From: Andrea Bianco Date: Sat, 15 Jan 2022 17:18:57 +0000 (+0100) Subject: Built motion from commit 2fae14ec.|2.5.47 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png//%22%27?a=commitdiff_plain;h=8c12afb2731d16631dffd517ed20a9f330190f09;p=motion2.git Built motion from commit 2fae14ec.|2.5.47 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8f2cf7c..0c70c9a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-15T12:54:17.186Z", + "time": "2022-01-15T17:05:30.472Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8f42abc..8e84d96 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-15T12:54:17.186Z", + "time": "2022-01-15T17:05:30.472Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index decf48b..b91f521 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 _0xd877=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','VIRTUAL','getDataValue','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x5b5144,_0x3c94ec){var _0x27dbd0=function(_0x51efd1){while(--_0x51efd1){_0x5b5144['push'](_0x5b5144['shift']());}};_0x27dbd0(++_0x3c94ec);}(_0xd877,0xcf));var _0x7d87=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd877[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d87('0x0')],'get':function(_0x4d853d){return this[_0x7d87('0x1')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7d87('0x2'),_0x7d87('0x3'),_0x7d87('0x4'),_0x7d87('0x5'),_0x7d87('0x6'),'browser',_0x7d87('0x7'),_0x7d87('0x8')]],'msg':_0x7d87('0x9')}},'comment':_0x7d87('0x9')},'data1':{'type':Sequelize[_0x7d87('0xa')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x7d87('0xa')](0x1000),'comment':_0x7d87('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7d87('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x7d87('0xa')](0x1000),'comments':_0x7d87('0xd')},'data6':{'type':Sequelize[_0x7d87('0xa')],'comments':_0x7d87('0xe')},'data7':{'type':Sequelize[_0x7d87('0xf')],'comments':_0x7d87('0x10')}}; \ No newline at end of file +var _0x2eec=['contactManager','integration','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x5702fb,_0x3f4105){var _0x2b0178=function(_0x3782c0){while(--_0x3782c0){_0x5702fb['push'](_0x5702fb['shift']());}};_0x2b0178(++_0x3f4105);}(_0x2eec,0xe6));var _0xc2ee=function(_0x53654e,_0x160bcc){_0x53654e=_0x53654e-0x0;var _0x3e5207=_0x2eec[_0x53654e];return _0x3e5207;};'use strict';var Sequelize=require(_0xc2ee('0x0'));module[_0xc2ee('0x1')]={'name':{'type':Sequelize[_0xc2ee('0x2')],'get':function(_0x31c363){return this[_0xc2ee('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xc2ee('0x4'),_0xc2ee('0x5'),'motionbar','jscripty',_0xc2ee('0x6'),_0xc2ee('0x7'),_0xc2ee('0x8'),_0xc2ee('0x9')]],'msg':_0xc2ee('0xa')}},'comment':_0xc2ee('0xa')},'data1':{'type':Sequelize[_0xc2ee('0xb')](0x1000),'comment':_0xc2ee('0xc')},'data2':{'type':Sequelize[_0xc2ee('0xb')](0x1000),'comment':_0xc2ee('0xd')},'data3':{'type':Sequelize[_0xc2ee('0xb')](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[_0xc2ee('0xb')](0x1000),'comments':_0xc2ee('0xe')},'data5':{'type':Sequelize[_0xc2ee('0xb')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xc2ee('0xb')],'comments':_0xc2ee('0xf')},'data7':{'type':Sequelize[_0xc2ee('0x10')],'comments':_0xc2ee('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 0c97c2c..837d706 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 _0xba31=['count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','update','Action','find','params','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','end','status','offset','undefined','limit'];(function(_0x38fa20,_0x301993){var _0x4ce943=function(_0x99fe7e){while(--_0x99fe7e){_0x38fa20['push'](_0x38fa20['shift']());}};_0x4ce943(++_0x301993);}(_0xba31,0x17a));var _0x1ba3=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xba31[_0x54edc9];return _0x2ae7a9;};'use strict';var emlformat=require(_0x1ba3('0x0'));var rimraf=require(_0x1ba3('0x1'));var zipdir=require(_0x1ba3('0x2'));var jsonpatch=require(_0x1ba3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1ba3('0x4'));var Mustache=require(_0x1ba3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1ba3('0x6'));var csv=require(_0x1ba3('0x7'));var ejs=require(_0x1ba3('0x8'));var fs=require('fs');var fs_extra=require(_0x1ba3('0x9'));var _=require('lodash');var squel=require(_0x1ba3('0xa'));var crypto=require('crypto');var jsforce=require(_0x1ba3('0xb'));var deskjs=require(_0x1ba3('0xc'));var toCsv=require(_0x1ba3('0x7'));var querystring=require(_0x1ba3('0xd'));var Papa=require(_0x1ba3('0xe'));var Redis=require(_0x1ba3('0xf'));var authService=require(_0x1ba3('0x10'));var qs=require(_0x1ba3('0x11'));var as=require(_0x1ba3('0x12'));var hardwareService=require(_0x1ba3('0x13'));var logger=require('../../config/logger')(_0x1ba3('0x14'));var utils=require('../../config/utils');var config=require(_0x1ba3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x128e41,_0x7bda1e){_0x7bda1e=_0x7bda1e||0xcc;return function(_0x501f17){if(_0x501f17){return _0x128e41['sendStatus'](_0x7bda1e);}return _0x128e41['status'](_0x7bda1e)[_0x1ba3('0x16')]();};}function respondWithResult(_0x4c343e,_0x3bb4c0){_0x3bb4c0=_0x3bb4c0||0xc8;return function(_0x2fc798){if(_0x2fc798){return _0x4c343e[_0x1ba3('0x17')](_0x3bb4c0)['json'](_0x2fc798);}};}function respondWithFilteredResult(_0x9f79c9,_0x372f04){return function(_0x2b69ac){if(_0x2b69ac){var _0x2390d8=typeof _0x372f04[_0x1ba3('0x18')]===_0x1ba3('0x19')&&typeof _0x372f04[_0x1ba3('0x1a')]==='undefined';var _0x478fbe=_0x2b69ac[_0x1ba3('0x1b')];var _0x8b58d7=_0x2390d8?0x0:_0x372f04[_0x1ba3('0x18')];var _0x340b40=_0x2390d8?_0x2b69ac[_0x1ba3('0x1b')]:_0x372f04[_0x1ba3('0x18')]+_0x372f04['limit'];var _0x227b1a;if(_0x340b40>=_0x478fbe){_0x340b40=_0x478fbe;_0x227b1a=0xc8;}else{_0x227b1a=0xce;}_0x9f79c9[_0x1ba3('0x17')](_0x227b1a);return _0x9f79c9[_0x1ba3('0x1c')](_0x1ba3('0x1d'),_0x8b58d7+'-'+_0x340b40+'/'+_0x478fbe)['json'](_0x2b69ac);}return null;};}function patchUpdates(_0x4db163){return function(_0x390f3a){try{jsonpatch[_0x1ba3('0x1e')](_0x390f3a,_0x4db163,!![]);}catch(_0x5935d1){return BPromise[_0x1ba3('0x1f')](_0x5935d1);}return _0x390f3a[_0x1ba3('0x20')]();};}function saveUpdates(_0x1bba92,_0x2edeaa){return function(_0x46d37a){if(_0x46d37a){return _0x46d37a['update'](_0x1bba92)[_0x1ba3('0x21')](function(_0xe1781f){return _0xe1781f;});}return null;};}function removeEntity(_0x3c0bc7,_0x547a6a){return function(_0x1f1d48){if(_0x1f1d48){return _0x1f1d48[_0x1ba3('0x22')]()['then'](function(){_0x3c0bc7[_0x1ba3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22903b,_0xa717f9){return function(_0x44403b){if(!_0x44403b){_0x22903b[_0x1ba3('0x23')](0x194);}return _0x44403b;};}function handleError(_0x4d6c57,_0x54e917){_0x54e917=_0x54e917||0x1f4;return function(_0x442ed5){logger[_0x1ba3('0x24')](_0x442ed5[_0x1ba3('0x25')]);if(_0x442ed5[_0x1ba3('0x26')]){delete _0x442ed5[_0x1ba3('0x26')];}_0x4d6c57[_0x1ba3('0x17')](_0x54e917)['send'](_0x442ed5);};}exports[_0x1ba3('0x27')]=function(_0x478424,_0x20acad){if(_0x478424['body']['id']){delete _0x478424['body']['id'];}return db[_0x1ba3('0x28')][_0x1ba3('0x29')]({'where':{'id':_0x478424[_0x1ba3('0x2a')]['id']}})[_0x1ba3('0x21')](handleEntityNotFound(_0x20acad,null))['then'](saveUpdates(_0x478424[_0x1ba3('0x2b')],null))['then'](respondWithResult(_0x20acad,null))[_0x1ba3('0x2c')](handleError(_0x20acad,null));};exports[_0x1ba3('0x22')]=function(_0x4e0d49,_0x220d93){return db[_0x1ba3('0x28')][_0x1ba3('0x29')]({'where':{'id':_0x4e0d49[_0x1ba3('0x2a')]['id']}})[_0x1ba3('0x21')](handleEntityNotFound(_0x220d93,null))['then'](removeEntity(_0x220d93,null))['catch'](handleError(_0x220d93,null));}; \ No newline at end of file +var _0x4753=['moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','body','find','params','catch','Action','eml-format','zip-dir','request-promise'];(function(_0x32f75b,_0x16cde7){var _0x26f5c7=function(_0x2f80b8){while(--_0x2f80b8){_0x32f75b['push'](_0x32f75b['shift']());}};_0x26f5c7(++_0x16cde7);}(_0x4753,0x84));var _0x3475=function(_0x4ad9b3,_0x22fef3){_0x4ad9b3=_0x4ad9b3-0x0;var _0x11c321=_0x4753[_0x4ad9b3];return _0x11c321;};'use strict';var emlformat=require(_0x3475('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3475('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3475('0x2'));var moment=require(_0x3475('0x3'));var BPromise=require(_0x3475('0x4'));var Mustache=require(_0x3475('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3475('0x6'));var csv=require(_0x3475('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3475('0x8'));var _=require(_0x3475('0x9'));var squel=require(_0x3475('0xa'));var crypto=require('crypto');var jsforce=require(_0x3475('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3475('0xc'));var Redis=require(_0x3475('0xd'));var authService=require(_0x3475('0xe'));var qs=require(_0x3475('0xf'));var as=require(_0x3475('0x10'));var hardwareService=require(_0x3475('0x11'));var logger=require('../../config/logger')(_0x3475('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3475('0x13'));var db=require(_0x3475('0x14'))['db'];function respondWithStatusCode(_0x2801f8,_0x26743a){_0x26743a=_0x26743a||0xcc;return function(_0x29668e){if(_0x29668e){return _0x2801f8[_0x3475('0x15')](_0x26743a);}return _0x2801f8[_0x3475('0x16')](_0x26743a)[_0x3475('0x17')]();};}function respondWithResult(_0x1991a1,_0xd408cb){_0xd408cb=_0xd408cb||0xc8;return function(_0x4d65cc){if(_0x4d65cc){return _0x1991a1['status'](_0xd408cb)['json'](_0x4d65cc);}};}function respondWithFilteredResult(_0x30098c,_0x1b30bf){return function(_0x1e6a4e){if(_0x1e6a4e){var _0x537a1e=typeof _0x1b30bf[_0x3475('0x18')]===_0x3475('0x19')&&typeof _0x1b30bf[_0x3475('0x1a')]===_0x3475('0x19');var _0x1c2043=_0x1e6a4e[_0x3475('0x1b')];var _0x4b6a69=_0x537a1e?0x0:_0x1b30bf[_0x3475('0x18')];var _0x20b00f=_0x537a1e?_0x1e6a4e[_0x3475('0x1b')]:_0x1b30bf[_0x3475('0x18')]+_0x1b30bf[_0x3475('0x1a')];var _0x10096c;if(_0x20b00f>=_0x1c2043){_0x20b00f=_0x1c2043;_0x10096c=0xc8;}else{_0x10096c=0xce;}_0x30098c[_0x3475('0x16')](_0x10096c);return _0x30098c[_0x3475('0x1c')](_0x3475('0x1d'),_0x4b6a69+'-'+_0x20b00f+'/'+_0x1c2043)[_0x3475('0x1e')](_0x1e6a4e);}return null;};}function patchUpdates(_0xe1a150){return function(_0x1ecff8){try{jsonpatch['apply'](_0x1ecff8,_0xe1a150,!![]);}catch(_0x488bc7){return BPromise[_0x3475('0x1f')](_0x488bc7);}return _0x1ecff8[_0x3475('0x20')]();};}function saveUpdates(_0x25fc30,_0x5ded07){return function(_0x220ac7){if(_0x220ac7){return _0x220ac7[_0x3475('0x21')](_0x25fc30)['then'](function(_0x465a76){return _0x465a76;});}return null;};}function removeEntity(_0x1ba636,_0x391435){return function(_0x49b521){if(_0x49b521){return _0x49b521[_0x3475('0x22')]()[_0x3475('0x23')](function(){_0x1ba636[_0x3475('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522b88,_0x2cf552){return function(_0x5e7d40){if(!_0x5e7d40){_0x522b88['sendStatus'](0x194);}return _0x5e7d40;};}function handleError(_0x5e9dd2,_0x2c1fb3){_0x2c1fb3=_0x2c1fb3||0x1f4;return function(_0x5318aa){logger[_0x3475('0x24')](_0x5318aa[_0x3475('0x25')]);if(_0x5318aa[_0x3475('0x26')]){delete _0x5318aa[_0x3475('0x26')];}_0x5e9dd2[_0x3475('0x16')](_0x2c1fb3)[_0x3475('0x27')](_0x5318aa);};}exports[_0x3475('0x21')]=function(_0x14b080,_0x3dcd89){if(_0x14b080[_0x3475('0x28')]['id']){delete _0x14b080[_0x3475('0x28')]['id'];}return db['Action'][_0x3475('0x29')]({'where':{'id':_0x14b080[_0x3475('0x2a')]['id']}})[_0x3475('0x23')](handleEntityNotFound(_0x3dcd89,null))[_0x3475('0x23')](saveUpdates(_0x14b080[_0x3475('0x28')],null))[_0x3475('0x23')](respondWithResult(_0x3dcd89,null))[_0x3475('0x2b')](handleError(_0x3dcd89,null));};exports[_0x3475('0x22')]=function(_0x32ea27,_0x32bc0e){return db[_0x3475('0x2c')]['find']({'where':{'id':_0x32ea27[_0x3475('0x2a')]['id']}})['then'](handleEntityNotFound(_0x32bc0e,null))['then'](removeEntity(_0x32bc0e,null))['catch'](handleError(_0x32bc0e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7c19ad1..5e35a6f 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 _0x4dc2=['rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x47c983,_0x5a2896){var _0x3e7cc3=function(_0x119c26){while(--_0x119c26){_0x47c983['push'](_0x47c983['shift']());}};_0x3e7cc3(++_0x5a2896);}(_0x4dc2,0xf5));var _0x24dc=function(_0x403fbd,_0x5f3e3d){_0x403fbd=_0x403fbd-0x0;var _0x2bbf8b=_0x4dc2[_0x403fbd];return _0x2bbf8b;};'use strict';var _=require(_0x24dc('0x0'));var util=require(_0x24dc('0x1'));var logger=require(_0x24dc('0x2'))(_0x24dc('0x3'));var moment=require(_0x24dc('0x4'));var BPromise=require('bluebird');var rp=require(_0x24dc('0x5'));var fs=require('fs');var path=require(_0x24dc('0x6'));var rimraf=require(_0x24dc('0x7'));var config=require(_0x24dc('0x8'));var attributes=require(_0x24dc('0x9'));module['exports']=function(_0x3a1844,_0x48471c){return _0x3a1844['define'](_0x24dc('0xa'),attributes,{'tableName':_0x24dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c31=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','api','moment','request-promise'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x2c31,0x13f));var _0x12c3=function(_0x4a4a82,_0x172322){_0x4a4a82=_0x4a4a82-0x0;var _0x4d069b=_0x2c31[_0x4a4a82];return _0x4d069b;};'use strict';var _=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var logger=require('../../config/logger')(_0x12c3('0x2'));var moment=require(_0x12c3('0x3'));var BPromise=require('bluebird');var rp=require(_0x12c3('0x4'));var fs=require('fs');var path=require(_0x12c3('0x5'));var rimraf=require(_0x12c3('0x6'));var config=require(_0x12c3('0x7'));var attributes=require(_0x12c3('0x8'));module[_0x12c3('0x9')]=function(_0x273c40,_0x1e63bf){return _0x273c40[_0x12c3('0xa')]('Action',attributes,{'tableName':_0x12c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index fb99169..1f56247 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0xf494,0x1c6));var _0x4f49=function(_0x531552,_0x2c78b4){_0x531552=_0x531552-0x0;var _0x3e0076=_0xf494[_0x531552];return _0x3e0076;};'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);});});} \ No newline at end of file +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(_0x3a5ab4,_0x56f591){var _0x4838f9=function(_0x4750ac){while(--_0x4750ac){_0x3a5ab4['push'](_0x3a5ab4['shift']());}};_0x4838f9(++_0x56f591);}(_0xabce,0x103));var _0xeabc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xabce[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 2ce1cf9..90cca20 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 _0xb6d7=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy'];(function(_0x12ab13,_0xb4a491){var _0x1a272c=function(_0x720ed4){while(--_0x720ed4){_0x12ab13['push'](_0x12ab13['shift']());}};_0x1a272c(++_0xb4a491);}(_0xb6d7,0x17a));var _0x7b6d=function(_0x386019,_0x1eac10){_0x386019=_0x386019-0x0;var _0x253833=_0xb6d7[_0x386019];return _0x253833;};'use strict';var multer=require(_0x7b6d('0x0'));var util=require(_0x7b6d('0x1'));var path=require(_0x7b6d('0x2'));var timeout=require(_0x7b6d('0x3'));var express=require(_0x7b6d('0x4'));var router=express[_0x7b6d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7b6d('0x6'));var interaction=require(_0x7b6d('0x7'));var config=require(_0x7b6d('0x8'));var controller=require(_0x7b6d('0x9'));router['put'](_0x7b6d('0xa'),auth[_0x7b6d('0xb')](),controller['update']);router[_0x7b6d('0xc')]('/:id',auth[_0x7b6d('0xb')](),controller[_0x7b6d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2506=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','update','delete','exports','util'];(function(_0x49af8b,_0x48d216){var _0x4f9e96=function(_0x3d39f7){while(--_0x3d39f7){_0x49af8b['push'](_0x49af8b['shift']());}};_0x4f9e96(++_0x48d216);}(_0x2506,0x15f));var _0x6250=function(_0x327aa9,_0x52ffa3){_0x327aa9=_0x327aa9-0x0;var _0x166bf2=_0x2506[_0x327aa9];return _0x166bf2;};'use strict';var multer=require('multer');var util=require(_0x6250('0x0'));var path=require(_0x6250('0x1'));var timeout=require(_0x6250('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6250('0x3'));var auth=require(_0x6250('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6250('0x5'));var controller=require('./action.controller');router['put'](_0x6250('0x6'),auth[_0x6250('0x7')](),controller[_0x6250('0x8')]);router[_0x6250('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6250('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7357427..88dbf4f 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x2675,0x75));var _0x5267=function(_0x3aab30,_0x4dc40d){_0x3aab30=_0x3aab30-0x0;var _0x57d644=_0x2675[_0x3aab30];return _0x57d644;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x2f8ed4,_0x295402){var _0x543bff=function(_0x3f6dca){while(--_0x3f6dca){_0x2f8ed4['push'](_0x2f8ed4['shift']());}};_0x543bff(++_0x295402);}(_0xeec6,0x1c2));var _0x6eec=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xeec6[_0x126fb9];return _0xc8a3b1;};'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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ab0070b..68b262a 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 _0xfc8f=['path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','user','get','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','UNIX_TIMESTAMP(%s)','operator','keyBy','MetricId','clone','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','../../files/reports','savename','countTable','COUNT(*)','run','runReport','MAX(%s)','AVG(%s)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x128437,_0x588bab){var _0x27ca7a=function(_0x2f9765){while(--_0x2f9765){_0x128437['push'](_0x128437['shift']());}};_0x27ca7a(++_0x588bab);}(_0xfc8f,0xa0));var _0xffc8=function(_0x21bc1d,_0x5cf2f7){_0x21bc1d=_0x21bc1d-0x0;var _0x4a9c53=_0xfc8f[_0x21bc1d];return _0x4a9c53;};'use strict';var emlformat=require(_0xffc8('0x0'));var rimraf=require(_0xffc8('0x1'));var zipdir=require(_0xffc8('0x2'));var jsonpatch=require(_0xffc8('0x3'));var rp=require('request-promise');var moment=require(_0xffc8('0x4'));var BPromise=require(_0xffc8('0x5'));var Mustache=require(_0xffc8('0x6'));var util=require(_0xffc8('0x7'));var path=require(_0xffc8('0x8'));var sox=require(_0xffc8('0x9'));var csv=require('to-csv');var ejs=require(_0xffc8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffc8('0xb'));var crypto=require(_0xffc8('0xc'));var jsforce=require(_0xffc8('0xd'));var deskjs=require(_0xffc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xffc8('0xf'));var Papa=require(_0xffc8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffc8('0x11'));var logger=require(_0xffc8('0x12'))(_0xffc8('0x13'));var utils=require(_0xffc8('0x14'));var config=require(_0xffc8('0x15'));var licenseUtil=require(_0xffc8('0x16'));var db=require(_0xffc8('0x17'))['db'];var dbH=require(_0xffc8('0x17'))[_0xffc8('0x18')];function respondWithStatusCode(_0x4464bf,_0x61308a){_0x61308a=_0x61308a||0xcc;return function(_0x51c31c){if(_0x51c31c){return _0x4464bf[_0xffc8('0x19')](_0x61308a);}return _0x4464bf[_0xffc8('0x1a')](_0x61308a)[_0xffc8('0x1b')]();};}function respondWithResult(_0x4542c6,_0x56dd24){_0x56dd24=_0x56dd24||0xc8;return function(_0x4dfc77){if(_0x4dfc77){return _0x4542c6[_0xffc8('0x1a')](_0x56dd24)[_0xffc8('0x1c')](_0x4dfc77);}};}function respondWithFilteredResult(_0x324f2a,_0x27f1fc){return function(_0x3bb14b){if(_0x3bb14b){var _0x4d8c3c=typeof _0x27f1fc[_0xffc8('0x1d')]===_0xffc8('0x1e')&&typeof _0x27f1fc[_0xffc8('0x1f')]===_0xffc8('0x1e');var _0x239f23=_0x3bb14b[_0xffc8('0x20')];var _0x326a4a=_0x4d8c3c?0x0:_0x27f1fc[_0xffc8('0x1d')];var _0x4b9ac9=_0x4d8c3c?_0x3bb14b[_0xffc8('0x20')]:_0x27f1fc['offset']+_0x27f1fc[_0xffc8('0x1f')];var _0x2baba7;if(_0x4b9ac9>=_0x239f23){_0x4b9ac9=_0x239f23;_0x2baba7=0xc8;}else{_0x2baba7=0xce;}_0x324f2a[_0xffc8('0x1a')](_0x2baba7);return _0x324f2a[_0xffc8('0x21')](_0xffc8('0x22'),_0x326a4a+'-'+_0x4b9ac9+'/'+_0x239f23)[_0xffc8('0x1c')](_0x3bb14b);}return null;};}function patchUpdates(_0x3d9b2a){return function(_0x17fd8d){try{jsonpatch['apply'](_0x17fd8d,_0x3d9b2a,!![]);}catch(_0x1f909c){return BPromise['reject'](_0x1f909c);}return _0x17fd8d[_0xffc8('0x23')]();};}function saveUpdates(_0x24de04,_0x5e982f){return function(_0x212745){if(_0x212745){return _0x212745[_0xffc8('0x24')](_0x24de04)[_0xffc8('0x25')](function(_0x35ab3d){return _0x35ab3d;});}return null;};}function removeEntity(_0x3885ff,_0x57c6f4){return function(_0x100163){if(_0x100163){return _0x100163[_0xffc8('0x26')]()[_0xffc8('0x25')](function(){var _0x495221=_0x100163['get']({'plain':!![]});var _0x14dc5d=_0xffc8('0x27');return db[_0xffc8('0x28')][_0xffc8('0x26')]({'where':{'type':_0x14dc5d,'resourceId':_0x495221['id']}})[_0xffc8('0x25')](function(){return _0x100163;});})[_0xffc8('0x25')](function(){_0x3885ff[_0xffc8('0x1a')](0xcc)[_0xffc8('0x1b')]();});}};}function handleEntityNotFound(_0x442227,_0x48e931){return function(_0x1c3155){if(!_0x1c3155){_0x442227[_0xffc8('0x19')](0x194);}return _0x1c3155;};}function handleError(_0x3abf91,_0x393caa){_0x393caa=_0x393caa||0x1f4;return function(_0x32439f){logger[_0xffc8('0x29')](_0x32439f[_0xffc8('0x2a')]);if(_0x32439f[_0xffc8('0x2b')]){delete _0x32439f[_0xffc8('0x2b')];}_0x3abf91[_0xffc8('0x1a')](_0x393caa)[_0xffc8('0x2c')](_0x32439f);};}exports[_0xffc8('0x2d')]=function(_0x1bd6ad,_0x58d9fe){var _0x328d86={},_0x3e5b71={},_0x11a169={'count':0x0,'rows':[]};var _0x282906=_['map'](db[_0xffc8('0x2e')][_0xffc8('0x2f')],function(_0xf9036d){return{'name':_0xf9036d[_0xffc8('0x30')],'type':_0xf9036d[_0xffc8('0x31')][_0xffc8('0x32')]};});_0x3e5b71[_0xffc8('0x33')]=_['map'](_0x282906,_0xffc8('0x2b'));_0x3e5b71[_0xffc8('0x34')]=_['keys'](_0x1bd6ad['query']);_0x3e5b71[_0xffc8('0x35')]=_[_0xffc8('0x36')](_0x3e5b71[_0xffc8('0x33')],_0x3e5b71[_0xffc8('0x34')]);_0x328d86[_0xffc8('0x37')]=_[_0xffc8('0x36')](_0x3e5b71[_0xffc8('0x33')],qs[_0xffc8('0x38')](_0x1bd6ad[_0xffc8('0x34')][_0xffc8('0x38')]));_0x328d86[_0xffc8('0x37')]=_0x328d86[_0xffc8('0x37')]['length']?_0x328d86[_0xffc8('0x37')]:_0x3e5b71[_0xffc8('0x33')];if(!_0x1bd6ad[_0xffc8('0x34')][_0xffc8('0x39')]('nolimit')){_0x328d86[_0xffc8('0x1f')]=qs[_0xffc8('0x1f')](_0x1bd6ad[_0xffc8('0x34')][_0xffc8('0x1f')]);_0x328d86[_0xffc8('0x1d')]=qs[_0xffc8('0x1d')](_0x1bd6ad[_0xffc8('0x34')]['offset']);}_0x328d86[_0xffc8('0x3a')]=qs[_0xffc8('0x3b')](_0x1bd6ad['query'][_0xffc8('0x3b')]);_0x328d86[_0xffc8('0x3c')]=qs[_0xffc8('0x35')](_['pick'](_0x1bd6ad[_0xffc8('0x34')],_0x3e5b71[_0xffc8('0x35')]),_0x282906);if(_0x1bd6ad['query'][_0xffc8('0x3d')]){_0x328d86[_0xffc8('0x3c')]=_[_0xffc8('0x3e')](_0x328d86[_0xffc8('0x3c')],{'$or':_[_0xffc8('0x3f')](_0x282906,function(_0x23dcc7){if(_0x23dcc7['type']!==_0xffc8('0x40')){var _0x261285={};_0x261285[_0x23dcc7['name']]={'$like':'%'+_0x1bd6ad[_0xffc8('0x34')][_0xffc8('0x3d')]+'%'};return _0x261285;}})});}_0x328d86=_['merge']({},_0x328d86,_0x1bd6ad[_0xffc8('0x41')]);var _0x4dcda4={'where':_0x328d86[_0xffc8('0x3c')]};return db[_0xffc8('0x2e')]['count'](_0x4dcda4)[_0xffc8('0x25')](function(_0x4f9930){_0x11a169[_0xffc8('0x20')]=_0x4f9930;if(_0x1bd6ad[_0xffc8('0x34')][_0xffc8('0x42')]){_0x328d86[_0xffc8('0x43')]=[{'all':!![]}];}return db[_0xffc8('0x2e')][_0xffc8('0x44')](_0x328d86);})[_0xffc8('0x25')](function(_0x19cf79){_0x11a169[_0xffc8('0x45')]=_0x19cf79;return _0x11a169;})[_0xffc8('0x25')](respondWithFilteredResult(_0x58d9fe,_0x328d86))[_0xffc8('0x46')](handleError(_0x58d9fe,null));};exports[_0xffc8('0x47')]=function(_0x5146f8,_0x21f5a4){var _0x447470={'raw':![],'where':{'id':_0x5146f8[_0xffc8('0x48')]['id']}},_0x202113={};_0x202113['model']=_['keys'](db[_0xffc8('0x2e')][_0xffc8('0x2f')]);_0x202113[_0xffc8('0x34')]=_[_0xffc8('0x49')](_0x5146f8[_0xffc8('0x34')]);_0x202113[_0xffc8('0x35')]=_[_0xffc8('0x36')](_0x202113['model'],_0x202113[_0xffc8('0x34')]);_0x447470['attributes']=_[_0xffc8('0x36')](_0x202113['model'],qs[_0xffc8('0x38')](_0x5146f8['query'][_0xffc8('0x38')]));_0x447470[_0xffc8('0x37')]=_0x447470[_0xffc8('0x37')][_0xffc8('0x4a')]?_0x447470[_0xffc8('0x37')]:_0x202113['model'];if(_0x5146f8['query'][_0xffc8('0x42')]){_0x447470[_0xffc8('0x43')]=[{'all':!![]}];}_0x447470=_['merge']({},_0x447470,_0x5146f8[_0xffc8('0x41')]);return db[_0xffc8('0x2e')]['find'](_0x447470)[_0xffc8('0x25')](handleEntityNotFound(_0x21f5a4,null))[_0xffc8('0x25')](respondWithResult(_0x21f5a4,null))[_0xffc8('0x46')](handleError(_0x21f5a4,null));};exports[_0xffc8('0x4b')]=function(_0x4d0afb,_0x4f75c9){return db[_0xffc8('0x2e')][_0xffc8('0x4b')](_0x4d0afb['body'],{})['then'](function(_0x27fa13){var _0x68ef02=_0x4d0afb[_0xffc8('0x4c')][_0xffc8('0x4d')]({'plain':!![]});if(!_0x68ef02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x68ef02[_0xffc8('0x4e')]==='user'){var _0x4006fb=_0x27fa13[_0xffc8('0x4d')]({'plain':!![]});var _0x24aa94=_0xffc8('0x4f');return db[_0xffc8('0x50')][_0xffc8('0x51')]({'where':{'name':_0x24aa94,'userProfileId':_0x68ef02[_0xffc8('0x52')]},'raw':!![]})[_0xffc8('0x25')](function(_0x39016b){if(_0x39016b&&_0x39016b[_0xffc8('0x53')]===0x0){return db[_0xffc8('0x28')][_0xffc8('0x4b')]({'name':_0x4006fb[_0xffc8('0x2b')],'resourceId':_0x4006fb['id'],'type':_0xffc8('0x27'),'sectionId':_0x39016b['id']},{})[_0xffc8('0x25')](function(){return _0x27fa13;});}else{return _0x27fa13;}})['catch'](function(_0xff4dfc){logger[_0xffc8('0x29')](_0xffc8('0x54'),_0xff4dfc);throw _0xff4dfc;});}return _0x27fa13;})[_0xffc8('0x25')](respondWithResult(_0x4f75c9,0xc9))[_0xffc8('0x46')](handleError(_0x4f75c9,null));};exports['update']=function(_0x3d8392,_0x30e0cc){if(_0x3d8392[_0xffc8('0x55')]['id']){delete _0x3d8392['body']['id'];}return db[_0xffc8('0x2e')][_0xffc8('0x51')]({'where':{'id':_0x3d8392[_0xffc8('0x48')]['id']}})[_0xffc8('0x25')](handleEntityNotFound(_0x30e0cc,null))[_0xffc8('0x25')](saveUpdates(_0x3d8392[_0xffc8('0x55')],null))[_0xffc8('0x25')](respondWithResult(_0x30e0cc,null))[_0xffc8('0x46')](handleError(_0x30e0cc,null));};exports[_0xffc8('0x26')]=function(_0x37ecab,_0x119c1c){return db['AnalyticCustomReport'][_0xffc8('0x51')]({'where':{'id':_0x37ecab[_0xffc8('0x48')]['id']}})[_0xffc8('0x25')](handleEntityNotFound(_0x119c1c,null))['then'](removeEntity(_0x119c1c,null))[_0xffc8('0x46')](handleError(_0x119c1c,null));};exports[_0xffc8('0x56')]=function(_0x5dbaa7,_0x27fb50){var _0xdf0ebd=0xa;var _0x37eb2a=[_0xffc8('0x57'),_0xffc8('0x58'),_0xffc8('0x59'),_0xffc8('0x5a')];var _0x311d81={'SUM':_0xffc8('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xffc8('0x5c'),'MAX':'MAX(%s)','MIN':_0xffc8('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xffc8('0x5e'),'GROUP_CONCAT ASC':_0xffc8('0x5f'),'GROUP_CONCAT DESC':_0xffc8('0x60')};var _0x36b9bf={'SEC_TO_TIME':_0xffc8('0x61'),'DATE':_0xffc8('0x62'),'HOUR':_0xffc8('0x63'),'ROUND':_0xffc8('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1db047=function(_0x45cb80){return!_[_0xffc8('0x65')]([_0xffc8('0x66'),_0xffc8('0x67'),_0xffc8('0x68'),_0xffc8('0x69')],_0x45cb80);};var _0x3b809c=function(_0x28ca4a){if(!_0x28ca4a||!_0x28ca4a[_0xffc8('0x6a')][_0xffc8('0x4a')]){return'';}for(var _0x14b890='(',_0x5121da=0x0;_0x5121da<_0x28ca4a['rules'][_0xffc8('0x4a')];_0x5121da+=0x1){_0x5121da>0x0&&(_0x14b890+='\x20'+_0x28ca4a['operator']+'\x20');_0x14b890+=_0x28ca4a['rules'][_0x5121da][_0xffc8('0x6b')]?_0x3b809c(_0x28ca4a[_0xffc8('0x6a')][_0x5121da][_0xffc8('0x6b')]):_0x28ca4a[_0xffc8('0x6a')][_0x5121da][_0xffc8('0x6c')]+'\x20'+_0x28ca4a[_0xffc8('0x6a')][_0x5121da][_0xffc8('0x6d')]+(_0x1db047(_0x28ca4a['rules'][_0x5121da][_0xffc8('0x6d')])?'\x20'+_0x28ca4a[_0xffc8('0x6a')][_0x5121da][_0xffc8('0x6e')]:'');}return _0x14b890+')';};var _0x538b14={'where':{'id':_0x5dbaa7['params']['id']}},_0x58b6ce,_0x2216f5,_0x26c0bc,_0x8dddcb,_0x250525;_0x538b14=_[_0xffc8('0x3e')]({},_0x538b14,_0x5dbaa7[_0xffc8('0x41')]);return db[_0xffc8('0x2e')]['find'](_0x538b14)['then'](function(_0x1ccc5e){if(_0x1ccc5e){_0x58b6ce=_0x1ccc5e;return _0x1ccc5e[_0xffc8('0x6f')]();}return null;})[_0xffc8('0x25')](function(_0x303155){if(_0x303155){if(!_0x303155['length']){throw new db[(_0xffc8('0x70'))][(_0xffc8('0x71'))](_0xffc8('0x72'),0x193);}_0x2216f5=_0x303155;return db[_0xffc8('0x73')][_0xffc8('0x44')]({'raw':!![]});}return null;})[_0xffc8('0x25')](function(_0x1ab127){if(_0x1ab127){_0x26c0bc=_['keyBy'](_0x1ab127,'id');var _0x5dc5da;var _0x217cdb=squel[_0xffc8('0x74')]();_0x217cdb[_0xffc8('0x75')](_0x58b6ce[_0xffc8('0x76')]);for(var _0x12659f=0x0;_0x12659f<_0x2216f5['length'];_0x12659f+=0x1){_0x5dc5da=_0x2216f5[_0x12659f]['MetricId']?_0x26c0bc[_0x2216f5[_0x12659f]['MetricId']][_0xffc8('0x77')]:_0x2216f5[_0x12659f]['field'];_0x5dc5da=_0x2216f5[_0x12659f]['function']?_[_0xffc8('0x78')](_0x311d81[_0x2216f5[_0x12659f][_0xffc8('0x79')]],'%s',_0x5dc5da):_0x5dc5da;_0x5dc5da=_0x2216f5[_0x12659f]['format']?_[_0xffc8('0x78')](_0x36b9bf[_0x2216f5[_0x12659f][_0xffc8('0x7a')]],'%s',_0x5dc5da):_0x5dc5da;if(_0x2216f5[_0x12659f][_0xffc8('0x7b')]){_0x217cdb[_0xffc8('0x6b')](_0x5dc5da);}_0x2216f5[_0x12659f][_0xffc8('0x7c')]&&_0x217cdb['order'](_0x5dc5da,_0x2216f5[_0x12659f][_0xffc8('0x7c')]===_0xffc8('0x7d')?![]:!![]);_0x217cdb[_0xffc8('0x6c')](_0x5dc5da,_0x2216f5[_0x12659f][_0xffc8('0x7e')]||_0x5dc5da);}if(_0x58b6ce[_0xffc8('0x7f')]){_0x58b6ce[_0xffc8('0x7f')]=JSON['parse'](_0x58b6ce[_0xffc8('0x7f')]);for(var _0x5b362d=0x0;_0x5b362d<_0x58b6ce[_0xffc8('0x7f')]['length'];_0x5b362d+=0x1){if(_0x58b6ce[_0xffc8('0x7f')][_0x5b362d]['type']&&_[_0xffc8('0x65')](_0x37eb2a,_0x58b6ce['joins'][_0x5b362d]['type'])&&_0x58b6ce['joins'][_0x5b362d]['parentKey']&&_0x58b6ce[_0xffc8('0x7f')][_0x5b362d]['foreignTable']&&_0x58b6ce['joins'][_0x5b362d][_0xffc8('0x80')]){_0x217cdb[_0x58b6ce[_0xffc8('0x7f')][_0x5b362d]['type']](_0x58b6ce['joins'][_0x5b362d][_0xffc8('0x81')],null,util[_0xffc8('0x7a')](_0xffc8('0x82'),_0x58b6ce[_0xffc8('0x76')],_0x58b6ce[_0xffc8('0x7f')][_0x5b362d][_0xffc8('0x83')],_0x58b6ce['joins'][_0x5b362d][_0xffc8('0x81')],_0x58b6ce[_0xffc8('0x7f')][_0x5b362d][_0xffc8('0x80')]));}}}if(_0x58b6ce[_0xffc8('0x84')]){_0x58b6ce[_0xffc8('0x84')]=JSON[_0xffc8('0x85')](_0x58b6ce[_0xffc8('0x84')]);_0x217cdb[_0xffc8('0x3c')](_0x3b809c(_0x58b6ce[_0xffc8('0x84')]['group']));}_0x250525=_0x217cdb['clone']();_0x217cdb['limit'](_0xdf0ebd);_0x217cdb[_0xffc8('0x1d')](0x0);logger[_0xffc8('0x86')](_0xffc8('0x87'),_0x217cdb[_0xffc8('0x88')]());return dbH[_0xffc8('0x89')][_0xffc8('0x34')](_0x217cdb[_0xffc8('0x88')](),{'type':dbH[_0xffc8('0x89')][_0xffc8('0x8a')][_0xffc8('0x8b')]});}})[_0xffc8('0x25')](respondWithResult(_0x27fb50,null))[_0xffc8('0x46')](handleError(_0x27fb50,null));};function runReport(_0x962763,_0x5dc242,_0x3a6ce5){var _0x55b463=_0x5dc242[_0xffc8('0x2b')];var _0x4d3bda=0xa;var _0x58b8e6=[_0xffc8('0x57'),_0xffc8('0x58'),_0xffc8('0x59'),_0xffc8('0x5a')];var _0x450691={'SUM':_0xffc8('0x5b'),'COUNT':_0xffc8('0x8c'),'COUNT DISTINCT':_0xffc8('0x5c'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xffc8('0x5e'),'GROUP_CONCAT ASC':_0xffc8('0x5f'),'GROUP_CONCAT DESC':_0xffc8('0x60')};var _0x5f337e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xffc8('0x62'),'HOUR':_0xffc8('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xffc8('0x8d')};var _0x44b6b3=function(_0x2196c6){return!_['includes']([_0xffc8('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xffc8('0x69')],_0x2196c6);};var _0x3a7d1d=function(_0x3cf7fe){if(!_0x3cf7fe||!_0x3cf7fe[_0xffc8('0x6a')][_0xffc8('0x4a')]){return'';}for(var _0x4a2463='(',_0xa6311c=0x0;_0xa6311c<_0x3cf7fe['rules'][_0xffc8('0x4a')];_0xa6311c+=0x1){_0xa6311c>0x0&&(_0x4a2463+='\x20'+_0x3cf7fe[_0xffc8('0x8e')]+'\x20');_0x4a2463+=_0x3cf7fe['rules'][_0xa6311c][_0xffc8('0x6b')]?_0x3a7d1d(_0x3cf7fe['rules'][_0xa6311c][_0xffc8('0x6b')]):_0x3cf7fe['rules'][_0xa6311c]['field']+'\x20'+_0x3cf7fe['rules'][_0xa6311c]['condition']+(_0x44b6b3(_0x3cf7fe[_0xffc8('0x6a')][_0xa6311c][_0xffc8('0x6d')])?'\x20'+_0x3cf7fe[_0xffc8('0x6a')][_0xa6311c]['value']:'');}return _0x4a2463+')';};var _0x584d07={'where':{'id':_0x962763['id']}},_0x5a1abb,_0x3ef204,_0x134f86,_0x19404a,_0x4190d6;_0x584d07=_[_0xffc8('0x3e')]({},_0x584d07,_0x3a6ce5);return db[_0xffc8('0x2e')][_0xffc8('0x51')](_0x584d07)['then'](function(_0x368946){if(_0x368946){_0x5a1abb=_0x368946;return _0x368946['getFields']();}return null;})[_0xffc8('0x25')](function(_0x1ef7b3){if(_0x1ef7b3){if(!_0x1ef7b3[_0xffc8('0x4a')]){throw new db[(_0xffc8('0x70'))]['ValidationErrorItem'](_0xffc8('0x72'),0x193);}_0x3ef204=_0x1ef7b3;return db['AnalyticMetric'][_0xffc8('0x44')]({'raw':!![]});}return null;})[_0xffc8('0x25')](function(_0x5615f2){if(_0x5615f2){_0x134f86=_[_0xffc8('0x8f')](_0x5615f2,'id');var _0x4c4217;var _0x13037e=squel[_0xffc8('0x74')]();_0x13037e['from'](_0x5a1abb['table']);for(var _0x517db2=0x0;_0x517db2<_0x3ef204[_0xffc8('0x4a')];_0x517db2+=0x1){_0x4c4217=_0x3ef204[_0x517db2][_0xffc8('0x90')]?_0x134f86[_0x3ef204[_0x517db2][_0xffc8('0x90')]][_0xffc8('0x77')]:_0x3ef204[_0x517db2]['field'];_0x4c4217=_0x3ef204[_0x517db2][_0xffc8('0x79')]?_[_0xffc8('0x78')](_0x450691[_0x3ef204[_0x517db2][_0xffc8('0x79')]],'%s',_0x4c4217):_0x4c4217;_0x4c4217=_0x3ef204[_0x517db2][_0xffc8('0x7a')]?_[_0xffc8('0x78')](_0x5f337e[_0x3ef204[_0x517db2][_0xffc8('0x7a')]],'%s',_0x4c4217):_0x4c4217;if(_0x3ef204[_0x517db2][_0xffc8('0x7b')]){_0x13037e[_0xffc8('0x6b')](_0x4c4217);}_0x3ef204[_0x517db2][_0xffc8('0x7c')]&&_0x13037e['order'](_0x4c4217,_0x3ef204[_0x517db2]['orderBy']===_0xffc8('0x7d')?![]:!![]);_0x13037e[_0xffc8('0x6c')](_0x4c4217,_0x3ef204[_0x517db2][_0xffc8('0x7e')]||_0x4c4217);}if(_0x5a1abb[_0xffc8('0x7f')]){_0x5a1abb['joins']=JSON[_0xffc8('0x85')](_0x5a1abb['joins']);for(var _0x34b9c8=0x0;_0x34b9c8<_0x5a1abb[_0xffc8('0x7f')]['length'];_0x34b9c8+=0x1){if(_0x5a1abb['joins'][_0x34b9c8][_0xffc8('0x31')]&&_[_0xffc8('0x65')](_0x58b8e6,_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8][_0xffc8('0x31')])&&_0x5a1abb['joins'][_0x34b9c8][_0xffc8('0x83')]&&_0x5a1abb['joins'][_0x34b9c8][_0xffc8('0x81')]&&_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8][_0xffc8('0x80')]){_0x13037e[_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8][_0xffc8('0x31')]](_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8][_0xffc8('0x81')],null,util[_0xffc8('0x7a')](_0xffc8('0x82'),_0x5a1abb[_0xffc8('0x76')],_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8][_0xffc8('0x83')],_0x5a1abb['joins'][_0x34b9c8][_0xffc8('0x81')],_0x5a1abb[_0xffc8('0x7f')][_0x34b9c8]['foreignKey']));}}}if(_0x5a1abb[_0xffc8('0x84')]){_0x5a1abb[_0xffc8('0x84')]=JSON[_0xffc8('0x85')](_0x5a1abb['conditions']);_0x13037e[_0xffc8('0x3c')](_0x3a7d1d(_0x5a1abb['conditions']['group']));}_0x4190d6=_0x13037e[_0xffc8('0x91')]();_0x13037e[_0xffc8('0x1f')](_0x4d3bda);_0x13037e[_0xffc8('0x1d')](0x0);return;}})['then'](function(){if(_0x5dc242[_0xffc8('0x92')]===_0xffc8('0x93')){return null;}var _0x5f3169=_[_0xffc8('0x3e')](_0x5dc242,{'name':_0x5dc242[_0xffc8('0x94')]||_0x5dc242[_0xffc8('0x2b')]||_0x5a1abb['name'],'basename':_0x55b463,'savename':util[_0xffc8('0x7a')](_0xffc8('0x95'),_0x5dc242['name']||_0x5a1abb[_0xffc8('0x2b')],require('randomstring')[_0xffc8('0x96')](0x4),_0x5dc242[_0xffc8('0x92')]||_0xffc8('0x97')),'reportId':_0x5a1abb['id'],'reportType':_0xffc8('0x98')});return db[_0xffc8('0x99')]['create'](_0x5f3169,{'raw':!![]});})[_0xffc8('0x25')](function(_0x3cec6f){if(_0x5a1abb[_0xffc8('0x76')]===_0xffc8('0x9a')){_0x4190d6[_0xffc8('0x3c')](_0x5a1abb[_0xffc8('0x76')]+_0xffc8('0x9b'),_0x5dc242[_0xffc8('0x9c')],_0x5dc242[_0xffc8('0x9d')]);}else{_0x4190d6['where'](_0x5a1abb['table']+_0xffc8('0x9e'),_0x5dc242[_0xffc8('0x9c')],_0x5dc242['endDate']);}if(_0x3cec6f){logger['info']('Run\x20Query:',_0x4190d6[_0xffc8('0x88')]());require(_0xffc8('0x9f'))['fork'](path[_0xffc8('0x57')](__dirname,'../../components/export/',_0x3cec6f['output']),[_0x3cec6f['id'],_0x4190d6[_0xffc8('0x88')](),path[_0xffc8('0x57')](__dirname,_0xffc8('0xa0'),_0x3cec6f[_0xffc8('0xa1')]),_0x55b463]);return _0x3cec6f;}else{var _0x33e069=squel[_0xffc8('0x74')]();_0x33e069[_0xffc8('0x75')]('('+_0x4190d6[_0xffc8('0x88')]()+')',_0xffc8('0xa2'));_0x33e069['field'](_0xffc8('0xa3'),_0xffc8('0x20'));_0x4190d6[_0xffc8('0x1f')](_0x5dc242[_0xffc8('0x1f')]||_0x4d3bda);_0x4190d6[_0xffc8('0x1d')](_0x5dc242[_0xffc8('0x1d')]||0x0);return dbH[_0xffc8('0x89')][_0xffc8('0x34')](_0x33e069[_0xffc8('0x88')](),{'type':dbH[_0xffc8('0x89')][_0xffc8('0x8a')][_0xffc8('0x8b')]})[_0xffc8('0x25')](function(_0x17d7a7){if(!_0x17d7a7[_0xffc8('0x4a')]){_0x19404a=0x0;}else{_0x19404a=_0x17d7a7[0x0]['count']||0x0;}return dbH[_0xffc8('0x89')][_0xffc8('0x34')](_0x4190d6[_0xffc8('0x88')](),{'type':dbH[_0xffc8('0x89')][_0xffc8('0x8a')][_0xffc8('0x8b')]});})[_0xffc8('0x25')](function(_0x2762ff){return{'rows':_0x2762ff||[],'count':_0x19404a};});}});}exports[_0xffc8('0xa4')]=function(_0x53ce74,_0x44e87b){return runReport(_0x53ce74['params'],_0x53ce74[_0xffc8('0x34')],_0x53ce74['options'])['then'](respondWithResult(_0x44e87b,null))[_0xffc8('0x46')](handleError(_0x44e87b,null));};exports[_0xffc8('0xa5')]=runReport;exports[_0xffc8('0x34')]=function(_0x41dcfa,_0x4e10c9){var _0x11e6c3=0xa;var _0x4002f5=[_0xffc8('0x57'),'left_join',_0xffc8('0x59'),_0xffc8('0x5a')];var _0x1a854f={'SUM':_0xffc8('0x5b'),'COUNT':_0xffc8('0x8c'),'COUNT DISTINCT':_0xffc8('0x5c'),'MAX':_0xffc8('0xa6'),'MIN':'MIN(%s)','AVG':_0xffc8('0xa7'),'GROUP_CONCAT':_0xffc8('0x5e'),'GROUP_CONCAT ASC':_0xffc8('0x5f'),'GROUP_CONCAT DESC':_0xffc8('0x60')};var _0x367b8f={'SEC_TO_TIME':_0xffc8('0x61'),'DATE':'DATE(%s)','HOUR':_0xffc8('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xffc8('0x8d')};var _0x42bb1f=function(_0x1e7df5){return!_[_0xffc8('0x65')](['IS\x20NULL',_0xffc8('0x67'),'IS\x20EMPTY',_0xffc8('0x69')],_0x1e7df5);};var _0x2f9ff5=function(_0x53c709){if(!_0x53c709||!_0x53c709[_0xffc8('0x6a')][_0xffc8('0x4a')]){return'';}for(var _0x40758d='(',_0xf4310a=0x0;_0xf4310a<_0x53c709[_0xffc8('0x6a')][_0xffc8('0x4a')];_0xf4310a+=0x1){_0xf4310a>0x0&&(_0x40758d+='\x20'+_0x53c709[_0xffc8('0x8e')]+'\x20');_0x40758d+=_0x53c709[_0xffc8('0x6a')][_0xf4310a][_0xffc8('0x6b')]?_0x2f9ff5(_0x53c709[_0xffc8('0x6a')][_0xf4310a][_0xffc8('0x6b')]):_0x53c709['rules'][_0xf4310a][_0xffc8('0x6c')]+'\x20'+_0x53c709[_0xffc8('0x6a')][_0xf4310a][_0xffc8('0x6d')]+(_0x42bb1f(_0x53c709[_0xffc8('0x6a')][_0xf4310a][_0xffc8('0x6d')])?'\x20'+_0x53c709[_0xffc8('0x6a')][_0xf4310a][_0xffc8('0x6e')]:'');}return _0x40758d+')';};var _0x558772={'where':{'id':_0x41dcfa[_0xffc8('0x48')]['id']}},_0x26d27e,_0x1b75d2,_0xb2b022,_0x47aeee,_0x2f85ed;_0x558772=_['merge']({},_0x558772,_0x41dcfa[_0xffc8('0x41')]);return db['AnalyticCustomReport'][_0xffc8('0x51')](_0x558772)[_0xffc8('0x25')](function(_0x55a93d){if(_0x55a93d){_0x26d27e=_0x55a93d;return _0x55a93d[_0xffc8('0x6f')]();}return null;})['then'](function(_0x387c5e){if(_0x387c5e){if(!_0x387c5e[_0xffc8('0x4a')]){throw new db[(_0xffc8('0x70'))][(_0xffc8('0x71'))](_0xffc8('0x72'),0x193);}_0x1b75d2=_0x387c5e;return db[_0xffc8('0x73')][_0xffc8('0x44')]({'raw':!![]});}return null;})[_0xffc8('0x25')](function(_0x5d34be){if(_0x5d34be){_0xb2b022=_[_0xffc8('0x8f')](_0x5d34be,'id');var _0x366d66;var _0x5788f7=squel[_0xffc8('0x74')]();_0x5788f7[_0xffc8('0x75')](_0x26d27e[_0xffc8('0x76')]);for(var _0x1bcb55=0x0;_0x1bcb55<_0x1b75d2[_0xffc8('0x4a')];_0x1bcb55+=0x1){_0x366d66=_0x1b75d2[_0x1bcb55]['MetricId']?_0xb2b022[_0x1b75d2[_0x1bcb55][_0xffc8('0x90')]][_0xffc8('0x77')]:_0x1b75d2[_0x1bcb55][_0xffc8('0x6c')];_0x366d66=_0x1b75d2[_0x1bcb55]['function']?_[_0xffc8('0x78')](_0x1a854f[_0x1b75d2[_0x1bcb55][_0xffc8('0x79')]],'%s',_0x366d66):_0x366d66;_0x366d66=_0x1b75d2[_0x1bcb55][_0xffc8('0x7a')]?_[_0xffc8('0x78')](_0x367b8f[_0x1b75d2[_0x1bcb55][_0xffc8('0x7a')]],'%s',_0x366d66):_0x366d66;if(_0x1b75d2[_0x1bcb55][_0xffc8('0x7b')]){_0x5788f7[_0xffc8('0x6b')](_0x366d66);}_0x1b75d2[_0x1bcb55][_0xffc8('0x7c')]&&_0x5788f7[_0xffc8('0x3a')](_0x366d66,_0x1b75d2[_0x1bcb55][_0xffc8('0x7c')]===_0xffc8('0x7d')?![]:!![]);_0x5788f7[_0xffc8('0x6c')](_0x366d66,_0x1b75d2[_0x1bcb55][_0xffc8('0x7e')]||_0x366d66);}if(_0x26d27e[_0xffc8('0x7f')]){_0x26d27e[_0xffc8('0x7f')]=JSON[_0xffc8('0x85')](_0x26d27e['joins']);for(var _0x582ae5=0x0;_0x582ae5<_0x26d27e['joins'][_0xffc8('0x4a')];_0x582ae5+=0x1){if(_0x26d27e[_0xffc8('0x7f')][_0x582ae5]['type']&&_['includes'](_0x4002f5,_0x26d27e[_0xffc8('0x7f')][_0x582ae5][_0xffc8('0x31')])&&_0x26d27e['joins'][_0x582ae5][_0xffc8('0x83')]&&_0x26d27e[_0xffc8('0x7f')][_0x582ae5][_0xffc8('0x81')]&&_0x26d27e[_0xffc8('0x7f')][_0x582ae5][_0xffc8('0x80')]){_0x5788f7[_0x26d27e[_0xffc8('0x7f')][_0x582ae5][_0xffc8('0x31')]](_0x26d27e['joins'][_0x582ae5][_0xffc8('0x81')],null,util['format'](_0xffc8('0x82'),_0x26d27e['table'],_0x26d27e['joins'][_0x582ae5][_0xffc8('0x83')],_0x26d27e[_0xffc8('0x7f')][_0x582ae5]['foreignTable'],_0x26d27e[_0xffc8('0x7f')][_0x582ae5][_0xffc8('0x80')]));}}}if(_0x26d27e[_0xffc8('0x84')]){_0x26d27e[_0xffc8('0x84')]=JSON[_0xffc8('0x85')](_0x26d27e[_0xffc8('0x84')]);_0x5788f7[_0xffc8('0x3c')](_0x2f9ff5(_0x26d27e[_0xffc8('0x84')][_0xffc8('0x6b')]));}_0x2f85ed=_0x5788f7[_0xffc8('0x91')]();_0x5788f7[_0xffc8('0x1f')](_0x11e6c3);_0x5788f7['offset'](0x0);logger[_0xffc8('0x86')](_0xffc8('0x87'),_0x5788f7[_0xffc8('0x88')]());return dbH[_0xffc8('0x89')][_0xffc8('0x34')](_0x5788f7[_0xffc8('0x88')](),{'type':dbH[_0xffc8('0x89')][_0xffc8('0x8a')][_0xffc8('0x8b')]});}})[_0xffc8('0x25')](function(){return{'sql':_0x2f85ed[_0xffc8('0x88')]()};})[_0xffc8('0x25')](respondWithResult(_0x4e10c9,null))[_0xffc8('0x46')](handleError(_0x4e10c9,null));}; \ No newline at end of file +var _0x2820=['startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','ValidationErrorItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','group','field','condition','value','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','operator','getFields','Sequelize','keyBy','from','output','web','fullPath','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x2820,0xb2));var _0x0282=function(_0x553e1f,_0x52741){_0x553e1f=_0x553e1f-0x0;var _0x45728a=_0x2820[_0x553e1f];return _0x45728a;};'use strict';var emlformat=require(_0x0282('0x0'));var rimraf=require(_0x0282('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0282('0x2'));var rp=require(_0x0282('0x3'));var moment=require(_0x0282('0x4'));var BPromise=require(_0x0282('0x5'));var Mustache=require('mustache');var util=require(_0x0282('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(_0x0282('0x7'));var _=require(_0x0282('0x8'));var squel=require(_0x0282('0x9'));var crypto=require(_0x0282('0xa'));var jsforce=require(_0x0282('0xb'));var deskjs=require(_0x0282('0xc'));var toCsv=require(_0x0282('0xd'));var querystring=require('querystring');var Papa=require(_0x0282('0xe'));var Redis=require(_0x0282('0xf'));var authService=require(_0x0282('0x10'));var qs=require(_0x0282('0x11'));var as=require(_0x0282('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0282('0x13'));var utils=require('../../config/utils');var config=require(_0x0282('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0282('0x15'))['db'];var dbH=require('../../mysqldb')[_0x0282('0x16')];function respondWithStatusCode(_0x2b6973,_0xbeea1d){_0xbeea1d=_0xbeea1d||0xcc;return function(_0x3693cb){if(_0x3693cb){return _0x2b6973[_0x0282('0x17')](_0xbeea1d);}return _0x2b6973[_0x0282('0x18')](_0xbeea1d)['end']();};}function respondWithResult(_0x37e6e8,_0x3a8f3b){_0x3a8f3b=_0x3a8f3b||0xc8;return function(_0x2e77ee){if(_0x2e77ee){return _0x37e6e8[_0x0282('0x18')](_0x3a8f3b)[_0x0282('0x19')](_0x2e77ee);}};}function respondWithFilteredResult(_0x3c4908,_0x5c01cd){return function(_0x32a1cb){if(_0x32a1cb){var _0xf7af46=typeof _0x5c01cd[_0x0282('0x1a')]===_0x0282('0x1b')&&typeof _0x5c01cd[_0x0282('0x1c')]===_0x0282('0x1b');var _0x2962c4=_0x32a1cb[_0x0282('0x1d')];var _0x16b273=_0xf7af46?0x0:_0x5c01cd['offset'];var _0x32e75c=_0xf7af46?_0x32a1cb[_0x0282('0x1d')]:_0x5c01cd[_0x0282('0x1a')]+_0x5c01cd[_0x0282('0x1c')];var _0x1cd597;if(_0x32e75c>=_0x2962c4){_0x32e75c=_0x2962c4;_0x1cd597=0xc8;}else{_0x1cd597=0xce;}_0x3c4908[_0x0282('0x18')](_0x1cd597);return _0x3c4908[_0x0282('0x1e')]('Content-Range',_0x16b273+'-'+_0x32e75c+'/'+_0x2962c4)[_0x0282('0x19')](_0x32a1cb);}return null;};}function patchUpdates(_0x2db6e4){return function(_0x55022e){try{jsonpatch[_0x0282('0x1f')](_0x55022e,_0x2db6e4,!![]);}catch(_0x5cd825){return BPromise['reject'](_0x5cd825);}return _0x55022e[_0x0282('0x20')]();};}function saveUpdates(_0x19f811,_0x25d37d){return function(_0x48070c){if(_0x48070c){return _0x48070c[_0x0282('0x21')](_0x19f811)[_0x0282('0x22')](function(_0x35cef9){return _0x35cef9;});}return null;};}function removeEntity(_0x2e033d,_0x41237e){return function(_0x11d4d6){if(_0x11d4d6){return _0x11d4d6[_0x0282('0x23')]()['then'](function(){var _0x28046e=_0x11d4d6[_0x0282('0x24')]({'plain':!![]});var _0x5d8388=_0x0282('0x25');return db[_0x0282('0x26')][_0x0282('0x23')]({'where':{'type':_0x5d8388,'resourceId':_0x28046e['id']}})[_0x0282('0x22')](function(){return _0x11d4d6;});})[_0x0282('0x22')](function(){_0x2e033d[_0x0282('0x18')](0xcc)[_0x0282('0x27')]();});}};}function handleEntityNotFound(_0x19d145,_0x3f28b8){return function(_0x55bbda){if(!_0x55bbda){_0x19d145[_0x0282('0x17')](0x194);}return _0x55bbda;};}function handleError(_0x18143f,_0x4c5416){_0x4c5416=_0x4c5416||0x1f4;return function(_0x1e0601){logger['error'](_0x1e0601[_0x0282('0x28')]);if(_0x1e0601['name']){delete _0x1e0601[_0x0282('0x29')];}_0x18143f[_0x0282('0x18')](_0x4c5416)[_0x0282('0x2a')](_0x1e0601);};}exports[_0x0282('0x2b')]=function(_0x8c953f,_0x435896){var _0x302077={},_0x2b4136={},_0x13076f={'count':0x0,'rows':[]};var _0x43552d=_[_0x0282('0x2c')](db[_0x0282('0x2d')]['rawAttributes'],function(_0x1cd4a6){return{'name':_0x1cd4a6[_0x0282('0x2e')],'type':_0x1cd4a6['type'][_0x0282('0x2f')]};});_0x2b4136[_0x0282('0x30')]=_[_0x0282('0x2c')](_0x43552d,'name');_0x2b4136['query']=_[_0x0282('0x31')](_0x8c953f[_0x0282('0x32')]);_0x2b4136['filters']=_[_0x0282('0x33')](_0x2b4136[_0x0282('0x30')],_0x2b4136[_0x0282('0x32')]);_0x302077['attributes']=_[_0x0282('0x33')](_0x2b4136[_0x0282('0x30')],qs[_0x0282('0x34')](_0x8c953f[_0x0282('0x32')][_0x0282('0x34')]));_0x302077[_0x0282('0x35')]=_0x302077['attributes']['length']?_0x302077['attributes']:_0x2b4136[_0x0282('0x30')];if(!_0x8c953f[_0x0282('0x32')][_0x0282('0x36')](_0x0282('0x37'))){_0x302077[_0x0282('0x1c')]=qs[_0x0282('0x1c')](_0x8c953f[_0x0282('0x32')][_0x0282('0x1c')]);_0x302077[_0x0282('0x1a')]=qs[_0x0282('0x1a')](_0x8c953f[_0x0282('0x32')][_0x0282('0x1a')]);}_0x302077[_0x0282('0x38')]=qs['sort'](_0x8c953f[_0x0282('0x32')][_0x0282('0x39')]);_0x302077[_0x0282('0x3a')]=qs[_0x0282('0x3b')](_[_0x0282('0x3c')](_0x8c953f['query'],_0x2b4136[_0x0282('0x3b')]),_0x43552d);if(_0x8c953f['query'][_0x0282('0x3d')]){_0x302077[_0x0282('0x3a')]=_[_0x0282('0x3e')](_0x302077['where'],{'$or':_[_0x0282('0x2c')](_0x43552d,function(_0x493f3e){if(_0x493f3e[_0x0282('0x3f')]!==_0x0282('0x40')){var _0x5dca64={};_0x5dca64[_0x493f3e['name']]={'$like':'%'+_0x8c953f[_0x0282('0x32')]['filter']+'%'};return _0x5dca64;}})});}_0x302077=_['merge']({},_0x302077,_0x8c953f['options']);var _0x459a4c={'where':_0x302077['where']};return db['AnalyticCustomReport']['count'](_0x459a4c)[_0x0282('0x22')](function(_0x1eca73){_0x13076f[_0x0282('0x1d')]=_0x1eca73;if(_0x8c953f[_0x0282('0x32')][_0x0282('0x41')]){_0x302077[_0x0282('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x0282('0x43')](_0x302077);})[_0x0282('0x22')](function(_0x4305ff){_0x13076f[_0x0282('0x44')]=_0x4305ff;return _0x13076f;})['then'](respondWithFilteredResult(_0x435896,_0x302077))[_0x0282('0x45')](handleError(_0x435896,null));};exports[_0x0282('0x46')]=function(_0x59f608,_0x27dfd0){var _0x377de3={'raw':![],'where':{'id':_0x59f608[_0x0282('0x47')]['id']}},_0x275a08={};_0x275a08[_0x0282('0x30')]=_[_0x0282('0x31')](db[_0x0282('0x2d')][_0x0282('0x48')]);_0x275a08[_0x0282('0x32')]=_[_0x0282('0x31')](_0x59f608[_0x0282('0x32')]);_0x275a08[_0x0282('0x3b')]=_[_0x0282('0x33')](_0x275a08[_0x0282('0x30')],_0x275a08[_0x0282('0x32')]);_0x377de3[_0x0282('0x35')]=_[_0x0282('0x33')](_0x275a08['model'],qs[_0x0282('0x34')](_0x59f608[_0x0282('0x32')]['fields']));_0x377de3['attributes']=_0x377de3[_0x0282('0x35')]['length']?_0x377de3['attributes']:_0x275a08[_0x0282('0x30')];if(_0x59f608[_0x0282('0x32')][_0x0282('0x41')]){_0x377de3[_0x0282('0x42')]=[{'all':!![]}];}_0x377de3=_[_0x0282('0x3e')]({},_0x377de3,_0x59f608[_0x0282('0x49')]);return db[_0x0282('0x2d')]['find'](_0x377de3)['then'](handleEntityNotFound(_0x27dfd0,null))[_0x0282('0x22')](respondWithResult(_0x27dfd0,null))['catch'](handleError(_0x27dfd0,null));};exports['create']=function(_0x23cac5,_0x56cbda){return db[_0x0282('0x2d')]['create'](_0x23cac5[_0x0282('0x4a')],{})[_0x0282('0x22')](function(_0x57ec2b){var _0x35c794=_0x23cac5[_0x0282('0x4b')][_0x0282('0x24')]({'plain':!![]});if(!_0x35c794)throw new Error(_0x0282('0x4c'));if(_0x35c794[_0x0282('0x4d')]===_0x0282('0x4b')){var _0x3c0282=_0x57ec2b[_0x0282('0x24')]({'plain':!![]});var _0xc7d5b7=_0x0282('0x4e');return db[_0x0282('0x4f')][_0x0282('0x50')]({'where':{'name':_0xc7d5b7,'userProfileId':_0x35c794[_0x0282('0x51')]},'raw':!![]})[_0x0282('0x22')](function(_0x50588a){if(_0x50588a&&_0x50588a[_0x0282('0x52')]===0x0){return db[_0x0282('0x26')][_0x0282('0x53')]({'name':_0x3c0282['name'],'resourceId':_0x3c0282['id'],'type':_0x0282('0x25'),'sectionId':_0x50588a['id']},{})['then'](function(){return _0x57ec2b;});}else{return _0x57ec2b;}})[_0x0282('0x45')](function(_0x135cb6){logger[_0x0282('0x54')](_0x0282('0x55'),_0x135cb6);throw _0x135cb6;});}return _0x57ec2b;})['then'](respondWithResult(_0x56cbda,0xc9))[_0x0282('0x45')](handleError(_0x56cbda,null));};exports[_0x0282('0x21')]=function(_0x56ad03,_0x398475){if(_0x56ad03['body']['id']){delete _0x56ad03[_0x0282('0x4a')]['id'];}return db[_0x0282('0x2d')][_0x0282('0x50')]({'where':{'id':_0x56ad03[_0x0282('0x47')]['id']}})[_0x0282('0x22')](handleEntityNotFound(_0x398475,null))[_0x0282('0x22')](saveUpdates(_0x56ad03[_0x0282('0x4a')],null))[_0x0282('0x22')](respondWithResult(_0x398475,null))[_0x0282('0x45')](handleError(_0x398475,null));};exports[_0x0282('0x23')]=function(_0x40ba8a,_0x47b14f){return db['AnalyticCustomReport'][_0x0282('0x50')]({'where':{'id':_0x40ba8a['params']['id']}})[_0x0282('0x22')](handleEntityNotFound(_0x47b14f,null))[_0x0282('0x22')](removeEntity(_0x47b14f,null))['catch'](handleError(_0x47b14f,null));};exports['preview']=function(_0xe1201c,_0x26855c){var _0x1adcb0=0xa;var _0x5ede56=[_0x0282('0x56'),_0x0282('0x57'),'right_join',_0x0282('0x58')];var _0x2767f4={'SUM':_0x0282('0x59'),'COUNT':_0x0282('0x5a'),'COUNT DISTINCT':_0x0282('0x5b'),'MAX':_0x0282('0x5c'),'MIN':_0x0282('0x5d'),'AVG':_0x0282('0x5e'),'GROUP_CONCAT':_0x0282('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0282('0x60')};var _0x19ad87={'SEC_TO_TIME':_0x0282('0x61'),'DATE':_0x0282('0x62'),'HOUR':_0x0282('0x63'),'ROUND':_0x0282('0x64'),'UNIX_TIMESTAMP':_0x0282('0x65')};var _0x271099=function(_0x231c97){return!_[_0x0282('0x66')]([_0x0282('0x67'),'IS\x20NOT\x20NULL',_0x0282('0x68'),_0x0282('0x69')],_0x231c97);};var _0x3f352b=function(_0x1dd0eb){if(!_0x1dd0eb||!_0x1dd0eb[_0x0282('0x6a')][_0x0282('0x6b')]){return'';}for(var _0x3056f2='(',_0x74dce0=0x0;_0x74dce0<_0x1dd0eb[_0x0282('0x6a')]['length'];_0x74dce0+=0x1){_0x74dce0>0x0&&(_0x3056f2+='\x20'+_0x1dd0eb['operator']+'\x20');_0x3056f2+=_0x1dd0eb['rules'][_0x74dce0][_0x0282('0x6c')]?_0x3f352b(_0x1dd0eb[_0x0282('0x6a')][_0x74dce0]['group']):_0x1dd0eb['rules'][_0x74dce0][_0x0282('0x6d')]+'\x20'+_0x1dd0eb[_0x0282('0x6a')][_0x74dce0][_0x0282('0x6e')]+(_0x271099(_0x1dd0eb['rules'][_0x74dce0]['condition'])?'\x20'+_0x1dd0eb[_0x0282('0x6a')][_0x74dce0][_0x0282('0x6f')]:'');}return _0x3056f2+')';};var _0x22addb={'where':{'id':_0xe1201c[_0x0282('0x47')]['id']}},_0x34ea76,_0x1e0974,_0x4c0ecc,_0x39ea71,_0x1226e6;_0x22addb=_['merge']({},_0x22addb,_0xe1201c[_0x0282('0x49')]);return db[_0x0282('0x2d')][_0x0282('0x50')](_0x22addb)[_0x0282('0x22')](function(_0x3a4711){if(_0x3a4711){_0x34ea76=_0x3a4711;return _0x3a4711['getFields']();}return null;})['then'](function(_0x4b5d9c){if(_0x4b5d9c){if(!_0x4b5d9c[_0x0282('0x6b')]){throw new db['Sequelize']['ValidationErrorItem'](_0x0282('0x70'),0x193);}_0x1e0974=_0x4b5d9c;return db[_0x0282('0x71')][_0x0282('0x43')]({'raw':!![]});}return null;})['then'](function(_0x56d46a){if(_0x56d46a){_0x4c0ecc=_['keyBy'](_0x56d46a,'id');var _0x4c481b;var _0x3c6c56=squel[_0x0282('0x72')]();_0x3c6c56['from'](_0x34ea76[_0x0282('0x73')]);for(var _0x413ef2=0x0;_0x413ef2<_0x1e0974[_0x0282('0x6b')];_0x413ef2+=0x1){_0x4c481b=_0x1e0974[_0x413ef2][_0x0282('0x74')]?_0x4c0ecc[_0x1e0974[_0x413ef2][_0x0282('0x74')]][_0x0282('0x75')]:_0x1e0974[_0x413ef2][_0x0282('0x6d')];_0x4c481b=_0x1e0974[_0x413ef2]['function']?_[_0x0282('0x76')](_0x2767f4[_0x1e0974[_0x413ef2][_0x0282('0x77')]],'%s',_0x4c481b):_0x4c481b;_0x4c481b=_0x1e0974[_0x413ef2]['format']?_[_0x0282('0x76')](_0x19ad87[_0x1e0974[_0x413ef2][_0x0282('0x78')]],'%s',_0x4c481b):_0x4c481b;if(_0x1e0974[_0x413ef2][_0x0282('0x79')]){_0x3c6c56[_0x0282('0x6c')](_0x4c481b);}_0x1e0974[_0x413ef2][_0x0282('0x7a')]&&_0x3c6c56[_0x0282('0x38')](_0x4c481b,_0x1e0974[_0x413ef2][_0x0282('0x7a')]===_0x0282('0x7b')?![]:!![]);_0x3c6c56['field'](_0x4c481b,_0x1e0974[_0x413ef2][_0x0282('0x7c')]||_0x4c481b);}if(_0x34ea76[_0x0282('0x7d')]){_0x34ea76['joins']=JSON[_0x0282('0x7e')](_0x34ea76[_0x0282('0x7d')]);for(var _0x593b54=0x0;_0x593b54<_0x34ea76['joins']['length'];_0x593b54+=0x1){if(_0x34ea76[_0x0282('0x7d')][_0x593b54][_0x0282('0x3f')]&&_[_0x0282('0x66')](_0x5ede56,_0x34ea76[_0x0282('0x7d')][_0x593b54][_0x0282('0x3f')])&&_0x34ea76[_0x0282('0x7d')][_0x593b54][_0x0282('0x7f')]&&_0x34ea76[_0x0282('0x7d')][_0x593b54][_0x0282('0x80')]&&_0x34ea76[_0x0282('0x7d')][_0x593b54]['foreignKey']){_0x3c6c56[_0x34ea76[_0x0282('0x7d')][_0x593b54]['type']](_0x34ea76[_0x0282('0x7d')][_0x593b54]['foreignTable'],null,util['format'](_0x0282('0x81'),_0x34ea76[_0x0282('0x73')],_0x34ea76[_0x0282('0x7d')][_0x593b54][_0x0282('0x7f')],_0x34ea76['joins'][_0x593b54][_0x0282('0x80')],_0x34ea76['joins'][_0x593b54][_0x0282('0x82')]));}}}if(_0x34ea76['conditions']){_0x34ea76['conditions']=JSON[_0x0282('0x7e')](_0x34ea76[_0x0282('0x83')]);_0x3c6c56['where'](_0x3f352b(_0x34ea76[_0x0282('0x83')][_0x0282('0x6c')]));}_0x1226e6=_0x3c6c56[_0x0282('0x84')]();_0x3c6c56['limit'](_0x1adcb0);_0x3c6c56[_0x0282('0x1a')](0x0);logger['debug'](_0x0282('0x85'),_0x3c6c56[_0x0282('0x86')]());return dbH['sequelize'][_0x0282('0x32')](_0x3c6c56['toString'](),{'type':dbH[_0x0282('0x87')][_0x0282('0x88')][_0x0282('0x89')]});}})[_0x0282('0x22')](respondWithResult(_0x26855c,null))[_0x0282('0x45')](handleError(_0x26855c,null));};function runReport(_0xa999e7,_0x575bf1,_0x293ff0){var _0x3b8a6b=_0x575bf1['name'];var _0x3260bc=0xa;var _0x4f1a9c=[_0x0282('0x56'),_0x0282('0x57'),_0x0282('0x8a'),'cross_join'];var _0x36802a={'SUM':_0x0282('0x59'),'COUNT':_0x0282('0x5a'),'COUNT DISTINCT':_0x0282('0x5b'),'MAX':_0x0282('0x5c'),'MIN':_0x0282('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0282('0x5f'),'GROUP_CONCAT ASC':_0x0282('0x8b'),'GROUP_CONCAT DESC':_0x0282('0x60')};var _0x209aca={'SEC_TO_TIME':_0x0282('0x61'),'DATE':_0x0282('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0282('0x65')};var _0x197b98=function(_0x11ac49){return!_[_0x0282('0x66')]([_0x0282('0x67'),_0x0282('0x8c'),_0x0282('0x68'),_0x0282('0x69')],_0x11ac49);};var _0x1b1311=function(_0x26c9d8){if(!_0x26c9d8||!_0x26c9d8[_0x0282('0x6a')]['length']){return'';}for(var _0x26b9dd='(',_0x2b1511=0x0;_0x2b1511<_0x26c9d8[_0x0282('0x6a')][_0x0282('0x6b')];_0x2b1511+=0x1){_0x2b1511>0x0&&(_0x26b9dd+='\x20'+_0x26c9d8[_0x0282('0x8d')]+'\x20');_0x26b9dd+=_0x26c9d8[_0x0282('0x6a')][_0x2b1511][_0x0282('0x6c')]?_0x1b1311(_0x26c9d8[_0x0282('0x6a')][_0x2b1511][_0x0282('0x6c')]):_0x26c9d8['rules'][_0x2b1511][_0x0282('0x6d')]+'\x20'+_0x26c9d8['rules'][_0x2b1511]['condition']+(_0x197b98(_0x26c9d8[_0x0282('0x6a')][_0x2b1511]['condition'])?'\x20'+_0x26c9d8['rules'][_0x2b1511][_0x0282('0x6f')]:'');}return _0x26b9dd+')';};var _0x481df9={'where':{'id':_0xa999e7['id']}},_0x2774f4,_0x4531e2,_0x234ac0,_0x915294,_0xd11573;_0x481df9=_[_0x0282('0x3e')]({},_0x481df9,_0x293ff0);return db[_0x0282('0x2d')][_0x0282('0x50')](_0x481df9)['then'](function(_0x23edd0){if(_0x23edd0){_0x2774f4=_0x23edd0;return _0x23edd0[_0x0282('0x8e')]();}return null;})[_0x0282('0x22')](function(_0x54dc0f){if(_0x54dc0f){if(!_0x54dc0f[_0x0282('0x6b')]){throw new db[(_0x0282('0x8f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4531e2=_0x54dc0f;return db[_0x0282('0x71')][_0x0282('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5d06e6){if(_0x5d06e6){_0x234ac0=_[_0x0282('0x90')](_0x5d06e6,'id');var _0x5e7577;var _0x5025de=squel['select']();_0x5025de[_0x0282('0x91')](_0x2774f4[_0x0282('0x73')]);for(var _0x237293=0x0;_0x237293<_0x4531e2[_0x0282('0x6b')];_0x237293+=0x1){_0x5e7577=_0x4531e2[_0x237293][_0x0282('0x74')]?_0x234ac0[_0x4531e2[_0x237293][_0x0282('0x74')]][_0x0282('0x75')]:_0x4531e2[_0x237293][_0x0282('0x6d')];_0x5e7577=_0x4531e2[_0x237293][_0x0282('0x77')]?_['replace'](_0x36802a[_0x4531e2[_0x237293]['function']],'%s',_0x5e7577):_0x5e7577;_0x5e7577=_0x4531e2[_0x237293]['format']?_[_0x0282('0x76')](_0x209aca[_0x4531e2[_0x237293][_0x0282('0x78')]],'%s',_0x5e7577):_0x5e7577;if(_0x4531e2[_0x237293]['groupBy']){_0x5025de[_0x0282('0x6c')](_0x5e7577);}_0x4531e2[_0x237293][_0x0282('0x7a')]&&_0x5025de[_0x0282('0x38')](_0x5e7577,_0x4531e2[_0x237293][_0x0282('0x7a')]==='DESC'?![]:!![]);_0x5025de[_0x0282('0x6d')](_0x5e7577,_0x4531e2[_0x237293][_0x0282('0x7c')]||_0x5e7577);}if(_0x2774f4[_0x0282('0x7d')]){_0x2774f4[_0x0282('0x7d')]=JSON[_0x0282('0x7e')](_0x2774f4[_0x0282('0x7d')]);for(var _0x4e8ff8=0x0;_0x4e8ff8<_0x2774f4['joins']['length'];_0x4e8ff8+=0x1){if(_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x3f')]&&_[_0x0282('0x66')](_0x4f1a9c,_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x3f')])&&_0x2774f4['joins'][_0x4e8ff8][_0x0282('0x7f')]&&_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x80')]&&_0x2774f4[_0x0282('0x7d')][_0x4e8ff8]['foreignKey']){_0x5025de[_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x3f')]](_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x80')],null,util[_0x0282('0x78')](_0x0282('0x81'),_0x2774f4['table'],_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x7f')],_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x80')],_0x2774f4[_0x0282('0x7d')][_0x4e8ff8][_0x0282('0x82')]));}}}if(_0x2774f4['conditions']){_0x2774f4[_0x0282('0x83')]=JSON[_0x0282('0x7e')](_0x2774f4[_0x0282('0x83')]);_0x5025de[_0x0282('0x3a')](_0x1b1311(_0x2774f4[_0x0282('0x83')][_0x0282('0x6c')]));}_0xd11573=_0x5025de[_0x0282('0x84')]();_0x5025de[_0x0282('0x1c')](_0x3260bc);_0x5025de[_0x0282('0x1a')](0x0);return;}})[_0x0282('0x22')](function(){if(_0x575bf1[_0x0282('0x92')]===_0x0282('0x93')){return null;}var _0x893cbe=_['merge'](_0x575bf1,{'name':_0x575bf1[_0x0282('0x94')]||_0x575bf1[_0x0282('0x29')]||_0x2774f4[_0x0282('0x29')],'basename':_0x3b8a6b,'savename':util[_0x0282('0x78')]('%s-%s.%s',_0x575bf1['name']||_0x2774f4['name'],require(_0x0282('0x95'))[_0x0282('0x96')](0x4),_0x575bf1['output']||'csv'),'reportId':_0x2774f4['id'],'reportType':_0x0282('0x97')});return db[_0x0282('0x98')][_0x0282('0x53')](_0x893cbe,{'raw':!![]});})[_0x0282('0x22')](function(_0x1aa218){if(_0x2774f4[_0x0282('0x73')]==='cdr'){_0xd11573[_0x0282('0x3a')](_0x2774f4[_0x0282('0x73')]+_0x0282('0x99'),_0x575bf1['startDate'],_0x575bf1[_0x0282('0x9a')]);}else{_0xd11573[_0x0282('0x3a')](_0x2774f4[_0x0282('0x73')]+_0x0282('0x9b'),_0x575bf1[_0x0282('0x9c')],_0x575bf1['endDate']);}if(_0x1aa218){logger[_0x0282('0x9d')](_0x0282('0x9e'),_0xd11573[_0x0282('0x86')]());require(_0x0282('0x9f'))[_0x0282('0xa0')](path[_0x0282('0x56')](__dirname,'../../components/export/',_0x1aa218[_0x0282('0x92')]),[_0x1aa218['id'],_0xd11573[_0x0282('0x86')](),path['join'](__dirname,_0x0282('0xa1'),_0x1aa218[_0x0282('0xa2')]),_0x3b8a6b]);return _0x1aa218;}else{var _0x2fb8cf=squel[_0x0282('0x72')]();_0x2fb8cf[_0x0282('0x91')]('('+_0xd11573['toString']()+')',_0x0282('0xa3'));_0x2fb8cf[_0x0282('0x6d')]('COUNT(*)',_0x0282('0x1d'));_0xd11573[_0x0282('0x1c')](_0x575bf1[_0x0282('0x1c')]||_0x3260bc);_0xd11573[_0x0282('0x1a')](_0x575bf1[_0x0282('0x1a')]||0x0);return dbH['sequelize'][_0x0282('0x32')](_0x2fb8cf[_0x0282('0x86')](),{'type':dbH[_0x0282('0x87')][_0x0282('0x88')]['SELECT']})[_0x0282('0x22')](function(_0x41ffdb){if(!_0x41ffdb['length']){_0x915294=0x0;}else{_0x915294=_0x41ffdb[0x0][_0x0282('0x1d')]||0x0;}return dbH[_0x0282('0x87')][_0x0282('0x32')](_0xd11573[_0x0282('0x86')](),{'type':dbH[_0x0282('0x87')][_0x0282('0x88')][_0x0282('0x89')]});})[_0x0282('0x22')](function(_0xef882e){return{'rows':_0xef882e||[],'count':_0x915294};});}});}exports[_0x0282('0xa4')]=function(_0x3c2a61,_0x5bbd85){return runReport(_0x3c2a61['params'],_0x3c2a61[_0x0282('0x32')],_0x3c2a61[_0x0282('0x49')])[_0x0282('0x22')](respondWithResult(_0x5bbd85,null))['catch'](handleError(_0x5bbd85,null));};exports[_0x0282('0xa5')]=runReport;exports[_0x0282('0x32')]=function(_0x34c5b5,_0xfed5e8){var _0x5032c6=0xa;var _0x2ac471=[_0x0282('0x56'),_0x0282('0x57'),_0x0282('0x8a'),'cross_join'];var _0x8082f2={'SUM':'SUM(%s)','COUNT':_0x0282('0x5a'),'COUNT DISTINCT':_0x0282('0x5b'),'MAX':'MAX(%s)','MIN':_0x0282('0x5d'),'AVG':_0x0282('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0282('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x31e03a={'SEC_TO_TIME':_0x0282('0x61'),'DATE':_0x0282('0x62'),'HOUR':_0x0282('0x63'),'ROUND':_0x0282('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1096a5=function(_0x8a2f49){return!_[_0x0282('0x66')]([_0x0282('0x67'),_0x0282('0x8c'),_0x0282('0x68'),_0x0282('0x69')],_0x8a2f49);};var _0x42a117=function(_0xa4c9a5){if(!_0xa4c9a5||!_0xa4c9a5[_0x0282('0x6a')][_0x0282('0x6b')]){return'';}for(var _0x186569='(',_0x4cf2da=0x0;_0x4cf2da<_0xa4c9a5[_0x0282('0x6a')][_0x0282('0x6b')];_0x4cf2da+=0x1){_0x4cf2da>0x0&&(_0x186569+='\x20'+_0xa4c9a5[_0x0282('0x8d')]+'\x20');_0x186569+=_0xa4c9a5['rules'][_0x4cf2da][_0x0282('0x6c')]?_0x42a117(_0xa4c9a5['rules'][_0x4cf2da][_0x0282('0x6c')]):_0xa4c9a5[_0x0282('0x6a')][_0x4cf2da]['field']+'\x20'+_0xa4c9a5[_0x0282('0x6a')][_0x4cf2da]['condition']+(_0x1096a5(_0xa4c9a5[_0x0282('0x6a')][_0x4cf2da][_0x0282('0x6e')])?'\x20'+_0xa4c9a5[_0x0282('0x6a')][_0x4cf2da][_0x0282('0x6f')]:'');}return _0x186569+')';};var _0x5ed494={'where':{'id':_0x34c5b5[_0x0282('0x47')]['id']}},_0x30b026,_0x5638d8,_0x5b21d3,_0x38ca76,_0x2a4a5e;_0x5ed494=_[_0x0282('0x3e')]({},_0x5ed494,_0x34c5b5[_0x0282('0x49')]);return db['AnalyticCustomReport'][_0x0282('0x50')](_0x5ed494)['then'](function(_0x19461c){if(_0x19461c){_0x30b026=_0x19461c;return _0x19461c[_0x0282('0x8e')]();}return null;})[_0x0282('0x22')](function(_0x58dcc3){if(_0x58dcc3){if(!_0x58dcc3[_0x0282('0x6b')]){throw new db[(_0x0282('0x8f'))][(_0x0282('0xa6'))](_0x0282('0x70'),0x193);}_0x5638d8=_0x58dcc3;return db['AnalyticMetric'][_0x0282('0x43')]({'raw':!![]});}return null;})[_0x0282('0x22')](function(_0x1202c3){if(_0x1202c3){_0x5b21d3=_[_0x0282('0x90')](_0x1202c3,'id');var _0x39b44b;var _0x38cb34=squel[_0x0282('0x72')]();_0x38cb34['from'](_0x30b026[_0x0282('0x73')]);for(var _0x54096c=0x0;_0x54096c<_0x5638d8['length'];_0x54096c+=0x1){_0x39b44b=_0x5638d8[_0x54096c][_0x0282('0x74')]?_0x5b21d3[_0x5638d8[_0x54096c][_0x0282('0x74')]][_0x0282('0x75')]:_0x5638d8[_0x54096c][_0x0282('0x6d')];_0x39b44b=_0x5638d8[_0x54096c]['function']?_[_0x0282('0x76')](_0x8082f2[_0x5638d8[_0x54096c][_0x0282('0x77')]],'%s',_0x39b44b):_0x39b44b;_0x39b44b=_0x5638d8[_0x54096c][_0x0282('0x78')]?_[_0x0282('0x76')](_0x31e03a[_0x5638d8[_0x54096c][_0x0282('0x78')]],'%s',_0x39b44b):_0x39b44b;if(_0x5638d8[_0x54096c]['groupBy']){_0x38cb34[_0x0282('0x6c')](_0x39b44b);}_0x5638d8[_0x54096c][_0x0282('0x7a')]&&_0x38cb34['order'](_0x39b44b,_0x5638d8[_0x54096c][_0x0282('0x7a')]===_0x0282('0x7b')?![]:!![]);_0x38cb34[_0x0282('0x6d')](_0x39b44b,_0x5638d8[_0x54096c][_0x0282('0x7c')]||_0x39b44b);}if(_0x30b026[_0x0282('0x7d')]){_0x30b026[_0x0282('0x7d')]=JSON[_0x0282('0x7e')](_0x30b026[_0x0282('0x7d')]);for(var _0x276107=0x0;_0x276107<_0x30b026[_0x0282('0x7d')][_0x0282('0x6b')];_0x276107+=0x1){if(_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x3f')]&&_['includes'](_0x2ac471,_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x3f')])&&_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x7f')]&&_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x80')]&&_0x30b026['joins'][_0x276107][_0x0282('0x82')]){_0x38cb34[_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x3f')]](_0x30b026['joins'][_0x276107][_0x0282('0x80')],null,util[_0x0282('0x78')](_0x0282('0x81'),_0x30b026[_0x0282('0x73')],_0x30b026['joins'][_0x276107][_0x0282('0x7f')],_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x80')],_0x30b026[_0x0282('0x7d')][_0x276107][_0x0282('0x82')]));}}}if(_0x30b026[_0x0282('0x83')]){_0x30b026[_0x0282('0x83')]=JSON[_0x0282('0x7e')](_0x30b026[_0x0282('0x83')]);_0x38cb34[_0x0282('0x3a')](_0x42a117(_0x30b026[_0x0282('0x83')][_0x0282('0x6c')]));}_0x2a4a5e=_0x38cb34[_0x0282('0x84')]();_0x38cb34[_0x0282('0x1c')](_0x5032c6);_0x38cb34['offset'](0x0);logger['debug']('Limited\x20Query:',_0x38cb34[_0x0282('0x86')]());return dbH[_0x0282('0x87')][_0x0282('0x32')](_0x38cb34[_0x0282('0x86')](),{'type':dbH[_0x0282('0x87')]['QueryTypes'][_0x0282('0x89')]});}})[_0x0282('0x22')](function(){return{'sql':_0x2a4a5e['toString']()};})[_0x0282('0x22')](respondWithResult(_0xfed5e8,null))['catch'](handleError(_0xfed5e8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index da317a1..4ef6857 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 _0xd0bc=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x27d633,_0x205c94){var _0x74ba36=function(_0x5517e0){while(--_0x5517e0){_0x27d633['push'](_0x27d633['shift']());}};_0x74ba36(++_0x205c94);}(_0xd0bc,0xc0));var _0xcd0b=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xd0bc[_0x1e3c02];return _0x4d26d7;};'use strict';var _=require(_0xcd0b('0x0'));var util=require(_0xcd0b('0x1'));var logger=require(_0xcd0b('0x2'))(_0xcd0b('0x3'));var moment=require(_0xcd0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd0b('0x5'));var fs=require('fs');var path=require(_0xcd0b('0x6'));var rimraf=require(_0xcd0b('0x7'));var config=require(_0xcd0b('0x8'));var attributes=require(_0xcd0b('0x9'));module[_0xcd0b('0xa')]=function(_0x3a7230,_0xd46164){return _0x3a7230[_0xcd0b('0xb')](_0xcd0b('0xc'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35bc=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35bc,0x10e));var _0xc35b=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0x35bc[_0xcb0eb2];return _0xbab9b8;};'use strict';var _=require(_0xc35b('0x0'));var util=require(_0xc35b('0x1'));var logger=require(_0xc35b('0x2'))(_0xc35b('0x3'));var moment=require(_0xc35b('0x4'));var BPromise=require('bluebird');var rp=require(_0xc35b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc35b('0x6'));var config=require(_0xc35b('0x7'));var attributes=require(_0xc35b('0x8'));module[_0xc35b('0x9')]=function(_0x5ee40b,_0x90f53a){return _0x5ee40b[_0xc35b('0xa')](_0xc35b('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b292007..c95912f 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 _0x7146=['AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x119940,_0x265a3f){var _0x59af49=function(_0x580199){while(--_0x580199){_0x119940['push'](_0x119940['shift']());}};_0x59af49(++_0x265a3f);}(_0x7146,0x1cf));var _0x6714=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x7146[_0x531cb8];return _0x5cf297;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var moment=require(_0x6714('0x2'));var BPromise=require('bluebird');var rs=require(_0x6714('0x3'));var fs=require('fs');var Redis=require(_0x6714('0x4'));var db=require(_0x6714('0x5'))['db'];var utils=require(_0x6714('0x6'));var logger=require(_0x6714('0x7'))(_0x6714('0x8'));var config=require(_0x6714('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6714('0xa')][_0x6714('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x556c1f,_0x4353b8,_0x5db85d){return new BPromise(function(_0x20cbde,_0x18a422){return client[_0x6714('0xc')](_0x556c1f,_0x5db85d)[_0x6714('0xd')](function(_0x300ce7){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4353b8,_0x6714('0xe'));logger['debug'](_0x6714('0xf'),_0x4353b8,_0x6714('0xe'),JSON[_0x6714('0x10')](_0x300ce7));if(_0x300ce7[_0x6714('0x11')]){if(_0x300ce7[_0x6714('0x11')][_0x6714('0x12')]===0x1f4){logger[_0x6714('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4353b8,_0x300ce7[_0x6714('0x11')][_0x6714('0x13')]);return _0x18a422(_0x300ce7[_0x6714('0x11')][_0x6714('0x13')]);}logger[_0x6714('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4353b8,_0x300ce7[_0x6714('0x11')]['message']);return _0x20cbde(_0x300ce7[_0x6714('0x11')]['message']);}else{logger['info'](_0x6714('0x14'),_0x4353b8,_0x6714('0xe'));_0x20cbde(_0x300ce7[_0x6714('0x15')][_0x6714('0x13')]);}})[_0x6714('0x16')](function(_0x1fb4b2){logger[_0x6714('0x11')](_0x6714('0x14'),_0x4353b8,_0x1fb4b2);_0x18a422(_0x1fb4b2);});});} \ No newline at end of file +var _0xa11c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util','moment','randomstring'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa11c,0xa4));var _0xca11=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa11c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xca11('0x0'));var util=require(_0xca11('0x1'));var moment=require(_0xca11('0x2'));var BPromise=require('bluebird');var rs=require(_0xca11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca11('0x4'))['db'];var utils=require(_0xca11('0x5'));var logger=require(_0xca11('0x6'))(_0xca11('0x7'));var config=require(_0xca11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca11('0x9')][_0xca11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3760f7,_0x11e38f,_0x93187d){return new BPromise(function(_0x2b94d2,_0x3b4bdf){return client['request'](_0x3760f7,_0x93187d)[_0xca11('0xb')](function(_0x50d763){logger[_0xca11('0xc')](_0xca11('0xd'),_0x11e38f,_0xca11('0xe'));logger[_0xca11('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x11e38f,_0xca11('0xe'),JSON[_0xca11('0x10')](_0x50d763));if(_0x50d763['error']){if(_0x50d763['error'][_0xca11('0x11')]===0x1f4){logger[_0xca11('0x12')](_0xca11('0xd'),_0x11e38f,_0x50d763[_0xca11('0x12')][_0xca11('0x13')]);return _0x3b4bdf(_0x50d763[_0xca11('0x12')][_0xca11('0x13')]);}logger['error'](_0xca11('0xd'),_0x11e38f,_0x50d763['error'][_0xca11('0x13')]);return _0x2b94d2(_0x50d763[_0xca11('0x12')]['message']);}else{logger['info'](_0xca11('0xd'),_0x11e38f,_0xca11('0xe'));_0x2b94d2(_0x50d763['result'][_0xca11('0x13')]);}})[_0xca11('0x14')](function(_0x4b04e9){logger[_0xca11('0x12')](_0xca11('0xd'),_0x11e38f,_0x4b04e9);_0x3b4bdf(_0x4b04e9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 301127f..5886df0 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 _0xcdbe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','preview','/:id/run','query','post','create','put','destroy','exports','util','path'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0xcdbe,0x6c));var _0xecdb=function(_0x10ab62,_0x21d1da){_0x10ab62=_0x10ab62-0x0;var _0x3b325b=_0xcdbe[_0x10ab62];return _0x3b325b;};'use strict';var multer=require('multer');var util=require(_0xecdb('0x0'));var path=require(_0xecdb('0x1'));var timeout=require(_0xecdb('0x2'));var express=require(_0xecdb('0x3'));var router=express[_0xecdb('0x4')]();var fs_extra=require(_0xecdb('0x5'));var auth=require(_0xecdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xecdb('0x7'));var controller=require(_0xecdb('0x8'));router[_0xecdb('0x9')]('/',auth['isAuthenticated'](),controller[_0xecdb('0xa')]);router[_0xecdb('0x9')](_0xecdb('0xb'),auth[_0xecdb('0xc')](),controller[_0xecdb('0xd')]);router[_0xecdb('0x9')]('/:id/preview',auth[_0xecdb('0xc')](),controller[_0xecdb('0xe')]);router['get'](_0xecdb('0xf'),auth['isAuthenticated'](),controller['run']);router['get']('/:id/query',auth[_0xecdb('0xc')](),controller[_0xecdb('0x10')]);router[_0xecdb('0x11')]('/',auth['isAuthenticated'](),controller[_0xecdb('0x12')]);router[_0xecdb('0x13')](_0xecdb('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xecdb('0xb'),auth['isAuthenticated'](),controller[_0xecdb('0x14')]);module[_0xecdb('0x15')]=router; \ No newline at end of file +var _0x2976=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xbbcada,_0x341b04){var _0x4f51de=function(_0x508d6c){while(--_0x508d6c){_0xbbcada['push'](_0xbbcada['shift']());}};_0x4f51de(++_0x341b04);}(_0x2976,0x1d5));var _0x6297=function(_0x1255d8,_0xb523fd){_0x1255d8=_0x1255d8-0x0;var _0x34ad49=_0x2976[_0x1255d8];return _0x34ad49;};'use strict';var multer=require(_0x6297('0x0'));var util=require(_0x6297('0x1'));var path=require(_0x6297('0x2'));var timeout=require(_0x6297('0x3'));var express=require('express');var router=express[_0x6297('0x4')]();var fs_extra=require(_0x6297('0x5'));var auth=require(_0x6297('0x6'));var interaction=require(_0x6297('0x7'));var config=require(_0x6297('0x8'));var controller=require(_0x6297('0x9'));router[_0x6297('0xa')]('/',auth['isAuthenticated'](),controller[_0x6297('0xb')]);router['get'](_0x6297('0xc'),auth[_0x6297('0xd')](),controller[_0x6297('0xe')]);router[_0x6297('0xa')](_0x6297('0xf'),auth[_0x6297('0xd')](),controller[_0x6297('0x10')]);router[_0x6297('0xa')](_0x6297('0x11'),auth['isAuthenticated'](),controller['run']);router[_0x6297('0xa')]('/:id/query',auth['isAuthenticated'](),controller[_0x6297('0x12')]);router[_0x6297('0x13')]('/',auth['isAuthenticated'](),controller[_0x6297('0x14')]);router['put'](_0x6297('0xc'),auth[_0x6297('0xd')](),controller[_0x6297('0x15')]);router[_0x6297('0x16')]('/:id',auth[_0x6297('0xd')](),controller[_0x6297('0x17')]);module[_0x6297('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6e4579c..fe3d8d9 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 _0x5d58=['TEXT','STRING'];(function(_0x3f8862,_0x1ece6e){var _0x305066=function(_0x591f95){while(--_0x591f95){_0x3f8862['push'](_0x3f8862['shift']());}};_0x305066(++_0x1ece6e);}(_0x5d58,0x187));var _0x85d5=function(_0x575878,_0x5604c6){_0x575878=_0x575878-0x0;var _0x1ebebe=_0x5d58[_0x575878];return _0x1ebebe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6ba4600..25666bf 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x1fee2f,_0x31ae6c){var _0x53c34d=function(_0xa5a72d){while(--_0xa5a72d){_0x1fee2f['push'](_0x1fee2f['shift']());}};_0x53c34d(++_0x31ae6c);}(_0x53ec,0x192));var _0xc53e=function(_0x444716,_0x1fd1ef){_0x444716=_0x444716-0x0;var _0x9e6df5=_0x53ec[_0x444716];return _0x9e6df5;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabce[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7d89a91..a8a3ad0 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 _0xcf76=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcf76,0x166));var _0x6cf7=function(_0x27755b,_0x370ff3){_0x27755b=_0x27755b-0x0;var _0x13eaec=_0xcf76[_0x27755b];return _0x13eaec;};'use strict';var _=require(_0x6cf7('0x0'));var util=require(_0x6cf7('0x1'));var logger=require(_0x6cf7('0x2'))(_0x6cf7('0x3'));var moment=require(_0x6cf7('0x4'));var BPromise=require(_0x6cf7('0x5'));var rp=require(_0x6cf7('0x6'));var fs=require('fs');var path=require(_0x6cf7('0x7'));var rimraf=require(_0x6cf7('0x8'));var config=require(_0x6cf7('0x9'));var attributes=require(_0x6cf7('0xa'));module[_0x6cf7('0xb')]=function(_0x4527d4,_0x2b736b){return _0x4527d4['define'](_0x6cf7('0xc'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eaf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x0eaf,0x143));var _0xf0ea=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0eaf[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xf0ea('0x0'));var util=require(_0xf0ea('0x1'));var logger=require(_0xf0ea('0x2'))(_0xf0ea('0x3'));var moment=require(_0xf0ea('0x4'));var BPromise=require(_0xf0ea('0x5'));var rp=require(_0xf0ea('0x6'));var fs=require('fs');var path=require(_0xf0ea('0x7'));var rimraf=require(_0xf0ea('0x8'));var config=require(_0xf0ea('0x9'));var attributes=require(_0xf0ea('0xa'));module['exports']=function(_0x5aea5e,_0x469183){return _0x5aea5e[_0xf0ea('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xf0ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 3b6fef8..30628e8 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 _0x7e3e=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x14ddac,_0x36b509){var _0x31aadf=function(_0x11ccb1){while(--_0x11ccb1){_0x14ddac['push'](_0x14ddac['shift']());}};_0x31aadf(++_0x36b509);}(_0x7e3e,0x155));var _0xe7e3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7e3e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xe7e3('0x0'));var util=require(_0xe7e3('0x1'));var moment=require('moment');var BPromise=require(_0xe7e3('0x2'));var rs=require(_0xe7e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7e3('0x5'))(_0xe7e3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1951,_0x1ee297,_0x192742){return new BPromise(function(_0xbb854b,_0x20e82b){return client['request'](_0x4c1951,_0x192742)[_0xe7e3('0x8')](function(_0x317bea){logger[_0xe7e3('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1ee297,_0xe7e3('0xa'));logger[_0xe7e3('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1ee297,_0xe7e3('0xa'),JSON[_0xe7e3('0xc')](_0x317bea));if(_0x317bea[_0xe7e3('0xd')]){if(_0x317bea[_0xe7e3('0xd')]['code']===0x1f4){logger[_0xe7e3('0xd')](_0xe7e3('0xe'),_0x1ee297,_0x317bea[_0xe7e3('0xd')][_0xe7e3('0xf')]);return _0x20e82b(_0x317bea['error']['message']);}logger['error'](_0xe7e3('0xe'),_0x1ee297,_0x317bea[_0xe7e3('0xd')][_0xe7e3('0xf')]);return _0xbb854b(_0x317bea[_0xe7e3('0xd')][_0xe7e3('0xf')]);}else{logger['info'](_0xe7e3('0xe'),_0x1ee297,'request\x20sent');_0xbb854b(_0x317bea[_0xe7e3('0x10')]['message']);}})[_0xe7e3('0x11')](function(_0x1dc800){logger[_0xe7e3('0xd')](_0xe7e3('0xe'),_0x1ee297,_0x1dc800);_0x20e82b(_0x1dc800);});});} \ No newline at end of file +var _0x3548=['AnalyticDefaultReport,\x20%s,\x20%s','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','message','result'];(function(_0x1a205d,_0x4c54f0){var _0xd32727=function(_0x3b3bc4){while(--_0x3b3bc4){_0x1a205d['push'](_0x1a205d['shift']());}};_0xd32727(++_0x4c54f0);}(_0x3548,0x10f));var _0x8354=function(_0x518461,_0x59c0bd){_0x518461=_0x518461-0x0;var _0x457a1c=_0x3548[_0x518461];return _0x457a1c;};'use strict';var _=require(_0x8354('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8354('0x1'));var rs=require(_0x8354('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8354('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8354('0x4'))('rpc');var config=require(_0x8354('0x5'));var jayson=require(_0x8354('0x6'));var client=jayson[_0x8354('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5958b1,_0x978001,_0x2781fb){return new BPromise(function(_0x52a6e7,_0x2fc0ad){return client[_0x8354('0x8')](_0x5958b1,_0x2781fb)[_0x8354('0x9')](function(_0x577012){logger[_0x8354('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x978001,_0x8354('0xb'));logger[_0x8354('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x978001,'request\x20sent',JSON[_0x8354('0xd')](_0x577012));if(_0x577012['error']){if(_0x577012[_0x8354('0xe')]['code']===0x1f4){logger[_0x8354('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x978001,_0x577012[_0x8354('0xe')][_0x8354('0xf')]);return _0x2fc0ad(_0x577012[_0x8354('0xe')][_0x8354('0xf')]);}logger[_0x8354('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x978001,_0x577012[_0x8354('0xe')][_0x8354('0xf')]);return _0x52a6e7(_0x577012[_0x8354('0xe')][_0x8354('0xf')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x978001,'request\x20sent');_0x52a6e7(_0x577012[_0x8354('0x10')][_0x8354('0xf')]);}})['catch'](function(_0x546822){logger[_0x8354('0xe')](_0x8354('0x11'),_0x978001,_0x546822);_0x2fc0ad(_0x546822);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8c65394..82ce0a0 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 _0x256a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/query','query','post','create','delete','exports','util','path'];(function(_0x59af5c,_0x317398){var _0x1afb48=function(_0x5d5bb3){while(--_0x5d5bb3){_0x59af5c['push'](_0x59af5c['shift']());}};_0x1afb48(++_0x317398);}(_0x256a,0x83));var _0xa256=function(_0x265cd2,_0x5281a3){_0x265cd2=_0x265cd2-0x0;var _0x1ba5ec=_0x256a[_0x265cd2];return _0x1ba5ec;};'use strict';var multer=require('multer');var util=require(_0xa256('0x0'));var path=require(_0xa256('0x1'));var timeout=require(_0xa256('0x2'));var express=require('express');var router=express[_0xa256('0x3')]();var fs_extra=require(_0xa256('0x4'));var auth=require(_0xa256('0x5'));var interaction=require(_0xa256('0x6'));var config=require('../../config/environment');var controller=require(_0xa256('0x7'));router[_0xa256('0x8')]('/',auth[_0xa256('0x9')](),controller[_0xa256('0xa')]);router[_0xa256('0x8')](_0xa256('0xb'),auth[_0xa256('0x9')](),controller[_0xa256('0xc')]);router[_0xa256('0x8')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router['get']('/:id/run',auth[_0xa256('0x9')](),controller['run']);router['get'](_0xa256('0xd'),auth[_0xa256('0x9')](),controller[_0xa256('0xe')]);router[_0xa256('0xf')]('/',auth[_0xa256('0x9')](),controller[_0xa256('0x10')]);router['put'](_0xa256('0xb'),auth[_0xa256('0x9')](),controller['update']);router[_0xa256('0x11')](_0xa256('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa256('0x12')]=router; \ No newline at end of file +var _0x9ade=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post'];(function(_0x30c95b,_0x5beb11){var _0xc5810c=function(_0x3b8809){while(--_0x3b8809){_0x30c95b['push'](_0x30c95b['shift']());}};_0xc5810c(++_0x5beb11);}(_0x9ade,0xde));var _0xe9ad=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x9ade[_0x1f7201];return _0x289fd2;};'use strict';var multer=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var path=require(_0xe9ad('0x2'));var timeout=require(_0xe9ad('0x3'));var express=require('express');var router=express[_0xe9ad('0x4')]();var fs_extra=require(_0xe9ad('0x5'));var auth=require(_0xe9ad('0x6'));var interaction=require(_0xe9ad('0x7'));var config=require(_0xe9ad('0x8'));var controller=require(_0xe9ad('0x9'));router[_0xe9ad('0xa')]('/',auth[_0xe9ad('0xb')](),controller[_0xe9ad('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe9ad('0xd')]);router[_0xe9ad('0xa')](_0xe9ad('0xe'),auth[_0xe9ad('0xb')](),controller[_0xe9ad('0xf')]);router[_0xe9ad('0xa')](_0xe9ad('0x10'),auth['isAuthenticated'](),controller[_0xe9ad('0x11')]);router[_0xe9ad('0xa')](_0xe9ad('0x12'),auth['isAuthenticated'](),controller[_0xe9ad('0x13')]);router[_0xe9ad('0x14')]('/',auth[_0xe9ad('0xb')](),controller['create']);router[_0xe9ad('0x15')](_0xe9ad('0x16'),auth['isAuthenticated'](),controller[_0xe9ad('0x17')]);router[_0xe9ad('0x18')](_0xe9ad('0x16'),auth[_0xe9ad('0xb')](),controller[_0xe9ad('0x19')]);module[_0xe9ad('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c4cbe8f..d26b140 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 _0x6484=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize','moment'];(function(_0xbb5c55,_0xad78ba){var _0x4121b8=function(_0x2b38dc){while(--_0x2b38dc){_0xbb5c55['push'](_0xbb5c55['shift']());}};_0x4121b8(++_0xad78ba);}(_0x6484,0x1d2));var _0x4648=function(_0x29802d,_0xbd2062){_0x29802d=_0x29802d-0x0;var _0x3590f=_0x6484[_0x29802d];return _0x3590f;};'use strict';var Sequelize=require(_0x4648('0x0'));var moment=require(_0x4648('0x1'));module[_0x4648('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4648('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4648('0x4')](_0x4648('0x5'),_0x4648('0x6'),_0x4648('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x4648('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4648('0x8')]},'status':{'type':Sequelize[_0x4648('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x4648('0x4')](_0x4648('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x4648('0xa')](0xb)[_0x4648('0xb')]},'reportType':{'type':Sequelize[_0x4648('0x3')]}}; \ No newline at end of file +var _0xe51c=['Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','xlsx','DATE'];(function(_0x1f2b2b,_0x20baed){var _0x1da0c8=function(_0x37fa60){while(--_0x37fa60){_0x1f2b2b['push'](_0x1f2b2b['shift']());}};_0x1da0c8(++_0x20baed);}(_0xe51c,0xdd));var _0xce51=function(_0x30a02e,_0x1338e8){_0x30a02e=_0x30a02e-0x0;var _0x36102a=_0xe51c[_0x30a02e];return _0x36102a;};'use strict';var Sequelize=require(_0xce51('0x0'));var moment=require(_0xce51('0x1'));module[_0xce51('0x2')]={'name':{'type':Sequelize[_0xce51('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xce51('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xce51('0x4'),'pdf',_0xce51('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xce51('0x6')]},'endDate':{'type':Sequelize[_0xce51('0x6')]},'status':{'type':Sequelize[_0xce51('0x3')],'defaultValue':_0xce51('0x7')},'type':{'type':Sequelize['ENUM'](_0xce51('0x8'),_0xce51('0x9')),'allowNull':![],'defaultValue':_0xce51('0x8')},'reportId':{'type':Sequelize[_0xce51('0xa')](0xb)[_0xce51('0xb')]},'reportType':{'type':Sequelize[_0xce51('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index add4569..c26872c 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 _0x2280=['exists','join','server/files/reports','format','basename','output','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','get','ExtractedReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','existsSync','root','Sequelize','ValidationError'];(function(_0x573289,_0x191a2d){var _0x35184b=function(_0x2e4440){while(--_0x2e4440){_0x573289['push'](_0x573289['shift']());}};_0x35184b(++_0x191a2d);}(_0x2280,0xc2));var _0x0228=function(_0x2f1090,_0x1bada4){_0x2f1090=_0x2f1090-0x0;var _0x1da182=_0x2280[_0x2f1090];return _0x1da182;};'use strict';var emlformat=require(_0x0228('0x0'));var rimraf=require(_0x0228('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0228('0x2'));var rp=require(_0x0228('0x3'));var moment=require('moment');var BPromise=require(_0x0228('0x4'));var Mustache=require(_0x0228('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0228('0x6'));var csv=require(_0x0228('0x7'));var ejs=require(_0x0228('0x8'));var fs=require('fs');var fs_extra=require(_0x0228('0x9'));var _=require(_0x0228('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0228('0xb'));var deskjs=require(_0x0228('0xc'));var toCsv=require(_0x0228('0x7'));var querystring=require(_0x0228('0xd'));var Papa=require(_0x0228('0xe'));var Redis=require(_0x0228('0xf'));var authService=require(_0x0228('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0228('0x11'));var hardwareService=require(_0x0228('0x12'));var logger=require(_0x0228('0x13'))('api');var utils=require(_0x0228('0x14'));var config=require(_0x0228('0x15'));var licenseUtil=require(_0x0228('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ba95d,_0x106f16){_0x106f16=_0x106f16||0xcc;return function(_0x548a41){if(_0x548a41){return _0x3ba95d[_0x0228('0x17')](_0x106f16);}return _0x3ba95d[_0x0228('0x18')](_0x106f16)['end']();};}function respondWithResult(_0x2b28e3,_0x51bba5){_0x51bba5=_0x51bba5||0xc8;return function(_0x2bcd0d){if(_0x2bcd0d){return _0x2b28e3[_0x0228('0x18')](_0x51bba5)[_0x0228('0x19')](_0x2bcd0d);}};}function respondWithFilteredResult(_0x553d7c,_0x492790){return function(_0x4f6709){if(_0x4f6709){var _0x216944=typeof _0x492790[_0x0228('0x1a')]===_0x0228('0x1b')&&typeof _0x492790[_0x0228('0x1c')]===_0x0228('0x1b');var _0x3fb58f=_0x4f6709[_0x0228('0x1d')];var _0x5b3baf=_0x216944?0x0:_0x492790[_0x0228('0x1a')];var _0x2625ef=_0x216944?_0x4f6709[_0x0228('0x1d')]:_0x492790['offset']+_0x492790[_0x0228('0x1c')];var _0x133e64;if(_0x2625ef>=_0x3fb58f){_0x2625ef=_0x3fb58f;_0x133e64=0xc8;}else{_0x133e64=0xce;}_0x553d7c['status'](_0x133e64);return _0x553d7c[_0x0228('0x1e')]('Content-Range',_0x5b3baf+'-'+_0x2625ef+'/'+_0x3fb58f)[_0x0228('0x19')](_0x4f6709);}return null;};}function patchUpdates(_0x27b00e){return function(_0x2f83bf){try{jsonpatch[_0x0228('0x1f')](_0x2f83bf,_0x27b00e,!![]);}catch(_0x1e8a85){return BPromise['reject'](_0x1e8a85);}return _0x2f83bf[_0x0228('0x20')]();};}function saveUpdates(_0x26391d,_0x4afce1){return function(_0x4555b4){if(_0x4555b4){return _0x4555b4[_0x0228('0x21')](_0x26391d)[_0x0228('0x22')](function(_0x5e4129){return _0x5e4129;});}return null;};}function removeEntity(_0x5616bd,_0x176764){return function(_0x40cf0a){if(_0x40cf0a){return _0x40cf0a['destroy']()['then'](function(){var _0x24cb1b=_0x40cf0a[_0x0228('0x23')]({'plain':!![]});var _0x23b635=_0x0228('0x24');return db[_0x0228('0x25')][_0x0228('0x26')]({'where':{'type':_0x23b635,'resourceId':_0x24cb1b['id']}})['then'](function(){return _0x40cf0a;});})[_0x0228('0x22')](function(){_0x5616bd[_0x0228('0x18')](0xcc)[_0x0228('0x27')]();});}};}function handleEntityNotFound(_0x4f17a1,_0x23fa6c){return function(_0x5d38b6){if(!_0x5d38b6){_0x4f17a1['sendStatus'](0x194);}return _0x5d38b6;};}function handleError(_0xba4b73,_0xce3988){_0xce3988=_0xce3988||0x1f4;return function(_0x59cb1b){logger[_0x0228('0x28')](_0x59cb1b['stack']);if(_0x59cb1b[_0x0228('0x29')]){delete _0x59cb1b[_0x0228('0x29')];}_0xba4b73[_0x0228('0x18')](_0xce3988)[_0x0228('0x2a')](_0x59cb1b);};}exports[_0x0228('0x2b')]=function(_0xf09731,_0x3e32bf){var _0x10ce94={},_0x59fce={},_0x60b7c8={'count':0x0,'rows':[]};var _0x5966b2=_[_0x0228('0x2c')](db[_0x0228('0x2d')][_0x0228('0x2e')],function(_0x304511){return{'name':_0x304511[_0x0228('0x2f')],'type':_0x304511[_0x0228('0x30')][_0x0228('0x31')]};});_0x59fce['model']=_[_0x0228('0x2c')](_0x5966b2,_0x0228('0x29'));_0x59fce[_0x0228('0x32')]=_[_0x0228('0x33')](_0xf09731['query']);_0x59fce['filters']=_[_0x0228('0x34')](_0x59fce[_0x0228('0x35')],_0x59fce[_0x0228('0x32')]);_0x10ce94[_0x0228('0x36')]=_['intersection'](_0x59fce['model'],qs[_0x0228('0x37')](_0xf09731[_0x0228('0x32')]['fields']));_0x10ce94[_0x0228('0x36')]=_0x10ce94['attributes'][_0x0228('0x38')]?_0x10ce94['attributes']:_0x59fce['model'];if(!_0xf09731[_0x0228('0x32')]['hasOwnProperty'](_0x0228('0x39'))){_0x10ce94[_0x0228('0x1c')]=qs[_0x0228('0x1c')](_0xf09731['query'][_0x0228('0x1c')]);_0x10ce94[_0x0228('0x1a')]=qs[_0x0228('0x1a')](_0xf09731[_0x0228('0x32')][_0x0228('0x1a')]);}_0x10ce94['order']=qs[_0x0228('0x3a')](_0xf09731[_0x0228('0x32')][_0x0228('0x3a')]);_0x10ce94[_0x0228('0x3b')]=qs[_0x0228('0x3c')](_[_0x0228('0x3d')](_0xf09731[_0x0228('0x32')],_0x59fce['filters']),_0x5966b2);if(_0xf09731['query'][_0x0228('0x3e')]){_0x10ce94[_0x0228('0x3b')]=_[_0x0228('0x3f')](_0x10ce94['where'],{'$or':_[_0x0228('0x2c')](_0x5966b2,function(_0x557552){if(_0x557552['type']!==_0x0228('0x40')){var _0xddd4dc={};_0xddd4dc[_0x557552[_0x0228('0x29')]]={'$like':'%'+_0xf09731[_0x0228('0x32')][_0x0228('0x3e')]+'%'};return _0xddd4dc;}})});}_0x10ce94=_['merge']({},_0x10ce94,_0xf09731[_0x0228('0x41')]);var _0x5a0cd5={'where':_0x10ce94[_0x0228('0x3b')]};return db[_0x0228('0x2d')][_0x0228('0x1d')](_0x5a0cd5)[_0x0228('0x22')](function(_0x3fe9c1){_0x60b7c8[_0x0228('0x1d')]=_0x3fe9c1;if(_0xf09731[_0x0228('0x32')]['includeAll']){_0x10ce94['include']=[{'all':!![]}];}return db[_0x0228('0x2d')][_0x0228('0x42')](_0x10ce94);})[_0x0228('0x22')](function(_0x53c4e3){_0x60b7c8['rows']=_0x53c4e3;return _0x60b7c8;})[_0x0228('0x22')](respondWithFilteredResult(_0x3e32bf,_0x10ce94))[_0x0228('0x43')](handleError(_0x3e32bf,null));};exports[_0x0228('0x44')]=function(_0x15e630,_0x2848f9){var _0x5c90b3={'raw':!![],'where':{'id':_0x15e630[_0x0228('0x45')]['id']}},_0x3a0b3b={};_0x3a0b3b[_0x0228('0x35')]=_['keys'](db[_0x0228('0x2d')][_0x0228('0x2e')]);_0x3a0b3b[_0x0228('0x32')]=_[_0x0228('0x33')](_0x15e630[_0x0228('0x32')]);_0x3a0b3b[_0x0228('0x3c')]=_['intersection'](_0x3a0b3b['model'],_0x3a0b3b['query']);_0x5c90b3[_0x0228('0x36')]=_[_0x0228('0x34')](_0x3a0b3b['model'],qs[_0x0228('0x37')](_0x15e630['query'][_0x0228('0x37')]));_0x5c90b3[_0x0228('0x36')]=_0x5c90b3[_0x0228('0x36')][_0x0228('0x38')]?_0x5c90b3[_0x0228('0x36')]:_0x3a0b3b[_0x0228('0x35')];if(_0x15e630[_0x0228('0x32')][_0x0228('0x46')]){_0x5c90b3[_0x0228('0x47')]=[{'all':!![]}];}_0x5c90b3=_[_0x0228('0x3f')]({},_0x5c90b3,_0x15e630[_0x0228('0x41')]);return db[_0x0228('0x2d')][_0x0228('0x48')](_0x5c90b3)[_0x0228('0x22')](handleEntityNotFound(_0x2848f9,null))[_0x0228('0x22')](respondWithResult(_0x2848f9,null))[_0x0228('0x43')](handleError(_0x2848f9,null));};exports[_0x0228('0x49')]=function(_0x23d1ea,_0x29c7a5){return db[_0x0228('0x2d')][_0x0228('0x49')](_0x23d1ea[_0x0228('0x4a')],{})[_0x0228('0x22')](function(_0x2d58ee){var _0x2f2dd4=_0x23d1ea[_0x0228('0x4b')]['get']({'plain':!![]});if(!_0x2f2dd4)throw new Error(_0x0228('0x4c'));if(_0x2f2dd4[_0x0228('0x4d')]===_0x0228('0x4b')){var _0x58d5c8=_0x2d58ee['get']({'plain':!![]});var _0x1fbc4c=_0x0228('0x24');return db[_0x0228('0x4e')]['find']({'where':{'name':_0x1fbc4c,'userProfileId':_0x2f2dd4[_0x0228('0x4f')]},'raw':!![]})[_0x0228('0x22')](function(_0x25cc64){if(_0x25cc64&&_0x25cc64[_0x0228('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x58d5c8[_0x0228('0x29')],'resourceId':_0x58d5c8['id'],'type':_0x25cc64[_0x0228('0x29')],'sectionId':_0x25cc64['id']},{})[_0x0228('0x22')](function(){return _0x2d58ee;});}else{return _0x2d58ee;}})['catch'](function(_0xe5036d){logger[_0x0228('0x28')](_0x0228('0x51'),_0xe5036d);throw _0xe5036d;});}return _0x2d58ee;})[_0x0228('0x22')](respondWithResult(_0x29c7a5,0xc9))[_0x0228('0x43')](handleError(_0x29c7a5,null));};exports[_0x0228('0x21')]=function(_0x59b522,_0x53a497){if(_0x59b522[_0x0228('0x4a')]['id']){delete _0x59b522[_0x0228('0x4a')]['id'];}return db[_0x0228('0x2d')][_0x0228('0x48')]({'where':{'id':_0x59b522[_0x0228('0x45')]['id']}})['then'](handleEntityNotFound(_0x53a497,null))[_0x0228('0x22')](saveUpdates(_0x59b522['body'],null))[_0x0228('0x22')](respondWithResult(_0x53a497,null))[_0x0228('0x43')](handleError(_0x53a497,null));};exports[_0x0228('0x26')]=function(_0x5be7c5,_0x150ba1){return db[_0x0228('0x2d')][_0x0228('0x48')]({'where':{'id':_0x5be7c5[_0x0228('0x45')]['id']}})[_0x0228('0x22')](handleEntityNotFound(_0x150ba1,null))[_0x0228('0x22')](removeEntity(_0x150ba1,null))['catch'](handleError(_0x150ba1,null));};exports[_0x0228('0x52')]=function(_0x5a16d2,_0x481810,_0x3e8101){return db[_0x0228('0x2d')][_0x0228('0x48')]({'where':{'id':_0x5a16d2[_0x0228('0x45')]['id']},'attributes':[_0x0228('0x29'),'basename',_0x0228('0x53'),'output'],'raw':!![]})[_0x0228('0x22')](handleEntityNotFound(_0x481810,null))[_0x0228('0x22')](function(_0x1e7ab9){if(_0x1e7ab9){if(!fs[_0x0228('0x54')](path['join'](config[_0x0228('0x55')],'server/files/reports',_0x1e7ab9[_0x0228('0x53')]))){throw new db[(_0x0228('0x56'))][(_0x0228('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5a16d2[_0x0228('0x32')][_0x0228('0x58')]){return _0x481810[_0x0228('0x17')](0xc8);}return _0x481810['download'](path[_0x0228('0x59')](config[_0x0228('0x55')],_0x0228('0x5a'),_0x1e7ab9[_0x0228('0x53')]),util[_0x0228('0x5b')]('%s.%s',_0x1e7ab9[_0x0228('0x5c')]||_0x1e7ab9[_0x0228('0x29')],_0x1e7ab9[_0x0228('0x5d')]['toLowerCase']()));}})[_0x0228('0x43')](handleError(_0x481810,null));}; \ No newline at end of file +var _0x9a3c=['error','stack','name','send','map','AnalyticExtractedReport','fieldName','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','sendStatus'];(function(_0x50811d,_0x17d91c){var _0x4f1582=function(_0x8450cc){while(--_0x8450cc){_0x50811d['push'](_0x50811d['shift']());}};_0x4f1582(++_0x17d91c);}(_0x9a3c,0x95));var _0xc9a3=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9a3c[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require(_0xc9a3('0x0'));var rimraf=require(_0xc9a3('0x1'));var zipdir=require(_0xc9a3('0x2'));var jsonpatch=require(_0xc9a3('0x3'));var rp=require(_0xc9a3('0x4'));var moment=require(_0xc9a3('0x5'));var BPromise=require(_0xc9a3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9a3('0x7'));var sox=require(_0xc9a3('0x8'));var csv=require(_0xc9a3('0x9'));var ejs=require(_0xc9a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9a3('0xb'));var squel=require(_0xc9a3('0xc'));var crypto=require(_0xc9a3('0xd'));var jsforce=require(_0xc9a3('0xe'));var deskjs=require(_0xc9a3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc9a3('0x10'));var Papa=require(_0xc9a3('0x11'));var Redis=require(_0xc9a3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc9a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9a3('0x14'));var logger=require(_0xc9a3('0x15'))(_0xc9a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9a3('0x17'))['db'];function respondWithStatusCode(_0x195ca3,_0x5195ce){_0x5195ce=_0x5195ce||0xcc;return function(_0x59f8bc){if(_0x59f8bc){return _0x195ca3['sendStatus'](_0x5195ce);}return _0x195ca3[_0xc9a3('0x18')](_0x5195ce)[_0xc9a3('0x19')]();};}function respondWithResult(_0x40ce57,_0x2428a3){_0x2428a3=_0x2428a3||0xc8;return function(_0x5bf20e){if(_0x5bf20e){return _0x40ce57[_0xc9a3('0x18')](_0x2428a3)['json'](_0x5bf20e);}};}function respondWithFilteredResult(_0x13bf9a,_0x5cdb88){return function(_0x4dba10){if(_0x4dba10){var _0x16a5fc=typeof _0x5cdb88[_0xc9a3('0x1a')]===_0xc9a3('0x1b')&&typeof _0x5cdb88[_0xc9a3('0x1c')]==='undefined';var _0x42ff8b=_0x4dba10[_0xc9a3('0x1d')];var _0x462399=_0x16a5fc?0x0:_0x5cdb88[_0xc9a3('0x1a')];var _0x5831fd=_0x16a5fc?_0x4dba10[_0xc9a3('0x1d')]:_0x5cdb88['offset']+_0x5cdb88['limit'];var _0x30df79;if(_0x5831fd>=_0x42ff8b){_0x5831fd=_0x42ff8b;_0x30df79=0xc8;}else{_0x30df79=0xce;}_0x13bf9a['status'](_0x30df79);return _0x13bf9a[_0xc9a3('0x1e')](_0xc9a3('0x1f'),_0x462399+'-'+_0x5831fd+'/'+_0x42ff8b)[_0xc9a3('0x20')](_0x4dba10);}return null;};}function patchUpdates(_0x6a3d10){return function(_0x403a8a){try{jsonpatch[_0xc9a3('0x21')](_0x403a8a,_0x6a3d10,!![]);}catch(_0x2eeef2){return BPromise[_0xc9a3('0x22')](_0x2eeef2);}return _0x403a8a[_0xc9a3('0x23')]();};}function saveUpdates(_0x5bf8af,_0x5c4659){return function(_0x318ca7){if(_0x318ca7){return _0x318ca7[_0xc9a3('0x24')](_0x5bf8af)[_0xc9a3('0x25')](function(_0x371b68){return _0x371b68;});}return null;};}function removeEntity(_0x2d86be,_0x29a59f){return function(_0x2c9a94){if(_0x2c9a94){return _0x2c9a94[_0xc9a3('0x26')]()['then'](function(){var _0x200dde=_0x2c9a94[_0xc9a3('0x27')]({'plain':!![]});var _0x372b22='ExtractedReports';return db['UserProfileResource'][_0xc9a3('0x26')]({'where':{'type':_0x372b22,'resourceId':_0x200dde['id']}})[_0xc9a3('0x25')](function(){return _0x2c9a94;});})[_0xc9a3('0x25')](function(){_0x2d86be[_0xc9a3('0x18')](0xcc)[_0xc9a3('0x19')]();});}};}function handleEntityNotFound(_0x16cc54,_0x13ab37){return function(_0x23f03b){if(!_0x23f03b){_0x16cc54[_0xc9a3('0x28')](0x194);}return _0x23f03b;};}function handleError(_0x54b8f8,_0x1f794c){_0x1f794c=_0x1f794c||0x1f4;return function(_0x2bfe87){logger[_0xc9a3('0x29')](_0x2bfe87[_0xc9a3('0x2a')]);if(_0x2bfe87[_0xc9a3('0x2b')]){delete _0x2bfe87[_0xc9a3('0x2b')];}_0x54b8f8[_0xc9a3('0x18')](_0x1f794c)[_0xc9a3('0x2c')](_0x2bfe87);};}exports['index']=function(_0x4302a2,_0x877aa8){var _0x1a0c47={},_0x166b3e={},_0x1bbbf4={'count':0x0,'rows':[]};var _0x17b56c=_[_0xc9a3('0x2d')](db[_0xc9a3('0x2e')]['rawAttributes'],function(_0x33ade8){return{'name':_0x33ade8[_0xc9a3('0x2f')],'type':_0x33ade8['type']['key']};});_0x166b3e[_0xc9a3('0x30')]=_['map'](_0x17b56c,_0xc9a3('0x2b'));_0x166b3e[_0xc9a3('0x31')]=_[_0xc9a3('0x32')](_0x4302a2[_0xc9a3('0x31')]);_0x166b3e[_0xc9a3('0x33')]=_['intersection'](_0x166b3e['model'],_0x166b3e[_0xc9a3('0x31')]);_0x1a0c47[_0xc9a3('0x34')]=_['intersection'](_0x166b3e[_0xc9a3('0x30')],qs[_0xc9a3('0x35')](_0x4302a2[_0xc9a3('0x31')][_0xc9a3('0x35')]));_0x1a0c47[_0xc9a3('0x34')]=_0x1a0c47[_0xc9a3('0x34')][_0xc9a3('0x36')]?_0x1a0c47['attributes']:_0x166b3e[_0xc9a3('0x30')];if(!_0x4302a2[_0xc9a3('0x31')]['hasOwnProperty'](_0xc9a3('0x37'))){_0x1a0c47[_0xc9a3('0x1c')]=qs[_0xc9a3('0x1c')](_0x4302a2['query'][_0xc9a3('0x1c')]);_0x1a0c47[_0xc9a3('0x1a')]=qs['offset'](_0x4302a2[_0xc9a3('0x31')]['offset']);}_0x1a0c47[_0xc9a3('0x38')]=qs[_0xc9a3('0x39')](_0x4302a2['query'][_0xc9a3('0x39')]);_0x1a0c47['where']=qs['filters'](_[_0xc9a3('0x3a')](_0x4302a2[_0xc9a3('0x31')],_0x166b3e[_0xc9a3('0x33')]),_0x17b56c);if(_0x4302a2[_0xc9a3('0x31')]['filter']){_0x1a0c47[_0xc9a3('0x3b')]=_[_0xc9a3('0x3c')](_0x1a0c47[_0xc9a3('0x3b')],{'$or':_[_0xc9a3('0x2d')](_0x17b56c,function(_0x1ca906){if(_0x1ca906[_0xc9a3('0x3d')]!==_0xc9a3('0x3e')){var _0x11cb35={};_0x11cb35[_0x1ca906[_0xc9a3('0x2b')]]={'$like':'%'+_0x4302a2[_0xc9a3('0x31')][_0xc9a3('0x3f')]+'%'};return _0x11cb35;}})});}_0x1a0c47=_[_0xc9a3('0x3c')]({},_0x1a0c47,_0x4302a2[_0xc9a3('0x40')]);var _0x371ab9={'where':_0x1a0c47[_0xc9a3('0x3b')]};return db[_0xc9a3('0x2e')][_0xc9a3('0x1d')](_0x371ab9)[_0xc9a3('0x25')](function(_0x5ecb34){_0x1bbbf4['count']=_0x5ecb34;if(_0x4302a2['query']['includeAll']){_0x1a0c47[_0xc9a3('0x41')]=[{'all':!![]}];}return db[_0xc9a3('0x2e')][_0xc9a3('0x42')](_0x1a0c47);})['then'](function(_0x2d62a6){_0x1bbbf4[_0xc9a3('0x43')]=_0x2d62a6;return _0x1bbbf4;})[_0xc9a3('0x25')](respondWithFilteredResult(_0x877aa8,_0x1a0c47))[_0xc9a3('0x44')](handleError(_0x877aa8,null));};exports['show']=function(_0xf8ed3d,_0x125f78){var _0xd2f882={'raw':!![],'where':{'id':_0xf8ed3d[_0xc9a3('0x45')]['id']}},_0x536da5={};_0x536da5[_0xc9a3('0x30')]=_[_0xc9a3('0x32')](db[_0xc9a3('0x2e')][_0xc9a3('0x46')]);_0x536da5[_0xc9a3('0x31')]=_[_0xc9a3('0x32')](_0xf8ed3d['query']);_0x536da5[_0xc9a3('0x33')]=_['intersection'](_0x536da5[_0xc9a3('0x30')],_0x536da5[_0xc9a3('0x31')]);_0xd2f882[_0xc9a3('0x34')]=_['intersection'](_0x536da5[_0xc9a3('0x30')],qs[_0xc9a3('0x35')](_0xf8ed3d[_0xc9a3('0x31')][_0xc9a3('0x35')]));_0xd2f882[_0xc9a3('0x34')]=_0xd2f882['attributes'][_0xc9a3('0x36')]?_0xd2f882[_0xc9a3('0x34')]:_0x536da5['model'];if(_0xf8ed3d[_0xc9a3('0x31')][_0xc9a3('0x47')]){_0xd2f882[_0xc9a3('0x41')]=[{'all':!![]}];}_0xd2f882=_[_0xc9a3('0x3c')]({},_0xd2f882,_0xf8ed3d['options']);return db[_0xc9a3('0x2e')][_0xc9a3('0x48')](_0xd2f882)['then'](handleEntityNotFound(_0x125f78,null))[_0xc9a3('0x25')](respondWithResult(_0x125f78,null))[_0xc9a3('0x44')](handleError(_0x125f78,null));};exports[_0xc9a3('0x49')]=function(_0x4f8e67,_0x3dd609){return db[_0xc9a3('0x2e')][_0xc9a3('0x49')](_0x4f8e67[_0xc9a3('0x4a')],{})[_0xc9a3('0x25')](function(_0x7efff5){var _0x3df796=_0x4f8e67[_0xc9a3('0x4b')]['get']({'plain':!![]});if(!_0x3df796)throw new Error(_0xc9a3('0x4c'));if(_0x3df796['role']===_0xc9a3('0x4b')){var _0x571bae=_0x7efff5[_0xc9a3('0x27')]({'plain':!![]});var _0x57bae9='ExtractedReports';return db['UserProfileSection'][_0xc9a3('0x48')]({'where':{'name':_0x57bae9,'userProfileId':_0x3df796[_0xc9a3('0x4d')]},'raw':!![]})['then'](function(_0x49baa2){if(_0x49baa2&&_0x49baa2[_0xc9a3('0x4e')]===0x0){return db[_0xc9a3('0x4f')][_0xc9a3('0x49')]({'name':_0x571bae[_0xc9a3('0x2b')],'resourceId':_0x571bae['id'],'type':_0x49baa2[_0xc9a3('0x2b')],'sectionId':_0x49baa2['id']},{})['then'](function(){return _0x7efff5;});}else{return _0x7efff5;}})[_0xc9a3('0x44')](function(_0x16de1e){logger[_0xc9a3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16de1e);throw _0x16de1e;});}return _0x7efff5;})['then'](respondWithResult(_0x3dd609,0xc9))['catch'](handleError(_0x3dd609,null));};exports[_0xc9a3('0x24')]=function(_0x24ad95,_0x6e10f9){if(_0x24ad95['body']['id']){delete _0x24ad95[_0xc9a3('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0xc9a3('0x48')]({'where':{'id':_0x24ad95['params']['id']}})[_0xc9a3('0x25')](handleEntityNotFound(_0x6e10f9,null))[_0xc9a3('0x25')](saveUpdates(_0x24ad95[_0xc9a3('0x4a')],null))[_0xc9a3('0x25')](respondWithResult(_0x6e10f9,null))[_0xc9a3('0x44')](handleError(_0x6e10f9,null));};exports[_0xc9a3('0x26')]=function(_0x4c5251,_0x4d14a8){return db['AnalyticExtractedReport'][_0xc9a3('0x48')]({'where':{'id':_0x4c5251[_0xc9a3('0x45')]['id']}})[_0xc9a3('0x25')](handleEntityNotFound(_0x4d14a8,null))['then'](removeEntity(_0x4d14a8,null))['catch'](handleError(_0x4d14a8,null));};exports[_0xc9a3('0x50')]=function(_0x259621,_0xa899b1,_0x1497d1){return db[_0xc9a3('0x2e')][_0xc9a3('0x48')]({'where':{'id':_0x259621['params']['id']},'attributes':['name',_0xc9a3('0x51'),_0xc9a3('0x52'),_0xc9a3('0x53')],'raw':!![]})[_0xc9a3('0x25')](handleEntityNotFound(_0xa899b1,null))[_0xc9a3('0x25')](function(_0x1f5df7){if(_0x1f5df7){if(!fs[_0xc9a3('0x54')](path[_0xc9a3('0x55')](config[_0xc9a3('0x56')],_0xc9a3('0x57'),_0x1f5df7[_0xc9a3('0x52')]))){throw new db[(_0xc9a3('0x58'))][(_0xc9a3('0x59'))](_0xc9a3('0x5a'));}if(_0x259621[_0xc9a3('0x31')][_0xc9a3('0x5b')]){return _0xa899b1[_0xc9a3('0x28')](0xc8);}return _0xa899b1['download'](path[_0xc9a3('0x55')](config['root'],_0xc9a3('0x57'),_0x1f5df7[_0xc9a3('0x52')]),util[_0xc9a3('0x5c')](_0xc9a3('0x5d'),_0x1f5df7[_0xc9a3('0x51')]||_0x1f5df7['name'],_0x1f5df7['output'][_0xc9a3('0x5e')]()));}})['catch'](handleError(_0xa899b1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 560045b..c16d603 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 _0xc240=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44c4b5,_0x2b3021){var _0x362934=function(_0x239a6d){while(--_0x239a6d){_0x44c4b5['push'](_0x44c4b5['shift']());}};_0x362934(++_0x2b3021);}(_0xc240,0x10d));var _0x0c24=function(_0x26d9e5,_0x13594a){_0x26d9e5=_0x26d9e5-0x0;var _0x18dbfa=_0xc240[_0x26d9e5];return _0x18dbfa;};'use strict';var _=require(_0x0c24('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c24('0x1'));var moment=require(_0x0c24('0x2'));var BPromise=require(_0x0c24('0x3'));var rp=require(_0x0c24('0x4'));var fs=require('fs');var path=require(_0x0c24('0x5'));var rimraf=require(_0x0c24('0x6'));var config=require(_0x0c24('0x7'));var attributes=require(_0x0c24('0x8'));module['exports']=function(_0x34dd4c,_0x2a8f1a){return _0x34dd4c[_0x0c24('0x9')](_0x0c24('0xa'),attributes,{'tableName':_0x0c24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ea1=['analytics_extracted_reports','util','api','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x45c55e,_0x18002b){var _0x5a9dd8=function(_0x389e52){while(--_0x389e52){_0x45c55e['push'](_0x45c55e['shift']());}};_0x5a9dd8(++_0x18002b);}(_0x0ea1,0xb5));var _0x10ea=function(_0x54b9e2,_0x47b06c){_0x54b9e2=_0x54b9e2-0x0;var _0x4859cc=_0x0ea1[_0x54b9e2];return _0x4859cc;};'use strict';var _=require('lodash');var util=require(_0x10ea('0x0'));var logger=require('../../config/logger')(_0x10ea('0x1'));var moment=require('moment');var BPromise=require(_0x10ea('0x2'));var rp=require(_0x10ea('0x3'));var fs=require('fs');var path=require(_0x10ea('0x4'));var rimraf=require('rimraf');var config=require(_0x10ea('0x5'));var attributes=require(_0x10ea('0x6'));module[_0x10ea('0x7')]=function(_0x4dfafc,_0x405754){return _0x4dfafc[_0x10ea('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x10ea('0x9'),'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 828b6a2..971deca 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 _0xd4a2=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x26eeed,_0x32f126){var _0x4c2ff8=function(_0x6296fe){while(--_0x6296fe){_0x26eeed['push'](_0x26eeed['shift']());}};_0x4c2ff8(++_0x32f126);}(_0xd4a2,0x173));var _0x2d4a=function(_0x32b8c9,_0x19950f){_0x32b8c9=_0x32b8c9-0x0;var _0x5f59a7=_0xd4a2[_0x32b8c9];return _0x5f59a7;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});} \ No newline at end of file +var _0x1137=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x46aa9c,_0x518160){var _0xf19a0b=function(_0x353d73){while(--_0x353d73){_0x46aa9c['push'](_0x46aa9c['shift']());}};_0xf19a0b(++_0x518160);}(_0x1137,0x183));var _0x7113=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x1137[_0x9307ea];return _0x295554;};'use strict';var _=require(_0x7113('0x0'));var util=require(_0x7113('0x1'));var moment=require(_0x7113('0x2'));var BPromise=require(_0x7113('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7113('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7113('0x5'));var logger=require('../../config/logger')(_0x7113('0x6'));var config=require(_0x7113('0x7'));var jayson=require(_0x7113('0x8'));var client=jayson[_0x7113('0x9')][_0x7113('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x518610,_0x4ae605,_0x532fa1){return new BPromise(function(_0x4ac528,_0x2fc982){return client['request'](_0x518610,_0x532fa1)['then'](function(_0xfe7490){logger[_0x7113('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ae605,_0x7113('0xc'));logger[_0x7113('0xd')](_0x7113('0xe'),_0x4ae605,_0x7113('0xc'),JSON[_0x7113('0xf')](_0xfe7490));if(_0xfe7490[_0x7113('0x10')]){if(_0xfe7490[_0x7113('0x10')][_0x7113('0x11')]===0x1f4){logger[_0x7113('0x10')](_0x7113('0x12'),_0x4ae605,_0xfe7490[_0x7113('0x10')]['message']);return _0x2fc982(_0xfe7490[_0x7113('0x10')]['message']);}logger[_0x7113('0x10')](_0x7113('0x12'),_0x4ae605,_0xfe7490[_0x7113('0x10')]['message']);return _0x4ac528(_0xfe7490[_0x7113('0x10')][_0x7113('0x13')]);}else{logger[_0x7113('0xb')](_0x7113('0x12'),_0x4ae605,'request\x20sent');_0x4ac528(_0xfe7490[_0x7113('0x14')]['message']);}})['catch'](function(_0x215e01){logger[_0x7113('0x10')](_0x7113('0x12'),_0x4ae605,_0x215e01);_0x2fc982(_0x215e01);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 37ec6bb..37b5306 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 _0xaf32=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update','destroy','multer','connect-timeout','express'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xaf32,0x18c));var _0x2af3=function(_0x243f79,_0x429e45){_0x243f79=_0x243f79-0x0;var _0x460321=_0xaf32[_0x243f79];return _0x460321;};'use strict';var multer=require(_0x2af3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2af3('0x1'));var express=require(_0x2af3('0x2'));var router=express[_0x2af3('0x3')]();var fs_extra=require(_0x2af3('0x4'));var auth=require(_0x2af3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2af3('0x6'));var controller=require(_0x2af3('0x7'));router[_0x2af3('0x8')]('/',auth[_0x2af3('0x9')](),controller[_0x2af3('0xa')]);router[_0x2af3('0x8')](_0x2af3('0xb'),auth[_0x2af3('0x9')](),controller[_0x2af3('0xc')]);router['get'](_0x2af3('0xd'),auth[_0x2af3('0x9')](),controller[_0x2af3('0xe')]);router['post']('/',auth[_0x2af3('0x9')](),controller[_0x2af3('0xf')]);router[_0x2af3('0x10')](_0x2af3('0xb'),auth['isAuthenticated'](),controller[_0x2af3('0x11')]);router['delete'](_0x2af3('0xb'),auth[_0x2af3('0x9')](),controller[_0x2af3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3588=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','put','delete','multer','util','path','connect-timeout'];(function(_0x2a2a4a,_0x30e750){var _0xbd4c98=function(_0x2b6339){while(--_0x2b6339){_0x2a2a4a['push'](_0x2a2a4a['shift']());}};_0xbd4c98(++_0x30e750);}(_0x3588,0xf8));var _0x8358=function(_0x4310e8,_0x3ba783){_0x4310e8=_0x4310e8-0x0;var _0x301445=_0x3588[_0x4310e8];return _0x301445;};'use strict';var multer=require(_0x8358('0x0'));var util=require(_0x8358('0x1'));var path=require(_0x8358('0x2'));var timeout=require(_0x8358('0x3'));var express=require(_0x8358('0x4'));var router=express[_0x8358('0x5')]();var fs_extra=require(_0x8358('0x6'));var auth=require(_0x8358('0x7'));var interaction=require(_0x8358('0x8'));var config=require('../../config/environment');var controller=require(_0x8358('0x9'));router['get']('/',auth[_0x8358('0xa')](),controller[_0x8358('0xb')]);router[_0x8358('0xc')](_0x8358('0xd'),auth[_0x8358('0xa')](),controller[_0x8358('0xe')]);router[_0x8358('0xc')](_0x8358('0xf'),auth[_0x8358('0xa')](),controller[_0x8358('0x10')]);router[_0x8358('0x11')]('/',auth['isAuthenticated'](),controller[_0x8358('0x12')]);router[_0x8358('0x13')]('/:id',auth[_0x8358('0xa')](),controller['update']);router[_0x8358('0x14')]('/:id',auth['isAuthenticated'](),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 6ac4572..cd27679 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 _0x21f4=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x463177,_0x3976f9){var _0x129e20=function(_0x537734){while(--_0x537734){_0x463177['push'](_0x463177['shift']());}};_0x129e20(++_0x3976f9);}(_0x21f4,0x126));var _0x421f=function(_0x2595c2,_0x27a4fc){_0x2595c2=_0x2595c2-0x0;var _0x16f71a=_0x21f4[_0x2595c2];return _0x16f71a;};'use strict';var Sequelize=require(_0x421f('0x0'));module[_0x421f('0x1')]={'field':{'type':Sequelize[_0x421f('0x2')]},'alias':{'type':Sequelize[_0x421f('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x421f('0x3')]},'groupBy':{'type':Sequelize[_0x421f('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x421f('0x3')]},'custom':{'type':Sequelize[_0x421f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcba5=['STRING','BOOLEAN','exports','TEXT'];(function(_0x5e0aed,_0x46575e){var _0x23cb81=function(_0x1afb92){while(--_0x1afb92){_0x5e0aed['push'](_0x5e0aed['shift']());}};_0x23cb81(++_0x46575e);}(_0xcba5,0xee));var _0x5cba=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xcba5[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require('sequelize');module[_0x5cba('0x0')]={'field':{'type':Sequelize[_0x5cba('0x1')]},'alias':{'type':Sequelize[_0x5cba('0x2')]},'function':{'type':Sequelize[_0x5cba('0x2')]},'format':{'type':Sequelize[_0x5cba('0x2')]},'groupBy':{'type':Sequelize[_0x5cba('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x5cba('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 988acc2..da3e6b0 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 _0x5c83=['rawAttributes','length','includeAll','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','name','send','map','AnalyticFieldReport','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','pick','where','merge','options','include','rows','show','params'];(function(_0x5a364d,_0x264e9b){var _0x366d62=function(_0x58591c){while(--_0x58591c){_0x5a364d['push'](_0x5a364d['shift']());}};_0x366d62(++_0x264e9b);}(_0x5c83,0xb2));var _0x35c8=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x5c83[_0x93942f];return _0x23fcd8;};'use strict';var emlformat=require(_0x35c8('0x0'));var rimraf=require(_0x35c8('0x1'));var zipdir=require(_0x35c8('0x2'));var jsonpatch=require(_0x35c8('0x3'));var rp=require(_0x35c8('0x4'));var moment=require(_0x35c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x35c8('0x6'));var util=require(_0x35c8('0x7'));var path=require('path');var sox=require(_0x35c8('0x8'));var csv=require('to-csv');var ejs=require(_0x35c8('0x9'));var fs=require('fs');var fs_extra=require(_0x35c8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x35c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35c8('0xd'));var Papa=require(_0x35c8('0xe'));var Redis=require(_0x35c8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x35c8('0x10'));var as=require(_0x35c8('0x11'));var hardwareService=require(_0x35c8('0x12'));var logger=require(_0x35c8('0x13'))(_0x35c8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x35c8('0x15'));var db=require(_0x35c8('0x16'))['db'];function respondWithStatusCode(_0x3b3c91,_0x4c597e){_0x4c597e=_0x4c597e||0xcc;return function(_0x1802b2){if(_0x1802b2){return _0x3b3c91[_0x35c8('0x17')](_0x4c597e);}return _0x3b3c91[_0x35c8('0x18')](_0x4c597e)[_0x35c8('0x19')]();};}function respondWithResult(_0x52bbd7,_0x17ab37){_0x17ab37=_0x17ab37||0xc8;return function(_0x39390c){if(_0x39390c){return _0x52bbd7[_0x35c8('0x18')](_0x17ab37)[_0x35c8('0x1a')](_0x39390c);}};}function respondWithFilteredResult(_0x1da72f,_0x3f1a1e){return function(_0x71a68f){if(_0x71a68f){var _0x2eee79=typeof _0x3f1a1e[_0x35c8('0x1b')]==='undefined'&&typeof _0x3f1a1e[_0x35c8('0x1c')]===_0x35c8('0x1d');var _0x203277=_0x71a68f[_0x35c8('0x1e')];var _0x3b54d0=_0x2eee79?0x0:_0x3f1a1e['offset'];var _0x23f337=_0x2eee79?_0x71a68f[_0x35c8('0x1e')]:_0x3f1a1e['offset']+_0x3f1a1e[_0x35c8('0x1c')];var _0xd76bba;if(_0x23f337>=_0x203277){_0x23f337=_0x203277;_0xd76bba=0xc8;}else{_0xd76bba=0xce;}_0x1da72f['status'](_0xd76bba);return _0x1da72f['set'](_0x35c8('0x1f'),_0x3b54d0+'-'+_0x23f337+'/'+_0x203277)[_0x35c8('0x1a')](_0x71a68f);}return null;};}function patchUpdates(_0x22273b){return function(_0x13873c){try{jsonpatch[_0x35c8('0x20')](_0x13873c,_0x22273b,!![]);}catch(_0x33bc60){return BPromise[_0x35c8('0x21')](_0x33bc60);}return _0x13873c[_0x35c8('0x22')]();};}function saveUpdates(_0x80d4a7,_0x1801c7){return function(_0x4f895d){if(_0x4f895d){return _0x4f895d['update'](_0x80d4a7)[_0x35c8('0x23')](function(_0x488472){return _0x488472;});}return null;};}function removeEntity(_0x4867ec,_0x4afec9){return function(_0xc6b330){if(_0xc6b330){return _0xc6b330[_0x35c8('0x24')]()[_0x35c8('0x23')](function(){_0x4867ec[_0x35c8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1869fc,_0x20569c){return function(_0x1bbe32){if(!_0x1bbe32){_0x1869fc[_0x35c8('0x17')](0x194);}return _0x1bbe32;};}function handleError(_0x33d28f,_0x48ab3c){_0x48ab3c=_0x48ab3c||0x1f4;return function(_0x38821f){logger[_0x35c8('0x25')](_0x38821f['stack']);if(_0x38821f[_0x35c8('0x26')]){delete _0x38821f['name'];}_0x33d28f[_0x35c8('0x18')](_0x48ab3c)[_0x35c8('0x27')](_0x38821f);};}exports['index']=function(_0x5397e4,_0x5e10c8){var _0x2314b6={},_0x2b4787={},_0x32998a={'count':0x0,'rows':[]};var _0x2e8d37=_[_0x35c8('0x28')](db[_0x35c8('0x29')]['rawAttributes'],function(_0x250c02){return{'name':_0x250c02[_0x35c8('0x2a')],'type':_0x250c02[_0x35c8('0x2b')]['key']};});_0x2b4787[_0x35c8('0x2c')]=_[_0x35c8('0x28')](_0x2e8d37,'name');_0x2b4787[_0x35c8('0x2d')]=_[_0x35c8('0x2e')](_0x5397e4[_0x35c8('0x2d')]);_0x2b4787['filters']=_['intersection'](_0x2b4787[_0x35c8('0x2c')],_0x2b4787[_0x35c8('0x2d')]);_0x2314b6[_0x35c8('0x2f')]=_[_0x35c8('0x30')](_0x2b4787[_0x35c8('0x2c')],qs[_0x35c8('0x31')](_0x5397e4[_0x35c8('0x2d')]['fields']));_0x2314b6[_0x35c8('0x2f')]=_0x2314b6['attributes']['length']?_0x2314b6[_0x35c8('0x2f')]:_0x2b4787[_0x35c8('0x2c')];if(!_0x5397e4[_0x35c8('0x2d')][_0x35c8('0x32')](_0x35c8('0x33'))){_0x2314b6[_0x35c8('0x1c')]=qs[_0x35c8('0x1c')](_0x5397e4[_0x35c8('0x2d')]['limit']);_0x2314b6[_0x35c8('0x1b')]=qs['offset'](_0x5397e4[_0x35c8('0x2d')][_0x35c8('0x1b')]);}_0x2314b6['order']=qs[_0x35c8('0x34')](_0x5397e4[_0x35c8('0x2d')][_0x35c8('0x34')]);_0x2314b6['where']=qs[_0x35c8('0x35')](_[_0x35c8('0x36')](_0x5397e4[_0x35c8('0x2d')],_0x2b4787['filters']),_0x2e8d37);if(_0x5397e4[_0x35c8('0x2d')]['filter']){_0x2314b6[_0x35c8('0x37')]=_[_0x35c8('0x38')](_0x2314b6['where'],{'$or':_[_0x35c8('0x28')](_0x2e8d37,function(_0x241e06){if(_0x241e06[_0x35c8('0x2b')]!=='VIRTUAL'){var _0x4210a2={};_0x4210a2[_0x241e06[_0x35c8('0x26')]]={'$like':'%'+_0x5397e4[_0x35c8('0x2d')]['filter']+'%'};return _0x4210a2;}})});}_0x2314b6=_[_0x35c8('0x38')]({},_0x2314b6,_0x5397e4[_0x35c8('0x39')]);var _0x45b470={'where':_0x2314b6[_0x35c8('0x37')]};return db[_0x35c8('0x29')][_0x35c8('0x1e')](_0x45b470)['then'](function(_0x441383){_0x32998a[_0x35c8('0x1e')]=_0x441383;if(_0x5397e4[_0x35c8('0x2d')]['includeAll']){_0x2314b6[_0x35c8('0x3a')]=[{'all':!![]}];}return db[_0x35c8('0x29')]['findAll'](_0x2314b6);})[_0x35c8('0x23')](function(_0x1ce112){_0x32998a[_0x35c8('0x3b')]=_0x1ce112;return _0x32998a;})[_0x35c8('0x23')](respondWithFilteredResult(_0x5e10c8,_0x2314b6))['catch'](handleError(_0x5e10c8,null));};exports[_0x35c8('0x3c')]=function(_0x4f22c0,_0x500bed){var _0x95f09e={'raw':![],'where':{'id':_0x4f22c0[_0x35c8('0x3d')]['id']}},_0x568f77={};_0x568f77[_0x35c8('0x2c')]=_['keys'](db['AnalyticFieldReport'][_0x35c8('0x3e')]);_0x568f77[_0x35c8('0x2d')]=_[_0x35c8('0x2e')](_0x4f22c0[_0x35c8('0x2d')]);_0x568f77[_0x35c8('0x35')]=_[_0x35c8('0x30')](_0x568f77[_0x35c8('0x2c')],_0x568f77[_0x35c8('0x2d')]);_0x95f09e[_0x35c8('0x2f')]=_[_0x35c8('0x30')](_0x568f77['model'],qs[_0x35c8('0x31')](_0x4f22c0[_0x35c8('0x2d')][_0x35c8('0x31')]));_0x95f09e[_0x35c8('0x2f')]=_0x95f09e[_0x35c8('0x2f')][_0x35c8('0x3f')]?_0x95f09e[_0x35c8('0x2f')]:_0x568f77[_0x35c8('0x2c')];if(_0x4f22c0['query'][_0x35c8('0x40')]){_0x95f09e['include']=[{'all':!![]}];}_0x95f09e=_[_0x35c8('0x38')]({},_0x95f09e,_0x4f22c0[_0x35c8('0x39')]);return db[_0x35c8('0x29')][_0x35c8('0x41')](_0x95f09e)['then'](handleEntityNotFound(_0x500bed,null))[_0x35c8('0x23')](respondWithResult(_0x500bed,null))[_0x35c8('0x42')](handleError(_0x500bed,null));};exports[_0x35c8('0x43')]=function(_0x44a9a4,_0x148f16){return db[_0x35c8('0x29')][_0x35c8('0x43')](_0x44a9a4[_0x35c8('0x44')],{})[_0x35c8('0x23')](respondWithResult(_0x148f16,0xc9))[_0x35c8('0x42')](handleError(_0x148f16,null));};exports[_0x35c8('0x45')]=function(_0x8cd018,_0x38ef88){return db[_0x35c8('0x29')][_0x35c8('0x45')](_0x8cd018[_0x35c8('0x44')],{'raw':![],'individualHooks':!![]})[_0x35c8('0x23')](respondWithResult(_0x38ef88,0xc9))[_0x35c8('0x42')](handleError(_0x38ef88,null));};exports[_0x35c8('0x46')]=function(_0x32a7e3,_0x434904){if(_0x32a7e3[_0x35c8('0x44')]['id']){delete _0x32a7e3['body']['id'];}return db[_0x35c8('0x29')]['find']({'where':{'id':_0x32a7e3[_0x35c8('0x3d')]['id']}})[_0x35c8('0x23')](handleEntityNotFound(_0x434904,null))['then'](saveUpdates(_0x32a7e3[_0x35c8('0x44')],null))[_0x35c8('0x23')](respondWithResult(_0x434904,null))['catch'](handleError(_0x434904,null));};exports[_0x35c8('0x24')]=function(_0x3d8f2f,_0x520d39){return db[_0x35c8('0x29')]['find']({'where':{'id':_0x3d8f2f[_0x35c8('0x3d')]['id']}})[_0x35c8('0x23')](handleEntityNotFound(_0x520d39,null))['then'](removeEntity(_0x520d39,null))[_0x35c8('0x42')](handleError(_0x520d39,null));};exports[_0x35c8('0x47')]=function(_0x12f7e7,_0x2d1c7f){return db[_0x35c8('0x29')][_0x35c8('0x24')]({'where':{'id':_0x12f7e7[_0x35c8('0x2d')][_0x35c8('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x35c8('0x23')](respondWithResult(_0x2d1c7f,0xcc))[_0x35c8('0x42')](handleError(_0x2d1c7f,null));};exports[_0x35c8('0x49')]=function(_0xc52713,_0x1c913a,_0x691b3c){return db[_0x35c8('0x4a')][_0x35c8('0x4b')]({'where':{'id':_0xc52713[_0x35c8('0x3d')]['id']}})[_0x35c8('0x23')](handleEntityNotFound(_0x1c913a,null))[_0x35c8('0x23')](function(_0x4d74c0){if(_0x4d74c0){return db[_0x35c8('0x4c')][_0x35c8('0x4d')](function(_0x27b62c){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xc52713[_0x35c8('0x3d')]['id']},'transaction':_0x27b62c})[_0x35c8('0x23')](function(_0x417f3c){var _0x1a843b=_['map'](_0xc52713[_0x35c8('0x44')],function(_0x51b850){delete _0x51b850['id'];_0x51b850[_0x35c8('0x4e')]=_0xc52713[_0x35c8('0x3d')]['id'];return _0x51b850;});return db['AnalyticFieldReport'][_0x35c8('0x45')](_0x1a843b,{'transaction':_0x27b62c});});})['then'](function(){return db[_0x35c8('0x29')][_0x35c8('0x4f')]({'where':{'CustomReportId':_0xc52713[_0x35c8('0x3d')]['id']}});});}})[_0x35c8('0x23')](respondWithResult(_0x1c913a,null))[_0x35c8('0x42')](handleError(_0x1c913a,null));}; \ No newline at end of file +var _0xad1b=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','addFields','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes'];(function(_0x5a0119,_0x5659d8){var _0x2f835a=function(_0xaf917c){while(--_0xaf917c){_0x5a0119['push'](_0x5a0119['shift']());}};_0x2f835a(++_0x5659d8);}(_0xad1b,0x164));var _0xbad1=function(_0x3520f7,_0x541650){_0x3520f7=_0x3520f7-0x0;var _0x14b6db=_0xad1b[_0x3520f7];return _0x14b6db;};'use strict';var emlformat=require(_0xbad1('0x0'));var rimraf=require(_0xbad1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbad1('0x2'));var rp=require('request-promise');var moment=require(_0xbad1('0x3'));var BPromise=require(_0xbad1('0x4'));var Mustache=require(_0xbad1('0x5'));var util=require('util');var path=require(_0xbad1('0x6'));var sox=require(_0xbad1('0x7'));var csv=require(_0xbad1('0x8'));var ejs=require(_0xbad1('0x9'));var fs=require('fs');var fs_extra=require(_0xbad1('0xa'));var _=require(_0xbad1('0xb'));var squel=require(_0xbad1('0xc'));var crypto=require(_0xbad1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbad1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbad1('0xf'));var Papa=require(_0xbad1('0x10'));var Redis=require(_0xbad1('0x11'));var authService=require(_0xbad1('0x12'));var qs=require(_0xbad1('0x13'));var as=require(_0xbad1('0x14'));var hardwareService=require(_0xbad1('0x15'));var logger=require(_0xbad1('0x16'))(_0xbad1('0x17'));var utils=require(_0xbad1('0x18'));var config=require(_0xbad1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7be4bf,_0x43ac7a){_0x43ac7a=_0x43ac7a||0xcc;return function(_0x6dabee){if(_0x6dabee){return _0x7be4bf[_0xbad1('0x1a')](_0x43ac7a);}return _0x7be4bf[_0xbad1('0x1b')](_0x43ac7a)[_0xbad1('0x1c')]();};}function respondWithResult(_0x52d00a,_0x388335){_0x388335=_0x388335||0xc8;return function(_0x55e839){if(_0x55e839){return _0x52d00a[_0xbad1('0x1b')](_0x388335)[_0xbad1('0x1d')](_0x55e839);}};}function respondWithFilteredResult(_0x2747e0,_0x3d6aaa){return function(_0x2df816){if(_0x2df816){var _0x1d0d81=typeof _0x3d6aaa[_0xbad1('0x1e')]===_0xbad1('0x1f')&&typeof _0x3d6aaa[_0xbad1('0x20')]===_0xbad1('0x1f');var _0x24361a=_0x2df816[_0xbad1('0x21')];var _0x1d4364=_0x1d0d81?0x0:_0x3d6aaa[_0xbad1('0x1e')];var _0x495de6=_0x1d0d81?_0x2df816[_0xbad1('0x21')]:_0x3d6aaa['offset']+_0x3d6aaa[_0xbad1('0x20')];var _0xc2de25;if(_0x495de6>=_0x24361a){_0x495de6=_0x24361a;_0xc2de25=0xc8;}else{_0xc2de25=0xce;}_0x2747e0[_0xbad1('0x1b')](_0xc2de25);return _0x2747e0[_0xbad1('0x22')]('Content-Range',_0x1d4364+'-'+_0x495de6+'/'+_0x24361a)[_0xbad1('0x1d')](_0x2df816);}return null;};}function patchUpdates(_0x453e15){return function(_0x2caf92){try{jsonpatch['apply'](_0x2caf92,_0x453e15,!![]);}catch(_0x3840ab){return BPromise['reject'](_0x3840ab);}return _0x2caf92['save']();};}function saveUpdates(_0x206456,_0x4b6abd){return function(_0x1c98bd){if(_0x1c98bd){return _0x1c98bd[_0xbad1('0x23')](_0x206456)[_0xbad1('0x24')](function(_0x1c8e7b){return _0x1c8e7b;});}return null;};}function removeEntity(_0x1a0925,_0x2b3eee){return function(_0x5c4a4e){if(_0x5c4a4e){return _0x5c4a4e[_0xbad1('0x25')]()[_0xbad1('0x24')](function(){_0x1a0925['status'](0xcc)[_0xbad1('0x1c')]();});}};}function handleEntityNotFound(_0x10fd11,_0x18d313){return function(_0x42bfdf){if(!_0x42bfdf){_0x10fd11[_0xbad1('0x1a')](0x194);}return _0x42bfdf;};}function handleError(_0x105dbd,_0x3f6b04){_0x3f6b04=_0x3f6b04||0x1f4;return function(_0x133ee2){logger['error'](_0x133ee2[_0xbad1('0x26')]);if(_0x133ee2[_0xbad1('0x27')]){delete _0x133ee2[_0xbad1('0x27')];}_0x105dbd[_0xbad1('0x1b')](_0x3f6b04)[_0xbad1('0x28')](_0x133ee2);};}exports[_0xbad1('0x29')]=function(_0x498f23,_0x3e386b){var _0x4d71f1={},_0x41907a={},_0x16d034={'count':0x0,'rows':[]};var _0x208f45=_['map'](db[_0xbad1('0x2a')][_0xbad1('0x2b')],function(_0x28f65a){return{'name':_0x28f65a[_0xbad1('0x2c')],'type':_0x28f65a[_0xbad1('0x2d')][_0xbad1('0x2e')]};});_0x41907a[_0xbad1('0x2f')]=_[_0xbad1('0x30')](_0x208f45,_0xbad1('0x27'));_0x41907a[_0xbad1('0x31')]=_[_0xbad1('0x32')](_0x498f23['query']);_0x41907a[_0xbad1('0x33')]=_[_0xbad1('0x34')](_0x41907a[_0xbad1('0x2f')],_0x41907a[_0xbad1('0x31')]);_0x4d71f1[_0xbad1('0x35')]=_[_0xbad1('0x34')](_0x41907a[_0xbad1('0x2f')],qs[_0xbad1('0x36')](_0x498f23[_0xbad1('0x31')][_0xbad1('0x36')]));_0x4d71f1[_0xbad1('0x35')]=_0x4d71f1[_0xbad1('0x35')]['length']?_0x4d71f1[_0xbad1('0x35')]:_0x41907a[_0xbad1('0x2f')];if(!_0x498f23[_0xbad1('0x31')][_0xbad1('0x37')](_0xbad1('0x38'))){_0x4d71f1[_0xbad1('0x20')]=qs[_0xbad1('0x20')](_0x498f23[_0xbad1('0x31')][_0xbad1('0x20')]);_0x4d71f1[_0xbad1('0x1e')]=qs['offset'](_0x498f23[_0xbad1('0x31')][_0xbad1('0x1e')]);}_0x4d71f1['order']=qs[_0xbad1('0x39')](_0x498f23[_0xbad1('0x31')]['sort']);_0x4d71f1[_0xbad1('0x3a')]=qs[_0xbad1('0x33')](_[_0xbad1('0x3b')](_0x498f23['query'],_0x41907a[_0xbad1('0x33')]),_0x208f45);if(_0x498f23['query'][_0xbad1('0x3c')]){_0x4d71f1[_0xbad1('0x3a')]=_[_0xbad1('0x3d')](_0x4d71f1[_0xbad1('0x3a')],{'$or':_[_0xbad1('0x30')](_0x208f45,function(_0x3b4dde){if(_0x3b4dde['type']!==_0xbad1('0x3e')){var _0x48f7b7={};_0x48f7b7[_0x3b4dde[_0xbad1('0x27')]]={'$like':'%'+_0x498f23[_0xbad1('0x31')][_0xbad1('0x3c')]+'%'};return _0x48f7b7;}})});}_0x4d71f1=_['merge']({},_0x4d71f1,_0x498f23[_0xbad1('0x3f')]);var _0x386f5f={'where':_0x4d71f1[_0xbad1('0x3a')]};return db[_0xbad1('0x2a')][_0xbad1('0x21')](_0x386f5f)['then'](function(_0x5af18e){_0x16d034['count']=_0x5af18e;if(_0x498f23[_0xbad1('0x31')][_0xbad1('0x40')]){_0x4d71f1[_0xbad1('0x41')]=[{'all':!![]}];}return db[_0xbad1('0x2a')][_0xbad1('0x42')](_0x4d71f1);})[_0xbad1('0x24')](function(_0x267321){_0x16d034[_0xbad1('0x43')]=_0x267321;return _0x16d034;})[_0xbad1('0x24')](respondWithFilteredResult(_0x3e386b,_0x4d71f1))[_0xbad1('0x44')](handleError(_0x3e386b,null));};exports[_0xbad1('0x45')]=function(_0x2659a1,_0x582c0f){var _0x595350={'raw':![],'where':{'id':_0x2659a1[_0xbad1('0x46')]['id']}},_0x2add3d={};_0x2add3d[_0xbad1('0x2f')]=_['keys'](db['AnalyticFieldReport'][_0xbad1('0x2b')]);_0x2add3d['query']=_[_0xbad1('0x32')](_0x2659a1[_0xbad1('0x31')]);_0x2add3d[_0xbad1('0x33')]=_['intersection'](_0x2add3d[_0xbad1('0x2f')],_0x2add3d['query']);_0x595350[_0xbad1('0x35')]=_['intersection'](_0x2add3d[_0xbad1('0x2f')],qs[_0xbad1('0x36')](_0x2659a1[_0xbad1('0x31')]['fields']));_0x595350[_0xbad1('0x35')]=_0x595350[_0xbad1('0x35')][_0xbad1('0x47')]?_0x595350[_0xbad1('0x35')]:_0x2add3d[_0xbad1('0x2f')];if(_0x2659a1[_0xbad1('0x31')][_0xbad1('0x40')]){_0x595350['include']=[{'all':!![]}];}_0x595350=_['merge']({},_0x595350,_0x2659a1[_0xbad1('0x3f')]);return db[_0xbad1('0x2a')][_0xbad1('0x48')](_0x595350)[_0xbad1('0x24')](handleEntityNotFound(_0x582c0f,null))[_0xbad1('0x24')](respondWithResult(_0x582c0f,null))[_0xbad1('0x44')](handleError(_0x582c0f,null));};exports[_0xbad1('0x49')]=function(_0x26d9bc,_0x5b3a17){return db[_0xbad1('0x2a')][_0xbad1('0x49')](_0x26d9bc[_0xbad1('0x4a')],{})['then'](respondWithResult(_0x5b3a17,0xc9))['catch'](handleError(_0x5b3a17,null));};exports[_0xbad1('0x4b')]=function(_0x10c0a8,_0x3e61dc){return db['AnalyticFieldReport'][_0xbad1('0x4b')](_0x10c0a8[_0xbad1('0x4a')],{'raw':![],'individualHooks':!![]})[_0xbad1('0x24')](respondWithResult(_0x3e61dc,0xc9))[_0xbad1('0x44')](handleError(_0x3e61dc,null));};exports[_0xbad1('0x23')]=function(_0x53a00b,_0x5a46b4){if(_0x53a00b['body']['id']){delete _0x53a00b['body']['id'];}return db[_0xbad1('0x2a')][_0xbad1('0x48')]({'where':{'id':_0x53a00b['params']['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x5a46b4,null))[_0xbad1('0x24')](saveUpdates(_0x53a00b[_0xbad1('0x4a')],null))[_0xbad1('0x24')](respondWithResult(_0x5a46b4,null))[_0xbad1('0x44')](handleError(_0x5a46b4,null));};exports[_0xbad1('0x25')]=function(_0x40a309,_0x184435){return db[_0xbad1('0x2a')][_0xbad1('0x48')]({'where':{'id':_0x40a309[_0xbad1('0x46')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x184435,null))[_0xbad1('0x24')](removeEntity(_0x184435,null))[_0xbad1('0x44')](handleError(_0x184435,null));};exports['bulkDestroy']=function(_0x2210ea,_0xe32c1a){return db[_0xbad1('0x2a')]['destroy']({'where':{'id':_0x2210ea[_0xbad1('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xbad1('0x24')](respondWithResult(_0xe32c1a,0xcc))[_0xbad1('0x44')](handleError(_0xe32c1a,null));};exports[_0xbad1('0x4c')]=function(_0x538eef,_0x20bd4f,_0x5d33dc){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x538eef[_0xbad1('0x46')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x20bd4f,null))[_0xbad1('0x24')](function(_0x216f1b){if(_0x216f1b){return db[_0xbad1('0x4d')][_0xbad1('0x4e')](function(_0xaeda4e){return db[_0xbad1('0x2a')][_0xbad1('0x25')]({'where':{'CustomReportId':_0x538eef[_0xbad1('0x46')]['id']},'transaction':_0xaeda4e})[_0xbad1('0x24')](function(_0x5f6be3){var _0x1449c2=_[_0xbad1('0x30')](_0x538eef[_0xbad1('0x4a')],function(_0x31f9ef){delete _0x31f9ef['id'];_0x31f9ef[_0xbad1('0x4f')]=_0x538eef[_0xbad1('0x46')]['id'];return _0x31f9ef;});return db['AnalyticFieldReport'][_0xbad1('0x4b')](_0x1449c2,{'transaction':_0xaeda4e});});})[_0xbad1('0x24')](function(){return db['AnalyticFieldReport'][_0xbad1('0x42')]({'where':{'CustomReportId':_0x538eef[_0xbad1('0x46')]['id']}});});}})[_0xbad1('0x24')](respondWithResult(_0x20bd4f,null))[_0xbad1('0x44')](handleError(_0x20bd4f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 75345b4..20260cf 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 _0x7e86=['rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x28f402,_0x5aec8a){var _0x498203=function(_0x2789e9){while(--_0x2789e9){_0x28f402['push'](_0x28f402['shift']());}};_0x498203(++_0x5aec8a);}(_0x7e86,0x14b));var _0x67e8=function(_0x136c19,_0x30aa53){_0x136c19=_0x136c19-0x0;var _0x1fea1f=_0x7e86[_0x136c19];return _0x1fea1f;};'use strict';var _=require('lodash');var util=require(_0x67e8('0x0'));var logger=require(_0x67e8('0x1'))(_0x67e8('0x2'));var moment=require(_0x67e8('0x3'));var BPromise=require(_0x67e8('0x4'));var rp=require(_0x67e8('0x5'));var fs=require('fs');var path=require(_0x67e8('0x6'));var rimraf=require(_0x67e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x67e8('0x8'));module[_0x67e8('0x9')]=function(_0x439071,_0x2d18e5){return _0x439071[_0x67e8('0xa')](_0x67e8('0xb'),attributes,{'tableName':_0x67e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf663=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xf663,0xff));var _0x3f66=function(_0x3f3a47,_0x28f84b){_0x3f3a47=_0x3f3a47-0x0;var _0x57a682=_0xf663[_0x3f3a47];return _0x57a682;};'use strict';var _=require(_0x3f66('0x0'));var util=require(_0x3f66('0x1'));var logger=require(_0x3f66('0x2'))('api');var moment=require(_0x3f66('0x3'));var BPromise=require(_0x3f66('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f66('0x5'));var rimraf=require(_0x3f66('0x6'));var config=require(_0x3f66('0x7'));var attributes=require(_0x3f66('0x8'));module[_0x3f66('0x9')]=function(_0x28e10f,_0x48e49a){return _0x28e10f[_0x3f66('0xa')](_0x3f66('0xb'),attributes,{'tableName':_0x3f66('0xc'),'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 9bdce6d..98741c8 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 _0xdbeb=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x571268,_0x4a2163){var _0x52b796=function(_0xf3a5db){while(--_0xf3a5db){_0x571268['push'](_0x571268['shift']());}};_0x52b796(++_0x4a2163);}(_0xdbeb,0xa0));var _0xbdbe=function(_0x394b54,_0x13aecd){_0x394b54=_0x394b54-0x0;var _0x1e9a70=_0xdbeb[_0x394b54];return _0x1e9a70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdbe('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdbe('0x1'));var db=require(_0xbdbe('0x2'))['db'];var utils=require(_0xbdbe('0x3'));var logger=require(_0xbdbe('0x4'))(_0xbdbe('0x5'));var config=require(_0xbdbe('0x6'));var jayson=require(_0xbdbe('0x7'));var client=jayson['client'][_0xbdbe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea48ee,_0x4eb6ba,_0x2da22d){return new BPromise(function(_0x8145e8,_0x361005){return client[_0xbdbe('0x9')](_0xea48ee,_0x2da22d)[_0xbdbe('0xa')](function(_0x5a0a63){logger[_0xbdbe('0xb')](_0xbdbe('0xc'),_0x4eb6ba,_0xbdbe('0xd'));logger[_0xbdbe('0xe')](_0xbdbe('0xf'),_0x4eb6ba,'request\x20sent',JSON[_0xbdbe('0x10')](_0x5a0a63));if(_0x5a0a63[_0xbdbe('0x11')]){if(_0x5a0a63['error'][_0xbdbe('0x12')]===0x1f4){logger['error'](_0xbdbe('0xc'),_0x4eb6ba,_0x5a0a63[_0xbdbe('0x11')]['message']);return _0x361005(_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);}logger[_0xbdbe('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4eb6ba,_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);return _0x8145e8(_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);}else{logger[_0xbdbe('0xb')](_0xbdbe('0xc'),_0x4eb6ba,_0xbdbe('0xd'));_0x8145e8(_0x5a0a63['result'][_0xbdbe('0x13')]);}})[_0xbdbe('0x14')](function(_0xb277b3){logger[_0xbdbe('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4eb6ba,_0xb277b3);_0x361005(_0xb277b3);});});} \ No newline at end of file +var _0x360a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f9f46,_0x49f6d2){var _0x2c9e54=function(_0x2f41a5){while(--_0x2f41a5){_0x3f9f46['push'](_0x3f9f46['shift']());}};_0x2c9e54(++_0x49f6d2);}(_0x360a,0x169));var _0xa360=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x360a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa360('0x0'));var util=require(_0xa360('0x1'));var moment=require(_0xa360('0x2'));var BPromise=require(_0xa360('0x3'));var rs=require(_0xa360('0x4'));var fs=require('fs');var Redis=require(_0xa360('0x5'));var db=require(_0xa360('0x6'))['db'];var utils=require(_0xa360('0x7'));var logger=require(_0xa360('0x8'))(_0xa360('0x9'));var config=require(_0xa360('0xa'));var jayson=require(_0xa360('0xb'));var client=jayson[_0xa360('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11855c,_0x408cf2,_0xe64fbf){return new BPromise(function(_0x5926b7,_0x5583e){return client['request'](_0x11855c,_0xe64fbf)[_0xa360('0xd')](function(_0xa4b13e){logger[_0xa360('0xe')](_0xa360('0xf'),_0x408cf2,_0xa360('0x10'));logger[_0xa360('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x408cf2,_0xa360('0x10'),JSON[_0xa360('0x12')](_0xa4b13e));if(_0xa4b13e[_0xa360('0x13')]){if(_0xa4b13e[_0xa360('0x13')][_0xa360('0x14')]===0x1f4){logger[_0xa360('0x13')](_0xa360('0xf'),_0x408cf2,_0xa4b13e['error']['message']);return _0x5583e(_0xa4b13e[_0xa360('0x13')][_0xa360('0x15')]);}logger[_0xa360('0x13')](_0xa360('0xf'),_0x408cf2,_0xa4b13e[_0xa360('0x13')][_0xa360('0x15')]);return _0x5926b7(_0xa4b13e['error']['message']);}else{logger['info'](_0xa360('0xf'),_0x408cf2,'request\x20sent');_0x5926b7(_0xa4b13e[_0xa360('0x16')]['message']);}})['catch'](function(_0x3254c5){logger[_0xa360('0x13')](_0xa360('0xf'),_0x408cf2,_0x3254c5);_0x5583e(_0x3254c5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 40b1295..b4a9ec7 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(_0x4ca19a,_0x51c584){var _0x3d5de0=function(_0x4803f6){while(--_0x4803f6){_0x4ca19a['push'](_0x4ca19a['shift']());}};_0x3d5de0(++_0x51c584);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x12e09c,_0x41e3f2){var _0x559e70=function(_0x3fb2da){while(--_0x3fb2da){_0x12e09c['push'](_0x12e09c['shift']());}};_0x559e70(++_0x41e3f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 ab9b0fa..75f3655 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 _0xac7f=['STRING','name','sequelize'];(function(_0x4d1191,_0x3f1700){var _0x58c49e=function(_0x3acc67){while(--_0x3acc67){_0x4d1191['push'](_0x4d1191['shift']());}};_0x58c49e(++_0x3f1700);}(_0xac7f,0x1e2));var _0xfac7=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xac7f[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xfac7('0x0'));module['exports']={'name':{'type':Sequelize[_0xfac7('0x1')],'allowNull':![],'unique':_0xfac7('0x2')},'table':{'type':Sequelize[_0xfac7('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xfac7('0x1')]}}; \ No newline at end of file +var _0xbdb7=['name','TEXT','sequelize','exports','STRING'];(function(_0x5c8736,_0x2a2a03){var _0x142bdb=function(_0x406951){while(--_0x406951){_0x5c8736['push'](_0x5c8736['shift']());}};_0x142bdb(++_0x2a2a03);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1d29f6,_0x45f6a0){_0x1d29f6=_0x1d29f6-0x0;var _0x491093=_0xbdb7[_0x1d29f6];return _0x491093;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'unique':_0x7bdb('0x3')},'table':{'type':Sequelize[_0x7bdb('0x2')]},'metric':{'type':Sequelize[_0x7bdb('0x4')]},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6c0e8e6..ff4f405 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x52a980,_0x129042){var _0x33f0db=function(_0x4fb1dd){while(--_0x4fb1dd){_0x52a980['push'](_0x52a980['shift']());}};_0x33f0db(++_0x129042);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../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','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x504d47,_0x5e604b){var _0x55cba4=function(_0xb7e707){while(--_0xb7e707){_0x504d47['push'](_0x504d47['shift']());}};_0x55cba4(++_0x5e604b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xf2ca[_0x143a91];return _0x1906f5;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e4c45d5..1f98fc4 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 _0x4553=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','util','../../config/logger','api','request-promise','path'];(function(_0x1cb649,_0xfb8c74){var _0x11d19f=function(_0x5c97d6){while(--_0x5c97d6){_0x1cb649['push'](_0x1cb649['shift']());}};_0x11d19f(++_0xfb8c74);}(_0x4553,0x1be));var _0x3455=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x4553[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var logger=require(_0x3455('0x1'))(_0x3455('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3455('0x3'));var fs=require('fs');var path=require(_0x3455('0x4'));var rimraf=require(_0x3455('0x5'));var config=require(_0x3455('0x6'));var attributes=require(_0x3455('0x7'));module[_0x3455('0x8')]=function(_0x2aa1ed,_0x4010cd){return _0x2aa1ed[_0x3455('0x9')]('AnalyticMetric',attributes,{'tableName':_0x3455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ad=['path','../../config/environment','./analyticMetric.attributes','exports','analytics_metrics','util','api','moment','bluebird','request-promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x15afeb,_0x3eb360){_0x15afeb=_0x15afeb-0x0;var _0x3ce58d=_0xb2ad[_0x15afeb];return _0x3ce58d;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var logger=require('../../config/logger')(_0xdb2a('0x1'));var moment=require(_0xdb2a('0x2'));var BPromise=require(_0xdb2a('0x3'));var rp=require(_0xdb2a('0x4'));var fs=require('fs');var path=require(_0xdb2a('0x5'));var rimraf=require('rimraf');var config=require(_0xdb2a('0x6'));var attributes=require(_0xdb2a('0x7'));module[_0xdb2a('0x8')]=function(_0x1f9551,_0x5c69b1){return _0x1f9551['define']('AnalyticMetric',attributes,{'tableName':_0xdb2a('0x9'),'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 01559ef..e2d7584 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 _0x10ad=['../../config/utils','rpc','../../config/environment','jayson/promise','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x36bf09,_0x2652b0){var _0x4e4d60=function(_0x1ec61f){while(--_0x1ec61f){_0x36bf09['push'](_0x36bf09['shift']());}};_0x4e4d60(++_0x2652b0);}(_0x10ad,0x1d6));var _0xd10a=function(_0x6b4fe4,_0x4f2c29){_0x6b4fe4=_0x6b4fe4-0x0;var _0x46b758=_0x10ad[_0x6b4fe4];return _0x46b758;};'use strict';var _=require(_0xd10a('0x0'));var util=require(_0xd10a('0x1'));var moment=require(_0xd10a('0x2'));var BPromise=require(_0xd10a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd10a('0x5'));var logger=require('../../config/logger')(_0xd10a('0x6'));var config=require(_0xd10a('0x7'));var jayson=require(_0xd10a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2572b7,_0x57d9d,_0x70b504){return new BPromise(function(_0x2bd527,_0x3c0ad9){return client[_0xd10a('0x9')](_0x2572b7,_0x70b504)['then'](function(_0x25e808){logger['info'](_0xd10a('0xa'),_0x57d9d,_0xd10a('0xb'));logger[_0xd10a('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x57d9d,_0xd10a('0xb'),JSON[_0xd10a('0xd')](_0x25e808));if(_0x25e808['error']){if(_0x25e808[_0xd10a('0xe')][_0xd10a('0xf')]===0x1f4){logger['error'](_0xd10a('0xa'),_0x57d9d,_0x25e808[_0xd10a('0xe')][_0xd10a('0x10')]);return _0x3c0ad9(_0x25e808[_0xd10a('0xe')][_0xd10a('0x10')]);}logger[_0xd10a('0xe')](_0xd10a('0xa'),_0x57d9d,_0x25e808[_0xd10a('0xe')]['message']);return _0x2bd527(_0x25e808[_0xd10a('0xe')]['message']);}else{logger[_0xd10a('0x11')](_0xd10a('0xa'),_0x57d9d,'request\x20sent');_0x2bd527(_0x25e808['result']['message']);}})[_0xd10a('0x12')](function(_0x207613){logger[_0xd10a('0xe')](_0xd10a('0xa'),_0x57d9d,_0x207613);_0x3c0ad9(_0x207613);});});} \ No newline at end of file +var _0x7f9c=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','code'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x7f9c,0x9e));var _0xc7f9=function(_0x33e5e2,_0x10d7a8){_0x33e5e2=_0x33e5e2-0x0;var _0x21e5af=_0x7f9c[_0x33e5e2];return _0x21e5af;};'use strict';var _=require('lodash');var util=require(_0xc7f9('0x0'));var moment=require(_0xc7f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7f9('0x2'));var fs=require('fs');var Redis=require(_0xc7f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7f9('0x4'));var logger=require(_0xc7f9('0x5'))(_0xc7f9('0x6'));var config=require(_0xc7f9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc7f9('0x8')][_0xc7f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7d17,_0x3e7d2a,_0x494665){return new BPromise(function(_0x32e53a,_0x5b3e36){return client[_0xc7f9('0xa')](_0x3e7d17,_0x494665)[_0xc7f9('0xb')](function(_0x4004fb){logger[_0xc7f9('0xc')](_0xc7f9('0xd'),_0x3e7d2a,_0xc7f9('0xe'));logger[_0xc7f9('0xf')](_0xc7f9('0x10'),_0x3e7d2a,_0xc7f9('0xe'),JSON['stringify'](_0x4004fb));if(_0x4004fb['error']){if(_0x4004fb['error'][_0xc7f9('0x11')]===0x1f4){logger['error'](_0xc7f9('0xd'),_0x3e7d2a,_0x4004fb[_0xc7f9('0x12')]['message']);return _0x5b3e36(_0x4004fb[_0xc7f9('0x12')][_0xc7f9('0x13')]);}logger[_0xc7f9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3e7d2a,_0x4004fb[_0xc7f9('0x12')][_0xc7f9('0x13')]);return _0x32e53a(_0x4004fb[_0xc7f9('0x12')][_0xc7f9('0x13')]);}else{logger[_0xc7f9('0xc')](_0xc7f9('0xd'),_0x3e7d2a,'request\x20sent');_0x32e53a(_0x4004fb[_0xc7f9('0x14')][_0xc7f9('0x13')]);}})[_0xc7f9('0x15')](function(_0x53efd2){logger[_0xc7f9('0x12')](_0xc7f9('0xd'),_0x3e7d2a,_0x53efd2);_0x5b3e36(_0x53efd2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3bf9265..a62a576 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 _0x60c2=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x3c571c,_0x23ee57){var _0x19c4ab=function(_0x1494c8){while(--_0x1494c8){_0x3c571c['push'](_0x3c571c['shift']());}};_0x19c4ab(++_0x23ee57);}(_0x60c2,0x8f));var _0x260c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x60c2[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var fs_extra=require(_0x260c('0x5'));var auth=require(_0x260c('0x6'));var interaction=require(_0x260c('0x7'));var config=require(_0x260c('0x8'));var controller=require(_0x260c('0x9'));router[_0x260c('0xa')]('/',auth[_0x260c('0xb')](),controller['index']);router[_0x260c('0xa')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0xd')]);router['post']('/',auth[_0x260c('0xb')](),controller[_0x260c('0xe')]);router[_0x260c('0xf')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0x10')]);router[_0x260c('0x11')]('/:id',auth[_0x260c('0xb')](),controller[_0x260c('0x12')]);module[_0x260c('0x13')]=router; \ No newline at end of file +var _0x624c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x542641,_0x7615ab){var _0x26a17a=function(_0x340089){while(--_0x340089){_0x542641['push'](_0x542641['shift']());}};_0x26a17a(++_0x7615ab);}(_0x624c,0x1ee));var _0xc624=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x624c[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0xc624('0x0'));var path=require(_0xc624('0x1'));var timeout=require(_0xc624('0x2'));var express=require(_0xc624('0x3'));var router=express[_0xc624('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc624('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc624('0x6'));var controller=require('./analyticMetric.controller');router[_0xc624('0x7')]('/',auth[_0xc624('0x8')](),controller[_0xc624('0x9')]);router[_0xc624('0x7')](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xb')]);router['post']('/',auth[_0xc624('0x8')](),controller[_0xc624('0xc')]);router[_0xc624('0xd')]('/:id',auth[_0xc624('0x8')](),controller[_0xc624('0xe')]);router['delete'](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xf')]);module[_0xc624('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ca14b1e..852cf4b 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 _0x5923=['exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5923,0x102));var _0x3592=function(_0x1ed8e0,_0x17f2a4){_0x1ed8e0=_0x1ed8e0-0x0;var _0x5d9541=_0x5923[_0x1ed8e0];return _0x5d9541;};'use strict';var Sequelize=require('sequelize');module[_0x3592('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x7717=['exports','TEXT','sequelize'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x7717,0x11f));var _0x7771=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7717[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7771('0x0'));module[_0x7771('0x1')]={'tree':{'type':Sequelize[_0x7771('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 8bd94ad..a9a7a48 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 _0x42f1=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2d5351,_0x4af07c){var _0x5ef04a=function(_0x2cb358){while(--_0x2cb358){_0x2d5351['push'](_0x2d5351['shift']());}};_0x5ef04a(++_0x4af07c);}(_0x42f1,0x14d));var _0x142f=function(_0x43e8e8,_0x2375a9){_0x43e8e8=_0x43e8e8-0x0;var _0x59e260=_0x42f1[_0x43e8e8];return _0x59e260;};'use strict';var emlformat=require(_0x142f('0x0'));var rimraf=require(_0x142f('0x1'));var zipdir=require(_0x142f('0x2'));var jsonpatch=require(_0x142f('0x3'));var rp=require(_0x142f('0x4'));var moment=require('moment');var BPromise=require(_0x142f('0x5'));var Mustache=require(_0x142f('0x6'));var util=require('util');var path=require(_0x142f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x142f('0x8'));var _=require(_0x142f('0x9'));var squel=require(_0x142f('0xa'));var crypto=require(_0x142f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x142f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x142f('0xd'));var Papa=require('papaparse');var Redis=require(_0x142f('0xe'));var authService=require(_0x142f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x142f('0x10'));var hardwareService=require(_0x142f('0x11'));var logger=require(_0x142f('0x12'))('api');var utils=require(_0x142f('0x13'));var config=require(_0x142f('0x14'));var licenseUtil=require(_0x142f('0x15'));var db=require(_0x142f('0x16'))['db'];function respondWithStatusCode(_0x4ce120,_0x29d653){_0x29d653=_0x29d653||0xcc;return function(_0x341d8e){if(_0x341d8e){return _0x4ce120[_0x142f('0x17')](_0x29d653);}return _0x4ce120['status'](_0x29d653)['end']();};}function respondWithResult(_0x344c8a,_0x6fdbb6){_0x6fdbb6=_0x6fdbb6||0xc8;return function(_0x875dea){if(_0x875dea){return _0x344c8a[_0x142f('0x18')](_0x6fdbb6)[_0x142f('0x19')](_0x875dea);}};}function respondWithFilteredResult(_0x1fdcdb,_0x3335ca){return function(_0x1f866f){if(_0x1f866f){var _0x51d353=typeof _0x3335ca[_0x142f('0x1a')]===_0x142f('0x1b')&&typeof _0x3335ca[_0x142f('0x1c')]===_0x142f('0x1b');var _0xe476fe=_0x1f866f[_0x142f('0x1d')];var _0x2a3980=_0x51d353?0x0:_0x3335ca[_0x142f('0x1a')];var _0x189d01=_0x51d353?_0x1f866f[_0x142f('0x1d')]:_0x3335ca['offset']+_0x3335ca[_0x142f('0x1c')];var _0x51d8b1;if(_0x189d01>=_0xe476fe){_0x189d01=_0xe476fe;_0x51d8b1=0xc8;}else{_0x51d8b1=0xce;}_0x1fdcdb[_0x142f('0x18')](_0x51d8b1);return _0x1fdcdb[_0x142f('0x1e')](_0x142f('0x1f'),_0x2a3980+'-'+_0x189d01+'/'+_0xe476fe)['json'](_0x1f866f);}return null;};}function patchUpdates(_0x3d9136){return function(_0x3a849f){try{jsonpatch[_0x142f('0x20')](_0x3a849f,_0x3d9136,!![]);}catch(_0x1a6488){return BPromise[_0x142f('0x21')](_0x1a6488);}return _0x3a849f['save']();};}function saveUpdates(_0x147d81,_0x1e74cb){return function(_0x533561){if(_0x533561){return _0x533561[_0x142f('0x22')](_0x147d81)[_0x142f('0x23')](function(_0x17e259){return _0x17e259;});}return null;};}function removeEntity(_0x1503ed,_0x18bdf0){return function(_0x318095){if(_0x318095){return _0x318095['destroy']()[_0x142f('0x23')](function(){_0x1503ed[_0x142f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6546,_0x99dcca){return function(_0x1bf050){if(!_0x1bf050){_0x5e6546['sendStatus'](0x194);}return _0x1bf050;};}function handleError(_0x7e08d6,_0x1ec1df){_0x1ec1df=_0x1ec1df||0x1f4;return function(_0x191535){logger[_0x142f('0x24')](_0x191535['stack']);if(_0x191535[_0x142f('0x25')]){delete _0x191535[_0x142f('0x25')];}_0x7e08d6[_0x142f('0x18')](_0x1ec1df)[_0x142f('0x26')](_0x191535);};}exports[_0x142f('0x27')]=function(_0x224f78,_0x4a3376){var _0x5cab5d={},_0x4c8f23={},_0x32bed3={'count':0x0,'rows':[]};var _0x1f050d=_[_0x142f('0x28')](db[_0x142f('0x29')][_0x142f('0x2a')],function(_0x47a220){return{'name':_0x47a220[_0x142f('0x2b')],'type':_0x47a220[_0x142f('0x2c')]['key']};});_0x4c8f23[_0x142f('0x2d')]=_[_0x142f('0x28')](_0x1f050d,_0x142f('0x25'));_0x4c8f23['query']=_[_0x142f('0x2e')](_0x224f78[_0x142f('0x2f')]);_0x4c8f23[_0x142f('0x30')]=_[_0x142f('0x31')](_0x4c8f23[_0x142f('0x2d')],_0x4c8f23[_0x142f('0x2f')]);_0x5cab5d[_0x142f('0x32')]=_['intersection'](_0x4c8f23[_0x142f('0x2d')],qs[_0x142f('0x33')](_0x224f78[_0x142f('0x2f')][_0x142f('0x33')]));_0x5cab5d[_0x142f('0x32')]=_0x5cab5d['attributes'][_0x142f('0x34')]?_0x5cab5d[_0x142f('0x32')]:_0x4c8f23['model'];if(!_0x224f78[_0x142f('0x2f')][_0x142f('0x35')](_0x142f('0x36'))){_0x5cab5d[_0x142f('0x1c')]=qs[_0x142f('0x1c')](_0x224f78[_0x142f('0x2f')]['limit']);_0x5cab5d[_0x142f('0x1a')]=qs[_0x142f('0x1a')](_0x224f78['query']['offset']);}_0x5cab5d['order']=qs['sort'](_0x224f78[_0x142f('0x2f')][_0x142f('0x37')]);_0x5cab5d[_0x142f('0x38')]=qs['filters'](_[_0x142f('0x39')](_0x224f78[_0x142f('0x2f')],_0x4c8f23[_0x142f('0x30')]),_0x1f050d);if(_0x224f78['query'][_0x142f('0x3a')]){_0x5cab5d['where']=_[_0x142f('0x3b')](_0x5cab5d[_0x142f('0x38')],{'$or':_[_0x142f('0x28')](_0x1f050d,function(_0x304805){if(_0x304805[_0x142f('0x2c')]!==_0x142f('0x3c')){var _0x5f1cbe={};_0x5f1cbe[_0x304805[_0x142f('0x25')]]={'$like':'%'+_0x224f78[_0x142f('0x2f')][_0x142f('0x3a')]+'%'};return _0x5f1cbe;}})});}_0x5cab5d=_[_0x142f('0x3b')]({},_0x5cab5d,_0x224f78[_0x142f('0x3d')]);var _0x11aac8={'where':_0x5cab5d[_0x142f('0x38')]};return db[_0x142f('0x29')][_0x142f('0x1d')](_0x11aac8)['then'](function(_0x4d6fb4){_0x32bed3['count']=_0x4d6fb4;if(_0x224f78[_0x142f('0x2f')][_0x142f('0x3e')]){_0x5cab5d[_0x142f('0x3f')]=[{'all':!![]}];}return db[_0x142f('0x29')][_0x142f('0x40')](_0x5cab5d);})[_0x142f('0x23')](function(_0x42ae45){_0x32bed3['rows']=_0x42ae45;return _0x32bed3;})[_0x142f('0x23')](respondWithFilteredResult(_0x4a3376,_0x5cab5d))[_0x142f('0x41')](handleError(_0x4a3376,null));};exports[_0x142f('0x42')]=function(_0x10aa9d,_0x4be260){var _0x19075b={'raw':!![],'where':{'id':_0x10aa9d['params']['id']}},_0x3f203b={};_0x3f203b[_0x142f('0x2d')]=_[_0x142f('0x2e')](db[_0x142f('0x29')][_0x142f('0x2a')]);_0x3f203b[_0x142f('0x2f')]=_['keys'](_0x10aa9d[_0x142f('0x2f')]);_0x3f203b[_0x142f('0x30')]=_[_0x142f('0x31')](_0x3f203b[_0x142f('0x2d')],_0x3f203b[_0x142f('0x2f')]);_0x19075b[_0x142f('0x32')]=_[_0x142f('0x31')](_0x3f203b[_0x142f('0x2d')],qs['fields'](_0x10aa9d[_0x142f('0x2f')][_0x142f('0x33')]));_0x19075b[_0x142f('0x32')]=_0x19075b['attributes'][_0x142f('0x34')]?_0x19075b[_0x142f('0x32')]:_0x3f203b['model'];if(_0x10aa9d['query'][_0x142f('0x3e')]){_0x19075b[_0x142f('0x3f')]=[{'all':!![]}];}_0x19075b=_[_0x142f('0x3b')]({},_0x19075b,_0x10aa9d[_0x142f('0x3d')]);return db[_0x142f('0x29')][_0x142f('0x43')](_0x19075b)[_0x142f('0x23')](handleEntityNotFound(_0x4be260,null))[_0x142f('0x23')](respondWithResult(_0x4be260,null))[_0x142f('0x41')](handleError(_0x4be260,null));};exports[_0x142f('0x44')]=function(_0x515c94,_0x7b0fd){return db[_0x142f('0x29')][_0x142f('0x44')](_0x515c94[_0x142f('0x45')],{})[_0x142f('0x23')](respondWithResult(_0x7b0fd,0xc9))[_0x142f('0x41')](handleError(_0x7b0fd,null));};exports['update']=function(_0x2c1954,_0x1e7bd2){if(_0x2c1954[_0x142f('0x45')]['id']){delete _0x2c1954[_0x142f('0x45')]['id'];}return db[_0x142f('0x29')][_0x142f('0x43')]({'where':{'id':_0x2c1954[_0x142f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e7bd2,null))[_0x142f('0x23')](saveUpdates(_0x2c1954[_0x142f('0x45')],null))[_0x142f('0x23')](respondWithResult(_0x1e7bd2,null))['catch'](handleError(_0x1e7bd2,null));};exports['destroy']=function(_0x1cace1,_0x3e0e22){return db[_0x142f('0x29')][_0x142f('0x43')]({'where':{'id':_0x1cace1[_0x142f('0x46')]['id']}})[_0x142f('0x23')](handleEntityNotFound(_0x3e0e22,null))[_0x142f('0x23')](removeEntity(_0x3e0e22,null))[_0x142f('0x41')](handleError(_0x3e0e22,null));}; \ No newline at end of file +var _0x6584=['Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x6584,0xc9));var _0x4658=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x6584[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x4658('0x0'));var rimraf=require(_0x4658('0x1'));var zipdir=require(_0x4658('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4658('0x3'));var moment=require(_0x4658('0x4'));var BPromise=require(_0x4658('0x5'));var Mustache=require(_0x4658('0x6'));var util=require(_0x4658('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4658('0x8'));var ejs=require(_0x4658('0x9'));var fs=require('fs');var fs_extra=require(_0x4658('0xa'));var _=require(_0x4658('0xb'));var squel=require(_0x4658('0xc'));var crypto=require(_0x4658('0xd'));var jsforce=require(_0x4658('0xe'));var deskjs=require(_0x4658('0xf'));var toCsv=require(_0x4658('0x8'));var querystring=require(_0x4658('0x10'));var Papa=require(_0x4658('0x11'));var Redis=require(_0x4658('0x12'));var authService=require(_0x4658('0x13'));var qs=require(_0x4658('0x14'));var as=require(_0x4658('0x15'));var hardwareService=require(_0x4658('0x16'));var logger=require(_0x4658('0x17'))('api');var utils=require(_0x4658('0x18'));var config=require(_0x4658('0x19'));var licenseUtil=require(_0x4658('0x1a'));var db=require(_0x4658('0x1b'))['db'];function respondWithStatusCode(_0x172dd0,_0x1d634b){_0x1d634b=_0x1d634b||0xcc;return function(_0x3e720e){if(_0x3e720e){return _0x172dd0['sendStatus'](_0x1d634b);}return _0x172dd0[_0x4658('0x1c')](_0x1d634b)[_0x4658('0x1d')]();};}function respondWithResult(_0x277607,_0x2e1e01){_0x2e1e01=_0x2e1e01||0xc8;return function(_0x5d3daf){if(_0x5d3daf){return _0x277607[_0x4658('0x1c')](_0x2e1e01)[_0x4658('0x1e')](_0x5d3daf);}};}function respondWithFilteredResult(_0x289e30,_0x48c219){return function(_0x996259){if(_0x996259){var _0x4dc572=typeof _0x48c219[_0x4658('0x1f')]==='undefined'&&typeof _0x48c219['limit']===_0x4658('0x20');var _0x1b13ec=_0x996259[_0x4658('0x21')];var _0x388331=_0x4dc572?0x0:_0x48c219[_0x4658('0x1f')];var _0x264729=_0x4dc572?_0x996259[_0x4658('0x21')]:_0x48c219[_0x4658('0x1f')]+_0x48c219[_0x4658('0x22')];var _0x256584;if(_0x264729>=_0x1b13ec){_0x264729=_0x1b13ec;_0x256584=0xc8;}else{_0x256584=0xce;}_0x289e30[_0x4658('0x1c')](_0x256584);return _0x289e30[_0x4658('0x23')](_0x4658('0x24'),_0x388331+'-'+_0x264729+'/'+_0x1b13ec)['json'](_0x996259);}return null;};}function patchUpdates(_0x54c1ce){return function(_0x39878a){try{jsonpatch[_0x4658('0x25')](_0x39878a,_0x54c1ce,!![]);}catch(_0x5bb225){return BPromise[_0x4658('0x26')](_0x5bb225);}return _0x39878a[_0x4658('0x27')]();};}function saveUpdates(_0x5943f1,_0x2eeb44){return function(_0xc1852b){if(_0xc1852b){return _0xc1852b[_0x4658('0x28')](_0x5943f1)[_0x4658('0x29')](function(_0x281773){return _0x281773;});}return null;};}function removeEntity(_0x109270,_0x420c0a){return function(_0x513a7a){if(_0x513a7a){return _0x513a7a[_0x4658('0x2a')]()[_0x4658('0x29')](function(){_0x109270[_0x4658('0x1c')](0xcc)[_0x4658('0x1d')]();});}};}function handleEntityNotFound(_0x1f971c,_0x5b6a2d){return function(_0x52935f){if(!_0x52935f){_0x1f971c['sendStatus'](0x194);}return _0x52935f;};}function handleError(_0x59a953,_0x4dff03){_0x4dff03=_0x4dff03||0x1f4;return function(_0x562967){logger[_0x4658('0x2b')](_0x562967['stack']);if(_0x562967[_0x4658('0x2c')]){delete _0x562967[_0x4658('0x2c')];}_0x59a953[_0x4658('0x1c')](_0x4dff03)[_0x4658('0x2d')](_0x562967);};}exports[_0x4658('0x2e')]=function(_0x457090,_0x260d4e){var _0x6e361a={},_0x1d5274={},_0x37f5cd={'count':0x0,'rows':[]};var _0x5e1ed8=_[_0x4658('0x2f')](db[_0x4658('0x30')][_0x4658('0x31')],function(_0x57949e){return{'name':_0x57949e[_0x4658('0x32')],'type':_0x57949e[_0x4658('0x33')]['key']};});_0x1d5274[_0x4658('0x34')]=_[_0x4658('0x2f')](_0x5e1ed8,_0x4658('0x2c'));_0x1d5274[_0x4658('0x35')]=_[_0x4658('0x36')](_0x457090['query']);_0x1d5274[_0x4658('0x37')]=_[_0x4658('0x38')](_0x1d5274[_0x4658('0x34')],_0x1d5274[_0x4658('0x35')]);_0x6e361a[_0x4658('0x39')]=_['intersection'](_0x1d5274['model'],qs[_0x4658('0x3a')](_0x457090[_0x4658('0x35')][_0x4658('0x3a')]));_0x6e361a[_0x4658('0x39')]=_0x6e361a[_0x4658('0x39')][_0x4658('0x3b')]?_0x6e361a[_0x4658('0x39')]:_0x1d5274[_0x4658('0x34')];if(!_0x457090[_0x4658('0x35')][_0x4658('0x3c')](_0x4658('0x3d'))){_0x6e361a[_0x4658('0x22')]=qs[_0x4658('0x22')](_0x457090[_0x4658('0x35')]['limit']);_0x6e361a[_0x4658('0x1f')]=qs[_0x4658('0x1f')](_0x457090[_0x4658('0x35')]['offset']);}_0x6e361a[_0x4658('0x3e')]=qs['sort'](_0x457090[_0x4658('0x35')][_0x4658('0x3f')]);_0x6e361a[_0x4658('0x40')]=qs[_0x4658('0x37')](_[_0x4658('0x41')](_0x457090[_0x4658('0x35')],_0x1d5274[_0x4658('0x37')]),_0x5e1ed8);if(_0x457090[_0x4658('0x35')]['filter']){_0x6e361a[_0x4658('0x40')]=_['merge'](_0x6e361a[_0x4658('0x40')],{'$or':_[_0x4658('0x2f')](_0x5e1ed8,function(_0x2bec7c){if(_0x2bec7c[_0x4658('0x33')]!==_0x4658('0x42')){var _0x235965={};_0x235965[_0x2bec7c[_0x4658('0x2c')]]={'$like':'%'+_0x457090['query'][_0x4658('0x43')]+'%'};return _0x235965;}})});}_0x6e361a=_[_0x4658('0x44')]({},_0x6e361a,_0x457090[_0x4658('0x45')]);var _0x232e37={'where':_0x6e361a['where']};return db[_0x4658('0x30')][_0x4658('0x21')](_0x232e37)[_0x4658('0x29')](function(_0xb27599){_0x37f5cd[_0x4658('0x21')]=_0xb27599;if(_0x457090[_0x4658('0x35')][_0x4658('0x46')]){_0x6e361a[_0x4658('0x47')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x6e361a);})[_0x4658('0x29')](function(_0x1a52fd){_0x37f5cd[_0x4658('0x48')]=_0x1a52fd;return _0x37f5cd;})[_0x4658('0x29')](respondWithFilteredResult(_0x260d4e,_0x6e361a))[_0x4658('0x49')](handleError(_0x260d4e,null));};exports[_0x4658('0x4a')]=function(_0x7ee94e,_0x348536){var _0x57e3bc={'raw':!![],'where':{'id':_0x7ee94e[_0x4658('0x4b')]['id']}},_0xa9c056={};_0xa9c056['model']=_[_0x4658('0x36')](db[_0x4658('0x30')][_0x4658('0x31')]);_0xa9c056[_0x4658('0x35')]=_[_0x4658('0x36')](_0x7ee94e[_0x4658('0x35')]);_0xa9c056['filters']=_[_0x4658('0x38')](_0xa9c056[_0x4658('0x34')],_0xa9c056[_0x4658('0x35')]);_0x57e3bc[_0x4658('0x39')]=_[_0x4658('0x38')](_0xa9c056[_0x4658('0x34')],qs[_0x4658('0x3a')](_0x7ee94e[_0x4658('0x35')][_0x4658('0x3a')]));_0x57e3bc[_0x4658('0x39')]=_0x57e3bc[_0x4658('0x39')][_0x4658('0x3b')]?_0x57e3bc[_0x4658('0x39')]:_0xa9c056[_0x4658('0x34')];if(_0x7ee94e[_0x4658('0x35')][_0x4658('0x46')]){_0x57e3bc[_0x4658('0x47')]=[{'all':!![]}];}_0x57e3bc=_[_0x4658('0x44')]({},_0x57e3bc,_0x7ee94e[_0x4658('0x45')]);return db[_0x4658('0x30')][_0x4658('0x4c')](_0x57e3bc)['then'](handleEntityNotFound(_0x348536,null))['then'](respondWithResult(_0x348536,null))[_0x4658('0x49')](handleError(_0x348536,null));};exports['create']=function(_0x434e97,_0x3b4713){return db[_0x4658('0x30')][_0x4658('0x4d')](_0x434e97[_0x4658('0x4e')],{})[_0x4658('0x29')](respondWithResult(_0x3b4713,0xc9))[_0x4658('0x49')](handleError(_0x3b4713,null));};exports[_0x4658('0x28')]=function(_0x3854ab,_0x9ea70c){if(_0x3854ab['body']['id']){delete _0x3854ab[_0x4658('0x4e')]['id'];}return db[_0x4658('0x30')][_0x4658('0x4c')]({'where':{'id':_0x3854ab[_0x4658('0x4b')]['id']}})[_0x4658('0x29')](handleEntityNotFound(_0x9ea70c,null))[_0x4658('0x29')](saveUpdates(_0x3854ab[_0x4658('0x4e')],null))[_0x4658('0x29')](respondWithResult(_0x9ea70c,null))[_0x4658('0x49')](handleError(_0x9ea70c,null));};exports[_0x4658('0x2a')]=function(_0x546a38,_0x506a98){return db[_0x4658('0x30')]['find']({'where':{'id':_0x546a38[_0x4658('0x4b')]['id']}})['then'](handleEntityNotFound(_0x506a98,null))[_0x4658('0x29')](removeEntity(_0x506a98,null))[_0x4658('0x49')](handleError(_0x506a98,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 36e31f0..1ccb4d7 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 _0xd139=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','../../config/logger','bluebird','path'];(function(_0x3eb800,_0x263792){var _0x32b52f=function(_0x5d6ae3){while(--_0x5d6ae3){_0x3eb800['push'](_0x3eb800['shift']());}};_0x32b52f(++_0x263792);}(_0xd139,0x7e));var _0x9d13=function(_0x4c687d,_0x9d62f){_0x4c687d=_0x4c687d-0x0;var _0x1ae390=_0xd139[_0x4c687d];return _0x1ae390;};'use strict';var _=require(_0x9d13('0x0'));var util=require('util');var logger=require(_0x9d13('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9d13('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d13('0x3'));var rimraf=require(_0x9d13('0x4'));var config=require(_0x9d13('0x5'));var attributes=require(_0x9d13('0x6'));module[_0x9d13('0x7')]=function(_0x542a75,_0x416eff){return _0x542a75[_0x9d13('0x8')](_0x9d13('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd17d=['rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird'];(function(_0x29f3e0,_0x486ad1){var _0x32fa40=function(_0x452c1c){while(--_0x452c1c){_0x29f3e0['push'](_0x29f3e0['shift']());}};_0x32fa40(++_0x486ad1);}(_0xd17d,0x1c8));var _0xdd17=function(_0x6dd9,_0x58c745){_0x6dd9=_0x6dd9-0x0;var _0x29423f=_0xd17d[_0x6dd9];return _0x29423f;};'use strict';var _=require(_0xdd17('0x0'));var util=require(_0xdd17('0x1'));var logger=require(_0xdd17('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdd17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd17('0x4'));var config=require('../../config/environment');var attributes=require(_0xdd17('0x5'));module[_0xdd17('0x6')]=function(_0x530891,_0x44f6c2){return _0x530891[_0xdd17('0x7')](_0xdd17('0x8'),attributes,{'tableName':_0xdd17('0x9'),'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 d6bd954..b1c2fd3 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x436713,_0x16e96c){var _0x5661b7=function(_0x2ede72){while(--_0x2ede72){_0x436713['push'](_0x436713['shift']());}};_0x5661b7(++_0x16e96c);}(_0xdb28,0x106));var _0x8db2=function(_0x441183,_0x5bb7f9){_0x441183=_0x441183-0x0;var _0x294587=_0xdb28[_0x441183];return _0x294587;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0x3df935,_0x2f6877){var _0x152412=function(_0x213b98){while(--_0x213b98){_0x3df935['push'](_0x3df935['shift']());}};_0x152412(++_0x2f6877);}(_0xadb5,0xad));var _0x5adb=function(_0x110f97,_0x643432){_0x110f97=_0x110f97-0x0;var _0x19cf55=_0xadb5[_0x110f97];return _0x19cf55;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 76be789..0731082 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 _0x0d1b=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x38c6b4,_0x8a6bca){var _0x4c45e4=function(_0x9cf700){while(--_0x9cf700){_0x38c6b4['push'](_0x38c6b4['shift']());}};_0x4c45e4(++_0x8a6bca);}(_0x0d1b,0x8f));var _0xb0d1=function(_0x385edd,_0x2a40e1){_0x385edd=_0x385edd-0x0;var _0x3083d0=_0x0d1b[_0x385edd];return _0x3083d0;};'use strict';var multer=require('multer');var util=require(_0xb0d1('0x0'));var path=require(_0xb0d1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0d1('0x2')]();var fs_extra=require(_0xb0d1('0x3'));var auth=require(_0xb0d1('0x4'));var interaction=require(_0xb0d1('0x5'));var config=require(_0xb0d1('0x6'));var controller=require(_0xb0d1('0x7'));router[_0xb0d1('0x8')]('/',auth[_0xb0d1('0x9')](),controller[_0xb0d1('0xa')]);router['get'](_0xb0d1('0xb'),auth['isAuthenticated'](),controller[_0xb0d1('0xc')]);router[_0xb0d1('0xd')]('/',auth[_0xb0d1('0x9')](),controller[_0xb0d1('0xe')]);router['put']('/:id',auth[_0xb0d1('0x9')](),controller[_0xb0d1('0xf')]);router[_0xb0d1('0x10')](_0xb0d1('0xb'),auth[_0xb0d1('0x9')](),controller[_0xb0d1('0x11')]);module[_0xb0d1('0x12')]=router; \ No newline at end of file +var _0xb4c7=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x146312,_0x5bd7af){var _0x1b0b27=function(_0x46d1ec){while(--_0x46d1ec){_0x146312['push'](_0x146312['shift']());}};_0x1b0b27(++_0x5bd7af);}(_0xb4c7,0x1eb));var _0x7b4c=function(_0x41ebe4,_0x2c44b5){_0x41ebe4=_0x41ebe4-0x0;var _0x164bef=_0xb4c7[_0x41ebe4];return _0x164bef;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express[_0x7b4c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x7b4c('0x9')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router['get'](_0x7b4c('0xc'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router[_0x7b4c('0xe')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7b4c('0x10')]);router[_0x7b4c('0x11')]('/:id',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x12')]);module[_0x7b4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b0b041e..65eb767 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 _0xf675=['STRING','sequelize','exports'];(function(_0x4d3de3,_0x1ea983){var _0x36becc=function(_0x537964){while(--_0x537964){_0x4d3de3['push'](_0x4d3de3['shift']());}};_0x36becc(++_0x1ea983);}(_0xf675,0x199));var _0x5f67=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf675[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x5f67('0x0'));module[_0x5f67('0x1')]={'name':{'type':Sequelize[_0x5f67('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5f67('0x2')]}}; \ No newline at end of file +var _0x8f7d=['exports','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x52eca4,_0x2afd62){_0x52eca4=_0x52eca4-0x0;var _0x1366b9=_0x8f7d[_0x52eca4];return _0x1366b9;};'use strict';var Sequelize=require(_0xd8f7('0x0'));module[_0xd8f7('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd8f7('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 960b2ae..6d69efe 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 _0xf675=['findAll','catch','show','params','find','get','omit','body','createdAt','create','file','originalname','mimetype','join','root','server/files/attachments/','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x179038,_0x2cd85e){var _0x2a4761=function(_0x258601){while(--_0x258601){_0x179038['push'](_0x179038['shift']());}};_0x2a4761(++_0x2cd85e);}(_0xf675,0x163));var _0x5f67=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf675[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x5f67('0x0'));var rimraf=require(_0x5f67('0x1'));var zipdir=require(_0x5f67('0x2'));var jsonpatch=require(_0x5f67('0x3'));var rp=require('request-promise');var moment=require(_0x5f67('0x4'));var BPromise=require(_0x5f67('0x5'));var Mustache=require(_0x5f67('0x6'));var util=require(_0x5f67('0x7'));var path=require(_0x5f67('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f67('0x9'));var _=require(_0x5f67('0xa'));var squel=require(_0x5f67('0xb'));var crypto=require(_0x5f67('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5f67('0xd'));var querystring=require(_0x5f67('0xe'));var Papa=require(_0x5f67('0xf'));var Redis=require(_0x5f67('0x10'));var authService=require(_0x5f67('0x11'));var qs=require(_0x5f67('0x12'));var as=require(_0x5f67('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f67('0x14'))(_0x5f67('0x15'));var utils=require(_0x5f67('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f67('0x17'))['db'];function respondWithStatusCode(_0x3a62da,_0x3856df){_0x3856df=_0x3856df||0xcc;return function(_0x284d7e){if(_0x284d7e){return _0x3a62da['sendStatus'](_0x3856df);}return _0x3a62da[_0x5f67('0x18')](_0x3856df)['end']();};}function respondWithResult(_0x4854ae,_0x424790){_0x424790=_0x424790||0xc8;return function(_0x4208ae){if(_0x4208ae){return _0x4854ae[_0x5f67('0x18')](_0x424790)[_0x5f67('0x19')](_0x4208ae);}};}function respondWithFilteredResult(_0x291f4e,_0x5949bf){return function(_0x43b7c9){if(_0x43b7c9){var _0x39542c=typeof _0x5949bf['offset']===_0x5f67('0x1a')&&typeof _0x5949bf[_0x5f67('0x1b')]===_0x5f67('0x1a');var _0x1feb20=_0x43b7c9[_0x5f67('0x1c')];var _0x251e1b=_0x39542c?0x0:_0x5949bf['offset'];var _0x4d764e=_0x39542c?_0x43b7c9[_0x5f67('0x1c')]:_0x5949bf[_0x5f67('0x1d')]+_0x5949bf[_0x5f67('0x1b')];var _0x5a17f9;if(_0x4d764e>=_0x1feb20){_0x4d764e=_0x1feb20;_0x5a17f9=0xc8;}else{_0x5a17f9=0xce;}_0x291f4e[_0x5f67('0x18')](_0x5a17f9);return _0x291f4e['set']('Content-Range',_0x251e1b+'-'+_0x4d764e+'/'+_0x1feb20)[_0x5f67('0x19')](_0x43b7c9);}return null;};}function patchUpdates(_0x455703){return function(_0x4be9be){try{jsonpatch[_0x5f67('0x1e')](_0x4be9be,_0x455703,!![]);}catch(_0x1eeeab){return BPromise[_0x5f67('0x1f')](_0x1eeeab);}return _0x4be9be[_0x5f67('0x20')]();};}function saveUpdates(_0x3d10dd,_0x3b691a){return function(_0x166027){if(_0x166027){return _0x166027[_0x5f67('0x21')](_0x3d10dd)[_0x5f67('0x22')](function(_0x461a2b){return _0x461a2b;});}return null;};}function removeEntity(_0x2f0842,_0x8f1b69){return function(_0x5968a4){if(_0x5968a4){return _0x5968a4[_0x5f67('0x23')]()[_0x5f67('0x22')](function(){_0x2f0842[_0x5f67('0x18')](0xcc)[_0x5f67('0x24')]();});}};}function handleEntityNotFound(_0x2f3e27,_0x29f177){return function(_0x4ed5b0){if(!_0x4ed5b0){_0x2f3e27[_0x5f67('0x25')](0x194);}return _0x4ed5b0;};}function handleError(_0x5ad2eb,_0x20e846){_0x20e846=_0x20e846||0x1f4;return function(_0x4b18cb){logger['error'](_0x4b18cb[_0x5f67('0x26')]);if(_0x4b18cb[_0x5f67('0x27')]){delete _0x4b18cb['name'];}_0x5ad2eb[_0x5f67('0x18')](_0x20e846)[_0x5f67('0x28')](_0x4b18cb);};}exports[_0x5f67('0x29')]=function(_0x19e00b,_0x193b93){var _0x4b2dc1={},_0x37e4f5={},_0x326d0d={'count':0x0,'rows':[]};var _0x127c7a=_[_0x5f67('0x2a')](db[_0x5f67('0x2b')][_0x5f67('0x2c')],function(_0x137584){return{'name':_0x137584[_0x5f67('0x2d')],'type':_0x137584[_0x5f67('0x2e')]['key']};});_0x37e4f5[_0x5f67('0x2f')]=_['map'](_0x127c7a,_0x5f67('0x27'));_0x37e4f5[_0x5f67('0x30')]=_[_0x5f67('0x31')](_0x19e00b[_0x5f67('0x30')]);_0x37e4f5['filters']=_[_0x5f67('0x32')](_0x37e4f5[_0x5f67('0x2f')],_0x37e4f5[_0x5f67('0x30')]);_0x4b2dc1[_0x5f67('0x33')]=_[_0x5f67('0x32')](_0x37e4f5['model'],qs[_0x5f67('0x34')](_0x19e00b[_0x5f67('0x30')][_0x5f67('0x34')]));_0x4b2dc1['attributes']=_0x4b2dc1[_0x5f67('0x33')][_0x5f67('0x35')]?_0x4b2dc1[_0x5f67('0x33')]:_0x37e4f5[_0x5f67('0x2f')];if(!_0x19e00b[_0x5f67('0x30')][_0x5f67('0x36')]('nolimit')){_0x4b2dc1[_0x5f67('0x1b')]=qs[_0x5f67('0x1b')](_0x19e00b[_0x5f67('0x30')][_0x5f67('0x1b')]);_0x4b2dc1[_0x5f67('0x1d')]=qs[_0x5f67('0x1d')](_0x19e00b['query'][_0x5f67('0x1d')]);}_0x4b2dc1[_0x5f67('0x37')]=qs[_0x5f67('0x38')](_0x19e00b[_0x5f67('0x30')][_0x5f67('0x38')]);_0x4b2dc1['where']=qs[_0x5f67('0x39')](_[_0x5f67('0x3a')](_0x19e00b[_0x5f67('0x30')],_0x37e4f5[_0x5f67('0x39')]),_0x127c7a);if(_0x19e00b[_0x5f67('0x30')][_0x5f67('0x3b')]){_0x4b2dc1[_0x5f67('0x3c')]=_[_0x5f67('0x3d')](_0x4b2dc1[_0x5f67('0x3c')],{'$or':_[_0x5f67('0x2a')](_0x127c7a,function(_0x21ab76){if(_0x21ab76[_0x5f67('0x2e')]!==_0x5f67('0x3e')){var _0x580867={};_0x580867[_0x21ab76[_0x5f67('0x27')]]={'$like':'%'+_0x19e00b[_0x5f67('0x30')][_0x5f67('0x3b')]+'%'};return _0x580867;}})});}_0x4b2dc1=_[_0x5f67('0x3d')]({},_0x4b2dc1,_0x19e00b['options']);var _0x5334af={'where':_0x4b2dc1[_0x5f67('0x3c')]};return db[_0x5f67('0x2b')][_0x5f67('0x1c')](_0x5334af)['then'](function(_0x342cca){_0x326d0d[_0x5f67('0x1c')]=_0x342cca;if(_0x19e00b['query'][_0x5f67('0x3f')]){_0x4b2dc1[_0x5f67('0x40')]=[{'all':!![]}];}return db[_0x5f67('0x2b')][_0x5f67('0x41')](_0x4b2dc1);})[_0x5f67('0x22')](function(_0x150f9a){_0x326d0d['rows']=_0x150f9a;return _0x326d0d;})[_0x5f67('0x22')](respondWithFilteredResult(_0x193b93,_0x4b2dc1))[_0x5f67('0x42')](handleError(_0x193b93,null));};exports[_0x5f67('0x43')]=function(_0x3a5b61,_0x5d030d){var _0x16ca2f={'raw':!![],'where':{'id':_0x3a5b61[_0x5f67('0x44')]['id']}},_0x2c79b1={};_0x2c79b1['model']=_[_0x5f67('0x31')](db[_0x5f67('0x2b')][_0x5f67('0x2c')]);_0x2c79b1[_0x5f67('0x30')]=_['keys'](_0x3a5b61['query']);_0x2c79b1[_0x5f67('0x39')]=_[_0x5f67('0x32')](_0x2c79b1[_0x5f67('0x2f')],_0x2c79b1['query']);_0x16ca2f[_0x5f67('0x33')]=_['intersection'](_0x2c79b1['model'],qs['fields'](_0x3a5b61[_0x5f67('0x30')][_0x5f67('0x34')]));_0x16ca2f[_0x5f67('0x33')]=_0x16ca2f[_0x5f67('0x33')][_0x5f67('0x35')]?_0x16ca2f['attributes']:_0x2c79b1[_0x5f67('0x2f')];if(_0x3a5b61['query'][_0x5f67('0x3f')]){_0x16ca2f[_0x5f67('0x40')]=[{'all':!![]}];}_0x16ca2f=_[_0x5f67('0x3d')]({},_0x16ca2f,_0x3a5b61['options']);return db['Attachment'][_0x5f67('0x45')](_0x16ca2f)[_0x5f67('0x22')](handleEntityNotFound(_0x5d030d,null))[_0x5f67('0x22')](respondWithResult(_0x5d030d,null))[_0x5f67('0x42')](handleError(_0x5d030d,null));};exports['clone']=function(_0x48988d,_0x4b0907){var _0x3fab09={'where':{'id':_0x48988d[_0x5f67('0x44')]['id']}},_0x104119={};_0x104119['model']=_[_0x5f67('0x31')](db[_0x5f67('0x2b')][_0x5f67('0x2c')]);_0x3fab09[_0x5f67('0x33')]=_['intersection'](_0x104119['model'],qs[_0x5f67('0x34')](_0x48988d['query'][_0x5f67('0x34')]));_0x3fab09[_0x5f67('0x33')]=_0x3fab09[_0x5f67('0x33')][_0x5f67('0x35')]?_0x3fab09[_0x5f67('0x33')]:_0x104119['model'];if(_0x48988d[_0x5f67('0x30')][_0x5f67('0x3f')]){_0x3fab09[_0x5f67('0x40')]=[{'all':!![]}];}_0x3fab09=_[_0x5f67('0x3d')]({},_0x3fab09,_0x48988d['options']);return db[_0x5f67('0x2b')][_0x5f67('0x45')](_0x3fab09)[_0x5f67('0x22')](handleEntityNotFound(_0x4b0907,null))[_0x5f67('0x22')](function(_0x23ade1){if(_0x23ade1){var _0x34b101=_0x23ade1[_0x5f67('0x46')]({'plain':!![]});_0x34b101=qs[_0x5f67('0x47')](_0x34b101,['id','createdAt','updatedAt']);_0x48988d[_0x5f67('0x48')]=_[_0x5f67('0x47')](_0x48988d[_0x5f67('0x48')],['id',_0x5f67('0x49'),'updatedAt']);return db[_0x5f67('0x2b')][_0x5f67('0x4a')](_[_0x5f67('0x3d')](_0x34b101,_0x48988d[_0x5f67('0x48')]),{'include':_0x48988d[_0x5f67('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x5f67('0x22')](respondWithResult(_0x4b0907,0xc9))[_0x5f67('0x42')](handleError(_0x4b0907,null));};exports[_0x5f67('0x21')]=function(_0x465bae,_0x89060e){if(_0x465bae[_0x5f67('0x48')]['id']){delete _0x465bae['body']['id'];}return db[_0x5f67('0x2b')][_0x5f67('0x45')]({'where':{'id':_0x465bae['params']['id']}})[_0x5f67('0x22')](handleEntityNotFound(_0x89060e,null))[_0x5f67('0x22')](saveUpdates(_0x465bae[_0x5f67('0x48')],null))[_0x5f67('0x22')](respondWithResult(_0x89060e,null))[_0x5f67('0x42')](handleError(_0x89060e,null));};exports['destroy']=function(_0x19f4a4,_0x17d967){return db[_0x5f67('0x2b')][_0x5f67('0x45')]({'where':{'id':_0x19f4a4[_0x5f67('0x44')]['id']}})[_0x5f67('0x22')](handleEntityNotFound(_0x17d967,null))[_0x5f67('0x22')](removeEntity(_0x17d967,null))[_0x5f67('0x42')](handleError(_0x17d967,null));};exports['create']=function(_0x51257e,_0x823bfe,_0x2cb63b){_0x51257e['body'][_0x5f67('0x27')]=_0x51257e[_0x5f67('0x4b')][_0x5f67('0x4c')];_0x51257e['body']['basename']=_0x51257e[_0x5f67('0x4b')]['filename'];_0x51257e[_0x5f67('0x48')][_0x5f67('0x2e')]=_0x51257e['file'][_0x5f67('0x4d')];return db[_0x5f67('0x2b')]['create'](_0x51257e[_0x5f67('0x48')])[_0x5f67('0x22')](respondWithResult(_0x823bfe,0xc9))[_0x5f67('0x42')](handleError(_0x823bfe,null));};exports['download']=function(_0x37c5b3,_0x2128e7,_0x39e7cc){return db[_0x5f67('0x2b')]['findOne']({'where':{'id':_0x37c5b3[_0x5f67('0x44')]['id']},'raw':!![]})[_0x5f67('0x22')](handleEntityNotFound(_0x2128e7,null))[_0x5f67('0x22')](function(_0x1f7186){if(_0x1f7186){var _0x438300=_0x1f7186['ChatOfflineMessageId']!==null;var _0x49cdd6=path[_0x5f67('0x4e')](config[_0x5f67('0x4f')],_0x5f67('0x50'));if(_0x438300){_0x49cdd6=path['join'](_0x49cdd6,_0x5f67('0x51'));}var _0x4444aa=path[_0x5f67('0x4e')](_0x49cdd6,_0x1f7186[_0x5f67('0x52')]);return _0x2128e7[_0x5f67('0x53')](_0x4444aa);}})['catch'](handleError(_0x2128e7,null));}; \ No newline at end of file +var _0xf2a3=['apply','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','filter','includeAll','findAll','catch','show','include','options','find','clone','params','get','omit','createdAt','updatedAt','body','create','file','originalname','filename','mimetype','ChatOfflineMessageId','join','server/files/attachments/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range'];(function(_0x27a929,_0x19068d){var _0x43ac7c=function(_0x86455b){while(--_0x86455b){_0x27a929['push'](_0x27a929['shift']());}};_0x43ac7c(++_0x19068d);}(_0xf2a3,0x1a8));var _0x3f2a=function(_0xb3275c,_0x2623c3){_0xb3275c=_0xb3275c-0x0;var _0x58e50b=_0xf2a3[_0xb3275c];return _0x58e50b;};'use strict';var emlformat=require(_0x3f2a('0x0'));var rimraf=require(_0x3f2a('0x1'));var zipdir=require(_0x3f2a('0x2'));var jsonpatch=require(_0x3f2a('0x3'));var rp=require(_0x3f2a('0x4'));var moment=require('moment');var BPromise=require(_0x3f2a('0x5'));var Mustache=require(_0x3f2a('0x6'));var util=require(_0x3f2a('0x7'));var path=require(_0x3f2a('0x8'));var sox=require(_0x3f2a('0x9'));var csv=require(_0x3f2a('0xa'));var ejs=require(_0x3f2a('0xb'));var fs=require('fs');var fs_extra=require(_0x3f2a('0xc'));var _=require(_0x3f2a('0xd'));var squel=require(_0x3f2a('0xe'));var crypto=require('crypto');var jsforce=require(_0x3f2a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3f2a('0xa'));var querystring=require(_0x3f2a('0x10'));var Papa=require(_0x3f2a('0x11'));var Redis=require(_0x3f2a('0x12'));var authService=require(_0x3f2a('0x13'));var qs=require(_0x3f2a('0x14'));var as=require(_0x3f2a('0x15'));var hardwareService=require(_0x3f2a('0x16'));var logger=require(_0x3f2a('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3f2a('0x18'));var licenseUtil=require(_0x3f2a('0x19'));var db=require(_0x3f2a('0x1a'))['db'];function respondWithStatusCode(_0x4db237,_0x5a6033){_0x5a6033=_0x5a6033||0xcc;return function(_0x423b63){if(_0x423b63){return _0x4db237[_0x3f2a('0x1b')](_0x5a6033);}return _0x4db237[_0x3f2a('0x1c')](_0x5a6033)[_0x3f2a('0x1d')]();};}function respondWithResult(_0x502a8f,_0x4d3bd1){_0x4d3bd1=_0x4d3bd1||0xc8;return function(_0x4c491c){if(_0x4c491c){return _0x502a8f[_0x3f2a('0x1c')](_0x4d3bd1)[_0x3f2a('0x1e')](_0x4c491c);}};}function respondWithFilteredResult(_0x18cf00,_0x28b4a5){return function(_0x5839fc){if(_0x5839fc){var _0x23ea38=typeof _0x28b4a5[_0x3f2a('0x1f')]===_0x3f2a('0x20')&&typeof _0x28b4a5['limit']===_0x3f2a('0x20');var _0x65aed9=_0x5839fc['count'];var _0xc445ba=_0x23ea38?0x0:_0x28b4a5[_0x3f2a('0x1f')];var _0x5af7d4=_0x23ea38?_0x5839fc[_0x3f2a('0x21')]:_0x28b4a5[_0x3f2a('0x1f')]+_0x28b4a5['limit'];var _0x2b72c7;if(_0x5af7d4>=_0x65aed9){_0x5af7d4=_0x65aed9;_0x2b72c7=0xc8;}else{_0x2b72c7=0xce;}_0x18cf00[_0x3f2a('0x1c')](_0x2b72c7);return _0x18cf00[_0x3f2a('0x22')](_0x3f2a('0x23'),_0xc445ba+'-'+_0x5af7d4+'/'+_0x65aed9)[_0x3f2a('0x1e')](_0x5839fc);}return null;};}function patchUpdates(_0x246d08){return function(_0x23b0a4){try{jsonpatch[_0x3f2a('0x24')](_0x23b0a4,_0x246d08,!![]);}catch(_0x255d82){return BPromise['reject'](_0x255d82);}return _0x23b0a4[_0x3f2a('0x25')]();};}function saveUpdates(_0x4ec9b8,_0x416cff){return function(_0x3c4168){if(_0x3c4168){return _0x3c4168[_0x3f2a('0x26')](_0x4ec9b8)[_0x3f2a('0x27')](function(_0x15341b){return _0x15341b;});}return null;};}function removeEntity(_0x5c685b,_0x8ecc6e){return function(_0x25642d){if(_0x25642d){return _0x25642d[_0x3f2a('0x28')]()[_0x3f2a('0x27')](function(){_0x5c685b[_0x3f2a('0x1c')](0xcc)[_0x3f2a('0x1d')]();});}};}function handleEntityNotFound(_0x23145d,_0x1c3773){return function(_0x47b038){if(!_0x47b038){_0x23145d['sendStatus'](0x194);}return _0x47b038;};}function handleError(_0x442b1e,_0xde22d2){_0xde22d2=_0xde22d2||0x1f4;return function(_0x46e857){logger[_0x3f2a('0x29')](_0x46e857[_0x3f2a('0x2a')]);if(_0x46e857[_0x3f2a('0x2b')]){delete _0x46e857[_0x3f2a('0x2b')];}_0x442b1e[_0x3f2a('0x1c')](_0xde22d2)[_0x3f2a('0x2c')](_0x46e857);};}exports[_0x3f2a('0x2d')]=function(_0x281bbe,_0x5f3ee0){var _0xbc311b={},_0x5bfb2f={},_0x4a80e3={'count':0x0,'rows':[]};var _0x32d3af=_[_0x3f2a('0x2e')](db[_0x3f2a('0x2f')][_0x3f2a('0x30')],function(_0x698e21){return{'name':_0x698e21[_0x3f2a('0x31')],'type':_0x698e21['type'][_0x3f2a('0x32')]};});_0x5bfb2f[_0x3f2a('0x33')]=_[_0x3f2a('0x2e')](_0x32d3af,_0x3f2a('0x2b'));_0x5bfb2f[_0x3f2a('0x34')]=_[_0x3f2a('0x35')](_0x281bbe['query']);_0x5bfb2f[_0x3f2a('0x36')]=_[_0x3f2a('0x37')](_0x5bfb2f['model'],_0x5bfb2f['query']);_0xbc311b['attributes']=_[_0x3f2a('0x37')](_0x5bfb2f[_0x3f2a('0x33')],qs[_0x3f2a('0x38')](_0x281bbe[_0x3f2a('0x34')][_0x3f2a('0x38')]));_0xbc311b[_0x3f2a('0x39')]=_0xbc311b[_0x3f2a('0x39')][_0x3f2a('0x3a')]?_0xbc311b[_0x3f2a('0x39')]:_0x5bfb2f[_0x3f2a('0x33')];if(!_0x281bbe[_0x3f2a('0x34')][_0x3f2a('0x3b')](_0x3f2a('0x3c'))){_0xbc311b[_0x3f2a('0x3d')]=qs[_0x3f2a('0x3d')](_0x281bbe['query']['limit']);_0xbc311b[_0x3f2a('0x1f')]=qs[_0x3f2a('0x1f')](_0x281bbe[_0x3f2a('0x34')]['offset']);}_0xbc311b[_0x3f2a('0x3e')]=qs[_0x3f2a('0x3f')](_0x281bbe[_0x3f2a('0x34')][_0x3f2a('0x3f')]);_0xbc311b[_0x3f2a('0x40')]=qs[_0x3f2a('0x36')](_['pick'](_0x281bbe[_0x3f2a('0x34')],_0x5bfb2f[_0x3f2a('0x36')]),_0x32d3af);if(_0x281bbe[_0x3f2a('0x34')]['filter']){_0xbc311b[_0x3f2a('0x40')]=_[_0x3f2a('0x41')](_0xbc311b['where'],{'$or':_[_0x3f2a('0x2e')](_0x32d3af,function(_0x13ab33){if(_0x13ab33[_0x3f2a('0x42')]!=='VIRTUAL'){var _0x458640={};_0x458640[_0x13ab33[_0x3f2a('0x2b')]]={'$like':'%'+_0x281bbe[_0x3f2a('0x34')][_0x3f2a('0x43')]+'%'};return _0x458640;}})});}_0xbc311b=_[_0x3f2a('0x41')]({},_0xbc311b,_0x281bbe['options']);var _0xb994c5={'where':_0xbc311b[_0x3f2a('0x40')]};return db[_0x3f2a('0x2f')]['count'](_0xb994c5)['then'](function(_0x50e9c0){_0x4a80e3[_0x3f2a('0x21')]=_0x50e9c0;if(_0x281bbe[_0x3f2a('0x34')][_0x3f2a('0x44')]){_0xbc311b['include']=[{'all':!![]}];}return db[_0x3f2a('0x2f')][_0x3f2a('0x45')](_0xbc311b);})[_0x3f2a('0x27')](function(_0x455c79){_0x4a80e3['rows']=_0x455c79;return _0x4a80e3;})[_0x3f2a('0x27')](respondWithFilteredResult(_0x5f3ee0,_0xbc311b))[_0x3f2a('0x46')](handleError(_0x5f3ee0,null));};exports[_0x3f2a('0x47')]=function(_0x502231,_0x143ff7){var _0x26fde0={'raw':!![],'where':{'id':_0x502231['params']['id']}},_0x489a4b={};_0x489a4b[_0x3f2a('0x33')]=_[_0x3f2a('0x35')](db[_0x3f2a('0x2f')][_0x3f2a('0x30')]);_0x489a4b[_0x3f2a('0x34')]=_[_0x3f2a('0x35')](_0x502231[_0x3f2a('0x34')]);_0x489a4b[_0x3f2a('0x36')]=_[_0x3f2a('0x37')](_0x489a4b[_0x3f2a('0x33')],_0x489a4b[_0x3f2a('0x34')]);_0x26fde0[_0x3f2a('0x39')]=_[_0x3f2a('0x37')](_0x489a4b[_0x3f2a('0x33')],qs[_0x3f2a('0x38')](_0x502231['query'][_0x3f2a('0x38')]));_0x26fde0['attributes']=_0x26fde0[_0x3f2a('0x39')][_0x3f2a('0x3a')]?_0x26fde0[_0x3f2a('0x39')]:_0x489a4b[_0x3f2a('0x33')];if(_0x502231['query'][_0x3f2a('0x44')]){_0x26fde0[_0x3f2a('0x48')]=[{'all':!![]}];}_0x26fde0=_[_0x3f2a('0x41')]({},_0x26fde0,_0x502231[_0x3f2a('0x49')]);return db[_0x3f2a('0x2f')][_0x3f2a('0x4a')](_0x26fde0)[_0x3f2a('0x27')](handleEntityNotFound(_0x143ff7,null))[_0x3f2a('0x27')](respondWithResult(_0x143ff7,null))[_0x3f2a('0x46')](handleError(_0x143ff7,null));};exports[_0x3f2a('0x4b')]=function(_0x139310,_0x330403){var _0x207369={'where':{'id':_0x139310[_0x3f2a('0x4c')]['id']}},_0x456eec={};_0x456eec['model']=_['keys'](db['Attachment'][_0x3f2a('0x30')]);_0x207369['attributes']=_[_0x3f2a('0x37')](_0x456eec[_0x3f2a('0x33')],qs[_0x3f2a('0x38')](_0x139310[_0x3f2a('0x34')][_0x3f2a('0x38')]));_0x207369[_0x3f2a('0x39')]=_0x207369[_0x3f2a('0x39')][_0x3f2a('0x3a')]?_0x207369[_0x3f2a('0x39')]:_0x456eec[_0x3f2a('0x33')];if(_0x139310[_0x3f2a('0x34')]['includeAll']){_0x207369[_0x3f2a('0x48')]=[{'all':!![]}];}_0x207369=_[_0x3f2a('0x41')]({},_0x207369,_0x139310[_0x3f2a('0x49')]);return db[_0x3f2a('0x2f')][_0x3f2a('0x4a')](_0x207369)[_0x3f2a('0x27')](handleEntityNotFound(_0x330403,null))[_0x3f2a('0x27')](function(_0x5e3470){if(_0x5e3470){var _0x5f51d9=_0x5e3470[_0x3f2a('0x4d')]({'plain':!![]});_0x5f51d9=qs[_0x3f2a('0x4e')](_0x5f51d9,['id',_0x3f2a('0x4f'),_0x3f2a('0x50')]);_0x139310[_0x3f2a('0x51')]=_['omit'](_0x139310[_0x3f2a('0x51')],['id',_0x3f2a('0x4f'),_0x3f2a('0x50')]);return db['Attachment'][_0x3f2a('0x52')](_[_0x3f2a('0x41')](_0x5f51d9,_0x139310[_0x3f2a('0x51')]),{'include':_0x139310['query'][_0x3f2a('0x44')]?[{'all':!![]}]:undefined});}})[_0x3f2a('0x27')](respondWithResult(_0x330403,0xc9))[_0x3f2a('0x46')](handleError(_0x330403,null));};exports[_0x3f2a('0x26')]=function(_0x3a6fa6,_0x419d95){if(_0x3a6fa6[_0x3f2a('0x51')]['id']){delete _0x3a6fa6[_0x3f2a('0x51')]['id'];}return db[_0x3f2a('0x2f')][_0x3f2a('0x4a')]({'where':{'id':_0x3a6fa6[_0x3f2a('0x4c')]['id']}})[_0x3f2a('0x27')](handleEntityNotFound(_0x419d95,null))[_0x3f2a('0x27')](saveUpdates(_0x3a6fa6['body'],null))['then'](respondWithResult(_0x419d95,null))[_0x3f2a('0x46')](handleError(_0x419d95,null));};exports[_0x3f2a('0x28')]=function(_0xdb27a3,_0xa20df9){return db[_0x3f2a('0x2f')][_0x3f2a('0x4a')]({'where':{'id':_0xdb27a3[_0x3f2a('0x4c')]['id']}})['then'](handleEntityNotFound(_0xa20df9,null))[_0x3f2a('0x27')](removeEntity(_0xa20df9,null))[_0x3f2a('0x46')](handleError(_0xa20df9,null));};exports[_0x3f2a('0x52')]=function(_0x5e0933,_0x5b9da2,_0x11426c){_0x5e0933[_0x3f2a('0x51')][_0x3f2a('0x2b')]=_0x5e0933[_0x3f2a('0x53')][_0x3f2a('0x54')];_0x5e0933['body']['basename']=_0x5e0933[_0x3f2a('0x53')][_0x3f2a('0x55')];_0x5e0933[_0x3f2a('0x51')]['type']=_0x5e0933[_0x3f2a('0x53')][_0x3f2a('0x56')];return db[_0x3f2a('0x2f')][_0x3f2a('0x52')](_0x5e0933['body'])[_0x3f2a('0x27')](respondWithResult(_0x5b9da2,0xc9))['catch'](handleError(_0x5b9da2,null));};exports['download']=function(_0x8009ec,_0x4fe88d,_0x482762){return db[_0x3f2a('0x2f')]['findOne']({'where':{'id':_0x8009ec['params']['id']},'raw':!![]})[_0x3f2a('0x27')](handleEntityNotFound(_0x4fe88d,null))[_0x3f2a('0x27')](function(_0x1b5ce1){if(_0x1b5ce1){var _0x250467=_0x1b5ce1[_0x3f2a('0x57')]!==null;var _0x4b1cd8=path[_0x3f2a('0x58')](config['root'],_0x3f2a('0x59'));if(_0x250467){_0x4b1cd8=path['join'](_0x4b1cd8,'offline-chat/');}var _0x29929f=path[_0x3f2a('0x58')](_0x4b1cd8,_0x1b5ce1[_0x3f2a('0x5a')]);return _0x4fe88d[_0x3f2a('0x5b')](_0x29929f);}})['catch'](handleError(_0x4fe88d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index da2cfb5..be22592 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 _0xa2a1=['exports','define','Attachment','attachments','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x26bf45,_0x1c8091){var _0x48a84e=function(_0x18e2ac){while(--_0x18e2ac){_0x26bf45['push'](_0x26bf45['shift']());}};_0x48a84e(++_0x1c8091);}(_0xa2a1,0xe0));var _0x1a2a=function(_0x10982b,_0x4fd22c){_0x10982b=_0x10982b-0x0;var _0x45e3a6=_0xa2a1[_0x10982b];return _0x45e3a6;};'use strict';var _=require('lodash');var util=require(_0x1a2a('0x0'));var logger=require(_0x1a2a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a2a('0x2'));var fs=require('fs');var path=require(_0x1a2a('0x3'));var rimraf=require(_0x1a2a('0x4'));var config=require(_0x1a2a('0x5'));var attributes=require(_0x1a2a('0x6'));module[_0x1a2a('0x7')]=function(_0x56d10f,_0x240d7e){return _0x56d10f[_0x1a2a('0x8')](_0x1a2a('0x9'),attributes,{'tableName':_0x1a2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3583=['../../config/environment','./attachment.attributes','define','Attachment','attachments','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3583,0xc0));var _0x3358=function(_0x7a56c,_0x4c8ece){_0x7a56c=_0x7a56c-0x0;var _0x14f77a=_0x3583[_0x7a56c];return _0x14f77a;};'use strict';var _=require('lodash');var util=require(_0x3358('0x0'));var logger=require(_0x3358('0x1'))('api');var moment=require(_0x3358('0x2'));var BPromise=require('bluebird');var rp=require(_0x3358('0x3'));var fs=require('fs');var path=require(_0x3358('0x4'));var rimraf=require(_0x3358('0x5'));var config=require(_0x3358('0x6'));var attributes=require(_0x3358('0x7'));module['exports']=function(_0xae929e,_0x5e6250){return _0xae929e[_0x3358('0x8')](_0x3358('0x9'),attributes,{'tableName':_0x3358('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3ada7d0..c154125 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 _0xfc1e=['message','result','CreateAttachment','create','body','options','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x243fef,_0x2f087c){var _0x214621=function(_0xe8efc5){while(--_0xe8efc5){_0x243fef['push'](_0x243fef['shift']());}};_0x214621(++_0x2f087c);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfc1e[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefc1('0x0'));var rs=require(_0xefc1('0x1'));var fs=require('fs');var Redis=require(_0xefc1('0x2'));var db=require(_0xefc1('0x3'))['db'];var utils=require(_0xefc1('0x4'));var logger=require('../../config/logger')(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38927c,_0x44d15b,_0x3ff4a7){return new BPromise(function(_0x45bec4,_0x77f637){return client[_0xefc1('0x8')](_0x38927c,_0x3ff4a7)[_0xefc1('0x9')](function(_0x244927){logger[_0xefc1('0xa')](_0xefc1('0xb'),_0x44d15b,'request\x20sent');logger[_0xefc1('0xc')](_0xefc1('0xd'),_0x44d15b,_0xefc1('0xe'),JSON[_0xefc1('0xf')](_0x244927));if(_0x244927[_0xefc1('0x10')]){if(_0x244927[_0xefc1('0x10')][_0xefc1('0x11')]===0x1f4){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x77f637(_0x244927['error'][_0xefc1('0x12')]);}logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x45bec4(_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);}else{logger[_0xefc1('0xa')]('Attachment,\x20%s,\x20%s',_0x44d15b,_0xefc1('0xe'));_0x45bec4(_0x244927[_0xefc1('0x13')][_0xefc1('0x12')]);}})['catch'](function(_0x159adb){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x159adb);_0x77f637(_0x159adb);});});}exports[_0xefc1('0x14')]=function(_0x257914){var _0x38923c=this;return new Promise(function(_0x3b5a6e,_0x126052){return db['Attachment'][_0xefc1('0x15')](_0x257914[_0xefc1('0x16')],{'raw':_0x257914[_0xefc1('0x17')]?_0x257914['options']['raw']===undefined?!![]:![]:!![]})[_0xefc1('0x9')](function(_0x492d7d){logger[_0xefc1('0xa')]('CreateAttachment',_0x257914);logger[_0xefc1('0xc')](_0xefc1('0x14'),_0x257914,JSON['stringify'](_0x492d7d));_0x3b5a6e(_0x492d7d);})[_0xefc1('0x18')](function(_0x2ea108){logger[_0xefc1('0x10')](_0xefc1('0x14'),_0x2ea108[_0xefc1('0x12')],_0x257914);_0x126052(_0x38923c[_0xefc1('0x10')](0x1f4,_0x2ea108['message']));});});}; \ No newline at end of file +var _0x07c3=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateAttachment','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x4ba9d2,_0x2ecfdd){var _0x29188d=function(_0x5c3a3d){while(--_0x5c3a3d){_0x4ba9d2['push'](_0x4ba9d2['shift']());}};_0x29188d(++_0x2ecfdd);}(_0x07c3,0x1bf));var _0x307c=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x07c3[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rs=require(_0x307c('0x4'));var fs=require('fs');var Redis=require(_0x307c('0x5'));var db=require(_0x307c('0x6'))['db'];var utils=require(_0x307c('0x7'));var logger=require('../../config/logger')(_0x307c('0x8'));var config=require(_0x307c('0x9'));var jayson=require(_0x307c('0xa'));var client=jayson[_0x307c('0xb')][_0x307c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x410ae8,_0x39af52,_0x3f5d08){return new BPromise(function(_0xfb14bf,_0x166467){return client[_0x307c('0xd')](_0x410ae8,_0x3f5d08)[_0x307c('0xe')](function(_0x1af97f){logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,'request\x20sent');logger[_0x307c('0x11')](_0x307c('0x12'),_0x39af52,_0x307c('0x13'),JSON[_0x307c('0x14')](_0x1af97f));if(_0x1af97f['error']){if(_0x1af97f['error'][_0x307c('0x15')]===0x1f4){logger['error'](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')]['message']);return _0x166467(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);return _0xfb14bf(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}else{logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,_0x307c('0x13'));_0xfb14bf(_0x1af97f[_0x307c('0x18')]['message']);}})[_0x307c('0x19')](function(_0x364441){logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x364441);_0x166467(_0x364441);});});}exports[_0x307c('0x1a')]=function(_0x2e21a6){var _0x3e05e2=this;return new Promise(function(_0x13f03b,_0xbfe2b4){return db['Attachment']['create'](_0x2e21a6[_0x307c('0x1b')],{'raw':_0x2e21a6['options']?_0x2e21a6[_0x307c('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4bcc1a){logger[_0x307c('0xf')]('CreateAttachment',_0x2e21a6);logger[_0x307c('0x11')](_0x307c('0x1a'),_0x2e21a6,JSON['stringify'](_0x4bcc1a));_0x13f03b(_0x4bcc1a);})[_0x307c('0x19')](function(_0x45fe2){logger['error'](_0x307c('0x1a'),_0x45fe2[_0x307c('0x17')],_0x2e21a6);_0xbfe2b4(_0x3e05e2[_0x307c('0x16')](0x1f4,_0x45fe2[_0x307c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1293bda..1617ac4 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x18b4a1,_0x4ed3a0){var _0x1432be=function(_0x37516d){while(--_0x37516d){_0x18b4a1['push'](_0x18b4a1['shift']());}};_0x1432be(++_0x4ed3a0);}(_0x757a,0xde));var _0xa757=function(_0x24bd8f,_0x8659c4){_0x24bd8f=_0x24bd8f-0x0;var _0x1b5cd1=_0x757a[_0x24bd8f];return _0x1b5cd1;};'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['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x106b3c,_0xb1b5d7){var _0x37eeb1=function(_0x406d3c){while(--_0x406d3c){_0x106b3c['push'](_0x106b3c['shift']());}};_0x37eeb1(++_0xb1b5d7);}(_0xadb5,0xad));var _0x5adb=function(_0x5a5f75,_0x29ee82){_0x5a5f75=_0x5a5f75-0x0;var _0x41ce5f=_0xadb5[_0x5a5f75];return _0x41ce5f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 8b7e5fd..3613b26 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 _0x873e=['online','admin','user','agent','blocked','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','use','password','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','inspect','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','disabled','blockedAt'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x873e,0xa1));var _0xe873=function(_0x157aef,_0x3e7774){_0x157aef=_0x157aef-0x0;var _0x5b8f6a=_0x873e[_0x157aef];return _0x5b8f6a;};'use strict';var passport=require(_0xe873('0x0'));var LocalStrategy=require(_0xe873('0x1'))[_0xe873('0x2')];var moment=require(_0xe873('0x3'));var ActiveDirectory=require(_0xe873('0x4'));var BPromise=require('bluebird');var util=require(_0xe873('0x5'));var db=require(_0xe873('0x6'))['db'];var authService=require(_0xe873('0x7'));var utils=require(_0xe873('0x8'));var config=require(_0xe873('0x9'));var logger=require(_0xe873('0xa'))(_0xe873('0xb'));function isActiveDirectoryConfigured(_0x512161){var _0x45cda5=![];if(typeof _0x512161[_0xe873('0xc')]!==_0xe873('0xd')){_0x45cda5=_0x512161[_0xe873('0xc')][_0xe873('0xe')]&&_0x512161[_0xe873('0xc')]['url']&&_0x512161['activedirectory'][_0xe873('0xf')];}return _0x45cda5;}function adAuthenticate(_0x5a08b2,_0x500463,_0x3af9c7){return new BPromise(function(_0x34b9cd,_0x2ffdd8){try{var _0x30e0e2=new ActiveDirectory(_0x5a08b2);_0x30e0e2[_0xe873('0x10')](_0x500463,_0x3af9c7,function(_0x1bb607,_0x1be8f4){if(_0x1bb607){logger[_0xe873('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x500463,util[_0xe873('0x12')](_0x1bb607,{'showHidden':![],'depth':null}));_0x2ffdd8(_0xe873('0x13'));}else if(!_0x1be8f4){logger['error'](_0xe873('0x14'),_0x500463);_0x2ffdd8(_0xe873('0x13'));}else{_0x34b9cd(_0x1be8f4);}});}catch(_0x1c25bc){_0x2ffdd8(_0x1c25bc);}});}function ActiveDirectoryAuthenticate(_0x596f8c,_0x37c3fb,_0x2a6c79,_0x31f7d7){var _0xbbcb83,_0x24ef37;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xe873('0x15'),_0x37c3fb);return _0x31f7d7(null,![],{'message':_0xe873('0x13')});}return db['Setting'][_0xe873('0x16')]({'where':{'id':0x1},'attributes':[_0xe873('0x17'),_0xe873('0x18')],'raw':!![]})[_0xe873('0x19')](function(_0x1c4124){_0xbbcb83=_0x1c4124;if(!_0xbbcb83[_0xe873('0x17')]){logger[_0xe873('0x11')](_0xe873('0x1a'),_0x37c3fb);throw new Error(_0xe873('0x13'));}return _0x596f8c[_0xe873('0x16')]({'logging':!![],'attributes':['id',_0xe873('0x1b'),'password',_0xe873('0x1c'),'role',_0xe873('0x1d'),'blocked',_0xe873('0x1e'),_0xe873('0x1f')],'where':{'name':_0x37c3fb,'role':{'$or':[_0xe873('0x20'),_0xe873('0x21'),_0xe873('0x22')]},'adSsoEnabled':!![]}});})[_0xe873('0x19')](function(_0x29e1f7){if(!_0x29e1f7||_0x29e1f7&&_0x29e1f7['name']!==_0x37c3fb){throw new Error(_0xe873('0x13'));}_0x24ef37=_0x29e1f7;var _0x17778f=_0x24ef37[_0xe873('0x1b')]+'@'+config[_0xe873('0xc')][_0xe873('0xf')];return adAuthenticate(config[_0xe873('0xc')],_0x17778f,_0x2a6c79);})[_0xe873('0x19')](function(_0x444bb9){if(_0x24ef37['disabled']){throw new Error(_0xe873('0x13'));}if(_0xbbcb83[_0xe873('0x18')]>0x0){if(_0x24ef37[_0xe873('0x23')]){if(moment(_0x24ef37[_0xe873('0x1e')])['add'](_0xbbcb83[_0xe873('0x18')],'minutes')>moment()){throw new Error(_0xe873('0x13'));}return utils[_0xe873('0x24')](_0x24ef37,0x0,![],null)[_0xe873('0x19')](function(){return utils[_0xe873('0x25')](_0x24ef37);})[_0xe873('0x19')](function(){return _0x31f7d7(null,_0x24ef37);});}else{return utils[_0xe873('0x25')](_0x24ef37)[_0xe873('0x19')](function(){return _0x31f7d7(null,_0x24ef37);});}}else{return utils[_0xe873('0x25')](_0x24ef37)[_0xe873('0x19')](function(){return _0x31f7d7(null,_0x24ef37);});}})['catch'](function(_0x4e704a){return _0x31f7d7(null,![],_0x4e704a);});}function handleError(_0x192e5b,_0x460f57,_0x50c86d){return _0x192e5b[_0xe873('0x26')](_0x460f57||0x1f4)[_0xe873('0x27')]({'message':_0x50c86d?_0x50c86d[_0xe873('0x28')]||_0x50c86d:''});}exports[_0xe873('0x29')]=function(_0x2a1506,_0x569d36,_0x2e6c5c){passport[_0xe873('0x10')](_0xe873('0x2a'),function(_0x27c6e8,_0x56c6f2,_0x7044ff){var _0x40f0f5=_0x27c6e8||_0x7044ff;if(_0x40f0f5){return handleError(_0x569d36,0x191,_0x40f0f5);}if(!_0x56c6f2){return handleError(_0x569d36,0x194,{'message':_0xe873('0x2b')});}else{var _0x436092={'payload':{'id':_0x56c6f2['id'],'role':_0x56c6f2[_0xe873('0x2c')]},'options':{'expiresIn':0x15180}};return authService[_0xe873('0x2d')](_0x436092)['then'](function(_0x595ba7){_0x569d36['json']({'id':_0x56c6f2['id'],'token':_0x595ba7,'statusCall':'','isAlreadyLogged':_0x56c6f2[_0xe873('0x1f')]});});}})(_0x2a1506,_0x569d36,_0x2e6c5c);};passport[_0xe873('0x2e')](_0xe873('0x2a'),new LocalStrategy({'usernameField':_0xe873('0x1b'),'passwordField':_0xe873('0x2f')},function(_0x57e5bf,_0xe9a24d,_0x370e05){return ActiveDirectoryAuthenticate(db['User'],_0x57e5bf,_0xe9a24d,_0x370e05);})); \ No newline at end of file +var _0x7246=['json','online','use','ad-login','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','admin','agent','then','add','clearBlockUser','getLicense','catch','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x263fe3,_0x216b34){var _0x578222=function(_0x1e48ab){while(--_0x1e48ab){_0x263fe3['push'](_0x263fe3['shift']());}};_0x578222(++_0x216b34);}(_0x7246,0x10a));var _0x6724=function(_0x5b0ae9,_0x5ad060){_0x5b0ae9=_0x5b0ae9-0x0;var _0x336c7f=_0x7246[_0x5b0ae9];return _0x336c7f;};'use strict';var passport=require(_0x6724('0x0'));var LocalStrategy=require(_0x6724('0x1'))[_0x6724('0x2')];var moment=require(_0x6724('0x3'));var ActiveDirectory=require(_0x6724('0x4'));var BPromise=require(_0x6724('0x5'));var util=require(_0x6724('0x6'));var db=require(_0x6724('0x7'))['db'];var authService=require(_0x6724('0x8'));var utils=require(_0x6724('0x9'));var config=require(_0x6724('0xa'));var logger=require(_0x6724('0xb'))(_0x6724('0xc'));function isActiveDirectoryConfigured(_0x50b18f){var _0x1d9319=![];if(typeof _0x50b18f[_0x6724('0xd')]!==_0x6724('0xe')){_0x1d9319=_0x50b18f[_0x6724('0xd')][_0x6724('0xf')]&&_0x50b18f[_0x6724('0xd')]['url']&&_0x50b18f['activedirectory'][_0x6724('0x10')];}return _0x1d9319;}function adAuthenticate(_0x16a229,_0x503ae4,_0x30dbf0){return new BPromise(function(_0x322c81,_0x2fa2ed){try{var _0x219e2c=new ActiveDirectory(_0x16a229);_0x219e2c[_0x6724('0x11')](_0x503ae4,_0x30dbf0,function(_0x417679,_0x586236){if(_0x417679){logger[_0x6724('0x12')](_0x6724('0x13'),_0x503ae4,util[_0x6724('0x14')](_0x417679,{'showHidden':![],'depth':null}));_0x2fa2ed('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x586236){logger['error'](_0x6724('0x15'),_0x503ae4);_0x2fa2ed(_0x6724('0x16'));}else{_0x322c81(_0x586236);}});}catch(_0x10ef06){_0x2fa2ed(_0x10ef06);}});}function ActiveDirectoryAuthenticate(_0x38f8a2,_0x43d283,_0x579503,_0x23179d){var _0x2d88b6,_0x428d28;if(!isActiveDirectoryConfigured(config)){logger[_0x6724('0x12')](_0x6724('0x17'),_0x43d283);return _0x23179d(null,![],{'message':_0x6724('0x16')});}return db[_0x6724('0x18')][_0x6724('0x19')]({'where':{'id':0x1},'attributes':[_0x6724('0x1a'),_0x6724('0x1b')],'raw':!![]})['then'](function(_0x7fc5e1){_0x2d88b6=_0x7fc5e1;if(!_0x2d88b6[_0x6724('0x1a')]){logger[_0x6724('0x12')](_0x6724('0x1c'),_0x43d283);throw new Error(_0x6724('0x16'));}return _0x38f8a2[_0x6724('0x19')]({'logging':!![],'attributes':['id',_0x6724('0x1d'),'password',_0x6724('0x1e'),_0x6724('0x1f'),_0x6724('0x20'),_0x6724('0x21'),_0x6724('0x22'),'online'],'where':{'name':_0x43d283,'role':{'$or':[_0x6724('0x23'),'user',_0x6724('0x24')]},'adSsoEnabled':!![]}});})[_0x6724('0x25')](function(_0x4eacf0){if(!_0x4eacf0||_0x4eacf0&&_0x4eacf0[_0x6724('0x1d')]!==_0x43d283){throw new Error(_0x6724('0x16'));}_0x428d28=_0x4eacf0;var _0x2a4d6c=_0x428d28[_0x6724('0x1d')]+'@'+config['activedirectory'][_0x6724('0x10')];return adAuthenticate(config[_0x6724('0xd')],_0x2a4d6c,_0x579503);})[_0x6724('0x25')](function(_0x554eeb){if(_0x428d28[_0x6724('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x2d88b6['blockDuration']>0x0){if(_0x428d28['blocked']){if(moment(_0x428d28[_0x6724('0x22')])[_0x6724('0x26')](_0x2d88b6[_0x6724('0x1b')],'minutes')>moment()){throw new Error(_0x6724('0x16'));}return utils[_0x6724('0x27')](_0x428d28,0x0,![],null)[_0x6724('0x25')](function(){return utils[_0x6724('0x28')](_0x428d28);})[_0x6724('0x25')](function(){return _0x23179d(null,_0x428d28);});}else{return utils[_0x6724('0x28')](_0x428d28)['then'](function(){return _0x23179d(null,_0x428d28);});}}else{return utils[_0x6724('0x28')](_0x428d28)[_0x6724('0x25')](function(){return _0x23179d(null,_0x428d28);});}})[_0x6724('0x29')](function(_0x44d07f){return _0x23179d(null,![],_0x44d07f);});}function handleError(_0x35a93f,_0x14a102,_0x4e9502){return _0x35a93f['status'](_0x14a102||0x1f4)[_0x6724('0x2a')]({'message':_0x4e9502?_0x4e9502[_0x6724('0x2b')]||_0x4e9502:''});}exports['login']=function(_0x6fd2aa,_0x596295,_0x3fbd8f){passport[_0x6724('0x11')]('ad-login',function(_0x12163a,_0x30357e,_0x572c4a){var _0x51ea72=_0x12163a||_0x572c4a;if(_0x51ea72){return handleError(_0x596295,0x191,_0x51ea72);}if(!_0x30357e){return handleError(_0x596295,0x194,{'message':_0x6724('0x2c')});}else{var _0x32a5b0={'payload':{'id':_0x30357e['id'],'role':_0x30357e[_0x6724('0x1f')]},'options':{'expiresIn':0x15180}};return authService[_0x6724('0x2d')](_0x32a5b0)[_0x6724('0x25')](function(_0x47bbf0){_0x596295[_0x6724('0x2e')]({'id':_0x30357e['id'],'token':_0x47bbf0,'statusCall':'','isAlreadyLogged':_0x30357e[_0x6724('0x2f')]});});}})(_0x6fd2aa,_0x596295,_0x3fbd8f);};passport[_0x6724('0x30')](_0x6724('0x31'),new LocalStrategy({'usernameField':_0x6724('0x1d'),'passwordField':_0x6724('0x32')},function(_0x1ff595,_0x2cd2c5,_0x13f1c4){return ActiveDirectoryAuthenticate(db[_0x6724('0x33')],_0x1ff595,_0x2cd2c5,_0x13f1c4);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 90d9b92..b08cf7f 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 _0x0076=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0076,0x6a));var _0x6007=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0076[_0xfae23b];return _0x200640;};'use strict';var express=require(_0x6007('0x0'));var router=express[_0x6007('0x1')]();var controller=require(_0x6007('0x2'));router[_0x6007('0x3')]('/',controller['login']);module[_0x6007('0x4')]=router; \ No newline at end of file +var _0xa179=['Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xa179,0x16d));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x9a17('0x0')]();var controller=require(_0x9a17('0x1'));router[_0x9a17('0x2')]('/',controller[_0x9a17('0x3')]);module[_0x9a17('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 8709e81..0e61886 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x187f71,_0xf40f00){var _0xdf027a=function(_0x127e87){while(--_0x127e87){_0x187f71['push'](_0x187f71['shift']());}};_0xdf027a(++_0xf40f00);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ 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(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0x18a9bc,_0x2457fc){_0x18a9bc=_0x18a9bc-0x0;var _0x14c6ae=_0x7a54[_0x18a9bc];return _0x14c6ae;};'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 d8107c2..a0ca8a8 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 _0x8ff3=['../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x2f0e79,_0x526f44){var _0x4e2500=function(_0x338759){while(--_0x338759){_0x2f0e79['push'](_0x2f0e79['shift']());}};_0x4e2500(++_0x526f44);}(_0x8ff3,0x1a9));var _0x38ff=function(_0x3b6bab,_0x4dd853){_0x3b6bab=_0x3b6bab-0x0;var _0x3f6478=_0x8ff3[_0x3b6bab];return _0x3f6478;};'use strict';var express=require(_0x38ff('0x0'));var passport=require(_0x38ff('0x1'));var router=express[_0x38ff('0x2')]();var controller=require(_0x38ff('0x3'));var userController=require(_0x38ff('0x4'));var authService=require(_0x38ff('0x5'));router['get']('/',controller[_0x38ff('0x6')]);router[_0x38ff('0x7')](_0x38ff('0x8'),controller[_0x38ff('0x9')],authService[_0x38ff('0xa')],userController[_0x38ff('0x6')],authService[_0x38ff('0xb')]);module[_0x38ff('0xc')]=router; \ No newline at end of file +var _0x7111=['express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','callback','login','setTokenCookie','exports'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x7111,0x19a));var _0x1711=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x7111[_0x209ec9];return _0x129b1b;};'use strict';var express=require(_0x1711('0x0'));var passport=require(_0x1711('0x1'));var router=express['Router']();var controller=require(_0x1711('0x2'));var userController=require(_0x1711('0x3'));var authService=require(_0x1711('0x4'));router[_0x1711('0x5')]('/',controller['login']);router[_0x1711('0x5')]('/callback',controller[_0x1711('0x6')],authService['isMiddleware'],userController[_0x1711('0x7')],authService[_0x1711('0x8')]);module[_0x1711('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e402449..5143285 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 _0x6fa4=['now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','enforcePasswordHistory','previousPasswords','password','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fa4,0x15d));var _0x46fa=function(_0x425d3e,_0x331f7c){_0x425d3e=_0x425d3e-0x0;var _0x2d1bf2=_0x6fa4[_0x425d3e];return _0x2d1bf2;};'use strict';var util=require(_0x46fa('0x0'));var passport=require(_0x46fa('0x1'));var LocalStrategy=require(_0x46fa('0x2'))['Strategy'];var jayson=require(_0x46fa('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x46fa('0x4'));var db=require(_0x46fa('0x5'))['db'];var authService=require(_0x46fa('0x6'));var utils=require(_0x46fa('0x7'));var client=jayson[_0x46fa('0x8')][_0x46fa('0x9')]({'port':0x232b});function localAuthenticate(_0x33da09,_0x4b02e7,_0x256a69,_0x1db1f9){var _0x2bf28c,_0x5a6e54;return db[_0x46fa('0xa')][_0x46fa('0xb')]({'where':{'id':0x1},'attributes':[_0x46fa('0xc'),_0x46fa('0xd')],'raw':!![]})[_0x46fa('0xe')](function(_0x5b6f1d){_0x2bf28c=_0x5b6f1d;return _0x33da09[_0x46fa('0xb')]({'attributes':['id',_0x46fa('0xf'),'password','salt',_0x46fa('0x10'),'disabled',_0x46fa('0x11'),_0x46fa('0x12'),_0x46fa('0x13')],'where':{'name':_0x4b02e7,'role':{'$or':[_0x46fa('0x14'),_0x46fa('0x15'),_0x46fa('0x16')]}}});})[_0x46fa('0xe')](function(_0x37385a){if(!_0x37385a||_0x37385a&&_0x37385a[_0x46fa('0xf')]!==_0x4b02e7){throw new Error(_0x46fa('0x17'));}else{_0x5a6e54=_0x37385a;return _0x5a6e54;}})[_0x46fa('0xe')](function(){_0x5a6e54[_0x46fa('0x18')](_0x256a69,function(_0x3dcfb1,_0x67a1c9){var _0x1f5e78=_0x5a6e54[_0x46fa('0x13')]+0x1;if(_0x3dcfb1){return _0x1db1f9(_0x3dcfb1);}else if(!_0x67a1c9){if(_0x5a6e54['disabled']){return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});}else if(_0x2bf28c[_0x46fa('0xc')]>0x0){if(_0x5a6e54[_0x46fa('0x11')]){if(_0x2bf28c[_0x46fa('0xd')]>0x0){if(moment(_0x5a6e54[_0x46fa('0x12')])[_0x46fa('0x19')](_0x2bf28c[_0x46fa('0xd')],_0x46fa('0x1a'))>moment()){return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});}else{return utils[_0x46fa('0x1b')](_0x5a6e54,_0x1f5e78,![],null)[_0x46fa('0xe')](function(){return _0x1db1f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1db1f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1f5e78>=_0x2bf28c[_0x46fa('0xc')]){return utils[_0x46fa('0x1b')](_0x5a6e54,0x0,!![],moment())[_0x46fa('0xe')](function(){return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});});}else{return utils[_0x46fa('0x1b')](_0x5a6e54,_0x1f5e78,![],null)['then'](function(){return _0x1db1f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});}}else{if(_0x5a6e54[_0x46fa('0x1c')]){return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});}else if(_0x2bf28c[_0x46fa('0xc')]>0x0){if(_0x5a6e54[_0x46fa('0x11')]){if(_0x2bf28c['blockDuration']>0x0){if(moment(_0x5a6e54[_0x46fa('0x12')])[_0x46fa('0x19')](_0x2bf28c[_0x46fa('0xd')],_0x46fa('0x1a'))>moment()){return _0x1db1f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x46fa('0x1b')](_0x5a6e54,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5a6e54);})[_0x46fa('0xe')](function(){return _0x1db1f9(null,_0x5a6e54);});}}else{return _0x1db1f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x46fa('0x1b')](_0x5a6e54,0x0,![],null)['then'](function(){return utils[_0x46fa('0x1d')](_0x5a6e54);})['then'](function(){return _0x1db1f9(null,_0x5a6e54);})[_0x46fa('0x1e')](function(_0x57d4cd){return _0x1db1f9(null,![],_0x57d4cd);});}}else{if(_0x5a6e54[_0x46fa('0x11')]){return _0x1db1f9(null,![],{'message':_0x46fa('0x17')});}else{return utils[_0x46fa('0x1d')](_0x5a6e54)[_0x46fa('0xe')](function(){return _0x1db1f9(null,_0x5a6e54);});}}}});})[_0x46fa('0x1e')](function(_0x419f20){return _0x1db1f9(null,![],_0x419f20);});}function sendServiceMail(_0x4461d8){return db[_0x46fa('0x1f')][_0x46fa('0x20')]({'where':{'service':!![]},'attributes':['id',_0x46fa('0xf'),_0x46fa('0x21')],'include':[{'model':db[_0x46fa('0x22')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x46fa('0x23')}]}]})['then'](function(_0x51bc4f){if(!_0x51bc4f){throw new Error(_0x46fa('0x24'));}var _0x5925ca=_0x51bc4f[_0x46fa('0x25')]();var _0x5680bf={'account':_0x5925ca,'message':_[_0x46fa('0x26')]({'from':util[_0x46fa('0x27')](_0x46fa('0x28'),_0x51bc4f[_0x46fa('0xf')],_0x51bc4f['email']||_0x51bc4f[_0x46fa('0x29')][_0x46fa('0x15')])},_0x4461d8)};return client[_0x46fa('0x2a')](_0x46fa('0x2b'),_0x5680bf);})[_0x46fa('0xe')](function(_0x2ab4d8){if(_0x2ab4d8[_0x46fa('0x2c')]){throw new Error(util[_0x46fa('0x27')](_0x46fa('0x2d'),_0x2ab4d8[_0x46fa('0x2c')][_0x46fa('0x2e')]||JSON[_0x46fa('0x2f')](_0x2ab4d8[_0x46fa('0x2c')])));}return!![];});}function handleError(_0x5d44b2,_0x4f4e95,_0x2811ed){return _0x5d44b2[_0x46fa('0x30')](_0x4f4e95||0x1f4)[_0x46fa('0x31')]({'message':_0x2811ed?_0x2811ed[_0x46fa('0x2e')]||_0x2811ed:''});}exports[_0x46fa('0x32')]=function(_0x32f24b,_0x2986b5,_0x9be203){passport[_0x46fa('0x18')](_0x46fa('0x33'),function(_0x1cd985,_0x39e22a,_0x47c392){var _0x5b4249=_0x1cd985||_0x47c392;if(_0x5b4249){return handleError(_0x2986b5,0x191,_0x5b4249);}if(!_0x39e22a){return handleError(_0x2986b5,0x194,{'message':_0x46fa('0x34')});}else{var _0x3a0d5b={'payload':{'id':_0x39e22a['id'],'role':_0x39e22a[_0x46fa('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x46fa('0x35')](_0x3a0d5b)[_0x46fa('0xe')](function(_0x4c8702){_0x2986b5[_0x46fa('0x36')]({'id':_0x39e22a['id'],'token':_0x4c8702,'statusCall':'','isAlreadyLogged':_0x39e22a[_0x46fa('0x37')]});});}})(_0x32f24b,_0x2986b5,_0x9be203);};exports[_0x46fa('0x38')]=function(_0x492078,_0x4df1b0){if(!_0x492078[_0x46fa('0x39')][_0x46fa('0x21')]){return handleError(_0x4df1b0,0x1f4,{'message':_0x46fa('0x3a')});}var _0x148f19=rs[_0x46fa('0x3b')]();_0x492078[_0x46fa('0x39')][_0x46fa('0x21')]=_0x492078[_0x46fa('0x39')][_0x46fa('0x21')][_0x46fa('0x3c')]()[_0x46fa('0x3d')]();var _0x4e7f3e;return db['Setting'][_0x46fa('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x46fa('0xd')],'raw':!![]})[_0x46fa('0xe')](function(_0xee912d){_0x4e7f3e=_0xee912d;return db[_0x46fa('0x3e')][_0x46fa('0x20')]({'where':{'email':_0x492078[_0x46fa('0x39')][_0x46fa('0x21')]}});})['then'](function(_0x12ecb7){if(!_0x12ecb7){throw new Error(_0x46fa('0x3f'));}if(_0x12ecb7['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x12ecb7[_0x46fa('0x11')]){if(moment(_0x12ecb7['blockedAt'])['add'](_0x4e7f3e[_0x46fa('0xd')],'minutes')>moment()){throw new Error(_0x46fa('0x40'));}else{_0x12ecb7[_0x46fa('0x11')]=![];_0x12ecb7[_0x46fa('0x12')]=null;}}_0x12ecb7[_0x46fa('0x41')]=_0x148f19;_0x12ecb7['resetPasswordExpires']=Date[_0x46fa('0x42')]()+0x36ee80;return _0x12ecb7['save']();})['then'](function(){return sendServiceMail({'to':_0x492078[_0x46fa('0x39')][_0x46fa('0x21')],'subject':_0x46fa('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x46fa('0x44')+_0x46fa('0x45')+_0x492078[_0x46fa('0x46')][_0x46fa('0x47')]+_0x46fa('0x48')+_0x148f19+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x46fa('0xe')](function(){_0x4df1b0[_0x46fa('0x30')](0xc8)[_0x46fa('0x31')]({'message':_0x46fa('0x49')});})[_0x46fa('0x1e')](function(_0x54fea7){return handleError(_0x4df1b0,0x1f4,_0x54fea7);});};exports[_0x46fa('0x4a')]=function(_0x1aecaf,_0x3f45eb){return db['User'][_0x46fa('0x20')]({'where':{'resetPasswordToken':_0x1aecaf[_0x46fa('0x4b')][_0x46fa('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x46fa('0x42')]()}}})[_0x46fa('0xe')](function(_0x1ef88d){if(!_0x1ef88d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x46fa('0xa')]['findOne']({'attributes':['id','securePassword',_0x46fa('0x4d'),'passwordHistoryLimit']})['then'](function(_0x1607e1){if(_0x1607e1['securePassword'])authService['validatePasswordPattern'](_0x1aecaf['body']['password']);if(!_0x1607e1[_0x46fa('0x4d')]||!_0x1ef88d[_0x46fa('0x4e')])return _0x1ef88d;authService['validatePasswordHistory'](_0x1aecaf[_0x46fa('0x39')][_0x46fa('0x4f')],_0x1ef88d[_0x46fa('0x4e')],_0x1607e1['passwordHistoryLimit']);return _0x1ef88d;})[_0x46fa('0xe')](function(){_0x1ef88d[_0x46fa('0x4f')]=_0x1aecaf[_0x46fa('0x39')][_0x46fa('0x4f')];_0x1ef88d[_0x46fa('0x41')]=null;_0x1ef88d[_0x46fa('0x50')]=null;return _0x1ef88d['save']();});})['then'](function(){_0x3f45eb[_0x46fa('0x30')](0xc8)['send']({'message':_0x46fa('0x51')});})[_0x46fa('0x1e')](function(_0x474711){return handleError(_0x3f45eb,0x1f4,_0x474711);});};passport[_0x46fa('0x52')](_0x46fa('0x33'),new LocalStrategy({'usernameField':'name','passwordField':_0x46fa('0x4f')},function(_0xcd2035,_0x5d34f0,_0x23c412){return localAuthenticate(db[_0x46fa('0x3e')],_0xcd2035,_0x5d34f0,_0x23c412);})); \ No newline at end of file +var _0x351c=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','save','Password\x20reset!','use','local-login','util','passport','passport-local','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','admin','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','blocked','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','merge','format','\x22%s\x22\x20<%s>','user','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x22cf12,_0x2807f7){var _0x2e47e2=function(_0x41ad94){while(--_0x41ad94){_0x22cf12['push'](_0x22cf12['shift']());}};_0x2e47e2(++_0x2807f7);}(_0x351c,0xff));var _0xc351=function(_0x4625c1,_0x186658){_0x4625c1=_0x4625c1-0x0;var _0x57635c=_0x351c[_0x4625c1];return _0x57635c;};'use strict';var util=require(_0xc351('0x0'));var passport=require(_0xc351('0x1'));var LocalStrategy=require(_0xc351('0x2'))['Strategy'];var jayson=require(_0xc351('0x3'));var _=require(_0xc351('0x4'));var rs=require(_0xc351('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xc351('0x6'));var utils=require(_0xc351('0x7'));var client=jayson[_0xc351('0x8')][_0xc351('0x9')]({'port':0x232b});function localAuthenticate(_0x57f226,_0x250f72,_0x5e148e,_0x244cf2){var _0x21a1e4,_0x5c78d0;return db[_0xc351('0xa')][_0xc351('0xb')]({'where':{'id':0x1},'attributes':[_0xc351('0xc'),_0xc351('0xd')],'raw':!![]})['then'](function(_0x3ca29e){_0x21a1e4=_0x3ca29e;return _0x57f226['findOne']({'attributes':['id','name',_0xc351('0xe'),_0xc351('0xf'),_0xc351('0x10'),_0xc351('0x11'),'blocked',_0xc351('0x12'),'loginAttempts'],'where':{'name':_0x250f72,'role':{'$or':[_0xc351('0x13'),'user',_0xc351('0x14')]}}});})[_0xc351('0x15')](function(_0x36ffeb){if(!_0x36ffeb||_0x36ffeb&&_0x36ffeb[_0xc351('0x16')]!==_0x250f72){throw new Error(_0xc351('0x17'));}else{_0x5c78d0=_0x36ffeb;return _0x5c78d0;}})['then'](function(){_0x5c78d0[_0xc351('0x18')](_0x5e148e,function(_0x4ec80b,_0x40c441){var _0x2a4e9e=_0x5c78d0[_0xc351('0x19')]+0x1;if(_0x4ec80b){return _0x244cf2(_0x4ec80b);}else if(!_0x40c441){if(_0x5c78d0[_0xc351('0x11')]){return _0x244cf2(null,![],{'message':_0xc351('0x17')});}else if(_0x21a1e4[_0xc351('0xc')]>0x0){if(_0x5c78d0['blocked']){if(_0x21a1e4['blockDuration']>0x0){if(moment(_0x5c78d0[_0xc351('0x12')])[_0xc351('0x1a')](_0x21a1e4[_0xc351('0xd')],_0xc351('0x1b'))>moment()){return _0x244cf2(null,![],{'message':_0xc351('0x17')});}else{return utils['clearBlockUser'](_0x5c78d0,_0x2a4e9e,![],null)[_0xc351('0x15')](function(){return _0x244cf2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x244cf2(null,![],{'message':_0xc351('0x17')});}}else{if(_0x2a4e9e>=_0x21a1e4['allowedLoginAttempts']){return utils[_0xc351('0x1c')](_0x5c78d0,0x0,!![],moment())[_0xc351('0x15')](function(){return _0x244cf2(null,![],{'message':_0xc351('0x17')});});}else{return utils[_0xc351('0x1c')](_0x5c78d0,_0x2a4e9e,![],null)['then'](function(){return _0x244cf2(null,![],{'message':_0xc351('0x17')});});}}}else{return _0x244cf2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5c78d0[_0xc351('0x11')]){return _0x244cf2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x21a1e4[_0xc351('0xc')]>0x0){if(_0x5c78d0[_0xc351('0x1d')]){if(_0x21a1e4[_0xc351('0xd')]>0x0){if(moment(_0x5c78d0['blockedAt'])[_0xc351('0x1a')](_0x21a1e4['blockDuration'],'minutes')>moment()){return _0x244cf2(null,![],{'message':_0xc351('0x17')});}else{return utils[_0xc351('0x1c')](_0x5c78d0,0x0,![],null)['then'](function(){return utils[_0xc351('0x1e')](_0x5c78d0);})['then'](function(){return _0x244cf2(null,_0x5c78d0);});}}else{return _0x244cf2(null,![],{'message':_0xc351('0x17')});}}else{return utils[_0xc351('0x1c')](_0x5c78d0,0x0,![],null)[_0xc351('0x15')](function(){return utils[_0xc351('0x1e')](_0x5c78d0);})[_0xc351('0x15')](function(){return _0x244cf2(null,_0x5c78d0);})['catch'](function(_0x8e2e2c){return _0x244cf2(null,![],_0x8e2e2c);});}}else{if(_0x5c78d0['blocked']){return _0x244cf2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x5c78d0)['then'](function(){return _0x244cf2(null,_0x5c78d0);});}}}});})[_0xc351('0x1f')](function(_0xfd9a15){return _0x244cf2(null,![],_0xfd9a15);});}function sendServiceMail(_0x2846d2){return db['MailAccount'][_0xc351('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc351('0x16'),_0xc351('0x21')],'include':[{'model':db[_0xc351('0x22')],'as':_0xc351('0x23'),'include':[{'model':db[_0xc351('0x24')],'as':_0xc351('0x24')}]}]})[_0xc351('0x15')](function(_0x519abb){if(!_0x519abb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5c4dd5=_0x519abb['getSmtpOptions']();var _0x437bb6={'account':_0x5c4dd5,'message':_[_0xc351('0x25')]({'from':util[_0xc351('0x26')](_0xc351('0x27'),_0x519abb[_0xc351('0x16')],_0x519abb[_0xc351('0x21')]||_0x519abb['Smtp'][_0xc351('0x28')])},_0x2846d2)};return client['request']('SendMail',_0x437bb6);})[_0xc351('0x15')](function(_0x3303d7){if(_0x3303d7[_0xc351('0x29')]){throw new Error(util[_0xc351('0x26')](_0xc351('0x2a'),_0x3303d7[_0xc351('0x29')][_0xc351('0x2b')]||JSON[_0xc351('0x2c')](_0x3303d7[_0xc351('0x29')])));}return!![];});}function handleError(_0x12b683,_0xc3596b,_0x5c58a5){return _0x12b683[_0xc351('0x2d')](_0xc3596b||0x1f4)[_0xc351('0x2e')]({'message':_0x5c58a5?_0x5c58a5[_0xc351('0x2b')]||_0x5c58a5:''});}exports[_0xc351('0x2f')]=function(_0x5a3bc9,_0x50a70a,_0x396c32){passport[_0xc351('0x18')]('local-login',function(_0x3b6ab1,_0x6165b6,_0x4eb174){var _0x3e0b4a=_0x3b6ab1||_0x4eb174;if(_0x3e0b4a){return handleError(_0x50a70a,0x191,_0x3e0b4a);}if(!_0x6165b6){return handleError(_0x50a70a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x531b17={'payload':{'id':_0x6165b6['id'],'role':_0x6165b6[_0xc351('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x531b17)[_0xc351('0x15')](function(_0xaea516){_0x50a70a[_0xc351('0x30')]({'id':_0x6165b6['id'],'token':_0xaea516,'statusCall':'','isAlreadyLogged':_0x6165b6[_0xc351('0x31')]});});}})(_0x5a3bc9,_0x50a70a,_0x396c32);};exports[_0xc351('0x32')]=function(_0x802d8,_0x3fbf0c){if(!_0x802d8[_0xc351('0x33')]['email']){return handleError(_0x3fbf0c,0x1f4,{'message':_0xc351('0x34')});}var _0x375718=rs[_0xc351('0x35')]();_0x802d8[_0xc351('0x33')][_0xc351('0x21')]=_0x802d8['body'][_0xc351('0x21')]['trim']()[_0xc351('0x36')]();var _0x417c3d;return db[_0xc351('0xa')][_0xc351('0xb')]({'where':{'id':0x1},'attributes':[_0xc351('0xc'),_0xc351('0xd')],'raw':!![]})[_0xc351('0x15')](function(_0x2f0f22){_0x417c3d=_0x2f0f22;return db[_0xc351('0x37')]['find']({'where':{'email':_0x802d8['body'][_0xc351('0x21')]}});})[_0xc351('0x15')](function(_0x433946){if(!_0x433946){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x433946['disabled']){throw new Error(_0xc351('0x38'));}if(_0x433946['blocked']){if(moment(_0x433946['blockedAt'])[_0xc351('0x1a')](_0x417c3d[_0xc351('0xd')],_0xc351('0x1b'))>moment()){throw new Error(_0xc351('0x39'));}else{_0x433946['blocked']=![];_0x433946[_0xc351('0x12')]=null;}}_0x433946[_0xc351('0x3a')]=_0x375718;_0x433946[_0xc351('0x3b')]=Date['now']()+0x36ee80;return _0x433946['save']();})[_0xc351('0x15')](function(){return sendServiceMail({'to':_0x802d8[_0xc351('0x33')][_0xc351('0x21')],'subject':_0xc351('0x3c'),'text':_0xc351('0x3d')+_0xc351('0x3e')+'https://'+_0x802d8['headers'][_0xc351('0x3f')]+'/reset/'+_0x375718+'\x0a\x0a'+_0xc351('0x40')});})['then'](function(){_0x3fbf0c[_0xc351('0x2d')](0xc8)[_0xc351('0x2e')]({'message':_0xc351('0x41')});})[_0xc351('0x1f')](function(_0x52064d){return handleError(_0x3fbf0c,0x1f4,_0x52064d);});};exports['reset']=function(_0x4465cc,_0x7a77d1){return db['User'][_0xc351('0x20')]({'where':{'resetPasswordToken':_0x4465cc[_0xc351('0x42')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc351('0x43')]()}}})[_0xc351('0x15')](function(_0x276538){if(!_0x276538){throw new Error(_0xc351('0x44'));}return db[_0xc351('0xa')][_0xc351('0xb')]({'attributes':['id',_0xc351('0x45'),_0xc351('0x46'),_0xc351('0x47')]})['then'](function(_0x431235){if(_0x431235['securePassword'])authService[_0xc351('0x48')](_0x4465cc['body'][_0xc351('0xe')]);if(!_0x431235[_0xc351('0x46')]||!_0x276538[_0xc351('0x49')])return _0x276538;authService['validatePasswordHistory'](_0x4465cc[_0xc351('0x33')][_0xc351('0xe')],_0x276538[_0xc351('0x49')],_0x431235[_0xc351('0x47')]);return _0x276538;})[_0xc351('0x15')](function(){_0x276538[_0xc351('0xe')]=_0x4465cc[_0xc351('0x33')]['password'];_0x276538[_0xc351('0x3a')]=null;_0x276538[_0xc351('0x3b')]=null;return _0x276538[_0xc351('0x4a')]();});})['then'](function(){_0x7a77d1[_0xc351('0x2d')](0xc8)[_0xc351('0x2e')]({'message':_0xc351('0x4b')});})[_0xc351('0x1f')](function(_0x226252){return handleError(_0x7a77d1,0x1f4,_0x226252);});};passport[_0xc351('0x4c')](_0xc351('0x4d'),new LocalStrategy({'usernameField':_0xc351('0x16'),'passwordField':_0xc351('0xe')},function(_0x4aeaf5,_0x46bbb8,_0x2b6419){return localAuthenticate(db[_0xc351('0x37')],_0x4aeaf5,_0x46bbb8,_0x2b6419);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b12df39..3c3bd48 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 _0x1cd7=['exports','./authLocal.controller','login','/forgot','forgot','post','/reset/:token','reset'];(function(_0x2d9144,_0x29691a){var _0x190bb8=function(_0x2b80ae){while(--_0x2b80ae){_0x2d9144['push'](_0x2d9144['shift']());}};_0x190bb8(++_0x29691a);}(_0x1cd7,0xb1));var _0x71cd=function(_0x190a54,_0x2d61d0){_0x190a54=_0x190a54-0x0;var _0x91adb0=_0x1cd7[_0x190a54];return _0x91adb0;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x71cd('0x0'));router['post']('/',controller[_0x71cd('0x1')]);router['post'](_0x71cd('0x2'),controller[_0x71cd('0x3')]);router[_0x71cd('0x4')](_0x71cd('0x5'),controller[_0x71cd('0x6')]);module[_0x71cd('0x7')]=router; \ No newline at end of file +var _0xe82b=['login','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','post'];(function(_0x1737a0,_0x11fb16){var _0x48d830=function(_0x5dc5a0){while(--_0x5dc5a0){_0x1737a0['push'](_0x1737a0['shift']());}};_0x48d830(++_0x11fb16);}(_0xe82b,0x125));var _0xbe82=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xe82b[_0x30ae5e];return _0x1f2e93;};'use strict';var express=require(_0xbe82('0x0'));var router=express[_0xbe82('0x1')]();var controller=require(_0xbe82('0x2'));router[_0xbe82('0x3')]('/',controller[_0xbe82('0x4')]);router[_0xbe82('0x3')](_0xbe82('0x5'),controller[_0xbe82('0x6')]);router[_0xbe82('0x3')](_0xbe82('0x7'),controller[_0xbe82('0x8')]);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 5ddfb9d..01772d8 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 _0x262e=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x454762,_0x480d8c){var _0x3c05c5=function(_0x4bc53e){while(--_0x4bc53e){_0x454762['push'](_0x454762['shift']());}};_0x3c05c5(++_0x480d8c);}(_0x262e,0x156));var _0xe262=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x262e[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0xe262('0x0'));module[_0xe262('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xe262('0x2')]},'description':{'type':Sequelize[_0xe262('0x2')]},'status':{'type':Sequelize[_0xe262('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe262('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xd0df=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0xd0df,0x1df));var _0xfd0d=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xd0df[_0x43f881];return _0x365c14;};'use strict';var Sequelize=require(_0xfd0d('0x0'));module[_0xfd0d('0x1')]={'name':{'type':Sequelize[_0xfd0d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xfd0d('0x2')]},'description':{'type':Sequelize[_0xfd0d('0x2')]},'status':{'type':Sequelize[_0xfd0d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xfd0d('0x4')],'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 889d217..cf031c3 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 _0xb06c=['findOne','getConditions','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','show','rawAttributes','includeAll','include','options','find','create','body','params','destroy','Condition','addConditions','ids','omit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb06c,0x1f3));var _0xcb06=function(_0x35d17f,_0x9b51ae){_0x35d17f=_0x35d17f-0x0;var _0x1b20b2=_0xb06c[_0x35d17f];return _0x1b20b2;};'use strict';var emlformat=require(_0xcb06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb06('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb06('0x2'));var BPromise=require(_0xcb06('0x3'));var Mustache=require(_0xcb06('0x4'));var util=require(_0xcb06('0x5'));var path=require(_0xcb06('0x6'));var sox=require(_0xcb06('0x7'));var csv=require('to-csv');var ejs=require(_0xcb06('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb06('0x9'));var squel=require('squel');var crypto=require(_0xcb06('0xa'));var jsforce=require(_0xcb06('0xb'));var deskjs=require(_0xcb06('0xc'));var toCsv=require(_0xcb06('0xd'));var querystring=require(_0xcb06('0xe'));var Papa=require(_0xcb06('0xf'));var Redis=require(_0xcb06('0x10'));var authService=require(_0xcb06('0x11'));var qs=require(_0xcb06('0x12'));var as=require(_0xcb06('0x13'));var hardwareService=require(_0xcb06('0x14'));var logger=require(_0xcb06('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcb06('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35c4ea,_0x3fac23){_0x3fac23=_0x3fac23||0xcc;return function(_0x20868f){if(_0x20868f){return _0x35c4ea['sendStatus'](_0x3fac23);}return _0x35c4ea[_0xcb06('0x17')](_0x3fac23)['end']();};}function respondWithResult(_0x212d81,_0x13b379){_0x13b379=_0x13b379||0xc8;return function(_0x2e47ce){if(_0x2e47ce){return _0x212d81[_0xcb06('0x17')](_0x13b379)[_0xcb06('0x18')](_0x2e47ce);}};}function respondWithFilteredResult(_0x2ae667,_0x46fbe1){return function(_0xb58947){if(_0xb58947){var _0x3676ce=typeof _0x46fbe1[_0xcb06('0x19')]==='undefined'&&typeof _0x46fbe1['limit']===_0xcb06('0x1a');var _0x229d9a=_0xb58947['count'];var _0x51fce6=_0x3676ce?0x0:_0x46fbe1[_0xcb06('0x19')];var _0x5ddb3d=_0x3676ce?_0xb58947[_0xcb06('0x1b')]:_0x46fbe1[_0xcb06('0x19')]+_0x46fbe1[_0xcb06('0x1c')];var _0x28f50d;if(_0x5ddb3d>=_0x229d9a){_0x5ddb3d=_0x229d9a;_0x28f50d=0xc8;}else{_0x28f50d=0xce;}_0x2ae667[_0xcb06('0x17')](_0x28f50d);return _0x2ae667[_0xcb06('0x1d')]('Content-Range',_0x51fce6+'-'+_0x5ddb3d+'/'+_0x229d9a)[_0xcb06('0x18')](_0xb58947);}return null;};}function patchUpdates(_0x72cebc){return function(_0x1f0862){try{jsonpatch[_0xcb06('0x1e')](_0x1f0862,_0x72cebc,!![]);}catch(_0x3df251){return BPromise[_0xcb06('0x1f')](_0x3df251);}return _0x1f0862[_0xcb06('0x20')]();};}function saveUpdates(_0x1f2dd3,_0x496c6f){return function(_0x441d78){if(_0x441d78){return _0x441d78[_0xcb06('0x21')](_0x1f2dd3)[_0xcb06('0x22')](function(_0x2b8521){return _0x2b8521;});}return null;};}function removeEntity(_0x46373e,_0x30ff21){return function(_0x4b7471){if(_0x4b7471){return _0x4b7471['destroy']()[_0xcb06('0x22')](function(){_0x46373e[_0xcb06('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc387,_0x1b43fa){return function(_0x44550b){if(!_0x44550b){_0x4fc387['sendStatus'](0x194);}return _0x44550b;};}function handleError(_0x33a723,_0x4ea798){_0x4ea798=_0x4ea798||0x1f4;return function(_0x20ef7d){logger['error'](_0x20ef7d[_0xcb06('0x23')]);if(_0x20ef7d[_0xcb06('0x24')]){delete _0x20ef7d[_0xcb06('0x24')];}_0x33a723[_0xcb06('0x17')](_0x4ea798)['send'](_0x20ef7d);};}exports[_0xcb06('0x25')]=function(_0xffe81c,_0x2a078d){var _0x2a4447={},_0x2a51d4={},_0x9f0fff={'count':0x0,'rows':[]};var _0x326e00=_[_0xcb06('0x26')](db[_0xcb06('0x27')]['rawAttributes'],function(_0x820d4){return{'name':_0x820d4[_0xcb06('0x28')],'type':_0x820d4[_0xcb06('0x29')][_0xcb06('0x2a')]};});_0x2a51d4[_0xcb06('0x2b')]=_[_0xcb06('0x26')](_0x326e00,_0xcb06('0x24'));_0x2a51d4[_0xcb06('0x2c')]=_[_0xcb06('0x2d')](_0xffe81c['query']);_0x2a51d4[_0xcb06('0x2e')]=_[_0xcb06('0x2f')](_0x2a51d4['model'],_0x2a51d4[_0xcb06('0x2c')]);_0x2a4447[_0xcb06('0x30')]=_[_0xcb06('0x2f')](_0x2a51d4[_0xcb06('0x2b')],qs[_0xcb06('0x31')](_0xffe81c['query'][_0xcb06('0x31')]));_0x2a4447[_0xcb06('0x30')]=_0x2a4447[_0xcb06('0x30')][_0xcb06('0x32')]?_0x2a4447[_0xcb06('0x30')]:_0x2a51d4[_0xcb06('0x2b')];if(!_0xffe81c[_0xcb06('0x2c')]['hasOwnProperty']('nolimit')){_0x2a4447[_0xcb06('0x1c')]=qs[_0xcb06('0x1c')](_0xffe81c['query']['limit']);_0x2a4447['offset']=qs[_0xcb06('0x19')](_0xffe81c[_0xcb06('0x2c')][_0xcb06('0x19')]);}_0x2a4447[_0xcb06('0x33')]=qs[_0xcb06('0x34')](_0xffe81c['query'][_0xcb06('0x34')]);_0x2a4447['where']=qs[_0xcb06('0x2e')](_[_0xcb06('0x35')](_0xffe81c[_0xcb06('0x2c')],_0x2a51d4[_0xcb06('0x2e')]),_0x326e00);if(_0xffe81c[_0xcb06('0x2c')][_0xcb06('0x36')]){_0x2a4447[_0xcb06('0x37')]=_[_0xcb06('0x38')](_0x2a4447['where'],{'$or':_[_0xcb06('0x26')](_0x326e00,function(_0x4ff4b1){if(_0x4ff4b1[_0xcb06('0x29')]!==_0xcb06('0x39')){var _0x56c6cd={};_0x56c6cd[_0x4ff4b1['name']]={'$like':'%'+_0xffe81c[_0xcb06('0x2c')]['filter']+'%'};return _0x56c6cd;}})});}_0x2a4447=_[_0xcb06('0x38')]({},_0x2a4447,_0xffe81c['options']);var _0x3f914f={'where':_0x2a4447[_0xcb06('0x37')]};return db[_0xcb06('0x27')][_0xcb06('0x1b')](_0x3f914f)[_0xcb06('0x22')](function(_0x44ddc4){_0x9f0fff[_0xcb06('0x1b')]=_0x44ddc4;if(_0xffe81c[_0xcb06('0x2c')]['includeAll']){_0x2a4447['include']=[{'all':!![]}];}return db[_0xcb06('0x27')][_0xcb06('0x3a')](_0x2a4447);})[_0xcb06('0x22')](function(_0x11d594){_0x9f0fff[_0xcb06('0x3b')]=_0x11d594;return _0x9f0fff;})[_0xcb06('0x22')](respondWithFilteredResult(_0x2a078d,_0x2a4447))[_0xcb06('0x3c')](handleError(_0x2a078d,null));};exports[_0xcb06('0x3d')]=function(_0x4c0bd8,_0x3a1e0f){var _0x3fdce0={'raw':![],'where':{'id':_0x4c0bd8['params']['id']}},_0x3b812d={};_0x3b812d['model']=_[_0xcb06('0x2d')](db[_0xcb06('0x27')][_0xcb06('0x3e')]);_0x3b812d[_0xcb06('0x2c')]=_[_0xcb06('0x2d')](_0x4c0bd8[_0xcb06('0x2c')]);_0x3b812d[_0xcb06('0x2e')]=_[_0xcb06('0x2f')](_0x3b812d[_0xcb06('0x2b')],_0x3b812d[_0xcb06('0x2c')]);_0x3fdce0[_0xcb06('0x30')]=_['intersection'](_0x3b812d[_0xcb06('0x2b')],qs[_0xcb06('0x31')](_0x4c0bd8[_0xcb06('0x2c')][_0xcb06('0x31')]));_0x3fdce0['attributes']=_0x3fdce0[_0xcb06('0x30')]['length']?_0x3fdce0[_0xcb06('0x30')]:_0x3b812d['model'];if(_0x4c0bd8[_0xcb06('0x2c')][_0xcb06('0x3f')]){_0x3fdce0[_0xcb06('0x40')]=[{'all':!![]}];}_0x3fdce0=_[_0xcb06('0x38')]({},_0x3fdce0,_0x4c0bd8[_0xcb06('0x41')]);return db['Automation'][_0xcb06('0x42')](_0x3fdce0)[_0xcb06('0x22')](handleEntityNotFound(_0x3a1e0f,null))[_0xcb06('0x22')](respondWithResult(_0x3a1e0f,null))[_0xcb06('0x3c')](handleError(_0x3a1e0f,null));};exports[_0xcb06('0x43')]=function(_0x26094e,_0x1581da){return db[_0xcb06('0x27')][_0xcb06('0x43')](_0x26094e[_0xcb06('0x44')],{})[_0xcb06('0x22')](respondWithResult(_0x1581da,0xc9))['catch'](handleError(_0x1581da,null));};exports[_0xcb06('0x21')]=function(_0xb5578c,_0x57736d){if(_0xb5578c['body']['id']){delete _0xb5578c[_0xcb06('0x44')]['id'];}return db[_0xcb06('0x27')][_0xcb06('0x42')]({'where':{'id':_0xb5578c[_0xcb06('0x45')]['id']}})[_0xcb06('0x22')](handleEntityNotFound(_0x57736d,null))[_0xcb06('0x22')](saveUpdates(_0xb5578c['body'],null))[_0xcb06('0x22')](respondWithResult(_0x57736d,null))[_0xcb06('0x3c')](handleError(_0x57736d,null));};exports[_0xcb06('0x46')]=function(_0x3930de,_0x418469){return db['Automation'][_0xcb06('0x42')]({'where':{'id':_0x3930de[_0xcb06('0x45')]['id']}})[_0xcb06('0x22')](handleEntityNotFound(_0x418469,null))[_0xcb06('0x22')](removeEntity(_0x418469,null))['catch'](handleError(_0x418469,null));};exports['addConditions']=function(_0x36e4f1,_0x537bea,_0x388d93){return db[_0xcb06('0x47')][_0xcb06('0x42')]({'where':{'id':_0x36e4f1[_0xcb06('0x45')]['id']}})['then'](handleEntityNotFound(_0x537bea,null))[_0xcb06('0x22')](function(_0x695593){if(_0x695593){return _0x695593[_0xcb06('0x48')](_0x36e4f1[_0xcb06('0x44')][_0xcb06('0x49')],_[_0xcb06('0x4a')](_0x36e4f1[_0xcb06('0x44')],[_0xcb06('0x49'),'id'])||{});}})[_0xcb06('0x22')](respondWithResult(_0x537bea,null))['catch'](handleError(_0x537bea,null));};exports['getConditions']=function(_0x2aa377,_0x3f628c,_0x2f0aaa){var _0x2afcc0={};var _0x73e0a4={};var _0x42bf01;var _0x15b869;return db[_0xcb06('0x27')][_0xcb06('0x4b')]({'where':{'id':_0x2aa377[_0xcb06('0x45')]['id']}})[_0xcb06('0x22')](handleEntityNotFound(_0x3f628c,null))[_0xcb06('0x22')](function(_0x22e5a8){if(_0x22e5a8){_0x42bf01=_0x22e5a8;_0x73e0a4[_0xcb06('0x2b')]=_[_0xcb06('0x2d')](db[_0xcb06('0x47')][_0xcb06('0x3e')]);_0x73e0a4['query']=_['keys'](_0x2aa377['query']);_0x73e0a4['filters']=_[_0xcb06('0x2f')](_0x73e0a4[_0xcb06('0x2b')],_0x73e0a4['query']);_0x2afcc0[_0xcb06('0x30')]=_['intersection'](_0x73e0a4['model'],qs['fields'](_0x2aa377[_0xcb06('0x2c')][_0xcb06('0x31')]));_0x2afcc0[_0xcb06('0x30')]=_0x2afcc0[_0xcb06('0x30')]['length']?_0x2afcc0['attributes']:_0x73e0a4['model'];_0x2afcc0[_0xcb06('0x33')]=qs[_0xcb06('0x34')](_0x2aa377[_0xcb06('0x2c')][_0xcb06('0x34')]);_0x2afcc0[_0xcb06('0x37')]=qs[_0xcb06('0x2e')](_['pick'](_0x2aa377['query'],_0x73e0a4[_0xcb06('0x2e')]));if(_0x2aa377[_0xcb06('0x2c')][_0xcb06('0x36')]){_0x2afcc0[_0xcb06('0x37')]=_[_0xcb06('0x38')](_0x2afcc0[_0xcb06('0x37')],{'$or':_[_0xcb06('0x26')](_0x2afcc0['attributes'],function(_0x2e9121){var _0x1256de={};_0x1256de[_0x2e9121]={'$like':'%'+_0x2aa377[_0xcb06('0x2c')][_0xcb06('0x36')]+'%'};return _0x1256de;})});}_0x2afcc0=_['merge']({},_0x2afcc0,_0x2aa377[_0xcb06('0x41')]);return _0x42bf01[_0xcb06('0x4c')](_0x2afcc0);}})[_0xcb06('0x22')](function(_0x2b0c22){if(_0x2b0c22){_0x15b869=_0x2b0c22[_0xcb06('0x32')];if(!_0x2aa377[_0xcb06('0x2c')][_0xcb06('0x4d')](_0xcb06('0x4e'))){_0x2afcc0[_0xcb06('0x1c')]=qs['limit'](_0x2aa377[_0xcb06('0x2c')]['limit']);_0x2afcc0[_0xcb06('0x19')]=qs['offset'](_0x2aa377['query'][_0xcb06('0x19')]);}return _0x42bf01[_0xcb06('0x4c')](_0x2afcc0);}})[_0xcb06('0x22')](function(_0x152823){if(_0x152823){return _0x152823?{'count':_0x15b869,'rows':_0x152823}:null;}})[_0xcb06('0x22')](respondWithResult(_0x3f628c,null))[_0xcb06('0x3c')](handleError(_0x3f628c,null));};exports[_0xcb06('0x4f')]=function(_0x43bf9c,_0x4a6cae,_0x93f8d6){return db['Action'][_0xcb06('0x42')]({'where':{'id':_0x43bf9c[_0xcb06('0x45')]['id']}})[_0xcb06('0x22')](handleEntityNotFound(_0x4a6cae,null))['then'](function(_0xa35df8){if(_0xa35df8){return _0xa35df8[_0xcb06('0x4f')](_0x43bf9c[_0xcb06('0x44')][_0xcb06('0x49')],_[_0xcb06('0x4a')](_0x43bf9c['body'],['ids','id'])||{});}})[_0xcb06('0x22')](respondWithResult(_0x4a6cae,null))[_0xcb06('0x3c')](handleError(_0x4a6cae,null));};exports['getActions']=function(_0x426efc,_0x5ec4eb,_0x507013){var _0x4ac03c={};var _0x3ecd16={};var _0x3cbd62;var _0x57f46c;return db[_0xcb06('0x27')]['findOne']({'where':{'id':_0x426efc[_0xcb06('0x45')]['id']}})[_0xcb06('0x22')](handleEntityNotFound(_0x5ec4eb,null))[_0xcb06('0x22')](function(_0x1ab9ed){if(_0x1ab9ed){_0x3cbd62=_0x1ab9ed;_0x3ecd16[_0xcb06('0x2b')]=_[_0xcb06('0x2d')](db[_0xcb06('0x50')][_0xcb06('0x3e')]);_0x3ecd16[_0xcb06('0x2c')]=_['keys'](_0x426efc[_0xcb06('0x2c')]);_0x3ecd16[_0xcb06('0x2e')]=_[_0xcb06('0x2f')](_0x3ecd16[_0xcb06('0x2b')],_0x3ecd16[_0xcb06('0x2c')]);_0x4ac03c[_0xcb06('0x30')]=_['intersection'](_0x3ecd16[_0xcb06('0x2b')],qs[_0xcb06('0x31')](_0x426efc[_0xcb06('0x2c')][_0xcb06('0x31')]));_0x4ac03c[_0xcb06('0x30')]=_0x4ac03c[_0xcb06('0x30')][_0xcb06('0x32')]?_0x4ac03c[_0xcb06('0x30')]:_0x3ecd16[_0xcb06('0x2b')];_0x4ac03c[_0xcb06('0x33')]=qs['sort'](_0x426efc[_0xcb06('0x2c')][_0xcb06('0x34')]);_0x4ac03c[_0xcb06('0x37')]=qs[_0xcb06('0x2e')](_[_0xcb06('0x35')](_0x426efc[_0xcb06('0x2c')],_0x3ecd16[_0xcb06('0x2e')]));if(_0x426efc[_0xcb06('0x2c')]['filter']){_0x4ac03c[_0xcb06('0x37')]=_[_0xcb06('0x38')](_0x4ac03c[_0xcb06('0x37')],{'$or':_['map'](_0x4ac03c['attributes'],function(_0x45bcc9){var _0x1b60b2={};_0x1b60b2[_0x45bcc9]={'$like':'%'+_0x426efc[_0xcb06('0x2c')][_0xcb06('0x36')]+'%'};return _0x1b60b2;})});}_0x4ac03c=_[_0xcb06('0x38')]({},_0x4ac03c,_0x426efc['options']);return _0x3cbd62[_0xcb06('0x51')](_0x4ac03c);}})[_0xcb06('0x22')](function(_0x4987e8){if(_0x4987e8){_0x57f46c=_0x4987e8[_0xcb06('0x32')];if(!_0x426efc[_0xcb06('0x2c')][_0xcb06('0x4d')](_0xcb06('0x4e'))){_0x4ac03c[_0xcb06('0x1c')]=qs[_0xcb06('0x1c')](_0x426efc[_0xcb06('0x2c')][_0xcb06('0x1c')]);_0x4ac03c['offset']=qs[_0xcb06('0x19')](_0x426efc['query'][_0xcb06('0x19')]);}return _0x3cbd62[_0xcb06('0x51')](_0x4ac03c);}})[_0xcb06('0x22')](function(_0x42ebd3){if(_0x42ebd3){return _0x42ebd3?{'count':_0x57f46c,'rows':_0x42ebd3}:null;}})[_0xcb06('0x22')](respondWithResult(_0x5ec4eb,null))[_0xcb06('0x3c')](handleError(_0x5ec4eb,null));}; \ No newline at end of file +var _0x5994=['update','then','destroy','error','stack','name','index','Automation','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','length','find','create','body','params','addConditions','omit','ids','getConditions','findOne','Condition','addActions','getActions','Action','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x4c9efc,_0x416853){var _0x58197d=function(_0x2ee00d){while(--_0x2ee00d){_0x4c9efc['push'](_0x4c9efc['shift']());}};_0x58197d(++_0x416853);}(_0x5994,0x11d));var _0x4599=function(_0x1c463b,_0x5fd405){_0x1c463b=_0x1c463b-0x0;var _0x39f8a4=_0x5994[_0x1c463b];return _0x39f8a4;};'use strict';var emlformat=require(_0x4599('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4599('0x1'));var moment=require(_0x4599('0x2'));var BPromise=require(_0x4599('0x3'));var Mustache=require(_0x4599('0x4'));var util=require(_0x4599('0x5'));var path=require(_0x4599('0x6'));var sox=require(_0x4599('0x7'));var csv=require(_0x4599('0x8'));var ejs=require(_0x4599('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4599('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4599('0xb'));var toCsv=require(_0x4599('0x8'));var querystring=require(_0x4599('0xc'));var Papa=require(_0x4599('0xd'));var Redis=require(_0x4599('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4599('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4599('0x10'))(_0x4599('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4599('0x12'));var db=require(_0x4599('0x13'))['db'];function respondWithStatusCode(_0x4abbe7,_0x4cd02e){_0x4cd02e=_0x4cd02e||0xcc;return function(_0x5aa1f6){if(_0x5aa1f6){return _0x4abbe7[_0x4599('0x14')](_0x4cd02e);}return _0x4abbe7[_0x4599('0x15')](_0x4cd02e)['end']();};}function respondWithResult(_0x29fa17,_0xd7642b){_0xd7642b=_0xd7642b||0xc8;return function(_0x531780){if(_0x531780){return _0x29fa17[_0x4599('0x15')](_0xd7642b)['json'](_0x531780);}};}function respondWithFilteredResult(_0x196080,_0x4168cf){return function(_0x40abdc){if(_0x40abdc){var _0x521058=typeof _0x4168cf[_0x4599('0x16')]===_0x4599('0x17')&&typeof _0x4168cf['limit']===_0x4599('0x17');var _0x1f968f=_0x40abdc[_0x4599('0x18')];var _0x4ed79a=_0x521058?0x0:_0x4168cf[_0x4599('0x16')];var _0x58f343=_0x521058?_0x40abdc['count']:_0x4168cf[_0x4599('0x16')]+_0x4168cf[_0x4599('0x19')];var _0x8304c1;if(_0x58f343>=_0x1f968f){_0x58f343=_0x1f968f;_0x8304c1=0xc8;}else{_0x8304c1=0xce;}_0x196080[_0x4599('0x15')](_0x8304c1);return _0x196080[_0x4599('0x1a')](_0x4599('0x1b'),_0x4ed79a+'-'+_0x58f343+'/'+_0x1f968f)[_0x4599('0x1c')](_0x40abdc);}return null;};}function patchUpdates(_0x4586a9){return function(_0x2eee2f){try{jsonpatch['apply'](_0x2eee2f,_0x4586a9,!![]);}catch(_0x360ab2){return BPromise[_0x4599('0x1d')](_0x360ab2);}return _0x2eee2f[_0x4599('0x1e')]();};}function saveUpdates(_0x14c89d,_0x5d7b4e){return function(_0x541030){if(_0x541030){return _0x541030[_0x4599('0x1f')](_0x14c89d)[_0x4599('0x20')](function(_0x2cd75a){return _0x2cd75a;});}return null;};}function removeEntity(_0x51ff32,_0x270cf7){return function(_0x1f090d){if(_0x1f090d){return _0x1f090d[_0x4599('0x21')]()[_0x4599('0x20')](function(){_0x51ff32[_0x4599('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e50e9,_0x281b66){return function(_0x3f3fcc){if(!_0x3f3fcc){_0x1e50e9['sendStatus'](0x194);}return _0x3f3fcc;};}function handleError(_0x30c1c3,_0xbed598){_0xbed598=_0xbed598||0x1f4;return function(_0x525369){logger[_0x4599('0x22')](_0x525369[_0x4599('0x23')]);if(_0x525369[_0x4599('0x24')]){delete _0x525369[_0x4599('0x24')];}_0x30c1c3['status'](_0xbed598)['send'](_0x525369);};}exports[_0x4599('0x25')]=function(_0x344ea7,_0x4f25cc){var _0xec3151={},_0x5d5c11={},_0x44eb43={'count':0x0,'rows':[]};var _0x427dca=_['map'](db[_0x4599('0x26')][_0x4599('0x27')],function(_0x45f4d3){return{'name':_0x45f4d3[_0x4599('0x28')],'type':_0x45f4d3[_0x4599('0x29')]['key']};});_0x5d5c11[_0x4599('0x2a')]=_[_0x4599('0x2b')](_0x427dca,'name');_0x5d5c11['query']=_['keys'](_0x344ea7[_0x4599('0x2c')]);_0x5d5c11[_0x4599('0x2d')]=_[_0x4599('0x2e')](_0x5d5c11[_0x4599('0x2a')],_0x5d5c11[_0x4599('0x2c')]);_0xec3151[_0x4599('0x2f')]=_[_0x4599('0x2e')](_0x5d5c11['model'],qs[_0x4599('0x30')](_0x344ea7['query'][_0x4599('0x30')]));_0xec3151[_0x4599('0x2f')]=_0xec3151['attributes']['length']?_0xec3151[_0x4599('0x2f')]:_0x5d5c11[_0x4599('0x2a')];if(!_0x344ea7['query'][_0x4599('0x31')](_0x4599('0x32'))){_0xec3151[_0x4599('0x19')]=qs[_0x4599('0x19')](_0x344ea7[_0x4599('0x2c')][_0x4599('0x19')]);_0xec3151[_0x4599('0x16')]=qs[_0x4599('0x16')](_0x344ea7[_0x4599('0x2c')][_0x4599('0x16')]);}_0xec3151[_0x4599('0x33')]=qs['sort'](_0x344ea7[_0x4599('0x2c')][_0x4599('0x34')]);_0xec3151[_0x4599('0x35')]=qs['filters'](_[_0x4599('0x36')](_0x344ea7[_0x4599('0x2c')],_0x5d5c11[_0x4599('0x2d')]),_0x427dca);if(_0x344ea7[_0x4599('0x2c')]['filter']){_0xec3151[_0x4599('0x35')]=_[_0x4599('0x37')](_0xec3151[_0x4599('0x35')],{'$or':_[_0x4599('0x2b')](_0x427dca,function(_0x3cbf6b){if(_0x3cbf6b[_0x4599('0x29')]!==_0x4599('0x38')){var _0x48b78a={};_0x48b78a[_0x3cbf6b['name']]={'$like':'%'+_0x344ea7[_0x4599('0x2c')][_0x4599('0x39')]+'%'};return _0x48b78a;}})});}_0xec3151=_['merge']({},_0xec3151,_0x344ea7[_0x4599('0x3a')]);var _0xeb7a18={'where':_0xec3151[_0x4599('0x35')]};return db[_0x4599('0x26')][_0x4599('0x18')](_0xeb7a18)['then'](function(_0x65b12){_0x44eb43['count']=_0x65b12;if(_0x344ea7['query'][_0x4599('0x3b')]){_0xec3151['include']=[{'all':!![]}];}return db[_0x4599('0x26')][_0x4599('0x3c')](_0xec3151);})[_0x4599('0x20')](function(_0xf92e20){_0x44eb43[_0x4599('0x3d')]=_0xf92e20;return _0x44eb43;})[_0x4599('0x20')](respondWithFilteredResult(_0x4f25cc,_0xec3151))[_0x4599('0x3e')](handleError(_0x4f25cc,null));};exports[_0x4599('0x3f')]=function(_0x5b34fc,_0x13f4f7){var _0x5214c0={'raw':![],'where':{'id':_0x5b34fc['params']['id']}},_0x32a7a5={};_0x32a7a5['model']=_['keys'](db['Automation']['rawAttributes']);_0x32a7a5[_0x4599('0x2c')]=_[_0x4599('0x40')](_0x5b34fc[_0x4599('0x2c')]);_0x32a7a5[_0x4599('0x2d')]=_[_0x4599('0x2e')](_0x32a7a5[_0x4599('0x2a')],_0x32a7a5[_0x4599('0x2c')]);_0x5214c0[_0x4599('0x2f')]=_['intersection'](_0x32a7a5['model'],qs[_0x4599('0x30')](_0x5b34fc[_0x4599('0x2c')][_0x4599('0x30')]));_0x5214c0[_0x4599('0x2f')]=_0x5214c0[_0x4599('0x2f')][_0x4599('0x41')]?_0x5214c0[_0x4599('0x2f')]:_0x32a7a5[_0x4599('0x2a')];if(_0x5b34fc[_0x4599('0x2c')][_0x4599('0x3b')]){_0x5214c0['include']=[{'all':!![]}];}_0x5214c0=_[_0x4599('0x37')]({},_0x5214c0,_0x5b34fc[_0x4599('0x3a')]);return db[_0x4599('0x26')][_0x4599('0x42')](_0x5214c0)[_0x4599('0x20')](handleEntityNotFound(_0x13f4f7,null))[_0x4599('0x20')](respondWithResult(_0x13f4f7,null))[_0x4599('0x3e')](handleError(_0x13f4f7,null));};exports[_0x4599('0x43')]=function(_0x2c3ff1,_0x26f544){return db['Automation'][_0x4599('0x43')](_0x2c3ff1['body'],{})[_0x4599('0x20')](respondWithResult(_0x26f544,0xc9))[_0x4599('0x3e')](handleError(_0x26f544,null));};exports['update']=function(_0x3ae371,_0x169df3){if(_0x3ae371[_0x4599('0x44')]['id']){delete _0x3ae371[_0x4599('0x44')]['id'];}return db['Automation'][_0x4599('0x42')]({'where':{'id':_0x3ae371['params']['id']}})['then'](handleEntityNotFound(_0x169df3,null))[_0x4599('0x20')](saveUpdates(_0x3ae371[_0x4599('0x44')],null))[_0x4599('0x20')](respondWithResult(_0x169df3,null))[_0x4599('0x3e')](handleError(_0x169df3,null));};exports[_0x4599('0x21')]=function(_0xbca1b8,_0x10761f){return db['Automation'][_0x4599('0x42')]({'where':{'id':_0xbca1b8[_0x4599('0x45')]['id']}})[_0x4599('0x20')](handleEntityNotFound(_0x10761f,null))[_0x4599('0x20')](removeEntity(_0x10761f,null))[_0x4599('0x3e')](handleError(_0x10761f,null));};exports[_0x4599('0x46')]=function(_0x101854,_0xb57f07,_0x2fc88b){return db['Condition'][_0x4599('0x42')]({'where':{'id':_0x101854['params']['id']}})[_0x4599('0x20')](handleEntityNotFound(_0xb57f07,null))[_0x4599('0x20')](function(_0x265f9b){if(_0x265f9b){return _0x265f9b[_0x4599('0x46')](_0x101854['body']['ids'],_[_0x4599('0x47')](_0x101854[_0x4599('0x44')],[_0x4599('0x48'),'id'])||{});}})[_0x4599('0x20')](respondWithResult(_0xb57f07,null))[_0x4599('0x3e')](handleError(_0xb57f07,null));};exports[_0x4599('0x49')]=function(_0xd4b04b,_0x42522e,_0x5ece82){var _0x3f0c3c={};var _0x32e312={};var _0x5e0c45;var _0x3463e3;return db[_0x4599('0x26')][_0x4599('0x4a')]({'where':{'id':_0xd4b04b[_0x4599('0x45')]['id']}})[_0x4599('0x20')](handleEntityNotFound(_0x42522e,null))['then'](function(_0x4c60a4){if(_0x4c60a4){_0x5e0c45=_0x4c60a4;_0x32e312[_0x4599('0x2a')]=_['keys'](db[_0x4599('0x4b')][_0x4599('0x27')]);_0x32e312[_0x4599('0x2c')]=_[_0x4599('0x40')](_0xd4b04b[_0x4599('0x2c')]);_0x32e312[_0x4599('0x2d')]=_['intersection'](_0x32e312[_0x4599('0x2a')],_0x32e312[_0x4599('0x2c')]);_0x3f0c3c['attributes']=_[_0x4599('0x2e')](_0x32e312[_0x4599('0x2a')],qs['fields'](_0xd4b04b[_0x4599('0x2c')][_0x4599('0x30')]));_0x3f0c3c[_0x4599('0x2f')]=_0x3f0c3c['attributes'][_0x4599('0x41')]?_0x3f0c3c[_0x4599('0x2f')]:_0x32e312[_0x4599('0x2a')];_0x3f0c3c[_0x4599('0x33')]=qs[_0x4599('0x34')](_0xd4b04b[_0x4599('0x2c')][_0x4599('0x34')]);_0x3f0c3c['where']=qs[_0x4599('0x2d')](_[_0x4599('0x36')](_0xd4b04b[_0x4599('0x2c')],_0x32e312[_0x4599('0x2d')]));if(_0xd4b04b[_0x4599('0x2c')]['filter']){_0x3f0c3c['where']=_[_0x4599('0x37')](_0x3f0c3c[_0x4599('0x35')],{'$or':_[_0x4599('0x2b')](_0x3f0c3c['attributes'],function(_0xa448da){var _0x111d4c={};_0x111d4c[_0xa448da]={'$like':'%'+_0xd4b04b[_0x4599('0x2c')][_0x4599('0x39')]+'%'};return _0x111d4c;})});}_0x3f0c3c=_['merge']({},_0x3f0c3c,_0xd4b04b[_0x4599('0x3a')]);return _0x5e0c45['getConditions'](_0x3f0c3c);}})['then'](function(_0x261999){if(_0x261999){_0x3463e3=_0x261999['length'];if(!_0xd4b04b[_0x4599('0x2c')][_0x4599('0x31')](_0x4599('0x32'))){_0x3f0c3c[_0x4599('0x19')]=qs[_0x4599('0x19')](_0xd4b04b['query'][_0x4599('0x19')]);_0x3f0c3c[_0x4599('0x16')]=qs[_0x4599('0x16')](_0xd4b04b[_0x4599('0x2c')]['offset']);}return _0x5e0c45[_0x4599('0x49')](_0x3f0c3c);}})[_0x4599('0x20')](function(_0x502b5b){if(_0x502b5b){return _0x502b5b?{'count':_0x3463e3,'rows':_0x502b5b}:null;}})[_0x4599('0x20')](respondWithResult(_0x42522e,null))[_0x4599('0x3e')](handleError(_0x42522e,null));};exports[_0x4599('0x4c')]=function(_0x10fcd7,_0x21d4c2,_0x14163f){return db['Action']['find']({'where':{'id':_0x10fcd7[_0x4599('0x45')]['id']}})[_0x4599('0x20')](handleEntityNotFound(_0x21d4c2,null))[_0x4599('0x20')](function(_0x357dfb){if(_0x357dfb){return _0x357dfb['addActions'](_0x10fcd7[_0x4599('0x44')][_0x4599('0x48')],_[_0x4599('0x47')](_0x10fcd7[_0x4599('0x44')],[_0x4599('0x48'),'id'])||{});}})[_0x4599('0x20')](respondWithResult(_0x21d4c2,null))[_0x4599('0x3e')](handleError(_0x21d4c2,null));};exports[_0x4599('0x4d')]=function(_0x137476,_0x1c52b6,_0x2902ef){var _0x4b29b4={};var _0x58e542={};var _0x2e2b6b;var _0x43cdf7;return db[_0x4599('0x26')][_0x4599('0x4a')]({'where':{'id':_0x137476[_0x4599('0x45')]['id']}})[_0x4599('0x20')](handleEntityNotFound(_0x1c52b6,null))[_0x4599('0x20')](function(_0x304e5a){if(_0x304e5a){_0x2e2b6b=_0x304e5a;_0x58e542['model']=_[_0x4599('0x40')](db[_0x4599('0x4e')][_0x4599('0x27')]);_0x58e542[_0x4599('0x2c')]=_[_0x4599('0x40')](_0x137476['query']);_0x58e542[_0x4599('0x2d')]=_['intersection'](_0x58e542[_0x4599('0x2a')],_0x58e542[_0x4599('0x2c')]);_0x4b29b4[_0x4599('0x2f')]=_[_0x4599('0x2e')](_0x58e542[_0x4599('0x2a')],qs['fields'](_0x137476[_0x4599('0x2c')]['fields']));_0x4b29b4[_0x4599('0x2f')]=_0x4b29b4[_0x4599('0x2f')]['length']?_0x4b29b4[_0x4599('0x2f')]:_0x58e542[_0x4599('0x2a')];_0x4b29b4[_0x4599('0x33')]=qs['sort'](_0x137476[_0x4599('0x2c')][_0x4599('0x34')]);_0x4b29b4['where']=qs['filters'](_[_0x4599('0x36')](_0x137476[_0x4599('0x2c')],_0x58e542[_0x4599('0x2d')]));if(_0x137476['query'][_0x4599('0x39')]){_0x4b29b4[_0x4599('0x35')]=_[_0x4599('0x37')](_0x4b29b4[_0x4599('0x35')],{'$or':_[_0x4599('0x2b')](_0x4b29b4['attributes'],function(_0x1ab15d){var _0x1cfef4={};_0x1cfef4[_0x1ab15d]={'$like':'%'+_0x137476['query'][_0x4599('0x39')]+'%'};return _0x1cfef4;})});}_0x4b29b4=_['merge']({},_0x4b29b4,_0x137476[_0x4599('0x3a')]);return _0x2e2b6b[_0x4599('0x4d')](_0x4b29b4);}})['then'](function(_0x5c86ec){if(_0x5c86ec){_0x43cdf7=_0x5c86ec['length'];if(!_0x137476[_0x4599('0x2c')][_0x4599('0x31')](_0x4599('0x32'))){_0x4b29b4[_0x4599('0x19')]=qs['limit'](_0x137476[_0x4599('0x2c')][_0x4599('0x19')]);_0x4b29b4[_0x4599('0x16')]=qs[_0x4599('0x16')](_0x137476[_0x4599('0x2c')][_0x4599('0x16')]);}return _0x2e2b6b[_0x4599('0x4d')](_0x4b29b4);}})['then'](function(_0x4704d8){if(_0x4704d8){return _0x4704d8?{'count':_0x43cdf7,'rows':_0x4704d8}:null;}})[_0x4599('0x20')](respondWithResult(_0x1c52b6,null))[_0x4599('0x3e')](handleError(_0x1c52b6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 056e4aa..df8b804 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 _0x4a45=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x4a45,0x180));var _0x54a4=function(_0x294272,_0x178245){_0x294272=_0x294272-0x0;var _0x36fcf9=_0x4a45[_0x294272];return _0x36fcf9;};'use strict';var _=require('lodash');var util=require(_0x54a4('0x0'));var logger=require(_0x54a4('0x1'))(_0x54a4('0x2'));var moment=require(_0x54a4('0x3'));var BPromise=require(_0x54a4('0x4'));var rp=require(_0x54a4('0x5'));var fs=require('fs');var path=require(_0x54a4('0x6'));var rimraf=require(_0x54a4('0x7'));var config=require(_0x54a4('0x8'));var attributes=require(_0x54a4('0x9'));module[_0x54a4('0xa')]=function(_0x39c5c9,_0x406abf){return _0x39c5c9[_0x54a4('0xb')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd34=['api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','tools_automations','util'];(function(_0x286634,_0xac4607){var _0x577003=function(_0x23bca7){while(--_0x23bca7){_0x286634['push'](_0x286634['shift']());}};_0x577003(++_0xac4607);}(_0xdd34,0x15f));var _0x4dd3=function(_0x524d5e,_0x269f75){_0x524d5e=_0x524d5e-0x0;var _0x3a1eca=_0xdd34[_0x524d5e];return _0x3a1eca;};'use strict';var _=require('lodash');var util=require(_0x4dd3('0x0'));var logger=require('../../config/logger')(_0x4dd3('0x1'));var moment=require(_0x4dd3('0x2'));var BPromise=require(_0x4dd3('0x3'));var rp=require(_0x4dd3('0x4'));var fs=require('fs');var path=require(_0x4dd3('0x5'));var rimraf=require('rimraf');var config=require(_0x4dd3('0x6'));var attributes=require(_0x4dd3('0x7'));module[_0x4dd3('0x8')]=function(_0x2b4148,_0x74864f){return _0x2b4148[_0x4dd3('0x9')]('Automation',attributes,{'tableName':_0x4dd3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0b468ef..849201d 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 _0x1c9a=['http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x1c9a,0x98));var _0xa1c9=function(_0x558759,_0xd9ea38){_0x558759=_0x558759-0x0;var _0x1c712f=_0x1c9a[_0x558759];return _0x1c712f;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('Automation,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});} \ No newline at end of file +var _0x6bab=['../../config/logger','rpc','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x6bab[_0x136a0d];return _0x212ea5;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var moment=require(_0xb6ba('0x2'));var BPromise=require(_0xb6ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ba('0x4'));var db=require(_0xb6ba('0x5'))['db'];var utils=require(_0xb6ba('0x6'));var logger=require(_0xb6ba('0x7'))(_0xb6ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6ba('0x9'));var client=jayson['client'][_0xb6ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389a0d,_0x3fd283,_0xbce6f){return new BPromise(function(_0xa0b5c7,_0x469e81){return client[_0xb6ba('0xb')](_0x389a0d,_0xbce6f)[_0xb6ba('0xc')](function(_0x36bdc2){logger['info'](_0xb6ba('0xd'),_0x3fd283,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3fd283,_0xb6ba('0xe'),JSON[_0xb6ba('0xf')](_0x36bdc2));if(_0x36bdc2[_0xb6ba('0x10')]){if(_0x36bdc2['error'][_0xb6ba('0x11')]===0x1f4){logger[_0xb6ba('0x10')](_0xb6ba('0xd'),_0x3fd283,_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);return _0x469e81(_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);}logger[_0xb6ba('0x10')](_0xb6ba('0xd'),_0x3fd283,_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);return _0xa0b5c7(_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);}else{logger[_0xb6ba('0x13')](_0xb6ba('0xd'),_0x3fd283,_0xb6ba('0xe'));_0xa0b5c7(_0x36bdc2[_0xb6ba('0x14')][_0xb6ba('0x12')]);}})[_0xb6ba('0x15')](function(_0x5313d4){logger[_0xb6ba('0x10')]('Automation,\x20%s,\x20%s',_0x3fd283,_0x5313d4);_0x469e81(_0x5313d4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index cf85eff..9305bde 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 _0x4c67=['show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index'];(function(_0x3d40db,_0x26f3c1){var _0x3b92c4=function(_0x28c086){while(--_0x28c086){_0x3d40db['push'](_0x3d40db['shift']());}};_0x3b92c4(++_0x26f3c1);}(_0x4c67,0x1cd));var _0x74c6=function(_0x52b034,_0x5d89ff){_0x52b034=_0x52b034-0x0;var _0xeb7545=_0x4c67[_0x52b034];return _0xeb7545;};'use strict';var multer=require(_0x74c6('0x0'));var util=require(_0x74c6('0x1'));var path=require(_0x74c6('0x2'));var timeout=require(_0x74c6('0x3'));var express=require(_0x74c6('0x4'));var router=express[_0x74c6('0x5')]();var fs_extra=require(_0x74c6('0x6'));var auth=require(_0x74c6('0x7'));var interaction=require(_0x74c6('0x8'));var config=require(_0x74c6('0x9'));var controller=require(_0x74c6('0xa'));router[_0x74c6('0xb')]('/',auth[_0x74c6('0xc')](),controller[_0x74c6('0xd')]);router[_0x74c6('0xb')]('/:id',auth[_0x74c6('0xc')](),controller[_0x74c6('0xe')]);router[_0x74c6('0xb')](_0x74c6('0xf'),auth[_0x74c6('0xc')](),controller[_0x74c6('0x10')]);router['get'](_0x74c6('0x11'),auth['isAuthenticated'](),controller[_0x74c6('0x12')]);router[_0x74c6('0x13')]('/',auth[_0x74c6('0xc')](),controller['create']);router[_0x74c6('0x13')]('/:id/conditions',auth[_0x74c6('0xc')](),controller[_0x74c6('0x14')]);router['post'](_0x74c6('0x11'),auth[_0x74c6('0xc')](),controller[_0x74c6('0x15')]);router['put'](_0x74c6('0x16'),auth[_0x74c6('0xc')](),controller[_0x74c6('0x17')]);router['delete'](_0x74c6('0x16'),auth['isAuthenticated'](),controller[_0x74c6('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6505=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports'];(function(_0x1bafb1,_0x3f4d43){var _0x1e9aa9=function(_0x34c867){while(--_0x34c867){_0x1bafb1['push'](_0x1bafb1['shift']());}};_0x1e9aa9(++_0x3f4d43);}(_0x6505,0x8c));var _0x5650=function(_0x5e16cf,_0x23b912){_0x5e16cf=_0x5e16cf-0x0;var _0x5201e5=_0x6505[_0x5e16cf];return _0x5201e5;};'use strict';var multer=require(_0x5650('0x0'));var util=require(_0x5650('0x1'));var path=require(_0x5650('0x2'));var timeout=require(_0x5650('0x3'));var express=require(_0x5650('0x4'));var router=express[_0x5650('0x5')]();var fs_extra=require(_0x5650('0x6'));var auth=require(_0x5650('0x7'));var interaction=require(_0x5650('0x8'));var config=require(_0x5650('0x9'));var controller=require(_0x5650('0xa'));router['get']('/',auth[_0x5650('0xb')](),controller[_0x5650('0xc')]);router[_0x5650('0xd')](_0x5650('0xe'),auth[_0x5650('0xb')](),controller[_0x5650('0xf')]);router[_0x5650('0xd')]('/:id/conditions',auth[_0x5650('0xb')](),controller['getConditions']);router[_0x5650('0xd')](_0x5650('0x10'),auth[_0x5650('0xb')](),controller[_0x5650('0x11')]);router[_0x5650('0x12')]('/',auth[_0x5650('0xb')](),controller[_0x5650('0x13')]);router[_0x5650('0x12')](_0x5650('0x14'),auth[_0x5650('0xb')](),controller[_0x5650('0x15')]);router[_0x5650('0x12')](_0x5650('0x10'),auth[_0x5650('0xb')](),controller[_0x5650('0x16')]);router[_0x5650('0x17')](_0x5650('0xe'),auth[_0x5650('0xb')](),controller[_0x5650('0x18')]);router[_0x5650('0x19')]('/:id',auth[_0x5650('0xb')](),controller[_0x5650('0x1a')]);module[_0x5650('0x1b')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5ce4d1f..e40935c 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 _0x6c93=['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)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','BOOLEAN'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x6c93,0x160));var _0x36c9=function(_0x18cf74,_0x1b6eb6){_0x18cf74=_0x18cf74-0x0;var _0x2f6f1f=_0x6c93[_0x18cf74];return _0x2f6f1f;};'use strict';var Sequelize=require(_0x36c9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x36c9('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x36c9('0x2')](_0x36c9('0x3')),'allowNull':![],'defaultValue':_0x36c9('0x3')},'description':{'type':Sequelize[_0x36c9('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x36c9('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x36c9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x36c9('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x36c9('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x36c9('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c9('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'comment':_0x36c9('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x36c9('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x36c9('0x2')](_0x36c9('0xf'),'never',_0x36c9('0x10')),'defaultValue':_0x36c9('0xf')},'dialAMDActive':{'type':Sequelize[_0x36c9('0x11')],'defaultValue':0x0,'comment':_0x36c9('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x36c9('0x8')](0x9)[_0x36c9('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x36c9('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x36c9('0x8')](0x9)[_0x36c9('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x36c9('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x36c9('0x8')](0x9)[_0x36c9('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x36c9('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x36c9('0x8')](0x9)[_0x36c9('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x36c9('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x36c9('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x36c9('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x36c9('0x8')](0x9)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x36c9('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x36c9('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x36c9('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x36c9('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x36c9('0x2')]('DESC','ASC'),'defaultValue':_0x36c9('0x1a')},'dialPrefix':{'type':Sequelize[_0x36c9('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x36c9('0x1b')},'dialCutDigit':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c9('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x36c9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c9('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)[_0x36c9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c9('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36c9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36c9('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x36c9('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36c9('0x24')}}; \ No newline at end of file +var _0x770f=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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)','exports','STRING','ivr','BOOLEAN','INTEGER','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always'];(function(_0xdd5244,_0x26242c){var _0x3d086d=function(_0x6a9652){while(--_0x6a9652){_0xdd5244['push'](_0xdd5244['shift']());}};_0x3d086d(++_0x26242c);}(_0x770f,0x7e));var _0xf770=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x770f[_0xba1760];return _0x1f3143;};'use strict';var Sequelize=require('sequelize');module[_0xf770('0x0')]={'name':{'type':Sequelize[_0xf770('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xf770('0x2')),'allowNull':![],'defaultValue':_0xf770('0x2')},'description':{'type':Sequelize[_0xf770('0x1')]},'active':{'type':Sequelize[_0xf770('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xf770('0x4')](0x4)[_0xf770('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf770('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xf770('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf770('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf770('0x1')],'defaultValue':_0xf770('0xb')},'dialCheckDuplicateType':{'type':Sequelize[_0xf770('0xc')](_0xf770('0xd'),_0xf770('0xe'),_0xf770('0xf')),'defaultValue':_0xf770('0xd')},'dialAMDActive':{'type':Sequelize[_0xf770('0x3')],'defaultValue':0x0,'comment':_0xf770('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf770('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xf770('0x4')](0x9)[_0xf770('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf770('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf770('0x4')](0x9)[_0xf770('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf770('0x4')](0x9)[_0xf770('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf770('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xf770('0x4')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf770('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf770('0x4')](0x9)[_0xf770('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf770('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf770('0x4')](0x9)[_0xf770('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf770('0x16')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xf770('0x17')),'defaultValue':_0xf770('0x18')},'dialPrefix':{'type':Sequelize[_0xf770('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf770('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf770('0x19')},'dialCutDigit':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf770('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf770('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf770('0x4')](0x3)[_0xf770('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf770('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf770('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf770('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 17caf92..2246e0e 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 _0x5dca=['mustache','util','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','includeAll','include','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','nolimit','order','findOne','CmHopperHistory','getHopperFinals','CampaignId','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','omit','spread','dialCheckDuplicateType','insert','into','fromQuery','scheduledAt','select','field','ContactId','toString','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone','phone\x20IS\x20NOT\x20NULL','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x5dca,0x191));var _0xa5dc=function(_0x5f2282,_0xc29c83){_0x5f2282=_0x5f2282-0x0;var _0x1c1b8b=_0x5dca[_0x5f2282];return _0x1c1b8b;};'use strict';var emlformat=require(_0xa5dc('0x0'));var rimraf=require(_0xa5dc('0x1'));var zipdir=require(_0xa5dc('0x2'));var jsonpatch=require(_0xa5dc('0x3'));var rp=require(_0xa5dc('0x4'));var moment=require(_0xa5dc('0x5'));var BPromise=require(_0xa5dc('0x6'));var Mustache=require(_0xa5dc('0x7'));var util=require(_0xa5dc('0x8'));var path=require('path');var sox=require(_0xa5dc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5dc('0xa'));var _=require(_0xa5dc('0xb'));var squel=require(_0xa5dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5dc('0xd'));var toCsv=require(_0xa5dc('0xe'));var querystring=require(_0xa5dc('0xf'));var Papa=require(_0xa5dc('0x10'));var Redis=require(_0xa5dc('0x11'));var authService=require(_0xa5dc('0x12'));var qs=require(_0xa5dc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5dc('0x14'));var logger=require(_0xa5dc('0x15'))(_0xa5dc('0x16'));var utils=require('../../config/utils');var config=require(_0xa5dc('0x17'));var licenseUtil=require(_0xa5dc('0x18'));var db=require(_0xa5dc('0x19'))['db'];function respondWithStatusCode(_0x2c5807,_0x28f55a){_0x28f55a=_0x28f55a||0xcc;return function(_0x1608ed){if(_0x1608ed){return _0x2c5807['sendStatus'](_0x28f55a);}return _0x2c5807[_0xa5dc('0x1a')](_0x28f55a)[_0xa5dc('0x1b')]();};}function respondWithResult(_0x58aaf0,_0x33ba28){_0x33ba28=_0x33ba28||0xc8;return function(_0x28dd7a){if(_0x28dd7a){return _0x58aaf0[_0xa5dc('0x1a')](_0x33ba28)[_0xa5dc('0x1c')](_0x28dd7a);}};}function respondWithFilteredResult(_0x2e5314,_0x245630){return function(_0x4b2e4){if(_0x4b2e4){var _0x33869e=typeof _0x245630['offset']===_0xa5dc('0x1d')&&typeof _0x245630[_0xa5dc('0x1e')]===_0xa5dc('0x1d');var _0x58e72d=_0x4b2e4[_0xa5dc('0x1f')];var _0x4b15d5=_0x33869e?0x0:_0x245630[_0xa5dc('0x20')];var _0x3a1e27=_0x33869e?_0x4b2e4['count']:_0x245630[_0xa5dc('0x20')]+_0x245630['limit'];var _0x2397e0;if(_0x3a1e27>=_0x58e72d){_0x3a1e27=_0x58e72d;_0x2397e0=0xc8;}else{_0x2397e0=0xce;}_0x2e5314[_0xa5dc('0x1a')](_0x2397e0);return _0x2e5314['set'](_0xa5dc('0x21'),_0x4b15d5+'-'+_0x3a1e27+'/'+_0x58e72d)['json'](_0x4b2e4);}return null;};}function patchUpdates(_0x3c8d80){return function(_0x2d12df){try{jsonpatch[_0xa5dc('0x22')](_0x2d12df,_0x3c8d80,!![]);}catch(_0x3dda89){return BPromise[_0xa5dc('0x23')](_0x3dda89);}return _0x2d12df['save']();};}function saveUpdates(_0x1dab3d,_0x125b4e){return function(_0x3527e2){if(_0x3527e2){return _0x3527e2[_0xa5dc('0x24')](_0x1dab3d)[_0xa5dc('0x25')](function(_0x5863dd){return _0x5863dd;});}return null;};}function removeEntity(_0xa0f4ed,_0x4255c3){return function(_0x8def96){if(_0x8def96){return _0x8def96['destroy']()[_0xa5dc('0x25')](function(){var _0x43f298=_0x8def96[_0xa5dc('0x26')]({'plain':!![]});var _0x39b65e=_0xa5dc('0x27');return db[_0xa5dc('0x28')][_0xa5dc('0x29')]({'where':{'type':_0x39b65e,'resourceId':_0x43f298['id']}})[_0xa5dc('0x25')](function(){return _0x8def96;});})['then'](function(){_0xa0f4ed[_0xa5dc('0x1a')](0xcc)[_0xa5dc('0x1b')]();});}};}function handleEntityNotFound(_0x30a583,_0x55b42e){return function(_0x1f557a){if(!_0x1f557a){_0x30a583['sendStatus'](0x194);}return _0x1f557a;};}function handleError(_0x55e4f4,_0x27f923){_0x27f923=_0x27f923||0x1f4;return function(_0x22e24a){logger[_0xa5dc('0x2a')](_0x22e24a[_0xa5dc('0x2b')]);if(_0x22e24a['name']){delete _0x22e24a[_0xa5dc('0x2c')];}_0x55e4f4['status'](_0x27f923)[_0xa5dc('0x2d')](_0x22e24a);};}exports[_0xa5dc('0x2e')]=function(_0x4b3645,_0x46e721){var _0x1e4f26={},_0x3dfc1d={},_0x1bb06f={'count':0x0,'rows':[]};var _0x10ebff=_[_0xa5dc('0x2f')](db[_0xa5dc('0x30')][_0xa5dc('0x31')],function(_0x307f74){return{'name':_0x307f74[_0xa5dc('0x32')],'type':_0x307f74[_0xa5dc('0x33')][_0xa5dc('0x34')]};});_0x3dfc1d[_0xa5dc('0x35')]=_[_0xa5dc('0x2f')](_0x10ebff,_0xa5dc('0x2c'));_0x3dfc1d[_0xa5dc('0x36')]=_[_0xa5dc('0x37')](_0x4b3645['query']);_0x3dfc1d[_0xa5dc('0x38')]=_['intersection'](_0x3dfc1d[_0xa5dc('0x35')],_0x3dfc1d[_0xa5dc('0x36')]);_0x1e4f26[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x3dfc1d[_0xa5dc('0x35')],qs[_0xa5dc('0x3b')](_0x4b3645['query'][_0xa5dc('0x3b')]));_0x1e4f26['attributes']=_0x1e4f26[_0xa5dc('0x39')][_0xa5dc('0x3c')]?_0x1e4f26[_0xa5dc('0x39')]:_0x3dfc1d['model'];if(!_0x4b3645[_0xa5dc('0x36')][_0xa5dc('0x3d')]('nolimit')){_0x1e4f26['limit']=qs[_0xa5dc('0x1e')](_0x4b3645[_0xa5dc('0x36')][_0xa5dc('0x1e')]);_0x1e4f26[_0xa5dc('0x20')]=qs[_0xa5dc('0x20')](_0x4b3645['query'][_0xa5dc('0x20')]);}_0x1e4f26['order']=qs[_0xa5dc('0x3e')](_0x4b3645[_0xa5dc('0x36')][_0xa5dc('0x3e')]);_0x1e4f26[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_[_0xa5dc('0x40')](_0x4b3645[_0xa5dc('0x36')],_0x3dfc1d[_0xa5dc('0x38')]),_0x10ebff);if(_0x4b3645['query'][_0xa5dc('0x41')]){_0x1e4f26['where']=_['merge'](_0x1e4f26['where'],{'$or':_[_0xa5dc('0x2f')](_0x10ebff,function(_0x141672){if(_0x141672[_0xa5dc('0x33')]!==_0xa5dc('0x42')){var _0x3cd3b5={};_0x3cd3b5[_0x141672[_0xa5dc('0x2c')]]={'$like':'%'+_0x4b3645['query'][_0xa5dc('0x41')]+'%'};return _0x3cd3b5;}})});}_0x1e4f26=_[_0xa5dc('0x43')]({},_0x1e4f26,_0x4b3645[_0xa5dc('0x44')]);var _0x199c7f={'where':_0x1e4f26['where']};return db[_0xa5dc('0x30')]['count'](_0x199c7f)[_0xa5dc('0x25')](function(_0x23131f){_0x1bb06f[_0xa5dc('0x1f')]=_0x23131f;if(_0x4b3645[_0xa5dc('0x36')]['includeAll']){_0x1e4f26['include']=[{'all':!![]}];}return db[_0xa5dc('0x30')][_0xa5dc('0x45')](_0x1e4f26);})[_0xa5dc('0x25')](function(_0x4c6b61){_0x1bb06f[_0xa5dc('0x46')]=_0x4c6b61;return _0x1bb06f;})[_0xa5dc('0x25')](respondWithFilteredResult(_0x46e721,_0x1e4f26))['catch'](handleError(_0x46e721,null));};exports[_0xa5dc('0x47')]=function(_0x53fbc1,_0x22a37c){var _0x17060c={'raw':![],'where':{'id':_0x53fbc1[_0xa5dc('0x48')]['id']}},_0x5566de={};_0x5566de[_0xa5dc('0x35')]=_['keys'](db[_0xa5dc('0x30')]['rawAttributes']);_0x5566de['query']=_[_0xa5dc('0x37')](_0x53fbc1[_0xa5dc('0x36')]);_0x5566de[_0xa5dc('0x38')]=_[_0xa5dc('0x3a')](_0x5566de[_0xa5dc('0x35')],_0x5566de['query']);_0x17060c[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x5566de['model'],qs[_0xa5dc('0x3b')](_0x53fbc1['query'][_0xa5dc('0x3b')]));_0x17060c[_0xa5dc('0x39')]=_0x17060c['attributes']['length']?_0x17060c[_0xa5dc('0x39')]:_0x5566de['model'];if(_0x53fbc1[_0xa5dc('0x36')]['includeAll']){_0x17060c['include']=[{'all':!![]}];}_0x17060c=_['merge']({},_0x17060c,_0x53fbc1[_0xa5dc('0x44')]);return db[_0xa5dc('0x30')][_0xa5dc('0x49')](_0x17060c)['then'](handleEntityNotFound(_0x22a37c,null))[_0xa5dc('0x25')](respondWithResult(_0x22a37c,null))['catch'](handleError(_0x22a37c,null));};exports[_0xa5dc('0x4a')]=function(_0x39fcae,_0x57493e){return db[_0xa5dc('0x30')]['create'](_0x39fcae[_0xa5dc('0x4b')],{})[_0xa5dc('0x25')](function(_0xef90d3){var _0x3c273c=_0x39fcae[_0xa5dc('0x4c')][_0xa5dc('0x26')]({'plain':!![]});if(!_0x3c273c)throw new Error(_0xa5dc('0x4d'));if(_0x3c273c[_0xa5dc('0x4e')]==='user'){var _0xb53cf6=_0xef90d3['get']({'plain':!![]});var _0x43672c=_0xa5dc('0x27');return db[_0xa5dc('0x4f')]['find']({'where':{'name':_0x43672c,'userProfileId':_0x3c273c[_0xa5dc('0x50')]},'raw':!![]})['then'](function(_0x4cd1c6){if(_0x4cd1c6&&_0x4cd1c6['autoAssociation']===0x0){return db[_0xa5dc('0x28')][_0xa5dc('0x4a')]({'name':_0xb53cf6[_0xa5dc('0x2c')],'resourceId':_0xb53cf6['id'],'type':_0x4cd1c6[_0xa5dc('0x2c')],'sectionId':_0x4cd1c6['id']},{})[_0xa5dc('0x25')](function(){return _0xef90d3;});}else{return _0xef90d3;}})['catch'](function(_0x1cb7bc){logger[_0xa5dc('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cb7bc);throw _0x1cb7bc;});}return _0xef90d3;})['then'](respondWithResult(_0x57493e,0xc9))[_0xa5dc('0x51')](handleError(_0x57493e,null));};exports['clone']=function(_0xfaca60,_0xd68c4){var _0xbc209b={'where':{'id':_0xfaca60[_0xa5dc('0x48')]['id']}},_0x52e1dc={};_0x52e1dc[_0xa5dc('0x35')]=_['keys'](db[_0xa5dc('0x30')]['rawAttributes']);_0xbc209b[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x52e1dc['model'],qs['fields'](_0xfaca60[_0xa5dc('0x36')][_0xa5dc('0x3b')]));_0xbc209b['attributes']=_0xbc209b[_0xa5dc('0x39')][_0xa5dc('0x3c')]?_0xbc209b[_0xa5dc('0x39')]:_0x52e1dc['model'];if(_0xfaca60[_0xa5dc('0x36')][_0xa5dc('0x52')]){_0xbc209b[_0xa5dc('0x53')]=[{'all':!![]}];}_0xbc209b=_[_0xa5dc('0x43')]({},_0xbc209b,_0xfaca60[_0xa5dc('0x44')]);return db[_0xa5dc('0x30')][_0xa5dc('0x49')](_0xbc209b)[_0xa5dc('0x25')](handleEntityNotFound(_0xd68c4,null))[_0xa5dc('0x25')](function(_0x50bb5f){if(_0x50bb5f){var _0x465964=_0x50bb5f[_0xa5dc('0x26')]({'plain':!![]});_0x465964=qs['omit'](_0x465964,['id',_0xa5dc('0x54'),_0xa5dc('0x55')]);_0xfaca60[_0xa5dc('0x4b')]=_['omit'](_0xfaca60[_0xa5dc('0x4b')],['id',_0xa5dc('0x54'),_0xa5dc('0x55')]);return db[_0xa5dc('0x30')][_0xa5dc('0x4a')](_['merge'](_0x465964,_0xfaca60['body']),{'include':_0xfaca60[_0xa5dc('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2577b3){var _0x37eb5f=_0xfaca60[_0xa5dc('0x4c')][_0xa5dc('0x26')]({'plain':!![]});if(!_0x37eb5f)throw new Error(_0xa5dc('0x4d'));if(_0x37eb5f[_0xa5dc('0x4e')]==='user'){var _0xeed85e=_0x2577b3[_0xa5dc('0x26')]({'plain':!![]});var _0x1378ba=_0xa5dc('0x27');return db[_0xa5dc('0x4f')][_0xa5dc('0x49')]({'where':{'name':_0x1378ba,'userProfileId':_0x37eb5f['userProfileId']},'raw':!![]})[_0xa5dc('0x25')](function(_0x2d6ea3){if(_0x2d6ea3&&_0x2d6ea3[_0xa5dc('0x56')]===0x0){return db[_0xa5dc('0x28')]['create']({'name':_0xeed85e[_0xa5dc('0x2c')],'resourceId':_0xeed85e['id'],'type':_0x2d6ea3['name'],'sectionId':_0x2d6ea3['id']},{})[_0xa5dc('0x25')](function(){return _0x2577b3;});}else{return _0x2577b3;}})[_0xa5dc('0x51')](function(_0x30e62b){logger[_0xa5dc('0x2a')](_0xa5dc('0x57'),_0x30e62b);throw _0x30e62b;});}return _0x2577b3;});}})['then'](respondWithResult(_0xd68c4,0xc9))['catch'](handleError(_0xd68c4,null));};exports[_0xa5dc('0x24')]=function(_0x5df928,_0x389850){if(_0x5df928[_0xa5dc('0x4b')]['id']){delete _0x5df928[_0xa5dc('0x4b')]['id'];}return db['Campaign'][_0xa5dc('0x49')]({'where':{'id':_0x5df928['params']['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x389850,null))[_0xa5dc('0x25')](saveUpdates(_0x5df928[_0xa5dc('0x4b')],null))['then'](respondWithResult(_0x389850,null))[_0xa5dc('0x51')](handleError(_0x389850,null));};exports[_0xa5dc('0x29')]=function(_0x3111dc,_0x1ebf8b){return db[_0xa5dc('0x30')][_0xa5dc('0x49')]({'where':{'id':_0x3111dc['params']['id']}})['then'](handleEntityNotFound(_0x1ebf8b,null))[_0xa5dc('0x25')](removeEntity(_0x1ebf8b,null))[_0xa5dc('0x51')](handleError(_0x1ebf8b,null));};exports[_0xa5dc('0x58')]=function(_0x529454,_0xd17c2f,_0xdc04a0){var _0x568efd={'raw':!![],'where':{}};var _0x52885c={};var _0x3398ae={'count':0x0,'rows':[]};return db[_0xa5dc('0x30')]['findOne']({'where':{'id':_0x529454[_0xa5dc('0x48')]['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0xd17c2f,null))['then'](function(_0x1d45e0){if(_0x1d45e0){_0x52885c['model']=_[_0xa5dc('0x37')](db[_0xa5dc('0x59')][_0xa5dc('0x31')]);_0x52885c[_0xa5dc('0x36')]=_[_0xa5dc('0x37')](_0x529454['query']);_0x52885c[_0xa5dc('0x38')]=_[_0xa5dc('0x3a')](_0x52885c[_0xa5dc('0x35')],_0x52885c[_0xa5dc('0x36')]);_0x568efd['attributes']=_['intersection'](_0x52885c['model'],qs[_0xa5dc('0x3b')](_0x529454[_0xa5dc('0x36')][_0xa5dc('0x3b')]));_0x568efd['attributes']=_0x568efd[_0xa5dc('0x39')][_0xa5dc('0x3c')]?_0x568efd[_0xa5dc('0x39')]:_0x52885c[_0xa5dc('0x35')];if(!_0x529454[_0xa5dc('0x36')][_0xa5dc('0x3d')](_0xa5dc('0x5a'))){_0x568efd['limit']=qs['limit'](_0x529454['query'][_0xa5dc('0x1e')]);_0x568efd[_0xa5dc('0x20')]=qs[_0xa5dc('0x20')](_0x529454[_0xa5dc('0x36')][_0xa5dc('0x20')]);}_0x568efd[_0xa5dc('0x5b')]=qs[_0xa5dc('0x3e')](_0x529454[_0xa5dc('0x36')][_0xa5dc('0x3e')]);_0x568efd[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_['pick'](_0x529454[_0xa5dc('0x36')],_0x52885c[_0xa5dc('0x38')]));_0x568efd['where']['CampaignId']=_0x1d45e0['id'];if(_0x529454[_0xa5dc('0x36')][_0xa5dc('0x41')]){_0x568efd[_0xa5dc('0x3f')]=_['merge'](_0x568efd['where'],{'$or':_['map'](_0x568efd[_0xa5dc('0x39')],function(_0x36386a){var _0x815822={};_0x815822[_0x36386a]={'$like':'%'+_0x529454[_0xa5dc('0x36')][_0xa5dc('0x41')]+'%'};return _0x815822;})});}_0x568efd=_['merge']({},_0x568efd,_0x529454[_0xa5dc('0x44')]);return db['CmHopper']['count']({'where':_0x568efd['where']})['then'](function(_0x31e1bf){_0x3398ae[_0xa5dc('0x1f')]=_0x31e1bf;if(_0x529454[_0xa5dc('0x36')][_0xa5dc('0x52')]){_0x568efd[_0xa5dc('0x53')]=[{'all':!![]}];}return db[_0xa5dc('0x59')][_0xa5dc('0x45')](_0x568efd);})['then'](function(_0x89a87d){_0x3398ae[_0xa5dc('0x46')]=_0x89a87d;return _0x3398ae;});}})[_0xa5dc('0x25')](respondWithFilteredResult(_0xd17c2f,_0x568efd))[_0xa5dc('0x51')](handleError(_0xd17c2f,null));};exports['getHopperHistories']=function(_0xef06fd,_0x11063e,_0x326cfa){var _0x4b5cbb={'raw':!![],'where':{}};var _0x9ed2da={};var _0x2dd27b={'count':0x0,'rows':[]};return db[_0xa5dc('0x30')][_0xa5dc('0x5c')]({'where':{'id':_0xef06fd[_0xa5dc('0x48')]['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x11063e,null))[_0xa5dc('0x25')](function(_0x4822c6){if(_0x4822c6){_0x9ed2da[_0xa5dc('0x35')]=_[_0xa5dc('0x37')](db[_0xa5dc('0x5d')][_0xa5dc('0x31')]);_0x9ed2da[_0xa5dc('0x36')]=_['keys'](_0xef06fd[_0xa5dc('0x36')]);_0x9ed2da[_0xa5dc('0x38')]=_[_0xa5dc('0x3a')](_0x9ed2da[_0xa5dc('0x35')],_0x9ed2da[_0xa5dc('0x36')]);_0x4b5cbb[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x9ed2da[_0xa5dc('0x35')],qs[_0xa5dc('0x3b')](_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x3b')]));_0x4b5cbb['attributes']=_0x4b5cbb[_0xa5dc('0x39')][_0xa5dc('0x3c')]?_0x4b5cbb[_0xa5dc('0x39')]:_0x9ed2da['model'];if(!_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x3d')](_0xa5dc('0x5a'))){_0x4b5cbb[_0xa5dc('0x1e')]=qs['limit'](_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x1e')]);_0x4b5cbb[_0xa5dc('0x20')]=qs['offset'](_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x20')]);}_0x4b5cbb[_0xa5dc('0x5b')]=qs[_0xa5dc('0x3e')](_0xef06fd['query'][_0xa5dc('0x3e')]);_0x4b5cbb[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_[_0xa5dc('0x40')](_0xef06fd[_0xa5dc('0x36')],_0x9ed2da[_0xa5dc('0x38')]));_0x4b5cbb['where']['CampaignId']=_0x4822c6['id'];if(_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x41')]){_0x4b5cbb['where']=_[_0xa5dc('0x43')](_0x4b5cbb[_0xa5dc('0x3f')],{'$or':_[_0xa5dc('0x2f')](_0x4b5cbb[_0xa5dc('0x39')],function(_0x911df9){var _0x2021bb={};_0x2021bb[_0x911df9]={'$like':'%'+_0xef06fd[_0xa5dc('0x36')][_0xa5dc('0x41')]+'%'};return _0x2021bb;})});}_0x4b5cbb=_[_0xa5dc('0x43')]({},_0x4b5cbb,_0xef06fd[_0xa5dc('0x44')]);return db['CmHopperHistory'][_0xa5dc('0x1f')]({'where':_0x4b5cbb['where']})['then'](function(_0x54e83c){_0x2dd27b[_0xa5dc('0x1f')]=_0x54e83c;if(_0xef06fd['query'][_0xa5dc('0x52')]){_0x4b5cbb[_0xa5dc('0x53')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa5dc('0x45')](_0x4b5cbb);})[_0xa5dc('0x25')](function(_0xe15fb5){_0x2dd27b[_0xa5dc('0x46')]=_0xe15fb5;return _0x2dd27b;});}})['then'](respondWithFilteredResult(_0x11063e,_0x4b5cbb))['catch'](handleError(_0x11063e,null));};exports[_0xa5dc('0x5e')]=function(_0x1c00e7,_0x538507,_0x3b0529){var _0x2efa1c={'raw':!![],'where':{}};var _0x5eceea={};var _0x17b387={'count':0x0,'rows':[]};return db[_0xa5dc('0x30')][_0xa5dc('0x5c')]({'where':{'id':_0x1c00e7[_0xa5dc('0x48')]['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x538507,null))[_0xa5dc('0x25')](function(_0x46775e){if(_0x46775e){_0x5eceea['model']=_[_0xa5dc('0x37')](db['CmHopperFinal'][_0xa5dc('0x31')]);_0x5eceea['query']=_[_0xa5dc('0x37')](_0x1c00e7[_0xa5dc('0x36')]);_0x5eceea['filters']=_[_0xa5dc('0x3a')](_0x5eceea[_0xa5dc('0x35')],_0x5eceea[_0xa5dc('0x36')]);_0x2efa1c[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x5eceea['model'],qs[_0xa5dc('0x3b')](_0x1c00e7['query'][_0xa5dc('0x3b')]));_0x2efa1c[_0xa5dc('0x39')]=_0x2efa1c[_0xa5dc('0x39')]['length']?_0x2efa1c[_0xa5dc('0x39')]:_0x5eceea[_0xa5dc('0x35')];if(!_0x1c00e7[_0xa5dc('0x36')][_0xa5dc('0x3d')](_0xa5dc('0x5a'))){_0x2efa1c[_0xa5dc('0x1e')]=qs['limit'](_0x1c00e7[_0xa5dc('0x36')][_0xa5dc('0x1e')]);_0x2efa1c[_0xa5dc('0x20')]=qs['offset'](_0x1c00e7[_0xa5dc('0x36')][_0xa5dc('0x20')]);}_0x2efa1c[_0xa5dc('0x5b')]=qs[_0xa5dc('0x3e')](_0x1c00e7['query']['sort']);_0x2efa1c[_0xa5dc('0x3f')]=qs['filters'](_[_0xa5dc('0x40')](_0x1c00e7['query'],_0x5eceea[_0xa5dc('0x38')]));_0x2efa1c['where'][_0xa5dc('0x5f')]=_0x46775e['id'];if(_0x1c00e7[_0xa5dc('0x36')][_0xa5dc('0x41')]){_0x2efa1c[_0xa5dc('0x3f')]=_['merge'](_0x2efa1c['where'],{'$or':_[_0xa5dc('0x2f')](_0x2efa1c[_0xa5dc('0x39')],function(_0x2bfdec){var _0x2b2bae={};_0x2b2bae[_0x2bfdec]={'$like':'%'+_0x1c00e7[_0xa5dc('0x36')]['filter']+'%'};return _0x2b2bae;})});}_0x2efa1c=_[_0xa5dc('0x43')]({},_0x2efa1c,_0x1c00e7[_0xa5dc('0x44')]);return db[_0xa5dc('0x60')][_0xa5dc('0x1f')]({'where':_0x2efa1c[_0xa5dc('0x3f')]})[_0xa5dc('0x25')](function(_0x5101b7){_0x17b387['count']=_0x5101b7;if(_0x1c00e7[_0xa5dc('0x36')][_0xa5dc('0x52')]){_0x2efa1c[_0xa5dc('0x53')]=[{'all':!![]}];}return db[_0xa5dc('0x60')][_0xa5dc('0x45')](_0x2efa1c);})['then'](function(_0x527c39){_0x17b387['rows']=_0x527c39;return _0x17b387;});}})[_0xa5dc('0x25')](respondWithFilteredResult(_0x538507,_0x2efa1c))['catch'](handleError(_0x538507,null));};exports['getHopperBlacks']=function(_0x24ad5c,_0x140f73,_0x12ec3a){var _0x171b14={'raw':!![],'where':{}};var _0x52e167={};var _0x4707df={'count':0x0,'rows':[]};return db['Campaign'][_0xa5dc('0x5c')]({'where':{'id':_0x24ad5c['params']['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x140f73,null))[_0xa5dc('0x25')](function(_0x4d8d51){if(_0x4d8d51){_0x52e167[_0xa5dc('0x35')]=_['keys'](db[_0xa5dc('0x61')]['rawAttributes']);_0x52e167[_0xa5dc('0x36')]=_[_0xa5dc('0x37')](_0x24ad5c[_0xa5dc('0x36')]);_0x52e167[_0xa5dc('0x38')]=_[_0xa5dc('0x3a')](_0x52e167[_0xa5dc('0x35')],_0x52e167['query']);_0x171b14[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x52e167[_0xa5dc('0x35')],qs[_0xa5dc('0x3b')](_0x24ad5c[_0xa5dc('0x36')][_0xa5dc('0x3b')]));_0x171b14['attributes']=_0x171b14[_0xa5dc('0x39')]['length']?_0x171b14[_0xa5dc('0x39')]:_0x52e167[_0xa5dc('0x35')];if(!_0x24ad5c[_0xa5dc('0x36')]['hasOwnProperty'](_0xa5dc('0x5a'))){_0x171b14['limit']=qs['limit'](_0x24ad5c[_0xa5dc('0x36')][_0xa5dc('0x1e')]);_0x171b14[_0xa5dc('0x20')]=qs[_0xa5dc('0x20')](_0x24ad5c[_0xa5dc('0x36')]['offset']);}_0x171b14[_0xa5dc('0x5b')]=qs['sort'](_0x24ad5c['query'][_0xa5dc('0x3e')]);_0x171b14[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_['pick'](_0x24ad5c[_0xa5dc('0x36')],_0x52e167[_0xa5dc('0x38')]));_0x171b14['where'][_0xa5dc('0x5f')]=_0x4d8d51['id'];if(_0x24ad5c['query'][_0xa5dc('0x41')]){_0x171b14['where']=_[_0xa5dc('0x43')](_0x171b14['where'],{'$or':_[_0xa5dc('0x2f')](_0x171b14['attributes'],function(_0x4f314b){var _0x3bd657={};_0x3bd657[_0x4f314b]={'$like':'%'+_0x24ad5c[_0xa5dc('0x36')]['filter']+'%'};return _0x3bd657;})});}_0x171b14=_['merge']({},_0x171b14,_0x24ad5c['options']);return db[_0xa5dc('0x61')][_0xa5dc('0x1f')]({'where':_0x171b14[_0xa5dc('0x3f')]})[_0xa5dc('0x25')](function(_0x4726f6){_0x4707df[_0xa5dc('0x1f')]=_0x4726f6;if(_0x24ad5c[_0xa5dc('0x36')][_0xa5dc('0x52')]){_0x171b14[_0xa5dc('0x53')]=[{'all':!![]}];}return db[_0xa5dc('0x61')][_0xa5dc('0x45')](_0x171b14);})[_0xa5dc('0x25')](function(_0x2a021b){_0x4707df[_0xa5dc('0x46')]=_0x2a021b;return _0x4707df;});}})[_0xa5dc('0x25')](respondWithFilteredResult(_0x140f73,_0x171b14))[_0xa5dc('0x51')](handleError(_0x140f73,null));};exports['getLists']=function(_0x5cce6c,_0x473b6c,_0x5f3567){var _0x2f99a6={};var _0x557f1c={};var _0xf0ba5e;var _0x2e16d3;return db[_0xa5dc('0x30')][_0xa5dc('0x5c')]({'where':{'id':_0x5cce6c['params']['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x473b6c,null))[_0xa5dc('0x25')](function(_0x218c57){if(_0x218c57){_0xf0ba5e=_0x218c57;_0x557f1c[_0xa5dc('0x35')]=_[_0xa5dc('0x37')](db[_0xa5dc('0x62')][_0xa5dc('0x31')]);_0x557f1c[_0xa5dc('0x36')]=_[_0xa5dc('0x37')](_0x5cce6c[_0xa5dc('0x36')]);_0x557f1c[_0xa5dc('0x38')]=_['intersection'](_0x557f1c['model'],_0x557f1c[_0xa5dc('0x36')]);_0x2f99a6[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x557f1c[_0xa5dc('0x35')],qs[_0xa5dc('0x3b')](_0x5cce6c['query'][_0xa5dc('0x3b')]));_0x2f99a6[_0xa5dc('0x39')]=_0x2f99a6['attributes'][_0xa5dc('0x3c')]?_0x2f99a6['attributes']:_0x557f1c[_0xa5dc('0x35')];_0x2f99a6['order']=qs[_0xa5dc('0x3e')](_0x5cce6c[_0xa5dc('0x36')][_0xa5dc('0x3e')]);_0x2f99a6[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_[_0xa5dc('0x40')](_0x5cce6c[_0xa5dc('0x36')],_0x557f1c['filters']));if(_0x5cce6c['query'][_0xa5dc('0x41')]){_0x2f99a6[_0xa5dc('0x3f')]=_['merge'](_0x2f99a6['where'],{'$or':_['map'](_0x2f99a6['attributes'],function(_0x50246f){var _0x122aa2={};_0x122aa2[_0x50246f]={'$like':'%'+_0x5cce6c[_0xa5dc('0x36')][_0xa5dc('0x41')]+'%'};return _0x122aa2;})});}_0x2f99a6=_[_0xa5dc('0x43')]({},_0x2f99a6,_0x5cce6c[_0xa5dc('0x44')]);return _0xf0ba5e[_0xa5dc('0x63')](_0x2f99a6);}})[_0xa5dc('0x25')](function(_0x1d9dc1){if(_0x1d9dc1){_0x2e16d3=_0x1d9dc1[_0xa5dc('0x3c')];if(!_0x5cce6c['query']['hasOwnProperty']('nolimit')){_0x2f99a6[_0xa5dc('0x1e')]=qs[_0xa5dc('0x1e')](_0x5cce6c['query'][_0xa5dc('0x1e')]);_0x2f99a6['offset']=qs[_0xa5dc('0x20')](_0x5cce6c[_0xa5dc('0x36')][_0xa5dc('0x20')]);}return _0xf0ba5e[_0xa5dc('0x63')](_0x2f99a6);}})[_0xa5dc('0x25')](function(_0x2555f1){if(_0x2555f1){return _0x2555f1?{'count':_0x2e16d3,'rows':_0x2555f1}:null;}})['then'](respondWithResult(_0x473b6c,null))['catch'](handleError(_0x473b6c,null));};exports['addLists']=function(_0x2dfc44,_0x13029e,_0x5d8e49){var _0x519538,_0x4c4974;return db[_0xa5dc('0x30')]['find']({'where':{'id':_0x2dfc44['params']['id']}})['then'](handleEntityNotFound(_0x13029e,null))[_0xa5dc('0x25')](function(_0x3f0fcf){if(_0x3f0fcf){_0x4c4974=_0x3f0fcf;return _0x3f0fcf[_0xa5dc('0x64')](_0x2dfc44[_0xa5dc('0x4b')][_0xa5dc('0x65')],_[_0xa5dc('0x66')](_0x2dfc44['body'],['ids','id'])||{});}return null;})[_0xa5dc('0x67')](function(_0x14da1c){var _0x299055;_0x519538=_0x14da1c||[];var _0x3c0095=[];if(_0x14da1c){for(var _0xbeb74e=0x0;_0xbeb74e<_0x14da1c[_0xa5dc('0x3c')];_0xbeb74e+=0x1){var _0x11f85a=_0x14da1c[_0xbeb74e][_0xa5dc('0x26')]({'plain':!![]});_0x4c4974['dialCheckDuplicateType']=_0x2dfc44[_0xa5dc('0x4b')][_0xa5dc('0x68')]?_0x2dfc44['body'][_0xa5dc('0x68')]:_0x4c4974['dialCheckDuplicateType'];switch(_0x4c4974[_0xa5dc('0x68')]){case'always':_0x299055=squel[_0xa5dc('0x69')]()[_0xa5dc('0x6a')]('cm_hopper')[_0xa5dc('0x6b')](['phone',_0xa5dc('0x6c'),'ContactId','ListId',_0xa5dc('0x5f'),_0xa5dc('0x54'),_0xa5dc('0x55')],squel[_0xa5dc('0x6d')]()[_0xa5dc('0x6e')]('phone','phone')[_0xa5dc('0x6e')]('NOW()',_0xa5dc('0x6c'))[_0xa5dc('0x6e')]('id',_0xa5dc('0x6f'))[_0xa5dc('0x6e')](_0x11f85a['CmListId'][_0xa5dc('0x70')](),_0xa5dc('0x71'))[_0xa5dc('0x6e')](_0x2dfc44[_0xa5dc('0x48')]['id']['toString'](),_0xa5dc('0x5f'))['field'](_0xa5dc('0x72'),_0xa5dc('0x54'))[_0xa5dc('0x6e')](_0xa5dc('0x72'),_0xa5dc('0x55'))['from'](_0xa5dc('0x73'))[_0xa5dc('0x3f')](_0xa5dc('0x74'))[_0xa5dc('0x3f')](_0xa5dc('0x75'),_0x11f85a[_0xa5dc('0x76')]['toString']())[_0xa5dc('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xa5dc('0x77'),squel[_0xa5dc('0x6d')]()[_0xa5dc('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0xa5dc('0x78')](_0xa5dc('0x79'))['where'](_0xa5dc('0x7a'),_0x2dfc44[_0xa5dc('0x48')]['id'][_0xa5dc('0x70')]()))[_0xa5dc('0x3f')](_0xa5dc('0x77'),squel[_0xa5dc('0x6d')]()['field'](_0xa5dc('0x7b'))[_0xa5dc('0x78')](_0xa5dc('0x7c'))[_0xa5dc('0x3f')]('CampaignId\x20=\x20?',_0x2dfc44[_0xa5dc('0x48')]['id'][_0xa5dc('0x70')]())))[_0xa5dc('0x70')]();break;case _0xa5dc('0x7d'):_0x299055=squel[_0xa5dc('0x69')]()[_0xa5dc('0x6a')]('cm_hopper')['fromQuery']([_0xa5dc('0x7e'),_0xa5dc('0x6c'),_0xa5dc('0x6f'),_0xa5dc('0x71'),'CampaignId',_0xa5dc('0x54'),_0xa5dc('0x55')],squel[_0xa5dc('0x6d')]()[_0xa5dc('0x6e')](_0xa5dc('0x7e'),_0xa5dc('0x7e'))[_0xa5dc('0x6e')](_0xa5dc('0x72'),'scheduledAt')['field']('id',_0xa5dc('0x6f'))[_0xa5dc('0x6e')](_0x11f85a[_0xa5dc('0x76')][_0xa5dc('0x70')](),_0xa5dc('0x71'))[_0xa5dc('0x6e')](_0x2dfc44['params']['id'][_0xa5dc('0x70')](),_0xa5dc('0x5f'))[_0xa5dc('0x6e')](_0xa5dc('0x72'),_0xa5dc('0x54'))['field'](_0xa5dc('0x72'),'updatedAt')[_0xa5dc('0x78')](_0xa5dc('0x73'))[_0xa5dc('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa5dc('0x3f')](_0xa5dc('0x75'),_0x11f85a[_0xa5dc('0x76')][_0xa5dc('0x70')]())['where'](_0xa5dc('0x7f'))[_0xa5dc('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa5dc('0x6d')]()[_0xa5dc('0x6e')](_0xa5dc('0x7b'))[_0xa5dc('0x78')](_0xa5dc('0x7c'))[_0xa5dc('0x3f')]('CampaignId\x20=\x20?',_0x2dfc44[_0xa5dc('0x48')]['id']['toString']())))[_0xa5dc('0x70')]();break;default:_0x299055=squel['insert']()[_0xa5dc('0x6a')](_0xa5dc('0x7c'))[_0xa5dc('0x6b')]([_0xa5dc('0x7e'),_0xa5dc('0x6c'),_0xa5dc('0x6f'),_0xa5dc('0x71'),'CampaignId',_0xa5dc('0x54'),'updatedAt'],squel[_0xa5dc('0x6d')]()['field'](_0xa5dc('0x7e'),'phone')['field'](_0xa5dc('0x72'),_0xa5dc('0x6c'))[_0xa5dc('0x6e')]('id','ContactId')[_0xa5dc('0x6e')](_0x11f85a[_0xa5dc('0x76')][_0xa5dc('0x70')](),'ListId')[_0xa5dc('0x6e')](_0x2dfc44[_0xa5dc('0x48')]['id'][_0xa5dc('0x70')](),_0xa5dc('0x5f'))['field'](_0xa5dc('0x72'),_0xa5dc('0x54'))['field'](_0xa5dc('0x72'),_0xa5dc('0x55'))[_0xa5dc('0x78')](_0xa5dc('0x73'))['where'](_0xa5dc('0x74'))[_0xa5dc('0x3f')]('ListId\x20=\x20?',_0x11f85a[_0xa5dc('0x76')][_0xa5dc('0x70')]())['where'](_0xa5dc('0x7f')))[_0xa5dc('0x70')]();}_0x3c0095[_0xa5dc('0x80')](db['sequelize'][_0xa5dc('0x36')](_0x299055));}return BPromise[_0xa5dc('0x81')](_0x3c0095);}})['then'](function(){return _0x519538;})[_0xa5dc('0x25')](respondWithResult(_0x13029e,null))[_0xa5dc('0x51')](handleError(_0x13029e,null));};exports[_0xa5dc('0x82')]=function(_0x2c6648,_0x1c538e,_0x2e052e){return db[_0xa5dc('0x30')]['find']({'where':{'id':_0x2c6648['params']['id']}})['then'](handleEntityNotFound(_0x1c538e,null))['then'](function(_0x263b61){if(_0x263b61){return _0x263b61[_0xa5dc('0x82')](_0x2c6648[_0xa5dc('0x36')][_0xa5dc('0x65')]);}})[_0xa5dc('0x25')](function(_0x79ea41){if(_0x79ea41){return db[_0xa5dc('0x59')][_0xa5dc('0x29')]({'where':{'ListId':_0x2c6648['query']['ids'],'CampaignId':_0x2c6648[_0xa5dc('0x48')]['id']}})[_0xa5dc('0x25')](function(){return _0x79ea41;});}})[_0xa5dc('0x25')](respondWithStatusCode(_0x1c538e,null))[_0xa5dc('0x51')](handleError(_0x1c538e,null));};exports[_0xa5dc('0x83')]=function(_0x4c4564,_0x15faeb,_0x57a08d){var _0x46f369={};var _0x3aa164={};var _0x4a0691;var _0x45cb08;return db[_0xa5dc('0x30')]['findOne']({'where':{'id':_0x4c4564[_0xa5dc('0x48')]['id']}})['then'](handleEntityNotFound(_0x15faeb,null))[_0xa5dc('0x25')](function(_0x1e4f0f){if(_0x1e4f0f){_0x4a0691=_0x1e4f0f;_0x3aa164[_0xa5dc('0x35')]=_[_0xa5dc('0x37')](db[_0xa5dc('0x62')][_0xa5dc('0x31')]);_0x3aa164[_0xa5dc('0x36')]=_['keys'](_0x4c4564[_0xa5dc('0x36')]);_0x3aa164[_0xa5dc('0x38')]=_[_0xa5dc('0x3a')](_0x3aa164['model'],_0x3aa164[_0xa5dc('0x36')]);_0x46f369[_0xa5dc('0x39')]=_[_0xa5dc('0x3a')](_0x3aa164[_0xa5dc('0x35')],qs['fields'](_0x4c4564[_0xa5dc('0x36')][_0xa5dc('0x3b')]));_0x46f369[_0xa5dc('0x39')]=_0x46f369[_0xa5dc('0x39')][_0xa5dc('0x3c')]?_0x46f369[_0xa5dc('0x39')]:_0x3aa164[_0xa5dc('0x35')];_0x46f369['order']=qs[_0xa5dc('0x3e')](_0x4c4564[_0xa5dc('0x36')][_0xa5dc('0x3e')]);_0x46f369[_0xa5dc('0x3f')]=qs[_0xa5dc('0x38')](_[_0xa5dc('0x40')](_0x4c4564[_0xa5dc('0x36')],_0x3aa164[_0xa5dc('0x38')]));if(_0x4c4564[_0xa5dc('0x36')][_0xa5dc('0x41')]){_0x46f369['where']=_[_0xa5dc('0x43')](_0x46f369[_0xa5dc('0x3f')],{'$or':_[_0xa5dc('0x2f')](_0x46f369[_0xa5dc('0x39')],function(_0xba4619){var _0x22ce21={};_0x22ce21[_0xba4619]={'$like':'%'+_0x4c4564['query'][_0xa5dc('0x41')]+'%'};return _0x22ce21;})});}_0x46f369=_[_0xa5dc('0x43')]({},_0x46f369,_0x4c4564['options']);return _0x4a0691[_0xa5dc('0x83')](_0x46f369);}})[_0xa5dc('0x25')](function(_0x3ee9b3){if(_0x3ee9b3){_0x45cb08=_0x3ee9b3['length'];if(!_0x4c4564['query'][_0xa5dc('0x3d')](_0xa5dc('0x5a'))){_0x46f369[_0xa5dc('0x1e')]=qs['limit'](_0x4c4564[_0xa5dc('0x36')][_0xa5dc('0x1e')]);_0x46f369['offset']=qs[_0xa5dc('0x20')](_0x4c4564['query'][_0xa5dc('0x20')]);}return _0x4a0691['getBlackLists'](_0x46f369);}})[_0xa5dc('0x25')](function(_0x3fedeb){if(_0x3fedeb){return _0x3fedeb?{'count':_0x45cb08,'rows':_0x3fedeb}:null;}})[_0xa5dc('0x25')](respondWithResult(_0x15faeb,null))['catch'](handleError(_0x15faeb,null));};exports['addBlackLists']=function(_0x7052e0,_0x23f300,_0x1699a0){var _0x1bcca2,_0x55c835;return db[_0xa5dc('0x30')]['find']({'where':{'id':_0x7052e0['params']['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x23f300,null))['then'](function(_0x25dbb3){if(_0x25dbb3){_0x55c835=_0x25dbb3;return _0x25dbb3[_0xa5dc('0x84')](_0x7052e0[_0xa5dc('0x4b')]['ids'],_[_0xa5dc('0x66')](_0x7052e0[_0xa5dc('0x4b')],[_0xa5dc('0x65'),'id'])||{});}return null;})[_0xa5dc('0x67')](function(_0x3f8709){var _0x513bbe;_0x1bcca2=_0x3f8709||[];var _0x208b11=[];if(_0x3f8709){for(var _0x341e7c=0x0;_0x341e7c<_0x3f8709[_0xa5dc('0x3c')];_0x341e7c+=0x1){var _0x9aa40c=_0x3f8709[_0x341e7c][_0xa5dc('0x26')]({'plain':!![]});_0x513bbe=squel['insert']()['into'](_0xa5dc('0x85'))[_0xa5dc('0x6b')]([_0xa5dc('0x7e'),'ContactId',_0xa5dc('0x71'),_0xa5dc('0x5f'),_0xa5dc('0x54'),_0xa5dc('0x55')],squel[_0xa5dc('0x6d')]()[_0xa5dc('0x6e')](_0xa5dc('0x7e'),_0xa5dc('0x7e'))[_0xa5dc('0x6e')]('id',_0xa5dc('0x6f'))['field'](_0x9aa40c[_0xa5dc('0x76')][_0xa5dc('0x70')](),'ListId')[_0xa5dc('0x6e')](_0x7052e0['params']['id']['toString'](),_0xa5dc('0x5f'))[_0xa5dc('0x6e')](_0xa5dc('0x72'),_0xa5dc('0x54'))[_0xa5dc('0x6e')]('NOW()',_0xa5dc('0x55'))['from'](_0xa5dc('0x73'))[_0xa5dc('0x3f')](_0xa5dc('0x74'))[_0xa5dc('0x3f')](_0xa5dc('0x75'),_0x9aa40c['CmListId'][_0xa5dc('0x70')]())[_0xa5dc('0x3f')](_0xa5dc('0x7f')))['toString']();_0x208b11[_0xa5dc('0x80')](db[_0xa5dc('0x86')][_0xa5dc('0x36')](_0x513bbe));}return BPromise['all'](_0x208b11);}})[_0xa5dc('0x25')](function(){return _0x1bcca2;})[_0xa5dc('0x25')](respondWithResult(_0x23f300,null))[_0xa5dc('0x51')](handleError(_0x23f300,null));};exports[_0xa5dc('0x87')]=function(_0x1d400f,_0x31271b,_0x24f568){return db[_0xa5dc('0x30')][_0xa5dc('0x49')]({'where':{'id':_0x1d400f[_0xa5dc('0x48')]['id']}})[_0xa5dc('0x25')](handleEntityNotFound(_0x31271b,null))[_0xa5dc('0x25')](function(_0x42f030){if(_0x42f030){return _0x42f030[_0xa5dc('0x87')](_0x1d400f[_0xa5dc('0x36')][_0xa5dc('0x65')]);}})[_0xa5dc('0x25')](function(_0x40ebfe){if(_0x40ebfe){return db[_0xa5dc('0x61')][_0xa5dc('0x29')]({'where':{'ListId':_0x1d400f[_0xa5dc('0x36')][_0xa5dc('0x65')],'CampaignId':_0x1d400f['params']['id']}})['then'](function(){return _0x40ebfe;});}})[_0xa5dc('0x25')](respondWithStatusCode(_0x31271b,null))[_0xa5dc('0x51')](handleError(_0x31271b,null));}; \ No newline at end of file +var _0x667f=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Campaign','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','role','params','getHoppers','findOne','keys','nolimit','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','insert','cm_contacts','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x3a096c,_0x440950){var _0x25173a=function(_0x341a97){while(--_0x341a97){_0x3a096c['push'](_0x3a096c['shift']());}};_0x25173a(++_0x440950);}(_0x667f,0xd7));var _0xf667=function(_0x2936d8,_0x2e415a){_0x2936d8=_0x2936d8-0x0;var _0x194e7b=_0x667f[_0x2936d8];return _0x194e7b;};'use strict';var emlformat=require(_0xf667('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf667('0x1'));var moment=require(_0xf667('0x2'));var BPromise=require(_0xf667('0x3'));var Mustache=require(_0xf667('0x4'));var util=require(_0xf667('0x5'));var path=require(_0xf667('0x6'));var sox=require('sox');var csv=require(_0xf667('0x7'));var ejs=require(_0xf667('0x8'));var fs=require('fs');var fs_extra=require(_0xf667('0x9'));var _=require(_0xf667('0xa'));var squel=require(_0xf667('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf667('0x7'));var querystring=require(_0xf667('0xc'));var Papa=require('papaparse');var Redis=require(_0xf667('0xd'));var authService=require(_0xf667('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf667('0xf'));var hardwareService=require(_0xf667('0x10'));var logger=require(_0xf667('0x11'))(_0xf667('0x12'));var utils=require(_0xf667('0x13'));var config=require(_0xf667('0x14'));var licenseUtil=require(_0xf667('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18191c,_0xd26c39){_0xd26c39=_0xd26c39||0xcc;return function(_0x40d3f4){if(_0x40d3f4){return _0x18191c[_0xf667('0x16')](_0xd26c39);}return _0x18191c[_0xf667('0x17')](_0xd26c39)[_0xf667('0x18')]();};}function respondWithResult(_0x42291d,_0xacafb3){_0xacafb3=_0xacafb3||0xc8;return function(_0x4cf66f){if(_0x4cf66f){return _0x42291d[_0xf667('0x17')](_0xacafb3)[_0xf667('0x19')](_0x4cf66f);}};}function respondWithFilteredResult(_0x32d0c7,_0x53d2c8){return function(_0x5c7b45){if(_0x5c7b45){var _0x11ac7f=typeof _0x53d2c8[_0xf667('0x1a')]===_0xf667('0x1b')&&typeof _0x53d2c8['limit']===_0xf667('0x1b');var _0x2dbacb=_0x5c7b45[_0xf667('0x1c')];var _0x2a3ca1=_0x11ac7f?0x0:_0x53d2c8[_0xf667('0x1a')];var _0x43d1d9=_0x11ac7f?_0x5c7b45['count']:_0x53d2c8[_0xf667('0x1a')]+_0x53d2c8[_0xf667('0x1d')];var _0x1023d3;if(_0x43d1d9>=_0x2dbacb){_0x43d1d9=_0x2dbacb;_0x1023d3=0xc8;}else{_0x1023d3=0xce;}_0x32d0c7[_0xf667('0x17')](_0x1023d3);return _0x32d0c7[_0xf667('0x1e')](_0xf667('0x1f'),_0x2a3ca1+'-'+_0x43d1d9+'/'+_0x2dbacb)[_0xf667('0x19')](_0x5c7b45);}return null;};}function patchUpdates(_0x2df328){return function(_0x47b20b){try{jsonpatch[_0xf667('0x20')](_0x47b20b,_0x2df328,!![]);}catch(_0x2518e5){return BPromise[_0xf667('0x21')](_0x2518e5);}return _0x47b20b[_0xf667('0x22')]();};}function saveUpdates(_0x356fda,_0x3526e5){return function(_0x365599){if(_0x365599){return _0x365599['update'](_0x356fda)[_0xf667('0x23')](function(_0x591fba){return _0x591fba;});}return null;};}function removeEntity(_0x88efc1,_0x27b29a){return function(_0x113dbc){if(_0x113dbc){return _0x113dbc[_0xf667('0x24')]()[_0xf667('0x23')](function(){var _0x5771e3=_0x113dbc[_0xf667('0x25')]({'plain':!![]});var _0x1ecb84=_0xf667('0x26');return db[_0xf667('0x27')]['destroy']({'where':{'type':_0x1ecb84,'resourceId':_0x5771e3['id']}})['then'](function(){return _0x113dbc;});})['then'](function(){_0x88efc1[_0xf667('0x17')](0xcc)[_0xf667('0x18')]();});}};}function handleEntityNotFound(_0x38abea,_0xa306e1){return function(_0x155668){if(!_0x155668){_0x38abea[_0xf667('0x16')](0x194);}return _0x155668;};}function handleError(_0x10476a,_0x48fa0a){_0x48fa0a=_0x48fa0a||0x1f4;return function(_0x3ed845){logger[_0xf667('0x28')](_0x3ed845[_0xf667('0x29')]);if(_0x3ed845[_0xf667('0x2a')]){delete _0x3ed845[_0xf667('0x2a')];}_0x10476a['status'](_0x48fa0a)[_0xf667('0x2b')](_0x3ed845);};}exports['index']=function(_0x32a781,_0x38684f){var _0x2dd6a1={},_0x42de82={},_0x546fd5={'count':0x0,'rows':[]};var _0xc89eea=_[_0xf667('0x2c')](db['Campaign'][_0xf667('0x2d')],function(_0x424cff){return{'name':_0x424cff[_0xf667('0x2e')],'type':_0x424cff[_0xf667('0x2f')][_0xf667('0x30')]};});_0x42de82[_0xf667('0x31')]=_[_0xf667('0x2c')](_0xc89eea,_0xf667('0x2a'));_0x42de82[_0xf667('0x32')]=_['keys'](_0x32a781['query']);_0x42de82[_0xf667('0x33')]=_[_0xf667('0x34')](_0x42de82[_0xf667('0x31')],_0x42de82[_0xf667('0x32')]);_0x2dd6a1[_0xf667('0x35')]=_[_0xf667('0x34')](_0x42de82['model'],qs['fields'](_0x32a781[_0xf667('0x32')][_0xf667('0x36')]));_0x2dd6a1[_0xf667('0x35')]=_0x2dd6a1[_0xf667('0x35')][_0xf667('0x37')]?_0x2dd6a1[_0xf667('0x35')]:_0x42de82[_0xf667('0x31')];if(!_0x32a781['query'][_0xf667('0x38')]('nolimit')){_0x2dd6a1[_0xf667('0x1d')]=qs[_0xf667('0x1d')](_0x32a781[_0xf667('0x32')][_0xf667('0x1d')]);_0x2dd6a1[_0xf667('0x1a')]=qs['offset'](_0x32a781['query'][_0xf667('0x1a')]);}_0x2dd6a1[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x32a781['query'][_0xf667('0x3a')]);_0x2dd6a1[_0xf667('0x3b')]=qs[_0xf667('0x33')](_[_0xf667('0x3c')](_0x32a781['query'],_0x42de82[_0xf667('0x33')]),_0xc89eea);if(_0x32a781[_0xf667('0x32')][_0xf667('0x3d')]){_0x2dd6a1[_0xf667('0x3b')]=_[_0xf667('0x3e')](_0x2dd6a1['where'],{'$or':_['map'](_0xc89eea,function(_0x16243d){if(_0x16243d[_0xf667('0x2f')]!==_0xf667('0x3f')){var _0x278704={};_0x278704[_0x16243d[_0xf667('0x2a')]]={'$like':'%'+_0x32a781['query']['filter']+'%'};return _0x278704;}})});}_0x2dd6a1=_[_0xf667('0x3e')]({},_0x2dd6a1,_0x32a781[_0xf667('0x40')]);var _0x4a17d1={'where':_0x2dd6a1[_0xf667('0x3b')]};return db['Campaign'][_0xf667('0x1c')](_0x4a17d1)[_0xf667('0x23')](function(_0x2b0ec9){_0x546fd5['count']=_0x2b0ec9;if(_0x32a781[_0xf667('0x32')][_0xf667('0x41')]){_0x2dd6a1[_0xf667('0x42')]=[{'all':!![]}];}return db['Campaign'][_0xf667('0x43')](_0x2dd6a1);})[_0xf667('0x23')](function(_0x524bc9){_0x546fd5[_0xf667('0x44')]=_0x524bc9;return _0x546fd5;})[_0xf667('0x23')](respondWithFilteredResult(_0x38684f,_0x2dd6a1))['catch'](handleError(_0x38684f,null));};exports[_0xf667('0x45')]=function(_0x5cebe8,_0x103097){var _0x1b0ab7={'raw':![],'where':{'id':_0x5cebe8['params']['id']}},_0x53b86b={};_0x53b86b['model']=_['keys'](db[_0xf667('0x46')][_0xf667('0x2d')]);_0x53b86b[_0xf667('0x32')]=_['keys'](_0x5cebe8[_0xf667('0x32')]);_0x53b86b[_0xf667('0x33')]=_['intersection'](_0x53b86b[_0xf667('0x31')],_0x53b86b['query']);_0x1b0ab7[_0xf667('0x35')]=_[_0xf667('0x34')](_0x53b86b['model'],qs['fields'](_0x5cebe8['query']['fields']));_0x1b0ab7[_0xf667('0x35')]=_0x1b0ab7[_0xf667('0x35')]['length']?_0x1b0ab7['attributes']:_0x53b86b['model'];if(_0x5cebe8[_0xf667('0x32')][_0xf667('0x41')]){_0x1b0ab7[_0xf667('0x42')]=[{'all':!![]}];}_0x1b0ab7=_[_0xf667('0x3e')]({},_0x1b0ab7,_0x5cebe8[_0xf667('0x40')]);return db['Campaign']['find'](_0x1b0ab7)[_0xf667('0x23')](handleEntityNotFound(_0x103097,null))[_0xf667('0x23')](respondWithResult(_0x103097,null))['catch'](handleError(_0x103097,null));};exports['create']=function(_0x2bd50b,_0x38b07b){return db['Campaign']['create'](_0x2bd50b[_0xf667('0x47')],{})[_0xf667('0x23')](function(_0x4c0e35){var _0x51800f=_0x2bd50b[_0xf667('0x48')][_0xf667('0x25')]({'plain':!![]});if(!_0x51800f)throw new Error(_0xf667('0x49'));if(_0x51800f['role']===_0xf667('0x48')){var _0x53a69b=_0x4c0e35['get']({'plain':!![]});var _0x1f6e5e=_0xf667('0x26');return db[_0xf667('0x4a')]['find']({'where':{'name':_0x1f6e5e,'userProfileId':_0x51800f[_0xf667('0x4b')]},'raw':!![]})[_0xf667('0x23')](function(_0x3c2109){if(_0x3c2109&&_0x3c2109[_0xf667('0x4c')]===0x0){return db['UserProfileResource'][_0xf667('0x4d')]({'name':_0x53a69b[_0xf667('0x2a')],'resourceId':_0x53a69b['id'],'type':_0x3c2109[_0xf667('0x2a')],'sectionId':_0x3c2109['id']},{})[_0xf667('0x23')](function(){return _0x4c0e35;});}else{return _0x4c0e35;}})[_0xf667('0x4e')](function(_0x1488f4){logger[_0xf667('0x28')](_0xf667('0x4f'),_0x1488f4);throw _0x1488f4;});}return _0x4c0e35;})[_0xf667('0x23')](respondWithResult(_0x38b07b,0xc9))[_0xf667('0x4e')](handleError(_0x38b07b,null));};exports[_0xf667('0x50')]=function(_0x54c42c,_0x5793d1){var _0x47331e={'where':{'id':_0x54c42c['params']['id']}},_0xf17602={};_0xf17602['model']=_['keys'](db[_0xf667('0x46')][_0xf667('0x2d')]);_0x47331e[_0xf667('0x35')]=_[_0xf667('0x34')](_0xf17602[_0xf667('0x31')],qs[_0xf667('0x36')](_0x54c42c[_0xf667('0x32')][_0xf667('0x36')]));_0x47331e[_0xf667('0x35')]=_0x47331e[_0xf667('0x35')][_0xf667('0x37')]?_0x47331e[_0xf667('0x35')]:_0xf17602[_0xf667('0x31')];if(_0x54c42c[_0xf667('0x32')][_0xf667('0x41')]){_0x47331e[_0xf667('0x42')]=[{'all':!![]}];}_0x47331e=_[_0xf667('0x3e')]({},_0x47331e,_0x54c42c[_0xf667('0x40')]);return db['Campaign'][_0xf667('0x51')](_0x47331e)[_0xf667('0x23')](handleEntityNotFound(_0x5793d1,null))[_0xf667('0x23')](function(_0x2c2019){if(_0x2c2019){var _0x2f5f98=_0x2c2019['get']({'plain':!![]});_0x2f5f98=qs[_0xf667('0x52')](_0x2f5f98,['id',_0xf667('0x53'),_0xf667('0x54')]);_0x54c42c[_0xf667('0x47')]=_[_0xf667('0x52')](_0x54c42c[_0xf667('0x47')],['id',_0xf667('0x53'),_0xf667('0x54')]);return db[_0xf667('0x46')][_0xf667('0x4d')](_[_0xf667('0x3e')](_0x2f5f98,_0x54c42c[_0xf667('0x47')]),{'include':_0x54c42c[_0xf667('0x32')][_0xf667('0x41')]?[{'all':!![]}]:undefined})[_0xf667('0x23')](function(_0xd60942){var _0x492910=_0x54c42c[_0xf667('0x48')]['get']({'plain':!![]});if(!_0x492910)throw new Error(_0xf667('0x49'));if(_0x492910[_0xf667('0x55')]===_0xf667('0x48')){var _0x545eed=_0xd60942[_0xf667('0x25')]({'plain':!![]});var _0xbe9ac5='IvrCampaigns';return db[_0xf667('0x4a')][_0xf667('0x51')]({'where':{'name':_0xbe9ac5,'userProfileId':_0x492910[_0xf667('0x4b')]},'raw':!![]})[_0xf667('0x23')](function(_0x27afc5){if(_0x27afc5&&_0x27afc5[_0xf667('0x4c')]===0x0){return db[_0xf667('0x27')][_0xf667('0x4d')]({'name':_0x545eed[_0xf667('0x2a')],'resourceId':_0x545eed['id'],'type':_0x27afc5[_0xf667('0x2a')],'sectionId':_0x27afc5['id']},{})[_0xf667('0x23')](function(){return _0xd60942;});}else{return _0xd60942;}})[_0xf667('0x4e')](function(_0x27f0e4){logger[_0xf667('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27f0e4);throw _0x27f0e4;});}return _0xd60942;});}})[_0xf667('0x23')](respondWithResult(_0x5793d1,0xc9))[_0xf667('0x4e')](handleError(_0x5793d1,null));};exports['update']=function(_0x356967,_0xc4a95a){if(_0x356967[_0xf667('0x47')]['id']){delete _0x356967[_0xf667('0x47')]['id'];}return db['Campaign'][_0xf667('0x51')]({'where':{'id':_0x356967[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0xc4a95a,null))[_0xf667('0x23')](saveUpdates(_0x356967[_0xf667('0x47')],null))[_0xf667('0x23')](respondWithResult(_0xc4a95a,null))[_0xf667('0x4e')](handleError(_0xc4a95a,null));};exports[_0xf667('0x24')]=function(_0x5ec5bd,_0x4d1c9f){return db[_0xf667('0x46')]['find']({'where':{'id':_0x5ec5bd[_0xf667('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d1c9f,null))[_0xf667('0x23')](removeEntity(_0x4d1c9f,null))[_0xf667('0x4e')](handleError(_0x4d1c9f,null));};exports[_0xf667('0x57')]=function(_0x1292ac,_0x41a531,_0x29e344){var _0x4f696c={'raw':!![],'where':{}};var _0x4ba6ad={};var _0x53d070={'count':0x0,'rows':[]};return db[_0xf667('0x46')][_0xf667('0x58')]({'where':{'id':_0x1292ac[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x41a531,null))[_0xf667('0x23')](function(_0x2a82e0){if(_0x2a82e0){_0x4ba6ad['model']=_[_0xf667('0x59')](db['CmHopper'][_0xf667('0x2d')]);_0x4ba6ad[_0xf667('0x32')]=_[_0xf667('0x59')](_0x1292ac[_0xf667('0x32')]);_0x4ba6ad[_0xf667('0x33')]=_[_0xf667('0x34')](_0x4ba6ad[_0xf667('0x31')],_0x4ba6ad['query']);_0x4f696c['attributes']=_[_0xf667('0x34')](_0x4ba6ad['model'],qs[_0xf667('0x36')](_0x1292ac['query']['fields']));_0x4f696c['attributes']=_0x4f696c['attributes'][_0xf667('0x37')]?_0x4f696c[_0xf667('0x35')]:_0x4ba6ad[_0xf667('0x31')];if(!_0x1292ac['query'][_0xf667('0x38')](_0xf667('0x5a'))){_0x4f696c[_0xf667('0x1d')]=qs[_0xf667('0x1d')](_0x1292ac[_0xf667('0x32')][_0xf667('0x1d')]);_0x4f696c[_0xf667('0x1a')]=qs[_0xf667('0x1a')](_0x1292ac[_0xf667('0x32')][_0xf667('0x1a')]);}_0x4f696c[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x1292ac[_0xf667('0x32')][_0xf667('0x3a')]);_0x4f696c[_0xf667('0x3b')]=qs['filters'](_[_0xf667('0x3c')](_0x1292ac[_0xf667('0x32')],_0x4ba6ad['filters']));_0x4f696c[_0xf667('0x3b')][_0xf667('0x5b')]=_0x2a82e0['id'];if(_0x1292ac[_0xf667('0x32')][_0xf667('0x3d')]){_0x4f696c[_0xf667('0x3b')]=_[_0xf667('0x3e')](_0x4f696c['where'],{'$or':_[_0xf667('0x2c')](_0x4f696c['attributes'],function(_0x486a2b){var _0x58c798={};_0x58c798[_0x486a2b]={'$like':'%'+_0x1292ac[_0xf667('0x32')][_0xf667('0x3d')]+'%'};return _0x58c798;})});}_0x4f696c=_[_0xf667('0x3e')]({},_0x4f696c,_0x1292ac[_0xf667('0x40')]);return db[_0xf667('0x5c')][_0xf667('0x1c')]({'where':_0x4f696c['where']})[_0xf667('0x23')](function(_0xeadd64){_0x53d070[_0xf667('0x1c')]=_0xeadd64;if(_0x1292ac[_0xf667('0x32')][_0xf667('0x41')]){_0x4f696c[_0xf667('0x42')]=[{'all':!![]}];}return db[_0xf667('0x5c')][_0xf667('0x43')](_0x4f696c);})[_0xf667('0x23')](function(_0x3741c9){_0x53d070[_0xf667('0x44')]=_0x3741c9;return _0x53d070;});}})[_0xf667('0x23')](respondWithFilteredResult(_0x41a531,_0x4f696c))[_0xf667('0x4e')](handleError(_0x41a531,null));};exports[_0xf667('0x5d')]=function(_0x269bea,_0x263c78,_0x1ca672){var _0x28f356={'raw':!![],'where':{}};var _0x1e44c1={};var _0x25fe40={'count':0x0,'rows':[]};return db[_0xf667('0x46')][_0xf667('0x58')]({'where':{'id':_0x269bea[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x263c78,null))[_0xf667('0x23')](function(_0x3c70f2){if(_0x3c70f2){_0x1e44c1['model']=_[_0xf667('0x59')](db[_0xf667('0x5e')][_0xf667('0x2d')]);_0x1e44c1['query']=_['keys'](_0x269bea[_0xf667('0x32')]);_0x1e44c1[_0xf667('0x33')]=_[_0xf667('0x34')](_0x1e44c1[_0xf667('0x31')],_0x1e44c1['query']);_0x28f356[_0xf667('0x35')]=_[_0xf667('0x34')](_0x1e44c1['model'],qs[_0xf667('0x36')](_0x269bea['query']['fields']));_0x28f356['attributes']=_0x28f356[_0xf667('0x35')][_0xf667('0x37')]?_0x28f356[_0xf667('0x35')]:_0x1e44c1[_0xf667('0x31')];if(!_0x269bea['query'][_0xf667('0x38')](_0xf667('0x5a'))){_0x28f356[_0xf667('0x1d')]=qs['limit'](_0x269bea[_0xf667('0x32')][_0xf667('0x1d')]);_0x28f356[_0xf667('0x1a')]=qs[_0xf667('0x1a')](_0x269bea['query'][_0xf667('0x1a')]);}_0x28f356[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x269bea['query'][_0xf667('0x3a')]);_0x28f356['where']=qs[_0xf667('0x33')](_['pick'](_0x269bea[_0xf667('0x32')],_0x1e44c1[_0xf667('0x33')]));_0x28f356[_0xf667('0x3b')][_0xf667('0x5b')]=_0x3c70f2['id'];if(_0x269bea[_0xf667('0x32')][_0xf667('0x3d')]){_0x28f356[_0xf667('0x3b')]=_[_0xf667('0x3e')](_0x28f356[_0xf667('0x3b')],{'$or':_[_0xf667('0x2c')](_0x28f356[_0xf667('0x35')],function(_0x47e677){var _0x2ba145={};_0x2ba145[_0x47e677]={'$like':'%'+_0x269bea[_0xf667('0x32')][_0xf667('0x3d')]+'%'};return _0x2ba145;})});}_0x28f356=_[_0xf667('0x3e')]({},_0x28f356,_0x269bea[_0xf667('0x40')]);return db[_0xf667('0x5e')][_0xf667('0x1c')]({'where':_0x28f356['where']})[_0xf667('0x23')](function(_0x5175dd){_0x25fe40[_0xf667('0x1c')]=_0x5175dd;if(_0x269bea['query'][_0xf667('0x41')]){_0x28f356[_0xf667('0x42')]=[{'all':!![]}];}return db[_0xf667('0x5e')][_0xf667('0x43')](_0x28f356);})[_0xf667('0x23')](function(_0x54cb54){_0x25fe40[_0xf667('0x44')]=_0x54cb54;return _0x25fe40;});}})[_0xf667('0x23')](respondWithFilteredResult(_0x263c78,_0x28f356))['catch'](handleError(_0x263c78,null));};exports['getHopperFinals']=function(_0x49f523,_0x461c01,_0x503745){var _0x5c6d8e={'raw':!![],'where':{}};var _0xe16cc={};var _0x327947={'count':0x0,'rows':[]};return db[_0xf667('0x46')][_0xf667('0x58')]({'where':{'id':_0x49f523[_0xf667('0x56')]['id']}})['then'](handleEntityNotFound(_0x461c01,null))['then'](function(_0x3ba57c){if(_0x3ba57c){_0xe16cc[_0xf667('0x31')]=_[_0xf667('0x59')](db[_0xf667('0x5f')][_0xf667('0x2d')]);_0xe16cc[_0xf667('0x32')]=_['keys'](_0x49f523[_0xf667('0x32')]);_0xe16cc[_0xf667('0x33')]=_[_0xf667('0x34')](_0xe16cc[_0xf667('0x31')],_0xe16cc[_0xf667('0x32')]);_0x5c6d8e[_0xf667('0x35')]=_[_0xf667('0x34')](_0xe16cc[_0xf667('0x31')],qs[_0xf667('0x36')](_0x49f523[_0xf667('0x32')]['fields']));_0x5c6d8e[_0xf667('0x35')]=_0x5c6d8e['attributes']['length']?_0x5c6d8e[_0xf667('0x35')]:_0xe16cc['model'];if(!_0x49f523[_0xf667('0x32')][_0xf667('0x38')](_0xf667('0x5a'))){_0x5c6d8e[_0xf667('0x1d')]=qs['limit'](_0x49f523[_0xf667('0x32')][_0xf667('0x1d')]);_0x5c6d8e[_0xf667('0x1a')]=qs['offset'](_0x49f523[_0xf667('0x32')]['offset']);}_0x5c6d8e[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x49f523[_0xf667('0x32')][_0xf667('0x3a')]);_0x5c6d8e[_0xf667('0x3b')]=qs[_0xf667('0x33')](_['pick'](_0x49f523['query'],_0xe16cc[_0xf667('0x33')]));_0x5c6d8e[_0xf667('0x3b')][_0xf667('0x5b')]=_0x3ba57c['id'];if(_0x49f523[_0xf667('0x32')][_0xf667('0x3d')]){_0x5c6d8e[_0xf667('0x3b')]=_[_0xf667('0x3e')](_0x5c6d8e[_0xf667('0x3b')],{'$or':_[_0xf667('0x2c')](_0x5c6d8e['attributes'],function(_0x522627){var _0x54b807={};_0x54b807[_0x522627]={'$like':'%'+_0x49f523[_0xf667('0x32')][_0xf667('0x3d')]+'%'};return _0x54b807;})});}_0x5c6d8e=_[_0xf667('0x3e')]({},_0x5c6d8e,_0x49f523[_0xf667('0x40')]);return db[_0xf667('0x5f')][_0xf667('0x1c')]({'where':_0x5c6d8e[_0xf667('0x3b')]})['then'](function(_0x5c8995){_0x327947['count']=_0x5c8995;if(_0x49f523[_0xf667('0x32')][_0xf667('0x41')]){_0x5c6d8e[_0xf667('0x42')]=[{'all':!![]}];}return db[_0xf667('0x5f')][_0xf667('0x43')](_0x5c6d8e);})[_0xf667('0x23')](function(_0xcd18c5){_0x327947[_0xf667('0x44')]=_0xcd18c5;return _0x327947;});}})[_0xf667('0x23')](respondWithFilteredResult(_0x461c01,_0x5c6d8e))[_0xf667('0x4e')](handleError(_0x461c01,null));};exports['getHopperBlacks']=function(_0x2071c8,_0x56a540,_0x5bb40b){var _0x118db7={'raw':!![],'where':{}};var _0x2a57b2={};var _0x100365={'count':0x0,'rows':[]};return db['Campaign'][_0xf667('0x58')]({'where':{'id':_0x2071c8[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x56a540,null))[_0xf667('0x23')](function(_0x5211dc){if(_0x5211dc){_0x2a57b2[_0xf667('0x31')]=_[_0xf667('0x59')](db[_0xf667('0x60')][_0xf667('0x2d')]);_0x2a57b2[_0xf667('0x32')]=_['keys'](_0x2071c8[_0xf667('0x32')]);_0x2a57b2['filters']=_[_0xf667('0x34')](_0x2a57b2[_0xf667('0x31')],_0x2a57b2[_0xf667('0x32')]);_0x118db7[_0xf667('0x35')]=_['intersection'](_0x2a57b2['model'],qs[_0xf667('0x36')](_0x2071c8[_0xf667('0x32')][_0xf667('0x36')]));_0x118db7[_0xf667('0x35')]=_0x118db7[_0xf667('0x35')][_0xf667('0x37')]?_0x118db7[_0xf667('0x35')]:_0x2a57b2[_0xf667('0x31')];if(!_0x2071c8[_0xf667('0x32')][_0xf667('0x38')](_0xf667('0x5a'))){_0x118db7['limit']=qs['limit'](_0x2071c8['query'][_0xf667('0x1d')]);_0x118db7[_0xf667('0x1a')]=qs[_0xf667('0x1a')](_0x2071c8[_0xf667('0x32')][_0xf667('0x1a')]);}_0x118db7[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x2071c8[_0xf667('0x32')][_0xf667('0x3a')]);_0x118db7[_0xf667('0x3b')]=qs['filters'](_[_0xf667('0x3c')](_0x2071c8['query'],_0x2a57b2[_0xf667('0x33')]));_0x118db7[_0xf667('0x3b')][_0xf667('0x5b')]=_0x5211dc['id'];if(_0x2071c8[_0xf667('0x32')][_0xf667('0x3d')]){_0x118db7['where']=_[_0xf667('0x3e')](_0x118db7['where'],{'$or':_[_0xf667('0x2c')](_0x118db7[_0xf667('0x35')],function(_0x586c58){var _0x542bf2={};_0x542bf2[_0x586c58]={'$like':'%'+_0x2071c8[_0xf667('0x32')]['filter']+'%'};return _0x542bf2;})});}_0x118db7=_[_0xf667('0x3e')]({},_0x118db7,_0x2071c8[_0xf667('0x40')]);return db[_0xf667('0x60')]['count']({'where':_0x118db7[_0xf667('0x3b')]})[_0xf667('0x23')](function(_0x18d7d3){_0x100365[_0xf667('0x1c')]=_0x18d7d3;if(_0x2071c8[_0xf667('0x32')]['includeAll']){_0x118db7['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x118db7);})[_0xf667('0x23')](function(_0x4c7c59){_0x100365[_0xf667('0x44')]=_0x4c7c59;return _0x100365;});}})[_0xf667('0x23')](respondWithFilteredResult(_0x56a540,_0x118db7))[_0xf667('0x4e')](handleError(_0x56a540,null));};exports[_0xf667('0x61')]=function(_0x68faf,_0x17b77d,_0x590071){var _0x101816={};var _0x3c9d22={};var _0x495d98;var _0x1ecc9e;return db['Campaign']['findOne']({'where':{'id':_0x68faf[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x17b77d,null))[_0xf667('0x23')](function(_0x31a4b1){if(_0x31a4b1){_0x495d98=_0x31a4b1;_0x3c9d22[_0xf667('0x31')]=_['keys'](db[_0xf667('0x62')][_0xf667('0x2d')]);_0x3c9d22['query']=_[_0xf667('0x59')](_0x68faf[_0xf667('0x32')]);_0x3c9d22[_0xf667('0x33')]=_[_0xf667('0x34')](_0x3c9d22['model'],_0x3c9d22[_0xf667('0x32')]);_0x101816[_0xf667('0x35')]=_[_0xf667('0x34')](_0x3c9d22['model'],qs[_0xf667('0x36')](_0x68faf[_0xf667('0x32')][_0xf667('0x36')]));_0x101816[_0xf667('0x35')]=_0x101816[_0xf667('0x35')]['length']?_0x101816[_0xf667('0x35')]:_0x3c9d22[_0xf667('0x31')];_0x101816['order']=qs[_0xf667('0x3a')](_0x68faf[_0xf667('0x32')]['sort']);_0x101816[_0xf667('0x3b')]=qs['filters'](_[_0xf667('0x3c')](_0x68faf['query'],_0x3c9d22['filters']));if(_0x68faf['query'][_0xf667('0x3d')]){_0x101816[_0xf667('0x3b')]=_['merge'](_0x101816[_0xf667('0x3b')],{'$or':_[_0xf667('0x2c')](_0x101816[_0xf667('0x35')],function(_0x28ec85){var _0x47e073={};_0x47e073[_0x28ec85]={'$like':'%'+_0x68faf[_0xf667('0x32')]['filter']+'%'};return _0x47e073;})});}_0x101816=_[_0xf667('0x3e')]({},_0x101816,_0x68faf['options']);return _0x495d98['getLists'](_0x101816);}})[_0xf667('0x23')](function(_0x199873){if(_0x199873){_0x1ecc9e=_0x199873[_0xf667('0x37')];if(!_0x68faf[_0xf667('0x32')]['hasOwnProperty']('nolimit')){_0x101816[_0xf667('0x1d')]=qs[_0xf667('0x1d')](_0x68faf[_0xf667('0x32')][_0xf667('0x1d')]);_0x101816[_0xf667('0x1a')]=qs[_0xf667('0x1a')](_0x68faf['query']['offset']);}return _0x495d98['getLists'](_0x101816);}})[_0xf667('0x23')](function(_0x4c1ea4){if(_0x4c1ea4){return _0x4c1ea4?{'count':_0x1ecc9e,'rows':_0x4c1ea4}:null;}})[_0xf667('0x23')](respondWithResult(_0x17b77d,null))['catch'](handleError(_0x17b77d,null));};exports['addLists']=function(_0x442b9c,_0xdce0c1,_0xb64b2f){var _0x3708f1,_0xba81b5;return db[_0xf667('0x46')]['find']({'where':{'id':_0x442b9c['params']['id']}})[_0xf667('0x23')](handleEntityNotFound(_0xdce0c1,null))[_0xf667('0x23')](function(_0x53077e){if(_0x53077e){_0xba81b5=_0x53077e;return _0x53077e[_0xf667('0x63')](_0x442b9c['body'][_0xf667('0x64')],_[_0xf667('0x52')](_0x442b9c['body'],['ids','id'])||{});}return null;})[_0xf667('0x65')](function(_0x11058d){var _0x456a1d;_0x3708f1=_0x11058d||[];var _0x2ad40b=[];if(_0x11058d){for(var _0x44753b=0x0;_0x44753b<_0x11058d['length'];_0x44753b+=0x1){var _0x524b9c=_0x11058d[_0x44753b]['get']({'plain':!![]});_0xba81b5[_0xf667('0x66')]=_0x442b9c[_0xf667('0x47')][_0xf667('0x66')]?_0x442b9c[_0xf667('0x47')][_0xf667('0x66')]:_0xba81b5[_0xf667('0x66')];switch(_0xba81b5['dialCheckDuplicateType']){case _0xf667('0x67'):_0x456a1d=squel['insert']()[_0xf667('0x68')]('cm_hopper')[_0xf667('0x69')]([_0xf667('0x6a'),'scheduledAt',_0xf667('0x6b'),'ListId','CampaignId','createdAt',_0xf667('0x54')],squel[_0xf667('0x6c')]()['field']('phone','phone')[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x6f'))[_0xf667('0x6d')]('id',_0xf667('0x6b'))[_0xf667('0x6d')](_0x524b9c[_0xf667('0x70')][_0xf667('0x71')](),_0xf667('0x72'))[_0xf667('0x6d')](_0x442b9c[_0xf667('0x56')]['id']['toString'](),_0xf667('0x5b'))[_0xf667('0x6d')]('NOW()',_0xf667('0x53'))[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x54'))[_0xf667('0x73')]('cm_contacts')[_0xf667('0x3b')](_0xf667('0x74'))[_0xf667('0x3b')](_0xf667('0x75'),_0x524b9c[_0xf667('0x70')][_0xf667('0x71')]())[_0xf667('0x3b')](_0xf667('0x76'))[_0xf667('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf667('0x73')](_0xf667('0x77'))[_0xf667('0x3b')](_0xf667('0x78'),_0x442b9c['params']['id'][_0xf667('0x71')]()))[_0xf667('0x3b')](_0xf667('0x79'),squel[_0xf667('0x6c')]()[_0xf667('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0xf667('0x7a'))[_0xf667('0x3b')](_0xf667('0x78'),_0x442b9c[_0xf667('0x56')]['id'][_0xf667('0x71')]())))[_0xf667('0x71')]();break;case'onlyIfOpen':_0x456a1d=squel[_0xf667('0x7b')]()[_0xf667('0x68')](_0xf667('0x7a'))[_0xf667('0x69')]([_0xf667('0x6a'),_0xf667('0x6f'),_0xf667('0x6b'),_0xf667('0x72'),'CampaignId',_0xf667('0x53'),_0xf667('0x54')],squel[_0xf667('0x6c')]()[_0xf667('0x6d')](_0xf667('0x6a'),_0xf667('0x6a'))[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x6f'))['field']('id',_0xf667('0x6b'))[_0xf667('0x6d')](_0x524b9c[_0xf667('0x70')]['toString'](),_0xf667('0x72'))['field'](_0x442b9c[_0xf667('0x56')]['id'][_0xf667('0x71')](),'CampaignId')[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x53'))['field'](_0xf667('0x6e'),'updatedAt')[_0xf667('0x73')](_0xf667('0x7c'))[_0xf667('0x3b')](_0xf667('0x74'))['where']('ListId\x20=\x20?',_0x524b9c[_0xf667('0x70')][_0xf667('0x71')]())['where'](_0xf667('0x76'))[_0xf667('0x3b')](_0xf667('0x79'),squel[_0xf667('0x6c')]()[_0xf667('0x6d')](_0xf667('0x7d'))[_0xf667('0x73')](_0xf667('0x7a'))['where'](_0xf667('0x78'),_0x442b9c[_0xf667('0x56')]['id'][_0xf667('0x71')]())))['toString']();break;default:_0x456a1d=squel[_0xf667('0x7b')]()[_0xf667('0x68')](_0xf667('0x7a'))[_0xf667('0x69')](['phone',_0xf667('0x6f'),_0xf667('0x6b'),_0xf667('0x72'),_0xf667('0x5b'),_0xf667('0x53'),_0xf667('0x54')],squel[_0xf667('0x6c')]()[_0xf667('0x6d')](_0xf667('0x6a'),_0xf667('0x6a'))[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x6f'))[_0xf667('0x6d')]('id',_0xf667('0x6b'))[_0xf667('0x6d')](_0x524b9c[_0xf667('0x70')][_0xf667('0x71')](),'ListId')[_0xf667('0x6d')](_0x442b9c[_0xf667('0x56')]['id']['toString'](),_0xf667('0x5b'))[_0xf667('0x6d')](_0xf667('0x6e'),_0xf667('0x53'))[_0xf667('0x6d')](_0xf667('0x6e'),'updatedAt')[_0xf667('0x73')](_0xf667('0x7c'))[_0xf667('0x3b')](_0xf667('0x74'))['where'](_0xf667('0x75'),_0x524b9c[_0xf667('0x70')][_0xf667('0x71')]())[_0xf667('0x3b')](_0xf667('0x76')))[_0xf667('0x71')]();}_0x2ad40b[_0xf667('0x7e')](db[_0xf667('0x7f')][_0xf667('0x32')](_0x456a1d));}return BPromise[_0xf667('0x80')](_0x2ad40b);}})[_0xf667('0x23')](function(){return _0x3708f1;})[_0xf667('0x23')](respondWithResult(_0xdce0c1,null))[_0xf667('0x4e')](handleError(_0xdce0c1,null));};exports[_0xf667('0x81')]=function(_0x5e518c,_0x1a2112,_0x2365ab){return db[_0xf667('0x46')][_0xf667('0x51')]({'where':{'id':_0x5e518c[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x1a2112,null))[_0xf667('0x23')](function(_0xfc3906){if(_0xfc3906){return _0xfc3906[_0xf667('0x81')](_0x5e518c[_0xf667('0x32')][_0xf667('0x64')]);}})[_0xf667('0x23')](function(_0x95d991){if(_0x95d991){return db[_0xf667('0x5c')][_0xf667('0x24')]({'where':{'ListId':_0x5e518c['query'][_0xf667('0x64')],'CampaignId':_0x5e518c[_0xf667('0x56')]['id']}})['then'](function(){return _0x95d991;});}})[_0xf667('0x23')](respondWithStatusCode(_0x1a2112,null))['catch'](handleError(_0x1a2112,null));};exports[_0xf667('0x82')]=function(_0x436cbd,_0x24a455,_0x5589f4){var _0x118ae9={};var _0x89e182={};var _0x4648df;var _0x1f7ec9;return db[_0xf667('0x46')][_0xf667('0x58')]({'where':{'id':_0x436cbd[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x24a455,null))[_0xf667('0x23')](function(_0x2d4358){if(_0x2d4358){_0x4648df=_0x2d4358;_0x89e182[_0xf667('0x31')]=_[_0xf667('0x59')](db[_0xf667('0x62')][_0xf667('0x2d')]);_0x89e182[_0xf667('0x32')]=_[_0xf667('0x59')](_0x436cbd[_0xf667('0x32')]);_0x89e182['filters']=_[_0xf667('0x34')](_0x89e182[_0xf667('0x31')],_0x89e182[_0xf667('0x32')]);_0x118ae9[_0xf667('0x35')]=_['intersection'](_0x89e182[_0xf667('0x31')],qs['fields'](_0x436cbd[_0xf667('0x32')]['fields']));_0x118ae9[_0xf667('0x35')]=_0x118ae9['attributes'][_0xf667('0x37')]?_0x118ae9['attributes']:_0x89e182[_0xf667('0x31')];_0x118ae9[_0xf667('0x39')]=qs[_0xf667('0x3a')](_0x436cbd['query'][_0xf667('0x3a')]);_0x118ae9['where']=qs[_0xf667('0x33')](_[_0xf667('0x3c')](_0x436cbd[_0xf667('0x32')],_0x89e182[_0xf667('0x33')]));if(_0x436cbd[_0xf667('0x32')][_0xf667('0x3d')]){_0x118ae9[_0xf667('0x3b')]=_[_0xf667('0x3e')](_0x118ae9[_0xf667('0x3b')],{'$or':_[_0xf667('0x2c')](_0x118ae9['attributes'],function(_0x55dec4){var _0x1625fc={};_0x1625fc[_0x55dec4]={'$like':'%'+_0x436cbd[_0xf667('0x32')]['filter']+'%'};return _0x1625fc;})});}_0x118ae9=_[_0xf667('0x3e')]({},_0x118ae9,_0x436cbd[_0xf667('0x40')]);return _0x4648df[_0xf667('0x82')](_0x118ae9);}})[_0xf667('0x23')](function(_0x43c99b){if(_0x43c99b){_0x1f7ec9=_0x43c99b[_0xf667('0x37')];if(!_0x436cbd[_0xf667('0x32')][_0xf667('0x38')](_0xf667('0x5a'))){_0x118ae9[_0xf667('0x1d')]=qs[_0xf667('0x1d')](_0x436cbd[_0xf667('0x32')][_0xf667('0x1d')]);_0x118ae9['offset']=qs['offset'](_0x436cbd[_0xf667('0x32')]['offset']);}return _0x4648df['getBlackLists'](_0x118ae9);}})[_0xf667('0x23')](function(_0x434844){if(_0x434844){return _0x434844?{'count':_0x1f7ec9,'rows':_0x434844}:null;}})[_0xf667('0x23')](respondWithResult(_0x24a455,null))[_0xf667('0x4e')](handleError(_0x24a455,null));};exports[_0xf667('0x83')]=function(_0xd209de,_0x10ecec,_0x89a5fd){var _0x4cf10e,_0x31550e;return db[_0xf667('0x46')][_0xf667('0x51')]({'where':{'id':_0xd209de['params']['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x10ecec,null))[_0xf667('0x23')](function(_0x4b06f0){if(_0x4b06f0){_0x31550e=_0x4b06f0;return _0x4b06f0[_0xf667('0x83')](_0xd209de['body']['ids'],_[_0xf667('0x52')](_0xd209de[_0xf667('0x47')],[_0xf667('0x64'),'id'])||{});}return null;})['spread'](function(_0x15b5c0){var _0x44c602;_0x4cf10e=_0x15b5c0||[];var _0x5bb609=[];if(_0x15b5c0){for(var _0x3c8ec0=0x0;_0x3c8ec0<_0x15b5c0[_0xf667('0x37')];_0x3c8ec0+=0x1){var _0x3cdbb0=_0x15b5c0[_0x3c8ec0][_0xf667('0x25')]({'plain':!![]});_0x44c602=squel[_0xf667('0x7b')]()[_0xf667('0x68')](_0xf667('0x84'))[_0xf667('0x69')]([_0xf667('0x6a'),_0xf667('0x6b'),_0xf667('0x72'),_0xf667('0x5b'),_0xf667('0x53'),_0xf667('0x54')],squel['select']()['field'](_0xf667('0x6a'),'phone')[_0xf667('0x6d')]('id','ContactId')['field'](_0x3cdbb0[_0xf667('0x70')][_0xf667('0x71')](),_0xf667('0x72'))[_0xf667('0x6d')](_0xd209de[_0xf667('0x56')]['id'][_0xf667('0x71')](),_0xf667('0x5b'))[_0xf667('0x6d')](_0xf667('0x6e'),'createdAt')[_0xf667('0x6d')]('NOW()',_0xf667('0x54'))[_0xf667('0x73')](_0xf667('0x7c'))[_0xf667('0x3b')]('deletedAt\x20IS\x20NULL')[_0xf667('0x3b')](_0xf667('0x75'),_0x3cdbb0[_0xf667('0x70')][_0xf667('0x71')]())['where'](_0xf667('0x76')))['toString']();_0x5bb609[_0xf667('0x7e')](db[_0xf667('0x7f')][_0xf667('0x32')](_0x44c602));}return BPromise[_0xf667('0x80')](_0x5bb609);}})['then'](function(){return _0x4cf10e;})[_0xf667('0x23')](respondWithResult(_0x10ecec,null))['catch'](handleError(_0x10ecec,null));};exports[_0xf667('0x85')]=function(_0x36d850,_0x42b038,_0x12a6ec){return db[_0xf667('0x46')][_0xf667('0x51')]({'where':{'id':_0x36d850[_0xf667('0x56')]['id']}})[_0xf667('0x23')](handleEntityNotFound(_0x42b038,null))[_0xf667('0x23')](function(_0x47a4de){if(_0x47a4de){return _0x47a4de[_0xf667('0x85')](_0x36d850[_0xf667('0x32')][_0xf667('0x64')]);}})[_0xf667('0x23')](function(_0x5c5434){if(_0x5c5434){return db[_0xf667('0x60')][_0xf667('0x24')]({'where':{'ListId':_0x36d850['query'][_0xf667('0x64')],'CampaignId':_0x36d850[_0xf667('0x56')]['id']}})[_0xf667('0x23')](function(){return _0x5c5434;});}})[_0xf667('0x23')](respondWithStatusCode(_0x42b038,null))['catch'](handleError(_0x42b038,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f727c80..151f989 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(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1e0bd3,_0x8ba362){var _0x2d3f81=function(_0x2580cc){while(--_0x2580cc){_0x1e0bd3['push'](_0x1e0bd3['shift']());}};_0x2d3f81(++_0x8ba362);}(_0x7a54,0x106));var _0x47a5=function(_0x3bc90f,_0xbcaf71){_0x3bc90f=_0x3bc90f-0x0;var _0x17b522=_0x7a54[_0x3bc90f];return _0x17b522;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 38bcfa8..46f747b 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 _0x342b=['map','model','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','raw','options','where','attributes','include'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x342b,0xbc));var _0xb342=function(_0x1f1d4e,_0x4125c4){_0x1f1d4e=_0x1f1d4e-0x0;var _0xc764a1=_0x342b[_0x1f1d4e];return _0xc764a1;};'use strict';var _=require(_0xb342('0x0'));var util=require('util');var moment=require(_0xb342('0x1'));var BPromise=require(_0xb342('0x2'));var rs=require(_0xb342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb342('0x4'));var config=require(_0xb342('0x5'));var jayson=require(_0xb342('0x6'));var client=jayson[_0xb342('0x7')][_0xb342('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f6281,_0x30106f,_0x3c7ac7){return new BPromise(function(_0x54175e,_0x54c788){return client[_0xb342('0x9')](_0x2f6281,_0x3c7ac7)[_0xb342('0xa')](function(_0x4e8f65){logger[_0xb342('0xb')](_0xb342('0xc'),_0x30106f,_0xb342('0xd'));logger[_0xb342('0xe')](_0xb342('0xf'),_0x30106f,_0xb342('0xd'),JSON[_0xb342('0x10')](_0x4e8f65));if(_0x4e8f65[_0xb342('0x11')]){if(_0x4e8f65[_0xb342('0x11')][_0xb342('0x12')]===0x1f4){logger[_0xb342('0x11')]('Campaign,\x20%s,\x20%s',_0x30106f,_0x4e8f65[_0xb342('0x11')]['message']);return _0x54c788(_0x4e8f65['error']['message']);}logger[_0xb342('0x11')](_0xb342('0xc'),_0x30106f,_0x4e8f65[_0xb342('0x11')][_0xb342('0x13')]);return _0x54175e(_0x4e8f65[_0xb342('0x11')][_0xb342('0x13')]);}else{logger[_0xb342('0xb')](_0xb342('0xc'),_0x30106f,'request\x20sent');_0x54175e(_0x4e8f65[_0xb342('0x14')][_0xb342('0x13')]);}})['catch'](function(_0x5ee646){logger['error'](_0xb342('0xc'),_0x30106f,_0x5ee646);_0x54c788(_0x5ee646);});});}exports[_0xb342('0x15')]=function(_0x52b3b6){var _0x26583c=this;return new Promise(function(_0x2fa7cd,_0x1694c7){return db[_0xb342('0x16')][_0xb342('0x17')]({'raw':_0x52b3b6['options']?_0x52b3b6['options'][_0xb342('0x18')]===undefined?!![]:![]:!![],'where':_0x52b3b6['options']?_0x52b3b6[_0xb342('0x19')][_0xb342('0x1a')]||null:null,'attributes':_0x52b3b6[_0xb342('0x19')]?_0x52b3b6[_0xb342('0x19')][_0xb342('0x1b')]||null:null,'limit':_0x52b3b6['options']?_0x52b3b6[_0xb342('0x19')]['limit']||null:null,'include':_0x52b3b6[_0xb342('0x19')]?_0x52b3b6['options'][_0xb342('0x1c')]?_[_0xb342('0x1d')](_0x52b3b6[_0xb342('0x19')][_0xb342('0x1c')],function(_0x4eda3a){return{'model':db[_0x4eda3a[_0xb342('0x1e')]],'as':_0x4eda3a['as'],'attributes':_0x4eda3a['attributes'],'include':_0x4eda3a['include']?_[_0xb342('0x1d')](_0x4eda3a['include'],function(_0x31aa2b){return{'model':db[_0x31aa2b[_0xb342('0x1e')]],'as':_0x31aa2b['as'],'attributes':_0x31aa2b[_0xb342('0x1b')],'include':_0x31aa2b[_0xb342('0x1c')]?_['map'](_0x31aa2b[_0xb342('0x1c')],function(_0x31469f){return{'model':db[_0x31469f[_0xb342('0x1e')]],'as':_0x31469f['as'],'attributes':_0x31469f[_0xb342('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb342('0xa')](function(_0x27005b){logger[_0xb342('0xb')]('GetCampaign',_0x52b3b6);logger[_0xb342('0xe')](_0xb342('0x15'),_0x52b3b6,JSON[_0xb342('0x10')](_0x27005b));_0x2fa7cd(_0x27005b);})['catch'](function(_0x54cc70){logger['error'](_0xb342('0x15'),_0x54cc70['message'],_0x52b3b6);_0x1694c7(_0x26583c[_0xb342('0x11')](0x1f4,_0x54cc70['message']));});});}; \ No newline at end of file +var _0xc041=['GetCampaign','options','raw','where','attributes','limit','include','model','map','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4f8a41,_0x2799f1){var _0x2b6e84=function(_0x53d4dc){while(--_0x53d4dc){_0x4f8a41['push'](_0x4f8a41['shift']());}};_0x2b6e84(++_0x2799f1);}(_0xc041,0x1ea));var _0x1c04=function(_0x40bfc2,_0x538e26){_0x40bfc2=_0x40bfc2-0x0;var _0x14d1db=_0xc041[_0x40bfc2];return _0x14d1db;};'use strict';var _=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var moment=require('moment');var BPromise=require(_0x1c04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c04('0x3'));var db=require(_0x1c04('0x4'))['db'];var utils=require(_0x1c04('0x5'));var logger=require(_0x1c04('0x6'))(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1c04('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x524f85,_0x9507a,_0x3613fe){return new BPromise(function(_0x41a0d3,_0x1c2e7e){return client[_0x1c04('0xa')](_0x524f85,_0x3613fe)['then'](function(_0x536a46){logger[_0x1c04('0xb')](_0x1c04('0xc'),_0x9507a,_0x1c04('0xd'));logger[_0x1c04('0xe')](_0x1c04('0xf'),_0x9507a,_0x1c04('0xd'),JSON[_0x1c04('0x10')](_0x536a46));if(_0x536a46[_0x1c04('0x11')]){if(_0x536a46['error'][_0x1c04('0x12')]===0x1f4){logger['error'](_0x1c04('0xc'),_0x9507a,_0x536a46[_0x1c04('0x11')]['message']);return _0x1c2e7e(_0x536a46[_0x1c04('0x11')][_0x1c04('0x13')]);}logger[_0x1c04('0x11')](_0x1c04('0xc'),_0x9507a,_0x536a46[_0x1c04('0x11')][_0x1c04('0x13')]);return _0x41a0d3(_0x536a46[_0x1c04('0x11')]['message']);}else{logger[_0x1c04('0xb')](_0x1c04('0xc'),_0x9507a,_0x1c04('0xd'));_0x41a0d3(_0x536a46['result'][_0x1c04('0x13')]);}})['catch'](function(_0x26cbfa){logger[_0x1c04('0x11')](_0x1c04('0xc'),_0x9507a,_0x26cbfa);_0x1c2e7e(_0x26cbfa);});});}exports[_0x1c04('0x14')]=function(_0x2b3a8b){var _0x12e227=this;return new Promise(function(_0x3e2bd9,_0x46e892){return db['Campaign']['findAll']({'raw':_0x2b3a8b['options']?_0x2b3a8b[_0x1c04('0x15')][_0x1c04('0x16')]===undefined?!![]:![]:!![],'where':_0x2b3a8b[_0x1c04('0x15')]?_0x2b3a8b[_0x1c04('0x15')][_0x1c04('0x17')]||null:null,'attributes':_0x2b3a8b[_0x1c04('0x15')]?_0x2b3a8b[_0x1c04('0x15')][_0x1c04('0x18')]||null:null,'limit':_0x2b3a8b[_0x1c04('0x15')]?_0x2b3a8b[_0x1c04('0x15')][_0x1c04('0x19')]||null:null,'include':_0x2b3a8b[_0x1c04('0x15')]?_0x2b3a8b[_0x1c04('0x15')][_0x1c04('0x1a')]?_['map'](_0x2b3a8b[_0x1c04('0x15')]['include'],function(_0x247116){return{'model':db[_0x247116[_0x1c04('0x1b')]],'as':_0x247116['as'],'attributes':_0x247116[_0x1c04('0x18')],'include':_0x247116[_0x1c04('0x1a')]?_[_0x1c04('0x1c')](_0x247116['include'],function(_0x5101e2){return{'model':db[_0x5101e2[_0x1c04('0x1b')]],'as':_0x5101e2['as'],'attributes':_0x5101e2[_0x1c04('0x18')],'include':_0x5101e2[_0x1c04('0x1a')]?_[_0x1c04('0x1c')](_0x5101e2[_0x1c04('0x1a')],function(_0x1e2daa){return{'model':db[_0x1e2daa[_0x1c04('0x1b')]],'as':_0x1e2daa['as'],'attributes':_0x1e2daa[_0x1c04('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bdd27){logger[_0x1c04('0xb')]('GetCampaign',_0x2b3a8b);logger[_0x1c04('0xe')](_0x1c04('0x14'),_0x2b3a8b,JSON[_0x1c04('0x10')](_0x4bdd27));_0x3e2bd9(_0x4bdd27);})[_0x1c04('0x1d')](function(_0x3bf4fd){logger[_0x1c04('0x11')](_0x1c04('0x14'),_0x3bf4fd['message'],_0x2b3a8b);_0x46e892(_0x12e227['error'](0x1f4,_0x3bf4fd['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index af41200..dd5df08 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 _0xb701=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x4d0ebd,_0x17ab0b){var _0x594e9c=function(_0x4d22ab){while(--_0x4d22ab){_0x4d0ebd['push'](_0x4d0ebd['shift']());}};_0x594e9c(++_0x17ab0b);}(_0xb701,0x144));var _0x1b70=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb701[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b70('0x2'));var auth=require(_0x1b70('0x3'));var interaction=require(_0x1b70('0x4'));var config=require(_0x1b70('0x5'));var controller=require(_0x1b70('0x6'));router[_0x1b70('0x7')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x9')]);router[_0x1b70('0x7')](_0x1b70('0xa'),auth['isAuthenticated'](),controller[_0x1b70('0xb')]);router[_0x1b70('0x7')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0xd')]);router[_0x1b70('0x7')](_0x1b70('0xe'),auth['isAuthenticated'](),controller[_0x1b70('0xf')]);router[_0x1b70('0x7')](_0x1b70('0x10'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x11')]);router[_0x1b70('0x7')](_0x1b70('0x12'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x13')]);router[_0x1b70('0x7')](_0x1b70('0x14'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x15')]);router['get'](_0x1b70('0x16'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x17')]);router[_0x1b70('0x18')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1b70('0x19'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x1a')]);router[_0x1b70('0x18')](_0x1b70('0x14'),auth[_0x1b70('0x8')](),controller['addLists']);router[_0x1b70('0x18')](_0x1b70('0x16'),auth[_0x1b70('0x8')](),controller['addBlackLists']);router[_0x1b70('0x1b')](_0x1b70('0xa'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x1c')]);router[_0x1b70('0x1d')](_0x1b70('0xa'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x1e')]);router['delete'](_0x1b70('0x14'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x1f')]);router['delete'](_0x1b70('0x16'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x20')]);module[_0x1b70('0x21')]=router; \ No newline at end of file +var _0x849e=['getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x849e,0x187));var _0xe849=function(_0x52d0d3,_0x552ba6){_0x52d0d3=_0x52d0d3-0x0;var _0x1b4978=_0x849e[_0x52d0d3];return _0x1b4978;};'use strict';var multer=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var path=require(_0xe849('0x2'));var timeout=require(_0xe849('0x3'));var express=require(_0xe849('0x4'));var router=express[_0xe849('0x5')]();var fs_extra=require(_0xe849('0x6'));var auth=require(_0xe849('0x7'));var interaction=require(_0xe849('0x8'));var config=require(_0xe849('0x9'));var controller=require(_0xe849('0xa'));router[_0xe849('0xb')]('/',auth[_0xe849('0xc')](),controller['index']);router[_0xe849('0xb')](_0xe849('0xd'),auth[_0xe849('0xc')](),controller[_0xe849('0xe')]);router[_0xe849('0xb')](_0xe849('0xf'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xe849('0xb')](_0xe849('0x10'),auth['isAuthenticated'](),controller[_0xe849('0x11')]);router[_0xe849('0xb')]('/:id/hopper_finals',auth[_0xe849('0xc')](),controller[_0xe849('0x12')]);router[_0xe849('0xb')](_0xe849('0x13'),auth[_0xe849('0xc')](),controller[_0xe849('0x14')]);router['get'](_0xe849('0x15'),auth[_0xe849('0xc')](),controller[_0xe849('0x16')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xe849('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe849('0x18'),auth[_0xe849('0xc')](),controller['clone']);router[_0xe849('0x17')](_0xe849('0x15'),auth[_0xe849('0xc')](),controller[_0xe849('0x19')]);router[_0xe849('0x17')](_0xe849('0x1a'),auth['isAuthenticated'](),controller[_0xe849('0x1b')]);router[_0xe849('0x1c')]('/:id',auth[_0xe849('0xc')](),controller['update']);router['delete'](_0xe849('0xd'),auth[_0xe849('0xc')](),controller[_0xe849('0x1d')]);router[_0xe849('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe849('0x1f')]);router['delete'](_0xe849('0x1a'),auth[_0xe849('0xc')](),controller[_0xe849('0x20')]);module[_0xe849('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 78ae88a..c3e90eb 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 _0x244b=['key','sequelize','exports','STRING','getDataValue'];(function(_0x5a15ac,_0x2b2595){var _0x5d0c48=function(_0x575d14){while(--_0x575d14){_0x5a15ac['push'](_0x5a15ac['shift']());}};_0x5d0c48(++_0x2b2595);}(_0x244b,0x1eb));var _0xb244=function(_0x2a59e0,_0xc12ff){_0x2a59e0=_0x2a59e0-0x0;var _0x48813a=_0x244b[_0x2a59e0];return _0x48813a;};'use strict';var Sequelize=require(_0xb244('0x0'));module[_0xb244('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xb244('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb244('0x3')](_0xb244('0x4'));}}}; \ No newline at end of file +var _0xfd1e=['VIRTUAL','getDataValue','key','exports','TEXT','STRING'];(function(_0x53f4e3,_0x62f760){var _0x25c1ef=function(_0x4e4e95){while(--_0x4e4e95){_0x53f4e3['push'](_0x53f4e3['shift']());}};_0x25c1ef(++_0x62f760);}(_0xfd1e,0xff));var _0xefd1=function(_0x246d80,_0x3ebb30){_0x246d80=_0x246d80-0x0;var _0x214f35=_0xfd1e[_0x246d80];return _0x214f35;};'use strict';var Sequelize=require('sequelize');module[_0xefd1('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xefd1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xefd1('0x2')]},'name':{'type':Sequelize[_0xefd1('0x3')],'get':function(){return this[_0xefd1('0x4')](_0xefd1('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d35e05c..4c94d11 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 _0xe39f=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','CannedAnswers','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','get','UserProfileSection','autoAssociation','UserProfileResource','eml-format','zip-dir','fast-json-patch'];(function(_0x7ed412,_0x223b70){var _0x1ed154=function(_0x3d5315){while(--_0x3d5315){_0x7ed412['push'](_0x7ed412['shift']());}};_0x1ed154(++_0x223b70);}(_0xe39f,0x16d));var _0xfe39=function(_0x5e8912,_0x5b6370){_0x5e8912=_0x5e8912-0x0;var _0xb5060b=_0xe39f[_0x5e8912];return _0xb5060b;};'use strict';var emlformat=require(_0xfe39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe39('0x1'));var jsonpatch=require(_0xfe39('0x2'));var rp=require(_0xfe39('0x3'));var moment=require(_0xfe39('0x4'));var BPromise=require(_0xfe39('0x5'));var Mustache=require(_0xfe39('0x6'));var util=require(_0xfe39('0x7'));var path=require(_0xfe39('0x8'));var sox=require(_0xfe39('0x9'));var csv=require(_0xfe39('0xa'));var ejs=require(_0xfe39('0xb'));var fs=require('fs');var fs_extra=require(_0xfe39('0xc'));var _=require(_0xfe39('0xd'));var squel=require(_0xfe39('0xe'));var crypto=require(_0xfe39('0xf'));var jsforce=require(_0xfe39('0x10'));var deskjs=require(_0xfe39('0x11'));var toCsv=require(_0xfe39('0xa'));var querystring=require(_0xfe39('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe39('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe39('0x14'));var logger=require(_0xfe39('0x15'))(_0xfe39('0x16'));var utils=require(_0xfe39('0x17'));var config=require(_0xfe39('0x18'));var licenseUtil=require(_0xfe39('0x19'));var db=require(_0xfe39('0x1a'))['db'];function respondWithStatusCode(_0x33067d,_0x68006f){_0x68006f=_0x68006f||0xcc;return function(_0x4399fe){if(_0x4399fe){return _0x33067d[_0xfe39('0x1b')](_0x68006f);}return _0x33067d[_0xfe39('0x1c')](_0x68006f)[_0xfe39('0x1d')]();};}function respondWithResult(_0x48d5d2,_0x4a810a){_0x4a810a=_0x4a810a||0xc8;return function(_0x3c86ef){if(_0x3c86ef){return _0x48d5d2['status'](_0x4a810a)[_0xfe39('0x1e')](_0x3c86ef);}};}function respondWithFilteredResult(_0xacfab6,_0x8918b1){return function(_0x4d457a){if(_0x4d457a){var _0x573ff6=typeof _0x8918b1[_0xfe39('0x1f')]===_0xfe39('0x20')&&typeof _0x8918b1[_0xfe39('0x21')]===_0xfe39('0x20');var _0x43660b=_0x4d457a[_0xfe39('0x22')];var _0x5618cd=_0x573ff6?0x0:_0x8918b1[_0xfe39('0x1f')];var _0x159ce9=_0x573ff6?_0x4d457a[_0xfe39('0x22')]:_0x8918b1['offset']+_0x8918b1[_0xfe39('0x21')];var _0x331753;if(_0x159ce9>=_0x43660b){_0x159ce9=_0x43660b;_0x331753=0xc8;}else{_0x331753=0xce;}_0xacfab6[_0xfe39('0x1c')](_0x331753);return _0xacfab6[_0xfe39('0x23')]('Content-Range',_0x5618cd+'-'+_0x159ce9+'/'+_0x43660b)[_0xfe39('0x1e')](_0x4d457a);}return null;};}function patchUpdates(_0x335adb){return function(_0x3aa3a1){try{jsonpatch[_0xfe39('0x24')](_0x3aa3a1,_0x335adb,!![]);}catch(_0x1e0286){return BPromise[_0xfe39('0x25')](_0x1e0286);}return _0x3aa3a1[_0xfe39('0x26')]();};}function saveUpdates(_0x1c3d71,_0x556a29){return function(_0x3032e){if(_0x3032e){return _0x3032e[_0xfe39('0x27')](_0x1c3d71)[_0xfe39('0x28')](function(_0x315816){return _0x315816;});}return null;};}function removeEntity(_0x29aa95,_0x479fa3){return function(_0x1adeee){if(_0x1adeee){return _0x1adeee[_0xfe39('0x29')]()[_0xfe39('0x28')](function(){var _0x2cc152=_0x1adeee['get']({'plain':!![]});var _0x2d35e1=_0xfe39('0x2a');return db['UserProfileResource'][_0xfe39('0x29')]({'where':{'type':_0x2d35e1,'resourceId':_0x2cc152['id']}})[_0xfe39('0x28')](function(){return _0x1adeee;});})[_0xfe39('0x28')](function(){_0x29aa95[_0xfe39('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x205ab2,_0x1ee8ec){return function(_0x4cd4be){if(!_0x4cd4be){_0x205ab2['sendStatus'](0x194);}return _0x4cd4be;};}function handleError(_0x108125,_0x17ea7a){_0x17ea7a=_0x17ea7a||0x1f4;return function(_0x3d142b){logger[_0xfe39('0x2b')](_0x3d142b[_0xfe39('0x2c')]);if(_0x3d142b['name']){delete _0x3d142b[_0xfe39('0x2d')];}_0x108125[_0xfe39('0x1c')](_0x17ea7a)[_0xfe39('0x2e')](_0x3d142b);};}exports['index']=function(_0x305c22,_0x477219){var _0x502e43={},_0x161d91={},_0x1be3bd={'count':0x0,'rows':[]};var _0x24c58c=_[_0xfe39('0x2f')](db[_0xfe39('0x30')][_0xfe39('0x31')],function(_0x5cb2e8){return{'name':_0x5cb2e8[_0xfe39('0x32')],'type':_0x5cb2e8[_0xfe39('0x33')][_0xfe39('0x34')]};});_0x161d91['model']=_[_0xfe39('0x2f')](_0x24c58c,_0xfe39('0x2d'));_0x161d91['query']=_[_0xfe39('0x35')](_0x305c22[_0xfe39('0x36')]);_0x161d91[_0xfe39('0x37')]=_[_0xfe39('0x38')](_0x161d91[_0xfe39('0x39')],_0x161d91[_0xfe39('0x36')]);_0x502e43[_0xfe39('0x3a')]=_['intersection'](_0x161d91[_0xfe39('0x39')],qs['fields'](_0x305c22[_0xfe39('0x36')][_0xfe39('0x3b')]));_0x502e43['attributes']=_0x502e43[_0xfe39('0x3a')]['length']?_0x502e43[_0xfe39('0x3a')]:_0x161d91[_0xfe39('0x39')];if(!_0x305c22[_0xfe39('0x36')][_0xfe39('0x3c')](_0xfe39('0x3d'))){_0x502e43[_0xfe39('0x21')]=qs['limit'](_0x305c22['query'][_0xfe39('0x21')]);_0x502e43[_0xfe39('0x1f')]=qs[_0xfe39('0x1f')](_0x305c22['query'][_0xfe39('0x1f')]);}_0x502e43[_0xfe39('0x3e')]=qs[_0xfe39('0x3f')](_0x305c22['query']['sort']);_0x502e43[_0xfe39('0x40')]=qs[_0xfe39('0x37')](_[_0xfe39('0x41')](_0x305c22[_0xfe39('0x36')],_0x161d91['filters']),_0x24c58c);if(_0x305c22['query'][_0xfe39('0x42')]){_0x502e43[_0xfe39('0x40')]=_['merge'](_0x502e43['where'],{'$or':[{'key':{'$like':'%'+_0x305c22['query']['filter']+'%'}},{'value':{'$like':'%'+_0x305c22[_0xfe39('0x36')][_0xfe39('0x42')]+'%'}}]});}_0x502e43=_[_0xfe39('0x43')]({},_0x502e43,_0x305c22[_0xfe39('0x44')]);var _0x44f763={'where':_0x502e43[_0xfe39('0x40')]};return db[_0xfe39('0x30')][_0xfe39('0x22')](_0x44f763)[_0xfe39('0x28')](function(_0x3b2ad6){_0x1be3bd['count']=_0x3b2ad6;if(_0x305c22[_0xfe39('0x36')][_0xfe39('0x45')]){_0x502e43[_0xfe39('0x46')]=[{'all':!![]}];}return db[_0xfe39('0x30')][_0xfe39('0x47')](_0x502e43);})[_0xfe39('0x28')](function(_0x1b8383){_0x1be3bd['rows']=_0x1b8383;return _0x1be3bd;})[_0xfe39('0x28')](respondWithFilteredResult(_0x477219,_0x502e43))[_0xfe39('0x48')](handleError(_0x477219,null));};exports[_0xfe39('0x49')]=function(_0x535f34,_0x2b9589){var _0x17c11f={'raw':!![],'where':{'id':_0x535f34[_0xfe39('0x4a')]['id']}},_0x1d3e73={};_0x1d3e73[_0xfe39('0x39')]=_['keys'](db[_0xfe39('0x30')][_0xfe39('0x31')]);_0x1d3e73[_0xfe39('0x36')]=_[_0xfe39('0x35')](_0x535f34['query']);_0x1d3e73[_0xfe39('0x37')]=_[_0xfe39('0x38')](_0x1d3e73['model'],_0x1d3e73[_0xfe39('0x36')]);_0x17c11f['attributes']=_[_0xfe39('0x38')](_0x1d3e73[_0xfe39('0x39')],qs['fields'](_0x535f34[_0xfe39('0x36')][_0xfe39('0x3b')]));_0x17c11f['attributes']=_0x17c11f[_0xfe39('0x3a')][_0xfe39('0x4b')]?_0x17c11f[_0xfe39('0x3a')]:_0x1d3e73[_0xfe39('0x39')];if(_0x535f34['query'][_0xfe39('0x45')]){_0x17c11f['include']=[{'all':!![]}];}_0x17c11f=_[_0xfe39('0x43')]({},_0x17c11f,_0x535f34[_0xfe39('0x44')]);return db[_0xfe39('0x30')]['find'](_0x17c11f)['then'](handleEntityNotFound(_0x2b9589,null))['then'](respondWithResult(_0x2b9589,null))[_0xfe39('0x48')](handleError(_0x2b9589,null));};exports[_0xfe39('0x27')]=function(_0x3cab26,_0x43ba4e){if(_0x3cab26[_0xfe39('0x4c')]['id']){delete _0x3cab26[_0xfe39('0x4c')]['id'];}return db[_0xfe39('0x30')][_0xfe39('0x4d')]({'where':{'id':_0x3cab26[_0xfe39('0x4a')]['id']}})[_0xfe39('0x28')](handleEntityNotFound(_0x43ba4e,null))[_0xfe39('0x28')](saveUpdates(_0x3cab26[_0xfe39('0x4c')],null))[_0xfe39('0x28')](respondWithResult(_0x43ba4e,null))[_0xfe39('0x48')](handleError(_0x43ba4e,null));};exports[_0xfe39('0x29')]=function(_0xfe7e2f,_0x5596fa){return db['CannedAnswer'][_0xfe39('0x4d')]({'where':{'id':_0xfe7e2f[_0xfe39('0x4a')]['id']}})[_0xfe39('0x28')](handleEntityNotFound(_0x5596fa,null))[_0xfe39('0x28')](removeEntity(_0x5596fa,null))[_0xfe39('0x48')](handleError(_0x5596fa,null));};exports[_0xfe39('0x4e')]=function(_0xe8455c,_0xb3b8a4){var _0x3bf491={'key':_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x34')]};if(_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x4f')]){_0x3bf491['MailAccountId']=_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x4f')];}else if(_0xe8455c['body'][_0xfe39('0x50')]){_0x3bf491[_0xfe39('0x50')]=_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x50')];}else if(_0xe8455c[_0xfe39('0x4c')]['OpenchannelAccountId']){_0x3bf491[_0xfe39('0x51')]=_0xe8455c[_0xfe39('0x4c')]['OpenchannelAccountId'];}else if(_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x52')]){_0x3bf491[_0xfe39('0x52')]=_0xe8455c[_0xfe39('0x4c')][_0xfe39('0x52')];}return db[_0xfe39('0x30')][_0xfe39('0x4d')]({'where':_0x3bf491})[_0xfe39('0x28')](function(_0x1e6992){if(_0x1e6992){throw new db[(_0xfe39('0x53'))][(_0xfe39('0x54'))](_0xfe39('0x55'));}return db[_0xfe39('0x30')][_0xfe39('0x4e')](_0xe8455c['body']);})[_0xfe39('0x28')](function(_0x1cef76){var _0x1dbd3f=_0xe8455c[_0xfe39('0x56')]['get']({'plain':!![]});if(!_0x1dbd3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1dbd3f[_0xfe39('0x57')]==='user'){var _0x54a394=_0x1cef76[_0xfe39('0x58')]({'plain':!![]});return db[_0xfe39('0x59')][_0xfe39('0x4d')]({'where':{'name':_0xfe39('0x2a'),'userProfileId':_0x1dbd3f['userProfileId']},'raw':!![]})['then'](function(_0x59ef55){if(_0x59ef55&&_0x59ef55[_0xfe39('0x5a')]===0x0){return db[_0xfe39('0x5b')][_0xfe39('0x4e')]({'name':_0x54a394[_0xfe39('0x2d')],'resourceId':_0x54a394['id'],'type':_0x59ef55[_0xfe39('0x2d')],'sectionId':_0x59ef55['id']},{})['then'](function(){return _0x1cef76;});}else{return _0x1cef76;}})[_0xfe39('0x48')](function(_0x16a4de){logger[_0xfe39('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16a4de);throw _0x16a4de;});}return _0x1cef76;})['then'](respondWithResult(_0xb3b8a4,0xc9))['catch'](handleError(_0xb3b8a4,null));}; \ No newline at end of file +var _0x1299=['body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','reject','update','then','get','CannedAnswers','destroy','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x430185,_0xb3bd00){var _0x412b86=function(_0x5ac609){while(--_0x5ac609){_0x430185['push'](_0x430185['shift']());}};_0x412b86(++_0xb3bd00);}(_0x1299,0x1c9));var _0x9129=function(_0x9fa60,_0x4df300){_0x9fa60=_0x9fa60-0x0;var _0x391006=_0x1299[_0x9fa60];return _0x391006;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9129('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9129('0x1'));var moment=require(_0x9129('0x2'));var BPromise=require(_0x9129('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9129('0x4'));var sox=require('sox');var csv=require(_0x9129('0x5'));var ejs=require(_0x9129('0x6'));var fs=require('fs');var fs_extra=require(_0x9129('0x7'));var _=require(_0x9129('0x8'));var squel=require(_0x9129('0x9'));var crypto=require(_0x9129('0xa'));var jsforce=require(_0x9129('0xb'));var deskjs=require(_0x9129('0xc'));var toCsv=require(_0x9129('0x5'));var querystring=require('querystring');var Papa=require(_0x9129('0xd'));var Redis=require(_0x9129('0xe'));var authService=require(_0x9129('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9129('0x10'));var hardwareService=require(_0x9129('0x11'));var logger=require(_0x9129('0x12'))(_0x9129('0x13'));var utils=require(_0x9129('0x14'));var config=require(_0x9129('0x15'));var licenseUtil=require(_0x9129('0x16'));var db=require(_0x9129('0x17'))['db'];function respondWithStatusCode(_0x354efc,_0x410378){_0x410378=_0x410378||0xcc;return function(_0x1aa3db){if(_0x1aa3db){return _0x354efc[_0x9129('0x18')](_0x410378);}return _0x354efc['status'](_0x410378)[_0x9129('0x19')]();};}function respondWithResult(_0x2a590f,_0x4eea6d){_0x4eea6d=_0x4eea6d||0xc8;return function(_0x267ecf){if(_0x267ecf){return _0x2a590f[_0x9129('0x1a')](_0x4eea6d)[_0x9129('0x1b')](_0x267ecf);}};}function respondWithFilteredResult(_0x1cf47b,_0x60edc2){return function(_0x18ae7d){if(_0x18ae7d){var _0x1addb6=typeof _0x60edc2[_0x9129('0x1c')]===_0x9129('0x1d')&&typeof _0x60edc2[_0x9129('0x1e')]===_0x9129('0x1d');var _0x5bbf46=_0x18ae7d['count'];var _0x50e089=_0x1addb6?0x0:_0x60edc2[_0x9129('0x1c')];var _0x4278ba=_0x1addb6?_0x18ae7d['count']:_0x60edc2[_0x9129('0x1c')]+_0x60edc2[_0x9129('0x1e')];var _0x53c112;if(_0x4278ba>=_0x5bbf46){_0x4278ba=_0x5bbf46;_0x53c112=0xc8;}else{_0x53c112=0xce;}_0x1cf47b[_0x9129('0x1a')](_0x53c112);return _0x1cf47b[_0x9129('0x1f')]('Content-Range',_0x50e089+'-'+_0x4278ba+'/'+_0x5bbf46)[_0x9129('0x1b')](_0x18ae7d);}return null;};}function patchUpdates(_0x1a238c){return function(_0x5bbb08){try{jsonpatch['apply'](_0x5bbb08,_0x1a238c,!![]);}catch(_0x4fcb60){return BPromise[_0x9129('0x20')](_0x4fcb60);}return _0x5bbb08['save']();};}function saveUpdates(_0x54d8f1,_0x249778){return function(_0x2c8ea8){if(_0x2c8ea8){return _0x2c8ea8[_0x9129('0x21')](_0x54d8f1)['then'](function(_0x3d91ee){return _0x3d91ee;});}return null;};}function removeEntity(_0x4a255c,_0x40f4a4){return function(_0x5b56c1){if(_0x5b56c1){return _0x5b56c1['destroy']()[_0x9129('0x22')](function(){var _0x12cb38=_0x5b56c1[_0x9129('0x23')]({'plain':!![]});var _0xe5099e=_0x9129('0x24');return db['UserProfileResource'][_0x9129('0x25')]({'where':{'type':_0xe5099e,'resourceId':_0x12cb38['id']}})[_0x9129('0x22')](function(){return _0x5b56c1;});})['then'](function(){_0x4a255c[_0x9129('0x1a')](0xcc)[_0x9129('0x19')]();});}};}function handleEntityNotFound(_0x3b522a,_0x55b126){return function(_0x50665b){if(!_0x50665b){_0x3b522a['sendStatus'](0x194);}return _0x50665b;};}function handleError(_0x53ff8e,_0x1d6511){_0x1d6511=_0x1d6511||0x1f4;return function(_0x88acf4){logger[_0x9129('0x26')](_0x88acf4[_0x9129('0x27')]);if(_0x88acf4[_0x9129('0x28')]){delete _0x88acf4['name'];}_0x53ff8e['status'](_0x1d6511)['send'](_0x88acf4);};}exports[_0x9129('0x29')]=function(_0x38dd11,_0x3e6a86){var _0x452753={},_0x5ee1fe={},_0x3dcfe1={'count':0x0,'rows':[]};var _0x59ae17=_['map'](db[_0x9129('0x2a')][_0x9129('0x2b')],function(_0xf3b59f){return{'name':_0xf3b59f[_0x9129('0x2c')],'type':_0xf3b59f['type'][_0x9129('0x2d')]};});_0x5ee1fe[_0x9129('0x2e')]=_[_0x9129('0x2f')](_0x59ae17,'name');_0x5ee1fe[_0x9129('0x30')]=_[_0x9129('0x31')](_0x38dd11[_0x9129('0x30')]);_0x5ee1fe[_0x9129('0x32')]=_[_0x9129('0x33')](_0x5ee1fe[_0x9129('0x2e')],_0x5ee1fe['query']);_0x452753[_0x9129('0x34')]=_[_0x9129('0x33')](_0x5ee1fe[_0x9129('0x2e')],qs[_0x9129('0x35')](_0x38dd11['query'][_0x9129('0x35')]));_0x452753[_0x9129('0x34')]=_0x452753[_0x9129('0x34')][_0x9129('0x36')]?_0x452753[_0x9129('0x34')]:_0x5ee1fe[_0x9129('0x2e')];if(!_0x38dd11['query'][_0x9129('0x37')](_0x9129('0x38'))){_0x452753[_0x9129('0x1e')]=qs[_0x9129('0x1e')](_0x38dd11[_0x9129('0x30')][_0x9129('0x1e')]);_0x452753['offset']=qs[_0x9129('0x1c')](_0x38dd11[_0x9129('0x30')][_0x9129('0x1c')]);}_0x452753[_0x9129('0x39')]=qs[_0x9129('0x3a')](_0x38dd11['query'][_0x9129('0x3a')]);_0x452753[_0x9129('0x3b')]=qs['filters'](_[_0x9129('0x3c')](_0x38dd11[_0x9129('0x30')],_0x5ee1fe['filters']),_0x59ae17);if(_0x38dd11[_0x9129('0x30')][_0x9129('0x3d')]){_0x452753[_0x9129('0x3b')]=_[_0x9129('0x3e')](_0x452753[_0x9129('0x3b')],{'$or':[{'key':{'$like':'%'+_0x38dd11['query']['filter']+'%'}},{'value':{'$like':'%'+_0x38dd11[_0x9129('0x30')]['filter']+'%'}}]});}_0x452753=_[_0x9129('0x3e')]({},_0x452753,_0x38dd11[_0x9129('0x3f')]);var _0x565f9c={'where':_0x452753[_0x9129('0x3b')]};return db[_0x9129('0x2a')]['count'](_0x565f9c)[_0x9129('0x22')](function(_0x5adfb7){_0x3dcfe1['count']=_0x5adfb7;if(_0x38dd11[_0x9129('0x30')][_0x9129('0x40')]){_0x452753[_0x9129('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9129('0x42')](_0x452753);})[_0x9129('0x22')](function(_0x2b81c5){_0x3dcfe1[_0x9129('0x43')]=_0x2b81c5;return _0x3dcfe1;})[_0x9129('0x22')](respondWithFilteredResult(_0x3e6a86,_0x452753))[_0x9129('0x44')](handleError(_0x3e6a86,null));};exports[_0x9129('0x45')]=function(_0x554988,_0x4851be){var _0x1accb8={'raw':!![],'where':{'id':_0x554988['params']['id']}},_0x2dd2a1={};_0x2dd2a1['model']=_[_0x9129('0x31')](db[_0x9129('0x2a')][_0x9129('0x2b')]);_0x2dd2a1[_0x9129('0x30')]=_[_0x9129('0x31')](_0x554988[_0x9129('0x30')]);_0x2dd2a1[_0x9129('0x32')]=_['intersection'](_0x2dd2a1[_0x9129('0x2e')],_0x2dd2a1['query']);_0x1accb8[_0x9129('0x34')]=_[_0x9129('0x33')](_0x2dd2a1[_0x9129('0x2e')],qs[_0x9129('0x35')](_0x554988[_0x9129('0x30')][_0x9129('0x35')]));_0x1accb8[_0x9129('0x34')]=_0x1accb8[_0x9129('0x34')][_0x9129('0x36')]?_0x1accb8[_0x9129('0x34')]:_0x2dd2a1[_0x9129('0x2e')];if(_0x554988[_0x9129('0x30')][_0x9129('0x40')]){_0x1accb8[_0x9129('0x41')]=[{'all':!![]}];}_0x1accb8=_[_0x9129('0x3e')]({},_0x1accb8,_0x554988[_0x9129('0x3f')]);return db[_0x9129('0x2a')][_0x9129('0x46')](_0x1accb8)[_0x9129('0x22')](handleEntityNotFound(_0x4851be,null))['then'](respondWithResult(_0x4851be,null))[_0x9129('0x44')](handleError(_0x4851be,null));};exports[_0x9129('0x21')]=function(_0x640fd0,_0x16287c){if(_0x640fd0[_0x9129('0x47')]['id']){delete _0x640fd0[_0x9129('0x47')]['id'];}return db[_0x9129('0x2a')]['find']({'where':{'id':_0x640fd0[_0x9129('0x48')]['id']}})[_0x9129('0x22')](handleEntityNotFound(_0x16287c,null))[_0x9129('0x22')](saveUpdates(_0x640fd0[_0x9129('0x47')],null))[_0x9129('0x22')](respondWithResult(_0x16287c,null))[_0x9129('0x44')](handleError(_0x16287c,null));};exports['destroy']=function(_0x1a6e42,_0x39265b){return db[_0x9129('0x2a')]['find']({'where':{'id':_0x1a6e42[_0x9129('0x48')]['id']}})[_0x9129('0x22')](handleEntityNotFound(_0x39265b,null))[_0x9129('0x22')](removeEntity(_0x39265b,null))[_0x9129('0x44')](handleError(_0x39265b,null));};exports[_0x9129('0x49')]=function(_0x1d1c62,_0x580700){var _0x223afa={'key':_0x1d1c62[_0x9129('0x47')]['key']};if(_0x1d1c62[_0x9129('0x47')][_0x9129('0x4a')]){_0x223afa[_0x9129('0x4a')]=_0x1d1c62[_0x9129('0x47')]['MailAccountId'];}else if(_0x1d1c62[_0x9129('0x47')][_0x9129('0x4b')]){_0x223afa[_0x9129('0x4b')]=_0x1d1c62[_0x9129('0x47')]['SmsAccountId'];}else if(_0x1d1c62['body'][_0x9129('0x4c')]){_0x223afa[_0x9129('0x4c')]=_0x1d1c62['body']['OpenchannelAccountId'];}else if(_0x1d1c62['body'][_0x9129('0x4d')]){_0x223afa[_0x9129('0x4d')]=_0x1d1c62[_0x9129('0x47')][_0x9129('0x4d')];}return db[_0x9129('0x2a')][_0x9129('0x46')]({'where':_0x223afa})['then'](function(_0x35de2c){if(_0x35de2c){throw new db[(_0x9129('0x4e'))][(_0x9129('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x9129('0x49')](_0x1d1c62[_0x9129('0x47')]);})[_0x9129('0x22')](function(_0x262762){var _0x44d121=_0x1d1c62[_0x9129('0x50')][_0x9129('0x23')]({'plain':!![]});if(!_0x44d121)throw new Error(_0x9129('0x51'));if(_0x44d121[_0x9129('0x52')]===_0x9129('0x50')){var _0x325614=_0x262762[_0x9129('0x23')]({'plain':!![]});return db[_0x9129('0x53')][_0x9129('0x46')]({'where':{'name':_0x9129('0x24'),'userProfileId':_0x44d121[_0x9129('0x54')]},'raw':!![]})[_0x9129('0x22')](function(_0x23420b){if(_0x23420b&&_0x23420b[_0x9129('0x55')]===0x0){return db[_0x9129('0x56')][_0x9129('0x49')]({'name':_0x325614[_0x9129('0x28')],'resourceId':_0x325614['id'],'type':_0x23420b[_0x9129('0x28')],'sectionId':_0x23420b['id']},{})['then'](function(){return _0x262762;});}else{return _0x262762;}})['catch'](function(_0x338114){logger[_0x9129('0x26')](_0x9129('0x57'),_0x338114);throw _0x338114;});}return _0x262762;})[_0x9129('0x22')](respondWithResult(_0x580700,0xc9))[_0x9129('0x44')](handleError(_0x580700,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 495c00b..9720dc8 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 _0xed0c=['CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xed0c,0x1d7));var _0xced0=function(_0x154f3d,_0x28e8fe){_0x154f3d=_0x154f3d-0x0;var _0xe6f1c2=_0xed0c[_0x154f3d];return _0xe6f1c2;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var logger=require('../../config/logger')(_0xced0('0x2'));var moment=require('moment');var BPromise=require(_0xced0('0x3'));var rp=require(_0xced0('0x4'));var fs=require('fs');var path=require(_0xced0('0x5'));var rimraf=require(_0xced0('0x6'));var config=require(_0xced0('0x7'));var attributes=require(_0xced0('0x8'));module['exports']=function(_0x1bc3ce,_0x48ca15){return _0x1bc3ce[_0xced0('0x9')](_0xced0('0xa'),attributes,{'tableName':_0xced0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xced0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6e7a=['lodash','util','api','moment','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x401fdf,_0x1a3185){var _0x2198a6=function(_0x3fe20b){while(--_0x3fe20b){_0x401fdf['push'](_0x401fdf['shift']());}};_0x2198a6(++_0x1a3185);}(_0x6e7a,0x145));var _0xa6e7=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0x6e7a[_0x19c6a6];return _0x29014;};'use strict';var _=require(_0xa6e7('0x0'));var util=require(_0xa6e7('0x1'));var logger=require('../../config/logger')(_0xa6e7('0x2'));var moment=require(_0xa6e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6e7('0x4'));var rimraf=require(_0xa6e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xa6e7('0x6'));module[_0xa6e7('0x7')]=function(_0x2cc300,_0x54bb45){return _0x2cc300[_0xa6e7('0x8')](_0xa6e7('0x9'),attributes,{'tableName':_0xa6e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa6e7('0xb'),'collate':_0xa6e7('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 866cddb..73c7936 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(_0x40f3e5,_0x1620e9){var _0x4db38a=function(_0x3321cd){while(--_0x3321cd){_0x40f3e5['push'](_0x40f3e5['shift']());}};_0x4db38a(++_0x1620e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x4f63b2,_0x473573){var _0x3b93bd=function(_0x167b0d){while(--_0x167b0d){_0x4f63b2['push'](_0x4f63b2['shift']());}};_0x3b93bd(++_0x473573);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index fc89585..102bdb6 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 _0x978f=['index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./cannedAnswer.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x978f,0x1f0));var _0xf978=function(_0x1e08fa,_0x2177b8){_0x1e08fa=_0x1e08fa-0x0;var _0x48a80f=_0x978f[_0x1e08fa];return _0x48a80f;};'use strict';var multer=require(_0xf978('0x0'));var util=require(_0xf978('0x1'));var path=require(_0xf978('0x2'));var timeout=require('connect-timeout');var express=require(_0xf978('0x3'));var router=express['Router']();var fs_extra=require(_0xf978('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf978('0x5'));var config=require('../../config/environment');var controller=require(_0xf978('0x6'));router[_0xf978('0x7')]('/',auth['isAuthenticated'](),controller[_0xf978('0x8')]);router[_0xf978('0x7')](_0xf978('0x9'),auth[_0xf978('0xa')](),controller[_0xf978('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf978('0xc')]);router[_0xf978('0xd')](_0xf978('0x9'),auth[_0xf978('0xa')](),controller[_0xf978('0xe')]);router[_0xf978('0xf')](_0xf978('0x9'),auth[_0xf978('0xa')](),controller[_0xf978('0x10')]);module[_0xf978('0x11')]=router; \ No newline at end of file +var _0x6e12=['update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','create','put','/:id'];(function(_0x1858e0,_0x16386c){var _0x38af40=function(_0x26e183){while(--_0x26e183){_0x1858e0['push'](_0x1858e0['shift']());}};_0x38af40(++_0x16386c);}(_0x6e12,0x1df));var _0x26e1=function(_0x43434f,_0x220ac7){_0x43434f=_0x43434f-0x0;var _0x5e7af7=_0x6e12[_0x43434f];return _0x5e7af7;};'use strict';var multer=require(_0x26e1('0x0'));var util=require(_0x26e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x26e1('0x2'));var router=express['Router']();var fs_extra=require(_0x26e1('0x3'));var auth=require(_0x26e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x26e1('0x5'));var controller=require(_0x26e1('0x6'));router[_0x26e1('0x7')]('/',auth[_0x26e1('0x8')](),controller[_0x26e1('0x9')]);router[_0x26e1('0x7')]('/:id',auth[_0x26e1('0x8')](),controller[_0x26e1('0xa')]);router['post']('/',auth[_0x26e1('0x8')](),controller[_0x26e1('0xb')]);router[_0x26e1('0xc')](_0x26e1('0xd'),auth['isAuthenticated'](),controller[_0x26e1('0xe')]);router[_0x26e1('0xf')]('/:id',auth[_0x26e1('0x8')](),controller[_0x26e1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ad519d4..0b7473d 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 _0x6482=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x30c92b,_0x154324){var _0x33837b=function(_0x3366e6){while(--_0x3366e6){_0x30c92b['push'](_0x30c92b['shift']());}};_0x33837b(++_0x154324);}(_0x6482,0xb0));var _0x2648=function(_0x4b1904,_0x102e50){_0x4b1904=_0x4b1904-0x0;var _0x5ad3d1=_0x6482[_0x4b1904];return _0x5ad3d1;};'use strict';var Sequelize=require('sequelize');module[_0x2648('0x0')]={'calldate':{'type':Sequelize[_0x2648('0x1')],'allowNull':![],'defaultValue':_0x2648('0x2')},'clid':{'type':Sequelize[_0x2648('0x3')]},'src':{'type':Sequelize[_0x2648('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2648('0x3')]},'dstchannel':{'type':Sequelize[_0x2648('0x3')]},'lastapp':{'type':Sequelize[_0x2648('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2648('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2648('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2648('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2648('0x3')]},'uniqueid':{'type':Sequelize[_0x2648('0x3')]},'linkedid':{'type':Sequelize[_0x2648('0x3')]},'sequence':{'type':Sequelize[_0x2648('0x3')]},'peeraccount':{'type':Sequelize[_0x2648('0x3')]},'type':{'type':Sequelize[_0x2648('0x3')]},'tag':{'type':Sequelize[_0x2648('0x3')]}}; \ No newline at end of file +var _0x53a6=['DATE','STRING','INTEGER','sequelize'];(function(_0x243243,_0x448f1a){var _0x3c3a78=function(_0x27a7e9){while(--_0x27a7e9){_0x243243['push'](_0x243243['shift']());}};_0x3c3a78(++_0x448f1a);}(_0x53a6,0x18f));var _0x653a=function(_0x58d89e,_0x532333){_0x58d89e=_0x58d89e-0x0;var _0x572cb5=_0x53a6[_0x58d89e];return _0x572cb5;};'use strict';var Sequelize=require(_0x653a('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x653a('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x653a('0x2')]},'src':{'type':Sequelize[_0x653a('0x2')]},'dst':{'type':Sequelize[_0x653a('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x653a('0x2')]},'dstchannel':{'type':Sequelize[_0x653a('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x653a('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x653a('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x653a('0x2')]},'amaflags':{'type':Sequelize[_0x653a('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x653a('0x2')]},'userfield':{'type':Sequelize[_0x653a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x653a('0x2')]},'sequence':{'type':Sequelize[_0x653a('0x2')]},'peeraccount':{'type':Sequelize[_0x653a('0x2')]},'type':{'type':Sequelize[_0x653a('0x2')]},'tag':{'type':Sequelize[_0x653a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4680d21..e022eeb 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 _0xda19=['rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','includeAll','findAll','catch','show','body','find','params','describe'];(function(_0x492cd4,_0x2a640f){var _0x2c73f5=function(_0x720b8){while(--_0x720b8){_0x492cd4['push'](_0x492cd4['shift']());}};_0x2c73f5(++_0x2a640f);}(_0xda19,0xd5));var _0x9da1=function(_0x100573,_0x443a74){_0x100573=_0x100573-0x0;var _0x38be6a=_0xda19[_0x100573];return _0x38be6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=typeof _0x43c093[_0x9da1('0x19')]==='undefined'&&typeof _0x43c093[_0x9da1('0x1a')]===_0x9da1('0x1b');var _0xf83bf8=_0x37653d[_0x9da1('0x1c')];var _0xfb278d=_0x1a1a6b?0x0:_0x43c093[_0x9da1('0x19')];var _0x497676=_0x1a1a6b?_0x37653d['count']:_0x43c093[_0x9da1('0x19')]+_0x43c093[_0x9da1('0x1a')];var _0x1b0e7f;if(_0x497676>=_0xf83bf8){_0x497676=_0xf83bf8;_0x1b0e7f=0xc8;}else{_0x1b0e7f=0xce;}_0x433ff4[_0x9da1('0x18')](_0x1b0e7f);return _0x433ff4[_0x9da1('0x1d')](_0x9da1('0x1e'),_0xfb278d+'-'+_0x497676+'/'+_0xf83bf8)[_0x9da1('0x1f')](_0x37653d);}return null;};}function patchUpdates(_0x47e5cf){return function(_0x1a459c){try{jsonpatch[_0x9da1('0x20')](_0x1a459c,_0x47e5cf,!![]);}catch(_0x9c3b37){return BPromise[_0x9da1('0x21')](_0x9c3b37);}return _0x1a459c[_0x9da1('0x22')]();};}function saveUpdates(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x23')](_0x4e9d7d)[_0x9da1('0x24')](function(_0x330219){return _0x330219;});}return null;};}function removeEntity(_0x32eb55,_0x165b73){return function(_0x4c60aa){if(_0x4c60aa){return _0x4c60aa[_0x9da1('0x25')]()[_0x9da1('0x24')](function(){_0x32eb55['status'](0xcc)[_0x9da1('0x26')]();});}};}function handleEntityNotFound(_0x3f5680,_0x534210){return function(_0x2fd49c){if(!_0x2fd49c){_0x3f5680[_0x9da1('0x17')](0x194);}return _0x2fd49c;};}function handleError(_0x4b1152,_0x36b87a){_0x36b87a=_0x36b87a||0x1f4;return function(_0x1d6af5){logger['error'](_0x1d6af5['stack']);if(_0x1d6af5[_0x9da1('0x27')]){delete _0x1d6af5[_0x9da1('0x27')];}_0x4b1152['status'](_0x36b87a)[_0x9da1('0x28')](_0x1d6af5);};}exports['index']=function(_0x5a6f2d,_0x5a59c2){var _0x31b826={},_0x404b86={},_0x24c6d5={'count':0x0,'rows':[]};var _0x26dd58=_[_0x9da1('0x29')](db['Cdr'][_0x9da1('0x2a')],function(_0x4e6083){return{'name':_0x4e6083[_0x9da1('0x2b')],'type':_0x4e6083[_0x9da1('0x2c')]['key']};});_0x404b86[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x26dd58,'name');_0x404b86[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5a6f2d[_0x9da1('0x2e')]);_0x404b86[_0x9da1('0x30')]=_['intersection'](_0x404b86['model'],_0x404b86[_0x9da1('0x2e')]);_0x31b826[_0x9da1('0x31')]=_[_0x9da1('0x32')](_0x404b86[_0x9da1('0x2d')],qs[_0x9da1('0x33')](_0x5a6f2d['query'][_0x9da1('0x33')]));_0x31b826[_0x9da1('0x31')]=_0x31b826[_0x9da1('0x31')][_0x9da1('0x34')]?_0x31b826[_0x9da1('0x31')]:_0x404b86[_0x9da1('0x2d')];if(!_0x5a6f2d['query'][_0x9da1('0x35')]('nolimit')){_0x31b826['limit']=qs[_0x9da1('0x1a')](_0x5a6f2d['query'][_0x9da1('0x1a')]);_0x31b826[_0x9da1('0x19')]=qs[_0x9da1('0x19')](_0x5a6f2d[_0x9da1('0x2e')][_0x9da1('0x19')]);}_0x31b826[_0x9da1('0x36')]=qs[_0x9da1('0x37')](_0x5a6f2d[_0x9da1('0x2e')]['sort']);_0x31b826[_0x9da1('0x38')]=qs['filters'](_[_0x9da1('0x39')](_0x5a6f2d['query'],_0x404b86['filters']),_0x26dd58);if(_0x5a6f2d[_0x9da1('0x2e')]['filter']){_0x31b826[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x31b826['where'],{'$or':_[_0x9da1('0x29')](_0x26dd58,function(_0x1b750f){if(_0x1b750f[_0x9da1('0x2c')]!==_0x9da1('0x3b')){var _0x56bd49={};_0x56bd49[_0x1b750f[_0x9da1('0x27')]]={'$like':'%'+_0x5a6f2d['query'][_0x9da1('0x3c')]+'%'};return _0x56bd49;}})});}_0x31b826=_['merge']({},_0x31b826,_0x5a6f2d[_0x9da1('0x3d')]);var _0x46c176={'where':_0x31b826['where']};return db[_0x9da1('0x3e')][_0x9da1('0x1c')](_0x46c176)[_0x9da1('0x24')](function(_0x4e9af3){_0x24c6d5['count']=_0x4e9af3;if(_0x5a6f2d['query'][_0x9da1('0x3f')]){_0x31b826['include']=[{'all':!![]}];}return db[_0x9da1('0x3e')][_0x9da1('0x40')](_0x31b826);})[_0x9da1('0x24')](function(_0x43c064){_0x24c6d5['rows']=_0x43c064;return _0x24c6d5;})[_0x9da1('0x24')](respondWithFilteredResult(_0x5a59c2,_0x31b826))[_0x9da1('0x41')](handleError(_0x5a59c2,null));};exports[_0x9da1('0x42')]=function(_0x173dc6,_0x28fc88){var _0x26c225={'raw':!![],'where':{'id':_0x173dc6['params']['id']}},_0x28e0b2={};_0x28e0b2[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x3e')]['rawAttributes']);_0x28e0b2[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x173dc6['query']);_0x28e0b2[_0x9da1('0x30')]=_[_0x9da1('0x32')](_0x28e0b2['model'],_0x28e0b2[_0x9da1('0x2e')]);_0x26c225['attributes']=_[_0x9da1('0x32')](_0x28e0b2[_0x9da1('0x2d')],qs['fields'](_0x173dc6['query'][_0x9da1('0x33')]));_0x26c225[_0x9da1('0x31')]=_0x26c225[_0x9da1('0x31')][_0x9da1('0x34')]?_0x26c225[_0x9da1('0x31')]:_0x28e0b2[_0x9da1('0x2d')];if(_0x173dc6[_0x9da1('0x2e')][_0x9da1('0x3f')]){_0x26c225['include']=[{'all':!![]}];}_0x26c225=_[_0x9da1('0x3a')]({},_0x26c225,_0x173dc6[_0x9da1('0x3d')]);return db[_0x9da1('0x3e')]['find'](_0x26c225)[_0x9da1('0x24')](handleEntityNotFound(_0x28fc88,null))[_0x9da1('0x24')](respondWithResult(_0x28fc88,null))[_0x9da1('0x41')](handleError(_0x28fc88,null));};exports['create']=function(_0x336fc3,_0x351d4d){return db[_0x9da1('0x3e')]['create'](_0x336fc3[_0x9da1('0x43')],{})['then'](respondWithResult(_0x351d4d,0xc9))['catch'](handleError(_0x351d4d,null));};exports[_0x9da1('0x23')]=function(_0x43c47d,_0x5afbc7){if(_0x43c47d[_0x9da1('0x43')]['id']){delete _0x43c47d[_0x9da1('0x43')]['id'];}return db['Cdr'][_0x9da1('0x44')]({'where':{'id':_0x43c47d[_0x9da1('0x45')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x5afbc7,null))[_0x9da1('0x24')](saveUpdates(_0x43c47d[_0x9da1('0x43')],null))[_0x9da1('0x24')](respondWithResult(_0x5afbc7,null))[_0x9da1('0x41')](handleError(_0x5afbc7,null));};exports[_0x9da1('0x25')]=function(_0x3889f4,_0x5c9b46){return db[_0x9da1('0x3e')][_0x9da1('0x44')]({'where':{'id':_0x3889f4[_0x9da1('0x45')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x5c9b46,null))['then'](removeEntity(_0x5c9b46,null))['catch'](handleError(_0x5c9b46,null));};exports[_0x9da1('0x46')]=function(_0x6ca1ac,_0x3870dd){return db[_0x9da1('0x3e')][_0x9da1('0x46')]()[_0x9da1('0x24')](respondWithResult(_0x3870dd,null))[_0x9da1('0x41')](handleError(_0x3870dd,null));}; \ No newline at end of file +var _0x3435=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','count','includeAll','include','findAll','catch','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','send','map','fieldName','type','key','name','query','keys'];(function(_0x497d3c,_0x2205fa){var _0x3174ac=function(_0xbcf466){while(--_0xbcf466){_0x497d3c['push'](_0x497d3c['shift']());}};_0x3174ac(++_0x2205fa);}(_0x3435,0xfa));var _0x5343=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x3435[_0x46ae5a];return _0x434986;};'use strict';var emlformat=require(_0x5343('0x0'));var rimraf=require(_0x5343('0x1'));var zipdir=require(_0x5343('0x2'));var jsonpatch=require(_0x5343('0x3'));var rp=require(_0x5343('0x4'));var moment=require(_0x5343('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5343('0x6'));var util=require(_0x5343('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5343('0x8'));var ejs=require(_0x5343('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5343('0xa'));var crypto=require(_0x5343('0xb'));var jsforce=require(_0x5343('0xc'));var deskjs=require(_0x5343('0xd'));var toCsv=require(_0x5343('0x8'));var querystring=require('querystring');var Papa=require(_0x5343('0xe'));var Redis=require('ioredis');var authService=require(_0x5343('0xf'));var qs=require(_0x5343('0x10'));var as=require(_0x5343('0x11'));var hardwareService=require(_0x5343('0x12'));var logger=require(_0x5343('0x13'))('api');var utils=require(_0x5343('0x14'));var config=require(_0x5343('0x15'));var licenseUtil=require(_0x5343('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ddeb7,_0x5f473f){_0x5f473f=_0x5f473f||0xcc;return function(_0x82074d){if(_0x82074d){return _0x2ddeb7[_0x5343('0x17')](_0x5f473f);}return _0x2ddeb7['status'](_0x5f473f)[_0x5343('0x18')]();};}function respondWithResult(_0x4cdfae,_0x13066f){_0x13066f=_0x13066f||0xc8;return function(_0x46c3d7){if(_0x46c3d7){return _0x4cdfae[_0x5343('0x19')](_0x13066f)[_0x5343('0x1a')](_0x46c3d7);}};}function respondWithFilteredResult(_0x4dbff1,_0x446e90){return function(_0x588a96){if(_0x588a96){var _0x1df724=typeof _0x446e90[_0x5343('0x1b')]===_0x5343('0x1c')&&typeof _0x446e90[_0x5343('0x1d')]===_0x5343('0x1c');var _0x4b5852=_0x588a96['count'];var _0x432992=_0x1df724?0x0:_0x446e90[_0x5343('0x1b')];var _0x1f5098=_0x1df724?_0x588a96['count']:_0x446e90[_0x5343('0x1b')]+_0x446e90[_0x5343('0x1d')];var _0x376c35;if(_0x1f5098>=_0x4b5852){_0x1f5098=_0x4b5852;_0x376c35=0xc8;}else{_0x376c35=0xce;}_0x4dbff1[_0x5343('0x19')](_0x376c35);return _0x4dbff1[_0x5343('0x1e')](_0x5343('0x1f'),_0x432992+'-'+_0x1f5098+'/'+_0x4b5852)[_0x5343('0x1a')](_0x588a96);}return null;};}function patchUpdates(_0x40ba38){return function(_0x35d41d){try{jsonpatch['apply'](_0x35d41d,_0x40ba38,!![]);}catch(_0x287304){return BPromise[_0x5343('0x20')](_0x287304);}return _0x35d41d[_0x5343('0x21')]();};}function saveUpdates(_0x42f92d,_0xd95a5b){return function(_0x4e7c0f){if(_0x4e7c0f){return _0x4e7c0f[_0x5343('0x22')](_0x42f92d)[_0x5343('0x23')](function(_0x24c250){return _0x24c250;});}return null;};}function removeEntity(_0x380aae,_0x290ce8){return function(_0x486597){if(_0x486597){return _0x486597[_0x5343('0x24')]()[_0x5343('0x23')](function(){_0x380aae['status'](0xcc)[_0x5343('0x18')]();});}};}function handleEntityNotFound(_0x96bbf6,_0x1ab5eb){return function(_0x5e4344){if(!_0x5e4344){_0x96bbf6['sendStatus'](0x194);}return _0x5e4344;};}function handleError(_0x462cb6,_0x5871de){_0x5871de=_0x5871de||0x1f4;return function(_0x14d05a){logger['error'](_0x14d05a[_0x5343('0x25')]);if(_0x14d05a['name']){delete _0x14d05a['name'];}_0x462cb6[_0x5343('0x19')](_0x5871de)[_0x5343('0x26')](_0x14d05a);};}exports['index']=function(_0x5d597e,_0x1202bb){var _0x5d0853={},_0x2ed8c9={},_0x47d49a={'count':0x0,'rows':[]};var _0x5c689e=_[_0x5343('0x27')](db['Cdr']['rawAttributes'],function(_0x125e4c){return{'name':_0x125e4c[_0x5343('0x28')],'type':_0x125e4c[_0x5343('0x29')][_0x5343('0x2a')]};});_0x2ed8c9['model']=_['map'](_0x5c689e,_0x5343('0x2b'));_0x2ed8c9[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x5d597e[_0x5343('0x2c')]);_0x2ed8c9[_0x5343('0x2e')]=_[_0x5343('0x2f')](_0x2ed8c9[_0x5343('0x30')],_0x2ed8c9[_0x5343('0x2c')]);_0x5d0853[_0x5343('0x31')]=_[_0x5343('0x2f')](_0x2ed8c9[_0x5343('0x30')],qs[_0x5343('0x32')](_0x5d597e['query']['fields']));_0x5d0853[_0x5343('0x31')]=_0x5d0853[_0x5343('0x31')]['length']?_0x5d0853[_0x5343('0x31')]:_0x2ed8c9['model'];if(!_0x5d597e[_0x5343('0x2c')][_0x5343('0x33')](_0x5343('0x34'))){_0x5d0853[_0x5343('0x1d')]=qs['limit'](_0x5d597e['query'][_0x5343('0x1d')]);_0x5d0853['offset']=qs[_0x5343('0x1b')](_0x5d597e[_0x5343('0x2c')]['offset']);}_0x5d0853[_0x5343('0x35')]=qs['sort'](_0x5d597e['query'][_0x5343('0x36')]);_0x5d0853[_0x5343('0x37')]=qs[_0x5343('0x2e')](_[_0x5343('0x38')](_0x5d597e['query'],_0x2ed8c9['filters']),_0x5c689e);if(_0x5d597e['query']['filter']){_0x5d0853[_0x5343('0x37')]=_[_0x5343('0x39')](_0x5d0853[_0x5343('0x37')],{'$or':_[_0x5343('0x27')](_0x5c689e,function(_0x3c517a){if(_0x3c517a[_0x5343('0x29')]!==_0x5343('0x3a')){var _0x4d2951={};_0x4d2951[_0x3c517a[_0x5343('0x2b')]]={'$like':'%'+_0x5d597e['query'][_0x5343('0x3b')]+'%'};return _0x4d2951;}})});}_0x5d0853=_[_0x5343('0x39')]({},_0x5d0853,_0x5d597e[_0x5343('0x3c')]);var _0x2f004a={'where':_0x5d0853[_0x5343('0x37')]};return db[_0x5343('0x3d')][_0x5343('0x3e')](_0x2f004a)['then'](function(_0xb93d9){_0x47d49a['count']=_0xb93d9;if(_0x5d597e[_0x5343('0x2c')][_0x5343('0x3f')]){_0x5d0853[_0x5343('0x40')]=[{'all':!![]}];}return db[_0x5343('0x3d')][_0x5343('0x41')](_0x5d0853);})[_0x5343('0x23')](function(_0x2c75bd){_0x47d49a['rows']=_0x2c75bd;return _0x47d49a;})[_0x5343('0x23')](respondWithFilteredResult(_0x1202bb,_0x5d0853))[_0x5343('0x42')](handleError(_0x1202bb,null));};exports['show']=function(_0x41df61,_0x16c880){var _0x4c576d={'raw':!![],'where':{'id':_0x41df61[_0x5343('0x43')]['id']}},_0x53c3c7={};_0x53c3c7[_0x5343('0x30')]=_[_0x5343('0x2d')](db['Cdr'][_0x5343('0x44')]);_0x53c3c7[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x41df61[_0x5343('0x2c')]);_0x53c3c7[_0x5343('0x2e')]=_[_0x5343('0x2f')](_0x53c3c7[_0x5343('0x30')],_0x53c3c7['query']);_0x4c576d[_0x5343('0x31')]=_[_0x5343('0x2f')](_0x53c3c7[_0x5343('0x30')],qs[_0x5343('0x32')](_0x41df61[_0x5343('0x2c')][_0x5343('0x32')]));_0x4c576d[_0x5343('0x31')]=_0x4c576d[_0x5343('0x31')][_0x5343('0x45')]?_0x4c576d[_0x5343('0x31')]:_0x53c3c7[_0x5343('0x30')];if(_0x41df61[_0x5343('0x2c')][_0x5343('0x3f')]){_0x4c576d[_0x5343('0x40')]=[{'all':!![]}];}_0x4c576d=_[_0x5343('0x39')]({},_0x4c576d,_0x41df61['options']);return db[_0x5343('0x3d')][_0x5343('0x46')](_0x4c576d)['then'](handleEntityNotFound(_0x16c880,null))[_0x5343('0x23')](respondWithResult(_0x16c880,null))[_0x5343('0x42')](handleError(_0x16c880,null));};exports[_0x5343('0x47')]=function(_0x1da1b7,_0x194316){return db['Cdr'][_0x5343('0x47')](_0x1da1b7['body'],{})['then'](respondWithResult(_0x194316,0xc9))[_0x5343('0x42')](handleError(_0x194316,null));};exports[_0x5343('0x22')]=function(_0x10329c,_0x1cd4ed){if(_0x10329c['body']['id']){delete _0x10329c[_0x5343('0x48')]['id'];}return db[_0x5343('0x3d')][_0x5343('0x46')]({'where':{'id':_0x10329c[_0x5343('0x43')]['id']}})[_0x5343('0x23')](handleEntityNotFound(_0x1cd4ed,null))[_0x5343('0x23')](saveUpdates(_0x10329c[_0x5343('0x48')],null))[_0x5343('0x23')](respondWithResult(_0x1cd4ed,null))[_0x5343('0x42')](handleError(_0x1cd4ed,null));};exports[_0x5343('0x24')]=function(_0x566d71,_0x1cbf7c){return db[_0x5343('0x3d')][_0x5343('0x46')]({'where':{'id':_0x566d71[_0x5343('0x43')]['id']}})[_0x5343('0x23')](handleEntityNotFound(_0x1cbf7c,null))[_0x5343('0x23')](removeEntity(_0x1cbf7c,null))[_0x5343('0x42')](handleError(_0x1cbf7c,null));};exports[_0x5343('0x49')]=function(_0x3b3c64,_0xad51f4){return db['Cdr'][_0x5343('0x49')]()['then'](respondWithResult(_0xad51f4,null))['catch'](handleError(_0xad51f4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 135ad6d..d8fed5e 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(_0x42930b,_0x3e920d){var _0x1c27a1=function(_0x4912ad){while(--_0x4912ad){_0x42930b['push'](_0x42930b['shift']());}};_0x1c27a1(++_0x3e920d);}(_0x7a54,0x106));var _0x47a5=function(_0x413719,_0x2aa3b8){_0x413719=_0x413719-0x0;var _0x352ced=_0x7a54[_0x413719];return _0x352ced;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x39cf37,_0x4dd4ab){var _0x310d01=function(_0x548e3a){while(--_0x548e3a){_0x39cf37['push'](_0x39cf37['shift']());}};_0x310d01(++_0x4dd4ab);}(_0x7a54,0x106));var _0x47a5=function(_0xbdd2ee,_0x3c6be1){_0xbdd2ee=_0xbdd2ee-0x0;var _0x3b9fe4=_0x7a54[_0xbdd2ee];return _0x3b9fe4;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 83646d8..5dbbc05 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 _0xed40=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x185487,_0x278958){var _0x8c7d49=function(_0x53362d){while(--_0x53362d){_0x185487['push'](_0x185487['shift']());}};_0x8c7d49(++_0x278958);}(_0xed40,0x17b));var _0x0ed4=function(_0x3a1bd7,_0x13657d){_0x3a1bd7=_0x3a1bd7-0x0;var _0x456f58=_0xed40[_0x3a1bd7];return _0x456f58;};'use strict';var _=require(_0x0ed4('0x0'));var util=require(_0x0ed4('0x1'));var moment=require(_0x0ed4('0x2'));var BPromise=require(_0x0ed4('0x3'));var rs=require(_0x0ed4('0x4'));var fs=require('fs');var Redis=require(_0x0ed4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ed4('0x6'))('rpc');var config=require(_0x0ed4('0x7'));var jayson=require(_0x0ed4('0x8'));var client=jayson[_0x0ed4('0x9')][_0x0ed4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c370c,_0x3c81e7,_0x4a2b21){return new BPromise(function(_0x2503e5,_0x3df7bb){return client[_0x0ed4('0xb')](_0x3c370c,_0x4a2b21)['then'](function(_0x4b7a0e){logger[_0x0ed4('0xc')](_0x0ed4('0xd'),_0x3c81e7,_0x0ed4('0xe'));logger['debug'](_0x0ed4('0xf'),_0x3c81e7,'request\x20sent',JSON[_0x0ed4('0x10')](_0x4b7a0e));if(_0x4b7a0e[_0x0ed4('0x11')]){if(_0x4b7a0e[_0x0ed4('0x11')]['code']===0x1f4){logger[_0x0ed4('0x11')](_0x0ed4('0xd'),_0x3c81e7,_0x4b7a0e[_0x0ed4('0x11')]['message']);return _0x3df7bb(_0x4b7a0e[_0x0ed4('0x11')][_0x0ed4('0x12')]);}logger[_0x0ed4('0x11')](_0x0ed4('0xd'),_0x3c81e7,_0x4b7a0e[_0x0ed4('0x11')]['message']);return _0x2503e5(_0x4b7a0e[_0x0ed4('0x11')][_0x0ed4('0x12')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x3c81e7,_0x0ed4('0xe'));_0x2503e5(_0x4b7a0e['result'][_0x0ed4('0x12')]);}})[_0x0ed4('0x13')](function(_0x4fdc04){logger['error'](_0x0ed4('0xd'),_0x3c81e7,_0x4fdc04);_0x3df7bb(_0x4fdc04);});});} \ No newline at end of file +var _0xc16b=['moment','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x37af2e,_0x355e49){var _0x357f12=function(_0x40671c){while(--_0x40671c){_0x37af2e['push'](_0x37af2e['shift']());}};_0x357f12(++_0x355e49);}(_0xc16b,0xb2));var _0xbc16=function(_0xe391aa,_0x255528){_0xe391aa=_0xe391aa-0x0;var _0x793c4d=_0xc16b[_0xe391aa];return _0x793c4d;};'use strict';var _=require(_0xbc16('0x0'));var util=require(_0xbc16('0x1'));var moment=require(_0xbc16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc16('0x3'));var logger=require('../../config/logger')(_0xbc16('0x4'));var config=require(_0xbc16('0x5'));var jayson=require(_0xbc16('0x6'));var client=jayson['client'][_0xbc16('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x490598,_0x528309,_0x1ab9d2){return new BPromise(function(_0x126312,_0x16ce18){return client[_0xbc16('0x8')](_0x490598,_0x1ab9d2)[_0xbc16('0x9')](function(_0x2c2a35){logger[_0xbc16('0xa')]('Cdr,\x20%s,\x20%s',_0x528309,_0xbc16('0xb'));logger[_0xbc16('0xc')](_0xbc16('0xd'),_0x528309,'request\x20sent',JSON['stringify'](_0x2c2a35));if(_0x2c2a35[_0xbc16('0xe')]){if(_0x2c2a35[_0xbc16('0xe')][_0xbc16('0xf')]===0x1f4){logger['error'](_0xbc16('0x10'),_0x528309,_0x2c2a35[_0xbc16('0xe')][_0xbc16('0x11')]);return _0x16ce18(_0x2c2a35['error'][_0xbc16('0x11')]);}logger[_0xbc16('0xe')](_0xbc16('0x10'),_0x528309,_0x2c2a35[_0xbc16('0xe')]['message']);return _0x126312(_0x2c2a35['error'][_0xbc16('0x11')]);}else{logger[_0xbc16('0xa')](_0xbc16('0x10'),_0x528309,_0xbc16('0xb'));_0x126312(_0x2c2a35[_0xbc16('0x12')][_0xbc16('0x11')]);}})[_0xbc16('0x13')](function(_0x2405a9){logger[_0xbc16('0xe')]('Cdr,\x20%s,\x20%s',_0x528309,_0x2405a9);_0x16ce18(_0x2405a9);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8bca059..386e85f 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(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 63cca07..2aa41e2 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 _0xd0ab=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0xa6f6a6,_0x138b7a){var _0x71a78a=function(_0x3070d1){while(--_0x3070d1){_0xa6f6a6['push'](_0xa6f6a6['shift']());}};_0x71a78a(++_0x138b7a);}(_0xd0ab,0x66));var _0xbd0a=function(_0x1ad248,_0x1579a6){_0x1ad248=_0x1ad248-0x0;var _0x3636df=_0xd0ab[_0x1ad248];return _0x3636df;};'use strict';var Sequelize=require(_0xbd0a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbd0a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbd0a('0x2')]()},'description':{'type':Sequelize[_0xbd0a('0x3')]},'interval':{'type':Sequelize[_0xbd0a('0x3')],'defaultValue':_0xbd0a('0x4')}}; \ No newline at end of file +var _0x5226=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2646ad,_0x2915ba){var _0x350cbb=function(_0x48a62c){while(--_0x48a62c){_0x2646ad['push'](_0x2646ad['shift']());}};_0x350cbb(++_0x2915ba);}(_0x5226,0x1b2));var _0x6522=function(_0x3c538f,_0x467bbf){_0x3c538f=_0x3c538f-0x0;var _0x44b0a8=_0x5226[_0x3c538f];return _0x44b0a8;};'use strict';var Sequelize=require(_0x6522('0x0'));module[_0x6522('0x1')]={'priority':{'type':Sequelize[_0x6522('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6522('0x3')],'allowNull':![],'defaultValue':_0x6522('0x4')},'appdata':{'type':Sequelize[_0x6522('0x5')]()},'description':{'type':Sequelize[_0x6522('0x3')]},'interval':{'type':Sequelize[_0x6522('0x3')],'defaultValue':_0x6522('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b2dde11..b6cd8cd 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 _0x0c5d=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','options','find','body','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x17e799,_0x490f26){var _0x682f42=function(_0x4b9043){while(--_0x4b9043){_0x17e799['push'](_0x17e799['shift']());}};_0x682f42(++_0x490f26);}(_0x0c5d,0x6c));var _0xd0c5=function(_0xf7f498,_0x3238c5){_0xf7f498=_0xf7f498-0x0;var _0x2bde38=_0x0c5d[_0xf7f498];return _0x2bde38;};'use strict';var emlformat=require(_0xd0c5('0x0'));var rimraf=require(_0xd0c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0c5('0x2'));var rp=require('request-promise');var moment=require(_0xd0c5('0x3'));var BPromise=require(_0xd0c5('0x4'));var Mustache=require(_0xd0c5('0x5'));var util=require(_0xd0c5('0x6'));var path=require(_0xd0c5('0x7'));var sox=require(_0xd0c5('0x8'));var csv=require(_0xd0c5('0x9'));var ejs=require(_0xd0c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0c5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xd'));var Papa=require(_0xd0c5('0xe'));var Redis=require('ioredis');var authService=require(_0xd0c5('0xf'));var qs=require(_0xd0c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0c5('0x11'));var logger=require(_0xd0c5('0x12'))(_0xd0c5('0x13'));var utils=require(_0xd0c5('0x14'));var config=require(_0xd0c5('0x15'));var licenseUtil=require(_0xd0c5('0x16'));var db=require(_0xd0c5('0x17'))['db'];function respondWithStatusCode(_0x46db00,_0x1e5ac4){_0x1e5ac4=_0x1e5ac4||0xcc;return function(_0x125470){if(_0x125470){return _0x46db00[_0xd0c5('0x18')](_0x1e5ac4);}return _0x46db00[_0xd0c5('0x19')](_0x1e5ac4)['end']();};}function respondWithResult(_0x11511d,_0x1c1cc8){_0x1c1cc8=_0x1c1cc8||0xc8;return function(_0x1fc98d){if(_0x1fc98d){return _0x11511d[_0xd0c5('0x19')](_0x1c1cc8)['json'](_0x1fc98d);}};}function respondWithFilteredResult(_0x280e22,_0x23d941){return function(_0x242615){if(_0x242615){var _0x639e72=typeof _0x23d941['offset']===_0xd0c5('0x1a')&&typeof _0x23d941['limit']===_0xd0c5('0x1a');var _0x57c76a=_0x242615[_0xd0c5('0x1b')];var _0x692aeb=_0x639e72?0x0:_0x23d941[_0xd0c5('0x1c')];var _0x1cfe05=_0x639e72?_0x242615[_0xd0c5('0x1b')]:_0x23d941[_0xd0c5('0x1c')]+_0x23d941[_0xd0c5('0x1d')];var _0x287961;if(_0x1cfe05>=_0x57c76a){_0x1cfe05=_0x57c76a;_0x287961=0xc8;}else{_0x287961=0xce;}_0x280e22['status'](_0x287961);return _0x280e22[_0xd0c5('0x1e')](_0xd0c5('0x1f'),_0x692aeb+'-'+_0x1cfe05+'/'+_0x57c76a)['json'](_0x242615);}return null;};}function patchUpdates(_0x835e8d){return function(_0x30f548){try{jsonpatch[_0xd0c5('0x20')](_0x30f548,_0x835e8d,!![]);}catch(_0x6febb1){return BPromise[_0xd0c5('0x21')](_0x6febb1);}return _0x30f548[_0xd0c5('0x22')]();};}function saveUpdates(_0x331849,_0x49db81){return function(_0x4ac41c){if(_0x4ac41c){return _0x4ac41c[_0xd0c5('0x23')](_0x331849)[_0xd0c5('0x24')](function(_0x439dd5){return _0x439dd5;});}return null;};}function removeEntity(_0x6ce082,_0x5eb093){return function(_0x185e33){if(_0x185e33){return _0x185e33['destroy']()['then'](function(){_0x6ce082[_0xd0c5('0x19')](0xcc)[_0xd0c5('0x25')]();});}};}function handleEntityNotFound(_0x364963,_0x73f292){return function(_0x3a5edf){if(!_0x3a5edf){_0x364963[_0xd0c5('0x18')](0x194);}return _0x3a5edf;};}function handleError(_0xbcef61,_0x17443b){_0x17443b=_0x17443b||0x1f4;return function(_0x19b9ec){logger[_0xd0c5('0x26')](_0x19b9ec[_0xd0c5('0x27')]);if(_0x19b9ec[_0xd0c5('0x28')]){delete _0x19b9ec[_0xd0c5('0x28')];}_0xbcef61[_0xd0c5('0x19')](_0x17443b)[_0xd0c5('0x29')](_0x19b9ec);};}exports[_0xd0c5('0x2a')]=function(_0x24d35f,_0x572e66){var _0x39284e={'raw':!![],'where':{'id':_0x24d35f[_0xd0c5('0x2b')]['id']}},_0x36415f={};_0x36415f[_0xd0c5('0x2c')]=_[_0xd0c5('0x2d')](db[_0xd0c5('0x2e')][_0xd0c5('0x2f')]);_0x36415f['query']=_[_0xd0c5('0x2d')](_0x24d35f['query']);_0x36415f[_0xd0c5('0x30')]=_[_0xd0c5('0x31')](_0x36415f[_0xd0c5('0x2c')],_0x36415f[_0xd0c5('0x32')]);_0x39284e[_0xd0c5('0x33')]=_[_0xd0c5('0x31')](_0x36415f[_0xd0c5('0x2c')],qs['fields'](_0x24d35f['query'][_0xd0c5('0x34')]));_0x39284e['attributes']=_0x39284e[_0xd0c5('0x33')][_0xd0c5('0x35')]?_0x39284e[_0xd0c5('0x33')]:_0x36415f[_0xd0c5('0x2c')];if(_0x24d35f['query'][_0xd0c5('0x36')]){_0x39284e[_0xd0c5('0x37')]=[{'all':!![]}];}_0x39284e=_['merge']({},_0x39284e,_0x24d35f[_0xd0c5('0x38')]);return db['ChatApplication'][_0xd0c5('0x39')](_0x39284e)[_0xd0c5('0x24')](handleEntityNotFound(_0x572e66,null))[_0xd0c5('0x24')](respondWithResult(_0x572e66,null))['catch'](handleError(_0x572e66,null));};exports[_0xd0c5('0x23')]=function(_0x263d3b,_0x2e8f04){if(_0x263d3b[_0xd0c5('0x3a')]['id']){delete _0x263d3b[_0xd0c5('0x3a')]['id'];}return db[_0xd0c5('0x2e')][_0xd0c5('0x39')]({'where':{'id':_0x263d3b[_0xd0c5('0x2b')]['id']}})[_0xd0c5('0x24')](handleEntityNotFound(_0x2e8f04,null))[_0xd0c5('0x24')](saveUpdates(_0x263d3b[_0xd0c5('0x3a')],null))[_0xd0c5('0x24')](respondWithResult(_0x2e8f04,null))[_0xd0c5('0x3b')](handleError(_0x2e8f04,null));};exports['destroy']=function(_0x4e3d0e,_0x1fe07f){return db['ChatApplication'][_0xd0c5('0x39')]({'where':{'id':_0x4e3d0e[_0xd0c5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1fe07f,null))[_0xd0c5('0x24')](removeEntity(_0x1fe07f,null))[_0xd0c5('0x3b')](handleError(_0x1fe07f,null));}; \ No newline at end of file +var _0xc2af=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','update','params','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x9c123e,_0x2c8bff){var _0x2157df=function(_0x13080a){while(--_0x13080a){_0x9c123e['push'](_0x9c123e['shift']());}};_0x2157df(++_0x2c8bff);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x1cbc64,_0x55fecc){_0x1cbc64=_0x1cbc64-0x0;var _0x1a601f=_0xc2af[_0x1cbc64];return _0x1a601f;};'use strict';var emlformat=require(_0xfc2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc2a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc2a('0x2'));var moment=require(_0xfc2a('0x3'));var BPromise=require(_0xfc2a('0x4'));var Mustache=require(_0xfc2a('0x5'));var util=require(_0xfc2a('0x6'));var path=require(_0xfc2a('0x7'));var sox=require(_0xfc2a('0x8'));var csv=require(_0xfc2a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc2a('0xa'));var _=require('lodash');var squel=require(_0xfc2a('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc2a('0xc'));var deskjs=require(_0xfc2a('0xd'));var toCsv=require(_0xfc2a('0x9'));var querystring=require(_0xfc2a('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfc2a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc2a('0x11'));var logger=require(_0xfc2a('0x12'))(_0xfc2a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc2a('0x14'));var db=require(_0xfc2a('0x15'))['db'];function respondWithStatusCode(_0x771766,_0x41395e){_0x41395e=_0x41395e||0xcc;return function(_0x268993){if(_0x268993){return _0x771766[_0xfc2a('0x16')](_0x41395e);}return _0x771766[_0xfc2a('0x17')](_0x41395e)[_0xfc2a('0x18')]();};}function respondWithResult(_0xe4b058,_0x55574a){_0x55574a=_0x55574a||0xc8;return function(_0x4e6b7e){if(_0x4e6b7e){return _0xe4b058[_0xfc2a('0x17')](_0x55574a)[_0xfc2a('0x19')](_0x4e6b7e);}};}function respondWithFilteredResult(_0x594a59,_0x12dd07){return function(_0x2f311c){if(_0x2f311c){var _0x21654f=typeof _0x12dd07[_0xfc2a('0x1a')]===_0xfc2a('0x1b')&&typeof _0x12dd07[_0xfc2a('0x1c')]===_0xfc2a('0x1b');var _0x678f8d=_0x2f311c[_0xfc2a('0x1d')];var _0x1e1524=_0x21654f?0x0:_0x12dd07[_0xfc2a('0x1a')];var _0x39bcb2=_0x21654f?_0x2f311c[_0xfc2a('0x1d')]:_0x12dd07['offset']+_0x12dd07[_0xfc2a('0x1c')];var _0x15ff6d;if(_0x39bcb2>=_0x678f8d){_0x39bcb2=_0x678f8d;_0x15ff6d=0xc8;}else{_0x15ff6d=0xce;}_0x594a59['status'](_0x15ff6d);return _0x594a59[_0xfc2a('0x1e')]('Content-Range',_0x1e1524+'-'+_0x39bcb2+'/'+_0x678f8d)['json'](_0x2f311c);}return null;};}function patchUpdates(_0x3e88fe){return function(_0x2b7f5c){try{jsonpatch[_0xfc2a('0x1f')](_0x2b7f5c,_0x3e88fe,!![]);}catch(_0x40ed0b){return BPromise[_0xfc2a('0x20')](_0x40ed0b);}return _0x2b7f5c['save']();};}function saveUpdates(_0x722009,_0x4908d7){return function(_0x5432f2){if(_0x5432f2){return _0x5432f2['update'](_0x722009)[_0xfc2a('0x21')](function(_0x57b67c){return _0x57b67c;});}return null;};}function removeEntity(_0x4d6b68,_0x43e237){return function(_0x10396d){if(_0x10396d){return _0x10396d[_0xfc2a('0x22')]()[_0xfc2a('0x21')](function(){_0x4d6b68['status'](0xcc)[_0xfc2a('0x18')]();});}};}function handleEntityNotFound(_0x192f0b,_0x33574a){return function(_0x5ea9f8){if(!_0x5ea9f8){_0x192f0b[_0xfc2a('0x16')](0x194);}return _0x5ea9f8;};}function handleError(_0x24ff4e,_0x542c9e){_0x542c9e=_0x542c9e||0x1f4;return function(_0x55c0bc){logger[_0xfc2a('0x23')](_0x55c0bc['stack']);if(_0x55c0bc[_0xfc2a('0x24')]){delete _0x55c0bc[_0xfc2a('0x24')];}_0x24ff4e[_0xfc2a('0x17')](_0x542c9e)[_0xfc2a('0x25')](_0x55c0bc);};}exports['show']=function(_0x4fe30d,_0x5f4165){var _0x3bf69f={'raw':!![],'where':{'id':_0x4fe30d['params']['id']}},_0x1f91f5={};_0x1f91f5[_0xfc2a('0x26')]=_[_0xfc2a('0x27')](db[_0xfc2a('0x28')][_0xfc2a('0x29')]);_0x1f91f5[_0xfc2a('0x2a')]=_[_0xfc2a('0x27')](_0x4fe30d[_0xfc2a('0x2a')]);_0x1f91f5[_0xfc2a('0x2b')]=_[_0xfc2a('0x2c')](_0x1f91f5['model'],_0x1f91f5[_0xfc2a('0x2a')]);_0x3bf69f[_0xfc2a('0x2d')]=_[_0xfc2a('0x2c')](_0x1f91f5[_0xfc2a('0x26')],qs[_0xfc2a('0x2e')](_0x4fe30d[_0xfc2a('0x2a')][_0xfc2a('0x2e')]));_0x3bf69f[_0xfc2a('0x2d')]=_0x3bf69f[_0xfc2a('0x2d')][_0xfc2a('0x2f')]?_0x3bf69f[_0xfc2a('0x2d')]:_0x1f91f5[_0xfc2a('0x26')];if(_0x4fe30d['query'][_0xfc2a('0x30')]){_0x3bf69f[_0xfc2a('0x31')]=[{'all':!![]}];}_0x3bf69f=_[_0xfc2a('0x32')]({},_0x3bf69f,_0x4fe30d[_0xfc2a('0x33')]);return db['ChatApplication'][_0xfc2a('0x34')](_0x3bf69f)['then'](handleEntityNotFound(_0x5f4165,null))[_0xfc2a('0x21')](respondWithResult(_0x5f4165,null))['catch'](handleError(_0x5f4165,null));};exports[_0xfc2a('0x35')]=function(_0x1a423d,_0x53491a){if(_0x1a423d['body']['id']){delete _0x1a423d['body']['id'];}return db['ChatApplication'][_0xfc2a('0x34')]({'where':{'id':_0x1a423d[_0xfc2a('0x36')]['id']}})['then'](handleEntityNotFound(_0x53491a,null))['then'](saveUpdates(_0x1a423d[_0xfc2a('0x37')],null))[_0xfc2a('0x21')](respondWithResult(_0x53491a,null))[_0xfc2a('0x38')](handleError(_0x53491a,null));};exports[_0xfc2a('0x22')]=function(_0x30a32a,_0x5dde47){return db[_0xfc2a('0x28')][_0xfc2a('0x34')]({'where':{'id':_0x30a32a['params']['id']}})[_0xfc2a('0x21')](handleEntityNotFound(_0x5dde47,null))[_0xfc2a('0x21')](removeEntity(_0x5dde47,null))[_0xfc2a('0x38')](handleError(_0x5dde47,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index bbbae4b..385f911 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 _0xec22=['exports','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3670f1,_0x378d01){var _0x4fed56=function(_0x2b0d27){while(--_0x2b0d27){_0x3670f1['push'](_0x3670f1['shift']());}};_0x4fed56(++_0x378d01);}(_0xec22,0x1b1));var _0x2ec2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xec22[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2ec2('0x0'));var util=require(_0x2ec2('0x1'));var logger=require(_0x2ec2('0x2'))(_0x2ec2('0x3'));var moment=require(_0x2ec2('0x4'));var BPromise=require(_0x2ec2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec2('0x6'));var rimraf=require(_0x2ec2('0x7'));var config=require(_0x2ec2('0x8'));var attributes=require('./chatApplication.attributes');module[_0x2ec2('0x9')]=function(_0x3bed29,_0x2aa01f){return _0x3bed29['define'](_0x2ec2('0xa'),attributes,{'tableName':_0x2ec2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2ec2('0xc')});}; \ No newline at end of file +var _0x1d9d=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x196189,_0x1a5b61){var _0x5a2bc1=function(_0x5e014b){while(--_0x5e014b){_0x196189['push'](_0x196189['shift']());}};_0x5a2bc1(++_0x1a5b61);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x5afaea,_0x168909){_0x5afaea=_0x5afaea-0x0;var _0x1707e0=_0x1d9d[_0x5afaea];return _0x1707e0;};'use strict';var _=require(_0xd1d9('0x0'));var util=require(_0xd1d9('0x1'));var logger=require(_0xd1d9('0x2'))('api');var moment=require(_0xd1d9('0x3'));var BPromise=require(_0xd1d9('0x4'));var rp=require(_0xd1d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1d9('0x6'));var config=require(_0xd1d9('0x7'));var attributes=require(_0xd1d9('0x8'));module[_0xd1d9('0x9')]=function(_0x5cc987,_0x286cd0){return _0x5cc987[_0xd1d9('0xa')](_0xd1d9('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd1d9('0xc'),'collate':_0xd1d9('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2918a24..8daaa50 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 _0xe95a=['error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x714046,_0x183573){var _0x486bfc=function(_0x3d8fac){while(--_0x3d8fac){_0x714046['push'](_0x714046['shift']());}};_0x486bfc(++_0x183573);}(_0xe95a,0x1a8));var _0xae95=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe95a[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xae95('0x0'));var util=require('util');var moment=require(_0xae95('0x1'));var BPromise=require('bluebird');var rs=require(_0xae95('0x2'));var fs=require('fs');var Redis=require(_0xae95('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae95('0x4'))(_0xae95('0x5'));var config=require(_0xae95('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xae95('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9953,_0x275e2d,_0x493076){return new BPromise(function(_0x2bfc76,_0xfe613c){return client[_0xae95('0x8')](_0x4a9953,_0x493076)[_0xae95('0x9')](function(_0x7246a2){logger[_0xae95('0xa')](_0xae95('0xb'),_0x275e2d,_0xae95('0xc'));logger[_0xae95('0xd')](_0xae95('0xe'),_0x275e2d,_0xae95('0xc'),JSON[_0xae95('0xf')](_0x7246a2));if(_0x7246a2['error']){if(_0x7246a2['error'][_0xae95('0x10')]===0x1f4){logger[_0xae95('0x11')](_0xae95('0xb'),_0x275e2d,_0x7246a2[_0xae95('0x11')][_0xae95('0x12')]);return _0xfe613c(_0x7246a2[_0xae95('0x11')]['message']);}logger[_0xae95('0x11')](_0xae95('0xb'),_0x275e2d,_0x7246a2[_0xae95('0x11')]['message']);return _0x2bfc76(_0x7246a2[_0xae95('0x11')][_0xae95('0x12')]);}else{logger[_0xae95('0xa')]('ChatApplication,\x20%s,\x20%s',_0x275e2d,'request\x20sent');_0x2bfc76(_0x7246a2[_0xae95('0x13')][_0xae95('0x12')]);}})[_0xae95('0x14')](function(_0x412f29){logger[_0xae95('0x11')]('ChatApplication,\x20%s,\x20%s',_0x275e2d,_0x412f29);_0xfe613c(_0x412f29);});});} \ No newline at end of file +var _0x58e4=['../../config/utils','rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x58e4,0x188));var _0x458e=function(_0xeb27e7,_0x4ca640){_0xeb27e7=_0xeb27e7-0x0;var _0x281f7f=_0x58e4[_0xeb27e7];return _0x281f7f;};'use strict';var _=require('lodash');var util=require(_0x458e('0x0'));var moment=require(_0x458e('0x1'));var BPromise=require('bluebird');var rs=require(_0x458e('0x2'));var fs=require('fs');var Redis=require(_0x458e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x458e('0x4'));var logger=require('../../config/logger')(_0x458e('0x5'));var config=require(_0x458e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x458e('0x7')][_0x458e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52f085,_0x2028f6,_0x277249){return new BPromise(function(_0x4e2383,_0x50edc3){return client['request'](_0x52f085,_0x277249)[_0x458e('0x9')](function(_0x158ebc){logger[_0x458e('0xa')](_0x458e('0xb'),_0x2028f6,_0x458e('0xc'));logger[_0x458e('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2028f6,_0x458e('0xc'),JSON['stringify'](_0x158ebc));if(_0x158ebc[_0x458e('0xe')]){if(_0x158ebc[_0x458e('0xe')][_0x458e('0xf')]===0x1f4){logger[_0x458e('0xe')](_0x458e('0xb'),_0x2028f6,_0x158ebc['error'][_0x458e('0x10')]);return _0x50edc3(_0x158ebc[_0x458e('0xe')][_0x458e('0x10')]);}logger[_0x458e('0xe')](_0x458e('0xb'),_0x2028f6,_0x158ebc[_0x458e('0xe')]['message']);return _0x4e2383(_0x158ebc[_0x458e('0xe')][_0x458e('0x10')]);}else{logger['info'](_0x458e('0xb'),_0x2028f6,_0x458e('0xc'));_0x4e2383(_0x158ebc[_0x458e('0x11')][_0x458e('0x10')]);}})['catch'](function(_0x2de057){logger['error'](_0x458e('0xb'),_0x2028f6,_0x2de057);_0x50edc3(_0x2de057);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3a7dd2a..2effbe7 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 _0x0bdd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','update','delete','isAuthenticated','destroy','exports','util','connect-timeout','express'];(function(_0x32bbb1,_0xa0e27e){var _0x42b415=function(_0x23f4e2){while(--_0x23f4e2){_0x32bbb1['push'](_0x32bbb1['shift']());}};_0x42b415(++_0xa0e27e);}(_0x0bdd,0xa7));var _0xd0bd=function(_0x5215e6,_0x14c378){_0x5215e6=_0x5215e6-0x0;var _0x145c9c=_0x0bdd[_0x5215e6];return _0x145c9c;};'use strict';var multer=require('multer');var util=require(_0xd0bd('0x0'));var path=require('path');var timeout=require(_0xd0bd('0x1'));var express=require(_0xd0bd('0x2'));var router=express[_0xd0bd('0x3')]();var fs_extra=require(_0xd0bd('0x4'));var auth=require(_0xd0bd('0x5'));var interaction=require(_0xd0bd('0x6'));var config=require(_0xd0bd('0x7'));var controller=require('./chatApplication.controller');router[_0xd0bd('0x8')](_0xd0bd('0x9'),auth['isAuthenticated'](),controller[_0xd0bd('0xa')]);router[_0xd0bd('0xb')](_0xd0bd('0x9'),auth['isAuthenticated'](),controller[_0xd0bd('0xc')]);router[_0xd0bd('0xd')](_0xd0bd('0x9'),auth[_0xd0bd('0xe')](),controller[_0xd0bd('0xf')]);module[_0xd0bd('0x10')]=router; \ No newline at end of file +var _0x7b4a=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x43d42c,_0x463065){var _0x30bee9=function(_0x453f1c){while(--_0x453f1c){_0x43d42c['push'](_0x43d42c['shift']());}};_0x30bee9(++_0x463065);}(_0x7b4a,0x1df));var _0xa7b4=function(_0x3c3021,_0x189015){_0x3c3021=_0x3c3021-0x0;var _0x347432=_0x7b4a[_0x3c3021];return _0x347432;};'use strict';var multer=require(_0xa7b4('0x0'));var util=require('util');var path=require(_0xa7b4('0x1'));var timeout=require(_0xa7b4('0x2'));var express=require(_0xa7b4('0x3'));var router=express[_0xa7b4('0x4')]();var fs_extra=require(_0xa7b4('0x5'));var auth=require(_0xa7b4('0x6'));var interaction=require(_0xa7b4('0x7'));var config=require(_0xa7b4('0x8'));var controller=require(_0xa7b4('0x9'));router[_0xa7b4('0xa')](_0xa7b4('0xb'),auth[_0xa7b4('0xc')](),controller[_0xa7b4('0xd')]);router[_0xa7b4('0xe')](_0xa7b4('0xb'),auth['isAuthenticated'](),controller[_0xa7b4('0xf')]);router['delete'](_0xa7b4('0xb'),auth[_0xa7b4('0xc')](),controller[_0xa7b4('0x10')]);module[_0xa7b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1aa028c..53b8f42 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 _0x7f59=['exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f59,0x156));var _0x97f5=function(_0x4785fa,_0x5763b4){_0x4785fa=_0x4785fa-0x0;var _0x5cd6a2=_0x7f59[_0x4785fa];return _0x5cd6a2;};'use strict';var Sequelize=require('sequelize');module[_0x97f5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x97f5('0x1')]},'write':{'type':Sequelize[_0x97f5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd9ce=['exports','STRING','BOOLEAN','sequelize'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xd9ce,0xeb));var _0xed9c=function(_0x37fb3a,_0x5a14ee){_0x37fb3a=_0x37fb3a-0x0;var _0x1e5c8f=_0xd9ce[_0x37fb3a];return _0x1e5c8f;};'use strict';var Sequelize=require(_0xed9c('0x0'));module[_0xed9c('0x1')]={'name':{'type':Sequelize[_0xed9c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xed9c('0x2')]},'write':{'type':Sequelize[_0xed9c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 63f701f..ee3b723 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 _0xbd19=['stack','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','getUnread','user','addMembers','omit','ids','getMembers','findOne','length','removeMembers','getMessages','ChatInternalMessage','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x4459bd,_0x46c786){var _0x30fd4b=function(_0x461456){while(--_0x461456){_0x4459bd['push'](_0x4459bd['shift']());}};_0x30fd4b(++_0x46c786);}(_0xbd19,0x8c));var _0x9bd1=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbd19[_0x35da42];return _0x370035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bd1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bd1('0x1'));var rp=require(_0x9bd1('0x2'));var moment=require(_0x9bd1('0x3'));var BPromise=require(_0x9bd1('0x4'));var Mustache=require('mustache');var util=require(_0x9bd1('0x5'));var path=require('path');var sox=require(_0x9bd1('0x6'));var csv=require(_0x9bd1('0x7'));var ejs=require(_0x9bd1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bd1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9bd1('0xa'));var toCsv=require(_0x9bd1('0x7'));var querystring=require(_0x9bd1('0xb'));var Papa=require(_0x9bd1('0xc'));var Redis=require(_0x9bd1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9bd1('0xe'));var as=require(_0x9bd1('0xf'));var hardwareService=require(_0x9bd1('0x10'));var logger=require(_0x9bd1('0x11'))(_0x9bd1('0x12'));var utils=require(_0x9bd1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9bd1('0x14'))['db'];config['redis']=_[_0x9bd1('0x15')](config[_0x9bd1('0x16')],{'host':_0x9bd1('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bd1('0x16')]));require(_0x9bd1('0x18'))['register'](socket);function respondWithStatusCode(_0x25b51e,_0x312dd1){_0x312dd1=_0x312dd1||0xcc;return function(_0x3593bb){if(_0x3593bb){return _0x25b51e[_0x9bd1('0x19')](_0x312dd1);}return _0x25b51e['status'](_0x312dd1)['end']();};}function respondWithResult(_0x407c1a,_0x492474){_0x492474=_0x492474||0xc8;return function(_0xd2dab8){if(_0xd2dab8){return _0x407c1a[_0x9bd1('0x1a')](_0x492474)[_0x9bd1('0x1b')](_0xd2dab8);}};}function respondWithFilteredResult(_0x1da7f3,_0x483e6f){return function(_0x509167){if(_0x509167){var _0x1ffbd3=typeof _0x483e6f[_0x9bd1('0x1c')]==='undefined'&&typeof _0x483e6f['limit']==='undefined';var _0x3c4968=_0x509167[_0x9bd1('0x1d')];var _0x3fccc6=_0x1ffbd3?0x0:_0x483e6f[_0x9bd1('0x1c')];var _0x229dd5=_0x1ffbd3?_0x509167[_0x9bd1('0x1d')]:_0x483e6f[_0x9bd1('0x1c')]+_0x483e6f[_0x9bd1('0x1e')];var _0x57848f;if(_0x229dd5>=_0x3c4968){_0x229dd5=_0x3c4968;_0x57848f=0xc8;}else{_0x57848f=0xce;}_0x1da7f3['status'](_0x57848f);return _0x1da7f3[_0x9bd1('0x1f')](_0x9bd1('0x20'),_0x3fccc6+'-'+_0x229dd5+'/'+_0x3c4968)['json'](_0x509167);}return null;};}function patchUpdates(_0x61aa14){return function(_0x662c67){try{jsonpatch[_0x9bd1('0x21')](_0x662c67,_0x61aa14,!![]);}catch(_0x5700ec){return BPromise[_0x9bd1('0x22')](_0x5700ec);}return _0x662c67[_0x9bd1('0x23')]();};}function saveUpdates(_0x41310f,_0x4c4f64){return function(_0x4b2766){if(_0x4b2766){return _0x4b2766[_0x9bd1('0x24')](_0x41310f)['then'](function(_0x4b4bb2){return _0x4b4bb2;});}return null;};}function removeEntity(_0x5375e4,_0x184032){return function(_0x1fc6b3){if(_0x1fc6b3){return _0x1fc6b3[_0x9bd1('0x25')]()[_0x9bd1('0x26')](function(){_0x5375e4[_0x9bd1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x98f646,_0x43ba76){return function(_0x598fd1){if(!_0x598fd1){_0x98f646[_0x9bd1('0x19')](0x194);}return _0x598fd1;};}function handleError(_0xa202d,_0x287563){_0x287563=_0x287563||0x1f4;return function(_0xe0bb78){logger[_0x9bd1('0x27')](_0xe0bb78[_0x9bd1('0x28')]);if(_0xe0bb78[_0x9bd1('0x29')]){delete _0xe0bb78[_0x9bd1('0x29')];}_0xa202d[_0x9bd1('0x1a')](_0x287563)[_0x9bd1('0x2a')](_0xe0bb78);};}exports[_0x9bd1('0x2b')]=function(_0x4aabdb,_0x5d42ca){var _0x62ef82={},_0x43209e={},_0x507966={'count':0x0,'rows':[]};var _0x5c5af1=_['map'](db[_0x9bd1('0x2c')][_0x9bd1('0x2d')],function(_0x275f98){return{'name':_0x275f98[_0x9bd1('0x2e')],'type':_0x275f98['type'][_0x9bd1('0x2f')]};});_0x43209e[_0x9bd1('0x30')]=_['map'](_0x5c5af1,'name');_0x43209e[_0x9bd1('0x31')]=_[_0x9bd1('0x32')](_0x4aabdb['query']);_0x43209e[_0x9bd1('0x33')]=_['intersection'](_0x43209e[_0x9bd1('0x30')],_0x43209e['query']);_0x62ef82['attributes']=_[_0x9bd1('0x34')](_0x43209e[_0x9bd1('0x30')],qs[_0x9bd1('0x35')](_0x4aabdb['query'][_0x9bd1('0x35')]));_0x62ef82[_0x9bd1('0x36')]=_0x62ef82['attributes']['length']?_0x62ef82[_0x9bd1('0x36')]:_0x43209e['model'];if(!_0x4aabdb[_0x9bd1('0x31')][_0x9bd1('0x37')](_0x9bd1('0x38'))){_0x62ef82[_0x9bd1('0x1e')]=qs[_0x9bd1('0x1e')](_0x4aabdb[_0x9bd1('0x31')][_0x9bd1('0x1e')]);_0x62ef82[_0x9bd1('0x1c')]=qs['offset'](_0x4aabdb[_0x9bd1('0x31')]['offset']);}_0x62ef82[_0x9bd1('0x39')]=qs[_0x9bd1('0x3a')](_0x4aabdb[_0x9bd1('0x31')][_0x9bd1('0x3a')]);_0x62ef82['where']=qs[_0x9bd1('0x33')](_[_0x9bd1('0x3b')](_0x4aabdb[_0x9bd1('0x31')],_0x43209e[_0x9bd1('0x33')]),_0x5c5af1);if(_0x4aabdb['query']['filter']){_0x62ef82[_0x9bd1('0x3c')]=_[_0x9bd1('0x3d')](_0x62ef82[_0x9bd1('0x3c')],{'$or':_[_0x9bd1('0x3e')](_0x5c5af1,function(_0x3d78c2){if(_0x3d78c2[_0x9bd1('0x3f')]!==_0x9bd1('0x40')){var _0xdfad9f={};_0xdfad9f[_0x3d78c2['name']]={'$like':'%'+_0x4aabdb['query'][_0x9bd1('0x41')]+'%'};return _0xdfad9f;}})});}_0x62ef82=_[_0x9bd1('0x3d')]({},_0x62ef82,_0x4aabdb[_0x9bd1('0x42')]);var _0x5d24a4={'where':_0x62ef82[_0x9bd1('0x3c')]};return db[_0x9bd1('0x2c')][_0x9bd1('0x1d')](_0x5d24a4)['then'](function(_0x302503){_0x507966[_0x9bd1('0x1d')]=_0x302503;if(_0x4aabdb[_0x9bd1('0x31')][_0x9bd1('0x43')]){_0x62ef82[_0x9bd1('0x44')]=[{'all':!![]}];}return db[_0x9bd1('0x2c')][_0x9bd1('0x45')](_0x62ef82);})['then'](function(_0x46d26b){_0x507966[_0x9bd1('0x46')]=_0x46d26b;return _0x507966;})['then'](respondWithFilteredResult(_0x5d42ca,_0x62ef82))[_0x9bd1('0x47')](handleError(_0x5d42ca,null));};exports['show']=function(_0x5ed7e9,_0x233fe7){var _0x46f695={'raw':!![],'where':{'id':_0x5ed7e9['params']['id']}},_0x522de7={};_0x522de7[_0x9bd1('0x30')]=_[_0x9bd1('0x32')](db[_0x9bd1('0x2c')][_0x9bd1('0x2d')]);_0x522de7[_0x9bd1('0x31')]=_[_0x9bd1('0x32')](_0x5ed7e9[_0x9bd1('0x31')]);_0x522de7[_0x9bd1('0x33')]=_[_0x9bd1('0x34')](_0x522de7[_0x9bd1('0x30')],_0x522de7[_0x9bd1('0x31')]);_0x46f695[_0x9bd1('0x36')]=_[_0x9bd1('0x34')](_0x522de7[_0x9bd1('0x30')],qs[_0x9bd1('0x35')](_0x5ed7e9['query'][_0x9bd1('0x35')]));_0x46f695['attributes']=_0x46f695['attributes']['length']?_0x46f695[_0x9bd1('0x36')]:_0x522de7[_0x9bd1('0x30')];if(_0x5ed7e9[_0x9bd1('0x31')]['includeAll']){_0x46f695[_0x9bd1('0x44')]=[{'all':!![]}];}_0x46f695=_[_0x9bd1('0x3d')]({},_0x46f695,_0x5ed7e9[_0x9bd1('0x42')]);return db['ChatGroup'][_0x9bd1('0x48')](_0x46f695)[_0x9bd1('0x26')](handleEntityNotFound(_0x233fe7,null))[_0x9bd1('0x26')](respondWithResult(_0x233fe7,null))['catch'](handleError(_0x233fe7,null));};exports['create']=function(_0x24c676,_0x54c120){return db[_0x9bd1('0x2c')][_0x9bd1('0x49')](_0x24c676['body'],{})[_0x9bd1('0x26')](respondWithResult(_0x54c120,0xc9))[_0x9bd1('0x47')](handleError(_0x54c120,null));};exports[_0x9bd1('0x24')]=function(_0x3307f8,_0x2af2fc){if(_0x3307f8['body']['id']){delete _0x3307f8[_0x9bd1('0x4a')]['id'];}return db[_0x9bd1('0x2c')]['find']({'where':{'id':_0x3307f8[_0x9bd1('0x4b')]['id']}})[_0x9bd1('0x26')](handleEntityNotFound(_0x2af2fc,null))[_0x9bd1('0x26')](saveUpdates(_0x3307f8[_0x9bd1('0x4a')],null))[_0x9bd1('0x26')](respondWithResult(_0x2af2fc,null))[_0x9bd1('0x47')](handleError(_0x2af2fc,null));};exports['destroy']=function(_0x1b560c,_0x58c1b2){return db[_0x9bd1('0x2c')]['find']({'where':{'id':_0x1b560c[_0x9bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58c1b2,null))[_0x9bd1('0x26')](removeEntity(_0x58c1b2,null))[_0x9bd1('0x47')](handleError(_0x58c1b2,null));};exports[_0x9bd1('0x4c')]=function(_0x380279,_0x559395){return db[_0x9bd1('0x2c')][_0x9bd1('0x4c')]()[_0x9bd1('0x26')](respondWithResult(_0x559395,null))[_0x9bd1('0x47')](handleError(_0x559395,null));};exports[_0x9bd1('0x4d')]=function(_0x2aca7a,_0x454feb,_0x5b2adc){return db['ChatInternalMessage'][_0x9bd1('0x1d')]({'where':{'ChatGroupId':_0x2aca7a[_0x9bd1('0x4b')]['id'],'ToId':_0x2aca7a[_0x9bd1('0x4e')]['id'],'read':![]}})[_0x9bd1('0x26')](function(_0x1f3eb7){return{'id':_['toInteger'](_0x2aca7a[_0x9bd1('0x4b')]['id']),'count':_0x1f3eb7};})[_0x9bd1('0x26')](respondWithResult(_0x454feb,null))['catch'](handleError(_0x454feb,null));};exports[_0x9bd1('0x4f')]=function(_0x578aa9,_0x1f888f,_0x2ef8c6){return db[_0x9bd1('0x2c')][_0x9bd1('0x48')]({'where':{'id':_0x578aa9[_0x9bd1('0x4b')]['id']}})[_0x9bd1('0x26')](handleEntityNotFound(_0x1f888f,null))[_0x9bd1('0x26')](function(_0x407e20){if(_0x407e20){return _0x407e20[_0x9bd1('0x4f')](_0x578aa9[_0x9bd1('0x4a')]['ids'],_[_0x9bd1('0x50')](_0x578aa9['body'],[_0x9bd1('0x51'),'id'])||{});}})[_0x9bd1('0x26')](respondWithResult(_0x1f888f,null))[_0x9bd1('0x47')](handleError(_0x1f888f,null));};exports[_0x9bd1('0x52')]=function(_0x1f49ad,_0x4af848,_0x4ede62){var _0x2080df={};var _0x39d2b6={};var _0x36c2a2;var _0x520193;return db[_0x9bd1('0x2c')][_0x9bd1('0x53')]({'where':{'id':_0x1f49ad[_0x9bd1('0x4b')]['id']}})[_0x9bd1('0x26')](handleEntityNotFound(_0x4af848,null))[_0x9bd1('0x26')](function(_0x549a33){if(_0x549a33){_0x36c2a2=_0x549a33;_0x39d2b6['model']=_[_0x9bd1('0x32')](db['User'][_0x9bd1('0x2d')]);_0x39d2b6[_0x9bd1('0x31')]=_[_0x9bd1('0x32')](_0x1f49ad[_0x9bd1('0x31')]);_0x39d2b6[_0x9bd1('0x33')]=_[_0x9bd1('0x34')](_0x39d2b6[_0x9bd1('0x30')],_0x39d2b6[_0x9bd1('0x31')]);_0x2080df[_0x9bd1('0x36')]=_[_0x9bd1('0x34')](_0x39d2b6[_0x9bd1('0x30')],qs[_0x9bd1('0x35')](_0x1f49ad[_0x9bd1('0x31')][_0x9bd1('0x35')]));_0x2080df[_0x9bd1('0x36')]=_0x2080df[_0x9bd1('0x36')][_0x9bd1('0x54')]?_0x2080df[_0x9bd1('0x36')]:_0x39d2b6['model'];_0x2080df[_0x9bd1('0x39')]=qs[_0x9bd1('0x3a')](_0x1f49ad[_0x9bd1('0x31')][_0x9bd1('0x3a')]);_0x2080df[_0x9bd1('0x3c')]=qs[_0x9bd1('0x33')](_[_0x9bd1('0x3b')](_0x1f49ad[_0x9bd1('0x31')],_0x39d2b6[_0x9bd1('0x33')]));if(_0x1f49ad[_0x9bd1('0x31')][_0x9bd1('0x41')]){_0x2080df[_0x9bd1('0x3c')]=_[_0x9bd1('0x3d')](_0x2080df[_0x9bd1('0x3c')],{'$or':_['map'](_0x2080df[_0x9bd1('0x36')],function(_0x4a1513){var _0x53230a={};_0x53230a[_0x4a1513]={'$like':'%'+_0x1f49ad['query'][_0x9bd1('0x41')]+'%'};return _0x53230a;})});}_0x2080df=_[_0x9bd1('0x3d')]({},_0x2080df,_0x1f49ad[_0x9bd1('0x42')]);return _0x36c2a2[_0x9bd1('0x52')](_0x2080df);}})[_0x9bd1('0x26')](function(_0x2e1312){if(_0x2e1312){_0x520193=_0x2e1312['length'];if(!_0x1f49ad[_0x9bd1('0x31')]['hasOwnProperty']('nolimit')){_0x2080df['limit']=qs[_0x9bd1('0x1e')](_0x1f49ad[_0x9bd1('0x31')][_0x9bd1('0x1e')]);_0x2080df['offset']=qs[_0x9bd1('0x1c')](_0x1f49ad[_0x9bd1('0x31')][_0x9bd1('0x1c')]);}return _0x36c2a2[_0x9bd1('0x52')](_0x2080df);}})[_0x9bd1('0x26')](function(_0x4c8c90){if(_0x4c8c90){return _0x4c8c90?{'count':_0x520193,'rows':_0x4c8c90}:null;}})[_0x9bd1('0x26')](respondWithResult(_0x4af848,null))['catch'](handleError(_0x4af848,null));};exports[_0x9bd1('0x55')]=function(_0x323f87,_0x4c4e60,_0x49853f){return db[_0x9bd1('0x2c')][_0x9bd1('0x48')]({'where':{'id':_0x323f87[_0x9bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c4e60,null))['then'](function(_0x1735c3){if(_0x1735c3){return _0x1735c3[_0x9bd1('0x55')](_0x323f87[_0x9bd1('0x31')][_0x9bd1('0x51')]);}})[_0x9bd1('0x26')](respondWithStatusCode(_0x4c4e60,null))[_0x9bd1('0x47')](handleError(_0x4c4e60,null));};exports['addMessage']=function(_0x3c7d33,_0x45d1,_0x4335fe){if(_0x3c7d33[_0x9bd1('0x4a')]['id']){delete _0x3c7d33[_0x9bd1('0x4a')]['id'];}return db[_0x9bd1('0x2c')]['find']({'where':{'id':_0x3c7d33[_0x9bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45d1,null))[_0x9bd1('0x26')](function(_0x361ba5){if(_0x361ba5){_0x3c7d33[_0x9bd1('0x4a')]['ChatGroupId']=_0x361ba5['id'];return db['ChatInternalMessage'][_0x9bd1('0x49')](_0x3c7d33['body']);}})[_0x9bd1('0x26')](respondWithResult(_0x45d1,null))[_0x9bd1('0x47')](handleError(_0x45d1,null));};exports[_0x9bd1('0x56')]=function(_0x2b1ce1,_0x104db1,_0x5b40ce){var _0x20392e={};var _0x324cef={};var _0x461444;var _0x1783c5;return db[_0x9bd1('0x2c')]['findOne']({'where':{'id':_0x2b1ce1[_0x9bd1('0x4b')]['id']}})[_0x9bd1('0x26')](handleEntityNotFound(_0x104db1,null))[_0x9bd1('0x26')](function(_0x501da5){if(_0x501da5){_0x461444=_0x501da5;_0x324cef[_0x9bd1('0x30')]=_['keys'](db[_0x9bd1('0x57')]['rawAttributes']);_0x324cef['query']=_['keys'](_0x2b1ce1[_0x9bd1('0x31')]);_0x324cef[_0x9bd1('0x33')]=_[_0x9bd1('0x34')](_0x324cef[_0x9bd1('0x30')],_0x324cef[_0x9bd1('0x31')]);_0x20392e['attributes']=_[_0x9bd1('0x34')](_0x324cef['model'],qs[_0x9bd1('0x35')](_0x2b1ce1['query'][_0x9bd1('0x35')]));_0x20392e[_0x9bd1('0x36')]=_0x20392e[_0x9bd1('0x36')][_0x9bd1('0x54')]?_0x20392e[_0x9bd1('0x36')]:_0x324cef[_0x9bd1('0x30')];_0x20392e[_0x9bd1('0x39')]=qs[_0x9bd1('0x3a')](_0x2b1ce1[_0x9bd1('0x31')][_0x9bd1('0x3a')]);_0x20392e[_0x9bd1('0x3c')]=qs[_0x9bd1('0x33')](_['pick'](_0x2b1ce1[_0x9bd1('0x31')],_0x324cef[_0x9bd1('0x33')]));if(_0x2b1ce1['query'][_0x9bd1('0x41')]){_0x20392e['where']=_[_0x9bd1('0x3d')](_0x20392e['where'],{'$or':_[_0x9bd1('0x3e')](_0x20392e[_0x9bd1('0x36')],function(_0x120416){var _0x2a0ba2={};_0x2a0ba2[_0x120416]={'$like':'%'+_0x2b1ce1[_0x9bd1('0x31')][_0x9bd1('0x41')]+'%'};return _0x2a0ba2;})});}if(_0x2b1ce1['query']['$gte']){var _0x2c1f6c=_0x2b1ce1[_0x9bd1('0x31')]['$gte'][_0x9bd1('0x58')](',');var _0x4f165f={};_0x4f165f[_0x2c1f6c[0x0]]={'$gte':moment(_0x2c1f6c[0x1])['format'](_0x9bd1('0x59'))};_0x20392e[_0x9bd1('0x3c')]=_['merge'](_0x20392e[_0x9bd1('0x3c')],_0x4f165f);}_0x20392e=_[_0x9bd1('0x3d')]({},_0x20392e,_0x2b1ce1['options']);return _0x461444['getMessages'](_0x20392e);}})[_0x9bd1('0x26')](function(_0x560710){if(_0x560710){_0x1783c5=_0x560710[_0x9bd1('0x54')];if(!_0x2b1ce1[_0x9bd1('0x31')][_0x9bd1('0x37')](_0x9bd1('0x38'))){_0x20392e['limit']=qs[_0x9bd1('0x1e')](_0x2b1ce1[_0x9bd1('0x31')][_0x9bd1('0x1e')]);_0x20392e[_0x9bd1('0x1c')]=qs[_0x9bd1('0x1c')](_0x2b1ce1['query']['offset']);}return _0x461444['getMessages'](_0x20392e);}})[_0x9bd1('0x26')](function(_0x2d2b77){if(_0x2d2b77){return _0x2d2b77?{'count':_0x1783c5,'rows':_0x2d2b77}:null;}})[_0x9bd1('0x26')](respondWithResult(_0x104db1,null))[_0x9bd1('0x47')](handleError(_0x104db1,null));}; \ No newline at end of file +var _0x5e4e=['removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ChatGroup','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','rawAttributes','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne'];(function(_0x2dab5a,_0xb1fc8d){var _0x1f4e38=function(_0x47a7df){while(--_0x47a7df){_0x2dab5a['push'](_0x2dab5a['shift']());}};_0x1f4e38(++_0xb1fc8d);}(_0x5e4e,0xbf));var _0xe5e4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5e4e[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xe5e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5e4('0x1'));var jsonpatch=require(_0xe5e4('0x2'));var rp=require(_0xe5e4('0x3'));var moment=require('moment');var BPromise=require(_0xe5e4('0x4'));var Mustache=require(_0xe5e4('0x5'));var util=require(_0xe5e4('0x6'));var path=require(_0xe5e4('0x7'));var sox=require(_0xe5e4('0x8'));var csv=require(_0xe5e4('0x9'));var ejs=require(_0xe5e4('0xa'));var fs=require('fs');var fs_extra=require(_0xe5e4('0xb'));var _=require(_0xe5e4('0xc'));var squel=require(_0xe5e4('0xd'));var crypto=require(_0xe5e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe5e4('0xf'));var toCsv=require(_0xe5e4('0x9'));var querystring=require('querystring');var Papa=require(_0xe5e4('0x10'));var Redis=require(_0xe5e4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5e4('0x12'));var as=require(_0xe5e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5e4('0x14'))(_0xe5e4('0x15'));var utils=require(_0xe5e4('0x16'));var config=require(_0xe5e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe5e4('0x18')]=_['defaults'](config[_0xe5e4('0x18')],{'host':_0xe5e4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5e4('0x18')]));require('./chatGroup.socket')[_0xe5e4('0x1a')](socket);function respondWithStatusCode(_0x48a0a4,_0x5c5953){_0x5c5953=_0x5c5953||0xcc;return function(_0x29fcab){if(_0x29fcab){return _0x48a0a4[_0xe5e4('0x1b')](_0x5c5953);}return _0x48a0a4[_0xe5e4('0x1c')](_0x5c5953)[_0xe5e4('0x1d')]();};}function respondWithResult(_0x149930,_0x2683b8){_0x2683b8=_0x2683b8||0xc8;return function(_0x1f9c72){if(_0x1f9c72){return _0x149930['status'](_0x2683b8)[_0xe5e4('0x1e')](_0x1f9c72);}};}function respondWithFilteredResult(_0x4f6b18,_0x2519a7){return function(_0x4cf0bd){if(_0x4cf0bd){var _0x4f18b3=typeof _0x2519a7[_0xe5e4('0x1f')]==='undefined'&&typeof _0x2519a7[_0xe5e4('0x20')]==='undefined';var _0x467cb1=_0x4cf0bd[_0xe5e4('0x21')];var _0x489aae=_0x4f18b3?0x0:_0x2519a7['offset'];var _0x31637d=_0x4f18b3?_0x4cf0bd[_0xe5e4('0x21')]:_0x2519a7[_0xe5e4('0x1f')]+_0x2519a7['limit'];var _0x19c6a4;if(_0x31637d>=_0x467cb1){_0x31637d=_0x467cb1;_0x19c6a4=0xc8;}else{_0x19c6a4=0xce;}_0x4f6b18['status'](_0x19c6a4);return _0x4f6b18[_0xe5e4('0x22')](_0xe5e4('0x23'),_0x489aae+'-'+_0x31637d+'/'+_0x467cb1)[_0xe5e4('0x1e')](_0x4cf0bd);}return null;};}function patchUpdates(_0x50ffcc){return function(_0x598418){try{jsonpatch[_0xe5e4('0x24')](_0x598418,_0x50ffcc,!![]);}catch(_0x5d7929){return BPromise[_0xe5e4('0x25')](_0x5d7929);}return _0x598418['save']();};}function saveUpdates(_0x285f2e,_0x30e1a8){return function(_0x35c0c5){if(_0x35c0c5){return _0x35c0c5[_0xe5e4('0x26')](_0x285f2e)[_0xe5e4('0x27')](function(_0xf4f9c1){return _0xf4f9c1;});}return null;};}function removeEntity(_0x3f567c,_0x738b8){return function(_0x1cf725){if(_0x1cf725){return _0x1cf725[_0xe5e4('0x28')]()[_0xe5e4('0x27')](function(){_0x3f567c[_0xe5e4('0x1c')](0xcc)[_0xe5e4('0x1d')]();});}};}function handleEntityNotFound(_0xd1d437,_0x4146de){return function(_0x1ad134){if(!_0x1ad134){_0xd1d437[_0xe5e4('0x1b')](0x194);}return _0x1ad134;};}function handleError(_0x1d260b,_0x3ba9e2){_0x3ba9e2=_0x3ba9e2||0x1f4;return function(_0x3252d6){logger[_0xe5e4('0x29')](_0x3252d6[_0xe5e4('0x2a')]);if(_0x3252d6[_0xe5e4('0x2b')]){delete _0x3252d6[_0xe5e4('0x2b')];}_0x1d260b[_0xe5e4('0x1c')](_0x3ba9e2)['send'](_0x3252d6);};}exports[_0xe5e4('0x2c')]=function(_0x1ffa81,_0x4c94eb){var _0x74a51f={},_0x2783ac={},_0x5aa1ec={'count':0x0,'rows':[]};var _0x3f4f33=_[_0xe5e4('0x2d')](db[_0xe5e4('0x2e')]['rawAttributes'],function(_0x20f83c){return{'name':_0x20f83c[_0xe5e4('0x2f')],'type':_0x20f83c[_0xe5e4('0x30')][_0xe5e4('0x31')]};});_0x2783ac[_0xe5e4('0x32')]=_[_0xe5e4('0x2d')](_0x3f4f33,_0xe5e4('0x2b'));_0x2783ac[_0xe5e4('0x33')]=_[_0xe5e4('0x34')](_0x1ffa81[_0xe5e4('0x33')]);_0x2783ac['filters']=_['intersection'](_0x2783ac[_0xe5e4('0x32')],_0x2783ac[_0xe5e4('0x33')]);_0x74a51f[_0xe5e4('0x35')]=_[_0xe5e4('0x36')](_0x2783ac[_0xe5e4('0x32')],qs[_0xe5e4('0x37')](_0x1ffa81['query'][_0xe5e4('0x37')]));_0x74a51f[_0xe5e4('0x35')]=_0x74a51f[_0xe5e4('0x35')][_0xe5e4('0x38')]?_0x74a51f['attributes']:_0x2783ac[_0xe5e4('0x32')];if(!_0x1ffa81['query'][_0xe5e4('0x39')](_0xe5e4('0x3a'))){_0x74a51f[_0xe5e4('0x20')]=qs['limit'](_0x1ffa81[_0xe5e4('0x33')][_0xe5e4('0x20')]);_0x74a51f['offset']=qs[_0xe5e4('0x1f')](_0x1ffa81['query'][_0xe5e4('0x1f')]);}_0x74a51f[_0xe5e4('0x3b')]=qs[_0xe5e4('0x3c')](_0x1ffa81[_0xe5e4('0x33')][_0xe5e4('0x3c')]);_0x74a51f['where']=qs[_0xe5e4('0x3d')](_[_0xe5e4('0x3e')](_0x1ffa81['query'],_0x2783ac[_0xe5e4('0x3d')]),_0x3f4f33);if(_0x1ffa81[_0xe5e4('0x33')][_0xe5e4('0x3f')]){_0x74a51f['where']=_[_0xe5e4('0x40')](_0x74a51f[_0xe5e4('0x41')],{'$or':_[_0xe5e4('0x2d')](_0x3f4f33,function(_0x8a65f){if(_0x8a65f[_0xe5e4('0x30')]!==_0xe5e4('0x42')){var _0x34a5de={};_0x34a5de[_0x8a65f[_0xe5e4('0x2b')]]={'$like':'%'+_0x1ffa81['query'][_0xe5e4('0x3f')]+'%'};return _0x34a5de;}})});}_0x74a51f=_['merge']({},_0x74a51f,_0x1ffa81[_0xe5e4('0x43')]);var _0x4bc367={'where':_0x74a51f[_0xe5e4('0x41')]};return db[_0xe5e4('0x2e')][_0xe5e4('0x21')](_0x4bc367)[_0xe5e4('0x27')](function(_0x38e8f5){_0x5aa1ec[_0xe5e4('0x21')]=_0x38e8f5;if(_0x1ffa81[_0xe5e4('0x33')][_0xe5e4('0x44')]){_0x74a51f[_0xe5e4('0x45')]=[{'all':!![]}];}return db[_0xe5e4('0x2e')]['findAll'](_0x74a51f);})[_0xe5e4('0x27')](function(_0x5ae0ee){_0x5aa1ec['rows']=_0x5ae0ee;return _0x5aa1ec;})[_0xe5e4('0x27')](respondWithFilteredResult(_0x4c94eb,_0x74a51f))[_0xe5e4('0x46')](handleError(_0x4c94eb,null));};exports['show']=function(_0x33bd3f,_0x2d1be0){var _0x3b5b6b={'raw':!![],'where':{'id':_0x33bd3f['params']['id']}},_0x14a2e9={};_0x14a2e9[_0xe5e4('0x32')]=_[_0xe5e4('0x34')](db[_0xe5e4('0x2e')][_0xe5e4('0x47')]);_0x14a2e9['query']=_['keys'](_0x33bd3f[_0xe5e4('0x33')]);_0x14a2e9['filters']=_[_0xe5e4('0x36')](_0x14a2e9[_0xe5e4('0x32')],_0x14a2e9[_0xe5e4('0x33')]);_0x3b5b6b[_0xe5e4('0x35')]=_['intersection'](_0x14a2e9['model'],qs[_0xe5e4('0x37')](_0x33bd3f[_0xe5e4('0x33')][_0xe5e4('0x37')]));_0x3b5b6b[_0xe5e4('0x35')]=_0x3b5b6b[_0xe5e4('0x35')][_0xe5e4('0x38')]?_0x3b5b6b['attributes']:_0x14a2e9[_0xe5e4('0x32')];if(_0x33bd3f['query'][_0xe5e4('0x44')]){_0x3b5b6b[_0xe5e4('0x45')]=[{'all':!![]}];}_0x3b5b6b=_[_0xe5e4('0x40')]({},_0x3b5b6b,_0x33bd3f['options']);return db[_0xe5e4('0x2e')][_0xe5e4('0x48')](_0x3b5b6b)[_0xe5e4('0x27')](handleEntityNotFound(_0x2d1be0,null))['then'](respondWithResult(_0x2d1be0,null))['catch'](handleError(_0x2d1be0,null));};exports['create']=function(_0x44ec4b,_0x3948a3){return db[_0xe5e4('0x2e')][_0xe5e4('0x49')](_0x44ec4b[_0xe5e4('0x4a')],{})['then'](respondWithResult(_0x3948a3,0xc9))['catch'](handleError(_0x3948a3,null));};exports[_0xe5e4('0x26')]=function(_0x4a0081,_0x269434){if(_0x4a0081[_0xe5e4('0x4a')]['id']){delete _0x4a0081[_0xe5e4('0x4a')]['id'];}return db[_0xe5e4('0x2e')][_0xe5e4('0x48')]({'where':{'id':_0x4a0081[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x269434,null))[_0xe5e4('0x27')](saveUpdates(_0x4a0081['body'],null))[_0xe5e4('0x27')](respondWithResult(_0x269434,null))[_0xe5e4('0x46')](handleError(_0x269434,null));};exports[_0xe5e4('0x28')]=function(_0x436457,_0x399970){return db[_0xe5e4('0x2e')][_0xe5e4('0x48')]({'where':{'id':_0x436457[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x399970,null))[_0xe5e4('0x27')](removeEntity(_0x399970,null))[_0xe5e4('0x46')](handleError(_0x399970,null));};exports[_0xe5e4('0x4c')]=function(_0x416f87,_0x21efe7){return db[_0xe5e4('0x2e')][_0xe5e4('0x4c')]()[_0xe5e4('0x27')](respondWithResult(_0x21efe7,null))[_0xe5e4('0x46')](handleError(_0x21efe7,null));};exports[_0xe5e4('0x4d')]=function(_0xe9cf34,_0x5d0baa,_0x1d9c95){return db[_0xe5e4('0x4e')][_0xe5e4('0x21')]({'where':{'ChatGroupId':_0xe9cf34['params']['id'],'ToId':_0xe9cf34[_0xe5e4('0x4f')]['id'],'read':![]}})[_0xe5e4('0x27')](function(_0x1488c3){return{'id':_[_0xe5e4('0x50')](_0xe9cf34['params']['id']),'count':_0x1488c3};})['then'](respondWithResult(_0x5d0baa,null))[_0xe5e4('0x46')](handleError(_0x5d0baa,null));};exports[_0xe5e4('0x51')]=function(_0x89e5f9,_0x325732,_0x23e2a){return db['ChatGroup'][_0xe5e4('0x48')]({'where':{'id':_0x89e5f9[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x325732,null))[_0xe5e4('0x27')](function(_0x3fe061){if(_0x3fe061){return _0x3fe061[_0xe5e4('0x51')](_0x89e5f9[_0xe5e4('0x4a')]['ids'],_['omit'](_0x89e5f9['body'],[_0xe5e4('0x52'),'id'])||{});}})[_0xe5e4('0x27')](respondWithResult(_0x325732,null))['catch'](handleError(_0x325732,null));};exports[_0xe5e4('0x53')]=function(_0x5ad69b,_0x38b1fc,_0x3d8f52){var _0x446cd7={};var _0xbc93fa={};var _0x27218a;var _0x556abe;return db[_0xe5e4('0x2e')][_0xe5e4('0x54')]({'where':{'id':_0x5ad69b[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x38b1fc,null))['then'](function(_0xc88923){if(_0xc88923){_0x27218a=_0xc88923;_0xbc93fa[_0xe5e4('0x32')]=_[_0xe5e4('0x34')](db['User'][_0xe5e4('0x47')]);_0xbc93fa[_0xe5e4('0x33')]=_[_0xe5e4('0x34')](_0x5ad69b[_0xe5e4('0x33')]);_0xbc93fa[_0xe5e4('0x3d')]=_[_0xe5e4('0x36')](_0xbc93fa[_0xe5e4('0x32')],_0xbc93fa[_0xe5e4('0x33')]);_0x446cd7[_0xe5e4('0x35')]=_['intersection'](_0xbc93fa[_0xe5e4('0x32')],qs[_0xe5e4('0x37')](_0x5ad69b[_0xe5e4('0x33')][_0xe5e4('0x37')]));_0x446cd7[_0xe5e4('0x35')]=_0x446cd7['attributes']['length']?_0x446cd7[_0xe5e4('0x35')]:_0xbc93fa[_0xe5e4('0x32')];_0x446cd7[_0xe5e4('0x3b')]=qs['sort'](_0x5ad69b[_0xe5e4('0x33')][_0xe5e4('0x3c')]);_0x446cd7[_0xe5e4('0x41')]=qs[_0xe5e4('0x3d')](_[_0xe5e4('0x3e')](_0x5ad69b[_0xe5e4('0x33')],_0xbc93fa[_0xe5e4('0x3d')]));if(_0x5ad69b[_0xe5e4('0x33')]['filter']){_0x446cd7[_0xe5e4('0x41')]=_[_0xe5e4('0x40')](_0x446cd7['where'],{'$or':_[_0xe5e4('0x2d')](_0x446cd7[_0xe5e4('0x35')],function(_0x2be762){var _0x165ca0={};_0x165ca0[_0x2be762]={'$like':'%'+_0x5ad69b[_0xe5e4('0x33')]['filter']+'%'};return _0x165ca0;})});}_0x446cd7=_[_0xe5e4('0x40')]({},_0x446cd7,_0x5ad69b[_0xe5e4('0x43')]);return _0x27218a[_0xe5e4('0x53')](_0x446cd7);}})[_0xe5e4('0x27')](function(_0x225fb7){if(_0x225fb7){_0x556abe=_0x225fb7[_0xe5e4('0x38')];if(!_0x5ad69b[_0xe5e4('0x33')][_0xe5e4('0x39')](_0xe5e4('0x3a'))){_0x446cd7[_0xe5e4('0x20')]=qs[_0xe5e4('0x20')](_0x5ad69b[_0xe5e4('0x33')][_0xe5e4('0x20')]);_0x446cd7[_0xe5e4('0x1f')]=qs['offset'](_0x5ad69b[_0xe5e4('0x33')][_0xe5e4('0x1f')]);}return _0x27218a[_0xe5e4('0x53')](_0x446cd7);}})[_0xe5e4('0x27')](function(_0x3308d9){if(_0x3308d9){return _0x3308d9?{'count':_0x556abe,'rows':_0x3308d9}:null;}})[_0xe5e4('0x27')](respondWithResult(_0x38b1fc,null))[_0xe5e4('0x46')](handleError(_0x38b1fc,null));};exports['removeMembers']=function(_0x4a8a68,_0x51709a,_0x48e8c2){return db[_0xe5e4('0x2e')][_0xe5e4('0x48')]({'where':{'id':_0x4a8a68[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x51709a,null))[_0xe5e4('0x27')](function(_0x2976af){if(_0x2976af){return _0x2976af[_0xe5e4('0x55')](_0x4a8a68[_0xe5e4('0x33')][_0xe5e4('0x52')]);}})[_0xe5e4('0x27')](respondWithStatusCode(_0x51709a,null))[_0xe5e4('0x46')](handleError(_0x51709a,null));};exports['addMessage']=function(_0x281758,_0x1f2c44,_0x4e7fbf){if(_0x281758[_0xe5e4('0x4a')]['id']){delete _0x281758['body']['id'];}return db[_0xe5e4('0x2e')]['find']({'where':{'id':_0x281758[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x1f2c44,null))[_0xe5e4('0x27')](function(_0x208f3a){if(_0x208f3a){_0x281758['body'][_0xe5e4('0x56')]=_0x208f3a['id'];return db['ChatInternalMessage'][_0xe5e4('0x49')](_0x281758[_0xe5e4('0x4a')]);}})[_0xe5e4('0x27')](respondWithResult(_0x1f2c44,null))[_0xe5e4('0x46')](handleError(_0x1f2c44,null));};exports[_0xe5e4('0x57')]=function(_0x2f7426,_0x39b419,_0x4aad5a){var _0x46e8fb={};var _0x376f72={};var _0x120a33;var _0x5ec36c;return db[_0xe5e4('0x2e')][_0xe5e4('0x54')]({'where':{'id':_0x2f7426[_0xe5e4('0x4b')]['id']}})[_0xe5e4('0x27')](handleEntityNotFound(_0x39b419,null))['then'](function(_0x2df7fa){if(_0x2df7fa){_0x120a33=_0x2df7fa;_0x376f72[_0xe5e4('0x32')]=_[_0xe5e4('0x34')](db[_0xe5e4('0x4e')][_0xe5e4('0x47')]);_0x376f72[_0xe5e4('0x33')]=_[_0xe5e4('0x34')](_0x2f7426[_0xe5e4('0x33')]);_0x376f72[_0xe5e4('0x3d')]=_['intersection'](_0x376f72[_0xe5e4('0x32')],_0x376f72[_0xe5e4('0x33')]);_0x46e8fb[_0xe5e4('0x35')]=_[_0xe5e4('0x36')](_0x376f72[_0xe5e4('0x32')],qs[_0xe5e4('0x37')](_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x37')]));_0x46e8fb[_0xe5e4('0x35')]=_0x46e8fb[_0xe5e4('0x35')][_0xe5e4('0x38')]?_0x46e8fb['attributes']:_0x376f72[_0xe5e4('0x32')];_0x46e8fb[_0xe5e4('0x3b')]=qs[_0xe5e4('0x3c')](_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x3c')]);_0x46e8fb[_0xe5e4('0x41')]=qs[_0xe5e4('0x3d')](_[_0xe5e4('0x3e')](_0x2f7426[_0xe5e4('0x33')],_0x376f72[_0xe5e4('0x3d')]));if(_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x3f')]){_0x46e8fb[_0xe5e4('0x41')]=_['merge'](_0x46e8fb[_0xe5e4('0x41')],{'$or':_[_0xe5e4('0x2d')](_0x46e8fb[_0xe5e4('0x35')],function(_0x21f467){var _0x538ab3={};_0x538ab3[_0x21f467]={'$like':'%'+_0x2f7426['query'][_0xe5e4('0x3f')]+'%'};return _0x538ab3;})});}if(_0x2f7426[_0xe5e4('0x33')]['$gte']){var _0x5579be=_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x58')][_0xe5e4('0x59')](',');var _0x2dde0c={};_0x2dde0c[_0x5579be[0x0]]={'$gte':moment(_0x5579be[0x1])[_0xe5e4('0x5a')](_0xe5e4('0x5b'))};_0x46e8fb[_0xe5e4('0x41')]=_[_0xe5e4('0x40')](_0x46e8fb[_0xe5e4('0x41')],_0x2dde0c);}_0x46e8fb=_['merge']({},_0x46e8fb,_0x2f7426['options']);return _0x120a33[_0xe5e4('0x57')](_0x46e8fb);}})['then'](function(_0x5504fe){if(_0x5504fe){_0x5ec36c=_0x5504fe[_0xe5e4('0x38')];if(!_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x39')](_0xe5e4('0x3a'))){_0x46e8fb[_0xe5e4('0x20')]=qs[_0xe5e4('0x20')](_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x20')]);_0x46e8fb[_0xe5e4('0x1f')]=qs['offset'](_0x2f7426[_0xe5e4('0x33')][_0xe5e4('0x1f')]);}return _0x120a33[_0xe5e4('0x57')](_0x46e8fb);}})[_0xe5e4('0x27')](function(_0x94d389){if(_0x94d389){return _0x94d389?{'count':_0x5ec36c,'rows':_0x94d389}:null;}})[_0xe5e4('0x27')](respondWithResult(_0x39b419,null))['catch'](handleError(_0x39b419,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bc2b6cd..ff51591 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 _0x8294=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x2fcd0c,_0x3fe101){var _0x19c93d=function(_0xd2faae){while(--_0xd2faae){_0x2fcd0c['push'](_0x2fcd0c['shift']());}};_0x19c93d(++_0x3fe101);}(_0x8294,0x1c6));var _0x4829=function(_0x706786,_0x53f40f){_0x706786=_0x706786-0x0;var _0x10d2ae=_0x8294[_0x706786];return _0x10d2ae;};'use strict';var EventEmitter=require(_0x4829('0x0'));var ChatGroup=require(_0x4829('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4829('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4829('0x3')};function emitEvent(_0x31c3ac){return function(_0x27a714,_0x494a7d,_0x1cbde3){ChatGroupEvents['emit'](_0x31c3ac+':'+_0x27a714['id'],_0x27a714);ChatGroupEvents[_0x4829('0x4')](_0x31c3ac,_0x27a714);_0x1cbde3(null);};}for(var e in events){if(events[_0x4829('0x5')](e)){var event=events[e];ChatGroup[_0x4829('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x3c8e=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x49bd3e,_0x2e6e2d){var _0x247ba6=function(_0x46a7d1){while(--_0x46a7d1){_0x49bd3e['push'](_0x49bd3e['shift']());}};_0x247ba6(++_0x2e6e2d);}(_0x3c8e,0x89));var _0xe3c8=function(_0x269ab2,_0x5e2aa0){_0x269ab2=_0x269ab2-0x0;var _0x16a0f8=_0x3c8e[_0x269ab2];return _0x16a0f8;};'use strict';var EventEmitter=require(_0xe3c8('0x0'));var ChatGroup=require(_0xe3c8('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe3c8('0x2'),'afterUpdate':_0xe3c8('0x3'),'afterDestroy':_0xe3c8('0x4')};function emitEvent(_0x563970){return function(_0x3f8a4b,_0x21efc9,_0xbd43ef){ChatGroupEvents[_0xe3c8('0x5')](_0x563970+':'+_0x3f8a4b['id'],_0x3f8a4b);ChatGroupEvents['emit'](_0x563970,_0x3f8a4b);_0xbd43ef(null);};}for(var e in events){if(events[_0xe3c8('0x6')](e)){var event=events[e];ChatGroup[_0xe3c8('0x7')](e,emitEvent(event));}}module[_0xe3c8('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 43fa024..0b1250d 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 _0x7915=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x236e72,_0x2199d9){var _0x57b4a8=function(_0x4522d8){while(--_0x4522d8){_0x236e72['push'](_0x236e72['shift']());}};_0x57b4a8(++_0x2199d9);}(_0x7915,0x128));var _0x5791=function(_0x3d2b6d,_0x1c710e){_0x3d2b6d=_0x3d2b6d-0x0;var _0x268764=_0x7915[_0x3d2b6d];return _0x268764;};'use strict';var _=require(_0x5791('0x0'));var util=require(_0x5791('0x1'));var logger=require(_0x5791('0x2'))(_0x5791('0x3'));var moment=require(_0x5791('0x4'));var BPromise=require(_0x5791('0x5'));var rp=require(_0x5791('0x6'));var fs=require('fs');var path=require(_0x5791('0x7'));var rimraf=require(_0x5791('0x8'));var config=require('../../config/environment');var attributes=require(_0x5791('0x9'));module[_0x5791('0xa')]=function(_0x549311,_0x3a13dd){return _0x549311[_0x5791('0xb')](_0x5791('0xc'),attributes,{'tableName':_0x5791('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3be3=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','request-promise','path'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x3be3,0xaf));var _0x33be=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x3be3[_0x452968];return _0xb6f9ae;};'use strict';var _=require(_0x33be('0x0'));var util=require('util');var logger=require(_0x33be('0x1'))(_0x33be('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x33be('0x3'));var fs=require('fs');var path=require(_0x33be('0x4'));var rimraf=require('rimraf');var config=require(_0x33be('0x5'));var attributes=require(_0x33be('0x6'));module['exports']=function(_0x3a12ea,_0x46c10a){return _0x3a12ea[_0x33be('0x7')](_0x33be('0x8'),attributes,{'tableName':_0x33be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3f6e71d..1d33cb9 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 _0xe5f7=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0xb9333c,_0x258707){var _0x4eecdc=function(_0x34569b){while(--_0x34569b){_0xb9333c['push'](_0xb9333c['shift']());}};_0x4eecdc(++_0x258707);}(_0xe5f7,0x178));var _0x7e5f=function(_0x5c2d47,_0x393371){_0x5c2d47=_0x5c2d47-0x0;var _0x222d7a=_0xe5f7[_0x5c2d47];return _0x222d7a;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var moment=require(_0x7e5f('0x2'));var BPromise=require(_0x7e5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e5f('0x4'))['db'];var utils=require(_0x7e5f('0x5'));var logger=require(_0x7e5f('0x6'))('rpc');var config=require(_0x7e5f('0x7'));var jayson=require(_0x7e5f('0x8'));var client=jayson['client'][_0x7e5f('0x9')]({'port':0x232a});config[_0x7e5f('0xa')]=_[_0x7e5f('0xb')](config[_0x7e5f('0xa')],{'host':_0x7e5f('0xc'),'port':0x18eb});var socket=require(_0x7e5f('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x7e5f('0xe')](socket);function respondWithRpcPromise(_0x1fec12,_0x313706,_0x1900d8){return new BPromise(function(_0x3844af,_0x218e50){return client[_0x7e5f('0xf')](_0x1fec12,_0x1900d8)[_0x7e5f('0x10')](function(_0x23a476){logger[_0x7e5f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x313706,_0x7e5f('0x12'));logger['debug'](_0x7e5f('0x13'),_0x313706,_0x7e5f('0x12'),JSON[_0x7e5f('0x14')](_0x23a476));if(_0x23a476[_0x7e5f('0x15')]){if(_0x23a476[_0x7e5f('0x15')][_0x7e5f('0x16')]===0x1f4){logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0x23a476[_0x7e5f('0x15')][_0x7e5f('0x18')]);return _0x218e50(_0x23a476['error'][_0x7e5f('0x18')]);}logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0x23a476[_0x7e5f('0x15')]['message']);return _0x3844af(_0x23a476['error']['message']);}else{logger[_0x7e5f('0x11')](_0x7e5f('0x17'),_0x313706,'request\x20sent');_0x3844af(_0x23a476[_0x7e5f('0x19')][_0x7e5f('0x18')]);}})[_0x7e5f('0x1a')](function(_0xd97c29){logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0xd97c29);_0x218e50(_0xd97c29);});});} \ No newline at end of file +var _0x87cb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatGroup,\x20%s,\x20%s','message'];(function(_0x55f5b7,_0x2dcdcc){var _0x34762d=function(_0x53fd0b){while(--_0x53fd0b){_0x55f5b7['push'](_0x55f5b7['shift']());}};_0x34762d(++_0x2dcdcc);}(_0x87cb,0xaa));var _0xb87c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x87cb[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var moment=require(_0xb87c('0x2'));var BPromise=require(_0xb87c('0x3'));var rs=require(_0xb87c('0x4'));var fs=require('fs');var Redis=require(_0xb87c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb87c('0x6'))(_0xb87c('0x7'));var config=require(_0xb87c('0x8'));var jayson=require(_0xb87c('0x9'));var client=jayson[_0xb87c('0xa')][_0xb87c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb87c('0xc')],{'host':_0xb87c('0xd'),'port':0x18eb});var socket=require(_0xb87c('0xe'))(new Redis(config[_0xb87c('0xc')]));require(_0xb87c('0xf'))['register'](socket);function respondWithRpcPromise(_0x10517c,_0x484d49,_0x260a20){return new BPromise(function(_0x5229a4,_0x37b8e7){return client[_0xb87c('0x10')](_0x10517c,_0x260a20)[_0xb87c('0x11')](function(_0xa4095f){logger[_0xb87c('0x12')]('ChatGroup,\x20%s,\x20%s',_0x484d49,'request\x20sent');logger[_0xb87c('0x13')](_0xb87c('0x14'),_0x484d49,_0xb87c('0x15'),JSON['stringify'](_0xa4095f));if(_0xa4095f[_0xb87c('0x16')]){if(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x17')]===0x1f4){logger[_0xb87c('0x16')](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x37b8e7(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);}logger['error'](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x5229a4(_0xa4095f[_0xb87c('0x16')]['message']);}else{logger[_0xb87c('0x12')]('ChatGroup,\x20%s,\x20%s',_0x484d49,'request\x20sent');_0x5229a4(_0xa4095f[_0xb87c('0x1a')][_0xb87c('0x19')]);}})[_0xb87c('0x1b')](function(_0x581c9e){logger['error']('ChatGroup,\x20%s,\x20%s',_0x484d49,_0x581c9e);_0x37b8e7(_0x581c9e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ae82024..dba5924 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 _0x49a3=['chatGroup:','./chatGroup.events','save','remove','removeListener'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x49a3,0x114));var _0x349a=function(_0x499abc,_0x31a2dc){_0x499abc=_0x499abc-0x0;var _0x48d808=_0x49a3[_0x499abc];return _0x48d808;};'use strict';var ChatGroupEvents=require(_0x349a('0x0'));var events=[_0x349a('0x1'),_0x349a('0x2'),'update'];function createListener(_0x31e583,_0x5490cc){return function(_0x4453f6){_0x5490cc['emit'](_0x31e583,_0x4453f6);};}function removeListener(_0x40b1f4,_0x5cf0a7){return function(){ChatGroupEvents[_0x349a('0x3')](_0x40b1f4,_0x5cf0a7);};}exports['register']=function(_0x155770){for(var _0x2078d3=0x0,_0x142b72=events['length'];_0x2078d3<_0x142b72;_0x2078d3++){var _0xca9e1d=events[_0x2078d3];var _0xd206d5=createListener(_0x349a('0x4')+_0xca9e1d,_0x155770);ChatGroupEvents['on'](_0xca9e1d,_0xd206d5);}}; \ No newline at end of file +var _0x4b7e=['remove','update','emit','removeListener','register','length','./chatGroup.events'];(function(_0x4f484c,_0x9bccb4){var _0x276e95=function(_0x32e002){while(--_0x32e002){_0x4f484c['push'](_0x4f484c['shift']());}};_0x276e95(++_0x9bccb4);}(_0x4b7e,0x1e9));var _0xe4b7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4b7e[_0x21a9d9];return _0x46adce;};'use strict';var ChatGroupEvents=require(_0xe4b7('0x0'));var events=['save',_0xe4b7('0x1'),_0xe4b7('0x2')];function createListener(_0xcd485e,_0x548b2e){return function(_0x36aebf){_0x548b2e[_0xe4b7('0x3')](_0xcd485e,_0x36aebf);};}function removeListener(_0x157112,_0x498c82){return function(){ChatGroupEvents[_0xe4b7('0x4')](_0x157112,_0x498c82);};}exports[_0xe4b7('0x5')]=function(_0x5cfec6){for(var _0xccaf26=0x0,_0x426ab3=events[_0xe4b7('0x6')];_0xccaf26<_0x426ab3;_0xccaf26++){var _0x733538=events[_0xccaf26];var _0x32fa2e=createListener('chatGroup:'+_0x733538,_0x5cfec6);ChatGroupEvents['on'](_0x733538,_0x32fa2e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4be05b0..40a41c6 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 _0xbd01=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','create','post','addMembers','update','delete','removeMembers','exports','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x168d88,_0x2c98c7){var _0x457997=function(_0x47d725){while(--_0x47d725){_0x168d88['push'](_0x168d88['shift']());}};_0x457997(++_0x2c98c7);}(_0xbd01,0xaa));var _0x1bd0=function(_0x524b15,_0x51c457){_0x524b15=_0x524b15-0x0;var _0x28bdef=_0xbd01[_0x524b15];return _0x28bdef;};'use strict';var multer=require('multer');var util=require(_0x1bd0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1bd0('0x1'));var router=express[_0x1bd0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1bd0('0x3'));var interaction=require(_0x1bd0('0x4'));var config=require(_0x1bd0('0x5'));var controller=require(_0x1bd0('0x6'));router[_0x1bd0('0x7')]('/',auth[_0x1bd0('0x8')](),controller[_0x1bd0('0x9')]);router[_0x1bd0('0x7')]('/describe',auth[_0x1bd0('0x8')](),controller[_0x1bd0('0xa')]);router[_0x1bd0('0x7')](_0x1bd0('0xb'),auth[_0x1bd0('0x8')](),controller[_0x1bd0('0xc')]);router[_0x1bd0('0x7')](_0x1bd0('0xd'),auth['isAuthenticated'](),controller[_0x1bd0('0xe')]);router[_0x1bd0('0x7')](_0x1bd0('0xf'),auth[_0x1bd0('0x8')](),controller['getMembers']);router[_0x1bd0('0x7')](_0x1bd0('0x10'),auth[_0x1bd0('0x8')](),controller[_0x1bd0('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1bd0('0x12')]);router[_0x1bd0('0x13')](_0x1bd0('0xf'),auth['isAuthenticated'](),controller[_0x1bd0('0x14')]);router[_0x1bd0('0x13')]('/:id/messages',auth[_0x1bd0('0x8')](),controller['addMessage']);router['put'](_0x1bd0('0xb'),auth[_0x1bd0('0x8')](),controller[_0x1bd0('0x15')]);router[_0x1bd0('0x16')](_0x1bd0('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0x1bd0('0x8')](),controller[_0x1bd0('0x17')]);module[_0x1bd0('0x18')]=router; \ No newline at end of file +var _0xbea8=['isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','index','get','/describe'];(function(_0x3b460b,_0x4e2058){var _0x3807fa=function(_0x115e88){while(--_0x115e88){_0x3b460b['push'](_0x3b460b['shift']());}};_0x3807fa(++_0x4e2058);}(_0xbea8,0x7c));var _0x8bea=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xbea8[_0x5550b3];return _0x4b8fc4;};'use strict';var multer=require(_0x8bea('0x0'));var util=require(_0x8bea('0x1'));var path=require(_0x8bea('0x2'));var timeout=require(_0x8bea('0x3'));var express=require('express');var router=express[_0x8bea('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bea('0x5'));var config=require(_0x8bea('0x6'));var controller=require(_0x8bea('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8bea('0x8')]);router[_0x8bea('0x9')](_0x8bea('0xa'),auth[_0x8bea('0xb')](),controller[_0x8bea('0xc')]);router[_0x8bea('0x9')](_0x8bea('0xd'),auth[_0x8bea('0xb')](),controller[_0x8bea('0xe')]);router[_0x8bea('0x9')](_0x8bea('0xf'),auth['isAuthenticated'](),controller[_0x8bea('0x10')]);router[_0x8bea('0x9')](_0x8bea('0x11'),auth[_0x8bea('0xb')](),controller[_0x8bea('0x12')]);router[_0x8bea('0x9')](_0x8bea('0x13'),auth[_0x8bea('0xb')](),controller[_0x8bea('0x14')]);router[_0x8bea('0x15')]('/',auth[_0x8bea('0xb')](),controller['create']);router[_0x8bea('0x15')]('/:id/members',auth[_0x8bea('0xb')](),controller[_0x8bea('0x16')]);router['post'](_0x8bea('0x13'),auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x8bea('0xd'),auth[_0x8bea('0xb')](),controller[_0x8bea('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8bea('0x18')]);router[_0x8bea('0x19')](_0x8bea('0x11'),auth[_0x8bea('0xb')](),controller[_0x8bea('0x1a')]);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 03b6586..f3d652b 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 _0x777d=['ENUM','out','exports','BOOLEAN','INTEGER','star','thumb','STRING','TEXT','long','DATE'];(function(_0x31ed51,_0x346405){var _0x257c83=function(_0x47aa99){while(--_0x47aa99){_0x31ed51['push'](_0x31ed51['shift']());}};_0x257c83(++_0x346405);}(_0x777d,0xe9));var _0xd777=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x777d[_0x571a17];return _0x3ef337;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'closed':{'type':Sequelize[_0xd777('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd777('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xd777('0x3'),_0xd777('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xd777('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd777('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd777('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xd777('0x5')]},'osVersion':{'type':Sequelize[_0xd777('0x5')]},'deviceModel':{'type':Sequelize[_0xd777('0x5')]},'deviceVendor':{'type':Sequelize[_0xd777('0x5')]},'deviceType':{'type':Sequelize[_0xd777('0x5')]},'referer':{'type':Sequelize[_0xd777('0x6')]},'customerIp':{'type':Sequelize[_0xd777('0x5')]},'formData':{'type':Sequelize[_0xd777('0x6')](_0xd777('0x7'))},'read1stAt':{'type':Sequelize[_0xd777('0x8')]},'lastMsgAt':{'type':Sequelize[_0xd777('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xd777('0x9')]('in',_0xd777('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xd777('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe9e8=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize'];(function(_0x3a05eb,_0x1715d6){var _0x485e33=function(_0x5a37eb){while(--_0x5a37eb){_0x3a05eb['push'](_0x3a05eb['shift']());}};_0x485e33(++_0x1715d6);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x36686a,_0x38cc45){_0x36686a=_0x36686a-0x0;var _0x7e74ab=_0xe9e8[_0x36686a];return _0x7e74ab;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'closed':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8e9e('0x3')]},'ratingType':{'type':Sequelize[_0x8e9e('0x4')](_0x8e9e('0x5'),_0x8e9e('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8e9e('0x7')]},'pathTranscript':{'type':Sequelize[_0x8e9e('0x7')]},'mailTranscript':{'type':Sequelize[_0x8e9e('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8e9e('0x8')]},'secondDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'thirdDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'note':{'type':Sequelize[_0x8e9e('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8e9e('0x8')]},'osName':{'type':Sequelize[_0x8e9e('0x8')]},'osVersion':{'type':Sequelize[_0x8e9e('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x8e9e('0x8')]},'deviceType':{'type':Sequelize[_0x8e9e('0x8')]},'referer':{'type':Sequelize[_0x8e9e('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8e9e('0x7')](_0x8e9e('0x9'))},'read1stAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x8e9e('0x4')]('in',_0x8e9e('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8e9e('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x8e9e('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d870f72..1872527 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 _0xa9e0=['createPdfFromHTML','err','rimraf','zip-dir','request-promise','mustache','path','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','account','Users','fullname','Tags','TagIds','split','forEach','push','catch','waiting','answered','unmanaged','abandoned','closed','UserId','talking','disposition','total','index','map','ChatInteraction','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','select','field','from','u.fullname','user_has_chat_interactions','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','keys','compact','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','group','i.id','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','describe','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','attachmentUpload','file','originalname','filename','Attachment','Unauthorized','findOne','attachId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','hasOwnProperty','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','color','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x32df1f,_0x228b18){var _0x41ef00=function(_0x1bb63c){while(--_0x1bb63c){_0x32df1f['push'](_0x32df1f['shift']());}};_0x41ef00(++_0x228b18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var rimraf=require(_0x0a9e('0x0'));var zipdir=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x3'));var util=require('util');var path=require(_0x0a9e('0x4'));var ejs=require(_0x0a9e('0x5'));var fs=require('fs');var _=require(_0x0a9e('0x6'));var squel=require(_0x0a9e('0x7'));var Redis=require(_0x0a9e('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x0a9e('0x9'));var pdf=require(_0x0a9e('0xa'));var logger=require(_0x0a9e('0xb'))('api');var config=require('../../config/environment');var db=require(_0x0a9e('0xc'))['db'];config['redis']=_['defaults'](config[_0x0a9e('0xd')],{'host':_0x0a9e('0xe'),'port':0x18eb});var socket=require(_0x0a9e('0xf'))(new Redis(config[_0x0a9e('0xd')]));require(_0x0a9e('0x10'))[_0x0a9e('0x11')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0x0a9e('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x36471c,_0xd5b662,_0x26d672,_0x32d742){return new BPromise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_0x32d742||client;return _0x4283ce[_0x0a9e('0x13')](_0x36471c,_0x26d672)[_0x0a9e('0x14')](function(_0x281129){logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');logger[_0x0a9e('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xd5b662,_0x0a9e('0x18'),JSON['stringify'](_0x281129));if(_0x281129[_0x0a9e('0x19')]){if(_0x281129[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x5db4b0(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}logger[_0x0a9e('0x19')](_0x0a9e('0x16'),_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x69aeb7(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');_0x69aeb7(_0x281129[_0x0a9e('0x1b')][_0x0a9e('0x1a')]);}})['catch'](function(_0x20f109){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x20f109);_0x5db4b0(_0x20f109);});});}function respondWithStatusCode(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0xcc;return function(_0x38e7c4){if(_0x38e7c4){return _0x3a02e1[_0x0a9e('0x1c')](_0x432e56);}return _0x3a02e1['status'](_0x432e56)[_0x0a9e('0x1d')]();};}function respondWithResult(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xc8;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x1e')](_0x3b45bc)[_0x0a9e('0x1f')](_0x4d00e6);}};}function respondWithFilteredResult(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(_0x59181e){var _0x197ec0=typeof _0x5ea472[_0x0a9e('0x20')]===_0x0a9e('0x21')&&typeof _0x5ea472[_0x0a9e('0x22')]==='undefined';var _0x384319=_0x59181e['count'];var _0x45a1e7=_0x197ec0?0x0:_0x5ea472['offset'];var _0x1dc186=_0x197ec0?_0x59181e[_0x0a9e('0x23')]:_0x5ea472[_0x0a9e('0x20')]+_0x5ea472[_0x0a9e('0x22')];var _0x140511;if(_0x1dc186>=_0x384319){_0x1dc186=_0x384319;_0x140511=0xc8;}else{_0x140511=0xce;}_0x16b1ca[_0x0a9e('0x1e')](_0x140511);return _0x16b1ca[_0x0a9e('0x24')](_0x0a9e('0x25'),_0x45a1e7+'-'+_0x1dc186+'/'+_0x384319)['json'](_0x59181e);}return null;};}function saveUpdates(_0x3652a7){return function(_0x468813){if(_0x468813){return _0x468813[_0x0a9e('0x26')](_0x3652a7)[_0x0a9e('0x14')](function(_0x5c877d){return _0x5c877d;});}return null;};}function removeEntity(_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x27')]()[_0x0a9e('0x14')](function(){_0x15b200[_0x0a9e('0x1e')](0xcc)[_0x0a9e('0x1d')]();});}};}function handleEntityNotFound(_0x296f41){return function(_0x2e8759){if(!_0x2e8759){_0x296f41[_0x0a9e('0x1c')](0x194);}return _0x2e8759;};}function handleError(_0x540530,_0x426950){_0x426950=_0x426950||0x1f4;return function(_0x5d1e0e){logger[_0x0a9e('0x19')](_0x5d1e0e[_0x0a9e('0x28')]);if(_0x5d1e0e[_0x0a9e('0x29')]){delete _0x5d1e0e[_0x0a9e('0x29')];}_0x540530[_0x0a9e('0x1e')](_0x426950)['send'](_0x5d1e0e);};}function getMustacheRender(_0x66c1d2,_0x46f0a5){return Mustache[_0x0a9e('0x2a')](_0x66c1d2,_[_0x0a9e('0x2b')](_0x46f0a5[_0x0a9e('0x2c')],{'contact':_0x46f0a5[_0x0a9e('0x2d')],'message':_0x46f0a5[_0x0a9e('0x1a')],'agent':_0x46f0a5[_0x0a9e('0x2e')],'interaction':_0x46f0a5['interaction'],'account':_0x46f0a5[_0x0a9e('0x2f')]}))||'';}function getInteractionUsers(_0x5e7238,_0x2cc7a0){return new BPromise(function(_0x14b13f,_0x2b7e7f){try{if(_0x2cc7a0[_0x5e7238['id']]){_0x5e7238[_0x0a9e('0x30')]=_['map'](_0x2cc7a0[_0x5e7238['id']],function(_0x191e91){return{'id':_0x191e91['id'],'fullname':_0x191e91[_0x0a9e('0x31')]};});}}catch(_0x1fa90d){_0x2b7e7f(_0x1fa90d);}_0x14b13f(_0x5e7238);});}function getInteractionTags(_0x15de0e,_0x4853b1){return new BPromise(function(_0x54135e,_0x1e8694){try{if(_0x15de0e['TagIds']){_0x15de0e[_0x0a9e('0x32')]=[];_0x15de0e[_0x0a9e('0x33')][_0x0a9e('0x34')](',')[_0x0a9e('0x35')](function(_0x4f41ae){_0x15de0e[_0x0a9e('0x32')][_0x0a9e('0x36')](_0x4853b1[_0x4f41ae]);});}delete _0x15de0e[_0x0a9e('0x33')];}catch(_0x533942){_0x1e8694(_0x533942);}_0x54135e(_0x15de0e);});}function updateChatInteraction(_0x1dbf74,_0x1a180b,_0x289467){return new BPromise(function(_0x4c1c0e,_0x546ef8){return getInteractionUsers(_0x1dbf74,_0x289467)[_0x0a9e('0x14')](function(_0x40d766){return getInteractionTags(_0x40d766,_0x1a180b);})['then'](function(_0x2b814e){return getStateInteraction(_0x2b814e);})[_0x0a9e('0x14')](function(_0x2e1b3a){_0x4c1c0e(_0x2e1b3a);})[_0x0a9e('0x37')](function(_0x4b38d9){_0x546ef8(_0x4b38d9);});});}function getStateInteraction(_0x5a594b){return new BPromise(function(_0x15e37d){_0x5a594b[_0x0a9e('0x38')]=0x0;_0x5a594b['talking']=0x0;_0x5a594b[_0x0a9e('0x39')]=0x0;_0x5a594b[_0x0a9e('0x3a')]=0x0;_0x5a594b[_0x0a9e('0x3b')]=0x0;_0x5a594b['total']=0x0;if(!_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x38')]+=0x1;}if(!_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x3e')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3f')]===_0x0a9e('0x3b')){_0x5a594b[_0x0a9e('0x3b')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b['UserId']&&_0x5a594b['disposition']){_0x5a594b[_0x0a9e('0x3a')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x39')]+=0x1;if(_0x5a594b[_0x0a9e('0x3e')]){_0x5a594b[_0x0a9e('0x3e')]-=0x1;}}_0x5a594b[_0x0a9e('0x40')]+=0x1;_0x15e37d(_0x5a594b);});}exports[_0x0a9e('0x41')]=function(_0x2c2cb0,_0x35ed4a){var _0x5026aa={},_0x117c99={},_0x138b8b={'count':0x0,'rows':[]};var _0xdd268f=_[_0x0a9e('0x42')](db[_0x0a9e('0x43')][_0x0a9e('0x44')],function(_0x21eb86){return{'name':_0x21eb86[_0x0a9e('0x45')],'type':_0x21eb86['type'][_0x0a9e('0x46')]};});_0x117c99['model']=_[_0x0a9e('0x42')](_0xdd268f,_0x0a9e('0x29'));_0x117c99[_0x0a9e('0x47')]=_['keys'](_0x2c2cb0[_0x0a9e('0x47')]);_0x117c99[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x117c99[_0x0a9e('0x4a')],_0x117c99[_0x0a9e('0x47')]);_0x5026aa[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x117c99['model'],qs[_0x0a9e('0x4c')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x5026aa[_0x0a9e('0x4b')]=_0x5026aa[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x5026aa[_0x0a9e('0x4b')]:_0x117c99[_0x0a9e('0x4a')];if(!_0x2c2cb0[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x5026aa[_0x0a9e('0x22')]=qs['limit'](_0x2c2cb0['query']['limit']);_0x5026aa[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x5026aa[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x5026aa['where']=qs['filters'](_['pick'](_0x2c2cb0[_0x0a9e('0x47')],_0x117c99[_0x0a9e('0x48')]),_0xdd268f);var _0x14d602=[];var _0x5bb3ed=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('id')['field']('name')[_0x0a9e('0x52')]('color')[_0x0a9e('0x53')]('tools_tags');var _0x2e5e62=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('u.id')[_0x0a9e('0x52')](_0x0a9e('0x54'))['field']('ui.ChatInteractionId')[_0x0a9e('0x53')](_0x0a9e('0x55'),'ui')['left_join'](_0x0a9e('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x211ef9=squel['select']()[_0x0a9e('0x53')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x0a9e('0x57'))['left_join'](_0x0a9e('0x56'),'o',_0x0a9e('0x58'))[_0x0a9e('0x59')](_0x0a9e('0x5a'),'a',_0x0a9e('0x5b'))[_0x0a9e('0x59')](_0x0a9e('0x5c'),'me',_0x0a9e('0x5d'))['left_join'](_0x0a9e('0x5e'),'it',_0x0a9e('0x5f'))[_0x0a9e('0x59')](_0x0a9e('0x60'),'t',_0x0a9e('0x61'));var _0x156662=squel['expr']();var _0x956fbe=[];var _0x26bc80=squel['expr']();var _0x3649cc;if(_0x2c2cb0['query'][_0x0a9e('0x62')]){_0x3649cc=as['parseSearch'](_0x2c2cb0['query']['search']);var _0x273cb5=_0x3649cc['sqlOperator'];for(var _0x2244d6=0x0;_0x2244d6<_0x3649cc[_0x0a9e('0x63')][_0x0a9e('0x4d')];_0x2244d6++){var _0x7be420=_0x3649cc[_0x0a9e('0x63')][_0x2244d6];var _0x26d7db='i';var _0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x7be420[_0x0a9e('0x52')]]);if(!_0x49eed0){switch(_0x7be420[_0x0a9e('0x52')]){case _0x0a9e('0x65'):if(_0x7be420['value']==0x1){_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420[_0x0a9e('0x52')]+_0x0a9e('0x67'));}else{_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420['field']+_0x0a9e('0x68'));}break;case _0x0a9e('0x69'):if(_0x7be420['operator']===_0x0a9e('0x6a')){if(_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')]('\x20')[_0x0a9e('0x4d')]>0x1){_0x156662[_0x273cb5](_0x0a9e('0x6c'),qs['getFullTextValue'](_0x7be420[_0x0a9e('0x6b')]),null);}else{var _0x2937e0='%'+_0x7be420[_0x0a9e('0x6b')]+'%';_0x156662[_0x273cb5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2937e0,_0x2937e0,_0x2937e0);}}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name','ContactId']);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x6d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x72'):var _0x2e89b7=_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')](',')[_0x0a9e('0x42')](function(_0x320898){return Number(_0x320898);});_0x2e89b7[_0x0a9e('0x35')](function(_0x2a28c0){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x2a28c0+',%');});_0x956fbe=_['union'](_0x956fbe,_0x2e89b7);break;case _0x0a9e('0x74'):if(_0x7be420[_0x0a9e('0x75')]===_0x0a9e('0x6a')){_0x156662[_0x273cb5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x7be420[_0x0a9e('0x6b')]+'%',null);}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x0a9e('0x3d')]);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x3d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f['value']['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x2c'):_0x235f8f=as[_0x0a9e('0x6e')]('me',null,_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')]['end']);break;}}else{var _0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f[_0x0a9e('0x6b')]['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}}}else{var _0x4c46c1=_(_0x2c2cb0[_0x0a9e('0x47')])[_0x0a9e('0x76')]()[_0x0a9e('0x42')](function(_0x317c0c){return _['some'](_0xdd268f,[_0x0a9e('0x29'),_0x317c0c])?_0x317c0c:undefined;})[_0x0a9e('0x77')]()[_0x0a9e('0x6b')]();if(!_[_0x0a9e('0x78')](_0x4c46c1)){_0x4c46c1['forEach'](function(_0x109ccb){if(_0x109ccb===_0x0a9e('0x79')){_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),[]['concat'](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]));}else if(_0x109ccb===_0x0a9e('0x7c')){var _0x30a4c7=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7e')];var _0x40fc56=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7f')];_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x80'),_0x30a4c7,_0x40fc56);}else{if(_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]===_0x0a9e('0x81')){_0x211ef9['where']('i.'+_0x109ccb+_0x0a9e('0x82'));}else{_0x211ef9[_0x0a9e('0x7a')]('i.'+_0x109ccb+_0x0a9e('0x83'),_0x2c2cb0['query'][_0x109ccb]);}}});}if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]==0x1){_0x211ef9['having']('`unreadMessages`\x20=\x200');}else{_0x211ef9[_0x0a9e('0x66')](_0x0a9e('0x85'));}}if(_0x2c2cb0['query'][_0x0a9e('0x86')]){_0x956fbe=_['isArray'](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')])?_0x2c2cb0['query'][_0x0a9e('0x86')]:new Array(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')]);_0x956fbe[_0x0a9e('0x35')](function(_0x3755fe){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x3755fe+',%');});}if(_0x2c2cb0[_0x0a9e('0x47')]['filter']){var _0x2973d3=_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x87')][_0x0a9e('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0a9e('0x89')](_0x2973d3)){_0x156662['or'](_0x0a9e('0x8a'),_0x2973d3+'%');}else{_0x156662['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x8b')](_0x2973d3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2973d3+'%');}}}_0x211ef9[_0x0a9e('0x7a')](_0x156662);_0x211ef9[_0x0a9e('0x8c')](_0x0a9e('0x8d'));var _0x385d52={'type':db['Sequelize']['QueryTypes'][_0x0a9e('0x8e')],'raw':!![]};var _0x2b9c01=_0x211ef9[_0x0a9e('0x8f')]();_0x2b9c01['field'](_0x0a9e('0x8d'));_0x2b9c01[_0x0a9e('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5026aa[_0x0a9e('0x4f')]){_0x5026aa['order']['forEach'](function(_0x4dc6b3){var _0x81d748=_0x4dc6b3[0x0]===_0x0a9e('0x90')?_0x4dc6b3[0x0]:'i.'+_0x4dc6b3[0x0];_0x211ef9[_0x0a9e('0x4f')](_0x81d748,_0x4dc6b3[0x1]===_0x0a9e('0x91')?![]:!![]);});}if(!_[_0x0a9e('0x78')](_0x956fbe)){_0x211ef9[_0x0a9e('0x66')](_0x26bc80);_0x2b9c01['where'](_0x0a9e('0x92'),_0x956fbe);}BPromise['resolve']()[_0x0a9e('0x14')](function(){if(!_0x3649cc){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return;_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x93'));return;}if(_0x2c2cb0[_0x0a9e('0x94')]['role']!==_0x0a9e('0x2e'))return;return _0x2c2cb0[_0x0a9e('0x94')][_0x0a9e('0x95')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x14')](function(_0x255e49){if(_[_0x0a9e('0x78')](_0x255e49)){_0x2b9c01[_0x0a9e('0x7a')](_0x0a9e('0x96'));_0x211ef9['where'](_0x0a9e('0x96'));}else{_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0a9e('0x42')](_0x255e49,'id'));_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),_['map'](_0x255e49,'id'));}});})[_0x0a9e('0x14')](function(){if(_0x2c2cb0['user'][_0x0a9e('0x97')]===_0x0a9e('0x2e')&&!_0x3649cc&&!_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x2b9c01[_0x0a9e('0x99')](),_0x385d52);})[_0x0a9e('0x14')](function(_0x501050){_0x138b8b[_0x0a9e('0x23')]=_0x501050[_0x0a9e('0x4d')];if(_0x138b8b[_0x0a9e('0x23')]===0x0)return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x5bb3ed[_0x0a9e('0x99')](),_0x385d52)[_0x0a9e('0x14')](function(_0x33f0c9){_0x14d602=_[_0x0a9e('0x9a')](_0x33f0c9,'id');_0x385d52=_[_0x0a9e('0x2b')](_0x385d52,{'model':db[_0x0a9e('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5026aa['attributes'][_0x0a9e('0x35')](function(_0x23e2bd){_0x211ef9[_0x0a9e('0x52')]('i.'+_0x23e2bd);});}else{_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9b'),'unreadMessages');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9c'),'Account.key');_0x211ef9[_0x0a9e('0x52')]('a.mandatoryDisposition',_0x0a9e('0x9d'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9e'),_0x0a9e('0x90'));_0x211ef9['field'](_0x0a9e('0x9f'));_0x211ef9['field'](_0x0a9e('0xa0'),_0x0a9e('0xa1'));_0x211ef9['field'](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x211ef9[_0x0a9e('0x52')]('c.email','Contact.email');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x211ef9['field'](_0x0a9e('0xaa'),'Owner.fullname');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xab'),_0x0a9e('0xac'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xad'),'TagIds');}if(_0x5026aa[_0x0a9e('0x22')])_0x211ef9[_0x0a9e('0x22')](_0x5026aa[_0x0a9e('0x22')]);if(_0x5026aa[_0x0a9e('0x20')])_0x211ef9[_0x0a9e('0x20')](_0x5026aa['offset']);return db['sequelize'][_0x0a9e('0x47')](_0x211ef9['toString'](),_0x385d52);})[_0x0a9e('0x14')](function(_0x4658df){if(_0x4658df[_0x0a9e('0x4d')]>0x0)_0x2e5e62[_0x0a9e('0x7a')](_0x0a9e('0xae'),_[_0x0a9e('0x42')](_0x4658df,'id'));return db['sequelize']['query'](_0x2e5e62[_0x0a9e('0x99')](),_0x385d52)['then'](function(_0x2469d1){var _0x5c689c=_[_0x0a9e('0xaf')](_0x2469d1,'ChatInteractionId');var _0x558d60=[];_0x4658df[_0x0a9e('0x35')](function(_0xb8db59){_0x558d60['push'](updateChatInteraction(_0xb8db59,_0x14d602,_0x5c689c));});return BPromise[_0x0a9e('0xb0')](_0x558d60);});});})[_0x0a9e('0x14')](function(_0x15c6b9){_0x138b8b[_0x0a9e('0xb1')]=_0x15c6b9;return _0x138b8b;})[_0x0a9e('0x14')](respondWithFilteredResult(_0x35ed4a,_0x5026aa))['catch'](handleError(_0x35ed4a,null));};exports['show']=function(_0x16449b,_0x22286c){var _0x41c8cd={'raw':![],'where':{'id':_0x16449b[_0x0a9e('0xb2')]['id']}},_0x24beb6={};_0x24beb6['model']=_[_0x0a9e('0x76')](db[_0x0a9e('0x43')]['rawAttributes']);_0x24beb6[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x16449b[_0x0a9e('0x47')]);_0x24beb6[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],_0x24beb6[_0x0a9e('0x47')]);_0x41c8cd[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],qs['fields'](_0x16449b[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x41c8cd[_0x0a9e('0x4b')]=_0x41c8cd[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x41c8cd['attributes']:_0x24beb6['model'];if(_0x16449b[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x41c8cd[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x41c8cd=_[_0x0a9e('0x2b')]({},_0x41c8cd,_0x16449b[_0x0a9e('0xb5')]);return db['ChatInteraction'][_0x0a9e('0x64')](_0x41c8cd)[_0x0a9e('0x14')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x14')](respondWithResult(_0x22286c,null))['catch'](handleError(_0x22286c,null));};exports[_0x0a9e('0xb6')]=function(_0x59aa7b,_0x2144ca){return db['ChatInteraction'][_0x0a9e('0xb6')](_0x59aa7b[_0x0a9e('0x2c')],{})[_0x0a9e('0x14')](respondWithResult(_0x2144ca,0xc9))['catch'](handleError(_0x2144ca,null));};exports[_0x0a9e('0x26')]=function(_0x5ed560,_0x4383da){if(_0x5ed560[_0x0a9e('0x2c')]['id']){delete _0x5ed560[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x5ed560[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x14')](saveUpdates(_0x5ed560[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x4383da,null))[_0x0a9e('0x37')](handleError(_0x4383da,null));};exports[_0x0a9e('0x27')]=function(_0x2415fe,_0x399def){return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x2415fe['params']['id']}})['then'](handleEntityNotFound(_0x399def,null))[_0x0a9e('0x14')](removeEntity(_0x399def,null))['catch'](handleError(_0x399def,null));};exports[_0x0a9e('0xb7')]=function(_0x3428c9,_0x5d6b69){return db[_0x0a9e('0x43')][_0x0a9e('0xb7')]()[_0x0a9e('0x14')](respondWithResult(_0x5d6b69,null))[_0x0a9e('0x37')](handleError(_0x5d6b69,null));};exports['createVidaooSession']=function(_0x148fd9,_0x26cb76){var _0x374f0b=_0x148fd9[_0x0a9e('0xb2')]['id'];var _0x5d0e1f;var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x374f0b}})[_0x0a9e('0x14')](function(_0x270df8){_0x5d0e1f=_0x270df8;return db[_0x0a9e('0xb8')]['findOne']({'where':{'id':_0x270df8[_0x0a9e('0x79')]},'attributes':['id',_0x0a9e('0xb9'),_0x0a9e('0xba'),_0x0a9e('0xbb'),_0x0a9e('0xbc'),'vidaooMetadata'],'raw':!![]});})[_0x0a9e('0x14')](function(_0x289e65){if(_0x289e65&&_0x289e65['vidaooApiKey']&&_0x289e65[_0x0a9e('0xba')]){_0x19e9ed=_0x289e65;var _0x1fcfe6={'interaction':{'id':_0x374f0b},'agent':{'id':_0x148fd9[_0x0a9e('0x94')]['id'],'name':_0x148fd9['user']['name'],'fullname':_0x148fd9['user'][_0x0a9e('0x31')],'email':_0x148fd9[_0x0a9e('0x94')]['email']},'contact':_0x148fd9[_0x0a9e('0x2c')][_0x0a9e('0x2d')],'account':_0x148fd9[_0x0a9e('0x2c')]['account']};var _0x9fc93e={'rejectUnauthorized':![],'method':_0x0a9e('0xbd'),'url':_0x0a9e('0xbe'),'headers':{'X-APIKEY':_0x289e65[_0x0a9e('0xb9')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x148fd9[_0x0a9e('0x94')][_0x0a9e('0xbf')]],'buttons':null,'topic':_0x19e9ed[_0x0a9e('0xbb')],'note':_[_0x0a9e('0xc0')](_0x19e9ed[_0x0a9e('0xbc')])?null:getMustacheRender(_0x19e9ed['vidaooNote'],_0x1fcfe6),'metadata':null},'redirect':_0x0a9e('0xc1'),'json':!![]};try{if(!_['isNull'](_0x19e9ed[_0x0a9e('0xc2')])){var _0x4093e6=getMustacheRender(_0x19e9ed[_0x0a9e('0xc2')],_0x1fcfe6);var _0x3cf222=JSON[_0x0a9e('0x7d')](_0x4093e6);_0x9fc93e[_0x0a9e('0x2c')]['metadata']=_0x3cf222;}}catch(_0x1a0314){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))](_0x0a9e('0xc5'));}return rp(_0x9fc93e);}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xc6'));}})[_0x0a9e('0x14')](function(_0x1c9539){_0x1a0b08=_0x1c9539;if(_0x1a0b08['id']){var _0xc2e7b={'body':_0x1a0b08[_0x0a9e('0xc7')],'ChatWebsiteId':_0x19e9ed['id'],'ChatInteractionId':_0x5d0e1f['id'],'direction':_0x0a9e('0xc8'),'UserId':_0x148fd9[_0x0a9e('0x94')]['id']};return db[_0x0a9e('0xc9')][_0x0a9e('0xb6')](_0xc2e7b,{});}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xca'));}})[_0x0a9e('0x14')](function(){return _0x5d0e1f[_0x0a9e('0xcb')]({'vidaooSessionId':_0x1a0b08['id']});})[_0x0a9e('0x14')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x37')](handleError(_0x26cb76,null));};exports[_0x0a9e('0xcc')]=function(_0x20ae21,_0x566b90){if(_0x20ae21[_0x0a9e('0x2c')]['id']){delete _0x20ae21[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x20ae21[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69')}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x14')](saveUpdates(_0x20ae21[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x566b90,null))[_0x0a9e('0x37')](handleError(_0x566b90,null));};exports[_0x0a9e('0xce')]=function(_0x451010,_0x5a7dad){if(_0x451010[_0x0a9e('0x2c')]['id']){delete _0x451010[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x451010[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](function(_0x5cb48d){if(!_0x5cb48d){logger[_0x0a9e('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x5a7dad[_0x0a9e('0x1c')](0x194);}else{if(_0x5cb48d[_0x0a9e('0x3d')]){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))]('Interaction\x20already\x20assigned');}}return _0x5cb48d;})[_0x0a9e('0x14')](function(_0x309fa9){if(_0x309fa9){return _0x309fa9[_0x0a9e('0x26')]({'closed':_0x451010[_0x0a9e('0x2c')][_0x0a9e('0x3c')],'disposition':_0x451010['body']['disposition']})[_0x0a9e('0x14')](function(_0x33bcb2){return _0x33bcb2;});}})[_0x0a9e('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0x0a9e('0xce'),_0x451010[_0x0a9e('0x2c')],client9004);})[_0x0a9e('0x14')](respondWithResult(_0x5a7dad,null))['catch'](handleError(_0x5a7dad,null));};exports[_0x0a9e('0xcf')]=function(_0x2bf85d,_0x15ba6b){_0x2bf85d['body'][_0x0a9e('0x29')]=_0x2bf85d[_0x0a9e('0xd0')][_0x0a9e('0xd1')];_0x2bf85d['body']['basename']=_0x2bf85d['file'][_0x0a9e('0xd2')];_0x2bf85d[_0x0a9e('0x2c')][_0x0a9e('0x6f')]=_0x2bf85d[_0x0a9e('0xd0')]['mimetype'];return db[_0x0a9e('0xd3')]['create'](_0x2bf85d[_0x0a9e('0x2c')])[_0x0a9e('0x14')](respondWithResult(_0x15ba6b,0xc9))[_0x0a9e('0x37')](handleError(_0x15ba6b,null));};exports['attachmentDownload']=function(_0x33b4b3,_0x33a26c){return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x33b4b3[_0x0a9e('0xb2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x33a26c,null))[_0x0a9e('0x14')](function(_0x5c57e1){if(_0x5c57e1){if(_0x5c57e1[_0x0a9e('0x3c')]){return _0x33a26c['status'](0x193)[_0x0a9e('0x1f')]({'status':0x193,'message':_0x0a9e('0xd4')});}return db[_0x0a9e('0xd3')][_0x0a9e('0xd5')]({'where':{'id':_0x33b4b3[_0x0a9e('0x47')][_0x0a9e('0xd6')]},'raw':!![]})[_0x0a9e('0x14')](handleEntityNotFound(_0x33a26c,null));}})['then'](function(_0x35ace3){if(_0x35ace3){var _0x1c9ea2=_0x35ace3['ChatOfflineMessageId']!==null;var _0xf4fb77=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0xd8'));if(_0x1c9ea2){_0xf4fb77=path[_0x0a9e('0xd7')](_0xf4fb77,_0x0a9e('0xd9'));}var _0x569528=path[_0x0a9e('0xd7')](_0xf4fb77,_0x35ace3[_0x0a9e('0xda')]);return _0x33a26c[_0x0a9e('0xdb')](_0x569528);}})[_0x0a9e('0x37')](handleError(_0x33a26c,null));};exports[_0x0a9e('0xdc')]=function(_0x29fdfe,_0x3ba897){var _0x74d9b8=null;var _0x22767f=null;var _0x426c3c=null;if(_0x29fdfe['body']['id']){delete _0x29fdfe[_0x0a9e('0x2c')]['id'];}if(_0x29fdfe['body'][_0x0a9e('0xdd')]){_0x426c3c=path[_0x0a9e('0xd7')](config[_0x0a9e('0xde')],_0x0a9e('0xdf'),util[_0x0a9e('0xe0')](_0x0a9e('0xe1'),Date['now']()));_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe2')]=_0x426c3c;}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x29fdfe[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xc9')],'as':_0x0a9e('0xe3'),'include':[{'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74')}]}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x3ba897,null))[_0x0a9e('0x14')](saveUpdates(_0x29fdfe['body'],null))[_0x0a9e('0x14')](function(_0x228c10){if(_0x228c10){_0x74d9b8=_0x228c10;return db[_0x0a9e('0xb8')][_0x0a9e('0x64')]({'where':{'id':_0x74d9b8[_0x0a9e('0x79')]}});}})[_0x0a9e('0x14')](function(_0x8120e){if(_0x8120e){_0x22767f=_0x8120e;return db['CmContact']['find']({'where':{'id':_0x74d9b8[_0x0a9e('0x6d')]}});}})[_0x0a9e('0x14')](function(_0x1f4929){if(_0x1f4929){if(_0x426c3c){var _0x1bf692=null;for(var _0x40e2da=0x1;_0x40e2da<_0x74d9b8[_0x0a9e('0xe3')][_0x0a9e('0x4d')];++_0x40e2da){_0x1bf692=_0x74d9b8['Messages'][_0x40e2da];var _0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');var _0x54f0b8=_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe7')]||util[_0x0a9e('0xe0')]('%s%d',_0x0a9e('0xe8'),_0x1bf692[_0x0a9e('0x6d')]);switch(_0x22767f[_0x0a9e('0xe9')]){case _0x0a9e('0xea'):_0x39ea62=_0x1bf692['UserId']?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');break;case _0x0a9e('0xeb'):_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?_0x1bf692[_0x0a9e('0x74')]['alias']||_0x1bf692[_0x0a9e('0x74')][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;case _0x0a9e('0xec'):_0x39ea62=_0x1bf692['UserId']?_0x1bf692['User'][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;default:_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util['format'](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692['UserId']):_0x0a9e('0xe6');}var _0x5d19b1=util[_0x0a9e('0xe0')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1bf692['createdAt'])['format'](_0x0a9e('0xed')),_0x1bf692[_0x0a9e('0xee')]==='in'?_0x54f0b8:_0x39ea62,_0x1bf692[_0x0a9e('0x2c')]);if(!_0x1bf692[_0x0a9e('0xef')]){fs[_0x0a9e('0xf0')](_0x426c3c,_0x5d19b1);}}return db[_0x0a9e('0xf1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xf2')],'as':_0x0a9e('0xf3'),'raw':!![],'include':[{'model':db[_0x0a9e('0xf4')],'as':_0x0a9e('0xf4'),'raw':!![]}]}]});}}})[_0x0a9e('0x14')](function(_0x18dccf){if(!_0x18dccf||!_0x18dccf[_0x0a9e('0xf3')]||!_0x29fdfe['body'])return _0x74d9b8;var _0x49baaa=_0x18dccf[_0x0a9e('0xf5')]();return respondWithRpcPromise('SendMail',_0x0a9e('0xf6'),{'account':_0x49baaa,'message':{'from':util[_0x0a9e('0xe0')](_0x0a9e('0xf7'),_0x18dccf[_0x0a9e('0x29')],_0x18dccf[_0x0a9e('0xbf')]||_0x18dccf[_0x0a9e('0xf3')]['user']),'to':_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x0a9e('0xe0')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript']),'attachments':[{'path':_0x426c3c}]}})['then'](function(){return _0x74d9b8;})[_0x0a9e('0x37')](function(_0x4a7a3c){logger[_0x0a9e('0x19')](_0x4a7a3c);});})[_0x0a9e('0x14')](respondWithStatusCode(_0x3ba897,0xc8))[_0x0a9e('0x37')](handleError(_0x3ba897,null));};exports['addMessage']=function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0xc9')]['find']({'where':{'id':_0x4152cd['params']['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1209c4,null))[_0x0a9e('0x14')](function(_0x89d2cb){if(_0x89d2cb){return _0x89d2cb[_0x0a9e('0xf8')](_0x4152cd[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x4152cd[_0x0a9e('0x2c')],[_0x0a9e('0xf9'),'id'])||{});}})[_0x0a9e('0x14')](respondWithResult(_0x1209c4,null))['catch'](handleError(_0x1209c4,null));};exports['getMessages']=function(_0x558171,_0x5975fa){var _0x19dcc2={'raw':![],'where':{}};var _0x2ce30f={};var _0x2d21c7={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x558171[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5975fa,null))['then'](function(_0x5c3ecf){if(_0x5c3ecf){_0x2ce30f[_0x0a9e('0x4a')]=_[_0x0a9e('0x76')](db['ChatMessage'][_0x0a9e('0x44')]);_0x2ce30f[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x558171[_0x0a9e('0x47')]);_0x2ce30f[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],_0x2ce30f[_0x0a9e('0x47')]);_0x19dcc2[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x558171['query'][_0x0a9e('0x4c')]));_0x19dcc2[_0x0a9e('0x4b')]=_0x19dcc2[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x19dcc2[_0x0a9e('0x4b')]:_0x2ce30f[_0x0a9e('0x4a')];if(!_0x558171[_0x0a9e('0x47')][_0x0a9e('0xfb')](_0x0a9e('0x4e'))){_0x19dcc2[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x558171[_0x0a9e('0x47')]['limit']);_0x19dcc2['offset']=qs[_0x0a9e('0x20')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x19dcc2[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x19dcc2['where']=qs[_0x0a9e('0x48')](_['pick'](_0x558171[_0x0a9e('0x47')],_0x2ce30f[_0x0a9e('0x48')]));_0x19dcc2[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x5c3ecf['id'];if(_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x19dcc2[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x19dcc2[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x19dcc2[_0x0a9e('0x4b')],function(_0x8231e5){var _0x43111e={};_0x43111e[_0x8231e5]={'$like':'%'+_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x43111e;})});}if(_0x558171[_0x0a9e('0x47')]['$gte']){var _0x54cf62=_0x558171[_0x0a9e('0x47')][_0x0a9e('0x7e')]['split'](',');var _0x5500de={};_0x5500de[_0x54cf62[0x0]]={'$gte':moment(_0x54cf62[0x1])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))};_0x19dcc2[_0x0a9e('0x7a')]=_['merge'](_0x19dcc2[_0x0a9e('0x7a')],_0x5500de);}_0x19dcc2=_['merge']({},_0x19dcc2,_0x558171[_0x0a9e('0xb5')]);return db['ChatMessage'][_0x0a9e('0x23')]({'where':_0x19dcc2['where']})[_0x0a9e('0x14')](function(_0x21e210){_0x2d21c7[_0x0a9e('0x23')]=_0x21e210;if(_0x558171['query'][_0x0a9e('0xb3')]){_0x19dcc2['include']=[{'all':!![]}];}return db['ChatMessage'][_0x0a9e('0xfe')](_0x19dcc2);})[_0x0a9e('0x14')](function(_0x3c691f){_0x2d21c7[_0x0a9e('0xb1')]=_0x3c691f;return _0x2d21c7;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x5975fa,_0x19dcc2))[_0x0a9e('0x37')](handleError(_0x5975fa,null));};exports[_0x0a9e('0xff')]=function(_0x82504f,_0x1a3143){var _0x151f16={'where':{}},_0xd6938={},_0x98bf26={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x82504f[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1a3143,null))[_0x0a9e('0x14')](function(_0x643f66){if(_0x643f66){_0xd6938[_0x0a9e('0x4a')]=_['keys'](db[_0x0a9e('0xc9')][_0x0a9e('0x44')]);_0xd6938[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x82504f['query']);_0xd6938['filters']=_['intersection'](_0xd6938[_0x0a9e('0x4a')],_0xd6938['query']);_0x151f16[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0xd6938[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x151f16[_0x0a9e('0x4b')]=_0x151f16[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x151f16[_0x0a9e('0x4b')]:_0xd6938['model'];if(!_0x82504f[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x151f16['limit']=qs[_0x0a9e('0x22')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x22')]);_0x151f16['offset']=qs[_0x0a9e('0x20')](_0x82504f[_0x0a9e('0x47')]['offset']);}_0x151f16['order']=qs[_0x0a9e('0x50')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x151f16['where']=qs['filters'](_['pick'](_0x82504f[_0x0a9e('0x47')],_0xd6938[_0x0a9e('0x48')]));_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x643f66['id'];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x151f16[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x151f16[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x151f16[_0x0a9e('0x4b')],function(_0x2f4de1){var _0x13215c={};_0x13215c[_0x2f4de1]={'$like':'%'+_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x13215c;})});}_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xef')]=![];if(_0x82504f[_0x0a9e('0x47')]['id']){_0x151f16['where']['id']={'$gt':_0x82504f[_0x0a9e('0x47')]['id']};}_0x151f16=_[_0x0a9e('0x2b')]({},_0x151f16,_0x82504f[_0x0a9e('0xb5')]);return db[_0x0a9e('0xc9')][_0x0a9e('0x23')]({'where':_0x151f16[_0x0a9e('0x7a')]})['then'](function(_0x4739ed){_0x98bf26[_0x0a9e('0x23')]=_0x4739ed;_0x151f16[_0x0a9e('0xb4')]=[];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x100')]){_0x151f16[_0x0a9e('0xb4')][_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id','fullname','alias']});}if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x151f16['include']=[{'all':!![]}];}return db[_0x0a9e('0xc9')][_0x0a9e('0xfe')](_0x151f16);})['then'](function(_0x1ca7c8){_0x98bf26['rows']=_0x1ca7c8;return _0x98bf26;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x1a3143,_0x151f16))[_0x0a9e('0x37')](handleError(_0x1a3143,null));};exports['addTags']=function(_0x27a41c,_0x31ab12){return db['ChatInteraction'][_0x0a9e('0x64')]({'where':{'id':_0x27a41c[_0x0a9e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x31ab12,null))[_0x0a9e('0x14')](function(_0x237994){if(_0x237994){return _0x237994[_0x0a9e('0x101')](_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x27a41c['body'],[_0x0a9e('0xf9'),'id'])||{})[_0x0a9e('0x102')](function(){return db['Tag'][_0x0a9e('0xfe')]({'attributes':['id',_0x0a9e('0x29'),_0x0a9e('0x103')],'where':{'id':_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')]}});})[_0x0a9e('0x14')](function(_0x368a12){socket['emit']('chatInteractionTags:save',{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]});return{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]};});}})['then'](respondWithResult(_0x31ab12,null))[_0x0a9e('0x37')](handleError(_0x31ab12,null));};exports[_0x0a9e('0x104')]=function(_0x556344,_0x5c23aa){return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x556344[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5c23aa,null))[_0x0a9e('0x14')](function(_0x175c97){if(_0x175c97){return _0x175c97[_0x0a9e('0x104')](_0x556344[_0x0a9e('0x47')]['ids']);}})[_0x0a9e('0x14')](respondWithStatusCode(_0x5c23aa,null))[_0x0a9e('0x37')](handleError(_0x5c23aa,null));};exports['download']=function(_0x44cdb8,_0x1c0d54){var _0x2e0e9b=moment()[_0x0a9e('0x105')]()[_0x0a9e('0x99')]();var _0x2f1cc0=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0x106'),'files',_0x0a9e('0x107'));var _0xd456e6=path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'files',_0x0a9e('0x108'));var _0x4e03f5=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x2e0e9b);var _0x9c686f=util['format'](_0x0a9e('0x109'),_0x44cdb8['params']['id'],_0x2e0e9b);var _0x1d046c=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x9c686f);var _0x732141=[];_0x732141[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id',_0x0a9e('0x31')],'raw':!![]});_0x732141['push']({'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69'),'attributes':['id',_0x0a9e('0x10a'),_0x0a9e('0x10b')],'raw':!![]});if(_0x44cdb8[_0x0a9e('0x47')]['attachments']){_0x732141[_0x0a9e('0x36')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3a459c=[{'model':db['ChatMessage'],'as':_0x0a9e('0xe3'),'attributes':['id',_0x0a9e('0x2c'),'createdAt',_0x0a9e('0xee'),_0x0a9e('0xef'),_0x0a9e('0x84')],'include':_0x732141}];_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0xb8')],'as':_0x0a9e('0x10c'),'attributes':['id',_0x0a9e('0x29')]});_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':'Owner','attributes':['id',_0x0a9e('0x31')]});return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x44cdb8[_0x0a9e('0xb2')]['id']},'include':_0x3a459c})['then'](handleEntityNotFound(_0x1c0d54,null))[_0x0a9e('0x14')](function(_0x439f25){if(_0x439f25){var _0x333d3c=_0x439f25['get']({'plain':!![]});fs[_0x0a9e('0x10d')](_0x4e03f5);var _0x2191c6={'channel':_0x0a9e('0x10e'),'account':_0x333d3c['Account'][_0x0a9e('0x29')],'agent':_0x333d3c['Owner']?_0x333d3c[_0x0a9e('0x10f')][_0x0a9e('0x31')]:_0x0a9e('0x110'),'createdAt':moment(_0x333d3c[_0x0a9e('0x7c')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'closedAt':_0x333d3c['closed']?moment(_0x333d3c[_0x0a9e('0x111')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')]():'','disposition':_0x333d3c[_0x0a9e('0x3f')],'chatInfo':{'browser':_0x333d3c[_0x0a9e('0x112')],'os':_0x333d3c[_0x0a9e('0x113')],'referer':_0x333d3c[_0x0a9e('0x114')],'customerIp':_0x333d3c[_0x0a9e('0x115')],'customerPort':_0x333d3c[_0x0a9e('0x116')]?_0x333d3c[_0x0a9e('0x116')]:_0x0a9e('0x110')},'messages':_(_0x333d3c[_0x0a9e('0xe3')])[_0x0a9e('0x117')]()[_0x0a9e('0x87')]({'secret':![]})[_0x0a9e('0x42')](function(_0x1008a1){if(_0x1008a1[_0x0a9e('0xd3')]){var _0x6276a4=path[_0x0a9e('0xd7')](_0xd456e6,_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]);if(fs[_0x0a9e('0x118')](_0x6276a4)){fs['createReadStream'](_0x6276a4)[_0x0a9e('0x119')](fs[_0x0a9e('0x11a')](path[_0x0a9e('0xd7')](_0x4e03f5,_0x1008a1['Attachment'][_0x0a9e('0xda')])));}}return{'date':moment(_0x1008a1['createdAt'])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'sender':_0x1008a1[_0x0a9e('0xee')]===_0x0a9e('0xc8')?_0x1008a1[_0x0a9e('0x74')]?_0x1008a1[_0x0a9e('0x74')][_0x0a9e('0x31')]:'System':_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10a')]+(_0x1008a1['Contact'][_0x0a9e('0x10b')]?'\x20'+_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10b')]:''),'body':_0x1008a1['Attachment']?_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]:_0x1008a1[_0x0a9e('0x2c')],'direction':_0x1008a1[_0x0a9e('0xee')]==='out'?'A':'C','secret':_0x1008a1[_0x0a9e('0xef')],'read':_0x1008a1[_0x0a9e('0x84')],'attachment':_0x1008a1[_0x0a9e('0xd3')]};})[_0x0a9e('0x6b')]()};return ejs[_0x0a9e('0x11b')](path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'views',_0x0a9e('0x11c')),{'interaction':_0x2191c6})[_0x0a9e('0x14')](function(_0x38284a){var _0x54246a=path['join'](_0x4e03f5,_0x0a9e('0x11d')+_0x333d3c['id']+'-'+_0x2e0e9b+_0x0a9e('0x11e'));var _0x271485={'path':_0x54246a,'channel':_0x0a9e('0x10e'),'interactionId':_0x333d3c['id']};return pdf[_0x0a9e('0x11f')](_0x38284a,_0x271485);})[_0x0a9e('0x14')](function(){return new Promise(function(_0x312e02,_0x221274){zipdir(_0x4e03f5,{'saveTo':_0x1d046c},function(_0x54c9d6,_0x5cc8cb){if(_0x54c9d6)return _0x221274(_0x54c9d6);return _0x312e02(_0x5cc8cb);});})[_0x0a9e('0x14')](function(){return new BPromise(function(_0x5330c2,_0x803bc){rimraf(_0x4e03f5,function(_0xef29b6){if(_0xef29b6)_0x803bc(_0xef29b6);return _0x5330c2();});});})[_0x0a9e('0x14')](function(){return _0x1c0d54[_0x0a9e('0xdb')](_0x1d046c,_0x9c686f,function(_0x57b11b){if(_0x57b11b){logger[_0x0a9e('0x19')](_0x0a9e('0x120'),_0x57b11b);}else{fs['unlinkSync'](_0x1d046c);}});});});}else{return _0x1c0d54[_0x0a9e('0x1c')](0xc8);}})['catch'](handleError(_0x1c0d54,null));}; \ No newline at end of file +var _0xa9e0=['createPdfFromHTML','err','rimraf','zip-dir','request-promise','mustache','path','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','account','Users','fullname','Tags','TagIds','split','forEach','push','catch','waiting','answered','unmanaged','abandoned','closed','UserId','talking','disposition','total','index','map','ChatInteraction','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','select','field','from','u.fullname','user_has_chat_interactions','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','keys','compact','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','group','i.id','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','describe','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','attachmentUpload','file','originalname','filename','Attachment','Unauthorized','findOne','attachId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','hasOwnProperty','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','color','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x1f21bc,_0x4b89b8){var _0x115182=function(_0x366734){while(--_0x366734){_0x1f21bc['push'](_0x1f21bc['shift']());}};_0x115182(++_0x4b89b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var rimraf=require(_0x0a9e('0x0'));var zipdir=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x3'));var util=require('util');var path=require(_0x0a9e('0x4'));var ejs=require(_0x0a9e('0x5'));var fs=require('fs');var _=require(_0x0a9e('0x6'));var squel=require(_0x0a9e('0x7'));var Redis=require(_0x0a9e('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x0a9e('0x9'));var pdf=require(_0x0a9e('0xa'));var logger=require(_0x0a9e('0xb'))('api');var config=require('../../config/environment');var db=require(_0x0a9e('0xc'))['db'];config['redis']=_['defaults'](config[_0x0a9e('0xd')],{'host':_0x0a9e('0xe'),'port':0x18eb});var socket=require(_0x0a9e('0xf'))(new Redis(config[_0x0a9e('0xd')]));require(_0x0a9e('0x10'))[_0x0a9e('0x11')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0x0a9e('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x36471c,_0xd5b662,_0x26d672,_0x32d742){return new BPromise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_0x32d742||client;return _0x4283ce[_0x0a9e('0x13')](_0x36471c,_0x26d672)[_0x0a9e('0x14')](function(_0x281129){logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');logger[_0x0a9e('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xd5b662,_0x0a9e('0x18'),JSON['stringify'](_0x281129));if(_0x281129[_0x0a9e('0x19')]){if(_0x281129[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x5db4b0(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}logger[_0x0a9e('0x19')](_0x0a9e('0x16'),_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x69aeb7(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');_0x69aeb7(_0x281129[_0x0a9e('0x1b')][_0x0a9e('0x1a')]);}})['catch'](function(_0x20f109){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x20f109);_0x5db4b0(_0x20f109);});});}function respondWithStatusCode(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0xcc;return function(_0x38e7c4){if(_0x38e7c4){return _0x3a02e1[_0x0a9e('0x1c')](_0x432e56);}return _0x3a02e1['status'](_0x432e56)[_0x0a9e('0x1d')]();};}function respondWithResult(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xc8;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x1e')](_0x3b45bc)[_0x0a9e('0x1f')](_0x4d00e6);}};}function respondWithFilteredResult(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(_0x59181e){var _0x197ec0=typeof _0x5ea472[_0x0a9e('0x20')]===_0x0a9e('0x21')&&typeof _0x5ea472[_0x0a9e('0x22')]==='undefined';var _0x384319=_0x59181e['count'];var _0x45a1e7=_0x197ec0?0x0:_0x5ea472['offset'];var _0x1dc186=_0x197ec0?_0x59181e[_0x0a9e('0x23')]:_0x5ea472[_0x0a9e('0x20')]+_0x5ea472[_0x0a9e('0x22')];var _0x140511;if(_0x1dc186>=_0x384319){_0x1dc186=_0x384319;_0x140511=0xc8;}else{_0x140511=0xce;}_0x16b1ca[_0x0a9e('0x1e')](_0x140511);return _0x16b1ca[_0x0a9e('0x24')](_0x0a9e('0x25'),_0x45a1e7+'-'+_0x1dc186+'/'+_0x384319)['json'](_0x59181e);}return null;};}function saveUpdates(_0x3652a7){return function(_0x468813){if(_0x468813){return _0x468813[_0x0a9e('0x26')](_0x3652a7)[_0x0a9e('0x14')](function(_0x5c877d){return _0x5c877d;});}return null;};}function removeEntity(_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x27')]()[_0x0a9e('0x14')](function(){_0x15b200[_0x0a9e('0x1e')](0xcc)[_0x0a9e('0x1d')]();});}};}function handleEntityNotFound(_0x296f41){return function(_0x2e8759){if(!_0x2e8759){_0x296f41[_0x0a9e('0x1c')](0x194);}return _0x2e8759;};}function handleError(_0x540530,_0x426950){_0x426950=_0x426950||0x1f4;return function(_0x5d1e0e){logger[_0x0a9e('0x19')](_0x5d1e0e[_0x0a9e('0x28')]);if(_0x5d1e0e[_0x0a9e('0x29')]){delete _0x5d1e0e[_0x0a9e('0x29')];}_0x540530[_0x0a9e('0x1e')](_0x426950)['send'](_0x5d1e0e);};}function getMustacheRender(_0x66c1d2,_0x46f0a5){return Mustache[_0x0a9e('0x2a')](_0x66c1d2,_[_0x0a9e('0x2b')](_0x46f0a5[_0x0a9e('0x2c')],{'contact':_0x46f0a5[_0x0a9e('0x2d')],'message':_0x46f0a5[_0x0a9e('0x1a')],'agent':_0x46f0a5[_0x0a9e('0x2e')],'interaction':_0x46f0a5['interaction'],'account':_0x46f0a5[_0x0a9e('0x2f')]}))||'';}function getInteractionUsers(_0x5e7238,_0x2cc7a0){return new BPromise(function(_0x14b13f,_0x2b7e7f){try{if(_0x2cc7a0[_0x5e7238['id']]){_0x5e7238[_0x0a9e('0x30')]=_['map'](_0x2cc7a0[_0x5e7238['id']],function(_0x191e91){return{'id':_0x191e91['id'],'fullname':_0x191e91[_0x0a9e('0x31')]};});}}catch(_0x1fa90d){_0x2b7e7f(_0x1fa90d);}_0x14b13f(_0x5e7238);});}function getInteractionTags(_0x15de0e,_0x4853b1){return new BPromise(function(_0x54135e,_0x1e8694){try{if(_0x15de0e['TagIds']){_0x15de0e[_0x0a9e('0x32')]=[];_0x15de0e[_0x0a9e('0x33')][_0x0a9e('0x34')](',')[_0x0a9e('0x35')](function(_0x4f41ae){_0x15de0e[_0x0a9e('0x32')][_0x0a9e('0x36')](_0x4853b1[_0x4f41ae]);});}delete _0x15de0e[_0x0a9e('0x33')];}catch(_0x533942){_0x1e8694(_0x533942);}_0x54135e(_0x15de0e);});}function updateChatInteraction(_0x1dbf74,_0x1a180b,_0x289467){return new BPromise(function(_0x4c1c0e,_0x546ef8){return getInteractionUsers(_0x1dbf74,_0x289467)[_0x0a9e('0x14')](function(_0x40d766){return getInteractionTags(_0x40d766,_0x1a180b);})['then'](function(_0x2b814e){return getStateInteraction(_0x2b814e);})[_0x0a9e('0x14')](function(_0x2e1b3a){_0x4c1c0e(_0x2e1b3a);})[_0x0a9e('0x37')](function(_0x4b38d9){_0x546ef8(_0x4b38d9);});});}function getStateInteraction(_0x5a594b){return new BPromise(function(_0x15e37d){_0x5a594b[_0x0a9e('0x38')]=0x0;_0x5a594b['talking']=0x0;_0x5a594b[_0x0a9e('0x39')]=0x0;_0x5a594b[_0x0a9e('0x3a')]=0x0;_0x5a594b[_0x0a9e('0x3b')]=0x0;_0x5a594b['total']=0x0;if(!_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x38')]+=0x1;}if(!_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x3e')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3f')]===_0x0a9e('0x3b')){_0x5a594b[_0x0a9e('0x3b')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b['UserId']&&_0x5a594b['disposition']){_0x5a594b[_0x0a9e('0x3a')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x39')]+=0x1;if(_0x5a594b[_0x0a9e('0x3e')]){_0x5a594b[_0x0a9e('0x3e')]-=0x1;}}_0x5a594b[_0x0a9e('0x40')]+=0x1;_0x15e37d(_0x5a594b);});}exports[_0x0a9e('0x41')]=function(_0x2c2cb0,_0x35ed4a){var _0x5026aa={},_0x117c99={},_0x138b8b={'count':0x0,'rows':[]};var _0xdd268f=_[_0x0a9e('0x42')](db[_0x0a9e('0x43')][_0x0a9e('0x44')],function(_0x21eb86){return{'name':_0x21eb86[_0x0a9e('0x45')],'type':_0x21eb86['type'][_0x0a9e('0x46')]};});_0x117c99['model']=_[_0x0a9e('0x42')](_0xdd268f,_0x0a9e('0x29'));_0x117c99[_0x0a9e('0x47')]=_['keys'](_0x2c2cb0[_0x0a9e('0x47')]);_0x117c99[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x117c99[_0x0a9e('0x4a')],_0x117c99[_0x0a9e('0x47')]);_0x5026aa[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x117c99['model'],qs[_0x0a9e('0x4c')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x5026aa[_0x0a9e('0x4b')]=_0x5026aa[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x5026aa[_0x0a9e('0x4b')]:_0x117c99[_0x0a9e('0x4a')];if(!_0x2c2cb0[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x5026aa[_0x0a9e('0x22')]=qs['limit'](_0x2c2cb0['query']['limit']);_0x5026aa[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x5026aa[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x5026aa['where']=qs['filters'](_['pick'](_0x2c2cb0[_0x0a9e('0x47')],_0x117c99[_0x0a9e('0x48')]),_0xdd268f);var _0x14d602=[];var _0x5bb3ed=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('id')['field']('name')[_0x0a9e('0x52')]('color')[_0x0a9e('0x53')]('tools_tags');var _0x2e5e62=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('u.id')[_0x0a9e('0x52')](_0x0a9e('0x54'))['field']('ui.ChatInteractionId')[_0x0a9e('0x53')](_0x0a9e('0x55'),'ui')['left_join'](_0x0a9e('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x211ef9=squel['select']()[_0x0a9e('0x53')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x0a9e('0x57'))['left_join'](_0x0a9e('0x56'),'o',_0x0a9e('0x58'))[_0x0a9e('0x59')](_0x0a9e('0x5a'),'a',_0x0a9e('0x5b'))[_0x0a9e('0x59')](_0x0a9e('0x5c'),'me',_0x0a9e('0x5d'))['left_join'](_0x0a9e('0x5e'),'it',_0x0a9e('0x5f'))[_0x0a9e('0x59')](_0x0a9e('0x60'),'t',_0x0a9e('0x61'));var _0x156662=squel['expr']();var _0x956fbe=[];var _0x26bc80=squel['expr']();var _0x3649cc;if(_0x2c2cb0['query'][_0x0a9e('0x62')]){_0x3649cc=as['parseSearch'](_0x2c2cb0['query']['search']);var _0x273cb5=_0x3649cc['sqlOperator'];for(var _0x2244d6=0x0;_0x2244d6<_0x3649cc[_0x0a9e('0x63')][_0x0a9e('0x4d')];_0x2244d6++){var _0x7be420=_0x3649cc[_0x0a9e('0x63')][_0x2244d6];var _0x26d7db='i';var _0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x7be420[_0x0a9e('0x52')]]);if(!_0x49eed0){switch(_0x7be420[_0x0a9e('0x52')]){case _0x0a9e('0x65'):if(_0x7be420['value']==0x1){_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420[_0x0a9e('0x52')]+_0x0a9e('0x67'));}else{_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420['field']+_0x0a9e('0x68'));}break;case _0x0a9e('0x69'):if(_0x7be420['operator']===_0x0a9e('0x6a')){if(_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')]('\x20')[_0x0a9e('0x4d')]>0x1){_0x156662[_0x273cb5](_0x0a9e('0x6c'),qs['getFullTextValue'](_0x7be420[_0x0a9e('0x6b')]),null);}else{var _0x2937e0='%'+_0x7be420[_0x0a9e('0x6b')]+'%';_0x156662[_0x273cb5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2937e0,_0x2937e0,_0x2937e0);}}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name','ContactId']);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x6d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x72'):var _0x2e89b7=_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')](',')[_0x0a9e('0x42')](function(_0x320898){return Number(_0x320898);});_0x2e89b7[_0x0a9e('0x35')](function(_0x2a28c0){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x2a28c0+',%');});_0x956fbe=_['union'](_0x956fbe,_0x2e89b7);break;case _0x0a9e('0x74'):if(_0x7be420[_0x0a9e('0x75')]===_0x0a9e('0x6a')){_0x156662[_0x273cb5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x7be420[_0x0a9e('0x6b')]+'%',null);}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x0a9e('0x3d')]);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x3d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f['value']['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x2c'):_0x235f8f=as[_0x0a9e('0x6e')]('me',null,_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')]['end']);break;}}else{var _0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f[_0x0a9e('0x6b')]['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}}}else{var _0x4c46c1=_(_0x2c2cb0[_0x0a9e('0x47')])[_0x0a9e('0x76')]()[_0x0a9e('0x42')](function(_0x317c0c){return _['some'](_0xdd268f,[_0x0a9e('0x29'),_0x317c0c])?_0x317c0c:undefined;})[_0x0a9e('0x77')]()[_0x0a9e('0x6b')]();if(!_[_0x0a9e('0x78')](_0x4c46c1)){_0x4c46c1['forEach'](function(_0x109ccb){if(_0x109ccb===_0x0a9e('0x79')){_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),[]['concat'](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]));}else if(_0x109ccb===_0x0a9e('0x7c')){var _0x30a4c7=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7e')];var _0x40fc56=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7f')];_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x80'),_0x30a4c7,_0x40fc56);}else{if(_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]===_0x0a9e('0x81')){_0x211ef9['where']('i.'+_0x109ccb+_0x0a9e('0x82'));}else{_0x211ef9[_0x0a9e('0x7a')]('i.'+_0x109ccb+_0x0a9e('0x83'),_0x2c2cb0['query'][_0x109ccb]);}}});}if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]==0x1){_0x211ef9['having']('`unreadMessages`\x20=\x200');}else{_0x211ef9[_0x0a9e('0x66')](_0x0a9e('0x85'));}}if(_0x2c2cb0['query'][_0x0a9e('0x86')]){_0x956fbe=_['isArray'](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')])?_0x2c2cb0['query'][_0x0a9e('0x86')]:new Array(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')]);_0x956fbe[_0x0a9e('0x35')](function(_0x3755fe){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x3755fe+',%');});}if(_0x2c2cb0[_0x0a9e('0x47')]['filter']){var _0x2973d3=_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x87')][_0x0a9e('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0a9e('0x89')](_0x2973d3)){_0x156662['or'](_0x0a9e('0x8a'),_0x2973d3+'%');}else{_0x156662['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x8b')](_0x2973d3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2973d3+'%');}}}_0x211ef9[_0x0a9e('0x7a')](_0x156662);_0x211ef9[_0x0a9e('0x8c')](_0x0a9e('0x8d'));var _0x385d52={'type':db['Sequelize']['QueryTypes'][_0x0a9e('0x8e')],'raw':!![]};var _0x2b9c01=_0x211ef9[_0x0a9e('0x8f')]();_0x2b9c01['field'](_0x0a9e('0x8d'));_0x2b9c01[_0x0a9e('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5026aa[_0x0a9e('0x4f')]){_0x5026aa['order']['forEach'](function(_0x4dc6b3){var _0x81d748=_0x4dc6b3[0x0]===_0x0a9e('0x90')?_0x4dc6b3[0x0]:'i.'+_0x4dc6b3[0x0];_0x211ef9[_0x0a9e('0x4f')](_0x81d748,_0x4dc6b3[0x1]===_0x0a9e('0x91')?![]:!![]);});}if(!_[_0x0a9e('0x78')](_0x956fbe)){_0x211ef9[_0x0a9e('0x66')](_0x26bc80);_0x2b9c01['where'](_0x0a9e('0x92'),_0x956fbe);}BPromise['resolve']()[_0x0a9e('0x14')](function(){if(!_0x3649cc){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return;_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x93'));return;}if(_0x2c2cb0[_0x0a9e('0x94')]['role']!==_0x0a9e('0x2e'))return;return _0x2c2cb0[_0x0a9e('0x94')][_0x0a9e('0x95')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x14')](function(_0x255e49){if(_[_0x0a9e('0x78')](_0x255e49)){_0x2b9c01[_0x0a9e('0x7a')](_0x0a9e('0x96'));_0x211ef9['where'](_0x0a9e('0x96'));}else{_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0a9e('0x42')](_0x255e49,'id'));_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),_['map'](_0x255e49,'id'));}});})[_0x0a9e('0x14')](function(){if(_0x2c2cb0['user'][_0x0a9e('0x97')]===_0x0a9e('0x2e')&&!_0x3649cc&&!_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x2b9c01[_0x0a9e('0x99')](),_0x385d52);})[_0x0a9e('0x14')](function(_0x501050){_0x138b8b[_0x0a9e('0x23')]=_0x501050[_0x0a9e('0x4d')];if(_0x138b8b[_0x0a9e('0x23')]===0x0)return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x5bb3ed[_0x0a9e('0x99')](),_0x385d52)[_0x0a9e('0x14')](function(_0x33f0c9){_0x14d602=_[_0x0a9e('0x9a')](_0x33f0c9,'id');_0x385d52=_[_0x0a9e('0x2b')](_0x385d52,{'model':db[_0x0a9e('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5026aa['attributes'][_0x0a9e('0x35')](function(_0x23e2bd){_0x211ef9[_0x0a9e('0x52')]('i.'+_0x23e2bd);});}else{_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9b'),'unreadMessages');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9c'),'Account.key');_0x211ef9[_0x0a9e('0x52')]('a.mandatoryDisposition',_0x0a9e('0x9d'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9e'),_0x0a9e('0x90'));_0x211ef9['field'](_0x0a9e('0x9f'));_0x211ef9['field'](_0x0a9e('0xa0'),_0x0a9e('0xa1'));_0x211ef9['field'](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x211ef9[_0x0a9e('0x52')]('c.email','Contact.email');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x211ef9['field'](_0x0a9e('0xaa'),'Owner.fullname');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xab'),_0x0a9e('0xac'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xad'),'TagIds');}if(_0x5026aa[_0x0a9e('0x22')])_0x211ef9[_0x0a9e('0x22')](_0x5026aa[_0x0a9e('0x22')]);if(_0x5026aa[_0x0a9e('0x20')])_0x211ef9[_0x0a9e('0x20')](_0x5026aa['offset']);return db['sequelize'][_0x0a9e('0x47')](_0x211ef9['toString'](),_0x385d52);})[_0x0a9e('0x14')](function(_0x4658df){if(_0x4658df[_0x0a9e('0x4d')]>0x0)_0x2e5e62[_0x0a9e('0x7a')](_0x0a9e('0xae'),_[_0x0a9e('0x42')](_0x4658df,'id'));return db['sequelize']['query'](_0x2e5e62[_0x0a9e('0x99')](),_0x385d52)['then'](function(_0x2469d1){var _0x5c689c=_[_0x0a9e('0xaf')](_0x2469d1,'ChatInteractionId');var _0x558d60=[];_0x4658df[_0x0a9e('0x35')](function(_0xb8db59){_0x558d60['push'](updateChatInteraction(_0xb8db59,_0x14d602,_0x5c689c));});return BPromise[_0x0a9e('0xb0')](_0x558d60);});});})[_0x0a9e('0x14')](function(_0x15c6b9){_0x138b8b[_0x0a9e('0xb1')]=_0x15c6b9;return _0x138b8b;})[_0x0a9e('0x14')](respondWithFilteredResult(_0x35ed4a,_0x5026aa))['catch'](handleError(_0x35ed4a,null));};exports['show']=function(_0x16449b,_0x22286c){var _0x41c8cd={'raw':![],'where':{'id':_0x16449b[_0x0a9e('0xb2')]['id']}},_0x24beb6={};_0x24beb6['model']=_[_0x0a9e('0x76')](db[_0x0a9e('0x43')]['rawAttributes']);_0x24beb6[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x16449b[_0x0a9e('0x47')]);_0x24beb6[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],_0x24beb6[_0x0a9e('0x47')]);_0x41c8cd[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],qs['fields'](_0x16449b[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x41c8cd[_0x0a9e('0x4b')]=_0x41c8cd[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x41c8cd['attributes']:_0x24beb6['model'];if(_0x16449b[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x41c8cd[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x41c8cd=_[_0x0a9e('0x2b')]({},_0x41c8cd,_0x16449b[_0x0a9e('0xb5')]);return db['ChatInteraction'][_0x0a9e('0x64')](_0x41c8cd)[_0x0a9e('0x14')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x14')](respondWithResult(_0x22286c,null))['catch'](handleError(_0x22286c,null));};exports[_0x0a9e('0xb6')]=function(_0x59aa7b,_0x2144ca){return db['ChatInteraction'][_0x0a9e('0xb6')](_0x59aa7b[_0x0a9e('0x2c')],{})[_0x0a9e('0x14')](respondWithResult(_0x2144ca,0xc9))['catch'](handleError(_0x2144ca,null));};exports[_0x0a9e('0x26')]=function(_0x5ed560,_0x4383da){if(_0x5ed560[_0x0a9e('0x2c')]['id']){delete _0x5ed560[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x5ed560[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x14')](saveUpdates(_0x5ed560[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x4383da,null))[_0x0a9e('0x37')](handleError(_0x4383da,null));};exports[_0x0a9e('0x27')]=function(_0x2415fe,_0x399def){return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x2415fe['params']['id']}})['then'](handleEntityNotFound(_0x399def,null))[_0x0a9e('0x14')](removeEntity(_0x399def,null))['catch'](handleError(_0x399def,null));};exports[_0x0a9e('0xb7')]=function(_0x3428c9,_0x5d6b69){return db[_0x0a9e('0x43')][_0x0a9e('0xb7')]()[_0x0a9e('0x14')](respondWithResult(_0x5d6b69,null))[_0x0a9e('0x37')](handleError(_0x5d6b69,null));};exports['createVidaooSession']=function(_0x148fd9,_0x26cb76){var _0x374f0b=_0x148fd9[_0x0a9e('0xb2')]['id'];var _0x5d0e1f;var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x374f0b}})[_0x0a9e('0x14')](function(_0x270df8){_0x5d0e1f=_0x270df8;return db[_0x0a9e('0xb8')]['findOne']({'where':{'id':_0x270df8[_0x0a9e('0x79')]},'attributes':['id',_0x0a9e('0xb9'),_0x0a9e('0xba'),_0x0a9e('0xbb'),_0x0a9e('0xbc'),'vidaooMetadata'],'raw':!![]});})[_0x0a9e('0x14')](function(_0x289e65){if(_0x289e65&&_0x289e65['vidaooApiKey']&&_0x289e65[_0x0a9e('0xba')]){_0x19e9ed=_0x289e65;var _0x1fcfe6={'interaction':{'id':_0x374f0b},'agent':{'id':_0x148fd9[_0x0a9e('0x94')]['id'],'name':_0x148fd9['user']['name'],'fullname':_0x148fd9['user'][_0x0a9e('0x31')],'email':_0x148fd9[_0x0a9e('0x94')]['email']},'contact':_0x148fd9[_0x0a9e('0x2c')][_0x0a9e('0x2d')],'account':_0x148fd9[_0x0a9e('0x2c')]['account']};var _0x9fc93e={'rejectUnauthorized':![],'method':_0x0a9e('0xbd'),'url':_0x0a9e('0xbe'),'headers':{'X-APIKEY':_0x289e65[_0x0a9e('0xb9')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x148fd9[_0x0a9e('0x94')][_0x0a9e('0xbf')]],'buttons':null,'topic':_0x19e9ed[_0x0a9e('0xbb')],'note':_[_0x0a9e('0xc0')](_0x19e9ed[_0x0a9e('0xbc')])?null:getMustacheRender(_0x19e9ed['vidaooNote'],_0x1fcfe6),'metadata':null},'redirect':_0x0a9e('0xc1'),'json':!![]};try{if(!_['isNull'](_0x19e9ed[_0x0a9e('0xc2')])){var _0x4093e6=getMustacheRender(_0x19e9ed[_0x0a9e('0xc2')],_0x1fcfe6);var _0x3cf222=JSON[_0x0a9e('0x7d')](_0x4093e6);_0x9fc93e[_0x0a9e('0x2c')]['metadata']=_0x3cf222;}}catch(_0x1a0314){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))](_0x0a9e('0xc5'));}return rp(_0x9fc93e);}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xc6'));}})[_0x0a9e('0x14')](function(_0x1c9539){_0x1a0b08=_0x1c9539;if(_0x1a0b08['id']){var _0xc2e7b={'body':_0x1a0b08[_0x0a9e('0xc7')],'ChatWebsiteId':_0x19e9ed['id'],'ChatInteractionId':_0x5d0e1f['id'],'direction':_0x0a9e('0xc8'),'UserId':_0x148fd9[_0x0a9e('0x94')]['id']};return db[_0x0a9e('0xc9')][_0x0a9e('0xb6')](_0xc2e7b,{});}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xca'));}})[_0x0a9e('0x14')](function(){return _0x5d0e1f[_0x0a9e('0xcb')]({'vidaooSessionId':_0x1a0b08['id']});})[_0x0a9e('0x14')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x37')](handleError(_0x26cb76,null));};exports[_0x0a9e('0xcc')]=function(_0x20ae21,_0x566b90){if(_0x20ae21[_0x0a9e('0x2c')]['id']){delete _0x20ae21[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x20ae21[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69')}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x14')](saveUpdates(_0x20ae21[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x566b90,null))[_0x0a9e('0x37')](handleError(_0x566b90,null));};exports[_0x0a9e('0xce')]=function(_0x451010,_0x5a7dad){if(_0x451010[_0x0a9e('0x2c')]['id']){delete _0x451010[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x451010[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](function(_0x5cb48d){if(!_0x5cb48d){logger[_0x0a9e('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x5a7dad[_0x0a9e('0x1c')](0x194);}else{if(_0x5cb48d[_0x0a9e('0x3d')]){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))]('Interaction\x20already\x20assigned');}}return _0x5cb48d;})[_0x0a9e('0x14')](function(_0x309fa9){if(_0x309fa9){return _0x309fa9[_0x0a9e('0x26')]({'closed':_0x451010[_0x0a9e('0x2c')][_0x0a9e('0x3c')],'disposition':_0x451010['body']['disposition']})[_0x0a9e('0x14')](function(_0x33bcb2){return _0x33bcb2;});}})[_0x0a9e('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0x0a9e('0xce'),_0x451010[_0x0a9e('0x2c')],client9004);})[_0x0a9e('0x14')](respondWithResult(_0x5a7dad,null))['catch'](handleError(_0x5a7dad,null));};exports[_0x0a9e('0xcf')]=function(_0x2bf85d,_0x15ba6b){_0x2bf85d['body'][_0x0a9e('0x29')]=_0x2bf85d[_0x0a9e('0xd0')][_0x0a9e('0xd1')];_0x2bf85d['body']['basename']=_0x2bf85d['file'][_0x0a9e('0xd2')];_0x2bf85d[_0x0a9e('0x2c')][_0x0a9e('0x6f')]=_0x2bf85d[_0x0a9e('0xd0')]['mimetype'];return db[_0x0a9e('0xd3')]['create'](_0x2bf85d[_0x0a9e('0x2c')])[_0x0a9e('0x14')](respondWithResult(_0x15ba6b,0xc9))[_0x0a9e('0x37')](handleError(_0x15ba6b,null));};exports['attachmentDownload']=function(_0x33b4b3,_0x33a26c){return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x33b4b3[_0x0a9e('0xb2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x33a26c,null))[_0x0a9e('0x14')](function(_0x5c57e1){if(_0x5c57e1){if(_0x5c57e1[_0x0a9e('0x3c')]){return _0x33a26c['status'](0x193)[_0x0a9e('0x1f')]({'status':0x193,'message':_0x0a9e('0xd4')});}return db[_0x0a9e('0xd3')][_0x0a9e('0xd5')]({'where':{'id':_0x33b4b3[_0x0a9e('0x47')][_0x0a9e('0xd6')]},'raw':!![]})[_0x0a9e('0x14')](handleEntityNotFound(_0x33a26c,null));}})['then'](function(_0x35ace3){if(_0x35ace3){var _0x1c9ea2=_0x35ace3['ChatOfflineMessageId']!==null;var _0xf4fb77=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0xd8'));if(_0x1c9ea2){_0xf4fb77=path[_0x0a9e('0xd7')](_0xf4fb77,_0x0a9e('0xd9'));}var _0x569528=path[_0x0a9e('0xd7')](_0xf4fb77,_0x35ace3[_0x0a9e('0xda')]);return _0x33a26c[_0x0a9e('0xdb')](_0x569528);}})[_0x0a9e('0x37')](handleError(_0x33a26c,null));};exports[_0x0a9e('0xdc')]=function(_0x29fdfe,_0x3ba897){var _0x74d9b8=null;var _0x22767f=null;var _0x426c3c=null;if(_0x29fdfe['body']['id']){delete _0x29fdfe[_0x0a9e('0x2c')]['id'];}if(_0x29fdfe['body'][_0x0a9e('0xdd')]){_0x426c3c=path[_0x0a9e('0xd7')](config[_0x0a9e('0xde')],_0x0a9e('0xdf'),util[_0x0a9e('0xe0')](_0x0a9e('0xe1'),Date['now']()));_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe2')]=_0x426c3c;}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x29fdfe[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xc9')],'as':_0x0a9e('0xe3'),'include':[{'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74')}]}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x3ba897,null))[_0x0a9e('0x14')](saveUpdates(_0x29fdfe['body'],null))[_0x0a9e('0x14')](function(_0x228c10){if(_0x228c10){_0x74d9b8=_0x228c10;return db[_0x0a9e('0xb8')][_0x0a9e('0x64')]({'where':{'id':_0x74d9b8[_0x0a9e('0x79')]}});}})[_0x0a9e('0x14')](function(_0x8120e){if(_0x8120e){_0x22767f=_0x8120e;return db['CmContact']['find']({'where':{'id':_0x74d9b8[_0x0a9e('0x6d')]}});}})[_0x0a9e('0x14')](function(_0x1f4929){if(_0x1f4929){if(_0x426c3c){var _0x1bf692=null;for(var _0x40e2da=0x1;_0x40e2da<_0x74d9b8[_0x0a9e('0xe3')][_0x0a9e('0x4d')];++_0x40e2da){_0x1bf692=_0x74d9b8['Messages'][_0x40e2da];var _0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');var _0x54f0b8=_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe7')]||util[_0x0a9e('0xe0')]('%s%d',_0x0a9e('0xe8'),_0x1bf692[_0x0a9e('0x6d')]);switch(_0x22767f[_0x0a9e('0xe9')]){case _0x0a9e('0xea'):_0x39ea62=_0x1bf692['UserId']?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');break;case _0x0a9e('0xeb'):_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?_0x1bf692[_0x0a9e('0x74')]['alias']||_0x1bf692[_0x0a9e('0x74')][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;case _0x0a9e('0xec'):_0x39ea62=_0x1bf692['UserId']?_0x1bf692['User'][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;default:_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util['format'](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692['UserId']):_0x0a9e('0xe6');}var _0x5d19b1=util[_0x0a9e('0xe0')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1bf692['createdAt'])['format'](_0x0a9e('0xed')),_0x1bf692[_0x0a9e('0xee')]==='in'?_0x54f0b8:_0x39ea62,_0x1bf692[_0x0a9e('0x2c')]);if(!_0x1bf692[_0x0a9e('0xef')]){fs[_0x0a9e('0xf0')](_0x426c3c,_0x5d19b1);}}return db[_0x0a9e('0xf1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xf2')],'as':_0x0a9e('0xf3'),'raw':!![],'include':[{'model':db[_0x0a9e('0xf4')],'as':_0x0a9e('0xf4'),'raw':!![]}]}]});}}})[_0x0a9e('0x14')](function(_0x18dccf){if(!_0x18dccf||!_0x18dccf[_0x0a9e('0xf3')]||!_0x29fdfe['body'])return _0x74d9b8;var _0x49baaa=_0x18dccf[_0x0a9e('0xf5')]();return respondWithRpcPromise('SendMail',_0x0a9e('0xf6'),{'account':_0x49baaa,'message':{'from':util[_0x0a9e('0xe0')](_0x0a9e('0xf7'),_0x18dccf[_0x0a9e('0x29')],_0x18dccf[_0x0a9e('0xbf')]||_0x18dccf[_0x0a9e('0xf3')]['user']),'to':_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x0a9e('0xe0')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript']),'attachments':[{'path':_0x426c3c}]}})['then'](function(){return _0x74d9b8;})[_0x0a9e('0x37')](function(_0x4a7a3c){logger[_0x0a9e('0x19')](_0x4a7a3c);});})[_0x0a9e('0x14')](respondWithStatusCode(_0x3ba897,0xc8))[_0x0a9e('0x37')](handleError(_0x3ba897,null));};exports['addMessage']=function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0xc9')]['find']({'where':{'id':_0x4152cd['params']['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1209c4,null))[_0x0a9e('0x14')](function(_0x89d2cb){if(_0x89d2cb){return _0x89d2cb[_0x0a9e('0xf8')](_0x4152cd[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x4152cd[_0x0a9e('0x2c')],[_0x0a9e('0xf9'),'id'])||{});}})[_0x0a9e('0x14')](respondWithResult(_0x1209c4,null))['catch'](handleError(_0x1209c4,null));};exports['getMessages']=function(_0x558171,_0x5975fa){var _0x19dcc2={'raw':![],'where':{}};var _0x2ce30f={};var _0x2d21c7={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x558171[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5975fa,null))['then'](function(_0x5c3ecf){if(_0x5c3ecf){_0x2ce30f[_0x0a9e('0x4a')]=_[_0x0a9e('0x76')](db['ChatMessage'][_0x0a9e('0x44')]);_0x2ce30f[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x558171[_0x0a9e('0x47')]);_0x2ce30f[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],_0x2ce30f[_0x0a9e('0x47')]);_0x19dcc2[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x558171['query'][_0x0a9e('0x4c')]));_0x19dcc2[_0x0a9e('0x4b')]=_0x19dcc2[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x19dcc2[_0x0a9e('0x4b')]:_0x2ce30f[_0x0a9e('0x4a')];if(!_0x558171[_0x0a9e('0x47')][_0x0a9e('0xfb')](_0x0a9e('0x4e'))){_0x19dcc2[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x558171[_0x0a9e('0x47')]['limit']);_0x19dcc2['offset']=qs[_0x0a9e('0x20')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x19dcc2[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x19dcc2['where']=qs[_0x0a9e('0x48')](_['pick'](_0x558171[_0x0a9e('0x47')],_0x2ce30f[_0x0a9e('0x48')]));_0x19dcc2[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x5c3ecf['id'];if(_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x19dcc2[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x19dcc2[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x19dcc2[_0x0a9e('0x4b')],function(_0x8231e5){var _0x43111e={};_0x43111e[_0x8231e5]={'$like':'%'+_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x43111e;})});}if(_0x558171[_0x0a9e('0x47')]['$gte']){var _0x54cf62=_0x558171[_0x0a9e('0x47')][_0x0a9e('0x7e')]['split'](',');var _0x5500de={};_0x5500de[_0x54cf62[0x0]]={'$gte':moment(_0x54cf62[0x1])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))};_0x19dcc2[_0x0a9e('0x7a')]=_['merge'](_0x19dcc2[_0x0a9e('0x7a')],_0x5500de);}_0x19dcc2=_['merge']({},_0x19dcc2,_0x558171[_0x0a9e('0xb5')]);return db['ChatMessage'][_0x0a9e('0x23')]({'where':_0x19dcc2['where']})[_0x0a9e('0x14')](function(_0x21e210){_0x2d21c7[_0x0a9e('0x23')]=_0x21e210;if(_0x558171['query'][_0x0a9e('0xb3')]){_0x19dcc2['include']=[{'all':!![]}];}return db['ChatMessage'][_0x0a9e('0xfe')](_0x19dcc2);})[_0x0a9e('0x14')](function(_0x3c691f){_0x2d21c7[_0x0a9e('0xb1')]=_0x3c691f;return _0x2d21c7;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x5975fa,_0x19dcc2))[_0x0a9e('0x37')](handleError(_0x5975fa,null));};exports[_0x0a9e('0xff')]=function(_0x82504f,_0x1a3143){var _0x151f16={'where':{}},_0xd6938={},_0x98bf26={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x82504f[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1a3143,null))[_0x0a9e('0x14')](function(_0x643f66){if(_0x643f66){_0xd6938[_0x0a9e('0x4a')]=_['keys'](db[_0x0a9e('0xc9')][_0x0a9e('0x44')]);_0xd6938[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x82504f['query']);_0xd6938['filters']=_['intersection'](_0xd6938[_0x0a9e('0x4a')],_0xd6938['query']);_0x151f16[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0xd6938[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x151f16[_0x0a9e('0x4b')]=_0x151f16[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x151f16[_0x0a9e('0x4b')]:_0xd6938['model'];if(!_0x82504f[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x151f16['limit']=qs[_0x0a9e('0x22')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x22')]);_0x151f16['offset']=qs[_0x0a9e('0x20')](_0x82504f[_0x0a9e('0x47')]['offset']);}_0x151f16['order']=qs[_0x0a9e('0x50')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x151f16['where']=qs['filters'](_['pick'](_0x82504f[_0x0a9e('0x47')],_0xd6938[_0x0a9e('0x48')]));_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x643f66['id'];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x151f16[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x151f16[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x151f16[_0x0a9e('0x4b')],function(_0x2f4de1){var _0x13215c={};_0x13215c[_0x2f4de1]={'$like':'%'+_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x13215c;})});}_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xef')]=![];if(_0x82504f[_0x0a9e('0x47')]['id']){_0x151f16['where']['id']={'$gt':_0x82504f[_0x0a9e('0x47')]['id']};}_0x151f16=_[_0x0a9e('0x2b')]({},_0x151f16,_0x82504f[_0x0a9e('0xb5')]);return db[_0x0a9e('0xc9')][_0x0a9e('0x23')]({'where':_0x151f16[_0x0a9e('0x7a')]})['then'](function(_0x4739ed){_0x98bf26[_0x0a9e('0x23')]=_0x4739ed;_0x151f16[_0x0a9e('0xb4')]=[];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x100')]){_0x151f16[_0x0a9e('0xb4')][_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id','fullname','alias']});}if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x151f16['include']=[{'all':!![]}];}return db[_0x0a9e('0xc9')][_0x0a9e('0xfe')](_0x151f16);})['then'](function(_0x1ca7c8){_0x98bf26['rows']=_0x1ca7c8;return _0x98bf26;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x1a3143,_0x151f16))[_0x0a9e('0x37')](handleError(_0x1a3143,null));};exports['addTags']=function(_0x27a41c,_0x31ab12){return db['ChatInteraction'][_0x0a9e('0x64')]({'where':{'id':_0x27a41c[_0x0a9e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x31ab12,null))[_0x0a9e('0x14')](function(_0x237994){if(_0x237994){return _0x237994[_0x0a9e('0x101')](_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x27a41c['body'],[_0x0a9e('0xf9'),'id'])||{})[_0x0a9e('0x102')](function(){return db['Tag'][_0x0a9e('0xfe')]({'attributes':['id',_0x0a9e('0x29'),_0x0a9e('0x103')],'where':{'id':_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')]}});})[_0x0a9e('0x14')](function(_0x368a12){socket['emit']('chatInteractionTags:save',{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]});return{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]};});}})['then'](respondWithResult(_0x31ab12,null))[_0x0a9e('0x37')](handleError(_0x31ab12,null));};exports[_0x0a9e('0x104')]=function(_0x556344,_0x5c23aa){return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x556344[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5c23aa,null))[_0x0a9e('0x14')](function(_0x175c97){if(_0x175c97){return _0x175c97[_0x0a9e('0x104')](_0x556344[_0x0a9e('0x47')]['ids']);}})[_0x0a9e('0x14')](respondWithStatusCode(_0x5c23aa,null))[_0x0a9e('0x37')](handleError(_0x5c23aa,null));};exports['download']=function(_0x44cdb8,_0x1c0d54){var _0x2e0e9b=moment()[_0x0a9e('0x105')]()[_0x0a9e('0x99')]();var _0x2f1cc0=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0x106'),'files',_0x0a9e('0x107'));var _0xd456e6=path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'files',_0x0a9e('0x108'));var _0x4e03f5=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x2e0e9b);var _0x9c686f=util['format'](_0x0a9e('0x109'),_0x44cdb8['params']['id'],_0x2e0e9b);var _0x1d046c=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x9c686f);var _0x732141=[];_0x732141[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id',_0x0a9e('0x31')],'raw':!![]});_0x732141['push']({'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69'),'attributes':['id',_0x0a9e('0x10a'),_0x0a9e('0x10b')],'raw':!![]});if(_0x44cdb8[_0x0a9e('0x47')]['attachments']){_0x732141[_0x0a9e('0x36')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3a459c=[{'model':db['ChatMessage'],'as':_0x0a9e('0xe3'),'attributes':['id',_0x0a9e('0x2c'),'createdAt',_0x0a9e('0xee'),_0x0a9e('0xef'),_0x0a9e('0x84')],'include':_0x732141}];_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0xb8')],'as':_0x0a9e('0x10c'),'attributes':['id',_0x0a9e('0x29')]});_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':'Owner','attributes':['id',_0x0a9e('0x31')]});return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x44cdb8[_0x0a9e('0xb2')]['id']},'include':_0x3a459c})['then'](handleEntityNotFound(_0x1c0d54,null))[_0x0a9e('0x14')](function(_0x439f25){if(_0x439f25){var _0x333d3c=_0x439f25['get']({'plain':!![]});fs[_0x0a9e('0x10d')](_0x4e03f5);var _0x2191c6={'channel':_0x0a9e('0x10e'),'account':_0x333d3c['Account'][_0x0a9e('0x29')],'agent':_0x333d3c['Owner']?_0x333d3c[_0x0a9e('0x10f')][_0x0a9e('0x31')]:_0x0a9e('0x110'),'createdAt':moment(_0x333d3c[_0x0a9e('0x7c')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'closedAt':_0x333d3c['closed']?moment(_0x333d3c[_0x0a9e('0x111')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')]():'','disposition':_0x333d3c[_0x0a9e('0x3f')],'chatInfo':{'browser':_0x333d3c[_0x0a9e('0x112')],'os':_0x333d3c[_0x0a9e('0x113')],'referer':_0x333d3c[_0x0a9e('0x114')],'customerIp':_0x333d3c[_0x0a9e('0x115')],'customerPort':_0x333d3c[_0x0a9e('0x116')]?_0x333d3c[_0x0a9e('0x116')]:_0x0a9e('0x110')},'messages':_(_0x333d3c[_0x0a9e('0xe3')])[_0x0a9e('0x117')]()[_0x0a9e('0x87')]({'secret':![]})[_0x0a9e('0x42')](function(_0x1008a1){if(_0x1008a1[_0x0a9e('0xd3')]){var _0x6276a4=path[_0x0a9e('0xd7')](_0xd456e6,_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]);if(fs[_0x0a9e('0x118')](_0x6276a4)){fs['createReadStream'](_0x6276a4)[_0x0a9e('0x119')](fs[_0x0a9e('0x11a')](path[_0x0a9e('0xd7')](_0x4e03f5,_0x1008a1['Attachment'][_0x0a9e('0xda')])));}}return{'date':moment(_0x1008a1['createdAt'])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'sender':_0x1008a1[_0x0a9e('0xee')]===_0x0a9e('0xc8')?_0x1008a1[_0x0a9e('0x74')]?_0x1008a1[_0x0a9e('0x74')][_0x0a9e('0x31')]:'System':_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10a')]+(_0x1008a1['Contact'][_0x0a9e('0x10b')]?'\x20'+_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10b')]:''),'body':_0x1008a1['Attachment']?_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]:_0x1008a1[_0x0a9e('0x2c')],'direction':_0x1008a1[_0x0a9e('0xee')]==='out'?'A':'C','secret':_0x1008a1[_0x0a9e('0xef')],'read':_0x1008a1[_0x0a9e('0x84')],'attachment':_0x1008a1[_0x0a9e('0xd3')]};})[_0x0a9e('0x6b')]()};return ejs[_0x0a9e('0x11b')](path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'views',_0x0a9e('0x11c')),{'interaction':_0x2191c6})[_0x0a9e('0x14')](function(_0x38284a){var _0x54246a=path['join'](_0x4e03f5,_0x0a9e('0x11d')+_0x333d3c['id']+'-'+_0x2e0e9b+_0x0a9e('0x11e'));var _0x271485={'path':_0x54246a,'channel':_0x0a9e('0x10e'),'interactionId':_0x333d3c['id']};return pdf[_0x0a9e('0x11f')](_0x38284a,_0x271485);})[_0x0a9e('0x14')](function(){return new Promise(function(_0x312e02,_0x221274){zipdir(_0x4e03f5,{'saveTo':_0x1d046c},function(_0x54c9d6,_0x5cc8cb){if(_0x54c9d6)return _0x221274(_0x54c9d6);return _0x312e02(_0x5cc8cb);});})[_0x0a9e('0x14')](function(){return new BPromise(function(_0x5330c2,_0x803bc){rimraf(_0x4e03f5,function(_0xef29b6){if(_0xef29b6)_0x803bc(_0xef29b6);return _0x5330c2();});});})[_0x0a9e('0x14')](function(){return _0x1c0d54[_0x0a9e('0xdb')](_0x1d046c,_0x9c686f,function(_0x57b11b){if(_0x57b11b){logger[_0x0a9e('0x19')](_0x0a9e('0x120'),_0x57b11b);}else{fs['unlinkSync'](_0x1d046c);}});});});}else{return _0x1c0d54[_0x0a9e('0x1c')](0xc8);}})['catch'](handleError(_0x1c0d54,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 622da66..0362169 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 _0x5066=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5066,0x116));var _0x6506=function(_0x28e502,_0x3e36c5){_0x28e502=_0x28e502-0x0;var _0x2fd662=_0x5066[_0x28e502];return _0x2fd662;};'use strict';var EventEmitter=require(_0x6506('0x0'));var ChatInteraction=require(_0x6506('0x1'))['db'][_0x6506('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x6506('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6506('0x4'),'afterDestroy':_0x6506('0x5')};function emitEvent(_0x3b4709){return function(_0x5e3192,_0x1a884f,_0x346b40){_0x5e3192['getUsers']({'attributes':['id'],'raw':!![]})[_0x6506('0x6')](function(_0x280733){_0x5e3192[_0x6506('0x7')](_0x6506('0x8'),_0x280733[_0x6506('0x9')](function(_0x5e934f){return{'id':_0x5e934f['id']};}));return ChatMessage[_0x6506('0xa')]({'where':{'ChatInteractionId':_0x5e3192['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2412df){_0x5e3192['setDataValue'](_0x6506('0xb'),_0x2412df['length']);ChatInteractionEvents[_0x6506('0xc')](_0x3b4709+':'+_0x5e3192['id'],_0x5e3192);ChatInteractionEvents[_0x6506('0xc')](_0x3b4709,_0x5e3192);_0x346b40(null);})[_0x6506('0xd')](_0x346b40(null));};}for(var e in events){if(events[_0x6506('0xe')](e)){var event=events[e];ChatInteraction[_0x6506('0xf')](e,emitEvent(event));}}module[_0x6506('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x86b3=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x5a6474,_0x4678e1){var _0x485021=function(_0x24dffd){while(--_0x24dffd){_0x5a6474['push'](_0x5a6474['shift']());}};_0x485021(++_0x4678e1);}(_0x86b3,0xc5));var _0x386b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x86b3[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x386b('0x0'));var ChatInteraction=require(_0x386b('0x1'))['db'][_0x386b('0x2')];var ChatMessage=require(_0x386b('0x1'))['db'][_0x386b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x386b('0x4')](0x0);var events={'afterCreate':_0x386b('0x5'),'afterUpdate':_0x386b('0x6'),'afterDestroy':_0x386b('0x7')};function emitEvent(_0x186701){return function(_0x3d2431,_0x476b3b,_0x51972d){_0x3d2431[_0x386b('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f653d){_0x3d2431[_0x386b('0x9')]('Users',_0x3f653d[_0x386b('0xa')](function(_0x18922b){return{'id':_0x18922b['id']};}));return ChatMessage[_0x386b('0xb')]({'where':{'ChatInteractionId':_0x3d2431['id'],'direction':'in','read':![]},'raw':!![]});})[_0x386b('0xc')](function(_0x39b255){_0x3d2431[_0x386b('0x9')]('unreadMessages',_0x39b255[_0x386b('0xd')]);ChatInteractionEvents[_0x386b('0xe')](_0x186701+':'+_0x3d2431['id'],_0x3d2431);ChatInteractionEvents[_0x386b('0xe')](_0x186701,_0x3d2431);_0x51972d(null);})[_0x386b('0xf')](_0x51972d(null));};}for(var e in events){if(events[_0x386b('0x10')](e)){var event=events[e];ChatInteraction[_0x386b('0x11')](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 7bebe39..f48168e 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 _0x978b=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closedAt','format','utf8mb4','utf8mb4_unicode_ci'];(function(_0x233c32,_0x3bdb3e){var _0x316ec6=function(_0x2e889d){while(--_0x2e889d){_0x233c32['push'](_0x233c32['shift']());}};_0x316ec6(++_0x3bdb3e);}(_0x978b,0xe0));var _0xb978=function(_0x22b085,_0x558e12){_0x22b085=_0x22b085-0x0;var _0x31bb92=_0x978b[_0x22b085];return _0x31bb92;};'use strict';var _=require(_0xb978('0x0'));var util=require('util');var logger=require(_0xb978('0x1'))('api');var moment=require(_0xb978('0x2'));var BPromise=require(_0xb978('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb978('0x4'));var rimraf=require(_0xb978('0x5'));var config=require(_0xb978('0x6'));var attributes=require(_0xb978('0x7'));module[_0xb978('0x8')]=function(_0x37215b,_0x3dfba2){return _0x37215b[_0xb978('0x9')]('ChatInteraction',attributes,{'tableName':_0xb978('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d101d,_0x355d02,_0x5f229b){if(_0x2d101d[_0xb978('0xb')]('closed')){_0x2d101d[_0xb978('0xc')]=moment()[_0xb978('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5f229b(null,_0x2d101d);}},'charset':_0xb978('0xe'),'collate':_0xb978('0xf')});}; \ No newline at end of file +var _0xd8eb=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd8eb,0x11b));var _0xbd8e=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xd8eb[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0xbd8e('0x0'));var util=require(_0xbd8e('0x1'));var logger=require(_0xbd8e('0x2'))(_0xbd8e('0x3'));var moment=require(_0xbd8e('0x4'));var BPromise=require(_0xbd8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8e('0x6'));var rimraf=require(_0xbd8e('0x7'));var config=require(_0xbd8e('0x8'));var attributes=require(_0xbd8e('0x9'));module[_0xbd8e('0xa')]=function(_0x5be2b7,_0x36f891){return _0x5be2b7[_0xbd8e('0xb')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a3bf4,_0x4d08dc,_0x271da6){if(_0x5a3bf4[_0xbd8e('0xc')]('closed')){_0x5a3bf4['closedAt']=moment()[_0xbd8e('0xd')](_0xbd8e('0xe'));}_0x271da6(null,_0x5a3bf4);}},'charset':_0xbd8e('0xf'),'collate':_0xbd8e('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2e54e01..40868f7 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 _0xc8b9=['attributes','limit','AddTagsToChatInteraction','ChatInteraction','where','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','update','body','options','raw'];(function(_0x4f36a6,_0x9f224d){var _0x1f8a94=function(_0xb3ab2e){while(--_0xb3ab2e){_0x4f36a6['push'](_0x4f36a6['shift']());}};_0x1f8a94(++_0x9f224d);}(_0xc8b9,0x1ae));var _0x9c8b=function(_0x15b56a,_0x567846){_0x15b56a=_0x15b56a-0x0;var _0x5a6617=_0xc8b9[_0x15b56a];return _0x5a6617;};'use strict';var _=require(_0x9c8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c8b('0x1'));var rs=require(_0x9c8b('0x2'));var fs=require('fs');var Redis=require(_0x9c8b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c8b('0x4'));var logger=require(_0x9c8b('0x5'))('rpc');var config=require(_0x9c8b('0x6'));var jayson=require(_0x9c8b('0x7'));var client=jayson[_0x9c8b('0x8')][_0x9c8b('0x9')]({'port':0x232a});config[_0x9c8b('0xa')]=_['defaults'](config[_0x9c8b('0xa')],{'host':_0x9c8b('0xb'),'port':0x18eb});var socket=require(_0x9c8b('0xc'))(new Redis(config[_0x9c8b('0xa')]));require(_0x9c8b('0xd'))[_0x9c8b('0xe')](socket);function respondWithRpcPromise(_0x3774df,_0x2aee8a,_0x174270){return new BPromise(function(_0x226c24,_0x35e307){return client[_0x9c8b('0xf')](_0x3774df,_0x174270)[_0x9c8b('0x10')](function(_0x1895a4){logger[_0x9c8b('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x2aee8a,_0x9c8b('0x12'));logger[_0x9c8b('0x13')](_0x9c8b('0x14'),_0x2aee8a,'request\x20sent',JSON[_0x9c8b('0x15')](_0x1895a4));if(_0x1895a4[_0x9c8b('0x16')]){if(_0x1895a4[_0x9c8b('0x16')]['code']===0x1f4){logger[_0x9c8b('0x16')](_0x9c8b('0x17'),_0x2aee8a,_0x1895a4['error']['message']);return _0x35e307(_0x1895a4['error'][_0x9c8b('0x18')]);}logger[_0x9c8b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2aee8a,_0x1895a4[_0x9c8b('0x16')][_0x9c8b('0x18')]);return _0x226c24(_0x1895a4['error']['message']);}else{logger[_0x9c8b('0x11')](_0x9c8b('0x17'),_0x2aee8a,'request\x20sent');_0x226c24(_0x1895a4[_0x9c8b('0x19')]['message']);}})[_0x9c8b('0x1a')](function(_0x51b266){logger[_0x9c8b('0x16')](_0x9c8b('0x17'),_0x2aee8a,_0x51b266);_0x35e307(_0x51b266);});});}exports[_0x9c8b('0x1b')]=function(_0x20a600){var _0x2af727=this;return new Promise(function(_0x1f9af3,_0x4e1b48){return db['ChatInteraction'][_0x9c8b('0x1c')](_0x20a600[_0x9c8b('0x1d')],{'raw':_0x20a600[_0x9c8b('0x1e')]?_0x20a600[_0x9c8b('0x1e')][_0x9c8b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20a600[_0x9c8b('0x1e')]?_0x20a600[_0x9c8b('0x1e')]['where']||null:null,'attributes':_0x20a600[_0x9c8b('0x1e')]?_0x20a600[_0x9c8b('0x1e')][_0x9c8b('0x20')]||null:null,'limit':_0x20a600['options']?_0x20a600['options'][_0x9c8b('0x21')]||null:null})[_0x9c8b('0x10')](function(_0x40b4e1){logger['info'](_0x9c8b('0x1b'),_0x20a600);logger['debug']('UpdateChatInteraction',_0x20a600,JSON[_0x9c8b('0x15')](_0x40b4e1));_0x1f9af3(_0x40b4e1);})['catch'](function(_0x394c44){logger[_0x9c8b('0x16')](_0x9c8b('0x1b'),_0x394c44[_0x9c8b('0x18')],_0x20a600);_0x4e1b48(_0x2af727[_0x9c8b('0x16')](0x1f4,_0x394c44[_0x9c8b('0x18')]));});});};exports[_0x9c8b('0x22')]=function(_0x55a6c2){return new Promise(function(_0x102985,_0x2d499d){return db[_0x9c8b('0x23')]['find']({'where':_0x55a6c2[_0x9c8b('0x1e')]?_0x55a6c2[_0x9c8b('0x1e')][_0x9c8b('0x24')]||null:null})[_0x9c8b('0x10')](function(_0x942d45){if(_0x942d45){return _0x942d45[_0x9c8b('0x25')](_0x55a6c2['body'][_0x9c8b('0x26')],_[_0x9c8b('0x27')](_0x55a6c2[_0x9c8b('0x1d')],[_0x9c8b('0x26'),'id'])||{});}})[_0x9c8b('0x28')](function(_0x11ea7e){logger[_0x9c8b('0x11')](_0x9c8b('0x29'),_0x55a6c2);logger[_0x9c8b('0x13')](_0x9c8b('0x29'),_0x55a6c2,JSON[_0x9c8b('0x15')](_0x11ea7e));_0x102985(_0x11ea7e);})[_0x9c8b('0x1a')](function(_0x274b05){logger[_0x9c8b('0x16')]('AddTags',_0x274b05[_0x9c8b('0x18')],_0x55a6c2);_0x2d499d(_this[_0x9c8b('0x16')](0x1f4,_0x274b05[_0x9c8b('0x18')]));});});}; \ No newline at end of file +var _0x2c9f=['error','code','message','catch','UpdateChatInteraction','update','raw','options','attributes','limit','ChatInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x2c9f,0x1c9));var _0xf2c9=function(_0x11d44b,_0x1c8de0){_0x11d44b=_0x11d44b-0x0;var _0x7af8aa=_0x2c9f[_0x11d44b];return _0x7af8aa;};'use strict';var _=require(_0xf2c9('0x0'));var util=require(_0xf2c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf2c9('0x2'));var fs=require('fs');var Redis=require(_0xf2c9('0x3'));var db=require(_0xf2c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2c9('0x5'))(_0xf2c9('0x6'));var config=require(_0xf2c9('0x7'));var jayson=require(_0xf2c9('0x8'));var client=jayson[_0xf2c9('0x9')]['http']({'port':0x232a});config[_0xf2c9('0xa')]=_[_0xf2c9('0xb')](config[_0xf2c9('0xa')],{'host':_0xf2c9('0xc'),'port':0x18eb});var socket=require(_0xf2c9('0xd'))(new Redis(config[_0xf2c9('0xa')]));require(_0xf2c9('0xe'))['register'](socket);function respondWithRpcPromise(_0x2861ab,_0x424058,_0xf74184){return new BPromise(function(_0x2b60f6,_0x265174){return client[_0xf2c9('0xf')](_0x2861ab,_0xf74184)[_0xf2c9('0x10')](function(_0x3f0ba4){logger[_0xf2c9('0x11')](_0xf2c9('0x12'),_0x424058,_0xf2c9('0x13'));logger[_0xf2c9('0x14')](_0xf2c9('0x15'),_0x424058,_0xf2c9('0x13'),JSON[_0xf2c9('0x16')](_0x3f0ba4));if(_0x3f0ba4[_0xf2c9('0x17')]){if(_0x3f0ba4[_0xf2c9('0x17')][_0xf2c9('0x18')]===0x1f4){logger[_0xf2c9('0x17')](_0xf2c9('0x12'),_0x424058,_0x3f0ba4['error'][_0xf2c9('0x19')]);return _0x265174(_0x3f0ba4[_0xf2c9('0x17')]['message']);}logger[_0xf2c9('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x424058,_0x3f0ba4[_0xf2c9('0x17')]['message']);return _0x2b60f6(_0x3f0ba4[_0xf2c9('0x17')][_0xf2c9('0x19')]);}else{logger['info'](_0xf2c9('0x12'),_0x424058,_0xf2c9('0x13'));_0x2b60f6(_0x3f0ba4['result'][_0xf2c9('0x19')]);}})[_0xf2c9('0x1a')](function(_0x44d362){logger[_0xf2c9('0x17')](_0xf2c9('0x12'),_0x424058,_0x44d362);_0x265174(_0x44d362);});});}exports[_0xf2c9('0x1b')]=function(_0x1fd3ac){var _0xb839db=this;return new Promise(function(_0x90743a,_0x1e006a){return db['ChatInteraction'][_0xf2c9('0x1c')](_0x1fd3ac['body'],{'raw':_0x1fd3ac['options']?_0x1fd3ac['options'][_0xf2c9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd3ac[_0xf2c9('0x1e')]?_0x1fd3ac['options']['where']||null:null,'attributes':_0x1fd3ac['options']?_0x1fd3ac[_0xf2c9('0x1e')][_0xf2c9('0x1f')]||null:null,'limit':_0x1fd3ac['options']?_0x1fd3ac['options'][_0xf2c9('0x20')]||null:null})[_0xf2c9('0x10')](function(_0x4bb35f){logger[_0xf2c9('0x11')](_0xf2c9('0x1b'),_0x1fd3ac);logger[_0xf2c9('0x14')]('UpdateChatInteraction',_0x1fd3ac,JSON[_0xf2c9('0x16')](_0x4bb35f));_0x90743a(_0x4bb35f);})[_0xf2c9('0x1a')](function(_0x31beb2){logger[_0xf2c9('0x17')](_0xf2c9('0x1b'),_0x31beb2[_0xf2c9('0x19')],_0x1fd3ac);_0x1e006a(_0xb839db[_0xf2c9('0x17')](0x1f4,_0x31beb2[_0xf2c9('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x512d10){return new Promise(function(_0x3b1cfe,_0x17c1b8){return db[_0xf2c9('0x21')][_0xf2c9('0x22')]({'where':_0x512d10[_0xf2c9('0x1e')]?_0x512d10[_0xf2c9('0x1e')]['where']||null:null})[_0xf2c9('0x10')](function(_0x1d0d3b){if(_0x1d0d3b){return _0x1d0d3b[_0xf2c9('0x23')](_0x512d10[_0xf2c9('0x24')]['ids'],_[_0xf2c9('0x25')](_0x512d10['body'],['ids','id'])||{});}})[_0xf2c9('0x26')](function(_0x5ccb69){logger[_0xf2c9('0x11')](_0xf2c9('0x27'),_0x512d10);logger[_0xf2c9('0x14')]('AddTags',_0x512d10,JSON[_0xf2c9('0x16')](_0x5ccb69));_0x3b1cfe(_0x5ccb69);})[_0xf2c9('0x1a')](function(_0x4ebaab){logger[_0xf2c9('0x17')]('AddTags',_0x4ebaab[_0xf2c9('0x19')],_0x512d10);_0x17c1b8(_this[_0xf2c9('0x17')](0x1f4,_0x4ebaab[_0xf2c9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0adb9c9..ed9f07e 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 _0x97db=['length','chatInteraction:','save','remove','update','removeListener','register'];(function(_0x2edd52,_0x421654){var _0x4cf728=function(_0x4a60da){while(--_0x4a60da){_0x2edd52['push'](_0x2edd52['shift']());}};_0x4cf728(++_0x421654);}(_0x97db,0x8e));var _0xb97d=function(_0x5039e1,_0x5167e7){_0x5039e1=_0x5039e1-0x0;var _0x46dc2f=_0x97db[_0x5039e1];return _0x46dc2f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb97d('0x0'),_0xb97d('0x1'),_0xb97d('0x2')];function createListener(_0xdc4f5,_0xe05ea6){return function(_0x5f250b){_0xe05ea6['emit'](_0xdc4f5,_0x5f250b);};}function removeListener(_0x4c34ed,_0x42b7e0){return function(){ChatInteractionEvents[_0xb97d('0x3')](_0x4c34ed,_0x42b7e0);};}exports[_0xb97d('0x4')]=function(_0x54d574){for(var _0x523e31=0x0,_0x3a0842=events[_0xb97d('0x5')];_0x523e31<_0x3a0842;_0x523e31++){var _0x2a96c3=events[_0x523e31];var _0x4c81d0=createListener(_0xb97d('0x6')+_0x2a96c3,_0x54d574);ChatInteractionEvents['on'](_0x2a96c3,_0x4c81d0);}}; \ No newline at end of file +var _0x2ebe=['save','remove','update','emit','removeListener','register'];(function(_0x335826,_0x5053f2){var _0xa07893=function(_0x357bdf){while(--_0x357bdf){_0x335826['push'](_0x335826['shift']());}};_0xa07893(++_0x5053f2);}(_0x2ebe,0x174));var _0xe2eb=function(_0x23b000,_0x204d41){_0x23b000=_0x23b000-0x0;var _0x3ad41a=_0x2ebe[_0x23b000];return _0x3ad41a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xe2eb('0x0'),_0xe2eb('0x1'),_0xe2eb('0x2')];function createListener(_0x10d2ee,_0x30b644){return function(_0x3e52ac){_0x30b644[_0xe2eb('0x3')](_0x10d2ee,_0x3e52ac);};}function removeListener(_0x146a00,_0x5ad308){return function(){ChatInteractionEvents[_0xe2eb('0x4')](_0x146a00,_0x5ad308);};}exports[_0xe2eb('0x5')]=function(_0x370d0a){for(var _0x6f5dc0=0x0,_0x3d048e=events['length'];_0x6f5dc0<_0x3d048e;_0x6f5dc0++){var _0x33af3b=events[_0x6f5dc0];var _0x403fbd=createListener('chatInteraction:'+_0x33af3b,_0x370d0a);ChatInteractionEvents['on'](_0x33af3b,_0x403fbd);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c4eca7a..a61774c 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 _0x264f=['attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','delete','chatinteraction:destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized'];(function(_0x201197,_0x33b7e6){var _0x1468bf=function(_0x13239c){while(--_0x13239c){_0x201197['push'](_0x201197['shift']());}};_0x1468bf(++_0x33b7e6);}(_0x264f,0x177));var _0xf264=function(_0x408611,_0x4c2768){_0x408611=_0x408611-0x0;var _0x5a6bf1=_0x264f[_0x408611];return _0x5a6bf1;};'use strict';var multer=require(_0xf264('0x0'));var util=require(_0xf264('0x1'));var path=require(_0xf264('0x2'));var timeout=require(_0xf264('0x3'));var express=require(_0xf264('0x4'));var router=express[_0xf264('0x5')]();var fs_extra=require(_0xf264('0x6'));var auth=require(_0xf264('0x7'));var interaction=require(_0xf264('0x8'));var config=require(_0xf264('0x9'));var controller=require('./chatInteraction.controller');router[_0xf264('0xa')]('/',auth['isAuthenticated'](),controller[_0xf264('0xb')]);router[_0xf264('0xa')](_0xf264('0xc'),auth[_0xf264('0xd')](),controller[_0xf264('0xe')]);router[_0xf264('0xa')](_0xf264('0xf'),auth[_0xf264('0x10')](),controller['show']);router['get']('/:id/attachment_download',auth[_0xf264('0x10')](),controller[_0xf264('0x11')]);router[_0xf264('0xa')](_0xf264('0x12'),auth['isAuthenticated'](),controller[_0xf264('0x13')]);router[_0xf264('0xa')]('/:id/my_messages',auth[_0xf264('0x10')](),controller[_0xf264('0x14')]);router['get'](_0xf264('0x15'),auth[_0xf264('0xd')](),controller[_0xf264('0x16')]);router[_0xf264('0x17')]('/',auth['isAuthenticated'](),controller[_0xf264('0x18')]);router['post'](_0xf264('0x19'),auth[_0xf264('0xd')](),controller[_0xf264('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f608b,_0x461436,_0x52504f){_0x52504f(null,path['join'](config[_0xf264('0x1b')],_0xf264('0x1c')));},'filename':function(_0xc332ff,_0x10019c,_0x55b7c7){_0x55b7c7(null,util[_0xf264('0x1d')]('%s-%s',Date[_0xf264('0x1e')](),_0x10019c[_0xf264('0x1f')][_0xf264('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf264('0x17')](_0xf264('0x21'),upload['single'](_0xf264('0x22')),controller['attachmentUpload']);router[_0xf264('0x17')]('/:id/messages',auth[_0xf264('0x10')](),controller['addMessage']);router[_0xf264('0x17')]('/:id/tags',auth[_0xf264('0xd')](),interaction[_0xf264('0x23')]('chat',_0xf264('0x24')),controller[_0xf264('0x25')]);router[_0xf264('0x26')](_0xf264('0xf'),auth[_0xf264('0xd')](),interaction[_0xf264('0x23')](_0xf264('0x27'),_0xf264('0x28')),controller[_0xf264('0x29')]);router['put'](_0xf264('0x2a'),controller[_0xf264('0x2b')]);router[_0xf264('0x26')]('/:id/abandon',auth[_0xf264('0x10')](),controller[_0xf264('0x2c')]);router[_0xf264('0x26')]('/:id/close',controller['close']);router[_0xf264('0x2d')](_0xf264('0xf'),auth['isAuthenticated'](),interaction[_0xf264('0x23')](_0xf264('0x27'),_0xf264('0x2e')),controller['destroy']);router[_0xf264('0x2d')](_0xf264('0x2f'),auth[_0xf264('0xd')](),controller['removeTags']);module[_0xf264('0x30')]=router; \ No newline at end of file +var _0xbde3=['/:id/abandon','abandon','/:id/close','close','delete','/:id','tracked','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','download','post','create','diskStorage','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate'];(function(_0x3068cb,_0x3441b8){var _0x4f2d79=function(_0xb8ae7e){while(--_0xb8ae7e){_0x3068cb['push'](_0x3068cb['shift']());}};_0x4f2d79(++_0x3441b8);}(_0xbde3,0x130));var _0x3bde=function(_0x442ae6,_0x58743b){_0x442ae6=_0x442ae6-0x0;var _0x581317=_0xbde3[_0x442ae6];return _0x581317;};'use strict';var multer=require('multer');var util=require(_0x3bde('0x0'));var path=require(_0x3bde('0x1'));var timeout=require(_0x3bde('0x2'));var express=require(_0x3bde('0x3'));var router=express[_0x3bde('0x4')]();var fs_extra=require(_0x3bde('0x5'));var auth=require(_0x3bde('0x6'));var interaction=require(_0x3bde('0x7'));var config=require(_0x3bde('0x8'));var controller=require(_0x3bde('0x9'));router[_0x3bde('0xa')]('/',auth[_0x3bde('0xb')](),controller['index']);router['get'](_0x3bde('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3bde('0xa')]('/:id',auth[_0x3bde('0xd')](),controller[_0x3bde('0xe')]);router[_0x3bde('0xa')](_0x3bde('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x3bde('0x10')]);router['get']('/:id/messages',auth[_0x3bde('0xb')](),controller['getMessages']);router[_0x3bde('0xa')]('/:id/my_messages',auth[_0x3bde('0xd')](),controller['getMyMessages']);router['get']('/:id/download',auth[_0x3bde('0xb')](),controller[_0x3bde('0x11')]);router[_0x3bde('0x12')]('/',auth[_0x3bde('0xb')](),controller[_0x3bde('0x13')]);router['post']('/:id/vidaoo',auth[_0x3bde('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x3bde('0x14')]({'destination':function(_0x53a27e,_0x324c0e,_0x53588e){_0x53588e(null,path['join'](config['root'],_0x3bde('0x15')));},'filename':function(_0x5b3e28,_0x2af720,_0x22e9b1){_0x22e9b1(null,util[_0x3bde('0x16')](_0x3bde('0x17'),Date['now'](),_0x2af720[_0x3bde('0x18')][_0x3bde('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3bde('0x12')](_0x3bde('0x1a'),upload[_0x3bde('0x1b')]('file'),controller[_0x3bde('0x1c')]);router[_0x3bde('0x12')](_0x3bde('0x1d'),auth[_0x3bde('0xd')](),controller['addMessage']);router['post'](_0x3bde('0x1e'),auth[_0x3bde('0xb')](),interaction['tracked'](_0x3bde('0x1f'),_0x3bde('0x20')),controller[_0x3bde('0x21')]);router[_0x3bde('0x22')]('/:id',auth[_0x3bde('0xb')](),interaction['tracked'](_0x3bde('0x1f'),_0x3bde('0x23')),controller[_0x3bde('0x24')]);router['put'](_0x3bde('0x25'),controller[_0x3bde('0x26')]);router[_0x3bde('0x22')](_0x3bde('0x27'),auth[_0x3bde('0xd')](),controller[_0x3bde('0x28')]);router['put'](_0x3bde('0x29'),controller[_0x3bde('0x2a')]);router[_0x3bde('0x2b')](_0x3bde('0x2c'),auth[_0x3bde('0xb')](),interaction[_0x3bde('0x2d')](_0x3bde('0x1f'),'chatinteraction:destroy'),controller[_0x3bde('0x2e')]);router[_0x3bde('0x2b')](_0x3bde('0x1e'),auth['isAuthenticated'](),controller[_0x3bde('0x2f')]);module[_0x3bde('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 7e3cb65..e983155 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 _0x55f6=['medium','INTEGER','exports','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x55f6,0x14e));var _0x655f=function(_0x35c013,_0x456f78){_0x35c013=_0x35c013-0x0;var _0x3e1e17=_0x55f6[_0x35c013];return _0x3e1e17;};'use strict';var Sequelize=require('sequelize');module[_0x655f('0x0')]={'body':{'type':Sequelize[_0x655f('0x1')](_0x655f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x655f('0x3')]}}; \ No newline at end of file +var _0xdc2d=['INTEGER','sequelize','BOOLEAN'];(function(_0xdecc07,_0x54ee6d){var _0x2ad019=function(_0x49f7fa){while(--_0x49f7fa){_0xdecc07['push'](_0xdecc07['shift']());}};_0x2ad019(++_0x54ee6d);}(_0xdc2d,0xa9));var _0xddc2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc2d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xddc2('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xddc2('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xddc2('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 29c0549..3f2d660 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 _0x8a95=['UserProfileResource','isEmpty','resourceId','push','filter','messages','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','then','destroy','error','stack','name','send','index','ChatInternalMessage','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','role','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId'];(function(_0x2806e0,_0xc69dad){var _0x356c7b=function(_0x13b322){while(--_0x13b322){_0x2806e0['push'](_0x2806e0['shift']());}};_0x356c7b(++_0xc69dad);}(_0x8a95,0x1bb));var _0x58a9=function(_0x242e7d,_0x4545ac){_0x242e7d=_0x242e7d-0x0;var _0x2caafa=_0x8a95[_0x242e7d];return _0x2caafa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58a9('0x0'));var zipdir=require(_0x58a9('0x1'));var jsonpatch=require(_0x58a9('0x2'));var rp=require('request-promise');var moment=require(_0x58a9('0x3'));var BPromise=require(_0x58a9('0x4'));var Mustache=require(_0x58a9('0x5'));var util=require(_0x58a9('0x6'));var path=require(_0x58a9('0x7'));var sox=require(_0x58a9('0x8'));var csv=require(_0x58a9('0x9'));var ejs=require(_0x58a9('0xa'));var fs=require('fs');var fs_extra=require(_0x58a9('0xb'));var _=require(_0x58a9('0xc'));var squel=require(_0x58a9('0xd'));var crypto=require(_0x58a9('0xe'));var jsforce=require(_0x58a9('0xf'));var deskjs=require(_0x58a9('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x58a9('0x11'));var Redis=require(_0x58a9('0x12'));var authService=require(_0x58a9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x58a9('0x14'));var hardwareService=require(_0x58a9('0x15'));var logger=require('../../config/logger')(_0x58a9('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x58a9('0x17'));var db=require('../../mysqldb')['db'];config[_0x58a9('0x18')]=_[_0x58a9('0x19')](config['redis'],{'host':_0x58a9('0x1a'),'port':0x18eb});var socket=require(_0x58a9('0x1b'))(new Redis(config[_0x58a9('0x18')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x33f2b5,_0x3aa5ca){_0x3aa5ca=_0x3aa5ca||0xcc;return function(_0x39e1be){if(_0x39e1be){return _0x33f2b5[_0x58a9('0x1c')](_0x3aa5ca);}return _0x33f2b5[_0x58a9('0x1d')](_0x3aa5ca)[_0x58a9('0x1e')]();};}function respondWithResult(_0x3ac8d7,_0x23ef06){_0x23ef06=_0x23ef06||0xc8;return function(_0x24b4f7){if(_0x24b4f7){return _0x3ac8d7[_0x58a9('0x1d')](_0x23ef06)[_0x58a9('0x1f')](_0x24b4f7);}};}function respondWithFilteredResult(_0x1088ed,_0x48a0e4){return function(_0x15922d){if(_0x15922d){var _0x2025c5=typeof _0x48a0e4['offset']===_0x58a9('0x20')&&typeof _0x48a0e4[_0x58a9('0x21')]==='undefined';var _0x56c7c2=_0x15922d[_0x58a9('0x22')];var _0x4340b7=_0x2025c5?0x0:_0x48a0e4[_0x58a9('0x23')];var _0xd6ce3f=_0x2025c5?_0x15922d[_0x58a9('0x22')]:_0x48a0e4[_0x58a9('0x23')]+_0x48a0e4[_0x58a9('0x21')];var _0x1bc688;if(_0xd6ce3f>=_0x56c7c2){_0xd6ce3f=_0x56c7c2;_0x1bc688=0xc8;}else{_0x1bc688=0xce;}_0x1088ed[_0x58a9('0x1d')](_0x1bc688);return _0x1088ed['set']('Content-Range',_0x4340b7+'-'+_0xd6ce3f+'/'+_0x56c7c2)[_0x58a9('0x1f')](_0x15922d);}return null;};}function patchUpdates(_0x1cf7a6){return function(_0x1d6d58){try{jsonpatch[_0x58a9('0x24')](_0x1d6d58,_0x1cf7a6,!![]);}catch(_0x1cb7d3){return BPromise['reject'](_0x1cb7d3);}return _0x1d6d58[_0x58a9('0x25')]();};}function saveUpdates(_0x4794ff,_0x3e2297){return function(_0x20bf2c){if(_0x20bf2c){return _0x20bf2c[_0x58a9('0x26')](_0x4794ff)[_0x58a9('0x27')](function(_0x37b560){return _0x37b560;});}return null;};}function removeEntity(_0x248110,_0x2db306){return function(_0x13025e){if(_0x13025e){return _0x13025e[_0x58a9('0x28')]()[_0x58a9('0x27')](function(){_0x248110[_0x58a9('0x1d')](0xcc)[_0x58a9('0x1e')]();});}};}function handleEntityNotFound(_0x1a382d,_0x37b85a){return function(_0x305bbc){if(!_0x305bbc){_0x1a382d[_0x58a9('0x1c')](0x194);}return _0x305bbc;};}function handleError(_0x63e1b1,_0x2262e7){_0x2262e7=_0x2262e7||0x1f4;return function(_0x564c32){logger[_0x58a9('0x29')](_0x564c32[_0x58a9('0x2a')]);if(_0x564c32[_0x58a9('0x2b')]){delete _0x564c32[_0x58a9('0x2b')];}_0x63e1b1[_0x58a9('0x1d')](_0x2262e7)[_0x58a9('0x2c')](_0x564c32);};}exports[_0x58a9('0x2d')]=function(_0x307e24,_0x169cb8){var _0x3e1e9a={},_0x58537e={},_0x23c72f={'count':0x0,'rows':[]};var _0x44856c=_['map'](db[_0x58a9('0x2e')]['rawAttributes'],function(_0x203da1){return{'name':_0x203da1[_0x58a9('0x2f')],'type':_0x203da1['type'][_0x58a9('0x30')]};});_0x58537e['model']=_[_0x58a9('0x31')](_0x44856c,'name');_0x58537e[_0x58a9('0x32')]=_['keys'](_0x307e24[_0x58a9('0x32')]);_0x58537e[_0x58a9('0x33')]=_[_0x58a9('0x34')](_0x58537e[_0x58a9('0x35')],_0x58537e[_0x58a9('0x32')]);_0x3e1e9a[_0x58a9('0x36')]=_[_0x58a9('0x34')](_0x58537e[_0x58a9('0x35')],qs[_0x58a9('0x37')](_0x307e24[_0x58a9('0x32')][_0x58a9('0x37')]));_0x3e1e9a[_0x58a9('0x36')]=_0x3e1e9a[_0x58a9('0x36')][_0x58a9('0x38')]?_0x3e1e9a[_0x58a9('0x36')]:_0x58537e[_0x58a9('0x35')];if(!_0x307e24[_0x58a9('0x32')][_0x58a9('0x39')]('nolimit')){_0x3e1e9a[_0x58a9('0x21')]=qs[_0x58a9('0x21')](_0x307e24[_0x58a9('0x32')][_0x58a9('0x21')]);_0x3e1e9a[_0x58a9('0x23')]=qs[_0x58a9('0x23')](_0x307e24[_0x58a9('0x32')][_0x58a9('0x23')]);}_0x3e1e9a[_0x58a9('0x3a')]=qs[_0x58a9('0x3b')](_0x307e24[_0x58a9('0x32')][_0x58a9('0x3b')]);_0x3e1e9a[_0x58a9('0x3c')]=qs[_0x58a9('0x33')](_[_0x58a9('0x3d')](_0x307e24[_0x58a9('0x32')],_0x58537e[_0x58a9('0x33')]),_0x44856c);if(_0x307e24[_0x58a9('0x32')]['filter']){_0x3e1e9a[_0x58a9('0x3c')]=_[_0x58a9('0x3e')](_0x3e1e9a[_0x58a9('0x3c')],{'$or':_['map'](_0x44856c,function(_0x4d797f){if(_0x4d797f['type']!==_0x58a9('0x3f')){var _0x441ee9={};_0x441ee9[_0x4d797f['name']]={'$like':'%'+_0x307e24[_0x58a9('0x32')]['filter']+'%'};return _0x441ee9;}})});}_0x3e1e9a=_[_0x58a9('0x3e')]({},_0x3e1e9a,_0x307e24[_0x58a9('0x40')]);var _0x18ce5a={'where':_0x3e1e9a[_0x58a9('0x3c')]};return db[_0x58a9('0x2e')]['count'](_0x18ce5a)[_0x58a9('0x27')](function(_0x15c3fa){_0x23c72f['count']=_0x15c3fa;if(_0x307e24[_0x58a9('0x32')][_0x58a9('0x41')]){_0x3e1e9a[_0x58a9('0x42')]=[{'all':!![]}];}return db[_0x58a9('0x2e')][_0x58a9('0x43')](_0x3e1e9a);})[_0x58a9('0x27')](function(_0x38bcd0){_0x23c72f[_0x58a9('0x44')]=_0x38bcd0;return _0x23c72f;})[_0x58a9('0x27')](respondWithFilteredResult(_0x169cb8,_0x3e1e9a))[_0x58a9('0x45')](handleError(_0x169cb8,null));};exports[_0x58a9('0x46')]=function(_0x1618cb,_0x5acba5){var _0x2b0691={'raw':!![],'where':{'id':_0x1618cb[_0x58a9('0x47')]['id']}},_0x538d5d={};_0x538d5d[_0x58a9('0x35')]=_[_0x58a9('0x48')](db[_0x58a9('0x2e')][_0x58a9('0x49')]);_0x538d5d[_0x58a9('0x32')]=_[_0x58a9('0x48')](_0x1618cb[_0x58a9('0x32')]);_0x538d5d[_0x58a9('0x33')]=_['intersection'](_0x538d5d[_0x58a9('0x35')],_0x538d5d[_0x58a9('0x32')]);_0x2b0691['attributes']=_[_0x58a9('0x34')](_0x538d5d[_0x58a9('0x35')],qs['fields'](_0x1618cb[_0x58a9('0x32')][_0x58a9('0x37')]));_0x2b0691['attributes']=_0x2b0691[_0x58a9('0x36')][_0x58a9('0x38')]?_0x2b0691[_0x58a9('0x36')]:_0x538d5d['model'];if(_0x1618cb[_0x58a9('0x32')]['includeAll']){_0x2b0691[_0x58a9('0x42')]=[{'all':!![]}];}_0x2b0691=_[_0x58a9('0x3e')]({},_0x2b0691,_0x1618cb['options']);return db[_0x58a9('0x2e')][_0x58a9('0x4a')](_0x2b0691)['then'](handleEntityNotFound(_0x5acba5,null))[_0x58a9('0x27')](respondWithResult(_0x5acba5,null))[_0x58a9('0x45')](handleError(_0x5acba5,null));};exports[_0x58a9('0x4b')]=function(_0x653b06,_0x576797){return db[_0x58a9('0x2e')][_0x58a9('0x4b')](_0x653b06[_0x58a9('0x4c')],{})[_0x58a9('0x27')](respondWithResult(_0x576797,0xc9))[_0x58a9('0x45')](handleError(_0x576797,null));};exports[_0x58a9('0x26')]=function(_0xecf5a7,_0x38a6ef){if(_0xecf5a7[_0x58a9('0x4c')]['id']){delete _0xecf5a7[_0x58a9('0x4c')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0xecf5a7[_0x58a9('0x47')]['id']}})[_0x58a9('0x27')](handleEntityNotFound(_0x38a6ef,null))[_0x58a9('0x27')](saveUpdates(_0xecf5a7[_0x58a9('0x4c')],null))[_0x58a9('0x27')](respondWithResult(_0x38a6ef,null))[_0x58a9('0x45')](handleError(_0x38a6ef,null));};exports['destroy']=function(_0x3d12ef,_0x14b3cb){return db['ChatInternalMessage'][_0x58a9('0x4a')]({'where':{'id':_0x3d12ef[_0x58a9('0x47')]['id']}})['then'](handleEntityNotFound(_0x14b3cb,null))[_0x58a9('0x27')](removeEntity(_0x14b3cb,null))['catch'](handleError(_0x14b3cb,null));};exports[_0x58a9('0x4d')]=function(_0x996e3e,_0x321fce){return db[_0x58a9('0x2e')][_0x58a9('0x4d')]()['then'](respondWithResult(_0x321fce,null))[_0x58a9('0x45')](handleError(_0x321fce,null));};function wrapUser(_0x4d0baf){return function(_0x3947aa){var _0x413e36=_0x4d0baf[_0x58a9('0x4e')]({'plain':!![]});_0x413e36['messages']=[];if(_0x3947aa){_0x413e36[_0x58a9('0x4f')]=_0x3947aa['createdAt'];_0x413e36[_0x58a9('0x50')]=_0x3947aa;}else{_0x413e36[_0x58a9('0x4f')]=moment(0x0)[_0x58a9('0x51')](_0x58a9('0x52'));_0x413e36[_0x58a9('0x50')]={};}return _0x413e36;};}exports[_0x58a9('0x53')]=function(_0x2eadb3,_0x304063,_0xc877b4){var _0x692a79=[];return db['User'][_0x58a9('0x43')]({'where':{'role':[_0x58a9('0x54'),'admin',_0x58a9('0x55')]},'attributes':['id','fullname',_0x58a9('0x2b'),_0x58a9('0x56'),'userpic',_0x58a9('0x57'),_0x58a9('0x58'),_0x58a9('0x59'),'allowmessenger',_0x58a9('0x5a')],'order':qs[_0x58a9('0x3b')]('-online'),'include':[{'model':db[_0x58a9('0x5b')],'as':_0x58a9('0x5c'),'attributes':['id',_0x58a9('0x2b'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x3d149d){if(_0x3d149d){var _0x2269e4=_0x2eadb3[_0x58a9('0x55')]['get']({'plain':!![]});if(!_0x2269e4)throw new Error(_0x58a9('0x5d'));if(_0x2269e4[_0x58a9('0x56')]===_0x58a9('0x55')){return db[_0x58a9('0x5e')][_0x58a9('0x4a')]({'where':{'name':_0x58a9('0x5f'),'userProfileId':_0x2269e4[_0x58a9('0x60')]},'raw':!![]})[_0x58a9('0x27')](function(_0x30e7e7){if(_0x30e7e7){if(_0x30e7e7['autoAssociation']===0x0){return db[_0x58a9('0x61')][_0x58a9('0x43')]({'where':{'sectionId':_0x30e7e7['id']},'raw':!![]})[_0x58a9('0x27')](function(_0x1b2e08){var _0x33ffca=[];if(_[_0x58a9('0x62')](_0x1b2e08)){_0x33ffca=_['filter'](_0x3d149d,function(_0x3039be){if(_0x3039be['role']!==_0x58a9('0x54')){return _0x3039be;}});return _0x33ffca;}else{for(var _0x313293=0x0;_0x313293<_0x3d149d['length'];_0x313293++){var _0x26b622=_0x3d149d[_0x313293];if(_0x26b622['role']==='agent'){var _0xe0338b=_[_0x58a9('0x4a')](_0x1b2e08,function(_0x59fb13){return _0x59fb13[_0x58a9('0x63')]===_0x26b622['id'];});if(_0xe0338b)_0x33ffca['push'](_0x26b622);}else{_0x33ffca[_0x58a9('0x64')](_0x26b622);}}return _0x33ffca;}});}else{return _0x3d149d;}}else{var _0x3f8f13=_[_0x58a9('0x65')](_0x3d149d,function(_0x282dbe){if(_0x282dbe[_0x58a9('0x56')]!==_0x58a9('0x54')){return _0x282dbe;}});return _0x3f8f13;}});}else{return _0x3d149d;}}})[_0x58a9('0x27')](function(_0x24b112){var _0x3510df=[];if(_0x24b112){_0x692a79=_0x24b112;for(var _0x2e7e86=0x0;_0x2e7e86<_0x24b112[_0x58a9('0x38')];_0x2e7e86+=0x1){_0x692a79[_0x2e7e86][_0x58a9('0x66')]=[];_0x3510df[_0x58a9('0x64')](db[_0x58a9('0x2e')][_0x58a9('0x4a')]({'where':{'FromId':[_0x2eadb3[_0x58a9('0x55')]['id'],_0x24b112[_0x2e7e86]['id']],'ToId':[_0x2eadb3[_0x58a9('0x55')]['id'],_0x24b112[_0x2e7e86]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x58a9('0x67'),_0x58a9('0x68'),_0x58a9('0x69'),_0x58a9('0x4c')],'order':qs[_0x58a9('0x3b')](_0x58a9('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x58a9('0x27')](wrapUser(_0x24b112[_0x2e7e86])));}return BPromise[_0x58a9('0x6b')](_0x3510df);}return[];})[_0x58a9('0x27')](function(_0x4ed5b3){return{'rows':_0x4ed5b3,'count':_0x4ed5b3[_0x58a9('0x38')]};})[_0x58a9('0x27')](respondWithResult(_0x304063,null))[_0x58a9('0x45')](handleError(_0x304063,null));}; \ No newline at end of file +var _0xc16f=['create','body','params','describe','createdAt','lastMessageAt','format','lastMessage','getUsers','agent','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x42ed03,_0x18b558){var _0x1a0126=function(_0xe74416){while(--_0xe74416){_0x42ed03['push'](_0x42ed03['shift']());}};_0x1a0126(++_0x18b558);}(_0xc16f,0x1eb));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfc16('0x0'));var rimraf=require(_0xfc16('0x1'));var zipdir=require(_0xfc16('0x2'));var jsonpatch=require(_0xfc16('0x3'));var rp=require(_0xfc16('0x4'));var moment=require(_0xfc16('0x5'));var BPromise=require(_0xfc16('0x6'));var Mustache=require(_0xfc16('0x7'));var util=require('util');var path=require(_0xfc16('0x8'));var sox=require(_0xfc16('0x9'));var csv=require(_0xfc16('0xa'));var ejs=require(_0xfc16('0xb'));var fs=require('fs');var fs_extra=require(_0xfc16('0xc'));var _=require('lodash');var squel=require(_0xfc16('0xd'));var crypto=require(_0xfc16('0xe'));var jsforce=require(_0xfc16('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc16('0xa'));var querystring=require('querystring');var Papa=require(_0xfc16('0x10'));var Redis=require(_0xfc16('0x11'));var authService=require(_0xfc16('0x12'));var qs=require(_0xfc16('0x13'));var as=require(_0xfc16('0x14'));var hardwareService=require(_0xfc16('0x15'));var logger=require(_0xfc16('0x16'))(_0xfc16('0x17'));var utils=require('../../config/utils');var config=require(_0xfc16('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfc16('0x19')]=_[_0xfc16('0x1a')](config[_0xfc16('0x19')],{'host':_0xfc16('0x1b'),'port':0x18eb});var socket=require(_0xfc16('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xfc16('0x1d')](socket);function respondWithStatusCode(_0x17be7d,_0x46fbdc){_0x46fbdc=_0x46fbdc||0xcc;return function(_0x4f8e75){if(_0x4f8e75){return _0x17be7d['sendStatus'](_0x46fbdc);}return _0x17be7d[_0xfc16('0x1e')](_0x46fbdc)[_0xfc16('0x1f')]();};}function respondWithResult(_0x58b894,_0x24eab5){_0x24eab5=_0x24eab5||0xc8;return function(_0x4b84d7){if(_0x4b84d7){return _0x58b894[_0xfc16('0x1e')](_0x24eab5)[_0xfc16('0x20')](_0x4b84d7);}};}function respondWithFilteredResult(_0x433804,_0x2f4ecf){return function(_0x48fa2e){if(_0x48fa2e){var _0x4bb7ff=typeof _0x2f4ecf[_0xfc16('0x21')]==='undefined'&&typeof _0x2f4ecf[_0xfc16('0x22')]===_0xfc16('0x23');var _0x5d5145=_0x48fa2e[_0xfc16('0x24')];var _0x3f78f3=_0x4bb7ff?0x0:_0x2f4ecf[_0xfc16('0x21')];var _0x1138fb=_0x4bb7ff?_0x48fa2e[_0xfc16('0x24')]:_0x2f4ecf[_0xfc16('0x21')]+_0x2f4ecf['limit'];var _0x3beaab;if(_0x1138fb>=_0x5d5145){_0x1138fb=_0x5d5145;_0x3beaab=0xc8;}else{_0x3beaab=0xce;}_0x433804['status'](_0x3beaab);return _0x433804[_0xfc16('0x25')](_0xfc16('0x26'),_0x3f78f3+'-'+_0x1138fb+'/'+_0x5d5145)[_0xfc16('0x20')](_0x48fa2e);}return null;};}function patchUpdates(_0x52e86f){return function(_0x5831cc){try{jsonpatch['apply'](_0x5831cc,_0x52e86f,!![]);}catch(_0x30df21){return BPromise[_0xfc16('0x27')](_0x30df21);}return _0x5831cc[_0xfc16('0x28')]();};}function saveUpdates(_0x53413c,_0x5b6102){return function(_0x5ad189){if(_0x5ad189){return _0x5ad189[_0xfc16('0x29')](_0x53413c)[_0xfc16('0x2a')](function(_0x5cd5af){return _0x5cd5af;});}return null;};}function removeEntity(_0x46f5c4,_0x4a7201){return function(_0x3777f7){if(_0x3777f7){return _0x3777f7[_0xfc16('0x2b')]()['then'](function(){_0x46f5c4[_0xfc16('0x1e')](0xcc)[_0xfc16('0x1f')]();});}};}function handleEntityNotFound(_0x5bc2a5,_0x4d302f){return function(_0x182686){if(!_0x182686){_0x5bc2a5[_0xfc16('0x2c')](0x194);}return _0x182686;};}function handleError(_0x31974c,_0x17d9d5){_0x17d9d5=_0x17d9d5||0x1f4;return function(_0xee267d){logger[_0xfc16('0x2d')](_0xee267d[_0xfc16('0x2e')]);if(_0xee267d['name']){delete _0xee267d[_0xfc16('0x2f')];}_0x31974c[_0xfc16('0x1e')](_0x17d9d5)[_0xfc16('0x30')](_0xee267d);};}exports[_0xfc16('0x31')]=function(_0x54ad95,_0xcd880d){var _0x5dde2d={},_0x468c71={},_0x5d879e={'count':0x0,'rows':[]};var _0xdbecab=_[_0xfc16('0x32')](db[_0xfc16('0x33')]['rawAttributes'],function(_0x51ffd9){return{'name':_0x51ffd9['fieldName'],'type':_0x51ffd9[_0xfc16('0x34')][_0xfc16('0x35')]};});_0x468c71['model']=_[_0xfc16('0x32')](_0xdbecab,_0xfc16('0x2f'));_0x468c71[_0xfc16('0x36')]=_[_0xfc16('0x37')](_0x54ad95[_0xfc16('0x36')]);_0x468c71['filters']=_[_0xfc16('0x38')](_0x468c71[_0xfc16('0x39')],_0x468c71['query']);_0x5dde2d['attributes']=_[_0xfc16('0x38')](_0x468c71[_0xfc16('0x39')],qs[_0xfc16('0x3a')](_0x54ad95[_0xfc16('0x36')][_0xfc16('0x3a')]));_0x5dde2d[_0xfc16('0x3b')]=_0x5dde2d['attributes'][_0xfc16('0x3c')]?_0x5dde2d[_0xfc16('0x3b')]:_0x468c71[_0xfc16('0x39')];if(!_0x54ad95[_0xfc16('0x36')][_0xfc16('0x3d')](_0xfc16('0x3e'))){_0x5dde2d[_0xfc16('0x22')]=qs[_0xfc16('0x22')](_0x54ad95[_0xfc16('0x36')][_0xfc16('0x22')]);_0x5dde2d['offset']=qs[_0xfc16('0x21')](_0x54ad95['query']['offset']);}_0x5dde2d[_0xfc16('0x3f')]=qs[_0xfc16('0x40')](_0x54ad95['query'][_0xfc16('0x40')]);_0x5dde2d[_0xfc16('0x41')]=qs['filters'](_[_0xfc16('0x42')](_0x54ad95[_0xfc16('0x36')],_0x468c71[_0xfc16('0x43')]),_0xdbecab);if(_0x54ad95[_0xfc16('0x36')]['filter']){_0x5dde2d[_0xfc16('0x41')]=_[_0xfc16('0x44')](_0x5dde2d[_0xfc16('0x41')],{'$or':_[_0xfc16('0x32')](_0xdbecab,function(_0x2437d9){if(_0x2437d9['type']!==_0xfc16('0x45')){var _0x5af1a5={};_0x5af1a5[_0x2437d9[_0xfc16('0x2f')]]={'$like':'%'+_0x54ad95[_0xfc16('0x36')][_0xfc16('0x46')]+'%'};return _0x5af1a5;}})});}_0x5dde2d=_['merge']({},_0x5dde2d,_0x54ad95[_0xfc16('0x47')]);var _0x245b48={'where':_0x5dde2d['where']};return db[_0xfc16('0x33')][_0xfc16('0x24')](_0x245b48)[_0xfc16('0x2a')](function(_0x55614f){_0x5d879e['count']=_0x55614f;if(_0x54ad95[_0xfc16('0x36')][_0xfc16('0x48')]){_0x5dde2d[_0xfc16('0x49')]=[{'all':!![]}];}return db[_0xfc16('0x33')][_0xfc16('0x4a')](_0x5dde2d);})['then'](function(_0x5e3baf){_0x5d879e[_0xfc16('0x4b')]=_0x5e3baf;return _0x5d879e;})['then'](respondWithFilteredResult(_0xcd880d,_0x5dde2d))[_0xfc16('0x4c')](handleError(_0xcd880d,null));};exports[_0xfc16('0x4d')]=function(_0x34ae54,_0x2efca5){var _0xf1b7e3={'raw':!![],'where':{'id':_0x34ae54['params']['id']}},_0x43e09f={};_0x43e09f[_0xfc16('0x39')]=_[_0xfc16('0x37')](db['ChatInternalMessage']['rawAttributes']);_0x43e09f['query']=_[_0xfc16('0x37')](_0x34ae54[_0xfc16('0x36')]);_0x43e09f[_0xfc16('0x43')]=_[_0xfc16('0x38')](_0x43e09f['model'],_0x43e09f['query']);_0xf1b7e3['attributes']=_[_0xfc16('0x38')](_0x43e09f[_0xfc16('0x39')],qs['fields'](_0x34ae54[_0xfc16('0x36')][_0xfc16('0x3a')]));_0xf1b7e3[_0xfc16('0x3b')]=_0xf1b7e3[_0xfc16('0x3b')][_0xfc16('0x3c')]?_0xf1b7e3[_0xfc16('0x3b')]:_0x43e09f[_0xfc16('0x39')];if(_0x34ae54[_0xfc16('0x36')][_0xfc16('0x48')]){_0xf1b7e3[_0xfc16('0x49')]=[{'all':!![]}];}_0xf1b7e3=_[_0xfc16('0x44')]({},_0xf1b7e3,_0x34ae54['options']);return db[_0xfc16('0x33')][_0xfc16('0x4e')](_0xf1b7e3)[_0xfc16('0x2a')](handleEntityNotFound(_0x2efca5,null))[_0xfc16('0x2a')](respondWithResult(_0x2efca5,null))[_0xfc16('0x4c')](handleError(_0x2efca5,null));};exports[_0xfc16('0x4f')]=function(_0x134b81,_0x3f75df){return db['ChatInternalMessage'][_0xfc16('0x4f')](_0x134b81[_0xfc16('0x50')],{})['then'](respondWithResult(_0x3f75df,0xc9))[_0xfc16('0x4c')](handleError(_0x3f75df,null));};exports['update']=function(_0x3bf86e,_0x2fc137){if(_0x3bf86e[_0xfc16('0x50')]['id']){delete _0x3bf86e[_0xfc16('0x50')]['id'];}return db['ChatInternalMessage'][_0xfc16('0x4e')]({'where':{'id':_0x3bf86e[_0xfc16('0x51')]['id']}})[_0xfc16('0x2a')](handleEntityNotFound(_0x2fc137,null))[_0xfc16('0x2a')](saveUpdates(_0x3bf86e[_0xfc16('0x50')],null))[_0xfc16('0x2a')](respondWithResult(_0x2fc137,null))[_0xfc16('0x4c')](handleError(_0x2fc137,null));};exports[_0xfc16('0x2b')]=function(_0x417565,_0x4c6624){return db['ChatInternalMessage'][_0xfc16('0x4e')]({'where':{'id':_0x417565[_0xfc16('0x51')]['id']}})[_0xfc16('0x2a')](handleEntityNotFound(_0x4c6624,null))[_0xfc16('0x2a')](removeEntity(_0x4c6624,null))[_0xfc16('0x4c')](handleError(_0x4c6624,null));};exports[_0xfc16('0x52')]=function(_0x57c963,_0x4939fe){return db['ChatInternalMessage'][_0xfc16('0x52')]()[_0xfc16('0x2a')](respondWithResult(_0x4939fe,null))[_0xfc16('0x4c')](handleError(_0x4939fe,null));};function wrapUser(_0xabeaf2){return function(_0x6542d5){var _0x3f11f3=_0xabeaf2['get']({'plain':!![]});_0x3f11f3['messages']=[];if(_0x6542d5){_0x3f11f3['lastMessageAt']=_0x6542d5[_0xfc16('0x53')];_0x3f11f3['lastMessage']=_0x6542d5;}else{_0x3f11f3[_0xfc16('0x54')]=moment(0x0)[_0xfc16('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f11f3[_0xfc16('0x56')]={};}return _0x3f11f3;};}exports[_0xfc16('0x57')]=function(_0x2c413a,_0xdbc166,_0x2d47b5){var _0x4b33ab=[];return db['User'][_0xfc16('0x4a')]({'where':{'role':[_0xfc16('0x58'),'admin',_0xfc16('0x59')]},'attributes':['id',_0xfc16('0x5a'),'name',_0xfc16('0x5b'),_0xfc16('0x5c'),_0xfc16('0x5d'),_0xfc16('0x5e'),'lastLoginAt',_0xfc16('0x5f'),_0xfc16('0x60')],'order':qs[_0xfc16('0x40')](_0xfc16('0x61')),'include':[{'model':db[_0xfc16('0x62')],'as':_0xfc16('0x63'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xfc16('0x2a')](function(_0x4f9385){if(_0x4f9385){var _0x4afa3d=_0x2c413a[_0xfc16('0x59')][_0xfc16('0x64')]({'plain':!![]});if(!_0x4afa3d)throw new Error(_0xfc16('0x65'));if(_0x4afa3d['role']===_0xfc16('0x59')){return db[_0xfc16('0x66')][_0xfc16('0x4e')]({'where':{'name':_0xfc16('0x67'),'userProfileId':_0x4afa3d['userProfileId']},'raw':!![]})[_0xfc16('0x2a')](function(_0x34ed86){if(_0x34ed86){if(_0x34ed86[_0xfc16('0x68')]===0x0){return db[_0xfc16('0x69')][_0xfc16('0x4a')]({'where':{'sectionId':_0x34ed86['id']},'raw':!![]})[_0xfc16('0x2a')](function(_0x2c7b44){var _0x6d8471=[];if(_[_0xfc16('0x6a')](_0x2c7b44)){_0x6d8471=_['filter'](_0x4f9385,function(_0x3e40ea){if(_0x3e40ea[_0xfc16('0x5b')]!==_0xfc16('0x58')){return _0x3e40ea;}});return _0x6d8471;}else{for(var _0x1226b6=0x0;_0x1226b6<_0x4f9385['length'];_0x1226b6++){var _0x6dfe5f=_0x4f9385[_0x1226b6];if(_0x6dfe5f['role']===_0xfc16('0x58')){var _0x2344ca=_['find'](_0x2c7b44,function(_0xf4b20d){return _0xf4b20d[_0xfc16('0x6b')]===_0x6dfe5f['id'];});if(_0x2344ca)_0x6d8471[_0xfc16('0x6c')](_0x6dfe5f);}else{_0x6d8471[_0xfc16('0x6c')](_0x6dfe5f);}}return _0x6d8471;}});}else{return _0x4f9385;}}else{var _0x1efdca=_[_0xfc16('0x46')](_0x4f9385,function(_0x31b61b){if(_0x31b61b[_0xfc16('0x5b')]!=='agent'){return _0x31b61b;}});return _0x1efdca;}});}else{return _0x4f9385;}}})[_0xfc16('0x2a')](function(_0x402c50){var _0x383738=[];if(_0x402c50){_0x4b33ab=_0x402c50;for(var _0x312194=0x0;_0x312194<_0x402c50[_0xfc16('0x3c')];_0x312194+=0x1){_0x4b33ab[_0x312194][_0xfc16('0x6d')]=[];_0x383738[_0xfc16('0x6c')](db[_0xfc16('0x33')][_0xfc16('0x4e')]({'where':{'FromId':[_0x2c413a['user']['id'],_0x402c50[_0x312194]['id']],'ToId':[_0x2c413a[_0xfc16('0x59')]['id'],_0x402c50[_0x312194]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xfc16('0x6e'),_0xfc16('0x6f'),_0xfc16('0x50')],'order':qs[_0xfc16('0x40')](_0xfc16('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfc16('0x2a')](wrapUser(_0x402c50[_0x312194])));}return BPromise[_0xfc16('0x71')](_0x383738);}return[];})['then'](function(_0x443371){return{'rows':_0x443371,'count':_0x443371[_0xfc16('0x3c')]};})['then'](respondWithResult(_0xdbc166,null))[_0xfc16('0x4c')](handleError(_0xdbc166,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3900f6b..2c2766b 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 _0x3166=['emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3166,0xbb));var _0x6316=function(_0x20afa0,_0xaf84ab){_0x20afa0=_0x20afa0-0x0;var _0x5981f2=_0x3166[_0x20afa0];return _0x5981f2;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6316('0x0'))['db'][_0x6316('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6316('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6316('0x3'),'afterDestroy':_0x6316('0x4')};function emitEvent(_0x516ce3){return function(_0x42c249,_0x2d7fed,_0x5c34c5){ChatInternalMessageEvents[_0x6316('0x5')](_0x516ce3+':'+_0x42c249['id'],_0x42c249);ChatInternalMessageEvents[_0x6316('0x5')](_0x516ce3,_0x42c249);_0x5c34c5(null);};}for(var e in events){if(events[_0x6316('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6316('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x3804=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x7bd370,_0x4bb7fa){var _0xdfa30b=function(_0x17d6b4){while(--_0x17d6b4){_0x7bd370['push'](_0x7bd370['shift']());}};_0xdfa30b(++_0x4bb7fa);}(_0x3804,0xe0));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4380('0x0'));var ChatInternalMessage=require(_0x4380('0x1'))['db'][_0x4380('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4380('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4380('0x4'),'afterDestroy':_0x4380('0x5')};function emitEvent(_0x9e8495){return function(_0x321ec5,_0x137af3,_0x160b47){ChatInternalMessageEvents['emit'](_0x9e8495+':'+_0x321ec5['id'],_0x321ec5);ChatInternalMessageEvents[_0x4380('0x6')](_0x9e8495,_0x321ec5);_0x160b47(null);};}for(var e in events){if(events[_0x4380('0x7')](e)){var event=events[e];ChatInternalMessage[_0x4380('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 76a0da6..15d4e45 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 _0xafce=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0xce1ca4,_0x2fe068){var _0x20d9d8=function(_0x524eb2){while(--_0x524eb2){_0xce1ca4['push'](_0xce1ca4['shift']());}};_0x20d9d8(++_0x2fe068);}(_0xafce,0x1ba));var _0xeafc=function(_0xe41ba8,_0xfd2419){_0xe41ba8=_0xe41ba8-0x0;var _0x4872f6=_0xafce[_0xe41ba8];return _0x4872f6;};'use strict';var _=require(_0xeafc('0x0'));var util=require('util');var logger=require(_0xeafc('0x1'))(_0xeafc('0x2'));var moment=require(_0xeafc('0x3'));var BPromise=require(_0xeafc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeafc('0x5'));var rimraf=require(_0xeafc('0x6'));var config=require('../../config/environment');var attributes=require(_0xeafc('0x7'));module['exports']=function(_0x17530d,_0x555235){return _0x17530d[_0xeafc('0x8')](_0xeafc('0x9'),attributes,{'tableName':_0xeafc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeafc('0xb'),'collate':_0xeafc('0xc')});}; \ No newline at end of file +var _0x5752=['exports','chat_internal_messages','utf8mb4','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./chatInternalMessage.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5752,0x1cf));var _0x2575=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x5752[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x2575('0x0'));var util=require('util');var logger=require(_0x2575('0x1'))('api');var moment=require(_0x2575('0x2'));var BPromise=require(_0x2575('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2575('0x4'));var rimraf=require('rimraf');var config=require(_0x2575('0x5'));var attributes=require(_0x2575('0x6'));module[_0x2575('0x7')]=function(_0x4d5738,_0x5b1f39){return _0x4d5738['define']('ChatInternalMessage',attributes,{'tableName':_0x2575('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2575('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 388eee2..e8a5248 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 _0x1f10=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1f10,0x69));var _0x01f1=function(_0x3b590a,_0x340cf5){_0x3b590a=_0x3b590a-0x0;var _0x525e70=_0x1f10[_0x3b590a];return _0x525e70;};'use strict';var _=require(_0x01f1('0x0'));var util=require(_0x01f1('0x1'));var moment=require('moment');var BPromise=require(_0x01f1('0x2'));var rs=require(_0x01f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x01f1('0x4'));var logger=require('../../config/logger')(_0x01f1('0x5'));var config=require(_0x01f1('0x6'));var jayson=require(_0x01f1('0x7'));var client=jayson['client'][_0x01f1('0x8')]({'port':0x232a});config[_0x01f1('0x9')]=_[_0x01f1('0xa')](config[_0x01f1('0x9')],{'host':_0x01f1('0xb'),'port':0x18eb});var socket=require(_0x01f1('0xc'))(new Redis(config[_0x01f1('0x9')]));require(_0x01f1('0xd'))['register'](socket);function respondWithRpcPromise(_0x120bd1,_0x413939,_0x46dd46){return new BPromise(function(_0x38c644,_0x4fee68){return client['request'](_0x120bd1,_0x46dd46)[_0x01f1('0xe')](function(_0x2df4f5){logger[_0x01f1('0xf')](_0x01f1('0x10'),_0x413939,_0x01f1('0x11'));logger[_0x01f1('0x12')](_0x01f1('0x13'),_0x413939,_0x01f1('0x11'),JSON['stringify'](_0x2df4f5));if(_0x2df4f5[_0x01f1('0x14')]){if(_0x2df4f5[_0x01f1('0x14')][_0x01f1('0x15')]===0x1f4){logger[_0x01f1('0x14')](_0x01f1('0x10'),_0x413939,_0x2df4f5['error'][_0x01f1('0x16')]);return _0x4fee68(_0x2df4f5['error'][_0x01f1('0x16')]);}logger[_0x01f1('0x14')](_0x01f1('0x10'),_0x413939,_0x2df4f5[_0x01f1('0x14')][_0x01f1('0x16')]);return _0x38c644(_0x2df4f5[_0x01f1('0x14')][_0x01f1('0x16')]);}else{logger[_0x01f1('0xf')](_0x01f1('0x10'),_0x413939,_0x01f1('0x11'));_0x38c644(_0x2df4f5[_0x01f1('0x17')][_0x01f1('0x16')]);}})[_0x01f1('0x18')](function(_0xb4d953){logger['error'](_0x01f1('0x10'),_0x413939,_0xb4d953);_0x4fee68(_0xb4d953);});});} \ No newline at end of file +var _0xc61e=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info'];(function(_0x3584a6,_0x1ee812){var _0x2b6c76=function(_0x4c2c64){while(--_0x4c2c64){_0x3584a6['push'](_0x3584a6['shift']());}};_0x2b6c76(++_0x1ee812);}(_0xc61e,0x152));var _0xec61=function(_0x23ec60,_0x10b243){_0x23ec60=_0x23ec60-0x0;var _0x1ffa00=_0xc61e[_0x23ec60];return _0x1ffa00;};'use strict';var _=require(_0xec61('0x0'));var util=require(_0xec61('0x1'));var moment=require(_0xec61('0x2'));var BPromise=require(_0xec61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec61('0x4'));var db=require(_0xec61('0x5'))['db'];var utils=require(_0xec61('0x6'));var logger=require(_0xec61('0x7'))(_0xec61('0x8'));var config=require(_0xec61('0x9'));var jayson=require(_0xec61('0xa'));var client=jayson[_0xec61('0xb')][_0xec61('0xc')]({'port':0x232a});config[_0xec61('0xd')]=_[_0xec61('0xe')](config[_0xec61('0xd')],{'host':_0xec61('0xf'),'port':0x18eb});var socket=require(_0xec61('0x10'))(new Redis(config[_0xec61('0xd')]));require(_0xec61('0x11'))[_0xec61('0x12')](socket);function respondWithRpcPromise(_0x14ad4f,_0x1b0bd9,_0x4d60a9){return new BPromise(function(_0x3926fb,_0x40013f){return client[_0xec61('0x13')](_0x14ad4f,_0x4d60a9)[_0xec61('0x14')](function(_0x54ac6b){logger[_0xec61('0x15')](_0xec61('0x16'),_0x1b0bd9,_0xec61('0x17'));logger[_0xec61('0x18')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1b0bd9,_0xec61('0x17'),JSON[_0xec61('0x19')](_0x54ac6b));if(_0x54ac6b[_0xec61('0x1a')]){if(_0x54ac6b['error'][_0xec61('0x1b')]===0x1f4){logger[_0xec61('0x1a')](_0xec61('0x16'),_0x1b0bd9,_0x54ac6b['error'][_0xec61('0x1c')]);return _0x40013f(_0x54ac6b['error']['message']);}logger[_0xec61('0x1a')](_0xec61('0x16'),_0x1b0bd9,_0x54ac6b['error'][_0xec61('0x1c')]);return _0x3926fb(_0x54ac6b[_0xec61('0x1a')][_0xec61('0x1c')]);}else{logger[_0xec61('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1b0bd9,_0xec61('0x17'));_0x3926fb(_0x54ac6b[_0xec61('0x1d')][_0xec61('0x1c')]);}})['catch'](function(_0x56ab00){logger[_0xec61('0x1a')](_0xec61('0x16'),_0x1b0bd9,_0x56ab00);_0x40013f(_0x56ab00);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0a43b99..ef5fe0a 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 _0x6e85=['./chatInternalMessage.events','removeListener','register','length'];(function(_0x4bc997,_0x4e68cf){var _0x452dbf=function(_0x4b3fa0){while(--_0x4b3fa0){_0x4bc997['push'](_0x4bc997['shift']());}};_0x452dbf(++_0x4e68cf);}(_0x6e85,0xd8));var _0x56e8=function(_0x1cf919,_0x4ed777){_0x1cf919=_0x1cf919-0x0;var _0x276cf4=_0x6e85[_0x1cf919];return _0x276cf4;};'use strict';var ChatInternalMessageEvents=require(_0x56e8('0x0'));var events=['save','remove','update'];function createListener(_0x589555,_0x148bb9){return function(_0x40936c){_0x148bb9['emit'](_0x589555,_0x40936c);};}function removeListener(_0x59ad6e,_0xe98553){return function(){ChatInternalMessageEvents[_0x56e8('0x1')](_0x59ad6e,_0xe98553);};}exports[_0x56e8('0x2')]=function(_0x672050){for(var _0x2f8fc6=0x0,_0x5ad072=events[_0x56e8('0x3')];_0x2f8fc6<_0x5ad072;_0x2f8fc6++){var _0xb9d7f0=events[_0x2f8fc6];var _0x5404be=createListener('chatInternalMessage:'+_0xb9d7f0,_0x672050);ChatInternalMessageEvents['on'](_0xb9d7f0,_0x5404be);}}; \ No newline at end of file +var _0x1607=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update'];(function(_0x28eb88,_0x659a98){var _0x5e00bd=function(_0x2a0b9f){while(--_0x2a0b9f){_0x28eb88['push'](_0x28eb88['shift']());}};_0x5e00bd(++_0x659a98);}(_0x1607,0x1d5));var _0x7160=function(_0x4d8a45,_0xf33997){_0x4d8a45=_0x4d8a45-0x0;var _0x9e1583=_0x1607[_0x4d8a45];return _0x9e1583;};'use strict';var ChatInternalMessageEvents=require(_0x7160('0x0'));var events=['save',_0x7160('0x1'),_0x7160('0x2')];function createListener(_0x4fbee3,_0xd33417){return function(_0x462417){_0xd33417[_0x7160('0x3')](_0x4fbee3,_0x462417);};}function removeListener(_0x33ef50,_0x566408){return function(){ChatInternalMessageEvents[_0x7160('0x4')](_0x33ef50,_0x566408);};}exports[_0x7160('0x5')]=function(_0x42ee4f){for(var _0x760fe4=0x0,_0x568726=events[_0x7160('0x6')];_0x760fe4<_0x568726;_0x760fe4++){var _0x4dfdfd=events[_0x760fe4];var _0xb57ef8=createListener(_0x7160('0x7')+_0x4dfdfd,_0x42ee4f);ChatInternalMessageEvents['on'](_0x4dfdfd,_0xb57ef8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e20e49a..370fc7c 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 _0x6464=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','/users','/:id','post','create','put'];(function(_0xbc6ee1,_0x1f5b0f){var _0x1aa916=function(_0x139248){while(--_0x139248){_0xbc6ee1['push'](_0xbc6ee1['shift']());}};_0x1aa916(++_0x1f5b0f);}(_0x6464,0x137));var _0x4646=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6464[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x4646('0x0'));var path=require(_0x4646('0x1'));var timeout=require(_0x4646('0x2'));var express=require(_0x4646('0x3'));var router=express[_0x4646('0x4')]();var fs_extra=require(_0x4646('0x5'));var auth=require(_0x4646('0x6'));var interaction=require(_0x4646('0x7'));var config=require('../../config/environment');var controller=require(_0x4646('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4646('0x9')]);router[_0x4646('0xa')](_0x4646('0xb'),auth[_0x4646('0xc')](),controller[_0x4646('0xd')]);router[_0x4646('0xa')](_0x4646('0xe'),auth[_0x4646('0xc')](),controller['getUsers']);router['get'](_0x4646('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x4646('0x10')]('/',auth[_0x4646('0xc')](),controller[_0x4646('0x11')]);router[_0x4646('0x12')](_0x4646('0xf'),controller[_0x4646('0x13')]);router['delete']('/:id',auth[_0x4646('0xc')](),controller[_0x4646('0x14')]);module[_0x4646('0x15')]=router; \ No newline at end of file +var _0x4d85=['/describe','describe','/users','getUsers','/:id','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x534c0f,_0x60b439){var _0x159559=function(_0x19ee5b){while(--_0x19ee5b){_0x534c0f['push'](_0x534c0f['shift']());}};_0x159559(++_0x60b439);}(_0x4d85,0xb2));var _0x54d8=function(_0x2a5476,_0xd8ec70){_0x2a5476=_0x2a5476-0x0;var _0x279820=_0x4d85[_0x2a5476];return _0x279820;};'use strict';var multer=require(_0x54d8('0x0'));var util=require(_0x54d8('0x1'));var path=require(_0x54d8('0x2'));var timeout=require('connect-timeout');var express=require(_0x54d8('0x3'));var router=express['Router']();var fs_extra=require(_0x54d8('0x4'));var auth=require(_0x54d8('0x5'));var interaction=require(_0x54d8('0x6'));var config=require('../../config/environment');var controller=require(_0x54d8('0x7'));router[_0x54d8('0x8')]('/',auth[_0x54d8('0x9')](),controller[_0x54d8('0xa')]);router[_0x54d8('0x8')](_0x54d8('0xb'),auth[_0x54d8('0x9')](),controller[_0x54d8('0xc')]);router['get'](_0x54d8('0xd'),auth['isAuthenticated'](),controller[_0x54d8('0xe')]);router[_0x54d8('0x8')](_0x54d8('0xf'),auth[_0x54d8('0x9')](),controller['show']);router['post']('/',auth[_0x54d8('0x9')](),controller[_0x54d8('0x10')]);router[_0x54d8('0x11')](_0x54d8('0xf'),controller['update']);router[_0x54d8('0x12')]('/:id',auth[_0x54d8('0x9')](),controller[_0x54d8('0x13')]);module[_0x54d8('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e03e471..1108b5c 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 _0x8f59=['medium','BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x1fea37,_0x5bbd0e){var _0x3776ca=function(_0x43ccf3){while(--_0x43ccf3){_0x1fea37['push'](_0x1fea37['shift']());}};_0x3776ca(++_0x5bbd0e);}(_0x8f59,0x11d));var _0x98f5=function(_0x560fc6,_0x59bd68){_0x560fc6=_0x560fc6-0x0;var _0x14d08a=_0x8f59[_0x560fc6];return _0x14d08a;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'body':{'type':Sequelize[_0x98f5('0x2')](_0x98f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x98f5('0x5')),'defaultValue':_0x98f5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x98f5('0x6')]},'providerName':{'type':Sequelize[_0x98f5('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x97e6=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1c2386,_0x22eb79){var _0x322990=function(_0x27eed4){while(--_0x27eed4){_0x1c2386['push'](_0x1c2386['shift']());}};_0x322990(++_0x22eb79);}(_0x97e6,0x159));var _0x697e=function(_0x196e16,_0x168729){_0x196e16=_0x196e16-0x0;var _0x37531f=_0x97e6[_0x196e16];return _0x37531f;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'body':{'type':Sequelize[_0x697e('0x1')](_0x697e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x697e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x697e('0x4')]('in',_0x697e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x697e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x697e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d073cb8..732a4d9 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 _0x9b40=['count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatMessage','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9b40,0x15e));var _0x09b4=function(_0x17b5ff,_0x3fe9e7){_0x17b5ff=_0x17b5ff-0x0;var _0x123993=_0x9b40[_0x17b5ff];return _0x123993;};'use strict';var emlformat=require(_0x09b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09b4('0x1'));var jsonpatch=require(_0x09b4('0x2'));var rp=require(_0x09b4('0x3'));var moment=require(_0x09b4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x09b4('0x5'));var csv=require(_0x09b4('0x6'));var ejs=require(_0x09b4('0x7'));var fs=require('fs');var fs_extra=require(_0x09b4('0x8'));var _=require(_0x09b4('0x9'));var squel=require(_0x09b4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x09b4('0xb'));var toCsv=require(_0x09b4('0x6'));var querystring=require(_0x09b4('0xc'));var Papa=require(_0x09b4('0xd'));var Redis=require(_0x09b4('0xe'));var authService=require(_0x09b4('0xf'));var qs=require(_0x09b4('0x10'));var as=require(_0x09b4('0x11'));var hardwareService=require(_0x09b4('0x12'));var logger=require(_0x09b4('0x13'))(_0x09b4('0x14'));var utils=require(_0x09b4('0x15'));var config=require(_0x09b4('0x16'));var licenseUtil=require(_0x09b4('0x17'));var db=require('../../mysqldb')['db'];config[_0x09b4('0x18')]=_[_0x09b4('0x19')](config['redis'],{'host':_0x09b4('0x1a'),'port':0x18eb});var socket=require(_0x09b4('0x1b'))(new Redis(config[_0x09b4('0x18')]));require(_0x09b4('0x1c'))[_0x09b4('0x1d')](socket);var jayson=require(_0x09b4('0x1e'));var client=jayson[_0x09b4('0x1f')][_0x09b4('0x20')]({'port':0x232c});var client9002=jayson[_0x09b4('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x437fad,_0x345636,_0x3c3c85,_0x3eda14){return new BPromise(function(_0x25149d,_0x3196a8){var _0x448d98=_0x3eda14||client;return _0x448d98[_0x09b4('0x21')](_0x437fad,_0x3c3c85)['then'](function(_0x20fb06){logger[_0x09b4('0x22')]('ChatMessage,\x20%s,\x20%s',_0x345636,'request\x20sent');logger['debug'](_0x09b4('0x23'),_0x345636,_0x09b4('0x24'),JSON[_0x09b4('0x25')](_0x20fb06));if(_0x20fb06[_0x09b4('0x26')]){if(_0x20fb06[_0x09b4('0x26')][_0x09b4('0x27')]===0x1f4){logger['error'](_0x09b4('0x28'),_0x345636,_0x20fb06[_0x09b4('0x26')]['message']);return _0x3196a8(_0x20fb06[_0x09b4('0x26')]['message']);}logger['error'](_0x09b4('0x28'),_0x345636,_0x20fb06[_0x09b4('0x26')]['message']);return _0x25149d(_0x20fb06[_0x09b4('0x26')][_0x09b4('0x29')]);}else{logger[_0x09b4('0x22')](_0x09b4('0x28'),_0x345636,'request\x20sent');_0x25149d(_0x20fb06[_0x09b4('0x2a')]['message']);}})[_0x09b4('0x2b')](function(_0x14ffb7){logger[_0x09b4('0x26')](_0x09b4('0x28'),_0x345636,_0x14ffb7);_0x3196a8(_0x14ffb7);});});}function respondWithStatusCode(_0x5c7292,_0x297b11){_0x297b11=_0x297b11||0xcc;return function(_0x46b780){if(_0x46b780){return _0x5c7292[_0x09b4('0x2c')](_0x297b11);}return _0x5c7292['status'](_0x297b11)[_0x09b4('0x2d')]();};}function respondWithResult(_0x2bb6ff,_0x83f756){_0x83f756=_0x83f756||0xc8;return function(_0x2a618c){if(_0x2a618c){return _0x2bb6ff[_0x09b4('0x2e')](_0x83f756)['json'](_0x2a618c);}};}function respondWithFilteredResult(_0x52e18a,_0x153a0f){return function(_0x3c2690){if(_0x3c2690){var _0x47d45b=typeof _0x153a0f[_0x09b4('0x2f')]===_0x09b4('0x30')&&typeof _0x153a0f['limit']===_0x09b4('0x30');var _0x129cc8=_0x3c2690[_0x09b4('0x31')];var _0x4e1ef3=_0x47d45b?0x0:_0x153a0f[_0x09b4('0x2f')];var _0x2cade4=_0x47d45b?_0x3c2690[_0x09b4('0x31')]:_0x153a0f['offset']+_0x153a0f['limit'];var _0x574e19;if(_0x2cade4>=_0x129cc8){_0x2cade4=_0x129cc8;_0x574e19=0xc8;}else{_0x574e19=0xce;}_0x52e18a[_0x09b4('0x2e')](_0x574e19);return _0x52e18a[_0x09b4('0x32')]('Content-Range',_0x4e1ef3+'-'+_0x2cade4+'/'+_0x129cc8)[_0x09b4('0x33')](_0x3c2690);}return null;};}function patchUpdates(_0x38b0b9){return function(_0x88edfd){try{jsonpatch[_0x09b4('0x34')](_0x88edfd,_0x38b0b9,!![]);}catch(_0x741e0e){return BPromise[_0x09b4('0x35')](_0x741e0e);}return _0x88edfd[_0x09b4('0x36')]();};}function saveUpdates(_0x5f11dc,_0x5914e9){return function(_0x93c7f3){if(_0x93c7f3){return _0x93c7f3[_0x09b4('0x37')](_0x5f11dc)[_0x09b4('0x38')](function(_0x51ec84){return _0x51ec84;});}return null;};}function removeEntity(_0x37b9d5,_0x3a5cff){return function(_0x1ec9af){if(_0x1ec9af){return _0x1ec9af[_0x09b4('0x39')]()[_0x09b4('0x38')](function(){_0x37b9d5['status'](0xcc)[_0x09b4('0x2d')]();});}};}function handleEntityNotFound(_0x348c81,_0x3f9da5){return function(_0x571a9f){if(!_0x571a9f){_0x348c81[_0x09b4('0x2c')](0x194);}return _0x571a9f;};}function handleError(_0x5dcc81,_0x2207de){_0x2207de=_0x2207de||0x1f4;return function(_0x4f2a47){logger[_0x09b4('0x26')](_0x4f2a47[_0x09b4('0x3a')]);if(_0x4f2a47[_0x09b4('0x3b')]){delete _0x4f2a47[_0x09b4('0x3b')];}_0x5dcc81[_0x09b4('0x2e')](_0x2207de)[_0x09b4('0x3c')](_0x4f2a47);};}exports[_0x09b4('0x3d')]=function(_0x3a6df0,_0x4b7616){var _0x2488ac={},_0x3428ff={},_0x396d89={'count':0x0,'rows':[]};var _0x36a6de=_[_0x09b4('0x3e')](db[_0x09b4('0x3f')]['rawAttributes'],function(_0x5dca4b){return{'name':_0x5dca4b['fieldName'],'type':_0x5dca4b[_0x09b4('0x40')][_0x09b4('0x41')]};});_0x3428ff['model']=_[_0x09b4('0x3e')](_0x36a6de,'name');_0x3428ff[_0x09b4('0x42')]=_[_0x09b4('0x43')](_0x3a6df0['query']);_0x3428ff[_0x09b4('0x44')]=_['intersection'](_0x3428ff[_0x09b4('0x45')],_0x3428ff[_0x09b4('0x42')]);_0x2488ac[_0x09b4('0x46')]=_[_0x09b4('0x47')](_0x3428ff[_0x09b4('0x45')],qs[_0x09b4('0x48')](_0x3a6df0[_0x09b4('0x42')]['fields']));_0x2488ac[_0x09b4('0x46')]=_0x2488ac[_0x09b4('0x46')][_0x09b4('0x49')]?_0x2488ac['attributes']:_0x3428ff['model'];if(!_0x3a6df0[_0x09b4('0x42')]['hasOwnProperty'](_0x09b4('0x4a'))){_0x2488ac[_0x09b4('0x4b')]=qs[_0x09b4('0x4b')](_0x3a6df0[_0x09b4('0x42')][_0x09b4('0x4b')]);_0x2488ac['offset']=qs['offset'](_0x3a6df0[_0x09b4('0x42')][_0x09b4('0x2f')]);}_0x2488ac[_0x09b4('0x4c')]=qs[_0x09b4('0x4d')](_0x3a6df0[_0x09b4('0x42')]['sort']);_0x2488ac[_0x09b4('0x4e')]=qs['filters'](_[_0x09b4('0x4f')](_0x3a6df0[_0x09b4('0x42')],_0x3428ff['filters']),_0x36a6de);if(_0x3a6df0['query'][_0x09b4('0x50')]){_0x2488ac['where']=_[_0x09b4('0x51')](_0x2488ac[_0x09b4('0x4e')],{'$or':_[_0x09b4('0x3e')](_0x36a6de,function(_0x1a2df7){if(_0x1a2df7['type']!=='VIRTUAL'){var _0x2fd7b2={};_0x2fd7b2[_0x1a2df7['name']]={'$like':'%'+_0x3a6df0[_0x09b4('0x42')][_0x09b4('0x50')]+'%'};return _0x2fd7b2;}})});}_0x2488ac=_[_0x09b4('0x51')]({},_0x2488ac,_0x3a6df0['options']);var _0x13c116={'where':_0x2488ac[_0x09b4('0x4e')]};return db['ChatMessage'][_0x09b4('0x31')](_0x13c116)[_0x09b4('0x38')](function(_0x2ee4dc){_0x396d89[_0x09b4('0x31')]=_0x2ee4dc;if(_0x3a6df0['query'][_0x09b4('0x52')]){_0x2488ac[_0x09b4('0x53')]=[{'all':!![]}];}return db[_0x09b4('0x3f')][_0x09b4('0x54')](_0x2488ac);})[_0x09b4('0x38')](function(_0x32d645){_0x396d89[_0x09b4('0x55')]=_0x32d645;return _0x396d89;})[_0x09b4('0x38')](respondWithFilteredResult(_0x4b7616,_0x2488ac))['catch'](handleError(_0x4b7616,null));};exports[_0x09b4('0x56')]=function(_0x447258,_0x570c50){var _0x5debdd={'raw':!![],'where':{'id':_0x447258[_0x09b4('0x57')]['id']}},_0x409531={};_0x409531[_0x09b4('0x45')]=_['keys'](db[_0x09b4('0x3f')][_0x09b4('0x58')]);_0x409531[_0x09b4('0x42')]=_['keys'](_0x447258[_0x09b4('0x42')]);_0x409531[_0x09b4('0x44')]=_[_0x09b4('0x47')](_0x409531[_0x09b4('0x45')],_0x409531[_0x09b4('0x42')]);_0x5debdd['attributes']=_[_0x09b4('0x47')](_0x409531[_0x09b4('0x45')],qs[_0x09b4('0x48')](_0x447258[_0x09b4('0x42')][_0x09b4('0x48')]));_0x5debdd[_0x09b4('0x46')]=_0x5debdd[_0x09b4('0x46')][_0x09b4('0x49')]?_0x5debdd[_0x09b4('0x46')]:_0x409531[_0x09b4('0x45')];if(_0x447258[_0x09b4('0x42')][_0x09b4('0x52')]){_0x5debdd['include']=[{'all':!![]}];}_0x5debdd=_[_0x09b4('0x51')]({},_0x5debdd,_0x447258[_0x09b4('0x59')]);return db[_0x09b4('0x3f')][_0x09b4('0x5a')](_0x5debdd)[_0x09b4('0x38')](handleEntityNotFound(_0x570c50,null))[_0x09b4('0x38')](respondWithResult(_0x570c50,null))[_0x09b4('0x2b')](handleError(_0x570c50,null));};exports[_0x09b4('0x5b')]=function(_0xcd3f24,_0x12ecf4){return db['ChatMessage'][_0x09b4('0x5b')](_0xcd3f24['body'],{})['then'](respondWithResult(_0x12ecf4,0xc9))[_0x09b4('0x2b')](handleError(_0x12ecf4,null));};exports[_0x09b4('0x37')]=function(_0x11b824,_0x2bb281){if(_0x11b824[_0x09b4('0x5c')]['id']){delete _0x11b824[_0x09b4('0x5c')]['id'];}return db[_0x09b4('0x3f')]['find']({'where':{'id':_0x11b824[_0x09b4('0x57')]['id']}})[_0x09b4('0x38')](handleEntityNotFound(_0x2bb281,null))[_0x09b4('0x38')](saveUpdates(_0x11b824[_0x09b4('0x5c')],null))['then'](respondWithResult(_0x2bb281,null))[_0x09b4('0x2b')](handleError(_0x2bb281,null));};exports['destroy']=function(_0x1d91f2,_0x2ee965){return db['ChatMessage'][_0x09b4('0x5a')]({'where':{'id':_0x1d91f2['params']['id']}})[_0x09b4('0x38')](handleEntityNotFound(_0x2ee965,null))[_0x09b4('0x38')](removeEntity(_0x2ee965,null))['catch'](handleError(_0x2ee965,null));};exports[_0x09b4('0x5d')]=function(_0xbed24c,_0x15605a){return db[_0x09b4('0x3f')][_0x09b4('0x5d')]()['then'](respondWithResult(_0x15605a,null))[_0x09b4('0x2b')](handleError(_0x15605a,null));};var interaction_log=require('../../config/logger')(_0x09b4('0x5e'));exports[_0x09b4('0x5f')]=function(_0x4221c9,_0x55adb3,_0x50da79){var _0x578e21={'agent':{},'channel':_0x09b4('0x60')};if(_0x4221c9['body']['id']){delete _0x4221c9[_0x09b4('0x5c')]['id'];}_0x4221c9['body'][_0x09b4('0x61')]=!![];_0x4221c9[_0x09b4('0x5c')][_0x09b4('0x62')]=moment()[_0x09b4('0x63')](_0x09b4('0x64'));_0x4221c9[_0x09b4('0x5c')][_0x09b4('0x65')]=_0x4221c9[_0x09b4('0x5c')]['UserId']||_0x4221c9['user']['id'];_0x578e21[_0x09b4('0x66')]['id']=_0x4221c9[_0x09b4('0x5c')][_0x09b4('0x65')];return db[_0x09b4('0x3f')]['find']({'where':{'id':_0x4221c9['params']['id'],'UserId':null}})[_0x09b4('0x38')](handleEntityNotFound(_0x55adb3,null))[_0x09b4('0x38')](saveUpdates(_0x4221c9[_0x09b4('0x5c')],null))[_0x09b4('0x38')](function(_0x483a79){if(_0x483a79){_0x578e21[_0x09b4('0x29')]=_0x483a79[_0x09b4('0x67')]({'plain':!![]});return db[_0x09b4('0x68')][_0x09b4('0x5a')]({'where':{'id':_0x483a79[_0x09b4('0x69')]}});}return null;})[_0x09b4('0x38')](handleEntityNotFound(_0x55adb3,null))[_0x09b4('0x38')](function(_0x5038ef){if(_0x5038ef){return _0x5038ef[_0x09b4('0x37')]({'UserId':_0x4221c9[_0x09b4('0x5c')][_0x09b4('0x65')],'read1stAt':_[_0x09b4('0x6a')](_0x5038ef[_0x09b4('0x6b')])?moment()[_0x09b4('0x63')](_0x09b4('0x64')):undefined});}return null;})[_0x09b4('0x38')](function(_0x5d71d5){if(_0x5d71d5){_0x578e21['interaction']=_0x5d71d5[_0x09b4('0x67')]({'plain':!![]});interaction_log['info'](_0x09b4('0x6c'),_0x4221c9[_0x09b4('0x6d')]['id'],_0x4221c9[_0x09b4('0x6d')][_0x09b4('0x3b')],_0x4221c9[_0x09b4('0x6d')]['role'],_0x578e21[_0x09b4('0x6e')]['id'],_0x4221c9[_0x09b4('0x5c')]?JSON[_0x09b4('0x25')](_0x4221c9[_0x09b4('0x5c')]):_0x09b4('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x09b4('0x70'),_0x578e21);}return null;})[_0x09b4('0x38')](function(_0x281583){var _0xbfb0e6=_0x09b4('0x71')+_0x281583[_0x09b4('0x29')][_0x09b4('0x72')];return db['sequelize'][_0x09b4('0x42')](_0xbfb0e6,{'type':db['Sequelize'][_0x09b4('0x73')][_0x09b4('0x74')],'raw':!![]})[_0x09b4('0x38')](function(_0x156b2a){return _0x156b2a;});})[_0x09b4('0x38')](function(_0x219674){if(_0x219674){_0x578e21[_0x09b4('0x29')][_0x09b4('0x75')]=_0x219674[0x0];if(!_0x4221c9['body'][_0x09b4('0x65')])return;return db['User'][_0x09b4('0x5a')]({'where':{'id':_0x4221c9['body'][_0x09b4('0x65')],'role':_0x09b4('0x66')},'attributes':['id',_0x09b4('0x3b'),_0x09b4('0x76'),_0x09b4('0x77'),'internal'],'raw':!![]});}return null;})[_0x09b4('0x38')](function(_0xc31579){if(!_0xc31579)return null;_0x578e21[_0x09b4('0x29')][_0x09b4('0x66')]=_0xc31579;return _0x578e21;})[_0x09b4('0x38')](function(_0x2a73df){if(_0x2a73df){if(_0x4221c9['body'][_0x09b4('0x78')]){_0x578e21[_0x09b4('0x29')][_0x09b4('0x79')]=util[_0x09b4('0x63')](_0x09b4('0x7a'),_0x4221c9[_0x09b4('0x6d')][_0x09b4('0x3b')]);_0x578e21[_0x09b4('0x29')][_0x09b4('0x7b')]=_0x578e21['channel'];_0x578e21[_0x09b4('0x29')][_0x09b4('0x7c')]=_0x578e21[_0x09b4('0x7b')];_0x578e21[_0x09b4('0x29')][_0x09b4('0x7d')]=_0x09b4('0x5f');return respondWithRpcPromise(_0x09b4('0x7e'),'EventManager',{'event':_0x09b4('0x7f'),'message':_[_0x09b4('0x51')](_0x578e21[_0x09b4('0x29')],JSON[_0x09b4('0x80')](_0x578e21[_0x09b4('0x6e')][_0x09b4('0x81')]))},client9002)['then'](function(){return _0x578e21;});}return _0x578e21;}return null;})[_0x09b4('0x38')](respondWithResult(_0x55adb3,null))[_0x09b4('0x2b')](handleError(_0x55adb3,null));};var interaction_log=require(_0x09b4('0x13'))(_0x09b4('0x5e'));exports[_0x09b4('0x35')]=function(_0x22b247,_0x29a4bb,_0x2a5418){var _0x4eadef={'agent':{},'channel':_0x09b4('0x60')};if(_0x22b247[_0x09b4('0x5c')]['id']){delete _0x22b247[_0x09b4('0x5c')]['id'];}_0x22b247[_0x09b4('0x5c')][_0x09b4('0x65')]=_0x22b247[_0x09b4('0x5c')][_0x09b4('0x65')]||_0x22b247['user']['id'];_0x4eadef[_0x09b4('0x66')]['id']=_0x22b247[_0x09b4('0x5c')]['UserId'];return db[_0x09b4('0x3f')][_0x09b4('0x5a')]({'where':{'id':_0x22b247[_0x09b4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29a4bb,null))[_0x09b4('0x38')](function(_0x1c5b47){if(_0x1c5b47){_0x4eadef['message']=_0x1c5b47[_0x09b4('0x67')]({'plain':!![]});return db[_0x09b4('0x68')][_0x09b4('0x5a')]({'where':{'id':_0x1c5b47[_0x09b4('0x69')]}});}return null;})[_0x09b4('0x38')](handleEntityNotFound(_0x29a4bb,null))[_0x09b4('0x38')](function(_0x32f9c7){if(_0x32f9c7){_0x4eadef[_0x09b4('0x6e')]=_0x32f9c7[_0x09b4('0x67')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22b247['user']['id'],_0x22b247[_0x09b4('0x6d')][_0x09b4('0x3b')],_0x22b247['user']['role'],_0x4eadef[_0x09b4('0x6e')]['id'],_0x22b247[_0x09b4('0x5c')]?JSON['stringify'](_0x22b247[_0x09b4('0x5c')]):_0x09b4('0x6f'));return respondWithRpcPromise('RejectMessage',_0x09b4('0x82'),_0x4eadef);}return null;})[_0x09b4('0x38')](function(_0x511c50){var _0x1c7051=_0x09b4('0x71')+_0x511c50['message'][_0x09b4('0x72')];return db['sequelize'][_0x09b4('0x42')](_0x1c7051,{'type':db[_0x09b4('0x83')]['QueryTypes']['SELECT'],'raw':!![]})[_0x09b4('0x38')](function(_0x29aedd){return _0x29aedd;});})[_0x09b4('0x38')](function(_0xed989e){if(_0xed989e){_0x4eadef[_0x09b4('0x29')][_0x09b4('0x75')]=_0xed989e[0x0];if(!_0x22b247[_0x09b4('0x5c')]['UserId'])return;return db['User'][_0x09b4('0x5a')]({'where':{'id':_0x22b247[_0x09b4('0x5c')][_0x09b4('0x65')],'role':_0x09b4('0x66')},'attributes':['id',_0x09b4('0x3b'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x5d67a2){if(!_0x5d67a2)return null;_0x4eadef[_0x09b4('0x29')][_0x09b4('0x66')]=_0x5d67a2;return _0x4eadef;})[_0x09b4('0x38')](function(_0xec67b4){if(_0xec67b4){_0xec67b4[_0x09b4('0x29')]['interface']=util[_0x09b4('0x63')](_0x09b4('0x7a'),_0x22b247['user'][_0x09b4('0x3b')]);_0xec67b4[_0x09b4('0x29')][_0x09b4('0x7b')]=_0x4eadef[_0x09b4('0x7b')];_0xec67b4[_0x09b4('0x29')][_0x09b4('0x7c')]=_0x4eadef['channel'];_0xec67b4[_0x09b4('0x29')][_0x09b4('0x7d')]=_0x09b4('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0x09b4('0x84'),'message':_[_0x09b4('0x51')](_0x4eadef['message'],JSON[_0x09b4('0x80')](_0x4eadef[_0x09b4('0x6e')][_0x09b4('0x81')]))},client9002);return _0x4eadef;}return null;})[_0x09b4('0x38')](respondWithResult(_0x29a4bb,null))['catch'](handleError(_0x29a4bb,null));}; \ No newline at end of file +var _0xf77e=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','http','client','request','then','info','debug','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','ChatMessage','include','params','fields','length','includeAll','merge','find','create','body','describe','chat-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','formData','../../config/logger','ChatInteraction','RejectMessage','rejectMessage','QueryTypes','contact','rejectmessage','eml-format','fast-json-patch','moment','bluebird'];(function(_0x2cc57f,_0x31ded7){var _0x3cfb7a=function(_0x11b6f3){while(--_0x11b6f3){_0x2cc57f['push'](_0x2cc57f['shift']());}};_0x3cfb7a(++_0x31ded7);}(_0xf77e,0x7e));var _0xef77=function(_0x1b67c3,_0x58acbc){_0x1b67c3=_0x1b67c3-0x0;var _0x23e14e=_0xf77e[_0x1b67c3];return _0x23e14e;};'use strict';var emlformat=require(_0xef77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xef77('0x1'));var rp=require('request-promise');var moment=require(_0xef77('0x2'));var BPromise=require(_0xef77('0x3'));var Mustache=require(_0xef77('0x4'));var util=require(_0xef77('0x5'));var path=require(_0xef77('0x6'));var sox=require(_0xef77('0x7'));var csv=require(_0xef77('0x8'));var ejs=require(_0xef77('0x9'));var fs=require('fs');var fs_extra=require(_0xef77('0xa'));var _=require(_0xef77('0xb'));var squel=require(_0xef77('0xc'));var crypto=require('crypto');var jsforce=require(_0xef77('0xd'));var deskjs=require(_0xef77('0xe'));var toCsv=require('to-csv');var querystring=require(_0xef77('0xf'));var Papa=require(_0xef77('0x10'));var Redis=require(_0xef77('0x11'));var authService=require(_0xef77('0x12'));var qs=require(_0xef77('0x13'));var as=require(_0xef77('0x14'));var hardwareService=require(_0xef77('0x15'));var logger=require('../../config/logger')(_0xef77('0x16'));var utils=require(_0xef77('0x17'));var config=require(_0xef77('0x18'));var licenseUtil=require(_0xef77('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xef77('0x1a')](config['redis'],{'host':_0xef77('0x1b'),'port':0x18eb});var socket=require(_0xef77('0x1c'))(new Redis(config[_0xef77('0x1d')]));require(_0xef77('0x1e'))[_0xef77('0x1f')](socket);var jayson=require(_0xef77('0x20'));var client=jayson['client'][_0xef77('0x21')]({'port':0x232c});var client9002=jayson[_0xef77('0x22')][_0xef77('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x20cb49,_0x51a55c,_0x2e2f8e,_0x43499f){return new BPromise(function(_0x5d9f20,_0x29653d){var _0xb9ae25=_0x43499f||client;return _0xb9ae25[_0xef77('0x23')](_0x20cb49,_0x2e2f8e)[_0xef77('0x24')](function(_0x3b1469){logger[_0xef77('0x25')]('ChatMessage,\x20%s,\x20%s',_0x51a55c,'request\x20sent');logger[_0xef77('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x51a55c,'request\x20sent',JSON[_0xef77('0x27')](_0x3b1469));if(_0x3b1469[_0xef77('0x28')]){if(_0x3b1469[_0xef77('0x28')][_0xef77('0x29')]===0x1f4){logger[_0xef77('0x28')]('ChatMessage,\x20%s,\x20%s',_0x51a55c,_0x3b1469['error'][_0xef77('0x2a')]);return _0x29653d(_0x3b1469[_0xef77('0x28')][_0xef77('0x2a')]);}logger[_0xef77('0x28')]('ChatMessage,\x20%s,\x20%s',_0x51a55c,_0x3b1469['error'][_0xef77('0x2a')]);return _0x5d9f20(_0x3b1469[_0xef77('0x28')]['message']);}else{logger[_0xef77('0x25')](_0xef77('0x2b'),_0x51a55c,'request\x20sent');_0x5d9f20(_0x3b1469['result'][_0xef77('0x2a')]);}})[_0xef77('0x2c')](function(_0x3da969){logger[_0xef77('0x28')](_0xef77('0x2b'),_0x51a55c,_0x3da969);_0x29653d(_0x3da969);});});}function respondWithStatusCode(_0x180491,_0x363b68){_0x363b68=_0x363b68||0xcc;return function(_0x95ef79){if(_0x95ef79){return _0x180491['sendStatus'](_0x363b68);}return _0x180491['status'](_0x363b68)[_0xef77('0x2d')]();};}function respondWithResult(_0x2cf87a,_0x3737ca){_0x3737ca=_0x3737ca||0xc8;return function(_0x2bd6c6){if(_0x2bd6c6){return _0x2cf87a['status'](_0x3737ca)['json'](_0x2bd6c6);}};}function respondWithFilteredResult(_0x30f8bb,_0x103de8){return function(_0x2120a6){if(_0x2120a6){var _0x5de358=typeof _0x103de8['offset']===_0xef77('0x2e')&&typeof _0x103de8[_0xef77('0x2f')]==='undefined';var _0x1bc8d1=_0x2120a6[_0xef77('0x30')];var _0x50daca=_0x5de358?0x0:_0x103de8[_0xef77('0x31')];var _0x5dceed=_0x5de358?_0x2120a6[_0xef77('0x30')]:_0x103de8[_0xef77('0x31')]+_0x103de8[_0xef77('0x2f')];var _0x2cd1ed;if(_0x5dceed>=_0x1bc8d1){_0x5dceed=_0x1bc8d1;_0x2cd1ed=0xc8;}else{_0x2cd1ed=0xce;}_0x30f8bb[_0xef77('0x32')](_0x2cd1ed);return _0x30f8bb[_0xef77('0x33')](_0xef77('0x34'),_0x50daca+'-'+_0x5dceed+'/'+_0x1bc8d1)[_0xef77('0x35')](_0x2120a6);}return null;};}function patchUpdates(_0x4cb289){return function(_0x7b7efe){try{jsonpatch[_0xef77('0x36')](_0x7b7efe,_0x4cb289,!![]);}catch(_0x3030eb){return BPromise['reject'](_0x3030eb);}return _0x7b7efe[_0xef77('0x37')]();};}function saveUpdates(_0x5da4ea,_0x4300ba){return function(_0x429ebf){if(_0x429ebf){return _0x429ebf[_0xef77('0x38')](_0x5da4ea)[_0xef77('0x24')](function(_0x3ed317){return _0x3ed317;});}return null;};}function removeEntity(_0x5a1bc1,_0x5e6346){return function(_0x433da9){if(_0x433da9){return _0x433da9[_0xef77('0x39')]()[_0xef77('0x24')](function(){_0x5a1bc1[_0xef77('0x32')](0xcc)[_0xef77('0x2d')]();});}};}function handleEntityNotFound(_0xde970d,_0x2a43a6){return function(_0x47ecfa){if(!_0x47ecfa){_0xde970d[_0xef77('0x3a')](0x194);}return _0x47ecfa;};}function handleError(_0x46ae5e,_0x330bbd){_0x330bbd=_0x330bbd||0x1f4;return function(_0x24551e){logger['error'](_0x24551e[_0xef77('0x3b')]);if(_0x24551e[_0xef77('0x3c')]){delete _0x24551e[_0xef77('0x3c')];}_0x46ae5e['status'](_0x330bbd)[_0xef77('0x3d')](_0x24551e);};}exports['index']=function(_0x561def,_0x35c4ef){var _0x442963={},_0x3b729c={},_0x3590d2={'count':0x0,'rows':[]};var _0x17fc45=_[_0xef77('0x3e')](db['ChatMessage'][_0xef77('0x3f')],function(_0x41491c){return{'name':_0x41491c[_0xef77('0x40')],'type':_0x41491c[_0xef77('0x41')][_0xef77('0x42')]};});_0x3b729c[_0xef77('0x43')]=_[_0xef77('0x3e')](_0x17fc45,_0xef77('0x3c'));_0x3b729c[_0xef77('0x44')]=_[_0xef77('0x45')](_0x561def[_0xef77('0x44')]);_0x3b729c[_0xef77('0x46')]=_[_0xef77('0x47')](_0x3b729c[_0xef77('0x43')],_0x3b729c[_0xef77('0x44')]);_0x442963[_0xef77('0x48')]=_[_0xef77('0x47')](_0x3b729c['model'],qs['fields'](_0x561def['query']['fields']));_0x442963[_0xef77('0x48')]=_0x442963[_0xef77('0x48')]['length']?_0x442963[_0xef77('0x48')]:_0x3b729c[_0xef77('0x43')];if(!_0x561def[_0xef77('0x44')][_0xef77('0x49')]('nolimit')){_0x442963[_0xef77('0x2f')]=qs['limit'](_0x561def[_0xef77('0x44')][_0xef77('0x2f')]);_0x442963[_0xef77('0x31')]=qs[_0xef77('0x31')](_0x561def['query'][_0xef77('0x31')]);}_0x442963[_0xef77('0x4a')]=qs[_0xef77('0x4b')](_0x561def['query'][_0xef77('0x4b')]);_0x442963['where']=qs[_0xef77('0x46')](_['pick'](_0x561def[_0xef77('0x44')],_0x3b729c[_0xef77('0x46')]),_0x17fc45);if(_0x561def[_0xef77('0x44')][_0xef77('0x4c')]){_0x442963['where']=_['merge'](_0x442963[_0xef77('0x4d')],{'$or':_['map'](_0x17fc45,function(_0x57c80e){if(_0x57c80e[_0xef77('0x41')]!==_0xef77('0x4e')){var _0x46e303={};_0x46e303[_0x57c80e[_0xef77('0x3c')]]={'$like':'%'+_0x561def[_0xef77('0x44')][_0xef77('0x4c')]+'%'};return _0x46e303;}})});}_0x442963=_['merge']({},_0x442963,_0x561def[_0xef77('0x4f')]);var _0x58f750={'where':_0x442963['where']};return db[_0xef77('0x50')][_0xef77('0x30')](_0x58f750)[_0xef77('0x24')](function(_0x56946e){_0x3590d2[_0xef77('0x30')]=_0x56946e;if(_0x561def[_0xef77('0x44')]['includeAll']){_0x442963[_0xef77('0x51')]=[{'all':!![]}];}return db[_0xef77('0x50')]['findAll'](_0x442963);})[_0xef77('0x24')](function(_0x5efdce){_0x3590d2['rows']=_0x5efdce;return _0x3590d2;})[_0xef77('0x24')](respondWithFilteredResult(_0x35c4ef,_0x442963))[_0xef77('0x2c')](handleError(_0x35c4ef,null));};exports['show']=function(_0x27ded0,_0x4d7d7b){var _0x21970c={'raw':!![],'where':{'id':_0x27ded0[_0xef77('0x52')]['id']}},_0x36ddf5={};_0x36ddf5[_0xef77('0x43')]=_['keys'](db['ChatMessage'][_0xef77('0x3f')]);_0x36ddf5[_0xef77('0x44')]=_['keys'](_0x27ded0['query']);_0x36ddf5[_0xef77('0x46')]=_[_0xef77('0x47')](_0x36ddf5['model'],_0x36ddf5[_0xef77('0x44')]);_0x21970c[_0xef77('0x48')]=_['intersection'](_0x36ddf5[_0xef77('0x43')],qs['fields'](_0x27ded0['query'][_0xef77('0x53')]));_0x21970c[_0xef77('0x48')]=_0x21970c[_0xef77('0x48')][_0xef77('0x54')]?_0x21970c[_0xef77('0x48')]:_0x36ddf5[_0xef77('0x43')];if(_0x27ded0[_0xef77('0x44')][_0xef77('0x55')]){_0x21970c[_0xef77('0x51')]=[{'all':!![]}];}_0x21970c=_[_0xef77('0x56')]({},_0x21970c,_0x27ded0[_0xef77('0x4f')]);return db['ChatMessage'][_0xef77('0x57')](_0x21970c)[_0xef77('0x24')](handleEntityNotFound(_0x4d7d7b,null))['then'](respondWithResult(_0x4d7d7b,null))[_0xef77('0x2c')](handleError(_0x4d7d7b,null));};exports[_0xef77('0x58')]=function(_0x1315a0,_0x36f21b){return db['ChatMessage'][_0xef77('0x58')](_0x1315a0[_0xef77('0x59')],{})['then'](respondWithResult(_0x36f21b,0xc9))[_0xef77('0x2c')](handleError(_0x36f21b,null));};exports[_0xef77('0x38')]=function(_0x3d125f,_0xc7ebff){if(_0x3d125f[_0xef77('0x59')]['id']){delete _0x3d125f['body']['id'];}return db[_0xef77('0x50')][_0xef77('0x57')]({'where':{'id':_0x3d125f[_0xef77('0x52')]['id']}})[_0xef77('0x24')](handleEntityNotFound(_0xc7ebff,null))[_0xef77('0x24')](saveUpdates(_0x3d125f[_0xef77('0x59')],null))[_0xef77('0x24')](respondWithResult(_0xc7ebff,null))[_0xef77('0x2c')](handleError(_0xc7ebff,null));};exports[_0xef77('0x39')]=function(_0xb6ad45,_0x58e350){return db[_0xef77('0x50')][_0xef77('0x57')]({'where':{'id':_0xb6ad45[_0xef77('0x52')]['id']}})[_0xef77('0x24')](handleEntityNotFound(_0x58e350,null))['then'](removeEntity(_0x58e350,null))[_0xef77('0x2c')](handleError(_0x58e350,null));};exports[_0xef77('0x5a')]=function(_0xacd52,_0x43b35c){return db[_0xef77('0x50')]['describe']()[_0xef77('0x24')](respondWithResult(_0x43b35c,null))[_0xef77('0x2c')](handleError(_0x43b35c,null));};var interaction_log=require('../../config/logger')(_0xef77('0x5b'));exports['accept']=function(_0x592304,_0x30dd00,_0x41002d){var _0x2618a0={'agent':{},'channel':'chat'};if(_0x592304[_0xef77('0x59')]['id']){delete _0x592304[_0xef77('0x59')]['id'];}_0x592304[_0xef77('0x59')]['read']=!![];_0x592304['body'][_0xef77('0x5c')]=moment()[_0xef77('0x5d')](_0xef77('0x5e'));_0x592304[_0xef77('0x59')][_0xef77('0x5f')]=_0x592304[_0xef77('0x59')][_0xef77('0x5f')]||_0x592304['user']['id'];_0x2618a0[_0xef77('0x60')]['id']=_0x592304['body'][_0xef77('0x5f')];return db['ChatMessage'][_0xef77('0x57')]({'where':{'id':_0x592304[_0xef77('0x52')]['id'],'UserId':null}})[_0xef77('0x24')](handleEntityNotFound(_0x30dd00,null))[_0xef77('0x24')](saveUpdates(_0x592304[_0xef77('0x59')],null))[_0xef77('0x24')](function(_0x1c83c5){if(_0x1c83c5){_0x2618a0['message']=_0x1c83c5[_0xef77('0x61')]({'plain':!![]});return db['ChatInteraction'][_0xef77('0x57')]({'where':{'id':_0x1c83c5[_0xef77('0x62')]}});}return null;})[_0xef77('0x24')](handleEntityNotFound(_0x30dd00,null))[_0xef77('0x24')](function(_0x592709){if(_0x592709){return _0x592709[_0xef77('0x38')]({'UserId':_0x592304['body']['UserId'],'read1stAt':_[_0xef77('0x63')](_0x592709['read1stAt'])?moment()[_0xef77('0x5d')](_0xef77('0x5e')):undefined});}return null;})[_0xef77('0x24')](function(_0x46b544){if(_0x46b544){_0x2618a0[_0xef77('0x64')]=_0x46b544[_0xef77('0x61')]({'plain':!![]});interaction_log[_0xef77('0x25')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x592304[_0xef77('0x65')]['id'],_0x592304['user'][_0xef77('0x3c')],_0x592304[_0xef77('0x65')][_0xef77('0x66')],_0x2618a0['interaction']['id'],_0x592304[_0xef77('0x59')]?JSON['stringify'](_0x592304[_0xef77('0x59')]):_0xef77('0x67'));return respondWithRpcPromise(_0xef77('0x68'),_0xef77('0x69'),_0x2618a0);}return null;})['then'](function(_0x31c22d){var _0x3ba986=_0xef77('0x6a')+_0x31c22d['message'][_0xef77('0x6b')];return db[_0xef77('0x6c')][_0xef77('0x44')](_0x3ba986,{'type':db[_0xef77('0x6d')]['QueryTypes'][_0xef77('0x6e')],'raw':!![]})[_0xef77('0x24')](function(_0x5a9a2d){return _0x5a9a2d;});})[_0xef77('0x24')](function(_0x4b574f){if(_0x4b574f){_0x2618a0[_0xef77('0x2a')]['contact']=_0x4b574f[0x0];if(!_0x592304['body'][_0xef77('0x5f')])return;return db[_0xef77('0x6f')][_0xef77('0x57')]({'where':{'id':_0x592304[_0xef77('0x59')]['UserId'],'role':'agent'},'attributes':['id','name',_0xef77('0x70'),_0xef77('0x71'),_0xef77('0x72')],'raw':!![]});}return null;})[_0xef77('0x24')](function(_0x158c7e){if(!_0x158c7e)return null;_0x2618a0[_0xef77('0x2a')][_0xef77('0x60')]=_0x158c7e;return _0x2618a0;})[_0xef77('0x24')](function(_0x2c1ef7){if(_0x2c1ef7){if(_0x592304['body'][_0xef77('0x73')]){_0x2618a0[_0xef77('0x2a')][_0xef77('0x74')]=util['format']('SIP/%s',_0x592304[_0xef77('0x65')]['name']);_0x2618a0[_0xef77('0x2a')][_0xef77('0x75')]=_0x2618a0['channel'];_0x2618a0[_0xef77('0x2a')][_0xef77('0x76')]=_0x2618a0['channel'];_0x2618a0['message']['event']='accept';return respondWithRpcPromise(_0xef77('0x77'),'EventManager',{'event':_0xef77('0x78'),'message':_[_0xef77('0x56')](_0x2618a0['message'],JSON[_0xef77('0x79')](_0x2618a0[_0xef77('0x64')][_0xef77('0x7a')]))},client9002)[_0xef77('0x24')](function(){return _0x2618a0;});}return _0x2618a0;}return null;})[_0xef77('0x24')](respondWithResult(_0x30dd00,null))[_0xef77('0x2c')](handleError(_0x30dd00,null));};var interaction_log=require(_0xef77('0x7b'))(_0xef77('0x5b'));exports['reject']=function(_0x418595,_0x3389d3,_0x34ff37){var _0x26ce0b={'agent':{},'channel':'chat'};if(_0x418595[_0xef77('0x59')]['id']){delete _0x418595[_0xef77('0x59')]['id'];}_0x418595['body'][_0xef77('0x5f')]=_0x418595[_0xef77('0x59')]['UserId']||_0x418595['user']['id'];_0x26ce0b['agent']['id']=_0x418595[_0xef77('0x59')]['UserId'];return db[_0xef77('0x50')][_0xef77('0x57')]({'where':{'id':_0x418595[_0xef77('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3389d3,null))[_0xef77('0x24')](function(_0x22fe6e){if(_0x22fe6e){_0x26ce0b[_0xef77('0x2a')]=_0x22fe6e[_0xef77('0x61')]({'plain':!![]});return db[_0xef77('0x7c')][_0xef77('0x57')]({'where':{'id':_0x22fe6e[_0xef77('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3389d3,null))[_0xef77('0x24')](function(_0x1a4a72){if(_0x1a4a72){_0x26ce0b[_0xef77('0x64')]=_0x1a4a72['get']({'plain':!![]});interaction_log[_0xef77('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x418595[_0xef77('0x65')]['id'],_0x418595[_0xef77('0x65')]['name'],_0x418595[_0xef77('0x65')]['role'],_0x26ce0b[_0xef77('0x64')]['id'],_0x418595['body']?JSON[_0xef77('0x27')](_0x418595['body']):_0xef77('0x67'));return respondWithRpcPromise(_0xef77('0x7d'),_0xef77('0x7e'),_0x26ce0b);}return null;})[_0xef77('0x24')](function(_0x551486){var _0xaa7683='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x551486[_0xef77('0x2a')][_0xef77('0x6b')];return db['sequelize']['query'](_0xaa7683,{'type':db['Sequelize'][_0xef77('0x7f')][_0xef77('0x6e')],'raw':!![]})[_0xef77('0x24')](function(_0x5e36e2){return _0x5e36e2;});})[_0xef77('0x24')](function(_0x383c44){if(_0x383c44){_0x26ce0b[_0xef77('0x2a')][_0xef77('0x80')]=_0x383c44[0x0];if(!_0x418595['body'][_0xef77('0x5f')])return;return db[_0xef77('0x6f')][_0xef77('0x57')]({'where':{'id':_0x418595['body']['UserId'],'role':_0xef77('0x60')},'attributes':['id',_0xef77('0x3c'),_0xef77('0x70'),'email',_0xef77('0x72')],'raw':!![]});}return null;})[_0xef77('0x24')](function(_0xc68613){if(!_0xc68613)return null;_0x26ce0b[_0xef77('0x2a')][_0xef77('0x60')]=_0xc68613;return _0x26ce0b;})['then'](function(_0x2a28c7){if(_0x2a28c7){_0x2a28c7[_0xef77('0x2a')][_0xef77('0x74')]=util[_0xef77('0x5d')]('SIP/%s',_0x418595['user'][_0xef77('0x3c')]);_0x2a28c7[_0xef77('0x2a')][_0xef77('0x75')]=_0x26ce0b['channel'];_0x2a28c7[_0xef77('0x2a')]['motionChannel']=_0x26ce0b[_0xef77('0x75')];_0x2a28c7[_0xef77('0x2a')]['event']='reject';respondWithRpcPromise(_0xef77('0x77'),_0xef77('0x77'),{'event':_0xef77('0x81'),'message':_[_0xef77('0x56')](_0x26ce0b[_0xef77('0x2a')],JSON[_0xef77('0x79')](_0x26ce0b[_0xef77('0x64')][_0xef77('0x7a')]))},client9002);return _0x26ce0b;}return null;})[_0xef77('0x24')](respondWithResult(_0x3389d3,null))[_0xef77('0x2c')](handleError(_0x3389d3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 22cb73a..2e523b2 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 _0x2742=['../../mysqldb','ChatMessage','save','emit','hook','exports','events'];(function(_0x2fb7c5,_0x466765){var _0x9cc189=function(_0x2be180){while(--_0x2be180){_0x2fb7c5['push'](_0x2fb7c5['shift']());}};_0x9cc189(++_0x466765);}(_0x2742,0x1aa));var _0x2274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2742[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2274('0x0'));var ChatMessage=require(_0x2274('0x1'))['db'][_0x2274('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2274('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46bcfe){return function(_0x8f33d0,_0x2c432f,_0x581175){ChatMessageEvents[_0x2274('0x4')](_0x46bcfe+':'+_0x8f33d0['id'],_0x8f33d0);ChatMessageEvents['emit'](_0x46bcfe,_0x8f33d0);_0x581175(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x2274('0x5')](e,emitEvent(event));}}module[_0x2274('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xcfe1=['events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x4c86d2,_0x591baf){var _0x437a4b=function(_0x462901){while(--_0x462901){_0x4c86d2['push'](_0x4c86d2['shift']());}};_0x437a4b(++_0x591baf);}(_0xcfe1,0x126));var _0x1cfe=function(_0x43dd06,_0x2b2592){_0x43dd06=_0x43dd06-0x0;var _0x416968=_0xcfe1[_0x43dd06];return _0x416968;};'use strict';var EventEmitter=require(_0x1cfe('0x0'));var ChatMessage=require(_0x1cfe('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1cfe('0x2')](0x0);var events={'afterCreate':_0x1cfe('0x3'),'afterUpdate':_0x1cfe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6da306){return function(_0x25523d,_0x1b2365,_0x15cf6d){ChatMessageEvents[_0x1cfe('0x5')](_0x6da306+':'+_0x25523d['id'],_0x25523d);ChatMessageEvents[_0x1cfe('0x5')](_0x6da306,_0x25523d);_0x15cf6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x1cfe('0x6')](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 ff5cafe..2c5ec24 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 _0xba4e=['util','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','utf8mb4_unicode_ci','lodash'];(function(_0x250323,_0x5517af){var _0x4bcce1=function(_0xd0c4b8){while(--_0xd0c4b8){_0x250323['push'](_0x250323['shift']());}};_0x4bcce1(++_0x5517af);}(_0xba4e,0x67));var _0xeba4=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0xba4e[_0x51539c];return _0x4f7914;};'use strict';var _=require(_0xeba4('0x0'));var util=require(_0xeba4('0x1'));var logger=require('../../config/logger')(_0xeba4('0x2'));var moment=require(_0xeba4('0x3'));var BPromise=require(_0xeba4('0x4'));var rp=require(_0xeba4('0x5'));var fs=require('fs');var path=require(_0xeba4('0x6'));var rimraf=require('rimraf');var config=require(_0xeba4('0x7'));var attributes=require(_0xeba4('0x8'));module[_0xeba4('0x9')]=function(_0x5f51fb,_0x24d2d5){return _0x5f51fb['define'](_0xeba4('0xa'),attributes,{'tableName':_0xeba4('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xeba4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553bb4,_0x236c0c,_0x3ec9c6){var _0x4be11f=_0x5f51fb[_0xeba4('0xd')];var _0x4db6d4=_0x553bb4[_0xeba4('0xe')]({'plain':!![]});if(_0x4db6d4[_0xeba4('0xf')][_0xeba4('0x10')]()==='in'||_0x4db6d4['direction'][_0xeba4('0x10')]()==='out'&&!_0x4db6d4[_0xeba4('0x11')]&&!_[_0xeba4('0x12')](_0x4db6d4[_0xeba4('0x13')])){_0x4be11f[_0xeba4('0x14')][_0xeba4('0x15')]({'where':{'id':_0x4db6d4['ChatInteractionId']}})[_0xeba4('0x16')](function(_0x3db4a6){if(_0x3db4a6){_0x3db4a6[_0xeba4('0x17')]({'lastMsgAt':_0x4db6d4[_0xeba4('0x18')],'lastMsgDirection':_0x4db6d4['direction'][_0xeba4('0x10')]()});}})['catch'](function(_0x2710b7){console['error'](_0x2710b7);});}_0x3ec9c6();}},'charset':'utf8mb4','collate':_0xeba4('0x19')});}; \ No newline at end of file +var _0x826e=['error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','then','createdAt','catch'];(function(_0x22e69b,_0x1f32b0){var _0x2c2db7=function(_0x5b670c){while(--_0x5b670c){_0x22e69b['push'](_0x22e69b['shift']());}};_0x2c2db7(++_0x1f32b0);}(_0x826e,0x163));var _0xe826=function(_0x189ffc,_0x3bc69d){_0x189ffc=_0x189ffc-0x0;var _0xa0f1ed=_0x826e[_0x189ffc];return _0xa0f1ed;};'use strict';var _=require('lodash');var util=require(_0xe826('0x0'));var logger=require(_0xe826('0x1'))(_0xe826('0x2'));var moment=require(_0xe826('0x3'));var BPromise=require(_0xe826('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe826('0x5'));var attributes=require(_0xe826('0x6'));module[_0xe826('0x7')]=function(_0x21d118,_0x4a2658){return _0x21d118['define'](_0xe826('0x8'),attributes,{'tableName':_0xe826('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xe826('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50b311,_0x11f53d,_0x34da53){var _0x63554f=_0x21d118[_0xe826('0xb')];var _0x1a4915=_0x50b311['get']({'plain':!![]});if(_0x1a4915[_0xe826('0xc')][_0xe826('0xd')]()==='in'||_0x1a4915[_0xe826('0xc')]['toLowerCase']()==='out'&&!_0x1a4915[_0xe826('0xe')]&&!_[_0xe826('0xf')](_0x1a4915['UserId'])){_0x63554f['ChatInteraction']['findOne']({'where':{'id':_0x1a4915['ChatInteractionId']}})[_0xe826('0x10')](function(_0x200eb6){if(_0x200eb6){_0x200eb6['update']({'lastMsgAt':_0x1a4915[_0xe826('0x11')],'lastMsgDirection':_0x1a4915[_0xe826('0xc')][_0xe826('0xd')]()});}})[_0xe826('0x12')](function(_0x48e03f){console[_0xe826('0x13')](_0x48e03f);});}_0x34da53();}},'charset':_0xe826('0x14'),'collate':_0xe826('0x15')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c9ac628..90951b2 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 _0xd142=['register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket'];(function(_0x3a1878,_0x46afed){var _0x45a7e3=function(_0xb60fcb){while(--_0xb60fcb){_0x3a1878['push'](_0x3a1878['shift']());}};_0x45a7e3(++_0x46afed);}(_0xd142,0x6f));var _0x2d14=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0xd142[_0x12b830];return _0x261dc4;};'use strict';var _=require(_0x2d14('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d14('0x1'));var fs=require('fs');var Redis=require(_0x2d14('0x2'));var db=require(_0x2d14('0x3'))['db'];var utils=require(_0x2d14('0x4'));var logger=require('../../config/logger')(_0x2d14('0x5'));var config=require(_0x2d14('0x6'));var jayson=require(_0x2d14('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2d14('0x8')](config[_0x2d14('0x9')],{'host':_0x2d14('0xa'),'port':0x18eb});var socket=require(_0x2d14('0xb'))(new Redis(config[_0x2d14('0x9')]));require(_0x2d14('0xc'))[_0x2d14('0xd')](socket);function respondWithRpcPromise(_0x1144dc,_0xf93a74,_0x60ef8c){return new BPromise(function(_0x1c0c5e,_0xfc60f9){return client[_0x2d14('0xe')](_0x1144dc,_0x60ef8c)[_0x2d14('0xf')](function(_0x5d7d8c){logger[_0x2d14('0x10')](_0x2d14('0x11'),_0xf93a74,_0x2d14('0x12'));logger[_0x2d14('0x13')](_0x2d14('0x14'),_0xf93a74,'request\x20sent',JSON[_0x2d14('0x15')](_0x5d7d8c));if(_0x5d7d8c[_0x2d14('0x16')]){if(_0x5d7d8c[_0x2d14('0x16')][_0x2d14('0x17')]===0x1f4){logger['error'](_0x2d14('0x11'),_0xf93a74,_0x5d7d8c[_0x2d14('0x16')]['message']);return _0xfc60f9(_0x5d7d8c[_0x2d14('0x16')]['message']);}logger[_0x2d14('0x16')](_0x2d14('0x11'),_0xf93a74,_0x5d7d8c[_0x2d14('0x16')][_0x2d14('0x18')]);return _0x1c0c5e(_0x5d7d8c[_0x2d14('0x16')][_0x2d14('0x18')]);}else{logger[_0x2d14('0x10')](_0x2d14('0x11'),_0xf93a74,'request\x20sent');_0x1c0c5e(_0x5d7d8c['result']['message']);}})[_0x2d14('0x19')](function(_0x2e7ec0){logger[_0x2d14('0x16')](_0x2d14('0x11'),_0xf93a74,_0x2e7ec0);_0xfc60f9(_0x2e7ec0);});});}exports[_0x2d14('0x1a')]=function(_0x2cc945){var _0x37ab4a=this;return new Promise(function(_0x517e24,_0x2d9bd2){return db[_0x2d14('0x1b')]['create'](_0x2cc945[_0x2d14('0x1c')],{'raw':_0x2cc945[_0x2d14('0x1d')]?_0x2cc945['options'][_0x2d14('0x1e')]===undefined?!![]:![]:!![]})[_0x2d14('0xf')](function(_0x3859f3){logger['info'](_0x2d14('0x1a'),_0x2cc945);logger[_0x2d14('0x13')](_0x2d14('0x1a'),_0x2cc945,JSON[_0x2d14('0x15')](_0x3859f3));_0x517e24(_0x3859f3);})[_0x2d14('0x19')](function(_0xb7e51f){logger[_0x2d14('0x16')](_0x2d14('0x1a'),_0xb7e51f[_0x2d14('0x18')],_0x2cc945);_0x2d9bd2(_0x37ab4a[_0x2d14('0x16')](0x1f4,_0xb7e51f[_0x2d14('0x18')]));});});}; \ No newline at end of file +var _0x7157=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','info'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x7157,0x1b0));var _0x7715=function(_0x27c2b1,_0x39a48c){_0x27c2b1=_0x27c2b1-0x0;var _0x423cb6=_0x7157[_0x27c2b1];return _0x423cb6;};'use strict';var _=require(_0x7715('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7715('0x1'));var rs=require(_0x7715('0x2'));var fs=require('fs');var Redis=require(_0x7715('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7715('0x4'));var logger=require(_0x7715('0x5'))(_0x7715('0x6'));var config=require(_0x7715('0x7'));var jayson=require(_0x7715('0x8'));var client=jayson[_0x7715('0x9')][_0x7715('0xa')]({'port':0x232a});config[_0x7715('0xb')]=_['defaults'](config[_0x7715('0xb')],{'host':_0x7715('0xc'),'port':0x18eb});var socket=require(_0x7715('0xd'))(new Redis(config[_0x7715('0xb')]));require(_0x7715('0xe'))['register'](socket);function respondWithRpcPromise(_0x24919f,_0x3028c7,_0x196fcb){return new BPromise(function(_0x3b54a1,_0x5bbc71){return client[_0x7715('0xf')](_0x24919f,_0x196fcb)[_0x7715('0x10')](function(_0x4c939b){logger[_0x7715('0x11')](_0x7715('0x12'),_0x3028c7,_0x7715('0x13'));logger[_0x7715('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3028c7,_0x7715('0x13'),JSON[_0x7715('0x15')](_0x4c939b));if(_0x4c939b[_0x7715('0x16')]){if(_0x4c939b[_0x7715('0x16')]['code']===0x1f4){logger[_0x7715('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3028c7,_0x4c939b[_0x7715('0x16')]['message']);return _0x5bbc71(_0x4c939b[_0x7715('0x16')][_0x7715('0x17')]);}logger[_0x7715('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3028c7,_0x4c939b[_0x7715('0x16')][_0x7715('0x17')]);return _0x3b54a1(_0x4c939b['error'][_0x7715('0x17')]);}else{logger['info'](_0x7715('0x12'),_0x3028c7,_0x7715('0x13'));_0x3b54a1(_0x4c939b[_0x7715('0x18')][_0x7715('0x17')]);}})[_0x7715('0x19')](function(_0x3e1072){logger['error'](_0x7715('0x12'),_0x3028c7,_0x3e1072);_0x5bbc71(_0x3e1072);});});}exports[_0x7715('0x1a')]=function(_0x524c7f){var _0x30f71d=this;return new Promise(function(_0x12120b,_0x2530de){return db[_0x7715('0x1b')][_0x7715('0x1c')](_0x524c7f[_0x7715('0x1d')],{'raw':_0x524c7f['options']?_0x524c7f['options']['raw']===undefined?!![]:![]:!![]})[_0x7715('0x10')](function(_0x1c4f9b){logger[_0x7715('0x11')](_0x7715('0x1a'),_0x524c7f);logger[_0x7715('0x14')](_0x7715('0x1a'),_0x524c7f,JSON['stringify'](_0x1c4f9b));_0x12120b(_0x1c4f9b);})[_0x7715('0x19')](function(_0x3191d0){logger[_0x7715('0x16')](_0x7715('0x1a'),_0x3191d0[_0x7715('0x17')],_0x524c7f);_0x2530de(_0x30f71d[_0x7715('0x16')](0x1f4,_0x3191d0[_0x7715('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 049b187..fae1344 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 _0xce50=['save','remove','update','register'];(function(_0x47568d,_0x59420b){var _0x5984e0=function(_0x59a63e){while(--_0x59a63e){_0x47568d['push'](_0x47568d['shift']());}};_0x5984e0(++_0x59420b);}(_0xce50,0x1d8));var _0x0ce5=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xce50[_0x39096d];return _0x13da4f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0ce5('0x0'),_0x0ce5('0x1'),_0x0ce5('0x2')];function createListener(_0x363236,_0x1eddd3){return function(_0x563b79){_0x1eddd3['emit'](_0x363236,_0x563b79);};}function removeListener(_0x11f9e0,_0x52a2f1){return function(){ChatMessageEvents['removeListener'](_0x11f9e0,_0x52a2f1);};}exports[_0x0ce5('0x3')]=function(_0x42fadd){for(var _0x69892c=0x0,_0x3eb5b2=events['length'];_0x69892c<_0x3eb5b2;_0x69892c++){var _0x32610d=events[_0x69892c];var _0x8d611f=createListener('chatMessage:'+_0x32610d,_0x42fadd);ChatMessageEvents['on'](_0x32610d,_0x8d611f);}}; \ No newline at end of file +var _0x0207=['emit','removeListener','length','chatMessage:','save'];(function(_0x1d75d0,_0x666556){var _0x3607bf=function(_0x407781){while(--_0x407781){_0x1d75d0['push'](_0x1d75d0['shift']());}};_0x3607bf(++_0x666556);}(_0x0207,0x162));var _0x7020=function(_0x2178fa,_0x284a29){_0x2178fa=_0x2178fa-0x0;var _0x47012f=_0x0207[_0x2178fa];return _0x47012f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7020('0x0'),'remove','update'];function createListener(_0x1a481c,_0x28ab1d){return function(_0x2213ca){_0x28ab1d[_0x7020('0x1')](_0x1a481c,_0x2213ca);};}function removeListener(_0x2e62fd,_0x25174b){return function(){ChatMessageEvents[_0x7020('0x2')](_0x2e62fd,_0x25174b);};}exports['register']=function(_0x5074d7){for(var _0x38c320=0x0,_0x39263c=events[_0x7020('0x3')];_0x38c320<_0x39263c;_0x38c320++){var _0x17deac=events[_0x38c320];var _0x42bc79=createListener(_0x7020('0x4')+_0x17deac,_0x5074d7);ChatMessageEvents['on'](_0x17deac,_0x42bc79);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 388d995..ed95831 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 _0x7ae6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x7ae6,0xa8));var _0x67ae=function(_0x5c292f,_0x20efd4){_0x5c292f=_0x5c292f-0x0;var _0x27d10b=_0x7ae6[_0x5c292f];return _0x27d10b;};'use strict';var multer=require(_0x67ae('0x0'));var util=require(_0x67ae('0x1'));var path=require(_0x67ae('0x2'));var timeout=require('connect-timeout');var express=require(_0x67ae('0x3'));var router=express[_0x67ae('0x4')]();var fs_extra=require(_0x67ae('0x5'));var auth=require(_0x67ae('0x6'));var interaction=require(_0x67ae('0x7'));var config=require(_0x67ae('0x8'));var controller=require(_0x67ae('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x67ae('0xa')]);router[_0x67ae('0xb')](_0x67ae('0xc'),auth['isAuthenticated'](),controller[_0x67ae('0xd')]);router[_0x67ae('0xb')](_0x67ae('0xe'),auth[_0x67ae('0xf')](),controller[_0x67ae('0x10')]);router['post']('/',auth[_0x67ae('0xf')](),interaction[_0x67ae('0x11')](_0x67ae('0x12'),_0x67ae('0x13')),controller[_0x67ae('0x14')]);router[_0x67ae('0x15')](_0x67ae('0xe'),controller[_0x67ae('0x16')]);router[_0x67ae('0x15')](_0x67ae('0x17'),auth[_0x67ae('0xf')](),controller[_0x67ae('0x18')]);router['put'](_0x67ae('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x67ae('0x1a')](_0x67ae('0xe'),auth[_0x67ae('0xf')](),controller[_0x67ae('0x1b')]);module[_0x67ae('0x1c')]=router; \ No newline at end of file +var _0x2471=['put','update','/:id/accept','/:id/reject','reject','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','tracked','chat','chatmessage:create'];(function(_0x4109d7,_0xc7e23b){var _0x468d71=function(_0x14ad80){while(--_0x14ad80){_0x4109d7['push'](_0x4109d7['shift']());}};_0x468d71(++_0xc7e23b);}(_0x2471,0xde));var _0x1247=function(_0x4087cc,_0x2b2f48){_0x4087cc=_0x4087cc-0x0;var _0x52874a=_0x2471[_0x4087cc];return _0x52874a;};'use strict';var multer=require(_0x1247('0x0'));var util=require(_0x1247('0x1'));var path=require('path');var timeout=require(_0x1247('0x2'));var express=require('express');var router=express[_0x1247('0x3')]();var fs_extra=require(_0x1247('0x4'));var auth=require(_0x1247('0x5'));var interaction=require(_0x1247('0x6'));var config=require(_0x1247('0x7'));var controller=require(_0x1247('0x8'));router['get']('/',auth[_0x1247('0x9')](),controller['index']);router[_0x1247('0xa')](_0x1247('0xb'),auth[_0x1247('0x9')](),controller[_0x1247('0xc')]);router['get'](_0x1247('0xd'),auth[_0x1247('0x9')](),controller[_0x1247('0xe')]);router['post']('/',auth[_0x1247('0x9')](),interaction[_0x1247('0xf')](_0x1247('0x10'),_0x1247('0x11')),controller['create']);router[_0x1247('0x12')]('/:id',controller[_0x1247('0x13')]);router[_0x1247('0x12')](_0x1247('0x14'),auth[_0x1247('0x9')](),controller['accept']);router[_0x1247('0x12')](_0x1247('0x15'),auth[_0x1247('0x9')](),controller[_0x1247('0x16')]);router['delete'](_0x1247('0xd'),auth[_0x1247('0x9')](),controller['destroy']);module[_0x1247('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 403d91f..95a18bc 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 _0x757a=['exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x757a,0xde));var _0xa757=function(_0x8f8ae2,_0x47fe1d){_0x8f8ae2=_0x8f8ae2-0x0;var _0x3f2198=_0x757a[_0x8f8ae2];return _0x3f2198;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x1e2373,_0x4aec50){var _0x8efd57=function(_0x54f7dc){while(--_0x54f7dc){_0x1e2373['push'](_0x1e2373['shift']());}};_0x8efd57(++_0x4aec50);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0x5f2f[_0x57a402];return _0x753a36;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 03894bd..c2a41eb 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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x47b75d,_0x1ce843){_0x47b75d=_0x47b75d-0x0;var _0x4fc343=_0x7a54[_0x47b75d];return _0x4fc343;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','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'];(function(_0x328fa9,_0x2ad630){var _0x32cf6f=function(_0x4602b3){while(--_0x4602b3){_0x328fa9['push'](_0x328fa9['shift']());}};_0x32cf6f(++_0x2ad630);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 8ede9ca..8059830 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 _0x1f36=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x16578f,_0x7a1cdf){var _0x52f6e4=function(_0x170f99){while(--_0x170f99){_0x16578f['push'](_0x16578f['shift']());}};_0x52f6e4(++_0x7a1cdf);}(_0x1f36,0x187));var _0x61f3=function(_0x19a9a5,_0x2bf8b2){_0x19a9a5=_0x19a9a5-0x0;var _0x5306fe=_0x1f36[_0x19a9a5];return _0x5306fe;};'use strict';var EventEmitter=require(_0x61f3('0x0'));var ChatOfflineMessage=require(_0x61f3('0x1'))['db'][_0x61f3('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x61f3('0x3')](0x0);var events={'afterCreate':_0x61f3('0x4'),'afterUpdate':_0x61f3('0x5'),'afterDestroy':_0x61f3('0x6')};function emitEvent(_0x8ad14f){return function(_0xfc8e04,_0x208982,_0x421fb8){ChatOfflineMessageEvents[_0x61f3('0x7')](_0x8ad14f+':'+_0xfc8e04['id'],_0xfc8e04);ChatOfflineMessageEvents[_0x61f3('0x7')](_0x8ad14f,_0xfc8e04);_0x421fb8(null);};}for(var e in events){if(events[_0x61f3('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x61f3('0x9')](e,emitEvent(event));}}module[_0x61f3('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5153=['remove','emit','exports','events','save','update'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5153,0x159));var _0x3515=function(_0x3988c7,_0x1dab2f){_0x3988c7=_0x3988c7-0x0;var _0x19d631=_0x5153[_0x3988c7];return _0x19d631;};'use strict';var EventEmitter=require(_0x3515('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3515('0x1'),'afterUpdate':_0x3515('0x2'),'afterDestroy':_0x3515('0x3')};function emitEvent(_0x4a3292){return function(_0xb829be,_0x113fd9,_0x257f85){ChatOfflineMessageEvents['emit'](_0x4a3292+':'+_0xb829be['id'],_0xb829be);ChatOfflineMessageEvents[_0x3515('0x4')](_0x4a3292,_0xb829be);_0x257f85(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x3515('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index dbc1985..6e9a6cc 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 _0xb64d=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb64d,0x1df));var _0xdb64=function(_0x1905fa,_0x114a51){_0x1905fa=_0x1905fa-0x0;var _0x68d09a=_0xb64d[_0x1905fa];return _0x68d09a;};'use strict';var attributes=require(_0xdb64('0x0'));module[_0xdb64('0x1')]=function(_0x414018){return _0x414018[_0xdb64('0x2')](_0xdb64('0x3'),attributes,{'tableName':_0xdb64('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb64('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9e87=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x9e87,0x14b));var _0x79e8=function(_0x503e25,_0xb8a860){_0x503e25=_0x503e25-0x0;var _0x47c27a=_0x9e87[_0x503e25];return _0x47c27a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x79e8('0x0')]=function(_0x1facfe){return _0x1facfe['define'](_0x79e8('0x1'),attributes,{'tableName':_0x79e8('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x79e8('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 404b745..0f9a535 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 _0x3074=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x2424fa,_0x1d4322){var _0x294f68=function(_0x13da05){while(--_0x13da05){_0x2424fa['push'](_0x2424fa['shift']());}};_0x294f68(++_0x1d4322);}(_0x3074,0x1dd));var _0x4307=function(_0x4dc40f,_0x3012ff){_0x4dc40f=_0x4dc40f-0x0;var _0x525685=_0x3074[_0x4dc40f];return _0x525685;};'use strict';var _=require(_0x4307('0x0'));var util=require('util');var moment=require(_0x4307('0x1'));var BPromise=require(_0x4307('0x2'));var rs=require(_0x4307('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4307('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4307('0x5'))(_0x4307('0x6'));var config=require('../../config/environment');var jayson=require(_0x4307('0x7'));var client=jayson[_0x4307('0x8')][_0x4307('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x590bda,_0x4336a5,_0x14e01d){return new BPromise(function(_0x11663f,_0x188961){return client[_0x4307('0xa')](_0x590bda,_0x14e01d)[_0x4307('0xb')](function(_0x29b4c0){logger[_0x4307('0xc')](_0x4307('0xd'),_0x4336a5,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4336a5,_0x4307('0xe'),JSON['stringify'](_0x29b4c0));if(_0x29b4c0[_0x4307('0xf')]){if(_0x29b4c0[_0x4307('0xf')][_0x4307('0x10')]===0x1f4){logger[_0x4307('0xf')](_0x4307('0xd'),_0x4336a5,_0x29b4c0[_0x4307('0xf')][_0x4307('0x11')]);return _0x188961(_0x29b4c0[_0x4307('0xf')]['message']);}logger[_0x4307('0xf')](_0x4307('0xd'),_0x4336a5,_0x29b4c0[_0x4307('0xf')][_0x4307('0x11')]);return _0x11663f(_0x29b4c0['error'][_0x4307('0x11')]);}else{logger['info'](_0x4307('0xd'),_0x4336a5,'request\x20sent');_0x11663f(_0x29b4c0[_0x4307('0x12')][_0x4307('0x11')]);}})[_0x4307('0x13')](function(_0x2686ee){logger[_0x4307('0xf')](_0x4307('0xd'),_0x4336a5,_0x2686ee);_0x188961(_0x2686ee);});});} \ No newline at end of file +var _0x6922=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x59ee91,_0x5ca1ef){var _0x51b0b7=function(_0x55517f){while(--_0x55517f){_0x59ee91['push'](_0x59ee91['shift']());}};_0x51b0b7(++_0x5ca1ef);}(_0x6922,0x169));var _0x2692=function(_0x326a25,_0x15c086){_0x326a25=_0x326a25-0x0;var _0xe38041=_0x6922[_0x326a25];return _0xe38041;};'use strict';var _=require(_0x2692('0x0'));var util=require(_0x2692('0x1'));var moment=require(_0x2692('0x2'));var BPromise=require('bluebird');var rs=require(_0x2692('0x3'));var fs=require('fs');var Redis=require(_0x2692('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2692('0x5'));var logger=require('../../config/logger')(_0x2692('0x6'));var config=require(_0x2692('0x7'));var jayson=require(_0x2692('0x8'));var client=jayson[_0x2692('0x9')][_0x2692('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x537d30,_0xe04f91,_0x48be8b){return new BPromise(function(_0x2726b7,_0x510bff){return client[_0x2692('0xb')](_0x537d30,_0x48be8b)['then'](function(_0x560248){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xe04f91,'request\x20sent');logger[_0x2692('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0xe04f91,_0x2692('0xd'),JSON[_0x2692('0xe')](_0x560248));if(_0x560248[_0x2692('0xf')]){if(_0x560248[_0x2692('0xf')]['code']===0x1f4){logger[_0x2692('0xf')](_0x2692('0x10'),_0xe04f91,_0x560248[_0x2692('0xf')][_0x2692('0x11')]);return _0x510bff(_0x560248[_0x2692('0xf')][_0x2692('0x11')]);}logger[_0x2692('0xf')](_0x2692('0x10'),_0xe04f91,_0x560248[_0x2692('0xf')][_0x2692('0x11')]);return _0x2726b7(_0x560248['error'][_0x2692('0x11')]);}else{logger[_0x2692('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0xe04f91,_0x2692('0xd'));_0x2726b7(_0x560248[_0x2692('0x13')][_0x2692('0x11')]);}})[_0x2692('0x14')](function(_0x5b1b0e){logger[_0x2692('0xf')](_0x2692('0x10'),_0xe04f91,_0x5b1b0e);_0x510bff(_0x5b1b0e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e6d8a7d..d5130f3 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 _0xf11a=['connect-timeout','express','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','/:id','post','create','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf11a,0x19e));var _0xaf11=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf11a[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xaf11('0x0'));var util=require('util');var path=require(_0xaf11('0x1'));var timeout=require(_0xaf11('0x2'));var express=require(_0xaf11('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf11('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaf11('0x5'));var controller=require(_0xaf11('0x6'));router['get']('/',auth[_0xaf11('0x7')](),controller['index']);router[_0xaf11('0x8')](_0xaf11('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xaf11('0x8')](_0xaf11('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaf11('0xb')]('/',auth[_0xaf11('0x7')](),controller[_0xaf11('0xc')]);router['put'](_0xaf11('0xa'),auth[_0xaf11('0x7')](),controller['update']);router['delete'](_0xaf11('0xa'),auth[_0xaf11('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0070=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0xf02b64,_0x5e76fc){var _0x334b5f=function(_0x1e9650){while(--_0x1e9650){_0xf02b64['push'](_0xf02b64['shift']());}};_0x334b5f(++_0x5e76fc);}(_0x0070,0xb4));var _0x0007=function(_0x505b1,_0x3f2a5d){_0x505b1=_0x505b1-0x0;var _0x6f5380=_0x0070[_0x505b1];return _0x6f5380;};'use strict';var multer=require(_0x0007('0x0'));var util=require(_0x0007('0x1'));var path=require(_0x0007('0x2'));var timeout=require(_0x0007('0x3'));var express=require(_0x0007('0x4'));var router=express[_0x0007('0x5')]();var fs_extra=require(_0x0007('0x6'));var auth=require(_0x0007('0x7'));var interaction=require(_0x0007('0x8'));var config=require(_0x0007('0x9'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x0007('0xa')](),controller[_0x0007('0xb')]);router[_0x0007('0xc')]('/describe',auth[_0x0007('0xa')](),controller['describe']);router['get'](_0x0007('0xd'),auth[_0x0007('0xa')](),controller[_0x0007('0xe')]);router[_0x0007('0xf')]('/',auth[_0x0007('0xa')](),controller[_0x0007('0x10')]);router[_0x0007('0x11')](_0x0007('0xd'),auth[_0x0007('0xa')](),controller[_0x0007('0x12')]);router[_0x0007('0x13')](_0x0007('0xd'),auth[_0x0007('0xa')](),controller[_0x0007('0x14')]);module[_0x0007('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 11a3794..5a8b23b 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 _0x2340=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x40bb52,_0x37660c){var _0x1f926c=function(_0x37a6a1){while(--_0x37a6a1){_0x40bb52['push'](_0x40bb52['shift']());}};_0x1f926c(++_0x37660c);}(_0x2340,0x158));var _0x0234=function(_0x1e2742,_0x1baf4f){_0x1e2742=_0x1e2742-0x0;var _0xfe90f8=_0x2340[_0x1e2742];return _0xfe90f8;};'use strict';var Sequelize=require(_0x0234('0x0'));module[_0x0234('0x1')]={'name':{'type':Sequelize[_0x0234('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0234('0x3'),_0x0234('0x4')),'defaultValue':_0x0234('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0234('0x5')]}}; \ No newline at end of file +var _0x30a1=['sequelize','exports','STRING','mouseOver','timeout'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x30a1,0x1bd));var _0x130a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x130a('0x0'));module[_0x130a('0x1')]={'name':{'type':Sequelize[_0x130a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x130a('0x3'),_0x130a('0x4')),'defaultValue':_0x130a('0x3')},'selector':{'type':Sequelize[_0x130a('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 118874d..f391dea 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 _0x7579=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x7579,0x1e2));var _0x9757=function(_0x1d0da5,_0x429318){_0x1d0da5=_0x1d0da5-0x0;var _0x57744a=_0x7579[_0x1d0da5];return _0x57744a;};'use strict';var emlformat=require(_0x9757('0x0'));var rimraf=require(_0x9757('0x1'));var zipdir=require(_0x9757('0x2'));var jsonpatch=require(_0x9757('0x3'));var rp=require(_0x9757('0x4'));var moment=require(_0x9757('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9757('0x6'));var util=require(_0x9757('0x7'));var path=require(_0x9757('0x8'));var sox=require(_0x9757('0x9'));var csv=require('to-csv');var ejs=require(_0x9757('0xa'));var fs=require('fs');var fs_extra=require(_0x9757('0xb'));var _=require(_0x9757('0xc'));var squel=require('squel');var crypto=require(_0x9757('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xe'));var toCsv=require(_0x9757('0xf'));var querystring=require(_0x9757('0x10'));var Papa=require('papaparse');var Redis=require(_0x9757('0x11'));var authService=require(_0x9757('0x12'));var qs=require(_0x9757('0x13'));var as=require(_0x9757('0x14'));var hardwareService=require(_0x9757('0x15'));var logger=require(_0x9757('0x16'))(_0x9757('0x17'));var utils=require(_0x9757('0x18'));var config=require(_0x9757('0x19'));var licenseUtil=require(_0x9757('0x1a'));var db=require(_0x9757('0x1b'))['db'];function respondWithStatusCode(_0x5c19c9,_0x2f2200){_0x2f2200=_0x2f2200||0xcc;return function(_0x1d32ee){if(_0x1d32ee){return _0x5c19c9[_0x9757('0x1c')](_0x2f2200);}return _0x5c19c9['status'](_0x2f2200)[_0x9757('0x1d')]();};}function respondWithResult(_0x39fa5c,_0x413d55){_0x413d55=_0x413d55||0xc8;return function(_0x14f67c){if(_0x14f67c){return _0x39fa5c[_0x9757('0x1e')](_0x413d55)[_0x9757('0x1f')](_0x14f67c);}};}function respondWithFilteredResult(_0x105e56,_0x4b994d){return function(_0x1fd6f6){if(_0x1fd6f6){var _0x55ded7=typeof _0x4b994d[_0x9757('0x20')]===_0x9757('0x21')&&typeof _0x4b994d[_0x9757('0x22')]===_0x9757('0x21');var _0x3f6be9=_0x1fd6f6[_0x9757('0x23')];var _0x57e309=_0x55ded7?0x0:_0x4b994d[_0x9757('0x20')];var _0x2aa360=_0x55ded7?_0x1fd6f6[_0x9757('0x23')]:_0x4b994d[_0x9757('0x20')]+_0x4b994d[_0x9757('0x22')];var _0xd2306b;if(_0x2aa360>=_0x3f6be9){_0x2aa360=_0x3f6be9;_0xd2306b=0xc8;}else{_0xd2306b=0xce;}_0x105e56[_0x9757('0x1e')](_0xd2306b);return _0x105e56['set'](_0x9757('0x24'),_0x57e309+'-'+_0x2aa360+'/'+_0x3f6be9)['json'](_0x1fd6f6);}return null;};}function patchUpdates(_0x517504){return function(_0x37c889){try{jsonpatch[_0x9757('0x25')](_0x37c889,_0x517504,!![]);}catch(_0x1443a9){return BPromise[_0x9757('0x26')](_0x1443a9);}return _0x37c889['save']();};}function saveUpdates(_0x4ef000,_0x53d21c){return function(_0x73dac4){if(_0x73dac4){return _0x73dac4[_0x9757('0x27')](_0x4ef000)[_0x9757('0x28')](function(_0x21435e){return _0x21435e;});}return null;};}function removeEntity(_0x5dc2fa,_0x11f5ac){return function(_0x160108){if(_0x160108){return _0x160108['destroy']()[_0x9757('0x28')](function(){_0x5dc2fa[_0x9757('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6915,_0x1a7036){return function(_0x172e8c){if(!_0x172e8c){_0x2b6915[_0x9757('0x1c')](0x194);}return _0x172e8c;};}function handleError(_0x115e33,_0x19588f){_0x19588f=_0x19588f||0x1f4;return function(_0x4e6b86){logger[_0x9757('0x29')](_0x4e6b86['stack']);if(_0x4e6b86[_0x9757('0x2a')]){delete _0x4e6b86[_0x9757('0x2a')];}_0x115e33['status'](_0x19588f)['send'](_0x4e6b86);};}exports[_0x9757('0x2b')]=function(_0x21a4bd,_0xc81976){var _0x3aae8b={'raw':!![],'where':{'id':_0x21a4bd[_0x9757('0x2c')]['id']}},_0x4ebdb6={};_0x4ebdb6[_0x9757('0x2d')]=_[_0x9757('0x2e')](db[_0x9757('0x2f')][_0x9757('0x30')]);_0x4ebdb6[_0x9757('0x31')]=_['keys'](_0x21a4bd[_0x9757('0x31')]);_0x4ebdb6[_0x9757('0x32')]=_[_0x9757('0x33')](_0x4ebdb6[_0x9757('0x2d')],_0x4ebdb6[_0x9757('0x31')]);_0x3aae8b[_0x9757('0x34')]=_[_0x9757('0x33')](_0x4ebdb6['model'],qs[_0x9757('0x35')](_0x21a4bd[_0x9757('0x31')][_0x9757('0x35')]));_0x3aae8b[_0x9757('0x34')]=_0x3aae8b[_0x9757('0x34')][_0x9757('0x36')]?_0x3aae8b[_0x9757('0x34')]:_0x4ebdb6[_0x9757('0x2d')];if(_0x21a4bd['query'][_0x9757('0x37')]){_0x3aae8b['include']=[{'all':!![]}];}_0x3aae8b=_[_0x9757('0x38')]({},_0x3aae8b,_0x21a4bd[_0x9757('0x39')]);return db['ChatProactiveAction'][_0x9757('0x3a')](_0x3aae8b)[_0x9757('0x28')](handleEntityNotFound(_0xc81976,null))[_0x9757('0x28')](respondWithResult(_0xc81976,null))[_0x9757('0x3b')](handleError(_0xc81976,null));};exports[_0x9757('0x3c')]=function(_0x2f2688,_0x3c94b2){return db[_0x9757('0x2f')][_0x9757('0x3c')](_0x2f2688[_0x9757('0x3d')],{})['then'](respondWithResult(_0x3c94b2,0xc9))[_0x9757('0x3b')](handleError(_0x3c94b2,null));};exports[_0x9757('0x27')]=function(_0x457d6c,_0x4f2ea4){if(_0x457d6c[_0x9757('0x3d')]['id']){delete _0x457d6c[_0x9757('0x3d')]['id'];}return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x457d6c[_0x9757('0x2c')]['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x4f2ea4,null))[_0x9757('0x28')](saveUpdates(_0x457d6c[_0x9757('0x3d')],null))[_0x9757('0x28')](respondWithResult(_0x4f2ea4,null))['catch'](handleError(_0x4f2ea4,null));};exports['destroy']=function(_0x2cf830,_0x2d0a6e){return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x2cf830['params']['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x2d0a6e,null))['then'](removeEntity(_0x2d0a6e,null))[_0x9757('0x3b')](handleError(_0x2d0a6e,null));}; \ No newline at end of file +var _0x3351=['attributes','length','include','options','find','create','body','catch','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','reject','save','then','destroy','error','stack','name','send','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','fields'];(function(_0x5983c7,_0x415ba8){var _0x555815=function(_0x193cc2){while(--_0x193cc2){_0x5983c7['push'](_0x5983c7['shift']());}};_0x555815(++_0x415ba8);}(_0x3351,0x1b4));var _0x1335=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x3351[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x1335('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1335('0x1'));var rp=require(_0x1335('0x2'));var moment=require(_0x1335('0x3'));var BPromise=require(_0x1335('0x4'));var Mustache=require(_0x1335('0x5'));var util=require(_0x1335('0x6'));var path=require(_0x1335('0x7'));var sox=require('sox');var csv=require(_0x1335('0x8'));var ejs=require(_0x1335('0x9'));var fs=require('fs');var fs_extra=require(_0x1335('0xa'));var _=require(_0x1335('0xb'));var squel=require(_0x1335('0xc'));var crypto=require(_0x1335('0xd'));var jsforce=require(_0x1335('0xe'));var deskjs=require(_0x1335('0xf'));var toCsv=require(_0x1335('0x8'));var querystring=require(_0x1335('0x10'));var Papa=require(_0x1335('0x11'));var Redis=require('ioredis');var authService=require(_0x1335('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1335('0x13'));var hardwareService=require(_0x1335('0x14'));var logger=require(_0x1335('0x15'))(_0x1335('0x16'));var utils=require(_0x1335('0x17'));var config=require(_0x1335('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1335('0x19'))['db'];function respondWithStatusCode(_0x55a85e,_0x425cd8){_0x425cd8=_0x425cd8||0xcc;return function(_0x5699f4){if(_0x5699f4){return _0x55a85e[_0x1335('0x1a')](_0x425cd8);}return _0x55a85e['status'](_0x425cd8)[_0x1335('0x1b')]();};}function respondWithResult(_0x4c8964,_0x4f9625){_0x4f9625=_0x4f9625||0xc8;return function(_0xc333ce){if(_0xc333ce){return _0x4c8964[_0x1335('0x1c')](_0x4f9625)['json'](_0xc333ce);}};}function respondWithFilteredResult(_0x5ee59d,_0x3bd6b0){return function(_0x565686){if(_0x565686){var _0x431433=typeof _0x3bd6b0[_0x1335('0x1d')]===_0x1335('0x1e')&&typeof _0x3bd6b0['limit']===_0x1335('0x1e');var _0x4da3b8=_0x565686[_0x1335('0x1f')];var _0x4d5b17=_0x431433?0x0:_0x3bd6b0[_0x1335('0x1d')];var _0x36123c=_0x431433?_0x565686[_0x1335('0x1f')]:_0x3bd6b0['offset']+_0x3bd6b0[_0x1335('0x20')];var _0xbebdea;if(_0x36123c>=_0x4da3b8){_0x36123c=_0x4da3b8;_0xbebdea=0xc8;}else{_0xbebdea=0xce;}_0x5ee59d[_0x1335('0x1c')](_0xbebdea);return _0x5ee59d[_0x1335('0x21')]('Content-Range',_0x4d5b17+'-'+_0x36123c+'/'+_0x4da3b8)[_0x1335('0x22')](_0x565686);}return null;};}function patchUpdates(_0x4ae091){return function(_0x5c10d3){try{jsonpatch['apply'](_0x5c10d3,_0x4ae091,!![]);}catch(_0x12e01b){return BPromise[_0x1335('0x23')](_0x12e01b);}return _0x5c10d3[_0x1335('0x24')]();};}function saveUpdates(_0x5c4c24,_0x4c01c9){return function(_0x25aacb){if(_0x25aacb){return _0x25aacb['update'](_0x5c4c24)[_0x1335('0x25')](function(_0x47eaa7){return _0x47eaa7;});}return null;};}function removeEntity(_0x35432b,_0x1c13a8){return function(_0x383d19){if(_0x383d19){return _0x383d19[_0x1335('0x26')]()[_0x1335('0x25')](function(){_0x35432b[_0x1335('0x1c')](0xcc)[_0x1335('0x1b')]();});}};}function handleEntityNotFound(_0x48a0f9,_0x37efee){return function(_0x26ba20){if(!_0x26ba20){_0x48a0f9[_0x1335('0x1a')](0x194);}return _0x26ba20;};}function handleError(_0x1e0019,_0x4cf375){_0x4cf375=_0x4cf375||0x1f4;return function(_0x1498e6){logger[_0x1335('0x27')](_0x1498e6[_0x1335('0x28')]);if(_0x1498e6[_0x1335('0x29')]){delete _0x1498e6[_0x1335('0x29')];}_0x1e0019[_0x1335('0x1c')](_0x4cf375)[_0x1335('0x2a')](_0x1498e6);};}exports[_0x1335('0x2b')]=function(_0x23b5cc,_0xdc07ab){var _0x233298={'raw':!![],'where':{'id':_0x23b5cc['params']['id']}},_0x19950c={};_0x19950c[_0x1335('0x2c')]=_['keys'](db[_0x1335('0x2d')][_0x1335('0x2e')]);_0x19950c[_0x1335('0x2f')]=_[_0x1335('0x30')](_0x23b5cc['query']);_0x19950c[_0x1335('0x31')]=_[_0x1335('0x32')](_0x19950c[_0x1335('0x2c')],_0x19950c[_0x1335('0x2f')]);_0x233298['attributes']=_[_0x1335('0x32')](_0x19950c[_0x1335('0x2c')],qs[_0x1335('0x33')](_0x23b5cc[_0x1335('0x2f')][_0x1335('0x33')]));_0x233298[_0x1335('0x34')]=_0x233298['attributes'][_0x1335('0x35')]?_0x233298[_0x1335('0x34')]:_0x19950c[_0x1335('0x2c')];if(_0x23b5cc[_0x1335('0x2f')]['includeAll']){_0x233298[_0x1335('0x36')]=[{'all':!![]}];}_0x233298=_['merge']({},_0x233298,_0x23b5cc[_0x1335('0x37')]);return db['ChatProactiveAction'][_0x1335('0x38')](_0x233298)[_0x1335('0x25')](handleEntityNotFound(_0xdc07ab,null))[_0x1335('0x25')](respondWithResult(_0xdc07ab,null))['catch'](handleError(_0xdc07ab,null));};exports[_0x1335('0x39')]=function(_0x5f311e,_0x3b82be){return db[_0x1335('0x2d')][_0x1335('0x39')](_0x5f311e[_0x1335('0x3a')],{})[_0x1335('0x25')](respondWithResult(_0x3b82be,0xc9))[_0x1335('0x3b')](handleError(_0x3b82be,null));};exports['update']=function(_0x31be79,_0x213815){if(_0x31be79[_0x1335('0x3a')]['id']){delete _0x31be79['body']['id'];}return db[_0x1335('0x2d')]['find']({'where':{'id':_0x31be79[_0x1335('0x3c')]['id']}})['then'](handleEntityNotFound(_0x213815,null))[_0x1335('0x25')](saveUpdates(_0x31be79[_0x1335('0x3a')],null))['then'](respondWithResult(_0x213815,null))[_0x1335('0x3b')](handleError(_0x213815,null));};exports[_0x1335('0x26')]=function(_0x524252,_0x21f5bb){return db[_0x1335('0x2d')][_0x1335('0x38')]({'where':{'id':_0x524252[_0x1335('0x3c')]['id']}})['then'](handleEntityNotFound(_0x21f5bb,null))[_0x1335('0x25')](removeEntity(_0x21f5bb,null))[_0x1335('0x3b')](handleError(_0x21f5bb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7f6606f..2ced68b 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 _0x708f=['moment','bluebird','request-promise','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x708f,0x17c));var _0xf708=function(_0x5772df,_0x635fec){_0x5772df=_0x5772df-0x0;var _0x1332d0=_0x708f[_0x5772df];return _0x1332d0;};'use strict';var _=require(_0xf708('0x0'));var util=require(_0xf708('0x1'));var logger=require(_0xf708('0x2'))(_0xf708('0x3'));var moment=require(_0xf708('0x4'));var BPromise=require(_0xf708('0x5'));var rp=require(_0xf708('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf708('0x7'));var attributes=require(_0xf708('0x8'));module[_0xf708('0x9')]=function(_0x5284a8,_0x407166){return _0x5284a8['define'](_0xf708('0xa'),attributes,{'tableName':_0xf708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63cd=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','lodash','util'];(function(_0x546e3b,_0x1d6b2b){var _0x331189=function(_0x1458ca){while(--_0x1458ca){_0x546e3b['push'](_0x546e3b['shift']());}};_0x331189(++_0x1d6b2b);}(_0x63cd,0x166));var _0xd63c=function(_0x8ebbc2,_0xab414a){_0x8ebbc2=_0x8ebbc2-0x0;var _0x2fc072=_0x63cd[_0x8ebbc2];return _0x2fc072;};'use strict';var _=require(_0xd63c('0x0'));var util=require(_0xd63c('0x1'));var logger=require(_0xd63c('0x2'))(_0xd63c('0x3'));var moment=require(_0xd63c('0x4'));var BPromise=require(_0xd63c('0x5'));var rp=require(_0xd63c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd63c('0x7'));var config=require(_0xd63c('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xd63c('0x9')]=function(_0x976082,_0x4005c0){return _0x976082['define']('ChatProactiveAction',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 fd469ed..ab5aba6 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 _0x69dc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x69dc,0x9d));var _0xc69d=function(_0x6621b7,_0x6010df){_0x6621b7=_0x6621b7-0x0;var _0x1c197b=_0x69dc[_0x6621b7];return _0x1c197b;};'use strict';var _=require('lodash');var util=require(_0xc69d('0x0'));var moment=require(_0xc69d('0x1'));var BPromise=require(_0xc69d('0x2'));var rs=require(_0xc69d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc69d('0x4'))['db'];var utils=require(_0xc69d('0x5'));var logger=require(_0xc69d('0x6'))(_0xc69d('0x7'));var config=require('../../config/environment');var jayson=require(_0xc69d('0x8'));var client=jayson[_0xc69d('0x9')][_0xc69d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdfaa,_0x4b37db,_0x3f2b53){return new BPromise(function(_0x34801f,_0x4e07a7){return client[_0xc69d('0xb')](_0x3cdfaa,_0x3f2b53)[_0xc69d('0xc')](function(_0x109a2b){logger[_0xc69d('0xd')](_0xc69d('0xe'),_0x4b37db,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4b37db,_0xc69d('0xf'),JSON['stringify'](_0x109a2b));if(_0x109a2b[_0xc69d('0x10')]){if(_0x109a2b['error']['code']===0x1f4){logger[_0xc69d('0x10')](_0xc69d('0xe'),_0x4b37db,_0x109a2b['error'][_0xc69d('0x11')]);return _0x4e07a7(_0x109a2b[_0xc69d('0x10')][_0xc69d('0x11')]);}logger[_0xc69d('0x10')](_0xc69d('0xe'),_0x4b37db,_0x109a2b[_0xc69d('0x10')][_0xc69d('0x11')]);return _0x34801f(_0x109a2b['error'][_0xc69d('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4b37db,'request\x20sent');_0x34801f(_0x109a2b[_0xc69d('0x12')][_0xc69d('0x11')]);}})[_0xc69d('0x13')](function(_0x3cbeae){logger[_0xc69d('0x10')](_0xc69d('0xe'),_0x4b37db,_0x3cbeae);_0x4e07a7(_0x3cbeae);});});} \ No newline at end of file +var _0x4012=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x516738,_0x1e0210){var _0x5f5d4d=function(_0x5a061e){while(--_0x5a061e){_0x516738['push'](_0x516738['shift']());}};_0x5f5d4d(++_0x1e0210);}(_0x4012,0xd6));var _0x2401=function(_0x130c86,_0x18bb4e){_0x130c86=_0x130c86-0x0;var _0x4f673d=_0x4012[_0x130c86];return _0x4f673d;};'use strict';var _=require(_0x2401('0x0'));var util=require('util');var moment=require(_0x2401('0x1'));var BPromise=require(_0x2401('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2401('0x3'));var db=require(_0x2401('0x4'))['db'];var utils=require(_0x2401('0x5'));var logger=require(_0x2401('0x6'))(_0x2401('0x7'));var config=require(_0x2401('0x8'));var jayson=require(_0x2401('0x9'));var client=jayson[_0x2401('0xa')][_0x2401('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x85f35f,_0x184814,_0x245b35){return new BPromise(function(_0x267711,_0x1fb21f){return client[_0x2401('0xc')](_0x85f35f,_0x245b35)[_0x2401('0xd')](function(_0x4e621c){logger['info'](_0x2401('0xe'),_0x184814,'request\x20sent');logger['debug'](_0x2401('0xf'),_0x184814,_0x2401('0x10'),JSON[_0x2401('0x11')](_0x4e621c));if(_0x4e621c[_0x2401('0x12')]){if(_0x4e621c[_0x2401('0x12')][_0x2401('0x13')]===0x1f4){logger[_0x2401('0x12')](_0x2401('0xe'),_0x184814,_0x4e621c[_0x2401('0x12')]['message']);return _0x1fb21f(_0x4e621c[_0x2401('0x12')][_0x2401('0x14')]);}logger[_0x2401('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x184814,_0x4e621c[_0x2401('0x12')]['message']);return _0x267711(_0x4e621c[_0x2401('0x12')][_0x2401('0x14')]);}else{logger[_0x2401('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x184814,_0x2401('0x10'));_0x267711(_0x4e621c[_0x2401('0x16')][_0x2401('0x14')]);}})[_0x2401('0x17')](function(_0x2fcca1){logger[_0x2401('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x184814,_0x2fcca1);_0x1fb21f(_0x2fcca1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b79489c..a28ad93 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 _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x68b040,_0x263ba9){var _0x269f90=function(_0x5c6b1f){while(--_0x5c6b1f){_0x68b040['push'](_0x68b040['shift']());}};_0x269f90(++_0x263ba9);}(_0x53ec,0x192));var _0xc53e=function(_0x349080,_0x485b71){_0x349080=_0x349080-0x0;var _0x1ef849=_0x53ec[_0x349080];return _0x1ef849;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x2bd8,0x130));var _0x82bd=function(_0x3c4c6a,_0x5802dc){_0x3c4c6a=_0x3c4c6a-0x0;var _0x123872=_0x2bd8[_0x3c4c6a];return _0x123872;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('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 75963b9..0f15505 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 _0x894d=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x15ebc8,_0x4b05af){var _0x29f88a=function(_0x5ec0ce){while(--_0x5ec0ce){_0x15ebc8['push'](_0x15ebc8['shift']());}};_0x29f88a(++_0x4b05af);}(_0x894d,0xd4));var _0xd894=function(_0x5cec18,_0x34d5ea){_0x5cec18=_0x5cec18-0x0;var _0x4b878f=_0x894d[_0x5cec18];return _0x4b878f;};'use strict';var Sequelize=require(_0xd894('0x0'));module['exports']={'name':{'type':Sequelize[_0xd894('0x1')],'unique':_0xd894('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd894('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd894('0x4')](_0xd894('0x5'),_0xd894('0x6'),_0xd894('0x7'))}}; \ No newline at end of file +var _0x9dd0=['ENUM','beepall','exports','STRING','INTEGER'];(function(_0x208c57,_0x3182e5){var _0x1dda31=function(_0x49e35c){while(--_0x49e35c){_0x208c57['push'](_0x208c57['shift']());}};_0x1dda31(++_0x3182e5);}(_0x9dd0,0x7f));var _0x09dd=function(_0x23c31d,_0x2e8382){_0x23c31d=_0x23c31d-0x0;var _0x4c8e11=_0x9dd0[_0x23c31d];return _0x4c8e11;};'use strict';var Sequelize=require('sequelize');module[_0x09dd('0x0')]={'name':{'type':Sequelize[_0x09dd('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x09dd('0x1')]},'timeout':{'type':Sequelize[_0x09dd('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x09dd('0x3')]('rrmemory',_0x09dd('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 979fcdf..b57cae4 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 _0x6bc4=['nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','ChatQueues','UserProfileSection','find','userProfileId','autoAssociation','params','describe','getMembers','UserChatQueue','ChatQueueId','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','order','addTeams','ids','User','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','end','status','json','limit','count','offset','apply','reject','save','update','destroy','sendStatus','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2fe9aa,_0x4748a5){var _0x264200=function(_0x27d8ce){while(--_0x27d8ce){_0x2fe9aa['push'](_0x2fe9aa['shift']());}};_0x264200(++_0x4748a5);}(_0x6bc4,0xe0));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x46bc('0x0'));var rimraf=require(_0x46bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46bc('0x2'));var rp=require(_0x46bc('0x3'));var moment=require(_0x46bc('0x4'));var BPromise=require(_0x46bc('0x5'));var Mustache=require(_0x46bc('0x6'));var util=require(_0x46bc('0x7'));var path=require(_0x46bc('0x8'));var sox=require('sox');var csv=require(_0x46bc('0x9'));var ejs=require(_0x46bc('0xa'));var fs=require('fs');var fs_extra=require(_0x46bc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46bc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x46bc('0xd'));var Papa=require(_0x46bc('0xe'));var Redis=require(_0x46bc('0xf'));var authService=require(_0x46bc('0x10'));var qs=require(_0x46bc('0x11'));var as=require(_0x46bc('0x12'));var hardwareService=require(_0x46bc('0x13'));var logger=require('../../config/logger')(_0x46bc('0x14'));var utils=require(_0x46bc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x46bc('0x16'));var db=require('../../mysqldb')['db'];config[_0x46bc('0x17')]=_[_0x46bc('0x18')](config[_0x46bc('0x17')],{'host':_0x46bc('0x19'),'port':0x18eb});var socket=require(_0x46bc('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x46bc('0x1b'));var client=jayson[_0x46bc('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x420d1f,_0x205c52,_0x4ee72b,_0x242172){return new BPromise(function(_0x402344,_0x52cf48){var _0x4067e3=_0x242172||client;return _0x4067e3[_0x46bc('0x1d')](_0x420d1f,_0x4ee72b)[_0x46bc('0x1e')](function(_0x10d311){logger['info'](_0x46bc('0x1f'),_0x205c52,_0x46bc('0x20'));logger[_0x46bc('0x21')](_0x46bc('0x22'),_0x205c52,_0x46bc('0x20'),JSON['stringify'](_0x10d311));if(_0x10d311['error']){if(_0x10d311[_0x46bc('0x23')][_0x46bc('0x24')]===0x1f4){logger[_0x46bc('0x23')]('ChatQueue,\x20%s,\x20%s',_0x205c52,_0x10d311[_0x46bc('0x23')][_0x46bc('0x25')]);return _0x52cf48(_0x10d311[_0x46bc('0x23')]['message']);}logger[_0x46bc('0x23')]('ChatQueue,\x20%s,\x20%s',_0x205c52,_0x10d311[_0x46bc('0x23')][_0x46bc('0x25')]);return _0x402344(_0x10d311['error'][_0x46bc('0x25')]);}else{logger[_0x46bc('0x26')](_0x46bc('0x1f'),_0x205c52,_0x46bc('0x20'));_0x402344(_0x10d311[_0x46bc('0x27')][_0x46bc('0x25')]);}})[_0x46bc('0x28')](function(_0x3e2c8b){logger['error'](_0x46bc('0x1f'),_0x205c52,_0x3e2c8b);_0x52cf48(_0x3e2c8b);});});}function respondWithStatusCode(_0x27456c,_0x4709e1){_0x4709e1=_0x4709e1||0xcc;return function(_0x2d7842){if(_0x2d7842){return _0x27456c['sendStatus'](_0x4709e1);}return _0x27456c['status'](_0x4709e1)[_0x46bc('0x29')]();};}function respondWithResult(_0x4b7388,_0x49abee){_0x49abee=_0x49abee||0xc8;return function(_0x5b73b9){if(_0x5b73b9){return _0x4b7388[_0x46bc('0x2a')](_0x49abee)[_0x46bc('0x2b')](_0x5b73b9);}};}function respondWithFilteredResult(_0x57f56a,_0x339b37){return function(_0x4a7863){if(_0x4a7863){var _0xdcd17a=typeof _0x339b37['offset']==='undefined'&&typeof _0x339b37[_0x46bc('0x2c')]==='undefined';var _0x1d7cb4=_0x4a7863[_0x46bc('0x2d')];var _0x1a0eae=_0xdcd17a?0x0:_0x339b37[_0x46bc('0x2e')];var _0x295e9b=_0xdcd17a?_0x4a7863[_0x46bc('0x2d')]:_0x339b37[_0x46bc('0x2e')]+_0x339b37['limit'];var _0x46a9dd;if(_0x295e9b>=_0x1d7cb4){_0x295e9b=_0x1d7cb4;_0x46a9dd=0xc8;}else{_0x46a9dd=0xce;}_0x57f56a[_0x46bc('0x2a')](_0x46a9dd);return _0x57f56a['set']('Content-Range',_0x1a0eae+'-'+_0x295e9b+'/'+_0x1d7cb4)[_0x46bc('0x2b')](_0x4a7863);}return null;};}function patchUpdates(_0x3f975f){return function(_0x136f5a){try{jsonpatch[_0x46bc('0x2f')](_0x136f5a,_0x3f975f,!![]);}catch(_0x1764f4){return BPromise[_0x46bc('0x30')](_0x1764f4);}return _0x136f5a[_0x46bc('0x31')]();};}function saveUpdates(_0x1e8772,_0x165b23){return function(_0x4083e6){if(_0x4083e6){return _0x4083e6[_0x46bc('0x32')](_0x1e8772)[_0x46bc('0x1e')](function(_0x5597e0){return _0x5597e0;});}return null;};}function removeEntity(_0x15e55c,_0x2aa9ae){return function(_0x47521c){if(_0x47521c){return _0x47521c[_0x46bc('0x33')]()['then'](function(){var _0x5701d7=_0x47521c['get']({'plain':!![]});var _0x4540da='ChatQueues';return db['UserProfileResource'][_0x46bc('0x33')]({'where':{'type':_0x4540da,'resourceId':_0x5701d7['id']}})[_0x46bc('0x1e')](function(){return _0x47521c;});})['then'](function(){_0x15e55c[_0x46bc('0x2a')](0xcc)[_0x46bc('0x29')]();});}};}function handleEntityNotFound(_0xb32f11,_0x5cb6d5){return function(_0x4d97e8){if(!_0x4d97e8){_0xb32f11[_0x46bc('0x34')](0x194);}return _0x4d97e8;};}function handleError(_0x1ec686,_0x2cbcc6){_0x2cbcc6=_0x2cbcc6||0x1f4;return function(_0x51aa30){logger[_0x46bc('0x23')](_0x51aa30['stack']);if(_0x51aa30[_0x46bc('0x35')]){delete _0x51aa30[_0x46bc('0x35')];}_0x1ec686[_0x46bc('0x2a')](_0x2cbcc6)[_0x46bc('0x36')](_0x51aa30);};}exports[_0x46bc('0x37')]=function(_0x3c4ade,_0x260ce7){var _0xbb6d7e={},_0x1201a5={},_0x4fa5e0={'count':0x0,'rows':[]};var _0x90c225=_['map'](db[_0x46bc('0x38')][_0x46bc('0x39')],function(_0x204503){return{'name':_0x204503[_0x46bc('0x3a')],'type':_0x204503[_0x46bc('0x3b')][_0x46bc('0x3c')]};});_0x1201a5[_0x46bc('0x3d')]=_['map'](_0x90c225,_0x46bc('0x35'));_0x1201a5['query']=_[_0x46bc('0x3e')](_0x3c4ade[_0x46bc('0x3f')]);_0x1201a5[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x1201a5[_0x46bc('0x3d')],_0x1201a5[_0x46bc('0x3f')]);_0xbb6d7e[_0x46bc('0x42')]=_['intersection'](_0x1201a5[_0x46bc('0x3d')],qs['fields'](_0x3c4ade[_0x46bc('0x3f')][_0x46bc('0x43')]));_0xbb6d7e[_0x46bc('0x42')]=_0xbb6d7e[_0x46bc('0x42')][_0x46bc('0x44')]?_0xbb6d7e[_0x46bc('0x42')]:_0x1201a5[_0x46bc('0x3d')];if(!_0x3c4ade[_0x46bc('0x3f')][_0x46bc('0x45')](_0x46bc('0x46'))){_0xbb6d7e[_0x46bc('0x2c')]=qs[_0x46bc('0x2c')](_0x3c4ade['query'][_0x46bc('0x2c')]);_0xbb6d7e['offset']=qs[_0x46bc('0x2e')](_0x3c4ade[_0x46bc('0x3f')][_0x46bc('0x2e')]);}_0xbb6d7e['order']=qs[_0x46bc('0x47')](_0x3c4ade[_0x46bc('0x3f')]['sort']);_0xbb6d7e[_0x46bc('0x48')]=qs[_0x46bc('0x40')](_[_0x46bc('0x49')](_0x3c4ade[_0x46bc('0x3f')],_0x1201a5[_0x46bc('0x40')]),_0x90c225);if(_0x3c4ade['query'][_0x46bc('0x4a')]){_0xbb6d7e['where']=_[_0x46bc('0x4b')](_0xbb6d7e['where'],{'$or':_[_0x46bc('0x4c')](_0x90c225,function(_0x4f16d8){if(_0x4f16d8[_0x46bc('0x3b')]!=='VIRTUAL'){var _0x20d1f6={};_0x20d1f6[_0x4f16d8[_0x46bc('0x35')]]={'$like':'%'+_0x3c4ade[_0x46bc('0x3f')][_0x46bc('0x4a')]+'%'};return _0x20d1f6;}})});}_0xbb6d7e=_[_0x46bc('0x4b')]({},_0xbb6d7e,_0x3c4ade[_0x46bc('0x4d')]);var _0x488485={'where':_0xbb6d7e[_0x46bc('0x48')]};return db[_0x46bc('0x38')][_0x46bc('0x2d')](_0x488485)['then'](function(_0x3dd88c){_0x4fa5e0['count']=_0x3dd88c;if(_0x3c4ade['query'][_0x46bc('0x4e')]){_0xbb6d7e[_0x46bc('0x4f')]=[{'all':!![]}];}return db[_0x46bc('0x38')][_0x46bc('0x50')](_0xbb6d7e);})[_0x46bc('0x1e')](function(_0x1d0922){_0x4fa5e0[_0x46bc('0x51')]=_0x1d0922;return _0x4fa5e0;})[_0x46bc('0x1e')](respondWithFilteredResult(_0x260ce7,_0xbb6d7e))['catch'](handleError(_0x260ce7,null));};exports[_0x46bc('0x52')]=function(_0x2eeff8,_0x53790a){var _0x55555e={'raw':!![],'where':{'id':_0x2eeff8['params']['id']}},_0x510cc6={};_0x510cc6[_0x46bc('0x3d')]=_[_0x46bc('0x3e')](db[_0x46bc('0x38')][_0x46bc('0x39')]);_0x510cc6[_0x46bc('0x3f')]=_['keys'](_0x2eeff8['query']);_0x510cc6['filters']=_['intersection'](_0x510cc6['model'],_0x510cc6[_0x46bc('0x3f')]);_0x55555e['attributes']=_[_0x46bc('0x41')](_0x510cc6[_0x46bc('0x3d')],qs[_0x46bc('0x43')](_0x2eeff8[_0x46bc('0x3f')][_0x46bc('0x43')]));_0x55555e['attributes']=_0x55555e[_0x46bc('0x42')][_0x46bc('0x44')]?_0x55555e[_0x46bc('0x42')]:_0x510cc6[_0x46bc('0x3d')];if(_0x2eeff8[_0x46bc('0x3f')][_0x46bc('0x4e')]){_0x55555e[_0x46bc('0x4f')]=[{'all':!![]}];}_0x55555e=_[_0x46bc('0x4b')]({},_0x55555e,_0x2eeff8[_0x46bc('0x4d')]);return db[_0x46bc('0x38')]['find'](_0x55555e)[_0x46bc('0x1e')](handleEntityNotFound(_0x53790a,null))['then'](respondWithResult(_0x53790a,null))[_0x46bc('0x28')](handleError(_0x53790a,null));};exports['create']=function(_0x9df5e9,_0x55736f){return db[_0x46bc('0x38')][_0x46bc('0x53')](_0x9df5e9[_0x46bc('0x54')],{})[_0x46bc('0x1e')](function(_0x4996fc){var _0x5e5db5=_0x9df5e9[_0x46bc('0x55')]['get']({'plain':!![]});if(!_0x5e5db5)throw new Error(_0x46bc('0x56'));if(_0x5e5db5['role']===_0x46bc('0x55')){var _0x42a9c4=_0x4996fc[_0x46bc('0x57')]({'plain':!![]});var _0x5c23a6=_0x46bc('0x58');return db[_0x46bc('0x59')][_0x46bc('0x5a')]({'where':{'name':_0x5c23a6,'userProfileId':_0x5e5db5[_0x46bc('0x5b')]},'raw':!![]})[_0x46bc('0x1e')](function(_0x315e9e){if(_0x315e9e&&_0x315e9e[_0x46bc('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x42a9c4['name'],'resourceId':_0x42a9c4['id'],'type':_0x315e9e[_0x46bc('0x35')],'sectionId':_0x315e9e['id']},{})[_0x46bc('0x1e')](function(){return _0x4996fc;});}else{return _0x4996fc;}})['catch'](function(_0x54b120){logger[_0x46bc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54b120);throw _0x54b120;});}return _0x4996fc;})[_0x46bc('0x1e')](respondWithResult(_0x55736f,0xc9))[_0x46bc('0x28')](handleError(_0x55736f,null));};exports[_0x46bc('0x32')]=function(_0x3fa61a,_0x3661eb){if(_0x3fa61a[_0x46bc('0x54')]['id']){delete _0x3fa61a[_0x46bc('0x54')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3fa61a[_0x46bc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3661eb,null))[_0x46bc('0x1e')](saveUpdates(_0x3fa61a[_0x46bc('0x54')],null))['then'](respondWithResult(_0x3661eb,null))[_0x46bc('0x28')](handleError(_0x3661eb,null));};exports[_0x46bc('0x33')]=function(_0x5bed94,_0x16ba14){return db[_0x46bc('0x38')][_0x46bc('0x5a')]({'where':{'id':_0x5bed94[_0x46bc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x16ba14,null))[_0x46bc('0x1e')](removeEntity(_0x16ba14,null))[_0x46bc('0x28')](handleError(_0x16ba14,null));};exports[_0x46bc('0x5e')]=function(_0x5888e8,_0x168494){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x168494,null))[_0x46bc('0x28')](handleError(_0x168494,null));};exports[_0x46bc('0x5f')]=function(_0x20ca08,_0xcca876,_0x2c35d9){var _0x57a02a={'raw':!![],'where':{}},_0x4d1d4a={},_0x2686c3;return db[_0x46bc('0x38')]['findOne']({'where':{'id':_0x20ca08[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](handleEntityNotFound(_0xcca876,null))[_0x46bc('0x1e')](function(_0x2ef201){if(_0x2ef201){_0x2686c3=_0x2ef201[_0x46bc('0x57')]({'plain':!![]});_0x4d1d4a['model']=_[_0x46bc('0x3e')](db[_0x46bc('0x60')][_0x46bc('0x39')]);_0x4d1d4a['query']=_[_0x46bc('0x3e')](_0x20ca08[_0x46bc('0x3f')]);_0x4d1d4a[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x4d1d4a['model'],_0x4d1d4a[_0x46bc('0x3f')]);_0x57a02a[_0x46bc('0x42')]=_[_0x46bc('0x41')](_0x4d1d4a['model'],qs[_0x46bc('0x43')](_0x20ca08[_0x46bc('0x3f')][_0x46bc('0x43')]));_0x57a02a['attributes']=_0x57a02a['attributes'][_0x46bc('0x44')]?_0x57a02a[_0x46bc('0x42')]:_0x4d1d4a[_0x46bc('0x3d')];if(!_0x20ca08[_0x46bc('0x3f')][_0x46bc('0x45')](_0x46bc('0x46'))){_0x57a02a[_0x46bc('0x2c')]=qs[_0x46bc('0x2c')](_0x20ca08[_0x46bc('0x3f')][_0x46bc('0x2c')]);_0x57a02a['offset']=qs[_0x46bc('0x2e')](_0x20ca08[_0x46bc('0x3f')][_0x46bc('0x2e')]);}_0x57a02a['order']=qs[_0x46bc('0x47')](_0x20ca08[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x57a02a[_0x46bc('0x48')]=qs[_0x46bc('0x40')](_['pick'](_0x20ca08[_0x46bc('0x3f')],_0x4d1d4a['filters']));_0x57a02a[_0x46bc('0x48')][_0x46bc('0x61')]=_0x2ef201['id'];if(_0x20ca08['query'][_0x46bc('0x4a')]){_0x57a02a[_0x46bc('0x48')]=_[_0x46bc('0x4b')](_0x57a02a[_0x46bc('0x48')],{'$or':_[_0x46bc('0x4c')](_0x57a02a[_0x46bc('0x42')],function(_0x34ba15){var _0x1c634b={};_0x1c634b[_0x34ba15]={'$like':'%'+_0x20ca08[_0x46bc('0x3f')]['filter']+'%'};return _0x1c634b;})});}_0x57a02a=_[_0x46bc('0x4b')]({},_0x57a02a,_0x20ca08[_0x46bc('0x4d')]);return db['UserChatQueue'][_0x46bc('0x50')](_0x57a02a);}})[_0x46bc('0x1e')](function(_0x47ba6d){if(_0x47ba6d){return db['User'][_0x46bc('0x62')]({'where':{'id':_['map'](_0x47ba6d,'UserId'),'role':_0x46bc('0x63')},'attributes':['id','name',_0x46bc('0x64'),_0x46bc('0x65'),_0x46bc('0x66')]});}})[_0x46bc('0x1e')](function(_0x3934cc){if(_0x3934cc){return{'count':_0x3934cc[_0x46bc('0x2d')],'rows':_[_0x46bc('0x4c')](_0x3934cc[_0x46bc('0x51')],function(_0x29928b){return{'membername':_0x29928b[_0x46bc('0x35')],'UserId':_0x29928b['id'],'queue_name':_0x2686c3[_0x46bc('0x35')],'ChatQueueId':_0x2686c3['id'],'interface':util[_0x46bc('0x67')](_0x46bc('0x68'),'SIP',_0x29928b['name']),'penalty':0x0,'paused':_0x29928b[_0x46bc('0x64')],'createdAt':_0x29928b['createdAt'],'updatedAt':_0x29928b[_0x46bc('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xcca876,_0x57a02a))[_0x46bc('0x28')](handleError(_0xcca876,null));};exports[_0x46bc('0x69')]=function(_0x46fbff,_0x92c0e1,_0x30aab6){var _0x8c7818={};var _0x29c248={};var _0x2348f1;var _0x41acee;return db['ChatQueue'][_0x46bc('0x6a')]({'where':{'id':_0x46fbff[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](handleEntityNotFound(_0x92c0e1,null))['then'](function(_0xdfde17){if(_0xdfde17){_0x2348f1=_0xdfde17;_0x29c248[_0x46bc('0x3d')]=_[_0x46bc('0x3e')](db[_0x46bc('0x6b')][_0x46bc('0x39')]);_0x29c248['query']=_[_0x46bc('0x3e')](_0x46fbff[_0x46bc('0x3f')]);_0x29c248[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x29c248['model'],_0x29c248[_0x46bc('0x3f')]);_0x8c7818[_0x46bc('0x42')]=_[_0x46bc('0x41')](_0x29c248[_0x46bc('0x3d')],qs[_0x46bc('0x43')](_0x46fbff[_0x46bc('0x3f')]['fields']));_0x8c7818[_0x46bc('0x42')]=_0x8c7818[_0x46bc('0x42')][_0x46bc('0x44')]?_0x8c7818[_0x46bc('0x42')]:_0x29c248['model'];_0x8c7818[_0x46bc('0x6c')]=qs[_0x46bc('0x47')](_0x46fbff[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x8c7818[_0x46bc('0x48')]=qs['filters'](_[_0x46bc('0x49')](_0x46fbff[_0x46bc('0x3f')],_0x29c248[_0x46bc('0x40')]));if(_0x46fbff['query']['filter']){_0x8c7818['where']=_['merge'](_0x8c7818['where'],{'$or':_[_0x46bc('0x4c')](_0x8c7818['attributes'],function(_0x2708b0){var _0x3b4c3b={};_0x3b4c3b[_0x2708b0]={'$like':'%'+_0x46fbff[_0x46bc('0x3f')]['filter']+'%'};return _0x3b4c3b;})});}_0x8c7818=_[_0x46bc('0x4b')]({},_0x8c7818,_0x46fbff[_0x46bc('0x4d')]);return _0x2348f1['getTeams'](_0x8c7818);}})[_0x46bc('0x1e')](function(_0x4eed4e){if(_0x4eed4e){_0x41acee=_0x4eed4e['length'];if(!_0x46fbff[_0x46bc('0x3f')][_0x46bc('0x45')](_0x46bc('0x46'))){_0x8c7818[_0x46bc('0x2c')]=qs[_0x46bc('0x2c')](_0x46fbff[_0x46bc('0x3f')][_0x46bc('0x2c')]);_0x8c7818[_0x46bc('0x2e')]=qs[_0x46bc('0x2e')](_0x46fbff[_0x46bc('0x3f')][_0x46bc('0x2e')]);}return _0x2348f1[_0x46bc('0x69')](_0x8c7818);}})[_0x46bc('0x1e')](function(_0x1896ce){if(_0x1896ce){return _0x1896ce?{'count':_0x41acee,'rows':_0x1896ce}:null;}})[_0x46bc('0x1e')](respondWithResult(_0x92c0e1,null))[_0x46bc('0x28')](handleError(_0x92c0e1,null));};exports[_0x46bc('0x6d')]=function(_0x2e91f6,_0x160d9d,_0x4cc248){var _0x5afdde=_0x2e91f6[_0x46bc('0x54')][_0x46bc('0x6e')];return db[_0x46bc('0x6b')][_0x46bc('0x50')]({'where':{'id':_0x5afdde},'attributes':['id'],'include':[{'model':db[_0x46bc('0x6f')],'as':'Agents','attributes':['id',_0x46bc('0x35'),'online','voicePause',_0x46bc('0x70')],'raw':!![]}]})[_0x46bc('0x1e')](function(_0x510b2a){if(_0x510b2a){var _0x383147=_[_0x46bc('0x71')](_0x510b2a,function(_0xac1534){var _0x4b3910=_0xac1534[_0x46bc('0x57')]({'plain':!![]});return _0x4b3910[_0x46bc('0x72')];});return db[_0x46bc('0x38')][_0x46bc('0x5a')]({'where':{'id':_0x2e91f6['params']['id']}})['then'](function(_0x3be347){return db[_0x46bc('0x73')][_0x46bc('0x74')](function(_0x9857ff){return _0x3be347['addTeams'](_0x5afdde,{'transaction':_0x9857ff})[_0x46bc('0x1e')](function(){return BPromise[_0x46bc('0x75')](_0x383147,function(_0x5d8035){return db[_0x46bc('0x60')][_0x46bc('0x76')]({'where':{'UserId':_0x5d8035['id'],'ChatQueueId':_0x2e91f6[_0x46bc('0x5d')]['id']},'transaction':_0x9857ff});});})[_0x46bc('0x1e')](function(){_0x383147[_0x46bc('0x77')](function(_0x5728a4){socket[_0x46bc('0x78')](_0x46bc('0x79'),{'UserId':_0x5728a4['id'],'ChatQueueId':_0x3be347['id']});});});});});}})[_0x46bc('0x1e')](respondWithStatusCode(_0x160d9d,null))[_0x46bc('0x28')](handleError(_0x160d9d,null));};exports[_0x46bc('0x7a')]=function(_0x11728d,_0x10c941,_0x1df9f3){return db[_0x46bc('0x6b')]['findAll']({'where':{'id':_0x11728d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x46bc('0x6f')],'as':_0x46bc('0x72'),'attributes':['id'],'raw':!![]}]})[_0x46bc('0x1e')](handleEntityNotFound(_0x10c941,null))[_0x46bc('0x1e')](function(_0x3aaa59){var _0x2d2e79=_[_0x46bc('0x4c')](_0x3aaa59,'id');var _0x17a30e=[];var _0x4a4b52=[];var _0x4b98cd=squel[_0x46bc('0x7b')]();_0x4b98cd[_0x46bc('0x7c')]('tq.TeamId')[_0x46bc('0x7d')](_0x46bc('0x7e'),'tq')[_0x46bc('0x7f')](_0x46bc('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x46bc('0x48')](_0x46bc('0x81'),_0x11728d[_0x46bc('0x5d')]['id']);for(var _0x15d885=0x0;_0x15d885<_0x3aaa59[_0x46bc('0x44')];_0x15d885+=0x1){let _0x197134=_0x3aaa59[_0x15d885];for(var _0xc841b5=0x0;_0xc841b5<_0x197134[_0x46bc('0x72')][_0x46bc('0x44')];_0xc841b5+=0x1){let _0x59ea55=_0x197134[_0x46bc('0x72')][_0xc841b5];var _0x44b367=_0x4b98cd['clone']();_0x44b367[_0x46bc('0x48')](_0x46bc('0x82'),_0x59ea55['id']);_0x4a4b52[_0x46bc('0x83')](db[_0x46bc('0x73')]['query'](_0x44b367[_0x46bc('0x84')](),{'type':db[_0x46bc('0x73')][_0x46bc('0x85')][_0x46bc('0x86')]})['then'](function(_0x10a066){if(_0x10a066['length']===0x1){return _0x59ea55['id'];}else{var _0x5917d6=_[_0x46bc('0x87')](_[_0x46bc('0x4c')](_0x10a066,'TeamId'),function(_0x363b35){return _[_0x46bc('0x88')](_0x2d2e79,_0x363b35);});if(_0x5917d6){return _0x59ea55['id'];}}}));}}return BPromise['all'](_0x4a4b52)['then'](function(_0x5933b1){_0x17a30e=_(_0x17a30e)[_0x46bc('0x89')](_0x5933b1)[_0x46bc('0x8a')]()[_0x46bc('0x8b')]();return db[_0x46bc('0x38')][_0x46bc('0x5a')]({'where':{'id':_0x11728d[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](function(_0x402f68){return db[_0x46bc('0x73')][_0x46bc('0x74')](function(_0x1391f7){return _0x402f68[_0x46bc('0x7a')](_0x11728d[_0x46bc('0x3f')][_0x46bc('0x6e')],{'transaction':_0x1391f7})[_0x46bc('0x1e')](function(){if(!_[_0x46bc('0x8c')](_0x17a30e)){return _0x402f68[_0x46bc('0x8d')](_0x17a30e,{'transaction':_0x1391f7});}})['then'](function(){_0x17a30e[_0x46bc('0x77')](function(_0x402389){socket[_0x46bc('0x78')](_0x46bc('0x8e'),{'UserId':_0x402389,'ChatQueueId':_0x402f68['id']});});});});});});})[_0x46bc('0x1e')](respondWithStatusCode(_0x10c941,null))['catch'](handleError(_0x10c941,null));};exports['addAgents']=function(_0x608dbd,_0x4e4b83,_0x4b3d8a){return db[_0x46bc('0x38')][_0x46bc('0x5a')]({'where':{'id':_0x608dbd[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](handleEntityNotFound(_0x4e4b83,null))[_0x46bc('0x1e')](function(_0x377835){if(_0x377835){return _0x377835[_0x46bc('0x8f')](_0x608dbd[_0x46bc('0x54')][_0x46bc('0x6e')],_[_0x46bc('0x90')](_0x608dbd[_0x46bc('0x54')],[_0x46bc('0x6e'),'id'])||{})[_0x46bc('0x91')](function(_0x496bc1){for(var _0x5d8b30=0x0;_0x5d8b30<_0x608dbd[_0x46bc('0x54')][_0x46bc('0x6e')]['length'];_0x5d8b30+=0x1){socket[_0x46bc('0x78')]('userChatQueue:save',{'UserId':Number(_0x608dbd[_0x46bc('0x54')][_0x46bc('0x6e')][_0x5d8b30]),'ChatQueueId':Number(_0x608dbd[_0x46bc('0x5d')]['id'])});}return _0x496bc1;});}})[_0x46bc('0x1e')](respondWithResult(_0x4e4b83,null))[_0x46bc('0x28')](handleError(_0x4e4b83,null));};exports[_0x46bc('0x8d')]=function(_0x3b6a97,_0x2557b2,_0x15bd95){return db[_0x46bc('0x38')][_0x46bc('0x5a')]({'where':{'id':_0x3b6a97[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](handleEntityNotFound(_0x2557b2,null))['then'](function(_0x180b7b){if(_0x180b7b){return _0x180b7b[_0x46bc('0x8d')](_0x3b6a97[_0x46bc('0x3f')]['ids'])[_0x46bc('0x1e')](function(){if(_['isArray'](_0x3b6a97['query'][_0x46bc('0x6e')])){for(var _0x2c9c74=0x0;_0x2c9c74<_0x3b6a97[_0x46bc('0x3f')][_0x46bc('0x6e')][_0x46bc('0x44')];_0x2c9c74+=0x1){socket[_0x46bc('0x78')](_0x46bc('0x8e'),{'UserId':Number(_0x3b6a97[_0x46bc('0x3f')]['ids'][_0x2c9c74]),'ChatQueueId':Number(_0x3b6a97['params']['id'])});}}else{socket['emit'](_0x46bc('0x8e'),{'UserId':Number(_0x3b6a97[_0x46bc('0x3f')][_0x46bc('0x6e')]),'ChatQueueId':Number(_0x3b6a97['params']['id'])});}});}})[_0x46bc('0x1e')](respondWithStatusCode(_0x2557b2,null))[_0x46bc('0x28')](handleError(_0x2557b2,null));};exports['getAgents']=function(_0x201b94,_0x171df3,_0x48d5ba){var _0x51d7b8={};var _0x47d3b2={};var _0x1c1829;var _0x18873c;return db[_0x46bc('0x38')]['findOne']({'where':{'id':_0x201b94[_0x46bc('0x5d')]['id']}})[_0x46bc('0x1e')](handleEntityNotFound(_0x171df3,null))[_0x46bc('0x1e')](function(_0x282473){if(_0x282473){_0x1c1829=_0x282473;_0x47d3b2[_0x46bc('0x3d')]=_[_0x46bc('0x3e')](db[_0x46bc('0x6f')]['rawAttributes']);_0x47d3b2[_0x46bc('0x3f')]=_[_0x46bc('0x3e')](_0x201b94[_0x46bc('0x3f')]);_0x47d3b2[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x47d3b2['model'],_0x47d3b2[_0x46bc('0x3f')]);_0x51d7b8[_0x46bc('0x42')]=_['intersection'](_0x47d3b2[_0x46bc('0x3d')],qs[_0x46bc('0x43')](_0x201b94[_0x46bc('0x3f')][_0x46bc('0x43')]));_0x51d7b8[_0x46bc('0x42')]=_0x51d7b8[_0x46bc('0x42')][_0x46bc('0x44')]?_0x51d7b8['attributes']:_0x47d3b2['model'];_0x51d7b8[_0x46bc('0x6c')]=qs['sort'](_0x201b94['query'][_0x46bc('0x47')]);_0x51d7b8['where']=qs[_0x46bc('0x40')](_[_0x46bc('0x49')](_0x201b94[_0x46bc('0x3f')],_0x47d3b2[_0x46bc('0x40')]));if(_0x201b94[_0x46bc('0x3f')][_0x46bc('0x4a')]){_0x51d7b8[_0x46bc('0x48')]=_['merge'](_0x51d7b8[_0x46bc('0x48')],{'$or':_[_0x46bc('0x4c')](_0x51d7b8[_0x46bc('0x42')],function(_0x459503){var _0x1be19f={};_0x1be19f[_0x459503]={'$like':'%'+_0x201b94[_0x46bc('0x3f')]['filter']+'%'};return _0x1be19f;})});}_0x51d7b8=_[_0x46bc('0x4b')]({},_0x51d7b8,_0x201b94['options']);return _0x1c1829[_0x46bc('0x92')](_0x51d7b8);}})[_0x46bc('0x1e')](function(_0x21729c){if(_0x21729c){_0x18873c=_0x21729c['length'];if(!_0x201b94[_0x46bc('0x3f')][_0x46bc('0x45')](_0x46bc('0x46'))){_0x51d7b8[_0x46bc('0x2c')]=qs[_0x46bc('0x2c')](_0x201b94[_0x46bc('0x3f')][_0x46bc('0x2c')]);_0x51d7b8[_0x46bc('0x2e')]=qs[_0x46bc('0x2e')](_0x201b94[_0x46bc('0x3f')]['offset']);}return _0x1c1829[_0x46bc('0x92')](_0x51d7b8);}})[_0x46bc('0x1e')](function(_0x123852){if(_0x123852){return _0x123852?{'count':_0x18873c,'rows':_0x123852}:null;}})[_0x46bc('0x1e')](respondWithResult(_0x171df3,null))['catch'](handleError(_0x171df3,null));}; \ No newline at end of file +var _0x1fa3=['role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','ChatQueueId','options','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','UserChatQueue','findOrCreate','emit','userChatQueue:save','Team','findAll','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','ids','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','undefined','limit','count','offset','Content-Range','json','reject','update','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueue','includeAll','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xa1cdd9,_0x32bc4b){var _0x82f482=function(_0x5e265c){while(--_0x5e265c){_0xa1cdd9['push'](_0xa1cdd9['shift']());}};_0x82f482(++_0x32bc4b);}(_0x1fa3,0xcf));var _0x31fa=function(_0x5c41cb,_0x330705){_0x5c41cb=_0x5c41cb-0x0;var _0x49db41=_0x1fa3[_0x5c41cb];return _0x49db41;};'use strict';var emlformat=require(_0x31fa('0x0'));var rimraf=require(_0x31fa('0x1'));var zipdir=require(_0x31fa('0x2'));var jsonpatch=require(_0x31fa('0x3'));var rp=require(_0x31fa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x31fa('0x5'));var csv=require(_0x31fa('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31fa('0x7'));var _=require(_0x31fa('0x8'));var squel=require(_0x31fa('0x9'));var crypto=require('crypto');var jsforce=require(_0x31fa('0xa'));var deskjs=require(_0x31fa('0xb'));var toCsv=require(_0x31fa('0x6'));var querystring=require(_0x31fa('0xc'));var Papa=require(_0x31fa('0xd'));var Redis=require(_0x31fa('0xe'));var authService=require(_0x31fa('0xf'));var qs=require(_0x31fa('0x10'));var as=require(_0x31fa('0x11'));var hardwareService=require(_0x31fa('0x12'));var logger=require(_0x31fa('0x13'))('api');var utils=require(_0x31fa('0x14'));var config=require(_0x31fa('0x15'));var licenseUtil=require(_0x31fa('0x16'));var db=require(_0x31fa('0x17'))['db'];config[_0x31fa('0x18')]=_[_0x31fa('0x19')](config[_0x31fa('0x18')],{'host':_0x31fa('0x1a'),'port':0x18eb});var socket=require(_0x31fa('0x1b'))(new Redis(config[_0x31fa('0x18')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x31fa('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x401e98,_0x437c87,_0x446b0f,_0x5d3e2f){return new BPromise(function(_0x185f94,_0x51baf2){var _0x16205d=_0x5d3e2f||client;return _0x16205d['request'](_0x401e98,_0x446b0f)[_0x31fa('0x1d')](function(_0x49d4a0){logger[_0x31fa('0x1e')](_0x31fa('0x1f'),_0x437c87,'request\x20sent');logger[_0x31fa('0x20')](_0x31fa('0x21'),_0x437c87,'request\x20sent',JSON[_0x31fa('0x22')](_0x49d4a0));if(_0x49d4a0['error']){if(_0x49d4a0[_0x31fa('0x23')][_0x31fa('0x24')]===0x1f4){logger[_0x31fa('0x23')](_0x31fa('0x1f'),_0x437c87,_0x49d4a0[_0x31fa('0x23')][_0x31fa('0x25')]);return _0x51baf2(_0x49d4a0[_0x31fa('0x23')][_0x31fa('0x25')]);}logger[_0x31fa('0x23')](_0x31fa('0x1f'),_0x437c87,_0x49d4a0['error'][_0x31fa('0x25')]);return _0x185f94(_0x49d4a0[_0x31fa('0x23')]['message']);}else{logger[_0x31fa('0x1e')](_0x31fa('0x1f'),_0x437c87,_0x31fa('0x26'));_0x185f94(_0x49d4a0['result'][_0x31fa('0x25')]);}})[_0x31fa('0x27')](function(_0x510825){logger[_0x31fa('0x23')](_0x31fa('0x1f'),_0x437c87,_0x510825);_0x51baf2(_0x510825);});});}function respondWithStatusCode(_0x2d3c06,_0xd4837){_0xd4837=_0xd4837||0xcc;return function(_0x1b4950){if(_0x1b4950){return _0x2d3c06['sendStatus'](_0xd4837);}return _0x2d3c06[_0x31fa('0x28')](_0xd4837)['end']();};}function respondWithResult(_0x366bc0,_0x1f45db){_0x1f45db=_0x1f45db||0xc8;return function(_0x58b166){if(_0x58b166){return _0x366bc0[_0x31fa('0x28')](_0x1f45db)['json'](_0x58b166);}};}function respondWithFilteredResult(_0xac980c,_0x29fea9){return function(_0x4f2c8e){if(_0x4f2c8e){var _0xa35143=typeof _0x29fea9['offset']===_0x31fa('0x29')&&typeof _0x29fea9[_0x31fa('0x2a')]===_0x31fa('0x29');var _0x1dea52=_0x4f2c8e[_0x31fa('0x2b')];var _0x4bac6b=_0xa35143?0x0:_0x29fea9[_0x31fa('0x2c')];var _0x48db78=_0xa35143?_0x4f2c8e['count']:_0x29fea9[_0x31fa('0x2c')]+_0x29fea9[_0x31fa('0x2a')];var _0x54359e;if(_0x48db78>=_0x1dea52){_0x48db78=_0x1dea52;_0x54359e=0xc8;}else{_0x54359e=0xce;}_0xac980c[_0x31fa('0x28')](_0x54359e);return _0xac980c['set'](_0x31fa('0x2d'),_0x4bac6b+'-'+_0x48db78+'/'+_0x1dea52)[_0x31fa('0x2e')](_0x4f2c8e);}return null;};}function patchUpdates(_0x2c1371){return function(_0xd208){try{jsonpatch['apply'](_0xd208,_0x2c1371,!![]);}catch(_0x3bd6f7){return BPromise[_0x31fa('0x2f')](_0x3bd6f7);}return _0xd208['save']();};}function saveUpdates(_0x417a79,_0x3043ab){return function(_0x28bbbd){if(_0x28bbbd){return _0x28bbbd[_0x31fa('0x30')](_0x417a79)[_0x31fa('0x1d')](function(_0x30acc7){return _0x30acc7;});}return null;};}function removeEntity(_0x46590d,_0x3b3875){return function(_0x46cbe1){if(_0x46cbe1){return _0x46cbe1['destroy']()[_0x31fa('0x1d')](function(){var _0x16ea82=_0x46cbe1[_0x31fa('0x31')]({'plain':!![]});var _0x138ac7='ChatQueues';return db[_0x31fa('0x32')]['destroy']({'where':{'type':_0x138ac7,'resourceId':_0x16ea82['id']}})[_0x31fa('0x1d')](function(){return _0x46cbe1;});})[_0x31fa('0x1d')](function(){_0x46590d[_0x31fa('0x28')](0xcc)[_0x31fa('0x33')]();});}};}function handleEntityNotFound(_0x21c514,_0x479034){return function(_0x3eae3a){if(!_0x3eae3a){_0x21c514['sendStatus'](0x194);}return _0x3eae3a;};}function handleError(_0x2d1064,_0x5df9e5){_0x5df9e5=_0x5df9e5||0x1f4;return function(_0x55d4a7){logger[_0x31fa('0x23')](_0x55d4a7[_0x31fa('0x34')]);if(_0x55d4a7[_0x31fa('0x35')]){delete _0x55d4a7[_0x31fa('0x35')];}_0x2d1064[_0x31fa('0x28')](_0x5df9e5)[_0x31fa('0x36')](_0x55d4a7);};}exports[_0x31fa('0x37')]=function(_0x2e4770,_0x462bdd){var _0x5b82e5={},_0x570429={},_0x294af8={'count':0x0,'rows':[]};var _0x59ac71=_[_0x31fa('0x38')](db['ChatQueue'][_0x31fa('0x39')],function(_0x5c5af8){return{'name':_0x5c5af8[_0x31fa('0x3a')],'type':_0x5c5af8[_0x31fa('0x3b')][_0x31fa('0x3c')]};});_0x570429['model']=_['map'](_0x59ac71,_0x31fa('0x35'));_0x570429[_0x31fa('0x3d')]=_[_0x31fa('0x3e')](_0x2e4770[_0x31fa('0x3d')]);_0x570429[_0x31fa('0x3f')]=_['intersection'](_0x570429[_0x31fa('0x40')],_0x570429[_0x31fa('0x3d')]);_0x5b82e5[_0x31fa('0x41')]=_[_0x31fa('0x42')](_0x570429[_0x31fa('0x40')],qs['fields'](_0x2e4770['query'][_0x31fa('0x43')]));_0x5b82e5[_0x31fa('0x41')]=_0x5b82e5[_0x31fa('0x41')][_0x31fa('0x44')]?_0x5b82e5[_0x31fa('0x41')]:_0x570429[_0x31fa('0x40')];if(!_0x2e4770['query'][_0x31fa('0x45')](_0x31fa('0x46'))){_0x5b82e5['limit']=qs[_0x31fa('0x2a')](_0x2e4770['query'][_0x31fa('0x2a')]);_0x5b82e5['offset']=qs[_0x31fa('0x2c')](_0x2e4770[_0x31fa('0x3d')]['offset']);}_0x5b82e5[_0x31fa('0x47')]=qs[_0x31fa('0x48')](_0x2e4770[_0x31fa('0x3d')]['sort']);_0x5b82e5[_0x31fa('0x49')]=qs[_0x31fa('0x3f')](_[_0x31fa('0x4a')](_0x2e4770[_0x31fa('0x3d')],_0x570429[_0x31fa('0x3f')]),_0x59ac71);if(_0x2e4770[_0x31fa('0x3d')][_0x31fa('0x4b')]){_0x5b82e5[_0x31fa('0x49')]=_[_0x31fa('0x4c')](_0x5b82e5['where'],{'$or':_[_0x31fa('0x38')](_0x59ac71,function(_0x35ff28){if(_0x35ff28[_0x31fa('0x3b')]!==_0x31fa('0x4d')){var _0x6d648d={};_0x6d648d[_0x35ff28[_0x31fa('0x35')]]={'$like':'%'+_0x2e4770[_0x31fa('0x3d')][_0x31fa('0x4b')]+'%'};return _0x6d648d;}})});}_0x5b82e5=_[_0x31fa('0x4c')]({},_0x5b82e5,_0x2e4770['options']);var _0x2456b1={'where':_0x5b82e5['where']};return db[_0x31fa('0x4e')][_0x31fa('0x2b')](_0x2456b1)[_0x31fa('0x1d')](function(_0x25e051){_0x294af8[_0x31fa('0x2b')]=_0x25e051;if(_0x2e4770['query'][_0x31fa('0x4f')]){_0x5b82e5[_0x31fa('0x50')]=[{'all':!![]}];}return db[_0x31fa('0x4e')]['findAll'](_0x5b82e5);})[_0x31fa('0x1d')](function(_0x22746d){_0x294af8[_0x31fa('0x51')]=_0x22746d;return _0x294af8;})[_0x31fa('0x1d')](respondWithFilteredResult(_0x462bdd,_0x5b82e5))[_0x31fa('0x27')](handleError(_0x462bdd,null));};exports[_0x31fa('0x52')]=function(_0x5d72ef,_0x33f48b){var _0x44bba0={'raw':!![],'where':{'id':_0x5d72ef[_0x31fa('0x53')]['id']}},_0x398fe1={};_0x398fe1[_0x31fa('0x40')]=_['keys'](db[_0x31fa('0x4e')][_0x31fa('0x39')]);_0x398fe1['query']=_['keys'](_0x5d72ef['query']);_0x398fe1['filters']=_[_0x31fa('0x42')](_0x398fe1[_0x31fa('0x40')],_0x398fe1['query']);_0x44bba0[_0x31fa('0x41')]=_[_0x31fa('0x42')](_0x398fe1[_0x31fa('0x40')],qs[_0x31fa('0x43')](_0x5d72ef['query'][_0x31fa('0x43')]));_0x44bba0[_0x31fa('0x41')]=_0x44bba0[_0x31fa('0x41')][_0x31fa('0x44')]?_0x44bba0[_0x31fa('0x41')]:_0x398fe1[_0x31fa('0x40')];if(_0x5d72ef['query'][_0x31fa('0x4f')]){_0x44bba0[_0x31fa('0x50')]=[{'all':!![]}];}_0x44bba0=_[_0x31fa('0x4c')]({},_0x44bba0,_0x5d72ef['options']);return db[_0x31fa('0x4e')][_0x31fa('0x54')](_0x44bba0)[_0x31fa('0x1d')](handleEntityNotFound(_0x33f48b,null))[_0x31fa('0x1d')](respondWithResult(_0x33f48b,null))[_0x31fa('0x27')](handleError(_0x33f48b,null));};exports[_0x31fa('0x55')]=function(_0x2189d8,_0x4b4101){return db[_0x31fa('0x4e')][_0x31fa('0x55')](_0x2189d8[_0x31fa('0x56')],{})[_0x31fa('0x1d')](function(_0x36e194){var _0x1986c8=_0x2189d8[_0x31fa('0x57')][_0x31fa('0x31')]({'plain':!![]});if(!_0x1986c8)throw new Error(_0x31fa('0x58'));if(_0x1986c8[_0x31fa('0x59')]==='user'){var _0x2cdcc4=_0x36e194['get']({'plain':!![]});var _0x3928c2='ChatQueues';return db['UserProfileSection'][_0x31fa('0x54')]({'where':{'name':_0x3928c2,'userProfileId':_0x1986c8['userProfileId']},'raw':!![]})[_0x31fa('0x1d')](function(_0x392fd7){if(_0x392fd7&&_0x392fd7[_0x31fa('0x5a')]===0x0){return db[_0x31fa('0x32')][_0x31fa('0x55')]({'name':_0x2cdcc4[_0x31fa('0x35')],'resourceId':_0x2cdcc4['id'],'type':_0x392fd7[_0x31fa('0x35')],'sectionId':_0x392fd7['id']},{})[_0x31fa('0x1d')](function(){return _0x36e194;});}else{return _0x36e194;}})['catch'](function(_0x20547d){logger['error'](_0x31fa('0x5b'),_0x20547d);throw _0x20547d;});}return _0x36e194;})[_0x31fa('0x1d')](respondWithResult(_0x4b4101,0xc9))[_0x31fa('0x27')](handleError(_0x4b4101,null));};exports[_0x31fa('0x30')]=function(_0x109ab9,_0x5ecdea){if(_0x109ab9[_0x31fa('0x56')]['id']){delete _0x109ab9[_0x31fa('0x56')]['id'];}return db[_0x31fa('0x4e')][_0x31fa('0x54')]({'where':{'id':_0x109ab9[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](handleEntityNotFound(_0x5ecdea,null))[_0x31fa('0x1d')](saveUpdates(_0x109ab9[_0x31fa('0x56')],null))['then'](respondWithResult(_0x5ecdea,null))['catch'](handleError(_0x5ecdea,null));};exports['destroy']=function(_0x5c26f0,_0x54573e){return db[_0x31fa('0x4e')]['find']({'where':{'id':_0x5c26f0[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](handleEntityNotFound(_0x54573e,null))['then'](removeEntity(_0x54573e,null))['catch'](handleError(_0x54573e,null));};exports[_0x31fa('0x5c')]=function(_0x27672a,_0x5f3240){return db[_0x31fa('0x4e')][_0x31fa('0x5c')]()[_0x31fa('0x1d')](respondWithResult(_0x5f3240,null))['catch'](handleError(_0x5f3240,null));};exports['getMembers']=function(_0x2d9fff,_0x1891ff,_0x125452){var _0x5cb8ab={'raw':!![],'where':{}},_0x2885d2={},_0x5bb2e7;return db[_0x31fa('0x4e')][_0x31fa('0x5d')]({'where':{'id':_0x2d9fff[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](handleEntityNotFound(_0x1891ff,null))[_0x31fa('0x1d')](function(_0x1bfff0){if(_0x1bfff0){_0x5bb2e7=_0x1bfff0[_0x31fa('0x31')]({'plain':!![]});_0x2885d2[_0x31fa('0x40')]=_[_0x31fa('0x3e')](db['UserChatQueue'][_0x31fa('0x39')]);_0x2885d2['query']=_[_0x31fa('0x3e')](_0x2d9fff[_0x31fa('0x3d')]);_0x2885d2[_0x31fa('0x3f')]=_[_0x31fa('0x42')](_0x2885d2[_0x31fa('0x40')],_0x2885d2[_0x31fa('0x3d')]);_0x5cb8ab[_0x31fa('0x41')]=_[_0x31fa('0x42')](_0x2885d2[_0x31fa('0x40')],qs[_0x31fa('0x43')](_0x2d9fff[_0x31fa('0x3d')][_0x31fa('0x43')]));_0x5cb8ab[_0x31fa('0x41')]=_0x5cb8ab['attributes'][_0x31fa('0x44')]?_0x5cb8ab['attributes']:_0x2885d2[_0x31fa('0x40')];if(!_0x2d9fff[_0x31fa('0x3d')][_0x31fa('0x45')]('nolimit')){_0x5cb8ab[_0x31fa('0x2a')]=qs['limit'](_0x2d9fff['query'][_0x31fa('0x2a')]);_0x5cb8ab[_0x31fa('0x2c')]=qs[_0x31fa('0x2c')](_0x2d9fff[_0x31fa('0x3d')][_0x31fa('0x2c')]);}_0x5cb8ab[_0x31fa('0x47')]=qs[_0x31fa('0x48')](_0x2d9fff[_0x31fa('0x3d')]['sort']);_0x5cb8ab[_0x31fa('0x49')]=qs['filters'](_[_0x31fa('0x4a')](_0x2d9fff['query'],_0x2885d2[_0x31fa('0x3f')]));_0x5cb8ab[_0x31fa('0x49')][_0x31fa('0x5e')]=_0x1bfff0['id'];if(_0x2d9fff[_0x31fa('0x3d')][_0x31fa('0x4b')]){_0x5cb8ab[_0x31fa('0x49')]=_[_0x31fa('0x4c')](_0x5cb8ab[_0x31fa('0x49')],{'$or':_['map'](_0x5cb8ab[_0x31fa('0x41')],function(_0x30e66d){var _0x5b0ed5={};_0x5b0ed5[_0x30e66d]={'$like':'%'+_0x2d9fff[_0x31fa('0x3d')][_0x31fa('0x4b')]+'%'};return _0x5b0ed5;})});}_0x5cb8ab=_[_0x31fa('0x4c')]({},_0x5cb8ab,_0x2d9fff[_0x31fa('0x5f')]);return db['UserChatQueue']['findAll'](_0x5cb8ab);}})['then'](function(_0x4b1070){if(_0x4b1070){return db['User']['findAndCountAll']({'where':{'id':_[_0x31fa('0x38')](_0x4b1070,_0x31fa('0x60')),'role':_0x31fa('0x61')},'attributes':['id',_0x31fa('0x35'),_0x31fa('0x62'),_0x31fa('0x63'),_0x31fa('0x64')]});}})[_0x31fa('0x1d')](function(_0x16358d){if(_0x16358d){return{'count':_0x16358d[_0x31fa('0x2b')],'rows':_[_0x31fa('0x38')](_0x16358d[_0x31fa('0x51')],function(_0x2b25f2){return{'membername':_0x2b25f2[_0x31fa('0x35')],'UserId':_0x2b25f2['id'],'queue_name':_0x5bb2e7[_0x31fa('0x35')],'ChatQueueId':_0x5bb2e7['id'],'interface':util[_0x31fa('0x65')](_0x31fa('0x66'),_0x31fa('0x67'),_0x2b25f2['name']),'penalty':0x0,'paused':_0x2b25f2['chatPause'],'createdAt':_0x2b25f2[_0x31fa('0x64')],'updatedAt':_0x2b25f2[_0x31fa('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x31fa('0x1d')](respondWithFilteredResult(_0x1891ff,_0x5cb8ab))[_0x31fa('0x27')](handleError(_0x1891ff,null));};exports['getTeams']=function(_0x1861a2,_0x13a441,_0x30afbf){var _0x587a5c={};var _0xaf25c1={};var _0xf08321;var _0x5ac64b;return db[_0x31fa('0x4e')]['findOne']({'where':{'id':_0x1861a2[_0x31fa('0x53')]['id']}})['then'](handleEntityNotFound(_0x13a441,null))[_0x31fa('0x1d')](function(_0x166b52){if(_0x166b52){_0xf08321=_0x166b52;_0xaf25c1[_0x31fa('0x40')]=_[_0x31fa('0x3e')](db['Team']['rawAttributes']);_0xaf25c1[_0x31fa('0x3d')]=_[_0x31fa('0x3e')](_0x1861a2['query']);_0xaf25c1['filters']=_['intersection'](_0xaf25c1[_0x31fa('0x40')],_0xaf25c1[_0x31fa('0x3d')]);_0x587a5c['attributes']=_[_0x31fa('0x42')](_0xaf25c1[_0x31fa('0x40')],qs[_0x31fa('0x43')](_0x1861a2[_0x31fa('0x3d')][_0x31fa('0x43')]));_0x587a5c[_0x31fa('0x41')]=_0x587a5c['attributes'][_0x31fa('0x44')]?_0x587a5c[_0x31fa('0x41')]:_0xaf25c1[_0x31fa('0x40')];_0x587a5c[_0x31fa('0x47')]=qs['sort'](_0x1861a2[_0x31fa('0x3d')][_0x31fa('0x48')]);_0x587a5c['where']=qs[_0x31fa('0x3f')](_[_0x31fa('0x4a')](_0x1861a2['query'],_0xaf25c1[_0x31fa('0x3f')]));if(_0x1861a2[_0x31fa('0x3d')][_0x31fa('0x4b')]){_0x587a5c[_0x31fa('0x49')]=_['merge'](_0x587a5c[_0x31fa('0x49')],{'$or':_[_0x31fa('0x38')](_0x587a5c['attributes'],function(_0x355977){var _0x227a1d={};_0x227a1d[_0x355977]={'$like':'%'+_0x1861a2[_0x31fa('0x3d')][_0x31fa('0x4b')]+'%'};return _0x227a1d;})});}_0x587a5c=_[_0x31fa('0x4c')]({},_0x587a5c,_0x1861a2[_0x31fa('0x5f')]);return _0xf08321[_0x31fa('0x68')](_0x587a5c);}})[_0x31fa('0x1d')](function(_0x3005c1){if(_0x3005c1){_0x5ac64b=_0x3005c1[_0x31fa('0x44')];if(!_0x1861a2[_0x31fa('0x3d')][_0x31fa('0x45')](_0x31fa('0x46'))){_0x587a5c[_0x31fa('0x2a')]=qs[_0x31fa('0x2a')](_0x1861a2[_0x31fa('0x3d')]['limit']);_0x587a5c[_0x31fa('0x2c')]=qs[_0x31fa('0x2c')](_0x1861a2[_0x31fa('0x3d')]['offset']);}return _0xf08321[_0x31fa('0x68')](_0x587a5c);}})[_0x31fa('0x1d')](function(_0x3c59c4){if(_0x3c59c4){return _0x3c59c4?{'count':_0x5ac64b,'rows':_0x3c59c4}:null;}})[_0x31fa('0x1d')](respondWithResult(_0x13a441,null))[_0x31fa('0x27')](handleError(_0x13a441,null));};exports[_0x31fa('0x69')]=function(_0x3a96c7,_0x1de1c3,_0x4b8bb6){var _0x5eb67b=_0x3a96c7['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x5eb67b},'attributes':['id'],'include':[{'model':db[_0x31fa('0x6a')],'as':_0x31fa('0x6b'),'attributes':['id',_0x31fa('0x35'),_0x31fa('0x6c'),_0x31fa('0x6d'),_0x31fa('0x6e')],'raw':!![]}]})['then'](function(_0x43b31c){if(_0x43b31c){var _0x46d9cf=_[_0x31fa('0x6f')](_0x43b31c,function(_0x1070fc){var _0x1d760e=_0x1070fc[_0x31fa('0x31')]({'plain':!![]});return _0x1d760e[_0x31fa('0x6b')];});return db[_0x31fa('0x4e')][_0x31fa('0x54')]({'where':{'id':_0x3a96c7[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](function(_0xc73174){return db[_0x31fa('0x70')][_0x31fa('0x71')](function(_0x4dddc7){return _0xc73174['addTeams'](_0x5eb67b,{'transaction':_0x4dddc7})[_0x31fa('0x1d')](function(){return BPromise[_0x31fa('0x72')](_0x46d9cf,function(_0x14a4f7){return db[_0x31fa('0x73')][_0x31fa('0x74')]({'where':{'UserId':_0x14a4f7['id'],'ChatQueueId':_0x3a96c7[_0x31fa('0x53')]['id']},'transaction':_0x4dddc7});});})[_0x31fa('0x1d')](function(){_0x46d9cf['forEach'](function(_0x188e57){socket[_0x31fa('0x75')](_0x31fa('0x76'),{'UserId':_0x188e57['id'],'ChatQueueId':_0xc73174['id']});});});});});}})[_0x31fa('0x1d')](respondWithStatusCode(_0x1de1c3,null))[_0x31fa('0x27')](handleError(_0x1de1c3,null));};exports['removeTeams']=function(_0x3a8abe,_0x17c106,_0x1e7996){return db[_0x31fa('0x77')][_0x31fa('0x78')]({'where':{'id':_0x3a8abe['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x31fa('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x17c106,null))['then'](function(_0x2b6714){var _0x576036=_[_0x31fa('0x38')](_0x2b6714,'id');var _0x2a2acc=[];var _0x44cf62=[];var _0x3d3395=squel['select']();_0x3d3395[_0x31fa('0x79')](_0x31fa('0x7a'))[_0x31fa('0x7b')](_0x31fa('0x7c'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x31fa('0x49')](_0x31fa('0x7d'),_0x3a8abe['params']['id']);for(var _0x85a503=0x0;_0x85a503<_0x2b6714[_0x31fa('0x44')];_0x85a503+=0x1){let _0x2a8318=_0x2b6714[_0x85a503];for(var _0x5de66c=0x0;_0x5de66c<_0x2a8318['Agents']['length'];_0x5de66c+=0x1){let _0x32d0de=_0x2a8318['Agents'][_0x5de66c];var _0x4a7371=_0x3d3395[_0x31fa('0x7e')]();_0x4a7371[_0x31fa('0x49')](_0x31fa('0x7f'),_0x32d0de['id']);_0x44cf62[_0x31fa('0x80')](db[_0x31fa('0x70')][_0x31fa('0x3d')](_0x4a7371[_0x31fa('0x81')](),{'type':db[_0x31fa('0x70')][_0x31fa('0x82')][_0x31fa('0x83')]})['then'](function(_0x58ea0c){if(_0x58ea0c[_0x31fa('0x44')]===0x1){return _0x32d0de['id'];}else{var _0xa51f08=_[_0x31fa('0x84')](_[_0x31fa('0x38')](_0x58ea0c,_0x31fa('0x85')),function(_0x2b97b3){return _[_0x31fa('0x86')](_0x576036,_0x2b97b3);});if(_0xa51f08){return _0x32d0de['id'];}}}));}}return BPromise[_0x31fa('0x87')](_0x44cf62)[_0x31fa('0x1d')](function(_0x3d1ba7){_0x2a2acc=_(_0x2a2acc)[_0x31fa('0x88')](_0x3d1ba7)[_0x31fa('0x89')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x3a8abe[_0x31fa('0x53')]['id']}})['then'](function(_0x2a88b4){return db[_0x31fa('0x70')][_0x31fa('0x71')](function(_0x5905a1){return _0x2a88b4[_0x31fa('0x8a')](_0x3a8abe[_0x31fa('0x3d')][_0x31fa('0x8b')],{'transaction':_0x5905a1})[_0x31fa('0x1d')](function(){if(!_['isEmpty'](_0x2a2acc)){return _0x2a88b4[_0x31fa('0x8c')](_0x2a2acc,{'transaction':_0x5905a1});}})[_0x31fa('0x1d')](function(){_0x2a2acc[_0x31fa('0x8d')](function(_0xe8ff14){socket[_0x31fa('0x75')](_0x31fa('0x8e'),{'UserId':_0xe8ff14,'ChatQueueId':_0x2a88b4['id']});});});});});});})['then'](respondWithStatusCode(_0x17c106,null))[_0x31fa('0x27')](handleError(_0x17c106,null));};exports[_0x31fa('0x8f')]=function(_0x58328c,_0x33f6f7,_0x507b76){return db[_0x31fa('0x4e')][_0x31fa('0x54')]({'where':{'id':_0x58328c[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](handleEntityNotFound(_0x33f6f7,null))[_0x31fa('0x1d')](function(_0x492765){if(_0x492765){return _0x492765[_0x31fa('0x8f')](_0x58328c[_0x31fa('0x56')][_0x31fa('0x8b')],_[_0x31fa('0x90')](_0x58328c[_0x31fa('0x56')],[_0x31fa('0x8b'),'id'])||{})[_0x31fa('0x91')](function(_0x2310fc){for(var _0x2e57da=0x0;_0x2e57da<_0x58328c[_0x31fa('0x56')][_0x31fa('0x8b')][_0x31fa('0x44')];_0x2e57da+=0x1){socket[_0x31fa('0x75')](_0x31fa('0x76'),{'UserId':Number(_0x58328c['body'][_0x31fa('0x8b')][_0x2e57da]),'ChatQueueId':Number(_0x58328c[_0x31fa('0x53')]['id'])});}return _0x2310fc;});}})[_0x31fa('0x1d')](respondWithResult(_0x33f6f7,null))[_0x31fa('0x27')](handleError(_0x33f6f7,null));};exports[_0x31fa('0x8c')]=function(_0x5bcbab,_0x34647e,_0x3032e6){return db[_0x31fa('0x4e')][_0x31fa('0x54')]({'where':{'id':_0x5bcbab[_0x31fa('0x53')]['id']}})[_0x31fa('0x1d')](handleEntityNotFound(_0x34647e,null))[_0x31fa('0x1d')](function(_0x3211fa){if(_0x3211fa){return _0x3211fa[_0x31fa('0x8c')](_0x5bcbab['query'][_0x31fa('0x8b')])[_0x31fa('0x1d')](function(){if(_[_0x31fa('0x92')](_0x5bcbab[_0x31fa('0x3d')]['ids'])){for(var _0x200ec3=0x0;_0x200ec3<_0x5bcbab[_0x31fa('0x3d')][_0x31fa('0x8b')]['length'];_0x200ec3+=0x1){socket[_0x31fa('0x75')]('userChatQueue:remove',{'UserId':Number(_0x5bcbab['query'][_0x31fa('0x8b')][_0x200ec3]),'ChatQueueId':Number(_0x5bcbab['params']['id'])});}}else{socket[_0x31fa('0x75')]('userChatQueue:remove',{'UserId':Number(_0x5bcbab[_0x31fa('0x3d')][_0x31fa('0x8b')]),'ChatQueueId':Number(_0x5bcbab[_0x31fa('0x53')]['id'])});}});}})[_0x31fa('0x1d')](respondWithStatusCode(_0x34647e,null))[_0x31fa('0x27')](handleError(_0x34647e,null));};exports[_0x31fa('0x93')]=function(_0x32e5f4,_0x5027ac,_0x2a2daf){var _0x2e85cc={};var _0x40d189={};var _0x4d709a;var _0x1bb3e1;return db[_0x31fa('0x4e')][_0x31fa('0x5d')]({'where':{'id':_0x32e5f4[_0x31fa('0x53')]['id']}})['then'](handleEntityNotFound(_0x5027ac,null))[_0x31fa('0x1d')](function(_0x36331b){if(_0x36331b){_0x4d709a=_0x36331b;_0x40d189[_0x31fa('0x40')]=_['keys'](db[_0x31fa('0x6a')][_0x31fa('0x39')]);_0x40d189[_0x31fa('0x3d')]=_[_0x31fa('0x3e')](_0x32e5f4[_0x31fa('0x3d')]);_0x40d189['filters']=_[_0x31fa('0x42')](_0x40d189[_0x31fa('0x40')],_0x40d189[_0x31fa('0x3d')]);_0x2e85cc['attributes']=_['intersection'](_0x40d189[_0x31fa('0x40')],qs[_0x31fa('0x43')](_0x32e5f4[_0x31fa('0x3d')][_0x31fa('0x43')]));_0x2e85cc['attributes']=_0x2e85cc[_0x31fa('0x41')][_0x31fa('0x44')]?_0x2e85cc[_0x31fa('0x41')]:_0x40d189[_0x31fa('0x40')];_0x2e85cc[_0x31fa('0x47')]=qs[_0x31fa('0x48')](_0x32e5f4[_0x31fa('0x3d')][_0x31fa('0x48')]);_0x2e85cc[_0x31fa('0x49')]=qs[_0x31fa('0x3f')](_[_0x31fa('0x4a')](_0x32e5f4[_0x31fa('0x3d')],_0x40d189[_0x31fa('0x3f')]));if(_0x32e5f4['query'][_0x31fa('0x4b')]){_0x2e85cc[_0x31fa('0x49')]=_[_0x31fa('0x4c')](_0x2e85cc[_0x31fa('0x49')],{'$or':_[_0x31fa('0x38')](_0x2e85cc[_0x31fa('0x41')],function(_0x1eb988){var _0xce1aca={};_0xce1aca[_0x1eb988]={'$like':'%'+_0x32e5f4[_0x31fa('0x3d')][_0x31fa('0x4b')]+'%'};return _0xce1aca;})});}_0x2e85cc=_['merge']({},_0x2e85cc,_0x32e5f4['options']);return _0x4d709a['getAgents'](_0x2e85cc);}})[_0x31fa('0x1d')](function(_0x486ce8){if(_0x486ce8){_0x1bb3e1=_0x486ce8[_0x31fa('0x44')];if(!_0x32e5f4[_0x31fa('0x3d')][_0x31fa('0x45')](_0x31fa('0x46'))){_0x2e85cc['limit']=qs[_0x31fa('0x2a')](_0x32e5f4[_0x31fa('0x3d')][_0x31fa('0x2a')]);_0x2e85cc[_0x31fa('0x2c')]=qs['offset'](_0x32e5f4[_0x31fa('0x3d')]['offset']);}return _0x4d709a[_0x31fa('0x93')](_0x2e85cc);}})[_0x31fa('0x1d')](function(_0x197d05){if(_0x197d05){return _0x197d05?{'count':_0x1bb3e1,'rows':_0x197d05}:null;}})[_0x31fa('0x1d')](respondWithResult(_0x5027ac,null))[_0x31fa('0x27')](handleError(_0x5027ac,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index dd8bb01..722948d 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 _0x4134=['exports','events','ChatQueue','setMaxListeners'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4134,0x89));var _0x4413=function(_0x12c65a,_0x3ba5ac){_0x12c65a=_0x12c65a-0x0;var _0x262a77=_0x4134[_0x12c65a];return _0x262a77;};'use strict';var EventEmitter=require(_0x4413('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4413('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4413('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30e001){return function(_0x373dc7,_0x5d7f2c,_0x39856d){ChatQueueEvents['emit'](_0x30e001+':'+_0x373dc7['id'],_0x373dc7);ChatQueueEvents['emit'](_0x30e001,_0x373dc7);_0x39856d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x4413('0x3')]=ChatQueueEvents; \ No newline at end of file +var _0x62b3=['save','update','remove','emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x3c7d06,_0x3a8eb6){var _0x14be70=function(_0x14c343){while(--_0x14c343){_0x3c7d06['push'](_0x3c7d06['shift']());}};_0x14be70(++_0x3a8eb6);}(_0x62b3,0x19c));var _0x362b=function(_0x9723e4,_0x52f61c){_0x9723e4=_0x9723e4-0x0;var _0x3393e9=_0x62b3[_0x9723e4];return _0x3393e9;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x362b('0x0')](0x0);var events={'afterCreate':_0x362b('0x1'),'afterUpdate':_0x362b('0x2'),'afterDestroy':_0x362b('0x3')};function emitEvent(_0x18b4e8){return function(_0x5b65b8,_0x1a5ed3,_0x16557d){ChatQueueEvents[_0x362b('0x4')](_0x18b4e8+':'+_0x5b65b8['id'],_0x5b65b8);ChatQueueEvents[_0x362b('0x4')](_0x18b4e8,_0x5b65b8);_0x16557d(null);};}for(var e in events){if(events[_0x362b('0x5')](e)){var event=events[e];ChatQueue[_0x362b('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 615f7e1..44ee8d2 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 _0x6093=['path','rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x15891b,_0xb8c1ee){var _0x3c16ce=function(_0x230da0){while(--_0x230da0){_0x15891b['push'](_0x15891b['shift']());}};_0x3c16ce(++_0xb8c1ee);}(_0x6093,0x66));var _0x3609=function(_0x54aa73,_0x1a53a5){_0x54aa73=_0x54aa73-0x0;var _0x12e83d=_0x6093[_0x54aa73];return _0x12e83d;};'use strict';var _=require(_0x3609('0x0'));var util=require(_0x3609('0x1'));var logger=require(_0x3609('0x2'))(_0x3609('0x3'));var moment=require(_0x3609('0x4'));var BPromise=require('bluebird');var rp=require(_0x3609('0x5'));var fs=require('fs');var path=require(_0x3609('0x6'));var rimraf=require(_0x3609('0x7'));var config=require(_0x3609('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x2711f3,_0x48bd21){return _0x2711f3[_0x3609('0x9')](_0x3609('0xa'),attributes,{'tableName':_0x3609('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f23=['moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash'];(function(_0x17ebb6,_0x465af7){var _0x32ec22=function(_0x160ff0){while(--_0x160ff0){_0x17ebb6['push'](_0x17ebb6['shift']());}};_0x32ec22(++_0x465af7);}(_0x2f23,0xf9));var _0x32f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f23[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x32f2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x32f2('0x1'));var BPromise=require(_0x32f2('0x2'));var rp=require(_0x32f2('0x3'));var fs=require('fs');var path=require(_0x32f2('0x4'));var rimraf=require(_0x32f2('0x5'));var config=require('../../config/environment');var attributes=require(_0x32f2('0x6'));module['exports']=function(_0x35444f,_0x2b04fb){return _0x35444f[_0x32f2('0x7')](_0x32f2('0x8'),attributes,{'tableName':_0x32f2('0x9'),'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 664c017..c2a9f22 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 _0x3746=['catch','GetChatQueue','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x5318fc,_0x22b166){var _0x5537d6=function(_0x3e9e8a){while(--_0x3e9e8a){_0x5318fc['push'](_0x5318fc['shift']());}};_0x5537d6(++_0x22b166);}(_0x3746,0xa9));var _0x6374=function(_0x28076e,_0x3c2b2c){_0x28076e=_0x28076e-0x0;var _0x53eb69=_0x3746[_0x28076e];return _0x53eb69;};'use strict';var _=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var moment=require('moment');var BPromise=require(_0x6374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6374('0x3'));var db=require(_0x6374('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6374('0x5'));var config=require(_0x6374('0x6'));var jayson=require(_0x6374('0x7'));var client=jayson[_0x6374('0x8')][_0x6374('0x9')]({'port':0x232a});config[_0x6374('0xa')]=_[_0x6374('0xb')](config[_0x6374('0xa')],{'host':_0x6374('0xc'),'port':0x18eb});var socket=require(_0x6374('0xd'))(new Redis(config['redis']));require(_0x6374('0xe'))['register'](socket);function respondWithRpcPromise(_0x323af1,_0x32b4d3,_0x1acacf){return new BPromise(function(_0x585eed,_0x154b00){return client[_0x6374('0xf')](_0x323af1,_0x1acacf)[_0x6374('0x10')](function(_0x4f0189){logger[_0x6374('0x11')](_0x6374('0x12'),_0x32b4d3,'request\x20sent');logger[_0x6374('0x13')](_0x6374('0x14'),_0x32b4d3,_0x6374('0x15'),JSON['stringify'](_0x4f0189));if(_0x4f0189[_0x6374('0x16')]){if(_0x4f0189[_0x6374('0x16')][_0x6374('0x17')]===0x1f4){logger['error'](_0x6374('0x12'),_0x32b4d3,_0x4f0189['error']['message']);return _0x154b00(_0x4f0189[_0x6374('0x16')]['message']);}logger[_0x6374('0x16')](_0x6374('0x12'),_0x32b4d3,_0x4f0189[_0x6374('0x16')][_0x6374('0x18')]);return _0x585eed(_0x4f0189[_0x6374('0x16')][_0x6374('0x18')]);}else{logger[_0x6374('0x11')](_0x6374('0x12'),_0x32b4d3,_0x6374('0x15'));_0x585eed(_0x4f0189[_0x6374('0x19')][_0x6374('0x18')]);}})[_0x6374('0x1a')](function(_0x4f8db8){logger[_0x6374('0x16')](_0x6374('0x12'),_0x32b4d3,_0x4f8db8);_0x154b00(_0x4f8db8);});});}exports[_0x6374('0x1b')]=function(_0x46fdc2){var _0x3b8ed2=this;return new Promise(function(_0x3ec117,_0x101d49){return db['ChatQueue']['findAll']({'raw':_0x46fdc2[_0x6374('0x1c')]?_0x46fdc2['options'][_0x6374('0x1d')]===undefined?!![]:![]:!![],'where':_0x46fdc2[_0x6374('0x1c')]?_0x46fdc2[_0x6374('0x1c')][_0x6374('0x1e')]||null:null,'attributes':_0x46fdc2['options']?_0x46fdc2[_0x6374('0x1c')][_0x6374('0x1f')]||null:null,'limit':_0x46fdc2[_0x6374('0x1c')]?_0x46fdc2[_0x6374('0x1c')][_0x6374('0x20')]||null:null,'include':_0x46fdc2[_0x6374('0x1c')]?_0x46fdc2[_0x6374('0x1c')][_0x6374('0x21')]?_['map'](_0x46fdc2[_0x6374('0x1c')][_0x6374('0x21')],function(_0x1b8f18){return{'model':db[_0x1b8f18['model']],'as':_0x1b8f18['as'],'attributes':_0x1b8f18[_0x6374('0x1f')],'include':_0x1b8f18['include']?_[_0x6374('0x22')](_0x1b8f18[_0x6374('0x21')],function(_0x8d5419){return{'model':db[_0x8d5419[_0x6374('0x23')]],'as':_0x8d5419['as'],'attributes':_0x8d5419[_0x6374('0x1f')],'include':_0x8d5419[_0x6374('0x21')]?_[_0x6374('0x22')](_0x8d5419[_0x6374('0x21')],function(_0x2f1f06){return{'model':db[_0x2f1f06['model']],'as':_0x2f1f06['as'],'attributes':_0x2f1f06[_0x6374('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6374('0x10')](function(_0x11ae6d){logger['info'](_0x6374('0x1b'),_0x46fdc2);logger[_0x6374('0x13')]('GetChatQueue',_0x46fdc2,JSON[_0x6374('0x24')](_0x11ae6d));_0x3ec117(_0x11ae6d);})['catch'](function(_0x4b7038){logger['error']('GetChatQueue',_0x4b7038['message'],_0x46fdc2);_0x101d49(_0x3b8ed2[_0x6374('0x16')](0x1f4,_0x4b7038['message']));});});};exports['ShowChatQueue']=function(_0x3e7278){var _0x413043=this;return new Promise(function(_0x3e5a5a,_0x37906f){return db['ChatQueue'][_0x6374('0x25')]({'raw':_0x3e7278['options']?_0x3e7278[_0x6374('0x1c')][_0x6374('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e7278[_0x6374('0x1c')]?_0x3e7278[_0x6374('0x1c')][_0x6374('0x1e')]||null:null,'attributes':_0x3e7278[_0x6374('0x1c')]?_0x3e7278[_0x6374('0x1c')][_0x6374('0x1f')]||null:null,'include':_0x3e7278[_0x6374('0x1c')]?_0x3e7278['options'][_0x6374('0x21')]?_[_0x6374('0x22')](_0x3e7278['options'][_0x6374('0x21')],function(_0x253bb1){return{'model':db[_0x253bb1[_0x6374('0x23')]],'as':_0x253bb1['as'],'attributes':_0x253bb1[_0x6374('0x1f')],'include':_0x253bb1[_0x6374('0x21')]?_[_0x6374('0x22')](_0x253bb1['include'],function(_0x38b7f6){return{'model':db[_0x38b7f6[_0x6374('0x23')]],'as':_0x38b7f6['as'],'attributes':_0x38b7f6[_0x6374('0x1f')],'include':_0x38b7f6[_0x6374('0x21')]?_[_0x6374('0x22')](_0x38b7f6[_0x6374('0x21')],function(_0x3f309a){return{'model':db[_0x3f309a['model']],'as':_0x3f309a['as'],'attributes':_0x3f309a[_0x6374('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6374('0x10')](function(_0x18206e){logger['info'](_0x6374('0x26'),_0x3e7278);logger[_0x6374('0x13')]('ShowChatQueue',_0x3e7278,JSON[_0x6374('0x24')](_0x18206e));_0x3e5a5a(_0x18206e);})[_0x6374('0x1a')](function(_0x2d0100){logger[_0x6374('0x16')](_0x6374('0x26'),_0x2d0100['message'],_0x3e7278);_0x37906f(_0x413043[_0x6374('0x16')](0x1f4,_0x2d0100[_0x6374('0x18')]));});});}; \ No newline at end of file +var _0xbb35=['include','ShowChatQueue','ChatQueue','find','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','findAll','options','where','attributes','limit','map','model'];(function(_0x10bf44,_0x33564a){var _0x542225=function(_0x4d617d){while(--_0x4d617d){_0x10bf44['push'](_0x10bf44['shift']());}};_0x542225(++_0x33564a);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x54d8c5,_0x236001){_0x54d8c5=_0x54d8c5-0x0;var _0x210790=_0xbb35[_0x54d8c5];return _0x210790;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var rs=require(_0x5bb3('0x3'));var fs=require('fs');var Redis=require(_0x5bb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb3('0x5'));var logger=require(_0x5bb3('0x6'))(_0x5bb3('0x7'));var config=require(_0x5bb3('0x8'));var jayson=require(_0x5bb3('0x9'));var client=jayson[_0x5bb3('0xa')][_0x5bb3('0xb')]({'port':0x232a});config[_0x5bb3('0xc')]=_[_0x5bb3('0xd')](config['redis'],{'host':_0x5bb3('0xe'),'port':0x18eb});var socket=require(_0x5bb3('0xf'))(new Redis(config[_0x5bb3('0xc')]));require(_0x5bb3('0x10'))['register'](socket);function respondWithRpcPromise(_0x399f28,_0x5621a8,_0x4035d1){return new BPromise(function(_0x5a8b3b,_0x12513f){return client[_0x5bb3('0x11')](_0x399f28,_0x4035d1)[_0x5bb3('0x12')](function(_0x3212c8){logger[_0x5bb3('0x13')]('ChatQueue,\x20%s,\x20%s',_0x5621a8,_0x5bb3('0x14'));logger[_0x5bb3('0x15')](_0x5bb3('0x16'),_0x5621a8,'request\x20sent',JSON[_0x5bb3('0x17')](_0x3212c8));if(_0x3212c8[_0x5bb3('0x18')]){if(_0x3212c8[_0x5bb3('0x18')][_0x5bb3('0x19')]===0x1f4){logger[_0x5bb3('0x18')](_0x5bb3('0x1a'),_0x5621a8,_0x3212c8[_0x5bb3('0x18')][_0x5bb3('0x1b')]);return _0x12513f(_0x3212c8['error']['message']);}logger['error'](_0x5bb3('0x1a'),_0x5621a8,_0x3212c8[_0x5bb3('0x18')][_0x5bb3('0x1b')]);return _0x5a8b3b(_0x3212c8[_0x5bb3('0x18')][_0x5bb3('0x1b')]);}else{logger[_0x5bb3('0x13')](_0x5bb3('0x1a'),_0x5621a8,_0x5bb3('0x14'));_0x5a8b3b(_0x3212c8[_0x5bb3('0x1c')][_0x5bb3('0x1b')]);}})['catch'](function(_0x5a541b){logger[_0x5bb3('0x18')](_0x5bb3('0x1a'),_0x5621a8,_0x5a541b);_0x12513f(_0x5a541b);});});}exports[_0x5bb3('0x1d')]=function(_0x442ee2){var _0x197d38=this;return new Promise(function(_0x3fe551,_0x2630b4){return db['ChatQueue'][_0x5bb3('0x1e')]({'raw':_0x442ee2[_0x5bb3('0x1f')]?_0x442ee2[_0x5bb3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x442ee2[_0x5bb3('0x1f')]?_0x442ee2['options'][_0x5bb3('0x20')]||null:null,'attributes':_0x442ee2['options']?_0x442ee2[_0x5bb3('0x1f')][_0x5bb3('0x21')]||null:null,'limit':_0x442ee2[_0x5bb3('0x1f')]?_0x442ee2[_0x5bb3('0x1f')][_0x5bb3('0x22')]||null:null,'include':_0x442ee2[_0x5bb3('0x1f')]?_0x442ee2[_0x5bb3('0x1f')]['include']?_[_0x5bb3('0x23')](_0x442ee2[_0x5bb3('0x1f')]['include'],function(_0x439ee4){return{'model':db[_0x439ee4[_0x5bb3('0x24')]],'as':_0x439ee4['as'],'attributes':_0x439ee4[_0x5bb3('0x21')],'include':_0x439ee4[_0x5bb3('0x25')]?_[_0x5bb3('0x23')](_0x439ee4[_0x5bb3('0x25')],function(_0x405eea){return{'model':db[_0x405eea[_0x5bb3('0x24')]],'as':_0x405eea['as'],'attributes':_0x405eea['attributes'],'include':_0x405eea['include']?_[_0x5bb3('0x23')](_0x405eea['include'],function(_0x182516){return{'model':db[_0x182516['model']],'as':_0x182516['as'],'attributes':_0x182516[_0x5bb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5bb3('0x12')](function(_0x104efe){logger['info'](_0x5bb3('0x1d'),_0x442ee2);logger[_0x5bb3('0x15')](_0x5bb3('0x1d'),_0x442ee2,JSON[_0x5bb3('0x17')](_0x104efe));_0x3fe551(_0x104efe);})['catch'](function(_0x55276b){logger[_0x5bb3('0x18')]('GetChatQueue',_0x55276b[_0x5bb3('0x1b')],_0x442ee2);_0x2630b4(_0x197d38[_0x5bb3('0x18')](0x1f4,_0x55276b['message']));});});};exports[_0x5bb3('0x26')]=function(_0xd935a7){var _0x3d7115=this;return new Promise(function(_0xe5981a,_0x46ba29){return db[_0x5bb3('0x27')][_0x5bb3('0x28')]({'raw':_0xd935a7['options']?_0xd935a7[_0x5bb3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xd935a7[_0x5bb3('0x1f')]?_0xd935a7[_0x5bb3('0x1f')][_0x5bb3('0x20')]||null:null,'attributes':_0xd935a7[_0x5bb3('0x1f')]?_0xd935a7['options']['attributes']||null:null,'include':_0xd935a7[_0x5bb3('0x1f')]?_0xd935a7[_0x5bb3('0x1f')][_0x5bb3('0x25')]?_[_0x5bb3('0x23')](_0xd935a7[_0x5bb3('0x1f')][_0x5bb3('0x25')],function(_0x4a7678){return{'model':db[_0x4a7678[_0x5bb3('0x24')]],'as':_0x4a7678['as'],'attributes':_0x4a7678[_0x5bb3('0x21')],'include':_0x4a7678[_0x5bb3('0x25')]?_[_0x5bb3('0x23')](_0x4a7678[_0x5bb3('0x25')],function(_0x5df4c5){return{'model':db[_0x5df4c5[_0x5bb3('0x24')]],'as':_0x5df4c5['as'],'attributes':_0x5df4c5[_0x5bb3('0x21')],'include':_0x5df4c5[_0x5bb3('0x25')]?_[_0x5bb3('0x23')](_0x5df4c5[_0x5bb3('0x25')],function(_0x24ff2c){return{'model':db[_0x24ff2c[_0x5bb3('0x24')]],'as':_0x24ff2c['as'],'attributes':_0x24ff2c[_0x5bb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5bb3('0x12')](function(_0x19c820){logger['info'](_0x5bb3('0x26'),_0xd935a7);logger[_0x5bb3('0x15')](_0x5bb3('0x26'),_0xd935a7,JSON[_0x5bb3('0x17')](_0x19c820));_0xe5981a(_0x19c820);})[_0x5bb3('0x29')](function(_0x40cc9d){logger[_0x5bb3('0x18')](_0x5bb3('0x26'),_0x40cc9d[_0x5bb3('0x1b')],_0xd935a7);_0x46ba29(_0x3d7115[_0x5bb3('0x18')](0x1f4,_0x40cc9d[_0x5bb3('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2de3ba7..160499e 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 _0x1cc7=['remove','emit','length','chatQueue:','./chatQueue.events','save'];(function(_0xf6b6f7,_0x4a24e3){var _0x357b1a=function(_0x33c32d){while(--_0x33c32d){_0xf6b6f7['push'](_0xf6b6f7['shift']());}};_0x357b1a(++_0x4a24e3);}(_0x1cc7,0x15a));var _0x71cc=function(_0x1c6118,_0x225e9a){_0x1c6118=_0x1c6118-0x0;var _0x5da93e=_0x1cc7[_0x1c6118];return _0x5da93e;};'use strict';var ChatQueueEvents=require(_0x71cc('0x0'));var events=[_0x71cc('0x1'),_0x71cc('0x2'),'update'];function createListener(_0x4db9cd,_0x547fe6){return function(_0xe5d54e){_0x547fe6[_0x71cc('0x3')](_0x4db9cd,_0xe5d54e);};}function removeListener(_0x402191,_0x5431e1){return function(){ChatQueueEvents['removeListener'](_0x402191,_0x5431e1);};}exports['register']=function(_0x27a175){for(var _0x4ecf81=0x0,_0xc0444e=events[_0x71cc('0x4')];_0x4ecf81<_0xc0444e;_0x4ecf81++){var _0x4039ce=events[_0x4ecf81];var _0x2e70f0=createListener(_0x71cc('0x5')+_0x4039ce,_0x27a175);ChatQueueEvents['on'](_0x4039ce,_0x2e70f0);}}; \ No newline at end of file +var _0xf3cd=['remove','update','emit','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3f1b36,_0x205b14){_0x3f1b36=_0x3f1b36-0x0;var _0x56a704=_0xf3cd[_0x3f1b36];return _0x56a704;};'use strict';var ChatQueueEvents=require(_0xdf3c('0x0'));var events=[_0xdf3c('0x1'),_0xdf3c('0x2'),_0xdf3c('0x3')];function createListener(_0x1839ec,_0x433a7f){return function(_0x54db05){_0x433a7f[_0xdf3c('0x4')](_0x1839ec,_0x54db05);};}function removeListener(_0x71b446,_0x9f71cb){return function(){ChatQueueEvents['removeListener'](_0x71b446,_0x9f71cb);};}exports[_0xdf3c('0x5')]=function(_0x17d42a){for(var _0x1313d5=0x0,_0x1f0601=events[_0xdf3c('0x6')];_0x1313d5<_0x1f0601;_0x1313d5++){var _0x28edae=events[_0x1313d5];var _0x52c073=createListener(_0xdf3c('0x7')+_0x28edae,_0x17d42a);ChatQueueEvents['on'](_0x28edae,_0x52c073);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index bf82a13..ea45887 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x496380,_0xdf128a){var _0x438e2f=function(_0x15dfb5){while(--_0x15dfb5){_0x496380['push'](_0x496380['shift']());}};_0x438e2f(++_0xdf128a);}(_0x55ca,0x126));var _0xa55c=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0x55ca[_0x22b70f];return _0x100985;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x15a7c5,_0x64f633){var _0x5aa80d=function(_0x3c4e90){while(--_0x3c4e90){_0x15a7c5['push'](_0x15a7c5['shift']());}};_0x5aa80d(++_0x64f633);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a38a232..1f85bd4 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 _0x4c9e=['DATE','sequelize','exports','STRING'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0x4c9e,0x145));var _0xe4c9=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4c9e[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require('moment');var Sequelize=require(_0xe4c9('0x0'));module[_0xe4c9('0x1')]={'uniqueid':{'type':Sequelize[_0xe4c9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe4c9('0x2')]},'joinAt':{'type':Sequelize[_0xe4c9('0x3')]},'leaveAt':{'type':Sequelize[_0xe4c9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe4c9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfcfc=['DATE','sequelize','exports','STRING'];(function(_0x5c67f9,_0x5f4d01){var _0x3c86b6=function(_0x551c0f){while(--_0x551c0f){_0x5c67f9['push'](_0x5c67f9['shift']());}};_0x3c86b6(++_0x5f4d01);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x35a21d,_0x3c92d9){_0x35a21d=_0x35a21d-0x0;var _0x564e89=_0xfcfc[_0x35a21d];return _0x564e89;};'use strict';var moment=require('moment');var Sequelize=require(_0xcfcf('0x0'));module[_0xcfcf('0x1')]={'uniqueid':{'type':Sequelize[_0xcfcf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcfcf('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcfcf('0x3')]},'reason':{'type':Sequelize[_0xcfcf('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6b160e1..bbc27af 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 _0xe451=['count','update','then','destroy','sendStatus','error','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x5c7621,_0x2e4e44){var _0x3406c1=function(_0x39cd44){while(--_0x39cd44){_0x5c7621['push'](_0x5c7621['shift']());}};_0x3406c1(++_0x2e4e44);}(_0xe451,0xec));var _0x1e45=function(_0x3f5172,_0x5c6313){_0x3f5172=_0x3f5172-0x0;var _0xa29e3b=_0xe451[_0x3f5172];return _0xa29e3b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e45('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e45('0x1'));var Mustache=require(_0x1e45('0x2'));var util=require(_0x1e45('0x3'));var path=require(_0x1e45('0x4'));var sox=require('sox');var csv=require(_0x1e45('0x5'));var ejs=require(_0x1e45('0x6'));var fs=require('fs');var fs_extra=require(_0x1e45('0x7'));var _=require('lodash');var squel=require(_0x1e45('0x8'));var crypto=require(_0x1e45('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e45('0x5'));var querystring=require(_0x1e45('0xa'));var Papa=require(_0x1e45('0xb'));var Redis=require('ioredis');var authService=require(_0x1e45('0xc'));var qs=require(_0x1e45('0xd'));var as=require(_0x1e45('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e45('0xf'));var utils=require(_0x1e45('0x10'));var config=require(_0x1e45('0x11'));var licenseUtil=require(_0x1e45('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cafc,_0x2ec564){_0x2ec564=_0x2ec564||0xcc;return function(_0x3d25a8){if(_0x3d25a8){return _0x16cafc['sendStatus'](_0x2ec564);}return _0x16cafc[_0x1e45('0x13')](_0x2ec564)[_0x1e45('0x14')]();};}function respondWithResult(_0x31215a,_0x21f68d){_0x21f68d=_0x21f68d||0xc8;return function(_0x5b3ee1){if(_0x5b3ee1){return _0x31215a[_0x1e45('0x13')](_0x21f68d)['json'](_0x5b3ee1);}};}function respondWithFilteredResult(_0xf66042,_0x2c7ace){return function(_0x4e1400){if(_0x4e1400){var _0xfdeae3=typeof _0x2c7ace[_0x1e45('0x15')]===_0x1e45('0x16')&&typeof _0x2c7ace[_0x1e45('0x17')]===_0x1e45('0x16');var _0x308c29=_0x4e1400[_0x1e45('0x18')];var _0x2a6f47=_0xfdeae3?0x0:_0x2c7ace[_0x1e45('0x15')];var _0x5d24a7=_0xfdeae3?_0x4e1400[_0x1e45('0x18')]:_0x2c7ace['offset']+_0x2c7ace['limit'];var _0x17c63a;if(_0x5d24a7>=_0x308c29){_0x5d24a7=_0x308c29;_0x17c63a=0xc8;}else{_0x17c63a=0xce;}_0xf66042['status'](_0x17c63a);return _0xf66042['set']('Content-Range',_0x2a6f47+'-'+_0x5d24a7+'/'+_0x308c29)['json'](_0x4e1400);}return null;};}function patchUpdates(_0x207335){return function(_0x4476eb){try{jsonpatch['apply'](_0x4476eb,_0x207335,!![]);}catch(_0xc0deec){return BPromise['reject'](_0xc0deec);}return _0x4476eb['save']();};}function saveUpdates(_0x41cfae,_0x59aaa7){return function(_0x4ffe97){if(_0x4ffe97){return _0x4ffe97[_0x1e45('0x19')](_0x41cfae)[_0x1e45('0x1a')](function(_0x4ce4c5){return _0x4ce4c5;});}return null;};}function removeEntity(_0x48209a,_0x2fb478){return function(_0x40c216){if(_0x40c216){return _0x40c216[_0x1e45('0x1b')]()[_0x1e45('0x1a')](function(){_0x48209a[_0x1e45('0x13')](0xcc)[_0x1e45('0x14')]();});}};}function handleEntityNotFound(_0x55e968,_0x3f6771){return function(_0x394f7e){if(!_0x394f7e){_0x55e968[_0x1e45('0x1c')](0x194);}return _0x394f7e;};}function handleError(_0x25b131,_0x1a8355){_0x1a8355=_0x1a8355||0x1f4;return function(_0xfd7633){logger[_0x1e45('0x1d')](_0xfd7633['stack']);if(_0xfd7633[_0x1e45('0x1e')]){delete _0xfd7633[_0x1e45('0x1e')];}_0x25b131[_0x1e45('0x13')](_0x1a8355)[_0x1e45('0x1f')](_0xfd7633);};}exports['index']=function(_0xe7cdcf,_0x34046e){var _0x3dd6c3={},_0x5229e7={},_0x3def67={'count':0x0,'rows':[]};var _0x4a04aa=_[_0x1e45('0x20')](db['ChatQueueReport']['rawAttributes'],function(_0x34d75e){return{'name':_0x34d75e[_0x1e45('0x21')],'type':_0x34d75e[_0x1e45('0x22')][_0x1e45('0x23')]};});_0x5229e7['model']=_[_0x1e45('0x20')](_0x4a04aa,'name');_0x5229e7[_0x1e45('0x24')]=_[_0x1e45('0x25')](_0xe7cdcf[_0x1e45('0x24')]);_0x5229e7['filters']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],_0x5229e7[_0x1e45('0x24')]);_0x3dd6c3['attributes']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],qs[_0x1e45('0x28')](_0xe7cdcf[_0x1e45('0x24')]['fields']));_0x3dd6c3[_0x1e45('0x29')]=_0x3dd6c3[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x3dd6c3[_0x1e45('0x29')]:_0x5229e7[_0x1e45('0x27')];if(!_0xe7cdcf['query']['hasOwnProperty']('nolimit')){_0x3dd6c3['limit']=qs[_0x1e45('0x17')](_0xe7cdcf['query'][_0x1e45('0x17')]);_0x3dd6c3[_0x1e45('0x15')]=qs['offset'](_0xe7cdcf['query'][_0x1e45('0x15')]);}_0x3dd6c3[_0x1e45('0x2b')]=qs[_0x1e45('0x2c')](_0xe7cdcf[_0x1e45('0x24')]['sort']);_0x3dd6c3[_0x1e45('0x2d')]=qs[_0x1e45('0x2e')](_[_0x1e45('0x2f')](_0xe7cdcf[_0x1e45('0x24')],_0x5229e7['filters']),_0x4a04aa);if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]){_0x3dd6c3[_0x1e45('0x2d')]=_['merge'](_0x3dd6c3['where'],{'$or':_[_0x1e45('0x20')](_0x4a04aa,function(_0x47c200){if(_0x47c200['type']!==_0x1e45('0x31')){var _0x587a0a={};_0x587a0a[_0x47c200['name']]={'$like':'%'+_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]+'%'};return _0x587a0a;}})});}_0x3dd6c3=_[_0x1e45('0x32')]({},_0x3dd6c3,_0xe7cdcf[_0x1e45('0x33')]);var _0x11a327={'where':_0x3dd6c3[_0x1e45('0x2d')]};return db[_0x1e45('0x34')][_0x1e45('0x18')](_0x11a327)[_0x1e45('0x1a')](function(_0x53713a){_0x3def67[_0x1e45('0x18')]=_0x53713a;if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x35')]){_0x3dd6c3[_0x1e45('0x36')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x1e45('0x37')](_0x3dd6c3);})[_0x1e45('0x1a')](function(_0x2984ae){_0x3def67[_0x1e45('0x38')]=_0x2984ae;return _0x3def67;})['then'](respondWithFilteredResult(_0x34046e,_0x3dd6c3))[_0x1e45('0x39')](handleError(_0x34046e,null));};exports[_0x1e45('0x3a')]=function(_0x32a42a,_0x393a50){var _0x522b40={'raw':!![],'where':{'id':_0x32a42a[_0x1e45('0x3b')]['id']}},_0x460d38={};_0x460d38[_0x1e45('0x27')]=_[_0x1e45('0x25')](db[_0x1e45('0x34')][_0x1e45('0x3c')]);_0x460d38['query']=_[_0x1e45('0x25')](_0x32a42a['query']);_0x460d38[_0x1e45('0x2e')]=_[_0x1e45('0x26')](_0x460d38[_0x1e45('0x27')],_0x460d38[_0x1e45('0x24')]);_0x522b40[_0x1e45('0x29')]=_[_0x1e45('0x26')](_0x460d38['model'],qs[_0x1e45('0x28')](_0x32a42a[_0x1e45('0x24')][_0x1e45('0x28')]));_0x522b40['attributes']=_0x522b40[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x522b40[_0x1e45('0x29')]:_0x460d38['model'];if(_0x32a42a['query']['includeAll']){_0x522b40[_0x1e45('0x36')]=[{'all':!![]}];}_0x522b40=_[_0x1e45('0x32')]({},_0x522b40,_0x32a42a[_0x1e45('0x33')]);return db[_0x1e45('0x34')]['find'](_0x522b40)[_0x1e45('0x1a')](handleEntityNotFound(_0x393a50,null))[_0x1e45('0x1a')](respondWithResult(_0x393a50,null))[_0x1e45('0x39')](handleError(_0x393a50,null));};exports[_0x1e45('0x3d')]=function(_0x3994d8,_0x53e41b){return db[_0x1e45('0x34')][_0x1e45('0x3d')](_0x3994d8[_0x1e45('0x3e')],{})[_0x1e45('0x1a')](respondWithResult(_0x53e41b,0xc9))[_0x1e45('0x39')](handleError(_0x53e41b,null));};exports['update']=function(_0x374c32,_0x14b06f){if(_0x374c32[_0x1e45('0x3e')]['id']){delete _0x374c32[_0x1e45('0x3e')]['id'];}return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x374c32['params']['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x14b06f,null))[_0x1e45('0x1a')](saveUpdates(_0x374c32['body'],null))[_0x1e45('0x1a')](respondWithResult(_0x14b06f,null))['catch'](handleError(_0x14b06f,null));};exports[_0x1e45('0x1b')]=function(_0x3e6845,_0x5bafc7){return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x3e6845[_0x1e45('0x3b')]['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x5bafc7,null))[_0x1e45('0x1a')](removeEntity(_0x5bafc7,null))[_0x1e45('0x39')](handleError(_0x5bafc7,null));};exports[_0x1e45('0x40')]=function(_0x4cdf47,_0x2f19f3){return db[_0x1e45('0x34')]['describe']()['then'](respondWithResult(_0x2f19f3,null))[_0x1e45('0x39')](handleError(_0x2f19f3,null));}; \ No newline at end of file +var _0x363e=['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','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatQueueReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5da8b9,_0xd99e62){var _0x2e08d8=function(_0x3844c5){while(--_0x3844c5){_0x5da8b9['push'](_0x5da8b9['shift']());}};_0x2e08d8(++_0xd99e62);}(_0x363e,0x179));var _0xe363=function(_0x27ccfa,_0x4885d1){_0x27ccfa=_0x27ccfa-0x0;var _0x2f4f2=_0x363e[_0x27ccfa];return _0x2f4f2;};'use strict';var emlformat=require(_0xe363('0x0'));var rimraf=require(_0xe363('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe363('0x2'));var rp=require(_0xe363('0x3'));var moment=require(_0xe363('0x4'));var BPromise=require(_0xe363('0x5'));var Mustache=require(_0xe363('0x6'));var util=require(_0xe363('0x7'));var path=require(_0xe363('0x8'));var sox=require(_0xe363('0x9'));var csv=require(_0xe363('0xa'));var ejs=require(_0xe363('0xb'));var fs=require('fs');var fs_extra=require(_0xe363('0xc'));var _=require('lodash');var squel=require(_0xe363('0xd'));var crypto=require(_0xe363('0xe'));var jsforce=require(_0xe363('0xf'));var deskjs=require(_0xe363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe363('0x11'));var Papa=require(_0xe363('0x12'));var Redis=require(_0xe363('0x13'));var authService=require(_0xe363('0x14'));var qs=require(_0xe363('0x15'));var as=require(_0xe363('0x16'));var hardwareService=require(_0xe363('0x17'));var logger=require('../../config/logger')(_0xe363('0x18'));var utils=require(_0xe363('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe363('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1fb0,_0x8b6974){_0x8b6974=_0x8b6974||0xcc;return function(_0x21cb92){if(_0x21cb92){return _0x4e1fb0[_0xe363('0x1b')](_0x8b6974);}return _0x4e1fb0[_0xe363('0x1c')](_0x8b6974)[_0xe363('0x1d')]();};}function respondWithResult(_0x563fbf,_0x17ff61){_0x17ff61=_0x17ff61||0xc8;return function(_0x22b227){if(_0x22b227){return _0x563fbf['status'](_0x17ff61)[_0xe363('0x1e')](_0x22b227);}};}function respondWithFilteredResult(_0x2ad0e9,_0x52e6c6){return function(_0x3c74f9){if(_0x3c74f9){var _0x73ef9a=typeof _0x52e6c6['offset']===_0xe363('0x1f')&&typeof _0x52e6c6[_0xe363('0x20')]==='undefined';var _0xecbe2c=_0x3c74f9[_0xe363('0x21')];var _0x2f2c20=_0x73ef9a?0x0:_0x52e6c6['offset'];var _0x287104=_0x73ef9a?_0x3c74f9[_0xe363('0x21')]:_0x52e6c6['offset']+_0x52e6c6[_0xe363('0x20')];var _0x110e59;if(_0x287104>=_0xecbe2c){_0x287104=_0xecbe2c;_0x110e59=0xc8;}else{_0x110e59=0xce;}_0x2ad0e9[_0xe363('0x1c')](_0x110e59);return _0x2ad0e9[_0xe363('0x22')](_0xe363('0x23'),_0x2f2c20+'-'+_0x287104+'/'+_0xecbe2c)[_0xe363('0x1e')](_0x3c74f9);}return null;};}function patchUpdates(_0x4ee855){return function(_0x3bed39){try{jsonpatch[_0xe363('0x24')](_0x3bed39,_0x4ee855,!![]);}catch(_0x14ff95){return BPromise[_0xe363('0x25')](_0x14ff95);}return _0x3bed39[_0xe363('0x26')]();};}function saveUpdates(_0x42928e,_0x24199a){return function(_0xaff56f){if(_0xaff56f){return _0xaff56f[_0xe363('0x27')](_0x42928e)[_0xe363('0x28')](function(_0x1de673){return _0x1de673;});}return null;};}function removeEntity(_0x441b94,_0x11556d){return function(_0x388223){if(_0x388223){return _0x388223[_0xe363('0x29')]()[_0xe363('0x28')](function(){_0x441b94[_0xe363('0x1c')](0xcc)[_0xe363('0x1d')]();});}};}function handleEntityNotFound(_0x19c7b4,_0x3e24ad){return function(_0x312d75){if(!_0x312d75){_0x19c7b4[_0xe363('0x1b')](0x194);}return _0x312d75;};}function handleError(_0x5b2b3d,_0xbdfae9){_0xbdfae9=_0xbdfae9||0x1f4;return function(_0x12358b){logger[_0xe363('0x2a')](_0x12358b[_0xe363('0x2b')]);if(_0x12358b[_0xe363('0x2c')]){delete _0x12358b['name'];}_0x5b2b3d[_0xe363('0x1c')](_0xbdfae9)[_0xe363('0x2d')](_0x12358b);};}exports['index']=function(_0x3cc130,_0x5a790c){var _0x3ed3e1={},_0x45d664={},_0x4c739d={'count':0x0,'rows':[]};var _0x357b6f=_[_0xe363('0x2e')](db[_0xe363('0x2f')]['rawAttributes'],function(_0x40671e){return{'name':_0x40671e[_0xe363('0x30')],'type':_0x40671e[_0xe363('0x31')][_0xe363('0x32')]};});_0x45d664['model']=_[_0xe363('0x2e')](_0x357b6f,_0xe363('0x2c'));_0x45d664[_0xe363('0x33')]=_[_0xe363('0x34')](_0x3cc130[_0xe363('0x33')]);_0x45d664[_0xe363('0x35')]=_[_0xe363('0x36')](_0x45d664[_0xe363('0x37')],_0x45d664[_0xe363('0x33')]);_0x3ed3e1[_0xe363('0x38')]=_['intersection'](_0x45d664['model'],qs[_0xe363('0x39')](_0x3cc130[_0xe363('0x33')]['fields']));_0x3ed3e1[_0xe363('0x38')]=_0x3ed3e1[_0xe363('0x38')]['length']?_0x3ed3e1[_0xe363('0x38')]:_0x45d664[_0xe363('0x37')];if(!_0x3cc130[_0xe363('0x33')][_0xe363('0x3a')]('nolimit')){_0x3ed3e1['limit']=qs[_0xe363('0x20')](_0x3cc130['query']['limit']);_0x3ed3e1[_0xe363('0x3b')]=qs[_0xe363('0x3b')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3b')]);}_0x3ed3e1[_0xe363('0x3c')]=qs[_0xe363('0x3d')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3d')]);_0x3ed3e1[_0xe363('0x3e')]=qs[_0xe363('0x35')](_[_0xe363('0x3f')](_0x3cc130[_0xe363('0x33')],_0x45d664['filters']),_0x357b6f);if(_0x3cc130['query'][_0xe363('0x40')]){_0x3ed3e1[_0xe363('0x3e')]=_[_0xe363('0x41')](_0x3ed3e1['where'],{'$or':_['map'](_0x357b6f,function(_0x815550){if(_0x815550[_0xe363('0x31')]!==_0xe363('0x42')){var _0x199c78={};_0x199c78[_0x815550['name']]={'$like':'%'+_0x3cc130[_0xe363('0x33')]['filter']+'%'};return _0x199c78;}})});}_0x3ed3e1=_[_0xe363('0x41')]({},_0x3ed3e1,_0x3cc130[_0xe363('0x43')]);var _0xbca95f={'where':_0x3ed3e1[_0xe363('0x3e')]};return db[_0xe363('0x2f')][_0xe363('0x21')](_0xbca95f)[_0xe363('0x28')](function(_0x44f03c){_0x4c739d[_0xe363('0x21')]=_0x44f03c;if(_0x3cc130['query']['includeAll']){_0x3ed3e1[_0xe363('0x44')]=[{'all':!![]}];}return db[_0xe363('0x2f')][_0xe363('0x45')](_0x3ed3e1);})[_0xe363('0x28')](function(_0x2fc2f0){_0x4c739d[_0xe363('0x46')]=_0x2fc2f0;return _0x4c739d;})[_0xe363('0x28')](respondWithFilteredResult(_0x5a790c,_0x3ed3e1))[_0xe363('0x47')](handleError(_0x5a790c,null));};exports[_0xe363('0x48')]=function(_0x4b8238,_0x3da5ba){var _0x58b837={'raw':!![],'where':{'id':_0x4b8238['params']['id']}},_0x41a87c={};_0x41a87c[_0xe363('0x37')]=_[_0xe363('0x34')](db['ChatQueueReport'][_0xe363('0x49')]);_0x41a87c[_0xe363('0x33')]=_[_0xe363('0x34')](_0x4b8238[_0xe363('0x33')]);_0x41a87c[_0xe363('0x35')]=_[_0xe363('0x36')](_0x41a87c['model'],_0x41a87c[_0xe363('0x33')]);_0x58b837[_0xe363('0x38')]=_[_0xe363('0x36')](_0x41a87c[_0xe363('0x37')],qs[_0xe363('0x39')](_0x4b8238['query'][_0xe363('0x39')]));_0x58b837[_0xe363('0x38')]=_0x58b837[_0xe363('0x38')][_0xe363('0x4a')]?_0x58b837[_0xe363('0x38')]:_0x41a87c[_0xe363('0x37')];if(_0x4b8238[_0xe363('0x33')]['includeAll']){_0x58b837['include']=[{'all':!![]}];}_0x58b837=_[_0xe363('0x41')]({},_0x58b837,_0x4b8238[_0xe363('0x43')]);return db[_0xe363('0x2f')]['find'](_0x58b837)[_0xe363('0x28')](handleEntityNotFound(_0x3da5ba,null))[_0xe363('0x28')](respondWithResult(_0x3da5ba,null))['catch'](handleError(_0x3da5ba,null));};exports['create']=function(_0x2a7b42,_0x34e08b){return db[_0xe363('0x2f')][_0xe363('0x4b')](_0x2a7b42['body'],{})[_0xe363('0x28')](respondWithResult(_0x34e08b,0xc9))[_0xe363('0x47')](handleError(_0x34e08b,null));};exports['update']=function(_0x4fbdbb,_0x306afd){if(_0x4fbdbb[_0xe363('0x4c')]['id']){delete _0x4fbdbb['body']['id'];}return db[_0xe363('0x2f')]['find']({'where':{'id':_0x4fbdbb[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x306afd,null))['then'](saveUpdates(_0x4fbdbb[_0xe363('0x4c')],null))[_0xe363('0x28')](respondWithResult(_0x306afd,null))['catch'](handleError(_0x306afd,null));};exports[_0xe363('0x29')]=function(_0x43ee23,_0x55f0e6){return db[_0xe363('0x2f')]['find']({'where':{'id':_0x43ee23[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x55f0e6,null))[_0xe363('0x28')](removeEntity(_0x55f0e6,null))[_0xe363('0x47')](handleError(_0x55f0e6,null));};exports['describe']=function(_0x2ff064,_0x225a43){return db[_0xe363('0x2f')]['describe']()[_0xe363('0x28')](respondWithResult(_0x225a43,null))[_0xe363('0x47')](handleError(_0x225a43,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 66ecb89..376d82e 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0xa60419,_0x7f3e3d){var _0xa7cb7d=function(_0x772759){while(--_0x772759){_0xa60419['push'](_0xa60419['shift']());}};_0xa7cb7d(++_0x7f3e3d);}(_0x757a,0xde));var _0xa757=function(_0x2efdc3,_0x276171){_0x2efdc3=_0x2efdc3-0x0;var _0x4660bc=_0x757a[_0x2efdc3];return _0x4660bc;};'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 +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4da05f,_0x20a393){var _0x30b926=function(_0x2b16d3){while(--_0x2b16d3){_0x4da05f['push'](_0x4da05f['shift']());}};_0x30b926(++_0x20a393);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xcb91[_0x10291b];return _0x1d5fbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 974bdc5..152925b 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 _0x5eff=['CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','catch'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5eff,0xc8));var _0xf5ef=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5eff[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xf5ef('0x0'));var util=require(_0xf5ef('0x1'));var moment=require(_0xf5ef('0x2'));var BPromise=require(_0xf5ef('0x3'));var rs=require(_0xf5ef('0x4'));var fs=require('fs');var Redis=require(_0xf5ef('0x5'));var db=require(_0xf5ef('0x6'))['db'];var utils=require(_0xf5ef('0x7'));var logger=require(_0xf5ef('0x8'))(_0xf5ef('0x9'));var config=require(_0xf5ef('0xa'));var jayson=require(_0xf5ef('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f0ad,_0x4b655a,_0x29de37){return new BPromise(function(_0x544036,_0x44aac0){return client[_0xf5ef('0xc')](_0x39f0ad,_0x29de37)[_0xf5ef('0xd')](function(_0x4a5662){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4b655a,_0xf5ef('0xe'));logger[_0xf5ef('0xf')](_0xf5ef('0x10'),_0x4b655a,_0xf5ef('0xe'),JSON[_0xf5ef('0x11')](_0x4a5662));if(_0x4a5662[_0xf5ef('0x12')]){if(_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x13')]===0x1f4){logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x15')]);return _0x44aac0(_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x15')]);}logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x4a5662['error'][_0xf5ef('0x15')]);return _0x544036(_0x4a5662[_0xf5ef('0x12')]['message']);}else{logger[_0xf5ef('0x16')](_0xf5ef('0x14'),_0x4b655a,_0xf5ef('0xe'));_0x544036(_0x4a5662['result'][_0xf5ef('0x15')]);}})[_0xf5ef('0x17')](function(_0x22b78f){logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x22b78f);_0x44aac0(_0x22b78f);});});}exports[_0xf5ef('0x18')]=function(_0x43595b){var _0x3ad136=this;return new Promise(function(_0x46cf6d,_0x10cfe3){return db[_0xf5ef('0x19')][_0xf5ef('0x1a')](_0x43595b[_0xf5ef('0x1b')],{'raw':_0x43595b['options']?_0x43595b[_0xf5ef('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf5ef('0xd')](function(_0x48382c){logger['info'](_0xf5ef('0x18'),_0x43595b);logger['debug'](_0xf5ef('0x18'),_0x43595b,JSON[_0xf5ef('0x11')](_0x48382c));_0x46cf6d(_0x48382c);})[_0xf5ef('0x17')](function(_0x29b8ca){logger[_0xf5ef('0x12')]('CreateChatQueueReport',_0x29b8ca['message'],_0x43595b);_0x10cfe3(_0x3ad136[_0xf5ef('0x12')](0x1f4,_0x29b8ca[_0xf5ef('0x15')]));});});};exports[_0xf5ef('0x1d')]=function(_0x46b881){var _0x1ad4e2=this;return new Promise(function(_0x83cf9e,_0x200d23){return db[_0xf5ef('0x19')]['update'](_0x46b881[_0xf5ef('0x1b')],{'raw':_0x46b881[_0xf5ef('0x1c')]?_0x46b881[_0xf5ef('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b881[_0xf5ef('0x1c')]?_0x46b881[_0xf5ef('0x1c')][_0xf5ef('0x1e')]||null:null,'attributes':_0x46b881[_0xf5ef('0x1c')]?_0x46b881[_0xf5ef('0x1c')]['attributes']||null:null,'limit':_0x46b881[_0xf5ef('0x1c')]?_0x46b881['options'][_0xf5ef('0x1f')]||null:null})[_0xf5ef('0xd')](function(_0x355448){logger[_0xf5ef('0x16')](_0xf5ef('0x1d'),_0x46b881);logger[_0xf5ef('0xf')](_0xf5ef('0x1d'),_0x46b881,JSON[_0xf5ef('0x11')](_0x355448));_0x83cf9e(_0x355448);})[_0xf5ef('0x17')](function(_0x3a9bb4){logger[_0xf5ef('0x12')](_0xf5ef('0x1d'),_0x3a9bb4['message'],_0x46b881);_0x200d23(_0x1ad4e2[_0xf5ef('0x12')](0x1f4,_0x3a9bb4['message']));});});}; \ No newline at end of file +var _0xecd6=['create','body','options','raw','update','where','attributes','UpdateChatQueueReport','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport'];(function(_0x4bd48b,_0x1a0264){var _0x3ecb8f=function(_0x3a5f2e){while(--_0x3a5f2e){_0x4bd48b['push'](_0x4bd48b['shift']());}};_0x3ecb8f(++_0x1a0264);}(_0xecd6,0xe1));var _0x6ecd=function(_0x2d7213,_0x1e9ce2){_0x2d7213=_0x2d7213-0x0;var _0x4bb328=_0xecd6[_0x2d7213];return _0x4bb328;};'use strict';var _=require(_0x6ecd('0x0'));var util=require('util');var moment=require(_0x6ecd('0x1'));var BPromise=require(_0x6ecd('0x2'));var rs=require(_0x6ecd('0x3'));var fs=require('fs');var Redis=require(_0x6ecd('0x4'));var db=require(_0x6ecd('0x5'))['db'];var utils=require(_0x6ecd('0x6'));var logger=require(_0x6ecd('0x7'))(_0x6ecd('0x8'));var config=require(_0x6ecd('0x9'));var jayson=require(_0x6ecd('0xa'));var client=jayson[_0x6ecd('0xb')][_0x6ecd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4569e9,_0x311902,_0x5f490b){return new BPromise(function(_0x427c4c,_0x5025a8){return client[_0x6ecd('0xd')](_0x4569e9,_0x5f490b)[_0x6ecd('0xe')](function(_0x308871){logger[_0x6ecd('0xf')](_0x6ecd('0x10'),_0x311902,_0x6ecd('0x11'));logger[_0x6ecd('0x12')](_0x6ecd('0x13'),_0x311902,_0x6ecd('0x11'),JSON[_0x6ecd('0x14')](_0x308871));if(_0x308871[_0x6ecd('0x15')]){if(_0x308871[_0x6ecd('0x15')][_0x6ecd('0x16')]===0x1f4){logger[_0x6ecd('0x15')](_0x6ecd('0x10'),_0x311902,_0x308871[_0x6ecd('0x15')][_0x6ecd('0x17')]);return _0x5025a8(_0x308871[_0x6ecd('0x15')][_0x6ecd('0x17')]);}logger[_0x6ecd('0x15')](_0x6ecd('0x10'),_0x311902,_0x308871[_0x6ecd('0x15')][_0x6ecd('0x17')]);return _0x427c4c(_0x308871[_0x6ecd('0x15')][_0x6ecd('0x17')]);}else{logger[_0x6ecd('0xf')](_0x6ecd('0x10'),_0x311902,_0x6ecd('0x11'));_0x427c4c(_0x308871[_0x6ecd('0x18')][_0x6ecd('0x17')]);}})['catch'](function(_0x44351f){logger[_0x6ecd('0x15')](_0x6ecd('0x10'),_0x311902,_0x44351f);_0x5025a8(_0x44351f);});});}exports[_0x6ecd('0x19')]=function(_0x53cdb9){var _0x17c956=this;return new Promise(function(_0x227fed,_0x29502d){return db[_0x6ecd('0x1a')][_0x6ecd('0x1b')](_0x53cdb9[_0x6ecd('0x1c')],{'raw':_0x53cdb9[_0x6ecd('0x1d')]?_0x53cdb9['options'][_0x6ecd('0x1e')]===undefined?!![]:![]:!![]})[_0x6ecd('0xe')](function(_0x266825){logger[_0x6ecd('0xf')]('CreateChatQueueReport',_0x53cdb9);logger[_0x6ecd('0x12')](_0x6ecd('0x19'),_0x53cdb9,JSON['stringify'](_0x266825));_0x227fed(_0x266825);})['catch'](function(_0xe12cb8){logger[_0x6ecd('0x15')](_0x6ecd('0x19'),_0xe12cb8[_0x6ecd('0x17')],_0x53cdb9);_0x29502d(_0x17c956[_0x6ecd('0x15')](0x1f4,_0xe12cb8[_0x6ecd('0x17')]));});});};exports['UpdateChatQueueReport']=function(_0x599cdd){var _0x3c3814=this;return new Promise(function(_0x36c4c2,_0x36efa7){return db[_0x6ecd('0x1a')][_0x6ecd('0x1f')](_0x599cdd[_0x6ecd('0x1c')],{'raw':_0x599cdd[_0x6ecd('0x1d')]?_0x599cdd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599cdd[_0x6ecd('0x1d')]?_0x599cdd[_0x6ecd('0x1d')][_0x6ecd('0x20')]||null:null,'attributes':_0x599cdd['options']?_0x599cdd['options'][_0x6ecd('0x21')]||null:null,'limit':_0x599cdd[_0x6ecd('0x1d')]?_0x599cdd[_0x6ecd('0x1d')]['limit']||null:null})['then'](function(_0x5f2431){logger[_0x6ecd('0xf')](_0x6ecd('0x22'),_0x599cdd);logger[_0x6ecd('0x12')](_0x6ecd('0x22'),_0x599cdd,JSON[_0x6ecd('0x14')](_0x5f2431));_0x36c4c2(_0x5f2431);})[_0x6ecd('0x23')](function(_0x3884f4){logger['error'](_0x6ecd('0x22'),_0x3884f4['message'],_0x599cdd);_0x36efa7(_0x3c3814[_0x6ecd('0x15')](0x1f4,_0x3884f4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 127c0d8..beaf863 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 _0x49e6=['../../config/environment','isAuthenticated','get','/describe','/:id','create','put','update','delete','destroy','multer','path','Router','fs-extra','../../components/interaction/service'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x49e6,0xeb));var _0x649e=function(_0x4dda67,_0x5669c2){_0x4dda67=_0x4dda67-0x0;var _0x3e3fdb=_0x49e6[_0x4dda67];return _0x3e3fdb;};'use strict';var multer=require(_0x649e('0x0'));var util=require('util');var path=require(_0x649e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x649e('0x2')]();var fs_extra=require(_0x649e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x649e('0x4'));var config=require(_0x649e('0x5'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x649e('0x6')](),controller['index']);router[_0x649e('0x7')](_0x649e('0x8'),auth[_0x649e('0x6')](),controller['describe']);router[_0x649e('0x7')](_0x649e('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x649e('0x6')](),controller[_0x649e('0xa')]);router[_0x649e('0xb')](_0x649e('0x9'),auth['isAuthenticated'](),controller[_0x649e('0xc')]);router[_0x649e('0xd')](_0x649e('0x9'),auth[_0x649e('0x6')](),controller[_0x649e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6208=['describe','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe'];(function(_0x47d103,_0xd2df8c){var _0x18e659=function(_0x27a38d){while(--_0x27a38d){_0x47d103['push'](_0x47d103['shift']());}};_0x18e659(++_0xd2df8c);}(_0x6208,0x96));var _0x8620=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x6208[_0x4e93a9];return _0x43013c;};'use strict';var multer=require('multer');var util=require(_0x8620('0x0'));var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8620('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x8620('0x6')](),controller[_0x8620('0x7')]);router[_0x8620('0x8')](_0x8620('0x9'),auth[_0x8620('0x6')](),controller[_0x8620('0xa')]);router['get']('/:id',auth[_0x8620('0x6')](),controller[_0x8620('0xb')]);router[_0x8620('0xc')]('/',auth[_0x8620('0x6')](),controller[_0x8620('0xd')]);router[_0x8620('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8620('0xf')]);router[_0x8620('0x10')](_0x8620('0x11'),auth[_0x8620('0x6')](),controller[_0x8620('0x12')]);module[_0x8620('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 40f5f50..16ac573 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x26a28c,_0x43a785){var _0x50daed=function(_0x13fb99){while(--_0x13fb99){_0x26a28c['push'](_0x26a28c['shift']());}};_0x50daed(++_0x43a785);}(_0xedd9,0xfc));var _0x9edd=function(_0x34a403,_0x2069ae){_0x34a403=_0x34a403-0x0;var _0x4fee1a=_0xedd9[_0x34a403];return _0x4fee1a;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1f004d,_0x4821eb){var _0x48ac0b=function(_0x32dd1e){while(--_0x32dd1e){_0x1f004d['push'](_0x1f004d['shift']());}};_0x48ac0b(++_0x4821eb);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0xf3cd[_0x34b821];return _0x5e00a0;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c7de645..c314957 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 _0x26b9=['reject','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x194934,_0x231270){var _0x59bb6b=function(_0xa10426){while(--_0xa10426){_0x194934['push'](_0x194934['shift']());}};_0x59bb6b(++_0x231270);}(_0x26b9,0x10a));var _0x926b=function(_0x1ab20a,_0x50a80a){_0x1ab20a=_0x1ab20a-0x0;var _0x42c089=_0x26b9[_0x1ab20a];return _0x42c089;};'use strict';var emlformat=require(_0x926b('0x0'));var rimraf=require(_0x926b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x926b('0x2'));var rp=require(_0x926b('0x3'));var moment=require(_0x926b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x926b('0x5'));var path=require(_0x926b('0x6'));var sox=require(_0x926b('0x7'));var csv=require(_0x926b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x926b('0x9'));var squel=require('squel');var crypto=require(_0x926b('0xa'));var jsforce=require(_0x926b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x926b('0x8'));var querystring=require(_0x926b('0xc'));var Papa=require(_0x926b('0xd'));var Redis=require(_0x926b('0xe'));var authService=require(_0x926b('0xf'));var qs=require(_0x926b('0x10'));var as=require(_0x926b('0x11'));var hardwareService=require(_0x926b('0x12'));var logger=require(_0x926b('0x13'))('api');var utils=require(_0x926b('0x14'));var config=require(_0x926b('0x15'));var licenseUtil=require(_0x926b('0x16'));var db=require(_0x926b('0x17'))['db'];function respondWithStatusCode(_0x42cb51,_0x5bd123){_0x5bd123=_0x5bd123||0xcc;return function(_0xe09589){if(_0xe09589){return _0x42cb51['sendStatus'](_0x5bd123);}return _0x42cb51[_0x926b('0x18')](_0x5bd123)[_0x926b('0x19')]();};}function respondWithResult(_0x217537,_0x205036){_0x205036=_0x205036||0xc8;return function(_0x1da982){if(_0x1da982){return _0x217537[_0x926b('0x18')](_0x205036)[_0x926b('0x1a')](_0x1da982);}};}function respondWithFilteredResult(_0xd39507,_0x3c030c){return function(_0x1db1e5){if(_0x1db1e5){var _0x82c900=typeof _0x3c030c[_0x926b('0x1b')]===_0x926b('0x1c')&&typeof _0x3c030c[_0x926b('0x1d')]==='undefined';var _0x179310=_0x1db1e5[_0x926b('0x1e')];var _0x12b6b1=_0x82c900?0x0:_0x3c030c[_0x926b('0x1b')];var _0x5d4655=_0x82c900?_0x1db1e5[_0x926b('0x1e')]:_0x3c030c[_0x926b('0x1b')]+_0x3c030c['limit'];var _0xc8d96b;if(_0x5d4655>=_0x179310){_0x5d4655=_0x179310;_0xc8d96b=0xc8;}else{_0xc8d96b=0xce;}_0xd39507[_0x926b('0x18')](_0xc8d96b);return _0xd39507[_0x926b('0x1f')](_0x926b('0x20'),_0x12b6b1+'-'+_0x5d4655+'/'+_0x179310)['json'](_0x1db1e5);}return null;};}function patchUpdates(_0x5311a6){return function(_0xdcbbfc){try{jsonpatch[_0x926b('0x21')](_0xdcbbfc,_0x5311a6,!![]);}catch(_0x18e9fe){return BPromise[_0x926b('0x22')](_0x18e9fe);}return _0xdcbbfc['save']();};}function saveUpdates(_0x37b941,_0x4f6a06){return function(_0x166d3b){if(_0x166d3b){return _0x166d3b['update'](_0x37b941)[_0x926b('0x23')](function(_0x1a5944){return _0x1a5944;});}return null;};}function removeEntity(_0x410202,_0xca434d){return function(_0x41c594){if(_0x41c594){return _0x41c594[_0x926b('0x24')]()[_0x926b('0x23')](function(){_0x410202['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab72c,_0x56d85e){return function(_0x408475){if(!_0x408475){_0x4ab72c[_0x926b('0x25')](0x194);}return _0x408475;};}function handleError(_0x20e551,_0x16d650){_0x16d650=_0x16d650||0x1f4;return function(_0x59df1a){logger['error'](_0x59df1a[_0x926b('0x26')]);if(_0x59df1a[_0x926b('0x27')]){delete _0x59df1a['name'];}_0x20e551['status'](_0x16d650)[_0x926b('0x28')](_0x59df1a);};}exports[_0x926b('0x29')]=function(_0x4da778,_0x1ba301){var _0x409442={},_0x118857={},_0x4c35e9={'count':0x0,'rows':[]};var _0xdd9b2a=_[_0x926b('0x2a')](db['ChatTransferReport'][_0x926b('0x2b')],function(_0x29d869){return{'name':_0x29d869[_0x926b('0x2c')],'type':_0x29d869[_0x926b('0x2d')]['key']};});_0x118857['model']=_[_0x926b('0x2a')](_0xdd9b2a,'name');_0x118857[_0x926b('0x2e')]=_['keys'](_0x4da778['query']);_0x118857['filters']=_[_0x926b('0x2f')](_0x118857['model'],_0x118857['query']);_0x409442['attributes']=_[_0x926b('0x2f')](_0x118857[_0x926b('0x30')],qs[_0x926b('0x31')](_0x4da778[_0x926b('0x2e')][_0x926b('0x31')]));_0x409442[_0x926b('0x32')]=_0x409442['attributes']['length']?_0x409442[_0x926b('0x32')]:_0x118857[_0x926b('0x30')];if(!_0x4da778[_0x926b('0x2e')][_0x926b('0x33')](_0x926b('0x34'))){_0x409442[_0x926b('0x1d')]=qs[_0x926b('0x1d')](_0x4da778['query']['limit']);_0x409442[_0x926b('0x1b')]=qs[_0x926b('0x1b')](_0x4da778[_0x926b('0x2e')][_0x926b('0x1b')]);}_0x409442[_0x926b('0x35')]=qs[_0x926b('0x36')](_0x4da778[_0x926b('0x2e')][_0x926b('0x36')]);_0x409442['where']=qs[_0x926b('0x37')](_['pick'](_0x4da778[_0x926b('0x2e')],_0x118857[_0x926b('0x37')]),_0xdd9b2a);if(_0x4da778[_0x926b('0x2e')]['filter']){_0x409442[_0x926b('0x38')]=_[_0x926b('0x39')](_0x409442[_0x926b('0x38')],{'$or':_[_0x926b('0x2a')](_0xdd9b2a,function(_0x570060){if(_0x570060[_0x926b('0x2d')]!==_0x926b('0x3a')){var _0x2f47ac={};_0x2f47ac[_0x570060[_0x926b('0x27')]]={'$like':'%'+_0x4da778['query'][_0x926b('0x3b')]+'%'};return _0x2f47ac;}})});}_0x409442=_['merge']({},_0x409442,_0x4da778[_0x926b('0x3c')]);var _0x201755={'where':_0x409442[_0x926b('0x38')]};return db[_0x926b('0x3d')]['count'](_0x201755)[_0x926b('0x23')](function(_0x500fe1){_0x4c35e9[_0x926b('0x1e')]=_0x500fe1;if(_0x4da778[_0x926b('0x2e')][_0x926b('0x3e')]){_0x409442[_0x926b('0x3f')]=[{'all':!![]}];}return db[_0x926b('0x3d')][_0x926b('0x40')](_0x409442);})[_0x926b('0x23')](function(_0x458415){_0x4c35e9[_0x926b('0x41')]=_0x458415;return _0x4c35e9;})[_0x926b('0x23')](respondWithFilteredResult(_0x1ba301,_0x409442))[_0x926b('0x42')](handleError(_0x1ba301,null));};exports[_0x926b('0x43')]=function(_0x4973ba,_0x466757){var _0x3f6282={'raw':!![],'where':{'id':_0x4973ba[_0x926b('0x44')]['id']}},_0x66563e={};_0x66563e['model']=_[_0x926b('0x45')](db[_0x926b('0x3d')][_0x926b('0x2b')]);_0x66563e[_0x926b('0x2e')]=_[_0x926b('0x45')](_0x4973ba[_0x926b('0x2e')]);_0x66563e[_0x926b('0x37')]=_[_0x926b('0x2f')](_0x66563e[_0x926b('0x30')],_0x66563e[_0x926b('0x2e')]);_0x3f6282['attributes']=_[_0x926b('0x2f')](_0x66563e['model'],qs[_0x926b('0x31')](_0x4973ba[_0x926b('0x2e')][_0x926b('0x31')]));_0x3f6282['attributes']=_0x3f6282[_0x926b('0x32')][_0x926b('0x46')]?_0x3f6282[_0x926b('0x32')]:_0x66563e[_0x926b('0x30')];if(_0x4973ba[_0x926b('0x2e')][_0x926b('0x3e')]){_0x3f6282[_0x926b('0x3f')]=[{'all':!![]}];}_0x3f6282=_['merge']({},_0x3f6282,_0x4973ba[_0x926b('0x3c')]);return db[_0x926b('0x3d')][_0x926b('0x47')](_0x3f6282)[_0x926b('0x23')](handleEntityNotFound(_0x466757,null))[_0x926b('0x23')](respondWithResult(_0x466757,null))[_0x926b('0x42')](handleError(_0x466757,null));};exports['create']=function(_0x53440b,_0x44589e){return db['ChatTransferReport'][_0x926b('0x48')](_0x53440b[_0x926b('0x49')],{})[_0x926b('0x23')](respondWithResult(_0x44589e,0xc9))[_0x926b('0x42')](handleError(_0x44589e,null));};exports['update']=function(_0x5a0f80,_0x1fd009){if(_0x5a0f80[_0x926b('0x49')]['id']){delete _0x5a0f80[_0x926b('0x49')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x5a0f80[_0x926b('0x44')]['id']}})[_0x926b('0x23')](handleEntityNotFound(_0x1fd009,null))['then'](saveUpdates(_0x5a0f80['body'],null))['then'](respondWithResult(_0x1fd009,null))[_0x926b('0x42')](handleError(_0x1fd009,null));};exports[_0x926b('0x24')]=function(_0x3fd99e,_0x1e550a){return db['ChatTransferReport'][_0x926b('0x47')]({'where':{'id':_0x3fd99e[_0x926b('0x44')]['id']}})[_0x926b('0x23')](handleEntityNotFound(_0x1e550a,null))[_0x926b('0x23')](removeEntity(_0x1e550a,null))['catch'](handleError(_0x1e550a,null));};exports[_0x926b('0x4a')]=function(_0x5ddb0c,_0x9ba127){return db[_0x926b('0x3d')][_0x926b('0x4a')]()[_0x926b('0x23')](respondWithResult(_0x9ba127,null))[_0x926b('0x42')](handleError(_0x9ba127,null));}; \ No newline at end of file +var _0x411f=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','ChatTransferReport','findAll','show','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map'];(function(_0x47d0d7,_0x5cd8b){var _0x5563ec=function(_0x4f607b){while(--_0x4f607b){_0x47d0d7['push'](_0x47d0d7['shift']());}};_0x5563ec(++_0x5cd8b);}(_0x411f,0x1e1));var _0xf411=function(_0x3deed9,_0x5b450c){_0x3deed9=_0x3deed9-0x0;var _0x22aadf=_0x411f[_0x3deed9];return _0x22aadf;};'use strict';var emlformat=require(_0xf411('0x0'));var rimraf=require(_0xf411('0x1'));var zipdir=require(_0xf411('0x2'));var jsonpatch=require(_0xf411('0x3'));var rp=require(_0xf411('0x4'));var moment=require(_0xf411('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf411('0x6'));var util=require(_0xf411('0x7'));var path=require(_0xf411('0x8'));var sox=require(_0xf411('0x9'));var csv=require(_0xf411('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf411('0xb'));var _=require(_0xf411('0xc'));var squel=require(_0xf411('0xd'));var crypto=require(_0xf411('0xe'));var jsforce=require(_0xf411('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf411('0xa'));var querystring=require(_0xf411('0x10'));var Papa=require('papaparse');var Redis=require(_0xf411('0x11'));var authService=require(_0xf411('0x12'));var qs=require(_0xf411('0x13'));var as=require(_0xf411('0x14'));var hardwareService=require(_0xf411('0x15'));var logger=require(_0xf411('0x16'))('api');var utils=require(_0xf411('0x17'));var config=require(_0xf411('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ef3ee,_0x11a6ae){_0x11a6ae=_0x11a6ae||0xcc;return function(_0xe5dc27){if(_0xe5dc27){return _0x1ef3ee[_0xf411('0x19')](_0x11a6ae);}return _0x1ef3ee[_0xf411('0x1a')](_0x11a6ae)[_0xf411('0x1b')]();};}function respondWithResult(_0x4b8ade,_0x1f8715){_0x1f8715=_0x1f8715||0xc8;return function(_0x57f255){if(_0x57f255){return _0x4b8ade['status'](_0x1f8715)[_0xf411('0x1c')](_0x57f255);}};}function respondWithFilteredResult(_0x10ea85,_0x41fc46){return function(_0x58ff91){if(_0x58ff91){var _0x4c70c6=typeof _0x41fc46[_0xf411('0x1d')]===_0xf411('0x1e')&&typeof _0x41fc46[_0xf411('0x1f')]===_0xf411('0x1e');var _0x5f97f0=_0x58ff91[_0xf411('0x20')];var _0x25bab2=_0x4c70c6?0x0:_0x41fc46[_0xf411('0x1d')];var _0x55d0dc=_0x4c70c6?_0x58ff91[_0xf411('0x20')]:_0x41fc46[_0xf411('0x1d')]+_0x41fc46['limit'];var _0x3eb959;if(_0x55d0dc>=_0x5f97f0){_0x55d0dc=_0x5f97f0;_0x3eb959=0xc8;}else{_0x3eb959=0xce;}_0x10ea85['status'](_0x3eb959);return _0x10ea85[_0xf411('0x21')](_0xf411('0x22'),_0x25bab2+'-'+_0x55d0dc+'/'+_0x5f97f0)[_0xf411('0x1c')](_0x58ff91);}return null;};}function patchUpdates(_0x543d14){return function(_0x421dfe){try{jsonpatch[_0xf411('0x23')](_0x421dfe,_0x543d14,!![]);}catch(_0x1a720b){return BPromise[_0xf411('0x24')](_0x1a720b);}return _0x421dfe['save']();};}function saveUpdates(_0xfedf53,_0xf4ece9){return function(_0x3398f7){if(_0x3398f7){return _0x3398f7[_0xf411('0x25')](_0xfedf53)[_0xf411('0x26')](function(_0x2057f8){return _0x2057f8;});}return null;};}function removeEntity(_0x48fb6c,_0xd68f18){return function(_0x365a5b){if(_0x365a5b){return _0x365a5b[_0xf411('0x27')]()[_0xf411('0x26')](function(){_0x48fb6c[_0xf411('0x1a')](0xcc)[_0xf411('0x1b')]();});}};}function handleEntityNotFound(_0x498ec6,_0x34faa2){return function(_0x2f15d9){if(!_0x2f15d9){_0x498ec6[_0xf411('0x19')](0x194);}return _0x2f15d9;};}function handleError(_0x18282a,_0x2bb6dc){_0x2bb6dc=_0x2bb6dc||0x1f4;return function(_0x2b2d49){logger[_0xf411('0x28')](_0x2b2d49[_0xf411('0x29')]);if(_0x2b2d49[_0xf411('0x2a')]){delete _0x2b2d49['name'];}_0x18282a[_0xf411('0x1a')](_0x2bb6dc)['send'](_0x2b2d49);};}exports['index']=function(_0x120900,_0x37e992){var _0x58f32e={},_0x164ea5={},_0x473345={'count':0x0,'rows':[]};var _0x42b6c8=_[_0xf411('0x2b')](db['ChatTransferReport'][_0xf411('0x2c')],function(_0xb9fc99){return{'name':_0xb9fc99['fieldName'],'type':_0xb9fc99[_0xf411('0x2d')][_0xf411('0x2e')]};});_0x164ea5[_0xf411('0x2f')]=_[_0xf411('0x2b')](_0x42b6c8,'name');_0x164ea5[_0xf411('0x30')]=_[_0xf411('0x31')](_0x120900[_0xf411('0x30')]);_0x164ea5[_0xf411('0x32')]=_[_0xf411('0x33')](_0x164ea5[_0xf411('0x2f')],_0x164ea5[_0xf411('0x30')]);_0x58f32e[_0xf411('0x34')]=_[_0xf411('0x33')](_0x164ea5[_0xf411('0x2f')],qs[_0xf411('0x35')](_0x120900[_0xf411('0x30')][_0xf411('0x35')]));_0x58f32e[_0xf411('0x34')]=_0x58f32e[_0xf411('0x34')][_0xf411('0x36')]?_0x58f32e[_0xf411('0x34')]:_0x164ea5['model'];if(!_0x120900[_0xf411('0x30')][_0xf411('0x37')](_0xf411('0x38'))){_0x58f32e[_0xf411('0x1f')]=qs[_0xf411('0x1f')](_0x120900[_0xf411('0x30')]['limit']);_0x58f32e[_0xf411('0x1d')]=qs[_0xf411('0x1d')](_0x120900[_0xf411('0x30')]['offset']);}_0x58f32e[_0xf411('0x39')]=qs[_0xf411('0x3a')](_0x120900[_0xf411('0x30')][_0xf411('0x3a')]);_0x58f32e['where']=qs['filters'](_[_0xf411('0x3b')](_0x120900[_0xf411('0x30')],_0x164ea5['filters']),_0x42b6c8);if(_0x120900[_0xf411('0x30')][_0xf411('0x3c')]){_0x58f32e[_0xf411('0x3d')]=_[_0xf411('0x3e')](_0x58f32e[_0xf411('0x3d')],{'$or':_['map'](_0x42b6c8,function(_0xd851e0){if(_0xd851e0['type']!=='VIRTUAL'){var _0x13dd97={};_0x13dd97[_0xd851e0[_0xf411('0x2a')]]={'$like':'%'+_0x120900['query'][_0xf411('0x3c')]+'%'};return _0x13dd97;}})});}_0x58f32e=_[_0xf411('0x3e')]({},_0x58f32e,_0x120900[_0xf411('0x3f')]);var _0x47d881={'where':_0x58f32e[_0xf411('0x3d')]};return db['ChatTransferReport'][_0xf411('0x20')](_0x47d881)[_0xf411('0x26')](function(_0x11ac30){_0x473345[_0xf411('0x20')]=_0x11ac30;if(_0x120900[_0xf411('0x30')][_0xf411('0x40')]){_0x58f32e[_0xf411('0x41')]=[{'all':!![]}];}return db[_0xf411('0x42')][_0xf411('0x43')](_0x58f32e);})['then'](function(_0x190fa8){_0x473345['rows']=_0x190fa8;return _0x473345;})[_0xf411('0x26')](respondWithFilteredResult(_0x37e992,_0x58f32e))['catch'](handleError(_0x37e992,null));};exports[_0xf411('0x44')]=function(_0x3c6ce1,_0x1a682c){var _0x4a7512={'raw':!![],'where':{'id':_0x3c6ce1[_0xf411('0x45')]['id']}},_0x368b87={};_0x368b87[_0xf411('0x2f')]=_[_0xf411('0x31')](db['ChatTransferReport'][_0xf411('0x2c')]);_0x368b87[_0xf411('0x30')]=_['keys'](_0x3c6ce1[_0xf411('0x30')]);_0x368b87[_0xf411('0x32')]=_[_0xf411('0x33')](_0x368b87[_0xf411('0x2f')],_0x368b87[_0xf411('0x30')]);_0x4a7512[_0xf411('0x34')]=_[_0xf411('0x33')](_0x368b87[_0xf411('0x2f')],qs[_0xf411('0x35')](_0x3c6ce1[_0xf411('0x30')][_0xf411('0x35')]));_0x4a7512['attributes']=_0x4a7512['attributes'][_0xf411('0x36')]?_0x4a7512[_0xf411('0x34')]:_0x368b87[_0xf411('0x2f')];if(_0x3c6ce1[_0xf411('0x30')][_0xf411('0x40')]){_0x4a7512[_0xf411('0x41')]=[{'all':!![]}];}_0x4a7512=_[_0xf411('0x3e')]({},_0x4a7512,_0x3c6ce1[_0xf411('0x3f')]);return db['ChatTransferReport']['find'](_0x4a7512)['then'](handleEntityNotFound(_0x1a682c,null))['then'](respondWithResult(_0x1a682c,null))['catch'](handleError(_0x1a682c,null));};exports[_0xf411('0x46')]=function(_0x533580,_0x1590f5){return db[_0xf411('0x42')][_0xf411('0x46')](_0x533580[_0xf411('0x47')],{})[_0xf411('0x26')](respondWithResult(_0x1590f5,0xc9))['catch'](handleError(_0x1590f5,null));};exports[_0xf411('0x25')]=function(_0x4dcd93,_0x4b698b){if(_0x4dcd93['body']['id']){delete _0x4dcd93[_0xf411('0x47')]['id'];}return db[_0xf411('0x42')]['find']({'where':{'id':_0x4dcd93[_0xf411('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b698b,null))['then'](saveUpdates(_0x4dcd93[_0xf411('0x47')],null))['then'](respondWithResult(_0x4b698b,null))[_0xf411('0x48')](handleError(_0x4b698b,null));};exports[_0xf411('0x27')]=function(_0x234d69,_0x5c09b3){return db[_0xf411('0x42')][_0xf411('0x49')]({'where':{'id':_0x234d69[_0xf411('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c09b3,null))[_0xf411('0x26')](removeEntity(_0x5c09b3,null))[_0xf411('0x48')](handleError(_0x5c09b3,null));};exports[_0xf411('0x4a')]=function(_0x412e30,_0x2d3495){return db[_0xf411('0x42')][_0xf411('0x4a')]()[_0xf411('0x26')](respondWithResult(_0x2d3495,null))[_0xf411('0x48')](handleError(_0x2d3495,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8a02ff9..2f2d7fb 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 _0x981b=['bluebird','path','rimraf','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x158ca9,_0x5ea5b3){var _0x3bbaf4=function(_0xed0587){while(--_0xed0587){_0x158ca9['push'](_0x158ca9['shift']());}};_0x3bbaf4(++_0x5ea5b3);}(_0x981b,0x1c9));var _0xb981=function(_0x149f8d,_0x5a2642){_0x149f8d=_0x149f8d-0x0;var _0x3110a4=_0x981b[_0x149f8d];return _0x3110a4;};'use strict';var _=require(_0xb981('0x0'));var util=require(_0xb981('0x1'));var logger=require(_0xb981('0x2'))(_0xb981('0x3'));var moment=require(_0xb981('0x4'));var BPromise=require(_0xb981('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb981('0x6'));var rimraf=require(_0xb981('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x13bedb,_0x199226){return _0x13bedb[_0xb981('0x8')]('ChatTransferReport',attributes,{'tableName':_0xb981('0x9'),'paranoid':![],'indexes':[{'name':_0xb981('0xa'),'fields':[_0xb981('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1b=['../../config/environment','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1d5108,_0x55e387){var _0x3cdd9d=function(_0x2330f5){while(--_0x2330f5){_0x1d5108['push'](_0x1d5108['shift']());}};_0x3cdd9d(++_0x55e387);}(_0x9c1b,0x10d));var _0xb9c1=function(_0x120fdb,_0x586aa3){_0x120fdb=_0x120fdb-0x0;var _0xc2f5ba=_0x9c1b[_0x120fdb];return _0xc2f5ba;};'use strict';var _=require(_0xb9c1('0x0'));var util=require(_0xb9c1('0x1'));var logger=require(_0xb9c1('0x2'))('api');var moment=require(_0xb9c1('0x3'));var BPromise=require(_0xb9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c1('0x5'));var rimraf=require(_0xb9c1('0x6'));var config=require(_0xb9c1('0x7'));var attributes=require(_0xb9c1('0x8'));module['exports']=function(_0x109fd3,_0x285b29){return _0x109fd3['define'](_0xb9c1('0x9'),attributes,{'tableName':_0xb9c1('0xa'),'paranoid':![],'indexes':[{'name':_0xb9c1('0xb'),'fields':[_0xb9c1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0b9de05..65eb0d0 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 _0xc024=['ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2b9bdf,_0x8fa76f){var _0x20dd2a=function(_0x2810d0){while(--_0x2810d0){_0x2b9bdf['push'](_0x2b9bdf['shift']());}};_0x20dd2a(++_0x8fa76f);}(_0xc024,0x101));var _0x4c02=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xc024[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x4c02('0x0'));var util=require(_0x4c02('0x1'));var moment=require(_0x4c02('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c02('0x3'));var fs=require('fs');var Redis=require(_0x4c02('0x4'));var db=require(_0x4c02('0x5'))['db'];var utils=require(_0x4c02('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4c02('0x7'));var jayson=require(_0x4c02('0x8'));var client=jayson[_0x4c02('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460d79,_0x1bd2e9,_0x43eef9){return new BPromise(function(_0x167769,_0x197afa){return client[_0x4c02('0xa')](_0x460d79,_0x43eef9)[_0x4c02('0xb')](function(_0x20309a){logger[_0x4c02('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x1bd2e9,'request\x20sent');logger[_0x4c02('0xd')](_0x4c02('0xe'),_0x1bd2e9,_0x4c02('0xf'),JSON[_0x4c02('0x10')](_0x20309a));if(_0x20309a[_0x4c02('0x11')]){if(_0x20309a[_0x4c02('0x11')][_0x4c02('0x12')]===0x1f4){logger[_0x4c02('0x11')](_0x4c02('0x13'),_0x1bd2e9,_0x20309a[_0x4c02('0x11')]['message']);return _0x197afa(_0x20309a[_0x4c02('0x11')][_0x4c02('0x14')]);}logger[_0x4c02('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x1bd2e9,_0x20309a[_0x4c02('0x11')][_0x4c02('0x14')]);return _0x167769(_0x20309a['error']['message']);}else{logger[_0x4c02('0xc')](_0x4c02('0x13'),_0x1bd2e9,_0x4c02('0xf'));_0x167769(_0x20309a[_0x4c02('0x15')][_0x4c02('0x14')]);}})[_0x4c02('0x16')](function(_0x104601){logger['error'](_0x4c02('0x13'),_0x1bd2e9,_0x104601);_0x197afa(_0x104601);});});} \ No newline at end of file +var _0x9cd4=['ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x50fe34,_0x14a248){var _0x5eab16=function(_0x2f5b6f){while(--_0x2f5b6f){_0x50fe34['push'](_0x50fe34['shift']());}};_0x5eab16(++_0x14a248);}(_0x9cd4,0x171));var _0x49cd=function(_0x4e7af4,_0x758572){_0x4e7af4=_0x4e7af4-0x0;var _0x2548f1=_0x9cd4[_0x4e7af4];return _0x2548f1;};'use strict';var _=require('lodash');var util=require(_0x49cd('0x0'));var moment=require(_0x49cd('0x1'));var BPromise=require(_0x49cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x49cd('0x4'));var logger=require('../../config/logger')(_0x49cd('0x5'));var config=require(_0x49cd('0x6'));var jayson=require(_0x49cd('0x7'));var client=jayson[_0x49cd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x521d8b,_0x252487,_0x3b50a1){return new BPromise(function(_0x6b551c,_0x48adb7){return client[_0x49cd('0x9')](_0x521d8b,_0x3b50a1)['then'](function(_0x22126b){logger[_0x49cd('0xa')](_0x49cd('0xb'),_0x252487,'request\x20sent');logger[_0x49cd('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x252487,_0x49cd('0xd'),JSON[_0x49cd('0xe')](_0x22126b));if(_0x22126b[_0x49cd('0xf')]){if(_0x22126b[_0x49cd('0xf')][_0x49cd('0x10')]===0x1f4){logger[_0x49cd('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x252487,_0x22126b[_0x49cd('0xf')][_0x49cd('0x11')]);return _0x48adb7(_0x22126b[_0x49cd('0xf')][_0x49cd('0x11')]);}logger['error'](_0x49cd('0xb'),_0x252487,_0x22126b[_0x49cd('0xf')][_0x49cd('0x11')]);return _0x6b551c(_0x22126b[_0x49cd('0xf')][_0x49cd('0x11')]);}else{logger['info'](_0x49cd('0xb'),_0x252487,_0x49cd('0xd'));_0x6b551c(_0x22126b[_0x49cd('0x12')][_0x49cd('0x11')]);}})[_0x49cd('0x13')](function(_0x2fb397){logger[_0x49cd('0xf')](_0x49cd('0xb'),_0x252487,_0x2fb397);_0x48adb7(_0x2fb397);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9e3b733..b390975 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 _0xdcfa=['isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xdcfa,0xe4));var _0xadcf=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xdcfa[_0x454018];return _0x24697d;};'use strict';var multer=require(_0xadcf('0x0'));var util=require(_0xadcf('0x1'));var path=require('path');var timeout=require(_0xadcf('0x2'));var express=require(_0xadcf('0x3'));var router=express[_0xadcf('0x4')]();var fs_extra=require(_0xadcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xadcf('0x6'));var config=require(_0xadcf('0x7'));var controller=require(_0xadcf('0x8'));router[_0xadcf('0x9')]('/',auth['isAuthenticated'](),controller[_0xadcf('0xa')]);router[_0xadcf('0x9')](_0xadcf('0xb'),auth[_0xadcf('0xc')](),controller[_0xadcf('0xd')]);router[_0xadcf('0x9')](_0xadcf('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xadcf('0xf')]('/',auth['isAuthenticated'](),controller[_0xadcf('0x10')]);router['put'](_0xadcf('0xe'),auth['isAuthenticated'](),controller[_0xadcf('0x11')]);router[_0xadcf('0x12')]('/:id',auth[_0xadcf('0xc')](),controller['destroy']);module[_0xadcf('0x13')]=router; \ No newline at end of file +var _0x1823=['exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3a175b,_0x505d13){var _0x9b84fa=function(_0x5533e1){while(--_0x5533e1){_0x3a175b['push'](_0x3a175b['shift']());}};_0x9b84fa(++_0x505d13);}(_0x1823,0x11e));var _0x3182=function(_0x39ce5a,_0x260622){_0x39ce5a=_0x39ce5a-0x0;var _0x46cd9a=_0x1823[_0x39ce5a];return _0x46cd9a;};'use strict';var multer=require('multer');var util=require(_0x3182('0x0'));var path=require(_0x3182('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3182('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3182('0x3'));var config=require(_0x3182('0x4'));var controller=require(_0x3182('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3182('0x6')](_0x3182('0x7'),auth[_0x3182('0x8')](),controller[_0x3182('0x9')]);router[_0x3182('0x6')](_0x3182('0xa'),auth[_0x3182('0x8')](),controller[_0x3182('0xb')]);router[_0x3182('0xc')]('/',auth[_0x3182('0x8')](),controller[_0x3182('0xd')]);router[_0x3182('0xe')](_0x3182('0xa'),auth['isAuthenticated'](),controller[_0x3182('0xf')]);router[_0x3182('0x10')](_0x3182('0xa'),auth[_0x3182('0x8')](),controller[_0x3182('0x11')]);module[_0x3182('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 912851d..9ba5114 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 _0x5bf6=['Comments','offlineForm','generate','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:','Send','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea'];(function(_0x1cea76,_0x11c8ad){var _0x1b359b=function(_0x4e849d){while(--_0x4e849d){_0x1cea76['push'](_0x1cea76['shift']());}};_0x1b359b(++_0x11c8ad);}(_0x5bf6,0x13e));var _0x65bf=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x5bf6[_0x1a21ff];return _0x25afc1;};'use strict';var Sequelize=require(_0x65bf('0x0'));var rs=require('randomstring');module[_0x65bf('0x1')]={'name':{'type':Sequelize[_0x65bf('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x65bf('0x2')],'allowNull':![],'unique':_0x65bf('0x3')},'description':{'type':Sequelize[_0x65bf('0x2')]},'mapKey':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x5')},'customerAlias':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x65bf('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x65bf('0x2')],'allowNull':![],'defaultValue':_0x65bf('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65bf('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x65bf('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x65bf('0xa')](_0x65bf('0xb'),_0x65bf('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0xd')},'start_chat_button':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x65bf('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x65bf('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x65bf('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x65bf('0x13')},'placeholderMessage':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x14')},'closingMessage':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x15')},'conditionAgreement':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x16')},'ratingType':{'type':Sequelize[_0x65bf('0xa')](_0x65bf('0x17'),'thumb'),'defaultValue':_0x65bf('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x65bf('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x65bf('0x18'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x65bf('0x19'),'helpText':''}},{'type':_0x65bf('0x18'),'props':{'title':_0x65bf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x65bf('0x4'),'type':_0x65bf('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x65bf('0x1a')](_0x65bf('0x1b'))?JSON[_0x65bf('0x1c')](this[_0x65bf('0x1a')]('onlineForm')):{};},'set':function(_0x5f0c8a){return this[_0x65bf('0x1d')](_0x65bf('0x1b'),JSON[_0x65bf('0x1e')](_0x5f0c8a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x65bf('0x1e')]({'items':[{'type':_0x65bf('0x18'),'props':{'title':_0x65bf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x65bf('0x4'),'type':_0x65bf('0x4')},'variable':null},{'type':_0x65bf('0x1f'),'config':{'placeholder':_0x65bf('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x65bf('0x1a')](_0x65bf('0x21'))?JSON[_0x65bf('0x1c')](this[_0x65bf('0x1a')]('offlineForm')):{};},'set':function(_0x874c78){return this['setDataValue'](_0x65bf('0x21'),JSON[_0x65bf('0x1e')](_0x874c78));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x65bf('0x22')]();}},'autoclose':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x65bf('0x2')]},'forwardOffline':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x65bf('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x65bf('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x24')},'offlineMessageBody':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x15')},'sendUnmanaged':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x26')},'enableCustomerAttachment':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x65bf('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x65bf('0x2')]},'notificationTemplate':{'type':Sequelize[_0x65bf('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x65bf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x28')},'verticalAlignment':{'type':Sequelize[_0x65bf('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x65bf('0x2a')},'defaultTitle':{'type':Sequelize[_0x65bf('0x2')]},'customerAvatar':{'type':Sequelize[_0x65bf('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x65bf('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x65bf('0x2')],'allowNull':![],'defaultValue':_0x65bf('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65bf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x65bf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':_0x65bf('0x2c')},'systemAvatar':{'type':Sequelize[_0x65bf('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x65bf('0x8')],'comment':_0x65bf('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![],'comment':_0x65bf('0x2e'),'set':function(_0x46ff3e){if(!_0x46ff3e)this['setDataValue'](_0x65bf('0x2f'),null);this[_0x65bf('0x1d')](_0x65bf('0x30'),_0x46ff3e);}},'vidaooEscalation':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x65bf('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65bf('0x31')},'vidaooNote':{'type':Sequelize[_0x65bf('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x65bf('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8283=['#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','address','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','Chat','Send','Contact\x20us','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','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate'];(function(_0x3a4053,_0x5684ee){var _0x42af54=function(_0x97a4b6){while(--_0x97a4b6){_0x3a4053['push'](_0x3a4053['shift']());}};_0x42af54(++_0x5684ee);}(_0x8283,0x173));var _0x3828=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8283[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3828('0x0'));var rs=require('randomstring');module[_0x3828('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3828('0x2')},'description':{'type':Sequelize[_0x3828('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3828('0x4')},'mapKeyOffline':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3828('0x3')],'allowNull':![],'defaultValue':_0x3828('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3828('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3828('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3828('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3828('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x3828('0xa'),'squared'),'defaultValue':_0x3828('0xa')},'header_online':{'type':Sequelize[_0x3828('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xb')},'offline_chat_button':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xc')},'header_offline':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3828('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x3828('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3828('0xf')]},'closingQuestion':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x12')},'noteTitle':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x13')},'placeholderMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x14')},'closingMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x15')},'closingMessageButton':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xc')},'skipMessageButton':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x16')},'conditionAgreement':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3828('0x17')},'ratingType':{'type':Sequelize[_0x3828('0x18')](_0x3828('0x19'),_0x3828('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3828('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3828('0xf')],'defaultValue':function(){return JSON[_0x3828('0x1b')]({'items':[{'type':_0x3828('0x1c'),'variable':null,'config':{'placeholder':_0x3828('0x1d'),'type':'text','required':!![]},'props':{'title':_0x3828('0x1d'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3828('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3828('0x1e')](_0x3828('0x1f'))?JSON[_0x3828('0x20')](this[_0x3828('0x1e')](_0x3828('0x1f'))):{};},'set':function(_0x176b5f){return this[_0x3828('0x21')]('onlineForm',JSON['stringify'](_0x176b5f));}},'offlineForm':{'type':Sequelize[_0x3828('0xf')],'defaultValue':function(){return JSON[_0x3828('0x1b')]({'items':[{'type':_0x3828('0x1c'),'props':{'title':_0x3828('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x3828('0x22'),'config':{'placeholder':_0x3828('0x23')},'props':{'title':'Comments','helpText':_0x3828('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x3828('0x1e')](_0x3828('0x25'))?JSON['parse'](this['getDataValue'](_0x3828('0x25'))):{};},'set':function(_0x5b714f){return this['setDataValue']('offlineForm',JSON[_0x3828('0x1b')](_0x5b714f));}},'token':{'type':Sequelize[_0x3828('0x3')],'defaultValue':function(){return rs[_0x3828('0x26')]();}},'autoclose':{'type':Sequelize[_0x3828('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3828('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x27')},'waitingMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x29')},'skipUnmanaged':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x16')},'sendUnmanaged':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3828('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3828('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3828('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3828('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3828('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3828('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x3828('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3828('0x2c')},'defaultTitle':{'type':Sequelize[_0x3828('0x3')]},'customerAvatar':{'type':Sequelize[_0x3828('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3828('0x3')],'allowNull':![],'defaultValue':_0x3828('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3828('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3828('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3828('0x3')],'defaultValue':_0x3828('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3828('0x8')],'comment':_0x3828('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![],'comment':_0x3828('0x30'),'set':function(_0x2874b0){if(!_0x2874b0)this[_0x3828('0x21')](_0x3828('0x31'),null);this[_0x3828('0x21')]('mandatoryDisposition',_0x2874b0);}},'vidaooEscalation':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3828('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3828('0x32')},'vidaooNote':{'type':Sequelize[_0x3828('0x3')],'defaultValue':function(){return _0x3828('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x3828('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3828('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3828('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1076643..fb7162e 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 _0xa9e0=['fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','bluebird','mustache','util','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','map','ChatWebsite','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','keys','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','file','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','existsSync','server/files/images/logos/','download','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications','List','account','applications','list','asc','from','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','push','*,*,*,*','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','fromString','attachments','offline-chat','basename','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','mapValues','subjectOffline','Chat','server','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','all','some','x-real-ip','connection','remoteAddress','replace','textColor','color_button','backgroundColor','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items'];(function(_0x51cf2b,_0x17bc1e){var _0x505756=function(_0xc43054){while(--_0xc43054){_0x51cf2b['push'](_0x51cf2b['shift']());}};_0x505756(++_0x17bc1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var Mustache=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x3'));var _=require('lodash');var querystring=require(_0x0a9e('0x4'));var Redis=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var db=require(_0x0a9e('0x9'))['db'];config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0a9e('0xd')](socket);var htmlToText=require(_0x0a9e('0xe'));var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x10')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client'][_0x0a9e('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x36471c,_0xd5b662,_0x26d672,_0x32d742){return new BPromise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_0x32d742||client;return _0x4283ce[_0x0a9e('0x12')](_0x36471c,_0x26d672)[_0x0a9e('0x13')](function(_0x281129){logger[_0x0a9e('0x14')](_0x0a9e('0x15'),_0xd5b662,'request\x20sent');logger[_0x0a9e('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xd5b662,_0x0a9e('0x17'),JSON['stringify'](_0x281129));if(_0x281129[_0x0a9e('0x18')]){if(_0x281129[_0x0a9e('0x18')]['code']===0x1f4){logger[_0x0a9e('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xd5b662,_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);return _0x5db4b0(_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);}logger[_0x0a9e('0x18')](_0x0a9e('0x15'),_0xd5b662,_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);return _0x69aeb7(_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);}else{logger[_0x0a9e('0x14')](_0x0a9e('0x15'),_0xd5b662,'request\x20sent');_0x69aeb7(_0x281129[_0x0a9e('0x1a')][_0x0a9e('0x19')]);}})['catch'](function(_0x20f109){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xd5b662,_0x20f109);_0x5db4b0(_0x20f109);});});}function respondWithStatusCode(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0xcc;return function(_0x38e7c4){if(_0x38e7c4){return _0x3a02e1[_0x0a9e('0x1b')](_0x432e56);}return _0x3a02e1['status'](_0x432e56)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xc8;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x1d')](_0x3b45bc)[_0x0a9e('0x1e')](_0x4d00e6);}};}function respondWithFilteredResult(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(_0x59181e){var _0x197ec0=typeof _0x5ea472[_0x0a9e('0x1f')]===_0x0a9e('0x20')&&typeof _0x5ea472[_0x0a9e('0x21')]==='undefined';var _0x384319=_0x59181e['count'];var _0x45a1e7=_0x197ec0?0x0:_0x5ea472['offset'];var _0x1dc186=_0x197ec0?_0x59181e[_0x0a9e('0x22')]:_0x5ea472[_0x0a9e('0x1f')]+_0x5ea472[_0x0a9e('0x21')];var _0x140511;if(_0x1dc186>=_0x384319){_0x1dc186=_0x384319;_0x140511=0xc8;}else{_0x140511=0xce;}_0x16b1ca[_0x0a9e('0x1d')](_0x140511);return _0x16b1ca[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x45a1e7+'-'+_0x1dc186+'/'+_0x384319)['json'](_0x59181e);}return null;};}function saveUpdates(_0x3652a7){return function(_0x468813){if(_0x468813){return _0x468813[_0x0a9e('0x25')](_0x3652a7)[_0x0a9e('0x13')](function(_0x5c877d){return _0x5c877d;});}return null;};}function removeEntity(_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x26')]()[_0x0a9e('0x13')](function(){var _0x58b06f=_0x40e7a3[_0x0a9e('0x27')]({'plain':!![]});var _0x296f41=_0x0a9e('0x28');return db[_0x0a9e('0x29')]['destroy']({'where':{'type':_0x296f41,'resourceId':_0x58b06f['id']}})[_0x0a9e('0x13')](function(){return _0x40e7a3;});})['then'](function(){_0x15b200[_0x0a9e('0x1d')](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x1122db){return function(_0x33bdb7){if(!_0x33bdb7){_0x1122db[_0x0a9e('0x1b')](0x194);}return _0x33bdb7;};}function handleError(_0x5180f1,_0x66c1d2){_0x66c1d2=_0x66c1d2||0x1f4;return function(_0x46f0a5){logger[_0x0a9e('0x18')](_0x46f0a5[_0x0a9e('0x2a')]);if(_0x46f0a5[_0x0a9e('0x2b')]){delete _0x46f0a5[_0x0a9e('0x2b')];}_0x5180f1[_0x0a9e('0x1d')](_0x66c1d2)[_0x0a9e('0x2c')](_0x46f0a5);};}exports['index']=function(_0x44295a,_0x5e7238){var _0x2cc7a0={'include':[{'model':db[_0x0a9e('0x2d')],'as':'mandatoryDispositionPause'}]},_0x14b13f={},_0x2b7e7f={'count':0x0,'rows':[]};var _0x191e91=_[_0x0a9e('0x2e')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')],function(_0x4853b1){return{'name':_0x4853b1['fieldName'],'type':_0x4853b1[_0x0a9e('0x31')]['key']};});_0x14b13f[_0x0a9e('0x32')]=_[_0x0a9e('0x2e')](_0x191e91,_0x0a9e('0x2b'));_0x14b13f[_0x0a9e('0x33')]=_['keys'](_0x44295a[_0x0a9e('0x33')]);_0x14b13f[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x14b13f['model'],_0x14b13f[_0x0a9e('0x33')]);_0x2cc7a0[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x14b13f['model'],qs['fields'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x2cc7a0['attributes']=_0x2cc7a0[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x2cc7a0[_0x0a9e('0x36')]:_0x14b13f[_0x0a9e('0x32')];if(!_0x44295a['query']['hasOwnProperty'](_0x0a9e('0x39'))){_0x2cc7a0[_0x0a9e('0x21')]=qs['limit'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x2cc7a0[_0x0a9e('0x1f')]=qs['offset'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x2cc7a0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x2cc7a0[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x44295a[_0x0a9e('0x33')],_0x14b13f[_0x0a9e('0x34')]),_0x191e91);if(_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x2cc7a0[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x2cc7a0['where'],{'$or':_['map'](_0x191e91,function(_0x473fdc){if(_0x473fdc[_0x0a9e('0x31')]!==_0x0a9e('0x40')){var _0x315881={};_0x315881[_0x473fdc[_0x0a9e('0x2b')]]={'$like':'%'+_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x315881;}})});}_0x2cc7a0=_[_0x0a9e('0x3f')]({},_0x2cc7a0,_0x44295a[_0x0a9e('0x41')]);var _0x25c6e6={'where':_0x2cc7a0[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2f')]['count'](_0x25c6e6)[_0x0a9e('0x13')](function(_0x138b8b){_0x2b7e7f[_0x0a9e('0x22')]=_0x138b8b;if(_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x2cc7a0[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x44')](_0x2cc7a0);})['then'](function(_0x2e9d90){_0x2b7e7f['rows']=_0x2e9d90;return _0x2b7e7f;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x5e7238,_0x2cc7a0))[_0x0a9e('0x45')](handleError(_0x5e7238,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){var _0x7f6eb1={'raw':![],'where':{'id':_0x562fb4[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x2d')],'as':_0x0a9e('0x48')}]},_0x4774f4={};_0x4774f4[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x4774f4[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x33')]);_0x4774f4[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4774f4[_0x0a9e('0x32')],_0x4774f4[_0x0a9e('0x33')]);_0x7f6eb1['attributes']=_[_0x0a9e('0x35')](_0x4774f4[_0x0a9e('0x32')],qs['fields'](_0x562fb4['query']['fields']));_0x7f6eb1[_0x0a9e('0x36')]=_0x7f6eb1[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x7f6eb1[_0x0a9e('0x36')]:_0x4774f4[_0x0a9e('0x32')];if(_0x562fb4[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x7f6eb1[_0x0a9e('0x43')]=[{'all':!![]}];}_0x7f6eb1=_['merge']({},_0x7f6eb1,_0x562fb4['options']);return db['ChatWebsite'][_0x0a9e('0x4a')](_0x7f6eb1)[_0x0a9e('0x13')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x13')](respondWithResult(_0x14bec2,null))['catch'](handleError(_0x14bec2,null));};exports[_0x0a9e('0x4b')]=function(_0x161aa7,_0x53d113){return db['ChatWebsite'][_0x0a9e('0x4b')](_0x161aa7['body'],{})[_0x0a9e('0x13')](function(_0x4c3845){var _0x2e5e62=_0x161aa7[_0x0a9e('0x4c')][_0x0a9e('0x27')]({'plain':!![]});if(!_0x2e5e62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e5e62[_0x0a9e('0x4d')]===_0x0a9e('0x4c')){var _0x508b47=_0x4c3845['get']({'plain':!![]});var _0x128aa6=_0x0a9e('0x28');return db['UserProfileSection'][_0x0a9e('0x4a')]({'where':{'name':_0x128aa6,'userProfileId':_0x2e5e62['userProfileId']},'raw':!![]})[_0x0a9e('0x13')](function(_0x523cd2){if(_0x523cd2&&_0x523cd2[_0x0a9e('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x508b47['name'],'resourceId':_0x508b47['id'],'type':_0x523cd2[_0x0a9e('0x2b')],'sectionId':_0x523cd2['id']},{})['then'](function(){return _0x4c3845;});}else{return _0x4c3845;}})[_0x0a9e('0x45')](function(_0x65432){logger[_0x0a9e('0x18')](_0x0a9e('0x4f'),_0x65432);throw _0x65432;});}return _0x4c3845;})[_0x0a9e('0x13')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x45')](handleError(_0x53d113,null));};exports[_0x0a9e('0x25')]=function(_0x28d814,_0x4e67ab){if(_0x28d814[_0x0a9e('0x50')]['id']){delete _0x28d814[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x28d814[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x0a9e('0x13')](handleEntityNotFound(_0x4e67ab,null))[_0x0a9e('0x13')](saveUpdates(_0x28d814['body'],null))[_0x0a9e('0x13')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));};exports[_0x0a9e('0x26')]=function(_0x5ba1f9,_0x4b3c1a){return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x5ba1f9['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x13')](removeEntity(_0x4b3c1a,null))[_0x0a9e('0x45')](handleError(_0x4b3c1a,null));};exports[_0x0a9e('0x51')]=function(_0x1cca9f,_0x26d7db){return db['ChatWebsite'][_0x0a9e('0x51')]()['then'](respondWithResult(_0x26d7db,null))[_0x0a9e('0x45')](handleError(_0x26d7db,null));};exports[_0x0a9e('0x52')]=function(_0x51aaf7,_0x5adf8f){if(_0x51aaf7[_0x0a9e('0x50')]['id']){delete _0x51aaf7[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x13')](function(_0x54327c){if(_0x54327c){_0x51aaf7[_0x0a9e('0x50')][_0x0a9e('0x53')]=_0x54327c['id'];return db[_0x0a9e('0x54')][_0x0a9e('0x4b')](_0x51aaf7[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x45')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x55')]=function(_0x281c7d,_0x47bb43){var _0x3528b7={'raw':![],'where':{}};var _0x4f1e60={};var _0x5211e3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x281c7d[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x13')](function(_0xc8c264){if(_0xc8c264){_0x4f1e60[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0x54')][_0x0a9e('0x30')]);_0x4f1e60[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x281c7d[_0x0a9e('0x33')]);_0x4f1e60[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4f1e60[_0x0a9e('0x32')],_0x4f1e60[_0x0a9e('0x33')]);_0x3528b7[_0x0a9e('0x36')]=_['intersection'](_0x4f1e60[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x281c7d[_0x0a9e('0x33')]['fields']));_0x3528b7[_0x0a9e('0x36')]=_0x3528b7[_0x0a9e('0x36')]['length']?_0x3528b7[_0x0a9e('0x36')]:_0x4f1e60[_0x0a9e('0x32')];if(!_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x3528b7['limit']=qs['limit'](_0x281c7d['query'][_0x0a9e('0x21')]);_0x3528b7[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x3528b7[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x281c7d[_0x0a9e('0x33')]['sort']);_0x3528b7[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x281c7d['query'],_0x4f1e60[_0x0a9e('0x34')]));_0x3528b7['where'][_0x0a9e('0x53')]=_0xc8c264['id'];if(_0x281c7d[_0x0a9e('0x33')]['filter']){_0x3528b7[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x3528b7[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x3528b7['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2e9552;})});}_0x3528b7=_['merge']({},_0x3528b7,_0x281c7d[_0x0a9e('0x41')]);return db[_0x0a9e('0x54')][_0x0a9e('0x22')]({'where':_0x3528b7[_0x0a9e('0x3c')]})['then'](function(_0x290d43){_0x5211e3[_0x0a9e('0x22')]=_0x290d43;if(_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x3528b7[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x54')][_0x0a9e('0x44')](_0x3528b7);})[_0x0a9e('0x13')](function(_0x1a7b03){_0x5211e3[_0x0a9e('0x58')]=_0x1a7b03;return _0x5211e3;});}})[_0x0a9e('0x13')](respondWithFilteredResult(_0x47bb43,_0x3528b7))[_0x0a9e('0x45')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x59')]=function(_0xe0749e,_0x5b35db){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0xe0749e[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b35db,null))[_0x0a9e('0x13')](function(_0x33dda0){if(_0x33dda0){return _0x33dda0[_0x0a9e('0x59')](_0xe0749e[_0x0a9e('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x5b35db,null))[_0x0a9e('0x45')](handleError(_0x5b35db,null));};exports[_0x0a9e('0x5a')]=function(_0x4c54fa,_0x45108c){if(_0x4c54fa['body']['id']){delete _0x4c54fa[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x4c54fa[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x45108c,null))[_0x0a9e('0x13')](function(_0x42b959){if(_0x42b959){_0x4c54fa[_0x0a9e('0x50')][_0x0a9e('0x53')]=_0x42b959['id'];return db[_0x0a9e('0x5b')]['create'](_0x4c54fa[_0x0a9e('0x50')]);}})[_0x0a9e('0x13')](respondWithResult(_0x45108c,null))[_0x0a9e('0x45')](handleError(_0x45108c,null));};exports[_0x0a9e('0x5c')]=function(_0x492543,_0xf51744){var _0xf0db1={'raw':![],'where':{}};var _0x4bf3a5={};var _0x1d6834={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x492543[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xf51744,null))[_0x0a9e('0x13')](function(_0x5af453){if(_0x5af453){_0x4bf3a5['model']=_[_0x0a9e('0x49')](db[_0x0a9e('0x5b')][_0x0a9e('0x30')]);_0x4bf3a5['query']=_[_0x0a9e('0x49')](_0x492543[_0x0a9e('0x33')]);_0x4bf3a5['filters']=_['intersection'](_0x4bf3a5[_0x0a9e('0x32')],_0x4bf3a5['query']);_0xf0db1['attributes']=_['intersection'](_0x4bf3a5[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0xf0db1[_0x0a9e('0x36')]=_0xf0db1[_0x0a9e('0x36')]['length']?_0xf0db1[_0x0a9e('0x36')]:_0x4bf3a5['model'];if(!_0x492543[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0xf0db1[_0x0a9e('0x21')]=qs['limit'](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0xf0db1[_0x0a9e('0x1f')]=qs['offset'](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0xf0db1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0xf0db1[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_['pick'](_0x492543[_0x0a9e('0x33')],_0x4bf3a5[_0x0a9e('0x34')]));_0xf0db1['where'][_0x0a9e('0x53')]=_0x5af453['id'];if(_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0xf0db1['where']=_[_0x0a9e('0x3f')](_0xf0db1['where'],{'$or':_[_0x0a9e('0x2e')](_0xf0db1[_0x0a9e('0x36')],function(_0x558a87){var _0x1f29bd={};_0x1f29bd[_0x558a87]={'$like':'%'+_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x1f29bd;})});}_0xf0db1=_[_0x0a9e('0x3f')]({},_0xf0db1,_0x492543[_0x0a9e('0x41')]);return db['CannedAnswer'][_0x0a9e('0x22')]({'where':_0xf0db1[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x30ef6e){_0x1d6834[_0x0a9e('0x22')]=_0x30ef6e;if(_0x492543[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0xf0db1[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x44')](_0xf0db1);})[_0x0a9e('0x13')](function(_0x3754e2){_0x1d6834[_0x0a9e('0x58')]=_0x3754e2;return _0x1d6834;});}})['then'](respondWithFilteredResult(_0xf51744,_0xf0db1))[_0x0a9e('0x45')](handleError(_0xf51744,null));};exports[_0x0a9e('0x5d')]=function(_0x12843d,_0x2ed526){return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x12843d[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2ed526,null))['then'](function(_0x23b447){if(_0x23b447){return _0x23b447['removeAnswers'](_0x12843d[_0x0a9e('0x33')][_0x0a9e('0x5e')]);}})[_0x0a9e('0x13')](respondWithStatusCode(_0x2ed526,null))[_0x0a9e('0x45')](handleError(_0x2ed526,null));};exports['addLogo']=function(_0x3ceba6,_0x4cf72d){_0x3ceba6[_0x0a9e('0x50')][_0x0a9e('0x5f')]=_0x3ceba6['file'][_0x0a9e('0x60')];return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x3ceba6['params']['id']}})['then'](handleEntityNotFound(_0x4cf72d,null))[_0x0a9e('0x13')](saveUpdates(_0x3ceba6[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x4cf72d,null))[_0x0a9e('0x45')](handleError(_0x4cf72d,null));};exports[_0x0a9e('0x61')]=function(_0x2450a8,_0x17793e){_0x2450a8[_0x0a9e('0x50')][_0x0a9e('0x62')]=_0x2450a8['file'][_0x0a9e('0x60')];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x2450a8[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x17793e,null))[_0x0a9e('0x13')](saveUpdates(_0x2450a8[_0x0a9e('0x50')],null))['then'](respondWithResult(_0x17793e,null))[_0x0a9e('0x45')](handleError(_0x17793e,null));};exports[_0x0a9e('0x63')]=function(_0x2791c5,_0x2aa5f2){_0x2791c5[_0x0a9e('0x50')]['customerAvatar']=_0x2791c5['file'][_0x0a9e('0x60')];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x2791c5[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x13')](saveUpdates(_0x2791c5[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports['addSystemAvatar']=function(_0x1889ed,_0x5dfbe2){_0x1889ed[_0x0a9e('0x50')]['systemAvatar']=_0x1889ed[_0x0a9e('0x64')]['filename'];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x1889ed[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5dfbe2,null))[_0x0a9e('0x13')](saveUpdates(_0x1889ed[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x5dfbe2,null))[_0x0a9e('0x45')](handleError(_0x5dfbe2,null));};exports[_0x0a9e('0x65')]=function(_0x5ab0bc,_0x5505f4){var _0x16449b=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x68'));var _0x59303b={'where':{'id':_0x5ab0bc['params']['id']},'attributes':['id',_0x0a9e('0x5f')],'raw':!![]};var _0xadce3d=![];return require('../../config/license/util')[_0x0a9e('0x69')]()[_0x0a9e('0x13')](function(_0xcacabb){if(_0xcacabb){_0xadce3d=_0xcacabb[_0x0a9e('0x6a')];}})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x59303b);})[_0x0a9e('0x13')](handleEntityNotFound(_0x5505f4,null))[_0x0a9e('0x13')](function(_0x16afb3){if(_0x16afb3){if(!_['isNil'](_0x16afb3[_0x0a9e('0x5f')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6c'),_0x16afb3['sitepic']))&&_0xadce3d){_0x16449b=path['join'](config[_0x0a9e('0x67')],_0x0a9e('0x6c'),_0x16afb3[_0x0a9e('0x5f')]);}}return _0x5505f4[_0x0a9e('0x6d')](_0x16449b);}})[_0x0a9e('0x45')](handleError(_0x5505f4,null));};exports['getAvatar']=function(_0x1339d0,_0x3c775a){var _0x3450ae=path['join'](config[_0x0a9e('0x67')],'server/files/images/avatars/default_avatar.png');var _0x2144ca={'where':{'id':_0x1339d0['params']['id']},'attributes':['id',_0x0a9e('0x62')],'raw':!![]};return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x2144ca)['then'](handleEntityNotFound(_0x3c775a,null))[_0x0a9e('0x13')](function(_0x5ed560){if(_0x5ed560){if(!_[_0x0a9e('0x6e')](_0x5ed560[_0x0a9e('0x62')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x5ed560[_0x0a9e('0x62')]))){_0x3450ae=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x5ed560[_0x0a9e('0x62')]);}}return _0x3c775a[_0x0a9e('0x6d')](_0x3450ae);}})[_0x0a9e('0x45')](handleError(_0x3c775a,null));};exports[_0x0a9e('0x70')]=function(_0x98c62c,_0x248368){var _0x5b93dd=path['join'](config[_0x0a9e('0x67')],'server/files/images/avatars/customer_avatar.png');var _0x1d999b={'where':{'id':_0x98c62c[_0x0a9e('0x47')]['id']},'attributes':['id','customerAvatar',_0x0a9e('0x71')],'raw':!![]};return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x1d999b)[_0x0a9e('0x13')](handleEntityNotFound(_0x248368,null))['then'](function(_0x148fd9){if(_0x148fd9){if(!_[_0x0a9e('0x6e')](_0x148fd9[_0x0a9e('0x72')])){if(fs[_0x0a9e('0x6b')](path['join'](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x148fd9[_0x0a9e('0x72')]))&&_0x148fd9['showCustomerAvatar']){_0x5b93dd=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x148fd9['customerAvatar']);}}return _0x248368[_0x0a9e('0x6d')](_0x5b93dd);}})[_0x0a9e('0x45')](handleError(_0x248368,null));};exports[_0x0a9e('0x73')]=function(_0x1a7f58,_0x2394d3){var _0x555780=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/images/avatars/system_avatar.png');var _0x3bab3e={'where':{'id':_0x1a7f58[_0x0a9e('0x47')]['id']},'attributes':['id',_0x0a9e('0x74')],'raw':!![]};return db['ChatWebsite']['find'](_0x3bab3e)['then'](handleEntityNotFound(_0x2394d3,null))[_0x0a9e('0x13')](function(_0x4a70ce){if(_0x4a70ce){if(!_['isNil'](_0x4a70ce[_0x0a9e('0x74')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config['root'],_0x0a9e('0x6f'),_0x4a70ce[_0x0a9e('0x74')]))){_0x555780=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x4a70ce[_0x0a9e('0x74')]);}}return _0x2394d3[_0x0a9e('0x6d')](_0x555780);}})[_0x0a9e('0x45')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x75')]=function(_0x5a1848,_0x43c397){var _0x5526a7=require(_0x0a9e('0x76'));var _0x4093e6=new _0x5526a7();var _0x2097d8=_0x4093e6[_0x0a9e('0x77')](_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x79')])['getResult']();var _0x1a0314={'body':_0x5a1848[_0x0a9e('0x50')],'channel':_0x0a9e('0x7a')};var _0x1af799=[];var _0x51aa2f=[];var _0x2e4887={};var _0x3c9135=![];return db[_0x0a9e('0x7b')][_0x0a9e('0x51')]()[_0x0a9e('0x13')](function(_0x2be526){if(!_0x2be526){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x7e'));}_0x1af799=_[_0x0a9e('0x7f')](_['keys'](_0x2be526),[_0x0a9e('0x80'),_0x0a9e('0x81')]);_0x51aa2f=_[_0x0a9e('0x7f')](_[_0x0a9e('0x49')](_0x2be526),[_0x0a9e('0x80'),_0x0a9e('0x81'),_0x0a9e('0x82'),_0x0a9e('0x83')]);if(_0x5a1848['body']['id']){delete _0x5a1848[_0x0a9e('0x50')]['id'];}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')]['from'])){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')])||_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')]===''){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x85')])){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x86')+_0x51aa2f);}if(!_['includes'](_0x51aa2f,_0x5a1848[_0x0a9e('0x50')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a9e('0x87')+_0x51aa2f);}_0x2e4887[_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x85')]]=_0x5a1848[_0x0a9e('0x50')]['from'];})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x5a1848[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x88')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0a9e('0x89'),'where':_0x2e4887,'limit':0x1,'order':[[_0x0a9e('0x81'),_0x0a9e('0x8a')]]}]},{'model':db['ChatApplication'],'as':_0x0a9e('0x8b')}]});})[_0x0a9e('0x13')](handleEntityNotFound(_0x43c397,null))[_0x0a9e('0x13')](function(_0x4cee8c){if(_0x4cee8c&&_0x4cee8c[_0x0a9e('0x8c')]){_0x1a0314[_0x0a9e('0x8d')]=_0x4cee8c;_0x1a0314[_0x0a9e('0x8e')]=_0x4cee8c['Applications'];_0x1a0314[_0x0a9e('0x8f')]=_0x4cee8c[_0x0a9e('0x8c')];_0x1a0314[_0x0a9e('0x8e')]=_['orderBy'](_0x1a0314['applications'],['priority'],[_0x0a9e('0x90')]);if(_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8b')]){delete _0x1a0314[_0x0a9e('0x8d')]['Applications'];}if(_0x1a0314[_0x0a9e('0x8d')]['List']&&_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8c')][_0x0a9e('0x89')]['length']){return _0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8c')][_0x0a9e('0x89')][0x0];}var _0x580dd6=_[_0x0a9e('0xb')](_0x5a1848['body'],{'firstName':_0x5a1848[_0x0a9e('0x50')]['from'],'ListId':_0x4cee8c[_0x0a9e('0x83')]});_0x580dd6[_0x5a1848['body'][_0x0a9e('0x85')]]=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x91')];return db[_0x0a9e('0x7b')][_0x0a9e('0x4b')](_0x580dd6,{'fields':_0x1af799,'raw':!![]});}})[_0x0a9e('0x13')](handleEntityNotFound(_0x43c397,null))[_0x0a9e('0x13')](function(_0x5acdc9){_0x1a0314[_0x0a9e('0x92')]=_0x5acdc9;var _0x1c9ea2=_0x5a1848['body'][_0x0a9e('0x93')];if(_0x5a1848[_0x0a9e('0x78')]['cf-connecting-ip']){_0x1c9ea2=_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x94')];}else if(_0x5a1848[_0x0a9e('0x78')]['x-forwarded-for']){_0x1c9ea2=_[_0x0a9e('0x95')](_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x96')][_0x0a9e('0x97')](','));}if(_0x5acdc9){var _0x2003bc={'ContactId':_0x5acdc9['id'],'ChatWebsiteId':_0x5a1848[_0x0a9e('0x47')]['id'],'from':(_0x5acdc9[_0x0a9e('0x98')]||'')+'\x20'+(_0x5acdc9[_0x0a9e('0x99')]||''),'customerIp':_0x1c9ea2,'customerPort':_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x9a')]?_0x5a1848['headers'][_0x0a9e('0x9a')]:null,'referer':_0x5a1848['body'][_0x0a9e('0x9b')],'browserName':_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x2b')]&&_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x9d')]?util[_0x0a9e('0x9e')]('%s\x20%s',_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x2b')],_0x2097d8[_0x0a9e('0x9c')]['version']):_0x0a9e('0x9f'),'browserVersion':_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x9d')]||_0x0a9e('0x9f'),'osName':util[_0x0a9e('0x9e')](_0x0a9e('0xa0'),_0x2097d8['os'][_0x0a9e('0x2b')],_0x2097d8['os']['version']),'osVersion':_0x2097d8['os'][_0x0a9e('0x9d')],'deviceModel':_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0x32')]&&_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')]?util[_0x0a9e('0x9e')](_0x0a9e('0xa3'),_0x2097d8['device']['model'],_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')],_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0x31')]):null,'deviceVendor':_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')],'deviceType':_0x2097d8[_0x0a9e('0xa1')]['type'],'formData':JSON[_0x0a9e('0xa4')](_0x5a1848[_0x0a9e('0x50')])};var _0x2d8e91={'ChatWebsiteId':_0x5a1848[_0x0a9e('0x47')]['id'],'closed':![]};if(_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')]){_0x2d8e91[_0x0a9e('0xa5')]=_0x5a1848['body'][_0x0a9e('0xa5')];return db[_0x0a9e('0xa6')][_0x0a9e('0x4a')]({'where':_0x2d8e91})['then'](function(_0x2b8ad4){if(_0x2b8ad4){return[_0x2b8ad4,![]];}_0x2003bc[_0x0a9e('0xa5')]=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')];_0x2003bc['externalUrl']=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa7')];return db[_0x0a9e('0xa6')][_0x0a9e('0x4b')](_0x2003bc)[_0x0a9e('0x13')](function(_0x20c130){return[_0x20c130,!![]];});});}_0x2d8e91[_0x0a9e('0xa8')]=_0x5acdc9['id'];if(_0x5a1848[_0x0a9e('0x50')]['interaction']&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa9')]['id']){_0x2d8e91['id']=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa9')]['id'];return db['ChatInteraction']['find']({'where':_0x2d8e91})[_0x0a9e('0x13')](function(_0x2abe55){if(_0x2abe55){return[_0x2abe55,![]];}return db[_0x0a9e('0xa6')]['create'](_0x2003bc)[_0x0a9e('0x13')](function(_0x40180d){return[_0x40180d,!![]];});});}return db['ChatInteraction'][_0x0a9e('0x4b')](_0x2003bc)['then'](function(_0x35cc2a){return[_0x35cc2a,!![]];});}})['spread'](function(_0x5b42b9,_0x48eaa3){if(_0x5b42b9){_0x3c9135=_0x48eaa3;if(!_0x48eaa3){var _0xad4d10={'from':(_0x1a0314[_0x0a9e('0x92')][_0x0a9e('0x98')]||'')+'\x20'+(_0x1a0314[_0x0a9e('0x92')][_0x0a9e('0x99')]||'')};if(_0x5a1848[_0x0a9e('0x50')]['threadId']&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xaa')]&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')]!=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xaa')]){_0xad4d10[_0x0a9e('0xa5')]=_0x5a1848['body']['messageId'];}return _0x5b42b9[_0x0a9e('0x25')](_0xad4d10);}else{return _0x5b42b9;}}})['then'](function(_0x29537a){_0x1a0314[_0x0a9e('0xa9')]=_0x29537a[_0x0a9e('0x27')]({'plain':!![]});_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xab')]=_0x3c9135;if(_0x1a0314[_0x0a9e('0xa9')]['created']){if(_0x1a0314[_0x0a9e('0x8d')]['autoclose']){_0x1a0314['applications'][_0x0a9e('0xac')]({'id':0x0,'priority':_0x1a0314['applications'][_0x0a9e('0x38')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x0a9e('0xad')});}}return db['ChatMessage'][_0x0a9e('0x4b')]({'body':_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')],'ChatWebsiteId':_0x5a1848['params']['id'],'ChatInteractionId':_0x29537a['id'],'direction':'in','ContactId':_0x1a0314[_0x0a9e('0x92')]['id'],'AttachmentId':_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xae')]});})['then'](function(_0x5236c9){_0x1a0314[_0x0a9e('0x19')]=_0x5236c9;if(_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xaf')]){return db[_0x0a9e('0xb0')][_0x0a9e('0x4a')]({'attributes':['id',_0x0a9e('0x2b')],'where':{'id':_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xaf')]}})[_0x0a9e('0x13')](function(_0x1020a0){if(_0x1020a0){_0x1a0314['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1020a0[_0x0a9e('0x2b')]+','+(_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0xb1')]||0xa),'interval':_0x0a9e('0xad')});_0x1a0314[_0x0a9e('0xb2')]=!![];}return respondWithRpcPromise(_0x0a9e('0xb3'),_0x0a9e('0xb4'),_0x1a0314);});}return respondWithRpcPromise(_0x0a9e('0xb3'),'startRouting',_0x1a0314);})['then'](function(_0x2869cc){respondWithRpcPromise(_0x0a9e('0xb5'),'EventManager',{'event':_0x0a9e('0x75'),'message':_0x2869cc},client9002);return _0x2869cc;})[_0x0a9e('0x13')](respondWithResult(_0x43c397,null))[_0x0a9e('0x45')](handleError(_0x43c397,null));};exports[_0x0a9e('0xb6')]=function(_0x2bb549,_0x2683ad){var _0x167196,_0x262281,_0x59f8f7;var _0x400800=[];var _0xbd1af3={};var _0x20e191=_0x2bb549['files']||[];var _0x4412a5=[];var _0x261ef8;return db[_0x0a9e('0x7b')][_0x0a9e('0x51')]()[_0x0a9e('0x13')](function(_0x21ada7){if(!_0x21ada7){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x7e'));}_0x400800=_[_0x0a9e('0x7f')](_[_0x0a9e('0x49')](_0x21ada7),[_0x0a9e('0x80'),'updatedAt','CompanyId',_0x0a9e('0x83')]);if(_0x2bb549[_0x0a9e('0x50')]['id']){delete _0x2bb549[_0x0a9e('0x50')]['id'];}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)['send'](new db[(_0x0a9e('0x7c'))]['ValidationError'](_0x0a9e('0x84')));}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')])||_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')]===''){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0xb7')));}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0xb8')])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db['Sequelize']['ValidationError'](_0x0a9e('0xb9')+_0x400800));}if(!_[_0x0a9e('0xba')](_0x400800,_0x2bb549['body']['mapKeyOffline'])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db[(_0x0a9e('0x7c'))]['ValidationError'](_0x0a9e('0xbb')+_0x400800));}_0xbd1af3[_0x2bb549['body'][_0x0a9e('0xb8')]]=_0x2bb549['body'][_0x0a9e('0x91')];})['then'](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x2bb549[_0x0a9e('0x47')]['id']},'include':[{'model':db['CmList'],'as':_0x0a9e('0x8c')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x0a9e('0x13')](handleEntityNotFound(_0x2683ad,null))[_0x0a9e('0x13')](function(_0x3c691f){if(_0x3c691f&&_0x3c691f[_0x0a9e('0x8c')]){_0x262281=_0x3c691f;var _0x1d51fd=_[_0x0a9e('0xb')](_0x2bb549[_0x0a9e('0x50')],{'firstName':_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')],'phone':_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')],'ListId':_0x3c691f[_0x0a9e('0x83')]});_0x1d51fd[_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0xb8')]]=_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')];return db[_0x0a9e('0x7b')][_0x0a9e('0xbc')]({'where':_0xbd1af3,'defaults':_0x1d51fd});}})[_0x0a9e('0xbd')](function(_0x51a987){if(_0x51a987){_0x59f8f7=_0x51a987;var _0x233e48=fs[_0x0a9e('0xbe')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x54658d=ejs[_0x0a9e('0xbf')](_0x233e48,{'body':_['toPairs'](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')]),'bodyTitle':_0x262281[_0x0a9e('0xc0')]});return db[_0x0a9e('0xc1')][_0x0a9e('0x4b')]({'body':_0x54658d,'plainBody':htmlToText[_0x0a9e('0xc2')](_0x54658d),'ContactId':_0x51a987['id'],'ChatWebsiteId':_0x262281['id']});}})[_0x0a9e('0x13')](function(_0x1cc73e){_0x261ef8=_0x1cc73e;if(_0x20e191[_0x0a9e('0x38')]){var _0x6b948a=_0x20e191['map'](function(_0x283c59){return{'name':_0x283c59['originalname'],'basename':_0x283c59[_0x0a9e('0x60')],'type':_0x283c59['mimetype'],'ChatOfflineMessageId':_0x1cc73e['id']};});_0x4412a5=_0x6b948a[_0x0a9e('0x2e')](_0x2c5385=>{var _0x216791={'filename':_0x2c5385['name'],'path':path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server','files',_0x0a9e('0xc3'),_0x0a9e('0xc4'),_0x2c5385[_0x0a9e('0xc5')])};return _0x216791;});if(!_0x262281['openNewInteraction']){return db['sequelize']['transaction'](function(_0x374964){return db[_0x0a9e('0xc6')][_0x0a9e('0xc7')](_0x6b948a,{'transaction':_0x374964});});}}})[_0x0a9e('0x13')](function(){if(_0x261ef8){_0x167196=_0x261ef8;return db[_0x0a9e('0xc8')][_0x0a9e('0x56')]({'where':{'active':!![]},'include':[{'model':db[_0x0a9e('0xc9')],'as':_0x0a9e('0xca'),'raw':!![],'include':[{'model':db[_0x0a9e('0xcb')],'as':_0x0a9e('0xcb'),'raw':!![]}]}]});}})[_0x0a9e('0x13')](function(_0x2f4de1){if(_0x2f4de1&&_0x2f4de1[_0x0a9e('0xca')]&&_0x262281[_0x0a9e('0xcc')]&&_0x262281[_0x0a9e('0xcd')]){var _0x1a74c4=_0x2f4de1[_0x0a9e('0xce')]();return respondWithRpcPromise(_0x0a9e('0xcf'),'sendMail',{'account':_0x1a74c4,'message':{'from':util[_0x0a9e('0x9e')](_0x0a9e('0xd0'),_0x2f4de1[_0x0a9e('0x2b')],_0x2f4de1[_0x0a9e('0xd1')]||_0x2f4de1[_0x0a9e('0xca')][_0x0a9e('0x4c')]),'to':_0x262281['forwardOfflineAddress'],'subject':_0x262281[_0x0a9e('0xd2')],'html':_0x167196[_0x0a9e('0x50')],'attachments':_0x4412a5}},client9003)[_0x0a9e('0x13')](function(){return _0x167196;})[_0x0a9e('0x45')](function(_0x37390b){logger[_0x0a9e('0x18')](_0x37390b);});}})[_0x0a9e('0x13')](function(){if(_0x262281&&_0x262281[_0x0a9e('0xd3')]&&_0x262281[_0x0a9e('0xd4')]){var _0x541af6=[];if(_0x20e191['length']){_0x541af6=_0x20e191[_0x0a9e('0x2e')](function(_0x3a0b30){return{'name':_0x3a0b30['originalname'],'basename':_0x3a0b30[_0x0a9e('0x60')],'type':_0x3a0b30[_0x0a9e('0xd5')],'ChatOfflineMessageId':_0x261ef8['id']};});}var _0x4c8d75;if(!_[_0x0a9e('0x6e')](_0x262281['subjectOffline'])){var _0x3468a4=_[_0x0a9e('0x2e')](_0x2bb549['body'],function(_0x27a41c){return _0x27a41c;});var _0x31ab12=_['toPairsIn'](_0x3468a4)[0x0];var _0x197d65=_[_0x0a9e('0xd6')](_0x31ab12,function(_0x53ad2b){return _0x53ad2b;});_0x4c8d75=_0x197d65[0x1][_0x262281[_0x0a9e('0xd7')]];}var _0x237994={'from':_0x59f8f7[_0x0a9e('0xd1')],'firstName':_0x59f8f7[_0x0a9e('0x98')],'lastName':_0x59f8f7[_0x0a9e('0x99')],'mapKey':_0x0a9e('0xd1'),'message':{'from':_0x59f8f7['email'],'to':_0x262281[_0x0a9e('0xc8')][_0x0a9e('0xd1')],'cc':'','subject':_['isNil'](_0x4c8d75)?_0x262281[_0x0a9e('0xd2')]:_0x4c8d75,'messageId':'','sentAt':new Date(),'attach':_0x541af6[_0x0a9e('0x38')],'attachments':_0x541af6,'originChannel':_0x0a9e('0xd8'),'ChatWebsiteId':_0x262281['id'],'ChatOfflineMessageId':_0x167196['id'],'originTo':_0x262281[_0x0a9e('0xc8')][_0x0a9e('0xd1')]},'body':_0x167196[_0x0a9e('0x50')]};var _0x368a12={'account':{'id':_0x262281['MailAccountId']},'body':_0x237994,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x368a12,client9001)['then'](function(){return _0x167196;})[_0x0a9e('0x45')](function(_0x23ef4e){logger['error'](_0x23ef4e);});}return;})['then'](function(){if(_0x167196){return _0x167196;}})[_0x0a9e('0x13')](respondWithResult(_0x2683ad,null))['catch'](function(_0x41600e){logger[_0x0a9e('0x18')](_0x0a9e('0x45'),_0x41600e);for(var _0x175c97 of _0x20e191){var _0x336518=path[_0x0a9e('0x66')](config['root'],_0x0a9e('0xd9'),_0x0a9e('0xda'),'attachments',_0x0a9e('0xc4'),_0x175c97[_0x0a9e('0x60')]);fs_extra[_0x0a9e('0xdb')](_0x336518)[_0x0a9e('0x45')](function(_0x1282da){logger[_0x0a9e('0x18')](_0x0a9e('0xdc'),_0x336518,_0x1282da);});}});};exports['addInteraction']=function(_0x331216,_0x508395){return db[_0x0a9e('0xa6')][_0x0a9e('0x4a')]({'where':{'id':_0x331216['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x508395,null))[_0x0a9e('0x13')](function(_0x5061e5){if(_0x5061e5){return _0x5061e5[_0x0a9e('0xdd')](_0x331216['body'][_0x0a9e('0x5e')],_[_0x0a9e('0xde')](_0x331216['body'],[_0x0a9e('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x508395,null))[_0x0a9e('0x45')](handleError(_0x508395,null));};exports[_0x0a9e('0xdf')]=function(_0x732141,_0x37ef45){var _0x288127={'raw':![],'where':{}};var _0x26d010={};var _0xa45906={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x732141[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x37ef45,null))[_0x0a9e('0x13')](function(_0x38e256){if(_0x38e256){_0x26d010['model']=_[_0x0a9e('0x49')](db['ChatInteraction']['rawAttributes']);_0x26d010[_0x0a9e('0x33')]=_['keys'](_0x732141[_0x0a9e('0x33')]);_0x26d010[_0x0a9e('0x34')]=_['intersection'](_0x26d010[_0x0a9e('0x32')],_0x26d010[_0x0a9e('0x33')]);_0x288127[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x26d010[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x732141[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x288127[_0x0a9e('0x36')]=_0x288127['attributes'][_0x0a9e('0x38')]?_0x288127[_0x0a9e('0x36')]:_0x26d010[_0x0a9e('0x32')];if(!_0x732141[_0x0a9e('0x33')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x288127[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x732141['query'][_0x0a9e('0x21')]);_0x288127[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x732141['query'][_0x0a9e('0x1f')]);}_0x288127['order']=qs[_0x0a9e('0x3b')](_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x288127[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x732141[_0x0a9e('0x33')],_0x26d010['filters']));_0x288127[_0x0a9e('0x3c')][_0x0a9e('0x53')]=_0x38e256['id'];if(_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x288127[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x288127[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x288127[_0x0a9e('0x36')],function(_0x4712c9){var _0x4542d3={};_0x4542d3[_0x4712c9]={'$like':'%'+_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x4542d3;})});}_0x288127=_[_0x0a9e('0x3f')]({},_0x288127,_0x732141[_0x0a9e('0x41')]);return db[_0x0a9e('0xa6')][_0x0a9e('0x22')]({'where':_0x288127[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x611e46){_0xa45906[_0x0a9e('0x22')]=_0x611e46;if(_0x732141[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x288127['include']=[{'model':db[_0x0a9e('0x7b')],'as':_0x0a9e('0xe0'),'required':![]},{'model':db[_0x0a9e('0xb0')],'as':'Owner','attributes':[_0x0a9e('0x2b'),'fullname',_0x0a9e('0xe1')],'required':![]},{'model':db[_0x0a9e('0xe2')],'as':_0x0a9e('0xe3'),'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0xe4')],'where':_0x732141[_0x0a9e('0x33')][_0x0a9e('0xe5')]?{'id':_0x732141[_0x0a9e('0x33')]['tag']}:undefined,'required':_0x732141[_0x0a9e('0x33')][_0x0a9e('0xe5')]?!![]:![]}];}return db['ChatInteraction'][_0x0a9e('0x44')](_0x288127);})[_0x0a9e('0x13')](function(_0x579bb0){_0xa45906['rows']=_0x579bb0;return _0xa45906;});}})[_0x0a9e('0x13')](respondWithFilteredResult(_0x37ef45,_0x288127))[_0x0a9e('0x45')](handleError(_0x37ef45,null));};function iftimePromise(_0x315299,_0x1bf053){return respondWithRpcPromise('Command',_0x0a9e('0xe6'),{'command':_0x1bf053[_0x0a9e('0xe7')]?util[_0x0a9e('0x9e')](_0x0a9e('0xe8'),_0x315299[_0x0a9e('0xe9')],_0x1bf053['timezone']):util[_0x0a9e('0x9e')](_0x0a9e('0xea'),_0x315299['interval'])},client9002)[_0x0a9e('0x13')](function(_0x2d20a0){var _0x38284a=_0x2d20a0&&_0x2d20a0['indexOf']('true')>=0x0?!![]:![];logger[_0x0a9e('0x14')](_0x0a9e('0xeb'),_0x1bf053['id'],_0x315299['id'],_0x315299[_0x0a9e('0xe9')],_0x38284a?_0x0a9e('0xec'):_0x0a9e('0xed'),_0x1bf053[_0x0a9e('0xe7')]?_0x1bf053[_0x0a9e('0xe7')]:_0x0a9e('0xee'));return _0x38284a;})['catch'](function(_0x5cc8cb){logger[_0x0a9e('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1bf053['id'],_0x315299['id'],_0x315299[_0x0a9e('0xe9')],util[_0x0a9e('0xef')](_0x5cc8cb,{'showHidden':![],'depth':null}),_0x1bf053[_0x0a9e('0xe7')]?_0x1bf053[_0x0a9e('0xe7')]:'No\x20timezone');return![];});}exports[_0x0a9e('0xe6')]=function(_0x43c1d1,_0x546bc9){var _0x10e370=0x0;var _0x5092af=0x0;var _0x2e1de7=![];var _0x30a77e;var _0xd63c87;return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x43c1d1[_0x0a9e('0x47')]['id']},'include':[{'model':db['Interval'],'as':_0x0a9e('0xf0'),'include':[{'model':db['Interval'],'as':_0x0a9e('0xf1'),'attributes':['id',_0x0a9e('0xe9')],'raw':!![]}]}]})[_0x0a9e('0x13')](handleEntityNotFound(_0x546bc9,null))[_0x0a9e('0x13')](function(_0xa244bc){if(_0xa244bc){_0x30a77e=_0xa244bc;return _0xa244bc[_0x0a9e('0xf2')]({'raw':!![]});}})[_0x0a9e('0x13')](function(_0x5bdba6){if(_0x30a77e){if(_0x5bdba6){_0xd63c87=_0x5bdba6;}}return require(_0x0a9e('0xf3'))[_0x0a9e('0x69')]();})[_0x0a9e('0x13')](function(_0x188231){if(_0x188231){_0x5092af=_0x188231[_0x0a9e('0xf4')];_0x2e1de7=_0x188231['custom'];}})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0xa6')]['count']({'where':{'closed':![]}});})['then'](function(_0x2240ea){_0x10e370=_0x2240ea;if(_0x5092af&&_0x2240ea>_0x5092af){return db[_0x0a9e('0xf5')][_0x0a9e('0x56')]({'where':{'id':0x1}})[_0x0a9e('0x13')](function(_0x380539){if(_0x380539){_0x380539[_0x0a9e('0xf6')]('chatLicenseExceeded');}});}})[_0x0a9e('0x13')](function(){if(_0x30a77e[_0x0a9e('0xf0')]&&_0x30a77e[_0x0a9e('0xf0')]['Intervals']){var _0x294e90=[];for(var _0x1969e3=0x0;_0x1969e3<_0x30a77e[_0x0a9e('0xf0')][_0x0a9e('0xf1')]['length'];_0x1969e3++){var _0x5d4935=_0x30a77e[_0x0a9e('0xf0')][_0x0a9e('0xf1')][_0x1969e3][_0x0a9e('0x27')]({'plain':!![]});_0x294e90[_0x0a9e('0xac')](iftimePromise(_0x5d4935,_0x30a77e));}return BPromise[_0x0a9e('0xf7')](_0x294e90)[_0x0a9e('0x13')](function(_0x371943){return _[_0x0a9e('0xf8')](_0x371943);});}else{return!![];}})['then'](function(_0x17187c){var _0x4be017=fs[_0x0a9e('0xbe')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/chat/iframe.ejs'),'utf8');var _0x462ecd={'remote':_0x30a77e['remote'],'query':querystring[_0x0a9e('0xa4')](_['merge'](_0x30a77e['get']({'plain':!![]}),{'customerIp':_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0x96')]||_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0xf9')]||_0x43c1d1[_0x0a9e('0xfa')][_0x0a9e('0xfb')]||_0x43c1d1['ip'],'referer':_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0x9b')],'openedInteractions':_0x10e370,'maxInteractions':_0x5092af,'virtual':_0x2e1de7[_0x0a9e('0xf4')],'online':_0x17187c,'custom':_0x2e1de7}))[_0x0a9e('0xfc')](/'/g,'\x5c\x27')};_0x546bc9[_0x0a9e('0x2c')](ejs[_0x0a9e('0xbf')](Mustache[_0x0a9e('0xbf')](_0x4be017,_0x462ecd),{'proactiveActions':_0xd63c87,'alignment':_0x30a77e['alignment'],'verticalAlignment':_0x30a77e['verticalAlignment'],'div_color':_0x30a77e[_0x0a9e('0xe4')],'labelText':_0x30a77e['labelText'],'text_color':_0x30a77e[_0x0a9e('0xfd')],'button_color':_0x30a77e[_0x0a9e('0xfe')],'background_color':_0x30a77e[_0x0a9e('0xff')],'hideWhenOffline':_0x30a77e['hideWhenOffline'],'interval':_0x30a77e['IntervalId']}));})[_0x0a9e('0x45')](handleError(_0x546bc9,null));};exports[_0x0a9e('0x100')]=function(_0x2c316b,_0x142c65){var _0x193e3b=_0x2c316b[_0x0a9e('0x47')]['id'];var _0x36e428=_0x2c316b['body'];var _0x12984a=0xc8;var _0x5799a6=null;return db[_0x0a9e('0x101')][_0x0a9e('0x102')]({'isolationLevel':db['sequelize'][_0x0a9e('0x103')][_0x0a9e('0x104')][_0x0a9e('0x105')]},function(_0x4524b8){return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x193e3b},'transaction':_0x4524b8})['then'](function(_0x475bcd){if(_0x475bcd){return db[_0x0a9e('0x106')][_0x0a9e('0x26')]({'where':{'ChatWebsiteId':_0x193e3b},'transaction':_0x4524b8})['then'](function(){var _0x857983=_[_0x0a9e('0x2e')](_0x36e428,function(_0x24dc3f){_0x24dc3f['ChatWebsiteId']=_0x193e3b;return _0x24dc3f;});return db[_0x0a9e('0x106')][_0x0a9e('0xc7')](_0x857983,{'transaction':_0x4524b8});});}else{_0x12984a=0x194;_0x5799a6=[];}});})[_0x0a9e('0x13')](function(){if(_0x12984a!==0x194){return db[_0x0a9e('0x106')][_0x0a9e('0x107')]({'where':{'ChatWebsiteId':_0x193e3b},'order':_0x0a9e('0x108')})['then'](function(_0x483aed){_0x5799a6=_0x483aed;});}})[_0x0a9e('0x45')](function(_0x1e01af){_0x12984a=0x1f4;logger['error'](_0x1e01af[_0x0a9e('0x2a')]);if(_0x1e01af[_0x0a9e('0x2b')]){delete _0x1e01af[_0x0a9e('0x2b')];}_0x5799a6=_0x1e01af;})[_0x0a9e('0x109')](function(){if(_0x5799a6===null){_0x142c65[_0x0a9e('0x1b')](_0x12984a);}else{if(_0x12984a===0x1f4){_0x142c65[_0x0a9e('0x1d')](_0x12984a)['send'](_0x5799a6);}else{_0x142c65[_0x0a9e('0x1d')](_0x12984a)[_0x0a9e('0x1e')](_0x5799a6);}}});};exports[_0x0a9e('0x10a')]=function(_0x4edb79,_0x45c6ce){var _0x4532de={};var _0x1747ab={};var _0x3afafa;var _0x5beea6;return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x4edb79[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x45c6ce,null))['then'](function(_0x3d75c9){if(_0x3d75c9){_0x3afafa=_0x3d75c9;_0x1747ab[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0x106')][_0x0a9e('0x30')]);_0x1747ab[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x4edb79[_0x0a9e('0x33')]);_0x1747ab['filters']=_['intersection'](_0x1747ab[_0x0a9e('0x32')],_0x1747ab[_0x0a9e('0x33')]);_0x4532de['attributes']=_[_0x0a9e('0x35')](_0x1747ab['model'],qs[_0x0a9e('0x37')](_0x4edb79[_0x0a9e('0x33')]['fields']));_0x4532de[_0x0a9e('0x36')]=_0x4532de[_0x0a9e('0x36')]['length']?_0x4532de[_0x0a9e('0x36')]:_0x1747ab[_0x0a9e('0x32')];_0x4532de[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x4532de[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x3d')](_0x4edb79[_0x0a9e('0x33')],_0x1747ab[_0x0a9e('0x34')]));if(_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x4532de[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x4532de['where'],{'$or':_['map'](_0x4532de[_0x0a9e('0x36')],function(_0x14c3f1){var _0x1e6bba={};_0x1e6bba[_0x14c3f1]={'$like':'%'+_0x4edb79['query']['filter']+'%'};return _0x1e6bba;})});}_0x4532de=_[_0x0a9e('0x3f')]({},_0x4532de,_0x4edb79['options']);return _0x3afafa[_0x0a9e('0x10a')](_0x4532de);}})[_0x0a9e('0x13')](function(_0x112789){if(_0x112789){_0x5beea6=_0x112789[_0x0a9e('0x38')];if(!_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x4532de[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x4edb79['query']['limit']);_0x4532de[_0x0a9e('0x1f')]=qs['offset'](_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x3afafa[_0x0a9e('0x10a')](_0x4532de);}})[_0x0a9e('0x13')](function(_0x4ad6fc){if(_0x4ad6fc){return _0x4ad6fc?{'count':_0x5beea6,'rows':_0x4ad6fc}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x45c6ce,null))[_0x0a9e('0x45')](handleError(_0x45c6ce,null));};exports[_0x0a9e('0x10b')]=function(_0x5174c5,_0x1ebf20){return db[_0x0a9e('0x10c')][_0x0a9e('0x4a')]({'where':{'id':_0x5174c5['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x1ebf20,null))[_0x0a9e('0x13')](function(_0x459ab7){if(_0x459ab7){return _0x459ab7[_0x0a9e('0x10b')](_0x5174c5[_0x0a9e('0x50')][_0x0a9e('0x5e')],_['omit'](_0x5174c5['body'],[_0x0a9e('0x5e'),'id'])||{});}})[_0x0a9e('0x13')](respondWithResult(_0x1ebf20,null))[_0x0a9e('0x45')](handleError(_0x1ebf20,null));};exports['getProactiveActions']=function(_0x5990e1,_0x2a5c2a){var _0x304a57={};var _0x2302a2={};var _0x5f5963;var _0x4b51ff;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x5990e1[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2a5c2a,null))[_0x0a9e('0x13')](function(_0x4f0bca){if(_0x4f0bca){_0x5f5963=_0x4f0bca;_0x2302a2[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x10d')][_0x0a9e('0x30')]);_0x2302a2['query']=_[_0x0a9e('0x49')](_0x5990e1['query']);_0x2302a2[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2302a2[_0x0a9e('0x32')],_0x2302a2[_0x0a9e('0x33')]);_0x304a57[_0x0a9e('0x36')]=_['intersection'](_0x2302a2[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x5990e1[_0x0a9e('0x33')]['fields']));_0x304a57[_0x0a9e('0x36')]=_0x304a57['attributes'][_0x0a9e('0x38')]?_0x304a57[_0x0a9e('0x36')]:_0x2302a2[_0x0a9e('0x32')];_0x304a57['order']=qs[_0x0a9e('0x3b')](_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x304a57[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x5990e1['query'],_0x2302a2[_0x0a9e('0x34')]));if(_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x304a57[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x304a57[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x304a57[_0x0a9e('0x36')],function(_0x597e99){var _0x2dc0de={};_0x2dc0de[_0x597e99]={'$like':'%'+_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2dc0de;})});}_0x304a57=_[_0x0a9e('0x3f')]({},_0x304a57,_0x5990e1['options']);return _0x5f5963[_0x0a9e('0xf2')](_0x304a57);}})['then'](function(_0xf81cc){if(_0xf81cc){_0x4b51ff=_0xf81cc[_0x0a9e('0x38')];if(!_0x5990e1[_0x0a9e('0x33')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x304a57[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x5990e1[_0x0a9e('0x33')]['limit']);_0x304a57[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x5f5963[_0x0a9e('0xf2')](_0x304a57);}})[_0x0a9e('0x13')](function(_0xbdc88e){if(_0xbdc88e){return _0xbdc88e?{'count':_0x4b51ff,'rows':_0xbdc88e}:null;}})['then'](respondWithResult(_0x2a5c2a,null))[_0x0a9e('0x45')](handleError(_0x2a5c2a,null));};exports[_0x0a9e('0x10e')]=function(_0x337c29,_0xa42055){var _0x52cdf4=_0x337c29[_0x0a9e('0x33')]['online']===_0x0a9e('0x10f')?_0x0a9e('0x110'):_0x0a9e('0x111');return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'attributes':['id',_0x52cdf4],'where':{'id':_0x337c29[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xa42055,null))['then'](function(_0x173f03){if(_0x173f03){var _0x4ac7f1=_0x173f03[_0x52cdf4];var _0x382412=_0x4ac7f1&&_0x4ac7f1[_0x0a9e('0x112')]?_0x4ac7f1['items']:[];_0xa42055[_0x0a9e('0x2c')]({'fromKey':_[_0x0a9e('0x6e')](_0x4ac7f1[_0x0a9e('0x113')])?undefined:_0x4ac7f1[_0x0a9e('0x113')],'count':_0x382412['length'],'rows':_0x382412});}})[_0x0a9e('0x45')](handleError(_0xa42055,null));};exports[_0x0a9e('0x114')]=function(_0x5a75d9,_0xcc859d){var _0x4a396c={'raw':![],'where':{}};var _0x58cb87={};var _0x50e7ec={'count':0x0,'rows':[]};return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x5a75d9['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xcc859d,null))[_0x0a9e('0x13')](function(_0x5ef7e8){if(_0x5ef7e8){_0x58cb87[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0xc1')][_0x0a9e('0x30')]);_0x58cb87[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x5a75d9[_0x0a9e('0x33')]);_0x58cb87['filters']=_[_0x0a9e('0x35')](_0x58cb87['model'],_0x58cb87[_0x0a9e('0x33')]);_0x4a396c[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x58cb87[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x5a75d9[_0x0a9e('0x33')]['fields']));_0x4a396c[_0x0a9e('0x36')]=_0x4a396c[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x4a396c['attributes']:_0x58cb87[_0x0a9e('0x32')];if(!_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x4a396c[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x4a396c[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x4a396c[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x4a396c['where']=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x5a75d9[_0x0a9e('0x33')],_0x58cb87['filters']));_0x4a396c[_0x0a9e('0x3c')][_0x0a9e('0x53')]=_0x5ef7e8['id'];if(_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x4a396c['where']=_[_0x0a9e('0x3f')](_0x4a396c[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x4a396c[_0x0a9e('0x36')],function(_0x4e8eb9){var _0x2b263b={};_0x2b263b[_0x4e8eb9]={'$like':'%'+_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2b263b;})});}_0x4a396c=_[_0x0a9e('0x3f')]({},_0x4a396c,_0x5a75d9['options']);return db['ChatOfflineMessage'][_0x0a9e('0x22')]({'where':_0x4a396c[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x353960){_0x50e7ec[_0x0a9e('0x22')]=_0x353960;if(_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x4a396c[_0x0a9e('0x43')]=[{'all':!![]}];}else{_0x4a396c[_0x0a9e('0x43')]=[{'model':db[_0x0a9e('0x7b')],'as':_0x0a9e('0xe0'),'required':![]},{'model':db[_0x0a9e('0xc6')],'as':_0x0a9e('0x115'),'required':![]}];}return db[_0x0a9e('0xc1')]['findAll'](_0x4a396c);})[_0x0a9e('0x13')](function(_0x5ce227){_0x50e7ec[_0x0a9e('0x58')]=_0x5ce227;return _0x50e7ec;});}})['then'](respondWithFilteredResult(_0xcc859d,_0x4a396c))['catch'](handleError(_0xcc859d,null));};exports[_0x0a9e('0x116')]=function(_0x51ec16,_0x3d2007){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x51ec16[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d2007,null))['then'](function(_0x2ad86f){if(_0x2ad86f){return _0x2ad86f[_0x0a9e('0x116')](_0x51ec16[_0x0a9e('0x50')][_0x0a9e('0x5e')],_['omit'](_0x51ec16[_0x0a9e('0x50')],[_0x0a9e('0x5e'),'id'])||{})[_0x0a9e('0xbd')](function(_0x25f5fa){for(var _0x193ef7=0x0;_0x193ef7<_0x51ec16['body']['ids'][_0x0a9e('0x38')];_0x193ef7+=0x1){socket[_0x0a9e('0x117')](_0x0a9e('0x118'),{'UserId':Number(_0x51ec16[_0x0a9e('0x50')][_0x0a9e('0x5e')][_0x193ef7]),'ChatWebsiteId':Number(_0x51ec16[_0x0a9e('0x47')]['id'])});}return _0x25f5fa;});}})[_0x0a9e('0x13')](respondWithResult(_0x3d2007,null))['catch'](handleError(_0x3d2007,null));};exports[_0x0a9e('0x119')]=function(_0xd73712,_0x173daf){return db['ChatWebsite']['find']({'where':{'id':_0xd73712['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x173daf,null))[_0x0a9e('0x13')](function(_0x5448ee){if(_0x5448ee){return _0x5448ee[_0x0a9e('0x119')](_0xd73712[_0x0a9e('0x33')][_0x0a9e('0x5e')])['then'](function(){if(_['isArray'](_0xd73712[_0x0a9e('0x33')][_0x0a9e('0x5e')])){for(var _0xf10a48=0x0;_0xf10a48<_0xd73712[_0x0a9e('0x33')]['ids'][_0x0a9e('0x38')];_0xf10a48+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xd73712[_0x0a9e('0x33')]['ids'][_0xf10a48]),'ChatWebsiteId':Number(_0xd73712[_0x0a9e('0x47')]['id'])});}}else{socket[_0x0a9e('0x117')](_0x0a9e('0x11a'),{'UserId':Number(_0xd73712['query'][_0x0a9e('0x5e')]),'ChatWebsiteId':Number(_0xd73712[_0x0a9e('0x47')]['id'])});}});}})[_0x0a9e('0x13')](respondWithStatusCode(_0x173daf,null))['catch'](handleError(_0x173daf,null));};exports['getAgents']=function(_0x3aa901,_0xb3e9cb){var _0x34b05f={};var _0x21fcaa={};var _0x1c3b0e;var _0x1966dd;return db['ChatWebsite']['findOne']({'where':{'id':_0x3aa901[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xb3e9cb,null))['then'](function(_0x539f84){if(_0x539f84){_0x1c3b0e=_0x539f84;_0x21fcaa['model']=_['keys'](db['User']['rawAttributes']);_0x21fcaa[_0x0a9e('0x33')]=_['keys'](_0x3aa901[_0x0a9e('0x33')]);_0x21fcaa[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x21fcaa[_0x0a9e('0x32')],_0x21fcaa[_0x0a9e('0x33')]);_0x34b05f[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x21fcaa['model'],qs[_0x0a9e('0x37')](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x34b05f[_0x0a9e('0x36')]=_0x34b05f[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x34b05f[_0x0a9e('0x36')]:_0x21fcaa[_0x0a9e('0x32')];_0x34b05f[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x3aa901[_0x0a9e('0x33')]['sort']);_0x34b05f[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_['pick'](_0x3aa901[_0x0a9e('0x33')],_0x21fcaa['filters']));if(_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x34b05f['where']=_['merge'](_0x34b05f[_0x0a9e('0x3c')],{'$or':_['map'](_0x34b05f[_0x0a9e('0x36')],function(_0xa8c784){var _0x132f85={};_0x132f85[_0xa8c784]={'$like':'%'+_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x132f85;})});}_0x34b05f=_['merge']({},_0x34b05f,_0x3aa901[_0x0a9e('0x41')]);return _0x1c3b0e['getAgents'](_0x34b05f);}})['then'](function(_0x398a88){if(_0x398a88){_0x1966dd=_0x398a88[_0x0a9e('0x38')];if(!_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x34b05f['limit']=qs[_0x0a9e('0x21')](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x34b05f[_0x0a9e('0x1f')]=qs['offset'](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x1c3b0e['getAgents'](_0x34b05f);}})[_0x0a9e('0x13')](function(_0x36d8a1){if(_0x36d8a1){return _0x36d8a1?{'count':_0x1966dd,'rows':_0x36d8a1}:null;}})[_0x0a9e('0x13')](respondWithResult(_0xb3e9cb,null))[_0x0a9e('0x45')](handleError(_0xb3e9cb,null));}; \ No newline at end of file +var _0xa9e0=['fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','bluebird','mustache','util','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','map','ChatWebsite','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','keys','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','file','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','existsSync','server/files/images/logos/','download','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications','List','account','applications','list','asc','from','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','push','*,*,*,*','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','fromString','attachments','offline-chat','basename','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','mapValues','subjectOffline','Chat','server','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','all','some','x-real-ip','connection','remoteAddress','replace','textColor','color_button','backgroundColor','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items'];(function(_0x207b7f,_0x1d1323){var _0x2d6d8e=function(_0x40156f){while(--_0x40156f){_0x207b7f['push'](_0x207b7f['shift']());}};_0x2d6d8e(++_0x1d1323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var BPromise=require(_0x0a9e('0x0'));var Mustache=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x3'));var _=require('lodash');var querystring=require(_0x0a9e('0x4'));var Redis=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var db=require(_0x0a9e('0x9'))['db'];config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0a9e('0xd')](socket);var htmlToText=require(_0x0a9e('0xe'));var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x10')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client'][_0x0a9e('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x36471c,_0xd5b662,_0x26d672,_0x32d742){return new BPromise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_0x32d742||client;return _0x4283ce[_0x0a9e('0x12')](_0x36471c,_0x26d672)[_0x0a9e('0x13')](function(_0x281129){logger[_0x0a9e('0x14')](_0x0a9e('0x15'),_0xd5b662,'request\x20sent');logger[_0x0a9e('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xd5b662,_0x0a9e('0x17'),JSON['stringify'](_0x281129));if(_0x281129[_0x0a9e('0x18')]){if(_0x281129[_0x0a9e('0x18')]['code']===0x1f4){logger[_0x0a9e('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xd5b662,_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);return _0x5db4b0(_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);}logger[_0x0a9e('0x18')](_0x0a9e('0x15'),_0xd5b662,_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);return _0x69aeb7(_0x281129[_0x0a9e('0x18')][_0x0a9e('0x19')]);}else{logger[_0x0a9e('0x14')](_0x0a9e('0x15'),_0xd5b662,'request\x20sent');_0x69aeb7(_0x281129[_0x0a9e('0x1a')][_0x0a9e('0x19')]);}})['catch'](function(_0x20f109){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xd5b662,_0x20f109);_0x5db4b0(_0x20f109);});});}function respondWithStatusCode(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0xcc;return function(_0x38e7c4){if(_0x38e7c4){return _0x3a02e1[_0x0a9e('0x1b')](_0x432e56);}return _0x3a02e1['status'](_0x432e56)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xc8;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x1d')](_0x3b45bc)[_0x0a9e('0x1e')](_0x4d00e6);}};}function respondWithFilteredResult(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(_0x59181e){var _0x197ec0=typeof _0x5ea472[_0x0a9e('0x1f')]===_0x0a9e('0x20')&&typeof _0x5ea472[_0x0a9e('0x21')]==='undefined';var _0x384319=_0x59181e['count'];var _0x45a1e7=_0x197ec0?0x0:_0x5ea472['offset'];var _0x1dc186=_0x197ec0?_0x59181e[_0x0a9e('0x22')]:_0x5ea472[_0x0a9e('0x1f')]+_0x5ea472[_0x0a9e('0x21')];var _0x140511;if(_0x1dc186>=_0x384319){_0x1dc186=_0x384319;_0x140511=0xc8;}else{_0x140511=0xce;}_0x16b1ca[_0x0a9e('0x1d')](_0x140511);return _0x16b1ca[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x45a1e7+'-'+_0x1dc186+'/'+_0x384319)['json'](_0x59181e);}return null;};}function saveUpdates(_0x3652a7){return function(_0x468813){if(_0x468813){return _0x468813[_0x0a9e('0x25')](_0x3652a7)[_0x0a9e('0x13')](function(_0x5c877d){return _0x5c877d;});}return null;};}function removeEntity(_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x26')]()[_0x0a9e('0x13')](function(){var _0x58b06f=_0x40e7a3[_0x0a9e('0x27')]({'plain':!![]});var _0x296f41=_0x0a9e('0x28');return db[_0x0a9e('0x29')]['destroy']({'where':{'type':_0x296f41,'resourceId':_0x58b06f['id']}})[_0x0a9e('0x13')](function(){return _0x40e7a3;});})['then'](function(){_0x15b200[_0x0a9e('0x1d')](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x1122db){return function(_0x33bdb7){if(!_0x33bdb7){_0x1122db[_0x0a9e('0x1b')](0x194);}return _0x33bdb7;};}function handleError(_0x5180f1,_0x66c1d2){_0x66c1d2=_0x66c1d2||0x1f4;return function(_0x46f0a5){logger[_0x0a9e('0x18')](_0x46f0a5[_0x0a9e('0x2a')]);if(_0x46f0a5[_0x0a9e('0x2b')]){delete _0x46f0a5[_0x0a9e('0x2b')];}_0x5180f1[_0x0a9e('0x1d')](_0x66c1d2)[_0x0a9e('0x2c')](_0x46f0a5);};}exports['index']=function(_0x44295a,_0x5e7238){var _0x2cc7a0={'include':[{'model':db[_0x0a9e('0x2d')],'as':'mandatoryDispositionPause'}]},_0x14b13f={},_0x2b7e7f={'count':0x0,'rows':[]};var _0x191e91=_[_0x0a9e('0x2e')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')],function(_0x4853b1){return{'name':_0x4853b1['fieldName'],'type':_0x4853b1[_0x0a9e('0x31')]['key']};});_0x14b13f[_0x0a9e('0x32')]=_[_0x0a9e('0x2e')](_0x191e91,_0x0a9e('0x2b'));_0x14b13f[_0x0a9e('0x33')]=_['keys'](_0x44295a[_0x0a9e('0x33')]);_0x14b13f[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x14b13f['model'],_0x14b13f[_0x0a9e('0x33')]);_0x2cc7a0[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x14b13f['model'],qs['fields'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x2cc7a0['attributes']=_0x2cc7a0[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x2cc7a0[_0x0a9e('0x36')]:_0x14b13f[_0x0a9e('0x32')];if(!_0x44295a['query']['hasOwnProperty'](_0x0a9e('0x39'))){_0x2cc7a0[_0x0a9e('0x21')]=qs['limit'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x2cc7a0[_0x0a9e('0x1f')]=qs['offset'](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x2cc7a0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x2cc7a0[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x44295a[_0x0a9e('0x33')],_0x14b13f[_0x0a9e('0x34')]),_0x191e91);if(_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x2cc7a0[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x2cc7a0['where'],{'$or':_['map'](_0x191e91,function(_0x473fdc){if(_0x473fdc[_0x0a9e('0x31')]!==_0x0a9e('0x40')){var _0x315881={};_0x315881[_0x473fdc[_0x0a9e('0x2b')]]={'$like':'%'+_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x315881;}})});}_0x2cc7a0=_[_0x0a9e('0x3f')]({},_0x2cc7a0,_0x44295a[_0x0a9e('0x41')]);var _0x25c6e6={'where':_0x2cc7a0[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2f')]['count'](_0x25c6e6)[_0x0a9e('0x13')](function(_0x138b8b){_0x2b7e7f[_0x0a9e('0x22')]=_0x138b8b;if(_0x44295a[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x2cc7a0[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x44')](_0x2cc7a0);})['then'](function(_0x2e9d90){_0x2b7e7f['rows']=_0x2e9d90;return _0x2b7e7f;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x5e7238,_0x2cc7a0))[_0x0a9e('0x45')](handleError(_0x5e7238,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){var _0x7f6eb1={'raw':![],'where':{'id':_0x562fb4[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x2d')],'as':_0x0a9e('0x48')}]},_0x4774f4={};_0x4774f4[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x4774f4[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x33')]);_0x4774f4[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4774f4[_0x0a9e('0x32')],_0x4774f4[_0x0a9e('0x33')]);_0x7f6eb1['attributes']=_[_0x0a9e('0x35')](_0x4774f4[_0x0a9e('0x32')],qs['fields'](_0x562fb4['query']['fields']));_0x7f6eb1[_0x0a9e('0x36')]=_0x7f6eb1[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x7f6eb1[_0x0a9e('0x36')]:_0x4774f4[_0x0a9e('0x32')];if(_0x562fb4[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x7f6eb1[_0x0a9e('0x43')]=[{'all':!![]}];}_0x7f6eb1=_['merge']({},_0x7f6eb1,_0x562fb4['options']);return db['ChatWebsite'][_0x0a9e('0x4a')](_0x7f6eb1)[_0x0a9e('0x13')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x13')](respondWithResult(_0x14bec2,null))['catch'](handleError(_0x14bec2,null));};exports[_0x0a9e('0x4b')]=function(_0x161aa7,_0x53d113){return db['ChatWebsite'][_0x0a9e('0x4b')](_0x161aa7['body'],{})[_0x0a9e('0x13')](function(_0x4c3845){var _0x2e5e62=_0x161aa7[_0x0a9e('0x4c')][_0x0a9e('0x27')]({'plain':!![]});if(!_0x2e5e62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e5e62[_0x0a9e('0x4d')]===_0x0a9e('0x4c')){var _0x508b47=_0x4c3845['get']({'plain':!![]});var _0x128aa6=_0x0a9e('0x28');return db['UserProfileSection'][_0x0a9e('0x4a')]({'where':{'name':_0x128aa6,'userProfileId':_0x2e5e62['userProfileId']},'raw':!![]})[_0x0a9e('0x13')](function(_0x523cd2){if(_0x523cd2&&_0x523cd2[_0x0a9e('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x508b47['name'],'resourceId':_0x508b47['id'],'type':_0x523cd2[_0x0a9e('0x2b')],'sectionId':_0x523cd2['id']},{})['then'](function(){return _0x4c3845;});}else{return _0x4c3845;}})[_0x0a9e('0x45')](function(_0x65432){logger[_0x0a9e('0x18')](_0x0a9e('0x4f'),_0x65432);throw _0x65432;});}return _0x4c3845;})[_0x0a9e('0x13')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x45')](handleError(_0x53d113,null));};exports[_0x0a9e('0x25')]=function(_0x28d814,_0x4e67ab){if(_0x28d814[_0x0a9e('0x50')]['id']){delete _0x28d814[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x28d814[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x0a9e('0x13')](handleEntityNotFound(_0x4e67ab,null))[_0x0a9e('0x13')](saveUpdates(_0x28d814['body'],null))[_0x0a9e('0x13')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));};exports[_0x0a9e('0x26')]=function(_0x5ba1f9,_0x4b3c1a){return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x5ba1f9['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x13')](removeEntity(_0x4b3c1a,null))[_0x0a9e('0x45')](handleError(_0x4b3c1a,null));};exports[_0x0a9e('0x51')]=function(_0x1cca9f,_0x26d7db){return db['ChatWebsite'][_0x0a9e('0x51')]()['then'](respondWithResult(_0x26d7db,null))[_0x0a9e('0x45')](handleError(_0x26d7db,null));};exports[_0x0a9e('0x52')]=function(_0x51aaf7,_0x5adf8f){if(_0x51aaf7[_0x0a9e('0x50')]['id']){delete _0x51aaf7[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x13')](function(_0x54327c){if(_0x54327c){_0x51aaf7[_0x0a9e('0x50')][_0x0a9e('0x53')]=_0x54327c['id'];return db[_0x0a9e('0x54')][_0x0a9e('0x4b')](_0x51aaf7[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x45')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x55')]=function(_0x281c7d,_0x47bb43){var _0x3528b7={'raw':![],'where':{}};var _0x4f1e60={};var _0x5211e3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x281c7d[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x13')](function(_0xc8c264){if(_0xc8c264){_0x4f1e60[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0x54')][_0x0a9e('0x30')]);_0x4f1e60[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x281c7d[_0x0a9e('0x33')]);_0x4f1e60[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4f1e60[_0x0a9e('0x32')],_0x4f1e60[_0x0a9e('0x33')]);_0x3528b7[_0x0a9e('0x36')]=_['intersection'](_0x4f1e60[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x281c7d[_0x0a9e('0x33')]['fields']));_0x3528b7[_0x0a9e('0x36')]=_0x3528b7[_0x0a9e('0x36')]['length']?_0x3528b7[_0x0a9e('0x36')]:_0x4f1e60[_0x0a9e('0x32')];if(!_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x3528b7['limit']=qs['limit'](_0x281c7d['query'][_0x0a9e('0x21')]);_0x3528b7[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x3528b7[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x281c7d[_0x0a9e('0x33')]['sort']);_0x3528b7[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x281c7d['query'],_0x4f1e60[_0x0a9e('0x34')]));_0x3528b7['where'][_0x0a9e('0x53')]=_0xc8c264['id'];if(_0x281c7d[_0x0a9e('0x33')]['filter']){_0x3528b7[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x3528b7[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x3528b7['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2e9552;})});}_0x3528b7=_['merge']({},_0x3528b7,_0x281c7d[_0x0a9e('0x41')]);return db[_0x0a9e('0x54')][_0x0a9e('0x22')]({'where':_0x3528b7[_0x0a9e('0x3c')]})['then'](function(_0x290d43){_0x5211e3[_0x0a9e('0x22')]=_0x290d43;if(_0x281c7d[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x3528b7[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x54')][_0x0a9e('0x44')](_0x3528b7);})[_0x0a9e('0x13')](function(_0x1a7b03){_0x5211e3[_0x0a9e('0x58')]=_0x1a7b03;return _0x5211e3;});}})[_0x0a9e('0x13')](respondWithFilteredResult(_0x47bb43,_0x3528b7))[_0x0a9e('0x45')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x59')]=function(_0xe0749e,_0x5b35db){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0xe0749e[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b35db,null))[_0x0a9e('0x13')](function(_0x33dda0){if(_0x33dda0){return _0x33dda0[_0x0a9e('0x59')](_0xe0749e[_0x0a9e('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x5b35db,null))[_0x0a9e('0x45')](handleError(_0x5b35db,null));};exports[_0x0a9e('0x5a')]=function(_0x4c54fa,_0x45108c){if(_0x4c54fa['body']['id']){delete _0x4c54fa[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x4c54fa[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x45108c,null))[_0x0a9e('0x13')](function(_0x42b959){if(_0x42b959){_0x4c54fa[_0x0a9e('0x50')][_0x0a9e('0x53')]=_0x42b959['id'];return db[_0x0a9e('0x5b')]['create'](_0x4c54fa[_0x0a9e('0x50')]);}})[_0x0a9e('0x13')](respondWithResult(_0x45108c,null))[_0x0a9e('0x45')](handleError(_0x45108c,null));};exports[_0x0a9e('0x5c')]=function(_0x492543,_0xf51744){var _0xf0db1={'raw':![],'where':{}};var _0x4bf3a5={};var _0x1d6834={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x492543[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xf51744,null))[_0x0a9e('0x13')](function(_0x5af453){if(_0x5af453){_0x4bf3a5['model']=_[_0x0a9e('0x49')](db[_0x0a9e('0x5b')][_0x0a9e('0x30')]);_0x4bf3a5['query']=_[_0x0a9e('0x49')](_0x492543[_0x0a9e('0x33')]);_0x4bf3a5['filters']=_['intersection'](_0x4bf3a5[_0x0a9e('0x32')],_0x4bf3a5['query']);_0xf0db1['attributes']=_['intersection'](_0x4bf3a5[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0xf0db1[_0x0a9e('0x36')]=_0xf0db1[_0x0a9e('0x36')]['length']?_0xf0db1[_0x0a9e('0x36')]:_0x4bf3a5['model'];if(!_0x492543[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0xf0db1[_0x0a9e('0x21')]=qs['limit'](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0xf0db1[_0x0a9e('0x1f')]=qs['offset'](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0xf0db1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0xf0db1[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_['pick'](_0x492543[_0x0a9e('0x33')],_0x4bf3a5[_0x0a9e('0x34')]));_0xf0db1['where'][_0x0a9e('0x53')]=_0x5af453['id'];if(_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0xf0db1['where']=_[_0x0a9e('0x3f')](_0xf0db1['where'],{'$or':_[_0x0a9e('0x2e')](_0xf0db1[_0x0a9e('0x36')],function(_0x558a87){var _0x1f29bd={};_0x1f29bd[_0x558a87]={'$like':'%'+_0x492543[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x1f29bd;})});}_0xf0db1=_[_0x0a9e('0x3f')]({},_0xf0db1,_0x492543[_0x0a9e('0x41')]);return db['CannedAnswer'][_0x0a9e('0x22')]({'where':_0xf0db1[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x30ef6e){_0x1d6834[_0x0a9e('0x22')]=_0x30ef6e;if(_0x492543[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0xf0db1[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x44')](_0xf0db1);})[_0x0a9e('0x13')](function(_0x3754e2){_0x1d6834[_0x0a9e('0x58')]=_0x3754e2;return _0x1d6834;});}})['then'](respondWithFilteredResult(_0xf51744,_0xf0db1))[_0x0a9e('0x45')](handleError(_0xf51744,null));};exports[_0x0a9e('0x5d')]=function(_0x12843d,_0x2ed526){return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x12843d[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2ed526,null))['then'](function(_0x23b447){if(_0x23b447){return _0x23b447['removeAnswers'](_0x12843d[_0x0a9e('0x33')][_0x0a9e('0x5e')]);}})[_0x0a9e('0x13')](respondWithStatusCode(_0x2ed526,null))[_0x0a9e('0x45')](handleError(_0x2ed526,null));};exports['addLogo']=function(_0x3ceba6,_0x4cf72d){_0x3ceba6[_0x0a9e('0x50')][_0x0a9e('0x5f')]=_0x3ceba6['file'][_0x0a9e('0x60')];return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x3ceba6['params']['id']}})['then'](handleEntityNotFound(_0x4cf72d,null))[_0x0a9e('0x13')](saveUpdates(_0x3ceba6[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x4cf72d,null))[_0x0a9e('0x45')](handleError(_0x4cf72d,null));};exports[_0x0a9e('0x61')]=function(_0x2450a8,_0x17793e){_0x2450a8[_0x0a9e('0x50')][_0x0a9e('0x62')]=_0x2450a8['file'][_0x0a9e('0x60')];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x2450a8[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x17793e,null))[_0x0a9e('0x13')](saveUpdates(_0x2450a8[_0x0a9e('0x50')],null))['then'](respondWithResult(_0x17793e,null))[_0x0a9e('0x45')](handleError(_0x17793e,null));};exports[_0x0a9e('0x63')]=function(_0x2791c5,_0x2aa5f2){_0x2791c5[_0x0a9e('0x50')]['customerAvatar']=_0x2791c5['file'][_0x0a9e('0x60')];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x2791c5[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x13')](saveUpdates(_0x2791c5[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports['addSystemAvatar']=function(_0x1889ed,_0x5dfbe2){_0x1889ed[_0x0a9e('0x50')]['systemAvatar']=_0x1889ed[_0x0a9e('0x64')]['filename'];return db['ChatWebsite'][_0x0a9e('0x4a')]({'where':{'id':_0x1889ed[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5dfbe2,null))[_0x0a9e('0x13')](saveUpdates(_0x1889ed[_0x0a9e('0x50')],null))[_0x0a9e('0x13')](respondWithResult(_0x5dfbe2,null))[_0x0a9e('0x45')](handleError(_0x5dfbe2,null));};exports[_0x0a9e('0x65')]=function(_0x5ab0bc,_0x5505f4){var _0x16449b=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x68'));var _0x59303b={'where':{'id':_0x5ab0bc['params']['id']},'attributes':['id',_0x0a9e('0x5f')],'raw':!![]};var _0xadce3d=![];return require('../../config/license/util')[_0x0a9e('0x69')]()[_0x0a9e('0x13')](function(_0xcacabb){if(_0xcacabb){_0xadce3d=_0xcacabb[_0x0a9e('0x6a')];}})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x59303b);})[_0x0a9e('0x13')](handleEntityNotFound(_0x5505f4,null))[_0x0a9e('0x13')](function(_0x16afb3){if(_0x16afb3){if(!_['isNil'](_0x16afb3[_0x0a9e('0x5f')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6c'),_0x16afb3['sitepic']))&&_0xadce3d){_0x16449b=path['join'](config[_0x0a9e('0x67')],_0x0a9e('0x6c'),_0x16afb3[_0x0a9e('0x5f')]);}}return _0x5505f4[_0x0a9e('0x6d')](_0x16449b);}})[_0x0a9e('0x45')](handleError(_0x5505f4,null));};exports['getAvatar']=function(_0x1339d0,_0x3c775a){var _0x3450ae=path['join'](config[_0x0a9e('0x67')],'server/files/images/avatars/default_avatar.png');var _0x2144ca={'where':{'id':_0x1339d0['params']['id']},'attributes':['id',_0x0a9e('0x62')],'raw':!![]};return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x2144ca)['then'](handleEntityNotFound(_0x3c775a,null))[_0x0a9e('0x13')](function(_0x5ed560){if(_0x5ed560){if(!_[_0x0a9e('0x6e')](_0x5ed560[_0x0a9e('0x62')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x5ed560[_0x0a9e('0x62')]))){_0x3450ae=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x5ed560[_0x0a9e('0x62')]);}}return _0x3c775a[_0x0a9e('0x6d')](_0x3450ae);}})[_0x0a9e('0x45')](handleError(_0x3c775a,null));};exports[_0x0a9e('0x70')]=function(_0x98c62c,_0x248368){var _0x5b93dd=path['join'](config[_0x0a9e('0x67')],'server/files/images/avatars/customer_avatar.png');var _0x1d999b={'where':{'id':_0x98c62c[_0x0a9e('0x47')]['id']},'attributes':['id','customerAvatar',_0x0a9e('0x71')],'raw':!![]};return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x1d999b)[_0x0a9e('0x13')](handleEntityNotFound(_0x248368,null))['then'](function(_0x148fd9){if(_0x148fd9){if(!_[_0x0a9e('0x6e')](_0x148fd9[_0x0a9e('0x72')])){if(fs[_0x0a9e('0x6b')](path['join'](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x148fd9[_0x0a9e('0x72')]))&&_0x148fd9['showCustomerAvatar']){_0x5b93dd=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x148fd9['customerAvatar']);}}return _0x248368[_0x0a9e('0x6d')](_0x5b93dd);}})[_0x0a9e('0x45')](handleError(_0x248368,null));};exports[_0x0a9e('0x73')]=function(_0x1a7f58,_0x2394d3){var _0x555780=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/images/avatars/system_avatar.png');var _0x3bab3e={'where':{'id':_0x1a7f58[_0x0a9e('0x47')]['id']},'attributes':['id',_0x0a9e('0x74')],'raw':!![]};return db['ChatWebsite']['find'](_0x3bab3e)['then'](handleEntityNotFound(_0x2394d3,null))[_0x0a9e('0x13')](function(_0x4a70ce){if(_0x4a70ce){if(!_['isNil'](_0x4a70ce[_0x0a9e('0x74')])){if(fs[_0x0a9e('0x6b')](path[_0x0a9e('0x66')](config['root'],_0x0a9e('0x6f'),_0x4a70ce[_0x0a9e('0x74')]))){_0x555780=path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],_0x0a9e('0x6f'),_0x4a70ce[_0x0a9e('0x74')]);}}return _0x2394d3[_0x0a9e('0x6d')](_0x555780);}})[_0x0a9e('0x45')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x75')]=function(_0x5a1848,_0x43c397){var _0x5526a7=require(_0x0a9e('0x76'));var _0x4093e6=new _0x5526a7();var _0x2097d8=_0x4093e6[_0x0a9e('0x77')](_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x79')])['getResult']();var _0x1a0314={'body':_0x5a1848[_0x0a9e('0x50')],'channel':_0x0a9e('0x7a')};var _0x1af799=[];var _0x51aa2f=[];var _0x2e4887={};var _0x3c9135=![];return db[_0x0a9e('0x7b')][_0x0a9e('0x51')]()[_0x0a9e('0x13')](function(_0x2be526){if(!_0x2be526){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x7e'));}_0x1af799=_[_0x0a9e('0x7f')](_['keys'](_0x2be526),[_0x0a9e('0x80'),_0x0a9e('0x81')]);_0x51aa2f=_[_0x0a9e('0x7f')](_[_0x0a9e('0x49')](_0x2be526),[_0x0a9e('0x80'),_0x0a9e('0x81'),_0x0a9e('0x82'),_0x0a9e('0x83')]);if(_0x5a1848['body']['id']){delete _0x5a1848[_0x0a9e('0x50')]['id'];}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')]['from'])){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')])||_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')]===''){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0a9e('0x6e')](_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x85')])){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x86')+_0x51aa2f);}if(!_['includes'](_0x51aa2f,_0x5a1848[_0x0a9e('0x50')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a9e('0x87')+_0x51aa2f);}_0x2e4887[_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x85')]]=_0x5a1848[_0x0a9e('0x50')]['from'];})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x5a1848[_0x0a9e('0x47')]['id']},'include':[{'model':db[_0x0a9e('0x88')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0a9e('0x89'),'where':_0x2e4887,'limit':0x1,'order':[[_0x0a9e('0x81'),_0x0a9e('0x8a')]]}]},{'model':db['ChatApplication'],'as':_0x0a9e('0x8b')}]});})[_0x0a9e('0x13')](handleEntityNotFound(_0x43c397,null))[_0x0a9e('0x13')](function(_0x4cee8c){if(_0x4cee8c&&_0x4cee8c[_0x0a9e('0x8c')]){_0x1a0314[_0x0a9e('0x8d')]=_0x4cee8c;_0x1a0314[_0x0a9e('0x8e')]=_0x4cee8c['Applications'];_0x1a0314[_0x0a9e('0x8f')]=_0x4cee8c[_0x0a9e('0x8c')];_0x1a0314[_0x0a9e('0x8e')]=_['orderBy'](_0x1a0314['applications'],['priority'],[_0x0a9e('0x90')]);if(_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8b')]){delete _0x1a0314[_0x0a9e('0x8d')]['Applications'];}if(_0x1a0314[_0x0a9e('0x8d')]['List']&&_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8c')][_0x0a9e('0x89')]['length']){return _0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0x8c')][_0x0a9e('0x89')][0x0];}var _0x580dd6=_[_0x0a9e('0xb')](_0x5a1848['body'],{'firstName':_0x5a1848[_0x0a9e('0x50')]['from'],'ListId':_0x4cee8c[_0x0a9e('0x83')]});_0x580dd6[_0x5a1848['body'][_0x0a9e('0x85')]]=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x91')];return db[_0x0a9e('0x7b')][_0x0a9e('0x4b')](_0x580dd6,{'fields':_0x1af799,'raw':!![]});}})[_0x0a9e('0x13')](handleEntityNotFound(_0x43c397,null))[_0x0a9e('0x13')](function(_0x5acdc9){_0x1a0314[_0x0a9e('0x92')]=_0x5acdc9;var _0x1c9ea2=_0x5a1848['body'][_0x0a9e('0x93')];if(_0x5a1848[_0x0a9e('0x78')]['cf-connecting-ip']){_0x1c9ea2=_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x94')];}else if(_0x5a1848[_0x0a9e('0x78')]['x-forwarded-for']){_0x1c9ea2=_[_0x0a9e('0x95')](_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x96')][_0x0a9e('0x97')](','));}if(_0x5acdc9){var _0x2003bc={'ContactId':_0x5acdc9['id'],'ChatWebsiteId':_0x5a1848[_0x0a9e('0x47')]['id'],'from':(_0x5acdc9[_0x0a9e('0x98')]||'')+'\x20'+(_0x5acdc9[_0x0a9e('0x99')]||''),'customerIp':_0x1c9ea2,'customerPort':_0x5a1848[_0x0a9e('0x78')][_0x0a9e('0x9a')]?_0x5a1848['headers'][_0x0a9e('0x9a')]:null,'referer':_0x5a1848['body'][_0x0a9e('0x9b')],'browserName':_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x2b')]&&_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x9d')]?util[_0x0a9e('0x9e')]('%s\x20%s',_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x2b')],_0x2097d8[_0x0a9e('0x9c')]['version']):_0x0a9e('0x9f'),'browserVersion':_0x2097d8[_0x0a9e('0x9c')][_0x0a9e('0x9d')]||_0x0a9e('0x9f'),'osName':util[_0x0a9e('0x9e')](_0x0a9e('0xa0'),_0x2097d8['os'][_0x0a9e('0x2b')],_0x2097d8['os']['version']),'osVersion':_0x2097d8['os'][_0x0a9e('0x9d')],'deviceModel':_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0x32')]&&_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')]?util[_0x0a9e('0x9e')](_0x0a9e('0xa3'),_0x2097d8['device']['model'],_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')],_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0x31')]):null,'deviceVendor':_0x2097d8[_0x0a9e('0xa1')][_0x0a9e('0xa2')],'deviceType':_0x2097d8[_0x0a9e('0xa1')]['type'],'formData':JSON[_0x0a9e('0xa4')](_0x5a1848[_0x0a9e('0x50')])};var _0x2d8e91={'ChatWebsiteId':_0x5a1848[_0x0a9e('0x47')]['id'],'closed':![]};if(_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')]){_0x2d8e91[_0x0a9e('0xa5')]=_0x5a1848['body'][_0x0a9e('0xa5')];return db[_0x0a9e('0xa6')][_0x0a9e('0x4a')]({'where':_0x2d8e91})['then'](function(_0x2b8ad4){if(_0x2b8ad4){return[_0x2b8ad4,![]];}_0x2003bc[_0x0a9e('0xa5')]=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')];_0x2003bc['externalUrl']=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa7')];return db[_0x0a9e('0xa6')][_0x0a9e('0x4b')](_0x2003bc)[_0x0a9e('0x13')](function(_0x20c130){return[_0x20c130,!![]];});});}_0x2d8e91[_0x0a9e('0xa8')]=_0x5acdc9['id'];if(_0x5a1848[_0x0a9e('0x50')]['interaction']&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa9')]['id']){_0x2d8e91['id']=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa9')]['id'];return db['ChatInteraction']['find']({'where':_0x2d8e91})[_0x0a9e('0x13')](function(_0x2abe55){if(_0x2abe55){return[_0x2abe55,![]];}return db[_0x0a9e('0xa6')]['create'](_0x2003bc)[_0x0a9e('0x13')](function(_0x40180d){return[_0x40180d,!![]];});});}return db['ChatInteraction'][_0x0a9e('0x4b')](_0x2003bc)['then'](function(_0x35cc2a){return[_0x35cc2a,!![]];});}})['spread'](function(_0x5b42b9,_0x48eaa3){if(_0x5b42b9){_0x3c9135=_0x48eaa3;if(!_0x48eaa3){var _0xad4d10={'from':(_0x1a0314[_0x0a9e('0x92')][_0x0a9e('0x98')]||'')+'\x20'+(_0x1a0314[_0x0a9e('0x92')][_0x0a9e('0x99')]||'')};if(_0x5a1848[_0x0a9e('0x50')]['threadId']&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xaa')]&&_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xa5')]!=_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xaa')]){_0xad4d10[_0x0a9e('0xa5')]=_0x5a1848['body']['messageId'];}return _0x5b42b9[_0x0a9e('0x25')](_0xad4d10);}else{return _0x5b42b9;}}})['then'](function(_0x29537a){_0x1a0314[_0x0a9e('0xa9')]=_0x29537a[_0x0a9e('0x27')]({'plain':!![]});_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xab')]=_0x3c9135;if(_0x1a0314[_0x0a9e('0xa9')]['created']){if(_0x1a0314[_0x0a9e('0x8d')]['autoclose']){_0x1a0314['applications'][_0x0a9e('0xac')]({'id':0x0,'priority':_0x1a0314['applications'][_0x0a9e('0x38')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x0a9e('0xad')});}}return db['ChatMessage'][_0x0a9e('0x4b')]({'body':_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0x50')],'ChatWebsiteId':_0x5a1848['params']['id'],'ChatInteractionId':_0x29537a['id'],'direction':'in','ContactId':_0x1a0314[_0x0a9e('0x92')]['id'],'AttachmentId':_0x5a1848[_0x0a9e('0x50')][_0x0a9e('0xae')]});})['then'](function(_0x5236c9){_0x1a0314[_0x0a9e('0x19')]=_0x5236c9;if(_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xaf')]){return db[_0x0a9e('0xb0')][_0x0a9e('0x4a')]({'attributes':['id',_0x0a9e('0x2b')],'where':{'id':_0x1a0314[_0x0a9e('0xa9')][_0x0a9e('0xaf')]}})[_0x0a9e('0x13')](function(_0x1020a0){if(_0x1020a0){_0x1a0314['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1020a0[_0x0a9e('0x2b')]+','+(_0x1a0314[_0x0a9e('0x8d')][_0x0a9e('0xb1')]||0xa),'interval':_0x0a9e('0xad')});_0x1a0314[_0x0a9e('0xb2')]=!![];}return respondWithRpcPromise(_0x0a9e('0xb3'),_0x0a9e('0xb4'),_0x1a0314);});}return respondWithRpcPromise(_0x0a9e('0xb3'),'startRouting',_0x1a0314);})['then'](function(_0x2869cc){respondWithRpcPromise(_0x0a9e('0xb5'),'EventManager',{'event':_0x0a9e('0x75'),'message':_0x2869cc},client9002);return _0x2869cc;})[_0x0a9e('0x13')](respondWithResult(_0x43c397,null))[_0x0a9e('0x45')](handleError(_0x43c397,null));};exports[_0x0a9e('0xb6')]=function(_0x2bb549,_0x2683ad){var _0x167196,_0x262281,_0x59f8f7;var _0x400800=[];var _0xbd1af3={};var _0x20e191=_0x2bb549['files']||[];var _0x4412a5=[];var _0x261ef8;return db[_0x0a9e('0x7b')][_0x0a9e('0x51')]()[_0x0a9e('0x13')](function(_0x21ada7){if(!_0x21ada7){throw new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0x7e'));}_0x400800=_[_0x0a9e('0x7f')](_[_0x0a9e('0x49')](_0x21ada7),[_0x0a9e('0x80'),'updatedAt','CompanyId',_0x0a9e('0x83')]);if(_0x2bb549[_0x0a9e('0x50')]['id']){delete _0x2bb549[_0x0a9e('0x50')]['id'];}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)['send'](new db[(_0x0a9e('0x7c'))]['ValidationError'](_0x0a9e('0x84')));}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')])||_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')]===''){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db[(_0x0a9e('0x7c'))][(_0x0a9e('0x7d'))](_0x0a9e('0xb7')));}if(_[_0x0a9e('0x6e')](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0xb8')])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db['Sequelize']['ValidationError'](_0x0a9e('0xb9')+_0x400800));}if(!_[_0x0a9e('0xba')](_0x400800,_0x2bb549['body']['mapKeyOffline'])){throw _0x2683ad[_0x0a9e('0x1d')](0x1f4)[_0x0a9e('0x2c')](new db[(_0x0a9e('0x7c'))]['ValidationError'](_0x0a9e('0xbb')+_0x400800));}_0xbd1af3[_0x2bb549['body'][_0x0a9e('0xb8')]]=_0x2bb549['body'][_0x0a9e('0x91')];})['then'](function(){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x2bb549[_0x0a9e('0x47')]['id']},'include':[{'model':db['CmList'],'as':_0x0a9e('0x8c')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x0a9e('0x13')](handleEntityNotFound(_0x2683ad,null))[_0x0a9e('0x13')](function(_0x3c691f){if(_0x3c691f&&_0x3c691f[_0x0a9e('0x8c')]){_0x262281=_0x3c691f;var _0x1d51fd=_[_0x0a9e('0xb')](_0x2bb549[_0x0a9e('0x50')],{'firstName':_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')],'phone':_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')],'ListId':_0x3c691f[_0x0a9e('0x83')]});_0x1d51fd[_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0xb8')]]=_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x91')];return db[_0x0a9e('0x7b')][_0x0a9e('0xbc')]({'where':_0xbd1af3,'defaults':_0x1d51fd});}})[_0x0a9e('0xbd')](function(_0x51a987){if(_0x51a987){_0x59f8f7=_0x51a987;var _0x233e48=fs[_0x0a9e('0xbe')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x54658d=ejs[_0x0a9e('0xbf')](_0x233e48,{'body':_['toPairs'](_0x2bb549[_0x0a9e('0x50')][_0x0a9e('0x50')]),'bodyTitle':_0x262281[_0x0a9e('0xc0')]});return db[_0x0a9e('0xc1')][_0x0a9e('0x4b')]({'body':_0x54658d,'plainBody':htmlToText[_0x0a9e('0xc2')](_0x54658d),'ContactId':_0x51a987['id'],'ChatWebsiteId':_0x262281['id']});}})[_0x0a9e('0x13')](function(_0x1cc73e){_0x261ef8=_0x1cc73e;if(_0x20e191[_0x0a9e('0x38')]){var _0x6b948a=_0x20e191['map'](function(_0x283c59){return{'name':_0x283c59['originalname'],'basename':_0x283c59[_0x0a9e('0x60')],'type':_0x283c59['mimetype'],'ChatOfflineMessageId':_0x1cc73e['id']};});_0x4412a5=_0x6b948a[_0x0a9e('0x2e')](_0x2c5385=>{var _0x216791={'filename':_0x2c5385['name'],'path':path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server','files',_0x0a9e('0xc3'),_0x0a9e('0xc4'),_0x2c5385[_0x0a9e('0xc5')])};return _0x216791;});if(!_0x262281['openNewInteraction']){return db['sequelize']['transaction'](function(_0x374964){return db[_0x0a9e('0xc6')][_0x0a9e('0xc7')](_0x6b948a,{'transaction':_0x374964});});}}})[_0x0a9e('0x13')](function(){if(_0x261ef8){_0x167196=_0x261ef8;return db[_0x0a9e('0xc8')][_0x0a9e('0x56')]({'where':{'active':!![]},'include':[{'model':db[_0x0a9e('0xc9')],'as':_0x0a9e('0xca'),'raw':!![],'include':[{'model':db[_0x0a9e('0xcb')],'as':_0x0a9e('0xcb'),'raw':!![]}]}]});}})[_0x0a9e('0x13')](function(_0x2f4de1){if(_0x2f4de1&&_0x2f4de1[_0x0a9e('0xca')]&&_0x262281[_0x0a9e('0xcc')]&&_0x262281[_0x0a9e('0xcd')]){var _0x1a74c4=_0x2f4de1[_0x0a9e('0xce')]();return respondWithRpcPromise(_0x0a9e('0xcf'),'sendMail',{'account':_0x1a74c4,'message':{'from':util[_0x0a9e('0x9e')](_0x0a9e('0xd0'),_0x2f4de1[_0x0a9e('0x2b')],_0x2f4de1[_0x0a9e('0xd1')]||_0x2f4de1[_0x0a9e('0xca')][_0x0a9e('0x4c')]),'to':_0x262281['forwardOfflineAddress'],'subject':_0x262281[_0x0a9e('0xd2')],'html':_0x167196[_0x0a9e('0x50')],'attachments':_0x4412a5}},client9003)[_0x0a9e('0x13')](function(){return _0x167196;})[_0x0a9e('0x45')](function(_0x37390b){logger[_0x0a9e('0x18')](_0x37390b);});}})[_0x0a9e('0x13')](function(){if(_0x262281&&_0x262281[_0x0a9e('0xd3')]&&_0x262281[_0x0a9e('0xd4')]){var _0x541af6=[];if(_0x20e191['length']){_0x541af6=_0x20e191[_0x0a9e('0x2e')](function(_0x3a0b30){return{'name':_0x3a0b30['originalname'],'basename':_0x3a0b30[_0x0a9e('0x60')],'type':_0x3a0b30[_0x0a9e('0xd5')],'ChatOfflineMessageId':_0x261ef8['id']};});}var _0x4c8d75;if(!_[_0x0a9e('0x6e')](_0x262281['subjectOffline'])){var _0x3468a4=_[_0x0a9e('0x2e')](_0x2bb549['body'],function(_0x27a41c){return _0x27a41c;});var _0x31ab12=_['toPairsIn'](_0x3468a4)[0x0];var _0x197d65=_[_0x0a9e('0xd6')](_0x31ab12,function(_0x53ad2b){return _0x53ad2b;});_0x4c8d75=_0x197d65[0x1][_0x262281[_0x0a9e('0xd7')]];}var _0x237994={'from':_0x59f8f7[_0x0a9e('0xd1')],'firstName':_0x59f8f7[_0x0a9e('0x98')],'lastName':_0x59f8f7[_0x0a9e('0x99')],'mapKey':_0x0a9e('0xd1'),'message':{'from':_0x59f8f7['email'],'to':_0x262281[_0x0a9e('0xc8')][_0x0a9e('0xd1')],'cc':'','subject':_['isNil'](_0x4c8d75)?_0x262281[_0x0a9e('0xd2')]:_0x4c8d75,'messageId':'','sentAt':new Date(),'attach':_0x541af6[_0x0a9e('0x38')],'attachments':_0x541af6,'originChannel':_0x0a9e('0xd8'),'ChatWebsiteId':_0x262281['id'],'ChatOfflineMessageId':_0x167196['id'],'originTo':_0x262281[_0x0a9e('0xc8')][_0x0a9e('0xd1')]},'body':_0x167196[_0x0a9e('0x50')]};var _0x368a12={'account':{'id':_0x262281['MailAccountId']},'body':_0x237994,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x368a12,client9001)['then'](function(){return _0x167196;})[_0x0a9e('0x45')](function(_0x23ef4e){logger['error'](_0x23ef4e);});}return;})['then'](function(){if(_0x167196){return _0x167196;}})[_0x0a9e('0x13')](respondWithResult(_0x2683ad,null))['catch'](function(_0x41600e){logger[_0x0a9e('0x18')](_0x0a9e('0x45'),_0x41600e);for(var _0x175c97 of _0x20e191){var _0x336518=path[_0x0a9e('0x66')](config['root'],_0x0a9e('0xd9'),_0x0a9e('0xda'),'attachments',_0x0a9e('0xc4'),_0x175c97[_0x0a9e('0x60')]);fs_extra[_0x0a9e('0xdb')](_0x336518)[_0x0a9e('0x45')](function(_0x1282da){logger[_0x0a9e('0x18')](_0x0a9e('0xdc'),_0x336518,_0x1282da);});}});};exports['addInteraction']=function(_0x331216,_0x508395){return db[_0x0a9e('0xa6')][_0x0a9e('0x4a')]({'where':{'id':_0x331216['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x508395,null))[_0x0a9e('0x13')](function(_0x5061e5){if(_0x5061e5){return _0x5061e5[_0x0a9e('0xdd')](_0x331216['body'][_0x0a9e('0x5e')],_[_0x0a9e('0xde')](_0x331216['body'],[_0x0a9e('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x508395,null))[_0x0a9e('0x45')](handleError(_0x508395,null));};exports[_0x0a9e('0xdf')]=function(_0x732141,_0x37ef45){var _0x288127={'raw':![],'where':{}};var _0x26d010={};var _0xa45906={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x732141[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x37ef45,null))[_0x0a9e('0x13')](function(_0x38e256){if(_0x38e256){_0x26d010['model']=_[_0x0a9e('0x49')](db['ChatInteraction']['rawAttributes']);_0x26d010[_0x0a9e('0x33')]=_['keys'](_0x732141[_0x0a9e('0x33')]);_0x26d010[_0x0a9e('0x34')]=_['intersection'](_0x26d010[_0x0a9e('0x32')],_0x26d010[_0x0a9e('0x33')]);_0x288127[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x26d010[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x732141[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x288127[_0x0a9e('0x36')]=_0x288127['attributes'][_0x0a9e('0x38')]?_0x288127[_0x0a9e('0x36')]:_0x26d010[_0x0a9e('0x32')];if(!_0x732141[_0x0a9e('0x33')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x288127[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x732141['query'][_0x0a9e('0x21')]);_0x288127[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x732141['query'][_0x0a9e('0x1f')]);}_0x288127['order']=qs[_0x0a9e('0x3b')](_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x288127[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x732141[_0x0a9e('0x33')],_0x26d010['filters']));_0x288127[_0x0a9e('0x3c')][_0x0a9e('0x53')]=_0x38e256['id'];if(_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x288127[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x288127[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x288127[_0x0a9e('0x36')],function(_0x4712c9){var _0x4542d3={};_0x4542d3[_0x4712c9]={'$like':'%'+_0x732141[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x4542d3;})});}_0x288127=_[_0x0a9e('0x3f')]({},_0x288127,_0x732141[_0x0a9e('0x41')]);return db[_0x0a9e('0xa6')][_0x0a9e('0x22')]({'where':_0x288127[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x611e46){_0xa45906[_0x0a9e('0x22')]=_0x611e46;if(_0x732141[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x288127['include']=[{'model':db[_0x0a9e('0x7b')],'as':_0x0a9e('0xe0'),'required':![]},{'model':db[_0x0a9e('0xb0')],'as':'Owner','attributes':[_0x0a9e('0x2b'),'fullname',_0x0a9e('0xe1')],'required':![]},{'model':db[_0x0a9e('0xe2')],'as':_0x0a9e('0xe3'),'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0xe4')],'where':_0x732141[_0x0a9e('0x33')][_0x0a9e('0xe5')]?{'id':_0x732141[_0x0a9e('0x33')]['tag']}:undefined,'required':_0x732141[_0x0a9e('0x33')][_0x0a9e('0xe5')]?!![]:![]}];}return db['ChatInteraction'][_0x0a9e('0x44')](_0x288127);})[_0x0a9e('0x13')](function(_0x579bb0){_0xa45906['rows']=_0x579bb0;return _0xa45906;});}})[_0x0a9e('0x13')](respondWithFilteredResult(_0x37ef45,_0x288127))[_0x0a9e('0x45')](handleError(_0x37ef45,null));};function iftimePromise(_0x315299,_0x1bf053){return respondWithRpcPromise('Command',_0x0a9e('0xe6'),{'command':_0x1bf053[_0x0a9e('0xe7')]?util[_0x0a9e('0x9e')](_0x0a9e('0xe8'),_0x315299[_0x0a9e('0xe9')],_0x1bf053['timezone']):util[_0x0a9e('0x9e')](_0x0a9e('0xea'),_0x315299['interval'])},client9002)[_0x0a9e('0x13')](function(_0x2d20a0){var _0x38284a=_0x2d20a0&&_0x2d20a0['indexOf']('true')>=0x0?!![]:![];logger[_0x0a9e('0x14')](_0x0a9e('0xeb'),_0x1bf053['id'],_0x315299['id'],_0x315299[_0x0a9e('0xe9')],_0x38284a?_0x0a9e('0xec'):_0x0a9e('0xed'),_0x1bf053[_0x0a9e('0xe7')]?_0x1bf053[_0x0a9e('0xe7')]:_0x0a9e('0xee'));return _0x38284a;})['catch'](function(_0x5cc8cb){logger[_0x0a9e('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1bf053['id'],_0x315299['id'],_0x315299[_0x0a9e('0xe9')],util[_0x0a9e('0xef')](_0x5cc8cb,{'showHidden':![],'depth':null}),_0x1bf053[_0x0a9e('0xe7')]?_0x1bf053[_0x0a9e('0xe7')]:'No\x20timezone');return![];});}exports[_0x0a9e('0xe6')]=function(_0x43c1d1,_0x546bc9){var _0x10e370=0x0;var _0x5092af=0x0;var _0x2e1de7=![];var _0x30a77e;var _0xd63c87;return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x43c1d1[_0x0a9e('0x47')]['id']},'include':[{'model':db['Interval'],'as':_0x0a9e('0xf0'),'include':[{'model':db['Interval'],'as':_0x0a9e('0xf1'),'attributes':['id',_0x0a9e('0xe9')],'raw':!![]}]}]})[_0x0a9e('0x13')](handleEntityNotFound(_0x546bc9,null))[_0x0a9e('0x13')](function(_0xa244bc){if(_0xa244bc){_0x30a77e=_0xa244bc;return _0xa244bc[_0x0a9e('0xf2')]({'raw':!![]});}})[_0x0a9e('0x13')](function(_0x5bdba6){if(_0x30a77e){if(_0x5bdba6){_0xd63c87=_0x5bdba6;}}return require(_0x0a9e('0xf3'))[_0x0a9e('0x69')]();})[_0x0a9e('0x13')](function(_0x188231){if(_0x188231){_0x5092af=_0x188231[_0x0a9e('0xf4')];_0x2e1de7=_0x188231['custom'];}})[_0x0a9e('0x13')](function(){return db[_0x0a9e('0xa6')]['count']({'where':{'closed':![]}});})['then'](function(_0x2240ea){_0x10e370=_0x2240ea;if(_0x5092af&&_0x2240ea>_0x5092af){return db[_0x0a9e('0xf5')][_0x0a9e('0x56')]({'where':{'id':0x1}})[_0x0a9e('0x13')](function(_0x380539){if(_0x380539){_0x380539[_0x0a9e('0xf6')]('chatLicenseExceeded');}});}})[_0x0a9e('0x13')](function(){if(_0x30a77e[_0x0a9e('0xf0')]&&_0x30a77e[_0x0a9e('0xf0')]['Intervals']){var _0x294e90=[];for(var _0x1969e3=0x0;_0x1969e3<_0x30a77e[_0x0a9e('0xf0')][_0x0a9e('0xf1')]['length'];_0x1969e3++){var _0x5d4935=_0x30a77e[_0x0a9e('0xf0')][_0x0a9e('0xf1')][_0x1969e3][_0x0a9e('0x27')]({'plain':!![]});_0x294e90[_0x0a9e('0xac')](iftimePromise(_0x5d4935,_0x30a77e));}return BPromise[_0x0a9e('0xf7')](_0x294e90)[_0x0a9e('0x13')](function(_0x371943){return _[_0x0a9e('0xf8')](_0x371943);});}else{return!![];}})['then'](function(_0x17187c){var _0x4be017=fs[_0x0a9e('0xbe')](path[_0x0a9e('0x66')](config[_0x0a9e('0x67')],'server/files/chat/iframe.ejs'),'utf8');var _0x462ecd={'remote':_0x30a77e['remote'],'query':querystring[_0x0a9e('0xa4')](_['merge'](_0x30a77e['get']({'plain':!![]}),{'customerIp':_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0x96')]||_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0xf9')]||_0x43c1d1[_0x0a9e('0xfa')][_0x0a9e('0xfb')]||_0x43c1d1['ip'],'referer':_0x43c1d1[_0x0a9e('0x78')][_0x0a9e('0x9b')],'openedInteractions':_0x10e370,'maxInteractions':_0x5092af,'virtual':_0x2e1de7[_0x0a9e('0xf4')],'online':_0x17187c,'custom':_0x2e1de7}))[_0x0a9e('0xfc')](/'/g,'\x5c\x27')};_0x546bc9[_0x0a9e('0x2c')](ejs[_0x0a9e('0xbf')](Mustache[_0x0a9e('0xbf')](_0x4be017,_0x462ecd),{'proactiveActions':_0xd63c87,'alignment':_0x30a77e['alignment'],'verticalAlignment':_0x30a77e['verticalAlignment'],'div_color':_0x30a77e[_0x0a9e('0xe4')],'labelText':_0x30a77e['labelText'],'text_color':_0x30a77e[_0x0a9e('0xfd')],'button_color':_0x30a77e[_0x0a9e('0xfe')],'background_color':_0x30a77e[_0x0a9e('0xff')],'hideWhenOffline':_0x30a77e['hideWhenOffline'],'interval':_0x30a77e['IntervalId']}));})[_0x0a9e('0x45')](handleError(_0x546bc9,null));};exports[_0x0a9e('0x100')]=function(_0x2c316b,_0x142c65){var _0x193e3b=_0x2c316b[_0x0a9e('0x47')]['id'];var _0x36e428=_0x2c316b['body'];var _0x12984a=0xc8;var _0x5799a6=null;return db[_0x0a9e('0x101')][_0x0a9e('0x102')]({'isolationLevel':db['sequelize'][_0x0a9e('0x103')][_0x0a9e('0x104')][_0x0a9e('0x105')]},function(_0x4524b8){return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x193e3b},'transaction':_0x4524b8})['then'](function(_0x475bcd){if(_0x475bcd){return db[_0x0a9e('0x106')][_0x0a9e('0x26')]({'where':{'ChatWebsiteId':_0x193e3b},'transaction':_0x4524b8})['then'](function(){var _0x857983=_[_0x0a9e('0x2e')](_0x36e428,function(_0x24dc3f){_0x24dc3f['ChatWebsiteId']=_0x193e3b;return _0x24dc3f;});return db[_0x0a9e('0x106')][_0x0a9e('0xc7')](_0x857983,{'transaction':_0x4524b8});});}else{_0x12984a=0x194;_0x5799a6=[];}});})[_0x0a9e('0x13')](function(){if(_0x12984a!==0x194){return db[_0x0a9e('0x106')][_0x0a9e('0x107')]({'where':{'ChatWebsiteId':_0x193e3b},'order':_0x0a9e('0x108')})['then'](function(_0x483aed){_0x5799a6=_0x483aed;});}})[_0x0a9e('0x45')](function(_0x1e01af){_0x12984a=0x1f4;logger['error'](_0x1e01af[_0x0a9e('0x2a')]);if(_0x1e01af[_0x0a9e('0x2b')]){delete _0x1e01af[_0x0a9e('0x2b')];}_0x5799a6=_0x1e01af;})[_0x0a9e('0x109')](function(){if(_0x5799a6===null){_0x142c65[_0x0a9e('0x1b')](_0x12984a);}else{if(_0x12984a===0x1f4){_0x142c65[_0x0a9e('0x1d')](_0x12984a)['send'](_0x5799a6);}else{_0x142c65[_0x0a9e('0x1d')](_0x12984a)[_0x0a9e('0x1e')](_0x5799a6);}}});};exports[_0x0a9e('0x10a')]=function(_0x4edb79,_0x45c6ce){var _0x4532de={};var _0x1747ab={};var _0x3afafa;var _0x5beea6;return db['ChatWebsite'][_0x0a9e('0x56')]({'where':{'id':_0x4edb79[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x45c6ce,null))['then'](function(_0x3d75c9){if(_0x3d75c9){_0x3afafa=_0x3d75c9;_0x1747ab[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0x106')][_0x0a9e('0x30')]);_0x1747ab[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x4edb79[_0x0a9e('0x33')]);_0x1747ab['filters']=_['intersection'](_0x1747ab[_0x0a9e('0x32')],_0x1747ab[_0x0a9e('0x33')]);_0x4532de['attributes']=_[_0x0a9e('0x35')](_0x1747ab['model'],qs[_0x0a9e('0x37')](_0x4edb79[_0x0a9e('0x33')]['fields']));_0x4532de[_0x0a9e('0x36')]=_0x4532de[_0x0a9e('0x36')]['length']?_0x4532de[_0x0a9e('0x36')]:_0x1747ab[_0x0a9e('0x32')];_0x4532de[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x4532de[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x3d')](_0x4edb79[_0x0a9e('0x33')],_0x1747ab[_0x0a9e('0x34')]));if(_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x4532de[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x4532de['where'],{'$or':_['map'](_0x4532de[_0x0a9e('0x36')],function(_0x14c3f1){var _0x1e6bba={};_0x1e6bba[_0x14c3f1]={'$like':'%'+_0x4edb79['query']['filter']+'%'};return _0x1e6bba;})});}_0x4532de=_[_0x0a9e('0x3f')]({},_0x4532de,_0x4edb79['options']);return _0x3afafa[_0x0a9e('0x10a')](_0x4532de);}})[_0x0a9e('0x13')](function(_0x112789){if(_0x112789){_0x5beea6=_0x112789[_0x0a9e('0x38')];if(!_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x4532de[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x4edb79['query']['limit']);_0x4532de[_0x0a9e('0x1f')]=qs['offset'](_0x4edb79[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x3afafa[_0x0a9e('0x10a')](_0x4532de);}})[_0x0a9e('0x13')](function(_0x4ad6fc){if(_0x4ad6fc){return _0x4ad6fc?{'count':_0x5beea6,'rows':_0x4ad6fc}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x45c6ce,null))[_0x0a9e('0x45')](handleError(_0x45c6ce,null));};exports[_0x0a9e('0x10b')]=function(_0x5174c5,_0x1ebf20){return db[_0x0a9e('0x10c')][_0x0a9e('0x4a')]({'where':{'id':_0x5174c5['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x1ebf20,null))[_0x0a9e('0x13')](function(_0x459ab7){if(_0x459ab7){return _0x459ab7[_0x0a9e('0x10b')](_0x5174c5[_0x0a9e('0x50')][_0x0a9e('0x5e')],_['omit'](_0x5174c5['body'],[_0x0a9e('0x5e'),'id'])||{});}})[_0x0a9e('0x13')](respondWithResult(_0x1ebf20,null))[_0x0a9e('0x45')](handleError(_0x1ebf20,null));};exports['getProactiveActions']=function(_0x5990e1,_0x2a5c2a){var _0x304a57={};var _0x2302a2={};var _0x5f5963;var _0x4b51ff;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x5990e1[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x2a5c2a,null))[_0x0a9e('0x13')](function(_0x4f0bca){if(_0x4f0bca){_0x5f5963=_0x4f0bca;_0x2302a2[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x10d')][_0x0a9e('0x30')]);_0x2302a2['query']=_[_0x0a9e('0x49')](_0x5990e1['query']);_0x2302a2[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2302a2[_0x0a9e('0x32')],_0x2302a2[_0x0a9e('0x33')]);_0x304a57[_0x0a9e('0x36')]=_['intersection'](_0x2302a2[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x5990e1[_0x0a9e('0x33')]['fields']));_0x304a57[_0x0a9e('0x36')]=_0x304a57['attributes'][_0x0a9e('0x38')]?_0x304a57[_0x0a9e('0x36')]:_0x2302a2[_0x0a9e('0x32')];_0x304a57['order']=qs[_0x0a9e('0x3b')](_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x304a57[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x5990e1['query'],_0x2302a2[_0x0a9e('0x34')]));if(_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x304a57[_0x0a9e('0x3c')]=_[_0x0a9e('0x3f')](_0x304a57[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x304a57[_0x0a9e('0x36')],function(_0x597e99){var _0x2dc0de={};_0x2dc0de[_0x597e99]={'$like':'%'+_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2dc0de;})});}_0x304a57=_[_0x0a9e('0x3f')]({},_0x304a57,_0x5990e1['options']);return _0x5f5963[_0x0a9e('0xf2')](_0x304a57);}})['then'](function(_0xf81cc){if(_0xf81cc){_0x4b51ff=_0xf81cc[_0x0a9e('0x38')];if(!_0x5990e1[_0x0a9e('0x33')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x304a57[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x5990e1[_0x0a9e('0x33')]['limit']);_0x304a57[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x5990e1[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x5f5963[_0x0a9e('0xf2')](_0x304a57);}})[_0x0a9e('0x13')](function(_0xbdc88e){if(_0xbdc88e){return _0xbdc88e?{'count':_0x4b51ff,'rows':_0xbdc88e}:null;}})['then'](respondWithResult(_0x2a5c2a,null))[_0x0a9e('0x45')](handleError(_0x2a5c2a,null));};exports[_0x0a9e('0x10e')]=function(_0x337c29,_0xa42055){var _0x52cdf4=_0x337c29[_0x0a9e('0x33')]['online']===_0x0a9e('0x10f')?_0x0a9e('0x110'):_0x0a9e('0x111');return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'attributes':['id',_0x52cdf4],'where':{'id':_0x337c29[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xa42055,null))['then'](function(_0x173f03){if(_0x173f03){var _0x4ac7f1=_0x173f03[_0x52cdf4];var _0x382412=_0x4ac7f1&&_0x4ac7f1[_0x0a9e('0x112')]?_0x4ac7f1['items']:[];_0xa42055[_0x0a9e('0x2c')]({'fromKey':_[_0x0a9e('0x6e')](_0x4ac7f1[_0x0a9e('0x113')])?undefined:_0x4ac7f1[_0x0a9e('0x113')],'count':_0x382412['length'],'rows':_0x382412});}})[_0x0a9e('0x45')](handleError(_0xa42055,null));};exports[_0x0a9e('0x114')]=function(_0x5a75d9,_0xcc859d){var _0x4a396c={'raw':![],'where':{}};var _0x58cb87={};var _0x50e7ec={'count':0x0,'rows':[]};return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x5a75d9['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xcc859d,null))[_0x0a9e('0x13')](function(_0x5ef7e8){if(_0x5ef7e8){_0x58cb87[_0x0a9e('0x32')]=_[_0x0a9e('0x49')](db[_0x0a9e('0xc1')][_0x0a9e('0x30')]);_0x58cb87[_0x0a9e('0x33')]=_[_0x0a9e('0x49')](_0x5a75d9[_0x0a9e('0x33')]);_0x58cb87['filters']=_[_0x0a9e('0x35')](_0x58cb87['model'],_0x58cb87[_0x0a9e('0x33')]);_0x4a396c[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x58cb87[_0x0a9e('0x32')],qs[_0x0a9e('0x37')](_0x5a75d9[_0x0a9e('0x33')]['fields']));_0x4a396c[_0x0a9e('0x36')]=_0x4a396c[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x4a396c['attributes']:_0x58cb87[_0x0a9e('0x32')];if(!_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x4a396c[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x4a396c[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x4a396c[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3b')]);_0x4a396c['where']=qs[_0x0a9e('0x34')](_[_0x0a9e('0x3d')](_0x5a75d9[_0x0a9e('0x33')],_0x58cb87['filters']));_0x4a396c[_0x0a9e('0x3c')][_0x0a9e('0x53')]=_0x5ef7e8['id'];if(_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x4a396c['where']=_[_0x0a9e('0x3f')](_0x4a396c[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x2e')](_0x4a396c[_0x0a9e('0x36')],function(_0x4e8eb9){var _0x2b263b={};_0x2b263b[_0x4e8eb9]={'$like':'%'+_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x2b263b;})});}_0x4a396c=_[_0x0a9e('0x3f')]({},_0x4a396c,_0x5a75d9['options']);return db['ChatOfflineMessage'][_0x0a9e('0x22')]({'where':_0x4a396c[_0x0a9e('0x3c')]})[_0x0a9e('0x13')](function(_0x353960){_0x50e7ec[_0x0a9e('0x22')]=_0x353960;if(_0x5a75d9[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x4a396c[_0x0a9e('0x43')]=[{'all':!![]}];}else{_0x4a396c[_0x0a9e('0x43')]=[{'model':db[_0x0a9e('0x7b')],'as':_0x0a9e('0xe0'),'required':![]},{'model':db[_0x0a9e('0xc6')],'as':_0x0a9e('0x115'),'required':![]}];}return db[_0x0a9e('0xc1')]['findAll'](_0x4a396c);})[_0x0a9e('0x13')](function(_0x5ce227){_0x50e7ec[_0x0a9e('0x58')]=_0x5ce227;return _0x50e7ec;});}})['then'](respondWithFilteredResult(_0xcc859d,_0x4a396c))['catch'](handleError(_0xcc859d,null));};exports[_0x0a9e('0x116')]=function(_0x51ec16,_0x3d2007){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x51ec16[_0x0a9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d2007,null))['then'](function(_0x2ad86f){if(_0x2ad86f){return _0x2ad86f[_0x0a9e('0x116')](_0x51ec16[_0x0a9e('0x50')][_0x0a9e('0x5e')],_['omit'](_0x51ec16[_0x0a9e('0x50')],[_0x0a9e('0x5e'),'id'])||{})[_0x0a9e('0xbd')](function(_0x25f5fa){for(var _0x193ef7=0x0;_0x193ef7<_0x51ec16['body']['ids'][_0x0a9e('0x38')];_0x193ef7+=0x1){socket[_0x0a9e('0x117')](_0x0a9e('0x118'),{'UserId':Number(_0x51ec16[_0x0a9e('0x50')][_0x0a9e('0x5e')][_0x193ef7]),'ChatWebsiteId':Number(_0x51ec16[_0x0a9e('0x47')]['id'])});}return _0x25f5fa;});}})[_0x0a9e('0x13')](respondWithResult(_0x3d2007,null))['catch'](handleError(_0x3d2007,null));};exports[_0x0a9e('0x119')]=function(_0xd73712,_0x173daf){return db['ChatWebsite']['find']({'where':{'id':_0xd73712['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x173daf,null))[_0x0a9e('0x13')](function(_0x5448ee){if(_0x5448ee){return _0x5448ee[_0x0a9e('0x119')](_0xd73712[_0x0a9e('0x33')][_0x0a9e('0x5e')])['then'](function(){if(_['isArray'](_0xd73712[_0x0a9e('0x33')][_0x0a9e('0x5e')])){for(var _0xf10a48=0x0;_0xf10a48<_0xd73712[_0x0a9e('0x33')]['ids'][_0x0a9e('0x38')];_0xf10a48+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xd73712[_0x0a9e('0x33')]['ids'][_0xf10a48]),'ChatWebsiteId':Number(_0xd73712[_0x0a9e('0x47')]['id'])});}}else{socket[_0x0a9e('0x117')](_0x0a9e('0x11a'),{'UserId':Number(_0xd73712['query'][_0x0a9e('0x5e')]),'ChatWebsiteId':Number(_0xd73712[_0x0a9e('0x47')]['id'])});}});}})[_0x0a9e('0x13')](respondWithStatusCode(_0x173daf,null))['catch'](handleError(_0x173daf,null));};exports['getAgents']=function(_0x3aa901,_0xb3e9cb){var _0x34b05f={};var _0x21fcaa={};var _0x1c3b0e;var _0x1966dd;return db['ChatWebsite']['findOne']({'where':{'id':_0x3aa901[_0x0a9e('0x47')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0xb3e9cb,null))['then'](function(_0x539f84){if(_0x539f84){_0x1c3b0e=_0x539f84;_0x21fcaa['model']=_['keys'](db['User']['rawAttributes']);_0x21fcaa[_0x0a9e('0x33')]=_['keys'](_0x3aa901[_0x0a9e('0x33')]);_0x21fcaa[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x21fcaa[_0x0a9e('0x32')],_0x21fcaa[_0x0a9e('0x33')]);_0x34b05f[_0x0a9e('0x36')]=_[_0x0a9e('0x35')](_0x21fcaa['model'],qs[_0x0a9e('0x37')](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x37')]));_0x34b05f[_0x0a9e('0x36')]=_0x34b05f[_0x0a9e('0x36')][_0x0a9e('0x38')]?_0x34b05f[_0x0a9e('0x36')]:_0x21fcaa[_0x0a9e('0x32')];_0x34b05f[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x3aa901[_0x0a9e('0x33')]['sort']);_0x34b05f[_0x0a9e('0x3c')]=qs[_0x0a9e('0x34')](_['pick'](_0x3aa901[_0x0a9e('0x33')],_0x21fcaa['filters']));if(_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x3e')]){_0x34b05f['where']=_['merge'](_0x34b05f[_0x0a9e('0x3c')],{'$or':_['map'](_0x34b05f[_0x0a9e('0x36')],function(_0xa8c784){var _0x132f85={};_0x132f85[_0xa8c784]={'$like':'%'+_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x3e')]+'%'};return _0x132f85;})});}_0x34b05f=_['merge']({},_0x34b05f,_0x3aa901[_0x0a9e('0x41')]);return _0x1c3b0e['getAgents'](_0x34b05f);}})['then'](function(_0x398a88){if(_0x398a88){_0x1966dd=_0x398a88[_0x0a9e('0x38')];if(!_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x57')](_0x0a9e('0x39'))){_0x34b05f['limit']=qs[_0x0a9e('0x21')](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x21')]);_0x34b05f[_0x0a9e('0x1f')]=qs['offset'](_0x3aa901[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0x1c3b0e['getAgents'](_0x34b05f);}})[_0x0a9e('0x13')](function(_0x36d8a1){if(_0x36d8a1){return _0x36d8a1?{'count':_0x1966dd,'rows':_0x36d8a1}:null;}})[_0x0a9e('0x13')](respondWithResult(_0xb3e9cb,null))[_0x0a9e('0x45')](handleError(_0xb3e9cb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 20839dc..11c1e9b 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 _0xe015=['update','emit','hasOwnProperty','events','../../mysqldb','ChatWebsite'];(function(_0x2a6385,_0xf10ba0){var _0x258535=function(_0x5bcfbb){while(--_0x5bcfbb){_0x2a6385['push'](_0x2a6385['shift']());}};_0x258535(++_0xf10ba0);}(_0xe015,0x13b));var _0x5e01=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe015[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x5e01('0x0'));var ChatWebsite=require(_0x5e01('0x1'))['db'][_0x5e01('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e01('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2136cf){return function(_0x420f00,_0x7ce4b9,_0x241c0e){ChatWebsiteEvents['emit'](_0x2136cf+':'+_0x420f00['id'],_0x420f00);ChatWebsiteEvents[_0x5e01('0x4')](_0x2136cf,_0x420f00);_0x241c0e(null);};}for(var e in events){if(events[_0x5e01('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x8e0f=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x4ab7bb,_0x290191){var _0x2624b3=function(_0x2852f2){while(--_0x2852f2){_0x4ab7bb['push'](_0x4ab7bb['shift']());}};_0x2624b3(++_0x290191);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x5741a3,_0x1258f3){_0x5741a3=_0x5741a3-0x0;var _0x4db4a0=_0x8e0f[_0x5741a3];return _0x4db4a0;};'use strict';var EventEmitter=require(_0xf8e0('0x0'));var ChatWebsite=require(_0xf8e0('0x1'))['db'][_0xf8e0('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf8e0('0x3')](0x0);var events={'afterCreate':_0xf8e0('0x4'),'afterUpdate':_0xf8e0('0x5'),'afterDestroy':_0xf8e0('0x6')};function emitEvent(_0x5e954c){return function(_0x40d121,_0x4a6acb,_0xa0826a){ChatWebsiteEvents[_0xf8e0('0x7')](_0x5e954c+':'+_0x40d121['id'],_0x40d121);ChatWebsiteEvents['emit'](_0x5e954c,_0x40d121);_0xa0826a(null);};}for(var e in events){if(events[_0xf8e0('0x8')](e)){var event=events[e];ChatWebsite[_0xf8e0('0x9')](e,emitEvent(event));}}module[_0xf8e0('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2570a12..26b2253 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 _0xc9ab=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfed6c5,_0x208e71){var _0x143596=function(_0x9226b7){while(--_0x9226b7){_0xfed6c5['push'](_0xfed6c5['shift']());}};_0x143596(++_0x208e71);}(_0xc9ab,0x17f));var _0xbc9a=function(_0x886d08,_0x2b985d){_0x886d08=_0x886d08-0x0;var _0x163828=_0xc9ab[_0x886d08];return _0x163828;};'use strict';var _=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var logger=require('../../config/logger')(_0xbc9a('0x2'));var moment=require(_0xbc9a('0x3'));var BPromise=require(_0xbc9a('0x4'));var rp=require(_0xbc9a('0x5'));var fs=require('fs');var path=require(_0xbc9a('0x6'));var rimraf=require(_0xbc9a('0x7'));var config=require(_0xbc9a('0x8'));var attributes=require(_0xbc9a('0x9'));module[_0xbc9a('0xa')]=function(_0x584e48,_0x5593d1){return _0x584e48[_0xbc9a('0xb')](_0xbc9a('0xc'),attributes,{'tableName':_0xbc9a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x440b=['define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x9f033e,_0xa9c326){var _0x467993=function(_0x42f7cb){while(--_0x42f7cb){_0x9f033e['push'](_0x9f033e['shift']());}};_0x467993(++_0xa9c326);}(_0x440b,0x18b));var _0xb440=function(_0x1e2c73,_0x12cd55){_0x1e2c73=_0x1e2c73-0x0;var _0x46f8d5=_0x440b[_0x1e2c73];return _0x46f8d5;};'use strict';var _=require(_0xb440('0x0'));var util=require(_0xb440('0x1'));var logger=require(_0xb440('0x2'))(_0xb440('0x3'));var moment=require(_0xb440('0x4'));var BPromise=require(_0xb440('0x5'));var rp=require(_0xb440('0x6'));var fs=require('fs');var path=require(_0xb440('0x7'));var rimraf=require(_0xb440('0x8'));var config=require(_0xb440('0x9'));var attributes=require('./chatWebsite.attributes');module[_0xb440('0xa')]=function(_0x2d856d,_0x16f9d3){return _0x2d856d[_0xb440('0xb')](_0xb440('0xc'),attributes,{'tableName':_0xb440('0xd'),'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 fde676e..0104292 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 _0x6002=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0xe7aa8a,_0x2eec45){var _0xd7df8c=function(_0x414f72){while(--_0x414f72){_0xe7aa8a['push'](_0xe7aa8a['shift']());}};_0xd7df8c(++_0x2eec45);}(_0x6002,0x117));var _0x2600=function(_0x107132,_0x13f848){_0x107132=_0x107132-0x0;var _0xeb25b1=_0x6002[_0x107132];return _0xeb25b1;};'use strict';var _=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var moment=require('moment');var BPromise=require(_0x2600('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2600('0x3'));var db=require(_0x2600('0x4'))['db'];var utils=require(_0x2600('0x5'));var logger=require(_0x2600('0x6'))('rpc');var config=require(_0x2600('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2600('0x8')][_0x2600('0x9')]({'port':0x232a});config['redis']=_[_0x2600('0xa')](config[_0x2600('0xb')],{'host':_0x2600('0xc'),'port':0x18eb});var socket=require(_0x2600('0xd'))(new Redis(config[_0x2600('0xb')]));require(_0x2600('0xe'))[_0x2600('0xf')](socket);function respondWithRpcPromise(_0x9d0649,_0xa87290,_0x494815){return new BPromise(function(_0x1532db,_0x1b93bf){return client[_0x2600('0x10')](_0x9d0649,_0x494815)[_0x2600('0x11')](function(_0x5b759c){logger[_0x2600('0x12')](_0x2600('0x13'),_0xa87290,_0x2600('0x14'));logger[_0x2600('0x15')](_0x2600('0x16'),_0xa87290,_0x2600('0x14'),JSON[_0x2600('0x17')](_0x5b759c));if(_0x5b759c[_0x2600('0x18')]){if(_0x5b759c[_0x2600('0x18')][_0x2600('0x19')]===0x1f4){logger['error'](_0x2600('0x13'),_0xa87290,_0x5b759c[_0x2600('0x18')][_0x2600('0x1a')]);return _0x1b93bf(_0x5b759c[_0x2600('0x18')][_0x2600('0x1a')]);}logger['error'](_0x2600('0x13'),_0xa87290,_0x5b759c[_0x2600('0x18')][_0x2600('0x1a')]);return _0x1532db(_0x5b759c[_0x2600('0x18')]['message']);}else{logger['info'](_0x2600('0x13'),_0xa87290,_0x2600('0x14'));_0x1532db(_0x5b759c['result'][_0x2600('0x1a')]);}})[_0x2600('0x1b')](function(_0x41db0b){logger[_0x2600('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xa87290,_0x41db0b);_0x1b93bf(_0x41db0b);});});} \ No newline at end of file +var _0xfc57=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then'];(function(_0x3f591e,_0xe02469){var _0x41d0c6=function(_0x112622){while(--_0x112622){_0x3f591e['push'](_0x3f591e['shift']());}};_0x41d0c6(++_0xe02469);}(_0xfc57,0xe2));var _0x7fc5=function(_0x22a648,_0x5e884e){_0x22a648=_0x22a648-0x0;var _0x4c0b91=_0xfc57[_0x22a648];return _0x4c0b91;};'use strict';var _=require('lodash');var util=require(_0x7fc5('0x0'));var moment=require(_0x7fc5('0x1'));var BPromise=require(_0x7fc5('0x2'));var rs=require(_0x7fc5('0x3'));var fs=require('fs');var Redis=require(_0x7fc5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fc5('0x5'));var logger=require(_0x7fc5('0x6'))(_0x7fc5('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fc5('0x8'));var client=jayson[_0x7fc5('0x9')][_0x7fc5('0xa')]({'port':0x232a});config[_0x7fc5('0xb')]=_[_0x7fc5('0xc')](config[_0x7fc5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fc5('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x7fc5('0xe')](socket);function respondWithRpcPromise(_0xf3d595,_0x11b01b,_0x498d63){return new BPromise(function(_0x6e5da0,_0x305b6c){return client[_0x7fc5('0xf')](_0xf3d595,_0x498d63)[_0x7fc5('0x10')](function(_0x12dbb5){logger[_0x7fc5('0x11')](_0x7fc5('0x12'),_0x11b01b,_0x7fc5('0x13'));logger[_0x7fc5('0x14')](_0x7fc5('0x15'),_0x11b01b,_0x7fc5('0x13'),JSON[_0x7fc5('0x16')](_0x12dbb5));if(_0x12dbb5['error']){if(_0x12dbb5['error'][_0x7fc5('0x17')]===0x1f4){logger['error'](_0x7fc5('0x12'),_0x11b01b,_0x12dbb5[_0x7fc5('0x18')]['message']);return _0x305b6c(_0x12dbb5[_0x7fc5('0x18')]['message']);}logger[_0x7fc5('0x18')](_0x7fc5('0x12'),_0x11b01b,_0x12dbb5[_0x7fc5('0x18')][_0x7fc5('0x19')]);return _0x6e5da0(_0x12dbb5[_0x7fc5('0x18')][_0x7fc5('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x11b01b,_0x7fc5('0x13'));_0x6e5da0(_0x12dbb5[_0x7fc5('0x1a')][_0x7fc5('0x19')]);}})['catch'](function(_0x10ac83){logger[_0x7fc5('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x11b01b,_0x10ac83);_0x305b6c(_0x10ac83);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a34e173..f129a41 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 _0x5c27=['update','emit','removeListener','chatWebsite:','./chatWebsite.events','save'];(function(_0x544700,_0x37f134){var _0x39260b=function(_0x4faf4a){while(--_0x4faf4a){_0x544700['push'](_0x544700['shift']());}};_0x39260b(++_0x37f134);}(_0x5c27,0x19c));var _0x75c2=function(_0x54ece6,_0x11a6c6){_0x54ece6=_0x54ece6-0x0;var _0x2cfd35=_0x5c27[_0x54ece6];return _0x2cfd35;};'use strict';var ChatWebsiteEvents=require(_0x75c2('0x0'));var events=[_0x75c2('0x1'),'remove',_0x75c2('0x2')];function createListener(_0x205d27,_0x4844cf){return function(_0x469b63){_0x4844cf[_0x75c2('0x3')](_0x205d27,_0x469b63);};}function removeListener(_0x2d9f08,_0x4f848f){return function(){ChatWebsiteEvents[_0x75c2('0x4')](_0x2d9f08,_0x4f848f);};}exports['register']=function(_0x3b5b92){for(var _0x5b37f5=0x0,_0x28704c=events['length'];_0x5b37f5<_0x28704c;_0x5b37f5++){var _0x44dab3=events[_0x5b37f5];var _0x158299=createListener(_0x75c2('0x5')+_0x44dab3,_0x3b5b92);ChatWebsiteEvents['on'](_0x44dab3,_0x158299);}}; \ No newline at end of file +var _0x25b0=['save','remove','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x309381,_0x336fa7){var _0x11f429=function(_0x206cdf){while(--_0x206cdf){_0x309381['push'](_0x309381['shift']());}};_0x11f429(++_0x336fa7);}(_0x25b0,0x170));var _0x025b=function(_0x22e056,_0x2cc7bd){_0x22e056=_0x22e056-0x0;var _0x20d872=_0x25b0[_0x22e056];return _0x20d872;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x025b('0x0'),_0x025b('0x1'),_0x025b('0x2')];function createListener(_0x3be0a0,_0x2fd3fb){return function(_0x4b270f){_0x2fd3fb[_0x025b('0x3')](_0x3be0a0,_0x4b270f);};}function removeListener(_0x2c6c59,_0x438af9){return function(){ChatWebsiteEvents[_0x025b('0x4')](_0x2c6c59,_0x438af9);};}exports[_0x025b('0x5')]=function(_0x2af29a){for(var _0x1da0fb=0x0,_0x4d6eef=events[_0x025b('0x6')];_0x1da0fb<_0x4d6eef;_0x1da0fb++){var _0x4b3877=events[_0x1da0fb];var _0x5bd27f=createListener(_0x025b('0x7')+_0x4b3877,_0x2af29a);ChatWebsiteEvents['on'](_0x4b3877,_0x5bd27f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9782040..b7c94e9 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 _0x2cb7=['connect-timeout','express','fs-extra','../../components/auth/service','./chatWebsite.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','addDisposition','addAnswer','join','server/files/images/logos/','%s-%s','now','originalname','/:id/logo','single','addLogo','diskStorage','server/files/images/avatars/','format','root','file','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','extname','any','offline','addInteraction','/:id/applications','addApplications','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','/:id/users','removeAgents','exports','util'];(function(_0x5b5e65,_0x4b7417){var _0x230214=function(_0x2d968a){while(--_0x2d968a){_0x5b5e65['push'](_0x5b5e65['shift']());}};_0x230214(++_0x4b7417);}(_0x2cb7,0x81));var _0x72cb=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0x2cb7[_0x699200];return _0x266fd1;};'use strict';var multer=require('multer');var util=require(_0x72cb('0x0'));var path=require('path');var timeout=require(_0x72cb('0x1'));var express=require(_0x72cb('0x2'));var router=express['Router']();var fs_extra=require(_0x72cb('0x3'));var auth=require(_0x72cb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x72cb('0x5'));router['get']('/',auth[_0x72cb('0x6')](),controller[_0x72cb('0x7')]);router[_0x72cb('0x8')]('/describe',auth[_0x72cb('0x6')](),controller[_0x72cb('0x9')]);router[_0x72cb('0x8')](_0x72cb('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x72cb('0xb'),auth[_0x72cb('0x6')](),controller['getDispositions']);router[_0x72cb('0x8')]('/:id/canned_answers',auth[_0x72cb('0x6')](),controller[_0x72cb('0xc')]);router[_0x72cb('0x8')]('/:id/logo',controller[_0x72cb('0xd')]);router[_0x72cb('0x8')](_0x72cb('0xe'),controller['getAvatar']);router[_0x72cb('0x8')](_0x72cb('0xf'),controller[_0x72cb('0x10')]);router[_0x72cb('0x8')](_0x72cb('0x11'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x72cb('0x12')]);router[_0x72cb('0x8')](_0x72cb('0x13'),controller['getSnippet']);router[_0x72cb('0x8')]('/:id/applications',auth[_0x72cb('0x6')](),controller[_0x72cb('0x14')]);router[_0x72cb('0x8')](_0x72cb('0x15'),auth['isAuthenticated'](),controller[_0x72cb('0x16')]);router[_0x72cb('0x8')](_0x72cb('0x17'),controller[_0x72cb('0x18')]);router[_0x72cb('0x8')](_0x72cb('0x19'),auth[_0x72cb('0x6')](),controller['getOfflineMessages']);router[_0x72cb('0x8')]('/:id/users',auth[_0x72cb('0x6')](),controller[_0x72cb('0x1a')]);router[_0x72cb('0x1b')]('/',auth[_0x72cb('0x6')](),controller[_0x72cb('0x1c')]);router['post'](_0x72cb('0xb'),auth[_0x72cb('0x6')](),controller[_0x72cb('0x1d')]);router[_0x72cb('0x1b')]('/:id/canned_answers',auth[_0x72cb('0x6')](),controller[_0x72cb('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a77fd,_0x3ddbe0,_0x24e819){_0x24e819(null,path[_0x72cb('0x1f')](config['root'],_0x72cb('0x20')));},'filename':function(_0x8df478,_0x466e9a,_0x383dca){_0x383dca(null,util['format'](_0x72cb('0x21'),Date[_0x72cb('0x22')](),_0x466e9a[_0x72cb('0x23')]));}})});router[_0x72cb('0x1b')](_0x72cb('0x24'),upload[_0x72cb('0x25')]('file'),controller[_0x72cb('0x26')]);var upload=multer({'storage':multer[_0x72cb('0x27')]({'destination':function(_0x4ac6ed,_0x1023db,_0x349e46){_0x349e46(null,path[_0x72cb('0x1f')](config['root'],_0x72cb('0x28')));},'filename':function(_0x339d3c,_0x12821f,_0xd0b144){_0xd0b144(null,util[_0x72cb('0x29')](_0x72cb('0x21'),Date[_0x72cb('0x22')](),_0x12821f[_0x72cb('0x23')]));}})});router[_0x72cb('0x1b')](_0x72cb('0xe'),upload[_0x72cb('0x25')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x72cb('0x27')]({'destination':function(_0x121ade,_0x4bf9f6,_0x275600){_0x275600(null,path['join'](config[_0x72cb('0x2a')],_0x72cb('0x28')));},'filename':function(_0x5cdf9c,_0x4c7e52,_0xec8a39){_0xec8a39(null,util[_0x72cb('0x29')](_0x72cb('0x21'),Date[_0x72cb('0x22')](),_0x4c7e52['originalname']));}})});router[_0x72cb('0x1b')](_0x72cb('0xf'),upload[_0x72cb('0x25')](_0x72cb('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x72cb('0x27')]({'destination':function(_0x7d1bed,_0x193d47,_0x5437a5){_0x5437a5(null,path[_0x72cb('0x1f')](config[_0x72cb('0x2a')],_0x72cb('0x28')));},'filename':function(_0x6b72bb,_0xac6549,_0x4280ff){_0x4280ff(null,util[_0x72cb('0x29')](_0x72cb('0x21'),Date[_0x72cb('0x22')](),_0xac6549[_0x72cb('0x23')]));}})});router[_0x72cb('0x1b')](_0x72cb('0x11'),upload[_0x72cb('0x25')](_0x72cb('0x2b')),controller[_0x72cb('0x2c')]);router[_0x72cb('0x1b')](_0x72cb('0x2d'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x72cb('0x27')]({'destination':function(_0x57fbb6,_0x56736a,_0x587291){const _0x4eed2e=path[_0x72cb('0x1f')](config[_0x72cb('0x2a')],_0x72cb('0x2e'),_0x72cb('0x2f'),_0x72cb('0x30'));fs_extra['ensureDir'](_0x4eed2e,function(){_0x587291(null,_0x4eed2e);});},'filename':function(_0x32c5c0,_0x283f32,_0x4d548d){const _0xcce1b2=_0x283f32[_0x72cb('0x23')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3f6495=path[_0x72cb('0x31')](_0xcce1b2);const _0x14d615=Date[_0x72cb('0x22')]()+'-'+_0xcce1b2['replace'](_0x3f6495,'')+_0x3f6495;_0x4d548d(null,_0x14d615);}})});router[_0x72cb('0x1b')]('/:id/offline',offlineUploadMulter[_0x72cb('0x32')](),controller[_0x72cb('0x33')]);router[_0x72cb('0x1b')]('/:id/interactions',auth[_0x72cb('0x6')](),controller[_0x72cb('0x34')]);router[_0x72cb('0x1b')](_0x72cb('0x35'),auth[_0x72cb('0x6')](),controller[_0x72cb('0x36')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x72cb('0x37')]('/:id',auth[_0x72cb('0x6')](),controller[_0x72cb('0x38')]);router[_0x72cb('0x39')](_0x72cb('0xa'),auth[_0x72cb('0x6')](),controller[_0x72cb('0x3a')]);router[_0x72cb('0x39')]('/:id/dispositions',auth[_0x72cb('0x6')](),controller[_0x72cb('0x3b')]);router[_0x72cb('0x39')](_0x72cb('0x3c'),auth['isAuthenticated'](),controller[_0x72cb('0x3d')]);router[_0x72cb('0x39')](_0x72cb('0x3e'),auth['isAuthenticated'](),controller[_0x72cb('0x3f')]);module[_0x72cb('0x40')]=router; \ No newline at end of file +var _0x40e8=['/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addAnswer','join','root','server/files/images/logos/','format','originalname','single','file','addLogo','diskStorage','now','addAvatar','server/files/images/avatars/','%s-%s','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x40e8,0x74));var _0x840e=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x40e8[_0x4067ac];return _0x53d74d;};'use strict';var multer=require(_0x840e('0x0'));var util=require('util');var path=require(_0x840e('0x1'));var timeout=require(_0x840e('0x2'));var express=require(_0x840e('0x3'));var router=express[_0x840e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x840e('0x5'));var interaction=require(_0x840e('0x6'));var config=require(_0x840e('0x7'));var controller=require('./chatWebsite.controller');router[_0x840e('0x8')]('/',auth[_0x840e('0x9')](),controller[_0x840e('0xa')]);router[_0x840e('0x8')]('/describe',auth[_0x840e('0x9')](),controller[_0x840e('0xb')]);router[_0x840e('0x8')](_0x840e('0xc'),auth['isAuthenticated'](),controller[_0x840e('0xd')]);router['get'](_0x840e('0xe'),auth[_0x840e('0x9')](),controller[_0x840e('0xf')]);router['get'](_0x840e('0x10'),auth[_0x840e('0x9')](),controller[_0x840e('0x11')]);router[_0x840e('0x8')](_0x840e('0x12'),controller['getLogo']);router['get'](_0x840e('0x13'),controller[_0x840e('0x14')]);router[_0x840e('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x840e('0x8')](_0x840e('0x15'),controller['getSystemAvatar']);router[_0x840e('0x8')](_0x840e('0x16'),auth[_0x840e('0x9')](),controller[_0x840e('0x17')]);router[_0x840e('0x8')](_0x840e('0x18'),controller[_0x840e('0x19')]);router[_0x840e('0x8')](_0x840e('0x1a'),auth[_0x840e('0x9')](),controller[_0x840e('0x1b')]);router['get'](_0x840e('0x1c'),auth[_0x840e('0x9')](),controller[_0x840e('0x1d')]);router[_0x840e('0x8')](_0x840e('0x1e'),controller[_0x840e('0x1f')]);router[_0x840e('0x8')](_0x840e('0x20'),auth['isAuthenticated'](),controller[_0x840e('0x21')]);router[_0x840e('0x8')](_0x840e('0x22'),auth['isAuthenticated'](),controller[_0x840e('0x23')]);router['post']('/',auth[_0x840e('0x9')](),controller[_0x840e('0x24')]);router[_0x840e('0x25')]('/:id/dispositions',auth[_0x840e('0x9')](),controller['addDisposition']);router[_0x840e('0x25')](_0x840e('0x10'),auth[_0x840e('0x9')](),controller[_0x840e('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x159950,_0x342627,_0x1ea2e0){_0x1ea2e0(null,path[_0x840e('0x27')](config[_0x840e('0x28')],_0x840e('0x29')));},'filename':function(_0x1c7b75,_0x1f5b1f,_0x2fc83e){_0x2fc83e(null,util[_0x840e('0x2a')]('%s-%s',Date['now'](),_0x1f5b1f[_0x840e('0x2b')]));}})});router['post']('/:id/logo',upload[_0x840e('0x2c')](_0x840e('0x2d')),controller[_0x840e('0x2e')]);var upload=multer({'storage':multer[_0x840e('0x2f')]({'destination':function(_0x590d2d,_0x3daf29,_0x54005a){_0x54005a(null,path[_0x840e('0x27')](config[_0x840e('0x28')],'server/files/images/avatars/'));},'filename':function(_0x45968a,_0x3f48f9,_0xbf6eb1){_0xbf6eb1(null,util[_0x840e('0x2a')]('%s-%s',Date[_0x840e('0x30')](),_0x3f48f9['originalname']));}})});router[_0x840e('0x25')]('/:id/avatar',upload['single'](_0x840e('0x2d')),controller[_0x840e('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25d594,_0x1203c5,_0x587b65){_0x587b65(null,path['join'](config[_0x840e('0x28')],_0x840e('0x32')));},'filename':function(_0x2f94d2,_0x3dee4a,_0x333f2d){_0x333f2d(null,util['format'](_0x840e('0x33'),Date[_0x840e('0x30')](),_0x3dee4a[_0x840e('0x2b')]));}})});router[_0x840e('0x25')](_0x840e('0x34'),upload['single'](_0x840e('0x2d')),controller[_0x840e('0x35')]);var upload=multer({'storage':multer[_0x840e('0x2f')]({'destination':function(_0x269015,_0x5a8d81,_0x28fddd){_0x28fddd(null,path[_0x840e('0x27')](config[_0x840e('0x28')],_0x840e('0x32')));},'filename':function(_0x432350,_0x3e5608,_0x4412bb){_0x4412bb(null,util['format']('%s-%s',Date[_0x840e('0x30')](),_0x3e5608[_0x840e('0x2b')]));}})});router[_0x840e('0x25')](_0x840e('0x15'),upload['single']('file'),controller[_0x840e('0x36')]);router[_0x840e('0x25')]('/:id/notify',controller[_0x840e('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x840e('0x2f')]({'destination':function(_0x1e6af7,_0x341d02,_0x49b338){const _0x5bad33=path[_0x840e('0x27')](config[_0x840e('0x28')],_0x840e('0x38'),_0x840e('0x39'),'offline-chat');fs_extra[_0x840e('0x3a')](_0x5bad33,function(){_0x49b338(null,_0x5bad33);});},'filename':function(_0x22878f,_0x31e91d,_0x3cbc98){const _0xe1136c=_0x31e91d[_0x840e('0x2b')][_0x840e('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xb08292=path['extname'](_0xe1136c);const _0x193c9c=Date[_0x840e('0x30')]()+'-'+_0xe1136c[_0x840e('0x3b')](_0xb08292,'')+_0xb08292;_0x3cbc98(null,_0x193c9c);}})});router[_0x840e('0x25')](_0x840e('0x3c'),offlineUploadMulter[_0x840e('0x3d')](),controller[_0x840e('0x3e')]);router[_0x840e('0x25')](_0x840e('0x16'),auth['isAuthenticated'](),controller[_0x840e('0x3f')]);router[_0x840e('0x25')](_0x840e('0x1a'),auth[_0x840e('0x9')](),controller[_0x840e('0x40')]);router['post']('/:id/proactive_actions',auth[_0x840e('0x9')](),controller[_0x840e('0x41')]);router[_0x840e('0x25')]('/:id/users',auth[_0x840e('0x9')](),controller[_0x840e('0x42')]);router[_0x840e('0x43')](_0x840e('0xc'),auth[_0x840e('0x9')](),controller[_0x840e('0x44')]);router[_0x840e('0x45')](_0x840e('0xc'),auth['isAuthenticated'](),controller[_0x840e('0x46')]);router[_0x840e('0x45')]('/:id/dispositions',auth[_0x840e('0x9')](),controller[_0x840e('0x47')]);router[_0x840e('0x45')](_0x840e('0x10'),auth[_0x840e('0x9')](),controller[_0x840e('0x48')]);router[_0x840e('0x45')](_0x840e('0x22'),auth[_0x840e('0x9')](),controller[_0x840e('0x49')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 22a4f10..c934aec 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 _0x84f9=['env','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','beaver-logger/server','express','../components/auth/service','Router'];(function(_0x5ad358,_0x342f88){var _0x190226=function(_0x3c7ead){while(--_0x3c7ead){_0x5ad358['push'](_0x5ad358['shift']());}};_0x190226(++_0x342f88);}(_0x84f9,0x13b));var _0x984f=function(_0x46275a,_0x157c56){_0x46275a=_0x46275a-0x0;var _0x1b6b39=_0x84f9[_0x46275a];return _0x1b6b39;};var beaverLogger=require(_0x984f('0x0'));var express=require(_0x984f('0x1'));var auth=require(_0x984f('0x2'));var config=require('../config/environment');var router=express[_0x984f('0x3')]();var isProduction=config[_0x984f('0x4')]==='production'||![];function clientSideLogs(_0x170a9a,_0x1b4238,_0x2c65f2){var _0x225b2c=_0x170a9a[_0x984f('0x5')][_0x984f('0x6')]('client-side-logger');if(!_0x225b2c){throw new Error(_0x984f('0x7'));}return beaverLogger[_0x984f('0x8')]({'uri':'/client-logs','logger':_0x225b2c,'enableCors':!isProduction})(_0x170a9a,_0x1b4238,_0x2c65f2);}router[_0x984f('0x9')](auth[_0x984f('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x55e8=['use','isAuthenticated','../config/environment','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55e8,0xe9));var _0x855e=function(_0x50849b,_0x4fe986){_0x50849b=_0x50849b-0x0;var _0x3c5f2a=_0x55e8[_0x50849b];return _0x3c5f2a;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require(_0x855e('0x0'));var router=express[_0x855e('0x1')]();var isProduction=config[_0x855e('0x2')]===_0x855e('0x3')||![];function clientSideLogs(_0x107649,_0x3e8802,_0x4d590f){var _0x4687e9=_0x107649[_0x855e('0x4')]['get'](_0x855e('0x5'));if(!_0x4687e9){throw new Error(_0x855e('0x6'));}return beaverLogger[_0x855e('0x7')]({'uri':_0x855e('0x8'),'logger':_0x4687e9,'enableCors':!isProduction})(_0x107649,_0x3e8802,_0x4d590f);}router[_0x855e('0x9')](auth[_0x855e('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e28a0e1..02fdab3 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 _0x9165=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x16d2c3,_0x3ca212){var _0x538674=function(_0x549e0b){while(--_0x549e0b){_0x16d2c3['push'](_0x16d2c3['shift']());}};_0x538674(++_0x3ca212);}(_0x9165,0x17e));var _0x5916=function(_0x3dbce7,_0x1756dd){_0x3dbce7=_0x3dbce7-0x0;var _0x226f10=_0x9165[_0x3dbce7];return _0x226f10;};'use strict';var Sequelize=require('sequelize');module[_0x5916('0x0')]={'name':{'type':Sequelize[_0x5916('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5916('0x2')](_0x5916('0x3'),'Google',_0x5916('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5916('0x2')](_0x5916('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x5916('0x1')],'comment':_0x5916('0x6')},'data2':{'type':Sequelize[_0x5916('0x1')],'comment':_0x5916('0x7')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x5916('0x8')},'data5':{'type':Sequelize[_0x5916('0x9')],'comment':_0x5916('0xa')},'data6':{'type':Sequelize[_0x5916('0x9')],'comment':_0x5916('0xb')},'data7':{'type':Sequelize[_0x5916('0x9')],'comment':_0x5916('0xc')}}; \ No newline at end of file +var _0x54b2=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0xd911fc,_0x34372f){var _0x531b21=function(_0x23efca){while(--_0x23efca){_0xd911fc['push'](_0xd911fc['shift']());}};_0x531b21(++_0x34372f);}(_0x54b2,0xa6));var _0x254b=function(_0x4add46,_0x40c151){_0x4add46=_0x4add46-0x0;var _0x13fe3d=_0x54b2[_0x4add46];return _0x13fe3d;};'use strict';var Sequelize=require(_0x254b('0x0'));module[_0x254b('0x1')]={'name':{'type':Sequelize[_0x254b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x254b('0x3')](_0x254b('0x4'),_0x254b('0x5'),_0x254b('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x254b('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x254b('0x2')],'comment':_0x254b('0x8')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x254b('0x2')],'comment':_0x254b('0x9')},'data4':{'type':Sequelize[_0x254b('0x2')],'comment':_0x254b('0xa')},'data5':{'type':Sequelize[_0x254b('0xb')],'comment':_0x254b('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x254b('0xb')],'comment':_0x254b('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index cd50272..5a87b87 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 _0x6881=['catch','update','MicrosoftAzure','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','base64','toString','ascii','parse','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','findAll','rows','service','decryptString','data3','show','params','keys','include','options','find','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6881,0x139));var _0x1688=function(_0xbcb35c,_0x927e24){_0xbcb35c=_0xbcb35c-0x0;var _0x47702d=_0x6881[_0xbcb35c];return _0x47702d;};'use strict';var _=require(_0x1688('0x0'));var Redis=require(_0x1688('0x1'));var qs=require(_0x1688('0x2'));var encryptor=require(_0x1688('0x3'));var config=require(_0x1688('0x4'));var logger=require('../../config/logger')('api');var db=require(_0x1688('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x1688('0x6')](config[_0x1688('0x7')],{'host':_0x1688('0x8'),'port':0x18eb});var socket=require(_0x1688('0x9'))(new Redis(config[_0x1688('0x7')]));var redis=new Redis(config[_0x1688('0x7')]);function respondWithStatusCode(_0x21b2f5,_0x4f0016){_0x4f0016=_0x4f0016||0xcc;return function(_0x3cce22){if(_0x3cce22){return _0x21b2f5['sendStatus'](_0x4f0016);}return _0x21b2f5[_0x1688('0xa')](_0x4f0016)[_0x1688('0xb')]();};}function respondWithResult(_0x328f70,_0x276baa){_0x276baa=_0x276baa||0xc8;return function(_0x2137c6){if(_0x2137c6){return _0x328f70[_0x1688('0xa')](_0x276baa)[_0x1688('0xc')](_0x2137c6);}};}function respondWithFilteredResult(_0x1d5a2e,_0x19e16b){return function(_0x2b8c30){if(_0x2b8c30){var _0x3fcfb8=typeof _0x19e16b['offset']===_0x1688('0xd')&&typeof _0x19e16b[_0x1688('0xe')]===_0x1688('0xd');var _0x2c0332=_0x2b8c30[_0x1688('0xf')];var _0x11e61b=_0x3fcfb8?0x0:_0x19e16b['offset'];var _0x38a364=_0x3fcfb8?_0x2b8c30[_0x1688('0xf')]:_0x19e16b[_0x1688('0x10')]+_0x19e16b[_0x1688('0xe')];var _0x407fec;if(_0x38a364>=_0x2c0332){_0x38a364=_0x2c0332;_0x407fec=0xc8;}else{_0x407fec=0xce;}_0x1d5a2e[_0x1688('0xa')](_0x407fec);return _0x1d5a2e[_0x1688('0x11')](_0x1688('0x12'),_0x11e61b+'-'+_0x38a364+'/'+_0x2c0332)[_0x1688('0xc')](_0x2b8c30);}return null;};}function saveUpdates(_0x244148){return function(_0x3ae22a){if(_0x3ae22a){return _0x3ae22a['update'](_0x244148)['then'](function(_0x4f92be){return _0x4f92be;});}return null;};}function removeEntity(_0x3af8ad){return function(_0x354ce0){if(_0x354ce0){return _0x354ce0[_0x1688('0x13')]()['then'](function(){_0x3af8ad[_0x1688('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33694a){return function(_0x2029aa){if(!_0x2029aa){_0x33694a[_0x1688('0x14')](0x194);}return _0x2029aa;};}function handleError(_0x2242c7,_0x5a8969){_0x5a8969=_0x5a8969||0x1f4;return function(_0xc45f65){logger[_0x1688('0x15')](_0xc45f65[_0x1688('0x16')]);if(_0xc45f65[_0x1688('0x17')]){delete _0xc45f65[_0x1688('0x17')];}_0x2242c7['status'](_0x5a8969)[_0x1688('0x18')](_0xc45f65);};}function maskClientSecret(_0x12f37d){return _[_0x1688('0x19')](_0x12f37d[_0x1688('0x1a')](0x0,0x3),0x14,'*');}exports[_0x1688('0x1b')]=function(_0xab4d08,_0x4cc549){var _0x31315c={},_0x261336={},_0x4f6dbb={'count':0x0,'rows':[]};var _0xa5fcde=_[_0x1688('0x1c')](db[_0x1688('0x1d')][_0x1688('0x1e')],function(_0x5569a5){return{'name':_0x5569a5[_0x1688('0x1f')],'type':_0x5569a5[_0x1688('0x20')][_0x1688('0x21')]};});_0x261336[_0x1688('0x22')]=_['map'](_0xa5fcde,_0x1688('0x17'));_0x261336[_0x1688('0x23')]=_['keys'](_0xab4d08[_0x1688('0x23')]);_0x261336[_0x1688('0x24')]=_[_0x1688('0x25')](_0x261336[_0x1688('0x22')],_0x261336[_0x1688('0x23')]);_0x31315c[_0x1688('0x26')]=_[_0x1688('0x25')](_0x261336[_0x1688('0x22')],qs[_0x1688('0x27')](_0xab4d08[_0x1688('0x23')][_0x1688('0x27')]));_0x31315c[_0x1688('0x26')]=_0x31315c[_0x1688('0x26')][_0x1688('0x28')]?_0x31315c[_0x1688('0x26')]:_0x261336[_0x1688('0x22')];if(!_0xab4d08[_0x1688('0x23')]['hasOwnProperty'](_0x1688('0x29'))){_0x31315c[_0x1688('0xe')]=qs[_0x1688('0xe')](_0xab4d08[_0x1688('0x23')][_0x1688('0xe')]);_0x31315c[_0x1688('0x10')]=qs[_0x1688('0x10')](_0xab4d08[_0x1688('0x23')][_0x1688('0x10')]);}_0x31315c[_0x1688('0x2a')]=qs[_0x1688('0x2b')](_0xab4d08[_0x1688('0x23')][_0x1688('0x2b')]);_0x31315c[_0x1688('0x2c')]=qs[_0x1688('0x24')](_[_0x1688('0x2d')](_0xab4d08[_0x1688('0x23')],_0x261336[_0x1688('0x24')]),_0xa5fcde);if(_0xab4d08['query']['filter']){_0x31315c['where']=_[_0x1688('0x2e')](_0x31315c[_0x1688('0x2c')],{'$or':_['map'](_0xa5fcde,function(_0x52eb43){if(_0x52eb43[_0x1688('0x20')]!==_0x1688('0x2f')){var _0x2d1075={};_0x2d1075[_0x52eb43['name']]={'$like':'%'+_0xab4d08[_0x1688('0x23')][_0x1688('0x30')]+'%'};return _0x2d1075;}})});}_0x31315c=_[_0x1688('0x2e')]({},_0x31315c,_0xab4d08['options']);var _0x184d44={'where':_0x31315c[_0x1688('0x2c')]};return db[_0x1688('0x1d')]['count'](_0x184d44)[_0x1688('0x31')](function(_0x50e1b7){_0x4f6dbb[_0x1688('0xf')]=_0x50e1b7;if(_0xab4d08[_0x1688('0x23')][_0x1688('0x32')]){_0x31315c['include']=[{'all':!![]}];}return db[_0x1688('0x1d')][_0x1688('0x33')](_0x31315c);})[_0x1688('0x31')](function(_0x282a74){_0x4f6dbb[_0x1688('0x34')]=_[_0x1688('0x1c')](_0x282a74,function(_0x181d61){if(_0x181d61[_0x1688('0x35')]==='MicrosoftAzure'){var _0x2f1639=encryptor[_0x1688('0x36')](_0x181d61[_0x1688('0x37')]);_0x181d61[_0x1688('0x37')]=maskClientSecret(_0x2f1639);}return _0x181d61;});return _0x4f6dbb;})[_0x1688('0x31')](respondWithFilteredResult(_0x4cc549,_0x31315c))['catch'](handleError(_0x4cc549,null));};exports[_0x1688('0x38')]=function(_0x338136,_0x35d702){var _0x49e3d0={'raw':!![],'where':{'id':_0x338136[_0x1688('0x39')]['id']}},_0xeaf9cb={};_0xeaf9cb[_0x1688('0x22')]=_[_0x1688('0x3a')](db['CloudProvider'][_0x1688('0x1e')]);_0xeaf9cb[_0x1688('0x23')]=_['keys'](_0x338136[_0x1688('0x23')]);_0xeaf9cb[_0x1688('0x24')]=_['intersection'](_0xeaf9cb[_0x1688('0x22')],_0xeaf9cb[_0x1688('0x23')]);_0x49e3d0[_0x1688('0x26')]=_[_0x1688('0x25')](_0xeaf9cb[_0x1688('0x22')],qs[_0x1688('0x27')](_0x338136['query'][_0x1688('0x27')]));_0x49e3d0[_0x1688('0x26')]=_0x49e3d0[_0x1688('0x26')][_0x1688('0x28')]?_0x49e3d0[_0x1688('0x26')]:_0xeaf9cb['model'];if(_0x338136[_0x1688('0x23')]['includeAll']){_0x49e3d0[_0x1688('0x3b')]=[{'all':!![]}];}_0x49e3d0=_[_0x1688('0x2e')]({},_0x49e3d0,_0x338136[_0x1688('0x3c')]);return db[_0x1688('0x1d')][_0x1688('0x3d')](_0x49e3d0)['then'](handleEntityNotFound(_0x35d702,null))[_0x1688('0x31')](function(_0x3074e3){if(_0x3074e3[_0x1688('0x35')]==='MicrosoftAzure'){var _0x3d84d6=encryptor[_0x1688('0x36')](_0x3074e3[_0x1688('0x37')]);_0x3074e3[_0x1688('0x37')]=maskClientSecret(_0x3d84d6);}return _0x3074e3;})['then'](respondWithResult(_0x35d702,null))['catch'](handleError(_0x35d702,null));};exports['create']=function(_0x1c2c74,_0x5adb3d){if(!_0x1c2c74['body'][_0x1688('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1c2c74[_0x1688('0x3e')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x28aa89=db[_0x1688('0x1d')][_0x1688('0x1e')][_0x1688('0x35')]['values'];if(!_0x28aa89['includes'](_0x1c2c74[_0x1688('0x3e')]['service']))throw new Error(_0x1688('0x3f')+_0x28aa89[_0x1688('0x40')](',\x20'));if(_0x1c2c74[_0x1688('0x3e')]['service']==='MicrosoftAzure'&&_0x1c2c74[_0x1688('0x3e')]['data3']){_0x1c2c74[_0x1688('0x3e')][_0x1688('0x37')]=encryptor[_0x1688('0x41')](_0x1c2c74['body']['data3']);}return db[_0x1688('0x1d')][_0x1688('0x42')](_0x1c2c74[_0x1688('0x3e')],{})[_0x1688('0x31')](respondWithResult(_0x5adb3d,0xc9))[_0x1688('0x43')](handleError(_0x5adb3d,null));};exports[_0x1688('0x44')]=function(_0x390483,_0x280c90){if(_0x390483[_0x1688('0x3e')]['id']){delete _0x390483[_0x1688('0x3e')]['id'];}return db[_0x1688('0x1d')]['find']({'where':{'id':_0x390483[_0x1688('0x39')]['id']}})[_0x1688('0x31')](handleEntityNotFound(_0x280c90,null))[_0x1688('0x31')](function(_0x4c32ff){if(_0x4c32ff[_0x1688('0x35')]===_0x1688('0x45')&&_0x390483[_0x1688('0x3e')][_0x1688('0x37')]){_0x390483[_0x1688('0x3e')][_0x1688('0x37')]=encryptor[_0x1688('0x41')](_0x390483[_0x1688('0x3e')][_0x1688('0x37')]);}return _0x4c32ff;})[_0x1688('0x31')](saveUpdates(_0x390483[_0x1688('0x3e')],null))['then'](respondWithResult(_0x280c90,null))['catch'](handleError(_0x280c90,null));};exports[_0x1688('0x13')]=function(_0x13ddff,_0x471627){return db[_0x1688('0x1d')][_0x1688('0x3d')]({'where':{'id':_0x13ddff[_0x1688('0x39')]['id']}})[_0x1688('0x31')](handleEntityNotFound(_0x471627,null))['then'](removeEntity(_0x471627,null))[_0x1688('0x43')](handleError(_0x471627,null));};exports[_0x1688('0x46')]=function(_0x547c97,_0x1f7ab0){return db[_0x1688('0x1d')][_0x1688('0x47')]({'where':{'id':_0x547c97[_0x1688('0x39')]['id']},'raw':!![]})['then'](function(_0x4c4ff5){if(!_0x4c4ff5)return _0x1f7ab0[_0x1688('0x14')](0x194);return{'url':oauth[_0x1688('0x48')](_0x4c4ff5,_0x547c97[_0x1688('0x49')]['id'])};})['then'](respondWithResult(_0x1f7ab0,null))[_0x1688('0x43')](handleError(_0x1f7ab0,null));};exports[_0x1688('0x4a')]=function(_0x5e7b2e,_0x26b9c3){var _0x438352=_0x5e7b2e[_0x1688('0x3e')];var _0x16c586;var _0x4186fc;if(_0x438352[_0x1688('0x15')])throw _0x438352;redis[_0x1688('0x4b')](_0x438352[_0x1688('0x4c')])[_0x1688('0x31')](function(_0x53dca6){if(!_0x53dca6)throw new Error('Invalid\x20state\x20parameter');_0x16c586=JSON['parse'](_0x53dca6);var _0x622553=Buffer['from'](_0x438352[_0x1688('0x4c')],_0x1688('0x4d'))[_0x1688('0x4e')](_0x1688('0x4f'));_0x4186fc=JSON[_0x1688('0x50')](_0x622553);if(!oauth['isValidIdToken'](_0x438352['id_token'],_0x16c586[_0x1688('0x51')]))throw new Error(_0x1688('0x52'));redis[_0x1688('0x53')](_0x438352[_0x1688('0x4c')]);return oauth[_0x1688('0x54')](_0x438352[_0x1688('0x55')],_0x16c586);})[_0x1688('0x31')](function(_0x235f0a){_0x16c586['data5']=_0x235f0a['access_token'];_0x16c586[_0x1688('0x56')]=_0x235f0a[_0x1688('0x57')];return db[_0x1688('0x1d')][_0x1688('0x44')]({'data5':_0x16c586[_0x1688('0x58')],'data6':_0x16c586[_0x1688('0x56')]},{'where':{'id':_0x16c586['id']}});})[_0x1688('0x31')](function(){oauth[_0x1688('0x59')](_0x16c586);socket['emit']('microsoftAuthorization:success',{'id':_0x4186fc['id']});return;})[_0x1688('0x31')](respondWithStatusCode(_0x26b9c3,null))[_0x1688('0x43')](function(_0x17f86f){if(_0x4186fc){socket[_0x1688('0x5a')](_0x1688('0x5b'),{'id':_0x4186fc['id']});}if(!_0x16c586){logger[_0x1688('0x15')](_0x1688('0x5c'),_0x17f86f);return _0x26b9c3[_0x1688('0xa')](0x1f4)[_0x1688('0x18')](_0x17f86f['message']);}logger[_0x1688('0x15')](_0x1688('0x5d'),_0x16c586['id'],JSON[_0x1688('0x5e')](_0x17f86f));});}; \ No newline at end of file +var _0x91f3=['filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','find','create','Service\x20parameter\x20not\x20specified','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','catch','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','id_token','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','count','set','Content-Range','json','update','destroy','then','error','stack','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x91f3,0x13c));var _0x391f=function(_0x598efc,_0x5e971c){_0x598efc=_0x598efc-0x0;var _0x435e4f=_0x91f3[_0x598efc];return _0x435e4f;};'use strict';var _=require(_0x391f('0x0'));var Redis=require(_0x391f('0x1'));var qs=require(_0x391f('0x2'));var encryptor=require(_0x391f('0x3'));var config=require(_0x391f('0x4'));var logger=require(_0x391f('0x5'))('api');var db=require(_0x391f('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x391f('0x7')]=_['defaults'](config[_0x391f('0x7')],{'host':_0x391f('0x8'),'port':0x18eb});var socket=require(_0x391f('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x391f('0x7')]);function respondWithStatusCode(_0x20f60e,_0x32b3bc){_0x32b3bc=_0x32b3bc||0xcc;return function(_0xc568d8){if(_0xc568d8){return _0x20f60e[_0x391f('0xa')](_0x32b3bc);}return _0x20f60e[_0x391f('0xb')](_0x32b3bc)[_0x391f('0xc')]();};}function respondWithResult(_0x3871dd,_0x51bd71){_0x51bd71=_0x51bd71||0xc8;return function(_0x56b8db){if(_0x56b8db){return _0x3871dd['status'](_0x51bd71)['json'](_0x56b8db);}};}function respondWithFilteredResult(_0x59c2e1,_0x479452){return function(_0x57ab95){if(_0x57ab95){var _0x20d0db=typeof _0x479452[_0x391f('0xd')]==='undefined'&&typeof _0x479452[_0x391f('0xe')]==='undefined';var _0x1c93d3=_0x57ab95[_0x391f('0xf')];var _0x673393=_0x20d0db?0x0:_0x479452[_0x391f('0xd')];var _0x30589a=_0x20d0db?_0x57ab95[_0x391f('0xf')]:_0x479452['offset']+_0x479452[_0x391f('0xe')];var _0x1a8891;if(_0x30589a>=_0x1c93d3){_0x30589a=_0x1c93d3;_0x1a8891=0xc8;}else{_0x1a8891=0xce;}_0x59c2e1[_0x391f('0xb')](_0x1a8891);return _0x59c2e1[_0x391f('0x10')](_0x391f('0x11'),_0x673393+'-'+_0x30589a+'/'+_0x1c93d3)[_0x391f('0x12')](_0x57ab95);}return null;};}function saveUpdates(_0x4d17f3){return function(_0xaa9a80){if(_0xaa9a80){return _0xaa9a80[_0x391f('0x13')](_0x4d17f3)['then'](function(_0xe45580){return _0xe45580;});}return null;};}function removeEntity(_0x788a3){return function(_0x19f5aa){if(_0x19f5aa){return _0x19f5aa[_0x391f('0x14')]()[_0x391f('0x15')](function(){_0x788a3[_0x391f('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c522){return function(_0x5322f0){if(!_0x5322f0){_0x40c522[_0x391f('0xa')](0x194);}return _0x5322f0;};}function handleError(_0x3ddd2b,_0x5e0d95){_0x5e0d95=_0x5e0d95||0x1f4;return function(_0xb3a4c9){logger[_0x391f('0x16')](_0xb3a4c9[_0x391f('0x17')]);if(_0xb3a4c9['name']){delete _0xb3a4c9['name'];}_0x3ddd2b[_0x391f('0xb')](_0x5e0d95)[_0x391f('0x18')](_0xb3a4c9);};}function maskClientSecret(_0x428f32){return _['padEnd'](_0x428f32['slice'](0x0,0x3),0x14,'*');}exports[_0x391f('0x19')]=function(_0x5d179b,_0x57e96a){var _0x565699={},_0xfcadec={},_0xc6622e={'count':0x0,'rows':[]};var _0x713a07=_[_0x391f('0x1a')](db[_0x391f('0x1b')][_0x391f('0x1c')],function(_0x1f87c9){return{'name':_0x1f87c9[_0x391f('0x1d')],'type':_0x1f87c9[_0x391f('0x1e')][_0x391f('0x1f')]};});_0xfcadec[_0x391f('0x20')]=_[_0x391f('0x1a')](_0x713a07,_0x391f('0x21'));_0xfcadec[_0x391f('0x22')]=_[_0x391f('0x23')](_0x5d179b[_0x391f('0x22')]);_0xfcadec[_0x391f('0x24')]=_[_0x391f('0x25')](_0xfcadec['model'],_0xfcadec[_0x391f('0x22')]);_0x565699[_0x391f('0x26')]=_[_0x391f('0x25')](_0xfcadec[_0x391f('0x20')],qs[_0x391f('0x27')](_0x5d179b[_0x391f('0x22')][_0x391f('0x27')]));_0x565699[_0x391f('0x26')]=_0x565699[_0x391f('0x26')][_0x391f('0x28')]?_0x565699[_0x391f('0x26')]:_0xfcadec['model'];if(!_0x5d179b['query']['hasOwnProperty'](_0x391f('0x29'))){_0x565699[_0x391f('0xe')]=qs[_0x391f('0xe')](_0x5d179b['query'][_0x391f('0xe')]);_0x565699[_0x391f('0xd')]=qs[_0x391f('0xd')](_0x5d179b[_0x391f('0x22')]['offset']);}_0x565699[_0x391f('0x2a')]=qs[_0x391f('0x2b')](_0x5d179b[_0x391f('0x22')][_0x391f('0x2b')]);_0x565699['where']=qs[_0x391f('0x24')](_['pick'](_0x5d179b[_0x391f('0x22')],_0xfcadec[_0x391f('0x24')]),_0x713a07);if(_0x5d179b[_0x391f('0x22')][_0x391f('0x2c')]){_0x565699['where']=_[_0x391f('0x2d')](_0x565699['where'],{'$or':_[_0x391f('0x1a')](_0x713a07,function(_0x50721a){if(_0x50721a['type']!==_0x391f('0x2e')){var _0x44295f={};_0x44295f[_0x50721a['name']]={'$like':'%'+_0x5d179b[_0x391f('0x22')][_0x391f('0x2c')]+'%'};return _0x44295f;}})});}_0x565699=_[_0x391f('0x2d')]({},_0x565699,_0x5d179b[_0x391f('0x2f')]);var _0x591564={'where':_0x565699[_0x391f('0x30')]};return db[_0x391f('0x1b')][_0x391f('0xf')](_0x591564)['then'](function(_0x4ed686){_0xc6622e[_0x391f('0xf')]=_0x4ed686;if(_0x5d179b[_0x391f('0x22')][_0x391f('0x31')]){_0x565699['include']=[{'all':!![]}];}return db[_0x391f('0x1b')][_0x391f('0x32')](_0x565699);})[_0x391f('0x15')](function(_0x2cd325){_0xc6622e[_0x391f('0x33')]=_[_0x391f('0x1a')](_0x2cd325,function(_0x449ba9){if(_0x449ba9[_0x391f('0x34')]===_0x391f('0x35')){var _0x2a75d1=encryptor[_0x391f('0x36')](_0x449ba9['data3']);_0x449ba9[_0x391f('0x37')]=maskClientSecret(_0x2a75d1);}return _0x449ba9;});return _0xc6622e;})[_0x391f('0x15')](respondWithFilteredResult(_0x57e96a,_0x565699))['catch'](handleError(_0x57e96a,null));};exports[_0x391f('0x38')]=function(_0x5c883e,_0x5cd244){var _0x43a6f9={'raw':!![],'where':{'id':_0x5c883e[_0x391f('0x39')]['id']}},_0x553006={};_0x553006[_0x391f('0x20')]=_[_0x391f('0x23')](db[_0x391f('0x1b')][_0x391f('0x1c')]);_0x553006['query']=_[_0x391f('0x23')](_0x5c883e[_0x391f('0x22')]);_0x553006[_0x391f('0x24')]=_['intersection'](_0x553006['model'],_0x553006[_0x391f('0x22')]);_0x43a6f9[_0x391f('0x26')]=_[_0x391f('0x25')](_0x553006[_0x391f('0x20')],qs[_0x391f('0x27')](_0x5c883e[_0x391f('0x22')][_0x391f('0x27')]));_0x43a6f9['attributes']=_0x43a6f9['attributes'][_0x391f('0x28')]?_0x43a6f9[_0x391f('0x26')]:_0x553006[_0x391f('0x20')];if(_0x5c883e[_0x391f('0x22')]['includeAll']){_0x43a6f9['include']=[{'all':!![]}];}_0x43a6f9=_[_0x391f('0x2d')]({},_0x43a6f9,_0x5c883e['options']);return db[_0x391f('0x1b')][_0x391f('0x3a')](_0x43a6f9)[_0x391f('0x15')](handleEntityNotFound(_0x5cd244,null))[_0x391f('0x15')](function(_0x1f9ae4){if(_0x1f9ae4[_0x391f('0x34')]===_0x391f('0x35')){var _0x20c4d3=encryptor[_0x391f('0x36')](_0x1f9ae4[_0x391f('0x37')]);_0x1f9ae4[_0x391f('0x37')]=maskClientSecret(_0x20c4d3);}return _0x1f9ae4;})[_0x391f('0x15')](respondWithResult(_0x5cd244,null))['catch'](handleError(_0x5cd244,null));};exports[_0x391f('0x3b')]=function(_0x352d2c,_0x541ba3){if(!_0x352d2c['body'][_0x391f('0x21')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x352d2c['body'][_0x391f('0x34')])throw new Error(_0x391f('0x3c'));var _0xeff2ec=db[_0x391f('0x1b')]['rawAttributes'][_0x391f('0x34')]['values'];if(!_0xeff2ec['includes'](_0x352d2c[_0x391f('0x3d')][_0x391f('0x34')]))throw new Error(_0x391f('0x3e')+_0xeff2ec[_0x391f('0x3f')](',\x20'));if(_0x352d2c[_0x391f('0x3d')][_0x391f('0x34')]===_0x391f('0x35')&&_0x352d2c[_0x391f('0x3d')][_0x391f('0x37')]){_0x352d2c['body'][_0x391f('0x37')]=encryptor['encryptString'](_0x352d2c[_0x391f('0x3d')][_0x391f('0x37')]);}return db[_0x391f('0x1b')][_0x391f('0x3b')](_0x352d2c[_0x391f('0x3d')],{})[_0x391f('0x15')](respondWithResult(_0x541ba3,0xc9))[_0x391f('0x40')](handleError(_0x541ba3,null));};exports[_0x391f('0x13')]=function(_0x1d7bc4,_0x19b9cd){if(_0x1d7bc4[_0x391f('0x3d')]['id']){delete _0x1d7bc4['body']['id'];}return db[_0x391f('0x1b')][_0x391f('0x3a')]({'where':{'id':_0x1d7bc4['params']['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x19b9cd,null))[_0x391f('0x15')](function(_0x255775){if(_0x255775[_0x391f('0x34')]===_0x391f('0x35')&&_0x1d7bc4[_0x391f('0x3d')][_0x391f('0x37')]){_0x1d7bc4[_0x391f('0x3d')][_0x391f('0x37')]=encryptor[_0x391f('0x41')](_0x1d7bc4[_0x391f('0x3d')]['data3']);}return _0x255775;})[_0x391f('0x15')](saveUpdates(_0x1d7bc4[_0x391f('0x3d')],null))[_0x391f('0x15')](respondWithResult(_0x19b9cd,null))[_0x391f('0x40')](handleError(_0x19b9cd,null));};exports[_0x391f('0x14')]=function(_0x3a345e,_0x51613c){return db[_0x391f('0x1b')][_0x391f('0x3a')]({'where':{'id':_0x3a345e[_0x391f('0x39')]['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x51613c,null))[_0x391f('0x15')](removeEntity(_0x51613c,null))['catch'](handleError(_0x51613c,null));};exports[_0x391f('0x42')]=function(_0x55686e,_0x541bc5){return db['CloudProvider'][_0x391f('0x43')]({'where':{'id':_0x55686e[_0x391f('0x39')]['id']},'raw':!![]})[_0x391f('0x15')](function(_0x268bff){if(!_0x268bff)return _0x541bc5['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x268bff,_0x55686e[_0x391f('0x44')]['id'])};})['then'](respondWithResult(_0x541bc5,null))[_0x391f('0x40')](handleError(_0x541bc5,null));};exports[_0x391f('0x45')]=function(_0x2e0aba,_0x295c6f){var _0x3b6296=_0x2e0aba[_0x391f('0x3d')];var _0x35b4dd;var _0x592270;if(_0x3b6296['error'])throw _0x3b6296;redis[_0x391f('0x46')](_0x3b6296[_0x391f('0x47')])['then'](function(_0x1235af){if(!_0x1235af)throw new Error(_0x391f('0x48'));_0x35b4dd=JSON[_0x391f('0x49')](_0x1235af);var _0x3de730=Buffer[_0x391f('0x4a')](_0x3b6296[_0x391f('0x47')],'base64')[_0x391f('0x4b')](_0x391f('0x4c'));_0x592270=JSON['parse'](_0x3de730);if(!oauth['isValidIdToken'](_0x3b6296[_0x391f('0x4d')],_0x35b4dd['oauth2Claims']))throw new Error(_0x391f('0x4e'));redis['del'](_0x3b6296[_0x391f('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3b6296[_0x391f('0x4f')],_0x35b4dd);})['then'](function(_0x11341f){_0x35b4dd[_0x391f('0x50')]=_0x11341f[_0x391f('0x51')];_0x35b4dd[_0x391f('0x52')]=_0x11341f['refresh_token'];return db['CloudProvider'][_0x391f('0x13')]({'data5':_0x35b4dd[_0x391f('0x50')],'data6':_0x35b4dd[_0x391f('0x52')]},{'where':{'id':_0x35b4dd['id']}});})[_0x391f('0x15')](function(){oauth[_0x391f('0x53')](_0x35b4dd);socket[_0x391f('0x54')]('microsoftAuthorization:success',{'id':_0x592270['id']});return;})[_0x391f('0x15')](respondWithStatusCode(_0x295c6f,null))[_0x391f('0x40')](function(_0x3d65a7){if(_0x592270){socket['emit'](_0x391f('0x55'),{'id':_0x592270['id']});}if(!_0x35b4dd){logger[_0x391f('0x16')](_0x391f('0x56'),_0x3d65a7);return _0x295c6f['status'](0x1f4)['send'](_0x3d65a7[_0x391f('0x57')]);}logger[_0x391f('0x16')](_0x391f('0x58'),_0x35b4dd['id'],JSON[_0x391f('0x59')](_0x3d65a7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8a4ab20..08fe68b 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 _0x270a=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash'];(function(_0x349ccf,_0x5a0a91){var _0x4b393b=function(_0x55f068){while(--_0x55f068){_0x349ccf['push'](_0x349ccf['shift']());}};_0x4b393b(++_0x5a0a91);}(_0x270a,0x11d));var _0xa270=function(_0x57c96a,_0x24f6f2){_0x57c96a=_0x57c96a-0x0;var _0x33a849=_0x270a[_0x57c96a];return _0x33a849;};'use strict';var _=require(_0xa270('0x0'));var util=require(_0xa270('0x1'));var logger=require(_0xa270('0x2'))('api');var moment=require(_0xa270('0x3'));var BPromise=require(_0xa270('0x4'));var rp=require(_0xa270('0x5'));var fs=require('fs');var path=require(_0xa270('0x6'));var rimraf=require('rimraf');var config=require(_0xa270('0x7'));var attributes=require(_0xa270('0x8'));module[_0xa270('0x9')]=function(_0x3f6d8b,_0x3700da){return _0x3f6d8b['define']('CloudProvider',attributes,{'tableName':_0xa270('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','../../config/logger'];(function(_0x1ef5f9,_0x44dad1){var _0x25f75b=function(_0x1b9955){while(--_0x1b9955){_0x1ef5f9['push'](_0x1ef5f9['shift']());}};_0x25f75b(++_0x44dad1);}(_0xa8a3,0x197));var _0x3a8a=function(_0x590f55,_0x314c3b){_0x590f55=_0x590f55-0x0;var _0x14142f=_0xa8a3[_0x590f55];return _0x14142f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3a8a('0x0'))('api');var moment=require(_0x3a8a('0x1'));var BPromise=require(_0x3a8a('0x2'));var rp=require(_0x3a8a('0x3'));var fs=require('fs');var path=require(_0x3a8a('0x4'));var rimraf=require(_0x3a8a('0x5'));var config=require(_0x3a8a('0x6'));var attributes=require(_0x3a8a('0x7'));module[_0x3a8a('0x8')]=function(_0x2d9629,_0x570fb3){return _0x2d9629[_0x3a8a('0x9')](_0x3a8a('0xa'),attributes,{'tableName':_0x3a8a('0xb'),'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 d7612eb..32930d5 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 _0x7db4=['then','refresh_token','data6','data1','decryptString','POST','data5','access_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','join','Outlook365','replace','{TENANT_ID}','data2','code','stringify','toString','base64','randomBytes','client_id','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne'];(function(_0x5c4a95,_0x26447d){var _0x8ec6a0=function(_0x4779b6){while(--_0x4779b6){_0x5c4a95['push'](_0x5c4a95['shift']());}};_0x8ec6a0(++_0x26447d);}(_0x7db4,0x1f2));var _0x47db=function(_0x55c193,_0x3dc41a){_0x55c193=_0x55c193-0x0;var _0x56f621=_0x7db4[_0x55c193];return _0x56f621;};'use strict';var _=require(_0x47db('0x0'));var crypto=require(_0x47db('0x1'));var jwt=require(_0x47db('0x2'));var moment=require(_0x47db('0x3'));var Redis=require(_0x47db('0x4'));var rp=require(_0x47db('0x5'));var util=require(_0x47db('0x6'));var encryptor=require(_0x47db('0x7'));var config=require(_0x47db('0x8'));var logger=require('../../config/logger')(_0x47db('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x47db('0xa'))['db'];config['redis']=_['defaults'](config[_0x47db('0xb')],{'host':_0x47db('0xc'),'port':0x18eb});var redis=new Redis(config[_0x47db('0xb')]);var MICROSOFT_AUTH_URL=_0x47db('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x47db('0xe'),_0x47db('0xf'),_0x47db('0x10'),_0x47db('0x11'),_0x47db('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x47db('0x13')],'Dynamics365':[_0x47db('0xe'),_0x47db('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x47db('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x40f6b0){var _0x535470=_[_0x47db('0x15')](AZURE_AUTH_SCOPES[_0x40f6b0[_0x47db('0x16')]]);if(_0x40f6b0['type']===_0x47db('0x17'))_0x535470[_0x47db('0x18')](_0x40f6b0['data7']+'/.default');return _0x535470[_0x47db('0x19')]('\x20');}function getAccessTokenScope(_0x519ec7){if(_0x519ec7[_0x47db('0x16')]===_0x47db('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x519ec7[_0x47db('0x16')]===_0x47db('0x17'))return _0x519ec7['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x3f7f40,_0x10a6c4){var _0x1df8a7=MICROSOFT_AUTH_URL[_0x47db('0x1b')](_0x47db('0x1c'),_0x3f7f40[_0x47db('0x1d')]);var _0x4f6cb9=[_0x47db('0x1e'),'id_token'];var _0x3935c4=Buffer['from'](JSON[_0x47db('0x1f')]({'id':_0x10a6c4}))[_0x47db('0x20')](_0x47db('0x21'));var _0x546bff=crypto[_0x47db('0x22')](0x10)[_0x47db('0x20')]('hex');var _0x4ea554=getAuthorizationScopes(_0x3f7f40);var _0x366f03=[{'key':_0x47db('0x23'),'value':_0x3f7f40['data1']},{'key':_0x47db('0x24'),'value':encodeURIComponent(_0x4f6cb9[_0x47db('0x19')]('\x20'))},{'key':'redirect_uri','value':_0x3f7f40[_0x47db('0x25')]},{'key':_0x47db('0x26'),'value':_0x47db('0x27')},{'key':_0x47db('0x28'),'value':encodeURIComponent(_0x4ea554)},{'key':_0x47db('0x29'),'value':_0x3935c4},{'key':_0x47db('0x2a'),'value':_0x546bff},{'key':_0x47db('0x2b'),'value':_0x47db('0x2c')}];var _0x155dc4=_0x1df8a7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x47db('0x15')](_0x366f03,function(_0xb02de7){return _0xb02de7[_0x47db('0x2d')]+'='+_0xb02de7['value'];})['join']('&');_0x3f7f40[_0x47db('0x2e')]={'issuer':_0x1df8a7[_0x47db('0x1b')](_0x47db('0x2f'),''),'audience':_0x3f7f40['data1'],'state':_0x3935c4,'nonce':_0x546bff};redis[_0x47db('0x30')](_0x3935c4,JSON[_0x47db('0x1f')](_0x3f7f40));return _0x155dc4;}function isValidIdToken(_0x1a8954,_0x23bb59){try{var _0x44ee56=jwt[_0x47db('0x31')](_0x1a8954,{'complete':!![]});var _0x4d5e4c=_0x44ee56[_0x47db('0x32')];if(_0x4d5e4c[_0x47db('0x33')]!==_0x23bb59[_0x47db('0x34')])return![];if(_0x4d5e4c[_0x47db('0x35')]!==_0x23bb59[_0x47db('0x36')])return![];if(_0x4d5e4c['nonce']!==_0x23bb59[_0x47db('0x2a')])return![];if(moment()[_0x47db('0x37')](moment[_0x47db('0x38')](_0x4d5e4c[_0x47db('0x39')])))return![];return!![];}catch(_0x3b7e16){throw _0x3b7e16;}}function refreshOauth2MicrosoftAccessToken(_0x51aa20){return Promise[_0x47db('0x3a')]()['then'](function(){if(_0x51aa20[_0x47db('0x3b')])return _0x51aa20;return db[_0x47db('0x3c')][_0x47db('0x3d')]({'where':{'id':_0x51aa20['id']},'raw':!![]});})[_0x47db('0x3e')](function(_0x11503f){var _0x29f619={'grant_type':_0x47db('0x3f'),'refresh_token':_0x11503f[_0x47db('0x40')],'scope':getAccessTokenScope(_0x11503f),'redirect_uri':_0x11503f['data4'],'client_id':_0x11503f[_0x47db('0x41')],'client_secret':encryptor[_0x47db('0x42')](_0x11503f[_0x47db('0x3b')])};var _0x325d36={'method':_0x47db('0x43'),'uri':MICROSOFT_AUTH_URL[_0x47db('0x1b')]('{TENANT_ID}',_0x11503f[_0x47db('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x29f619,'json':!![]};return rp(_0x325d36);})[_0x47db('0x3e')](function(_0x50cbef){_0x51aa20[_0x47db('0x44')]=_0x50cbef[_0x47db('0x45')];_0x51aa20['data6']=_0x50cbef[_0x47db('0x3f')];return db[_0x47db('0x3c')]['update']({'data5':_0x51aa20[_0x47db('0x44')],'data6':_0x51aa20[_0x47db('0x40')]},{'where':{'id':_0x51aa20['id']}});})[_0x47db('0x3e')](function(){return _0x51aa20;})['catch'](function(_0x17a3ff){logger[_0x47db('0x46')](_0x47db('0x47'),_0x51aa20['id'],_0x17a3ff);});}function getOauth2MicrosoftAccessToken(_0x4a3cf0,_0x3382a){var _0x15010c={'grant_type':'authorization_code','code':_0x4a3cf0,'scope':getAccessTokenScope(_0x3382a),'redirect_uri':_0x3382a[_0x47db('0x25')],'client_id':_0x3382a[_0x47db('0x41')],'client_secret':encryptor[_0x47db('0x42')](_0x3382a['data3'])};var _0x4d21e5={'method':_0x47db('0x43'),'uri':MICROSOFT_AUTH_URL[_0x47db('0x1b')](_0x47db('0x1c'),_0x3382a['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x15010c,'json':!![]};return rp(_0x4d21e5);}function startRefreshInterval(_0x384d7a){var _0x32c40a=schedule[_0x47db('0x48')];if(_0x32c40a[_0x384d7a['id']])clearInterval(_0x32c40a[_0x384d7a['id']]);_0x32c40a[_0x384d7a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x47db('0x49')](this,{'id':_0x384d7a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x47db('0x48')]=_0x32c40a;}function startAllRefreshIntervals(){return db[_0x47db('0x3c')][_0x47db('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x29d35a){var _0x413362=_0x29d35a[_0x47db('0x15')](function(_0x2f0392){return refreshOauth2MicrosoftAccessToken(_0x2f0392)['then'](function(_0x58499c){startRefreshInterval(_0x58499c);});});return Promise[_0x47db('0x4b')](_0x413362);})[_0x47db('0x4c')](function(_0x571057){var _0x324d34=_0x571057?util[_0x47db('0x4d')](_0x571057,{'showHidden':![],'depth':null}):'';logger[_0x47db('0x46')](_0x47db('0x4e'),_0x324d34);});}module[_0x47db('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2279=['catch','error','authorization_code','intervals','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','/token','type','push','data7','join','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','redirect_uri','data4','form_post','state','prompt','login','map','key','value','oauth2Claims','oauth2/','set','payload','issuer','aud','audience','nonce','isAfter','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','{TENANT_ID}','update'];(function(_0x514d96,_0x27dc94){var _0x3d1eeb=function(_0x3f0518){while(--_0x3f0518){_0x514d96['push'](_0x514d96['shift']());}};_0x3d1eeb(++_0x27dc94);}(_0x2279,0x18e));var _0x9227=function(_0x3d4a53,_0x41b236){_0x3d4a53=_0x3d4a53-0x0;var _0x4a4279=_0x2279[_0x3d4a53];return _0x4a4279;};'use strict';var _=require(_0x9227('0x0'));var crypto=require(_0x9227('0x1'));var jwt=require(_0x9227('0x2'));var moment=require(_0x9227('0x3'));var Redis=require(_0x9227('0x4'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x9227('0x5'));var config=require(_0x9227('0x6'));var logger=require(_0x9227('0x7'))(_0x9227('0x8'));var schedule=require(_0x9227('0x9'));var db=require(_0x9227('0xa'))['db'];config[_0x9227('0xb')]=_[_0x9227('0xc')](config[_0x9227('0xb')],{'host':_0x9227('0xd'),'port':0x18eb});var redis=new Redis(config[_0x9227('0xb')]);var MICROSOFT_AUTH_URL=_0x9227('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x9227('0xf'),_0x9227('0x10'),_0x9227('0x11'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x9227('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9227('0x13'),_0x9227('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x9227('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x9227('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2184d7){var _0x5c9d5e=_['map'](AZURE_AUTH_SCOPES[_0x2184d7[_0x9227('0x16')]]);if(_0x2184d7['type']==='Dynamics365')_0x5c9d5e[_0x9227('0x17')](_0x2184d7[_0x9227('0x18')]+'/.default');return _0x5c9d5e[_0x9227('0x19')]('\x20');}function getAccessTokenScope(_0x593597){if(_0x593597['type']==='Outlook365')return _0x9227('0x1a');if(_0x593597[_0x9227('0x16')]==='Dynamics365')return _0x593597[_0x9227('0x18')]+_0x9227('0x1b');}function generateMicrosoftAuthorizationUrl(_0x4239f2,_0x2854f3){var _0xe8b359=MICROSOFT_AUTH_URL[_0x9227('0x1c')]('{TENANT_ID}',_0x4239f2[_0x9227('0x1d')]);var _0x1b889c=[_0x9227('0x1e'),_0x9227('0x1f')];var _0x5af2bf=Buffer[_0x9227('0x20')](JSON[_0x9227('0x21')]({'id':_0x2854f3}))[_0x9227('0x22')](_0x9227('0x23'));var _0x3d1507=crypto[_0x9227('0x24')](0x10)[_0x9227('0x22')](_0x9227('0x25'));var _0x377bbc=getAuthorizationScopes(_0x4239f2);var _0x270c0d=[{'key':_0x9227('0x26'),'value':_0x4239f2[_0x9227('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x1b889c[_0x9227('0x19')]('\x20'))},{'key':_0x9227('0x28'),'value':_0x4239f2[_0x9227('0x29')]},{'key':'response_mode','value':_0x9227('0x2a')},{'key':'scope','value':encodeURIComponent(_0x377bbc)},{'key':_0x9227('0x2b'),'value':_0x5af2bf},{'key':'nonce','value':_0x3d1507},{'key':_0x9227('0x2c'),'value':_0x9227('0x2d')}];var _0x223160=_0xe8b359+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9227('0x2e')](_0x270c0d,function(_0x5ae7fc){return _0x5ae7fc[_0x9227('0x2f')]+'='+_0x5ae7fc[_0x9227('0x30')];})['join']('&');_0x4239f2[_0x9227('0x31')]={'issuer':_0xe8b359[_0x9227('0x1c')](_0x9227('0x32'),''),'audience':_0x4239f2[_0x9227('0x27')],'state':_0x5af2bf,'nonce':_0x3d1507};redis[_0x9227('0x33')](_0x5af2bf,JSON[_0x9227('0x21')](_0x4239f2));return _0x223160;}function isValidIdToken(_0x5436fd,_0x3342be){try{var _0x26bac0=jwt['decode'](_0x5436fd,{'complete':!![]});var _0xe9eb8e=_0x26bac0[_0x9227('0x34')];if(_0xe9eb8e['iss']!==_0x3342be[_0x9227('0x35')])return![];if(_0xe9eb8e[_0x9227('0x36')]!==_0x3342be[_0x9227('0x37')])return![];if(_0xe9eb8e[_0x9227('0x38')]!==_0x3342be[_0x9227('0x38')])return![];if(moment()[_0x9227('0x39')](moment['unix'](_0xe9eb8e[_0x9227('0x3a')])))return![];return!![];}catch(_0x329cfd){throw _0x329cfd;}}function refreshOauth2MicrosoftAccessToken(_0x5dcbe2){return Promise[_0x9227('0x3b')]()[_0x9227('0x3c')](function(){if(_0x5dcbe2['data3'])return _0x5dcbe2;return db[_0x9227('0x3d')][_0x9227('0x3e')]({'where':{'id':_0x5dcbe2['id']},'raw':!![]});})[_0x9227('0x3c')](function(_0x6e2259){var _0x2fe3d5={'grant_type':_0x9227('0x3f'),'refresh_token':_0x6e2259[_0x9227('0x40')],'scope':getAccessTokenScope(_0x6e2259),'redirect_uri':_0x6e2259['data4'],'client_id':_0x6e2259['data1'],'client_secret':encryptor[_0x9227('0x41')](_0x6e2259[_0x9227('0x42')])};var _0x138ed0={'method':_0x9227('0x43'),'uri':MICROSOFT_AUTH_URL[_0x9227('0x1c')](_0x9227('0x44'),_0x6e2259['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2fe3d5,'json':!![]};return rp(_0x138ed0);})[_0x9227('0x3c')](function(_0x3b7e75){_0x5dcbe2['data5']=_0x3b7e75['access_token'];_0x5dcbe2[_0x9227('0x40')]=_0x3b7e75[_0x9227('0x3f')];return db['CloudProvider'][_0x9227('0x45')]({'data5':_0x5dcbe2['data5'],'data6':_0x5dcbe2[_0x9227('0x40')]},{'where':{'id':_0x5dcbe2['id']}});})['then'](function(){return _0x5dcbe2;})[_0x9227('0x46')](function(_0x2f85aa){logger[_0x9227('0x47')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5dcbe2['id'],_0x2f85aa);});}function getOauth2MicrosoftAccessToken(_0x22aae0,_0x33e887){var _0x3a1936={'grant_type':_0x9227('0x48'),'code':_0x22aae0,'scope':getAccessTokenScope(_0x33e887),'redirect_uri':_0x33e887['data4'],'client_id':_0x33e887[_0x9227('0x27')],'client_secret':encryptor['decryptString'](_0x33e887[_0x9227('0x42')])};var _0x4f3e1a={'method':_0x9227('0x43'),'uri':MICROSOFT_AUTH_URL[_0x9227('0x1c')]('{TENANT_ID}',_0x33e887[_0x9227('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3a1936,'json':!![]};return rp(_0x4f3e1a);}function startRefreshInterval(_0x4b66e8){var _0x387e83=schedule[_0x9227('0x49')];if(_0x387e83[_0x4b66e8['id']])clearInterval(_0x387e83[_0x4b66e8['id']]);_0x387e83[_0x4b66e8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9227('0x4a')](this,{'id':_0x4b66e8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9227('0x49')]=_0x387e83;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x9227('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9227('0x3c')](function(_0x84a2d6){var _0x55f8df=_0x84a2d6[_0x9227('0x2e')](function(_0x4c1ce8){return refreshOauth2MicrosoftAccessToken(_0x4c1ce8)[_0x9227('0x3c')](function(_0x2974dc){startRefreshInterval(_0x2974dc);});});return Promise[_0x9227('0x4c')](_0x55f8df);})[_0x9227('0x46')](function(_0x26c906){var _0x4539fe=_0x26c906?util['inspect'](_0x26c906,{'showHidden':![],'depth':null}):'';logger[_0x9227('0x47')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4539fe);});}module[_0x9227('0x4d')]={'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 f4305a4..e91ea56 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 _0x25e7=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x1b10de,_0xe0ae69){var _0x59c631=function(_0x4e76d5){while(--_0x4e76d5){_0x1b10de['push'](_0x1b10de['shift']());}};_0x59c631(++_0xe0ae69);}(_0x25e7,0x1d6));var _0x725e=function(_0x5098d3,_0x245091){_0x5098d3=_0x5098d3-0x0;var _0x285389=_0x25e7[_0x5098d3];return _0x285389;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('CloudProvider,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});} \ No newline at end of file +var _0xce62=['code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error'];(function(_0x3dc9ce,_0x3f76b0){var _0x1747f2=function(_0x38ec7d){while(--_0x38ec7d){_0x3dc9ce['push'](_0x3dc9ce['shift']());}};_0x1747f2(++_0x3f76b0);}(_0xce62,0x83));var _0x2ce6=function(_0x45204c,_0x1eefaa){_0x45204c=_0x45204c-0x0;var _0x5dc667=_0xce62[_0x45204c];return _0x5dc667;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var moment=require('moment');var BPromise=require(_0x2ce6('0x2'));var rs=require(_0x2ce6('0x3'));var fs=require('fs');var Redis=require(_0x2ce6('0x4'));var db=require(_0x2ce6('0x5'))['db'];var utils=require(_0x2ce6('0x6'));var logger=require(_0x2ce6('0x7'))('rpc');var config=require(_0x2ce6('0x8'));var jayson=require(_0x2ce6('0x9'));var client=jayson[_0x2ce6('0xa')][_0x2ce6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf425,_0x2c66c2,_0x5b7f02){return new BPromise(function(_0x46ef52,_0x12f647){return client['request'](_0xcf425,_0x5b7f02)[_0x2ce6('0xc')](function(_0x2e6eae){logger[_0x2ce6('0xd')]('CloudProvider,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'),JSON['stringify'](_0x2e6eae));if(_0x2e6eae[_0x2ce6('0xf')]){if(_0x2e6eae['error'][_0x2ce6('0x10')]===0x1f4){logger[_0x2ce6('0xf')](_0x2ce6('0x11'),_0x2c66c2,_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);return _0x12f647(_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);}logger[_0x2ce6('0xf')]('CloudProvider,\x20%s,\x20%s',_0x2c66c2,_0x2e6eae[_0x2ce6('0xf')]['message']);return _0x46ef52(_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);}else{logger[_0x2ce6('0xd')]('CloudProvider,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'));_0x46ef52(_0x2e6eae[_0x2ce6('0x13')][_0x2ce6('0x12')]);}})[_0x2ce6('0x14')](function(_0x38032e){logger[_0x2ce6('0xf')](_0x2ce6('0x11'),_0x2c66c2,_0x38032e);_0x12f647(_0x38032e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 23b6e34..7e48363 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x1c4397,_0x3bb634){_0x1c4397=_0x1c4397-0x0;var _0x2bb766=_0x7a54[_0x1c4397];return _0x2bb766;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x4f4365,_0x2aee26){var _0x128f6e=function(_0x72a92f){while(--_0x72a92f){_0x4f4365['push'](_0x4f4365['shift']());}};_0x128f6e(++_0x2aee26);}(_0xadb5,0xad));var _0x5adb=function(_0x321ceb,_0x100a58){_0x321ceb=_0x321ceb-0x0;var _0x512dbc=_0xadb5[_0x321ceb];return _0x512dbc;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('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 b14859d..15fb684 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 _0xab8a=['sequelize','STRING','name'];(function(_0x4fe0bf,_0x59f8f3){var _0x3a769f=function(_0x4a0a5a){while(--_0x4a0a5a){_0x4fe0bf['push'](_0x4fe0bf['shift']());}};_0x3a769f(++_0x59f8f3);}(_0xab8a,0x195));var _0xaab8=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xab8a[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0xaab8('0x0'));module['exports']={'name':{'type':Sequelize[_0xaab8('0x1')],'unique':_0xaab8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xaab8('0x1')]},'website':{'type':Sequelize[_0xaab8('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xaab8('0x1')]},'type':{'type':Sequelize[_0xaab8('0x1')]},'street':{'type':Sequelize[_0xaab8('0x1')]},'postalCode':{'type':Sequelize[_0xaab8('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xaab8('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xaab8('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xaab8('0x1')]},'description':{'type':Sequelize[_0xaab8('0x1')]}}; \ No newline at end of file +var _0xec43=['STRING','name','sequelize','exports'];(function(_0x304998,_0x2635c9){var _0x136067=function(_0x519e6e){while(--_0x519e6e){_0x304998['push'](_0x304998['shift']());}};_0x136067(++_0x2635c9);}(_0xec43,0x1c2));var _0x3ec4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec43[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3ec4('0x0'));module[_0x3ec4('0x1')]={'name':{'type':Sequelize[_0x3ec4('0x2')],'unique':_0x3ec4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3ec4('0x2')]},'companyId':{'type':Sequelize[_0x3ec4('0x2')]},'website':{'type':Sequelize[_0x3ec4('0x2')]},'phone':{'type':Sequelize[_0x3ec4('0x2')]},'fax':{'type':Sequelize[_0x3ec4('0x2')]},'type':{'type':Sequelize[_0x3ec4('0x2')]},'street':{'type':Sequelize[_0x3ec4('0x2')]},'postalCode':{'type':Sequelize[_0x3ec4('0x2')]},'city':{'type':Sequelize[_0x3ec4('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3ec4('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3ec4('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x3ec4('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index de46532..60fe266 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 _0xa990=['end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','get','Companies','sendStatus','name','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','map','filter','options','includeAll','include','CmCompany','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','rawAttributes','length','pick','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x358675,_0x12aa40){var _0xab59aa=function(_0x37c618){while(--_0x37c618){_0x358675['push'](_0x358675['shift']());}};_0xab59aa(++_0x12aa40);}(_0xa990,0xed));var _0x0a99=function(_0x31c001,_0x51c2cd){_0x31c001=_0x31c001-0x0;var _0x1e2888=_0xa990[_0x31c001];return _0x1e2888;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require('request-promise');var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var Mustache=require(_0x0a99('0x6'));var util=require(_0x0a99('0x7'));var path=require(_0x0a99('0x8'));var sox=require('sox');var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require('lodash');var squel=require(_0x0a99('0xc'));var crypto=require(_0x0a99('0xd'));var jsforce=require(_0x0a99('0xe'));var deskjs=require(_0x0a99('0xf'));var toCsv=require(_0x0a99('0x9'));var querystring=require('querystring');var Papa=require(_0x0a99('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a99('0x11'));var hardwareService=require(_0x0a99('0x12'));var logger=require(_0x0a99('0x13'))(_0x0a99('0x14'));var utils=require(_0x0a99('0x15'));var config=require(_0x0a99('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x17'))['db'];function respondWithStatusCode(_0x3326ef,_0x31a53f){_0x31a53f=_0x31a53f||0xcc;return function(_0xdae76){if(_0xdae76){return _0x3326ef['sendStatus'](_0x31a53f);}return _0x3326ef['status'](_0x31a53f)[_0x0a99('0x18')]();};}function respondWithResult(_0x4d92cd,_0x18a26d){_0x18a26d=_0x18a26d||0xc8;return function(_0x401a13){if(_0x401a13){return _0x4d92cd['status'](_0x18a26d)[_0x0a99('0x19')](_0x401a13);}};}function respondWithFilteredResult(_0x54bcc5,_0x552596){return function(_0x37d374){if(_0x37d374){var _0x3e9301=typeof _0x552596[_0x0a99('0x1a')]===_0x0a99('0x1b')&&typeof _0x552596[_0x0a99('0x1c')]==='undefined';var _0x37b48b=_0x37d374[_0x0a99('0x1d')];var _0x3abcbb=_0x3e9301?0x0:_0x552596['offset'];var _0xd279f7=_0x3e9301?_0x37d374[_0x0a99('0x1d')]:_0x552596[_0x0a99('0x1a')]+_0x552596[_0x0a99('0x1c')];var _0x598187;if(_0xd279f7>=_0x37b48b){_0xd279f7=_0x37b48b;_0x598187=0xc8;}else{_0x598187=0xce;}_0x54bcc5[_0x0a99('0x1e')](_0x598187);return _0x54bcc5[_0x0a99('0x1f')](_0x0a99('0x20'),_0x3abcbb+'-'+_0xd279f7+'/'+_0x37b48b)[_0x0a99('0x19')](_0x37d374);}return null;};}function patchUpdates(_0x55c4c4){return function(_0x4b4149){try{jsonpatch[_0x0a99('0x21')](_0x4b4149,_0x55c4c4,!![]);}catch(_0x5b5719){return BPromise[_0x0a99('0x22')](_0x5b5719);}return _0x4b4149['save']();};}function saveUpdates(_0x232d80,_0x1dd76e){return function(_0x2bf6f4){if(_0x2bf6f4){return _0x2bf6f4[_0x0a99('0x23')](_0x232d80)[_0x0a99('0x24')](function(_0x80a1b9){return _0x80a1b9;});}return null;};}function removeEntity(_0x4549f6,_0x2744b1){return function(_0x4a1c61){if(_0x4a1c61){return _0x4a1c61[_0x0a99('0x25')]()[_0x0a99('0x24')](function(){var _0x4d0aae=_0x4a1c61[_0x0a99('0x26')]({'plain':!![]});var _0x5bbfc3=_0x0a99('0x27');return db['UserProfileResource'][_0x0a99('0x25')]({'where':{'type':_0x5bbfc3,'resourceId':_0x4d0aae['id']}})['then'](function(){return _0x4a1c61;});})[_0x0a99('0x24')](function(){_0x4549f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3235c1,_0x4fb23b){return function(_0x4f981f){if(!_0x4f981f){_0x3235c1[_0x0a99('0x28')](0x194);}return _0x4f981f;};}function handleError(_0x1f4c0f,_0x20707b){_0x20707b=_0x20707b||0x1f4;return function(_0x4ee77c){logger['error'](_0x4ee77c['stack']);if(_0x4ee77c[_0x0a99('0x29')]){delete _0x4ee77c[_0x0a99('0x29')];}_0x1f4c0f['status'](_0x20707b)['send'](_0x4ee77c);};}exports['index']=function(_0x718e55,_0x2c5123){var _0x530a33={},_0x98cdd6={},_0x17ecf3={'count':0x0,'rows':[]};return db['CmCompany'][_0x0a99('0x2a')]()[_0x0a99('0x24')](function(_0x5e4f78){_0x98cdd6[_0x0a99('0x2b')]=_[_0x0a99('0x2c')](_0x5e4f78);_0x98cdd6[_0x0a99('0x2d')]=_[_0x0a99('0x2c')](_0x718e55[_0x0a99('0x2d')]);_0x98cdd6['filters']=_[_0x0a99('0x2e')](_0x98cdd6[_0x0a99('0x2b')],_0x98cdd6[_0x0a99('0x2d')]);_0x530a33[_0x0a99('0x2f')]=_['intersection'](_0x98cdd6[_0x0a99('0x2b')],qs[_0x0a99('0x30')](_0x718e55[_0x0a99('0x2d')][_0x0a99('0x30')]));_0x530a33[_0x0a99('0x2f')]=_0x530a33['attributes']['length']?_0x530a33[_0x0a99('0x2f')]:_0x98cdd6[_0x0a99('0x2b')];if(!_0x718e55[_0x0a99('0x2d')][_0x0a99('0x31')](_0x0a99('0x32'))){_0x530a33[_0x0a99('0x1c')]=qs[_0x0a99('0x1c')](_0x718e55[_0x0a99('0x2d')][_0x0a99('0x1c')]);_0x530a33[_0x0a99('0x1a')]=qs['offset'](_0x718e55[_0x0a99('0x2d')][_0x0a99('0x1a')]);}_0x530a33[_0x0a99('0x33')]=qs[_0x0a99('0x34')](_0x718e55[_0x0a99('0x2d')]['sort']);_0x530a33['where']=qs[_0x0a99('0x35')](_['pick'](_0x718e55[_0x0a99('0x2d')],_0x98cdd6[_0x0a99('0x35')]),_0x5e4f78);if(_0x718e55[_0x0a99('0x2d')]['filter']){_0x530a33[_0x0a99('0x36')]=_[_0x0a99('0x37')](_0x530a33[_0x0a99('0x36')],{'$or':_[_0x0a99('0x38')](_0x530a33[_0x0a99('0x2f')],function(_0x4540bf){var _0x1452b6={};_0x1452b6[_0x4540bf]={'$like':'%'+_0x718e55[_0x0a99('0x2d')][_0x0a99('0x39')]+'%'};return _0x1452b6;})});}_0x530a33=_[_0x0a99('0x37')]({},_0x530a33,_0x718e55[_0x0a99('0x3a')]);var _0x2432cb={'where':_0x530a33[_0x0a99('0x36')]};return db['CmCompany'][_0x0a99('0x1d')](_0x2432cb)[_0x0a99('0x24')](function(_0x20f5d6){_0x17ecf3[_0x0a99('0x1d')]=_0x20f5d6;if(_0x718e55['query'][_0x0a99('0x3b')]){_0x530a33[_0x0a99('0x3c')]=[{'all':!![]}];}return db[_0x0a99('0x3d')][_0x0a99('0x3e')](_0x530a33);})['then'](function(_0x17d06f){_0x17ecf3[_0x0a99('0x3f')]=_0x17d06f;return _0x17ecf3;})['then'](respondWithFilteredResult(_0x2c5123,_0x530a33))[_0x0a99('0x40')](handleError(_0x2c5123,null));})[_0x0a99('0x40')](handleError(_0x2c5123,null));};exports[_0x0a99('0x41')]=function(_0x7eeaea,_0x1f96b9){var _0x5bdc0b={'raw':![],'where':{'id':_0x7eeaea[_0x0a99('0x42')]['id']}},_0x319263={};_0x319263[_0x0a99('0x2b')]=_[_0x0a99('0x2c')](db[_0x0a99('0x3d')]['rawAttributes']);_0x319263['query']=_['keys'](_0x7eeaea['query']);_0x319263['filters']=_[_0x0a99('0x2e')](_0x319263['model'],_0x319263['query']);_0x5bdc0b[_0x0a99('0x2f')]=_[_0x0a99('0x2e')](_0x319263[_0x0a99('0x2b')],qs[_0x0a99('0x30')](_0x7eeaea['query'][_0x0a99('0x30')]));_0x5bdc0b[_0x0a99('0x2f')]=_0x5bdc0b['attributes']['length']?_0x5bdc0b[_0x0a99('0x2f')]:_0x319263[_0x0a99('0x2b')];if(_0x7eeaea[_0x0a99('0x2d')][_0x0a99('0x3b')]){_0x5bdc0b['include']=[{'all':!![]}];}_0x5bdc0b=_[_0x0a99('0x37')]({},_0x5bdc0b,_0x7eeaea['options']);return db[_0x0a99('0x3d')][_0x0a99('0x43')](_0x5bdc0b)[_0x0a99('0x24')](handleEntityNotFound(_0x1f96b9,null))[_0x0a99('0x24')](respondWithResult(_0x1f96b9,null))[_0x0a99('0x40')](handleError(_0x1f96b9,null));};exports[_0x0a99('0x44')]=function(_0x410b7a,_0x394c52){return db[_0x0a99('0x3d')][_0x0a99('0x44')](_0x410b7a[_0x0a99('0x45')],{})[_0x0a99('0x24')](function(_0x3afe55){var _0x1aa412=_0x410b7a[_0x0a99('0x46')][_0x0a99('0x26')]({'plain':!![]});if(!_0x1aa412)throw new Error(_0x0a99('0x47'));if(_0x1aa412[_0x0a99('0x48')]===_0x0a99('0x46')){var _0x1985dd=_0x3afe55[_0x0a99('0x26')]({'plain':!![]});var _0x362ab3=_0x0a99('0x27');return db['UserProfileSection'][_0x0a99('0x43')]({'where':{'name':_0x362ab3,'userProfileId':_0x1aa412[_0x0a99('0x49')]},'raw':!![]})[_0x0a99('0x24')](function(_0x51f55b){if(_0x51f55b&&_0x51f55b[_0x0a99('0x4a')]===0x0){return db[_0x0a99('0x4b')][_0x0a99('0x44')]({'name':_0x1985dd[_0x0a99('0x29')],'resourceId':_0x1985dd['id'],'type':_0x51f55b[_0x0a99('0x29')],'sectionId':_0x51f55b['id']},{})['then'](function(){return _0x3afe55;});}else{return _0x3afe55;}})[_0x0a99('0x40')](function(_0x1aadd7){logger[_0x0a99('0x4c')](_0x0a99('0x4d'),_0x1aadd7);throw _0x1aadd7;});}return _0x3afe55;})['then'](respondWithResult(_0x394c52,0xc9))[_0x0a99('0x40')](handleError(_0x394c52,null));};exports[_0x0a99('0x23')]=function(_0x2429b4,_0x2b67fb){if(_0x2429b4[_0x0a99('0x45')]['id']){delete _0x2429b4[_0x0a99('0x45')]['id'];}return db[_0x0a99('0x3d')]['find']({'where':{'id':_0x2429b4[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x2b67fb,null))['then'](saveUpdates(_0x2429b4[_0x0a99('0x45')],null))[_0x0a99('0x24')](respondWithResult(_0x2b67fb,null))[_0x0a99('0x40')](handleError(_0x2b67fb,null));};exports['destroy']=function(_0x5484b0,_0x326957){return db['CmCompany']['find']({'where':{'id':_0x5484b0[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x326957,null))[_0x0a99('0x24')](removeEntity(_0x326957,null))[_0x0a99('0x40')](handleError(_0x326957,null));};exports[_0x0a99('0x2a')]=function(_0x1f8aa7,_0x36245e){return db[_0x0a99('0x3d')][_0x0a99('0x2a')]()[_0x0a99('0x24')](respondWithResult(_0x36245e,null))['catch'](handleError(_0x36245e,null));};exports[_0x0a99('0x4e')]=function(_0x9d75b1,_0x8a0ce6,_0x51e761){return db[_0x0a99('0x4f')]['find']({'where':{'id':_0x9d75b1[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x8a0ce6,null))[_0x0a99('0x24')](function(_0x4cc220){if(_0x4cc220){return _0x4cc220[_0x0a99('0x4e')](_0x9d75b1[_0x0a99('0x45')][_0x0a99('0x50')],_[_0x0a99('0x51')](_0x9d75b1[_0x0a99('0x45')],[_0x0a99('0x50'),'id'])||{});}})['then'](respondWithResult(_0x8a0ce6,null))['catch'](handleError(_0x8a0ce6,null));};exports['getContacts']=function(_0x55d37b,_0x32e553,_0x371fee){var _0x17a914={};var _0x186e05={};var _0x35e279;var _0x550450;return db['CmCompany'][_0x0a99('0x52')]({'where':{'id':_0x55d37b[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x32e553,null))['then'](function(_0x197457){if(_0x197457){_0x35e279=_0x197457;_0x186e05['model']=_[_0x0a99('0x2c')](db[_0x0a99('0x4f')][_0x0a99('0x53')]);_0x186e05[_0x0a99('0x2d')]=_[_0x0a99('0x2c')](_0x55d37b['query']);_0x186e05[_0x0a99('0x35')]=_[_0x0a99('0x2e')](_0x186e05[_0x0a99('0x2b')],_0x186e05['query']);_0x17a914['attributes']=_['intersection'](_0x186e05[_0x0a99('0x2b')],qs[_0x0a99('0x30')](_0x55d37b[_0x0a99('0x2d')][_0x0a99('0x30')]));_0x17a914[_0x0a99('0x2f')]=_0x17a914[_0x0a99('0x2f')][_0x0a99('0x54')]?_0x17a914[_0x0a99('0x2f')]:_0x186e05[_0x0a99('0x2b')];_0x17a914[_0x0a99('0x33')]=qs[_0x0a99('0x34')](_0x55d37b[_0x0a99('0x2d')][_0x0a99('0x34')]);_0x17a914['where']=qs[_0x0a99('0x35')](_[_0x0a99('0x55')](_0x55d37b[_0x0a99('0x2d')],_0x186e05[_0x0a99('0x35')]));if(_0x55d37b['query'][_0x0a99('0x39')]){_0x17a914[_0x0a99('0x36')]=_[_0x0a99('0x37')](_0x17a914[_0x0a99('0x36')],{'$or':_[_0x0a99('0x38')](_0x17a914['attributes'],function(_0x265d59){var _0x183c33={};_0x183c33[_0x265d59]={'$like':'%'+_0x55d37b[_0x0a99('0x2d')][_0x0a99('0x39')]+'%'};return _0x183c33;})});}_0x17a914=_[_0x0a99('0x37')]({},_0x17a914,_0x55d37b[_0x0a99('0x3a')]);return _0x35e279[_0x0a99('0x56')](_0x17a914);}})[_0x0a99('0x24')](function(_0x2c1a92){if(_0x2c1a92){_0x550450=_0x2c1a92[_0x0a99('0x54')];if(!_0x55d37b[_0x0a99('0x2d')][_0x0a99('0x31')]('nolimit')){_0x17a914[_0x0a99('0x1c')]=qs['limit'](_0x55d37b['query'][_0x0a99('0x1c')]);_0x17a914[_0x0a99('0x1a')]=qs[_0x0a99('0x1a')](_0x55d37b[_0x0a99('0x2d')][_0x0a99('0x1a')]);}return _0x35e279[_0x0a99('0x56')](_0x17a914);}})[_0x0a99('0x24')](function(_0x2256f0){if(_0x2256f0){return _0x2256f0?{'count':_0x550450,'rows':_0x2256f0}:null;}})[_0x0a99('0x24')](respondWithResult(_0x32e553,null))[_0x0a99('0x40')](handleError(_0x32e553,null));}; \ No newline at end of file +var _0xbcd1=['sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','map','options','count','includeAll','findAll','rows','catch','show','rawAttributes','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','CmContact','addContacts','ids','findOne','sort','pick','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbcd1,0xe9));var _0x1bcd=function(_0x2e1cd7,_0x293ea1){_0x2e1cd7=_0x2e1cd7-0x0;var _0x515226=_0xbcd1[_0x2e1cd7];return _0x515226;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bcd('0x0'));var zipdir=require(_0x1bcd('0x1'));var jsonpatch=require(_0x1bcd('0x2'));var rp=require(_0x1bcd('0x3'));var moment=require('moment');var BPromise=require(_0x1bcd('0x4'));var Mustache=require(_0x1bcd('0x5'));var util=require(_0x1bcd('0x6'));var path=require('path');var sox=require(_0x1bcd('0x7'));var csv=require(_0x1bcd('0x8'));var ejs=require(_0x1bcd('0x9'));var fs=require('fs');var fs_extra=require(_0x1bcd('0xa'));var _=require(_0x1bcd('0xb'));var squel=require(_0x1bcd('0xc'));var crypto=require(_0x1bcd('0xd'));var jsforce=require(_0x1bcd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1bcd('0x8'));var querystring=require(_0x1bcd('0xf'));var Papa=require('papaparse');var Redis=require(_0x1bcd('0x10'));var authService=require(_0x1bcd('0x11'));var qs=require(_0x1bcd('0x12'));var as=require(_0x1bcd('0x13'));var hardwareService=require(_0x1bcd('0x14'));var logger=require(_0x1bcd('0x15'))(_0x1bcd('0x16'));var utils=require(_0x1bcd('0x17'));var config=require(_0x1bcd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3cd0,_0x53a60c){_0x53a60c=_0x53a60c||0xcc;return function(_0x3999da){if(_0x3999da){return _0x5b3cd0[_0x1bcd('0x19')](_0x53a60c);}return _0x5b3cd0[_0x1bcd('0x1a')](_0x53a60c)['end']();};}function respondWithResult(_0x3cb2c0,_0x1f6ad6){_0x1f6ad6=_0x1f6ad6||0xc8;return function(_0x550a41){if(_0x550a41){return _0x3cb2c0[_0x1bcd('0x1a')](_0x1f6ad6)['json'](_0x550a41);}};}function respondWithFilteredResult(_0x413b70,_0x21af94){return function(_0x1876fc){if(_0x1876fc){var _0x408f91=typeof _0x21af94[_0x1bcd('0x1b')]==='undefined'&&typeof _0x21af94[_0x1bcd('0x1c')]==='undefined';var _0x3535da=_0x1876fc['count'];var _0x5a1a38=_0x408f91?0x0:_0x21af94[_0x1bcd('0x1b')];var _0xd64780=_0x408f91?_0x1876fc['count']:_0x21af94[_0x1bcd('0x1b')]+_0x21af94['limit'];var _0x5b5772;if(_0xd64780>=_0x3535da){_0xd64780=_0x3535da;_0x5b5772=0xc8;}else{_0x5b5772=0xce;}_0x413b70[_0x1bcd('0x1a')](_0x5b5772);return _0x413b70[_0x1bcd('0x1d')]('Content-Range',_0x5a1a38+'-'+_0xd64780+'/'+_0x3535da)[_0x1bcd('0x1e')](_0x1876fc);}return null;};}function patchUpdates(_0x581747){return function(_0x4dcfdf){try{jsonpatch[_0x1bcd('0x1f')](_0x4dcfdf,_0x581747,!![]);}catch(_0x14df57){return BPromise[_0x1bcd('0x20')](_0x14df57);}return _0x4dcfdf[_0x1bcd('0x21')]();};}function saveUpdates(_0x14ca60,_0x3c9292){return function(_0x104f4b){if(_0x104f4b){return _0x104f4b[_0x1bcd('0x22')](_0x14ca60)[_0x1bcd('0x23')](function(_0x161fb9){return _0x161fb9;});}return null;};}function removeEntity(_0x1ce295,_0x2c8601){return function(_0x30c468){if(_0x30c468){return _0x30c468[_0x1bcd('0x24')]()['then'](function(){var _0x4729bd=_0x30c468['get']({'plain':!![]});var _0x37ef5b='Companies';return db[_0x1bcd('0x25')][_0x1bcd('0x24')]({'where':{'type':_0x37ef5b,'resourceId':_0x4729bd['id']}})[_0x1bcd('0x23')](function(){return _0x30c468;});})[_0x1bcd('0x23')](function(){_0x1ce295[_0x1bcd('0x1a')](0xcc)[_0x1bcd('0x26')]();});}};}function handleEntityNotFound(_0x3ffbd9,_0x3516d2){return function(_0x15c8a0){if(!_0x15c8a0){_0x3ffbd9['sendStatus'](0x194);}return _0x15c8a0;};}function handleError(_0x54d86a,_0x418815){_0x418815=_0x418815||0x1f4;return function(_0x21e7ff){logger[_0x1bcd('0x27')](_0x21e7ff['stack']);if(_0x21e7ff[_0x1bcd('0x28')]){delete _0x21e7ff[_0x1bcd('0x28')];}_0x54d86a[_0x1bcd('0x1a')](_0x418815)['send'](_0x21e7ff);};}exports[_0x1bcd('0x29')]=function(_0x4a6c8c,_0x2bf5ad){var _0x29615b={},_0x3b3b1d={},_0xb9f698={'count':0x0,'rows':[]};return db[_0x1bcd('0x2a')]['describe']()['then'](function(_0xbbca44){_0x3b3b1d['model']=_[_0x1bcd('0x2b')](_0xbbca44);_0x3b3b1d[_0x1bcd('0x2c')]=_[_0x1bcd('0x2b')](_0x4a6c8c[_0x1bcd('0x2c')]);_0x3b3b1d[_0x1bcd('0x2d')]=_[_0x1bcd('0x2e')](_0x3b3b1d[_0x1bcd('0x2f')],_0x3b3b1d[_0x1bcd('0x2c')]);_0x29615b[_0x1bcd('0x30')]=_[_0x1bcd('0x2e')](_0x3b3b1d[_0x1bcd('0x2f')],qs[_0x1bcd('0x31')](_0x4a6c8c['query'][_0x1bcd('0x31')]));_0x29615b[_0x1bcd('0x30')]=_0x29615b[_0x1bcd('0x30')][_0x1bcd('0x32')]?_0x29615b[_0x1bcd('0x30')]:_0x3b3b1d[_0x1bcd('0x2f')];if(!_0x4a6c8c[_0x1bcd('0x2c')][_0x1bcd('0x33')](_0x1bcd('0x34'))){_0x29615b[_0x1bcd('0x1c')]=qs['limit'](_0x4a6c8c[_0x1bcd('0x2c')]['limit']);_0x29615b[_0x1bcd('0x1b')]=qs[_0x1bcd('0x1b')](_0x4a6c8c['query'][_0x1bcd('0x1b')]);}_0x29615b[_0x1bcd('0x35')]=qs['sort'](_0x4a6c8c[_0x1bcd('0x2c')]['sort']);_0x29615b[_0x1bcd('0x36')]=qs[_0x1bcd('0x2d')](_['pick'](_0x4a6c8c[_0x1bcd('0x2c')],_0x3b3b1d[_0x1bcd('0x2d')]),_0xbbca44);if(_0x4a6c8c['query'][_0x1bcd('0x37')]){_0x29615b[_0x1bcd('0x36')]=_['merge'](_0x29615b[_0x1bcd('0x36')],{'$or':_[_0x1bcd('0x38')](_0x29615b[_0x1bcd('0x30')],function(_0x3a8f27){var _0x43c5c5={};_0x43c5c5[_0x3a8f27]={'$like':'%'+_0x4a6c8c[_0x1bcd('0x2c')][_0x1bcd('0x37')]+'%'};return _0x43c5c5;})});}_0x29615b=_['merge']({},_0x29615b,_0x4a6c8c[_0x1bcd('0x39')]);var _0x4cedb8={'where':_0x29615b[_0x1bcd('0x36')]};return db[_0x1bcd('0x2a')]['count'](_0x4cedb8)[_0x1bcd('0x23')](function(_0x4bfe13){_0xb9f698[_0x1bcd('0x3a')]=_0x4bfe13;if(_0x4a6c8c[_0x1bcd('0x2c')][_0x1bcd('0x3b')]){_0x29615b['include']=[{'all':!![]}];}return db[_0x1bcd('0x2a')][_0x1bcd('0x3c')](_0x29615b);})[_0x1bcd('0x23')](function(_0x445497){_0xb9f698[_0x1bcd('0x3d')]=_0x445497;return _0xb9f698;})[_0x1bcd('0x23')](respondWithFilteredResult(_0x2bf5ad,_0x29615b))[_0x1bcd('0x3e')](handleError(_0x2bf5ad,null));})[_0x1bcd('0x3e')](handleError(_0x2bf5ad,null));};exports[_0x1bcd('0x3f')]=function(_0x4dab25,_0x320f84){var _0x1818d9={'raw':![],'where':{'id':_0x4dab25['params']['id']}},_0x23efd7={};_0x23efd7[_0x1bcd('0x2f')]=_[_0x1bcd('0x2b')](db[_0x1bcd('0x2a')][_0x1bcd('0x40')]);_0x23efd7[_0x1bcd('0x2c')]=_[_0x1bcd('0x2b')](_0x4dab25['query']);_0x23efd7[_0x1bcd('0x2d')]=_[_0x1bcd('0x2e')](_0x23efd7['model'],_0x23efd7[_0x1bcd('0x2c')]);_0x1818d9[_0x1bcd('0x30')]=_[_0x1bcd('0x2e')](_0x23efd7['model'],qs['fields'](_0x4dab25[_0x1bcd('0x2c')][_0x1bcd('0x31')]));_0x1818d9[_0x1bcd('0x30')]=_0x1818d9[_0x1bcd('0x30')][_0x1bcd('0x32')]?_0x1818d9['attributes']:_0x23efd7[_0x1bcd('0x2f')];if(_0x4dab25[_0x1bcd('0x2c')][_0x1bcd('0x3b')]){_0x1818d9[_0x1bcd('0x41')]=[{'all':!![]}];}_0x1818d9=_[_0x1bcd('0x42')]({},_0x1818d9,_0x4dab25[_0x1bcd('0x39')]);return db[_0x1bcd('0x2a')][_0x1bcd('0x43')](_0x1818d9)[_0x1bcd('0x23')](handleEntityNotFound(_0x320f84,null))[_0x1bcd('0x23')](respondWithResult(_0x320f84,null))[_0x1bcd('0x3e')](handleError(_0x320f84,null));};exports[_0x1bcd('0x44')]=function(_0x361977,_0xa04945){return db[_0x1bcd('0x2a')][_0x1bcd('0x44')](_0x361977[_0x1bcd('0x45')],{})['then'](function(_0x5e5a33){var _0x1c115a=_0x361977[_0x1bcd('0x46')][_0x1bcd('0x47')]({'plain':!![]});if(!_0x1c115a)throw new Error(_0x1bcd('0x48'));if(_0x1c115a[_0x1bcd('0x49')]==='user'){var _0x1376c3=_0x5e5a33[_0x1bcd('0x47')]({'plain':!![]});var _0x523da3=_0x1bcd('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x523da3,'userProfileId':_0x1c115a['userProfileId']},'raw':!![]})[_0x1bcd('0x23')](function(_0x34904d){if(_0x34904d&&_0x34904d[_0x1bcd('0x4b')]===0x0){return db[_0x1bcd('0x25')][_0x1bcd('0x44')]({'name':_0x1376c3[_0x1bcd('0x28')],'resourceId':_0x1376c3['id'],'type':_0x34904d[_0x1bcd('0x28')],'sectionId':_0x34904d['id']},{})[_0x1bcd('0x23')](function(){return _0x5e5a33;});}else{return _0x5e5a33;}})[_0x1bcd('0x3e')](function(_0x3d8f83){logger[_0x1bcd('0x27')](_0x1bcd('0x4c'),_0x3d8f83);throw _0x3d8f83;});}return _0x5e5a33;})['then'](respondWithResult(_0xa04945,0xc9))[_0x1bcd('0x3e')](handleError(_0xa04945,null));};exports['update']=function(_0xe1f92,_0xfa2b2f){if(_0xe1f92[_0x1bcd('0x45')]['id']){delete _0xe1f92[_0x1bcd('0x45')]['id'];}return db[_0x1bcd('0x2a')][_0x1bcd('0x43')]({'where':{'id':_0xe1f92[_0x1bcd('0x4d')]['id']}})['then'](handleEntityNotFound(_0xfa2b2f,null))[_0x1bcd('0x23')](saveUpdates(_0xe1f92[_0x1bcd('0x45')],null))[_0x1bcd('0x23')](respondWithResult(_0xfa2b2f,null))[_0x1bcd('0x3e')](handleError(_0xfa2b2f,null));};exports[_0x1bcd('0x24')]=function(_0x4de844,_0x4ac031){return db[_0x1bcd('0x2a')][_0x1bcd('0x43')]({'where':{'id':_0x4de844[_0x1bcd('0x4d')]['id']}})[_0x1bcd('0x23')](handleEntityNotFound(_0x4ac031,null))[_0x1bcd('0x23')](removeEntity(_0x4ac031,null))[_0x1bcd('0x3e')](handleError(_0x4ac031,null));};exports[_0x1bcd('0x4e')]=function(_0x5eb026,_0x5812cb){return db[_0x1bcd('0x2a')][_0x1bcd('0x4e')]()[_0x1bcd('0x23')](respondWithResult(_0x5812cb,null))['catch'](handleError(_0x5812cb,null));};exports['addContacts']=function(_0xe25a7c,_0x51275a,_0x18af40){return db[_0x1bcd('0x4f')][_0x1bcd('0x43')]({'where':{'id':_0xe25a7c[_0x1bcd('0x4d')]['id']}})[_0x1bcd('0x23')](handleEntityNotFound(_0x51275a,null))[_0x1bcd('0x23')](function(_0x418689){if(_0x418689){return _0x418689[_0x1bcd('0x50')](_0xe25a7c[_0x1bcd('0x45')][_0x1bcd('0x51')],_['omit'](_0xe25a7c[_0x1bcd('0x45')],[_0x1bcd('0x51'),'id'])||{});}})['then'](respondWithResult(_0x51275a,null))['catch'](handleError(_0x51275a,null));};exports['getContacts']=function(_0x1f147b,_0x5d6280,_0x3ed84f){var _0xe7c08c={};var _0x29c08f={};var _0x584692;var _0x5c6cfd;return db[_0x1bcd('0x2a')][_0x1bcd('0x52')]({'where':{'id':_0x1f147b['params']['id']}})['then'](handleEntityNotFound(_0x5d6280,null))[_0x1bcd('0x23')](function(_0x4ce427){if(_0x4ce427){_0x584692=_0x4ce427;_0x29c08f[_0x1bcd('0x2f')]=_[_0x1bcd('0x2b')](db[_0x1bcd('0x4f')][_0x1bcd('0x40')]);_0x29c08f[_0x1bcd('0x2c')]=_[_0x1bcd('0x2b')](_0x1f147b[_0x1bcd('0x2c')]);_0x29c08f[_0x1bcd('0x2d')]=_[_0x1bcd('0x2e')](_0x29c08f[_0x1bcd('0x2f')],_0x29c08f[_0x1bcd('0x2c')]);_0xe7c08c[_0x1bcd('0x30')]=_[_0x1bcd('0x2e')](_0x29c08f[_0x1bcd('0x2f')],qs['fields'](_0x1f147b['query'][_0x1bcd('0x31')]));_0xe7c08c['attributes']=_0xe7c08c[_0x1bcd('0x30')][_0x1bcd('0x32')]?_0xe7c08c['attributes']:_0x29c08f['model'];_0xe7c08c[_0x1bcd('0x35')]=qs[_0x1bcd('0x53')](_0x1f147b[_0x1bcd('0x2c')][_0x1bcd('0x53')]);_0xe7c08c[_0x1bcd('0x36')]=qs['filters'](_[_0x1bcd('0x54')](_0x1f147b[_0x1bcd('0x2c')],_0x29c08f[_0x1bcd('0x2d')]));if(_0x1f147b[_0x1bcd('0x2c')][_0x1bcd('0x37')]){_0xe7c08c[_0x1bcd('0x36')]=_[_0x1bcd('0x42')](_0xe7c08c['where'],{'$or':_[_0x1bcd('0x38')](_0xe7c08c['attributes'],function(_0x233152){var _0x3774ea={};_0x3774ea[_0x233152]={'$like':'%'+_0x1f147b[_0x1bcd('0x2c')][_0x1bcd('0x37')]+'%'};return _0x3774ea;})});}_0xe7c08c=_['merge']({},_0xe7c08c,_0x1f147b[_0x1bcd('0x39')]);return _0x584692[_0x1bcd('0x55')](_0xe7c08c);}})[_0x1bcd('0x23')](function(_0x4843ec){if(_0x4843ec){_0x5c6cfd=_0x4843ec[_0x1bcd('0x32')];if(!_0x1f147b[_0x1bcd('0x2c')][_0x1bcd('0x33')](_0x1bcd('0x34'))){_0xe7c08c[_0x1bcd('0x1c')]=qs['limit'](_0x1f147b[_0x1bcd('0x2c')][_0x1bcd('0x1c')]);_0xe7c08c[_0x1bcd('0x1b')]=qs[_0x1bcd('0x1b')](_0x1f147b['query']['offset']);}return _0x584692['getContacts'](_0xe7c08c);}})[_0x1bcd('0x23')](function(_0x417599){if(_0x417599){return _0x417599?{'count':_0x5c6cfd,'rows':_0x417599}:null;}})[_0x1bcd('0x23')](respondWithResult(_0x5d6280,null))[_0x1bcd('0x3e')](handleError(_0x5d6280,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c7f86a6..9cfea6a 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 _0xd9eb=['util','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany'];(function(_0x4ebc20,_0x4c087b){var _0x26fce3=function(_0x59253f){while(--_0x59253f){_0x4ebc20['push'](_0x4ebc20['shift']());}};_0x26fce3(++_0x4c087b);}(_0xd9eb,0xa8));var _0xbd9e=function(_0x2d2ccc,_0x30f2fe){_0x2d2ccc=_0x2d2ccc-0x0;var _0x54dc55=_0xd9eb[_0x2d2ccc];return _0x54dc55;};'use strict';var _=require('lodash');var util=require(_0xbd9e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd9e('0x1'));var fs=require('fs');var path=require(_0xbd9e('0x2'));var rimraf=require(_0xbd9e('0x3'));var config=require(_0xbd9e('0x4'));var attributes=require(_0xbd9e('0x5'));module['exports']=function(_0x476629,_0x121125){return _0x476629['define'](_0xbd9e('0x6'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee20=['api','moment','request-promise','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x1b7523,_0x51b4e9){var _0x1dc12e=function(_0x2573f3){while(--_0x2573f3){_0x1b7523['push'](_0x1b7523['shift']());}};_0x1dc12e(++_0x51b4e9);}(_0xee20,0x18a));var _0x0ee2=function(_0x999162,_0x289750){_0x999162=_0x999162-0x0;var _0x4f899a=_0xee20[_0x999162];return _0x4f899a;};'use strict';var _=require(_0x0ee2('0x0'));var util=require(_0x0ee2('0x1'));var logger=require('../../config/logger')(_0x0ee2('0x2'));var moment=require(_0x0ee2('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ee2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ee2('0x5'));var config=require('../../config/environment');var attributes=require(_0x0ee2('0x6'));module[_0x0ee2('0x7')]=function(_0x21f993,_0x583cfe){return _0x21f993[_0x0ee2('0x8')](_0x0ee2('0x9'),attributes,{'tableName':_0x0ee2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 202745c..e87fe5b 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 _0xe05a=['stringify','error','code','message','result','lodash','moment','bluebird','rpc','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42ea30,_0x3c60c1){var _0x83e81e=function(_0x3b0e4a){while(--_0x3b0e4a){_0x42ea30['push'](_0x42ea30['shift']());}};_0x83e81e(++_0x3c60c1);}(_0xe05a,0xf3));var _0xae05=function(_0x5be0e5,_0x187d76){_0x5be0e5=_0x5be0e5-0x0;var _0x518f42=_0xe05a[_0x5be0e5];return _0x518f42;};'use strict';var _=require(_0xae05('0x0'));var util=require('util');var moment=require(_0xae05('0x1'));var BPromise=require(_0xae05('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')(_0xae05('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae05('0x4')][_0xae05('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1c5c3e,_0x43a8ba,_0x3a8867){return new BPromise(function(_0x112eec,_0x1c1752){return client[_0xae05('0x6')](_0x1c5c3e,_0x3a8867)[_0xae05('0x7')](function(_0x25a136){logger[_0xae05('0x8')](_0xae05('0x9'),_0x43a8ba,_0xae05('0xa'));logger[_0xae05('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x43a8ba,'request\x20sent',JSON[_0xae05('0xc')](_0x25a136));if(_0x25a136[_0xae05('0xd')]){if(_0x25a136[_0xae05('0xd')][_0xae05('0xe')]===0x1f4){logger[_0xae05('0xd')](_0xae05('0x9'),_0x43a8ba,_0x25a136[_0xae05('0xd')]['message']);return _0x1c1752(_0x25a136['error']['message']);}logger['error'](_0xae05('0x9'),_0x43a8ba,_0x25a136[_0xae05('0xd')]['message']);return _0x112eec(_0x25a136[_0xae05('0xd')][_0xae05('0xf')]);}else{logger[_0xae05('0x8')](_0xae05('0x9'),_0x43a8ba,'request\x20sent');_0x112eec(_0x25a136[_0xae05('0x10')]['message']);}})['catch'](function(_0x42e690){logger[_0xae05('0xd')](_0xae05('0x9'),_0x43a8ba,_0x42e690);_0x1c1752(_0x42e690);});});} \ No newline at end of file +var _0xde9b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s'];(function(_0x5dbd29,_0xc9dd40){var _0x577f92=function(_0x42b53c){while(--_0x42b53c){_0x5dbd29['push'](_0x5dbd29['shift']());}};_0x577f92(++_0xc9dd40);}(_0xde9b,0xc9));var _0xbde9=function(_0x460e6d,_0x26bbf9){_0x460e6d=_0x460e6d-0x0;var _0x288333=_0xde9b[_0x460e6d];return _0x288333;};'use strict';var _=require(_0xbde9('0x0'));var util=require(_0xbde9('0x1'));var moment=require(_0xbde9('0x2'));var BPromise=require(_0xbde9('0x3'));var rs=require(_0xbde9('0x4'));var fs=require('fs');var Redis=require(_0xbde9('0x5'));var db=require(_0xbde9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbde9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbde9('0x8'));var client=jayson[_0xbde9('0x9')][_0xbde9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe64b86,_0x298185,_0x3760b7){return new BPromise(function(_0x4aacb0,_0x257d52){return client[_0xbde9('0xb')](_0xe64b86,_0x3760b7)[_0xbde9('0xc')](function(_0x3b9036){logger[_0xbde9('0xd')]('CmCompany,\x20%s,\x20%s',_0x298185,_0xbde9('0xe'));logger[_0xbde9('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x298185,'request\x20sent',JSON[_0xbde9('0x10')](_0x3b9036));if(_0x3b9036['error']){if(_0x3b9036['error']['code']===0x1f4){logger[_0xbde9('0x11')](_0xbde9('0x12'),_0x298185,_0x3b9036[_0xbde9('0x11')][_0xbde9('0x13')]);return _0x257d52(_0x3b9036[_0xbde9('0x11')][_0xbde9('0x13')]);}logger[_0xbde9('0x11')](_0xbde9('0x12'),_0x298185,_0x3b9036[_0xbde9('0x11')][_0xbde9('0x13')]);return _0x4aacb0(_0x3b9036[_0xbde9('0x11')]['message']);}else{logger[_0xbde9('0xd')](_0xbde9('0x12'),_0x298185,_0xbde9('0xe'));_0x4aacb0(_0x3b9036[_0xbde9('0x14')]['message']);}})[_0xbde9('0x15')](function(_0x439187){logger[_0xbde9('0x11')]('CmCompany,\x20%s,\x20%s',_0x298185,_0x439187);_0x257d52(_0x439187);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8929424..50b3cd8 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 _0x190d=['../../config/environment','get','isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','addContacts','/:id','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x51e916,_0x549682){var _0x2f718d=function(_0x402905){while(--_0x402905){_0x51e916['push'](_0x51e916['shift']());}};_0x2f718d(++_0x549682);}(_0x190d,0x126));var _0xd190=function(_0x25131c,_0x55c347){_0x25131c=_0x25131c-0x0;var _0x829a63=_0x190d[_0x25131c];return _0x829a63;};'use strict';var multer=require(_0xd190('0x0'));var util=require('util');var path=require(_0xd190('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd190('0x2')]();var fs_extra=require(_0xd190('0x3'));var auth=require(_0xd190('0x4'));var interaction=require(_0xd190('0x5'));var config=require(_0xd190('0x6'));var controller=require('./cmCompany.controller');router[_0xd190('0x7')]('/',auth[_0xd190('0x8')](),controller[_0xd190('0x9')]);router[_0xd190('0x7')](_0xd190('0xa'),auth[_0xd190('0x8')](),controller['describe']);router[_0xd190('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd190('0xb')]);router[_0xd190('0x7')](_0xd190('0xc'),auth['isAuthenticated'](),controller[_0xd190('0xd')]);router[_0xd190('0xe')]('/',auth[_0xd190('0x8')](),controller['create']);router['post'](_0xd190('0xc'),auth[_0xd190('0x8')](),controller[_0xd190('0xf')]);router['put'](_0xd190('0x10'),auth[_0xd190('0x8')](),controller[_0xd190('0x11')]);router['delete']('/:id',auth[_0xd190('0x8')](),controller[_0xd190('0x12')]);module[_0xd190('0x13')]=router; \ No newline at end of file +var _0x06a7=['/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06a7,0x18f));var _0x706a=function(_0x2e2d89,_0x4bb615){_0x2e2d89=_0x2e2d89-0x0;var _0x3aba90=_0x06a7[_0x2e2d89];return _0x3aba90;};'use strict';var multer=require(_0x706a('0x0'));var util=require(_0x706a('0x1'));var path=require(_0x706a('0x2'));var timeout=require('connect-timeout');var express=require(_0x706a('0x3'));var router=express[_0x706a('0x4')]();var fs_extra=require(_0x706a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x706a('0x6'));var controller=require(_0x706a('0x7'));router[_0x706a('0x8')]('/',auth[_0x706a('0x9')](),controller[_0x706a('0xa')]);router[_0x706a('0x8')](_0x706a('0xb'),auth[_0x706a('0x9')](),controller[_0x706a('0xc')]);router[_0x706a('0x8')](_0x706a('0xd'),auth[_0x706a('0x9')](),controller[_0x706a('0xe')]);router[_0x706a('0x8')](_0x706a('0xf'),auth[_0x706a('0x9')](),controller[_0x706a('0x10')]);router[_0x706a('0x11')]('/',auth[_0x706a('0x9')](),controller['create']);router[_0x706a('0x11')](_0x706a('0xf'),auth['isAuthenticated'](),controller[_0x706a('0x12')]);router[_0x706a('0x13')](_0x706a('0xd'),auth[_0x706a('0x9')](),controller[_0x706a('0x14')]);router[_0x706a('0x15')](_0x706a('0xd'),auth['isAuthenticated'](),controller[_0x706a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d0990b7..fdc612c 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 _0xb10b=['TEXT','INTEGER','UNSIGNED','DATE','lodash','exports','STRING'];(function(_0x3e447f,_0x1162b9){var _0x7f2d95=function(_0x8ac030){while(--_0x8ac030){_0x3e447f['push'](_0x3e447f['shift']());}};_0x7f2d95(++_0x1162b9);}(_0xb10b,0x12a));var _0xbb10=function(_0xe3a46,_0x4f9273){_0xe3a46=_0xe3a46-0x0;var _0x5bb333=_0xb10b[_0xe3a46];return _0x5bb333;};'use strict';var _=require(_0xbb10('0x0'));var Sequelize=require('sequelize');module[_0xbb10('0x1')]={'firstName':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbb10('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xbb10('0x2')]},'city':{'type':Sequelize[_0xbb10('0x2')]},'country':{'type':Sequelize[_0xbb10('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbb10('0x2')]},'description':{'type':Sequelize[_0xbb10('0x3')]},'phone':{'type':Sequelize[_0xbb10('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbb10('0x2')]},'email':{'type':Sequelize[_0xbb10('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xbb10('0x2')]},'fb_data':{'type':Sequelize[_0xbb10('0x2')]},'twitter':{'type':Sequelize[_0xbb10('0x2')]},'skype':{'type':Sequelize[_0xbb10('0x2')]},'teams':{'type':Sequelize[_0xbb10('0x2')]},'viber':{'type':Sequelize[_0xbb10('0x2')]},'line':{'type':Sequelize[_0xbb10('0x2')]},'wechat':{'type':Sequelize[_0xbb10('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xbb10('0x4')](0x2)[_0xbb10('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbb10('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xbb10('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb10b=['TEXT','INTEGER','UNSIGNED','DATE','lodash','exports','STRING'];(function(_0x1fc9da,_0x2675d5){var _0x52065c=function(_0x488ad1){while(--_0x488ad1){_0x1fc9da['push'](_0x1fc9da['shift']());}};_0x52065c(++_0x2675d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x614c88,_0x184f02){_0x614c88=_0x614c88-0x0;var _0x1a768e=_0xb10b[_0x614c88];return _0x1a768e;};'use strict';var _=require(_0xbb10('0x0'));var Sequelize=require('sequelize');module[_0xbb10('0x1')]={'firstName':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbb10('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xbb10('0x2')]},'city':{'type':Sequelize[_0xbb10('0x2')]},'country':{'type':Sequelize[_0xbb10('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbb10('0x2')]},'description':{'type':Sequelize[_0xbb10('0x3')]},'phone':{'type':Sequelize[_0xbb10('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbb10('0x2')]},'email':{'type':Sequelize[_0xbb10('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xbb10('0x2')]},'fb_data':{'type':Sequelize[_0xbb10('0x2')]},'twitter':{'type':Sequelize[_0xbb10('0x2')]},'skype':{'type':Sequelize[_0xbb10('0x2')]},'teams':{'type':Sequelize[_0xbb10('0x2')]},'viber':{'type':Sequelize[_0xbb10('0x2')]},'line':{'type':Sequelize[_0xbb10('0x2')]},'wechat':{'type':Sequelize[_0xbb10('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xbb10('0x4')](0x2)[_0xbb10('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbb10('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xbb10('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3d6b93e..cb6b498 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 _0x15d5=['CmHopperFinal','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','join','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','findOrCreate','show','$and','format','cf_%d','omit','pickBy','table','setFields','id\x20=\x20?','values','phone','options','getTags','setTags','rawAttributes','sort','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','path','meta','import','binding','No\x20phone\x20column\x20specified','child_process','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','UserId','fullname','createdAt','range','VoiceCallReport','startCase','Website','closed','disposition','Account','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','findAndCountAll','flatten','sortBy','reverse','slice','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','offset','undefined','limit','count','status','set','Content-Range','then','end','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','all','fieldType','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','field','color','from','select','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','forEach','union','User','and','uc.UserId\x20=\x20?','datetime','castTo','DATE','text','map','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','DESC','having','resolve','role','agent','some','user','getLists','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','destroy','params','tags','startsWith','columnName','displayName','findAll','alias','custom','body','get','mergeWith','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x15d5,0x7e));var _0x515d=function(_0x56121e,_0x3bcae1){_0x56121e=_0x56121e-0x0;var _0x584744=_0x15d5[_0x56121e];return _0x584744;};'use strict';var moment=require(_0x515d('0x0'));var BPromise=require(_0x515d('0x1'));var util=require(_0x515d('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x515d('0x3'));var squel=require(_0x515d('0x4'));var Papa=require(_0x515d('0x5'));var Redis=require(_0x515d('0x6'));var qs=require(_0x515d('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x515d('0x8'))('api');var config=require(_0x515d('0x9'));var shared=require(_0x515d('0xa'));var db=require(_0x515d('0xb'))['db'];config[_0x515d('0xc')]=_[_0x515d('0xd')](config[_0x515d('0xc')],{'host':_0x515d('0xe'),'port':0x18eb});var socket=require(_0x515d('0xf'))(new Redis(config[_0x515d('0xc')]));require(_0x515d('0x10'))['register'](socket);function respondWithResult(_0x30247d,_0x13a746){_0x13a746=_0x13a746||0xc8;return function(_0x423b69){if(_0x423b69){return _0x30247d['status'](_0x13a746)['json'](_0x423b69);}};}function respondWithFilteredResult(_0x3b4ee0,_0x341014){return function(_0x457b56){if(_0x457b56){var _0x4fb283=typeof _0x341014[_0x515d('0x11')]===_0x515d('0x12')&&typeof _0x341014[_0x515d('0x13')]==='undefined';var _0x5998fd=_0x457b56[_0x515d('0x14')];var _0x247da2=_0x4fb283?0x0:_0x341014[_0x515d('0x11')];var _0x23e507=_0x4fb283?_0x457b56[_0x515d('0x14')]:_0x341014[_0x515d('0x11')]+_0x341014['limit'];var _0x1e3bdb;if(_0x23e507>=_0x5998fd){_0x23e507=_0x5998fd;_0x1e3bdb=0xc8;}else{_0x1e3bdb=0xce;}_0x3b4ee0[_0x515d('0x15')](_0x1e3bdb);return _0x3b4ee0[_0x515d('0x16')](_0x515d('0x17'),_0x247da2+'-'+_0x23e507+'/'+_0x5998fd)['json'](_0x457b56);}return null;};}function saveUpdates(_0x48fe29){return function(_0x3c2668){if(_0x3c2668){return _0x3c2668['update'](_0x48fe29)['then'](function(_0x176082){return _0x176082;});}return null;};}function removeEntity(_0x435be0){return function(_0x26a955){if(_0x26a955){return _0x26a955['destroy']()[_0x515d('0x18')](function(){_0x435be0[_0x515d('0x15')](0xcc)[_0x515d('0x19')]();});}};}function handleEntityNotFound(_0x599c93){return function(_0x212d0e){if(!_0x212d0e){_0x599c93['sendStatus'](0x194);}return _0x212d0e;};}function handleError(_0x46c166,_0x50f421){_0x50f421=_0x50f421||0x1f4;return function(_0x3a1b8d){logger[_0x515d('0x1a')](_0x3a1b8d[_0x515d('0x1b')]);if(_0x3a1b8d[_0x515d('0x1c')]){delete _0x3a1b8d[_0x515d('0x1c')];}_0x46c166['status'](_0x50f421)['send'](_0x3a1b8d);};}exports[_0x515d('0x1d')]=function(_0x3a8106,_0x3fa849){var _0x27ef06={},_0x3a3348={},_0x3be20a={'count':0x0,'rows':[]};return db[_0x515d('0x1e')][_0x515d('0x1f')]()['then'](function(_0xf916ab){var _0x14778c=[];for(var _0x377e32=0x0;_0x377e320x1){_0x2b5f62['or'](_0x515d('0x5e'),qs[_0x515d('0x5f')](_0x51a65c),null);}else{if(qs[_0x515d('0x60')](_0x51a65c)){_0x2b5f62['or'](_0x515d('0x61'),_0x51a65c+'%');_0x2b5f62['or'](_0x515d('0x62'),_0x51a65c+'%');_0x2b5f62['or'](_0x515d('0x63'),_0x51a65c+'%');_0x2b5f62['or']('c.fax\x20LIKE\x20?',_0x51a65c+'%');}else if(qs[_0x515d('0x64')](_0x51a65c)){_0x2b5f62['or']('c.email\x20LIKE\x20?',_0x51a65c+'%');}else{_0x2b5f62['or'](_0x515d('0x65'),'%'+_0x51a65c+'%');_0x2b5f62['or'](_0x515d('0x66'),'%'+_0x51a65c+'%');_0x2b5f62['or'](_0x515d('0x67'),'%'+_0x51a65c+'%');}}}}_0x550c03[_0x515d('0x32')](_0x2b5f62);_0x550c03[_0x515d('0x68')](_0x515d('0x69'));var _0x2f302d={'type':db[_0x515d('0x6a')]['QueryTypes'][_0x515d('0x6b')],'raw':!![]};var _0x4f0c84=_0x550c03[_0x515d('0x6c')]()['field'](_0x515d('0x69'));if(_0x27ef06[_0x515d('0x31')]){_0x27ef06[_0x515d('0x31')][_0x515d('0x48')](function(_0x14b545){_0x550c03[_0x515d('0x31')]('c.'+_0x14b545[0x0],_0x14b545[0x1]===_0x515d('0x6d')?![]:!![]);});}if(!_['isEmpty'](_0x450a02)){_0x550c03[_0x515d('0x6e')](_0x366124);_0x4f0c84[_0x515d('0x32')]('t.id\x20IN\x20?',_0x450a02);}BPromise[_0x515d('0x6f')]()[_0x515d('0x18')](function(){if(!_0x9a2ba2)return;if(_0x3a8106['user'][_0x515d('0x70')]!==_0x515d('0x71'))return;if(!_[_0x515d('0x72')](_0x9a2ba2[_0x515d('0x43')],[_0x515d('0x34'),'User'])){return _0x3a8106[_0x515d('0x73')][_0x515d('0x74')]({'attributes':['id'],'raw':!![]})[_0x515d('0x18')](function(_0x48063b){if(_['isEmpty'](_0x48063b)){_0x4f0c84['where']('c.ListId\x20IS\x20NULL');_0x550c03[_0x515d('0x32')](_0x515d('0x75'));}else{_0x4f0c84[_0x515d('0x32')](_0x515d('0x55'),_[_0x515d('0x51')](_0x48063b,'id'));_0x550c03[_0x515d('0x32')](_0x515d('0x55'),_[_0x515d('0x51')](_0x48063b,'id'));}});}})[_0x515d('0x18')](function(){if(_0x3a8106['user'][_0x515d('0x70')]===_0x515d('0x71')&&!_0x9a2ba2&&!_0x3a8106[_0x515d('0x2a')][_0x515d('0x76')])return[];return db[_0x515d('0x77')][_0x515d('0x2a')](_0x4f0c84[_0x515d('0x78')](),_0x2f302d);})[_0x515d('0x18')](function(_0x4b2e97){_0x3be20a[_0x515d('0x14')]=_0x4b2e97[_0x515d('0x21')];if(_0x3be20a['count']===0x0)return[];return db[_0x515d('0x77')][_0x515d('0x2a')](_0x276661[_0x515d('0x78')](),_0x2f302d)['then'](function(_0x3b28e6){_0x16561e=_[_0x515d('0x79')](_0x3b28e6,'id');_0x2f302d=_[_0x515d('0x7a')](_0x2f302d,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a8106['query'][_0x515d('0x2e')]){_0x27ef06[_0x515d('0x2c')][_0x515d('0x48')](function(_0x2ecee4){_0x550c03[_0x515d('0x34')]('c.'+_0x2ecee4);});}else{_0x550c03[_0x515d('0x34')](_0x515d('0x69'));_0x550c03['field']('c.firstName');_0x550c03['field'](_0x515d('0x7b'));_0x550c03[_0x515d('0x34')](_0x515d('0x7c'));_0x550c03[_0x515d('0x34')](_0x515d('0x7d'));_0x550c03['field'](_0x515d('0x7e'));_0x550c03[_0x515d('0x34')](_0x515d('0x7f'));_0x550c03[_0x515d('0x34')](_0x515d('0x80'));_0x550c03['field'](_0x515d('0x81'));_0x550c03[_0x515d('0x34')](_0x515d('0x82'));_0x550c03[_0x515d('0x34')](_0x515d('0x83'));_0x550c03[_0x515d('0x34')](_0x515d('0x84'),_0x515d('0x85'));}if(_0x27ef06['limit'])_0x550c03[_0x515d('0x13')](_0x27ef06[_0x515d('0x13')]);if(_0x27ef06[_0x515d('0x11')])_0x550c03[_0x515d('0x11')](_0x27ef06[_0x515d('0x11')]);return db[_0x515d('0x77')][_0x515d('0x2a')](_0x550c03['toString'](),_0x2f302d);});})[_0x515d('0x18')](function(_0x586836){_0x586836[_0x515d('0x48')](function(_0x43a4aa){if(_0x43a4aa[_0x515d('0x85')]){_0x43a4aa[_0x515d('0x86')]=[];_0x43a4aa[_0x515d('0x85')][_0x515d('0x47')](',')[_0x515d('0x48')](function(_0x1ff53a){_0x43a4aa[_0x515d('0x86')][_0x515d('0x23')](_0x16561e[_0x1ff53a]);});}delete _0x43a4aa[_0x515d('0x85')];});_0x3be20a['rows']=_0x586836;return _0x3be20a;})[_0x515d('0x18')](respondWithFilteredResult(_0x3fa849,_0x27ef06));})[_0x515d('0x87')](handleError(_0x3fa849,null));};exports[_0x515d('0x88')]=function(_0x234f57,_0xfff4a4){return db['CmContact'][_0x515d('0x44')]({'where':{'id':_0x234f57[_0x515d('0x89')]['id']}})[_0x515d('0x18')](handleEntityNotFound(_0xfff4a4,null))[_0x515d('0x18')](removeEntity(_0xfff4a4,null))[_0x515d('0x87')](handleError(_0xfff4a4,null));};exports[_0x515d('0x1f')]=function(_0x244b46,_0x2fd1ff){return db[_0x515d('0x1e')][_0x515d('0x1f')]()['then'](function(_0x4324af){delete _0x4324af[_0x515d('0x8a')];for(var _0x587195=0x0;_0x587195=_0x55689a){_0x2e2a42=_0x55689a;_0x59d7fd=0xc8;}else{_0x59d7fd=0xce;}_0x46c1f8['status'](_0x59d7fd);return _0x46c1f8['set'](_0xd5aa('0x14'),_0x19f4ad+'-'+_0x2e2a42+'/'+_0x55689a)['json'](_0xaa05f1);}return null;};}function saveUpdates(_0x3db918){return function(_0x5b34a3){if(_0x5b34a3){return _0x5b34a3[_0xd5aa('0x15')](_0x3db918)[_0xd5aa('0x16')](function(_0x25845d){return _0x25845d;});}return null;};}function removeEntity(_0x4d75e4){return function(_0x2d91f4){if(_0x2d91f4){return _0x2d91f4[_0xd5aa('0x17')]()[_0xd5aa('0x16')](function(){_0x4d75e4[_0xd5aa('0xe')](0xcc)[_0xd5aa('0x18')]();});}};}function handleEntityNotFound(_0x374df7){return function(_0x422e36){if(!_0x422e36){_0x374df7['sendStatus'](0x194);}return _0x422e36;};}function handleError(_0x3561d2,_0x48dfe9){_0x48dfe9=_0x48dfe9||0x1f4;return function(_0x501c7a){logger[_0xd5aa('0x19')](_0x501c7a[_0xd5aa('0x1a')]);if(_0x501c7a[_0xd5aa('0x1b')]){delete _0x501c7a['name'];}_0x3561d2[_0xd5aa('0xe')](_0x48dfe9)[_0xd5aa('0x1c')](_0x501c7a);};}exports['index']=function(_0xaa96e5,_0x2d8dcd){var _0x5a1d78={},_0x30a9d8={},_0x76b080={'count':0x0,'rows':[]};return db['CmContact'][_0xd5aa('0x1d')]()[_0xd5aa('0x16')](function(_0x713539){var _0x5b5bf2=[];for(var _0x18c1a3=0x0;_0x18c1a30x1){_0x307057['or'](_0xd5aa('0x57'),qs[_0xd5aa('0x58')](_0x14d073),null);}else{if(qs[_0xd5aa('0x59')](_0x14d073)){_0x307057['or'](_0xd5aa('0x5a'),_0x14d073+'%');_0x307057['or'](_0xd5aa('0x5b'),_0x14d073+'%');_0x307057['or'](_0xd5aa('0x5c'),_0x14d073+'%');_0x307057['or']('c.fax\x20LIKE\x20?',_0x14d073+'%');}else if(qs[_0xd5aa('0x5d')](_0x14d073)){_0x307057['or'](_0xd5aa('0x5e'),_0x14d073+'%');}else{_0x307057['or']('c.firstName\x20LIKE\x20?','%'+_0x14d073+'%');_0x307057['or'](_0xd5aa('0x5f'),'%'+_0x14d073+'%');_0x307057['or'](_0xd5aa('0x5e'),'%'+_0x14d073+'%');}}}}_0x32a592[_0xd5aa('0x2f')](_0x307057);_0x32a592[_0xd5aa('0x60')](_0xd5aa('0x61'));var _0x23a788={'type':db[_0xd5aa('0x62')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3ca504=_0x32a592[_0xd5aa('0x63')]()[_0xd5aa('0x32')](_0xd5aa('0x61'));if(_0x5a1d78[_0xd5aa('0x2d')]){_0x5a1d78[_0xd5aa('0x2d')][_0xd5aa('0x45')](function(_0x17c6ec){_0x32a592[_0xd5aa('0x2d')]('c.'+_0x17c6ec[0x0],_0x17c6ec[0x1]===_0xd5aa('0x64')?![]:!![]);});}if(!_[_0xd5aa('0x65')](_0x33f4d4)){_0x32a592[_0xd5aa('0x66')](_0x552169);_0x3ca504['where']('t.id\x20IN\x20?',_0x33f4d4);}BPromise['resolve']()[_0xd5aa('0x16')](function(){if(!_0x292baa)return;if(_0xaa96e5[_0xd5aa('0x67')][_0xd5aa('0x68')]!==_0xd5aa('0x69'))return;if(!_[_0xd5aa('0x6a')](_0x292baa[_0xd5aa('0x40')],[_0xd5aa('0x32'),_0xd5aa('0x6b')])){return _0xaa96e5[_0xd5aa('0x67')][_0xd5aa('0x6c')]({'attributes':['id'],'raw':!![]})[_0xd5aa('0x16')](function(_0x3b36b3){if(_[_0xd5aa('0x65')](_0x3b36b3)){_0x3ca504['where'](_0xd5aa('0x6d'));_0x32a592[_0xd5aa('0x2f')](_0xd5aa('0x6d'));}else{_0x3ca504[_0xd5aa('0x2f')](_0xd5aa('0x50'),_[_0xd5aa('0x44')](_0x3b36b3,'id'));_0x32a592[_0xd5aa('0x2f')](_0xd5aa('0x50'),_[_0xd5aa('0x44')](_0x3b36b3,'id'));}});}})['then'](function(){if(_0xaa96e5['user']['role']===_0xd5aa('0x69')&&!_0x292baa&&!_0xaa96e5['query'][_0xd5aa('0x6e')])return[];return db[_0xd5aa('0x6f')]['query'](_0x3ca504[_0xd5aa('0x70')](),_0x23a788);})[_0xd5aa('0x16')](function(_0x56ec91){_0x76b080[_0xd5aa('0x12')]=_0x56ec91[_0xd5aa('0x2b')];if(_0x76b080[_0xd5aa('0x12')]===0x0)return[];return db[_0xd5aa('0x6f')][_0xd5aa('0x27')](_0x5cfe32[_0xd5aa('0x70')](),_0x23a788)[_0xd5aa('0x16')](function(_0x1cb83e){_0x1f0c1d=_[_0xd5aa('0x71')](_0x1cb83e,'id');_0x23a788=_[_0xd5aa('0x72')](_0x23a788,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xaa96e5[_0xd5aa('0x27')][_0xd5aa('0x73')]){_0x5a1d78['attributes'][_0xd5aa('0x45')](function(_0x4cdcd8){_0x32a592[_0xd5aa('0x32')]('c.'+_0x4cdcd8);});}else{_0x32a592['field'](_0xd5aa('0x61'));_0x32a592['field']('c.firstName');_0x32a592['field'](_0xd5aa('0x74'));_0x32a592['field'](_0xd5aa('0x75'));_0x32a592['field']('c.mobile');_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x76'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x77'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x78'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x79'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x7a'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x7b'));_0x32a592[_0xd5aa('0x32')](_0xd5aa('0x7c'),'TagIds');}if(_0x5a1d78['limit'])_0x32a592[_0xd5aa('0x13')](_0x5a1d78[_0xd5aa('0x13')]);if(_0x5a1d78[_0xd5aa('0x10')])_0x32a592[_0xd5aa('0x10')](_0x5a1d78[_0xd5aa('0x10')]);return db['sequelize']['query'](_0x32a592[_0xd5aa('0x70')](),_0x23a788);});})[_0xd5aa('0x16')](function(_0x3690ed){_0x3690ed[_0xd5aa('0x45')](function(_0x25f846){if(_0x25f846[_0xd5aa('0x7d')]){_0x25f846[_0xd5aa('0x7e')]=[];_0x25f846[_0xd5aa('0x7d')]['split'](',')[_0xd5aa('0x45')](function(_0x508ac9){_0x25f846[_0xd5aa('0x7e')][_0xd5aa('0x21')](_0x1f0c1d[_0x508ac9]);});}delete _0x25f846['TagIds'];});_0x76b080[_0xd5aa('0x7f')]=_0x3690ed;return _0x76b080;})['then'](respondWithFilteredResult(_0x2d8dcd,_0x5a1d78));})[_0xd5aa('0x80')](handleError(_0x2d8dcd,null));};exports[_0xd5aa('0x17')]=function(_0x4ad95e,_0x2e1de7){return db[_0xd5aa('0x81')]['find']({'where':{'id':_0x4ad95e[_0xd5aa('0x82')]['id']}})[_0xd5aa('0x16')](handleEntityNotFound(_0x2e1de7,null))[_0xd5aa('0x16')](removeEntity(_0x2e1de7,null))[_0xd5aa('0x80')](handleError(_0x2e1de7,null));};exports[_0xd5aa('0x1d')]=function(_0x5364be,_0x33b419){return db[_0xd5aa('0x81')]['describe']()[_0xd5aa('0x16')](function(_0xb34cb){delete _0xb34cb[_0xd5aa('0x83')];for(var _0xb0a6be=0x0;_0xb0a6be{}\s\\|]/g,'-');_0x31d4f0(null,util['format'](_0x9a1b('0x1b'),path['basename'](_0x3ec147[_0x9a1b('0x19')],path[_0x9a1b('0x1c')](_0x3ec147[_0x9a1b('0x19')])),Date['now'](),path[_0x9a1b('0x1c')](_0x3ec147[_0x9a1b('0x19')])));}})});router[_0x9a1b('0x15')](_0x9a1b('0x1d'),upload['single']('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9a1b('0x1e')]({'destination':function(_0xc7e126,_0x226366,_0x2ae104){_0x2ae104(null,path['join'](config['root'],_0x9a1b('0x1f')));},'filename':function(_0x251460,_0xdf6d7f,_0x25576c){_0xdf6d7f[_0x9a1b('0x19')]=_0xdf6d7f[_0x9a1b('0x19')][_0x9a1b('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25576c(null,util[_0x9a1b('0x20')](_0x9a1b('0x1b'),path[_0x9a1b('0x21')](_0xdf6d7f[_0x9a1b('0x19')],path['extname'](_0xdf6d7f[_0x9a1b('0x19')])),Date['now'](),path['extname'](_0xdf6d7f['originalname'])));}})});router[_0x9a1b('0x15')](_0x9a1b('0x22'),upload[_0x9a1b('0x23')](_0x9a1b('0x24')),controller[_0x9a1b('0x25')]);router[_0x9a1b('0x15')](_0x9a1b('0x26'),auth[_0x9a1b('0x7')](),controller[_0x9a1b('0x27')]);router[_0x9a1b('0x28')]('/:id',auth['isAuthenticated'](),controller[_0x9a1b('0x29')]);router[_0x9a1b('0x2a')](_0x9a1b('0xa'),auth[_0x9a1b('0x7')](),controller[_0x9a1b('0x2b')]);module[_0x9a1b('0x2c')]=router; \ No newline at end of file +var _0x00d1=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','now','/csv','single','file','extname','/upload','upload','/upload/:id','delete','destroy','multer','util','path'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x00d1,0xf7));var _0x100d=function(_0x1152e5,_0x5a8eaf){_0x1152e5=_0x1152e5-0x0;var _0xd1fcdb=_0x00d1[_0x1152e5];return _0xd1fcdb;};'use strict';var multer=require(_0x100d('0x0'));var util=require(_0x100d('0x1'));var path=require(_0x100d('0x2'));var timeout=require(_0x100d('0x3'));var express=require('express');var router=express[_0x100d('0x4')]();var fs_extra=require(_0x100d('0x5'));var auth=require(_0x100d('0x6'));var interaction=require(_0x100d('0x7'));var config=require('../../config/environment');var controller=require(_0x100d('0x8'));router['get']('/',auth[_0x100d('0x9')](),controller['index']);router[_0x100d('0xa')](_0x100d('0xb'),auth[_0x100d('0x9')](),controller[_0x100d('0xc')]);router[_0x100d('0xa')](_0x100d('0xd'),auth[_0x100d('0x9')](),controller[_0x100d('0xe')]);router[_0x100d('0xa')](_0x100d('0xf'),auth[_0x100d('0x9')](),controller[_0x100d('0x10')]);router['get'](_0x100d('0x11'),auth[_0x100d('0x9')](),controller[_0x100d('0x12')]);router[_0x100d('0xa')](_0x100d('0x13'),auth[_0x100d('0x9')](),controller['getHopperHistories']);router[_0x100d('0xa')]('/:id/hopper_finals',auth[_0x100d('0x9')](),controller[_0x100d('0x14')]);router['get'](_0x100d('0x15'),auth[_0x100d('0x9')](),controller[_0x100d('0x16')]);router[_0x100d('0xa')](_0x100d('0x17'),auth[_0x100d('0x9')](),controller[_0x100d('0x18')]);router[_0x100d('0x19')](_0x100d('0x1a'),auth['isAuthenticated'](),controller[_0x100d('0x1b')]);router[_0x100d('0x19')]('/',auth['isAuthenticated'](),controller[_0x100d('0x1c')]);router['post'](_0x100d('0x1d'),auth[_0x100d('0x9')](),controller[_0x100d('0x1e')]);router['post'](_0x100d('0xf'),auth[_0x100d('0x9')](),controller[_0x100d('0x1f')]);var upload=multer({'storage':multer[_0x100d('0x20')]({'destination':function(_0x2fcf53,_0x5de5b5,_0x27a096){_0x27a096(null,path[_0x100d('0x21')](config[_0x100d('0x22')],'server/files/tmp'));},'filename':function(_0x5e0ca7,_0x150eb8,_0x1a7080){_0x150eb8['originalname']=_0x150eb8[_0x100d('0x23')][_0x100d('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a7080(null,util[_0x100d('0x25')](_0x100d('0x26'),path[_0x100d('0x27')](_0x150eb8[_0x100d('0x23')],path['extname'](_0x150eb8[_0x100d('0x23')])),Date[_0x100d('0x28')](),path['extname'](_0x150eb8[_0x100d('0x23')])));}})});router[_0x100d('0x19')](_0x100d('0x29'),upload[_0x100d('0x2a')](_0x100d('0x2b')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x100d('0x20')]({'destination':function(_0x395ae0,_0x4f0714,_0x325cbc){_0x325cbc(null,path[_0x100d('0x21')](config[_0x100d('0x22')],'server/files/tmp'));},'filename':function(_0x503616,_0x3e81cb,_0x1e7501){_0x3e81cb[_0x100d('0x23')]=_0x3e81cb[_0x100d('0x23')][_0x100d('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e7501(null,util[_0x100d('0x25')](_0x100d('0x26'),path[_0x100d('0x27')](_0x3e81cb['originalname'],path[_0x100d('0x2c')](_0x3e81cb[_0x100d('0x23')])),Date[_0x100d('0x28')](),path[_0x100d('0x2c')](_0x3e81cb['originalname'])));}})});router['post'](_0x100d('0x2d'),upload[_0x100d('0x2a')](_0x100d('0x2b')),controller[_0x100d('0x2e')]);router[_0x100d('0x19')](_0x100d('0x2f'),auth[_0x100d('0x9')](),controller['import']);router['put'](_0x100d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x100d('0x30')]('/:id',auth[_0x100d('0x9')](),controller[_0x100d('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index df3f13d..157a632 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 _0xc146=['parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type'];(function(_0x5b065e,_0x51d0d2){var _0x1afd26=function(_0x33b3ee){while(--_0x33b3ee){_0x5b065e['push'](_0x5b065e['shift']());}};_0x1afd26(++_0x51d0d2);}(_0xc146,0x1c0));var _0x6c14=function(_0x89a94d,_0x6742ed){_0x89a94d=_0x89a94d-0x0;var _0x14d3f9=_0xc146[_0x89a94d];return _0x14d3f9;};'use strict';var Sequelize=require(_0x6c14('0x0'));var _=require(_0x6c14('0x1'));module[_0x6c14('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1fa8e2){return this[_0x6c14('0x3')](_0x6c14('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2b6570){this[_0x6c14('0x5')](_0x6c14('0x4'),_0x2b6570?_0x2b6570:this[_0x6c14('0x3')](_0x6c14('0x6')));}},'type':{'type':Sequelize[_0x6c14('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x6c14('0x8')](_0x6c14('0x9')),'get':function(){if(this[_0x6c14('0x3')](_0x6c14('0xa'))==='select'){return JSON[_0x6c14('0xb')](this[_0x6c14('0x3')](_0x6c14('0xc')));}else{return this[_0x6c14('0x3')](_0x6c14('0xc'));}},'set':function(_0x1cfbf1){if(Array['isArray'](_0x1cfbf1)){this['setDataValue'](_0x6c14('0xc'),JSON[_0x6c14('0xd')](_0x1cfbf1));}else{this[_0x6c14('0x5')](_0x6c14('0xc'),_0x1cfbf1);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6c14('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6c14('0xf')](_0x6c14('0x10'))}}; \ No newline at end of file +var _0x893f=['name','STRING','TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','sequelize','exports','VIRTUAL','getDataValue','alias','setDataValue'];(function(_0xde0c87,_0x122c9e){var _0x27469d=function(_0x34413d){while(--_0x34413d){_0xde0c87['push'](_0xde0c87['shift']());}};_0x27469d(++_0x122c9e);}(_0x893f,0x1da));var _0xf893=function(_0x45523a,_0x2ef861){_0x45523a=_0x45523a-0x0;var _0x2c31d0=_0x893f[_0x45523a];return _0x2c31d0;};'use strict';var Sequelize=require(_0xf893('0x0'));var _=require('lodash');module[_0xf893('0x1')]={'name':{'type':Sequelize[_0xf893('0x2')],'get':function(_0x23a862){return this[_0xf893('0x3')](_0xf893('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x47e86c){this[_0xf893('0x5')](_0xf893('0x4'),_0x47e86c?_0x47e86c:this[_0xf893('0x3')](_0xf893('0x6')));}},'type':{'type':Sequelize[_0xf893('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xf893('0x8')](_0xf893('0x9')),'get':function(){if(this[_0xf893('0x3')](_0xf893('0xa'))==='select'){return JSON[_0xf893('0xb')](this[_0xf893('0x3')](_0xf893('0xc')));}else{return this[_0xf893('0x3')](_0xf893('0xc'));}},'set':function(_0x155103){if(Array['isArray'](_0x155103)){this['setDataValue']('values',JSON[_0xf893('0xd')](_0x155103));}else{this[_0xf893('0x5')]('values',_0x155103);}}},'required':{'type':Sequelize[_0xf893('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf893('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf893('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5ad07ea..d03ed97 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 _0xe60b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','CmCustomField','includeAll','include','rows','show','params','rawAttributes','catch','update','body','find','create','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30122d,_0x4ff436){var _0x4b88bc=function(_0x3020d6){while(--_0x3020d6){_0x30122d['push'](_0x30122d['shift']());}};_0x4b88bc(++_0x4ff436);}(_0xe60b,0xf1));var _0xbe60=function(_0x4ebba4,_0x1ffdfd){_0x4ebba4=_0x4ebba4-0x0;var _0x29a6d3=_0xe60b[_0x4ebba4];return _0x29a6d3;};'use strict';var emlformat=require(_0xbe60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe60('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe60('0x2'));var moment=require('moment');var BPromise=require(_0xbe60('0x3'));var Mustache=require('mustache');var util=require(_0xbe60('0x4'));var path=require(_0xbe60('0x5'));var sox=require(_0xbe60('0x6'));var csv=require(_0xbe60('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe60('0x8'));var _=require(_0xbe60('0x9'));var squel=require(_0xbe60('0xa'));var crypto=require(_0xbe60('0xb'));var jsforce=require(_0xbe60('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe60('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe60('0xe'));var qs=require(_0xbe60('0xf'));var as=require(_0xbe60('0x10'));var hardwareService=require(_0xbe60('0x11'));var logger=require(_0xbe60('0x12'))(_0xbe60('0x13'));var utils=require(_0xbe60('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbe60('0x15'));var db=require(_0xbe60('0x16'))['db'];function respondWithStatusCode(_0x1a28e8,_0x4b92a1){_0x4b92a1=_0x4b92a1||0xcc;return function(_0x53e915){if(_0x53e915){return _0x1a28e8[_0xbe60('0x17')](_0x4b92a1);}return _0x1a28e8['status'](_0x4b92a1)[_0xbe60('0x18')]();};}function respondWithResult(_0x262cb3,_0x3efc47){_0x3efc47=_0x3efc47||0xc8;return function(_0x2c58bb){if(_0x2c58bb){return _0x262cb3['status'](_0x3efc47)[_0xbe60('0x19')](_0x2c58bb);}};}function respondWithFilteredResult(_0x49f242,_0x53a68c){return function(_0x5266f3){if(_0x5266f3){var _0x180345=typeof _0x53a68c[_0xbe60('0x1a')]===_0xbe60('0x1b')&&typeof _0x53a68c[_0xbe60('0x1c')]==='undefined';var _0x392714=_0x5266f3[_0xbe60('0x1d')];var _0x3cd5c6=_0x180345?0x0:_0x53a68c[_0xbe60('0x1a')];var _0x32f857=_0x180345?_0x5266f3[_0xbe60('0x1d')]:_0x53a68c[_0xbe60('0x1a')]+_0x53a68c['limit'];var _0x86c91d;if(_0x32f857>=_0x392714){_0x32f857=_0x392714;_0x86c91d=0xc8;}else{_0x86c91d=0xce;}_0x49f242[_0xbe60('0x1e')](_0x86c91d);return _0x49f242['set'](_0xbe60('0x1f'),_0x3cd5c6+'-'+_0x32f857+'/'+_0x392714)[_0xbe60('0x19')](_0x5266f3);}return null;};}function patchUpdates(_0x9c067){return function(_0x5e8de8){try{jsonpatch[_0xbe60('0x20')](_0x5e8de8,_0x9c067,!![]);}catch(_0x1716c9){return BPromise[_0xbe60('0x21')](_0x1716c9);}return _0x5e8de8[_0xbe60('0x22')]();};}function saveUpdates(_0x34cd45,_0x30dc5b){return function(_0xb8d8b0){if(_0xb8d8b0){return _0xb8d8b0['update'](_0x34cd45)[_0xbe60('0x23')](function(_0x545a0a){return _0x545a0a;});}return null;};}function removeEntity(_0x3ff587,_0x282b61){return function(_0x1696f8){if(_0x1696f8){return _0x1696f8[_0xbe60('0x24')]()[_0xbe60('0x23')](function(){_0x3ff587[_0xbe60('0x1e')](0xcc)[_0xbe60('0x18')]();});}};}function handleEntityNotFound(_0x6ea599,_0x4d4e66){return function(_0x1f5507){if(!_0x1f5507){_0x6ea599[_0xbe60('0x17')](0x194);}return _0x1f5507;};}function handleError(_0x5245b7,_0x29b4e2){_0x29b4e2=_0x29b4e2||0x1f4;return function(_0x4b6aa0){logger[_0xbe60('0x25')](_0x4b6aa0[_0xbe60('0x26')]);if(_0x4b6aa0[_0xbe60('0x27')]){delete _0x4b6aa0[_0xbe60('0x27')];}_0x5245b7[_0xbe60('0x1e')](_0x29b4e2)['send'](_0x4b6aa0);};}exports[_0xbe60('0x28')]=function(_0x4bb3a3,_0x364057){var _0x13a98c={},_0x251151={},_0x2f868e={'count':0x0,'rows':[]};var _0x3cab1f=_['map'](db['CmCustomField']['rawAttributes'],function(_0x3d7ea3){return{'name':_0x3d7ea3[_0xbe60('0x29')],'type':_0x3d7ea3[_0xbe60('0x2a')][_0xbe60('0x2b')]};});_0x251151[_0xbe60('0x2c')]=_['differenceBy'](_['map'](_0x3cab1f,_0xbe60('0x27')),[_0xbe60('0x27')]);_0x251151[_0xbe60('0x2d')]=_[_0xbe60('0x2e')](_0x4bb3a3[_0xbe60('0x2d')]);_0x251151[_0xbe60('0x2f')]=_[_0xbe60('0x30')](_0x251151['model'],_0x251151['query']);_0x13a98c[_0xbe60('0x31')]=_['intersection'](_0x251151[_0xbe60('0x2c')],qs[_0xbe60('0x32')](_0x4bb3a3[_0xbe60('0x2d')]['fields']));_0x13a98c['attributes']=_0x13a98c[_0xbe60('0x31')][_0xbe60('0x33')]?_0x13a98c[_0xbe60('0x31')]:_0x251151[_0xbe60('0x2c')];if(!_0x4bb3a3[_0xbe60('0x2d')][_0xbe60('0x34')]('nolimit')){_0x13a98c[_0xbe60('0x1c')]=qs[_0xbe60('0x1c')](_0x4bb3a3[_0xbe60('0x2d')][_0xbe60('0x1c')]);_0x13a98c[_0xbe60('0x1a')]=qs['offset'](_0x4bb3a3['query'][_0xbe60('0x1a')]);}_0x13a98c['order']=qs[_0xbe60('0x35')](_0x4bb3a3['query'][_0xbe60('0x35')]);_0x13a98c[_0xbe60('0x36')]=qs[_0xbe60('0x2f')](_[_0xbe60('0x37')](_0x4bb3a3[_0xbe60('0x2d')],_0x251151[_0xbe60('0x2f')]),_0x3cab1f);if(_0x4bb3a3['query'][_0xbe60('0x38')]){_0x13a98c[_0xbe60('0x36')]=_[_0xbe60('0x39')](_0x13a98c[_0xbe60('0x36')],{'$or':_[_0xbe60('0x3a')](_0x3cab1f,function(_0x1cc280){if(_0x1cc280['type']!==_0xbe60('0x3b')){var _0x9626b7={};_0x9626b7[_0x1cc280['name']]={'$like':'%'+_0x4bb3a3['query'][_0xbe60('0x38')]+'%'};return _0x9626b7;}})});}_0x13a98c=_[_0xbe60('0x39')]({},_0x13a98c,_0x4bb3a3[_0xbe60('0x3c')]);var _0x333f30={'where':_0x13a98c[_0xbe60('0x36')]};return db[_0xbe60('0x3d')][_0xbe60('0x1d')](_0x333f30)['then'](function(_0x28779b){_0x2f868e[_0xbe60('0x1d')]=_0x28779b;if(_0x4bb3a3[_0xbe60('0x2d')][_0xbe60('0x3e')]){_0x13a98c[_0xbe60('0x3f')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x13a98c);})[_0xbe60('0x23')](function(_0x31d325){_0x2f868e[_0xbe60('0x40')]=_0x31d325;return _0x2f868e;})['then'](respondWithFilteredResult(_0x364057,_0x13a98c))['catch'](handleError(_0x364057,null));};exports[_0xbe60('0x41')]=function(_0x24c50d,_0xf24faa){var _0xef6723={'raw':!![],'where':{'id':_0x24c50d[_0xbe60('0x42')]['id']}},_0x1877d3={};_0x1877d3[_0xbe60('0x2c')]=_[_0xbe60('0x2e')](db[_0xbe60('0x3d')][_0xbe60('0x43')]);_0x1877d3[_0xbe60('0x2d')]=_[_0xbe60('0x2e')](_0x24c50d[_0xbe60('0x2d')]);_0x1877d3[_0xbe60('0x2f')]=_[_0xbe60('0x30')](_0x1877d3['model'],_0x1877d3[_0xbe60('0x2d')]);_0xef6723[_0xbe60('0x31')]=_[_0xbe60('0x30')](_0x1877d3[_0xbe60('0x2c')],qs[_0xbe60('0x32')](_0x24c50d[_0xbe60('0x2d')]['fields']));_0xef6723[_0xbe60('0x31')]=_0xef6723['attributes'][_0xbe60('0x33')]?_0xef6723[_0xbe60('0x31')]:_0x1877d3[_0xbe60('0x2c')];if(_0x24c50d[_0xbe60('0x2d')][_0xbe60('0x3e')]){_0xef6723[_0xbe60('0x3f')]=[{'all':!![]}];}_0xef6723=_[_0xbe60('0x39')]({},_0xef6723,_0x24c50d['options']);return db[_0xbe60('0x3d')]['find'](_0xef6723)['then'](handleEntityNotFound(_0xf24faa,null))[_0xbe60('0x23')](respondWithResult(_0xf24faa,null))[_0xbe60('0x44')](handleError(_0xf24faa,null));};exports[_0xbe60('0x45')]=function(_0x41a113,_0x5ee570){if(_0x41a113[_0xbe60('0x46')]['id']){delete _0x41a113[_0xbe60('0x46')]['id'];}return db['CmCustomField'][_0xbe60('0x47')]({'where':{'id':_0x41a113[_0xbe60('0x42')]['id']}})[_0xbe60('0x23')](handleEntityNotFound(_0x5ee570,null))[_0xbe60('0x23')](saveUpdates(_0x41a113['body'],null))[_0xbe60('0x23')](respondWithResult(_0x5ee570,null))[_0xbe60('0x44')](handleError(_0x5ee570,null));};exports[_0xbe60('0x24')]=function(_0x48d892,_0x5bdfb4){return db['CmCustomField'][_0xbe60('0x47')]({'where':{'id':_0x48d892[_0xbe60('0x42')]['id']}})[_0xbe60('0x23')](handleEntityNotFound(_0x5bdfb4,null))['then'](removeEntity(_0x5bdfb4,null))[_0xbe60('0x44')](handleError(_0x5bdfb4,null));};exports[_0xbe60('0x48')]=function(_0x357c7f,_0x3f8969){var _0x5a66c6;return db[_0xbe60('0x49')]['transaction'](function(_0x484dd9){return db['CmCustomField']['create'](_0x357c7f[_0xbe60('0x46')],{'transaction':_0x484dd9})['then'](function(_0x387682){_0x5a66c6=_0x387682;var _0x19a170={'type':db[_0xbe60('0x4a')]['TEXT'],'transaction':_0x484dd9};switch(_0x357c7f[_0xbe60('0x46')][_0xbe60('0x2a')]){case _0xbe60('0x4b'):_0x19a170[_0xbe60('0x2a')]=db[_0xbe60('0x4a')][_0xbe60('0x4c')];break;case _0xbe60('0x4d'):_0x19a170['type']=db[_0xbe60('0x4a')][_0xbe60('0x4e')];break;case _0xbe60('0x4f'):_0x19a170[_0xbe60('0x2a')]=db['Sequelize'][_0xbe60('0x50')];_0x19a170['defaultValue']=![];break;default:}return db[_0xbe60('0x49')][_0xbe60('0x51')][_0xbe60('0x52')](_0xbe60('0x53'),util[_0xbe60('0x54')](_0xbe60('0x55'),_0x5a66c6['id']),_0x19a170);})['then'](function(){return _0x5a66c6;});})['then'](respondWithResult(_0x3f8969,0xc9))[_0xbe60('0x44')](handleError(_0x3f8969,null));}; \ No newline at end of file +var _0xc2c7=['end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','find','body','params','create','Sequelize','text','TEXT','number','switch','defaultValue','sequelize','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x56e4e7,_0x348779){var _0x2e74cf=function(_0x170567){while(--_0x170567){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x2e74cf(++_0x348779);}(_0xc2c7,0x197));var _0x7c2c=function(_0x44c46c,_0x41e18e){_0x44c46c=_0x44c46c-0x0;var _0x81dc10=_0xc2c7[_0x44c46c];return _0x81dc10;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7c2c('0x0'));var jsonpatch=require(_0x7c2c('0x1'));var rp=require(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var Mustache=require(_0x7c2c('0x5'));var util=require(_0x7c2c('0x6'));var path=require(_0x7c2c('0x7'));var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xb'));var _=require(_0x7c2c('0xc'));var squel=require(_0x7c2c('0xd'));var crypto=require('crypto');var jsforce=require(_0x7c2c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c2c('0xf'));var Papa=require('papaparse');var Redis=require(_0x7c2c('0x10'));var authService=require(_0x7c2c('0x11'));var qs=require(_0x7c2c('0x12'));var as=require(_0x7c2c('0x13'));var hardwareService=require(_0x7c2c('0x14'));var logger=require(_0x7c2c('0x15'))(_0x7c2c('0x16'));var utils=require(_0x7c2c('0x17'));var config=require(_0x7c2c('0x18'));var licenseUtil=require(_0x7c2c('0x19'));var db=require(_0x7c2c('0x1a'))['db'];function respondWithStatusCode(_0x2b45e9,_0x1409bc){_0x1409bc=_0x1409bc||0xcc;return function(_0x743159){if(_0x743159){return _0x2b45e9[_0x7c2c('0x1b')](_0x1409bc);}return _0x2b45e9['status'](_0x1409bc)[_0x7c2c('0x1c')]();};}function respondWithResult(_0x35b0c7,_0x21bf49){_0x21bf49=_0x21bf49||0xc8;return function(_0x165910){if(_0x165910){return _0x35b0c7[_0x7c2c('0x1d')](_0x21bf49)[_0x7c2c('0x1e')](_0x165910);}};}function respondWithFilteredResult(_0x5d2594,_0x5cbe37){return function(_0x310598){if(_0x310598){var _0x49ee63=typeof _0x5cbe37[_0x7c2c('0x1f')]===_0x7c2c('0x20')&&typeof _0x5cbe37[_0x7c2c('0x21')]===_0x7c2c('0x20');var _0x1193af=_0x310598[_0x7c2c('0x22')];var _0x526c9b=_0x49ee63?0x0:_0x5cbe37[_0x7c2c('0x1f')];var _0x3bcdb9=_0x49ee63?_0x310598[_0x7c2c('0x22')]:_0x5cbe37['offset']+_0x5cbe37[_0x7c2c('0x21')];var _0x5e97a7;if(_0x3bcdb9>=_0x1193af){_0x3bcdb9=_0x1193af;_0x5e97a7=0xc8;}else{_0x5e97a7=0xce;}_0x5d2594[_0x7c2c('0x1d')](_0x5e97a7);return _0x5d2594[_0x7c2c('0x23')](_0x7c2c('0x24'),_0x526c9b+'-'+_0x3bcdb9+'/'+_0x1193af)[_0x7c2c('0x1e')](_0x310598);}return null;};}function patchUpdates(_0x436d21){return function(_0x5aa0a2){try{jsonpatch['apply'](_0x5aa0a2,_0x436d21,!![]);}catch(_0x352ba7){return BPromise['reject'](_0x352ba7);}return _0x5aa0a2[_0x7c2c('0x25')]();};}function saveUpdates(_0x5eac56,_0x521531){return function(_0x494707){if(_0x494707){return _0x494707[_0x7c2c('0x26')](_0x5eac56)[_0x7c2c('0x27')](function(_0xd970e6){return _0xd970e6;});}return null;};}function removeEntity(_0xfd9f43,_0x36612e){return function(_0x88450f){if(_0x88450f){return _0x88450f[_0x7c2c('0x28')]()['then'](function(){_0xfd9f43[_0x7c2c('0x1d')](0xcc)[_0x7c2c('0x1c')]();});}};}function handleEntityNotFound(_0x721558,_0x39e866){return function(_0x22c6a8){if(!_0x22c6a8){_0x721558[_0x7c2c('0x1b')](0x194);}return _0x22c6a8;};}function handleError(_0x4606eb,_0x20a3c4){_0x20a3c4=_0x20a3c4||0x1f4;return function(_0x176745){logger['error'](_0x176745['stack']);if(_0x176745['name']){delete _0x176745[_0x7c2c('0x29')];}_0x4606eb[_0x7c2c('0x1d')](_0x20a3c4)[_0x7c2c('0x2a')](_0x176745);};}exports[_0x7c2c('0x2b')]=function(_0x24114f,_0x1a5b43){var _0x23b4e7={},_0x5d43c9={},_0x324cdc={'count':0x0,'rows':[]};var _0x37bcfc=_[_0x7c2c('0x2c')](db[_0x7c2c('0x2d')]['rawAttributes'],function(_0x2e563f){return{'name':_0x2e563f[_0x7c2c('0x2e')],'type':_0x2e563f[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0x5d43c9[_0x7c2c('0x31')]=_[_0x7c2c('0x32')](_[_0x7c2c('0x2c')](_0x37bcfc,_0x7c2c('0x29')),['name']);_0x5d43c9[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x24114f[_0x7c2c('0x33')]);_0x5d43c9['filters']=_[_0x7c2c('0x35')](_0x5d43c9[_0x7c2c('0x31')],_0x5d43c9['query']);_0x23b4e7[_0x7c2c('0x36')]=_[_0x7c2c('0x35')](_0x5d43c9[_0x7c2c('0x31')],qs['fields'](_0x24114f[_0x7c2c('0x33')][_0x7c2c('0x37')]));_0x23b4e7[_0x7c2c('0x36')]=_0x23b4e7['attributes'][_0x7c2c('0x38')]?_0x23b4e7['attributes']:_0x5d43c9[_0x7c2c('0x31')];if(!_0x24114f[_0x7c2c('0x33')][_0x7c2c('0x39')](_0x7c2c('0x3a'))){_0x23b4e7[_0x7c2c('0x21')]=qs[_0x7c2c('0x21')](_0x24114f[_0x7c2c('0x33')][_0x7c2c('0x21')]);_0x23b4e7['offset']=qs[_0x7c2c('0x1f')](_0x24114f['query']['offset']);}_0x23b4e7[_0x7c2c('0x3b')]=qs[_0x7c2c('0x3c')](_0x24114f[_0x7c2c('0x33')][_0x7c2c('0x3c')]);_0x23b4e7[_0x7c2c('0x3d')]=qs[_0x7c2c('0x3e')](_['pick'](_0x24114f[_0x7c2c('0x33')],_0x5d43c9['filters']),_0x37bcfc);if(_0x24114f[_0x7c2c('0x33')]['filter']){_0x23b4e7[_0x7c2c('0x3d')]=_[_0x7c2c('0x3f')](_0x23b4e7[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2c')](_0x37bcfc,function(_0x4cd740){if(_0x4cd740['type']!=='VIRTUAL'){var _0x25969e={};_0x25969e[_0x4cd740['name']]={'$like':'%'+_0x24114f['query'][_0x7c2c('0x40')]+'%'};return _0x25969e;}})});}_0x23b4e7=_['merge']({},_0x23b4e7,_0x24114f[_0x7c2c('0x41')]);var _0x173abf={'where':_0x23b4e7[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2d')][_0x7c2c('0x22')](_0x173abf)[_0x7c2c('0x27')](function(_0x4cc85c){_0x324cdc[_0x7c2c('0x22')]=_0x4cc85c;if(_0x24114f[_0x7c2c('0x33')][_0x7c2c('0x42')]){_0x23b4e7[_0x7c2c('0x43')]=[{'all':!![]}];}return db[_0x7c2c('0x2d')][_0x7c2c('0x44')](_0x23b4e7);})[_0x7c2c('0x27')](function(_0x484398){_0x324cdc[_0x7c2c('0x45')]=_0x484398;return _0x324cdc;})['then'](respondWithFilteredResult(_0x1a5b43,_0x23b4e7))[_0x7c2c('0x46')](handleError(_0x1a5b43,null));};exports['show']=function(_0x1b2edc,_0x1f0b3f){var _0x321e49={'raw':!![],'where':{'id':_0x1b2edc['params']['id']}},_0x1b55c1={};_0x1b55c1['model']=_[_0x7c2c('0x34')](db[_0x7c2c('0x2d')][_0x7c2c('0x47')]);_0x1b55c1[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x1b2edc[_0x7c2c('0x33')]);_0x1b55c1[_0x7c2c('0x3e')]=_[_0x7c2c('0x35')](_0x1b55c1[_0x7c2c('0x31')],_0x1b55c1['query']);_0x321e49[_0x7c2c('0x36')]=_['intersection'](_0x1b55c1['model'],qs[_0x7c2c('0x37')](_0x1b2edc['query'][_0x7c2c('0x37')]));_0x321e49[_0x7c2c('0x36')]=_0x321e49[_0x7c2c('0x36')][_0x7c2c('0x38')]?_0x321e49[_0x7c2c('0x36')]:_0x1b55c1[_0x7c2c('0x31')];if(_0x1b2edc[_0x7c2c('0x33')][_0x7c2c('0x42')]){_0x321e49[_0x7c2c('0x43')]=[{'all':!![]}];}_0x321e49=_['merge']({},_0x321e49,_0x1b2edc[_0x7c2c('0x41')]);return db[_0x7c2c('0x2d')][_0x7c2c('0x48')](_0x321e49)['then'](handleEntityNotFound(_0x1f0b3f,null))[_0x7c2c('0x27')](respondWithResult(_0x1f0b3f,null))[_0x7c2c('0x46')](handleError(_0x1f0b3f,null));};exports['update']=function(_0x2f7d34,_0x32b4d8){if(_0x2f7d34['body']['id']){delete _0x2f7d34[_0x7c2c('0x49')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x2f7d34[_0x7c2c('0x4a')]['id']}})[_0x7c2c('0x27')](handleEntityNotFound(_0x32b4d8,null))[_0x7c2c('0x27')](saveUpdates(_0x2f7d34['body'],null))[_0x7c2c('0x27')](respondWithResult(_0x32b4d8,null))['catch'](handleError(_0x32b4d8,null));};exports[_0x7c2c('0x28')]=function(_0xa4fba7,_0x326de9){return db[_0x7c2c('0x2d')]['find']({'where':{'id':_0xa4fba7[_0x7c2c('0x4a')]['id']}})[_0x7c2c('0x27')](handleEntityNotFound(_0x326de9,null))[_0x7c2c('0x27')](removeEntity(_0x326de9,null))[_0x7c2c('0x46')](handleError(_0x326de9,null));};exports[_0x7c2c('0x4b')]=function(_0x47c491,_0x19bedc){var _0x1b7c18;return db['sequelize']['transaction'](function(_0x84fdb){return db[_0x7c2c('0x2d')][_0x7c2c('0x4b')](_0x47c491[_0x7c2c('0x49')],{'transaction':_0x84fdb})['then'](function(_0x1af735){_0x1b7c18=_0x1af735;var _0x325f72={'type':db[_0x7c2c('0x4c')]['TEXT'],'transaction':_0x84fdb};switch(_0x47c491['body'][_0x7c2c('0x2f')]){case _0x7c2c('0x4d'):_0x325f72[_0x7c2c('0x2f')]=db['Sequelize'][_0x7c2c('0x4e')];break;case _0x7c2c('0x4f'):_0x325f72[_0x7c2c('0x2f')]=db[_0x7c2c('0x4c')]['INTEGER'];break;case _0x7c2c('0x50'):_0x325f72[_0x7c2c('0x2f')]=db['Sequelize']['BOOLEAN'];_0x325f72[_0x7c2c('0x51')]=![];break;default:}return db[_0x7c2c('0x52')]['queryInterface'][_0x7c2c('0x53')](_0x7c2c('0x54'),util[_0x7c2c('0x55')](_0x7c2c('0x56'),_0x1b7c18['id']),_0x325f72);})['then'](function(){return _0x1b7c18;});})[_0x7c2c('0x27')](respondWithResult(_0x19bedc,0xc9))[_0x7c2c('0x46')](handleError(_0x19bedc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 827a38d..8951c7d 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 _0x7611=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0xd7b7c4,_0x3bde33){var _0x3701d4=function(_0x37f7de){while(--_0x37f7de){_0xd7b7c4['push'](_0xd7b7c4['shift']());}};_0x3701d4(++_0x3bde33);}(_0x7611,0x19b));var _0x1761=function(_0x1551a8,_0x3f9847){_0x1551a8=_0x1551a8-0x0;var _0x4f2969=_0x7611[_0x1551a8];return _0x4f2969;};'use strict';var _=require(_0x1761('0x0'));var util=require(_0x1761('0x1'));var logger=require(_0x1761('0x2'))(_0x1761('0x3'));var moment=require(_0x1761('0x4'));var BPromise=require(_0x1761('0x5'));var rp=require(_0x1761('0x6'));var fs=require('fs');var path=require(_0x1761('0x7'));var rimraf=require(_0x1761('0x8'));var config=require(_0x1761('0x9'));var attributes=require(_0x1761('0xa'));module[_0x1761('0xb')]=function(_0xc064bd,_0x173f71){return _0xc064bd[_0x1761('0xc')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e93=['exports','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x49b420,_0x3dba14){var _0x147252=function(_0x138a9d){while(--_0x138a9d){_0x49b420['push'](_0x49b420['shift']());}};_0x147252(++_0x3dba14);}(_0x7e93,0xc5));var _0x37e9=function(_0x1ecc25,_0x217243){_0x1ecc25=_0x1ecc25-0x0;var _0x53f55a=_0x7e93[_0x1ecc25];return _0x53f55a;};'use strict';var _=require(_0x37e9('0x0'));var util=require(_0x37e9('0x1'));var logger=require(_0x37e9('0x2'))(_0x37e9('0x3'));var moment=require(_0x37e9('0x4'));var BPromise=require(_0x37e9('0x5'));var rp=require(_0x37e9('0x6'));var fs=require('fs');var path=require(_0x37e9('0x7'));var rimraf=require(_0x37e9('0x8'));var config=require(_0x37e9('0x9'));var attributes=require(_0x37e9('0xa'));module[_0x37e9('0xb')]=function(_0xf4322a,_0x1d67d9){return _0xf4322a['define'](_0x37e9('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 3a9c679..0074eb8 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 _0xd991=['error','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xd991,0x104));var _0x1d99=function(_0x49ee83,_0x3ff5ce){_0x49ee83=_0x49ee83-0x0;var _0xef654a=_0xd991[_0x49ee83];return _0xef654a;};'use strict';var _=require(_0x1d99('0x0'));var util=require('util');var moment=require(_0x1d99('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d99('0x2'));var fs=require('fs');var Redis=require(_0x1d99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d99('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d99('0x5'));var jayson=require(_0x1d99('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55ccbc,_0x2a3851,_0x14950b){return new BPromise(function(_0x3f1be1,_0xc43337){return client[_0x1d99('0x7')](_0x55ccbc,_0x14950b)['then'](function(_0x594bc4){logger[_0x1d99('0x8')]('CmCustomField,\x20%s,\x20%s',_0x2a3851,_0x1d99('0x9'));logger['debug'](_0x1d99('0xa'),_0x2a3851,'request\x20sent',JSON[_0x1d99('0xb')](_0x594bc4));if(_0x594bc4[_0x1d99('0xc')]){if(_0x594bc4[_0x1d99('0xc')]['code']===0x1f4){logger['error'](_0x1d99('0xd'),_0x2a3851,_0x594bc4[_0x1d99('0xc')][_0x1d99('0xe')]);return _0xc43337(_0x594bc4[_0x1d99('0xc')]['message']);}logger['error'](_0x1d99('0xd'),_0x2a3851,_0x594bc4[_0x1d99('0xc')][_0x1d99('0xe')]);return _0x3f1be1(_0x594bc4[_0x1d99('0xc')][_0x1d99('0xe')]);}else{logger[_0x1d99('0x8')]('CmCustomField,\x20%s,\x20%s',_0x2a3851,_0x1d99('0x9'));_0x3f1be1(_0x594bc4[_0x1d99('0xf')][_0x1d99('0xe')]);}})[_0x1d99('0x10')](function(_0x1d3307){logger[_0x1d99('0xc')](_0x1d99('0xd'),_0x2a3851,_0x1d3307);_0xc43337(_0x1d3307);});});} \ No newline at end of file +var _0x5606=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x50225f,_0x1148fa){var _0x2a5625=function(_0x36fd1e){while(--_0x36fd1e){_0x50225f['push'](_0x50225f['shift']());}};_0x2a5625(++_0x1148fa);}(_0x5606,0x19e));var _0x6560=function(_0x5190e2,_0x4c7901){_0x5190e2=_0x5190e2-0x0;var _0x138d3b=_0x5606[_0x5190e2];return _0x138d3b;};'use strict';var _=require(_0x6560('0x0'));var util=require(_0x6560('0x1'));var moment=require(_0x6560('0x2'));var BPromise=require(_0x6560('0x3'));var rs=require(_0x6560('0x4'));var fs=require('fs');var Redis=require(_0x6560('0x5'));var db=require(_0x6560('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6560('0x7'))(_0x6560('0x8'));var config=require(_0x6560('0x9'));var jayson=require(_0x6560('0xa'));var client=jayson[_0x6560('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x138d6d,_0x47db6d,_0x5a3283){return new BPromise(function(_0x25bb5c,_0x4b57c6){return client[_0x6560('0xc')](_0x138d6d,_0x5a3283)[_0x6560('0xd')](function(_0xc8a15b){logger[_0x6560('0xe')](_0x6560('0xf'),_0x47db6d,_0x6560('0x10'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x47db6d,_0x6560('0x10'),JSON['stringify'](_0xc8a15b));if(_0xc8a15b[_0x6560('0x11')]){if(_0xc8a15b[_0x6560('0x11')][_0x6560('0x12')]===0x1f4){logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0xc8a15b[_0x6560('0x11')][_0x6560('0x13')]);return _0x4b57c6(_0xc8a15b[_0x6560('0x11')]['message']);}logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0xc8a15b[_0x6560('0x11')]['message']);return _0x25bb5c(_0xc8a15b[_0x6560('0x11')][_0x6560('0x13')]);}else{logger['info'](_0x6560('0xf'),_0x47db6d,_0x6560('0x10'));_0x25bb5c(_0xc8a15b[_0x6560('0x14')][_0x6560('0x13')]);}})['catch'](function(_0x42c05c){logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0x42c05c);_0x4b57c6(_0x42c05c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0afd9a2..c243a1c 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 _0x2f3d=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x29a435,_0x21acb0){var _0x2fdc1f=function(_0x5aedaa){while(--_0x5aedaa){_0x29a435['push'](_0x29a435['shift']());}};_0x2fdc1f(++_0x21acb0);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x60ff54,_0x4ed385){_0x60ff54=_0x60ff54-0x0;var _0x4e8e28=_0x2f3d[_0x60ff54];return _0x4e8e28;};'use strict';var multer=require('multer');var util=require(_0xd2f3('0x0'));var path=require(_0xd2f3('0x1'));var timeout=require(_0xd2f3('0x2'));var express=require(_0xd2f3('0x3'));var router=express[_0xd2f3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2f3('0x5'));var config=require(_0xd2f3('0x6'));var controller=require(_0xd2f3('0x7'));router['get']('/',auth[_0xd2f3('0x8')](),controller[_0xd2f3('0x9')]);router[_0xd2f3('0xa')](_0xd2f3('0xb'),auth[_0xd2f3('0x8')](),controller[_0xd2f3('0xc')]);router[_0xd2f3('0xd')]('/',auth['isAuthenticated'](),controller[_0xd2f3('0xe')]);router[_0xd2f3('0xf')]('/:id',auth[_0xd2f3('0x8')](),controller[_0xd2f3('0x10')]);router[_0xd2f3('0x11')](_0xd2f3('0xb'),auth[_0xd2f3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcc05=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x5e5cea,_0x247905){var _0x25e9e6=function(_0x4f197c){while(--_0x4f197c){_0x5e5cea['push'](_0x5e5cea['shift']());}};_0x25e9e6(++_0x247905);}(_0xcc05,0x95));var _0x5cc0=function(_0x2d0c33,_0x2b22cf){_0x2d0c33=_0x2d0c33-0x0;var _0x50f706=_0xcc05[_0x2d0c33];return _0x50f706;};'use strict';var multer=require(_0x5cc0('0x0'));var util=require(_0x5cc0('0x1'));var path=require('path');var timeout=require(_0x5cc0('0x2'));var express=require(_0x5cc0('0x3'));var router=express[_0x5cc0('0x4')]();var fs_extra=require(_0x5cc0('0x5'));var auth=require(_0x5cc0('0x6'));var interaction=require(_0x5cc0('0x7'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x5cc0('0x8')]('/',auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xa')]);router['get'](_0x5cc0('0xb'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xc')]);router[_0x5cc0('0xd')]('/',auth['isAuthenticated'](),controller[_0x5cc0('0xe')]);router[_0x5cc0('0xf')](_0x5cc0('0xb'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0x10')]);router[_0x5cc0('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5cc0('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6bd4ab7..51574b2 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 _0x33af=['UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x4538db,_0x2b3b95){var _0x5c069c=function(_0x284f82){while(--_0x284f82){_0x4538db['push'](_0x4538db['shift']());}};_0x5c069c(++_0x2b3b95);}(_0x33af,0xec));var _0xf33a=function(_0x37a45b,_0x1056ef){_0x37a45b=_0x37a45b-0x0;var _0x35f3bb=_0x33af[_0x37a45b];return _0x35f3bb;};'use strict';var moment=require('moment');var Sequelize=require(_0xf33a('0x0'));module['exports']={'phone':{'type':Sequelize[_0xf33a('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xf33a('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf33a('0x3')],'defaultValue':moment()[_0xf33a('0x4')](_0xf33a('0x5'))},'countbusyretry':{'type':Sequelize[_0xf33a('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf33a('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf33a('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf33a('0x3')]},'priority':{'type':Sequelize[_0xf33a('0x6')](0x2)[_0xf33a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf33a('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf33a('0x6')],'unique':_0xf33a('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf33a('0x8')},'UserId':{'type':Sequelize[_0xf33a('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf33a('0x6')],'unique':_0xf33a('0x8')},'CampaignId':{'type':Sequelize[_0xf33a('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf33a('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf33a('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf33a('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf33a('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf33a('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x4137=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x55830a,_0x91caf2){var _0x3d3c4f=function(_0x3f0597){while(--_0x3f0597){_0x55830a['push'](_0x55830a['shift']());}};_0x3d3c4f(++_0x91caf2);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var moment=require(_0x7413('0x0'));var Sequelize=require(_0x7413('0x1'));module[_0x7413('0x2')]={'phone':{'type':Sequelize[_0x7413('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7413('0x5')],'defaultValue':moment()[_0x7413('0x6')](_0x7413('0x7'))},'countbusyretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7413('0x5')]},'priority':{'type':Sequelize[_0x7413('0x8')](0x2)[_0x7413('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7413('0xa')},'ListId':{'type':Sequelize[_0x7413('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x7413('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x7413('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x7413('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7413('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7413('0x5')],'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 fc54210..92afd69 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 _0x0427=['getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','filters','concat','$and','$or','$gte','$ne','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','filter','options','CmHopper','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','priority','ASC','sequelize','literal','DESC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','dialActive','getPreviewRecall','outbound','transaction','findOne','List','CmHopper,\x20%s,\x20%s,\x20%s'];(function(_0x30417c,_0x391505){var _0x10325e=function(_0x2169e9){while(--_0x2169e9){_0x30417c['push'](_0x30417c['shift']());}};_0x10325e(++_0x391505);}(_0x0427,0x137));var _0x7042=function(_0x15ee3c,_0x5d8699){_0x15ee3c=_0x15ee3c-0x0;var _0x4c962b=_0x0427[_0x15ee3c];return _0x4c962b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7042('0x0'));var jsonpatch=require(_0x7042('0x1'));var rp=require('request-promise');var moment=require(_0x7042('0x2'));var BPromise=require(_0x7042('0x3'));var Mustache=require(_0x7042('0x4'));var util=require(_0x7042('0x5'));var path=require(_0x7042('0x6'));var sox=require(_0x7042('0x7'));var csv=require(_0x7042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7042('0x9'));var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0x8'));var querystring=require(_0x7042('0xf'));var Papa=require(_0x7042('0x10'));var Redis=require('ioredis');var authService=require(_0x7042('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x12'));var utils=require('../../config/utils');var config=require(_0x7042('0x13'));var shared=require(_0x7042('0x13'));var licenseUtil=require(_0x7042('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c06f0,_0x292c4a){_0x292c4a=_0x292c4a||0xcc;return function(_0x3f92eb){if(_0x3f92eb){return _0x5c06f0[_0x7042('0x15')](_0x292c4a);}return _0x5c06f0[_0x7042('0x16')](_0x292c4a)[_0x7042('0x17')]();};}function respondWithResult(_0xee4c2,_0x5def25){_0x5def25=_0x5def25||0xc8;return function(_0x3c8ecd){if(_0x3c8ecd){return _0xee4c2[_0x7042('0x16')](_0x5def25)[_0x7042('0x18')](_0x3c8ecd);}};}function respondWithFilteredResult(_0x5c1ef0,_0x4c68c4){return function(_0xc7e44e){if(_0xc7e44e){var _0x4de51e=typeof _0x4c68c4[_0x7042('0x19')]==='undefined'&&typeof _0x4c68c4['limit']===_0x7042('0x1a');var _0x313e08=_0xc7e44e[_0x7042('0x1b')];var _0x22d9a8=_0x4de51e?0x0:_0x4c68c4[_0x7042('0x19')];var _0x544c02=_0x4de51e?_0xc7e44e[_0x7042('0x1b')]:_0x4c68c4[_0x7042('0x19')]+_0x4c68c4[_0x7042('0x1c')];var _0x39cfbe;if(_0x544c02>=_0x313e08){_0x544c02=_0x313e08;_0x39cfbe=0xc8;}else{_0x39cfbe=0xce;}_0x5c1ef0[_0x7042('0x16')](_0x39cfbe);return _0x5c1ef0['set'](_0x7042('0x1d'),_0x22d9a8+'-'+_0x544c02+'/'+_0x313e08)['json'](_0xc7e44e);}return null;};}function patchUpdates(_0x363f3c){return function(_0x572ebe){try{jsonpatch[_0x7042('0x1e')](_0x572ebe,_0x363f3c,!![]);}catch(_0x472492){return BPromise[_0x7042('0x1f')](_0x472492);}return _0x572ebe[_0x7042('0x20')]();};}function saveUpdates(_0x484c82,_0x5a224b){return function(_0x5d1e14){if(_0x5d1e14){return _0x5d1e14[_0x7042('0x21')](_0x484c82)[_0x7042('0x22')](function(_0x3af8bc){return _0x3af8bc;});}return null;};}function removeEntity(_0x1949fe,_0x48d529){return function(_0x12d618){if(_0x12d618){return _0x12d618[_0x7042('0x23')]()[_0x7042('0x22')](function(){_0x1949fe[_0x7042('0x16')](0xcc)[_0x7042('0x17')]();});}};}function handleEntityNotFound(_0x54445b,_0xc5fed3){return function(_0x41dc11){if(!_0x41dc11){_0x54445b[_0x7042('0x15')](0x194);}return _0x41dc11;};}function handleError(_0x1a05d1,_0x2e4dbe){_0x2e4dbe=_0x2e4dbe||0x1f4;return function(_0x1cb194){logger[_0x7042('0x24')](_0x1cb194[_0x7042('0x25')]);if(_0x1cb194[_0x7042('0x26')]){delete _0x1cb194[_0x7042('0x26')];}_0x1a05d1[_0x7042('0x16')](_0x2e4dbe)[_0x7042('0x27')](_0x1cb194);};}exports[_0x7042('0x28')]=function(_0x1b6a29,_0x101b89){var _0x3203f3={},_0x477972={},_0xa7461d={'count':0x0,'rows':[]};var _0x370307=_['map'](db['CmHopper'][_0x7042('0x29')],function(_0x160af6){return{'name':_0x160af6[_0x7042('0x2a')],'type':_0x160af6[_0x7042('0x2b')][_0x7042('0x2c')]};});_0x477972[_0x7042('0x2d')]=_[_0x7042('0x2e')](_0x370307,'name');_0x477972['query']=_[_0x7042('0x2f')](_0x1b6a29[_0x7042('0x30')]);_0x477972['filters']=_[_0x7042('0x31')](_0x477972[_0x7042('0x2d')],_0x477972['query']);_0x477972[_0x7042('0x32')]=_[_0x7042('0x33')](_0x477972[_0x7042('0x32')],[_0x7042('0x34'),_0x7042('0x35'),'$gt',_0x7042('0x36'),'$lt','$lte',_0x7042('0x37'),'$eq',_0x7042('0x38'),_0x7042('0x39'),'$notBetween',_0x7042('0x3a'),'$notIn',_0x7042('0x3b'),_0x7042('0x3c'),_0x7042('0x3d'),_0x7042('0x3e'),_0x7042('0x3b'),_0x7042('0x3f'),_0x7042('0x40'),_0x7042('0x41'),_0x7042('0x42')]);_0x3203f3['attributes']=_[_0x7042('0x31')](_0x477972[_0x7042('0x2d')],qs[_0x7042('0x43')](_0x1b6a29['query']['fields']));_0x3203f3[_0x7042('0x44')]=_0x3203f3[_0x7042('0x44')]['length']?_0x3203f3[_0x7042('0x44')]:_0x477972[_0x7042('0x2d')];if(!_0x1b6a29[_0x7042('0x30')][_0x7042('0x45')](_0x7042('0x46'))){_0x3203f3[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x1b6a29[_0x7042('0x30')][_0x7042('0x1c')]);_0x3203f3[_0x7042('0x19')]=qs[_0x7042('0x19')](_0x1b6a29[_0x7042('0x30')][_0x7042('0x19')]);}_0x3203f3['order']=qs['sort'](_0x1b6a29[_0x7042('0x30')][_0x7042('0x47')]);_0x3203f3[_0x7042('0x48')]=qs[_0x7042('0x32')](_['pick'](_0x1b6a29[_0x7042('0x30')],_0x477972[_0x7042('0x32')]),_0x370307);if(_0x1b6a29['query']['filter']){_0x3203f3[_0x7042('0x48')]=_[_0x7042('0x49')](_0x3203f3[_0x7042('0x48')],{'$or':_[_0x7042('0x2e')](_0x370307,function(_0x35c7e3){if(_0x35c7e3['type']!=='VIRTUAL'){var _0x2c8d2a={};_0x2c8d2a[_0x35c7e3[_0x7042('0x26')]]={'$like':'%'+_0x1b6a29['query'][_0x7042('0x4a')]+'%'};return _0x2c8d2a;}})});}_0x3203f3=_[_0x7042('0x49')]({},_0x3203f3,_0x1b6a29[_0x7042('0x4b')]);var _0x59568d={'where':_0x3203f3['where']};return db[_0x7042('0x4c')][_0x7042('0x1b')](_0x59568d)[_0x7042('0x22')](function(_0x5316f6){_0xa7461d[_0x7042('0x1b')]=_0x5316f6;if(_0x1b6a29[_0x7042('0x30')]['includeAll']){_0x3203f3[_0x7042('0x4d')]=[{'all':!![]}];}return db[_0x7042('0x4c')][_0x7042('0x4e')](_0x3203f3);})[_0x7042('0x22')](function(_0x25adef){_0xa7461d[_0x7042('0x4f')]=_0x25adef;return _0xa7461d;})[_0x7042('0x22')](respondWithFilteredResult(_0x101b89,_0x3203f3))['catch'](handleError(_0x101b89,null));};exports[_0x7042('0x50')]=function(_0x18a7d5,_0x4cd0a0){var _0x292ebf={'raw':!![],'where':{'id':_0x18a7d5[_0x7042('0x51')]['id']}},_0xd0d738={};_0xd0d738[_0x7042('0x2d')]=_[_0x7042('0x2f')](db[_0x7042('0x4c')]['rawAttributes']);_0xd0d738['query']=_['keys'](_0x18a7d5[_0x7042('0x30')]);_0xd0d738['filters']=_['intersection'](_0xd0d738[_0x7042('0x2d')],_0xd0d738['query']);_0x292ebf[_0x7042('0x44')]=_[_0x7042('0x31')](_0xd0d738[_0x7042('0x2d')],qs[_0x7042('0x43')](_0x18a7d5[_0x7042('0x30')][_0x7042('0x43')]));_0x292ebf[_0x7042('0x44')]=_0x292ebf[_0x7042('0x44')][_0x7042('0x52')]?_0x292ebf[_0x7042('0x44')]:_0xd0d738[_0x7042('0x2d')];if(_0x18a7d5[_0x7042('0x30')][_0x7042('0x53')]){_0x292ebf['include']=[{'all':!![]}];}_0x292ebf=_[_0x7042('0x49')]({},_0x292ebf,_0x18a7d5[_0x7042('0x4b')]);return db[_0x7042('0x4c')][_0x7042('0x54')](_0x292ebf)[_0x7042('0x22')](handleEntityNotFound(_0x4cd0a0,null))[_0x7042('0x22')](respondWithResult(_0x4cd0a0,null))[_0x7042('0x55')](handleError(_0x4cd0a0,null));};exports[_0x7042('0x56')]=function(_0x3b258d,_0x936eeb){return db[_0x7042('0x4c')][_0x7042('0x56')](_0x3b258d[_0x7042('0x57')],{})['then'](respondWithResult(_0x936eeb,0xc9))[_0x7042('0x55')](handleError(_0x936eeb,null));};exports['update']=function(_0x2cb2da,_0x1a2b3a){if(_0x2cb2da[_0x7042('0x57')]['id']){delete _0x2cb2da['body']['id'];}return db['CmHopper'][_0x7042('0x54')]({'where':{'id':_0x2cb2da[_0x7042('0x51')]['id']}})[_0x7042('0x22')](handleEntityNotFound(_0x1a2b3a,null))[_0x7042('0x22')](saveUpdates(_0x2cb2da['body'],null))['then'](respondWithResult(_0x1a2b3a,null))[_0x7042('0x55')](handleError(_0x1a2b3a,null));};exports[_0x7042('0x58')]=function(_0x4a2b70,_0x382b74){return db[_0x7042('0x4c')]['describe']()[_0x7042('0x22')](respondWithResult(_0x382b74,null))[_0x7042('0x55')](handleError(_0x382b74,null));};exports['destroy']=function(_0x449de2,_0x266f7d){var _0x3a437b;return db['CmHopper'][_0x7042('0x54')]({'where':{'id':_0x449de2[_0x7042('0x51')]['id']}})[_0x7042('0x22')](handleEntityNotFound(_0x266f7d,null))[_0x7042('0x22')](function(_0x31fb4f){if(_0x31fb4f){return _0x31fb4f[_0x7042('0x23')]()[_0x7042('0x22')](function(_0x34995b){return _0x34995b;});}})[_0x7042('0x22')](function(_0x3a1e37){_0x3a437b=_0x3a1e37;if(_0x3a1e37){if(_0x3a1e37[_0x7042('0x59')]||_0x3a1e37[_0x7042('0x5a')]){return db[_0x3a1e37['VoiceQueueId']?_0x7042('0x5b'):_0x7042('0x5c')][_0x7042('0x54')]({'where':{'id':_0x3a1e37[_0x7042('0x59')]?_0x3a1e37[_0x7042('0x59')]:_0x3a1e37[_0x7042('0x5a')]},'attributes':['id','name'],'raw':!![]});}}})[_0x7042('0x22')](function(_0x17f5c9){var _0x205e82={};if(_0x17f5c9){_['merge'](_0x205e82,_[_0x7042('0x5d')](_0x3a437b[_0x7042('0x5e')],[_0x7042('0x5f'),_0x7042('0x60'),'id']));_0x205e82[_0x7042('0x61')]=0x15;_0x205e82[_0x7042('0x62')]=_0x7042('0x63');_0x205e82[_0x7042('0x64')]=_0x17f5c9['name'];_0x205e82[_0x7042('0x65')]=_0x449de2[_0x7042('0x66')][_0x7042('0x26')];_0x205e82[_0x7042('0x67')]=_0x449de2[_0x7042('0x66')]['id'];_0x205e82[_0x7042('0x63')]=!![];_0x205e82[_0x7042('0x68')]=moment()['format'](_0x7042('0x69'));_0x205e82['calleridnum']=_0x3a437b[_0x7042('0x6a')];_0x205e82[_0x7042('0x6b')]=_0x3a437b[_0x7042('0x59')]?_0x7042('0x6c'):'ivr';return db['CmContact'][_0x7042('0x54')]({'where':{'id':_0x205e82[_0x7042('0x6d')]},'attributes':['firstName',_0x7042('0x6e')]})[_0x7042('0x22')](function(_0x12df51){if(!_[_0x7042('0x6f')](_0x266f7d)&&!_[_0x7042('0x6f')](_0x12df51[_0x7042('0x70')])){_0x205e82[_0x7042('0x71')]=_0x12df51[_0x7042('0x70')];if(!_[_0x7042('0x6f')](_0x12df51['lastName'])){_0x205e82[_0x7042('0x71')]+='\x20'+_0x12df51[_0x7042('0x6e')];}}})[_0x7042('0x72')](function(){return db[_0x7042('0x73')]['create'](_0x205e82);});}})[_0x7042('0x22')](function(){return _0x266f7d['status'](0xcc)[_0x7042('0x17')]();})[_0x7042('0x55')](handleError(_0x266f7d,null));};exports['getPreview']=function(_0x5559dc,_0x3ca818,_0x5ba91e){var _0xc51212=[];return db[_0x7042('0x74')][_0x7042('0x58')]()['then'](function(_0x5ee669){_0xc51212=_['keys'](_0x5ee669);return _0x5559dc[_0x7042('0x66')][_0x7042('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7042('0x76')},'attributes':['id',_0x7042('0x77'),_0x7042('0x78')],'raw':!![]});})['then'](function(_0x245201){if(_0x245201&&_0x245201[_0x7042('0x52')]){return db['sequelize']['transaction'](function(_0x190ce7){var _0x5bbef4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7042('0x69'))},'VoiceQueueId':{'$in':_[_0x7042('0x2e')](_0x245201,'id')},'$or':[{'UserId':null},{'UserId':_0x5559dc[_0x7042('0x66')]['id']}]};var _0x88a357={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x245201)[_0x7042('0x4a')]([_0x7042('0x78'),0x0])[_0x7042('0x2e')]('id')[_0x7042('0x79')]()},'$or':[{'UserId':null},{'UserId':_0x5559dc['user']['id']}]};var _0x5ed59a={'$or':[_0x5bbef4,_0x88a357]};var _0x2e2747=[];if(_0x5559dc[_0x7042('0x57')][_0x7042('0x7a')]&&_0x5559dc['body']['direction']===_0x7042('0x7b')){if(!_['isEmpty'](_0x5559dc[_0x7042('0x57')][_0x7042('0x7c')])){_0x5ed59a['id']={'$in':_0x5559dc[_0x7042('0x57')]['hopperIds']};}_0x2e2747=[[_0x7042('0x7d'),_0x7042('0x7e')],['scheduledAt',_0x245201[0x0][_0x7042('0x77')]===_0x7042('0x7e')?'DESC':'ASC'],db[_0x7042('0x7f')][_0x7042('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7042('0x81')]];}else{if(!_[_0x7042('0x82')](_0x5559dc[_0x7042('0x57')][_0x7042('0x7c')])){_0x5ed59a['id']={'$notIn':_0x5559dc[_0x7042('0x57')][_0x7042('0x7c')]};}_0x2e2747=[[_0x7042('0x7d'),_0x7042('0x81')],[_0x7042('0x83'),_0x245201[0x0][_0x7042('0x77')]],db['sequelize'][_0x7042('0x80')](_0x7042('0x84')),['id',_0x7042('0x7e')]];}return db[_0x7042('0x4c')]['findOne']({'attributes':['id',_0x7042('0x85'),_0x7042('0x86')],'where':_0x5ed59a,'order':_0x2e2747,'transaction':_0x190ce7,'lock':_0x190ce7[_0x7042('0x87')][_0x7042('0x88')],'include':[{'model':db['CmContact'],'as':_0x7042('0x89'),'attributes':_0xc51212,'include':[{'model':db[_0x7042('0x8a')],'as':_0x7042('0x8b'),'attributes':['id',_0x7042('0x26')]}]},{'model':db[_0x7042('0x8c')],'as':'List','attributes':['id','name']},{'model':db[_0x7042('0x5b')],'as':'Queue','attributes':['id',_0x7042('0x26'),_0x7042('0x8d')]}]})[_0x7042('0x22')](function(_0x206afd){if(_0x206afd){return _0x206afd[_0x7042('0x21')]({'UserId':_0x5559dc[_0x7042('0x66')]['id']},{'transaction':_0x190ce7});}});});}})['then'](handleEntityNotFound(_0x3ca818,null))[_0x7042('0x22')](respondWithResult(_0x3ca818,null))['catch'](handleError(_0x3ca818,null));};exports[_0x7042('0x8e')]=function(_0x377f0a,_0x58878d,_0x20a996){var _0x400004=[];return db[_0x7042('0x74')][_0x7042('0x58')]()['then'](function(_0x2b3fb1){_0x400004=_[_0x7042('0x2f')](_0x2b3fb1);return _0x377f0a[_0x7042('0x66')][_0x7042('0x75')]({'where':{'type':_0x7042('0x8f'),'dialActive':!![],'dialMethod':_0x7042('0x76')},'attributes':['id',_0x7042('0x77'),_0x7042('0x78')],'raw':!![]});})[_0x7042('0x22')](function(_0x497380){if(_0x497380&&_0x497380[_0x7042('0x52')]){return db[_0x7042('0x7f')][_0x7042('0x90')](function(_0x5bb1c3){var _0x41fafb={'active':![],'recallme':!![],'id':_0x377f0a['body']['hopperId']};return db[_0x7042('0x4c')][_0x7042('0x91')]({'attributes':['id',_0x7042('0x85'),'recallme'],'where':_0x41fafb,'transaction':_0x5bb1c3,'lock':_0x5bb1c3[_0x7042('0x87')][_0x7042('0x88')],'include':[{'model':db[_0x7042('0x74')],'as':'Contact','attributes':_0x400004,'include':[{'model':db[_0x7042('0x8a')],'as':_0x7042('0x8b'),'attributes':['id',_0x7042('0x26')]}]},{'model':db[_0x7042('0x8c')],'as':_0x7042('0x92'),'attributes':['id',_0x7042('0x26')]},{'model':db[_0x7042('0x5b')],'as':'Queue','attributes':['id','name',_0x7042('0x8d')]}]})['then'](function(_0x106935){if(_0x106935){return _0x106935[_0x7042('0x21')]({'UserId':_0x377f0a['user']['id']},{'transaction':_0x5bb1c3});}});});}})['then'](handleEntityNotFound(_0x58878d,null))[_0x7042('0x22')](respondWithResult(_0x58878d,null))[_0x7042('0x55')](handleError(_0x58878d,null));};exports['getOpenContacts']=function(_0x1d9a4b,_0x236ba7,_0x39c5d5){return _0x1d9a4b[_0x7042('0x66')][_0x7042('0x75')]({'where':{'type':_0x7042('0x8f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x7042('0x22')](function(_0x3df8ac){if(_0x3df8ac&&_0x3df8ac['length']){return db['CmHopper'][_0x7042('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7042('0x69'))},'VoiceQueueId':{'$in':_[_0x7042('0x2e')](_0x3df8ac,'id')},'$or':[{'UserId':null},{'UserId':_0x1d9a4b[_0x7042('0x66')]['id']}]}});}return 0x0;})['then'](function(_0x5e8535){if(!_['isNil'](_0x5e8535)&&_['isNumber'](_0x5e8535)){return _0x236ba7[_0x7042('0x16')](0xc8)[_0x7042('0x18')]({'contacts':_0x5e8535});}else{logger[_0x7042('0x24')](_0x7042('0x93'),_0x7042('0x94'),0x194,_0x7042('0x95'));_0x236ba7[_0x7042('0x15')](0x194);}})['catch'](handleError(_0x236ba7,null));};exports[_0x7042('0x96')]=function(_0x2b5a3d,_0x59ebb0,_0x2b0e89){var _0x27e8ae=shared[_0x7042('0x97')];var _0xfc46ac=[];_['map'](_0x27e8ae,function(_0x4b87fc){_0xfc46ac['push']({'id':_0x4b87fc[_0x7042('0x26')],'name':_0x4b87fc['name'],'utcOffset':_0x4b87fc[_0x7042('0x98')]});});return _0x59ebb0[_0x7042('0x16')](0xc8)[_0x7042('0x18')]({'tz':_0xfc46ac});};exports['getTimezone']=function(_0x94ea96,_0x171823,_0x1e052d){var _0x17c1ab=shared['timezones'];var _0x805cd4={};if(!_[_0x7042('0x6f')](_0x17c1ab[_0x94ea96['body']['id']]))_0x805cd4=_0x17c1ab[_0x94ea96['body']['id']];return _0x171823[_0x7042('0x16')](0xc8)[_0x7042('0x18')](_0x805cd4);}; \ No newline at end of file +var _0x1fa7=['dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','getVoiceQueues','hopperId','UPDATE','VoiceQueue','getOpenContacts','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','CmHopper','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','VoiceQueueId','dataValues','createdAt','updatedAt','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','outbound','preview'];(function(_0x5673a0,_0x217887){var _0x142f1e=function(_0x132745){while(--_0x132745){_0x5673a0['push'](_0x5673a0['shift']());}};_0x142f1e(++_0x217887);}(_0x1fa7,0x151));var _0x71fa=function(_0x54b35a,_0x44ad63){_0x54b35a=_0x54b35a-0x0;var _0x444ec3=_0x1fa7[_0x54b35a];return _0x444ec3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71fa('0x0'));var zipdir=require(_0x71fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71fa('0x2'));var BPromise=require(_0x71fa('0x3'));var Mustache=require('mustache');var util=require(_0x71fa('0x4'));var path=require('path');var sox=require(_0x71fa('0x5'));var csv=require(_0x71fa('0x6'));var ejs=require(_0x71fa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71fa('0x8'));var squel=require(_0x71fa('0x9'));var crypto=require(_0x71fa('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x71fa('0x6'));var querystring=require(_0x71fa('0xb'));var Papa=require(_0x71fa('0xc'));var Redis=require(_0x71fa('0xd'));var authService=require(_0x71fa('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x71fa('0xf'));var hardwareService=require(_0x71fa('0x10'));var logger=require(_0x71fa('0x11'))(_0x71fa('0x12'));var utils=require(_0x71fa('0x13'));var config=require('../../config/environment');var shared=require(_0x71fa('0x14'));var licenseUtil=require(_0x71fa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2966d5,_0x23751d){_0x23751d=_0x23751d||0xcc;return function(_0x5efa7d){if(_0x5efa7d){return _0x2966d5[_0x71fa('0x16')](_0x23751d);}return _0x2966d5[_0x71fa('0x17')](_0x23751d)[_0x71fa('0x18')]();};}function respondWithResult(_0x157024,_0xc1fc2a){_0xc1fc2a=_0xc1fc2a||0xc8;return function(_0x3f5d30){if(_0x3f5d30){return _0x157024[_0x71fa('0x17')](_0xc1fc2a)[_0x71fa('0x19')](_0x3f5d30);}};}function respondWithFilteredResult(_0x50e6c8,_0x25b825){return function(_0x29ba6a){if(_0x29ba6a){var _0x1e79a8=typeof _0x25b825[_0x71fa('0x1a')]==='undefined'&&typeof _0x25b825['limit']===_0x71fa('0x1b');var _0x14b56b=_0x29ba6a[_0x71fa('0x1c')];var _0x2e8d57=_0x1e79a8?0x0:_0x25b825[_0x71fa('0x1a')];var _0x3ddb6b=_0x1e79a8?_0x29ba6a['count']:_0x25b825[_0x71fa('0x1a')]+_0x25b825['limit'];var _0x3eb2f2;if(_0x3ddb6b>=_0x14b56b){_0x3ddb6b=_0x14b56b;_0x3eb2f2=0xc8;}else{_0x3eb2f2=0xce;}_0x50e6c8[_0x71fa('0x17')](_0x3eb2f2);return _0x50e6c8[_0x71fa('0x1d')](_0x71fa('0x1e'),_0x2e8d57+'-'+_0x3ddb6b+'/'+_0x14b56b)[_0x71fa('0x19')](_0x29ba6a);}return null;};}function patchUpdates(_0x54d52d){return function(_0x12f3cd){try{jsonpatch[_0x71fa('0x1f')](_0x12f3cd,_0x54d52d,!![]);}catch(_0x470efd){return BPromise[_0x71fa('0x20')](_0x470efd);}return _0x12f3cd['save']();};}function saveUpdates(_0x472440,_0x51fd35){return function(_0x49429e){if(_0x49429e){return _0x49429e[_0x71fa('0x21')](_0x472440)[_0x71fa('0x22')](function(_0x408e13){return _0x408e13;});}return null;};}function removeEntity(_0x16e0c3,_0x358591){return function(_0xf662ae){if(_0xf662ae){return _0xf662ae[_0x71fa('0x23')]()[_0x71fa('0x22')](function(){_0x16e0c3[_0x71fa('0x17')](0xcc)[_0x71fa('0x18')]();});}};}function handleEntityNotFound(_0x4d3818,_0x16fdfe){return function(_0x4ad521){if(!_0x4ad521){_0x4d3818[_0x71fa('0x16')](0x194);}return _0x4ad521;};}function handleError(_0x12457c,_0x3d5c60){_0x3d5c60=_0x3d5c60||0x1f4;return function(_0x24274c){logger['error'](_0x24274c['stack']);if(_0x24274c[_0x71fa('0x24')]){delete _0x24274c[_0x71fa('0x24')];}_0x12457c[_0x71fa('0x17')](_0x3d5c60)[_0x71fa('0x25')](_0x24274c);};}exports[_0x71fa('0x26')]=function(_0x3ba2b2,_0xcb78){var _0x2fa76d={},_0x2773a0={},_0x12605b={'count':0x0,'rows':[]};var _0x14d552=_[_0x71fa('0x27')](db['CmHopper'][_0x71fa('0x28')],function(_0x56c812){return{'name':_0x56c812['fieldName'],'type':_0x56c812[_0x71fa('0x29')][_0x71fa('0x2a')]};});_0x2773a0[_0x71fa('0x2b')]=_[_0x71fa('0x27')](_0x14d552,_0x71fa('0x24'));_0x2773a0[_0x71fa('0x2c')]=_[_0x71fa('0x2d')](_0x3ba2b2[_0x71fa('0x2c')]);_0x2773a0[_0x71fa('0x2e')]=_[_0x71fa('0x2f')](_0x2773a0[_0x71fa('0x2b')],_0x2773a0['query']);_0x2773a0[_0x71fa('0x2e')]=_[_0x71fa('0x30')](_0x2773a0[_0x71fa('0x2e')],['$and','$or','$gt',_0x71fa('0x31'),_0x71fa('0x32'),_0x71fa('0x33'),_0x71fa('0x34'),_0x71fa('0x35'),_0x71fa('0x36'),_0x71fa('0x37'),'$notBetween',_0x71fa('0x38'),_0x71fa('0x39'),_0x71fa('0x3a'),_0x71fa('0x3b'),_0x71fa('0x3c'),'$notILike',_0x71fa('0x3a'),_0x71fa('0x3d'),_0x71fa('0x3e'),_0x71fa('0x3f'),_0x71fa('0x40')]);_0x2fa76d[_0x71fa('0x41')]=_[_0x71fa('0x2f')](_0x2773a0[_0x71fa('0x2b')],qs[_0x71fa('0x42')](_0x3ba2b2[_0x71fa('0x2c')]['fields']));_0x2fa76d[_0x71fa('0x41')]=_0x2fa76d[_0x71fa('0x41')][_0x71fa('0x43')]?_0x2fa76d[_0x71fa('0x41')]:_0x2773a0[_0x71fa('0x2b')];if(!_0x3ba2b2[_0x71fa('0x2c')][_0x71fa('0x44')](_0x71fa('0x45'))){_0x2fa76d[_0x71fa('0x46')]=qs[_0x71fa('0x46')](_0x3ba2b2[_0x71fa('0x2c')][_0x71fa('0x46')]);_0x2fa76d[_0x71fa('0x1a')]=qs[_0x71fa('0x1a')](_0x3ba2b2[_0x71fa('0x2c')]['offset']);}_0x2fa76d['order']=qs['sort'](_0x3ba2b2[_0x71fa('0x2c')][_0x71fa('0x47')]);_0x2fa76d['where']=qs[_0x71fa('0x2e')](_[_0x71fa('0x48')](_0x3ba2b2['query'],_0x2773a0[_0x71fa('0x2e')]),_0x14d552);if(_0x3ba2b2[_0x71fa('0x2c')][_0x71fa('0x49')]){_0x2fa76d[_0x71fa('0x4a')]=_[_0x71fa('0x4b')](_0x2fa76d['where'],{'$or':_[_0x71fa('0x27')](_0x14d552,function(_0x35d6b6){if(_0x35d6b6[_0x71fa('0x29')]!==_0x71fa('0x4c')){var _0x1bebab={};_0x1bebab[_0x35d6b6['name']]={'$like':'%'+_0x3ba2b2['query']['filter']+'%'};return _0x1bebab;}})});}_0x2fa76d=_['merge']({},_0x2fa76d,_0x3ba2b2['options']);var _0x2f5a37={'where':_0x2fa76d[_0x71fa('0x4a')]};return db[_0x71fa('0x4d')]['count'](_0x2f5a37)[_0x71fa('0x22')](function(_0x31b3de){_0x12605b[_0x71fa('0x1c')]=_0x31b3de;if(_0x3ba2b2[_0x71fa('0x2c')][_0x71fa('0x4e')]){_0x2fa76d[_0x71fa('0x4f')]=[{'all':!![]}];}return db[_0x71fa('0x4d')][_0x71fa('0x50')](_0x2fa76d);})[_0x71fa('0x22')](function(_0x393832){_0x12605b[_0x71fa('0x51')]=_0x393832;return _0x12605b;})[_0x71fa('0x22')](respondWithFilteredResult(_0xcb78,_0x2fa76d))[_0x71fa('0x52')](handleError(_0xcb78,null));};exports[_0x71fa('0x53')]=function(_0x5b9bd8,_0xd1936c){var _0x2fb251={'raw':!![],'where':{'id':_0x5b9bd8[_0x71fa('0x54')]['id']}},_0x50090c={};_0x50090c[_0x71fa('0x2b')]=_[_0x71fa('0x2d')](db['CmHopper'][_0x71fa('0x28')]);_0x50090c[_0x71fa('0x2c')]=_[_0x71fa('0x2d')](_0x5b9bd8[_0x71fa('0x2c')]);_0x50090c[_0x71fa('0x2e')]=_[_0x71fa('0x2f')](_0x50090c[_0x71fa('0x2b')],_0x50090c[_0x71fa('0x2c')]);_0x2fb251[_0x71fa('0x41')]=_['intersection'](_0x50090c[_0x71fa('0x2b')],qs[_0x71fa('0x42')](_0x5b9bd8[_0x71fa('0x2c')]['fields']));_0x2fb251['attributes']=_0x2fb251[_0x71fa('0x41')]['length']?_0x2fb251[_0x71fa('0x41')]:_0x50090c['model'];if(_0x5b9bd8['query'][_0x71fa('0x4e')]){_0x2fb251['include']=[{'all':!![]}];}_0x2fb251=_['merge']({},_0x2fb251,_0x5b9bd8['options']);return db['CmHopper'][_0x71fa('0x55')](_0x2fb251)[_0x71fa('0x22')](handleEntityNotFound(_0xd1936c,null))[_0x71fa('0x22')](respondWithResult(_0xd1936c,null))['catch'](handleError(_0xd1936c,null));};exports[_0x71fa('0x56')]=function(_0x5637b7,_0xd0c7a0){return db[_0x71fa('0x4d')][_0x71fa('0x56')](_0x5637b7['body'],{})['then'](respondWithResult(_0xd0c7a0,0xc9))['catch'](handleError(_0xd0c7a0,null));};exports[_0x71fa('0x21')]=function(_0x52d5a0,_0x1a67b6){if(_0x52d5a0[_0x71fa('0x57')]['id']){delete _0x52d5a0['body']['id'];}return db['CmHopper'][_0x71fa('0x55')]({'where':{'id':_0x52d5a0['params']['id']}})[_0x71fa('0x22')](handleEntityNotFound(_0x1a67b6,null))[_0x71fa('0x22')](saveUpdates(_0x52d5a0[_0x71fa('0x57')],null))[_0x71fa('0x22')](respondWithResult(_0x1a67b6,null))[_0x71fa('0x52')](handleError(_0x1a67b6,null));};exports[_0x71fa('0x58')]=function(_0x4b00b7,_0x50980a){return db[_0x71fa('0x4d')][_0x71fa('0x58')]()[_0x71fa('0x22')](respondWithResult(_0x50980a,null))[_0x71fa('0x52')](handleError(_0x50980a,null));};exports[_0x71fa('0x23')]=function(_0x342d9d,_0x583c0d){var _0x1249f3;return db['CmHopper']['find']({'where':{'id':_0x342d9d[_0x71fa('0x54')]['id']}})['then'](handleEntityNotFound(_0x583c0d,null))[_0x71fa('0x22')](function(_0x1d8d23){if(_0x1d8d23){return _0x1d8d23[_0x71fa('0x23')]()[_0x71fa('0x22')](function(_0x378708){return _0x378708;});}})[_0x71fa('0x22')](function(_0xf462d1){_0x1249f3=_0xf462d1;if(_0xf462d1){if(_0xf462d1[_0x71fa('0x59')]||_0xf462d1['CampaignId']){return db[_0xf462d1[_0x71fa('0x59')]?'VoiceQueue':'Campaign'][_0x71fa('0x55')]({'where':{'id':_0xf462d1[_0x71fa('0x59')]?_0xf462d1[_0x71fa('0x59')]:_0xf462d1['CampaignId']},'attributes':['id',_0x71fa('0x24')],'raw':!![]});}}})[_0x71fa('0x22')](function(_0x47df85){var _0x171e24={};if(_0x47df85){_[_0x71fa('0x4b')](_0x171e24,_['omit'](_0x1249f3[_0x71fa('0x5a')],[_0x71fa('0x5b'),_0x71fa('0x5c'),'id']));_0x171e24['state']=0x15;_0x171e24['statedesc']=_0x71fa('0x5d');_0x171e24['campaign']=_0x47df85['name'];_0x171e24[_0x71fa('0x5e')]=_0x342d9d[_0x71fa('0x5f')][_0x71fa('0x24')];_0x171e24[_0x71fa('0x60')]=_0x342d9d[_0x71fa('0x5f')]['id'];_0x171e24[_0x71fa('0x5d')]=!![];_0x171e24[_0x71fa('0x61')]=moment()['format'](_0x71fa('0x62'));_0x171e24['calleridnum']=_0x1249f3['phone'];_0x171e24[_0x71fa('0x63')]=_0x1249f3[_0x71fa('0x59')]?'queue':_0x71fa('0x64');return db[_0x71fa('0x65')][_0x71fa('0x55')]({'where':{'id':_0x171e24[_0x71fa('0x66')]},'attributes':[_0x71fa('0x67'),_0x71fa('0x68')]})[_0x71fa('0x22')](function(_0x170f47){if(!_[_0x71fa('0x69')](_0x583c0d)&&!_[_0x71fa('0x69')](_0x170f47[_0x71fa('0x67')])){_0x171e24[_0x71fa('0x6a')]=_0x170f47['firstName'];if(!_[_0x71fa('0x69')](_0x170f47[_0x71fa('0x68')])){_0x171e24[_0x71fa('0x6a')]+='\x20'+_0x170f47[_0x71fa('0x68')];}}})[_0x71fa('0x6b')](function(){return db['CmHopperFinal'][_0x71fa('0x56')](_0x171e24);});}})[_0x71fa('0x22')](function(){return _0x583c0d[_0x71fa('0x17')](0xcc)[_0x71fa('0x18')]();})[_0x71fa('0x52')](handleError(_0x583c0d,null));};exports['getPreview']=function(_0x3dfb54,_0x1f14e4,_0x29e416){var _0x2675a4=[];return db[_0x71fa('0x65')][_0x71fa('0x58')]()[_0x71fa('0x22')](function(_0x1aa465){_0x2675a4=_[_0x71fa('0x2d')](_0x1aa465);return _0x3dfb54[_0x71fa('0x5f')]['getVoiceQueues']({'where':{'type':_0x71fa('0x6c'),'dialActive':!![],'dialMethod':_0x71fa('0x6d')},'attributes':['id',_0x71fa('0x6e'),_0x71fa('0x6f')],'raw':!![]});})[_0x71fa('0x22')](function(_0x2e247f){if(_0x2e247f&&_0x2e247f['length']){return db[_0x71fa('0x70')][_0x71fa('0x71')](function(_0x495291){var _0x17a6bb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x71fa('0x72')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2e247f,'id')},'$or':[{'UserId':null},{'UserId':_0x3dfb54[_0x71fa('0x5f')]['id']}]};var _0x1d99c5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2e247f)['filter']([_0x71fa('0x6f'),0x0])['map']('id')[_0x71fa('0x73')]()},'$or':[{'UserId':null},{'UserId':_0x3dfb54[_0x71fa('0x5f')]['id']}]};var _0x3d7cc7={'$or':[_0x17a6bb,_0x1d99c5]};var _0x13118d=[];if(_0x3dfb54['body']['direction']&&_0x3dfb54[_0x71fa('0x57')][_0x71fa('0x74')]===_0x71fa('0x75')){if(!_['isEmpty'](_0x3dfb54[_0x71fa('0x57')]['hopperIds'])){_0x3d7cc7['id']={'$in':_0x3dfb54[_0x71fa('0x57')][_0x71fa('0x76')]};}_0x13118d=[[_0x71fa('0x77'),_0x71fa('0x78')],[_0x71fa('0x79'),_0x2e247f[0x0]['dialOrderByScheduledAt']===_0x71fa('0x78')?_0x71fa('0x7a'):_0x71fa('0x78')],db[_0x71fa('0x70')][_0x71fa('0x7b')](_0x71fa('0x7c')),['id',_0x71fa('0x7a')]];}else{if(!_[_0x71fa('0x7d')](_0x3dfb54[_0x71fa('0x57')][_0x71fa('0x76')])){_0x3d7cc7['id']={'$notIn':_0x3dfb54['body'][_0x71fa('0x76')]};}_0x13118d=[[_0x71fa('0x77'),'DESC'],['scheduledAt',_0x2e247f[0x0][_0x71fa('0x6e')]],db[_0x71fa('0x70')][_0x71fa('0x7b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x71fa('0x78')]];}return db[_0x71fa('0x4d')][_0x71fa('0x7e')]({'attributes':['id',_0x71fa('0x7f'),_0x71fa('0x80')],'where':_0x3d7cc7,'order':_0x13118d,'transaction':_0x495291,'lock':_0x495291[_0x71fa('0x81')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x71fa('0x82'),'attributes':_0x2675a4,'include':[{'model':db[_0x71fa('0x83')],'as':_0x71fa('0x84'),'attributes':['id',_0x71fa('0x24')]}]},{'model':db[_0x71fa('0x85')],'as':_0x71fa('0x86'),'attributes':['id',_0x71fa('0x24')]},{'model':db['VoiceQueue'],'as':_0x71fa('0x87'),'attributes':['id',_0x71fa('0x24'),_0x71fa('0x88')]}]})[_0x71fa('0x22')](function(_0x2476d8){if(_0x2476d8){return _0x2476d8[_0x71fa('0x21')]({'UserId':_0x3dfb54[_0x71fa('0x5f')]['id']},{'transaction':_0x495291});}});});}})[_0x71fa('0x22')](handleEntityNotFound(_0x1f14e4,null))[_0x71fa('0x22')](respondWithResult(_0x1f14e4,null))[_0x71fa('0x52')](handleError(_0x1f14e4,null));};exports[_0x71fa('0x89')]=function(_0xb655bc,_0x3d554d,_0x102dfa){var _0x17fde4=[];return db[_0x71fa('0x65')][_0x71fa('0x58')]()[_0x71fa('0x22')](function(_0x4d5448){_0x17fde4=_[_0x71fa('0x2d')](_0x4d5448);return _0xb655bc[_0x71fa('0x5f')][_0x71fa('0x8a')]({'where':{'type':_0x71fa('0x6c'),'dialActive':!![],'dialMethod':_0x71fa('0x6d')},'attributes':['id',_0x71fa('0x6e'),_0x71fa('0x6f')],'raw':!![]});})[_0x71fa('0x22')](function(_0x3e6116){if(_0x3e6116&&_0x3e6116[_0x71fa('0x43')]){return db[_0x71fa('0x70')][_0x71fa('0x71')](function(_0x3fbd34){var _0x4020fb={'active':![],'recallme':!![],'id':_0xb655bc['body'][_0x71fa('0x8b')]};return db['CmHopper'][_0x71fa('0x7e')]({'attributes':['id',_0x71fa('0x7f'),'recallme'],'where':_0x4020fb,'transaction':_0x3fbd34,'lock':_0x3fbd34[_0x71fa('0x81')][_0x71fa('0x8c')],'include':[{'model':db[_0x71fa('0x65')],'as':_0x71fa('0x82'),'attributes':_0x17fde4,'include':[{'model':db['CmCompany'],'as':_0x71fa('0x84'),'attributes':['id',_0x71fa('0x24')]}]},{'model':db[_0x71fa('0x85')],'as':_0x71fa('0x86'),'attributes':['id',_0x71fa('0x24')]},{'model':db[_0x71fa('0x8d')],'as':_0x71fa('0x87'),'attributes':['id',_0x71fa('0x24'),'dialActive']}]})[_0x71fa('0x22')](function(_0x373191){if(_0x373191){return _0x373191[_0x71fa('0x21')]({'UserId':_0xb655bc[_0x71fa('0x5f')]['id']},{'transaction':_0x3fbd34});}});});}})[_0x71fa('0x22')](handleEntityNotFound(_0x3d554d,null))[_0x71fa('0x22')](respondWithResult(_0x3d554d,null))[_0x71fa('0x52')](handleError(_0x3d554d,null));};exports[_0x71fa('0x8e')]=function(_0xea510e,_0x371bdb,_0x38b5c3){return _0xea510e[_0x71fa('0x5f')][_0x71fa('0x8a')]({'where':{'type':_0x71fa('0x6c'),'dialActive':!![],'dialMethod':_0x71fa('0x6d')},'attributes':['id'],'raw':!![]})[_0x71fa('0x22')](function(_0xa80d15){if(_0xa80d15&&_0xa80d15[_0x71fa('0x43')]){return db['CmHopper'][_0x71fa('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x71fa('0x72')](_0x71fa('0x62'))},'VoiceQueueId':{'$in':_['map'](_0xa80d15,'id')},'$or':[{'UserId':null},{'UserId':_0xea510e[_0x71fa('0x5f')]['id']}]}});}return 0x0;})[_0x71fa('0x22')](function(_0x16584a){if(!_[_0x71fa('0x69')](_0x16584a)&&_['isNumber'](_0x16584a)){return _0x371bdb[_0x71fa('0x17')](0xc8)[_0x71fa('0x19')]({'contacts':_0x16584a});}else{logger[_0x71fa('0x8f')](_0x71fa('0x90'),_0x71fa('0x8e'),0x194,_0x71fa('0x91'));_0x371bdb[_0x71fa('0x16')](0x194);}})['catch'](handleError(_0x371bdb,null));};exports['getTimezones']=function(_0x43392e,_0x5f1424,_0xce9db8){var _0x291316=shared['timezones'];var _0x5ede76=[];_[_0x71fa('0x27')](_0x291316,function(_0x4f7e46){_0x5ede76[_0x71fa('0x92')]({'id':_0x4f7e46[_0x71fa('0x24')],'name':_0x4f7e46[_0x71fa('0x24')],'utcOffset':_0x4f7e46[_0x71fa('0x93')]});});return _0x5f1424[_0x71fa('0x17')](0xc8)[_0x71fa('0x19')]({'tz':_0x5ede76});};exports[_0x71fa('0x94')]=function(_0x12f797,_0x30fcd2,_0x1d9810){var _0x424a52=shared['timezones'];var _0x572421={};if(!_[_0x71fa('0x69')](_0x424a52[_0x12f797[_0x71fa('0x57')]['id']]))_0x572421=_0x424a52[_0x12f797['body']['id']];return _0x30fcd2[_0x71fa('0x17')](0xc8)[_0x71fa('0x19')](_0x572421);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1c830c2..de7df16 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 _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9536,0x179));var _0x6953=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x9536[_0x29e35f];return _0x266b74;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x333f55,_0x4b800e){var _0xea3b68=function(_0x3f8db2){while(--_0x3f8db2){_0x333f55['push'](_0x333f55['shift']());}};_0xea3b68(++_0x4b800e);}(_0x7096,0x10c));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 043f2f3..d024f8a 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 _0xa6b0=['length','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','keys','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','\x20MINUTE','CmList','NOW()\x20+\x20INTERVAL\x20','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw','attributes','include','model','map','debug','where','ShowCmHopper','CreateCmHopper','create','update','body','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','CmContact','describe','findAll','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause'];(function(_0x451e06,_0x579c2e){var _0x487b7b=function(_0x490e9a){while(--_0x490e9a){_0x451e06['push'](_0x451e06['shift']());}};_0x487b7b(++_0x579c2e);}(_0xa6b0,0x12d));var _0x0a6b=function(_0x5bf77b,_0xcb7e21){_0x5bf77b=_0x5bf77b-0x0;var _0x2557f1=_0xa6b0[_0x5bf77b];return _0x2557f1;};'use strict';var _=require(_0x0a6b('0x0'));var util=require('util');var moment=require(_0x0a6b('0x1'));var BPromise=require(_0x0a6b('0x2'));var rs=require(_0x0a6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a6b('0x4'))['db'];var utils=require(_0x0a6b('0x5'));var logger=require(_0x0a6b('0x6'))('rpc');var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));const {validateExpressRequest}=require(_0x0a6b('0x9'));var client=jayson[_0x0a6b('0xa')][_0x0a6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e0fe4,_0x20b43d,_0xcb2315){return new BPromise(function(_0x43739d,_0x7093f4){return client[_0x0a6b('0xc')](_0x1e0fe4,_0xcb2315)[_0x0a6b('0xd')](function(_0x5b6138){logger[_0x0a6b('0xe')](_0x0a6b('0xf'),_0x20b43d,_0x0a6b('0x10'));logger['debug'](_0x0a6b('0x11'),_0x20b43d,'request\x20sent',JSON[_0x0a6b('0x12')](_0x5b6138));if(_0x5b6138['error']){if(_0x5b6138[_0x0a6b('0x13')][_0x0a6b('0x14')]===0x1f4){logger[_0x0a6b('0x13')]('CmHopper,\x20%s,\x20%s',_0x20b43d,_0x5b6138[_0x0a6b('0x13')][_0x0a6b('0x15')]);return _0x7093f4(_0x5b6138[_0x0a6b('0x13')][_0x0a6b('0x15')]);}logger[_0x0a6b('0x13')](_0x0a6b('0xf'),_0x20b43d,_0x5b6138[_0x0a6b('0x13')][_0x0a6b('0x15')]);return _0x43739d(_0x5b6138[_0x0a6b('0x13')][_0x0a6b('0x15')]);}else{logger[_0x0a6b('0xe')](_0x0a6b('0xf'),_0x20b43d,'request\x20sent');_0x43739d(_0x5b6138[_0x0a6b('0x16')][_0x0a6b('0x15')]);}})[_0x0a6b('0x17')](function(_0x406324){logger[_0x0a6b('0x13')](_0x0a6b('0xf'),_0x20b43d,_0x406324);_0x7093f4(_0x406324);});});}exports[_0x0a6b('0x18')]=function(_0x3aea10){var _0x1abcca=this;return new Promise(function(_0x50f5e5,_0x2a890a){return db[_0x0a6b('0x19')]['findAll']({'raw':_0x3aea10[_0x0a6b('0x1a')]?_0x3aea10[_0x0a6b('0x1a')][_0x0a6b('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aea10[_0x0a6b('0x1a')]?_0x3aea10['options']['where']||null:null,'attributes':_0x3aea10[_0x0a6b('0x1a')]?_0x3aea10['options'][_0x0a6b('0x1c')]||null:null,'limit':_0x3aea10[_0x0a6b('0x1a')]?_0x3aea10[_0x0a6b('0x1a')]['limit']||null:null,'include':_0x3aea10[_0x0a6b('0x1a')]?_0x3aea10[_0x0a6b('0x1a')][_0x0a6b('0x1d')]?_['map'](_0x3aea10['options'][_0x0a6b('0x1d')],function(_0x510dfc){return{'model':db[_0x510dfc[_0x0a6b('0x1e')]],'as':_0x510dfc['as'],'attributes':_0x510dfc[_0x0a6b('0x1c')],'include':_0x510dfc['include']?_[_0x0a6b('0x1f')](_0x510dfc[_0x0a6b('0x1d')],function(_0x346a49){return{'model':db[_0x346a49['model']],'as':_0x346a49['as'],'attributes':_0x346a49['attributes'],'include':_0x346a49[_0x0a6b('0x1d')]?_[_0x0a6b('0x1f')](_0x346a49[_0x0a6b('0x1d')],function(_0x4307a1){return{'model':db[_0x4307a1[_0x0a6b('0x1e')]],'as':_0x4307a1['as'],'attributes':_0x4307a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a6b('0xd')](function(_0x1d8db5){logger[_0x0a6b('0xe')](_0x0a6b('0x18'),_0x3aea10);logger[_0x0a6b('0x20')](_0x0a6b('0x18'),_0x3aea10,JSON['stringify'](_0x1d8db5));_0x50f5e5(_0x1d8db5);})[_0x0a6b('0x17')](function(_0x2a51eb){logger[_0x0a6b('0x13')](_0x0a6b('0x18'),_0x2a51eb['message'],_0x3aea10);_0x2a890a(_0x1abcca[_0x0a6b('0x13')](0x1f4,_0x2a51eb[_0x0a6b('0x15')]));});});};exports['ShowCmHopper']=function(_0x491058){var _0x32e540=this;return new Promise(function(_0x5ca161,_0xcabbba){return db[_0x0a6b('0x19')]['find']({'raw':_0x491058[_0x0a6b('0x1a')]?_0x491058[_0x0a6b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x491058[_0x0a6b('0x1a')]?_0x491058[_0x0a6b('0x1a')][_0x0a6b('0x21')]||null:null,'attributes':_0x491058[_0x0a6b('0x1a')]?_0x491058[_0x0a6b('0x1a')][_0x0a6b('0x1c')]||null:null,'include':_0x491058[_0x0a6b('0x1a')]?_0x491058[_0x0a6b('0x1a')][_0x0a6b('0x1d')]?_[_0x0a6b('0x1f')](_0x491058[_0x0a6b('0x1a')][_0x0a6b('0x1d')],function(_0x4ff27a){return{'model':db[_0x4ff27a[_0x0a6b('0x1e')]],'as':_0x4ff27a['as'],'attributes':_0x4ff27a[_0x0a6b('0x1c')],'include':_0x4ff27a[_0x0a6b('0x1d')]?_[_0x0a6b('0x1f')](_0x4ff27a[_0x0a6b('0x1d')],function(_0x5e1765){return{'model':db[_0x5e1765[_0x0a6b('0x1e')]],'as':_0x5e1765['as'],'attributes':_0x5e1765[_0x0a6b('0x1c')],'include':_0x5e1765[_0x0a6b('0x1d')]?_['map'](_0x5e1765[_0x0a6b('0x1d')],function(_0x23e76){return{'model':db[_0x23e76[_0x0a6b('0x1e')]],'as':_0x23e76['as'],'attributes':_0x23e76[_0x0a6b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0xd')](function(_0x5b7365){logger[_0x0a6b('0xe')](_0x0a6b('0x22'),_0x491058);logger['debug']('ShowCmHopper',_0x491058,JSON[_0x0a6b('0x12')](_0x5b7365));_0x5ca161(_0x5b7365);})[_0x0a6b('0x17')](function(_0x46f2c2){logger[_0x0a6b('0x13')]('ShowCmHopper',_0x46f2c2[_0x0a6b('0x15')],_0x491058);_0xcabbba(_0x32e540['error'](0x1f4,_0x46f2c2[_0x0a6b('0x15')]));});});};exports[_0x0a6b('0x23')]=function(_0x2f5aa8){var _0x1c7f63=this;return new Promise(function(_0x5c32e3,_0x17f7bf){return db[_0x0a6b('0x19')][_0x0a6b('0x24')](_0x2f5aa8['body'],{'raw':_0x2f5aa8[_0x0a6b('0x1a')]?_0x2f5aa8[_0x0a6b('0x1a')][_0x0a6b('0x1b')]===undefined?!![]:![]:!![]})[_0x0a6b('0xd')](function(_0x4b6d4b){logger['info'](_0x0a6b('0x23'),_0x2f5aa8);logger[_0x0a6b('0x20')](_0x0a6b('0x23'),_0x2f5aa8,JSON['stringify'](_0x4b6d4b));_0x5c32e3(_0x4b6d4b);})[_0x0a6b('0x17')](function(_0x5259f3){logger['error']('CreateCmHopper',_0x5259f3[_0x0a6b('0x15')],_0x2f5aa8);_0x17f7bf(_0x1c7f63[_0x0a6b('0x13')](0x1f4,_0x5259f3[_0x0a6b('0x15')]));});});};exports['UpdateCmHopper']=function(_0x236999){var _0x15bdfd=this;return new Promise(function(_0x5d0a4a,_0x3964e6){return db[_0x0a6b('0x19')][_0x0a6b('0x25')](_0x236999[_0x0a6b('0x26')],{'raw':_0x236999['options']?_0x236999['options'][_0x0a6b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x236999[_0x0a6b('0x1a')]?_0x236999['options'][_0x0a6b('0x21')]||null:null,'attributes':_0x236999[_0x0a6b('0x1a')]?_0x236999['options'][_0x0a6b('0x1c')]||null:null,'limit':_0x236999['options']?_0x236999[_0x0a6b('0x1a')][_0x0a6b('0x27')]||null:null})['then'](function(_0x3a7185){logger[_0x0a6b('0xe')](_0x0a6b('0x28'),_0x236999);logger[_0x0a6b('0xe')](_0x0a6b('0x29'),JSON[_0x0a6b('0x12')](_0x236999[_0x0a6b('0x1a')][_0x0a6b('0x21')]),_0x236999['body']['active']);logger[_0x0a6b('0x20')](_0x0a6b('0x28'),_0x236999,JSON[_0x0a6b('0x12')](_0x3a7185));_0x5d0a4a(_0x3a7185);})[_0x0a6b('0x17')](function(_0x16761e){logger['error']('UpdateCmHopper',_0x16761e[_0x0a6b('0x15')],_0x236999);_0x3964e6(_0x15bdfd['error'](0x1f4,_0x16761e['message']));});});};exports[_0x0a6b('0x2a')]=function(_0x31aed3){var _0x1cb6a7=this;return new Promise(function(_0x34a2cc,_0x24acb1){return db[_0x0a6b('0x19')][_0x0a6b('0x2b')]({'where':_0x31aed3['options']?_0x31aed3['options'][_0x0a6b('0x21')]||null:null})[_0x0a6b('0xd')](function(_0x18e895){logger[_0x0a6b('0xe')](_0x0a6b('0x2a'),_0x31aed3);logger[_0x0a6b('0x20')](_0x0a6b('0x2a'),_0x31aed3,JSON['stringify'](_0x18e895));_0x34a2cc(_0x18e895);})[_0x0a6b('0x17')](function(_0x30f7ed){logger[_0x0a6b('0x13')](_0x0a6b('0x2a'),_0x30f7ed[_0x0a6b('0x15')],_0x31aed3);_0x24acb1(_0x1cb6a7[_0x0a6b('0x13')](0x1f4,_0x30f7ed[_0x0a6b('0x15')]));});});};exports['GetContactDialer']=function(_0x331f9e){var _0x26b411=this;return new Promise(function(_0x5ef5c9,_0x20983f){return db[_0x0a6b('0x2c')][_0x0a6b('0x2d')]()[_0x0a6b('0xd')](function(_0x168193){return db['sequelize']['transaction'](function(_0x19a356){return db[_0x0a6b('0x19')][_0x0a6b('0x2e')]({'where':_0x331f9e[_0x0a6b('0x1a')]?_0x331f9e[_0x0a6b('0x1a')]['where']||null:null,'attributes':_0x331f9e[_0x0a6b('0x1a')]?_0x331f9e['options'][_0x0a6b('0x1c')]||null:null,'limit':_0x331f9e['options']?_0x331f9e[_0x0a6b('0x1a')][_0x0a6b('0x27')]||null:null,'order':_0x331f9e[_0x0a6b('0x1a')]?_0x331f9e[_0x0a6b('0x1a')][_0x0a6b('0x2f')]||null:null,'transaction':_0x19a356,'lock':_0x19a356[_0x0a6b('0x30')][_0x0a6b('0x31')],'include':[{'model':db[_0x0a6b('0x2c')],'as':_0x0a6b('0x32'),'attributes':_['keys'](_0x168193)},{'model':db[_0x0a6b('0x33')],'as':_0x0a6b('0x34'),'attributes':['id',_0x0a6b('0x35'),_0x0a6b('0x36')]}]})['then'](function(_0x3a5095){var _0x258dfc=[];var _0x22f0a0=[];for(var _0x2fb9d7=0x0;_0x2fb9d7<_0x3a5095[_0x0a6b('0x37')];_0x2fb9d7+=0x1){var _0x1d6f72=_0x3a5095[_0x2fb9d7]['UserId'];if(_0x1d6f72===null){_0x258dfc[_0x0a6b('0x38')](_0x3a5095[_0x2fb9d7]['update'](_0x331f9e[_0x0a6b('0x26')],{'transaction':_0x19a356}));}else if(!_0x22f0a0[_0x0a6b('0x39')](_0x1d6f72)){_0x22f0a0['push'](_0x1d6f72);_0x258dfc[_0x0a6b('0x38')](_0x3a5095[_0x2fb9d7]['update'](_0x331f9e['body'],{'transaction':_0x19a356}));}}return BPromise[_0x0a6b('0x3a')](_0x258dfc);});})[_0x0a6b('0xd')](function(_0x200c33){logger[_0x0a6b('0xe')](_0x0a6b('0x3b'),_0x331f9e);if(_0x200c33[_0x0a6b('0x37')]>0x0){logger[_0x0a6b('0xe')](_0x0a6b('0x3c'),_0x200c33[0x0][_0x0a6b('0x3d')]['id'],_0x200c33[0x0][_0x0a6b('0x3d')][_0x0a6b('0x3e')],_0x200c33[0x0][_0x0a6b('0x3d')][_0x0a6b('0x3f')]);}logger[_0x0a6b('0x20')](_0x0a6b('0x3b'),_0x331f9e,JSON['stringify'](_0x200c33));_0x5ef5c9(_0x200c33);})[_0x0a6b('0x17')](function(_0x139a09){logger[_0x0a6b('0x13')](_0x0a6b('0x3b'),_0x139a09[_0x0a6b('0x15')],_0x331f9e);_0x20983f(_0x26b411[_0x0a6b('0x13')](0x1f4,_0x139a09[_0x0a6b('0x15')]));});});});};exports[_0x0a6b('0x40')]=function(_0xf69473){var _0x78fece=this;return new Promise(function(_0x275645,_0xc8c97c){return db[_0x0a6b('0x41')][_0x0a6b('0x42')](function(_0x215a28){return db['CmHopperFinal'][_0x0a6b('0x24')](_0xf69473[_0x0a6b('0x26')],{'raw':_0xf69473[_0x0a6b('0x1a')]?_0xf69473['options'][_0x0a6b('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x215a28})[_0x0a6b('0xd')](function(){logger[_0x0a6b('0xe')](_0x0a6b('0x43'),JSON['stringify'](_0xf69473[_0x0a6b('0x1a')][_0x0a6b('0x21')]),_0xf69473[_0x0a6b('0x1a')]['where'][_0x0a6b('0x3f')]);return db[_0x0a6b('0x19')]['destroy']({'where':_0xf69473[_0x0a6b('0x1a')]?_0xf69473[_0x0a6b('0x1a')][_0x0a6b('0x21')]||null:null,'transaction':_0x215a28});});})[_0x0a6b('0xd')](function(_0x51bcf1){logger[_0x0a6b('0xe')](_0x0a6b('0x40'),_0xf69473);logger[_0x0a6b('0x20')]('MoveContactManagedDialer',_0xf69473,JSON[_0x0a6b('0x12')](_0x51bcf1));_0x275645(_0x51bcf1);})[_0x0a6b('0x17')](function(_0x380021){logger[_0x0a6b('0x13')]('MoveContactManagedDialer',_0x380021[_0x0a6b('0x15')],_0xf69473);_0xc8c97c(_0x78fece['error'](0x1f4,_0x380021[_0x0a6b('0x15')]));});});};exports[_0x0a6b('0x44')]=function(_0x22b0ac){var _0x44f3c4=this;return new Promise(function(_0x3c720d,_0x31a165){return db[_0x0a6b('0x19')][_0x0a6b('0x2e')]({'raw':_0x22b0ac['options']?_0x22b0ac['options'][_0x0a6b('0x1b')]===undefined?!![]:![]:!![],'where':_0x22b0ac[_0x0a6b('0x1a')]?_0x22b0ac['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x0a6b('0x45'),db[_0x0a6b('0x41')]['fn']('IF',db['sequelize'][_0x0a6b('0x46')]('`scheduledat`\x20>=\x20'+util[_0x0a6b('0x47')](_0x0a6b('0x48'),moment()[_0x0a6b('0x47')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x0a6b('0x49')]]})[_0x0a6b('0xd')](function(_0x5bdeba){logger[_0x0a6b('0xe')](_0x0a6b('0x44'),_0x22b0ac);logger['debug'](_0x0a6b('0x44'),_0x22b0ac,JSON[_0x0a6b('0x12')](_0x5bdeba));_0x3c720d(_0x5bdeba);})['catch'](function(_0x30ed86){logger[_0x0a6b('0x13')](_0x0a6b('0x44'),_0x30ed86[_0x0a6b('0x15')],_0x22b0ac);_0x31a165(_0x44f3c4['error'](0x1f4,_0x30ed86[_0x0a6b('0x15')]));});});};exports[_0x0a6b('0x4a')]=function(_0x489b06){var _0x8ef626=this;return new Promise(function(_0x474888,_0x2d1ce1){return db[_0x0a6b('0x2c')][_0x0a6b('0x2d')]()[_0x0a6b('0xd')](function(_0x503535){return db[_0x0a6b('0x41')][_0x0a6b('0x42')](function(_0x4d7fb3){return db[_0x0a6b('0x19')]['findAll']({'where':_0x489b06[_0x0a6b('0x1a')]?_0x489b06[_0x0a6b('0x1a')]['where']||null:null,'attributes':_0x489b06[_0x0a6b('0x1a')]?_0x489b06[_0x0a6b('0x1a')][_0x0a6b('0x1c')]||null:null,'limit':0x1,'order':_0x489b06['options']?_0x489b06[_0x0a6b('0x1a')][_0x0a6b('0x2f')]||null:null,'group':db['CmHopper'][_0x0a6b('0x4b')],'transaction':_0x4d7fb3,'lock':_0x4d7fb3[_0x0a6b('0x30')][_0x0a6b('0x31')],'include':_0x489b06[_0x0a6b('0x1a')]?_0x489b06['options'][_0x0a6b('0x1d')]?_[_0x0a6b('0x1f')](_0x489b06[_0x0a6b('0x1a')][_0x0a6b('0x1d')],function(_0x4c36a1){return{'model':db[_0x4c36a1[_0x0a6b('0x1e')]],'as':_0x4c36a1['as'],'attributes':_0x4c36a1[_0x0a6b('0x1c')],'include':_0x4c36a1[_0x0a6b('0x1d')]?_[_0x0a6b('0x1f')](_0x4c36a1[_0x0a6b('0x1d')],function(_0x468701){return{'model':db[_0x468701[_0x0a6b('0x1e')]],'as':_0x468701['as'],'attributes':_0x468701[_0x0a6b('0x1c')],'include':_0x468701[_0x0a6b('0x1d')]?_['map'](_0x468701['include'],function(_0x4b3672){return{'model':db[_0x4b3672[_0x0a6b('0x1e')]],'as':_0x4b3672['as'],'attributes':_0x4b3672['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15f07b){var _0x4e6ed5=[];for(var _0x3fbfc4=0x0;_0x3fbfc4<_0x15f07b['length'];_0x3fbfc4+=0x1){_0x4e6ed5['push'](_0x15f07b[_0x3fbfc4][_0x0a6b('0x25')](_0x489b06['body'],{'transaction':_0x4d7fb3}));}return BPromise[_0x0a6b('0x3a')](_0x4e6ed5);});})[_0x0a6b('0xd')](function(_0x5b603b){logger[_0x0a6b('0xe')](_0x0a6b('0x4a'),_0x489b06);logger[_0x0a6b('0x20')](_0x0a6b('0x4a'),_0x489b06,JSON[_0x0a6b('0x12')](_0x5b603b));_0x474888(_0x5b603b);})['catch'](function(_0x45aef3){logger['error'](_0x0a6b('0x4a'),_0x45aef3[_0x0a6b('0x15')],_0x489b06);_0x2d1ce1(_0x8ef626[_0x0a6b('0x13')](0x1f4,_0x45aef3[_0x0a6b('0x15')]));});});});};exports[_0x0a6b('0x4c')]=function(_0x493155){var _0x28d3fb=this;return new Promise(function(_0x33d007,_0x498aa2){db['CmContact'][_0x0a6b('0x2d')]()[_0x0a6b('0xd')](function(_0x1515f6){return db[_0x0a6b('0x19')][_0x0a6b('0x2e')]({'raw':_0x493155[_0x0a6b('0x1a')]?_0x493155[_0x0a6b('0x1a')][_0x0a6b('0x1b')]===undefined?!![]:![]:!![],'where':_0x493155[_0x0a6b('0x1a')]?_0x493155['options']['where']||null:null,'attributes':_0x493155[_0x0a6b('0x1a')]?_0x493155['options'][_0x0a6b('0x1c')]||null:null,'limit':_0x493155[_0x0a6b('0x1a')]?_0x493155[_0x0a6b('0x1a')][_0x0a6b('0x27')]||null:null,'include':_0x493155[_0x0a6b('0x1a')]?_0x493155[_0x0a6b('0x1a')]['include']?_[_0x0a6b('0x1f')](_0x493155['options'][_0x0a6b('0x1d')],function(_0x1ac53e){return{'model':db[_0x1ac53e[_0x0a6b('0x1e')]],'as':_0x1ac53e['as'],'attributes':_0x1ac53e['as']===_0x0a6b('0x32')?_[_0x0a6b('0x4d')](_0x1515f6):_0x1ac53e['attributes'],'include':_0x1ac53e[_0x0a6b('0x1d')]?_['map'](_0x1ac53e['include'],function(_0x1a5dc9){return{'model':db[_0x1a5dc9[_0x0a6b('0x1e')]],'as':_0x1a5dc9['as'],'attributes':_0x1a5dc9[_0x0a6b('0x1c')],'include':_0x1a5dc9['include']?_[_0x0a6b('0x1f')](_0x1a5dc9[_0x0a6b('0x1d')],function(_0x45db2a){return{'model':db[_0x45db2a[_0x0a6b('0x1e')]],'as':_0x45db2a['as'],'attributes':_0x45db2a[_0x0a6b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0xd')](function(_0x2f50e1){logger[_0x0a6b('0xe')](_0x0a6b('0x18'),_0x493155);logger['debug'](_0x0a6b('0x18'),_0x493155,JSON[_0x0a6b('0x12')](_0x2f50e1));_0x33d007(_0x2f50e1);})['catch'](function(_0x27dbf8){logger[_0x0a6b('0x13')](_0x0a6b('0x18'),_0x27dbf8[_0x0a6b('0x15')],_0x493155);_0x498aa2(_0x28d3fb[_0x0a6b('0x13')](0x1f4,_0x27dbf8[_0x0a6b('0x15')]));});});});};exports['GetContactByPhone']=function(_0x463200){var _0x22b3f9=this;return new Promise(function(_0x43cbcc,_0x486612){return db[_0x0a6b('0x2c')][_0x0a6b('0x4e')]({'raw':!![],'where':{'phone':_0x463200[_0x0a6b('0x1a')][_0x0a6b('0x21')][_0x0a6b('0x4f')]},'attributes':['id',_0x0a6b('0x50')],'order':[['id','DESC']]})[_0x0a6b('0xd')](function(_0x326ef4){logger[_0x0a6b('0xe')](_0x0a6b('0x51'),_0x463200);logger[_0x0a6b('0x20')](_0x0a6b('0x51'),_0x463200,JSON['stringify'](_0x326ef4));_0x43cbcc(_0x326ef4);})[_0x0a6b('0x17')](function(_0x365daa){logger[_0x0a6b('0x13')](_0x0a6b('0x51'),_0x365daa['message'],_0x463200);_0x486612(_0x22b3f9['error'](0x1f4,_0x365daa[_0x0a6b('0x15')]));});});};exports['ResetActiveCalls']=function(_0x1955dd){var _0x2def41=this;return new Promise(function(_0x110116,_0x4d2131){return db[_0x0a6b('0x41')][_0x0a6b('0x42')](function(_0x1e2036){return db['CmHopper']['update']({'active':![]},{'where':{},'transaction':_0x1e2036})[_0x0a6b('0xd')](function(_0x3f5d39){logger[_0x0a6b('0xe')](_0x0a6b('0x52'),_0x1955dd);logger[_0x0a6b('0x20')](_0x0a6b('0x52'),_0x1955dd,JSON[_0x0a6b('0x12')](_0x3f5d39));_0x110116(_0x3f5d39);})[_0x0a6b('0x17')](function(_0x3621a4){logger[_0x0a6b('0x13')]('ResetActiveCalls',_0x3621a4[_0x0a6b('0x15')],_0x1955dd);_0x4d2131(_0x2def41[_0x0a6b('0x13')](0x1f4,_0x3621a4[_0x0a6b('0x15')]));});});});};exports[_0x0a6b('0x53')]=function(_0x55cfb6){var _0x44f5b7=this;var _0x4c7b0e=_0x55cfb6[_0x0a6b('0x26')][_0x0a6b('0x21')][_0x0a6b('0x54')];var _0x5d3a55=_0x55cfb6[_0x0a6b('0x26')][_0x0a6b('0x21')][_0x0a6b('0x55')];return new Promise(function(_0x2cd1ef,_0x376380){return db[_0x0a6b('0x19')]['findAll']({'where':{'voiceQueueId':_0x4c7b0e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x0a6b('0x41')][_0x0a6b('0x46')]('NOW()\x20+\x20INTERVAL\x20'+_0x5d3a55+_0x0a6b('0x56'))}},'include':[{'model':db[_0x0a6b('0x2c')],'as':_0x0a6b('0x32')},{'model':db[_0x0a6b('0x33')],'as':_0x0a6b('0x34'),'attributes':['id',_0x0a6b('0x35'),_0x0a6b('0x36')]},{'model':db[_0x0a6b('0x57')],'as':'List'}]})[_0x0a6b('0xd')](function(_0x85609b){return db[_0x0a6b('0x41')][_0x0a6b('0x42')](function(_0x1a6f6a){return db[_0x0a6b('0x19')][_0x0a6b('0x25')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x4c7b0e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x0a6b('0x41')][_0x0a6b('0x46')](_0x0a6b('0x58')+_0x5d3a55+'\x20MINUTE')}},'transaction':_0x1a6f6a})[_0x0a6b('0xd')](function(_0x29a9db){_0x2cd1ef(_0x85609b);})['catch'](function(_0x29fff8){logger[_0x0a6b('0x13')](_0x0a6b('0x53'),_0x29fff8[_0x0a6b('0x15')],_0x55cfb6);_0x376380(validateExpressRequest);});});})[_0x0a6b('0x17')](function(_0x5e689b){logger['error'](_0x0a6b('0x53'),_0x5e689b['message'],_0x55cfb6);_0x376380(_0x44f5b7[_0x0a6b('0x13')](0x1f4,_0x5e689b['message']));});});}; \ No newline at end of file +var _0x59aa=['CmContact','describe','transaction','order','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','LOCK','UPDATE','GetContactRecallMe','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','interval','\x20MINUTE','name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowCmHopper','CmHopper','find','then','create','CreateCmHopper','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy'];(function(_0xdfcf97,_0x3459dc){var _0x541b99=function(_0x3b2db1){while(--_0x3b2db1){_0xdfcf97['push'](_0xdfcf97['shift']());}};_0x541b99(++_0x3459dc);}(_0x59aa,0x1dd));var _0xa59a=function(_0x3344c0,_0x18a644){_0x3344c0=_0x3344c0-0x0;var _0x409cb7=_0x59aa[_0x3344c0];return _0x409cb7;};'use strict';var _=require(_0xa59a('0x0'));var util=require(_0xa59a('0x1'));var moment=require(_0xa59a('0x2'));var BPromise=require(_0xa59a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa59a('0x4'));var db=require(_0xa59a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa59a('0x6'))(_0xa59a('0x7'));var config=require(_0xa59a('0x8'));var jayson=require(_0xa59a('0x9'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0xa59a('0xa')][_0xa59a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b2bca,_0x4746fa,_0x1520ac){return new BPromise(function(_0x28d322,_0x3542bf){return client['request'](_0x2b2bca,_0x1520ac)['then'](function(_0x266235){logger['info'](_0xa59a('0xc'),_0x4746fa,'request\x20sent');logger['debug'](_0xa59a('0xd'),_0x4746fa,_0xa59a('0xe'),JSON[_0xa59a('0xf')](_0x266235));if(_0x266235[_0xa59a('0x10')]){if(_0x266235[_0xa59a('0x10')]['code']===0x1f4){logger[_0xa59a('0x10')]('CmHopper,\x20%s,\x20%s',_0x4746fa,_0x266235[_0xa59a('0x10')][_0xa59a('0x11')]);return _0x3542bf(_0x266235[_0xa59a('0x10')][_0xa59a('0x11')]);}logger[_0xa59a('0x10')](_0xa59a('0xc'),_0x4746fa,_0x266235['error'][_0xa59a('0x11')]);return _0x28d322(_0x266235[_0xa59a('0x10')][_0xa59a('0x11')]);}else{logger[_0xa59a('0x12')]('CmHopper,\x20%s,\x20%s',_0x4746fa,_0xa59a('0xe'));_0x28d322(_0x266235[_0xa59a('0x13')][_0xa59a('0x11')]);}})[_0xa59a('0x14')](function(_0x1c7aa7){logger[_0xa59a('0x10')](_0xa59a('0xc'),_0x4746fa,_0x1c7aa7);_0x3542bf(_0x1c7aa7);});});}exports[_0xa59a('0x15')]=function(_0x43cf40){var _0x238892=this;return new Promise(function(_0x3046ec,_0x446abb){return db['CmHopper'][_0xa59a('0x16')]({'raw':_0x43cf40[_0xa59a('0x17')]?_0x43cf40[_0xa59a('0x17')][_0xa59a('0x18')]===undefined?!![]:![]:!![],'where':_0x43cf40['options']?_0x43cf40[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'attributes':_0x43cf40[_0xa59a('0x17')]?_0x43cf40[_0xa59a('0x17')][_0xa59a('0x1a')]||null:null,'limit':_0x43cf40[_0xa59a('0x17')]?_0x43cf40[_0xa59a('0x17')][_0xa59a('0x1b')]||null:null,'include':_0x43cf40[_0xa59a('0x17')]?_0x43cf40[_0xa59a('0x17')][_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x43cf40[_0xa59a('0x17')][_0xa59a('0x1c')],function(_0x3e67ef){return{'model':db[_0x3e67ef[_0xa59a('0x1e')]],'as':_0x3e67ef['as'],'attributes':_0x3e67ef[_0xa59a('0x1a')],'include':_0x3e67ef[_0xa59a('0x1c')]?_['map'](_0x3e67ef[_0xa59a('0x1c')],function(_0x243a48){return{'model':db[_0x243a48[_0xa59a('0x1e')]],'as':_0x243a48['as'],'attributes':_0x243a48[_0xa59a('0x1a')],'include':_0x243a48[_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x243a48[_0xa59a('0x1c')],function(_0x3a640b){return{'model':db[_0x3a640b['model']],'as':_0x3a640b['as'],'attributes':_0x3a640b[_0xa59a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50d705){logger['info'](_0xa59a('0x15'),_0x43cf40);logger[_0xa59a('0x1f')](_0xa59a('0x15'),_0x43cf40,JSON[_0xa59a('0xf')](_0x50d705));_0x3046ec(_0x50d705);})[_0xa59a('0x14')](function(_0x22816a){logger[_0xa59a('0x10')](_0xa59a('0x15'),_0x22816a[_0xa59a('0x11')],_0x43cf40);_0x446abb(_0x238892[_0xa59a('0x10')](0x1f4,_0x22816a['message']));});});};exports[_0xa59a('0x20')]=function(_0x30e03c){var _0x863062=this;return new Promise(function(_0x19b495,_0x12f6bc){return db[_0xa59a('0x21')][_0xa59a('0x22')]({'raw':_0x30e03c[_0xa59a('0x17')]?_0x30e03c[_0xa59a('0x17')][_0xa59a('0x18')]===undefined?!![]:![]:!![],'where':_0x30e03c[_0xa59a('0x17')]?_0x30e03c[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'attributes':_0x30e03c['options']?_0x30e03c['options'][_0xa59a('0x1a')]||null:null,'include':_0x30e03c[_0xa59a('0x17')]?_0x30e03c['options'][_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x30e03c[_0xa59a('0x17')][_0xa59a('0x1c')],function(_0x37a28c){return{'model':db[_0x37a28c[_0xa59a('0x1e')]],'as':_0x37a28c['as'],'attributes':_0x37a28c[_0xa59a('0x1a')],'include':_0x37a28c[_0xa59a('0x1c')]?_['map'](_0x37a28c[_0xa59a('0x1c')],function(_0xf2f230){return{'model':db[_0xf2f230[_0xa59a('0x1e')]],'as':_0xf2f230['as'],'attributes':_0xf2f230[_0xa59a('0x1a')],'include':_0xf2f230[_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0xf2f230[_0xa59a('0x1c')],function(_0x1d26d5){return{'model':db[_0x1d26d5[_0xa59a('0x1e')]],'as':_0x1d26d5['as'],'attributes':_0x1d26d5[_0xa59a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa59a('0x23')](function(_0x1dbaa9){logger[_0xa59a('0x12')]('ShowCmHopper',_0x30e03c);logger[_0xa59a('0x1f')](_0xa59a('0x20'),_0x30e03c,JSON['stringify'](_0x1dbaa9));_0x19b495(_0x1dbaa9);})[_0xa59a('0x14')](function(_0x1278ff){logger[_0xa59a('0x10')](_0xa59a('0x20'),_0x1278ff[_0xa59a('0x11')],_0x30e03c);_0x12f6bc(_0x863062[_0xa59a('0x10')](0x1f4,_0x1278ff[_0xa59a('0x11')]));});});};exports['CreateCmHopper']=function(_0x4e8593){var _0x2c7003=this;return new Promise(function(_0x4a5908,_0xcd8cd6){return db[_0xa59a('0x21')][_0xa59a('0x24')](_0x4e8593['body'],{'raw':_0x4e8593[_0xa59a('0x17')]?_0x4e8593[_0xa59a('0x17')][_0xa59a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2c4223){logger[_0xa59a('0x12')](_0xa59a('0x25'),_0x4e8593);logger[_0xa59a('0x1f')](_0xa59a('0x25'),_0x4e8593,JSON[_0xa59a('0xf')](_0x2c4223));_0x4a5908(_0x2c4223);})[_0xa59a('0x14')](function(_0x30f505){logger[_0xa59a('0x10')](_0xa59a('0x25'),_0x30f505[_0xa59a('0x11')],_0x4e8593);_0xcd8cd6(_0x2c7003['error'](0x1f4,_0x30f505['message']));});});};exports['UpdateCmHopper']=function(_0x38124c){var _0x4356d3=this;return new Promise(function(_0x1255bb,_0x4d1549){return db[_0xa59a('0x21')][_0xa59a('0x26')](_0x38124c['body'],{'raw':_0x38124c[_0xa59a('0x17')]?_0x38124c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38124c['options']?_0x38124c[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'attributes':_0x38124c[_0xa59a('0x17')]?_0x38124c[_0xa59a('0x17')]['attributes']||null:null,'limit':_0x38124c[_0xa59a('0x17')]?_0x38124c[_0xa59a('0x17')][_0xa59a('0x1b')]||null:null})[_0xa59a('0x23')](function(_0x419c0c){logger['info'](_0xa59a('0x27'),_0x38124c);logger['info'](_0xa59a('0x28'),JSON[_0xa59a('0xf')](_0x38124c[_0xa59a('0x17')][_0xa59a('0x19')]),_0x38124c[_0xa59a('0x29')][_0xa59a('0x2a')]);logger[_0xa59a('0x1f')](_0xa59a('0x27'),_0x38124c,JSON[_0xa59a('0xf')](_0x419c0c));_0x1255bb(_0x419c0c);})[_0xa59a('0x14')](function(_0x1b35f4){logger[_0xa59a('0x10')]('UpdateCmHopper',_0x1b35f4[_0xa59a('0x11')],_0x38124c);_0x4d1549(_0x4356d3[_0xa59a('0x10')](0x1f4,_0x1b35f4[_0xa59a('0x11')]));});});};exports[_0xa59a('0x2b')]=function(_0x3ae84b){var _0x4430c8=this;return new Promise(function(_0x17516b,_0x66a283){return db[_0xa59a('0x21')][_0xa59a('0x2c')]({'where':_0x3ae84b['options']?_0x3ae84b[_0xa59a('0x17')][_0xa59a('0x19')]||null:null})[_0xa59a('0x23')](function(_0x4221b1){logger['info']('DestroyCmHopper',_0x3ae84b);logger[_0xa59a('0x1f')](_0xa59a('0x2b'),_0x3ae84b,JSON[_0xa59a('0xf')](_0x4221b1));_0x17516b(_0x4221b1);})[_0xa59a('0x14')](function(_0x2fd8b4){logger['error'](_0xa59a('0x2b'),_0x2fd8b4['message'],_0x3ae84b);_0x66a283(_0x4430c8['error'](0x1f4,_0x2fd8b4[_0xa59a('0x11')]));});});};exports['GetContactDialer']=function(_0x41fecb){var _0x52f9c6=this;return new Promise(function(_0x183037,_0x364728){return db[_0xa59a('0x2d')][_0xa59a('0x2e')]()[_0xa59a('0x23')](function(_0x2073c){return db['sequelize'][_0xa59a('0x2f')](function(_0x4eb2e8){return db[_0xa59a('0x21')]['findAll']({'where':_0x41fecb['options']?_0x41fecb['options']['where']||null:null,'attributes':_0x41fecb[_0xa59a('0x17')]?_0x41fecb['options']['attributes']||null:null,'limit':_0x41fecb[_0xa59a('0x17')]?_0x41fecb[_0xa59a('0x17')][_0xa59a('0x1b')]||null:null,'order':_0x41fecb[_0xa59a('0x17')]?_0x41fecb[_0xa59a('0x17')][_0xa59a('0x30')]||null:null,'transaction':_0x4eb2e8,'lock':_0x4eb2e8['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa59a('0x31'),'attributes':_[_0xa59a('0x32')](_0x2073c)},{'model':db[_0xa59a('0x33')],'as':_0xa59a('0x34'),'attributes':['id','name',_0xa59a('0x35')]}]})[_0xa59a('0x23')](function(_0xf2b3f0){var _0x38bd21=[];var _0x2f8646=[];for(var _0x55f9ce=0x0;_0x55f9ce<_0xf2b3f0[_0xa59a('0x36')];_0x55f9ce+=0x1){var _0x202b0d=_0xf2b3f0[_0x55f9ce][_0xa59a('0x37')];if(_0x202b0d===null){_0x38bd21[_0xa59a('0x38')](_0xf2b3f0[_0x55f9ce][_0xa59a('0x26')](_0x41fecb[_0xa59a('0x29')],{'transaction':_0x4eb2e8}));}else if(!_0x2f8646[_0xa59a('0x39')](_0x202b0d)){_0x2f8646[_0xa59a('0x38')](_0x202b0d);_0x38bd21[_0xa59a('0x38')](_0xf2b3f0[_0x55f9ce][_0xa59a('0x26')](_0x41fecb[_0xa59a('0x29')],{'transaction':_0x4eb2e8}));}}return BPromise[_0xa59a('0x3a')](_0x38bd21);});})[_0xa59a('0x23')](function(_0x56be8e){logger[_0xa59a('0x12')](_0xa59a('0x3b'),_0x41fecb);if(_0x56be8e[_0xa59a('0x36')]>0x0){logger[_0xa59a('0x12')](_0xa59a('0x3c'),_0x56be8e[0x0][_0xa59a('0x3d')]['id'],_0x56be8e[0x0][_0xa59a('0x3d')][_0xa59a('0x3e')],_0x56be8e[0x0][_0xa59a('0x3d')][_0xa59a('0x2a')]);}logger[_0xa59a('0x1f')]('GetContactDialer',_0x41fecb,JSON[_0xa59a('0xf')](_0x56be8e));_0x183037(_0x56be8e);})[_0xa59a('0x14')](function(_0x19489e){logger[_0xa59a('0x10')](_0xa59a('0x3b'),_0x19489e[_0xa59a('0x11')],_0x41fecb);_0x364728(_0x52f9c6[_0xa59a('0x10')](0x1f4,_0x19489e[_0xa59a('0x11')]));});});});};exports[_0xa59a('0x3f')]=function(_0x340fbc){var _0x1eefc8=this;return new Promise(function(_0x190b15,_0x395d8e){return db[_0xa59a('0x40')][_0xa59a('0x2f')](function(_0xf35887){return db['CmHopperFinal'][_0xa59a('0x24')](_0x340fbc[_0xa59a('0x29')],{'raw':_0x340fbc['options']?_0x340fbc['options'][_0xa59a('0x18')]===undefined?!![]:![]:!![],'transaction':_0xf35887})['then'](function(){logger[_0xa59a('0x12')](_0xa59a('0x41'),JSON[_0xa59a('0xf')](_0x340fbc['options'][_0xa59a('0x19')]),_0x340fbc[_0xa59a('0x17')][_0xa59a('0x19')][_0xa59a('0x2a')]);return db[_0xa59a('0x21')][_0xa59a('0x2c')]({'where':_0x340fbc[_0xa59a('0x17')]?_0x340fbc[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'transaction':_0xf35887});});})[_0xa59a('0x23')](function(_0x205430){logger[_0xa59a('0x12')]('MoveContactManagedDialer',_0x340fbc);logger[_0xa59a('0x1f')]('MoveContactManagedDialer',_0x340fbc,JSON['stringify'](_0x205430));_0x190b15(_0x205430);})[_0xa59a('0x14')](function(_0x31da55){logger[_0xa59a('0x10')](_0xa59a('0x3f'),_0x31da55[_0xa59a('0x11')],_0x340fbc);_0x395d8e(_0x1eefc8[_0xa59a('0x10')](0x1f4,_0x31da55['message']));});});};exports[_0xa59a('0x42')]=function(_0x141e6a){var _0x23258c=this;return new Promise(function(_0xc492a1,_0x22897b){return db[_0xa59a('0x21')][_0xa59a('0x16')]({'raw':_0x141e6a[_0xa59a('0x17')]?_0x141e6a['options'][_0xa59a('0x18')]===undefined?!![]:![]:!![],'where':_0x141e6a['options']?_0x141e6a[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'attributes':[[db[_0xa59a('0x40')]['fn']('COUNT',db[_0xa59a('0x40')]['fn']('IF',db[_0xa59a('0x40')][_0xa59a('0x43')]('`scheduledat`\x20>=\x20'+util[_0xa59a('0x44')](_0xa59a('0x45'),moment()[_0xa59a('0x44')](_0xa59a('0x46')))+_0xa59a('0x47')))),_0xa59a('0x48')]]})[_0xa59a('0x23')](function(_0xc1f6f5){logger[_0xa59a('0x12')](_0xa59a('0x42'),_0x141e6a);logger[_0xa59a('0x1f')](_0xa59a('0x42'),_0x141e6a,JSON[_0xa59a('0xf')](_0xc1f6f5));_0xc492a1(_0xc1f6f5);})[_0xa59a('0x14')](function(_0x3f57d9){logger[_0xa59a('0x10')]('CountReScheduled',_0x3f57d9['message'],_0x141e6a);_0x22897b(_0x23258c[_0xa59a('0x10')](0x1f4,_0x3f57d9[_0xa59a('0x11')]));});});};exports['GetContactRecallMe']=function(_0x4d181a){var _0x387cb0=this;return new Promise(function(_0x531251,_0x55541c){return db[_0xa59a('0x2d')][_0xa59a('0x2e')]()[_0xa59a('0x23')](function(_0x5ed09c){return db[_0xa59a('0x40')][_0xa59a('0x2f')](function(_0x43a1d5){return db[_0xa59a('0x21')][_0xa59a('0x16')]({'where':_0x4d181a[_0xa59a('0x17')]?_0x4d181a['options'][_0xa59a('0x19')]||null:null,'attributes':_0x4d181a[_0xa59a('0x17')]?_0x4d181a[_0xa59a('0x17')]['attributes']||null:null,'limit':0x1,'order':_0x4d181a[_0xa59a('0x17')]?_0x4d181a[_0xa59a('0x17')]['order']||null:null,'group':db[_0xa59a('0x21')][_0xa59a('0x37')],'transaction':_0x43a1d5,'lock':_0x43a1d5[_0xa59a('0x49')][_0xa59a('0x4a')],'include':_0x4d181a[_0xa59a('0x17')]?_0x4d181a[_0xa59a('0x17')][_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x4d181a['options'][_0xa59a('0x1c')],function(_0x23d626){return{'model':db[_0x23d626['model']],'as':_0x23d626['as'],'attributes':_0x23d626[_0xa59a('0x1a')],'include':_0x23d626[_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x23d626['include'],function(_0x24d67e){return{'model':db[_0x24d67e[_0xa59a('0x1e')]],'as':_0x24d67e['as'],'attributes':_0x24d67e[_0xa59a('0x1a')],'include':_0x24d67e['include']?_[_0xa59a('0x1d')](_0x24d67e[_0xa59a('0x1c')],function(_0x1698df){return{'model':db[_0x1698df[_0xa59a('0x1e')]],'as':_0x1698df['as'],'attributes':_0x1698df[_0xa59a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6f42){var _0x10958e=[];for(var _0x5eacbd=0x0;_0x5eacbd<_0x4b6f42[_0xa59a('0x36')];_0x5eacbd+=0x1){_0x10958e[_0xa59a('0x38')](_0x4b6f42[_0x5eacbd]['update'](_0x4d181a[_0xa59a('0x29')],{'transaction':_0x43a1d5}));}return BPromise[_0xa59a('0x3a')](_0x10958e);});})[_0xa59a('0x23')](function(_0x267033){logger[_0xa59a('0x12')](_0xa59a('0x4b'),_0x4d181a);logger[_0xa59a('0x1f')](_0xa59a('0x4b'),_0x4d181a,JSON['stringify'](_0x267033));_0x531251(_0x267033);})['catch'](function(_0x41f290){logger[_0xa59a('0x10')]('GetContactRecallMe',_0x41f290[_0xa59a('0x11')],_0x4d181a);_0x55541c(_0x387cb0[_0xa59a('0x10')](0x1f4,_0x41f290[_0xa59a('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x10d081){var _0x73417b=this;return new Promise(function(_0xda53b7,_0x256ccc){db[_0xa59a('0x2d')]['describe']()[_0xa59a('0x23')](function(_0x407b6e){return db[_0xa59a('0x21')][_0xa59a('0x16')]({'raw':_0x10d081[_0xa59a('0x17')]?_0x10d081[_0xa59a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x10d081[_0xa59a('0x17')]?_0x10d081[_0xa59a('0x17')][_0xa59a('0x19')]||null:null,'attributes':_0x10d081['options']?_0x10d081['options'][_0xa59a('0x1a')]||null:null,'limit':_0x10d081[_0xa59a('0x17')]?_0x10d081[_0xa59a('0x17')]['limit']||null:null,'include':_0x10d081[_0xa59a('0x17')]?_0x10d081[_0xa59a('0x17')]['include']?_[_0xa59a('0x1d')](_0x10d081[_0xa59a('0x17')][_0xa59a('0x1c')],function(_0x35994c){return{'model':db[_0x35994c[_0xa59a('0x1e')]],'as':_0x35994c['as'],'attributes':_0x35994c['as']===_0xa59a('0x31')?_[_0xa59a('0x32')](_0x407b6e):_0x35994c[_0xa59a('0x1a')],'include':_0x35994c[_0xa59a('0x1c')]?_[_0xa59a('0x1d')](_0x35994c[_0xa59a('0x1c')],function(_0x136568){return{'model':db[_0x136568[_0xa59a('0x1e')]],'as':_0x136568['as'],'attributes':_0x136568[_0xa59a('0x1a')],'include':_0x136568['include']?_[_0xa59a('0x1d')](_0x136568[_0xa59a('0x1c')],function(_0x15f149){return{'model':db[_0x15f149['model']],'as':_0x15f149['as'],'attributes':_0x15f149['attributes']};}):[]};}):[]};}):[]:[]})[_0xa59a('0x23')](function(_0x465c59){logger[_0xa59a('0x12')](_0xa59a('0x15'),_0x10d081);logger[_0xa59a('0x1f')](_0xa59a('0x15'),_0x10d081,JSON['stringify'](_0x465c59));_0xda53b7(_0x465c59);})[_0xa59a('0x14')](function(_0x2d1439){logger[_0xa59a('0x10')](_0xa59a('0x15'),_0x2d1439['message'],_0x10d081);_0x256ccc(_0x73417b[_0xa59a('0x10')](0x1f4,_0x2d1439[_0xa59a('0x11')]));});});});};exports['GetContactByPhone']=function(_0x59c2e2){var _0x14a7c9=this;return new Promise(function(_0x2b0026,_0x300b5d){return db['CmContact'][_0xa59a('0x4c')]({'raw':!![],'where':{'phone':_0x59c2e2[_0xa59a('0x17')][_0xa59a('0x19')][_0xa59a('0x4d')]},'attributes':['id','dialTimezone'],'order':[['id',_0xa59a('0x4e')]]})[_0xa59a('0x23')](function(_0x51f2c0){logger[_0xa59a('0x12')](_0xa59a('0x4f'),_0x59c2e2);logger['debug'](_0xa59a('0x4f'),_0x59c2e2,JSON[_0xa59a('0xf')](_0x51f2c0));_0x2b0026(_0x51f2c0);})[_0xa59a('0x14')](function(_0x3b514e){logger[_0xa59a('0x10')](_0xa59a('0x4f'),_0x3b514e['message'],_0x59c2e2);_0x300b5d(_0x14a7c9[_0xa59a('0x10')](0x1f4,_0x3b514e[_0xa59a('0x11')]));});});};exports['ResetActiveCalls']=function(_0x126600){var _0x27ad4e=this;return new Promise(function(_0x915657,_0x271758){return db[_0xa59a('0x40')][_0xa59a('0x2f')](function(_0x3fc85e){return db[_0xa59a('0x21')][_0xa59a('0x26')]({'active':![]},{'where':{},'transaction':_0x3fc85e})[_0xa59a('0x23')](function(_0x3f29be){logger[_0xa59a('0x12')]('ResetActiveCalls',_0x126600);logger['debug']('ResetActiveCalls',_0x126600,JSON[_0xa59a('0xf')](_0x3f29be));_0x915657(_0x3f29be);})[_0xa59a('0x14')](function(_0x4749b9){logger[_0xa59a('0x10')](_0xa59a('0x50'),_0x4749b9['message'],_0x126600);_0x271758(_0x27ad4e['error'](0x1f4,_0x4749b9[_0xa59a('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1e127c){var _0x518653=this;var _0x94ae9d=_0x1e127c[_0xa59a('0x29')][_0xa59a('0x19')]['voiceQueueId'];var _0x577331=_0x1e127c[_0xa59a('0x29')][_0xa59a('0x19')][_0xa59a('0x51')];return new Promise(function(_0x37cdde,_0x27aa2f){return db[_0xa59a('0x21')][_0xa59a('0x16')]({'where':{'voiceQueueId':_0x94ae9d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xa59a('0x40')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x577331+_0xa59a('0x52'))}},'include':[{'model':db[_0xa59a('0x2d')],'as':_0xa59a('0x31')},{'model':db['User'],'as':_0xa59a('0x34'),'attributes':['id',_0xa59a('0x53'),_0xa59a('0x35')]},{'model':db[_0xa59a('0x54')],'as':_0xa59a('0x55')}]})['then'](function(_0x2b3768){return db[_0xa59a('0x40')][_0xa59a('0x2f')](function(_0x2921ca){return db[_0xa59a('0x21')][_0xa59a('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x94ae9d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xa59a('0x40')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x577331+_0xa59a('0x52'))}},'transaction':_0x2921ca})[_0xa59a('0x23')](function(_0x48f000){_0x37cdde(_0x2b3768);})[_0xa59a('0x14')](function(_0x2a28d0){logger[_0xa59a('0x10')](_0xa59a('0x56'),_0x2a28d0['message'],_0x1e127c);_0x27aa2f(validateExpressRequest);});});})['catch'](function(_0x2bbc79){logger[_0xa59a('0x10')](_0xa59a('0x56'),_0x2bbc79[_0xa59a('0x11')],_0x1e127c);_0x27aa2f(_0x518653['error'](0x1f4,_0x2bbc79[_0xa59a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index bd3af5a..2b8b084 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 _0x4c2e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts','getTimezones','show','post','/preview','/timezone','getTimezone','/previewrecall','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x19ef2b,_0x354f66){var _0x4df537=function(_0x576738){while(--_0x576738){_0x19ef2b['push'](_0x19ef2b['shift']());}};_0x4df537(++_0x354f66);}(_0x4c2e,0xfe));var _0xe4c2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4c2e[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0xe4c2('0x0'));var util=require('util');var path=require(_0xe4c2('0x1'));var timeout=require(_0xe4c2('0x2'));var express=require(_0xe4c2('0x3'));var router=express[_0xe4c2('0x4')]();var fs_extra=require(_0xe4c2('0x5'));var auth=require(_0xe4c2('0x6'));var interaction=require(_0xe4c2('0x7'));var config=require(_0xe4c2('0x8'));var controller=require(_0xe4c2('0x9'));router[_0xe4c2('0xa')]('/',auth[_0xe4c2('0xb')](),controller['index']);router['get'](_0xe4c2('0xc'),auth[_0xe4c2('0xb')](),controller['describe']);router[_0xe4c2('0xa')](_0xe4c2('0xd'),auth[_0xe4c2('0xb')](),controller['getOpenContacts']);router[_0xe4c2('0xa')]('/timezones',auth['isAuthenticated'](),controller[_0xe4c2('0xe')]);router[_0xe4c2('0xa')]('/:id',auth[_0xe4c2('0xb')](),controller[_0xe4c2('0xf')]);router[_0xe4c2('0x10')]('/',auth[_0xe4c2('0xb')](),controller['create']);router[_0xe4c2('0x10')](_0xe4c2('0x11'),auth['isAuthenticated'](),controller['getPreview']);router[_0xe4c2('0x10')](_0xe4c2('0x12'),auth[_0xe4c2('0xb')](),controller[_0xe4c2('0x13')]);router[_0xe4c2('0x10')](_0xe4c2('0x14'),auth[_0xe4c2('0xb')](),controller['getPreviewRecall']);router['put'](_0xe4c2('0x15'),auth[_0xe4c2('0xb')](),controller[_0xe4c2('0x16')]);router[_0xe4c2('0x17')](_0xe4c2('0x15'),auth[_0xe4c2('0xb')](),controller[_0xe4c2('0x18')]);module[_0xe4c2('0x19')]=router; \ No newline at end of file +var _0x7859=['/:id','post','/previewrecall','getPreviewRecall','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones'];(function(_0x2ad678,_0x35ca0f){var _0x8427f6=function(_0x5f4829){while(--_0x5f4829){_0x2ad678['push'](_0x2ad678['shift']());}};_0x8427f6(++_0x35ca0f);}(_0x7859,0x1ef));var _0x9785=function(_0x2ed2f1,_0x56e766){_0x2ed2f1=_0x2ed2f1-0x0;var _0x22f337=_0x7859[_0x2ed2f1];return _0x22f337;};'use strict';var multer=require(_0x9785('0x0'));var util=require(_0x9785('0x1'));var path=require(_0x9785('0x2'));var timeout=require(_0x9785('0x3'));var express=require(_0x9785('0x4'));var router=express[_0x9785('0x5')]();var fs_extra=require(_0x9785('0x6'));var auth=require(_0x9785('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9785('0x8'));var controller=require(_0x9785('0x9'));router[_0x9785('0xa')]('/',auth[_0x9785('0xb')](),controller[_0x9785('0xc')]);router[_0x9785('0xa')]('/describe',auth[_0x9785('0xb')](),controller[_0x9785('0xd')]);router['get'](_0x9785('0xe'),auth['isAuthenticated'](),controller[_0x9785('0xf')]);router['get'](_0x9785('0x10'),auth[_0x9785('0xb')](),controller[_0x9785('0x11')]);router['get'](_0x9785('0x12'),auth[_0x9785('0xb')](),controller['show']);router[_0x9785('0x13')]('/',auth[_0x9785('0xb')](),controller['create']);router[_0x9785('0x13')]('/preview',auth[_0x9785('0xb')](),controller['getPreview']);router['post']('/timezone',auth[_0x9785('0xb')](),controller['getTimezone']);router[_0x9785('0x13')](_0x9785('0x14'),auth[_0x9785('0xb')](),controller[_0x9785('0x15')]);router[_0x9785('0x16')](_0x9785('0x12'),auth['isAuthenticated'](),controller[_0x9785('0x17')]);router[_0x9785('0x18')](_0x9785('0x12'),auth[_0x9785('0xb')](),controller[_0x9785('0x19')]);module[_0x9785('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6a38a2d..ad86dfe 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 _0xfa23=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x469fe3,_0x1c116f){var _0x323496=function(_0x5a639f){while(--_0x5a639f){_0x469fe3['push'](_0x469fe3['shift']());}};_0x323496(++_0x1c116f);}(_0xfa23,0x1d5));var _0x3fa2=function(_0x196792,_0x5b9f89){_0x196792=_0x196792-0x0;var _0x2f8d8c=_0xfa23[_0x196792];return _0x2f8d8c;};'use strict';var moment=require(_0x3fa2('0x0'));var Sequelize=require('sequelize');module[_0x3fa2('0x1')]={'phone':{'type':Sequelize[_0x3fa2('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3fa2('0x3')],'unique':_0x3fa2('0x4')},'ListId':{'type':Sequelize[_0x3fa2('0x3')],'unique':_0x3fa2('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3fa2('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x119a=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0x119a,0x69));var _0xa119=function(_0x1c3fae,_0x231153){_0x1c3fae=_0x1c3fae-0x0;var _0x47e4b5=_0x119a[_0x1c3fae];return _0x47e4b5;};'use strict';var moment=require(_0xa119('0x0'));var Sequelize=require(_0xa119('0x1'));module[_0xa119('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'ListId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa119('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4bb71bd..ba979e4 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 _0xd5f7=['rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x5d8c3a,_0x52c448){var _0x5fbe1b=function(_0x5a07b4){while(--_0x5a07b4){_0x5d8c3a['push'](_0x5d8c3a['shift']());}};_0x5fbe1b(++_0x52c448);}(_0xd5f7,0x13b));var _0x7d5f=function(_0x375494,_0x3a9886){_0x375494=_0x375494-0x0;var _0x57913d=_0xd5f7[_0x375494];return _0x57913d;};'use strict';var emlformat=require(_0x7d5f('0x0'));var rimraf=require(_0x7d5f('0x1'));var zipdir=require(_0x7d5f('0x2'));var jsonpatch=require(_0x7d5f('0x3'));var rp=require('request-promise');var moment=require(_0x7d5f('0x4'));var BPromise=require(_0x7d5f('0x5'));var Mustache=require(_0x7d5f('0x6'));var util=require(_0x7d5f('0x7'));var path=require(_0x7d5f('0x8'));var sox=require(_0x7d5f('0x9'));var csv=require(_0x7d5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d5f('0xb'));var _=require(_0x7d5f('0xc'));var squel=require(_0x7d5f('0xd'));var crypto=require('crypto');var jsforce=require(_0x7d5f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d5f('0xa'));var querystring=require(_0x7d5f('0xf'));var Papa=require('papaparse');var Redis=require(_0x7d5f('0x10'));var authService=require(_0x7d5f('0x11'));var qs=require(_0x7d5f('0x12'));var as=require(_0x7d5f('0x13'));var hardwareService=require(_0x7d5f('0x14'));var logger=require('../../config/logger')(_0x7d5f('0x15'));var utils=require('../../config/utils');var config=require(_0x7d5f('0x16'));var licenseUtil=require(_0x7d5f('0x17'));var db=require(_0x7d5f('0x18'))['db'];function respondWithStatusCode(_0x56efdf,_0x56b900){_0x56b900=_0x56b900||0xcc;return function(_0x414c82){if(_0x414c82){return _0x56efdf[_0x7d5f('0x19')](_0x56b900);}return _0x56efdf[_0x7d5f('0x1a')](_0x56b900)['end']();};}function respondWithResult(_0x593f59,_0xd64d6a){_0xd64d6a=_0xd64d6a||0xc8;return function(_0x3139ab){if(_0x3139ab){return _0x593f59[_0x7d5f('0x1a')](_0xd64d6a)[_0x7d5f('0x1b')](_0x3139ab);}};}function respondWithFilteredResult(_0x2f067a,_0x151ec7){return function(_0x213d20){if(_0x213d20){var _0x5e54df=typeof _0x151ec7[_0x7d5f('0x1c')]===_0x7d5f('0x1d')&&typeof _0x151ec7[_0x7d5f('0x1e')]===_0x7d5f('0x1d');var _0x4f8473=_0x213d20[_0x7d5f('0x1f')];var _0x16ebd1=_0x5e54df?0x0:_0x151ec7['offset'];var _0x542d1f=_0x5e54df?_0x213d20['count']:_0x151ec7['offset']+_0x151ec7[_0x7d5f('0x1e')];var _0xadfa54;if(_0x542d1f>=_0x4f8473){_0x542d1f=_0x4f8473;_0xadfa54=0xc8;}else{_0xadfa54=0xce;}_0x2f067a['status'](_0xadfa54);return _0x2f067a[_0x7d5f('0x20')]('Content-Range',_0x16ebd1+'-'+_0x542d1f+'/'+_0x4f8473)[_0x7d5f('0x1b')](_0x213d20);}return null;};}function patchUpdates(_0x51c6b1){return function(_0x31befd){try{jsonpatch[_0x7d5f('0x21')](_0x31befd,_0x51c6b1,!![]);}catch(_0x3498ec){return BPromise[_0x7d5f('0x22')](_0x3498ec);}return _0x31befd[_0x7d5f('0x23')]();};}function saveUpdates(_0x30791a,_0x18d9dc){return function(_0x4f0351){if(_0x4f0351){return _0x4f0351[_0x7d5f('0x24')](_0x30791a)[_0x7d5f('0x25')](function(_0x47a491){return _0x47a491;});}return null;};}function removeEntity(_0x57aa06,_0x1e34b5){return function(_0xa08cec){if(_0xa08cec){return _0xa08cec[_0x7d5f('0x26')]()['then'](function(){_0x57aa06['status'](0xcc)[_0x7d5f('0x27')]();});}};}function handleEntityNotFound(_0x2632c5,_0x52d4dc){return function(_0x24ff80){if(!_0x24ff80){_0x2632c5[_0x7d5f('0x19')](0x194);}return _0x24ff80;};}function handleError(_0x4fd7d0,_0x127911){_0x127911=_0x127911||0x1f4;return function(_0x3099b3){logger[_0x7d5f('0x28')](_0x3099b3[_0x7d5f('0x29')]);if(_0x3099b3[_0x7d5f('0x2a')]){delete _0x3099b3[_0x7d5f('0x2a')];}_0x4fd7d0[_0x7d5f('0x1a')](_0x127911)[_0x7d5f('0x2b')](_0x3099b3);};}exports[_0x7d5f('0x2c')]=function(_0x1d2e86,_0x19dc86){var _0x3955fa={},_0x4f58e4={},_0x2d331d={'count':0x0,'rows':[]};var _0x316bf4=_[_0x7d5f('0x2d')](db[_0x7d5f('0x2e')][_0x7d5f('0x2f')],function(_0x5a3a33){return{'name':_0x5a3a33[_0x7d5f('0x30')],'type':_0x5a3a33[_0x7d5f('0x31')]['key']};});_0x4f58e4[_0x7d5f('0x32')]=_['map'](_0x316bf4,_0x7d5f('0x2a'));_0x4f58e4[_0x7d5f('0x33')]=_[_0x7d5f('0x34')](_0x1d2e86['query']);_0x4f58e4[_0x7d5f('0x35')]=_[_0x7d5f('0x36')](_0x4f58e4[_0x7d5f('0x32')],_0x4f58e4[_0x7d5f('0x33')]);_0x3955fa['attributes']=_[_0x7d5f('0x36')](_0x4f58e4['model'],qs[_0x7d5f('0x37')](_0x1d2e86['query'][_0x7d5f('0x37')]));_0x3955fa[_0x7d5f('0x38')]=_0x3955fa[_0x7d5f('0x38')][_0x7d5f('0x39')]?_0x3955fa[_0x7d5f('0x38')]:_0x4f58e4[_0x7d5f('0x32')];if(!_0x1d2e86[_0x7d5f('0x33')][_0x7d5f('0x3a')](_0x7d5f('0x3b'))){_0x3955fa['limit']=qs[_0x7d5f('0x1e')](_0x1d2e86[_0x7d5f('0x33')][_0x7d5f('0x1e')]);_0x3955fa[_0x7d5f('0x1c')]=qs['offset'](_0x1d2e86[_0x7d5f('0x33')][_0x7d5f('0x1c')]);}_0x3955fa[_0x7d5f('0x3c')]=qs[_0x7d5f('0x3d')](_0x1d2e86[_0x7d5f('0x33')][_0x7d5f('0x3d')]);_0x3955fa[_0x7d5f('0x3e')]=qs[_0x7d5f('0x35')](_[_0x7d5f('0x3f')](_0x1d2e86[_0x7d5f('0x33')],_0x4f58e4[_0x7d5f('0x35')]),_0x316bf4);if(_0x1d2e86[_0x7d5f('0x33')][_0x7d5f('0x40')]){_0x3955fa[_0x7d5f('0x3e')]=_[_0x7d5f('0x41')](_0x3955fa[_0x7d5f('0x3e')],{'$or':_[_0x7d5f('0x2d')](_0x316bf4,function(_0x233b5d){if(_0x233b5d['type']!==_0x7d5f('0x42')){var _0x1ce4fe={};_0x1ce4fe[_0x233b5d[_0x7d5f('0x2a')]]={'$like':'%'+_0x1d2e86[_0x7d5f('0x33')]['filter']+'%'};return _0x1ce4fe;}})});}_0x3955fa=_[_0x7d5f('0x41')]({},_0x3955fa,_0x1d2e86[_0x7d5f('0x43')]);var _0x17a740={'where':_0x3955fa['where']};return db[_0x7d5f('0x2e')]['count'](_0x17a740)[_0x7d5f('0x25')](function(_0x5120e6){_0x2d331d['count']=_0x5120e6;if(_0x1d2e86['query'][_0x7d5f('0x44')]){_0x3955fa['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x7d5f('0x45')](_0x3955fa);})[_0x7d5f('0x25')](function(_0x4a8ff1){_0x2d331d[_0x7d5f('0x46')]=_0x4a8ff1;return _0x2d331d;})[_0x7d5f('0x25')](respondWithFilteredResult(_0x19dc86,_0x3955fa))[_0x7d5f('0x47')](handleError(_0x19dc86,null));};exports[_0x7d5f('0x48')]=function(_0x1b8e1c,_0x465fd4){var _0x24a414={'raw':!![],'where':{'id':_0x1b8e1c['params']['id']}},_0x59e785={};_0x59e785['model']=_['keys'](db['CmHopperBlack'][_0x7d5f('0x2f')]);_0x59e785['query']=_[_0x7d5f('0x34')](_0x1b8e1c[_0x7d5f('0x33')]);_0x59e785[_0x7d5f('0x35')]=_[_0x7d5f('0x36')](_0x59e785[_0x7d5f('0x32')],_0x59e785['query']);_0x24a414[_0x7d5f('0x38')]=_['intersection'](_0x59e785[_0x7d5f('0x32')],qs[_0x7d5f('0x37')](_0x1b8e1c[_0x7d5f('0x33')][_0x7d5f('0x37')]));_0x24a414[_0x7d5f('0x38')]=_0x24a414[_0x7d5f('0x38')][_0x7d5f('0x39')]?_0x24a414['attributes']:_0x59e785[_0x7d5f('0x32')];if(_0x1b8e1c[_0x7d5f('0x33')]['includeAll']){_0x24a414['include']=[{'all':!![]}];}_0x24a414=_['merge']({},_0x24a414,_0x1b8e1c[_0x7d5f('0x43')]);return db[_0x7d5f('0x2e')][_0x7d5f('0x49')](_0x24a414)[_0x7d5f('0x25')](handleEntityNotFound(_0x465fd4,null))['then'](respondWithResult(_0x465fd4,null))[_0x7d5f('0x47')](handleError(_0x465fd4,null));};exports['update']=function(_0x2381de,_0x4f73af){if(_0x2381de[_0x7d5f('0x4a')]['id']){delete _0x2381de['body']['id'];}return db[_0x7d5f('0x2e')]['find']({'where':{'id':_0x2381de[_0x7d5f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f73af,null))[_0x7d5f('0x25')](saveUpdates(_0x2381de[_0x7d5f('0x4a')],null))['then'](respondWithResult(_0x4f73af,null))[_0x7d5f('0x47')](handleError(_0x4f73af,null));};exports['destroy']=function(_0x1d6c8b,_0x144b2a){return db[_0x7d5f('0x2e')][_0x7d5f('0x49')]({'where':{'id':_0x1d6c8b['params']['id']}})[_0x7d5f('0x25')](handleEntityNotFound(_0x144b2a,null))[_0x7d5f('0x25')](removeEntity(_0x144b2a,null))[_0x7d5f('0x47')](handleError(_0x144b2a,null));};exports[_0x7d5f('0x4c')]=function(_0xd7015e,_0x41d26b){return db['CmHopperBlack'][_0x7d5f('0x4c')]()[_0x7d5f('0x25')](respondWithResult(_0x41d26b,null))[_0x7d5f('0x47')](handleError(_0x41d26b,null));}; \ No newline at end of file +var _0xf04d=['json','apply','reject','save','destroy','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','count','then','includeAll','include','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','set','Content-Range'];(function(_0x3b2e63,_0x17936c){var _0x5bb3db=function(_0x42e703){while(--_0x42e703){_0x3b2e63['push'](_0x3b2e63['shift']());}};_0x5bb3db(++_0x17936c);}(_0xf04d,0x1e6));var _0xdf04=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xf04d[_0xdbe2de];return _0x2facd7;};'use strict';var emlformat=require(_0xdf04('0x0'));var rimraf=require(_0xdf04('0x1'));var zipdir=require(_0xdf04('0x2'));var jsonpatch=require(_0xdf04('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf04('0x4'));var Mustache=require(_0xdf04('0x5'));var util=require(_0xdf04('0x6'));var path=require(_0xdf04('0x7'));var sox=require(_0xdf04('0x8'));var csv=require(_0xdf04('0x9'));var ejs=require(_0xdf04('0xa'));var fs=require('fs');var fs_extra=require(_0xdf04('0xb'));var _=require(_0xdf04('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdf04('0xd'));var deskjs=require(_0xdf04('0xe'));var toCsv=require(_0xdf04('0x9'));var querystring=require(_0xdf04('0xf'));var Papa=require('papaparse');var Redis=require(_0xdf04('0x10'));var authService=require(_0xdf04('0x11'));var qs=require(_0xdf04('0x12'));var as=require(_0xdf04('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf04('0x14'))(_0xdf04('0x15'));var utils=require(_0xdf04('0x16'));var config=require(_0xdf04('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485b12,_0x1d5dac){_0x1d5dac=_0x1d5dac||0xcc;return function(_0x42e40a){if(_0x42e40a){return _0x485b12[_0xdf04('0x18')](_0x1d5dac);}return _0x485b12['status'](_0x1d5dac)[_0xdf04('0x19')]();};}function respondWithResult(_0x377d3b,_0x5a7eb1){_0x5a7eb1=_0x5a7eb1||0xc8;return function(_0x554de9){if(_0x554de9){return _0x377d3b[_0xdf04('0x1a')](_0x5a7eb1)['json'](_0x554de9);}};}function respondWithFilteredResult(_0x13a1cc,_0x3189f7){return function(_0x9c2c43){if(_0x9c2c43){var _0x2a2e85=typeof _0x3189f7[_0xdf04('0x1b')]===_0xdf04('0x1c')&&typeof _0x3189f7[_0xdf04('0x1d')]==='undefined';var _0x5eb8a8=_0x9c2c43['count'];var _0x46ef03=_0x2a2e85?0x0:_0x3189f7[_0xdf04('0x1b')];var _0x43840f=_0x2a2e85?_0x9c2c43['count']:_0x3189f7[_0xdf04('0x1b')]+_0x3189f7[_0xdf04('0x1d')];var _0x19b2be;if(_0x43840f>=_0x5eb8a8){_0x43840f=_0x5eb8a8;_0x19b2be=0xc8;}else{_0x19b2be=0xce;}_0x13a1cc['status'](_0x19b2be);return _0x13a1cc[_0xdf04('0x1e')](_0xdf04('0x1f'),_0x46ef03+'-'+_0x43840f+'/'+_0x5eb8a8)[_0xdf04('0x20')](_0x9c2c43);}return null;};}function patchUpdates(_0xf22a42){return function(_0x5dc18c){try{jsonpatch[_0xdf04('0x21')](_0x5dc18c,_0xf22a42,!![]);}catch(_0x16e0f5){return BPromise[_0xdf04('0x22')](_0x16e0f5);}return _0x5dc18c[_0xdf04('0x23')]();};}function saveUpdates(_0x1d1e1f,_0x510436){return function(_0x32799a){if(_0x32799a){return _0x32799a['update'](_0x1d1e1f)['then'](function(_0x17a024){return _0x17a024;});}return null;};}function removeEntity(_0x14a15b,_0x4ba20e){return function(_0x272881){if(_0x272881){return _0x272881[_0xdf04('0x24')]()['then'](function(){_0x14a15b[_0xdf04('0x1a')](0xcc)[_0xdf04('0x19')]();});}};}function handleEntityNotFound(_0x205a6a,_0x14eb7c){return function(_0xb2e7f6){if(!_0xb2e7f6){_0x205a6a[_0xdf04('0x18')](0x194);}return _0xb2e7f6;};}function handleError(_0x34366e,_0x2c7833){_0x2c7833=_0x2c7833||0x1f4;return function(_0x5ad234){logger[_0xdf04('0x25')](_0x5ad234['stack']);if(_0x5ad234[_0xdf04('0x26')]){delete _0x5ad234[_0xdf04('0x26')];}_0x34366e[_0xdf04('0x1a')](_0x2c7833)[_0xdf04('0x27')](_0x5ad234);};}exports[_0xdf04('0x28')]=function(_0x3c24ae,_0x29a9e8){var _0x58ef67={},_0xd187af={},_0x59d931={'count':0x0,'rows':[]};var _0x360031=_[_0xdf04('0x29')](db[_0xdf04('0x2a')][_0xdf04('0x2b')],function(_0x3d0aa1){return{'name':_0x3d0aa1[_0xdf04('0x2c')],'type':_0x3d0aa1[_0xdf04('0x2d')][_0xdf04('0x2e')]};});_0xd187af[_0xdf04('0x2f')]=_[_0xdf04('0x29')](_0x360031,'name');_0xd187af['query']=_[_0xdf04('0x30')](_0x3c24ae[_0xdf04('0x31')]);_0xd187af[_0xdf04('0x32')]=_[_0xdf04('0x33')](_0xd187af[_0xdf04('0x2f')],_0xd187af[_0xdf04('0x31')]);_0x58ef67[_0xdf04('0x34')]=_[_0xdf04('0x33')](_0xd187af['model'],qs[_0xdf04('0x35')](_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x35')]));_0x58ef67['attributes']=_0x58ef67[_0xdf04('0x34')][_0xdf04('0x36')]?_0x58ef67[_0xdf04('0x34')]:_0xd187af[_0xdf04('0x2f')];if(!_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x37')]('nolimit')){_0x58ef67[_0xdf04('0x1d')]=qs[_0xdf04('0x1d')](_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x1d')]);_0x58ef67[_0xdf04('0x1b')]=qs[_0xdf04('0x1b')](_0x3c24ae['query'][_0xdf04('0x1b')]);}_0x58ef67['order']=qs['sort'](_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x38')]);_0x58ef67['where']=qs[_0xdf04('0x32')](_['pick'](_0x3c24ae[_0xdf04('0x31')],_0xd187af[_0xdf04('0x32')]),_0x360031);if(_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x39')]){_0x58ef67[_0xdf04('0x3a')]=_[_0xdf04('0x3b')](_0x58ef67[_0xdf04('0x3a')],{'$or':_[_0xdf04('0x29')](_0x360031,function(_0x41cc44){if(_0x41cc44[_0xdf04('0x2d')]!==_0xdf04('0x3c')){var _0x3aed04={};_0x3aed04[_0x41cc44[_0xdf04('0x26')]]={'$like':'%'+_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x39')]+'%'};return _0x3aed04;}})});}_0x58ef67=_[_0xdf04('0x3b')]({},_0x58ef67,_0x3c24ae[_0xdf04('0x3d')]);var _0x146185={'where':_0x58ef67['where']};return db[_0xdf04('0x2a')][_0xdf04('0x3e')](_0x146185)[_0xdf04('0x3f')](function(_0x29a42f){_0x59d931[_0xdf04('0x3e')]=_0x29a42f;if(_0x3c24ae[_0xdf04('0x31')][_0xdf04('0x40')]){_0x58ef67[_0xdf04('0x41')]=[{'all':!![]}];}return db[_0xdf04('0x2a')]['findAll'](_0x58ef67);})['then'](function(_0x1498fd){_0x59d931[_0xdf04('0x42')]=_0x1498fd;return _0x59d931;})['then'](respondWithFilteredResult(_0x29a9e8,_0x58ef67))[_0xdf04('0x43')](handleError(_0x29a9e8,null));};exports[_0xdf04('0x44')]=function(_0x436ec9,_0xf521f1){var _0xd6e9be={'raw':!![],'where':{'id':_0x436ec9[_0xdf04('0x45')]['id']}},_0x2e02fd={};_0x2e02fd['model']=_[_0xdf04('0x30')](db[_0xdf04('0x2a')]['rawAttributes']);_0x2e02fd[_0xdf04('0x31')]=_['keys'](_0x436ec9[_0xdf04('0x31')]);_0x2e02fd[_0xdf04('0x32')]=_['intersection'](_0x2e02fd[_0xdf04('0x2f')],_0x2e02fd[_0xdf04('0x31')]);_0xd6e9be['attributes']=_[_0xdf04('0x33')](_0x2e02fd[_0xdf04('0x2f')],qs[_0xdf04('0x35')](_0x436ec9['query'][_0xdf04('0x35')]));_0xd6e9be[_0xdf04('0x34')]=_0xd6e9be['attributes'][_0xdf04('0x36')]?_0xd6e9be['attributes']:_0x2e02fd['model'];if(_0x436ec9[_0xdf04('0x31')][_0xdf04('0x40')]){_0xd6e9be[_0xdf04('0x41')]=[{'all':!![]}];}_0xd6e9be=_[_0xdf04('0x3b')]({},_0xd6e9be,_0x436ec9[_0xdf04('0x3d')]);return db[_0xdf04('0x2a')][_0xdf04('0x46')](_0xd6e9be)[_0xdf04('0x3f')](handleEntityNotFound(_0xf521f1,null))[_0xdf04('0x3f')](respondWithResult(_0xf521f1,null))[_0xdf04('0x43')](handleError(_0xf521f1,null));};exports[_0xdf04('0x47')]=function(_0x3ce0af,_0x391dea){if(_0x3ce0af[_0xdf04('0x48')]['id']){delete _0x3ce0af['body']['id'];}return db[_0xdf04('0x2a')][_0xdf04('0x46')]({'where':{'id':_0x3ce0af[_0xdf04('0x45')]['id']}})[_0xdf04('0x3f')](handleEntityNotFound(_0x391dea,null))['then'](saveUpdates(_0x3ce0af[_0xdf04('0x48')],null))[_0xdf04('0x3f')](respondWithResult(_0x391dea,null))['catch'](handleError(_0x391dea,null));};exports['destroy']=function(_0xd609a3,_0x5cfea4){return db[_0xdf04('0x2a')][_0xdf04('0x46')]({'where':{'id':_0xd609a3[_0xdf04('0x45')]['id']}})[_0xdf04('0x3f')](handleEntityNotFound(_0x5cfea4,null))[_0xdf04('0x3f')](removeEntity(_0x5cfea4,null))['catch'](handleError(_0x5cfea4,null));};exports['describe']=function(_0x28c04e,_0x58ef1c){return db[_0xdf04('0x2a')][_0xdf04('0x49')]()['then'](respondWithResult(_0x58ef1c,null))['catch'](handleError(_0x58ef1c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ed8f40c..d03237c 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 _0x7faa=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb14011,_0x505c7a){var _0xb71e31=function(_0x5535bc){while(--_0x5535bc){_0xb14011['push'](_0xb14011['shift']());}};_0xb71e31(++_0x505c7a);}(_0x7faa,0x105));var _0xa7fa=function(_0x31cfcd,_0x5e813e){_0x31cfcd=_0x31cfcd-0x0;var _0xf6b0bb=_0x7faa[_0x31cfcd];return _0xf6b0bb;};'use strict';var _=require(_0xa7fa('0x0'));var util=require(_0xa7fa('0x1'));var logger=require(_0xa7fa('0x2'))(_0xa7fa('0x3'));var moment=require(_0xa7fa('0x4'));var BPromise=require(_0xa7fa('0x5'));var rp=require(_0xa7fa('0x6'));var fs=require('fs');var path=require(_0xa7fa('0x7'));var rimraf=require(_0xa7fa('0x8'));var config=require(_0xa7fa('0x9'));var attributes=require(_0xa7fa('0xa'));module[_0xa7fa('0xb')]=function(_0x562bd8,_0x58f4e5){return _0x562bd8[_0xa7fa('0xc')](_0xa7fa('0xd'),attributes,{'tableName':_0xa7fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc566=['path','rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc566,0x72));var _0x6c56=function(_0x490173,_0x43ce31){_0x490173=_0x490173-0x0;var _0x5b2028=_0xc566[_0x490173];return _0x5b2028;};'use strict';var _=require(_0x6c56('0x0'));var util=require(_0x6c56('0x1'));var logger=require('../../config/logger')(_0x6c56('0x2'));var moment=require(_0x6c56('0x3'));var BPromise=require(_0x6c56('0x4'));var rp=require(_0x6c56('0x5'));var fs=require('fs');var path=require(_0x6c56('0x6'));var rimraf=require(_0x6c56('0x7'));var config=require(_0x6c56('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x6c56('0x9')]=function(_0x1fe7c9,_0x5ea479){return _0x1fe7c9['define'](_0x6c56('0xa'),attributes,{'tableName':_0x6c56('0xb'),'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 a67c321..e9956e6 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 _0x221d=['DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','GetCmHopperBlack','update','body','UpdateCmHopperBlack'];(function(_0x3455da,_0x373a95){var _0x507759=function(_0x595153){while(--_0x595153){_0x3455da['push'](_0x3455da['shift']());}};_0x507759(++_0x373a95);}(_0x221d,0x158));var _0xd221=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x221d[_0x4ed1d4];return _0x28e363;};'use strict';var _=require(_0xd221('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd221('0x1'));var rs=require(_0xd221('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd221('0x3'))['db'];var utils=require(_0xd221('0x4'));var logger=require(_0xd221('0x5'))(_0xd221('0x6'));var config=require(_0xd221('0x7'));var jayson=require(_0xd221('0x8'));var client=jayson[_0xd221('0x9')][_0xd221('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58a307,_0x2bc878,_0x3bf5ef){return new BPromise(function(_0x25577d,_0x3b65b4){return client['request'](_0x58a307,_0x3bf5ef)[_0xd221('0xb')](function(_0x2458fd){logger[_0xd221('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x2bc878,_0xd221('0xd'));logger[_0xd221('0xe')](_0xd221('0xf'),_0x2bc878,'request\x20sent',JSON[_0xd221('0x10')](_0x2458fd));if(_0x2458fd[_0xd221('0x11')]){if(_0x2458fd[_0xd221('0x11')][_0xd221('0x12')]===0x1f4){logger[_0xd221('0x11')](_0xd221('0x13'),_0x2bc878,_0x2458fd[_0xd221('0x11')]['message']);return _0x3b65b4(_0x2458fd[_0xd221('0x11')][_0xd221('0x14')]);}logger['error'](_0xd221('0x13'),_0x2bc878,_0x2458fd[_0xd221('0x11')][_0xd221('0x14')]);return _0x25577d(_0x2458fd[_0xd221('0x11')][_0xd221('0x14')]);}else{logger[_0xd221('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x2bc878,_0xd221('0xd'));_0x25577d(_0x2458fd['result'][_0xd221('0x14')]);}})[_0xd221('0x15')](function(_0x44fd5e){logger[_0xd221('0x11')](_0xd221('0x13'),_0x2bc878,_0x44fd5e);_0x3b65b4(_0x44fd5e);});});}exports['GetCmHopperBlack']=function(_0x30239d){var _0xf456c5=this;return new Promise(function(_0x30eed0,_0x45836f){return db[_0xd221('0x16')][_0xd221('0x17')]({'raw':_0x30239d[_0xd221('0x18')]?_0x30239d[_0xd221('0x18')][_0xd221('0x19')]===undefined?!![]:![]:!![],'where':_0x30239d[_0xd221('0x18')]?_0x30239d['options'][_0xd221('0x1a')]||null:null,'attributes':_0x30239d[_0xd221('0x18')]?_0x30239d[_0xd221('0x18')][_0xd221('0x1b')]||null:null,'limit':_0x30239d['options']?_0x30239d[_0xd221('0x18')][_0xd221('0x1c')]||null:null,'include':_0x30239d[_0xd221('0x18')]?_0x30239d[_0xd221('0x18')][_0xd221('0x1d')]?_['map'](_0x30239d[_0xd221('0x18')]['include'],function(_0x3104ff){return{'model':db[_0x3104ff[_0xd221('0x1e')]],'as':_0x3104ff['as'],'attributes':_0x3104ff[_0xd221('0x1b')],'include':_0x3104ff[_0xd221('0x1d')]?_[_0xd221('0x1f')](_0x3104ff[_0xd221('0x1d')],function(_0x18262f){return{'model':db[_0x18262f['model']],'as':_0x18262f['as'],'attributes':_0x18262f[_0xd221('0x1b')],'include':_0x18262f[_0xd221('0x1d')]?_[_0xd221('0x1f')](_0x18262f['include'],function(_0x18db41){return{'model':db[_0x18db41[_0xd221('0x1e')]],'as':_0x18db41['as'],'attributes':_0x18db41[_0xd221('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd221('0xb')](function(_0x4ca2e3){logger[_0xd221('0xc')](_0xd221('0x20'),_0x30239d);logger[_0xd221('0xe')]('GetCmHopperBlack',_0x30239d,JSON[_0xd221('0x10')](_0x4ca2e3));_0x30eed0(_0x4ca2e3);})['catch'](function(_0x55f6ce){logger[_0xd221('0x11')](_0xd221('0x20'),_0x55f6ce[_0xd221('0x14')],_0x30239d);_0x45836f(_0xf456c5['error'](0x1f4,_0x55f6ce[_0xd221('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x48b20d){var _0x41fe33=this;return new Promise(function(_0x3cffff,_0x3acc24){return db['CmHopperBlack'][_0xd221('0x21')](_0x48b20d[_0xd221('0x22')],{'raw':_0x48b20d[_0xd221('0x18')]?_0x48b20d[_0xd221('0x18')][_0xd221('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b20d[_0xd221('0x18')]?_0x48b20d['options'][_0xd221('0x1a')]||null:null,'attributes':_0x48b20d[_0xd221('0x18')]?_0x48b20d[_0xd221('0x18')][_0xd221('0x1b')]||null:null,'limit':_0x48b20d['options']?_0x48b20d[_0xd221('0x18')][_0xd221('0x1c')]||null:null})['then'](function(_0x442b77){logger[_0xd221('0xc')](_0xd221('0x23'),_0x48b20d);logger[_0xd221('0xe')](_0xd221('0x23'),_0x48b20d,JSON[_0xd221('0x10')](_0x442b77));_0x3cffff(_0x442b77);})['catch'](function(_0x2f15ad){logger['error'](_0xd221('0x23'),_0x2f15ad['message'],_0x48b20d);_0x3acc24(_0x41fe33[_0xd221('0x11')](0x1f4,_0x2f15ad[_0xd221('0x14')]));});});};exports[_0xd221('0x24')]=function(_0x26725c){var _0x453bda=this;return new Promise(function(_0x12f65e,_0x1ac5d9){return db['CmHopperBlack'][_0xd221('0x25')]({'where':_0x26725c['options']?_0x26725c[_0xd221('0x18')][_0xd221('0x1a')]||null:null})[_0xd221('0xb')](function(_0xc12426){logger[_0xd221('0xc')]('DestroyCmHopperBlack',_0x26725c);logger[_0xd221('0xe')](_0xd221('0x24'),_0x26725c,JSON['stringify'](_0xc12426));_0x12f65e(_0xc12426);})[_0xd221('0x15')](function(_0xa98c55){logger[_0xd221('0x11')](_0xd221('0x24'),_0xa98c55[_0xd221('0x14')],_0x26725c);_0x1ac5d9(_0x453bda['error'](0x1f4,_0xa98c55[_0xd221('0x14')]));});});}; \ No newline at end of file +var _0x3310=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','raw','options','where','attributes','limit','include','map','model','info','debug','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x3310,0xa3));var _0x0331=function(_0x2c9aec,_0x51171b){_0x2c9aec=_0x2c9aec-0x0;var _0x13c1bd=_0x3310[_0x2c9aec];return _0x13c1bd;};'use strict';var _=require(_0x0331('0x0'));var util=require(_0x0331('0x1'));var moment=require(_0x0331('0x2'));var BPromise=require(_0x0331('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0331('0x4'));var db=require(_0x0331('0x5'))['db'];var utils=require(_0x0331('0x6'));var logger=require(_0x0331('0x7'))(_0x0331('0x8'));var config=require(_0x0331('0x9'));var jayson=require(_0x0331('0xa'));var client=jayson[_0x0331('0xb')][_0x0331('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3543f6,_0x52dda6,_0x405fb4){return new BPromise(function(_0x55c635,_0x8a711b){return client[_0x0331('0xd')](_0x3543f6,_0x405fb4)[_0x0331('0xe')](function(_0x3caeef){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x52dda6,_0x0331('0xf'));logger['debug'](_0x0331('0x10'),_0x52dda6,_0x0331('0xf'),JSON[_0x0331('0x11')](_0x3caeef));if(_0x3caeef[_0x0331('0x12')]){if(_0x3caeef[_0x0331('0x12')]['code']===0x1f4){logger[_0x0331('0x12')](_0x0331('0x13'),_0x52dda6,_0x3caeef[_0x0331('0x12')][_0x0331('0x14')]);return _0x8a711b(_0x3caeef[_0x0331('0x12')][_0x0331('0x14')]);}logger[_0x0331('0x12')](_0x0331('0x13'),_0x52dda6,_0x3caeef[_0x0331('0x12')][_0x0331('0x14')]);return _0x55c635(_0x3caeef['error']['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x52dda6,_0x0331('0xf'));_0x55c635(_0x3caeef[_0x0331('0x15')][_0x0331('0x14')]);}})[_0x0331('0x16')](function(_0x44ec8a){logger[_0x0331('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x52dda6,_0x44ec8a);_0x8a711b(_0x44ec8a);});});}exports[_0x0331('0x17')]=function(_0x2ef3cb){var _0x61f42a=this;return new Promise(function(_0x182042,_0x1b6671){return db['CmHopperBlack'][_0x0331('0x18')]({'raw':_0x2ef3cb['options']?_0x2ef3cb['options'][_0x0331('0x19')]===undefined?!![]:![]:!![],'where':_0x2ef3cb[_0x0331('0x1a')]?_0x2ef3cb['options'][_0x0331('0x1b')]||null:null,'attributes':_0x2ef3cb[_0x0331('0x1a')]?_0x2ef3cb[_0x0331('0x1a')][_0x0331('0x1c')]||null:null,'limit':_0x2ef3cb[_0x0331('0x1a')]?_0x2ef3cb[_0x0331('0x1a')][_0x0331('0x1d')]||null:null,'include':_0x2ef3cb[_0x0331('0x1a')]?_0x2ef3cb[_0x0331('0x1a')][_0x0331('0x1e')]?_[_0x0331('0x1f')](_0x2ef3cb[_0x0331('0x1a')]['include'],function(_0x51ad39){return{'model':db[_0x51ad39[_0x0331('0x20')]],'as':_0x51ad39['as'],'attributes':_0x51ad39[_0x0331('0x1c')],'include':_0x51ad39['include']?_[_0x0331('0x1f')](_0x51ad39[_0x0331('0x1e')],function(_0x57d147){return{'model':db[_0x57d147[_0x0331('0x20')]],'as':_0x57d147['as'],'attributes':_0x57d147[_0x0331('0x1c')],'include':_0x57d147[_0x0331('0x1e')]?_[_0x0331('0x1f')](_0x57d147['include'],function(_0x368061){return{'model':db[_0x368061[_0x0331('0x20')]],'as':_0x368061['as'],'attributes':_0x368061[_0x0331('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x540116){logger[_0x0331('0x21')](_0x0331('0x17'),_0x2ef3cb);logger[_0x0331('0x22')](_0x0331('0x17'),_0x2ef3cb,JSON[_0x0331('0x11')](_0x540116));_0x182042(_0x540116);})[_0x0331('0x16')](function(_0x50dff6){logger[_0x0331('0x12')](_0x0331('0x17'),_0x50dff6[_0x0331('0x14')],_0x2ef3cb);_0x1b6671(_0x61f42a['error'](0x1f4,_0x50dff6['message']));});});};exports[_0x0331('0x23')]=function(_0x3c33c6){var _0x24c250=this;return new Promise(function(_0x4cca72,_0x11defe){return db[_0x0331('0x24')][_0x0331('0x25')](_0x3c33c6[_0x0331('0x26')],{'raw':_0x3c33c6[_0x0331('0x1a')]?_0x3c33c6[_0x0331('0x1a')][_0x0331('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c33c6['options']?_0x3c33c6['options'][_0x0331('0x1b')]||null:null,'attributes':_0x3c33c6[_0x0331('0x1a')]?_0x3c33c6[_0x0331('0x1a')][_0x0331('0x1c')]||null:null,'limit':_0x3c33c6[_0x0331('0x1a')]?_0x3c33c6[_0x0331('0x1a')][_0x0331('0x1d')]||null:null})[_0x0331('0xe')](function(_0x3c2ba4){logger[_0x0331('0x21')](_0x0331('0x23'),_0x3c33c6);logger['debug'](_0x0331('0x23'),_0x3c33c6,JSON[_0x0331('0x11')](_0x3c2ba4));_0x4cca72(_0x3c2ba4);})[_0x0331('0x16')](function(_0x3afc9d){logger[_0x0331('0x12')](_0x0331('0x23'),_0x3afc9d[_0x0331('0x14')],_0x3c33c6);_0x11defe(_0x24c250['error'](0x1f4,_0x3afc9d[_0x0331('0x14')]));});});};exports[_0x0331('0x27')]=function(_0x5f555b){var _0x21699f=this;return new Promise(function(_0x7126ba,_0x111cec){return db[_0x0331('0x24')][_0x0331('0x28')]({'where':_0x5f555b[_0x0331('0x1a')]?_0x5f555b[_0x0331('0x1a')][_0x0331('0x1b')]||null:null})[_0x0331('0xe')](function(_0x401e0d){logger['info'](_0x0331('0x27'),_0x5f555b);logger[_0x0331('0x22')](_0x0331('0x27'),_0x5f555b,JSON['stringify'](_0x401e0d));_0x7126ba(_0x401e0d);})['catch'](function(_0x2b1f82){logger[_0x0331('0x12')](_0x0331('0x27'),_0x2b1f82[_0x0331('0x14')],_0x5f555b);_0x111cec(_0x21699f[_0x0331('0x12')](0x1f4,_0x2b1f82[_0x0331('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3b3c52c..36faf96 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 _0x3d04=['show','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id'];(function(_0x225460,_0x19f96d){var _0x14d050=function(_0x1e8609){while(--_0x1e8609){_0x225460['push'](_0x225460['shift']());}};_0x14d050(++_0x19f96d);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['put']('/:id',auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xf')]);module[_0x43d0('0x10')]=router; \ No newline at end of file +var _0x53ec=['../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router'];(function(_0x3b6eb9,_0x409248){var _0x2d48a4=function(_0x5c5fb8){while(--_0x5c5fb8){_0x3b6eb9['push'](_0x3b6eb9['shift']());}};_0x2d48a4(++_0x409248);}(_0x53ec,0x192));var _0xc53e=function(_0x585723,_0x25250e){_0x585723=_0x585723-0x0;var _0x54edcf=_0x53ec[_0x585723];return _0x54edcf;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller['destroy']);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 86e24a2..264bd8a 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 _0x8f6f=['diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','followuptime'];(function(_0x310861,_0x45c9ba){var _0xa1598e=function(_0x53ce2b){while(--_0x53ce2b){_0x310861['push'](_0x310861['shift']());}};_0xa1598e(++_0x45c9ba);}(_0x8f6f,0x1c7));var _0xf8f6=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x8f6f[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf8f6('0x0'));module[_0xf8f6('0x1')]={'state':{'type':Sequelize[_0xf8f6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf8f6('0x3')]},'scheduledat':{'type':Sequelize[_0xf8f6('0x4')]},'countbusyretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf8f6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf8f6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf8f6('0x3')]},'starttime':{'type':Sequelize[_0xf8f6('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf8f6('0x4')]},'droptime':{'type':Sequelize[_0xf8f6('0x4')]},'endtime':{'type':Sequelize[_0xf8f6('0x4')]},'ringtime':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf8f6('0x3')]},'campaign':{'type':Sequelize[_0xf8f6('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf8f6('0x3')]},'reason':{'type':Sequelize[_0xf8f6('0x3')]},'disposition':{'type':Sequelize[_0xf8f6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xf8f6('0x4')],'set':function(_0x3a5d4e){var _0x32b3a7=this[_0xf8f6('0x5')]('endtime');if(_0x32b3a7&&_0x3a5d4e){this['setDataValue'](_0xf8f6('0x6'),moment(_0x3a5d4e)[_0xf8f6('0x7')](moment(_0x32b3a7),_0xf8f6('0x8')));}return this['setDataValue'](_0xf8f6('0x9'),_0x3a5d4e);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf8f6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf8f6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf8f6('0x4')]},'callback':{'type':Sequelize[_0xf8f6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8f6('0x4')]},'deleted':{'type':Sequelize[_0xf8f6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf8f6('0x4')]},'recallme':{'type':Sequelize[_0xf8f6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8f6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc530=['dispositionat','BOOLEAN','sequelize','moment','STRING','DATE','INTEGER','endtime','setDataValue','followuptime','diff'];(function(_0x22f6a7,_0x1e5ec2){var _0x24c3a4=function(_0x5e23a6){while(--_0x5e23a6){_0x22f6a7['push'](_0x22f6a7['shift']());}};_0x24c3a4(++_0x1e5ec2);}(_0xc530,0x157));var _0x0c53=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc530[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x0c53('0x0'));var moment=require(_0x0c53('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0c53('0x2')]},'scheduledat':{'type':Sequelize[_0x0c53('0x3')]},'countbusyretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0c53('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0c53('0x2')]},'calleridname':{'type':Sequelize[_0x0c53('0x2')]},'starttime':{'type':Sequelize[_0x0c53('0x3')]},'responsetime':{'type':Sequelize[_0x0c53('0x3')]},'answertime':{'type':Sequelize[_0x0c53('0x3')]},'droptime':{'type':Sequelize[_0x0c53('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0c53('0x2')]},'campaigntype':{'type':Sequelize[_0x0c53('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x0c53('0x2')]},'disposition':{'type':Sequelize[_0x0c53('0x2')]},'secondDisposition':{'type':Sequelize[_0x0c53('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x0c53('0x3')],'set':function(_0x462414){var _0x3b876a=this['getDataValue'](_0x0c53('0x5'));if(_0x3b876a&&_0x462414){this[_0x0c53('0x6')](_0x0c53('0x7'),moment(_0x462414)[_0x0c53('0x8')](moment(_0x3b876a),'seconds'));}return this['setDataValue'](_0x0c53('0x9'),_0x462414);}},'amd':{'type':Sequelize[_0x0c53('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0c53('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0c53('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0c53('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0c53('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0c53('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0c53('0x3')]},'deleted':{'type':Sequelize[_0x0c53('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0c53('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0c53('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c53('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c53('0x4')],'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 bf02ee0..38ab571 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 _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0xf18452,_0x1df28e){var _0x2d87c2=function(_0x261467){while(--_0x261467){_0xf18452['push'](_0xf18452['shift']());}};_0x2d87c2(++_0x1df28e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file +var _0x2a07=['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','name','send','index','map','CmHopperFinal','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','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4db45a,_0x4724a1){var _0x50b7d1=function(_0x323d8d){while(--_0x323d8d){_0x4db45a['push'](_0x4db45a['shift']());}};_0x50b7d1(++_0x4724a1);}(_0x2a07,0x74));var _0x72a0=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0x2a07[_0x1ff804];return _0x3454b8;};'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['CmHopperFinal'][_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')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5c216f6..c20c004 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 _0x5a67=['moment','request-promise','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0x5a67,0x75));var _0x75a6=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x5a67[_0x3f1710];return _0x528458;};'use strict';var _=require('lodash');var util=require(_0x75a6('0x0'));var logger=require(_0x75a6('0x1'))(_0x75a6('0x2'));var moment=require(_0x75a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x75a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75a6('0x5'));var config=require('../../config/environment');var attributes=require(_0x75a6('0x6'));module[_0x75a6('0x7')]=function(_0x563bf6,_0x50fbe3){return _0x563bf6['define'](_0x75a6('0x8'),attributes,{'tableName':_0x75a6('0x9'),'paranoid':![],'indexes':[{'name':_0x75a6('0xa'),'fields':[_0x75a6('0xa')]},{'name':_0x75a6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff96=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xff96,0x9c));var _0x6ff9=function(_0x3382e5,_0x4bfaa8){_0x3382e5=_0x3382e5-0x0;var _0x5efe1a=_0xff96[_0x3382e5];return _0x5efe1a;};'use strict';var _=require('lodash');var util=require(_0x6ff9('0x0'));var logger=require(_0x6ff9('0x1'))(_0x6ff9('0x2'));var moment=require(_0x6ff9('0x3'));var BPromise=require(_0x6ff9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ff9('0x5'));var rimraf=require(_0x6ff9('0x6'));var config=require(_0x6ff9('0x7'));var attributes=require(_0x6ff9('0x8'));module[_0x6ff9('0x9')]=function(_0x5aa59e,_0x4a702b){return _0x5aa59e[_0x6ff9('0xa')](_0x6ff9('0xb'),attributes,{'tableName':_0x6ff9('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x6ff9('0xd')]},{'name':_0x6ff9('0xe'),'fields':[_0x6ff9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 9e03c8e..48060aa 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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5810a1,_0x164ea7){var _0x50fdb5=function(_0x12b250){while(--_0x12b250){_0x5810a1['push'](_0x5810a1['shift']());}};_0x50fdb5(++_0x164ea7);}(_0xb10b,0x12a));var _0xbb10=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0xb10b[_0x2980de];return _0x81a4ca;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xeea1cf,_0x24ffe6){var _0x5dd395=function(_0x3cf5a1){while(--_0x3cf5a1){_0xeea1cf['push'](_0xeea1cf['shift']());}};_0x5dd395(++_0x24ffe6);}(_0xb10b,0x12a));var _0xbb10=function(_0x440fde,_0x445ce0){_0x440fde=_0x440fde-0x0;var _0x11052c=_0xb10b[_0x440fde];return _0x11052c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0c1986c..ee26a68 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 _0x8b6c=['put','update','multer','util','connect-timeout','express','Router','fs-extra','./cmHopperFinal.controller','get','/describe','isAuthenticated','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x53ddbb,_0x1b76b9){var _0x32ab79=function(_0x2e74fb){while(--_0x2e74fb){_0x53ddbb['push'](_0x53ddbb['shift']());}};_0x32ab79(++_0x1b76b9);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0xda2346,_0x186fd9){_0xda2346=_0xda2346-0x0;var _0x19e292=_0x8b6c[_0xda2346];return _0x19e292;};'use strict';var multer=require(_0xc8b6('0x0'));var util=require(_0xc8b6('0x1'));var path=require('path');var timeout=require(_0xc8b6('0x2'));var express=require(_0xc8b6('0x3'));var router=express[_0xc8b6('0x4')]();var fs_extra=require(_0xc8b6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc8b6('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc8b6('0x7')](_0xc8b6('0x8'),auth[_0xc8b6('0x9')](),controller['describe']);router['get'](_0xc8b6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc8b6('0x7')](_0xc8b6('0xb'),auth[_0xc8b6('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xc8b6('0x7')](_0xc8b6('0xc'),auth[_0xc8b6('0x9')](),controller[_0xc8b6('0xd')]);router[_0xc8b6('0xe')](_0xc8b6('0xf'),auth[_0xc8b6('0x9')](),controller[_0xc8b6('0x10')]);router[_0xc8b6('0xe')](_0xc8b6('0x11'),auth[_0xc8b6('0x9')](),controller[_0xc8b6('0x12')]);router[_0xc8b6('0xe')](_0xc8b6('0x13'),auth[_0xc8b6('0x9')](),controller[_0xc8b6('0x14')]);router[_0xc8b6('0x15')](_0xc8b6('0xa'),auth[_0xc8b6('0x9')](),controller[_0xc8b6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x07e1=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','checkContactHopper','multer','path'];(function(_0x27bfe0,_0x437ba7){var _0x5dd160=function(_0x229d42){while(--_0x229d42){_0x27bfe0['push'](_0x27bfe0['shift']());}};_0x5dd160(++_0x437ba7);}(_0x07e1,0x18a));var _0x107e=function(_0x5dbcef,_0x5efec6){_0x5dbcef=_0x5dbcef-0x0;var _0x5690b9=_0x07e1[_0x5dbcef];return _0x5690b9;};'use strict';var multer=require(_0x107e('0x0'));var util=require('util');var path=require(_0x107e('0x1'));var timeout=require(_0x107e('0x2'));var express=require(_0x107e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x107e('0x4'));var interaction=require(_0x107e('0x5'));var config=require(_0x107e('0x6'));var controller=require(_0x107e('0x7'));router['get']('/',auth[_0x107e('0x8')](),controller[_0x107e('0x9')]);router[_0x107e('0xa')](_0x107e('0xb'),auth[_0x107e('0x8')](),controller[_0x107e('0xc')]);router[_0x107e('0xa')](_0x107e('0xd'),auth[_0x107e('0x8')](),controller[_0x107e('0xe')]);router['get'](_0x107e('0xf'),auth[_0x107e('0x8')](),controller[_0x107e('0x10')]);router[_0x107e('0xa')](_0x107e('0x11'),auth[_0x107e('0x8')](),controller[_0x107e('0x12')]);router[_0x107e('0x13')](_0x107e('0x14'),auth[_0x107e('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x107e('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x107e('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x107e('0x13')]('/checkContactHopper',auth[_0x107e('0x8')](),controller[_0x107e('0x15')]);router['put'](_0x107e('0xd'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 20063de..0367d89 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 _0xeb82=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x551171,_0x3a8777){var _0x5bb909=function(_0x387a1f){while(--_0x387a1f){_0x551171['push'](_0x551171['shift']());}};_0x5bb909(++_0x3a8777);}(_0xeb82,0xdb));var _0x2eb8=function(_0x5f4e0e,_0x41f8cd){_0x5f4e0e=_0x5f4e0e-0x0;var _0x3c3355=_0xeb82[_0x5f4e0e];return _0x3c3355;};'use strict';var Sequelize=require(_0x2eb8('0x0'));module[_0x2eb8('0x1')]={'state':{'type':Sequelize[_0x2eb8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2eb8('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2eb8('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2eb8('0x4')]},'responsetime':{'type':Sequelize[_0x2eb8('0x4')]},'answertime':{'type':Sequelize[_0x2eb8('0x4')]},'droptime':{'type':Sequelize[_0x2eb8('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2eb8('0x3')]},'campaign':{'type':Sequelize[_0x2eb8('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2eb8('0x3')]},'reason':{'type':Sequelize[_0x2eb8('0x3')]},'amd':{'type':Sequelize[_0x2eb8('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2eb8('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2eb8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2eb8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2eb8('0x4')]},'recallme':{'type':Sequelize[_0x2eb8('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2eb8('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2eb8('0x3')]}}; \ No newline at end of file +var _0xde76=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x494e4b,_0x57ea49){var _0x4a86c8=function(_0x8a75e){while(--_0x8a75e){_0x494e4b['push'](_0x494e4b['shift']());}};_0x4a86c8(++_0x57ea49);}(_0xde76,0xe9));var _0x6de7=function(_0x5cc96a,_0x5af128){_0x5cc96a=_0x5cc96a-0x0;var _0x4f3fde=_0xde76[_0x5cc96a];return _0x4f3fde;};'use strict';var Sequelize=require(_0x6de7('0x0'));module[_0x6de7('0x1')]={'state':{'type':Sequelize[_0x6de7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6de7('0x3')]},'scheduledat':{'type':Sequelize[_0x6de7('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6de7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6de7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6de7('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6de7('0x3')]},'calleridnum':{'type':Sequelize[_0x6de7('0x3')]},'calleridname':{'type':Sequelize[_0x6de7('0x3')]},'starttime':{'type':Sequelize[_0x6de7('0x4')]},'responsetime':{'type':Sequelize[_0x6de7('0x4')]},'answertime':{'type':Sequelize[_0x6de7('0x4')]},'droptime':{'type':Sequelize[_0x6de7('0x4')]},'endtime':{'type':Sequelize[_0x6de7('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6de7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6de7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6de7('0x3')]},'campaign':{'type':Sequelize[_0x6de7('0x3')]},'campaigntype':{'type':Sequelize[_0x6de7('0x3')]},'membername':{'type':Sequelize[_0x6de7('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x6de7('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6de7('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6de7('0x4')]},'recallme':{'type':Sequelize[_0x6de7('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6de7('0x4')]},'edited':{'type':Sequelize[_0x6de7('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6de7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6de7('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6de7('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 007c62b..9fcce17 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 _0xc9ff=['index','map','CmHopperHistory','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send'];(function(_0x3b20c2,_0x888661){var _0x5b4482=function(_0x15b274){while(--_0x15b274){_0x3b20c2['push'](_0x3b20c2['shift']());}};_0x5b4482(++_0x888661);}(_0xc9ff,0x109));var _0xfc9f=function(_0x28404a,_0x374343){_0x28404a=_0x28404a-0x0;var _0x4003f2=_0xc9ff[_0x28404a];return _0x4003f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc9f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc9f('0x1'));var rp=require(_0xfc9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfc9f('0x3'));var util=require('util');var path=require(_0xfc9f('0x4'));var sox=require(_0xfc9f('0x5'));var csv=require(_0xfc9f('0x6'));var ejs=require(_0xfc9f('0x7'));var fs=require('fs');var fs_extra=require(_0xfc9f('0x8'));var _=require(_0xfc9f('0x9'));var squel=require(_0xfc9f('0xa'));var crypto=require(_0xfc9f('0xb'));var jsforce=require(_0xfc9f('0xc'));var deskjs=require(_0xfc9f('0xd'));var toCsv=require(_0xfc9f('0x6'));var querystring=require(_0xfc9f('0xe'));var Papa=require(_0xfc9f('0xf'));var Redis=require(_0xfc9f('0x10'));var authService=require(_0xfc9f('0x11'));var qs=require(_0xfc9f('0x12'));var as=require(_0xfc9f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc9f('0x14'))(_0xfc9f('0x15'));var utils=require(_0xfc9f('0x16'));var config=require(_0xfc9f('0x17'));var licenseUtil=require(_0xfc9f('0x18'));var db=require(_0xfc9f('0x19'))['db'];function respondWithStatusCode(_0x13329a,_0x472eab){_0x472eab=_0x472eab||0xcc;return function(_0x321019){if(_0x321019){return _0x13329a[_0xfc9f('0x1a')](_0x472eab);}return _0x13329a[_0xfc9f('0x1b')](_0x472eab)['end']();};}function respondWithResult(_0x419b3c,_0x4f3c42){_0x4f3c42=_0x4f3c42||0xc8;return function(_0x8c17e8){if(_0x8c17e8){return _0x419b3c[_0xfc9f('0x1b')](_0x4f3c42)[_0xfc9f('0x1c')](_0x8c17e8);}};}function respondWithFilteredResult(_0x21489b,_0x2da5ef){return function(_0x7a7bf0){if(_0x7a7bf0){var _0x3582ca=typeof _0x2da5ef[_0xfc9f('0x1d')]===_0xfc9f('0x1e')&&typeof _0x2da5ef[_0xfc9f('0x1f')]==='undefined';var _0x44cdc1=_0x7a7bf0[_0xfc9f('0x20')];var _0x30a3a6=_0x3582ca?0x0:_0x2da5ef[_0xfc9f('0x1d')];var _0x5884fc=_0x3582ca?_0x7a7bf0[_0xfc9f('0x20')]:_0x2da5ef[_0xfc9f('0x1d')]+_0x2da5ef[_0xfc9f('0x1f')];var _0x3801ec;if(_0x5884fc>=_0x44cdc1){_0x5884fc=_0x44cdc1;_0x3801ec=0xc8;}else{_0x3801ec=0xce;}_0x21489b[_0xfc9f('0x1b')](_0x3801ec);return _0x21489b[_0xfc9f('0x21')](_0xfc9f('0x22'),_0x30a3a6+'-'+_0x5884fc+'/'+_0x44cdc1)[_0xfc9f('0x1c')](_0x7a7bf0);}return null;};}function patchUpdates(_0x1dfa00){return function(_0x53dca6){try{jsonpatch['apply'](_0x53dca6,_0x1dfa00,!![]);}catch(_0x309ad9){return BPromise[_0xfc9f('0x23')](_0x309ad9);}return _0x53dca6[_0xfc9f('0x24')]();};}function saveUpdates(_0xd4178,_0x1305d4){return function(_0x1c1aa1){if(_0x1c1aa1){return _0x1c1aa1[_0xfc9f('0x25')](_0xd4178)[_0xfc9f('0x26')](function(_0x3f21a0){return _0x3f21a0;});}return null;};}function removeEntity(_0x122116,_0x26048b){return function(_0x58dee2){if(_0x58dee2){return _0x58dee2[_0xfc9f('0x27')]()['then'](function(){_0x122116['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d81e1,_0x1d9ea2){return function(_0x20efac){if(!_0x20efac){_0x3d81e1[_0xfc9f('0x1a')](0x194);}return _0x20efac;};}function handleError(_0x401a89,_0x198bf9){_0x198bf9=_0x198bf9||0x1f4;return function(_0x3cf52d){logger['error'](_0x3cf52d[_0xfc9f('0x28')]);if(_0x3cf52d[_0xfc9f('0x29')]){delete _0x3cf52d['name'];}_0x401a89[_0xfc9f('0x1b')](_0x198bf9)[_0xfc9f('0x2a')](_0x3cf52d);};}exports[_0xfc9f('0x2b')]=function(_0x5478e5,_0x218192){var _0x240e98={},_0x15292b={},_0x264fdc={'count':0x0,'rows':[]};var _0x2614ca=_[_0xfc9f('0x2c')](db[_0xfc9f('0x2d')]['rawAttributes'],function(_0x21980b){return{'name':_0x21980b['fieldName'],'type':_0x21980b['type'][_0xfc9f('0x2e')]};});_0x15292b['model']=_[_0xfc9f('0x2c')](_0x2614ca,'name');_0x15292b[_0xfc9f('0x2f')]=_[_0xfc9f('0x30')](_0x5478e5[_0xfc9f('0x2f')]);_0x15292b[_0xfc9f('0x31')]=_['intersection'](_0x15292b[_0xfc9f('0x32')],_0x15292b[_0xfc9f('0x2f')]);_0x240e98['attributes']=_[_0xfc9f('0x33')](_0x15292b['model'],qs[_0xfc9f('0x34')](_0x5478e5[_0xfc9f('0x2f')][_0xfc9f('0x34')]));_0x240e98[_0xfc9f('0x35')]=_0x240e98[_0xfc9f('0x35')][_0xfc9f('0x36')]?_0x240e98['attributes']:_0x15292b[_0xfc9f('0x32')];if(!_0x5478e5[_0xfc9f('0x2f')]['hasOwnProperty'](_0xfc9f('0x37'))){_0x240e98[_0xfc9f('0x1f')]=qs[_0xfc9f('0x1f')](_0x5478e5[_0xfc9f('0x2f')][_0xfc9f('0x1f')]);_0x240e98[_0xfc9f('0x1d')]=qs[_0xfc9f('0x1d')](_0x5478e5[_0xfc9f('0x2f')][_0xfc9f('0x1d')]);}_0x240e98[_0xfc9f('0x38')]=qs[_0xfc9f('0x39')](_0x5478e5[_0xfc9f('0x2f')][_0xfc9f('0x39')]);_0x240e98['where']=qs['filters'](_[_0xfc9f('0x3a')](_0x5478e5[_0xfc9f('0x2f')],_0x15292b[_0xfc9f('0x31')]),_0x2614ca);if(_0x5478e5[_0xfc9f('0x2f')][_0xfc9f('0x3b')]){_0x240e98[_0xfc9f('0x3c')]=_['merge'](_0x240e98[_0xfc9f('0x3c')],{'$or':_[_0xfc9f('0x2c')](_0x2614ca,function(_0x3121d5){if(_0x3121d5['type']!==_0xfc9f('0x3d')){var _0x4867e3={};_0x4867e3[_0x3121d5[_0xfc9f('0x29')]]={'$like':'%'+_0x5478e5['query'][_0xfc9f('0x3b')]+'%'};return _0x4867e3;}})});}_0x240e98=_[_0xfc9f('0x3e')]({},_0x240e98,_0x5478e5[_0xfc9f('0x3f')]);var _0x4eac64={'where':_0x240e98[_0xfc9f('0x3c')]};return db[_0xfc9f('0x2d')]['count'](_0x4eac64)[_0xfc9f('0x26')](function(_0x2be2a5){_0x264fdc[_0xfc9f('0x20')]=_0x2be2a5;if(_0x5478e5[_0xfc9f('0x2f')]['includeAll']){_0x240e98[_0xfc9f('0x40')]=[{'all':!![]}];}return db[_0xfc9f('0x2d')][_0xfc9f('0x41')](_0x240e98);})['then'](function(_0x26c822){_0x264fdc[_0xfc9f('0x42')]=_0x26c822;return _0x264fdc;})['then'](respondWithFilteredResult(_0x218192,_0x240e98))[_0xfc9f('0x43')](handleError(_0x218192,null));};exports[_0xfc9f('0x44')]=function(_0x59e7b0,_0x6bcfc1){var _0x5bac17={'raw':!![],'where':{'id':_0x59e7b0[_0xfc9f('0x45')]['id']}},_0x339039={};_0x339039['model']=_[_0xfc9f('0x30')](db['CmHopperHistory'][_0xfc9f('0x46')]);_0x339039[_0xfc9f('0x2f')]=_[_0xfc9f('0x30')](_0x59e7b0[_0xfc9f('0x2f')]);_0x339039[_0xfc9f('0x31')]=_[_0xfc9f('0x33')](_0x339039[_0xfc9f('0x32')],_0x339039[_0xfc9f('0x2f')]);_0x5bac17[_0xfc9f('0x35')]=_[_0xfc9f('0x33')](_0x339039['model'],qs['fields'](_0x59e7b0[_0xfc9f('0x2f')][_0xfc9f('0x34')]));_0x5bac17[_0xfc9f('0x35')]=_0x5bac17[_0xfc9f('0x35')]['length']?_0x5bac17['attributes']:_0x339039[_0xfc9f('0x32')];if(_0x59e7b0['query'][_0xfc9f('0x47')]){_0x5bac17['include']=[{'all':!![]}];}_0x5bac17=_[_0xfc9f('0x3e')]({},_0x5bac17,_0x59e7b0['options']);return db[_0xfc9f('0x2d')][_0xfc9f('0x48')](_0x5bac17)['then'](handleEntityNotFound(_0x6bcfc1,null))[_0xfc9f('0x26')](respondWithResult(_0x6bcfc1,null))[_0xfc9f('0x43')](handleError(_0x6bcfc1,null));};exports['create']=function(_0x40bdee,_0x2d154a){return db[_0xfc9f('0x2d')][_0xfc9f('0x49')](_0x40bdee[_0xfc9f('0x4a')],{})[_0xfc9f('0x26')](respondWithResult(_0x2d154a,0xc9))['catch'](handleError(_0x2d154a,null));};exports[_0xfc9f('0x4b')]=function(_0x3f7be3,_0x194ae4){return db[_0xfc9f('0x2d')][_0xfc9f('0x4b')]()[_0xfc9f('0x26')](respondWithResult(_0x194ae4,null))['catch'](handleError(_0x194ae4,null));};exports[_0xfc9f('0x25')]=function(_0x3774be,_0x17f19a){if(_0x3774be[_0xfc9f('0x4a')][_0xfc9f('0x4c')]){delete _0x3774be[_0xfc9f('0x4a')][_0xfc9f('0x4c')];}return db[_0xfc9f('0x2d')][_0xfc9f('0x48')]({'where':{'uniqueid':_0x3774be[_0xfc9f('0x45')]['id']}})[_0xfc9f('0x26')](handleEntityNotFound(_0x17f19a,null))[_0xfc9f('0x26')](saveUpdates(_0x3774be[_0xfc9f('0x4a')],null))[_0xfc9f('0x26')](respondWithResult(_0x17f19a,null))['catch'](handleError(_0x17f19a,null));}; \ No newline at end of file +var _0x2af1=['include','find','catch','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','findAll','show','keys','includeAll'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x2af1,0xe0));var _0x12af=function(_0x5d7719,_0x52350d){_0x5d7719=_0x5d7719-0x0;var _0x38407a=_0x2af1[_0x5d7719];return _0x38407a;};'use strict';var emlformat=require(_0x12af('0x0'));var rimraf=require(_0x12af('0x1'));var zipdir=require(_0x12af('0x2'));var jsonpatch=require(_0x12af('0x3'));var rp=require(_0x12af('0x4'));var moment=require(_0x12af('0x5'));var BPromise=require(_0x12af('0x6'));var Mustache=require('mustache');var util=require(_0x12af('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x12af('0x8'));var ejs=require(_0x12af('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x12af('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x12af('0xb'));var toCsv=require(_0x12af('0x8'));var querystring=require(_0x12af('0xc'));var Papa=require('papaparse');var Redis=require(_0x12af('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x12af('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12af('0xf'));var logger=require(_0x12af('0x10'))(_0x12af('0x11'));var utils=require(_0x12af('0x12'));var config=require(_0x12af('0x13'));var licenseUtil=require(_0x12af('0x14'));var db=require(_0x12af('0x15'))['db'];function respondWithStatusCode(_0x2867f7,_0x59d671){_0x59d671=_0x59d671||0xcc;return function(_0x319546){if(_0x319546){return _0x2867f7[_0x12af('0x16')](_0x59d671);}return _0x2867f7[_0x12af('0x17')](_0x59d671)[_0x12af('0x18')]();};}function respondWithResult(_0x57698c,_0x429d44){_0x429d44=_0x429d44||0xc8;return function(_0x390f9e){if(_0x390f9e){return _0x57698c[_0x12af('0x17')](_0x429d44)[_0x12af('0x19')](_0x390f9e);}};}function respondWithFilteredResult(_0x578f7f,_0x3dcdc4){return function(_0x264dae){if(_0x264dae){var _0x5052cc=typeof _0x3dcdc4[_0x12af('0x1a')]==='undefined'&&typeof _0x3dcdc4['limit']===_0x12af('0x1b');var _0x412283=_0x264dae[_0x12af('0x1c')];var _0x3ff67a=_0x5052cc?0x0:_0x3dcdc4[_0x12af('0x1a')];var _0x15421f=_0x5052cc?_0x264dae[_0x12af('0x1c')]:_0x3dcdc4[_0x12af('0x1a')]+_0x3dcdc4['limit'];var _0x9249f7;if(_0x15421f>=_0x412283){_0x15421f=_0x412283;_0x9249f7=0xc8;}else{_0x9249f7=0xce;}_0x578f7f[_0x12af('0x17')](_0x9249f7);return _0x578f7f[_0x12af('0x1d')](_0x12af('0x1e'),_0x3ff67a+'-'+_0x15421f+'/'+_0x412283)[_0x12af('0x19')](_0x264dae);}return null;};}function patchUpdates(_0x2d18a5){return function(_0xad82dd){try{jsonpatch[_0x12af('0x1f')](_0xad82dd,_0x2d18a5,!![]);}catch(_0x235c02){return BPromise[_0x12af('0x20')](_0x235c02);}return _0xad82dd[_0x12af('0x21')]();};}function saveUpdates(_0x4dc9be,_0x3db6b9){return function(_0x2d1f67){if(_0x2d1f67){return _0x2d1f67[_0x12af('0x22')](_0x4dc9be)[_0x12af('0x23')](function(_0x1cb720){return _0x1cb720;});}return null;};}function removeEntity(_0x5c8526,_0x4633cb){return function(_0x45f247){if(_0x45f247){return _0x45f247[_0x12af('0x24')]()[_0x12af('0x23')](function(){_0x5c8526[_0x12af('0x17')](0xcc)[_0x12af('0x18')]();});}};}function handleEntityNotFound(_0x5d20c0,_0x3dc933){return function(_0x16c05b){if(!_0x16c05b){_0x5d20c0[_0x12af('0x16')](0x194);}return _0x16c05b;};}function handleError(_0x3fb83e,_0x5c904d){_0x5c904d=_0x5c904d||0x1f4;return function(_0x3d0af4){logger[_0x12af('0x25')](_0x3d0af4[_0x12af('0x26')]);if(_0x3d0af4[_0x12af('0x27')]){delete _0x3d0af4['name'];}_0x3fb83e[_0x12af('0x17')](_0x5c904d)[_0x12af('0x28')](_0x3d0af4);};}exports[_0x12af('0x29')]=function(_0x2b4607,_0x2ff364){var _0x85d213={},_0x562244={},_0x847040={'count':0x0,'rows':[]};var _0x234df5=_['map'](db[_0x12af('0x2a')][_0x12af('0x2b')],function(_0x785206){return{'name':_0x785206['fieldName'],'type':_0x785206[_0x12af('0x2c')][_0x12af('0x2d')]};});_0x562244[_0x12af('0x2e')]=_['map'](_0x234df5,'name');_0x562244[_0x12af('0x2f')]=_['keys'](_0x2b4607[_0x12af('0x2f')]);_0x562244[_0x12af('0x30')]=_[_0x12af('0x31')](_0x562244[_0x12af('0x2e')],_0x562244[_0x12af('0x2f')]);_0x85d213[_0x12af('0x32')]=_[_0x12af('0x31')](_0x562244[_0x12af('0x2e')],qs[_0x12af('0x33')](_0x2b4607['query'][_0x12af('0x33')]));_0x85d213['attributes']=_0x85d213[_0x12af('0x32')][_0x12af('0x34')]?_0x85d213['attributes']:_0x562244['model'];if(!_0x2b4607[_0x12af('0x2f')]['hasOwnProperty']('nolimit')){_0x85d213['limit']=qs[_0x12af('0x35')](_0x2b4607[_0x12af('0x2f')][_0x12af('0x35')]);_0x85d213['offset']=qs[_0x12af('0x1a')](_0x2b4607[_0x12af('0x2f')][_0x12af('0x1a')]);}_0x85d213['order']=qs[_0x12af('0x36')](_0x2b4607[_0x12af('0x2f')][_0x12af('0x36')]);_0x85d213[_0x12af('0x37')]=qs[_0x12af('0x30')](_[_0x12af('0x38')](_0x2b4607[_0x12af('0x2f')],_0x562244['filters']),_0x234df5);if(_0x2b4607[_0x12af('0x2f')][_0x12af('0x39')]){_0x85d213[_0x12af('0x37')]=_[_0x12af('0x3a')](_0x85d213[_0x12af('0x37')],{'$or':_['map'](_0x234df5,function(_0x5f44d0){if(_0x5f44d0[_0x12af('0x2c')]!==_0x12af('0x3b')){var _0x46d34d={};_0x46d34d[_0x5f44d0[_0x12af('0x27')]]={'$like':'%'+_0x2b4607[_0x12af('0x2f')]['filter']+'%'};return _0x46d34d;}})});}_0x85d213=_[_0x12af('0x3a')]({},_0x85d213,_0x2b4607['options']);var _0x2f746d={'where':_0x85d213['where']};return db[_0x12af('0x2a')][_0x12af('0x1c')](_0x2f746d)[_0x12af('0x23')](function(_0xd39321){_0x847040[_0x12af('0x1c')]=_0xd39321;if(_0x2b4607[_0x12af('0x2f')]['includeAll']){_0x85d213['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x12af('0x3c')](_0x85d213);})[_0x12af('0x23')](function(_0x5df360){_0x847040['rows']=_0x5df360;return _0x847040;})[_0x12af('0x23')](respondWithFilteredResult(_0x2ff364,_0x85d213))['catch'](handleError(_0x2ff364,null));};exports[_0x12af('0x3d')]=function(_0x4920d1,_0x377c50){var _0x4f63fa={'raw':!![],'where':{'id':_0x4920d1['params']['id']}},_0x38740e={};_0x38740e[_0x12af('0x2e')]=_[_0x12af('0x3e')](db[_0x12af('0x2a')][_0x12af('0x2b')]);_0x38740e['query']=_[_0x12af('0x3e')](_0x4920d1[_0x12af('0x2f')]);_0x38740e[_0x12af('0x30')]=_['intersection'](_0x38740e[_0x12af('0x2e')],_0x38740e[_0x12af('0x2f')]);_0x4f63fa[_0x12af('0x32')]=_['intersection'](_0x38740e[_0x12af('0x2e')],qs[_0x12af('0x33')](_0x4920d1['query']['fields']));_0x4f63fa['attributes']=_0x4f63fa[_0x12af('0x32')][_0x12af('0x34')]?_0x4f63fa['attributes']:_0x38740e['model'];if(_0x4920d1['query'][_0x12af('0x3f')]){_0x4f63fa[_0x12af('0x40')]=[{'all':!![]}];}_0x4f63fa=_[_0x12af('0x3a')]({},_0x4f63fa,_0x4920d1['options']);return db[_0x12af('0x2a')][_0x12af('0x41')](_0x4f63fa)[_0x12af('0x23')](handleEntityNotFound(_0x377c50,null))[_0x12af('0x23')](respondWithResult(_0x377c50,null))[_0x12af('0x42')](handleError(_0x377c50,null));};exports[_0x12af('0x43')]=function(_0x365bc5,_0x3829d3){return db[_0x12af('0x2a')]['create'](_0x365bc5[_0x12af('0x44')],{})[_0x12af('0x23')](respondWithResult(_0x3829d3,0xc9))[_0x12af('0x42')](handleError(_0x3829d3,null));};exports[_0x12af('0x45')]=function(_0x58e7fd,_0x15d5dd){return db[_0x12af('0x2a')][_0x12af('0x45')]()[_0x12af('0x23')](respondWithResult(_0x15d5dd,null))[_0x12af('0x42')](handleError(_0x15d5dd,null));};exports[_0x12af('0x22')]=function(_0x365c3e,_0x531a92){if(_0x365c3e[_0x12af('0x44')][_0x12af('0x46')]){delete _0x365c3e[_0x12af('0x44')][_0x12af('0x46')];}return db[_0x12af('0x2a')]['find']({'where':{'uniqueid':_0x365c3e[_0x12af('0x47')]['id']}})[_0x12af('0x23')](handleEntityNotFound(_0x531a92,null))[_0x12af('0x23')](saveUpdates(_0x365c3e['body'],null))[_0x12af('0x23')](respondWithResult(_0x531a92,null))[_0x12af('0x42')](handleError(_0x531a92,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index eb0d1e7..2d7a961 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 _0xfb0b=['define','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./cmHopperHistory.attributes','exports'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0xfb0b,0x94));var _0xbfb0=function(_0x630263,_0x4b417a){_0x630263=_0x630263-0x0;var _0x1fd6f2=_0xfb0b[_0x630263];return _0x1fd6f2;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x5'));var config=require('../../config/environment');var attributes=require(_0xbfb0('0x6'));module[_0xbfb0('0x7')]=function(_0x8c7fee,_0x35d657){return _0x8c7fee[_0xbfb0('0x8')](_0xbfb0('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xbfb0('0xa'),'fields':[_0xbfb0('0xa')]},{'name':_0xbfb0('0xb'),'fields':[_0xbfb0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x082a=['endtime','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_history'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x082a,0x154));var _0xa082=function(_0x56b7bf,_0x278652){_0x56b7bf=_0x56b7bf-0x0;var _0x5b2cc6=_0x082a[_0x56b7bf];return _0x5b2cc6;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var logger=require(_0xa082('0x1'))(_0xa082('0x2'));var moment=require('moment');var BPromise=require(_0xa082('0x3'));var rp=require(_0xa082('0x4'));var fs=require('fs');var path=require(_0xa082('0x5'));var rimraf=require(_0xa082('0x6'));var config=require(_0xa082('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xa082('0x8')]=function(_0x59b4a8,_0x1ada27){return _0x59b4a8[_0xa082('0x9')]('CmHopperHistory',attributes,{'tableName':_0xa082('0xa'),'paranoid':![],'indexes':[{'name':_0xa082('0xb'),'fields':[_0xa082('0xb')]},{'name':'uniqueid','fields':[_0xa082('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b54ea4b..840bb4a 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 _0xf2a6=['raw','AvgHandleTime','sequelize','col','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5312bc,_0x3435a0){_0x5312bc=_0x5312bc-0x0;var _0xe7e826=_0xf2a6[_0x5312bc];return _0xe7e826;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2a('0x2'))['db'];var utils=require(_0x6f2a('0x3'));var logger=require(_0x6f2a('0x4'))(_0x6f2a('0x5'));var config=require(_0x6f2a('0x6'));var jayson=require(_0x6f2a('0x7'));var client=jayson[_0x6f2a('0x8')][_0x6f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1efd8,_0x424ebd,_0x4b4fde){return new BPromise(function(_0x379b80,_0xda4179){return client[_0x6f2a('0xa')](_0x1efd8,_0x4b4fde)[_0x6f2a('0xb')](function(_0x5b1229){logger[_0x6f2a('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x424ebd,_0x6f2a('0xd'));logger[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x424ebd,'request\x20sent',JSON[_0x6f2a('0x10')](_0x5b1229));if(_0x5b1229['error']){if(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x12')]===0x1f4){logger[_0x6f2a('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0xda4179(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0x379b80(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}else{logger[_0x6f2a('0xc')](_0x6f2a('0x14'),_0x424ebd,_0x6f2a('0xd'));_0x379b80(_0x5b1229[_0x6f2a('0x15')][_0x6f2a('0x13')]);}})[_0x6f2a('0x16')](function(_0x2cf5de){logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x2cf5de);_0xda4179(_0x2cf5de);});});}exports[_0x6f2a('0x17')]=function(_0x5c408b){var _0x46b25d=this;return new Promise(function(_0x3171b9,_0x55d117){return db[_0x6f2a('0x18')][_0x6f2a('0x19')](_0x5c408b[_0x6f2a('0x1a')],{'raw':_0x5c408b[_0x6f2a('0x1b')]?_0x5c408b[_0x6f2a('0x1b')][_0x6f2a('0x1c')]===undefined?!![]:![]:!![]})[_0x6f2a('0xb')](function(_0x33554f){logger['info'](_0x6f2a('0x17'),_0x5c408b);logger[_0x6f2a('0xe')](_0x6f2a('0x17'),_0x5c408b,JSON[_0x6f2a('0x10')](_0x33554f));_0x3171b9(_0x33554f);})[_0x6f2a('0x16')](function(_0x108b8b){logger[_0x6f2a('0x11')]('CreateCmHopperHistory',_0x108b8b[_0x6f2a('0x13')],_0x5c408b);_0x55d117(_0x46b25d['error'](0x1f4,_0x108b8b[_0x6f2a('0x13')]));});});};exports[_0x6f2a('0x1d')]=function(_0x148240){var _0x524b69=this;return new Promise(function(_0x8af4e5,_0xb7cd00){return db['CmHopperHistory']['findAll']({'raw':_0x148240[_0x6f2a('0x1b')]?_0x148240[_0x6f2a('0x1b')][_0x6f2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x148240[_0x6f2a('0x1b')]?_0x148240[_0x6f2a('0x1b')]['where']||null:null,'attributes':[[db[_0x6f2a('0x1e')]['fn']('COUNT',db[_0x6f2a('0x1e')][_0x6f2a('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db['sequelize']['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x22')))),_0x6f2a('0x23')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x6f2a('0x24')],[db['sequelize']['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')]['literal'](_0x6f2a('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x26'),db['sequelize']['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x28')))),'predictiveIntervalAvgTalktime']]})[_0x6f2a('0xb')](function(_0x277e8f){logger[_0x6f2a('0xc')](_0x6f2a('0x1d'),_0x148240);logger['debug'](_0x6f2a('0x1d'),_0x148240,JSON['stringify'](_0x277e8f));_0x8af4e5(_0x277e8f);})[_0x6f2a('0x16')](function(_0x28281f){logger[_0x6f2a('0x11')](_0x6f2a('0x1d'),_0x28281f[_0x6f2a('0x13')],_0x148240);_0xb7cd00(_0x524b69[_0x6f2a('0x11')](0x1f4,_0x28281f[_0x6f2a('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x99c894){var _0x2ce7ee=this;return new Promise(function(_0x1e0595,_0x1945ad){return db[_0x6f2a('0x18')][_0x6f2a('0x29')]({'raw':_0x99c894[_0x6f2a('0x1b')]?_0x99c894[_0x6f2a('0x1b')][_0x6f2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x99c894[_0x6f2a('0x1b')]?_0x99c894[_0x6f2a('0x1b')]['where']||null:null,'attributes':[[_0x6f2a('0x2a'),_0x6f2a('0x2b')],[db[_0x6f2a('0x1e')]['fn']('COUNT',db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x2c')))),_0x6f2a('0x2d')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x22')))),_0x6f2a('0x2f')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x6f2a('0x30')],[db['sequelize']['fn']('COUNT',db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x31')))),'outboundCongestionCallsDay'],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x32')))),'outboundDropCallsDayTimeout'],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x33')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x6f2a('0x20'),db['sequelize']['fn']('IF',db[_0x6f2a('0x1e')]['literal'](_0x6f2a('0x34')))),_0x6f2a('0x35')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6f2a('0x1e')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x6f2a('0x36')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x37')))),_0x6f2a('0x38')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x39')))),_0x6f2a('0x3a')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x3b')))),_0x6f2a('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x3d')))),_0x6f2a('0x3a')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db[_0x6f2a('0x1e')][_0x6f2a('0x21')](_0x6f2a('0x3e')))),_0x6f2a('0x3f')]],'group':[_0x6f2a('0x2a')]})['then'](function(_0x2c26fc){logger['info'](_0x6f2a('0x40'),_0x99c894);logger['debug'](_0x6f2a('0x40'),_0x99c894,JSON['stringify'](_0x2c26fc));_0x1e0595(_0x2c26fc);})[_0x6f2a('0x16')](function(_0x1c1ad9){logger[_0x6f2a('0x11')]('GetVoiceQueueHopperHistory',_0x1c1ad9[_0x6f2a('0x13')],_0x99c894);_0x1945ad(_0x2ce7ee['error'](0x1f4,_0x1c1ad9[_0x6f2a('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x5add29){var _0x2e0078=this;return new Promise(function(_0x3a213c,_0x1a5afb){return db[_0x6f2a('0x18')][_0x6f2a('0x29')]({'raw':_0x5add29[_0x6f2a('0x1b')]?_0x5add29[_0x6f2a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5add29[_0x6f2a('0x1b')]?_0x5add29[_0x6f2a('0x1b')][_0x6f2a('0x41')]||null:null,'attributes':[[_0x6f2a('0x2a'),_0x6f2a('0x2b')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')][_0x6f2a('0x1f')]('id')),_0x6f2a('0x42')],[db[_0x6f2a('0x1e')]['fn'](_0x6f2a('0x20'),db[_0x6f2a('0x1e')]['fn']('IF',db['sequelize'][_0x6f2a('0x21')](_0x6f2a('0x22')))),_0x6f2a('0x43')]],'group':[_0x6f2a('0x2a')]})[_0x6f2a('0xb')](function(_0x307355){logger[_0x6f2a('0xc')](_0x6f2a('0x44'),_0x5add29);logger[_0x6f2a('0xe')]('GetCampaignHopperHistory',_0x5add29,JSON[_0x6f2a('0x10')](_0x307355));_0x3a213c(_0x307355);})[_0x6f2a('0x16')](function(_0xe5189d){logger[_0x6f2a('0x11')](_0x6f2a('0x44'),_0xe5189d[_0x6f2a('0x13')],_0x5add29);_0x1a5afb(_0x2e0078[_0x6f2a('0x11')](0x1f4,_0xe5189d[_0x6f2a('0x13')]));});});}; \ No newline at end of file +var _0xcdcc=['code','message','result','catch','CmHopperHistory','body','options','raw','then','CreateCmHopperHistory','stringify','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','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','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xcdcc,0x1d2));var _0xccdc=function(_0x2b636c,_0x3b7317){_0x2b636c=_0x2b636c-0x0;var _0x213a3b=_0xcdcc[_0x2b636c];return _0x213a3b;};'use strict';var _=require(_0xccdc('0x0'));var util=require(_0xccdc('0x1'));var moment=require(_0xccdc('0x2'));var BPromise=require('bluebird');var rs=require(_0xccdc('0x3'));var fs=require('fs');var Redis=require(_0xccdc('0x4'));var db=require(_0xccdc('0x5'))['db'];var utils=require(_0xccdc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xccdc('0x7'));var jayson=require(_0xccdc('0x8'));var client=jayson['client'][_0xccdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fb2c6,_0x188a11,_0x2c5732){return new BPromise(function(_0x17a77d,_0x364fa8){return client[_0xccdc('0xa')](_0x4fb2c6,_0x2c5732)['then'](function(_0x2d0263){logger[_0xccdc('0xb')](_0xccdc('0xc'),_0x188a11,_0xccdc('0xd'));logger[_0xccdc('0xe')](_0xccdc('0xf'),_0x188a11,_0xccdc('0xd'),JSON['stringify'](_0x2d0263));if(_0x2d0263[_0xccdc('0x10')]){if(_0x2d0263['error'][_0xccdc('0x11')]===0x1f4){logger['error'](_0xccdc('0xc'),_0x188a11,_0x2d0263[_0xccdc('0x10')][_0xccdc('0x12')]);return _0x364fa8(_0x2d0263[_0xccdc('0x10')][_0xccdc('0x12')]);}logger[_0xccdc('0x10')](_0xccdc('0xc'),_0x188a11,_0x2d0263[_0xccdc('0x10')][_0xccdc('0x12')]);return _0x17a77d(_0x2d0263[_0xccdc('0x10')][_0xccdc('0x12')]);}else{logger[_0xccdc('0xb')](_0xccdc('0xc'),_0x188a11,'request\x20sent');_0x17a77d(_0x2d0263[_0xccdc('0x13')]['message']);}})[_0xccdc('0x14')](function(_0x4b9c8b){logger['error'](_0xccdc('0xc'),_0x188a11,_0x4b9c8b);_0x364fa8(_0x4b9c8b);});});}exports['CreateCmHopperHistory']=function(_0x7927e3){var _0x4c768d=this;return new Promise(function(_0x496654,_0x225048){return db[_0xccdc('0x15')]['create'](_0x7927e3[_0xccdc('0x16')],{'raw':_0x7927e3[_0xccdc('0x17')]?_0x7927e3[_0xccdc('0x17')][_0xccdc('0x18')]===undefined?!![]:![]:!![]})[_0xccdc('0x19')](function(_0x1b5ae7){logger[_0xccdc('0xb')](_0xccdc('0x1a'),_0x7927e3);logger[_0xccdc('0xe')](_0xccdc('0x1a'),_0x7927e3,JSON[_0xccdc('0x1b')](_0x1b5ae7));_0x496654(_0x1b5ae7);})[_0xccdc('0x14')](function(_0x12cc53){logger[_0xccdc('0x10')](_0xccdc('0x1a'),_0x12cc53[_0xccdc('0x12')],_0x7927e3);_0x225048(_0x4c768d[_0xccdc('0x10')](0x1f4,_0x12cc53[_0xccdc('0x12')]));});});};exports['AvgHandleTime']=function(_0x3e2648){var _0xc2ccd0=this;return new Promise(function(_0x58c57,_0x1fe032){return db[_0xccdc('0x15')]['findAll']({'raw':_0x3e2648[_0xccdc('0x17')]?_0x3e2648[_0xccdc('0x17')][_0xccdc('0x18')]===undefined?!![]:![]:!![],'where':_0x3e2648['options']?_0x3e2648[_0xccdc('0x17')][_0xccdc('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')][_0xccdc('0x1f')]('id')),_0xccdc('0x20')],[db['sequelize']['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xccdc('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x24')))),_0xccdc('0x25')],[db['sequelize']['fn'](_0xccdc('0x26'),db['sequelize']['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x27')))),_0xccdc('0x28')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x26'),db['sequelize']['fn']('IF',db[_0xccdc('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xccdc('0x29')]]})[_0xccdc('0x19')](function(_0x5b3328){logger[_0xccdc('0xb')]('AvgHandleTime',_0x3e2648);logger[_0xccdc('0xe')](_0xccdc('0x2a'),_0x3e2648,JSON['stringify'](_0x5b3328));_0x58c57(_0x5b3328);})['catch'](function(_0x3547d3){logger[_0xccdc('0x10')](_0xccdc('0x2a'),_0x3547d3['message'],_0x3e2648);_0x1fe032(_0xc2ccd0[_0xccdc('0x10')](0x1f4,_0x3547d3[_0xccdc('0x12')]));});});};exports[_0xccdc('0x2b')]=function(_0x434b63){var _0x531efe=this;return new Promise(function(_0x1badd5,_0xe612a){return db[_0xccdc('0x15')][_0xccdc('0x2c')]({'raw':_0x434b63[_0xccdc('0x17')]?_0x434b63[_0xccdc('0x17')][_0xccdc('0x18')]===undefined?!![]:![]:!![],'where':_0x434b63[_0xccdc('0x17')]?_0x434b63[_0xccdc('0x17')][_0xccdc('0x1c')]||null:null,'attributes':[[_0xccdc('0x2d'),'name'],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x2e')))),_0xccdc('0x2f')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xccdc('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0xccdc('0x30')],[db[_0xccdc('0x1e')]['fn']('COUNT',db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x21')))),_0xccdc('0x31')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db['sequelize'][_0xccdc('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0xccdc('0x32')],[db[_0xccdc('0x1e')]['fn']('COUNT',db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x33')))),_0xccdc('0x34')],[db[_0xccdc('0x1e')]['fn']('COUNT',db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x35')))),_0xccdc('0x36')],[db[_0xccdc('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x37')))),_0xccdc('0x38')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xccdc('0x39')))),'outboundUnknownCallsDay'],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0xccdc('0x3a')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0xccdc('0x3b')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')]['literal'](_0xccdc('0x3c')))),_0xccdc('0x3d')],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xccdc('0x3e')))),_0xccdc('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')]['literal'](_0xccdc('0x40')))),_0xccdc('0x3d')],[db[_0xccdc('0x1e')]['fn']('COUNT',db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x41')))),'outboundReCallsDay']],'group':[_0xccdc('0x2d')]})['then'](function(_0x201f3b){logger[_0xccdc('0xb')](_0xccdc('0x2b'),_0x434b63);logger[_0xccdc('0xe')](_0xccdc('0x2b'),_0x434b63,JSON[_0xccdc('0x1b')](_0x201f3b));_0x1badd5(_0x201f3b);})['catch'](function(_0x430b8c){logger['error'](_0xccdc('0x2b'),_0x430b8c[_0xccdc('0x12')],_0x434b63);_0xe612a(_0x531efe[_0xccdc('0x10')](0x1f4,_0x430b8c[_0xccdc('0x12')]));});});};exports[_0xccdc('0x42')]=function(_0x58e618){var _0x1dc8d2=this;return new Promise(function(_0x6bfb4e,_0x93ff88){return db[_0xccdc('0x15')][_0xccdc('0x2c')]({'raw':_0x58e618['options']?_0x58e618[_0xccdc('0x17')][_0xccdc('0x18')]===undefined?!![]:![]:!![],'where':_0x58e618[_0xccdc('0x17')]?_0x58e618['options'][_0xccdc('0x1c')]||null:null,'attributes':[[_0xccdc('0x2d'),'name'],[db[_0xccdc('0x1e')]['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['col']('id')),_0xccdc('0x43')],[db['sequelize']['fn'](_0xccdc('0x1d'),db[_0xccdc('0x1e')]['fn']('IF',db[_0xccdc('0x1e')][_0xccdc('0x22')](_0xccdc('0x21')))),_0xccdc('0x44')]],'group':[_0xccdc('0x2d')]})['then'](function(_0x330b04){logger[_0xccdc('0xb')](_0xccdc('0x42'),_0x58e618);logger[_0xccdc('0xe')]('GetCampaignHopperHistory',_0x58e618,JSON[_0xccdc('0x1b')](_0x330b04));_0x6bfb4e(_0x330b04);})['catch'](function(_0x33fe95){logger['error'](_0xccdc('0x42'),_0x33fe95['message'],_0x58e618);_0x93ff88(_0x1dc8d2['error'](0x1f4,_0x33fe95['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7972824..3ae3424 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 _0xdb41=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','util','path'];(function(_0x5c9495,_0x1ccc25){var _0x569ddf=function(_0x536b6a){while(--_0x536b6a){_0x5c9495['push'](_0x5c9495['shift']());}};_0x569ddf(++_0x1ccc25);}(_0xdb41,0x95));var _0x1db4=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0xdb41[_0x426076];return _0x1e9565;};'use strict';var multer=require(_0x1db4('0x0'));var util=require(_0x1db4('0x1'));var path=require(_0x1db4('0x2'));var timeout=require(_0x1db4('0x3'));var express=require(_0x1db4('0x4'));var router=express[_0x1db4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1db4('0x6'));var interaction=require(_0x1db4('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x1db4('0x8')]('/',auth[_0x1db4('0x9')](),controller[_0x1db4('0xa')]);router[_0x1db4('0x8')](_0x1db4('0xb'),auth[_0x1db4('0x9')](),controller[_0x1db4('0xc')]);router[_0x1db4('0x8')](_0x1db4('0xd'),auth[_0x1db4('0x9')](),controller[_0x1db4('0xe')]);router[_0x1db4('0xf')]('/',auth['isAuthenticated'](),controller[_0x1db4('0x10')]);router['put'](_0x1db4('0xd'),auth[_0x1db4('0x9')](),controller[_0x1db4('0x11')]);module[_0x1db4('0x12')]=router; \ No newline at end of file +var _0xc150=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x33aa42,_0x19b09f){var _0x195523=function(_0x3b7d76){while(--_0x3b7d76){_0x33aa42['push'](_0x33aa42['shift']());}};_0x195523(++_0x19b09f);}(_0xc150,0xae));var _0x0c15=function(_0x45509f,_0x412835){_0x45509f=_0x45509f-0x0;var _0x17de53=_0xc150[_0x45509f];return _0x17de53;};'use strict';var multer=require(_0x0c15('0x0'));var util=require(_0x0c15('0x1'));var path=require(_0x0c15('0x2'));var timeout=require(_0x0c15('0x3'));var express=require('express');var router=express[_0x0c15('0x4')]();var fs_extra=require(_0x0c15('0x5'));var auth=require(_0x0c15('0x6'));var interaction=require(_0x0c15('0x7'));var config=require(_0x0c15('0x8'));var controller=require(_0x0c15('0x9'));router[_0x0c15('0xa')]('/',auth[_0x0c15('0xb')](),controller[_0x0c15('0xc')]);router[_0x0c15('0xa')](_0x0c15('0xd'),auth[_0x0c15('0xb')](),controller['describe']);router['get'](_0x0c15('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0c15('0xe'),auth[_0x0c15('0xb')](),controller['update']);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 5292422..c68e006 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 _0x616c=['exports','STRING'];(function(_0x240d75,_0x4850fd){var _0x438e90=function(_0x1ae2cd){while(--_0x1ae2cd){_0x240d75['push'](_0x240d75['shift']());}};_0x438e90(++_0x4850fd);}(_0x616c,0x1b6));var _0xc616=function(_0x57e043,_0x59e2bd){_0x57e043=_0x57e043-0x0;var _0x340a78=_0x616c[_0x57e043];return _0x340a78;};'use strict';var Sequelize=require('sequelize');module[_0xc616('0x0')]={'name':{'type':Sequelize[_0xc616('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc616('0x1')]},'dialPrefix':{'type':Sequelize[_0xc616('0x1')]}}; \ No newline at end of file +var _0xec39=['exports','STRING','name','sequelize'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0xec39,0x19f));var _0x9ec3=function(_0x56fc46,_0x1f673d){_0x56fc46=_0x56fc46-0x0;var _0x5f40f4=_0xec39[_0x56fc46];return _0x5f40f4;};'use strict';var Sequelize=require(_0x9ec3('0x0'));module[_0x9ec3('0x1')]={'name':{'type':Sequelize[_0x9ec3('0x2')],'unique':_0x9ec3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ec3('0x2')]},'dialPrefix':{'type':Sequelize[_0x9ec3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 686e72a..755537b 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 _0x9063=['redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','raw','getContactsCsv','concat','format','cf_%d','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9063,0x18f));var _0x3906=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9063[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x3906('0x0'));var rimraf=require(_0x3906('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3906('0x2'));var rp=require(_0x3906('0x3'));var moment=require('moment');var BPromise=require(_0x3906('0x4'));var Mustache=require(_0x3906('0x5'));var util=require(_0x3906('0x6'));var path=require(_0x3906('0x7'));var sox=require(_0x3906('0x8'));var csv=require(_0x3906('0x9'));var ejs=require(_0x3906('0xa'));var fs=require('fs');var fs_extra=require(_0x3906('0xb'));var _=require(_0x3906('0xc'));var squel=require(_0x3906('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3906('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3906('0xe'));var authService=require(_0x3906('0xf'));var qs=require(_0x3906('0x10'));var as=require(_0x3906('0x11'));var hardwareService=require(_0x3906('0x12'));var logger=require(_0x3906('0x13'))(_0x3906('0x14'));var utils=require(_0x3906('0x15'));var config=require(_0x3906('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3906('0x17'))['db'];config['redis']=_['defaults'](config[_0x3906('0x18')],{'host':_0x3906('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x3906('0x1a')](socket);function respondWithStatusCode(_0xc1057c,_0x1f2af4){_0x1f2af4=_0x1f2af4||0xcc;return function(_0x48096c){if(_0x48096c){return _0xc1057c[_0x3906('0x1b')](_0x1f2af4);}return _0xc1057c[_0x3906('0x1c')](_0x1f2af4)[_0x3906('0x1d')]();};}function respondWithResult(_0x18cac4,_0x3d069d){_0x3d069d=_0x3d069d||0xc8;return function(_0x2ffce5){if(_0x2ffce5){return _0x18cac4[_0x3906('0x1c')](_0x3d069d)[_0x3906('0x1e')](_0x2ffce5);}};}function respondWithFilteredResult(_0x3149ed,_0x274ad3){return function(_0x2eeca4){if(_0x2eeca4){var _0xd557ef=typeof _0x274ad3['offset']===_0x3906('0x1f')&&typeof _0x274ad3[_0x3906('0x20')]===_0x3906('0x1f');var _0x3ed10c=_0x2eeca4[_0x3906('0x21')];var _0x4e1f59=_0xd557ef?0x0:_0x274ad3['offset'];var _0x5f2d15=_0xd557ef?_0x2eeca4['count']:_0x274ad3[_0x3906('0x22')]+_0x274ad3['limit'];var _0xc10e5e;if(_0x5f2d15>=_0x3ed10c){_0x5f2d15=_0x3ed10c;_0xc10e5e=0xc8;}else{_0xc10e5e=0xce;}_0x3149ed['status'](_0xc10e5e);return _0x3149ed[_0x3906('0x23')](_0x3906('0x24'),_0x4e1f59+'-'+_0x5f2d15+'/'+_0x3ed10c)[_0x3906('0x1e')](_0x2eeca4);}return null;};}function patchUpdates(_0x576298){return function(_0x2c469e){try{jsonpatch[_0x3906('0x25')](_0x2c469e,_0x576298,!![]);}catch(_0x4e11d4){return BPromise[_0x3906('0x26')](_0x4e11d4);}return _0x2c469e['save']();};}function saveUpdates(_0x216d5d,_0x54d074){return function(_0x109c3a){if(_0x109c3a){return _0x109c3a[_0x3906('0x27')](_0x216d5d)[_0x3906('0x28')](function(_0x22dc49){return _0x22dc49;});}return null;};}function removeEntity(_0x5da659,_0xe63d11){return function(_0x27ef86){if(_0x27ef86){return _0x27ef86[_0x3906('0x29')]()[_0x3906('0x28')](function(){var _0x2d1da3=_0x27ef86[_0x3906('0x2a')]({'plain':!![]});var _0x47fcc8=_0x3906('0x2b');return db[_0x3906('0x2c')]['destroy']({'where':{'type':_0x47fcc8,'resourceId':_0x2d1da3['id']}})[_0x3906('0x28')](function(){return _0x27ef86;});})[_0x3906('0x28')](function(){_0x5da659['status'](0xcc)[_0x3906('0x1d')]();});}};}function handleEntityNotFound(_0x1eace6,_0x478325){return function(_0x1396b7){if(!_0x1396b7){_0x1eace6['sendStatus'](0x194);}return _0x1396b7;};}function handleError(_0x25b6fd,_0x5b913a){_0x5b913a=_0x5b913a||0x1f4;return function(_0x55b545){logger[_0x3906('0x2d')](_0x55b545['stack']);if(_0x55b545[_0x3906('0x2e')]){delete _0x55b545['name'];}_0x25b6fd[_0x3906('0x1c')](_0x5b913a)[_0x3906('0x2f')](_0x55b545);};}exports['index']=function(_0x584194,_0x57dd44){var _0x5f15a9={},_0x4a4e26={},_0x23ccdf={'count':0x0,'rows':[]};var _0x4909c5=_[_0x3906('0x30')](db[_0x3906('0x31')][_0x3906('0x32')],function(_0x430ed3){return{'name':_0x430ed3[_0x3906('0x33')],'type':_0x430ed3[_0x3906('0x34')][_0x3906('0x35')]};});_0x4a4e26[_0x3906('0x36')]=_[_0x3906('0x30')](_0x4909c5,_0x3906('0x2e'));_0x4a4e26[_0x3906('0x37')]=_[_0x3906('0x38')](_0x584194[_0x3906('0x37')]);_0x4a4e26[_0x3906('0x39')]=_[_0x3906('0x3a')](_0x4a4e26[_0x3906('0x36')],_0x4a4e26[_0x3906('0x37')]);_0x5f15a9[_0x3906('0x3b')]=_[_0x3906('0x3a')](_0x4a4e26[_0x3906('0x36')],qs[_0x3906('0x3c')](_0x584194[_0x3906('0x37')]['fields']));_0x5f15a9['attributes']=_0x5f15a9[_0x3906('0x3b')][_0x3906('0x3d')]?_0x5f15a9[_0x3906('0x3b')]:_0x4a4e26[_0x3906('0x36')];if(!_0x584194[_0x3906('0x37')]['hasOwnProperty']('nolimit')){_0x5f15a9['limit']=qs[_0x3906('0x20')](_0x584194[_0x3906('0x37')][_0x3906('0x20')]);_0x5f15a9[_0x3906('0x22')]=qs[_0x3906('0x22')](_0x584194[_0x3906('0x37')][_0x3906('0x22')]);}_0x5f15a9[_0x3906('0x3e')]=qs[_0x3906('0x3f')](_0x584194[_0x3906('0x37')][_0x3906('0x3f')]);_0x5f15a9[_0x3906('0x40')]=qs[_0x3906('0x39')](_[_0x3906('0x41')](_0x584194[_0x3906('0x37')],_0x4a4e26[_0x3906('0x39')]),_0x4909c5);if(_0x584194[_0x3906('0x37')]['filter']){_0x5f15a9[_0x3906('0x40')]=_[_0x3906('0x42')](_0x5f15a9['where'],{'$or':_[_0x3906('0x30')](_0x4909c5,function(_0xf03210){if(_0xf03210[_0x3906('0x34')]!==_0x3906('0x43')){var _0x5a42d6={};_0x5a42d6[_0xf03210['name']]={'$like':'%'+_0x584194[_0x3906('0x37')][_0x3906('0x44')]+'%'};return _0x5a42d6;}})});}_0x5f15a9=_['merge']({},_0x5f15a9,_0x584194[_0x3906('0x45')]);var _0x54c2ae={'where':_0x5f15a9[_0x3906('0x40')]};return db['CmList']['count'](_0x54c2ae)[_0x3906('0x28')](function(_0xd4832b){_0x23ccdf[_0x3906('0x21')]=_0xd4832b;if(_0x584194['query'][_0x3906('0x46')]){_0x5f15a9[_0x3906('0x47')]=[{'all':!![]}];}return db[_0x3906('0x31')][_0x3906('0x48')](_0x5f15a9);})[_0x3906('0x28')](function(_0x113b1b){_0x23ccdf[_0x3906('0x49')]=_0x113b1b;return _0x23ccdf;})[_0x3906('0x28')](respondWithFilteredResult(_0x57dd44,_0x5f15a9))[_0x3906('0x4a')](handleError(_0x57dd44,null));};exports[_0x3906('0x4b')]=function(_0x3d68f5,_0x20d9fd){var _0x1f0ef7={'raw':![],'where':{'id':_0x3d68f5[_0x3906('0x4c')]['id']}},_0x932fa7={};_0x932fa7[_0x3906('0x36')]=_[_0x3906('0x38')](db[_0x3906('0x31')]['rawAttributes']);_0x932fa7[_0x3906('0x37')]=_[_0x3906('0x38')](_0x3d68f5['query']);_0x932fa7[_0x3906('0x39')]=_['intersection'](_0x932fa7[_0x3906('0x36')],_0x932fa7[_0x3906('0x37')]);_0x1f0ef7[_0x3906('0x3b')]=_[_0x3906('0x3a')](_0x932fa7[_0x3906('0x36')],qs[_0x3906('0x3c')](_0x3d68f5[_0x3906('0x37')]['fields']));_0x1f0ef7[_0x3906('0x3b')]=_0x1f0ef7[_0x3906('0x3b')][_0x3906('0x3d')]?_0x1f0ef7[_0x3906('0x3b')]:_0x932fa7['model'];if(_0x3d68f5['query'][_0x3906('0x46')]){_0x1f0ef7[_0x3906('0x47')]=[{'all':!![]}];}_0x1f0ef7=_[_0x3906('0x42')]({},_0x1f0ef7,_0x3d68f5[_0x3906('0x45')]);return db[_0x3906('0x31')][_0x3906('0x4d')](_0x1f0ef7)['then'](handleEntityNotFound(_0x20d9fd,null))['then'](respondWithResult(_0x20d9fd,null))['catch'](handleError(_0x20d9fd,null));};exports['create']=function(_0x17e388,_0x3cac78){return db[_0x3906('0x31')][_0x3906('0x4e')](_0x17e388['body'],{})['then'](function(_0x1c069b){var _0x76e3ee=_0x17e388[_0x3906('0x4f')]['get']({'plain':!![]});if(!_0x76e3ee)throw new Error(_0x3906('0x50'));if(_0x76e3ee['role']===_0x3906('0x4f')){var _0x6b040a=_0x1c069b[_0x3906('0x2a')]({'plain':!![]});var _0x396767='Lists';return db[_0x3906('0x51')][_0x3906('0x4d')]({'where':{'name':_0x396767,'userProfileId':_0x76e3ee['userProfileId']},'raw':!![]})[_0x3906('0x28')](function(_0xd22c8b){if(_0xd22c8b&&_0xd22c8b['autoAssociation']===0x0){return db[_0x3906('0x2c')][_0x3906('0x4e')]({'name':_0x6b040a[_0x3906('0x2e')],'resourceId':_0x6b040a['id'],'type':_0xd22c8b[_0x3906('0x2e')],'sectionId':_0xd22c8b['id']},{})[_0x3906('0x28')](function(){return _0x1c069b;});}else{return _0x1c069b;}})[_0x3906('0x4a')](function(_0x5e509f){logger['error'](_0x3906('0x52'),_0x5e509f);throw _0x5e509f;});}return _0x1c069b;})['then'](respondWithResult(_0x3cac78,0xc9))['catch'](handleError(_0x3cac78,null));};exports['update']=function(_0x48e1e0,_0x48873){if(_0x48e1e0[_0x3906('0x53')]['id']){delete _0x48e1e0[_0x3906('0x53')]['id'];}return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0x48e1e0[_0x3906('0x4c')]['id']}})['then'](handleEntityNotFound(_0x48873,null))[_0x3906('0x28')](saveUpdates(_0x48e1e0[_0x3906('0x53')],null))[_0x3906('0x28')](respondWithResult(_0x48873,null))[_0x3906('0x4a')](handleError(_0x48873,null));};exports[_0x3906('0x29')]=function(_0x4dee26,_0x27087a){return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0x4dee26[_0x3906('0x4c')]['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x27087a,null))[_0x3906('0x28')](removeEntity(_0x27087a,null))[_0x3906('0x4a')](handleError(_0x27087a,null));};exports[_0x3906('0x54')]=function(_0x520533,_0x539eae){return db[_0x3906('0x31')][_0x3906('0x54')]()[_0x3906('0x28')](respondWithResult(_0x539eae,null))[_0x3906('0x4a')](handleError(_0x539eae,null));};exports[_0x3906('0x55')]=function(_0x495154,_0x364639,_0xc77839){if(_0x495154[_0x3906('0x53')]['id']){delete _0x495154['body']['id'];}return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0x495154['params']['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x364639,null))[_0x3906('0x28')](function(_0x137d40){if(_0x137d40){_0x495154['body'][_0x3906('0x56')]=_0x137d40['id'];return db[_0x3906('0x57')][_0x3906('0x4e')](_0x495154[_0x3906('0x53')]);}})[_0x3906('0x28')](respondWithResult(_0x364639,null))[_0x3906('0x4a')](handleError(_0x364639,null));};exports['getDispositions']=function(_0x3603eb,_0x3ea219,_0xc1155c){var _0x4e06df={'raw':![],'where':{}};var _0x1bb4f5={};var _0x37d641={'count':0x0,'rows':[]};return db[_0x3906('0x31')][_0x3906('0x58')]({'where':{'id':_0x3603eb[_0x3906('0x4c')]['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x3ea219,null))[_0x3906('0x28')](function(_0x53c7ac){if(_0x53c7ac){_0x1bb4f5[_0x3906('0x36')]=_[_0x3906('0x38')](db[_0x3906('0x57')][_0x3906('0x32')]);_0x1bb4f5[_0x3906('0x37')]=_['keys'](_0x3603eb[_0x3906('0x37')]);_0x1bb4f5[_0x3906('0x39')]=_[_0x3906('0x3a')](_0x1bb4f5['model'],_0x1bb4f5[_0x3906('0x37')]);_0x4e06df[_0x3906('0x3b')]=_[_0x3906('0x3a')](_0x1bb4f5[_0x3906('0x36')],qs[_0x3906('0x3c')](_0x3603eb['query'][_0x3906('0x3c')]));_0x4e06df[_0x3906('0x3b')]=_0x4e06df[_0x3906('0x3b')][_0x3906('0x3d')]?_0x4e06df['attributes']:_0x1bb4f5[_0x3906('0x36')];if(!_0x3603eb[_0x3906('0x37')][_0x3906('0x59')](_0x3906('0x5a'))){_0x4e06df[_0x3906('0x20')]=qs[_0x3906('0x20')](_0x3603eb[_0x3906('0x37')][_0x3906('0x20')]);_0x4e06df[_0x3906('0x22')]=qs[_0x3906('0x22')](_0x3603eb[_0x3906('0x37')][_0x3906('0x22')]);}_0x4e06df[_0x3906('0x3e')]=qs[_0x3906('0x3f')](_0x3603eb[_0x3906('0x37')][_0x3906('0x3f')]);_0x4e06df[_0x3906('0x40')]=qs[_0x3906('0x39')](_[_0x3906('0x41')](_0x3603eb['query'],_0x1bb4f5['filters']));_0x4e06df[_0x3906('0x40')]['ListId']=_0x53c7ac['id'];if(_0x3603eb[_0x3906('0x37')][_0x3906('0x44')]){_0x4e06df[_0x3906('0x40')]=_[_0x3906('0x42')](_0x4e06df[_0x3906('0x40')],{'$or':_['map'](_0x4e06df[_0x3906('0x3b')],function(_0x23cfbd){var _0xb98c07={};_0xb98c07[_0x23cfbd]={'$like':'%'+_0x3603eb[_0x3906('0x37')][_0x3906('0x44')]+'%'};return _0xb98c07;})});}_0x4e06df=_['merge']({},_0x4e06df,_0x3603eb[_0x3906('0x45')]);return db[_0x3906('0x57')][_0x3906('0x21')]({'where':_0x4e06df[_0x3906('0x40')]})['then'](function(_0x4db148){_0x37d641[_0x3906('0x21')]=_0x4db148;if(_0x3603eb[_0x3906('0x37')]['includeAll']){_0x4e06df[_0x3906('0x47')]=[{'all':!![]}];}return db[_0x3906('0x57')][_0x3906('0x48')](_0x4e06df);})['then'](function(_0x254785){_0x37d641[_0x3906('0x49')]=_0x254785;return _0x37d641;});}})['then'](respondWithFilteredResult(_0x3ea219,_0x4e06df))[_0x3906('0x4a')](handleError(_0x3ea219,null));};exports[_0x3906('0x5b')]=function(_0x38ac91,_0x35a9d0,_0x2f5359){return db[_0x3906('0x31')]['find']({'where':{'id':_0x38ac91[_0x3906('0x4c')]['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x35a9d0,null))['then'](function(_0x42e027){if(_0x42e027){return _0x42e027[_0x3906('0x5b')](_0x38ac91[_0x3906('0x37')][_0x3906('0x5c')]);}})[_0x3906('0x28')](respondWithStatusCode(_0x35a9d0,null))[_0x3906('0x4a')](handleError(_0x35a9d0,null));};exports[_0x3906('0x5d')]=function(_0x45687f,_0x13ad8e,_0xa0a077){return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0x45687f[_0x3906('0x4c')]['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x13ad8e,null))[_0x3906('0x28')](function(_0x4e91c8){if(_0x4e91c8){var _0x525f9b=[];var _0x2cba60={'success':[],'errors':[]};return db[_0x3906('0x5e')][_0x3906('0x54')]()[_0x3906('0x28')](function(_0x6bcf7){if(_0x45687f['body'][_0x3906('0x5f')]&&_[_0x3906('0x60')](_0x45687f[_0x3906('0x53')][_0x3906('0x5f')])){if(_0x45687f[_0x3906('0x53')][_0x3906('0x5f')]['length']){_0x45687f[_0x3906('0x53')][_0x3906('0x5f')]=_0x45687f[_0x3906('0x53')]['tags'][_0x3906('0x61')](';')+';';}else{_0x45687f[_0x3906('0x53')][_0x3906('0x5f')]=null;}}else{_0x45687f[_0x3906('0x53')]['tags']=null;}if(_0x45687f[_0x3906('0x53')]&&_[_0x3906('0x60')](_0x45687f[_0x3906('0x53')])){for(var _0x4823ab=0x0;_0x4823ab<_0x45687f[_0x3906('0x53')][_0x3906('0x3d')];_0x4823ab+=0x1){_0x45687f[_0x3906('0x53')][_0x4823ab][_0x3906('0x56')]=_0x45687f[_0x3906('0x4c')]['id'];_0x525f9b[_0x3906('0x62')](_0x45687f[_0x3906('0x53')][_0x4823ab]);}return BPromise[_0x3906('0x63')](_0x525f9b,function(_0x14a485){return db[_0x3906('0x5e')][_0x3906('0x4e')](_[_0x3906('0x64')](_0x14a485,[_0x3906('0x5c'),'id'])||{},{'fields':_[_0x3906('0x38')](_0x6bcf7),'raw':!![]})[_0x3906('0x28')](function(_0x5bf734){_0x2cba60['success'][_0x3906('0x62')](_0x5bf734[_0x3906('0x65')]);})[_0x3906('0x4a')](function(_0x360ed6){_0x2cba60['errors']['push']({'data':_0x14a485,'error':_0x360ed6['message']});});})[_0x3906('0x28')](function(_0x20eb4e){return _0x2cba60;})[_0x3906('0x4a')](function(_0xe142f7){return _0xe142f7;});}else{_0x13ad8e[_0x3906('0x1c')](0x190)[_0x3906('0x1e')]({'message':_0x3906('0x66')});}});}})[_0x3906('0x28')](respondWithResult(_0x13ad8e,null))[_0x3906('0x4a')](handleError(_0x13ad8e,null));};exports[_0x3906('0x67')]=function(_0x470bb9,_0xe1db85,_0x41e238){var _0x4ec4e5;return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0x470bb9['params']['id']},'include':[{'model':db[_0x3906('0x68')],'as':'CustomFields'}]})[_0x3906('0x28')](handleEntityNotFound(_0xe1db85,null))[_0x3906('0x28')](function(_0x691368){if(_0x691368){_0x4ec4e5=_0x691368;return db[_0x3906('0x5e')][_0x3906('0x32')];}})[_0x3906('0x28')](function(_0x5411f7){if(_0x5411f7){var _0x36615f={};var _0x232db7={};_0x232db7[_0x3906('0x36')]=_['concat'](_[_0x3906('0x38')](_0x5411f7),_[_0x3906('0x30')](_0x4ec4e5[_0x3906('0x69')],function(_0x4564b9){return util['format']('cf_%d',_0x4564b9['id']);}));_0x232db7[_0x3906('0x37')]=_[_0x3906('0x38')](_0x470bb9[_0x3906('0x37')]);_0x232db7[_0x3906('0x39')]=_[_0x3906('0x3a')](_0x232db7['model'],_0x232db7['query']);_0x36615f[_0x3906('0x3b')]=_['intersection'](_0x232db7[_0x3906('0x36')],qs[_0x3906('0x3c')](_0x470bb9['query']['fields']));_0x36615f[_0x3906('0x3b')]=_0x36615f['attributes'][_0x3906('0x3d')]?_0x36615f['attributes']:_0x232db7[_0x3906('0x36')];if(!_0x470bb9['query'][_0x3906('0x59')](_0x3906('0x5a'))){_0x36615f[_0x3906('0x20')]=qs['limit'](_0x470bb9[_0x3906('0x37')][_0x3906('0x20')]);_0x36615f[_0x3906('0x22')]=qs[_0x3906('0x22')](_0x470bb9[_0x3906('0x37')]['offset']);}_0x36615f[_0x3906('0x3e')]=qs[_0x3906('0x3f')](_0x470bb9[_0x3906('0x37')]['sort']);_0x36615f[_0x3906('0x40')]=qs[_0x3906('0x39')](_[_0x3906('0x41')](_0x470bb9[_0x3906('0x37')],_0x232db7[_0x3906('0x39')]));_0x36615f[_0x3906('0x6a')]=!![];if(_0x470bb9['query'][_0x3906('0x44')]){_0x36615f[_0x3906('0x40')]=_['merge'](_0x36615f[_0x3906('0x40')],{'$or':_['map'](_0x36615f['attributes'],function(_0x486335){var _0x2f0548={};_0x2f0548[_0x486335]={'$like':'%'+_0x470bb9[_0x3906('0x37')][_0x3906('0x44')]+'%'};return _0x2f0548;})});}_0x36615f=_['merge']({},_0x36615f,_0x470bb9[_0x3906('0x45')]);return _0x4ec4e5[_0x3906('0x67')](_0x36615f);}})[_0x3906('0x28')](respondWithResult(_0xe1db85,null))[_0x3906('0x4a')](handleError(_0xe1db85,null));};exports[_0x3906('0x6b')]=function(_0xd1d754,_0x1b253d,_0x49d65a){var _0x3d168f;return db[_0x3906('0x31')][_0x3906('0x4d')]({'where':{'id':_0xd1d754[_0x3906('0x4c')]['id']},'include':[{'model':db[_0x3906('0x68')],'as':_0x3906('0x69')}]})['then'](handleEntityNotFound(_0x1b253d,null))[_0x3906('0x28')](function(_0x5ea8bb){if(_0x5ea8bb){_0x3d168f=_0x5ea8bb;return db[_0x3906('0x5e')][_0x3906('0x32')];}})[_0x3906('0x28')](function(_0xed83d7){if(_0xed83d7){var _0x4d5bb8={};var _0x4f1d21={};_0x4f1d21[_0x3906('0x36')]=_[_0x3906('0x6c')](_[_0x3906('0x38')](_0xed83d7),_[_0x3906('0x30')](_0x3d168f[_0x3906('0x69')],function(_0x343cb9){return util[_0x3906('0x6d')](_0x3906('0x6e'),_0x343cb9['id']);}));_0x4f1d21[_0x3906('0x37')]=_[_0x3906('0x38')](_0xd1d754[_0x3906('0x37')]);_0x4f1d21['filters']=_[_0x3906('0x3a')](_0x4f1d21[_0x3906('0x36')],_0x4f1d21[_0x3906('0x37')]);_0x4d5bb8['attributes']=_[_0x3906('0x3a')](_0x4f1d21[_0x3906('0x36')],qs[_0x3906('0x3c')](_0xd1d754[_0x3906('0x37')][_0x3906('0x3c')]));_0x4d5bb8['attributes']=_0x4d5bb8['attributes'][_0x3906('0x3d')]?_0x4d5bb8['attributes']:_0x4f1d21['model'];if(!_0xd1d754[_0x3906('0x37')][_0x3906('0x59')](_0x3906('0x5a'))){_0x4d5bb8[_0x3906('0x20')]=qs[_0x3906('0x20')](_0xd1d754[_0x3906('0x37')][_0x3906('0x20')]);_0x4d5bb8['offset']=qs[_0x3906('0x22')](_0xd1d754['query']['offset']);}_0x4d5bb8[_0x3906('0x3e')]=qs[_0x3906('0x3f')](_0xd1d754[_0x3906('0x37')]['sort']);_0x4d5bb8[_0x3906('0x40')]=qs[_0x3906('0x39')](_[_0x3906('0x41')](_0xd1d754['query'],_0x4f1d21[_0x3906('0x39')]));_0x4d5bb8[_0x3906('0x6a')]=!![];if(_0xd1d754['query']['filter']){_0x4d5bb8[_0x3906('0x40')]=_[_0x3906('0x42')](_0x4d5bb8[_0x3906('0x40')],{'$or':_[_0x3906('0x30')](_0x4d5bb8[_0x3906('0x3b')],function(_0x54e002){var _0x3d2909={};_0x3d2909[_0x54e002]={'$like':'%'+_0xd1d754[_0x3906('0x37')][_0x3906('0x44')]+'%'};return _0x3d2909;})});}_0x4d5bb8=_[_0x3906('0x42')]({},_0x4d5bb8,_0xd1d754['options']);return _0x3d168f['getContacts'](_0x4d5bb8);}})['then'](function(_0x3259ad){if(!_[_0x3906('0x6f')](_0x3259ad)){var _0x1bccc2=toCsv(_0x3259ad);var _0x3f58a2=Date['now']();fs[_0x3906('0x70')](util[_0x3906('0x6d')](_0x3906('0x71'),_0x3d168f['id'],_0x3f58a2),_0x1bccc2);_0x1b253d[_0x3906('0x72')](_0x3906('0x73'),'attachment;\x20filename='+util[_0x3906('0x6d')](_0x3906('0x74'),_0x3d168f['id'],_0x3f58a2));_0x1b253d['setHeader'](_0x3906('0x75'),_0x3906('0x76'));return _0x1b253d[_0x3906('0x77')](util[_0x3906('0x6d')](_0x3906('0x71'),_0x3d168f['id'],_0x3f58a2));}else{return _0x1b253d[_0x3906('0x1b')](0xcc);}})[_0x3906('0x4a')](handleError(_0x1b253d,null));};exports['addCustomField']=function(_0x3ad828,_0x1acee1,_0x4e23a0){var _0x28b4af;delete _0x3ad828[_0x3906('0x53')]['id'];return db[_0x3906('0x31')]['findOne']({'where':{'id':_0x3ad828[_0x3906('0x4c')]['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x1acee1,null))[_0x3906('0x28')](function(_0x31f44d){if(_0x31f44d){return db[_0x3906('0x78')][_0x3906('0x79')](function(_0x499da3){return db[_0x3906('0x68')]['create'](_0x3ad828[_0x3906('0x53')],{'transaction':_0x499da3})['then'](function(_0x24d817){_0x28b4af=_0x24d817;return _0x31f44d['addCustomFields'](_0x24d817,{'transaction':_0x499da3});})[_0x3906('0x28')](function(){var _0x520294={'type':db[_0x3906('0x7a')]['TEXT'],'transaction':_0x499da3};switch(_0x3ad828[_0x3906('0x53')][_0x3906('0x34')]){case _0x3906('0x7b'):_0x520294[_0x3906('0x34')]=db['Sequelize'][_0x3906('0x7c')];break;case _0x3906('0x7d'):_0x520294['type']=db['Sequelize'][_0x3906('0x7e')];break;case'switch':_0x520294[_0x3906('0x34')]=db['Sequelize']['BOOLEAN'];_0x520294[_0x3906('0x7f')]=![];break;default:}return db[_0x3906('0x78')][_0x3906('0x80')][_0x3906('0x81')](_0x3906('0x82'),util[_0x3906('0x6d')](_0x3906('0x83'),_0x28b4af['id']),_0x520294);})['then'](function(){return _0x28b4af;});});}})[_0x3906('0x28')](respondWithResult(_0x1acee1,null))[_0x3906('0x4a')](handleError(_0x1acee1,null));};exports[_0x3906('0x84')]=function(_0x4cf92a,_0x3a9a27,_0x3eec8a){var _0x440d67={};var _0xfe3aa5={};var _0xfc86d2;var _0x4553f6;return db[_0x3906('0x31')][_0x3906('0x58')]({'where':{'id':_0x4cf92a[_0x3906('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3a9a27,null))['then'](function(_0x46b763){if(_0x46b763){_0xfc86d2=_0x46b763;_0xfe3aa5['model']=_[_0x3906('0x38')](db[_0x3906('0x68')][_0x3906('0x32')]);_0xfe3aa5['query']=_[_0x3906('0x38')](_0x4cf92a[_0x3906('0x37')]);_0xfe3aa5[_0x3906('0x39')]=_[_0x3906('0x3a')](_0xfe3aa5[_0x3906('0x36')],_0xfe3aa5[_0x3906('0x37')]);_0x440d67['attributes']=_[_0x3906('0x3a')](_0xfe3aa5[_0x3906('0x36')],qs[_0x3906('0x3c')](_0x4cf92a['query'][_0x3906('0x3c')]));_0x440d67[_0x3906('0x3b')]=_0x440d67[_0x3906('0x3b')][_0x3906('0x3d')]?_0x440d67[_0x3906('0x3b')]:_0xfe3aa5[_0x3906('0x36')];_0x440d67[_0x3906('0x3e')]=qs['sort'](_0x4cf92a[_0x3906('0x37')][_0x3906('0x3f')]);_0x440d67[_0x3906('0x40')]=qs[_0x3906('0x39')](_['pick'](_0x4cf92a[_0x3906('0x37')],_0xfe3aa5[_0x3906('0x39')]));_0x440d67[_0x3906('0x40')]=_[_0x3906('0x42')](_0x440d67[_0x3906('0x40')],{'$or':[{'ListId':_0x46b763['id']},{'ListId':null}]});if(_0x4cf92a['query'][_0x3906('0x44')]){_0x440d67[_0x3906('0x40')]=_['merge'](_0x440d67['where'],{'$or':_[_0x3906('0x30')](_0x440d67[_0x3906('0x3b')],function(_0x5a0d0b){var _0x281c52={};_0x281c52[_0x5a0d0b]={'$like':'%'+_0x4cf92a[_0x3906('0x37')]['filter']+'%'};return _0x281c52;})});}_0x440d67=_[_0x3906('0x42')]({},_0x440d67,_0x4cf92a[_0x3906('0x45')]);return db['CmCustomField'][_0x3906('0x85')](_0x440d67);}})[_0x3906('0x28')](respondWithResult(_0x3a9a27,null))[_0x3906('0x4a')](handleError(_0x3a9a27,null));};exports[_0x3906('0x86')]=function(_0x47f595,_0x3e8854,_0x42bd0d){return db[_0x3906('0x31')]['find']({'where':{'id':_0x47f595['params']['id']}})['then'](handleEntityNotFound(_0x3e8854,null))[_0x3906('0x28')](function(_0x45e3c8){if(_0x45e3c8){return _0x45e3c8[_0x3906('0x86')](_0x47f595[_0x3906('0x53')][_0x3906('0x5c')],_[_0x3906('0x64')](_0x47f595[_0x3906('0x53')],[_0x3906('0x5c'),'id'])||{})['spread'](function(_0x45e098){for(var _0x11d891=0x0;_0x11d891<_0x47f595[_0x3906('0x53')][_0x3906('0x5c')][_0x3906('0x3d')];_0x11d891+=0x1){socket[_0x3906('0x87')](_0x3906('0x88'),{'UserId':Number(_0x47f595[_0x3906('0x53')][_0x3906('0x5c')][_0x11d891]),'CmListId':Number(_0x47f595[_0x3906('0x4c')]['id'])});}return _0x45e098;});}})[_0x3906('0x28')](respondWithResult(_0x3e8854,null))[_0x3906('0x4a')](handleError(_0x3e8854,null));};exports[_0x3906('0x89')]=function(_0x50a7ea,_0x2ac4ae,_0x3f44f8){return db[_0x3906('0x31')]['find']({'where':{'id':_0x50a7ea['params']['id']}})[_0x3906('0x28')](handleEntityNotFound(_0x2ac4ae,null))[_0x3906('0x28')](function(_0x52556b){if(_0x52556b){return _0x52556b[_0x3906('0x89')](_0x50a7ea[_0x3906('0x37')]['ids'])[_0x3906('0x28')](function(){if(_[_0x3906('0x60')](_0x50a7ea[_0x3906('0x37')]['ids'])){for(var _0x26d67c=0x0;_0x26d67c<_0x50a7ea[_0x3906('0x37')][_0x3906('0x5c')][_0x3906('0x3d')];_0x26d67c+=0x1){socket[_0x3906('0x87')](_0x3906('0x8a'),{'UserId':Number(_0x50a7ea[_0x3906('0x37')][_0x3906('0x5c')][_0x26d67c]),'CmListId':Number(_0x50a7ea[_0x3906('0x4c')]['id'])});}}else{socket[_0x3906('0x87')](_0x3906('0x8a'),{'UserId':Number(_0x50a7ea['query'][_0x3906('0x5c')]),'CmListId':Number(_0x50a7ea[_0x3906('0x4c')]['id'])});}});}})[_0x3906('0x28')](respondWithStatusCode(_0x2ac4ae,null))[_0x3906('0x4a')](handleError(_0x2ac4ae,null));};exports[_0x3906('0x8b')]=function(_0x2d2431,_0x247fbf,_0x1fb93f){var _0x42ee8b={};var _0x3a0e1e={};var _0x368468;var _0x3eed34;return db[_0x3906('0x31')][_0x3906('0x58')]({'where':{'id':_0x2d2431[_0x3906('0x4c')]['id']}})['then'](handleEntityNotFound(_0x247fbf,null))[_0x3906('0x28')](function(_0xe7e09b){if(_0xe7e09b){_0x368468=_0xe7e09b;_0x3a0e1e[_0x3906('0x36')]=_[_0x3906('0x38')](db[_0x3906('0x8c')][_0x3906('0x32')]);_0x3a0e1e[_0x3906('0x37')]=_[_0x3906('0x38')](_0x2d2431[_0x3906('0x37')]);_0x3a0e1e['filters']=_[_0x3906('0x3a')](_0x3a0e1e['model'],_0x3a0e1e[_0x3906('0x37')]);_0x42ee8b[_0x3906('0x3b')]=_[_0x3906('0x3a')](_0x3a0e1e[_0x3906('0x36')],qs['fields'](_0x2d2431[_0x3906('0x37')][_0x3906('0x3c')]));_0x42ee8b[_0x3906('0x3b')]=_0x42ee8b[_0x3906('0x3b')][_0x3906('0x3d')]?_0x42ee8b[_0x3906('0x3b')]:_0x3a0e1e[_0x3906('0x36')];_0x42ee8b[_0x3906('0x3e')]=qs[_0x3906('0x3f')](_0x2d2431['query'][_0x3906('0x3f')]);_0x42ee8b[_0x3906('0x40')]=qs[_0x3906('0x39')](_[_0x3906('0x41')](_0x2d2431[_0x3906('0x37')],_0x3a0e1e[_0x3906('0x39')]));if(_0x2d2431[_0x3906('0x37')][_0x3906('0x44')]){_0x42ee8b[_0x3906('0x40')]=_[_0x3906('0x42')](_0x42ee8b[_0x3906('0x40')],{'$or':_[_0x3906('0x30')](_0x42ee8b['attributes'],function(_0x3e071d){var _0x1a8e31={};_0x1a8e31[_0x3e071d]={'$like':'%'+_0x2d2431[_0x3906('0x37')][_0x3906('0x44')]+'%'};return _0x1a8e31;})});}_0x42ee8b=_[_0x3906('0x42')]({},_0x42ee8b,_0x2d2431['options']);return _0x368468['getAgents'](_0x42ee8b);}})[_0x3906('0x28')](function(_0x3cad89){if(_0x3cad89){_0x3eed34=_0x3cad89[_0x3906('0x3d')];if(!_0x2d2431['query'][_0x3906('0x59')](_0x3906('0x5a'))){_0x42ee8b['limit']=qs[_0x3906('0x20')](_0x2d2431[_0x3906('0x37')]['limit']);_0x42ee8b[_0x3906('0x22')]=qs['offset'](_0x2d2431['query'][_0x3906('0x22')]);}return _0x368468[_0x3906('0x8b')](_0x42ee8b);}})[_0x3906('0x28')](function(_0x25f53f){if(_0x25f53f){return _0x25f53f?{'count':_0x3eed34,'rows':_0x25f53f}:null;}})[_0x3906('0x28')](respondWithResult(_0x247fbf,null))[_0x3906('0x4a')](handleError(_0x247fbf,null));}; \ No newline at end of file +var _0x05c3=['ids','addContacts','CmContact','tags','isArray','length','join','push','omit','dataValues','errors','message','CmCustomField','CustomFields','format','raw','getContactsCsv','cf_%d','getContacts','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','merge','includeAll','include','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','options','removeDispositions'];(function(_0x294e67,_0xdfb197){var _0xdeb282=function(_0x1c3c86){while(--_0x1c3c86){_0x294e67['push'](_0x294e67['shift']());}};_0xdeb282(++_0xdfb197);}(_0x05c3,0xbd));var _0x305c=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x05c3[_0x58efa6];return _0x5d643c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x305c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x305c('0x1'));var moment=require(_0x305c('0x2'));var BPromise=require(_0x305c('0x3'));var Mustache=require('mustache');var util=require(_0x305c('0x4'));var path=require(_0x305c('0x5'));var sox=require(_0x305c('0x6'));var csv=require(_0x305c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x305c('0x8'));var _=require(_0x305c('0x9'));var squel=require('squel');var crypto=require(_0x305c('0xa'));var jsforce=require(_0x305c('0xb'));var deskjs=require(_0x305c('0xc'));var toCsv=require(_0x305c('0x7'));var querystring=require(_0x305c('0xd'));var Papa=require('papaparse');var Redis=require(_0x305c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x305c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x305c('0x10'))(_0x305c('0x11'));var utils=require(_0x305c('0x12'));var config=require(_0x305c('0x13'));var licenseUtil=require(_0x305c('0x14'));var db=require(_0x305c('0x15'))['db'];config[_0x305c('0x16')]=_[_0x305c('0x17')](config[_0x305c('0x16')],{'host':_0x305c('0x18'),'port':0x18eb});var socket=require(_0x305c('0x19'))(new Redis(config[_0x305c('0x16')]));require('./cmList.socket')[_0x305c('0x1a')](socket);function respondWithStatusCode(_0x17bce0,_0xc4cf66){_0xc4cf66=_0xc4cf66||0xcc;return function(_0x173ac0){if(_0x173ac0){return _0x17bce0['sendStatus'](_0xc4cf66);}return _0x17bce0[_0x305c('0x1b')](_0xc4cf66)['end']();};}function respondWithResult(_0x5df231,_0x1f082c){_0x1f082c=_0x1f082c||0xc8;return function(_0x20ad72){if(_0x20ad72){return _0x5df231[_0x305c('0x1b')](_0x1f082c)[_0x305c('0x1c')](_0x20ad72);}};}function respondWithFilteredResult(_0xde9500,_0x560023){return function(_0x112fd1){if(_0x112fd1){var _0x432485=typeof _0x560023['offset']===_0x305c('0x1d')&&typeof _0x560023['limit']===_0x305c('0x1d');var _0x24a44c=_0x112fd1[_0x305c('0x1e')];var _0x3adb93=_0x432485?0x0:_0x560023['offset'];var _0x1f0b46=_0x432485?_0x112fd1[_0x305c('0x1e')]:_0x560023[_0x305c('0x1f')]+_0x560023[_0x305c('0x20')];var _0x35410e;if(_0x1f0b46>=_0x24a44c){_0x1f0b46=_0x24a44c;_0x35410e=0xc8;}else{_0x35410e=0xce;}_0xde9500[_0x305c('0x1b')](_0x35410e);return _0xde9500[_0x305c('0x21')]('Content-Range',_0x3adb93+'-'+_0x1f0b46+'/'+_0x24a44c)[_0x305c('0x1c')](_0x112fd1);}return null;};}function patchUpdates(_0x43430a){return function(_0x5bc985){try{jsonpatch[_0x305c('0x22')](_0x5bc985,_0x43430a,!![]);}catch(_0x587ef0){return BPromise[_0x305c('0x23')](_0x587ef0);}return _0x5bc985[_0x305c('0x24')]();};}function saveUpdates(_0x2712d5,_0x2b3bf6){return function(_0x4a5bd4){if(_0x4a5bd4){return _0x4a5bd4[_0x305c('0x25')](_0x2712d5)[_0x305c('0x26')](function(_0x28808d){return _0x28808d;});}return null;};}function removeEntity(_0x281201,_0x3bec31){return function(_0x469426){if(_0x469426){return _0x469426[_0x305c('0x27')]()['then'](function(){var _0x1a8757=_0x469426[_0x305c('0x28')]({'plain':!![]});var _0x50a287=_0x305c('0x29');return db[_0x305c('0x2a')][_0x305c('0x27')]({'where':{'type':_0x50a287,'resourceId':_0x1a8757['id']}})[_0x305c('0x26')](function(){return _0x469426;});})[_0x305c('0x26')](function(){_0x281201['status'](0xcc)[_0x305c('0x2b')]();});}};}function handleEntityNotFound(_0x2c5c62,_0x2561fa){return function(_0x1c00b3){if(!_0x1c00b3){_0x2c5c62[_0x305c('0x2c')](0x194);}return _0x1c00b3;};}function handleError(_0x28e00c,_0x48caf4){_0x48caf4=_0x48caf4||0x1f4;return function(_0x220a72){logger[_0x305c('0x2d')](_0x220a72[_0x305c('0x2e')]);if(_0x220a72['name']){delete _0x220a72['name'];}_0x28e00c[_0x305c('0x1b')](_0x48caf4)[_0x305c('0x2f')](_0x220a72);};}exports[_0x305c('0x30')]=function(_0x2204b1,_0x5ae28b){var _0x4615d7={},_0x5b70b2={},_0x5da8a6={'count':0x0,'rows':[]};var _0x5bfb41=_[_0x305c('0x31')](db[_0x305c('0x32')][_0x305c('0x33')],function(_0x3fcb3b){return{'name':_0x3fcb3b[_0x305c('0x34')],'type':_0x3fcb3b['type'][_0x305c('0x35')]};});_0x5b70b2[_0x305c('0x36')]=_[_0x305c('0x31')](_0x5bfb41,'name');_0x5b70b2[_0x305c('0x37')]=_[_0x305c('0x38')](_0x2204b1[_0x305c('0x37')]);_0x5b70b2[_0x305c('0x39')]=_[_0x305c('0x3a')](_0x5b70b2[_0x305c('0x36')],_0x5b70b2[_0x305c('0x37')]);_0x4615d7[_0x305c('0x3b')]=_['intersection'](_0x5b70b2['model'],qs[_0x305c('0x3c')](_0x2204b1['query'][_0x305c('0x3c')]));_0x4615d7[_0x305c('0x3b')]=_0x4615d7[_0x305c('0x3b')]['length']?_0x4615d7['attributes']:_0x5b70b2[_0x305c('0x36')];if(!_0x2204b1['query']['hasOwnProperty'](_0x305c('0x3d'))){_0x4615d7['limit']=qs[_0x305c('0x20')](_0x2204b1[_0x305c('0x37')][_0x305c('0x20')]);_0x4615d7['offset']=qs[_0x305c('0x1f')](_0x2204b1[_0x305c('0x37')]['offset']);}_0x4615d7[_0x305c('0x3e')]=qs[_0x305c('0x3f')](_0x2204b1[_0x305c('0x37')][_0x305c('0x3f')]);_0x4615d7[_0x305c('0x40')]=qs[_0x305c('0x39')](_[_0x305c('0x41')](_0x2204b1[_0x305c('0x37')],_0x5b70b2[_0x305c('0x39')]),_0x5bfb41);if(_0x2204b1['query'][_0x305c('0x42')]){_0x4615d7[_0x305c('0x40')]=_['merge'](_0x4615d7[_0x305c('0x40')],{'$or':_[_0x305c('0x31')](_0x5bfb41,function(_0x12823f){if(_0x12823f[_0x305c('0x43')]!=='VIRTUAL'){var _0x98163a={};_0x98163a[_0x12823f['name']]={'$like':'%'+_0x2204b1[_0x305c('0x37')][_0x305c('0x42')]+'%'};return _0x98163a;}})});}_0x4615d7=_[_0x305c('0x44')]({},_0x4615d7,_0x2204b1['options']);var _0x3eb0af={'where':_0x4615d7[_0x305c('0x40')]};return db['CmList'][_0x305c('0x1e')](_0x3eb0af)['then'](function(_0x295397){_0x5da8a6[_0x305c('0x1e')]=_0x295397;if(_0x2204b1['query'][_0x305c('0x45')]){_0x4615d7[_0x305c('0x46')]=[{'all':!![]}];}return db[_0x305c('0x32')]['findAll'](_0x4615d7);})[_0x305c('0x26')](function(_0x32c260){_0x5da8a6[_0x305c('0x47')]=_0x32c260;return _0x5da8a6;})[_0x305c('0x26')](respondWithFilteredResult(_0x5ae28b,_0x4615d7))[_0x305c('0x48')](handleError(_0x5ae28b,null));};exports[_0x305c('0x49')]=function(_0x248c79,_0x14566d){var _0x2c1f1e={'raw':![],'where':{'id':_0x248c79[_0x305c('0x4a')]['id']}},_0x39521f={};_0x39521f[_0x305c('0x36')]=_['keys'](db['CmList'][_0x305c('0x33')]);_0x39521f[_0x305c('0x37')]=_['keys'](_0x248c79[_0x305c('0x37')]);_0x39521f[_0x305c('0x39')]=_['intersection'](_0x39521f[_0x305c('0x36')],_0x39521f[_0x305c('0x37')]);_0x2c1f1e[_0x305c('0x3b')]=_[_0x305c('0x3a')](_0x39521f[_0x305c('0x36')],qs[_0x305c('0x3c')](_0x248c79[_0x305c('0x37')][_0x305c('0x3c')]));_0x2c1f1e[_0x305c('0x3b')]=_0x2c1f1e[_0x305c('0x3b')]['length']?_0x2c1f1e['attributes']:_0x39521f[_0x305c('0x36')];if(_0x248c79['query']['includeAll']){_0x2c1f1e[_0x305c('0x46')]=[{'all':!![]}];}_0x2c1f1e=_[_0x305c('0x44')]({},_0x2c1f1e,_0x248c79['options']);return db[_0x305c('0x32')][_0x305c('0x4b')](_0x2c1f1e)[_0x305c('0x26')](handleEntityNotFound(_0x14566d,null))[_0x305c('0x26')](respondWithResult(_0x14566d,null))[_0x305c('0x48')](handleError(_0x14566d,null));};exports['create']=function(_0x2a3eb7,_0x582117){return db[_0x305c('0x32')][_0x305c('0x4c')](_0x2a3eb7['body'],{})[_0x305c('0x26')](function(_0x32e7f6){var _0x113937=_0x2a3eb7['user'][_0x305c('0x28')]({'plain':!![]});if(!_0x113937)throw new Error(_0x305c('0x4d'));if(_0x113937[_0x305c('0x4e')]==='user'){var _0x4822db=_0x32e7f6['get']({'plain':!![]});var _0x53d990=_0x305c('0x29');return db['UserProfileSection'][_0x305c('0x4b')]({'where':{'name':_0x53d990,'userProfileId':_0x113937[_0x305c('0x4f')]},'raw':!![]})[_0x305c('0x26')](function(_0x28df22){if(_0x28df22&&_0x28df22[_0x305c('0x50')]===0x0){return db[_0x305c('0x2a')][_0x305c('0x4c')]({'name':_0x4822db[_0x305c('0x51')],'resourceId':_0x4822db['id'],'type':_0x28df22[_0x305c('0x51')],'sectionId':_0x28df22['id']},{})['then'](function(){return _0x32e7f6;});}else{return _0x32e7f6;}})[_0x305c('0x48')](function(_0x54b900){logger[_0x305c('0x2d')](_0x305c('0x52'),_0x54b900);throw _0x54b900;});}return _0x32e7f6;})[_0x305c('0x26')](respondWithResult(_0x582117,0xc9))[_0x305c('0x48')](handleError(_0x582117,null));};exports[_0x305c('0x25')]=function(_0x14a260,_0x23e8b8){if(_0x14a260[_0x305c('0x53')]['id']){delete _0x14a260[_0x305c('0x53')]['id'];}return db[_0x305c('0x32')][_0x305c('0x4b')]({'where':{'id':_0x14a260[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x23e8b8,null))[_0x305c('0x26')](saveUpdates(_0x14a260['body'],null))[_0x305c('0x26')](respondWithResult(_0x23e8b8,null))[_0x305c('0x48')](handleError(_0x23e8b8,null));};exports['destroy']=function(_0x3ef18c,_0x4f82f6){return db[_0x305c('0x32')][_0x305c('0x4b')]({'where':{'id':_0x3ef18c['params']['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x4f82f6,null))[_0x305c('0x26')](removeEntity(_0x4f82f6,null))[_0x305c('0x48')](handleError(_0x4f82f6,null));};exports[_0x305c('0x54')]=function(_0x7b536b,_0x2209af){return db[_0x305c('0x32')][_0x305c('0x54')]()[_0x305c('0x26')](respondWithResult(_0x2209af,null))['catch'](handleError(_0x2209af,null));};exports[_0x305c('0x55')]=function(_0xd0bb48,_0xae0a85,_0x4c9b43){if(_0xd0bb48[_0x305c('0x53')]['id']){delete _0xd0bb48[_0x305c('0x53')]['id'];}return db['CmList'][_0x305c('0x4b')]({'where':{'id':_0xd0bb48[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0xae0a85,null))[_0x305c('0x26')](function(_0x9a88d0){if(_0x9a88d0){_0xd0bb48[_0x305c('0x53')][_0x305c('0x56')]=_0x9a88d0['id'];return db[_0x305c('0x57')][_0x305c('0x4c')](_0xd0bb48[_0x305c('0x53')]);}})[_0x305c('0x26')](respondWithResult(_0xae0a85,null))[_0x305c('0x48')](handleError(_0xae0a85,null));};exports[_0x305c('0x58')]=function(_0x201b12,_0x4d126e,_0x332d50){var _0x1bf802={'raw':![],'where':{}};var _0x2158a0={};var _0x493250={'count':0x0,'rows':[]};return db[_0x305c('0x32')][_0x305c('0x59')]({'where':{'id':_0x201b12[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x4d126e,null))['then'](function(_0x4fd5d9){if(_0x4fd5d9){_0x2158a0['model']=_['keys'](db['Disposition']['rawAttributes']);_0x2158a0[_0x305c('0x37')]=_[_0x305c('0x38')](_0x201b12['query']);_0x2158a0[_0x305c('0x39')]=_['intersection'](_0x2158a0[_0x305c('0x36')],_0x2158a0[_0x305c('0x37')]);_0x1bf802['attributes']=_[_0x305c('0x3a')](_0x2158a0['model'],qs[_0x305c('0x3c')](_0x201b12[_0x305c('0x37')][_0x305c('0x3c')]));_0x1bf802[_0x305c('0x3b')]=_0x1bf802[_0x305c('0x3b')]['length']?_0x1bf802[_0x305c('0x3b')]:_0x2158a0[_0x305c('0x36')];if(!_0x201b12[_0x305c('0x37')][_0x305c('0x5a')]('nolimit')){_0x1bf802['limit']=qs[_0x305c('0x20')](_0x201b12[_0x305c('0x37')][_0x305c('0x20')]);_0x1bf802[_0x305c('0x1f')]=qs[_0x305c('0x1f')](_0x201b12[_0x305c('0x37')][_0x305c('0x1f')]);}_0x1bf802[_0x305c('0x3e')]=qs[_0x305c('0x3f')](_0x201b12[_0x305c('0x37')][_0x305c('0x3f')]);_0x1bf802['where']=qs[_0x305c('0x39')](_[_0x305c('0x41')](_0x201b12['query'],_0x2158a0[_0x305c('0x39')]));_0x1bf802[_0x305c('0x40')][_0x305c('0x56')]=_0x4fd5d9['id'];if(_0x201b12[_0x305c('0x37')][_0x305c('0x42')]){_0x1bf802[_0x305c('0x40')]=_[_0x305c('0x44')](_0x1bf802[_0x305c('0x40')],{'$or':_[_0x305c('0x31')](_0x1bf802['attributes'],function(_0x3b50e2){var _0x38b0c9={};_0x38b0c9[_0x3b50e2]={'$like':'%'+_0x201b12['query'][_0x305c('0x42')]+'%'};return _0x38b0c9;})});}_0x1bf802=_['merge']({},_0x1bf802,_0x201b12[_0x305c('0x5b')]);return db['Disposition'][_0x305c('0x1e')]({'where':_0x1bf802[_0x305c('0x40')]})[_0x305c('0x26')](function(_0x1aae0e){_0x493250['count']=_0x1aae0e;if(_0x201b12['query'][_0x305c('0x45')]){_0x1bf802['include']=[{'all':!![]}];}return db[_0x305c('0x57')]['findAll'](_0x1bf802);})[_0x305c('0x26')](function(_0x1cabe1){_0x493250[_0x305c('0x47')]=_0x1cabe1;return _0x493250;});}})['then'](respondWithFilteredResult(_0x4d126e,_0x1bf802))['catch'](handleError(_0x4d126e,null));};exports[_0x305c('0x5c')]=function(_0x390a04,_0x1f5af9,_0x15bf3c){return db['CmList'][_0x305c('0x4b')]({'where':{'id':_0x390a04[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x1f5af9,null))[_0x305c('0x26')](function(_0x5cbfda){if(_0x5cbfda){return _0x5cbfda[_0x305c('0x5c')](_0x390a04[_0x305c('0x37')][_0x305c('0x5d')]);}})[_0x305c('0x26')](respondWithStatusCode(_0x1f5af9,null))[_0x305c('0x48')](handleError(_0x1f5af9,null));};exports[_0x305c('0x5e')]=function(_0x6726c5,_0x593f4f,_0x53fef7){return db[_0x305c('0x32')]['find']({'where':{'id':_0x6726c5[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x593f4f,null))[_0x305c('0x26')](function(_0x4c816b){if(_0x4c816b){var _0x1144f2=[];var _0x1fd96a={'success':[],'errors':[]};return db[_0x305c('0x5f')][_0x305c('0x54')]()['then'](function(_0x38f4e9){if(_0x6726c5[_0x305c('0x53')][_0x305c('0x60')]&&_[_0x305c('0x61')](_0x6726c5['body'][_0x305c('0x60')])){if(_0x6726c5[_0x305c('0x53')]['tags'][_0x305c('0x62')]){_0x6726c5['body']['tags']=_0x6726c5['body'][_0x305c('0x60')][_0x305c('0x63')](';')+';';}else{_0x6726c5[_0x305c('0x53')][_0x305c('0x60')]=null;}}else{_0x6726c5['body']['tags']=null;}if(_0x6726c5[_0x305c('0x53')]&&_[_0x305c('0x61')](_0x6726c5[_0x305c('0x53')])){for(var _0x1c2912=0x0;_0x1c2912<_0x6726c5[_0x305c('0x53')][_0x305c('0x62')];_0x1c2912+=0x1){_0x6726c5[_0x305c('0x53')][_0x1c2912][_0x305c('0x56')]=_0x6726c5[_0x305c('0x4a')]['id'];_0x1144f2[_0x305c('0x64')](_0x6726c5[_0x305c('0x53')][_0x1c2912]);}return BPromise['each'](_0x1144f2,function(_0x1737f6){return db[_0x305c('0x5f')][_0x305c('0x4c')](_[_0x305c('0x65')](_0x1737f6,['ids','id'])||{},{'fields':_[_0x305c('0x38')](_0x38f4e9),'raw':!![]})[_0x305c('0x26')](function(_0x26a186){_0x1fd96a['success'][_0x305c('0x64')](_0x26a186[_0x305c('0x66')]);})[_0x305c('0x48')](function(_0x3c48af){_0x1fd96a[_0x305c('0x67')][_0x305c('0x64')]({'data':_0x1737f6,'error':_0x3c48af[_0x305c('0x68')]});});})[_0x305c('0x26')](function(_0x1bb3da){return _0x1fd96a;})[_0x305c('0x48')](function(_0x3db33d){return _0x3db33d;});}else{_0x593f4f[_0x305c('0x1b')](0x190)[_0x305c('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x305c('0x26')](respondWithResult(_0x593f4f,null))[_0x305c('0x48')](handleError(_0x593f4f,null));};exports['getContacts']=function(_0x374c10,_0x4c4f0f,_0x371b40){var _0x400ff9;return db[_0x305c('0x32')]['find']({'where':{'id':_0x374c10[_0x305c('0x4a')]['id']},'include':[{'model':db[_0x305c('0x69')],'as':'CustomFields'}]})[_0x305c('0x26')](handleEntityNotFound(_0x4c4f0f,null))[_0x305c('0x26')](function(_0x1e1915){if(_0x1e1915){_0x400ff9=_0x1e1915;return db[_0x305c('0x5f')][_0x305c('0x33')];}})[_0x305c('0x26')](function(_0x499eb5){if(_0x499eb5){var _0x5e4a76={};var _0x156663={};_0x156663[_0x305c('0x36')]=_['concat'](_[_0x305c('0x38')](_0x499eb5),_['map'](_0x400ff9[_0x305c('0x6a')],function(_0x378eba){return util[_0x305c('0x6b')]('cf_%d',_0x378eba['id']);}));_0x156663[_0x305c('0x37')]=_['keys'](_0x374c10[_0x305c('0x37')]);_0x156663['filters']=_['intersection'](_0x156663['model'],_0x156663[_0x305c('0x37')]);_0x5e4a76[_0x305c('0x3b')]=_[_0x305c('0x3a')](_0x156663[_0x305c('0x36')],qs[_0x305c('0x3c')](_0x374c10[_0x305c('0x37')][_0x305c('0x3c')]));_0x5e4a76['attributes']=_0x5e4a76[_0x305c('0x3b')][_0x305c('0x62')]?_0x5e4a76['attributes']:_0x156663[_0x305c('0x36')];if(!_0x374c10[_0x305c('0x37')]['hasOwnProperty'](_0x305c('0x3d'))){_0x5e4a76[_0x305c('0x20')]=qs[_0x305c('0x20')](_0x374c10[_0x305c('0x37')]['limit']);_0x5e4a76['offset']=qs[_0x305c('0x1f')](_0x374c10[_0x305c('0x37')][_0x305c('0x1f')]);}_0x5e4a76[_0x305c('0x3e')]=qs[_0x305c('0x3f')](_0x374c10[_0x305c('0x37')][_0x305c('0x3f')]);_0x5e4a76[_0x305c('0x40')]=qs['filters'](_[_0x305c('0x41')](_0x374c10['query'],_0x156663[_0x305c('0x39')]));_0x5e4a76[_0x305c('0x6c')]=!![];if(_0x374c10[_0x305c('0x37')][_0x305c('0x42')]){_0x5e4a76[_0x305c('0x40')]=_[_0x305c('0x44')](_0x5e4a76['where'],{'$or':_[_0x305c('0x31')](_0x5e4a76['attributes'],function(_0x31e292){var _0x292649={};_0x292649[_0x31e292]={'$like':'%'+_0x374c10[_0x305c('0x37')][_0x305c('0x42')]+'%'};return _0x292649;})});}_0x5e4a76=_[_0x305c('0x44')]({},_0x5e4a76,_0x374c10['options']);return _0x400ff9['getContacts'](_0x5e4a76);}})[_0x305c('0x26')](respondWithResult(_0x4c4f0f,null))['catch'](handleError(_0x4c4f0f,null));};exports[_0x305c('0x6d')]=function(_0x166c3d,_0x22fe55,_0x41feee){var _0x171ef1;return db[_0x305c('0x32')][_0x305c('0x4b')]({'where':{'id':_0x166c3d[_0x305c('0x4a')]['id']},'include':[{'model':db[_0x305c('0x69')],'as':_0x305c('0x6a')}]})['then'](handleEntityNotFound(_0x22fe55,null))[_0x305c('0x26')](function(_0x339960){if(_0x339960){_0x171ef1=_0x339960;return db[_0x305c('0x5f')][_0x305c('0x33')];}})[_0x305c('0x26')](function(_0x194aac){if(_0x194aac){var _0x3318c9={};var _0x216063={};_0x216063[_0x305c('0x36')]=_['concat'](_[_0x305c('0x38')](_0x194aac),_[_0x305c('0x31')](_0x171ef1['CustomFields'],function(_0x29da48){return util[_0x305c('0x6b')](_0x305c('0x6e'),_0x29da48['id']);}));_0x216063[_0x305c('0x37')]=_[_0x305c('0x38')](_0x166c3d[_0x305c('0x37')]);_0x216063['filters']=_[_0x305c('0x3a')](_0x216063[_0x305c('0x36')],_0x216063[_0x305c('0x37')]);_0x3318c9['attributes']=_[_0x305c('0x3a')](_0x216063[_0x305c('0x36')],qs[_0x305c('0x3c')](_0x166c3d['query'][_0x305c('0x3c')]));_0x3318c9['attributes']=_0x3318c9[_0x305c('0x3b')][_0x305c('0x62')]?_0x3318c9[_0x305c('0x3b')]:_0x216063[_0x305c('0x36')];if(!_0x166c3d[_0x305c('0x37')][_0x305c('0x5a')]('nolimit')){_0x3318c9['limit']=qs[_0x305c('0x20')](_0x166c3d[_0x305c('0x37')][_0x305c('0x20')]);_0x3318c9[_0x305c('0x1f')]=qs[_0x305c('0x1f')](_0x166c3d[_0x305c('0x37')][_0x305c('0x1f')]);}_0x3318c9['order']=qs['sort'](_0x166c3d[_0x305c('0x37')][_0x305c('0x3f')]);_0x3318c9['where']=qs[_0x305c('0x39')](_[_0x305c('0x41')](_0x166c3d[_0x305c('0x37')],_0x216063[_0x305c('0x39')]));_0x3318c9[_0x305c('0x6c')]=!![];if(_0x166c3d[_0x305c('0x37')]['filter']){_0x3318c9[_0x305c('0x40')]=_[_0x305c('0x44')](_0x3318c9[_0x305c('0x40')],{'$or':_['map'](_0x3318c9[_0x305c('0x3b')],function(_0x166fc4){var _0x2c7804={};_0x2c7804[_0x166fc4]={'$like':'%'+_0x166c3d['query'][_0x305c('0x42')]+'%'};return _0x2c7804;})});}_0x3318c9=_[_0x305c('0x44')]({},_0x3318c9,_0x166c3d[_0x305c('0x5b')]);return _0x171ef1[_0x305c('0x6f')](_0x3318c9);}})['then'](function(_0x28853b){if(!_['isEmpty'](_0x28853b)){var _0x6deee5=toCsv(_0x28853b);var _0x20da46=Date[_0x305c('0x70')]();fs[_0x305c('0x71')](util[_0x305c('0x6b')](_0x305c('0x72'),_0x171ef1['id'],_0x20da46),_0x6deee5);_0x22fe55['setHeader'](_0x305c('0x73'),'attachment;\x20filename='+util[_0x305c('0x6b')](_0x305c('0x74'),_0x171ef1['id'],_0x20da46));_0x22fe55[_0x305c('0x75')](_0x305c('0x76'),_0x305c('0x77'));return _0x22fe55[_0x305c('0x78')](util[_0x305c('0x6b')](_0x305c('0x72'),_0x171ef1['id'],_0x20da46));}else{return _0x22fe55[_0x305c('0x2c')](0xcc);}})['catch'](handleError(_0x22fe55,null));};exports['addCustomField']=function(_0x37e05a,_0x1f2902,_0x172b37){var _0x30ab6b;delete _0x37e05a[_0x305c('0x53')]['id'];return db[_0x305c('0x32')][_0x305c('0x59')]({'where':{'id':_0x37e05a[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x1f2902,null))[_0x305c('0x26')](function(_0x589e82){if(_0x589e82){return db[_0x305c('0x79')][_0x305c('0x7a')](function(_0x320afd){return db['CmCustomField'][_0x305c('0x4c')](_0x37e05a[_0x305c('0x53')],{'transaction':_0x320afd})['then'](function(_0x4a1cd2){_0x30ab6b=_0x4a1cd2;return _0x589e82['addCustomFields'](_0x4a1cd2,{'transaction':_0x320afd});})[_0x305c('0x26')](function(){var _0x1a5095={'type':db[_0x305c('0x7b')]['TEXT'],'transaction':_0x320afd};switch(_0x37e05a[_0x305c('0x53')][_0x305c('0x43')]){case _0x305c('0x7c'):_0x1a5095[_0x305c('0x43')]=db[_0x305c('0x7b')][_0x305c('0x7d')];break;case _0x305c('0x7e'):_0x1a5095[_0x305c('0x43')]=db['Sequelize'][_0x305c('0x7f')];break;case'switch':_0x1a5095[_0x305c('0x43')]=db['Sequelize'][_0x305c('0x80')];_0x1a5095['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x305c('0x81')](_0x305c('0x82'),util[_0x305c('0x6b')](_0x305c('0x83'),_0x30ab6b['id']),_0x1a5095);})['then'](function(){return _0x30ab6b;});});}})[_0x305c('0x26')](respondWithResult(_0x1f2902,null))['catch'](handleError(_0x1f2902,null));};exports[_0x305c('0x84')]=function(_0x46abe5,_0x2c7e71,_0x3b3589){var _0x3fbb89={};var _0x13ca63={};var _0x238a25;var _0x4f5485;return db[_0x305c('0x32')][_0x305c('0x59')]({'where':{'id':_0x46abe5[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x2c7e71,null))[_0x305c('0x26')](function(_0x59340e){if(_0x59340e){_0x238a25=_0x59340e;_0x13ca63['model']=_[_0x305c('0x38')](db[_0x305c('0x69')]['rawAttributes']);_0x13ca63[_0x305c('0x37')]=_[_0x305c('0x38')](_0x46abe5[_0x305c('0x37')]);_0x13ca63['filters']=_[_0x305c('0x3a')](_0x13ca63[_0x305c('0x36')],_0x13ca63[_0x305c('0x37')]);_0x3fbb89[_0x305c('0x3b')]=_['intersection'](_0x13ca63[_0x305c('0x36')],qs[_0x305c('0x3c')](_0x46abe5[_0x305c('0x37')][_0x305c('0x3c')]));_0x3fbb89['attributes']=_0x3fbb89[_0x305c('0x3b')][_0x305c('0x62')]?_0x3fbb89[_0x305c('0x3b')]:_0x13ca63[_0x305c('0x36')];_0x3fbb89[_0x305c('0x3e')]=qs[_0x305c('0x3f')](_0x46abe5[_0x305c('0x37')][_0x305c('0x3f')]);_0x3fbb89[_0x305c('0x40')]=qs[_0x305c('0x39')](_[_0x305c('0x41')](_0x46abe5[_0x305c('0x37')],_0x13ca63[_0x305c('0x39')]));_0x3fbb89['where']=_[_0x305c('0x44')](_0x3fbb89[_0x305c('0x40')],{'$or':[{'ListId':_0x59340e['id']},{'ListId':null}]});if(_0x46abe5[_0x305c('0x37')][_0x305c('0x42')]){_0x3fbb89[_0x305c('0x40')]=_[_0x305c('0x44')](_0x3fbb89[_0x305c('0x40')],{'$or':_[_0x305c('0x31')](_0x3fbb89[_0x305c('0x3b')],function(_0x3db671){var _0x507618={};_0x507618[_0x3db671]={'$like':'%'+_0x46abe5[_0x305c('0x37')][_0x305c('0x42')]+'%'};return _0x507618;})});}_0x3fbb89=_[_0x305c('0x44')]({},_0x3fbb89,_0x46abe5[_0x305c('0x5b')]);return db[_0x305c('0x69')][_0x305c('0x85')](_0x3fbb89);}})[_0x305c('0x26')](respondWithResult(_0x2c7e71,null))[_0x305c('0x48')](handleError(_0x2c7e71,null));};exports['addAgents']=function(_0x3ff864,_0x27b9bb,_0x2bc16a){return db[_0x305c('0x32')]['find']({'where':{'id':_0x3ff864[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x27b9bb,null))['then'](function(_0x475a52){if(_0x475a52){return _0x475a52[_0x305c('0x86')](_0x3ff864[_0x305c('0x53')][_0x305c('0x5d')],_['omit'](_0x3ff864[_0x305c('0x53')],['ids','id'])||{})['spread'](function(_0x3ad04c){for(var _0x1bc91d=0x0;_0x1bc91d<_0x3ff864[_0x305c('0x53')]['ids'][_0x305c('0x62')];_0x1bc91d+=0x1){socket['emit'](_0x305c('0x87'),{'UserId':Number(_0x3ff864['body']['ids'][_0x1bc91d]),'CmListId':Number(_0x3ff864[_0x305c('0x4a')]['id'])});}return _0x3ad04c;});}})[_0x305c('0x26')](respondWithResult(_0x27b9bb,null))[_0x305c('0x48')](handleError(_0x27b9bb,null));};exports[_0x305c('0x88')]=function(_0x23b9dd,_0x1b0138,_0xe5082e){return db[_0x305c('0x32')]['find']({'where':{'id':_0x23b9dd[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x1b0138,null))[_0x305c('0x26')](function(_0x34ccbb){if(_0x34ccbb){return _0x34ccbb[_0x305c('0x88')](_0x23b9dd[_0x305c('0x37')]['ids'])[_0x305c('0x26')](function(){if(_[_0x305c('0x61')](_0x23b9dd[_0x305c('0x37')][_0x305c('0x5d')])){for(var _0x38407a=0x0;_0x38407a<_0x23b9dd[_0x305c('0x37')][_0x305c('0x5d')][_0x305c('0x62')];_0x38407a+=0x1){socket[_0x305c('0x89')](_0x305c('0x8a'),{'UserId':Number(_0x23b9dd[_0x305c('0x37')][_0x305c('0x5d')][_0x38407a]),'CmListId':Number(_0x23b9dd[_0x305c('0x4a')]['id'])});}}else{socket[_0x305c('0x89')](_0x305c('0x8a'),{'UserId':Number(_0x23b9dd[_0x305c('0x37')][_0x305c('0x5d')]),'CmListId':Number(_0x23b9dd[_0x305c('0x4a')]['id'])});}});}})[_0x305c('0x26')](respondWithStatusCode(_0x1b0138,null))['catch'](handleError(_0x1b0138,null));};exports['getAgents']=function(_0x2bdfdc,_0x4d20a0,_0x2a6215){var _0x39f5c6={};var _0x660e3e={};var _0x51e03d;var _0x324b09;return db[_0x305c('0x32')]['findOne']({'where':{'id':_0x2bdfdc[_0x305c('0x4a')]['id']}})[_0x305c('0x26')](handleEntityNotFound(_0x4d20a0,null))[_0x305c('0x26')](function(_0x557a3b){if(_0x557a3b){_0x51e03d=_0x557a3b;_0x660e3e[_0x305c('0x36')]=_[_0x305c('0x38')](db[_0x305c('0x8b')][_0x305c('0x33')]);_0x660e3e[_0x305c('0x37')]=_[_0x305c('0x38')](_0x2bdfdc[_0x305c('0x37')]);_0x660e3e[_0x305c('0x39')]=_[_0x305c('0x3a')](_0x660e3e[_0x305c('0x36')],_0x660e3e[_0x305c('0x37')]);_0x39f5c6[_0x305c('0x3b')]=_[_0x305c('0x3a')](_0x660e3e['model'],qs[_0x305c('0x3c')](_0x2bdfdc[_0x305c('0x37')][_0x305c('0x3c')]));_0x39f5c6['attributes']=_0x39f5c6[_0x305c('0x3b')][_0x305c('0x62')]?_0x39f5c6[_0x305c('0x3b')]:_0x660e3e['model'];_0x39f5c6[_0x305c('0x3e')]=qs[_0x305c('0x3f')](_0x2bdfdc['query'][_0x305c('0x3f')]);_0x39f5c6['where']=qs['filters'](_['pick'](_0x2bdfdc['query'],_0x660e3e['filters']));if(_0x2bdfdc['query'][_0x305c('0x42')]){_0x39f5c6[_0x305c('0x40')]=_['merge'](_0x39f5c6[_0x305c('0x40')],{'$or':_[_0x305c('0x31')](_0x39f5c6['attributes'],function(_0x12d15e){var _0x410470={};_0x410470[_0x12d15e]={'$like':'%'+_0x2bdfdc[_0x305c('0x37')][_0x305c('0x42')]+'%'};return _0x410470;})});}_0x39f5c6=_[_0x305c('0x44')]({},_0x39f5c6,_0x2bdfdc[_0x305c('0x5b')]);return _0x51e03d[_0x305c('0x8c')](_0x39f5c6);}})[_0x305c('0x26')](function(_0x5ca07d){if(_0x5ca07d){_0x324b09=_0x5ca07d[_0x305c('0x62')];if(!_0x2bdfdc['query'][_0x305c('0x5a')](_0x305c('0x3d'))){_0x39f5c6[_0x305c('0x20')]=qs[_0x305c('0x20')](_0x2bdfdc[_0x305c('0x37')][_0x305c('0x20')]);_0x39f5c6[_0x305c('0x1f')]=qs[_0x305c('0x1f')](_0x2bdfdc[_0x305c('0x37')][_0x305c('0x1f')]);}return _0x51e03d[_0x305c('0x8c')](_0x39f5c6);}})[_0x305c('0x26')](function(_0x5c5da9){if(_0x5c5da9){return _0x5c5da9?{'count':_0x324b09,'rows':_0x5c5da9}:null;}})[_0x305c('0x26')](respondWithResult(_0x4d20a0,null))[_0x305c('0x48')](handleError(_0x4d20a0,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7e865d0..b6f730b 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x35371f,_0x12cd72){var _0x303f0e=function(_0x5b220a){while(--_0x5b220a){_0x35371f['push'](_0x35371f['shift']());}};_0x303f0e(++_0x12cd72);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x2c9056,_0x552f14){var _0x3e6959=function(_0x556247){while(--_0x556247){_0x2c9056['push'](_0x2c9056['shift']());}};_0x3e6959(++_0x552f14);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index bb4e212..bb3c75a 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 _0x70e0=['cm_lists','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes'];(function(_0x4a4b87,_0x1d7cd6){var _0xafd91a=function(_0xc0870a){while(--_0xc0870a){_0x4a4b87['push'](_0x4a4b87['shift']());}};_0xafd91a(++_0x1d7cd6);}(_0x70e0,0x17b));var _0x070e=function(_0x21ec18,_0x202d49){_0x21ec18=_0x21ec18-0x0;var _0xb40e34=_0x70e0[_0x21ec18];return _0xb40e34;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmList',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3ad88c,_0x3e6fb0){_0x3ad88c=_0x3ad88c-0x0;var _0x44b377=_0xd2ea[_0x3ad88c];return _0x44b377;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'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 5a3238b..e1f2439 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 _0x8528=['jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4dfb08,_0x1650ad){var _0xf00ce6=function(_0x2332e3){while(--_0x2332e3){_0x4dfb08['push'](_0x4dfb08['shift']());}};_0xf00ce6(++_0x1650ad);}(_0x8528,0x146));var _0x8852=function(_0x4cb24f,_0x2f64bd){_0x4cb24f=_0x4cb24f-0x0;var _0x3c73e3=_0x8528[_0x4cb24f];return _0x3c73e3;};'use strict';var _=require(_0x8852('0x0'));var util=require(_0x8852('0x1'));var moment=require(_0x8852('0x2'));var BPromise=require(_0x8852('0x3'));var rs=require(_0x8852('0x4'));var fs=require('fs');var Redis=require(_0x8852('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8852('0x6'));var logger=require(_0x8852('0x7'))(_0x8852('0x8'));var config=require(_0x8852('0x9'));var jayson=require(_0x8852('0xa'));var client=jayson[_0x8852('0xb')][_0x8852('0xc')]({'port':0x232a});config[_0x8852('0xd')]=_[_0x8852('0xe')](config['redis'],{'host':_0x8852('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8852('0x10'))[_0x8852('0x11')](socket);function respondWithRpcPromise(_0x1b3fa3,_0x15819e,_0x2b13a4){return new BPromise(function(_0x1c0ec5,_0x4a395b){return client['request'](_0x1b3fa3,_0x2b13a4)['then'](function(_0x561359){logger[_0x8852('0x12')](_0x8852('0x13'),_0x15819e,_0x8852('0x14'));logger[_0x8852('0x15')](_0x8852('0x16'),_0x15819e,_0x8852('0x14'),JSON[_0x8852('0x17')](_0x561359));if(_0x561359[_0x8852('0x18')]){if(_0x561359[_0x8852('0x18')][_0x8852('0x19')]===0x1f4){logger[_0x8852('0x18')](_0x8852('0x13'),_0x15819e,_0x561359[_0x8852('0x18')]['message']);return _0x4a395b(_0x561359[_0x8852('0x18')][_0x8852('0x1a')]);}logger[_0x8852('0x18')](_0x8852('0x13'),_0x15819e,_0x561359[_0x8852('0x18')][_0x8852('0x1a')]);return _0x1c0ec5(_0x561359[_0x8852('0x18')][_0x8852('0x1a')]);}else{logger[_0x8852('0x12')]('CmList,\x20%s,\x20%s',_0x15819e,_0x8852('0x14'));_0x1c0ec5(_0x561359['result'][_0x8852('0x1a')]);}})[_0x8852('0x1b')](function(_0x1ff147){logger[_0x8852('0x18')](_0x8852('0x13'),_0x15819e,_0x1ff147);_0x4a395b(_0x1ff147);});});} \ No newline at end of file +var _0x3aab=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x4c24c2,_0x52cf87){var _0x3a6e0f=function(_0x184b57){while(--_0x184b57){_0x4c24c2['push'](_0x4c24c2['shift']());}};_0x3a6e0f(++_0x52cf87);}(_0x3aab,0x1a2));var _0xb3aa=function(_0x22368a,_0x21548d){_0x22368a=_0x22368a-0x0;var _0x390b59=_0x3aab[_0x22368a];return _0x390b59;};'use strict';var _=require('lodash');var util=require(_0xb3aa('0x0'));var moment=require(_0xb3aa('0x1'));var BPromise=require(_0xb3aa('0x2'));var rs=require(_0xb3aa('0x3'));var fs=require('fs');var Redis=require(_0xb3aa('0x4'));var db=require(_0xb3aa('0x5'))['db'];var utils=require(_0xb3aa('0x6'));var logger=require(_0xb3aa('0x7'))(_0xb3aa('0x8'));var config=require('../../config/environment');var jayson=require(_0xb3aa('0x9'));var client=jayson[_0xb3aa('0xa')]['http']({'port':0x232a});config[_0xb3aa('0xb')]=_[_0xb3aa('0xc')](config[_0xb3aa('0xb')],{'host':_0xb3aa('0xd'),'port':0x18eb});var socket=require(_0xb3aa('0xe'))(new Redis(config[_0xb3aa('0xb')]));require(_0xb3aa('0xf'))[_0xb3aa('0x10')](socket);function respondWithRpcPromise(_0x495794,_0x1d06ef,_0x231174){return new BPromise(function(_0x7d121e,_0x38aa0b){return client[_0xb3aa('0x11')](_0x495794,_0x231174)['then'](function(_0x26fe66){logger[_0xb3aa('0x12')](_0xb3aa('0x13'),_0x1d06ef,_0xb3aa('0x14'));logger[_0xb3aa('0x15')](_0xb3aa('0x16'),_0x1d06ef,_0xb3aa('0x14'),JSON[_0xb3aa('0x17')](_0x26fe66));if(_0x26fe66['error']){if(_0x26fe66[_0xb3aa('0x18')]['code']===0x1f4){logger[_0xb3aa('0x18')](_0xb3aa('0x13'),_0x1d06ef,_0x26fe66[_0xb3aa('0x18')][_0xb3aa('0x19')]);return _0x38aa0b(_0x26fe66[_0xb3aa('0x18')][_0xb3aa('0x19')]);}logger[_0xb3aa('0x18')]('CmList,\x20%s,\x20%s',_0x1d06ef,_0x26fe66[_0xb3aa('0x18')][_0xb3aa('0x19')]);return _0x7d121e(_0x26fe66[_0xb3aa('0x18')]['message']);}else{logger[_0xb3aa('0x12')](_0xb3aa('0x13'),_0x1d06ef,_0xb3aa('0x14'));_0x7d121e(_0x26fe66[_0xb3aa('0x1a')]['message']);}})[_0xb3aa('0x1b')](function(_0x57cedc){logger[_0xb3aa('0x18')](_0xb3aa('0x13'),_0x1d06ef,_0x57cedc);_0x38aa0b(_0x57cedc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d7dc0e1..aac1c53 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 _0xb785=['emit','removeListener','register','length','update'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb785,0x1df));var _0x5b78=function(_0x46bfde,_0x36d255){_0x46bfde=_0x46bfde-0x0;var _0x674ccb=_0xb785[_0x46bfde];return _0x674ccb;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove',_0x5b78('0x0')];function createListener(_0x5854e1,_0xdc562d){return function(_0x1bef10){_0xdc562d[_0x5b78('0x1')](_0x5854e1,_0x1bef10);};}function removeListener(_0x557df7,_0x34ed7c){return function(){CmListEvents[_0x5b78('0x2')](_0x557df7,_0x34ed7c);};}exports[_0x5b78('0x3')]=function(_0x56b65b){for(var _0x4613e3=0x0,_0x540ab2=events[_0x5b78('0x4')];_0x4613e3<_0x540ab2;_0x4613e3++){var _0x33d669=events[_0x4613e3];var _0x2a1b07=createListener('cmList:'+_0x33d669,_0x56b65b);CmListEvents['on'](_0x33d669,_0x2a1b07);}}; \ No newline at end of file +var _0x8228=['cmList:','removeListener','register','length'];(function(_0x20e430,_0x241c7a){var _0x1e1e0d=function(_0x2f8f90){while(--_0x2f8f90){_0x20e430['push'](_0x20e430['shift']());}};_0x1e1e0d(++_0x241c7a);}(_0x8228,0x145));var _0x8822=function(_0x304d0c,_0x5f05ae){_0x304d0c=_0x304d0c-0x0;var _0x3aa39b=_0x8228[_0x304d0c];return _0x3aa39b;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove','update'];function createListener(_0x5a2117,_0x45d91e){return function(_0x577a27){_0x45d91e['emit'](_0x5a2117,_0x577a27);};}function removeListener(_0x259ad4,_0xcf212b){return function(){CmListEvents[_0x8822('0x0')](_0x259ad4,_0xcf212b);};}exports[_0x8822('0x1')]=function(_0x283bb1){for(var _0x2b664c=0x0,_0x58a00a=events[_0x8822('0x2')];_0x2b664c<_0x58a00a;_0x2b664c++){var _0x4d5a6c=events[_0x2b664c];var _0x10ec97=createListener(_0x8822('0x3')+_0x4d5a6c,_0x283bb1);CmListEvents['on'](_0x4d5a6c,_0x10ec97);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9fdfef2..335dd39 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 _0x4297=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getAgents','post','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x4297,0x13a));var _0x7429=function(_0x2d99b1,_0x40b1c8){_0x2d99b1=_0x2d99b1-0x0;var _0x5cab05=_0x4297[_0x2d99b1];return _0x5cab05;};'use strict';var multer=require(_0x7429('0x0'));var util=require('util');var path=require(_0x7429('0x1'));var timeout=require('connect-timeout');var express=require(_0x7429('0x2'));var router=express[_0x7429('0x3')]();var fs_extra=require(_0x7429('0x4'));var auth=require(_0x7429('0x5'));var interaction=require(_0x7429('0x6'));var config=require(_0x7429('0x7'));var controller=require(_0x7429('0x8'));router[_0x7429('0x9')]('/',auth[_0x7429('0xa')](),controller[_0x7429('0xb')]);router[_0x7429('0x9')]('/describe',auth[_0x7429('0xa')](),controller['describe']);router['get'](_0x7429('0xc'),auth[_0x7429('0xa')](),controller[_0x7429('0xd')]);router[_0x7429('0x9')](_0x7429('0xe'),auth[_0x7429('0xa')](),controller['getDispositions']);router[_0x7429('0x9')](_0x7429('0xf'),auth[_0x7429('0xa')](),controller[_0x7429('0x10')]);router[_0x7429('0x9')](_0x7429('0x11'),auth[_0x7429('0xa')](),controller[_0x7429('0x12')]);router['get']('/:id/fields',auth[_0x7429('0xa')](),controller['getCustomFields']);router[_0x7429('0x9')]('/:id/users',auth[_0x7429('0xa')](),controller[_0x7429('0x13')]);router[_0x7429('0x14')]('/',auth[_0x7429('0xa')](),controller['create']);router[_0x7429('0x14')](_0x7429('0xe'),auth[_0x7429('0xa')](),controller[_0x7429('0x15')]);router[_0x7429('0x14')](_0x7429('0xf'),auth['isAuthenticated'](),controller[_0x7429('0x16')]);router[_0x7429('0x14')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7429('0x17')]);router[_0x7429('0x14')](_0x7429('0x18'),auth[_0x7429('0xa')](),controller[_0x7429('0x19')]);router[_0x7429('0x1a')]('/:id',auth[_0x7429('0xa')](),controller[_0x7429('0x1b')]);router[_0x7429('0x1c')](_0x7429('0xc'),auth[_0x7429('0xa')](),controller[_0x7429('0x1d')]);router[_0x7429('0x1c')]('/:id/dispositions',auth[_0x7429('0xa')](),controller[_0x7429('0x1e')]);router[_0x7429('0x1c')](_0x7429('0x18'),auth[_0x7429('0xa')](),controller['removeAgents']);module[_0x7429('0x1f')]=router; \ No newline at end of file +var _0x7922=['/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id'];(function(_0x34c92b,_0x173432){var _0x10bc29=function(_0x180d22){while(--_0x180d22){_0x34c92b['push'](_0x34c92b['shift']());}};_0x10bc29(++_0x173432);}(_0x7922,0x15e));var _0x2792=function(_0x3c3b95,_0x366237){_0x3c3b95=_0x3c3b95-0x0;var _0x313db4=_0x7922[_0x3c3b95];return _0x313db4;};'use strict';var multer=require(_0x2792('0x0'));var util=require('util');var path=require(_0x2792('0x1'));var timeout=require(_0x2792('0x2'));var express=require(_0x2792('0x3'));var router=express['Router']();var fs_extra=require(_0x2792('0x4'));var auth=require(_0x2792('0x5'));var interaction=require(_0x2792('0x6'));var config=require(_0x2792('0x7'));var controller=require('./cmList.controller');router[_0x2792('0x8')]('/',auth['isAuthenticated'](),controller[_0x2792('0x9')]);router[_0x2792('0x8')](_0x2792('0xa'),auth[_0x2792('0xb')](),controller['describe']);router['get'](_0x2792('0xc'),auth[_0x2792('0xb')](),controller['show']);router[_0x2792('0x8')](_0x2792('0xd'),auth[_0x2792('0xb')](),controller[_0x2792('0xe')]);router[_0x2792('0x8')](_0x2792('0xf'),auth[_0x2792('0xb')](),controller['getContacts']);router[_0x2792('0x8')](_0x2792('0x10'),auth[_0x2792('0xb')](),controller[_0x2792('0x11')]);router[_0x2792('0x8')](_0x2792('0x12'),auth['isAuthenticated'](),controller[_0x2792('0x13')]);router[_0x2792('0x8')](_0x2792('0x14'),auth[_0x2792('0xb')](),controller[_0x2792('0x15')]);router['post']('/',auth[_0x2792('0xb')](),controller[_0x2792('0x16')]);router[_0x2792('0x17')](_0x2792('0xd'),auth[_0x2792('0xb')](),controller[_0x2792('0x18')]);router['post'](_0x2792('0xf'),auth[_0x2792('0xb')](),controller[_0x2792('0x19')]);router[_0x2792('0x17')](_0x2792('0x12'),auth['isAuthenticated'](),controller[_0x2792('0x1a')]);router[_0x2792('0x17')]('/:id/users',auth[_0x2792('0xb')](),controller[_0x2792('0x1b')]);router[_0x2792('0x1c')](_0x2792('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2792('0x1d')](_0x2792('0xc'),auth[_0x2792('0xb')](),controller[_0x2792('0x1e')]);router[_0x2792('0x1d')]('/:id/dispositions',auth[_0x2792('0xb')](),controller[_0x2792('0x1f')]);router[_0x2792('0x1d')](_0x2792('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2792('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a4c28b8..0f226d3 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 _0x59b0=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x1188e8,_0x5b5373){var _0x29c84f=function(_0xde5ff8){while(--_0xde5ff8){_0x1188e8['push'](_0x1188e8['shift']());}};_0x29c84f(++_0x5b5373);}(_0x59b0,0x10d));var _0x059b=function(_0x3ad737,_0x300131){_0x3ad737=_0x3ad737-0x0;var _0x16c1e2=_0x59b0[_0x3ad737];return _0x16c1e2;};'use strict';var Sequelize=require(_0x059b('0x0'));module[_0x059b('0x1')]={'name':{'type':Sequelize[_0x059b('0x2')],'get':function(_0x9b0ce5){return this[_0x059b('0x3')](_0x059b('0x4'));}},'field':{'type':Sequelize[_0x059b('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x059b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x059b('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xc65d=['STRING','exports','VIRTUAL','field'];(function(_0x52aee7,_0x3497a7){var _0x22cbf3=function(_0xac7002){while(--_0xac7002){_0x52aee7['push'](_0x52aee7['shift']());}};_0x22cbf3(++_0x3497a7);}(_0xc65d,0xa9));var _0xdc65=function(_0x666f26,_0x2bac4){_0x666f26=_0x666f26-0x0;var _0x30152a=_0xc65d[_0x666f26];return _0x30152a;};'use strict';var Sequelize=require('sequelize');module[_0xdc65('0x0')]={'name':{'type':Sequelize[_0xdc65('0x1')],'get':function(_0x444939){return this['getDataValue'](_0xdc65('0x2'));}},'field':{'type':Sequelize[_0xdc65('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xdc65('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 cf01dbc..b93c7c3 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 _0x7a54=['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','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x552b0f,_0x3b88e2){var _0x275989=function(_0x31c63a){while(--_0x31c63a){_0x552b0f['push'](_0x552b0f['shift']());}};_0x275989(++_0x3b88e2);}(_0x7a54,0x106));var _0x47a5=function(_0x207736,_0x4dce74){_0x207736=_0x207736-0x0;var _0x106838=_0x7a54[_0x207736];return _0x106838;};'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('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,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(_0x48ff69,_0xfea383){var _0x596d1e=function(_0x47febe){while(--_0x47febe){_0x48ff69['push'](_0x48ff69['shift']());}};_0x596d1e(++_0xfea383);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 c9150ab..dbb5d16 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 _0xf1e5=['request-promise','../../config/environment','./condition.attributes','tools_conditions','util','../../config/logger','moment'];(function(_0x1cf7d1,_0x395d36){var _0x28f291=function(_0x3ad8bf){while(--_0x3ad8bf){_0x1cf7d1['push'](_0x1cf7d1['shift']());}};_0x28f291(++_0x395d36);}(_0xf1e5,0x1d9));var _0x5f1e=function(_0xbb9667,_0x36c9f0){_0xbb9667=_0xbb9667-0x0;var _0x347994=_0xf1e5[_0xbb9667];return _0x347994;};'use strict';var _=require('lodash');var util=require(_0x5f1e('0x0'));var logger=require(_0x5f1e('0x1'))('api');var moment=require(_0x5f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f1e('0x4'));var attributes=require(_0x5f1e('0x5'));module['exports']=function(_0x522b67,_0x185b6b){return _0x522b67['define']('Condition',attributes,{'tableName':_0x5f1e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0137=['tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x259b7f,_0x1d59bd){var _0x277849=function(_0x4e3063){while(--_0x4e3063){_0x259b7f['push'](_0x259b7f['shift']());}};_0x277849(++_0x1d59bd);}(_0x0137,0x9d));var _0x7013=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0x0137[_0x17788a];return _0x33f47c;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require('rimraf');var config=require(_0x7013('0x7'));var attributes=require(_0x7013('0x8'));module[_0x7013('0x9')]=function(_0x1dad9d,_0x50a4d2){return _0x1dad9d[_0x7013('0xa')](_0x7013('0xb'),attributes,{'tableName':_0x7013('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 6b3d542..7bb8232 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 _0x27d1=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1842f1,_0xeb7b6){var _0x2b446a=function(_0x52e631){while(--_0x52e631){_0x1842f1['push'](_0x1842f1['shift']());}};_0x2b446a(++_0xeb7b6);}(_0x27d1,0x68));var _0x127d=function(_0x46632d,_0x1fb958){_0x46632d=_0x46632d-0x0;var _0xeff17a=_0x27d1[_0x46632d];return _0xeff17a;};'use strict';var _=require(_0x127d('0x0'));var util=require(_0x127d('0x1'));var moment=require('moment');var BPromise=require(_0x127d('0x2'));var rs=require(_0x127d('0x3'));var fs=require('fs');var Redis=require(_0x127d('0x4'));var db=require(_0x127d('0x5'))['db'];var utils=require(_0x127d('0x6'));var logger=require(_0x127d('0x7'))(_0x127d('0x8'));var config=require(_0x127d('0x9'));var jayson=require(_0x127d('0xa'));var client=jayson[_0x127d('0xb')][_0x127d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x183a40,_0x926459,_0x2c4389){return new BPromise(function(_0x2f9075,_0x2091c5){return client[_0x127d('0xd')](_0x183a40,_0x2c4389)[_0x127d('0xe')](function(_0x407aee){logger[_0x127d('0xf')](_0x127d('0x10'),_0x926459,_0x127d('0x11'));logger[_0x127d('0x12')]('Condition,\x20%s,\x20%s,\x20%s',_0x926459,_0x127d('0x11'),JSON[_0x127d('0x13')](_0x407aee));if(_0x407aee['error']){if(_0x407aee[_0x127d('0x14')][_0x127d('0x15')]===0x1f4){logger[_0x127d('0x14')](_0x127d('0x10'),_0x926459,_0x407aee[_0x127d('0x14')][_0x127d('0x16')]);return _0x2091c5(_0x407aee[_0x127d('0x14')][_0x127d('0x16')]);}logger[_0x127d('0x14')](_0x127d('0x10'),_0x926459,_0x407aee[_0x127d('0x14')][_0x127d('0x16')]);return _0x2f9075(_0x407aee['error']['message']);}else{logger[_0x127d('0xf')](_0x127d('0x10'),_0x926459,'request\x20sent');_0x2f9075(_0x407aee[_0x127d('0x17')][_0x127d('0x16')]);}})[_0x127d('0x18')](function(_0x30a2e9){logger[_0x127d('0x14')](_0x127d('0x10'),_0x926459,_0x30a2e9);_0x2091c5(_0x30a2e9);});});} \ No newline at end of file +var _0xd2ee=['jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xd2ee,0x1b0));var _0xed2e=function(_0x822c4e,_0x21f855){_0x822c4e=_0x822c4e-0x0;var _0x2aab89=_0xd2ee[_0x822c4e];return _0x2aab89;};'use strict';var _=require(_0xed2e('0x0'));var util=require('util');var moment=require(_0xed2e('0x1'));var BPromise=require(_0xed2e('0x2'));var rs=require(_0xed2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed2e('0x4'))['db'];var utils=require(_0xed2e('0x5'));var logger=require('../../config/logger')(_0xed2e('0x6'));var config=require(_0xed2e('0x7'));var jayson=require(_0xed2e('0x8'));var client=jayson[_0xed2e('0x9')][_0xed2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f360d,_0x25a07b,_0x1d59ef){return new BPromise(function(_0x2e41ed,_0x3d2e7c){return client['request'](_0x4f360d,_0x1d59ef)[_0xed2e('0xb')](function(_0x368bb6){logger[_0xed2e('0xc')](_0xed2e('0xd'),_0x25a07b,_0xed2e('0xe'));logger[_0xed2e('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x25a07b,_0xed2e('0xe'),JSON[_0xed2e('0x10')](_0x368bb6));if(_0x368bb6[_0xed2e('0x11')]){if(_0x368bb6[_0xed2e('0x11')][_0xed2e('0x12')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x25a07b,_0x368bb6[_0xed2e('0x11')][_0xed2e('0x13')]);return _0x3d2e7c(_0x368bb6['error']['message']);}logger[_0xed2e('0x11')](_0xed2e('0xd'),_0x25a07b,_0x368bb6[_0xed2e('0x11')]['message']);return _0x2e41ed(_0x368bb6[_0xed2e('0x11')][_0xed2e('0x13')]);}else{logger[_0xed2e('0xc')](_0xed2e('0xd'),_0x25a07b,_0xed2e('0xe'));_0x2e41ed(_0x368bb6[_0xed2e('0x14')][_0xed2e('0x13')]);}})[_0xed2e('0x15')](function(_0x767777){logger[_0xed2e('0x11')](_0xed2e('0xd'),_0x25a07b,_0x767777);_0x3d2e7c(_0x767777);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7849640..89ac0c5 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 _0x61ef=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','multer','path'];(function(_0x4f1dd0,_0x4b9eac){var _0x41ea2e=function(_0x397238){while(--_0x397238){_0x4f1dd0['push'](_0x4f1dd0['shift']());}};_0x41ea2e(++_0x4b9eac);}(_0x61ef,0xd0));var _0xf61e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x61ef[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xf61e('0x0'));var util=require('util');var path=require(_0xf61e('0x1'));var timeout=require(_0xf61e('0x2'));var express=require(_0xf61e('0x3'));var router=express[_0xf61e('0x4')]();var fs_extra=require(_0xf61e('0x5'));var auth=require(_0xf61e('0x6'));var interaction=require(_0xf61e('0x7'));var config=require(_0xf61e('0x8'));var controller=require(_0xf61e('0x9'));router[_0xf61e('0xa')](_0xf61e('0xb'),auth[_0xf61e('0xc')](),controller[_0xf61e('0xd')]);router['delete'](_0xf61e('0xb'),auth[_0xf61e('0xc')](),controller[_0xf61e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x93ba=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util'];(function(_0x329e44,_0x2bec9b){var _0xe0eaac=function(_0x2fe957){while(--_0x2fe957){_0x329e44['push'](_0x329e44['shift']());}};_0xe0eaac(++_0x2bec9b);}(_0x93ba,0x8a));var _0xa93b=function(_0x353501,_0x27c84e){_0x353501=_0x353501-0x0;var _0x3dd779=_0x93ba[_0x353501];return _0x3dd779;};'use strict';var multer=require(_0xa93b('0x0'));var util=require(_0xa93b('0x1'));var path=require(_0xa93b('0x2'));var timeout=require('connect-timeout');var express=require(_0xa93b('0x3'));var router=express['Router']();var fs_extra=require(_0xa93b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa93b('0x5'));var config=require(_0xa93b('0x6'));var controller=require(_0xa93b('0x7'));router[_0xa93b('0x8')](_0xa93b('0x9'),auth[_0xa93b('0xa')](),controller[_0xa93b('0xb')]);router['delete'](_0xa93b('0x9'),auth[_0xa93b('0xa')](),controller[_0xa93b('0xc')]);module[_0xa93b('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 22abb75..505d111 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 _0xd8b0=['exports','sequelize'];(function(_0x3bfef7,_0x264ab8){var _0x279a77=function(_0x199146){while(--_0x199146){_0x3bfef7['push'](_0x3bfef7['shift']());}};_0x279a77(++_0x264ab8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x1b83b6,_0x53478f){var _0x3f160e=function(_0x118ee1){while(--_0x118ee1){_0x1b83b6['push'](_0x1b83b6['shift']());}};_0x3f160e(++_0x53478f);}(_0x2032,0xd9));var _0x2203=function(_0x565f84,_0x2197ec){_0x565f84=_0x565f84-0x0;var _0x33137c=_0x2032[_0x565f84];return _0x33137c;};'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 f1bef00..39760b7 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 _0x88a8=['type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','Dashboard','findAll','rows','catch','params','find','create','user','get','role','UserProfileSection','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../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','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x5b8c28,_0x219f5f){var _0x4a36ec=function(_0x297c4e){while(--_0x297c4e){_0x5b8c28['push'](_0x5b8c28['shift']());}};_0x4a36ec(++_0x219f5f);}(_0x88a8,0x159));var _0x888a=function(_0x24383c,_0xf93f31){_0x24383c=_0x24383c-0x0;var _0x31ddd2=_0x88a8[_0x24383c];return _0x31ddd2;};'use strict';var emlformat=require(_0x888a('0x0'));var rimraf=require(_0x888a('0x1'));var zipdir=require(_0x888a('0x2'));var jsonpatch=require(_0x888a('0x3'));var rp=require(_0x888a('0x4'));var moment=require(_0x888a('0x5'));var BPromise=require(_0x888a('0x6'));var Mustache=require(_0x888a('0x7'));var util=require('util');var path=require(_0x888a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x888a('0x9'));var fs=require('fs');var fs_extra=require(_0x888a('0xa'));var _=require(_0x888a('0xb'));var squel=require('squel');var crypto=require(_0x888a('0xc'));var jsforce=require(_0x888a('0xd'));var deskjs=require(_0x888a('0xe'));var toCsv=require(_0x888a('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x888a('0x10'));var qs=require(_0x888a('0x11'));var as=require(_0x888a('0x12'));var hardwareService=require(_0x888a('0x13'));var logger=require(_0x888a('0x14'))(_0x888a('0x15'));var utils=require(_0x888a('0x16'));var config=require(_0x888a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x888a('0x18'))['db'];config[_0x888a('0x19')]=_[_0x888a('0x1a')](config[_0x888a('0x19')],{'host':_0x888a('0x1b'),'port':0x18eb});var socket=require(_0x888a('0x1c'))(new Redis(config[_0x888a('0x19')]));require(_0x888a('0x1d'))['register'](socket);function respondWithStatusCode(_0x1183c1,_0x3def98){_0x3def98=_0x3def98||0xcc;return function(_0x318eeb){if(_0x318eeb){return _0x1183c1[_0x888a('0x1e')](_0x3def98);}return _0x1183c1[_0x888a('0x1f')](_0x3def98)[_0x888a('0x20')]();};}function respondWithResult(_0x9ac62d,_0x38df98){_0x38df98=_0x38df98||0xc8;return function(_0x989740){if(_0x989740){return _0x9ac62d[_0x888a('0x1f')](_0x38df98)[_0x888a('0x21')](_0x989740);}};}function respondWithFilteredResult(_0x54a2ee,_0x375f5c){return function(_0x465d67){if(_0x465d67){var _0x9ed3ed=typeof _0x375f5c[_0x888a('0x22')]===_0x888a('0x23')&&typeof _0x375f5c['limit']===_0x888a('0x23');var _0x52280f=_0x465d67[_0x888a('0x24')];var _0x2e9079=_0x9ed3ed?0x0:_0x375f5c['offset'];var _0x4aba60=_0x9ed3ed?_0x465d67['count']:_0x375f5c[_0x888a('0x22')]+_0x375f5c[_0x888a('0x25')];var _0x2eb373;if(_0x4aba60>=_0x52280f){_0x4aba60=_0x52280f;_0x2eb373=0xc8;}else{_0x2eb373=0xce;}_0x54a2ee[_0x888a('0x1f')](_0x2eb373);return _0x54a2ee[_0x888a('0x26')]('Content-Range',_0x2e9079+'-'+_0x4aba60+'/'+_0x52280f)[_0x888a('0x21')](_0x465d67);}return null;};}function patchUpdates(_0x3c37c9){return function(_0xb52fca){try{jsonpatch[_0x888a('0x27')](_0xb52fca,_0x3c37c9,!![]);}catch(_0x1d85b4){return BPromise[_0x888a('0x28')](_0x1d85b4);}return _0xb52fca[_0x888a('0x29')]();};}function saveUpdates(_0x1d7c14,_0x3704c3){return function(_0x2583af){if(_0x2583af){return _0x2583af[_0x888a('0x2a')](_0x1d7c14)[_0x888a('0x2b')](function(_0x4faf5c){return _0x4faf5c;});}return null;};}function removeEntity(_0x20c85a,_0x273b99){return function(_0x39bc4d){if(_0x39bc4d){return _0x39bc4d[_0x888a('0x2c')]()[_0x888a('0x2b')](function(){var _0x2aca68=_0x39bc4d['get']({'plain':!![]});var _0xaa5bb=_0x888a('0x2d');return db[_0x888a('0x2e')][_0x888a('0x2c')]({'where':{'type':_0xaa5bb,'resourceId':_0x2aca68['id']}})['then'](function(){return _0x39bc4d;});})[_0x888a('0x2b')](function(){_0x20c85a[_0x888a('0x1f')](0xcc)[_0x888a('0x20')]();});}};}function handleEntityNotFound(_0x16adac,_0x4cd1a2){return function(_0x3376a9){if(!_0x3376a9){_0x16adac['sendStatus'](0x194);}return _0x3376a9;};}function handleError(_0x262049,_0x1bc495){_0x1bc495=_0x1bc495||0x1f4;return function(_0x396c11){logger[_0x888a('0x2f')](_0x396c11[_0x888a('0x30')]);if(_0x396c11[_0x888a('0x31')]){delete _0x396c11[_0x888a('0x31')];}_0x262049[_0x888a('0x1f')](_0x1bc495)[_0x888a('0x32')](_0x396c11);};}exports[_0x888a('0x33')]=function(_0x23ef2c,_0x473a23){var _0x567fd1={},_0x1dc323={},_0x3bc854={'count':0x0,'rows':[]};var _0x71620=_['map'](db['Dashboard'][_0x888a('0x34')],function(_0x3ee512){return{'name':_0x3ee512[_0x888a('0x35')],'type':_0x3ee512[_0x888a('0x36')]['key']};});_0x1dc323[_0x888a('0x37')]=_['map'](_0x71620,_0x888a('0x31'));_0x1dc323['query']=_[_0x888a('0x38')](_0x23ef2c['query']);_0x1dc323['filters']=_[_0x888a('0x39')](_0x1dc323[_0x888a('0x37')],_0x1dc323[_0x888a('0x3a')]);_0x567fd1[_0x888a('0x3b')]=_['intersection'](_0x1dc323[_0x888a('0x37')],qs[_0x888a('0x3c')](_0x23ef2c[_0x888a('0x3a')]['fields']));_0x567fd1[_0x888a('0x3b')]=_0x567fd1[_0x888a('0x3b')][_0x888a('0x3d')]?_0x567fd1[_0x888a('0x3b')]:_0x1dc323[_0x888a('0x37')];if(!_0x23ef2c[_0x888a('0x3a')][_0x888a('0x3e')](_0x888a('0x3f'))){_0x567fd1[_0x888a('0x25')]=qs[_0x888a('0x25')](_0x23ef2c[_0x888a('0x3a')][_0x888a('0x25')]);_0x567fd1[_0x888a('0x22')]=qs['offset'](_0x23ef2c[_0x888a('0x3a')][_0x888a('0x22')]);}_0x567fd1[_0x888a('0x40')]=qs[_0x888a('0x41')](_0x23ef2c[_0x888a('0x3a')][_0x888a('0x41')]);_0x567fd1[_0x888a('0x42')]=qs[_0x888a('0x43')](_[_0x888a('0x44')](_0x23ef2c[_0x888a('0x3a')],_0x1dc323[_0x888a('0x43')]),_0x71620);if(_0x23ef2c[_0x888a('0x3a')][_0x888a('0x45')]){_0x567fd1[_0x888a('0x42')]=_[_0x888a('0x46')](_0x567fd1['where'],{'$or':_[_0x888a('0x47')](_0x71620,function(_0x333d45){if(_0x333d45[_0x888a('0x36')]!==_0x888a('0x48')){var _0x5b1bbf={};_0x5b1bbf[_0x333d45[_0x888a('0x31')]]={'$like':'%'+_0x23ef2c['query']['filter']+'%'};return _0x5b1bbf;}})});}_0x567fd1=_[_0x888a('0x46')]({},_0x567fd1,_0x23ef2c[_0x888a('0x49')]);var _0x220f7c={'where':_0x567fd1[_0x888a('0x42')]};return db['Dashboard'][_0x888a('0x24')](_0x220f7c)['then'](function(_0x27766d){_0x3bc854[_0x888a('0x24')]=_0x27766d;if(_0x23ef2c[_0x888a('0x3a')][_0x888a('0x4a')]){_0x567fd1[_0x888a('0x4b')]=[{'all':!![]}];}return db[_0x888a('0x4c')][_0x888a('0x4d')](_0x567fd1);})[_0x888a('0x2b')](function(_0x56c3e1){_0x3bc854[_0x888a('0x4e')]=_0x56c3e1;return _0x3bc854;})['then'](respondWithFilteredResult(_0x473a23,_0x567fd1))[_0x888a('0x4f')](handleError(_0x473a23,null));};exports['show']=function(_0x50ec90,_0x4d0909){var _0x30943a={'raw':![],'where':{'id':_0x50ec90[_0x888a('0x50')]['id']}},_0x3350a9={};_0x3350a9[_0x888a('0x37')]=_[_0x888a('0x38')](db[_0x888a('0x4c')][_0x888a('0x34')]);_0x3350a9[_0x888a('0x3a')]=_[_0x888a('0x38')](_0x50ec90[_0x888a('0x3a')]);_0x3350a9[_0x888a('0x43')]=_[_0x888a('0x39')](_0x3350a9[_0x888a('0x37')],_0x3350a9[_0x888a('0x3a')]);_0x30943a['attributes']=_[_0x888a('0x39')](_0x3350a9[_0x888a('0x37')],qs[_0x888a('0x3c')](_0x50ec90[_0x888a('0x3a')][_0x888a('0x3c')]));_0x30943a[_0x888a('0x3b')]=_0x30943a['attributes']['length']?_0x30943a[_0x888a('0x3b')]:_0x3350a9[_0x888a('0x37')];if(_0x50ec90[_0x888a('0x3a')][_0x888a('0x4a')]){_0x30943a['include']=[{'all':!![]}];}_0x30943a=_[_0x888a('0x46')]({},_0x30943a,_0x50ec90[_0x888a('0x49')]);return db[_0x888a('0x4c')][_0x888a('0x51')](_0x30943a)[_0x888a('0x2b')](handleEntityNotFound(_0x4d0909,null))[_0x888a('0x2b')](respondWithResult(_0x4d0909,null))[_0x888a('0x4f')](handleError(_0x4d0909,null));};exports[_0x888a('0x52')]=function(_0x407013,_0x334ada){return db['Dashboard'][_0x888a('0x52')](_0x407013['body'],{})['then'](function(_0x352c43){var _0x5e1e9f=_0x407013[_0x888a('0x53')][_0x888a('0x54')]({'plain':!![]});if(!_0x5e1e9f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e1e9f[_0x888a('0x55')]===_0x888a('0x53')){var _0x1aa7c1=_0x352c43[_0x888a('0x54')]({'plain':!![]});var _0xcc48f0=_0x888a('0x2d');return db[_0x888a('0x56')][_0x888a('0x51')]({'where':{'name':_0xcc48f0,'userProfileId':_0x5e1e9f['userProfileId']},'raw':!![]})['then'](function(_0x1e33f7){if(_0x1e33f7&&_0x1e33f7['autoAssociation']===0x0){return db[_0x888a('0x2e')][_0x888a('0x52')]({'name':_0x1aa7c1[_0x888a('0x31')],'resourceId':_0x1aa7c1['id'],'type':_0x1e33f7[_0x888a('0x31')],'sectionId':_0x1e33f7['id']},{})[_0x888a('0x2b')](function(){return _0x352c43;});}else{return _0x352c43;}})['catch'](function(_0x59ba17){logger[_0x888a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ba17);throw _0x59ba17;});}return _0x352c43;})['then'](respondWithResult(_0x334ada,0xc9))[_0x888a('0x4f')](handleError(_0x334ada,null));};exports['clone']=function(_0x553250,_0x3b62af){var _0x553b47={'where':{'id':_0x553250[_0x888a('0x50')]['id']}},_0x1a8d1e={};_0x1a8d1e[_0x888a('0x37')]=_[_0x888a('0x38')](db[_0x888a('0x4c')][_0x888a('0x34')]);_0x553b47[_0x888a('0x3b')]=_[_0x888a('0x39')](_0x1a8d1e[_0x888a('0x37')],qs['fields'](_0x553250[_0x888a('0x3a')][_0x888a('0x3c')]));_0x553b47[_0x888a('0x3b')]=_0x553b47[_0x888a('0x3b')][_0x888a('0x3d')]?_0x553b47[_0x888a('0x3b')]:_0x1a8d1e[_0x888a('0x37')];if(_0x553250['query']['includeAll']){_0x553b47[_0x888a('0x4b')]=[{'all':!![]}];}_0x553b47=_['merge']({},_0x553b47,_0x553250['options']);return db['Dashboard'][_0x888a('0x51')](_0x553b47)[_0x888a('0x2b')](handleEntityNotFound(_0x3b62af,null))[_0x888a('0x2b')](function(_0x144bc2){if(_0x144bc2){var _0x1a1c5f=_0x144bc2['get']({'plain':!![]});_0x1a1c5f=qs[_0x888a('0x57')](_0x1a1c5f,['id',_0x888a('0x58'),_0x888a('0x59')]);_0x553250[_0x888a('0x5a')]=_[_0x888a('0x57')](_0x553250[_0x888a('0x5a')],['id',_0x888a('0x58'),'updatedAt']);return db['Dashboard'][_0x888a('0x52')](_[_0x888a('0x46')](_0x1a1c5f,_0x553250[_0x888a('0x5a')]),{'include':_0x553250[_0x888a('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x888a('0x2b')](function(_0x5d45f3){var _0x499d54=_0x553250[_0x888a('0x53')][_0x888a('0x54')]({'plain':!![]});if(!_0x499d54)throw new Error(_0x888a('0x5b'));if(_0x499d54['role']==='user'){var _0x4a9cee=_0x5d45f3[_0x888a('0x54')]({'plain':!![]});var _0x3d4719=_0x888a('0x2d');return db[_0x888a('0x56')]['find']({'where':{'name':_0x3d4719,'userProfileId':_0x499d54[_0x888a('0x5c')]},'raw':!![]})[_0x888a('0x2b')](function(_0x5c1e1f){if(_0x5c1e1f&&_0x5c1e1f[_0x888a('0x5d')]===0x0){return db[_0x888a('0x2e')][_0x888a('0x52')]({'name':_0x4a9cee[_0x888a('0x31')],'resourceId':_0x4a9cee['id'],'type':_0x5c1e1f[_0x888a('0x31')],'sectionId':_0x5c1e1f['id']},{})['then'](function(){return _0x5d45f3;});}else{return _0x5d45f3;}})[_0x888a('0x4f')](function(_0xfaf420){logger[_0x888a('0x2f')](_0x888a('0x5e'),_0xfaf420);throw _0xfaf420;});}return _0x5d45f3;});}})[_0x888a('0x2b')](respondWithResult(_0x3b62af,0xc9))['catch'](handleError(_0x3b62af,null));};exports[_0x888a('0x2a')]=function(_0x49e2bd,_0x3703d0){if(_0x49e2bd[_0x888a('0x5a')]['id']){delete _0x49e2bd[_0x888a('0x5a')]['id'];}return db[_0x888a('0x4c')][_0x888a('0x51')]({'where':{'id':_0x49e2bd[_0x888a('0x50')]['id']}})['then'](handleEntityNotFound(_0x3703d0,null))['then'](saveUpdates(_0x49e2bd['body'],null))[_0x888a('0x2b')](respondWithResult(_0x3703d0,null))['catch'](handleError(_0x3703d0,null));};exports[_0x888a('0x2c')]=function(_0x4a3544,_0xfa22c8){return db['Dashboard'][_0x888a('0x51')]({'where':{'id':_0x4a3544[_0x888a('0x50')]['id']}})[_0x888a('0x2b')](handleEntityNotFound(_0xfa22c8,null))[_0x888a('0x2b')](removeEntity(_0xfa22c8,null))[_0x888a('0x4f')](handleError(_0xfa22c8,null));};function widgetAttributes(_0x4a4920){try{switch(_0x4a4920[_0x888a('0x36')]){case'iframe':return[{'name':_0x888a('0x5f'),'value':_0x4a4920[_0x888a('0x5f')]||(_0x4a4920['attrs']&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0][_0x888a('0x61')]:undefined)||'https://'}];case _0x888a('0x62'):return[{'name':'attrPath','value':_0x4a4920[_0x888a('0x63')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0][_0x888a('0x61')]:undefined)||''}];case _0x888a('0x64'):return[{'name':'attrHourFormat','value':_0x4a4920[_0x888a('0x65')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0]['value']:undefined)||_0x888a('0x66')},{'name':_0x888a('0x67'),'value':_0x4a4920[_0x888a('0x67')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x1]?_0x4a4920[_0x888a('0x60')][0x1][_0x888a('0x61')]:undefined)||_0x888a('0x68')},{'name':_0x888a('0x69'),'value':_0x4a4920[_0x888a('0x69')]||(_0x4a4920['attrs']&&_0x4a4920[_0x888a('0x60')][0x2]?_0x4a4920[_0x888a('0x60')][0x2][_0x888a('0x61')]:undefined)||0xc}];case _0x888a('0x6a'):return[{'name':'attrMetric','value':_0x4a4920[_0x888a('0x6b')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0]['value']:undefined)||_0x888a('0x6c')},{'name':_0x888a('0x6d'),'value':_0x4a4920['attrVoiceQueues']||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x1]?_0x4a4920[_0x888a('0x60')][0x1]['value']:undefined)||[]},{'name':_0x888a('0x69'),'value':_0x4a4920[_0x888a('0x69')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x2]?_0x4a4920[_0x888a('0x60')][0x2][_0x888a('0x61')]:undefined)||0x14},{'name':_0x888a('0x6e'),'value':_0x4a4920[_0x888a('0x6e')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x3]?_0x4a4920[_0x888a('0x60')][0x3]['value']:undefined)||_0x888a('0x6f')},{'name':_0x888a('0x70'),'value':_0x4a4920[_0x888a('0x70')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x4]?_0x4a4920[_0x888a('0x60')][0x4][_0x888a('0x61')]:undefined)||''},{'name':_0x888a('0x71'),'value':_0x4a4920[_0x888a('0x71')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x5]?_0x4a4920[_0x888a('0x60')][0x5]['value']:undefined)||''},{'name':_0x888a('0x72'),'value':_0x4a4920[_0x888a('0x72')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x6]?_0x4a4920[_0x888a('0x60')][0x6]['value']:undefined)||''},{'name':_0x888a('0x73'),'value':_0x4a4920[_0x888a('0x73')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x7]?_0x4a4920[_0x888a('0x60')][0x7][_0x888a('0x61')]:undefined)||''},{'name':_0x888a('0x74'),'value':_0x4a4920[_0x888a('0x74')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x8]?_0x4a4920[_0x888a('0x60')][0x8][_0x888a('0x61')]:undefined)||''},{'name':_0x888a('0x75'),'value':_0x4a4920[_0x888a('0x75')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x9]?_0x4a4920['attrs'][0x9][_0x888a('0x61')]:undefined)||''}];case _0x888a('0x76'):case _0x888a('0x77'):return[{'name':_0x888a('0x78'),'value':_0x4a4920[_0x888a('0x78')]||(_0x4a4920['attrs']&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920['attrs'][0x0][_0x888a('0x61')]:undefined)||_0x888a('0x6c')},{'name':_0x888a('0x79'),'value':_0x4a4920['attrSerie2']||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x1]?_0x4a4920[_0x888a('0x60')][0x1][_0x888a('0x61')]:undefined)||null},{'name':_0x888a('0x7a'),'value':_0x4a4920[_0x888a('0x7a')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x2]?_0x4a4920[_0x888a('0x60')][0x2]['value']:undefined)||null},{'name':_0x888a('0x6d'),'value':_0x4a4920[_0x888a('0x6d')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x3]?_0x4a4920[_0x888a('0x60')][0x3][_0x888a('0x61')]:undefined)||[]},{'name':_0x888a('0x6e'),'value':_0x4a4920['attrChannel']||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x4]?_0x4a4920[_0x888a('0x60')][0x4]['value']:undefined)||_0x888a('0x6f')},{'name':_0x888a('0x70'),'value':_0x4a4920[_0x888a('0x70')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x5]?_0x4a4920[_0x888a('0x60')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x4a4920[_0x888a('0x71')]||(_0x4a4920['attrs']&&_0x4a4920[_0x888a('0x60')][0x6]?_0x4a4920[_0x888a('0x60')][0x6][_0x888a('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4a4920[_0x888a('0x72')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x7]?_0x4a4920[_0x888a('0x60')][0x7][_0x888a('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4a4920[_0x888a('0x73')]||(_0x4a4920['attrs']&&_0x4a4920['attrs'][0x8]?_0x4a4920[_0x888a('0x60')][0x8][_0x888a('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4a4920['attrWhatsappAccounts']||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x9]?_0x4a4920['attrs'][0x9]['value']:undefined)||''},{'name':_0x888a('0x75'),'value':_0x4a4920[_0x888a('0x75')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0xa]?_0x4a4920[_0x888a('0x60')][0xa][_0x888a('0x61')]:undefined)||''}];case _0x888a('0x7b'):return[{'name':_0x888a('0x7c'),'type':_0x4a4920[_0x888a('0x7d')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0][_0x888a('0x36')]:undefined)||null,'value':_0x4a4920[_0x888a('0x7c')]||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920[_0x888a('0x60')][0x0]?_0x4a4920[_0x888a('0x60')][0x0][_0x888a('0x61')]:undefined)||null},{'name':_0x888a('0x7e'),'value':_0x4a4920['attrRefresh']||(_0x4a4920[_0x888a('0x60')]&&_0x4a4920['attrs'][0x1]?_0x4a4920[_0x888a('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5adffb){logger['error'](_0x888a('0x7f'),JSON['stringify'](_0x5adffb));return[];}}exports[_0x888a('0x80')]=function(_0x8f4f0d,_0x700fd6,_0x9e7c8b){if(_0x8f4f0d[_0x888a('0x5a')]['id']){delete _0x8f4f0d[_0x888a('0x5a')]['id'];}return db[_0x888a('0x4c')][_0x888a('0x51')]({'where':{'id':_0x8f4f0d[_0x888a('0x50')]['id']}})[_0x888a('0x2b')](handleEntityNotFound(_0x700fd6,null))[_0x888a('0x2b')](function(_0x41e8b3){if(_0x41e8b3){_0x8f4f0d['body'][_0x888a('0x81')]=_0x41e8b3['id'];_0x8f4f0d['body'][_0x888a('0x60')]=widgetAttributes(_0x8f4f0d[_0x888a('0x5a')]);return db[_0x888a('0x82')][_0x888a('0x52')](_0x8f4f0d[_0x888a('0x5a')]);}})['then'](respondWithResult(_0x700fd6,null))[_0x888a('0x4f')](handleError(_0x700fd6,null));};exports[_0x888a('0x83')]=function(_0x435f4d,_0x3f8d5c,_0x4bc6aa){var _0x50e02e={};var _0x51512d={};var _0x161793;var _0x341883;return db['Dashboard'][_0x888a('0x84')]({'where':{'id':_0x435f4d[_0x888a('0x50')]['id']}})[_0x888a('0x2b')](handleEntityNotFound(_0x3f8d5c,null))[_0x888a('0x2b')](function(_0x55f42f){if(_0x55f42f){_0x161793=_0x55f42f;_0x51512d['model']=_[_0x888a('0x38')](db[_0x888a('0x82')][_0x888a('0x34')]);_0x51512d['query']=_[_0x888a('0x38')](_0x435f4d[_0x888a('0x3a')]);_0x51512d[_0x888a('0x43')]=_[_0x888a('0x39')](_0x51512d[_0x888a('0x37')],_0x51512d[_0x888a('0x3a')]);_0x50e02e[_0x888a('0x3b')]=_[_0x888a('0x39')](_0x51512d['model'],qs[_0x888a('0x3c')](_0x435f4d[_0x888a('0x3a')][_0x888a('0x3c')]));_0x50e02e['attributes']=_0x50e02e[_0x888a('0x3b')][_0x888a('0x3d')]?_0x50e02e[_0x888a('0x3b')]:_0x51512d['model'];_0x50e02e[_0x888a('0x40')]=qs[_0x888a('0x41')](_0x435f4d[_0x888a('0x3a')]['sort']);_0x50e02e['where']=qs['filters'](_[_0x888a('0x44')](_0x435f4d[_0x888a('0x3a')],_0x51512d['filters']));if(_0x435f4d[_0x888a('0x3a')][_0x888a('0x45')]){_0x50e02e[_0x888a('0x42')]=_[_0x888a('0x46')](_0x50e02e[_0x888a('0x42')],{'$or':_['map'](_0x50e02e[_0x888a('0x3b')],function(_0x2d58b7){var _0x33a428={};_0x33a428[_0x2d58b7]={'$like':'%'+_0x435f4d[_0x888a('0x3a')][_0x888a('0x45')]+'%'};return _0x33a428;})});}_0x50e02e=_[_0x888a('0x46')]({},_0x50e02e,_0x435f4d[_0x888a('0x49')]);return _0x161793[_0x888a('0x83')](_0x50e02e);}})[_0x888a('0x2b')](function(_0x3af9e6){if(_0x3af9e6){_0x341883=_0x3af9e6['length'];if(!_0x435f4d[_0x888a('0x3a')]['hasOwnProperty'](_0x888a('0x3f'))){_0x50e02e['limit']=qs['limit'](_0x435f4d[_0x888a('0x3a')]['limit']);_0x50e02e[_0x888a('0x22')]=qs[_0x888a('0x22')](_0x435f4d[_0x888a('0x3a')]['offset']);}return _0x161793[_0x888a('0x83')](_0x50e02e);}})['then'](function(_0x538693){if(_0x538693){return _0x538693?{'count':_0x341883,'rows':_0x538693}:null;}})[_0x888a('0x2b')](respondWithResult(_0x3f8d5c,null))['catch'](handleError(_0x3f8d5c,null));}; \ No newline at end of file +var _0x9fc4=['update','then','get','destroy','error','stack','name','send','map','Dashboard','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0xfc2dc,_0x465465){var _0x466519=function(_0x56b16e){while(--_0x56b16e){_0xfc2dc['push'](_0xfc2dc['shift']());}};_0x466519(++_0x465465);}(_0x9fc4,0x15f));var _0x49fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fc4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49fc('0x0'));var zipdir=require(_0x49fc('0x1'));var jsonpatch=require(_0x49fc('0x2'));var rp=require(_0x49fc('0x3'));var moment=require(_0x49fc('0x4'));var BPromise=require(_0x49fc('0x5'));var Mustache=require(_0x49fc('0x6'));var util=require(_0x49fc('0x7'));var path=require(_0x49fc('0x8'));var sox=require(_0x49fc('0x9'));var csv=require(_0x49fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49fc('0xb'));var _=require('lodash');var squel=require(_0x49fc('0xc'));var crypto=require(_0x49fc('0xd'));var jsforce=require(_0x49fc('0xe'));var deskjs=require(_0x49fc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49fc('0x10'));var Redis=require(_0x49fc('0x11'));var authService=require(_0x49fc('0x12'));var qs=require(_0x49fc('0x13'));var as=require(_0x49fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49fc('0x15'))(_0x49fc('0x16'));var utils=require(_0x49fc('0x17'));var config=require(_0x49fc('0x18'));var licenseUtil=require(_0x49fc('0x19'));var db=require(_0x49fc('0x1a'))['db'];config[_0x49fc('0x1b')]=_[_0x49fc('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x49fc('0x1d'))(new Redis(config[_0x49fc('0x1b')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x315f63,_0x8ee19b){_0x8ee19b=_0x8ee19b||0xcc;return function(_0x16d5e8){if(_0x16d5e8){return _0x315f63[_0x49fc('0x1e')](_0x8ee19b);}return _0x315f63['status'](_0x8ee19b)[_0x49fc('0x1f')]();};}function respondWithResult(_0x32f044,_0x41feef){_0x41feef=_0x41feef||0xc8;return function(_0x228db6){if(_0x228db6){return _0x32f044[_0x49fc('0x20')](_0x41feef)[_0x49fc('0x21')](_0x228db6);}};}function respondWithFilteredResult(_0x399601,_0x213e03){return function(_0x1fd58d){if(_0x1fd58d){var _0x292f2b=typeof _0x213e03[_0x49fc('0x22')]===_0x49fc('0x23')&&typeof _0x213e03[_0x49fc('0x24')]==='undefined';var _0x392b23=_0x1fd58d[_0x49fc('0x25')];var _0x5ae5c6=_0x292f2b?0x0:_0x213e03['offset'];var _0x2cf09f=_0x292f2b?_0x1fd58d[_0x49fc('0x25')]:_0x213e03[_0x49fc('0x22')]+_0x213e03[_0x49fc('0x24')];var _0x8ae520;if(_0x2cf09f>=_0x392b23){_0x2cf09f=_0x392b23;_0x8ae520=0xc8;}else{_0x8ae520=0xce;}_0x399601['status'](_0x8ae520);return _0x399601[_0x49fc('0x26')]('Content-Range',_0x5ae5c6+'-'+_0x2cf09f+'/'+_0x392b23)[_0x49fc('0x21')](_0x1fd58d);}return null;};}function patchUpdates(_0x2ca496){return function(_0x263451){try{jsonpatch[_0x49fc('0x27')](_0x263451,_0x2ca496,!![]);}catch(_0x443c3d){return BPromise[_0x49fc('0x28')](_0x443c3d);}return _0x263451[_0x49fc('0x29')]();};}function saveUpdates(_0x48c92c,_0x1278e8){return function(_0xcb75a7){if(_0xcb75a7){return _0xcb75a7[_0x49fc('0x2a')](_0x48c92c)[_0x49fc('0x2b')](function(_0x2002ae){return _0x2002ae;});}return null;};}function removeEntity(_0x52c42f,_0x5c55d2){return function(_0x5b8608){if(_0x5b8608){return _0x5b8608['destroy']()[_0x49fc('0x2b')](function(){var _0x27d062=_0x5b8608[_0x49fc('0x2c')]({'plain':!![]});var _0x23f7af='CustomDashboards';return db['UserProfileResource'][_0x49fc('0x2d')]({'where':{'type':_0x23f7af,'resourceId':_0x27d062['id']}})[_0x49fc('0x2b')](function(){return _0x5b8608;});})[_0x49fc('0x2b')](function(){_0x52c42f[_0x49fc('0x20')](0xcc)[_0x49fc('0x1f')]();});}};}function handleEntityNotFound(_0x53107e,_0x2f2248){return function(_0x17b966){if(!_0x17b966){_0x53107e['sendStatus'](0x194);}return _0x17b966;};}function handleError(_0x16a6c7,_0x574fb1){_0x574fb1=_0x574fb1||0x1f4;return function(_0x42dcaa){logger[_0x49fc('0x2e')](_0x42dcaa[_0x49fc('0x2f')]);if(_0x42dcaa[_0x49fc('0x30')]){delete _0x42dcaa[_0x49fc('0x30')];}_0x16a6c7['status'](_0x574fb1)[_0x49fc('0x31')](_0x42dcaa);};}exports['index']=function(_0x39e27c,_0x594f58){var _0x3e325b={},_0x2e4398={},_0x3ed84b={'count':0x0,'rows':[]};var _0x3e66d8=_[_0x49fc('0x32')](db[_0x49fc('0x33')]['rawAttributes'],function(_0x24ebda){return{'name':_0x24ebda[_0x49fc('0x34')],'type':_0x24ebda[_0x49fc('0x35')][_0x49fc('0x36')]};});_0x2e4398[_0x49fc('0x37')]=_['map'](_0x3e66d8,_0x49fc('0x30'));_0x2e4398[_0x49fc('0x38')]=_[_0x49fc('0x39')](_0x39e27c[_0x49fc('0x38')]);_0x2e4398[_0x49fc('0x3a')]=_['intersection'](_0x2e4398[_0x49fc('0x37')],_0x2e4398[_0x49fc('0x38')]);_0x3e325b[_0x49fc('0x3b')]=_[_0x49fc('0x3c')](_0x2e4398[_0x49fc('0x37')],qs[_0x49fc('0x3d')](_0x39e27c[_0x49fc('0x38')][_0x49fc('0x3d')]));_0x3e325b[_0x49fc('0x3b')]=_0x3e325b[_0x49fc('0x3b')][_0x49fc('0x3e')]?_0x3e325b[_0x49fc('0x3b')]:_0x2e4398[_0x49fc('0x37')];if(!_0x39e27c[_0x49fc('0x38')][_0x49fc('0x3f')](_0x49fc('0x40'))){_0x3e325b[_0x49fc('0x24')]=qs[_0x49fc('0x24')](_0x39e27c[_0x49fc('0x38')][_0x49fc('0x24')]);_0x3e325b[_0x49fc('0x22')]=qs['offset'](_0x39e27c[_0x49fc('0x38')][_0x49fc('0x22')]);}_0x3e325b[_0x49fc('0x41')]=qs[_0x49fc('0x42')](_0x39e27c[_0x49fc('0x38')][_0x49fc('0x42')]);_0x3e325b[_0x49fc('0x43')]=qs[_0x49fc('0x3a')](_[_0x49fc('0x44')](_0x39e27c[_0x49fc('0x38')],_0x2e4398[_0x49fc('0x3a')]),_0x3e66d8);if(_0x39e27c['query'][_0x49fc('0x45')]){_0x3e325b[_0x49fc('0x43')]=_[_0x49fc('0x46')](_0x3e325b[_0x49fc('0x43')],{'$or':_['map'](_0x3e66d8,function(_0x27e238){if(_0x27e238['type']!==_0x49fc('0x47')){var _0x533df1={};_0x533df1[_0x27e238[_0x49fc('0x30')]]={'$like':'%'+_0x39e27c[_0x49fc('0x38')][_0x49fc('0x45')]+'%'};return _0x533df1;}})});}_0x3e325b=_[_0x49fc('0x46')]({},_0x3e325b,_0x39e27c[_0x49fc('0x48')]);var _0x2ef659={'where':_0x3e325b[_0x49fc('0x43')]};return db[_0x49fc('0x33')][_0x49fc('0x25')](_0x2ef659)[_0x49fc('0x2b')](function(_0x1aa232){_0x3ed84b['count']=_0x1aa232;if(_0x39e27c['query'][_0x49fc('0x49')]){_0x3e325b[_0x49fc('0x4a')]=[{'all':!![]}];}return db[_0x49fc('0x33')]['findAll'](_0x3e325b);})[_0x49fc('0x2b')](function(_0x5f0ec2){_0x3ed84b['rows']=_0x5f0ec2;return _0x3ed84b;})[_0x49fc('0x2b')](respondWithFilteredResult(_0x594f58,_0x3e325b))[_0x49fc('0x4b')](handleError(_0x594f58,null));};exports[_0x49fc('0x4c')]=function(_0x4dfed8,_0x21e9b2){var _0x5c5562={'raw':![],'where':{'id':_0x4dfed8[_0x49fc('0x4d')]['id']}},_0x3403dd={};_0x3403dd[_0x49fc('0x37')]=_[_0x49fc('0x39')](db['Dashboard'][_0x49fc('0x4e')]);_0x3403dd[_0x49fc('0x38')]=_[_0x49fc('0x39')](_0x4dfed8['query']);_0x3403dd[_0x49fc('0x3a')]=_[_0x49fc('0x3c')](_0x3403dd['model'],_0x3403dd[_0x49fc('0x38')]);_0x5c5562[_0x49fc('0x3b')]=_[_0x49fc('0x3c')](_0x3403dd[_0x49fc('0x37')],qs[_0x49fc('0x3d')](_0x4dfed8[_0x49fc('0x38')]['fields']));_0x5c5562[_0x49fc('0x3b')]=_0x5c5562['attributes']['length']?_0x5c5562['attributes']:_0x3403dd['model'];if(_0x4dfed8['query']['includeAll']){_0x5c5562[_0x49fc('0x4a')]=[{'all':!![]}];}_0x5c5562=_[_0x49fc('0x46')]({},_0x5c5562,_0x4dfed8['options']);return db['Dashboard'][_0x49fc('0x4f')](_0x5c5562)['then'](handleEntityNotFound(_0x21e9b2,null))['then'](respondWithResult(_0x21e9b2,null))[_0x49fc('0x4b')](handleError(_0x21e9b2,null));};exports[_0x49fc('0x50')]=function(_0x1b9487,_0x112176){return db[_0x49fc('0x33')][_0x49fc('0x50')](_0x1b9487[_0x49fc('0x51')],{})['then'](function(_0x27a311){var _0x127779=_0x1b9487['user'][_0x49fc('0x2c')]({'plain':!![]});if(!_0x127779)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x127779['role']===_0x49fc('0x52')){var _0x50dc39=_0x27a311['get']({'plain':!![]});var _0x3ae33d=_0x49fc('0x53');return db[_0x49fc('0x54')][_0x49fc('0x4f')]({'where':{'name':_0x3ae33d,'userProfileId':_0x127779[_0x49fc('0x55')]},'raw':!![]})['then'](function(_0x20361e){if(_0x20361e&&_0x20361e[_0x49fc('0x56')]===0x0){return db[_0x49fc('0x57')][_0x49fc('0x50')]({'name':_0x50dc39[_0x49fc('0x30')],'resourceId':_0x50dc39['id'],'type':_0x20361e['name'],'sectionId':_0x20361e['id']},{})[_0x49fc('0x2b')](function(){return _0x27a311;});}else{return _0x27a311;}})[_0x49fc('0x4b')](function(_0x25a35d){logger[_0x49fc('0x2e')](_0x49fc('0x58'),_0x25a35d);throw _0x25a35d;});}return _0x27a311;})['then'](respondWithResult(_0x112176,0xc9))[_0x49fc('0x4b')](handleError(_0x112176,null));};exports[_0x49fc('0x59')]=function(_0x276ba,_0x1e7896){var _0x34423a={'where':{'id':_0x276ba[_0x49fc('0x4d')]['id']}},_0x39d58a={};_0x39d58a[_0x49fc('0x37')]=_[_0x49fc('0x39')](db[_0x49fc('0x33')][_0x49fc('0x4e')]);_0x34423a[_0x49fc('0x3b')]=_[_0x49fc('0x3c')](_0x39d58a[_0x49fc('0x37')],qs[_0x49fc('0x3d')](_0x276ba[_0x49fc('0x38')][_0x49fc('0x3d')]));_0x34423a[_0x49fc('0x3b')]=_0x34423a[_0x49fc('0x3b')]['length']?_0x34423a[_0x49fc('0x3b')]:_0x39d58a[_0x49fc('0x37')];if(_0x276ba[_0x49fc('0x38')][_0x49fc('0x49')]){_0x34423a['include']=[{'all':!![]}];}_0x34423a=_[_0x49fc('0x46')]({},_0x34423a,_0x276ba[_0x49fc('0x48')]);return db[_0x49fc('0x33')]['find'](_0x34423a)[_0x49fc('0x2b')](handleEntityNotFound(_0x1e7896,null))[_0x49fc('0x2b')](function(_0x5ae4da){if(_0x5ae4da){var _0xd5beef=_0x5ae4da[_0x49fc('0x2c')]({'plain':!![]});_0xd5beef=qs[_0x49fc('0x5a')](_0xd5beef,['id',_0x49fc('0x5b'),_0x49fc('0x5c')]);_0x276ba[_0x49fc('0x51')]=_[_0x49fc('0x5a')](_0x276ba[_0x49fc('0x51')],['id',_0x49fc('0x5b'),_0x49fc('0x5c')]);return db['Dashboard'][_0x49fc('0x50')](_[_0x49fc('0x46')](_0xd5beef,_0x276ba[_0x49fc('0x51')]),{'include':_0x276ba[_0x49fc('0x38')][_0x49fc('0x49')]?[{'all':!![]}]:undefined})[_0x49fc('0x2b')](function(_0x3b902a){var _0x203e89=_0x276ba['user'][_0x49fc('0x2c')]({'plain':!![]});if(!_0x203e89)throw new Error(_0x49fc('0x5d'));if(_0x203e89[_0x49fc('0x5e')]===_0x49fc('0x52')){var _0x73e682=_0x3b902a['get']({'plain':!![]});var _0x135018=_0x49fc('0x53');return db['UserProfileSection'][_0x49fc('0x4f')]({'where':{'name':_0x135018,'userProfileId':_0x203e89[_0x49fc('0x55')]},'raw':!![]})[_0x49fc('0x2b')](function(_0x4a9648){if(_0x4a9648&&_0x4a9648[_0x49fc('0x56')]===0x0){return db[_0x49fc('0x57')][_0x49fc('0x50')]({'name':_0x73e682['name'],'resourceId':_0x73e682['id'],'type':_0x4a9648[_0x49fc('0x30')],'sectionId':_0x4a9648['id']},{})['then'](function(){return _0x3b902a;});}else{return _0x3b902a;}})['catch'](function(_0x5d22af){logger[_0x49fc('0x2e')](_0x49fc('0x58'),_0x5d22af);throw _0x5d22af;});}return _0x3b902a;});}})[_0x49fc('0x2b')](respondWithResult(_0x1e7896,0xc9))[_0x49fc('0x4b')](handleError(_0x1e7896,null));};exports[_0x49fc('0x2a')]=function(_0xcd2681,_0x1f988b){if(_0xcd2681[_0x49fc('0x51')]['id']){delete _0xcd2681['body']['id'];}return db['Dashboard'][_0x49fc('0x4f')]({'where':{'id':_0xcd2681['params']['id']}})[_0x49fc('0x2b')](handleEntityNotFound(_0x1f988b,null))['then'](saveUpdates(_0xcd2681[_0x49fc('0x51')],null))[_0x49fc('0x2b')](respondWithResult(_0x1f988b,null))[_0x49fc('0x4b')](handleError(_0x1f988b,null));};exports[_0x49fc('0x2d')]=function(_0x321580,_0x23d2b){return db['Dashboard'][_0x49fc('0x4f')]({'where':{'id':_0x321580['params']['id']}})[_0x49fc('0x2b')](handleEntityNotFound(_0x23d2b,null))['then'](removeEntity(_0x23d2b,null))['catch'](handleError(_0x23d2b,null));};function widgetAttributes(_0x42e35b){try{switch(_0x42e35b[_0x49fc('0x35')]){case _0x49fc('0x5f'):return[{'name':'attrUrl','value':_0x42e35b['attrUrl']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b[_0x49fc('0x60')][0x0][_0x49fc('0x61')]:undefined)||_0x49fc('0x62')}];case _0x49fc('0x63'):return[{'name':_0x49fc('0x64'),'value':_0x42e35b['attrPath']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b['attrs'][0x0][_0x49fc('0x61')]:undefined)||''}];case _0x49fc('0x65'):return[{'name':_0x49fc('0x66'),'value':_0x42e35b[_0x49fc('0x66')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b[_0x49fc('0x60')][0x0][_0x49fc('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x49fc('0x67'),'value':_0x42e35b[_0x49fc('0x67')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x1]?_0x42e35b[_0x49fc('0x60')][0x1][_0x49fc('0x61')]:undefined)||'0.00'},{'name':_0x49fc('0x68'),'value':_0x42e35b[_0x49fc('0x68')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x2]?_0x42e35b[_0x49fc('0x60')][0x2][_0x49fc('0x61')]:undefined)||0xc}];case _0x49fc('0x69'):return[{'name':_0x49fc('0x6a'),'value':_0x42e35b[_0x49fc('0x6a')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b[_0x49fc('0x60')][0x0][_0x49fc('0x61')]:undefined)||_0x49fc('0x6b')},{'name':'attrVoiceQueues','value':_0x42e35b[_0x49fc('0x6c')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x1]?_0x42e35b['attrs'][0x1][_0x49fc('0x61')]:undefined)||[]},{'name':_0x49fc('0x68'),'value':_0x42e35b[_0x49fc('0x68')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b['attrs'][0x2]?_0x42e35b[_0x49fc('0x60')][0x2][_0x49fc('0x61')]:undefined)||0x14},{'name':_0x49fc('0x6d'),'value':_0x42e35b[_0x49fc('0x6d')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b['attrs'][0x3]?_0x42e35b['attrs'][0x3][_0x49fc('0x61')]:undefined)||_0x49fc('0x6e')},{'name':_0x49fc('0x6f'),'value':_0x42e35b[_0x49fc('0x6f')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x4]?_0x42e35b['attrs'][0x4][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x70'),'value':_0x42e35b[_0x49fc('0x70')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x5]?_0x42e35b[_0x49fc('0x60')][0x5][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x71'),'value':_0x42e35b[_0x49fc('0x71')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x6]?_0x42e35b['attrs'][0x6][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x72'),'value':_0x42e35b[_0x49fc('0x72')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x7]?_0x42e35b[_0x49fc('0x60')][0x7][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x73'),'value':_0x42e35b[_0x49fc('0x73')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x8]?_0x42e35b[_0x49fc('0x60')][0x8][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x74'),'value':_0x42e35b['attrChatWebsites']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x9]?_0x42e35b['attrs'][0x9][_0x49fc('0x61')]:undefined)||''}];case _0x49fc('0x75'):case _0x49fc('0x76'):return[{'name':_0x49fc('0x77'),'value':_0x42e35b['attrSerie1']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b[_0x49fc('0x60')][0x0]['value']:undefined)||_0x49fc('0x6b')},{'name':_0x49fc('0x78'),'value':_0x42e35b['attrSerie2']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x1]?_0x42e35b[_0x49fc('0x60')][0x1]['value']:undefined)||null},{'name':_0x49fc('0x79'),'value':_0x42e35b[_0x49fc('0x79')]||(_0x42e35b['attrs']&&_0x42e35b[_0x49fc('0x60')][0x2]?_0x42e35b['attrs'][0x2][_0x49fc('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x42e35b[_0x49fc('0x6c')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x3]?_0x42e35b[_0x49fc('0x60')][0x3][_0x49fc('0x61')]:undefined)||[]},{'name':_0x49fc('0x6d'),'value':_0x42e35b[_0x49fc('0x6d')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x4]?_0x42e35b[_0x49fc('0x60')][0x4]['value']:undefined)||_0x49fc('0x6e')},{'name':_0x49fc('0x6f'),'value':_0x42e35b[_0x49fc('0x6f')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x5]?_0x42e35b[_0x49fc('0x60')][0x5][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x70'),'value':_0x42e35b['attrFaxAccounts']||(_0x42e35b['attrs']&&_0x42e35b[_0x49fc('0x60')][0x6]?_0x42e35b['attrs'][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x42e35b[_0x49fc('0x71')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b['attrs'][0x7]?_0x42e35b['attrs'][0x7][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x72'),'value':_0x42e35b[_0x49fc('0x72')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0x8]?_0x42e35b[_0x49fc('0x60')][0x8][_0x49fc('0x61')]:undefined)||''},{'name':_0x49fc('0x73'),'value':_0x42e35b[_0x49fc('0x73')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b['attrs'][0x9]?_0x42e35b[_0x49fc('0x60')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x42e35b[_0x49fc('0x74')]||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b[_0x49fc('0x60')][0xa]?_0x42e35b['attrs'][0xa][_0x49fc('0x61')]:undefined)||''}];case _0x49fc('0x7a'):return[{'name':_0x49fc('0x7b'),'type':_0x42e35b['reportType']||(_0x42e35b[_0x49fc('0x60')]&&_0x42e35b['attrs'][0x0]?_0x42e35b[_0x49fc('0x60')][0x0][_0x49fc('0x35')]:undefined)||null,'value':_0x42e35b['attrReport']||(_0x42e35b['attrs']&&_0x42e35b[_0x49fc('0x60')][0x0]?_0x42e35b[_0x49fc('0x60')][0x0][_0x49fc('0x61')]:undefined)||null},{'name':_0x49fc('0x7c'),'value':_0x42e35b[_0x49fc('0x7c')]||(_0x42e35b['attrs']&&_0x42e35b['attrs'][0x1]?_0x42e35b[_0x49fc('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x53b511){logger[_0x49fc('0x2e')](_0x49fc('0x7d'),JSON[_0x49fc('0x7e')](_0x53b511));return[];}}exports[_0x49fc('0x7f')]=function(_0x35b9cc,_0x25c489,_0x1df839){if(_0x35b9cc[_0x49fc('0x51')]['id']){delete _0x35b9cc[_0x49fc('0x51')]['id'];}return db[_0x49fc('0x33')][_0x49fc('0x4f')]({'where':{'id':_0x35b9cc[_0x49fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x25c489,null))[_0x49fc('0x2b')](function(_0x2c2cc4){if(_0x2c2cc4){_0x35b9cc[_0x49fc('0x51')][_0x49fc('0x80')]=_0x2c2cc4['id'];_0x35b9cc[_0x49fc('0x51')][_0x49fc('0x60')]=widgetAttributes(_0x35b9cc[_0x49fc('0x51')]);return db['DashboardItem'][_0x49fc('0x50')](_0x35b9cc[_0x49fc('0x51')]);}})[_0x49fc('0x2b')](respondWithResult(_0x25c489,null))[_0x49fc('0x4b')](handleError(_0x25c489,null));};exports['getItems']=function(_0x3a92fa,_0x49cf3d,_0x2e89cf){var _0x2f73d8={};var _0x2de61d={};var _0x5f2f72;var _0x1ea7f1;return db[_0x49fc('0x33')]['findOne']({'where':{'id':_0x3a92fa['params']['id']}})[_0x49fc('0x2b')](handleEntityNotFound(_0x49cf3d,null))['then'](function(_0x2c698e){if(_0x2c698e){_0x5f2f72=_0x2c698e;_0x2de61d[_0x49fc('0x37')]=_['keys'](db[_0x49fc('0x81')][_0x49fc('0x4e')]);_0x2de61d[_0x49fc('0x38')]=_[_0x49fc('0x39')](_0x3a92fa['query']);_0x2de61d[_0x49fc('0x3a')]=_[_0x49fc('0x3c')](_0x2de61d[_0x49fc('0x37')],_0x2de61d[_0x49fc('0x38')]);_0x2f73d8[_0x49fc('0x3b')]=_[_0x49fc('0x3c')](_0x2de61d[_0x49fc('0x37')],qs[_0x49fc('0x3d')](_0x3a92fa['query'][_0x49fc('0x3d')]));_0x2f73d8['attributes']=_0x2f73d8['attributes'][_0x49fc('0x3e')]?_0x2f73d8[_0x49fc('0x3b')]:_0x2de61d[_0x49fc('0x37')];_0x2f73d8['order']=qs[_0x49fc('0x42')](_0x3a92fa[_0x49fc('0x38')]['sort']);_0x2f73d8[_0x49fc('0x43')]=qs[_0x49fc('0x3a')](_['pick'](_0x3a92fa[_0x49fc('0x38')],_0x2de61d[_0x49fc('0x3a')]));if(_0x3a92fa[_0x49fc('0x38')][_0x49fc('0x45')]){_0x2f73d8[_0x49fc('0x43')]=_[_0x49fc('0x46')](_0x2f73d8[_0x49fc('0x43')],{'$or':_['map'](_0x2f73d8['attributes'],function(_0x216247){var _0x384830={};_0x384830[_0x216247]={'$like':'%'+_0x3a92fa[_0x49fc('0x38')]['filter']+'%'};return _0x384830;})});}_0x2f73d8=_[_0x49fc('0x46')]({},_0x2f73d8,_0x3a92fa['options']);return _0x5f2f72['getItems'](_0x2f73d8);}})['then'](function(_0x2a5bd6){if(_0x2a5bd6){_0x1ea7f1=_0x2a5bd6['length'];if(!_0x3a92fa[_0x49fc('0x38')][_0x49fc('0x3f')](_0x49fc('0x40'))){_0x2f73d8['limit']=qs[_0x49fc('0x24')](_0x3a92fa['query'][_0x49fc('0x24')]);_0x2f73d8[_0x49fc('0x22')]=qs['offset'](_0x3a92fa[_0x49fc('0x38')]['offset']);}return _0x5f2f72[_0x49fc('0x82')](_0x2f73d8);}})[_0x49fc('0x2b')](function(_0x3afc1f){if(_0x3afc1f){return _0x3afc1f?{'count':_0x1ea7f1,'rows':_0x3afc1f}:null;}})[_0x49fc('0x2b')](respondWithResult(_0x49cf3d,null))[_0x49fc('0x4b')](handleError(_0x49cf3d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a2b11d2..336463d 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 _0xcac3=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x174c2d,_0x20271f){var _0x4080e1=function(_0xf175c1){while(--_0xf175c1){_0x174c2d['push'](_0x174c2d['shift']());}};_0x4080e1(++_0x20271f);}(_0xcac3,0x193));var _0x3cac=function(_0x4230f4,_0x38625b){_0x4230f4=_0x4230f4-0x0;var _0x4a12ac=_0xcac3[_0x4230f4];return _0x4a12ac;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3cac('0x0'))['db'][_0x3cac('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3cac('0x2')](0x0);var events={'afterCreate':_0x3cac('0x3'),'afterUpdate':_0x3cac('0x4'),'afterDestroy':_0x3cac('0x5')};function emitEvent(_0x40033c){return function(_0xce6bcd,_0x2d7790,_0x346c24){DashboardEvents[_0x3cac('0x6')](_0x40033c+':'+_0xce6bcd['id'],_0xce6bcd);DashboardEvents[_0x3cac('0x6')](_0x40033c,_0xce6bcd);_0x346c24(null);};}for(var e in events){if(events[_0x3cac('0x7')](e)){var event=events[e];Dashboard[_0x3cac('0x8')](e,emitEvent(event));}}module[_0x3cac('0x9')]=DashboardEvents; \ No newline at end of file +var _0xeda7=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeda7,0x196));var _0x7eda=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xeda7[_0x946518];return _0x909b69;};'use strict';var EventEmitter=require(_0x7eda('0x0'));var Dashboard=require(_0x7eda('0x1'))['db'][_0x7eda('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7eda('0x3')](0x0);var events={'afterCreate':_0x7eda('0x4'),'afterUpdate':_0x7eda('0x5'),'afterDestroy':_0x7eda('0x6')};function emitEvent(_0x2b1d21){return function(_0x324a25,_0x36a9f1,_0x15856b){DashboardEvents[_0x7eda('0x7')](_0x2b1d21+':'+_0x324a25['id'],_0x324a25);DashboardEvents[_0x7eda('0x7')](_0x2b1d21,_0x324a25);_0x15856b(null);};}for(var e in events){if(events[_0x7eda('0x8')](e)){var event=events[e];Dashboard[_0x7eda('0x9')](e,emitEvent(event));}}module[_0x7eda('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 07fe880..aadb48a 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 _0x128d=['./dashboard.attributes','define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x68c5b2,_0x3e923c){var _0x58fd07=function(_0x562da1){while(--_0x562da1){_0x68c5b2['push'](_0x68c5b2['shift']());}};_0x58fd07(++_0x3e923c);}(_0x128d,0x179));var _0xd128=function(_0x1f0642,_0xee8ed6){_0x1f0642=_0x1f0642-0x0;var _0x171d07=_0x128d[_0x1f0642];return _0x171d07;};'use strict';var _=require(_0xd128('0x0'));var util=require(_0xd128('0x1'));var logger=require(_0xd128('0x2'))(_0xd128('0x3'));var moment=require(_0xd128('0x4'));var BPromise=require(_0xd128('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd128('0x6'));var rimraf=require('rimraf');var config=require(_0xd128('0x7'));var attributes=require(_0xd128('0x8'));module['exports']=function(_0x327360,_0x6f2cd6){return _0x327360[_0xd128('0x9')]('Dashboard',attributes,{'tableName':_0xd128('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d41=['../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','api','bluebird','request-promise','path'];(function(_0x37789b,_0xfa89c8){var _0x138388=function(_0x4136c5){while(--_0x4136c5){_0x37789b['push'](_0x37789b['shift']());}};_0x138388(++_0xfa89c8);}(_0x6d41,0x118));var _0x16d4=function(_0x1bc9b8,_0x379fc7){_0x1bc9b8=_0x1bc9b8-0x0;var _0x1a9a13=_0x6d41[_0x1bc9b8];return _0x1a9a13;};'use strict';var _=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var logger=require('../../config/logger')(_0x16d4('0x2'));var moment=require('moment');var BPromise=require(_0x16d4('0x3'));var rp=require(_0x16d4('0x4'));var fs=require('fs');var path=require(_0x16d4('0x5'));var rimraf=require('rimraf');var config=require(_0x16d4('0x6'));var attributes=require(_0x16d4('0x7'));module[_0x16d4('0x8')]=function(_0x10a301,_0x34e67c){return _0x10a301['define'](_0x16d4('0x9'),attributes,{'tableName':_0x16d4('0xa'),'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 28604b8..30a21b8 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 _0x9c36=['http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2da9db,_0x16a3e4){var _0x306a99=function(_0x73f36f){while(--_0x73f36f){_0x2da9db['push'](_0x2da9db['shift']());}};_0x306a99(++_0x16a3e4);}(_0x9c36,0x163));var _0x69c3=function(_0x49937a,_0x4c6b72){_0x49937a=_0x49937a-0x0;var _0x3d040b=_0x9c36[_0x49937a];return _0x3d040b;};'use strict';var _=require(_0x69c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69c3('0x1'));var rs=require(_0x69c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69c3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x69c3('0x4'))(_0x69c3('0x5'));var config=require(_0x69c3('0x6'));var jayson=require(_0x69c3('0x7'));var client=jayson[_0x69c3('0x8')][_0x69c3('0x9')]({'port':0x232a});config[_0x69c3('0xa')]=_[_0x69c3('0xb')](config[_0x69c3('0xa')],{'host':_0x69c3('0xc'),'port':0x18eb});var socket=require(_0x69c3('0xd'))(new Redis(config[_0x69c3('0xa')]));require(_0x69c3('0xe'))[_0x69c3('0xf')](socket);function respondWithRpcPromise(_0x4d4638,_0x4cbd55,_0x57390f){return new BPromise(function(_0x51d27b,_0x47d038){return client[_0x69c3('0x10')](_0x4d4638,_0x57390f)[_0x69c3('0x11')](function(_0x3a3b99){logger[_0x69c3('0x12')]('Dashboard,\x20%s,\x20%s',_0x4cbd55,_0x69c3('0x13'));logger[_0x69c3('0x14')](_0x69c3('0x15'),_0x4cbd55,_0x69c3('0x13'),JSON[_0x69c3('0x16')](_0x3a3b99));if(_0x3a3b99[_0x69c3('0x17')]){if(_0x3a3b99[_0x69c3('0x17')][_0x69c3('0x18')]===0x1f4){logger['error'](_0x69c3('0x19'),_0x4cbd55,_0x3a3b99[_0x69c3('0x17')][_0x69c3('0x1a')]);return _0x47d038(_0x3a3b99[_0x69c3('0x17')]['message']);}logger[_0x69c3('0x17')](_0x69c3('0x19'),_0x4cbd55,_0x3a3b99['error'][_0x69c3('0x1a')]);return _0x51d27b(_0x3a3b99[_0x69c3('0x17')][_0x69c3('0x1a')]);}else{logger[_0x69c3('0x12')]('Dashboard,\x20%s,\x20%s',_0x4cbd55,_0x69c3('0x13'));_0x51d27b(_0x3a3b99[_0x69c3('0x1b')][_0x69c3('0x1a')]);}})['catch'](function(_0x20b5c3){logger[_0x69c3('0x17')]('Dashboard,\x20%s,\x20%s',_0x4cbd55,_0x20b5c3);_0x47d038(_0x20b5c3);});});} \ No newline at end of file +var _0x3095=['../../config/environment','client','http','redis','defaults','./dashboard.socket','register','request','info','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x1df999,_0x49c69d){var _0x13b087=function(_0xf20d93){while(--_0xf20d93){_0x1df999['push'](_0x1df999['shift']());}};_0x13b087(++_0x49c69d);}(_0x3095,0x15f));var _0x5309=function(_0xb08125,_0x561acb){_0xb08125=_0xb08125-0x0;var _0x2ace23=_0x3095[_0xb08125];return _0x2ace23;};'use strict';var _=require(_0x5309('0x0'));var util=require(_0x5309('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5309('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5309('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5309('0x4'))(_0x5309('0x5'));var config=require(_0x5309('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5309('0x7')][_0x5309('0x8')]({'port':0x232a});config[_0x5309('0x9')]=_[_0x5309('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5309('0xb'))[_0x5309('0xc')](socket);function respondWithRpcPromise(_0x3510ab,_0x1de8f1,_0xd34f67){return new BPromise(function(_0x4c7d32,_0x2be0c4){return client[_0x5309('0xd')](_0x3510ab,_0xd34f67)['then'](function(_0xb1a94e){logger[_0x5309('0xe')]('Dashboard,\x20%s,\x20%s',_0x1de8f1,_0x5309('0xf'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1de8f1,_0x5309('0xf'),JSON[_0x5309('0x10')](_0xb1a94e));if(_0xb1a94e[_0x5309('0x11')]){if(_0xb1a94e[_0x5309('0x11')][_0x5309('0x12')]===0x1f4){logger[_0x5309('0x11')](_0x5309('0x13'),_0x1de8f1,_0xb1a94e[_0x5309('0x11')][_0x5309('0x14')]);return _0x2be0c4(_0xb1a94e[_0x5309('0x11')][_0x5309('0x14')]);}logger['error'](_0x5309('0x13'),_0x1de8f1,_0xb1a94e[_0x5309('0x11')][_0x5309('0x14')]);return _0x4c7d32(_0xb1a94e[_0x5309('0x11')][_0x5309('0x14')]);}else{logger[_0x5309('0xe')](_0x5309('0x13'),_0x1de8f1,'request\x20sent');_0x4c7d32(_0xb1a94e['result'][_0x5309('0x14')]);}})['catch'](function(_0x285ccd){logger[_0x5309('0x11')](_0x5309('0x13'),_0x1de8f1,_0x285ccd);_0x2be0c4(_0x285ccd);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5c16776..bee64dd 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 _0x871a=['update','emit','removeListener','length','dashboard:','./dashboard.events','save','remove'];(function(_0x20629d,_0x1a6757){var _0x4ca950=function(_0x2c806c){while(--_0x2c806c){_0x20629d['push'](_0x20629d['shift']());}};_0x4ca950(++_0x1a6757);}(_0x871a,0x1e5));var _0xa871=function(_0x12da6c,_0x23ee55){_0x12da6c=_0x12da6c-0x0;var _0x3ef7b3=_0x871a[_0x12da6c];return _0x3ef7b3;};'use strict';var DashboardEvents=require(_0xa871('0x0'));var events=[_0xa871('0x1'),_0xa871('0x2'),_0xa871('0x3')];function createListener(_0x31ec6a,_0x1b386f){return function(_0x51509e){_0x1b386f[_0xa871('0x4')](_0x31ec6a,_0x51509e);};}function removeListener(_0x212a99,_0x1a7e01){return function(){DashboardEvents[_0xa871('0x5')](_0x212a99,_0x1a7e01);};}exports['register']=function(_0x164416){for(var _0x1b3979=0x0,_0x5685fd=events[_0xa871('0x6')];_0x1b3979<_0x5685fd;_0x1b3979++){var _0x940c6e=events[_0x1b3979];var _0x4a591b=createListener(_0xa871('0x7')+_0x940c6e,_0x164416);DashboardEvents['on'](_0x940c6e,_0x4a591b);}}; \ No newline at end of file +var _0x79ca=['dashboard:','./dashboard.events','remove','update','removeListener','length'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x79ca,0xdf));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var DashboardEvents=require(_0xa79c('0x0'));var events=['save',_0xa79c('0x1'),_0xa79c('0x2')];function createListener(_0x15e41a,_0x478c24){return function(_0x453d43){_0x478c24['emit'](_0x15e41a,_0x453d43);};}function removeListener(_0x3e4f9a,_0x17a9a8){return function(){DashboardEvents[_0xa79c('0x3')](_0x3e4f9a,_0x17a9a8);};}exports['register']=function(_0xe6b1d3){for(var _0x212992=0x0,_0x43ff9b=events[_0xa79c('0x4')];_0x212992<_0x43ff9b;_0x212992++){var _0x295e74=events[_0x212992];var _0x54e0b8=createListener(_0xa79c('0x5')+_0x295e74,_0xe6b1d3);DashboardEvents['on'](_0x295e74,_0x54e0b8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 91e7d37..44fa58d 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 _0x900a=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','getItems','post','/:id/clone','addItem','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3987bf,_0x597b0f){var _0x2a05f0=function(_0x5253bb){while(--_0x5253bb){_0x3987bf['push'](_0x3987bf['shift']());}};_0x2a05f0(++_0x597b0f);}(_0x900a,0x151));var _0xa900=function(_0xa6604c,_0x198151){_0xa6604c=_0xa6604c-0x0;var _0x2bb2a1=_0x900a[_0xa6604c];return _0x2bb2a1;};'use strict';var multer=require(_0xa900('0x0'));var util=require(_0xa900('0x1'));var path=require(_0xa900('0x2'));var timeout=require(_0xa900('0x3'));var express=require(_0xa900('0x4'));var router=express[_0xa900('0x5')]();var fs_extra=require(_0xa900('0x6'));var auth=require(_0xa900('0x7'));var interaction=require(_0xa900('0x8'));var config=require(_0xa900('0x9'));var controller=require(_0xa900('0xa'));router[_0xa900('0xb')]('/',auth[_0xa900('0xc')](),controller[_0xa900('0xd')]);router[_0xa900('0xb')](_0xa900('0xe'),auth[_0xa900('0xc')](),controller['show']);router['get']('/:id/items',auth[_0xa900('0xc')](),controller[_0xa900('0xf')]);router[_0xa900('0x10')]('/',auth[_0xa900('0xc')](),controller['create']);router[_0xa900('0x10')](_0xa900('0x11'),auth[_0xa900('0xc')](),controller['clone']);router[_0xa900('0x10')]('/:id/items',auth[_0xa900('0xc')](),controller[_0xa900('0x12')]);router[_0xa900('0x13')](_0xa900('0xe'),auth[_0xa900('0xc')](),controller[_0xa900('0x14')]);router['delete'](_0xa900('0xe'),auth['isAuthenticated'](),controller[_0xa900('0x15')]);module[_0xa900('0x16')]=router; \ No newline at end of file +var _0x7179=['multer','util','connect-timeout','express','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','post','create','/:id/clone','addItem','put','/:id','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7179,0x18c));var _0x9717=function(_0x1052e9,_0x12a216){_0x1052e9=_0x1052e9-0x0;var _0x5b0fc=_0x7179[_0x1052e9];return _0x5b0fc;};'use strict';var multer=require(_0x9717('0x0'));var util=require(_0x9717('0x1'));var path=require('path');var timeout=require(_0x9717('0x2'));var express=require(_0x9717('0x3'));var router=express['Router']();var fs_extra=require(_0x9717('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9717('0x5'));var controller=require(_0x9717('0x6'));router[_0x9717('0x7')]('/',auth[_0x9717('0x8')](),controller[_0x9717('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9717('0xa')]);router[_0x9717('0x7')](_0x9717('0xb'),auth['isAuthenticated'](),controller['getItems']);router[_0x9717('0xc')]('/',auth['isAuthenticated'](),controller[_0x9717('0xd')]);router[_0x9717('0xc')](_0x9717('0xe'),auth[_0x9717('0x8')](),controller['clone']);router[_0x9717('0xc')](_0x9717('0xb'),auth['isAuthenticated'](),controller[_0x9717('0xf')]);router[_0x9717('0x10')](_0x9717('0x11'),auth[_0x9717('0x8')](),controller[_0x9717('0x12')]);router[_0x9717('0x13')](_0x9717('0x11'),auth['isAuthenticated'](),controller[_0x9717('0x14')]);module[_0x9717('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a0763a0..7016e41 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 _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0xfdbd[_0xf1af27];return _0x46b274;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9b3105c..72634ea 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 _0x5226=['attrSerie1','total','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','destroy','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart'];(function(_0x1e6eab,_0x216f5b){var _0x5f5517=function(_0x1acf8b){while(--_0x1acf8b){_0x1e6eab['push'](_0x1e6eab['shift']());}};_0x5f5517(++_0x216f5b);}(_0x5226,0x137));var _0x6522=function(_0x5ac407,_0x44a5fe){_0x5ac407=_0x5ac407-0x0;var _0x51d089=_0x5226[_0x5ac407];return _0x51d089;};'use strict';var emlformat=require(_0x6522('0x0'));var rimraf=require(_0x6522('0x1'));var zipdir=require(_0x6522('0x2'));var jsonpatch=require(_0x6522('0x3'));var rp=require(_0x6522('0x4'));var moment=require('moment');var BPromise=require(_0x6522('0x5'));var Mustache=require(_0x6522('0x6'));var util=require(_0x6522('0x7'));var path=require('path');var sox=require(_0x6522('0x8'));var csv=require('to-csv');var ejs=require(_0x6522('0x9'));var fs=require('fs');var fs_extra=require(_0x6522('0xa'));var _=require(_0x6522('0xb'));var squel=require(_0x6522('0xc'));var crypto=require(_0x6522('0xd'));var jsforce=require(_0x6522('0xe'));var deskjs=require(_0x6522('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6522('0x10'));var Redis=require(_0x6522('0x11'));var authService=require(_0x6522('0x12'));var qs=require(_0x6522('0x13'));var as=require(_0x6522('0x14'));var hardwareService=require(_0x6522('0x15'));var logger=require(_0x6522('0x16'))(_0x6522('0x17'));var utils=require(_0x6522('0x18'));var config=require(_0x6522('0x19'));var licenseUtil=require(_0x6522('0x1a'));var db=require(_0x6522('0x1b'))['db'];config[_0x6522('0x1c')]=_['defaults'](config[_0x6522('0x1c')],{'host':_0x6522('0x1d'),'port':0x18eb});var socket=require(_0x6522('0x1e'))(new Redis(config[_0x6522('0x1c')]));require(_0x6522('0x1f'))['register'](socket);function respondWithStatusCode(_0x3c855a,_0x2ab9a0){_0x2ab9a0=_0x2ab9a0||0xcc;return function(_0x26ed67){if(_0x26ed67){return _0x3c855a[_0x6522('0x20')](_0x2ab9a0);}return _0x3c855a[_0x6522('0x21')](_0x2ab9a0)[_0x6522('0x22')]();};}function respondWithResult(_0x31ddff,_0x1e12b7){_0x1e12b7=_0x1e12b7||0xc8;return function(_0x36a557){if(_0x36a557){return _0x31ddff[_0x6522('0x21')](_0x1e12b7)[_0x6522('0x23')](_0x36a557);}};}function respondWithFilteredResult(_0x434a84,_0x51a8e0){return function(_0x6f0909){if(_0x6f0909){var _0x1edcb6=typeof _0x51a8e0[_0x6522('0x24')]===_0x6522('0x25')&&typeof _0x51a8e0['limit']===_0x6522('0x25');var _0x9a5622=_0x6f0909['count'];var _0x38aae6=_0x1edcb6?0x0:_0x51a8e0['offset'];var _0x1bb7df=_0x1edcb6?_0x6f0909[_0x6522('0x26')]:_0x51a8e0[_0x6522('0x24')]+_0x51a8e0[_0x6522('0x27')];var _0x44bd23;if(_0x1bb7df>=_0x9a5622){_0x1bb7df=_0x9a5622;_0x44bd23=0xc8;}else{_0x44bd23=0xce;}_0x434a84[_0x6522('0x21')](_0x44bd23);return _0x434a84['set'](_0x6522('0x28'),_0x38aae6+'-'+_0x1bb7df+'/'+_0x9a5622)[_0x6522('0x23')](_0x6f0909);}return null;};}function patchUpdates(_0x13ec44){return function(_0x14ba8f){try{jsonpatch[_0x6522('0x29')](_0x14ba8f,_0x13ec44,!![]);}catch(_0x16c3cf){return BPromise['reject'](_0x16c3cf);}return _0x14ba8f[_0x6522('0x2a')]();};}function saveUpdates(_0x415f16,_0xcb377c){return function(_0x2c3269){if(_0x2c3269){return _0x2c3269['update'](_0x415f16)['then'](function(_0x263d7d){return _0x263d7d;});}return null;};}function removeEntity(_0x38045b,_0x2c20dc){return function(_0x29b7f4){if(_0x29b7f4){return _0x29b7f4['destroy']()[_0x6522('0x2b')](function(){_0x38045b[_0x6522('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375555,_0x2f6e86){return function(_0x23dc77){if(!_0x23dc77){_0x375555[_0x6522('0x20')](0x194);}return _0x23dc77;};}function handleError(_0x5db9bb,_0x204305){_0x204305=_0x204305||0x1f4;return function(_0x27bbc0){logger[_0x6522('0x2c')](_0x27bbc0[_0x6522('0x2d')]);if(_0x27bbc0[_0x6522('0x2e')]){delete _0x27bbc0[_0x6522('0x2e')];}_0x5db9bb[_0x6522('0x21')](_0x204305)[_0x6522('0x2f')](_0x27bbc0);};}exports[_0x6522('0x30')]=function(_0x2c57f7,_0x9e6606){var _0x2c2e97={'raw':![],'where':{'id':_0x2c57f7[_0x6522('0x31')]['id']}},_0x4c4d29={};_0x4c4d29[_0x6522('0x32')]=_[_0x6522('0x33')](db[_0x6522('0x34')][_0x6522('0x35')]);_0x4c4d29[_0x6522('0x36')]=_['keys'](_0x2c57f7[_0x6522('0x36')]);_0x4c4d29[_0x6522('0x37')]=_[_0x6522('0x38')](_0x4c4d29[_0x6522('0x32')],_0x4c4d29[_0x6522('0x36')]);_0x2c2e97[_0x6522('0x39')]=_[_0x6522('0x38')](_0x4c4d29[_0x6522('0x32')],qs[_0x6522('0x3a')](_0x2c57f7[_0x6522('0x36')][_0x6522('0x3a')]));_0x2c2e97[_0x6522('0x39')]=_0x2c2e97[_0x6522('0x39')]['length']?_0x2c2e97['attributes']:_0x4c4d29['model'];if(_0x2c57f7[_0x6522('0x36')][_0x6522('0x3b')]){_0x2c2e97[_0x6522('0x3c')]=[{'all':!![]}];}_0x2c2e97=_[_0x6522('0x3d')]({},_0x2c2e97,_0x2c57f7[_0x6522('0x3e')]);return db[_0x6522('0x34')]['find'](_0x2c2e97)[_0x6522('0x2b')](handleEntityNotFound(_0x9e6606,null))[_0x6522('0x2b')](respondWithResult(_0x9e6606,null))[_0x6522('0x3f')](handleError(_0x9e6606,null));};exports[_0x6522('0x40')]=function(_0x15d709,_0x4ec7ab){return db['DashboardItem']['find']({'where':{'id':_0x15d709[_0x6522('0x31')]['id']}})[_0x6522('0x2b')](handleEntityNotFound(_0x4ec7ab,null))['then'](removeEntity(_0x4ec7ab,null))['catch'](handleError(_0x4ec7ab,null));};function widgetAttributes(_0xed4641){try{switch(_0xed4641['type']){case'iframe':return[{'name':_0x6522('0x41'),'value':_0xed4641[_0x6522('0x41')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0]['value']:undefined)||_0x6522('0x43')}];case _0x6522('0x44'):return[{'name':_0x6522('0x45'),'value':_0xed4641[_0x6522('0x45')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0xed4641[_0x6522('0x47')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x6522('0x48'),'value':_0xed4641[_0x6522('0x48')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||'0.00'},{'name':_0x6522('0x49'),'value':_0xed4641['attrFontSize']||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||0xc}];case _0x6522('0x4a'):return[{'name':'attrMetric','value':_0xed4641[_0x6522('0x4b')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641['attrs'][0x0][_0x6522('0x46')]:undefined)||'total'},{'name':_0x6522('0x4c'),'value':_0xed4641[_0x6522('0x4c')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||[]},{'name':_0x6522('0x49'),'value':_0xed4641[_0x6522('0x49')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||0x14},{'name':_0x6522('0x4d'),'value':_0xed4641[_0x6522('0x4d')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x3]?_0xed4641[_0x6522('0x42')][0x3][_0x6522('0x46')]:undefined)||_0x6522('0x4e')},{'name':_0x6522('0x4f'),'value':_0xed4641[_0x6522('0x4f')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x4]?_0xed4641[_0x6522('0x42')][0x4][_0x6522('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xed4641['attrFaxAccounts']||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x5]?_0xed4641['attrs'][0x5][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x50'),'value':_0xed4641['attrSmsAccounts']||(_0xed4641['attrs']&&_0xed4641['attrs'][0x6]?_0xed4641['attrs'][0x6][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x51'),'value':_0xed4641[_0x6522('0x51')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x7]?_0xed4641[_0x6522('0x42')][0x7]['value']:undefined)||''},{'name':_0x6522('0x52'),'value':_0xed4641[_0x6522('0x52')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x8]?_0xed4641[_0x6522('0x42')][0x8][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x53'),'value':_0xed4641[_0x6522('0x53')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x9]?_0xed4641[_0x6522('0x42')][0x9][_0x6522('0x46')]:undefined)||''}];case'multibar-chart':case _0x6522('0x54'):return[{'name':_0x6522('0x55'),'value':_0xed4641[_0x6522('0x55')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0]['value']:undefined)||_0x6522('0x56')},{'name':'attrSerie2','value':_0xed4641['attrSerie2']||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641['attrs'][0x1]['value']:undefined)||null},{'name':_0x6522('0x57'),'value':_0xed4641['attrSerie3']||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||null},{'name':_0x6522('0x4c'),'value':_0xed4641[_0x6522('0x4c')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x3]?_0xed4641['attrs'][0x3][_0x6522('0x46')]:undefined)||[]},{'name':_0x6522('0x4d'),'value':_0xed4641[_0x6522('0x4d')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x4]?_0xed4641['attrs'][0x4][_0x6522('0x46')]:undefined)||_0x6522('0x4e')},{'name':_0x6522('0x4f'),'value':_0xed4641[_0x6522('0x4f')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x5]?_0xed4641[_0x6522('0x42')][0x5][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x58'),'value':_0xed4641[_0x6522('0x58')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x6]?_0xed4641[_0x6522('0x42')][0x6][_0x6522('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xed4641[_0x6522('0x50')]||(_0xed4641['attrs']&&_0xed4641['attrs'][0x7]?_0xed4641[_0x6522('0x42')][0x7][_0x6522('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xed4641[_0x6522('0x51')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x8]?_0xed4641[_0x6522('0x42')][0x8][_0x6522('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xed4641[_0x6522('0x52')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x9]?_0xed4641[_0x6522('0x42')][0x9][_0x6522('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0xed4641[_0x6522('0x53')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0xa]?_0xed4641['attrs'][0xa][_0x6522('0x46')]:undefined)||''}];case _0x6522('0x59'):return[{'name':_0x6522('0x5a'),'type':_0xed4641[_0x6522('0x5b')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x5c')]:undefined)||null,'value':_0xed4641[_0x6522('0x5a')]||(_0xed4641['attrs']&&_0xed4641['attrs'][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||null},{'name':_0x6522('0x5d'),'value':_0xed4641[_0x6522('0x5d')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x3e4686){logger[_0x6522('0x2c')](_0x6522('0x5e'),JSON[_0x6522('0x5f')](_0x3e4686));return[];}}exports['create']=function(_0x1cac9e,_0x24c8f8){if(_0x1cac9e[_0x6522('0x60')]){_0x1cac9e[_0x6522('0x60')]['attrs']=widgetAttributes(_0x1cac9e[_0x6522('0x60')]);}return db[_0x6522('0x34')]['create'](_0x1cac9e[_0x6522('0x60')],{})[_0x6522('0x2b')](respondWithResult(_0x24c8f8,0xc9))[_0x6522('0x3f')](handleError(_0x24c8f8,null));};exports[_0x6522('0x61')]=function(_0x1c0ede,_0x11f1e1){if(_0x1c0ede[_0x6522('0x60')]['id']){delete _0x1c0ede[_0x6522('0x60')]['id'];}_0x1c0ede[_0x6522('0x60')][_0x6522('0x42')]=widgetAttributes(_0x1c0ede[_0x6522('0x60')]);return db[_0x6522('0x34')][_0x6522('0x62')]({'where':{'id':_0x1c0ede['params']['id']}})['then'](handleEntityNotFound(_0x11f1e1,null))[_0x6522('0x2b')](saveUpdates(_0x1c0ede['body'],null))[_0x6522('0x2b')](respondWithResult(_0x11f1e1,null))['catch'](handleError(_0x11f1e1,null));}; \ No newline at end of file +var _0xd1f9=['DashboardItem','catch','type','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options'];(function(_0x2e8a3b,_0x2c02a9){var _0x5236c0=function(_0x214332){while(--_0x214332){_0x2e8a3b['push'](_0x2e8a3b['shift']());}};_0x5236c0(++_0x2c02a9);}(_0xd1f9,0x88));var _0x9d1f=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0xd1f9[_0x28407a];return _0x8bd6ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d1f('0x0'));var jsonpatch=require(_0x9d1f('0x1'));var rp=require(_0x9d1f('0x2'));var moment=require(_0x9d1f('0x3'));var BPromise=require(_0x9d1f('0x4'));var Mustache=require(_0x9d1f('0x5'));var util=require(_0x9d1f('0x6'));var path=require(_0x9d1f('0x7'));var sox=require(_0x9d1f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1f('0xa'));var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x10'));var querystring=require(_0x9d1f('0x11'));var Papa=require(_0x9d1f('0x12'));var Redis=require(_0x9d1f('0x13'));var authService=require(_0x9d1f('0x14'));var qs=require(_0x9d1f('0x15'));var as=require(_0x9d1f('0x16'));var hardwareService=require(_0x9d1f('0x17'));var logger=require(_0x9d1f('0x18'))(_0x9d1f('0x19'));var utils=require(_0x9d1f('0x1a'));var config=require(_0x9d1f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1c'))['db'];config[_0x9d1f('0x1d')]=_[_0x9d1f('0x1e')](config['redis'],{'host':_0x9d1f('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9d1f('0x20'))[_0x9d1f('0x21')](socket);function respondWithStatusCode(_0x25c0b0,_0x1d6f6e){_0x1d6f6e=_0x1d6f6e||0xcc;return function(_0x1fea4f){if(_0x1fea4f){return _0x25c0b0[_0x9d1f('0x22')](_0x1d6f6e);}return _0x25c0b0[_0x9d1f('0x23')](_0x1d6f6e)[_0x9d1f('0x24')]();};}function respondWithResult(_0x24cd8a,_0x45a870){_0x45a870=_0x45a870||0xc8;return function(_0x1f9338){if(_0x1f9338){return _0x24cd8a[_0x9d1f('0x23')](_0x45a870)[_0x9d1f('0x25')](_0x1f9338);}};}function respondWithFilteredResult(_0x57ba11,_0x47832c){return function(_0x42a2b4){if(_0x42a2b4){var _0x4e5328=typeof _0x47832c[_0x9d1f('0x26')]==='undefined'&&typeof _0x47832c['limit']==='undefined';var _0x2d39f3=_0x42a2b4[_0x9d1f('0x27')];var _0x380a14=_0x4e5328?0x0:_0x47832c['offset'];var _0x3671f7=_0x4e5328?_0x42a2b4['count']:_0x47832c[_0x9d1f('0x26')]+_0x47832c['limit'];var _0x552a84;if(_0x3671f7>=_0x2d39f3){_0x3671f7=_0x2d39f3;_0x552a84=0xc8;}else{_0x552a84=0xce;}_0x57ba11[_0x9d1f('0x23')](_0x552a84);return _0x57ba11[_0x9d1f('0x28')](_0x9d1f('0x29'),_0x380a14+'-'+_0x3671f7+'/'+_0x2d39f3)[_0x9d1f('0x25')](_0x42a2b4);}return null;};}function patchUpdates(_0x44ef15){return function(_0x41e88f){try{jsonpatch[_0x9d1f('0x2a')](_0x41e88f,_0x44ef15,!![]);}catch(_0x3b10f7){return BPromise[_0x9d1f('0x2b')](_0x3b10f7);}return _0x41e88f[_0x9d1f('0x2c')]();};}function saveUpdates(_0x1ab0f4,_0x426c31){return function(_0x1b0ba7){if(_0x1b0ba7){return _0x1b0ba7[_0x9d1f('0x2d')](_0x1ab0f4)['then'](function(_0x2b234d){return _0x2b234d;});}return null;};}function removeEntity(_0xa2392f,_0x48245c){return function(_0x5c9fe7){if(_0x5c9fe7){return _0x5c9fe7[_0x9d1f('0x2e')]()[_0x9d1f('0x2f')](function(){_0xa2392f[_0x9d1f('0x23')](0xcc)[_0x9d1f('0x24')]();});}};}function handleEntityNotFound(_0x1aeaf3,_0x55f7de){return function(_0x47fc5e){if(!_0x47fc5e){_0x1aeaf3[_0x9d1f('0x22')](0x194);}return _0x47fc5e;};}function handleError(_0x12385d,_0x21ba80){_0x21ba80=_0x21ba80||0x1f4;return function(_0x44515d){logger[_0x9d1f('0x30')](_0x44515d[_0x9d1f('0x31')]);if(_0x44515d['name']){delete _0x44515d[_0x9d1f('0x32')];}_0x12385d['status'](_0x21ba80)[_0x9d1f('0x33')](_0x44515d);};}exports[_0x9d1f('0x34')]=function(_0x18a937,_0x579c46){var _0x1bb45e={'raw':![],'where':{'id':_0x18a937[_0x9d1f('0x35')]['id']}},_0x57f521={};_0x57f521[_0x9d1f('0x36')]=_[_0x9d1f('0x37')](db['DashboardItem']['rawAttributes']);_0x57f521[_0x9d1f('0x38')]=_[_0x9d1f('0x37')](_0x18a937['query']);_0x57f521[_0x9d1f('0x39')]=_[_0x9d1f('0x3a')](_0x57f521[_0x9d1f('0x36')],_0x57f521[_0x9d1f('0x38')]);_0x1bb45e['attributes']=_[_0x9d1f('0x3a')](_0x57f521[_0x9d1f('0x36')],qs[_0x9d1f('0x3b')](_0x18a937[_0x9d1f('0x38')]['fields']));_0x1bb45e[_0x9d1f('0x3c')]=_0x1bb45e['attributes'][_0x9d1f('0x3d')]?_0x1bb45e[_0x9d1f('0x3c')]:_0x57f521[_0x9d1f('0x36')];if(_0x18a937['query'][_0x9d1f('0x3e')]){_0x1bb45e[_0x9d1f('0x3f')]=[{'all':!![]}];}_0x1bb45e=_[_0x9d1f('0x40')]({},_0x1bb45e,_0x18a937[_0x9d1f('0x41')]);return db[_0x9d1f('0x42')]['find'](_0x1bb45e)[_0x9d1f('0x2f')](handleEntityNotFound(_0x579c46,null))[_0x9d1f('0x2f')](respondWithResult(_0x579c46,null))[_0x9d1f('0x43')](handleError(_0x579c46,null));};exports[_0x9d1f('0x2e')]=function(_0x245675,_0x381654){return db[_0x9d1f('0x42')]['find']({'where':{'id':_0x245675[_0x9d1f('0x35')]['id']}})[_0x9d1f('0x2f')](handleEntityNotFound(_0x381654,null))[_0x9d1f('0x2f')](removeEntity(_0x381654,null))[_0x9d1f('0x43')](handleError(_0x381654,null));};function widgetAttributes(_0x529dca){try{switch(_0x529dca[_0x9d1f('0x44')]){case'iframe':return[{'name':'attrUrl','value':_0x529dca['attrUrl']||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x0]?_0x529dca['attrs'][0x0][_0x9d1f('0x46')]:undefined)||_0x9d1f('0x47')}];case _0x9d1f('0x48'):return[{'name':_0x9d1f('0x49'),'value':_0x529dca[_0x9d1f('0x49')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x0]?_0x529dca['attrs'][0x0][_0x9d1f('0x46')]:undefined)||''}];case'clock':return[{'name':_0x9d1f('0x4a'),'value':_0x529dca[_0x9d1f('0x4a')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x0]?_0x529dca[_0x9d1f('0x45')][0x0][_0x9d1f('0x46')]:undefined)||_0x9d1f('0x4b')},{'name':_0x9d1f('0x4c'),'value':_0x529dca[_0x9d1f('0x4c')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x1]?_0x529dca[_0x9d1f('0x45')][0x1][_0x9d1f('0x46')]:undefined)||'0.00'},{'name':_0x9d1f('0x4d'),'value':_0x529dca['attrFontSize']||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x2]?_0x529dca['attrs'][0x2][_0x9d1f('0x46')]:undefined)||0xc}];case _0x9d1f('0x4e'):return[{'name':_0x9d1f('0x4f'),'value':_0x529dca[_0x9d1f('0x4f')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x0]?_0x529dca[_0x9d1f('0x45')][0x0][_0x9d1f('0x46')]:undefined)||'total'},{'name':_0x9d1f('0x50'),'value':_0x529dca[_0x9d1f('0x50')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x1]?_0x529dca[_0x9d1f('0x45')][0x1][_0x9d1f('0x46')]:undefined)||[]},{'name':_0x9d1f('0x4d'),'value':_0x529dca[_0x9d1f('0x4d')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x2]?_0x529dca[_0x9d1f('0x45')][0x2][_0x9d1f('0x46')]:undefined)||0x14},{'name':_0x9d1f('0x51'),'value':_0x529dca[_0x9d1f('0x51')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x3]?_0x529dca[_0x9d1f('0x45')][0x3][_0x9d1f('0x46')]:undefined)||_0x9d1f('0x52')},{'name':_0x9d1f('0x53'),'value':_0x529dca[_0x9d1f('0x53')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x4]?_0x529dca['attrs'][0x4][_0x9d1f('0x46')]:undefined)||''},{'name':_0x9d1f('0x54'),'value':_0x529dca[_0x9d1f('0x54')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x5]?_0x529dca[_0x9d1f('0x45')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x529dca[_0x9d1f('0x55')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x6]?_0x529dca[_0x9d1f('0x45')][0x6][_0x9d1f('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x529dca[_0x9d1f('0x56')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x7]?_0x529dca[_0x9d1f('0x45')][0x7][_0x9d1f('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x529dca[_0x9d1f('0x57')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x8]?_0x529dca['attrs'][0x8][_0x9d1f('0x46')]:undefined)||''},{'name':_0x9d1f('0x58'),'value':_0x529dca[_0x9d1f('0x58')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x9]?_0x529dca['attrs'][0x9]['value']:undefined)||''}];case _0x9d1f('0x59'):case _0x9d1f('0x5a'):return[{'name':_0x9d1f('0x5b'),'value':_0x529dca[_0x9d1f('0x5b')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x0]?_0x529dca['attrs'][0x0][_0x9d1f('0x46')]:undefined)||_0x9d1f('0x5c')},{'name':_0x9d1f('0x5d'),'value':_0x529dca['attrSerie2']||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x1]?_0x529dca[_0x9d1f('0x45')][0x1][_0x9d1f('0x46')]:undefined)||null},{'name':_0x9d1f('0x5e'),'value':_0x529dca[_0x9d1f('0x5e')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x2]?_0x529dca['attrs'][0x2][_0x9d1f('0x46')]:undefined)||null},{'name':_0x9d1f('0x50'),'value':_0x529dca[_0x9d1f('0x50')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x3]?_0x529dca['attrs'][0x3][_0x9d1f('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x529dca[_0x9d1f('0x51')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x4]?_0x529dca[_0x9d1f('0x45')][0x4][_0x9d1f('0x46')]:undefined)||_0x9d1f('0x52')},{'name':_0x9d1f('0x53'),'value':_0x529dca[_0x9d1f('0x53')]||(_0x529dca['attrs']&&_0x529dca['attrs'][0x5]?_0x529dca[_0x9d1f('0x45')][0x5]['value']:undefined)||''},{'name':_0x9d1f('0x54'),'value':_0x529dca[_0x9d1f('0x54')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x6]?_0x529dca['attrs'][0x6][_0x9d1f('0x46')]:undefined)||''},{'name':_0x9d1f('0x55'),'value':_0x529dca[_0x9d1f('0x55')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x7]?_0x529dca['attrs'][0x7][_0x9d1f('0x46')]:undefined)||''},{'name':_0x9d1f('0x56'),'value':_0x529dca[_0x9d1f('0x56')]||(_0x529dca['attrs']&&_0x529dca[_0x9d1f('0x45')][0x8]?_0x529dca[_0x9d1f('0x45')][0x8][_0x9d1f('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x529dca[_0x9d1f('0x57')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x9]?_0x529dca['attrs'][0x9][_0x9d1f('0x46')]:undefined)||''},{'name':_0x9d1f('0x58'),'value':_0x529dca[_0x9d1f('0x58')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0xa]?_0x529dca['attrs'][0xa][_0x9d1f('0x46')]:undefined)||''}];case'web-report':return[{'name':_0x9d1f('0x5f'),'type':_0x529dca['reportType']||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca['attrs'][0x0]?_0x529dca[_0x9d1f('0x45')][0x0][_0x9d1f('0x44')]:undefined)||null,'value':_0x529dca[_0x9d1f('0x5f')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x0]?_0x529dca['attrs'][0x0]['value']:undefined)||null},{'name':_0x9d1f('0x60'),'value':_0x529dca[_0x9d1f('0x60')]||(_0x529dca[_0x9d1f('0x45')]&&_0x529dca[_0x9d1f('0x45')][0x1]?_0x529dca[_0x9d1f('0x45')][0x1][_0x9d1f('0x46')]:undefined)||0x0}];default:return[];}}catch(_0xa5a47e){logger[_0x9d1f('0x30')]('widgetAttributes:\x20%s',JSON[_0x9d1f('0x61')](_0xa5a47e));return[];}}exports[_0x9d1f('0x62')]=function(_0x32cb18,_0x45bde8){if(_0x32cb18[_0x9d1f('0x63')]){_0x32cb18[_0x9d1f('0x63')][_0x9d1f('0x45')]=widgetAttributes(_0x32cb18[_0x9d1f('0x63')]);}return db[_0x9d1f('0x42')][_0x9d1f('0x62')](_0x32cb18[_0x9d1f('0x63')],{})[_0x9d1f('0x2f')](respondWithResult(_0x45bde8,0xc9))[_0x9d1f('0x43')](handleError(_0x45bde8,null));};exports[_0x9d1f('0x2d')]=function(_0x686aaa,_0x4e4741){if(_0x686aaa[_0x9d1f('0x63')]['id']){delete _0x686aaa[_0x9d1f('0x63')]['id'];}_0x686aaa['body'][_0x9d1f('0x45')]=widgetAttributes(_0x686aaa[_0x9d1f('0x63')]);return db[_0x9d1f('0x42')][_0x9d1f('0x64')]({'where':{'id':_0x686aaa[_0x9d1f('0x35')]['id']}})[_0x9d1f('0x2f')](handleEntityNotFound(_0x4e4741,null))[_0x9d1f('0x2f')](saveUpdates(_0x686aaa[_0x9d1f('0x63')],null))['then'](respondWithResult(_0x4e4741,null))['catch'](handleError(_0x4e4741,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3c62e08..2c8a18f 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 _0x9185=['exports','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x9185,0x1de));var _0x5918=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0x9185[_0x27b423];return _0x5c11b8;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5918('0x0'))['db'][_0x5918('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5918('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5918('0x3'),'afterDestroy':_0x5918('0x4')};function emitEvent(_0x30e872){return function(_0x24f47f,_0x227391,_0x4e5053){DashboardItemEvents['emit'](_0x30e872+':'+_0x24f47f['id'],_0x24f47f);DashboardItemEvents[_0x5918('0x5')](_0x30e872,_0x24f47f);_0x4e5053(null);};}for(var e in events){if(events[_0x5918('0x6')](e)){var event=events[e];DashboardItem[_0x5918('0x7')](e,emitEvent(event));}}module[_0x5918('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x007d=['hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit'];(function(_0x36896c,_0x46f3b6){var _0x4baf6e=function(_0x54847d){while(--_0x54847d){_0x36896c['push'](_0x36896c['shift']());}};_0x4baf6e(++_0x46f3b6);}(_0x007d,0xff));var _0xd007=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x007d[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd007('0x0'))['db'][_0xd007('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd007('0x2')](0x0);var events={'afterCreate':_0xd007('0x3'),'afterUpdate':'update','afterDestroy':_0xd007('0x4')};function emitEvent(_0x3ca797){return function(_0xd29a1,_0x3cb5e8,_0x7e6b8d){DashboardItemEvents[_0xd007('0x5')](_0x3ca797+':'+_0xd29a1['id'],_0xd29a1);DashboardItemEvents[_0xd007('0x5')](_0x3ca797,_0xd29a1);_0x7e6b8d(null);};}for(var e in events){if(events[_0xd007('0x6')](e)){var event=events[e];DashboardItem[_0xd007('0x7')](e,emitEvent(event));}}module[_0xd007('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 99bff52..61a487e 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 _0x3351=['exports','define','DashboardItem','dashboard_items','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30f395,_0x3629b5){var _0x2ea0ee=function(_0x35a9af){while(--_0x35a9af){_0x30f395['push'](_0x30f395['shift']());}};_0x2ea0ee(++_0x3629b5);}(_0x3351,0x1b4));var _0x1335=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x3351[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x1335('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1335('0x1'));var moment=require(_0x1335('0x2'));var BPromise=require(_0x1335('0x3'));var rp=require(_0x1335('0x4'));var fs=require('fs');var path=require(_0x1335('0x5'));var rimraf=require(_0x1335('0x6'));var config=require(_0x1335('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x1335('0x8')]=function(_0x1b951c,_0x2ee73b){return _0x1b951c[_0x1335('0x9')](_0x1335('0xa'),attributes,{'tableName':_0x1335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d28=['util','../../config/logger','api','moment','bluebird','path','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash'];(function(_0x457766,_0x39f036){var _0x2ad888=function(_0x335c30){while(--_0x335c30){_0x457766['push'](_0x457766['shift']());}};_0x2ad888(++_0x39f036);}(_0x7d28,0x112));var _0x87d2=function(_0x52ed6e,_0x10a030){_0x52ed6e=_0x52ed6e-0x0;var _0x582f08=_0x7d28[_0x52ed6e];return _0x582f08;};'use strict';var _=require(_0x87d2('0x0'));var util=require(_0x87d2('0x1'));var logger=require(_0x87d2('0x2'))(_0x87d2('0x3'));var moment=require(_0x87d2('0x4'));var BPromise=require(_0x87d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87d2('0x7'));module['exports']=function(_0x15bfa4,_0x16bb80){return _0x15bfa4[_0x87d2('0x8')](_0x87d2('0x9'),attributes,{'tableName':_0x87d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4a08d46..4c11c19 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 _0x299d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','./dashboardItem.socket','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result'];(function(_0x284bfb,_0xc7941f){var _0x3c078d=function(_0x8d97a0){while(--_0x8d97a0){_0x284bfb['push'](_0x284bfb['shift']());}};_0x3c078d(++_0xc7941f);}(_0x299d,0x109));var _0xd299=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x299d[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0xd299('0x0'));var moment=require(_0xd299('0x1'));var BPromise=require(_0xd299('0x2'));var rs=require(_0xd299('0x3'));var fs=require('fs');var Redis=require(_0xd299('0x4'));var db=require(_0xd299('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd299('0x6'))(_0xd299('0x7'));var config=require(_0xd299('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd299('0x9')]({'port':0x232a});config[_0xd299('0xa')]=_['defaults'](config[_0xd299('0xa')],{'host':_0xd299('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd299('0xa')]));require(_0xd299('0xc'))['register'](socket);function respondWithRpcPromise(_0x944382,_0x2c429a,_0x1121de){return new BPromise(function(_0x129bdf,_0x5b1998){return client['request'](_0x944382,_0x1121de)[_0xd299('0xd')](function(_0x4a4155){logger[_0xd299('0xe')]('DashboardItem,\x20%s,\x20%s',_0x2c429a,_0xd299('0xf'));logger['debug'](_0xd299('0x10'),_0x2c429a,'request\x20sent',JSON[_0xd299('0x11')](_0x4a4155));if(_0x4a4155[_0xd299('0x12')]){if(_0x4a4155[_0xd299('0x12')][_0xd299('0x13')]===0x1f4){logger[_0xd299('0x12')](_0xd299('0x14'),_0x2c429a,_0x4a4155[_0xd299('0x12')][_0xd299('0x15')]);return _0x5b1998(_0x4a4155[_0xd299('0x12')][_0xd299('0x15')]);}logger[_0xd299('0x12')](_0xd299('0x14'),_0x2c429a,_0x4a4155[_0xd299('0x12')][_0xd299('0x15')]);return _0x129bdf(_0x4a4155[_0xd299('0x12')][_0xd299('0x15')]);}else{logger[_0xd299('0xe')](_0xd299('0x14'),_0x2c429a,_0xd299('0xf'));_0x129bdf(_0x4a4155[_0xd299('0x16')][_0xd299('0x15')]);}})[_0xd299('0x17')](function(_0x3835e7){logger[_0xd299('0x12')]('DashboardItem,\x20%s,\x20%s',_0x2c429a,_0x3835e7);_0x5b1998(_0x3835e7);});});} \ No newline at end of file +var _0xbbb3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','redis','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x596363,_0x951078){var _0x4f514a=function(_0x3719a7){while(--_0x3719a7){_0x596363['push'](_0x596363['shift']());}};_0x4f514a(++_0x951078);}(_0xbbb3,0x19b));var _0x3bbb=function(_0x11220a,_0x250683){_0x11220a=_0x11220a-0x0;var _0xee0a0=_0xbbb3[_0x11220a];return _0xee0a0;};'use strict';var _=require('lodash');var util=require(_0x3bbb('0x0'));var moment=require('moment');var BPromise=require(_0x3bbb('0x1'));var rs=require(_0x3bbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bbb('0x3'))['db'];var utils=require(_0x3bbb('0x4'));var logger=require(_0x3bbb('0x5'))('rpc');var config=require(_0x3bbb('0x6'));var jayson=require(_0x3bbb('0x7'));var client=jayson[_0x3bbb('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3bbb('0x9'))(new Redis(config[_0x3bbb('0xa')]));require('./dashboardItem.socket')[_0x3bbb('0xb')](socket);function respondWithRpcPromise(_0x413fda,_0x94ce5e,_0x1d44c2){return new BPromise(function(_0x17ee84,_0x4df585){return client[_0x3bbb('0xc')](_0x413fda,_0x1d44c2)['then'](function(_0x581737){logger[_0x3bbb('0xd')](_0x3bbb('0xe'),_0x94ce5e,_0x3bbb('0xf'));logger[_0x3bbb('0x10')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x94ce5e,'request\x20sent',JSON[_0x3bbb('0x11')](_0x581737));if(_0x581737[_0x3bbb('0x12')]){if(_0x581737[_0x3bbb('0x12')][_0x3bbb('0x13')]===0x1f4){logger[_0x3bbb('0x12')](_0x3bbb('0xe'),_0x94ce5e,_0x581737['error'][_0x3bbb('0x14')]);return _0x4df585(_0x581737[_0x3bbb('0x12')]['message']);}logger['error'](_0x3bbb('0xe'),_0x94ce5e,_0x581737['error'][_0x3bbb('0x14')]);return _0x17ee84(_0x581737['error'][_0x3bbb('0x14')]);}else{logger['info'](_0x3bbb('0xe'),_0x94ce5e,_0x3bbb('0xf'));_0x17ee84(_0x581737[_0x3bbb('0x15')][_0x3bbb('0x14')]);}})[_0x3bbb('0x16')](function(_0x342f35){logger[_0x3bbb('0x12')](_0x3bbb('0xe'),_0x94ce5e,_0x342f35);_0x4df585(_0x342f35);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6eb922e..5b08fd7 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 _0xcdba=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x3c9b33,_0x3eee6f){var _0x587a7f=function(_0x5a11af){while(--_0x5a11af){_0x3c9b33['push'](_0x3c9b33['shift']());}};_0x587a7f(++_0x3eee6f);}(_0xcdba,0xc6));var _0xacdb=function(_0x15f648,_0x179f7e){_0x15f648=_0x15f648-0x0;var _0x401602=_0xcdba[_0x15f648];return _0x401602;};'use strict';var DashboardItemEvents=require(_0xacdb('0x0'));var events=[_0xacdb('0x1'),'remove',_0xacdb('0x2')];function createListener(_0x586edf,_0x1cb00c){return function(_0x44d5d3){_0x1cb00c[_0xacdb('0x3')](_0x586edf,_0x44d5d3);};}function removeListener(_0x560ce8,_0xb3f690){return function(){DashboardItemEvents[_0xacdb('0x4')](_0x560ce8,_0xb3f690);};}exports[_0xacdb('0x5')]=function(_0x3dcb28){for(var _0x2a1d2c=0x0,_0x25c4a1=events[_0xacdb('0x6')];_0x2a1d2c<_0x25c4a1;_0x2a1d2c++){var _0x1ca137=events[_0x2a1d2c];var _0x1d0ef8=createListener(_0xacdb('0x7')+_0x1ca137,_0x3dcb28);DashboardItemEvents['on'](_0x1ca137,_0x1d0ef8);}}; \ No newline at end of file +var _0xb77e=['save','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x281784,_0x171733){var _0x211035=function(_0x17ab0d){while(--_0x17ab0d){_0x281784['push'](_0x281784['shift']());}};_0x211035(++_0x171733);}(_0xb77e,0xb8));var _0xeb77=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb77e[_0x501510];return _0x1e6ee5;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xeb77('0x0'),_0xeb77('0x1'),_0xeb77('0x2')];function createListener(_0x5aae3b,_0x432f08){return function(_0x101ca8){_0x432f08[_0xeb77('0x3')](_0x5aae3b,_0x101ca8);};}function removeListener(_0x574d3e,_0x169f15){return function(){DashboardItemEvents[_0xeb77('0x4')](_0x574d3e,_0x169f15);};}exports[_0xeb77('0x5')]=function(_0x9ae693){for(var _0x3e5f66=0x0,_0xc185fb=events[_0xeb77('0x6')];_0x3e5f66<_0xc185fb;_0x3e5f66++){var _0x37281d=events[_0x3e5f66];var _0x1f970e=createListener(_0xeb77('0x7')+_0x37281d,_0x9ae693);DashboardItemEvents['on'](_0x37281d,_0x1f970e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 15c5740..886a198 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 _0x9c51=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x20105a,_0x3a6271){var _0x3f783a=function(_0x34e22b){while(--_0x34e22b){_0x20105a['push'](_0x20105a['shift']());}};_0x3f783a(++_0x3a6271);}(_0x9c51,0x19b));var _0x19c5=function(_0x41adba,_0xafe971){_0x41adba=_0x41adba-0x0;var _0x2d2f3e=_0x9c51[_0x41adba];return _0x2d2f3e;};'use strict';var multer=require(_0x19c5('0x0'));var util=require(_0x19c5('0x1'));var path=require(_0x19c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x19c5('0x3'));var router=express[_0x19c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x19c5('0x5'));var interaction=require(_0x19c5('0x6'));var config=require(_0x19c5('0x7'));var controller=require(_0x19c5('0x8'));router['get'](_0x19c5('0x9'),auth[_0x19c5('0xa')](),controller['show']);router[_0x19c5('0xb')]('/',auth[_0x19c5('0xa')](),controller[_0x19c5('0xc')]);router[_0x19c5('0xd')]('/:id',auth[_0x19c5('0xa')](),controller[_0x19c5('0xe')]);router[_0x19c5('0xf')](_0x19c5('0x9'),auth[_0x19c5('0xa')](),controller[_0x19c5('0x10')]);module[_0x19c5('0x11')]=router; \ No newline at end of file +var _0x75f7=['destroy','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','update','delete'];(function(_0x3cb2e7,_0x54db4c){var _0x39308c=function(_0x1e8381){while(--_0x1e8381){_0x3cb2e7['push'](_0x3cb2e7['shift']());}};_0x39308c(++_0x54db4c);}(_0x75f7,0x7f));var _0x775f=function(_0x40025c,_0x4115f1){_0x40025c=_0x40025c-0x0;var _0x57bb0c=_0x75f7[_0x40025c];return _0x57bb0c;};'use strict';var multer=require('multer');var util=require(_0x775f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x775f('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x775f('0x2'));var interaction=require(_0x775f('0x3'));var config=require(_0x775f('0x4'));var controller=require(_0x775f('0x5'));router[_0x775f('0x6')](_0x775f('0x7'),auth[_0x775f('0x8')](),controller[_0x775f('0x9')]);router['post']('/',auth[_0x775f('0x8')](),controller[_0x775f('0xa')]);router['put']('/:id',auth[_0x775f('0x8')](),controller[_0x775f('0xb')]);router[_0x775f('0xc')](_0x775f('0x7'),auth[_0x775f('0x8')](),controller[_0x775f('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 03e95fe..62b38e0 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 _0xfb0b=['STRING','ENUM','first','third','exports'];(function(_0x5f4864,_0x48dd66){var _0xa73468=function(_0xcde800){while(--_0xcde800){_0x5f4864['push'](_0x5f4864['shift']());}};_0xa73468(++_0x48dd66);}(_0xfb0b,0xf4));var _0xbfb0=function(_0x2f53eb,_0x21b3a2){_0x2f53eb=_0x2f53eb-0x0;var _0xf5205b=_0xfb0b[_0x2f53eb];return _0xf5205b;};'use strict';var Sequelize=require('sequelize');module[_0xbfb0('0x0')]={'name':{'type':Sequelize[_0xbfb0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xbfb0('0x2')](_0xbfb0('0x3'),'second',_0xbfb0('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xbfb0('0x1')]}}; \ No newline at end of file +var _0xea97=['first','sequelize','exports','STRING','ENUM','second'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xea97,0x151));var _0x7ea9=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xea97[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x7ea9('0x0'));module[_0x7ea9('0x1')]={'name':{'type':Sequelize[_0x7ea9('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7ea9('0x3')]('first',_0x7ea9('0x4'),'third'),'allowNull':![],'defaultValue':_0x7ea9('0x5')},'description':{'type':Sequelize[_0x7ea9('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d2a5d10..d92d0da 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 _0x2c6f=['sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','show','params','rawAttributes','intersection','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x56d369,_0x435f7a){var _0x8379f5=function(_0x43e1f9){while(--_0x43e1f9){_0x56d369['push'](_0x56d369['shift']());}};_0x8379f5(++_0x435f7a);}(_0x2c6f,0x138));var _0xf2c6=function(_0x38d3f6,_0x711933){_0x38d3f6=_0x38d3f6-0x0;var _0x234a32=_0x2c6f[_0x38d3f6];return _0x234a32;};'use strict';var emlformat=require(_0xf2c6('0x0'));var rimraf=require(_0xf2c6('0x1'));var zipdir=require(_0xf2c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2c6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf2c6('0x4'));var path=require(_0xf2c6('0x5'));var sox=require(_0xf2c6('0x6'));var csv=require('to-csv');var ejs=require(_0xf2c6('0x7'));var fs=require('fs');var fs_extra=require(_0xf2c6('0x8'));var _=require(_0xf2c6('0x9'));var squel=require(_0xf2c6('0xa'));var crypto=require('crypto');var jsforce=require(_0xf2c6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf2c6('0xc'));var querystring=require(_0xf2c6('0xd'));var Papa=require(_0xf2c6('0xe'));var Redis=require('ioredis');var authService=require(_0xf2c6('0xf'));var qs=require(_0xf2c6('0x10'));var as=require(_0xf2c6('0x11'));var hardwareService=require(_0xf2c6('0x12'));var logger=require(_0xf2c6('0x13'))('api');var utils=require(_0xf2c6('0x14'));var config=require(_0xf2c6('0x15'));var licenseUtil=require(_0xf2c6('0x16'));var db=require(_0xf2c6('0x17'))['db'];function respondWithStatusCode(_0x2b5236,_0x3dff21){_0x3dff21=_0x3dff21||0xcc;return function(_0x2aee72){if(_0x2aee72){return _0x2b5236[_0xf2c6('0x18')](_0x3dff21);}return _0x2b5236['status'](_0x3dff21)[_0xf2c6('0x19')]();};}function respondWithResult(_0x292898,_0x3c0b64){_0x3c0b64=_0x3c0b64||0xc8;return function(_0xc37d2){if(_0xc37d2){return _0x292898[_0xf2c6('0x1a')](_0x3c0b64)[_0xf2c6('0x1b')](_0xc37d2);}};}function respondWithFilteredResult(_0x187725,_0x237b69){return function(_0x36b958){if(_0x36b958){var _0x16cb6c=typeof _0x237b69['offset']===_0xf2c6('0x1c')&&typeof _0x237b69[_0xf2c6('0x1d')]===_0xf2c6('0x1c');var _0x567e87=_0x36b958[_0xf2c6('0x1e')];var _0x27253c=_0x16cb6c?0x0:_0x237b69['offset'];var _0x128387=_0x16cb6c?_0x36b958[_0xf2c6('0x1e')]:_0x237b69[_0xf2c6('0x1f')]+_0x237b69['limit'];var _0x30d88b;if(_0x128387>=_0x567e87){_0x128387=_0x567e87;_0x30d88b=0xc8;}else{_0x30d88b=0xce;}_0x187725[_0xf2c6('0x1a')](_0x30d88b);return _0x187725[_0xf2c6('0x20')](_0xf2c6('0x21'),_0x27253c+'-'+_0x128387+'/'+_0x567e87)[_0xf2c6('0x1b')](_0x36b958);}return null;};}function patchUpdates(_0x350760){return function(_0x664d4){try{jsonpatch['apply'](_0x664d4,_0x350760,!![]);}catch(_0x47482b){return BPromise[_0xf2c6('0x22')](_0x47482b);}return _0x664d4['save']();};}function saveUpdates(_0x54c0eb,_0x4e8693){return function(_0x50bdf4){if(_0x50bdf4){return _0x50bdf4[_0xf2c6('0x23')](_0x54c0eb)[_0xf2c6('0x24')](function(_0x2239db){return _0x2239db;});}return null;};}function removeEntity(_0x55426a,_0x4f3267){return function(_0x271812){if(_0x271812){return _0x271812[_0xf2c6('0x25')]()[_0xf2c6('0x24')](function(){var _0x2ad6c4=_0x271812[_0xf2c6('0x26')]({'plain':!![]});var _0xfe5ea0=_0xf2c6('0x27');return db[_0xf2c6('0x28')][_0xf2c6('0x25')]({'where':{'type':_0xfe5ea0,'resourceId':_0x2ad6c4['id']}})[_0xf2c6('0x24')](function(){return _0x271812;});})[_0xf2c6('0x24')](function(){_0x55426a['status'](0xcc)[_0xf2c6('0x19')]();});}};}function handleEntityNotFound(_0x5382aa,_0x1772e7){return function(_0xef5891){if(!_0xef5891){_0x5382aa[_0xf2c6('0x18')](0x194);}return _0xef5891;};}function handleError(_0x42c7a2,_0x3456f5){_0x3456f5=_0x3456f5||0x1f4;return function(_0x32b030){logger[_0xf2c6('0x29')](_0x32b030[_0xf2c6('0x2a')]);if(_0x32b030[_0xf2c6('0x2b')]){delete _0x32b030[_0xf2c6('0x2b')];}_0x42c7a2[_0xf2c6('0x1a')](_0x3456f5)[_0xf2c6('0x2c')](_0x32b030);};}exports[_0xf2c6('0x2d')]=function(_0x29a032,_0x5c6939){var _0x1b1f6e={},_0x2c241c={},_0x21f5c6={'count':0x0,'rows':[]};var _0x27b1e4=_[_0xf2c6('0x2e')](db['Disposition']['rawAttributes'],function(_0x5d4669){return{'name':_0x5d4669[_0xf2c6('0x2f')],'type':_0x5d4669[_0xf2c6('0x30')][_0xf2c6('0x31')]};});_0x2c241c['model']=_[_0xf2c6('0x2e')](_0x27b1e4,_0xf2c6('0x2b'));_0x2c241c[_0xf2c6('0x32')]=_[_0xf2c6('0x33')](_0x29a032[_0xf2c6('0x32')]);_0x2c241c[_0xf2c6('0x34')]=_['intersection'](_0x2c241c[_0xf2c6('0x35')],_0x2c241c[_0xf2c6('0x32')]);_0x1b1f6e[_0xf2c6('0x36')]=_['intersection'](_0x2c241c[_0xf2c6('0x35')],qs['fields'](_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x37')]));_0x1b1f6e['attributes']=_0x1b1f6e['attributes'][_0xf2c6('0x38')]?_0x1b1f6e[_0xf2c6('0x36')]:_0x2c241c[_0xf2c6('0x35')];if(!_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x39')](_0xf2c6('0x3a'))){_0x1b1f6e['limit']=qs[_0xf2c6('0x1d')](_0x29a032['query'][_0xf2c6('0x1d')]);_0x1b1f6e[_0xf2c6('0x1f')]=qs[_0xf2c6('0x1f')](_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x1f')]);}_0x1b1f6e[_0xf2c6('0x3b')]=qs[_0xf2c6('0x3c')](_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x3c')]);_0x1b1f6e[_0xf2c6('0x3d')]=qs[_0xf2c6('0x34')](_[_0xf2c6('0x3e')](_0x29a032['query'],_0x2c241c['filters']),_0x27b1e4);if(_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x3f')]){_0x1b1f6e[_0xf2c6('0x3d')]=_[_0xf2c6('0x40')](_0x1b1f6e[_0xf2c6('0x3d')],{'$or':_[_0xf2c6('0x2e')](_0x27b1e4,function(_0x423c1e){if(_0x423c1e[_0xf2c6('0x30')]!==_0xf2c6('0x41')){var _0x47fcf7={};_0x47fcf7[_0x423c1e['name']]={'$like':'%'+_0x29a032['query'][_0xf2c6('0x3f')]+'%'};return _0x47fcf7;}})});}_0x1b1f6e=_[_0xf2c6('0x40')]({},_0x1b1f6e,_0x29a032[_0xf2c6('0x42')]);var _0x1ff2f4={'where':_0x1b1f6e['where']};return db[_0xf2c6('0x43')][_0xf2c6('0x1e')](_0x1ff2f4)[_0xf2c6('0x24')](function(_0x3eb720){_0x21f5c6['count']=_0x3eb720;if(_0x29a032[_0xf2c6('0x32')][_0xf2c6('0x44')]){_0x1b1f6e[_0xf2c6('0x45')]=[{'all':!![]}];}return db[_0xf2c6('0x43')][_0xf2c6('0x46')](_0x1b1f6e);})[_0xf2c6('0x24')](function(_0x3ed285){_0x21f5c6['rows']=_0x3ed285;return _0x21f5c6;})[_0xf2c6('0x24')](respondWithFilteredResult(_0x5c6939,_0x1b1f6e))['catch'](handleError(_0x5c6939,null));};exports[_0xf2c6('0x47')]=function(_0xaa89bb,_0x2b7cea){var _0x1feffc={'raw':!![],'where':{'id':_0xaa89bb[_0xf2c6('0x48')]['id']}},_0x246737={};_0x246737[_0xf2c6('0x35')]=_[_0xf2c6('0x33')](db[_0xf2c6('0x43')][_0xf2c6('0x49')]);_0x246737[_0xf2c6('0x32')]=_[_0xf2c6('0x33')](_0xaa89bb['query']);_0x246737[_0xf2c6('0x34')]=_[_0xf2c6('0x4a')](_0x246737[_0xf2c6('0x35')],_0x246737['query']);_0x1feffc[_0xf2c6('0x36')]=_[_0xf2c6('0x4a')](_0x246737[_0xf2c6('0x35')],qs[_0xf2c6('0x37')](_0xaa89bb['query'][_0xf2c6('0x37')]));_0x1feffc['attributes']=_0x1feffc[_0xf2c6('0x36')]['length']?_0x1feffc[_0xf2c6('0x36')]:_0x246737[_0xf2c6('0x35')];if(_0xaa89bb[_0xf2c6('0x32')]['includeAll']){_0x1feffc[_0xf2c6('0x45')]=[{'all':!![]}];}_0x1feffc=_[_0xf2c6('0x40')]({},_0x1feffc,_0xaa89bb[_0xf2c6('0x42')]);return db['Disposition'][_0xf2c6('0x4b')](_0x1feffc)[_0xf2c6('0x24')](handleEntityNotFound(_0x2b7cea,null))['then'](respondWithResult(_0x2b7cea,null))[_0xf2c6('0x4c')](handleError(_0x2b7cea,null));};exports[_0xf2c6('0x4d')]=function(_0x37adc3,_0x372d27){return db[_0xf2c6('0x43')]['create'](_0x37adc3['body'],{})[_0xf2c6('0x24')](function(_0x5d4741){var _0x1beacd=_0x37adc3[_0xf2c6('0x4e')][_0xf2c6('0x26')]({'plain':!![]});if(!_0x1beacd)throw new Error(_0xf2c6('0x4f'));if(_0x1beacd[_0xf2c6('0x50')]===_0xf2c6('0x4e')){var _0x50e8fa=_0x5d4741[_0xf2c6('0x26')]({'plain':!![]});var _0x118a41=_0xf2c6('0x27');return db[_0xf2c6('0x51')][_0xf2c6('0x4b')]({'where':{'name':_0x118a41,'userProfileId':_0x1beacd[_0xf2c6('0x52')]},'raw':!![]})['then'](function(_0x23f7a8){if(_0x23f7a8&&_0x23f7a8['autoAssociation']===0x0){return db[_0xf2c6('0x28')]['create']({'name':_0x50e8fa[_0xf2c6('0x2b')],'resourceId':_0x50e8fa['id'],'type':_0x23f7a8[_0xf2c6('0x2b')],'sectionId':_0x23f7a8['id']},{})[_0xf2c6('0x24')](function(){return _0x5d4741;});}else{return _0x5d4741;}})[_0xf2c6('0x4c')](function(_0x710f8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x710f8c);throw _0x710f8c;});}return _0x5d4741;})[_0xf2c6('0x24')](respondWithResult(_0x372d27,0xc9))[_0xf2c6('0x4c')](handleError(_0x372d27,null));};exports[_0xf2c6('0x23')]=function(_0x21a60f,_0x1608ce){if(_0x21a60f[_0xf2c6('0x53')]['id']){delete _0x21a60f[_0xf2c6('0x53')]['id'];}return db[_0xf2c6('0x43')][_0xf2c6('0x4b')]({'where':{'id':_0x21a60f[_0xf2c6('0x48')]['id']}})[_0xf2c6('0x24')](handleEntityNotFound(_0x1608ce,null))[_0xf2c6('0x24')](saveUpdates(_0x21a60f[_0xf2c6('0x53')],null))[_0xf2c6('0x24')](respondWithResult(_0x1608ce,null))[_0xf2c6('0x4c')](handleError(_0x1608ce,null));};exports['destroy']=function(_0x352c34,_0x1457ef){return db[_0xf2c6('0x43')][_0xf2c6('0x4b')]({'where':{'id':_0x352c34[_0xf2c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1457ef,null))[_0xf2c6('0x24')](removeEntity(_0x1457ef,null))['catch'](handleError(_0x1457ef,null));}; \ No newline at end of file +var _0xe397=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','get','Dispositions','sendStatus','error','stack','name','send','index','Disposition','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','params','keys','includeAll','find'];(function(_0x5e6be5,_0xf2805c){var _0x3e6e05=function(_0x5a5bb2){while(--_0x5a5bb2){_0x5e6be5['push'](_0x5e6be5['shift']());}};_0x3e6e05(++_0xf2805c);}(_0xe397,0xac));var _0x7e39=function(_0x59947d,_0x27ad58){_0x59947d=_0x59947d-0x0;var _0x4b59e0=_0xe397[_0x59947d];return _0x4b59e0;};'use strict';var emlformat=require(_0x7e39('0x0'));var rimraf=require(_0x7e39('0x1'));var zipdir=require(_0x7e39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e39('0x3'));var moment=require(_0x7e39('0x4'));var BPromise=require(_0x7e39('0x5'));var Mustache=require(_0x7e39('0x6'));var util=require(_0x7e39('0x7'));var path=require(_0x7e39('0x8'));var sox=require('sox');var csv=require(_0x7e39('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e39('0xa'));var _=require(_0x7e39('0xb'));var squel=require(_0x7e39('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e39('0x9'));var querystring=require(_0x7e39('0xe'));var Papa=require(_0x7e39('0xf'));var Redis=require(_0x7e39('0x10'));var authService=require(_0x7e39('0x11'));var qs=require(_0x7e39('0x12'));var as=require(_0x7e39('0x13'));var hardwareService=require(_0x7e39('0x14'));var logger=require('../../config/logger')(_0x7e39('0x15'));var utils=require(_0x7e39('0x16'));var config=require(_0x7e39('0x17'));var licenseUtil=require(_0x7e39('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7b39,_0x5738ed){_0x5738ed=_0x5738ed||0xcc;return function(_0x279bd1){if(_0x279bd1){return _0x4a7b39['sendStatus'](_0x5738ed);}return _0x4a7b39[_0x7e39('0x19')](_0x5738ed)['end']();};}function respondWithResult(_0x31b3fd,_0x5210d3){_0x5210d3=_0x5210d3||0xc8;return function(_0xf7e9af){if(_0xf7e9af){return _0x31b3fd[_0x7e39('0x19')](_0x5210d3)[_0x7e39('0x1a')](_0xf7e9af);}};}function respondWithFilteredResult(_0x276f09,_0x31b73f){return function(_0x4be7e0){if(_0x4be7e0){var _0x425b68=typeof _0x31b73f[_0x7e39('0x1b')]===_0x7e39('0x1c')&&typeof _0x31b73f['limit']===_0x7e39('0x1c');var _0x26eb46=_0x4be7e0['count'];var _0x4918ea=_0x425b68?0x0:_0x31b73f[_0x7e39('0x1b')];var _0x5bc780=_0x425b68?_0x4be7e0[_0x7e39('0x1d')]:_0x31b73f['offset']+_0x31b73f[_0x7e39('0x1e')];var _0x45a085;if(_0x5bc780>=_0x26eb46){_0x5bc780=_0x26eb46;_0x45a085=0xc8;}else{_0x45a085=0xce;}_0x276f09[_0x7e39('0x19')](_0x45a085);return _0x276f09['set'](_0x7e39('0x1f'),_0x4918ea+'-'+_0x5bc780+'/'+_0x26eb46)[_0x7e39('0x1a')](_0x4be7e0);}return null;};}function patchUpdates(_0x345eca){return function(_0x61b10d){try{jsonpatch['apply'](_0x61b10d,_0x345eca,!![]);}catch(_0x7ccfd7){return BPromise[_0x7e39('0x20')](_0x7ccfd7);}return _0x61b10d['save']();};}function saveUpdates(_0x5b8435,_0x568572){return function(_0x5c65e5){if(_0x5c65e5){return _0x5c65e5['update'](_0x5b8435)[_0x7e39('0x21')](function(_0x410e7b){return _0x410e7b;});}return null;};}function removeEntity(_0x31e74c,_0x58bbe5){return function(_0x4df0dd){if(_0x4df0dd){return _0x4df0dd[_0x7e39('0x22')]()[_0x7e39('0x21')](function(){var _0x11e7ae=_0x4df0dd[_0x7e39('0x23')]({'plain':!![]});var _0x4a1a47=_0x7e39('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a1a47,'resourceId':_0x11e7ae['id']}})[_0x7e39('0x21')](function(){return _0x4df0dd;});})[_0x7e39('0x21')](function(){_0x31e74c[_0x7e39('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d6d02,_0x587687){return function(_0x338d9c){if(!_0x338d9c){_0x3d6d02[_0x7e39('0x25')](0x194);}return _0x338d9c;};}function handleError(_0x58223f,_0x1fe467){_0x1fe467=_0x1fe467||0x1f4;return function(_0x30c66e){logger[_0x7e39('0x26')](_0x30c66e[_0x7e39('0x27')]);if(_0x30c66e['name']){delete _0x30c66e[_0x7e39('0x28')];}_0x58223f[_0x7e39('0x19')](_0x1fe467)[_0x7e39('0x29')](_0x30c66e);};}exports[_0x7e39('0x2a')]=function(_0x45e6d3,_0x5b81a0){var _0x242f56={},_0x1d459f={},_0x1c117a={'count':0x0,'rows':[]};var _0x369fe9=_['map'](db[_0x7e39('0x2b')]['rawAttributes'],function(_0x4f7cb7){return{'name':_0x4f7cb7[_0x7e39('0x2c')],'type':_0x4f7cb7[_0x7e39('0x2d')][_0x7e39('0x2e')]};});_0x1d459f[_0x7e39('0x2f')]=_[_0x7e39('0x30')](_0x369fe9,_0x7e39('0x28'));_0x1d459f[_0x7e39('0x31')]=_['keys'](_0x45e6d3[_0x7e39('0x31')]);_0x1d459f[_0x7e39('0x32')]=_['intersection'](_0x1d459f[_0x7e39('0x2f')],_0x1d459f[_0x7e39('0x31')]);_0x242f56[_0x7e39('0x33')]=_[_0x7e39('0x34')](_0x1d459f[_0x7e39('0x2f')],qs[_0x7e39('0x35')](_0x45e6d3[_0x7e39('0x31')][_0x7e39('0x35')]));_0x242f56[_0x7e39('0x33')]=_0x242f56[_0x7e39('0x33')][_0x7e39('0x36')]?_0x242f56[_0x7e39('0x33')]:_0x1d459f[_0x7e39('0x2f')];if(!_0x45e6d3[_0x7e39('0x31')][_0x7e39('0x37')](_0x7e39('0x38'))){_0x242f56[_0x7e39('0x1e')]=qs[_0x7e39('0x1e')](_0x45e6d3['query'][_0x7e39('0x1e')]);_0x242f56['offset']=qs['offset'](_0x45e6d3['query'][_0x7e39('0x1b')]);}_0x242f56[_0x7e39('0x39')]=qs['sort'](_0x45e6d3[_0x7e39('0x31')][_0x7e39('0x3a')]);_0x242f56[_0x7e39('0x3b')]=qs[_0x7e39('0x32')](_[_0x7e39('0x3c')](_0x45e6d3[_0x7e39('0x31')],_0x1d459f[_0x7e39('0x32')]),_0x369fe9);if(_0x45e6d3[_0x7e39('0x31')]['filter']){_0x242f56[_0x7e39('0x3b')]=_[_0x7e39('0x3d')](_0x242f56[_0x7e39('0x3b')],{'$or':_[_0x7e39('0x30')](_0x369fe9,function(_0x38b8fc){if(_0x38b8fc[_0x7e39('0x2d')]!==_0x7e39('0x3e')){var _0x14fc01={};_0x14fc01[_0x38b8fc[_0x7e39('0x28')]]={'$like':'%'+_0x45e6d3[_0x7e39('0x31')][_0x7e39('0x3f')]+'%'};return _0x14fc01;}})});}_0x242f56=_[_0x7e39('0x3d')]({},_0x242f56,_0x45e6d3[_0x7e39('0x40')]);var _0x6cf9f3={'where':_0x242f56[_0x7e39('0x3b')]};return db['Disposition'][_0x7e39('0x1d')](_0x6cf9f3)[_0x7e39('0x21')](function(_0xdb46eb){_0x1c117a[_0x7e39('0x1d')]=_0xdb46eb;if(_0x45e6d3[_0x7e39('0x31')]['includeAll']){_0x242f56[_0x7e39('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x242f56);})[_0x7e39('0x21')](function(_0xe7cfc3){_0x1c117a['rows']=_0xe7cfc3;return _0x1c117a;})[_0x7e39('0x21')](respondWithFilteredResult(_0x5b81a0,_0x242f56))[_0x7e39('0x42')](handleError(_0x5b81a0,null));};exports['show']=function(_0x5ca526,_0x59e57d){var _0x2b090c={'raw':!![],'where':{'id':_0x5ca526[_0x7e39('0x43')]['id']}},_0x3e6cf5={};_0x3e6cf5[_0x7e39('0x2f')]=_[_0x7e39('0x44')](db[_0x7e39('0x2b')]['rawAttributes']);_0x3e6cf5[_0x7e39('0x31')]=_[_0x7e39('0x44')](_0x5ca526[_0x7e39('0x31')]);_0x3e6cf5[_0x7e39('0x32')]=_['intersection'](_0x3e6cf5[_0x7e39('0x2f')],_0x3e6cf5[_0x7e39('0x31')]);_0x2b090c['attributes']=_[_0x7e39('0x34')](_0x3e6cf5[_0x7e39('0x2f')],qs[_0x7e39('0x35')](_0x5ca526[_0x7e39('0x31')]['fields']));_0x2b090c[_0x7e39('0x33')]=_0x2b090c[_0x7e39('0x33')][_0x7e39('0x36')]?_0x2b090c['attributes']:_0x3e6cf5['model'];if(_0x5ca526['query'][_0x7e39('0x45')]){_0x2b090c[_0x7e39('0x41')]=[{'all':!![]}];}_0x2b090c=_[_0x7e39('0x3d')]({},_0x2b090c,_0x5ca526[_0x7e39('0x40')]);return db[_0x7e39('0x2b')][_0x7e39('0x46')](_0x2b090c)[_0x7e39('0x21')](handleEntityNotFound(_0x59e57d,null))['then'](respondWithResult(_0x59e57d,null))[_0x7e39('0x42')](handleError(_0x59e57d,null));};exports[_0x7e39('0x47')]=function(_0x6d2728,_0x7e1394){return db[_0x7e39('0x2b')][_0x7e39('0x47')](_0x6d2728[_0x7e39('0x48')],{})[_0x7e39('0x21')](function(_0x1a4710){var _0x5735ae=_0x6d2728[_0x7e39('0x49')][_0x7e39('0x23')]({'plain':!![]});if(!_0x5735ae)throw new Error(_0x7e39('0x4a'));if(_0x5735ae[_0x7e39('0x4b')]==='user'){var _0x317af1=_0x1a4710['get']({'plain':!![]});var _0x1b8c5a=_0x7e39('0x24');return db[_0x7e39('0x4c')][_0x7e39('0x46')]({'where':{'name':_0x1b8c5a,'userProfileId':_0x5735ae['userProfileId']},'raw':!![]})[_0x7e39('0x21')](function(_0x30124c){if(_0x30124c&&_0x30124c[_0x7e39('0x4d')]===0x0){return db[_0x7e39('0x4e')][_0x7e39('0x47')]({'name':_0x317af1['name'],'resourceId':_0x317af1['id'],'type':_0x30124c[_0x7e39('0x28')],'sectionId':_0x30124c['id']},{})[_0x7e39('0x21')](function(){return _0x1a4710;});}else{return _0x1a4710;}})[_0x7e39('0x42')](function(_0x22c4d6){logger[_0x7e39('0x26')](_0x7e39('0x4f'),_0x22c4d6);throw _0x22c4d6;});}return _0x1a4710;})[_0x7e39('0x21')](respondWithResult(_0x7e1394,0xc9))[_0x7e39('0x42')](handleError(_0x7e1394,null));};exports[_0x7e39('0x50')]=function(_0x4e7929,_0x1c6e0f){if(_0x4e7929['body']['id']){delete _0x4e7929[_0x7e39('0x48')]['id'];}return db[_0x7e39('0x2b')]['find']({'where':{'id':_0x4e7929[_0x7e39('0x43')]['id']}})[_0x7e39('0x21')](handleEntityNotFound(_0x1c6e0f,null))['then'](saveUpdates(_0x4e7929[_0x7e39('0x48')],null))[_0x7e39('0x21')](respondWithResult(_0x1c6e0f,null))['catch'](handleError(_0x1c6e0f,null));};exports[_0x7e39('0x22')]=function(_0x5240f8,_0x8c3ef){return db[_0x7e39('0x2b')][_0x7e39('0x46')]({'where':{'id':_0x5240f8[_0x7e39('0x43')]['id']}})[_0x7e39('0x21')](handleEntityNotFound(_0x8c3ef,null))[_0x7e39('0x21')](removeEntity(_0x8c3ef,null))[_0x7e39('0x42')](handleError(_0x8c3ef,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 09c7d9e..1b0f5d8 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 _0x6479=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x2ee1ed,_0x5d7786){var _0x3fe790=function(_0x2f388f){while(--_0x2f388f){_0x2ee1ed['push'](_0x2ee1ed['shift']());}};_0x3fe790(++_0x5d7786);}(_0x6479,0x1c8));var _0x9647=function(_0x1867e3,_0x589b2d){_0x1867e3=_0x1867e3-0x0;var _0x4b22aa=_0x6479[_0x1867e3];return _0x4b22aa;};'use strict';var _=require(_0x9647('0x0'));var util=require(_0x9647('0x1'));var logger=require(_0x9647('0x2'))(_0x9647('0x3'));var moment=require(_0x9647('0x4'));var BPromise=require(_0x9647('0x5'));var rp=require(_0x9647('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9647('0x7'));var attributes=require(_0x9647('0x8'));module[_0x9647('0x9')]=function(_0x37d3d1,_0xc0e8a5){return _0x37d3d1['define'](_0x9647('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x9647('0xb'),_0x9647('0xc')]},{'unique':!![],'name':_0x9647('0xd'),'fields':[_0x9647('0xb'),_0x9647('0xe')]},{'unique':!![],'name':_0x9647('0xf'),'fields':[_0x9647('0xb'),_0x9647('0x10')]},{'unique':!![],'name':_0x9647('0x11'),'fields':[_0x9647('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x9647('0x12'),'fields':['name',_0x9647('0x13')]},{'unique':!![],'name':_0x9647('0x14'),'fields':[_0x9647('0xb'),_0x9647('0x15')]},{'unique':!![],'name':_0x9647('0x16'),'fields':['name',_0x9647('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x331c=['ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','util','../../config/logger','api','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId'];(function(_0x136315,_0x45411c){var _0x483132=function(_0x536af0){while(--_0x536af0){_0x136315['push'](_0x136315['shift']());}};_0x483132(++_0x45411c);}(_0x331c,0x148));var _0xc331=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x331c[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0xc331('0x0'));var logger=require(_0xc331('0x1'))(_0xc331('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc331('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc331('0x4'));var attributes=require(_0xc331('0x5'));module[_0xc331('0x6')]=function(_0xd0bb0,_0x192526){return _0xd0bb0[_0xc331('0x7')](_0xc331('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xc331('0x9'),'fields':[_0xc331('0xa'),_0xc331('0xb')]},{'unique':!![],'name':'name_chat','fields':['name',_0xc331('0xc')]},{'unique':!![],'name':_0xc331('0xd'),'fields':[_0xc331('0xa'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name',_0xc331('0xe')]},{'unique':!![],'name':_0xc331('0xf'),'fields':[_0xc331('0xa'),_0xc331('0x10')]},{'unique':!![],'name':_0xc331('0x11'),'fields':[_0xc331('0xa'),_0xc331('0x12')]},{'unique':!![],'name':_0xc331('0x13'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7e130d7..1774629 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(_0x3f9423,_0x5d24f1){var _0x32ddc4=function(_0x2afc04){while(--_0x2afc04){_0x3f9423['push'](_0x3f9423['shift']());}};_0x32ddc4(++_0x5d24f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x2be490,_0x29f00d){var _0x3059aa=function(_0x51b6ab){while(--_0x51b6ab){_0x2be490['push'](_0x2be490['shift']());}};_0x3059aa(++_0x29f00d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 44eab02..e159933 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 _0xbd23=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','multer','util','connect-timeout','Router','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd23,0x9d));var _0x3bd2=function(_0x549c77,_0xb62a09){_0x549c77=_0x549c77-0x0;var _0x9725a2=_0xbd23[_0x549c77];return _0x9725a2;};'use strict';var multer=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var path=require('path');var timeout=require(_0x3bd2('0x2'));var express=require('express');var router=express[_0x3bd2('0x3')]();var fs_extra=require(_0x3bd2('0x4'));var auth=require(_0x3bd2('0x5'));var interaction=require(_0x3bd2('0x6'));var config=require(_0x3bd2('0x7'));var controller=require(_0x3bd2('0x8'));router[_0x3bd2('0x9')]('/',auth[_0x3bd2('0xa')](),controller[_0x3bd2('0xb')]);router[_0x3bd2('0x9')]('/:id',auth[_0x3bd2('0xa')](),controller['show']);router[_0x3bd2('0xc')]('/',auth[_0x3bd2('0xa')](),controller[_0x3bd2('0xd')]);router[_0x3bd2('0xe')](_0x3bd2('0xf'),auth[_0x3bd2('0xa')](),controller[_0x3bd2('0x10')]);router[_0x3bd2('0x11')](_0x3bd2('0xf'),auth[_0x3bd2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa492=['index','show','create','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x525ae8,_0x37081d){var _0x36e410=function(_0x1977c3){while(--_0x1977c3){_0x525ae8['push'](_0x525ae8['shift']());}};_0x36e410(++_0x37081d);}(_0xa492,0x1c4));var _0x2a49=function(_0x33ca94,_0x329754){_0x33ca94=_0x33ca94-0x0;var _0x54edb1=_0xa492[_0x33ca94];return _0x54edb1;};'use strict';var multer=require(_0x2a49('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a49('0x1'));var express=require(_0x2a49('0x2'));var router=express['Router']();var fs_extra=require(_0x2a49('0x3'));var auth=require(_0x2a49('0x4'));var interaction=require(_0x2a49('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x2a49('0x6')]('/',auth['isAuthenticated'](),controller[_0x2a49('0x7')]);router[_0x2a49('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2a49('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a49('0x9')]);router[_0x2a49('0xa')](_0x2a49('0xb'),auth[_0x2a49('0xc')](),controller[_0x2a49('0xd')]);router[_0x2a49('0xe')]('/:id',auth[_0x2a49('0xc')](),controller[_0x2a49('0xf')]);module[_0x2a49('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b4cc4f2..39cdac4 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 _0xfb86=['localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x47186d,_0x2b166b){var _0x285bba=function(_0x1dd305){while(--_0x1dd305){_0x47186d['push'](_0x47186d['shift']());}};_0x285bba(++_0x2b166b);}(_0xfb86,0xeb));var _0x6fb8=function(_0x133020,_0x2f76aa){_0x133020=_0x133020-0x0;var _0x3257c9=_0xfb86[_0x133020];return _0x3257c9;};'use strict';var Sequelize=require('sequelize');module[_0x6fb8('0x0')]={'name':{'type':Sequelize[_0x6fb8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fb8('0x1')]},'ecm':{'type':Sequelize[_0x6fb8('0x2')]('yes','no'),'defaultValue':_0x6fb8('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6fb8('0x4')},'localstationid':{'type':Sequelize[_0x6fb8('0x1')],'unique':_0x6fb8('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x6fb8('0x6'),_0x6fb8('0x7'),_0x6fb8('0x8'),_0x6fb8('0x9'),_0x6fb8('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6fb8('0x2')](_0x6fb8('0x6'),_0x6fb8('0x7'),_0x6fb8('0x8'),'9600','12000',_0x6fb8('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x6fb8('0xc')},'gateway':{'type':Sequelize[_0x6fb8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6fb8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6fb8('0x2')](_0x6fb8('0xd'),_0x6fb8('0xe'),'DADHI',_0x6fb8('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6fb8('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6fb8('0x10')],'defaultValue':function(){return _0x6fb8('0x11');}},'notificationSound':{'type':Sequelize[_0x6fb8('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fb8('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6fb8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6fb8('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fb8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fb8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6fb8('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6fb8('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5049cd){if(!_0x5049cd)this[_0x6fb8('0x15')](_0x6fb8('0x16'),null);this['setDataValue'](_0x6fb8('0x17'),_0x5049cd);}}}; \ No newline at end of file +var _0x7d9f=['SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','INTEGER'];(function(_0x13b200,_0xb00e8a){var _0x489875=function(_0x3b261e){while(--_0x3b261e){_0x13b200['push'](_0x13b200['shift']());}};_0x489875(++_0xb00e8a);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0x7d9f[_0x4dbc5d];return _0x45b461;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]},'ecm':{'type':Sequelize[_0xf7d9('0x3')]('yes','no'),'defaultValue':_0xf7d9('0x4')},'headerinfo':{'type':Sequelize[_0xf7d9('0x2')],'defaultValue':_0xf7d9('0x5')},'localstationid':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0xf7d9('0x7'),_0xf7d9('0x8'),'9600',_0xf7d9('0x9'),_0xf7d9('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xf7d9('0x3')]('2400',_0xf7d9('0x7'),_0xf7d9('0x8'),'9600','12000',_0xf7d9('0xa')),'defaultValue':_0xf7d9('0xa')},'modem':{'type':Sequelize[_0xf7d9('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf7d9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf7d9('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf7d9('0x3')](_0xf7d9('0xc'),'IAX',_0xf7d9('0xd'),_0xf7d9('0xe')),'defaultValue':_0xf7d9('0xc')},'key':{'type':Sequelize[_0xf7d9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf7d9('0xf');}},'notificationSound':{'type':Sequelize[_0xf7d9('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf7d9('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf7d9('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf7d9('0x10')],'defaultValue':![],'comment':_0xf7d9('0x11'),'set':function(_0xe29103){if(!_0xe29103)this['setDataValue'](_0xf7d9('0x12'),null);this[_0xf7d9('0x13')]('mandatoryDisposition',_0xe29103);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 371aaf4..7fdf22a 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 _0x155f=['register','jayson/promise','client','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','show','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','length','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','DESC','attachments','join','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x43f748,_0x2afb5f){var _0x2b6349=function(_0x26c642){while(--_0x26c642){_0x43f748['push'](_0x43f748['shift']());}};_0x2b6349(++_0x2afb5f);}(_0x155f,0xa5));var _0xf155=function(_0x48ab45,_0x3724ae){_0x48ab45=_0x48ab45-0x0;var _0xc9770a=_0x155f[_0x48ab45];return _0xc9770a;};'use strict';var emlformat=require(_0xf155('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf155('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf155('0x2'));var moment=require(_0xf155('0x3'));var BPromise=require(_0xf155('0x4'));var Mustache=require(_0xf155('0x5'));var util=require(_0xf155('0x6'));var path=require(_0xf155('0x7'));var sox=require(_0xf155('0x8'));var csv=require(_0xf155('0x9'));var ejs=require(_0xf155('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf155('0xb'));var squel=require(_0xf155('0xc'));var crypto=require(_0xf155('0xd'));var jsforce=require(_0xf155('0xe'));var deskjs=require(_0xf155('0xf'));var toCsv=require(_0xf155('0x9'));var querystring=require(_0xf155('0x10'));var Papa=require(_0xf155('0x11'));var Redis=require(_0xf155('0x12'));var authService=require(_0xf155('0x13'));var qs=require(_0xf155('0x14'));var as=require(_0xf155('0x15'));var hardwareService=require(_0xf155('0x16'));var logger=require(_0xf155('0x17'))(_0xf155('0x18'));var utils=require(_0xf155('0x19'));var config=require(_0xf155('0x1a'));var licenseUtil=require(_0xf155('0x1b'));var db=require(_0xf155('0x1c'))['db'];config[_0xf155('0x1d')]=_[_0xf155('0x1e')](config[_0xf155('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xf155('0x1f'))(new Redis(config[_0xf155('0x1d')]));require('./faxAccount.socket')[_0xf155('0x20')](socket);var jayson=require(_0xf155('0x21'));var client=jayson[_0xf155('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xf155('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304af6,_0x43913d,_0x2fd1b5,_0x462ddf){return new BPromise(function(_0x27a36e,_0x484fd1){var _0x551be5=_0x462ddf||client;return _0x551be5[_0xf155('0x23')](_0x304af6,_0x2fd1b5)[_0xf155('0x24')](function(_0x16af28){logger[_0xf155('0x25')]('FaxAccount,\x20%s,\x20%s',_0x43913d,_0xf155('0x26'));logger[_0xf155('0x27')](_0xf155('0x28'),_0x43913d,_0xf155('0x26'),JSON[_0xf155('0x29')](_0x16af28));if(_0x16af28['error']){if(_0x16af28[_0xf155('0x2a')][_0xf155('0x2b')]===0x1f4){logger[_0xf155('0x2a')](_0xf155('0x2c'),_0x43913d,_0x16af28[_0xf155('0x2a')]['message']);return _0x484fd1(_0x16af28[_0xf155('0x2a')][_0xf155('0x2d')]);}logger[_0xf155('0x2a')](_0xf155('0x2c'),_0x43913d,_0x16af28[_0xf155('0x2a')]['message']);return _0x27a36e(_0x16af28[_0xf155('0x2a')][_0xf155('0x2d')]);}else{logger['info'](_0xf155('0x2c'),_0x43913d,'request\x20sent');_0x27a36e(_0x16af28[_0xf155('0x2e')][_0xf155('0x2d')]);}})[_0xf155('0x2f')](function(_0x364d5c){logger[_0xf155('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x43913d,_0x364d5c);_0x484fd1(_0x364d5c);});});}function respondWithStatusCode(_0x5a7271,_0x28b044){_0x28b044=_0x28b044||0xcc;return function(_0x120e79){if(_0x120e79){return _0x5a7271[_0xf155('0x30')](_0x28b044);}return _0x5a7271[_0xf155('0x31')](_0x28b044)[_0xf155('0x32')]();};}function respondWithResult(_0x4925d5,_0x511e86){_0x511e86=_0x511e86||0xc8;return function(_0x65c957){if(_0x65c957){return _0x4925d5[_0xf155('0x31')](_0x511e86)[_0xf155('0x33')](_0x65c957);}};}function respondWithFilteredResult(_0x3ff651,_0x325f15){return function(_0x27d69b){if(_0x27d69b){var _0x47ba7c=typeof _0x325f15[_0xf155('0x34')]===_0xf155('0x35')&&typeof _0x325f15[_0xf155('0x36')]==='undefined';var _0x4f04eb=_0x27d69b[_0xf155('0x37')];var _0x22fd26=_0x47ba7c?0x0:_0x325f15['offset'];var _0x9deb2=_0x47ba7c?_0x27d69b[_0xf155('0x37')]:_0x325f15['offset']+_0x325f15[_0xf155('0x36')];var _0x2c063c;if(_0x9deb2>=_0x4f04eb){_0x9deb2=_0x4f04eb;_0x2c063c=0xc8;}else{_0x2c063c=0xce;}_0x3ff651[_0xf155('0x31')](_0x2c063c);return _0x3ff651[_0xf155('0x38')](_0xf155('0x39'),_0x22fd26+'-'+_0x9deb2+'/'+_0x4f04eb)[_0xf155('0x33')](_0x27d69b);}return null;};}function patchUpdates(_0x9df1b3){return function(_0x1a216a){try{jsonpatch[_0xf155('0x3a')](_0x1a216a,_0x9df1b3,!![]);}catch(_0x424508){return BPromise[_0xf155('0x3b')](_0x424508);}return _0x1a216a[_0xf155('0x3c')]();};}function saveUpdates(_0x560afd,_0x1a0266){return function(_0x90fb96){if(_0x90fb96){return _0x90fb96['update'](_0x560afd)[_0xf155('0x24')](function(_0x119f37){return _0x119f37;});}return null;};}function removeEntity(_0x4a2b58,_0x20b8a1){return function(_0x5e1f2d){if(_0x5e1f2d){return _0x5e1f2d[_0xf155('0x3d')]()['then'](function(){var _0x379559=_0x5e1f2d[_0xf155('0x3e')]({'plain':!![]});var _0x4767d6=_0xf155('0x3f');return db['UserProfileResource'][_0xf155('0x3d')]({'where':{'type':_0x4767d6,'resourceId':_0x379559['id']}})[_0xf155('0x24')](function(){return _0x5e1f2d;});})[_0xf155('0x24')](function(){_0x4a2b58[_0xf155('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3745c9,_0x40bdc2){return function(_0x2a68e8){if(!_0x2a68e8){_0x3745c9[_0xf155('0x30')](0x194);}return _0x2a68e8;};}function handleError(_0x5a7513,_0xb22ce){_0xb22ce=_0xb22ce||0x1f4;return function(_0x483b69){logger[_0xf155('0x2a')](_0x483b69['stack']);if(_0x483b69['name']){delete _0x483b69[_0xf155('0x40')];}_0x5a7513[_0xf155('0x31')](_0xb22ce)[_0xf155('0x41')](_0x483b69);};}exports['index']=function(_0x21de4b,_0x35fa82){var _0x2a3e69={'include':[{'model':db[_0xf155('0x42')],'as':'mandatoryDispositionPause'}]},_0xb4a323={},_0x309c69={'count':0x0,'rows':[]};var _0x8bb2b5=_[_0xf155('0x43')](db[_0xf155('0x44')][_0xf155('0x45')],function(_0x11a954){return{'name':_0x11a954[_0xf155('0x46')],'type':_0x11a954[_0xf155('0x47')]['key']};});_0xb4a323[_0xf155('0x48')]=_[_0xf155('0x43')](_0x8bb2b5,_0xf155('0x40'));_0xb4a323[_0xf155('0x49')]=_[_0xf155('0x4a')](_0x21de4b[_0xf155('0x49')]);_0xb4a323[_0xf155('0x4b')]=_[_0xf155('0x4c')](_0xb4a323[_0xf155('0x48')],_0xb4a323[_0xf155('0x49')]);_0x2a3e69[_0xf155('0x4d')]=_[_0xf155('0x4c')](_0xb4a323[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x21de4b['query']['fields']));_0x2a3e69['attributes']=_0x2a3e69[_0xf155('0x4d')]['length']?_0x2a3e69[_0xf155('0x4d')]:_0xb4a323[_0xf155('0x48')];if(!_0x21de4b[_0xf155('0x49')][_0xf155('0x4f')](_0xf155('0x50'))){_0x2a3e69[_0xf155('0x36')]=qs[_0xf155('0x36')](_0x21de4b[_0xf155('0x49')][_0xf155('0x36')]);_0x2a3e69['offset']=qs[_0xf155('0x34')](_0x21de4b['query']['offset']);}_0x2a3e69[_0xf155('0x51')]=qs[_0xf155('0x52')](_0x21de4b[_0xf155('0x49')][_0xf155('0x52')]);_0x2a3e69[_0xf155('0x53')]=qs['filters'](_['pick'](_0x21de4b['query'],_0xb4a323['filters']),_0x8bb2b5);if(_0x21de4b['query']['filter']){_0x2a3e69[_0xf155('0x53')]=_[_0xf155('0x54')](_0x2a3e69[_0xf155('0x53')],{'$or':_['map'](_0x8bb2b5,function(_0x1b6629){if(_0x1b6629['type']!==_0xf155('0x55')){var _0x99eb91={};_0x99eb91[_0x1b6629['name']]={'$like':'%'+_0x21de4b[_0xf155('0x49')][_0xf155('0x56')]+'%'};return _0x99eb91;}})});}_0x2a3e69=_[_0xf155('0x54')]({},_0x2a3e69,_0x21de4b[_0xf155('0x57')]);var _0x40040e={'where':_0x2a3e69[_0xf155('0x53')]};return db[_0xf155('0x44')]['count'](_0x40040e)[_0xf155('0x24')](function(_0x2ca78e){_0x309c69[_0xf155('0x37')]=_0x2ca78e;if(_0x21de4b[_0xf155('0x49')]['includeAll']){_0x2a3e69[_0xf155('0x58')]=[{'all':!![]}];}return db[_0xf155('0x44')]['findAll'](_0x2a3e69);})[_0xf155('0x24')](function(_0x748b2){_0x309c69[_0xf155('0x59')]=_0x748b2;return _0x309c69;})[_0xf155('0x24')](respondWithFilteredResult(_0x35fa82,_0x2a3e69))[_0xf155('0x2f')](handleError(_0x35fa82,null));};exports[_0xf155('0x5a')]=function(_0x57cdc8,_0x4722a5){var _0x1ad5a5={'raw':![],'where':{'id':_0x57cdc8['params']['id']},'include':[{'model':db[_0xf155('0x42')],'as':_0xf155('0x5b')}]},_0x4f2f50={};_0x4f2f50[_0xf155('0x48')]=_['keys'](db[_0xf155('0x44')][_0xf155('0x45')]);_0x4f2f50['query']=_[_0xf155('0x4a')](_0x57cdc8[_0xf155('0x49')]);_0x4f2f50[_0xf155('0x4b')]=_['intersection'](_0x4f2f50['model'],_0x4f2f50['query']);_0x1ad5a5[_0xf155('0x4d')]=_['intersection'](_0x4f2f50[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x57cdc8[_0xf155('0x49')][_0xf155('0x4e')]));_0x1ad5a5['attributes']=_0x1ad5a5['attributes']['length']?_0x1ad5a5['attributes']:_0x4f2f50[_0xf155('0x48')];if(_0x57cdc8[_0xf155('0x49')][_0xf155('0x5c')]){_0x1ad5a5[_0xf155('0x58')]=[{'all':!![]}];}_0x1ad5a5=_[_0xf155('0x54')]({},_0x1ad5a5,_0x57cdc8[_0xf155('0x57')]);return db['FaxAccount'][_0xf155('0x5d')](_0x1ad5a5)[_0xf155('0x24')](handleEntityNotFound(_0x4722a5,null))[_0xf155('0x24')](respondWithResult(_0x4722a5,null))[_0xf155('0x2f')](handleError(_0x4722a5,null));};exports['create']=function(_0x3a69b9,_0x1a628e){return db[_0xf155('0x44')][_0xf155('0x5e')](_0x3a69b9[_0xf155('0x5f')],{})[_0xf155('0x24')](function(_0x8b6720){var _0x2fc576=_0x3a69b9[_0xf155('0x60')][_0xf155('0x3e')]({'plain':!![]});if(!_0x2fc576)throw new Error(_0xf155('0x61'));if(_0x2fc576['role']===_0xf155('0x60')){var _0x1083ca=_0x8b6720['get']({'plain':!![]});var _0x1286ec='FaxAccounts';return db['UserProfileSection'][_0xf155('0x5d')]({'where':{'name':_0x1286ec,'userProfileId':_0x2fc576['userProfileId']},'raw':!![]})[_0xf155('0x24')](function(_0x531b20){if(_0x531b20&&_0x531b20['autoAssociation']===0x0){return db['UserProfileResource'][_0xf155('0x5e')]({'name':_0x1083ca['name'],'resourceId':_0x1083ca['id'],'type':_0x531b20['name'],'sectionId':_0x531b20['id']},{})[_0xf155('0x24')](function(){return _0x8b6720;});}else{return _0x8b6720;}})[_0xf155('0x2f')](function(_0x13dcc8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13dcc8);throw _0x13dcc8;});}return _0x8b6720;})[_0xf155('0x24')](respondWithResult(_0x1a628e,0xc9))['catch'](handleError(_0x1a628e,null));};exports[_0xf155('0x62')]=function(_0x43da9f,_0xb281af){if(_0x43da9f[_0xf155('0x5f')]['id']){delete _0x43da9f['body']['id'];}return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x43da9f['params']['id']},'include':[{'model':db[_0xf155('0x42')],'as':_0xf155('0x5b')}]})[_0xf155('0x24')](handleEntityNotFound(_0xb281af,null))[_0xf155('0x24')](saveUpdates(_0x43da9f['body'],null))['then'](respondWithResult(_0xb281af,null))[_0xf155('0x2f')](handleError(_0xb281af,null));};exports[_0xf155('0x3d')]=function(_0x4e9d0a,_0x5bf587){return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x4e9d0a[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x5bf587,null))[_0xf155('0x24')](removeEntity(_0x5bf587,null))[_0xf155('0x2f')](handleError(_0x5bf587,null));};exports[_0xf155('0x64')]=function(_0x1b01cd,_0x106cb0){return db[_0xf155('0x44')][_0xf155('0x64')]()[_0xf155('0x24')](respondWithResult(_0x106cb0,null))[_0xf155('0x2f')](handleError(_0x106cb0,null));};exports[_0xf155('0x65')]=function(_0x5dbaaa,_0x9892e0,_0x59c3fd){if(_0x5dbaaa[_0xf155('0x5f')]['id']){delete _0x5dbaaa[_0xf155('0x5f')]['id'];}return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x5dbaaa[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x9892e0,null))['then'](function(_0x52b116){if(_0x52b116){_0x5dbaaa['body'][_0xf155('0x66')]=_0x52b116['id'];return db[_0xf155('0x67')]['create'](_0x5dbaaa[_0xf155('0x5f')]);}})[_0xf155('0x24')](respondWithResult(_0x9892e0,null))[_0xf155('0x2f')](handleError(_0x9892e0,null));};exports[_0xf155('0x68')]=function(_0x226374,_0x2865bb,_0x367193){var _0x426bda={'raw':![],'where':{}};var _0x259ca7={};var _0x5178ed={'count':0x0,'rows':[]};return db[_0xf155('0x44')][_0xf155('0x69')]({'where':{'id':_0x226374['params']['id']}})['then'](handleEntityNotFound(_0x2865bb,null))[_0xf155('0x24')](function(_0x40e1db){if(_0x40e1db){_0x259ca7[_0xf155('0x48')]=_['keys'](db['Disposition'][_0xf155('0x45')]);_0x259ca7[_0xf155('0x49')]=_[_0xf155('0x4a')](_0x226374[_0xf155('0x49')]);_0x259ca7[_0xf155('0x4b')]=_[_0xf155('0x4c')](_0x259ca7[_0xf155('0x48')],_0x259ca7[_0xf155('0x49')]);_0x426bda['attributes']=_[_0xf155('0x4c')](_0x259ca7[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x226374[_0xf155('0x49')][_0xf155('0x4e')]));_0x426bda[_0xf155('0x4d')]=_0x426bda[_0xf155('0x4d')][_0xf155('0x6a')]?_0x426bda[_0xf155('0x4d')]:_0x259ca7[_0xf155('0x48')];if(!_0x226374['query'][_0xf155('0x4f')]('nolimit')){_0x426bda[_0xf155('0x36')]=qs[_0xf155('0x36')](_0x226374[_0xf155('0x49')][_0xf155('0x36')]);_0x426bda['offset']=qs[_0xf155('0x34')](_0x226374[_0xf155('0x49')][_0xf155('0x34')]);}_0x426bda[_0xf155('0x51')]=qs['sort'](_0x226374['query'][_0xf155('0x52')]);_0x426bda['where']=qs['filters'](_['pick'](_0x226374[_0xf155('0x49')],_0x259ca7[_0xf155('0x4b')]));_0x426bda[_0xf155('0x53')][_0xf155('0x66')]=_0x40e1db['id'];if(_0x226374[_0xf155('0x49')][_0xf155('0x56')]){_0x426bda[_0xf155('0x53')]=_[_0xf155('0x54')](_0x426bda[_0xf155('0x53')],{'$or':_['map'](_0x426bda['attributes'],function(_0xed6351){var _0x5ed16b={};_0x5ed16b[_0xed6351]={'$like':'%'+_0x226374[_0xf155('0x49')][_0xf155('0x56')]+'%'};return _0x5ed16b;})});}_0x426bda=_[_0xf155('0x54')]({},_0x426bda,_0x226374['options']);return db[_0xf155('0x67')][_0xf155('0x37')]({'where':_0x426bda['where']})['then'](function(_0x510055){_0x5178ed[_0xf155('0x37')]=_0x510055;if(_0x226374['query'][_0xf155('0x5c')]){_0x426bda['include']=[{'all':!![]}];}return db[_0xf155('0x67')][_0xf155('0x6b')](_0x426bda);})['then'](function(_0x1a4805){_0x5178ed[_0xf155('0x59')]=_0x1a4805;return _0x5178ed;});}})[_0xf155('0x24')](respondWithFilteredResult(_0x2865bb,_0x426bda))[_0xf155('0x2f')](handleError(_0x2865bb,null));};exports[_0xf155('0x6c')]=function(_0x420577,_0x2b1699,_0x5595af){return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x420577[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x2b1699,null))['then'](function(_0x42cbbf){if(_0x42cbbf){return _0x42cbbf[_0xf155('0x6c')](_0x420577[_0xf155('0x49')][_0xf155('0x6d')]);}})[_0xf155('0x24')](respondWithStatusCode(_0x2b1699,null))[_0xf155('0x2f')](handleError(_0x2b1699,null));};exports[_0xf155('0x6e')]=function(_0x20c786,_0x3c2be1,_0x4bd3ad){if(_0x20c786['body']['id']){delete _0x20c786[_0xf155('0x5f')]['id'];}return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x20c786[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x3c2be1,null))['then'](function(_0x4ce12e){if(_0x4ce12e){_0x20c786['body'][_0xf155('0x66')]=_0x4ce12e['id'];return db[_0xf155('0x6f')]['create'](_0x20c786[_0xf155('0x5f')]);}})[_0xf155('0x24')](respondWithResult(_0x3c2be1,null))[_0xf155('0x2f')](handleError(_0x3c2be1,null));};exports[_0xf155('0x70')]=function(_0x3fb257,_0x5243a1,_0x1fdce7){var _0x58559c={'raw':![],'where':{}};var _0x64d505={};var _0x3c09f3={'count':0x0,'rows':[]};return db[_0xf155('0x44')][_0xf155('0x69')]({'where':{'id':_0x3fb257[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x5243a1,null))[_0xf155('0x24')](function(_0x1e2563){if(_0x1e2563){_0x64d505[_0xf155('0x48')]=_[_0xf155('0x4a')](db[_0xf155('0x6f')]['rawAttributes']);_0x64d505[_0xf155('0x49')]=_[_0xf155('0x4a')](_0x3fb257[_0xf155('0x49')]);_0x64d505[_0xf155('0x4b')]=_[_0xf155('0x4c')](_0x64d505[_0xf155('0x48')],_0x64d505['query']);_0x58559c[_0xf155('0x4d')]=_[_0xf155('0x4c')](_0x64d505[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x3fb257['query'][_0xf155('0x4e')]));_0x58559c['attributes']=_0x58559c[_0xf155('0x4d')][_0xf155('0x6a')]?_0x58559c[_0xf155('0x4d')]:_0x64d505[_0xf155('0x48')];if(!_0x3fb257[_0xf155('0x49')][_0xf155('0x4f')]('nolimit')){_0x58559c[_0xf155('0x36')]=qs['limit'](_0x3fb257[_0xf155('0x49')][_0xf155('0x36')]);_0x58559c[_0xf155('0x34')]=qs['offset'](_0x3fb257[_0xf155('0x49')][_0xf155('0x34')]);}_0x58559c[_0xf155('0x51')]=qs['sort'](_0x3fb257[_0xf155('0x49')][_0xf155('0x52')]);_0x58559c[_0xf155('0x53')]=qs[_0xf155('0x4b')](_[_0xf155('0x71')](_0x3fb257[_0xf155('0x49')],_0x64d505['filters']));_0x58559c[_0xf155('0x53')]['FaxAccountId']=_0x1e2563['id'];if(_0x3fb257[_0xf155('0x49')][_0xf155('0x56')]){_0x58559c[_0xf155('0x53')]=_['merge'](_0x58559c[_0xf155('0x53')],{'$or':_[_0xf155('0x43')](_0x58559c[_0xf155('0x4d')],function(_0x409d47){var _0x158903={};_0x158903[_0x409d47]={'$like':'%'+_0x3fb257[_0xf155('0x49')][_0xf155('0x56')]+'%'};return _0x158903;})});}_0x58559c=_[_0xf155('0x54')]({},_0x58559c,_0x3fb257['options']);return db['CannedAnswer'][_0xf155('0x37')]({'where':_0x58559c[_0xf155('0x53')]})[_0xf155('0x24')](function(_0x165489){_0x3c09f3[_0xf155('0x37')]=_0x165489;if(_0x3fb257[_0xf155('0x49')][_0xf155('0x5c')]){_0x58559c[_0xf155('0x58')]=[{'all':!![]}];}return db[_0xf155('0x6f')]['findAll'](_0x58559c);})[_0xf155('0x24')](function(_0xd04d6f){_0x3c09f3[_0xf155('0x59')]=_0xd04d6f;return _0x3c09f3;});}})[_0xf155('0x24')](respondWithFilteredResult(_0x5243a1,_0x58559c))['catch'](handleError(_0x5243a1,null));};exports[_0xf155('0x72')]=function(_0x48d090,_0x5eadae,_0x5bc8d3){return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x48d090[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x5eadae,null))[_0xf155('0x24')](function(_0x15050d){if(_0x15050d){return _0x15050d['removeAnswers'](_0x48d090[_0xf155('0x49')][_0xf155('0x6d')]);}})[_0xf155('0x24')](respondWithStatusCode(_0x5eadae,null))[_0xf155('0x2f')](handleError(_0x5eadae,null));};exports['addInteraction']=function(_0x524a29,_0xbeb0b,_0xd72561){return db[_0xf155('0x73')][_0xf155('0x5d')]({'where':{'id':_0x524a29[_0xf155('0x63')]['id']}})['then'](handleEntityNotFound(_0xbeb0b,null))['then'](function(_0x595fc4){if(_0x595fc4){return _0x595fc4[_0xf155('0x74')](_0x524a29[_0xf155('0x5f')][_0xf155('0x6d')],_[_0xf155('0x75')](_0x524a29[_0xf155('0x5f')],[_0xf155('0x6d'),'id'])||{});}})[_0xf155('0x24')](respondWithResult(_0xbeb0b,null))[_0xf155('0x2f')](handleError(_0xbeb0b,null));};exports[_0xf155('0x76')]=function(_0x1dba48,_0x2e6ca3,_0x4e6871){var _0x58b63c={'raw':![],'where':{}};var _0x42d425={};var _0x1ce84e={'count':0x0,'rows':[]};return db[_0xf155('0x44')][_0xf155('0x69')]({'where':{'id':_0x1dba48[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x2e6ca3,null))[_0xf155('0x24')](function(_0x1df2d5){if(_0x1df2d5){_0x42d425[_0xf155('0x48')]=_[_0xf155('0x4a')](db[_0xf155('0x73')][_0xf155('0x45')]);_0x42d425[_0xf155('0x49')]=_[_0xf155('0x4a')](_0x1dba48[_0xf155('0x49')]);_0x42d425['filters']=_['intersection'](_0x42d425['model'],_0x42d425['query']);_0x58b63c['attributes']=_[_0xf155('0x4c')](_0x42d425[_0xf155('0x48')],qs['fields'](_0x1dba48['query'][_0xf155('0x4e')]));_0x58b63c[_0xf155('0x4d')]=_0x58b63c[_0xf155('0x4d')]['length']?_0x58b63c[_0xf155('0x4d')]:_0x42d425[_0xf155('0x48')];if(!_0x1dba48[_0xf155('0x49')][_0xf155('0x4f')](_0xf155('0x50'))){_0x58b63c[_0xf155('0x36')]=qs[_0xf155('0x36')](_0x1dba48[_0xf155('0x49')][_0xf155('0x36')]);_0x58b63c[_0xf155('0x34')]=qs[_0xf155('0x34')](_0x1dba48[_0xf155('0x49')][_0xf155('0x34')]);}_0x58b63c[_0xf155('0x51')]=qs[_0xf155('0x52')](_0x1dba48[_0xf155('0x49')][_0xf155('0x52')]);_0x58b63c['where']=qs['filters'](_['pick'](_0x1dba48[_0xf155('0x49')],_0x42d425[_0xf155('0x4b')]));_0x58b63c[_0xf155('0x53')][_0xf155('0x66')]=_0x1df2d5['id'];if(_0x1dba48[_0xf155('0x49')][_0xf155('0x56')]){_0x58b63c[_0xf155('0x53')]=_[_0xf155('0x54')](_0x58b63c[_0xf155('0x53')],{'$or':_['map'](_0x58b63c[_0xf155('0x4d')],function(_0x1cef6c){var _0x5dbc0d={};_0x5dbc0d[_0x1cef6c]={'$like':'%'+_0x1dba48['query'][_0xf155('0x56')]+'%'};return _0x5dbc0d;})});}_0x58b63c=_[_0xf155('0x54')]({},_0x58b63c,_0x1dba48[_0xf155('0x57')]);return db[_0xf155('0x73')]['count']({'where':_0x58b63c['where']})['then'](function(_0x17a1e6){_0x1ce84e[_0xf155('0x37')]=_0x17a1e6;if(_0x1dba48[_0xf155('0x49')][_0xf155('0x5c')]){_0x58b63c['include']=[{'model':db[_0xf155('0x77')],'as':_0xf155('0x78'),'required':![]},{'model':db[_0xf155('0x79')],'as':_0xf155('0x7a'),'attributes':[_0xf155('0x40'),'fullname',_0xf155('0x7b')],'required':![]},{'model':db[_0xf155('0x7c')],'as':_0xf155('0x7d'),'attributes':['id','name',_0xf155('0x7e')],'where':_0x1dba48['query'][_0xf155('0x7f')]?{'id':_0x1dba48[_0xf155('0x49')][_0xf155('0x7f')]}:undefined,'required':_0x1dba48[_0xf155('0x49')][_0xf155('0x7f')]?!![]:![]}];}return db[_0xf155('0x73')][_0xf155('0x6b')](_0x58b63c);})['then'](function(_0x137bf0){_0x1ce84e[_0xf155('0x59')]=_0x137bf0;return _0x1ce84e;});}})['then'](respondWithFilteredResult(_0x2e6ca3,_0x58b63c))['catch'](handleError(_0x2e6ca3,null));};exports[_0xf155('0x80')]=function(_0x8216f1,_0x5a272b){var _0x2750c1=_0x8216f1[_0xf155('0x63')]['id'];var _0x264a30=_0x8216f1['body'];var _0x3acc5f=0xc8;var _0x525b50=null;return db['sequelize'][_0xf155('0x81')]({'isolationLevel':db[_0xf155('0x82')][_0xf155('0x83')][_0xf155('0x84')]['READ_COMMITTED']},function(_0x5555cb){return db[_0xf155('0x44')][_0xf155('0x69')]({'where':{'id':_0x2750c1},'transaction':_0x5555cb})[_0xf155('0x24')](function(_0x34040e){if(_0x34040e){return db[_0xf155('0x85')][_0xf155('0x3d')]({'where':{'FaxAccountId':_0x2750c1},'transaction':_0x5555cb})[_0xf155('0x24')](function(){var _0x58a1c5=_[_0xf155('0x43')](_0x264a30,function(_0x1a6d52){_0x1a6d52[_0xf155('0x66')]=_0x2750c1;return _0x1a6d52;});return db[_0xf155('0x85')][_0xf155('0x86')](_0x58a1c5,{'transaction':_0x5555cb});});}else{_0x3acc5f=0x194;_0x525b50=[];}});})[_0xf155('0x24')](function(){if(_0x3acc5f!==0x194){return db['FaxApplication'][_0xf155('0x87')]({'where':{'FaxAccountId':_0x2750c1},'order':_0xf155('0x88')})[_0xf155('0x24')](function(_0x5227e1){_0x525b50=_0x5227e1;});}})[_0xf155('0x2f')](function(_0x4aa7d3){_0x3acc5f=0x1f4;logger[_0xf155('0x2a')](_0x4aa7d3['stack']);if(_0x4aa7d3['name']){delete _0x4aa7d3[_0xf155('0x40')];}_0x525b50=_0x4aa7d3;})[_0xf155('0x89')](function(){if(_0x525b50===null){_0x5a272b['sendStatus'](_0x3acc5f);}else{if(_0x3acc5f===0x1f4){_0x5a272b[_0xf155('0x31')](_0x3acc5f)[_0xf155('0x41')](_0x525b50);}else{_0x5a272b[_0xf155('0x31')](_0x3acc5f)['json'](_0x525b50);}}});};exports[_0xf155('0x8a')]=function(_0x19554a,_0x828a87,_0x3825d2){var _0x2d0fd6={};var _0x4b784b={};var _0x1aad35;var _0x57dd67;return db[_0xf155('0x44')][_0xf155('0x69')]({'where':{'id':_0x19554a[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x828a87,null))['then'](function(_0x41fc10){if(_0x41fc10){_0x1aad35=_0x41fc10;_0x4b784b[_0xf155('0x48')]=_['keys'](db[_0xf155('0x85')]['rawAttributes']);_0x4b784b[_0xf155('0x49')]=_['keys'](_0x19554a[_0xf155('0x49')]);_0x4b784b['filters']=_[_0xf155('0x4c')](_0x4b784b[_0xf155('0x48')],_0x4b784b[_0xf155('0x49')]);_0x2d0fd6[_0xf155('0x4d')]=_[_0xf155('0x4c')](_0x4b784b[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x19554a[_0xf155('0x49')]['fields']));_0x2d0fd6['attributes']=_0x2d0fd6['attributes'][_0xf155('0x6a')]?_0x2d0fd6[_0xf155('0x4d')]:_0x4b784b[_0xf155('0x48')];_0x2d0fd6[_0xf155('0x51')]=qs[_0xf155('0x52')](_0x19554a[_0xf155('0x49')]['sort']);_0x2d0fd6[_0xf155('0x53')]=qs[_0xf155('0x4b')](_[_0xf155('0x71')](_0x19554a[_0xf155('0x49')],_0x4b784b[_0xf155('0x4b')]));if(_0x19554a[_0xf155('0x49')]['filter']){_0x2d0fd6['where']=_[_0xf155('0x54')](_0x2d0fd6[_0xf155('0x53')],{'$or':_[_0xf155('0x43')](_0x2d0fd6[_0xf155('0x4d')],function(_0x59afb6){var _0x21c559={};_0x21c559[_0x59afb6]={'$like':'%'+_0x19554a['query']['filter']+'%'};return _0x21c559;})});}_0x2d0fd6=_['merge']({},_0x2d0fd6,_0x19554a[_0xf155('0x57')]);return _0x1aad35[_0xf155('0x8a')](_0x2d0fd6);}})['then'](function(_0x58564b){if(_0x58564b){_0x57dd67=_0x58564b['length'];if(!_0x19554a[_0xf155('0x49')][_0xf155('0x4f')](_0xf155('0x50'))){_0x2d0fd6['limit']=qs[_0xf155('0x36')](_0x19554a[_0xf155('0x49')][_0xf155('0x36')]);_0x2d0fd6[_0xf155('0x34')]=qs[_0xf155('0x34')](_0x19554a[_0xf155('0x49')]['offset']);}return _0x1aad35[_0xf155('0x8a')](_0x2d0fd6);}})[_0xf155('0x24')](function(_0x365055){if(_0x365055){return _0x365055?{'count':_0x57dd67,'rows':_0x365055}:null;}})[_0xf155('0x24')](respondWithResult(_0x828a87,null))[_0xf155('0x2f')](handleError(_0x828a87,null));};function Extension(_0x229ebe,_0x5e5fe2,_0x5dab90,_0x18a1c2){this[_0xf155('0x8b')]=_0xf155('0x8c');this[_0xf155('0x8d')]=_0x229ebe[_0xf155('0x8e')];this['app']=_0x18a1c2;this[_0xf155('0x47')]='system';this['description']=_0xf155('0x8f');this['FaxAccountId']=_0x229ebe['id'];this[_0xf155('0x88')]=_0x5e5fe2;this[_0xf155('0x90')]=_0x5dab90;}function createExtensionsReciveFax(_0x5265ce){var _0x1ff261=0x1;var _0x358f2a=[];_0x358f2a[_0xf155('0x91')](new Extension(_0x5265ce,_0x1ff261,'',_0xf155('0x92')));_0x1ff261+=0x1;_0x358f2a[_0xf155('0x91')](new Extension(_0x5265ce,_0x1ff261,'CDR(type)=inbound-fax',_0xf155('0x93')));_0x1ff261+=0x1;for(var _0x5e7bed in _0x5265ce){if(_0x5265ce['hasOwnProperty'](_0x5e7bed)&&(_0x5e7bed===_0xf155('0x94')||_0x5e7bed===_0xf155('0x8e')||_0x5e7bed===_0xf155('0x95')||_0x5e7bed===_0xf155('0x96')||_0x5e7bed==='headerinfo'||_0x5e7bed===_0xf155('0x97')||_0x5e7bed===_0xf155('0x98')||_0x5e7bed==='modem'||_0x5e7bed==='t38timeout')){_0x358f2a[_0xf155('0x91')](new Extension(_0x5265ce,_0x1ff261,_0xf155('0x99')+_0x5e7bed+')='+_0x5265ce[_0x5e7bed],_0xf155('0x93')));_0x1ff261+=0x1;}}_0x358f2a[_0xf155('0x91')](new Extension(_0x5265ce,_0x1ff261,'6',_0xf155('0x9a')));_0x1ff261+=0x1;_0x358f2a[_0xf155('0x91')](new Extension(_0x5265ce,_0x1ff261,_0xf155('0x9b'),_0xf155('0x9c')));_0x1ff261=0x0;return _0x358f2a;}exports[_0xf155('0x9d')]=function(_0x3a86c1,_0x173b54,_0x572c38){var _0x25a00b;return db[_0xf155('0x82')]['transaction'](function(_0x12007d){return db['FaxAccount']['create'](_0x3a86c1['body'],{'transaction':_0x12007d})['then'](function(_0x298e90){_0x25a00b=_0x298e90[_0xf155('0x3e')]({'plain':!![]});return db[_0xf155('0x9e')][_0xf155('0x86')](createExtensionsReciveFax(_0x25a00b),{'transaction':_0x12007d});});})['then'](function(){return _0x25a00b;})[_0xf155('0x24')](respondWithResult(_0x173b54,null))[_0xf155('0x2f')](handleError(_0x173b54,null));};exports[_0xf155('0x9f')]=function(_0x181478,_0x4a208f,_0xfd243a){var _0x1d1eb2;return db[_0xf155('0x82')][_0xf155('0x81')](function(_0x594248){return db[_0xf155('0x44')][_0xf155('0x62')](_0x181478['body'],{'where':{'id':_0x181478[_0xf155('0x5f')]['id']},'transaction':_0x594248})[_0xf155('0x24')](function(_0xbbcad1){return db[_0xf155('0x9e')]['destroy']({'where':{'FaxAccountId':_0x181478[_0xf155('0x5f')]['id']},'transaction':_0x594248})[_0xf155('0x24')](function(_0x4ccb7b){return db[_0xf155('0x9e')][_0xf155('0x86')](createExtensionsReciveFax(_[_0xf155('0x75')](_0x181478[_0xf155('0x5f')],[_0xf155('0xa0'),_0xf155('0xa1'),_0xf155('0xa2'),_0xf155('0xa3'),_0xf155('0xa4'),'ListId'])),{'transaction':_0x594248});});});})[_0xf155('0x24')](function(){return db[_0xf155('0x44')]['findById'](_0x181478[_0xf155('0x5f')]['id']);})[_0xf155('0x24')](respondWithResult(_0x4a208f,null))[_0xf155('0x2f')](handleError(_0x4a208f,null));};exports[_0xf155('0xa5')]=function(_0x5c0fdd,_0x53fd6d,_0x1fe503){var _0x3af868={'raw':!![],'where':{}};var _0x538dd4={};var _0x310881={'count':0x0,'rows':[]};return db[_0xf155('0x44')]['findOne']({'where':{'id':_0x5c0fdd[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x53fd6d,null))[_0xf155('0x24')](function(_0x3420c9){if(_0x3420c9){_0x538dd4[_0xf155('0x48')]=_[_0xf155('0x4a')](db['FaxMessage']['rawAttributes']);_0x538dd4[_0xf155('0x49')]=_['keys'](_0x5c0fdd['query']);_0x538dd4[_0xf155('0x4b')]=_[_0xf155('0x4c')](_0x538dd4[_0xf155('0x48')],_0x538dd4[_0xf155('0x49')]);_0x3af868[_0xf155('0x4d')]=_[_0xf155('0x4c')](_0x538dd4[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x5c0fdd[_0xf155('0x49')][_0xf155('0x4e')]));_0x3af868[_0xf155('0x4d')]=_0x3af868[_0xf155('0x4d')][_0xf155('0x6a')]?_0x3af868[_0xf155('0x4d')]:_0x538dd4[_0xf155('0x48')];if(!_0x5c0fdd[_0xf155('0x49')][_0xf155('0x4f')](_0xf155('0x50'))){_0x3af868[_0xf155('0x36')]=qs[_0xf155('0x36')](_0x5c0fdd[_0xf155('0x49')][_0xf155('0x36')]);_0x3af868['offset']=qs[_0xf155('0x34')](_0x5c0fdd[_0xf155('0x49')][_0xf155('0x34')]);}_0x3af868['order']=qs['sort'](_0x5c0fdd[_0xf155('0x49')][_0xf155('0x52')]);_0x3af868[_0xf155('0x53')]=qs['filters'](_[_0xf155('0x71')](_0x5c0fdd[_0xf155('0x49')],_0x538dd4['filters']));_0x3af868[_0xf155('0x53')][_0xf155('0x66')]=_0x3420c9['id'];if(_0x5c0fdd[_0xf155('0x49')][_0xf155('0x56')]){_0x3af868['where']=_[_0xf155('0x54')](_0x3af868['where'],{'$or':_[_0xf155('0x43')](_0x3af868[_0xf155('0x4d')],function(_0x17659d){var _0x7b5d8c={};_0x7b5d8c[_0x17659d]={'$like':'%'+_0x5c0fdd[_0xf155('0x49')]['filter']+'%'};return _0x7b5d8c;})});}if(_0x5c0fdd[_0xf155('0x49')][_0xf155('0xa6')]){var _0x35a900=_0x5c0fdd[_0xf155('0x49')][_0xf155('0xa6')][_0xf155('0xa7')](',');var _0x14c2c3={};_0x14c2c3[_0x35a900[0x0]]={'$gte':moment(_0x35a900[0x1])[_0xf155('0xa8')](_0xf155('0xa9'))};_0x3af868[_0xf155('0x53')]=_[_0xf155('0x54')](_0x3af868[_0xf155('0x53')],_0x14c2c3);}_0x3af868=_[_0xf155('0x54')]({},_0x3af868,_0x5c0fdd[_0xf155('0x57')]);return db[_0xf155('0xaa')][_0xf155('0x37')]({'where':_0x3af868[_0xf155('0x53')]})['then'](function(_0x20ee6b){_0x310881[_0xf155('0x37')]=_0x20ee6b;if(_0x5c0fdd[_0xf155('0x49')][_0xf155('0x5c')]){_0x3af868[_0xf155('0x58')]=[{'all':!![]}];}return db['FaxMessage'][_0xf155('0x6b')](_0x3af868);})[_0xf155('0x24')](function(_0xe6411f){_0x310881[_0xf155('0x59')]=_0xe6411f;return _0x310881;});}})[_0xf155('0x24')](respondWithFilteredResult(_0x53fd6d,_0x3af868))['catch'](handleError(_0x53fd6d,null));};exports[_0xf155('0x41')]=function(_0x2f7b85,_0x1e9434,_0x1d4f8f){var _0x284b91,_0x11360d={},_0x1dbc59;if(_0x2f7b85[_0xf155('0x5f')]['to']){_0x1dbc59=_0x2f7b85[_0xf155('0x5f')]['to'][0x0];}return db[_0xf155('0x44')][_0xf155('0x5d')]({'where':{'id':_0x2f7b85[_0xf155('0x63')]['id']},'include':[{'model':db[_0xf155('0xab')],'as':_0xf155('0xac'),'include':[{'model':db[_0xf155('0x77')],'as':'Contacts','where':{'fax':_0x1dbc59},'limit':0x1,'order':[['updatedAt',_0xf155('0xad')]]}]}]})['then'](handleEntityNotFound(_0x1e9434,null))[_0xf155('0x24')](function(_0x340e9e){_0x284b91=_0x340e9e;if(_0x2f7b85[_0xf155('0x5f')]['attachments']&&_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][_0xf155('0x6a')]){for(var _0x5cdf48=0x0;_0x5cdf48<_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')]['length'];_0x5cdf48+=0x1){_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][_0x5cdf48]={'filename':_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][_0x5cdf48][_0xf155('0x40')],'id':_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][_0x5cdf48]['id'],'path':path[_0xf155('0xaf')](config[_0xf155('0xb0')],'server/files/attachments',_0x2f7b85['body'][_0xf155('0xae')][_0x5cdf48]['basename'])};}}return respondWithRpcPromise(_0xf155('0xb1'),_0xf155('0xb1'),{'FaxAccountId':_[_0xf155('0xb2')](_0x2f7b85[_0xf155('0x63')]['id'])?undefined:_0x2f7b85[_0xf155('0x63')]['id'],'path':_[_0xf155('0xb2')](_0x2f7b85['body'][_0xf155('0xae')][0x0][_0xf155('0x7')])?undefined:_0x2f7b85['body']['attachments'][0x0][_0xf155('0x7')],'fax':_['isNil'](_0x2f7b85[_0xf155('0x5f')]['to'][0x0])?undefined:_0x2f7b85[_0xf155('0x5f')]['to'][0x0]},client9002);})[_0xf155('0x24')](function(){if(_0x284b91){if(_[_0xf155('0xb2')](_0x2f7b85[_0xf155('0x5f')][_0xf155('0xb3')])){_0x2f7b85[_0xf155('0x5f')][_0xf155('0xb3')]=util[_0xf155('0xa8')](_0xf155('0xb4'),_0x284b91[_0xf155('0x40')],_0x284b91[_0xf155('0xb5')]);}if(_0x284b91[_0xf155('0xac')]){if(_0x284b91[_0xf155('0xac')][_0xf155('0xb6')]['length']){return _0x284b91['List'][_0xf155('0xb6')][0x0];}else{return db['CmContact'][_0xf155('0x5e')](_[_0xf155('0x1e')](_0x2f7b85['body'],{'firstName':_0x2f7b85[_0xf155('0x5f')]['to'][0x0],'phone':_0x2f7b85['body']['to'][0x0],'fax':_0x2f7b85[_0xf155('0x5f')]['to'][0x0],'ListId':_0x284b91[_0xf155('0xb7')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf155('0xb8'));}})[_0xf155('0x24')](function(_0x3b9dec){if(_0x3b9dec){return db[_0xf155('0x73')][_0xf155('0x5d')]({'where':{'ContactId':_0x3b9dec['id'],'closed':![],'FaxAccountId':_0x284b91['id']}})[_0xf155('0x24')](function(_0x12f834){if(_0x12f834){return[_0x12f834,![]];}return db['FaxInteraction'][_0xf155('0x5e')]({'UserId':_0x2f7b85['user']['id'],'ContactId':_0x3b9dec['id'],'FaxAccountId':_0x284b91['id'],'fax':_0x2f7b85[_0xf155('0x5f')]['to'][0x0],'firstMsgDirection':_0xf155('0xb9'),'Messages':[_[_0xf155('0x54')](_0x2f7b85[_0xf155('0x5f')],{'read':![],'body':_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][0x0]['filename'],'FaxAccountId':_0x284b91['id'],'UserId':_0x2f7b85[_0xf155('0x60')]['id'],'ContactId':_0x3b9dec['id'],'AttachmentId':_0x2f7b85['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xf155('0xba')}]})[_0xf155('0x24')](function(_0x2e8a0c){return[_0x2e8a0c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf155('0xbb')](function(_0x28fc6f,_0xf82fa2){if(_0xf82fa2){return _0x28fc6f;}return db[_0xf155('0xaa')]['create']({'direction':_0xf155('0xb9'),'read':![],'body':_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][0x0][_0xf155('0xbc')],'FaxAccountId':_0x284b91['id'],'FaxInteractionId':_0x28fc6f['id'],'UserId':_0x2f7b85[_0xf155('0x60')]['id'],'ContactId':_0x28fc6f[_0xf155('0xbd')],'AttachmentId':_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][0x0]['id']})['then'](function(_0x33b979){_0x28fc6f[_0xf155('0xbe')][_0xf155('0xba')]=[];_0x28fc6f['dataValues'][_0xf155('0xba')][_0xf155('0x91')](_0x33b979[_0xf155('0xbe')]);return _0x28fc6f;});})[_0xf155('0x24')](function(_0x2d2628){respondWithRpcPromise(_0xf155('0xbf'),'SendFax',{'FaxAccountId':_[_0xf155('0xb2')](_0x2f7b85['params']['id'])?undefined:_0x2f7b85[_0xf155('0x63')]['id'],'path':_[_0xf155('0xb2')](_0x2f7b85[_0xf155('0x5f')][_0xf155('0xae')][0x0]['path'])?undefined:_0x2f7b85[_0xf155('0x5f')]['attachments'][0x0]['path'],'fax':_[_0xf155('0xb2')](_0x2f7b85['body']['to'][0x0])?undefined:_0x2f7b85['body']['to'][0x0],'AttachmentId':_0x2f7b85[_0xf155('0x5f')]['attachments'][0x0]['id']},client9002)[_0xf155('0x24')](function(_0x59ec43){logger['info']('SendFaxRpc,\x20%s',_0x59ec43);})[_0xf155('0x2f')](function(_0x2bff9e){logger['info']('SendFaxRpc,\x20%s',_0x2bff9e);});return _0x2d2628;})['then'](respondWithResult(_0x1e9434,null))['catch'](handleError(_0x1e9434,null));};exports[_0xf155('0xc0')]=function(_0x26fd10,_0x543976,_0x324fa2){return db['FaxAccount'][_0xf155('0x5d')]({'where':{'id':_0x26fd10[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0x543976,null))[_0xf155('0x24')](function(_0x291706){if(_0x291706){return _0x291706['addAgents'](_0x26fd10[_0xf155('0x5f')][_0xf155('0x6d')],_[_0xf155('0x75')](_0x26fd10[_0xf155('0x5f')],[_0xf155('0x6d'),'id'])||{})['spread'](function(_0x235b2b){for(var _0xffce23=0x0;_0xffce23<_0x26fd10[_0xf155('0x5f')][_0xf155('0x6d')]['length'];_0xffce23+=0x1){socket[_0xf155('0xc1')](_0xf155('0xc2'),{'UserId':Number(_0x26fd10[_0xf155('0x5f')]['ids'][_0xffce23]),'FaxAccountId':Number(_0x26fd10[_0xf155('0x63')]['id'])});}return _0x235b2b;});}})[_0xf155('0x24')](respondWithResult(_0x543976,null))[_0xf155('0x2f')](handleError(_0x543976,null));};exports[_0xf155('0xc3')]=function(_0x158025,_0xd284bb,_0x325e79){return db[_0xf155('0x44')]['find']({'where':{'id':_0x158025[_0xf155('0x63')]['id']}})[_0xf155('0x24')](handleEntityNotFound(_0xd284bb,null))[_0xf155('0x24')](function(_0x2e97eb){if(_0x2e97eb){return _0x2e97eb['removeAgents'](_0x158025['query'][_0xf155('0x6d')])[_0xf155('0x24')](function(){if(_['isArray'](_0x158025[_0xf155('0x49')][_0xf155('0x6d')])){for(var _0x38c180=0x0;_0x38c180<_0x158025[_0xf155('0x49')][_0xf155('0x6d')][_0xf155('0x6a')];_0x38c180+=0x1){socket[_0xf155('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x158025[_0xf155('0x49')][_0xf155('0x6d')][_0x38c180]),'FaxAccountId':Number(_0x158025[_0xf155('0x63')]['id'])});}}else{socket[_0xf155('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x158025[_0xf155('0x49')]['ids']),'FaxAccountId':Number(_0x158025[_0xf155('0x63')]['id'])});}});}})[_0xf155('0x24')](respondWithStatusCode(_0xd284bb,null))['catch'](handleError(_0xd284bb,null));};exports[_0xf155('0xc4')]=function(_0x24c6ec,_0x4e45e3,_0x438184){var _0x35ba67={};var _0xe2af3d={};var _0x26c3f2;var _0x35e84b;return db[_0xf155('0x44')]['findOne']({'where':{'id':_0x24c6ec[_0xf155('0x63')]['id']}})['then'](handleEntityNotFound(_0x4e45e3,null))[_0xf155('0x24')](function(_0x2d91e1){if(_0x2d91e1){_0x26c3f2=_0x2d91e1;_0xe2af3d[_0xf155('0x48')]=_[_0xf155('0x4a')](db['User'][_0xf155('0x45')]);_0xe2af3d[_0xf155('0x49')]=_[_0xf155('0x4a')](_0x24c6ec['query']);_0xe2af3d[_0xf155('0x4b')]=_['intersection'](_0xe2af3d[_0xf155('0x48')],_0xe2af3d['query']);_0x35ba67['attributes']=_[_0xf155('0x4c')](_0xe2af3d[_0xf155('0x48')],qs[_0xf155('0x4e')](_0x24c6ec[_0xf155('0x49')][_0xf155('0x4e')]));_0x35ba67[_0xf155('0x4d')]=_0x35ba67[_0xf155('0x4d')][_0xf155('0x6a')]?_0x35ba67[_0xf155('0x4d')]:_0xe2af3d[_0xf155('0x48')];_0x35ba67[_0xf155('0x51')]=qs[_0xf155('0x52')](_0x24c6ec['query'][_0xf155('0x52')]);_0x35ba67[_0xf155('0x53')]=qs[_0xf155('0x4b')](_[_0xf155('0x71')](_0x24c6ec['query'],_0xe2af3d['filters']));if(_0x24c6ec['query']['filter']){_0x35ba67[_0xf155('0x53')]=_[_0xf155('0x54')](_0x35ba67[_0xf155('0x53')],{'$or':_[_0xf155('0x43')](_0x35ba67[_0xf155('0x4d')],function(_0x59e81f){var _0x25c11a={};_0x25c11a[_0x59e81f]={'$like':'%'+_0x24c6ec[_0xf155('0x49')][_0xf155('0x56')]+'%'};return _0x25c11a;})});}_0x35ba67=_[_0xf155('0x54')]({},_0x35ba67,_0x24c6ec['options']);return _0x26c3f2[_0xf155('0xc4')](_0x35ba67);}})['then'](function(_0x477203){if(_0x477203){_0x35e84b=_0x477203[_0xf155('0x6a')];if(!_0x24c6ec[_0xf155('0x49')][_0xf155('0x4f')](_0xf155('0x50'))){_0x35ba67['limit']=qs[_0xf155('0x36')](_0x24c6ec['query'][_0xf155('0x36')]);_0x35ba67[_0xf155('0x34')]=qs[_0xf155('0x34')](_0x24c6ec['query'][_0xf155('0x34')]);}return _0x26c3f2[_0xf155('0xc4')](_0x35ba67);}})['then'](function(_0xa5ffb7){if(_0xa5ffb7){return _0xa5ffb7?{'count':_0x35e84b,'rows':_0xa5ffb7}:null;}})[_0xf155('0x24')](respondWithResult(_0x4e45e3,null))[_0xf155('0x2f')](handleError(_0x4e45e3,null));}; \ No newline at end of file +var _0x5161=['register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','Pause','params','describe','FaxAccountId','Disposition','getDispositions','findOne','length','hasOwnProperty','nolimit','sort','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','Contact','User','Owner','fullname','Tags','color','tag','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','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','sequelize','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','CmList','CmContact','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket'];(function(_0x3ed384,_0x4560e4){var _0x337eab=function(_0x552d24){while(--_0x552d24){_0x3ed384['push'](_0x3ed384['shift']());}};_0x337eab(++_0x4560e4);}(_0x5161,0x179));var _0x1516=function(_0x2b5076,_0x3a4a2d){_0x2b5076=_0x2b5076-0x0;var _0x169ee1=_0x5161[_0x2b5076];return _0x169ee1;};'use strict';var emlformat=require(_0x1516('0x0'));var rimraf=require(_0x1516('0x1'));var zipdir=require(_0x1516('0x2'));var jsonpatch=require(_0x1516('0x3'));var rp=require(_0x1516('0x4'));var moment=require(_0x1516('0x5'));var BPromise=require(_0x1516('0x6'));var Mustache=require(_0x1516('0x7'));var util=require(_0x1516('0x8'));var path=require(_0x1516('0x9'));var sox=require(_0x1516('0xa'));var csv=require(_0x1516('0xb'));var ejs=require(_0x1516('0xc'));var fs=require('fs');var fs_extra=require(_0x1516('0xd'));var _=require(_0x1516('0xe'));var squel=require(_0x1516('0xf'));var crypto=require(_0x1516('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1516('0xb'));var querystring=require(_0x1516('0x11'));var Papa=require(_0x1516('0x12'));var Redis=require(_0x1516('0x13'));var authService=require(_0x1516('0x14'));var qs=require(_0x1516('0x15'));var as=require(_0x1516('0x16'));var hardwareService=require(_0x1516('0x17'));var logger=require(_0x1516('0x18'))(_0x1516('0x19'));var utils=require(_0x1516('0x1a'));var config=require(_0x1516('0x1b'));var licenseUtil=require(_0x1516('0x1c'));var db=require('../../mysqldb')['db'];config[_0x1516('0x1d')]=_[_0x1516('0x1e')](config[_0x1516('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x1516('0x1f'))(new Redis(config['redis']));require(_0x1516('0x20'))[_0x1516('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1516('0x22')][_0x1516('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x1516('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4f4a61,_0x37a209,_0x58c47f,_0x3921a5){return new BPromise(function(_0x3c9db4,_0x218043){var _0x205068=_0x3921a5||client;return _0x205068[_0x1516('0x24')](_0x4f4a61,_0x58c47f)[_0x1516('0x25')](function(_0x27ec51){logger[_0x1516('0x26')](_0x1516('0x27'),_0x37a209,'request\x20sent');logger[_0x1516('0x28')](_0x1516('0x29'),_0x37a209,_0x1516('0x2a'),JSON[_0x1516('0x2b')](_0x27ec51));if(_0x27ec51[_0x1516('0x2c')]){if(_0x27ec51[_0x1516('0x2c')]['code']===0x1f4){logger['error'](_0x1516('0x27'),_0x37a209,_0x27ec51[_0x1516('0x2c')][_0x1516('0x2d')]);return _0x218043(_0x27ec51[_0x1516('0x2c')][_0x1516('0x2d')]);}logger[_0x1516('0x2c')](_0x1516('0x27'),_0x37a209,_0x27ec51[_0x1516('0x2c')]['message']);return _0x3c9db4(_0x27ec51['error']['message']);}else{logger[_0x1516('0x26')](_0x1516('0x27'),_0x37a209,_0x1516('0x2a'));_0x3c9db4(_0x27ec51[_0x1516('0x2e')]['message']);}})[_0x1516('0x2f')](function(_0x267bca){logger[_0x1516('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x37a209,_0x267bca);_0x218043(_0x267bca);});});}function respondWithStatusCode(_0x3b8e56,_0x3bb565){_0x3bb565=_0x3bb565||0xcc;return function(_0x1489aa){if(_0x1489aa){return _0x3b8e56[_0x1516('0x30')](_0x3bb565);}return _0x3b8e56[_0x1516('0x31')](_0x3bb565)[_0x1516('0x32')]();};}function respondWithResult(_0x151776,_0x148d14){_0x148d14=_0x148d14||0xc8;return function(_0x21a9f2){if(_0x21a9f2){return _0x151776[_0x1516('0x31')](_0x148d14)[_0x1516('0x33')](_0x21a9f2);}};}function respondWithFilteredResult(_0x48a456,_0x5a4204){return function(_0x1a58ac){if(_0x1a58ac){var _0x114a61=typeof _0x5a4204[_0x1516('0x34')]==='undefined'&&typeof _0x5a4204['limit']===_0x1516('0x35');var _0x4c25f1=_0x1a58ac[_0x1516('0x36')];var _0x5a991b=_0x114a61?0x0:_0x5a4204[_0x1516('0x34')];var _0x2787f7=_0x114a61?_0x1a58ac[_0x1516('0x36')]:_0x5a4204[_0x1516('0x34')]+_0x5a4204[_0x1516('0x37')];var _0x16d61a;if(_0x2787f7>=_0x4c25f1){_0x2787f7=_0x4c25f1;_0x16d61a=0xc8;}else{_0x16d61a=0xce;}_0x48a456[_0x1516('0x31')](_0x16d61a);return _0x48a456[_0x1516('0x38')](_0x1516('0x39'),_0x5a991b+'-'+_0x2787f7+'/'+_0x4c25f1)[_0x1516('0x33')](_0x1a58ac);}return null;};}function patchUpdates(_0x2d346e){return function(_0x2e18b7){try{jsonpatch['apply'](_0x2e18b7,_0x2d346e,!![]);}catch(_0x12f557){return BPromise[_0x1516('0x3a')](_0x12f557);}return _0x2e18b7[_0x1516('0x3b')]();};}function saveUpdates(_0x186e9b,_0x7dd83){return function(_0x2aa94e){if(_0x2aa94e){return _0x2aa94e['update'](_0x186e9b)[_0x1516('0x25')](function(_0x15a85d){return _0x15a85d;});}return null;};}function removeEntity(_0xd7e292,_0x29d4d7){return function(_0x14e565){if(_0x14e565){return _0x14e565[_0x1516('0x3c')]()[_0x1516('0x25')](function(){var _0x527ef7=_0x14e565[_0x1516('0x3d')]({'plain':!![]});var _0x3a560e=_0x1516('0x3e');return db[_0x1516('0x3f')][_0x1516('0x3c')]({'where':{'type':_0x3a560e,'resourceId':_0x527ef7['id']}})[_0x1516('0x25')](function(){return _0x14e565;});})[_0x1516('0x25')](function(){_0xd7e292[_0x1516('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x546b73,_0xa3c6f9){return function(_0x2402da){if(!_0x2402da){_0x546b73[_0x1516('0x30')](0x194);}return _0x2402da;};}function handleError(_0x2f3c8f,_0x5cb779){_0x5cb779=_0x5cb779||0x1f4;return function(_0x4d7ee){logger[_0x1516('0x2c')](_0x4d7ee[_0x1516('0x40')]);if(_0x4d7ee[_0x1516('0x41')]){delete _0x4d7ee['name'];}_0x2f3c8f[_0x1516('0x31')](_0x5cb779)[_0x1516('0x42')](_0x4d7ee);};}exports[_0x1516('0x43')]=function(_0x331537,_0x55b193){var _0x20080f={'include':[{'model':db['Pause'],'as':_0x1516('0x44')}]},_0x3aa8e3={},_0x9ea83e={'count':0x0,'rows':[]};var _0x5b8a9e=_[_0x1516('0x45')](db[_0x1516('0x46')][_0x1516('0x47')],function(_0x432337){return{'name':_0x432337[_0x1516('0x48')],'type':_0x432337[_0x1516('0x49')][_0x1516('0x4a')]};});_0x3aa8e3[_0x1516('0x4b')]=_[_0x1516('0x45')](_0x5b8a9e,'name');_0x3aa8e3[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x331537['query']);_0x3aa8e3[_0x1516('0x4e')]=_[_0x1516('0x4f')](_0x3aa8e3[_0x1516('0x4b')],_0x3aa8e3['query']);_0x20080f[_0x1516('0x50')]=_['intersection'](_0x3aa8e3[_0x1516('0x4b')],qs[_0x1516('0x51')](_0x331537[_0x1516('0x4c')][_0x1516('0x51')]));_0x20080f[_0x1516('0x50')]=_0x20080f[_0x1516('0x50')]['length']?_0x20080f[_0x1516('0x50')]:_0x3aa8e3[_0x1516('0x4b')];if(!_0x331537[_0x1516('0x4c')]['hasOwnProperty']('nolimit')){_0x20080f[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x331537[_0x1516('0x4c')][_0x1516('0x37')]);_0x20080f['offset']=qs[_0x1516('0x34')](_0x331537[_0x1516('0x4c')]['offset']);}_0x20080f[_0x1516('0x52')]=qs['sort'](_0x331537['query']['sort']);_0x20080f[_0x1516('0x53')]=qs[_0x1516('0x4e')](_[_0x1516('0x54')](_0x331537[_0x1516('0x4c')],_0x3aa8e3[_0x1516('0x4e')]),_0x5b8a9e);if(_0x331537[_0x1516('0x4c')][_0x1516('0x55')]){_0x20080f[_0x1516('0x53')]=_[_0x1516('0x56')](_0x20080f['where'],{'$or':_[_0x1516('0x45')](_0x5b8a9e,function(_0x2c0a92){if(_0x2c0a92[_0x1516('0x49')]!==_0x1516('0x57')){var _0x231275={};_0x231275[_0x2c0a92[_0x1516('0x41')]]={'$like':'%'+_0x331537[_0x1516('0x4c')][_0x1516('0x55')]+'%'};return _0x231275;}})});}_0x20080f=_[_0x1516('0x56')]({},_0x20080f,_0x331537[_0x1516('0x58')]);var _0x8c1bbe={'where':_0x20080f[_0x1516('0x53')]};return db[_0x1516('0x46')][_0x1516('0x36')](_0x8c1bbe)['then'](function(_0x177bf6){_0x9ea83e['count']=_0x177bf6;if(_0x331537[_0x1516('0x4c')]['includeAll']){_0x20080f[_0x1516('0x59')]=[{'all':!![]}];}return db[_0x1516('0x46')][_0x1516('0x5a')](_0x20080f);})[_0x1516('0x25')](function(_0xb06dfa){_0x9ea83e[_0x1516('0x5b')]=_0xb06dfa;return _0x9ea83e;})['then'](respondWithFilteredResult(_0x55b193,_0x20080f))['catch'](handleError(_0x55b193,null));};exports['show']=function(_0x29c9db,_0x314f1c){var _0xd2a914={'raw':![],'where':{'id':_0x29c9db['params']['id']},'include':[{'model':db['Pause'],'as':_0x1516('0x44')}]},_0x4ab397={};_0x4ab397[_0x1516('0x4b')]=_[_0x1516('0x4d')](db[_0x1516('0x46')][_0x1516('0x47')]);_0x4ab397[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x29c9db[_0x1516('0x4c')]);_0x4ab397[_0x1516('0x4e')]=_[_0x1516('0x4f')](_0x4ab397[_0x1516('0x4b')],_0x4ab397[_0x1516('0x4c')]);_0xd2a914[_0x1516('0x50')]=_[_0x1516('0x4f')](_0x4ab397[_0x1516('0x4b')],qs[_0x1516('0x51')](_0x29c9db['query']['fields']));_0xd2a914[_0x1516('0x50')]=_0xd2a914[_0x1516('0x50')]['length']?_0xd2a914[_0x1516('0x50')]:_0x4ab397['model'];if(_0x29c9db[_0x1516('0x4c')][_0x1516('0x5c')]){_0xd2a914[_0x1516('0x59')]=[{'all':!![]}];}_0xd2a914=_[_0x1516('0x56')]({},_0xd2a914,_0x29c9db[_0x1516('0x58')]);return db[_0x1516('0x46')][_0x1516('0x5d')](_0xd2a914)[_0x1516('0x25')](handleEntityNotFound(_0x314f1c,null))[_0x1516('0x25')](respondWithResult(_0x314f1c,null))[_0x1516('0x2f')](handleError(_0x314f1c,null));};exports['create']=function(_0x4a9133,_0x5ddac7){return db[_0x1516('0x46')][_0x1516('0x5e')](_0x4a9133['body'],{})[_0x1516('0x25')](function(_0x115a04){var _0x4ec5ca=_0x4a9133['user'][_0x1516('0x3d')]({'plain':!![]});if(!_0x4ec5ca)throw new Error(_0x1516('0x5f'));if(_0x4ec5ca[_0x1516('0x60')]===_0x1516('0x61')){var _0x44ca05=_0x115a04['get']({'plain':!![]});var _0x25e129=_0x1516('0x3e');return db[_0x1516('0x62')][_0x1516('0x5d')]({'where':{'name':_0x25e129,'userProfileId':_0x4ec5ca[_0x1516('0x63')]},'raw':!![]})[_0x1516('0x25')](function(_0x553075){if(_0x553075&&_0x553075[_0x1516('0x64')]===0x0){return db[_0x1516('0x3f')][_0x1516('0x5e')]({'name':_0x44ca05[_0x1516('0x41')],'resourceId':_0x44ca05['id'],'type':_0x553075['name'],'sectionId':_0x553075['id']},{})[_0x1516('0x25')](function(){return _0x115a04;});}else{return _0x115a04;}})[_0x1516('0x2f')](function(_0x277c83){logger[_0x1516('0x2c')](_0x1516('0x65'),_0x277c83);throw _0x277c83;});}return _0x115a04;})[_0x1516('0x25')](respondWithResult(_0x5ddac7,0xc9))[_0x1516('0x2f')](handleError(_0x5ddac7,null));};exports[_0x1516('0x66')]=function(_0x3478de,_0x341c20){if(_0x3478de[_0x1516('0x67')]['id']){delete _0x3478de[_0x1516('0x67')]['id'];}return db[_0x1516('0x46')]['find']({'where':{'id':_0x3478de['params']['id']},'include':[{'model':db[_0x1516('0x68')],'as':_0x1516('0x44')}]})[_0x1516('0x25')](handleEntityNotFound(_0x341c20,null))['then'](saveUpdates(_0x3478de[_0x1516('0x67')],null))[_0x1516('0x25')](respondWithResult(_0x341c20,null))[_0x1516('0x2f')](handleError(_0x341c20,null));};exports[_0x1516('0x3c')]=function(_0xe2bedf,_0x4a4a04){return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0xe2bedf[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x4a4a04,null))[_0x1516('0x25')](removeEntity(_0x4a4a04,null))['catch'](handleError(_0x4a4a04,null));};exports[_0x1516('0x6a')]=function(_0x3c6a16,_0x4d4e2b){return db[_0x1516('0x46')][_0x1516('0x6a')]()[_0x1516('0x25')](respondWithResult(_0x4d4e2b,null))[_0x1516('0x2f')](handleError(_0x4d4e2b,null));};exports['addDisposition']=function(_0x3bcafe,_0x462ebe,_0x3ea24f){if(_0x3bcafe[_0x1516('0x67')]['id']){delete _0x3bcafe[_0x1516('0x67')]['id'];}return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0x3bcafe[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x462ebe,null))['then'](function(_0x3f425c){if(_0x3f425c){_0x3bcafe['body'][_0x1516('0x6b')]=_0x3f425c['id'];return db[_0x1516('0x6c')][_0x1516('0x5e')](_0x3bcafe['body']);}})[_0x1516('0x25')](respondWithResult(_0x462ebe,null))[_0x1516('0x2f')](handleError(_0x462ebe,null));};exports[_0x1516('0x6d')]=function(_0x2d85ef,_0x38be1e,_0x5b9c2a){var _0x494713={'raw':![],'where':{}};var _0x7f793e={};var _0x198172={'count':0x0,'rows':[]};return db[_0x1516('0x46')][_0x1516('0x6e')]({'where':{'id':_0x2d85ef[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x38be1e,null))[_0x1516('0x25')](function(_0x1311e4){if(_0x1311e4){_0x7f793e[_0x1516('0x4b')]=_[_0x1516('0x4d')](db[_0x1516('0x6c')]['rawAttributes']);_0x7f793e[_0x1516('0x4c')]=_['keys'](_0x2d85ef[_0x1516('0x4c')]);_0x7f793e[_0x1516('0x4e')]=_[_0x1516('0x4f')](_0x7f793e[_0x1516('0x4b')],_0x7f793e[_0x1516('0x4c')]);_0x494713['attributes']=_[_0x1516('0x4f')](_0x7f793e[_0x1516('0x4b')],qs['fields'](_0x2d85ef['query'][_0x1516('0x51')]));_0x494713[_0x1516('0x50')]=_0x494713[_0x1516('0x50')][_0x1516('0x6f')]?_0x494713[_0x1516('0x50')]:_0x7f793e[_0x1516('0x4b')];if(!_0x2d85ef[_0x1516('0x4c')][_0x1516('0x70')](_0x1516('0x71'))){_0x494713[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x2d85ef[_0x1516('0x4c')]['limit']);_0x494713['offset']=qs['offset'](_0x2d85ef['query'][_0x1516('0x34')]);}_0x494713[_0x1516('0x52')]=qs[_0x1516('0x72')](_0x2d85ef['query'][_0x1516('0x72')]);_0x494713['where']=qs[_0x1516('0x4e')](_['pick'](_0x2d85ef[_0x1516('0x4c')],_0x7f793e[_0x1516('0x4e')]));_0x494713['where'][_0x1516('0x6b')]=_0x1311e4['id'];if(_0x2d85ef[_0x1516('0x4c')][_0x1516('0x55')]){_0x494713[_0x1516('0x53')]=_['merge'](_0x494713[_0x1516('0x53')],{'$or':_['map'](_0x494713[_0x1516('0x50')],function(_0x440398){var _0x1c7647={};_0x1c7647[_0x440398]={'$like':'%'+_0x2d85ef[_0x1516('0x4c')]['filter']+'%'};return _0x1c7647;})});}_0x494713=_[_0x1516('0x56')]({},_0x494713,_0x2d85ef[_0x1516('0x58')]);return db[_0x1516('0x6c')][_0x1516('0x36')]({'where':_0x494713[_0x1516('0x53')]})[_0x1516('0x25')](function(_0x43f70e){_0x198172[_0x1516('0x36')]=_0x43f70e;if(_0x2d85ef[_0x1516('0x4c')][_0x1516('0x5c')]){_0x494713[_0x1516('0x59')]=[{'all':!![]}];}return db[_0x1516('0x6c')][_0x1516('0x5a')](_0x494713);})[_0x1516('0x25')](function(_0x2bebbe){_0x198172[_0x1516('0x5b')]=_0x2bebbe;return _0x198172;});}})['then'](respondWithFilteredResult(_0x38be1e,_0x494713))[_0x1516('0x2f')](handleError(_0x38be1e,null));};exports['removeDispositions']=function(_0x354f53,_0x263aa3,_0x2b95cb){return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0x354f53['params']['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x263aa3,null))['then'](function(_0x4ee67d){if(_0x4ee67d){return _0x4ee67d['removeDispositions'](_0x354f53['query']['ids']);}})['then'](respondWithStatusCode(_0x263aa3,null))['catch'](handleError(_0x263aa3,null));};exports[_0x1516('0x73')]=function(_0xb0eb97,_0x16c1ce,_0x38edd0){if(_0xb0eb97[_0x1516('0x67')]['id']){delete _0xb0eb97['body']['id'];}return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0xb0eb97[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x16c1ce,null))[_0x1516('0x25')](function(_0x37ea9a){if(_0x37ea9a){_0xb0eb97['body'][_0x1516('0x6b')]=_0x37ea9a['id'];return db[_0x1516('0x74')]['create'](_0xb0eb97['body']);}})[_0x1516('0x25')](respondWithResult(_0x16c1ce,null))['catch'](handleError(_0x16c1ce,null));};exports[_0x1516('0x75')]=function(_0x486c90,_0x2966bb,_0x3ed65f){var _0x379325={'raw':![],'where':{}};var _0xcdc3e9={};var _0x286944={'count':0x0,'rows':[]};return db[_0x1516('0x46')][_0x1516('0x6e')]({'where':{'id':_0x486c90[_0x1516('0x69')]['id']}})['then'](handleEntityNotFound(_0x2966bb,null))[_0x1516('0x25')](function(_0x23eb96){if(_0x23eb96){_0xcdc3e9[_0x1516('0x4b')]=_[_0x1516('0x4d')](db[_0x1516('0x74')][_0x1516('0x47')]);_0xcdc3e9[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x486c90['query']);_0xcdc3e9['filters']=_[_0x1516('0x4f')](_0xcdc3e9[_0x1516('0x4b')],_0xcdc3e9['query']);_0x379325[_0x1516('0x50')]=_[_0x1516('0x4f')](_0xcdc3e9[_0x1516('0x4b')],qs['fields'](_0x486c90['query'][_0x1516('0x51')]));_0x379325['attributes']=_0x379325['attributes'][_0x1516('0x6f')]?_0x379325[_0x1516('0x50')]:_0xcdc3e9[_0x1516('0x4b')];if(!_0x486c90[_0x1516('0x4c')][_0x1516('0x70')](_0x1516('0x71'))){_0x379325['limit']=qs[_0x1516('0x37')](_0x486c90['query'][_0x1516('0x37')]);_0x379325[_0x1516('0x34')]=qs['offset'](_0x486c90[_0x1516('0x4c')][_0x1516('0x34')]);}_0x379325[_0x1516('0x52')]=qs[_0x1516('0x72')](_0x486c90[_0x1516('0x4c')][_0x1516('0x72')]);_0x379325['where']=qs[_0x1516('0x4e')](_[_0x1516('0x54')](_0x486c90['query'],_0xcdc3e9[_0x1516('0x4e')]));_0x379325['where'][_0x1516('0x6b')]=_0x23eb96['id'];if(_0x486c90['query'][_0x1516('0x55')]){_0x379325['where']=_[_0x1516('0x56')](_0x379325[_0x1516('0x53')],{'$or':_[_0x1516('0x45')](_0x379325['attributes'],function(_0x255145){var _0x118ef0={};_0x118ef0[_0x255145]={'$like':'%'+_0x486c90[_0x1516('0x4c')][_0x1516('0x55')]+'%'};return _0x118ef0;})});}_0x379325=_['merge']({},_0x379325,_0x486c90[_0x1516('0x58')]);return db[_0x1516('0x74')][_0x1516('0x36')]({'where':_0x379325[_0x1516('0x53')]})[_0x1516('0x25')](function(_0x5cd59a){_0x286944[_0x1516('0x36')]=_0x5cd59a;if(_0x486c90['query'][_0x1516('0x5c')]){_0x379325[_0x1516('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1516('0x5a')](_0x379325);})[_0x1516('0x25')](function(_0x307fed){_0x286944[_0x1516('0x5b')]=_0x307fed;return _0x286944;});}})[_0x1516('0x25')](respondWithFilteredResult(_0x2966bb,_0x379325))[_0x1516('0x2f')](handleError(_0x2966bb,null));};exports[_0x1516('0x76')]=function(_0x108e9e,_0x3bae16,_0x2187cd){return db[_0x1516('0x46')]['find']({'where':{'id':_0x108e9e['params']['id']}})['then'](handleEntityNotFound(_0x3bae16,null))[_0x1516('0x25')](function(_0x598d22){if(_0x598d22){return _0x598d22[_0x1516('0x76')](_0x108e9e[_0x1516('0x4c')][_0x1516('0x77')]);}})[_0x1516('0x25')](respondWithStatusCode(_0x3bae16,null))['catch'](handleError(_0x3bae16,null));};exports[_0x1516('0x78')]=function(_0xc5c583,_0x5e3f28,_0x508a0f){return db[_0x1516('0x79')][_0x1516('0x5d')]({'where':{'id':_0xc5c583[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x5e3f28,null))[_0x1516('0x25')](function(_0x29b1d5){if(_0x29b1d5){return _0x29b1d5[_0x1516('0x78')](_0xc5c583[_0x1516('0x67')][_0x1516('0x77')],_[_0x1516('0x7a')](_0xc5c583[_0x1516('0x67')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e3f28,null))[_0x1516('0x2f')](handleError(_0x5e3f28,null));};exports['getInteractions']=function(_0x478504,_0x4755d3,_0x38bce2){var _0x5351a0={'raw':![],'where':{}};var _0x41630e={};var _0x3d1219={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x478504['params']['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x4755d3,null))[_0x1516('0x25')](function(_0x27e7e9){if(_0x27e7e9){_0x41630e[_0x1516('0x4b')]=_[_0x1516('0x4d')](db[_0x1516('0x79')][_0x1516('0x47')]);_0x41630e['query']=_['keys'](_0x478504[_0x1516('0x4c')]);_0x41630e['filters']=_['intersection'](_0x41630e[_0x1516('0x4b')],_0x41630e[_0x1516('0x4c')]);_0x5351a0[_0x1516('0x50')]=_[_0x1516('0x4f')](_0x41630e[_0x1516('0x4b')],qs[_0x1516('0x51')](_0x478504[_0x1516('0x4c')][_0x1516('0x51')]));_0x5351a0[_0x1516('0x50')]=_0x5351a0[_0x1516('0x50')][_0x1516('0x6f')]?_0x5351a0[_0x1516('0x50')]:_0x41630e[_0x1516('0x4b')];if(!_0x478504[_0x1516('0x4c')][_0x1516('0x70')]('nolimit')){_0x5351a0[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x478504['query'][_0x1516('0x37')]);_0x5351a0[_0x1516('0x34')]=qs[_0x1516('0x34')](_0x478504[_0x1516('0x4c')][_0x1516('0x34')]);}_0x5351a0[_0x1516('0x52')]=qs['sort'](_0x478504[_0x1516('0x4c')][_0x1516('0x72')]);_0x5351a0['where']=qs[_0x1516('0x4e')](_['pick'](_0x478504[_0x1516('0x4c')],_0x41630e['filters']));_0x5351a0[_0x1516('0x53')][_0x1516('0x6b')]=_0x27e7e9['id'];if(_0x478504[_0x1516('0x4c')][_0x1516('0x55')]){_0x5351a0[_0x1516('0x53')]=_[_0x1516('0x56')](_0x5351a0[_0x1516('0x53')],{'$or':_[_0x1516('0x45')](_0x5351a0[_0x1516('0x50')],function(_0x3b7150){var _0x1adf57={};_0x1adf57[_0x3b7150]={'$like':'%'+_0x478504[_0x1516('0x4c')]['filter']+'%'};return _0x1adf57;})});}_0x5351a0=_['merge']({},_0x5351a0,_0x478504[_0x1516('0x58')]);return db['FaxInteraction'][_0x1516('0x36')]({'where':_0x5351a0[_0x1516('0x53')]})['then'](function(_0x26eb1b){_0x3d1219['count']=_0x26eb1b;if(_0x478504[_0x1516('0x4c')][_0x1516('0x5c')]){_0x5351a0[_0x1516('0x59')]=[{'model':db['CmContact'],'as':_0x1516('0x7b'),'required':![]},{'model':db[_0x1516('0x7c')],'as':_0x1516('0x7d'),'attributes':[_0x1516('0x41'),_0x1516('0x7e'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x1516('0x7f'),'attributes':['id',_0x1516('0x41'),_0x1516('0x80')],'where':_0x478504[_0x1516('0x4c')][_0x1516('0x81')]?{'id':_0x478504[_0x1516('0x4c')][_0x1516('0x81')]}:undefined,'required':_0x478504['query'][_0x1516('0x81')]?!![]:![]}];}return db['FaxInteraction'][_0x1516('0x5a')](_0x5351a0);})['then'](function(_0x536ab7){_0x3d1219[_0x1516('0x5b')]=_0x536ab7;return _0x3d1219;});}})[_0x1516('0x25')](respondWithFilteredResult(_0x4755d3,_0x5351a0))[_0x1516('0x2f')](handleError(_0x4755d3,null));};exports[_0x1516('0x82')]=function(_0x551c03,_0xbcfcf0){var _0x35a7f8=_0x551c03[_0x1516('0x69')]['id'];var _0x56b391=_0x551c03['body'];var _0xd1aef9=0xc8;var _0x3eb69b=null;return db['sequelize'][_0x1516('0x83')]({'isolationLevel':db['sequelize']['Transaction'][_0x1516('0x84')][_0x1516('0x85')]},function(_0x57415c){return db[_0x1516('0x46')][_0x1516('0x6e')]({'where':{'id':_0x35a7f8},'transaction':_0x57415c})[_0x1516('0x25')](function(_0x4a13af){if(_0x4a13af){return db[_0x1516('0x86')][_0x1516('0x3c')]({'where':{'FaxAccountId':_0x35a7f8},'transaction':_0x57415c})['then'](function(){var _0x51ade5=_[_0x1516('0x45')](_0x56b391,function(_0x2a1535){_0x2a1535['FaxAccountId']=_0x35a7f8;return _0x2a1535;});return db[_0x1516('0x86')][_0x1516('0x87')](_0x51ade5,{'transaction':_0x57415c});});}else{_0xd1aef9=0x194;_0x3eb69b=[];}});})[_0x1516('0x25')](function(){if(_0xd1aef9!==0x194){return db[_0x1516('0x86')][_0x1516('0x88')]({'where':{'FaxAccountId':_0x35a7f8},'order':_0x1516('0x89')})[_0x1516('0x25')](function(_0x23ddca){_0x3eb69b=_0x23ddca;});}})[_0x1516('0x2f')](function(_0xacab3f){_0xd1aef9=0x1f4;logger[_0x1516('0x2c')](_0xacab3f[_0x1516('0x40')]);if(_0xacab3f[_0x1516('0x41')]){delete _0xacab3f[_0x1516('0x41')];}_0x3eb69b=_0xacab3f;})[_0x1516('0x8a')](function(){if(_0x3eb69b===null){_0xbcfcf0[_0x1516('0x30')](_0xd1aef9);}else{if(_0xd1aef9===0x1f4){_0xbcfcf0[_0x1516('0x31')](_0xd1aef9)[_0x1516('0x42')](_0x3eb69b);}else{_0xbcfcf0[_0x1516('0x31')](_0xd1aef9)['json'](_0x3eb69b);}}});};exports[_0x1516('0x8b')]=function(_0x3eb911,_0x5ed078,_0x4ac456){var _0x24de47={};var _0x22bfcd={};var _0x1b7e97;var _0x366d8c;return db['FaxAccount'][_0x1516('0x6e')]({'where':{'id':_0x3eb911[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x5ed078,null))['then'](function(_0xb6ac32){if(_0xb6ac32){_0x1b7e97=_0xb6ac32;_0x22bfcd['model']=_['keys'](db[_0x1516('0x86')][_0x1516('0x47')]);_0x22bfcd[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x3eb911[_0x1516('0x4c')]);_0x22bfcd[_0x1516('0x4e')]=_[_0x1516('0x4f')](_0x22bfcd[_0x1516('0x4b')],_0x22bfcd[_0x1516('0x4c')]);_0x24de47[_0x1516('0x50')]=_[_0x1516('0x4f')](_0x22bfcd[_0x1516('0x4b')],qs[_0x1516('0x51')](_0x3eb911['query'][_0x1516('0x51')]));_0x24de47[_0x1516('0x50')]=_0x24de47[_0x1516('0x50')][_0x1516('0x6f')]?_0x24de47[_0x1516('0x50')]:_0x22bfcd[_0x1516('0x4b')];_0x24de47[_0x1516('0x52')]=qs[_0x1516('0x72')](_0x3eb911[_0x1516('0x4c')]['sort']);_0x24de47[_0x1516('0x53')]=qs[_0x1516('0x4e')](_[_0x1516('0x54')](_0x3eb911[_0x1516('0x4c')],_0x22bfcd['filters']));if(_0x3eb911['query'][_0x1516('0x55')]){_0x24de47[_0x1516('0x53')]=_[_0x1516('0x56')](_0x24de47[_0x1516('0x53')],{'$or':_[_0x1516('0x45')](_0x24de47[_0x1516('0x50')],function(_0x587d17){var _0x53047b={};_0x53047b[_0x587d17]={'$like':'%'+_0x3eb911[_0x1516('0x4c')][_0x1516('0x55')]+'%'};return _0x53047b;})});}_0x24de47=_[_0x1516('0x56')]({},_0x24de47,_0x3eb911[_0x1516('0x58')]);return _0x1b7e97[_0x1516('0x8b')](_0x24de47);}})[_0x1516('0x25')](function(_0x28822f){if(_0x28822f){_0x366d8c=_0x28822f[_0x1516('0x6f')];if(!_0x3eb911[_0x1516('0x4c')][_0x1516('0x70')](_0x1516('0x71'))){_0x24de47[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x3eb911[_0x1516('0x4c')][_0x1516('0x37')]);_0x24de47[_0x1516('0x34')]=qs[_0x1516('0x34')](_0x3eb911[_0x1516('0x4c')]['offset']);}return _0x1b7e97[_0x1516('0x8b')](_0x24de47);}})[_0x1516('0x25')](function(_0x5988c5){if(_0x5988c5){return _0x5988c5?{'count':_0x366d8c,'rows':_0x5988c5}:null;}})[_0x1516('0x25')](respondWithResult(_0x5ed078,null))[_0x1516('0x2f')](handleError(_0x5ed078,null));};function Extension(_0x39d1ea,_0x5f1511,_0x428daf,_0x3dbdbb){this[_0x1516('0x8c')]='from-voip-provider';this[_0x1516('0x8d')]=_0x39d1ea['localstationid'];this[_0x1516('0x8e')]=_0x3dbdbb;this['type']=_0x1516('0x8f');this[_0x1516('0x90')]=_0x1516('0x91');this[_0x1516('0x6b')]=_0x39d1ea['id'];this['priority']=_0x5f1511;this[_0x1516('0x92')]=_0x428daf;}function createExtensionsReciveFax(_0x2d98ef){var _0x2559fa=0x1;var _0x3d39eb=[];_0x3d39eb[_0x1516('0x93')](new Extension(_0x2d98ef,_0x2559fa,'',_0x1516('0x94')));_0x2559fa+=0x1;_0x3d39eb[_0x1516('0x93')](new Extension(_0x2d98ef,_0x2559fa,_0x1516('0x95'),_0x1516('0x96')));_0x2559fa+=0x1;for(var _0x1a7f92 in _0x2d98ef){if(_0x2d98ef['hasOwnProperty'](_0x1a7f92)&&(_0x1a7f92===_0x1516('0x97')||_0x1a7f92===_0x1516('0x98')||_0x1a7f92===_0x1516('0x99')||_0x1a7f92===_0x1516('0x9a')||_0x1a7f92===_0x1516('0x9b')||_0x1a7f92===_0x1516('0x9c')||_0x1a7f92===_0x1516('0x9d')||_0x1a7f92===_0x1516('0x9e')||_0x1a7f92==='t38timeout')){_0x3d39eb[_0x1516('0x93')](new Extension(_0x2d98ef,_0x2559fa,_0x1516('0x9f')+_0x1a7f92+')='+_0x2d98ef[_0x1a7f92],_0x1516('0x96')));_0x2559fa+=0x1;}}_0x3d39eb[_0x1516('0x93')](new Extension(_0x2d98ef,_0x2559fa,'6',_0x1516('0xa0')));_0x2559fa+=0x1;_0x3d39eb[_0x1516('0x93')](new Extension(_0x2d98ef,_0x2559fa,_0x1516('0xa1'),_0x1516('0xa2')));_0x2559fa=0x0;return _0x3d39eb;}exports['addAccountApplications']=function(_0x115727,_0xa8a0b,_0x9cc58d){var _0x2a60a8;return db[_0x1516('0xa3')][_0x1516('0x83')](function(_0x5ad233){return db[_0x1516('0x46')][_0x1516('0x5e')](_0x115727[_0x1516('0x67')],{'transaction':_0x5ad233})[_0x1516('0x25')](function(_0x43b18c){_0x2a60a8=_0x43b18c[_0x1516('0x3d')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x2a60a8),{'transaction':_0x5ad233});});})[_0x1516('0x25')](function(){return _0x2a60a8;})[_0x1516('0x25')](respondWithResult(_0xa8a0b,null))[_0x1516('0x2f')](handleError(_0xa8a0b,null));};exports[_0x1516('0xa4')]=function(_0x1d4352,_0x404dda,_0x4dbe4d){var _0x54d721;return db[_0x1516('0xa3')]['transaction'](function(_0x575c8d){return db['FaxAccount']['update'](_0x1d4352[_0x1516('0x67')],{'where':{'id':_0x1d4352[_0x1516('0x67')]['id']},'transaction':_0x575c8d})['then'](function(_0xb58321){return db[_0x1516('0xa5')][_0x1516('0x3c')]({'where':{'FaxAccountId':_0x1d4352[_0x1516('0x67')]['id']},'transaction':_0x575c8d})['then'](function(_0x29f9a3){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x1516('0x7a')](_0x1d4352[_0x1516('0x67')],[_0x1516('0xa6'),_0x1516('0x4a'),_0x1516('0xa7'),_0x1516('0xa8'),_0x1516('0xa9'),_0x1516('0xaa')])),{'transaction':_0x575c8d});});});})[_0x1516('0x25')](function(){return db[_0x1516('0x46')]['findById'](_0x1d4352[_0x1516('0x67')]['id']);})[_0x1516('0x25')](respondWithResult(_0x404dda,null))[_0x1516('0x2f')](handleError(_0x404dda,null));};exports[_0x1516('0xab')]=function(_0x1d1ac3,_0x1e036a,_0x30ed1f){var _0x508aff={'raw':!![],'where':{}};var _0x88e7e7={};var _0x3ad2f4={'count':0x0,'rows':[]};return db[_0x1516('0x46')][_0x1516('0x6e')]({'where':{'id':_0x1d1ac3['params']['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x1e036a,null))[_0x1516('0x25')](function(_0x5553cb){if(_0x5553cb){_0x88e7e7[_0x1516('0x4b')]=_[_0x1516('0x4d')](db[_0x1516('0xac')][_0x1516('0x47')]);_0x88e7e7[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x1d1ac3['query']);_0x88e7e7['filters']=_['intersection'](_0x88e7e7['model'],_0x88e7e7['query']);_0x508aff[_0x1516('0x50')]=_[_0x1516('0x4f')](_0x88e7e7[_0x1516('0x4b')],qs[_0x1516('0x51')](_0x1d1ac3[_0x1516('0x4c')][_0x1516('0x51')]));_0x508aff['attributes']=_0x508aff[_0x1516('0x50')][_0x1516('0x6f')]?_0x508aff[_0x1516('0x50')]:_0x88e7e7[_0x1516('0x4b')];if(!_0x1d1ac3[_0x1516('0x4c')]['hasOwnProperty'](_0x1516('0x71'))){_0x508aff[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x1d1ac3[_0x1516('0x4c')]['limit']);_0x508aff[_0x1516('0x34')]=qs[_0x1516('0x34')](_0x1d1ac3['query']['offset']);}_0x508aff[_0x1516('0x52')]=qs[_0x1516('0x72')](_0x1d1ac3[_0x1516('0x4c')][_0x1516('0x72')]);_0x508aff[_0x1516('0x53')]=qs[_0x1516('0x4e')](_[_0x1516('0x54')](_0x1d1ac3[_0x1516('0x4c')],_0x88e7e7[_0x1516('0x4e')]));_0x508aff['where'][_0x1516('0x6b')]=_0x5553cb['id'];if(_0x1d1ac3[_0x1516('0x4c')][_0x1516('0x55')]){_0x508aff[_0x1516('0x53')]=_['merge'](_0x508aff[_0x1516('0x53')],{'$or':_[_0x1516('0x45')](_0x508aff[_0x1516('0x50')],function(_0x4bf8d6){var _0x3fcfb1={};_0x3fcfb1[_0x4bf8d6]={'$like':'%'+_0x1d1ac3[_0x1516('0x4c')][_0x1516('0x55')]+'%'};return _0x3fcfb1;})});}if(_0x1d1ac3[_0x1516('0x4c')][_0x1516('0xad')]){var _0x522a67=_0x1d1ac3[_0x1516('0x4c')][_0x1516('0xad')][_0x1516('0xae')](',');var _0xb5bf90={};_0xb5bf90[_0x522a67[0x0]]={'$gte':moment(_0x522a67[0x1])[_0x1516('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x508aff[_0x1516('0x53')]=_['merge'](_0x508aff[_0x1516('0x53')],_0xb5bf90);}_0x508aff=_['merge']({},_0x508aff,_0x1d1ac3[_0x1516('0x58')]);return db['FaxMessage'][_0x1516('0x36')]({'where':_0x508aff[_0x1516('0x53')]})[_0x1516('0x25')](function(_0x27d58e){_0x3ad2f4[_0x1516('0x36')]=_0x27d58e;if(_0x1d1ac3[_0x1516('0x4c')][_0x1516('0x5c')]){_0x508aff[_0x1516('0x59')]=[{'all':!![]}];}return db['FaxMessage'][_0x1516('0x5a')](_0x508aff);})[_0x1516('0x25')](function(_0x478c76){_0x3ad2f4[_0x1516('0x5b')]=_0x478c76;return _0x3ad2f4;});}})[_0x1516('0x25')](respondWithFilteredResult(_0x1e036a,_0x508aff))['catch'](handleError(_0x1e036a,null));};exports[_0x1516('0x42')]=function(_0x1d383f,_0x44a4c6,_0x4e8917){var _0x375cd8,_0x79e7cb={},_0x5f57ee;if(_0x1d383f[_0x1516('0x67')]['to']){_0x5f57ee=_0x1d383f[_0x1516('0x67')]['to'][0x0];}return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0x1d383f[_0x1516('0x69')]['id']},'include':[{'model':db[_0x1516('0xb0')],'as':'List','include':[{'model':db[_0x1516('0xb1')],'as':_0x1516('0xb2'),'where':{'fax':_0x5f57ee},'limit':0x1,'order':[[_0x1516('0xa8'),_0x1516('0xb3')]]}]}]})[_0x1516('0x25')](handleEntityNotFound(_0x44a4c6,null))[_0x1516('0x25')](function(_0x50db26){_0x375cd8=_0x50db26;if(_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')]&&_0x1d383f['body'][_0x1516('0xb4')][_0x1516('0x6f')]){for(var _0x3b3cf1=0x0;_0x3b3cf1<_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][_0x1516('0x6f')];_0x3b3cf1+=0x1){_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][_0x3b3cf1]={'filename':_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][_0x3b3cf1][_0x1516('0x41')],'id':_0x1d383f['body'][_0x1516('0xb4')][_0x3b3cf1]['id'],'path':path[_0x1516('0xb5')](config['root'],_0x1516('0xb6'),_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][_0x3b3cf1][_0x1516('0xb7')])};}}return respondWithRpcPromise(_0x1516('0xb8'),_0x1516('0xb8'),{'FaxAccountId':_[_0x1516('0xb9')](_0x1d383f[_0x1516('0x69')]['id'])?undefined:_0x1d383f[_0x1516('0x69')]['id'],'path':_['isNil'](_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][0x0][_0x1516('0x9')])?undefined:_0x1d383f['body'][_0x1516('0xb4')][0x0]['path'],'fax':_[_0x1516('0xb9')](_0x1d383f[_0x1516('0x67')]['to'][0x0])?undefined:_0x1d383f[_0x1516('0x67')]['to'][0x0]},client9002);})[_0x1516('0x25')](function(){if(_0x375cd8){if(_[_0x1516('0xb9')](_0x1d383f[_0x1516('0x67')][_0x1516('0xba')])){_0x1d383f[_0x1516('0x67')][_0x1516('0xba')]=util[_0x1516('0xaf')](_0x1516('0xbb'),_0x375cd8[_0x1516('0x41')],_0x375cd8['fax']);}if(_0x375cd8[_0x1516('0xbc')]){if(_0x375cd8[_0x1516('0xbc')][_0x1516('0xb2')][_0x1516('0x6f')]){return _0x375cd8[_0x1516('0xbc')][_0x1516('0xb2')][0x0];}else{return db['CmContact'][_0x1516('0x5e')](_['defaults'](_0x1d383f[_0x1516('0x67')],{'firstName':_0x1d383f[_0x1516('0x67')]['to'][0x0],'phone':_0x1d383f[_0x1516('0x67')]['to'][0x0],'fax':_0x1d383f[_0x1516('0x67')]['to'][0x0],'ListId':_0x375cd8[_0x1516('0xaa')]}));}}else{throw new Error(_0x1516('0xbd'));}}else{throw new Error(_0x1516('0xbe'));}})[_0x1516('0x25')](function(_0x4f91ee){if(_0x4f91ee){return db[_0x1516('0x79')][_0x1516('0x5d')]({'where':{'ContactId':_0x4f91ee['id'],'closed':![],'FaxAccountId':_0x375cd8['id']}})['then'](function(_0x55105f){if(_0x55105f){return[_0x55105f,![]];}return db['FaxInteraction'][_0x1516('0x5e')]({'UserId':_0x1d383f[_0x1516('0x61')]['id'],'ContactId':_0x4f91ee['id'],'FaxAccountId':_0x375cd8['id'],'fax':_0x1d383f[_0x1516('0x67')]['to'][0x0],'firstMsgDirection':_0x1516('0xbf'),'Messages':[_[_0x1516('0x56')](_0x1d383f[_0x1516('0x67')],{'read':![],'body':_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][0x0]['filename'],'FaxAccountId':_0x375cd8['id'],'UserId':_0x1d383f[_0x1516('0x61')]['id'],'ContactId':_0x4f91ee['id'],'AttachmentId':_0x1d383f['body'][_0x1516('0xb4')][0x0]['id']})]},{'include':[{'model':db[_0x1516('0xac')],'as':_0x1516('0xc0')}]})[_0x1516('0x25')](function(_0x352d50){return[_0x352d50,!![]];});});}else{throw new Error(_0x1516('0xc1'));}})['spread'](function(_0x24b670,_0x2352b8){if(_0x2352b8){return _0x24b670;}return db['FaxMessage']['create']({'direction':_0x1516('0xbf'),'read':![],'body':_0x1d383f['body'][_0x1516('0xb4')][0x0]['filename'],'FaxAccountId':_0x375cd8['id'],'FaxInteractionId':_0x24b670['id'],'UserId':_0x1d383f[_0x1516('0x61')]['id'],'ContactId':_0x24b670[_0x1516('0xc2')],'AttachmentId':_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][0x0]['id']})[_0x1516('0x25')](function(_0x1b4571){_0x24b670['dataValues'][_0x1516('0xc0')]=[];_0x24b670[_0x1516('0xc3')][_0x1516('0xc0')][_0x1516('0x93')](_0x1b4571['dataValues']);return _0x24b670;});})[_0x1516('0x25')](function(_0x32107c){respondWithRpcPromise('SendFax',_0x1516('0xc4'),{'FaxAccountId':_[_0x1516('0xb9')](_0x1d383f['params']['id'])?undefined:_0x1d383f[_0x1516('0x69')]['id'],'path':_[_0x1516('0xb9')](_0x1d383f[_0x1516('0x67')]['attachments'][0x0]['path'])?undefined:_0x1d383f['body']['attachments'][0x0][_0x1516('0x9')],'fax':_[_0x1516('0xb9')](_0x1d383f['body']['to'][0x0])?undefined:_0x1d383f[_0x1516('0x67')]['to'][0x0],'AttachmentId':_0x1d383f[_0x1516('0x67')][_0x1516('0xb4')][0x0]['id']},client9002)[_0x1516('0x25')](function(_0x38e4e){logger['info'](_0x1516('0xc5'),_0x38e4e);})[_0x1516('0x2f')](function(_0x3dd576){logger[_0x1516('0x26')](_0x1516('0xc5'),_0x3dd576);});return _0x32107c;})['then'](respondWithResult(_0x44a4c6,null))[_0x1516('0x2f')](handleError(_0x44a4c6,null));};exports[_0x1516('0xc6')]=function(_0x3c8ae7,_0x25df30,_0x1a113c){return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0x3c8ae7[_0x1516('0x69')]['id']}})['then'](handleEntityNotFound(_0x25df30,null))[_0x1516('0x25')](function(_0x5611a2){if(_0x5611a2){return _0x5611a2[_0x1516('0xc6')](_0x3c8ae7[_0x1516('0x67')][_0x1516('0x77')],_['omit'](_0x3c8ae7['body'],[_0x1516('0x77'),'id'])||{})['spread'](function(_0x44dd86){for(var _0x595d92=0x0;_0x595d92<_0x3c8ae7[_0x1516('0x67')][_0x1516('0x77')][_0x1516('0x6f')];_0x595d92+=0x1){socket[_0x1516('0xc7')](_0x1516('0xc8'),{'UserId':Number(_0x3c8ae7['body'][_0x1516('0x77')][_0x595d92]),'FaxAccountId':Number(_0x3c8ae7['params']['id'])});}return _0x44dd86;});}})[_0x1516('0x25')](respondWithResult(_0x25df30,null))[_0x1516('0x2f')](handleError(_0x25df30,null));};exports['removeAgents']=function(_0x39b034,_0xe0932f,_0x1b16bc){return db[_0x1516('0x46')][_0x1516('0x5d')]({'where':{'id':_0x39b034[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0xe0932f,null))[_0x1516('0x25')](function(_0x2a8589){if(_0x2a8589){return _0x2a8589[_0x1516('0xc9')](_0x39b034[_0x1516('0x4c')][_0x1516('0x77')])['then'](function(){if(_[_0x1516('0xca')](_0x39b034[_0x1516('0x4c')][_0x1516('0x77')])){for(var _0x41803d=0x0;_0x41803d<_0x39b034[_0x1516('0x4c')]['ids']['length'];_0x41803d+=0x1){socket[_0x1516('0xc7')](_0x1516('0xcb'),{'UserId':Number(_0x39b034[_0x1516('0x4c')][_0x1516('0x77')][_0x41803d]),'FaxAccountId':Number(_0x39b034[_0x1516('0x69')]['id'])});}}else{socket[_0x1516('0xc7')](_0x1516('0xcb'),{'UserId':Number(_0x39b034[_0x1516('0x4c')][_0x1516('0x77')]),'FaxAccountId':Number(_0x39b034[_0x1516('0x69')]['id'])});}});}})[_0x1516('0x25')](respondWithStatusCode(_0xe0932f,null))[_0x1516('0x2f')](handleError(_0xe0932f,null));};exports['getAgents']=function(_0x3eeb38,_0x4ab455,_0xaa2f0d){var _0x17e8aa={};var _0x53d7a3={};var _0x31218a;var _0x12d7a7;return db[_0x1516('0x46')][_0x1516('0x6e')]({'where':{'id':_0x3eeb38[_0x1516('0x69')]['id']}})[_0x1516('0x25')](handleEntityNotFound(_0x4ab455,null))[_0x1516('0x25')](function(_0x14abe3){if(_0x14abe3){_0x31218a=_0x14abe3;_0x53d7a3[_0x1516('0x4b')]=_[_0x1516('0x4d')](db['User'][_0x1516('0x47')]);_0x53d7a3[_0x1516('0x4c')]=_[_0x1516('0x4d')](_0x3eeb38[_0x1516('0x4c')]);_0x53d7a3['filters']=_[_0x1516('0x4f')](_0x53d7a3[_0x1516('0x4b')],_0x53d7a3['query']);_0x17e8aa[_0x1516('0x50')]=_['intersection'](_0x53d7a3['model'],qs['fields'](_0x3eeb38[_0x1516('0x4c')]['fields']));_0x17e8aa[_0x1516('0x50')]=_0x17e8aa[_0x1516('0x50')][_0x1516('0x6f')]?_0x17e8aa[_0x1516('0x50')]:_0x53d7a3[_0x1516('0x4b')];_0x17e8aa[_0x1516('0x52')]=qs[_0x1516('0x72')](_0x3eeb38[_0x1516('0x4c')]['sort']);_0x17e8aa[_0x1516('0x53')]=qs[_0x1516('0x4e')](_[_0x1516('0x54')](_0x3eeb38[_0x1516('0x4c')],_0x53d7a3[_0x1516('0x4e')]));if(_0x3eeb38[_0x1516('0x4c')][_0x1516('0x55')]){_0x17e8aa['where']=_[_0x1516('0x56')](_0x17e8aa[_0x1516('0x53')],{'$or':_[_0x1516('0x45')](_0x17e8aa[_0x1516('0x50')],function(_0x2d2f4f){var _0x5c6c7d={};_0x5c6c7d[_0x2d2f4f]={'$like':'%'+_0x3eeb38[_0x1516('0x4c')][_0x1516('0x55')]+'%'};return _0x5c6c7d;})});}_0x17e8aa=_[_0x1516('0x56')]({},_0x17e8aa,_0x3eeb38['options']);return _0x31218a[_0x1516('0xcc')](_0x17e8aa);}})[_0x1516('0x25')](function(_0x8c30ca){if(_0x8c30ca){_0x12d7a7=_0x8c30ca[_0x1516('0x6f')];if(!_0x3eeb38[_0x1516('0x4c')]['hasOwnProperty']('nolimit')){_0x17e8aa[_0x1516('0x37')]=qs[_0x1516('0x37')](_0x3eeb38[_0x1516('0x4c')][_0x1516('0x37')]);_0x17e8aa[_0x1516('0x34')]=qs[_0x1516('0x34')](_0x3eeb38['query'][_0x1516('0x34')]);}return _0x31218a['getAgents'](_0x17e8aa);}})[_0x1516('0x25')](function(_0x14035a){if(_0x14035a){return _0x14035a?{'count':_0x12d7a7,'rows':_0x14035a}:null;}})[_0x1516('0x25')](respondWithResult(_0x4ab455,null))[_0x1516('0x2f')](handleError(_0x4ab455,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 920b79c..40f2472 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 _0x8786=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x4c147c,_0x132c49){var _0x5e8bc0=function(_0x2b2f68){while(--_0x2b2f68){_0x4c147c['push'](_0x4c147c['shift']());}};_0x5e8bc0(++_0x132c49);}(_0x8786,0x153));var _0x6878=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8786[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x6878('0x0'));var FaxAccount=require(_0x6878('0x1'))['db'][_0x6878('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6878('0x3'),'afterUpdate':_0x6878('0x4'),'afterDestroy':_0x6878('0x5')};function emitEvent(_0x57ff21){return function(_0x347e06,_0x439475,_0x23647a){FaxAccountEvents[_0x6878('0x6')](_0x57ff21+':'+_0x347e06['id'],_0x347e06);FaxAccountEvents['emit'](_0x57ff21,_0x347e06);_0x23647a(null);};}for(var e in events){if(events[_0x6878('0x7')](e)){var event=events[e];FaxAccount[_0x6878('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x1303=['../../mysqldb','FaxAccount','save','update','emit','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1303,0x117));var _0x3130=function(_0x137603,_0xbb12a8){_0x137603=_0x137603-0x0;var _0x3dbcf4=_0x1303[_0x137603];return _0x3dbcf4;};'use strict';var EventEmitter=require(_0x3130('0x0'));var FaxAccount=require(_0x3130('0x1'))['db'][_0x3130('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3130('0x3'),'afterUpdate':_0x3130('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4792cd){return function(_0x27b876,_0x4c1a65,_0x46ae43){FaxAccountEvents['emit'](_0x4792cd+':'+_0x27b876['id'],_0x27b876);FaxAccountEvents[_0x3130('0x5')](_0x4792cd,_0x27b876);_0x46ae43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3130('0x6')](e,emitEvent(event));}}module[_0x3130('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 574c747..5495fe1 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 _0x50b6=['../../config/logger','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x50b6,0xee));var _0x650b=function(_0x5cdcd7,_0x54eb4d){_0x5cdcd7=_0x5cdcd7-0x0;var _0x1dc83b=_0x50b6[_0x5cdcd7];return _0x1dc83b;};'use strict';var _=require(_0x650b('0x0'));var util=require(_0x650b('0x1'));var logger=require(_0x650b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x650b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x650b('0x4'));var rimraf=require(_0x650b('0x5'));var config=require(_0x650b('0x6'));var attributes=require(_0x650b('0x7'));module[_0x650b('0x8')]=function(_0x1bfabd,_0x25c520){return _0x1bfabd[_0x650b('0x9')](_0x650b('0xa'),attributes,{'tableName':_0x650b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e22=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x498ba1,_0x3b3b26){var _0x30c018=function(_0x3c5da5){while(--_0x3c5da5){_0x498ba1['push'](_0x498ba1['shift']());}};_0x30c018(++_0x3b3b26);}(_0x2e22,0x1b6));var _0x22e2=function(_0x3500e7,_0x38ea3b){_0x3500e7=_0x3500e7-0x0;var _0x177cfe=_0x2e22[_0x3500e7];return _0x177cfe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22e2('0x0'))(_0x22e2('0x1'));var moment=require(_0x22e2('0x2'));var BPromise=require(_0x22e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22e2('0x4'));var rimraf=require(_0x22e2('0x5'));var config=require(_0x22e2('0x6'));var attributes=require(_0x22e2('0x7'));module[_0x22e2('0x8')]=function(_0x223791,_0xb0bf1d){return _0x223791[_0x22e2('0x9')](_0x22e2('0xa'),attributes,{'tableName':_0x22e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f5361aa..18332c1 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 _0x2b7c=['result','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','priority','asc','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','name','agent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x10f141,_0xc29b73){var _0x24a599=function(_0x25100d){while(--_0x25100d){_0x10f141['push'](_0x10f141['shift']());}};_0x24a599(++_0xc29b73);}(_0x2b7c,0xf5));var _0xc2b7=function(_0x3b0adf,_0x32f605){_0x3b0adf=_0x3b0adf-0x0;var _0x3db79e=_0x2b7c[_0x3b0adf];return _0x3db79e;};'use strict';var _=require(_0xc2b7('0x0'));var util=require(_0xc2b7('0x1'));var moment=require('moment');var BPromise=require(_0xc2b7('0x2'));var rs=require(_0xc2b7('0x3'));var fs=require('fs');var Redis=require(_0xc2b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2b7('0x5'));var logger=require(_0xc2b7('0x6'))(_0xc2b7('0x7'));var config=require(_0xc2b7('0x8'));var jayson=require(_0xc2b7('0x9'));var client=jayson[_0xc2b7('0xa')][_0xc2b7('0xb')]({'port':0x232c});config[_0xc2b7('0xc')]=_[_0xc2b7('0xd')](config[_0xc2b7('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x7448fa,_0x2b1852,_0x1cbcf8){return new BPromise(function(_0x2ae2eb,_0x4d37a3){return client[_0xc2b7('0xe')](_0x7448fa,_0x1cbcf8)[_0xc2b7('0xf')](function(_0x3a3e7c){logger[_0xc2b7('0x10')](_0xc2b7('0x11'),_0x2b1852,_0xc2b7('0x12'));logger[_0xc2b7('0x13')](_0xc2b7('0x14'),_0x2b1852,'request\x20sent',JSON[_0xc2b7('0x15')](_0x3a3e7c));if(_0x3a3e7c[_0xc2b7('0x16')]){if(_0x3a3e7c[_0xc2b7('0x16')][_0xc2b7('0x17')]===0x1f4){logger[_0xc2b7('0x16')]('FaxAccount,\x20%s,\x20%s',_0x2b1852,_0x3a3e7c[_0xc2b7('0x16')][_0xc2b7('0x18')]);return _0x4d37a3(_0x3a3e7c['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x2b1852,_0x3a3e7c[_0xc2b7('0x16')][_0xc2b7('0x18')]);return _0x2ae2eb(_0x3a3e7c['error'][_0xc2b7('0x18')]);}else{logger['info'](_0xc2b7('0x11'),_0x2b1852,_0xc2b7('0x12'));_0x2ae2eb(_0x3a3e7c[_0xc2b7('0x19')][_0xc2b7('0x18')]);}})['catch'](function(_0x536cb2){logger['error'](_0xc2b7('0x11'),_0x2b1852,_0x536cb2);_0x4d37a3(_0x536cb2);});});}exports['GetFaxAccount']=function(_0x190776){var _0x52ddc0=this;return new Promise(function(_0x13e5ab,_0x37f62c){return db[_0xc2b7('0x1a')][_0xc2b7('0x1b')]({'raw':_0x190776[_0xc2b7('0x1c')]?_0x190776['options'][_0xc2b7('0x1d')]===undefined?!![]:![]:!![],'where':_0x190776[_0xc2b7('0x1c')]?_0x190776['options'][_0xc2b7('0x1e')]||null:null,'attributes':_0x190776['options']?_0x190776[_0xc2b7('0x1c')][_0xc2b7('0x1f')]||null:null,'limit':_0x190776[_0xc2b7('0x1c')]?_0x190776[_0xc2b7('0x1c')][_0xc2b7('0x20')]||null:null,'include':_0x190776[_0xc2b7('0x1c')]?_0x190776['options']['include']?_[_0xc2b7('0x21')](_0x190776['options']['include'],function(_0x1e9f00){return{'model':db[_0x1e9f00['model']],'as':_0x1e9f00['as'],'attributes':_0x1e9f00[_0xc2b7('0x1f')],'include':_0x1e9f00[_0xc2b7('0x22')]?_[_0xc2b7('0x21')](_0x1e9f00[_0xc2b7('0x22')],function(_0x14a80c){return{'model':db[_0x14a80c[_0xc2b7('0x23')]],'as':_0x14a80c['as'],'attributes':_0x14a80c[_0xc2b7('0x1f')],'include':_0x14a80c[_0xc2b7('0x22')]?_['map'](_0x14a80c['include'],function(_0x14611c){return{'model':db[_0x14611c[_0xc2b7('0x23')]],'as':_0x14611c['as'],'attributes':_0x14611c[_0xc2b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fb3ca){logger[_0xc2b7('0x10')](_0xc2b7('0x24'),_0x190776);logger['debug']('GetFaxAccount',_0x190776,JSON[_0xc2b7('0x15')](_0x1fb3ca));_0x13e5ab(_0x1fb3ca);})[_0xc2b7('0x25')](function(_0x4613ad){logger[_0xc2b7('0x16')](_0xc2b7('0x24'),_0x4613ad[_0xc2b7('0x18')],_0x190776);_0x37f62c(_0x52ddc0[_0xc2b7('0x16')](0x1f4,_0x4613ad[_0xc2b7('0x18')]));});});};exports[_0xc2b7('0x26')]=function(_0x299275,_0x2b0ddd,_0x4e54ed){var _0x2516d7=this;return new Promise(function(_0x1affb6,_0x3ad73c){var _0x1b3112={'body':_0x299275[_0xc2b7('0x27')],'channel':_0xc2b7('0x28')};var _0x2f0c25=[];var _0x4447e8=[];var _0x14c444={};return db[_0xc2b7('0x29')][_0xc2b7('0x2a')]()[_0xc2b7('0xf')](function(_0x18d95e){if(!_0x18d95e){throw new db[(_0xc2b7('0x2b'))][(_0xc2b7('0x2c'))](_0xc2b7('0x2d'));}_0x2f0c25=_[_0xc2b7('0x2e')](_['keys'](_0x18d95e),[_0xc2b7('0x2f'),_0xc2b7('0x30')]);_0x4447e8=_['difference'](_[_0xc2b7('0x31')](_0x18d95e),[_0xc2b7('0x2f'),_0xc2b7('0x30'),_0xc2b7('0x32'),_0xc2b7('0x33')]);if(_0x299275[_0xc2b7('0x27')]['id']){delete _0x299275['body']['id'];}if(_[_0xc2b7('0x34')](_0x299275[_0xc2b7('0x27')][_0xc2b7('0x35')])){throw new db[(_0xc2b7('0x2b'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xc2b7('0x34')](_0x299275[_0xc2b7('0x27')][_0xc2b7('0x27')])||_0x299275[_0xc2b7('0x27')][_0xc2b7('0x27')]===''){throw new db[(_0xc2b7('0x2b'))][(_0xc2b7('0x2c'))](_0xc2b7('0x36'));}if(_[_0xc2b7('0x34')](_0x299275['body'][_0xc2b7('0x37')])){throw new db['Sequelize'][(_0xc2b7('0x2c'))](_0xc2b7('0x38')+_0x4447e8);}if(!_[_0xc2b7('0x39')](_0x4447e8,_0x299275[_0xc2b7('0x27')][_0xc2b7('0x37')])){throw new db[(_0xc2b7('0x2b'))][(_0xc2b7('0x2c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4447e8);}_0x14c444[_0x299275['body'][_0xc2b7('0x37')]]=_0x299275[_0xc2b7('0x27')]['from'];})['then'](function(){return db[_0xc2b7('0x1a')][_0xc2b7('0x3a')]({'where':{'id':_0x299275['account']['id']},'include':[{'model':db[_0xc2b7('0x3b')],'as':_0xc2b7('0x3c'),'include':[{'model':db[_0xc2b7('0x29')],'as':_0xc2b7('0x3d'),'where':_0x14c444,'limit':0x1,'order':[[_0xc2b7('0x30'),_0xc2b7('0x3e')]]}]},{'model':db[_0xc2b7('0x3f')],'as':_0xc2b7('0x40')}]});})[_0xc2b7('0xf')](function(_0xd6f411){if(_0xd6f411&&_0xd6f411[_0xc2b7('0x3c')]){var _0xf2aa5=_0xd6f411[_0xc2b7('0x41')]({'plain':!![]});_0x1b3112[_0xc2b7('0x42')]=_0xf2aa5;_0x1b3112[_0xc2b7('0x43')]=_0xf2aa5['Applications'];_0x1b3112[_0xc2b7('0x44')]=_0xf2aa5['List'];_0x1b3112[_0xc2b7('0x43')]=_['orderBy'](_0x1b3112[_0xc2b7('0x43')],[_0xc2b7('0x45')],[_0xc2b7('0x46')]);if(_0x1b3112['account'][_0xc2b7('0x40')]){delete _0x1b3112['account']['Applications'];}if(_0x1b3112['account'][_0xc2b7('0x3c')]&&_0x1b3112[_0xc2b7('0x42')]['List']['Contacts']['length']){return _0x1b3112[_0xc2b7('0x42')][_0xc2b7('0x3c')][_0xc2b7('0x3d')][0x0];}var _0x1b3f97=_['defaults'](_0x299275[_0xc2b7('0x27')],{'firstName':_0x299275[_0xc2b7('0x27')]['from'],'ListId':_0xf2aa5[_0xc2b7('0x33')]});_0x1b3f97[_0x299275[_0xc2b7('0x27')]['mapKey']]=_0x299275['body'][_0xc2b7('0x35')];return db[_0xc2b7('0x29')]['create'](_0x1b3f97,{'fields':_0x2f0c25,'raw':!![]});}})[_0xc2b7('0xf')](function(_0x58875b){_0x1b3112[_0xc2b7('0x47')]=_0x58875b;if(_0x58875b){var _0x5d1ac8={'ContactId':_0x58875b['id'],'FaxAccountId':_0x299275['account']['id'],'fax':_0x58875b['fax']};return db[_0xc2b7('0x48')][_0xc2b7('0x3a')]({'where':{'ContactId':_0x58875b['id'],'closed':![],'FaxAccountId':_0x299275[_0xc2b7('0x42')]['id']}})[_0xc2b7('0xf')](function(_0x1274bb){if(_0x1274bb){return[_0x1274bb,![]];}return db[_0xc2b7('0x48')]['create'](_0x5d1ac8)[_0xc2b7('0xf')](function(_0x23693){return[_0x23693,!![]];});});}else{throw new Error(_0xc2b7('0x49'));}})['spread'](function(_0x4f4721,_0x1c3ff6){var _0x9f605=_0x4f4721[_0xc2b7('0x41')]({'plain':!![]});if(_0x1c3ff6){if(_0x1b3112[_0xc2b7('0x42')][_0xc2b7('0x4a')]){_0x1b3112['applications'][_0xc2b7('0x4b')]({'id':0x0,'priority':_0x1b3112[_0xc2b7('0x43')]['length']+0x1,'app':_0xc2b7('0x4c'),'appdata':_0xc2b7('0x4d'),'interval':_0xc2b7('0x4e')});}_0x9f605[_0xc2b7('0x4f')]=!![];}else{_0x9f605[_0xc2b7('0x4f')]=![];}_0x1b3112[_0xc2b7('0x50')]=_0x9f605;return db[_0xc2b7('0x51')][_0xc2b7('0x52')]({'body':_0x299275[_0xc2b7('0x27')]['body'],'FaxAccountId':_0x299275[_0xc2b7('0x42')]['id'],'FaxInteractionId':_0x4f4721['id'],'direction':'in','ContactId':_0x4f4721[_0xc2b7('0x53')],'AttachmentId':_0x299275[_0xc2b7('0x27')][_0xc2b7('0x54')]});})[_0xc2b7('0xf')](function(_0x4f9d00){_0x1b3112['message']=_0x4f9d00;if(_0x1b3112[_0xc2b7('0x50')][_0xc2b7('0x55')]){return db['User'][_0xc2b7('0x3a')]({'attributes':['id',_0xc2b7('0x56')],'where':{'id':_0x1b3112[_0xc2b7('0x50')][_0xc2b7('0x55')]}})[_0xc2b7('0xf')](function(_0x46f407){if(_0x46f407){_0x1b3112[_0xc2b7('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc2b7('0x57'),'appdata':_0x46f407[_0xc2b7('0x56')]+','+(_0x1b3112[_0xc2b7('0x42')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc2b7('0x58'),_0xc2b7('0x59'),_0x1b3112);});}return respondWithRpcPromise(_0xc2b7('0x58'),'startRouting',_0x1b3112);})[_0xc2b7('0xf')](function(_0x108d28){_0x1affb6(_0x108d28);})[_0xc2b7('0x25')](function(_0x12f703){_0x3ad73c(_0x2516d7[_0xc2b7('0x16')](0x1f4,_0x12f703[_0xc2b7('0x18')]));});});}; \ No newline at end of file +var _0xfa42=['FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','include','map','model','stringify','body','fax','CmContact','ValidationError','difference','keys','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','Contacts','FaxApplication','Applications','List','list','applications','orderBy','priority','length','create','contact','FaxInteraction','get','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','unshift','agent','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa42,0x140));var _0x2fa4=function(_0x3f0eaa,_0x8bb233){_0x3f0eaa=_0x3f0eaa-0x0;var _0x7a151c=_0xfa42[_0x3f0eaa];return _0x7a151c;};'use strict';var _=require(_0x2fa4('0x0'));var util=require(_0x2fa4('0x1'));var moment=require(_0x2fa4('0x2'));var BPromise=require(_0x2fa4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fa4('0x4'));var db=require(_0x2fa4('0x5'))['db'];var utils=require(_0x2fa4('0x6'));var logger=require(_0x2fa4('0x7'))(_0x2fa4('0x8'));var config=require(_0x2fa4('0x9'));var jayson=require(_0x2fa4('0xa'));var client=jayson[_0x2fa4('0xb')][_0x2fa4('0xc')]({'port':0x232c});config[_0x2fa4('0xd')]=_[_0x2fa4('0xe')](config[_0x2fa4('0xd')],{'host':_0x2fa4('0xf'),'port':0x18eb});var socket=require(_0x2fa4('0x10'))(new Redis(config[_0x2fa4('0xd')]));require('./faxAccount.socket')[_0x2fa4('0x11')](socket);function respondWithRpcPromise(_0xe7087,_0xa6900,_0x1d6e3f){return new BPromise(function(_0x2b6263,_0x540536){return client[_0x2fa4('0x12')](_0xe7087,_0x1d6e3f)[_0x2fa4('0x13')](function(_0x59a9f0){logger[_0x2fa4('0x14')](_0x2fa4('0x15'),_0xa6900,_0x2fa4('0x16'));logger[_0x2fa4('0x17')](_0x2fa4('0x18'),_0xa6900,'request\x20sent',JSON['stringify'](_0x59a9f0));if(_0x59a9f0['error']){if(_0x59a9f0[_0x2fa4('0x19')][_0x2fa4('0x1a')]===0x1f4){logger[_0x2fa4('0x19')](_0x2fa4('0x15'),_0xa6900,_0x59a9f0['error'][_0x2fa4('0x1b')]);return _0x540536(_0x59a9f0[_0x2fa4('0x19')][_0x2fa4('0x1b')]);}logger[_0x2fa4('0x19')](_0x2fa4('0x15'),_0xa6900,_0x59a9f0[_0x2fa4('0x19')][_0x2fa4('0x1b')]);return _0x2b6263(_0x59a9f0['error'][_0x2fa4('0x1b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0xa6900,_0x2fa4('0x16'));_0x2b6263(_0x59a9f0[_0x2fa4('0x1c')]['message']);}})[_0x2fa4('0x1d')](function(_0x1f7922){logger[_0x2fa4('0x19')]('FaxAccount,\x20%s,\x20%s',_0xa6900,_0x1f7922);_0x540536(_0x1f7922);});});}exports[_0x2fa4('0x1e')]=function(_0x335b3d){var _0x342ba0=this;return new Promise(function(_0x46b0f9,_0x1a961b){return db['FaxAccount'][_0x2fa4('0x1f')]({'raw':_0x335b3d[_0x2fa4('0x20')]?_0x335b3d[_0x2fa4('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x335b3d[_0x2fa4('0x20')]?_0x335b3d[_0x2fa4('0x20')][_0x2fa4('0x21')]||null:null,'attributes':_0x335b3d[_0x2fa4('0x20')]?_0x335b3d[_0x2fa4('0x20')][_0x2fa4('0x22')]||null:null,'limit':_0x335b3d[_0x2fa4('0x20')]?_0x335b3d[_0x2fa4('0x20')][_0x2fa4('0x23')]||null:null,'include':_0x335b3d[_0x2fa4('0x20')]?_0x335b3d[_0x2fa4('0x20')][_0x2fa4('0x24')]?_['map'](_0x335b3d[_0x2fa4('0x20')][_0x2fa4('0x24')],function(_0x5d60a4){return{'model':db[_0x5d60a4['model']],'as':_0x5d60a4['as'],'attributes':_0x5d60a4['attributes'],'include':_0x5d60a4[_0x2fa4('0x24')]?_[_0x2fa4('0x25')](_0x5d60a4['include'],function(_0x61c264){return{'model':db[_0x61c264[_0x2fa4('0x26')]],'as':_0x61c264['as'],'attributes':_0x61c264[_0x2fa4('0x22')],'include':_0x61c264[_0x2fa4('0x24')]?_[_0x2fa4('0x25')](_0x61c264[_0x2fa4('0x24')],function(_0x10347a){return{'model':db[_0x10347a['model']],'as':_0x10347a['as'],'attributes':_0x10347a[_0x2fa4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2fa4('0x13')](function(_0x306c84){logger['info']('GetFaxAccount',_0x335b3d);logger[_0x2fa4('0x17')](_0x2fa4('0x1e'),_0x335b3d,JSON[_0x2fa4('0x27')](_0x306c84));_0x46b0f9(_0x306c84);})[_0x2fa4('0x1d')](function(_0x4657d2){logger['error'](_0x2fa4('0x1e'),_0x4657d2[_0x2fa4('0x1b')],_0x335b3d);_0x1a961b(_0x342ba0[_0x2fa4('0x19')](0x1f4,_0x4657d2[_0x2fa4('0x1b')]));});});};exports['NotifyFaxAccount']=function(_0x1e3643,_0x2078a3,_0x2e4a3e){var _0x3cd554=this;return new Promise(function(_0x16d67d,_0x13c8f8){var _0x8fc739={'body':_0x1e3643[_0x2fa4('0x28')],'channel':_0x2fa4('0x29')};var _0x171b90=[];var _0x46ccf0=[];var _0x2b754b={};return db[_0x2fa4('0x2a')]['describe']()[_0x2fa4('0x13')](function(_0x50f3e0){if(!_0x50f3e0){throw new db['Sequelize'][(_0x2fa4('0x2b'))]('no\x20available\x20attributes');}_0x171b90=_[_0x2fa4('0x2c')](_[_0x2fa4('0x2d')](_0x50f3e0),['createdAt',_0x2fa4('0x2e')]);_0x46ccf0=_['difference'](_[_0x2fa4('0x2d')](_0x50f3e0),['createdAt',_0x2fa4('0x2e'),_0x2fa4('0x2f'),_0x2fa4('0x30')]);if(_0x1e3643[_0x2fa4('0x28')]['id']){delete _0x1e3643[_0x2fa4('0x28')]['id'];}if(_['isNil'](_0x1e3643['body'][_0x2fa4('0x31')])){throw new db[(_0x2fa4('0x32'))][(_0x2fa4('0x2b'))](_0x2fa4('0x33'));}if(_[_0x2fa4('0x34')](_0x1e3643[_0x2fa4('0x28')]['body'])||_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x28')]===''){throw new db['Sequelize'][(_0x2fa4('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2fa4('0x34')](_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x35')])){throw new db[(_0x2fa4('0x32'))][(_0x2fa4('0x2b'))](_0x2fa4('0x36')+_0x46ccf0);}if(!_[_0x2fa4('0x37')](_0x46ccf0,_0x1e3643['body'][_0x2fa4('0x35')])){throw new db[(_0x2fa4('0x32'))][(_0x2fa4('0x2b'))](_0x2fa4('0x38')+_0x46ccf0);}_0x2b754b[_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x35')]]=_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x31')];})[_0x2fa4('0x13')](function(){return db[_0x2fa4('0x39')][_0x2fa4('0x3a')]({'where':{'id':_0x1e3643[_0x2fa4('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2fa4('0x2a')],'as':_0x2fa4('0x3c'),'where':_0x2b754b,'limit':0x1,'order':[[_0x2fa4('0x2e'),'DESC']]}]},{'model':db[_0x2fa4('0x3d')],'as':_0x2fa4('0x3e')}]});})[_0x2fa4('0x13')](function(_0xcd20df){if(_0xcd20df&&_0xcd20df[_0x2fa4('0x3f')]){var _0x111cf6=_0xcd20df['get']({'plain':!![]});_0x8fc739['account']=_0x111cf6;_0x8fc739['applications']=_0x111cf6['Applications'];_0x8fc739[_0x2fa4('0x40')]=_0x111cf6[_0x2fa4('0x3f')];_0x8fc739[_0x2fa4('0x41')]=_[_0x2fa4('0x42')](_0x8fc739[_0x2fa4('0x41')],[_0x2fa4('0x43')],['asc']);if(_0x8fc739[_0x2fa4('0x3b')][_0x2fa4('0x3e')]){delete _0x8fc739['account']['Applications'];}if(_0x8fc739['account'][_0x2fa4('0x3f')]&&_0x8fc739[_0x2fa4('0x3b')][_0x2fa4('0x3f')][_0x2fa4('0x3c')][_0x2fa4('0x44')]){return _0x8fc739[_0x2fa4('0x3b')][_0x2fa4('0x3f')][_0x2fa4('0x3c')][0x0];}var _0x4a4b99=_[_0x2fa4('0xe')](_0x1e3643[_0x2fa4('0x28')],{'firstName':_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x31')],'ListId':_0x111cf6[_0x2fa4('0x30')]});_0x4a4b99[_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x35')]]=_0x1e3643[_0x2fa4('0x28')][_0x2fa4('0x31')];return db[_0x2fa4('0x2a')][_0x2fa4('0x45')](_0x4a4b99,{'fields':_0x171b90,'raw':!![]});}})[_0x2fa4('0x13')](function(_0x316313){_0x8fc739[_0x2fa4('0x46')]=_0x316313;if(_0x316313){var _0x391408={'ContactId':_0x316313['id'],'FaxAccountId':_0x1e3643['account']['id'],'fax':_0x316313['fax']};return db[_0x2fa4('0x47')]['find']({'where':{'ContactId':_0x316313['id'],'closed':![],'FaxAccountId':_0x1e3643[_0x2fa4('0x3b')]['id']}})['then'](function(_0x5f321f){if(_0x5f321f){return[_0x5f321f,![]];}return db[_0x2fa4('0x47')][_0x2fa4('0x45')](_0x391408)[_0x2fa4('0x13')](function(_0x1d68b1){return[_0x1d68b1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2c25da,_0x4bd740){var _0x5e551c=_0x2c25da[_0x2fa4('0x48')]({'plain':!![]});if(_0x4bd740){if(_0x8fc739[_0x2fa4('0x3b')]['autoclose']){_0x8fc739[_0x2fa4('0x41')]['push']({'id':0x0,'priority':_0x8fc739[_0x2fa4('0x41')][_0x2fa4('0x44')]+0x1,'app':_0x2fa4('0x49'),'appdata':_0x2fa4('0x4a'),'interval':_0x2fa4('0x4b')});}_0x5e551c[_0x2fa4('0x4c')]=!![];}else{_0x5e551c[_0x2fa4('0x4c')]=![];}_0x8fc739['interaction']=_0x5e551c;return db[_0x2fa4('0x4d')][_0x2fa4('0x45')]({'body':_0x1e3643['body'][_0x2fa4('0x28')],'FaxAccountId':_0x1e3643[_0x2fa4('0x3b')]['id'],'FaxInteractionId':_0x2c25da['id'],'direction':'in','ContactId':_0x2c25da[_0x2fa4('0x4e')],'AttachmentId':_0x1e3643[_0x2fa4('0x28')]['AttachmentId']});})[_0x2fa4('0x13')](function(_0x2901ac){_0x8fc739[_0x2fa4('0x1b')]=_0x2901ac;if(_0x8fc739[_0x2fa4('0x4f')][_0x2fa4('0x50')]){return db[_0x2fa4('0x51')]['find']({'attributes':['id',_0x2fa4('0x52')],'where':{'id':_0x8fc739[_0x2fa4('0x4f')][_0x2fa4('0x50')]}})[_0x2fa4('0x13')](function(_0x3f357c){if(_0x3f357c){_0x8fc739[_0x2fa4('0x41')][_0x2fa4('0x53')]({'id':0x0,'priority':0x0,'app':_0x2fa4('0x54'),'appdata':_0x3f357c[_0x2fa4('0x52')]+','+(_0x8fc739['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2fa4('0x4b')});}return respondWithRpcPromise('Start','startRouting',_0x8fc739);});}return respondWithRpcPromise(_0x2fa4('0x55'),'startRouting',_0x8fc739);})[_0x2fa4('0x13')](function(_0x23e170){_0x16d67d(_0x23e170);})['catch'](function(_0x459cf6){_0x13c8f8(_0x3cd554[_0x2fa4('0x19')](0x1f4,_0x459cf6[_0x2fa4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 4508b3d..e64e876 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 _0x40a8=['save','update','emit','removeListener','faxAccount:','./faxAccount.events'];(function(_0x48f440,_0x205b56){var _0xcc60f=function(_0x320c20){while(--_0x320c20){_0x48f440['push'](_0x48f440['shift']());}};_0xcc60f(++_0x205b56);}(_0x40a8,0x83));var _0x840a=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x40a8[_0x3eb713];return _0x1d7128;};'use strict';var FaxAccountEvents=require(_0x840a('0x0'));var events=[_0x840a('0x1'),'remove',_0x840a('0x2')];function createListener(_0x236bb4,_0x2574d4){return function(_0x144454){_0x2574d4[_0x840a('0x3')](_0x236bb4,_0x144454);};}function removeListener(_0x509b58,_0x2e06fa){return function(){FaxAccountEvents[_0x840a('0x4')](_0x509b58,_0x2e06fa);};}exports['register']=function(_0x1de480){for(var _0x28b2d5=0x0,_0x584378=events['length'];_0x28b2d5<_0x584378;_0x28b2d5++){var _0x5c2dc4=events[_0x28b2d5];var _0x166151=createListener(_0x840a('0x5')+_0x5c2dc4,_0x1de480);FaxAccountEvents['on'](_0x5c2dc4,_0x166151);}}; \ No newline at end of file +var _0xbe4a=['register','length','save','remove','update','emit','removeListener'];(function(_0x16a464,_0x118602){var _0x336697=function(_0xb2004a){while(--_0xb2004a){_0x16a464['push'](_0x16a464['shift']());}};_0x336697(++_0x118602);}(_0xbe4a,0x105));var _0xabe4=function(_0x31ce32,_0x3870a8){_0x31ce32=_0x31ce32-0x0;var _0x40958b=_0xbe4a[_0x31ce32];return _0x40958b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xabe4('0x0'),_0xabe4('0x1'),_0xabe4('0x2')];function createListener(_0x1e2691,_0x10e6c0){return function(_0x20734d){_0x10e6c0[_0xabe4('0x3')](_0x1e2691,_0x20734d);};}function removeListener(_0x463a00,_0x86d4b0){return function(){FaxAccountEvents[_0xabe4('0x4')](_0x463a00,_0x86d4b0);};}exports[_0xabe4('0x5')]=function(_0x3a21d2){for(var _0x1326b9=0x0,_0x32ff59=events[_0xabe4('0x6')];_0x1326b9<_0x32ff59;_0x1326b9++){var _0x99c679=events[_0x1326b9];var _0x2cebb2=createListener('faxAccount:'+_0x99c679,_0x3a21d2);FaxAccountEvents['on'](_0x99c679,_0x2cebb2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 398d81a..1246734 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x26a9c1,_0x74cb43){var _0x11cbe6=function(_0x1800c4){while(--_0x1800c4){_0x26a9c1['push'](_0x26a9c1['shift']());}};_0x11cbe6(++_0x74cb43);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x4bd2a9,_0x14cde1){var _0x5c5a82=function(_0x3b857a){while(--_0x3b857a){_0x4bd2a9['push'](_0x4bd2a9['shift']());}};_0x5c5a82(++_0x14cde1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 888408a..3a31bb8 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 _0x4610=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0x4610,0xa7));var _0x0461=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x4610[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require('sequelize');module[_0x0461('0x0')]={'priority':{'type':Sequelize[_0x0461('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0461('0x2')],'allowNull':![],'defaultValue':_0x0461('0x3')},'appdata':{'type':Sequelize[_0x0461('0x4')]()},'description':{'type':Sequelize[_0x0461('0x2')]},'interval':{'type':Sequelize[_0x0461('0x2')],'defaultValue':_0x0461('0x5')}}; \ No newline at end of file +var _0xa4df=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x506632,_0x2bbf2e){var _0x510d15=function(_0x444572){while(--_0x444572){_0x506632['push'](_0x506632['shift']());}};_0x510d15(++_0x2bbf2e);}(_0xa4df,0xd0));var _0xfa4d=function(_0x223c68,_0x28ce25){_0x223c68=_0x223c68-0x0;var _0x45880c=_0xa4df[_0x223c68];return _0x45880c;};'use strict';var Sequelize=require(_0xfa4d('0x0'));module[_0xfa4d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfa4d('0x2')],'allowNull':![],'defaultValue':_0xfa4d('0x3')},'appdata':{'type':Sequelize[_0xfa4d('0x4')]()},'description':{'type':Sequelize[_0xfa4d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfa4d('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6196d8b..6ba46b1 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 _0xba1a=['query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../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','update','then','destroy','end','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type'];(function(_0x47f914,_0x588630){var _0x2c29ae=function(_0x4076f7){while(--_0x4076f7){_0x47f914['push'](_0x47f914['shift']());}};_0x2c29ae(++_0x588630);}(_0xba1a,0xb7));var _0xaba1=function(_0x5c9995,_0x553cd2){_0x5c9995=_0x5c9995-0x0;var _0xf907b7=_0xba1a[_0x5c9995];return _0xf907b7;};'use strict';var emlformat=require(_0xaba1('0x0'));var rimraf=require(_0xaba1('0x1'));var zipdir=require(_0xaba1('0x2'));var jsonpatch=require(_0xaba1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaba1('0x4'));var Mustache=require(_0xaba1('0x5'));var util=require(_0xaba1('0x6'));var path=require(_0xaba1('0x7'));var sox=require(_0xaba1('0x8'));var csv=require('to-csv');var ejs=require(_0xaba1('0x9'));var fs=require('fs');var fs_extra=require(_0xaba1('0xa'));var _=require(_0xaba1('0xb'));var squel=require(_0xaba1('0xc'));var crypto=require(_0xaba1('0xd'));var jsforce=require(_0xaba1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaba1('0xf'));var querystring=require(_0xaba1('0x10'));var Papa=require(_0xaba1('0x11'));var Redis=require('ioredis');var authService=require(_0xaba1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaba1('0x13'));var hardwareService=require(_0xaba1('0x14'));var logger=require(_0xaba1('0x15'))(_0xaba1('0x16'));var utils=require(_0xaba1('0x17'));var config=require(_0xaba1('0x18'));var licenseUtil=require(_0xaba1('0x19'));var db=require(_0xaba1('0x1a'))['db'];function respondWithStatusCode(_0xaf4483,_0x183004){_0x183004=_0x183004||0xcc;return function(_0x178984){if(_0x178984){return _0xaf4483[_0xaba1('0x1b')](_0x183004);}return _0xaf4483[_0xaba1('0x1c')](_0x183004)['end']();};}function respondWithResult(_0x2d9064,_0x523a21){_0x523a21=_0x523a21||0xc8;return function(_0x1da3cd){if(_0x1da3cd){return _0x2d9064[_0xaba1('0x1c')](_0x523a21)[_0xaba1('0x1d')](_0x1da3cd);}};}function respondWithFilteredResult(_0x3efa7e,_0x556c42){return function(_0x2cfe72){if(_0x2cfe72){var _0x37c34e=typeof _0x556c42[_0xaba1('0x1e')]===_0xaba1('0x1f')&&typeof _0x556c42[_0xaba1('0x20')]===_0xaba1('0x1f');var _0x417db8=_0x2cfe72[_0xaba1('0x21')];var _0x16a5a8=_0x37c34e?0x0:_0x556c42[_0xaba1('0x1e')];var _0x2e8d6b=_0x37c34e?_0x2cfe72['count']:_0x556c42[_0xaba1('0x1e')]+_0x556c42[_0xaba1('0x20')];var _0x4f30b7;if(_0x2e8d6b>=_0x417db8){_0x2e8d6b=_0x417db8;_0x4f30b7=0xc8;}else{_0x4f30b7=0xce;}_0x3efa7e[_0xaba1('0x1c')](_0x4f30b7);return _0x3efa7e['set'](_0xaba1('0x22'),_0x16a5a8+'-'+_0x2e8d6b+'/'+_0x417db8)[_0xaba1('0x1d')](_0x2cfe72);}return null;};}function patchUpdates(_0x383ce7){return function(_0x1878d4){try{jsonpatch[_0xaba1('0x23')](_0x1878d4,_0x383ce7,!![]);}catch(_0x400c4e){return BPromise[_0xaba1('0x24')](_0x400c4e);}return _0x1878d4[_0xaba1('0x25')]();};}function saveUpdates(_0x677157,_0x50fadd){return function(_0x116727){if(_0x116727){return _0x116727[_0xaba1('0x26')](_0x677157)[_0xaba1('0x27')](function(_0x1c43c9){return _0x1c43c9;});}return null;};}function removeEntity(_0x4071a1,_0x14fb2f){return function(_0x50c99b){if(_0x50c99b){return _0x50c99b[_0xaba1('0x28')]()[_0xaba1('0x27')](function(){_0x4071a1[_0xaba1('0x1c')](0xcc)[_0xaba1('0x29')]();});}};}function handleEntityNotFound(_0x6ccac9,_0x5e2bfc){return function(_0x1aedae){if(!_0x1aedae){_0x6ccac9['sendStatus'](0x194);}return _0x1aedae;};}function handleError(_0x2c8d92,_0x404f78){_0x404f78=_0x404f78||0x1f4;return function(_0x5dfca3){logger['error'](_0x5dfca3[_0xaba1('0x2a')]);if(_0x5dfca3[_0xaba1('0x2b')]){delete _0x5dfca3[_0xaba1('0x2b')];}_0x2c8d92[_0xaba1('0x1c')](_0x404f78)[_0xaba1('0x2c')](_0x5dfca3);};}exports[_0xaba1('0x2d')]=function(_0x46f839,_0x22ca92){var _0x2b7653={},_0x188d14={},_0x410a69={'count':0x0,'rows':[]};var _0x1d15f6=_[_0xaba1('0x2e')](db[_0xaba1('0x2f')][_0xaba1('0x30')],function(_0x490656){return{'name':_0x490656[_0xaba1('0x31')],'type':_0x490656[_0xaba1('0x32')]['key']};});_0x188d14['model']=_[_0xaba1('0x2e')](_0x1d15f6,_0xaba1('0x2b'));_0x188d14[_0xaba1('0x33')]=_['keys'](_0x46f839[_0xaba1('0x33')]);_0x188d14['filters']=_[_0xaba1('0x34')](_0x188d14['model'],_0x188d14[_0xaba1('0x33')]);_0x2b7653['attributes']=_['intersection'](_0x188d14[_0xaba1('0x35')],qs[_0xaba1('0x36')](_0x46f839['query']['fields']));_0x2b7653['attributes']=_0x2b7653[_0xaba1('0x37')]['length']?_0x2b7653[_0xaba1('0x37')]:_0x188d14['model'];if(!_0x46f839[_0xaba1('0x33')][_0xaba1('0x38')](_0xaba1('0x39'))){_0x2b7653[_0xaba1('0x20')]=qs[_0xaba1('0x20')](_0x46f839[_0xaba1('0x33')]['limit']);_0x2b7653[_0xaba1('0x1e')]=qs[_0xaba1('0x1e')](_0x46f839[_0xaba1('0x33')]['offset']);}_0x2b7653[_0xaba1('0x3a')]=qs['sort'](_0x46f839[_0xaba1('0x33')][_0xaba1('0x3b')]);_0x2b7653[_0xaba1('0x3c')]=qs[_0xaba1('0x3d')](_[_0xaba1('0x3e')](_0x46f839[_0xaba1('0x33')],_0x188d14[_0xaba1('0x3d')]),_0x1d15f6);if(_0x46f839[_0xaba1('0x33')][_0xaba1('0x3f')]){_0x2b7653[_0xaba1('0x3c')]=_['merge'](_0x2b7653['where'],{'$or':_['map'](_0x1d15f6,function(_0x13a490){if(_0x13a490['type']!==_0xaba1('0x40')){var _0x29b7c2={};_0x29b7c2[_0x13a490[_0xaba1('0x2b')]]={'$like':'%'+_0x46f839[_0xaba1('0x33')]['filter']+'%'};return _0x29b7c2;}})});}_0x2b7653=_['merge']({},_0x2b7653,_0x46f839[_0xaba1('0x41')]);var _0x338480={'where':_0x2b7653[_0xaba1('0x3c')]};return db[_0xaba1('0x2f')][_0xaba1('0x21')](_0x338480)['then'](function(_0x242029){_0x410a69[_0xaba1('0x21')]=_0x242029;if(_0x46f839[_0xaba1('0x33')][_0xaba1('0x42')]){_0x2b7653[_0xaba1('0x43')]=[{'all':!![]}];}return db['FaxApplication'][_0xaba1('0x44')](_0x2b7653);})['then'](function(_0xbbb98e){_0x410a69[_0xaba1('0x45')]=_0xbbb98e;return _0x410a69;})[_0xaba1('0x27')](respondWithFilteredResult(_0x22ca92,_0x2b7653))[_0xaba1('0x46')](handleError(_0x22ca92,null));};exports[_0xaba1('0x47')]=function(_0x161c8a,_0x313a2a){var _0x1825cb={'raw':!![],'where':{'id':_0x161c8a[_0xaba1('0x48')]['id']}},_0xb52ee5={};_0xb52ee5['model']=_[_0xaba1('0x49')](db[_0xaba1('0x2f')]['rawAttributes']);_0xb52ee5['query']=_[_0xaba1('0x49')](_0x161c8a[_0xaba1('0x33')]);_0xb52ee5[_0xaba1('0x3d')]=_[_0xaba1('0x34')](_0xb52ee5['model'],_0xb52ee5['query']);_0x1825cb[_0xaba1('0x37')]=_['intersection'](_0xb52ee5[_0xaba1('0x35')],qs[_0xaba1('0x36')](_0x161c8a[_0xaba1('0x33')][_0xaba1('0x36')]));_0x1825cb['attributes']=_0x1825cb[_0xaba1('0x37')][_0xaba1('0x4a')]?_0x1825cb['attributes']:_0xb52ee5[_0xaba1('0x35')];if(_0x161c8a[_0xaba1('0x33')][_0xaba1('0x42')]){_0x1825cb[_0xaba1('0x43')]=[{'all':!![]}];}_0x1825cb=_['merge']({},_0x1825cb,_0x161c8a[_0xaba1('0x41')]);return db[_0xaba1('0x2f')][_0xaba1('0x4b')](_0x1825cb)[_0xaba1('0x27')](handleEntityNotFound(_0x313a2a,null))['then'](respondWithResult(_0x313a2a,null))[_0xaba1('0x46')](handleError(_0x313a2a,null));};exports[_0xaba1('0x4c')]=function(_0x5d9bc2,_0x2c5c88){return db[_0xaba1('0x2f')]['create'](_0x5d9bc2[_0xaba1('0x4d')],{})[_0xaba1('0x27')](respondWithResult(_0x2c5c88,0xc9))[_0xaba1('0x46')](handleError(_0x2c5c88,null));};exports[_0xaba1('0x26')]=function(_0x500c69,_0x576a09){if(_0x500c69[_0xaba1('0x4d')]['id']){delete _0x500c69[_0xaba1('0x4d')]['id'];}return db[_0xaba1('0x2f')][_0xaba1('0x4b')]({'where':{'id':_0x500c69[_0xaba1('0x48')]['id']}})[_0xaba1('0x27')](handleEntityNotFound(_0x576a09,null))[_0xaba1('0x27')](saveUpdates(_0x500c69[_0xaba1('0x4d')],null))[_0xaba1('0x27')](respondWithResult(_0x576a09,null))['catch'](handleError(_0x576a09,null));};exports[_0xaba1('0x28')]=function(_0x436e08,_0x2854ad){return db[_0xaba1('0x2f')][_0xaba1('0x4b')]({'where':{'id':_0x436e08[_0xaba1('0x48')]['id']}})[_0xaba1('0x27')](handleEntityNotFound(_0x2854ad,null))[_0xaba1('0x27')](removeEntity(_0x2854ad,null))[_0xaba1('0x46')](handleError(_0x2854ad,null));}; \ No newline at end of file +var _0x4c25=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','fast-json-patch','mustache','util','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse'];(function(_0x2e8613,_0x4b6256){var _0x1f85c0=function(_0x5a2e40){while(--_0x5a2e40){_0x2e8613['push'](_0x2e8613['shift']());}};_0x1f85c0(++_0x4b6256);}(_0x4c25,0x106));var _0x54c2=function(_0x22d667,_0x4ab6f6){_0x22d667=_0x22d667-0x0;var _0xc8eba0=_0x4c25[_0x22d667];return _0xc8eba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54c2('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54c2('0x1'));var util=require(_0x54c2('0x2'));var path=require('path');var sox=require(_0x54c2('0x3'));var csv=require('to-csv');var ejs=require(_0x54c2('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54c2('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x54c2('0x6'));var deskjs=require('desk.js');var toCsv=require(_0x54c2('0x7'));var querystring=require(_0x54c2('0x8'));var Papa=require(_0x54c2('0x9'));var Redis=require(_0x54c2('0xa'));var authService=require(_0x54c2('0xb'));var qs=require(_0x54c2('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54c2('0xd'));var logger=require(_0x54c2('0xe'))('api');var utils=require(_0x54c2('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54c2('0x10'))['db'];function respondWithStatusCode(_0x308059,_0x56c51b){_0x56c51b=_0x56c51b||0xcc;return function(_0x2d85c5){if(_0x2d85c5){return _0x308059['sendStatus'](_0x56c51b);}return _0x308059[_0x54c2('0x11')](_0x56c51b)[_0x54c2('0x12')]();};}function respondWithResult(_0xbeb82d,_0x576cc7){_0x576cc7=_0x576cc7||0xc8;return function(_0x5c43b2){if(_0x5c43b2){return _0xbeb82d[_0x54c2('0x11')](_0x576cc7)[_0x54c2('0x13')](_0x5c43b2);}};}function respondWithFilteredResult(_0x5eb7a1,_0x28bf2a){return function(_0x3f91bc){if(_0x3f91bc){var _0x15f059=typeof _0x28bf2a[_0x54c2('0x14')]===_0x54c2('0x15')&&typeof _0x28bf2a[_0x54c2('0x16')]===_0x54c2('0x15');var _0x46f485=_0x3f91bc[_0x54c2('0x17')];var _0x52241b=_0x15f059?0x0:_0x28bf2a[_0x54c2('0x14')];var _0x43cf48=_0x15f059?_0x3f91bc[_0x54c2('0x17')]:_0x28bf2a[_0x54c2('0x14')]+_0x28bf2a['limit'];var _0x4480b3;if(_0x43cf48>=_0x46f485){_0x43cf48=_0x46f485;_0x4480b3=0xc8;}else{_0x4480b3=0xce;}_0x5eb7a1[_0x54c2('0x11')](_0x4480b3);return _0x5eb7a1[_0x54c2('0x18')](_0x54c2('0x19'),_0x52241b+'-'+_0x43cf48+'/'+_0x46f485)[_0x54c2('0x13')](_0x3f91bc);}return null;};}function patchUpdates(_0x403d34){return function(_0x41d742){try{jsonpatch[_0x54c2('0x1a')](_0x41d742,_0x403d34,!![]);}catch(_0x33cbeb){return BPromise[_0x54c2('0x1b')](_0x33cbeb);}return _0x41d742['save']();};}function saveUpdates(_0x2f5638,_0x46ecbe){return function(_0xfd53bf){if(_0xfd53bf){return _0xfd53bf[_0x54c2('0x1c')](_0x2f5638)[_0x54c2('0x1d')](function(_0x4860b9){return _0x4860b9;});}return null;};}function removeEntity(_0x1e673b,_0x1d27ca){return function(_0x1ef9dc){if(_0x1ef9dc){return _0x1ef9dc[_0x54c2('0x1e')]()[_0x54c2('0x1d')](function(){_0x1e673b[_0x54c2('0x11')](0xcc)[_0x54c2('0x12')]();});}};}function handleEntityNotFound(_0x752f2e,_0x3e7780){return function(_0x1de644){if(!_0x1de644){_0x752f2e[_0x54c2('0x1f')](0x194);}return _0x1de644;};}function handleError(_0x532f03,_0x499e0d){_0x499e0d=_0x499e0d||0x1f4;return function(_0x36cce4){logger[_0x54c2('0x20')](_0x36cce4['stack']);if(_0x36cce4[_0x54c2('0x21')]){delete _0x36cce4['name'];}_0x532f03[_0x54c2('0x11')](_0x499e0d)[_0x54c2('0x22')](_0x36cce4);};}exports[_0x54c2('0x23')]=function(_0x4db615,_0x509dd7){var _0x18c6b4={},_0xae3632={},_0x566a1f={'count':0x0,'rows':[]};var _0x1166cb=_[_0x54c2('0x24')](db[_0x54c2('0x25')][_0x54c2('0x26')],function(_0x1fc72b){return{'name':_0x1fc72b[_0x54c2('0x27')],'type':_0x1fc72b[_0x54c2('0x28')][_0x54c2('0x29')]};});_0xae3632[_0x54c2('0x2a')]=_['map'](_0x1166cb,'name');_0xae3632[_0x54c2('0x2b')]=_[_0x54c2('0x2c')](_0x4db615[_0x54c2('0x2b')]);_0xae3632[_0x54c2('0x2d')]=_[_0x54c2('0x2e')](_0xae3632[_0x54c2('0x2a')],_0xae3632['query']);_0x18c6b4[_0x54c2('0x2f')]=_[_0x54c2('0x2e')](_0xae3632['model'],qs[_0x54c2('0x30')](_0x4db615[_0x54c2('0x2b')]['fields']));_0x18c6b4[_0x54c2('0x2f')]=_0x18c6b4[_0x54c2('0x2f')][_0x54c2('0x31')]?_0x18c6b4[_0x54c2('0x2f')]:_0xae3632['model'];if(!_0x4db615[_0x54c2('0x2b')]['hasOwnProperty'](_0x54c2('0x32'))){_0x18c6b4[_0x54c2('0x16')]=qs[_0x54c2('0x16')](_0x4db615[_0x54c2('0x2b')][_0x54c2('0x16')]);_0x18c6b4[_0x54c2('0x14')]=qs['offset'](_0x4db615['query']['offset']);}_0x18c6b4[_0x54c2('0x33')]=qs['sort'](_0x4db615[_0x54c2('0x2b')][_0x54c2('0x34')]);_0x18c6b4[_0x54c2('0x35')]=qs[_0x54c2('0x2d')](_[_0x54c2('0x36')](_0x4db615[_0x54c2('0x2b')],_0xae3632[_0x54c2('0x2d')]),_0x1166cb);if(_0x4db615[_0x54c2('0x2b')][_0x54c2('0x37')]){_0x18c6b4['where']=_[_0x54c2('0x38')](_0x18c6b4['where'],{'$or':_[_0x54c2('0x24')](_0x1166cb,function(_0x138441){if(_0x138441[_0x54c2('0x28')]!==_0x54c2('0x39')){var _0x2c809b={};_0x2c809b[_0x138441[_0x54c2('0x21')]]={'$like':'%'+_0x4db615['query'][_0x54c2('0x37')]+'%'};return _0x2c809b;}})});}_0x18c6b4=_[_0x54c2('0x38')]({},_0x18c6b4,_0x4db615[_0x54c2('0x3a')]);var _0x293707={'where':_0x18c6b4[_0x54c2('0x35')]};return db[_0x54c2('0x25')]['count'](_0x293707)[_0x54c2('0x1d')](function(_0x5f5348){_0x566a1f[_0x54c2('0x17')]=_0x5f5348;if(_0x4db615[_0x54c2('0x2b')][_0x54c2('0x3b')]){_0x18c6b4[_0x54c2('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x54c2('0x3d')](_0x18c6b4);})[_0x54c2('0x1d')](function(_0x556608){_0x566a1f['rows']=_0x556608;return _0x566a1f;})['then'](respondWithFilteredResult(_0x509dd7,_0x18c6b4))[_0x54c2('0x3e')](handleError(_0x509dd7,null));};exports[_0x54c2('0x3f')]=function(_0x73dc8c,_0x591126){var _0x35dc6b={'raw':!![],'where':{'id':_0x73dc8c['params']['id']}},_0x508910={};_0x508910[_0x54c2('0x2a')]=_[_0x54c2('0x2c')](db[_0x54c2('0x25')]['rawAttributes']);_0x508910['query']=_[_0x54c2('0x2c')](_0x73dc8c[_0x54c2('0x2b')]);_0x508910[_0x54c2('0x2d')]=_[_0x54c2('0x2e')](_0x508910[_0x54c2('0x2a')],_0x508910['query']);_0x35dc6b[_0x54c2('0x2f')]=_[_0x54c2('0x2e')](_0x508910[_0x54c2('0x2a')],qs[_0x54c2('0x30')](_0x73dc8c['query'][_0x54c2('0x30')]));_0x35dc6b['attributes']=_0x35dc6b[_0x54c2('0x2f')][_0x54c2('0x31')]?_0x35dc6b['attributes']:_0x508910[_0x54c2('0x2a')];if(_0x73dc8c[_0x54c2('0x2b')][_0x54c2('0x3b')]){_0x35dc6b[_0x54c2('0x3c')]=[{'all':!![]}];}_0x35dc6b=_['merge']({},_0x35dc6b,_0x73dc8c[_0x54c2('0x3a')]);return db['FaxApplication'][_0x54c2('0x40')](_0x35dc6b)[_0x54c2('0x1d')](handleEntityNotFound(_0x591126,null))['then'](respondWithResult(_0x591126,null))[_0x54c2('0x3e')](handleError(_0x591126,null));};exports['create']=function(_0x1ce198,_0x24d863){return db[_0x54c2('0x25')][_0x54c2('0x41')](_0x1ce198['body'],{})[_0x54c2('0x1d')](respondWithResult(_0x24d863,0xc9))[_0x54c2('0x3e')](handleError(_0x24d863,null));};exports[_0x54c2('0x1c')]=function(_0x2846be,_0x32dc8e){if(_0x2846be[_0x54c2('0x42')]['id']){delete _0x2846be[_0x54c2('0x42')]['id'];}return db[_0x54c2('0x25')][_0x54c2('0x40')]({'where':{'id':_0x2846be[_0x54c2('0x43')]['id']}})[_0x54c2('0x1d')](handleEntityNotFound(_0x32dc8e,null))['then'](saveUpdates(_0x2846be[_0x54c2('0x42')],null))[_0x54c2('0x1d')](respondWithResult(_0x32dc8e,null))[_0x54c2('0x3e')](handleError(_0x32dc8e,null));};exports[_0x54c2('0x1e')]=function(_0x4d7e6c,_0x1ce518){return db[_0x54c2('0x25')][_0x54c2('0x40')]({'where':{'id':_0x4d7e6c[_0x54c2('0x43')]['id']}})[_0x54c2('0x1d')](handleEntityNotFound(_0x1ce518,null))[_0x54c2('0x1d')](removeEntity(_0x1ce518,null))[_0x54c2('0x3e')](handleError(_0x1ce518,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 8014371..c4dc6d7 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 _0xd9dc=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x581f9a,_0x32f3c1){var _0x2c1b9d=function(_0x36a588){while(--_0x36a588){_0x581f9a['push'](_0x581f9a['shift']());}};_0x2c1b9d(++_0x32f3c1);}(_0xd9dc,0x16f));var _0xcd9d=function(_0x1d3ece,_0x556172){_0x1d3ece=_0x1d3ece-0x0;var _0x2feba1=_0xd9dc[_0x1d3ece];return _0x2feba1;};'use strict';var _=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var logger=require('../../config/logger')(_0xcd9d('0x2'));var moment=require('moment');var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var attributes=require(_0xcd9d('0x7'));module[_0xcd9d('0x8')]=function(_0x345803,_0xe4b7f9){return _0x345803[_0xcd9d('0x9')](_0xcd9d('0xa'),attributes,{'tableName':_0xcd9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd9d('0xc'),'collate':_0xcd9d('0xd')});}; \ No newline at end of file +var _0x0889=['../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x0889,0x103));var _0x9088=function(_0x2da0f6,_0x3986fb){_0x2da0f6=_0x2da0f6-0x0;var _0x53ebeb=_0x0889[_0x2da0f6];return _0x53ebeb;};'use strict';var _=require(_0x9088('0x0'));var util=require(_0x9088('0x1'));var logger=require(_0x9088('0x2'))(_0x9088('0x3'));var moment=require('moment');var BPromise=require(_0x9088('0x4'));var rp=require(_0x9088('0x5'));var fs=require('fs');var path=require(_0x9088('0x6'));var rimraf=require('rimraf');var config=require(_0x9088('0x7'));var attributes=require(_0x9088('0x8'));module[_0x9088('0x9')]=function(_0x5b9a8a,_0xe92e73){return _0x5b9a8a[_0x9088('0xa')](_0x9088('0xb'),attributes,{'tableName':_0x9088('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9088('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c1fd412..eef4a8b 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 _0x3239=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','body','options','where','limit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3239,0xcc));var _0x9323=function(_0x3f85ab,_0x4f5199){_0x3f85ab=_0x3f85ab-0x0;var _0x3cd439=_0x3239[_0x3f85ab];return _0x3cd439;};'use strict';var _=require(_0x9323('0x0'));var util=require(_0x9323('0x1'));var moment=require(_0x9323('0x2'));var BPromise=require(_0x9323('0x3'));var rs=require(_0x9323('0x4'));var fs=require('fs');var Redis=require(_0x9323('0x5'));var db=require(_0x9323('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9323('0x7'))(_0x9323('0x8'));var config=require(_0x9323('0x9'));var jayson=require(_0x9323('0xa'));var client=jayson[_0x9323('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1137be,_0x514982,_0x58ff8a){return new BPromise(function(_0x1b0dd4,_0x3cc9f3){return client['request'](_0x1137be,_0x58ff8a)[_0x9323('0xc')](function(_0x4f6857){logger[_0x9323('0xd')](_0x9323('0xe'),_0x514982,_0x9323('0xf'));logger[_0x9323('0x10')](_0x9323('0x11'),_0x514982,_0x9323('0xf'),JSON['stringify'](_0x4f6857));if(_0x4f6857['error']){if(_0x4f6857[_0x9323('0x12')][_0x9323('0x13')]===0x1f4){logger[_0x9323('0x12')](_0x9323('0xe'),_0x514982,_0x4f6857['error']['message']);return _0x3cc9f3(_0x4f6857[_0x9323('0x12')][_0x9323('0x14')]);}logger[_0x9323('0x12')](_0x9323('0xe'),_0x514982,_0x4f6857[_0x9323('0x12')][_0x9323('0x14')]);return _0x1b0dd4(_0x4f6857[_0x9323('0x12')][_0x9323('0x14')]);}else{logger[_0x9323('0xd')](_0x9323('0xe'),_0x514982,_0x9323('0xf'));_0x1b0dd4(_0x4f6857[_0x9323('0x15')][_0x9323('0x14')]);}})[_0x9323('0x16')](function(_0x1c79f6){logger['error'](_0x9323('0xe'),_0x514982,_0x1c79f6);_0x3cc9f3(_0x1c79f6);});});}exports[_0x9323('0x17')]=function(_0x341ea4){var _0x11ced2=this;return new Promise(function(_0x579bc4,_0x417bd2){return db['FaxApplication']['update'](_0x341ea4[_0x9323('0x18')],{'raw':_0x341ea4[_0x9323('0x19')]?_0x341ea4[_0x9323('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x341ea4[_0x9323('0x19')]?_0x341ea4[_0x9323('0x19')][_0x9323('0x1a')]||null:null,'attributes':_0x341ea4[_0x9323('0x19')]?_0x341ea4[_0x9323('0x19')]['attributes']||null:null,'limit':_0x341ea4['options']?_0x341ea4[_0x9323('0x19')][_0x9323('0x1b')]||null:null})['then'](function(_0x3097c8){logger[_0x9323('0xd')](_0x9323('0x17'),_0x341ea4);logger[_0x9323('0x10')](_0x9323('0x17'),_0x341ea4,JSON[_0x9323('0x1c')](_0x3097c8));_0x579bc4(_0x3097c8);})[_0x9323('0x16')](function(_0x26061){logger[_0x9323('0x12')](_0x9323('0x17'),_0x26061['message'],_0x341ea4);_0x417bd2(_0x11ced2[_0x9323('0x12')](0x1f4,_0x26061[_0x9323('0x14')]));});});}; \ No newline at end of file +var _0x9bb9=['http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9bb9,0x84));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x99bb('0x0'));var util=require(_0x99bb('0x1'));var moment=require('moment');var BPromise=require(_0x99bb('0x2'));var rs=require(_0x99bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99bb('0x4'));var logger=require(_0x99bb('0x5'))(_0x99bb('0x6'));var config=require('../../config/environment');var jayson=require(_0x99bb('0x7'));var client=jayson['client'][_0x99bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c16a1,_0x43e721,_0x3c5da2){return new BPromise(function(_0x36e625,_0x3cb654){return client[_0x99bb('0x9')](_0x1c16a1,_0x3c5da2)[_0x99bb('0xa')](function(_0x478767){logger['info']('FaxApplication,\x20%s,\x20%s',_0x43e721,_0x99bb('0xb'));logger[_0x99bb('0xc')](_0x99bb('0xd'),_0x43e721,_0x99bb('0xb'),JSON[_0x99bb('0xe')](_0x478767));if(_0x478767[_0x99bb('0xf')]){if(_0x478767[_0x99bb('0xf')][_0x99bb('0x10')]===0x1f4){logger['error'](_0x99bb('0x11'),_0x43e721,_0x478767[_0x99bb('0xf')]['message']);return _0x3cb654(_0x478767['error'][_0x99bb('0x12')]);}logger[_0x99bb('0xf')](_0x99bb('0x11'),_0x43e721,_0x478767[_0x99bb('0xf')]['message']);return _0x36e625(_0x478767[_0x99bb('0xf')]['message']);}else{logger[_0x99bb('0x13')](_0x99bb('0x11'),_0x43e721,_0x99bb('0xb'));_0x36e625(_0x478767[_0x99bb('0x14')][_0x99bb('0x12')]);}})[_0x99bb('0x15')](function(_0x612338){logger[_0x99bb('0xf')](_0x99bb('0x11'),_0x43e721,_0x612338);_0x3cb654(_0x612338);});});}exports[_0x99bb('0x16')]=function(_0x3bd64a){var _0x523902=this;return new Promise(function(_0x32fd8b,_0x21c467){return db[_0x99bb('0x17')]['update'](_0x3bd64a['body'],{'raw':_0x3bd64a['options']?_0x3bd64a[_0x99bb('0x18')][_0x99bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bd64a[_0x99bb('0x18')]?_0x3bd64a['options'][_0x99bb('0x1a')]||null:null,'attributes':_0x3bd64a[_0x99bb('0x18')]?_0x3bd64a[_0x99bb('0x18')][_0x99bb('0x1b')]||null:null,'limit':_0x3bd64a[_0x99bb('0x18')]?_0x3bd64a[_0x99bb('0x18')]['limit']||null:null})['then'](function(_0x164f06){logger[_0x99bb('0x13')](_0x99bb('0x16'),_0x3bd64a);logger[_0x99bb('0xc')]('UpdateFaxApplication',_0x3bd64a,JSON[_0x99bb('0xe')](_0x164f06));_0x32fd8b(_0x164f06);})[_0x99bb('0x15')](function(_0x35fcb5){logger[_0x99bb('0xf')](_0x99bb('0x16'),_0x35fcb5[_0x99bb('0x12')],_0x3bd64a);_0x21c467(_0x523902[_0x99bb('0xf')](0x1f4,_0x35fcb5[_0x99bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 29c7051..62f8d6a 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 _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefda,0x96));var _0xaefd=function(_0x12de45,_0x320962){_0x12de45=_0x12de45-0x0;var _0xf14ba5=_0xefda[_0x12de45];return _0xf14ba5;};'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['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file +var _0x6cb4=['get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated'];(function(_0x578c1f,_0x3b2de0){var _0x15dadc=function(_0x4d982a){while(--_0x4d982a){_0x578c1f['push'](_0x578c1f['shift']());}};_0x15dadc(++_0x3b2de0);}(_0x6cb4,0xff));var _0x46cb=function(_0xb5be44,_0x475bc0){_0xb5be44=_0xb5be44-0x0;var _0x25651f=_0x6cb4[_0xb5be44];return _0x25651f;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xe')]('/',auth[_0x46cb('0xa')](),controller['create']);router[_0x46cb('0xf')](_0x46cb('0xc'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x11')]('/:id',auth[_0x46cb('0xa')](),controller[_0x46cb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e16f6ef..40b5ddf 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 _0x1822=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x55f190,_0x4235cd){var _0x27f517=function(_0xf70cbf){while(--_0xf70cbf){_0x55f190['push'](_0x55f190['shift']());}};_0x27f517(++_0x4235cd);}(_0x1822,0x11f));var _0x2182=function(_0x2d2d29,_0xe91ee7){_0x2d2d29=_0x2d2d29-0x0;var _0x19f7c5=_0x1822[_0x2d2d29];return _0x19f7c5;};'use strict';var Sequelize=require(_0x2182('0x0'));module[_0x2182('0x1')]={'closed':{'type':Sequelize[_0x2182('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2182('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2182('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2182('0x4')]},'note':{'type':Sequelize[_0x2182('0x4')]},'read1stAt':{'type':Sequelize[_0x2182('0x3')]},'fax':{'type':Sequelize[_0x2182('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2182('0x5')]('in',_0x2182('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x11d0=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xa2d11,_0x5b7f27){var _0x103a96=function(_0x3f83ff){while(--_0x3f83ff){_0xa2d11['push'](_0xa2d11['shift']());}};_0x103a96(++_0x5b7f27);}(_0x11d0,0x76));var _0x011d=function(_0xe2deca,_0x395b70){_0xe2deca=_0xe2deca-0x0;var _0x1cbf79=_0x11d0[_0xe2deca];return _0x1cbf79;};'use strict';var Sequelize=require(_0x011d('0x0'));module[_0x011d('0x1')]={'closed':{'type':Sequelize[_0x011d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x011d('0x3')]},'disposition':{'type':Sequelize[_0x011d('0x4')]},'secondDisposition':{'type':Sequelize[_0x011d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x011d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x011d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x011d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x011d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x011d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index e659eda..33b05b1 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 _0xcab8=['split','forEach','push','catch','talking','answered','unmanaged','total','UserId','waiting','closed','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','type','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','FaxInteraction','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','merge','options','create','body','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','nolimit','format','includeAll','include','findAll','addTags','setTags','omit','spread','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcab8,0xa2));var _0x8cab=function(_0x6b819f,_0x2a4fb2){_0x6b819f=_0x6b819f-0x0;var _0x306000=_0xcab8[_0x6b819f];return _0x306000;};'use strict';var emlformat=require(_0x8cab('0x0'));var rimraf=require(_0x8cab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cab('0x2'));var rp=require(_0x8cab('0x3'));var moment=require(_0x8cab('0x4'));var BPromise=require(_0x8cab('0x5'));var Mustache=require(_0x8cab('0x6'));var util=require(_0x8cab('0x7'));var path=require(_0x8cab('0x8'));var sox=require(_0x8cab('0x9'));var csv=require(_0x8cab('0xa'));var ejs=require(_0x8cab('0xb'));var fs=require('fs');var fs_extra=require(_0x8cab('0xc'));var _=require(_0x8cab('0xd'));var squel=require(_0x8cab('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cab('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8cab('0xf'));var authService=require(_0x8cab('0x10'));var qs=require(_0x8cab('0x11'));var as=require(_0x8cab('0x12'));var hardwareService=require(_0x8cab('0x13'));var logger=require('../../config/logger')(_0x8cab('0x14'));var utils=require(_0x8cab('0x15'));var config=require(_0x8cab('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cab('0x17'))['db'];config[_0x8cab('0x18')]=_[_0x8cab('0x19')](config[_0x8cab('0x18')],{'host':_0x8cab('0x1a'),'port':0x18eb});var socket=require(_0x8cab('0x1b'))(new Redis(config[_0x8cab('0x18')]));require(_0x8cab('0x1c'))['register'](socket);function respondWithStatusCode(_0x4c13a4,_0x32a2ee){_0x32a2ee=_0x32a2ee||0xcc;return function(_0x2b0ff6){if(_0x2b0ff6){return _0x4c13a4[_0x8cab('0x1d')](_0x32a2ee);}return _0x4c13a4['status'](_0x32a2ee)[_0x8cab('0x1e')]();};}function respondWithResult(_0x5eb31d,_0x4fd757){_0x4fd757=_0x4fd757||0xc8;return function(_0x53d601){if(_0x53d601){return _0x5eb31d[_0x8cab('0x1f')](_0x4fd757)['json'](_0x53d601);}};}function respondWithFilteredResult(_0x353fd8,_0x1a032a){return function(_0x442d96){if(_0x442d96){var _0x23ea27=typeof _0x1a032a[_0x8cab('0x20')]===_0x8cab('0x21')&&typeof _0x1a032a[_0x8cab('0x22')]==='undefined';var _0x2e618d=_0x442d96[_0x8cab('0x23')];var _0x462748=_0x23ea27?0x0:_0x1a032a[_0x8cab('0x20')];var _0x1d142f=_0x23ea27?_0x442d96['count']:_0x1a032a[_0x8cab('0x20')]+_0x1a032a[_0x8cab('0x22')];var _0x4f04a2;if(_0x1d142f>=_0x2e618d){_0x1d142f=_0x2e618d;_0x4f04a2=0xc8;}else{_0x4f04a2=0xce;}_0x353fd8['status'](_0x4f04a2);return _0x353fd8[_0x8cab('0x24')](_0x8cab('0x25'),_0x462748+'-'+_0x1d142f+'/'+_0x2e618d)[_0x8cab('0x26')](_0x442d96);}return null;};}function patchUpdates(_0x5cfd32){return function(_0x18b72a){try{jsonpatch['apply'](_0x18b72a,_0x5cfd32,!![]);}catch(_0xb67576){return BPromise['reject'](_0xb67576);}return _0x18b72a['save']();};}function saveUpdates(_0x2d1cc4,_0x477aab){return function(_0x40fa3c){if(_0x40fa3c){return _0x40fa3c['update'](_0x2d1cc4)[_0x8cab('0x27')](function(_0x167536){return _0x167536;});}return null;};}function removeEntity(_0x1f997c,_0x5ce4dd){return function(_0x30dfc0){if(_0x30dfc0){return _0x30dfc0[_0x8cab('0x28')]()['then'](function(){_0x1f997c[_0x8cab('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b90c5,_0x381d7b){return function(_0x4957bc){if(!_0x4957bc){_0x2b90c5[_0x8cab('0x1d')](0x194);}return _0x4957bc;};}function handleError(_0x30f964,_0x578c52){_0x578c52=_0x578c52||0x1f4;return function(_0xa23f44){logger[_0x8cab('0x29')](_0xa23f44[_0x8cab('0x2a')]);if(_0xa23f44[_0x8cab('0x2b')]){delete _0xa23f44[_0x8cab('0x2b')];}_0x30f964[_0x8cab('0x1f')](_0x578c52)[_0x8cab('0x2c')](_0xa23f44);};}function getInteractionUsers(_0x36f6fd,_0x166fac){return new BPromise(function(_0x53d874,_0x27bd6f){try{if(_0x166fac[_0x36f6fd['id']]){_0x36f6fd[_0x8cab('0x2d')]=_[_0x8cab('0x2e')](_0x166fac[_0x36f6fd['id']],function(_0x3e6fc6){return{'id':_0x3e6fc6['id'],'fullname':_0x3e6fc6[_0x8cab('0x2f')]};});}}catch(_0x7038bc){_0x27bd6f(_0x7038bc);}_0x53d874(_0x36f6fd);});}function getInteractionTags(_0x1a635a,_0x2d38e8){return new BPromise(function(_0x1a4bb4,_0xb606d4){try{if(_0x1a635a[_0x8cab('0x30')]){_0x1a635a[_0x8cab('0x31')]=[];_0x1a635a[_0x8cab('0x30')][_0x8cab('0x32')](',')[_0x8cab('0x33')](function(_0x310a6e){_0x1a635a[_0x8cab('0x31')][_0x8cab('0x34')](_0x2d38e8[_0x310a6e]);});}delete _0x1a635a[_0x8cab('0x30')];}catch(_0x2c71a6){_0xb606d4(_0x2c71a6);}_0x1a4bb4(_0x1a635a);});}function updateFaxInteraction(_0x5fd3e0,_0x33ad7c,_0x4960aa){return new BPromise(function(_0x461af0,_0x167d3c){return getInteractionUsers(_0x5fd3e0,_0x4960aa)[_0x8cab('0x27')](function(_0x3df813){return getInteractionTags(_0x3df813,_0x33ad7c);})['then'](function(_0x5de217){return getStateInteraction(_0x5de217);})['then'](function(_0x18d22c){_0x461af0(_0x18d22c);})[_0x8cab('0x35')](function(_0x17cd1b){_0x167d3c(_0x17cd1b);});});}function getStateInteraction(_0x537507){return new BPromise(function(_0x2ed807){_0x537507['waiting']=0x0;_0x537507[_0x8cab('0x36')]=0x0;_0x537507[_0x8cab('0x37')]=0x0;_0x537507[_0x8cab('0x38')]=0x0;_0x537507[_0x8cab('0x39')]=0x0;if(!_0x537507['closed']&&!_0x537507[_0x8cab('0x3a')]){_0x537507['waiting']+=0x1;}if(!_0x537507['closed']&&_0x537507[_0x8cab('0x3a')]){_0x537507['talking']+=0x1;if(_0x537507[_0x8cab('0x3b')]){_0x537507[_0x8cab('0x3b')]-=0x1;}}if(_0x537507[_0x8cab('0x3c')]&&_0x537507['UserId']){_0x537507['answered']+=0x1;if(_0x537507['talking']){_0x537507[_0x8cab('0x36')]-=0x1;}}if(_0x537507[_0x8cab('0x3c')]&&!_0x537507[_0x8cab('0x3a')]){_0x537507[_0x8cab('0x38')]+=0x1;if(_0x537507[_0x8cab('0x3b')]){_0x537507[_0x8cab('0x3b')]-=0x1;}}_0x537507[_0x8cab('0x39')]+=0x1;_0x2ed807(_0x537507);});}exports['index']=function(_0x7bdfe5,_0xa2c62){var _0x3510ac={},_0x49ef5e={},_0x29df51={'count':0x0,'rows':[]};var _0xa71277=_[_0x8cab('0x2e')](db['FaxInteraction'][_0x8cab('0x3d')],function(_0x367678){return{'name':_0x367678['fieldName'],'type':_0x367678['type'][_0x8cab('0x3e')]};});_0x49ef5e[_0x8cab('0x3f')]=_[_0x8cab('0x2e')](_0xa71277,'name');_0x49ef5e[_0x8cab('0x40')]=_[_0x8cab('0x41')](_0x7bdfe5[_0x8cab('0x40')]);_0x49ef5e[_0x8cab('0x42')]=_[_0x8cab('0x43')](_0x49ef5e['model'],_0x49ef5e['query']);_0x3510ac[_0x8cab('0x44')]=_['intersection'](_0x49ef5e[_0x8cab('0x3f')],qs[_0x8cab('0x45')](_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x45')]));_0x3510ac[_0x8cab('0x44')]=_0x3510ac['attributes'][_0x8cab('0x46')]?_0x3510ac[_0x8cab('0x44')]:_0x49ef5e[_0x8cab('0x3f')];if(!_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x47')]('nolimit')){_0x3510ac[_0x8cab('0x22')]=qs['limit'](_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x22')]);_0x3510ac[_0x8cab('0x20')]=qs[_0x8cab('0x20')](_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x20')]);}_0x3510ac[_0x8cab('0x48')]=qs[_0x8cab('0x49')](_0x7bdfe5['query'][_0x8cab('0x49')]);_0x3510ac[_0x8cab('0x4a')]=qs[_0x8cab('0x42')](_[_0x8cab('0x4b')](_0x7bdfe5[_0x8cab('0x40')],_0x49ef5e[_0x8cab('0x42')]),_0xa71277);var _0x47be9a=[];var _0x3cbcb3=squel['select']()['field']('id')[_0x8cab('0x4c')](_0x8cab('0x2b'))['field'](_0x8cab('0x4d'))[_0x8cab('0x4e')]('tools_tags');var _0x404b9a=squel[_0x8cab('0x4f')]()['field'](_0x8cab('0x50'))['field'](_0x8cab('0x51'))['field'](_0x8cab('0x52'))[_0x8cab('0x4e')](_0x8cab('0x53'),'ui')[_0x8cab('0x54')](_0x8cab('0x55'),'u','u.id\x20=\x20ui.UserId');var _0xf92986=squel['select']()[_0x8cab('0x4e')]('fax_interactions','i')[_0x8cab('0x54')](_0x8cab('0x56'),'c',_0x8cab('0x57'))[_0x8cab('0x54')](_0x8cab('0x55'),'o',_0x8cab('0x58'))[_0x8cab('0x54')]('fax_accounts','a',_0x8cab('0x59'))[_0x8cab('0x54')](_0x8cab('0x5a'),'me',_0x8cab('0x5b'))[_0x8cab('0x54')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x8cab('0x54')](_0x8cab('0x5c'),'t',_0x8cab('0x5d'));var _0x40ec18=squel[_0x8cab('0x5e')]();var _0x17f726=[];var _0x4250f7=squel[_0x8cab('0x5e')]();var _0x394d77;if(_0x7bdfe5[_0x8cab('0x40')]['search']){_0x394d77=as[_0x8cab('0x5f')](_0x7bdfe5[_0x8cab('0x40')]['search']);var _0x23bcb4=_0x394d77['sqlOperator'];for(var _0x18bd3e=0x0;_0x18bd3e<_0x394d77[_0x8cab('0x60')][_0x8cab('0x46')];_0x18bd3e++){var _0x4c4446=_0x394d77['conditions'][_0x18bd3e];var _0x5e11fe='i';var _0x1867be=_[_0x8cab('0x61')](_0xa71277,['name',_0x4c4446[_0x8cab('0x4c')]]);if(!_0x1867be){switch(_0x4c4446[_0x8cab('0x4c')]){case _0x8cab('0x62'):if(_0x4c4446[_0x8cab('0x63')]==0x1){_0xf92986['having']('`'+_0x4c4446[_0x8cab('0x4c')]+_0x8cab('0x64'));}else{_0xf92986[_0x8cab('0x65')]('`'+_0x4c4446[_0x8cab('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x4c4446[_0x8cab('0x66')]===_0x8cab('0x67')){if(_0x4c4446[_0x8cab('0x63')][_0x8cab('0x32')]('\x20')[_0x8cab('0x46')]>0x1){_0x40ec18[_0x23bcb4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4c4446['value']),null);}else{var _0x35ee9e='%'+_0x4c4446[_0x8cab('0x63')]+'%';_0x40ec18[_0x23bcb4](_0x8cab('0x68'),_0x35ee9e,_0x35ee9e,_0x35ee9e);}}else{_0x1867be=_[_0x8cab('0x61')](_0xa71277,['name','ContactId']);_0x4c4446['field']=_0x8cab('0x69');_0x218e12=as[_0x8cab('0x6a')](_0x5e11fe,_0x1867be['type'],_0x4c4446);_0x40ec18[_0x23bcb4](_0x218e12[_0x8cab('0x6b')],_0x218e12[_0x8cab('0x63')][_0x8cab('0x6c')],_0x218e12['value'][_0x8cab('0x1e')]);}break;case _0x8cab('0x6d'):var _0x2640ee=_0x4c4446['value'][_0x8cab('0x32')](',')['map'](function(_0x1397c2){return Number(_0x1397c2);});_0x2640ee['forEach'](function(_0x3d5064){_0x4250f7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d5064+',%');});_0x17f726=_[_0x8cab('0x6e')](_0x17f726,_0x2640ee);break;case _0x8cab('0x6f'):if(_0x4c4446[_0x8cab('0x66')]===_0x8cab('0x67')){_0x40ec18[_0x23bcb4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c4446['value']+'%',null);}else{_0x1867be=_[_0x8cab('0x61')](_0xa71277,[_0x8cab('0x2b'),_0x8cab('0x3a')]);_0x4c4446[_0x8cab('0x4c')]=_0x8cab('0x3a');_0x218e12=as[_0x8cab('0x6a')](_0x5e11fe,_0x1867be[_0x8cab('0x70')],_0x4c4446);_0x40ec18[_0x23bcb4](_0x218e12['text'],_0x218e12[_0x8cab('0x63')][_0x8cab('0x6c')],_0x218e12[_0x8cab('0x63')][_0x8cab('0x1e')]);}break;case'body':_0x218e12=as[_0x8cab('0x6a')]('me',null,_0x4c4446);_0x40ec18[_0x23bcb4](_0x218e12[_0x8cab('0x6b')],_0x218e12['value'][_0x8cab('0x6c')],_0x218e12[_0x8cab('0x63')]['end']);break;}}else{var _0x218e12=as[_0x8cab('0x6a')](_0x5e11fe,_0x1867be[_0x8cab('0x70')],_0x4c4446);_0x40ec18[_0x23bcb4](_0x218e12[_0x8cab('0x6b')],_0x218e12[_0x8cab('0x63')]['start'],_0x218e12[_0x8cab('0x63')][_0x8cab('0x1e')]);}}}else{var _0xfa25d=_(_0x7bdfe5['query'])['keys']()[_0x8cab('0x2e')](function(_0x44cae3){return _[_0x8cab('0x71')](_0xa71277,[_0x8cab('0x2b'),_0x44cae3])?_0x44cae3:undefined;})['compact']()[_0x8cab('0x63')]();if(!_[_0x8cab('0x72')](_0xfa25d)){_0xfa25d[_0x8cab('0x33')](function(_0x2606a1){if(_0x2606a1===_0x8cab('0x73')){_0xf92986[_0x8cab('0x4a')](_0x8cab('0x74'),[][_0x8cab('0x75')](_0x7bdfe5['query'][_0x2606a1]));}else if(_0x2606a1===_0x8cab('0x76')){var _0x256640=JSON['parse'](_0x7bdfe5[_0x8cab('0x40')][_0x2606a1])[_0x8cab('0x77')];var _0x3cbc9a=JSON[_0x8cab('0x78')](_0x7bdfe5[_0x8cab('0x40')][_0x2606a1])[_0x8cab('0x79')];_0xf92986[_0x8cab('0x4a')](_0x8cab('0x7a'),_0x256640,_0x3cbc9a);}else{if(_0x7bdfe5['query'][_0x2606a1]===_0x8cab('0x7b')){_0xf92986[_0x8cab('0x4a')]('i.'+_0x2606a1+_0x8cab('0x7c'));}else{_0xf92986['where']('i.'+_0x2606a1+_0x8cab('0x7d'),_0x7bdfe5[_0x8cab('0x40')][_0x2606a1]);}}});}if(_0x7bdfe5[_0x8cab('0x40')]['read']){if(_0x7bdfe5['query'][_0x8cab('0x7e')]==0x1){_0xf92986[_0x8cab('0x65')]('`unreadMessages`\x20=\x200');}else{_0xf92986[_0x8cab('0x65')](_0x8cab('0x7f'));}}if(_0x7bdfe5[_0x8cab('0x40')]['tag']){_0x17f726=_['isArray'](_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x80')])?_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x80')]:new Array(_0x7bdfe5['query']['tag']);_0x17f726[_0x8cab('0x33')](function(_0x425565){_0x4250f7['or'](_0x8cab('0x81'),'%,'+_0x425565+',%');});}if(_0x7bdfe5['query'][_0x8cab('0x82')]){var _0x4b2849=_0x7bdfe5['query'][_0x8cab('0x82')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4b2849)){_0x40ec18['or']('i.id\x20LIKE\x20?',_0x4b2849+'%')['or'](_0x8cab('0x83'),_0x4b2849+'%');}_0x40ec18['or'](_0x8cab('0x84'),_0x4b2849+'%');}}_0xf92986[_0x8cab('0x4a')](_0x40ec18);_0xf92986[_0x8cab('0x85')](_0x8cab('0x86'));var _0x3b5239={'type':db[_0x8cab('0x87')][_0x8cab('0x88')][_0x8cab('0x89')],'raw':!![]};var _0x28a594=_0xf92986['clone']();_0x28a594['field'](_0x8cab('0x86'));_0x28a594[_0x8cab('0x4c')](_0x8cab('0x8a'),_0x8cab('0x62'));if(_0x3510ac[_0x8cab('0x48')]){_0x3510ac[_0x8cab('0x48')][_0x8cab('0x33')](function(_0x3a960f){var _0x1bf3af=_0x3a960f[0x0]==='contactName'?_0x3a960f[0x0]:'i.'+_0x3a960f[0x0];_0xf92986[_0x8cab('0x48')](_0x1bf3af,_0x3a960f[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x17f726)){_0xf92986[_0x8cab('0x65')](_0x4250f7);_0x28a594['where'](_0x8cab('0x8b'),_0x17f726);}BPromise[_0x8cab('0x8c')]()[_0x8cab('0x27')](function(){if(!_0x394d77){if(_0x7bdfe5[_0x8cab('0x40')][_0x8cab('0x73')])return;_0x28a594[_0x8cab('0x4a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xf92986['where'](_0x8cab('0x8d'));return;}if(_0x7bdfe5[_0x8cab('0x8e')][_0x8cab('0x8f')]!==_0x8cab('0x90'))return;return _0x7bdfe5['user'][_0x8cab('0x91')]({'attributes':['id'],'raw':!![]})[_0x8cab('0x27')](function(_0x41404f){if(_['isEmpty'](_0x41404f)){_0x28a594[_0x8cab('0x4a')](_0x8cab('0x92'));_0xf92986[_0x8cab('0x4a')](_0x8cab('0x92'));}else{_0x28a594[_0x8cab('0x4a')]('i.FaxAccountId\x20IN\x20?',_[_0x8cab('0x2e')](_0x41404f,'id'));_0xf92986[_0x8cab('0x4a')]('i.FaxAccountId\x20IN\x20?',_[_0x8cab('0x2e')](_0x41404f,'id'));}});})[_0x8cab('0x27')](function(){if(_0x7bdfe5[_0x8cab('0x8e')][_0x8cab('0x8f')]===_0x8cab('0x90')&&!_0x394d77&&!_0x7bdfe5['query'][_0x8cab('0x73')])return[];return db[_0x8cab('0x93')]['query'](_0x28a594['toString'](),_0x3b5239);})[_0x8cab('0x27')](function(_0x3ef8ff){_0x29df51['count']=_0x3ef8ff[_0x8cab('0x46')];if(_0x29df51[_0x8cab('0x23')]===0x0)return[];return db[_0x8cab('0x93')][_0x8cab('0x40')](_0x3cbcb3[_0x8cab('0x94')](),_0x3b5239)['then'](function(_0x4e3fdd){_0x47be9a=_['keyBy'](_0x4e3fdd,'id');_0x3b5239=_['merge'](_0x3b5239,{'model':db[_0x8cab('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7bdfe5['query'][_0x8cab('0x45')]){_0x3510ac[_0x8cab('0x44')][_0x8cab('0x33')](function(_0x1d05e3){_0xf92986[_0x8cab('0x4c')]('i.'+_0x1d05e3);});}else{_0xf92986[_0x8cab('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8cab('0x62'));_0xf92986['field'](_0x8cab('0x96'),_0x8cab('0x97'));_0xf92986[_0x8cab('0x4c')]('a.mandatoryDisposition',_0x8cab('0x98'));_0xf92986[_0x8cab('0x4c')]('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',_0x8cab('0x99'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0x9a'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0x9b'),'Contact.firstName');_0xf92986[_0x8cab('0x4c')](_0x8cab('0x9c'),_0x8cab('0x9d'));_0xf92986['field'](_0x8cab('0x9e'),'Contact.email');_0xf92986[_0x8cab('0x4c')](_0x8cab('0x9f'),_0x8cab('0xa0'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0xa1'),_0x8cab('0xa2'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0xa3'),_0x8cab('0xa4'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0xa5'),_0x8cab('0xa6'));_0xf92986['field'](_0x8cab('0xa7'),_0x8cab('0xa8'));_0xf92986[_0x8cab('0x4c')](_0x8cab('0xa9'),_0x8cab('0x30'));}if(_0x3510ac[_0x8cab('0x22')])_0xf92986[_0x8cab('0x22')](_0x3510ac[_0x8cab('0x22')]);if(_0x3510ac[_0x8cab('0x20')])_0xf92986['offset'](_0x3510ac[_0x8cab('0x20')]);return db[_0x8cab('0x93')][_0x8cab('0x40')](_0xf92986[_0x8cab('0x94')](),_0x3b5239);})[_0x8cab('0x27')](function(_0x538b83){if(_0x538b83['length']>0x0)_0x404b9a['where'](_0x8cab('0xaa'),_[_0x8cab('0x2e')](_0x538b83,'id'));return db[_0x8cab('0x93')][_0x8cab('0x40')](_0x404b9a['toString'](),_0x3b5239)[_0x8cab('0x27')](function(_0x277d9d){var _0x551daf=_[_0x8cab('0xab')](_0x277d9d,_0x8cab('0xac'));var _0x40f3f1=[];_0x538b83[_0x8cab('0x33')](function(_0x3ef684){_0x40f3f1[_0x8cab('0x34')](updateFaxInteraction(_0x3ef684,_0x47be9a,_0x551daf));});return BPromise[_0x8cab('0xad')](_0x40f3f1);});});})[_0x8cab('0x27')](function(_0x2c6bc7){_0x29df51[_0x8cab('0xae')]=_0x2c6bc7;return _0x29df51;})['then'](respondWithFilteredResult(_0xa2c62,_0x3510ac))[_0x8cab('0x35')](handleError(_0xa2c62,null));};exports['show']=function(_0x3b08b1,_0x25eb57){var _0x575755={'raw':![],'where':{'id':_0x3b08b1['params']['id']}},_0x1953a9={};_0x1953a9[_0x8cab('0x3f')]=_[_0x8cab('0x41')](db[_0x8cab('0x95')][_0x8cab('0x3d')]);_0x1953a9[_0x8cab('0x40')]=_[_0x8cab('0x41')](_0x3b08b1['query']);_0x1953a9[_0x8cab('0x42')]=_[_0x8cab('0x43')](_0x1953a9['model'],_0x1953a9[_0x8cab('0x40')]);_0x575755[_0x8cab('0x44')]=_[_0x8cab('0x43')](_0x1953a9[_0x8cab('0x3f')],qs[_0x8cab('0x45')](_0x3b08b1[_0x8cab('0x40')][_0x8cab('0x45')]));_0x575755['attributes']=_0x575755[_0x8cab('0x44')][_0x8cab('0x46')]?_0x575755['attributes']:_0x1953a9['model'];if(_0x3b08b1[_0x8cab('0x40')]['includeAll']){_0x575755['include']=[{'all':!![]}];}_0x575755=_[_0x8cab('0xaf')]({},_0x575755,_0x3b08b1[_0x8cab('0xb0')]);return db['FaxInteraction'][_0x8cab('0x61')](_0x575755)[_0x8cab('0x27')](handleEntityNotFound(_0x25eb57,null))['then'](respondWithResult(_0x25eb57,null))[_0x8cab('0x35')](handleError(_0x25eb57,null));};exports['create']=function(_0x4e273f,_0x4d16ff){return db[_0x8cab('0x95')][_0x8cab('0xb1')](_0x4e273f[_0x8cab('0xb2')],{})['then'](respondWithResult(_0x4d16ff,0xc9))[_0x8cab('0x35')](handleError(_0x4d16ff,null));};exports['update']=function(_0x41e6dd,_0x13ff4d){if(_0x41e6dd['body']['id']){delete _0x41e6dd[_0x8cab('0xb2')]['id'];}return db[_0x8cab('0x95')][_0x8cab('0x61')]({'where':{'id':_0x41e6dd['params']['id']}})[_0x8cab('0x27')](handleEntityNotFound(_0x13ff4d,null))[_0x8cab('0x27')](saveUpdates(_0x41e6dd[_0x8cab('0xb2')],null))[_0x8cab('0x27')](respondWithResult(_0x13ff4d,null))[_0x8cab('0x35')](handleError(_0x13ff4d,null));};exports[_0x8cab('0x28')]=function(_0x5810b6,_0x418e29){return db[_0x8cab('0x95')]['find']({'where':{'id':_0x5810b6[_0x8cab('0xb3')]['id']}})[_0x8cab('0x27')](handleEntityNotFound(_0x418e29,null))['then'](removeEntity(_0x418e29,null))[_0x8cab('0x35')](handleError(_0x418e29,null));};exports[_0x8cab('0xb4')]=function(_0x102b44,_0xba0a29){return db[_0x8cab('0x95')]['describe']()[_0x8cab('0x27')](respondWithResult(_0xba0a29,null))[_0x8cab('0x35')](handleError(_0xba0a29,null));};exports[_0x8cab('0xb5')]=function(_0x14443a,_0x2cfdc9,_0x1c36ef){return db[_0x8cab('0xb6')]['find']({'where':{'id':_0x14443a[_0x8cab('0xb3')]['id']}})[_0x8cab('0x27')](handleEntityNotFound(_0x2cfdc9,null))[_0x8cab('0x27')](function(_0x1bae69){if(_0x1bae69){return _0x1bae69['addMessage'](_0x14443a[_0x8cab('0xb2')][_0x8cab('0xb7')],_['omit'](_0x14443a[_0x8cab('0xb2')],[_0x8cab('0xb7'),'id'])||{});}})[_0x8cab('0x27')](respondWithResult(_0x2cfdc9,null))[_0x8cab('0x35')](handleError(_0x2cfdc9,null));};exports[_0x8cab('0xb8')]=function(_0x5f23f2,_0x496fb1,_0x556269){var _0x2568fb={'raw':![],'where':{}};var _0x584e48={};var _0x2c85ba={'count':0x0,'rows':[]};return db[_0x8cab('0x95')][_0x8cab('0xb9')]({'where':{'id':_0x5f23f2[_0x8cab('0xb3')]['id']}})[_0x8cab('0x27')](handleEntityNotFound(_0x496fb1,null))[_0x8cab('0x27')](function(_0x436bca){if(_0x436bca){_0x584e48[_0x8cab('0x3f')]=_[_0x8cab('0x41')](db[_0x8cab('0xb6')]['rawAttributes']);_0x584e48[_0x8cab('0x40')]=_[_0x8cab('0x41')](_0x5f23f2[_0x8cab('0x40')]);_0x584e48[_0x8cab('0x42')]=_['intersection'](_0x584e48['model'],_0x584e48[_0x8cab('0x40')]);_0x2568fb[_0x8cab('0x44')]=_[_0x8cab('0x43')](_0x584e48['model'],qs[_0x8cab('0x45')](_0x5f23f2[_0x8cab('0x40')]['fields']));_0x2568fb[_0x8cab('0x44')]=_0x2568fb[_0x8cab('0x44')][_0x8cab('0x46')]?_0x2568fb['attributes']:_0x584e48[_0x8cab('0x3f')];if(!_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x47')](_0x8cab('0xba'))){_0x2568fb[_0x8cab('0x22')]=qs['limit'](_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x22')]);_0x2568fb[_0x8cab('0x20')]=qs['offset'](_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x20')]);}_0x2568fb['order']=qs[_0x8cab('0x49')](_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x49')]);_0x2568fb[_0x8cab('0x4a')]=qs['filters'](_[_0x8cab('0x4b')](_0x5f23f2['query'],_0x584e48[_0x8cab('0x42')]));_0x2568fb[_0x8cab('0x4a')][_0x8cab('0xac')]=_0x436bca['id'];if(_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x82')]){_0x2568fb[_0x8cab('0x4a')]=_[_0x8cab('0xaf')](_0x2568fb[_0x8cab('0x4a')],{'$or':_[_0x8cab('0x2e')](_0x2568fb[_0x8cab('0x44')],function(_0x1a6767){var _0x1477b4={};_0x1477b4[_0x1a6767]={'$like':'%'+_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x82')]+'%'};return _0x1477b4;})});}if(_0x5f23f2[_0x8cab('0x40')][_0x8cab('0x77')]){var _0x487f7e=_0x5f23f2[_0x8cab('0x40')]['$gte'][_0x8cab('0x32')](',');var _0x580c9c={};_0x580c9c[_0x487f7e[0x0]]={'$gte':moment(_0x487f7e[0x1])[_0x8cab('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2568fb['where']=_['merge'](_0x2568fb[_0x8cab('0x4a')],_0x580c9c);}_0x2568fb=_[_0x8cab('0xaf')]({},_0x2568fb,_0x5f23f2[_0x8cab('0xb0')]);return db[_0x8cab('0xb6')]['count']({'where':_0x2568fb[_0x8cab('0x4a')]})[_0x8cab('0x27')](function(_0x470d70){_0x2c85ba[_0x8cab('0x23')]=_0x470d70;if(_0x5f23f2['query'][_0x8cab('0xbc')]){_0x2568fb[_0x8cab('0xbd')]=[{'all':!![]}];}return db[_0x8cab('0xb6')][_0x8cab('0xbe')](_0x2568fb);})[_0x8cab('0x27')](function(_0x14a766){_0x2c85ba[_0x8cab('0xae')]=_0x14a766;return _0x2c85ba;});}})[_0x8cab('0x27')](respondWithFilteredResult(_0x496fb1,_0x2568fb))['catch'](handleError(_0x496fb1,null));};exports[_0x8cab('0xbf')]=function(_0x2c3e27,_0x12f42f,_0x5c8d25){return db[_0x8cab('0x95')]['find']({'where':{'id':_0x2c3e27[_0x8cab('0xb3')]['id']}})[_0x8cab('0x27')](handleEntityNotFound(_0x12f42f,null))[_0x8cab('0x27')](function(_0x9cb604){if(_0x9cb604){return _0x9cb604[_0x8cab('0xc0')](_0x2c3e27[_0x8cab('0xb2')][_0x8cab('0xb7')],_[_0x8cab('0xc1')](_0x2c3e27[_0x8cab('0xb2')],[_0x8cab('0xb7'),'id'])||{})[_0x8cab('0xc2')](function(){return db['Tag'][_0x8cab('0xbe')]({'attributes':['id',_0x8cab('0x2b'),_0x8cab('0x4d')],'where':{'id':_0x2c3e27[_0x8cab('0xb2')][_0x8cab('0xb7')]}});})[_0x8cab('0x27')](function(_0x27e168){socket['emit']('faxInteractionTags:save',{'id':Number(_0x2c3e27[_0x8cab('0xb3')]['id']),'tags':_0x27e168||[]});return{'id':Number(_0x2c3e27[_0x8cab('0xb3')]['id']),'tags':_0x27e168||[]};});}})[_0x8cab('0x27')](respondWithResult(_0x12f42f,null))['catch'](handleError(_0x12f42f,null));};exports['removeTags']=function(_0x50c69b,_0x5bddc9,_0x257a8e){return db[_0x8cab('0x95')][_0x8cab('0x61')]({'where':{'id':_0x50c69b[_0x8cab('0xb3')]['id']}})['then'](handleEntityNotFound(_0x5bddc9,null))[_0x8cab('0x27')](function(_0x2dbbee){if(_0x2dbbee){return _0x2dbbee[_0x8cab('0xc3')](_0x50c69b['query'][_0x8cab('0xb7')]);}})['then'](respondWithStatusCode(_0x5bddc9,null))[_0x8cab('0x35')](handleError(_0x5bddc9,null));};exports[_0x8cab('0xc4')]=function(_0x1f9c18,_0x1da537){var _0x58b2cd=moment()[_0x8cab('0xc5')]()[_0x8cab('0x94')]();var _0x39c44d=path[_0x8cab('0xc6')](config['root'],_0x8cab('0xc7'),_0x8cab('0xc8'),'tmp');var _0x4cf8f8=path['join'](config[_0x8cab('0xc9')],'server',_0x8cab('0xc8'),_0x8cab('0xca'));var _0x5d7795=path[_0x8cab('0xc6')](_0x39c44d,_0x58b2cd);var _0x391176=util[_0x8cab('0xbb')](_0x8cab('0xcb'),_0x1f9c18[_0x8cab('0xb3')]['id'],_0x58b2cd);var _0x2e332d=path[_0x8cab('0xc6')](_0x39c44d,_0x391176);var _0xab0c94=[];_0xab0c94[_0x8cab('0x34')]({'model':db[_0x8cab('0xcc')],'as':_0x8cab('0xcc'),'raw':!![]});var _0x5ca3ff=[{'model':db[_0x8cab('0xb6')],'as':_0x8cab('0xcd'),'attributes':['id',_0x8cab('0xb2'),_0x8cab('0x76')],'include':_0xab0c94}];return db['FaxInteraction'][_0x8cab('0x61')]({'where':{'id':_0x1f9c18[_0x8cab('0xb3')]['id']},'include':_0x5ca3ff})[_0x8cab('0x27')](handleEntityNotFound(_0x1da537,null))[_0x8cab('0x27')](function(_0x3c331e){if(_0x3c331e&&_0x3c331e[_0x8cab('0xcd')]){var _0x2e03b4=_0x3c331e[_0x8cab('0xce')]({'plain':!![]});fs['mkdirSync'](_0x5d7795);for(var _0x485531=0x0;_0x485531<_0x2e03b4[_0x8cab('0xcd')][_0x8cab('0x46')];_0x485531++){var _0x422ab7=_0x2e03b4['Messages'][_0x485531][_0x8cab('0xcc')];if(_0x422ab7){var _0x17b14a=path[_0x8cab('0xc6')](_0x4cf8f8,_0x422ab7['basename']);if(fs[_0x8cab('0xcf')](_0x17b14a)){fs[_0x8cab('0xd0')](_0x17b14a)[_0x8cab('0xd1')](fs[_0x8cab('0xd2')](path['join'](_0x5d7795,_0x422ab7[_0x8cab('0xd3')])));}}}return BPromise['resolve']()[_0x8cab('0x27')](function(){return new BPromise(function(_0x56202b,_0x3216a5){zipdir(_0x5d7795,{'saveTo':_0x2e332d},function(_0x36d841,_0x258ef6){if(_0x36d841)return _0x3216a5(_0x36d841);return _0x56202b(_0x258ef6);});})[_0x8cab('0x27')](function(){return new BPromise(function(_0x23870d,_0x4436d3){rimraf(_0x5d7795,function(_0x4691f8){if(_0x4691f8)_0x4436d3(_0x4691f8);return _0x23870d();});});})[_0x8cab('0x27')](function(){return _0x1da537[_0x8cab('0xc4')](_0x2e332d,_0x391176,function(_0xbbb09e){if(_0xbbb09e){console['log']('err',_0xbbb09e);}else{fs['unlinkSync'](_0x2e332d);}});});});}else{return _0x1da537[_0x8cab('0x1d')](0xc8);}})[_0x8cab('0x35')](handleError(_0x1da537,null));}; \ No newline at end of file +var _0xc62c=['operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','type','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','text','body','buildExpression','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','include','create','FaxInteraction','describe','addMessage','FaxMessage','ids','omit','getMessages','nolimit','FaxInteractionId','merge','$gte','format','options','addTags','setTags','spread','emit','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','t.id\x20=\x20it.TagId','search','sqlOperator','find','unreadMessages','having','`\x20=\x200','Contact'];(function(_0x5558fb,_0xe6bb5e){var _0x11368d=function(_0x4f0cd6){while(--_0x4f0cd6){_0x5558fb['push'](_0x5558fb['shift']());}};_0x11368d(++_0xe6bb5e);}(_0xc62c,0x152));var _0xcc62=function(_0x55a984,_0x3c1a84){_0x55a984=_0x55a984-0x0;var _0x36c8f3=_0xc62c[_0x55a984];return _0x36c8f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc62('0x0'));var zipdir=require(_0xcc62('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc62('0x3'));var util=require(_0xcc62('0x4'));var path=require(_0xcc62('0x5'));var sox=require(_0xcc62('0x6'));var csv=require('to-csv');var ejs=require(_0xcc62('0x7'));var fs=require('fs');var fs_extra=require(_0xcc62('0x8'));var _=require(_0xcc62('0x9'));var squel=require(_0xcc62('0xa'));var crypto=require(_0xcc62('0xb'));var jsforce=require(_0xcc62('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcc62('0xd'));var querystring=require(_0xcc62('0xe'));var Papa=require(_0xcc62('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc62('0x10'));var as=require(_0xcc62('0x11'));var hardwareService=require(_0xcc62('0x12'));var logger=require(_0xcc62('0x13'))(_0xcc62('0x14'));var utils=require(_0xcc62('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc62('0x16'))['db'];config[_0xcc62('0x17')]=_[_0xcc62('0x18')](config[_0xcc62('0x17')],{'host':_0xcc62('0x19'),'port':0x18eb});var socket=require(_0xcc62('0x1a'))(new Redis(config['redis']));require(_0xcc62('0x1b'))[_0xcc62('0x1c')](socket);function respondWithStatusCode(_0x4d4aa7,_0x1cf5a5){_0x1cf5a5=_0x1cf5a5||0xcc;return function(_0x2a88cb){if(_0x2a88cb){return _0x4d4aa7[_0xcc62('0x1d')](_0x1cf5a5);}return _0x4d4aa7[_0xcc62('0x1e')](_0x1cf5a5)['end']();};}function respondWithResult(_0x1aad77,_0x3c902b){_0x3c902b=_0x3c902b||0xc8;return function(_0x522d73){if(_0x522d73){return _0x1aad77[_0xcc62('0x1e')](_0x3c902b)['json'](_0x522d73);}};}function respondWithFilteredResult(_0x31fb67,_0x182eae){return function(_0x4f0b37){if(_0x4f0b37){var _0x5613c5=typeof _0x182eae[_0xcc62('0x1f')]===_0xcc62('0x20')&&typeof _0x182eae[_0xcc62('0x21')]==='undefined';var _0x5539cd=_0x4f0b37[_0xcc62('0x22')];var _0x19aa7a=_0x5613c5?0x0:_0x182eae[_0xcc62('0x1f')];var _0x2cc672=_0x5613c5?_0x4f0b37['count']:_0x182eae[_0xcc62('0x1f')]+_0x182eae[_0xcc62('0x21')];var _0x328a4f;if(_0x2cc672>=_0x5539cd){_0x2cc672=_0x5539cd;_0x328a4f=0xc8;}else{_0x328a4f=0xce;}_0x31fb67[_0xcc62('0x1e')](_0x328a4f);return _0x31fb67['set'](_0xcc62('0x23'),_0x19aa7a+'-'+_0x2cc672+'/'+_0x5539cd)[_0xcc62('0x24')](_0x4f0b37);}return null;};}function patchUpdates(_0x30bea1){return function(_0x1a7d08){try{jsonpatch['apply'](_0x1a7d08,_0x30bea1,!![]);}catch(_0x17b957){return BPromise[_0xcc62('0x25')](_0x17b957);}return _0x1a7d08[_0xcc62('0x26')]();};}function saveUpdates(_0x492873,_0x486059){return function(_0x20630d){if(_0x20630d){return _0x20630d[_0xcc62('0x27')](_0x492873)['then'](function(_0x37d516){return _0x37d516;});}return null;};}function removeEntity(_0x482c81,_0x50ac5c){return function(_0x2bfe0a){if(_0x2bfe0a){return _0x2bfe0a[_0xcc62('0x28')]()[_0xcc62('0x29')](function(){_0x482c81[_0xcc62('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dbb5f,_0x425027){return function(_0xed403d){if(!_0xed403d){_0x4dbb5f[_0xcc62('0x1d')](0x194);}return _0xed403d;};}function handleError(_0x4ce179,_0x4cb76f){_0x4cb76f=_0x4cb76f||0x1f4;return function(_0x70b3f6){logger[_0xcc62('0x2a')](_0x70b3f6['stack']);if(_0x70b3f6[_0xcc62('0x2b')]){delete _0x70b3f6[_0xcc62('0x2b')];}_0x4ce179[_0xcc62('0x1e')](_0x4cb76f)[_0xcc62('0x2c')](_0x70b3f6);};}function getInteractionUsers(_0x564894,_0x3763d3){return new BPromise(function(_0x50c91c,_0x519308){try{if(_0x3763d3[_0x564894['id']]){_0x564894[_0xcc62('0x2d')]=_[_0xcc62('0x2e')](_0x3763d3[_0x564894['id']],function(_0x3eaf8f){return{'id':_0x3eaf8f['id'],'fullname':_0x3eaf8f[_0xcc62('0x2f')]};});}}catch(_0x29cec5){_0x519308(_0x29cec5);}_0x50c91c(_0x564894);});}function getInteractionTags(_0x379f5b,_0x2a516a){return new BPromise(function(_0x277c92,_0x4061a3){try{if(_0x379f5b[_0xcc62('0x30')]){_0x379f5b['Tags']=[];_0x379f5b[_0xcc62('0x30')][_0xcc62('0x31')](',')[_0xcc62('0x32')](function(_0x99a985){_0x379f5b[_0xcc62('0x33')][_0xcc62('0x34')](_0x2a516a[_0x99a985]);});}delete _0x379f5b['TagIds'];}catch(_0x3810b1){_0x4061a3(_0x3810b1);}_0x277c92(_0x379f5b);});}function updateFaxInteraction(_0x21bebc,_0x2b75c8,_0x59178a){return new BPromise(function(_0x45b520,_0x3ef007){return getInteractionUsers(_0x21bebc,_0x59178a)['then'](function(_0x579bc9){return getInteractionTags(_0x579bc9,_0x2b75c8);})['then'](function(_0x1e20c9){return getStateInteraction(_0x1e20c9);})[_0xcc62('0x29')](function(_0x43a254){_0x45b520(_0x43a254);})[_0xcc62('0x35')](function(_0x497b55){_0x3ef007(_0x497b55);});});}function getStateInteraction(_0x112e10){return new BPromise(function(_0x477a23){_0x112e10[_0xcc62('0x36')]=0x0;_0x112e10[_0xcc62('0x37')]=0x0;_0x112e10[_0xcc62('0x38')]=0x0;_0x112e10[_0xcc62('0x39')]=0x0;_0x112e10[_0xcc62('0x3a')]=0x0;if(!_0x112e10['closed']&&!_0x112e10[_0xcc62('0x3b')]){_0x112e10[_0xcc62('0x36')]+=0x1;}if(!_0x112e10[_0xcc62('0x3c')]&&_0x112e10[_0xcc62('0x3b')]){_0x112e10[_0xcc62('0x37')]+=0x1;if(_0x112e10['waiting']){_0x112e10[_0xcc62('0x36')]-=0x1;}}if(_0x112e10[_0xcc62('0x3c')]&&_0x112e10[_0xcc62('0x3b')]){_0x112e10[_0xcc62('0x38')]+=0x1;if(_0x112e10[_0xcc62('0x37')]){_0x112e10[_0xcc62('0x37')]-=0x1;}}if(_0x112e10[_0xcc62('0x3c')]&&!_0x112e10[_0xcc62('0x3b')]){_0x112e10[_0xcc62('0x39')]+=0x1;if(_0x112e10[_0xcc62('0x36')]){_0x112e10[_0xcc62('0x36')]-=0x1;}}_0x112e10[_0xcc62('0x3a')]+=0x1;_0x477a23(_0x112e10);});}exports[_0xcc62('0x3d')]=function(_0x3b87f9,_0x2f5159){var _0x5125a0={},_0x455ec3={},_0x1d598b={'count':0x0,'rows':[]};var _0x37a820=_[_0xcc62('0x2e')](db['FaxInteraction'][_0xcc62('0x3e')],function(_0x193330){return{'name':_0x193330['fieldName'],'type':_0x193330['type']['key']};});_0x455ec3[_0xcc62('0x3f')]=_[_0xcc62('0x2e')](_0x37a820,_0xcc62('0x2b'));_0x455ec3[_0xcc62('0x40')]=_[_0xcc62('0x41')](_0x3b87f9['query']);_0x455ec3[_0xcc62('0x42')]=_[_0xcc62('0x43')](_0x455ec3['model'],_0x455ec3[_0xcc62('0x40')]);_0x5125a0['attributes']=_[_0xcc62('0x43')](_0x455ec3[_0xcc62('0x3f')],qs[_0xcc62('0x44')](_0x3b87f9['query'][_0xcc62('0x44')]));_0x5125a0['attributes']=_0x5125a0[_0xcc62('0x45')][_0xcc62('0x46')]?_0x5125a0['attributes']:_0x455ec3[_0xcc62('0x3f')];if(!_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x47')]('nolimit')){_0x5125a0[_0xcc62('0x21')]=qs['limit'](_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x21')]);_0x5125a0[_0xcc62('0x1f')]=qs['offset'](_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x1f')]);}_0x5125a0['order']=qs[_0xcc62('0x48')](_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x48')]);_0x5125a0[_0xcc62('0x49')]=qs['filters'](_[_0xcc62('0x4a')](_0x3b87f9[_0xcc62('0x40')],_0x455ec3[_0xcc62('0x42')]),_0x37a820);var _0x1232e1=[];var _0x5d7a46=squel['select']()[_0xcc62('0x4b')]('id')['field'](_0xcc62('0x2b'))[_0xcc62('0x4b')](_0xcc62('0x4c'))[_0xcc62('0x4d')]('tools_tags');var _0x473986=squel['select']()[_0xcc62('0x4b')](_0xcc62('0x4e'))[_0xcc62('0x4b')](_0xcc62('0x4f'))[_0xcc62('0x4b')](_0xcc62('0x50'))[_0xcc62('0x4d')](_0xcc62('0x51'),'ui')[_0xcc62('0x52')](_0xcc62('0x53'),'u',_0xcc62('0x54'));var _0x1f6501=squel[_0xcc62('0x55')]()[_0xcc62('0x4d')](_0xcc62('0x56'),'i')[_0xcc62('0x52')]('cm_contacts','c',_0xcc62('0x57'))[_0xcc62('0x52')]('users','o',_0xcc62('0x58'))[_0xcc62('0x52')](_0xcc62('0x59'),'a',_0xcc62('0x5a'))[_0xcc62('0x52')](_0xcc62('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xcc62('0x52')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0xcc62('0x52')]('tools_tags','t',_0xcc62('0x5c'));var _0x343f93=squel['expr']();var _0x3da269=[];var _0x21cef9=squel['expr']();var _0x3cb235;if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x5d')]){_0x3cb235=as['parseSearch'](_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x5d')]);var _0x2aaf8a=_0x3cb235[_0xcc62('0x5e')];for(var _0x1cd2b6=0x0;_0x1cd2b6<_0x3cb235['conditions'][_0xcc62('0x46')];_0x1cd2b6++){var _0x27b011=_0x3cb235['conditions'][_0x1cd2b6];var _0x164690='i';var _0x46a945=_[_0xcc62('0x5f')](_0x37a820,[_0xcc62('0x2b'),_0x27b011['field']]);if(!_0x46a945){switch(_0x27b011[_0xcc62('0x4b')]){case _0xcc62('0x60'):if(_0x27b011['value']==0x1){_0x1f6501[_0xcc62('0x61')]('`'+_0x27b011['field']+_0xcc62('0x62'));}else{_0x1f6501[_0xcc62('0x61')]('`'+_0x27b011[_0xcc62('0x4b')]+'`\x20>\x200');}break;case _0xcc62('0x63'):if(_0x27b011[_0xcc62('0x64')]==='$substring'){if(_0x27b011['value'][_0xcc62('0x31')]('\x20')[_0xcc62('0x46')]>0x1){_0x343f93[_0x2aaf8a](_0xcc62('0x65'),qs['getFullTextValue'](_0x27b011[_0xcc62('0x66')]),null);}else{var _0x1c6094='%'+_0x27b011['value']+'%';_0x343f93[_0x2aaf8a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1c6094,_0x1c6094,_0x1c6094);}}else{_0x46a945=_[_0xcc62('0x5f')](_0x37a820,[_0xcc62('0x2b'),_0xcc62('0x67')]);_0x27b011[_0xcc62('0x4b')]=_0xcc62('0x67');_0x143aad=as['buildExpression'](_0x164690,_0x46a945[_0xcc62('0x68')],_0x27b011);_0x343f93[_0x2aaf8a](_0x143aad['text'],_0x143aad[_0xcc62('0x66')][_0xcc62('0x69')],_0x143aad[_0xcc62('0x66')][_0xcc62('0x6a')]);}break;case _0xcc62('0x6b'):var _0x5225e8=_0x27b011['value']['split'](',')[_0xcc62('0x2e')](function(_0x218c9d){return Number(_0x218c9d);});_0x5225e8[_0xcc62('0x32')](function(_0x1df023){_0x21cef9['or'](_0xcc62('0x6c'),'%,'+_0x1df023+',%');});_0x3da269=_[_0xcc62('0x6d')](_0x3da269,_0x5225e8);break;case _0xcc62('0x6e'):if(_0x27b011[_0xcc62('0x64')]===_0xcc62('0x6f')){_0x343f93[_0x2aaf8a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x27b011[_0xcc62('0x66')]+'%',null);}else{_0x46a945=_[_0xcc62('0x5f')](_0x37a820,['name',_0xcc62('0x3b')]);_0x27b011[_0xcc62('0x4b')]=_0xcc62('0x3b');_0x143aad=as['buildExpression'](_0x164690,_0x46a945[_0xcc62('0x68')],_0x27b011);_0x343f93[_0x2aaf8a](_0x143aad[_0xcc62('0x70')],_0x143aad[_0xcc62('0x66')][_0xcc62('0x69')],_0x143aad['value'][_0xcc62('0x6a')]);}break;case _0xcc62('0x71'):_0x143aad=as[_0xcc62('0x72')]('me',null,_0x27b011);_0x343f93[_0x2aaf8a](_0x143aad['text'],_0x143aad['value']['start'],_0x143aad[_0xcc62('0x66')][_0xcc62('0x6a')]);break;}}else{var _0x143aad=as['buildExpression'](_0x164690,_0x46a945[_0xcc62('0x68')],_0x27b011);_0x343f93[_0x2aaf8a](_0x143aad[_0xcc62('0x70')],_0x143aad[_0xcc62('0x66')]['start'],_0x143aad[_0xcc62('0x66')][_0xcc62('0x6a')]);}}}else{var _0x16118c=_(_0x3b87f9['query'])[_0xcc62('0x41')]()[_0xcc62('0x2e')](function(_0x3bc6ca){return _[_0xcc62('0x73')](_0x37a820,[_0xcc62('0x2b'),_0x3bc6ca])?_0x3bc6ca:undefined;})['compact']()[_0xcc62('0x66')]();if(!_[_0xcc62('0x74')](_0x16118c)){_0x16118c[_0xcc62('0x32')](function(_0x136ff4){if(_0x136ff4===_0xcc62('0x75')){_0x1f6501[_0xcc62('0x49')](_0xcc62('0x76'),[][_0xcc62('0x77')](_0x3b87f9[_0xcc62('0x40')][_0x136ff4]));}else if(_0x136ff4===_0xcc62('0x78')){var _0x40e6c4=JSON[_0xcc62('0x79')](_0x3b87f9[_0xcc62('0x40')][_0x136ff4])['$gte'];var _0x5ed316=JSON[_0xcc62('0x79')](_0x3b87f9[_0xcc62('0x40')][_0x136ff4])[_0xcc62('0x7a')];_0x1f6501['where'](_0xcc62('0x7b'),_0x40e6c4,_0x5ed316);}else{if(_0x3b87f9[_0xcc62('0x40')][_0x136ff4]===_0xcc62('0x7c')){_0x1f6501[_0xcc62('0x49')]('i.'+_0x136ff4+'\x20IS\x20NULL');}else{_0x1f6501[_0xcc62('0x49')]('i.'+_0x136ff4+_0xcc62('0x7d'),_0x3b87f9[_0xcc62('0x40')][_0x136ff4]);}}});}if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x7e')]){if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x7e')]==0x1){_0x1f6501[_0xcc62('0x61')](_0xcc62('0x7f'));}else{_0x1f6501[_0xcc62('0x61')](_0xcc62('0x80'));}}if(_0x3b87f9[_0xcc62('0x40')]['tag']){_0x3da269=_['isArray'](_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x81')])?_0x3b87f9[_0xcc62('0x40')]['tag']:new Array(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x81')]);_0x3da269[_0xcc62('0x32')](function(_0x2b7e78){_0x21cef9['or'](_0xcc62('0x6c'),'%,'+_0x2b7e78+',%');});}if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x82')]){var _0x4cb506=_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x82')][_0xcc62('0x83')]('\x5c','\x5c\x5c')[_0xcc62('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4cb506)){_0x343f93['or'](_0xcc62('0x84'),_0x4cb506+'%')['or'](_0xcc62('0x85'),_0x4cb506+'%');}_0x343f93['or'](_0xcc62('0x86'),_0x4cb506+'%');}}_0x1f6501[_0xcc62('0x49')](_0x343f93);_0x1f6501[_0xcc62('0x87')]('i.id');var _0x30e7dc={'type':db[_0xcc62('0x88')][_0xcc62('0x89')][_0xcc62('0x8a')],'raw':!![]};var _0x538f59=_0x1f6501[_0xcc62('0x8b')]();_0x538f59[_0xcc62('0x4b')](_0xcc62('0x8c'));_0x538f59[_0xcc62('0x4b')](_0xcc62('0x8d'),_0xcc62('0x60'));if(_0x5125a0['order']){_0x5125a0[_0xcc62('0x8e')][_0xcc62('0x32')](function(_0x408df2){var _0x358ce6=_0x408df2[0x0]==='contactName'?_0x408df2[0x0]:'i.'+_0x408df2[0x0];_0x1f6501['order'](_0x358ce6,_0x408df2[0x1]===_0xcc62('0x8f')?![]:!![]);});}if(!_[_0xcc62('0x74')](_0x3da269)){_0x1f6501[_0xcc62('0x61')](_0x21cef9);_0x538f59[_0xcc62('0x49')](_0xcc62('0x90'),_0x3da269);}BPromise[_0xcc62('0x91')]()['then'](function(){if(!_0x3cb235){if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x75')])return;_0x538f59[_0xcc62('0x49')](_0xcc62('0x92'));_0x1f6501[_0xcc62('0x49')](_0xcc62('0x92'));return;}if(_0x3b87f9['user']['role']!==_0xcc62('0x93'))return;return _0x3b87f9[_0xcc62('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xcc62('0x29')](function(_0xfb7661){if(_['isEmpty'](_0xfb7661)){_0x538f59[_0xcc62('0x49')](_0xcc62('0x95'));_0x1f6501[_0xcc62('0x49')](_0xcc62('0x95'));}else{_0x538f59[_0xcc62('0x49')]('i.FaxAccountId\x20IN\x20?',_[_0xcc62('0x2e')](_0xfb7661,'id'));_0x1f6501[_0xcc62('0x49')](_0xcc62('0x76'),_[_0xcc62('0x2e')](_0xfb7661,'id'));}});})[_0xcc62('0x29')](function(){if(_0x3b87f9[_0xcc62('0x94')][_0xcc62('0x96')]===_0xcc62('0x93')&&!_0x3cb235&&!_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x75')])return[];return db[_0xcc62('0x97')][_0xcc62('0x40')](_0x538f59['toString'](),_0x30e7dc);})[_0xcc62('0x29')](function(_0x3ca1fa){_0x1d598b[_0xcc62('0x22')]=_0x3ca1fa['length'];if(_0x1d598b['count']===0x0)return[];return db[_0xcc62('0x97')][_0xcc62('0x40')](_0x5d7a46[_0xcc62('0x98')](),_0x30e7dc)[_0xcc62('0x29')](function(_0xd7066c){_0x1232e1=_[_0xcc62('0x99')](_0xd7066c,'id');_0x30e7dc=_['merge'](_0x30e7dc,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b87f9[_0xcc62('0x40')][_0xcc62('0x44')]){_0x5125a0['attributes'][_0xcc62('0x32')](function(_0xb289a7){_0x1f6501[_0xcc62('0x4b')]('i.'+_0xb289a7);});}else{_0x1f6501['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcc62('0x60'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0x9a'),_0xcc62('0x9b'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0x9c'),_0xcc62('0x9d'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0x9e'),_0xcc62('0x9f'));_0x1f6501['field'](_0xcc62('0xa0'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xa1'),_0xcc62('0xa2'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xa3'),_0xcc62('0xa4'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xa5'),'Contact.email');_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xa6'),'Contact.phone');_0x1f6501[_0xcc62('0x4b')]('c.mobile',_0xcc62('0xa7'));_0x1f6501[_0xcc62('0x4b')]('c.fax','Contact.fax');_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xa8'),_0xcc62('0xa9'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xaa'),_0xcc62('0xab'));_0x1f6501[_0xcc62('0x4b')](_0xcc62('0xac'),_0xcc62('0x30'));}if(_0x5125a0[_0xcc62('0x21')])_0x1f6501[_0xcc62('0x21')](_0x5125a0[_0xcc62('0x21')]);if(_0x5125a0[_0xcc62('0x1f')])_0x1f6501[_0xcc62('0x1f')](_0x5125a0[_0xcc62('0x1f')]);return db[_0xcc62('0x97')]['query'](_0x1f6501['toString'](),_0x30e7dc);})[_0xcc62('0x29')](function(_0x45fb39){if(_0x45fb39[_0xcc62('0x46')]>0x0)_0x473986[_0xcc62('0x49')](_0xcc62('0xad'),_[_0xcc62('0x2e')](_0x45fb39,'id'));return db[_0xcc62('0x97')]['query'](_0x473986[_0xcc62('0x98')](),_0x30e7dc)[_0xcc62('0x29')](function(_0x341f0a){var _0xfe7475=_[_0xcc62('0xae')](_0x341f0a,'FaxInteractionId');var _0x37930a=[];_0x45fb39[_0xcc62('0x32')](function(_0x298f42){_0x37930a[_0xcc62('0x34')](updateFaxInteraction(_0x298f42,_0x1232e1,_0xfe7475));});return BPromise['all'](_0x37930a);});});})[_0xcc62('0x29')](function(_0x1eb05d){_0x1d598b[_0xcc62('0xaf')]=_0x1eb05d;return _0x1d598b;})[_0xcc62('0x29')](respondWithFilteredResult(_0x2f5159,_0x5125a0))[_0xcc62('0x35')](handleError(_0x2f5159,null));};exports[_0xcc62('0xb0')]=function(_0x50784c,_0xc5a284){var _0x2f827e={'raw':![],'where':{'id':_0x50784c[_0xcc62('0xb1')]['id']}},_0x1163ed={};_0x1163ed[_0xcc62('0x3f')]=_['keys'](db['FaxInteraction'][_0xcc62('0x3e')]);_0x1163ed[_0xcc62('0x40')]=_[_0xcc62('0x41')](_0x50784c[_0xcc62('0x40')]);_0x1163ed['filters']=_[_0xcc62('0x43')](_0x1163ed[_0xcc62('0x3f')],_0x1163ed['query']);_0x2f827e[_0xcc62('0x45')]=_[_0xcc62('0x43')](_0x1163ed[_0xcc62('0x3f')],qs[_0xcc62('0x44')](_0x50784c[_0xcc62('0x40')][_0xcc62('0x44')]));_0x2f827e[_0xcc62('0x45')]=_0x2f827e[_0xcc62('0x45')][_0xcc62('0x46')]?_0x2f827e[_0xcc62('0x45')]:_0x1163ed[_0xcc62('0x3f')];if(_0x50784c[_0xcc62('0x40')][_0xcc62('0xb2')]){_0x2f827e[_0xcc62('0xb3')]=[{'all':!![]}];}_0x2f827e=_['merge']({},_0x2f827e,_0x50784c['options']);return db['FaxInteraction'][_0xcc62('0x5f')](_0x2f827e)[_0xcc62('0x29')](handleEntityNotFound(_0xc5a284,null))[_0xcc62('0x29')](respondWithResult(_0xc5a284,null))[_0xcc62('0x35')](handleError(_0xc5a284,null));};exports[_0xcc62('0xb4')]=function(_0x404fc7,_0x27440a){return db[_0xcc62('0xb5')][_0xcc62('0xb4')](_0x404fc7[_0xcc62('0x71')],{})[_0xcc62('0x29')](respondWithResult(_0x27440a,0xc9))['catch'](handleError(_0x27440a,null));};exports[_0xcc62('0x27')]=function(_0x1964c3,_0x44af25){if(_0x1964c3[_0xcc62('0x71')]['id']){delete _0x1964c3[_0xcc62('0x71')]['id'];}return db[_0xcc62('0xb5')]['find']({'where':{'id':_0x1964c3[_0xcc62('0xb1')]['id']}})[_0xcc62('0x29')](handleEntityNotFound(_0x44af25,null))[_0xcc62('0x29')](saveUpdates(_0x1964c3['body'],null))[_0xcc62('0x29')](respondWithResult(_0x44af25,null))[_0xcc62('0x35')](handleError(_0x44af25,null));};exports['destroy']=function(_0x16fc71,_0x576882){return db[_0xcc62('0xb5')][_0xcc62('0x5f')]({'where':{'id':_0x16fc71[_0xcc62('0xb1')]['id']}})[_0xcc62('0x29')](handleEntityNotFound(_0x576882,null))['then'](removeEntity(_0x576882,null))[_0xcc62('0x35')](handleError(_0x576882,null));};exports[_0xcc62('0xb6')]=function(_0x3b818f,_0x3fa4af){return db[_0xcc62('0xb5')][_0xcc62('0xb6')]()['then'](respondWithResult(_0x3fa4af,null))['catch'](handleError(_0x3fa4af,null));};exports[_0xcc62('0xb7')]=function(_0x194f29,_0xb1095c,_0x5a8083){return db[_0xcc62('0xb8')][_0xcc62('0x5f')]({'where':{'id':_0x194f29[_0xcc62('0xb1')]['id']}})[_0xcc62('0x29')](handleEntityNotFound(_0xb1095c,null))[_0xcc62('0x29')](function(_0x4a6085){if(_0x4a6085){return _0x4a6085[_0xcc62('0xb7')](_0x194f29[_0xcc62('0x71')][_0xcc62('0xb9')],_[_0xcc62('0xba')](_0x194f29[_0xcc62('0x71')],['ids','id'])||{});}})['then'](respondWithResult(_0xb1095c,null))[_0xcc62('0x35')](handleError(_0xb1095c,null));};exports[_0xcc62('0xbb')]=function(_0x36cdce,_0x25f04e,_0x2043bf){var _0x4fee0d={'raw':![],'where':{}};var _0x277af7={};var _0x260c6e={'count':0x0,'rows':[]};return db[_0xcc62('0xb5')]['findOne']({'where':{'id':_0x36cdce[_0xcc62('0xb1')]['id']}})[_0xcc62('0x29')](handleEntityNotFound(_0x25f04e,null))['then'](function(_0x2a08f4){if(_0x2a08f4){_0x277af7['model']=_['keys'](db['FaxMessage'][_0xcc62('0x3e')]);_0x277af7[_0xcc62('0x40')]=_['keys'](_0x36cdce[_0xcc62('0x40')]);_0x277af7[_0xcc62('0x42')]=_[_0xcc62('0x43')](_0x277af7[_0xcc62('0x3f')],_0x277af7['query']);_0x4fee0d[_0xcc62('0x45')]=_['intersection'](_0x277af7['model'],qs[_0xcc62('0x44')](_0x36cdce[_0xcc62('0x40')]['fields']));_0x4fee0d['attributes']=_0x4fee0d['attributes']['length']?_0x4fee0d[_0xcc62('0x45')]:_0x277af7[_0xcc62('0x3f')];if(!_0x36cdce[_0xcc62('0x40')][_0xcc62('0x47')](_0xcc62('0xbc'))){_0x4fee0d[_0xcc62('0x21')]=qs[_0xcc62('0x21')](_0x36cdce[_0xcc62('0x40')]['limit']);_0x4fee0d[_0xcc62('0x1f')]=qs['offset'](_0x36cdce[_0xcc62('0x40')][_0xcc62('0x1f')]);}_0x4fee0d['order']=qs[_0xcc62('0x48')](_0x36cdce['query'][_0xcc62('0x48')]);_0x4fee0d[_0xcc62('0x49')]=qs[_0xcc62('0x42')](_[_0xcc62('0x4a')](_0x36cdce[_0xcc62('0x40')],_0x277af7[_0xcc62('0x42')]));_0x4fee0d[_0xcc62('0x49')][_0xcc62('0xbd')]=_0x2a08f4['id'];if(_0x36cdce['query'][_0xcc62('0x82')]){_0x4fee0d[_0xcc62('0x49')]=_[_0xcc62('0xbe')](_0x4fee0d['where'],{'$or':_[_0xcc62('0x2e')](_0x4fee0d['attributes'],function(_0x39601f){var _0x526877={};_0x526877[_0x39601f]={'$like':'%'+_0x36cdce[_0xcc62('0x40')][_0xcc62('0x82')]+'%'};return _0x526877;})});}if(_0x36cdce[_0xcc62('0x40')]['$gte']){var _0x2ea85f=_0x36cdce[_0xcc62('0x40')][_0xcc62('0xbf')][_0xcc62('0x31')](',');var _0x583d30={};_0x583d30[_0x2ea85f[0x0]]={'$gte':moment(_0x2ea85f[0x1])[_0xcc62('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4fee0d[_0xcc62('0x49')]=_[_0xcc62('0xbe')](_0x4fee0d[_0xcc62('0x49')],_0x583d30);}_0x4fee0d=_[_0xcc62('0xbe')]({},_0x4fee0d,_0x36cdce[_0xcc62('0xc1')]);return db[_0xcc62('0xb8')]['count']({'where':_0x4fee0d[_0xcc62('0x49')]})[_0xcc62('0x29')](function(_0x27f594){_0x260c6e[_0xcc62('0x22')]=_0x27f594;if(_0x36cdce['query'][_0xcc62('0xb2')]){_0x4fee0d['include']=[{'all':!![]}];}return db[_0xcc62('0xb8')]['findAll'](_0x4fee0d);})[_0xcc62('0x29')](function(_0x1cd21b){_0x260c6e[_0xcc62('0xaf')]=_0x1cd21b;return _0x260c6e;});}})['then'](respondWithFilteredResult(_0x25f04e,_0x4fee0d))[_0xcc62('0x35')](handleError(_0x25f04e,null));};exports[_0xcc62('0xc2')]=function(_0x441050,_0x49da04,_0x2ca2e9){return db[_0xcc62('0xb5')][_0xcc62('0x5f')]({'where':{'id':_0x441050[_0xcc62('0xb1')]['id']}})['then'](handleEntityNotFound(_0x49da04,null))[_0xcc62('0x29')](function(_0x3fd82c){if(_0x3fd82c){return _0x3fd82c[_0xcc62('0xc3')](_0x441050['body']['ids'],_['omit'](_0x441050['body'],[_0xcc62('0xb9'),'id'])||{})[_0xcc62('0xc4')](function(){return db['Tag']['findAll']({'attributes':['id',_0xcc62('0x2b'),_0xcc62('0x4c')],'where':{'id':_0x441050[_0xcc62('0x71')][_0xcc62('0xb9')]}});})[_0xcc62('0x29')](function(_0x2bf540){socket[_0xcc62('0xc5')]('faxInteractionTags:save',{'id':Number(_0x441050[_0xcc62('0xb1')]['id']),'tags':_0x2bf540||[]});return{'id':Number(_0x441050[_0xcc62('0xb1')]['id']),'tags':_0x2bf540||[]};});}})[_0xcc62('0x29')](respondWithResult(_0x49da04,null))['catch'](handleError(_0x49da04,null));};exports[_0xcc62('0xc6')]=function(_0x382bdb,_0x3e9d62,_0x52d613){return db['FaxInteraction']['find']({'where':{'id':_0x382bdb['params']['id']}})[_0xcc62('0x29')](handleEntityNotFound(_0x3e9d62,null))[_0xcc62('0x29')](function(_0x782270){if(_0x782270){return _0x782270[_0xcc62('0xc6')](_0x382bdb[_0xcc62('0x40')][_0xcc62('0xb9')]);}})[_0xcc62('0x29')](respondWithStatusCode(_0x3e9d62,null))['catch'](handleError(_0x3e9d62,null));};exports['download']=function(_0x4e5c87,_0x453294){var _0x323bd2=moment()[_0xcc62('0xc7')]()[_0xcc62('0x98')]();var _0x244350=path[_0xcc62('0xc8')](config[_0xcc62('0xc9')],_0xcc62('0xca'),_0xcc62('0xcb'),_0xcc62('0xcc'));var _0x559068=path['join'](config['root'],_0xcc62('0xca'),_0xcc62('0xcb'),_0xcc62('0xcd'));var _0x183e36=path[_0xcc62('0xc8')](_0x244350,_0x323bd2);var _0x15563e=util[_0xcc62('0xc0')](_0xcc62('0xce'),_0x4e5c87[_0xcc62('0xb1')]['id'],_0x323bd2);var _0x1c303a=path[_0xcc62('0xc8')](_0x244350,_0x15563e);var _0x3bbf0c=[];_0x3bbf0c[_0xcc62('0x34')]({'model':db[_0xcc62('0xcf')],'as':_0xcc62('0xcf'),'raw':!![]});var _0x26f892=[{'model':db[_0xcc62('0xb8')],'as':'Messages','attributes':['id',_0xcc62('0x71'),_0xcc62('0x78')],'include':_0x3bbf0c}];return db['FaxInteraction'][_0xcc62('0x5f')]({'where':{'id':_0x4e5c87[_0xcc62('0xb1')]['id']},'include':_0x26f892})[_0xcc62('0x29')](handleEntityNotFound(_0x453294,null))[_0xcc62('0x29')](function(_0x50e6d4){if(_0x50e6d4&&_0x50e6d4[_0xcc62('0xd0')]){var _0x413a28=_0x50e6d4[_0xcc62('0xd1')]({'plain':!![]});fs[_0xcc62('0xd2')](_0x183e36);for(var _0x2de292=0x0;_0x2de292<_0x413a28['Messages'][_0xcc62('0x46')];_0x2de292++){var _0x1af7d3=_0x413a28[_0xcc62('0xd0')][_0x2de292][_0xcc62('0xcf')];if(_0x1af7d3){var _0x2fd7fb=path[_0xcc62('0xc8')](_0x559068,_0x1af7d3[_0xcc62('0xd3')]);if(fs['existsSync'](_0x2fd7fb)){fs[_0xcc62('0xd4')](_0x2fd7fb)[_0xcc62('0xd5')](fs[_0xcc62('0xd6')](path[_0xcc62('0xc8')](_0x183e36,_0x1af7d3[_0xcc62('0xd3')])));}}}return BPromise['resolve']()[_0xcc62('0x29')](function(){return new BPromise(function(_0x3f3b0f,_0x2a5377){zipdir(_0x183e36,{'saveTo':_0x1c303a},function(_0x1b6870,_0x1ff8b3){if(_0x1b6870)return _0x2a5377(_0x1b6870);return _0x3f3b0f(_0x1ff8b3);});})[_0xcc62('0x29')](function(){return new BPromise(function(_0x3a4952,_0x1ce984){rimraf(_0x183e36,function(_0x2e5135){if(_0x2e5135)_0x1ce984(_0x2e5135);return _0x3a4952();});});})[_0xcc62('0x29')](function(){return _0x453294[_0xcc62('0xd7')](_0x1c303a,_0x15563e,function(_0x306fdb){if(_0x306fdb){console[_0xcc62('0xd8')](_0xcc62('0xd9'),_0x306fdb);}else{fs[_0xcc62('0xda')](_0x1c303a);}});});});}else{return _0x453294[_0xcc62('0x1d')](0xc8);}})['catch'](handleError(_0x453294,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f0a7426..3d5c684 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 _0xf36e=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xf36e,0x1bb));var _0xef36=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf36e[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xef36('0x0'));var FaxInteraction=require(_0xef36('0x1'))['db'][_0xef36('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xef36('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xef36('0x4')](0x0);var events={'afterCreate':_0xef36('0x5'),'afterUpdate':'update','afterDestroy':_0xef36('0x6')};function emitEvent(_0x4088b4){return function(_0x24a3ec,_0x3793b3,_0x299514){_0x24a3ec['getUsers']({'attributes':['id'],'raw':!![]})[_0xef36('0x7')](function(_0x296d9e){_0x24a3ec[_0xef36('0x8')]('Users',_0x296d9e['map'](function(_0x2646fa){return{'id':_0x2646fa['id']};}));return FaxMessage[_0xef36('0x9')]({'where':{'FaxInteractionId':_0x24a3ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef36('0x7')](function(_0xb8eaeb){_0x24a3ec[_0xef36('0x8')](_0xef36('0xa'),_0xb8eaeb[_0xef36('0xb')]);FaxInteractionEvents['emit'](_0x4088b4+':'+_0x24a3ec['id'],_0x24a3ec);FaxInteractionEvents[_0xef36('0xc')](_0x4088b4,_0x24a3ec);_0x299514(null);})[_0xef36('0xd')](_0x299514(null));};}for(var e in events){if(events[_0xef36('0xe')](e)){var event=events[e];FaxInteraction[_0xef36('0xf')](e,emitEvent(event));}}module[_0xef36('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x4065=['then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','update','getUsers'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4065,0x13d));var _0x5406=function(_0x43c8ef,_0x34b34d){_0x43c8ef=_0x43c8ef-0x0;var _0x31684e=_0x4065[_0x43c8ef];return _0x31684e;};'use strict';var EventEmitter=require(_0x5406('0x0'));var FaxInteraction=require(_0x5406('0x1'))['db'][_0x5406('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5406('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5406('0x4'),'afterDestroy':'remove'};function emitEvent(_0x522408){return function(_0x53d4ab,_0x263eae,_0x368a6c){_0x53d4ab[_0x5406('0x5')]({'attributes':['id'],'raw':!![]})[_0x5406('0x6')](function(_0x40fd6b){_0x53d4ab[_0x5406('0x7')](_0x5406('0x8'),_0x40fd6b['map'](function(_0x190593){return{'id':_0x190593['id']};}));return FaxMessage[_0x5406('0x9')]({'where':{'FaxInteractionId':_0x53d4ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5406('0x6')](function(_0x4e34e5){_0x53d4ab[_0x5406('0x7')](_0x5406('0xa'),_0x4e34e5[_0x5406('0xb')]);FaxInteractionEvents[_0x5406('0xc')](_0x522408+':'+_0x53d4ab['id'],_0x53d4ab);FaxInteractionEvents[_0x5406('0xc')](_0x522408,_0x53d4ab);_0x368a6c(null);})[_0x5406('0xd')](_0x368a6c(null));};}for(var e in events){if(events[_0x5406('0xe')](e)){var event=events[e];FaxInteraction[_0x5406('0xf')](e,emitEvent(event));}}module[_0x5406('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d2b5582..89833b5 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 _0xbf6c=['closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions'];(function(_0x4ae0a2,_0x566c05){var _0x53889d=function(_0x206445){while(--_0x206445){_0x4ae0a2['push'](_0x4ae0a2['shift']());}};_0x53889d(++_0x566c05);}(_0xbf6c,0x1a6));var _0xcbf6=function(_0x4fe4d8,_0x27b6cb){_0x4fe4d8=_0x4fe4d8-0x0;var _0x576b22=_0xbf6c[_0x4fe4d8];return _0x576b22;};'use strict';var _=require(_0xcbf6('0x0'));var util=require(_0xcbf6('0x1'));var logger=require('../../config/logger')(_0xcbf6('0x2'));var moment=require(_0xcbf6('0x3'));var BPromise=require(_0xcbf6('0x4'));var rp=require(_0xcbf6('0x5'));var fs=require('fs');var path=require(_0xcbf6('0x6'));var rimraf=require(_0xcbf6('0x7'));var config=require(_0xcbf6('0x8'));var attributes=require(_0xcbf6('0x9'));module['exports']=function(_0x58be56,_0x5ad0ce){return _0x58be56[_0xcbf6('0xa')](_0xcbf6('0xb'),attributes,{'tableName':_0xcbf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15800d,_0x40d87b,_0x33e4de){if(_0x15800d['changed'](_0xcbf6('0xd'))){_0x15800d['closedAt']=moment()['format'](_0xcbf6('0xe'));}_0x33e4de(null,_0x15800d);}}});}; \ No newline at end of file +var _0x77de=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4f4b98,_0x4fc762){var _0x4f32cd=function(_0x21ba11){while(--_0x21ba11){_0x4f4b98['push'](_0x4f4b98['shift']());}};_0x4f32cd(++_0x4fc762);}(_0x77de,0x1d0));var _0xe77d=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x77de[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0xe77d('0x0'));var util=require(_0xe77d('0x1'));var logger=require(_0xe77d('0x2'))(_0xe77d('0x3'));var moment=require('moment');var BPromise=require(_0xe77d('0x4'));var rp=require(_0xe77d('0x5'));var fs=require('fs');var path=require(_0xe77d('0x6'));var rimraf=require(_0xe77d('0x7'));var config=require(_0xe77d('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x30a0e5,_0x2d8811){return _0x30a0e5[_0xe77d('0x9')](_0xe77d('0xa'),attributes,{'tableName':_0xe77d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcc5d1f,_0x42be92,_0x1c6088){if(_0xcc5d1f[_0xe77d('0xc')]('closed')){_0xcc5d1f[_0xe77d('0xd')]=moment()[_0xe77d('0xe')](_0xe77d('0xf'));}_0x1c6088(null,_0xcc5d1f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index feb1016..765a6b4 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 _0x20d7=['debug','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','body','options','where','limit','UpdateFaxInteraction'];(function(_0x4a2e12,_0x8b172b){var _0x2b8506=function(_0x5b9d30){while(--_0x5b9d30){_0x4a2e12['push'](_0x4a2e12['shift']());}};_0x2b8506(++_0x8b172b);}(_0x20d7,0xe6));var _0x720d=function(_0x5f9a6,_0x268d42){_0x5f9a6=_0x5f9a6-0x0;var _0x1d24ac=_0x20d7[_0x5f9a6];return _0x1d24ac;};'use strict';var _=require(_0x720d('0x0'));var util=require(_0x720d('0x1'));var moment=require(_0x720d('0x2'));var BPromise=require(_0x720d('0x3'));var rs=require(_0x720d('0x4'));var fs=require('fs');var Redis=require(_0x720d('0x5'));var db=require(_0x720d('0x6'))['db'];var utils=require(_0x720d('0x7'));var logger=require(_0x720d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x720d('0x9'));var client=jayson[_0x720d('0xa')][_0x720d('0xb')]({'port':0x232a});config[_0x720d('0xc')]=_['defaults'](config[_0x720d('0xc')],{'host':_0x720d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x720d('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1f5236,_0x5486e4,_0x3f30e3){return new BPromise(function(_0x1d6e60,_0xffbfc7){return client[_0x720d('0xe')](_0x1f5236,_0x3f30e3)[_0x720d('0xf')](function(_0x30229c){logger[_0x720d('0x10')](_0x720d('0x11'),_0x5486e4,_0x720d('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x5486e4,_0x720d('0x12'),JSON[_0x720d('0x13')](_0x30229c));if(_0x30229c['error']){if(_0x30229c['error'][_0x720d('0x14')]===0x1f4){logger[_0x720d('0x15')](_0x720d('0x11'),_0x5486e4,_0x30229c[_0x720d('0x15')][_0x720d('0x16')]);return _0xffbfc7(_0x30229c[_0x720d('0x15')]['message']);}logger[_0x720d('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x5486e4,_0x30229c['error']['message']);return _0x1d6e60(_0x30229c['error'][_0x720d('0x16')]);}else{logger['info'](_0x720d('0x11'),_0x5486e4,'request\x20sent');_0x1d6e60(_0x30229c['result'][_0x720d('0x16')]);}})[_0x720d('0x17')](function(_0x200337){logger['error'](_0x720d('0x11'),_0x5486e4,_0x200337);_0xffbfc7(_0x200337);});});}exports['UpdateFaxInteraction']=function(_0x22f6a7){var _0x442065=this;return new Promise(function(_0x1929b6,_0x54c00c){return db['FaxInteraction']['update'](_0x22f6a7[_0x720d('0x18')],{'raw':_0x22f6a7[_0x720d('0x19')]?_0x22f6a7[_0x720d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f6a7['options']?_0x22f6a7[_0x720d('0x19')][_0x720d('0x1a')]||null:null,'attributes':_0x22f6a7['options']?_0x22f6a7[_0x720d('0x19')]['attributes']||null:null,'limit':_0x22f6a7[_0x720d('0x19')]?_0x22f6a7[_0x720d('0x19')][_0x720d('0x1b')]||null:null})[_0x720d('0xf')](function(_0x3a68cc){logger['info'](_0x720d('0x1c'),_0x22f6a7);logger[_0x720d('0x1d')](_0x720d('0x1c'),_0x22f6a7,JSON[_0x720d('0x13')](_0x3a68cc));_0x1929b6(_0x3a68cc);})['catch'](function(_0x20b0bd){logger[_0x720d('0x15')](_0x720d('0x1c'),_0x20b0bd[_0x720d('0x16')],_0x22f6a7);_0x54c00c(_0x442065[_0x720d('0x15')](0x1f4,_0x20b0bd['message']));});});};exports[_0x720d('0x1e')]=function(_0x181b7d){return new Promise(function(_0x4b62f8,_0x5e6c6f){return db[_0x720d('0x1f')][_0x720d('0x20')]({'where':_0x181b7d[_0x720d('0x19')]?_0x181b7d['options']['where']||null:null})['then'](function(_0x2114dc){if(_0x2114dc){return _0x2114dc[_0x720d('0x21')](_0x181b7d[_0x720d('0x18')][_0x720d('0x22')],_['omit'](_0x181b7d[_0x720d('0x18')],['ids','id'])||{});}})[_0x720d('0x23')](function(_0x3f1e11){logger[_0x720d('0x10')](_0x720d('0x24'),_0x181b7d);logger[_0x720d('0x1d')](_0x720d('0x24'),_0x181b7d,JSON['stringify'](_0x3f1e11));_0x4b62f8(_0x3f1e11);})[_0x720d('0x17')](function(_0x177ab7){logger[_0x720d('0x15')](_0x720d('0x24'),_0x177ab7['message'],_0x181b7d);_0x5e6c6f(_this[_0x720d('0x15')](0x1f4,_0x177ab7[_0x720d('0x16')]));});});}; \ No newline at end of file +var _0x3ef5=['attributes','debug','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxInteraction.socket','register','then','info','request\x20sent','stringify','error','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','update','body','options','where'];(function(_0x394a43,_0xfcdb69){var _0x190b5a=function(_0x31c0a3){while(--_0x31c0a3){_0x394a43['push'](_0x394a43['shift']());}};_0x190b5a(++_0xfcdb69);}(_0x3ef5,0xa1));var _0x53ef=function(_0x5d7047,_0x4d9f67){_0x5d7047=_0x5d7047-0x0;var _0x20101d=_0x3ef5[_0x5d7047];return _0x20101d;};'use strict';var _=require(_0x53ef('0x0'));var util=require(_0x53ef('0x1'));var moment=require(_0x53ef('0x2'));var BPromise=require(_0x53ef('0x3'));var rs=require(_0x53ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53ef('0x6'))(_0x53ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x53ef('0x8'));var client=jayson[_0x53ef('0x9')]['http']({'port':0x232a});config[_0x53ef('0xa')]=_[_0x53ef('0xb')](config['redis'],{'host':_0x53ef('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x53ef('0xd'))[_0x53ef('0xe')](socket);function respondWithRpcPromise(_0x133aa0,_0x132caa,_0xa27d4a){return new BPromise(function(_0x215d64,_0x3442e2){return client['request'](_0x133aa0,_0xa27d4a)[_0x53ef('0xf')](function(_0x23ae11){logger[_0x53ef('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x132caa,_0x53ef('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x132caa,_0x53ef('0x11'),JSON[_0x53ef('0x12')](_0x23ae11));if(_0x23ae11[_0x53ef('0x13')]){if(_0x23ae11['error']['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x132caa,_0x23ae11[_0x53ef('0x13')][_0x53ef('0x14')]);return _0x3442e2(_0x23ae11[_0x53ef('0x13')][_0x53ef('0x14')]);}logger[_0x53ef('0x13')](_0x53ef('0x15'),_0x132caa,_0x23ae11[_0x53ef('0x13')][_0x53ef('0x14')]);return _0x215d64(_0x23ae11[_0x53ef('0x13')]['message']);}else{logger[_0x53ef('0x10')](_0x53ef('0x15'),_0x132caa,'request\x20sent');_0x215d64(_0x23ae11[_0x53ef('0x16')]['message']);}})[_0x53ef('0x17')](function(_0x5a2a4c){logger[_0x53ef('0x13')](_0x53ef('0x15'),_0x132caa,_0x5a2a4c);_0x3442e2(_0x5a2a4c);});});}exports[_0x53ef('0x18')]=function(_0x5ab566){var _0x2236ab=this;return new Promise(function(_0x4ea1ba,_0x499434){return db['FaxInteraction'][_0x53ef('0x19')](_0x5ab566[_0x53ef('0x1a')],{'raw':_0x5ab566[_0x53ef('0x1b')]?_0x5ab566[_0x53ef('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ab566[_0x53ef('0x1b')]?_0x5ab566[_0x53ef('0x1b')][_0x53ef('0x1c')]||null:null,'attributes':_0x5ab566['options']?_0x5ab566[_0x53ef('0x1b')][_0x53ef('0x1d')]||null:null,'limit':_0x5ab566[_0x53ef('0x1b')]?_0x5ab566[_0x53ef('0x1b')]['limit']||null:null})[_0x53ef('0xf')](function(_0x1d3cda){logger[_0x53ef('0x10')](_0x53ef('0x18'),_0x5ab566);logger[_0x53ef('0x1e')]('UpdateFaxInteraction',_0x5ab566,JSON[_0x53ef('0x12')](_0x1d3cda));_0x4ea1ba(_0x1d3cda);})[_0x53ef('0x17')](function(_0x5b2538){logger['error'](_0x53ef('0x18'),_0x5b2538['message'],_0x5ab566);_0x499434(_0x2236ab[_0x53ef('0x13')](0x1f4,_0x5b2538[_0x53ef('0x14')]));});});};exports[_0x53ef('0x1f')]=function(_0xb4aefd){return new Promise(function(_0x2a54a8,_0x48080a){return db[_0x53ef('0x20')][_0x53ef('0x21')]({'where':_0xb4aefd[_0x53ef('0x1b')]?_0xb4aefd[_0x53ef('0x1b')][_0x53ef('0x1c')]||null:null})[_0x53ef('0xf')](function(_0x54db7b){if(_0x54db7b){return _0x54db7b[_0x53ef('0x22')](_0xb4aefd[_0x53ef('0x1a')][_0x53ef('0x23')],_['omit'](_0xb4aefd['body'],[_0x53ef('0x23'),'id'])||{});}})[_0x53ef('0x24')](function(_0x33d647){logger[_0x53ef('0x10')](_0x53ef('0x25'),_0xb4aefd);logger[_0x53ef('0x1e')](_0x53ef('0x25'),_0xb4aefd,JSON[_0x53ef('0x12')](_0x33d647));_0x2a54a8(_0x33d647);})['catch'](function(_0x5019af){logger[_0x53ef('0x13')](_0x53ef('0x25'),_0x5019af[_0x53ef('0x14')],_0xb4aefd);_0x48080a(_this['error'](0x1f4,_0x5019af['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0d67440..9a0869d 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 _0x2327=['emit','removeListener','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2327,0x11c));var _0x7232=function(_0x577727,_0x5b41e7){_0x577727=_0x577727-0x0;var _0x4c4270=_0x2327[_0x577727];return _0x4c4270;};'use strict';var FaxInteractionEvents=require(_0x7232('0x0'));var events=[_0x7232('0x1'),_0x7232('0x2'),'update'];function createListener(_0x2aa68d,_0x1e6d93){return function(_0x190960){_0x1e6d93[_0x7232('0x3')](_0x2aa68d,_0x190960);};}function removeListener(_0x2fb659,_0x1e0e6b){return function(){FaxInteractionEvents[_0x7232('0x4')](_0x2fb659,_0x1e0e6b);};}exports[_0x7232('0x5')]=function(_0x1fc4b2){for(var _0x31a523=0x0,_0x5be525=events['length'];_0x31a523<_0x5be525;_0x31a523++){var _0x2ddef3=events[_0x31a523];var _0x1d349f=createListener(_0x7232('0x6')+_0x2ddef3,_0x1fc4b2);FaxInteractionEvents['on'](_0x2ddef3,_0x1d349f);}}; \ No newline at end of file +var _0xa9b4=['length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xa9b4,0x74));var _0x4a9b=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xa9b4[_0x412e27];return _0x53da42;};'use strict';var FaxInteractionEvents=require(_0x4a9b('0x0'));var events=[_0x4a9b('0x1'),_0x4a9b('0x2'),_0x4a9b('0x3')];function createListener(_0x3c75c7,_0x4bb9d7){return function(_0x3c6bc6){_0x4bb9d7['emit'](_0x3c75c7,_0x3c6bc6);};}function removeListener(_0x245a15,_0x59e654){return function(){FaxInteractionEvents['removeListener'](_0x245a15,_0x59e654);};}exports['register']=function(_0x180662){for(var _0x33d839=0x0,_0x45ab82=events[_0x4a9b('0x4')];_0x33d839<_0x45ab82;_0x33d839++){var _0x1adc59=events[_0x33d839];var _0x4d575b=createListener(_0x4a9b('0x5')+_0x1adc59,_0x180662);FaxInteractionEvents['on'](_0x1adc59,_0x4d575b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fd41d2b..ab49a96 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 _0x846e=['describe','/:id','show','getMessages','download','post','addMessage','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','get','/describe'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x846e,0x1a7));var _0xe846=function(_0x4067da,_0x59ff32){_0x4067da=_0x4067da-0x0;var _0x405111=_0x846e[_0x4067da];return _0x405111;};'use strict';var multer=require('multer');var util=require(_0xe846('0x0'));var path=require('path');var timeout=require(_0xe846('0x1'));var express=require(_0xe846('0x2'));var router=express['Router']();var fs_extra=require(_0xe846('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe846('0x4'));var config=require('../../config/environment');var controller=require(_0xe846('0x5'));router['get']('/',auth[_0xe846('0x6')](),controller['index']);router[_0xe846('0x7')](_0xe846('0x8'),auth[_0xe846('0x6')](),controller[_0xe846('0x9')]);router[_0xe846('0x7')](_0xe846('0xa'),auth[_0xe846('0x6')](),controller[_0xe846('0xb')]);router[_0xe846('0x7')]('/:id/messages',auth[_0xe846('0x6')](),controller[_0xe846('0xc')]);router['get']('/:id/download',auth[_0xe846('0x6')](),controller[_0xe846('0xd')]);router[_0xe846('0xe')]('/',auth[_0xe846('0x6')](),controller['create']);router[_0xe846('0xe')]('/:id/messages',auth[_0xe846('0x6')](),controller[_0xe846('0xf')]);router[_0xe846('0xe')]('/:id/tags',auth[_0xe846('0x6')](),interaction[_0xe846('0x10')]('fax',_0xe846('0x11')),controller[_0xe846('0x12')]);router['put'](_0xe846('0xa'),auth[_0xe846('0x6')](),interaction[_0xe846('0x10')](_0xe846('0x13'),_0xe846('0x14')),controller[_0xe846('0x15')]);router['delete'](_0xe846('0xa'),auth[_0xe846('0x6')](),interaction['tracked'](_0xe846('0x13'),_0xe846('0x16')),controller[_0xe846('0x17')]);router['delete'](_0xe846('0x18'),auth[_0xe846('0x6')](),controller[_0xe846('0x19')]);module[_0xe846('0x1a')]=router; \ No newline at end of file +var _0x14d8=['get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction: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'];(function(_0x1ce926,_0x108f46){var _0x28ba23=function(_0x27a518){while(--_0x27a518){_0x1ce926['push'](_0x1ce926['shift']());}};_0x28ba23(++_0x108f46);}(_0x14d8,0x9f));var _0x814d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x14d8[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var path=require(_0x814d('0x2'));var timeout=require(_0x814d('0x3'));var express=require(_0x814d('0x4'));var router=express[_0x814d('0x5')]();var fs_extra=require(_0x814d('0x6'));var auth=require(_0x814d('0x7'));var interaction=require(_0x814d('0x8'));var config=require(_0x814d('0x9'));var controller=require(_0x814d('0xa'));router[_0x814d('0xb')]('/',auth[_0x814d('0xc')](),controller[_0x814d('0xd')]);router[_0x814d('0xb')](_0x814d('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x814d('0xb')](_0x814d('0xf'),auth[_0x814d('0xc')](),controller['show']);router[_0x814d('0xb')](_0x814d('0x10'),auth['isAuthenticated'](),controller[_0x814d('0x11')]);router[_0x814d('0xb')](_0x814d('0x12'),auth['isAuthenticated'](),controller[_0x814d('0x13')]);router[_0x814d('0x14')]('/',auth[_0x814d('0xc')](),controller[_0x814d('0x15')]);router[_0x814d('0x14')](_0x814d('0x10'),auth[_0x814d('0xc')](),controller[_0x814d('0x16')]);router['post'](_0x814d('0x17'),auth[_0x814d('0xc')](),interaction[_0x814d('0x18')](_0x814d('0x19'),_0x814d('0x1a')),controller[_0x814d('0x1b')]);router[_0x814d('0x1c')](_0x814d('0xf'),auth[_0x814d('0xc')](),interaction[_0x814d('0x18')](_0x814d('0x19'),_0x814d('0x1d')),controller['update']);router[_0x814d('0x1e')]('/:id',auth[_0x814d('0xc')](),interaction[_0x814d('0x18')]('fax',_0x814d('0x1f')),controller['destroy']);router['delete']('/:id/tags',auth[_0x814d('0xc')](),controller[_0x814d('0x20')]);module[_0x814d('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 3473560..1fe2d52 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 _0x54f3=['exports','TEXT','medium','BOOLEAN','ENUM','DATE'];(function(_0x9bcc0b,_0x120f6c){var _0x195399=function(_0x5be8b9){while(--_0x5be8b9){_0x9bcc0b['push'](_0x9bcc0b['shift']());}};_0x195399(++_0x120f6c);}(_0x54f3,0x120));var _0x354f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x54f3[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'body':{'type':Sequelize[_0x354f('0x1')](_0x354f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x354f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x354f('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x354f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x354f('0x5')]}}; \ No newline at end of file +var _0x72b1=['sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x72b1,0x16e));var _0x172b=function(_0xcac133,_0x3c84fd){_0xcac133=_0xcac133-0x0;var _0x38dc9a=_0x72b1[_0xcac133];return _0x38dc9a;};'use strict';var Sequelize=require(_0x172b('0x0'));module['exports']={'body':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x172b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x172b('0x4')]('in',_0x172b('0x5')),'defaultValue':_0x172b('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x172b('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ab6a0be..7114703 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 _0x83a0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','jayson/promise','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','update','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','fullname','email','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring'];(function(_0x4b2976,_0x11a553){var _0x43a714=function(_0x1c989a){while(--_0x1c989a){_0x4b2976['push'](_0x4b2976['shift']());}};_0x43a714(++_0x11a553);}(_0x83a0,0x111));var _0x083a=function(_0x6751fa,_0x410198){_0x6751fa=_0x6751fa-0x0;var _0x3f24c1=_0x83a0[_0x6751fa];return _0x3f24c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x083a('0x0'));var rp=require(_0x083a('0x1'));var moment=require('moment');var BPromise=require(_0x083a('0x2'));var Mustache=require(_0x083a('0x3'));var util=require(_0x083a('0x4'));var path=require(_0x083a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x083a('0x6'));var fs=require('fs');var fs_extra=require(_0x083a('0x7'));var _=require(_0x083a('0x8'));var squel=require('squel');var crypto=require(_0x083a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x083a('0xa'));var toCsv=require(_0x083a('0xb'));var querystring=require(_0x083a('0xc'));var Papa=require('papaparse');var Redis=require(_0x083a('0xd'));var authService=require(_0x083a('0xe'));var qs=require(_0x083a('0xf'));var as=require(_0x083a('0x10'));var hardwareService=require(_0x083a('0x11'));var logger=require(_0x083a('0x12'))('api');var utils=require(_0x083a('0x13'));var config=require(_0x083a('0x14'));var licenseUtil=require(_0x083a('0x15'));var db=require('../../mysqldb')['db'];config[_0x083a('0x16')]=_[_0x083a('0x17')](config[_0x083a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x083a('0x18'))(new Redis(config[_0x083a('0x16')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x083a('0x19'));var client=jayson['client'][_0x083a('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37987e,_0xa52ae9,_0x2a82da,_0x2c969f){return new BPromise(function(_0x372420,_0x58b030){var _0x271fed=_0x2c969f||client;return _0x271fed[_0x083a('0x1b')](_0x37987e,_0x2a82da)[_0x083a('0x1c')](function(_0x308f65){logger[_0x083a('0x1d')](_0x083a('0x1e'),_0xa52ae9,_0x083a('0x1f'));logger[_0x083a('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xa52ae9,_0x083a('0x1f'),JSON['stringify'](_0x308f65));if(_0x308f65[_0x083a('0x21')]){if(_0x308f65[_0x083a('0x21')][_0x083a('0x22')]===0x1f4){logger[_0x083a('0x21')](_0x083a('0x1e'),_0xa52ae9,_0x308f65['error'][_0x083a('0x23')]);return _0x58b030(_0x308f65[_0x083a('0x21')]['message']);}logger[_0x083a('0x21')](_0x083a('0x1e'),_0xa52ae9,_0x308f65[_0x083a('0x21')][_0x083a('0x23')]);return _0x372420(_0x308f65[_0x083a('0x21')][_0x083a('0x23')]);}else{logger[_0x083a('0x1d')]('FaxMessage,\x20%s,\x20%s',_0xa52ae9,_0x083a('0x1f'));_0x372420(_0x308f65[_0x083a('0x24')][_0x083a('0x23')]);}})['catch'](function(_0x723d1f){logger['error']('FaxMessage,\x20%s,\x20%s',_0xa52ae9,_0x723d1f);_0x58b030(_0x723d1f);});});}function respondWithStatusCode(_0x1cdf22,_0x11f986){_0x11f986=_0x11f986||0xcc;return function(_0xb7ba4){if(_0xb7ba4){return _0x1cdf22[_0x083a('0x25')](_0x11f986);}return _0x1cdf22[_0x083a('0x26')](_0x11f986)[_0x083a('0x27')]();};}function respondWithResult(_0x38776b,_0x24834d){_0x24834d=_0x24834d||0xc8;return function(_0x1cbe39){if(_0x1cbe39){return _0x38776b['status'](_0x24834d)['json'](_0x1cbe39);}};}function respondWithFilteredResult(_0x39b161,_0x99134){return function(_0x2541e7){if(_0x2541e7){var _0x277609=typeof _0x99134[_0x083a('0x28')]==='undefined'&&typeof _0x99134[_0x083a('0x29')]===_0x083a('0x2a');var _0x265a99=_0x2541e7[_0x083a('0x2b')];var _0x8ac9cc=_0x277609?0x0:_0x99134[_0x083a('0x28')];var _0x3387ec=_0x277609?_0x2541e7['count']:_0x99134[_0x083a('0x28')]+_0x99134[_0x083a('0x29')];var _0x3c0059;if(_0x3387ec>=_0x265a99){_0x3387ec=_0x265a99;_0x3c0059=0xc8;}else{_0x3c0059=0xce;}_0x39b161[_0x083a('0x26')](_0x3c0059);return _0x39b161[_0x083a('0x2c')](_0x083a('0x2d'),_0x8ac9cc+'-'+_0x3387ec+'/'+_0x265a99)['json'](_0x2541e7);}return null;};}function patchUpdates(_0x5fb667){return function(_0x4342fe){try{jsonpatch[_0x083a('0x2e')](_0x4342fe,_0x5fb667,!![]);}catch(_0x364874){return BPromise[_0x083a('0x2f')](_0x364874);}return _0x4342fe[_0x083a('0x30')]();};}function saveUpdates(_0x18775f,_0x56e3f4){return function(_0x1e74c0){if(_0x1e74c0){return _0x1e74c0['update'](_0x18775f)[_0x083a('0x1c')](function(_0x40b0e6){return _0x40b0e6;});}return null;};}function removeEntity(_0xeeeb98,_0x433637){return function(_0x55c32b){if(_0x55c32b){return _0x55c32b[_0x083a('0x31')]()[_0x083a('0x1c')](function(){_0xeeeb98[_0x083a('0x26')](0xcc)[_0x083a('0x27')]();});}};}function handleEntityNotFound(_0x5c814b,_0x4074dd){return function(_0x4af072){if(!_0x4af072){_0x5c814b['sendStatus'](0x194);}return _0x4af072;};}function handleError(_0x2ca552,_0xddabfe){_0xddabfe=_0xddabfe||0x1f4;return function(_0x3e56b6){logger['error'](_0x3e56b6['stack']);if(_0x3e56b6['name']){delete _0x3e56b6[_0x083a('0x32')];}_0x2ca552['status'](_0xddabfe)[_0x083a('0x33')](_0x3e56b6);};}exports[_0x083a('0x34')]=function(_0x1e7372,_0x1c2e21){var _0x110a0d={},_0x4718f4={},_0x221e20={'count':0x0,'rows':[]};var _0x55bf0e=_[_0x083a('0x35')](db[_0x083a('0x36')][_0x083a('0x37')],function(_0x5cc4c0){return{'name':_0x5cc4c0[_0x083a('0x38')],'type':_0x5cc4c0[_0x083a('0x39')][_0x083a('0x3a')]};});_0x4718f4[_0x083a('0x3b')]=_['map'](_0x55bf0e,_0x083a('0x32'));_0x4718f4['query']=_[_0x083a('0x3c')](_0x1e7372[_0x083a('0x3d')]);_0x4718f4[_0x083a('0x3e')]=_[_0x083a('0x3f')](_0x4718f4[_0x083a('0x3b')],_0x4718f4['query']);_0x110a0d['attributes']=_[_0x083a('0x3f')](_0x4718f4[_0x083a('0x3b')],qs[_0x083a('0x40')](_0x1e7372['query'][_0x083a('0x40')]));_0x110a0d['attributes']=_0x110a0d['attributes'][_0x083a('0x41')]?_0x110a0d[_0x083a('0x42')]:_0x4718f4[_0x083a('0x3b')];if(!_0x1e7372['query'][_0x083a('0x43')](_0x083a('0x44'))){_0x110a0d[_0x083a('0x29')]=qs['limit'](_0x1e7372['query'][_0x083a('0x29')]);_0x110a0d[_0x083a('0x28')]=qs[_0x083a('0x28')](_0x1e7372[_0x083a('0x3d')][_0x083a('0x28')]);}_0x110a0d['order']=qs[_0x083a('0x45')](_0x1e7372[_0x083a('0x3d')][_0x083a('0x45')]);_0x110a0d[_0x083a('0x46')]=qs[_0x083a('0x3e')](_['pick'](_0x1e7372[_0x083a('0x3d')],_0x4718f4['filters']),_0x55bf0e);if(_0x1e7372[_0x083a('0x3d')][_0x083a('0x47')]){_0x110a0d[_0x083a('0x46')]=_[_0x083a('0x48')](_0x110a0d['where'],{'$or':_[_0x083a('0x35')](_0x55bf0e,function(_0x29d142){if(_0x29d142['type']!==_0x083a('0x49')){var _0x1bdf3b={};_0x1bdf3b[_0x29d142[_0x083a('0x32')]]={'$like':'%'+_0x1e7372[_0x083a('0x3d')][_0x083a('0x47')]+'%'};return _0x1bdf3b;}})});}_0x110a0d=_['merge']({},_0x110a0d,_0x1e7372[_0x083a('0x4a')]);var _0xb7611f={'where':_0x110a0d['where']};return db['FaxMessage']['count'](_0xb7611f)[_0x083a('0x1c')](function(_0x5f145e){_0x221e20[_0x083a('0x2b')]=_0x5f145e;if(_0x1e7372['query'][_0x083a('0x4b')]){_0x110a0d[_0x083a('0x4c')]=[{'all':!![]}];}return db[_0x083a('0x36')][_0x083a('0x4d')](_0x110a0d);})[_0x083a('0x1c')](function(_0x1dff81){_0x221e20[_0x083a('0x4e')]=_0x1dff81;return _0x221e20;})['then'](respondWithFilteredResult(_0x1c2e21,_0x110a0d))[_0x083a('0x4f')](handleError(_0x1c2e21,null));};exports[_0x083a('0x50')]=function(_0x301210,_0x150faf){var _0x24a6d3={'raw':!![],'where':{'id':_0x301210[_0x083a('0x51')]['id']}},_0x37e139={};_0x37e139[_0x083a('0x3b')]=_[_0x083a('0x3c')](db[_0x083a('0x36')][_0x083a('0x37')]);_0x37e139[_0x083a('0x3d')]=_[_0x083a('0x3c')](_0x301210['query']);_0x37e139[_0x083a('0x3e')]=_['intersection'](_0x37e139[_0x083a('0x3b')],_0x37e139[_0x083a('0x3d')]);_0x24a6d3[_0x083a('0x42')]=_['intersection'](_0x37e139[_0x083a('0x3b')],qs[_0x083a('0x40')](_0x301210[_0x083a('0x3d')][_0x083a('0x40')]));_0x24a6d3[_0x083a('0x42')]=_0x24a6d3[_0x083a('0x42')][_0x083a('0x41')]?_0x24a6d3[_0x083a('0x42')]:_0x37e139[_0x083a('0x3b')];if(_0x301210['query'][_0x083a('0x4b')]){_0x24a6d3[_0x083a('0x4c')]=[{'all':!![]}];}_0x24a6d3=_[_0x083a('0x48')]({},_0x24a6d3,_0x301210['options']);return db[_0x083a('0x36')]['find'](_0x24a6d3)[_0x083a('0x1c')](handleEntityNotFound(_0x150faf,null))[_0x083a('0x1c')](respondWithResult(_0x150faf,null))['catch'](handleError(_0x150faf,null));};exports[_0x083a('0x52')]=function(_0x53692b,_0x159fd2){if(_0x53692b[_0x083a('0x53')]['id']){delete _0x53692b[_0x083a('0x53')]['id'];}return db[_0x083a('0x36')][_0x083a('0x54')]({'where':{'id':_0x53692b['params']['id']}})[_0x083a('0x1c')](handleEntityNotFound(_0x159fd2,null))['then'](saveUpdates(_0x53692b['body'],null))[_0x083a('0x1c')](respondWithResult(_0x159fd2,null))['catch'](handleError(_0x159fd2,null));};exports[_0x083a('0x31')]=function(_0xdd7125,_0x5d04be){return db[_0x083a('0x36')][_0x083a('0x54')]({'where':{'id':_0xdd7125[_0x083a('0x51')]['id']}})[_0x083a('0x1c')](handleEntityNotFound(_0x5d04be,null))[_0x083a('0x1c')](removeEntity(_0x5d04be,null))[_0x083a('0x4f')](handleError(_0x5d04be,null));};exports[_0x083a('0x55')]=function(_0x38b112,_0xdcca1){return db[_0x083a('0x36')]['describe']()['then'](respondWithResult(_0xdcca1,null))[_0x083a('0x4f')](handleError(_0xdcca1,null));};var interaction_log=require(_0x083a('0x12'))(_0x083a('0x56'));exports[_0x083a('0x57')]=function(_0x5dc6be,_0x2d024d,_0x2c7fa2){var _0x1f9935={'agent':{},'channel':_0x083a('0x58')};if(_0x5dc6be[_0x083a('0x53')]['id']){delete _0x5dc6be[_0x083a('0x53')]['id'];}_0x5dc6be[_0x083a('0x53')][_0x083a('0x59')]=!![];_0x5dc6be[_0x083a('0x53')][_0x083a('0x5a')]=moment()[_0x083a('0x5b')](_0x083a('0x5c'));_0x5dc6be[_0x083a('0x53')][_0x083a('0x5d')]=_0x5dc6be[_0x083a('0x53')]['UserId']||_0x5dc6be['user']['id'];_0x1f9935[_0x083a('0x5e')]['id']=_0x5dc6be[_0x083a('0x53')]['UserId'];return db['FaxMessage'][_0x083a('0x54')]({'where':{'id':_0x5dc6be[_0x083a('0x51')]['id'],'UserId':null}})[_0x083a('0x1c')](handleEntityNotFound(_0x2d024d,null))['then'](saveUpdates(_0x5dc6be['body'],null))['then'](function(_0xf2c5cc){if(_0xf2c5cc){_0x1f9935['message']=_0xf2c5cc[_0x083a('0x5f')]({'plain':!![]});return db[_0x083a('0x60')][_0x083a('0x54')]({'where':{'id':_0xf2c5cc[_0x083a('0x61')]}});}return null;})[_0x083a('0x1c')](handleEntityNotFound(_0x2d024d,null))[_0x083a('0x1c')](function(_0x469a46){if(_0x469a46){return _0x469a46[_0x083a('0x52')]({'UserId':_0x5dc6be[_0x083a('0x53')]['UserId'],'read1stAt':_[_0x083a('0x62')](_0x469a46[_0x083a('0x63')])?moment()[_0x083a('0x5b')](_0x083a('0x5c')):undefined});}return null;})[_0x083a('0x1c')](function(_0x3bd136){if(_0x3bd136){_0x1f9935['interaction']=_0x3bd136['get']({'plain':!![]});interaction_log[_0x083a('0x1d')](_0x083a('0x64'),_0x5dc6be[_0x083a('0x65')]['id'],_0x5dc6be[_0x083a('0x65')]['name'],_0x5dc6be[_0x083a('0x65')][_0x083a('0x66')],_0x1f9935[_0x083a('0x67')]['id'],_0x5dc6be[_0x083a('0x53')]?JSON[_0x083a('0x68')](_0x5dc6be[_0x083a('0x53')]):_0x083a('0x69'));return respondWithRpcPromise(_0x083a('0x6a'),_0x083a('0x6b'),_0x1f9935);}return null;})[_0x083a('0x1c')](function(_0x45168d){var _0x205f2e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45168d[_0x083a('0x23')][_0x083a('0x6c')];return db['sequelize'][_0x083a('0x3d')](_0x205f2e,{'type':db[_0x083a('0x6d')][_0x083a('0x6e')][_0x083a('0x6f')],'raw':!![]})[_0x083a('0x1c')](function(_0x18a11d){return _0x18a11d;});})[_0x083a('0x1c')](function(_0x3acbb7){if(_0x3acbb7){_0x1f9935[_0x083a('0x23')][_0x083a('0x70')]=_0x3acbb7[0x0];if(!_0x5dc6be['body'][_0x083a('0x5d')])return;return db[_0x083a('0x71')][_0x083a('0x54')]({'where':{'id':_0x5dc6be[_0x083a('0x53')][_0x083a('0x5d')],'role':_0x083a('0x5e')},'attributes':['id',_0x083a('0x32'),'fullname','email',_0x083a('0x72')],'raw':!![]});}return null;})[_0x083a('0x1c')](function(_0x218503){if(!_0x218503)return null;_0x1f9935[_0x083a('0x23')][_0x083a('0x5e')]=_0x218503;return _0x1f9935;})['then'](function(_0x470639){if(_0x470639){if(_0x5dc6be['body'][_0x083a('0x73')]){_0x1f9935[_0x083a('0x23')][_0x083a('0x74')]=util[_0x083a('0x5b')](_0x083a('0x75'),_0x5dc6be[_0x083a('0x65')][_0x083a('0x32')]);_0x1f9935[_0x083a('0x23')][_0x083a('0x76')]=_0x1f9935['channel'];_0x1f9935[_0x083a('0x23')]['motionChannel']=_0x1f9935[_0x083a('0x76')];_0x1f9935[_0x083a('0x23')][_0x083a('0x77')]=_0x083a('0x57');return respondWithRpcPromise(_0x083a('0x78'),_0x083a('0x78'),{'event':'acceptmessage','message':_0x1f9935[_0x083a('0x23')]},client9002)['then'](function(){return _0x1f9935;});}return _0x1f9935;}return null;})[_0x083a('0x1c')](respondWithResult(_0x2d024d,null))[_0x083a('0x4f')](handleError(_0x2d024d,null));};var interaction_log=require(_0x083a('0x12'))(_0x083a('0x56'));exports['reject']=function(_0x13cf2a,_0x2fe1e1,_0x5b6f35){var _0x410d46={'agent':{},'channel':_0x083a('0x58')};if(_0x13cf2a[_0x083a('0x53')]['id']){delete _0x13cf2a['body']['id'];}_0x13cf2a[_0x083a('0x53')]['UserId']=_0x13cf2a[_0x083a('0x53')][_0x083a('0x5d')]||_0x13cf2a['user']['id'];_0x410d46[_0x083a('0x5e')]['id']=_0x13cf2a[_0x083a('0x53')][_0x083a('0x5d')];return db[_0x083a('0x36')][_0x083a('0x54')]({'where':{'id':_0x13cf2a[_0x083a('0x51')]['id'],'UserId':null}})[_0x083a('0x1c')](handleEntityNotFound(_0x2fe1e1,null))['then'](function(_0x560088){if(_0x560088){_0x410d46[_0x083a('0x23')]=_0x560088[_0x083a('0x5f')]({'plain':!![]});return db[_0x083a('0x60')][_0x083a('0x54')]({'where':{'id':_0x560088[_0x083a('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x2fe1e1,null))[_0x083a('0x1c')](function(_0x24b77a){if(_0x24b77a){_0x410d46[_0x083a('0x67')]=_0x24b77a[_0x083a('0x5f')]({'plain':!![]});interaction_log[_0x083a('0x1d')](_0x083a('0x79'),_0x13cf2a['user']['id'],_0x13cf2a[_0x083a('0x65')][_0x083a('0x32')],_0x13cf2a['user'][_0x083a('0x66')],_0x410d46['interaction']['id'],_0x13cf2a[_0x083a('0x53')]?JSON[_0x083a('0x68')](_0x13cf2a[_0x083a('0x53')]):_0x083a('0x69'));return respondWithRpcPromise(_0x083a('0x7a'),_0x083a('0x7b'),_0x410d46);}return null;})[_0x083a('0x1c')](function(_0x521662){var _0x2300b7=_0x083a('0x7c')+_0x521662[_0x083a('0x23')][_0x083a('0x6c')];return db[_0x083a('0x7d')][_0x083a('0x3d')](_0x2300b7,{'type':db[_0x083a('0x6d')][_0x083a('0x6e')][_0x083a('0x6f')],'raw':!![]})[_0x083a('0x1c')](function(_0x283fba){return _0x283fba;});})[_0x083a('0x1c')](function(_0x12cb81){if(_0x12cb81){_0x410d46[_0x083a('0x23')][_0x083a('0x70')]=_0x12cb81[0x0];if(!_0x13cf2a[_0x083a('0x53')][_0x083a('0x5d')])return;return db[_0x083a('0x71')]['find']({'where':{'id':_0x13cf2a[_0x083a('0x53')][_0x083a('0x5d')],'role':'agent'},'attributes':['id',_0x083a('0x32'),_0x083a('0x7e'),_0x083a('0x7f'),_0x083a('0x72')],'raw':!![]});}return null;})[_0x083a('0x1c')](function(_0x1f7941){if(!_0x1f7941)return null;_0x410d46['message'][_0x083a('0x5e')]=_0x1f7941;return _0x410d46;})[_0x083a('0x1c')](function(_0x2df396){if(_0x2df396){_0x2df396[_0x083a('0x23')][_0x083a('0x74')]=util[_0x083a('0x5b')](_0x083a('0x75'),_0x13cf2a[_0x083a('0x65')][_0x083a('0x32')]);_0x2df396[_0x083a('0x23')][_0x083a('0x76')]=_0x410d46[_0x083a('0x76')];_0x2df396['message']['motionChannel']=_0x410d46[_0x083a('0x76')];_0x2df396[_0x083a('0x23')]['event']=_0x083a('0x2f');respondWithRpcPromise(_0x083a('0x78'),_0x083a('0x78'),{'event':_0x083a('0x80'),'message':_0x2df396[_0x083a('0x23')]},client9002);return _0x410d46;}return null;})[_0x083a('0x1c')](respondWithResult(_0x2fe1e1,null))[_0x083a('0x4f')](handleError(_0x2fe1e1,null));};exports[_0x083a('0x81')]=function(_0x4ce958,_0x2078ef){var _0x13a5d1;return db[_0x083a('0x36')][_0x083a('0x81')](_0x4ce958[_0x083a('0x53')],{})[_0x083a('0x1c')](function(_0xc6add6){_0x13a5d1=_0xc6add6;return db['CmContact'][_0x083a('0x82')]({'where':{'id':_0x13a5d1[_0x083a('0x6c')]}});})[_0x083a('0x1c')](function(_0x1b62b2){if(_[_0x083a('0x62')](_0x1b62b2)){return;}else{_0x13a5d1['fax']=_0x1b62b2['fax'];return db[_0x083a('0x83')][_0x083a('0x82')]({'where':{'id':_0x13a5d1[_0x083a('0x84')]}});}})[_0x083a('0x1c')](function(_0x39734b){return respondWithRpcPromise(_0x083a('0x85'),_0x083a('0x85'),{'FaxAccountId':_[_0x083a('0x62')](_0x4ce958[_0x083a('0x53')])?undefined:_0x4ce958['body'][_0x083a('0x86')],'path':_['isNil'](_0x39734b)?undefined:util[_0x083a('0x5b')](_0x083a('0x87'),_0x39734b[_0x083a('0x88')]),'fax':_[_0x083a('0x62')](_0x13a5d1[_0x083a('0x58')])?undefined:_0x13a5d1[_0x083a('0x58')],'AttachmentId':_0x13a5d1[_0x083a('0x84')]},client9002);})[_0x083a('0x1c')](respondWithResult(_0x2078ef,0xc9))[_0x083a('0x4f')](handleError(_0x2078ef,null));};exports['download']=function(_0x2887ab,_0x61c891){var _0x39753f=path[_0x083a('0x89')](config[_0x083a('0x8a')],_0x083a('0x8b'),_0x083a('0x8c'),_0x083a('0x8d'));return db[_0x083a('0x36')][_0x083a('0x54')]({'where':{'id':_0x2887ab[_0x083a('0x51')]['id']},'include':[{'model':db[_0x083a('0x83')],'as':_0x083a('0x83')}]})[_0x083a('0x1c')](handleEntityNotFound(_0x61c891,null))[_0x083a('0x1c')](function(_0x228d7f){if(_0x228d7f){return _0x61c891[_0x083a('0x8e')](path[_0x083a('0x89')](_0x39753f,_0x228d7f[_0x083a('0x83')][_0x083a('0x88')]));}})[_0x083a('0x4f')](handleError(_0x61c891,null));}; \ No newline at end of file +var _0x4b3f=['where','pick','filter','name','merge','includeAll','include','findAll','rows','params','options','body','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','find','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','event','create','CmContact','findOne','ContactId','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x102fdd,_0x2947b8){var _0x199250=function(_0x3b221f){while(--_0x3b221f){_0x102fdd['push'](_0x102fdd['shift']());}};_0x199250(++_0x2947b8);}(_0x4b3f,0x1ef));var _0xf4b3=function(_0x1fdf10,_0x13bb3a){_0x1fdf10=_0x1fdf10-0x0;var _0x16f2a6=_0x4b3f[_0x1fdf10];return _0x16f2a6;};'use strict';var emlformat=require(_0xf4b3('0x0'));var rimraf=require(_0xf4b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4b3('0x2'));var rp=require(_0xf4b3('0x3'));var moment=require(_0xf4b3('0x4'));var BPromise=require(_0xf4b3('0x5'));var Mustache=require(_0xf4b3('0x6'));var util=require(_0xf4b3('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4b3('0x8'));var fs=require('fs');var fs_extra=require(_0xf4b3('0x9'));var _=require(_0xf4b3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4b3('0xb'));var toCsv=require(_0xf4b3('0xc'));var querystring=require(_0xf4b3('0xd'));var Papa=require(_0xf4b3('0xe'));var Redis=require(_0xf4b3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4b3('0x10'));var as=require(_0xf4b3('0x11'));var hardwareService=require(_0xf4b3('0x12'));var logger=require('../../config/logger')(_0xf4b3('0x13'));var utils=require(_0xf4b3('0x14'));var config=require(_0xf4b3('0x15'));var licenseUtil=require(_0xf4b3('0x16'));var db=require(_0xf4b3('0x17'))['db'];config[_0xf4b3('0x18')]=_[_0xf4b3('0x19')](config[_0xf4b3('0x18')],{'host':_0xf4b3('0x1a'),'port':0x18eb});var socket=require(_0xf4b3('0x1b'))(new Redis(config[_0xf4b3('0x18')]));require(_0xf4b3('0x1c'))[_0xf4b3('0x1d')](socket);var jayson=require(_0xf4b3('0x1e'));var client=jayson[_0xf4b3('0x1f')][_0xf4b3('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xf4b3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x8db3ad,_0x66119f,_0x593914,_0x1abc07){return new BPromise(function(_0x27954f,_0x568aab){var _0x2c5d2f=_0x1abc07||client;return _0x2c5d2f['request'](_0x8db3ad,_0x593914)[_0xf4b3('0x21')](function(_0x47557a){logger[_0xf4b3('0x22')](_0xf4b3('0x23'),_0x66119f,_0xf4b3('0x24'));logger[_0xf4b3('0x25')](_0xf4b3('0x26'),_0x66119f,_0xf4b3('0x24'),JSON['stringify'](_0x47557a));if(_0x47557a[_0xf4b3('0x27')]){if(_0x47557a[_0xf4b3('0x27')][_0xf4b3('0x28')]===0x1f4){logger[_0xf4b3('0x27')](_0xf4b3('0x23'),_0x66119f,_0x47557a[_0xf4b3('0x27')][_0xf4b3('0x29')]);return _0x568aab(_0x47557a[_0xf4b3('0x27')][_0xf4b3('0x29')]);}logger[_0xf4b3('0x27')](_0xf4b3('0x23'),_0x66119f,_0x47557a[_0xf4b3('0x27')][_0xf4b3('0x29')]);return _0x27954f(_0x47557a[_0xf4b3('0x27')][_0xf4b3('0x29')]);}else{logger[_0xf4b3('0x22')](_0xf4b3('0x23'),_0x66119f,_0xf4b3('0x24'));_0x27954f(_0x47557a[_0xf4b3('0x2a')]['message']);}})[_0xf4b3('0x2b')](function(_0x462743){logger[_0xf4b3('0x27')](_0xf4b3('0x23'),_0x66119f,_0x462743);_0x568aab(_0x462743);});});}function respondWithStatusCode(_0xba667a,_0x15c0c2){_0x15c0c2=_0x15c0c2||0xcc;return function(_0x490ca5){if(_0x490ca5){return _0xba667a[_0xf4b3('0x2c')](_0x15c0c2);}return _0xba667a['status'](_0x15c0c2)[_0xf4b3('0x2d')]();};}function respondWithResult(_0x352c37,_0x1e4afd){_0x1e4afd=_0x1e4afd||0xc8;return function(_0x4d6585){if(_0x4d6585){return _0x352c37[_0xf4b3('0x2e')](_0x1e4afd)[_0xf4b3('0x2f')](_0x4d6585);}};}function respondWithFilteredResult(_0x56e526,_0x195fbf){return function(_0x3c3e7f){if(_0x3c3e7f){var _0x11ac72=typeof _0x195fbf[_0xf4b3('0x30')]===_0xf4b3('0x31')&&typeof _0x195fbf[_0xf4b3('0x32')]===_0xf4b3('0x31');var _0x5b83a9=_0x3c3e7f[_0xf4b3('0x33')];var _0x2cf39a=_0x11ac72?0x0:_0x195fbf['offset'];var _0x433f97=_0x11ac72?_0x3c3e7f[_0xf4b3('0x33')]:_0x195fbf[_0xf4b3('0x30')]+_0x195fbf[_0xf4b3('0x32')];var _0x27605d;if(_0x433f97>=_0x5b83a9){_0x433f97=_0x5b83a9;_0x27605d=0xc8;}else{_0x27605d=0xce;}_0x56e526[_0xf4b3('0x2e')](_0x27605d);return _0x56e526[_0xf4b3('0x34')](_0xf4b3('0x35'),_0x2cf39a+'-'+_0x433f97+'/'+_0x5b83a9)[_0xf4b3('0x2f')](_0x3c3e7f);}return null;};}function patchUpdates(_0xaa0299){return function(_0x31c94e){try{jsonpatch[_0xf4b3('0x36')](_0x31c94e,_0xaa0299,!![]);}catch(_0x220a49){return BPromise[_0xf4b3('0x37')](_0x220a49);}return _0x31c94e[_0xf4b3('0x38')]();};}function saveUpdates(_0x935c8b,_0x5f4eed){return function(_0x13243b){if(_0x13243b){return _0x13243b[_0xf4b3('0x39')](_0x935c8b)[_0xf4b3('0x21')](function(_0x2a2a6c){return _0x2a2a6c;});}return null;};}function removeEntity(_0x5f0c0f,_0x1cee88){return function(_0x1e3d12){if(_0x1e3d12){return _0x1e3d12[_0xf4b3('0x3a')]()[_0xf4b3('0x21')](function(){_0x5f0c0f[_0xf4b3('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffd923,_0x2ef619){return function(_0x14628b){if(!_0x14628b){_0xffd923[_0xf4b3('0x2c')](0x194);}return _0x14628b;};}function handleError(_0x369ad8,_0x386ecc){_0x386ecc=_0x386ecc||0x1f4;return function(_0x5b87b9){logger['error'](_0x5b87b9['stack']);if(_0x5b87b9['name']){delete _0x5b87b9['name'];}_0x369ad8[_0xf4b3('0x2e')](_0x386ecc)[_0xf4b3('0x3b')](_0x5b87b9);};}exports[_0xf4b3('0x3c')]=function(_0x2d1986,_0x75fa20){var _0xdfb80a={},_0x377939={},_0x54d23e={'count':0x0,'rows':[]};var _0x5b940f=_[_0xf4b3('0x3d')](db[_0xf4b3('0x3e')][_0xf4b3('0x3f')],function(_0x80dccc){return{'name':_0x80dccc[_0xf4b3('0x40')],'type':_0x80dccc[_0xf4b3('0x41')]['key']};});_0x377939[_0xf4b3('0x42')]=_[_0xf4b3('0x3d')](_0x5b940f,'name');_0x377939[_0xf4b3('0x43')]=_[_0xf4b3('0x44')](_0x2d1986[_0xf4b3('0x43')]);_0x377939[_0xf4b3('0x45')]=_[_0xf4b3('0x46')](_0x377939[_0xf4b3('0x42')],_0x377939['query']);_0xdfb80a[_0xf4b3('0x47')]=_[_0xf4b3('0x46')](_0x377939[_0xf4b3('0x42')],qs[_0xf4b3('0x48')](_0x2d1986[_0xf4b3('0x43')][_0xf4b3('0x48')]));_0xdfb80a[_0xf4b3('0x47')]=_0xdfb80a['attributes'][_0xf4b3('0x49')]?_0xdfb80a[_0xf4b3('0x47')]:_0x377939[_0xf4b3('0x42')];if(!_0x2d1986[_0xf4b3('0x43')][_0xf4b3('0x4a')](_0xf4b3('0x4b'))){_0xdfb80a['limit']=qs[_0xf4b3('0x32')](_0x2d1986[_0xf4b3('0x43')]['limit']);_0xdfb80a[_0xf4b3('0x30')]=qs[_0xf4b3('0x30')](_0x2d1986[_0xf4b3('0x43')]['offset']);}_0xdfb80a['order']=qs[_0xf4b3('0x4c')](_0x2d1986[_0xf4b3('0x43')][_0xf4b3('0x4c')]);_0xdfb80a[_0xf4b3('0x4d')]=qs[_0xf4b3('0x45')](_[_0xf4b3('0x4e')](_0x2d1986['query'],_0x377939['filters']),_0x5b940f);if(_0x2d1986[_0xf4b3('0x43')][_0xf4b3('0x4f')]){_0xdfb80a['where']=_['merge'](_0xdfb80a[_0xf4b3('0x4d')],{'$or':_['map'](_0x5b940f,function(_0x11591a){if(_0x11591a[_0xf4b3('0x41')]!=='VIRTUAL'){var _0xaab860={};_0xaab860[_0x11591a[_0xf4b3('0x50')]]={'$like':'%'+_0x2d1986[_0xf4b3('0x43')][_0xf4b3('0x4f')]+'%'};return _0xaab860;}})});}_0xdfb80a=_[_0xf4b3('0x51')]({},_0xdfb80a,_0x2d1986['options']);var _0x14ba6d={'where':_0xdfb80a['where']};return db[_0xf4b3('0x3e')]['count'](_0x14ba6d)[_0xf4b3('0x21')](function(_0x392992){_0x54d23e[_0xf4b3('0x33')]=_0x392992;if(_0x2d1986['query'][_0xf4b3('0x52')]){_0xdfb80a[_0xf4b3('0x53')]=[{'all':!![]}];}return db[_0xf4b3('0x3e')][_0xf4b3('0x54')](_0xdfb80a);})[_0xf4b3('0x21')](function(_0x4c7ccb){_0x54d23e[_0xf4b3('0x55')]=_0x4c7ccb;return _0x54d23e;})[_0xf4b3('0x21')](respondWithFilteredResult(_0x75fa20,_0xdfb80a))[_0xf4b3('0x2b')](handleError(_0x75fa20,null));};exports['show']=function(_0x250ea3,_0x536c70){var _0xe1d7b7={'raw':!![],'where':{'id':_0x250ea3[_0xf4b3('0x56')]['id']}},_0x37fd11={};_0x37fd11[_0xf4b3('0x42')]=_[_0xf4b3('0x44')](db['FaxMessage'][_0xf4b3('0x3f')]);_0x37fd11[_0xf4b3('0x43')]=_[_0xf4b3('0x44')](_0x250ea3[_0xf4b3('0x43')]);_0x37fd11[_0xf4b3('0x45')]=_[_0xf4b3('0x46')](_0x37fd11['model'],_0x37fd11[_0xf4b3('0x43')]);_0xe1d7b7['attributes']=_[_0xf4b3('0x46')](_0x37fd11['model'],qs[_0xf4b3('0x48')](_0x250ea3['query'][_0xf4b3('0x48')]));_0xe1d7b7[_0xf4b3('0x47')]=_0xe1d7b7[_0xf4b3('0x47')][_0xf4b3('0x49')]?_0xe1d7b7[_0xf4b3('0x47')]:_0x37fd11[_0xf4b3('0x42')];if(_0x250ea3['query']['includeAll']){_0xe1d7b7[_0xf4b3('0x53')]=[{'all':!![]}];}_0xe1d7b7=_[_0xf4b3('0x51')]({},_0xe1d7b7,_0x250ea3[_0xf4b3('0x57')]);return db['FaxMessage']['find'](_0xe1d7b7)[_0xf4b3('0x21')](handleEntityNotFound(_0x536c70,null))[_0xf4b3('0x21')](respondWithResult(_0x536c70,null))[_0xf4b3('0x2b')](handleError(_0x536c70,null));};exports[_0xf4b3('0x39')]=function(_0x1ae432,_0x482fcb){if(_0x1ae432['body']['id']){delete _0x1ae432[_0xf4b3('0x58')]['id'];}return db[_0xf4b3('0x3e')]['find']({'where':{'id':_0x1ae432[_0xf4b3('0x56')]['id']}})[_0xf4b3('0x21')](handleEntityNotFound(_0x482fcb,null))[_0xf4b3('0x21')](saveUpdates(_0x1ae432[_0xf4b3('0x58')],null))[_0xf4b3('0x21')](respondWithResult(_0x482fcb,null))[_0xf4b3('0x2b')](handleError(_0x482fcb,null));};exports['destroy']=function(_0x1708c8,_0x4c941f){return db[_0xf4b3('0x3e')]['find']({'where':{'id':_0x1708c8[_0xf4b3('0x56')]['id']}})[_0xf4b3('0x21')](handleEntityNotFound(_0x4c941f,null))[_0xf4b3('0x21')](removeEntity(_0x4c941f,null))['catch'](handleError(_0x4c941f,null));};exports['describe']=function(_0x5c21dc,_0x3f76ec){return db[_0xf4b3('0x3e')]['describe']()[_0xf4b3('0x21')](respondWithResult(_0x3f76ec,null))[_0xf4b3('0x2b')](handleError(_0x3f76ec,null));};var interaction_log=require(_0xf4b3('0x59'))(_0xf4b3('0x5a'));exports[_0xf4b3('0x5b')]=function(_0x745378,_0x487726,_0x436e13){var _0x5ed4f0={'agent':{},'channel':_0xf4b3('0x5c')};if(_0x745378[_0xf4b3('0x58')]['id']){delete _0x745378['body']['id'];}_0x745378[_0xf4b3('0x58')][_0xf4b3('0x5d')]=!![];_0x745378[_0xf4b3('0x58')][_0xf4b3('0x5e')]=moment()[_0xf4b3('0x5f')](_0xf4b3('0x60'));_0x745378[_0xf4b3('0x58')][_0xf4b3('0x61')]=_0x745378[_0xf4b3('0x58')][_0xf4b3('0x61')]||_0x745378[_0xf4b3('0x62')]['id'];_0x5ed4f0[_0xf4b3('0x63')]['id']=_0x745378['body'][_0xf4b3('0x61')];return db[_0xf4b3('0x3e')]['find']({'where':{'id':_0x745378[_0xf4b3('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x487726,null))[_0xf4b3('0x21')](saveUpdates(_0x745378[_0xf4b3('0x58')],null))[_0xf4b3('0x21')](function(_0x3935ca){if(_0x3935ca){_0x5ed4f0[_0xf4b3('0x29')]=_0x3935ca[_0xf4b3('0x64')]({'plain':!![]});return db[_0xf4b3('0x65')][_0xf4b3('0x66')]({'where':{'id':_0x3935ca[_0xf4b3('0x67')]}});}return null;})[_0xf4b3('0x21')](handleEntityNotFound(_0x487726,null))[_0xf4b3('0x21')](function(_0x4f7ecf){if(_0x4f7ecf){return _0x4f7ecf[_0xf4b3('0x39')]({'UserId':_0x745378[_0xf4b3('0x58')][_0xf4b3('0x61')],'read1stAt':_[_0xf4b3('0x68')](_0x4f7ecf[_0xf4b3('0x69')])?moment()[_0xf4b3('0x5f')](_0xf4b3('0x60')):undefined});}return null;})[_0xf4b3('0x21')](function(_0x4f1e20){if(_0x4f1e20){_0x5ed4f0['interaction']=_0x4f1e20[_0xf4b3('0x64')]({'plain':!![]});interaction_log['info'](_0xf4b3('0x6a'),_0x745378[_0xf4b3('0x62')]['id'],_0x745378['user'][_0xf4b3('0x50')],_0x745378['user']['role'],_0x5ed4f0[_0xf4b3('0x6b')]['id'],_0x745378[_0xf4b3('0x58')]?JSON[_0xf4b3('0x6c')](_0x745378[_0xf4b3('0x58')]):_0xf4b3('0x6d'));return respondWithRpcPromise(_0xf4b3('0x6e'),_0xf4b3('0x6f'),_0x5ed4f0);}return null;})['then'](function(_0x202dec){var _0x339d77='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x202dec[_0xf4b3('0x29')]['ContactId'];return db['sequelize']['query'](_0x339d77,{'type':db[_0xf4b3('0x70')][_0xf4b3('0x71')][_0xf4b3('0x72')],'raw':!![]})[_0xf4b3('0x21')](function(_0x29abf9){return _0x29abf9;});})['then'](function(_0x5c1322){if(_0x5c1322){_0x5ed4f0[_0xf4b3('0x29')]['contact']=_0x5c1322[0x0];if(!_0x745378[_0xf4b3('0x58')][_0xf4b3('0x61')])return;return db['User'][_0xf4b3('0x66')]({'where':{'id':_0x745378[_0xf4b3('0x58')]['UserId'],'role':_0xf4b3('0x63')},'attributes':['id','name',_0xf4b3('0x73'),_0xf4b3('0x74'),_0xf4b3('0x75')],'raw':!![]});}return null;})[_0xf4b3('0x21')](function(_0xa794c0){if(!_0xa794c0)return null;_0x5ed4f0[_0xf4b3('0x29')][_0xf4b3('0x63')]=_0xa794c0;return _0x5ed4f0;})['then'](function(_0x5730ed){if(_0x5730ed){if(_0x745378[_0xf4b3('0x58')]['manual']){_0x5ed4f0[_0xf4b3('0x29')][_0xf4b3('0x76')]=util['format'](_0xf4b3('0x77'),_0x745378[_0xf4b3('0x62')][_0xf4b3('0x50')]);_0x5ed4f0[_0xf4b3('0x29')][_0xf4b3('0x78')]=_0x5ed4f0[_0xf4b3('0x78')];_0x5ed4f0[_0xf4b3('0x29')][_0xf4b3('0x79')]=_0x5ed4f0[_0xf4b3('0x78')];_0x5ed4f0[_0xf4b3('0x29')]['event']=_0xf4b3('0x5b');return respondWithRpcPromise(_0xf4b3('0x7a'),_0xf4b3('0x7a'),{'event':'acceptmessage','message':_0x5ed4f0[_0xf4b3('0x29')]},client9002)[_0xf4b3('0x21')](function(){return _0x5ed4f0;});}return _0x5ed4f0;}return null;})[_0xf4b3('0x21')](respondWithResult(_0x487726,null))[_0xf4b3('0x2b')](handleError(_0x487726,null));};var interaction_log=require(_0xf4b3('0x59'))(_0xf4b3('0x5a'));exports[_0xf4b3('0x37')]=function(_0x3f0af2,_0x235496,_0x5a1bd2){var _0x27714c={'agent':{},'channel':'fax'};if(_0x3f0af2[_0xf4b3('0x58')]['id']){delete _0x3f0af2[_0xf4b3('0x58')]['id'];}_0x3f0af2[_0xf4b3('0x58')][_0xf4b3('0x61')]=_0x3f0af2[_0xf4b3('0x58')][_0xf4b3('0x61')]||_0x3f0af2[_0xf4b3('0x62')]['id'];_0x27714c[_0xf4b3('0x63')]['id']=_0x3f0af2[_0xf4b3('0x58')][_0xf4b3('0x61')];return db['FaxMessage'][_0xf4b3('0x66')]({'where':{'id':_0x3f0af2['params']['id'],'UserId':null}})[_0xf4b3('0x21')](handleEntityNotFound(_0x235496,null))[_0xf4b3('0x21')](function(_0x295bb8){if(_0x295bb8){_0x27714c[_0xf4b3('0x29')]=_0x295bb8['get']({'plain':!![]});return db['FaxInteraction'][_0xf4b3('0x66')]({'where':{'id':_0x295bb8[_0xf4b3('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x235496,null))['then'](function(_0x14cf43){if(_0x14cf43){_0x27714c['interaction']=_0x14cf43[_0xf4b3('0x64')]({'plain':!![]});interaction_log[_0xf4b3('0x22')](_0xf4b3('0x7b'),_0x3f0af2[_0xf4b3('0x62')]['id'],_0x3f0af2[_0xf4b3('0x62')][_0xf4b3('0x50')],_0x3f0af2[_0xf4b3('0x62')]['role'],_0x27714c[_0xf4b3('0x6b')]['id'],_0x3f0af2[_0xf4b3('0x58')]?JSON[_0xf4b3('0x6c')](_0x3f0af2[_0xf4b3('0x58')]):_0xf4b3('0x6d'));return respondWithRpcPromise(_0xf4b3('0x7c'),_0xf4b3('0x7d'),_0x27714c);}return null;})[_0xf4b3('0x21')](function(_0x121852){var _0x161a6e=_0xf4b3('0x7e')+_0x121852['message']['ContactId'];return db['sequelize'][_0xf4b3('0x43')](_0x161a6e,{'type':db[_0xf4b3('0x70')][_0xf4b3('0x71')][_0xf4b3('0x72')],'raw':!![]})['then'](function(_0x2c7dc4){return _0x2c7dc4;});})[_0xf4b3('0x21')](function(_0x2d5afa){if(_0x2d5afa){_0x27714c[_0xf4b3('0x29')][_0xf4b3('0x7f')]=_0x2d5afa[0x0];if(!_0x3f0af2[_0xf4b3('0x58')]['UserId'])return;return db[_0xf4b3('0x80')][_0xf4b3('0x66')]({'where':{'id':_0x3f0af2[_0xf4b3('0x58')][_0xf4b3('0x61')],'role':_0xf4b3('0x63')},'attributes':['id',_0xf4b3('0x50'),_0xf4b3('0x73'),_0xf4b3('0x74'),_0xf4b3('0x75')],'raw':!![]});}return null;})[_0xf4b3('0x21')](function(_0x3a2d52){if(!_0x3a2d52)return null;_0x27714c['message']['agent']=_0x3a2d52;return _0x27714c;})[_0xf4b3('0x21')](function(_0x2809b5){if(_0x2809b5){_0x2809b5[_0xf4b3('0x29')][_0xf4b3('0x76')]=util[_0xf4b3('0x5f')](_0xf4b3('0x77'),_0x3f0af2[_0xf4b3('0x62')][_0xf4b3('0x50')]);_0x2809b5['message'][_0xf4b3('0x78')]=_0x27714c[_0xf4b3('0x78')];_0x2809b5[_0xf4b3('0x29')][_0xf4b3('0x79')]=_0x27714c['channel'];_0x2809b5[_0xf4b3('0x29')][_0xf4b3('0x81')]=_0xf4b3('0x37');respondWithRpcPromise(_0xf4b3('0x7a'),_0xf4b3('0x7a'),{'event':'rejectmessage','message':_0x2809b5[_0xf4b3('0x29')]},client9002);return _0x27714c;}return null;})[_0xf4b3('0x21')](respondWithResult(_0x235496,null))['catch'](handleError(_0x235496,null));};exports[_0xf4b3('0x82')]=function(_0xc3726d,_0x344815){var _0x2b3e37;return db['FaxMessage'][_0xf4b3('0x82')](_0xc3726d['body'],{})[_0xf4b3('0x21')](function(_0x5ce585){_0x2b3e37=_0x5ce585;return db[_0xf4b3('0x83')][_0xf4b3('0x84')]({'where':{'id':_0x2b3e37[_0xf4b3('0x85')]}});})[_0xf4b3('0x21')](function(_0x2390b9){if(_[_0xf4b3('0x68')](_0x2390b9)){return;}else{_0x2b3e37[_0xf4b3('0x5c')]=_0x2390b9[_0xf4b3('0x5c')];return db['Attachment']['findOne']({'where':{'id':_0x2b3e37['AttachmentId']}});}})[_0xf4b3('0x21')](function(_0x100f0a){return respondWithRpcPromise(_0xf4b3('0x86'),'SendFax',{'FaxAccountId':_[_0xf4b3('0x68')](_0xc3726d['body'])?undefined:_0xc3726d[_0xf4b3('0x58')][_0xf4b3('0x87')],'path':_[_0xf4b3('0x68')](_0x100f0a)?undefined:util[_0xf4b3('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x100f0a[_0xf4b3('0x88')]),'fax':_[_0xf4b3('0x68')](_0x2b3e37['fax'])?undefined:_0x2b3e37['fax'],'AttachmentId':_0x2b3e37[_0xf4b3('0x89')]},client9002);})[_0xf4b3('0x21')](respondWithResult(_0x344815,0xc9))[_0xf4b3('0x2b')](handleError(_0x344815,null));};exports[_0xf4b3('0x8a')]=function(_0x48cc8d,_0x14ed29){var _0x386c45=path[_0xf4b3('0x8b')](config[_0xf4b3('0x8c')],_0xf4b3('0x8d'),'files','attachments');return db[_0xf4b3('0x3e')][_0xf4b3('0x66')]({'where':{'id':_0x48cc8d[_0xf4b3('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xf4b3('0x8e')}]})[_0xf4b3('0x21')](handleEntityNotFound(_0x14ed29,null))[_0xf4b3('0x21')](function(_0x3245aa){if(_0x3245aa){return _0x14ed29[_0xf4b3('0x8a')](path[_0xf4b3('0x8b')](_0x386c45,_0x3245aa['Attachment'][_0xf4b3('0x88')]));}})['catch'](handleError(_0x14ed29,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 542668e..c1d75af 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 _0xf811=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x467729,_0x235857){var _0x2017f7=function(_0x168a5b){while(--_0x168a5b){_0x467729['push'](_0x467729['shift']());}};_0x2017f7(++_0x235857);}(_0xf811,0x6f));var _0x1f81=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xf811[_0x2aecb2];return _0x3ebb80;};'use strict';var EventEmitter=require(_0x1f81('0x0'));var FaxMessage=require(_0x1f81('0x1'))['db'][_0x1f81('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1f81('0x3')](0x0);var events={'afterCreate':_0x1f81('0x4'),'afterUpdate':_0x1f81('0x5'),'afterDestroy':_0x1f81('0x6')};function emitEvent(_0x1650f4){return function(_0x18f178,_0x4281c3,_0x40b2b6){FaxMessageEvents[_0x1f81('0x7')](_0x1650f4+':'+_0x18f178['id'],_0x18f178);FaxMessageEvents[_0x1f81('0x7')](_0x1650f4,_0x18f178);_0x40b2b6(null);};}for(var e in events){if(events[_0x1f81('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x1f81('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xaa37=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaa37[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var FaxMessage=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){FaxMessageEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);FaxMessageEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];FaxMessage[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 221455a..f871396 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 _0x6e18=['FaxInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x4a6aeb,_0xb9e51c){var _0x389485=function(_0x285849){while(--_0x285849){_0x4a6aeb['push'](_0x4a6aeb['shift']());}};_0x389485(++_0xb9e51c);}(_0x6e18,0x11d));var _0x86e1=function(_0x50e9d7,_0x12b367){_0x50e9d7=_0x50e9d7-0x0;var _0xfe6ecc=_0x6e18[_0x50e9d7];return _0xfe6ecc;};'use strict';var _=require(_0x86e1('0x0'));var util=require('util');var logger=require(_0x86e1('0x1'))(_0x86e1('0x2'));var moment=require(_0x86e1('0x3'));var BPromise=require(_0x86e1('0x4'));var rp=require(_0x86e1('0x5'));var fs=require('fs');var path=require(_0x86e1('0x6'));var rimraf=require(_0x86e1('0x7'));var config=require(_0x86e1('0x8'));var attributes=require(_0x86e1('0x9'));module[_0x86e1('0xa')]=function(_0x2e3323,_0x293460){return _0x2e3323[_0x86e1('0xb')](_0x86e1('0xc'),attributes,{'tableName':_0x86e1('0xd'),'paranoid':![],'indexes':[{'name':_0x86e1('0xe'),'fields':[_0x86e1('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49b608,_0x290bb3,_0x534fe8){var _0x3565ff=_0x2e3323[_0x86e1('0x10')];var _0x2e4411=_0x49b608[_0x86e1('0x11')]({'plain':!![]});if(_0x2e4411[_0x86e1('0x12')]['toLowerCase']()==='in'||_0x2e4411['direction'][_0x86e1('0x13')]()===_0x86e1('0x14')&&!_0x2e4411[_0x86e1('0x15')]&&!_[_0x86e1('0x16')](_0x2e4411[_0x86e1('0x17')])){_0x3565ff['FaxInteraction'][_0x86e1('0x18')]({'where':{'id':_0x2e4411[_0x86e1('0x19')]}})[_0x86e1('0x1a')](function(_0x454988){if(_0x454988){_0x454988['update']({'lastMsgAt':_0x2e4411[_0x86e1('0x1b')],'lastMsgDirection':_0x2e4411[_0x86e1('0x12')][_0x86e1('0x13')]()});}})[_0x86e1('0x1c')](function(_0x3213ed){console[_0x86e1('0x1d')](_0x3213ed);});}_0x534fe8();}},'charset':'utf8mb4','collate':_0x86e1('0x1e')});}; \ No newline at end of file +var _0x1679=['models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','update','createdAt','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','FULLTEXT'];(function(_0x2c803a,_0x5722fc){var _0x28e9fb=function(_0x8e9c21){while(--_0x8e9c21){_0x2c803a['push'](_0x2c803a['shift']());}};_0x28e9fb(++_0x5722fc);}(_0x1679,0xff));var _0x9167=function(_0x4dbd6b,_0x19ab95){_0x4dbd6b=_0x4dbd6b-0x0;var _0x2024a9=_0x1679[_0x4dbd6b];return _0x2024a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9167('0x0'))(_0x9167('0x1'));var moment=require(_0x9167('0x2'));var BPromise=require(_0x9167('0x3'));var rp=require(_0x9167('0x4'));var fs=require('fs');var path=require(_0x9167('0x5'));var rimraf=require('rimraf');var config=require(_0x9167('0x6'));var attributes=require('./faxMessage.attributes');module[_0x9167('0x7')]=function(_0x52b8bf,_0x5b15e7){return _0x52b8bf['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x9167('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56c5ce,_0x3f9a73,_0x493aff){var _0x2947eb=_0x52b8bf[_0x9167('0x9')];var _0x59e4d7=_0x56c5ce[_0x9167('0xa')]({'plain':!![]});if(_0x59e4d7[_0x9167('0xb')]['toLowerCase']()==='in'||_0x59e4d7[_0x9167('0xb')][_0x9167('0xc')]()===_0x9167('0xd')&&!_0x59e4d7[_0x9167('0xe')]&&!_[_0x9167('0xf')](_0x59e4d7[_0x9167('0x10')])){_0x2947eb['FaxInteraction']['findOne']({'where':{'id':_0x59e4d7[_0x9167('0x11')]}})[_0x9167('0x12')](function(_0x1591ce){if(_0x1591ce){_0x1591ce[_0x9167('0x13')]({'lastMsgAt':_0x59e4d7[_0x9167('0x14')],'lastMsgDirection':_0x59e4d7[_0x9167('0xb')]['toLowerCase']()});}})['catch'](function(_0x332a09){console['error'](_0x332a09);});}_0x493aff();}},'charset':'utf8mb4','collate':_0x9167('0x15')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7524997..1dd63cf 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 _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4bc3[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x21482b,_0x3a8966){var _0x19235d=function(_0x56c2c2){while(--_0x56c2c2){_0x21482b['push'](_0x21482b['shift']());}};_0x19235d(++_0x3a8966);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x4b84[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 85a8bfd..e69fac5 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 _0x15b6=['removeListener','register','length','./faxMessage.events','remove','update','emit'];(function(_0x31db79,_0x3f5037){var _0x2ff81e=function(_0x3580e3){while(--_0x3580e3){_0x31db79['push'](_0x31db79['shift']());}};_0x2ff81e(++_0x3f5037);}(_0x15b6,0x8f));var _0x615b=function(_0x5745e3,_0x2b3a14){_0x5745e3=_0x5745e3-0x0;var _0x65b84f=_0x15b6[_0x5745e3];return _0x65b84f;};'use strict';var FaxMessageEvents=require(_0x615b('0x0'));var events=['save',_0x615b('0x1'),_0x615b('0x2')];function createListener(_0x47ba5a,_0x4091db){return function(_0x594d7b){_0x4091db[_0x615b('0x3')](_0x47ba5a,_0x594d7b);};}function removeListener(_0x2ede9a,_0x24489d){return function(){FaxMessageEvents[_0x615b('0x4')](_0x2ede9a,_0x24489d);};}exports[_0x615b('0x5')]=function(_0x32f52a){for(var _0x12d8e2=0x0,_0x40a1ed=events[_0x615b('0x6')];_0x12d8e2<_0x40a1ed;_0x12d8e2++){var _0x10e470=events[_0x12d8e2];var _0x2238d9=createListener('faxMessage:'+_0x10e470,_0x32f52a);FaxMessageEvents['on'](_0x10e470,_0x2238d9);}}; \ No newline at end of file +var _0xa107=['save','remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x49ebed,_0x2ed245){var _0x247194=function(_0x5384b9){while(--_0x5384b9){_0x49ebed['push'](_0x49ebed['shift']());}};_0x247194(++_0x2ed245);}(_0xa107,0x177));var _0x7a10=function(_0x1a0517,_0x1da755){_0x1a0517=_0x1a0517-0x0;var _0x2e71cd=_0xa107[_0x1a0517];return _0x2e71cd;};'use strict';var FaxMessageEvents=require(_0x7a10('0x0'));var events=[_0x7a10('0x1'),_0x7a10('0x2'),_0x7a10('0x3')];function createListener(_0x5e63c9,_0x141399){return function(_0x2aef1e){_0x141399[_0x7a10('0x4')](_0x5e63c9,_0x2aef1e);};}function removeListener(_0xb97f06,_0x587f81){return function(){FaxMessageEvents[_0x7a10('0x5')](_0xb97f06,_0x587f81);};}exports[_0x7a10('0x6')]=function(_0xbf41e3){for(var _0x3174b6=0x0,_0x2c76c9=events[_0x7a10('0x7')];_0x3174b6<_0x2c76c9;_0x3174b6++){var _0x4efd1d=events[_0x3174b6];var _0x39084f=createListener('faxMessage:'+_0x4efd1d,_0xbf41e3);FaxMessageEvents['on'](_0x4efd1d,_0x39084f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 06ebad9..d5c4952 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 _0xae60=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept'];(function(_0x54a081,_0x1fda89){var _0x58a652=function(_0x5ad709){while(--_0x5ad709){_0x54a081['push'](_0x54a081['shift']());}};_0x58a652(++_0x1fda89);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xae60[_0x2f45ea];return _0x485a84;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./faxMessage.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),interaction[_0x0ae6('0x11')](_0x0ae6('0x12'),_0x0ae6('0x13')),controller[_0x0ae6('0x14')]);router[_0x0ae6('0x15')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x17')]);router[_0x0ae6('0x15')](_0x0ae6('0x18'),auth[_0x0ae6('0x9')](),controller['accept']);router[_0x0ae6('0x15')](_0x0ae6('0x19'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1a')]);router[_0x0ae6('0x1b')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1c')]);module[_0x0ae6('0x1d')]=router; \ No newline at end of file +var _0xde2c=['/describe','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x147a8e,_0x17a1a0){var _0x12c13e=function(_0x22a009){while(--_0x22a009){_0x147a8e['push'](_0x147a8e['shift']());}};_0x12c13e(++_0x17a1a0);}(_0xde2c,0x7f));var _0xcde2=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xde2c[_0x328534];return _0x2796c0;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xcde2('0x13'),_0xcde2('0x14')),controller[_0xcde2('0x15')]);router[_0xcde2('0x16')](_0xcde2('0x17'),auth[_0xcde2('0xb')](),controller['update']);router[_0xcde2('0x16')]('/:id/accept',auth[_0xcde2('0xb')](),controller['accept']);router['put'](_0xcde2('0x18'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x19')]);router[_0xcde2('0x1a')](_0xcde2('0x17'),auth['isAuthenticated'](),controller[_0xcde2('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fdf6111..330be37 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 _0xe5de=['ENUM','roundrobin','STRING','INTEGER'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0xe5de,0x1aa));var _0xee5d=function(_0xa9bfa6,_0x31423b){_0xa9bfa6=_0xa9bfa6-0x0;var _0x5a794a=_0xe5de[_0xa9bfa6];return _0x5a794a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee5d('0x0')]},'timeout':{'type':Sequelize[_0xee5d('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee5d('0x2')]('rrmemory','beepall',_0xee5d('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b4a=['exports','STRING','name','ENUM','rrmemory','roundrobin','INTEGER','sequelize'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x6b4a,0x147));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6b4('0x0'));module[_0xa6b4('0x1')]={'name':{'type':Sequelize[_0xa6b4('0x2')],'unique':_0xa6b4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6b4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6b4('0x4')](_0xa6b4('0x5'),'beepall',_0xa6b4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa6b4('0x7')],'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 f328dac..f309c06 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 _0x34ec=['map','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filters','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','order','sort','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','emit','addAgents','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','send','FaxQueue','fieldName','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ec,0x1ed));var _0xc34e=function(_0x51e108,_0x1dc4d8){_0x51e108=_0x51e108-0x0;var _0x383762=_0x34ec[_0x51e108];return _0x383762;};'use strict';var emlformat=require(_0xc34e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc34e('0x1'));var jsonpatch=require(_0xc34e('0x2'));var rp=require('request-promise');var moment=require(_0xc34e('0x3'));var BPromise=require(_0xc34e('0x4'));var Mustache=require('mustache');var util=require(_0xc34e('0x5'));var path=require(_0xc34e('0x6'));var sox=require(_0xc34e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc34e('0x8'));var squel=require(_0xc34e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc34e('0xa'));var toCsv=require(_0xc34e('0xb'));var querystring=require(_0xc34e('0xc'));var Papa=require(_0xc34e('0xd'));var Redis=require(_0xc34e('0xe'));var authService=require(_0xc34e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc34e('0x10'));var hardwareService=require(_0xc34e('0x11'));var logger=require('../../config/logger')(_0xc34e('0x12'));var utils=require('../../config/utils');var config=require(_0xc34e('0x13'));var licenseUtil=require(_0xc34e('0x14'));var db=require(_0xc34e('0x15'))['db'];config[_0xc34e('0x16')]=_['defaults'](config[_0xc34e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc34e('0x17'))(new Redis(config['redis']));require(_0xc34e('0x18'))[_0xc34e('0x19')](socket);function respondWithStatusCode(_0xbc32da,_0x7c0a1d){_0x7c0a1d=_0x7c0a1d||0xcc;return function(_0x1ac481){if(_0x1ac481){return _0xbc32da[_0xc34e('0x1a')](_0x7c0a1d);}return _0xbc32da[_0xc34e('0x1b')](_0x7c0a1d)[_0xc34e('0x1c')]();};}function respondWithResult(_0x4181d6,_0x4fa61d){_0x4fa61d=_0x4fa61d||0xc8;return function(_0x15fea7){if(_0x15fea7){return _0x4181d6[_0xc34e('0x1b')](_0x4fa61d)[_0xc34e('0x1d')](_0x15fea7);}};}function respondWithFilteredResult(_0x23c801,_0x23b0a7){return function(_0x75dfad){if(_0x75dfad){var _0x14371e=typeof _0x23b0a7[_0xc34e('0x1e')]===_0xc34e('0x1f')&&typeof _0x23b0a7[_0xc34e('0x20')]==='undefined';var _0x45cd9f=_0x75dfad['count'];var _0x5ad37e=_0x14371e?0x0:_0x23b0a7['offset'];var _0x135651=_0x14371e?_0x75dfad['count']:_0x23b0a7[_0xc34e('0x1e')]+_0x23b0a7[_0xc34e('0x20')];var _0x2d8695;if(_0x135651>=_0x45cd9f){_0x135651=_0x45cd9f;_0x2d8695=0xc8;}else{_0x2d8695=0xce;}_0x23c801[_0xc34e('0x1b')](_0x2d8695);return _0x23c801[_0xc34e('0x21')]('Content-Range',_0x5ad37e+'-'+_0x135651+'/'+_0x45cd9f)[_0xc34e('0x1d')](_0x75dfad);}return null;};}function patchUpdates(_0x3f7bda){return function(_0x9a58ad){try{jsonpatch['apply'](_0x9a58ad,_0x3f7bda,!![]);}catch(_0x5b3e2a){return BPromise[_0xc34e('0x22')](_0x5b3e2a);}return _0x9a58ad[_0xc34e('0x23')]();};}function saveUpdates(_0xc5e1cb,_0x2c9210){return function(_0x4878c1){if(_0x4878c1){return _0x4878c1[_0xc34e('0x24')](_0xc5e1cb)[_0xc34e('0x25')](function(_0x240282){return _0x240282;});}return null;};}function removeEntity(_0x53b18d,_0x44cc0a){return function(_0x561367){if(_0x561367){return _0x561367[_0xc34e('0x26')]()[_0xc34e('0x25')](function(){var _0x489956=_0x561367[_0xc34e('0x27')]({'plain':!![]});var _0x494d60=_0xc34e('0x28');return db[_0xc34e('0x29')][_0xc34e('0x26')]({'where':{'type':_0x494d60,'resourceId':_0x489956['id']}})[_0xc34e('0x25')](function(){return _0x561367;});})[_0xc34e('0x25')](function(){_0x53b18d[_0xc34e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501099,_0x5084f1){return function(_0x1bfff3){if(!_0x1bfff3){_0x501099[_0xc34e('0x1a')](0x194);}return _0x1bfff3;};}function handleError(_0x1eb3db,_0x221e2f){_0x221e2f=_0x221e2f||0x1f4;return function(_0x276905){logger['error'](_0x276905['stack']);if(_0x276905['name']){delete _0x276905['name'];}_0x1eb3db['status'](_0x221e2f)[_0xc34e('0x2a')](_0x276905);};}exports['index']=function(_0x7f814c,_0x32539b){var _0x15cd56={},_0x444d88={},_0x211bcd={'count':0x0,'rows':[]};var _0x57e918=_['map'](db[_0xc34e('0x2b')]['rawAttributes'],function(_0xf66e36){return{'name':_0xf66e36[_0xc34e('0x2c')],'type':_0xf66e36['type'][_0xc34e('0x2d')]};});_0x444d88[_0xc34e('0x2e')]=_[_0xc34e('0x2f')](_0x57e918,_0xc34e('0x30'));_0x444d88[_0xc34e('0x31')]=_[_0xc34e('0x32')](_0x7f814c[_0xc34e('0x31')]);_0x444d88['filters']=_['intersection'](_0x444d88[_0xc34e('0x2e')],_0x444d88[_0xc34e('0x31')]);_0x15cd56[_0xc34e('0x33')]=_[_0xc34e('0x34')](_0x444d88[_0xc34e('0x2e')],qs[_0xc34e('0x35')](_0x7f814c[_0xc34e('0x31')]['fields']));_0x15cd56[_0xc34e('0x33')]=_0x15cd56['attributes'][_0xc34e('0x36')]?_0x15cd56[_0xc34e('0x33')]:_0x444d88[_0xc34e('0x2e')];if(!_0x7f814c[_0xc34e('0x31')][_0xc34e('0x37')](_0xc34e('0x38'))){_0x15cd56[_0xc34e('0x20')]=qs['limit'](_0x7f814c[_0xc34e('0x31')][_0xc34e('0x20')]);_0x15cd56['offset']=qs[_0xc34e('0x1e')](_0x7f814c[_0xc34e('0x31')][_0xc34e('0x1e')]);}_0x15cd56['order']=qs['sort'](_0x7f814c[_0xc34e('0x31')]['sort']);_0x15cd56[_0xc34e('0x39')]=qs['filters'](_[_0xc34e('0x3a')](_0x7f814c[_0xc34e('0x31')],_0x444d88[_0xc34e('0x3b')]),_0x57e918);if(_0x7f814c[_0xc34e('0x31')]['filter']){_0x15cd56[_0xc34e('0x39')]=_[_0xc34e('0x3c')](_0x15cd56[_0xc34e('0x39')],{'$or':_[_0xc34e('0x2f')](_0x57e918,function(_0xeba2f2){if(_0xeba2f2[_0xc34e('0x3d')]!==_0xc34e('0x3e')){var _0x1d1009={};_0x1d1009[_0xeba2f2['name']]={'$like':'%'+_0x7f814c[_0xc34e('0x31')][_0xc34e('0x3f')]+'%'};return _0x1d1009;}})});}_0x15cd56=_[_0xc34e('0x3c')]({},_0x15cd56,_0x7f814c[_0xc34e('0x40')]);var _0x1cebf8={'where':_0x15cd56[_0xc34e('0x39')]};return db['FaxQueue'][_0xc34e('0x41')](_0x1cebf8)[_0xc34e('0x25')](function(_0x4352fc){_0x211bcd[_0xc34e('0x41')]=_0x4352fc;if(_0x7f814c[_0xc34e('0x31')][_0xc34e('0x42')]){_0x15cd56[_0xc34e('0x43')]=[{'all':!![]}];}return db[_0xc34e('0x2b')][_0xc34e('0x44')](_0x15cd56);})[_0xc34e('0x25')](function(_0x2fb7df){_0x211bcd[_0xc34e('0x45')]=_0x2fb7df;return _0x211bcd;})[_0xc34e('0x25')](respondWithFilteredResult(_0x32539b,_0x15cd56))[_0xc34e('0x46')](handleError(_0x32539b,null));};exports['show']=function(_0x161de7,_0x1f4b20){var _0x41e57e={'raw':!![],'where':{'id':_0x161de7[_0xc34e('0x47')]['id']}},_0x1d3c2d={};_0x1d3c2d[_0xc34e('0x2e')]=_['keys'](db['FaxQueue'][_0xc34e('0x48')]);_0x1d3c2d[_0xc34e('0x31')]=_['keys'](_0x161de7[_0xc34e('0x31')]);_0x1d3c2d['filters']=_[_0xc34e('0x34')](_0x1d3c2d[_0xc34e('0x2e')],_0x1d3c2d[_0xc34e('0x31')]);_0x41e57e[_0xc34e('0x33')]=_[_0xc34e('0x34')](_0x1d3c2d[_0xc34e('0x2e')],qs[_0xc34e('0x35')](_0x161de7[_0xc34e('0x31')][_0xc34e('0x35')]));_0x41e57e[_0xc34e('0x33')]=_0x41e57e[_0xc34e('0x33')]['length']?_0x41e57e[_0xc34e('0x33')]:_0x1d3c2d[_0xc34e('0x2e')];if(_0x161de7[_0xc34e('0x31')]['includeAll']){_0x41e57e[_0xc34e('0x43')]=[{'all':!![]}];}_0x41e57e=_['merge']({},_0x41e57e,_0x161de7[_0xc34e('0x40')]);return db[_0xc34e('0x2b')]['find'](_0x41e57e)[_0xc34e('0x25')](handleEntityNotFound(_0x1f4b20,null))[_0xc34e('0x25')](respondWithResult(_0x1f4b20,null))[_0xc34e('0x46')](handleError(_0x1f4b20,null));};exports['create']=function(_0x535658,_0x39125a){return db[_0xc34e('0x2b')][_0xc34e('0x49')](_0x535658['body'],{})[_0xc34e('0x25')](function(_0x3dd4d1){var _0x394eae=_0x535658[_0xc34e('0x4a')]['get']({'plain':!![]});if(!_0x394eae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x394eae[_0xc34e('0x4b')]===_0xc34e('0x4a')){var _0x4af36e=_0x3dd4d1['get']({'plain':!![]});var _0x2656d5=_0xc34e('0x28');return db[_0xc34e('0x4c')][_0xc34e('0x4d')]({'where':{'name':_0x2656d5,'userProfileId':_0x394eae[_0xc34e('0x4e')]},'raw':!![]})['then'](function(_0x24d25f){if(_0x24d25f&&_0x24d25f[_0xc34e('0x4f')]===0x0){return db[_0xc34e('0x29')][_0xc34e('0x49')]({'name':_0x4af36e['name'],'resourceId':_0x4af36e['id'],'type':_0x24d25f[_0xc34e('0x30')],'sectionId':_0x24d25f['id']},{})[_0xc34e('0x25')](function(){return _0x3dd4d1;});}else{return _0x3dd4d1;}})[_0xc34e('0x46')](function(_0x3aacb3){logger['error'](_0xc34e('0x50'),_0x3aacb3);throw _0x3aacb3;});}return _0x3dd4d1;})[_0xc34e('0x25')](respondWithResult(_0x39125a,0xc9))[_0xc34e('0x46')](handleError(_0x39125a,null));};exports['update']=function(_0x411d0d,_0x495733){if(_0x411d0d[_0xc34e('0x51')]['id']){delete _0x411d0d[_0xc34e('0x51')]['id'];}return db['FaxQueue'][_0xc34e('0x4d')]({'where':{'id':_0x411d0d[_0xc34e('0x47')]['id']}})[_0xc34e('0x25')](handleEntityNotFound(_0x495733,null))[_0xc34e('0x25')](saveUpdates(_0x411d0d[_0xc34e('0x51')],null))['then'](respondWithResult(_0x495733,null))[_0xc34e('0x46')](handleError(_0x495733,null));};exports[_0xc34e('0x26')]=function(_0x273fdb,_0x1380fd){return db['FaxQueue'][_0xc34e('0x4d')]({'where':{'id':_0x273fdb['params']['id']}})[_0xc34e('0x25')](handleEntityNotFound(_0x1380fd,null))['then'](removeEntity(_0x1380fd,null))[_0xc34e('0x46')](handleError(_0x1380fd,null));};exports[_0xc34e('0x52')]=function(_0x55bafc,_0x12f2fe){return db[_0xc34e('0x2b')][_0xc34e('0x52')]()['then'](respondWithResult(_0x12f2fe,null))['catch'](handleError(_0x12f2fe,null));};exports[_0xc34e('0x53')]=function(_0x2bcd99,_0x189f51,_0x4dc164){var _0x1d146d={'raw':!![],'where':{}},_0x7fea0c={},_0x1c7eff;return db['FaxQueue'][_0xc34e('0x54')]({'where':{'id':_0x2bcd99[_0xc34e('0x47')]['id']}})[_0xc34e('0x25')](handleEntityNotFound(_0x189f51,null))['then'](function(_0x35f030){if(_0x35f030){_0x1c7eff=_0x35f030['get']({'plain':!![]});_0x7fea0c['model']=_[_0xc34e('0x32')](db[_0xc34e('0x55')][_0xc34e('0x48')]);_0x7fea0c[_0xc34e('0x31')]=_[_0xc34e('0x32')](_0x2bcd99[_0xc34e('0x31')]);_0x7fea0c[_0xc34e('0x3b')]=_[_0xc34e('0x34')](_0x7fea0c['model'],_0x7fea0c[_0xc34e('0x31')]);_0x1d146d['attributes']=_[_0xc34e('0x34')](_0x7fea0c['model'],qs[_0xc34e('0x35')](_0x2bcd99[_0xc34e('0x31')][_0xc34e('0x35')]));_0x1d146d[_0xc34e('0x33')]=_0x1d146d[_0xc34e('0x33')]['length']?_0x1d146d[_0xc34e('0x33')]:_0x7fea0c[_0xc34e('0x2e')];if(!_0x2bcd99['query'][_0xc34e('0x37')](_0xc34e('0x38'))){_0x1d146d['limit']=qs['limit'](_0x2bcd99[_0xc34e('0x31')]['limit']);_0x1d146d[_0xc34e('0x1e')]=qs[_0xc34e('0x1e')](_0x2bcd99['query'][_0xc34e('0x1e')]);}_0x1d146d[_0xc34e('0x56')]=qs[_0xc34e('0x57')](_0x2bcd99[_0xc34e('0x31')]['sort']);_0x1d146d[_0xc34e('0x39')]=qs[_0xc34e('0x3b')](_[_0xc34e('0x3a')](_0x2bcd99[_0xc34e('0x31')],_0x7fea0c['filters']));_0x1d146d[_0xc34e('0x39')][_0xc34e('0x58')]=_0x35f030['id'];if(_0x2bcd99[_0xc34e('0x31')][_0xc34e('0x3f')]){_0x1d146d[_0xc34e('0x39')]=_['merge'](_0x1d146d[_0xc34e('0x39')],{'$or':_[_0xc34e('0x2f')](_0x1d146d[_0xc34e('0x33')],function(_0x506111){var _0x45cfae={};_0x45cfae[_0x506111]={'$like':'%'+_0x2bcd99['query'][_0xc34e('0x3f')]+'%'};return _0x45cfae;})});}_0x1d146d=_[_0xc34e('0x3c')]({},_0x1d146d,_0x2bcd99['options']);return db['UserFaxQueue'][_0xc34e('0x44')](_0x1d146d);}})[_0xc34e('0x25')](function(_0x7e9b32){if(_0x7e9b32){return db[_0xc34e('0x59')][_0xc34e('0x5a')]({'where':{'id':_[_0xc34e('0x2f')](_0x7e9b32,'UserId'),'role':_0xc34e('0x5b')},'attributes':['id',_0xc34e('0x30'),_0xc34e('0x5c'),_0xc34e('0x5d'),'createdAt']});}})['then'](function(_0x2045f4){if(_0x2045f4){return{'count':_0x2045f4['count'],'rows':_[_0xc34e('0x2f')](_0x2045f4[_0xc34e('0x45')],function(_0x31133a){return{'membername':_0x31133a[_0xc34e('0x30')],'UserId':_0x31133a['id'],'queue_name':_0x1c7eff[_0xc34e('0x30')],'FaxQueueId':_0x1c7eff['id'],'interface':util[_0xc34e('0x5e')](_0xc34e('0x5f'),'SIP',_0x31133a[_0xc34e('0x30')]),'penalty':0x0,'paused':_0x31133a[_0xc34e('0x5c')],'createdAt':_0x31133a[_0xc34e('0x60')],'updatedAt':_0x31133a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x189f51,_0x1d146d))['catch'](handleError(_0x189f51,null));};exports[_0xc34e('0x61')]=function(_0x39bc40,_0x16708a,_0x36342c){var _0x3fa0a8={};var _0x141e3c={};var _0x3421e9;var _0x28e60e;return db['FaxQueue'][_0xc34e('0x54')]({'where':{'id':_0x39bc40['params']['id']}})['then'](handleEntityNotFound(_0x16708a,null))[_0xc34e('0x25')](function(_0x2d87af){if(_0x2d87af){_0x3421e9=_0x2d87af;_0x141e3c[_0xc34e('0x2e')]=_[_0xc34e('0x32')](db[_0xc34e('0x62')]['rawAttributes']);_0x141e3c['query']=_['keys'](_0x39bc40[_0xc34e('0x31')]);_0x141e3c[_0xc34e('0x3b')]=_[_0xc34e('0x34')](_0x141e3c['model'],_0x141e3c[_0xc34e('0x31')]);_0x3fa0a8[_0xc34e('0x33')]=_[_0xc34e('0x34')](_0x141e3c[_0xc34e('0x2e')],qs[_0xc34e('0x35')](_0x39bc40['query'][_0xc34e('0x35')]));_0x3fa0a8[_0xc34e('0x33')]=_0x3fa0a8[_0xc34e('0x33')]['length']?_0x3fa0a8[_0xc34e('0x33')]:_0x141e3c[_0xc34e('0x2e')];_0x3fa0a8[_0xc34e('0x56')]=qs['sort'](_0x39bc40['query'][_0xc34e('0x57')]);_0x3fa0a8[_0xc34e('0x39')]=qs['filters'](_[_0xc34e('0x3a')](_0x39bc40[_0xc34e('0x31')],_0x141e3c[_0xc34e('0x3b')]));if(_0x39bc40['query'][_0xc34e('0x3f')]){_0x3fa0a8['where']=_[_0xc34e('0x3c')](_0x3fa0a8[_0xc34e('0x39')],{'$or':_[_0xc34e('0x2f')](_0x3fa0a8['attributes'],function(_0x26600b){var _0x269cfa={};_0x269cfa[_0x26600b]={'$like':'%'+_0x39bc40[_0xc34e('0x31')][_0xc34e('0x3f')]+'%'};return _0x269cfa;})});}_0x3fa0a8=_['merge']({},_0x3fa0a8,_0x39bc40[_0xc34e('0x40')]);return _0x3421e9['getTeams'](_0x3fa0a8);}})['then'](function(_0x39cef1){if(_0x39cef1){_0x28e60e=_0x39cef1['length'];if(!_0x39bc40[_0xc34e('0x31')][_0xc34e('0x37')](_0xc34e('0x38'))){_0x3fa0a8[_0xc34e('0x20')]=qs[_0xc34e('0x20')](_0x39bc40[_0xc34e('0x31')][_0xc34e('0x20')]);_0x3fa0a8['offset']=qs['offset'](_0x39bc40['query'][_0xc34e('0x1e')]);}return _0x3421e9[_0xc34e('0x61')](_0x3fa0a8);}})[_0xc34e('0x25')](function(_0x9514ef){if(_0x9514ef){return _0x9514ef?{'count':_0x28e60e,'rows':_0x9514ef}:null;}})['then'](respondWithResult(_0x16708a,null))['catch'](handleError(_0x16708a,null));};exports[_0xc34e('0x63')]=function(_0x365e26,_0x325a67,_0x35df6b){var _0x43c7c6=_0x365e26[_0xc34e('0x51')][_0xc34e('0x64')];return db[_0xc34e('0x62')][_0xc34e('0x44')]({'where':{'id':_0x43c7c6},'attributes':['id'],'include':[{'model':db[_0xc34e('0x59')],'as':_0xc34e('0x65'),'attributes':['id',_0xc34e('0x30'),_0xc34e('0x66'),_0xc34e('0x67'),_0xc34e('0x68')],'raw':!![]}]})['then'](function(_0x3d2349){if(_0x3d2349){var _0x14c039=_[_0xc34e('0x69')](_0x3d2349,function(_0x41d035){var _0x25e49e=_0x41d035[_0xc34e('0x27')]({'plain':!![]});return _0x25e49e[_0xc34e('0x65')];});return db[_0xc34e('0x2b')][_0xc34e('0x4d')]({'where':{'id':_0x365e26['params']['id']}})[_0xc34e('0x25')](function(_0x40115b){return db[_0xc34e('0x6a')][_0xc34e('0x6b')](function(_0x1f0d75){return _0x40115b[_0xc34e('0x63')](_0x43c7c6,{'transaction':_0x1f0d75})['then'](function(){return BPromise[_0xc34e('0x6c')](_0x14c039,function(_0x5d3aa4){return db[_0xc34e('0x55')][_0xc34e('0x6d')]({'where':{'UserId':_0x5d3aa4['id'],'FaxQueueId':_0x365e26[_0xc34e('0x47')]['id']},'transaction':_0x1f0d75});});})[_0xc34e('0x25')](function(){_0x14c039['forEach'](function(_0x45cc20){socket['emit']('userFaxQueue:save',{'UserId':_0x45cc20['id'],'FaxQueueId':_0x40115b['id']});});});});});}})[_0xc34e('0x25')](respondWithStatusCode(_0x325a67,null))[_0xc34e('0x46')](handleError(_0x325a67,null));};exports['removeTeams']=function(_0x44bb24,_0x136387,_0x3a1299){return db[_0xc34e('0x62')][_0xc34e('0x44')]({'where':{'id':_0x44bb24[_0xc34e('0x31')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc34e('0x65'),'attributes':['id'],'raw':!![]}]})[_0xc34e('0x25')](handleEntityNotFound(_0x136387,null))[_0xc34e('0x25')](function(_0x48208d){var _0x211ee2=_[_0xc34e('0x2f')](_0x48208d,'id');var _0x4a8897=[];var _0x38bf7e=[];var _0xeb9969=squel['select']();_0xeb9969['field'](_0xc34e('0x6e'))[_0xc34e('0x6f')](_0xc34e('0x70'),'tq')[_0xc34e('0x71')](_0xc34e('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x44bb24['params']['id']);for(var _0x8bd4e5=0x0;_0x8bd4e5<_0x48208d[_0xc34e('0x36')];_0x8bd4e5+=0x1){let _0x12ff8b=_0x48208d[_0x8bd4e5];for(var _0x17fdb1=0x0;_0x17fdb1<_0x12ff8b[_0xc34e('0x65')][_0xc34e('0x36')];_0x17fdb1+=0x1){let _0x131943=_0x12ff8b[_0xc34e('0x65')][_0x17fdb1];var _0x2fc513=_0xeb9969[_0xc34e('0x73')]();_0x2fc513[_0xc34e('0x39')]('ut.UserId\x20=\x20?',_0x131943['id']);_0x38bf7e[_0xc34e('0x74')](db['sequelize']['query'](_0x2fc513['toString'](),{'type':db[_0xc34e('0x6a')][_0xc34e('0x75')]['SELECT']})['then'](function(_0x5dd82f){if(_0x5dd82f[_0xc34e('0x36')]===0x1){return _0x131943['id'];}else{var _0x4b6751=_[_0xc34e('0x76')](_['map'](_0x5dd82f,_0xc34e('0x77')),function(_0x5be80d){return _[_0xc34e('0x78')](_0x211ee2,_0x5be80d);});if(_0x4b6751){return _0x131943['id'];}}}));}}return BPromise[_0xc34e('0x79')](_0x38bf7e)[_0xc34e('0x25')](function(_0x4581d1){_0x4a8897=_(_0x4a8897)[_0xc34e('0x7a')](_0x4581d1)[_0xc34e('0x7b')]()[_0xc34e('0x7c')]();return db[_0xc34e('0x2b')][_0xc34e('0x4d')]({'where':{'id':_0x44bb24['params']['id']}})[_0xc34e('0x25')](function(_0x4d3086){return db[_0xc34e('0x6a')][_0xc34e('0x6b')](function(_0x149b66){return _0x4d3086['removeTeams'](_0x44bb24[_0xc34e('0x31')][_0xc34e('0x64')],{'transaction':_0x149b66})[_0xc34e('0x25')](function(){if(!_[_0xc34e('0x7d')](_0x4a8897)){return _0x4d3086[_0xc34e('0x7e')](_0x4a8897,{'transaction':_0x149b66});}})[_0xc34e('0x25')](function(){_0x4a8897[_0xc34e('0x7f')](function(_0xb9c3f8){socket[_0xc34e('0x80')]('userFaxQueue:remove',{'UserId':_0xb9c3f8,'FaxQueueId':_0x4d3086['id']});});});});});});})[_0xc34e('0x25')](respondWithStatusCode(_0x136387,null))[_0xc34e('0x46')](handleError(_0x136387,null));};exports['addAgents']=function(_0x290a93,_0x14ef6b,_0x4450da){return db[_0xc34e('0x2b')][_0xc34e('0x4d')]({'where':{'id':_0x290a93[_0xc34e('0x47')]['id']}})['then'](handleEntityNotFound(_0x14ef6b,null))[_0xc34e('0x25')](function(_0x560b5a){if(_0x560b5a){return _0x560b5a[_0xc34e('0x81')](_0x290a93['body'][_0xc34e('0x64')],_['omit'](_0x290a93[_0xc34e('0x51')],[_0xc34e('0x64'),'id'])||{})[_0xc34e('0x82')](function(_0x4ab144){for(var _0x1cf8f9=0x0;_0x1cf8f9<_0x290a93[_0xc34e('0x51')][_0xc34e('0x64')][_0xc34e('0x36')];_0x1cf8f9+=0x1){socket[_0xc34e('0x80')](_0xc34e('0x83'),{'UserId':Number(_0x290a93[_0xc34e('0x51')][_0xc34e('0x64')][_0x1cf8f9]),'FaxQueueId':Number(_0x290a93[_0xc34e('0x47')]['id'])});}return _0x4ab144;});}})[_0xc34e('0x25')](respondWithResult(_0x14ef6b,null))['catch'](handleError(_0x14ef6b,null));};exports[_0xc34e('0x7e')]=function(_0x7f827a,_0x58fa2d,_0xc65037){return db[_0xc34e('0x2b')][_0xc34e('0x4d')]({'where':{'id':_0x7f827a[_0xc34e('0x47')]['id']}})[_0xc34e('0x25')](handleEntityNotFound(_0x58fa2d,null))[_0xc34e('0x25')](function(_0x1a5ea3){if(_0x1a5ea3){return _0x1a5ea3[_0xc34e('0x7e')](_0x7f827a['query'][_0xc34e('0x64')])[_0xc34e('0x25')](function(){if(_[_0xc34e('0x84')](_0x7f827a[_0xc34e('0x31')][_0xc34e('0x64')])){for(var _0xe0c018=0x0;_0xe0c018<_0x7f827a['query']['ids'][_0xc34e('0x36')];_0xe0c018+=0x1){socket[_0xc34e('0x80')](_0xc34e('0x85'),{'UserId':Number(_0x7f827a[_0xc34e('0x31')][_0xc34e('0x64')][_0xe0c018]),'FaxQueueId':Number(_0x7f827a[_0xc34e('0x47')]['id'])});}}else{socket[_0xc34e('0x80')](_0xc34e('0x85'),{'UserId':Number(_0x7f827a[_0xc34e('0x31')][_0xc34e('0x64')]),'FaxQueueId':Number(_0x7f827a[_0xc34e('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x58fa2d,null))['catch'](handleError(_0x58fa2d,null));};exports[_0xc34e('0x86')]=function(_0x4f803b,_0x4b9435,_0x4b9530){var _0x214dee={};var _0x34c23a={};var _0x504059;var _0x2d3a1e;return db[_0xc34e('0x2b')][_0xc34e('0x54')]({'where':{'id':_0x4f803b['params']['id']}})[_0xc34e('0x25')](handleEntityNotFound(_0x4b9435,null))[_0xc34e('0x25')](function(_0x40030b){if(_0x40030b){_0x504059=_0x40030b;_0x34c23a['model']=_[_0xc34e('0x32')](db[_0xc34e('0x59')][_0xc34e('0x48')]);_0x34c23a[_0xc34e('0x31')]=_['keys'](_0x4f803b[_0xc34e('0x31')]);_0x34c23a[_0xc34e('0x3b')]=_[_0xc34e('0x34')](_0x34c23a[_0xc34e('0x2e')],_0x34c23a[_0xc34e('0x31')]);_0x214dee[_0xc34e('0x33')]=_[_0xc34e('0x34')](_0x34c23a[_0xc34e('0x2e')],qs['fields'](_0x4f803b[_0xc34e('0x31')][_0xc34e('0x35')]));_0x214dee[_0xc34e('0x33')]=_0x214dee[_0xc34e('0x33')]['length']?_0x214dee[_0xc34e('0x33')]:_0x34c23a[_0xc34e('0x2e')];_0x214dee[_0xc34e('0x56')]=qs[_0xc34e('0x57')](_0x4f803b[_0xc34e('0x31')][_0xc34e('0x57')]);_0x214dee['where']=qs['filters'](_['pick'](_0x4f803b[_0xc34e('0x31')],_0x34c23a[_0xc34e('0x3b')]));if(_0x4f803b['query'][_0xc34e('0x3f')]){_0x214dee[_0xc34e('0x39')]=_[_0xc34e('0x3c')](_0x214dee[_0xc34e('0x39')],{'$or':_[_0xc34e('0x2f')](_0x214dee[_0xc34e('0x33')],function(_0x1b73fd){var _0x1c40ef={};_0x1c40ef[_0x1b73fd]={'$like':'%'+_0x4f803b[_0xc34e('0x31')][_0xc34e('0x3f')]+'%'};return _0x1c40ef;})});}_0x214dee=_[_0xc34e('0x3c')]({},_0x214dee,_0x4f803b['options']);return _0x504059[_0xc34e('0x86')](_0x214dee);}})['then'](function(_0x1e38f1){if(_0x1e38f1){_0x2d3a1e=_0x1e38f1['length'];if(!_0x4f803b['query']['hasOwnProperty']('nolimit')){_0x214dee[_0xc34e('0x20')]=qs['limit'](_0x4f803b[_0xc34e('0x31')][_0xc34e('0x20')]);_0x214dee[_0xc34e('0x1e')]=qs[_0xc34e('0x1e')](_0x4f803b[_0xc34e('0x31')][_0xc34e('0x1e')]);}return _0x504059[_0xc34e('0x86')](_0x214dee);}})[_0xc34e('0x25')](function(_0x2d02f1){if(_0x2d02f1){return _0x2d02f1?{'count':_0x2d3a1e,'rows':_0x2d02f1}:null;}})['then'](respondWithResult(_0x4b9435,null))[_0xc34e('0x46')](handleError(_0x4b9435,null));}; \ No newline at end of file +var _0x11dd=['emit','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','FaxQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','FaxQueue','findAll','rows','catch','params','include','create','body','role','user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','keys','order','FaxQueueId','options','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','faxPause','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each'];(function(_0x1caabc,_0x4fc375){var _0x403e38=function(_0x3aaa89){while(--_0x3aaa89){_0x1caabc['push'](_0x1caabc['shift']());}};_0x403e38(++_0x4fc375);}(_0x11dd,0x139));var _0xd11d=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x11dd[_0x386c3e];return _0x4b8e13;};'use strict';var emlformat=require(_0xd11d('0x0'));var rimraf=require(_0xd11d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd11d('0x2'));var rp=require(_0xd11d('0x3'));var moment=require(_0xd11d('0x4'));var BPromise=require(_0xd11d('0x5'));var Mustache=require(_0xd11d('0x6'));var util=require(_0xd11d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd11d('0x8'));var ejs=require(_0xd11d('0x9'));var fs=require('fs');var fs_extra=require(_0xd11d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd11d('0xb'));var deskjs=require(_0xd11d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd11d('0xd'));var Papa=require(_0xd11d('0xe'));var Redis=require(_0xd11d('0xf'));var authService=require(_0xd11d('0x10'));var qs=require(_0xd11d('0x11'));var as=require(_0xd11d('0x12'));var hardwareService=require(_0xd11d('0x13'));var logger=require(_0xd11d('0x14'))(_0xd11d('0x15'));var utils=require(_0xd11d('0x16'));var config=require(_0xd11d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd11d('0x18')]=_[_0xd11d('0x19')](config[_0xd11d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd11d('0x1a'))(new Redis(config[_0xd11d('0x18')]));require(_0xd11d('0x1b'))[_0xd11d('0x1c')](socket);function respondWithStatusCode(_0x459817,_0x266341){_0x266341=_0x266341||0xcc;return function(_0x5adf9b){if(_0x5adf9b){return _0x459817[_0xd11d('0x1d')](_0x266341);}return _0x459817[_0xd11d('0x1e')](_0x266341)['end']();};}function respondWithResult(_0x310a8d,_0x5e3422){_0x5e3422=_0x5e3422||0xc8;return function(_0x15a1aa){if(_0x15a1aa){return _0x310a8d[_0xd11d('0x1e')](_0x5e3422)[_0xd11d('0x1f')](_0x15a1aa);}};}function respondWithFilteredResult(_0x4bf005,_0x496f82){return function(_0x1ab195){if(_0x1ab195){var _0x5c4ad7=typeof _0x496f82[_0xd11d('0x20')]===_0xd11d('0x21')&&typeof _0x496f82[_0xd11d('0x22')]===_0xd11d('0x21');var _0x836fc3=_0x1ab195[_0xd11d('0x23')];var _0x5b7777=_0x5c4ad7?0x0:_0x496f82[_0xd11d('0x20')];var _0x51568c=_0x5c4ad7?_0x1ab195[_0xd11d('0x23')]:_0x496f82['offset']+_0x496f82[_0xd11d('0x22')];var _0x779e3f;if(_0x51568c>=_0x836fc3){_0x51568c=_0x836fc3;_0x779e3f=0xc8;}else{_0x779e3f=0xce;}_0x4bf005[_0xd11d('0x1e')](_0x779e3f);return _0x4bf005[_0xd11d('0x24')](_0xd11d('0x25'),_0x5b7777+'-'+_0x51568c+'/'+_0x836fc3)[_0xd11d('0x1f')](_0x1ab195);}return null;};}function patchUpdates(_0x5e9fef){return function(_0x3b7303){try{jsonpatch[_0xd11d('0x26')](_0x3b7303,_0x5e9fef,!![]);}catch(_0x402c71){return BPromise[_0xd11d('0x27')](_0x402c71);}return _0x3b7303[_0xd11d('0x28')]();};}function saveUpdates(_0x3a3678,_0x9578a4){return function(_0x427ee0){if(_0x427ee0){return _0x427ee0[_0xd11d('0x29')](_0x3a3678)['then'](function(_0x292a05){return _0x292a05;});}return null;};}function removeEntity(_0x38c205,_0x1f9fb9){return function(_0x5b5d5a){if(_0x5b5d5a){return _0x5b5d5a[_0xd11d('0x2a')]()[_0xd11d('0x2b')](function(){var _0xbca489=_0x5b5d5a['get']({'plain':!![]});var _0x419629=_0xd11d('0x2c');return db[_0xd11d('0x2d')]['destroy']({'where':{'type':_0x419629,'resourceId':_0xbca489['id']}})[_0xd11d('0x2b')](function(){return _0x5b5d5a;});})['then'](function(){_0x38c205[_0xd11d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24737b,_0x4697c4){return function(_0xacf540){if(!_0xacf540){_0x24737b[_0xd11d('0x1d')](0x194);}return _0xacf540;};}function handleError(_0x2f49ea,_0x4eb9c8){_0x4eb9c8=_0x4eb9c8||0x1f4;return function(_0x28c898){logger[_0xd11d('0x2e')](_0x28c898[_0xd11d('0x2f')]);if(_0x28c898[_0xd11d('0x30')]){delete _0x28c898[_0xd11d('0x30')];}_0x2f49ea[_0xd11d('0x1e')](_0x4eb9c8)['send'](_0x28c898);};}exports[_0xd11d('0x31')]=function(_0x484081,_0x4681a0){var _0x190087={},_0x40d7ed={},_0xfec29a={'count':0x0,'rows':[]};var _0x5dfa64=_[_0xd11d('0x32')](db['FaxQueue'][_0xd11d('0x33')],function(_0x5e81e3){return{'name':_0x5e81e3[_0xd11d('0x34')],'type':_0x5e81e3[_0xd11d('0x35')][_0xd11d('0x36')]};});_0x40d7ed['model']=_[_0xd11d('0x32')](_0x5dfa64,_0xd11d('0x30'));_0x40d7ed['query']=_['keys'](_0x484081[_0xd11d('0x37')]);_0x40d7ed['filters']=_[_0xd11d('0x38')](_0x40d7ed['model'],_0x40d7ed[_0xd11d('0x37')]);_0x190087[_0xd11d('0x39')]=_['intersection'](_0x40d7ed[_0xd11d('0x3a')],qs[_0xd11d('0x3b')](_0x484081[_0xd11d('0x37')][_0xd11d('0x3b')]));_0x190087[_0xd11d('0x39')]=_0x190087[_0xd11d('0x39')][_0xd11d('0x3c')]?_0x190087[_0xd11d('0x39')]:_0x40d7ed['model'];if(!_0x484081[_0xd11d('0x37')][_0xd11d('0x3d')](_0xd11d('0x3e'))){_0x190087[_0xd11d('0x22')]=qs[_0xd11d('0x22')](_0x484081[_0xd11d('0x37')][_0xd11d('0x22')]);_0x190087[_0xd11d('0x20')]=qs[_0xd11d('0x20')](_0x484081[_0xd11d('0x37')][_0xd11d('0x20')]);}_0x190087['order']=qs[_0xd11d('0x3f')](_0x484081[_0xd11d('0x37')][_0xd11d('0x3f')]);_0x190087[_0xd11d('0x40')]=qs[_0xd11d('0x41')](_[_0xd11d('0x42')](_0x484081['query'],_0x40d7ed[_0xd11d('0x41')]),_0x5dfa64);if(_0x484081[_0xd11d('0x37')][_0xd11d('0x43')]){_0x190087['where']=_[_0xd11d('0x44')](_0x190087[_0xd11d('0x40')],{'$or':_[_0xd11d('0x32')](_0x5dfa64,function(_0x2bba4d){if(_0x2bba4d['type']!==_0xd11d('0x45')){var _0x1384f5={};_0x1384f5[_0x2bba4d[_0xd11d('0x30')]]={'$like':'%'+_0x484081[_0xd11d('0x37')][_0xd11d('0x43')]+'%'};return _0x1384f5;}})});}_0x190087=_[_0xd11d('0x44')]({},_0x190087,_0x484081['options']);var _0x2dc149={'where':_0x190087[_0xd11d('0x40')]};return db[_0xd11d('0x46')]['count'](_0x2dc149)[_0xd11d('0x2b')](function(_0x4b6426){_0xfec29a[_0xd11d('0x23')]=_0x4b6426;if(_0x484081[_0xd11d('0x37')]['includeAll']){_0x190087['include']=[{'all':!![]}];}return db[_0xd11d('0x46')][_0xd11d('0x47')](_0x190087);})[_0xd11d('0x2b')](function(_0x5444b5){_0xfec29a[_0xd11d('0x48')]=_0x5444b5;return _0xfec29a;})[_0xd11d('0x2b')](respondWithFilteredResult(_0x4681a0,_0x190087))[_0xd11d('0x49')](handleError(_0x4681a0,null));};exports['show']=function(_0x3b9153,_0x3c752b){var _0x28f1c9={'raw':!![],'where':{'id':_0x3b9153[_0xd11d('0x4a')]['id']}},_0x26ea2d={};_0x26ea2d['model']=_['keys'](db[_0xd11d('0x46')]['rawAttributes']);_0x26ea2d[_0xd11d('0x37')]=_['keys'](_0x3b9153[_0xd11d('0x37')]);_0x26ea2d[_0xd11d('0x41')]=_[_0xd11d('0x38')](_0x26ea2d[_0xd11d('0x3a')],_0x26ea2d[_0xd11d('0x37')]);_0x28f1c9[_0xd11d('0x39')]=_[_0xd11d('0x38')](_0x26ea2d['model'],qs[_0xd11d('0x3b')](_0x3b9153[_0xd11d('0x37')][_0xd11d('0x3b')]));_0x28f1c9[_0xd11d('0x39')]=_0x28f1c9[_0xd11d('0x39')]['length']?_0x28f1c9[_0xd11d('0x39')]:_0x26ea2d[_0xd11d('0x3a')];if(_0x3b9153['query']['includeAll']){_0x28f1c9[_0xd11d('0x4b')]=[{'all':!![]}];}_0x28f1c9=_[_0xd11d('0x44')]({},_0x28f1c9,_0x3b9153['options']);return db['FaxQueue']['find'](_0x28f1c9)[_0xd11d('0x2b')](handleEntityNotFound(_0x3c752b,null))[_0xd11d('0x2b')](respondWithResult(_0x3c752b,null))[_0xd11d('0x49')](handleError(_0x3c752b,null));};exports['create']=function(_0x3e5649,_0x2f1b5c){return db['FaxQueue'][_0xd11d('0x4c')](_0x3e5649[_0xd11d('0x4d')],{})[_0xd11d('0x2b')](function(_0x3cf999){var _0x59b75e=_0x3e5649['user']['get']({'plain':!![]});if(!_0x59b75e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59b75e[_0xd11d('0x4e')]===_0xd11d('0x4f')){var _0x1199b2=_0x3cf999[_0xd11d('0x50')]({'plain':!![]});var _0x2aa9a0='FaxQueues';return db['UserProfileSection'][_0xd11d('0x51')]({'where':{'name':_0x2aa9a0,'userProfileId':_0x59b75e[_0xd11d('0x52')]},'raw':!![]})['then'](function(_0x1f82f1){if(_0x1f82f1&&_0x1f82f1[_0xd11d('0x53')]===0x0){return db[_0xd11d('0x2d')][_0xd11d('0x4c')]({'name':_0x1199b2['name'],'resourceId':_0x1199b2['id'],'type':_0x1f82f1['name'],'sectionId':_0x1f82f1['id']},{})[_0xd11d('0x2b')](function(){return _0x3cf999;});}else{return _0x3cf999;}})[_0xd11d('0x49')](function(_0x2906b4){logger[_0xd11d('0x2e')](_0xd11d('0x54'),_0x2906b4);throw _0x2906b4;});}return _0x3cf999;})[_0xd11d('0x2b')](respondWithResult(_0x2f1b5c,0xc9))[_0xd11d('0x49')](handleError(_0x2f1b5c,null));};exports['update']=function(_0x114b7b,_0x3bcd88){if(_0x114b7b[_0xd11d('0x4d')]['id']){delete _0x114b7b['body']['id'];}return db[_0xd11d('0x46')][_0xd11d('0x51')]({'where':{'id':_0x114b7b[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](handleEntityNotFound(_0x3bcd88,null))['then'](saveUpdates(_0x114b7b[_0xd11d('0x4d')],null))[_0xd11d('0x2b')](respondWithResult(_0x3bcd88,null))[_0xd11d('0x49')](handleError(_0x3bcd88,null));};exports[_0xd11d('0x2a')]=function(_0x1a2b05,_0x2b4e5d){return db[_0xd11d('0x46')][_0xd11d('0x51')]({'where':{'id':_0x1a2b05[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](handleEntityNotFound(_0x2b4e5d,null))[_0xd11d('0x2b')](removeEntity(_0x2b4e5d,null))[_0xd11d('0x49')](handleError(_0x2b4e5d,null));};exports[_0xd11d('0x55')]=function(_0x3dffb4,_0x20f2c3){return db[_0xd11d('0x46')][_0xd11d('0x55')]()['then'](respondWithResult(_0x20f2c3,null))[_0xd11d('0x49')](handleError(_0x20f2c3,null));};exports[_0xd11d('0x56')]=function(_0x1a0d29,_0x271fd1,_0x3c1386){var _0x1da9de={'raw':!![],'where':{}},_0x25502a={},_0x3ef0b9;return db['FaxQueue']['findOne']({'where':{'id':_0x1a0d29[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](handleEntityNotFound(_0x271fd1,null))[_0xd11d('0x2b')](function(_0x3ae9a9){if(_0x3ae9a9){_0x3ef0b9=_0x3ae9a9['get']({'plain':!![]});_0x25502a[_0xd11d('0x3a')]=_[_0xd11d('0x57')](db['UserFaxQueue'][_0xd11d('0x33')]);_0x25502a['query']=_['keys'](_0x1a0d29[_0xd11d('0x37')]);_0x25502a['filters']=_[_0xd11d('0x38')](_0x25502a[_0xd11d('0x3a')],_0x25502a[_0xd11d('0x37')]);_0x1da9de['attributes']=_[_0xd11d('0x38')](_0x25502a['model'],qs['fields'](_0x1a0d29[_0xd11d('0x37')][_0xd11d('0x3b')]));_0x1da9de[_0xd11d('0x39')]=_0x1da9de[_0xd11d('0x39')][_0xd11d('0x3c')]?_0x1da9de['attributes']:_0x25502a['model'];if(!_0x1a0d29[_0xd11d('0x37')][_0xd11d('0x3d')](_0xd11d('0x3e'))){_0x1da9de['limit']=qs['limit'](_0x1a0d29['query'][_0xd11d('0x22')]);_0x1da9de['offset']=qs[_0xd11d('0x20')](_0x1a0d29[_0xd11d('0x37')][_0xd11d('0x20')]);}_0x1da9de[_0xd11d('0x58')]=qs[_0xd11d('0x3f')](_0x1a0d29[_0xd11d('0x37')][_0xd11d('0x3f')]);_0x1da9de[_0xd11d('0x40')]=qs[_0xd11d('0x41')](_[_0xd11d('0x42')](_0x1a0d29[_0xd11d('0x37')],_0x25502a[_0xd11d('0x41')]));_0x1da9de['where'][_0xd11d('0x59')]=_0x3ae9a9['id'];if(_0x1a0d29[_0xd11d('0x37')][_0xd11d('0x43')]){_0x1da9de[_0xd11d('0x40')]=_[_0xd11d('0x44')](_0x1da9de[_0xd11d('0x40')],{'$or':_[_0xd11d('0x32')](_0x1da9de['attributes'],function(_0x3012fe){var _0x3da471={};_0x3da471[_0x3012fe]={'$like':'%'+_0x1a0d29['query'][_0xd11d('0x43')]+'%'};return _0x3da471;})});}_0x1da9de=_[_0xd11d('0x44')]({},_0x1da9de,_0x1a0d29[_0xd11d('0x5a')]);return db['UserFaxQueue'][_0xd11d('0x47')](_0x1da9de);}})[_0xd11d('0x2b')](function(_0x50e508){if(_0x50e508){return db[_0xd11d('0x5b')][_0xd11d('0x5c')]({'where':{'id':_[_0xd11d('0x32')](_0x50e508,_0xd11d('0x5d')),'role':_0xd11d('0x5e')},'attributes':['id',_0xd11d('0x30'),'faxPause',_0xd11d('0x5f'),'createdAt']});}})['then'](function(_0x150eb5){if(_0x150eb5){return{'count':_0x150eb5[_0xd11d('0x23')],'rows':_[_0xd11d('0x32')](_0x150eb5[_0xd11d('0x48')],function(_0x2e25c9){return{'membername':_0x2e25c9[_0xd11d('0x30')],'UserId':_0x2e25c9['id'],'queue_name':_0x3ef0b9['name'],'FaxQueueId':_0x3ef0b9['id'],'interface':util[_0xd11d('0x60')](_0xd11d('0x61'),'SIP',_0x2e25c9[_0xd11d('0x30')]),'penalty':0x0,'paused':_0x2e25c9[_0xd11d('0x62')],'createdAt':_0x2e25c9[_0xd11d('0x63')],'updatedAt':_0x2e25c9[_0xd11d('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd11d('0x2b')](respondWithFilteredResult(_0x271fd1,_0x1da9de))[_0xd11d('0x49')](handleError(_0x271fd1,null));};exports[_0xd11d('0x64')]=function(_0x4b9441,_0xa22a1f,_0x5cf0c1){var _0x2336c6={};var _0x338932={};var _0x393a11;var _0x46a309;return db[_0xd11d('0x46')][_0xd11d('0x65')]({'where':{'id':_0x4b9441[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](handleEntityNotFound(_0xa22a1f,null))[_0xd11d('0x2b')](function(_0x2bb5d3){if(_0x2bb5d3){_0x393a11=_0x2bb5d3;_0x338932[_0xd11d('0x3a')]=_[_0xd11d('0x57')](db[_0xd11d('0x66')][_0xd11d('0x33')]);_0x338932[_0xd11d('0x37')]=_[_0xd11d('0x57')](_0x4b9441[_0xd11d('0x37')]);_0x338932[_0xd11d('0x41')]=_[_0xd11d('0x38')](_0x338932[_0xd11d('0x3a')],_0x338932[_0xd11d('0x37')]);_0x2336c6[_0xd11d('0x39')]=_[_0xd11d('0x38')](_0x338932[_0xd11d('0x3a')],qs[_0xd11d('0x3b')](_0x4b9441['query']['fields']));_0x2336c6['attributes']=_0x2336c6['attributes'][_0xd11d('0x3c')]?_0x2336c6[_0xd11d('0x39')]:_0x338932['model'];_0x2336c6[_0xd11d('0x58')]=qs[_0xd11d('0x3f')](_0x4b9441['query']['sort']);_0x2336c6[_0xd11d('0x40')]=qs[_0xd11d('0x41')](_[_0xd11d('0x42')](_0x4b9441[_0xd11d('0x37')],_0x338932[_0xd11d('0x41')]));if(_0x4b9441[_0xd11d('0x37')][_0xd11d('0x43')]){_0x2336c6['where']=_[_0xd11d('0x44')](_0x2336c6[_0xd11d('0x40')],{'$or':_[_0xd11d('0x32')](_0x2336c6['attributes'],function(_0x3c844f){var _0x3b29e4={};_0x3b29e4[_0x3c844f]={'$like':'%'+_0x4b9441[_0xd11d('0x37')][_0xd11d('0x43')]+'%'};return _0x3b29e4;})});}_0x2336c6=_['merge']({},_0x2336c6,_0x4b9441[_0xd11d('0x5a')]);return _0x393a11['getTeams'](_0x2336c6);}})[_0xd11d('0x2b')](function(_0x12cae6){if(_0x12cae6){_0x46a309=_0x12cae6[_0xd11d('0x3c')];if(!_0x4b9441[_0xd11d('0x37')][_0xd11d('0x3d')](_0xd11d('0x3e'))){_0x2336c6[_0xd11d('0x22')]=qs['limit'](_0x4b9441[_0xd11d('0x37')]['limit']);_0x2336c6[_0xd11d('0x20')]=qs[_0xd11d('0x20')](_0x4b9441['query'][_0xd11d('0x20')]);}return _0x393a11[_0xd11d('0x64')](_0x2336c6);}})[_0xd11d('0x2b')](function(_0x4b1b3a){if(_0x4b1b3a){return _0x4b1b3a?{'count':_0x46a309,'rows':_0x4b1b3a}:null;}})[_0xd11d('0x2b')](respondWithResult(_0xa22a1f,null))[_0xd11d('0x49')](handleError(_0xa22a1f,null));};exports[_0xd11d('0x67')]=function(_0x417cd1,_0x414738,_0x2a0965){var _0x25ffbb=_0x417cd1[_0xd11d('0x4d')][_0xd11d('0x68')];return db[_0xd11d('0x66')][_0xd11d('0x47')]({'where':{'id':_0x25ffbb},'attributes':['id'],'include':[{'model':db[_0xd11d('0x5b')],'as':_0xd11d('0x69'),'attributes':['id',_0xd11d('0x30'),_0xd11d('0x6a'),_0xd11d('0x6b'),_0xd11d('0x6c')],'raw':!![]}]})['then'](function(_0x3147b1){if(_0x3147b1){var _0x2d0022=_[_0xd11d('0x6d')](_0x3147b1,function(_0x22338b){var _0x49b197=_0x22338b[_0xd11d('0x50')]({'plain':!![]});return _0x49b197[_0xd11d('0x69')];});return db[_0xd11d('0x46')][_0xd11d('0x51')]({'where':{'id':_0x417cd1[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](function(_0xbd2fb7){return db[_0xd11d('0x6e')][_0xd11d('0x6f')](function(_0x57a3e4){return _0xbd2fb7['addTeams'](_0x25ffbb,{'transaction':_0x57a3e4})[_0xd11d('0x2b')](function(){return BPromise[_0xd11d('0x70')](_0x2d0022,function(_0x35a955){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x35a955['id'],'FaxQueueId':_0x417cd1[_0xd11d('0x4a')]['id']},'transaction':_0x57a3e4});});})['then'](function(){_0x2d0022['forEach'](function(_0x34b125){socket[_0xd11d('0x71')]('userFaxQueue:save',{'UserId':_0x34b125['id'],'FaxQueueId':_0xbd2fb7['id']});});});});});}})[_0xd11d('0x2b')](respondWithStatusCode(_0x414738,null))[_0xd11d('0x49')](handleError(_0x414738,null));};exports['removeTeams']=function(_0x5f3824,_0xadb4f0,_0x1cc4fe){return db[_0xd11d('0x66')][_0xd11d('0x47')]({'where':{'id':_0x5f3824[_0xd11d('0x37')][_0xd11d('0x68')]},'attributes':['id'],'include':[{'model':db[_0xd11d('0x5b')],'as':_0xd11d('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xadb4f0,null))[_0xd11d('0x2b')](function(_0x297843){var _0x197b8f=_['map'](_0x297843,'id');var _0x27da25=[];var _0x22e9b6=[];var _0x306700=squel[_0xd11d('0x72')]();_0x306700[_0xd11d('0x73')](_0xd11d('0x74'))[_0xd11d('0x75')](_0xd11d('0x76'),'tq')['join'](_0xd11d('0x77'),'ut',_0xd11d('0x78'))[_0xd11d('0x40')](_0xd11d('0x79'),_0x5f3824[_0xd11d('0x4a')]['id']);for(var _0x2593df=0x0;_0x2593df<_0x297843[_0xd11d('0x3c')];_0x2593df+=0x1){let _0xf4cd11=_0x297843[_0x2593df];for(var _0x570ccc=0x0;_0x570ccc<_0xf4cd11['Agents'][_0xd11d('0x3c')];_0x570ccc+=0x1){let _0x7de45=_0xf4cd11[_0xd11d('0x69')][_0x570ccc];var _0x3a794d=_0x306700[_0xd11d('0x7a')]();_0x3a794d[_0xd11d('0x40')](_0xd11d('0x7b'),_0x7de45['id']);_0x22e9b6[_0xd11d('0x7c')](db[_0xd11d('0x6e')][_0xd11d('0x37')](_0x3a794d[_0xd11d('0x7d')](),{'type':db[_0xd11d('0x6e')][_0xd11d('0x7e')]['SELECT']})[_0xd11d('0x2b')](function(_0x455518){if(_0x455518[_0xd11d('0x3c')]===0x1){return _0x7de45['id'];}else{var _0x2af2b3=_[_0xd11d('0x7f')](_[_0xd11d('0x32')](_0x455518,_0xd11d('0x80')),function(_0x1d970d){return _[_0xd11d('0x81')](_0x197b8f,_0x1d970d);});if(_0x2af2b3){return _0x7de45['id'];}}}));}}return BPromise[_0xd11d('0x82')](_0x22e9b6)[_0xd11d('0x2b')](function(_0x2ca95e){_0x27da25=_(_0x27da25)[_0xd11d('0x83')](_0x2ca95e)[_0xd11d('0x84')]()['value']();return db['FaxQueue'][_0xd11d('0x51')]({'where':{'id':_0x5f3824['params']['id']}})['then'](function(_0x4907fb){return db[_0xd11d('0x6e')][_0xd11d('0x6f')](function(_0x2c08fd){return _0x4907fb['removeTeams'](_0x5f3824[_0xd11d('0x37')][_0xd11d('0x68')],{'transaction':_0x2c08fd})[_0xd11d('0x2b')](function(){if(!_['isEmpty'](_0x27da25)){return _0x4907fb[_0xd11d('0x85')](_0x27da25,{'transaction':_0x2c08fd});}})[_0xd11d('0x2b')](function(){_0x27da25[_0xd11d('0x86')](function(_0x28ad49){socket[_0xd11d('0x71')](_0xd11d('0x87'),{'UserId':_0x28ad49,'FaxQueueId':_0x4907fb['id']});});});});});});})[_0xd11d('0x2b')](respondWithStatusCode(_0xadb4f0,null))[_0xd11d('0x49')](handleError(_0xadb4f0,null));};exports[_0xd11d('0x88')]=function(_0x44decc,_0xac781f,_0x233c48){return db[_0xd11d('0x46')]['find']({'where':{'id':_0x44decc[_0xd11d('0x4a')]['id']}})['then'](handleEntityNotFound(_0xac781f,null))[_0xd11d('0x2b')](function(_0x47fcf0){if(_0x47fcf0){return _0x47fcf0[_0xd11d('0x88')](_0x44decc[_0xd11d('0x4d')][_0xd11d('0x68')],_[_0xd11d('0x89')](_0x44decc[_0xd11d('0x4d')],['ids','id'])||{})[_0xd11d('0x8a')](function(_0x9914bb){for(var _0xc60fec=0x0;_0xc60fec<_0x44decc[_0xd11d('0x4d')][_0xd11d('0x68')][_0xd11d('0x3c')];_0xc60fec+=0x1){socket[_0xd11d('0x71')](_0xd11d('0x8b'),{'UserId':Number(_0x44decc['body'][_0xd11d('0x68')][_0xc60fec]),'FaxQueueId':Number(_0x44decc[_0xd11d('0x4a')]['id'])});}return _0x9914bb;});}})[_0xd11d('0x2b')](respondWithResult(_0xac781f,null))[_0xd11d('0x49')](handleError(_0xac781f,null));};exports[_0xd11d('0x85')]=function(_0x2f63bf,_0x4fa1f7,_0x598da1){return db[_0xd11d('0x46')][_0xd11d('0x51')]({'where':{'id':_0x2f63bf[_0xd11d('0x4a')]['id']}})[_0xd11d('0x2b')](handleEntityNotFound(_0x4fa1f7,null))[_0xd11d('0x2b')](function(_0x174d58){if(_0x174d58){return _0x174d58[_0xd11d('0x85')](_0x2f63bf[_0xd11d('0x37')]['ids'])[_0xd11d('0x2b')](function(){if(_[_0xd11d('0x8c')](_0x2f63bf[_0xd11d('0x37')][_0xd11d('0x68')])){for(var _0x1a293a=0x0;_0x1a293a<_0x2f63bf[_0xd11d('0x37')]['ids'][_0xd11d('0x3c')];_0x1a293a+=0x1){socket[_0xd11d('0x71')](_0xd11d('0x87'),{'UserId':Number(_0x2f63bf['query'][_0xd11d('0x68')][_0x1a293a]),'FaxQueueId':Number(_0x2f63bf[_0xd11d('0x4a')]['id'])});}}else{socket[_0xd11d('0x71')](_0xd11d('0x87'),{'UserId':Number(_0x2f63bf[_0xd11d('0x37')][_0xd11d('0x68')]),'FaxQueueId':Number(_0x2f63bf[_0xd11d('0x4a')]['id'])});}});}})[_0xd11d('0x2b')](respondWithStatusCode(_0x4fa1f7,null))[_0xd11d('0x49')](handleError(_0x4fa1f7,null));};exports[_0xd11d('0x8d')]=function(_0x217258,_0x363243,_0x5d329a){var _0x4b14a8={};var _0x2d4ab4={};var _0x29f3fd;var _0x1120ad;return db[_0xd11d('0x46')][_0xd11d('0x65')]({'where':{'id':_0x217258['params']['id']}})['then'](handleEntityNotFound(_0x363243,null))['then'](function(_0x2c7acb){if(_0x2c7acb){_0x29f3fd=_0x2c7acb;_0x2d4ab4[_0xd11d('0x3a')]=_[_0xd11d('0x57')](db['User'][_0xd11d('0x33')]);_0x2d4ab4[_0xd11d('0x37')]=_[_0xd11d('0x57')](_0x217258[_0xd11d('0x37')]);_0x2d4ab4[_0xd11d('0x41')]=_['intersection'](_0x2d4ab4[_0xd11d('0x3a')],_0x2d4ab4[_0xd11d('0x37')]);_0x4b14a8[_0xd11d('0x39')]=_[_0xd11d('0x38')](_0x2d4ab4['model'],qs[_0xd11d('0x3b')](_0x217258[_0xd11d('0x37')][_0xd11d('0x3b')]));_0x4b14a8[_0xd11d('0x39')]=_0x4b14a8[_0xd11d('0x39')]['length']?_0x4b14a8[_0xd11d('0x39')]:_0x2d4ab4[_0xd11d('0x3a')];_0x4b14a8[_0xd11d('0x58')]=qs[_0xd11d('0x3f')](_0x217258[_0xd11d('0x37')][_0xd11d('0x3f')]);_0x4b14a8['where']=qs[_0xd11d('0x41')](_[_0xd11d('0x42')](_0x217258[_0xd11d('0x37')],_0x2d4ab4['filters']));if(_0x217258[_0xd11d('0x37')]['filter']){_0x4b14a8[_0xd11d('0x40')]=_[_0xd11d('0x44')](_0x4b14a8[_0xd11d('0x40')],{'$or':_[_0xd11d('0x32')](_0x4b14a8['attributes'],function(_0x4eeef2){var _0x2bc15c={};_0x2bc15c[_0x4eeef2]={'$like':'%'+_0x217258[_0xd11d('0x37')][_0xd11d('0x43')]+'%'};return _0x2bc15c;})});}_0x4b14a8=_['merge']({},_0x4b14a8,_0x217258['options']);return _0x29f3fd[_0xd11d('0x8d')](_0x4b14a8);}})[_0xd11d('0x2b')](function(_0x1643b7){if(_0x1643b7){_0x1120ad=_0x1643b7[_0xd11d('0x3c')];if(!_0x217258[_0xd11d('0x37')][_0xd11d('0x3d')]('nolimit')){_0x4b14a8[_0xd11d('0x22')]=qs[_0xd11d('0x22')](_0x217258[_0xd11d('0x37')][_0xd11d('0x22')]);_0x4b14a8[_0xd11d('0x20')]=qs[_0xd11d('0x20')](_0x217258[_0xd11d('0x37')][_0xd11d('0x20')]);}return _0x29f3fd[_0xd11d('0x8d')](_0x4b14a8);}})[_0xd11d('0x2b')](function(_0x39cf96){if(_0x39cf96){return _0x39cf96?{'count':_0x1120ad,'rows':_0x39cf96}:null;}})[_0xd11d('0x2b')](respondWithResult(_0x363243,null))[_0xd11d('0x49')](handleError(_0x363243,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4171cc1..d1bd749 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 _0xec15=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','remove','emit'];(function(_0x2f85aa,_0x318140){var _0x1b4b95=function(_0x369f5e){while(--_0x369f5e){_0x2f85aa['push'](_0x2f85aa['shift']());}};_0x1b4b95(++_0x318140);}(_0xec15,0x158));var _0x5ec1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec15[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5ec1('0x0'));var FaxQueue=require(_0x5ec1('0x1'))['db'][_0x5ec1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5ec1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5ec1('0x4')};function emitEvent(_0xa20583){return function(_0x50824a,_0x437e4a,_0x12a2ef){FaxQueueEvents[_0x5ec1('0x5')](_0xa20583+':'+_0x50824a['id'],_0x50824a);FaxQueueEvents[_0x5ec1('0x5')](_0xa20583,_0x50824a);_0x12a2ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5ec1('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x6d6f=['emit','hook','exports','FaxQueue','setMaxListeners','update'];(function(_0x533a86,_0x49c481){var _0x52b173=function(_0x268e07){while(--_0x268e07){_0x533a86['push'](_0x533a86['shift']());}};_0x52b173(++_0x49c481);}(_0x6d6f,0x1cb));var _0xf6d6=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x6d6f[_0x23be51];return _0x47a26d;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xf6d6('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf6d6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf6d6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x54db59){return function(_0x172b0a,_0x26689e,_0x1e94d7){FaxQueueEvents[_0xf6d6('0x3')](_0x54db59+':'+_0x172b0a['id'],_0x172b0a);FaxQueueEvents[_0xf6d6('0x3')](_0x54db59,_0x172b0a);_0x1e94d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf6d6('0x4')](e,emitEvent(event));}}module[_0xf6d6('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 522c7af..8db62b1 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 _0xdd2c=['rimraf','exports','define','FaxQueue','lodash','../../config/logger','api','bluebird','path'];(function(_0x2f6167,_0x432253){var _0x2e2548=function(_0x1da10){while(--_0x1da10){_0x2f6167['push'](_0x2f6167['shift']());}};_0x2e2548(++_0x432253);}(_0xdd2c,0x17e));var _0xcdd2=function(_0x298b14,_0x4c1749){_0x298b14=_0x298b14-0x0;var _0x1f7d7a=_0xdd2c[_0x298b14];return _0x1f7d7a;};'use strict';var _=require(_0xcdd2('0x0'));var util=require('util');var logger=require(_0xcdd2('0x1'))(_0xcdd2('0x2'));var moment=require('moment');var BPromise=require(_0xcdd2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdd2('0x4'));var rimraf=require(_0xcdd2('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xcdd2('0x6')]=function(_0x2e382c,_0x7938a3){return _0x2e382c[_0xcdd2('0x7')](_0xcdd2('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd885=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd885,0xa8));var _0x5d88=function(_0x1439e4,_0x3eafab){_0x1439e4=_0x1439e4-0x0;var _0x19c384=_0xd885[_0x1439e4];return _0x19c384;};'use strict';var _=require(_0x5d88('0x0'));var util=require('util');var logger=require(_0x5d88('0x1'))(_0x5d88('0x2'));var moment=require(_0x5d88('0x3'));var BPromise=require(_0x5d88('0x4'));var rp=require(_0x5d88('0x5'));var fs=require('fs');var path=require(_0x5d88('0x6'));var rimraf=require(_0x5d88('0x7'));var config=require(_0x5d88('0x8'));var attributes=require(_0x5d88('0x9'));module[_0x5d88('0xa')]=function(_0x1ec21e,_0x81dcfe){return _0x1ec21e[_0x5d88('0xb')]('FaxQueue',attributes,{'tableName':_0x5d88('0xc'),'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 463ca41..6f92c50 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 _0x9808=['FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxQueue','debug','catch','ShowFaxQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x306db6,_0x18a817){var _0x2046eb=function(_0x1ac67a){while(--_0x1ac67a){_0x306db6['push'](_0x306db6['shift']());}};_0x2046eb(++_0x18a817);}(_0x9808,0x1bc));var _0x8980=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x9808[_0x2a7b50];return _0x4224c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8980('0x0'));var BPromise=require(_0x8980('0x1'));var rs=require(_0x8980('0x2'));var fs=require('fs');var Redis=require(_0x8980('0x3'));var db=require(_0x8980('0x4'))['db'];var utils=require(_0x8980('0x5'));var logger=require('../../config/logger')(_0x8980('0x6'));var config=require(_0x8980('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8980('0x8')][_0x8980('0x9')]({'port':0x232a});config[_0x8980('0xa')]=_[_0x8980('0xb')](config[_0x8980('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8980('0xc'))(new Redis(config[_0x8980('0xa')]));require('./faxQueue.socket')[_0x8980('0xd')](socket);function respondWithRpcPromise(_0x4f2040,_0x4697e5,_0x4a6850){return new BPromise(function(_0x37e7e4,_0x39fe53){return client[_0x8980('0xe')](_0x4f2040,_0x4a6850)[_0x8980('0xf')](function(_0x579df2){logger[_0x8980('0x10')](_0x8980('0x11'),_0x4697e5,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4697e5,_0x8980('0x12'),JSON[_0x8980('0x13')](_0x579df2));if(_0x579df2[_0x8980('0x14')]){if(_0x579df2[_0x8980('0x14')][_0x8980('0x15')]===0x1f4){logger['error'](_0x8980('0x11'),_0x4697e5,_0x579df2[_0x8980('0x14')][_0x8980('0x16')]);return _0x39fe53(_0x579df2[_0x8980('0x14')]['message']);}logger[_0x8980('0x14')](_0x8980('0x11'),_0x4697e5,_0x579df2['error'][_0x8980('0x16')]);return _0x37e7e4(_0x579df2[_0x8980('0x14')][_0x8980('0x16')]);}else{logger[_0x8980('0x10')]('FaxQueue,\x20%s,\x20%s',_0x4697e5,'request\x20sent');_0x37e7e4(_0x579df2[_0x8980('0x17')][_0x8980('0x16')]);}})['catch'](function(_0xa0e605){logger[_0x8980('0x14')](_0x8980('0x11'),_0x4697e5,_0xa0e605);_0x39fe53(_0xa0e605);});});}exports['GetFaxQueue']=function(_0x18898b){var _0x1c1df2=this;return new Promise(function(_0x50f417,_0x22e242){return db[_0x8980('0x18')][_0x8980('0x19')]({'raw':_0x18898b[_0x8980('0x1a')]?_0x18898b['options'][_0x8980('0x1b')]===undefined?!![]:![]:!![],'where':_0x18898b[_0x8980('0x1a')]?_0x18898b[_0x8980('0x1a')][_0x8980('0x1c')]||null:null,'attributes':_0x18898b[_0x8980('0x1a')]?_0x18898b['options'][_0x8980('0x1d')]||null:null,'limit':_0x18898b[_0x8980('0x1a')]?_0x18898b[_0x8980('0x1a')][_0x8980('0x1e')]||null:null,'include':_0x18898b['options']?_0x18898b[_0x8980('0x1a')][_0x8980('0x1f')]?_['map'](_0x18898b[_0x8980('0x1a')][_0x8980('0x1f')],function(_0x3b1c72){return{'model':db[_0x3b1c72[_0x8980('0x20')]],'as':_0x3b1c72['as'],'attributes':_0x3b1c72[_0x8980('0x1d')],'include':_0x3b1c72[_0x8980('0x1f')]?_[_0x8980('0x21')](_0x3b1c72[_0x8980('0x1f')],function(_0x377632){return{'model':db[_0x377632[_0x8980('0x20')]],'as':_0x377632['as'],'attributes':_0x377632[_0x8980('0x1d')],'include':_0x377632[_0x8980('0x1f')]?_[_0x8980('0x21')](_0x377632['include'],function(_0x1e93bc){return{'model':db[_0x1e93bc[_0x8980('0x20')]],'as':_0x1e93bc['as'],'attributes':_0x1e93bc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ec9ba){logger[_0x8980('0x10')](_0x8980('0x22'),_0x18898b);logger[_0x8980('0x23')](_0x8980('0x22'),_0x18898b,JSON['stringify'](_0x4ec9ba));_0x50f417(_0x4ec9ba);})[_0x8980('0x24')](function(_0x11138c){logger[_0x8980('0x14')]('GetFaxQueue',_0x11138c[_0x8980('0x16')],_0x18898b);_0x22e242(_0x1c1df2[_0x8980('0x14')](0x1f4,_0x11138c['message']));});});};exports[_0x8980('0x25')]=function(_0x501e9){var _0x2ecd4b=this;return new Promise(function(_0x393779,_0x367e7c){return db['FaxQueue'][_0x8980('0x26')]({'raw':_0x501e9[_0x8980('0x1a')]?_0x501e9[_0x8980('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x501e9[_0x8980('0x1a')]?_0x501e9['options']['where']||null:null,'attributes':_0x501e9[_0x8980('0x1a')]?_0x501e9[_0x8980('0x1a')][_0x8980('0x1d')]||null:null,'include':_0x501e9[_0x8980('0x1a')]?_0x501e9[_0x8980('0x1a')][_0x8980('0x1f')]?_[_0x8980('0x21')](_0x501e9[_0x8980('0x1a')][_0x8980('0x1f')],function(_0x399ad6){return{'model':db[_0x399ad6['model']],'as':_0x399ad6['as'],'attributes':_0x399ad6[_0x8980('0x1d')],'include':_0x399ad6['include']?_[_0x8980('0x21')](_0x399ad6[_0x8980('0x1f')],function(_0x1f1e92){return{'model':db[_0x1f1e92[_0x8980('0x20')]],'as':_0x1f1e92['as'],'attributes':_0x1f1e92['attributes'],'include':_0x1f1e92[_0x8980('0x1f')]?_['map'](_0x1f1e92[_0x8980('0x1f')],function(_0x28617f){return{'model':db[_0x28617f[_0x8980('0x20')]],'as':_0x28617f['as'],'attributes':_0x28617f[_0x8980('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8980('0xf')](function(_0x4b8841){logger[_0x8980('0x10')]('ShowFaxQueue',_0x501e9);logger['debug'](_0x8980('0x25'),_0x501e9,JSON[_0x8980('0x13')](_0x4b8841));_0x393779(_0x4b8841);})[_0x8980('0x24')](function(_0x4d5661){logger['error'](_0x8980('0x25'),_0x4d5661[_0x8980('0x16')],_0x501e9);_0x367e7c(_0x2ecd4b[_0x8980('0x14')](0x1f4,_0x4d5661[_0x8980('0x16')]));});});}; \ No newline at end of file +var _0x20af=['request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowFaxQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x570eab,_0x190c64){var _0x373780=function(_0x50310b){while(--_0x50310b){_0x570eab['push'](_0x570eab['shift']());}};_0x373780(++_0x190c64);}(_0x20af,0x1ee));var _0xf20a=function(_0x31151f,_0xcc0630){_0x31151f=_0x31151f-0x0;var _0x39c430=_0x20af[_0x31151f];return _0x39c430;};'use strict';var _=require(_0xf20a('0x0'));var util=require(_0xf20a('0x1'));var moment=require('moment');var BPromise=require(_0xf20a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf20a('0x3'))['db'];var utils=require(_0xf20a('0x4'));var logger=require(_0xf20a('0x5'))(_0xf20a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf20a('0x7')][_0xf20a('0x8')]({'port':0x232a});config['redis']=_[_0xf20a('0x9')](config[_0xf20a('0xa')],{'host':_0xf20a('0xb'),'port':0x18eb});var socket=require(_0xf20a('0xc'))(new Redis(config[_0xf20a('0xa')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4f25fa,_0xffedc0,_0x5e12cf){return new BPromise(function(_0x266e6f,_0x2e1e8f){return client[_0xf20a('0xd')](_0x4f25fa,_0x5e12cf)[_0xf20a('0xe')](function(_0x21cc95){logger[_0xf20a('0xf')](_0xf20a('0x10'),_0xffedc0,'request\x20sent');logger[_0xf20a('0x11')](_0xf20a('0x12'),_0xffedc0,'request\x20sent',JSON[_0xf20a('0x13')](_0x21cc95));if(_0x21cc95[_0xf20a('0x14')]){if(_0x21cc95[_0xf20a('0x14')][_0xf20a('0x15')]===0x1f4){logger['error'](_0xf20a('0x10'),_0xffedc0,_0x21cc95[_0xf20a('0x14')][_0xf20a('0x16')]);return _0x2e1e8f(_0x21cc95[_0xf20a('0x14')][_0xf20a('0x16')]);}logger[_0xf20a('0x14')](_0xf20a('0x10'),_0xffedc0,_0x21cc95[_0xf20a('0x14')][_0xf20a('0x16')]);return _0x266e6f(_0x21cc95['error'][_0xf20a('0x16')]);}else{logger[_0xf20a('0xf')](_0xf20a('0x10'),_0xffedc0,_0xf20a('0x17'));_0x266e6f(_0x21cc95[_0xf20a('0x18')][_0xf20a('0x16')]);}})[_0xf20a('0x19')](function(_0x4291d3){logger[_0xf20a('0x14')]('FaxQueue,\x20%s,\x20%s',_0xffedc0,_0x4291d3);_0x2e1e8f(_0x4291d3);});});}exports[_0xf20a('0x1a')]=function(_0x36c861){var _0x12e944=this;return new Promise(function(_0x6ab77f,_0x2d1115){return db[_0xf20a('0x1b')][_0xf20a('0x1c')]({'raw':_0x36c861[_0xf20a('0x1d')]?_0x36c861[_0xf20a('0x1d')][_0xf20a('0x1e')]===undefined?!![]:![]:!![],'where':_0x36c861['options']?_0x36c861[_0xf20a('0x1d')][_0xf20a('0x1f')]||null:null,'attributes':_0x36c861[_0xf20a('0x1d')]?_0x36c861[_0xf20a('0x1d')][_0xf20a('0x20')]||null:null,'limit':_0x36c861[_0xf20a('0x1d')]?_0x36c861[_0xf20a('0x1d')][_0xf20a('0x21')]||null:null,'include':_0x36c861[_0xf20a('0x1d')]?_0x36c861[_0xf20a('0x1d')]['include']?_[_0xf20a('0x22')](_0x36c861[_0xf20a('0x1d')][_0xf20a('0x23')],function(_0x1bf3a3){return{'model':db[_0x1bf3a3['model']],'as':_0x1bf3a3['as'],'attributes':_0x1bf3a3[_0xf20a('0x20')],'include':_0x1bf3a3[_0xf20a('0x23')]?_['map'](_0x1bf3a3['include'],function(_0x3b0694){return{'model':db[_0x3b0694['model']],'as':_0x3b0694['as'],'attributes':_0x3b0694[_0xf20a('0x20')],'include':_0x3b0694[_0xf20a('0x23')]?_[_0xf20a('0x22')](_0x3b0694[_0xf20a('0x23')],function(_0x3392ca){return{'model':db[_0x3392ca[_0xf20a('0x24')]],'as':_0x3392ca['as'],'attributes':_0x3392ca[_0xf20a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf20a('0xe')](function(_0x20fbb6){logger[_0xf20a('0xf')](_0xf20a('0x1a'),_0x36c861);logger['debug'](_0xf20a('0x1a'),_0x36c861,JSON[_0xf20a('0x13')](_0x20fbb6));_0x6ab77f(_0x20fbb6);})[_0xf20a('0x19')](function(_0x2b0af6){logger[_0xf20a('0x14')](_0xf20a('0x1a'),_0x2b0af6['message'],_0x36c861);_0x2d1115(_0x12e944[_0xf20a('0x14')](0x1f4,_0x2b0af6[_0xf20a('0x16')]));});});};exports['ShowFaxQueue']=function(_0x158696){var _0x38e04b=this;return new Promise(function(_0x5a61a0,_0x44aacc){return db['FaxQueue'][_0xf20a('0x25')]({'raw':_0x158696[_0xf20a('0x1d')]?_0x158696[_0xf20a('0x1d')][_0xf20a('0x1e')]===undefined?!![]:![]:!![],'where':_0x158696[_0xf20a('0x1d')]?_0x158696['options'][_0xf20a('0x1f')]||null:null,'attributes':_0x158696['options']?_0x158696['options']['attributes']||null:null,'include':_0x158696['options']?_0x158696[_0xf20a('0x1d')][_0xf20a('0x23')]?_['map'](_0x158696[_0xf20a('0x1d')][_0xf20a('0x23')],function(_0x2b53eb){return{'model':db[_0x2b53eb['model']],'as':_0x2b53eb['as'],'attributes':_0x2b53eb[_0xf20a('0x20')],'include':_0x2b53eb[_0xf20a('0x23')]?_['map'](_0x2b53eb[_0xf20a('0x23')],function(_0x5a6b8a){return{'model':db[_0x5a6b8a[_0xf20a('0x24')]],'as':_0x5a6b8a['as'],'attributes':_0x5a6b8a[_0xf20a('0x20')],'include':_0x5a6b8a[_0xf20a('0x23')]?_[_0xf20a('0x22')](_0x5a6b8a[_0xf20a('0x23')],function(_0x184c12){return{'model':db[_0x184c12['model']],'as':_0x184c12['as'],'attributes':_0x184c12[_0xf20a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf20a('0xe')](function(_0x3cfa92){logger[_0xf20a('0xf')](_0xf20a('0x26'),_0x158696);logger['debug'](_0xf20a('0x26'),_0x158696,JSON['stringify'](_0x3cfa92));_0x5a61a0(_0x3cfa92);})['catch'](function(_0x1a13a0){logger[_0xf20a('0x14')]('ShowFaxQueue',_0x1a13a0[_0xf20a('0x16')],_0x158696);_0x44aacc(_0x38e04b[_0xf20a('0x14')](0x1f4,_0x1a13a0[_0xf20a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 13b2fe6..043c847 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 _0x9f72=['removeListener','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x22000f,_0x4c17fa){var _0x5144fe=function(_0xe94101){while(--_0xe94101){_0x22000f['push'](_0x22000f['shift']());}};_0x5144fe(++_0x4c17fa);}(_0x9f72,0x114));var _0x29f7=function(_0xe0ff52,_0x26b714){_0xe0ff52=_0xe0ff52-0x0;var _0x3a864f=_0x9f72[_0xe0ff52];return _0x3a864f;};'use strict';var FaxQueueEvents=require(_0x29f7('0x0'));var events=[_0x29f7('0x1'),_0x29f7('0x2'),_0x29f7('0x3')];function createListener(_0x3233f1,_0x34812b){return function(_0x49bc04){_0x34812b['emit'](_0x3233f1,_0x49bc04);};}function removeListener(_0x141b78,_0x3bd2aa){return function(){FaxQueueEvents[_0x29f7('0x4')](_0x141b78,_0x3bd2aa);};}exports['register']=function(_0x4ae5e0){for(var _0x4c0537=0x0,_0x41399d=events[_0x29f7('0x5')];_0x4c0537<_0x41399d;_0x4c0537++){var _0xc52148=events[_0x4c0537];var _0x44e83e=createListener(_0x29f7('0x6')+_0xc52148,_0x4ae5e0);FaxQueueEvents['on'](_0xc52148,_0x44e83e);}}; \ No newline at end of file +var _0x256d=['remove','update','emit','register','./faxQueue.events','save'];(function(_0x1274c1,_0x15de12){var _0x47f51d=function(_0x4213bf){while(--_0x4213bf){_0x1274c1['push'](_0x1274c1['shift']());}};_0x47f51d(++_0x15de12);}(_0x256d,0x70));var _0xd256=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x256d[_0x8ba19a];return _0x2bd8b4;};'use strict';var FaxQueueEvents=require(_0xd256('0x0'));var events=[_0xd256('0x1'),_0xd256('0x2'),_0xd256('0x3')];function createListener(_0x503103,_0x3499f0){return function(_0x45d6aa){_0x3499f0[_0xd256('0x4')](_0x503103,_0x45d6aa);};}function removeListener(_0x1262f4,_0x1b3321){return function(){FaxQueueEvents['removeListener'](_0x1262f4,_0x1b3321);};}exports[_0xd256('0x5')]=function(_0x1137b3){for(var _0x23faf4=0x0,_0x28dca5=events['length'];_0x23faf4<_0x28dca5;_0x23faf4++){var _0x51c150=events[_0x23faf4];var _0x11c053=createListener('faxQueue:'+_0x51c150,_0x1137b3);FaxQueueEvents['on'](_0x51c150,_0x11c053);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fc15064..19c67f4 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 _0xc2c7=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0xc2c7,0x134));var _0x7c2c=function(_0x16b246,_0x36119f){_0x16b246=_0x16b246-0x0;var _0xc81ac0=_0xc2c7[_0x16b246];return _0xc81ac0;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x14')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7c2c('0x14')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['addAgents']);router[_0x7c2c('0x16')](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['delete'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x19')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1a')]);router[_0x7c2c('0x19')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1b')]);module[_0x7c2c('0x1c')]=router; \ No newline at end of file +var _0x07e8=['post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','fs-extra','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x07e8,0x10f));var _0x807e=function(_0x3fa472,_0x289495){_0x3fa472=_0x3fa472-0x0;var _0xf18ea1=_0x07e8[_0x3fa472];return _0xf18ea1;};'use strict';var multer=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var path=require(_0x807e('0x2'));var timeout=require('connect-timeout');var express=require(_0x807e('0x3'));var router=express['Router']();var fs_extra=require(_0x807e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x807e('0x5'));var controller=require(_0x807e('0x6'));router[_0x807e('0x7')]('/',auth['isAuthenticated'](),controller[_0x807e('0x8')]);router[_0x807e('0x7')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0xb')]);router['get'](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0xd')]);router[_0x807e('0x7')](_0x807e('0xe'),auth[_0x807e('0xa')](),controller[_0x807e('0xf')]);router[_0x807e('0x7')](_0x807e('0x10'),auth[_0x807e('0xa')](),controller[_0x807e('0x11')]);router[_0x807e('0x7')](_0x807e('0x12'),auth[_0x807e('0xa')](),controller['getAgents']);router[_0x807e('0x13')]('/',auth[_0x807e('0xa')](),controller[_0x807e('0x14')]);router[_0x807e('0x13')](_0x807e('0x10'),auth[_0x807e('0xa')](),controller[_0x807e('0x15')]);router['post']('/:id/users',auth[_0x807e('0xa')](),controller[_0x807e('0x16')]);router[_0x807e('0x17')](_0x807e('0xc'),auth['isAuthenticated'](),controller[_0x807e('0x18')]);router[_0x807e('0x19')](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0x1a')]);router[_0x807e('0x19')]('/:id/teams',auth[_0x807e('0xa')](),controller['removeTeams']);router[_0x807e('0x19')](_0x807e('0x12'),auth[_0x807e('0xa')](),controller[_0x807e('0x1b')]);module[_0x807e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 59b01dd..6d21ddb 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 _0x35b5=['moment','exports','STRING','DATE'];(function(_0x4409db,_0x230498){var _0x2b3a7d=function(_0x4a6fcb){while(--_0x4a6fcb){_0x4409db['push'](_0x4409db['shift']());}};_0x2b3a7d(++_0x230498);}(_0x35b5,0x1c4));var _0x535b=function(_0x24ece3,_0xb9402d){_0x24ece3=_0x24ece3-0x0;var _0x453542=_0x35b5[_0x24ece3];return _0x453542;};'use strict';var moment=require(_0x535b('0x0'));var Sequelize=require('sequelize');module[_0x535b('0x1')]={'uniqueid':{'type':Sequelize[_0x535b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x535b('0x2')]},'joinAt':{'type':Sequelize[_0x535b('0x3')]},'leaveAt':{'type':Sequelize[_0x535b('0x3')]},'acceptAt':{'type':Sequelize[_0x535b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x535b('0x2')]}}; \ No newline at end of file +var _0x222a=['moment','exports','STRING','DATE'];(function(_0x506380,_0x4cc05e){var _0x2d7d52=function(_0x5a7c5f){while(--_0x5a7c5f){_0x506380['push'](_0x506380['shift']());}};_0x2d7d52(++_0x4cc05e);}(_0x222a,0x1ec));var _0xa222=function(_0x14a645,_0x783bf8){_0x14a645=_0x14a645-0x0;var _0x2d4c9b=_0x222a[_0x14a645];return _0x2d4c9b;};'use strict';var moment=require(_0xa222('0x0'));var Sequelize=require('sequelize');module[_0xa222('0x1')]={'uniqueid':{'type':Sequelize[_0xa222('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa222('0x2')]},'joinAt':{'type':Sequelize[_0xa222('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa222('0x3')]},'exitAt':{'type':Sequelize[_0xa222('0x3')]},'reason':{'type':Sequelize[_0xa222('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 178db27..e5914c3 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 _0xf109=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','FaxQueueReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0xf109,0xce));var _0x9f10=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xf109[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x9f10('0x0'));var rimraf=require(_0x9f10('0x1'));var zipdir=require(_0x9f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f10('0x3'));var Mustache=require(_0x9f10('0x4'));var util=require(_0x9f10('0x5'));var path=require(_0x9f10('0x6'));var sox=require(_0x9f10('0x7'));var csv=require(_0x9f10('0x8'));var ejs=require(_0x9f10('0x9'));var fs=require('fs');var fs_extra=require(_0x9f10('0xa'));var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x8'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289164,_0x260606){_0x260606=_0x260606||0xcc;return function(_0x35c529){if(_0x35c529){return _0x289164['sendStatus'](_0x260606);}return _0x289164[_0x9f10('0x18')](_0x260606)[_0x9f10('0x19')]();};}function respondWithResult(_0x5be443,_0x40a48a){_0x40a48a=_0x40a48a||0xc8;return function(_0x236e28){if(_0x236e28){return _0x5be443['status'](_0x40a48a)['json'](_0x236e28);}};}function respondWithFilteredResult(_0x2b6c4c,_0x177918){return function(_0x549217){if(_0x549217){var _0x11154b=typeof _0x177918['offset']===_0x9f10('0x1a')&&typeof _0x177918[_0x9f10('0x1b')]==='undefined';var _0x11cc56=_0x549217[_0x9f10('0x1c')];var _0x509fba=_0x11154b?0x0:_0x177918[_0x9f10('0x1d')];var _0x53bfbd=_0x11154b?_0x549217[_0x9f10('0x1c')]:_0x177918['offset']+_0x177918[_0x9f10('0x1b')];var _0x56fb44;if(_0x53bfbd>=_0x11cc56){_0x53bfbd=_0x11cc56;_0x56fb44=0xc8;}else{_0x56fb44=0xce;}_0x2b6c4c['status'](_0x56fb44);return _0x2b6c4c[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x509fba+'-'+_0x53bfbd+'/'+_0x11cc56)[_0x9f10('0x20')](_0x549217);}return null;};}function patchUpdates(_0x3a78be){return function(_0xa810c){try{jsonpatch[_0x9f10('0x21')](_0xa810c,_0x3a78be,!![]);}catch(_0x27843d){return BPromise['reject'](_0x27843d);}return _0xa810c[_0x9f10('0x22')]();};}function saveUpdates(_0x58e6ba,_0x293990){return function(_0x36ace4){if(_0x36ace4){return _0x36ace4[_0x9f10('0x23')](_0x58e6ba)['then'](function(_0x2f31fb){return _0x2f31fb;});}return null;};}function removeEntity(_0x3dde2e,_0x213567){return function(_0x4d21c5){if(_0x4d21c5){return _0x4d21c5[_0x9f10('0x24')]()[_0x9f10('0x25')](function(){_0x3dde2e[_0x9f10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec07d,_0x23c2e7){return function(_0x11cae7){if(!_0x11cae7){_0x2ec07d[_0x9f10('0x26')](0x194);}return _0x11cae7;};}function handleError(_0x5e80de,_0x57539b){_0x57539b=_0x57539b||0x1f4;return function(_0x5c1800){logger[_0x9f10('0x27')](_0x5c1800['stack']);if(_0x5c1800[_0x9f10('0x28')]){delete _0x5c1800[_0x9f10('0x28')];}_0x5e80de[_0x9f10('0x18')](_0x57539b)[_0x9f10('0x29')](_0x5c1800);};}exports[_0x9f10('0x2a')]=function(_0x4f6b0c,_0x522805){var _0x22814f={},_0x40f96b={},_0xfbb37f={'count':0x0,'rows':[]};var _0x181aec=_[_0x9f10('0x2b')](db['FaxQueueReport'][_0x9f10('0x2c')],function(_0x501ee){return{'name':_0x501ee[_0x9f10('0x2d')],'type':_0x501ee[_0x9f10('0x2e')]['key']};});_0x40f96b[_0x9f10('0x2f')]=_[_0x9f10('0x2b')](_0x181aec,_0x9f10('0x28'));_0x40f96b['query']=_[_0x9f10('0x30')](_0x4f6b0c['query']);_0x40f96b[_0x9f10('0x31')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],_0x40f96b['query']);_0x22814f[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],qs[_0x9f10('0x34')](_0x4f6b0c[_0x9f10('0x35')]['fields']));_0x22814f[_0x9f10('0x33')]=_0x22814f['attributes'][_0x9f10('0x36')]?_0x22814f[_0x9f10('0x33')]:_0x40f96b[_0x9f10('0x2f')];if(!_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x37')](_0x9f10('0x38'))){_0x22814f['limit']=qs[_0x9f10('0x1b')](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x1b')]);_0x22814f['offset']=qs[_0x9f10('0x1d')](_0x4f6b0c[_0x9f10('0x35')]['offset']);}_0x22814f[_0x9f10('0x39')]=qs['sort'](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x3a')]);_0x22814f[_0x9f10('0x3b')]=qs[_0x9f10('0x31')](_[_0x9f10('0x3c')](_0x4f6b0c[_0x9f10('0x35')],_0x40f96b[_0x9f10('0x31')]),_0x181aec);if(_0x4f6b0c[_0x9f10('0x35')]['filter']){_0x22814f[_0x9f10('0x3b')]=_[_0x9f10('0x3d')](_0x22814f[_0x9f10('0x3b')],{'$or':_['map'](_0x181aec,function(_0x233bab){if(_0x233bab[_0x9f10('0x2e')]!=='VIRTUAL'){var _0x30b04b={};_0x30b04b[_0x233bab[_0x9f10('0x28')]]={'$like':'%'+_0x4f6b0c[_0x9f10('0x35')]['filter']+'%'};return _0x30b04b;}})});}_0x22814f=_['merge']({},_0x22814f,_0x4f6b0c[_0x9f10('0x3e')]);var _0x2ff98d={'where':_0x22814f[_0x9f10('0x3b')]};return db[_0x9f10('0x3f')][_0x9f10('0x1c')](_0x2ff98d)[_0x9f10('0x25')](function(_0x15929f){_0xfbb37f[_0x9f10('0x1c')]=_0x15929f;if(_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x40')]){_0x22814f[_0x9f10('0x41')]=[{'all':!![]}];}return db[_0x9f10('0x3f')]['findAll'](_0x22814f);})['then'](function(_0x4bb805){_0xfbb37f[_0x9f10('0x42')]=_0x4bb805;return _0xfbb37f;})['then'](respondWithFilteredResult(_0x522805,_0x22814f))[_0x9f10('0x43')](handleError(_0x522805,null));};exports[_0x9f10('0x44')]=function(_0x426d30,_0x47d25c){var _0x3cfce6={'raw':!![],'where':{'id':_0x426d30[_0x9f10('0x45')]['id']}},_0xf1164={};_0xf1164[_0x9f10('0x2f')]=_[_0x9f10('0x30')](db['FaxQueueReport']['rawAttributes']);_0xf1164['query']=_[_0x9f10('0x30')](_0x426d30['query']);_0xf1164[_0x9f10('0x31')]=_['intersection'](_0xf1164[_0x9f10('0x2f')],_0xf1164[_0x9f10('0x35')]);_0x3cfce6[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0xf1164['model'],qs[_0x9f10('0x34')](_0x426d30[_0x9f10('0x35')]['fields']));_0x3cfce6[_0x9f10('0x33')]=_0x3cfce6[_0x9f10('0x33')][_0x9f10('0x36')]?_0x3cfce6[_0x9f10('0x33')]:_0xf1164[_0x9f10('0x2f')];if(_0x426d30[_0x9f10('0x35')][_0x9f10('0x40')]){_0x3cfce6[_0x9f10('0x41')]=[{'all':!![]}];}_0x3cfce6=_[_0x9f10('0x3d')]({},_0x3cfce6,_0x426d30[_0x9f10('0x3e')]);return db['FaxQueueReport'][_0x9f10('0x46')](_0x3cfce6)[_0x9f10('0x25')](handleEntityNotFound(_0x47d25c,null))['then'](respondWithResult(_0x47d25c,null))[_0x9f10('0x43')](handleError(_0x47d25c,null));};exports[_0x9f10('0x47')]=function(_0x1cf3eb,_0x1807b3){return db['FaxQueueReport'][_0x9f10('0x47')](_0x1cf3eb[_0x9f10('0x48')],{})[_0x9f10('0x25')](respondWithResult(_0x1807b3,0xc9))[_0x9f10('0x43')](handleError(_0x1807b3,null));};exports[_0x9f10('0x23')]=function(_0x43cb31,_0x479b46){if(_0x43cb31[_0x9f10('0x48')]['id']){delete _0x43cb31[_0x9f10('0x48')]['id'];}return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x43cb31[_0x9f10('0x45')]['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x479b46,null))['then'](saveUpdates(_0x43cb31[_0x9f10('0x48')],null))[_0x9f10('0x25')](respondWithResult(_0x479b46,null))[_0x9f10('0x43')](handleError(_0x479b46,null));};exports[_0x9f10('0x24')]=function(_0x39dae3,_0x15d676){return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x39dae3['params']['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x15d676,null))['then'](removeEntity(_0x15d676,null))[_0x9f10('0x43')](handleError(_0x15d676,null));};exports['describe']=function(_0x2c9eb3,_0x2d06b2){return db[_0x9f10('0x3f')][_0x9f10('0x49')]()[_0x9f10('0x25')](respondWithResult(_0x2d06b2,null))['catch'](handleError(_0x2d06b2,null));}; \ No newline at end of file +var _0xc737=['apply','reject','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','offset','limit','Content-Range'];(function(_0xb02d52,_0x3107aa){var _0x37ce22=function(_0x3bfa81){while(--_0x3bfa81){_0xb02d52['push'](_0xb02d52['shift']());}};_0x37ce22(++_0x3107aa);}(_0xc737,0x154));var _0x7c73=function(_0x1b1a41,_0x37fdba){_0x1b1a41=_0x1b1a41-0x0;var _0x2ef3b7=_0xc737[_0x1b1a41];return _0x2ef3b7;};'use strict';var emlformat=require(_0x7c73('0x0'));var rimraf=require(_0x7c73('0x1'));var zipdir=require(_0x7c73('0x2'));var jsonpatch=require(_0x7c73('0x3'));var rp=require('request-promise');var moment=require(_0x7c73('0x4'));var BPromise=require(_0x7c73('0x5'));var Mustache=require(_0x7c73('0x6'));var util=require('util');var path=require(_0x7c73('0x7'));var sox=require(_0x7c73('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c73('0x9'));var _=require(_0x7c73('0xa'));var squel=require('squel');var crypto=require(_0x7c73('0xb'));var jsforce=require(_0x7c73('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c73('0xd'));var Papa=require(_0x7c73('0xe'));var Redis=require(_0x7c73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c73('0x10'));var as=require(_0x7c73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c73('0x12'))('api');var utils=require(_0x7c73('0x13'));var config=require(_0x7c73('0x14'));var licenseUtil=require(_0x7c73('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa28cb5,_0x301cae){_0x301cae=_0x301cae||0xcc;return function(_0x446320){if(_0x446320){return _0xa28cb5[_0x7c73('0x16')](_0x301cae);}return _0xa28cb5['status'](_0x301cae)[_0x7c73('0x17')]();};}function respondWithResult(_0x5207f0,_0x41864b){_0x41864b=_0x41864b||0xc8;return function(_0x3afd48){if(_0x3afd48){return _0x5207f0[_0x7c73('0x18')](_0x41864b)[_0x7c73('0x19')](_0x3afd48);}};}function respondWithFilteredResult(_0x346514,_0x8d1a6b){return function(_0x2ca472){if(_0x2ca472){var _0x15be28=typeof _0x8d1a6b['offset']===_0x7c73('0x1a')&&typeof _0x8d1a6b['limit']===_0x7c73('0x1a');var _0x768ba9=_0x2ca472['count'];var _0x534a39=_0x15be28?0x0:_0x8d1a6b[_0x7c73('0x1b')];var _0x4a2ebc=_0x15be28?_0x2ca472['count']:_0x8d1a6b[_0x7c73('0x1b')]+_0x8d1a6b[_0x7c73('0x1c')];var _0x15f094;if(_0x4a2ebc>=_0x768ba9){_0x4a2ebc=_0x768ba9;_0x15f094=0xc8;}else{_0x15f094=0xce;}_0x346514[_0x7c73('0x18')](_0x15f094);return _0x346514['set'](_0x7c73('0x1d'),_0x534a39+'-'+_0x4a2ebc+'/'+_0x768ba9)[_0x7c73('0x19')](_0x2ca472);}return null;};}function patchUpdates(_0x2d7e82){return function(_0x2d04dd){try{jsonpatch[_0x7c73('0x1e')](_0x2d04dd,_0x2d7e82,!![]);}catch(_0x4e840d){return BPromise[_0x7c73('0x1f')](_0x4e840d);}return _0x2d04dd[_0x7c73('0x20')]();};}function saveUpdates(_0x42867c,_0x1745d9){return function(_0x3b752c){if(_0x3b752c){return _0x3b752c[_0x7c73('0x21')](_0x42867c)[_0x7c73('0x22')](function(_0x6d5714){return _0x6d5714;});}return null;};}function removeEntity(_0x12650f,_0x4c8933){return function(_0x427b12){if(_0x427b12){return _0x427b12['destroy']()[_0x7c73('0x22')](function(){_0x12650f['status'](0xcc)[_0x7c73('0x17')]();});}};}function handleEntityNotFound(_0x57dd84,_0x1abfc5){return function(_0x5c8f9d){if(!_0x5c8f9d){_0x57dd84[_0x7c73('0x16')](0x194);}return _0x5c8f9d;};}function handleError(_0x21a4a3,_0xb758d3){_0xb758d3=_0xb758d3||0x1f4;return function(_0x5b8bc9){logger[_0x7c73('0x23')](_0x5b8bc9[_0x7c73('0x24')]);if(_0x5b8bc9[_0x7c73('0x25')]){delete _0x5b8bc9['name'];}_0x21a4a3[_0x7c73('0x18')](_0xb758d3)[_0x7c73('0x26')](_0x5b8bc9);};}exports[_0x7c73('0x27')]=function(_0x3c9a44,_0x270d3d){var _0x23af7e={},_0x5800eb={},_0x5909ec={'count':0x0,'rows':[]};var _0x485f0a=_[_0x7c73('0x28')](db[_0x7c73('0x29')][_0x7c73('0x2a')],function(_0x49b1ad){return{'name':_0x49b1ad['fieldName'],'type':_0x49b1ad[_0x7c73('0x2b')][_0x7c73('0x2c')]};});_0x5800eb[_0x7c73('0x2d')]=_[_0x7c73('0x28')](_0x485f0a,_0x7c73('0x25'));_0x5800eb[_0x7c73('0x2e')]=_[_0x7c73('0x2f')](_0x3c9a44[_0x7c73('0x2e')]);_0x5800eb[_0x7c73('0x30')]=_[_0x7c73('0x31')](_0x5800eb['model'],_0x5800eb['query']);_0x23af7e[_0x7c73('0x32')]=_[_0x7c73('0x31')](_0x5800eb[_0x7c73('0x2d')],qs['fields'](_0x3c9a44[_0x7c73('0x2e')][_0x7c73('0x33')]));_0x23af7e[_0x7c73('0x32')]=_0x23af7e[_0x7c73('0x32')][_0x7c73('0x34')]?_0x23af7e[_0x7c73('0x32')]:_0x5800eb[_0x7c73('0x2d')];if(!_0x3c9a44[_0x7c73('0x2e')]['hasOwnProperty'](_0x7c73('0x35'))){_0x23af7e[_0x7c73('0x1c')]=qs[_0x7c73('0x1c')](_0x3c9a44[_0x7c73('0x2e')][_0x7c73('0x1c')]);_0x23af7e[_0x7c73('0x1b')]=qs[_0x7c73('0x1b')](_0x3c9a44[_0x7c73('0x2e')][_0x7c73('0x1b')]);}_0x23af7e[_0x7c73('0x36')]=qs[_0x7c73('0x37')](_0x3c9a44[_0x7c73('0x2e')][_0x7c73('0x37')]);_0x23af7e[_0x7c73('0x38')]=qs[_0x7c73('0x30')](_[_0x7c73('0x39')](_0x3c9a44['query'],_0x5800eb[_0x7c73('0x30')]),_0x485f0a);if(_0x3c9a44[_0x7c73('0x2e')]['filter']){_0x23af7e[_0x7c73('0x38')]=_[_0x7c73('0x3a')](_0x23af7e['where'],{'$or':_[_0x7c73('0x28')](_0x485f0a,function(_0x5b96dd){if(_0x5b96dd[_0x7c73('0x2b')]!==_0x7c73('0x3b')){var _0xde1390={};_0xde1390[_0x5b96dd[_0x7c73('0x25')]]={'$like':'%'+_0x3c9a44[_0x7c73('0x2e')][_0x7c73('0x3c')]+'%'};return _0xde1390;}})});}_0x23af7e=_[_0x7c73('0x3a')]({},_0x23af7e,_0x3c9a44[_0x7c73('0x3d')]);var _0x419a8a={'where':_0x23af7e['where']};return db[_0x7c73('0x29')][_0x7c73('0x3e')](_0x419a8a)[_0x7c73('0x22')](function(_0xc3bc03){_0x5909ec[_0x7c73('0x3e')]=_0xc3bc03;if(_0x3c9a44['query']['includeAll']){_0x23af7e[_0x7c73('0x3f')]=[{'all':!![]}];}return db[_0x7c73('0x29')][_0x7c73('0x40')](_0x23af7e);})[_0x7c73('0x22')](function(_0x248a58){_0x5909ec[_0x7c73('0x41')]=_0x248a58;return _0x5909ec;})[_0x7c73('0x22')](respondWithFilteredResult(_0x270d3d,_0x23af7e))[_0x7c73('0x42')](handleError(_0x270d3d,null));};exports['show']=function(_0x36ad41,_0x4212f8){var _0x36b18e={'raw':!![],'where':{'id':_0x36ad41[_0x7c73('0x43')]['id']}},_0x43b35e={};_0x43b35e[_0x7c73('0x2d')]=_['keys'](db[_0x7c73('0x29')][_0x7c73('0x2a')]);_0x43b35e[_0x7c73('0x2e')]=_[_0x7c73('0x2f')](_0x36ad41['query']);_0x43b35e['filters']=_['intersection'](_0x43b35e[_0x7c73('0x2d')],_0x43b35e[_0x7c73('0x2e')]);_0x36b18e[_0x7c73('0x32')]=_[_0x7c73('0x31')](_0x43b35e['model'],qs[_0x7c73('0x33')](_0x36ad41[_0x7c73('0x2e')][_0x7c73('0x33')]));_0x36b18e[_0x7c73('0x32')]=_0x36b18e[_0x7c73('0x32')][_0x7c73('0x34')]?_0x36b18e[_0x7c73('0x32')]:_0x43b35e[_0x7c73('0x2d')];if(_0x36ad41['query'][_0x7c73('0x44')]){_0x36b18e['include']=[{'all':!![]}];}_0x36b18e=_['merge']({},_0x36b18e,_0x36ad41[_0x7c73('0x3d')]);return db[_0x7c73('0x29')][_0x7c73('0x45')](_0x36b18e)[_0x7c73('0x22')](handleEntityNotFound(_0x4212f8,null))['then'](respondWithResult(_0x4212f8,null))[_0x7c73('0x42')](handleError(_0x4212f8,null));};exports['create']=function(_0xcb9bd0,_0x51425d){return db['FaxQueueReport'][_0x7c73('0x46')](_0xcb9bd0[_0x7c73('0x47')],{})[_0x7c73('0x22')](respondWithResult(_0x51425d,0xc9))[_0x7c73('0x42')](handleError(_0x51425d,null));};exports['update']=function(_0x291c15,_0x2866bb){if(_0x291c15['body']['id']){delete _0x291c15[_0x7c73('0x47')]['id'];}return db['FaxQueueReport'][_0x7c73('0x45')]({'where':{'id':_0x291c15['params']['id']}})['then'](handleEntityNotFound(_0x2866bb,null))[_0x7c73('0x22')](saveUpdates(_0x291c15['body'],null))['then'](respondWithResult(_0x2866bb,null))[_0x7c73('0x42')](handleError(_0x2866bb,null));};exports[_0x7c73('0x48')]=function(_0x400077,_0x488308){return db['FaxQueueReport'][_0x7c73('0x45')]({'where':{'id':_0x400077[_0x7c73('0x43')]['id']}})[_0x7c73('0x22')](handleEntityNotFound(_0x488308,null))[_0x7c73('0x22')](removeEntity(_0x488308,null))[_0x7c73('0x42')](handleError(_0x488308,null));};exports['describe']=function(_0x4b85b3,_0x12d83f){return db[_0x7c73('0x29')][_0x7c73('0x49')]()[_0x7c73('0x22')](respondWithResult(_0x12d83f,null))[_0x7c73('0x42')](handleError(_0x12d83f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 8b17219..42bdb53 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x234fc1,_0x3ba1bf){var _0x4eba54=function(_0x50accb){while(--_0x50accb){_0x234fc1['push'](_0x234fc1['shift']());}};_0x4eba54(++_0x3ba1bf);}(_0xe14b,0x93));var _0xbe14=function(_0x45a825,_0x6df36b){_0x45a825=_0x45a825-0x0;var _0x30a8a8=_0xe14b[_0x45a825];return _0x30a8a8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0xe3edfe,_0x3569c5){var _0x2e53a3=function(_0x58197b){while(--_0x58197b){_0xe3edfe['push'](_0xe3edfe['shift']());}};_0x2e53a3(++_0x3569c5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d453c25..84552df 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 _0xfbea=['CreateFaxQueueReport','FaxQueueReport','create','body','options','then','debug','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x2fd70d,_0x304a6d){var _0x19d2e2=function(_0x4934ea){while(--_0x4934ea){_0x2fd70d['push'](_0x2fd70d['shift']());}};_0x19d2e2(++_0x304a6d);}(_0xfbea,0x1ec));var _0xafbe=function(_0xed47d7,_0x18ce1b){_0xed47d7=_0xed47d7-0x0;var _0x140d37=_0xfbea[_0xed47d7];return _0x140d37;};'use strict';var _=require(_0xafbe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xafbe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafbe('0x2'));var logger=require(_0xafbe('0x3'))(_0xafbe('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xafbe('0x5')][_0xafbe('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1133d2,_0x2f7741,_0x3d0dcd){return new BPromise(function(_0x4105ce,_0x5ce37f){return client[_0xafbe('0x7')](_0x1133d2,_0x3d0dcd)['then'](function(_0x66c58e){logger[_0xafbe('0x8')](_0xafbe('0x9'),_0x2f7741,_0xafbe('0xa'));logger['debug'](_0xafbe('0xb'),_0x2f7741,_0xafbe('0xa'),JSON[_0xafbe('0xc')](_0x66c58e));if(_0x66c58e['error']){if(_0x66c58e['error'][_0xafbe('0xd')]===0x1f4){logger[_0xafbe('0xe')](_0xafbe('0x9'),_0x2f7741,_0x66c58e[_0xafbe('0xe')][_0xafbe('0xf')]);return _0x5ce37f(_0x66c58e[_0xafbe('0xe')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2f7741,_0x66c58e[_0xafbe('0xe')][_0xafbe('0xf')]);return _0x4105ce(_0x66c58e[_0xafbe('0xe')][_0xafbe('0xf')]);}else{logger[_0xafbe('0x8')](_0xafbe('0x9'),_0x2f7741,_0xafbe('0xa'));_0x4105ce(_0x66c58e[_0xafbe('0x10')][_0xafbe('0xf')]);}})[_0xafbe('0x11')](function(_0x166f68){logger[_0xafbe('0xe')](_0xafbe('0x9'),_0x2f7741,_0x166f68);_0x5ce37f(_0x166f68);});});}exports[_0xafbe('0x12')]=function(_0x27cb72){var _0x4d8eee=this;return new Promise(function(_0x5f2cdb,_0x48208d){return db[_0xafbe('0x13')][_0xafbe('0x14')](_0x27cb72[_0xafbe('0x15')],{'raw':_0x27cb72['options']?_0x27cb72[_0xafbe('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xafbe('0x17')](function(_0x17294c){logger['info']('CreateFaxQueueReport',_0x27cb72);logger[_0xafbe('0x18')]('CreateFaxQueueReport',_0x27cb72,JSON[_0xafbe('0xc')](_0x17294c));_0x5f2cdb(_0x17294c);})[_0xafbe('0x11')](function(_0x12876b){logger[_0xafbe('0xe')]('CreateFaxQueueReport',_0x12876b[_0xafbe('0xf')],_0x27cb72);_0x48208d(_0x4d8eee['error'](0x1f4,_0x12876b['message']));});});};exports['UpdateFaxQueueReport']=function(_0xcab1d5){var _0x5c9f5c=this;return new Promise(function(_0x584344,_0x2c99f1){return db[_0xafbe('0x13')]['update'](_0xcab1d5[_0xafbe('0x15')],{'raw':_0xcab1d5['options']?_0xcab1d5['options'][_0xafbe('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcab1d5[_0xafbe('0x16')]?_0xcab1d5[_0xafbe('0x16')][_0xafbe('0x1a')]||null:null,'attributes':_0xcab1d5[_0xafbe('0x16')]?_0xcab1d5['options'][_0xafbe('0x1b')]||null:null,'limit':_0xcab1d5[_0xafbe('0x16')]?_0xcab1d5['options'][_0xafbe('0x1c')]||null:null})[_0xafbe('0x17')](function(_0x400753){logger[_0xafbe('0x8')](_0xafbe('0x1d'),_0xcab1d5);logger[_0xafbe('0x18')](_0xafbe('0x1d'),_0xcab1d5,JSON[_0xafbe('0xc')](_0x400753));_0x584344(_0x400753);})[_0xafbe('0x11')](function(_0x48d917){logger['error'](_0xafbe('0x1d'),_0x48d917['message'],_0xcab1d5);_0x2c99f1(_0x5c9f5c['error'](0x1f4,_0x48d917[_0xafbe('0xf')]));});});}; \ No newline at end of file +var _0x5661=['error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','debug','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x5661,0x1ae));var _0x1566=function(_0x38dbb5,_0x427be1){_0x38dbb5=_0x38dbb5-0x0;var _0x34bd46=_0x5661[_0x38dbb5];return _0x34bd46;};'use strict';var _=require(_0x1566('0x0'));var util=require(_0x1566('0x1'));var moment=require(_0x1566('0x2'));var BPromise=require('bluebird');var rs=require(_0x1566('0x3'));var fs=require('fs');var Redis=require(_0x1566('0x4'));var db=require(_0x1566('0x5'))['db'];var utils=require(_0x1566('0x6'));var logger=require('../../config/logger')(_0x1566('0x7'));var config=require(_0x1566('0x8'));var jayson=require(_0x1566('0x9'));var client=jayson[_0x1566('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e7c47,_0x1d8dfb,_0xbe3fe8){return new BPromise(function(_0x4c39e0,_0x4673e9){return client[_0x1566('0xb')](_0x2e7c47,_0xbe3fe8)[_0x1566('0xc')](function(_0x15095c){logger[_0x1566('0xd')](_0x1566('0xe'),_0x1d8dfb,_0x1566('0xf'));logger['debug'](_0x1566('0x10'),_0x1d8dfb,_0x1566('0xf'),JSON[_0x1566('0x11')](_0x15095c));if(_0x15095c[_0x1566('0x12')]){if(_0x15095c['error'][_0x1566('0x13')]===0x1f4){logger[_0x1566('0x12')](_0x1566('0xe'),_0x1d8dfb,_0x15095c[_0x1566('0x12')][_0x1566('0x14')]);return _0x4673e9(_0x15095c['error'][_0x1566('0x14')]);}logger['error'](_0x1566('0xe'),_0x1d8dfb,_0x15095c['error']['message']);return _0x4c39e0(_0x15095c[_0x1566('0x12')][_0x1566('0x14')]);}else{logger[_0x1566('0xd')](_0x1566('0xe'),_0x1d8dfb,_0x1566('0xf'));_0x4c39e0(_0x15095c[_0x1566('0x15')][_0x1566('0x14')]);}})[_0x1566('0x16')](function(_0x326ffb){logger[_0x1566('0x12')](_0x1566('0xe'),_0x1d8dfb,_0x326ffb);_0x4673e9(_0x326ffb);});});}exports[_0x1566('0x17')]=function(_0x144eca){var _0x4de49d=this;return new Promise(function(_0x40e52d,_0x29ba54){return db[_0x1566('0x18')]['create'](_0x144eca[_0x1566('0x19')],{'raw':_0x144eca[_0x1566('0x1a')]?_0x144eca[_0x1566('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1566('0xc')](function(_0x331122){logger[_0x1566('0xd')](_0x1566('0x17'),_0x144eca);logger[_0x1566('0x1b')]('CreateFaxQueueReport',_0x144eca,JSON[_0x1566('0x11')](_0x331122));_0x40e52d(_0x331122);})['catch'](function(_0x121749){logger[_0x1566('0x12')]('CreateFaxQueueReport',_0x121749['message'],_0x144eca);_0x29ba54(_0x4de49d[_0x1566('0x12')](0x1f4,_0x121749['message']));});});};exports[_0x1566('0x1c')]=function(_0x57d9b7){var _0x1c28f8=this;return new Promise(function(_0x34997a,_0x45f615){return db[_0x1566('0x18')][_0x1566('0x1d')](_0x57d9b7[_0x1566('0x19')],{'raw':_0x57d9b7[_0x1566('0x1a')]?_0x57d9b7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d9b7['options']?_0x57d9b7['options']['where']||null:null,'attributes':_0x57d9b7[_0x1566('0x1a')]?_0x57d9b7['options'][_0x1566('0x1e')]||null:null,'limit':_0x57d9b7[_0x1566('0x1a')]?_0x57d9b7['options'][_0x1566('0x1f')]||null:null})['then'](function(_0x278ee4){logger[_0x1566('0xd')](_0x1566('0x1c'),_0x57d9b7);logger[_0x1566('0x1b')]('UpdateFaxQueueReport',_0x57d9b7,JSON[_0x1566('0x11')](_0x278ee4));_0x34997a(_0x278ee4);})[_0x1566('0x16')](function(_0x516de3){logger[_0x1566('0x12')](_0x1566('0x1c'),_0x516de3['message'],_0x57d9b7);_0x45f615(_0x1c28f8[_0x1566('0x12')](0x1f4,_0x516de3[_0x1566('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e7c4173..8b5a9e3 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 _0x4542=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','multer','util','path','connect-timeout'];(function(_0x293bfc,_0x9af21f){var _0x20ccec=function(_0x2d7611){while(--_0x2d7611){_0x293bfc['push'](_0x293bfc['shift']());}};_0x20ccec(++_0x9af21f);}(_0x4542,0x164));var _0x2454=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4542[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var path=require(_0x2454('0x2'));var timeout=require(_0x2454('0x3'));var express=require('express');var router=express[_0x2454('0x4')]();var fs_extra=require(_0x2454('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2454('0x6'));var config=require(_0x2454('0x7'));var controller=require(_0x2454('0x8'));router[_0x2454('0x9')]('/',auth[_0x2454('0xa')](),controller[_0x2454('0xb')]);router[_0x2454('0x9')](_0x2454('0xc'),auth[_0x2454('0xa')](),controller[_0x2454('0xd')]);router['get'](_0x2454('0xe'),auth[_0x2454('0xa')](),controller['show']);router[_0x2454('0xf')]('/',auth[_0x2454('0xa')](),controller[_0x2454('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2454('0xe'),auth[_0x2454('0xa')](),controller[_0x2454('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa8f6=['/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x10aeef,_0x5a8c0f){var _0x534f59=function(_0x3cb83d){while(--_0x3cb83d){_0x10aeef['push'](_0x10aeef['shift']());}};_0x534f59(++_0x5a8c0f);}(_0xa8f6,0xfe));var _0x6a8f=function(_0x1890fe,_0x500cff){_0x1890fe=_0x1890fe-0x0;var _0x2a5984=_0xa8f6[_0x1890fe];return _0x2a5984;};'use strict';var multer=require(_0x6a8f('0x0'));var util=require(_0x6a8f('0x1'));var path=require('path');var timeout=require(_0x6a8f('0x2'));var express=require(_0x6a8f('0x3'));var router=express[_0x6a8f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a8f('0x5'));var interaction=require(_0x6a8f('0x6'));var config=require(_0x6a8f('0x7'));var controller=require('./faxQueueReport.controller');router[_0x6a8f('0x8')]('/',auth[_0x6a8f('0x9')](),controller[_0x6a8f('0xa')]);router[_0x6a8f('0x8')]('/describe',auth[_0x6a8f('0x9')](),controller[_0x6a8f('0xb')]);router[_0x6a8f('0x8')](_0x6a8f('0xc'),auth[_0x6a8f('0x9')](),controller[_0x6a8f('0xd')]);router[_0x6a8f('0xe')]('/',auth[_0x6a8f('0x9')](),controller[_0x6a8f('0xf')]);router[_0x6a8f('0x10')](_0x6a8f('0xc'),auth[_0x6a8f('0x9')](),controller['update']);router[_0x6a8f('0x11')](_0x6a8f('0xc'),auth[_0x6a8f('0x9')](),controller['destroy']);module[_0x6a8f('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 426fc17..4229c99 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x406b75,_0x2aa72b){var _0x198625=function(_0x312a54){while(--_0x312a54){_0x406b75['push'](_0x406b75['shift']());}};_0x198625(++_0x2aa72b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x7a42d9,_0x5a0c72){_0x7a42d9=_0x7a42d9-0x0;var _0x278b78=_0xf3cd[_0x7a42d9];return _0x278b78;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xb43b,0x1b2));var _0xbb43=function(_0xfe75f5,_0x3eb41d){_0xfe75f5=_0xfe75f5-0x0;var _0x2ce754=_0xb43b[_0xfe75f5];return _0x2ce754;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6cd0eb1..a3e9775 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 _0x6ac7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0x6ac7,0xd2));var _0x76ac=function(_0x45dad3,_0x2f1239){_0x45dad3=_0x45dad3-0x0;var _0x1b4594=_0x6ac7[_0x45dad3];return _0x1b4594;};'use strict';var emlformat=require(_0x76ac('0x0'));var rimraf=require(_0x76ac('0x1'));var zipdir=require(_0x76ac('0x2'));var jsonpatch=require(_0x76ac('0x3'));var rp=require(_0x76ac('0x4'));var moment=require('moment');var BPromise=require(_0x76ac('0x5'));var Mustache=require(_0x76ac('0x6'));var util=require('util');var path=require(_0x76ac('0x7'));var sox=require(_0x76ac('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76ac('0x9'));var _=require(_0x76ac('0xa'));var squel=require(_0x76ac('0xb'));var crypto=require('crypto');var jsforce=require(_0x76ac('0xc'));var deskjs=require(_0x76ac('0xd'));var toCsv=require(_0x76ac('0xe'));var querystring=require(_0x76ac('0xf'));var Papa=require(_0x76ac('0x10'));var Redis=require('ioredis');var authService=require(_0x76ac('0x11'));var qs=require(_0x76ac('0x12'));var as=require(_0x76ac('0x13'));var hardwareService=require(_0x76ac('0x14'));var logger=require(_0x76ac('0x15'))(_0x76ac('0x16'));var utils=require(_0x76ac('0x17'));var config=require(_0x76ac('0x18'));var licenseUtil=require(_0x76ac('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d522c,_0xcd9e93){_0xcd9e93=_0xcd9e93||0xcc;return function(_0x16f45d){if(_0x16f45d){return _0x1d522c['sendStatus'](_0xcd9e93);}return _0x1d522c['status'](_0xcd9e93)['end']();};}function respondWithResult(_0x5e6213,_0x31f839){_0x31f839=_0x31f839||0xc8;return function(_0x48bdd8){if(_0x48bdd8){return _0x5e6213['status'](_0x31f839)[_0x76ac('0x1a')](_0x48bdd8);}};}function respondWithFilteredResult(_0x4102b9,_0x26d423){return function(_0x4365f8){if(_0x4365f8){var _0x123d20=typeof _0x26d423[_0x76ac('0x1b')]===_0x76ac('0x1c')&&typeof _0x26d423[_0x76ac('0x1d')]==='undefined';var _0x16e530=_0x4365f8[_0x76ac('0x1e')];var _0x42c39f=_0x123d20?0x0:_0x26d423[_0x76ac('0x1b')];var _0x451fdc=_0x123d20?_0x4365f8[_0x76ac('0x1e')]:_0x26d423[_0x76ac('0x1b')]+_0x26d423[_0x76ac('0x1d')];var _0x436ebb;if(_0x451fdc>=_0x16e530){_0x451fdc=_0x16e530;_0x436ebb=0xc8;}else{_0x436ebb=0xce;}_0x4102b9[_0x76ac('0x1f')](_0x436ebb);return _0x4102b9[_0x76ac('0x20')](_0x76ac('0x21'),_0x42c39f+'-'+_0x451fdc+'/'+_0x16e530)[_0x76ac('0x1a')](_0x4365f8);}return null;};}function patchUpdates(_0x1fc9ad){return function(_0x1a2779){try{jsonpatch[_0x76ac('0x22')](_0x1a2779,_0x1fc9ad,!![]);}catch(_0x20f942){return BPromise['reject'](_0x20f942);}return _0x1a2779[_0x76ac('0x23')]();};}function saveUpdates(_0x93f589,_0x3790b0){return function(_0x3610cc){if(_0x3610cc){return _0x3610cc[_0x76ac('0x24')](_0x93f589)['then'](function(_0x2514c3){return _0x2514c3;});}return null;};}function removeEntity(_0x4be681,_0x127074){return function(_0x11885b){if(_0x11885b){return _0x11885b['destroy']()[_0x76ac('0x25')](function(){_0x4be681[_0x76ac('0x1f')](0xcc)[_0x76ac('0x26')]();});}};}function handleEntityNotFound(_0x4b148d,_0x1fd69e){return function(_0x7847e0){if(!_0x7847e0){_0x4b148d['sendStatus'](0x194);}return _0x7847e0;};}function handleError(_0x4a1694,_0x1dcf8b){_0x1dcf8b=_0x1dcf8b||0x1f4;return function(_0x1558b1){logger['error'](_0x1558b1[_0x76ac('0x27')]);if(_0x1558b1[_0x76ac('0x28')]){delete _0x1558b1[_0x76ac('0x28')];}_0x4a1694['status'](_0x1dcf8b)[_0x76ac('0x29')](_0x1558b1);};}exports[_0x76ac('0x2a')]=function(_0x5a7ba4,_0x533e54){var _0x23bfe8={},_0x4554c9={},_0x37883d={'count':0x0,'rows':[]};var _0x5e4650=_[_0x76ac('0x2b')](db['FaxTransferReport']['rawAttributes'],function(_0x157a50){return{'name':_0x157a50[_0x76ac('0x2c')],'type':_0x157a50[_0x76ac('0x2d')]['key']};});_0x4554c9[_0x76ac('0x2e')]=_[_0x76ac('0x2b')](_0x5e4650,_0x76ac('0x28'));_0x4554c9[_0x76ac('0x2f')]=_[_0x76ac('0x30')](_0x5a7ba4[_0x76ac('0x2f')]);_0x4554c9[_0x76ac('0x31')]=_[_0x76ac('0x32')](_0x4554c9[_0x76ac('0x2e')],_0x4554c9['query']);_0x23bfe8[_0x76ac('0x33')]=_[_0x76ac('0x32')](_0x4554c9[_0x76ac('0x2e')],qs['fields'](_0x5a7ba4[_0x76ac('0x2f')][_0x76ac('0x34')]));_0x23bfe8[_0x76ac('0x33')]=_0x23bfe8[_0x76ac('0x33')]['length']?_0x23bfe8[_0x76ac('0x33')]:_0x4554c9['model'];if(!_0x5a7ba4[_0x76ac('0x2f')]['hasOwnProperty'](_0x76ac('0x35'))){_0x23bfe8[_0x76ac('0x1d')]=qs[_0x76ac('0x1d')](_0x5a7ba4[_0x76ac('0x2f')][_0x76ac('0x1d')]);_0x23bfe8[_0x76ac('0x1b')]=qs['offset'](_0x5a7ba4['query']['offset']);}_0x23bfe8[_0x76ac('0x36')]=qs['sort'](_0x5a7ba4[_0x76ac('0x2f')][_0x76ac('0x37')]);_0x23bfe8[_0x76ac('0x38')]=qs[_0x76ac('0x31')](_[_0x76ac('0x39')](_0x5a7ba4[_0x76ac('0x2f')],_0x4554c9[_0x76ac('0x31')]),_0x5e4650);if(_0x5a7ba4[_0x76ac('0x2f')][_0x76ac('0x3a')]){_0x23bfe8[_0x76ac('0x38')]=_[_0x76ac('0x3b')](_0x23bfe8[_0x76ac('0x38')],{'$or':_[_0x76ac('0x2b')](_0x5e4650,function(_0x45b64d){if(_0x45b64d[_0x76ac('0x2d')]!==_0x76ac('0x3c')){var _0x425ca1={};_0x425ca1[_0x45b64d[_0x76ac('0x28')]]={'$like':'%'+_0x5a7ba4['query']['filter']+'%'};return _0x425ca1;}})});}_0x23bfe8=_['merge']({},_0x23bfe8,_0x5a7ba4[_0x76ac('0x3d')]);var _0x41068e={'where':_0x23bfe8[_0x76ac('0x38')]};return db['FaxTransferReport'][_0x76ac('0x1e')](_0x41068e)[_0x76ac('0x25')](function(_0xb9d9ab){_0x37883d[_0x76ac('0x1e')]=_0xb9d9ab;if(_0x5a7ba4[_0x76ac('0x2f')][_0x76ac('0x3e')]){_0x23bfe8[_0x76ac('0x3f')]=[{'all':!![]}];}return db[_0x76ac('0x40')][_0x76ac('0x41')](_0x23bfe8);})[_0x76ac('0x25')](function(_0x52192f){_0x37883d[_0x76ac('0x42')]=_0x52192f;return _0x37883d;})[_0x76ac('0x25')](respondWithFilteredResult(_0x533e54,_0x23bfe8))[_0x76ac('0x43')](handleError(_0x533e54,null));};exports[_0x76ac('0x44')]=function(_0x4c6946,_0x16737d){var _0xd8c887={'raw':!![],'where':{'id':_0x4c6946[_0x76ac('0x45')]['id']}},_0x2bc5c9={};_0x2bc5c9[_0x76ac('0x2e')]=_[_0x76ac('0x30')](db[_0x76ac('0x40')][_0x76ac('0x46')]);_0x2bc5c9['query']=_[_0x76ac('0x30')](_0x4c6946[_0x76ac('0x2f')]);_0x2bc5c9[_0x76ac('0x31')]=_[_0x76ac('0x32')](_0x2bc5c9[_0x76ac('0x2e')],_0x2bc5c9[_0x76ac('0x2f')]);_0xd8c887[_0x76ac('0x33')]=_[_0x76ac('0x32')](_0x2bc5c9[_0x76ac('0x2e')],qs[_0x76ac('0x34')](_0x4c6946[_0x76ac('0x2f')]['fields']));_0xd8c887[_0x76ac('0x33')]=_0xd8c887['attributes']['length']?_0xd8c887['attributes']:_0x2bc5c9[_0x76ac('0x2e')];if(_0x4c6946[_0x76ac('0x2f')][_0x76ac('0x3e')]){_0xd8c887[_0x76ac('0x3f')]=[{'all':!![]}];}_0xd8c887=_[_0x76ac('0x3b')]({},_0xd8c887,_0x4c6946[_0x76ac('0x3d')]);return db['FaxTransferReport'][_0x76ac('0x47')](_0xd8c887)['then'](handleEntityNotFound(_0x16737d,null))[_0x76ac('0x25')](respondWithResult(_0x16737d,null))['catch'](handleError(_0x16737d,null));};exports[_0x76ac('0x48')]=function(_0xdf9ca8,_0x3d1f96){return db[_0x76ac('0x40')][_0x76ac('0x48')](_0xdf9ca8[_0x76ac('0x49')],{})[_0x76ac('0x25')](respondWithResult(_0x3d1f96,0xc9))[_0x76ac('0x43')](handleError(_0x3d1f96,null));};exports[_0x76ac('0x24')]=function(_0x6f20ca,_0x221599){if(_0x6f20ca[_0x76ac('0x49')]['id']){delete _0x6f20ca['body']['id'];}return db[_0x76ac('0x40')][_0x76ac('0x47')]({'where':{'id':_0x6f20ca[_0x76ac('0x45')]['id']}})[_0x76ac('0x25')](handleEntityNotFound(_0x221599,null))['then'](saveUpdates(_0x6f20ca[_0x76ac('0x49')],null))['then'](respondWithResult(_0x221599,null))[_0x76ac('0x43')](handleError(_0x221599,null));};exports[_0x76ac('0x4a')]=function(_0x575db,_0x4a35e7){return db[_0x76ac('0x40')][_0x76ac('0x47')]({'where':{'id':_0x575db[_0x76ac('0x45')]['id']}})[_0x76ac('0x25')](handleEntityNotFound(_0x4a35e7,null))[_0x76ac('0x25')](removeEntity(_0x4a35e7,null))[_0x76ac('0x43')](handleError(_0x4a35e7,null));};exports[_0x76ac('0x4b')]=function(_0x393a2f,_0x47053f){return db['FaxTransferReport'][_0x76ac('0x4b')]()[_0x76ac('0x25')](respondWithResult(_0x47053f,null))[_0x76ac('0x43')](handleError(_0x47053f,null));}; \ No newline at end of file +var _0xd9b1=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','map','FaxTransferReport','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service'];(function(_0x35a9a7,_0x5e8c7f){var _0x142c13=function(_0x6f2671){while(--_0x6f2671){_0x35a9a7['push'](_0x35a9a7['shift']());}};_0x142c13(++_0x5e8c7f);}(_0xd9b1,0x10b));var _0x1d9b=function(_0x23012c,_0x14ffaf){_0x23012c=_0x23012c-0x0;var _0x318c14=_0xd9b1[_0x23012c];return _0x318c14;};'use strict';var emlformat=require(_0x1d9b('0x0'));var rimraf=require(_0x1d9b('0x1'));var zipdir=require(_0x1d9b('0x2'));var jsonpatch=require(_0x1d9b('0x3'));var rp=require(_0x1d9b('0x4'));var moment=require('moment');var BPromise=require(_0x1d9b('0x5'));var Mustache=require('mustache');var util=require(_0x1d9b('0x6'));var path=require(_0x1d9b('0x7'));var sox=require(_0x1d9b('0x8'));var csv=require(_0x1d9b('0x9'));var ejs=require(_0x1d9b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d9b('0xb'));var squel=require(_0x1d9b('0xc'));var crypto=require(_0x1d9b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d9b('0xe'));var toCsv=require(_0x1d9b('0x9'));var querystring=require('querystring');var Papa=require(_0x1d9b('0xf'));var Redis=require('ioredis');var authService=require(_0x1d9b('0x10'));var qs=require(_0x1d9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d9b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1d9b('0x13'));var config=require(_0x1d9b('0x14'));var licenseUtil=require(_0x1d9b('0x15'));var db=require(_0x1d9b('0x16'))['db'];function respondWithStatusCode(_0x1653bf,_0x5ab0df){_0x5ab0df=_0x5ab0df||0xcc;return function(_0x493999){if(_0x493999){return _0x1653bf[_0x1d9b('0x17')](_0x5ab0df);}return _0x1653bf[_0x1d9b('0x18')](_0x5ab0df)['end']();};}function respondWithResult(_0x458476,_0x5ec7f6){_0x5ec7f6=_0x5ec7f6||0xc8;return function(_0x5d6d58){if(_0x5d6d58){return _0x458476[_0x1d9b('0x18')](_0x5ec7f6)[_0x1d9b('0x19')](_0x5d6d58);}};}function respondWithFilteredResult(_0x2975b6,_0x1e844d){return function(_0x13c3d4){if(_0x13c3d4){var _0x985563=typeof _0x1e844d['offset']===_0x1d9b('0x1a')&&typeof _0x1e844d[_0x1d9b('0x1b')]===_0x1d9b('0x1a');var _0x3c098b=_0x13c3d4[_0x1d9b('0x1c')];var _0x105f4b=_0x985563?0x0:_0x1e844d[_0x1d9b('0x1d')];var _0x5caf05=_0x985563?_0x13c3d4['count']:_0x1e844d[_0x1d9b('0x1d')]+_0x1e844d[_0x1d9b('0x1b')];var _0x20c459;if(_0x5caf05>=_0x3c098b){_0x5caf05=_0x3c098b;_0x20c459=0xc8;}else{_0x20c459=0xce;}_0x2975b6[_0x1d9b('0x18')](_0x20c459);return _0x2975b6[_0x1d9b('0x1e')](_0x1d9b('0x1f'),_0x105f4b+'-'+_0x5caf05+'/'+_0x3c098b)[_0x1d9b('0x19')](_0x13c3d4);}return null;};}function patchUpdates(_0x455269){return function(_0x333827){try{jsonpatch[_0x1d9b('0x20')](_0x333827,_0x455269,!![]);}catch(_0x502ed2){return BPromise['reject'](_0x502ed2);}return _0x333827['save']();};}function saveUpdates(_0x27e120,_0x2ec59b){return function(_0x445006){if(_0x445006){return _0x445006[_0x1d9b('0x21')](_0x27e120)[_0x1d9b('0x22')](function(_0x5d0ddd){return _0x5d0ddd;});}return null;};}function removeEntity(_0x774df0,_0x478d1c){return function(_0x137ae3){if(_0x137ae3){return _0x137ae3[_0x1d9b('0x23')]()['then'](function(){_0x774df0[_0x1d9b('0x18')](0xcc)[_0x1d9b('0x24')]();});}};}function handleEntityNotFound(_0x4d5296,_0x619a26){return function(_0x3c9151){if(!_0x3c9151){_0x4d5296[_0x1d9b('0x17')](0x194);}return _0x3c9151;};}function handleError(_0x38bb91,_0x46866f){_0x46866f=_0x46866f||0x1f4;return function(_0x50b606){logger[_0x1d9b('0x25')](_0x50b606['stack']);if(_0x50b606[_0x1d9b('0x26')]){delete _0x50b606[_0x1d9b('0x26')];}_0x38bb91[_0x1d9b('0x18')](_0x46866f)['send'](_0x50b606);};}exports['index']=function(_0x12002e,_0x313425){var _0x553489={},_0x15664a={},_0x584296={'count':0x0,'rows':[]};var _0x51a588=_[_0x1d9b('0x27')](db[_0x1d9b('0x28')]['rawAttributes'],function(_0x2d7f87){return{'name':_0x2d7f87['fieldName'],'type':_0x2d7f87[_0x1d9b('0x29')]['key']};});_0x15664a[_0x1d9b('0x2a')]=_[_0x1d9b('0x27')](_0x51a588,_0x1d9b('0x26'));_0x15664a['query']=_[_0x1d9b('0x2b')](_0x12002e[_0x1d9b('0x2c')]);_0x15664a[_0x1d9b('0x2d')]=_[_0x1d9b('0x2e')](_0x15664a[_0x1d9b('0x2a')],_0x15664a[_0x1d9b('0x2c')]);_0x553489[_0x1d9b('0x2f')]=_[_0x1d9b('0x2e')](_0x15664a[_0x1d9b('0x2a')],qs[_0x1d9b('0x30')](_0x12002e[_0x1d9b('0x2c')][_0x1d9b('0x30')]));_0x553489[_0x1d9b('0x2f')]=_0x553489[_0x1d9b('0x2f')]['length']?_0x553489[_0x1d9b('0x2f')]:_0x15664a[_0x1d9b('0x2a')];if(!_0x12002e[_0x1d9b('0x2c')][_0x1d9b('0x31')](_0x1d9b('0x32'))){_0x553489['limit']=qs[_0x1d9b('0x1b')](_0x12002e['query'][_0x1d9b('0x1b')]);_0x553489[_0x1d9b('0x1d')]=qs['offset'](_0x12002e[_0x1d9b('0x2c')][_0x1d9b('0x1d')]);}_0x553489[_0x1d9b('0x33')]=qs[_0x1d9b('0x34')](_0x12002e[_0x1d9b('0x2c')]['sort']);_0x553489[_0x1d9b('0x35')]=qs[_0x1d9b('0x2d')](_[_0x1d9b('0x36')](_0x12002e[_0x1d9b('0x2c')],_0x15664a['filters']),_0x51a588);if(_0x12002e[_0x1d9b('0x2c')]['filter']){_0x553489['where']=_[_0x1d9b('0x37')](_0x553489[_0x1d9b('0x35')],{'$or':_[_0x1d9b('0x27')](_0x51a588,function(_0x3bdd0c){if(_0x3bdd0c['type']!==_0x1d9b('0x38')){var _0x59243b={};_0x59243b[_0x3bdd0c[_0x1d9b('0x26')]]={'$like':'%'+_0x12002e[_0x1d9b('0x2c')][_0x1d9b('0x39')]+'%'};return _0x59243b;}})});}_0x553489=_[_0x1d9b('0x37')]({},_0x553489,_0x12002e[_0x1d9b('0x3a')]);var _0x17e582={'where':_0x553489[_0x1d9b('0x35')]};return db[_0x1d9b('0x28')][_0x1d9b('0x1c')](_0x17e582)[_0x1d9b('0x22')](function(_0x47d692){_0x584296[_0x1d9b('0x1c')]=_0x47d692;if(_0x12002e[_0x1d9b('0x2c')][_0x1d9b('0x3b')]){_0x553489[_0x1d9b('0x3c')]=[{'all':!![]}];}return db[_0x1d9b('0x28')]['findAll'](_0x553489);})[_0x1d9b('0x22')](function(_0x272b63){_0x584296[_0x1d9b('0x3d')]=_0x272b63;return _0x584296;})['then'](respondWithFilteredResult(_0x313425,_0x553489))[_0x1d9b('0x3e')](handleError(_0x313425,null));};exports[_0x1d9b('0x3f')]=function(_0x1a7927,_0x1ebc46){var _0x51c66a={'raw':!![],'where':{'id':_0x1a7927[_0x1d9b('0x40')]['id']}},_0x2cb3da={};_0x2cb3da[_0x1d9b('0x2a')]=_[_0x1d9b('0x2b')](db[_0x1d9b('0x28')][_0x1d9b('0x41')]);_0x2cb3da[_0x1d9b('0x2c')]=_[_0x1d9b('0x2b')](_0x1a7927['query']);_0x2cb3da['filters']=_[_0x1d9b('0x2e')](_0x2cb3da[_0x1d9b('0x2a')],_0x2cb3da[_0x1d9b('0x2c')]);_0x51c66a[_0x1d9b('0x2f')]=_[_0x1d9b('0x2e')](_0x2cb3da[_0x1d9b('0x2a')],qs[_0x1d9b('0x30')](_0x1a7927[_0x1d9b('0x2c')]['fields']));_0x51c66a[_0x1d9b('0x2f')]=_0x51c66a[_0x1d9b('0x2f')][_0x1d9b('0x42')]?_0x51c66a[_0x1d9b('0x2f')]:_0x2cb3da[_0x1d9b('0x2a')];if(_0x1a7927[_0x1d9b('0x2c')][_0x1d9b('0x3b')]){_0x51c66a['include']=[{'all':!![]}];}_0x51c66a=_[_0x1d9b('0x37')]({},_0x51c66a,_0x1a7927[_0x1d9b('0x3a')]);return db[_0x1d9b('0x28')][_0x1d9b('0x43')](_0x51c66a)[_0x1d9b('0x22')](handleEntityNotFound(_0x1ebc46,null))[_0x1d9b('0x22')](respondWithResult(_0x1ebc46,null))[_0x1d9b('0x3e')](handleError(_0x1ebc46,null));};exports[_0x1d9b('0x44')]=function(_0xc7699d,_0x407539){return db['FaxTransferReport']['create'](_0xc7699d[_0x1d9b('0x45')],{})[_0x1d9b('0x22')](respondWithResult(_0x407539,0xc9))[_0x1d9b('0x3e')](handleError(_0x407539,null));};exports[_0x1d9b('0x21')]=function(_0x19714f,_0xf14f71){if(_0x19714f[_0x1d9b('0x45')]['id']){delete _0x19714f[_0x1d9b('0x45')]['id'];}return db[_0x1d9b('0x28')][_0x1d9b('0x43')]({'where':{'id':_0x19714f[_0x1d9b('0x40')]['id']}})[_0x1d9b('0x22')](handleEntityNotFound(_0xf14f71,null))[_0x1d9b('0x22')](saveUpdates(_0x19714f[_0x1d9b('0x45')],null))['then'](respondWithResult(_0xf14f71,null))[_0x1d9b('0x3e')](handleError(_0xf14f71,null));};exports[_0x1d9b('0x23')]=function(_0x3cf973,_0x338261){return db[_0x1d9b('0x28')][_0x1d9b('0x43')]({'where':{'id':_0x3cf973['params']['id']}})['then'](handleEntityNotFound(_0x338261,null))[_0x1d9b('0x22')](removeEntity(_0x338261,null))[_0x1d9b('0x3e')](handleError(_0x338261,null));};exports['describe']=function(_0x4abf46,_0x4d9fa3){return db[_0x1d9b('0x28')][_0x1d9b('0x46')]()['then'](respondWithResult(_0x4d9fa3,null))[_0x1d9b('0x3e')](handleError(_0x4d9fa3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c3cbf7e..ece614f 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 _0xd501=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x255caf,_0x2f893b){var _0x25e862=function(_0xffbed9){while(--_0xffbed9){_0x255caf['push'](_0x255caf['shift']());}};_0x25e862(++_0x2f893b);}(_0xd501,0x135));var _0x1d50=function(_0x5cf7af,_0x272d9e){_0x5cf7af=_0x5cf7af-0x0;var _0x413a00=_0xd501[_0x5cf7af];return _0x413a00;};'use strict';var _=require(_0x1d50('0x0'));var util=require(_0x1d50('0x1'));var logger=require(_0x1d50('0x2'))(_0x1d50('0x3'));var moment=require(_0x1d50('0x4'));var BPromise=require(_0x1d50('0x5'));var rp=require(_0x1d50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d50('0x7'));var config=require(_0x1d50('0x8'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2a5088,_0x1129df){return _0x2a5088[_0x1d50('0x9')]('FaxTransferReport',attributes,{'tableName':_0x1d50('0xa'),'paranoid':![],'indexes':[{'name':_0x1d50('0xb'),'fields':[_0x1d50('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac7a=['moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x445d6e,_0x3a9cc1){var _0x2368f5=function(_0x546173){while(--_0x546173){_0x445d6e['push'](_0x445d6e['shift']());}};_0x2368f5(++_0x3a9cc1);}(_0xac7a,0x1f4));var _0xaac7=function(_0xb2fbcf,_0x28a699){_0xb2fbcf=_0xb2fbcf-0x0;var _0x448577=_0xac7a[_0xb2fbcf];return _0x448577;};'use strict';var _=require(_0xaac7('0x0'));var util=require(_0xaac7('0x1'));var logger=require(_0xaac7('0x2'))(_0xaac7('0x3'));var moment=require(_0xaac7('0x4'));var BPromise=require(_0xaac7('0x5'));var rp=require(_0xaac7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaac7('0x7'));var config=require('../../config/environment');var attributes=require(_0xaac7('0x8'));module[_0xaac7('0x9')]=function(_0x5a0c51,_0x3be9c1){return _0x5a0c51['define'](_0xaac7('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xaac7('0xb'),'fields':[_0xaac7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4a66a33..000d22e 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 _0x0770=['code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0x0770,0x12a));var _0x0077=function(_0x53d816,_0x1d1594){_0x53d816=_0x53d816-0x0;var _0x17c9ed=_0x0770[_0x53d816];return _0x17c9ed;};'use strict';var _=require('lodash');var util=require(_0x0077('0x0'));var moment=require(_0x0077('0x1'));var BPromise=require(_0x0077('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0077('0x3'))['db'];var utils=require(_0x0077('0x4'));var logger=require('../../config/logger')(_0x0077('0x5'));var config=require(_0x0077('0x6'));var jayson=require(_0x0077('0x7'));var client=jayson[_0x0077('0x8')][_0x0077('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c131b,_0x1351a6,_0x2b8181){return new BPromise(function(_0x211da3,_0x1f4695){return client[_0x0077('0xa')](_0x3c131b,_0x2b8181)['then'](function(_0x1ba618){logger[_0x0077('0xb')](_0x0077('0xc'),_0x1351a6,_0x0077('0xd'));logger['debug'](_0x0077('0xe'),_0x1351a6,_0x0077('0xd'),JSON[_0x0077('0xf')](_0x1ba618));if(_0x1ba618[_0x0077('0x10')]){if(_0x1ba618[_0x0077('0x10')][_0x0077('0x11')]===0x1f4){logger['error'](_0x0077('0xc'),_0x1351a6,_0x1ba618[_0x0077('0x10')][_0x0077('0x12')]);return _0x1f4695(_0x1ba618[_0x0077('0x10')][_0x0077('0x12')]);}logger[_0x0077('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1351a6,_0x1ba618[_0x0077('0x10')]['message']);return _0x211da3(_0x1ba618[_0x0077('0x10')]['message']);}else{logger[_0x0077('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x1351a6,'request\x20sent');_0x211da3(_0x1ba618[_0x0077('0x13')][_0x0077('0x12')]);}})[_0x0077('0x14')](function(_0xe8779f){logger[_0x0077('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1351a6,_0xe8779f);_0x1f4695(_0xe8779f);});});} \ No newline at end of file +var _0xc9c2=['stringify','code','error','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x32cb63,_0x50c74b){var _0xc78d79=function(_0x282fda){while(--_0x282fda){_0x32cb63['push'](_0x32cb63['shift']());}};_0xc78d79(++_0x50c74b);}(_0xc9c2,0xc4));var _0x2c9c=function(_0x81d23e,_0x176dc5){_0x81d23e=_0x81d23e-0x0;var _0x1ec56d=_0xc9c2[_0x81d23e];return _0x1ec56d;};'use strict';var _=require(_0x2c9c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c9c('0x1'));var rs=require(_0x2c9c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c9c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c9c('0x4'));var config=require(_0x2c9c('0x5'));var jayson=require(_0x2c9c('0x6'));var client=jayson[_0x2c9c('0x7')][_0x2c9c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x845b70,_0x40402f,_0x3c54c8){return new BPromise(function(_0x2c1fc2,_0x381e5e){return client['request'](_0x845b70,_0x3c54c8)[_0x2c9c('0x9')](function(_0x3962c5){logger['info'](_0x2c9c('0xa'),_0x40402f,_0x2c9c('0xb'));logger[_0x2c9c('0xc')](_0x2c9c('0xd'),_0x40402f,'request\x20sent',JSON[_0x2c9c('0xe')](_0x3962c5));if(_0x3962c5['error']){if(_0x3962c5['error'][_0x2c9c('0xf')]===0x1f4){logger['error'](_0x2c9c('0xa'),_0x40402f,_0x3962c5[_0x2c9c('0x10')][_0x2c9c('0x11')]);return _0x381e5e(_0x3962c5[_0x2c9c('0x10')][_0x2c9c('0x11')]);}logger[_0x2c9c('0x10')](_0x2c9c('0xa'),_0x40402f,_0x3962c5[_0x2c9c('0x10')][_0x2c9c('0x11')]);return _0x2c1fc2(_0x3962c5['error'][_0x2c9c('0x11')]);}else{logger[_0x2c9c('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x40402f,_0x2c9c('0xb'));_0x2c1fc2(_0x3962c5[_0x2c9c('0x13')][_0x2c9c('0x11')]);}})[_0x2c9c('0x14')](function(_0x1939cf){logger[_0x2c9c('0x10')](_0x2c9c('0xa'),_0x40402f,_0x1939cf);_0x381e5e(_0x1939cf);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e8b6e54..653d540 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 _0x9e86=['create','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','get','index','describe','/:id','isAuthenticated','post'];(function(_0x1dd528,_0x393eea){var _0x5aeb47=function(_0x284f2d){while(--_0x284f2d){_0x1dd528['push'](_0x1dd528['shift']());}};_0x5aeb47(++_0x393eea);}(_0x9e86,0x185));var _0x69e8=function(_0x87797,_0x4f8d31){_0x87797=_0x87797-0x0;var _0x5285ee=_0x9e86[_0x87797];return _0x5285ee;};'use strict';var multer=require('multer');var util=require(_0x69e8('0x0'));var path=require(_0x69e8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69e8('0x2')]();var fs_extra=require(_0x69e8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x69e8('0x4'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x69e8('0x5')]('/',auth['isAuthenticated'](),controller[_0x69e8('0x6')]);router[_0x69e8('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x69e8('0x7')]);router[_0x69e8('0x5')](_0x69e8('0x8'),auth[_0x69e8('0x9')](),controller['show']);router[_0x69e8('0xa')]('/',auth[_0x69e8('0x9')](),controller[_0x69e8('0xb')]);router[_0x69e8('0xc')](_0x69e8('0x8'),auth[_0x69e8('0x9')](),controller[_0x69e8('0xd')]);router[_0x69e8('0xe')]('/:id',auth[_0x69e8('0x9')](),controller[_0x69e8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x97cc=['index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','path','express','Router','fs-extra','../../config/environment'];(function(_0x569970,_0x16f028){var _0x13cc81=function(_0x313dc2){while(--_0x313dc2){_0x569970['push'](_0x569970['shift']());}};_0x13cc81(++_0x16f028);}(_0x97cc,0x163));var _0xc97c=function(_0x41e8fc,_0x109b29){_0x41e8fc=_0x41e8fc-0x0;var _0x22b788=_0x97cc[_0x41e8fc];return _0x22b788;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc97c('0x0'));var timeout=require('connect-timeout');var express=require(_0xc97c('0x1'));var router=express[_0xc97c('0x2')]();var fs_extra=require(_0xc97c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc97c('0x4'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc97c('0x5')]);router[_0xc97c('0x6')](_0xc97c('0x7'),auth[_0xc97c('0x8')](),controller[_0xc97c('0x9')]);router[_0xc97c('0x6')](_0xc97c('0xa'),auth[_0xc97c('0x8')](),controller[_0xc97c('0xb')]);router[_0xc97c('0xc')]('/',auth[_0xc97c('0x8')](),controller[_0xc97c('0xd')]);router[_0xc97c('0xe')](_0xc97c('0xa'),auth[_0xc97c('0x8')](),controller[_0xc97c('0xf')]);router[_0xc97c('0x10')](_0xc97c('0xa'),auth[_0xc97c('0x8')](),controller[_0xc97c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 794f65d..926ea3f 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 _0x2aef=['isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x14f07a,_0x4d21be){var _0x5c80b7=function(_0x39ce49){while(--_0x39ce49){_0x14f07a['push'](_0x14f07a['shift']());}};_0x5c80b7(++_0x4d21be);}(_0x2aef,0x1f1));var _0xf2ae=function(_0x1a0901,_0x39bcf4){_0x1a0901=_0x1a0901-0x0;var _0x52e9cd=_0x2aef[_0x1a0901];return _0x52e9cd;};'use strict';var multer=require(_0xf2ae('0x0'));var util=require('util');var path=require(_0xf2ae('0x1'));var timeout=require(_0xf2ae('0x2'));var express=require(_0xf2ae('0x3'));var router=express['Router']();var fs_extra=require(_0xf2ae('0x4'));var auth=require(_0xf2ae('0x5'));var interaction=require(_0xf2ae('0x6'));var config=require(_0xf2ae('0x7'));var controller=require(_0xf2ae('0x8'));router['get']('/',auth[_0xf2ae('0x9')](),controller[_0xf2ae('0xa')]);router[_0xf2ae('0xb')](_0xf2ae('0xc'),auth[_0xf2ae('0x9')](),controller[_0xf2ae('0xd')]);router[_0xf2ae('0xb')](_0xf2ae('0xe'),auth[_0xf2ae('0x9')](),controller[_0xf2ae('0xf')]);router['get'](_0xf2ae('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xf2ae('0x11')]('/',auth[_0xf2ae('0x9')](),controller[_0xf2ae('0x12')]);router[_0xf2ae('0x11')](_0xf2ae('0xe'),auth[_0xf2ae('0x9')](),controller[_0xf2ae('0x13')]);router['put'](_0xf2ae('0xc'),auth[_0xf2ae('0x9')](),controller[_0xf2ae('0x14')]);router[_0xf2ae('0x15')](_0xf2ae('0xc'),auth[_0xf2ae('0x9')](),controller['destroy']);module[_0xf2ae('0x16')]=router; \ No newline at end of file +var _0x5c66=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','delete'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x5c66,0x14b));var _0x65c6=function(_0x3ef806,_0x4eae75){_0x3ef806=_0x3ef806-0x0;var _0x4e3570=_0x5c66[_0x3ef806];return _0x4e3570;};'use strict';var multer=require(_0x65c6('0x0'));var util=require('util');var path=require(_0x65c6('0x1'));var timeout=require(_0x65c6('0x2'));var express=require('express');var router=express[_0x65c6('0x3')]();var fs_extra=require(_0x65c6('0x4'));var auth=require(_0x65c6('0x5'));var interaction=require(_0x65c6('0x6'));var config=require(_0x65c6('0x7'));var controller=require(_0x65c6('0x8'));router[_0x65c6('0x9')]('/',auth['isAuthenticated'](),controller[_0x65c6('0xa')]);router[_0x65c6('0x9')](_0x65c6('0xb'),auth[_0x65c6('0xc')](),controller[_0x65c6('0xd')]);router[_0x65c6('0x9')]('/:id/configurations',auth[_0x65c6('0xc')](),controller['getConfigurations']);router[_0x65c6('0x9')](_0x65c6('0xe'),auth[_0x65c6('0xc')](),controller[_0x65c6('0xf')]);router[_0x65c6('0x10')]('/',auth[_0x65c6('0xc')](),controller['create']);router[_0x65c6('0x10')](_0x65c6('0x11'),auth[_0x65c6('0xc')](),controller[_0x65c6('0x12')]);router[_0x65c6('0x13')](_0x65c6('0xb'),auth[_0x65c6('0xc')](),controller['update']);router[_0x65c6('0x14')]('/:id',auth[_0x65c6('0xc')](),controller['destroy']);module[_0x65c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 09df388..70dafb4 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 _0x4587=['basic','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x557b0e,_0x4cb914){var _0x437a9f=function(_0x7b93e0){while(--_0x7b93e0){_0x557b0e['push'](_0x557b0e['shift']());}};_0x437a9f(++_0x4cb914);}(_0x4587,0x10e));var _0x7458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4587[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7458('0x0'));module[_0x7458('0x1')]={'name':{'type':Sequelize[_0x7458('0x2')]},'description':{'type':Sequelize[_0x7458('0x2')]},'username':{'type':Sequelize[_0x7458('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x7458('0x3')),'defaultValue':_0x7458('0x3')},'password':{'type':Sequelize[_0x7458('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7458('0x2')]},'serverUrl':{'type':Sequelize[_0x7458('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7458('0x4')](_0x7458('0x5'),_0x7458('0x6')),'defaultValue':_0x7458('0x5')}}; \ No newline at end of file +var _0x83af=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0xca3e47,_0x49e3d1){var _0x3e09cf=function(_0x386cd6){while(--_0x386cd6){_0xca3e47['push'](_0xca3e47['shift']());}};_0x3e09cf(++_0x49e3d1);}(_0x83af,0x1ec));var _0xf83a=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x83af[_0x3902c1];return _0x1266cc;};'use strict';var Sequelize=require(_0xf83a('0x0'));module[_0xf83a('0x1')]={'name':{'type':Sequelize[_0xf83a('0x2')]},'description':{'type':Sequelize[_0xf83a('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf83a('0x2')]},'authType':{'type':Sequelize[_0xf83a('0x3')](_0xf83a('0x4')),'defaultValue':_0xf83a('0x4')},'password':{'type':Sequelize[_0xf83a('0x2')]},'consumerKey':{'type':Sequelize[_0xf83a('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf83a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf83a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf83a('0x3')](_0xf83a('0x5'),_0xf83a('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9568028..7c54bbc 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 _0x75b2=['basic','headers','%s:%s','toString','base64','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','channel','Descriptions','DeskConfiguration','DeskField','Subjects','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json'];(function(_0x385865,_0x39b9fb){var _0x4e8d5d=function(_0x44da43){while(--_0x44da43){_0x385865['push'](_0x385865['shift']());}};_0x4e8d5d(++_0x39b9fb);}(_0x75b2,0x1ce));var _0x275b=function(_0x143ea6,_0x3c9999){_0x143ea6=_0x143ea6-0x0;var _0xfb14d=_0x75b2[_0x143ea6];return _0xfb14d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x275b('0x0'));var jsonpatch=require(_0x275b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x275b('0x2'));var path=require(_0x275b('0x3'));var sox=require(_0x275b('0x4'));var csv=require(_0x275b('0x5'));var ejs=require(_0x275b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x275b('0x7'));var squel=require('squel');var crypto=require(_0x275b('0x8'));var jsforce=require(_0x275b('0x9'));var deskjs=require(_0x275b('0xa'));var toCsv=require(_0x275b('0x5'));var querystring=require(_0x275b('0xb'));var Papa=require(_0x275b('0xc'));var Redis=require(_0x275b('0xd'));var authService=require(_0x275b('0xe'));var qs=require(_0x275b('0xf'));var as=require(_0x275b('0x10'));var hardwareService=require(_0x275b('0x11'));var logger=require(_0x275b('0x12'))(_0x275b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x275b('0x14'));var db=require(_0x275b('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2184d1,_0x2e3e75){_0x2e3e75=_0x2e3e75||0xcc;return function(_0xc6345f){if(_0xc6345f){return _0x2184d1[_0x275b('0x16')](_0x2e3e75);}return _0x2184d1[_0x275b('0x17')](_0x2e3e75)[_0x275b('0x18')]();};}function respondWithResult(_0x31c32e,_0x197d34){_0x197d34=_0x197d34||0xc8;return function(_0x3e60cd){if(_0x3e60cd){return _0x31c32e[_0x275b('0x17')](_0x197d34)[_0x275b('0x19')](_0x3e60cd);}};}function respondWithFilteredResult(_0xa84f24,_0x26fa1f){return function(_0x12f2df){if(_0x12f2df){var _0x54889b=typeof _0x26fa1f[_0x275b('0x1a')]===_0x275b('0x1b')&&typeof _0x26fa1f[_0x275b('0x1c')]===_0x275b('0x1b');var _0x569049=_0x12f2df['count'];var _0x3b78b1=_0x54889b?0x0:_0x26fa1f[_0x275b('0x1a')];var _0x4da809=_0x54889b?_0x12f2df[_0x275b('0x1d')]:_0x26fa1f[_0x275b('0x1a')]+_0x26fa1f[_0x275b('0x1c')];var _0x37b432;if(_0x4da809>=_0x569049){_0x4da809=_0x569049;_0x37b432=0xc8;}else{_0x37b432=0xce;}_0xa84f24[_0x275b('0x17')](_0x37b432);return _0xa84f24[_0x275b('0x1e')](_0x275b('0x1f'),_0x3b78b1+'-'+_0x4da809+'/'+_0x569049)[_0x275b('0x19')](_0x12f2df);}return null;};}function patchUpdates(_0x291963){return function(_0x3b1426){try{jsonpatch[_0x275b('0x20')](_0x3b1426,_0x291963,!![]);}catch(_0x2a6258){return BPromise[_0x275b('0x21')](_0x2a6258);}return _0x3b1426['save']();};}function saveUpdates(_0x381e67,_0x436c73){return function(_0x5a40eb){if(_0x5a40eb){return _0x5a40eb[_0x275b('0x22')](_0x381e67)[_0x275b('0x23')](function(_0x1251ae){return _0x1251ae;});}return null;};}function removeEntity(_0x181510,_0xc7b8d7){return function(_0x324298){if(_0x324298){return _0x324298[_0x275b('0x24')]()[_0x275b('0x23')](function(){_0x181510[_0x275b('0x17')](0xcc)[_0x275b('0x18')]();});}};}function handleEntityNotFound(_0x1532b4,_0x2935df){return function(_0xa3c94c){if(!_0xa3c94c){_0x1532b4['sendStatus'](0x194);}return _0xa3c94c;};}function handleError(_0x23d571,_0x51939e){_0x51939e=_0x51939e||0x1f4;return function(_0xfe7ddc){logger[_0x275b('0x25')](_0xfe7ddc[_0x275b('0x26')]);if(_0xfe7ddc[_0x275b('0x27')]){delete _0xfe7ddc[_0x275b('0x27')];}_0x23d571[_0x275b('0x17')](_0x51939e)[_0x275b('0x28')](_0xfe7ddc);};}exports[_0x275b('0x29')]=function(_0x5e8e03,_0x5c4cad){var _0x1f8e33={},_0x5e6a39={},_0x516107={'count':0x0,'rows':[]};var _0x2f39e0=_[_0x275b('0x2a')](db[_0x275b('0x2b')][_0x275b('0x2c')],function(_0x4e1501){return{'name':_0x4e1501[_0x275b('0x2d')],'type':_0x4e1501[_0x275b('0x2e')]['key']};});_0x5e6a39[_0x275b('0x2f')]=_[_0x275b('0x2a')](_0x2f39e0,_0x275b('0x27'));_0x5e6a39[_0x275b('0x30')]=_[_0x275b('0x31')](_0x5e8e03['query']);_0x5e6a39['filters']=_[_0x275b('0x32')](_0x5e6a39[_0x275b('0x2f')],_0x5e6a39['query']);_0x1f8e33[_0x275b('0x33')]=_[_0x275b('0x32')](_0x5e6a39['model'],qs[_0x275b('0x34')](_0x5e8e03['query']['fields']));_0x1f8e33['attributes']=_0x1f8e33[_0x275b('0x33')]['length']?_0x1f8e33[_0x275b('0x33')]:_0x5e6a39['model'];if(!_0x5e8e03[_0x275b('0x30')][_0x275b('0x35')](_0x275b('0x36'))){_0x1f8e33[_0x275b('0x1c')]=qs['limit'](_0x5e8e03['query'][_0x275b('0x1c')]);_0x1f8e33[_0x275b('0x1a')]=qs[_0x275b('0x1a')](_0x5e8e03[_0x275b('0x30')][_0x275b('0x1a')]);}_0x1f8e33[_0x275b('0x37')]=qs[_0x275b('0x38')](_0x5e8e03[_0x275b('0x30')][_0x275b('0x38')]);_0x1f8e33[_0x275b('0x39')]=qs['filters'](_[_0x275b('0x3a')](_0x5e8e03[_0x275b('0x30')],_0x5e6a39[_0x275b('0x3b')]),_0x2f39e0);if(_0x5e8e03['query'][_0x275b('0x3c')]){_0x1f8e33[_0x275b('0x39')]=_[_0x275b('0x3d')](_0x1f8e33['where'],{'$or':_[_0x275b('0x2a')](_0x2f39e0,function(_0x5ab6a8){if(_0x5ab6a8[_0x275b('0x2e')]!==_0x275b('0x3e')){var _0x57dc0b={};_0x57dc0b[_0x5ab6a8[_0x275b('0x27')]]={'$like':'%'+_0x5e8e03[_0x275b('0x30')][_0x275b('0x3c')]+'%'};return _0x57dc0b;}})});}_0x1f8e33=_['merge']({},_0x1f8e33,_0x5e8e03[_0x275b('0x3f')]);var _0x1b8670={'where':_0x1f8e33[_0x275b('0x39')]};return db['DeskAccount'][_0x275b('0x1d')](_0x1b8670)['then'](function(_0x431dc6){_0x516107[_0x275b('0x1d')]=_0x431dc6;if(_0x5e8e03['query'][_0x275b('0x40')]){_0x1f8e33[_0x275b('0x41')]=[{'all':!![]}];}return db['DeskAccount'][_0x275b('0x42')](_0x1f8e33);})[_0x275b('0x23')](function(_0xd36ba6){_0x516107[_0x275b('0x43')]=_0xd36ba6;return _0x516107;})[_0x275b('0x23')](respondWithFilteredResult(_0x5c4cad,_0x1f8e33))[_0x275b('0x44')](handleError(_0x5c4cad,null));};exports['show']=function(_0x282267,_0x5b25f1){var _0x46486c={'raw':![],'where':{'id':_0x282267[_0x275b('0x45')]['id']}},_0x13efda={};_0x13efda[_0x275b('0x2f')]=_['keys'](db[_0x275b('0x2b')][_0x275b('0x2c')]);_0x13efda['query']=_[_0x275b('0x31')](_0x282267[_0x275b('0x30')]);_0x13efda[_0x275b('0x3b')]=_['intersection'](_0x13efda[_0x275b('0x2f')],_0x13efda[_0x275b('0x30')]);_0x46486c[_0x275b('0x33')]=_[_0x275b('0x32')](_0x13efda[_0x275b('0x2f')],qs[_0x275b('0x34')](_0x282267[_0x275b('0x30')][_0x275b('0x34')]));_0x46486c[_0x275b('0x33')]=_0x46486c[_0x275b('0x33')][_0x275b('0x46')]?_0x46486c[_0x275b('0x33')]:_0x13efda['model'];if(_0x282267[_0x275b('0x30')][_0x275b('0x40')]){_0x46486c[_0x275b('0x41')]=[{'all':!![]}];}_0x46486c=_[_0x275b('0x3d')]({},_0x46486c,_0x282267[_0x275b('0x3f')]);return db['DeskAccount'][_0x275b('0x47')](_0x46486c)[_0x275b('0x23')](handleEntityNotFound(_0x5b25f1,null))['then'](respondWithResult(_0x5b25f1,null))[_0x275b('0x44')](handleError(_0x5b25f1,null));};exports[_0x275b('0x48')]=function(_0x519622,_0x41917e){return db[_0x275b('0x2b')][_0x275b('0x48')](_0x519622[_0x275b('0x49')],{})['then'](respondWithResult(_0x41917e,0xc9))[_0x275b('0x44')](handleError(_0x41917e,null));};exports[_0x275b('0x22')]=function(_0x24100a,_0x24f5ef){if(_0x24100a['body']['id']){delete _0x24100a[_0x275b('0x49')]['id'];}return db[_0x275b('0x2b')]['find']({'where':{'id':_0x24100a[_0x275b('0x45')]['id']}})[_0x275b('0x23')](handleEntityNotFound(_0x24f5ef,null))['then'](saveUpdates(_0x24100a['body'],null))[_0x275b('0x23')](respondWithResult(_0x24f5ef,null))[_0x275b('0x44')](handleError(_0x24f5ef,null));};exports[_0x275b('0x24')]=function(_0x455cea,_0x5ba23d){return db['DeskAccount']['find']({'where':{'id':_0x455cea[_0x275b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ba23d,null))[_0x275b('0x23')](removeEntity(_0x5ba23d,null))[_0x275b('0x44')](handleError(_0x5ba23d,null));};exports[_0x275b('0x4a')]=function(_0x2592da,_0x5d3719,_0x3dde1f){var _0x28df40={};var _0x5895d2={};var _0x5adbf8;var _0x281d94;return db[_0x275b('0x2b')][_0x275b('0x4b')]({'where':{'id':_0x2592da[_0x275b('0x45')]['id']}})[_0x275b('0x23')](handleEntityNotFound(_0x5d3719,null))[_0x275b('0x23')](function(_0x2a7b10){if(_0x2a7b10){_0x5adbf8=_0x2a7b10;_0x5895d2[_0x275b('0x2f')]=_[_0x275b('0x31')](db['DeskConfiguration'][_0x275b('0x2c')]);_0x5895d2[_0x275b('0x30')]=_[_0x275b('0x31')](_0x2592da[_0x275b('0x30')]);_0x5895d2['filters']=_[_0x275b('0x32')](_0x5895d2[_0x275b('0x2f')],_0x5895d2[_0x275b('0x30')]);_0x28df40[_0x275b('0x33')]=_[_0x275b('0x32')](_0x5895d2[_0x275b('0x2f')],qs['fields'](_0x2592da[_0x275b('0x30')]['fields']));_0x28df40[_0x275b('0x33')]=_0x28df40[_0x275b('0x33')][_0x275b('0x46')]?_0x28df40['attributes']:_0x5895d2[_0x275b('0x2f')];_0x28df40['order']=qs['sort'](_0x2592da[_0x275b('0x30')]['sort']);_0x28df40[_0x275b('0x39')]=qs['filters'](_[_0x275b('0x3a')](_0x2592da['query'],_0x5895d2[_0x275b('0x3b')]));if(_0x2592da[_0x275b('0x30')]['filter']){_0x28df40[_0x275b('0x39')]=_['merge'](_0x28df40['where'],{'$or':_[_0x275b('0x2a')](_0x28df40[_0x275b('0x33')],function(_0x5af010){var _0x2081ea={};_0x2081ea[_0x5af010]={'$like':'%'+_0x2592da[_0x275b('0x30')][_0x275b('0x3c')]+'%'};return _0x2081ea;})});}_0x28df40=_[_0x275b('0x3d')]({},_0x28df40,_0x2592da[_0x275b('0x3f')]);return _0x5adbf8[_0x275b('0x4a')](_0x28df40);}})[_0x275b('0x23')](function(_0x31114d){if(_0x31114d){_0x281d94=_0x31114d[_0x275b('0x46')];if(!_0x2592da[_0x275b('0x30')][_0x275b('0x35')](_0x275b('0x36'))){_0x28df40[_0x275b('0x1c')]=qs[_0x275b('0x1c')](_0x2592da['query']['limit']);_0x28df40['offset']=qs[_0x275b('0x1a')](_0x2592da[_0x275b('0x30')][_0x275b('0x1a')]);}return _0x5adbf8['getConfigurations'](_0x28df40);}})[_0x275b('0x23')](function(_0x160841){if(_0x160841){return _0x160841?{'count':_0x281d94,'rows':_0x160841}:null;}})[_0x275b('0x23')](respondWithResult(_0x5d3719,null))[_0x275b('0x44')](handleError(_0x5d3719,null));};exports[_0x275b('0x4c')]=function(_0x38b7ed,_0x52a4f8,_0x3e5c3d){if(_0x38b7ed[_0x275b('0x49')]['id']){delete _0x38b7ed[_0x275b('0x49')]['id'];}return db[_0x275b('0x2b')]['findOne']({'where':{'id':_0x38b7ed['params']['id']}})[_0x275b('0x23')](handleEntityNotFound(_0x52a4f8,null))[_0x275b('0x23')](function(_0x3bf175){if(_0x3bf175){_0x38b7ed['body'][_0x275b('0x4d')]=_0x3bf175['id'];_0x38b7ed['body']['Subjects']=integrations['getSubjects'](_0x38b7ed['body'][_0x275b('0x4e')],_0x38b7ed[_0x275b('0x49')][_0x275b('0x2e')]);_0x38b7ed[_0x275b('0x49')][_0x275b('0x4f')]=integrations['getDescriptions'](_0x38b7ed['body'][_0x275b('0x4e')],_0x38b7ed[_0x275b('0x49')][_0x275b('0x2e')]);return db[_0x275b('0x50')]['create'](_0x38b7ed[_0x275b('0x49')],{'include':[{'model':db[_0x275b('0x51')],'as':_0x275b('0x52')},{'model':db[_0x275b('0x51')],'as':_0x275b('0x4f')}]});}return null;})['then'](respondWithResult(_0x52a4f8,null))[_0x275b('0x44')](handleError(_0x52a4f8,null));};exports['getFields']=function(_0x173a2f,_0x448eb8,_0x154729){var _0x470219=[{'name':'priority','label':_0x275b('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 _0x27273d='';return db[_0x275b('0x2b')][_0x275b('0x4b')]({'where':{'id':_0x173a2f['params']['id']},'attributes':['id','remoteUri',_0x275b('0x54'),_0x275b('0x55'),_0x275b('0x56'),_0x275b('0x57'),_0x275b('0x58'),_0x275b('0x59'),_0x275b('0x5a')]})[_0x275b('0x23')](handleEntityNotFound(_0x448eb8,null))[_0x275b('0x23')](function(_0x16dbc7){if(_0x16dbc7){_0x27273d=_0x16dbc7['remoteUri'];var _0xa41e8a=_0x27273d[_0x275b('0x5b')](-0x1);if(_0xa41e8a==='/'){_0x27273d=_0x27273d[_0x275b('0x5c')](0x0,_0x27273d[_0x275b('0x5d')](_0xa41e8a));}var _0x47dd2e={'method':_0x275b('0x5e'),'uri':util[_0x275b('0x5f')](_0x275b('0x60'),_0x27273d),'headers':{'Content-Type':_0x275b('0x61'),'Accept':'application/json'},'json':!![]};if(_0x16dbc7[_0x275b('0x54')]===_0x275b('0x62')){_0x47dd2e[_0x275b('0x63')]['Authorization']=util[_0x275b('0x5f')]('Basic\x20%s',new Buffer(util['format'](_0x275b('0x64'),_0x16dbc7[_0x275b('0x55')],_0x16dbc7[_0x275b('0x56')]))[_0x275b('0x65')](_0x275b('0x66')));}return rp(_0x47dd2e)[_0x275b('0x23')](function(_0x35a125){return _0x470219['concat'](_[_0x275b('0x2a')](_0x35a125[_0x275b('0x67')][_0x275b('0x68')],function(_0x15bd45){return{'id':_0x15bd45[_0x275b('0x27')],'name':_0x15bd45[_0x275b('0x27')],'type':_0x15bd45['type'],'active':_0x15bd45[_0x275b('0x69')],'label':_0x15bd45['label'],'custom':!![]};}));});}})['then'](function(_0x1d7709){return{'count':_0x1d7709['length'],'rows':_0x1d7709};})[_0x275b('0x23')](respondWithResult(_0x448eb8,null))[_0x275b('0x44')](function(_0x234d5f){var _0x5a8737=_0x173a2f['query'][_0x275b('0x6a')]?0x1f4:_0x234d5f[_0x275b('0x6b')]||0x1f4;logger['error'](_0x275b('0x6c'),_0x275b('0x6d'),_0x5a8737,JSON[_0x275b('0x6e')](_0x234d5f));delete _0x234d5f[_0x275b('0x27')];if(_0x5a8737===0x191){_0x5a8737=0x190;}_0x448eb8['status'](_0x5a8737)[_0x275b('0x28')](_0x173a2f['query'][_0x275b('0x6a')]?{'message':_0x275b('0x6f'),'statusCode':_0x234d5f[_0x275b('0x6b')]}:_0x234d5f);});}; \ No newline at end of file +var _0xb074=['password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','base64','concat','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','show','params','options','catch','body','find','getConfigurations','findOne','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','create','DeskField','Subjects','getFields','priority','authType'];(function(_0x429e11,_0x5566dd){var _0x20a53c=function(_0x1b6e11){while(--_0x1b6e11){_0x429e11['push'](_0x429e11['shift']());}};_0x20a53c(++_0x5566dd);}(_0xb074,0xfb));var _0x4b07=function(_0x5cff18,_0x5615f5){_0x5cff18=_0x5cff18-0x0;var _0x33027d=_0xb074[_0x5cff18];return _0x33027d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b07('0x0'));var zipdir=require(_0x4b07('0x1'));var jsonpatch=require(_0x4b07('0x2'));var rp=require(_0x4b07('0x3'));var moment=require(_0x4b07('0x4'));var BPromise=require(_0x4b07('0x5'));var Mustache=require(_0x4b07('0x6'));var util=require('util');var path=require(_0x4b07('0x7'));var sox=require(_0x4b07('0x8'));var csv=require(_0x4b07('0x9'));var ejs=require(_0x4b07('0xa'));var fs=require('fs');var fs_extra=require(_0x4b07('0xb'));var _=require('lodash');var squel=require(_0x4b07('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b07('0xd'));var deskjs=require(_0x4b07('0xe'));var toCsv=require(_0x4b07('0x9'));var querystring=require(_0x4b07('0xf'));var Papa=require(_0x4b07('0x10'));var Redis=require(_0x4b07('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b07('0x12'));var as=require(_0x4b07('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b07('0x14'))(_0x4b07('0x15'));var utils=require(_0x4b07('0x16'));var config=require(_0x4b07('0x17'));var licenseUtil=require(_0x4b07('0x18'));var db=require(_0x4b07('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5cfa4b,_0x5ddecd){_0x5ddecd=_0x5ddecd||0xcc;return function(_0x3e8873){if(_0x3e8873){return _0x5cfa4b[_0x4b07('0x1a')](_0x5ddecd);}return _0x5cfa4b[_0x4b07('0x1b')](_0x5ddecd)['end']();};}function respondWithResult(_0x523d76,_0x4ef9b5){_0x4ef9b5=_0x4ef9b5||0xc8;return function(_0x4825d4){if(_0x4825d4){return _0x523d76['status'](_0x4ef9b5)['json'](_0x4825d4);}};}function respondWithFilteredResult(_0x4aa878,_0x792a8a){return function(_0x3fa032){if(_0x3fa032){var _0x1380a4=typeof _0x792a8a[_0x4b07('0x1c')]==='undefined'&&typeof _0x792a8a[_0x4b07('0x1d')]==='undefined';var _0x279d16=_0x3fa032[_0x4b07('0x1e')];var _0x2034ae=_0x1380a4?0x0:_0x792a8a[_0x4b07('0x1c')];var _0x3ae919=_0x1380a4?_0x3fa032['count']:_0x792a8a[_0x4b07('0x1c')]+_0x792a8a['limit'];var _0x287f3f;if(_0x3ae919>=_0x279d16){_0x3ae919=_0x279d16;_0x287f3f=0xc8;}else{_0x287f3f=0xce;}_0x4aa878[_0x4b07('0x1b')](_0x287f3f);return _0x4aa878[_0x4b07('0x1f')](_0x4b07('0x20'),_0x2034ae+'-'+_0x3ae919+'/'+_0x279d16)['json'](_0x3fa032);}return null;};}function patchUpdates(_0x1e6126){return function(_0xf4d804){try{jsonpatch[_0x4b07('0x21')](_0xf4d804,_0x1e6126,!![]);}catch(_0x3a352a){return BPromise[_0x4b07('0x22')](_0x3a352a);}return _0xf4d804[_0x4b07('0x23')]();};}function saveUpdates(_0x41443f,_0x5662f2){return function(_0x4752f0){if(_0x4752f0){return _0x4752f0[_0x4b07('0x24')](_0x41443f)[_0x4b07('0x25')](function(_0x531039){return _0x531039;});}return null;};}function removeEntity(_0x16cf51,_0x51f0d9){return function(_0x5cc0b9){if(_0x5cc0b9){return _0x5cc0b9[_0x4b07('0x26')]()[_0x4b07('0x25')](function(){_0x16cf51[_0x4b07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429ded,_0x32e876){return function(_0x5c6f45){if(!_0x5c6f45){_0x429ded[_0x4b07('0x1a')](0x194);}return _0x5c6f45;};}function handleError(_0x212e1c,_0x1c7b37){_0x1c7b37=_0x1c7b37||0x1f4;return function(_0x45cf6d){logger[_0x4b07('0x27')](_0x45cf6d[_0x4b07('0x28')]);if(_0x45cf6d['name']){delete _0x45cf6d[_0x4b07('0x29')];}_0x212e1c[_0x4b07('0x1b')](_0x1c7b37)['send'](_0x45cf6d);};}exports[_0x4b07('0x2a')]=function(_0x132b82,_0xbaed57){var _0x296cab={},_0x5e4270={},_0x561a55={'count':0x0,'rows':[]};var _0x525e2d=_[_0x4b07('0x2b')](db[_0x4b07('0x2c')][_0x4b07('0x2d')],function(_0x4b5e73){return{'name':_0x4b5e73[_0x4b07('0x2e')],'type':_0x4b5e73['type'][_0x4b07('0x2f')]};});_0x5e4270[_0x4b07('0x30')]=_[_0x4b07('0x2b')](_0x525e2d,_0x4b07('0x29'));_0x5e4270['query']=_[_0x4b07('0x31')](_0x132b82[_0x4b07('0x32')]);_0x5e4270['filters']=_[_0x4b07('0x33')](_0x5e4270[_0x4b07('0x30')],_0x5e4270[_0x4b07('0x32')]);_0x296cab[_0x4b07('0x34')]=_['intersection'](_0x5e4270[_0x4b07('0x30')],qs[_0x4b07('0x35')](_0x132b82[_0x4b07('0x32')][_0x4b07('0x35')]));_0x296cab[_0x4b07('0x34')]=_0x296cab['attributes'][_0x4b07('0x36')]?_0x296cab[_0x4b07('0x34')]:_0x5e4270[_0x4b07('0x30')];if(!_0x132b82[_0x4b07('0x32')][_0x4b07('0x37')](_0x4b07('0x38'))){_0x296cab[_0x4b07('0x1d')]=qs[_0x4b07('0x1d')](_0x132b82[_0x4b07('0x32')][_0x4b07('0x1d')]);_0x296cab['offset']=qs[_0x4b07('0x1c')](_0x132b82['query']['offset']);}_0x296cab[_0x4b07('0x39')]=qs[_0x4b07('0x3a')](_0x132b82[_0x4b07('0x32')]['sort']);_0x296cab[_0x4b07('0x3b')]=qs[_0x4b07('0x3c')](_[_0x4b07('0x3d')](_0x132b82[_0x4b07('0x32')],_0x5e4270[_0x4b07('0x3c')]),_0x525e2d);if(_0x132b82[_0x4b07('0x32')][_0x4b07('0x3e')]){_0x296cab[_0x4b07('0x3b')]=_[_0x4b07('0x3f')](_0x296cab[_0x4b07('0x3b')],{'$or':_[_0x4b07('0x2b')](_0x525e2d,function(_0x3e992c){if(_0x3e992c[_0x4b07('0x40')]!==_0x4b07('0x41')){var _0x59f908={};_0x59f908[_0x3e992c[_0x4b07('0x29')]]={'$like':'%'+_0x132b82[_0x4b07('0x32')]['filter']+'%'};return _0x59f908;}})});}_0x296cab=_[_0x4b07('0x3f')]({},_0x296cab,_0x132b82['options']);var _0xd5f5b7={'where':_0x296cab['where']};return db[_0x4b07('0x2c')][_0x4b07('0x1e')](_0xd5f5b7)['then'](function(_0x26d23c){_0x561a55['count']=_0x26d23c;if(_0x132b82[_0x4b07('0x32')][_0x4b07('0x42')]){_0x296cab[_0x4b07('0x43')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x296cab);})['then'](function(_0xbb2370){_0x561a55['rows']=_0xbb2370;return _0x561a55;})[_0x4b07('0x25')](respondWithFilteredResult(_0xbaed57,_0x296cab))['catch'](handleError(_0xbaed57,null));};exports[_0x4b07('0x44')]=function(_0x223e82,_0x3a34a6){var _0x587f9e={'raw':![],'where':{'id':_0x223e82[_0x4b07('0x45')]['id']}},_0x325b27={};_0x325b27[_0x4b07('0x30')]=_[_0x4b07('0x31')](db[_0x4b07('0x2c')][_0x4b07('0x2d')]);_0x325b27[_0x4b07('0x32')]=_[_0x4b07('0x31')](_0x223e82[_0x4b07('0x32')]);_0x325b27[_0x4b07('0x3c')]=_[_0x4b07('0x33')](_0x325b27[_0x4b07('0x30')],_0x325b27[_0x4b07('0x32')]);_0x587f9e[_0x4b07('0x34')]=_['intersection'](_0x325b27[_0x4b07('0x30')],qs['fields'](_0x223e82[_0x4b07('0x32')]['fields']));_0x587f9e[_0x4b07('0x34')]=_0x587f9e['attributes'][_0x4b07('0x36')]?_0x587f9e[_0x4b07('0x34')]:_0x325b27[_0x4b07('0x30')];if(_0x223e82['query']['includeAll']){_0x587f9e[_0x4b07('0x43')]=[{'all':!![]}];}_0x587f9e=_['merge']({},_0x587f9e,_0x223e82[_0x4b07('0x46')]);return db[_0x4b07('0x2c')]['find'](_0x587f9e)[_0x4b07('0x25')](handleEntityNotFound(_0x3a34a6,null))[_0x4b07('0x25')](respondWithResult(_0x3a34a6,null))[_0x4b07('0x47')](handleError(_0x3a34a6,null));};exports['create']=function(_0x11afe0,_0x40873b){return db[_0x4b07('0x2c')]['create'](_0x11afe0[_0x4b07('0x48')],{})['then'](respondWithResult(_0x40873b,0xc9))['catch'](handleError(_0x40873b,null));};exports['update']=function(_0x188126,_0x10cef5){if(_0x188126[_0x4b07('0x48')]['id']){delete _0x188126['body']['id'];}return db[_0x4b07('0x2c')][_0x4b07('0x49')]({'where':{'id':_0x188126[_0x4b07('0x45')]['id']}})[_0x4b07('0x25')](handleEntityNotFound(_0x10cef5,null))['then'](saveUpdates(_0x188126['body'],null))[_0x4b07('0x25')](respondWithResult(_0x10cef5,null))[_0x4b07('0x47')](handleError(_0x10cef5,null));};exports[_0x4b07('0x26')]=function(_0x4e562f,_0x2acd3c){return db[_0x4b07('0x2c')]['find']({'where':{'id':_0x4e562f[_0x4b07('0x45')]['id']}})[_0x4b07('0x25')](handleEntityNotFound(_0x2acd3c,null))['then'](removeEntity(_0x2acd3c,null))[_0x4b07('0x47')](handleError(_0x2acd3c,null));};exports[_0x4b07('0x4a')]=function(_0x1df049,_0x1059f5,_0x39e589){var _0x1e5b54={};var _0x483c2c={};var _0x46ad71;var _0x2caf61;return db[_0x4b07('0x2c')][_0x4b07('0x4b')]({'where':{'id':_0x1df049[_0x4b07('0x45')]['id']}})[_0x4b07('0x25')](handleEntityNotFound(_0x1059f5,null))[_0x4b07('0x25')](function(_0x2eb6de){if(_0x2eb6de){_0x46ad71=_0x2eb6de;_0x483c2c['model']=_[_0x4b07('0x31')](db['DeskConfiguration'][_0x4b07('0x2d')]);_0x483c2c[_0x4b07('0x32')]=_[_0x4b07('0x31')](_0x1df049[_0x4b07('0x32')]);_0x483c2c[_0x4b07('0x3c')]=_[_0x4b07('0x33')](_0x483c2c[_0x4b07('0x30')],_0x483c2c['query']);_0x1e5b54['attributes']=_[_0x4b07('0x33')](_0x483c2c['model'],qs['fields'](_0x1df049[_0x4b07('0x32')][_0x4b07('0x35')]));_0x1e5b54[_0x4b07('0x34')]=_0x1e5b54[_0x4b07('0x34')][_0x4b07('0x36')]?_0x1e5b54[_0x4b07('0x34')]:_0x483c2c[_0x4b07('0x30')];_0x1e5b54[_0x4b07('0x39')]=qs[_0x4b07('0x3a')](_0x1df049['query'][_0x4b07('0x3a')]);_0x1e5b54[_0x4b07('0x3b')]=qs[_0x4b07('0x3c')](_[_0x4b07('0x3d')](_0x1df049[_0x4b07('0x32')],_0x483c2c[_0x4b07('0x3c')]));if(_0x1df049[_0x4b07('0x32')]['filter']){_0x1e5b54[_0x4b07('0x3b')]=_[_0x4b07('0x3f')](_0x1e5b54[_0x4b07('0x3b')],{'$or':_[_0x4b07('0x2b')](_0x1e5b54[_0x4b07('0x34')],function(_0x457c76){var _0x55a3f1={};_0x55a3f1[_0x457c76]={'$like':'%'+_0x1df049['query'][_0x4b07('0x3e')]+'%'};return _0x55a3f1;})});}_0x1e5b54=_[_0x4b07('0x3f')]({},_0x1e5b54,_0x1df049['options']);return _0x46ad71[_0x4b07('0x4a')](_0x1e5b54);}})[_0x4b07('0x25')](function(_0x128c0a){if(_0x128c0a){_0x2caf61=_0x128c0a[_0x4b07('0x36')];if(!_0x1df049[_0x4b07('0x32')][_0x4b07('0x37')](_0x4b07('0x38'))){_0x1e5b54['limit']=qs[_0x4b07('0x1d')](_0x1df049[_0x4b07('0x32')][_0x4b07('0x1d')]);_0x1e5b54[_0x4b07('0x1c')]=qs[_0x4b07('0x1c')](_0x1df049[_0x4b07('0x32')][_0x4b07('0x1c')]);}return _0x46ad71['getConfigurations'](_0x1e5b54);}})[_0x4b07('0x25')](function(_0x3ab03a){if(_0x3ab03a){return _0x3ab03a?{'count':_0x2caf61,'rows':_0x3ab03a}:null;}})['then'](respondWithResult(_0x1059f5,null))[_0x4b07('0x47')](handleError(_0x1059f5,null));};exports[_0x4b07('0x4c')]=function(_0x120a18,_0x22a064,_0x2abdbf){if(_0x120a18[_0x4b07('0x48')]['id']){delete _0x120a18[_0x4b07('0x48')]['id'];}return db[_0x4b07('0x2c')][_0x4b07('0x4b')]({'where':{'id':_0x120a18[_0x4b07('0x45')]['id']}})[_0x4b07('0x25')](handleEntityNotFound(_0x22a064,null))['then'](function(_0x1cce59){if(_0x1cce59){_0x120a18[_0x4b07('0x48')]['AccountId']=_0x1cce59['id'];_0x120a18[_0x4b07('0x48')]['Subjects']=integrations[_0x4b07('0x4d')](_0x120a18[_0x4b07('0x48')][_0x4b07('0x4e')],_0x120a18[_0x4b07('0x48')][_0x4b07('0x40')]);_0x120a18[_0x4b07('0x48')][_0x4b07('0x4f')]=integrations[_0x4b07('0x50')](_0x120a18['body'][_0x4b07('0x4e')],_0x120a18[_0x4b07('0x48')]['type']);return db[_0x4b07('0x51')][_0x4b07('0x52')](_0x120a18['body'],{'include':[{'model':db[_0x4b07('0x53')],'as':_0x4b07('0x54')},{'model':db[_0x4b07('0x53')],'as':_0x4b07('0x4f')}]});}return null;})[_0x4b07('0x25')](respondWithResult(_0x22a064,null))[_0x4b07('0x47')](handleError(_0x22a064,null));};exports[_0x4b07('0x55')]=function(_0x48b02e,_0x4294e7,_0x4ae5fb){var _0x32f1f2=[{'name':_0x4b07('0x56'),'label':_0x4b07('0x56'),'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 _0xda826f='';return db[_0x4b07('0x2c')][_0x4b07('0x4b')]({'where':{'id':_0x48b02e[_0x4b07('0x45')]['id']},'attributes':['id','remoteUri',_0x4b07('0x57'),'username',_0x4b07('0x58'),_0x4b07('0x59'),_0x4b07('0x5a'),_0x4b07('0x5b'),_0x4b07('0x5c')]})['then'](handleEntityNotFound(_0x4294e7,null))[_0x4b07('0x25')](function(_0x340993){if(_0x340993){_0xda826f=_0x340993[_0x4b07('0x5d')];var _0xc6a08d=_0xda826f[_0x4b07('0x5e')](-0x1);if(_0xc6a08d==='/'){_0xda826f=_0xda826f['substring'](0x0,_0xda826f['lastIndexOf'](_0xc6a08d));}var _0x355745={'method':_0x4b07('0x5f'),'uri':util[_0x4b07('0x60')](_0x4b07('0x61'),_0xda826f),'headers':{'Content-Type':_0x4b07('0x62'),'Accept':_0x4b07('0x62')},'json':!![]};if(_0x340993[_0x4b07('0x57')]===_0x4b07('0x63')){_0x355745[_0x4b07('0x64')][_0x4b07('0x65')]=util[_0x4b07('0x60')]('Basic\x20%s',new Buffer(util[_0x4b07('0x60')](_0x4b07('0x66'),_0x340993['username'],_0x340993[_0x4b07('0x58')]))['toString'](_0x4b07('0x67')));}return rp(_0x355745)['then'](function(_0xc698b1){return _0x32f1f2[_0x4b07('0x68')](_[_0x4b07('0x2b')](_0xc698b1['_embedded'][_0x4b07('0x69')],function(_0x2ddf8c){return{'id':_0x2ddf8c[_0x4b07('0x29')],'name':_0x2ddf8c[_0x4b07('0x29')],'type':_0x2ddf8c[_0x4b07('0x40')],'active':_0x2ddf8c[_0x4b07('0x6a')],'label':_0x2ddf8c[_0x4b07('0x6b')],'custom':!![]};}));});}})[_0x4b07('0x25')](function(_0x30bbd5){return{'count':_0x30bbd5[_0x4b07('0x36')],'rows':_0x30bbd5};})[_0x4b07('0x25')](respondWithResult(_0x4294e7,null))[_0x4b07('0x47')](function(_0x1896fd){var _0x3b9c2e=_0x48b02e[_0x4b07('0x32')][_0x4b07('0x6c')]?0x1f4:_0x1896fd['statusCode']||0x1f4;logger[_0x4b07('0x27')](_0x4b07('0x6d'),_0x4b07('0x55'),_0x3b9c2e,JSON[_0x4b07('0x6e')](_0x1896fd));delete _0x1896fd['name'];if(_0x3b9c2e===0x191){_0x3b9c2e=0x190;}_0x4294e7[_0x4b07('0x1b')](_0x3b9c2e)['send'](_0x48b02e[_0x4b07('0x32')][_0x4b07('0x6c')]?{'message':_0x4b07('0x6f'),'statusCode':_0x1896fd[_0x4b07('0x70')]}:_0x1896fd);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 72dde96..db42c07 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 _0x798f=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x5c4990,_0x48c934){var _0x414a8e=function(_0x2bea0c){while(--_0x2bea0c){_0x5c4990['push'](_0x5c4990['shift']());}};_0x414a8e(++_0x48c934);}(_0x798f,0x96));var _0xf798=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x798f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf798('0x0'));var util=require(_0xf798('0x1'));var logger=require(_0xf798('0x2'))('api');var moment=require(_0xf798('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf798('0x4'));var rimraf=require(_0xf798('0x5'));var config=require(_0xf798('0x6'));var attributes=require(_0xf798('0x7'));var integrations=require(_0xf798('0x8'));module[_0xf798('0x9')]=function(_0x29d86f,_0x23496e){return _0x29d86f[_0xf798('0xa')](_0xf798('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e33=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x3e33,0x1ef));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x33e3('0x0'));var logger=require(_0x33e3('0x1'))(_0x33e3('0x2'));var moment=require('moment');var BPromise=require(_0x33e3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33e3('0x4'));var rimraf=require(_0x33e3('0x5'));var config=require(_0x33e3('0x6'));var attributes=require(_0x33e3('0x7'));var integrations=require(_0x33e3('0x8'));module['exports']=function(_0xe2231c,_0x75cf8e){return _0xe2231c['define'](_0x33e3('0x9'),attributes,{'tableName':_0x33e3('0xa'),'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 e00b1f8..01799ec 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 _0x001e=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','ShowDeskAccount','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1be71b,_0x478a01){var _0x2d7a6c=function(_0x1a907a){while(--_0x1a907a){_0x1be71b['push'](_0x1be71b['shift']());}};_0x2d7a6c(++_0x478a01);}(_0x001e,0x195));var _0xe001=function(_0xa51ba0,_0x3bf58d){_0xa51ba0=_0xa51ba0-0x0;var _0x17f343=_0x001e[_0xa51ba0];return _0x17f343;};'use strict';var _=require('lodash');var util=require(_0xe001('0x0'));var moment=require(_0xe001('0x1'));var BPromise=require('bluebird');var rs=require(_0xe001('0x2'));var fs=require('fs');var Redis=require(_0xe001('0x3'));var db=require(_0xe001('0x4'))['db'];var utils=require(_0xe001('0x5'));var logger=require(_0xe001('0x6'))(_0xe001('0x7'));var config=require(_0xe001('0x8'));var jayson=require(_0xe001('0x9'));var client=jayson['client'][_0xe001('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41151c,_0x2ee503,_0x1abae1){return new BPromise(function(_0x1fdd97,_0x45d2d0){return client['request'](_0x41151c,_0x1abae1)[_0xe001('0xb')](function(_0x49f347){logger[_0xe001('0xc')](_0xe001('0xd'),_0x2ee503,_0xe001('0xe'));logger[_0xe001('0xf')](_0xe001('0x10'),_0x2ee503,_0xe001('0xe'),JSON[_0xe001('0x11')](_0x49f347));if(_0x49f347[_0xe001('0x12')]){if(_0x49f347['error']['code']===0x1f4){logger[_0xe001('0x12')](_0xe001('0xd'),_0x2ee503,_0x49f347[_0xe001('0x12')][_0xe001('0x13')]);return _0x45d2d0(_0x49f347[_0xe001('0x12')][_0xe001('0x13')]);}logger[_0xe001('0x12')](_0xe001('0xd'),_0x2ee503,_0x49f347[_0xe001('0x12')]['message']);return _0x1fdd97(_0x49f347['error'][_0xe001('0x13')]);}else{logger[_0xe001('0xc')](_0xe001('0xd'),_0x2ee503,'request\x20sent');_0x1fdd97(_0x49f347[_0xe001('0x14')][_0xe001('0x13')]);}})[_0xe001('0x15')](function(_0x1b95a5){logger[_0xe001('0x12')](_0xe001('0xd'),_0x2ee503,_0x1b95a5);_0x45d2d0(_0x1b95a5);});});}exports['GetDeskAccount']=function(_0x47da88){var _0x345c91=this;return new Promise(function(_0x8bdde0,_0x154513){return db[_0xe001('0x16')][_0xe001('0x17')]({'raw':_0x47da88[_0xe001('0x18')]?_0x47da88[_0xe001('0x18')][_0xe001('0x19')]===undefined?!![]:![]:!![],'where':_0x47da88[_0xe001('0x18')]?_0x47da88[_0xe001('0x18')][_0xe001('0x1a')]||null:null,'attributes':_0x47da88[_0xe001('0x18')]?_0x47da88['options'][_0xe001('0x1b')]||null:null,'limit':_0x47da88[_0xe001('0x18')]?_0x47da88[_0xe001('0x18')][_0xe001('0x1c')]||null:null,'include':_0x47da88['options']?_0x47da88[_0xe001('0x18')]['include']?_[_0xe001('0x1d')](_0x47da88[_0xe001('0x18')][_0xe001('0x1e')],function(_0x14e96a){return{'model':db[_0x14e96a[_0xe001('0x1f')]],'as':_0x14e96a['as'],'attributes':_0x14e96a[_0xe001('0x1b')],'include':_0x14e96a[_0xe001('0x1e')]?_[_0xe001('0x1d')](_0x14e96a[_0xe001('0x1e')],function(_0x13f95b){return{'model':db[_0x13f95b[_0xe001('0x1f')]],'as':_0x13f95b['as'],'attributes':_0x13f95b['attributes'],'include':_0x13f95b['include']?_['map'](_0x13f95b['include'],function(_0x128f29){return{'model':db[_0x128f29[_0xe001('0x1f')]],'as':_0x128f29['as'],'attributes':_0x128f29[_0xe001('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe001('0xb')](function(_0x19cac5){logger['info'](_0xe001('0x20'),_0x47da88);logger['debug']('GetDeskAccount',_0x47da88,JSON[_0xe001('0x11')](_0x19cac5));_0x8bdde0(_0x19cac5);})[_0xe001('0x15')](function(_0x2cb8cb){logger[_0xe001('0x12')](_0xe001('0x20'),_0x2cb8cb['message'],_0x47da88);_0x154513(_0x345c91[_0xe001('0x12')](0x1f4,_0x2cb8cb[_0xe001('0x13')]));});});};exports[_0xe001('0x21')]=function(_0x5464ce){var _0x40a924=this;return new Promise(function(_0x2588f3,_0x520faf){return db['DeskAccount'][_0xe001('0x22')]({'raw':_0x5464ce[_0xe001('0x18')]?_0x5464ce['options']['raw']===undefined?!![]:![]:!![],'where':_0x5464ce['options']?_0x5464ce['options'][_0xe001('0x1a')]||null:null,'attributes':_0x5464ce[_0xe001('0x18')]?_0x5464ce[_0xe001('0x18')][_0xe001('0x1b')]||null:null,'include':_0x5464ce['options']?_0x5464ce[_0xe001('0x18')][_0xe001('0x1e')]?_[_0xe001('0x1d')](_0x5464ce[_0xe001('0x18')]['include'],function(_0x30d47e){return{'model':db[_0x30d47e[_0xe001('0x1f')]],'as':_0x30d47e['as'],'attributes':_0x30d47e['attributes'],'include':_0x30d47e['include']?_[_0xe001('0x1d')](_0x30d47e[_0xe001('0x1e')],function(_0x536fce){return{'model':db[_0x536fce[_0xe001('0x1f')]],'as':_0x536fce['as'],'attributes':_0x536fce[_0xe001('0x1b')],'include':_0x536fce[_0xe001('0x1e')]?_[_0xe001('0x1d')](_0x536fce[_0xe001('0x1e')],function(_0x52af5b){return{'model':db[_0x52af5b[_0xe001('0x1f')]],'as':_0x52af5b['as'],'attributes':_0x52af5b[_0xe001('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe001('0xb')](function(_0x462612){logger['info'](_0xe001('0x21'),_0x5464ce);logger[_0xe001('0xf')](_0xe001('0x21'),_0x5464ce,JSON['stringify'](_0x462612));_0x2588f3(_0x462612);})[_0xe001('0x15')](function(_0x34b38b){logger[_0xe001('0x12')]('ShowDeskAccount',_0x34b38b[_0xe001('0x13')],_0x5464ce);_0x520faf(_0x40a924[_0xe001('0x12')](0x1f4,_0x34b38b[_0xe001('0x13')]));});});}; \ No newline at end of file +var _0x55d2=['../../config/logger','rpc','../../config/environment','http','request','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDeskAccount','DeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x55d2,0x66));var _0x255d=function(_0x5c8f3e,_0x11f776){_0x5c8f3e=_0x5c8f3e-0x0;var _0x26f42f=_0x55d2[_0x5c8f3e];return _0x26f42f;};'use strict';var _=require(_0x255d('0x0'));var util=require(_0x255d('0x1'));var moment=require('moment');var BPromise=require(_0x255d('0x2'));var rs=require(_0x255d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x255d('0x4'))['db'];var utils=require(_0x255d('0x5'));var logger=require(_0x255d('0x6'))(_0x255d('0x7'));var config=require(_0x255d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x255d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f06d,_0x2715b9,_0x67fb5c){return new BPromise(function(_0x150d9d,_0x350273){return client[_0x255d('0xa')](_0x49f06d,_0x67fb5c)['then'](function(_0x28a318){logger['info'](_0x255d('0xb'),_0x2715b9,'request\x20sent');logger[_0x255d('0xc')](_0x255d('0xd'),_0x2715b9,_0x255d('0xe'),JSON[_0x255d('0xf')](_0x28a318));if(_0x28a318[_0x255d('0x10')]){if(_0x28a318[_0x255d('0x10')][_0x255d('0x11')]===0x1f4){logger[_0x255d('0x10')]('DeskAccount,\x20%s,\x20%s',_0x2715b9,_0x28a318[_0x255d('0x10')][_0x255d('0x12')]);return _0x350273(_0x28a318[_0x255d('0x10')][_0x255d('0x12')]);}logger[_0x255d('0x10')](_0x255d('0xb'),_0x2715b9,_0x28a318[_0x255d('0x10')][_0x255d('0x12')]);return _0x150d9d(_0x28a318[_0x255d('0x10')][_0x255d('0x12')]);}else{logger[_0x255d('0x13')](_0x255d('0xb'),_0x2715b9,'request\x20sent');_0x150d9d(_0x28a318[_0x255d('0x14')]['message']);}})[_0x255d('0x15')](function(_0x47701a){logger[_0x255d('0x10')](_0x255d('0xb'),_0x2715b9,_0x47701a);_0x350273(_0x47701a);});});}exports[_0x255d('0x16')]=function(_0x4bd8f7){var _0x352bf4=this;return new Promise(function(_0x24637a,_0x1eb8a7){return db['DeskAccount'][_0x255d('0x17')]({'raw':_0x4bd8f7[_0x255d('0x18')]?_0x4bd8f7[_0x255d('0x18')][_0x255d('0x19')]===undefined?!![]:![]:!![],'where':_0x4bd8f7[_0x255d('0x18')]?_0x4bd8f7[_0x255d('0x18')][_0x255d('0x1a')]||null:null,'attributes':_0x4bd8f7[_0x255d('0x18')]?_0x4bd8f7[_0x255d('0x18')][_0x255d('0x1b')]||null:null,'limit':_0x4bd8f7[_0x255d('0x18')]?_0x4bd8f7[_0x255d('0x18')][_0x255d('0x1c')]||null:null,'include':_0x4bd8f7[_0x255d('0x18')]?_0x4bd8f7[_0x255d('0x18')]['include']?_[_0x255d('0x1d')](_0x4bd8f7[_0x255d('0x18')][_0x255d('0x1e')],function(_0x170961){return{'model':db[_0x170961[_0x255d('0x1f')]],'as':_0x170961['as'],'attributes':_0x170961[_0x255d('0x1b')],'include':_0x170961['include']?_['map'](_0x170961[_0x255d('0x1e')],function(_0x46f478){return{'model':db[_0x46f478[_0x255d('0x1f')]],'as':_0x46f478['as'],'attributes':_0x46f478['attributes'],'include':_0x46f478[_0x255d('0x1e')]?_[_0x255d('0x1d')](_0x46f478['include'],function(_0x3a95fd){return{'model':db[_0x3a95fd[_0x255d('0x1f')]],'as':_0x3a95fd['as'],'attributes':_0x3a95fd[_0x255d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x255d('0x20')](function(_0x3d97a4){logger[_0x255d('0x13')](_0x255d('0x16'),_0x4bd8f7);logger[_0x255d('0xc')](_0x255d('0x16'),_0x4bd8f7,JSON['stringify'](_0x3d97a4));_0x24637a(_0x3d97a4);})[_0x255d('0x15')](function(_0x201390){logger[_0x255d('0x10')](_0x255d('0x16'),_0x201390[_0x255d('0x12')],_0x4bd8f7);_0x1eb8a7(_0x352bf4[_0x255d('0x10')](0x1f4,_0x201390['message']));});});};exports[_0x255d('0x21')]=function(_0x2492e3){var _0x18da54=this;return new Promise(function(_0x3b505b,_0x104dfc){return db[_0x255d('0x22')][_0x255d('0x23')]({'raw':_0x2492e3[_0x255d('0x18')]?_0x2492e3[_0x255d('0x18')][_0x255d('0x19')]===undefined?!![]:![]:!![],'where':_0x2492e3['options']?_0x2492e3['options'][_0x255d('0x1a')]||null:null,'attributes':_0x2492e3[_0x255d('0x18')]?_0x2492e3[_0x255d('0x18')]['attributes']||null:null,'include':_0x2492e3[_0x255d('0x18')]?_0x2492e3['options'][_0x255d('0x1e')]?_[_0x255d('0x1d')](_0x2492e3['options'][_0x255d('0x1e')],function(_0x2eeaaa){return{'model':db[_0x2eeaaa[_0x255d('0x1f')]],'as':_0x2eeaaa['as'],'attributes':_0x2eeaaa['attributes'],'include':_0x2eeaaa['include']?_[_0x255d('0x1d')](_0x2eeaaa[_0x255d('0x1e')],function(_0xfcda07){return{'model':db[_0xfcda07[_0x255d('0x1f')]],'as':_0xfcda07['as'],'attributes':_0xfcda07['attributes'],'include':_0xfcda07[_0x255d('0x1e')]?_['map'](_0xfcda07['include'],function(_0x25c47e){return{'model':db[_0x25c47e[_0x255d('0x1f')]],'as':_0x25c47e['as'],'attributes':_0x25c47e[_0x255d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x255d('0x20')](function(_0x3ae84e){logger[_0x255d('0x13')](_0x255d('0x21'),_0x2492e3);logger[_0x255d('0xc')](_0x255d('0x21'),_0x2492e3,JSON[_0x255d('0xf')](_0x3ae84e));_0x3b505b(_0x3ae84e);})[_0x255d('0x15')](function(_0x36b840){logger['error']('ShowDeskAccount',_0x36b840[_0x255d('0x12')],_0x2492e3);_0x104dfc(_0x18da54[_0x255d('0x10')](0x1f4,_0x36b840['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 50f155c..4786a46 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x55ca,0x126));var _0xa55c=function(_0x59ee9c,_0x43f62d){_0x59ee9c=_0x59ee9c-0x0;var _0x44a2a8=_0x55ca[_0x59ee9c];return _0x44a2a8;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x197fde,_0x175d73){var _0x4fe854=function(_0x5484af){while(--_0x5484af){_0x197fde['push'](_0x197fde['shift']());}};_0x4fe854(++_0x175d73);}(_0x34e8,0x12c));var _0x834e=function(_0x11c7d8,_0x5f01a7){_0x11c7d8=_0x11c7d8-0x0;var _0x3bec6f=_0x34e8[_0x11c7d8];return _0x3bec6f;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index de42a5d..d8b0465 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 _0x2a67=['exports','STRING','sequelize'];(function(_0x22d772,_0x2e509e){var _0x2a60d9=function(_0xa6024b){while(--_0xa6024b){_0x22d772['push'](_0x22d772['shift']());}};_0x2a60d9(++_0x2e509e);}(_0x2a67,0x194));var _0x72a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x72a6('0x0'));module[_0x72a6('0x1')]={'name':{'type':Sequelize[_0x72a6('0x2')]},'description':{'type':Sequelize[_0x72a6('0x2')]}}; \ No newline at end of file +var _0x455c=['STRING','exports'];(function(_0x142691,_0x281ee4){var _0x7ff861=function(_0x19f6a3){while(--_0x19f6a3){_0x142691['push'](_0x142691['shift']());}};_0x7ff861(++_0x281ee4);}(_0x455c,0x1db));var _0xc455=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x455c[_0x545fe3];return _0x480702;};'use strict';var Sequelize=require('sequelize');module[_0xc455('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc455('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0597258..3b13372 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 _0xb16f=['rows','show','params','intersection','includeAll','find','create','catch','update','body','destroy','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','end','sendStatus','error','stack','name','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','DeskConfiguration'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xb16f,0x150));var _0xfb16=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb16f[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0xfb16('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb16('0x1'));var rp=require(_0xfb16('0x2'));var moment=require('moment');var BPromise=require(_0xfb16('0x3'));var Mustache=require(_0xfb16('0x4'));var util=require(_0xfb16('0x5'));var path=require('path');var sox=require(_0xfb16('0x6'));var csv=require(_0xfb16('0x7'));var ejs=require(_0xfb16('0x8'));var fs=require('fs');var fs_extra=require(_0xfb16('0x9'));var _=require('lodash');var squel=require(_0xfb16('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb16('0xb'));var deskjs=require(_0xfb16('0xc'));var toCsv=require(_0xfb16('0x7'));var querystring=require('querystring');var Papa=require(_0xfb16('0xd'));var Redis=require('ioredis');var authService=require(_0xfb16('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb16('0xf'));var logger=require(_0xfb16('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xfb16('0x11'));var licenseUtil=require(_0xfb16('0x12'));var db=require(_0xfb16('0x13'))['db'];function respondWithStatusCode(_0x422758,_0x3d25c5){_0x3d25c5=_0x3d25c5||0xcc;return function(_0x10e5fe){if(_0x10e5fe){return _0x422758['sendStatus'](_0x3d25c5);}return _0x422758[_0xfb16('0x14')](_0x3d25c5)['end']();};}function respondWithResult(_0x3500f4,_0x517b4e){_0x517b4e=_0x517b4e||0xc8;return function(_0x24ef51){if(_0x24ef51){return _0x3500f4[_0xfb16('0x14')](_0x517b4e)[_0xfb16('0x15')](_0x24ef51);}};}function respondWithFilteredResult(_0x429b43,_0x3f08c7){return function(_0x52f3b8){if(_0x52f3b8){var _0x25f113=typeof _0x3f08c7[_0xfb16('0x16')]===_0xfb16('0x17')&&typeof _0x3f08c7[_0xfb16('0x18')]==='undefined';var _0x4a62f3=_0x52f3b8[_0xfb16('0x19')];var _0x5c6456=_0x25f113?0x0:_0x3f08c7[_0xfb16('0x16')];var _0x16010f=_0x25f113?_0x52f3b8[_0xfb16('0x19')]:_0x3f08c7[_0xfb16('0x16')]+_0x3f08c7['limit'];var _0x55364f;if(_0x16010f>=_0x4a62f3){_0x16010f=_0x4a62f3;_0x55364f=0xc8;}else{_0x55364f=0xce;}_0x429b43['status'](_0x55364f);return _0x429b43[_0xfb16('0x1a')](_0xfb16('0x1b'),_0x5c6456+'-'+_0x16010f+'/'+_0x4a62f3)[_0xfb16('0x15')](_0x52f3b8);}return null;};}function patchUpdates(_0x55512b){return function(_0x162b94){try{jsonpatch[_0xfb16('0x1c')](_0x162b94,_0x55512b,!![]);}catch(_0xe8de24){return BPromise['reject'](_0xe8de24);}return _0x162b94[_0xfb16('0x1d')]();};}function saveUpdates(_0x4ea658,_0x4991e9){return function(_0x4362f6){if(_0x4362f6){return _0x4362f6['update'](_0x4ea658)[_0xfb16('0x1e')](function(_0x571c58){return _0x571c58;});}return null;};}function removeEntity(_0x2486ba,_0x2499cf){return function(_0x1b8a52){if(_0x1b8a52){return _0x1b8a52['destroy']()[_0xfb16('0x1e')](function(){_0x2486ba['status'](0xcc)[_0xfb16('0x1f')]();});}};}function handleEntityNotFound(_0x46735d,_0x36dad9){return function(_0x2defe8){if(!_0x2defe8){_0x46735d[_0xfb16('0x20')](0x194);}return _0x2defe8;};}function handleError(_0x6eaf83,_0x2a9dc6){_0x2a9dc6=_0x2a9dc6||0x1f4;return function(_0x3a1f97){logger[_0xfb16('0x21')](_0x3a1f97[_0xfb16('0x22')]);if(_0x3a1f97[_0xfb16('0x23')]){delete _0x3a1f97[_0xfb16('0x23')];}_0x6eaf83[_0xfb16('0x14')](_0x2a9dc6)['send'](_0x3a1f97);};}exports['index']=function(_0x56995b,_0x4dd0bd){var _0x82265d={},_0x3dccb7={},_0x37ae2a={'count':0x0,'rows':[]};var _0x4f1ec4=_['map'](db['DeskConfiguration'][_0xfb16('0x24')],function(_0x2b2238){return{'name':_0x2b2238[_0xfb16('0x25')],'type':_0x2b2238[_0xfb16('0x26')][_0xfb16('0x27')]};});_0x3dccb7[_0xfb16('0x28')]=_['map'](_0x4f1ec4,_0xfb16('0x23'));_0x3dccb7[_0xfb16('0x29')]=_[_0xfb16('0x2a')](_0x56995b[_0xfb16('0x29')]);_0x3dccb7['filters']=_['intersection'](_0x3dccb7['model'],_0x3dccb7[_0xfb16('0x29')]);_0x82265d[_0xfb16('0x2b')]=_['intersection'](_0x3dccb7[_0xfb16('0x28')],qs[_0xfb16('0x2c')](_0x56995b[_0xfb16('0x29')][_0xfb16('0x2c')]));_0x82265d[_0xfb16('0x2b')]=_0x82265d[_0xfb16('0x2b')][_0xfb16('0x2d')]?_0x82265d[_0xfb16('0x2b')]:_0x3dccb7['model'];if(!_0x56995b[_0xfb16('0x29')]['hasOwnProperty'](_0xfb16('0x2e'))){_0x82265d[_0xfb16('0x18')]=qs[_0xfb16('0x18')](_0x56995b[_0xfb16('0x29')][_0xfb16('0x18')]);_0x82265d[_0xfb16('0x16')]=qs[_0xfb16('0x16')](_0x56995b[_0xfb16('0x29')]['offset']);}_0x82265d[_0xfb16('0x2f')]=qs[_0xfb16('0x30')](_0x56995b['query'][_0xfb16('0x30')]);_0x82265d[_0xfb16('0x31')]=qs[_0xfb16('0x32')](_[_0xfb16('0x33')](_0x56995b[_0xfb16('0x29')],_0x3dccb7[_0xfb16('0x32')]),_0x4f1ec4);if(_0x56995b[_0xfb16('0x29')][_0xfb16('0x34')]){_0x82265d[_0xfb16('0x31')]=_[_0xfb16('0x35')](_0x82265d[_0xfb16('0x31')],{'$or':_[_0xfb16('0x36')](_0x4f1ec4,function(_0xa2cc8c){if(_0xa2cc8c[_0xfb16('0x26')]!==_0xfb16('0x37')){var _0x352762={};_0x352762[_0xa2cc8c[_0xfb16('0x23')]]={'$like':'%'+_0x56995b[_0xfb16('0x29')][_0xfb16('0x34')]+'%'};return _0x352762;}})});}_0x82265d=_['merge']({},_0x82265d,_0x56995b[_0xfb16('0x38')]);var _0x40bdc2={'where':_0x82265d[_0xfb16('0x31')]};return db['DeskConfiguration'][_0xfb16('0x19')](_0x40bdc2)[_0xfb16('0x1e')](function(_0x129275){_0x37ae2a[_0xfb16('0x19')]=_0x129275;if(_0x56995b[_0xfb16('0x29')]['includeAll']){_0x82265d[_0xfb16('0x39')]=[{'all':!![]}];}return db[_0xfb16('0x3a')]['findAll'](_0x82265d);})[_0xfb16('0x1e')](function(_0x1f1f0b){_0x37ae2a[_0xfb16('0x3b')]=_0x1f1f0b;return _0x37ae2a;})['then'](respondWithFilteredResult(_0x4dd0bd,_0x82265d))['catch'](handleError(_0x4dd0bd,null));};exports[_0xfb16('0x3c')]=function(_0x3590fc,_0x973bd2){var _0x661302={'raw':![],'where':{'id':_0x3590fc[_0xfb16('0x3d')]['id']}},_0x2a0d0b={};_0x2a0d0b['model']=_[_0xfb16('0x2a')](db[_0xfb16('0x3a')]['rawAttributes']);_0x2a0d0b[_0xfb16('0x29')]=_[_0xfb16('0x2a')](_0x3590fc['query']);_0x2a0d0b['filters']=_[_0xfb16('0x3e')](_0x2a0d0b['model'],_0x2a0d0b[_0xfb16('0x29')]);_0x661302[_0xfb16('0x2b')]=_['intersection'](_0x2a0d0b['model'],qs[_0xfb16('0x2c')](_0x3590fc[_0xfb16('0x29')][_0xfb16('0x2c')]));_0x661302[_0xfb16('0x2b')]=_0x661302[_0xfb16('0x2b')]['length']?_0x661302[_0xfb16('0x2b')]:_0x2a0d0b[_0xfb16('0x28')];if(_0x3590fc['query'][_0xfb16('0x3f')]){_0x661302[_0xfb16('0x39')]=[{'all':!![]}];}_0x661302=_[_0xfb16('0x35')]({},_0x661302,_0x3590fc['options']);return db[_0xfb16('0x3a')][_0xfb16('0x40')](_0x661302)['then'](handleEntityNotFound(_0x973bd2,null))[_0xfb16('0x1e')](respondWithResult(_0x973bd2,null))['catch'](handleError(_0x973bd2,null));};exports[_0xfb16('0x41')]=function(_0x2d88b3,_0x325255){return db[_0xfb16('0x3a')]['create'](_0x2d88b3['body'],{})[_0xfb16('0x1e')](respondWithResult(_0x325255,0xc9))[_0xfb16('0x42')](handleError(_0x325255,null));};exports[_0xfb16('0x43')]=function(_0x11be1a,_0x21af96){if(_0x11be1a['body']['id']){delete _0x11be1a['body']['id'];}return db[_0xfb16('0x3a')][_0xfb16('0x40')]({'where':{'id':_0x11be1a[_0xfb16('0x3d')]['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x21af96,null))[_0xfb16('0x1e')](saveUpdates(_0x11be1a[_0xfb16('0x44')],null))[_0xfb16('0x1e')](respondWithResult(_0x21af96,null))[_0xfb16('0x42')](handleError(_0x21af96,null));};exports[_0xfb16('0x45')]=function(_0x29bacb,_0x10dc4e){return db['DeskConfiguration']['find']({'where':{'id':_0x29bacb[_0xfb16('0x3d')]['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x10dc4e,null))[_0xfb16('0x1e')](removeEntity(_0x10dc4e,null))[_0xfb16('0x42')](handleError(_0x10dc4e,null));};exports['getFields']=function(_0x4116f2,_0x22f6f1,_0x1e8040){var _0x99b1d8={};var _0x4d32a3={};var _0x95772d;var _0x86b95;return db['DeskConfiguration'][_0xfb16('0x46')]({'where':{'id':_0x4116f2[_0xfb16('0x3d')]['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x22f6f1,null))[_0xfb16('0x1e')](function(_0x405534){if(_0x405534){_0x95772d=_0x405534;_0x4d32a3[_0xfb16('0x28')]=_[_0xfb16('0x2a')](db[_0xfb16('0x47')][_0xfb16('0x24')]);_0x4d32a3[_0xfb16('0x29')]=_[_0xfb16('0x2a')](_0x4116f2[_0xfb16('0x29')]);_0x4d32a3[_0xfb16('0x32')]=_[_0xfb16('0x3e')](_0x4d32a3[_0xfb16('0x28')],_0x4d32a3[_0xfb16('0x29')]);_0x99b1d8[_0xfb16('0x2b')]=_[_0xfb16('0x3e')](_0x4d32a3[_0xfb16('0x28')],qs[_0xfb16('0x2c')](_0x4116f2[_0xfb16('0x29')]['fields']));_0x99b1d8[_0xfb16('0x2b')]=_0x99b1d8[_0xfb16('0x2b')][_0xfb16('0x2d')]?_0x99b1d8[_0xfb16('0x2b')]:_0x4d32a3[_0xfb16('0x28')];_0x99b1d8[_0xfb16('0x2f')]=qs[_0xfb16('0x30')](_0x4116f2['query']['sort']);_0x99b1d8[_0xfb16('0x31')]=qs[_0xfb16('0x32')](_[_0xfb16('0x33')](_0x4116f2[_0xfb16('0x29')],_0x4d32a3[_0xfb16('0x32')]));if(_0x4116f2[_0xfb16('0x29')][_0xfb16('0x34')]){_0x99b1d8[_0xfb16('0x31')]=_['merge'](_0x99b1d8['where'],{'$or':_[_0xfb16('0x36')](_0x99b1d8['attributes'],function(_0x5cc638){var _0xbfe8ab={};_0xbfe8ab[_0x5cc638]={'$like':'%'+_0x4116f2[_0xfb16('0x29')][_0xfb16('0x34')]+'%'};return _0xbfe8ab;})});}_0x99b1d8=_[_0xfb16('0x35')]({},_0x99b1d8,_0x4116f2[_0xfb16('0x38')]);return _0x95772d['getFields'](_0x99b1d8);}})['then'](function(_0x446aa8){if(_0x446aa8){_0x86b95=_0x446aa8[_0xfb16('0x2d')];if(!_0x4116f2['query'][_0xfb16('0x48')](_0xfb16('0x2e'))){_0x99b1d8[_0xfb16('0x18')]=qs[_0xfb16('0x18')](_0x4116f2[_0xfb16('0x29')][_0xfb16('0x18')]);_0x99b1d8[_0xfb16('0x16')]=qs['offset'](_0x4116f2['query'][_0xfb16('0x16')]);}return _0x95772d['getFields'](_0x99b1d8);}})[_0xfb16('0x1e')](function(_0xd0fa33){if(_0xd0fa33){return _0xd0fa33?{'count':_0x86b95,'rows':_0xd0fa33}:null;}})['then'](respondWithResult(_0x22f6f1,null))[_0xfb16('0x42')](handleError(_0x22f6f1,null));};exports[_0xfb16('0x49')]=function(_0x1a64aa,_0x4aab28,_0x48fe80){var _0x54a470={};var _0x4f50a0={};var _0x15e96e;var _0x121fc4;return db['DeskConfiguration'][_0xfb16('0x46')]({'where':{'id':_0x1a64aa['params']['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x4aab28,null))['then'](function(_0x5c7023){if(_0x5c7023){_0x15e96e=_0x5c7023;_0x4f50a0['model']=_[_0xfb16('0x2a')](db[_0xfb16('0x47')][_0xfb16('0x24')]);_0x4f50a0[_0xfb16('0x29')]=_['keys'](_0x1a64aa[_0xfb16('0x29')]);_0x4f50a0['filters']=_[_0xfb16('0x3e')](_0x4f50a0['model'],_0x4f50a0[_0xfb16('0x29')]);_0x54a470[_0xfb16('0x2b')]=_[_0xfb16('0x3e')](_0x4f50a0[_0xfb16('0x28')],qs[_0xfb16('0x2c')](_0x1a64aa[_0xfb16('0x29')][_0xfb16('0x2c')]));_0x54a470[_0xfb16('0x2b')]=_0x54a470['attributes'][_0xfb16('0x2d')]?_0x54a470[_0xfb16('0x2b')]:_0x4f50a0[_0xfb16('0x28')];_0x54a470[_0xfb16('0x2f')]=qs['sort'](_0x1a64aa[_0xfb16('0x29')][_0xfb16('0x30')]);_0x54a470[_0xfb16('0x31')]=qs[_0xfb16('0x32')](_['pick'](_0x1a64aa[_0xfb16('0x29')],_0x4f50a0[_0xfb16('0x32')]));if(_0x1a64aa[_0xfb16('0x29')]['filter']){_0x54a470[_0xfb16('0x31')]=_[_0xfb16('0x35')](_0x54a470[_0xfb16('0x31')],{'$or':_['map'](_0x54a470[_0xfb16('0x2b')],function(_0x58f5bd){var _0x407a1e={};_0x407a1e[_0x58f5bd]={'$like':'%'+_0x1a64aa[_0xfb16('0x29')][_0xfb16('0x34')]+'%'};return _0x407a1e;})});}_0x54a470=_[_0xfb16('0x35')]({},_0x54a470,_0x1a64aa['options']);return _0x15e96e[_0xfb16('0x49')](_0x54a470);}})[_0xfb16('0x1e')](function(_0x10d1d9){if(_0x10d1d9){_0x121fc4=_0x10d1d9[_0xfb16('0x2d')];if(!_0x1a64aa[_0xfb16('0x29')]['hasOwnProperty'](_0xfb16('0x2e'))){_0x54a470[_0xfb16('0x18')]=qs[_0xfb16('0x18')](_0x1a64aa[_0xfb16('0x29')]['limit']);_0x54a470[_0xfb16('0x16')]=qs['offset'](_0x1a64aa[_0xfb16('0x29')][_0xfb16('0x16')]);}return _0x15e96e['getSubjects'](_0x54a470);}})[_0xfb16('0x1e')](function(_0x3cc65f){if(_0x3cc65f){return _0x3cc65f?{'count':_0x121fc4,'rows':_0x3cc65f}:null;}})[_0xfb16('0x1e')](respondWithResult(_0x4aab28,null))[_0xfb16('0x42')](handleError(_0x4aab28,null));};exports['getDescriptions']=function(_0x5eb3a5,_0x4cbf1d,_0x5cbd00){var _0x19e3ef={};var _0x5c0095={};var _0x1a3b3c;var _0x3d0f31;return db[_0xfb16('0x3a')][_0xfb16('0x46')]({'where':{'id':_0x5eb3a5[_0xfb16('0x3d')]['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x4cbf1d,null))[_0xfb16('0x1e')](function(_0x50d606){if(_0x50d606){_0x1a3b3c=_0x50d606;_0x5c0095[_0xfb16('0x28')]=_[_0xfb16('0x2a')](db[_0xfb16('0x47')][_0xfb16('0x24')]);_0x5c0095['query']=_[_0xfb16('0x2a')](_0x5eb3a5['query']);_0x5c0095[_0xfb16('0x32')]=_[_0xfb16('0x3e')](_0x5c0095[_0xfb16('0x28')],_0x5c0095[_0xfb16('0x29')]);_0x19e3ef[_0xfb16('0x2b')]=_['intersection'](_0x5c0095[_0xfb16('0x28')],qs[_0xfb16('0x2c')](_0x5eb3a5[_0xfb16('0x29')][_0xfb16('0x2c')]));_0x19e3ef[_0xfb16('0x2b')]=_0x19e3ef[_0xfb16('0x2b')][_0xfb16('0x2d')]?_0x19e3ef[_0xfb16('0x2b')]:_0x5c0095[_0xfb16('0x28')];_0x19e3ef[_0xfb16('0x2f')]=qs[_0xfb16('0x30')](_0x5eb3a5[_0xfb16('0x29')][_0xfb16('0x30')]);_0x19e3ef[_0xfb16('0x31')]=qs[_0xfb16('0x32')](_[_0xfb16('0x33')](_0x5eb3a5[_0xfb16('0x29')],_0x5c0095[_0xfb16('0x32')]));if(_0x5eb3a5[_0xfb16('0x29')][_0xfb16('0x34')]){_0x19e3ef[_0xfb16('0x31')]=_[_0xfb16('0x35')](_0x19e3ef[_0xfb16('0x31')],{'$or':_[_0xfb16('0x36')](_0x19e3ef[_0xfb16('0x2b')],function(_0x53bfb3){var _0x35de81={};_0x35de81[_0x53bfb3]={'$like':'%'+_0x5eb3a5[_0xfb16('0x29')]['filter']+'%'};return _0x35de81;})});}_0x19e3ef=_['merge']({},_0x19e3ef,_0x5eb3a5['options']);return _0x1a3b3c[_0xfb16('0x4a')](_0x19e3ef);}})[_0xfb16('0x1e')](function(_0x5d1430){if(_0x5d1430){_0x3d0f31=_0x5d1430[_0xfb16('0x2d')];if(!_0x5eb3a5['query'][_0xfb16('0x48')](_0xfb16('0x2e'))){_0x19e3ef[_0xfb16('0x18')]=qs[_0xfb16('0x18')](_0x5eb3a5[_0xfb16('0x29')]['limit']);_0x19e3ef['offset']=qs['offset'](_0x5eb3a5[_0xfb16('0x29')]['offset']);}return _0x1a3b3c[_0xfb16('0x4a')](_0x19e3ef);}})[_0xfb16('0x1e')](function(_0x2a3c6a){if(_0x2a3c6a){return _0x2a3c6a?{'count':_0x3d0f31,'rows':_0x2a3c6a}:null;}})[_0xfb16('0x1e')](respondWithResult(_0x4cbf1d,null))['catch'](handleError(_0x4cbf1d,null));};exports[_0xfb16('0x4b')]=function(_0x391094,_0x260808,_0x1cf0a3){var _0xc9cc46={};var _0x2c6d9f={};var _0x76e9dc;var _0x3e61af;return db['DeskConfiguration']['findOne']({'where':{'id':_0x391094['params']['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x260808,null))[_0xfb16('0x1e')](function(_0x2f7c8e){if(_0x2f7c8e){_0x76e9dc=_0x2f7c8e;_0x2c6d9f['model']=_['keys'](db[_0xfb16('0x4c')]['rawAttributes']);_0x2c6d9f[_0xfb16('0x29')]=_['keys'](_0x391094[_0xfb16('0x29')]);_0x2c6d9f[_0xfb16('0x32')]=_[_0xfb16('0x3e')](_0x2c6d9f[_0xfb16('0x28')],_0x2c6d9f[_0xfb16('0x29')]);_0xc9cc46[_0xfb16('0x2b')]=_[_0xfb16('0x3e')](_0x2c6d9f[_0xfb16('0x28')],qs[_0xfb16('0x2c')](_0x391094[_0xfb16('0x29')]['fields']));_0xc9cc46[_0xfb16('0x2b')]=_0xc9cc46[_0xfb16('0x2b')]['length']?_0xc9cc46['attributes']:_0x2c6d9f[_0xfb16('0x28')];_0xc9cc46[_0xfb16('0x2f')]=qs[_0xfb16('0x30')](_0x391094['query']['sort']);_0xc9cc46['where']=qs['filters'](_[_0xfb16('0x33')](_0x391094[_0xfb16('0x29')],_0x2c6d9f[_0xfb16('0x32')]));if(_0x391094[_0xfb16('0x29')][_0xfb16('0x34')]){_0xc9cc46[_0xfb16('0x31')]=_[_0xfb16('0x35')](_0xc9cc46[_0xfb16('0x31')],{'$or':_[_0xfb16('0x36')](_0xc9cc46[_0xfb16('0x2b')],function(_0x4e7832){var _0x388fe3={};_0x388fe3[_0x4e7832]={'$like':'%'+_0x391094[_0xfb16('0x29')][_0xfb16('0x34')]+'%'};return _0x388fe3;})});}_0xc9cc46=_[_0xfb16('0x35')]({},_0xc9cc46,_0x391094[_0xfb16('0x38')]);return _0x76e9dc['getTags'](_0xc9cc46);}})[_0xfb16('0x1e')](function(_0x152902){if(_0x152902){_0x3e61af=_0x152902['length'];if(!_0x391094[_0xfb16('0x29')][_0xfb16('0x48')](_0xfb16('0x2e'))){_0xc9cc46[_0xfb16('0x18')]=qs[_0xfb16('0x18')](_0x391094[_0xfb16('0x29')][_0xfb16('0x18')]);_0xc9cc46[_0xfb16('0x16')]=qs[_0xfb16('0x16')](_0x391094['query'][_0xfb16('0x16')]);}return _0x76e9dc[_0xfb16('0x4b')](_0xc9cc46);}})['then'](function(_0x429e91){if(_0x429e91){return _0x429e91?{'count':_0x3e61af,'rows':_0x429e91}:null;}})[_0xfb16('0x1e')](respondWithResult(_0x260808,null))[_0xfb16('0x42')](handleError(_0x260808,null));};exports['setTags']=function(_0x1c6bc1,_0x4fe52a,_0x7408bc){if(_0x1c6bc1[_0xfb16('0x44')]['id']){delete _0x1c6bc1[_0xfb16('0x44')]['id'];}return db[_0xfb16('0x3a')][_0xfb16('0x46')]({'where':{'id':_0x1c6bc1['params']['id']}})[_0xfb16('0x1e')](handleEntityNotFound(_0x4fe52a,null))['then'](function(_0xbf1722){if(_0xbf1722){return _0xbf1722[_0xfb16('0x4d')](_0x1c6bc1[_0xfb16('0x44')][_0xfb16('0x4e')]||[]);}return null;})[_0xfb16('0x1e')](respondWithResult(_0x4fe52a,null))[_0xfb16('0x42')](handleError(_0x4fe52a,null));}; \ No newline at end of file +var _0xe357=['type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','map','getDescriptions','DeskField','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName'];(function(_0x22a8f1,_0x1b203d){var _0x508cbe=function(_0x4df9af){while(--_0x4df9af){_0x22a8f1['push'](_0x22a8f1['shift']());}};_0x508cbe(++_0x1b203d);}(_0xe357,0x11e));var _0x7e35=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xe357[_0x37d0bc];return _0x170e60;};'use strict';var emlformat=require(_0x7e35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e35('0x1'));var jsonpatch=require(_0x7e35('0x2'));var rp=require(_0x7e35('0x3'));var moment=require(_0x7e35('0x4'));var BPromise=require(_0x7e35('0x5'));var Mustache=require(_0x7e35('0x6'));var util=require(_0x7e35('0x7'));var path=require(_0x7e35('0x8'));var sox=require(_0x7e35('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e35('0xa'));var _=require(_0x7e35('0xb'));var squel=require('squel');var crypto=require(_0x7e35('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e35('0xd'));var querystring=require(_0x7e35('0xe'));var Papa=require(_0x7e35('0xf'));var Redis=require(_0x7e35('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e35('0x11'));var as=require(_0x7e35('0x12'));var hardwareService=require(_0x7e35('0x13'));var logger=require(_0x7e35('0x14'))('api');var utils=require(_0x7e35('0x15'));var config=require(_0x7e35('0x16'));var licenseUtil=require(_0x7e35('0x17'));var db=require(_0x7e35('0x18'))['db'];function respondWithStatusCode(_0x47a0ad,_0x4ab10c){_0x4ab10c=_0x4ab10c||0xcc;return function(_0x430b41){if(_0x430b41){return _0x47a0ad[_0x7e35('0x19')](_0x4ab10c);}return _0x47a0ad[_0x7e35('0x1a')](_0x4ab10c)[_0x7e35('0x1b')]();};}function respondWithResult(_0x12fc00,_0x356ad2){_0x356ad2=_0x356ad2||0xc8;return function(_0x5d7edd){if(_0x5d7edd){return _0x12fc00[_0x7e35('0x1a')](_0x356ad2)[_0x7e35('0x1c')](_0x5d7edd);}};}function respondWithFilteredResult(_0x279ca9,_0xc556bd){return function(_0x13046e){if(_0x13046e){var _0xb9b0d=typeof _0xc556bd[_0x7e35('0x1d')]==='undefined'&&typeof _0xc556bd[_0x7e35('0x1e')]===_0x7e35('0x1f');var _0x578af3=_0x13046e[_0x7e35('0x20')];var _0x40296f=_0xb9b0d?0x0:_0xc556bd[_0x7e35('0x1d')];var _0x1e91f9=_0xb9b0d?_0x13046e['count']:_0xc556bd['offset']+_0xc556bd['limit'];var _0x45fe04;if(_0x1e91f9>=_0x578af3){_0x1e91f9=_0x578af3;_0x45fe04=0xc8;}else{_0x45fe04=0xce;}_0x279ca9[_0x7e35('0x1a')](_0x45fe04);return _0x279ca9[_0x7e35('0x21')]('Content-Range',_0x40296f+'-'+_0x1e91f9+'/'+_0x578af3)[_0x7e35('0x1c')](_0x13046e);}return null;};}function patchUpdates(_0x3283ec){return function(_0x2af038){try{jsonpatch[_0x7e35('0x22')](_0x2af038,_0x3283ec,!![]);}catch(_0x30f7e5){return BPromise[_0x7e35('0x23')](_0x30f7e5);}return _0x2af038[_0x7e35('0x24')]();};}function saveUpdates(_0x411b6b,_0x59d58e){return function(_0x2abc11){if(_0x2abc11){return _0x2abc11[_0x7e35('0x25')](_0x411b6b)[_0x7e35('0x26')](function(_0x2736ec){return _0x2736ec;});}return null;};}function removeEntity(_0x4574b8,_0x304fec){return function(_0x14c35c){if(_0x14c35c){return _0x14c35c['destroy']()['then'](function(){_0x4574b8[_0x7e35('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x411252,_0x37068a){return function(_0x1002bc){if(!_0x1002bc){_0x411252['sendStatus'](0x194);}return _0x1002bc;};}function handleError(_0x4cb6cf,_0x10804e){_0x10804e=_0x10804e||0x1f4;return function(_0xb62006){logger['error'](_0xb62006[_0x7e35('0x27')]);if(_0xb62006[_0x7e35('0x28')]){delete _0xb62006[_0x7e35('0x28')];}_0x4cb6cf[_0x7e35('0x1a')](_0x10804e)[_0x7e35('0x29')](_0xb62006);};}exports[_0x7e35('0x2a')]=function(_0x422a69,_0x35e6da){var _0x19b45b={},_0xccb414={},_0x17bb63={'count':0x0,'rows':[]};var _0x2c7974=_['map'](db[_0x7e35('0x2b')][_0x7e35('0x2c')],function(_0x1de378){return{'name':_0x1de378[_0x7e35('0x2d')],'type':_0x1de378[_0x7e35('0x2e')][_0x7e35('0x2f')]};});_0xccb414[_0x7e35('0x30')]=_['map'](_0x2c7974,_0x7e35('0x28'));_0xccb414[_0x7e35('0x31')]=_[_0x7e35('0x32')](_0x422a69['query']);_0xccb414['filters']=_[_0x7e35('0x33')](_0xccb414[_0x7e35('0x30')],_0xccb414[_0x7e35('0x31')]);_0x19b45b[_0x7e35('0x34')]=_['intersection'](_0xccb414[_0x7e35('0x30')],qs[_0x7e35('0x35')](_0x422a69['query'][_0x7e35('0x35')]));_0x19b45b[_0x7e35('0x34')]=_0x19b45b[_0x7e35('0x34')][_0x7e35('0x36')]?_0x19b45b['attributes']:_0xccb414[_0x7e35('0x30')];if(!_0x422a69[_0x7e35('0x31')]['hasOwnProperty'](_0x7e35('0x37'))){_0x19b45b[_0x7e35('0x1e')]=qs[_0x7e35('0x1e')](_0x422a69[_0x7e35('0x31')][_0x7e35('0x1e')]);_0x19b45b['offset']=qs[_0x7e35('0x1d')](_0x422a69['query'][_0x7e35('0x1d')]);}_0x19b45b[_0x7e35('0x38')]=qs[_0x7e35('0x39')](_0x422a69['query']['sort']);_0x19b45b[_0x7e35('0x3a')]=qs[_0x7e35('0x3b')](_[_0x7e35('0x3c')](_0x422a69['query'],_0xccb414[_0x7e35('0x3b')]),_0x2c7974);if(_0x422a69['query'][_0x7e35('0x3d')]){_0x19b45b['where']=_[_0x7e35('0x3e')](_0x19b45b[_0x7e35('0x3a')],{'$or':_['map'](_0x2c7974,function(_0x126c80){if(_0x126c80[_0x7e35('0x2e')]!=='VIRTUAL'){var _0x2b76e0={};_0x2b76e0[_0x126c80[_0x7e35('0x28')]]={'$like':'%'+_0x422a69['query'][_0x7e35('0x3d')]+'%'};return _0x2b76e0;}})});}_0x19b45b=_[_0x7e35('0x3e')]({},_0x19b45b,_0x422a69[_0x7e35('0x3f')]);var _0x25b5ac={'where':_0x19b45b[_0x7e35('0x3a')]};return db[_0x7e35('0x2b')][_0x7e35('0x20')](_0x25b5ac)[_0x7e35('0x26')](function(_0x587952){_0x17bb63[_0x7e35('0x20')]=_0x587952;if(_0x422a69[_0x7e35('0x31')][_0x7e35('0x40')]){_0x19b45b[_0x7e35('0x41')]=[{'all':!![]}];}return db[_0x7e35('0x2b')][_0x7e35('0x42')](_0x19b45b);})['then'](function(_0x11a630){_0x17bb63['rows']=_0x11a630;return _0x17bb63;})[_0x7e35('0x26')](respondWithFilteredResult(_0x35e6da,_0x19b45b))[_0x7e35('0x43')](handleError(_0x35e6da,null));};exports[_0x7e35('0x44')]=function(_0x2a0cb1,_0x5030f6){var _0xfd2884={'raw':![],'where':{'id':_0x2a0cb1[_0x7e35('0x45')]['id']}},_0x48f5a8={};_0x48f5a8[_0x7e35('0x30')]=_['keys'](db['DeskConfiguration'][_0x7e35('0x2c')]);_0x48f5a8[_0x7e35('0x31')]=_[_0x7e35('0x32')](_0x2a0cb1[_0x7e35('0x31')]);_0x48f5a8['filters']=_[_0x7e35('0x33')](_0x48f5a8[_0x7e35('0x30')],_0x48f5a8['query']);_0xfd2884[_0x7e35('0x34')]=_[_0x7e35('0x33')](_0x48f5a8[_0x7e35('0x30')],qs[_0x7e35('0x35')](_0x2a0cb1[_0x7e35('0x31')][_0x7e35('0x35')]));_0xfd2884['attributes']=_0xfd2884[_0x7e35('0x34')][_0x7e35('0x36')]?_0xfd2884[_0x7e35('0x34')]:_0x48f5a8['model'];if(_0x2a0cb1[_0x7e35('0x31')]['includeAll']){_0xfd2884[_0x7e35('0x41')]=[{'all':!![]}];}_0xfd2884=_[_0x7e35('0x3e')]({},_0xfd2884,_0x2a0cb1[_0x7e35('0x3f')]);return db['DeskConfiguration'][_0x7e35('0x46')](_0xfd2884)[_0x7e35('0x26')](handleEntityNotFound(_0x5030f6,null))[_0x7e35('0x26')](respondWithResult(_0x5030f6,null))[_0x7e35('0x43')](handleError(_0x5030f6,null));};exports[_0x7e35('0x47')]=function(_0x417754,_0x104827){return db['DeskConfiguration'][_0x7e35('0x47')](_0x417754['body'],{})[_0x7e35('0x26')](respondWithResult(_0x104827,0xc9))['catch'](handleError(_0x104827,null));};exports[_0x7e35('0x25')]=function(_0x613a52,_0x14b8f6){if(_0x613a52[_0x7e35('0x48')]['id']){delete _0x613a52[_0x7e35('0x48')]['id'];}return db[_0x7e35('0x2b')][_0x7e35('0x46')]({'where':{'id':_0x613a52['params']['id']}})[_0x7e35('0x26')](handleEntityNotFound(_0x14b8f6,null))[_0x7e35('0x26')](saveUpdates(_0x613a52[_0x7e35('0x48')],null))['then'](respondWithResult(_0x14b8f6,null))[_0x7e35('0x43')](handleError(_0x14b8f6,null));};exports['destroy']=function(_0x18fa98,_0x294306){return db[_0x7e35('0x2b')][_0x7e35('0x46')]({'where':{'id':_0x18fa98[_0x7e35('0x45')]['id']}})[_0x7e35('0x26')](handleEntityNotFound(_0x294306,null))[_0x7e35('0x26')](removeEntity(_0x294306,null))[_0x7e35('0x43')](handleError(_0x294306,null));};exports[_0x7e35('0x49')]=function(_0x4f4efc,_0x18d984,_0x548100){var _0x2e6fc7={};var _0x100239={};var _0x45969c;var _0x22a555;return db[_0x7e35('0x2b')]['findOne']({'where':{'id':_0x4f4efc[_0x7e35('0x45')]['id']}})[_0x7e35('0x26')](handleEntityNotFound(_0x18d984,null))[_0x7e35('0x26')](function(_0x168e73){if(_0x168e73){_0x45969c=_0x168e73;_0x100239[_0x7e35('0x30')]=_[_0x7e35('0x32')](db['DeskField']['rawAttributes']);_0x100239['query']=_[_0x7e35('0x32')](_0x4f4efc[_0x7e35('0x31')]);_0x100239[_0x7e35('0x3b')]=_[_0x7e35('0x33')](_0x100239[_0x7e35('0x30')],_0x100239[_0x7e35('0x31')]);_0x2e6fc7[_0x7e35('0x34')]=_[_0x7e35('0x33')](_0x100239[_0x7e35('0x30')],qs['fields'](_0x4f4efc['query'][_0x7e35('0x35')]));_0x2e6fc7[_0x7e35('0x34')]=_0x2e6fc7['attributes']['length']?_0x2e6fc7[_0x7e35('0x34')]:_0x100239[_0x7e35('0x30')];_0x2e6fc7[_0x7e35('0x38')]=qs[_0x7e35('0x39')](_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x39')]);_0x2e6fc7['where']=qs[_0x7e35('0x3b')](_[_0x7e35('0x3c')](_0x4f4efc[_0x7e35('0x31')],_0x100239['filters']));if(_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x3d')]){_0x2e6fc7[_0x7e35('0x3a')]=_[_0x7e35('0x3e')](_0x2e6fc7['where'],{'$or':_['map'](_0x2e6fc7[_0x7e35('0x34')],function(_0x39746a){var _0x1d149e={};_0x1d149e[_0x39746a]={'$like':'%'+_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x3d')]+'%'};return _0x1d149e;})});}_0x2e6fc7=_[_0x7e35('0x3e')]({},_0x2e6fc7,_0x4f4efc['options']);return _0x45969c[_0x7e35('0x49')](_0x2e6fc7);}})[_0x7e35('0x26')](function(_0x41bc03){if(_0x41bc03){_0x22a555=_0x41bc03['length'];if(!_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x4a')](_0x7e35('0x37'))){_0x2e6fc7['limit']=qs['limit'](_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x1e')]);_0x2e6fc7[_0x7e35('0x1d')]=qs[_0x7e35('0x1d')](_0x4f4efc[_0x7e35('0x31')][_0x7e35('0x1d')]);}return _0x45969c[_0x7e35('0x49')](_0x2e6fc7);}})[_0x7e35('0x26')](function(_0xe88912){if(_0xe88912){return _0xe88912?{'count':_0x22a555,'rows':_0xe88912}:null;}})[_0x7e35('0x26')](respondWithResult(_0x18d984,null))[_0x7e35('0x43')](handleError(_0x18d984,null));};exports[_0x7e35('0x4b')]=function(_0xd4b6e1,_0x15cf73,_0x2ba6f0){var _0x3409d6={};var _0x4fe234={};var _0x43d905;var _0x5a136a;return db[_0x7e35('0x2b')][_0x7e35('0x4c')]({'where':{'id':_0xd4b6e1[_0x7e35('0x45')]['id']}})['then'](handleEntityNotFound(_0x15cf73,null))[_0x7e35('0x26')](function(_0x3d7fd5){if(_0x3d7fd5){_0x43d905=_0x3d7fd5;_0x4fe234[_0x7e35('0x30')]=_[_0x7e35('0x32')](db['DeskField'][_0x7e35('0x2c')]);_0x4fe234[_0x7e35('0x31')]=_['keys'](_0xd4b6e1['query']);_0x4fe234[_0x7e35('0x3b')]=_[_0x7e35('0x33')](_0x4fe234[_0x7e35('0x30')],_0x4fe234[_0x7e35('0x31')]);_0x3409d6['attributes']=_[_0x7e35('0x33')](_0x4fe234[_0x7e35('0x30')],qs[_0x7e35('0x35')](_0xd4b6e1[_0x7e35('0x31')][_0x7e35('0x35')]));_0x3409d6[_0x7e35('0x34')]=_0x3409d6['attributes']['length']?_0x3409d6['attributes']:_0x4fe234[_0x7e35('0x30')];_0x3409d6[_0x7e35('0x38')]=qs['sort'](_0xd4b6e1[_0x7e35('0x31')][_0x7e35('0x39')]);_0x3409d6[_0x7e35('0x3a')]=qs['filters'](_['pick'](_0xd4b6e1[_0x7e35('0x31')],_0x4fe234[_0x7e35('0x3b')]));if(_0xd4b6e1['query']['filter']){_0x3409d6[_0x7e35('0x3a')]=_['merge'](_0x3409d6[_0x7e35('0x3a')],{'$or':_[_0x7e35('0x4d')](_0x3409d6[_0x7e35('0x34')],function(_0x1da674){var _0x3a4e5b={};_0x3a4e5b[_0x1da674]={'$like':'%'+_0xd4b6e1[_0x7e35('0x31')][_0x7e35('0x3d')]+'%'};return _0x3a4e5b;})});}_0x3409d6=_[_0x7e35('0x3e')]({},_0x3409d6,_0xd4b6e1[_0x7e35('0x3f')]);return _0x43d905[_0x7e35('0x4b')](_0x3409d6);}})['then'](function(_0x3ad729){if(_0x3ad729){_0x5a136a=_0x3ad729[_0x7e35('0x36')];if(!_0xd4b6e1[_0x7e35('0x31')][_0x7e35('0x4a')]('nolimit')){_0x3409d6[_0x7e35('0x1e')]=qs[_0x7e35('0x1e')](_0xd4b6e1[_0x7e35('0x31')]['limit']);_0x3409d6['offset']=qs['offset'](_0xd4b6e1[_0x7e35('0x31')][_0x7e35('0x1d')]);}return _0x43d905[_0x7e35('0x4b')](_0x3409d6);}})[_0x7e35('0x26')](function(_0x25a3ed){if(_0x25a3ed){return _0x25a3ed?{'count':_0x5a136a,'rows':_0x25a3ed}:null;}})['then'](respondWithResult(_0x15cf73,null))[_0x7e35('0x43')](handleError(_0x15cf73,null));};exports[_0x7e35('0x4e')]=function(_0x142a74,_0xd4a01c,_0x450cbc){var _0x10e8e={};var _0x365c1c={};var _0x5da13a;var _0x1cd614;return db['DeskConfiguration'][_0x7e35('0x4c')]({'where':{'id':_0x142a74[_0x7e35('0x45')]['id']}})[_0x7e35('0x26')](handleEntityNotFound(_0xd4a01c,null))[_0x7e35('0x26')](function(_0xaba752){if(_0xaba752){_0x5da13a=_0xaba752;_0x365c1c[_0x7e35('0x30')]=_[_0x7e35('0x32')](db[_0x7e35('0x4f')][_0x7e35('0x2c')]);_0x365c1c[_0x7e35('0x31')]=_[_0x7e35('0x32')](_0x142a74['query']);_0x365c1c[_0x7e35('0x3b')]=_['intersection'](_0x365c1c['model'],_0x365c1c[_0x7e35('0x31')]);_0x10e8e[_0x7e35('0x34')]=_[_0x7e35('0x33')](_0x365c1c[_0x7e35('0x30')],qs['fields'](_0x142a74[_0x7e35('0x31')][_0x7e35('0x35')]));_0x10e8e[_0x7e35('0x34')]=_0x10e8e['attributes'][_0x7e35('0x36')]?_0x10e8e[_0x7e35('0x34')]:_0x365c1c[_0x7e35('0x30')];_0x10e8e[_0x7e35('0x38')]=qs[_0x7e35('0x39')](_0x142a74[_0x7e35('0x31')]['sort']);_0x10e8e['where']=qs[_0x7e35('0x3b')](_[_0x7e35('0x3c')](_0x142a74[_0x7e35('0x31')],_0x365c1c[_0x7e35('0x3b')]));if(_0x142a74[_0x7e35('0x31')][_0x7e35('0x3d')]){_0x10e8e[_0x7e35('0x3a')]=_[_0x7e35('0x3e')](_0x10e8e[_0x7e35('0x3a')],{'$or':_[_0x7e35('0x4d')](_0x10e8e['attributes'],function(_0x7f3fb9){var _0xc2147c={};_0xc2147c[_0x7f3fb9]={'$like':'%'+_0x142a74[_0x7e35('0x31')][_0x7e35('0x3d')]+'%'};return _0xc2147c;})});}_0x10e8e=_['merge']({},_0x10e8e,_0x142a74[_0x7e35('0x3f')]);return _0x5da13a[_0x7e35('0x4e')](_0x10e8e);}})[_0x7e35('0x26')](function(_0x553f6c){if(_0x553f6c){_0x1cd614=_0x553f6c[_0x7e35('0x36')];if(!_0x142a74[_0x7e35('0x31')][_0x7e35('0x4a')]('nolimit')){_0x10e8e[_0x7e35('0x1e')]=qs[_0x7e35('0x1e')](_0x142a74[_0x7e35('0x31')][_0x7e35('0x1e')]);_0x10e8e[_0x7e35('0x1d')]=qs[_0x7e35('0x1d')](_0x142a74[_0x7e35('0x31')][_0x7e35('0x1d')]);}return _0x5da13a['getDescriptions'](_0x10e8e);}})[_0x7e35('0x26')](function(_0x13d52c){if(_0x13d52c){return _0x13d52c?{'count':_0x1cd614,'rows':_0x13d52c}:null;}})[_0x7e35('0x26')](respondWithResult(_0xd4a01c,null))['catch'](handleError(_0xd4a01c,null));};exports[_0x7e35('0x50')]=function(_0x336bde,_0x3c9a35,_0x16fe1c){var _0x29b5db={};var _0x4e9bbf={};var _0x24c889;var _0x26b1bd;return db[_0x7e35('0x2b')][_0x7e35('0x4c')]({'where':{'id':_0x336bde[_0x7e35('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c9a35,null))['then'](function(_0x1bff80){if(_0x1bff80){_0x24c889=_0x1bff80;_0x4e9bbf['model']=_[_0x7e35('0x32')](db['Tag']['rawAttributes']);_0x4e9bbf['query']=_[_0x7e35('0x32')](_0x336bde[_0x7e35('0x31')]);_0x4e9bbf[_0x7e35('0x3b')]=_[_0x7e35('0x33')](_0x4e9bbf['model'],_0x4e9bbf[_0x7e35('0x31')]);_0x29b5db['attributes']=_[_0x7e35('0x33')](_0x4e9bbf['model'],qs[_0x7e35('0x35')](_0x336bde['query'][_0x7e35('0x35')]));_0x29b5db['attributes']=_0x29b5db[_0x7e35('0x34')][_0x7e35('0x36')]?_0x29b5db[_0x7e35('0x34')]:_0x4e9bbf[_0x7e35('0x30')];_0x29b5db[_0x7e35('0x38')]=qs[_0x7e35('0x39')](_0x336bde[_0x7e35('0x31')][_0x7e35('0x39')]);_0x29b5db['where']=qs[_0x7e35('0x3b')](_[_0x7e35('0x3c')](_0x336bde[_0x7e35('0x31')],_0x4e9bbf[_0x7e35('0x3b')]));if(_0x336bde[_0x7e35('0x31')][_0x7e35('0x3d')]){_0x29b5db[_0x7e35('0x3a')]=_[_0x7e35('0x3e')](_0x29b5db['where'],{'$or':_[_0x7e35('0x4d')](_0x29b5db[_0x7e35('0x34')],function(_0x53d385){var _0x4455bd={};_0x4455bd[_0x53d385]={'$like':'%'+_0x336bde[_0x7e35('0x31')][_0x7e35('0x3d')]+'%'};return _0x4455bd;})});}_0x29b5db=_[_0x7e35('0x3e')]({},_0x29b5db,_0x336bde['options']);return _0x24c889[_0x7e35('0x50')](_0x29b5db);}})[_0x7e35('0x26')](function(_0x42d599){if(_0x42d599){_0x26b1bd=_0x42d599[_0x7e35('0x36')];if(!_0x336bde[_0x7e35('0x31')]['hasOwnProperty'](_0x7e35('0x37'))){_0x29b5db[_0x7e35('0x1e')]=qs[_0x7e35('0x1e')](_0x336bde[_0x7e35('0x31')]['limit']);_0x29b5db[_0x7e35('0x1d')]=qs['offset'](_0x336bde[_0x7e35('0x31')][_0x7e35('0x1d')]);}return _0x24c889['getTags'](_0x29b5db);}})[_0x7e35('0x26')](function(_0x3eea3d){if(_0x3eea3d){return _0x3eea3d?{'count':_0x26b1bd,'rows':_0x3eea3d}:null;}})['then'](respondWithResult(_0x3c9a35,null))[_0x7e35('0x43')](handleError(_0x3c9a35,null));};exports[_0x7e35('0x51')]=function(_0x169d4b,_0x546e5f,_0x1f3700){if(_0x169d4b[_0x7e35('0x48')]['id']){delete _0x169d4b[_0x7e35('0x48')]['id'];}return db[_0x7e35('0x2b')][_0x7e35('0x4c')]({'where':{'id':_0x169d4b[_0x7e35('0x45')]['id']}})['then'](handleEntityNotFound(_0x546e5f,null))['then'](function(_0x4e3590){if(_0x4e3590){return _0x4e3590[_0x7e35('0x51')](_0x169d4b['body'][_0x7e35('0x52')]||[]);}return null;})[_0x7e35('0x26')](respondWithResult(_0x546e5f,null))['catch'](handleError(_0x546e5f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e8aec12..0f598cc 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util'];(function(_0x1978fc,_0x398da2){var _0x1da73a=function(_0x8f23c2){while(--_0x8f23c2){_0x1978fc['push'](_0x1978fc['shift']());}};_0x1da73a(++_0x398da2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9722=['util','../../config/logger','api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','exports','define','int_desk_configurations'];(function(_0x2246f2,_0x32d10d){var _0x57438f=function(_0xafc755){while(--_0xafc755){_0x2246f2['push'](_0x2246f2['shift']());}};_0x57438f(++_0x32d10d);}(_0x9722,0x140));var _0x2972=function(_0x37ec84,_0x14c659){_0x37ec84=_0x37ec84-0x0;var _0x108cfd=_0x9722[_0x37ec84];return _0x108cfd;};'use strict';var _=require('lodash');var util=require(_0x2972('0x0'));var logger=require(_0x2972('0x1'))(_0x2972('0x2'));var moment=require(_0x2972('0x3'));var BPromise=require(_0x2972('0x4'));var rp=require(_0x2972('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2972('0x6'));module[_0x2972('0x7')]=function(_0x3e203d,_0x28c6c5){return _0x3e203d[_0x2972('0x8')]('DeskConfiguration',attributes,{'tableName':_0x2972('0x9'),'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 ff771ba..18a1856 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 _0x9bc7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash'];(function(_0x526ffc,_0x2548d7){var _0x36ef31=function(_0x313f48){while(--_0x313f48){_0x526ffc['push'](_0x526ffc['shift']());}};_0x36ef31(++_0x2548d7);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var moment=require(_0x79bc('0x2'));var BPromise=require(_0x79bc('0x3'));var rs=require(_0x79bc('0x4'));var fs=require('fs');var Redis=require(_0x79bc('0x5'));var db=require(_0x79bc('0x6'))['db'];var utils=require(_0x79bc('0x7'));var logger=require(_0x79bc('0x8'))(_0x79bc('0x9'));var config=require('../../config/environment');var jayson=require(_0x79bc('0xa'));var client=jayson[_0x79bc('0xb')][_0x79bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559f38,_0xf0aefd,_0x4da6a3){return new BPromise(function(_0x450c79,_0x17b1cc){return client[_0x79bc('0xd')](_0x559f38,_0x4da6a3)[_0x79bc('0xe')](function(_0x6f370e){logger['info'](_0x79bc('0xf'),_0xf0aefd,'request\x20sent');logger[_0x79bc('0x10')](_0x79bc('0x11'),_0xf0aefd,'request\x20sent',JSON['stringify'](_0x6f370e));if(_0x6f370e[_0x79bc('0x12')]){if(_0x6f370e[_0x79bc('0x12')][_0x79bc('0x13')]===0x1f4){logger[_0x79bc('0x12')](_0x79bc('0xf'),_0xf0aefd,_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);return _0x17b1cc(_0x6f370e[_0x79bc('0x12')]['message']);}logger[_0x79bc('0x12')](_0x79bc('0xf'),_0xf0aefd,_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);return _0x450c79(_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);}else{logger['info'](_0x79bc('0xf'),_0xf0aefd,_0x79bc('0x15'));_0x450c79(_0x6f370e['result'][_0x79bc('0x14')]);}})['catch'](function(_0x403ebe){logger[_0x79bc('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf0aefd,_0x403ebe);_0x17b1cc(_0x403ebe);});});} \ No newline at end of file +var _0x5fa1=['request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x3c957d,_0x40d8f3){var _0x46ab64=function(_0x470663){while(--_0x470663){_0x3c957d['push'](_0x3c957d['shift']());}};_0x46ab64(++_0x40d8f3);}(_0x5fa1,0xd2));var _0x15fa=function(_0xe3f14f,_0x4f38d1){_0xe3f14f=_0xe3f14f-0x0;var _0x3fc066=_0x5fa1[_0xe3f14f];return _0x3fc066;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var moment=require('moment');var BPromise=require(_0x15fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15fa('0x3'));var db=require(_0x15fa('0x4'))['db'];var utils=require(_0x15fa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x15fa('0x6'));var jayson=require(_0x15fa('0x7'));var client=jayson[_0x15fa('0x8')][_0x15fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eba46,_0x251f6d,_0x38fd8d){return new BPromise(function(_0x3de7f3,_0x557013){return client[_0x15fa('0xa')](_0x5eba46,_0x38fd8d)[_0x15fa('0xb')](function(_0x4a081e){logger[_0x15fa('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x251f6d,'request\x20sent');logger[_0x15fa('0xd')](_0x15fa('0xe'),_0x251f6d,_0x15fa('0xf'),JSON[_0x15fa('0x10')](_0x4a081e));if(_0x4a081e[_0x15fa('0x11')]){if(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x12')]===0x1f4){logger['error'](_0x15fa('0x13'),_0x251f6d,_0x4a081e['error']['message']);return _0x557013(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x14')]);}logger[_0x15fa('0x11')](_0x15fa('0x13'),_0x251f6d,_0x4a081e['error']['message']);return _0x3de7f3(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x14')]);}else{logger[_0x15fa('0xc')](_0x15fa('0x13'),_0x251f6d,'request\x20sent');_0x3de7f3(_0x4a081e['result'][_0x15fa('0x14')]);}})[_0x15fa('0x15')](function(_0x444a73){logger['error'](_0x15fa('0x13'),_0x251f6d,_0x444a73);_0x557013(_0x444a73);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3acea56..d8d3a2a 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 _0x8c2d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x312e17,_0x356a7d){var _0x1ca136=function(_0x54b683){while(--_0x54b683){_0x312e17['push'](_0x312e17['shift']());}};_0x1ca136(++_0x356a7d);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x3d6606,_0x1e9ed3){_0x3d6606=_0x3d6606-0x0;var _0x241e05=_0x8c2d[_0x3d6606];return _0x241e05;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8c2('0xe')]);router[_0xd8c2('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd8c2('0x10')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);module[_0xd8c2('0x12')]=router; \ No newline at end of file +var _0x8286=['index','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0x40dc29,_0x4a07e5){var _0x1cb592=function(_0x5901c3){while(--_0x5901c3){_0x40dc29['push'](_0x40dc29['shift']());}};_0x1cb592(++_0x4a07e5);}(_0x8286,0x66));var _0x6828=function(_0x2e08c3,_0x1dbe5c){_0x2e08c3=_0x2e08c3-0x0;var _0xc180af=_0x8286[_0x2e08c3];return _0xc180af;};'use strict';var multer=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var path=require(_0x6828('0x2'));var timeout=require(_0x6828('0x3'));var express=require(_0x6828('0x4'));var router=express[_0x6828('0x5')]();var fs_extra=require(_0x6828('0x6'));var auth=require(_0x6828('0x7'));var interaction=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var controller=require(_0x6828('0xa'));router['get']('/',auth[_0x6828('0xb')](),controller[_0x6828('0xc')]);router['get'](_0x6828('0xd'),auth[_0x6828('0xb')](),controller[_0x6828('0xe')]);router['post']('/',auth[_0x6828('0xb')](),controller[_0x6828('0xf')]);router[_0x6828('0x10')](_0x6828('0xd'),auth[_0x6828('0xb')](),controller[_0x6828('0x11')]);router[_0x6828('0x12')](_0x6828('0xd'),auth[_0x6828('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 9e2daa7..a7d2c20 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 _0xe31a=['picklist','STRING','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x3dc620,_0x4b3171){var _0x361690=function(_0x435608){while(--_0x435608){_0x3dc620['push'](_0x3dc620['shift']());}};_0x361690(++_0x4b3171);}(_0xe31a,0x15b));var _0xae31=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe31a[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0xae31('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xae31('0x1'),_0xae31('0x2'),_0xae31('0x3'),_0xae31('0x4'),_0xae31('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xae31('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xae31('0x1'),_0xae31('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xae31('0x6')]},'idField':{'type':Sequelize[_0xae31('0x6')]},'nameField':{'type':Sequelize[_0xae31('0x6')]},'customField':{'type':Sequelize[_0xae31('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae31('0x6')]}}; \ No newline at end of file +var _0xf9f7=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0xe1208a,_0x3f07ce){var _0x10268f=function(_0x2887d1){while(--_0x2887d1){_0xe1208a['push'](_0xe1208a['shift']());}};_0x10268f(++_0x3f07ce);}(_0xf9f7,0x1f0));var _0x7f9f=function(_0x4fa3d2,_0x1bb8db){_0x4fa3d2=_0x4fa3d2-0x0;var _0x1ea3fd=_0xf9f7[_0x4fa3d2];return _0x1ea3fd;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'type':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3'),_0x7f9f('0x4'),_0x7f9f('0x5'),'keyValue','picklist'),'defaultValue':_0x7f9f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7f9f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7f9f('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7f9f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7f9f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c20ef1e..caaa83c 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 _0x6299=['keys','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','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','limit','count','offset','set','apply','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params'];(function(_0x417b1e,_0xd72636){var _0x46526f=function(_0x2b9506){while(--_0x2b9506){_0x417b1e['push'](_0x417b1e['shift']());}};_0x46526f(++_0xd72636);}(_0x6299,0x169));var _0x9629=function(_0x36f340,_0x4838d0){_0x36f340=_0x36f340-0x0;var _0x277e50=_0x6299[_0x36f340];return _0x277e50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9629('0x0'));var jsonpatch=require(_0x9629('0x1'));var rp=require(_0x9629('0x2'));var moment=require(_0x9629('0x3'));var BPromise=require(_0x9629('0x4'));var Mustache=require(_0x9629('0x5'));var util=require('util');var path=require(_0x9629('0x6'));var sox=require(_0x9629('0x7'));var csv=require(_0x9629('0x8'));var ejs=require(_0x9629('0x9'));var fs=require('fs');var fs_extra=require(_0x9629('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9629('0xb'));var jsforce=require(_0x9629('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9629('0xd'));var Redis=require(_0x9629('0xe'));var authService=require(_0x9629('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9629('0x10'));var hardwareService=require(_0x9629('0x11'));var logger=require(_0x9629('0x12'))('api');var utils=require(_0x9629('0x13'));var config=require(_0x9629('0x14'));var licenseUtil=require(_0x9629('0x15'));var db=require(_0x9629('0x16'))['db'];function respondWithStatusCode(_0x37a60e,_0x4e7334){_0x4e7334=_0x4e7334||0xcc;return function(_0x2e2964){if(_0x2e2964){return _0x37a60e[_0x9629('0x17')](_0x4e7334);}return _0x37a60e[_0x9629('0x18')](_0x4e7334)[_0x9629('0x19')]();};}function respondWithResult(_0x216adc,_0x196eef){_0x196eef=_0x196eef||0xc8;return function(_0x5358c5){if(_0x5358c5){return _0x216adc[_0x9629('0x18')](_0x196eef)[_0x9629('0x1a')](_0x5358c5);}};}function respondWithFilteredResult(_0x73793b,_0x1fdf53){return function(_0xa4b554){if(_0xa4b554){var _0x365c6d=typeof _0x1fdf53['offset']===_0x9629('0x1b')&&typeof _0x1fdf53[_0x9629('0x1c')]===_0x9629('0x1b');var _0x33c7f3=_0xa4b554[_0x9629('0x1d')];var _0x3f777a=_0x365c6d?0x0:_0x1fdf53[_0x9629('0x1e')];var _0x447f28=_0x365c6d?_0xa4b554[_0x9629('0x1d')]:_0x1fdf53['offset']+_0x1fdf53[_0x9629('0x1c')];var _0x57ce58;if(_0x447f28>=_0x33c7f3){_0x447f28=_0x33c7f3;_0x57ce58=0xc8;}else{_0x57ce58=0xce;}_0x73793b[_0x9629('0x18')](_0x57ce58);return _0x73793b[_0x9629('0x1f')]('Content-Range',_0x3f777a+'-'+_0x447f28+'/'+_0x33c7f3)[_0x9629('0x1a')](_0xa4b554);}return null;};}function patchUpdates(_0x4ab24f){return function(_0x3a4c7a){try{jsonpatch[_0x9629('0x20')](_0x3a4c7a,_0x4ab24f,!![]);}catch(_0x1746cd){return BPromise['reject'](_0x1746cd);}return _0x3a4c7a['save']();};}function saveUpdates(_0x248d17,_0x169576){return function(_0x2956ed){if(_0x2956ed){return _0x2956ed['update'](_0x248d17)[_0x9629('0x21')](function(_0x7a93de){return _0x7a93de;});}return null;};}function removeEntity(_0xfc1c2c,_0x4ae0c7){return function(_0x5caac4){if(_0x5caac4){return _0x5caac4[_0x9629('0x22')]()[_0x9629('0x21')](function(){_0xfc1c2c[_0x9629('0x18')](0xcc)[_0x9629('0x19')]();});}};}function handleEntityNotFound(_0x1232ec,_0xaa1b76){return function(_0x4ae694){if(!_0x4ae694){_0x1232ec[_0x9629('0x17')](0x194);}return _0x4ae694;};}function handleError(_0x499bb3,_0x25ae31){_0x25ae31=_0x25ae31||0x1f4;return function(_0x1db0d9){logger[_0x9629('0x23')](_0x1db0d9[_0x9629('0x24')]);if(_0x1db0d9[_0x9629('0x25')]){delete _0x1db0d9[_0x9629('0x25')];}_0x499bb3[_0x9629('0x18')](_0x25ae31)[_0x9629('0x26')](_0x1db0d9);};}exports[_0x9629('0x27')]=function(_0x52f5cd,_0x9adda2){var _0x33b1cd={},_0x596376={},_0x2426e9={'count':0x0,'rows':[]};var _0x27cf36=_[_0x9629('0x28')](db[_0x9629('0x29')]['rawAttributes'],function(_0x3d6859){return{'name':_0x3d6859[_0x9629('0x2a')],'type':_0x3d6859['type'][_0x9629('0x2b')]};});_0x596376['model']=_[_0x9629('0x28')](_0x27cf36,_0x9629('0x25'));_0x596376['query']=_['keys'](_0x52f5cd[_0x9629('0x2c')]);_0x596376[_0x9629('0x2d')]=_[_0x9629('0x2e')](_0x596376[_0x9629('0x2f')],_0x596376[_0x9629('0x2c')]);_0x33b1cd[_0x9629('0x30')]=_[_0x9629('0x2e')](_0x596376[_0x9629('0x2f')],qs[_0x9629('0x31')](_0x52f5cd[_0x9629('0x2c')][_0x9629('0x31')]));_0x33b1cd['attributes']=_0x33b1cd[_0x9629('0x30')]['length']?_0x33b1cd[_0x9629('0x30')]:_0x596376[_0x9629('0x2f')];if(!_0x52f5cd[_0x9629('0x2c')][_0x9629('0x32')](_0x9629('0x33'))){_0x33b1cd['limit']=qs[_0x9629('0x1c')](_0x52f5cd[_0x9629('0x2c')][_0x9629('0x1c')]);_0x33b1cd[_0x9629('0x1e')]=qs[_0x9629('0x1e')](_0x52f5cd[_0x9629('0x2c')]['offset']);}_0x33b1cd[_0x9629('0x34')]=qs[_0x9629('0x35')](_0x52f5cd['query']['sort']);_0x33b1cd[_0x9629('0x36')]=qs[_0x9629('0x2d')](_[_0x9629('0x37')](_0x52f5cd['query'],_0x596376[_0x9629('0x2d')]),_0x27cf36);if(_0x52f5cd[_0x9629('0x2c')][_0x9629('0x38')]){_0x33b1cd[_0x9629('0x36')]=_[_0x9629('0x39')](_0x33b1cd[_0x9629('0x36')],{'$or':_[_0x9629('0x28')](_0x27cf36,function(_0x182a38){if(_0x182a38[_0x9629('0x3a')]!==_0x9629('0x3b')){var _0x29c189={};_0x29c189[_0x182a38['name']]={'$like':'%'+_0x52f5cd[_0x9629('0x2c')][_0x9629('0x38')]+'%'};return _0x29c189;}})});}_0x33b1cd=_[_0x9629('0x39')]({},_0x33b1cd,_0x52f5cd['options']);var _0x2d7c09={'where':_0x33b1cd[_0x9629('0x36')]};return db['DeskField'][_0x9629('0x1d')](_0x2d7c09)[_0x9629('0x21')](function(_0x5538fb){_0x2426e9['count']=_0x5538fb;if(_0x52f5cd[_0x9629('0x2c')][_0x9629('0x3c')]){_0x33b1cd[_0x9629('0x3d')]=[{'all':!![]}];}return db[_0x9629('0x29')]['findAll'](_0x33b1cd);})[_0x9629('0x21')](function(_0x16734a){_0x2426e9[_0x9629('0x3e')]=_0x16734a;return _0x2426e9;})[_0x9629('0x21')](respondWithFilteredResult(_0x9adda2,_0x33b1cd))['catch'](handleError(_0x9adda2,null));};exports[_0x9629('0x3f')]=function(_0x423dc6,_0x127dab){var _0x5052c1={'raw':!![],'where':{'id':_0x423dc6[_0x9629('0x40')]['id']}},_0x59efb8={};_0x59efb8[_0x9629('0x2f')]=_[_0x9629('0x41')](db['DeskField']['rawAttributes']);_0x59efb8[_0x9629('0x2c')]=_[_0x9629('0x41')](_0x423dc6[_0x9629('0x2c')]);_0x59efb8[_0x9629('0x2d')]=_[_0x9629('0x2e')](_0x59efb8[_0x9629('0x2f')],_0x59efb8['query']);_0x5052c1[_0x9629('0x30')]=_[_0x9629('0x2e')](_0x59efb8[_0x9629('0x2f')],qs[_0x9629('0x31')](_0x423dc6[_0x9629('0x2c')][_0x9629('0x31')]));_0x5052c1[_0x9629('0x30')]=_0x5052c1['attributes']['length']?_0x5052c1[_0x9629('0x30')]:_0x59efb8[_0x9629('0x2f')];if(_0x423dc6[_0x9629('0x2c')][_0x9629('0x3c')]){_0x5052c1[_0x9629('0x3d')]=[{'all':!![]}];}_0x5052c1=_['merge']({},_0x5052c1,_0x423dc6['options']);return db[_0x9629('0x29')][_0x9629('0x42')](_0x5052c1)[_0x9629('0x21')](handleEntityNotFound(_0x127dab,null))['then'](respondWithResult(_0x127dab,null))[_0x9629('0x43')](handleError(_0x127dab,null));};exports['create']=function(_0x32d979,_0x3cc5ee){return db[_0x9629('0x29')][_0x9629('0x44')](_0x32d979[_0x9629('0x45')],{})['then'](respondWithResult(_0x3cc5ee,0xc9))[_0x9629('0x43')](handleError(_0x3cc5ee,null));};exports[_0x9629('0x46')]=function(_0x553cf9,_0x315b73){if(_0x553cf9['body']['id']){delete _0x553cf9[_0x9629('0x45')]['id'];}return db['DeskField'][_0x9629('0x42')]({'where':{'id':_0x553cf9[_0x9629('0x40')]['id']}})[_0x9629('0x21')](handleEntityNotFound(_0x315b73,null))[_0x9629('0x21')](saveUpdates(_0x553cf9[_0x9629('0x45')],null))[_0x9629('0x21')](respondWithResult(_0x315b73,null))[_0x9629('0x43')](handleError(_0x315b73,null));};exports[_0x9629('0x22')]=function(_0x4dc231,_0x4388cf){return db[_0x9629('0x29')][_0x9629('0x42')]({'where':{'id':_0x4dc231[_0x9629('0x40')]['id']}})[_0x9629('0x21')](handleEntityNotFound(_0x4388cf,null))[_0x9629('0x21')](removeEntity(_0x4388cf,null))[_0x9629('0x43')](handleError(_0x4388cf,null));}; \ No newline at end of file +var _0xc891=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','name','send','DeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','create','body','find','catch','destroy','eml-format','fast-json-patch'];(function(_0x1a4474,_0x484797){var _0x3c19fd=function(_0x255ce9){while(--_0x255ce9){_0x1a4474['push'](_0x1a4474['shift']());}};_0x3c19fd(++_0x484797);}(_0xc891,0x152));var _0x1c89=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xc891[_0x18cd5b];return _0x5eaa52;};'use strict';var emlformat=require(_0x1c89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c89('0x1'));var rp=require('request-promise');var moment=require(_0x1c89('0x2'));var BPromise=require(_0x1c89('0x3'));var Mustache=require(_0x1c89('0x4'));var util=require('util');var path=require(_0x1c89('0x5'));var sox=require(_0x1c89('0x6'));var csv=require(_0x1c89('0x7'));var ejs=require(_0x1c89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c89('0x9'));var squel=require(_0x1c89('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c89('0xb'));var deskjs=require(_0x1c89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c89('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c89('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c89('0xf'))('api');var utils=require(_0x1c89('0x10'));var config=require(_0x1c89('0x11'));var licenseUtil=require(_0x1c89('0x12'));var db=require(_0x1c89('0x13'))['db'];function respondWithStatusCode(_0x7a4a2b,_0x27e7c0){_0x27e7c0=_0x27e7c0||0xcc;return function(_0x393b5f){if(_0x393b5f){return _0x7a4a2b[_0x1c89('0x14')](_0x27e7c0);}return _0x7a4a2b['status'](_0x27e7c0)[_0x1c89('0x15')]();};}function respondWithResult(_0x514e4d,_0x46be15){_0x46be15=_0x46be15||0xc8;return function(_0x424651){if(_0x424651){return _0x514e4d[_0x1c89('0x16')](_0x46be15)['json'](_0x424651);}};}function respondWithFilteredResult(_0x45354d,_0x29602e){return function(_0x2c9572){if(_0x2c9572){var _0x4af31b=typeof _0x29602e[_0x1c89('0x17')]===_0x1c89('0x18')&&typeof _0x29602e[_0x1c89('0x19')]===_0x1c89('0x18');var _0x33afcf=_0x2c9572[_0x1c89('0x1a')];var _0x2cb186=_0x4af31b?0x0:_0x29602e[_0x1c89('0x17')];var _0x166444=_0x4af31b?_0x2c9572[_0x1c89('0x1a')]:_0x29602e[_0x1c89('0x17')]+_0x29602e['limit'];var _0x18ce93;if(_0x166444>=_0x33afcf){_0x166444=_0x33afcf;_0x18ce93=0xc8;}else{_0x18ce93=0xce;}_0x45354d[_0x1c89('0x16')](_0x18ce93);return _0x45354d['set'](_0x1c89('0x1b'),_0x2cb186+'-'+_0x166444+'/'+_0x33afcf)[_0x1c89('0x1c')](_0x2c9572);}return null;};}function patchUpdates(_0x14121c){return function(_0x43a17a){try{jsonpatch['apply'](_0x43a17a,_0x14121c,!![]);}catch(_0x4ef155){return BPromise[_0x1c89('0x1d')](_0x4ef155);}return _0x43a17a[_0x1c89('0x1e')]();};}function saveUpdates(_0x253e07,_0x23def1){return function(_0x5b4fbc){if(_0x5b4fbc){return _0x5b4fbc[_0x1c89('0x1f')](_0x253e07)[_0x1c89('0x20')](function(_0x4fbd33){return _0x4fbd33;});}return null;};}function removeEntity(_0x45f604,_0x26a1cc){return function(_0x1ac0cc){if(_0x1ac0cc){return _0x1ac0cc['destroy']()[_0x1c89('0x20')](function(){_0x45f604[_0x1c89('0x16')](0xcc)[_0x1c89('0x15')]();});}};}function handleEntityNotFound(_0x59a87e,_0x22afe9){return function(_0x49f69b){if(!_0x49f69b){_0x59a87e['sendStatus'](0x194);}return _0x49f69b;};}function handleError(_0x35cc05,_0x352449){_0x352449=_0x352449||0x1f4;return function(_0x4c4694){logger['error'](_0x4c4694['stack']);if(_0x4c4694[_0x1c89('0x21')]){delete _0x4c4694['name'];}_0x35cc05['status'](_0x352449)[_0x1c89('0x22')](_0x4c4694);};}exports['index']=function(_0x193d8d,_0x51aa70){var _0x4dac46={},_0x25500d={},_0x10dc12={'count':0x0,'rows':[]};var _0x14f7cb=_['map'](db[_0x1c89('0x23')][_0x1c89('0x24')],function(_0x487916){return{'name':_0x487916[_0x1c89('0x25')],'type':_0x487916['type'][_0x1c89('0x26')]};});_0x25500d[_0x1c89('0x27')]=_[_0x1c89('0x28')](_0x14f7cb,_0x1c89('0x21'));_0x25500d[_0x1c89('0x29')]=_[_0x1c89('0x2a')](_0x193d8d[_0x1c89('0x29')]);_0x25500d[_0x1c89('0x2b')]=_[_0x1c89('0x2c')](_0x25500d[_0x1c89('0x27')],_0x25500d['query']);_0x4dac46[_0x1c89('0x2d')]=_['intersection'](_0x25500d['model'],qs[_0x1c89('0x2e')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x4dac46[_0x1c89('0x2d')]=_0x4dac46[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x4dac46[_0x1c89('0x2d')]:_0x25500d[_0x1c89('0x27')];if(!_0x193d8d[_0x1c89('0x29')][_0x1c89('0x30')](_0x1c89('0x31'))){_0x4dac46['limit']=qs['limit'](_0x193d8d[_0x1c89('0x29')]['limit']);_0x4dac46['offset']=qs[_0x1c89('0x17')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x17')]);}_0x4dac46[_0x1c89('0x32')]=qs[_0x1c89('0x33')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x33')]);_0x4dac46['where']=qs[_0x1c89('0x2b')](_[_0x1c89('0x34')](_0x193d8d['query'],_0x25500d[_0x1c89('0x2b')]),_0x14f7cb);if(_0x193d8d[_0x1c89('0x29')][_0x1c89('0x35')]){_0x4dac46[_0x1c89('0x36')]=_[_0x1c89('0x37')](_0x4dac46['where'],{'$or':_[_0x1c89('0x28')](_0x14f7cb,function(_0x2e6ebd){if(_0x2e6ebd[_0x1c89('0x38')]!=='VIRTUAL'){var _0xed5122={};_0xed5122[_0x2e6ebd['name']]={'$like':'%'+_0x193d8d[_0x1c89('0x29')]['filter']+'%'};return _0xed5122;}})});}_0x4dac46=_[_0x1c89('0x37')]({},_0x4dac46,_0x193d8d[_0x1c89('0x39')]);var _0x45152f={'where':_0x4dac46[_0x1c89('0x36')]};return db[_0x1c89('0x23')][_0x1c89('0x1a')](_0x45152f)[_0x1c89('0x20')](function(_0x1b8566){_0x10dc12[_0x1c89('0x1a')]=_0x1b8566;if(_0x193d8d['query'][_0x1c89('0x3a')]){_0x4dac46[_0x1c89('0x3b')]=[{'all':!![]}];}return db[_0x1c89('0x23')][_0x1c89('0x3c')](_0x4dac46);})['then'](function(_0x36e3a7){_0x10dc12[_0x1c89('0x3d')]=_0x36e3a7;return _0x10dc12;})[_0x1c89('0x20')](respondWithFilteredResult(_0x51aa70,_0x4dac46))['catch'](handleError(_0x51aa70,null));};exports['show']=function(_0xa1d4bb,_0x21fa5c){var _0x5f33c0={'raw':!![],'where':{'id':_0xa1d4bb[_0x1c89('0x3e')]['id']}},_0xebb4c3={};_0xebb4c3[_0x1c89('0x27')]=_[_0x1c89('0x2a')](db[_0x1c89('0x23')][_0x1c89('0x24')]);_0xebb4c3[_0x1c89('0x29')]=_['keys'](_0xa1d4bb[_0x1c89('0x29')]);_0xebb4c3['filters']=_['intersection'](_0xebb4c3[_0x1c89('0x27')],_0xebb4c3[_0x1c89('0x29')]);_0x5f33c0[_0x1c89('0x2d')]=_[_0x1c89('0x2c')](_0xebb4c3[_0x1c89('0x27')],qs[_0x1c89('0x2e')](_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x5f33c0[_0x1c89('0x2d')]=_0x5f33c0[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x5f33c0[_0x1c89('0x2d')]:_0xebb4c3[_0x1c89('0x27')];if(_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x3a')]){_0x5f33c0[_0x1c89('0x3b')]=[{'all':!![]}];}_0x5f33c0=_['merge']({},_0x5f33c0,_0xa1d4bb[_0x1c89('0x39')]);return db['DeskField']['find'](_0x5f33c0)[_0x1c89('0x20')](handleEntityNotFound(_0x21fa5c,null))['then'](respondWithResult(_0x21fa5c,null))['catch'](handleError(_0x21fa5c,null));};exports[_0x1c89('0x3f')]=function(_0x4b4d3f,_0x5f102d){return db['DeskField'][_0x1c89('0x3f')](_0x4b4d3f['body'],{})[_0x1c89('0x20')](respondWithResult(_0x5f102d,0xc9))['catch'](handleError(_0x5f102d,null));};exports[_0x1c89('0x1f')]=function(_0x5114bb,_0x36d5fc){if(_0x5114bb[_0x1c89('0x40')]['id']){delete _0x5114bb[_0x1c89('0x40')]['id'];}return db['DeskField'][_0x1c89('0x41')]({'where':{'id':_0x5114bb[_0x1c89('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36d5fc,null))['then'](saveUpdates(_0x5114bb[_0x1c89('0x40')],null))[_0x1c89('0x20')](respondWithResult(_0x36d5fc,null))[_0x1c89('0x42')](handleError(_0x36d5fc,null));};exports[_0x1c89('0x43')]=function(_0x94f616,_0x392fdb){return db[_0x1c89('0x23')][_0x1c89('0x41')]({'where':{'id':_0x94f616[_0x1c89('0x3e')]['id']}})[_0x1c89('0x20')](handleEntityNotFound(_0x392fdb,null))[_0x1c89('0x20')](removeEntity(_0x392fdb,null))[_0x1c89('0x42')](handleError(_0x392fdb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f691ced..95cfe67 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 _0x8744=['FieldId','lodash','util','api','moment','request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index'];(function(_0x2145c0,_0x549319){var _0x4c613a=function(_0x4e7350){while(--_0x4e7350){_0x2145c0['push'](_0x2145c0['shift']());}};_0x4c613a(++_0x549319);}(_0x8744,0x79));var _0x4874=function(_0x3b52e8,_0x3ef0d5){_0x3b52e8=_0x3b52e8-0x0;var _0x3fb4eb=_0x8744[_0x3b52e8];return _0x3fb4eb;};'use strict';var _=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var logger=require('../../config/logger')(_0x4874('0x2'));var moment=require(_0x4874('0x3'));var BPromise=require('bluebird');var rp=require(_0x4874('0x4'));var fs=require('fs');var path=require(_0x4874('0x5'));var rimraf=require('rimraf');var config=require(_0x4874('0x6'));var attributes=require(_0x4874('0x7'));module[_0x4874('0x8')]=function(_0x1e2cb1,_0x271c3d){return _0x1e2cb1['define'](_0x4874('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x4874('0xa'),'fields':['idField',_0x4874('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfe=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','idField','FieldId'];(function(_0x1661c0,_0x506ccd){var _0xa34ceb=function(_0x3ce0ee){while(--_0x3ce0ee){_0x1661c0['push'](_0x1661c0['shift']());}};_0xa34ceb(++_0x506ccd);}(_0xbbfe,0xc3));var _0xebbf=function(_0x3820d0,_0x4cf0a2){_0x3820d0=_0x3820d0-0x0;var _0x2ae9b1=_0xbbfe[_0x3820d0];return _0x2ae9b1;};'use strict';var _=require(_0xebbf('0x0'));var util=require('util');var logger=require(_0xebbf('0x1'))(_0xebbf('0x2'));var moment=require('moment');var BPromise=require(_0xebbf('0x3'));var rp=require(_0xebbf('0x4'));var fs=require('fs');var path=require(_0xebbf('0x5'));var rimraf=require('rimraf');var config=require(_0xebbf('0x6'));var attributes=require(_0xebbf('0x7'));module['exports']=function(_0x22c9e6,_0x171beb){return _0x22c9e6[_0xebbf('0x8')](_0xebbf('0x9'),attributes,{'tableName':_0xebbf('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xebbf('0xb'),_0xebbf('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 37b1f76..419a4ce 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 _0x0f71=['then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x27448d,_0x217fe5){var _0x9b5718=function(_0x2a7a38){while(--_0x2a7a38){_0x27448d['push'](_0x27448d['shift']());}};_0x9b5718(++_0x217fe5);}(_0x0f71,0x164));var _0x10f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f71[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x10f7('0x0'));var util=require(_0x10f7('0x1'));var moment=require(_0x10f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x10f7('0x3'));var fs=require('fs');var Redis=require(_0x10f7('0x4'));var db=require(_0x10f7('0x5'))['db'];var utils=require(_0x10f7('0x6'));var logger=require(_0x10f7('0x7'))(_0x10f7('0x8'));var config=require(_0x10f7('0x9'));var jayson=require(_0x10f7('0xa'));var client=jayson['client'][_0x10f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2421a,_0x192f12,_0x1bb07f){return new BPromise(function(_0x4d881c,_0x13fb8b){return client['request'](_0xa2421a,_0x1bb07f)[_0x10f7('0xc')](function(_0x39f935){logger[_0x10f7('0xd')](_0x10f7('0xe'),_0x192f12,'request\x20sent');logger[_0x10f7('0xf')](_0x10f7('0x10'),_0x192f12,_0x10f7('0x11'),JSON[_0x10f7('0x12')](_0x39f935));if(_0x39f935['error']){if(_0x39f935['error']['code']===0x1f4){logger[_0x10f7('0x13')](_0x10f7('0xe'),_0x192f12,_0x39f935[_0x10f7('0x13')]['message']);return _0x13fb8b(_0x39f935['error'][_0x10f7('0x14')]);}logger[_0x10f7('0x13')](_0x10f7('0xe'),_0x192f12,_0x39f935['error'][_0x10f7('0x14')]);return _0x4d881c(_0x39f935['error'][_0x10f7('0x14')]);}else{logger[_0x10f7('0xd')](_0x10f7('0xe'),_0x192f12,'request\x20sent');_0x4d881c(_0x39f935[_0x10f7('0x15')][_0x10f7('0x14')]);}})[_0x10f7('0x16')](function(_0x2af9b7){logger[_0x10f7('0x13')](_0x10f7('0xe'),_0x192f12,_0x2af9b7);_0x13fb8b(_0x2af9b7);});});} \ No newline at end of file +var _0xb4b7=['../../config/logger','../../config/environment','client','http','request','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x447dc6,_0x4e29c8){var _0x36f1ae=function(_0x5f5370){while(--_0x5f5370){_0x447dc6['push'](_0x447dc6['shift']());}};_0x36f1ae(++_0x4e29c8);}(_0xb4b7,0x73));var _0x7b4b=function(_0x561797,_0xd4598d){_0x561797=_0x561797-0x0;var _0x354033=_0xb4b7[_0x561797];return _0x354033;};'use strict';var _=require(_0x7b4b('0x0'));var util=require('util');var moment=require(_0x7b4b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b4b('0x2'));var fs=require('fs');var Redis=require(_0x7b4b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b4b('0x4'));var logger=require(_0x7b4b('0x5'))('rpc');var config=require(_0x7b4b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b4b('0x7')][_0x7b4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x232857,_0x153536,_0x537ae0){return new BPromise(function(_0x4f2c2,_0xcfd549){return client[_0x7b4b('0x9')](_0x232857,_0x537ae0)['then'](function(_0xec79fe){logger['info']('DeskField,\x20%s,\x20%s',_0x153536,_0x7b4b('0xa'));logger[_0x7b4b('0xb')](_0x7b4b('0xc'),_0x153536,'request\x20sent',JSON[_0x7b4b('0xd')](_0xec79fe));if(_0xec79fe[_0x7b4b('0xe')]){if(_0xec79fe['error'][_0x7b4b('0xf')]===0x1f4){logger[_0x7b4b('0xe')](_0x7b4b('0x10'),_0x153536,_0xec79fe[_0x7b4b('0xe')]['message']);return _0xcfd549(_0xec79fe[_0x7b4b('0xe')][_0x7b4b('0x11')]);}logger['error'](_0x7b4b('0x10'),_0x153536,_0xec79fe['error'][_0x7b4b('0x11')]);return _0x4f2c2(_0xec79fe[_0x7b4b('0xe')]['message']);}else{logger[_0x7b4b('0x12')](_0x7b4b('0x10'),_0x153536,'request\x20sent');_0x4f2c2(_0xec79fe[_0x7b4b('0x13')][_0x7b4b('0x11')]);}})['catch'](function(_0x1db935){logger[_0x7b4b('0xe')](_0x7b4b('0x10'),_0x153536,_0x1db935);_0xcfd549(_0x1db935);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 423fa69..a3c9d9d 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 _0x6286=['put','update','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x419a58,_0x5f9e86){var _0x2e0158=function(_0x3a10de){while(--_0x3a10de){_0x419a58['push'](_0x419a58['shift']());}};_0x2e0158(++_0x5f9e86);}(_0x6286,0xd2));var _0x6628=function(_0x31e649,_0xb74ea1){_0x31e649=_0x31e649-0x0;var _0x2925ae=_0x6286[_0x31e649];return _0x2925ae;};'use strict';var multer=require('multer');var util=require(_0x6628('0x0'));var path=require(_0x6628('0x1'));var timeout=require(_0x6628('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6628('0x3'));var auth=require(_0x6628('0x4'));var interaction=require(_0x6628('0x5'));var config=require(_0x6628('0x6'));var controller=require(_0x6628('0x7'));router[_0x6628('0x8')]('/',auth[_0x6628('0x9')](),controller[_0x6628('0xa')]);router[_0x6628('0x8')](_0x6628('0xb'),auth[_0x6628('0x9')](),controller[_0x6628('0xc')]);router[_0x6628('0x8')](_0x6628('0xd'),auth[_0x6628('0x9')](),controller[_0x6628('0xe')]);router['get'](_0x6628('0xf'),auth[_0x6628('0x9')](),controller[_0x6628('0x10')]);router[_0x6628('0x11')]('/',auth[_0x6628('0x9')](),controller[_0x6628('0x12')]);router[_0x6628('0x11')]('/:id/configurations',auth[_0x6628('0x9')](),controller[_0x6628('0x13')]);router[_0x6628('0x14')]('/:id',auth[_0x6628('0x9')](),controller[_0x6628('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6628('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb3dd=['getConfigurations','/:id/fields','getFields','post','isAuthenticated','create','/:id/configurations','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','show'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb3dd,0x1d4));var _0xdb3d=function(_0xdff437,_0x5b2d74){_0xdff437=_0xdff437-0x0;var _0x7e0f5c=_0xb3dd[_0xdff437];return _0x7e0f5c;};'use strict';var multer=require(_0xdb3d('0x0'));var util=require(_0xdb3d('0x1'));var path=require(_0xdb3d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb3d('0x3')]();var fs_extra=require(_0xdb3d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdb3d('0x5'));var config=require(_0xdb3d('0x6'));var controller=require(_0xdb3d('0x7'));router[_0xdb3d('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb3d('0x9')]);router['get'](_0xdb3d('0xa'),auth['isAuthenticated'](),controller[_0xdb3d('0xb')]);router[_0xdb3d('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdb3d('0xc')]);router[_0xdb3d('0x8')](_0xdb3d('0xd'),auth['isAuthenticated'](),controller[_0xdb3d('0xe')]);router[_0xdb3d('0xf')]('/',auth[_0xdb3d('0x10')](),controller[_0xdb3d('0x11')]);router['post'](_0xdb3d('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xdb3d('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdb3d('0xa'),auth[_0xdb3d('0x10')](),controller['destroy']);module[_0xdb3d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7b8f2ac..feeeb20 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 _0x02a7=['exports','STRING'];(function(_0x5730e1,_0x2d934d){var _0x4638e7=function(_0x22ddfa){while(--_0x22ddfa){_0x5730e1['push'](_0x5730e1['shift']());}};_0x4638e7(++_0x2d934d);}(_0x02a7,0x7a));var _0x702a=function(_0x2580bc,_0x3d7907){_0x2580bc=_0x2580bc-0x0;var _0x4d0855=_0x02a7[_0x2580bc];return _0x4d0855;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x702a('0x1')]},'remoteUri':{'type':Sequelize[_0x702a('0x1')]},'tenantId':{'type':Sequelize[_0x702a('0x1')]},'clientId':{'type':Sequelize[_0x702a('0x1')]},'clientSecret':{'type':Sequelize[_0x702a('0x1')]},'serverUrl':{'type':Sequelize[_0x702a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x702a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8832=['sequelize','exports','STRING','BOOLEAN'];(function(_0x43e7f9,_0x5cdaef){var _0x5ef242=function(_0x333a53){while(--_0x333a53){_0x43e7f9['push'](_0x43e7f9['shift']());}};_0x5ef242(++_0x5cdaef);}(_0x8832,0x1f4));var _0x2883=function(_0x39bf83,_0x28baca){_0x39bf83=_0x39bf83-0x0;var _0x42d171=_0x8832[_0x39bf83];return _0x42d171;};'use strict';var Sequelize=require(_0x2883('0x0'));module[_0x2883('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2883('0x2')]},'remoteUri':{'type':Sequelize[_0x2883('0x2')]},'tenantId':{'type':Sequelize[_0x2883('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2883('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2883('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2883('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 ff24cfd..e3b9dfd 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 _0xa45c=['customerid','ownerid','caseorigincode','subject','regardingobjectid','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','tenantId','clientSecret','GET','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../config/logger','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','order','pick','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description'];(function(_0x1422a9,_0x4d21a6){var _0x3baa66=function(_0x32f8c7){while(--_0x32f8c7){_0x1422a9['push'](_0x1422a9['shift']());}};_0x3baa66(++_0x4d21a6);}(_0xa45c,0x6d));var _0xca45=function(_0x39f024,_0x5cfb18){_0x39f024=_0x39f024-0x0;var _0x31bcee=_0xa45c[_0x39f024];return _0x31bcee;};'use strict';var rp=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xca45('0x2'))('api');var db=require(_0xca45('0x3'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x16a36c,_0x47d8b9){_0x47d8b9=_0x47d8b9||0xc8;return function(_0x4d45e6){if(_0x4d45e6){return _0x16a36c[_0xca45('0x4')](_0x47d8b9)[_0xca45('0x5')](_0x4d45e6);}};}function respondWithFilteredResult(_0x18d789,_0x15628b){return function(_0x578a7b){if(_0x578a7b){var _0x1a8b9c=typeof _0x15628b[_0xca45('0x6')]===_0xca45('0x7')&&typeof _0x15628b[_0xca45('0x8')]===_0xca45('0x7');var _0x5c18b9=_0x578a7b[_0xca45('0x9')];var _0x342542=_0x1a8b9c?0x0:_0x15628b[_0xca45('0x6')];var _0x151691=_0x1a8b9c?_0x578a7b[_0xca45('0x9')]:_0x15628b[_0xca45('0x6')]+_0x15628b[_0xca45('0x8')];var _0x4a8692;if(_0x151691>=_0x5c18b9){_0x151691=_0x5c18b9;_0x4a8692=0xc8;}else{_0x4a8692=0xce;}_0x18d789[_0xca45('0x4')](_0x4a8692);return _0x18d789[_0xca45('0xa')](_0xca45('0xb'),_0x342542+'-'+_0x151691+'/'+_0x5c18b9)[_0xca45('0x5')](_0x578a7b);}return null;};}function saveUpdates(_0x580c43){return function(_0x3044b1){if(_0x3044b1){return _0x3044b1[_0xca45('0xc')](_0x580c43)[_0xca45('0xd')](function(_0x59b6de){return _0x59b6de;});}return null;};}function removeEntity(_0x214939){return function(_0x569ba6){if(_0x569ba6){return _0x569ba6[_0xca45('0xe')]()[_0xca45('0xd')](function(){_0x214939[_0xca45('0x4')](0xcc)[_0xca45('0xf')]();});}};}function handleEntityNotFound(_0x35b130){return function(_0x323b19){if(!_0x323b19){_0x35b130[_0xca45('0x10')](0x194);}return _0x323b19;};}function handleError(_0x570784,_0x571baa){_0x571baa=_0x571baa||0x1f4;return function(_0x5b4e29){logger['error'](_0x5b4e29[_0xca45('0x11')]);if(_0x5b4e29[_0xca45('0x12')]){delete _0x5b4e29['name'];}_0x570784[_0xca45('0x4')](_0x571baa)[_0xca45('0x13')](_0x5b4e29);};}exports['index']=function(_0x40540f,_0x3f0c23){var _0x446243={},_0x11cbf0={},_0x5a231d={'count':0x0,'rows':[]};var _0x3e396b=_[_0xca45('0x14')](db[_0xca45('0x15')][_0xca45('0x16')],function(_0x548d0c){return{'name':_0x548d0c[_0xca45('0x17')],'type':_0x548d0c[_0xca45('0x18')][_0xca45('0x19')]};});_0x11cbf0[_0xca45('0x1a')]=_[_0xca45('0x14')](_0x3e396b,_0xca45('0x12'));_0x11cbf0[_0xca45('0x1b')]=_[_0xca45('0x1c')](_0x40540f[_0xca45('0x1b')]);_0x11cbf0['filters']=_[_0xca45('0x1d')](_0x11cbf0[_0xca45('0x1a')],_0x11cbf0[_0xca45('0x1b')]);_0x446243[_0xca45('0x1e')]=_[_0xca45('0x1d')](_0x11cbf0['model'],qs['fields'](_0x40540f['query'][_0xca45('0x1f')]));_0x446243['attributes']=_0x446243['attributes'][_0xca45('0x20')]?_0x446243[_0xca45('0x1e')]:_0x11cbf0[_0xca45('0x1a')];if(!_0x40540f[_0xca45('0x1b')][_0xca45('0x21')]('nolimit')){_0x446243[_0xca45('0x8')]=qs[_0xca45('0x8')](_0x40540f[_0xca45('0x1b')]['limit']);_0x446243['offset']=qs['offset'](_0x40540f[_0xca45('0x1b')][_0xca45('0x6')]);}_0x446243['order']=qs[_0xca45('0x22')](_0x40540f[_0xca45('0x1b')][_0xca45('0x22')]);_0x446243[_0xca45('0x23')]=qs['filters'](_['pick'](_0x40540f['query'],_0x11cbf0[_0xca45('0x24')]),_0x3e396b);if(_0x40540f['query']['filter']){_0x446243['where']=_[_0xca45('0x25')](_0x446243['where'],{'$or':_['map'](_0x3e396b,function(_0x119244){if(_0x119244[_0xca45('0x18')]!==_0xca45('0x26')){var _0x535ae0={};_0x535ae0[_0x119244[_0xca45('0x12')]]={'$like':'%'+_0x40540f[_0xca45('0x1b')]['filter']+'%'};return _0x535ae0;}})});}_0x446243=_[_0xca45('0x25')]({},_0x446243,_0x40540f[_0xca45('0x27')]);var _0x3a47a2={'where':_0x446243[_0xca45('0x23')]};return db[_0xca45('0x15')][_0xca45('0x9')](_0x3a47a2)[_0xca45('0xd')](function(_0x291dd6){_0x5a231d[_0xca45('0x9')]=_0x291dd6;if(_0x40540f[_0xca45('0x1b')][_0xca45('0x28')]){_0x446243[_0xca45('0x29')]=[{'all':!![]}];}return db[_0xca45('0x15')]['findAll'](_0x446243);})['then'](function(_0x53c4f7){_0x5a231d[_0xca45('0x2a')]=_0x53c4f7;return _0x5a231d;})[_0xca45('0xd')](respondWithFilteredResult(_0x3f0c23,_0x446243))['catch'](handleError(_0x3f0c23,null));};exports['show']=function(_0x366390,_0x4a3eb9){var _0x34cfae={'raw':![],'where':{'id':_0x366390[_0xca45('0x2b')]['id']}},_0x53202c={};_0x53202c[_0xca45('0x1a')]=_[_0xca45('0x1c')](db[_0xca45('0x15')][_0xca45('0x16')]);_0x53202c['query']=_[_0xca45('0x1c')](_0x366390['query']);_0x53202c[_0xca45('0x24')]=_[_0xca45('0x1d')](_0x53202c[_0xca45('0x1a')],_0x53202c[_0xca45('0x1b')]);_0x34cfae['attributes']=_[_0xca45('0x1d')](_0x53202c[_0xca45('0x1a')],qs[_0xca45('0x1f')](_0x366390['query']['fields']));_0x34cfae[_0xca45('0x1e')]=_0x34cfae[_0xca45('0x1e')][_0xca45('0x20')]?_0x34cfae[_0xca45('0x1e')]:_0x53202c[_0xca45('0x1a')];if(_0x366390[_0xca45('0x1b')][_0xca45('0x28')]){_0x34cfae[_0xca45('0x29')]=[{'all':!![]}];}_0x34cfae=_[_0xca45('0x25')]({},_0x34cfae,_0x366390[_0xca45('0x27')]);return db[_0xca45('0x15')][_0xca45('0x2c')](_0x34cfae)[_0xca45('0xd')](handleEntityNotFound(_0x4a3eb9,null))[_0xca45('0xd')](respondWithResult(_0x4a3eb9,null))[_0xca45('0x2d')](handleError(_0x4a3eb9,null));};exports[_0xca45('0x2e')]=function(_0x288d8c,_0x190ea6){return db['Dynamics365Account'][_0xca45('0x2e')](_0x288d8c[_0xca45('0x2f')],{})[_0xca45('0xd')](respondWithResult(_0x190ea6,0xc9))['catch'](handleError(_0x190ea6,null));};exports[_0xca45('0xc')]=function(_0x4e7539,_0x1dba0e){if(_0x4e7539[_0xca45('0x2f')]['id']){delete _0x4e7539['body']['id'];}return db[_0xca45('0x15')][_0xca45('0x2c')]({'where':{'id':_0x4e7539[_0xca45('0x2b')]['id']}})[_0xca45('0xd')](handleEntityNotFound(_0x1dba0e,null))[_0xca45('0xd')](saveUpdates(_0x4e7539[_0xca45('0x2f')],null))[_0xca45('0xd')](respondWithResult(_0x1dba0e,null))[_0xca45('0x2d')](handleError(_0x1dba0e,null));};exports[_0xca45('0xe')]=function(_0x195a9a,_0x310d75){return db[_0xca45('0x15')][_0xca45('0x2c')]({'where':{'id':_0x195a9a[_0xca45('0x2b')]['id']}})[_0xca45('0xd')](handleEntityNotFound(_0x310d75,null))[_0xca45('0xd')](removeEntity(_0x310d75,null))[_0xca45('0x2d')](handleError(_0x310d75,null));};exports[_0xca45('0x30')]=function(_0x465b71,_0x4bbe9e){var _0x1a0c5e={};var _0x2c78e8={};var _0x1f224d;var _0x3fc876;return db[_0xca45('0x15')][_0xca45('0x31')]({'where':{'id':_0x465b71[_0xca45('0x2b')]['id']}})[_0xca45('0xd')](handleEntityNotFound(_0x4bbe9e,null))[_0xca45('0xd')](function(_0x427bf5){if(_0x427bf5){_0x1f224d=_0x427bf5;_0x2c78e8[_0xca45('0x1a')]=_[_0xca45('0x1c')](db[_0xca45('0x32')][_0xca45('0x16')]);_0x2c78e8['query']=_[_0xca45('0x1c')](_0x465b71[_0xca45('0x1b')]);_0x2c78e8[_0xca45('0x24')]=_[_0xca45('0x1d')](_0x2c78e8[_0xca45('0x1a')],_0x2c78e8[_0xca45('0x1b')]);_0x1a0c5e[_0xca45('0x1e')]=_[_0xca45('0x1d')](_0x2c78e8[_0xca45('0x1a')],qs[_0xca45('0x1f')](_0x465b71[_0xca45('0x1b')]['fields']));_0x1a0c5e['attributes']=_0x1a0c5e[_0xca45('0x1e')][_0xca45('0x20')]?_0x1a0c5e['attributes']:_0x2c78e8[_0xca45('0x1a')];_0x1a0c5e[_0xca45('0x33')]=qs[_0xca45('0x22')](_0x465b71[_0xca45('0x1b')][_0xca45('0x22')]);_0x1a0c5e[_0xca45('0x23')]=qs[_0xca45('0x24')](_[_0xca45('0x34')](_0x465b71[_0xca45('0x1b')],_0x2c78e8[_0xca45('0x24')]));if(_0x465b71[_0xca45('0x1b')][_0xca45('0x35')]){_0x1a0c5e[_0xca45('0x23')]=_['merge'](_0x1a0c5e[_0xca45('0x23')],{'$or':_[_0xca45('0x14')](_0x1a0c5e[_0xca45('0x1e')],function(_0x3820b2){var _0x44b7e1={};_0x44b7e1[_0x3820b2]={'$like':'%'+_0x465b71[_0xca45('0x1b')][_0xca45('0x35')]+'%'};return _0x44b7e1;})});}_0x1a0c5e=_[_0xca45('0x25')]({},_0x1a0c5e,_0x465b71[_0xca45('0x27')]);return _0x1f224d['getConfigurations'](_0x1a0c5e);}})['then'](function(_0x4cb20b){if(_0x4cb20b){_0x3fc876=_0x4cb20b['length'];if(!_0x465b71[_0xca45('0x1b')][_0xca45('0x21')](_0xca45('0x36'))){_0x1a0c5e[_0xca45('0x8')]=qs['limit'](_0x465b71[_0xca45('0x1b')][_0xca45('0x8')]);_0x1a0c5e['offset']=qs[_0xca45('0x6')](_0x465b71[_0xca45('0x1b')]['offset']);}return _0x1f224d[_0xca45('0x30')](_0x1a0c5e);}})['then'](function(_0xf29cbc){if(_0xf29cbc){return _0xf29cbc?{'count':_0x3fc876,'rows':_0xf29cbc}:null;}})['then'](respondWithResult(_0x4bbe9e,null))[_0xca45('0x2d')](handleError(_0x4bbe9e,null));};exports[_0xca45('0x37')]=function(_0x4c66e4,_0x4c878a){if(_0x4c66e4[_0xca45('0x2f')]['id']){delete _0x4c66e4[_0xca45('0x2f')]['id'];}return db['Dynamics365Account'][_0xca45('0x31')]({'where':{'id':_0x4c66e4[_0xca45('0x2b')]['id']}})[_0xca45('0xd')](handleEntityNotFound(_0x4c878a,null))['then'](function(_0x12d6da){if(_0x12d6da){_0x4c66e4[_0xca45('0x2f')][_0xca45('0x38')]=_0x12d6da['id'];_0x4c66e4[_0xca45('0x2f')][_0xca45('0x39')]=integrations[_0xca45('0x3a')](_0x4c66e4[_0xca45('0x2f')][_0xca45('0x3b')],_0x4c66e4[_0xca45('0x2f')]['type']);_0x4c66e4[_0xca45('0x2f')][_0xca45('0x3c')]=integrations[_0xca45('0x3d')](_0x4c66e4[_0xca45('0x2f')][_0xca45('0x3b')],_0x4c66e4['body'][_0xca45('0x18')]);return db['Dynamics365Configuration']['create'](_0x4c66e4[_0xca45('0x2f')],{'include':[{'model':db['Dynamics365Field'],'as':_0xca45('0x39')},{'model':db[_0xca45('0x3e')],'as':_0xca45('0x3c')}]});}return null;})[_0xca45('0xd')](respondWithResult(_0x4c878a,null))[_0xca45('0x2d')](handleError(_0x4c878a,null));};function sanitizeRemoteUri(_0x5e8505){var _0x41e17a=_0x5e8505[_0xca45('0x3f')](-0x1);if(_0x41e17a==='/')return _0x5e8505[_0xca45('0x40')](0x0,_0x5e8505[_0xca45('0x41')](_0x41e17a));return _0x5e8505;}function getWebApiUrl(_0x1dd3bc){return util[_0xca45('0x42')](_0xca45('0x43'),_0x1dd3bc);}exports[_0xca45('0x44')]=function(_0x1995de,_0x5bb442){var _0x16c7ee=_0x1995de[_0xca45('0x1b')][_0xca45('0x45')];var _0x4732ad=_0x16c7ee===_0xca45('0x46')?_0xca45('0x47'):_0xca45('0x48');var _0x58411c='';var _0x37dd71='';var _0x2d11a1='';var _0x304126='';var _0x5346f8='';var _0x13f088='';var _0xc455c1='';var _0x50a812='';var _0x46dff7=[_0xca45('0x49'),_0xca45('0x4a'),_0xca45('0x4b'),_0xca45('0x4c'),_0xca45('0x4d'),_0xca45('0x4e'),'phonenumber',_0xca45('0x4f'),'directioncode','phonecall_activity_parties'];var _0x15529a=['accountidname',_0xca45('0x50'),'actualserviceunits','billedserviceunits',_0xca45('0x51'),'contactidyominame',_0xca45('0x52'),_0xca45('0x53'),_0xca45('0x54'),_0xca45('0x55'),'createdbyname','createdbyyominame','createdon','createdonbehalfbyname',_0xca45('0x56'),'customeridname',_0xca45('0x57'),_0xca45('0x58'),'emailaddress',_0xca45('0x59'),_0xca45('0x5a'),_0xca45('0x5b'),'escalatedon',_0xca45('0x5c'),_0xca45('0x5d'),_0xca45('0x5e'),_0xca45('0x5f'),'influencescore',_0xca45('0x60'),'lastonholdtime',_0xca45('0x61'),_0xca45('0x62'),_0xca45('0x63'),_0xca45('0x64'),_0xca45('0x65'),_0xca45('0x66'),_0xca45('0x67'),'modifiedonbehalfbyyominame',_0xca45('0x68'),_0xca45('0x69'),_0xca45('0x6a'),'onholdtime',_0xca45('0x6b'),'owneridname',_0xca45('0x6c'),_0xca45('0x6d'),_0xca45('0x6e'),'primarycontactidname',_0xca45('0x6f'),_0xca45('0x70'),_0xca45('0x71'),_0xca45('0x72'),_0xca45('0x73'),'resolvebykpiidname',_0xca45('0x74'),_0xca45('0x75'),_0xca45('0x76'),_0xca45('0x77'),_0xca45('0x78'),_0xca45('0x79'),_0xca45('0x7a'),_0xca45('0x7b'),'statuscode',_0xca45('0x7c'),_0xca45('0x7d'),_0xca45('0x7e'),_0xca45('0x7f'),_0xca45('0x80'),_0xca45('0x81'),'versionnumber'];var _0x4cbd02=_0x46dff7[_0xca45('0x82')](_0x15529a);return db[_0xca45('0x15')][_0xca45('0x31')]({'where':{'id':_0x1995de['params']['id']},'attributes':['id',_0xca45('0x83'),_0xca45('0x84'),_0xca45('0x85'),'tenantId',_0xca45('0x86'),'clientSecret',_0xca45('0x87')],'include':[{'model':db[_0xca45('0x88')],'as':'CloudProvider','attributes':['id',_0xca45('0x89'),'data7']}]})['then'](handleEntityNotFound(_0x5bb442,null))['then'](function(_0x209784){if(_0x209784){if(_0x209784[_0xca45('0x87')]){_0x209784[_0xca45('0x8a')]=_0x209784[_0xca45('0x88')][_0xca45('0x89')];_0x50a812=sanitizeRemoteUri(_0x209784[_0xca45('0x88')][_0xca45('0x8b')]);_0xc455c1=getWebApiUrl(_0x50a812);return _0x209784;}_0x50a812=sanitizeRemoteUri(_0x209784['remoteUri']);_0xc455c1=getWebApiUrl(_0x50a812);var _0x45a833={'method':_0xca45('0x8c'),'uri':_0xca45('0x8d')+_0x209784[_0xca45('0x8e')]+'/oauth2/token','form':{'client_id':_0x209784[_0xca45('0x86')],'resource':_0x50a812,'username':_0x209784['username'],'password':_0x209784[_0xca45('0x84')],'grant_type':_0xca45('0x84'),'client_secret':_0x209784[_0xca45('0x8f')]},'json':!![]};return rp(_0x45a833);}})[_0xca45('0xd')](function(_0x4fd5dc){_0x13f088=_0x4fd5dc[_0xca45('0x8a')];var _0x566e6b={'method':_0xca45('0x90'),'uri':encodeURI(_0xc455c1+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4732ad+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x13f088,'If-None-Match':null,'OData-Version':_0xca45('0x91')},'json':!![]};return rp(_0x566e6b);})['then'](function(_0x560e17){var _0x3ad72f=_0x560e17['value'][0x0];var _0x11fbe9=_0x3ad72f[_0xca45('0x92')];var _0x325380={'method':_0xca45('0x90'),'uri':_0xc455c1+_0xca45('0x93')+_0x11fbe9+_0xca45('0x94'),'headers':{'Authorization':'Bearer\x20'+_0x13f088,'If-None-Match':null,'OData-Version':_0xca45('0x91')},'json':!![]};return rp(_0x325380);})['then'](function(_0x4a141a){_0x58411c=_0x4a141a;_0x37dd71=_0x58411c['Attributes'];_0x37dd71=_['remove'](_0x37dd71,function(_0x5959d5){return!_0x4cbd02[_0xca45('0x95')](_0x5959d5['LogicalName']);});var _0x1275e9=[];var _0x15a797=[];_0x37dd71[_0xca45('0x96')](function(_0x21e558){if(_0x21e558['@odata.type']){var _0x4bee4f=_0x21e558[_0xca45('0x97')][_0xca45('0x40')](_0x21e558[_0xca45('0x97')][_0xca45('0x41')]('.')+0x1);if(_0x4bee4f===_0xca45('0x98')){_0x1275e9['push'](getSelectList(_0xc455c1,_0x16c7ee,_0x15a797,_0x58411c[_0xca45('0x92')],_0x21e558[_0xca45('0x92')],_0x13f088));}}});return Promise[_0xca45('0x99')](_0x1275e9);})[_0xca45('0xd')](function(_0x4fa1f9){_0x2d11a1=_0x4fa1f9[0x0];var _0xdf4f81=[];var _0x4de8d1=[];_0x37dd71[_0xca45('0x96')](function(_0x31ca64){if(!_['isNil'](_0x31ca64[_0xca45('0x97')])){var _0x5f19a6=_0x31ca64[_0xca45('0x97')][_0xca45('0x40')](_0x31ca64[_0xca45('0x97')][_0xca45('0x41')]('.')+0x1);if(_0x5f19a6===_0xca45('0x9a')){_0xdf4f81[_0xca45('0x9b')](getBooleanList(_0xc455c1,_0x16c7ee,_0x4de8d1,_0x58411c[_0xca45('0x92')],_0x31ca64[_0xca45('0x92')],_0x13f088));}}});return Promise[_0xca45('0x99')](_0xdf4f81);})[_0xca45('0xd')](function(_0x518b32){_0x304126=_0x518b32[0x0];var _0x20f055=[];var _0x46649f=[];_0x37dd71['forEach'](function(_0x41a0d5){if(_0x41a0d5[_0xca45('0x97')]){var _0x571cde=_0x41a0d5[_0xca45('0x97')][_0xca45('0x40')](_0x41a0d5[_0xca45('0x97')][_0xca45('0x41')]('.')+0x1);if(_0x571cde===_0xca45('0x9c')||_0x571cde===_0xca45('0x9d')||_0x571cde===_0xca45('0x9e')||_0x571cde==='IntegerAttributeMetadata'||_0x571cde==='MemoAttributeMetadata'||_0x571cde===_0xca45('0x9f')||_0x571cde===_0xca45('0xa0')||_0x571cde===_0xca45('0xa1')||_0x571cde===_0xca45('0xa2')||_0x571cde===_0xca45('0xa3')){_0x20f055['push'](getInputList(_0xc455c1,_0x16c7ee,_0x571cde,_0x46649f,_0x58411c[_0xca45('0x92')],_0x41a0d5[_0xca45('0x92')],_0x13f088));}}});return Promise[_0xca45('0x99')](_0x20f055);})[_0xca45('0xd')](function(_0x598488){_0x5346f8=_0x598488[0x0];var _0x11c4be=_0x2d11a1[_0xca45('0x82')](_0x304126)[_0xca45('0x82')](_0x5346f8);var _0x28b119={'count':_0x11c4be[_0xca45('0x20')],'rows':_0x11c4be};return _0x28b119;})[_0xca45('0xd')](respondWithResult(_0x5bb442,null))[_0xca45('0x2d')](function(_0x191101){var _0x887e16=_0x1995de[_0xca45('0x1b')][_0xca45('0xa4')]?0x1f4:_0x191101[_0xca45('0xa5')]||0x1f4;logger['error'](_0x191101[_0xca45('0x11')]);delete _0x191101[_0xca45('0x12')];if(_0x887e16===0x191){_0x887e16=0x190;}_0x5bb442[_0xca45('0x4')](_0x887e16)[_0xca45('0x13')](_0x1995de[_0xca45('0x1b')][_0xca45('0xa4')]?{'message':_0xca45('0xa6'),'statusCode':_0x191101['statusCode']}:_0x191101);});};function getSelectList(_0x5f5a5a,_0x4ee2f7,_0x15249f,_0x4b2ea4,_0x444f5b,_0x1a76ee){var _0x1949cc={'method':_0xca45('0x90'),'uri':_0x5f5a5a+_0xca45('0x93')+_0x4b2ea4+_0xca45('0xa7')+_0x444f5b+_0xca45('0xa8')+_0xca45('0xa9'),'headers':{'Authorization':_0xca45('0xaa')+_0x1a76ee,'If-None-Match':null,'OData-Version':_0xca45('0x91')},'json':!![]};return rp(_0x1949cc)['then'](function(_0x275404){var _0xfc818=[];var _0x33eb47=_0x275404[_0xca45('0xab')][_0xca45('0xac')];_0x33eb47['forEach'](function(_0xc3de51){_0xfc818[_0xca45('0x9b')]({'name':_0xc3de51['Label'][_0xca45('0xad')][_0xca45('0xae')],'value':String(_0xc3de51[_0xca45('0xaf')])});});var _0x414563={'id':_0x4ee2f7+'_'+_0x275404[_0xca45('0xb0')],'name':_0x275404[_0xca45('0xb1')][_0xca45('0xad')][_0xca45('0xae')],'custom':![],'options':_0xfc818};_0x15249f['push'](_0x414563);return _0x15249f;});}function getBooleanList(_0x3c763e,_0x2071f6,_0x5421b8,_0x2c8e11,_0x374d58,_0xc9d56b){var _0x127806={'method':_0xca45('0x90'),'uri':_0x3c763e+'EntityDefinitions('+_0x2c8e11+_0xca45('0xa7')+_0x374d58+_0xca45('0xb2'),'headers':{'Authorization':_0xca45('0xaa')+_0xc9d56b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x127806)[_0xca45('0xd')](function(_0x1d4782){var _0x2afef2=[];_0x2afef2[_0xca45('0x9b')]({'name':_0x1d4782[_0xca45('0xab')][_0xca45('0xb3')][_0xca45('0xae')][_0xca45('0xad')]['Label'],'value':_0xca45('0xb4')},{'name':_0x1d4782['OptionSet']['FalseOption'][_0xca45('0xae')]['UserLocalizedLabel'][_0xca45('0xae')],'value':_0xca45('0xb5')});var _0x554d36={'id':_0x2071f6+'_'+_0x1d4782[_0xca45('0xb0')],'name':_0x1d4782['DisplayName'][_0xca45('0xad')][_0xca45('0xae')],'custom':![],'options':_0x2afef2};_0x5421b8[_0xca45('0x9b')](_0x554d36);return _0x5421b8;});}function getInputList(_0x160c6a,_0x2338ea,_0x174c1e,_0x3208ff,_0x110e26,_0x47fbfd,_0x3ac81f){var _0x31ec27={'method':'GET','uri':_0x160c6a+_0xca45('0x93')+_0x110e26+_0xca45('0xa7')+_0x47fbfd+_0xca45('0xb6')+_0x174c1e+_0xca45('0xb7'),'headers':{'Authorization':_0xca45('0xaa')+_0x3ac81f,'If-None-Match':null,'OData-Version':_0xca45('0x91')},'json':!![]};return rp(_0x31ec27)[_0xca45('0xd')](function(_0x1a8d82){var _0x21c5a6={'id':_0x2338ea+'_'+_0x1a8d82[_0xca45('0xb0')],'name':_0x1a8d82[_0xca45('0xb1')][_0xca45('0xad')]?_0x1a8d82[_0xca45('0xb1')][_0xca45('0xad')][_0xca45('0xae')]:_0x1a8d82[_0xca45('0xb0')],'custom':![],'options':[]};_0x3208ff['push'](_0x21c5a6);return _0x3208ff;});} \ No newline at end of file +var _0x9cb4=['4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','includes','LogicalName','forEach','@odata.type','substring','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','status','json','undefined','limit','count','offset','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','show','params','find','create','body','Dynamics365Configuration','getConfigurations','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','description','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','GET'];(function(_0x85eeab,_0x367d2a){var _0x5b1338=function(_0x207d98){while(--_0x207d98){_0x85eeab['push'](_0x85eeab['shift']());}};_0x5b1338(++_0x367d2a);}(_0x9cb4,0xe7));var _0x49cb=function(_0x1d8540,_0x5792ba){_0x1d8540=_0x1d8540-0x0;var _0x41e8e2=_0x9cb4[_0x1d8540];return _0x41e8e2;};'use strict';var rp=require(_0x49cb('0x0'));var util=require(_0x49cb('0x1'));var _=require('lodash');var qs=require(_0x49cb('0x2'));var logger=require(_0x49cb('0x3'))(_0x49cb('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0xd1d925,_0xa39f88){_0xa39f88=_0xa39f88||0xc8;return function(_0x348a53){if(_0x348a53){return _0xd1d925[_0x49cb('0x5')](_0xa39f88)[_0x49cb('0x6')](_0x348a53);}};}function respondWithFilteredResult(_0x4fe90a,_0x3de180){return function(_0x432782){if(_0x432782){var _0x26c144=typeof _0x3de180['offset']===_0x49cb('0x7')&&typeof _0x3de180[_0x49cb('0x8')]===_0x49cb('0x7');var _0x3b1bec=_0x432782[_0x49cb('0x9')];var _0x5438b2=_0x26c144?0x0:_0x3de180['offset'];var _0x5da766=_0x26c144?_0x432782[_0x49cb('0x9')]:_0x3de180[_0x49cb('0xa')]+_0x3de180['limit'];var _0xfde228;if(_0x5da766>=_0x3b1bec){_0x5da766=_0x3b1bec;_0xfde228=0xc8;}else{_0xfde228=0xce;}_0x4fe90a[_0x49cb('0x5')](_0xfde228);return _0x4fe90a['set']('Content-Range',_0x5438b2+'-'+_0x5da766+'/'+_0x3b1bec)[_0x49cb('0x6')](_0x432782);}return null;};}function saveUpdates(_0x1e5d40){return function(_0x2ff9d4){if(_0x2ff9d4){return _0x2ff9d4[_0x49cb('0xb')](_0x1e5d40)[_0x49cb('0xc')](function(_0x14b2dd){return _0x14b2dd;});}return null;};}function removeEntity(_0x77427a){return function(_0x1a681a){if(_0x1a681a){return _0x1a681a[_0x49cb('0xd')]()[_0x49cb('0xc')](function(){_0x77427a[_0x49cb('0x5')](0xcc)[_0x49cb('0xe')]();});}};}function handleEntityNotFound(_0x66ec25){return function(_0x66670e){if(!_0x66670e){_0x66ec25[_0x49cb('0xf')](0x194);}return _0x66670e;};}function handleError(_0x2ccea8,_0x836f4a){_0x836f4a=_0x836f4a||0x1f4;return function(_0x54725a){logger[_0x49cb('0x10')](_0x54725a[_0x49cb('0x11')]);if(_0x54725a['name']){delete _0x54725a[_0x49cb('0x12')];}_0x2ccea8['status'](_0x836f4a)[_0x49cb('0x13')](_0x54725a);};}exports[_0x49cb('0x14')]=function(_0x577478,_0x1f1f9a){var _0x34f02b={},_0x35e2d4={},_0xb2218e={'count':0x0,'rows':[]};var _0x26fa15=_[_0x49cb('0x15')](db['Dynamics365Account'][_0x49cb('0x16')],function(_0x351306){return{'name':_0x351306['fieldName'],'type':_0x351306[_0x49cb('0x17')][_0x49cb('0x18')]};});_0x35e2d4[_0x49cb('0x19')]=_[_0x49cb('0x15')](_0x26fa15,'name');_0x35e2d4['query']=_[_0x49cb('0x1a')](_0x577478['query']);_0x35e2d4['filters']=_['intersection'](_0x35e2d4[_0x49cb('0x19')],_0x35e2d4[_0x49cb('0x1b')]);_0x34f02b[_0x49cb('0x1c')]=_[_0x49cb('0x1d')](_0x35e2d4['model'],qs[_0x49cb('0x1e')](_0x577478[_0x49cb('0x1b')][_0x49cb('0x1e')]));_0x34f02b[_0x49cb('0x1c')]=_0x34f02b['attributes'][_0x49cb('0x1f')]?_0x34f02b[_0x49cb('0x1c')]:_0x35e2d4['model'];if(!_0x577478[_0x49cb('0x1b')][_0x49cb('0x20')](_0x49cb('0x21'))){_0x34f02b['limit']=qs[_0x49cb('0x8')](_0x577478[_0x49cb('0x1b')][_0x49cb('0x8')]);_0x34f02b['offset']=qs['offset'](_0x577478['query'][_0x49cb('0xa')]);}_0x34f02b['order']=qs[_0x49cb('0x22')](_0x577478[_0x49cb('0x1b')][_0x49cb('0x22')]);_0x34f02b[_0x49cb('0x23')]=qs['filters'](_[_0x49cb('0x24')](_0x577478[_0x49cb('0x1b')],_0x35e2d4[_0x49cb('0x25')]),_0x26fa15);if(_0x577478[_0x49cb('0x1b')][_0x49cb('0x26')]){_0x34f02b[_0x49cb('0x23')]=_[_0x49cb('0x27')](_0x34f02b[_0x49cb('0x23')],{'$or':_['map'](_0x26fa15,function(_0x567b36){if(_0x567b36[_0x49cb('0x17')]!==_0x49cb('0x28')){var _0x25da52={};_0x25da52[_0x567b36[_0x49cb('0x12')]]={'$like':'%'+_0x577478['query'][_0x49cb('0x26')]+'%'};return _0x25da52;}})});}_0x34f02b=_[_0x49cb('0x27')]({},_0x34f02b,_0x577478[_0x49cb('0x29')]);var _0x21a352={'where':_0x34f02b[_0x49cb('0x23')]};return db[_0x49cb('0x2a')][_0x49cb('0x9')](_0x21a352)['then'](function(_0x3443aa){_0xb2218e[_0x49cb('0x9')]=_0x3443aa;if(_0x577478[_0x49cb('0x1b')][_0x49cb('0x2b')]){_0x34f02b[_0x49cb('0x2c')]=[{'all':!![]}];}return db[_0x49cb('0x2a')][_0x49cb('0x2d')](_0x34f02b);})[_0x49cb('0xc')](function(_0x3c8146){_0xb2218e[_0x49cb('0x2e')]=_0x3c8146;return _0xb2218e;})[_0x49cb('0xc')](respondWithFilteredResult(_0x1f1f9a,_0x34f02b))[_0x49cb('0x2f')](handleError(_0x1f1f9a,null));};exports[_0x49cb('0x30')]=function(_0x1087f4,_0x1febab){var _0x31e8ea={'raw':![],'where':{'id':_0x1087f4[_0x49cb('0x31')]['id']}},_0x3cd425={};_0x3cd425[_0x49cb('0x19')]=_['keys'](db[_0x49cb('0x2a')][_0x49cb('0x16')]);_0x3cd425[_0x49cb('0x1b')]=_[_0x49cb('0x1a')](_0x1087f4[_0x49cb('0x1b')]);_0x3cd425[_0x49cb('0x25')]=_['intersection'](_0x3cd425[_0x49cb('0x19')],_0x3cd425[_0x49cb('0x1b')]);_0x31e8ea[_0x49cb('0x1c')]=_['intersection'](_0x3cd425[_0x49cb('0x19')],qs[_0x49cb('0x1e')](_0x1087f4[_0x49cb('0x1b')][_0x49cb('0x1e')]));_0x31e8ea[_0x49cb('0x1c')]=_0x31e8ea['attributes'][_0x49cb('0x1f')]?_0x31e8ea['attributes']:_0x3cd425[_0x49cb('0x19')];if(_0x1087f4[_0x49cb('0x1b')][_0x49cb('0x2b')]){_0x31e8ea[_0x49cb('0x2c')]=[{'all':!![]}];}_0x31e8ea=_['merge']({},_0x31e8ea,_0x1087f4['options']);return db[_0x49cb('0x2a')][_0x49cb('0x32')](_0x31e8ea)['then'](handleEntityNotFound(_0x1febab,null))['then'](respondWithResult(_0x1febab,null))[_0x49cb('0x2f')](handleError(_0x1febab,null));};exports[_0x49cb('0x33')]=function(_0x255766,_0x209c6d){return db[_0x49cb('0x2a')][_0x49cb('0x33')](_0x255766[_0x49cb('0x34')],{})[_0x49cb('0xc')](respondWithResult(_0x209c6d,0xc9))[_0x49cb('0x2f')](handleError(_0x209c6d,null));};exports['update']=function(_0x48698c,_0x242068){if(_0x48698c['body']['id']){delete _0x48698c[_0x49cb('0x34')]['id'];}return db[_0x49cb('0x2a')][_0x49cb('0x32')]({'where':{'id':_0x48698c[_0x49cb('0x31')]['id']}})[_0x49cb('0xc')](handleEntityNotFound(_0x242068,null))[_0x49cb('0xc')](saveUpdates(_0x48698c[_0x49cb('0x34')],null))[_0x49cb('0xc')](respondWithResult(_0x242068,null))[_0x49cb('0x2f')](handleError(_0x242068,null));};exports['destroy']=function(_0x184e3f,_0x3e21b3){return db[_0x49cb('0x2a')][_0x49cb('0x32')]({'where':{'id':_0x184e3f[_0x49cb('0x31')]['id']}})[_0x49cb('0xc')](handleEntityNotFound(_0x3e21b3,null))[_0x49cb('0xc')](removeEntity(_0x3e21b3,null))[_0x49cb('0x2f')](handleError(_0x3e21b3,null));};exports['getConfigurations']=function(_0x500f5e,_0x185964){var _0x651961={};var _0x21887a={};var _0x5c7a10;var _0x484442;return db[_0x49cb('0x2a')]['findOne']({'where':{'id':_0x500f5e[_0x49cb('0x31')]['id']}})['then'](handleEntityNotFound(_0x185964,null))['then'](function(_0x405e1d){if(_0x405e1d){_0x5c7a10=_0x405e1d;_0x21887a[_0x49cb('0x19')]=_[_0x49cb('0x1a')](db[_0x49cb('0x35')]['rawAttributes']);_0x21887a[_0x49cb('0x1b')]=_[_0x49cb('0x1a')](_0x500f5e[_0x49cb('0x1b')]);_0x21887a[_0x49cb('0x25')]=_[_0x49cb('0x1d')](_0x21887a[_0x49cb('0x19')],_0x21887a[_0x49cb('0x1b')]);_0x651961[_0x49cb('0x1c')]=_[_0x49cb('0x1d')](_0x21887a['model'],qs[_0x49cb('0x1e')](_0x500f5e[_0x49cb('0x1b')][_0x49cb('0x1e')]));_0x651961[_0x49cb('0x1c')]=_0x651961['attributes'][_0x49cb('0x1f')]?_0x651961['attributes']:_0x21887a[_0x49cb('0x19')];_0x651961['order']=qs[_0x49cb('0x22')](_0x500f5e[_0x49cb('0x1b')][_0x49cb('0x22')]);_0x651961[_0x49cb('0x23')]=qs[_0x49cb('0x25')](_[_0x49cb('0x24')](_0x500f5e['query'],_0x21887a[_0x49cb('0x25')]));if(_0x500f5e[_0x49cb('0x1b')][_0x49cb('0x26')]){_0x651961[_0x49cb('0x23')]=_[_0x49cb('0x27')](_0x651961['where'],{'$or':_[_0x49cb('0x15')](_0x651961[_0x49cb('0x1c')],function(_0x3d562a){var _0x1265c7={};_0x1265c7[_0x3d562a]={'$like':'%'+_0x500f5e['query'][_0x49cb('0x26')]+'%'};return _0x1265c7;})});}_0x651961=_[_0x49cb('0x27')]({},_0x651961,_0x500f5e[_0x49cb('0x29')]);return _0x5c7a10[_0x49cb('0x36')](_0x651961);}})[_0x49cb('0xc')](function(_0x2b97fc){if(_0x2b97fc){_0x484442=_0x2b97fc[_0x49cb('0x1f')];if(!_0x500f5e[_0x49cb('0x1b')][_0x49cb('0x20')]('nolimit')){_0x651961[_0x49cb('0x8')]=qs[_0x49cb('0x8')](_0x500f5e[_0x49cb('0x1b')][_0x49cb('0x8')]);_0x651961[_0x49cb('0xa')]=qs[_0x49cb('0xa')](_0x500f5e[_0x49cb('0x1b')]['offset']);}return _0x5c7a10[_0x49cb('0x36')](_0x651961);}})[_0x49cb('0xc')](function(_0x5a3723){if(_0x5a3723){return _0x5a3723?{'count':_0x484442,'rows':_0x5a3723}:null;}})[_0x49cb('0xc')](respondWithResult(_0x185964,null))[_0x49cb('0x2f')](handleError(_0x185964,null));};exports['addConfiguration']=function(_0x37bb8c,_0x4883d7){if(_0x37bb8c[_0x49cb('0x34')]['id']){delete _0x37bb8c[_0x49cb('0x34')]['id'];}return db[_0x49cb('0x2a')][_0x49cb('0x37')]({'where':{'id':_0x37bb8c[_0x49cb('0x31')]['id']}})['then'](handleEntityNotFound(_0x4883d7,null))[_0x49cb('0xc')](function(_0x462071){if(_0x462071){_0x37bb8c[_0x49cb('0x34')]['AccountId']=_0x462071['id'];_0x37bb8c[_0x49cb('0x34')][_0x49cb('0x38')]=integrations[_0x49cb('0x39')](_0x37bb8c[_0x49cb('0x34')][_0x49cb('0x3a')],_0x37bb8c[_0x49cb('0x34')]['type']);_0x37bb8c['body'][_0x49cb('0x3b')]=integrations[_0x49cb('0x3c')](_0x37bb8c['body'][_0x49cb('0x3a')],_0x37bb8c[_0x49cb('0x34')][_0x49cb('0x17')]);return db['Dynamics365Configuration'][_0x49cb('0x33')](_0x37bb8c[_0x49cb('0x34')],{'include':[{'model':db[_0x49cb('0x3d')],'as':_0x49cb('0x38')},{'model':db[_0x49cb('0x3d')],'as':_0x49cb('0x3b')}]});}return null;})['then'](respondWithResult(_0x4883d7,null))[_0x49cb('0x2f')](handleError(_0x4883d7,null));};function sanitizeRemoteUri(_0x1156fd){var _0x2f017f=_0x1156fd[_0x49cb('0x3e')](-0x1);if(_0x2f017f==='/')return _0x1156fd['substring'](0x0,_0x1156fd[_0x49cb('0x3f')](_0x2f017f));return _0x1156fd;}function getWebApiUrl(_0xc4bd0f){return util[_0x49cb('0x40')](_0x49cb('0x41'),_0xc4bd0f);}exports[_0x49cb('0x42')]=function(_0x51a02f,_0x5a2f3a){var _0x52a0d4=_0x51a02f[_0x49cb('0x1b')][_0x49cb('0x43')];var _0x3c6673=_0x52a0d4==='incident'?_0x49cb('0x44'):_0x49cb('0x45');var _0x1e37d9='';var _0x304d65='';var _0x483e2e='';var _0x254684='';var _0xe4f139='';var _0x5d30b4='';var _0x550f39='';var _0x1a59ed='';var _0x2c69de=['title',_0x49cb('0x46'),'customerid',_0x49cb('0x47'),'caseorigincode',_0x49cb('0x48'),_0x49cb('0x49'),'regardingobjectid',_0x49cb('0x4a'),_0x49cb('0x4b')];var _0x21211a=[_0x49cb('0x4c'),'accountidyominame',_0x49cb('0x4d'),_0x49cb('0x4e'),_0x49cb('0x4f'),'contactidyominame',_0x49cb('0x50'),_0x49cb('0x51'),_0x49cb('0x52'),_0x49cb('0x53'),_0x49cb('0x54'),'createdbyyominame',_0x49cb('0x55'),'createdonbehalfbyname',_0x49cb('0x56'),_0x49cb('0x57'),_0x49cb('0x58'),_0x49cb('0x59'),_0x49cb('0x5a'),_0x49cb('0x5b'),'entityimage_timestamp','entityimage_url',_0x49cb('0x5c'),_0x49cb('0x5d'),_0x49cb('0x5e'),_0x49cb('0x5f'),_0x49cb('0x60'),_0x49cb('0x61'),'kbarticleidname',_0x49cb('0x62'),_0x49cb('0x63'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x49cb('0x64'),_0x49cb('0x65'),_0x49cb('0x66'),_0x49cb('0x67'),_0x49cb('0x68'),_0x49cb('0x69'),_0x49cb('0x6a'),_0x49cb('0x6b'),_0x49cb('0x6c'),_0x49cb('0x6d'),'owneridname',_0x49cb('0x6e'),_0x49cb('0x6f'),_0x49cb('0x70'),_0x49cb('0x71'),_0x49cb('0x72'),_0x49cb('0x73'),_0x49cb('0x74'),_0x49cb('0x75'),_0x49cb('0x76'),_0x49cb('0x77'),_0x49cb('0x78'),'responsiblecontactidname',_0x49cb('0x79'),_0x49cb('0x7a'),_0x49cb('0x7b'),_0x49cb('0x7c'),_0x49cb('0x7d'),'statecode',_0x49cb('0x7e'),_0x49cb('0x7f'),'ticketnumber',_0x49cb('0x80'),_0x49cb('0x81'),_0x49cb('0x82'),_0x49cb('0x83'),_0x49cb('0x84')];var _0x3ae5cb=_0x2c69de[_0x49cb('0x85')](_0x21211a);return db[_0x49cb('0x2a')]['findOne']({'where':{'id':_0x51a02f['params']['id']},'attributes':['id','username',_0x49cb('0x86'),'remoteUri','tenantId',_0x49cb('0x87'),_0x49cb('0x88'),_0x49cb('0x89')],'include':[{'model':db[_0x49cb('0x8a')],'as':_0x49cb('0x8a'),'attributes':['id',_0x49cb('0x8b'),_0x49cb('0x8c')]}]})[_0x49cb('0xc')](handleEntityNotFound(_0x5a2f3a,null))[_0x49cb('0xc')](function(_0x34c4c6){if(_0x34c4c6){if(_0x34c4c6[_0x49cb('0x89')]){_0x34c4c6[_0x49cb('0x8d')]=_0x34c4c6[_0x49cb('0x8a')][_0x49cb('0x8b')];_0x1a59ed=sanitizeRemoteUri(_0x34c4c6['CloudProvider'][_0x49cb('0x8c')]);_0x550f39=getWebApiUrl(_0x1a59ed);return _0x34c4c6;}_0x1a59ed=sanitizeRemoteUri(_0x34c4c6[_0x49cb('0x8e')]);_0x550f39=getWebApiUrl(_0x1a59ed);var _0x304a0c={'method':_0x49cb('0x8f'),'uri':_0x49cb('0x90')+_0x34c4c6[_0x49cb('0x91')]+_0x49cb('0x92'),'form':{'client_id':_0x34c4c6[_0x49cb('0x87')],'resource':_0x1a59ed,'username':_0x34c4c6[_0x49cb('0x93')],'password':_0x34c4c6[_0x49cb('0x86')],'grant_type':_0x49cb('0x86'),'client_secret':_0x34c4c6[_0x49cb('0x88')]},'json':!![]};return rp(_0x304a0c);}})['then'](function(_0x233b2a){_0x5d30b4=_0x233b2a[_0x49cb('0x8d')];var _0x585d96={'method':_0x49cb('0x94'),'uri':encodeURI(_0x550f39+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3c6673+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5d30b4,'If-None-Match':null,'OData-Version':_0x49cb('0x95')},'json':!![]};return rp(_0x585d96);})['then'](function(_0x254709){var _0x112d73=_0x254709[_0x49cb('0x96')][0x0];var _0x96241f=_0x112d73[_0x49cb('0x97')];var _0x2ef0ce={'method':_0x49cb('0x94'),'uri':_0x550f39+_0x49cb('0x98')+_0x96241f+_0x49cb('0x99'),'headers':{'Authorization':_0x49cb('0x9a')+_0x5d30b4,'If-None-Match':null,'OData-Version':_0x49cb('0x95')},'json':!![]};return rp(_0x2ef0ce);})[_0x49cb('0xc')](function(_0x28d601){_0x1e37d9=_0x28d601;_0x304d65=_0x1e37d9['Attributes'];_0x304d65=_['remove'](_0x304d65,function(_0x260ee2){return!_0x3ae5cb[_0x49cb('0x9b')](_0x260ee2[_0x49cb('0x9c')]);});var _0x3951f5=[];var _0x16377b=[];_0x304d65[_0x49cb('0x9d')](function(_0x108752){if(_0x108752[_0x49cb('0x9e')]){var _0x4ca985=_0x108752[_0x49cb('0x9e')][_0x49cb('0x9f')](_0x108752[_0x49cb('0x9e')][_0x49cb('0x3f')]('.')+0x1);if(_0x4ca985==='PicklistAttributeMetadata'){_0x3951f5['push'](getSelectList(_0x550f39,_0x52a0d4,_0x16377b,_0x1e37d9[_0x49cb('0x97')],_0x108752[_0x49cb('0x97')],_0x5d30b4));}}});return Promise[_0x49cb('0xa0')](_0x3951f5);})[_0x49cb('0xc')](function(_0x2f8ce4){_0x483e2e=_0x2f8ce4[0x0];var _0x20339f=[];var _0x3609d7=[];_0x304d65['forEach'](function(_0x5ee9d7){if(!_[_0x49cb('0xa1')](_0x5ee9d7[_0x49cb('0x9e')])){var _0x54f1bb=_0x5ee9d7[_0x49cb('0x9e')][_0x49cb('0x9f')](_0x5ee9d7[_0x49cb('0x9e')]['lastIndexOf']('.')+0x1);if(_0x54f1bb===_0x49cb('0xa2')){_0x20339f[_0x49cb('0xa3')](getBooleanList(_0x550f39,_0x52a0d4,_0x3609d7,_0x1e37d9['MetadataId'],_0x5ee9d7[_0x49cb('0x97')],_0x5d30b4));}}});return Promise['all'](_0x20339f);})[_0x49cb('0xc')](function(_0x3b6ec3){_0x254684=_0x3b6ec3[0x0];var _0x21edbc=[];var _0x55a09f=[];_0x304d65[_0x49cb('0x9d')](function(_0x26b956){if(_0x26b956[_0x49cb('0x9e')]){var _0x454b30=_0x26b956[_0x49cb('0x9e')][_0x49cb('0x9f')](_0x26b956[_0x49cb('0x9e')]['lastIndexOf']('.')+0x1);if(_0x454b30===_0x49cb('0xa4')||_0x454b30==='DoubleAttributeMetadata'||_0x454b30===_0x49cb('0xa5')||_0x454b30===_0x49cb('0xa6')||_0x454b30===_0x49cb('0xa7')||_0x454b30===_0x49cb('0xa8')||_0x454b30===_0x49cb('0xa9')||_0x454b30===_0x49cb('0xaa')||_0x454b30==='StateAttributeMetadata'||_0x454b30===_0x49cb('0xab')){_0x21edbc[_0x49cb('0xa3')](getInputList(_0x550f39,_0x52a0d4,_0x454b30,_0x55a09f,_0x1e37d9[_0x49cb('0x97')],_0x26b956[_0x49cb('0x97')],_0x5d30b4));}}});return Promise['all'](_0x21edbc);})[_0x49cb('0xc')](function(_0x42b28a){_0xe4f139=_0x42b28a[0x0];var _0x14ebec=_0x483e2e[_0x49cb('0x85')](_0x254684)[_0x49cb('0x85')](_0xe4f139);var _0x59e7c7={'count':_0x14ebec['length'],'rows':_0x14ebec};return _0x59e7c7;})[_0x49cb('0xc')](respondWithResult(_0x5a2f3a,null))['catch'](function(_0x22d2ef){var _0x291af4=_0x51a02f['query']['test']?0x1f4:_0x22d2ef[_0x49cb('0xac')]||0x1f4;logger[_0x49cb('0x10')](_0x22d2ef[_0x49cb('0x11')]);delete _0x22d2ef[_0x49cb('0x12')];if(_0x291af4===0x191){_0x291af4=0x190;}_0x5a2f3a['status'](_0x291af4)['send'](_0x51a02f[_0x49cb('0x1b')]['test']?{'message':_0x49cb('0xad'),'statusCode':_0x22d2ef['statusCode']}:_0x22d2ef);});};function getSelectList(_0x41d062,_0x1194d1,_0x2c48d2,_0x3b1e99,_0x153ff5,_0x5c078c){var _0x24bb10={'method':_0x49cb('0x94'),'uri':_0x41d062+_0x49cb('0x98')+_0x3b1e99+_0x49cb('0xae')+_0x153ff5+_0x49cb('0xaf')+_0x49cb('0xb0'),'headers':{'Authorization':_0x49cb('0x9a')+_0x5c078c,'If-None-Match':null,'OData-Version':_0x49cb('0x95')},'json':!![]};return rp(_0x24bb10)[_0x49cb('0xc')](function(_0x556190){var _0x49fa18=[];var _0x45f0ba=_0x556190['OptionSet'][_0x49cb('0xb1')];_0x45f0ba[_0x49cb('0x9d')](function(_0x351748){_0x49fa18[_0x49cb('0xa3')]({'name':_0x351748[_0x49cb('0xb2')]['UserLocalizedLabel']['Label'],'value':String(_0x351748[_0x49cb('0xb3')])});});var _0x2d0161={'id':_0x1194d1+'_'+_0x556190[_0x49cb('0x9c')],'name':_0x556190[_0x49cb('0xb4')][_0x49cb('0xb5')][_0x49cb('0xb2')],'custom':![],'options':_0x49fa18};_0x2c48d2[_0x49cb('0xa3')](_0x2d0161);return _0x2c48d2;});}function getBooleanList(_0x50cfb4,_0x268776,_0x23ce28,_0x3618bd,_0x259a70,_0x57f5c7){var _0xefb9b9={'method':_0x49cb('0x94'),'uri':_0x50cfb4+_0x49cb('0x98')+_0x3618bd+')/Attributes('+_0x259a70+_0x49cb('0xb6'),'headers':{'Authorization':_0x49cb('0x9a')+_0x57f5c7,'If-None-Match':null,'OData-Version':_0x49cb('0x95')},'json':!![]};return rp(_0xefb9b9)['then'](function(_0x1465ca){var _0x3e21c1=[];_0x3e21c1[_0x49cb('0xa3')]({'name':_0x1465ca[_0x49cb('0xb7')][_0x49cb('0xb8')][_0x49cb('0xb2')][_0x49cb('0xb5')][_0x49cb('0xb2')],'value':_0x49cb('0xb9')},{'name':_0x1465ca[_0x49cb('0xb7')][_0x49cb('0xba')][_0x49cb('0xb2')][_0x49cb('0xb5')]['Label'],'value':_0x49cb('0xbb')});var _0x1335d7={'id':_0x268776+'_'+_0x1465ca['LogicalName'],'name':_0x1465ca[_0x49cb('0xb4')][_0x49cb('0xb5')][_0x49cb('0xb2')],'custom':![],'options':_0x3e21c1};_0x23ce28[_0x49cb('0xa3')](_0x1335d7);return _0x23ce28;});}function getInputList(_0x4f1833,_0x35afac,_0x2efaa7,_0x4ab00d,_0x281e08,_0x375dad,_0x34aa67){var _0x51bf2b={'method':'GET','uri':_0x4f1833+_0x49cb('0x98')+_0x281e08+_0x49cb('0xae')+_0x375dad+_0x49cb('0xbc')+_0x2efaa7+_0x49cb('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0x34aa67,'If-None-Match':null,'OData-Version':_0x49cb('0x95')},'json':!![]};return rp(_0x51bf2b)['then'](function(_0x3808f0){var _0x54fed6={'id':_0x35afac+'_'+_0x3808f0['LogicalName'],'name':_0x3808f0[_0x49cb('0xb4')][_0x49cb('0xb5')]?_0x3808f0['DisplayName']['UserLocalizedLabel'][_0x49cb('0xb2')]:_0x3808f0['LogicalName'],'custom':![],'options':[]};_0x4ab00d['push'](_0x54fed6);return _0x4ab00d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index abd3cd8..b926e03 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x114470,_0xc29200){var _0x2f5e14=function(_0x434a61){while(--_0x434a61){_0x114470['push'](_0x114470['shift']());}};_0x2f5e14(++_0xc29200);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x354c74,_0x324bb0){var _0x283858=function(_0x2f44f1){while(--_0x2f44f1){_0x354c74['push'](_0x354c74['shift']());}};_0x283858(++_0x324bb0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'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 1db52d3..3845226 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 _0xc199=['code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','model','map','then','ShowDynamics365Account','find','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x364310,_0x266247){var _0x5a438b=function(_0x4b15a3){while(--_0x4b15a3){_0x364310['push'](_0x364310['shift']());}};_0x5a438b(++_0x266247);}(_0xc199,0x192));var _0x9c19=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xc199[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x9c19('0x0'));var util=require(_0x9c19('0x1'));var moment=require('moment');var BPromise=require(_0x9c19('0x2'));var rs=require(_0x9c19('0x3'));var fs=require('fs');var Redis=require(_0x9c19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c19('0x5'));var logger=require(_0x9c19('0x6'))('rpc');var config=require(_0x9c19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c19('0x8')][_0x9c19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x314015,_0x319140,_0x5a0a54){return new BPromise(function(_0x2f003f,_0x28fa92){return client[_0x9c19('0xa')](_0x314015,_0x5a0a54)['then'](function(_0x54afa7){logger[_0x9c19('0xb')](_0x9c19('0xc'),_0x319140,_0x9c19('0xd'));logger[_0x9c19('0xe')](_0x9c19('0xf'),_0x319140,_0x9c19('0xd'),JSON[_0x9c19('0x10')](_0x54afa7));if(_0x54afa7[_0x9c19('0x11')]){if(_0x54afa7[_0x9c19('0x11')][_0x9c19('0x12')]===0x1f4){logger[_0x9c19('0x11')](_0x9c19('0xc'),_0x319140,_0x54afa7['error'][_0x9c19('0x13')]);return _0x28fa92(_0x54afa7[_0x9c19('0x11')][_0x9c19('0x13')]);}logger['error'](_0x9c19('0xc'),_0x319140,_0x54afa7[_0x9c19('0x11')][_0x9c19('0x13')]);return _0x2f003f(_0x54afa7[_0x9c19('0x11')][_0x9c19('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x319140,_0x9c19('0xd'));_0x2f003f(_0x54afa7[_0x9c19('0x14')][_0x9c19('0x13')]);}})[_0x9c19('0x15')](function(_0x4d9507){logger[_0x9c19('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x319140,_0x4d9507);_0x28fa92(_0x4d9507);});});}exports[_0x9c19('0x16')]=function(_0x20cad7){var _0x5bcbf8=this;return new Promise(function(_0x1581ba,_0x23d38e){return db[_0x9c19('0x17')][_0x9c19('0x18')]({'raw':_0x20cad7[_0x9c19('0x19')]?_0x20cad7[_0x9c19('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20cad7[_0x9c19('0x19')]?_0x20cad7[_0x9c19('0x19')][_0x9c19('0x1a')]||null:null,'attributes':_0x20cad7['options']?_0x20cad7[_0x9c19('0x19')][_0x9c19('0x1b')]||null:null,'limit':_0x20cad7[_0x9c19('0x19')]?_0x20cad7[_0x9c19('0x19')]['limit']||null:null,'include':_0x20cad7['options']?_0x20cad7[_0x9c19('0x19')][_0x9c19('0x1c')]?_['map'](_0x20cad7[_0x9c19('0x19')][_0x9c19('0x1c')],function(_0x218e61){return{'model':db[_0x218e61[_0x9c19('0x1d')]],'as':_0x218e61['as'],'attributes':_0x218e61[_0x9c19('0x1b')],'include':_0x218e61[_0x9c19('0x1c')]?_[_0x9c19('0x1e')](_0x218e61[_0x9c19('0x1c')],function(_0x30fd00){return{'model':db[_0x30fd00['model']],'as':_0x30fd00['as'],'attributes':_0x30fd00[_0x9c19('0x1b')],'include':_0x30fd00[_0x9c19('0x1c')]?_[_0x9c19('0x1e')](_0x30fd00[_0x9c19('0x1c')],function(_0x2ac7d5){return{'model':db[_0x2ac7d5[_0x9c19('0x1d')]],'as':_0x2ac7d5['as'],'attributes':_0x2ac7d5[_0x9c19('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9c19('0x1f')](function(_0x19512b){logger[_0x9c19('0xb')](_0x9c19('0x16'),_0x20cad7);logger['debug'](_0x9c19('0x16'),_0x20cad7,JSON[_0x9c19('0x10')](_0x19512b));_0x1581ba(_0x19512b);})[_0x9c19('0x15')](function(_0x363226){logger[_0x9c19('0x11')]('GetDynamics365Account',_0x363226['message'],_0x20cad7);_0x23d38e(_0x5bcbf8['error'](0x1f4,_0x363226[_0x9c19('0x13')]));});});};exports[_0x9c19('0x20')]=function(_0x17dc08){var _0x24412b=this;return new Promise(function(_0x297620,_0x162fda){return db[_0x9c19('0x17')][_0x9c19('0x21')]({'raw':_0x17dc08[_0x9c19('0x19')]?_0x17dc08[_0x9c19('0x19')][_0x9c19('0x22')]===undefined?!![]:![]:!![],'where':_0x17dc08['options']?_0x17dc08['options'][_0x9c19('0x1a')]||null:null,'attributes':_0x17dc08[_0x9c19('0x19')]?_0x17dc08[_0x9c19('0x19')][_0x9c19('0x1b')]||null:null,'include':_0x17dc08[_0x9c19('0x19')]?_0x17dc08['options']['include']?_['map'](_0x17dc08['options'][_0x9c19('0x1c')],function(_0x1c6e04){return{'model':db[_0x1c6e04['model']],'as':_0x1c6e04['as'],'attributes':_0x1c6e04[_0x9c19('0x1b')],'include':_0x1c6e04[_0x9c19('0x1c')]?_[_0x9c19('0x1e')](_0x1c6e04[_0x9c19('0x1c')],function(_0x36b604){return{'model':db[_0x36b604[_0x9c19('0x1d')]],'as':_0x36b604['as'],'attributes':_0x36b604[_0x9c19('0x1b')],'include':_0x36b604['include']?_[_0x9c19('0x1e')](_0x36b604[_0x9c19('0x1c')],function(_0x11ded0){return{'model':db[_0x11ded0[_0x9c19('0x1d')]],'as':_0x11ded0['as'],'attributes':_0x11ded0[_0x9c19('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x313f33){logger[_0x9c19('0xb')](_0x9c19('0x20'),_0x17dc08);logger['debug'](_0x9c19('0x20'),_0x17dc08,JSON[_0x9c19('0x10')](_0x313f33));_0x297620(_0x313f33);})[_0x9c19('0x15')](function(_0x90cbfe){logger['error']('ShowDynamics365Account',_0x90cbfe[_0x9c19('0x13')],_0x17dc08);_0x162fda(_0x24412b[_0x9c19('0x11')](0x1f4,_0x90cbfe[_0x9c19('0x13')]));});});}; \ No newline at end of file +var _0x8c6f=['request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','Dynamics365Account','findAll','options','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','where','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e13f4,_0x4d9f8a){var _0x156693=function(_0x316953){while(--_0x316953){_0x3e13f4['push'](_0x3e13f4['shift']());}};_0x156693(++_0x4d9f8a);}(_0x8c6f,0x8b));var _0xf8c6=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x8c6f[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0xf8c6('0x0'));var moment=require(_0xf8c6('0x1'));var BPromise=require(_0xf8c6('0x2'));var rs=require(_0xf8c6('0x3'));var fs=require('fs');var Redis=require(_0xf8c6('0x4'));var db=require(_0xf8c6('0x5'))['db'];var utils=require(_0xf8c6('0x6'));var logger=require(_0xf8c6('0x7'))(_0xf8c6('0x8'));var config=require(_0xf8c6('0x9'));var jayson=require(_0xf8c6('0xa'));var client=jayson[_0xf8c6('0xb')][_0xf8c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x577d4c,_0x4b5a64,_0x57a449){return new BPromise(function(_0x47b2c2,_0xcfa97c){return client[_0xf8c6('0xd')](_0x577d4c,_0x57a449)[_0xf8c6('0xe')](function(_0x5d9752){logger['info'](_0xf8c6('0xf'),_0x4b5a64,_0xf8c6('0x10'));logger['debug'](_0xf8c6('0x11'),_0x4b5a64,_0xf8c6('0x10'),JSON['stringify'](_0x5d9752));if(_0x5d9752[_0xf8c6('0x12')]){if(_0x5d9752['error']['code']===0x1f4){logger[_0xf8c6('0x12')](_0xf8c6('0xf'),_0x4b5a64,_0x5d9752[_0xf8c6('0x12')][_0xf8c6('0x13')]);return _0xcfa97c(_0x5d9752['error'][_0xf8c6('0x13')]);}logger[_0xf8c6('0x12')](_0xf8c6('0xf'),_0x4b5a64,_0x5d9752[_0xf8c6('0x12')]['message']);return _0x47b2c2(_0x5d9752[_0xf8c6('0x12')][_0xf8c6('0x13')]);}else{logger[_0xf8c6('0x14')](_0xf8c6('0xf'),_0x4b5a64,'request\x20sent');_0x47b2c2(_0x5d9752[_0xf8c6('0x15')]['message']);}})[_0xf8c6('0x16')](function(_0x2ab4cd){logger[_0xf8c6('0x12')](_0xf8c6('0xf'),_0x4b5a64,_0x2ab4cd);_0xcfa97c(_0x2ab4cd);});});}exports['GetDynamics365Account']=function(_0x657597){var _0x434779=this;return new Promise(function(_0x551179,_0x435a5a){return db[_0xf8c6('0x17')][_0xf8c6('0x18')]({'raw':_0x657597['options']?_0x657597[_0xf8c6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x657597[_0xf8c6('0x19')]?_0x657597[_0xf8c6('0x19')]['where']||null:null,'attributes':_0x657597['options']?_0x657597[_0xf8c6('0x19')][_0xf8c6('0x1a')]||null:null,'limit':_0x657597[_0xf8c6('0x19')]?_0x657597[_0xf8c6('0x19')][_0xf8c6('0x1b')]||null:null,'include':_0x657597[_0xf8c6('0x19')]?_0x657597[_0xf8c6('0x19')][_0xf8c6('0x1c')]?_[_0xf8c6('0x1d')](_0x657597[_0xf8c6('0x19')]['include'],function(_0x33aaf9){return{'model':db[_0x33aaf9[_0xf8c6('0x1e')]],'as':_0x33aaf9['as'],'attributes':_0x33aaf9['attributes'],'include':_0x33aaf9['include']?_['map'](_0x33aaf9[_0xf8c6('0x1c')],function(_0x595be8){return{'model':db[_0x595be8[_0xf8c6('0x1e')]],'as':_0x595be8['as'],'attributes':_0x595be8['attributes'],'include':_0x595be8[_0xf8c6('0x1c')]?_['map'](_0x595be8['include'],function(_0x173b1b){return{'model':db[_0x173b1b[_0xf8c6('0x1e')]],'as':_0x173b1b['as'],'attributes':_0x173b1b[_0xf8c6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8c6('0xe')](function(_0x2774b4){logger['info']('GetDynamics365Account',_0x657597);logger['debug'](_0xf8c6('0x1f'),_0x657597,JSON[_0xf8c6('0x20')](_0x2774b4));_0x551179(_0x2774b4);})[_0xf8c6('0x16')](function(_0x556e78){logger[_0xf8c6('0x12')](_0xf8c6('0x1f'),_0x556e78['message'],_0x657597);_0x435a5a(_0x434779['error'](0x1f4,_0x556e78['message']));});});};exports[_0xf8c6('0x21')]=function(_0x2e69e8){var _0x2c7b7d=this;return new Promise(function(_0x2a92a3,_0x4f1d46){return db[_0xf8c6('0x17')][_0xf8c6('0x22')]({'raw':_0x2e69e8[_0xf8c6('0x19')]?_0x2e69e8[_0xf8c6('0x19')][_0xf8c6('0x23')]===undefined?!![]:![]:!![],'where':_0x2e69e8[_0xf8c6('0x19')]?_0x2e69e8[_0xf8c6('0x19')][_0xf8c6('0x24')]||null:null,'attributes':_0x2e69e8[_0xf8c6('0x19')]?_0x2e69e8[_0xf8c6('0x19')]['attributes']||null:null,'include':_0x2e69e8['options']?_0x2e69e8[_0xf8c6('0x19')][_0xf8c6('0x1c')]?_[_0xf8c6('0x1d')](_0x2e69e8[_0xf8c6('0x19')]['include'],function(_0x21640e){return{'model':db[_0x21640e[_0xf8c6('0x1e')]],'as':_0x21640e['as'],'attributes':_0x21640e[_0xf8c6('0x1a')],'include':_0x21640e[_0xf8c6('0x1c')]?_[_0xf8c6('0x1d')](_0x21640e[_0xf8c6('0x1c')],function(_0x44cc41){return{'model':db[_0x44cc41['model']],'as':_0x44cc41['as'],'attributes':_0x44cc41[_0xf8c6('0x1a')],'include':_0x44cc41[_0xf8c6('0x1c')]?_[_0xf8c6('0x1d')](_0x44cc41[_0xf8c6('0x1c')],function(_0x400779){return{'model':db[_0x400779[_0xf8c6('0x1e')]],'as':_0x400779['as'],'attributes':_0x400779['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8c6('0xe')](function(_0x26da33){logger[_0xf8c6('0x14')](_0xf8c6('0x21'),_0x2e69e8);logger[_0xf8c6('0x25')](_0xf8c6('0x21'),_0x2e69e8,JSON[_0xf8c6('0x20')](_0x26da33));_0x2a92a3(_0x26da33);})['catch'](function(_0x1f1a51){logger['error'](_0xf8c6('0x21'),_0x1f1a51['message'],_0x2e69e8);_0x4f1d46(_0x2c7b7d[_0xf8c6('0x12')](0x1f4,_0x1f1a51[_0xf8c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0a95b28..c8b350d 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 _0x51c5=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0x51c5,0x8f));var _0x551c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x51c5[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var path=require(_0x551c('0x2'));var timeout=require(_0x551c('0x3'));var express=require(_0x551c('0x4'));var router=express[_0x551c('0x5')]();var fs_extra=require(_0x551c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x551c('0x7'));var config=require(_0x551c('0x8'));var controller=require(_0x551c('0x9'));router[_0x551c('0xa')]('/',auth[_0x551c('0xb')](),controller[_0x551c('0xc')]);router[_0x551c('0xa')](_0x551c('0xd'),auth['isAuthenticated'](),controller[_0x551c('0xe')]);router[_0x551c('0xa')](_0x551c('0xf'),auth['isAuthenticated'](),controller[_0x551c('0x10')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x551c('0x11')]);router['get'](_0x551c('0x12'),auth[_0x551c('0xb')](),controller[_0x551c('0x13')]);router[_0x551c('0x14')]('/',auth[_0x551c('0xb')](),controller[_0x551c('0x15')]);router['put'](_0x551c('0xd'),auth[_0x551c('0xb')](),controller[_0x551c('0x16')]);router['delete'](_0x551c('0xd'),auth[_0x551c('0xb')](),controller['destroy']);module[_0x551c('0x17')]=router; \ No newline at end of file +var _0xe3a5=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe3a5,0x127));var _0x5e3a=function(_0x7dc133,_0x448c68){_0x7dc133=_0x7dc133-0x0;var _0x4e25d6=_0xe3a5[_0x7dc133];return _0x4e25d6;};'use strict';var multer=require(_0x5e3a('0x0'));var util=require(_0x5e3a('0x1'));var path=require(_0x5e3a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e3a('0x3')]();var fs_extra=require(_0x5e3a('0x4'));var auth=require(_0x5e3a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e3a('0x6'));var controller=require(_0x5e3a('0x7'));router[_0x5e3a('0x8')]('/',auth[_0x5e3a('0x9')](),controller[_0x5e3a('0xa')]);router['get'](_0x5e3a('0xb'),auth['isAuthenticated'](),controller[_0x5e3a('0xc')]);router['get'](_0x5e3a('0xd'),auth[_0x5e3a('0x9')](),controller['getFields']);router['get'](_0x5e3a('0xe'),auth[_0x5e3a('0x9')](),controller[_0x5e3a('0xf')]);router[_0x5e3a('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5e3a('0x10')]);router[_0x5e3a('0x11')]('/',auth[_0x5e3a('0x9')](),controller[_0x5e3a('0x12')]);router[_0x5e3a('0x13')](_0x5e3a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5e3a('0x14')]('/:id',auth[_0x5e3a('0x9')](),controller['destroy']);module[_0x5e3a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 8506a4e..f83bbf3 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 _0xbd2d=['sequelize','exports','STRING','ENUM','incident','phonecall','nothing','contact'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xbd2d,0xa0));var _0xdbd2=function(_0x1a3398,_0x487a06){_0x1a3398=_0x1a3398-0x0;var _0x37af24=_0xbd2d[_0x1a3398];return _0x37af24;};'use strict';var Sequelize=require(_0xdbd2('0x0'));module[_0xdbd2('0x1')]={'name':{'type':Sequelize[_0xdbd2('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xdbd2('0x3')](_0xdbd2('0x4'),_0xdbd2('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xdbd2('0x3')]('contact',_0xdbd2('0x6')),'defaultValue':_0xdbd2('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xb370=['phonecall','nothing','contact','sequelize','exports','STRING','ENUM','incident'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0xb370,0x123));var _0x0b37=function(_0x4bb034,_0x3de1a4){_0x4bb034=_0x4bb034-0x0;var _0x1ea86b=_0xb370[_0x4bb034];return _0x1ea86b;};'use strict';var Sequelize=require(_0x0b37('0x0'));module[_0x0b37('0x1')]={'name':{'type':Sequelize[_0x0b37('0x2')]},'description':{'type':Sequelize[_0x0b37('0x2')]},'ticketType':{'type':Sequelize[_0x0b37('0x3')](_0x0b37('0x4'),_0x0b37('0x5')),'defaultValue':_0x0b37('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x0b37('0x6')),'defaultValue':_0x0b37('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6c168df..72c65e9 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 _0xe355=['status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','Dynamics365Configuration','findAll','rows','catch','show','find','create','body','params','findOne','Dynamics365Field','order','pick','getFields','getSubjects','getDescriptions','zip-dir','request-promise','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','to-csv','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'];(function(_0x5e4fb9,_0x45caf4){var _0x4189b4=function(_0x486bfa){while(--_0x486bfa){_0x5e4fb9['push'](_0x5e4fb9['shift']());}};_0x4189b4(++_0x45caf4);}(_0xe355,0x87));var _0x5e35=function(_0xfdf7a4,_0x37da46){_0xfdf7a4=_0xfdf7a4-0x0;var _0x59ec89=_0xe355[_0xfdf7a4];return _0x59ec89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e35('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e35('0x1'));var moment=require('moment');var BPromise=require(_0x5e35('0x2'));var Mustache=require(_0x5e35('0x3'));var util=require(_0x5e35('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5e35('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e35('0x6'));var squel=require(_0x5e35('0x7'));var crypto=require(_0x5e35('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5e35('0x9'));var toCsv=require(_0x5e35('0xa'));var querystring=require('querystring');var Papa=require(_0x5e35('0xb'));var Redis=require(_0x5e35('0xc'));var authService=require(_0x5e35('0xd'));var qs=require(_0x5e35('0xe'));var as=require(_0x5e35('0xf'));var hardwareService=require(_0x5e35('0x10'));var logger=require(_0x5e35('0x11'))('api');var utils=require(_0x5e35('0x12'));var config=require(_0x5e35('0x13'));var licenseUtil=require(_0x5e35('0x14'));var db=require(_0x5e35('0x15'))['db'];function respondWithStatusCode(_0x126ba8,_0x201baf){_0x201baf=_0x201baf||0xcc;return function(_0x25e2bc){if(_0x25e2bc){return _0x126ba8[_0x5e35('0x16')](_0x201baf);}return _0x126ba8[_0x5e35('0x17')](_0x201baf)[_0x5e35('0x18')]();};}function respondWithResult(_0x410af8,_0x4b2dde){_0x4b2dde=_0x4b2dde||0xc8;return function(_0x566f8c){if(_0x566f8c){return _0x410af8[_0x5e35('0x17')](_0x4b2dde)[_0x5e35('0x19')](_0x566f8c);}};}function respondWithFilteredResult(_0x1d5d8d,_0x578717){return function(_0x3c8fb1){if(_0x3c8fb1){var _0x1e5e24=typeof _0x578717['offset']===_0x5e35('0x1a')&&typeof _0x578717[_0x5e35('0x1b')]===_0x5e35('0x1a');var _0x4b21d5=_0x3c8fb1[_0x5e35('0x1c')];var _0x27aabc=_0x1e5e24?0x0:_0x578717['offset'];var _0x4b390d=_0x1e5e24?_0x3c8fb1[_0x5e35('0x1c')]:_0x578717[_0x5e35('0x1d')]+_0x578717['limit'];var _0x1e416d;if(_0x4b390d>=_0x4b21d5){_0x4b390d=_0x4b21d5;_0x1e416d=0xc8;}else{_0x1e416d=0xce;}_0x1d5d8d[_0x5e35('0x17')](_0x1e416d);return _0x1d5d8d['set'](_0x5e35('0x1e'),_0x27aabc+'-'+_0x4b390d+'/'+_0x4b21d5)[_0x5e35('0x19')](_0x3c8fb1);}return null;};}function patchUpdates(_0xcf409f){return function(_0x454724){try{jsonpatch['apply'](_0x454724,_0xcf409f,!![]);}catch(_0x29844f){return BPromise[_0x5e35('0x1f')](_0x29844f);}return _0x454724[_0x5e35('0x20')]();};}function saveUpdates(_0x5394e7,_0x576e9a){return function(_0x453239){if(_0x453239){return _0x453239[_0x5e35('0x21')](_0x5394e7)[_0x5e35('0x22')](function(_0x26311e){return _0x26311e;});}return null;};}function removeEntity(_0x1e2ff8,_0xeb2603){return function(_0x1c95f4){if(_0x1c95f4){return _0x1c95f4[_0x5e35('0x23')]()[_0x5e35('0x22')](function(){_0x1e2ff8['status'](0xcc)[_0x5e35('0x18')]();});}};}function handleEntityNotFound(_0x2e350e,_0x302022){return function(_0x132f9f){if(!_0x132f9f){_0x2e350e[_0x5e35('0x16')](0x194);}return _0x132f9f;};}function handleError(_0x181007,_0x5177cd){_0x5177cd=_0x5177cd||0x1f4;return function(_0x4fc9f4){logger[_0x5e35('0x24')](_0x4fc9f4[_0x5e35('0x25')]);if(_0x4fc9f4[_0x5e35('0x26')]){delete _0x4fc9f4['name'];}_0x181007[_0x5e35('0x17')](_0x5177cd)[_0x5e35('0x27')](_0x4fc9f4);};}exports[_0x5e35('0x28')]=function(_0x5afcf6,_0x1d6326){var _0x376d25={},_0x278ebc={},_0x3b4bba={'count':0x0,'rows':[]};var _0x2ce3f4=_[_0x5e35('0x29')](db['Dynamics365Configuration'][_0x5e35('0x2a')],function(_0x26795d){return{'name':_0x26795d[_0x5e35('0x2b')],'type':_0x26795d[_0x5e35('0x2c')][_0x5e35('0x2d')]};});_0x278ebc[_0x5e35('0x2e')]=_[_0x5e35('0x29')](_0x2ce3f4,_0x5e35('0x26'));_0x278ebc[_0x5e35('0x2f')]=_[_0x5e35('0x30')](_0x5afcf6[_0x5e35('0x2f')]);_0x278ebc[_0x5e35('0x31')]=_[_0x5e35('0x32')](_0x278ebc['model'],_0x278ebc[_0x5e35('0x2f')]);_0x376d25['attributes']=_[_0x5e35('0x32')](_0x278ebc[_0x5e35('0x2e')],qs[_0x5e35('0x33')](_0x5afcf6[_0x5e35('0x2f')][_0x5e35('0x33')]));_0x376d25[_0x5e35('0x34')]=_0x376d25[_0x5e35('0x34')][_0x5e35('0x35')]?_0x376d25['attributes']:_0x278ebc['model'];if(!_0x5afcf6['query'][_0x5e35('0x36')](_0x5e35('0x37'))){_0x376d25['limit']=qs[_0x5e35('0x1b')](_0x5afcf6[_0x5e35('0x2f')]['limit']);_0x376d25['offset']=qs[_0x5e35('0x1d')](_0x5afcf6[_0x5e35('0x2f')]['offset']);}_0x376d25['order']=qs[_0x5e35('0x38')](_0x5afcf6['query'][_0x5e35('0x38')]);_0x376d25[_0x5e35('0x39')]=qs[_0x5e35('0x31')](_['pick'](_0x5afcf6[_0x5e35('0x2f')],_0x278ebc[_0x5e35('0x31')]),_0x2ce3f4);if(_0x5afcf6[_0x5e35('0x2f')][_0x5e35('0x3a')]){_0x376d25['where']=_[_0x5e35('0x3b')](_0x376d25[_0x5e35('0x39')],{'$or':_['map'](_0x2ce3f4,function(_0x1ad7cd){if(_0x1ad7cd[_0x5e35('0x2c')]!==_0x5e35('0x3c')){var _0xb6dfce={};_0xb6dfce[_0x1ad7cd[_0x5e35('0x26')]]={'$like':'%'+_0x5afcf6[_0x5e35('0x2f')]['filter']+'%'};return _0xb6dfce;}})});}_0x376d25=_['merge']({},_0x376d25,_0x5afcf6[_0x5e35('0x3d')]);var _0x4ed260={'where':_0x376d25[_0x5e35('0x39')]};return db['Dynamics365Configuration']['count'](_0x4ed260)[_0x5e35('0x22')](function(_0x623086){_0x3b4bba['count']=_0x623086;if(_0x5afcf6['query']['includeAll']){_0x376d25[_0x5e35('0x3e')]=[{'all':!![]}];}return db[_0x5e35('0x3f')][_0x5e35('0x40')](_0x376d25);})['then'](function(_0x5c24a7){_0x3b4bba[_0x5e35('0x41')]=_0x5c24a7;return _0x3b4bba;})[_0x5e35('0x22')](respondWithFilteredResult(_0x1d6326,_0x376d25))[_0x5e35('0x42')](handleError(_0x1d6326,null));};exports[_0x5e35('0x43')]=function(_0x58515,_0x54cf4c){var _0x4121af={'raw':![],'where':{'id':_0x58515['params']['id']}},_0x4ec67a={};_0x4ec67a[_0x5e35('0x2e')]=_[_0x5e35('0x30')](db[_0x5e35('0x3f')][_0x5e35('0x2a')]);_0x4ec67a['query']=_[_0x5e35('0x30')](_0x58515[_0x5e35('0x2f')]);_0x4ec67a[_0x5e35('0x31')]=_[_0x5e35('0x32')](_0x4ec67a[_0x5e35('0x2e')],_0x4ec67a[_0x5e35('0x2f')]);_0x4121af['attributes']=_[_0x5e35('0x32')](_0x4ec67a[_0x5e35('0x2e')],qs[_0x5e35('0x33')](_0x58515[_0x5e35('0x2f')][_0x5e35('0x33')]));_0x4121af[_0x5e35('0x34')]=_0x4121af[_0x5e35('0x34')]['length']?_0x4121af[_0x5e35('0x34')]:_0x4ec67a[_0x5e35('0x2e')];if(_0x58515[_0x5e35('0x2f')]['includeAll']){_0x4121af[_0x5e35('0x3e')]=[{'all':!![]}];}_0x4121af=_['merge']({},_0x4121af,_0x58515[_0x5e35('0x3d')]);return db[_0x5e35('0x3f')][_0x5e35('0x44')](_0x4121af)[_0x5e35('0x22')](handleEntityNotFound(_0x54cf4c,null))[_0x5e35('0x22')](respondWithResult(_0x54cf4c,null))[_0x5e35('0x42')](handleError(_0x54cf4c,null));};exports['create']=function(_0x56ba06,_0x1167da){return db[_0x5e35('0x3f')][_0x5e35('0x45')](_0x56ba06['body'],{})[_0x5e35('0x22')](respondWithResult(_0x1167da,0xc9))['catch'](handleError(_0x1167da,null));};exports['update']=function(_0x250356,_0x566dca){if(_0x250356[_0x5e35('0x46')]['id']){delete _0x250356[_0x5e35('0x46')]['id'];}return db[_0x5e35('0x3f')]['find']({'where':{'id':_0x250356['params']['id']}})['then'](handleEntityNotFound(_0x566dca,null))['then'](saveUpdates(_0x250356[_0x5e35('0x46')],null))[_0x5e35('0x22')](respondWithResult(_0x566dca,null))[_0x5e35('0x42')](handleError(_0x566dca,null));};exports['destroy']=function(_0x1168bd,_0x1e41d0){return db['Dynamics365Configuration'][_0x5e35('0x44')]({'where':{'id':_0x1168bd[_0x5e35('0x47')]['id']}})[_0x5e35('0x22')](handleEntityNotFound(_0x1e41d0,null))[_0x5e35('0x22')](removeEntity(_0x1e41d0,null))[_0x5e35('0x42')](handleError(_0x1e41d0,null));};exports['getFields']=function(_0x5f4780,_0x1a4b44,_0x15825e){var _0xd5bd59={};var _0x47aba2={};var _0xcba984;var _0x5e5606;return db[_0x5e35('0x3f')][_0x5e35('0x48')]({'where':{'id':_0x5f4780[_0x5e35('0x47')]['id']}})[_0x5e35('0x22')](handleEntityNotFound(_0x1a4b44,null))[_0x5e35('0x22')](function(_0x32880c){if(_0x32880c){_0xcba984=_0x32880c;_0x47aba2[_0x5e35('0x2e')]=_[_0x5e35('0x30')](db[_0x5e35('0x49')]['rawAttributes']);_0x47aba2['query']=_[_0x5e35('0x30')](_0x5f4780['query']);_0x47aba2[_0x5e35('0x31')]=_['intersection'](_0x47aba2[_0x5e35('0x2e')],_0x47aba2['query']);_0xd5bd59[_0x5e35('0x34')]=_['intersection'](_0x47aba2['model'],qs[_0x5e35('0x33')](_0x5f4780[_0x5e35('0x2f')][_0x5e35('0x33')]));_0xd5bd59[_0x5e35('0x34')]=_0xd5bd59[_0x5e35('0x34')][_0x5e35('0x35')]?_0xd5bd59['attributes']:_0x47aba2[_0x5e35('0x2e')];_0xd5bd59[_0x5e35('0x4a')]=qs['sort'](_0x5f4780[_0x5e35('0x2f')][_0x5e35('0x38')]);_0xd5bd59[_0x5e35('0x39')]=qs[_0x5e35('0x31')](_[_0x5e35('0x4b')](_0x5f4780[_0x5e35('0x2f')],_0x47aba2[_0x5e35('0x31')]));if(_0x5f4780[_0x5e35('0x2f')]['filter']){_0xd5bd59[_0x5e35('0x39')]=_[_0x5e35('0x3b')](_0xd5bd59[_0x5e35('0x39')],{'$or':_['map'](_0xd5bd59[_0x5e35('0x34')],function(_0x5c761e){var _0x2807dd={};_0x2807dd[_0x5c761e]={'$like':'%'+_0x5f4780[_0x5e35('0x2f')][_0x5e35('0x3a')]+'%'};return _0x2807dd;})});}_0xd5bd59=_[_0x5e35('0x3b')]({},_0xd5bd59,_0x5f4780[_0x5e35('0x3d')]);return _0xcba984[_0x5e35('0x4c')](_0xd5bd59);}})[_0x5e35('0x22')](function(_0x7b5241){if(_0x7b5241){_0x5e5606=_0x7b5241[_0x5e35('0x35')];if(!_0x5f4780[_0x5e35('0x2f')][_0x5e35('0x36')](_0x5e35('0x37'))){_0xd5bd59['limit']=qs[_0x5e35('0x1b')](_0x5f4780[_0x5e35('0x2f')]['limit']);_0xd5bd59['offset']=qs['offset'](_0x5f4780[_0x5e35('0x2f')][_0x5e35('0x1d')]);}return _0xcba984[_0x5e35('0x4c')](_0xd5bd59);}})[_0x5e35('0x22')](function(_0x2a55da){if(_0x2a55da){return _0x2a55da?{'count':_0x5e5606,'rows':_0x2a55da}:null;}})[_0x5e35('0x22')](respondWithResult(_0x1a4b44,null))[_0x5e35('0x42')](handleError(_0x1a4b44,null));};exports['getSubjects']=function(_0x2b38b5,_0x56a1e5,_0x38fcab){var _0x5d339e={};var _0x567529={};var _0x477f58;var _0xbb0700;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2b38b5[_0x5e35('0x47')]['id']}})['then'](handleEntityNotFound(_0x56a1e5,null))[_0x5e35('0x22')](function(_0x1e0446){if(_0x1e0446){_0x477f58=_0x1e0446;_0x567529[_0x5e35('0x2e')]=_[_0x5e35('0x30')](db[_0x5e35('0x49')][_0x5e35('0x2a')]);_0x567529['query']=_[_0x5e35('0x30')](_0x2b38b5['query']);_0x567529[_0x5e35('0x31')]=_['intersection'](_0x567529['model'],_0x567529[_0x5e35('0x2f')]);_0x5d339e[_0x5e35('0x34')]=_[_0x5e35('0x32')](_0x567529[_0x5e35('0x2e')],qs[_0x5e35('0x33')](_0x2b38b5['query'][_0x5e35('0x33')]));_0x5d339e[_0x5e35('0x34')]=_0x5d339e[_0x5e35('0x34')][_0x5e35('0x35')]?_0x5d339e['attributes']:_0x567529[_0x5e35('0x2e')];_0x5d339e[_0x5e35('0x4a')]=qs[_0x5e35('0x38')](_0x2b38b5[_0x5e35('0x2f')][_0x5e35('0x38')]);_0x5d339e['where']=qs[_0x5e35('0x31')](_['pick'](_0x2b38b5[_0x5e35('0x2f')],_0x567529['filters']));if(_0x2b38b5['query'][_0x5e35('0x3a')]){_0x5d339e[_0x5e35('0x39')]=_[_0x5e35('0x3b')](_0x5d339e[_0x5e35('0x39')],{'$or':_[_0x5e35('0x29')](_0x5d339e['attributes'],function(_0x16d010){var _0x59e1a3={};_0x59e1a3[_0x16d010]={'$like':'%'+_0x2b38b5['query']['filter']+'%'};return _0x59e1a3;})});}_0x5d339e=_[_0x5e35('0x3b')]({},_0x5d339e,_0x2b38b5['options']);return _0x477f58[_0x5e35('0x4d')](_0x5d339e);}})[_0x5e35('0x22')](function(_0x59e723){if(_0x59e723){_0xbb0700=_0x59e723[_0x5e35('0x35')];if(!_0x2b38b5[_0x5e35('0x2f')]['hasOwnProperty']('nolimit')){_0x5d339e[_0x5e35('0x1b')]=qs[_0x5e35('0x1b')](_0x2b38b5[_0x5e35('0x2f')][_0x5e35('0x1b')]);_0x5d339e[_0x5e35('0x1d')]=qs[_0x5e35('0x1d')](_0x2b38b5[_0x5e35('0x2f')]['offset']);}return _0x477f58[_0x5e35('0x4d')](_0x5d339e);}})[_0x5e35('0x22')](function(_0x5b3c80){if(_0x5b3c80){return _0x5b3c80?{'count':_0xbb0700,'rows':_0x5b3c80}:null;}})['then'](respondWithResult(_0x56a1e5,null))[_0x5e35('0x42')](handleError(_0x56a1e5,null));};exports[_0x5e35('0x4e')]=function(_0xf6e9f5,_0x555e72,_0x2cee17){var _0xbed905={};var _0x1c4c59={};var _0x34b54d;var _0x280129;return db[_0x5e35('0x3f')][_0x5e35('0x48')]({'where':{'id':_0xf6e9f5[_0x5e35('0x47')]['id']}})[_0x5e35('0x22')](handleEntityNotFound(_0x555e72,null))[_0x5e35('0x22')](function(_0xc49cb1){if(_0xc49cb1){_0x34b54d=_0xc49cb1;_0x1c4c59[_0x5e35('0x2e')]=_['keys'](db[_0x5e35('0x49')][_0x5e35('0x2a')]);_0x1c4c59[_0x5e35('0x2f')]=_[_0x5e35('0x30')](_0xf6e9f5['query']);_0x1c4c59[_0x5e35('0x31')]=_[_0x5e35('0x32')](_0x1c4c59[_0x5e35('0x2e')],_0x1c4c59['query']);_0xbed905[_0x5e35('0x34')]=_['intersection'](_0x1c4c59['model'],qs[_0x5e35('0x33')](_0xf6e9f5[_0x5e35('0x2f')]['fields']));_0xbed905[_0x5e35('0x34')]=_0xbed905[_0x5e35('0x34')]['length']?_0xbed905[_0x5e35('0x34')]:_0x1c4c59[_0x5e35('0x2e')];_0xbed905[_0x5e35('0x4a')]=qs['sort'](_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x38')]);_0xbed905[_0x5e35('0x39')]=qs['filters'](_[_0x5e35('0x4b')](_0xf6e9f5['query'],_0x1c4c59['filters']));if(_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x3a')]){_0xbed905[_0x5e35('0x39')]=_[_0x5e35('0x3b')](_0xbed905[_0x5e35('0x39')],{'$or':_[_0x5e35('0x29')](_0xbed905['attributes'],function(_0x29222c){var _0x2b4470={};_0x2b4470[_0x29222c]={'$like':'%'+_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x3a')]+'%'};return _0x2b4470;})});}_0xbed905=_[_0x5e35('0x3b')]({},_0xbed905,_0xf6e9f5['options']);return _0x34b54d[_0x5e35('0x4e')](_0xbed905);}})[_0x5e35('0x22')](function(_0x5325c9){if(_0x5325c9){_0x280129=_0x5325c9[_0x5e35('0x35')];if(!_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x36')](_0x5e35('0x37'))){_0xbed905[_0x5e35('0x1b')]=qs[_0x5e35('0x1b')](_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x1b')]);_0xbed905[_0x5e35('0x1d')]=qs[_0x5e35('0x1d')](_0xf6e9f5[_0x5e35('0x2f')][_0x5e35('0x1d')]);}return _0x34b54d[_0x5e35('0x4e')](_0xbed905);}})[_0x5e35('0x22')](function(_0x3df4ca){if(_0x3df4ca){return _0x3df4ca?{'count':_0x280129,'rows':_0x3df4ca}:null;}})[_0x5e35('0x22')](respondWithResult(_0x555e72,null))[_0x5e35('0x42')](handleError(_0x555e72,null));}; \ No newline at end of file +var _0xa01d=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','includeAll','find','catch','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x356bb2,_0x471e7a){var _0x198620=function(_0x2f92b2){while(--_0x2f92b2){_0x356bb2['push'](_0x356bb2['shift']());}};_0x198620(++_0x471e7a);}(_0xa01d,0x1e4));var _0xda01=function(_0x500663,_0x2a329b){_0x500663=_0x500663-0x0;var _0xa9908=_0xa01d[_0x500663];return _0xa9908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda01('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda01('0x1'));var rp=require(_0xda01('0x2'));var moment=require('moment');var BPromise=require(_0xda01('0x3'));var Mustache=require(_0xda01('0x4'));var util=require(_0xda01('0x5'));var path=require('path');var sox=require(_0xda01('0x6'));var csv=require(_0xda01('0x7'));var ejs=require(_0xda01('0x8'));var fs=require('fs');var fs_extra=require(_0xda01('0x9'));var _=require('lodash');var squel=require(_0xda01('0xa'));var crypto=require(_0xda01('0xb'));var jsforce=require(_0xda01('0xc'));var deskjs=require(_0xda01('0xd'));var toCsv=require(_0xda01('0x7'));var querystring=require('querystring');var Papa=require(_0xda01('0xe'));var Redis=require(_0xda01('0xf'));var authService=require(_0xda01('0x10'));var qs=require(_0xda01('0x11'));var as=require(_0xda01('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda01('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda01('0x14'))['db'];function respondWithStatusCode(_0x2a4f2a,_0x416427){_0x416427=_0x416427||0xcc;return function(_0x209b1c){if(_0x209b1c){return _0x2a4f2a[_0xda01('0x15')](_0x416427);}return _0x2a4f2a[_0xda01('0x16')](_0x416427)[_0xda01('0x17')]();};}function respondWithResult(_0x53d482,_0x4f66f9){_0x4f66f9=_0x4f66f9||0xc8;return function(_0x252a59){if(_0x252a59){return _0x53d482['status'](_0x4f66f9)[_0xda01('0x18')](_0x252a59);}};}function respondWithFilteredResult(_0xebdb1e,_0x498c9c){return function(_0x51b475){if(_0x51b475){var _0x50192c=typeof _0x498c9c[_0xda01('0x19')]===_0xda01('0x1a')&&typeof _0x498c9c[_0xda01('0x1b')]==='undefined';var _0x570483=_0x51b475['count'];var _0x1f4e0f=_0x50192c?0x0:_0x498c9c['offset'];var _0xaa202c=_0x50192c?_0x51b475[_0xda01('0x1c')]:_0x498c9c['offset']+_0x498c9c['limit'];var _0xfe3e2c;if(_0xaa202c>=_0x570483){_0xaa202c=_0x570483;_0xfe3e2c=0xc8;}else{_0xfe3e2c=0xce;}_0xebdb1e[_0xda01('0x16')](_0xfe3e2c);return _0xebdb1e[_0xda01('0x1d')](_0xda01('0x1e'),_0x1f4e0f+'-'+_0xaa202c+'/'+_0x570483)[_0xda01('0x18')](_0x51b475);}return null;};}function patchUpdates(_0x25dbbb){return function(_0x4a9cc0){try{jsonpatch[_0xda01('0x1f')](_0x4a9cc0,_0x25dbbb,!![]);}catch(_0x47b49e){return BPromise[_0xda01('0x20')](_0x47b49e);}return _0x4a9cc0['save']();};}function saveUpdates(_0x1638f4,_0xa9f454){return function(_0xc06f0e){if(_0xc06f0e){return _0xc06f0e[_0xda01('0x21')](_0x1638f4)[_0xda01('0x22')](function(_0x113e3c){return _0x113e3c;});}return null;};}function removeEntity(_0xf1f984,_0x6a525b){return function(_0x432e6e){if(_0x432e6e){return _0x432e6e[_0xda01('0x23')]()[_0xda01('0x22')](function(){_0xf1f984['status'](0xcc)[_0xda01('0x17')]();});}};}function handleEntityNotFound(_0x44181b,_0x5c3196){return function(_0x4e9eb6){if(!_0x4e9eb6){_0x44181b[_0xda01('0x15')](0x194);}return _0x4e9eb6;};}function handleError(_0x514bc4,_0x19756c){_0x19756c=_0x19756c||0x1f4;return function(_0x1d3e17){logger[_0xda01('0x24')](_0x1d3e17['stack']);if(_0x1d3e17[_0xda01('0x25')]){delete _0x1d3e17['name'];}_0x514bc4[_0xda01('0x16')](_0x19756c)[_0xda01('0x26')](_0x1d3e17);};}exports[_0xda01('0x27')]=function(_0x1467c6,_0x455fdb){var _0x35d9b7={},_0x2bfa87={},_0x49b752={'count':0x0,'rows':[]};var _0x26b8a2=_[_0xda01('0x28')](db[_0xda01('0x29')][_0xda01('0x2a')],function(_0x3116d){return{'name':_0x3116d['fieldName'],'type':_0x3116d[_0xda01('0x2b')][_0xda01('0x2c')]};});_0x2bfa87[_0xda01('0x2d')]=_[_0xda01('0x28')](_0x26b8a2,_0xda01('0x25'));_0x2bfa87[_0xda01('0x2e')]=_[_0xda01('0x2f')](_0x1467c6[_0xda01('0x2e')]);_0x2bfa87[_0xda01('0x30')]=_[_0xda01('0x31')](_0x2bfa87[_0xda01('0x2d')],_0x2bfa87[_0xda01('0x2e')]);_0x35d9b7[_0xda01('0x32')]=_[_0xda01('0x31')](_0x2bfa87[_0xda01('0x2d')],qs[_0xda01('0x33')](_0x1467c6[_0xda01('0x2e')]['fields']));_0x35d9b7['attributes']=_0x35d9b7['attributes'][_0xda01('0x34')]?_0x35d9b7['attributes']:_0x2bfa87[_0xda01('0x2d')];if(!_0x1467c6[_0xda01('0x2e')][_0xda01('0x35')](_0xda01('0x36'))){_0x35d9b7['limit']=qs[_0xda01('0x1b')](_0x1467c6[_0xda01('0x2e')][_0xda01('0x1b')]);_0x35d9b7['offset']=qs[_0xda01('0x19')](_0x1467c6[_0xda01('0x2e')][_0xda01('0x19')]);}_0x35d9b7[_0xda01('0x37')]=qs[_0xda01('0x38')](_0x1467c6[_0xda01('0x2e')][_0xda01('0x38')]);_0x35d9b7[_0xda01('0x39')]=qs[_0xda01('0x30')](_[_0xda01('0x3a')](_0x1467c6['query'],_0x2bfa87['filters']),_0x26b8a2);if(_0x1467c6[_0xda01('0x2e')][_0xda01('0x3b')]){_0x35d9b7[_0xda01('0x39')]=_[_0xda01('0x3c')](_0x35d9b7[_0xda01('0x39')],{'$or':_['map'](_0x26b8a2,function(_0x4c0097){if(_0x4c0097[_0xda01('0x2b')]!==_0xda01('0x3d')){var _0x29e997={};_0x29e997[_0x4c0097[_0xda01('0x25')]]={'$like':'%'+_0x1467c6[_0xda01('0x2e')][_0xda01('0x3b')]+'%'};return _0x29e997;}})});}_0x35d9b7=_['merge']({},_0x35d9b7,_0x1467c6[_0xda01('0x3e')]);var _0x3b1e55={'where':_0x35d9b7[_0xda01('0x39')]};return db['Dynamics365Configuration'][_0xda01('0x1c')](_0x3b1e55)['then'](function(_0x24afc6){_0x49b752[_0xda01('0x1c')]=_0x24afc6;if(_0x1467c6[_0xda01('0x2e')]['includeAll']){_0x35d9b7[_0xda01('0x3f')]=[{'all':!![]}];}return db[_0xda01('0x29')]['findAll'](_0x35d9b7);})[_0xda01('0x22')](function(_0x4f69f8){_0x49b752[_0xda01('0x40')]=_0x4f69f8;return _0x49b752;})[_0xda01('0x22')](respondWithFilteredResult(_0x455fdb,_0x35d9b7))['catch'](handleError(_0x455fdb,null));};exports[_0xda01('0x41')]=function(_0x55e28a,_0x51ce5d){var _0x34ffcc={'raw':![],'where':{'id':_0x55e28a['params']['id']}},_0x32e3d5={};_0x32e3d5['model']=_[_0xda01('0x2f')](db[_0xda01('0x29')][_0xda01('0x2a')]);_0x32e3d5[_0xda01('0x2e')]=_[_0xda01('0x2f')](_0x55e28a[_0xda01('0x2e')]);_0x32e3d5['filters']=_[_0xda01('0x31')](_0x32e3d5[_0xda01('0x2d')],_0x32e3d5[_0xda01('0x2e')]);_0x34ffcc[_0xda01('0x32')]=_[_0xda01('0x31')](_0x32e3d5['model'],qs[_0xda01('0x33')](_0x55e28a[_0xda01('0x2e')][_0xda01('0x33')]));_0x34ffcc[_0xda01('0x32')]=_0x34ffcc[_0xda01('0x32')][_0xda01('0x34')]?_0x34ffcc[_0xda01('0x32')]:_0x32e3d5[_0xda01('0x2d')];if(_0x55e28a[_0xda01('0x2e')][_0xda01('0x42')]){_0x34ffcc[_0xda01('0x3f')]=[{'all':!![]}];}_0x34ffcc=_[_0xda01('0x3c')]({},_0x34ffcc,_0x55e28a[_0xda01('0x3e')]);return db[_0xda01('0x29')][_0xda01('0x43')](_0x34ffcc)[_0xda01('0x22')](handleEntityNotFound(_0x51ce5d,null))[_0xda01('0x22')](respondWithResult(_0x51ce5d,null))[_0xda01('0x44')](handleError(_0x51ce5d,null));};exports[_0xda01('0x45')]=function(_0x4eb03b,_0x47d57f){return db[_0xda01('0x29')][_0xda01('0x45')](_0x4eb03b['body'],{})[_0xda01('0x22')](respondWithResult(_0x47d57f,0xc9))[_0xda01('0x44')](handleError(_0x47d57f,null));};exports['update']=function(_0x194ce0,_0x1c03b6){if(_0x194ce0[_0xda01('0x46')]['id']){delete _0x194ce0[_0xda01('0x46')]['id'];}return db[_0xda01('0x29')][_0xda01('0x43')]({'where':{'id':_0x194ce0[_0xda01('0x47')]['id']}})[_0xda01('0x22')](handleEntityNotFound(_0x1c03b6,null))['then'](saveUpdates(_0x194ce0[_0xda01('0x46')],null))[_0xda01('0x22')](respondWithResult(_0x1c03b6,null))[_0xda01('0x44')](handleError(_0x1c03b6,null));};exports[_0xda01('0x23')]=function(_0x371332,_0x3a1ff2){return db[_0xda01('0x29')][_0xda01('0x43')]({'where':{'id':_0x371332[_0xda01('0x47')]['id']}})[_0xda01('0x22')](handleEntityNotFound(_0x3a1ff2,null))[_0xda01('0x22')](removeEntity(_0x3a1ff2,null))['catch'](handleError(_0x3a1ff2,null));};exports[_0xda01('0x48')]=function(_0x1f6558,_0x247bf4,_0x44877a){var _0x2002b2={};var _0x9868f2={};var _0x2987db;var _0x27e7be;return db[_0xda01('0x29')][_0xda01('0x49')]({'where':{'id':_0x1f6558['params']['id']}})[_0xda01('0x22')](handleEntityNotFound(_0x247bf4,null))[_0xda01('0x22')](function(_0x1f4f9e){if(_0x1f4f9e){_0x2987db=_0x1f4f9e;_0x9868f2['model']=_['keys'](db[_0xda01('0x4a')][_0xda01('0x2a')]);_0x9868f2[_0xda01('0x2e')]=_[_0xda01('0x2f')](_0x1f6558[_0xda01('0x2e')]);_0x9868f2[_0xda01('0x30')]=_[_0xda01('0x31')](_0x9868f2[_0xda01('0x2d')],_0x9868f2['query']);_0x2002b2[_0xda01('0x32')]=_[_0xda01('0x31')](_0x9868f2[_0xda01('0x2d')],qs[_0xda01('0x33')](_0x1f6558[_0xda01('0x2e')][_0xda01('0x33')]));_0x2002b2[_0xda01('0x32')]=_0x2002b2['attributes']['length']?_0x2002b2[_0xda01('0x32')]:_0x9868f2[_0xda01('0x2d')];_0x2002b2[_0xda01('0x37')]=qs[_0xda01('0x38')](_0x1f6558[_0xda01('0x2e')][_0xda01('0x38')]);_0x2002b2[_0xda01('0x39')]=qs[_0xda01('0x30')](_[_0xda01('0x3a')](_0x1f6558[_0xda01('0x2e')],_0x9868f2['filters']));if(_0x1f6558['query'][_0xda01('0x3b')]){_0x2002b2[_0xda01('0x39')]=_['merge'](_0x2002b2['where'],{'$or':_['map'](_0x2002b2[_0xda01('0x32')],function(_0x467966){var _0x9fc084={};_0x9fc084[_0x467966]={'$like':'%'+_0x1f6558[_0xda01('0x2e')][_0xda01('0x3b')]+'%'};return _0x9fc084;})});}_0x2002b2=_[_0xda01('0x3c')]({},_0x2002b2,_0x1f6558[_0xda01('0x3e')]);return _0x2987db[_0xda01('0x48')](_0x2002b2);}})[_0xda01('0x22')](function(_0x68c61d){if(_0x68c61d){_0x27e7be=_0x68c61d[_0xda01('0x34')];if(!_0x1f6558[_0xda01('0x2e')][_0xda01('0x35')]('nolimit')){_0x2002b2[_0xda01('0x1b')]=qs['limit'](_0x1f6558[_0xda01('0x2e')][_0xda01('0x1b')]);_0x2002b2[_0xda01('0x19')]=qs[_0xda01('0x19')](_0x1f6558['query'][_0xda01('0x19')]);}return _0x2987db['getFields'](_0x2002b2);}})[_0xda01('0x22')](function(_0x3f05b1){if(_0x3f05b1){return _0x3f05b1?{'count':_0x27e7be,'rows':_0x3f05b1}:null;}})[_0xda01('0x22')](respondWithResult(_0x247bf4,null))[_0xda01('0x44')](handleError(_0x247bf4,null));};exports[_0xda01('0x4b')]=function(_0x5adfa2,_0x23b77e,_0x311dae){var _0x4de519={};var _0x255be4={};var _0x4c49eb;var _0x54b449;return db[_0xda01('0x29')][_0xda01('0x49')]({'where':{'id':_0x5adfa2[_0xda01('0x47')]['id']}})[_0xda01('0x22')](handleEntityNotFound(_0x23b77e,null))[_0xda01('0x22')](function(_0x2c5de1){if(_0x2c5de1){_0x4c49eb=_0x2c5de1;_0x255be4[_0xda01('0x2d')]=_['keys'](db[_0xda01('0x4a')][_0xda01('0x2a')]);_0x255be4[_0xda01('0x2e')]=_['keys'](_0x5adfa2[_0xda01('0x2e')]);_0x255be4[_0xda01('0x30')]=_[_0xda01('0x31')](_0x255be4[_0xda01('0x2d')],_0x255be4[_0xda01('0x2e')]);_0x4de519[_0xda01('0x32')]=_[_0xda01('0x31')](_0x255be4['model'],qs['fields'](_0x5adfa2[_0xda01('0x2e')][_0xda01('0x33')]));_0x4de519[_0xda01('0x32')]=_0x4de519[_0xda01('0x32')][_0xda01('0x34')]?_0x4de519['attributes']:_0x255be4[_0xda01('0x2d')];_0x4de519[_0xda01('0x37')]=qs[_0xda01('0x38')](_0x5adfa2[_0xda01('0x2e')][_0xda01('0x38')]);_0x4de519[_0xda01('0x39')]=qs[_0xda01('0x30')](_[_0xda01('0x3a')](_0x5adfa2['query'],_0x255be4[_0xda01('0x30')]));if(_0x5adfa2['query'][_0xda01('0x3b')]){_0x4de519[_0xda01('0x39')]=_[_0xda01('0x3c')](_0x4de519['where'],{'$or':_[_0xda01('0x28')](_0x4de519[_0xda01('0x32')],function(_0x2d4b74){var _0x3a7df8={};_0x3a7df8[_0x2d4b74]={'$like':'%'+_0x5adfa2[_0xda01('0x2e')]['filter']+'%'};return _0x3a7df8;})});}_0x4de519=_[_0xda01('0x3c')]({},_0x4de519,_0x5adfa2[_0xda01('0x3e')]);return _0x4c49eb[_0xda01('0x4b')](_0x4de519);}})['then'](function(_0x3e3862){if(_0x3e3862){_0x54b449=_0x3e3862['length'];if(!_0x5adfa2[_0xda01('0x2e')][_0xda01('0x35')]('nolimit')){_0x4de519['limit']=qs[_0xda01('0x1b')](_0x5adfa2[_0xda01('0x2e')][_0xda01('0x1b')]);_0x4de519['offset']=qs['offset'](_0x5adfa2[_0xda01('0x2e')][_0xda01('0x19')]);}return _0x4c49eb[_0xda01('0x4b')](_0x4de519);}})[_0xda01('0x22')](function(_0x4fa17e){if(_0x4fa17e){return _0x4fa17e?{'count':_0x54b449,'rows':_0x4fa17e}:null;}})['then'](respondWithResult(_0x23b77e,null))[_0xda01('0x44')](handleError(_0x23b77e,null));};exports[_0xda01('0x4c')]=function(_0x1e01ef,_0x420dbb,_0x2ea2c0){var _0x2ca4d5={};var _0x57ae3a={};var _0x2a88b2;var _0x4ea6ca;return db[_0xda01('0x29')][_0xda01('0x49')]({'where':{'id':_0x1e01ef[_0xda01('0x47')]['id']}})[_0xda01('0x22')](handleEntityNotFound(_0x420dbb,null))[_0xda01('0x22')](function(_0x1143f7){if(_0x1143f7){_0x2a88b2=_0x1143f7;_0x57ae3a[_0xda01('0x2d')]=_[_0xda01('0x2f')](db[_0xda01('0x4a')]['rawAttributes']);_0x57ae3a[_0xda01('0x2e')]=_[_0xda01('0x2f')](_0x1e01ef[_0xda01('0x2e')]);_0x57ae3a['filters']=_['intersection'](_0x57ae3a[_0xda01('0x2d')],_0x57ae3a[_0xda01('0x2e')]);_0x2ca4d5[_0xda01('0x32')]=_['intersection'](_0x57ae3a['model'],qs[_0xda01('0x33')](_0x1e01ef[_0xda01('0x2e')][_0xda01('0x33')]));_0x2ca4d5[_0xda01('0x32')]=_0x2ca4d5[_0xda01('0x32')][_0xda01('0x34')]?_0x2ca4d5[_0xda01('0x32')]:_0x57ae3a[_0xda01('0x2d')];_0x2ca4d5[_0xda01('0x37')]=qs[_0xda01('0x38')](_0x1e01ef[_0xda01('0x2e')]['sort']);_0x2ca4d5[_0xda01('0x39')]=qs[_0xda01('0x30')](_[_0xda01('0x3a')](_0x1e01ef[_0xda01('0x2e')],_0x57ae3a[_0xda01('0x30')]));if(_0x1e01ef[_0xda01('0x2e')][_0xda01('0x3b')]){_0x2ca4d5['where']=_[_0xda01('0x3c')](_0x2ca4d5['where'],{'$or':_[_0xda01('0x28')](_0x2ca4d5[_0xda01('0x32')],function(_0x33dc23){var _0x5c339a={};_0x5c339a[_0x33dc23]={'$like':'%'+_0x1e01ef['query'][_0xda01('0x3b')]+'%'};return _0x5c339a;})});}_0x2ca4d5=_['merge']({},_0x2ca4d5,_0x1e01ef['options']);return _0x2a88b2['getDescriptions'](_0x2ca4d5);}})[_0xda01('0x22')](function(_0x10d00e){if(_0x10d00e){_0x4ea6ca=_0x10d00e['length'];if(!_0x1e01ef[_0xda01('0x2e')][_0xda01('0x35')]('nolimit')){_0x2ca4d5[_0xda01('0x1b')]=qs[_0xda01('0x1b')](_0x1e01ef[_0xda01('0x2e')][_0xda01('0x1b')]);_0x2ca4d5[_0xda01('0x19')]=qs[_0xda01('0x19')](_0x1e01ef[_0xda01('0x2e')][_0xda01('0x19')]);}return _0x2a88b2[_0xda01('0x4c')](_0x2ca4d5);}})[_0xda01('0x22')](function(_0x4ecf5c){if(_0x4ecf5c){return _0x4ecf5c?{'count':_0x4ea6ca,'rows':_0x4ecf5c}:null;}})[_0xda01('0x22')](respondWithResult(_0x420dbb,null))[_0xda01('0x44')](handleError(_0x420dbb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8ef65d1..40c7877 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x3e74,0x175));var _0x43e7=function(_0x2eb883,_0x5b5b7b){_0x2eb883=_0x2eb883-0x0;var _0x2ec3d5=_0x3e74[_0x2eb883];return _0x2ec3d5;};'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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x1b528e,_0x5be309){var _0x176f6f=function(_0x4c810b){while(--_0x4c810b){_0x1b528e['push'](_0x1b528e['shift']());}};_0x176f6f(++_0x5be309);}(_0x84ab,0x12f));var _0xb84a=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x84ab[_0x3877c1];return _0x59056a;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','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 5a504fc..8aad385 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 _0xbf5d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x4dacfb,_0x3628f6){var _0x316580=function(_0x49004c){while(--_0x49004c){_0x4dacfb['push'](_0x4dacfb['shift']());}};_0x316580(++_0x3628f6);}(_0xbf5d,0x8f));var _0xdbf5=function(_0x4f91d9,_0x3fba2f){_0x4f91d9=_0x4f91d9-0x0;var _0x4e3492=_0xbf5d[_0x4f91d9];return _0x4e3492;};'use strict';var _=require('lodash');var util=require(_0xdbf5('0x0'));var moment=require('moment');var BPromise=require(_0xdbf5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbf5('0x2'));var db=require(_0xdbf5('0x3'))['db'];var utils=require(_0xdbf5('0x4'));var logger=require(_0xdbf5('0x5'))(_0xdbf5('0x6'));var config=require(_0xdbf5('0x7'));var jayson=require(_0xdbf5('0x8'));var client=jayson['client'][_0xdbf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59453e,_0x5b3155,_0x20f942){return new BPromise(function(_0x6d1daa,_0x2af952){return client[_0xdbf5('0xa')](_0x59453e,_0x20f942)[_0xdbf5('0xb')](function(_0x2271a8){logger[_0xdbf5('0xc')](_0xdbf5('0xd'),_0x5b3155,'request\x20sent');logger[_0xdbf5('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5b3155,'request\x20sent',JSON[_0xdbf5('0xf')](_0x2271a8));if(_0x2271a8[_0xdbf5('0x10')]){if(_0x2271a8[_0xdbf5('0x10')][_0xdbf5('0x11')]===0x1f4){logger['error'](_0xdbf5('0xd'),_0x5b3155,_0x2271a8[_0xdbf5('0x10')][_0xdbf5('0x12')]);return _0x2af952(_0x2271a8[_0xdbf5('0x10')][_0xdbf5('0x12')]);}logger[_0xdbf5('0x10')](_0xdbf5('0xd'),_0x5b3155,_0x2271a8[_0xdbf5('0x10')][_0xdbf5('0x12')]);return _0x6d1daa(_0x2271a8[_0xdbf5('0x10')][_0xdbf5('0x12')]);}else{logger['info'](_0xdbf5('0xd'),_0x5b3155,'request\x20sent');_0x6d1daa(_0x2271a8[_0xdbf5('0x13')]['message']);}})[_0xdbf5('0x14')](function(_0xc56416){logger['error'](_0xdbf5('0xd'),_0x5b3155,_0xc56416);_0x2af952(_0xc56416);});});} \ No newline at end of file +var _0x2fe2=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x203b83,_0x4671f6){var _0x3725c6=function(_0xc6a169){while(--_0xc6a169){_0x203b83['push'](_0x203b83['shift']());}};_0x3725c6(++_0x4671f6);}(_0x2fe2,0xd8));var _0x22fe=function(_0xe89c08,_0x48cb9d){_0xe89c08=_0xe89c08-0x0;var _0x16738e=_0x2fe2[_0xe89c08];return _0x16738e;};'use strict';var _=require('lodash');var util=require(_0x22fe('0x0'));var moment=require(_0x22fe('0x1'));var BPromise=require(_0x22fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22fe('0x3'));var db=require(_0x22fe('0x4'))['db'];var utils=require(_0x22fe('0x5'));var logger=require(_0x22fe('0x6'))(_0x22fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x22fe('0x8'));var client=jayson['client'][_0x22fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59e38d,_0x2ab082,_0x53ccaf){return new BPromise(function(_0x12865e,_0xbe4dd0){return client[_0x22fe('0xa')](_0x59e38d,_0x53ccaf)[_0x22fe('0xb')](function(_0x53c470){logger[_0x22fe('0xc')](_0x22fe('0xd'),_0x2ab082,_0x22fe('0xe'));logger[_0x22fe('0xf')](_0x22fe('0x10'),_0x2ab082,_0x22fe('0xe'),JSON[_0x22fe('0x11')](_0x53c470));if(_0x53c470['error']){if(_0x53c470[_0x22fe('0x12')][_0x22fe('0x13')]===0x1f4){logger[_0x22fe('0x12')](_0x22fe('0xd'),_0x2ab082,_0x53c470[_0x22fe('0x12')][_0x22fe('0x14')]);return _0xbe4dd0(_0x53c470[_0x22fe('0x12')][_0x22fe('0x14')]);}logger['error'](_0x22fe('0xd'),_0x2ab082,_0x53c470[_0x22fe('0x12')][_0x22fe('0x14')]);return _0x12865e(_0x53c470[_0x22fe('0x12')][_0x22fe('0x14')]);}else{logger[_0x22fe('0xc')](_0x22fe('0xd'),_0x2ab082,'request\x20sent');_0x12865e(_0x53c470[_0x22fe('0x15')][_0x22fe('0x14')]);}})[_0x22fe('0x16')](function(_0x1f6403){logger[_0x22fe('0x12')](_0x22fe('0xd'),_0x2ab082,_0x1f6403);_0xbe4dd0(_0x1f6403);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5c98955..3479e51 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 _0xfb47=['delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x1b576d,_0x2ce437){var _0xa33e9b=function(_0x47b2da){while(--_0x47b2da){_0x1b576d['push'](_0x1b576d['shift']());}};_0xa33e9b(++_0x2ce437);}(_0xfb47,0x19a));var _0x7fb4=function(_0x492336,_0x2af56a){_0x492336=_0x492336-0x0;var _0xcb5fd7=_0xfb47[_0x492336];return _0xcb5fd7;};'use strict';var multer=require(_0x7fb4('0x0'));var util=require(_0x7fb4('0x1'));var path=require(_0x7fb4('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fb4('0x3'));var router=express['Router']();var fs_extra=require(_0x7fb4('0x4'));var auth=require(_0x7fb4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7fb4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fb4('0x7')]);router[_0x7fb4('0x8')](_0x7fb4('0x9'),auth[_0x7fb4('0xa')](),controller[_0x7fb4('0xb')]);router[_0x7fb4('0xc')]('/',auth[_0x7fb4('0xa')](),controller[_0x7fb4('0xd')]);router['put']('/:id',auth[_0x7fb4('0xa')](),controller[_0x7fb4('0xe')]);router[_0x7fb4('0xf')](_0x7fb4('0x9'),auth[_0x7fb4('0xa')](),controller['destroy']);module[_0x7fb4('0x10')]=router; \ No newline at end of file +var _0x48f2=['./intDynamics365Field.controller','get','index','isAuthenticated','create','put','update','delete','/:id','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service'];(function(_0x2ccbd1,_0x5da465){var _0x101d73=function(_0x55a901){while(--_0x55a901){_0x2ccbd1['push'](_0x2ccbd1['shift']());}};_0x101d73(++_0x5da465);}(_0x48f2,0x16b));var _0x248f=function(_0x207177,_0x5d450c){_0x207177=_0x207177-0x0;var _0x1ed60c=_0x48f2[_0x207177];return _0x1ed60c;};'use strict';var multer=require(_0x248f('0x0'));var util=require('util');var path=require(_0x248f('0x1'));var timeout=require('connect-timeout');var express=require(_0x248f('0x2'));var router=express['Router']();var fs_extra=require(_0x248f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x248f('0x4'));var config=require('../../config/environment');var controller=require(_0x248f('0x5'));router[_0x248f('0x6')]('/',auth['isAuthenticated'](),controller[_0x248f('0x7')]);router['get']('/:id',auth[_0x248f('0x8')](),controller['show']);router['post']('/',auth[_0x248f('0x8')](),controller[_0x248f('0x9')]);router[_0x248f('0xa')]('/:id',auth[_0x248f('0x8')](),controller[_0x248f('0xb')]);router[_0x248f('0xc')](_0x248f('0xd'),auth[_0x248f('0x8')](),controller[_0x248f('0xe')]);module[_0x248f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a8a1db0..4566f9b 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 _0x662d=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x243a2a,_0x35a7a6){var _0x38cdec=function(_0x4e85c3){while(--_0x4e85c3){_0x243a2a['push'](_0x243a2a['shift']());}};_0x38cdec(++_0x35a7a6);}(_0x662d,0xfc));var _0xd662=function(_0x2afcf7,_0x189ad8){_0x2afcf7=_0x2afcf7-0x0;var _0x5e9ffc=_0x662d[_0x2afcf7];return _0x5e9ffc;};'use strict';var Sequelize=require(_0xd662('0x0'));module[_0xd662('0x1')]={'type':{'type':Sequelize[_0xd662('0x2')](_0xd662('0x3'),_0xd662('0x4'),'customVariable',_0xd662('0x5'),'picklist'),'defaultValue':_0xd662('0x3')},'content':{'type':Sequelize[_0xd662('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd662('0x2')](_0xd662('0x3'),_0xd662('0x4'),_0xd662('0x7'))},'keyContent':{'type':Sequelize[_0xd662('0x6')]},'idField':{'type':Sequelize[_0xd662('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd662('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd662('0x6')]}}; \ No newline at end of file +var _0x9fa4=['keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x2c523a,_0x5ac80f){var _0x3334ca=function(_0x48c686){while(--_0x48c686){_0x2c523a['push'](_0x2c523a['shift']());}};_0x3334ca(++_0x5ac80f);}(_0x9fa4,0x145));var _0x49fa=function(_0x23c2ed,_0x4ad287){_0x23c2ed=_0x23c2ed-0x0;var _0x4315c3=_0x9fa4[_0x23c2ed];return _0x4315c3;};'use strict';var Sequelize=require(_0x49fa('0x0'));module[_0x49fa('0x1')]={'type':{'type':Sequelize[_0x49fa('0x2')]('string',_0x49fa('0x3'),_0x49fa('0x4'),_0x49fa('0x5'),_0x49fa('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x49fa('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x49fa('0x2')](_0x49fa('0x8'),_0x49fa('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x49fa('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x49fa('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49fa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 37c07cd..285efaf 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 _0xf07d=['limit','undefined','count','offset','set','json','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xf07d,0x149));var _0xdf07=function(_0x1494f8,_0xa35f49){_0x1494f8=_0x1494f8-0x0;var _0x435dee=_0xf07d[_0x1494f8];return _0x435dee;};'use strict';var emlformat=require(_0xdf07('0x0'));var rimraf=require(_0xdf07('0x1'));var zipdir=require(_0xdf07('0x2'));var jsonpatch=require(_0xdf07('0x3'));var rp=require(_0xdf07('0x4'));var moment=require('moment');var BPromise=require(_0xdf07('0x5'));var Mustache=require('mustache');var util=require(_0xdf07('0x6'));var path=require(_0xdf07('0x7'));var sox=require('sox');var csv=require(_0xdf07('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf07('0x9'));var _=require(_0xdf07('0xa'));var squel=require(_0xdf07('0xb'));var crypto=require(_0xdf07('0xc'));var jsforce=require(_0xdf07('0xd'));var deskjs=require(_0xdf07('0xe'));var toCsv=require(_0xdf07('0x8'));var querystring=require('querystring');var Papa=require(_0xdf07('0xf'));var Redis=require(_0xdf07('0x10'));var authService=require(_0xdf07('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf07('0x12'));var logger=require('../../config/logger')(_0xdf07('0x13'));var utils=require('../../config/utils');var config=require(_0xdf07('0x14'));var licenseUtil=require(_0xdf07('0x15'));var db=require(_0xdf07('0x16'))['db'];function respondWithStatusCode(_0x3f70d1,_0x186b27){_0x186b27=_0x186b27||0xcc;return function(_0x4b3756){if(_0x4b3756){return _0x3f70d1[_0xdf07('0x17')](_0x186b27);}return _0x3f70d1[_0xdf07('0x18')](_0x186b27)[_0xdf07('0x19')]();};}function respondWithResult(_0x542cab,_0x324d25){_0x324d25=_0x324d25||0xc8;return function(_0x1b8798){if(_0x1b8798){return _0x542cab['status'](_0x324d25)['json'](_0x1b8798);}};}function respondWithFilteredResult(_0x563246,_0x2fb624){return function(_0x50438f){if(_0x50438f){var _0x5a982c=typeof _0x2fb624['offset']==='undefined'&&typeof _0x2fb624[_0xdf07('0x1a')]===_0xdf07('0x1b');var _0x557586=_0x50438f[_0xdf07('0x1c')];var _0x4509e7=_0x5a982c?0x0:_0x2fb624[_0xdf07('0x1d')];var _0x3ac9a3=_0x5a982c?_0x50438f[_0xdf07('0x1c')]:_0x2fb624[_0xdf07('0x1d')]+_0x2fb624[_0xdf07('0x1a')];var _0x3f32e2;if(_0x3ac9a3>=_0x557586){_0x3ac9a3=_0x557586;_0x3f32e2=0xc8;}else{_0x3f32e2=0xce;}_0x563246[_0xdf07('0x18')](_0x3f32e2);return _0x563246[_0xdf07('0x1e')]('Content-Range',_0x4509e7+'-'+_0x3ac9a3+'/'+_0x557586)[_0xdf07('0x1f')](_0x50438f);}return null;};}function patchUpdates(_0x5fba36){return function(_0x3db18b){try{jsonpatch[_0xdf07('0x20')](_0x3db18b,_0x5fba36,!![]);}catch(_0x1cd580){return BPromise[_0xdf07('0x21')](_0x1cd580);}return _0x3db18b[_0xdf07('0x22')]();};}function saveUpdates(_0x4aff49,_0x57277f){return function(_0xa4b949){if(_0xa4b949){return _0xa4b949['update'](_0x4aff49)[_0xdf07('0x23')](function(_0x1d8aeb){return _0x1d8aeb;});}return null;};}function removeEntity(_0x52cfc9,_0x5bb324){return function(_0x94356f){if(_0x94356f){return _0x94356f[_0xdf07('0x24')]()[_0xdf07('0x23')](function(){_0x52cfc9['status'](0xcc)[_0xdf07('0x19')]();});}};}function handleEntityNotFound(_0x1b930d,_0x2d4b84){return function(_0x150efd){if(!_0x150efd){_0x1b930d[_0xdf07('0x17')](0x194);}return _0x150efd;};}function handleError(_0x45dda3,_0x48f8c6){_0x48f8c6=_0x48f8c6||0x1f4;return function(_0x3e9fa2){logger[_0xdf07('0x25')](_0x3e9fa2['stack']);if(_0x3e9fa2[_0xdf07('0x26')]){delete _0x3e9fa2['name'];}_0x45dda3['status'](_0x48f8c6)[_0xdf07('0x27')](_0x3e9fa2);};}exports['index']=function(_0x153a6e,_0x34990a){var _0xea2a47={},_0x1fa37a={},_0x7e89b8={'count':0x0,'rows':[]};var _0x5bf3d7=_[_0xdf07('0x28')](db['Dynamics365Field'][_0xdf07('0x29')],function(_0x30baa4){return{'name':_0x30baa4['fieldName'],'type':_0x30baa4[_0xdf07('0x2a')]['key']};});_0x1fa37a[_0xdf07('0x2b')]=_[_0xdf07('0x28')](_0x5bf3d7,_0xdf07('0x26'));_0x1fa37a[_0xdf07('0x2c')]=_['keys'](_0x153a6e['query']);_0x1fa37a[_0xdf07('0x2d')]=_[_0xdf07('0x2e')](_0x1fa37a[_0xdf07('0x2b')],_0x1fa37a[_0xdf07('0x2c')]);_0xea2a47[_0xdf07('0x2f')]=_[_0xdf07('0x2e')](_0x1fa37a[_0xdf07('0x2b')],qs[_0xdf07('0x30')](_0x153a6e[_0xdf07('0x2c')]['fields']));_0xea2a47['attributes']=_0xea2a47[_0xdf07('0x2f')][_0xdf07('0x31')]?_0xea2a47[_0xdf07('0x2f')]:_0x1fa37a[_0xdf07('0x2b')];if(!_0x153a6e[_0xdf07('0x2c')]['hasOwnProperty'](_0xdf07('0x32'))){_0xea2a47[_0xdf07('0x1a')]=qs['limit'](_0x153a6e['query'][_0xdf07('0x1a')]);_0xea2a47[_0xdf07('0x1d')]=qs[_0xdf07('0x1d')](_0x153a6e[_0xdf07('0x2c')]['offset']);}_0xea2a47[_0xdf07('0x33')]=qs[_0xdf07('0x34')](_0x153a6e['query']['sort']);_0xea2a47[_0xdf07('0x35')]=qs['filters'](_[_0xdf07('0x36')](_0x153a6e[_0xdf07('0x2c')],_0x1fa37a[_0xdf07('0x2d')]),_0x5bf3d7);if(_0x153a6e[_0xdf07('0x2c')][_0xdf07('0x37')]){_0xea2a47[_0xdf07('0x35')]=_[_0xdf07('0x38')](_0xea2a47[_0xdf07('0x35')],{'$or':_['map'](_0x5bf3d7,function(_0x54dba8){if(_0x54dba8[_0xdf07('0x2a')]!==_0xdf07('0x39')){var _0x10f42c={};_0x10f42c[_0x54dba8[_0xdf07('0x26')]]={'$like':'%'+_0x153a6e[_0xdf07('0x2c')]['filter']+'%'};return _0x10f42c;}})});}_0xea2a47=_[_0xdf07('0x38')]({},_0xea2a47,_0x153a6e[_0xdf07('0x3a')]);var _0x1c88d8={'where':_0xea2a47[_0xdf07('0x35')]};return db[_0xdf07('0x3b')]['count'](_0x1c88d8)[_0xdf07('0x23')](function(_0x5080be){_0x7e89b8[_0xdf07('0x1c')]=_0x5080be;if(_0x153a6e[_0xdf07('0x2c')][_0xdf07('0x3c')]){_0xea2a47[_0xdf07('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xdf07('0x3e')](_0xea2a47);})[_0xdf07('0x23')](function(_0x285835){_0x7e89b8['rows']=_0x285835;return _0x7e89b8;})[_0xdf07('0x23')](respondWithFilteredResult(_0x34990a,_0xea2a47))[_0xdf07('0x3f')](handleError(_0x34990a,null));};exports[_0xdf07('0x40')]=function(_0x2eab61,_0x2fb912){var _0xe4dcfa={'raw':!![],'where':{'id':_0x2eab61[_0xdf07('0x41')]['id']}},_0x57b15e={};_0x57b15e['model']=_[_0xdf07('0x42')](db[_0xdf07('0x3b')][_0xdf07('0x29')]);_0x57b15e[_0xdf07('0x2c')]=_[_0xdf07('0x42')](_0x2eab61[_0xdf07('0x2c')]);_0x57b15e[_0xdf07('0x2d')]=_['intersection'](_0x57b15e['model'],_0x57b15e[_0xdf07('0x2c')]);_0xe4dcfa[_0xdf07('0x2f')]=_[_0xdf07('0x2e')](_0x57b15e[_0xdf07('0x2b')],qs[_0xdf07('0x30')](_0x2eab61['query'][_0xdf07('0x30')]));_0xe4dcfa[_0xdf07('0x2f')]=_0xe4dcfa['attributes']['length']?_0xe4dcfa[_0xdf07('0x2f')]:_0x57b15e['model'];if(_0x2eab61[_0xdf07('0x2c')][_0xdf07('0x3c')]){_0xe4dcfa[_0xdf07('0x3d')]=[{'all':!![]}];}_0xe4dcfa=_[_0xdf07('0x38')]({},_0xe4dcfa,_0x2eab61[_0xdf07('0x3a')]);return db[_0xdf07('0x3b')][_0xdf07('0x43')](_0xe4dcfa)['then'](handleEntityNotFound(_0x2fb912,null))[_0xdf07('0x23')](respondWithResult(_0x2fb912,null))['catch'](handleError(_0x2fb912,null));};exports[_0xdf07('0x44')]=function(_0x526427,_0xd5a433){return db['Dynamics365Field'][_0xdf07('0x44')](_0x526427[_0xdf07('0x45')],{})['then'](respondWithResult(_0xd5a433,0xc9))[_0xdf07('0x3f')](handleError(_0xd5a433,null));};exports[_0xdf07('0x46')]=function(_0x271fbe,_0x5ddb9d){if(_0x271fbe[_0xdf07('0x45')]['id']){delete _0x271fbe[_0xdf07('0x45')]['id'];}return db[_0xdf07('0x3b')]['find']({'where':{'id':_0x271fbe[_0xdf07('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ddb9d,null))[_0xdf07('0x23')](saveUpdates(_0x271fbe[_0xdf07('0x45')],null))[_0xdf07('0x23')](respondWithResult(_0x5ddb9d,null))['catch'](handleError(_0x5ddb9d,null));};exports[_0xdf07('0x24')]=function(_0xe25d59,_0x37a485){return db['Dynamics365Field'][_0xdf07('0x43')]({'where':{'id':_0xe25d59[_0xdf07('0x41')]['id']}})[_0xdf07('0x23')](handleEntityNotFound(_0x37a485,null))[_0xdf07('0x23')](removeEntity(_0x37a485,null))[_0xdf07('0x3f')](handleError(_0x37a485,null));}; \ No newline at end of file +var _0xd131=['json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','Dynamics365Field','findAll','show','params','include','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2e700a,_0x5585a2){var _0x31e0f8=function(_0x4a1187){while(--_0x4a1187){_0x2e700a['push'](_0x2e700a['shift']());}};_0x31e0f8(++_0x5585a2);}(_0xd131,0x15a));var _0x1d13=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd131[_0xb6e2ea];return _0x2a57bb;};'use strict';var emlformat=require(_0x1d13('0x0'));var rimraf=require(_0x1d13('0x1'));var zipdir=require(_0x1d13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d13('0x3'));var BPromise=require(_0x1d13('0x4'));var Mustache=require('mustache');var util=require(_0x1d13('0x5'));var path=require(_0x1d13('0x6'));var sox=require(_0x1d13('0x7'));var csv=require(_0x1d13('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d13('0x9'));var _=require(_0x1d13('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1d13('0xb'));var deskjs=require(_0x1d13('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d13('0xd'));var Redis=require(_0x1d13('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1d13('0xf'));var as=require(_0x1d13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d13('0x11'))(_0x1d13('0x12'));var utils=require(_0x1d13('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1d13('0x14'));var db=require(_0x1d13('0x15'))['db'];function respondWithStatusCode(_0x3c16bf,_0x2d1987){_0x2d1987=_0x2d1987||0xcc;return function(_0x1f9022){if(_0x1f9022){return _0x3c16bf[_0x1d13('0x16')](_0x2d1987);}return _0x3c16bf[_0x1d13('0x17')](_0x2d1987)['end']();};}function respondWithResult(_0x104743,_0x26e34f){_0x26e34f=_0x26e34f||0xc8;return function(_0x3ca241){if(_0x3ca241){return _0x104743[_0x1d13('0x17')](_0x26e34f)[_0x1d13('0x18')](_0x3ca241);}};}function respondWithFilteredResult(_0x558c78,_0x2bae03){return function(_0xb26453){if(_0xb26453){var _0xb34f7d=typeof _0x2bae03['offset']==='undefined'&&typeof _0x2bae03['limit']===_0x1d13('0x19');var _0x312b72=_0xb26453[_0x1d13('0x1a')];var _0x2602a2=_0xb34f7d?0x0:_0x2bae03[_0x1d13('0x1b')];var _0xf3c1af=_0xb34f7d?_0xb26453['count']:_0x2bae03[_0x1d13('0x1b')]+_0x2bae03[_0x1d13('0x1c')];var _0x3aad01;if(_0xf3c1af>=_0x312b72){_0xf3c1af=_0x312b72;_0x3aad01=0xc8;}else{_0x3aad01=0xce;}_0x558c78[_0x1d13('0x17')](_0x3aad01);return _0x558c78[_0x1d13('0x1d')]('Content-Range',_0x2602a2+'-'+_0xf3c1af+'/'+_0x312b72)[_0x1d13('0x18')](_0xb26453);}return null;};}function patchUpdates(_0xdef15c){return function(_0x4c626a){try{jsonpatch[_0x1d13('0x1e')](_0x4c626a,_0xdef15c,!![]);}catch(_0x1718ac){return BPromise[_0x1d13('0x1f')](_0x1718ac);}return _0x4c626a[_0x1d13('0x20')]();};}function saveUpdates(_0x5c8adf,_0x3d874f){return function(_0xe1c12f){if(_0xe1c12f){return _0xe1c12f['update'](_0x5c8adf)[_0x1d13('0x21')](function(_0x175f75){return _0x175f75;});}return null;};}function removeEntity(_0x22a28d,_0x311722){return function(_0x332dfe){if(_0x332dfe){return _0x332dfe[_0x1d13('0x22')]()[_0x1d13('0x21')](function(){_0x22a28d[_0x1d13('0x17')](0xcc)[_0x1d13('0x23')]();});}};}function handleEntityNotFound(_0x5878b7,_0xe9d5e){return function(_0x44ab40){if(!_0x44ab40){_0x5878b7[_0x1d13('0x16')](0x194);}return _0x44ab40;};}function handleError(_0x34d885,_0x4995ed){_0x4995ed=_0x4995ed||0x1f4;return function(_0x55889c){logger[_0x1d13('0x24')](_0x55889c[_0x1d13('0x25')]);if(_0x55889c['name']){delete _0x55889c[_0x1d13('0x26')];}_0x34d885[_0x1d13('0x17')](_0x4995ed)[_0x1d13('0x27')](_0x55889c);};}exports[_0x1d13('0x28')]=function(_0x60a631,_0xa51865){var _0x3cf2e6={},_0x4d2048={},_0x38b5b0={'count':0x0,'rows':[]};var _0x76c4e8=_[_0x1d13('0x29')](db['Dynamics365Field'][_0x1d13('0x2a')],function(_0x296b7e){return{'name':_0x296b7e[_0x1d13('0x2b')],'type':_0x296b7e[_0x1d13('0x2c')][_0x1d13('0x2d')]};});_0x4d2048['model']=_['map'](_0x76c4e8,_0x1d13('0x26'));_0x4d2048['query']=_[_0x1d13('0x2e')](_0x60a631['query']);_0x4d2048[_0x1d13('0x2f')]=_['intersection'](_0x4d2048['model'],_0x4d2048[_0x1d13('0x30')]);_0x3cf2e6['attributes']=_[_0x1d13('0x31')](_0x4d2048[_0x1d13('0x32')],qs[_0x1d13('0x33')](_0x60a631['query']['fields']));_0x3cf2e6[_0x1d13('0x34')]=_0x3cf2e6['attributes'][_0x1d13('0x35')]?_0x3cf2e6[_0x1d13('0x34')]:_0x4d2048[_0x1d13('0x32')];if(!_0x60a631[_0x1d13('0x30')][_0x1d13('0x36')]('nolimit')){_0x3cf2e6[_0x1d13('0x1c')]=qs['limit'](_0x60a631[_0x1d13('0x30')][_0x1d13('0x1c')]);_0x3cf2e6['offset']=qs[_0x1d13('0x1b')](_0x60a631[_0x1d13('0x30')]['offset']);}_0x3cf2e6[_0x1d13('0x37')]=qs[_0x1d13('0x38')](_0x60a631['query'][_0x1d13('0x38')]);_0x3cf2e6[_0x1d13('0x39')]=qs[_0x1d13('0x2f')](_[_0x1d13('0x3a')](_0x60a631[_0x1d13('0x30')],_0x4d2048[_0x1d13('0x2f')]),_0x76c4e8);if(_0x60a631[_0x1d13('0x30')][_0x1d13('0x3b')]){_0x3cf2e6[_0x1d13('0x39')]=_[_0x1d13('0x3c')](_0x3cf2e6[_0x1d13('0x39')],{'$or':_[_0x1d13('0x29')](_0x76c4e8,function(_0x57c4cb){if(_0x57c4cb['type']!==_0x1d13('0x3d')){var _0x3d966c={};_0x3d966c[_0x57c4cb[_0x1d13('0x26')]]={'$like':'%'+_0x60a631[_0x1d13('0x30')][_0x1d13('0x3b')]+'%'};return _0x3d966c;}})});}_0x3cf2e6=_[_0x1d13('0x3c')]({},_0x3cf2e6,_0x60a631['options']);var _0xd9cc93={'where':_0x3cf2e6[_0x1d13('0x39')]};return db['Dynamics365Field'][_0x1d13('0x1a')](_0xd9cc93)[_0x1d13('0x21')](function(_0x13bfcb){_0x38b5b0[_0x1d13('0x1a')]=_0x13bfcb;if(_0x60a631[_0x1d13('0x30')][_0x1d13('0x3e')]){_0x3cf2e6['include']=[{'all':!![]}];}return db[_0x1d13('0x3f')][_0x1d13('0x40')](_0x3cf2e6);})[_0x1d13('0x21')](function(_0x3a1ef9){_0x38b5b0['rows']=_0x3a1ef9;return _0x38b5b0;})[_0x1d13('0x21')](respondWithFilteredResult(_0xa51865,_0x3cf2e6))['catch'](handleError(_0xa51865,null));};exports[_0x1d13('0x41')]=function(_0x46e480,_0x395d0c){var _0x72c548={'raw':!![],'where':{'id':_0x46e480[_0x1d13('0x42')]['id']}},_0x36a1f9={};_0x36a1f9[_0x1d13('0x32')]=_[_0x1d13('0x2e')](db[_0x1d13('0x3f')]['rawAttributes']);_0x36a1f9[_0x1d13('0x30')]=_[_0x1d13('0x2e')](_0x46e480[_0x1d13('0x30')]);_0x36a1f9['filters']=_[_0x1d13('0x31')](_0x36a1f9['model'],_0x36a1f9[_0x1d13('0x30')]);_0x72c548[_0x1d13('0x34')]=_[_0x1d13('0x31')](_0x36a1f9['model'],qs[_0x1d13('0x33')](_0x46e480[_0x1d13('0x30')][_0x1d13('0x33')]));_0x72c548[_0x1d13('0x34')]=_0x72c548[_0x1d13('0x34')][_0x1d13('0x35')]?_0x72c548[_0x1d13('0x34')]:_0x36a1f9[_0x1d13('0x32')];if(_0x46e480[_0x1d13('0x30')][_0x1d13('0x3e')]){_0x72c548[_0x1d13('0x43')]=[{'all':!![]}];}_0x72c548=_[_0x1d13('0x3c')]({},_0x72c548,_0x46e480[_0x1d13('0x44')]);return db[_0x1d13('0x3f')][_0x1d13('0x45')](_0x72c548)[_0x1d13('0x21')](handleEntityNotFound(_0x395d0c,null))['then'](respondWithResult(_0x395d0c,null))[_0x1d13('0x46')](handleError(_0x395d0c,null));};exports[_0x1d13('0x47')]=function(_0x3366de,_0x20a138){return db[_0x1d13('0x3f')][_0x1d13('0x47')](_0x3366de[_0x1d13('0x48')],{})[_0x1d13('0x21')](respondWithResult(_0x20a138,0xc9))[_0x1d13('0x46')](handleError(_0x20a138,null));};exports[_0x1d13('0x49')]=function(_0x25bf3b,_0x1bb600){if(_0x25bf3b[_0x1d13('0x48')]['id']){delete _0x25bf3b['body']['id'];}return db['Dynamics365Field'][_0x1d13('0x45')]({'where':{'id':_0x25bf3b[_0x1d13('0x42')]['id']}})[_0x1d13('0x21')](handleEntityNotFound(_0x1bb600,null))['then'](saveUpdates(_0x25bf3b[_0x1d13('0x48')],null))['then'](respondWithResult(_0x1bb600,null))[_0x1d13('0x46')](handleError(_0x1bb600,null));};exports['destroy']=function(_0x5a98df,_0x3f12b3){return db[_0x1d13('0x3f')][_0x1d13('0x45')]({'where':{'id':_0x5a98df[_0x1d13('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f12b3,null))[_0x1d13('0x21')](removeEntity(_0x3f12b3,null))[_0x1d13('0x46')](handleError(_0x3f12b3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d471a05..11d539f 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 _0x2abc=['api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x19a86f,_0x99163c){var _0x5eb911=function(_0x588076){while(--_0x588076){_0x19a86f['push'](_0x19a86f['shift']());}};_0x5eb911(++_0x99163c);}(_0x2abc,0x1a1));var _0xc2ab=function(_0x4d2a0e,_0x394ac4){_0x4d2a0e=_0x4d2a0e-0x0;var _0x363cb6=_0x2abc[_0x4d2a0e];return _0x363cb6;};'use strict';var _=require(_0xc2ab('0x0'));var util=require(_0xc2ab('0x1'));var logger=require(_0xc2ab('0x2'))(_0xc2ab('0x3'));var moment=require(_0xc2ab('0x4'));var BPromise=require(_0xc2ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2ab('0x6'));var rimraf=require(_0xc2ab('0x7'));var config=require(_0xc2ab('0x8'));var attributes=require(_0xc2ab('0x9'));module['exports']=function(_0x551f87,_0x4feaf2){return _0x551f87[_0xc2ab('0xa')](_0xc2ab('0xb'),attributes,{'tableName':_0xc2ab('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xc2ab('0xd'),_0xc2ab('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','bluebird'];(function(_0x101b9a,_0x3bf5e2){var _0x2c1453=function(_0x3cc722){while(--_0x3cc722){_0x101b9a['push'](_0x101b9a['shift']());}};_0x2c1453(++_0x3bf5e2);}(_0xab40,0x6c));var _0x0ab4=function(_0x39947b,_0x3d690b){_0x39947b=_0x39947b-0x0;var _0x1b3a24=_0xab40[_0x39947b];return _0x1b3a24;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ab4('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ab4('0x2'));var config=require('../../config/environment');var attributes=require(_0x0ab4('0x3'));module[_0x0ab4('0x4')]=function(_0x2cba19,_0x18fa3a){return _0x2cba19[_0x0ab4('0x5')](_0x0ab4('0x6'),attributes,{'tableName':_0x0ab4('0x7'),'paranoid':![],'indexes':[{'name':_0x0ab4('0x8'),'fields':[_0x0ab4('0x9'),_0x0ab4('0xa')],'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 fedc43a..850c66d 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 _0xab8e=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1e8c4e,_0x4b6ba5){var _0x19088a=function(_0x33116a){while(--_0x33116a){_0x1e8c4e['push'](_0x1e8c4e['shift']());}};_0x19088a(++_0x4b6ba5);}(_0xab8e,0xcb));var _0xeab8=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xab8e[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xeab8('0x0'));var util=require(_0xeab8('0x1'));var moment=require('moment');var BPromise=require(_0xeab8('0x2'));var rs=require(_0xeab8('0x3'));var fs=require('fs');var Redis=require(_0xeab8('0x4'));var db=require(_0xeab8('0x5'))['db'];var utils=require(_0xeab8('0x6'));var logger=require(_0xeab8('0x7'))(_0xeab8('0x8'));var config=require('../../config/environment');var jayson=require(_0xeab8('0x9'));var client=jayson[_0xeab8('0xa')][_0xeab8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1771ff,_0x442ada,_0x126c9a){return new BPromise(function(_0x109356,_0x20b249){return client[_0xeab8('0xc')](_0x1771ff,_0x126c9a)[_0xeab8('0xd')](function(_0x2aad2f){logger[_0xeab8('0xe')](_0xeab8('0xf'),_0x442ada,_0xeab8('0x10'));logger[_0xeab8('0x11')](_0xeab8('0x12'),_0x442ada,_0xeab8('0x10'),JSON[_0xeab8('0x13')](_0x2aad2f));if(_0x2aad2f[_0xeab8('0x14')]){if(_0x2aad2f[_0xeab8('0x14')][_0xeab8('0x15')]===0x1f4){logger['error'](_0xeab8('0xf'),_0x442ada,_0x2aad2f[_0xeab8('0x14')][_0xeab8('0x16')]);return _0x20b249(_0x2aad2f[_0xeab8('0x14')][_0xeab8('0x16')]);}logger[_0xeab8('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x442ada,_0x2aad2f[_0xeab8('0x14')]['message']);return _0x109356(_0x2aad2f[_0xeab8('0x14')][_0xeab8('0x16')]);}else{logger[_0xeab8('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x442ada,_0xeab8('0x10'));_0x109356(_0x2aad2f[_0xeab8('0x17')][_0xeab8('0x16')]);}})['catch'](function(_0x3a662a){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x442ada,_0x3a662a);_0x20b249(_0x3a662a);});});} \ No newline at end of file +var _0x8c1e=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0x5593aa,_0x2b9791){var _0x30d201=function(_0x5580bc){while(--_0x5580bc){_0x5593aa['push'](_0x5593aa['shift']());}};_0x30d201(++_0x2b9791);}(_0x8c1e,0xde));var _0xe8c1=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x8c1e[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0xe8c1('0x0'));var util=require('util');var moment=require(_0xe8c1('0x1'));var BPromise=require(_0xe8c1('0x2'));var rs=require(_0xe8c1('0x3'));var fs=require('fs');var Redis=require(_0xe8c1('0x4'));var db=require(_0xe8c1('0x5'))['db'];var utils=require(_0xe8c1('0x6'));var logger=require('../../config/logger')(_0xe8c1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe8c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7826a,_0x2b562b,_0x573677){return new BPromise(function(_0x45cf47,_0x2b5d54){return client[_0xe8c1('0x9')](_0x7826a,_0x573677)[_0xe8c1('0xa')](function(_0x45ce17){logger[_0xe8c1('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2b562b,_0xe8c1('0xc'));logger[_0xe8c1('0xd')](_0xe8c1('0xe'),_0x2b562b,_0xe8c1('0xc'),JSON['stringify'](_0x45ce17));if(_0x45ce17[_0xe8c1('0xf')]){if(_0x45ce17[_0xe8c1('0xf')][_0xe8c1('0x10')]===0x1f4){logger['error'](_0xe8c1('0x11'),_0x2b562b,_0x45ce17['error'][_0xe8c1('0x12')]);return _0x2b5d54(_0x45ce17[_0xe8c1('0xf')][_0xe8c1('0x12')]);}logger[_0xe8c1('0xf')](_0xe8c1('0x11'),_0x2b562b,_0x45ce17[_0xe8c1('0xf')][_0xe8c1('0x12')]);return _0x45cf47(_0x45ce17[_0xe8c1('0xf')]['message']);}else{logger[_0xe8c1('0xb')](_0xe8c1('0x11'),_0x2b562b,'request\x20sent');_0x45cf47(_0x45ce17[_0xe8c1('0x13')][_0xe8c1('0x12')]);}})['catch'](function(_0x584b48){logger['error'](_0xe8c1('0x11'),_0x2b562b,_0x584b48);_0x2b5d54(_0x584b48);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 00f8fea..f8387c2 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 _0x7168=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id'];(function(_0x206455,_0x326169){var _0x346f8b=function(_0x57075d){while(--_0x57075d){_0x206455['push'](_0x206455['shift']());}};_0x346f8b(++_0x326169);}(_0x7168,0x194));var _0x8716=function(_0x203682,_0x1e8073){_0x203682=_0x203682-0x0;var _0x22a7fc=_0x7168[_0x203682];return _0x22a7fc;};'use strict';var multer=require('multer');var util=require(_0x8716('0x0'));var path=require('path');var timeout=require(_0x8716('0x1'));var express=require(_0x8716('0x2'));var router=express['Router']();var fs_extra=require(_0x8716('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8716('0x4'));var controller=require(_0x8716('0x5'));router['get']('/',auth[_0x8716('0x6')](),controller[_0x8716('0x7')]);router[_0x8716('0x8')](_0x8716('0x9'),auth[_0x8716('0x6')](),controller[_0x8716('0xa')]);router[_0x8716('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8716('0xb')]);router[_0x8716('0x8')](_0x8716('0xc'),auth[_0x8716('0x6')](),controller[_0x8716('0xd')]);router[_0x8716('0xe')]('/',auth[_0x8716('0x6')](),controller[_0x8716('0xf')]);router[_0x8716('0xe')](_0x8716('0x10'),auth['isAuthenticated'](),controller[_0x8716('0x11')]);router[_0x8716('0x12')](_0x8716('0x9'),auth['isAuthenticated'](),controller[_0x8716('0x13')]);router[_0x8716('0x14')]('/:id',auth[_0x8716('0x6')](),controller[_0x8716('0x15')]);module[_0x8716('0x16')]=router; \ No newline at end of file +var _0x035d=['/:id/fields','getFields','/:id/configurations','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations'];(function(_0x3f1d63,_0x1fbfa){var _0x2311d7=function(_0xf7e5f8){while(--_0xf7e5f8){_0x3f1d63['push'](_0x3f1d63['shift']());}};_0x2311d7(++_0x1fbfa);}(_0x035d,0x192));var _0xd035=function(_0x3dc155,_0x4c9429){_0x3dc155=_0x3dc155-0x0;var _0x25613b=_0x035d[_0x3dc155];return _0x25613b;};'use strict';var multer=require(_0xd035('0x0'));var util=require('util');var path=require(_0xd035('0x1'));var timeout=require(_0xd035('0x2'));var express=require(_0xd035('0x3'));var router=express[_0xd035('0x4')]();var fs_extra=require(_0xd035('0x5'));var auth=require(_0xd035('0x6'));var interaction=require(_0xd035('0x7'));var config=require(_0xd035('0x8'));var controller=require(_0xd035('0x9'));router[_0xd035('0xa')]('/',auth['isAuthenticated'](),controller[_0xd035('0xb')]);router['get'](_0xd035('0xc'),auth[_0xd035('0xd')](),controller[_0xd035('0xe')]);router['get']('/:id/configurations',auth[_0xd035('0xd')](),controller[_0xd035('0xf')]);router[_0xd035('0xa')](_0xd035('0x10'),auth[_0xd035('0xd')](),controller[_0xd035('0x11')]);router['post']('/',auth[_0xd035('0xd')](),controller['create']);router['post'](_0xd035('0x12'),auth[_0xd035('0xd')](),controller['addConfiguration']);router['put'](_0xd035('0xc'),auth[_0xd035('0xd')](),controller[_0xd035('0x13')]);router[_0xd035('0x14')](_0xd035('0xc'),auth[_0xd035('0xd')](),controller[_0xd035('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 47931a7..515e706 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 _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0xda9247,_0x59ca79){var _0x2dc126=function(_0xf974a1){while(--_0xf974a1){_0xda9247['push'](_0xda9247['shift']());}};_0x2dc126(++_0x59ca79);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2032=['remoteUri','exports','STRING','username'];(function(_0x446ab2,_0x4206de){var _0x597d84=function(_0x4cb110){while(--_0x4cb110){_0x446ab2['push'](_0x446ab2['shift']());}};_0x597d84(++_0x4206de);}(_0x2032,0xd9));var _0x2203=function(_0x1c6260,_0xea4f11){_0x1c6260=_0x1c6260-0x0;var _0x4c0d9a=_0x2032[_0x1c6260];return _0x4c0d9a;};'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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3f22cc3..5688af5 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 _0x4627=['findOne','FreshdeskConfiguration','fields','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','getFields','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','status','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','then','show','params','includeAll','include','catch','create','body','getConfigurations'];(function(_0x19edb7,_0x5cfb59){var _0x4cc6f8=function(_0x2fcef6){while(--_0x2fcef6){_0x19edb7['push'](_0x19edb7['shift']());}};_0x4cc6f8(++_0x5cfb59);}(_0x4627,0x115));var _0x7462=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x4627[_0x56fe98];return _0x212f4f;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];var integrations=require(_0x7462('0x1d'));function respondWithStatusCode(_0x4e313a,_0x5cb363){_0x5cb363=_0x5cb363||0xcc;return function(_0x4e6e42){if(_0x4e6e42){return _0x4e313a[_0x7462('0x1e')](_0x5cb363);}return _0x4e313a['status'](_0x5cb363)[_0x7462('0x1f')]();};}function respondWithResult(_0x461bd2,_0x368f45){_0x368f45=_0x368f45||0xc8;return function(_0x1ac398){if(_0x1ac398){return _0x461bd2['status'](_0x368f45)[_0x7462('0x20')](_0x1ac398);}};}function respondWithFilteredResult(_0x4913ff,_0x36b008){return function(_0x42ed50){if(_0x42ed50){var _0x1ebbe8=typeof _0x36b008[_0x7462('0x21')]==='undefined'&&typeof _0x36b008[_0x7462('0x22')]==='undefined';var _0x2f0201=_0x42ed50[_0x7462('0x23')];var _0xca0bdf=_0x1ebbe8?0x0:_0x36b008[_0x7462('0x21')];var _0x49378e=_0x1ebbe8?_0x42ed50[_0x7462('0x23')]:_0x36b008['offset']+_0x36b008[_0x7462('0x22')];var _0x3e5596;if(_0x49378e>=_0x2f0201){_0x49378e=_0x2f0201;_0x3e5596=0xc8;}else{_0x3e5596=0xce;}_0x4913ff['status'](_0x3e5596);return _0x4913ff[_0x7462('0x24')](_0x7462('0x25'),_0xca0bdf+'-'+_0x49378e+'/'+_0x2f0201)['json'](_0x42ed50);}return null;};}function patchUpdates(_0x25a44a){return function(_0x33c605){try{jsonpatch[_0x7462('0x26')](_0x33c605,_0x25a44a,!![]);}catch(_0xac7eae){return BPromise[_0x7462('0x27')](_0xac7eae);}return _0x33c605[_0x7462('0x28')]();};}function saveUpdates(_0x32da06,_0x3c9616){return function(_0x556c0a){if(_0x556c0a){return _0x556c0a[_0x7462('0x29')](_0x32da06)['then'](function(_0x185934){return _0x185934;});}return null;};}function removeEntity(_0x11caf5,_0x290715){return function(_0x51b9fc){if(_0x51b9fc){return _0x51b9fc[_0x7462('0x2a')]()['then'](function(){_0x11caf5[_0x7462('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5759fa,_0x29992b){return function(_0x3a6cab){if(!_0x3a6cab){_0x5759fa['sendStatus'](0x194);}return _0x3a6cab;};}function handleError(_0x5575fc,_0x554d21){_0x554d21=_0x554d21||0x1f4;return function(_0x488d59){logger['error'](_0x488d59[_0x7462('0x2c')]);if(_0x488d59[_0x7462('0x2d')]){delete _0x488d59['name'];}_0x5575fc[_0x7462('0x2b')](_0x554d21)[_0x7462('0x2e')](_0x488d59);};}exports[_0x7462('0x2f')]=function(_0x10a673,_0x4948c9){var _0x1f279b={},_0x3523c={},_0x30cb61={'count':0x0,'rows':[]};var _0x288736=_[_0x7462('0x30')](db[_0x7462('0x31')][_0x7462('0x32')],function(_0x77cf43){return{'name':_0x77cf43[_0x7462('0x33')],'type':_0x77cf43[_0x7462('0x34')]['key']};});_0x3523c[_0x7462('0x35')]=_['map'](_0x288736,_0x7462('0x2d'));_0x3523c[_0x7462('0x36')]=_[_0x7462('0x37')](_0x10a673[_0x7462('0x36')]);_0x3523c['filters']=_[_0x7462('0x38')](_0x3523c[_0x7462('0x35')],_0x3523c[_0x7462('0x36')]);_0x1f279b[_0x7462('0x39')]=_[_0x7462('0x38')](_0x3523c[_0x7462('0x35')],qs['fields'](_0x10a673[_0x7462('0x36')]['fields']));_0x1f279b[_0x7462('0x39')]=_0x1f279b['attributes'][_0x7462('0x3a')]?_0x1f279b[_0x7462('0x39')]:_0x3523c['model'];if(!_0x10a673[_0x7462('0x36')][_0x7462('0x3b')](_0x7462('0x3c'))){_0x1f279b[_0x7462('0x22')]=qs[_0x7462('0x22')](_0x10a673[_0x7462('0x36')][_0x7462('0x22')]);_0x1f279b[_0x7462('0x21')]=qs[_0x7462('0x21')](_0x10a673[_0x7462('0x36')][_0x7462('0x21')]);}_0x1f279b[_0x7462('0x3d')]=qs[_0x7462('0x3e')](_0x10a673[_0x7462('0x36')]['sort']);_0x1f279b[_0x7462('0x3f')]=qs[_0x7462('0x40')](_[_0x7462('0x41')](_0x10a673[_0x7462('0x36')],_0x3523c['filters']),_0x288736);if(_0x10a673[_0x7462('0x36')][_0x7462('0x42')]){_0x1f279b[_0x7462('0x3f')]=_[_0x7462('0x43')](_0x1f279b[_0x7462('0x3f')],{'$or':_[_0x7462('0x30')](_0x288736,function(_0x5c46c8){if(_0x5c46c8[_0x7462('0x34')]!==_0x7462('0x44')){var _0x2f50c1={};_0x2f50c1[_0x5c46c8[_0x7462('0x2d')]]={'$like':'%'+_0x10a673['query'][_0x7462('0x42')]+'%'};return _0x2f50c1;}})});}_0x1f279b=_[_0x7462('0x43')]({},_0x1f279b,_0x10a673[_0x7462('0x45')]);var _0x4ecd45={'where':_0x1f279b[_0x7462('0x3f')]};return db[_0x7462('0x31')][_0x7462('0x23')](_0x4ecd45)['then'](function(_0x1b4059){_0x30cb61['count']=_0x1b4059;if(_0x10a673[_0x7462('0x36')]['includeAll']){_0x1f279b['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7462('0x46')](_0x1f279b);})[_0x7462('0x47')](function(_0x2317eb){_0x30cb61['rows']=_0x2317eb;return _0x30cb61;})['then'](respondWithFilteredResult(_0x4948c9,_0x1f279b))['catch'](handleError(_0x4948c9,null));};exports[_0x7462('0x48')]=function(_0x8aa7cd,_0x57e0ae){var _0x5e50c7={'raw':![],'where':{'id':_0x8aa7cd[_0x7462('0x49')]['id']}},_0x20c576={};_0x20c576[_0x7462('0x35')]=_[_0x7462('0x37')](db['FreshdeskAccount']['rawAttributes']);_0x20c576[_0x7462('0x36')]=_[_0x7462('0x37')](_0x8aa7cd[_0x7462('0x36')]);_0x20c576[_0x7462('0x40')]=_['intersection'](_0x20c576[_0x7462('0x35')],_0x20c576[_0x7462('0x36')]);_0x5e50c7[_0x7462('0x39')]=_['intersection'](_0x20c576[_0x7462('0x35')],qs['fields'](_0x8aa7cd[_0x7462('0x36')]['fields']));_0x5e50c7['attributes']=_0x5e50c7[_0x7462('0x39')][_0x7462('0x3a')]?_0x5e50c7[_0x7462('0x39')]:_0x20c576[_0x7462('0x35')];if(_0x8aa7cd[_0x7462('0x36')][_0x7462('0x4a')]){_0x5e50c7[_0x7462('0x4b')]=[{'all':!![]}];}_0x5e50c7=_[_0x7462('0x43')]({},_0x5e50c7,_0x8aa7cd[_0x7462('0x45')]);return db['FreshdeskAccount']['find'](_0x5e50c7)[_0x7462('0x47')](handleEntityNotFound(_0x57e0ae,null))['then'](respondWithResult(_0x57e0ae,null))[_0x7462('0x4c')](handleError(_0x57e0ae,null));};exports['create']=function(_0x331459,_0x2cec83){return db[_0x7462('0x31')][_0x7462('0x4d')](_0x331459[_0x7462('0x4e')],{})['then'](respondWithResult(_0x2cec83,0xc9))['catch'](handleError(_0x2cec83,null));};exports[_0x7462('0x29')]=function(_0x37fc97,_0x354e81){if(_0x37fc97[_0x7462('0x4e')]['id']){delete _0x37fc97[_0x7462('0x4e')]['id'];}return db[_0x7462('0x31')]['find']({'where':{'id':_0x37fc97[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x354e81,null))[_0x7462('0x47')](saveUpdates(_0x37fc97[_0x7462('0x4e')],null))['then'](respondWithResult(_0x354e81,null))[_0x7462('0x4c')](handleError(_0x354e81,null));};exports[_0x7462('0x2a')]=function(_0x4429da,_0x4a631e){return db[_0x7462('0x31')]['find']({'where':{'id':_0x4429da[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x4a631e,null))['then'](removeEntity(_0x4a631e,null))['catch'](handleError(_0x4a631e,null));};exports[_0x7462('0x4f')]=function(_0x3c82fa,_0x3da9ce,_0x3aa514){var _0x664d7a={};var _0x5cd5cc={};var _0x45447b;var _0x5862a9;return db[_0x7462('0x31')][_0x7462('0x50')]({'where':{'id':_0x3c82fa[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x3da9ce,null))[_0x7462('0x47')](function(_0x76d533){if(_0x76d533){_0x45447b=_0x76d533;_0x5cd5cc[_0x7462('0x35')]=_[_0x7462('0x37')](db[_0x7462('0x51')][_0x7462('0x32')]);_0x5cd5cc['query']=_[_0x7462('0x37')](_0x3c82fa[_0x7462('0x36')]);_0x5cd5cc[_0x7462('0x40')]=_[_0x7462('0x38')](_0x5cd5cc['model'],_0x5cd5cc[_0x7462('0x36')]);_0x664d7a[_0x7462('0x39')]=_[_0x7462('0x38')](_0x5cd5cc[_0x7462('0x35')],qs['fields'](_0x3c82fa[_0x7462('0x36')][_0x7462('0x52')]));_0x664d7a[_0x7462('0x39')]=_0x664d7a[_0x7462('0x39')][_0x7462('0x3a')]?_0x664d7a[_0x7462('0x39')]:_0x5cd5cc[_0x7462('0x35')];_0x664d7a['order']=qs[_0x7462('0x3e')](_0x3c82fa[_0x7462('0x36')]['sort']);_0x664d7a[_0x7462('0x3f')]=qs[_0x7462('0x40')](_[_0x7462('0x41')](_0x3c82fa[_0x7462('0x36')],_0x5cd5cc['filters']));if(_0x3c82fa['query'][_0x7462('0x42')]){_0x664d7a[_0x7462('0x3f')]=_[_0x7462('0x43')](_0x664d7a['where'],{'$or':_[_0x7462('0x30')](_0x664d7a[_0x7462('0x39')],function(_0x2cca57){var _0x30e5e6={};_0x30e5e6[_0x2cca57]={'$like':'%'+_0x3c82fa['query'][_0x7462('0x42')]+'%'};return _0x30e5e6;})});}_0x664d7a=_[_0x7462('0x43')]({},_0x664d7a,_0x3c82fa[_0x7462('0x45')]);return _0x45447b['getConfigurations'](_0x664d7a);}})[_0x7462('0x47')](function(_0x27240d){if(_0x27240d){_0x5862a9=_0x27240d[_0x7462('0x3a')];if(!_0x3c82fa[_0x7462('0x36')]['hasOwnProperty'](_0x7462('0x3c'))){_0x664d7a['limit']=qs[_0x7462('0x22')](_0x3c82fa[_0x7462('0x36')]['limit']);_0x664d7a[_0x7462('0x21')]=qs['offset'](_0x3c82fa[_0x7462('0x36')][_0x7462('0x21')]);}return _0x45447b['getConfigurations'](_0x664d7a);}})[_0x7462('0x47')](function(_0x97d91a){if(_0x97d91a){return _0x97d91a?{'count':_0x5862a9,'rows':_0x97d91a}:null;}})[_0x7462('0x47')](respondWithResult(_0x3da9ce,null))[_0x7462('0x4c')](handleError(_0x3da9ce,null));};exports[_0x7462('0x53')]=function(_0x4b4215,_0x2828e9,_0x4c30f0){if(_0x4b4215[_0x7462('0x4e')]['id']){delete _0x4b4215[_0x7462('0x4e')]['id'];}return db[_0x7462('0x31')][_0x7462('0x50')]({'where':{'id':_0x4b4215[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x2828e9,null))[_0x7462('0x47')](function(_0xcb38cd){if(_0xcb38cd){_0x4b4215['body'][_0x7462('0x54')]=_0xcb38cd['id'];_0x4b4215['body'][_0x7462('0x55')]=integrations['getSubjects'](_0x4b4215[_0x7462('0x4e')][_0x7462('0x56')],_0x4b4215[_0x7462('0x4e')][_0x7462('0x34')]);_0x4b4215[_0x7462('0x4e')][_0x7462('0x57')]=integrations[_0x7462('0x58')](_0x4b4215['body'][_0x7462('0x56')],_0x4b4215['body'][_0x7462('0x34')]);return db[_0x7462('0x51')][_0x7462('0x4d')](_0x4b4215[_0x7462('0x4e')],{'include':[{'model':db['FreshdeskField'],'as':_0x7462('0x55')},{'model':db['FreshdeskField'],'as':_0x7462('0x57')}]});}return null;})[_0x7462('0x47')](respondWithResult(_0x2828e9,null))['catch'](handleError(_0x2828e9,null));};exports[_0x7462('0x59')]=function(_0x5bd7fa,_0x47c3a8,_0x5ea90d){var _0x576371='';return db[_0x7462('0x31')]['findOne']({'where':{'id':_0x5bd7fa[_0x7462('0x49')]['id']},'attributes':['id',_0x7462('0x5a'),'apiKey']})['then'](handleEntityNotFound(_0x47c3a8,null))[_0x7462('0x47')](function(_0x76819e){if(_0x76819e){_0x576371=_0x76819e[_0x7462('0x5a')];var _0x4dcebf=_0x576371[_0x7462('0x5b')](-0x1);if(_0x4dcebf==='/'){_0x576371=_0x576371[_0x7462('0x5c')](0x0,_0x576371['lastIndexOf'](_0x4dcebf));}return rp({'method':_0x7462('0x5d'),'uri':util[_0x7462('0x5e')](_0x7462('0x5f'),_0x576371,_0x7462('0x60')),'headers':{'Authorization':util[_0x7462('0x5e')](_0x7462('0x61'),new Buffer(util[_0x7462('0x5e')](_0x7462('0x62'),_0x76819e[_0x7462('0x63')]))[_0x7462('0x64')](_0x7462('0x65')))},'json':!![]});}})[_0x7462('0x47')](function(_0x4671fe){if(_0x4671fe){var _0x2dc1d1=[_0x7462('0x66'),_0x7462('0x67'),_0x7462('0x68'),'description','status',_0x7462('0x69'),_0x7462('0x6a'),_0x7462('0x6b'),_0x7462('0x6c'),'group',_0x7462('0x6d')];_[_0x7462('0x6e')](_0x4671fe,function(_0x8b26d0){return _0x2dc1d1['includes'](_0x8b26d0[_0x7462('0x2d')])||!_0x8b26d0['default']&&_0x8b26d0[_0x7462('0x34')]!=='custom_text'&&_0x8b26d0[_0x7462('0x34')]!==_0x7462('0x6f');});return{'count':_0x4671fe[_0x7462('0x3a')],'rows':_[_0x7462('0x30')](_0x4671fe,function(_0x16581c){return{'id':_0x16581c[_0x7462('0x2d')],'name':_0x16581c[_0x7462('0x70')],'custom':!_0x16581c[_0x7462('0x71')],'options':_0x16581c[_0x7462('0x72')]?_['map'](_0x16581c[_0x7462('0x72')],function(_0x7d68e8){return{'name':_['capitalize'](_0x7d68e8),'value':_0x7d68e8};}):[]};})};}})[_0x7462('0x47')](respondWithResult(_0x47c3a8,null))[_0x7462('0x4c')](function(_0x3d2a1a){var _0x310b56=_0x5bd7fa[_0x7462('0x36')][_0x7462('0x73')]?0x1f4:_0x3d2a1a[_0x7462('0x74')]||0x1f4;logger['error'](_0x7462('0x75'),_0x7462('0x59'),_0x310b56,JSON['stringify'](_0x3d2a1a));delete _0x3d2a1a[_0x7462('0x2d')];if(_0x310b56===0x191){_0x310b56=0x190;}_0x47c3a8[_0x7462('0x2b')](_0x310b56)[_0x7462('0x2e')](_0x5bd7fa[_0x7462('0x36')][_0x7462('0x73')]?{'message':_0x7462('0x76'),'statusCode':_0x3d2a1a[_0x7462('0x74')]}:_0x3d2a1a);});}; \ No newline at end of file +var _0x151b=['default','custom_text','label','choices','capitalize','statusCode','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','type','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','priority','source','remove','includes'];(function(_0x34bf03,_0x7ebc65){var _0x478925=function(_0x46508c){while(--_0x46508c){_0x34bf03['push'](_0x34bf03['shift']());}};_0x478925(++_0x7ebc65);}(_0x151b,0x153));var _0xb151=function(_0x2e57ab,_0x2a8a62){_0x2e57ab=_0x2e57ab-0x0;var _0x6b5c2b=_0x151b[_0x2e57ab];return _0x6b5c2b;};'use strict';var emlformat=require(_0xb151('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb151('0x1'));var rp=require('request-promise');var moment=require(_0xb151('0x2'));var BPromise=require(_0xb151('0x3'));var Mustache=require(_0xb151('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb151('0x5'));var csv=require(_0xb151('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb151('0x7'));var _=require('lodash');var squel=require(_0xb151('0x8'));var crypto=require(_0xb151('0x9'));var jsforce=require(_0xb151('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb151('0xb'));var Papa=require(_0xb151('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb151('0xd'));var as=require(_0xb151('0xe'));var hardwareService=require(_0xb151('0xf'));var logger=require(_0xb151('0x10'))(_0xb151('0x11'));var utils=require(_0xb151('0x12'));var config=require(_0xb151('0x13'));var licenseUtil=require(_0xb151('0x14'));var db=require(_0xb151('0x15'))['db'];var integrations=require(_0xb151('0x16'));function respondWithStatusCode(_0x4e54ca,_0x1ae9b4){_0x1ae9b4=_0x1ae9b4||0xcc;return function(_0x4ac0f0){if(_0x4ac0f0){return _0x4e54ca[_0xb151('0x17')](_0x1ae9b4);}return _0x4e54ca[_0xb151('0x18')](_0x1ae9b4)[_0xb151('0x19')]();};}function respondWithResult(_0xfd071d,_0x4af767){_0x4af767=_0x4af767||0xc8;return function(_0x3bb725){if(_0x3bb725){return _0xfd071d[_0xb151('0x18')](_0x4af767)[_0xb151('0x1a')](_0x3bb725);}};}function respondWithFilteredResult(_0x5b12e5,_0x56ea81){return function(_0x5b2faa){if(_0x5b2faa){var _0x4af1c2=typeof _0x56ea81[_0xb151('0x1b')]==='undefined'&&typeof _0x56ea81[_0xb151('0x1c')]==='undefined';var _0x4eccca=_0x5b2faa[_0xb151('0x1d')];var _0x1d620e=_0x4af1c2?0x0:_0x56ea81[_0xb151('0x1b')];var _0x2ba8bf=_0x4af1c2?_0x5b2faa[_0xb151('0x1d')]:_0x56ea81[_0xb151('0x1b')]+_0x56ea81[_0xb151('0x1c')];var _0x5525fd;if(_0x2ba8bf>=_0x4eccca){_0x2ba8bf=_0x4eccca;_0x5525fd=0xc8;}else{_0x5525fd=0xce;}_0x5b12e5[_0xb151('0x18')](_0x5525fd);return _0x5b12e5[_0xb151('0x1e')]('Content-Range',_0x1d620e+'-'+_0x2ba8bf+'/'+_0x4eccca)[_0xb151('0x1a')](_0x5b2faa);}return null;};}function patchUpdates(_0x22b1cd){return function(_0x1dd369){try{jsonpatch[_0xb151('0x1f')](_0x1dd369,_0x22b1cd,!![]);}catch(_0x2a06c7){return BPromise[_0xb151('0x20')](_0x2a06c7);}return _0x1dd369[_0xb151('0x21')]();};}function saveUpdates(_0x8ab45,_0x49c2e){return function(_0x370110){if(_0x370110){return _0x370110['update'](_0x8ab45)[_0xb151('0x22')](function(_0x23cb48){return _0x23cb48;});}return null;};}function removeEntity(_0x37768a,_0x41c508){return function(_0x724bd7){if(_0x724bd7){return _0x724bd7[_0xb151('0x23')]()[_0xb151('0x22')](function(){_0x37768a[_0xb151('0x18')](0xcc)[_0xb151('0x19')]();});}};}function handleEntityNotFound(_0x55689c,_0x13b3dd){return function(_0x46b235){if(!_0x46b235){_0x55689c[_0xb151('0x17')](0x194);}return _0x46b235;};}function handleError(_0x303479,_0x2d65f8){_0x2d65f8=_0x2d65f8||0x1f4;return function(_0x1c0b04){logger[_0xb151('0x24')](_0x1c0b04[_0xb151('0x25')]);if(_0x1c0b04['name']){delete _0x1c0b04[_0xb151('0x26')];}_0x303479['status'](_0x2d65f8)[_0xb151('0x27')](_0x1c0b04);};}exports[_0xb151('0x28')]=function(_0x5e494c,_0x1faf67){var _0x495847={},_0x277814={},_0x45dc3c={'count':0x0,'rows':[]};var _0x4215b7=_[_0xb151('0x29')](db[_0xb151('0x2a')][_0xb151('0x2b')],function(_0x3d070b){return{'name':_0x3d070b[_0xb151('0x2c')],'type':_0x3d070b['type'][_0xb151('0x2d')]};});_0x277814[_0xb151('0x2e')]=_[_0xb151('0x29')](_0x4215b7,_0xb151('0x26'));_0x277814[_0xb151('0x2f')]=_[_0xb151('0x30')](_0x5e494c[_0xb151('0x2f')]);_0x277814['filters']=_[_0xb151('0x31')](_0x277814[_0xb151('0x2e')],_0x277814[_0xb151('0x2f')]);_0x495847[_0xb151('0x32')]=_[_0xb151('0x31')](_0x277814['model'],qs['fields'](_0x5e494c[_0xb151('0x2f')][_0xb151('0x33')]));_0x495847[_0xb151('0x32')]=_0x495847[_0xb151('0x32')]['length']?_0x495847[_0xb151('0x32')]:_0x277814['model'];if(!_0x5e494c[_0xb151('0x2f')][_0xb151('0x34')](_0xb151('0x35'))){_0x495847[_0xb151('0x1c')]=qs[_0xb151('0x1c')](_0x5e494c[_0xb151('0x2f')][_0xb151('0x1c')]);_0x495847[_0xb151('0x1b')]=qs[_0xb151('0x1b')](_0x5e494c[_0xb151('0x2f')][_0xb151('0x1b')]);}_0x495847['order']=qs[_0xb151('0x36')](_0x5e494c[_0xb151('0x2f')][_0xb151('0x36')]);_0x495847['where']=qs[_0xb151('0x37')](_[_0xb151('0x38')](_0x5e494c[_0xb151('0x2f')],_0x277814[_0xb151('0x37')]),_0x4215b7);if(_0x5e494c[_0xb151('0x2f')][_0xb151('0x39')]){_0x495847[_0xb151('0x3a')]=_[_0xb151('0x3b')](_0x495847[_0xb151('0x3a')],{'$or':_[_0xb151('0x29')](_0x4215b7,function(_0x29d4d8){if(_0x29d4d8['type']!==_0xb151('0x3c')){var _0x4ce704={};_0x4ce704[_0x29d4d8[_0xb151('0x26')]]={'$like':'%'+_0x5e494c[_0xb151('0x2f')][_0xb151('0x39')]+'%'};return _0x4ce704;}})});}_0x495847=_[_0xb151('0x3b')]({},_0x495847,_0x5e494c[_0xb151('0x3d')]);var _0x47035e={'where':_0x495847[_0xb151('0x3a')]};return db['FreshdeskAccount'][_0xb151('0x1d')](_0x47035e)[_0xb151('0x22')](function(_0x135e52){_0x45dc3c[_0xb151('0x1d')]=_0x135e52;if(_0x5e494c[_0xb151('0x2f')][_0xb151('0x3e')]){_0x495847[_0xb151('0x3f')]=[{'all':!![]}];}return db[_0xb151('0x2a')][_0xb151('0x40')](_0x495847);})[_0xb151('0x22')](function(_0x3b4776){_0x45dc3c[_0xb151('0x41')]=_0x3b4776;return _0x45dc3c;})[_0xb151('0x22')](respondWithFilteredResult(_0x1faf67,_0x495847))[_0xb151('0x42')](handleError(_0x1faf67,null));};exports[_0xb151('0x43')]=function(_0x128eff,_0x16de3b){var _0x4075bf={'raw':![],'where':{'id':_0x128eff[_0xb151('0x44')]['id']}},_0x27fbe4={};_0x27fbe4[_0xb151('0x2e')]=_[_0xb151('0x30')](db[_0xb151('0x2a')][_0xb151('0x2b')]);_0x27fbe4['query']=_[_0xb151('0x30')](_0x128eff[_0xb151('0x2f')]);_0x27fbe4[_0xb151('0x37')]=_[_0xb151('0x31')](_0x27fbe4[_0xb151('0x2e')],_0x27fbe4[_0xb151('0x2f')]);_0x4075bf['attributes']=_[_0xb151('0x31')](_0x27fbe4[_0xb151('0x2e')],qs[_0xb151('0x33')](_0x128eff[_0xb151('0x2f')][_0xb151('0x33')]));_0x4075bf[_0xb151('0x32')]=_0x4075bf[_0xb151('0x32')][_0xb151('0x45')]?_0x4075bf[_0xb151('0x32')]:_0x27fbe4[_0xb151('0x2e')];if(_0x128eff['query'][_0xb151('0x3e')]){_0x4075bf['include']=[{'all':!![]}];}_0x4075bf=_[_0xb151('0x3b')]({},_0x4075bf,_0x128eff[_0xb151('0x3d')]);return db[_0xb151('0x2a')]['find'](_0x4075bf)[_0xb151('0x22')](handleEntityNotFound(_0x16de3b,null))['then'](respondWithResult(_0x16de3b,null))[_0xb151('0x42')](handleError(_0x16de3b,null));};exports[_0xb151('0x46')]=function(_0xba7534,_0xa8f920){return db[_0xb151('0x2a')]['create'](_0xba7534[_0xb151('0x47')],{})['then'](respondWithResult(_0xa8f920,0xc9))[_0xb151('0x42')](handleError(_0xa8f920,null));};exports[_0xb151('0x48')]=function(_0x964b2b,_0x2ce3ca){if(_0x964b2b['body']['id']){delete _0x964b2b[_0xb151('0x47')]['id'];}return db[_0xb151('0x2a')][_0xb151('0x49')]({'where':{'id':_0x964b2b[_0xb151('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ce3ca,null))[_0xb151('0x22')](saveUpdates(_0x964b2b['body'],null))[_0xb151('0x22')](respondWithResult(_0x2ce3ca,null))[_0xb151('0x42')](handleError(_0x2ce3ca,null));};exports[_0xb151('0x23')]=function(_0x50b4dd,_0x211e0c){return db['FreshdeskAccount']['find']({'where':{'id':_0x50b4dd[_0xb151('0x44')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x211e0c,null))[_0xb151('0x22')](removeEntity(_0x211e0c,null))[_0xb151('0x42')](handleError(_0x211e0c,null));};exports[_0xb151('0x4a')]=function(_0x4cb261,_0xd94c1d,_0x55117d){var _0x3ba19f={};var _0x4e352e={};var _0x74b4f3;var _0x21c382;return db['FreshdeskAccount'][_0xb151('0x4b')]({'where':{'id':_0x4cb261[_0xb151('0x44')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0xd94c1d,null))[_0xb151('0x22')](function(_0x2e4389){if(_0x2e4389){_0x74b4f3=_0x2e4389;_0x4e352e[_0xb151('0x2e')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x4e352e[_0xb151('0x2f')]=_[_0xb151('0x30')](_0x4cb261[_0xb151('0x2f')]);_0x4e352e[_0xb151('0x37')]=_[_0xb151('0x31')](_0x4e352e['model'],_0x4e352e[_0xb151('0x2f')]);_0x3ba19f['attributes']=_['intersection'](_0x4e352e[_0xb151('0x2e')],qs[_0xb151('0x33')](_0x4cb261['query']['fields']));_0x3ba19f[_0xb151('0x32')]=_0x3ba19f[_0xb151('0x32')][_0xb151('0x45')]?_0x3ba19f[_0xb151('0x32')]:_0x4e352e[_0xb151('0x2e')];_0x3ba19f[_0xb151('0x4c')]=qs[_0xb151('0x36')](_0x4cb261['query'][_0xb151('0x36')]);_0x3ba19f[_0xb151('0x3a')]=qs[_0xb151('0x37')](_[_0xb151('0x38')](_0x4cb261[_0xb151('0x2f')],_0x4e352e[_0xb151('0x37')]));if(_0x4cb261[_0xb151('0x2f')][_0xb151('0x39')]){_0x3ba19f[_0xb151('0x3a')]=_[_0xb151('0x3b')](_0x3ba19f[_0xb151('0x3a')],{'$or':_['map'](_0x3ba19f['attributes'],function(_0x24b552){var _0x253464={};_0x253464[_0x24b552]={'$like':'%'+_0x4cb261[_0xb151('0x2f')][_0xb151('0x39')]+'%'};return _0x253464;})});}_0x3ba19f=_[_0xb151('0x3b')]({},_0x3ba19f,_0x4cb261['options']);return _0x74b4f3[_0xb151('0x4a')](_0x3ba19f);}})[_0xb151('0x22')](function(_0x54b97f){if(_0x54b97f){_0x21c382=_0x54b97f[_0xb151('0x45')];if(!_0x4cb261[_0xb151('0x2f')][_0xb151('0x34')]('nolimit')){_0x3ba19f[_0xb151('0x1c')]=qs['limit'](_0x4cb261[_0xb151('0x2f')][_0xb151('0x1c')]);_0x3ba19f[_0xb151('0x1b')]=qs[_0xb151('0x1b')](_0x4cb261[_0xb151('0x2f')][_0xb151('0x1b')]);}return _0x74b4f3[_0xb151('0x4a')](_0x3ba19f);}})[_0xb151('0x22')](function(_0x1cfc6e){if(_0x1cfc6e){return _0x1cfc6e?{'count':_0x21c382,'rows':_0x1cfc6e}:null;}})[_0xb151('0x22')](respondWithResult(_0xd94c1d,null))[_0xb151('0x42')](handleError(_0xd94c1d,null));};exports[_0xb151('0x4d')]=function(_0x5efd97,_0x216575,_0x26438f){if(_0x5efd97['body']['id']){delete _0x5efd97[_0xb151('0x47')]['id'];}return db[_0xb151('0x2a')]['findOne']({'where':{'id':_0x5efd97[_0xb151('0x44')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x216575,null))[_0xb151('0x22')](function(_0x333d09){if(_0x333d09){_0x5efd97['body'][_0xb151('0x4e')]=_0x333d09['id'];_0x5efd97[_0xb151('0x47')][_0xb151('0x4f')]=integrations['getSubjects'](_0x5efd97[_0xb151('0x47')][_0xb151('0x50')],_0x5efd97[_0xb151('0x47')]['type']);_0x5efd97[_0xb151('0x47')][_0xb151('0x51')]=integrations['getDescriptions'](_0x5efd97[_0xb151('0x47')][_0xb151('0x50')],_0x5efd97[_0xb151('0x47')][_0xb151('0x52')]);return db[_0xb151('0x53')][_0xb151('0x46')](_0x5efd97[_0xb151('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0xb151('0x4f')},{'model':db[_0xb151('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x216575,null))[_0xb151('0x42')](handleError(_0x216575,null));};exports[_0xb151('0x55')]=function(_0x25e3d3,_0x46b7d0,_0x5d41d5){var _0x365972='';return db[_0xb151('0x2a')][_0xb151('0x4b')]({'where':{'id':_0x25e3d3['params']['id']},'attributes':['id',_0xb151('0x56'),_0xb151('0x57')]})['then'](handleEntityNotFound(_0x46b7d0,null))[_0xb151('0x22')](function(_0x42a051){if(_0x42a051){_0x365972=_0x42a051[_0xb151('0x56')];var _0x4900bb=_0x365972['slice'](-0x1);if(_0x4900bb==='/'){_0x365972=_0x365972[_0xb151('0x58')](0x0,_0x365972[_0xb151('0x59')](_0x4900bb));}return rp({'method':'GET','uri':util[_0xb151('0x5a')]('%s/%s',_0x365972,_0xb151('0x5b')),'headers':{'Authorization':util[_0xb151('0x5a')](_0xb151('0x5c'),new Buffer(util[_0xb151('0x5a')](_0xb151('0x5d'),_0x42a051[_0xb151('0x57')]))['toString'](_0xb151('0x5e')))},'json':!![]});}})[_0xb151('0x22')](function(_0x1b5a68){if(_0x1b5a68){var _0xeb662e=[_0xb151('0x5f'),_0xb151('0x60'),'agent','description','status',_0xb151('0x61'),'group',_0xb151('0x62'),'ticket_type','group','company'];_[_0xb151('0x63')](_0x1b5a68,function(_0x1a9f1a){return _0xeb662e[_0xb151('0x64')](_0x1a9f1a[_0xb151('0x26')])||!_0x1a9f1a[_0xb151('0x65')]&&_0x1a9f1a[_0xb151('0x52')]!==_0xb151('0x66')&&_0x1a9f1a['type']!=='custom_dropdown';});return{'count':_0x1b5a68['length'],'rows':_['map'](_0x1b5a68,function(_0x41fca0){return{'id':_0x41fca0[_0xb151('0x26')],'name':_0x41fca0[_0xb151('0x67')],'custom':!_0x41fca0[_0xb151('0x65')],'options':_0x41fca0[_0xb151('0x68')]?_[_0xb151('0x29')](_0x41fca0[_0xb151('0x68')],function(_0x3ccc70){return{'name':_[_0xb151('0x69')](_0x3ccc70),'value':_0x3ccc70};}):[]};})};}})[_0xb151('0x22')](respondWithResult(_0x46b7d0,null))['catch'](function(_0x12875a){var _0x555ca3=_0x25e3d3[_0xb151('0x2f')]['test']?0x1f4:_0x12875a[_0xb151('0x6a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb151('0x55'),_0x555ca3,JSON[_0xb151('0x6b')](_0x12875a));delete _0x12875a['name'];if(_0x555ca3===0x191){_0x555ca3=0x190;}_0x46b7d0[_0xb151('0x18')](_0x555ca3)[_0xb151('0x27')](_0x25e3d3[_0xb151('0x2f')][_0xb151('0x6c')]?{'message':_0xb151('0x6d'),'statusCode':_0x12875a['statusCode']}:_0x12875a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 1819da1..a2b0fa5 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 _0xcf64=['bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','util','../../config/logger','api','moment'];(function(_0x5200c8,_0x42b5b5){var _0x3aca1d=function(_0x8e9554){while(--_0x8e9554){_0x5200c8['push'](_0x5200c8['shift']());}};_0x3aca1d(++_0x42b5b5);}(_0xcf64,0x1c3));var _0x4cf6=function(_0x27d9f1,_0x340511){_0x27d9f1=_0x27d9f1-0x0;var _0x5a17d1=_0xcf64[_0x27d9f1];return _0x5a17d1;};'use strict';var _=require('lodash');var util=require(_0x4cf6('0x0'));var logger=require(_0x4cf6('0x1'))(_0x4cf6('0x2'));var moment=require(_0x4cf6('0x3'));var BPromise=require(_0x4cf6('0x4'));var rp=require(_0x4cf6('0x5'));var fs=require('fs');var path=require(_0x4cf6('0x6'));var rimraf=require('rimraf');var config=require(_0x4cf6('0x7'));var attributes=require(_0x4cf6('0x8'));var integrations=require(_0x4cf6('0x9'));module[_0x4cf6('0xa')]=function(_0x1d45b9,_0x1283d4){return _0x1d45b9[_0x4cf6('0xb')]('FreshdeskAccount',attributes,{'tableName':_0x4cf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd124=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','int_freshdesk_accounts'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd124,0x18c));var _0x4d12=function(_0x12f0fc,_0x3c2bd6){_0x12f0fc=_0x12f0fc-0x0;var _0x3b9534=_0xd124[_0x12f0fc];return _0x3b9534;};'use strict';var _=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var logger=require(_0x4d12('0x2'))(_0x4d12('0x3'));var moment=require('moment');var BPromise=require(_0x4d12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d12('0x5'));var rimraf=require(_0x4d12('0x6'));var config=require(_0x4d12('0x7'));var attributes=require(_0x4d12('0x8'));var integrations=require(_0x4d12('0x9'));module['exports']=function(_0x2797ee,_0x2d5b79){return _0x2797ee[_0x4d12('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x4d12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 73254d8..2825402 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 _0xde39=['raw','where','include','map','model','attributes','then','stringify','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','FreshdeskAccount','findAll','options'];(function(_0x461c2c,_0x13f720){var _0x34ce82=function(_0x44f0f5){while(--_0x44f0f5){_0x461c2c['push'](_0x461c2c['shift']());}};_0x34ce82(++_0x13f720);}(_0xde39,0x15e));var _0x9de3=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0xde39[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0x9de3('0x0'));var util=require(_0x9de3('0x1'));var moment=require('moment');var BPromise=require(_0x9de3('0x2'));var rs=require(_0x9de3('0x3'));var fs=require('fs');var Redis=require(_0x9de3('0x4'));var db=require(_0x9de3('0x5'))['db'];var utils=require(_0x9de3('0x6'));var logger=require(_0x9de3('0x7'))('rpc');var config=require(_0x9de3('0x8'));var jayson=require(_0x9de3('0x9'));var client=jayson[_0x9de3('0xa')][_0x9de3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e6096,_0x26f9f6,_0x3eb46b){return new BPromise(function(_0xd8741a,_0xeead2e){return client[_0x9de3('0xc')](_0x4e6096,_0x3eb46b)['then'](function(_0x197faa){logger[_0x9de3('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x26f9f6,_0x9de3('0xe'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x26f9f6,'request\x20sent',JSON['stringify'](_0x197faa));if(_0x197faa[_0x9de3('0xf')]){if(_0x197faa[_0x9de3('0xf')][_0x9de3('0x10')]===0x1f4){logger[_0x9de3('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x26f9f6,_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);return _0xeead2e(_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);}logger[_0x9de3('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x26f9f6,_0x197faa['error'][_0x9de3('0x11')]);return _0xd8741a(_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);}else{logger[_0x9de3('0xd')](_0x9de3('0x12'),_0x26f9f6,_0x9de3('0xe'));_0xd8741a(_0x197faa[_0x9de3('0x13')][_0x9de3('0x11')]);}})[_0x9de3('0x14')](function(_0x138167){logger['error'](_0x9de3('0x12'),_0x26f9f6,_0x138167);_0xeead2e(_0x138167);});});}exports['GetFreshdeskAccount']=function(_0x29efbf){var _0x553db4=this;return new Promise(function(_0x302ecf,_0x5401c8){return db[_0x9de3('0x15')][_0x9de3('0x16')]({'raw':_0x29efbf[_0x9de3('0x17')]?_0x29efbf[_0x9de3('0x17')][_0x9de3('0x18')]===undefined?!![]:![]:!![],'where':_0x29efbf[_0x9de3('0x17')]?_0x29efbf[_0x9de3('0x17')][_0x9de3('0x19')]||null:null,'attributes':_0x29efbf[_0x9de3('0x17')]?_0x29efbf[_0x9de3('0x17')]['attributes']||null:null,'limit':_0x29efbf[_0x9de3('0x17')]?_0x29efbf[_0x9de3('0x17')]['limit']||null:null,'include':_0x29efbf['options']?_0x29efbf[_0x9de3('0x17')][_0x9de3('0x1a')]?_[_0x9de3('0x1b')](_0x29efbf[_0x9de3('0x17')][_0x9de3('0x1a')],function(_0x56459e){return{'model':db[_0x56459e[_0x9de3('0x1c')]],'as':_0x56459e['as'],'attributes':_0x56459e[_0x9de3('0x1d')],'include':_0x56459e['include']?_['map'](_0x56459e['include'],function(_0x5570f2){return{'model':db[_0x5570f2[_0x9de3('0x1c')]],'as':_0x5570f2['as'],'attributes':_0x5570f2[_0x9de3('0x1d')],'include':_0x5570f2['include']?_[_0x9de3('0x1b')](_0x5570f2[_0x9de3('0x1a')],function(_0x4beccb){return{'model':db[_0x4beccb[_0x9de3('0x1c')]],'as':_0x4beccb['as'],'attributes':_0x4beccb[_0x9de3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9de3('0x1e')](function(_0x4baea9){logger['info']('GetFreshdeskAccount',_0x29efbf);logger['debug']('GetFreshdeskAccount',_0x29efbf,JSON[_0x9de3('0x1f')](_0x4baea9));_0x302ecf(_0x4baea9);})[_0x9de3('0x14')](function(_0x2a0c0f){logger[_0x9de3('0xf')](_0x9de3('0x20'),_0x2a0c0f[_0x9de3('0x11')],_0x29efbf);_0x5401c8(_0x553db4['error'](0x1f4,_0x2a0c0f[_0x9de3('0x11')]));});});};exports[_0x9de3('0x21')]=function(_0x4a427d){var _0x520f9e=this;return new Promise(function(_0x51d309,_0x31bbd3){return db[_0x9de3('0x15')]['find']({'raw':_0x4a427d[_0x9de3('0x17')]?_0x4a427d['options'][_0x9de3('0x18')]===undefined?!![]:![]:!![],'where':_0x4a427d['options']?_0x4a427d[_0x9de3('0x17')]['where']||null:null,'attributes':_0x4a427d[_0x9de3('0x17')]?_0x4a427d['options'][_0x9de3('0x1d')]||null:null,'include':_0x4a427d[_0x9de3('0x17')]?_0x4a427d[_0x9de3('0x17')][_0x9de3('0x1a')]?_['map'](_0x4a427d[_0x9de3('0x17')][_0x9de3('0x1a')],function(_0x1e03de){return{'model':db[_0x1e03de[_0x9de3('0x1c')]],'as':_0x1e03de['as'],'attributes':_0x1e03de[_0x9de3('0x1d')],'include':_0x1e03de[_0x9de3('0x1a')]?_[_0x9de3('0x1b')](_0x1e03de[_0x9de3('0x1a')],function(_0x4b0720){return{'model':db[_0x4b0720[_0x9de3('0x1c')]],'as':_0x4b0720['as'],'attributes':_0x4b0720[_0x9de3('0x1d')],'include':_0x4b0720[_0x9de3('0x1a')]?_[_0x9de3('0x1b')](_0x4b0720[_0x9de3('0x1a')],function(_0x4d2f35){return{'model':db[_0x4d2f35[_0x9de3('0x1c')]],'as':_0x4d2f35['as'],'attributes':_0x4d2f35[_0x9de3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9de3('0x1e')](function(_0x46d670){logger['info'](_0x9de3('0x21'),_0x4a427d);logger['debug'](_0x9de3('0x21'),_0x4a427d,JSON[_0x9de3('0x1f')](_0x46d670));_0x51d309(_0x46d670);})['catch'](function(_0x897dea){logger[_0x9de3('0xf')]('ShowFreshdeskAccount',_0x897dea[_0x9de3('0x11')],_0x4a427d);_0x31bbd3(_0x520f9e[_0x9de3('0xf')](0x1f4,_0x897dea[_0x9de3('0x11')]));});});}; \ No newline at end of file +var _0xe6f1=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','model','map','catch','ShowFreshdeskAccount','lodash'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xe6f1,0x16a));var _0x1e6f=function(_0x42d41d,_0x17b8ea){_0x42d41d=_0x42d41d-0x0;var _0x2e6184=_0xe6f1[_0x42d41d];return _0x2e6184;};'use strict';var _=require(_0x1e6f('0x0'));var util=require(_0x1e6f('0x1'));var moment=require(_0x1e6f('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e6f('0x3'));var fs=require('fs');var Redis=require(_0x1e6f('0x4'));var db=require(_0x1e6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e6f('0x6'))(_0x1e6f('0x7'));var config=require(_0x1e6f('0x8'));var jayson=require(_0x1e6f('0x9'));var client=jayson[_0x1e6f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2154f7,_0x1b1ec4,_0x4b1916){return new BPromise(function(_0x3cc1f8,_0x1e3b72){return client[_0x1e6f('0xb')](_0x2154f7,_0x4b1916)[_0x1e6f('0xc')](function(_0x1e5bcc){logger[_0x1e6f('0xd')](_0x1e6f('0xe'),_0x1b1ec4,_0x1e6f('0xf'));logger[_0x1e6f('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1b1ec4,_0x1e6f('0xf'),JSON[_0x1e6f('0x11')](_0x1e5bcc));if(_0x1e5bcc[_0x1e6f('0x12')]){if(_0x1e5bcc[_0x1e6f('0x12')][_0x1e6f('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1b1ec4,_0x1e5bcc['error'][_0x1e6f('0x14')]);return _0x1e3b72(_0x1e5bcc[_0x1e6f('0x12')][_0x1e6f('0x14')]);}logger[_0x1e6f('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1b1ec4,_0x1e5bcc[_0x1e6f('0x12')][_0x1e6f('0x14')]);return _0x3cc1f8(_0x1e5bcc['error'][_0x1e6f('0x14')]);}else{logger[_0x1e6f('0xd')](_0x1e6f('0xe'),_0x1b1ec4,_0x1e6f('0xf'));_0x3cc1f8(_0x1e5bcc[_0x1e6f('0x15')][_0x1e6f('0x14')]);}})['catch'](function(_0xb2b5d4){logger['error'](_0x1e6f('0xe'),_0x1b1ec4,_0xb2b5d4);_0x1e3b72(_0xb2b5d4);});});}exports[_0x1e6f('0x16')]=function(_0x2203c8){var _0x1f976f=this;return new Promise(function(_0x171a50,_0x32919c){return db[_0x1e6f('0x17')]['findAll']({'raw':_0x2203c8[_0x1e6f('0x18')]?_0x2203c8[_0x1e6f('0x18')][_0x1e6f('0x19')]===undefined?!![]:![]:!![],'where':_0x2203c8[_0x1e6f('0x18')]?_0x2203c8[_0x1e6f('0x18')][_0x1e6f('0x1a')]||null:null,'attributes':_0x2203c8[_0x1e6f('0x18')]?_0x2203c8[_0x1e6f('0x18')][_0x1e6f('0x1b')]||null:null,'limit':_0x2203c8[_0x1e6f('0x18')]?_0x2203c8[_0x1e6f('0x18')]['limit']||null:null,'include':_0x2203c8[_0x1e6f('0x18')]?_0x2203c8['options']['include']?_['map'](_0x2203c8[_0x1e6f('0x18')][_0x1e6f('0x1c')],function(_0x1b219a){return{'model':db[_0x1b219a[_0x1e6f('0x1d')]],'as':_0x1b219a['as'],'attributes':_0x1b219a[_0x1e6f('0x1b')],'include':_0x1b219a[_0x1e6f('0x1c')]?_[_0x1e6f('0x1e')](_0x1b219a[_0x1e6f('0x1c')],function(_0x56cc9b){return{'model':db[_0x56cc9b['model']],'as':_0x56cc9b['as'],'attributes':_0x56cc9b['attributes'],'include':_0x56cc9b[_0x1e6f('0x1c')]?_[_0x1e6f('0x1e')](_0x56cc9b[_0x1e6f('0x1c')],function(_0x31af77){return{'model':db[_0x31af77['model']],'as':_0x31af77['as'],'attributes':_0x31af77['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e6f('0xc')](function(_0x432efa){logger['info'](_0x1e6f('0x16'),_0x2203c8);logger[_0x1e6f('0x10')](_0x1e6f('0x16'),_0x2203c8,JSON['stringify'](_0x432efa));_0x171a50(_0x432efa);})[_0x1e6f('0x1f')](function(_0x4b1ecb){logger[_0x1e6f('0x12')](_0x1e6f('0x16'),_0x4b1ecb['message'],_0x2203c8);_0x32919c(_0x1f976f[_0x1e6f('0x12')](0x1f4,_0x4b1ecb[_0x1e6f('0x14')]));});});};exports[_0x1e6f('0x20')]=function(_0x15c6d6){var _0x42a4ef=this;return new Promise(function(_0x3433fa,_0xccc474){return db[_0x1e6f('0x17')]['find']({'raw':_0x15c6d6['options']?_0x15c6d6[_0x1e6f('0x18')][_0x1e6f('0x19')]===undefined?!![]:![]:!![],'where':_0x15c6d6[_0x1e6f('0x18')]?_0x15c6d6[_0x1e6f('0x18')]['where']||null:null,'attributes':_0x15c6d6['options']?_0x15c6d6[_0x1e6f('0x18')]['attributes']||null:null,'include':_0x15c6d6[_0x1e6f('0x18')]?_0x15c6d6[_0x1e6f('0x18')][_0x1e6f('0x1c')]?_[_0x1e6f('0x1e')](_0x15c6d6[_0x1e6f('0x18')]['include'],function(_0x3bf82b){return{'model':db[_0x3bf82b['model']],'as':_0x3bf82b['as'],'attributes':_0x3bf82b[_0x1e6f('0x1b')],'include':_0x3bf82b[_0x1e6f('0x1c')]?_['map'](_0x3bf82b[_0x1e6f('0x1c')],function(_0x45dde3){return{'model':db[_0x45dde3[_0x1e6f('0x1d')]],'as':_0x45dde3['as'],'attributes':_0x45dde3[_0x1e6f('0x1b')],'include':_0x45dde3[_0x1e6f('0x1c')]?_['map'](_0x45dde3[_0x1e6f('0x1c')],function(_0x1ff45f){return{'model':db[_0x1ff45f[_0x1e6f('0x1d')]],'as':_0x1ff45f['as'],'attributes':_0x1ff45f[_0x1e6f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4692dd){logger[_0x1e6f('0xd')]('ShowFreshdeskAccount',_0x15c6d6);logger[_0x1e6f('0x10')](_0x1e6f('0x20'),_0x15c6d6,JSON[_0x1e6f('0x11')](_0x4692dd));_0x3433fa(_0x4692dd);})[_0x1e6f('0x1f')](function(_0x29a08b){logger['error'](_0x1e6f('0x20'),_0x29a08b[_0x1e6f('0x14')],_0x15c6d6);_0xccc474(_0x42a4ef[_0x1e6f('0x12')](0x1f4,_0x29a08b['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0f7b149..e482831 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 _0xfbd8=['create','setTags','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post'];(function(_0x342db9,_0x50c6f0){var _0x47ee40=function(_0x38a400){while(--_0x38a400){_0x342db9['push'](_0x342db9['shift']());}};_0x47ee40(++_0x50c6f0);}(_0xfbd8,0x1f3));var _0x8fbd=function(_0x17d703,_0x2266eb){_0x17d703=_0x17d703-0x0;var _0x4fd652=_0xfbd8[_0x17d703];return _0x4fd652;};'use strict';var multer=require(_0x8fbd('0x0'));var util=require(_0x8fbd('0x1'));var path=require(_0x8fbd('0x2'));var timeout=require(_0x8fbd('0x3'));var express=require('express');var router=express[_0x8fbd('0x4')]();var fs_extra=require(_0x8fbd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8fbd('0x6'));var config=require(_0x8fbd('0x7'));var controller=require(_0x8fbd('0x8'));router[_0x8fbd('0x9')]('/',auth[_0x8fbd('0xa')](),controller[_0x8fbd('0xb')]);router[_0x8fbd('0x9')](_0x8fbd('0xc'),auth[_0x8fbd('0xa')](),controller[_0x8fbd('0xd')]);router[_0x8fbd('0x9')](_0x8fbd('0xe'),auth[_0x8fbd('0xa')](),controller[_0x8fbd('0xf')]);router['get'](_0x8fbd('0x10'),auth[_0x8fbd('0xa')](),controller[_0x8fbd('0x11')]);router[_0x8fbd('0x9')]('/:id/descriptions',auth[_0x8fbd('0xa')](),controller[_0x8fbd('0x12')]);router['get'](_0x8fbd('0x13'),auth[_0x8fbd('0xa')](),controller['getTags']);router[_0x8fbd('0x14')]('/',auth[_0x8fbd('0xa')](),controller[_0x8fbd('0x15')]);router[_0x8fbd('0x14')]('/:id/tags',auth[_0x8fbd('0xa')](),controller[_0x8fbd('0x16')]);router[_0x8fbd('0x17')](_0x8fbd('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8fbd('0x18')](_0x8fbd('0xc'),auth['isAuthenticated'](),controller[_0x8fbd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x49a4=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects'];(function(_0x5bcddc,_0x288f93){var _0x578229=function(_0x277e20){while(--_0x277e20){_0x5bcddc['push'](_0x5bcddc['shift']());}};_0x578229(++_0x288f93);}(_0x49a4,0x11d));var _0x449a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49a4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x449a('0x0'));var util=require(_0x449a('0x1'));var path=require(_0x449a('0x2'));var timeout=require(_0x449a('0x3'));var express=require(_0x449a('0x4'));var router=express[_0x449a('0x5')]();var fs_extra=require(_0x449a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x449a('0x7'));var controller=require(_0x449a('0x8'));router[_0x449a('0x9')]('/',auth[_0x449a('0xa')](),controller['index']);router[_0x449a('0x9')](_0x449a('0xb'),auth[_0x449a('0xa')](),controller[_0x449a('0xc')]);router['get'](_0x449a('0xd'),auth[_0x449a('0xa')](),controller['getFields']);router[_0x449a('0x9')](_0x449a('0xe'),auth[_0x449a('0xa')](),controller[_0x449a('0xf')]);router[_0x449a('0x9')](_0x449a('0x10'),auth[_0x449a('0xa')](),controller[_0x449a('0x11')]);router[_0x449a('0x9')](_0x449a('0x12'),auth['isAuthenticated'](),controller['getTags']);router[_0x449a('0x13')]('/',auth[_0x449a('0xa')](),controller['create']);router[_0x449a('0x13')](_0x449a('0x12'),auth[_0x449a('0xa')](),controller[_0x449a('0x14')]);router[_0x449a('0x15')](_0x449a('0xb'),auth[_0x449a('0xa')](),controller[_0x449a('0x16')]);router[_0x449a('0x17')]('/:id',auth[_0x449a('0xa')](),controller['destroy']);module[_0x449a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0da00e3..ca7ec39 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 _0x0a0e=['STRING','sequelize'];(function(_0x14dc7d,_0x13ff80){var _0x2a94df=function(_0x524a4f){while(--_0x524a4f){_0x14dc7d['push'](_0x14dc7d['shift']());}};_0x2a94df(++_0x13ff80);}(_0x0a0e,0xb1));var _0xe0a0=function(_0x34ea22,_0x1270b3){_0x34ea22=_0x34ea22-0x0;var _0x1ca470=_0x0a0e[_0x34ea22];return _0x1ca470;};'use strict';var Sequelize=require(_0xe0a0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0a0('0x1')]},'description':{'type':Sequelize[_0xe0a0('0x1')]}}; \ No newline at end of file +var _0xb724=['exports','STRING','sequelize'];(function(_0x3242fd,_0x2df22c){var _0x443711=function(_0xc4ef6d){while(--_0xc4ef6d){_0x3242fd['push'](_0x3242fd['shift']());}};_0x443711(++_0x2df22c);}(_0xb724,0x1d9));var _0x4b72=function(_0x19dabf,_0x419c46){_0x19dabf=_0x19dabf-0x0;var _0x5bb62b=_0xb724[_0x19dabf];return _0x5bb62b;};'use strict';var Sequelize=require(_0x4b72('0x0'));module[_0x4b72('0x1')]={'name':{'type':Sequelize[_0x4b72('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 016333d..e199468 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 _0x7718=['lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','name','send','index','FreshdeskConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','rawAttributes','length','include','find','create','body','params','getFields','FreshdeskField','nolimit','getSubjects','findOne','pick','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs'];(function(_0x26ac27,_0x574b86){var _0x44a599=function(_0x130e2c){while(--_0x130e2c){_0x26ac27['push'](_0x26ac27['shift']());}};_0x44a599(++_0x574b86);}(_0x7718,0xe4));var _0x8771=function(_0x3b15f4,_0x30faec){_0x3b15f4=_0x3b15f4-0x0;var _0x2a8dbf=_0x7718[_0x3b15f4];return _0x2a8dbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8771('0x0'));var zipdir=require(_0x8771('0x1'));var jsonpatch=require(_0x8771('0x2'));var rp=require(_0x8771('0x3'));var moment=require('moment');var BPromise=require(_0x8771('0x4'));var Mustache=require('mustache');var util=require(_0x8771('0x5'));var path=require(_0x8771('0x6'));var sox=require(_0x8771('0x7'));var csv=require('to-csv');var ejs=require(_0x8771('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8771('0x9'));var squel=require(_0x8771('0xa'));var crypto=require('crypto');var jsforce=require(_0x8771('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8771('0xc'));var querystring=require(_0x8771('0xd'));var Papa=require('papaparse');var Redis=require(_0x8771('0xe'));var authService=require(_0x8771('0xf'));var qs=require(_0x8771('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8771('0x11'));var logger=require(_0x8771('0x12'))(_0x8771('0x13'));var utils=require(_0x8771('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8771('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593d01,_0x420538){_0x420538=_0x420538||0xcc;return function(_0x1f7139){if(_0x1f7139){return _0x593d01[_0x8771('0x16')](_0x420538);}return _0x593d01[_0x8771('0x17')](_0x420538)['end']();};}function respondWithResult(_0x15b00e,_0x24f0c0){_0x24f0c0=_0x24f0c0||0xc8;return function(_0x4e9ece){if(_0x4e9ece){return _0x15b00e['status'](_0x24f0c0)[_0x8771('0x18')](_0x4e9ece);}};}function respondWithFilteredResult(_0x178f76,_0x7f992a){return function(_0xf12284){if(_0xf12284){var _0x339e50=typeof _0x7f992a[_0x8771('0x19')]===_0x8771('0x1a')&&typeof _0x7f992a[_0x8771('0x1b')]==='undefined';var _0xaeddc4=_0xf12284[_0x8771('0x1c')];var _0x4d648b=_0x339e50?0x0:_0x7f992a[_0x8771('0x19')];var _0x1f3904=_0x339e50?_0xf12284['count']:_0x7f992a[_0x8771('0x19')]+_0x7f992a[_0x8771('0x1b')];var _0x5eee4b;if(_0x1f3904>=_0xaeddc4){_0x1f3904=_0xaeddc4;_0x5eee4b=0xc8;}else{_0x5eee4b=0xce;}_0x178f76[_0x8771('0x17')](_0x5eee4b);return _0x178f76[_0x8771('0x1d')](_0x8771('0x1e'),_0x4d648b+'-'+_0x1f3904+'/'+_0xaeddc4)[_0x8771('0x18')](_0xf12284);}return null;};}function patchUpdates(_0x20771f){return function(_0x1305cf){try{jsonpatch[_0x8771('0x1f')](_0x1305cf,_0x20771f,!![]);}catch(_0x149bf2){return BPromise['reject'](_0x149bf2);}return _0x1305cf['save']();};}function saveUpdates(_0x7baa23,_0x64ab3e){return function(_0x3a6594){if(_0x3a6594){return _0x3a6594[_0x8771('0x20')](_0x7baa23)['then'](function(_0x425460){return _0x425460;});}return null;};}function removeEntity(_0x182e79,_0x44f2c0){return function(_0x43992d){if(_0x43992d){return _0x43992d[_0x8771('0x21')]()[_0x8771('0x22')](function(){_0x182e79['status'](0xcc)[_0x8771('0x23')]();});}};}function handleEntityNotFound(_0x291fcd,_0x1bfda7){return function(_0x381580){if(!_0x381580){_0x291fcd[_0x8771('0x16')](0x194);}return _0x381580;};}function handleError(_0xf6515,_0x2d827f){_0x2d827f=_0x2d827f||0x1f4;return function(_0x412b5b){logger['error'](_0x412b5b['stack']);if(_0x412b5b[_0x8771('0x24')]){delete _0x412b5b[_0x8771('0x24')];}_0xf6515[_0x8771('0x17')](_0x2d827f)[_0x8771('0x25')](_0x412b5b);};}exports[_0x8771('0x26')]=function(_0x4bc631,_0x32049d){var _0x1d0243={},_0x59b347={},_0xf96601={'count':0x0,'rows':[]};var _0x1cd787=_['map'](db[_0x8771('0x27')]['rawAttributes'],function(_0x4c687c){return{'name':_0x4c687c[_0x8771('0x28')],'type':_0x4c687c[_0x8771('0x29')]['key']};});_0x59b347[_0x8771('0x2a')]=_[_0x8771('0x2b')](_0x1cd787,_0x8771('0x24'));_0x59b347[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x4bc631['query']);_0x59b347[_0x8771('0x2e')]=_[_0x8771('0x2f')](_0x59b347[_0x8771('0x2a')],_0x59b347['query']);_0x1d0243[_0x8771('0x30')]=_[_0x8771('0x2f')](_0x59b347[_0x8771('0x2a')],qs[_0x8771('0x31')](_0x4bc631['query'][_0x8771('0x31')]));_0x1d0243[_0x8771('0x30')]=_0x1d0243['attributes']['length']?_0x1d0243[_0x8771('0x30')]:_0x59b347[_0x8771('0x2a')];if(!_0x4bc631[_0x8771('0x2c')][_0x8771('0x32')]('nolimit')){_0x1d0243['limit']=qs['limit'](_0x4bc631[_0x8771('0x2c')]['limit']);_0x1d0243[_0x8771('0x19')]=qs[_0x8771('0x19')](_0x4bc631[_0x8771('0x2c')]['offset']);}_0x1d0243[_0x8771('0x33')]=qs[_0x8771('0x34')](_0x4bc631[_0x8771('0x2c')][_0x8771('0x34')]);_0x1d0243[_0x8771('0x35')]=qs[_0x8771('0x2e')](_['pick'](_0x4bc631[_0x8771('0x2c')],_0x59b347[_0x8771('0x2e')]),_0x1cd787);if(_0x4bc631['query'][_0x8771('0x36')]){_0x1d0243[_0x8771('0x35')]=_[_0x8771('0x37')](_0x1d0243[_0x8771('0x35')],{'$or':_['map'](_0x1cd787,function(_0x4fa255){if(_0x4fa255['type']!=='VIRTUAL'){var _0x31c9c2={};_0x31c9c2[_0x4fa255['name']]={'$like':'%'+_0x4bc631[_0x8771('0x2c')][_0x8771('0x36')]+'%'};return _0x31c9c2;}})});}_0x1d0243=_[_0x8771('0x37')]({},_0x1d0243,_0x4bc631[_0x8771('0x38')]);var _0x102ac6={'where':_0x1d0243[_0x8771('0x35')]};return db['FreshdeskConfiguration'][_0x8771('0x1c')](_0x102ac6)[_0x8771('0x22')](function(_0x31ead3){_0xf96601[_0x8771('0x1c')]=_0x31ead3;if(_0x4bc631['query'][_0x8771('0x39')]){_0x1d0243['include']=[{'all':!![]}];}return db[_0x8771('0x27')][_0x8771('0x3a')](_0x1d0243);})['then'](function(_0x348fc5){_0xf96601['rows']=_0x348fc5;return _0xf96601;})[_0x8771('0x22')](respondWithFilteredResult(_0x32049d,_0x1d0243))[_0x8771('0x3b')](handleError(_0x32049d,null));};exports[_0x8771('0x3c')]=function(_0x2004f4,_0x49dfaf){var _0x3cc7be={'raw':![],'where':{'id':_0x2004f4['params']['id']}},_0x4bc10a={};_0x4bc10a[_0x8771('0x2a')]=_[_0x8771('0x2d')](db[_0x8771('0x27')][_0x8771('0x3d')]);_0x4bc10a[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x2004f4['query']);_0x4bc10a[_0x8771('0x2e')]=_[_0x8771('0x2f')](_0x4bc10a[_0x8771('0x2a')],_0x4bc10a['query']);_0x3cc7be[_0x8771('0x30')]=_[_0x8771('0x2f')](_0x4bc10a[_0x8771('0x2a')],qs['fields'](_0x2004f4['query']['fields']));_0x3cc7be['attributes']=_0x3cc7be[_0x8771('0x30')][_0x8771('0x3e')]?_0x3cc7be[_0x8771('0x30')]:_0x4bc10a[_0x8771('0x2a')];if(_0x2004f4[_0x8771('0x2c')][_0x8771('0x39')]){_0x3cc7be[_0x8771('0x3f')]=[{'all':!![]}];}_0x3cc7be=_[_0x8771('0x37')]({},_0x3cc7be,_0x2004f4[_0x8771('0x38')]);return db[_0x8771('0x27')][_0x8771('0x40')](_0x3cc7be)[_0x8771('0x22')](handleEntityNotFound(_0x49dfaf,null))['then'](respondWithResult(_0x49dfaf,null))[_0x8771('0x3b')](handleError(_0x49dfaf,null));};exports[_0x8771('0x41')]=function(_0x139742,_0x224afd){return db[_0x8771('0x27')][_0x8771('0x41')](_0x139742['body'],{})[_0x8771('0x22')](respondWithResult(_0x224afd,0xc9))[_0x8771('0x3b')](handleError(_0x224afd,null));};exports['update']=function(_0x58ca35,_0x2c2add){if(_0x58ca35[_0x8771('0x42')]['id']){delete _0x58ca35[_0x8771('0x42')]['id'];}return db['FreshdeskConfiguration'][_0x8771('0x40')]({'where':{'id':_0x58ca35['params']['id']}})[_0x8771('0x22')](handleEntityNotFound(_0x2c2add,null))['then'](saveUpdates(_0x58ca35['body'],null))[_0x8771('0x22')](respondWithResult(_0x2c2add,null))[_0x8771('0x3b')](handleError(_0x2c2add,null));};exports[_0x8771('0x21')]=function(_0x12102f,_0x14043a){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x12102f[_0x8771('0x43')]['id']}})['then'](handleEntityNotFound(_0x14043a,null))[_0x8771('0x22')](removeEntity(_0x14043a,null))[_0x8771('0x3b')](handleError(_0x14043a,null));};exports[_0x8771('0x44')]=function(_0x43f570,_0x247dcf,_0x41d03b){var _0x26a10a={};var _0x233444={};var _0x4013dd;var _0x14cf78;return db[_0x8771('0x27')]['findOne']({'where':{'id':_0x43f570[_0x8771('0x43')]['id']}})[_0x8771('0x22')](handleEntityNotFound(_0x247dcf,null))[_0x8771('0x22')](function(_0x400944){if(_0x400944){_0x4013dd=_0x400944;_0x233444['model']=_[_0x8771('0x2d')](db[_0x8771('0x45')][_0x8771('0x3d')]);_0x233444[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x43f570[_0x8771('0x2c')]);_0x233444[_0x8771('0x2e')]=_['intersection'](_0x233444[_0x8771('0x2a')],_0x233444[_0x8771('0x2c')]);_0x26a10a[_0x8771('0x30')]=_[_0x8771('0x2f')](_0x233444[_0x8771('0x2a')],qs['fields'](_0x43f570['query'][_0x8771('0x31')]));_0x26a10a[_0x8771('0x30')]=_0x26a10a[_0x8771('0x30')][_0x8771('0x3e')]?_0x26a10a['attributes']:_0x233444[_0x8771('0x2a')];_0x26a10a[_0x8771('0x33')]=qs['sort'](_0x43f570['query'][_0x8771('0x34')]);_0x26a10a[_0x8771('0x35')]=qs[_0x8771('0x2e')](_['pick'](_0x43f570[_0x8771('0x2c')],_0x233444[_0x8771('0x2e')]));if(_0x43f570['query'][_0x8771('0x36')]){_0x26a10a[_0x8771('0x35')]=_[_0x8771('0x37')](_0x26a10a[_0x8771('0x35')],{'$or':_['map'](_0x26a10a[_0x8771('0x30')],function(_0x5bd6cf){var _0x2d8959={};_0x2d8959[_0x5bd6cf]={'$like':'%'+_0x43f570[_0x8771('0x2c')][_0x8771('0x36')]+'%'};return _0x2d8959;})});}_0x26a10a=_[_0x8771('0x37')]({},_0x26a10a,_0x43f570[_0x8771('0x38')]);return _0x4013dd[_0x8771('0x44')](_0x26a10a);}})[_0x8771('0x22')](function(_0x3707a1){if(_0x3707a1){_0x14cf78=_0x3707a1[_0x8771('0x3e')];if(!_0x43f570['query'][_0x8771('0x32')](_0x8771('0x46'))){_0x26a10a['limit']=qs[_0x8771('0x1b')](_0x43f570[_0x8771('0x2c')][_0x8771('0x1b')]);_0x26a10a[_0x8771('0x19')]=qs[_0x8771('0x19')](_0x43f570['query'][_0x8771('0x19')]);}return _0x4013dd['getFields'](_0x26a10a);}})[_0x8771('0x22')](function(_0x5b3ec7){if(_0x5b3ec7){return _0x5b3ec7?{'count':_0x14cf78,'rows':_0x5b3ec7}:null;}})['then'](respondWithResult(_0x247dcf,null))[_0x8771('0x3b')](handleError(_0x247dcf,null));};exports[_0x8771('0x47')]=function(_0x66d911,_0x2d3217,_0x2b7e4b){var _0x4dd925={};var _0x4aa710={};var _0x4e5e7d;var _0x221815;return db[_0x8771('0x27')][_0x8771('0x48')]({'where':{'id':_0x66d911[_0x8771('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d3217,null))[_0x8771('0x22')](function(_0x20f9d1){if(_0x20f9d1){_0x4e5e7d=_0x20f9d1;_0x4aa710[_0x8771('0x2a')]=_[_0x8771('0x2d')](db['FreshdeskField'][_0x8771('0x3d')]);_0x4aa710[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x66d911[_0x8771('0x2c')]);_0x4aa710[_0x8771('0x2e')]=_['intersection'](_0x4aa710[_0x8771('0x2a')],_0x4aa710['query']);_0x4dd925[_0x8771('0x30')]=_['intersection'](_0x4aa710[_0x8771('0x2a')],qs['fields'](_0x66d911['query'][_0x8771('0x31')]));_0x4dd925['attributes']=_0x4dd925[_0x8771('0x30')]['length']?_0x4dd925['attributes']:_0x4aa710[_0x8771('0x2a')];_0x4dd925[_0x8771('0x33')]=qs['sort'](_0x66d911['query'][_0x8771('0x34')]);_0x4dd925[_0x8771('0x35')]=qs[_0x8771('0x2e')](_[_0x8771('0x49')](_0x66d911[_0x8771('0x2c')],_0x4aa710[_0x8771('0x2e')]));if(_0x66d911[_0x8771('0x2c')][_0x8771('0x36')]){_0x4dd925['where']=_['merge'](_0x4dd925[_0x8771('0x35')],{'$or':_[_0x8771('0x2b')](_0x4dd925[_0x8771('0x30')],function(_0x1c5da5){var _0x511db1={};_0x511db1[_0x1c5da5]={'$like':'%'+_0x66d911[_0x8771('0x2c')][_0x8771('0x36')]+'%'};return _0x511db1;})});}_0x4dd925=_['merge']({},_0x4dd925,_0x66d911[_0x8771('0x38')]);return _0x4e5e7d[_0x8771('0x47')](_0x4dd925);}})['then'](function(_0x21d570){if(_0x21d570){_0x221815=_0x21d570['length'];if(!_0x66d911[_0x8771('0x2c')][_0x8771('0x32')]('nolimit')){_0x4dd925[_0x8771('0x1b')]=qs[_0x8771('0x1b')](_0x66d911[_0x8771('0x2c')]['limit']);_0x4dd925[_0x8771('0x19')]=qs[_0x8771('0x19')](_0x66d911[_0x8771('0x2c')][_0x8771('0x19')]);}return _0x4e5e7d['getSubjects'](_0x4dd925);}})[_0x8771('0x22')](function(_0x2292a1){if(_0x2292a1){return _0x2292a1?{'count':_0x221815,'rows':_0x2292a1}:null;}})[_0x8771('0x22')](respondWithResult(_0x2d3217,null))[_0x8771('0x3b')](handleError(_0x2d3217,null));};exports[_0x8771('0x4a')]=function(_0x592155,_0x955eae,_0x33d6eb){var _0x364542={};var _0xa0db00={};var _0x4bc217;var _0x42a1e1;return db[_0x8771('0x27')][_0x8771('0x48')]({'where':{'id':_0x592155[_0x8771('0x43')]['id']}})[_0x8771('0x22')](handleEntityNotFound(_0x955eae,null))[_0x8771('0x22')](function(_0x2ad00a){if(_0x2ad00a){_0x4bc217=_0x2ad00a;_0xa0db00[_0x8771('0x2a')]=_[_0x8771('0x2d')](db[_0x8771('0x45')][_0x8771('0x3d')]);_0xa0db00[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x592155[_0x8771('0x2c')]);_0xa0db00[_0x8771('0x2e')]=_['intersection'](_0xa0db00[_0x8771('0x2a')],_0xa0db00[_0x8771('0x2c')]);_0x364542[_0x8771('0x30')]=_[_0x8771('0x2f')](_0xa0db00[_0x8771('0x2a')],qs[_0x8771('0x31')](_0x592155[_0x8771('0x2c')]['fields']));_0x364542['attributes']=_0x364542[_0x8771('0x30')][_0x8771('0x3e')]?_0x364542[_0x8771('0x30')]:_0xa0db00[_0x8771('0x2a')];_0x364542['order']=qs[_0x8771('0x34')](_0x592155[_0x8771('0x2c')][_0x8771('0x34')]);_0x364542['where']=qs[_0x8771('0x2e')](_[_0x8771('0x49')](_0x592155['query'],_0xa0db00[_0x8771('0x2e')]));if(_0x592155[_0x8771('0x2c')][_0x8771('0x36')]){_0x364542[_0x8771('0x35')]=_[_0x8771('0x37')](_0x364542[_0x8771('0x35')],{'$or':_[_0x8771('0x2b')](_0x364542['attributes'],function(_0x4bb04c){var _0x5ec6b2={};_0x5ec6b2[_0x4bb04c]={'$like':'%'+_0x592155['query']['filter']+'%'};return _0x5ec6b2;})});}_0x364542=_[_0x8771('0x37')]({},_0x364542,_0x592155[_0x8771('0x38')]);return _0x4bc217['getDescriptions'](_0x364542);}})['then'](function(_0x3620bc){if(_0x3620bc){_0x42a1e1=_0x3620bc[_0x8771('0x3e')];if(!_0x592155[_0x8771('0x2c')][_0x8771('0x32')](_0x8771('0x46'))){_0x364542[_0x8771('0x1b')]=qs[_0x8771('0x1b')](_0x592155['query'][_0x8771('0x1b')]);_0x364542[_0x8771('0x19')]=qs[_0x8771('0x19')](_0x592155[_0x8771('0x2c')]['offset']);}return _0x4bc217[_0x8771('0x4a')](_0x364542);}})[_0x8771('0x22')](function(_0x1170a2){if(_0x1170a2){return _0x1170a2?{'count':_0x42a1e1,'rows':_0x1170a2}:null;}})[_0x8771('0x22')](respondWithResult(_0x955eae,null))['catch'](handleError(_0x955eae,null));};exports[_0x8771('0x4b')]=function(_0x102374,_0x3c8b88,_0x542e7e){var _0x43afdf={};var _0xa9c066={};var _0x389158;var _0x2f3779;return db['FreshdeskConfiguration'][_0x8771('0x48')]({'where':{'id':_0x102374[_0x8771('0x43')]['id']}})[_0x8771('0x22')](handleEntityNotFound(_0x3c8b88,null))[_0x8771('0x22')](function(_0x4caf5d){if(_0x4caf5d){_0x389158=_0x4caf5d;_0xa9c066[_0x8771('0x2a')]=_['keys'](db[_0x8771('0x4c')]['rawAttributes']);_0xa9c066[_0x8771('0x2c')]=_[_0x8771('0x2d')](_0x102374[_0x8771('0x2c')]);_0xa9c066[_0x8771('0x2e')]=_[_0x8771('0x2f')](_0xa9c066[_0x8771('0x2a')],_0xa9c066[_0x8771('0x2c')]);_0x43afdf[_0x8771('0x30')]=_['intersection'](_0xa9c066['model'],qs[_0x8771('0x31')](_0x102374[_0x8771('0x2c')][_0x8771('0x31')]));_0x43afdf['attributes']=_0x43afdf[_0x8771('0x30')][_0x8771('0x3e')]?_0x43afdf[_0x8771('0x30')]:_0xa9c066['model'];_0x43afdf['order']=qs[_0x8771('0x34')](_0x102374[_0x8771('0x2c')][_0x8771('0x34')]);_0x43afdf[_0x8771('0x35')]=qs[_0x8771('0x2e')](_[_0x8771('0x49')](_0x102374[_0x8771('0x2c')],_0xa9c066[_0x8771('0x2e')]));if(_0x102374['query'][_0x8771('0x36')]){_0x43afdf[_0x8771('0x35')]=_[_0x8771('0x37')](_0x43afdf[_0x8771('0x35')],{'$or':_[_0x8771('0x2b')](_0x43afdf[_0x8771('0x30')],function(_0x326625){var _0x473e32={};_0x473e32[_0x326625]={'$like':'%'+_0x102374[_0x8771('0x2c')][_0x8771('0x36')]+'%'};return _0x473e32;})});}_0x43afdf=_['merge']({},_0x43afdf,_0x102374[_0x8771('0x38')]);return _0x389158[_0x8771('0x4b')](_0x43afdf);}})['then'](function(_0x3cb7db){if(_0x3cb7db){_0x2f3779=_0x3cb7db['length'];if(!_0x102374[_0x8771('0x2c')]['hasOwnProperty'](_0x8771('0x46'))){_0x43afdf[_0x8771('0x1b')]=qs[_0x8771('0x1b')](_0x102374[_0x8771('0x2c')]['limit']);_0x43afdf[_0x8771('0x19')]=qs[_0x8771('0x19')](_0x102374[_0x8771('0x2c')]['offset']);}return _0x389158['getTags'](_0x43afdf);}})[_0x8771('0x22')](function(_0x580f24){if(_0x580f24){return _0x580f24?{'count':_0x2f3779,'rows':_0x580f24}:null;}})['then'](respondWithResult(_0x3c8b88,null))['catch'](handleError(_0x3c8b88,null));};exports[_0x8771('0x4d')]=function(_0x16fcf,_0x5377d5,_0x512714){if(_0x16fcf['body']['id']){delete _0x16fcf[_0x8771('0x42')]['id'];}return db[_0x8771('0x27')][_0x8771('0x48')]({'where':{'id':_0x16fcf['params']['id']}})[_0x8771('0x22')](handleEntityNotFound(_0x5377d5,null))['then'](function(_0x24baed){if(_0x24baed){return _0x24baed[_0x8771('0x4d')](_0x16fcf[_0x8771('0x42')][_0x8771('0x4e')]||[]);}return null;})[_0x8771('0x22')](respondWithResult(_0x5377d5,null))['catch'](handleError(_0x5377d5,null));}; \ No newline at end of file +var _0xb0a0=['undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','catch','show','params','find','create','body','FreshdeskField','pick','getFields','getSubjects','findOne','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xb0a0,0x85));var _0x0b0a=function(_0xd92e0f,_0x4c28de){_0xd92e0f=_0xd92e0f-0x0;var _0x408a33=_0xb0a0[_0xd92e0f];return _0x408a33;};'use strict';var emlformat=require(_0x0b0a('0x0'));var rimraf=require(_0x0b0a('0x1'));var zipdir=require(_0x0b0a('0x2'));var jsonpatch=require(_0x0b0a('0x3'));var rp=require(_0x0b0a('0x4'));var moment=require(_0x0b0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b0a('0x6'));var util=require(_0x0b0a('0x7'));var path=require(_0x0b0a('0x8'));var sox=require('sox');var csv=require(_0x0b0a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b0a('0xa'));var squel=require('squel');var crypto=require(_0x0b0a('0xb'));var jsforce=require(_0x0b0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0b0a('0x9'));var querystring=require(_0x0b0a('0xd'));var Papa=require(_0x0b0a('0xe'));var Redis=require('ioredis');var authService=require(_0x0b0a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0a('0x10'));var logger=require(_0x0b0a('0x11'))(_0x0b0a('0x12'));var utils=require(_0x0b0a('0x13'));var config=require(_0x0b0a('0x14'));var licenseUtil=require(_0x0b0a('0x15'));var db=require(_0x0b0a('0x16'))['db'];function respondWithStatusCode(_0x4015ff,_0x5c3b98){_0x5c3b98=_0x5c3b98||0xcc;return function(_0x5cfac8){if(_0x5cfac8){return _0x4015ff[_0x0b0a('0x17')](_0x5c3b98);}return _0x4015ff[_0x0b0a('0x18')](_0x5c3b98)[_0x0b0a('0x19')]();};}function respondWithResult(_0x4c1ba9,_0x8a9455){_0x8a9455=_0x8a9455||0xc8;return function(_0x1d5fba){if(_0x1d5fba){return _0x4c1ba9[_0x0b0a('0x18')](_0x8a9455)[_0x0b0a('0x1a')](_0x1d5fba);}};}function respondWithFilteredResult(_0x1791ba,_0x2e4d5e){return function(_0x25f0c6){if(_0x25f0c6){var _0x3bb583=typeof _0x2e4d5e[_0x0b0a('0x1b')]==='undefined'&&typeof _0x2e4d5e[_0x0b0a('0x1c')]===_0x0b0a('0x1d');var _0x17310a=_0x25f0c6[_0x0b0a('0x1e')];var _0x51436b=_0x3bb583?0x0:_0x2e4d5e['offset'];var _0xccec4c=_0x3bb583?_0x25f0c6[_0x0b0a('0x1e')]:_0x2e4d5e[_0x0b0a('0x1b')]+_0x2e4d5e['limit'];var _0x480949;if(_0xccec4c>=_0x17310a){_0xccec4c=_0x17310a;_0x480949=0xc8;}else{_0x480949=0xce;}_0x1791ba[_0x0b0a('0x18')](_0x480949);return _0x1791ba[_0x0b0a('0x1f')](_0x0b0a('0x20'),_0x51436b+'-'+_0xccec4c+'/'+_0x17310a)[_0x0b0a('0x1a')](_0x25f0c6);}return null;};}function patchUpdates(_0x16698a){return function(_0x5de9b5){try{jsonpatch[_0x0b0a('0x21')](_0x5de9b5,_0x16698a,!![]);}catch(_0x3e3e8a){return BPromise[_0x0b0a('0x22')](_0x3e3e8a);}return _0x5de9b5[_0x0b0a('0x23')]();};}function saveUpdates(_0x1fd2a0,_0x1ec9fb){return function(_0xc0ffb8){if(_0xc0ffb8){return _0xc0ffb8[_0x0b0a('0x24')](_0x1fd2a0)['then'](function(_0x16a90b){return _0x16a90b;});}return null;};}function removeEntity(_0x4f1ea4,_0x2024bd){return function(_0x212be4){if(_0x212be4){return _0x212be4['destroy']()[_0x0b0a('0x25')](function(){_0x4f1ea4[_0x0b0a('0x18')](0xcc)[_0x0b0a('0x19')]();});}};}function handleEntityNotFound(_0x1411fe,_0x128cbb){return function(_0x4928ff){if(!_0x4928ff){_0x1411fe[_0x0b0a('0x17')](0x194);}return _0x4928ff;};}function handleError(_0x44f71c,_0x55f5f9){_0x55f5f9=_0x55f5f9||0x1f4;return function(_0x143d43){logger['error'](_0x143d43[_0x0b0a('0x26')]);if(_0x143d43[_0x0b0a('0x27')]){delete _0x143d43[_0x0b0a('0x27')];}_0x44f71c['status'](_0x55f5f9)[_0x0b0a('0x28')](_0x143d43);};}exports[_0x0b0a('0x29')]=function(_0x3b6ac0,_0x5f2db0){var _0x361853={},_0x14d228={},_0xb9a201={'count':0x0,'rows':[]};var _0x12fcb8=_['map'](db[_0x0b0a('0x2a')][_0x0b0a('0x2b')],function(_0x2e44f1){return{'name':_0x2e44f1[_0x0b0a('0x2c')],'type':_0x2e44f1[_0x0b0a('0x2d')]['key']};});_0x14d228[_0x0b0a('0x2e')]=_['map'](_0x12fcb8,_0x0b0a('0x27'));_0x14d228[_0x0b0a('0x2f')]=_[_0x0b0a('0x30')](_0x3b6ac0['query']);_0x14d228[_0x0b0a('0x31')]=_[_0x0b0a('0x32')](_0x14d228[_0x0b0a('0x2e')],_0x14d228[_0x0b0a('0x2f')]);_0x361853[_0x0b0a('0x33')]=_[_0x0b0a('0x32')](_0x14d228[_0x0b0a('0x2e')],qs[_0x0b0a('0x34')](_0x3b6ac0[_0x0b0a('0x2f')]['fields']));_0x361853[_0x0b0a('0x33')]=_0x361853[_0x0b0a('0x33')][_0x0b0a('0x35')]?_0x361853[_0x0b0a('0x33')]:_0x14d228[_0x0b0a('0x2e')];if(!_0x3b6ac0[_0x0b0a('0x2f')]['hasOwnProperty'](_0x0b0a('0x36'))){_0x361853['limit']=qs['limit'](_0x3b6ac0[_0x0b0a('0x2f')][_0x0b0a('0x1c')]);_0x361853[_0x0b0a('0x1b')]=qs['offset'](_0x3b6ac0[_0x0b0a('0x2f')][_0x0b0a('0x1b')]);}_0x361853[_0x0b0a('0x37')]=qs[_0x0b0a('0x38')](_0x3b6ac0[_0x0b0a('0x2f')]['sort']);_0x361853[_0x0b0a('0x39')]=qs['filters'](_['pick'](_0x3b6ac0[_0x0b0a('0x2f')],_0x14d228[_0x0b0a('0x31')]),_0x12fcb8);if(_0x3b6ac0[_0x0b0a('0x2f')][_0x0b0a('0x3a')]){_0x361853[_0x0b0a('0x39')]=_[_0x0b0a('0x3b')](_0x361853[_0x0b0a('0x39')],{'$or':_[_0x0b0a('0x3c')](_0x12fcb8,function(_0x40b97b){if(_0x40b97b[_0x0b0a('0x2d')]!=='VIRTUAL'){var _0x146e6d={};_0x146e6d[_0x40b97b['name']]={'$like':'%'+_0x3b6ac0['query'][_0x0b0a('0x3a')]+'%'};return _0x146e6d;}})});}_0x361853=_[_0x0b0a('0x3b')]({},_0x361853,_0x3b6ac0[_0x0b0a('0x3d')]);var _0x2709eb={'where':_0x361853['where']};return db[_0x0b0a('0x2a')][_0x0b0a('0x1e')](_0x2709eb)['then'](function(_0x13f3e2){_0xb9a201[_0x0b0a('0x1e')]=_0x13f3e2;if(_0x3b6ac0[_0x0b0a('0x2f')][_0x0b0a('0x3e')]){_0x361853[_0x0b0a('0x3f')]=[{'all':!![]}];}return db[_0x0b0a('0x2a')][_0x0b0a('0x40')](_0x361853);})[_0x0b0a('0x25')](function(_0x2071d7){_0xb9a201['rows']=_0x2071d7;return _0xb9a201;})['then'](respondWithFilteredResult(_0x5f2db0,_0x361853))[_0x0b0a('0x41')](handleError(_0x5f2db0,null));};exports[_0x0b0a('0x42')]=function(_0x41c149,_0x17330c){var _0x33730f={'raw':![],'where':{'id':_0x41c149[_0x0b0a('0x43')]['id']}},_0x1f09df={};_0x1f09df[_0x0b0a('0x2e')]=_[_0x0b0a('0x30')](db[_0x0b0a('0x2a')][_0x0b0a('0x2b')]);_0x1f09df['query']=_[_0x0b0a('0x30')](_0x41c149['query']);_0x1f09df['filters']=_[_0x0b0a('0x32')](_0x1f09df['model'],_0x1f09df[_0x0b0a('0x2f')]);_0x33730f['attributes']=_[_0x0b0a('0x32')](_0x1f09df[_0x0b0a('0x2e')],qs[_0x0b0a('0x34')](_0x41c149['query'][_0x0b0a('0x34')]));_0x33730f[_0x0b0a('0x33')]=_0x33730f['attributes']['length']?_0x33730f[_0x0b0a('0x33')]:_0x1f09df[_0x0b0a('0x2e')];if(_0x41c149[_0x0b0a('0x2f')][_0x0b0a('0x3e')]){_0x33730f[_0x0b0a('0x3f')]=[{'all':!![]}];}_0x33730f=_[_0x0b0a('0x3b')]({},_0x33730f,_0x41c149['options']);return db[_0x0b0a('0x2a')][_0x0b0a('0x44')](_0x33730f)[_0x0b0a('0x25')](handleEntityNotFound(_0x17330c,null))[_0x0b0a('0x25')](respondWithResult(_0x17330c,null))[_0x0b0a('0x41')](handleError(_0x17330c,null));};exports[_0x0b0a('0x45')]=function(_0x4935a4,_0x3eb702){return db['FreshdeskConfiguration'][_0x0b0a('0x45')](_0x4935a4[_0x0b0a('0x46')],{})[_0x0b0a('0x25')](respondWithResult(_0x3eb702,0xc9))[_0x0b0a('0x41')](handleError(_0x3eb702,null));};exports['update']=function(_0x132537,_0x184bbf){if(_0x132537[_0x0b0a('0x46')]['id']){delete _0x132537[_0x0b0a('0x46')]['id'];}return db[_0x0b0a('0x2a')][_0x0b0a('0x44')]({'where':{'id':_0x132537[_0x0b0a('0x43')]['id']}})[_0x0b0a('0x25')](handleEntityNotFound(_0x184bbf,null))[_0x0b0a('0x25')](saveUpdates(_0x132537[_0x0b0a('0x46')],null))[_0x0b0a('0x25')](respondWithResult(_0x184bbf,null))[_0x0b0a('0x41')](handleError(_0x184bbf,null));};exports['destroy']=function(_0x3b6c64,_0x3f1707){return db[_0x0b0a('0x2a')][_0x0b0a('0x44')]({'where':{'id':_0x3b6c64['params']['id']}})['then'](handleEntityNotFound(_0x3f1707,null))['then'](removeEntity(_0x3f1707,null))[_0x0b0a('0x41')](handleError(_0x3f1707,null));};exports['getFields']=function(_0x30e6fd,_0x468ffa,_0x7372d2){var _0x5d809={};var _0x57e3cf={};var _0xe4e60d;var _0x727f39;return db[_0x0b0a('0x2a')]['findOne']({'where':{'id':_0x30e6fd['params']['id']}})[_0x0b0a('0x25')](handleEntityNotFound(_0x468ffa,null))[_0x0b0a('0x25')](function(_0x5d447f){if(_0x5d447f){_0xe4e60d=_0x5d447f;_0x57e3cf[_0x0b0a('0x2e')]=_[_0x0b0a('0x30')](db[_0x0b0a('0x47')]['rawAttributes']);_0x57e3cf[_0x0b0a('0x2f')]=_[_0x0b0a('0x30')](_0x30e6fd[_0x0b0a('0x2f')]);_0x57e3cf[_0x0b0a('0x31')]=_[_0x0b0a('0x32')](_0x57e3cf[_0x0b0a('0x2e')],_0x57e3cf['query']);_0x5d809[_0x0b0a('0x33')]=_['intersection'](_0x57e3cf['model'],qs['fields'](_0x30e6fd['query']['fields']));_0x5d809[_0x0b0a('0x33')]=_0x5d809[_0x0b0a('0x33')][_0x0b0a('0x35')]?_0x5d809[_0x0b0a('0x33')]:_0x57e3cf['model'];_0x5d809[_0x0b0a('0x37')]=qs[_0x0b0a('0x38')](_0x30e6fd[_0x0b0a('0x2f')]['sort']);_0x5d809[_0x0b0a('0x39')]=qs['filters'](_[_0x0b0a('0x48')](_0x30e6fd[_0x0b0a('0x2f')],_0x57e3cf[_0x0b0a('0x31')]));if(_0x30e6fd[_0x0b0a('0x2f')][_0x0b0a('0x3a')]){_0x5d809[_0x0b0a('0x39')]=_[_0x0b0a('0x3b')](_0x5d809['where'],{'$or':_[_0x0b0a('0x3c')](_0x5d809[_0x0b0a('0x33')],function(_0x5795ee){var _0x43221={};_0x43221[_0x5795ee]={'$like':'%'+_0x30e6fd[_0x0b0a('0x2f')][_0x0b0a('0x3a')]+'%'};return _0x43221;})});}_0x5d809=_[_0x0b0a('0x3b')]({},_0x5d809,_0x30e6fd['options']);return _0xe4e60d[_0x0b0a('0x49')](_0x5d809);}})[_0x0b0a('0x25')](function(_0x5b5c7a){if(_0x5b5c7a){_0x727f39=_0x5b5c7a[_0x0b0a('0x35')];if(!_0x30e6fd['query']['hasOwnProperty']('nolimit')){_0x5d809[_0x0b0a('0x1c')]=qs['limit'](_0x30e6fd['query'][_0x0b0a('0x1c')]);_0x5d809[_0x0b0a('0x1b')]=qs[_0x0b0a('0x1b')](_0x30e6fd['query']['offset']);}return _0xe4e60d[_0x0b0a('0x49')](_0x5d809);}})[_0x0b0a('0x25')](function(_0x495de2){if(_0x495de2){return _0x495de2?{'count':_0x727f39,'rows':_0x495de2}:null;}})['then'](respondWithResult(_0x468ffa,null))[_0x0b0a('0x41')](handleError(_0x468ffa,null));};exports[_0x0b0a('0x4a')]=function(_0x2d5068,_0x47f122,_0x407564){var _0x40332b={};var _0x4e2119={};var _0x5d791b;var _0x51c772;return db[_0x0b0a('0x2a')][_0x0b0a('0x4b')]({'where':{'id':_0x2d5068['params']['id']}})[_0x0b0a('0x25')](handleEntityNotFound(_0x47f122,null))[_0x0b0a('0x25')](function(_0x4e1311){if(_0x4e1311){_0x5d791b=_0x4e1311;_0x4e2119[_0x0b0a('0x2e')]=_[_0x0b0a('0x30')](db[_0x0b0a('0x47')][_0x0b0a('0x2b')]);_0x4e2119[_0x0b0a('0x2f')]=_[_0x0b0a('0x30')](_0x2d5068[_0x0b0a('0x2f')]);_0x4e2119['filters']=_[_0x0b0a('0x32')](_0x4e2119[_0x0b0a('0x2e')],_0x4e2119['query']);_0x40332b[_0x0b0a('0x33')]=_[_0x0b0a('0x32')](_0x4e2119[_0x0b0a('0x2e')],qs['fields'](_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x34')]));_0x40332b[_0x0b0a('0x33')]=_0x40332b['attributes'][_0x0b0a('0x35')]?_0x40332b[_0x0b0a('0x33')]:_0x4e2119['model'];_0x40332b[_0x0b0a('0x37')]=qs[_0x0b0a('0x38')](_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x38')]);_0x40332b['where']=qs[_0x0b0a('0x31')](_[_0x0b0a('0x48')](_0x2d5068[_0x0b0a('0x2f')],_0x4e2119[_0x0b0a('0x31')]));if(_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x3a')]){_0x40332b[_0x0b0a('0x39')]=_[_0x0b0a('0x3b')](_0x40332b['where'],{'$or':_[_0x0b0a('0x3c')](_0x40332b['attributes'],function(_0x4396ee){var _0x41ccb1={};_0x41ccb1[_0x4396ee]={'$like':'%'+_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x3a')]+'%'};return _0x41ccb1;})});}_0x40332b=_['merge']({},_0x40332b,_0x2d5068[_0x0b0a('0x3d')]);return _0x5d791b[_0x0b0a('0x4a')](_0x40332b);}})[_0x0b0a('0x25')](function(_0x50b424){if(_0x50b424){_0x51c772=_0x50b424[_0x0b0a('0x35')];if(!_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x4c')]('nolimit')){_0x40332b[_0x0b0a('0x1c')]=qs[_0x0b0a('0x1c')](_0x2d5068['query'][_0x0b0a('0x1c')]);_0x40332b[_0x0b0a('0x1b')]=qs['offset'](_0x2d5068[_0x0b0a('0x2f')][_0x0b0a('0x1b')]);}return _0x5d791b[_0x0b0a('0x4a')](_0x40332b);}})['then'](function(_0x17c95c){if(_0x17c95c){return _0x17c95c?{'count':_0x51c772,'rows':_0x17c95c}:null;}})['then'](respondWithResult(_0x47f122,null))[_0x0b0a('0x41')](handleError(_0x47f122,null));};exports['getDescriptions']=function(_0x25eec0,_0x583750,_0x3887e6){var _0x373744={};var _0x366e2f={};var _0x2a7e2b;var _0x20ee51;return db[_0x0b0a('0x2a')][_0x0b0a('0x4b')]({'where':{'id':_0x25eec0['params']['id']}})[_0x0b0a('0x25')](handleEntityNotFound(_0x583750,null))[_0x0b0a('0x25')](function(_0x712b5){if(_0x712b5){_0x2a7e2b=_0x712b5;_0x366e2f[_0x0b0a('0x2e')]=_[_0x0b0a('0x30')](db[_0x0b0a('0x47')][_0x0b0a('0x2b')]);_0x366e2f[_0x0b0a('0x2f')]=_[_0x0b0a('0x30')](_0x25eec0[_0x0b0a('0x2f')]);_0x366e2f['filters']=_[_0x0b0a('0x32')](_0x366e2f[_0x0b0a('0x2e')],_0x366e2f[_0x0b0a('0x2f')]);_0x373744['attributes']=_['intersection'](_0x366e2f['model'],qs[_0x0b0a('0x34')](_0x25eec0[_0x0b0a('0x2f')]['fields']));_0x373744[_0x0b0a('0x33')]=_0x373744['attributes']['length']?_0x373744['attributes']:_0x366e2f[_0x0b0a('0x2e')];_0x373744[_0x0b0a('0x37')]=qs[_0x0b0a('0x38')](_0x25eec0['query'][_0x0b0a('0x38')]);_0x373744['where']=qs['filters'](_[_0x0b0a('0x48')](_0x25eec0[_0x0b0a('0x2f')],_0x366e2f[_0x0b0a('0x31')]));if(_0x25eec0[_0x0b0a('0x2f')][_0x0b0a('0x3a')]){_0x373744['where']=_['merge'](_0x373744['where'],{'$or':_[_0x0b0a('0x3c')](_0x373744[_0x0b0a('0x33')],function(_0x5b0dcf){var _0x384288={};_0x384288[_0x5b0dcf]={'$like':'%'+_0x25eec0[_0x0b0a('0x2f')]['filter']+'%'};return _0x384288;})});}_0x373744=_[_0x0b0a('0x3b')]({},_0x373744,_0x25eec0[_0x0b0a('0x3d')]);return _0x2a7e2b[_0x0b0a('0x4d')](_0x373744);}})[_0x0b0a('0x25')](function(_0x367d45){if(_0x367d45){_0x20ee51=_0x367d45[_0x0b0a('0x35')];if(!_0x25eec0['query'][_0x0b0a('0x4c')]('nolimit')){_0x373744[_0x0b0a('0x1c')]=qs[_0x0b0a('0x1c')](_0x25eec0[_0x0b0a('0x2f')][_0x0b0a('0x1c')]);_0x373744[_0x0b0a('0x1b')]=qs[_0x0b0a('0x1b')](_0x25eec0['query'][_0x0b0a('0x1b')]);}return _0x2a7e2b[_0x0b0a('0x4d')](_0x373744);}})[_0x0b0a('0x25')](function(_0x283051){if(_0x283051){return _0x283051?{'count':_0x20ee51,'rows':_0x283051}:null;}})[_0x0b0a('0x25')](respondWithResult(_0x583750,null))[_0x0b0a('0x41')](handleError(_0x583750,null));};exports[_0x0b0a('0x4e')]=function(_0x2e241f,_0x58bd79,_0x2b4ede){var _0x197c60={};var _0x1101cd={};var _0x845230;var _0x43b4b3;return db[_0x0b0a('0x2a')][_0x0b0a('0x4b')]({'where':{'id':_0x2e241f[_0x0b0a('0x43')]['id']}})[_0x0b0a('0x25')](handleEntityNotFound(_0x58bd79,null))[_0x0b0a('0x25')](function(_0x4b142e){if(_0x4b142e){_0x845230=_0x4b142e;_0x1101cd[_0x0b0a('0x2e')]=_[_0x0b0a('0x30')](db['Tag'][_0x0b0a('0x2b')]);_0x1101cd[_0x0b0a('0x2f')]=_[_0x0b0a('0x30')](_0x2e241f['query']);_0x1101cd[_0x0b0a('0x31')]=_[_0x0b0a('0x32')](_0x1101cd['model'],_0x1101cd['query']);_0x197c60[_0x0b0a('0x33')]=_[_0x0b0a('0x32')](_0x1101cd['model'],qs[_0x0b0a('0x34')](_0x2e241f[_0x0b0a('0x2f')]['fields']));_0x197c60[_0x0b0a('0x33')]=_0x197c60[_0x0b0a('0x33')]['length']?_0x197c60[_0x0b0a('0x33')]:_0x1101cd['model'];_0x197c60['order']=qs[_0x0b0a('0x38')](_0x2e241f['query'][_0x0b0a('0x38')]);_0x197c60['where']=qs['filters'](_[_0x0b0a('0x48')](_0x2e241f['query'],_0x1101cd[_0x0b0a('0x31')]));if(_0x2e241f[_0x0b0a('0x2f')][_0x0b0a('0x3a')]){_0x197c60[_0x0b0a('0x39')]=_[_0x0b0a('0x3b')](_0x197c60['where'],{'$or':_[_0x0b0a('0x3c')](_0x197c60[_0x0b0a('0x33')],function(_0x215a0a){var _0x46268b={};_0x46268b[_0x215a0a]={'$like':'%'+_0x2e241f[_0x0b0a('0x2f')][_0x0b0a('0x3a')]+'%'};return _0x46268b;})});}_0x197c60=_[_0x0b0a('0x3b')]({},_0x197c60,_0x2e241f[_0x0b0a('0x3d')]);return _0x845230[_0x0b0a('0x4e')](_0x197c60);}})[_0x0b0a('0x25')](function(_0x4680f3){if(_0x4680f3){_0x43b4b3=_0x4680f3['length'];if(!_0x2e241f['query'][_0x0b0a('0x4c')](_0x0b0a('0x36'))){_0x197c60[_0x0b0a('0x1c')]=qs[_0x0b0a('0x1c')](_0x2e241f[_0x0b0a('0x2f')][_0x0b0a('0x1c')]);_0x197c60[_0x0b0a('0x1b')]=qs[_0x0b0a('0x1b')](_0x2e241f[_0x0b0a('0x2f')]['offset']);}return _0x845230[_0x0b0a('0x4e')](_0x197c60);}})['then'](function(_0x3634b7){if(_0x3634b7){return _0x3634b7?{'count':_0x43b4b3,'rows':_0x3634b7}:null;}})[_0x0b0a('0x25')](respondWithResult(_0x58bd79,null))[_0x0b0a('0x41')](handleError(_0x58bd79,null));};exports[_0x0b0a('0x4f')]=function(_0x338985,_0x3eddcc,_0x175bd7){if(_0x338985[_0x0b0a('0x46')]['id']){delete _0x338985[_0x0b0a('0x46')]['id'];}return db[_0x0b0a('0x2a')][_0x0b0a('0x4b')]({'where':{'id':_0x338985['params']['id']}})['then'](handleEntityNotFound(_0x3eddcc,null))[_0x0b0a('0x25')](function(_0x535d8b){if(_0x535d8b){return _0x535d8b[_0x0b0a('0x4f')](_0x338985[_0x0b0a('0x46')][_0x0b0a('0x50')]||[]);}return null;})[_0x0b0a('0x25')](respondWithResult(_0x3eddcc,null))['catch'](handleError(_0x3eddcc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cd2e51f..6d48c89 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 _0xe491=['util','../../config/logger','api','moment','bluebird','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x26e69b,_0xcdb05a){var _0x3648a1=function(_0x32bd22){while(--_0x32bd22){_0x26e69b['push'](_0x26e69b['shift']());}};_0x3648a1(++_0xcdb05a);}(_0xe491,0x197));var _0x1e49=function(_0xed8148,_0x54464d){_0xed8148=_0xed8148-0x0;var _0x16bbcc=_0xe491[_0xed8148];return _0x16bbcc;};'use strict';var _=require(_0x1e49('0x0'));var util=require(_0x1e49('0x1'));var logger=require(_0x1e49('0x2'))(_0x1e49('0x3'));var moment=require(_0x1e49('0x4'));var BPromise=require(_0x1e49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e49('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e49('0x7'));module[_0x1e49('0x8')]=function(_0x5d631b,_0x5b8433){return _0x5d631b[_0x1e49('0x9')](_0x1e49('0xa'),attributes,{'tableName':_0x1e49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecfd=['FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xecfd,0x199));var _0xdecf=function(_0x4c4f54,_0x55c818){_0x4c4f54=_0x4c4f54-0x0;var _0x2a888c=_0xecfd[_0x4c4f54];return _0x2a888c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdecf('0x0'))('api');var moment=require(_0xdecf('0x1'));var BPromise=require(_0xdecf('0x2'));var rp=require(_0xdecf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdecf('0x4'));var config=require(_0xdecf('0x5'));var attributes=require(_0xdecf('0x6'));module[_0xdecf('0x7')]=function(_0x1bb905,_0x11a3f5){return _0x1bb905[_0xdecf('0x8')](_0xdecf('0x9'),attributes,{'tableName':_0xdecf('0xa'),'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 8735c59..df456b8 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 _0x2fdd=['moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0xce77c8,_0x41931d){var _0x5bfc85=function(_0xa8753a){while(--_0xa8753a){_0xce77c8['push'](_0xce77c8['shift']());}};_0x5bfc85(++_0x41931d);}(_0x2fdd,0x1a2));var _0xd2fd=function(_0x127996,_0x1a85f3){_0x127996=_0x127996-0x0;var _0x3ea21e=_0x2fdd[_0x127996];return _0x3ea21e;};'use strict';var _=require(_0xd2fd('0x0'));var util=require(_0xd2fd('0x1'));var moment=require(_0xd2fd('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2fd('0x3'));var fs=require('fs');var Redis=require(_0xd2fd('0x4'));var db=require(_0xd2fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd2fd('0x6'));var jayson=require(_0xd2fd('0x7'));var client=jayson[_0xd2fd('0x8')][_0xd2fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x102a1e,_0x4a5ad1,_0x436723){return new BPromise(function(_0x5d99ca,_0x440d11){return client['request'](_0x102a1e,_0x436723)[_0xd2fd('0xa')](function(_0x35a545){logger['info'](_0xd2fd('0xb'),_0x4a5ad1,_0xd2fd('0xc'));logger['debug'](_0xd2fd('0xd'),_0x4a5ad1,_0xd2fd('0xc'),JSON[_0xd2fd('0xe')](_0x35a545));if(_0x35a545[_0xd2fd('0xf')]){if(_0x35a545[_0xd2fd('0xf')]['code']===0x1f4){logger[_0xd2fd('0xf')](_0xd2fd('0xb'),_0x4a5ad1,_0x35a545[_0xd2fd('0xf')][_0xd2fd('0x10')]);return _0x440d11(_0x35a545[_0xd2fd('0xf')]['message']);}logger[_0xd2fd('0xf')](_0xd2fd('0xb'),_0x4a5ad1,_0x35a545[_0xd2fd('0xf')][_0xd2fd('0x10')]);return _0x5d99ca(_0x35a545[_0xd2fd('0xf')][_0xd2fd('0x10')]);}else{logger[_0xd2fd('0x11')](_0xd2fd('0xb'),_0x4a5ad1,_0xd2fd('0xc'));_0x5d99ca(_0x35a545[_0xd2fd('0x12')][_0xd2fd('0x10')]);}})[_0xd2fd('0x13')](function(_0x54010b){logger[_0xd2fd('0xf')](_0xd2fd('0xb'),_0x4a5ad1,_0x54010b);_0x440d11(_0x54010b);});});} \ No newline at end of file +var _0xdaec=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c3e7b,_0x53259c){var _0x18234e=function(_0x14c1fe){while(--_0x14c1fe){_0x5c3e7b['push'](_0x5c3e7b['shift']());}};_0x18234e(++_0x53259c);}(_0xdaec,0xda));var _0xcdae=function(_0x57d5c1,_0x55a5ef){_0x57d5c1=_0x57d5c1-0x0;var _0x4347c1=_0xdaec[_0x57d5c1];return _0x4347c1;};'use strict';var _=require(_0xcdae('0x0'));var util=require('util');var moment=require(_0xcdae('0x1'));var BPromise=require('bluebird');var rs=require(_0xcdae('0x2'));var fs=require('fs');var Redis=require(_0xcdae('0x3'));var db=require(_0xcdae('0x4'))['db'];var utils=require(_0xcdae('0x5'));var logger=require(_0xcdae('0x6'))(_0xcdae('0x7'));var config=require(_0xcdae('0x8'));var jayson=require(_0xcdae('0x9'));var client=jayson[_0xcdae('0xa')][_0xcdae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af7cb,_0x11b292,_0x4832ec){return new BPromise(function(_0x5a0306,_0x132833){return client[_0xcdae('0xc')](_0x3af7cb,_0x4832ec)[_0xcdae('0xd')](function(_0x1e8f39){logger[_0xcdae('0xe')](_0xcdae('0xf'),_0x11b292,_0xcdae('0x10'));logger['debug'](_0xcdae('0x11'),_0x11b292,_0xcdae('0x10'),JSON[_0xcdae('0x12')](_0x1e8f39));if(_0x1e8f39['error']){if(_0x1e8f39[_0xcdae('0x13')]['code']===0x1f4){logger[_0xcdae('0x13')](_0xcdae('0xf'),_0x11b292,_0x1e8f39[_0xcdae('0x13')]['message']);return _0x132833(_0x1e8f39[_0xcdae('0x13')][_0xcdae('0x14')]);}logger[_0xcdae('0x13')](_0xcdae('0xf'),_0x11b292,_0x1e8f39[_0xcdae('0x13')][_0xcdae('0x14')]);return _0x5a0306(_0x1e8f39['error']['message']);}else{logger[_0xcdae('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11b292,'request\x20sent');_0x5a0306(_0x1e8f39[_0xcdae('0x15')][_0xcdae('0x14')]);}})[_0xcdae('0x16')](function(_0x2172f1){logger[_0xcdae('0x13')](_0xcdae('0xf'),_0x11b292,_0x2172f1);_0x132833(_0x2172f1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ca269c2..44ccb4c 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 _0xfba9=['create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post'];(function(_0x36b72d,_0x589e01){var _0x16d057=function(_0x49e194){while(--_0x49e194){_0x36b72d['push'](_0x36b72d['shift']());}};_0x16d057(++_0x589e01);}(_0xfba9,0x1d2));var _0x9fba=function(_0x4fbd61,_0x4d0605){_0x4fbd61=_0x4fbd61-0x0;var _0x579ea5=_0xfba9[_0x4fbd61];return _0x579ea5;};'use strict';var multer=require('multer');var util=require(_0x9fba('0x0'));var path=require(_0x9fba('0x1'));var timeout=require(_0x9fba('0x2'));var express=require(_0x9fba('0x3'));var router=express[_0x9fba('0x4')]();var fs_extra=require(_0x9fba('0x5'));var auth=require(_0x9fba('0x6'));var interaction=require(_0x9fba('0x7'));var config=require('../../config/environment');var controller=require(_0x9fba('0x8'));router[_0x9fba('0x9')]('/',auth[_0x9fba('0xa')](),controller[_0x9fba('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9fba('0xc')]);router[_0x9fba('0xd')]('/',auth[_0x9fba('0xa')](),controller[_0x9fba('0xe')]);router[_0x9fba('0xf')](_0x9fba('0x10'),auth[_0x9fba('0xa')](),controller[_0x9fba('0x11')]);router[_0x9fba('0x12')]('/:id',auth[_0x9fba('0xa')](),controller[_0x9fba('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa5a8=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x24f052,_0x2d48e6){var _0x26d48f=function(_0x1c4be5){while(--_0x1c4be5){_0x24f052['push'](_0x24f052['shift']());}};_0x26d48f(++_0x2d48e6);}(_0xa5a8,0x18a));var _0x8a5a=function(_0x349c9f,_0x3d4703){_0x349c9f=_0x349c9f-0x0;var _0x108243=_0xa5a8[_0x349c9f];return _0x108243;};'use strict';var multer=require(_0x8a5a('0x0'));var util=require(_0x8a5a('0x1'));var path=require(_0x8a5a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a5a('0x3'));var router=express[_0x8a5a('0x4')]();var fs_extra=require(_0x8a5a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a5a('0x6'));var config=require(_0x8a5a('0x7'));var controller=require(_0x8a5a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a5a('0x9')]);router[_0x8a5a('0xa')](_0x8a5a('0xb'),auth['isAuthenticated'](),controller[_0x8a5a('0xc')]);router[_0x8a5a('0xd')]('/',auth[_0x8a5a('0xe')](),controller[_0x8a5a('0xf')]);router[_0x8a5a('0x10')](_0x8a5a('0xb'),auth[_0x8a5a('0xe')](),controller[_0x8a5a('0x11')]);router[_0x8a5a('0x12')](_0x8a5a('0xb'),auth[_0x8a5a('0xe')](),controller['destroy']);module[_0x8a5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a8c8838..485793d 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 _0xc99c=['picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x5e3bb1,_0x3cfe7c){var _0x4c1278=function(_0x124955){while(--_0x124955){_0x5e3bb1['push'](_0x5e3bb1['shift']());}};_0x4c1278(++_0x3cfe7c);}(_0xc99c,0x174));var _0xcc99=function(_0x4550a0,_0x3abd86){_0x4550a0=_0x4550a0-0x0;var _0x42246b=_0xc99c[_0x4550a0];return _0x42246b;};'use strict';var Sequelize=require(_0xcc99('0x0'));module[_0xcc99('0x1')]={'type':{'type':Sequelize[_0xcc99('0x2')](_0xcc99('0x3'),'variable',_0xcc99('0x4'),_0xcc99('0x5'),_0xcc99('0x6')),'defaultValue':_0xcc99('0x3')},'content':{'type':Sequelize[_0xcc99('0x7')]},'key':{'type':Sequelize[_0xcc99('0x7')]},'keyType':{'type':Sequelize[_0xcc99('0x2')](_0xcc99('0x3'),_0xcc99('0x8'),_0xcc99('0x4'))},'keyContent':{'type':Sequelize[_0xcc99('0x7')]},'idField':{'type':Sequelize[_0xcc99('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc99('0x7')]}}; \ No newline at end of file +var _0x41c9=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x36d2ef,_0x5095e6){var _0x2c2da6=function(_0x4944b7){while(--_0x4944b7){_0x36d2ef['push'](_0x36d2ef['shift']());}};_0x2c2da6(++_0x5095e6);}(_0x41c9,0xf6));var _0x941c=function(_0xc9139b,_0x298b58){_0xc9139b=_0xc9139b-0x0;var _0x3904ba=_0x41c9[_0xc9139b];return _0x3904ba;};'use strict';var Sequelize=require(_0x941c('0x0'));module['exports']={'type':{'type':Sequelize[_0x941c('0x1')](_0x941c('0x2'),_0x941c('0x3'),_0x941c('0x4'),_0x941c('0x5'),'picklist'),'defaultValue':_0x941c('0x2')},'content':{'type':Sequelize[_0x941c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x941c('0x1')](_0x941c('0x2'),_0x941c('0x3'),_0x941c('0x4'))},'keyContent':{'type':Sequelize[_0x941c('0x6')]},'idField':{'type':Sequelize[_0x941c('0x6')]},'nameField':{'type':Sequelize[_0x941c('0x6')]},'customField':{'type':Sequelize[_0x941c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x941c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e20326b..cf13281 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 _0xd87e=['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','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x549d5b,_0x52d808){var _0x2f9cc6=function(_0x115d2f){while(--_0x115d2f){_0x549d5b['push'](_0x549d5b['shift']());}};_0x2f9cc6(++_0x52d808);}(_0xd87e,0x1bf));var _0xed87=function(_0x3132c4,_0x321a8d){_0x3132c4=_0x3132c4-0x0;var _0xb0d3c=_0xd87e[_0x3132c4];return _0xb0d3c;};'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'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){_0x3d1641['status'](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x3c22b7,_0x41e0d4){return function(_0x320bcc){if(!_0x320bcc){_0x3c22b7[_0xed87('0x18')](0x194);}return _0x320bcc;};}function handleError(_0x289e38,_0x25a6f7){_0x25a6f7=_0x25a6f7||0x1f4;return function(_0x4735b3){logger[_0xed87('0x25')](_0x4735b3[_0xed87('0x26')]);if(_0x4735b3[_0xed87('0x27')]){delete _0x4735b3[_0xed87('0x27')];}_0x289e38[_0xed87('0x19')](_0x25a6f7)[_0xed87('0x28')](_0x4735b3);};}exports['index']=function(_0xb32b1c,_0x1c4a65){var _0x4eaa44={},_0x3dff74={},_0x33c367={'count':0x0,'rows':[]};var _0x21c93b=_['map'](db['FreshdeskField'][_0xed87('0x29')],function(_0x428b75){return{'name':_0x428b75[_0xed87('0x2a')],'type':_0x428b75['type'][_0xed87('0x2b')]};});_0x3dff74[_0xed87('0x2c')]=_[_0xed87('0x2d')](_0x21c93b,_0xed87('0x27'));_0x3dff74[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0xb32b1c[_0xed87('0x2e')]);_0x3dff74[_0xed87('0x30')]=_[_0xed87('0x31')](_0x3dff74['model'],_0x3dff74[_0xed87('0x2e')]);_0x4eaa44[_0xed87('0x32')]=_['intersection'](_0x3dff74[_0xed87('0x2c')],qs['fields'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x4eaa44[_0xed87('0x32')]=_0x4eaa44[_0xed87('0x32')][_0xed87('0x34')]?_0x4eaa44[_0xed87('0x32')]:_0x3dff74[_0xed87('0x2c')];if(!_0xb32b1c[_0xed87('0x2e')][_0xed87('0x35')](_0xed87('0x36'))){_0x4eaa44[_0xed87('0x1e')]=qs['limit'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x1e')]);_0x4eaa44['offset']=qs[_0xed87('0x1c')](_0xb32b1c['query'][_0xed87('0x1c')]);}_0x4eaa44[_0xed87('0x37')]=qs['sort'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x38')]);_0x4eaa44[_0xed87('0x39')]=qs[_0xed87('0x30')](_[_0xed87('0x3a')](_0xb32b1c['query'],_0x3dff74[_0xed87('0x30')]),_0x21c93b);if(_0xb32b1c['query'][_0xed87('0x3b')]){_0x4eaa44['where']=_[_0xed87('0x3c')](_0x4eaa44[_0xed87('0x39')],{'$or':_[_0xed87('0x2d')](_0x21c93b,function(_0x217435){if(_0x217435[_0xed87('0x3d')]!==_0xed87('0x3e')){var _0x9e3356={};_0x9e3356[_0x217435[_0xed87('0x27')]]={'$like':'%'+_0xb32b1c[_0xed87('0x2e')]['filter']+'%'};return _0x9e3356;}})});}_0x4eaa44=_['merge']({},_0x4eaa44,_0xb32b1c[_0xed87('0x3f')]);var _0x206544={'where':_0x4eaa44[_0xed87('0x39')]};return db[_0xed87('0x40')][_0xed87('0x1f')](_0x206544)[_0xed87('0x23')](function(_0x5d1bd0){_0x33c367[_0xed87('0x1f')]=_0x5d1bd0;if(_0xb32b1c[_0xed87('0x2e')][_0xed87('0x41')]){_0x4eaa44['include']=[{'all':!![]}];}return db[_0xed87('0x40')][_0xed87('0x42')](_0x4eaa44);})[_0xed87('0x23')](function(_0x1b0092){_0x33c367[_0xed87('0x43')]=_0x1b0092;return _0x33c367;})[_0xed87('0x23')](respondWithFilteredResult(_0x1c4a65,_0x4eaa44))[_0xed87('0x44')](handleError(_0x1c4a65,null));};exports[_0xed87('0x45')]=function(_0x35bd1c,_0x406b73){var _0x5c6925={'raw':!![],'where':{'id':_0x35bd1c[_0xed87('0x46')]['id']}},_0x7e6cbb={};_0x7e6cbb[_0xed87('0x2c')]=_['keys'](db['FreshdeskField'][_0xed87('0x29')]);_0x7e6cbb[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0x35bd1c[_0xed87('0x2e')]);_0x7e6cbb['filters']=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],_0x7e6cbb['query']);_0x5c6925[_0xed87('0x32')]=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],qs[_0xed87('0x33')](_0x35bd1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x5c6925[_0xed87('0x32')]=_0x5c6925[_0xed87('0x32')][_0xed87('0x34')]?_0x5c6925[_0xed87('0x32')]:_0x7e6cbb[_0xed87('0x2c')];if(_0x35bd1c['query'][_0xed87('0x41')]){_0x5c6925[_0xed87('0x47')]=[{'all':!![]}];}_0x5c6925=_[_0xed87('0x3c')]({},_0x5c6925,_0x35bd1c[_0xed87('0x3f')]);return db[_0xed87('0x40')][_0xed87('0x48')](_0x5c6925)[_0xed87('0x23')](handleEntityNotFound(_0x406b73,null))[_0xed87('0x23')](respondWithResult(_0x406b73,null))[_0xed87('0x44')](handleError(_0x406b73,null));};exports[_0xed87('0x49')]=function(_0x8aa499,_0x26c8f4){return db[_0xed87('0x40')][_0xed87('0x49')](_0x8aa499[_0xed87('0x4a')],{})[_0xed87('0x23')](respondWithResult(_0x26c8f4,0xc9))[_0xed87('0x44')](handleError(_0x26c8f4,null));};exports['update']=function(_0x2c7bef,_0x1a68a7){if(_0x2c7bef[_0xed87('0x4a')]['id']){delete _0x2c7bef['body']['id'];}return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x2c7bef['params']['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x1a68a7,null))[_0xed87('0x23')](saveUpdates(_0x2c7bef[_0xed87('0x4a')],null))[_0xed87('0x23')](respondWithResult(_0x1a68a7,null))['catch'](handleError(_0x1a68a7,null));};exports[_0xed87('0x24')]=function(_0x436e15,_0x3ca34c){return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x436e15[_0xed87('0x46')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3ca34c,null))[_0xed87('0x23')](removeEntity(_0x3ca34c,null))[_0xed87('0x44')](handleError(_0x3ca34c,null));}; \ No newline at end of file +var _0x1bca=['index','map','fieldName','key','model','keys','filters','intersection','fields','attributes','query','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','FreshdeskField','body','find','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send'];(function(_0x3cfc6e,_0x570fb1){var _0x27f848=function(_0x2cc428){while(--_0x2cc428){_0x3cfc6e['push'](_0x3cfc6e['shift']());}};_0x27f848(++_0x570fb1);}(_0x1bca,0xb6));var _0xa1bc=function(_0x61d9c8,_0x46dc82){_0x61d9c8=_0x61d9c8-0x0;var _0x20319e=_0x1bca[_0x61d9c8];return _0x20319e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){_0x44f952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc2e0,_0x3a87f4){return function(_0x5eff38){if(!_0x5eff38){_0x3cc2e0[_0xa1bc('0x17')](0x194);}return _0x5eff38;};}function handleError(_0x31d31c,_0x14e37b){_0x14e37b=_0x14e37b||0x1f4;return function(_0x2a0348){logger[_0xa1bc('0x25')](_0x2a0348[_0xa1bc('0x26')]);if(_0x2a0348['name']){delete _0x2a0348['name'];}_0x31d31c[_0xa1bc('0x18')](_0x14e37b)[_0xa1bc('0x27')](_0x2a0348);};}exports[_0xa1bc('0x28')]=function(_0x1270f5,_0x16a9d7){var _0x4ae5d0={},_0x228fc8={},_0x512608={'count':0x0,'rows':[]};var _0x332201=_[_0xa1bc('0x29')](db['FreshdeskField']['rawAttributes'],function(_0x4a120c){return{'name':_0x4a120c[_0xa1bc('0x2a')],'type':_0x4a120c['type'][_0xa1bc('0x2b')]};});_0x228fc8[_0xa1bc('0x2c')]=_[_0xa1bc('0x29')](_0x332201,'name');_0x228fc8['query']=_[_0xa1bc('0x2d')](_0x1270f5['query']);_0x228fc8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x228fc8[_0xa1bc('0x2c')],_0x228fc8['query']);_0x4ae5d0['attributes']=_['intersection'](_0x228fc8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x1270f5['query'][_0xa1bc('0x30')]));_0x4ae5d0[_0xa1bc('0x31')]=_0x4ae5d0[_0xa1bc('0x31')]['length']?_0x4ae5d0[_0xa1bc('0x31')]:_0x228fc8[_0xa1bc('0x2c')];if(!_0x1270f5[_0xa1bc('0x32')]['hasOwnProperty'](_0xa1bc('0x33'))){_0x4ae5d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x1d')]);_0x4ae5d0[_0xa1bc('0x1b')]=qs[_0xa1bc('0x1b')](_0x1270f5[_0xa1bc('0x32')]['offset']);}_0x4ae5d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x35')]);_0x4ae5d0['where']=qs[_0xa1bc('0x2e')](_[_0xa1bc('0x36')](_0x1270f5['query'],_0x228fc8[_0xa1bc('0x2e')]),_0x332201);if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]){_0x4ae5d0[_0xa1bc('0x38')]=_[_0xa1bc('0x39')](_0x4ae5d0['where'],{'$or':_[_0xa1bc('0x29')](_0x332201,function(_0x14c645){if(_0x14c645[_0xa1bc('0x3a')]!==_0xa1bc('0x3b')){var _0x3abf84={};_0x3abf84[_0x14c645['name']]={'$like':'%'+_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]+'%'};return _0x3abf84;}})});}_0x4ae5d0=_[_0xa1bc('0x39')]({},_0x4ae5d0,_0x1270f5[_0xa1bc('0x3c')]);var _0xf9b275={'where':_0x4ae5d0['where']};return db['FreshdeskField']['count'](_0xf9b275)[_0xa1bc('0x24')](function(_0x57160e){_0x512608[_0xa1bc('0x1e')]=_0x57160e;if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x3d')]){_0x4ae5d0[_0xa1bc('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa1bc('0x3f')](_0x4ae5d0);})['then'](function(_0x482d37){_0x512608[_0xa1bc('0x40')]=_0x482d37;return _0x512608;})['then'](respondWithFilteredResult(_0x16a9d7,_0x4ae5d0))[_0xa1bc('0x41')](handleError(_0x16a9d7,null));};exports[_0xa1bc('0x42')]=function(_0x5d6c5c,_0x1d8e3c){var _0x5cd49d={'raw':!![],'where':{'id':_0x5d6c5c[_0xa1bc('0x43')]['id']}},_0x1544c8={};_0x1544c8[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db['FreshdeskField'][_0xa1bc('0x44')]);_0x1544c8[_0xa1bc('0x32')]=_['keys'](_0x5d6c5c[_0xa1bc('0x32')]);_0x1544c8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],_0x1544c8[_0xa1bc('0x32')]);_0x5cd49d[_0xa1bc('0x31')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x5d6c5c[_0xa1bc('0x32')][_0xa1bc('0x30')]));_0x5cd49d[_0xa1bc('0x31')]=_0x5cd49d[_0xa1bc('0x31')][_0xa1bc('0x45')]?_0x5cd49d['attributes']:_0x1544c8[_0xa1bc('0x2c')];if(_0x5d6c5c['query'][_0xa1bc('0x3d')]){_0x5cd49d[_0xa1bc('0x3e')]=[{'all':!![]}];}_0x5cd49d=_[_0xa1bc('0x39')]({},_0x5cd49d,_0x5d6c5c[_0xa1bc('0x3c')]);return db['FreshdeskField']['find'](_0x5cd49d)['then'](handleEntityNotFound(_0x1d8e3c,null))['then'](respondWithResult(_0x1d8e3c,null))['catch'](handleError(_0x1d8e3c,null));};exports[_0xa1bc('0x46')]=function(_0x5cc542,_0x2dfad5){return db[_0xa1bc('0x47')][_0xa1bc('0x46')](_0x5cc542[_0xa1bc('0x48')],{})['then'](respondWithResult(_0x2dfad5,0xc9))[_0xa1bc('0x41')](handleError(_0x2dfad5,null));};exports[_0xa1bc('0x22')]=function(_0x3fa784,_0x3eb3d7){if(_0x3fa784[_0xa1bc('0x48')]['id']){delete _0x3fa784['body']['id'];}return db[_0xa1bc('0x47')][_0xa1bc('0x49')]({'where':{'id':_0x3fa784[_0xa1bc('0x43')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x3eb3d7,null))['then'](saveUpdates(_0x3fa784['body'],null))['then'](respondWithResult(_0x3eb3d7,null))[_0xa1bc('0x41')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x23')]=function(_0x5b3b1,_0x274684){return db[_0xa1bc('0x47')]['find']({'where':{'id':_0x5b3b1['params']['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x274684,null))[_0xa1bc('0x24')](removeEntity(_0x274684,null))[_0xa1bc('0x41')](handleError(_0x274684,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5fbad0c..7f200b9 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 _0x93e9=['api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x93e9,0x7b));var _0x993e=function(_0x4fcb48,_0x2bce5a){_0x4fcb48=_0x4fcb48-0x0;var _0x3316a2=_0x93e9[_0x4fcb48];return _0x3316a2;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require(_0x993e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x16d10c,_0x438e51){return _0x16d10c[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x993e('0xc'),_0x993e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4369=['./intFreshdeskField.attributes','exports','define','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x114373,_0x1b9f2d){var _0x403f3d=function(_0x978d49){while(--_0x978d49){_0x114373['push'](_0x114373['shift']());}};_0x403f3d(++_0x1b9f2d);}(_0x4369,0x147));var _0x9436=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x4369[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0x9436('0x0'));var util=require(_0x9436('0x1'));var logger=require(_0x9436('0x2'))(_0x9436('0x3'));var moment=require(_0x9436('0x4'));var BPromise=require(_0x9436('0x5'));var rp=require(_0x9436('0x6'));var fs=require('fs');var path=require(_0x9436('0x7'));var rimraf=require(_0x9436('0x8'));var config=require('../../config/environment');var attributes=require(_0x9436('0x9'));module[_0x9436('0xa')]=function(_0x499f50,_0x3f0b52){return _0x499f50[_0x9436('0xb')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x9436('0xc'),'fields':[_0x9436('0xd'),'FieldId'],'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 05ae5b6..610f794 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 _0x7e7b=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e7b,0x95));var _0xb7e7=function(_0x2b58f2,_0x1171bc){_0x2b58f2=_0x2b58f2-0x0;var _0x445144=_0x7e7b[_0x2b58f2];return _0x445144;};'use strict';var _=require(_0xb7e7('0x0'));var util=require(_0xb7e7('0x1'));var moment=require(_0xb7e7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7e7('0x3'));var db=require(_0xb7e7('0x4'))['db'];var utils=require(_0xb7e7('0x5'));var logger=require(_0xb7e7('0x6'))('rpc');var config=require(_0xb7e7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb7e7('0x8')][_0xb7e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x465ae1,_0x282c2f,_0x5998b7){return new BPromise(function(_0x129b03,_0x4d3e12){return client[_0xb7e7('0xa')](_0x465ae1,_0x5998b7)[_0xb7e7('0xb')](function(_0x4c7819){logger[_0xb7e7('0xc')](_0xb7e7('0xd'),_0x282c2f,_0xb7e7('0xe'));logger[_0xb7e7('0xf')](_0xb7e7('0x10'),_0x282c2f,_0xb7e7('0xe'),JSON['stringify'](_0x4c7819));if(_0x4c7819[_0xb7e7('0x11')]){if(_0x4c7819[_0xb7e7('0x11')]['code']===0x1f4){logger[_0xb7e7('0x11')](_0xb7e7('0xd'),_0x282c2f,_0x4c7819[_0xb7e7('0x11')][_0xb7e7('0x12')]);return _0x4d3e12(_0x4c7819[_0xb7e7('0x11')]['message']);}logger[_0xb7e7('0x11')](_0xb7e7('0xd'),_0x282c2f,_0x4c7819[_0xb7e7('0x11')]['message']);return _0x129b03(_0x4c7819[_0xb7e7('0x11')][_0xb7e7('0x12')]);}else{logger[_0xb7e7('0xc')](_0xb7e7('0xd'),_0x282c2f,_0xb7e7('0xe'));_0x129b03(_0x4c7819['result'][_0xb7e7('0x12')]);}})[_0xb7e7('0x13')](function(_0x1afa84){logger[_0xb7e7('0x11')](_0xb7e7('0xd'),_0x282c2f,_0x1afa84);_0x4d3e12(_0x1afa84);});});} \ No newline at end of file +var _0x09ba=['FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4495b6,_0x1660d5){var _0x2ff893=function(_0x381027){while(--_0x381027){_0x4495b6['push'](_0x4495b6['shift']());}};_0x2ff893(++_0x1660d5);}(_0x09ba,0x1be));var _0xa09b=function(_0x124ca2,_0x5d5659){_0x124ca2=_0x124ca2-0x0;var _0x329cda=_0x09ba[_0x124ca2];return _0x329cda;};'use strict';var _=require(_0xa09b('0x0'));var util=require(_0xa09b('0x1'));var moment=require(_0xa09b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa09b('0x3'));var fs=require('fs');var Redis=require(_0xa09b('0x4'));var db=require(_0xa09b('0x5'))['db'];var utils=require(_0xa09b('0x6'));var logger=require(_0xa09b('0x7'))(_0xa09b('0x8'));var config=require(_0xa09b('0x9'));var jayson=require(_0xa09b('0xa'));var client=jayson[_0xa09b('0xb')][_0xa09b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x470bae,_0x32e0ed,_0x524b96){return new BPromise(function(_0x2d57c6,_0x2245a7){return client[_0xa09b('0xd')](_0x470bae,_0x524b96)[_0xa09b('0xe')](function(_0x49e664){logger[_0xa09b('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x32e0ed,_0xa09b('0x10'));logger[_0xa09b('0x11')](_0xa09b('0x12'),_0x32e0ed,_0xa09b('0x10'),JSON[_0xa09b('0x13')](_0x49e664));if(_0x49e664[_0xa09b('0x14')]){if(_0x49e664[_0xa09b('0x14')][_0xa09b('0x15')]===0x1f4){logger[_0xa09b('0x14')](_0xa09b('0x16'),_0x32e0ed,_0x49e664[_0xa09b('0x14')][_0xa09b('0x17')]);return _0x2245a7(_0x49e664[_0xa09b('0x14')]['message']);}logger['error'](_0xa09b('0x16'),_0x32e0ed,_0x49e664['error']['message']);return _0x2d57c6(_0x49e664[_0xa09b('0x14')][_0xa09b('0x17')]);}else{logger[_0xa09b('0xf')](_0xa09b('0x16'),_0x32e0ed,_0xa09b('0x10'));_0x2d57c6(_0x49e664[_0xa09b('0x18')][_0xa09b('0x17')]);}})[_0xa09b('0x19')](function(_0x502dd6){logger['error'](_0xa09b('0x16'),_0x32e0ed,_0x502dd6);_0x2245a7(_0x502dd6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9c38150..29b3773 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 _0x0102=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','util','path','connect-timeout','express','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0x0102,0x186));var _0x2010=function(_0x51cdc7,_0xd43e13){_0x51cdc7=_0x51cdc7-0x0;var _0x4a754c=_0x0102[_0x51cdc7];return _0x4a754c;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();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(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id/configurations',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0xe')]);router[_0x2010('0xd')](_0x2010('0xf'),auth[_0x2010('0x6')](),controller[_0x2010('0x10')]);router[_0x2010('0x11')](_0x2010('0x8'),auth[_0x2010('0x6')](),controller['update']);router['delete'](_0x2010('0x8'),auth[_0x2010('0x6')](),controller[_0x2010('0x12')]);module[_0x2010('0x13')]=router; \ No newline at end of file +var _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','destroy','path','connect-timeout','express','fs-extra'];(function(_0x1e40da,_0x505367){var _0x1e13c9=function(_0x4d6546){while(--_0x4d6546){_0x1e40da['push'](_0x1e40da['shift']());}};_0x1e13c9(++_0x505367);}(_0x4522,0x1a0));var _0x2452=function(_0x1f3b93,_0x5e92d3){_0x1f3b93=_0x1f3b93-0x0;var _0x4b44e3=_0x4522[_0x1f3b93];return _0x4b44e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['get']('/:id/fields',auth[_0x2452('0x9')](),controller['getFields']);router['post']('/',auth[_0x2452('0x9')](),controller[_0x2452('0xf')]);router[_0x2452('0x10')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x11')]);router[_0x2452('0x12')](_0x2452('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2452('0xb'),auth['isAuthenticated'](),controller[_0x2452('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9111e24..93f6d34 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0x5b2247,_0x2c12fe){var _0x165675=function(_0x484e68){while(--_0x484e68){_0x5b2247['push'](_0x5b2247['shift']());}};_0x165675(++_0x2c12fe);}(_0x583c,0x12b));var _0xc583=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x583c[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdf55=['exports','STRING','remoteUri','sequelize'];(function(_0x381a6d,_0x42c0d3){var _0x54c28d=function(_0x1bae4e){while(--_0x1bae4e){_0x381a6d['push'](_0x381a6d['shift']());}};_0x54c28d(++_0x42c0d3);}(_0xdf55,0x83));var _0x5df5=function(_0x20f4af,_0x4163e6){_0x20f4af=_0x20f4af-0x0;var _0x20b7ed=_0xdf55[_0x20f4af];return _0x20b7ed;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5df5('0x2')]},'remoteUri':{'type':Sequelize[_0x5df5('0x2')],'unique':_0x5df5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 86790d2..8566875 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 _0xa13c=['findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','send','index','FreshsalesAccount','rawAttributes','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x6f9891,_0x1c993a){var _0x3f950a=function(_0x14ad61){while(--_0x14ad61){_0x6f9891['push'](_0x6f9891['shift']());}};_0x3f950a(++_0x1c993a);}(_0xa13c,0x14e));var _0xca13=function(_0xa42ac1,_0x5241f6){_0xa42ac1=_0xa42ac1-0x0;var _0x481f10=_0xa13c[_0xa42ac1];return _0x481f10;};'use strict';var emlformat=require(_0xca13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca13('0x2'));var moment=require(_0xca13('0x3'));var BPromise=require(_0xca13('0x4'));var Mustache=require('mustache');var util=require(_0xca13('0x5'));var path=require(_0xca13('0x6'));var sox=require(_0xca13('0x7'));var csv=require('to-csv');var ejs=require(_0xca13('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca13('0x9'));var squel=require(_0xca13('0xa'));var crypto=require(_0xca13('0xb'));var jsforce=require(_0xca13('0xc'));var deskjs=require(_0xca13('0xd'));var toCsv=require(_0xca13('0xe'));var querystring=require(_0xca13('0xf'));var Papa=require(_0xca13('0x10'));var Redis=require(_0xca13('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xca13('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xca13('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xca13('0x14'));function respondWithStatusCode(_0x425af5,_0xb18085){_0xb18085=_0xb18085||0xcc;return function(_0x499d9f){if(_0x499d9f){return _0x425af5[_0xca13('0x15')](_0xb18085);}return _0x425af5['status'](_0xb18085)[_0xca13('0x16')]();};}function respondWithResult(_0x1a3dc9,_0xf459df){_0xf459df=_0xf459df||0xc8;return function(_0x7888a8){if(_0x7888a8){return _0x1a3dc9[_0xca13('0x17')](_0xf459df)['json'](_0x7888a8);}};}function respondWithFilteredResult(_0x1e5510,_0x18ce33){return function(_0x1843f1){if(_0x1843f1){var _0x4cf473=typeof _0x18ce33[_0xca13('0x18')]===_0xca13('0x19')&&typeof _0x18ce33[_0xca13('0x1a')]===_0xca13('0x19');var _0x110174=_0x1843f1['count'];var _0xaa5d92=_0x4cf473?0x0:_0x18ce33[_0xca13('0x18')];var _0x49fc5a=_0x4cf473?_0x1843f1[_0xca13('0x1b')]:_0x18ce33[_0xca13('0x18')]+_0x18ce33[_0xca13('0x1a')];var _0x21501b;if(_0x49fc5a>=_0x110174){_0x49fc5a=_0x110174;_0x21501b=0xc8;}else{_0x21501b=0xce;}_0x1e5510[_0xca13('0x17')](_0x21501b);return _0x1e5510[_0xca13('0x1c')](_0xca13('0x1d'),_0xaa5d92+'-'+_0x49fc5a+'/'+_0x110174)['json'](_0x1843f1);}return null;};}function patchUpdates(_0x3b413e){return function(_0x3eb762){try{jsonpatch[_0xca13('0x1e')](_0x3eb762,_0x3b413e,!![]);}catch(_0x3e3a1a){return BPromise['reject'](_0x3e3a1a);}return _0x3eb762[_0xca13('0x1f')]();};}function saveUpdates(_0x14b255,_0x205f27){return function(_0x34b30a){if(_0x34b30a){return _0x34b30a[_0xca13('0x20')](_0x14b255)[_0xca13('0x21')](function(_0x4d8674){return _0x4d8674;});}return null;};}function removeEntity(_0x47d988,_0x3264b1){return function(_0x3ac9c5){if(_0x3ac9c5){return _0x3ac9c5['destroy']()[_0xca13('0x21')](function(){_0x47d988[_0xca13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dfc27,_0x31a7a8){return function(_0x4364bb){if(!_0x4364bb){_0x2dfc27[_0xca13('0x15')](0x194);}return _0x4364bb;};}function handleError(_0xa295f6,_0x5cc2d0){_0x5cc2d0=_0x5cc2d0||0x1f4;return function(_0x30665c){logger[_0xca13('0x22')](_0x30665c[_0xca13('0x23')]);if(_0x30665c['name']){delete _0x30665c['name'];}_0xa295f6['status'](_0x5cc2d0)[_0xca13('0x24')](_0x30665c);};}exports[_0xca13('0x25')]=function(_0x11d650,_0x3d3781){var _0x311dba={},_0x3447ca={},_0x444707={'count':0x0,'rows':[]};var _0x53034b=_['map'](db[_0xca13('0x26')][_0xca13('0x27')],function(_0x335f15){return{'name':_0x335f15['fieldName'],'type':_0x335f15[_0xca13('0x28')][_0xca13('0x29')]};});_0x3447ca['model']=_[_0xca13('0x2a')](_0x53034b,_0xca13('0x2b'));_0x3447ca[_0xca13('0x2c')]=_[_0xca13('0x2d')](_0x11d650[_0xca13('0x2c')]);_0x3447ca[_0xca13('0x2e')]=_[_0xca13('0x2f')](_0x3447ca[_0xca13('0x30')],_0x3447ca['query']);_0x311dba[_0xca13('0x31')]=_[_0xca13('0x2f')](_0x3447ca[_0xca13('0x30')],qs['fields'](_0x11d650[_0xca13('0x2c')][_0xca13('0x32')]));_0x311dba[_0xca13('0x31')]=_0x311dba['attributes'][_0xca13('0x33')]?_0x311dba[_0xca13('0x31')]:_0x3447ca[_0xca13('0x30')];if(!_0x11d650[_0xca13('0x2c')][_0xca13('0x34')](_0xca13('0x35'))){_0x311dba[_0xca13('0x1a')]=qs['limit'](_0x11d650[_0xca13('0x2c')][_0xca13('0x1a')]);_0x311dba['offset']=qs[_0xca13('0x18')](_0x11d650[_0xca13('0x2c')]['offset']);}_0x311dba[_0xca13('0x36')]=qs[_0xca13('0x37')](_0x11d650[_0xca13('0x2c')][_0xca13('0x37')]);_0x311dba[_0xca13('0x38')]=qs[_0xca13('0x2e')](_['pick'](_0x11d650['query'],_0x3447ca['filters']),_0x53034b);if(_0x11d650['query']['filter']){_0x311dba['where']=_[_0xca13('0x39')](_0x311dba[_0xca13('0x38')],{'$or':_[_0xca13('0x2a')](_0x53034b,function(_0xc1a752){if(_0xc1a752[_0xca13('0x28')]!==_0xca13('0x3a')){var _0x444869={};_0x444869[_0xc1a752['name']]={'$like':'%'+_0x11d650[_0xca13('0x2c')]['filter']+'%'};return _0x444869;}})});}_0x311dba=_[_0xca13('0x39')]({},_0x311dba,_0x11d650[_0xca13('0x3b')]);var _0x33f163={'where':_0x311dba[_0xca13('0x38')]};return db[_0xca13('0x26')][_0xca13('0x1b')](_0x33f163)[_0xca13('0x21')](function(_0xca7030){_0x444707['count']=_0xca7030;if(_0x11d650[_0xca13('0x2c')][_0xca13('0x3c')]){_0x311dba[_0xca13('0x3d')]=[{'all':!![]}];}return db[_0xca13('0x26')][_0xca13('0x3e')](_0x311dba);})[_0xca13('0x21')](function(_0x210e49){_0x444707[_0xca13('0x3f')]=_0x210e49;return _0x444707;})['then'](respondWithFilteredResult(_0x3d3781,_0x311dba))[_0xca13('0x40')](handleError(_0x3d3781,null));};exports[_0xca13('0x41')]=function(_0x18513b,_0x1ceca3){var _0xfe896e={'raw':![],'where':{'id':_0x18513b[_0xca13('0x42')]['id']}},_0x122649={};_0x122649[_0xca13('0x30')]=_[_0xca13('0x2d')](db[_0xca13('0x26')]['rawAttributes']);_0x122649[_0xca13('0x2c')]=_[_0xca13('0x2d')](_0x18513b[_0xca13('0x2c')]);_0x122649[_0xca13('0x2e')]=_[_0xca13('0x2f')](_0x122649[_0xca13('0x30')],_0x122649[_0xca13('0x2c')]);_0xfe896e['attributes']=_[_0xca13('0x2f')](_0x122649['model'],qs[_0xca13('0x32')](_0x18513b[_0xca13('0x2c')][_0xca13('0x32')]));_0xfe896e['attributes']=_0xfe896e[_0xca13('0x31')][_0xca13('0x33')]?_0xfe896e['attributes']:_0x122649['model'];if(_0x18513b[_0xca13('0x2c')]['includeAll']){_0xfe896e[_0xca13('0x3d')]=[{'all':!![]}];}_0xfe896e=_[_0xca13('0x39')]({},_0xfe896e,_0x18513b['options']);return db['FreshsalesAccount'][_0xca13('0x43')](_0xfe896e)[_0xca13('0x21')](handleEntityNotFound(_0x1ceca3,null))[_0xca13('0x21')](respondWithResult(_0x1ceca3,null))[_0xca13('0x40')](handleError(_0x1ceca3,null));};exports[_0xca13('0x44')]=function(_0x359e79,_0x34c97c){return db[_0xca13('0x26')][_0xca13('0x44')](_0x359e79[_0xca13('0x45')],{})[_0xca13('0x21')](respondWithResult(_0x34c97c,0xc9))[_0xca13('0x40')](handleError(_0x34c97c,null));};exports[_0xca13('0x20')]=function(_0x492813,_0x33c2dc){if(_0x492813[_0xca13('0x45')]['id']){delete _0x492813[_0xca13('0x45')]['id'];}return db[_0xca13('0x26')][_0xca13('0x43')]({'where':{'id':_0x492813[_0xca13('0x42')]['id']}})[_0xca13('0x21')](handleEntityNotFound(_0x33c2dc,null))[_0xca13('0x21')](saveUpdates(_0x492813[_0xca13('0x45')],null))[_0xca13('0x21')](respondWithResult(_0x33c2dc,null))[_0xca13('0x40')](handleError(_0x33c2dc,null));};exports[_0xca13('0x46')]=function(_0x13ed54,_0x2cf79a){return db[_0xca13('0x26')][_0xca13('0x43')]({'where':{'id':_0x13ed54[_0xca13('0x42')]['id']}})[_0xca13('0x21')](handleEntityNotFound(_0x2cf79a,null))[_0xca13('0x21')](removeEntity(_0x2cf79a,null))[_0xca13('0x40')](handleError(_0x2cf79a,null));};exports[_0xca13('0x47')]=function(_0x1253a2,_0x320483,_0x4c8507){var _0x35a8c7={};var _0x179c82={};var _0x35d1ec;var _0x9163fe;return db[_0xca13('0x26')][_0xca13('0x48')]({'where':{'id':_0x1253a2['params']['id']}})['then'](handleEntityNotFound(_0x320483,null))[_0xca13('0x21')](function(_0x76764){if(_0x76764){_0x35d1ec=_0x76764;_0x179c82[_0xca13('0x30')]=_[_0xca13('0x2d')](db[_0xca13('0x49')]['rawAttributes']);_0x179c82['query']=_['keys'](_0x1253a2[_0xca13('0x2c')]);_0x179c82[_0xca13('0x2e')]=_['intersection'](_0x179c82[_0xca13('0x30')],_0x179c82[_0xca13('0x2c')]);_0x35a8c7[_0xca13('0x31')]=_['intersection'](_0x179c82['model'],qs[_0xca13('0x32')](_0x1253a2[_0xca13('0x2c')][_0xca13('0x32')]));_0x35a8c7[_0xca13('0x31')]=_0x35a8c7[_0xca13('0x31')][_0xca13('0x33')]?_0x35a8c7[_0xca13('0x31')]:_0x179c82[_0xca13('0x30')];_0x35a8c7[_0xca13('0x36')]=qs[_0xca13('0x37')](_0x1253a2[_0xca13('0x2c')][_0xca13('0x37')]);_0x35a8c7['where']=qs[_0xca13('0x2e')](_[_0xca13('0x4a')](_0x1253a2[_0xca13('0x2c')],_0x179c82[_0xca13('0x2e')]));if(_0x1253a2[_0xca13('0x2c')][_0xca13('0x4b')]){_0x35a8c7['where']=_[_0xca13('0x39')](_0x35a8c7[_0xca13('0x38')],{'$or':_[_0xca13('0x2a')](_0x35a8c7[_0xca13('0x31')],function(_0x5f3277){var _0x23f36a={};_0x23f36a[_0x5f3277]={'$like':'%'+_0x1253a2[_0xca13('0x2c')][_0xca13('0x4b')]+'%'};return _0x23f36a;})});}_0x35a8c7=_['merge']({},_0x35a8c7,_0x1253a2[_0xca13('0x3b')]);return _0x35d1ec[_0xca13('0x47')](_0x35a8c7);}})[_0xca13('0x21')](function(_0x931145){if(_0x931145){_0x9163fe=_0x931145[_0xca13('0x33')];if(!_0x1253a2[_0xca13('0x2c')][_0xca13('0x34')](_0xca13('0x35'))){_0x35a8c7[_0xca13('0x1a')]=qs[_0xca13('0x1a')](_0x1253a2['query'][_0xca13('0x1a')]);_0x35a8c7[_0xca13('0x18')]=qs[_0xca13('0x18')](_0x1253a2[_0xca13('0x2c')][_0xca13('0x18')]);}return _0x35d1ec[_0xca13('0x47')](_0x35a8c7);}})[_0xca13('0x21')](function(_0x58b30f){if(_0x58b30f){return _0x58b30f?{'count':_0x9163fe,'rows':_0x58b30f}:null;}})[_0xca13('0x21')](respondWithResult(_0x320483,null))['catch'](handleError(_0x320483,null));};exports[_0xca13('0x4c')]=function(_0x254ded,_0x1fea4e,_0x20b9f5){if(_0x254ded['body']['id']){delete _0x254ded[_0xca13('0x45')]['id'];}return db[_0xca13('0x26')][_0xca13('0x48')]({'where':{'id':_0x254ded[_0xca13('0x42')]['id']}})[_0xca13('0x21')](handleEntityNotFound(_0x1fea4e,null))['then'](function(_0x188e2e){if(_0x188e2e){_0x254ded[_0xca13('0x45')][_0xca13('0x4d')]=_0x188e2e['id'];_0x254ded[_0xca13('0x45')]['Subjects']=integrations[_0xca13('0x4e')](_0x254ded[_0xca13('0x45')][_0xca13('0x4f')],_0x254ded[_0xca13('0x45')][_0xca13('0x28')]);_0x254ded[_0xca13('0x45')][_0xca13('0x50')]=integrations['getDescriptions'](_0x254ded[_0xca13('0x45')]['channel'],_0x254ded[_0xca13('0x45')][_0xca13('0x28')]);return db[_0xca13('0x49')][_0xca13('0x44')](_0x254ded[_0xca13('0x45')],{'include':[{'model':db[_0xca13('0x51')],'as':_0xca13('0x52')},{'model':db[_0xca13('0x51')],'as':_0xca13('0x50')}]});}return null;})[_0xca13('0x21')](respondWithResult(_0x1fea4e,null))[_0xca13('0x40')](handleError(_0x1fea4e,null));};exports[_0xca13('0x53')]=function(_0x13092b,_0x4af7c4,_0x3a9467){var _0x3de3a2='';var _0x1221d0='';return db['FreshsalesAccount'][_0xca13('0x48')]({'where':{'id':_0x13092b['params']['id']},'attributes':['id',_0xca13('0x54'),_0xca13('0x55'),_0xca13('0x56')]})['then'](handleEntityNotFound(_0x4af7c4,null))[_0xca13('0x21')](function(_0x1aeb39){if(_0x1aeb39){_0x1221d0=_0x1aeb39[_0xca13('0x54')];_0x3de3a2=_0x1aeb39[_0xca13('0x55')];var _0x43764a=_0x1aeb39[_0xca13('0x55')][_0xca13('0x57')](-0x1);if(_0x43764a==='/'){_0x3de3a2=_0x3de3a2[_0xca13('0x58')](0x0,_0x3de3a2[_0xca13('0x59')](_0x43764a));}return rp({'method':'GET','uri':util[_0xca13('0x5a')]('%s%s',_0x3de3a2,_0xca13('0x5b')),'headers':{'Authorization':'Token\x20token='+_0x1aeb39[_0xca13('0x56')]},'json':!![]});}})[_0xca13('0x21')](function(_0x23a9c2){if(_0x23a9c2){var _0x4a146c=_0x23a9c2['users'];var _0xaa5da5=![];var _0x1a443f=null;for(_0x1a443f=0x0;_0x1a443f<_0x4a146c['length'];_0x1a443f++){if(_0x4a146c[_0x1a443f][_0xca13('0x5c')]===_0x1221d0){_0xaa5da5=!![];}}if(_0xaa5da5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xca13('0x5d')});}}})[_0xca13('0x21')](respondWithResult(_0x4af7c4,null))['catch'](function(_0xa93611){var _0x5bbf06=_0x13092b[_0xca13('0x2c')][_0xca13('0x5e')]?0x1f4:_0xa93611[_0xca13('0x5f')]||0x1f4;logger[_0xca13('0x22')](_0xca13('0x60'),_0xca13('0x53'),_0x5bbf06,JSON[_0xca13('0x61')](_0xa93611));delete _0xa93611['name'];if(_0x5bbf06===0x191){_0x5bbf06=0x190;}_0x4af7c4['status'](_0x5bbf06)[_0xca13('0x24')](_0x13092b[_0xca13('0x2c')]['test']?{'message':_0xca13('0x62'),'statusCode':_0xa93611[_0xca13('0x5f')]}:_0xa93611);});}; \ No newline at end of file +var _0x1d53=['stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','params','find','catch','create','body','update','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','error'];(function(_0x8ce99,_0xe40fa0){var _0x186ca7=function(_0xa277bc){while(--_0xa277bc){_0x8ce99['push'](_0x8ce99['shift']());}};_0x186ca7(++_0xe40fa0);}(_0x1d53,0xd0));var _0x31d5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1d53[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x31d5('0x0'));var rimraf=require(_0x31d5('0x1'));var zipdir=require(_0x31d5('0x2'));var jsonpatch=require(_0x31d5('0x3'));var rp=require(_0x31d5('0x4'));var moment=require(_0x31d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31d5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x31d5('0x7'));var ejs=require(_0x31d5('0x8'));var fs=require('fs');var fs_extra=require(_0x31d5('0x9'));var _=require(_0x31d5('0xa'));var squel=require(_0x31d5('0xb'));var crypto=require(_0x31d5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31d5('0xd'));var toCsv=require(_0x31d5('0x7'));var querystring=require(_0x31d5('0xe'));var Papa=require('papaparse');var Redis=require(_0x31d5('0xf'));var authService=require(_0x31d5('0x10'));var qs=require(_0x31d5('0x11'));var as=require(_0x31d5('0x12'));var hardwareService=require(_0x31d5('0x13'));var logger=require(_0x31d5('0x14'))(_0x31d5('0x15'));var utils=require(_0x31d5('0x16'));var config=require(_0x31d5('0x17'));var licenseUtil=require(_0x31d5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x31d5('0x19'));function respondWithStatusCode(_0x5709be,_0x17a41c){_0x17a41c=_0x17a41c||0xcc;return function(_0x5127c4){if(_0x5127c4){return _0x5709be[_0x31d5('0x1a')](_0x17a41c);}return _0x5709be[_0x31d5('0x1b')](_0x17a41c)[_0x31d5('0x1c')]();};}function respondWithResult(_0x524282,_0x172ba8){_0x172ba8=_0x172ba8||0xc8;return function(_0x1a85e8){if(_0x1a85e8){return _0x524282[_0x31d5('0x1b')](_0x172ba8)['json'](_0x1a85e8);}};}function respondWithFilteredResult(_0xbdf4e,_0x4a465b){return function(_0x3c32fa){if(_0x3c32fa){var _0x2f5b28=typeof _0x4a465b[_0x31d5('0x1d')]===_0x31d5('0x1e')&&typeof _0x4a465b[_0x31d5('0x1f')]===_0x31d5('0x1e');var _0x68b01a=_0x3c32fa[_0x31d5('0x20')];var _0x40c02e=_0x2f5b28?0x0:_0x4a465b[_0x31d5('0x1d')];var _0x503386=_0x2f5b28?_0x3c32fa[_0x31d5('0x20')]:_0x4a465b[_0x31d5('0x1d')]+_0x4a465b[_0x31d5('0x1f')];var _0x466eae;if(_0x503386>=_0x68b01a){_0x503386=_0x68b01a;_0x466eae=0xc8;}else{_0x466eae=0xce;}_0xbdf4e[_0x31d5('0x1b')](_0x466eae);return _0xbdf4e[_0x31d5('0x21')](_0x31d5('0x22'),_0x40c02e+'-'+_0x503386+'/'+_0x68b01a)['json'](_0x3c32fa);}return null;};}function patchUpdates(_0x413af5){return function(_0x28ebe3){try{jsonpatch[_0x31d5('0x23')](_0x28ebe3,_0x413af5,!![]);}catch(_0x16fb30){return BPromise[_0x31d5('0x24')](_0x16fb30);}return _0x28ebe3['save']();};}function saveUpdates(_0x1b77e4,_0xc7338c){return function(_0x36b447){if(_0x36b447){return _0x36b447['update'](_0x1b77e4)[_0x31d5('0x25')](function(_0x35610a){return _0x35610a;});}return null;};}function removeEntity(_0x3242f9,_0x496352){return function(_0xe6829b){if(_0xe6829b){return _0xe6829b[_0x31d5('0x26')]()[_0x31d5('0x25')](function(){_0x3242f9['status'](0xcc)[_0x31d5('0x1c')]();});}};}function handleEntityNotFound(_0x300a12,_0x5c8e10){return function(_0x2804cb){if(!_0x2804cb){_0x300a12['sendStatus'](0x194);}return _0x2804cb;};}function handleError(_0x217f11,_0x42ed50){_0x42ed50=_0x42ed50||0x1f4;return function(_0x219a13){logger['error'](_0x219a13[_0x31d5('0x27')]);if(_0x219a13['name']){delete _0x219a13[_0x31d5('0x28')];}_0x217f11[_0x31d5('0x1b')](_0x42ed50)['send'](_0x219a13);};}exports[_0x31d5('0x29')]=function(_0x1cf20f,_0xd848f3){var _0x16f994={},_0x368d54={},_0x3aaa15={'count':0x0,'rows':[]};var _0x2ed015=_[_0x31d5('0x2a')](db['FreshsalesAccount'][_0x31d5('0x2b')],function(_0x487f02){return{'name':_0x487f02[_0x31d5('0x2c')],'type':_0x487f02[_0x31d5('0x2d')]['key']};});_0x368d54['model']=_['map'](_0x2ed015,_0x31d5('0x28'));_0x368d54[_0x31d5('0x2e')]=_[_0x31d5('0x2f')](_0x1cf20f[_0x31d5('0x2e')]);_0x368d54[_0x31d5('0x30')]=_[_0x31d5('0x31')](_0x368d54['model'],_0x368d54[_0x31d5('0x2e')]);_0x16f994[_0x31d5('0x32')]=_[_0x31d5('0x31')](_0x368d54[_0x31d5('0x33')],qs[_0x31d5('0x34')](_0x1cf20f[_0x31d5('0x2e')][_0x31d5('0x34')]));_0x16f994[_0x31d5('0x32')]=_0x16f994[_0x31d5('0x32')][_0x31d5('0x35')]?_0x16f994[_0x31d5('0x32')]:_0x368d54['model'];if(!_0x1cf20f[_0x31d5('0x2e')]['hasOwnProperty'](_0x31d5('0x36'))){_0x16f994[_0x31d5('0x1f')]=qs[_0x31d5('0x1f')](_0x1cf20f[_0x31d5('0x2e')][_0x31d5('0x1f')]);_0x16f994[_0x31d5('0x1d')]=qs[_0x31d5('0x1d')](_0x1cf20f[_0x31d5('0x2e')]['offset']);}_0x16f994['order']=qs[_0x31d5('0x37')](_0x1cf20f[_0x31d5('0x2e')]['sort']);_0x16f994[_0x31d5('0x38')]=qs['filters'](_['pick'](_0x1cf20f['query'],_0x368d54[_0x31d5('0x30')]),_0x2ed015);if(_0x1cf20f[_0x31d5('0x2e')][_0x31d5('0x39')]){_0x16f994[_0x31d5('0x38')]=_[_0x31d5('0x3a')](_0x16f994[_0x31d5('0x38')],{'$or':_[_0x31d5('0x2a')](_0x2ed015,function(_0x537626){if(_0x537626['type']!==_0x31d5('0x3b')){var _0x3ef376={};_0x3ef376[_0x537626['name']]={'$like':'%'+_0x1cf20f[_0x31d5('0x2e')][_0x31d5('0x39')]+'%'};return _0x3ef376;}})});}_0x16f994=_[_0x31d5('0x3a')]({},_0x16f994,_0x1cf20f[_0x31d5('0x3c')]);var _0x355019={'where':_0x16f994[_0x31d5('0x38')]};return db[_0x31d5('0x3d')][_0x31d5('0x20')](_0x355019)[_0x31d5('0x25')](function(_0x47ef66){_0x3aaa15[_0x31d5('0x20')]=_0x47ef66;if(_0x1cf20f[_0x31d5('0x2e')][_0x31d5('0x3e')]){_0x16f994[_0x31d5('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x31d5('0x40')](_0x16f994);})[_0x31d5('0x25')](function(_0x55ec0a){_0x3aaa15[_0x31d5('0x41')]=_0x55ec0a;return _0x3aaa15;})['then'](respondWithFilteredResult(_0xd848f3,_0x16f994))['catch'](handleError(_0xd848f3,null));};exports['show']=function(_0x1f0b4d,_0x2d30fb){var _0x7cf4d4={'raw':![],'where':{'id':_0x1f0b4d[_0x31d5('0x42')]['id']}},_0x35536b={};_0x35536b[_0x31d5('0x33')]=_[_0x31d5('0x2f')](db[_0x31d5('0x3d')][_0x31d5('0x2b')]);_0x35536b[_0x31d5('0x2e')]=_[_0x31d5('0x2f')](_0x1f0b4d['query']);_0x35536b[_0x31d5('0x30')]=_['intersection'](_0x35536b[_0x31d5('0x33')],_0x35536b[_0x31d5('0x2e')]);_0x7cf4d4['attributes']=_[_0x31d5('0x31')](_0x35536b[_0x31d5('0x33')],qs[_0x31d5('0x34')](_0x1f0b4d[_0x31d5('0x2e')][_0x31d5('0x34')]));_0x7cf4d4[_0x31d5('0x32')]=_0x7cf4d4[_0x31d5('0x32')]['length']?_0x7cf4d4['attributes']:_0x35536b['model'];if(_0x1f0b4d[_0x31d5('0x2e')][_0x31d5('0x3e')]){_0x7cf4d4[_0x31d5('0x3f')]=[{'all':!![]}];}_0x7cf4d4=_['merge']({},_0x7cf4d4,_0x1f0b4d[_0x31d5('0x3c')]);return db['FreshsalesAccount'][_0x31d5('0x43')](_0x7cf4d4)['then'](handleEntityNotFound(_0x2d30fb,null))[_0x31d5('0x25')](respondWithResult(_0x2d30fb,null))[_0x31d5('0x44')](handleError(_0x2d30fb,null));};exports[_0x31d5('0x45')]=function(_0xccb93b,_0x1a5bcf){return db['FreshsalesAccount'][_0x31d5('0x45')](_0xccb93b[_0x31d5('0x46')],{})[_0x31d5('0x25')](respondWithResult(_0x1a5bcf,0xc9))[_0x31d5('0x44')](handleError(_0x1a5bcf,null));};exports[_0x31d5('0x47')]=function(_0x5dc2fb,_0x38be22){if(_0x5dc2fb['body']['id']){delete _0x5dc2fb[_0x31d5('0x46')]['id'];}return db[_0x31d5('0x3d')][_0x31d5('0x43')]({'where':{'id':_0x5dc2fb[_0x31d5('0x42')]['id']}})[_0x31d5('0x25')](handleEntityNotFound(_0x38be22,null))[_0x31d5('0x25')](saveUpdates(_0x5dc2fb['body'],null))['then'](respondWithResult(_0x38be22,null))[_0x31d5('0x44')](handleError(_0x38be22,null));};exports[_0x31d5('0x26')]=function(_0x4e45c5,_0x452feb){return db[_0x31d5('0x3d')][_0x31d5('0x43')]({'where':{'id':_0x4e45c5['params']['id']}})[_0x31d5('0x25')](handleEntityNotFound(_0x452feb,null))['then'](removeEntity(_0x452feb,null))['catch'](handleError(_0x452feb,null));};exports[_0x31d5('0x48')]=function(_0x4e2ade,_0x3b2070,_0x5e09e7){var _0x3da404={};var _0x4336be={};var _0x5cb1eb;var _0x932d94;return db[_0x31d5('0x3d')][_0x31d5('0x49')]({'where':{'id':_0x4e2ade[_0x31d5('0x42')]['id']}})[_0x31d5('0x25')](handleEntityNotFound(_0x3b2070,null))[_0x31d5('0x25')](function(_0x4f72b0){if(_0x4f72b0){_0x5cb1eb=_0x4f72b0;_0x4336be[_0x31d5('0x33')]=_[_0x31d5('0x2f')](db['FreshsalesConfiguration'][_0x31d5('0x2b')]);_0x4336be['query']=_[_0x31d5('0x2f')](_0x4e2ade[_0x31d5('0x2e')]);_0x4336be['filters']=_[_0x31d5('0x31')](_0x4336be[_0x31d5('0x33')],_0x4336be[_0x31d5('0x2e')]);_0x3da404['attributes']=_[_0x31d5('0x31')](_0x4336be['model'],qs[_0x31d5('0x34')](_0x4e2ade[_0x31d5('0x2e')][_0x31d5('0x34')]));_0x3da404[_0x31d5('0x32')]=_0x3da404['attributes'][_0x31d5('0x35')]?_0x3da404[_0x31d5('0x32')]:_0x4336be['model'];_0x3da404['order']=qs[_0x31d5('0x37')](_0x4e2ade[_0x31d5('0x2e')][_0x31d5('0x37')]);_0x3da404[_0x31d5('0x38')]=qs[_0x31d5('0x30')](_['pick'](_0x4e2ade[_0x31d5('0x2e')],_0x4336be[_0x31d5('0x30')]));if(_0x4e2ade['query'][_0x31d5('0x39')]){_0x3da404[_0x31d5('0x38')]=_[_0x31d5('0x3a')](_0x3da404['where'],{'$or':_['map'](_0x3da404[_0x31d5('0x32')],function(_0x519307){var _0x348b7b={};_0x348b7b[_0x519307]={'$like':'%'+_0x4e2ade['query'][_0x31d5('0x39')]+'%'};return _0x348b7b;})});}_0x3da404=_['merge']({},_0x3da404,_0x4e2ade[_0x31d5('0x3c')]);return _0x5cb1eb['getConfigurations'](_0x3da404);}})[_0x31d5('0x25')](function(_0x3aefba){if(_0x3aefba){_0x932d94=_0x3aefba[_0x31d5('0x35')];if(!_0x4e2ade[_0x31d5('0x2e')][_0x31d5('0x4a')](_0x31d5('0x36'))){_0x3da404[_0x31d5('0x1f')]=qs[_0x31d5('0x1f')](_0x4e2ade['query'][_0x31d5('0x1f')]);_0x3da404['offset']=qs[_0x31d5('0x1d')](_0x4e2ade[_0x31d5('0x2e')]['offset']);}return _0x5cb1eb[_0x31d5('0x48')](_0x3da404);}})[_0x31d5('0x25')](function(_0xe713df){if(_0xe713df){return _0xe713df?{'count':_0x932d94,'rows':_0xe713df}:null;}})[_0x31d5('0x25')](respondWithResult(_0x3b2070,null))[_0x31d5('0x44')](handleError(_0x3b2070,null));};exports[_0x31d5('0x4b')]=function(_0x5bf0f8,_0x2cc760,_0x3ad82e){if(_0x5bf0f8['body']['id']){delete _0x5bf0f8[_0x31d5('0x46')]['id'];}return db[_0x31d5('0x3d')][_0x31d5('0x49')]({'where':{'id':_0x5bf0f8[_0x31d5('0x42')]['id']}})[_0x31d5('0x25')](handleEntityNotFound(_0x2cc760,null))[_0x31d5('0x25')](function(_0x50683a){if(_0x50683a){_0x5bf0f8[_0x31d5('0x46')][_0x31d5('0x4c')]=_0x50683a['id'];_0x5bf0f8['body'][_0x31d5('0x4d')]=integrations[_0x31d5('0x4e')](_0x5bf0f8[_0x31d5('0x46')][_0x31d5('0x4f')],_0x5bf0f8['body'][_0x31d5('0x2d')]);_0x5bf0f8[_0x31d5('0x46')][_0x31d5('0x50')]=integrations[_0x31d5('0x51')](_0x5bf0f8[_0x31d5('0x46')][_0x31d5('0x4f')],_0x5bf0f8['body'][_0x31d5('0x2d')]);return db[_0x31d5('0x52')]['create'](_0x5bf0f8[_0x31d5('0x46')],{'include':[{'model':db[_0x31d5('0x53')],'as':_0x31d5('0x4d')},{'model':db[_0x31d5('0x53')],'as':_0x31d5('0x50')}]});}return null;})[_0x31d5('0x25')](respondWithResult(_0x2cc760,null))['catch'](handleError(_0x2cc760,null));};exports[_0x31d5('0x54')]=function(_0x595501,_0x1e643b,_0x3e7203){var _0x5c4fef='';var _0x173f22='';return db[_0x31d5('0x3d')]['findOne']({'where':{'id':_0x595501[_0x31d5('0x42')]['id']},'attributes':['id',_0x31d5('0x55'),_0x31d5('0x56'),_0x31d5('0x57')]})[_0x31d5('0x25')](handleEntityNotFound(_0x1e643b,null))[_0x31d5('0x25')](function(_0x5c225f){if(_0x5c225f){_0x173f22=_0x5c225f[_0x31d5('0x55')];_0x5c4fef=_0x5c225f[_0x31d5('0x56')];var _0x5ab57e=_0x5c225f[_0x31d5('0x56')][_0x31d5('0x58')](-0x1);if(_0x5ab57e==='/'){_0x5c4fef=_0x5c4fef['substring'](0x0,_0x5c4fef['lastIndexOf'](_0x5ab57e));}return rp({'method':_0x31d5('0x59'),'uri':util[_0x31d5('0x5a')](_0x31d5('0x5b'),_0x5c4fef,_0x31d5('0x5c')),'headers':{'Authorization':_0x31d5('0x5d')+_0x5c225f['apiKey']},'json':!![]});}})[_0x31d5('0x25')](function(_0x1e66a1){if(_0x1e66a1){var _0x52b21f=_0x1e66a1[_0x31d5('0x5e')];var _0x1be781=![];var _0x15d434=null;for(_0x15d434=0x0;_0x15d434<_0x52b21f[_0x31d5('0x35')];_0x15d434++){if(_0x52b21f[_0x15d434]['email']===_0x173f22){_0x1be781=!![];}}if(_0x1be781){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x31d5('0x5f')});}}})[_0x31d5('0x25')](respondWithResult(_0x1e643b,null))[_0x31d5('0x44')](function(_0x346414){var _0x31de9e=_0x595501[_0x31d5('0x2e')][_0x31d5('0x60')]?0x1f4:_0x346414['statusCode']||0x1f4;logger[_0x31d5('0x61')]('getFields,\x20%s,\x20%s,\x20%s',_0x31d5('0x54'),_0x31de9e,JSON[_0x31d5('0x62')](_0x346414));delete _0x346414[_0x31d5('0x28')];if(_0x31de9e===0x191){_0x31de9e=0x190;}_0x1e643b[_0x31d5('0x1b')](_0x31de9e)[_0x31d5('0x63')](_0x595501[_0x31d5('0x2e')][_0x31d5('0x60')]?{'message':_0x31d5('0x64'),'statusCode':_0x346414[_0x31d5('0x65')]}:_0x346414);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3658e8f..cf117d8 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 _0x0424=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','../../config/logger','api','moment','bluebird','path'];(function(_0x7e087c,_0x52d4f2){var _0xa86caa=function(_0x4897c6){while(--_0x4897c6){_0x7e087c['push'](_0x7e087c['shift']());}};_0xa86caa(++_0x52d4f2);}(_0x0424,0x159));var _0x4042=function(_0x41a457,_0x4a8e30){_0x41a457=_0x41a457-0x0;var _0x84b15f=_0x0424[_0x41a457];return _0x84b15f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));var integrations=require(_0x4042('0x6'));module[_0x4042('0x7')]=function(_0xc0fba0,_0x3abaf1){return _0xc0fba0[_0x4042('0x8')](_0x4042('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f2d44,_0x3f3e67){var _0x3c5298=function(_0xf36c0b){while(--_0xf36c0b){_0x5f2d44['push'](_0x5f2d44['shift']());}};_0x3c5298(++_0x3f3e67);}(_0x1893,0xa2));var _0x3189=function(_0x5832be,_0x382b95){_0x5832be=_0x5832be-0x0;var _0x5d0088=_0x1893[_0x5832be];return _0x5d0088;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));var integrations=require(_0x3189('0x8'));module[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return _0x4080a9[_0x3189('0xa')](_0x3189('0xb'),attributes,{'tableName':_0x3189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e9f5f90..3a9a897 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 _0x0adf=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','find','raw','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x3b94eb,_0x5e690d){var _0x14e15d=function(_0x49e963){while(--_0x49e963){_0x3b94eb['push'](_0x3b94eb['shift']());}};_0x14e15d(++_0x5e690d);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x5d5fcc,_0x13ccca){_0x5d5fcc=_0x5d5fcc-0x0;var _0x5afcaa=_0x0adf[_0x5d5fcc];return _0x5afcaa;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['GetFreshsalesAccount']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')]({'raw':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1b')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'limit':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970['options'][_0xf0ad('0x1d')]||null:null,'include':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')],function(_0x276322){return{'model':db[_0x276322[_0xf0ad('0x20')]],'as':_0x276322['as'],'attributes':_0x276322[_0xf0ad('0x1c')],'include':_0x276322[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x276322[_0xf0ad('0x1e')],function(_0x456f81){return{'model':db[_0x456f81[_0xf0ad('0x20')]],'as':_0x456f81['as'],'attributes':_0x456f81['attributes'],'include':_0x456f81[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x456f81[_0xf0ad('0x1e')],function(_0x7377d7){return{'model':db[_0x7377d7[_0xf0ad('0x20')]],'as':_0x7377d7['as'],'attributes':_0x7377d7[_0xf0ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbe00){logger[_0xf0ad('0xd')](_0xf0ad('0x21'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x21'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x2cbe00));_0x46fb20(_0x2cbe00);})[_0xf0ad('0x17')](function(_0x1bee71){logger[_0xf0ad('0x13')](_0xf0ad('0x21'),_0x1bee71[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8['error'](0x1f4,_0x1bee71[_0xf0ad('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x83f211){var _0x57a1f3=this;return new Promise(function(_0x25ed0b,_0x320174){return db[_0xf0ad('0x18')][_0xf0ad('0x22')]({'raw':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x23')]===undefined?!![]:![]:!![],'where':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options']['where']||null:null,'attributes':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'include':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options'][_0xf0ad('0x1e')]?_['map'](_0x83f211[_0xf0ad('0x1a')]['include'],function(_0x4136b9){return{'model':db[_0x4136b9['model']],'as':_0x4136b9['as'],'attributes':_0x4136b9[_0xf0ad('0x1c')],'include':_0x4136b9[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4136b9[_0xf0ad('0x1e')],function(_0x42f87f){return{'model':db[_0x42f87f[_0xf0ad('0x20')]],'as':_0x42f87f['as'],'attributes':_0x42f87f[_0xf0ad('0x1c')],'include':_0x42f87f[_0xf0ad('0x1e')]?_['map'](_0x42f87f[_0xf0ad('0x1e')],function(_0x54b59d){return{'model':db[_0x54b59d[_0xf0ad('0x20')]],'as':_0x54b59d['as'],'attributes':_0x54b59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0ad('0xc')](function(_0x25246b){logger[_0xf0ad('0xd')](_0xf0ad('0x24'),_0x83f211);logger[_0xf0ad('0xf')]('ShowFreshsalesAccount',_0x83f211,JSON[_0xf0ad('0x11')](_0x25246b));_0x25ed0b(_0x25246b);})[_0xf0ad('0x17')](function(_0x1d57d1){logger[_0xf0ad('0x13')](_0xf0ad('0x24'),_0x1d57d1[_0xf0ad('0x15')],_0x83f211);_0x320174(_0x57a1f3[_0xf0ad('0x13')](0x1f4,_0x1d57d1['message']));});});}; \ No newline at end of file +var _0x5430=['map','model','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include'];(function(_0x48f5d6,_0x36bd82){var _0x2cf127=function(_0x17f84c){while(--_0x17f84c){_0x48f5d6['push'](_0x48f5d6['shift']());}};_0x2cf127(++_0x36bd82);}(_0x5430,0x10c));var _0x0543=function(_0x56054c,_0x49d876){_0x56054c=_0x56054c-0x0;var _0x1c2910=_0x5430[_0x56054c];return _0x1c2910;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['findAll']({'raw':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x20b396[_0x0543('0x17')]?_0x20b396['options'][_0x0543('0x19')]||null:null,'attributes':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'limit':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1b')]||null:null,'include':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x20b396['options']['include'],function(_0x59f1b2){return{'model':db[_0x59f1b2[_0x0543('0x1e')]],'as':_0x59f1b2['as'],'attributes':_0x59f1b2[_0x0543('0x1a')],'include':_0x59f1b2[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x59f1b2[_0x0543('0x1c')],function(_0x26e500){return{'model':db[_0x26e500[_0x0543('0x1e')]],'as':_0x26e500['as'],'attributes':_0x26e500[_0x0543('0x1a')],'include':_0x26e500[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x26e500[_0x0543('0x1c')],function(_0x21fc63){return{'model':db[_0x21fc63['model']],'as':_0x21fc63['as'],'attributes':_0x21fc63[_0x0543('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x30ad9e){logger['info'](_0x0543('0x15'),_0x20b396);logger[_0x0543('0xe')](_0x0543('0x15'),_0x20b396,JSON[_0x0543('0xf')](_0x30ad9e));_0x577cf0(_0x30ad9e);})['catch'](function(_0x1732be){logger[_0x0543('0x10')]('GetFreshsalesAccount',_0x1732be['message'],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x1732be[_0x0543('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x3b879b){var _0x2e03d1=this;return new Promise(function(_0x931ccc,_0x2bd6ce){return db[_0x0543('0x16')][_0x0543('0x1f')]({'raw':_0x3b879b[_0x0543('0x17')]?_0x3b879b['options'][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')][_0x0543('0x19')]||null:null,'attributes':_0x3b879b[_0x0543('0x17')]?_0x3b879b[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'include':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')]['include']?_[_0x0543('0x1d')](_0x3b879b[_0x0543('0x17')][_0x0543('0x1c')],function(_0x327027){return{'model':db[_0x327027['model']],'as':_0x327027['as'],'attributes':_0x327027[_0x0543('0x1a')],'include':_0x327027['include']?_[_0x0543('0x1d')](_0x327027[_0x0543('0x1c')],function(_0x3fbf5f){return{'model':db[_0x3fbf5f[_0x0543('0x1e')]],'as':_0x3fbf5f['as'],'attributes':_0x3fbf5f[_0x0543('0x1a')],'include':_0x3fbf5f[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x3fbf5f[_0x0543('0x1c')],function(_0x8ef4d4){return{'model':db[_0x8ef4d4[_0x0543('0x1e')]],'as':_0x8ef4d4['as'],'attributes':_0x8ef4d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x2d76d6){logger['info'](_0x0543('0x20'),_0x3b879b);logger['debug'](_0x0543('0x20'),_0x3b879b,JSON[_0x0543('0xf')](_0x2d76d6));_0x931ccc(_0x2d76d6);})['catch'](function(_0x5e8800){logger[_0x0543('0x10')](_0x0543('0x20'),_0x5e8800['message'],_0x3b879b);_0x2bd6ce(_0x2e03d1[_0x0543('0x10')](0x1f4,_0x5e8800[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 126bd8d..7832ec0 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 _0xc57e=['get','isAuthenticated','index','/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','delete','exports','multer','util','path','express','Router','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x37b22d,_0x16a6ad){var _0xc3c038=function(_0x362e00){while(--_0x362e00){_0x37b22d['push'](_0x37b22d['shift']());}};_0xc3c038(++_0x16a6ad);}(_0xc57e,0x129));var _0xec57=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc57e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xec57('0x0'));var util=require(_0xec57('0x1'));var path=require(_0xec57('0x2'));var timeout=require('connect-timeout');var express=require(_0xec57('0x3'));var router=express[_0xec57('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec57('0x5'));var controller=require(_0xec57('0x6'));router[_0xec57('0x7')]('/',auth[_0xec57('0x8')](),controller[_0xec57('0x9')]);router[_0xec57('0x7')](_0xec57('0xa'),auth[_0xec57('0x8')](),controller['show']);router['get'](_0xec57('0xb'),auth[_0xec57('0x8')](),controller['getSubjects']);router[_0xec57('0x7')](_0xec57('0xc'),auth[_0xec57('0x8')](),controller[_0xec57('0xd')]);router['get'](_0xec57('0xe'),auth[_0xec57('0x8')](),controller[_0xec57('0xf')]);router[_0xec57('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xec57('0xa'),auth[_0xec57('0x8')](),controller['update']);router[_0xec57('0x11')](_0xec57('0xa'),auth[_0xec57('0x8')](),controller['destroy']);module[_0xec57('0x12')]=router; \ No newline at end of file +var _0x3e1a=['exports','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','/:id','update','destroy'];(function(_0x340921,_0x19e57d){var _0xa5365a=function(_0x166dbc){while(--_0x166dbc){_0x340921['push'](_0x340921['shift']());}};_0xa5365a(++_0x19e57d);}(_0x3e1a,0x190));var _0xa3e1=function(_0xf72fe,_0x37463c){_0xf72fe=_0xf72fe-0x0;var _0x540dbf=_0x3e1a[_0xf72fe];return _0x540dbf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa3e1('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3e1('0x1'));var interaction=require(_0xa3e1('0x2'));var config=require('../../config/environment');var controller=require(_0xa3e1('0x3'));router[_0xa3e1('0x4')]('/',auth[_0xa3e1('0x5')](),controller[_0xa3e1('0x6')]);router[_0xa3e1('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa3e1('0x4')](_0xa3e1('0x7'),auth['isAuthenticated'](),controller[_0xa3e1('0x8')]);router[_0xa3e1('0x4')](_0xa3e1('0x9'),auth[_0xa3e1('0x5')](),controller[_0xa3e1('0xa')]);router['get'](_0xa3e1('0xb'),auth[_0xa3e1('0x5')](),controller[_0xa3e1('0xc')]);router['post']('/',auth[_0xa3e1('0x5')](),controller[_0xa3e1('0xd')]);router[_0xa3e1('0xe')](_0xa3e1('0xf'),auth['isAuthenticated'](),controller[_0xa3e1('0x10')]);router['delete'](_0xa3e1('0xf'),auth['isAuthenticated'](),controller[_0xa3e1('0x11')]);module[_0xa3e1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 77ac348..b7385fe 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 _0xabed=['exports','STRING','sequelize'];(function(_0x5cbfc3,_0x230cd7){var _0x16878d=function(_0x2c612a){while(--_0x2c612a){_0x5cbfc3['push'](_0x5cbfc3['shift']());}};_0x16878d(++_0x230cd7);}(_0xabed,0xe3));var _0xdabe=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xabed[_0x10dfdf];return _0x4d857d;};'use strict';var Sequelize=require(_0xdabe('0x0'));module[_0xdabe('0x1')]={'name':{'type':Sequelize[_0xdabe('0x2')]},'description':{'type':Sequelize[_0xdabe('0x2')]}}; \ No newline at end of file +var _0x12a8=['STRING','exports'];(function(_0x1c92d9,_0x3ae205){var _0x183705=function(_0x39ca54){while(--_0x39ca54){_0x1c92d9['push'](_0x1c92d9['shift']());}};_0x183705(++_0x3ae205);}(_0x12a8,0xb9));var _0x812a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x12a8[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x812a('0x0')]={'name':{'type':Sequelize[_0x812a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 42db592..f34e929 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 _0x9004=['intersection','fields','length','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','catch','show','params','merge','find','create','body','update','findOne','order','pick','hasOwnProperty','getSubjects','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','reject','then','destroy','sendStatus','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','query','keys','filters','model','attributes'];(function(_0x49945e,_0x161d29){var _0x3b825a=function(_0x3a913b){while(--_0x3a913b){_0x49945e['push'](_0x49945e['shift']());}};_0x3b825a(++_0x161d29);}(_0x9004,0x6a));var _0x4900=function(_0x36e4ce,_0x576858){_0x36e4ce=_0x36e4ce-0x0;var _0x2a9753=_0x9004[_0x36e4ce];return _0x2a9753;};'use strict';var emlformat=require(_0x4900('0x0'));var rimraf=require(_0x4900('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4900('0x2'));var rp=require(_0x4900('0x3'));var moment=require(_0x4900('0x4'));var BPromise=require(_0x4900('0x5'));var Mustache=require(_0x4900('0x6'));var util=require('util');var path=require(_0x4900('0x7'));var sox=require(_0x4900('0x8'));var csv=require('to-csv');var ejs=require(_0x4900('0x9'));var fs=require('fs');var fs_extra=require(_0x4900('0xa'));var _=require(_0x4900('0xb'));var squel=require('squel');var crypto=require(_0x4900('0xc'));var jsforce=require(_0x4900('0xd'));var deskjs=require(_0x4900('0xe'));var toCsv=require(_0x4900('0xf'));var querystring=require(_0x4900('0x10'));var Papa=require(_0x4900('0x11'));var Redis=require(_0x4900('0x12'));var authService=require(_0x4900('0x13'));var qs=require(_0x4900('0x14'));var as=require(_0x4900('0x15'));var hardwareService=require(_0x4900('0x16'));var logger=require(_0x4900('0x17'))(_0x4900('0x18'));var utils=require(_0x4900('0x19'));var config=require(_0x4900('0x1a'));var licenseUtil=require(_0x4900('0x1b'));var db=require(_0x4900('0x1c'))['db'];function respondWithStatusCode(_0x5d95c5,_0x2a5b12){_0x2a5b12=_0x2a5b12||0xcc;return function(_0x4057ea){if(_0x4057ea){return _0x5d95c5['sendStatus'](_0x2a5b12);}return _0x5d95c5[_0x4900('0x1d')](_0x2a5b12)[_0x4900('0x1e')]();};}function respondWithResult(_0x48b932,_0x1646f0){_0x1646f0=_0x1646f0||0xc8;return function(_0x1994c1){if(_0x1994c1){return _0x48b932['status'](_0x1646f0)['json'](_0x1994c1);}};}function respondWithFilteredResult(_0x2c1d5c,_0x137706){return function(_0x7dafea){if(_0x7dafea){var _0x5c1cd1=typeof _0x137706[_0x4900('0x1f')]===_0x4900('0x20')&&typeof _0x137706[_0x4900('0x21')]===_0x4900('0x20');var _0x236e19=_0x7dafea[_0x4900('0x22')];var _0x1d1baf=_0x5c1cd1?0x0:_0x137706[_0x4900('0x1f')];var _0x203bbc=_0x5c1cd1?_0x7dafea[_0x4900('0x22')]:_0x137706[_0x4900('0x1f')]+_0x137706[_0x4900('0x21')];var _0x45650b;if(_0x203bbc>=_0x236e19){_0x203bbc=_0x236e19;_0x45650b=0xc8;}else{_0x45650b=0xce;}_0x2c1d5c[_0x4900('0x1d')](_0x45650b);return _0x2c1d5c['set'](_0x4900('0x23'),_0x1d1baf+'-'+_0x203bbc+'/'+_0x236e19)['json'](_0x7dafea);}return null;};}function patchUpdates(_0x46ac55){return function(_0x16a4b4){try{jsonpatch['apply'](_0x16a4b4,_0x46ac55,!![]);}catch(_0x163b38){return BPromise[_0x4900('0x24')](_0x163b38);}return _0x16a4b4['save']();};}function saveUpdates(_0x2642a7,_0x4cda24){return function(_0x1b595d){if(_0x1b595d){return _0x1b595d['update'](_0x2642a7)[_0x4900('0x25')](function(_0x322760){return _0x322760;});}return null;};}function removeEntity(_0x217fe8,_0x5e8f0a){return function(_0x203751){if(_0x203751){return _0x203751[_0x4900('0x26')]()[_0x4900('0x25')](function(){_0x217fe8[_0x4900('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb816,_0x1964e0){return function(_0x2c37e9){if(!_0x2c37e9){_0x4fb816[_0x4900('0x27')](0x194);}return _0x2c37e9;};}function handleError(_0x1256fe,_0x4aaf54){_0x4aaf54=_0x4aaf54||0x1f4;return function(_0x177973){logger['error'](_0x177973[_0x4900('0x28')]);if(_0x177973['name']){delete _0x177973[_0x4900('0x29')];}_0x1256fe['status'](_0x4aaf54)['send'](_0x177973);};}exports['index']=function(_0x3e8a6b,_0x473799){var _0x2abf8d={},_0x5eb2fd={},_0x15e172={'count':0x0,'rows':[]};var _0x241b8a=_[_0x4900('0x2a')](db[_0x4900('0x2b')][_0x4900('0x2c')],function(_0x3f3dfa){return{'name':_0x3f3dfa[_0x4900('0x2d')],'type':_0x3f3dfa[_0x4900('0x2e')]['key']};});_0x5eb2fd['model']=_['map'](_0x241b8a,_0x4900('0x29'));_0x5eb2fd[_0x4900('0x2f')]=_[_0x4900('0x30')](_0x3e8a6b[_0x4900('0x2f')]);_0x5eb2fd[_0x4900('0x31')]=_['intersection'](_0x5eb2fd[_0x4900('0x32')],_0x5eb2fd[_0x4900('0x2f')]);_0x2abf8d[_0x4900('0x33')]=_[_0x4900('0x34')](_0x5eb2fd[_0x4900('0x32')],qs['fields'](_0x3e8a6b['query'][_0x4900('0x35')]));_0x2abf8d['attributes']=_0x2abf8d['attributes'][_0x4900('0x36')]?_0x2abf8d[_0x4900('0x33')]:_0x5eb2fd[_0x4900('0x32')];if(!_0x3e8a6b[_0x4900('0x2f')]['hasOwnProperty'](_0x4900('0x37'))){_0x2abf8d['limit']=qs[_0x4900('0x21')](_0x3e8a6b['query'][_0x4900('0x21')]);_0x2abf8d[_0x4900('0x1f')]=qs[_0x4900('0x1f')](_0x3e8a6b[_0x4900('0x2f')][_0x4900('0x1f')]);}_0x2abf8d['order']=qs['sort'](_0x3e8a6b[_0x4900('0x2f')][_0x4900('0x38')]);_0x2abf8d[_0x4900('0x39')]=qs[_0x4900('0x31')](_['pick'](_0x3e8a6b[_0x4900('0x2f')],_0x5eb2fd['filters']),_0x241b8a);if(_0x3e8a6b[_0x4900('0x2f')][_0x4900('0x3a')]){_0x2abf8d[_0x4900('0x39')]=_['merge'](_0x2abf8d[_0x4900('0x39')],{'$or':_['map'](_0x241b8a,function(_0xa9cbf8){if(_0xa9cbf8[_0x4900('0x2e')]!==_0x4900('0x3b')){var _0x1e83ec={};_0x1e83ec[_0xa9cbf8[_0x4900('0x29')]]={'$like':'%'+_0x3e8a6b[_0x4900('0x2f')][_0x4900('0x3a')]+'%'};return _0x1e83ec;}})});}_0x2abf8d=_['merge']({},_0x2abf8d,_0x3e8a6b[_0x4900('0x3c')]);var _0xcde65={'where':_0x2abf8d[_0x4900('0x39')]};return db[_0x4900('0x2b')][_0x4900('0x22')](_0xcde65)[_0x4900('0x25')](function(_0x440b0e){_0x15e172[_0x4900('0x22')]=_0x440b0e;if(_0x3e8a6b['query'][_0x4900('0x3d')]){_0x2abf8d[_0x4900('0x3e')]=[{'all':!![]}];}return db[_0x4900('0x2b')]['findAll'](_0x2abf8d);})[_0x4900('0x25')](function(_0x24f4b0){_0x15e172['rows']=_0x24f4b0;return _0x15e172;})[_0x4900('0x25')](respondWithFilteredResult(_0x473799,_0x2abf8d))[_0x4900('0x3f')](handleError(_0x473799,null));};exports[_0x4900('0x40')]=function(_0x5df812,_0x1d099d){var _0x4116bc={'raw':![],'where':{'id':_0x5df812[_0x4900('0x41')]['id']}},_0x4ac086={};_0x4ac086[_0x4900('0x32')]=_[_0x4900('0x30')](db[_0x4900('0x2b')][_0x4900('0x2c')]);_0x4ac086[_0x4900('0x2f')]=_['keys'](_0x5df812[_0x4900('0x2f')]);_0x4ac086[_0x4900('0x31')]=_[_0x4900('0x34')](_0x4ac086[_0x4900('0x32')],_0x4ac086[_0x4900('0x2f')]);_0x4116bc[_0x4900('0x33')]=_[_0x4900('0x34')](_0x4ac086['model'],qs[_0x4900('0x35')](_0x5df812['query'][_0x4900('0x35')]));_0x4116bc['attributes']=_0x4116bc[_0x4900('0x33')][_0x4900('0x36')]?_0x4116bc[_0x4900('0x33')]:_0x4ac086[_0x4900('0x32')];if(_0x5df812['query'][_0x4900('0x3d')]){_0x4116bc[_0x4900('0x3e')]=[{'all':!![]}];}_0x4116bc=_[_0x4900('0x42')]({},_0x4116bc,_0x5df812[_0x4900('0x3c')]);return db[_0x4900('0x2b')][_0x4900('0x43')](_0x4116bc)['then'](handleEntityNotFound(_0x1d099d,null))[_0x4900('0x25')](respondWithResult(_0x1d099d,null))[_0x4900('0x3f')](handleError(_0x1d099d,null));};exports[_0x4900('0x44')]=function(_0x2c96fc,_0x20d8ac){return db[_0x4900('0x2b')][_0x4900('0x44')](_0x2c96fc[_0x4900('0x45')],{})[_0x4900('0x25')](respondWithResult(_0x20d8ac,0xc9))['catch'](handleError(_0x20d8ac,null));};exports[_0x4900('0x46')]=function(_0x2c1adc,_0x2a3f9a){if(_0x2c1adc['body']['id']){delete _0x2c1adc[_0x4900('0x45')]['id'];}return db[_0x4900('0x2b')][_0x4900('0x43')]({'where':{'id':_0x2c1adc[_0x4900('0x41')]['id']}})[_0x4900('0x25')](handleEntityNotFound(_0x2a3f9a,null))['then'](saveUpdates(_0x2c1adc[_0x4900('0x45')],null))['then'](respondWithResult(_0x2a3f9a,null))[_0x4900('0x3f')](handleError(_0x2a3f9a,null));};exports['destroy']=function(_0x1c0e6c,_0x4fcc6f){return db[_0x4900('0x2b')]['find']({'where':{'id':_0x1c0e6c[_0x4900('0x41')]['id']}})[_0x4900('0x25')](handleEntityNotFound(_0x4fcc6f,null))[_0x4900('0x25')](removeEntity(_0x4fcc6f,null))[_0x4900('0x3f')](handleError(_0x4fcc6f,null));};exports['getSubjects']=function(_0x190c23,_0x58ca0e,_0x47d27b){var _0x5b1b3a={};var _0x2b0be0={};var _0xea036;var _0x19a8d9;return db['FreshsalesConfiguration'][_0x4900('0x47')]({'where':{'id':_0x190c23['params']['id']}})[_0x4900('0x25')](handleEntityNotFound(_0x58ca0e,null))['then'](function(_0x196d6f){if(_0x196d6f){_0xea036=_0x196d6f;_0x2b0be0['model']=_[_0x4900('0x30')](db['FreshsalesField'][_0x4900('0x2c')]);_0x2b0be0['query']=_[_0x4900('0x30')](_0x190c23[_0x4900('0x2f')]);_0x2b0be0[_0x4900('0x31')]=_['intersection'](_0x2b0be0[_0x4900('0x32')],_0x2b0be0['query']);_0x5b1b3a[_0x4900('0x33')]=_[_0x4900('0x34')](_0x2b0be0['model'],qs[_0x4900('0x35')](_0x190c23['query'][_0x4900('0x35')]));_0x5b1b3a[_0x4900('0x33')]=_0x5b1b3a[_0x4900('0x33')][_0x4900('0x36')]?_0x5b1b3a['attributes']:_0x2b0be0[_0x4900('0x32')];_0x5b1b3a[_0x4900('0x48')]=qs[_0x4900('0x38')](_0x190c23[_0x4900('0x2f')][_0x4900('0x38')]);_0x5b1b3a['where']=qs[_0x4900('0x31')](_[_0x4900('0x49')](_0x190c23[_0x4900('0x2f')],_0x2b0be0[_0x4900('0x31')]));if(_0x190c23[_0x4900('0x2f')][_0x4900('0x3a')]){_0x5b1b3a['where']=_['merge'](_0x5b1b3a[_0x4900('0x39')],{'$or':_['map'](_0x5b1b3a[_0x4900('0x33')],function(_0x3f5a60){var _0x8ea5c3={};_0x8ea5c3[_0x3f5a60]={'$like':'%'+_0x190c23[_0x4900('0x2f')][_0x4900('0x3a')]+'%'};return _0x8ea5c3;})});}_0x5b1b3a=_[_0x4900('0x42')]({},_0x5b1b3a,_0x190c23[_0x4900('0x3c')]);return _0xea036['getSubjects'](_0x5b1b3a);}})[_0x4900('0x25')](function(_0x366e73){if(_0x366e73){_0x19a8d9=_0x366e73['length'];if(!_0x190c23[_0x4900('0x2f')][_0x4900('0x4a')](_0x4900('0x37'))){_0x5b1b3a['limit']=qs[_0x4900('0x21')](_0x190c23['query'][_0x4900('0x21')]);_0x5b1b3a[_0x4900('0x1f')]=qs[_0x4900('0x1f')](_0x190c23[_0x4900('0x2f')][_0x4900('0x1f')]);}return _0xea036[_0x4900('0x4b')](_0x5b1b3a);}})[_0x4900('0x25')](function(_0x53d676){if(_0x53d676){return _0x53d676?{'count':_0x19a8d9,'rows':_0x53d676}:null;}})[_0x4900('0x25')](respondWithResult(_0x58ca0e,null))[_0x4900('0x3f')](handleError(_0x58ca0e,null));};exports[_0x4900('0x4c')]=function(_0x49c712,_0x11543e,_0x2130bf){var _0x4f2e9c={};var _0x1c36a7={};var _0x59257f;var _0x4e351b;return db[_0x4900('0x2b')][_0x4900('0x47')]({'where':{'id':_0x49c712[_0x4900('0x41')]['id']}})['then'](handleEntityNotFound(_0x11543e,null))[_0x4900('0x25')](function(_0x215471){if(_0x215471){_0x59257f=_0x215471;_0x1c36a7['model']=_[_0x4900('0x30')](db[_0x4900('0x4d')][_0x4900('0x2c')]);_0x1c36a7[_0x4900('0x2f')]=_[_0x4900('0x30')](_0x49c712[_0x4900('0x2f')]);_0x1c36a7[_0x4900('0x31')]=_[_0x4900('0x34')](_0x1c36a7[_0x4900('0x32')],_0x1c36a7['query']);_0x4f2e9c[_0x4900('0x33')]=_[_0x4900('0x34')](_0x1c36a7['model'],qs[_0x4900('0x35')](_0x49c712[_0x4900('0x2f')][_0x4900('0x35')]));_0x4f2e9c[_0x4900('0x33')]=_0x4f2e9c['attributes'][_0x4900('0x36')]?_0x4f2e9c['attributes']:_0x1c36a7[_0x4900('0x32')];_0x4f2e9c[_0x4900('0x48')]=qs[_0x4900('0x38')](_0x49c712['query'][_0x4900('0x38')]);_0x4f2e9c[_0x4900('0x39')]=qs[_0x4900('0x31')](_['pick'](_0x49c712[_0x4900('0x2f')],_0x1c36a7[_0x4900('0x31')]));if(_0x49c712[_0x4900('0x2f')][_0x4900('0x3a')]){_0x4f2e9c[_0x4900('0x39')]=_[_0x4900('0x42')](_0x4f2e9c[_0x4900('0x39')],{'$or':_[_0x4900('0x2a')](_0x4f2e9c[_0x4900('0x33')],function(_0xb72c77){var _0x151fe5={};_0x151fe5[_0xb72c77]={'$like':'%'+_0x49c712['query']['filter']+'%'};return _0x151fe5;})});}_0x4f2e9c=_['merge']({},_0x4f2e9c,_0x49c712[_0x4900('0x3c')]);return _0x59257f['getDescriptions'](_0x4f2e9c);}})['then'](function(_0x164cd2){if(_0x164cd2){_0x4e351b=_0x164cd2[_0x4900('0x36')];if(!_0x49c712[_0x4900('0x2f')][_0x4900('0x4a')](_0x4900('0x37'))){_0x4f2e9c[_0x4900('0x21')]=qs[_0x4900('0x21')](_0x49c712[_0x4900('0x2f')]['limit']);_0x4f2e9c['offset']=qs[_0x4900('0x1f')](_0x49c712[_0x4900('0x2f')][_0x4900('0x1f')]);}return _0x59257f[_0x4900('0x4c')](_0x4f2e9c);}})[_0x4900('0x25')](function(_0x4016d3){if(_0x4016d3){return _0x4016d3?{'count':_0x4e351b,'rows':_0x4016d3}:null;}})[_0x4900('0x25')](respondWithResult(_0x11543e,null))[_0x4900('0x3f')](handleError(_0x11543e,null));};exports[_0x4900('0x4e')]=function(_0x1daa50,_0x208cbd,_0x3f93c1){var _0x223bda={};var _0x1c4ad9={};var _0x5181b3;var _0x1967bd;return db[_0x4900('0x2b')][_0x4900('0x47')]({'where':{'id':_0x1daa50[_0x4900('0x41')]['id']}})['then'](handleEntityNotFound(_0x208cbd,null))[_0x4900('0x25')](function(_0x539a62){if(_0x539a62){_0x5181b3=_0x539a62;_0x1c4ad9[_0x4900('0x32')]=_[_0x4900('0x30')](db[_0x4900('0x4d')][_0x4900('0x2c')]);_0x1c4ad9['query']=_[_0x4900('0x30')](_0x1daa50[_0x4900('0x2f')]);_0x1c4ad9[_0x4900('0x31')]=_[_0x4900('0x34')](_0x1c4ad9[_0x4900('0x32')],_0x1c4ad9[_0x4900('0x2f')]);_0x223bda[_0x4900('0x33')]=_[_0x4900('0x34')](_0x1c4ad9[_0x4900('0x32')],qs[_0x4900('0x35')](_0x1daa50[_0x4900('0x2f')][_0x4900('0x35')]));_0x223bda[_0x4900('0x33')]=_0x223bda[_0x4900('0x33')][_0x4900('0x36')]?_0x223bda[_0x4900('0x33')]:_0x1c4ad9['model'];_0x223bda[_0x4900('0x48')]=qs[_0x4900('0x38')](_0x1daa50[_0x4900('0x2f')][_0x4900('0x38')]);_0x223bda[_0x4900('0x39')]=qs[_0x4900('0x31')](_['pick'](_0x1daa50[_0x4900('0x2f')],_0x1c4ad9['filters']));if(_0x1daa50[_0x4900('0x2f')][_0x4900('0x3a')]){_0x223bda[_0x4900('0x39')]=_[_0x4900('0x42')](_0x223bda[_0x4900('0x39')],{'$or':_['map'](_0x223bda[_0x4900('0x33')],function(_0x581bfb){var _0x5ccd9d={};_0x5ccd9d[_0x581bfb]={'$like':'%'+_0x1daa50[_0x4900('0x2f')][_0x4900('0x3a')]+'%'};return _0x5ccd9d;})});}_0x223bda=_[_0x4900('0x42')]({},_0x223bda,_0x1daa50['options']);return _0x5181b3['getFields'](_0x223bda);}})[_0x4900('0x25')](function(_0x3ffad5){if(_0x3ffad5){_0x1967bd=_0x3ffad5[_0x4900('0x36')];if(!_0x1daa50[_0x4900('0x2f')][_0x4900('0x4a')]('nolimit')){_0x223bda[_0x4900('0x21')]=qs[_0x4900('0x21')](_0x1daa50[_0x4900('0x2f')][_0x4900('0x21')]);_0x223bda[_0x4900('0x1f')]=qs[_0x4900('0x1f')](_0x1daa50[_0x4900('0x2f')]['offset']);}return _0x5181b3[_0x4900('0x4e')](_0x223bda);}})['then'](function(_0x269ad0){if(_0x269ad0){return _0x269ad0?{'count':_0x1967bd,'rows':_0x269ad0}:null;}})[_0x4900('0x25')](respondWithResult(_0x208cbd,null))['catch'](handleError(_0x208cbd,null));}; \ No newline at end of file +var _0xbf2c=['params','length','include','find','create','body','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show'];(function(_0x38232b,_0x43cb04){var _0x4c4ffe=function(_0x417c33){while(--_0x417c33){_0x38232b['push'](_0x38232b['shift']());}};_0x4c4ffe(++_0x43cb04);}(_0xbf2c,0x1f1));var _0xcbf2=function(_0xbba984,_0x52aeb0){_0xbba984=_0xbba984-0x0;var _0x49024d=_0xbf2c[_0xbba984];return _0x49024d;};'use strict';var emlformat=require(_0xcbf2('0x0'));var rimraf=require(_0xcbf2('0x1'));var zipdir=require(_0xcbf2('0x2'));var jsonpatch=require(_0xcbf2('0x3'));var rp=require(_0xcbf2('0x4'));var moment=require(_0xcbf2('0x5'));var BPromise=require(_0xcbf2('0x6'));var Mustache=require(_0xcbf2('0x7'));var util=require(_0xcbf2('0x8'));var path=require(_0xcbf2('0x9'));var sox=require(_0xcbf2('0xa'));var csv=require(_0xcbf2('0xb'));var ejs=require(_0xcbf2('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbf2('0xd'));var squel=require(_0xcbf2('0xe'));var crypto=require(_0xcbf2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcbf2('0x10'));var toCsv=require(_0xcbf2('0xb'));var querystring=require('querystring');var Papa=require(_0xcbf2('0x11'));var Redis=require(_0xcbf2('0x12'));var authService=require(_0xcbf2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcbf2('0x14'));var hardwareService=require(_0xcbf2('0x15'));var logger=require(_0xcbf2('0x16'))(_0xcbf2('0x17'));var utils=require('../../config/utils');var config=require(_0xcbf2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2e21,_0x457279){_0x457279=_0x457279||0xcc;return function(_0x1ff42b){if(_0x1ff42b){return _0x5a2e21['sendStatus'](_0x457279);}return _0x5a2e21[_0xcbf2('0x19')](_0x457279)[_0xcbf2('0x1a')]();};}function respondWithResult(_0x172458,_0xdb0bd){_0xdb0bd=_0xdb0bd||0xc8;return function(_0x24ca6b){if(_0x24ca6b){return _0x172458[_0xcbf2('0x19')](_0xdb0bd)[_0xcbf2('0x1b')](_0x24ca6b);}};}function respondWithFilteredResult(_0x4b6763,_0x23e438){return function(_0x37cdf2){if(_0x37cdf2){var _0x27285c=typeof _0x23e438['offset']===_0xcbf2('0x1c')&&typeof _0x23e438[_0xcbf2('0x1d')]==='undefined';var _0x92ffa=_0x37cdf2[_0xcbf2('0x1e')];var _0x18644e=_0x27285c?0x0:_0x23e438[_0xcbf2('0x1f')];var _0x47d571=_0x27285c?_0x37cdf2['count']:_0x23e438[_0xcbf2('0x1f')]+_0x23e438[_0xcbf2('0x1d')];var _0x546663;if(_0x47d571>=_0x92ffa){_0x47d571=_0x92ffa;_0x546663=0xc8;}else{_0x546663=0xce;}_0x4b6763['status'](_0x546663);return _0x4b6763[_0xcbf2('0x20')](_0xcbf2('0x21'),_0x18644e+'-'+_0x47d571+'/'+_0x92ffa)[_0xcbf2('0x1b')](_0x37cdf2);}return null;};}function patchUpdates(_0x25bbf1){return function(_0x29c66f){try{jsonpatch[_0xcbf2('0x22')](_0x29c66f,_0x25bbf1,!![]);}catch(_0x13cf92){return BPromise[_0xcbf2('0x23')](_0x13cf92);}return _0x29c66f[_0xcbf2('0x24')]();};}function saveUpdates(_0x2678e4,_0xcf68e6){return function(_0x1446b6){if(_0x1446b6){return _0x1446b6[_0xcbf2('0x25')](_0x2678e4)[_0xcbf2('0x26')](function(_0x2ebb5a){return _0x2ebb5a;});}return null;};}function removeEntity(_0x337ff6,_0x321d2a){return function(_0x3407b3){if(_0x3407b3){return _0x3407b3['destroy']()[_0xcbf2('0x26')](function(){_0x337ff6[_0xcbf2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32760b,_0x1e4b82){return function(_0x4716c3){if(!_0x4716c3){_0x32760b['sendStatus'](0x194);}return _0x4716c3;};}function handleError(_0x35991e,_0x2ff837){_0x2ff837=_0x2ff837||0x1f4;return function(_0xc0057e){logger[_0xcbf2('0x27')](_0xc0057e[_0xcbf2('0x28')]);if(_0xc0057e[_0xcbf2('0x29')]){delete _0xc0057e[_0xcbf2('0x29')];}_0x35991e['status'](_0x2ff837)[_0xcbf2('0x2a')](_0xc0057e);};}exports[_0xcbf2('0x2b')]=function(_0x4b2827,_0x2ba6cf){var _0x1c554a={},_0x13fced={},_0x248c17={'count':0x0,'rows':[]};var _0x2e9a75=_[_0xcbf2('0x2c')](db[_0xcbf2('0x2d')][_0xcbf2('0x2e')],function(_0x21ffa6){return{'name':_0x21ffa6[_0xcbf2('0x2f')],'type':_0x21ffa6[_0xcbf2('0x30')][_0xcbf2('0x31')]};});_0x13fced[_0xcbf2('0x32')]=_[_0xcbf2('0x2c')](_0x2e9a75,_0xcbf2('0x29'));_0x13fced[_0xcbf2('0x33')]=_[_0xcbf2('0x34')](_0x4b2827[_0xcbf2('0x33')]);_0x13fced[_0xcbf2('0x35')]=_[_0xcbf2('0x36')](_0x13fced[_0xcbf2('0x32')],_0x13fced[_0xcbf2('0x33')]);_0x1c554a[_0xcbf2('0x37')]=_[_0xcbf2('0x36')](_0x13fced[_0xcbf2('0x32')],qs[_0xcbf2('0x38')](_0x4b2827['query'][_0xcbf2('0x38')]));_0x1c554a[_0xcbf2('0x37')]=_0x1c554a[_0xcbf2('0x37')]['length']?_0x1c554a[_0xcbf2('0x37')]:_0x13fced[_0xcbf2('0x32')];if(!_0x4b2827[_0xcbf2('0x33')][_0xcbf2('0x39')](_0xcbf2('0x3a'))){_0x1c554a['limit']=qs['limit'](_0x4b2827['query'][_0xcbf2('0x1d')]);_0x1c554a['offset']=qs['offset'](_0x4b2827[_0xcbf2('0x33')][_0xcbf2('0x1f')]);}_0x1c554a[_0xcbf2('0x3b')]=qs[_0xcbf2('0x3c')](_0x4b2827[_0xcbf2('0x33')][_0xcbf2('0x3c')]);_0x1c554a[_0xcbf2('0x3d')]=qs['filters'](_['pick'](_0x4b2827['query'],_0x13fced[_0xcbf2('0x35')]),_0x2e9a75);if(_0x4b2827[_0xcbf2('0x33')]['filter']){_0x1c554a['where']=_[_0xcbf2('0x3e')](_0x1c554a[_0xcbf2('0x3d')],{'$or':_[_0xcbf2('0x2c')](_0x2e9a75,function(_0x435247){if(_0x435247[_0xcbf2('0x30')]!==_0xcbf2('0x3f')){var _0x3641fe={};_0x3641fe[_0x435247[_0xcbf2('0x29')]]={'$like':'%'+_0x4b2827['query'][_0xcbf2('0x40')]+'%'};return _0x3641fe;}})});}_0x1c554a=_['merge']({},_0x1c554a,_0x4b2827[_0xcbf2('0x41')]);var _0x5abdd1={'where':_0x1c554a[_0xcbf2('0x3d')]};return db['FreshsalesConfiguration'][_0xcbf2('0x1e')](_0x5abdd1)['then'](function(_0x5ed2b3){_0x248c17[_0xcbf2('0x1e')]=_0x5ed2b3;if(_0x4b2827[_0xcbf2('0x33')][_0xcbf2('0x42')]){_0x1c554a['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1c554a);})[_0xcbf2('0x26')](function(_0x11c354){_0x248c17[_0xcbf2('0x43')]=_0x11c354;return _0x248c17;})[_0xcbf2('0x26')](respondWithFilteredResult(_0x2ba6cf,_0x1c554a))[_0xcbf2('0x44')](handleError(_0x2ba6cf,null));};exports[_0xcbf2('0x45')]=function(_0x9987ee,_0xc881b6){var _0x1cb894={'raw':![],'where':{'id':_0x9987ee[_0xcbf2('0x46')]['id']}},_0x2dc64b={};_0x2dc64b[_0xcbf2('0x32')]=_[_0xcbf2('0x34')](db['FreshsalesConfiguration']['rawAttributes']);_0x2dc64b[_0xcbf2('0x33')]=_[_0xcbf2('0x34')](_0x9987ee[_0xcbf2('0x33')]);_0x2dc64b[_0xcbf2('0x35')]=_[_0xcbf2('0x36')](_0x2dc64b[_0xcbf2('0x32')],_0x2dc64b[_0xcbf2('0x33')]);_0x1cb894[_0xcbf2('0x37')]=_[_0xcbf2('0x36')](_0x2dc64b['model'],qs[_0xcbf2('0x38')](_0x9987ee[_0xcbf2('0x33')][_0xcbf2('0x38')]));_0x1cb894[_0xcbf2('0x37')]=_0x1cb894[_0xcbf2('0x37')][_0xcbf2('0x47')]?_0x1cb894['attributes']:_0x2dc64b[_0xcbf2('0x32')];if(_0x9987ee[_0xcbf2('0x33')][_0xcbf2('0x42')]){_0x1cb894[_0xcbf2('0x48')]=[{'all':!![]}];}_0x1cb894=_[_0xcbf2('0x3e')]({},_0x1cb894,_0x9987ee['options']);return db[_0xcbf2('0x2d')][_0xcbf2('0x49')](_0x1cb894)[_0xcbf2('0x26')](handleEntityNotFound(_0xc881b6,null))[_0xcbf2('0x26')](respondWithResult(_0xc881b6,null))['catch'](handleError(_0xc881b6,null));};exports[_0xcbf2('0x4a')]=function(_0xba3e25,_0x1b7094){return db[_0xcbf2('0x2d')][_0xcbf2('0x4a')](_0xba3e25[_0xcbf2('0x4b')],{})['then'](respondWithResult(_0x1b7094,0xc9))[_0xcbf2('0x44')](handleError(_0x1b7094,null));};exports['update']=function(_0x26e9b4,_0x52d5f5){if(_0x26e9b4[_0xcbf2('0x4b')]['id']){delete _0x26e9b4[_0xcbf2('0x4b')]['id'];}return db[_0xcbf2('0x2d')][_0xcbf2('0x49')]({'where':{'id':_0x26e9b4[_0xcbf2('0x46')]['id']}})[_0xcbf2('0x26')](handleEntityNotFound(_0x52d5f5,null))[_0xcbf2('0x26')](saveUpdates(_0x26e9b4['body'],null))[_0xcbf2('0x26')](respondWithResult(_0x52d5f5,null))[_0xcbf2('0x44')](handleError(_0x52d5f5,null));};exports['destroy']=function(_0x14ff5d,_0x3d89c5){return db[_0xcbf2('0x2d')][_0xcbf2('0x49')]({'where':{'id':_0x14ff5d['params']['id']}})['then'](handleEntityNotFound(_0x3d89c5,null))[_0xcbf2('0x26')](removeEntity(_0x3d89c5,null))[_0xcbf2('0x44')](handleError(_0x3d89c5,null));};exports[_0xcbf2('0x4c')]=function(_0x2c12fb,_0x493076,_0x41902c){var _0x3e18d2={};var _0x1f602b={};var _0x55de99;var _0x1d8bc5;return db[_0xcbf2('0x2d')]['findOne']({'where':{'id':_0x2c12fb[_0xcbf2('0x46')]['id']}})[_0xcbf2('0x26')](handleEntityNotFound(_0x493076,null))['then'](function(_0x23beb8){if(_0x23beb8){_0x55de99=_0x23beb8;_0x1f602b['model']=_[_0xcbf2('0x34')](db[_0xcbf2('0x4d')]['rawAttributes']);_0x1f602b[_0xcbf2('0x33')]=_['keys'](_0x2c12fb[_0xcbf2('0x33')]);_0x1f602b[_0xcbf2('0x35')]=_[_0xcbf2('0x36')](_0x1f602b[_0xcbf2('0x32')],_0x1f602b[_0xcbf2('0x33')]);_0x3e18d2[_0xcbf2('0x37')]=_[_0xcbf2('0x36')](_0x1f602b[_0xcbf2('0x32')],qs[_0xcbf2('0x38')](_0x2c12fb[_0xcbf2('0x33')]['fields']));_0x3e18d2[_0xcbf2('0x37')]=_0x3e18d2['attributes'][_0xcbf2('0x47')]?_0x3e18d2[_0xcbf2('0x37')]:_0x1f602b[_0xcbf2('0x32')];_0x3e18d2[_0xcbf2('0x3b')]=qs[_0xcbf2('0x3c')](_0x2c12fb[_0xcbf2('0x33')]['sort']);_0x3e18d2[_0xcbf2('0x3d')]=qs['filters'](_['pick'](_0x2c12fb[_0xcbf2('0x33')],_0x1f602b[_0xcbf2('0x35')]));if(_0x2c12fb[_0xcbf2('0x33')][_0xcbf2('0x40')]){_0x3e18d2['where']=_[_0xcbf2('0x3e')](_0x3e18d2[_0xcbf2('0x3d')],{'$or':_[_0xcbf2('0x2c')](_0x3e18d2[_0xcbf2('0x37')],function(_0x10bd48){var _0x51ca74={};_0x51ca74[_0x10bd48]={'$like':'%'+_0x2c12fb[_0xcbf2('0x33')][_0xcbf2('0x40')]+'%'};return _0x51ca74;})});}_0x3e18d2=_[_0xcbf2('0x3e')]({},_0x3e18d2,_0x2c12fb['options']);return _0x55de99[_0xcbf2('0x4c')](_0x3e18d2);}})[_0xcbf2('0x26')](function(_0x3ecadb){if(_0x3ecadb){_0x1d8bc5=_0x3ecadb[_0xcbf2('0x47')];if(!_0x2c12fb[_0xcbf2('0x33')][_0xcbf2('0x39')](_0xcbf2('0x3a'))){_0x3e18d2[_0xcbf2('0x1d')]=qs[_0xcbf2('0x1d')](_0x2c12fb[_0xcbf2('0x33')][_0xcbf2('0x1d')]);_0x3e18d2[_0xcbf2('0x1f')]=qs['offset'](_0x2c12fb[_0xcbf2('0x33')][_0xcbf2('0x1f')]);}return _0x55de99[_0xcbf2('0x4c')](_0x3e18d2);}})[_0xcbf2('0x26')](function(_0x1bc8de){if(_0x1bc8de){return _0x1bc8de?{'count':_0x1d8bc5,'rows':_0x1bc8de}:null;}})[_0xcbf2('0x26')](respondWithResult(_0x493076,null))['catch'](handleError(_0x493076,null));};exports[_0xcbf2('0x4e')]=function(_0x4e92d,_0x13349a,_0x11f57d){var _0x4b9391={};var _0x281588={};var _0x3e1204;var _0x455c5a;return db[_0xcbf2('0x2d')][_0xcbf2('0x4f')]({'where':{'id':_0x4e92d[_0xcbf2('0x46')]['id']}})[_0xcbf2('0x26')](handleEntityNotFound(_0x13349a,null))[_0xcbf2('0x26')](function(_0x2a9f31){if(_0x2a9f31){_0x3e1204=_0x2a9f31;_0x281588['model']=_[_0xcbf2('0x34')](db[_0xcbf2('0x4d')][_0xcbf2('0x2e')]);_0x281588[_0xcbf2('0x33')]=_[_0xcbf2('0x34')](_0x4e92d[_0xcbf2('0x33')]);_0x281588[_0xcbf2('0x35')]=_[_0xcbf2('0x36')](_0x281588[_0xcbf2('0x32')],_0x281588['query']);_0x4b9391[_0xcbf2('0x37')]=_[_0xcbf2('0x36')](_0x281588[_0xcbf2('0x32')],qs[_0xcbf2('0x38')](_0x4e92d[_0xcbf2('0x33')][_0xcbf2('0x38')]));_0x4b9391[_0xcbf2('0x37')]=_0x4b9391['attributes'][_0xcbf2('0x47')]?_0x4b9391[_0xcbf2('0x37')]:_0x281588[_0xcbf2('0x32')];_0x4b9391['order']=qs['sort'](_0x4e92d[_0xcbf2('0x33')]['sort']);_0x4b9391[_0xcbf2('0x3d')]=qs[_0xcbf2('0x35')](_['pick'](_0x4e92d[_0xcbf2('0x33')],_0x281588[_0xcbf2('0x35')]));if(_0x4e92d[_0xcbf2('0x33')][_0xcbf2('0x40')]){_0x4b9391[_0xcbf2('0x3d')]=_[_0xcbf2('0x3e')](_0x4b9391[_0xcbf2('0x3d')],{'$or':_[_0xcbf2('0x2c')](_0x4b9391['attributes'],function(_0x4ce81e){var _0x3d326a={};_0x3d326a[_0x4ce81e]={'$like':'%'+_0x4e92d['query'][_0xcbf2('0x40')]+'%'};return _0x3d326a;})});}_0x4b9391=_['merge']({},_0x4b9391,_0x4e92d['options']);return _0x3e1204[_0xcbf2('0x4e')](_0x4b9391);}})[_0xcbf2('0x26')](function(_0xeba33b){if(_0xeba33b){_0x455c5a=_0xeba33b[_0xcbf2('0x47')];if(!_0x4e92d[_0xcbf2('0x33')][_0xcbf2('0x39')](_0xcbf2('0x3a'))){_0x4b9391['limit']=qs['limit'](_0x4e92d['query'][_0xcbf2('0x1d')]);_0x4b9391[_0xcbf2('0x1f')]=qs[_0xcbf2('0x1f')](_0x4e92d[_0xcbf2('0x33')][_0xcbf2('0x1f')]);}return _0x3e1204[_0xcbf2('0x4e')](_0x4b9391);}})[_0xcbf2('0x26')](function(_0x6b047d){if(_0x6b047d){return _0x6b047d?{'count':_0x455c5a,'rows':_0x6b047d}:null;}})[_0xcbf2('0x26')](respondWithResult(_0x13349a,null))[_0xcbf2('0x44')](handleError(_0x13349a,null));};exports[_0xcbf2('0x50')]=function(_0x1656d2,_0x5b0113,_0x209128){var _0x94c450={};var _0x147435={};var _0x5242f4;var _0x2890f2;return db[_0xcbf2('0x2d')][_0xcbf2('0x4f')]({'where':{'id':_0x1656d2[_0xcbf2('0x46')]['id']}})[_0xcbf2('0x26')](handleEntityNotFound(_0x5b0113,null))[_0xcbf2('0x26')](function(_0x5322c4){if(_0x5322c4){_0x5242f4=_0x5322c4;_0x147435[_0xcbf2('0x32')]=_['keys'](db[_0xcbf2('0x4d')][_0xcbf2('0x2e')]);_0x147435[_0xcbf2('0x33')]=_[_0xcbf2('0x34')](_0x1656d2[_0xcbf2('0x33')]);_0x147435['filters']=_[_0xcbf2('0x36')](_0x147435[_0xcbf2('0x32')],_0x147435[_0xcbf2('0x33')]);_0x94c450[_0xcbf2('0x37')]=_['intersection'](_0x147435['model'],qs['fields'](_0x1656d2[_0xcbf2('0x33')][_0xcbf2('0x38')]));_0x94c450[_0xcbf2('0x37')]=_0x94c450['attributes']['length']?_0x94c450[_0xcbf2('0x37')]:_0x147435[_0xcbf2('0x32')];_0x94c450[_0xcbf2('0x3b')]=qs[_0xcbf2('0x3c')](_0x1656d2[_0xcbf2('0x33')]['sort']);_0x94c450['where']=qs[_0xcbf2('0x35')](_['pick'](_0x1656d2[_0xcbf2('0x33')],_0x147435[_0xcbf2('0x35')]));if(_0x1656d2[_0xcbf2('0x33')][_0xcbf2('0x40')]){_0x94c450['where']=_['merge'](_0x94c450[_0xcbf2('0x3d')],{'$or':_['map'](_0x94c450[_0xcbf2('0x37')],function(_0x26f03d){var _0x5a37c3={};_0x5a37c3[_0x26f03d]={'$like':'%'+_0x1656d2['query'][_0xcbf2('0x40')]+'%'};return _0x5a37c3;})});}_0x94c450=_['merge']({},_0x94c450,_0x1656d2[_0xcbf2('0x41')]);return _0x5242f4['getFields'](_0x94c450);}})[_0xcbf2('0x26')](function(_0x47a8b9){if(_0x47a8b9){_0x2890f2=_0x47a8b9['length'];if(!_0x1656d2[_0xcbf2('0x33')][_0xcbf2('0x39')](_0xcbf2('0x3a'))){_0x94c450['limit']=qs['limit'](_0x1656d2[_0xcbf2('0x33')][_0xcbf2('0x1d')]);_0x94c450[_0xcbf2('0x1f')]=qs[_0xcbf2('0x1f')](_0x1656d2[_0xcbf2('0x33')][_0xcbf2('0x1f')]);}return _0x5242f4['getFields'](_0x94c450);}})[_0xcbf2('0x26')](function(_0x3146a7){if(_0x3146a7){return _0x3146a7?{'count':_0x2890f2,'rows':_0x3146a7}:null;}})[_0xcbf2('0x26')](respondWithResult(_0x5b0113,null))[_0xcbf2('0x44')](handleError(_0x5b0113,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 54c5831..6dccbe4 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 _0xb935=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x8d4b94,_0xd7112e){var _0x8913a=function(_0x536fff){while(--_0x536fff){_0x8d4b94['push'](_0x8d4b94['shift']());}};_0x8913a(++_0xd7112e);}(_0xb935,0xac));var _0x5b93=function(_0x4fdcb2,_0x44a823){_0x4fdcb2=_0x4fdcb2-0x0;var _0x30614b=_0xb935[_0x4fdcb2];return _0x30614b;};'use strict';var _=require(_0x5b93('0x0'));var util=require(_0x5b93('0x1'));var logger=require(_0x5b93('0x2'))(_0x5b93('0x3'));var moment=require(_0x5b93('0x4'));var BPromise=require(_0x5b93('0x5'));var rp=require(_0x5b93('0x6'));var fs=require('fs');var path=require(_0x5b93('0x7'));var rimraf=require('rimraf');var config=require(_0x5b93('0x8'));var attributes=require(_0x5b93('0x9'));module[_0x5b93('0xa')]=function(_0x3d92e4,_0xf49105){return _0x3d92e4['define'](_0x5b93('0xb'),attributes,{'tableName':_0x5b93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63bd=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x63bd,0x13b));var _0xd63b=function(_0x544fe4,_0x19f284){_0x544fe4=_0x544fe4-0x0;var _0x466b71=_0x63bd[_0x544fe4];return _0x466b71;};'use strict';var _=require(_0xd63b('0x0'));var util=require(_0xd63b('0x1'));var logger=require(_0xd63b('0x2'))(_0xd63b('0x3'));var moment=require(_0xd63b('0x4'));var BPromise=require(_0xd63b('0x5'));var rp=require(_0xd63b('0x6'));var fs=require('fs');var path=require(_0xd63b('0x7'));var rimraf=require(_0xd63b('0x8'));var config=require(_0xd63b('0x9'));var attributes=require(_0xd63b('0xa'));module[_0xd63b('0xb')]=function(_0x1bb626,_0x4c2252){return _0x1bb626[_0xd63b('0xc')]('FreshsalesConfiguration',attributes,{'tableName':_0xd63b('0xd'),'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 f5abf8e..26a2b2e 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 _0x8e0e=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0x8e0e,0x64));var _0xe8e0=function(_0x3a09e5,_0x22b07d){_0x3a09e5=_0x3a09e5-0x0;var _0x47f87d=_0x8e0e[_0x3a09e5];return _0x47f87d;};'use strict';var _=require(_0xe8e0('0x0'));var util=require(_0xe8e0('0x1'));var moment=require(_0xe8e0('0x2'));var BPromise=require(_0xe8e0('0x3'));var rs=require(_0xe8e0('0x4'));var fs=require('fs');var Redis=require(_0xe8e0('0x5'));var db=require(_0xe8e0('0x6'))['db'];var utils=require(_0xe8e0('0x7'));var logger=require(_0xe8e0('0x8'))(_0xe8e0('0x9'));var config=require(_0xe8e0('0xa'));var jayson=require(_0xe8e0('0xb'));var client=jayson[_0xe8e0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x317d12,_0x5b114c,_0x38a0f5){return new BPromise(function(_0x4028a6,_0x22d9a5){return client[_0xe8e0('0xd')](_0x317d12,_0x38a0f5)[_0xe8e0('0xe')](function(_0x2b2e2e){logger[_0xe8e0('0xf')](_0xe8e0('0x10'),_0x5b114c,_0xe8e0('0x11'));logger['debug'](_0xe8e0('0x12'),_0x5b114c,_0xe8e0('0x11'),JSON['stringify'](_0x2b2e2e));if(_0x2b2e2e[_0xe8e0('0x13')]){if(_0x2b2e2e[_0xe8e0('0x13')][_0xe8e0('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b114c,_0x2b2e2e[_0xe8e0('0x13')][_0xe8e0('0x15')]);return _0x22d9a5(_0x2b2e2e[_0xe8e0('0x13')][_0xe8e0('0x15')]);}logger[_0xe8e0('0x13')](_0xe8e0('0x10'),_0x5b114c,_0x2b2e2e[_0xe8e0('0x13')]['message']);return _0x4028a6(_0x2b2e2e[_0xe8e0('0x13')][_0xe8e0('0x15')]);}else{logger['info'](_0xe8e0('0x10'),_0x5b114c,_0xe8e0('0x11'));_0x4028a6(_0x2b2e2e[_0xe8e0('0x16')][_0xe8e0('0x15')]);}})['catch'](function(_0x2ad21b){logger[_0xe8e0('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b114c,_0x2ad21b);_0x22d9a5(_0x2ad21b);});});} \ No newline at end of file +var _0x393d=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','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'];(function(_0x27f8e7,_0x27873e){var _0x2bda25=function(_0x38643e){while(--_0x38643e){_0x27f8e7['push'](_0x27f8e7['shift']());}};_0x2bda25(++_0x27873e);}(_0x393d,0x84));var _0xd393=function(_0x40a69b,_0x30a7e9){_0x40a69b=_0x40a69b-0x0;var _0x31c177=_0x393d[_0x40a69b];return _0x31c177;};'use strict';var _=require(_0xd393('0x0'));var util=require(_0xd393('0x1'));var moment=require(_0xd393('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd393('0x3'));var db=require(_0xd393('0x4'))['db'];var utils=require(_0xd393('0x5'));var logger=require('../../config/logger')(_0xd393('0x6'));var config=require(_0xd393('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd393('0x8')][_0xd393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x253c4c,_0x7a0230,_0x5c20f4){return new BPromise(function(_0xfd430d,_0x5016da){return client['request'](_0x253c4c,_0x5c20f4)[_0xd393('0xa')](function(_0x1b92a8){logger[_0xd393('0xb')](_0xd393('0xc'),_0x7a0230,_0xd393('0xd'));logger[_0xd393('0xe')](_0xd393('0xf'),_0x7a0230,_0xd393('0xd'),JSON[_0xd393('0x10')](_0x1b92a8));if(_0x1b92a8[_0xd393('0x11')]){if(_0x1b92a8[_0xd393('0x11')][_0xd393('0x12')]===0x1f4){logger[_0xd393('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7a0230,_0x1b92a8[_0xd393('0x11')][_0xd393('0x13')]);return _0x5016da(_0x1b92a8['error']['message']);}logger[_0xd393('0x11')](_0xd393('0xc'),_0x7a0230,_0x1b92a8[_0xd393('0x11')][_0xd393('0x13')]);return _0xfd430d(_0x1b92a8[_0xd393('0x11')][_0xd393('0x13')]);}else{logger[_0xd393('0xb')](_0xd393('0xc'),_0x7a0230,_0xd393('0xd'));_0xfd430d(_0x1b92a8[_0xd393('0x14')][_0xd393('0x13')]);}})[_0xd393('0x15')](function(_0x589e1f){logger[_0xd393('0x11')](_0xd393('0xc'),_0x7a0230,_0x589e1f);_0x5016da(_0x589e1f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 004ac58..8b4772f 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 _0x8868=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','index','get','isAuthenticated','post','create','put','/:id','delete','destroy','multer','util'];(function(_0x55447a,_0x3220be){var _0x33a38b=function(_0x1b4e2b){while(--_0x1b4e2b){_0x55447a['push'](_0x55447a['shift']());}};_0x33a38b(++_0x3220be);}(_0x8868,0x1ca));var _0x8886=function(_0x5d611d,_0x18af65){_0x5d611d=_0x5d611d-0x0;var _0x5a1308=_0x8868[_0x5d611d];return _0x5a1308;};'use strict';var multer=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var path=require(_0x8886('0x2'));var timeout=require(_0x8886('0x3'));var express=require(_0x8886('0x4'));var router=express[_0x8886('0x5')]();var fs_extra=require(_0x8886('0x6'));var auth=require(_0x8886('0x7'));var interaction=require(_0x8886('0x8'));var config=require(_0x8886('0x9'));var controller=require(_0x8886('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8886('0xb')]);router[_0x8886('0xc')]('/:id',auth[_0x8886('0xd')](),controller['show']);router[_0x8886('0xe')]('/',auth[_0x8886('0xd')](),controller[_0x8886('0xf')]);router[_0x8886('0x10')](_0x8886('0x11'),auth[_0x8886('0xd')](),controller['update']);router[_0x8886('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8886('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd3b4=['fs-extra','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x55e3cb,_0x14ce9d){_0x55e3cb=_0x55e3cb-0x0;var _0x19a1c8=_0xd3b4[_0x55e3cb];return _0x19a1c8;};'use strict';var multer=require(_0x4d3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4d3b('0x1'));var express=require(_0x4d3b('0x2'));var router=express[_0x4d3b('0x3')]();var fs_extra=require(_0x4d3b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4d3b('0x5'));var config=require('../../config/environment');var controller=require(_0x4d3b('0x6'));router[_0x4d3b('0x7')]('/',auth[_0x4d3b('0x8')](),controller[_0x4d3b('0x9')]);router[_0x4d3b('0x7')](_0x4d3b('0xa'),auth[_0x4d3b('0x8')](),controller[_0x4d3b('0xb')]);router[_0x4d3b('0xc')]('/',auth[_0x4d3b('0x8')](),controller['create']);router[_0x4d3b('0xd')]('/:id',auth[_0x4d3b('0x8')](),controller['update']);router[_0x4d3b('0xe')](_0x4d3b('0xa'),auth[_0x4d3b('0x8')](),controller[_0x4d3b('0xf')]);module[_0x4d3b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2cbf88a..9ef4d62 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 _0x50bd=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50bd,0x1d9));var _0xd50b=function(_0x2f603a,_0x56dcbb){_0x2f603a=_0x2f603a-0x0;var _0x37db08=_0x50bd[_0x2f603a];return _0x37db08;};'use strict';var Sequelize=require('sequelize');module[_0xd50b('0x0')]={'type':{'type':Sequelize[_0xd50b('0x1')](_0xd50b('0x2'),_0xd50b('0x3'),_0xd50b('0x4'),_0xd50b('0x5'),_0xd50b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd50b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd50b('0x1')](_0xd50b('0x2'),_0xd50b('0x3'),_0xd50b('0x4'))},'keyContent':{'type':Sequelize[_0xd50b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd50b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd50b('0x7')]}}; \ No newline at end of file +var _0x4df7=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x41e083,_0x6e9eb6){var _0x12894a=function(_0x5d7a68){while(--_0x5d7a68){_0x41e083['push'](_0x41e083['shift']());}};_0x12894a(++_0x6e9eb6);}(_0x4df7,0x12b));var _0x74df=function(_0x9cffbe,_0x5bd6d2){_0x9cffbe=_0x9cffbe-0x0;var _0x94b478=_0x4df7[_0x9cffbe];return _0x94b478;};'use strict';var Sequelize=require(_0x74df('0x0'));module['exports']={'type':{'type':Sequelize[_0x74df('0x1')](_0x74df('0x2'),_0x74df('0x3'),_0x74df('0x4'),'keyValue',_0x74df('0x5')),'defaultValue':_0x74df('0x2')},'content':{'type':Sequelize[_0x74df('0x6')]},'key':{'type':Sequelize[_0x74df('0x6')]},'keyType':{'type':Sequelize[_0x74df('0x1')](_0x74df('0x2'),_0x74df('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x74df('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x74df('0x6')]},'customField':{'type':Sequelize[_0x74df('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x74df('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 03016b7..93f3fbc 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 _0x6cc3=['eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body'];(function(_0x26a490,_0x1d54cf){var _0x4f14c1=function(_0x47922f){while(--_0x47922f){_0x26a490['push'](_0x26a490['shift']());}};_0x4f14c1(++_0x1d54cf);}(_0x6cc3,0x11c));var _0x36cc=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0x6cc3[_0x509c83];return _0x534626;};'use strict';var emlformat=require(_0x36cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x36cc('0x1'));var jsonpatch=require(_0x36cc('0x2'));var rp=require(_0x36cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36cc('0x4'));var util=require(_0x36cc('0x5'));var path=require(_0x36cc('0x6'));var sox=require(_0x36cc('0x7'));var csv=require(_0x36cc('0x8'));var ejs=require(_0x36cc('0x9'));var fs=require('fs');var fs_extra=require(_0x36cc('0xa'));var _=require(_0x36cc('0xb'));var squel=require(_0x36cc('0xc'));var crypto=require(_0x36cc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x36cc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x36cc('0xe'));var authService=require(_0x36cc('0xf'));var qs=require(_0x36cc('0x10'));var as=require(_0x36cc('0x11'));var hardwareService=require(_0x36cc('0x12'));var logger=require(_0x36cc('0x13'))(_0x36cc('0x14'));var utils=require(_0x36cc('0x15'));var config=require(_0x36cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x36cc('0x17'))['db'];function respondWithStatusCode(_0x39ebd9,_0x2065ae){_0x2065ae=_0x2065ae||0xcc;return function(_0x3f0446){if(_0x3f0446){return _0x39ebd9[_0x36cc('0x18')](_0x2065ae);}return _0x39ebd9[_0x36cc('0x19')](_0x2065ae)[_0x36cc('0x1a')]();};}function respondWithResult(_0x44e672,_0x5473a0){_0x5473a0=_0x5473a0||0xc8;return function(_0x52f005){if(_0x52f005){return _0x44e672[_0x36cc('0x19')](_0x5473a0)[_0x36cc('0x1b')](_0x52f005);}};}function respondWithFilteredResult(_0x16b909,_0xf0e55){return function(_0x1d30e7){if(_0x1d30e7){var _0x181eb7=typeof _0xf0e55['offset']==='undefined'&&typeof _0xf0e55[_0x36cc('0x1c')]===_0x36cc('0x1d');var _0x30905a=_0x1d30e7[_0x36cc('0x1e')];var _0x806e34=_0x181eb7?0x0:_0xf0e55[_0x36cc('0x1f')];var _0x35588a=_0x181eb7?_0x1d30e7[_0x36cc('0x1e')]:_0xf0e55[_0x36cc('0x1f')]+_0xf0e55[_0x36cc('0x1c')];var _0x177eb2;if(_0x35588a>=_0x30905a){_0x35588a=_0x30905a;_0x177eb2=0xc8;}else{_0x177eb2=0xce;}_0x16b909[_0x36cc('0x19')](_0x177eb2);return _0x16b909['set']('Content-Range',_0x806e34+'-'+_0x35588a+'/'+_0x30905a)[_0x36cc('0x1b')](_0x1d30e7);}return null;};}function patchUpdates(_0x8bcd87){return function(_0x2d1640){try{jsonpatch[_0x36cc('0x20')](_0x2d1640,_0x8bcd87,!![]);}catch(_0x66918c){return BPromise[_0x36cc('0x21')](_0x66918c);}return _0x2d1640['save']();};}function saveUpdates(_0x5cafe0,_0x1e2314){return function(_0x5407f9){if(_0x5407f9){return _0x5407f9[_0x36cc('0x22')](_0x5cafe0)[_0x36cc('0x23')](function(_0x3b43f1){return _0x3b43f1;});}return null;};}function removeEntity(_0x53d14e,_0x17bd93){return function(_0x4244a0){if(_0x4244a0){return _0x4244a0[_0x36cc('0x24')]()[_0x36cc('0x23')](function(){_0x53d14e[_0x36cc('0x19')](0xcc)[_0x36cc('0x1a')]();});}};}function handleEntityNotFound(_0x13b98d,_0xb4f47f){return function(_0x4477bd){if(!_0x4477bd){_0x13b98d[_0x36cc('0x18')](0x194);}return _0x4477bd;};}function handleError(_0x730578,_0xd36a0e){_0xd36a0e=_0xd36a0e||0x1f4;return function(_0x53eba5){logger[_0x36cc('0x25')](_0x53eba5['stack']);if(_0x53eba5[_0x36cc('0x26')]){delete _0x53eba5[_0x36cc('0x26')];}_0x730578[_0x36cc('0x19')](_0xd36a0e)[_0x36cc('0x27')](_0x53eba5);};}exports[_0x36cc('0x28')]=function(_0xec0c33,_0x103ed8){var _0x5e1bff={},_0x4d5cf9={},_0x1e7431={'count':0x0,'rows':[]};var _0x1244d3=_['map'](db['FreshsalesField'][_0x36cc('0x29')],function(_0x6cdb2){return{'name':_0x6cdb2[_0x36cc('0x2a')],'type':_0x6cdb2[_0x36cc('0x2b')][_0x36cc('0x2c')]};});_0x4d5cf9[_0x36cc('0x2d')]=_[_0x36cc('0x2e')](_0x1244d3,_0x36cc('0x26'));_0x4d5cf9[_0x36cc('0x2f')]=_['keys'](_0xec0c33['query']);_0x4d5cf9['filters']=_[_0x36cc('0x30')](_0x4d5cf9[_0x36cc('0x2d')],_0x4d5cf9[_0x36cc('0x2f')]);_0x5e1bff[_0x36cc('0x31')]=_['intersection'](_0x4d5cf9[_0x36cc('0x2d')],qs[_0x36cc('0x32')](_0xec0c33[_0x36cc('0x2f')][_0x36cc('0x32')]));_0x5e1bff[_0x36cc('0x31')]=_0x5e1bff[_0x36cc('0x31')][_0x36cc('0x33')]?_0x5e1bff[_0x36cc('0x31')]:_0x4d5cf9[_0x36cc('0x2d')];if(!_0xec0c33['query']['hasOwnProperty']('nolimit')){_0x5e1bff[_0x36cc('0x1c')]=qs[_0x36cc('0x1c')](_0xec0c33[_0x36cc('0x2f')]['limit']);_0x5e1bff[_0x36cc('0x1f')]=qs[_0x36cc('0x1f')](_0xec0c33[_0x36cc('0x2f')]['offset']);}_0x5e1bff[_0x36cc('0x34')]=qs[_0x36cc('0x35')](_0xec0c33['query'][_0x36cc('0x35')]);_0x5e1bff[_0x36cc('0x36')]=qs['filters'](_['pick'](_0xec0c33[_0x36cc('0x2f')],_0x4d5cf9[_0x36cc('0x37')]),_0x1244d3);if(_0xec0c33['query'][_0x36cc('0x38')]){_0x5e1bff[_0x36cc('0x36')]=_[_0x36cc('0x39')](_0x5e1bff[_0x36cc('0x36')],{'$or':_[_0x36cc('0x2e')](_0x1244d3,function(_0x1eb9f4){if(_0x1eb9f4[_0x36cc('0x2b')]!=='VIRTUAL'){var _0x52e13d={};_0x52e13d[_0x1eb9f4[_0x36cc('0x26')]]={'$like':'%'+_0xec0c33[_0x36cc('0x2f')]['filter']+'%'};return _0x52e13d;}})});}_0x5e1bff=_[_0x36cc('0x39')]({},_0x5e1bff,_0xec0c33[_0x36cc('0x3a')]);var _0x4a5d71={'where':_0x5e1bff[_0x36cc('0x36')]};return db[_0x36cc('0x3b')][_0x36cc('0x1e')](_0x4a5d71)[_0x36cc('0x23')](function(_0x5684a2){_0x1e7431['count']=_0x5684a2;if(_0xec0c33[_0x36cc('0x2f')][_0x36cc('0x3c')]){_0x5e1bff[_0x36cc('0x3d')]=[{'all':!![]}];}return db[_0x36cc('0x3b')][_0x36cc('0x3e')](_0x5e1bff);})[_0x36cc('0x23')](function(_0x5a68db){_0x1e7431[_0x36cc('0x3f')]=_0x5a68db;return _0x1e7431;})[_0x36cc('0x23')](respondWithFilteredResult(_0x103ed8,_0x5e1bff))['catch'](handleError(_0x103ed8,null));};exports[_0x36cc('0x40')]=function(_0x46cd6e,_0x1828f6){var _0x9337bb={'raw':!![],'where':{'id':_0x46cd6e[_0x36cc('0x41')]['id']}},_0x5686b3={};_0x5686b3[_0x36cc('0x2d')]=_[_0x36cc('0x42')](db['FreshsalesField'][_0x36cc('0x29')]);_0x5686b3[_0x36cc('0x2f')]=_['keys'](_0x46cd6e['query']);_0x5686b3[_0x36cc('0x37')]=_[_0x36cc('0x30')](_0x5686b3[_0x36cc('0x2d')],_0x5686b3['query']);_0x9337bb['attributes']=_['intersection'](_0x5686b3['model'],qs[_0x36cc('0x32')](_0x46cd6e[_0x36cc('0x2f')][_0x36cc('0x32')]));_0x9337bb[_0x36cc('0x31')]=_0x9337bb['attributes']['length']?_0x9337bb[_0x36cc('0x31')]:_0x5686b3[_0x36cc('0x2d')];if(_0x46cd6e[_0x36cc('0x2f')][_0x36cc('0x3c')]){_0x9337bb[_0x36cc('0x3d')]=[{'all':!![]}];}_0x9337bb=_[_0x36cc('0x39')]({},_0x9337bb,_0x46cd6e[_0x36cc('0x3a')]);return db['FreshsalesField'][_0x36cc('0x43')](_0x9337bb)[_0x36cc('0x23')](handleEntityNotFound(_0x1828f6,null))[_0x36cc('0x23')](respondWithResult(_0x1828f6,null))[_0x36cc('0x44')](handleError(_0x1828f6,null));};exports['create']=function(_0x32507e,_0x24ae3a){return db[_0x36cc('0x3b')][_0x36cc('0x45')](_0x32507e[_0x36cc('0x46')],{})['then'](respondWithResult(_0x24ae3a,0xc9))['catch'](handleError(_0x24ae3a,null));};exports[_0x36cc('0x22')]=function(_0x59e205,_0x38bc24){if(_0x59e205[_0x36cc('0x46')]['id']){delete _0x59e205[_0x36cc('0x46')]['id'];}return db['FreshsalesField'][_0x36cc('0x43')]({'where':{'id':_0x59e205[_0x36cc('0x41')]['id']}})['then'](handleEntityNotFound(_0x38bc24,null))[_0x36cc('0x23')](saveUpdates(_0x59e205['body'],null))[_0x36cc('0x23')](respondWithResult(_0x38bc24,null))[_0x36cc('0x44')](handleError(_0x38bc24,null));};exports[_0x36cc('0x24')]=function(_0x4cc89e,_0x3ced50){return db[_0x36cc('0x3b')]['find']({'where':{'id':_0x4cc89e[_0x36cc('0x41')]['id']}})[_0x36cc('0x23')](handleEntityNotFound(_0x3ced50,null))['then'](removeEntity(_0x3ced50,null))['catch'](handleError(_0x3ced50,null));}; \ No newline at end of file +var _0x9180=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','stack','send','index','map','FreshsalesField','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','rimraf','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','api','../../config/environment'];(function(_0x59577e,_0x16bdf1){var _0x1c1215=function(_0x2339c2){while(--_0x2339c2){_0x59577e['push'](_0x59577e['shift']());}};_0x1c1215(++_0x16bdf1);}(_0x9180,0x1e7));var _0x0918=function(_0x4bd4ce,_0x5981fe){_0x4bd4ce=_0x4bd4ce-0x0;var _0x1ea87e=_0x9180[_0x4bd4ce];return _0x1ea87e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0918('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0918('0x1'));var rp=require(_0x0918('0x2'));var moment=require(_0x0918('0x3'));var BPromise=require(_0x0918('0x4'));var Mustache=require(_0x0918('0x5'));var util=require(_0x0918('0x6'));var path=require('path');var sox=require(_0x0918('0x7'));var csv=require(_0x0918('0x8'));var ejs=require(_0x0918('0x9'));var fs=require('fs');var fs_extra=require(_0x0918('0xa'));var _=require(_0x0918('0xb'));var squel=require(_0x0918('0xc'));var crypto=require('crypto');var jsforce=require(_0x0918('0xd'));var deskjs=require(_0x0918('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0918('0xf'));var Papa=require(_0x0918('0x10'));var Redis=require(_0x0918('0x11'));var authService=require(_0x0918('0x12'));var qs=require(_0x0918('0x13'));var as=require(_0x0918('0x14'));var hardwareService=require(_0x0918('0x15'));var logger=require('../../config/logger')(_0x0918('0x16'));var utils=require('../../config/utils');var config=require(_0x0918('0x17'));var licenseUtil=require(_0x0918('0x18'));var db=require(_0x0918('0x19'))['db'];function respondWithStatusCode(_0x16a33a,_0x1e155b){_0x1e155b=_0x1e155b||0xcc;return function(_0x20773d){if(_0x20773d){return _0x16a33a[_0x0918('0x1a')](_0x1e155b);}return _0x16a33a[_0x0918('0x1b')](_0x1e155b)['end']();};}function respondWithResult(_0x543fff,_0x374513){_0x374513=_0x374513||0xc8;return function(_0x3dc88f){if(_0x3dc88f){return _0x543fff[_0x0918('0x1b')](_0x374513)['json'](_0x3dc88f);}};}function respondWithFilteredResult(_0x4f69a8,_0x247430){return function(_0x61c57){if(_0x61c57){var _0xbd78a4=typeof _0x247430[_0x0918('0x1c')]===_0x0918('0x1d')&&typeof _0x247430[_0x0918('0x1e')]===_0x0918('0x1d');var _0x207b04=_0x61c57['count'];var _0xd2da69=_0xbd78a4?0x0:_0x247430[_0x0918('0x1c')];var _0x31e3bf=_0xbd78a4?_0x61c57[_0x0918('0x1f')]:_0x247430[_0x0918('0x1c')]+_0x247430['limit'];var _0x299ce7;if(_0x31e3bf>=_0x207b04){_0x31e3bf=_0x207b04;_0x299ce7=0xc8;}else{_0x299ce7=0xce;}_0x4f69a8['status'](_0x299ce7);return _0x4f69a8[_0x0918('0x20')]('Content-Range',_0xd2da69+'-'+_0x31e3bf+'/'+_0x207b04)[_0x0918('0x21')](_0x61c57);}return null;};}function patchUpdates(_0x4c9ce4){return function(_0x533224){try{jsonpatch[_0x0918('0x22')](_0x533224,_0x4c9ce4,!![]);}catch(_0x1104b3){return BPromise[_0x0918('0x23')](_0x1104b3);}return _0x533224['save']();};}function saveUpdates(_0x244de7,_0x2203d6){return function(_0x17d346){if(_0x17d346){return _0x17d346[_0x0918('0x24')](_0x244de7)['then'](function(_0x5a0455){return _0x5a0455;});}return null;};}function removeEntity(_0x14b52d,_0x3f375c){return function(_0xebae66){if(_0xebae66){return _0xebae66[_0x0918('0x25')]()[_0x0918('0x26')](function(){_0x14b52d[_0x0918('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x226436,_0x4477e7){return function(_0x5b336c){if(!_0x5b336c){_0x226436['sendStatus'](0x194);}return _0x5b336c;};}function handleError(_0x7405ae,_0x10b28a){_0x10b28a=_0x10b28a||0x1f4;return function(_0x479fe6){logger['error'](_0x479fe6[_0x0918('0x27')]);if(_0x479fe6['name']){delete _0x479fe6['name'];}_0x7405ae[_0x0918('0x1b')](_0x10b28a)[_0x0918('0x28')](_0x479fe6);};}exports[_0x0918('0x29')]=function(_0x2d1a14,_0x4b58ce){var _0x1b1aee={},_0x58386c={},_0x408b2d={'count':0x0,'rows':[]};var _0x55071c=_[_0x0918('0x2a')](db[_0x0918('0x2b')][_0x0918('0x2c')],function(_0x547461){return{'name':_0x547461['fieldName'],'type':_0x547461[_0x0918('0x2d')][_0x0918('0x2e')]};});_0x58386c['model']=_['map'](_0x55071c,'name');_0x58386c['query']=_[_0x0918('0x2f')](_0x2d1a14['query']);_0x58386c[_0x0918('0x30')]=_[_0x0918('0x31')](_0x58386c[_0x0918('0x32')],_0x58386c[_0x0918('0x33')]);_0x1b1aee[_0x0918('0x34')]=_[_0x0918('0x31')](_0x58386c['model'],qs[_0x0918('0x35')](_0x2d1a14[_0x0918('0x33')]['fields']));_0x1b1aee[_0x0918('0x34')]=_0x1b1aee[_0x0918('0x34')][_0x0918('0x36')]?_0x1b1aee[_0x0918('0x34')]:_0x58386c[_0x0918('0x32')];if(!_0x2d1a14['query'][_0x0918('0x37')]('nolimit')){_0x1b1aee[_0x0918('0x1e')]=qs[_0x0918('0x1e')](_0x2d1a14[_0x0918('0x33')]['limit']);_0x1b1aee[_0x0918('0x1c')]=qs[_0x0918('0x1c')](_0x2d1a14[_0x0918('0x33')][_0x0918('0x1c')]);}_0x1b1aee[_0x0918('0x38')]=qs[_0x0918('0x39')](_0x2d1a14[_0x0918('0x33')][_0x0918('0x39')]);_0x1b1aee[_0x0918('0x3a')]=qs[_0x0918('0x30')](_[_0x0918('0x3b')](_0x2d1a14[_0x0918('0x33')],_0x58386c[_0x0918('0x30')]),_0x55071c);if(_0x2d1a14[_0x0918('0x33')][_0x0918('0x3c')]){_0x1b1aee['where']=_[_0x0918('0x3d')](_0x1b1aee[_0x0918('0x3a')],{'$or':_['map'](_0x55071c,function(_0x4db4f7){if(_0x4db4f7['type']!==_0x0918('0x3e')){var _0x2c85d3={};_0x2c85d3[_0x4db4f7['name']]={'$like':'%'+_0x2d1a14[_0x0918('0x33')][_0x0918('0x3c')]+'%'};return _0x2c85d3;}})});}_0x1b1aee=_[_0x0918('0x3d')]({},_0x1b1aee,_0x2d1a14[_0x0918('0x3f')]);var _0x58e8e4={'where':_0x1b1aee[_0x0918('0x3a')]};return db[_0x0918('0x2b')]['count'](_0x58e8e4)[_0x0918('0x26')](function(_0x30658e){_0x408b2d[_0x0918('0x1f')]=_0x30658e;if(_0x2d1a14['query'][_0x0918('0x40')]){_0x1b1aee[_0x0918('0x41')]=[{'all':!![]}];}return db[_0x0918('0x2b')][_0x0918('0x42')](_0x1b1aee);})[_0x0918('0x26')](function(_0x5a1f06){_0x408b2d[_0x0918('0x43')]=_0x5a1f06;return _0x408b2d;})[_0x0918('0x26')](respondWithFilteredResult(_0x4b58ce,_0x1b1aee))['catch'](handleError(_0x4b58ce,null));};exports['show']=function(_0x43508b,_0x46fc68){var _0x5bafaa={'raw':!![],'where':{'id':_0x43508b[_0x0918('0x44')]['id']}},_0x325d1c={};_0x325d1c[_0x0918('0x32')]=_[_0x0918('0x2f')](db[_0x0918('0x2b')]['rawAttributes']);_0x325d1c[_0x0918('0x33')]=_['keys'](_0x43508b[_0x0918('0x33')]);_0x325d1c[_0x0918('0x30')]=_[_0x0918('0x31')](_0x325d1c['model'],_0x325d1c['query']);_0x5bafaa['attributes']=_['intersection'](_0x325d1c[_0x0918('0x32')],qs['fields'](_0x43508b[_0x0918('0x33')][_0x0918('0x35')]));_0x5bafaa[_0x0918('0x34')]=_0x5bafaa['attributes'][_0x0918('0x36')]?_0x5bafaa[_0x0918('0x34')]:_0x325d1c['model'];if(_0x43508b[_0x0918('0x33')][_0x0918('0x40')]){_0x5bafaa[_0x0918('0x41')]=[{'all':!![]}];}_0x5bafaa=_[_0x0918('0x3d')]({},_0x5bafaa,_0x43508b[_0x0918('0x3f')]);return db[_0x0918('0x2b')][_0x0918('0x45')](_0x5bafaa)['then'](handleEntityNotFound(_0x46fc68,null))[_0x0918('0x26')](respondWithResult(_0x46fc68,null))[_0x0918('0x46')](handleError(_0x46fc68,null));};exports[_0x0918('0x47')]=function(_0x3957be,_0x279aa4){return db[_0x0918('0x2b')][_0x0918('0x47')](_0x3957be[_0x0918('0x48')],{})[_0x0918('0x26')](respondWithResult(_0x279aa4,0xc9))[_0x0918('0x46')](handleError(_0x279aa4,null));};exports['update']=function(_0x5814f5,_0x2fc64d){if(_0x5814f5[_0x0918('0x48')]['id']){delete _0x5814f5[_0x0918('0x48')]['id'];}return db[_0x0918('0x2b')]['find']({'where':{'id':_0x5814f5[_0x0918('0x44')]['id']}})[_0x0918('0x26')](handleEntityNotFound(_0x2fc64d,null))[_0x0918('0x26')](saveUpdates(_0x5814f5['body'],null))[_0x0918('0x26')](respondWithResult(_0x2fc64d,null))[_0x0918('0x46')](handleError(_0x2fc64d,null));};exports[_0x0918('0x25')]=function(_0x255b53,_0x2a9236){return db[_0x0918('0x2b')][_0x0918('0x45')]({'where':{'id':_0x255b53[_0x0918('0x44')]['id']}})[_0x0918('0x26')](handleEntityNotFound(_0x2a9236,null))[_0x0918('0x26')](removeEntity(_0x2a9236,null))[_0x0918('0x46')](handleError(_0x2a9236,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3c99b62..52f23ca 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 _0xb1fa=['define','int_freshsales_fields','freshsales_unique_index','FieldId','../../config/logger','moment','./intFreshsalesField.attributes'];(function(_0x52f7ca,_0x8009c3){var _0x1bc7da=function(_0x1d4fcd){while(--_0x1d4fcd){_0x52f7ca['push'](_0x52f7ca['shift']());}};_0x1bc7da(++_0x8009c3);}(_0xb1fa,0x9e));var _0xab1f=function(_0x23195c,_0xf7abc3){_0x23195c=_0x23195c-0x0;var _0x107e93=_0xb1fa[_0x23195c];return _0x107e93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab1f('0x0'))('api');var moment=require(_0xab1f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab1f('0x2'));module['exports']=function(_0x50ada8,_0x4ee73b){return _0x50ada8[_0xab1f('0x3')]('FreshsalesField',attributes,{'tableName':_0xab1f('0x4'),'paranoid':![],'indexes':[{'name':_0xab1f('0x5'),'fields':['idField',_0xab1f('0x6')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd481=['../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x92791a,_0x425c65){var _0x2c17fb=function(_0x2c0b21){while(--_0x2c0b21){_0x92791a['push'](_0x92791a['shift']());}};_0x2c17fb(++_0x425c65);}(_0xd481,0x1e4));var _0x1d48=function(_0x3a1dda,_0x5c56d7){_0x3a1dda=_0x3a1dda-0x0;var _0x5ca3e1=_0xd481[_0x3a1dda];return _0x5ca3e1;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var logger=require(_0x1d48('0x1'))(_0x1d48('0x2'));var moment=require('moment');var BPromise=require(_0x1d48('0x3'));var rp=require(_0x1d48('0x4'));var fs=require('fs');var path=require(_0x1d48('0x5'));var rimraf=require('rimraf');var config=require(_0x1d48('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x1d48('0x7')]=function(_0x2a4830,_0x5a0c28){return _0x2a4830[_0x1d48('0x8')](_0x1d48('0x9'),attributes,{'tableName':_0x1d48('0xa'),'paranoid':![],'indexes':[{'name':_0x1d48('0xb'),'fields':[_0x1d48('0xc'),_0x1d48('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 258ab54..53bb01f 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2634b1,_0x2cd01c){var _0x3fd7ae=function(_0xb3e5cc){while(--_0xb3e5cc){_0x2634b1['push'](_0x2634b1['shift']());}};_0x3fd7ae(++_0x2cd01c);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x3a2f2e,_0x48839b){var _0x4c8f7d=function(_0x5bf16b){while(--_0x5bf16b){_0x3a2f2e['push'](_0x3a2f2e['shift']());}};_0x4c8f7d(++_0x48839b);}(_0xeda8,0x104));var _0x8eda=function(_0x23e0c5,_0x146aca){_0x23e0c5=_0x23e0c5-0x0;var _0x4b4fe0=_0xeda8[_0x23e0c5];return _0x4b4fe0;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a84fafc..3921613 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(_0x190172,_0x28a398){var _0x52a723=function(_0x2dc671){while(--_0x2dc671){_0x190172['push'](_0x190172['shift']());}};_0x52a723(++_0x28a398);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xf87e8b,_0x3d8fb7){var _0x35f67c=function(_0x594a74){while(--_0x594a74){_0xf87e8b['push'](_0xf87e8b['shift']());}};_0x35f67c(++_0x3d8fb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 299d382..cfd2c3d 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 _0x3e2a=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x4fed73,_0x24ee00){var _0x4285e7=function(_0x5c48df){while(--_0x5c48df){_0x4fed73['push'](_0x4fed73['shift']());}};_0x4285e7(++_0x24ee00);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x26e16c,_0x2d7790){_0x26e16c=_0x26e16c-0x0;var _0x45973f=_0x3e2a[_0x26e16c];return _0x45973f;};'use strict';var Sequelize=require(_0xa3e2('0x0'));module[_0xa3e2('0x1')]={'name':{'type':Sequelize[_0xa3e2('0x2')]},'description':{'type':Sequelize[_0xa3e2('0x2')]},'username':{'type':Sequelize[_0xa3e2('0x2')],'unique':_0xa3e2('0x3')},'remoteUri':{'type':Sequelize[_0xa3e2('0x2')]},'password':{'type':Sequelize[_0xa3e2('0x2')]},'clientId':{'type':Sequelize[_0xa3e2('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xa3e2('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3e2('0x4')](_0xa3e2('0x5'),_0xa3e2('0x6')),'defaultValue':_0xa3e2('0x5')}}; \ No newline at end of file +var _0x3646=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x13a835,_0x38eb0e){var _0x5eef55=function(_0x532dd1){while(--_0x532dd1){_0x13a835['push'](_0x13a835['shift']());}};_0x5eef55(++_0x38eb0e);}(_0x3646,0x15f));var _0x6364=function(_0x14248c,_0x1b087f){_0x14248c=_0x14248c-0x0;var _0x263376=_0x3646[_0x14248c];return _0x263376;};'use strict';var Sequelize=require(_0x6364('0x0'));module[_0x6364('0x1')]={'name':{'type':Sequelize[_0x6364('0x2')]},'description':{'type':Sequelize[_0x6364('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6364('0x3')},'remoteUri':{'type':Sequelize[_0x6364('0x2')]},'password':{'type':Sequelize[_0x6364('0x2')]},'clientId':{'type':Sequelize[_0x6364('0x2')]},'clientSecret':{'type':Sequelize[_0x6364('0x2')]},'securityToken':{'type':Sequelize[_0x6364('0x2')]},'serverUrl':{'type':Sequelize[_0x6364('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6364('0x4')](_0x6364('0x5'),_0x6364('0x6')),'defaultValue':_0x6364('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e60dc36..859a8e7 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 _0x6d66=['channel','SalesforceField','getFields','Task','findOne','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','Connection','username','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SalesforceAccount','findAll','show','params','length','includeAll','include','find','catch','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6d66,0x12c));var _0x66d6=function(_0x546037,_0x4e7876){_0x546037=_0x546037-0x0;var _0x122caf=_0x6d66[_0x546037];return _0x122caf;};'use strict';var emlformat=require(_0x66d6('0x0'));var rimraf=require(_0x66d6('0x1'));var zipdir=require(_0x66d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66d6('0x3'));var moment=require(_0x66d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x66d6('0x5'));var util=require(_0x66d6('0x6'));var path=require(_0x66d6('0x7'));var sox=require(_0x66d6('0x8'));var csv=require(_0x66d6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66d6('0xa'));var squel=require('squel');var crypto=require(_0x66d6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x66d6('0xc'));var toCsv=require(_0x66d6('0x9'));var querystring=require(_0x66d6('0xd'));var Papa=require('papaparse');var Redis=require(_0x66d6('0xe'));var authService=require(_0x66d6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x66d6('0x10'));var hardwareService=require(_0x66d6('0x11'));var logger=require(_0x66d6('0x12'))(_0x66d6('0x13'));var utils=require(_0x66d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x66d6('0x15'));var db=require(_0x66d6('0x16'))['db'];var integrations=require(_0x66d6('0x17'));function respondWithStatusCode(_0x15bab2,_0x3b767e){_0x3b767e=_0x3b767e||0xcc;return function(_0x1fa7a){if(_0x1fa7a){return _0x15bab2['sendStatus'](_0x3b767e);}return _0x15bab2[_0x66d6('0x18')](_0x3b767e)[_0x66d6('0x19')]();};}function respondWithResult(_0x48f75e,_0x22d223){_0x22d223=_0x22d223||0xc8;return function(_0x537f86){if(_0x537f86){return _0x48f75e[_0x66d6('0x18')](_0x22d223)[_0x66d6('0x1a')](_0x537f86);}};}function respondWithFilteredResult(_0x43ece2,_0x512dfe){return function(_0x4d4761){if(_0x4d4761){var _0x555f0c=typeof _0x512dfe[_0x66d6('0x1b')]===_0x66d6('0x1c')&&typeof _0x512dfe[_0x66d6('0x1d')]==='undefined';var _0x402d6e=_0x4d4761['count'];var _0x5c1a89=_0x555f0c?0x0:_0x512dfe[_0x66d6('0x1b')];var _0x20c9b6=_0x555f0c?_0x4d4761[_0x66d6('0x1e')]:_0x512dfe[_0x66d6('0x1b')]+_0x512dfe[_0x66d6('0x1d')];var _0x589ba5;if(_0x20c9b6>=_0x402d6e){_0x20c9b6=_0x402d6e;_0x589ba5=0xc8;}else{_0x589ba5=0xce;}_0x43ece2[_0x66d6('0x18')](_0x589ba5);return _0x43ece2[_0x66d6('0x1f')](_0x66d6('0x20'),_0x5c1a89+'-'+_0x20c9b6+'/'+_0x402d6e)[_0x66d6('0x1a')](_0x4d4761);}return null;};}function patchUpdates(_0x369121){return function(_0x44f7cb){try{jsonpatch['apply'](_0x44f7cb,_0x369121,!![]);}catch(_0x17b9ee){return BPromise['reject'](_0x17b9ee);}return _0x44f7cb[_0x66d6('0x21')]();};}function saveUpdates(_0x39a73c,_0x378cdf){return function(_0x33bcae){if(_0x33bcae){return _0x33bcae['update'](_0x39a73c)[_0x66d6('0x22')](function(_0x49fde0){return _0x49fde0;});}return null;};}function removeEntity(_0x47be5d,_0x636026){return function(_0x452fa2){if(_0x452fa2){return _0x452fa2[_0x66d6('0x23')]()[_0x66d6('0x22')](function(){_0x47be5d[_0x66d6('0x18')](0xcc)[_0x66d6('0x19')]();});}};}function handleEntityNotFound(_0x10e61a,_0x1c7e7b){return function(_0x296892){if(!_0x296892){_0x10e61a[_0x66d6('0x24')](0x194);}return _0x296892;};}function handleError(_0xc969ed,_0x35c876){_0x35c876=_0x35c876||0x1f4;return function(_0xe3e590){logger[_0x66d6('0x25')](_0xe3e590['stack']);if(_0xe3e590[_0x66d6('0x26')]){delete _0xe3e590[_0x66d6('0x26')];}_0xc969ed[_0x66d6('0x18')](_0x35c876)[_0x66d6('0x27')](_0xe3e590);};}exports[_0x66d6('0x28')]=function(_0x25d048,_0x3bf569){var _0x713126={},_0x324450={},_0x1ed744={'count':0x0,'rows':[]};var _0x5f0eb5=_[_0x66d6('0x29')](db['SalesforceAccount'][_0x66d6('0x2a')],function(_0x3139cf){return{'name':_0x3139cf[_0x66d6('0x2b')],'type':_0x3139cf[_0x66d6('0x2c')][_0x66d6('0x2d')]};});_0x324450[_0x66d6('0x2e')]=_[_0x66d6('0x29')](_0x5f0eb5,_0x66d6('0x26'));_0x324450[_0x66d6('0x2f')]=_[_0x66d6('0x30')](_0x25d048[_0x66d6('0x2f')]);_0x324450[_0x66d6('0x31')]=_['intersection'](_0x324450[_0x66d6('0x2e')],_0x324450[_0x66d6('0x2f')]);_0x713126['attributes']=_[_0x66d6('0x32')](_0x324450[_0x66d6('0x2e')],qs[_0x66d6('0x33')](_0x25d048[_0x66d6('0x2f')][_0x66d6('0x33')]));_0x713126[_0x66d6('0x34')]=_0x713126[_0x66d6('0x34')]['length']?_0x713126[_0x66d6('0x34')]:_0x324450[_0x66d6('0x2e')];if(!_0x25d048[_0x66d6('0x2f')][_0x66d6('0x35')](_0x66d6('0x36'))){_0x713126['limit']=qs[_0x66d6('0x1d')](_0x25d048[_0x66d6('0x2f')]['limit']);_0x713126[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x25d048['query'][_0x66d6('0x1b')]);}_0x713126[_0x66d6('0x37')]=qs[_0x66d6('0x38')](_0x25d048['query'][_0x66d6('0x38')]);_0x713126[_0x66d6('0x39')]=qs[_0x66d6('0x31')](_[_0x66d6('0x3a')](_0x25d048[_0x66d6('0x2f')],_0x324450[_0x66d6('0x31')]),_0x5f0eb5);if(_0x25d048[_0x66d6('0x2f')][_0x66d6('0x3b')]){_0x713126[_0x66d6('0x39')]=_['merge'](_0x713126[_0x66d6('0x39')],{'$or':_['map'](_0x5f0eb5,function(_0x57ad91){if(_0x57ad91[_0x66d6('0x2c')]!=='VIRTUAL'){var _0x176aa1={};_0x176aa1[_0x57ad91[_0x66d6('0x26')]]={'$like':'%'+_0x25d048[_0x66d6('0x2f')]['filter']+'%'};return _0x176aa1;}})});}_0x713126=_[_0x66d6('0x3c')]({},_0x713126,_0x25d048[_0x66d6('0x3d')]);var _0x21ec05={'where':_0x713126['where']};return db[_0x66d6('0x3e')][_0x66d6('0x1e')](_0x21ec05)[_0x66d6('0x22')](function(_0xf1f919){_0x1ed744[_0x66d6('0x1e')]=_0xf1f919;if(_0x25d048[_0x66d6('0x2f')]['includeAll']){_0x713126['include']=[{'all':!![]}];}return db[_0x66d6('0x3e')][_0x66d6('0x3f')](_0x713126);})[_0x66d6('0x22')](function(_0xacf362){_0x1ed744['rows']=_0xacf362;return _0x1ed744;})[_0x66d6('0x22')](respondWithFilteredResult(_0x3bf569,_0x713126))['catch'](handleError(_0x3bf569,null));};exports[_0x66d6('0x40')]=function(_0x49f599,_0x2b237d){var _0x4450c1={'raw':![],'where':{'id':_0x49f599[_0x66d6('0x41')]['id']}},_0x3a24ec={};_0x3a24ec[_0x66d6('0x2e')]=_[_0x66d6('0x30')](db[_0x66d6('0x3e')][_0x66d6('0x2a')]);_0x3a24ec[_0x66d6('0x2f')]=_[_0x66d6('0x30')](_0x49f599[_0x66d6('0x2f')]);_0x3a24ec[_0x66d6('0x31')]=_[_0x66d6('0x32')](_0x3a24ec['model'],_0x3a24ec[_0x66d6('0x2f')]);_0x4450c1['attributes']=_['intersection'](_0x3a24ec[_0x66d6('0x2e')],qs[_0x66d6('0x33')](_0x49f599[_0x66d6('0x2f')][_0x66d6('0x33')]));_0x4450c1[_0x66d6('0x34')]=_0x4450c1['attributes'][_0x66d6('0x42')]?_0x4450c1[_0x66d6('0x34')]:_0x3a24ec[_0x66d6('0x2e')];if(_0x49f599['query'][_0x66d6('0x43')]){_0x4450c1[_0x66d6('0x44')]=[{'all':!![]}];}_0x4450c1=_[_0x66d6('0x3c')]({},_0x4450c1,_0x49f599['options']);return db[_0x66d6('0x3e')][_0x66d6('0x45')](_0x4450c1)[_0x66d6('0x22')](handleEntityNotFound(_0x2b237d,null))['then'](respondWithResult(_0x2b237d,null))[_0x66d6('0x46')](handleError(_0x2b237d,null));};exports[_0x66d6('0x47')]=function(_0x5061bd,_0x399ca4){return db[_0x66d6('0x3e')][_0x66d6('0x47')](_0x5061bd[_0x66d6('0x48')],{})[_0x66d6('0x22')](respondWithResult(_0x399ca4,0xc9))[_0x66d6('0x46')](handleError(_0x399ca4,null));};exports['update']=function(_0x1df173,_0x4a0018){if(_0x1df173[_0x66d6('0x48')]['id']){delete _0x1df173['body']['id'];}return db[_0x66d6('0x3e')][_0x66d6('0x45')]({'where':{'id':_0x1df173[_0x66d6('0x41')]['id']}})[_0x66d6('0x22')](handleEntityNotFound(_0x4a0018,null))['then'](saveUpdates(_0x1df173[_0x66d6('0x48')],null))[_0x66d6('0x22')](respondWithResult(_0x4a0018,null))[_0x66d6('0x46')](handleError(_0x4a0018,null));};exports[_0x66d6('0x23')]=function(_0x24701a,_0x4b89e0){return db[_0x66d6('0x3e')][_0x66d6('0x45')]({'where':{'id':_0x24701a[_0x66d6('0x41')]['id']}})[_0x66d6('0x22')](handleEntityNotFound(_0x4b89e0,null))[_0x66d6('0x22')](removeEntity(_0x4b89e0,null))[_0x66d6('0x46')](handleError(_0x4b89e0,null));};exports[_0x66d6('0x49')]=function(_0x9cd381,_0x4174ab,_0x10ec82){var _0x4fdfe8={};var _0x48e38a={};var _0x3aa6ec;var _0x218c28;return db[_0x66d6('0x3e')]['findOne']({'where':{'id':_0x9cd381[_0x66d6('0x41')]['id']}})[_0x66d6('0x22')](handleEntityNotFound(_0x4174ab,null))['then'](function(_0x545ac5){if(_0x545ac5){_0x3aa6ec=_0x545ac5;_0x48e38a[_0x66d6('0x2e')]=_[_0x66d6('0x30')](db[_0x66d6('0x4a')][_0x66d6('0x2a')]);_0x48e38a['query']=_[_0x66d6('0x30')](_0x9cd381[_0x66d6('0x2f')]);_0x48e38a['filters']=_[_0x66d6('0x32')](_0x48e38a['model'],_0x48e38a[_0x66d6('0x2f')]);_0x4fdfe8[_0x66d6('0x34')]=_['intersection'](_0x48e38a[_0x66d6('0x2e')],qs[_0x66d6('0x33')](_0x9cd381[_0x66d6('0x2f')][_0x66d6('0x33')]));_0x4fdfe8[_0x66d6('0x34')]=_0x4fdfe8['attributes'][_0x66d6('0x42')]?_0x4fdfe8['attributes']:_0x48e38a[_0x66d6('0x2e')];_0x4fdfe8[_0x66d6('0x37')]=qs['sort'](_0x9cd381[_0x66d6('0x2f')][_0x66d6('0x38')]);_0x4fdfe8[_0x66d6('0x39')]=qs[_0x66d6('0x31')](_[_0x66d6('0x3a')](_0x9cd381[_0x66d6('0x2f')],_0x48e38a[_0x66d6('0x31')]));if(_0x9cd381[_0x66d6('0x2f')]['filter']){_0x4fdfe8[_0x66d6('0x39')]=_[_0x66d6('0x3c')](_0x4fdfe8[_0x66d6('0x39')],{'$or':_[_0x66d6('0x29')](_0x4fdfe8['attributes'],function(_0x35c0bf){var _0x4ddd70={};_0x4ddd70[_0x35c0bf]={'$like':'%'+_0x9cd381[_0x66d6('0x2f')][_0x66d6('0x3b')]+'%'};return _0x4ddd70;})});}_0x4fdfe8=_['merge']({},_0x4fdfe8,_0x9cd381[_0x66d6('0x3d')]);return _0x3aa6ec['getConfigurations'](_0x4fdfe8);}})['then'](function(_0x5c1395){if(_0x5c1395){_0x218c28=_0x5c1395[_0x66d6('0x42')];if(!_0x9cd381[_0x66d6('0x2f')]['hasOwnProperty'](_0x66d6('0x36'))){_0x4fdfe8[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x9cd381[_0x66d6('0x2f')]['limit']);_0x4fdfe8[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x9cd381[_0x66d6('0x2f')][_0x66d6('0x1b')]);}return _0x3aa6ec[_0x66d6('0x49')](_0x4fdfe8);}})[_0x66d6('0x22')](function(_0x20a0f2){if(_0x20a0f2){return _0x20a0f2?{'count':_0x218c28,'rows':_0x20a0f2}:null;}})['then'](respondWithResult(_0x4174ab,null))[_0x66d6('0x46')](handleError(_0x4174ab,null));};exports[_0x66d6('0x4b')]=function(_0xf11fc8,_0xef2e83,_0x2110aa){if(_0xf11fc8[_0x66d6('0x48')]['id']){delete _0xf11fc8[_0x66d6('0x48')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0xf11fc8[_0x66d6('0x41')]['id']}})[_0x66d6('0x22')](handleEntityNotFound(_0xef2e83,null))[_0x66d6('0x22')](function(_0x182c7d){if(_0x182c7d){_0xf11fc8[_0x66d6('0x48')][_0x66d6('0x4c')]=_0x182c7d['id'];_0xf11fc8[_0x66d6('0x48')][_0x66d6('0x4d')]=integrations[_0x66d6('0x4e')](_0xf11fc8[_0x66d6('0x48')]['channel'],_0xf11fc8['body']['type']);_0xf11fc8['body'][_0x66d6('0x4f')]=integrations[_0x66d6('0x50')](_0xf11fc8['body'][_0x66d6('0x51')],_0xf11fc8[_0x66d6('0x48')][_0x66d6('0x2c')]);return db[_0x66d6('0x4a')]['create'](_0xf11fc8[_0x66d6('0x48')],{'include':[{'model':db[_0x66d6('0x52')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x66d6('0x4f')}]});}return null;})[_0x66d6('0x22')](respondWithResult(_0xef2e83,null))[_0x66d6('0x46')](handleError(_0xef2e83,null));};exports[_0x66d6('0x53')]=function(_0x55f222,_0x37057d,_0x228cf3){var _0x8c13ee;var _0x55e562='';var _0x54de84=_0x66d6('0x54');return db[_0x66d6('0x3e')][_0x66d6('0x55')]({'where':{'id':_0x55f222[_0x66d6('0x41')]['id']},'attributes':['id',_0x66d6('0x56'),_0x66d6('0x57'),_0x66d6('0x58'),'username',_0x66d6('0x59'),'securityToken']})[_0x66d6('0x22')](handleEntityNotFound(_0x37057d,null))[_0x66d6('0x22')](function(_0x2a29d5){if(_0x2a29d5){_0x55e562=_0x2a29d5['remoteUri'];var _0x3cc375=_0x55e562[_0x66d6('0x5a')](-0x1);if(_0x3cc375==='/'){_0x55e562=_0x55e562[_0x66d6('0x5b')](0x0,_0x55e562[_0x66d6('0x5c')](_0x3cc375));}_0x8c13ee=new jsforce[(_0x66d6('0x5d'))]({'oauth2':{'loginUrl':_0x55e562,'clientId':_0x2a29d5['clientId'],'clientSecret':_0x2a29d5[_0x66d6('0x58')]}});return _0x8c13ee['login'](_0x2a29d5[_0x66d6('0x5e')],_0x2a29d5[_0x66d6('0x59')]['concat'](_0x2a29d5[_0x66d6('0x5f')]));}})[_0x66d6('0x22')](function(_0x138ffe){if(_0x138ffe){if(!_[_0x66d6('0x60')](_0x55f222[_0x66d6('0x2f')][_0x66d6('0x61')])){_0x54de84=_0x55f222[_0x66d6('0x2f')][_0x66d6('0x61')];}return _0x8c13ee[_0x66d6('0x62')](_0x54de84)[_0x66d6('0x63')]();}})[_0x66d6('0x22')](function(_0xac65b){var _0x762bd=[_0x66d6('0x64'),_0x66d6('0x65'),_0x66d6('0x66'),_0x66d6('0x67'),_0x66d6('0x68'),_0x66d6('0x69')];var _0x1d450f=[_0x66d6('0x6a'),_0x66d6('0x6b'),_0x66d6('0x6c'),_0x66d6('0x6d'),'email',_0x66d6('0x6e'),_0x66d6('0x6f')];if(_0xac65b){_[_0x66d6('0x70')](_0xac65b['fields'],function(_0x2022f4){return _0x762bd[_0x66d6('0x71')](_0x2022f4[_0x66d6('0x26')])||!_0x1d450f[_0x66d6('0x71')](_0x2022f4[_0x66d6('0x2c')]);});return{'count':_0xac65b[_0x66d6('0x33')][_0x66d6('0x42')],'rows':_[_0x66d6('0x29')](_0xac65b[_0x66d6('0x33')],function(_0x526d4c){return{'id':_0x526d4c[_0x66d6('0x26')],'name':_0x526d4c['label'],'custom':_0x526d4c[_0x66d6('0x72')],'options':_0x526d4c[_0x66d6('0x73')][_0x66d6('0x42')]>0x0?_[_0x66d6('0x29')](_0x526d4c[_0x66d6('0x73')],function(_0x116026){return{'name':_0x116026[_0x66d6('0x74')],'value':_0x116026[_0x66d6('0x75')]};}):_0x526d4c[_0x66d6('0x2c')]=='boolean'?[{'name':_0x66d6('0x76'),'value':_0x66d6('0x77')},{'name':_0x66d6('0x78'),'value':_0x66d6('0x79')}]:[]};})};}})['then'](respondWithResult(_0x37057d,null))['catch'](function(_0x14c607){var _0xfc2cae=_0x55f222[_0x66d6('0x2f')][_0x66d6('0x7a')]?0x1f4:_0x14c607[_0x66d6('0x7b')]||0x1f4;logger[_0x66d6('0x25')](_0x66d6('0x7c'),'getFields',_0xfc2cae,JSON[_0x66d6('0x7d')](_0x14c607));delete _0x14c607['name'];if(_0xfc2cae===0x191){_0xfc2cae=0x190;}_0x37057d['status'](_0xfc2cae)[_0x66d6('0x27')](_0x55f222['query'][_0x66d6('0x7a')]?{'message':_0x66d6('0x7e'),'statusCode':_0x14c607[_0x66d6('0x7b')]}:_0x14c607);});}; \ No newline at end of file +var _0x8914=['map','SalesforceAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','update','getConfigurations','SalesforceConfiguration','length','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','findOne','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','isNil','ticketType','sobject','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','textarea','includes','label','custom','picklistValues','value','boolean','True','False','false','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','index'];(function(_0x3496e4,_0x550764){var _0x5690a0=function(_0x33445d){while(--_0x33445d){_0x3496e4['push'](_0x3496e4['shift']());}};_0x5690a0(++_0x550764);}(_0x8914,0xcc));var _0x4891=function(_0x31b4ad,_0x4ea918){_0x31b4ad=_0x31b4ad-0x0;var _0x18f198=_0x8914[_0x31b4ad];return _0x18f198;};'use strict';var emlformat=require(_0x4891('0x0'));var rimraf=require(_0x4891('0x1'));var zipdir=require(_0x4891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4891('0x3'));var moment=require(_0x4891('0x4'));var BPromise=require(_0x4891('0x5'));var Mustache=require(_0x4891('0x6'));var util=require(_0x4891('0x7'));var path=require(_0x4891('0x8'));var sox=require(_0x4891('0x9'));var csv=require(_0x4891('0xa'));var ejs=require(_0x4891('0xb'));var fs=require('fs');var fs_extra=require(_0x4891('0xc'));var _=require(_0x4891('0xd'));var squel=require(_0x4891('0xe'));var crypto=require(_0x4891('0xf'));var jsforce=require(_0x4891('0x10'));var deskjs=require(_0x4891('0x11'));var toCsv=require(_0x4891('0xa'));var querystring=require(_0x4891('0x12'));var Papa=require(_0x4891('0x13'));var Redis=require('ioredis');var authService=require(_0x4891('0x14'));var qs=require(_0x4891('0x15'));var as=require(_0x4891('0x16'));var hardwareService=require(_0x4891('0x17'));var logger=require(_0x4891('0x18'))(_0x4891('0x19'));var utils=require(_0x4891('0x1a'));var config=require(_0x4891('0x1b'));var licenseUtil=require(_0x4891('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56ea02,_0x5bfc69){_0x5bfc69=_0x5bfc69||0xcc;return function(_0x5c736b){if(_0x5c736b){return _0x56ea02[_0x4891('0x1d')](_0x5bfc69);}return _0x56ea02[_0x4891('0x1e')](_0x5bfc69)[_0x4891('0x1f')]();};}function respondWithResult(_0x32d4f4,_0x820e7d){_0x820e7d=_0x820e7d||0xc8;return function(_0x58e7e7){if(_0x58e7e7){return _0x32d4f4[_0x4891('0x1e')](_0x820e7d)['json'](_0x58e7e7);}};}function respondWithFilteredResult(_0x12e85f,_0x46daf5){return function(_0x2ef78a){if(_0x2ef78a){var _0x3d5ce4=typeof _0x46daf5[_0x4891('0x20')]==='undefined'&&typeof _0x46daf5[_0x4891('0x21')]==='undefined';var _0x39fb64=_0x2ef78a['count'];var _0x5d4eb6=_0x3d5ce4?0x0:_0x46daf5[_0x4891('0x20')];var _0x54ce5d=_0x3d5ce4?_0x2ef78a[_0x4891('0x22')]:_0x46daf5[_0x4891('0x20')]+_0x46daf5[_0x4891('0x21')];var _0x545ddf;if(_0x54ce5d>=_0x39fb64){_0x54ce5d=_0x39fb64;_0x545ddf=0xc8;}else{_0x545ddf=0xce;}_0x12e85f['status'](_0x545ddf);return _0x12e85f[_0x4891('0x23')](_0x4891('0x24'),_0x5d4eb6+'-'+_0x54ce5d+'/'+_0x39fb64)[_0x4891('0x25')](_0x2ef78a);}return null;};}function patchUpdates(_0x2ff296){return function(_0x46f37d){try{jsonpatch[_0x4891('0x26')](_0x46f37d,_0x2ff296,!![]);}catch(_0x4cadf7){return BPromise[_0x4891('0x27')](_0x4cadf7);}return _0x46f37d['save']();};}function saveUpdates(_0x3d5124,_0x1cb0df){return function(_0x403147){if(_0x403147){return _0x403147['update'](_0x3d5124)[_0x4891('0x28')](function(_0x4560b7){return _0x4560b7;});}return null;};}function removeEntity(_0x7169c7,_0x1998ba){return function(_0x4f04af){if(_0x4f04af){return _0x4f04af[_0x4891('0x29')]()[_0x4891('0x28')](function(){_0x7169c7[_0x4891('0x1e')](0xcc)[_0x4891('0x1f')]();});}};}function handleEntityNotFound(_0x5f3466,_0x5b3d49){return function(_0x4c6428){if(!_0x4c6428){_0x5f3466['sendStatus'](0x194);}return _0x4c6428;};}function handleError(_0x3a3027,_0x22d174){_0x22d174=_0x22d174||0x1f4;return function(_0x44d1eb){logger[_0x4891('0x2a')](_0x44d1eb[_0x4891('0x2b')]);if(_0x44d1eb['name']){delete _0x44d1eb[_0x4891('0x2c')];}_0x3a3027[_0x4891('0x1e')](_0x22d174)['send'](_0x44d1eb);};}exports[_0x4891('0x2d')]=function(_0x59ab48,_0xf6d8a1){var _0x3916dc={},_0x2236af={},_0x3c1517={'count':0x0,'rows':[]};var _0x3dd3b9=_[_0x4891('0x2e')](db[_0x4891('0x2f')][_0x4891('0x30')],function(_0x496f0a){return{'name':_0x496f0a['fieldName'],'type':_0x496f0a[_0x4891('0x31')][_0x4891('0x32')]};});_0x2236af['model']=_[_0x4891('0x2e')](_0x3dd3b9,_0x4891('0x2c'));_0x2236af[_0x4891('0x33')]=_[_0x4891('0x34')](_0x59ab48['query']);_0x2236af[_0x4891('0x35')]=_[_0x4891('0x36')](_0x2236af[_0x4891('0x37')],_0x2236af[_0x4891('0x33')]);_0x3916dc[_0x4891('0x38')]=_[_0x4891('0x36')](_0x2236af[_0x4891('0x37')],qs[_0x4891('0x39')](_0x59ab48[_0x4891('0x33')]['fields']));_0x3916dc['attributes']=_0x3916dc['attributes']['length']?_0x3916dc[_0x4891('0x38')]:_0x2236af['model'];if(!_0x59ab48[_0x4891('0x33')][_0x4891('0x3a')](_0x4891('0x3b'))){_0x3916dc[_0x4891('0x21')]=qs[_0x4891('0x21')](_0x59ab48['query'][_0x4891('0x21')]);_0x3916dc[_0x4891('0x20')]=qs[_0x4891('0x20')](_0x59ab48[_0x4891('0x33')][_0x4891('0x20')]);}_0x3916dc[_0x4891('0x3c')]=qs[_0x4891('0x3d')](_0x59ab48[_0x4891('0x33')]['sort']);_0x3916dc[_0x4891('0x3e')]=qs['filters'](_[_0x4891('0x3f')](_0x59ab48[_0x4891('0x33')],_0x2236af[_0x4891('0x35')]),_0x3dd3b9);if(_0x59ab48['query'][_0x4891('0x40')]){_0x3916dc['where']=_[_0x4891('0x41')](_0x3916dc['where'],{'$or':_['map'](_0x3dd3b9,function(_0x2150da){if(_0x2150da[_0x4891('0x31')]!==_0x4891('0x42')){var _0x5246be={};_0x5246be[_0x2150da[_0x4891('0x2c')]]={'$like':'%'+_0x59ab48[_0x4891('0x33')][_0x4891('0x40')]+'%'};return _0x5246be;}})});}_0x3916dc=_['merge']({},_0x3916dc,_0x59ab48[_0x4891('0x43')]);var _0x2b03fa={'where':_0x3916dc[_0x4891('0x3e')]};return db[_0x4891('0x2f')][_0x4891('0x22')](_0x2b03fa)[_0x4891('0x28')](function(_0x49c3d5){_0x3c1517[_0x4891('0x22')]=_0x49c3d5;if(_0x59ab48[_0x4891('0x33')][_0x4891('0x44')]){_0x3916dc[_0x4891('0x45')]=[{'all':!![]}];}return db[_0x4891('0x2f')]['findAll'](_0x3916dc);})['then'](function(_0xc66e6b){_0x3c1517[_0x4891('0x46')]=_0xc66e6b;return _0x3c1517;})[_0x4891('0x28')](respondWithFilteredResult(_0xf6d8a1,_0x3916dc))[_0x4891('0x47')](handleError(_0xf6d8a1,null));};exports['show']=function(_0x1d6a80,_0x5996c6){var _0x3c344b={'raw':![],'where':{'id':_0x1d6a80[_0x4891('0x48')]['id']}},_0x1def53={};_0x1def53['model']=_[_0x4891('0x34')](db[_0x4891('0x2f')][_0x4891('0x30')]);_0x1def53['query']=_[_0x4891('0x34')](_0x1d6a80[_0x4891('0x33')]);_0x1def53['filters']=_[_0x4891('0x36')](_0x1def53[_0x4891('0x37')],_0x1def53['query']);_0x3c344b[_0x4891('0x38')]=_[_0x4891('0x36')](_0x1def53['model'],qs[_0x4891('0x39')](_0x1d6a80['query'][_0x4891('0x39')]));_0x3c344b['attributes']=_0x3c344b[_0x4891('0x38')]['length']?_0x3c344b[_0x4891('0x38')]:_0x1def53[_0x4891('0x37')];if(_0x1d6a80['query'][_0x4891('0x44')]){_0x3c344b[_0x4891('0x45')]=[{'all':!![]}];}_0x3c344b=_[_0x4891('0x41')]({},_0x3c344b,_0x1d6a80[_0x4891('0x43')]);return db[_0x4891('0x2f')][_0x4891('0x49')](_0x3c344b)[_0x4891('0x28')](handleEntityNotFound(_0x5996c6,null))[_0x4891('0x28')](respondWithResult(_0x5996c6,null))[_0x4891('0x47')](handleError(_0x5996c6,null));};exports['create']=function(_0x19d09e,_0x307e87){return db[_0x4891('0x2f')][_0x4891('0x4a')](_0x19d09e[_0x4891('0x4b')],{})[_0x4891('0x28')](respondWithResult(_0x307e87,0xc9))['catch'](handleError(_0x307e87,null));};exports[_0x4891('0x4c')]=function(_0x2393c1,_0x49b347){if(_0x2393c1[_0x4891('0x4b')]['id']){delete _0x2393c1[_0x4891('0x4b')]['id'];}return db[_0x4891('0x2f')][_0x4891('0x49')]({'where':{'id':_0x2393c1[_0x4891('0x48')]['id']}})[_0x4891('0x28')](handleEntityNotFound(_0x49b347,null))[_0x4891('0x28')](saveUpdates(_0x2393c1[_0x4891('0x4b')],null))['then'](respondWithResult(_0x49b347,null))[_0x4891('0x47')](handleError(_0x49b347,null));};exports[_0x4891('0x29')]=function(_0x5c7013,_0x76eac3){return db['SalesforceAccount'][_0x4891('0x49')]({'where':{'id':_0x5c7013['params']['id']}})[_0x4891('0x28')](handleEntityNotFound(_0x76eac3,null))[_0x4891('0x28')](removeEntity(_0x76eac3,null))[_0x4891('0x47')](handleError(_0x76eac3,null));};exports[_0x4891('0x4d')]=function(_0x26acb6,_0x22368c,_0x3ff27a){var _0xe4f7c7={};var _0x2e7922={};var _0x2ce13f;var _0x1f85bb;return db[_0x4891('0x2f')]['findOne']({'where':{'id':_0x26acb6['params']['id']}})[_0x4891('0x28')](handleEntityNotFound(_0x22368c,null))[_0x4891('0x28')](function(_0x3f9740){if(_0x3f9740){_0x2ce13f=_0x3f9740;_0x2e7922['model']=_[_0x4891('0x34')](db[_0x4891('0x4e')]['rawAttributes']);_0x2e7922[_0x4891('0x33')]=_[_0x4891('0x34')](_0x26acb6[_0x4891('0x33')]);_0x2e7922['filters']=_[_0x4891('0x36')](_0x2e7922[_0x4891('0x37')],_0x2e7922[_0x4891('0x33')]);_0xe4f7c7[_0x4891('0x38')]=_['intersection'](_0x2e7922[_0x4891('0x37')],qs['fields'](_0x26acb6['query']['fields']));_0xe4f7c7[_0x4891('0x38')]=_0xe4f7c7[_0x4891('0x38')][_0x4891('0x4f')]?_0xe4f7c7[_0x4891('0x38')]:_0x2e7922[_0x4891('0x37')];_0xe4f7c7[_0x4891('0x3c')]=qs[_0x4891('0x3d')](_0x26acb6[_0x4891('0x33')][_0x4891('0x3d')]);_0xe4f7c7[_0x4891('0x3e')]=qs[_0x4891('0x35')](_[_0x4891('0x3f')](_0x26acb6[_0x4891('0x33')],_0x2e7922[_0x4891('0x35')]));if(_0x26acb6[_0x4891('0x33')]['filter']){_0xe4f7c7[_0x4891('0x3e')]=_[_0x4891('0x41')](_0xe4f7c7[_0x4891('0x3e')],{'$or':_[_0x4891('0x2e')](_0xe4f7c7[_0x4891('0x38')],function(_0x5675f2){var _0x9d2085={};_0x9d2085[_0x5675f2]={'$like':'%'+_0x26acb6['query']['filter']+'%'};return _0x9d2085;})});}_0xe4f7c7=_[_0x4891('0x41')]({},_0xe4f7c7,_0x26acb6[_0x4891('0x43')]);return _0x2ce13f[_0x4891('0x4d')](_0xe4f7c7);}})[_0x4891('0x28')](function(_0x33c753){if(_0x33c753){_0x1f85bb=_0x33c753[_0x4891('0x4f')];if(!_0x26acb6['query'][_0x4891('0x3a')](_0x4891('0x3b'))){_0xe4f7c7['limit']=qs['limit'](_0x26acb6[_0x4891('0x33')]['limit']);_0xe4f7c7['offset']=qs[_0x4891('0x20')](_0x26acb6['query'][_0x4891('0x20')]);}return _0x2ce13f['getConfigurations'](_0xe4f7c7);}})[_0x4891('0x28')](function(_0x1eb52f){if(_0x1eb52f){return _0x1eb52f?{'count':_0x1f85bb,'rows':_0x1eb52f}:null;}})[_0x4891('0x28')](respondWithResult(_0x22368c,null))[_0x4891('0x47')](handleError(_0x22368c,null));};exports[_0x4891('0x50')]=function(_0x455684,_0x48ae11,_0x3ce155){if(_0x455684[_0x4891('0x4b')]['id']){delete _0x455684['body']['id'];}return db[_0x4891('0x2f')]['findOne']({'where':{'id':_0x455684[_0x4891('0x48')]['id']}})[_0x4891('0x28')](handleEntityNotFound(_0x48ae11,null))[_0x4891('0x28')](function(_0x5ab4ee){if(_0x5ab4ee){_0x455684[_0x4891('0x4b')]['AccountId']=_0x5ab4ee['id'];_0x455684[_0x4891('0x4b')][_0x4891('0x51')]=integrations[_0x4891('0x52')](_0x455684[_0x4891('0x4b')][_0x4891('0x53')],_0x455684[_0x4891('0x4b')][_0x4891('0x31')]);_0x455684['body'][_0x4891('0x54')]=integrations[_0x4891('0x55')](_0x455684['body'][_0x4891('0x53')],_0x455684[_0x4891('0x4b')][_0x4891('0x31')]);return db[_0x4891('0x4e')][_0x4891('0x4a')](_0x455684['body'],{'include':[{'model':db[_0x4891('0x56')],'as':_0x4891('0x51')},{'model':db[_0x4891('0x56')],'as':_0x4891('0x54')}]});}return null;})[_0x4891('0x28')](respondWithResult(_0x48ae11,null))[_0x4891('0x47')](handleError(_0x48ae11,null));};exports['getFields']=function(_0x182e4f,_0x4663e8,_0x2f851a){var _0x47afe8;var _0x31b83d='';var _0x3d7415=_0x4891('0x57');return db['SalesforceAccount'][_0x4891('0x58')]({'where':{'id':_0x182e4f[_0x4891('0x48')]['id']},'attributes':['id',_0x4891('0x59'),_0x4891('0x5a'),_0x4891('0x5b'),_0x4891('0x5c'),_0x4891('0x5d'),_0x4891('0x5e')]})[_0x4891('0x28')](handleEntityNotFound(_0x4663e8,null))[_0x4891('0x28')](function(_0x341a8b){if(_0x341a8b){_0x31b83d=_0x341a8b[_0x4891('0x59')];var _0x2ebdec=_0x31b83d[_0x4891('0x5f')](-0x1);if(_0x2ebdec==='/'){_0x31b83d=_0x31b83d['substring'](0x0,_0x31b83d[_0x4891('0x60')](_0x2ebdec));}_0x47afe8=new jsforce[(_0x4891('0x61'))]({'oauth2':{'loginUrl':_0x31b83d,'clientId':_0x341a8b[_0x4891('0x5a')],'clientSecret':_0x341a8b['clientSecret']}});return _0x47afe8[_0x4891('0x62')](_0x341a8b['username'],_0x341a8b[_0x4891('0x5d')]['concat'](_0x341a8b[_0x4891('0x5e')]));}})[_0x4891('0x28')](function(_0x2933bf){if(_0x2933bf){if(!_[_0x4891('0x63')](_0x182e4f['query'][_0x4891('0x64')])){_0x3d7415=_0x182e4f[_0x4891('0x33')]['ticketType'];}return _0x47afe8[_0x4891('0x65')](_0x3d7415)['describe']();}})['then'](function(_0x3cae70){var _0x55715b=['OwnerId','ActivityDate',_0x4891('0x66'),_0x4891('0x67'),_0x4891('0x68'),_0x4891('0x69')];var _0x33a1e1=[_0x4891('0x6a'),'int',_0x4891('0x6b'),'boolean','email',_0x4891('0x6c'),'phone'];if(_0x3cae70){_['remove'](_0x3cae70[_0x4891('0x39')],function(_0x544ce0){return _0x55715b[_0x4891('0x6d')](_0x544ce0[_0x4891('0x2c')])||!_0x33a1e1[_0x4891('0x6d')](_0x544ce0[_0x4891('0x31')]);});return{'count':_0x3cae70['fields'][_0x4891('0x4f')],'rows':_['map'](_0x3cae70[_0x4891('0x39')],function(_0xdf2835){return{'id':_0xdf2835[_0x4891('0x2c')],'name':_0xdf2835[_0x4891('0x6e')],'custom':_0xdf2835[_0x4891('0x6f')],'options':_0xdf2835['picklistValues']['length']>0x0?_['map'](_0xdf2835[_0x4891('0x70')],function(_0x25ab1a){return{'name':_0x25ab1a[_0x4891('0x6e')],'value':_0x25ab1a[_0x4891('0x71')]};}):_0xdf2835['type']==_0x4891('0x72')?[{'name':_0x4891('0x73'),'value':'true'},{'name':_0x4891('0x74'),'value':_0x4891('0x75')}]:[]};})};}})[_0x4891('0x28')](respondWithResult(_0x4663e8,null))['catch'](function(_0x5aa358){var _0x3914aa=_0x182e4f[_0x4891('0x33')]['test']?0x1f4:_0x5aa358['statusCode']||0x1f4;logger[_0x4891('0x2a')](_0x4891('0x76'),_0x4891('0x77'),_0x3914aa,JSON[_0x4891('0x78')](_0x5aa358));delete _0x5aa358[_0x4891('0x2c')];if(_0x3914aa===0x191){_0x3914aa=0x190;}_0x4663e8[_0x4891('0x1e')](_0x3914aa)[_0x4891('0x79')](_0x182e4f[_0x4891('0x33')][_0x4891('0x7a')]?{'message':_0x4891('0x7b'),'statusCode':_0x5aa358[_0x4891('0x7c')]}:_0x5aa358);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 32ad124..14aa20f 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 _0x428b=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x428b,0x180));var _0xb428=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x428b[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0xb428('0x0'));var logger=require(_0xb428('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb428('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb428('0x3'));var rimraf=require(_0xb428('0x4'));var config=require(_0xb428('0x5'));var attributes=require(_0xb428('0x6'));var integrations=require(_0xb428('0x7'));module[_0xb428('0x8')]=function(_0x53528f,_0x27bfe6){return _0x53528f[_0xb428('0x9')](_0xb428('0xa'),attributes,{'tableName':_0xb428('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fca=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0x0fca,0x185));var _0xa0fc=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0fca[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xa0fc('0x0'));var util=require(_0xa0fc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0fc('0x2'));var BPromise=require(_0xa0fc('0x3'));var rp=require(_0xa0fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0fc('0x5'));var config=require(_0xa0fc('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa0fc('0x7'));module[_0xa0fc('0x8')]=function(_0x42b04d,_0x4301b6){return _0x42b04d[_0xa0fc('0x9')](_0xa0fc('0xa'),attributes,{'tableName':_0xa0fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 068dc71..5bead11 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 _0xb282=['options','where','attributes','limit','map','include','model','then','GetSalesforceAccount','catch','ShowSalesforceAccount','find','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SalesforceAccount'];(function(_0x3cfe76,_0x1d9d61){var _0x1f6f12=function(_0x1f2148){while(--_0x1f2148){_0x3cfe76['push'](_0x3cfe76['shift']());}};_0x1f6f12(++_0x1d9d61);}(_0xb282,0xad));var _0x2b28=function(_0x4d0810,_0x13e15f){_0x4d0810=_0x4d0810-0x0;var _0x3e47e0=_0xb282[_0x4d0810];return _0x3e47e0;};'use strict';var _=require(_0x2b28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b28('0x1'));var rs=require(_0x2b28('0x2'));var fs=require('fs');var Redis=require(_0x2b28('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b28('0x4'));var logger=require(_0x2b28('0x5'))(_0x2b28('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b28('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51d80a,_0x44181f,_0x406760){return new BPromise(function(_0x4a681b,_0x2bd543){return client['request'](_0x51d80a,_0x406760)['then'](function(_0x153509){logger[_0x2b28('0x8')](_0x2b28('0x9'),_0x44181f,_0x2b28('0xa'));logger[_0x2b28('0xb')](_0x2b28('0xc'),_0x44181f,'request\x20sent',JSON[_0x2b28('0xd')](_0x153509));if(_0x153509[_0x2b28('0xe')]){if(_0x153509[_0x2b28('0xe')][_0x2b28('0xf')]===0x1f4){logger[_0x2b28('0xe')](_0x2b28('0x9'),_0x44181f,_0x153509[_0x2b28('0xe')][_0x2b28('0x10')]);return _0x2bd543(_0x153509['error']['message']);}logger[_0x2b28('0xe')](_0x2b28('0x9'),_0x44181f,_0x153509[_0x2b28('0xe')]['message']);return _0x4a681b(_0x153509[_0x2b28('0xe')][_0x2b28('0x10')]);}else{logger[_0x2b28('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x44181f,_0x2b28('0xa'));_0x4a681b(_0x153509[_0x2b28('0x11')][_0x2b28('0x10')]);}})['catch'](function(_0x519ec8){logger['error'](_0x2b28('0x9'),_0x44181f,_0x519ec8);_0x2bd543(_0x519ec8);});});}exports['GetSalesforceAccount']=function(_0x10e674){var _0xa68f21=this;return new Promise(function(_0x29dd8c,_0x4b8736){return db[_0x2b28('0x12')]['findAll']({'raw':_0x10e674[_0x2b28('0x13')]?_0x10e674[_0x2b28('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x10e674[_0x2b28('0x13')]?_0x10e674['options'][_0x2b28('0x14')]||null:null,'attributes':_0x10e674['options']?_0x10e674['options'][_0x2b28('0x15')]||null:null,'limit':_0x10e674[_0x2b28('0x13')]?_0x10e674['options'][_0x2b28('0x16')]||null:null,'include':_0x10e674[_0x2b28('0x13')]?_0x10e674[_0x2b28('0x13')]['include']?_[_0x2b28('0x17')](_0x10e674[_0x2b28('0x13')][_0x2b28('0x18')],function(_0x39ca6d){return{'model':db[_0x39ca6d['model']],'as':_0x39ca6d['as'],'attributes':_0x39ca6d[_0x2b28('0x15')],'include':_0x39ca6d[_0x2b28('0x18')]?_[_0x2b28('0x17')](_0x39ca6d[_0x2b28('0x18')],function(_0x3d3d3e){return{'model':db[_0x3d3d3e[_0x2b28('0x19')]],'as':_0x3d3d3e['as'],'attributes':_0x3d3d3e[_0x2b28('0x15')],'include':_0x3d3d3e['include']?_['map'](_0x3d3d3e[_0x2b28('0x18')],function(_0x102a56){return{'model':db[_0x102a56[_0x2b28('0x19')]],'as':_0x102a56['as'],'attributes':_0x102a56[_0x2b28('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2b28('0x1a')](function(_0x263dbe){logger['info'](_0x2b28('0x1b'),_0x10e674);logger[_0x2b28('0xb')]('GetSalesforceAccount',_0x10e674,JSON[_0x2b28('0xd')](_0x263dbe));_0x29dd8c(_0x263dbe);})[_0x2b28('0x1c')](function(_0x40613a){logger['error'](_0x2b28('0x1b'),_0x40613a['message'],_0x10e674);_0x4b8736(_0xa68f21[_0x2b28('0xe')](0x1f4,_0x40613a[_0x2b28('0x10')]));});});};exports[_0x2b28('0x1d')]=function(_0x1822ac){var _0xc7b5f=this;return new Promise(function(_0x2b4233,_0xebea2a){return db[_0x2b28('0x12')][_0x2b28('0x1e')]({'raw':_0x1822ac[_0x2b28('0x13')]?_0x1822ac[_0x2b28('0x13')][_0x2b28('0x1f')]===undefined?!![]:![]:!![],'where':_0x1822ac[_0x2b28('0x13')]?_0x1822ac[_0x2b28('0x13')]['where']||null:null,'attributes':_0x1822ac[_0x2b28('0x13')]?_0x1822ac['options'][_0x2b28('0x15')]||null:null,'include':_0x1822ac[_0x2b28('0x13')]?_0x1822ac['options'][_0x2b28('0x18')]?_[_0x2b28('0x17')](_0x1822ac[_0x2b28('0x13')][_0x2b28('0x18')],function(_0x4425dd){return{'model':db[_0x4425dd[_0x2b28('0x19')]],'as':_0x4425dd['as'],'attributes':_0x4425dd[_0x2b28('0x15')],'include':_0x4425dd['include']?_[_0x2b28('0x17')](_0x4425dd[_0x2b28('0x18')],function(_0x4d03a5){return{'model':db[_0x4d03a5[_0x2b28('0x19')]],'as':_0x4d03a5['as'],'attributes':_0x4d03a5[_0x2b28('0x15')],'include':_0x4d03a5[_0x2b28('0x18')]?_[_0x2b28('0x17')](_0x4d03a5['include'],function(_0x350a88){return{'model':db[_0x350a88['model']],'as':_0x350a88['as'],'attributes':_0x350a88[_0x2b28('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2b28('0x1a')](function(_0xcd3288){logger[_0x2b28('0x8')](_0x2b28('0x1d'),_0x1822ac);logger[_0x2b28('0xb')](_0x2b28('0x1d'),_0x1822ac,JSON[_0x2b28('0xd')](_0xcd3288));_0x2b4233(_0xcd3288);})[_0x2b28('0x1c')](function(_0x59369c){logger[_0x2b28('0xe')](_0x2b28('0x1d'),_0x59369c[_0x2b28('0x10')],_0x1822ac);_0xebea2a(_0xc7b5f[_0x2b28('0xe')](0x1f4,_0x59369c[_0x2b28('0x10')]));});});}; \ No newline at end of file +var _0xe137=['raw','where','attributes','limit','model','include','map','then','info','find','ShowSalesforceAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xe137,0x176));var _0x7e13=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xe137[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e13('0x0'));var BPromise=require(_0x7e13('0x1'));var rs=require(_0x7e13('0x2'));var fs=require('fs');var Redis=require(_0x7e13('0x3'));var db=require(_0x7e13('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e13('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e13('0x6'));var client=jayson['client'][_0x7e13('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50902f,_0x2bb94a,_0x1d6c8f){return new BPromise(function(_0x47acd7,_0x5e2d19){return client['request'](_0x50902f,_0x1d6c8f)['then'](function(_0x4f01a2){logger['info'](_0x7e13('0x8'),_0x2bb94a,_0x7e13('0x9'));logger[_0x7e13('0xa')](_0x7e13('0xb'),_0x2bb94a,_0x7e13('0x9'),JSON[_0x7e13('0xc')](_0x4f01a2));if(_0x4f01a2[_0x7e13('0xd')]){if(_0x4f01a2['error'][_0x7e13('0xe')]===0x1f4){logger[_0x7e13('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x2bb94a,_0x4f01a2['error'][_0x7e13('0xf')]);return _0x5e2d19(_0x4f01a2[_0x7e13('0xd')][_0x7e13('0xf')]);}logger[_0x7e13('0xd')](_0x7e13('0x8'),_0x2bb94a,_0x4f01a2['error'][_0x7e13('0xf')]);return _0x47acd7(_0x4f01a2[_0x7e13('0xd')]['message']);}else{logger['info'](_0x7e13('0x8'),_0x2bb94a,_0x7e13('0x9'));_0x47acd7(_0x4f01a2[_0x7e13('0x10')][_0x7e13('0xf')]);}})[_0x7e13('0x11')](function(_0x1a2c44){logger[_0x7e13('0xd')](_0x7e13('0x8'),_0x2bb94a,_0x1a2c44);_0x5e2d19(_0x1a2c44);});});}exports[_0x7e13('0x12')]=function(_0x27ec4c){var _0xdfa7c2=this;return new Promise(function(_0x3ac440,_0x1d53aa){return db[_0x7e13('0x13')][_0x7e13('0x14')]({'raw':_0x27ec4c['options']?_0x27ec4c[_0x7e13('0x15')][_0x7e13('0x16')]===undefined?!![]:![]:!![],'where':_0x27ec4c['options']?_0x27ec4c['options'][_0x7e13('0x17')]||null:null,'attributes':_0x27ec4c[_0x7e13('0x15')]?_0x27ec4c['options'][_0x7e13('0x18')]||null:null,'limit':_0x27ec4c[_0x7e13('0x15')]?_0x27ec4c[_0x7e13('0x15')][_0x7e13('0x19')]||null:null,'include':_0x27ec4c[_0x7e13('0x15')]?_0x27ec4c[_0x7e13('0x15')]['include']?_['map'](_0x27ec4c[_0x7e13('0x15')]['include'],function(_0x39e2fd){return{'model':db[_0x39e2fd[_0x7e13('0x1a')]],'as':_0x39e2fd['as'],'attributes':_0x39e2fd[_0x7e13('0x18')],'include':_0x39e2fd[_0x7e13('0x1b')]?_[_0x7e13('0x1c')](_0x39e2fd['include'],function(_0x856cbe){return{'model':db[_0x856cbe['model']],'as':_0x856cbe['as'],'attributes':_0x856cbe[_0x7e13('0x18')],'include':_0x856cbe[_0x7e13('0x1b')]?_[_0x7e13('0x1c')](_0x856cbe['include'],function(_0x101923){return{'model':db[_0x101923[_0x7e13('0x1a')]],'as':_0x101923['as'],'attributes':_0x101923['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e13('0x1d')](function(_0x3660bb){logger[_0x7e13('0x1e')](_0x7e13('0x12'),_0x27ec4c);logger[_0x7e13('0xa')]('GetSalesforceAccount',_0x27ec4c,JSON[_0x7e13('0xc')](_0x3660bb));_0x3ac440(_0x3660bb);})[_0x7e13('0x11')](function(_0x40bb03){logger['error'](_0x7e13('0x12'),_0x40bb03['message'],_0x27ec4c);_0x1d53aa(_0xdfa7c2['error'](0x1f4,_0x40bb03[_0x7e13('0xf')]));});});};exports['ShowSalesforceAccount']=function(_0x343da3){var _0x5d39e8=this;return new Promise(function(_0x2d2a90,_0x38c2e7){return db[_0x7e13('0x13')][_0x7e13('0x1f')]({'raw':_0x343da3['options']?_0x343da3[_0x7e13('0x15')][_0x7e13('0x16')]===undefined?!![]:![]:!![],'where':_0x343da3[_0x7e13('0x15')]?_0x343da3[_0x7e13('0x15')][_0x7e13('0x17')]||null:null,'attributes':_0x343da3[_0x7e13('0x15')]?_0x343da3[_0x7e13('0x15')]['attributes']||null:null,'include':_0x343da3[_0x7e13('0x15')]?_0x343da3[_0x7e13('0x15')][_0x7e13('0x1b')]?_[_0x7e13('0x1c')](_0x343da3[_0x7e13('0x15')]['include'],function(_0x29931c){return{'model':db[_0x29931c[_0x7e13('0x1a')]],'as':_0x29931c['as'],'attributes':_0x29931c[_0x7e13('0x18')],'include':_0x29931c[_0x7e13('0x1b')]?_[_0x7e13('0x1c')](_0x29931c[_0x7e13('0x1b')],function(_0x2effd5){return{'model':db[_0x2effd5[_0x7e13('0x1a')]],'as':_0x2effd5['as'],'attributes':_0x2effd5['attributes'],'include':_0x2effd5['include']?_[_0x7e13('0x1c')](_0x2effd5['include'],function(_0x4208f7){return{'model':db[_0x4208f7[_0x7e13('0x1a')]],'as':_0x4208f7['as'],'attributes':_0x4208f7[_0x7e13('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7e13('0x1d')](function(_0x4634f9){logger['info'](_0x7e13('0x20'),_0x343da3);logger[_0x7e13('0xa')](_0x7e13('0x20'),_0x343da3,JSON[_0x7e13('0xc')](_0x4634f9));_0x2d2a90(_0x4634f9);})[_0x7e13('0x11')](function(_0x350c08){logger[_0x7e13('0xd')](_0x7e13('0x20'),_0x350c08[_0x7e13('0xf')],_0x343da3);_0x38c2e7(_0x5d39e8[_0x7e13('0xd')](0x1f4,_0x350c08[_0x7e13('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 61beaf4..311fb4f 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xdb28,0x106));var _0x8db2=function(_0x72429e,_0x23d2e1){_0x72429e=_0x72429e-0x0;var _0x1768b9=_0xdb28[_0x72429e];return _0x1768b9;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1792cf,_0x30143a){var _0x2e490c=function(_0x42ce34){while(--_0x42ce34){_0x1792cf['push'](_0x1792cf['shift']());}};_0x2e490c(++_0x30143a);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a1bc0,_0x8422a5){_0x5a1bc0=_0x5a1bc0-0x0;var _0x3baf67=_0x2ef3[_0x5a1bc0];return _0x3baf67;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b12a0a5..de38818 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 _0x8f72=['STRING','ENUM','Case','Task','contact_lead','contact','lead','account','nothing','sequelize','exports'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x8f72,0xfb));var _0x28f7=function(_0x415fe0,_0x5730b7){_0x415fe0=_0x415fe0-0x0;var _0x4c0f5d=_0x8f72[_0x415fe0];return _0x4c0f5d;};'use strict';var Sequelize=require(_0x28f7('0x0'));module[_0x28f7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x28f7('0x2')]},'ticketType':{'type':Sequelize[_0x28f7('0x3')]('Task',_0x28f7('0x4')),'defaultValue':_0x28f7('0x5')},'moduleSearch':{'type':Sequelize[_0x28f7('0x3')](_0x28f7('0x6'),_0x28f7('0x7'),_0x28f7('0x8'),'account_contact_lead',_0x28f7('0x9')),'defaultValue':_0x28f7('0x6')},'moduleCreate':{'type':Sequelize[_0x28f7('0x3')](_0x28f7('0xa'),'contact','lead','account'),'defaultValue':_0x28f7('0x8')},'leadId':{'type':Sequelize[_0x28f7('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x28f7('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x28f7('0x2')]}}; \ No newline at end of file +var _0xc35f=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account','nothing','sequelize','exports'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0xc35f,0x82));var _0xfc35=function(_0xcc4c6b,_0x403f00){_0xcc4c6b=_0xcc4c6b-0x0;var _0x409805=_0xc35f[_0xcc4c6b];return _0x409805;};'use strict';var Sequelize=require(_0xfc35('0x0'));module[_0xfc35('0x1')]={'name':{'type':Sequelize[_0xfc35('0x2')]},'description':{'type':Sequelize[_0xfc35('0x2')]},'ticketType':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x4'),_0xfc35('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x6'),_0xfc35('0x7'),_0xfc35('0x8'),'account_contact_lead',_0xfc35('0x9')),'defaultValue':_0xfc35('0x6')},'moduleCreate':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0xa'),_0xfc35('0x7'),_0xfc35('0x8'),'account'),'defaultValue':_0xfc35('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xfc35('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfc35('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xfc35('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9ae9bcb..39b6fc8 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 _0xc474=['params','find','catch','body','destroy','findOne','map','getFields','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc474,0xfc));var _0x4c47=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xc474[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require(_0x4c47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c47('0x3'));var moment=require(_0x4c47('0x4'));var BPromise=require(_0x4c47('0x5'));var Mustache=require(_0x4c47('0x6'));var util=require(_0x4c47('0x7'));var path=require(_0x4c47('0x8'));var sox=require(_0x4c47('0x9'));var csv=require(_0x4c47('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=typeof _0x78f26b['offset']==='undefined'&&typeof _0x78f26b['limit']===_0x4c47('0x1b');var _0x92a444=_0x16c7a9[_0x4c47('0x1c')];var _0x5727cf=_0xd162cc?0x0:_0x78f26b[_0x4c47('0x1d')];var _0x254dfc=_0xd162cc?_0x16c7a9[_0x4c47('0x1c')]:_0x78f26b[_0x4c47('0x1d')]+_0x78f26b['limit'];var _0x4cc984;if(_0x254dfc>=_0x92a444){_0x254dfc=_0x92a444;_0x4cc984=0xc8;}else{_0x4cc984=0xce;}_0xb53c24['status'](_0x4cc984);return _0xb53c24[_0x4c47('0x1e')](_0x4c47('0x1f'),_0x5727cf+'-'+_0x254dfc+'/'+_0x92a444)[_0x4c47('0x20')](_0x16c7a9);}return null;};}function patchUpdates(_0x3b156f){return function(_0x52de60){try{jsonpatch[_0x4c47('0x21')](_0x52de60,_0x3b156f,!![]);}catch(_0x27b61a){return BPromise[_0x4c47('0x22')](_0x27b61a);}return _0x52de60[_0x4c47('0x23')]();};}function saveUpdates(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['update'](_0x20950c)['then'](function(_0x1a575a){return _0x1a575a;});}return null;};}function removeEntity(_0x275a10,_0x4d110d){return function(_0x3037a2){if(_0x3037a2){return _0x3037a2['destroy']()[_0x4c47('0x24')](function(){_0x275a10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592469,_0x3bacc9){return function(_0x3bd199){if(!_0x3bd199){_0x592469[_0x4c47('0x25')](0x194);}return _0x3bd199;};}function handleError(_0x4eff26,_0x33f440){_0x33f440=_0x33f440||0x1f4;return function(_0x2c0367){logger[_0x4c47('0x26')](_0x2c0367[_0x4c47('0x27')]);if(_0x2c0367[_0x4c47('0x28')]){delete _0x2c0367[_0x4c47('0x28')];}_0x4eff26[_0x4c47('0x1a')](_0x33f440)[_0x4c47('0x29')](_0x2c0367);};}exports['index']=function(_0x36e82b,_0x344a7d){var _0x590b56={},_0x491638={},_0x3b977d={'count':0x0,'rows':[]};var _0x56c130=_['map'](db[_0x4c47('0x2a')][_0x4c47('0x2b')],function(_0x12462a){return{'name':_0x12462a[_0x4c47('0x2c')],'type':_0x12462a[_0x4c47('0x2d')]['key']};});_0x491638[_0x4c47('0x2e')]=_['map'](_0x56c130,_0x4c47('0x28'));_0x491638[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x36e82b['query']);_0x491638['filters']=_['intersection'](_0x491638['model'],_0x491638[_0x4c47('0x2f')]);_0x590b56[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x491638['model'],qs[_0x4c47('0x33')](_0x36e82b['query'][_0x4c47('0x33')]));_0x590b56[_0x4c47('0x31')]=_0x590b56[_0x4c47('0x31')][_0x4c47('0x34')]?_0x590b56[_0x4c47('0x31')]:_0x491638[_0x4c47('0x2e')];if(!_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x35')]('nolimit')){_0x590b56[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x590b56['offset']=qs['offset'](_0x36e82b['query'][_0x4c47('0x1d')]);}_0x590b56[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x36e82b['query']['sort']);_0x590b56['where']=qs['filters'](_[_0x4c47('0x39')](_0x36e82b[_0x4c47('0x2f')],_0x491638[_0x4c47('0x3a')]),_0x56c130);if(_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x3b')]){_0x590b56['where']=_[_0x4c47('0x3c')](_0x590b56[_0x4c47('0x3d')],{'$or':_['map'](_0x56c130,function(_0x1c309b){if(_0x1c309b[_0x4c47('0x2d')]!==_0x4c47('0x3e')){var _0x418098={};_0x418098[_0x1c309b[_0x4c47('0x28')]]={'$like':'%'+_0x36e82b['query'][_0x4c47('0x3b')]+'%'};return _0x418098;}})});}_0x590b56=_[_0x4c47('0x3c')]({},_0x590b56,_0x36e82b[_0x4c47('0x3f')]);var _0x291666={'where':_0x590b56[_0x4c47('0x3d')]};return db['SalesforceConfiguration'][_0x4c47('0x1c')](_0x291666)[_0x4c47('0x24')](function(_0x5a7135){_0x3b977d[_0x4c47('0x1c')]=_0x5a7135;if(_0x36e82b['query'][_0x4c47('0x40')]){_0x590b56[_0x4c47('0x41')]=[{'all':!![]}];}return db[_0x4c47('0x2a')]['findAll'](_0x590b56);})['then'](function(_0x164105){_0x3b977d[_0x4c47('0x42')]=_0x164105;return _0x3b977d;})[_0x4c47('0x24')](respondWithFilteredResult(_0x344a7d,_0x590b56))['catch'](handleError(_0x344a7d,null));};exports[_0x4c47('0x43')]=function(_0x10669d,_0x40057e){var _0x5a0b1f={'raw':![],'where':{'id':_0x10669d[_0x4c47('0x44')]['id']}},_0x274596={};_0x274596[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2a')][_0x4c47('0x2b')]);_0x274596[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x10669d[_0x4c47('0x2f')]);_0x274596[_0x4c47('0x3a')]=_['intersection'](_0x274596[_0x4c47('0x2e')],_0x274596[_0x4c47('0x2f')]);_0x5a0b1f['attributes']=_['intersection'](_0x274596[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x10669d['query'][_0x4c47('0x33')]));_0x5a0b1f[_0x4c47('0x31')]=_0x5a0b1f[_0x4c47('0x31')][_0x4c47('0x34')]?_0x5a0b1f[_0x4c47('0x31')]:_0x274596['model'];if(_0x10669d['query'][_0x4c47('0x40')]){_0x5a0b1f[_0x4c47('0x41')]=[{'all':!![]}];}_0x5a0b1f=_[_0x4c47('0x3c')]({},_0x5a0b1f,_0x10669d[_0x4c47('0x3f')]);return db[_0x4c47('0x2a')][_0x4c47('0x45')](_0x5a0b1f)[_0x4c47('0x24')](handleEntityNotFound(_0x40057e,null))['then'](respondWithResult(_0x40057e,null))[_0x4c47('0x46')](handleError(_0x40057e,null));};exports['create']=function(_0x40bbec,_0x460fef){return db[_0x4c47('0x2a')]['create'](_0x40bbec[_0x4c47('0x47')],{})[_0x4c47('0x24')](respondWithResult(_0x460fef,0xc9))[_0x4c47('0x46')](handleError(_0x460fef,null));};exports['update']=function(_0x125b18,_0x4ccb67){if(_0x125b18[_0x4c47('0x47')]['id']){delete _0x125b18['body']['id'];}return db[_0x4c47('0x2a')]['find']({'where':{'id':_0x125b18[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x4ccb67,null))[_0x4c47('0x24')](saveUpdates(_0x125b18[_0x4c47('0x47')],null))['then'](respondWithResult(_0x4ccb67,null))['catch'](handleError(_0x4ccb67,null));};exports[_0x4c47('0x48')]=function(_0x48ba62,_0x419ee3){return db[_0x4c47('0x2a')][_0x4c47('0x45')]({'where':{'id':_0x48ba62['params']['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x419ee3,null))[_0x4c47('0x24')](removeEntity(_0x419ee3,null))['catch'](handleError(_0x419ee3,null));};exports['getFields']=function(_0x59d746,_0x479332,_0x23aff5){var _0x3f403b={};var _0x4048e7={};var _0x386af4;var _0x5d2618;return db[_0x4c47('0x2a')][_0x4c47('0x49')]({'where':{'id':_0x59d746[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x479332,null))[_0x4c47('0x24')](function(_0x345289){if(_0x345289){_0x386af4=_0x345289;_0x4048e7[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db['SalesforceField'][_0x4c47('0x2b')]);_0x4048e7[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x59d746['query']);_0x4048e7['filters']=_['intersection'](_0x4048e7[_0x4c47('0x2e')],_0x4048e7[_0x4c47('0x2f')]);_0x3f403b[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x4048e7[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x59d746[_0x4c47('0x2f')][_0x4c47('0x33')]));_0x3f403b[_0x4c47('0x31')]=_0x3f403b[_0x4c47('0x31')]['length']?_0x3f403b['attributes']:_0x4048e7[_0x4c47('0x2e')];_0x3f403b[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x59d746[_0x4c47('0x2f')][_0x4c47('0x38')]);_0x3f403b[_0x4c47('0x3d')]=qs['filters'](_[_0x4c47('0x39')](_0x59d746['query'],_0x4048e7['filters']));if(_0x59d746['query'][_0x4c47('0x3b')]){_0x3f403b[_0x4c47('0x3d')]=_[_0x4c47('0x3c')](_0x3f403b[_0x4c47('0x3d')],{'$or':_[_0x4c47('0x4a')](_0x3f403b[_0x4c47('0x31')],function(_0x36f2d8){var _0x4790f9={};_0x4790f9[_0x36f2d8]={'$like':'%'+_0x59d746['query'][_0x4c47('0x3b')]+'%'};return _0x4790f9;})});}_0x3f403b=_['merge']({},_0x3f403b,_0x59d746[_0x4c47('0x3f')]);return _0x386af4[_0x4c47('0x4b')](_0x3f403b);}})[_0x4c47('0x24')](function(_0x4b3009){if(_0x4b3009){_0x5d2618=_0x4b3009[_0x4c47('0x34')];if(!_0x59d746[_0x4c47('0x2f')][_0x4c47('0x35')](_0x4c47('0x4c'))){_0x3f403b[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x59d746[_0x4c47('0x2f')]['limit']);_0x3f403b[_0x4c47('0x1d')]=qs[_0x4c47('0x1d')](_0x59d746[_0x4c47('0x2f')][_0x4c47('0x1d')]);}return _0x386af4[_0x4c47('0x4b')](_0x3f403b);}})[_0x4c47('0x24')](function(_0x38339f){if(_0x38339f){return _0x38339f?{'count':_0x5d2618,'rows':_0x38339f}:null;}})[_0x4c47('0x24')](respondWithResult(_0x479332,null))[_0x4c47('0x46')](handleError(_0x479332,null));};exports[_0x4c47('0x4d')]=function(_0x19e8fd,_0x21808c,_0x4d6b7f){var _0xc436f7={};var _0x46bf82={};var _0x15a4b8;var _0x20316a;return db['SalesforceConfiguration'][_0x4c47('0x49')]({'where':{'id':_0x19e8fd[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x21808c,null))['then'](function(_0x27bb34){if(_0x27bb34){_0x15a4b8=_0x27bb34;_0x46bf82[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x4e')][_0x4c47('0x2b')]);_0x46bf82[_0x4c47('0x2f')]=_['keys'](_0x19e8fd[_0x4c47('0x2f')]);_0x46bf82['filters']=_[_0x4c47('0x32')](_0x46bf82['model'],_0x46bf82['query']);_0xc436f7['attributes']=_[_0x4c47('0x32')](_0x46bf82[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x19e8fd['query'][_0x4c47('0x33')]));_0xc436f7[_0x4c47('0x31')]=_0xc436f7['attributes'][_0x4c47('0x34')]?_0xc436f7[_0x4c47('0x31')]:_0x46bf82[_0x4c47('0x2e')];_0xc436f7[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x19e8fd[_0x4c47('0x2f')]['sort']);_0xc436f7[_0x4c47('0x3d')]=qs[_0x4c47('0x3a')](_[_0x4c47('0x39')](_0x19e8fd[_0x4c47('0x2f')],_0x46bf82[_0x4c47('0x3a')]));if(_0x19e8fd[_0x4c47('0x2f')][_0x4c47('0x3b')]){_0xc436f7[_0x4c47('0x3d')]=_['merge'](_0xc436f7[_0x4c47('0x3d')],{'$or':_[_0x4c47('0x4a')](_0xc436f7[_0x4c47('0x31')],function(_0x21df76){var _0x1dde40={};_0x1dde40[_0x21df76]={'$like':'%'+_0x19e8fd[_0x4c47('0x2f')]['filter']+'%'};return _0x1dde40;})});}_0xc436f7=_[_0x4c47('0x3c')]({},_0xc436f7,_0x19e8fd[_0x4c47('0x3f')]);return _0x15a4b8[_0x4c47('0x4d')](_0xc436f7);}})[_0x4c47('0x24')](function(_0x56eade){if(_0x56eade){_0x20316a=_0x56eade[_0x4c47('0x34')];if(!_0x19e8fd[_0x4c47('0x2f')]['hasOwnProperty'](_0x4c47('0x4c'))){_0xc436f7[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x19e8fd[_0x4c47('0x2f')][_0x4c47('0x36')]);_0xc436f7[_0x4c47('0x1d')]=qs[_0x4c47('0x1d')](_0x19e8fd[_0x4c47('0x2f')][_0x4c47('0x1d')]);}return _0x15a4b8[_0x4c47('0x4d')](_0xc436f7);}})[_0x4c47('0x24')](function(_0x2ee540){if(_0x2ee540){return _0x2ee540?{'count':_0x20316a,'rows':_0x2ee540}:null;}})[_0x4c47('0x24')](respondWithResult(_0x21808c,null))['catch'](handleError(_0x21808c,null));};exports[_0x4c47('0x4f')]=function(_0x3f5b10,_0x39f7c9,_0x589eac){var _0x3f34f7={};var _0x59935b={};var _0x3461f4;var _0x4d3bf7;return db[_0x4c47('0x2a')]['findOne']({'where':{'id':_0x3f5b10[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x39f7c9,null))[_0x4c47('0x24')](function(_0xf33d8b){if(_0xf33d8b){_0x3461f4=_0xf33d8b;_0x59935b[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x4e')][_0x4c47('0x2b')]);_0x59935b['query']=_[_0x4c47('0x30')](_0x3f5b10[_0x4c47('0x2f')]);_0x59935b[_0x4c47('0x3a')]=_[_0x4c47('0x32')](_0x59935b['model'],_0x59935b[_0x4c47('0x2f')]);_0x3f34f7[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x59935b[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x3f5b10[_0x4c47('0x2f')][_0x4c47('0x33')]));_0x3f34f7[_0x4c47('0x31')]=_0x3f34f7[_0x4c47('0x31')][_0x4c47('0x34')]?_0x3f34f7['attributes']:_0x59935b[_0x4c47('0x2e')];_0x3f34f7[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x3f5b10[_0x4c47('0x2f')]['sort']);_0x3f34f7[_0x4c47('0x3d')]=qs[_0x4c47('0x3a')](_[_0x4c47('0x39')](_0x3f5b10[_0x4c47('0x2f')],_0x59935b[_0x4c47('0x3a')]));if(_0x3f5b10[_0x4c47('0x2f')]['filter']){_0x3f34f7[_0x4c47('0x3d')]=_[_0x4c47('0x3c')](_0x3f34f7[_0x4c47('0x3d')],{'$or':_[_0x4c47('0x4a')](_0x3f34f7['attributes'],function(_0x2481d6){var _0x7b1d3c={};_0x7b1d3c[_0x2481d6]={'$like':'%'+_0x3f5b10[_0x4c47('0x2f')][_0x4c47('0x3b')]+'%'};return _0x7b1d3c;})});}_0x3f34f7=_['merge']({},_0x3f34f7,_0x3f5b10[_0x4c47('0x3f')]);return _0x3461f4[_0x4c47('0x4f')](_0x3f34f7);}})[_0x4c47('0x24')](function(_0x173088){if(_0x173088){_0x4d3bf7=_0x173088[_0x4c47('0x34')];if(!_0x3f5b10[_0x4c47('0x2f')]['hasOwnProperty']('nolimit')){_0x3f34f7[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x3f5b10[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x3f34f7[_0x4c47('0x1d')]=qs[_0x4c47('0x1d')](_0x3f5b10[_0x4c47('0x2f')][_0x4c47('0x1d')]);}return _0x3461f4[_0x4c47('0x4f')](_0x3f34f7);}})[_0x4c47('0x24')](function(_0x28fed5){if(_0x28fed5){return _0x28fed5?{'count':_0x4d3bf7,'rows':_0x28fed5}:null;}})[_0x4c47('0x24')](respondWithResult(_0x39f7c9,null))[_0x4c47('0x46')](handleError(_0x39f7c9,null));}; \ No newline at end of file +var _0xc8c0=['include','findAll','rows','catch','show','params','create','body','find','destroy','findOne','SalesforceField','getFields','getSubjects','nolimit','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','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','limit','undefined','count','set','apply','reject','update','then','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0xc8c0,0x100));var _0x0c8c=function(_0x9c71e8,_0x30db09){_0x9c71e8=_0x9c71e8-0x0;var _0x5c6004=_0xc8c0[_0x9c71e8];return _0x5c6004;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c8c('0x0'));var jsonpatch=require(_0x0c8c('0x1'));var rp=require(_0x0c8c('0x2'));var moment=require(_0x0c8c('0x3'));var BPromise=require(_0x0c8c('0x4'));var Mustache=require(_0x0c8c('0x5'));var util=require('util');var path=require(_0x0c8c('0x6'));var sox=require(_0x0c8c('0x7'));var csv=require(_0x0c8c('0x8'));var ejs=require(_0x0c8c('0x9'));var fs=require('fs');var fs_extra=require(_0x0c8c('0xa'));var _=require('lodash');var squel=require(_0x0c8c('0xb'));var crypto=require(_0x0c8c('0xc'));var jsforce=require(_0x0c8c('0xd'));var deskjs=require(_0x0c8c('0xe'));var toCsv=require(_0x0c8c('0x8'));var querystring=require('querystring');var Papa=require(_0x0c8c('0xf'));var Redis=require(_0x0c8c('0x10'));var authService=require(_0x0c8c('0x11'));var qs=require(_0x0c8c('0x12'));var as=require(_0x0c8c('0x13'));var hardwareService=require(_0x0c8c('0x14'));var logger=require('../../config/logger')(_0x0c8c('0x15'));var utils=require(_0x0c8c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0c8c('0x17'));var db=require(_0x0c8c('0x18'))['db'];function respondWithStatusCode(_0x8b06b7,_0x363b92){_0x363b92=_0x363b92||0xcc;return function(_0x45608f){if(_0x45608f){return _0x8b06b7[_0x0c8c('0x19')](_0x363b92);}return _0x8b06b7[_0x0c8c('0x1a')](_0x363b92)[_0x0c8c('0x1b')]();};}function respondWithResult(_0x10fc84,_0x94f387){_0x94f387=_0x94f387||0xc8;return function(_0x18572a){if(_0x18572a){return _0x10fc84[_0x0c8c('0x1a')](_0x94f387)[_0x0c8c('0x1c')](_0x18572a);}};}function respondWithFilteredResult(_0x46eb4d,_0x3d591a){return function(_0x53179b){if(_0x53179b){var _0x262f25=typeof _0x3d591a[_0x0c8c('0x1d')]==='undefined'&&typeof _0x3d591a[_0x0c8c('0x1e')]===_0x0c8c('0x1f');var _0xac89a8=_0x53179b[_0x0c8c('0x20')];var _0x4c289a=_0x262f25?0x0:_0x3d591a[_0x0c8c('0x1d')];var _0xa98821=_0x262f25?_0x53179b[_0x0c8c('0x20')]:_0x3d591a[_0x0c8c('0x1d')]+_0x3d591a['limit'];var _0xaea9a1;if(_0xa98821>=_0xac89a8){_0xa98821=_0xac89a8;_0xaea9a1=0xc8;}else{_0xaea9a1=0xce;}_0x46eb4d[_0x0c8c('0x1a')](_0xaea9a1);return _0x46eb4d[_0x0c8c('0x21')]('Content-Range',_0x4c289a+'-'+_0xa98821+'/'+_0xac89a8)['json'](_0x53179b);}return null;};}function patchUpdates(_0x5231a2){return function(_0xcd20e5){try{jsonpatch[_0x0c8c('0x22')](_0xcd20e5,_0x5231a2,!![]);}catch(_0xf9f2a4){return BPromise[_0x0c8c('0x23')](_0xf9f2a4);}return _0xcd20e5['save']();};}function saveUpdates(_0x4f0a91,_0xd50e86){return function(_0x2429a8){if(_0x2429a8){return _0x2429a8[_0x0c8c('0x24')](_0x4f0a91)[_0x0c8c('0x25')](function(_0x5b8ccc){return _0x5b8ccc;});}return null;};}function removeEntity(_0x2bef0c,_0x2cc8de){return function(_0x230830){if(_0x230830){return _0x230830['destroy']()[_0x0c8c('0x25')](function(){_0x2bef0c[_0x0c8c('0x1a')](0xcc)[_0x0c8c('0x1b')]();});}};}function handleEntityNotFound(_0x43861a,_0xff36d6){return function(_0x129ef3){if(!_0x129ef3){_0x43861a[_0x0c8c('0x19')](0x194);}return _0x129ef3;};}function handleError(_0x223263,_0xf90c02){_0xf90c02=_0xf90c02||0x1f4;return function(_0x1cf81c){logger['error'](_0x1cf81c[_0x0c8c('0x26')]);if(_0x1cf81c[_0x0c8c('0x27')]){delete _0x1cf81c[_0x0c8c('0x27')];}_0x223263['status'](_0xf90c02)[_0x0c8c('0x28')](_0x1cf81c);};}exports['index']=function(_0x266ae5,_0x445edd){var _0x360ec9={},_0x36d3cf={},_0x5ec3a3={'count':0x0,'rows':[]};var _0x51c769=_[_0x0c8c('0x29')](db[_0x0c8c('0x2a')][_0x0c8c('0x2b')],function(_0x39a8e0){return{'name':_0x39a8e0[_0x0c8c('0x2c')],'type':_0x39a8e0[_0x0c8c('0x2d')]['key']};});_0x36d3cf[_0x0c8c('0x2e')]=_['map'](_0x51c769,'name');_0x36d3cf[_0x0c8c('0x2f')]=_[_0x0c8c('0x30')](_0x266ae5[_0x0c8c('0x2f')]);_0x36d3cf[_0x0c8c('0x31')]=_[_0x0c8c('0x32')](_0x36d3cf[_0x0c8c('0x2e')],_0x36d3cf[_0x0c8c('0x2f')]);_0x360ec9[_0x0c8c('0x33')]=_[_0x0c8c('0x32')](_0x36d3cf[_0x0c8c('0x2e')],qs[_0x0c8c('0x34')](_0x266ae5[_0x0c8c('0x2f')]['fields']));_0x360ec9[_0x0c8c('0x33')]=_0x360ec9['attributes'][_0x0c8c('0x35')]?_0x360ec9[_0x0c8c('0x33')]:_0x36d3cf[_0x0c8c('0x2e')];if(!_0x266ae5['query'][_0x0c8c('0x36')]('nolimit')){_0x360ec9[_0x0c8c('0x1e')]=qs[_0x0c8c('0x1e')](_0x266ae5[_0x0c8c('0x2f')][_0x0c8c('0x1e')]);_0x360ec9[_0x0c8c('0x1d')]=qs['offset'](_0x266ae5['query'][_0x0c8c('0x1d')]);}_0x360ec9[_0x0c8c('0x37')]=qs[_0x0c8c('0x38')](_0x266ae5[_0x0c8c('0x2f')][_0x0c8c('0x38')]);_0x360ec9[_0x0c8c('0x39')]=qs[_0x0c8c('0x31')](_[_0x0c8c('0x3a')](_0x266ae5[_0x0c8c('0x2f')],_0x36d3cf[_0x0c8c('0x31')]),_0x51c769);if(_0x266ae5[_0x0c8c('0x2f')]['filter']){_0x360ec9[_0x0c8c('0x39')]=_[_0x0c8c('0x3b')](_0x360ec9[_0x0c8c('0x39')],{'$or':_['map'](_0x51c769,function(_0x33a261){if(_0x33a261[_0x0c8c('0x2d')]!==_0x0c8c('0x3c')){var _0x5ad775={};_0x5ad775[_0x33a261[_0x0c8c('0x27')]]={'$like':'%'+_0x266ae5[_0x0c8c('0x2f')][_0x0c8c('0x3d')]+'%'};return _0x5ad775;}})});}_0x360ec9=_['merge']({},_0x360ec9,_0x266ae5[_0x0c8c('0x3e')]);var _0x266cfa={'where':_0x360ec9[_0x0c8c('0x39')]};return db[_0x0c8c('0x2a')]['count'](_0x266cfa)[_0x0c8c('0x25')](function(_0xeec002){_0x5ec3a3['count']=_0xeec002;if(_0x266ae5[_0x0c8c('0x2f')][_0x0c8c('0x3f')]){_0x360ec9[_0x0c8c('0x40')]=[{'all':!![]}];}return db[_0x0c8c('0x2a')][_0x0c8c('0x41')](_0x360ec9);})[_0x0c8c('0x25')](function(_0x2d87a1){_0x5ec3a3[_0x0c8c('0x42')]=_0x2d87a1;return _0x5ec3a3;})['then'](respondWithFilteredResult(_0x445edd,_0x360ec9))[_0x0c8c('0x43')](handleError(_0x445edd,null));};exports[_0x0c8c('0x44')]=function(_0x57cf3b,_0x3884be){var _0x3f9748={'raw':![],'where':{'id':_0x57cf3b[_0x0c8c('0x45')]['id']}},_0x23e602={};_0x23e602[_0x0c8c('0x2e')]=_[_0x0c8c('0x30')](db[_0x0c8c('0x2a')][_0x0c8c('0x2b')]);_0x23e602['query']=_[_0x0c8c('0x30')](_0x57cf3b[_0x0c8c('0x2f')]);_0x23e602[_0x0c8c('0x31')]=_['intersection'](_0x23e602[_0x0c8c('0x2e')],_0x23e602[_0x0c8c('0x2f')]);_0x3f9748[_0x0c8c('0x33')]=_[_0x0c8c('0x32')](_0x23e602[_0x0c8c('0x2e')],qs[_0x0c8c('0x34')](_0x57cf3b[_0x0c8c('0x2f')][_0x0c8c('0x34')]));_0x3f9748[_0x0c8c('0x33')]=_0x3f9748[_0x0c8c('0x33')][_0x0c8c('0x35')]?_0x3f9748['attributes']:_0x23e602[_0x0c8c('0x2e')];if(_0x57cf3b[_0x0c8c('0x2f')]['includeAll']){_0x3f9748[_0x0c8c('0x40')]=[{'all':!![]}];}_0x3f9748=_['merge']({},_0x3f9748,_0x57cf3b[_0x0c8c('0x3e')]);return db['SalesforceConfiguration']['find'](_0x3f9748)[_0x0c8c('0x25')](handleEntityNotFound(_0x3884be,null))[_0x0c8c('0x25')](respondWithResult(_0x3884be,null))[_0x0c8c('0x43')](handleError(_0x3884be,null));};exports['create']=function(_0x36353c,_0x43305b){return db[_0x0c8c('0x2a')][_0x0c8c('0x46')](_0x36353c['body'],{})[_0x0c8c('0x25')](respondWithResult(_0x43305b,0xc9))[_0x0c8c('0x43')](handleError(_0x43305b,null));};exports[_0x0c8c('0x24')]=function(_0x43df0b,_0x21bbcf){if(_0x43df0b[_0x0c8c('0x47')]['id']){delete _0x43df0b[_0x0c8c('0x47')]['id'];}return db[_0x0c8c('0x2a')][_0x0c8c('0x48')]({'where':{'id':_0x43df0b[_0x0c8c('0x45')]['id']}})[_0x0c8c('0x25')](handleEntityNotFound(_0x21bbcf,null))[_0x0c8c('0x25')](saveUpdates(_0x43df0b[_0x0c8c('0x47')],null))['then'](respondWithResult(_0x21bbcf,null))[_0x0c8c('0x43')](handleError(_0x21bbcf,null));};exports[_0x0c8c('0x49')]=function(_0x2a2553,_0x4c649a){return db['SalesforceConfiguration'][_0x0c8c('0x48')]({'where':{'id':_0x2a2553[_0x0c8c('0x45')]['id']}})[_0x0c8c('0x25')](handleEntityNotFound(_0x4c649a,null))[_0x0c8c('0x25')](removeEntity(_0x4c649a,null))['catch'](handleError(_0x4c649a,null));};exports['getFields']=function(_0x2c741e,_0x3aba4e,_0x1c4217){var _0x16c7e2={};var _0x5431be={};var _0x5ab7c0;var _0x374f80;return db[_0x0c8c('0x2a')][_0x0c8c('0x4a')]({'where':{'id':_0x2c741e['params']['id']}})[_0x0c8c('0x25')](handleEntityNotFound(_0x3aba4e,null))[_0x0c8c('0x25')](function(_0x1416c2){if(_0x1416c2){_0x5ab7c0=_0x1416c2;_0x5431be[_0x0c8c('0x2e')]=_[_0x0c8c('0x30')](db[_0x0c8c('0x4b')][_0x0c8c('0x2b')]);_0x5431be[_0x0c8c('0x2f')]=_[_0x0c8c('0x30')](_0x2c741e[_0x0c8c('0x2f')]);_0x5431be[_0x0c8c('0x31')]=_['intersection'](_0x5431be[_0x0c8c('0x2e')],_0x5431be[_0x0c8c('0x2f')]);_0x16c7e2[_0x0c8c('0x33')]=_[_0x0c8c('0x32')](_0x5431be['model'],qs[_0x0c8c('0x34')](_0x2c741e[_0x0c8c('0x2f')]['fields']));_0x16c7e2[_0x0c8c('0x33')]=_0x16c7e2[_0x0c8c('0x33')][_0x0c8c('0x35')]?_0x16c7e2['attributes']:_0x5431be[_0x0c8c('0x2e')];_0x16c7e2['order']=qs[_0x0c8c('0x38')](_0x2c741e[_0x0c8c('0x2f')]['sort']);_0x16c7e2['where']=qs[_0x0c8c('0x31')](_[_0x0c8c('0x3a')](_0x2c741e[_0x0c8c('0x2f')],_0x5431be[_0x0c8c('0x31')]));if(_0x2c741e[_0x0c8c('0x2f')]['filter']){_0x16c7e2[_0x0c8c('0x39')]=_[_0x0c8c('0x3b')](_0x16c7e2['where'],{'$or':_['map'](_0x16c7e2[_0x0c8c('0x33')],function(_0xa8f996){var _0x4edc0d={};_0x4edc0d[_0xa8f996]={'$like':'%'+_0x2c741e[_0x0c8c('0x2f')][_0x0c8c('0x3d')]+'%'};return _0x4edc0d;})});}_0x16c7e2=_[_0x0c8c('0x3b')]({},_0x16c7e2,_0x2c741e['options']);return _0x5ab7c0[_0x0c8c('0x4c')](_0x16c7e2);}})[_0x0c8c('0x25')](function(_0x4976fb){if(_0x4976fb){_0x374f80=_0x4976fb['length'];if(!_0x2c741e[_0x0c8c('0x2f')]['hasOwnProperty']('nolimit')){_0x16c7e2[_0x0c8c('0x1e')]=qs[_0x0c8c('0x1e')](_0x2c741e[_0x0c8c('0x2f')]['limit']);_0x16c7e2['offset']=qs['offset'](_0x2c741e[_0x0c8c('0x2f')][_0x0c8c('0x1d')]);}return _0x5ab7c0[_0x0c8c('0x4c')](_0x16c7e2);}})[_0x0c8c('0x25')](function(_0x41dc7d){if(_0x41dc7d){return _0x41dc7d?{'count':_0x374f80,'rows':_0x41dc7d}:null;}})[_0x0c8c('0x25')](respondWithResult(_0x3aba4e,null))['catch'](handleError(_0x3aba4e,null));};exports[_0x0c8c('0x4d')]=function(_0x196073,_0x32ae81,_0x42882f){var _0x2609a4={};var _0x5a764b={};var _0x163bd2;var _0x3838a7;return db['SalesforceConfiguration'][_0x0c8c('0x4a')]({'where':{'id':_0x196073[_0x0c8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x32ae81,null))[_0x0c8c('0x25')](function(_0x585acd){if(_0x585acd){_0x163bd2=_0x585acd;_0x5a764b[_0x0c8c('0x2e')]=_['keys'](db[_0x0c8c('0x4b')][_0x0c8c('0x2b')]);_0x5a764b[_0x0c8c('0x2f')]=_[_0x0c8c('0x30')](_0x196073[_0x0c8c('0x2f')]);_0x5a764b['filters']=_[_0x0c8c('0x32')](_0x5a764b['model'],_0x5a764b[_0x0c8c('0x2f')]);_0x2609a4[_0x0c8c('0x33')]=_[_0x0c8c('0x32')](_0x5a764b[_0x0c8c('0x2e')],qs[_0x0c8c('0x34')](_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x34')]));_0x2609a4[_0x0c8c('0x33')]=_0x2609a4[_0x0c8c('0x33')][_0x0c8c('0x35')]?_0x2609a4[_0x0c8c('0x33')]:_0x5a764b[_0x0c8c('0x2e')];_0x2609a4[_0x0c8c('0x37')]=qs[_0x0c8c('0x38')](_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x38')]);_0x2609a4[_0x0c8c('0x39')]=qs[_0x0c8c('0x31')](_['pick'](_0x196073['query'],_0x5a764b[_0x0c8c('0x31')]));if(_0x196073[_0x0c8c('0x2f')]['filter']){_0x2609a4[_0x0c8c('0x39')]=_['merge'](_0x2609a4['where'],{'$or':_[_0x0c8c('0x29')](_0x2609a4['attributes'],function(_0x41bf2a){var _0x2cd55d={};_0x2cd55d[_0x41bf2a]={'$like':'%'+_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x3d')]+'%'};return _0x2cd55d;})});}_0x2609a4=_['merge']({},_0x2609a4,_0x196073[_0x0c8c('0x3e')]);return _0x163bd2[_0x0c8c('0x4d')](_0x2609a4);}})[_0x0c8c('0x25')](function(_0x50eea5){if(_0x50eea5){_0x3838a7=_0x50eea5['length'];if(!_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x36')](_0x0c8c('0x4e'))){_0x2609a4[_0x0c8c('0x1e')]=qs[_0x0c8c('0x1e')](_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x1e')]);_0x2609a4[_0x0c8c('0x1d')]=qs[_0x0c8c('0x1d')](_0x196073[_0x0c8c('0x2f')][_0x0c8c('0x1d')]);}return _0x163bd2[_0x0c8c('0x4d')](_0x2609a4);}})[_0x0c8c('0x25')](function(_0x26422a){if(_0x26422a){return _0x26422a?{'count':_0x3838a7,'rows':_0x26422a}:null;}})[_0x0c8c('0x25')](respondWithResult(_0x32ae81,null))[_0x0c8c('0x43')](handleError(_0x32ae81,null));};exports[_0x0c8c('0x4f')]=function(_0x2fcd70,_0x904fb9,_0x4560d3){var _0x448583={};var _0x507980={};var _0x11467e;var _0x2ea2b6;return db[_0x0c8c('0x2a')][_0x0c8c('0x4a')]({'where':{'id':_0x2fcd70[_0x0c8c('0x45')]['id']}})[_0x0c8c('0x25')](handleEntityNotFound(_0x904fb9,null))['then'](function(_0x231a41){if(_0x231a41){_0x11467e=_0x231a41;_0x507980[_0x0c8c('0x2e')]=_[_0x0c8c('0x30')](db['SalesforceField'][_0x0c8c('0x2b')]);_0x507980[_0x0c8c('0x2f')]=_['keys'](_0x2fcd70['query']);_0x507980[_0x0c8c('0x31')]=_[_0x0c8c('0x32')](_0x507980[_0x0c8c('0x2e')],_0x507980[_0x0c8c('0x2f')]);_0x448583[_0x0c8c('0x33')]=_[_0x0c8c('0x32')](_0x507980['model'],qs[_0x0c8c('0x34')](_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x34')]));_0x448583[_0x0c8c('0x33')]=_0x448583[_0x0c8c('0x33')][_0x0c8c('0x35')]?_0x448583[_0x0c8c('0x33')]:_0x507980[_0x0c8c('0x2e')];_0x448583[_0x0c8c('0x37')]=qs[_0x0c8c('0x38')](_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x38')]);_0x448583[_0x0c8c('0x39')]=qs[_0x0c8c('0x31')](_[_0x0c8c('0x3a')](_0x2fcd70[_0x0c8c('0x2f')],_0x507980[_0x0c8c('0x31')]));if(_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x3d')]){_0x448583[_0x0c8c('0x39')]=_[_0x0c8c('0x3b')](_0x448583[_0x0c8c('0x39')],{'$or':_[_0x0c8c('0x29')](_0x448583[_0x0c8c('0x33')],function(_0x5bf1f3){var _0x4e1b2d={};_0x4e1b2d[_0x5bf1f3]={'$like':'%'+_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x3d')]+'%'};return _0x4e1b2d;})});}_0x448583=_['merge']({},_0x448583,_0x2fcd70[_0x0c8c('0x3e')]);return _0x11467e[_0x0c8c('0x4f')](_0x448583);}})['then'](function(_0x3dfe00){if(_0x3dfe00){_0x2ea2b6=_0x3dfe00[_0x0c8c('0x35')];if(!_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x36')](_0x0c8c('0x4e'))){_0x448583[_0x0c8c('0x1e')]=qs[_0x0c8c('0x1e')](_0x2fcd70['query']['limit']);_0x448583['offset']=qs[_0x0c8c('0x1d')](_0x2fcd70[_0x0c8c('0x2f')][_0x0c8c('0x1d')]);}return _0x11467e['getDescriptions'](_0x448583);}})[_0x0c8c('0x25')](function(_0xf84a37){if(_0xf84a37){return _0xf84a37?{'count':_0x2ea2b6,'rows':_0xf84a37}:null;}})[_0x0c8c('0x25')](respondWithResult(_0x904fb9,null))[_0x0c8c('0x43')](handleError(_0x904fb9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9fa2f51..6a19bdd 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 _0xb018=['moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0xb018,0x1dd));var _0x8b01=function(_0x8c515f,_0x51b744){_0x8c515f=_0x8c515f-0x0;var _0x1c8b2f=_0xb018[_0x8c515f];return _0x1c8b2f;};'use strict';var _=require(_0x8b01('0x0'));var util=require('util');var logger=require(_0x8b01('0x1'))(_0x8b01('0x2'));var moment=require(_0x8b01('0x3'));var BPromise=require(_0x8b01('0x4'));var rp=require(_0x8b01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b01('0x6'));var attributes=require(_0x8b01('0x7'));module[_0x8b01('0x8')]=function(_0x58328e,_0x18c7ca){return _0x58328e[_0x8b01('0x9')](_0x8b01('0xa'),attributes,{'tableName':_0x8b01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x347b=['exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x13ec89,_0x1cc1ba){var _0x969623=function(_0x1451eb){while(--_0x1451eb){_0x13ec89['push'](_0x13ec89['shift']());}};_0x969623(++_0x1cc1ba);}(_0x347b,0x9f));var _0xb347=function(_0x529a72,_0x3a841b){_0x529a72=_0x529a72-0x0;var _0x5f0d01=_0x347b[_0x529a72];return _0x5f0d01;};'use strict';var _=require(_0xb347('0x0'));var util=require(_0xb347('0x1'));var logger=require(_0xb347('0x2'))(_0xb347('0x3'));var moment=require('moment');var BPromise=require(_0xb347('0x4'));var rp=require(_0xb347('0x5'));var fs=require('fs');var path=require(_0xb347('0x6'));var rimraf=require(_0xb347('0x7'));var config=require(_0xb347('0x8'));var attributes=require(_0xb347('0x9'));module[_0xb347('0xa')]=function(_0x2938fa,_0xd9cbf6){return _0x2938fa[_0xb347('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0xb347('0xc'),'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 abb563d..e80c07a 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 _0xbfd0=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3c0689,_0x59a1a3){var _0x441a65=function(_0x5d0245){while(--_0x5d0245){_0x3c0689['push'](_0x3c0689['shift']());}};_0x441a65(++_0x59a1a3);}(_0xbfd0,0x1ef));var _0x0bfd=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbfd0[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x0bfd('0x0'));var util=require(_0x0bfd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0bfd('0x2'));var fs=require('fs');var Redis=require(_0x0bfd('0x3'));var db=require(_0x0bfd('0x4'))['db'];var utils=require(_0x0bfd('0x5'));var logger=require('../../config/logger')(_0x0bfd('0x6'));var config=require(_0x0bfd('0x7'));var jayson=require(_0x0bfd('0x8'));var client=jayson[_0x0bfd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ac4c,_0x1a0d6b,_0x267a94){return new BPromise(function(_0x2fd08d,_0x1e8cf3){return client[_0x0bfd('0xa')](_0x29ac4c,_0x267a94)[_0x0bfd('0xb')](function(_0x275004){logger[_0x0bfd('0xc')](_0x0bfd('0xd'),_0x1a0d6b,_0x0bfd('0xe'));logger[_0x0bfd('0xf')](_0x0bfd('0x10'),_0x1a0d6b,_0x0bfd('0xe'),JSON[_0x0bfd('0x11')](_0x275004));if(_0x275004[_0x0bfd('0x12')]){if(_0x275004['error'][_0x0bfd('0x13')]===0x1f4){logger['error'](_0x0bfd('0xd'),_0x1a0d6b,_0x275004[_0x0bfd('0x12')]['message']);return _0x1e8cf3(_0x275004[_0x0bfd('0x12')][_0x0bfd('0x14')]);}logger[_0x0bfd('0x12')](_0x0bfd('0xd'),_0x1a0d6b,_0x275004[_0x0bfd('0x12')][_0x0bfd('0x14')]);return _0x2fd08d(_0x275004[_0x0bfd('0x12')][_0x0bfd('0x14')]);}else{logger[_0x0bfd('0xc')](_0x0bfd('0xd'),_0x1a0d6b,'request\x20sent');_0x2fd08d(_0x275004[_0x0bfd('0x15')]['message']);}})['catch'](function(_0x1ebb81){logger['error'](_0x0bfd('0xd'),_0x1a0d6b,_0x1ebb81);_0x1e8cf3(_0x1ebb81);});});} \ No newline at end of file +var _0xa3cd=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5c14d0,_0x545572){var _0x24fef4=function(_0x220c94){while(--_0x220c94){_0x5c14d0['push'](_0x5c14d0['shift']());}};_0x24fef4(++_0x545572);}(_0xa3cd,0x1ce));var _0xda3c=function(_0x4b8f7b,_0x1c757b){_0x4b8f7b=_0x4b8f7b-0x0;var _0x4439fd=_0xa3cd[_0x4b8f7b];return _0x4439fd;};'use strict';var _=require(_0xda3c('0x0'));var util=require('util');var moment=require(_0xda3c('0x1'));var BPromise=require(_0xda3c('0x2'));var rs=require(_0xda3c('0x3'));var fs=require('fs');var Redis=require(_0xda3c('0x4'));var db=require(_0xda3c('0x5'))['db'];var utils=require(_0xda3c('0x6'));var logger=require(_0xda3c('0x7'))(_0xda3c('0x8'));var config=require(_0xda3c('0x9'));var jayson=require(_0xda3c('0xa'));var client=jayson[_0xda3c('0xb')][_0xda3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x480a52,_0x1d989a,_0x363bb){return new BPromise(function(_0x66407b,_0x1ee41e){return client[_0xda3c('0xd')](_0x480a52,_0x363bb)[_0xda3c('0xe')](function(_0x509eee){logger[_0xda3c('0xf')](_0xda3c('0x10'),_0x1d989a,_0xda3c('0x11'));logger[_0xda3c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1d989a,'request\x20sent',JSON[_0xda3c('0x13')](_0x509eee));if(_0x509eee[_0xda3c('0x14')]){if(_0x509eee['error']['code']===0x1f4){logger[_0xda3c('0x14')](_0xda3c('0x10'),_0x1d989a,_0x509eee[_0xda3c('0x14')][_0xda3c('0x15')]);return _0x1ee41e(_0x509eee[_0xda3c('0x14')][_0xda3c('0x15')]);}logger['error'](_0xda3c('0x10'),_0x1d989a,_0x509eee[_0xda3c('0x14')]['message']);return _0x66407b(_0x509eee[_0xda3c('0x14')][_0xda3c('0x15')]);}else{logger[_0xda3c('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1d989a,_0xda3c('0x11'));_0x66407b(_0x509eee[_0xda3c('0x16')]['message']);}})['catch'](function(_0x1198cd){logger[_0xda3c('0x14')](_0xda3c('0x10'),_0x1d989a,_0x1198cd);_0x1ee41e(_0x1198cd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 24adca3..b24a08a 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 _0xfada=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4f9f78,_0x14c6a3){var _0x328fb7=function(_0xa4ec1d){while(--_0xa4ec1d){_0x4f9f78['push'](_0x4f9f78['shift']());}};_0x328fb7(++_0x14c6a3);}(_0xfada,0x119));var _0xafad=function(_0x4fadfa,_0x15796d){_0x4fadfa=_0x4fadfa-0x0;var _0x2dc4f7=_0xfada[_0x4fadfa];return _0x2dc4f7;};'use strict';var multer=require(_0xafad('0x0'));var util=require(_0xafad('0x1'));var path=require(_0xafad('0x2'));var timeout=require('connect-timeout');var express=require(_0xafad('0x3'));var router=express[_0xafad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafad('0x5'));var interaction=require(_0xafad('0x6'));var config=require(_0xafad('0x7'));var controller=require(_0xafad('0x8'));router[_0xafad('0x9')]('/',auth[_0xafad('0xa')](),controller['index']);router[_0xafad('0x9')]('/:id',auth[_0xafad('0xa')](),controller[_0xafad('0xb')]);router['post']('/',auth[_0xafad('0xa')](),controller['create']);router[_0xafad('0xc')]('/:id',auth[_0xafad('0xa')](),controller[_0xafad('0xd')]);router[_0xafad('0xe')](_0xafad('0xf'),auth[_0xafad('0xa')](),controller[_0xafad('0x10')]);module[_0xafad('0x11')]=router; \ No newline at end of file +var _0x0d1a=['delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x446a96,_0x4330bd){var _0x4aa4e1=function(_0x49326c){while(--_0x49326c){_0x446a96['push'](_0x446a96['shift']());}};_0x4aa4e1(++_0x4330bd);}(_0x0d1a,0x1b3));var _0xa0d1=function(_0x5c40bc,_0x2a121f){_0x5c40bc=_0x5c40bc-0x0;var _0x3b73d5=_0x0d1a[_0x5c40bc];return _0x3b73d5;};'use strict';var multer=require(_0xa0d1('0x0'));var util=require(_0xa0d1('0x1'));var path=require('path');var timeout=require(_0xa0d1('0x2'));var express=require(_0xa0d1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0d1('0x4'));var controller=require('./intSalesforceField.controller');router[_0xa0d1('0x5')]('/',auth[_0xa0d1('0x6')](),controller[_0xa0d1('0x7')]);router[_0xa0d1('0x5')](_0xa0d1('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xa0d1('0x9')]('/',auth[_0xa0d1('0x6')](),controller[_0xa0d1('0xa')]);router[_0xa0d1('0xb')]('/:id',auth[_0xa0d1('0x6')](),controller[_0xa0d1('0xc')]);router[_0xa0d1('0xd')]('/:id',auth[_0xa0d1('0x6')](),controller[_0xa0d1('0xe')]);module[_0xa0d1('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c638b51..6b283ad 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 _0xb041=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0xbf2c8f,_0x5623ae){var _0x47a45a=function(_0x231b63){while(--_0x231b63){_0xbf2c8f['push'](_0xbf2c8f['shift']());}};_0x47a45a(++_0x5623ae);}(_0xb041,0x1e5));var _0x1b04=function(_0x401bdc,_0x34b20e){_0x401bdc=_0x401bdc-0x0;var _0x31c9c5=_0xb041[_0x401bdc];return _0x31c9c5;};'use strict';var Sequelize=require(_0x1b04('0x0'));module[_0x1b04('0x1')]={'type':{'type':Sequelize[_0x1b04('0x2')](_0x1b04('0x3'),_0x1b04('0x4'),_0x1b04('0x5'),'keyValue',_0x1b04('0x6')),'defaultValue':_0x1b04('0x3')},'content':{'type':Sequelize[_0x1b04('0x7')]},'key':{'type':Sequelize[_0x1b04('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x1b04('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1b04('0x7')]},'variableName':{'type':Sequelize[_0x1b04('0x7')]}}; \ No newline at end of file +var _0xf000=['string','variable','STRING','sequelize','ENUM','customVariable','keyValue','picklist'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xf000,0x1a3));var _0x0f00=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xf000[_0x258fb0];return _0x4d1afe;};'use strict';var Sequelize=require(_0x0f00('0x0'));module['exports']={'type':{'type':Sequelize[_0x0f00('0x1')]('string','variable',_0x0f00('0x2'),_0x0f00('0x3'),_0x0f00('0x4')),'defaultValue':_0x0f00('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f00('0x1')](_0x0f00('0x5'),_0x0f00('0x6'),_0x0f00('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0f00('0x7')]},'variableName':{'type':Sequelize[_0x0f00('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 183868a..e73ce55 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 _0x8b7a=['index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','options','rows','params','length','includeAll','include','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','stack','name','send'];(function(_0x14f55f,_0x353846){var _0x3ca2a7=function(_0x3069f4){while(--_0x3069f4){_0x14f55f['push'](_0x14f55f['shift']());}};_0x3ca2a7(++_0x353846);}(_0x8b7a,0x177));var _0xa8b7=function(_0x4c002d,_0x5a07d1){_0x4c002d=_0x4c002d-0x0;var _0x7af2f0=_0x8b7a[_0x4c002d];return _0x7af2f0;};'use strict';var emlformat=require(_0xa8b7('0x0'));var rimraf=require(_0xa8b7('0x1'));var zipdir=require(_0xa8b7('0x2'));var jsonpatch=require(_0xa8b7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa8b7('0x4'));var util=require('util');var path=require(_0xa8b7('0x5'));var sox=require(_0xa8b7('0x6'));var csv=require(_0xa8b7('0x7'));var ejs=require(_0xa8b7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa8b7('0x9'));var squel=require('squel');var crypto=require(_0xa8b7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa8b7('0x7'));var querystring=require(_0xa8b7('0xb'));var Papa=require(_0xa8b7('0xc'));var Redis=require(_0xa8b7('0xd'));var authService=require(_0xa8b7('0xe'));var qs=require(_0xa8b7('0xf'));var as=require(_0xa8b7('0x10'));var hardwareService=require(_0xa8b7('0x11'));var logger=require(_0xa8b7('0x12'))(_0xa8b7('0x13'));var utils=require(_0xa8b7('0x14'));var config=require(_0xa8b7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff6e76,_0x1a0f1c){_0x1a0f1c=_0x1a0f1c||0xcc;return function(_0x384d9a){if(_0x384d9a){return _0xff6e76[_0xa8b7('0x16')](_0x1a0f1c);}return _0xff6e76[_0xa8b7('0x17')](_0x1a0f1c)[_0xa8b7('0x18')]();};}function respondWithResult(_0x36bfaa,_0x1291e0){_0x1291e0=_0x1291e0||0xc8;return function(_0x3ec840){if(_0x3ec840){return _0x36bfaa[_0xa8b7('0x17')](_0x1291e0)[_0xa8b7('0x19')](_0x3ec840);}};}function respondWithFilteredResult(_0x62b829,_0x59fdde){return function(_0x539d54){if(_0x539d54){var _0x560fec=typeof _0x59fdde[_0xa8b7('0x1a')]==='undefined'&&typeof _0x59fdde[_0xa8b7('0x1b')]===_0xa8b7('0x1c');var _0x67ec8=_0x539d54['count'];var _0x14fc7c=_0x560fec?0x0:_0x59fdde[_0xa8b7('0x1a')];var _0x14119b=_0x560fec?_0x539d54[_0xa8b7('0x1d')]:_0x59fdde[_0xa8b7('0x1a')]+_0x59fdde[_0xa8b7('0x1b')];var _0x12886b;if(_0x14119b>=_0x67ec8){_0x14119b=_0x67ec8;_0x12886b=0xc8;}else{_0x12886b=0xce;}_0x62b829[_0xa8b7('0x17')](_0x12886b);return _0x62b829[_0xa8b7('0x1e')](_0xa8b7('0x1f'),_0x14fc7c+'-'+_0x14119b+'/'+_0x67ec8)[_0xa8b7('0x19')](_0x539d54);}return null;};}function patchUpdates(_0x3be074){return function(_0x9d8880){try{jsonpatch['apply'](_0x9d8880,_0x3be074,!![]);}catch(_0x42b2c1){return BPromise[_0xa8b7('0x20')](_0x42b2c1);}return _0x9d8880['save']();};}function saveUpdates(_0x1f7c4d,_0x25398a){return function(_0x5b9a3f){if(_0x5b9a3f){return _0x5b9a3f[_0xa8b7('0x21')](_0x1f7c4d)['then'](function(_0x2f91e9){return _0x2f91e9;});}return null;};}function removeEntity(_0x9a09b3,_0x26403d){return function(_0x2ee07d){if(_0x2ee07d){return _0x2ee07d[_0xa8b7('0x22')]()[_0xa8b7('0x23')](function(){_0x9a09b3['status'](0xcc)[_0xa8b7('0x18')]();});}};}function handleEntityNotFound(_0x2ac253,_0x8dea73){return function(_0x20769d){if(!_0x20769d){_0x2ac253[_0xa8b7('0x16')](0x194);}return _0x20769d;};}function handleError(_0x2fe9e5,_0x45b808){_0x45b808=_0x45b808||0x1f4;return function(_0x33958e){logger['error'](_0x33958e[_0xa8b7('0x24')]);if(_0x33958e[_0xa8b7('0x25')]){delete _0x33958e[_0xa8b7('0x25')];}_0x2fe9e5[_0xa8b7('0x17')](_0x45b808)[_0xa8b7('0x26')](_0x33958e);};}exports[_0xa8b7('0x27')]=function(_0x4dd42e,_0x4d5bc9){var _0x5258c5={},_0x5c1d65={},_0x36843e={'count':0x0,'rows':[]};var _0x29705d=_[_0xa8b7('0x28')](db[_0xa8b7('0x29')][_0xa8b7('0x2a')],function(_0x5d974b){return{'name':_0x5d974b[_0xa8b7('0x2b')],'type':_0x5d974b[_0xa8b7('0x2c')][_0xa8b7('0x2d')]};});_0x5c1d65[_0xa8b7('0x2e')]=_['map'](_0x29705d,_0xa8b7('0x25'));_0x5c1d65[_0xa8b7('0x2f')]=_[_0xa8b7('0x30')](_0x4dd42e[_0xa8b7('0x2f')]);_0x5c1d65[_0xa8b7('0x31')]=_[_0xa8b7('0x32')](_0x5c1d65['model'],_0x5c1d65[_0xa8b7('0x2f')]);_0x5258c5[_0xa8b7('0x33')]=_[_0xa8b7('0x32')](_0x5c1d65[_0xa8b7('0x2e')],qs[_0xa8b7('0x34')](_0x4dd42e[_0xa8b7('0x2f')][_0xa8b7('0x34')]));_0x5258c5[_0xa8b7('0x33')]=_0x5258c5['attributes']['length']?_0x5258c5[_0xa8b7('0x33')]:_0x5c1d65[_0xa8b7('0x2e')];if(!_0x4dd42e['query']['hasOwnProperty'](_0xa8b7('0x35'))){_0x5258c5['limit']=qs[_0xa8b7('0x1b')](_0x4dd42e[_0xa8b7('0x2f')][_0xa8b7('0x1b')]);_0x5258c5[_0xa8b7('0x1a')]=qs['offset'](_0x4dd42e['query'][_0xa8b7('0x1a')]);}_0x5258c5['order']=qs[_0xa8b7('0x36')](_0x4dd42e['query'][_0xa8b7('0x36')]);_0x5258c5[_0xa8b7('0x37')]=qs[_0xa8b7('0x31')](_[_0xa8b7('0x38')](_0x4dd42e[_0xa8b7('0x2f')],_0x5c1d65[_0xa8b7('0x31')]),_0x29705d);if(_0x4dd42e[_0xa8b7('0x2f')]['filter']){_0x5258c5[_0xa8b7('0x37')]=_[_0xa8b7('0x39')](_0x5258c5[_0xa8b7('0x37')],{'$or':_[_0xa8b7('0x28')](_0x29705d,function(_0x5e355f){if(_0x5e355f['type']!==_0xa8b7('0x3a')){var _0x584b43={};_0x584b43[_0x5e355f[_0xa8b7('0x25')]]={'$like':'%'+_0x4dd42e[_0xa8b7('0x2f')]['filter']+'%'};return _0x584b43;}})});}_0x5258c5=_[_0xa8b7('0x39')]({},_0x5258c5,_0x4dd42e[_0xa8b7('0x3b')]);var _0x2aa5a0={'where':_0x5258c5[_0xa8b7('0x37')]};return db['SalesforceField']['count'](_0x2aa5a0)['then'](function(_0x196638){_0x36843e['count']=_0x196638;if(_0x4dd42e[_0xa8b7('0x2f')]['includeAll']){_0x5258c5['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x5258c5);})[_0xa8b7('0x23')](function(_0x4c020d){_0x36843e[_0xa8b7('0x3c')]=_0x4c020d;return _0x36843e;})[_0xa8b7('0x23')](respondWithFilteredResult(_0x4d5bc9,_0x5258c5))['catch'](handleError(_0x4d5bc9,null));};exports['show']=function(_0x99fd16,_0x48ceec){var _0x1c2493={'raw':!![],'where':{'id':_0x99fd16[_0xa8b7('0x3d')]['id']}},_0xc61101={};_0xc61101[_0xa8b7('0x2e')]=_['keys'](db[_0xa8b7('0x29')][_0xa8b7('0x2a')]);_0xc61101[_0xa8b7('0x2f')]=_[_0xa8b7('0x30')](_0x99fd16[_0xa8b7('0x2f')]);_0xc61101[_0xa8b7('0x31')]=_[_0xa8b7('0x32')](_0xc61101[_0xa8b7('0x2e')],_0xc61101['query']);_0x1c2493[_0xa8b7('0x33')]=_['intersection'](_0xc61101[_0xa8b7('0x2e')],qs['fields'](_0x99fd16[_0xa8b7('0x2f')][_0xa8b7('0x34')]));_0x1c2493[_0xa8b7('0x33')]=_0x1c2493[_0xa8b7('0x33')][_0xa8b7('0x3e')]?_0x1c2493[_0xa8b7('0x33')]:_0xc61101[_0xa8b7('0x2e')];if(_0x99fd16[_0xa8b7('0x2f')][_0xa8b7('0x3f')]){_0x1c2493[_0xa8b7('0x40')]=[{'all':!![]}];}_0x1c2493=_[_0xa8b7('0x39')]({},_0x1c2493,_0x99fd16[_0xa8b7('0x3b')]);return db[_0xa8b7('0x29')][_0xa8b7('0x41')](_0x1c2493)[_0xa8b7('0x23')](handleEntityNotFound(_0x48ceec,null))[_0xa8b7('0x23')](respondWithResult(_0x48ceec,null))['catch'](handleError(_0x48ceec,null));};exports[_0xa8b7('0x42')]=function(_0x520314,_0x362306){return db['SalesforceField'][_0xa8b7('0x42')](_0x520314[_0xa8b7('0x43')],{})['then'](respondWithResult(_0x362306,0xc9))[_0xa8b7('0x44')](handleError(_0x362306,null));};exports[_0xa8b7('0x21')]=function(_0x2cff45,_0x4bea9a){if(_0x2cff45['body']['id']){delete _0x2cff45['body']['id'];}return db[_0xa8b7('0x29')][_0xa8b7('0x41')]({'where':{'id':_0x2cff45[_0xa8b7('0x3d')]['id']}})[_0xa8b7('0x23')](handleEntityNotFound(_0x4bea9a,null))[_0xa8b7('0x23')](saveUpdates(_0x2cff45[_0xa8b7('0x43')],null))[_0xa8b7('0x23')](respondWithResult(_0x4bea9a,null))[_0xa8b7('0x44')](handleError(_0x4bea9a,null));};exports[_0xa8b7('0x22')]=function(_0x137d40,_0x8c2708){return db['SalesforceField'][_0xa8b7('0x41')]({'where':{'id':_0x137d40['params']['id']}})[_0xa8b7('0x23')](handleEntityNotFound(_0x8c2708,null))['then'](removeEntity(_0x8c2708,null))[_0xa8b7('0x44')](handleError(_0x8c2708,null));}; \ No newline at end of file +var _0x16db=['nolimit','sort','merge','options','then','include','findAll','rows','catch','params','length','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x16db,0x126));var _0xb16d=function(_0x33deaf,_0x5c43b5){_0x33deaf=_0x33deaf-0x0;var _0x3f1076=_0x16db[_0x33deaf];return _0x3f1076;};'use strict';var emlformat=require(_0xb16d('0x0'));var rimraf=require(_0xb16d('0x1'));var zipdir=require(_0xb16d('0x2'));var jsonpatch=require(_0xb16d('0x3'));var rp=require(_0xb16d('0x4'));var moment=require(_0xb16d('0x5'));var BPromise=require(_0xb16d('0x6'));var Mustache=require(_0xb16d('0x7'));var util=require(_0xb16d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb16d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb16d('0xa'));var _=require(_0xb16d('0xb'));var squel=require('squel');var crypto=require(_0xb16d('0xc'));var jsforce=require(_0xb16d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb16d('0x9'));var querystring=require(_0xb16d('0xe'));var Papa=require(_0xb16d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb16d('0x10'));var as=require(_0xb16d('0x11'));var hardwareService=require(_0xb16d('0x12'));var logger=require(_0xb16d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb16d('0x14'));var licenseUtil=require(_0xb16d('0x15'));var db=require(_0xb16d('0x16'))['db'];function respondWithStatusCode(_0x53d078,_0x16e418){_0x16e418=_0x16e418||0xcc;return function(_0x513cd3){if(_0x513cd3){return _0x53d078[_0xb16d('0x17')](_0x16e418);}return _0x53d078[_0xb16d('0x18')](_0x16e418)[_0xb16d('0x19')]();};}function respondWithResult(_0x4be0a9,_0x50a28d){_0x50a28d=_0x50a28d||0xc8;return function(_0x237597){if(_0x237597){return _0x4be0a9[_0xb16d('0x18')](_0x50a28d)[_0xb16d('0x1a')](_0x237597);}};}function respondWithFilteredResult(_0x538c31,_0x16315){return function(_0x399fc1){if(_0x399fc1){var _0x2b787d=typeof _0x16315[_0xb16d('0x1b')]===_0xb16d('0x1c')&&typeof _0x16315[_0xb16d('0x1d')]===_0xb16d('0x1c');var _0x681657=_0x399fc1[_0xb16d('0x1e')];var _0x5963f5=_0x2b787d?0x0:_0x16315[_0xb16d('0x1b')];var _0xe39d6f=_0x2b787d?_0x399fc1[_0xb16d('0x1e')]:_0x16315[_0xb16d('0x1b')]+_0x16315[_0xb16d('0x1d')];var _0x2561f6;if(_0xe39d6f>=_0x681657){_0xe39d6f=_0x681657;_0x2561f6=0xc8;}else{_0x2561f6=0xce;}_0x538c31[_0xb16d('0x18')](_0x2561f6);return _0x538c31[_0xb16d('0x1f')](_0xb16d('0x20'),_0x5963f5+'-'+_0xe39d6f+'/'+_0x681657)[_0xb16d('0x1a')](_0x399fc1);}return null;};}function patchUpdates(_0x1ccb1b){return function(_0x3cc9f8){try{jsonpatch[_0xb16d('0x21')](_0x3cc9f8,_0x1ccb1b,!![]);}catch(_0x39ce98){return BPromise[_0xb16d('0x22')](_0x39ce98);}return _0x3cc9f8[_0xb16d('0x23')]();};}function saveUpdates(_0x41533b,_0x5d5894){return function(_0x5d60c9){if(_0x5d60c9){return _0x5d60c9[_0xb16d('0x24')](_0x41533b)['then'](function(_0x2b731f){return _0x2b731f;});}return null;};}function removeEntity(_0x5e2fb1,_0x26402e){return function(_0x7bf03c){if(_0x7bf03c){return _0x7bf03c['destroy']()['then'](function(){_0x5e2fb1[_0xb16d('0x18')](0xcc)[_0xb16d('0x19')]();});}};}function handleEntityNotFound(_0xef8da3,_0x3e82ce){return function(_0x56c3b7){if(!_0x56c3b7){_0xef8da3[_0xb16d('0x17')](0x194);}return _0x56c3b7;};}function handleError(_0x1a74d0,_0x37bb0b){_0x37bb0b=_0x37bb0b||0x1f4;return function(_0x492f10){logger[_0xb16d('0x25')](_0x492f10[_0xb16d('0x26')]);if(_0x492f10[_0xb16d('0x27')]){delete _0x492f10[_0xb16d('0x27')];}_0x1a74d0[_0xb16d('0x18')](_0x37bb0b)[_0xb16d('0x28')](_0x492f10);};}exports[_0xb16d('0x29')]=function(_0x2c6779,_0xba8283){var _0x92dd8={},_0x5f3629={},_0x11e26b={'count':0x0,'rows':[]};var _0x1bf9d6=_[_0xb16d('0x2a')](db[_0xb16d('0x2b')][_0xb16d('0x2c')],function(_0x116cab){return{'name':_0x116cab[_0xb16d('0x2d')],'type':_0x116cab[_0xb16d('0x2e')][_0xb16d('0x2f')]};});_0x5f3629[_0xb16d('0x30')]=_[_0xb16d('0x2a')](_0x1bf9d6,_0xb16d('0x27'));_0x5f3629['query']=_[_0xb16d('0x31')](_0x2c6779['query']);_0x5f3629[_0xb16d('0x32')]=_[_0xb16d('0x33')](_0x5f3629[_0xb16d('0x30')],_0x5f3629['query']);_0x92dd8[_0xb16d('0x34')]=_[_0xb16d('0x33')](_0x5f3629[_0xb16d('0x30')],qs[_0xb16d('0x35')](_0x2c6779[_0xb16d('0x36')][_0xb16d('0x35')]));_0x92dd8[_0xb16d('0x34')]=_0x92dd8[_0xb16d('0x34')]['length']?_0x92dd8['attributes']:_0x5f3629['model'];if(!_0x2c6779[_0xb16d('0x36')][_0xb16d('0x37')](_0xb16d('0x38'))){_0x92dd8[_0xb16d('0x1d')]=qs[_0xb16d('0x1d')](_0x2c6779[_0xb16d('0x36')][_0xb16d('0x1d')]);_0x92dd8[_0xb16d('0x1b')]=qs[_0xb16d('0x1b')](_0x2c6779[_0xb16d('0x36')][_0xb16d('0x1b')]);}_0x92dd8['order']=qs['sort'](_0x2c6779[_0xb16d('0x36')][_0xb16d('0x39')]);_0x92dd8['where']=qs[_0xb16d('0x32')](_['pick'](_0x2c6779[_0xb16d('0x36')],_0x5f3629[_0xb16d('0x32')]),_0x1bf9d6);if(_0x2c6779[_0xb16d('0x36')]['filter']){_0x92dd8['where']=_[_0xb16d('0x3a')](_0x92dd8['where'],{'$or':_[_0xb16d('0x2a')](_0x1bf9d6,function(_0x430578){if(_0x430578[_0xb16d('0x2e')]!=='VIRTUAL'){var _0xf5f9e3={};_0xf5f9e3[_0x430578[_0xb16d('0x27')]]={'$like':'%'+_0x2c6779[_0xb16d('0x36')]['filter']+'%'};return _0xf5f9e3;}})});}_0x92dd8=_[_0xb16d('0x3a')]({},_0x92dd8,_0x2c6779[_0xb16d('0x3b')]);var _0x1ec175={'where':_0x92dd8['where']};return db[_0xb16d('0x2b')][_0xb16d('0x1e')](_0x1ec175)[_0xb16d('0x3c')](function(_0xa0593a){_0x11e26b[_0xb16d('0x1e')]=_0xa0593a;if(_0x2c6779[_0xb16d('0x36')]['includeAll']){_0x92dd8[_0xb16d('0x3d')]=[{'all':!![]}];}return db[_0xb16d('0x2b')][_0xb16d('0x3e')](_0x92dd8);})['then'](function(_0x23f831){_0x11e26b[_0xb16d('0x3f')]=_0x23f831;return _0x11e26b;})[_0xb16d('0x3c')](respondWithFilteredResult(_0xba8283,_0x92dd8))[_0xb16d('0x40')](handleError(_0xba8283,null));};exports['show']=function(_0x3e3f9d,_0x20bab4){var _0x5a76b8={'raw':!![],'where':{'id':_0x3e3f9d[_0xb16d('0x41')]['id']}},_0x1a6123={};_0x1a6123[_0xb16d('0x30')]=_['keys'](db[_0xb16d('0x2b')][_0xb16d('0x2c')]);_0x1a6123['query']=_[_0xb16d('0x31')](_0x3e3f9d[_0xb16d('0x36')]);_0x1a6123[_0xb16d('0x32')]=_['intersection'](_0x1a6123['model'],_0x1a6123['query']);_0x5a76b8[_0xb16d('0x34')]=_['intersection'](_0x1a6123[_0xb16d('0x30')],qs[_0xb16d('0x35')](_0x3e3f9d[_0xb16d('0x36')][_0xb16d('0x35')]));_0x5a76b8[_0xb16d('0x34')]=_0x5a76b8[_0xb16d('0x34')][_0xb16d('0x42')]?_0x5a76b8[_0xb16d('0x34')]:_0x1a6123[_0xb16d('0x30')];if(_0x3e3f9d[_0xb16d('0x36')]['includeAll']){_0x5a76b8[_0xb16d('0x3d')]=[{'all':!![]}];}_0x5a76b8=_[_0xb16d('0x3a')]({},_0x5a76b8,_0x3e3f9d[_0xb16d('0x3b')]);return db[_0xb16d('0x2b')][_0xb16d('0x43')](_0x5a76b8)[_0xb16d('0x3c')](handleEntityNotFound(_0x20bab4,null))[_0xb16d('0x3c')](respondWithResult(_0x20bab4,null))[_0xb16d('0x40')](handleError(_0x20bab4,null));};exports['create']=function(_0xa56bdf,_0x34d3a3){return db[_0xb16d('0x2b')]['create'](_0xa56bdf['body'],{})[_0xb16d('0x3c')](respondWithResult(_0x34d3a3,0xc9))['catch'](handleError(_0x34d3a3,null));};exports[_0xb16d('0x24')]=function(_0x2ad7f9,_0x60ab79){if(_0x2ad7f9['body']['id']){delete _0x2ad7f9[_0xb16d('0x44')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2ad7f9['params']['id']}})[_0xb16d('0x3c')](handleEntityNotFound(_0x60ab79,null))[_0xb16d('0x3c')](saveUpdates(_0x2ad7f9['body'],null))[_0xb16d('0x3c')](respondWithResult(_0x60ab79,null))[_0xb16d('0x40')](handleError(_0x60ab79,null));};exports[_0xb16d('0x45')]=function(_0x3d03e9,_0xcc54e9){return db[_0xb16d('0x2b')][_0xb16d('0x43')]({'where':{'id':_0x3d03e9[_0xb16d('0x41')]['id']}})['then'](handleEntityNotFound(_0xcc54e9,null))['then'](removeEntity(_0xcc54e9,null))[_0xb16d('0x40')](handleError(_0xcc54e9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e08a108..c687353 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 _0x4247=['int_salesforce_fields','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','SalesforceField'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x4247,0x114));var _0x7424=function(_0x21a886,_0x4f8d13){_0x21a886=_0x21a886-0x0;var _0x2bcf26=_0x4247[_0x21a886];return _0x2bcf26;};'use strict';var _=require(_0x7424('0x0'));var util=require(_0x7424('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7424('0x2'));var BPromise=require(_0x7424('0x3'));var rp=require(_0x7424('0x4'));var fs=require('fs');var path=require(_0x7424('0x5'));var rimraf=require(_0x7424('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x7424('0x7')]=function(_0x555a0a,_0x1f2185){return _0x555a0a[_0x7424('0x8')](_0x7424('0x9'),attributes,{'tableName':_0x7424('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x824d=['rimraf','exports','define','SalesforceField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x824d,0x1f1));var _0xd824=function(_0x447bda,_0x44c248){_0x447bda=_0x447bda-0x0;var _0x247fd6=_0x824d[_0x447bda];return _0x247fd6;};'use strict';var _=require(_0xd824('0x0'));var util=require(_0xd824('0x1'));var logger=require(_0xd824('0x2'))(_0xd824('0x3'));var moment=require(_0xd824('0x4'));var BPromise=require(_0xd824('0x5'));var rp=require(_0xd824('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd824('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xd824('0x8')]=function(_0x48106c,_0xe76f50){return _0x48106c[_0xd824('0x9')](_0xd824('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xd824('0xb')],'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 44728d9..03cf436 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 _0x0ea9=['error','code','message','request\x20sent','catch','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x3425c9,_0x26083d){var _0x2b0fb8=function(_0x5e8643){while(--_0x5e8643){_0x3425c9['push'](_0x3425c9['shift']());}};_0x2b0fb8(++_0x26083d);}(_0x0ea9,0xaf));var _0x90ea=function(_0x2d2a32,_0x1abc3c){_0x2d2a32=_0x2d2a32-0x0;var _0x535e3d=_0x0ea9[_0x2d2a32];return _0x535e3d;};'use strict';var _=require(_0x90ea('0x0'));var util=require(_0x90ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90ea('0x3'));var logger=require(_0x90ea('0x4'))('rpc');var config=require(_0x90ea('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90ea('0x6')][_0x90ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39d716,_0x240234,_0x178fb2){return new BPromise(function(_0x16c172,_0x2166b8){return client[_0x90ea('0x8')](_0x39d716,_0x178fb2)[_0x90ea('0x9')](function(_0x38a707){logger[_0x90ea('0xa')](_0x90ea('0xb'),_0x240234,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x240234,'request\x20sent',JSON['stringify'](_0x38a707));if(_0x38a707['error']){if(_0x38a707[_0x90ea('0xc')][_0x90ea('0xd')]===0x1f4){logger[_0x90ea('0xc')]('SalesforceField,\x20%s,\x20%s',_0x240234,_0x38a707[_0x90ea('0xc')][_0x90ea('0xe')]);return _0x2166b8(_0x38a707[_0x90ea('0xc')][_0x90ea('0xe')]);}logger[_0x90ea('0xc')](_0x90ea('0xb'),_0x240234,_0x38a707['error'][_0x90ea('0xe')]);return _0x16c172(_0x38a707[_0x90ea('0xc')][_0x90ea('0xe')]);}else{logger[_0x90ea('0xa')](_0x90ea('0xb'),_0x240234,_0x90ea('0xf'));_0x16c172(_0x38a707['result'][_0x90ea('0xe')]);}})[_0x90ea('0x10')](function(_0x2ec29d){logger[_0x90ea('0xc')](_0x90ea('0xb'),_0x240234,_0x2ec29d);_0x2166b8(_0x2ec29d);});});} \ No newline at end of file +var _0x7d49=['info','request\x20sent','debug','error','message','SalesforceField,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x3ed6ee,_0x5cf650){var _0x1a88a0=function(_0x5e1161){while(--_0x5e1161){_0x3ed6ee['push'](_0x3ed6ee['shift']());}};_0x1a88a0(++_0x5cf650);}(_0x7d49,0xcc));var _0x97d4=function(_0x546215,_0x3ad7d6){_0x546215=_0x546215-0x0;var _0x24017c=_0x7d49[_0x546215];return _0x24017c;};'use strict';var _=require(_0x97d4('0x0'));var util=require(_0x97d4('0x1'));var moment=require(_0x97d4('0x2'));var BPromise=require(_0x97d4('0x3'));var rs=require(_0x97d4('0x4'));var fs=require('fs');var Redis=require(_0x97d4('0x5'));var db=require(_0x97d4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x97d4('0x7'))('rpc');var config=require(_0x97d4('0x8'));var jayson=require(_0x97d4('0x9'));var client=jayson['client'][_0x97d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa00c68,_0x48b352,_0x5a1700){return new BPromise(function(_0x25fbca,_0x901f6b){return client['request'](_0xa00c68,_0x5a1700)[_0x97d4('0xb')](function(_0x542073){logger[_0x97d4('0xc')]('SalesforceField,\x20%s,\x20%s',_0x48b352,_0x97d4('0xd'));logger[_0x97d4('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x48b352,_0x97d4('0xd'),JSON['stringify'](_0x542073));if(_0x542073['error']){if(_0x542073[_0x97d4('0xf')]['code']===0x1f4){logger[_0x97d4('0xf')]('SalesforceField,\x20%s,\x20%s',_0x48b352,_0x542073[_0x97d4('0xf')][_0x97d4('0x10')]);return _0x901f6b(_0x542073[_0x97d4('0xf')]['message']);}logger[_0x97d4('0xf')]('SalesforceField,\x20%s,\x20%s',_0x48b352,_0x542073[_0x97d4('0xf')]['message']);return _0x25fbca(_0x542073[_0x97d4('0xf')][_0x97d4('0x10')]);}else{logger[_0x97d4('0xc')](_0x97d4('0x11'),_0x48b352,_0x97d4('0xd'));_0x25fbca(_0x542073['result'][_0x97d4('0x10')]);}})['catch'](function(_0x339359){logger[_0x97d4('0xf')](_0x97d4('0x11'),_0x48b352,_0x339359);_0x901f6b(_0x339359);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e057ed9..4d8072d 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 _0x7c5e=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5c25e2,_0x54d1b9){var _0x19f8c7=function(_0x53bed1){while(--_0x53bed1){_0x5c25e2['push'](_0x5c25e2['shift']());}};_0x19f8c7(++_0x54d1b9);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x2788b8,_0x595fe1){_0x2788b8=_0x2788b8-0x0;var _0x1da099=_0x7c5e[_0x2788b8];return _0x1da099;};'use strict';var multer=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var path=require(_0xe7c5('0x2'));var timeout=require(_0xe7c5('0x3'));var express=require(_0xe7c5('0x4'));var router=express[_0xe7c5('0x5')]();var fs_extra=require(_0xe7c5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe7c5('0x7'));var config=require(_0xe7c5('0x8'));var controller=require(_0xe7c5('0x9'));router[_0xe7c5('0xa')]('/',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0xc')]);router[_0xe7c5('0xa')](_0xe7c5('0xd'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0xe')]);router[_0xe7c5('0xa')](_0xe7c5('0xf'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x10')]);router[_0xe7c5('0xa')]('/:id/fields',auth[_0xe7c5('0xb')](),controller['getFields']);router[_0xe7c5('0x11')]('/',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x12')]);router[_0xe7c5('0x11')]('/:id/configurations',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x13')]);router[_0xe7c5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe7c5('0x15')]);router['delete'](_0xe7c5('0xd'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x16')]);module[_0xe7c5('0x17')]=router; \ No newline at end of file +var _0xfecd=['Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfecd,0x107));var _0xdfec=function(_0x1a1e57,_0x2cb6fd){_0x1a1e57=_0x1a1e57-0x0;var _0x177217=_0xfecd[_0x1a1e57];return _0x177217;};'use strict';var multer=require(_0xdfec('0x0'));var util=require('util');var path=require(_0xdfec('0x1'));var timeout=require(_0xdfec('0x2'));var express=require('express');var router=express[_0xdfec('0x3')]();var fs_extra=require(_0xdfec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfec('0x5'));var config=require('../../config/environment');var controller=require(_0xdfec('0x6'));router[_0xdfec('0x7')]('/',auth[_0xdfec('0x8')](),controller['index']);router[_0xdfec('0x7')](_0xdfec('0x9'),auth[_0xdfec('0x8')](),controller[_0xdfec('0xa')]);router[_0xdfec('0x7')]('/:id/configurations',auth[_0xdfec('0x8')](),controller[_0xdfec('0xb')]);router[_0xdfec('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdfec('0xc')]);router[_0xdfec('0xd')]('/',auth['isAuthenticated'](),controller[_0xdfec('0xe')]);router[_0xdfec('0xd')]('/:id/configurations',auth[_0xdfec('0x8')](),controller['addConfiguration']);router[_0xdfec('0xf')](_0xdfec('0x9'),auth[_0xdfec('0x8')](),controller[_0xdfec('0x10')]);router[_0xdfec('0x11')](_0xdfec('0x9'),auth[_0xdfec('0x8')](),controller[_0xdfec('0x12')]);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 bf8c62c..2d8e288 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 _0x8c71=['exports','STRING','remoteUri','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8c71,0x1cf));var _0x18c7=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x8c71[_0x12d6c2];return _0x1c9825;};'use strict';var Sequelize=require(_0x18c7('0x0'));module[_0x18c7('0x1')]={'name':{'type':Sequelize[_0x18c7('0x2')]},'description':{'type':Sequelize[_0x18c7('0x2')]},'username':{'type':Sequelize[_0x18c7('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x18c7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x18c7('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x555c=['exports','STRING','username','remoteUri'];(function(_0x2baea6,_0x17e57f){var _0x5f0913=function(_0x590805){while(--_0x590805){_0x2baea6['push'](_0x2baea6['shift']());}};_0x5f0913(++_0x17e57f);}(_0x555c,0xc4));var _0xc555=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x555c[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require('sequelize');module[_0xc555('0x0')]={'name':{'type':Sequelize[_0xc555('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc555('0x1')],'unique':_0xc555('0x2')},'password':{'type':Sequelize[_0xc555('0x1')]},'email':{'type':Sequelize[_0xc555('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc555('0x3')},'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 10b3108..f3cc2a7 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 _0x45c8=['value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','find','catch','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','sort','options','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','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','impact','active','work_notes_list','priority','sys_domain_path','rfc','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','incident\x20table\x20objects','assign','remove','includes','internalType','label','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','ServiceNow\x20error:\x20','test','statusCode','True','true','false'];(function(_0x3b875f,_0x456f92){var _0x26d6a4=function(_0x5ace03){while(--_0x5ace03){_0x3b875f['push'](_0x3b875f['shift']());}};_0x26d6a4(++_0x456f92);}(_0x45c8,0xc0));var _0x845c=function(_0x13d6bd,_0x216a7b){_0x13d6bd=_0x13d6bd-0x0;var _0x2736cb=_0x45c8[_0x13d6bd];return _0x2736cb;};'use strict';var emlformat=require(_0x845c('0x0'));var rimraf=require(_0x845c('0x1'));var zipdir=require(_0x845c('0x2'));var jsonpatch=require(_0x845c('0x3'));var rp=require('request-promise');var moment=require(_0x845c('0x4'));var BPromise=require(_0x845c('0x5'));var Mustache=require(_0x845c('0x6'));var util=require(_0x845c('0x7'));var path=require(_0x845c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x845c('0x9'));var fs=require('fs');var fs_extra=require(_0x845c('0xa'));var _=require(_0x845c('0xb'));var squel=require('squel');var crypto=require(_0x845c('0xc'));var jsforce=require(_0x845c('0xd'));var deskjs=require(_0x845c('0xe'));var toCsv=require(_0x845c('0xf'));var querystring=require('querystring');var Papa=require(_0x845c('0x10'));var Redis=require(_0x845c('0x11'));var authService=require(_0x845c('0x12'));var qs=require(_0x845c('0x13'));var as=require(_0x845c('0x14'));var hardwareService=require(_0x845c('0x15'));var logger=require(_0x845c('0x16'))(_0x845c('0x17'));var utils=require(_0x845c('0x18'));var config=require(_0x845c('0x19'));var licenseUtil=require(_0x845c('0x1a'));var db=require(_0x845c('0x1b'))['db'];var integrations=require(_0x845c('0x1c'));function respondWithStatusCode(_0x30f632,_0x3ffd26){_0x3ffd26=_0x3ffd26||0xcc;return function(_0x1bee57){if(_0x1bee57){return _0x30f632[_0x845c('0x1d')](_0x3ffd26);}return _0x30f632[_0x845c('0x1e')](_0x3ffd26)[_0x845c('0x1f')]();};}function respondWithResult(_0x2ed9a7,_0x284694){_0x284694=_0x284694||0xc8;return function(_0x394e1e){if(_0x394e1e){return _0x2ed9a7['status'](_0x284694)[_0x845c('0x20')](_0x394e1e);}};}function respondWithFilteredResult(_0x339914,_0x24bf01){return function(_0x30b7a3){if(_0x30b7a3){var _0x12b483=typeof _0x24bf01[_0x845c('0x21')]===_0x845c('0x22')&&typeof _0x24bf01[_0x845c('0x23')]===_0x845c('0x22');var _0x1b4904=_0x30b7a3[_0x845c('0x24')];var _0x41397b=_0x12b483?0x0:_0x24bf01[_0x845c('0x21')];var _0x2bb0c1=_0x12b483?_0x30b7a3[_0x845c('0x24')]:_0x24bf01['offset']+_0x24bf01[_0x845c('0x23')];var _0x3fc1dd;if(_0x2bb0c1>=_0x1b4904){_0x2bb0c1=_0x1b4904;_0x3fc1dd=0xc8;}else{_0x3fc1dd=0xce;}_0x339914['status'](_0x3fc1dd);return _0x339914['set'](_0x845c('0x25'),_0x41397b+'-'+_0x2bb0c1+'/'+_0x1b4904)['json'](_0x30b7a3);}return null;};}function patchUpdates(_0x28cc1b){return function(_0x1905a2){try{jsonpatch[_0x845c('0x26')](_0x1905a2,_0x28cc1b,!![]);}catch(_0x1e0a0f){return BPromise[_0x845c('0x27')](_0x1e0a0f);}return _0x1905a2['save']();};}function saveUpdates(_0x22242c,_0x4f64d3){return function(_0x256842){if(_0x256842){return _0x256842[_0x845c('0x28')](_0x22242c)[_0x845c('0x29')](function(_0x53ff14){return _0x53ff14;});}return null;};}function removeEntity(_0x494431,_0x4a3799){return function(_0x2e52dd){if(_0x2e52dd){return _0x2e52dd['destroy']()[_0x845c('0x29')](function(){_0x494431['status'](0xcc)[_0x845c('0x1f')]();});}};}function handleEntityNotFound(_0x349393,_0x21b5b3){return function(_0x5317e2){if(!_0x5317e2){_0x349393[_0x845c('0x1d')](0x194);}return _0x5317e2;};}function handleError(_0x178903,_0x432809){_0x432809=_0x432809||0x1f4;return function(_0x2c1f0c){logger[_0x845c('0x2a')](_0x2c1f0c[_0x845c('0x2b')]);if(_0x2c1f0c[_0x845c('0x2c')]){delete _0x2c1f0c['name'];}_0x178903[_0x845c('0x1e')](_0x432809)[_0x845c('0x2d')](_0x2c1f0c);};}exports[_0x845c('0x2e')]=function(_0x1d88b3,_0x15251c){var _0x41bb6d={},_0xcb1af4={},_0x58c02c={'count':0x0,'rows':[]};var _0x78b601=_['map'](db[_0x845c('0x2f')][_0x845c('0x30')],function(_0x4450db){return{'name':_0x4450db[_0x845c('0x31')],'type':_0x4450db[_0x845c('0x32')][_0x845c('0x33')]};});_0xcb1af4[_0x845c('0x34')]=_[_0x845c('0x35')](_0x78b601,'name');_0xcb1af4[_0x845c('0x36')]=_[_0x845c('0x37')](_0x1d88b3[_0x845c('0x36')]);_0xcb1af4[_0x845c('0x38')]=_['intersection'](_0xcb1af4[_0x845c('0x34')],_0xcb1af4[_0x845c('0x36')]);_0x41bb6d[_0x845c('0x39')]=_[_0x845c('0x3a')](_0xcb1af4[_0x845c('0x34')],qs[_0x845c('0x3b')](_0x1d88b3['query']['fields']));_0x41bb6d[_0x845c('0x39')]=_0x41bb6d[_0x845c('0x39')][_0x845c('0x3c')]?_0x41bb6d[_0x845c('0x39')]:_0xcb1af4[_0x845c('0x34')];if(!_0x1d88b3[_0x845c('0x36')][_0x845c('0x3d')](_0x845c('0x3e'))){_0x41bb6d[_0x845c('0x23')]=qs['limit'](_0x1d88b3['query'][_0x845c('0x23')]);_0x41bb6d[_0x845c('0x21')]=qs['offset'](_0x1d88b3['query'][_0x845c('0x21')]);}_0x41bb6d[_0x845c('0x3f')]=qs['sort'](_0x1d88b3[_0x845c('0x36')]['sort']);_0x41bb6d[_0x845c('0x40')]=qs[_0x845c('0x38')](_[_0x845c('0x41')](_0x1d88b3[_0x845c('0x36')],_0xcb1af4[_0x845c('0x38')]),_0x78b601);if(_0x1d88b3['query'][_0x845c('0x42')]){_0x41bb6d['where']=_[_0x845c('0x43')](_0x41bb6d['where'],{'$or':_[_0x845c('0x35')](_0x78b601,function(_0x579f48){if(_0x579f48['type']!==_0x845c('0x44')){var _0x44e0e7={};_0x44e0e7[_0x579f48[_0x845c('0x2c')]]={'$like':'%'+_0x1d88b3[_0x845c('0x36')][_0x845c('0x42')]+'%'};return _0x44e0e7;}})});}_0x41bb6d=_[_0x845c('0x43')]({},_0x41bb6d,_0x1d88b3['options']);var _0x3a6ab1={'where':_0x41bb6d[_0x845c('0x40')]};return db['ServicenowAccount'][_0x845c('0x24')](_0x3a6ab1)['then'](function(_0x20990b){_0x58c02c[_0x845c('0x24')]=_0x20990b;if(_0x1d88b3[_0x845c('0x36')][_0x845c('0x45')]){_0x41bb6d[_0x845c('0x46')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x845c('0x47')](_0x41bb6d);})['then'](function(_0x34f98a){_0x58c02c['rows']=_0x34f98a;return _0x58c02c;})[_0x845c('0x29')](respondWithFilteredResult(_0x15251c,_0x41bb6d))['catch'](handleError(_0x15251c,null));};exports['show']=function(_0x4ae93c,_0x24cb6a){var _0x2ceaf6={'raw':![],'where':{'id':_0x4ae93c[_0x845c('0x48')]['id']}},_0x5d3da2={};_0x5d3da2['model']=_[_0x845c('0x37')](db[_0x845c('0x2f')][_0x845c('0x30')]);_0x5d3da2[_0x845c('0x36')]=_[_0x845c('0x37')](_0x4ae93c[_0x845c('0x36')]);_0x5d3da2['filters']=_['intersection'](_0x5d3da2[_0x845c('0x34')],_0x5d3da2[_0x845c('0x36')]);_0x2ceaf6[_0x845c('0x39')]=_[_0x845c('0x3a')](_0x5d3da2[_0x845c('0x34')],qs['fields'](_0x4ae93c[_0x845c('0x36')][_0x845c('0x3b')]));_0x2ceaf6[_0x845c('0x39')]=_0x2ceaf6[_0x845c('0x39')]['length']?_0x2ceaf6[_0x845c('0x39')]:_0x5d3da2[_0x845c('0x34')];if(_0x4ae93c[_0x845c('0x36')]['includeAll']){_0x2ceaf6[_0x845c('0x46')]=[{'all':!![]}];}_0x2ceaf6=_[_0x845c('0x43')]({},_0x2ceaf6,_0x4ae93c['options']);return db[_0x845c('0x2f')][_0x845c('0x49')](_0x2ceaf6)[_0x845c('0x29')](handleEntityNotFound(_0x24cb6a,null))[_0x845c('0x29')](respondWithResult(_0x24cb6a,null))[_0x845c('0x4a')](handleError(_0x24cb6a,null));};exports[_0x845c('0x4b')]=function(_0x234390,_0x307b56){return db[_0x845c('0x2f')][_0x845c('0x4b')](_0x234390['body'],{})[_0x845c('0x29')](respondWithResult(_0x307b56,0xc9))[_0x845c('0x4a')](handleError(_0x307b56,null));};exports[_0x845c('0x28')]=function(_0x3f7a98,_0x2654ac){if(_0x3f7a98[_0x845c('0x4c')]['id']){delete _0x3f7a98[_0x845c('0x4c')]['id'];}return db[_0x845c('0x2f')]['find']({'where':{'id':_0x3f7a98[_0x845c('0x48')]['id']}})[_0x845c('0x29')](handleEntityNotFound(_0x2654ac,null))[_0x845c('0x29')](saveUpdates(_0x3f7a98['body'],null))['then'](respondWithResult(_0x2654ac,null))[_0x845c('0x4a')](handleError(_0x2654ac,null));};exports[_0x845c('0x4d')]=function(_0x2e14c9,_0x2b6a8d){return db[_0x845c('0x2f')][_0x845c('0x49')]({'where':{'id':_0x2e14c9[_0x845c('0x48')]['id']}})[_0x845c('0x29')](handleEntityNotFound(_0x2b6a8d,null))[_0x845c('0x29')](removeEntity(_0x2b6a8d,null))[_0x845c('0x4a')](handleError(_0x2b6a8d,null));};exports[_0x845c('0x4e')]=function(_0x1726c4,_0x23cd85,_0x19372b){var _0x3212be={};var _0x5d30b5={};var _0x2980bc;var _0x458964;return db['ServicenowAccount'][_0x845c('0x4f')]({'where':{'id':_0x1726c4[_0x845c('0x48')]['id']}})[_0x845c('0x29')](handleEntityNotFound(_0x23cd85,null))[_0x845c('0x29')](function(_0x4fb102){if(_0x4fb102){_0x2980bc=_0x4fb102;_0x5d30b5[_0x845c('0x34')]=_['keys'](db[_0x845c('0x50')][_0x845c('0x30')]);_0x5d30b5[_0x845c('0x36')]=_[_0x845c('0x37')](_0x1726c4[_0x845c('0x36')]);_0x5d30b5[_0x845c('0x38')]=_[_0x845c('0x3a')](_0x5d30b5[_0x845c('0x34')],_0x5d30b5[_0x845c('0x36')]);_0x3212be['attributes']=_['intersection'](_0x5d30b5[_0x845c('0x34')],qs[_0x845c('0x3b')](_0x1726c4[_0x845c('0x36')][_0x845c('0x3b')]));_0x3212be['attributes']=_0x3212be[_0x845c('0x39')][_0x845c('0x3c')]?_0x3212be[_0x845c('0x39')]:_0x5d30b5[_0x845c('0x34')];_0x3212be[_0x845c('0x3f')]=qs[_0x845c('0x51')](_0x1726c4[_0x845c('0x36')]['sort']);_0x3212be[_0x845c('0x40')]=qs[_0x845c('0x38')](_[_0x845c('0x41')](_0x1726c4[_0x845c('0x36')],_0x5d30b5[_0x845c('0x38')]));if(_0x1726c4[_0x845c('0x36')][_0x845c('0x42')]){_0x3212be[_0x845c('0x40')]=_[_0x845c('0x43')](_0x3212be[_0x845c('0x40')],{'$or':_[_0x845c('0x35')](_0x3212be['attributes'],function(_0x319eca){var _0x4a83ec={};_0x4a83ec[_0x319eca]={'$like':'%'+_0x1726c4[_0x845c('0x36')][_0x845c('0x42')]+'%'};return _0x4a83ec;})});}_0x3212be=_[_0x845c('0x43')]({},_0x3212be,_0x1726c4[_0x845c('0x52')]);return _0x2980bc['getConfigurations'](_0x3212be);}})[_0x845c('0x29')](function(_0x134eea){if(_0x134eea){_0x458964=_0x134eea[_0x845c('0x3c')];if(!_0x1726c4[_0x845c('0x36')][_0x845c('0x3d')]('nolimit')){_0x3212be['limit']=qs[_0x845c('0x23')](_0x1726c4['query'][_0x845c('0x23')]);_0x3212be[_0x845c('0x21')]=qs[_0x845c('0x21')](_0x1726c4['query']['offset']);}return _0x2980bc[_0x845c('0x4e')](_0x3212be);}})[_0x845c('0x29')](function(_0xe1e79b){if(_0xe1e79b){return _0xe1e79b?{'count':_0x458964,'rows':_0xe1e79b}:null;}})[_0x845c('0x29')](respondWithResult(_0x23cd85,null))[_0x845c('0x4a')](handleError(_0x23cd85,null));};exports['addConfiguration']=function(_0x306a95,_0x44281c,_0x486810){if(_0x306a95['body']['id']){delete _0x306a95[_0x845c('0x4c')]['id'];}return db['ServicenowAccount'][_0x845c('0x4f')]({'where':{'id':_0x306a95[_0x845c('0x48')]['id']}})['then'](handleEntityNotFound(_0x44281c,null))['then'](function(_0x55c5b3){if(_0x55c5b3){_0x306a95[_0x845c('0x4c')][_0x845c('0x53')]=_0x55c5b3['id'];_0x306a95[_0x845c('0x4c')][_0x845c('0x54')]=integrations[_0x845c('0x55')](_0x306a95[_0x845c('0x4c')]['channel'],_0x306a95[_0x845c('0x4c')][_0x845c('0x32')]);_0x306a95['body'][_0x845c('0x56')]=integrations[_0x845c('0x57')](_0x306a95[_0x845c('0x4c')][_0x845c('0x58')],_0x306a95[_0x845c('0x4c')][_0x845c('0x32')]);return db[_0x845c('0x50')]['create'](_0x306a95[_0x845c('0x4c')],{'include':[{'model':db[_0x845c('0x59')],'as':_0x845c('0x54')},{'model':db[_0x845c('0x59')],'as':_0x845c('0x56')}]});}return null;})[_0x845c('0x29')](respondWithResult(_0x44281c,null))['catch'](handleError(_0x44281c,null));};exports[_0x845c('0x5a')]=function(_0x43b4a7,_0x3f3cea,_0x4dab86){var _0x24128b=[_0x845c('0x5b'),_0x845c('0x5c'),_0x845c('0x5d'),'subcategory','close_code','notify',_0x845c('0x5e'),_0x845c('0x5f'),_0x845c('0x60')];var _0x575279=[_0x845c('0x61'),_0x845c('0x5b'),'caused_by',_0x845c('0x62'),_0x845c('0x63'),_0x845c('0x64'),_0x845c('0x65'),_0x845c('0x5c'),'approval_history',_0x845c('0x66'),_0x845c('0x67'),_0x845c('0x68'),_0x845c('0x69'),'user_input',_0x845c('0x6a'),_0x845c('0x6b'),_0x845c('0x6c'),_0x845c('0x6d'),_0x845c('0x5d'),'order',_0x845c('0x6e'),_0x845c('0x6f'),_0x845c('0x70'),_0x845c('0x71'),_0x845c('0x72'),_0x845c('0x73'),_0x845c('0x74'),'business_service',_0x845c('0x75'),_0x845c('0x76'),_0x845c('0x77'),'time_worked','expected_start','opened_at','business_duration',_0x845c('0x78'),_0x845c('0x79'),_0x845c('0x7a'),_0x845c('0x7b'),_0x845c('0x7c'),_0x845c('0x7d'),_0x845c('0x7e'),_0x845c('0x7f'),_0x845c('0x80'),_0x845c('0x81'),_0x845c('0x82'),_0x845c('0x83'),_0x845c('0x84'),_0x845c('0x85'),'business_stc',_0x845c('0x86'),_0x845c('0x87'),_0x845c('0x88'),_0x845c('0x89'),_0x845c('0x8a'),'close_notes',_0x845c('0x8b'),_0x845c('0x8c'),_0x845c('0x8d'),_0x845c('0x8e'),_0x845c('0x8f'),_0x845c('0x90'),_0x845c('0x5e'),_0x845c('0x91'),_0x845c('0x92'),_0x845c('0x93'),_0x845c('0x94'),_0x845c('0x95'),_0x845c('0x96'),_0x845c('0x5f'),'comments',_0x845c('0x97'),_0x845c('0x98'),_0x845c('0x99'),'due_date',_0x845c('0x9a'),'reopen_count',_0x845c('0x9b'),'escalation',_0x845c('0x9c'),_0x845c('0x9d'),_0x845c('0x9e'),'category'];var _0x2e2390='';var _0x40cea4='';var _0x4df03e=[];var _0x81f0ff='';var _0x7768da='';var _0x4fee97=[];var _0x38eacc='';var _0x50727c='';var _0x40a490={};var _0x1b6daf='';return db[_0x845c('0x2f')][_0x845c('0x4f')]({'where':{'id':_0x43b4a7[_0x845c('0x48')]['id']},'attributes':['id',_0x845c('0x9f'),_0x845c('0xa0'),_0x845c('0xa1'),_0x845c('0xa2'),_0x845c('0xa3')]})[_0x845c('0x29')](handleEntityNotFound(_0x3f3cea,null))[_0x845c('0x29')](function(_0x341879){if(_0x341879){_0x1b6daf=_0x341879[_0x845c('0xa2')];var _0x555f48=_0x1b6daf[_0x845c('0xa4')](-0x1);if(_0x555f48==='/'){_0x1b6daf=_0x1b6daf[_0x845c('0xa5')](0x0,_0x1b6daf['lastIndexOf'](_0x555f48));}_0x50727c=util['format'](_0x845c('0xa6'),_0x1b6daf);_0x38eacc=util[_0x845c('0xa7')](_0x845c('0xa8'),_0x1b6daf);_0x40a490={'user':_0x341879[_0x845c('0x9f')],'pass':_0x341879[_0x845c('0xa0')]};var _0x2e93dc={'method':_0x845c('0xa9'),'uri':_0x50727c+'incident?sysparm_display_value=all','auth':_0x40a490,'json':!![]};return rp(_0x2e93dc);}})['then'](function(_0x496c48){if(_0x496c48[_0x845c('0xaa')][_0x845c('0x3c')]>0x0){_0x2e2390=_0x496c48[_0x845c('0xaa')];}console['log'](_0x845c('0xab'),_0x2e2390);_0x4fee97=[];_0x40cea4=Object[_0x845c('0xac')]([],_0x2e2390);_[_0x845c('0xad')](_0x40cea4,function(_0x518805){return!_0x24128b[_0x845c('0xae')](_0x518805[_0x845c('0x2c')]);});_0x40cea4['forEach'](function(_0x586e65){var _0x3ca641=createFieldObject(_0x38eacc,_0x40a490,_0x586e65[_0x845c('0xaf')],_0x586e65[_0x845c('0x2c')],_0x586e65[_0x845c('0xb0')],![]);_0x4fee97['push'](_0x3ca641);});return Promise[_0x845c('0xb1')](_0x4fee97);})[_0x845c('0x29')](function(_0x1a2663){_0x4df03e=_0x1a2663;_0x81f0ff=Object[_0x845c('0xac')]([],_0x2e2390);console[_0x845c('0xb2')](_0x845c('0xb3'),_0x2e2390);_[_0x845c('0xad')](_0x81f0ff,function(_0x254726){return _0x575279['includes'](_0x254726[_0x845c('0x2c')]);});console[_0x845c('0xb2')](_0x845c('0xb4'),_0x81f0ff);_0x4fee97=[];_0x81f0ff[_0x845c('0xb5')](function(_0x37ca02){var _0x2f1171=createFieldObject(_0x38eacc,_0x40a490,_0x37ca02[_0x845c('0xaf')],_0x37ca02[_0x845c('0x2c')],_0x37ca02[_0x845c('0xb0')],!![]);_0x4fee97[_0x845c('0xb6')](_0x2f1171);});return Promise[_0x845c('0xb1')](_0x4fee97);})[_0x845c('0x29')](function(_0x3538e8){_0x7768da=_0x3538e8;var _0xf5632b=_0x4df03e[_0x845c('0xb7')](_0x7768da);return{'count':_0xf5632b['length'],'rows':_0xf5632b};})[_0x845c('0x29')](respondWithResult(_0x3f3cea,null))[_0x845c('0x4a')](function(_0x324f1d){console[_0x845c('0xb2')](_0x845c('0xb8')+_0x324f1d);var _0x3aaac5=_0x43b4a7[_0x845c('0x36')][_0x845c('0xb9')]?0x1f4:_0x324f1d[_0x845c('0xba')]||0x1f4;logger[_0x845c('0x2a')](_0x324f1d[_0x845c('0x2b')]);delete _0x324f1d[_0x845c('0x2c')];if(_0x3aaac5===0x191){_0x3aaac5=0x190;}_0x3f3cea[_0x845c('0x1e')](_0x3aaac5)[_0x845c('0x2d')](_0x43b4a7['query'][_0x845c('0xb9')]?{'message':'Wrong\x20credentials','statusCode':_0x324f1d['statusCode']}:_0x324f1d);});};function createFieldObject(_0x402bea,_0x4dacbb,_0x2900a8,_0x27589e,_0x1f5cc0,_0x4ad611){return new Promise(function(_0x1f3ec2,_0x881c56){var _0x364ca8={'id':_0x27589e,'name':_0x1f5cc0,'custom':_0x4ad611};if(_0x2900a8==='boolean'){_0x364ca8[_0x845c('0x52')]=[{'name':_0x845c('0xbb'),'value':_0x845c('0xbc')},{'name':'False','value':_0x845c('0xbd')}];_0x1f3ec2(_0x364ca8);}else{var _0x40d85e={'method':_0x845c('0xa9'),'uri':_0x402bea+'sys_choice?sysparm_query=name=incident^element='+_0x27589e,'auth':_0x4dacbb,'json':!![]};return rp(_0x40d85e)['then'](function(_0x2a23a1){var _0x1ab412=[];if(_0x2a23a1['result'][_0x845c('0x3c')]>0x0){_0x2a23a1[_0x845c('0xaa')]['forEach'](function(_0x5d7ca6){if(_0x5d7ca6['inactive']==='false'){var _0x292b88={'name':_0x5d7ca6['label'],'value':_0x5d7ca6[_0x845c('0xbe')]};_0x1ab412['push'](_0x292b88);}});}_0x364ca8[_0x845c('0x52')]=_0x1ab412;if(_0x364ca8[_0x845c('0x52')][_0x845c('0x3c')]>0x0){_0x1f3ec2(_0x364ca8);}else{if(_0x4ad611==![]){_0x1f3ec2();}else{_0x1f3ec2(_0x364ca8);}}});}});} \ No newline at end of file +var _0xb3ad=['hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','assigned_to','severity','comments','approval','comments_and_work_notes','sys_mod_count','sys_tags','correlation_id','location','remoteUri','serverUrl','substring','lastIndexOf','format','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','error','boolean','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla'];(function(_0x41c513,_0x494765){var _0x34f76b=function(_0x1b46f7){while(--_0x1b46f7){_0x41c513['push'](_0x41c513['shift']());}};_0x34f76b(++_0x494765);}(_0xb3ad,0x1c6));var _0xdb3a=function(_0xfb1d48,_0x22bcaa){_0xfb1d48=_0xfb1d48-0x0;var _0x30cbb2=_0xb3ad[_0xfb1d48];return _0x30cbb2;};'use strict';var emlformat=require(_0xdb3a('0x0'));var rimraf=require(_0xdb3a('0x1'));var zipdir=require(_0xdb3a('0x2'));var jsonpatch=require(_0xdb3a('0x3'));var rp=require(_0xdb3a('0x4'));var moment=require(_0xdb3a('0x5'));var BPromise=require(_0xdb3a('0x6'));var Mustache=require(_0xdb3a('0x7'));var util=require(_0xdb3a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb3a('0x9'));var fs=require('fs');var fs_extra=require(_0xdb3a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb3a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb3a('0xc'));var querystring=require(_0xdb3a('0xd'));var Papa=require(_0xdb3a('0xe'));var Redis=require('ioredis');var authService=require(_0xdb3a('0xf'));var qs=require(_0xdb3a('0x10'));var as=require(_0xdb3a('0x11'));var hardwareService=require(_0xdb3a('0x12'));var logger=require(_0xdb3a('0x13'))('api');var utils=require(_0xdb3a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb3a('0x15'));var db=require(_0xdb3a('0x16'))['db'];var integrations=require(_0xdb3a('0x17'));function respondWithStatusCode(_0x345932,_0x58a3c4){_0x58a3c4=_0x58a3c4||0xcc;return function(_0x3e044d){if(_0x3e044d){return _0x345932[_0xdb3a('0x18')](_0x58a3c4);}return _0x345932[_0xdb3a('0x19')](_0x58a3c4)[_0xdb3a('0x1a')]();};}function respondWithResult(_0x9df218,_0x3b417f){_0x3b417f=_0x3b417f||0xc8;return function(_0x484659){if(_0x484659){return _0x9df218[_0xdb3a('0x19')](_0x3b417f)[_0xdb3a('0x1b')](_0x484659);}};}function respondWithFilteredResult(_0x3c0d8b,_0xb5eb29){return function(_0x580e6d){if(_0x580e6d){var _0x960d96=typeof _0xb5eb29[_0xdb3a('0x1c')]===_0xdb3a('0x1d')&&typeof _0xb5eb29[_0xdb3a('0x1e')]===_0xdb3a('0x1d');var _0x8af4f=_0x580e6d['count'];var _0x1a74fd=_0x960d96?0x0:_0xb5eb29['offset'];var _0x3dd786=_0x960d96?_0x580e6d[_0xdb3a('0x1f')]:_0xb5eb29[_0xdb3a('0x1c')]+_0xb5eb29[_0xdb3a('0x1e')];var _0x2ad74;if(_0x3dd786>=_0x8af4f){_0x3dd786=_0x8af4f;_0x2ad74=0xc8;}else{_0x2ad74=0xce;}_0x3c0d8b[_0xdb3a('0x19')](_0x2ad74);return _0x3c0d8b[_0xdb3a('0x20')]('Content-Range',_0x1a74fd+'-'+_0x3dd786+'/'+_0x8af4f)[_0xdb3a('0x1b')](_0x580e6d);}return null;};}function patchUpdates(_0x453253){return function(_0x4b4782){try{jsonpatch[_0xdb3a('0x21')](_0x4b4782,_0x453253,!![]);}catch(_0x2c3180){return BPromise[_0xdb3a('0x22')](_0x2c3180);}return _0x4b4782[_0xdb3a('0x23')]();};}function saveUpdates(_0x19cb71,_0x34be5e){return function(_0x579b32){if(_0x579b32){return _0x579b32[_0xdb3a('0x24')](_0x19cb71)['then'](function(_0x2815f3){return _0x2815f3;});}return null;};}function removeEntity(_0x5caeed,_0x2aab7e){return function(_0x4fd0e6){if(_0x4fd0e6){return _0x4fd0e6[_0xdb3a('0x25')]()[_0xdb3a('0x26')](function(){_0x5caeed[_0xdb3a('0x19')](0xcc)[_0xdb3a('0x1a')]();});}};}function handleEntityNotFound(_0x556bac,_0x541039){return function(_0x589e9b){if(!_0x589e9b){_0x556bac[_0xdb3a('0x18')](0x194);}return _0x589e9b;};}function handleError(_0x38248e,_0xf641eb){_0xf641eb=_0xf641eb||0x1f4;return function(_0x49f280){logger['error'](_0x49f280[_0xdb3a('0x27')]);if(_0x49f280['name']){delete _0x49f280[_0xdb3a('0x28')];}_0x38248e['status'](_0xf641eb)[_0xdb3a('0x29')](_0x49f280);};}exports[_0xdb3a('0x2a')]=function(_0x4dcffc,_0xd6d1e1){var _0xdd1403={},_0x3401bb={},_0x391977={'count':0x0,'rows':[]};var _0x211238=_[_0xdb3a('0x2b')](db[_0xdb3a('0x2c')]['rawAttributes'],function(_0x28cdf5){return{'name':_0x28cdf5[_0xdb3a('0x2d')],'type':_0x28cdf5[_0xdb3a('0x2e')]['key']};});_0x3401bb[_0xdb3a('0x2f')]=_[_0xdb3a('0x2b')](_0x211238,_0xdb3a('0x28'));_0x3401bb[_0xdb3a('0x30')]=_[_0xdb3a('0x31')](_0x4dcffc['query']);_0x3401bb[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x3401bb[_0xdb3a('0x2f')],_0x3401bb['query']);_0xdd1403[_0xdb3a('0x34')]=_['intersection'](_0x3401bb[_0xdb3a('0x2f')],qs[_0xdb3a('0x35')](_0x4dcffc['query'][_0xdb3a('0x35')]));_0xdd1403[_0xdb3a('0x34')]=_0xdd1403[_0xdb3a('0x34')][_0xdb3a('0x36')]?_0xdd1403[_0xdb3a('0x34')]:_0x3401bb[_0xdb3a('0x2f')];if(!_0x4dcffc['query']['hasOwnProperty'](_0xdb3a('0x37'))){_0xdd1403[_0xdb3a('0x1e')]=qs[_0xdb3a('0x1e')](_0x4dcffc['query']['limit']);_0xdd1403[_0xdb3a('0x1c')]=qs['offset'](_0x4dcffc['query']['offset']);}_0xdd1403[_0xdb3a('0x38')]=qs[_0xdb3a('0x39')](_0x4dcffc['query'][_0xdb3a('0x39')]);_0xdd1403[_0xdb3a('0x3a')]=qs[_0xdb3a('0x32')](_['pick'](_0x4dcffc[_0xdb3a('0x30')],_0x3401bb[_0xdb3a('0x32')]),_0x211238);if(_0x4dcffc[_0xdb3a('0x30')]['filter']){_0xdd1403[_0xdb3a('0x3a')]=_['merge'](_0xdd1403[_0xdb3a('0x3a')],{'$or':_['map'](_0x211238,function(_0x43dd20){if(_0x43dd20[_0xdb3a('0x2e')]!==_0xdb3a('0x3b')){var _0x2cdb96={};_0x2cdb96[_0x43dd20[_0xdb3a('0x28')]]={'$like':'%'+_0x4dcffc[_0xdb3a('0x30')][_0xdb3a('0x3c')]+'%'};return _0x2cdb96;}})});}_0xdd1403=_[_0xdb3a('0x3d')]({},_0xdd1403,_0x4dcffc[_0xdb3a('0x3e')]);var _0x5b230e={'where':_0xdd1403[_0xdb3a('0x3a')]};return db[_0xdb3a('0x2c')][_0xdb3a('0x1f')](_0x5b230e)['then'](function(_0x1bca56){_0x391977[_0xdb3a('0x1f')]=_0x1bca56;if(_0x4dcffc[_0xdb3a('0x30')][_0xdb3a('0x3f')]){_0xdd1403[_0xdb3a('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xdb3a('0x41')](_0xdd1403);})[_0xdb3a('0x26')](function(_0x2dd9d2){_0x391977[_0xdb3a('0x42')]=_0x2dd9d2;return _0x391977;})[_0xdb3a('0x26')](respondWithFilteredResult(_0xd6d1e1,_0xdd1403))[_0xdb3a('0x43')](handleError(_0xd6d1e1,null));};exports[_0xdb3a('0x44')]=function(_0x2dc5b0,_0x706183){var _0x4efb3b={'raw':![],'where':{'id':_0x2dc5b0[_0xdb3a('0x45')]['id']}},_0x3a6031={};_0x3a6031[_0xdb3a('0x2f')]=_[_0xdb3a('0x31')](db[_0xdb3a('0x2c')][_0xdb3a('0x46')]);_0x3a6031['query']=_['keys'](_0x2dc5b0[_0xdb3a('0x30')]);_0x3a6031[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x3a6031[_0xdb3a('0x2f')],_0x3a6031[_0xdb3a('0x30')]);_0x4efb3b['attributes']=_[_0xdb3a('0x33')](_0x3a6031[_0xdb3a('0x2f')],qs[_0xdb3a('0x35')](_0x2dc5b0[_0xdb3a('0x30')][_0xdb3a('0x35')]));_0x4efb3b[_0xdb3a('0x34')]=_0x4efb3b['attributes']['length']?_0x4efb3b[_0xdb3a('0x34')]:_0x3a6031['model'];if(_0x2dc5b0[_0xdb3a('0x30')][_0xdb3a('0x3f')]){_0x4efb3b[_0xdb3a('0x40')]=[{'all':!![]}];}_0x4efb3b=_[_0xdb3a('0x3d')]({},_0x4efb3b,_0x2dc5b0[_0xdb3a('0x3e')]);return db['ServicenowAccount'][_0xdb3a('0x47')](_0x4efb3b)[_0xdb3a('0x26')](handleEntityNotFound(_0x706183,null))[_0xdb3a('0x26')](respondWithResult(_0x706183,null))[_0xdb3a('0x43')](handleError(_0x706183,null));};exports[_0xdb3a('0x48')]=function(_0x5c79b2,_0xf17306){return db[_0xdb3a('0x2c')][_0xdb3a('0x48')](_0x5c79b2[_0xdb3a('0x49')],{})[_0xdb3a('0x26')](respondWithResult(_0xf17306,0xc9))[_0xdb3a('0x43')](handleError(_0xf17306,null));};exports[_0xdb3a('0x24')]=function(_0x3fd88e,_0x79cdbf){if(_0x3fd88e['body']['id']){delete _0x3fd88e[_0xdb3a('0x49')]['id'];}return db[_0xdb3a('0x2c')]['find']({'where':{'id':_0x3fd88e['params']['id']}})[_0xdb3a('0x26')](handleEntityNotFound(_0x79cdbf,null))['then'](saveUpdates(_0x3fd88e[_0xdb3a('0x49')],null))[_0xdb3a('0x26')](respondWithResult(_0x79cdbf,null))[_0xdb3a('0x43')](handleError(_0x79cdbf,null));};exports[_0xdb3a('0x25')]=function(_0x28eed9,_0x89c821){return db[_0xdb3a('0x2c')][_0xdb3a('0x47')]({'where':{'id':_0x28eed9[_0xdb3a('0x45')]['id']}})['then'](handleEntityNotFound(_0x89c821,null))[_0xdb3a('0x26')](removeEntity(_0x89c821,null))[_0xdb3a('0x43')](handleError(_0x89c821,null));};exports[_0xdb3a('0x4a')]=function(_0x4acb40,_0x29ae3d,_0x113a55){var _0x55e48b={};var _0x5bf884={};var _0x12d260;var _0x1357b6;return db[_0xdb3a('0x2c')][_0xdb3a('0x4b')]({'where':{'id':_0x4acb40[_0xdb3a('0x45')]['id']}})['then'](handleEntityNotFound(_0x29ae3d,null))['then'](function(_0x330621){if(_0x330621){_0x12d260=_0x330621;_0x5bf884[_0xdb3a('0x2f')]=_[_0xdb3a('0x31')](db[_0xdb3a('0x4c')][_0xdb3a('0x46')]);_0x5bf884[_0xdb3a('0x30')]=_[_0xdb3a('0x31')](_0x4acb40[_0xdb3a('0x30')]);_0x5bf884[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x5bf884[_0xdb3a('0x2f')],_0x5bf884['query']);_0x55e48b['attributes']=_['intersection'](_0x5bf884[_0xdb3a('0x2f')],qs['fields'](_0x4acb40[_0xdb3a('0x30')]['fields']));_0x55e48b[_0xdb3a('0x34')]=_0x55e48b[_0xdb3a('0x34')]['length']?_0x55e48b[_0xdb3a('0x34')]:_0x5bf884[_0xdb3a('0x2f')];_0x55e48b[_0xdb3a('0x38')]=qs[_0xdb3a('0x39')](_0x4acb40[_0xdb3a('0x30')][_0xdb3a('0x39')]);_0x55e48b[_0xdb3a('0x3a')]=qs[_0xdb3a('0x32')](_[_0xdb3a('0x4d')](_0x4acb40['query'],_0x5bf884['filters']));if(_0x4acb40['query'][_0xdb3a('0x3c')]){_0x55e48b[_0xdb3a('0x3a')]=_[_0xdb3a('0x3d')](_0x55e48b[_0xdb3a('0x3a')],{'$or':_[_0xdb3a('0x2b')](_0x55e48b['attributes'],function(_0x244ab9){var _0x18c0e7={};_0x18c0e7[_0x244ab9]={'$like':'%'+_0x4acb40['query']['filter']+'%'};return _0x18c0e7;})});}_0x55e48b=_['merge']({},_0x55e48b,_0x4acb40[_0xdb3a('0x3e')]);return _0x12d260['getConfigurations'](_0x55e48b);}})[_0xdb3a('0x26')](function(_0x4bcfca){if(_0x4bcfca){_0x1357b6=_0x4bcfca[_0xdb3a('0x36')];if(!_0x4acb40[_0xdb3a('0x30')][_0xdb3a('0x4e')](_0xdb3a('0x37'))){_0x55e48b['limit']=qs[_0xdb3a('0x1e')](_0x4acb40[_0xdb3a('0x30')][_0xdb3a('0x1e')]);_0x55e48b[_0xdb3a('0x1c')]=qs['offset'](_0x4acb40[_0xdb3a('0x30')][_0xdb3a('0x1c')]);}return _0x12d260[_0xdb3a('0x4a')](_0x55e48b);}})[_0xdb3a('0x26')](function(_0x31dc06){if(_0x31dc06){return _0x31dc06?{'count':_0x1357b6,'rows':_0x31dc06}:null;}})[_0xdb3a('0x26')](respondWithResult(_0x29ae3d,null))['catch'](handleError(_0x29ae3d,null));};exports[_0xdb3a('0x4f')]=function(_0x39d256,_0x32801b,_0x23c19c){if(_0x39d256[_0xdb3a('0x49')]['id']){delete _0x39d256['body']['id'];}return db['ServicenowAccount'][_0xdb3a('0x4b')]({'where':{'id':_0x39d256[_0xdb3a('0x45')]['id']}})['then'](handleEntityNotFound(_0x32801b,null))[_0xdb3a('0x26')](function(_0x272031){if(_0x272031){_0x39d256[_0xdb3a('0x49')][_0xdb3a('0x50')]=_0x272031['id'];_0x39d256[_0xdb3a('0x49')][_0xdb3a('0x51')]=integrations[_0xdb3a('0x52')](_0x39d256['body'][_0xdb3a('0x53')],_0x39d256['body'][_0xdb3a('0x2e')]);_0x39d256[_0xdb3a('0x49')][_0xdb3a('0x54')]=integrations[_0xdb3a('0x55')](_0x39d256[_0xdb3a('0x49')][_0xdb3a('0x53')],_0x39d256[_0xdb3a('0x49')][_0xdb3a('0x2e')]);return db[_0xdb3a('0x4c')][_0xdb3a('0x48')](_0x39d256['body'],{'include':[{'model':db[_0xdb3a('0x56')],'as':_0xdb3a('0x51')},{'model':db['ServicenowField'],'as':_0xdb3a('0x54')}]});}return null;})[_0xdb3a('0x26')](respondWithResult(_0x32801b,null))[_0xdb3a('0x43')](handleError(_0x32801b,null));};exports[_0xdb3a('0x57')]=function(_0x2f9986,_0x1577ac,_0x2dd356){var _0xc06cd7=[_0xdb3a('0x58'),_0xdb3a('0x59'),_0xdb3a('0x5a'),_0xdb3a('0x5b'),_0xdb3a('0x5c'),_0xdb3a('0x5d'),_0xdb3a('0x5e'),'severity',_0xdb3a('0x5f')];var _0x4a43a1=[_0xdb3a('0x60'),_0xdb3a('0x58'),'caused_by',_0xdb3a('0x61'),_0xdb3a('0x62'),_0xdb3a('0x63'),_0xdb3a('0x64'),_0xdb3a('0x59'),_0xdb3a('0x65'),_0xdb3a('0x66'),'resolved_by','sys_updated_by',_0xdb3a('0x67'),_0xdb3a('0x68'),_0xdb3a('0x69'),_0xdb3a('0x6a'),_0xdb3a('0x6b'),'sys_created_by',_0xdb3a('0x5a'),_0xdb3a('0x38'),_0xdb3a('0x6c'),_0xdb3a('0x6d'),_0xdb3a('0x6e'),_0xdb3a('0x6f'),_0xdb3a('0x70'),'active','work_notes_list',_0xdb3a('0x71'),'priority','sys_domain_path','rfc',_0xdb3a('0x72'),_0xdb3a('0x73'),_0xdb3a('0x74'),_0xdb3a('0x75'),_0xdb3a('0x76'),_0xdb3a('0x77'),_0xdb3a('0x78'),_0xdb3a('0x79'),'caller_id','approval_set',_0xdb3a('0x5b'),'work_notes',_0xdb3a('0x7a'),_0xdb3a('0x5c'),_0xdb3a('0x7b'),'delivery_task',_0xdb3a('0x7c'),_0xdb3a('0x7d'),_0xdb3a('0x7e'),_0xdb3a('0x7f'),'description',_0xdb3a('0x80'),_0xdb3a('0x5d'),_0xdb3a('0x81'),_0xdb3a('0x82'),_0xdb3a('0x83'),_0xdb3a('0x84'),_0xdb3a('0x85'),_0xdb3a('0x86'),_0xdb3a('0x87'),_0xdb3a('0x88'),_0xdb3a('0x5e'),_0xdb3a('0x89'),_0xdb3a('0x8a'),_0xdb3a('0x8b'),'reassignment_count','activity_due',_0xdb3a('0x8c'),_0xdb3a('0x8d'),_0xdb3a('0x8e'),'sla_due',_0xdb3a('0x8f'),_0xdb3a('0x90'),'due_date',_0xdb3a('0x91'),'reopen_count',_0xdb3a('0x92'),'escalation','upon_approval',_0xdb3a('0x93'),_0xdb3a('0x94'),_0xdb3a('0x5f')];var _0x502b19='';var _0x1e24db='';var _0xd388eb=[];var _0x27846f='';var _0x45546d='';var _0x175912=[];var _0x3b65a4='';var _0x222b24='';var _0x376509={};var _0x45a0da='';return db[_0xdb3a('0x2c')]['findOne']({'where':{'id':_0x2f9986[_0xdb3a('0x45')]['id']},'attributes':['id','username','password','email',_0xdb3a('0x95'),_0xdb3a('0x96')]})[_0xdb3a('0x26')](handleEntityNotFound(_0x1577ac,null))[_0xdb3a('0x26')](function(_0x52fb4a){if(_0x52fb4a){_0x45a0da=_0x52fb4a[_0xdb3a('0x95')];var _0x360b14=_0x45a0da['slice'](-0x1);if(_0x360b14==='/'){_0x45a0da=_0x45a0da[_0xdb3a('0x97')](0x0,_0x45a0da[_0xdb3a('0x98')](_0x360b14));}_0x222b24=util['format']('%s/api/now/doc/table/schema/',_0x45a0da);_0x3b65a4=util[_0xdb3a('0x99')]('%s/api/now/table/',_0x45a0da);_0x376509={'user':_0x52fb4a[_0xdb3a('0x9a')],'pass':_0x52fb4a[_0xdb3a('0x9b')]};var _0x36e9e4={'method':_0xdb3a('0x9c'),'uri':_0x222b24+_0xdb3a('0x9d'),'auth':_0x376509,'json':!![]};return rp(_0x36e9e4);}})[_0xdb3a('0x26')](function(_0x2dc491){if(_0x2dc491[_0xdb3a('0x9e')][_0xdb3a('0x36')]>0x0){_0x502b19=_0x2dc491['result'];}console[_0xdb3a('0x9f')](_0xdb3a('0xa0'),_0x502b19);_0x175912=[];_0x1e24db=Object[_0xdb3a('0xa1')]([],_0x502b19);_[_0xdb3a('0xa2')](_0x1e24db,function(_0x5b9a67){return!_0xc06cd7[_0xdb3a('0xa3')](_0x5b9a67['name']);});_0x1e24db[_0xdb3a('0xa4')](function(_0x37ec48){var _0x112918=createFieldObject(_0x3b65a4,_0x376509,_0x37ec48[_0xdb3a('0xa5')],_0x37ec48['name'],_0x37ec48[_0xdb3a('0xa6')],![]);_0x175912[_0xdb3a('0xa7')](_0x112918);});return Promise[_0xdb3a('0xa8')](_0x175912);})[_0xdb3a('0x26')](function(_0x445705){_0xd388eb=_0x445705;_0x27846f=Object['assign']([],_0x502b19);console[_0xdb3a('0x9f')](_0xdb3a('0xa9'),_0x502b19);_[_0xdb3a('0xa2')](_0x27846f,function(_0x1a38f0){return _0x4a43a1['includes'](_0x1a38f0[_0xdb3a('0x28')]);});console[_0xdb3a('0x9f')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x27846f);_0x175912=[];_0x27846f[_0xdb3a('0xa4')](function(_0x534c8e){var _0x5cb27f=createFieldObject(_0x3b65a4,_0x376509,_0x534c8e[_0xdb3a('0xa5')],_0x534c8e[_0xdb3a('0x28')],_0x534c8e['label'],!![]);_0x175912[_0xdb3a('0xa7')](_0x5cb27f);});return Promise['all'](_0x175912);})[_0xdb3a('0x26')](function(_0x599ca2){_0x45546d=_0x599ca2;var _0xb8d7b5=_0xd388eb[_0xdb3a('0xaa')](_0x45546d);return{'count':_0xb8d7b5[_0xdb3a('0x36')],'rows':_0xb8d7b5};})[_0xdb3a('0x26')](respondWithResult(_0x1577ac,null))['catch'](function(_0x57591c){console[_0xdb3a('0x9f')](_0xdb3a('0xab')+_0x57591c);var _0x35b6b8=_0x2f9986[_0xdb3a('0x30')][_0xdb3a('0xac')]?0x1f4:_0x57591c[_0xdb3a('0xad')]||0x1f4;logger[_0xdb3a('0xae')](_0x57591c[_0xdb3a('0x27')]);delete _0x57591c[_0xdb3a('0x28')];if(_0x35b6b8===0x191){_0x35b6b8=0x190;}_0x1577ac[_0xdb3a('0x19')](_0x35b6b8)['send'](_0x2f9986['query'][_0xdb3a('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x57591c[_0xdb3a('0xad')]}:_0x57591c);});};function createFieldObject(_0x2e2e1c,_0x27a252,_0x5bbf13,_0x5c3ee4,_0x11b444,_0x44611a){return new Promise(function(_0x2d06c7,_0x4e791d){var _0x2b0f58={'id':_0x5c3ee4,'name':_0x11b444,'custom':_0x44611a};if(_0x5bbf13===_0xdb3a('0xaf')){_0x2b0f58[_0xdb3a('0x3e')]=[{'name':'True','value':_0xdb3a('0xb0')},{'name':_0xdb3a('0xb1'),'value':_0xdb3a('0xb2')}];_0x2d06c7(_0x2b0f58);}else{var _0x398920={'method':_0xdb3a('0x9c'),'uri':_0x2e2e1c+'sys_choice?sysparm_query=name=incident^element='+_0x5c3ee4,'auth':_0x27a252,'json':!![]};return rp(_0x398920)[_0xdb3a('0x26')](function(_0x2a49c4){var _0x3510da=[];if(_0x2a49c4[_0xdb3a('0x9e')][_0xdb3a('0x36')]>0x0){_0x2a49c4[_0xdb3a('0x9e')][_0xdb3a('0xa4')](function(_0x131c90){if(_0x131c90[_0xdb3a('0xb3')]==='false'){var _0x34773f={'name':_0x131c90[_0xdb3a('0xa6')],'value':_0x131c90[_0xdb3a('0xb4')]};_0x3510da[_0xdb3a('0xa7')](_0x34773f);}});}_0x2b0f58[_0xdb3a('0x3e')]=_0x3510da;if(_0x2b0f58[_0xdb3a('0x3e')]['length']>0x0){_0x2d06c7(_0x2b0f58);}else{if(_0x44611a==![]){_0x2d06c7();}else{_0x2d06c7(_0x2b0f58);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5a3333e..f0e4c61 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 _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x2f1cf8,_0x45b3fa){var _0x58d3f0=function(_0x16934f){while(--_0x16934f){_0x2f1cf8['push'](_0x2f1cf8['shift']());}};_0x58d3f0(++_0x45b3fa);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5244f,_0x364747){_0x5244f=_0x5244f-0x0;var _0x364623=_0xdc97[_0x5244f];return _0x364623;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x578f34,_0x4b1866){var _0x1220d9=function(_0x5bbfd0){while(--_0x5bbfd0){_0x578f34['push'](_0x578f34['shift']());}};_0x1220d9(++_0x4b1866);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4992a7,_0x483cde){_0x4992a7=_0x4992a7-0x0;var _0x167311=_0x9c5a[_0x4992a7];return _0x167311;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'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 b14a86d..ce6d407 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 _0xd7f5=['jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','include','map','model','attributes','debug','find','where','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x290638,_0x13ba4d){var _0xff8f4f=function(_0x21a548){while(--_0x21a548){_0x290638['push'](_0x290638['shift']());}};_0xff8f4f(++_0x13ba4d);}(_0xd7f5,0x15f));var _0x5d7f=function(_0x4cd22f,_0x57c3ea){_0x4cd22f=_0x4cd22f-0x0;var _0x2342d3=_0xd7f5[_0x4cd22f];return _0x2342d3;};'use strict';var _=require(_0x5d7f('0x0'));var util=require('util');var moment=require(_0x5d7f('0x1'));var BPromise=require(_0x5d7f('0x2'));var rs=require(_0x5d7f('0x3'));var fs=require('fs');var Redis=require(_0x5d7f('0x4'));var db=require(_0x5d7f('0x5'))['db'];var utils=require(_0x5d7f('0x6'));var logger=require('../../config/logger')(_0x5d7f('0x7'));var config=require(_0x5d7f('0x8'));var jayson=require(_0x5d7f('0x9'));var client=jayson['client'][_0x5d7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fefd1,_0x41ff12,_0x163b9a){return new BPromise(function(_0x164982,_0x4ab826){return client[_0x5d7f('0xb')](_0x1fefd1,_0x163b9a)[_0x5d7f('0xc')](function(_0x5cd8ad){logger[_0x5d7f('0xd')](_0x5d7f('0xe'),_0x41ff12,_0x5d7f('0xf'));logger['debug'](_0x5d7f('0x10'),_0x41ff12,'request\x20sent',JSON[_0x5d7f('0x11')](_0x5cd8ad));if(_0x5cd8ad[_0x5d7f('0x12')]){if(_0x5cd8ad[_0x5d7f('0x12')][_0x5d7f('0x13')]===0x1f4){logger[_0x5d7f('0x12')](_0x5d7f('0xe'),_0x41ff12,_0x5cd8ad['error']['message']);return _0x4ab826(_0x5cd8ad[_0x5d7f('0x12')][_0x5d7f('0x14')]);}logger['error'](_0x5d7f('0xe'),_0x41ff12,_0x5cd8ad[_0x5d7f('0x12')][_0x5d7f('0x14')]);return _0x164982(_0x5cd8ad[_0x5d7f('0x12')][_0x5d7f('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x41ff12,_0x5d7f('0xf'));_0x164982(_0x5cd8ad[_0x5d7f('0x15')][_0x5d7f('0x14')]);}})[_0x5d7f('0x16')](function(_0x3e3783){logger[_0x5d7f('0x12')](_0x5d7f('0xe'),_0x41ff12,_0x3e3783);_0x4ab826(_0x3e3783);});});}exports[_0x5d7f('0x17')]=function(_0x27894a){var _0x517db0=this;return new Promise(function(_0x2dfb56,_0x3a3184){return db[_0x5d7f('0x18')][_0x5d7f('0x19')]({'raw':_0x27894a[_0x5d7f('0x1a')]?_0x27894a[_0x5d7f('0x1a')][_0x5d7f('0x1b')]===undefined?!![]:![]:!![],'where':_0x27894a[_0x5d7f('0x1a')]?_0x27894a['options']['where']||null:null,'attributes':_0x27894a[_0x5d7f('0x1a')]?_0x27894a[_0x5d7f('0x1a')]['attributes']||null:null,'limit':_0x27894a[_0x5d7f('0x1a')]?_0x27894a[_0x5d7f('0x1a')]['limit']||null:null,'include':_0x27894a[_0x5d7f('0x1a')]?_0x27894a['options'][_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x27894a[_0x5d7f('0x1a')][_0x5d7f('0x1c')],function(_0x4d0f78){return{'model':db[_0x4d0f78[_0x5d7f('0x1e')]],'as':_0x4d0f78['as'],'attributes':_0x4d0f78[_0x5d7f('0x1f')],'include':_0x4d0f78[_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x4d0f78['include'],function(_0x48c665){return{'model':db[_0x48c665[_0x5d7f('0x1e')]],'as':_0x48c665['as'],'attributes':_0x48c665[_0x5d7f('0x1f')],'include':_0x48c665[_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x48c665[_0x5d7f('0x1c')],function(_0x50a2ed){return{'model':db[_0x50a2ed[_0x5d7f('0x1e')]],'as':_0x50a2ed['as'],'attributes':_0x50a2ed[_0x5d7f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b214e){logger[_0x5d7f('0xd')](_0x5d7f('0x17'),_0x27894a);logger[_0x5d7f('0x20')](_0x5d7f('0x17'),_0x27894a,JSON[_0x5d7f('0x11')](_0x3b214e));_0x2dfb56(_0x3b214e);})['catch'](function(_0x56e561){logger[_0x5d7f('0x12')](_0x5d7f('0x17'),_0x56e561[_0x5d7f('0x14')],_0x27894a);_0x3a3184(_0x517db0[_0x5d7f('0x12')](0x1f4,_0x56e561['message']));});});};exports['ShowServicenowAccount']=function(_0x28d555){var _0x395796=this;return new Promise(function(_0x5a09b4,_0x528594){return db[_0x5d7f('0x18')][_0x5d7f('0x21')]({'raw':_0x28d555[_0x5d7f('0x1a')]?_0x28d555['options'][_0x5d7f('0x1b')]===undefined?!![]:![]:!![],'where':_0x28d555['options']?_0x28d555['options'][_0x5d7f('0x22')]||null:null,'attributes':_0x28d555[_0x5d7f('0x1a')]?_0x28d555['options']['attributes']||null:null,'include':_0x28d555[_0x5d7f('0x1a')]?_0x28d555[_0x5d7f('0x1a')][_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x28d555[_0x5d7f('0x1a')]['include'],function(_0x4c3a4a){return{'model':db[_0x4c3a4a[_0x5d7f('0x1e')]],'as':_0x4c3a4a['as'],'attributes':_0x4c3a4a[_0x5d7f('0x1f')],'include':_0x4c3a4a[_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x4c3a4a[_0x5d7f('0x1c')],function(_0x197f5b){return{'model':db[_0x197f5b[_0x5d7f('0x1e')]],'as':_0x197f5b['as'],'attributes':_0x197f5b[_0x5d7f('0x1f')],'include':_0x197f5b[_0x5d7f('0x1c')]?_[_0x5d7f('0x1d')](_0x197f5b['include'],function(_0x4f0345){return{'model':db[_0x4f0345[_0x5d7f('0x1e')]],'as':_0x4f0345['as'],'attributes':_0x4f0345['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d7f('0xc')](function(_0x22dcd6){logger[_0x5d7f('0xd')](_0x5d7f('0x23'),_0x28d555);logger[_0x5d7f('0x20')](_0x5d7f('0x23'),_0x28d555,JSON[_0x5d7f('0x11')](_0x22dcd6));_0x5a09b4(_0x22dcd6);})[_0x5d7f('0x16')](function(_0x540bc2){logger[_0x5d7f('0x12')](_0x5d7f('0x23'),_0x540bc2[_0x5d7f('0x14')],_0x28d555);_0x528594(_0x395796['error'](0x1f4,_0x540bc2[_0x5d7f('0x14')]));});});}; \ No newline at end of file +var _0x031b=['map','model','then','info','catch','ShowServicenowAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x031b,0x186));var _0xb031=function(_0x1386ef,_0x3e459d){_0x1386ef=_0x1386ef-0x0;var _0x8490be=_0x031b[_0x1386ef];return _0x8490be;};'use strict';var _=require(_0xb031('0x0'));var util=require(_0xb031('0x1'));var moment=require(_0xb031('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb031('0x3'));var db=require(_0xb031('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb031('0x5'))('rpc');var config=require(_0xb031('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb031('0x7')][_0xb031('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d3992,_0x7ff680,_0x146c16){return new BPromise(function(_0x35df98,_0x572fd7){return client['request'](_0x3d3992,_0x146c16)['then'](function(_0x4fd310){logger['info'](_0xb031('0x9'),_0x7ff680,_0xb031('0xa'));logger[_0xb031('0xb')](_0xb031('0xc'),_0x7ff680,_0xb031('0xa'),JSON[_0xb031('0xd')](_0x4fd310));if(_0x4fd310[_0xb031('0xe')]){if(_0x4fd310['error'][_0xb031('0xf')]===0x1f4){logger[_0xb031('0xe')](_0xb031('0x9'),_0x7ff680,_0x4fd310[_0xb031('0xe')]['message']);return _0x572fd7(_0x4fd310[_0xb031('0xe')][_0xb031('0x10')]);}logger[_0xb031('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x7ff680,_0x4fd310[_0xb031('0xe')]['message']);return _0x35df98(_0x4fd310[_0xb031('0xe')][_0xb031('0x10')]);}else{logger['info'](_0xb031('0x9'),_0x7ff680,_0xb031('0xa'));_0x35df98(_0x4fd310[_0xb031('0x11')][_0xb031('0x10')]);}})['catch'](function(_0x1e1940){logger[_0xb031('0xe')](_0xb031('0x9'),_0x7ff680,_0x1e1940);_0x572fd7(_0x1e1940);});});}exports[_0xb031('0x12')]=function(_0x16f1b5){var _0xc372d1=this;return new Promise(function(_0x4bba8a,_0x4263be){return db[_0xb031('0x13')]['findAll']({'raw':_0x16f1b5[_0xb031('0x14')]?_0x16f1b5['options'][_0xb031('0x15')]===undefined?!![]:![]:!![],'where':_0x16f1b5[_0xb031('0x14')]?_0x16f1b5[_0xb031('0x14')][_0xb031('0x16')]||null:null,'attributes':_0x16f1b5[_0xb031('0x14')]?_0x16f1b5[_0xb031('0x14')][_0xb031('0x17')]||null:null,'limit':_0x16f1b5[_0xb031('0x14')]?_0x16f1b5['options'][_0xb031('0x18')]||null:null,'include':_0x16f1b5[_0xb031('0x14')]?_0x16f1b5['options'][_0xb031('0x19')]?_[_0xb031('0x1a')](_0x16f1b5[_0xb031('0x14')][_0xb031('0x19')],function(_0x460021){return{'model':db[_0x460021[_0xb031('0x1b')]],'as':_0x460021['as'],'attributes':_0x460021[_0xb031('0x17')],'include':_0x460021[_0xb031('0x19')]?_['map'](_0x460021[_0xb031('0x19')],function(_0x49ab0c){return{'model':db[_0x49ab0c['model']],'as':_0x49ab0c['as'],'attributes':_0x49ab0c[_0xb031('0x17')],'include':_0x49ab0c[_0xb031('0x19')]?_[_0xb031('0x1a')](_0x49ab0c['include'],function(_0x35cd73){return{'model':db[_0x35cd73[_0xb031('0x1b')]],'as':_0x35cd73['as'],'attributes':_0x35cd73[_0xb031('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb031('0x1c')](function(_0x3d68be){logger[_0xb031('0x1d')](_0xb031('0x12'),_0x16f1b5);logger[_0xb031('0xb')]('GetServicenowAccount',_0x16f1b5,JSON[_0xb031('0xd')](_0x3d68be));_0x4bba8a(_0x3d68be);})[_0xb031('0x1e')](function(_0x544bdc){logger['error'](_0xb031('0x12'),_0x544bdc[_0xb031('0x10')],_0x16f1b5);_0x4263be(_0xc372d1[_0xb031('0xe')](0x1f4,_0x544bdc[_0xb031('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x2099a1){var _0x5c2ccc=this;return new Promise(function(_0x37382c,_0x44f5c9){return db['ServicenowAccount']['find']({'raw':_0x2099a1[_0xb031('0x14')]?_0x2099a1[_0xb031('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2099a1[_0xb031('0x14')]?_0x2099a1['options']['where']||null:null,'attributes':_0x2099a1[_0xb031('0x14')]?_0x2099a1[_0xb031('0x14')][_0xb031('0x17')]||null:null,'include':_0x2099a1['options']?_0x2099a1['options'][_0xb031('0x19')]?_[_0xb031('0x1a')](_0x2099a1[_0xb031('0x14')][_0xb031('0x19')],function(_0x2427fd){return{'model':db[_0x2427fd[_0xb031('0x1b')]],'as':_0x2427fd['as'],'attributes':_0x2427fd[_0xb031('0x17')],'include':_0x2427fd['include']?_[_0xb031('0x1a')](_0x2427fd['include'],function(_0x2f0e98){return{'model':db[_0x2f0e98[_0xb031('0x1b')]],'as':_0x2f0e98['as'],'attributes':_0x2f0e98['attributes'],'include':_0x2f0e98['include']?_['map'](_0x2f0e98['include'],function(_0x222599){return{'model':db[_0x222599['model']],'as':_0x222599['as'],'attributes':_0x222599[_0xb031('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3efccc){logger[_0xb031('0x1d')](_0xb031('0x1f'),_0x2099a1);logger[_0xb031('0xb')](_0xb031('0x1f'),_0x2099a1,JSON[_0xb031('0xd')](_0x3efccc));_0x37382c(_0x3efccc);})[_0xb031('0x1e')](function(_0x3d1bd3){logger[_0xb031('0xe')](_0xb031('0x1f'),_0x3d1bd3[_0xb031('0x10')],_0x2099a1);_0x44f5c9(_0x5c2ccc[_0xb031('0xe')](0x1f4,_0x3d1bd3[_0xb031('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 13d9945..fbcac73 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 _0xb585=['../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xb585,0xfe));var _0x5b58=function(_0x3c20e2,_0x562f86){_0x3c20e2=_0x3c20e2-0x0;var _0x5005cd=_0xb585[_0x3c20e2];return _0x5005cd;};'use strict';var multer=require('multer');var util=require(_0x5b58('0x0'));var path=require(_0x5b58('0x1'));var timeout=require(_0x5b58('0x2'));var express=require(_0x5b58('0x3'));var router=express[_0x5b58('0x4')]();var fs_extra=require(_0x5b58('0x5'));var auth=require(_0x5b58('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b58('0x7'));router[_0x5b58('0x8')]('/',auth[_0x5b58('0x9')](),controller['index']);router['get'](_0x5b58('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5b58('0x8')]('/:id/fields',auth[_0x5b58('0x9')](),controller['getFields']);router['get'](_0x5b58('0xb'),auth[_0x5b58('0x9')](),controller[_0x5b58('0xc')]);router[_0x5b58('0x8')](_0x5b58('0xd'),auth[_0x5b58('0x9')](),controller['getDescriptions']);router[_0x5b58('0xe')]('/',auth[_0x5b58('0x9')](),controller[_0x5b58('0xf')]);router[_0x5b58('0x10')](_0x5b58('0xa'),auth[_0x5b58('0x9')](),controller[_0x5b58('0x11')]);router[_0x5b58('0x12')](_0x5b58('0xa'),auth[_0x5b58('0x9')](),controller[_0x5b58('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8fde=['/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getSubjects'];(function(_0x39249b,_0x95190){var _0x5bb65f=function(_0x40bfb3){while(--_0x40bfb3){_0x39249b['push'](_0x39249b['shift']());}};_0x5bb65f(++_0x95190);}(_0x8fde,0x1bd));var _0xe8fd=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x8fde[_0x3070dc];return _0x431489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8fd('0x0'));var timeout=require(_0xe8fd('0x1'));var express=require(_0xe8fd('0x2'));var router=express[_0xe8fd('0x3')]();var fs_extra=require(_0xe8fd('0x4'));var auth=require(_0xe8fd('0x5'));var interaction=require(_0xe8fd('0x6'));var config=require('../../config/environment');var controller=require(_0xe8fd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8fd('0x8')]);router[_0xe8fd('0x9')](_0xe8fd('0xa'),auth['isAuthenticated'](),controller[_0xe8fd('0xb')]);router[_0xe8fd('0x9')](_0xe8fd('0xc'),auth[_0xe8fd('0xd')](),controller['getFields']);router[_0xe8fd('0x9')]('/:id/subjects',auth[_0xe8fd('0xd')](),controller[_0xe8fd('0xe')]);router['get'](_0xe8fd('0xf'),auth[_0xe8fd('0xd')](),controller[_0xe8fd('0x10')]);router[_0xe8fd('0x11')]('/',auth['isAuthenticated'](),controller[_0xe8fd('0x12')]);router[_0xe8fd('0x13')]('/:id',auth[_0xe8fd('0xd')](),controller[_0xe8fd('0x14')]);router['delete'](_0xe8fd('0xa'),auth[_0xe8fd('0xd')](),controller[_0xe8fd('0x15')]);module[_0xe8fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 796ab2c..3cf5c99 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 _0x6e25=['exports','STRING','sequelize'];(function(_0xa25039,_0x2bf601){var _0x3b0776=function(_0x1efc65){while(--_0x1efc65){_0xa25039['push'](_0xa25039['shift']());}};_0x3b0776(++_0x2bf601);}(_0x6e25,0xda));var _0x56e2=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x6e25[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require(_0x56e2('0x0'));module[_0x56e2('0x1')]={'name':{'type':Sequelize[_0x56e2('0x2')]},'description':{'type':Sequelize[_0x56e2('0x2')]}}; \ No newline at end of file +var _0x9cd1=['sequelize','STRING'];(function(_0x33ac69,_0x4e428d){var _0x4715a7=function(_0x2d1077){while(--_0x2d1077){_0x33ac69['push'](_0x33ac69['shift']());}};_0x4715a7(++_0x4e428d);}(_0x9cd1,0x11c));var _0x19cd=function(_0x5034de,_0x1f010c){_0x5034de=_0x5034de-0x0;var _0x347e46=_0x9cd1[_0x5034de];return _0x347e46;};'use strict';var Sequelize=require(_0x19cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x19cd('0x1')]},'description':{'type':Sequelize[_0x19cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2799595..d4911de 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 _0x9ccc=['keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','update','body','destroy','getFields','ServicenowField','pick','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','then','end','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','query'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x9ccc,0x107));var _0xc9cc=function(_0x4bd063,_0x5d09e9){_0x4bd063=_0x4bd063-0x0;var _0x363c3b=_0x9ccc[_0x4bd063];return _0x363c3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9cc('0x0'));var zipdir=require(_0xc9cc('0x1'));var jsonpatch=require(_0xc9cc('0x2'));var rp=require(_0xc9cc('0x3'));var moment=require('moment');var BPromise=require(_0xc9cc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc9cc('0x5'));var ejs=require(_0xc9cc('0x6'));var fs=require('fs');var fs_extra=require(_0xc9cc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9cc('0x8'));var jsforce=require(_0xc9cc('0x9'));var deskjs=require(_0xc9cc('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc9cc('0xb'));var Papa=require(_0xc9cc('0xc'));var Redis=require(_0xc9cc('0xd'));var authService=require(_0xc9cc('0xe'));var qs=require(_0xc9cc('0xf'));var as=require(_0xc9cc('0x10'));var hardwareService=require(_0xc9cc('0x11'));var logger=require('../../config/logger')(_0xc9cc('0x12'));var utils=require(_0xc9cc('0x13'));var config=require(_0xc9cc('0x14'));var licenseUtil=require(_0xc9cc('0x15'));var db=require(_0xc9cc('0x16'))['db'];function respondWithStatusCode(_0x3a2697,_0x36d66d){_0x36d66d=_0x36d66d||0xcc;return function(_0x1853d1){if(_0x1853d1){return _0x3a2697[_0xc9cc('0x17')](_0x36d66d);}return _0x3a2697[_0xc9cc('0x18')](_0x36d66d)['end']();};}function respondWithResult(_0x387dc6,_0x143e00){_0x143e00=_0x143e00||0xc8;return function(_0x30f2d0){if(_0x30f2d0){return _0x387dc6[_0xc9cc('0x18')](_0x143e00)[_0xc9cc('0x19')](_0x30f2d0);}};}function respondWithFilteredResult(_0x261eef,_0x5d574a){return function(_0x37f55c){if(_0x37f55c){var _0x637ad8=typeof _0x5d574a[_0xc9cc('0x1a')]===_0xc9cc('0x1b')&&typeof _0x5d574a[_0xc9cc('0x1c')]===_0xc9cc('0x1b');var _0x1b1aaf=_0x37f55c[_0xc9cc('0x1d')];var _0x3dcac0=_0x637ad8?0x0:_0x5d574a[_0xc9cc('0x1a')];var _0x4f675a=_0x637ad8?_0x37f55c['count']:_0x5d574a['offset']+_0x5d574a[_0xc9cc('0x1c')];var _0x4a74ad;if(_0x4f675a>=_0x1b1aaf){_0x4f675a=_0x1b1aaf;_0x4a74ad=0xc8;}else{_0x4a74ad=0xce;}_0x261eef[_0xc9cc('0x18')](_0x4a74ad);return _0x261eef['set']('Content-Range',_0x3dcac0+'-'+_0x4f675a+'/'+_0x1b1aaf)[_0xc9cc('0x19')](_0x37f55c);}return null;};}function patchUpdates(_0x29c346){return function(_0x535939){try{jsonpatch[_0xc9cc('0x1e')](_0x535939,_0x29c346,!![]);}catch(_0x18fd28){return BPromise['reject'](_0x18fd28);}return _0x535939['save']();};}function saveUpdates(_0x2a31b2,_0x577d2c){return function(_0x463d69){if(_0x463d69){return _0x463d69['update'](_0x2a31b2)[_0xc9cc('0x1f')](function(_0x4590ed){return _0x4590ed;});}return null;};}function removeEntity(_0x220529,_0x8ae7e3){return function(_0x5e497f){if(_0x5e497f){return _0x5e497f['destroy']()[_0xc9cc('0x1f')](function(){_0x220529[_0xc9cc('0x18')](0xcc)[_0xc9cc('0x20')]();});}};}function handleEntityNotFound(_0x6de4f7,_0x481b3e){return function(_0x568c22){if(!_0x568c22){_0x6de4f7[_0xc9cc('0x17')](0x194);}return _0x568c22;};}function handleError(_0x412001,_0x3b78d9){_0x3b78d9=_0x3b78d9||0x1f4;return function(_0x18c80c){logger[_0xc9cc('0x21')](_0x18c80c[_0xc9cc('0x22')]);if(_0x18c80c[_0xc9cc('0x23')]){delete _0x18c80c[_0xc9cc('0x23')];}_0x412001['status'](_0x3b78d9)[_0xc9cc('0x24')](_0x18c80c);};}exports[_0xc9cc('0x25')]=function(_0x18df8e,_0x495ac8){var _0x22ef85={},_0x72b38e={},_0x1155a0={'count':0x0,'rows':[]};var _0x5e0293=_[_0xc9cc('0x26')](db[_0xc9cc('0x27')]['rawAttributes'],function(_0x28cf2d){return{'name':_0x28cf2d[_0xc9cc('0x28')],'type':_0x28cf2d[_0xc9cc('0x29')][_0xc9cc('0x2a')]};});_0x72b38e[_0xc9cc('0x2b')]=_[_0xc9cc('0x26')](_0x5e0293,_0xc9cc('0x23'));_0x72b38e[_0xc9cc('0x2c')]=_[_0xc9cc('0x2d')](_0x18df8e[_0xc9cc('0x2c')]);_0x72b38e[_0xc9cc('0x2e')]=_[_0xc9cc('0x2f')](_0x72b38e[_0xc9cc('0x2b')],_0x72b38e[_0xc9cc('0x2c')]);_0x22ef85['attributes']=_[_0xc9cc('0x2f')](_0x72b38e['model'],qs['fields'](_0x18df8e[_0xc9cc('0x2c')][_0xc9cc('0x30')]));_0x22ef85[_0xc9cc('0x31')]=_0x22ef85[_0xc9cc('0x31')]['length']?_0x22ef85[_0xc9cc('0x31')]:_0x72b38e[_0xc9cc('0x2b')];if(!_0x18df8e[_0xc9cc('0x2c')][_0xc9cc('0x32')]('nolimit')){_0x22ef85['limit']=qs[_0xc9cc('0x1c')](_0x18df8e['query'][_0xc9cc('0x1c')]);_0x22ef85[_0xc9cc('0x1a')]=qs[_0xc9cc('0x1a')](_0x18df8e[_0xc9cc('0x2c')]['offset']);}_0x22ef85[_0xc9cc('0x33')]=qs['sort'](_0x18df8e['query'][_0xc9cc('0x34')]);_0x22ef85['where']=qs['filters'](_['pick'](_0x18df8e['query'],_0x72b38e[_0xc9cc('0x2e')]),_0x5e0293);if(_0x18df8e['query'][_0xc9cc('0x35')]){_0x22ef85[_0xc9cc('0x36')]=_[_0xc9cc('0x37')](_0x22ef85[_0xc9cc('0x36')],{'$or':_[_0xc9cc('0x26')](_0x5e0293,function(_0xa2cac1){if(_0xa2cac1['type']!=='VIRTUAL'){var _0x41848b={};_0x41848b[_0xa2cac1[_0xc9cc('0x23')]]={'$like':'%'+_0x18df8e[_0xc9cc('0x2c')][_0xc9cc('0x35')]+'%'};return _0x41848b;}})});}_0x22ef85=_[_0xc9cc('0x37')]({},_0x22ef85,_0x18df8e['options']);var _0x2feef6={'where':_0x22ef85[_0xc9cc('0x36')]};return db[_0xc9cc('0x27')][_0xc9cc('0x1d')](_0x2feef6)[_0xc9cc('0x1f')](function(_0x4e6195){_0x1155a0['count']=_0x4e6195;if(_0x18df8e['query'][_0xc9cc('0x38')]){_0x22ef85[_0xc9cc('0x39')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xc9cc('0x3a')](_0x22ef85);})[_0xc9cc('0x1f')](function(_0x2ec721){_0x1155a0['rows']=_0x2ec721;return _0x1155a0;})['then'](respondWithFilteredResult(_0x495ac8,_0x22ef85))[_0xc9cc('0x3b')](handleError(_0x495ac8,null));};exports[_0xc9cc('0x3c')]=function(_0x3724bc,_0x18c802){var _0x598a3b={'raw':![],'where':{'id':_0x3724bc[_0xc9cc('0x3d')]['id']}},_0x31ab73={};_0x31ab73[_0xc9cc('0x2b')]=_[_0xc9cc('0x2d')](db[_0xc9cc('0x27')][_0xc9cc('0x3e')]);_0x31ab73[_0xc9cc('0x2c')]=_[_0xc9cc('0x2d')](_0x3724bc[_0xc9cc('0x2c')]);_0x31ab73[_0xc9cc('0x2e')]=_['intersection'](_0x31ab73[_0xc9cc('0x2b')],_0x31ab73[_0xc9cc('0x2c')]);_0x598a3b[_0xc9cc('0x31')]=_[_0xc9cc('0x2f')](_0x31ab73['model'],qs[_0xc9cc('0x30')](_0x3724bc[_0xc9cc('0x2c')][_0xc9cc('0x30')]));_0x598a3b['attributes']=_0x598a3b['attributes'][_0xc9cc('0x3f')]?_0x598a3b['attributes']:_0x31ab73[_0xc9cc('0x2b')];if(_0x3724bc[_0xc9cc('0x2c')]['includeAll']){_0x598a3b[_0xc9cc('0x39')]=[{'all':!![]}];}_0x598a3b=_[_0xc9cc('0x37')]({},_0x598a3b,_0x3724bc[_0xc9cc('0x40')]);return db[_0xc9cc('0x27')][_0xc9cc('0x41')](_0x598a3b)[_0xc9cc('0x1f')](handleEntityNotFound(_0x18c802,null))['then'](respondWithResult(_0x18c802,null))[_0xc9cc('0x3b')](handleError(_0x18c802,null));};exports[_0xc9cc('0x42')]=function(_0x27ec81,_0x3d0f03){return db[_0xc9cc('0x27')][_0xc9cc('0x42')](_0x27ec81['body'],{})[_0xc9cc('0x1f')](respondWithResult(_0x3d0f03,0xc9))[_0xc9cc('0x3b')](handleError(_0x3d0f03,null));};exports[_0xc9cc('0x43')]=function(_0x550121,_0x3b1f18){if(_0x550121[_0xc9cc('0x44')]['id']){delete _0x550121['body']['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x550121['params']['id']}})[_0xc9cc('0x1f')](handleEntityNotFound(_0x3b1f18,null))['then'](saveUpdates(_0x550121[_0xc9cc('0x44')],null))[_0xc9cc('0x1f')](respondWithResult(_0x3b1f18,null))['catch'](handleError(_0x3b1f18,null));};exports[_0xc9cc('0x45')]=function(_0x8daa88,_0x122954){return db[_0xc9cc('0x27')][_0xc9cc('0x41')]({'where':{'id':_0x8daa88[_0xc9cc('0x3d')]['id']}})[_0xc9cc('0x1f')](handleEntityNotFound(_0x122954,null))[_0xc9cc('0x1f')](removeEntity(_0x122954,null))[_0xc9cc('0x3b')](handleError(_0x122954,null));};exports[_0xc9cc('0x46')]=function(_0x33ee41,_0x304616,_0x57c273){var _0x5521ca={};var _0x13522d={};var _0x3df0bf;var _0x4c95d4;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x33ee41['params']['id']}})[_0xc9cc('0x1f')](handleEntityNotFound(_0x304616,null))[_0xc9cc('0x1f')](function(_0x4acfde){if(_0x4acfde){_0x3df0bf=_0x4acfde;_0x13522d[_0xc9cc('0x2b')]=_[_0xc9cc('0x2d')](db[_0xc9cc('0x47')][_0xc9cc('0x3e')]);_0x13522d[_0xc9cc('0x2c')]=_[_0xc9cc('0x2d')](_0x33ee41[_0xc9cc('0x2c')]);_0x13522d[_0xc9cc('0x2e')]=_[_0xc9cc('0x2f')](_0x13522d[_0xc9cc('0x2b')],_0x13522d[_0xc9cc('0x2c')]);_0x5521ca[_0xc9cc('0x31')]=_[_0xc9cc('0x2f')](_0x13522d[_0xc9cc('0x2b')],qs[_0xc9cc('0x30')](_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x30')]));_0x5521ca[_0xc9cc('0x31')]=_0x5521ca[_0xc9cc('0x31')]['length']?_0x5521ca[_0xc9cc('0x31')]:_0x13522d['model'];_0x5521ca['order']=qs[_0xc9cc('0x34')](_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x34')]);_0x5521ca[_0xc9cc('0x36')]=qs['filters'](_[_0xc9cc('0x48')](_0x33ee41[_0xc9cc('0x2c')],_0x13522d['filters']));if(_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x35')]){_0x5521ca[_0xc9cc('0x36')]=_[_0xc9cc('0x37')](_0x5521ca[_0xc9cc('0x36')],{'$or':_[_0xc9cc('0x26')](_0x5521ca['attributes'],function(_0x27dfbf){var _0x1a6e6e={};_0x1a6e6e[_0x27dfbf]={'$like':'%'+_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x35')]+'%'};return _0x1a6e6e;})});}_0x5521ca=_[_0xc9cc('0x37')]({},_0x5521ca,_0x33ee41[_0xc9cc('0x40')]);return _0x3df0bf[_0xc9cc('0x46')](_0x5521ca);}})[_0xc9cc('0x1f')](function(_0x24bdf8){if(_0x24bdf8){_0x4c95d4=_0x24bdf8[_0xc9cc('0x3f')];if(!_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x32')](_0xc9cc('0x49'))){_0x5521ca[_0xc9cc('0x1c')]=qs[_0xc9cc('0x1c')](_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x1c')]);_0x5521ca['offset']=qs[_0xc9cc('0x1a')](_0x33ee41[_0xc9cc('0x2c')][_0xc9cc('0x1a')]);}return _0x3df0bf[_0xc9cc('0x46')](_0x5521ca);}})['then'](function(_0x4dd3ad){if(_0x4dd3ad){return _0x4dd3ad?{'count':_0x4c95d4,'rows':_0x4dd3ad}:null;}})[_0xc9cc('0x1f')](respondWithResult(_0x304616,null))[_0xc9cc('0x3b')](handleError(_0x304616,null));};exports[_0xc9cc('0x4a')]=function(_0x8c61b1,_0x325e45,_0x4733b6){var _0x3202f2={};var _0x49658d={};var _0x4a1d29;var _0x36e93c;return db[_0xc9cc('0x27')][_0xc9cc('0x4b')]({'where':{'id':_0x8c61b1[_0xc9cc('0x3d')]['id']}})[_0xc9cc('0x1f')](handleEntityNotFound(_0x325e45,null))[_0xc9cc('0x1f')](function(_0x151123){if(_0x151123){_0x4a1d29=_0x151123;_0x49658d['model']=_['keys'](db[_0xc9cc('0x47')][_0xc9cc('0x3e')]);_0x49658d[_0xc9cc('0x2c')]=_[_0xc9cc('0x2d')](_0x8c61b1[_0xc9cc('0x2c')]);_0x49658d[_0xc9cc('0x2e')]=_[_0xc9cc('0x2f')](_0x49658d[_0xc9cc('0x2b')],_0x49658d[_0xc9cc('0x2c')]);_0x3202f2[_0xc9cc('0x31')]=_[_0xc9cc('0x2f')](_0x49658d[_0xc9cc('0x2b')],qs[_0xc9cc('0x30')](_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x30')]));_0x3202f2[_0xc9cc('0x31')]=_0x3202f2[_0xc9cc('0x31')]['length']?_0x3202f2[_0xc9cc('0x31')]:_0x49658d['model'];_0x3202f2[_0xc9cc('0x33')]=qs['sort'](_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x34')]);_0x3202f2[_0xc9cc('0x36')]=qs[_0xc9cc('0x2e')](_[_0xc9cc('0x48')](_0x8c61b1['query'],_0x49658d[_0xc9cc('0x2e')]));if(_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x35')]){_0x3202f2[_0xc9cc('0x36')]=_['merge'](_0x3202f2[_0xc9cc('0x36')],{'$or':_[_0xc9cc('0x26')](_0x3202f2[_0xc9cc('0x31')],function(_0x106db9){var _0x39219b={};_0x39219b[_0x106db9]={'$like':'%'+_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x35')]+'%'};return _0x39219b;})});}_0x3202f2=_[_0xc9cc('0x37')]({},_0x3202f2,_0x8c61b1[_0xc9cc('0x40')]);return _0x4a1d29['getSubjects'](_0x3202f2);}})[_0xc9cc('0x1f')](function(_0x4ddd39){if(_0x4ddd39){_0x36e93c=_0x4ddd39[_0xc9cc('0x3f')];if(!_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x32')](_0xc9cc('0x49'))){_0x3202f2[_0xc9cc('0x1c')]=qs[_0xc9cc('0x1c')](_0x8c61b1[_0xc9cc('0x2c')][_0xc9cc('0x1c')]);_0x3202f2[_0xc9cc('0x1a')]=qs[_0xc9cc('0x1a')](_0x8c61b1['query'][_0xc9cc('0x1a')]);}return _0x4a1d29[_0xc9cc('0x4a')](_0x3202f2);}})[_0xc9cc('0x1f')](function(_0x49cdfb){if(_0x49cdfb){return _0x49cdfb?{'count':_0x36e93c,'rows':_0x49cdfb}:null;}})[_0xc9cc('0x1f')](respondWithResult(_0x325e45,null))[_0xc9cc('0x3b')](handleError(_0x325e45,null));};exports[_0xc9cc('0x4c')]=function(_0x27ea43,_0x43d238,_0x1ea63b){var _0x2e8b7f={};var _0x562163={};var _0x5c7abb;var _0x536489;return db[_0xc9cc('0x27')]['findOne']({'where':{'id':_0x27ea43[_0xc9cc('0x3d')]['id']}})['then'](handleEntityNotFound(_0x43d238,null))[_0xc9cc('0x1f')](function(_0x528f93){if(_0x528f93){_0x5c7abb=_0x528f93;_0x562163[_0xc9cc('0x2b')]=_[_0xc9cc('0x2d')](db['ServicenowField'][_0xc9cc('0x3e')]);_0x562163[_0xc9cc('0x2c')]=_[_0xc9cc('0x2d')](_0x27ea43['query']);_0x562163[_0xc9cc('0x2e')]=_[_0xc9cc('0x2f')](_0x562163[_0xc9cc('0x2b')],_0x562163[_0xc9cc('0x2c')]);_0x2e8b7f[_0xc9cc('0x31')]=_[_0xc9cc('0x2f')](_0x562163[_0xc9cc('0x2b')],qs[_0xc9cc('0x30')](_0x27ea43[_0xc9cc('0x2c')][_0xc9cc('0x30')]));_0x2e8b7f[_0xc9cc('0x31')]=_0x2e8b7f[_0xc9cc('0x31')]['length']?_0x2e8b7f[_0xc9cc('0x31')]:_0x562163[_0xc9cc('0x2b')];_0x2e8b7f['order']=qs[_0xc9cc('0x34')](_0x27ea43['query']['sort']);_0x2e8b7f['where']=qs[_0xc9cc('0x2e')](_[_0xc9cc('0x48')](_0x27ea43[_0xc9cc('0x2c')],_0x562163[_0xc9cc('0x2e')]));if(_0x27ea43[_0xc9cc('0x2c')]['filter']){_0x2e8b7f[_0xc9cc('0x36')]=_['merge'](_0x2e8b7f['where'],{'$or':_['map'](_0x2e8b7f['attributes'],function(_0x23aee8){var _0x5f26bc={};_0x5f26bc[_0x23aee8]={'$like':'%'+_0x27ea43[_0xc9cc('0x2c')]['filter']+'%'};return _0x5f26bc;})});}_0x2e8b7f=_[_0xc9cc('0x37')]({},_0x2e8b7f,_0x27ea43[_0xc9cc('0x40')]);return _0x5c7abb[_0xc9cc('0x4c')](_0x2e8b7f);}})[_0xc9cc('0x1f')](function(_0x182a25){if(_0x182a25){_0x536489=_0x182a25['length'];if(!_0x27ea43[_0xc9cc('0x2c')][_0xc9cc('0x32')](_0xc9cc('0x49'))){_0x2e8b7f['limit']=qs[_0xc9cc('0x1c')](_0x27ea43['query'][_0xc9cc('0x1c')]);_0x2e8b7f[_0xc9cc('0x1a')]=qs[_0xc9cc('0x1a')](_0x27ea43[_0xc9cc('0x2c')][_0xc9cc('0x1a')]);}return _0x5c7abb[_0xc9cc('0x4c')](_0x2e8b7f);}})['then'](function(_0x3e324d){if(_0x3e324d){return _0x3e324d?{'count':_0x536489,'rows':_0x3e324d}:null;}})[_0xc9cc('0x1f')](respondWithResult(_0x43d238,null))['catch'](handleError(_0x43d238,null));}; \ No newline at end of file +var _0x5eaf=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','keys','options','create','body','find','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x1f54f4,_0x3b19b3){var _0xb08144=function(_0xd1ae73){while(--_0xd1ae73){_0x1f54f4['push'](_0x1f54f4['shift']());}};_0xb08144(++_0x3b19b3);}(_0x5eaf,0x96));var _0xf5ea=function(_0x3da696,_0x53e7fe){_0x3da696=_0x3da696-0x0;var _0x25288d=_0x5eaf[_0x3da696];return _0x25288d;};'use strict';var emlformat=require(_0xf5ea('0x0'));var rimraf=require(_0xf5ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf5ea('0x2'));var BPromise=require(_0xf5ea('0x3'));var Mustache=require('mustache');var util=require(_0xf5ea('0x4'));var path=require(_0xf5ea('0x5'));var sox=require(_0xf5ea('0x6'));var csv=require(_0xf5ea('0x7'));var ejs=require(_0xf5ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf5ea('0x9'));var _=require('lodash');var squel=require(_0xf5ea('0xa'));var crypto=require(_0xf5ea('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf5ea('0xc'));var toCsv=require(_0xf5ea('0x7'));var querystring=require(_0xf5ea('0xd'));var Papa=require(_0xf5ea('0xe'));var Redis=require(_0xf5ea('0xf'));var authService=require(_0xf5ea('0x10'));var qs=require(_0xf5ea('0x11'));var as=require(_0xf5ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ea('0x13'))(_0xf5ea('0x14'));var utils=require(_0xf5ea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5ea('0x16'));var db=require(_0xf5ea('0x17'))['db'];function respondWithStatusCode(_0x83cef9,_0xdd4760){_0xdd4760=_0xdd4760||0xcc;return function(_0x984b34){if(_0x984b34){return _0x83cef9[_0xf5ea('0x18')](_0xdd4760);}return _0x83cef9[_0xf5ea('0x19')](_0xdd4760)['end']();};}function respondWithResult(_0x216a89,_0x2a9047){_0x2a9047=_0x2a9047||0xc8;return function(_0x524ec4){if(_0x524ec4){return _0x216a89['status'](_0x2a9047)[_0xf5ea('0x1a')](_0x524ec4);}};}function respondWithFilteredResult(_0x468e24,_0x5b54d1){return function(_0x3a4c18){if(_0x3a4c18){var _0xdf8b6=typeof _0x5b54d1['offset']===_0xf5ea('0x1b')&&typeof _0x5b54d1[_0xf5ea('0x1c')]==='undefined';var _0x4ace45=_0x3a4c18[_0xf5ea('0x1d')];var _0x4bb25e=_0xdf8b6?0x0:_0x5b54d1['offset'];var _0x3ca41c=_0xdf8b6?_0x3a4c18['count']:_0x5b54d1[_0xf5ea('0x1e')]+_0x5b54d1['limit'];var _0xbbaad7;if(_0x3ca41c>=_0x4ace45){_0x3ca41c=_0x4ace45;_0xbbaad7=0xc8;}else{_0xbbaad7=0xce;}_0x468e24[_0xf5ea('0x19')](_0xbbaad7);return _0x468e24[_0xf5ea('0x1f')](_0xf5ea('0x20'),_0x4bb25e+'-'+_0x3ca41c+'/'+_0x4ace45)[_0xf5ea('0x1a')](_0x3a4c18);}return null;};}function patchUpdates(_0x513efc){return function(_0x384412){try{jsonpatch[_0xf5ea('0x21')](_0x384412,_0x513efc,!![]);}catch(_0x50809a){return BPromise[_0xf5ea('0x22')](_0x50809a);}return _0x384412[_0xf5ea('0x23')]();};}function saveUpdates(_0x264eb1,_0x171525){return function(_0xcc482){if(_0xcc482){return _0xcc482[_0xf5ea('0x24')](_0x264eb1)[_0xf5ea('0x25')](function(_0x35e30b){return _0x35e30b;});}return null;};}function removeEntity(_0x2508d9,_0xff6d6a){return function(_0x3a784a){if(_0x3a784a){return _0x3a784a[_0xf5ea('0x26')]()[_0xf5ea('0x25')](function(){_0x2508d9[_0xf5ea('0x19')](0xcc)[_0xf5ea('0x27')]();});}};}function handleEntityNotFound(_0x2fb7a3,_0x122a61){return function(_0x29c180){if(!_0x29c180){_0x2fb7a3[_0xf5ea('0x18')](0x194);}return _0x29c180;};}function handleError(_0x14e8bf,_0x23a756){_0x23a756=_0x23a756||0x1f4;return function(_0x521f38){logger['error'](_0x521f38[_0xf5ea('0x28')]);if(_0x521f38[_0xf5ea('0x29')]){delete _0x521f38[_0xf5ea('0x29')];}_0x14e8bf[_0xf5ea('0x19')](_0x23a756)[_0xf5ea('0x2a')](_0x521f38);};}exports[_0xf5ea('0x2b')]=function(_0x537436,_0x4b7041){var _0x3e1951={},_0x5d77b2={},_0x2fd988={'count':0x0,'rows':[]};var _0x39e177=_[_0xf5ea('0x2c')](db[_0xf5ea('0x2d')]['rawAttributes'],function(_0x1d97c7){return{'name':_0x1d97c7[_0xf5ea('0x2e')],'type':_0x1d97c7[_0xf5ea('0x2f')][_0xf5ea('0x30')]};});_0x5d77b2['model']=_[_0xf5ea('0x2c')](_0x39e177,_0xf5ea('0x29'));_0x5d77b2[_0xf5ea('0x31')]=_['keys'](_0x537436['query']);_0x5d77b2[_0xf5ea('0x32')]=_[_0xf5ea('0x33')](_0x5d77b2['model'],_0x5d77b2[_0xf5ea('0x31')]);_0x3e1951[_0xf5ea('0x34')]=_[_0xf5ea('0x33')](_0x5d77b2['model'],qs[_0xf5ea('0x35')](_0x537436[_0xf5ea('0x31')]['fields']));_0x3e1951[_0xf5ea('0x34')]=_0x3e1951[_0xf5ea('0x34')][_0xf5ea('0x36')]?_0x3e1951[_0xf5ea('0x34')]:_0x5d77b2[_0xf5ea('0x37')];if(!_0x537436[_0xf5ea('0x31')]['hasOwnProperty'](_0xf5ea('0x38'))){_0x3e1951[_0xf5ea('0x1c')]=qs[_0xf5ea('0x1c')](_0x537436[_0xf5ea('0x31')][_0xf5ea('0x1c')]);_0x3e1951['offset']=qs[_0xf5ea('0x1e')](_0x537436['query'][_0xf5ea('0x1e')]);}_0x3e1951[_0xf5ea('0x39')]=qs['sort'](_0x537436[_0xf5ea('0x31')][_0xf5ea('0x3a')]);_0x3e1951['where']=qs[_0xf5ea('0x32')](_[_0xf5ea('0x3b')](_0x537436[_0xf5ea('0x31')],_0x5d77b2['filters']),_0x39e177);if(_0x537436[_0xf5ea('0x31')][_0xf5ea('0x3c')]){_0x3e1951[_0xf5ea('0x3d')]=_['merge'](_0x3e1951[_0xf5ea('0x3d')],{'$or':_[_0xf5ea('0x2c')](_0x39e177,function(_0x3e69c1){if(_0x3e69c1[_0xf5ea('0x2f')]!==_0xf5ea('0x3e')){var _0x494212={};_0x494212[_0x3e69c1[_0xf5ea('0x29')]]={'$like':'%'+_0x537436[_0xf5ea('0x31')][_0xf5ea('0x3c')]+'%'};return _0x494212;}})});}_0x3e1951=_[_0xf5ea('0x3f')]({},_0x3e1951,_0x537436['options']);var _0x160274={'where':_0x3e1951[_0xf5ea('0x3d')]};return db[_0xf5ea('0x2d')][_0xf5ea('0x1d')](_0x160274)[_0xf5ea('0x25')](function(_0x367051){_0x2fd988[_0xf5ea('0x1d')]=_0x367051;if(_0x537436[_0xf5ea('0x31')][_0xf5ea('0x40')]){_0x3e1951[_0xf5ea('0x41')]=[{'all':!![]}];}return db[_0xf5ea('0x2d')][_0xf5ea('0x42')](_0x3e1951);})[_0xf5ea('0x25')](function(_0x2f577b){_0x2fd988['rows']=_0x2f577b;return _0x2fd988;})[_0xf5ea('0x25')](respondWithFilteredResult(_0x4b7041,_0x3e1951))[_0xf5ea('0x43')](handleError(_0x4b7041,null));};exports[_0xf5ea('0x44')]=function(_0x3a792a,_0x406b50){var _0x38a08d={'raw':![],'where':{'id':_0x3a792a[_0xf5ea('0x45')]['id']}},_0x6d4245={};_0x6d4245[_0xf5ea('0x37')]=_['keys'](db[_0xf5ea('0x2d')][_0xf5ea('0x46')]);_0x6d4245[_0xf5ea('0x31')]=_[_0xf5ea('0x47')](_0x3a792a[_0xf5ea('0x31')]);_0x6d4245['filters']=_[_0xf5ea('0x33')](_0x6d4245['model'],_0x6d4245[_0xf5ea('0x31')]);_0x38a08d[_0xf5ea('0x34')]=_[_0xf5ea('0x33')](_0x6d4245[_0xf5ea('0x37')],qs[_0xf5ea('0x35')](_0x3a792a[_0xf5ea('0x31')][_0xf5ea('0x35')]));_0x38a08d[_0xf5ea('0x34')]=_0x38a08d[_0xf5ea('0x34')]['length']?_0x38a08d[_0xf5ea('0x34')]:_0x6d4245[_0xf5ea('0x37')];if(_0x3a792a['query'][_0xf5ea('0x40')]){_0x38a08d[_0xf5ea('0x41')]=[{'all':!![]}];}_0x38a08d=_[_0xf5ea('0x3f')]({},_0x38a08d,_0x3a792a[_0xf5ea('0x48')]);return db[_0xf5ea('0x2d')]['find'](_0x38a08d)['then'](handleEntityNotFound(_0x406b50,null))[_0xf5ea('0x25')](respondWithResult(_0x406b50,null))[_0xf5ea('0x43')](handleError(_0x406b50,null));};exports[_0xf5ea('0x49')]=function(_0x10f530,_0x255f90){return db[_0xf5ea('0x2d')][_0xf5ea('0x49')](_0x10f530['body'],{})[_0xf5ea('0x25')](respondWithResult(_0x255f90,0xc9))[_0xf5ea('0x43')](handleError(_0x255f90,null));};exports[_0xf5ea('0x24')]=function(_0x53ff92,_0x9a6a9e){if(_0x53ff92[_0xf5ea('0x4a')]['id']){delete _0x53ff92[_0xf5ea('0x4a')]['id'];}return db[_0xf5ea('0x2d')][_0xf5ea('0x4b')]({'where':{'id':_0x53ff92[_0xf5ea('0x45')]['id']}})[_0xf5ea('0x25')](handleEntityNotFound(_0x9a6a9e,null))[_0xf5ea('0x25')](saveUpdates(_0x53ff92[_0xf5ea('0x4a')],null))[_0xf5ea('0x25')](respondWithResult(_0x9a6a9e,null))[_0xf5ea('0x43')](handleError(_0x9a6a9e,null));};exports[_0xf5ea('0x26')]=function(_0x47b4d7,_0x31eb05){return db[_0xf5ea('0x2d')]['find']({'where':{'id':_0x47b4d7['params']['id']}})['then'](handleEntityNotFound(_0x31eb05,null))[_0xf5ea('0x25')](removeEntity(_0x31eb05,null))[_0xf5ea('0x43')](handleError(_0x31eb05,null));};exports[_0xf5ea('0x4c')]=function(_0x33c691,_0x4d637c,_0x5d2b6a){var _0x4fe7b0={};var _0xee5abe={};var _0x249ab0;var _0x58ea3f;return db[_0xf5ea('0x2d')][_0xf5ea('0x4d')]({'where':{'id':_0x33c691[_0xf5ea('0x45')]['id']}})[_0xf5ea('0x25')](handleEntityNotFound(_0x4d637c,null))[_0xf5ea('0x25')](function(_0x37cb19){if(_0x37cb19){_0x249ab0=_0x37cb19;_0xee5abe['model']=_[_0xf5ea('0x47')](db[_0xf5ea('0x4e')][_0xf5ea('0x46')]);_0xee5abe[_0xf5ea('0x31')]=_[_0xf5ea('0x47')](_0x33c691[_0xf5ea('0x31')]);_0xee5abe[_0xf5ea('0x32')]=_[_0xf5ea('0x33')](_0xee5abe['model'],_0xee5abe[_0xf5ea('0x31')]);_0x4fe7b0['attributes']=_[_0xf5ea('0x33')](_0xee5abe[_0xf5ea('0x37')],qs[_0xf5ea('0x35')](_0x33c691[_0xf5ea('0x31')][_0xf5ea('0x35')]));_0x4fe7b0['attributes']=_0x4fe7b0[_0xf5ea('0x34')][_0xf5ea('0x36')]?_0x4fe7b0[_0xf5ea('0x34')]:_0xee5abe[_0xf5ea('0x37')];_0x4fe7b0[_0xf5ea('0x39')]=qs[_0xf5ea('0x3a')](_0x33c691[_0xf5ea('0x31')][_0xf5ea('0x3a')]);_0x4fe7b0['where']=qs[_0xf5ea('0x32')](_['pick'](_0x33c691['query'],_0xee5abe['filters']));if(_0x33c691['query'][_0xf5ea('0x3c')]){_0x4fe7b0[_0xf5ea('0x3d')]=_[_0xf5ea('0x3f')](_0x4fe7b0[_0xf5ea('0x3d')],{'$or':_[_0xf5ea('0x2c')](_0x4fe7b0[_0xf5ea('0x34')],function(_0x5e85f5){var _0x21ed18={};_0x21ed18[_0x5e85f5]={'$like':'%'+_0x33c691[_0xf5ea('0x31')][_0xf5ea('0x3c')]+'%'};return _0x21ed18;})});}_0x4fe7b0=_[_0xf5ea('0x3f')]({},_0x4fe7b0,_0x33c691[_0xf5ea('0x48')]);return _0x249ab0[_0xf5ea('0x4c')](_0x4fe7b0);}})[_0xf5ea('0x25')](function(_0x31e768){if(_0x31e768){_0x58ea3f=_0x31e768[_0xf5ea('0x36')];if(!_0x33c691['query'][_0xf5ea('0x4f')](_0xf5ea('0x38'))){_0x4fe7b0['limit']=qs['limit'](_0x33c691[_0xf5ea('0x31')][_0xf5ea('0x1c')]);_0x4fe7b0['offset']=qs[_0xf5ea('0x1e')](_0x33c691['query'][_0xf5ea('0x1e')]);}return _0x249ab0[_0xf5ea('0x4c')](_0x4fe7b0);}})[_0xf5ea('0x25')](function(_0x35d764){if(_0x35d764){return _0x35d764?{'count':_0x58ea3f,'rows':_0x35d764}:null;}})[_0xf5ea('0x25')](respondWithResult(_0x4d637c,null))[_0xf5ea('0x43')](handleError(_0x4d637c,null));};exports['getSubjects']=function(_0x3d800c,_0x5c826d,_0x360872){var _0x270f96={};var _0x4bfb43={};var _0x449c4d;var _0x329d6d;return db[_0xf5ea('0x2d')][_0xf5ea('0x4d')]({'where':{'id':_0x3d800c[_0xf5ea('0x45')]['id']}})[_0xf5ea('0x25')](handleEntityNotFound(_0x5c826d,null))['then'](function(_0x5c17dd){if(_0x5c17dd){_0x449c4d=_0x5c17dd;_0x4bfb43['model']=_['keys'](db[_0xf5ea('0x4e')]['rawAttributes']);_0x4bfb43[_0xf5ea('0x31')]=_['keys'](_0x3d800c[_0xf5ea('0x31')]);_0x4bfb43['filters']=_[_0xf5ea('0x33')](_0x4bfb43[_0xf5ea('0x37')],_0x4bfb43[_0xf5ea('0x31')]);_0x270f96[_0xf5ea('0x34')]=_[_0xf5ea('0x33')](_0x4bfb43[_0xf5ea('0x37')],qs['fields'](_0x3d800c['query'][_0xf5ea('0x35')]));_0x270f96[_0xf5ea('0x34')]=_0x270f96[_0xf5ea('0x34')][_0xf5ea('0x36')]?_0x270f96['attributes']:_0x4bfb43[_0xf5ea('0x37')];_0x270f96[_0xf5ea('0x39')]=qs[_0xf5ea('0x3a')](_0x3d800c[_0xf5ea('0x31')][_0xf5ea('0x3a')]);_0x270f96[_0xf5ea('0x3d')]=qs['filters'](_[_0xf5ea('0x3b')](_0x3d800c[_0xf5ea('0x31')],_0x4bfb43[_0xf5ea('0x32')]));if(_0x3d800c[_0xf5ea('0x31')][_0xf5ea('0x3c')]){_0x270f96[_0xf5ea('0x3d')]=_[_0xf5ea('0x3f')](_0x270f96[_0xf5ea('0x3d')],{'$or':_[_0xf5ea('0x2c')](_0x270f96[_0xf5ea('0x34')],function(_0x5f3d70){var _0x26cde7={};_0x26cde7[_0x5f3d70]={'$like':'%'+_0x3d800c[_0xf5ea('0x31')][_0xf5ea('0x3c')]+'%'};return _0x26cde7;})});}_0x270f96=_['merge']({},_0x270f96,_0x3d800c[_0xf5ea('0x48')]);return _0x449c4d['getSubjects'](_0x270f96);}})[_0xf5ea('0x25')](function(_0x395b81){if(_0x395b81){_0x329d6d=_0x395b81[_0xf5ea('0x36')];if(!_0x3d800c[_0xf5ea('0x31')][_0xf5ea('0x4f')](_0xf5ea('0x38'))){_0x270f96[_0xf5ea('0x1c')]=qs['limit'](_0x3d800c['query'][_0xf5ea('0x1c')]);_0x270f96['offset']=qs[_0xf5ea('0x1e')](_0x3d800c[_0xf5ea('0x31')][_0xf5ea('0x1e')]);}return _0x449c4d[_0xf5ea('0x50')](_0x270f96);}})['then'](function(_0x55aecf){if(_0x55aecf){return _0x55aecf?{'count':_0x329d6d,'rows':_0x55aecf}:null;}})['then'](respondWithResult(_0x5c826d,null))['catch'](handleError(_0x5c826d,null));};exports[_0xf5ea('0x51')]=function(_0x4c7066,_0x479eaa,_0x103c9e){var _0x456bce={};var _0x246114={};var _0x40c7c6;var _0x579e73;return db[_0xf5ea('0x2d')][_0xf5ea('0x4d')]({'where':{'id':_0x4c7066[_0xf5ea('0x45')]['id']}})[_0xf5ea('0x25')](handleEntityNotFound(_0x479eaa,null))[_0xf5ea('0x25')](function(_0x3cf17d){if(_0x3cf17d){_0x40c7c6=_0x3cf17d;_0x246114[_0xf5ea('0x37')]=_['keys'](db['ServicenowField'][_0xf5ea('0x46')]);_0x246114[_0xf5ea('0x31')]=_[_0xf5ea('0x47')](_0x4c7066[_0xf5ea('0x31')]);_0x246114[_0xf5ea('0x32')]=_[_0xf5ea('0x33')](_0x246114[_0xf5ea('0x37')],_0x246114[_0xf5ea('0x31')]);_0x456bce[_0xf5ea('0x34')]=_[_0xf5ea('0x33')](_0x246114['model'],qs['fields'](_0x4c7066[_0xf5ea('0x31')][_0xf5ea('0x35')]));_0x456bce[_0xf5ea('0x34')]=_0x456bce['attributes'][_0xf5ea('0x36')]?_0x456bce[_0xf5ea('0x34')]:_0x246114['model'];_0x456bce['order']=qs[_0xf5ea('0x3a')](_0x4c7066[_0xf5ea('0x31')][_0xf5ea('0x3a')]);_0x456bce['where']=qs[_0xf5ea('0x32')](_['pick'](_0x4c7066['query'],_0x246114[_0xf5ea('0x32')]));if(_0x4c7066['query']['filter']){_0x456bce[_0xf5ea('0x3d')]=_[_0xf5ea('0x3f')](_0x456bce['where'],{'$or':_[_0xf5ea('0x2c')](_0x456bce[_0xf5ea('0x34')],function(_0x1ac5e6){var _0x45d6ef={};_0x45d6ef[_0x1ac5e6]={'$like':'%'+_0x4c7066[_0xf5ea('0x31')]['filter']+'%'};return _0x45d6ef;})});}_0x456bce=_[_0xf5ea('0x3f')]({},_0x456bce,_0x4c7066[_0xf5ea('0x48')]);return _0x40c7c6[_0xf5ea('0x51')](_0x456bce);}})[_0xf5ea('0x25')](function(_0x493e18){if(_0x493e18){_0x579e73=_0x493e18[_0xf5ea('0x36')];if(!_0x4c7066['query']['hasOwnProperty'](_0xf5ea('0x38'))){_0x456bce[_0xf5ea('0x1c')]=qs[_0xf5ea('0x1c')](_0x4c7066[_0xf5ea('0x31')][_0xf5ea('0x1c')]);_0x456bce['offset']=qs[_0xf5ea('0x1e')](_0x4c7066[_0xf5ea('0x31')][_0xf5ea('0x1e')]);}return _0x40c7c6[_0xf5ea('0x51')](_0x456bce);}})[_0xf5ea('0x25')](function(_0x6e3115){if(_0x6e3115){return _0x6e3115?{'count':_0x579e73,'rows':_0x6e3115}:null;}})[_0xf5ea('0x25')](respondWithResult(_0x479eaa,null))[_0xf5ea('0x43')](handleError(_0x479eaa,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9570351..b992f89 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 _0x3f40=['path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise'];(function(_0x23858d,_0x50db66){var _0xda4fd6=function(_0x544772){while(--_0x544772){_0x23858d['push'](_0x23858d['shift']());}};_0xda4fd6(++_0x50db66);}(_0x3f40,0xbb));var _0x03f4=function(_0x1f38e1,_0x35ec04){_0x1f38e1=_0x1f38e1-0x0;var _0x742ee1=_0x3f40[_0x1f38e1];return _0x742ee1;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var logger=require(_0x03f4('0x2'))('api');var moment=require(_0x03f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x03f4('0x4'));var fs=require('fs');var path=require(_0x03f4('0x5'));var rimraf=require(_0x03f4('0x6'));var config=require(_0x03f4('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x03f4('0x8')]=function(_0x3b42bb,_0x196b64){return _0x3b42bb[_0x03f4('0x9')](_0x03f4('0xa'),attributes,{'tableName':_0x03f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cd6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x576357,_0x4b7bb9){_0x576357=_0x576357-0x0;var _0x55cbdf=_0x7cd6[_0x576357];return _0x55cbdf;};'use strict';var _=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var logger=require(_0x67cd('0x2'))(_0x67cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67cd('0x4'));var fs=require('fs');var path=require(_0x67cd('0x5'));var rimraf=require(_0x67cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x67cd('0x7'));module['exports']=function(_0x218c1c,_0x2cec15){return _0x218c1c[_0x67cd('0x8')](_0x67cd('0x9'),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 ba4347b..bd2ed83 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 _0xc130=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xc130,0x7c));var _0x0c13=function(_0x1a2e2e,_0x507045){_0x1a2e2e=_0x1a2e2e-0x0;var _0x41666b=_0xc130[_0x1a2e2e];return _0x41666b;};'use strict';var _=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var moment=require(_0x0c13('0x2'));var BPromise=require(_0x0c13('0x3'));var rs=require(_0x0c13('0x4'));var fs=require('fs');var Redis=require(_0x0c13('0x5'));var db=require(_0x0c13('0x6'))['db'];var utils=require(_0x0c13('0x7'));var logger=require(_0x0c13('0x8'))(_0x0c13('0x9'));var config=require(_0x0c13('0xa'));var jayson=require(_0x0c13('0xb'));var client=jayson[_0x0c13('0xc')][_0x0c13('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2eaff3,_0x14bc49,_0x36104f){return new BPromise(function(_0x400c1f,_0x4ba593){return client[_0x0c13('0xe')](_0x2eaff3,_0x36104f)[_0x0c13('0xf')](function(_0x582c1f){logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));logger['debug'](_0x0c13('0x13'),_0x14bc49,'request\x20sent',JSON[_0x0c13('0x14')](_0x582c1f));if(_0x582c1f[_0x0c13('0x15')]){if(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x16')]===0x1f4){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x4ba593(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x400c1f(_0x582c1f[_0x0c13('0x15')]['message']);}else{logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));_0x400c1f(_0x582c1f['result'][_0x0c13('0x17')]);}})[_0x0c13('0x18')](function(_0x2e5791){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x2e5791);_0x4ba593(_0x2e5791);});});} \ No newline at end of file +var _0xe3e4=['request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x15ebbe,_0x14f8fc){var _0x3ff72e=function(_0x1e9085){while(--_0x1e9085){_0x15ebbe['push'](_0x15ebbe['shift']());}};_0x3ff72e(++_0x14f8fc);}(_0xe3e4,0xc3));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4e3e('0x0'));var util=require(_0x4e3e('0x1'));var moment=require(_0x4e3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e3e('0x3'));var fs=require('fs');var Redis=require(_0x4e3e('0x4'));var db=require(_0x4e3e('0x5'))['db'];var utils=require(_0x4e3e('0x6'));var logger=require(_0x4e3e('0x7'))('rpc');var config=require(_0x4e3e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e3e('0x9')][_0x4e3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f5942,_0x1edbea,_0x33c6dd){return new BPromise(function(_0x2727c7,_0x1b794e){return client[_0x4e3e('0xb')](_0x2f5942,_0x33c6dd)[_0x4e3e('0xc')](function(_0x2baa65){logger[_0x4e3e('0xd')](_0x4e3e('0xe'),_0x1edbea,_0x4e3e('0xf'));logger[_0x4e3e('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1edbea,_0x4e3e('0xf'),JSON[_0x4e3e('0x11')](_0x2baa65));if(_0x2baa65[_0x4e3e('0x12')]){if(_0x2baa65['error'][_0x4e3e('0x13')]===0x1f4){logger['error'](_0x4e3e('0xe'),_0x1edbea,_0x2baa65['error']['message']);return _0x1b794e(_0x2baa65[_0x4e3e('0x12')]['message']);}logger['error'](_0x4e3e('0xe'),_0x1edbea,_0x2baa65[_0x4e3e('0x12')][_0x4e3e('0x14')]);return _0x2727c7(_0x2baa65['error']['message']);}else{logger[_0x4e3e('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1edbea,_0x4e3e('0xf'));_0x2727c7(_0x2baa65['result'][_0x4e3e('0x14')]);}})['catch'](function(_0x58f8db){logger[_0x4e3e('0x12')](_0x4e3e('0xe'),_0x1edbea,_0x58f8db);_0x1b794e(_0x58f8db);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 97ea0eb..bf4c104 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 _0x7d09=['get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x539866,_0x3f84e3){var _0x435137=function(_0x10666d){while(--_0x10666d){_0x539866['push'](_0x539866['shift']());}};_0x435137(++_0x3f84e3);}(_0x7d09,0x1e5));var _0x97d0=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x7d09[_0x1b5aea];return _0x51cae9;};'use strict';var multer=require(_0x97d0('0x0'));var util=require(_0x97d0('0x1'));var path=require(_0x97d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x97d0('0x3'));var router=express['Router']();var fs_extra=require(_0x97d0('0x4'));var auth=require(_0x97d0('0x5'));var interaction=require(_0x97d0('0x6'));var config=require(_0x97d0('0x7'));var controller=require(_0x97d0('0x8'));router[_0x97d0('0x9')]('/',auth[_0x97d0('0xa')](),controller[_0x97d0('0xb')]);router['get'](_0x97d0('0xc'),auth[_0x97d0('0xa')](),controller[_0x97d0('0xd')]);router[_0x97d0('0xe')]('/',auth[_0x97d0('0xa')](),controller[_0x97d0('0xf')]);router[_0x97d0('0x10')]('/:id',auth[_0x97d0('0xa')](),controller['update']);router[_0x97d0('0x11')](_0x97d0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x97d0('0x12')]=router; \ No newline at end of file +var _0x6fe1=['post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated'];(function(_0x2e7c69,_0x25327c){var _0x1b84c1=function(_0x5cdcfe){while(--_0x5cdcfe){_0x2e7c69['push'](_0x2e7c69['shift']());}};_0x1b84c1(++_0x25327c);}(_0x6fe1,0xbb));var _0x16fe=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x6fe1[_0x58e469];return _0x4c01c5;};'use strict';var multer=require('multer');var util=require(_0x16fe('0x0'));var path=require(_0x16fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x16fe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16fe('0x3'));var interaction=require(_0x16fe('0x4'));var config=require(_0x16fe('0x5'));var controller=require(_0x16fe('0x6'));router[_0x16fe('0x7')]('/',auth['isAuthenticated'](),controller[_0x16fe('0x8')]);router[_0x16fe('0x7')](_0x16fe('0x9'),auth[_0x16fe('0xa')](),controller['show']);router[_0x16fe('0xb')]('/',auth[_0x16fe('0xa')](),controller[_0x16fe('0xc')]);router[_0x16fe('0xd')]('/:id',auth[_0x16fe('0xa')](),controller[_0x16fe('0xe')]);router[_0x16fe('0xf')](_0x16fe('0x9'),auth[_0x16fe('0xa')](),controller[_0x16fe('0x10')]);module[_0x16fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 93d8ccd..c2d2025 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 _0x8c53=['ENUM','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x3c2a0d,_0x1d352d){var _0x30b0e7=function(_0x5f3b0d){while(--_0x5f3b0d){_0x3c2a0d['push'](_0x3c2a0d['shift']());}};_0x30b0e7(++_0x1d352d);}(_0x8c53,0x172));var _0x38c5=function(_0x4f8b6a,_0x2ead69){_0x4f8b6a=_0x4f8b6a-0x0;var _0x192d31=_0x8c53[_0x4f8b6a];return _0x192d31;};'use strict';var Sequelize=require(_0x38c5('0x0'));module[_0x38c5('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x38c5('0x2'),_0x38c5('0x3'),_0x38c5('0x4'),_0x38c5('0x5')),'defaultValue':_0x38c5('0x6')},'content':{'type':Sequelize[_0x38c5('0x7')]},'key':{'type':Sequelize[_0x38c5('0x7')]},'keyType':{'type':Sequelize[_0x38c5('0x8')](_0x38c5('0x6'),_0x38c5('0x2'),_0x38c5('0x3'))},'keyContent':{'type':Sequelize[_0x38c5('0x7')]},'idField':{'type':Sequelize[_0x38c5('0x7')]},'nameField':{'type':Sequelize[_0x38c5('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38c5('0x7')]}}; \ No newline at end of file +var _0xea92=['ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x31f034,_0x57dff8){var _0x591ae4=function(_0x1e32dc){while(--_0x1e32dc){_0x31f034['push'](_0x31f034['shift']());}};_0x591ae4(++_0x57dff8);}(_0xea92,0x6e));var _0x2ea9=function(_0x3d0a1a,_0x422a1b){_0x3d0a1a=_0x3d0a1a-0x0;var _0x21e838=_0xea92[_0x3d0a1a];return _0x21e838;};'use strict';var Sequelize=require(_0x2ea9('0x0'));module[_0x2ea9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x2ea9('0x2'),_0x2ea9('0x3'),_0x2ea9('0x4'),'picklist'),'defaultValue':_0x2ea9('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2ea9('0x6')]},'keyType':{'type':Sequelize[_0x2ea9('0x7')]('string',_0x2ea9('0x2'),_0x2ea9('0x3'))},'keyContent':{'type':Sequelize[_0x2ea9('0x6')]},'idField':{'type':Sequelize[_0x2ea9('0x6')]},'nameField':{'type':Sequelize[_0x2ea9('0x6')]},'customField':{'type':Sequelize[_0x2ea9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ea9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a10c79e..9668858 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 _0x97e8=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','ServicenowField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x16e2f6,_0xc1c6ec){var _0x295f79=function(_0x1eb279){while(--_0x1eb279){_0x16e2f6['push'](_0x16e2f6['shift']());}};_0x295f79(++_0xc1c6ec);}(_0x97e8,0xc0));var _0x897e=function(_0x5ad011,_0x191a65){_0x5ad011=_0x5ad011-0x0;var _0x178367=_0x97e8[_0x5ad011];return _0x178367;};'use strict';var emlformat=require(_0x897e('0x0'));var rimraf=require(_0x897e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x897e('0x2'));var rp=require(_0x897e('0x3'));var moment=require(_0x897e('0x4'));var BPromise=require(_0x897e('0x5'));var Mustache=require(_0x897e('0x6'));var util=require(_0x897e('0x7'));var path=require(_0x897e('0x8'));var sox=require(_0x897e('0x9'));var csv=require(_0x897e('0xa'));var ejs=require(_0x897e('0xb'));var fs=require('fs');var fs_extra=require(_0x897e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x897e('0xd'));var jsforce=require(_0x897e('0xe'));var deskjs=require(_0x897e('0xf'));var toCsv=require(_0x897e('0xa'));var querystring=require('querystring');var Papa=require(_0x897e('0x10'));var Redis=require(_0x897e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x897e('0x12'));var as=require(_0x897e('0x13'));var hardwareService=require(_0x897e('0x14'));var logger=require(_0x897e('0x15'))('api');var utils=require(_0x897e('0x16'));var config=require(_0x897e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6c60,_0x3c0f03){_0x3c0f03=_0x3c0f03||0xcc;return function(_0x34799c){if(_0x34799c){return _0x1d6c60['sendStatus'](_0x3c0f03);}return _0x1d6c60[_0x897e('0x18')](_0x3c0f03)[_0x897e('0x19')]();};}function respondWithResult(_0x7a14c,_0x4c2be7){_0x4c2be7=_0x4c2be7||0xc8;return function(_0x5a8e1f){if(_0x5a8e1f){return _0x7a14c[_0x897e('0x18')](_0x4c2be7)[_0x897e('0x1a')](_0x5a8e1f);}};}function respondWithFilteredResult(_0x54c5be,_0x266ba1){return function(_0x51742e){if(_0x51742e){var _0x1a57fc=typeof _0x266ba1[_0x897e('0x1b')]===_0x897e('0x1c')&&typeof _0x266ba1[_0x897e('0x1d')]===_0x897e('0x1c');var _0x265ead=_0x51742e[_0x897e('0x1e')];var _0x4c8b5d=_0x1a57fc?0x0:_0x266ba1[_0x897e('0x1b')];var _0x18d4c9=_0x1a57fc?_0x51742e[_0x897e('0x1e')]:_0x266ba1['offset']+_0x266ba1[_0x897e('0x1d')];var _0x322776;if(_0x18d4c9>=_0x265ead){_0x18d4c9=_0x265ead;_0x322776=0xc8;}else{_0x322776=0xce;}_0x54c5be['status'](_0x322776);return _0x54c5be[_0x897e('0x1f')](_0x897e('0x20'),_0x4c8b5d+'-'+_0x18d4c9+'/'+_0x265ead)[_0x897e('0x1a')](_0x51742e);}return null;};}function patchUpdates(_0x49095d){return function(_0x25f0a1){try{jsonpatch[_0x897e('0x21')](_0x25f0a1,_0x49095d,!![]);}catch(_0x5c7646){return BPromise['reject'](_0x5c7646);}return _0x25f0a1['save']();};}function saveUpdates(_0x2cfadc,_0x40344d){return function(_0x5aa1fd){if(_0x5aa1fd){return _0x5aa1fd[_0x897e('0x22')](_0x2cfadc)[_0x897e('0x23')](function(_0x582f73){return _0x582f73;});}return null;};}function removeEntity(_0x40ec8d,_0x3a8101){return function(_0x2402a8){if(_0x2402a8){return _0x2402a8[_0x897e('0x24')]()[_0x897e('0x23')](function(){_0x40ec8d['status'](0xcc)[_0x897e('0x19')]();});}};}function handleEntityNotFound(_0x104005,_0xf0044f){return function(_0xb7323c){if(!_0xb7323c){_0x104005['sendStatus'](0x194);}return _0xb7323c;};}function handleError(_0x5566d1,_0x54edbf){_0x54edbf=_0x54edbf||0x1f4;return function(_0x5c5b10){logger[_0x897e('0x25')](_0x5c5b10[_0x897e('0x26')]);if(_0x5c5b10['name']){delete _0x5c5b10[_0x897e('0x27')];}_0x5566d1[_0x897e('0x18')](_0x54edbf)['send'](_0x5c5b10);};}exports[_0x897e('0x28')]=function(_0xd73733,_0x4e208b){var _0xf62494={},_0x20e015={},_0x2de124={'count':0x0,'rows':[]};var _0x1bd3e6=_[_0x897e('0x29')](db[_0x897e('0x2a')]['rawAttributes'],function(_0x2dc276){return{'name':_0x2dc276[_0x897e('0x2b')],'type':_0x2dc276[_0x897e('0x2c')]['key']};});_0x20e015[_0x897e('0x2d')]=_[_0x897e('0x29')](_0x1bd3e6,_0x897e('0x27'));_0x20e015[_0x897e('0x2e')]=_[_0x897e('0x2f')](_0xd73733[_0x897e('0x2e')]);_0x20e015[_0x897e('0x30')]=_[_0x897e('0x31')](_0x20e015[_0x897e('0x2d')],_0x20e015[_0x897e('0x2e')]);_0xf62494[_0x897e('0x32')]=_[_0x897e('0x31')](_0x20e015[_0x897e('0x2d')],qs[_0x897e('0x33')](_0xd73733[_0x897e('0x2e')][_0x897e('0x33')]));_0xf62494[_0x897e('0x32')]=_0xf62494[_0x897e('0x32')]['length']?_0xf62494[_0x897e('0x32')]:_0x20e015['model'];if(!_0xd73733[_0x897e('0x2e')]['hasOwnProperty'](_0x897e('0x34'))){_0xf62494[_0x897e('0x1d')]=qs[_0x897e('0x1d')](_0xd73733[_0x897e('0x2e')][_0x897e('0x1d')]);_0xf62494[_0x897e('0x1b')]=qs[_0x897e('0x1b')](_0xd73733[_0x897e('0x2e')]['offset']);}_0xf62494[_0x897e('0x35')]=qs[_0x897e('0x36')](_0xd73733['query'][_0x897e('0x36')]);_0xf62494[_0x897e('0x37')]=qs[_0x897e('0x30')](_[_0x897e('0x38')](_0xd73733[_0x897e('0x2e')],_0x20e015[_0x897e('0x30')]),_0x1bd3e6);if(_0xd73733[_0x897e('0x2e')]['filter']){_0xf62494[_0x897e('0x37')]=_['merge'](_0xf62494[_0x897e('0x37')],{'$or':_['map'](_0x1bd3e6,function(_0x112fad){if(_0x112fad[_0x897e('0x2c')]!==_0x897e('0x39')){var _0x3674e7={};_0x3674e7[_0x112fad[_0x897e('0x27')]]={'$like':'%'+_0xd73733[_0x897e('0x2e')][_0x897e('0x3a')]+'%'};return _0x3674e7;}})});}_0xf62494=_['merge']({},_0xf62494,_0xd73733['options']);var _0x40189d={'where':_0xf62494[_0x897e('0x37')]};return db[_0x897e('0x2a')][_0x897e('0x1e')](_0x40189d)[_0x897e('0x23')](function(_0x3a00d7){_0x2de124[_0x897e('0x1e')]=_0x3a00d7;if(_0xd73733['query'][_0x897e('0x3b')]){_0xf62494[_0x897e('0x3c')]=[{'all':!![]}];}return db['ServicenowField'][_0x897e('0x3d')](_0xf62494);})[_0x897e('0x23')](function(_0x38a7be){_0x2de124[_0x897e('0x3e')]=_0x38a7be;return _0x2de124;})[_0x897e('0x23')](respondWithFilteredResult(_0x4e208b,_0xf62494))[_0x897e('0x3f')](handleError(_0x4e208b,null));};exports[_0x897e('0x40')]=function(_0x48b585,_0x31251a){var _0x1beafe={'raw':!![],'where':{'id':_0x48b585[_0x897e('0x41')]['id']}},_0x26afef={};_0x26afef[_0x897e('0x2d')]=_[_0x897e('0x2f')](db[_0x897e('0x2a')][_0x897e('0x42')]);_0x26afef[_0x897e('0x2e')]=_['keys'](_0x48b585['query']);_0x26afef['filters']=_[_0x897e('0x31')](_0x26afef[_0x897e('0x2d')],_0x26afef[_0x897e('0x2e')]);_0x1beafe[_0x897e('0x32')]=_['intersection'](_0x26afef[_0x897e('0x2d')],qs[_0x897e('0x33')](_0x48b585[_0x897e('0x2e')][_0x897e('0x33')]));_0x1beafe[_0x897e('0x32')]=_0x1beafe[_0x897e('0x32')]['length']?_0x1beafe[_0x897e('0x32')]:_0x26afef[_0x897e('0x2d')];if(_0x48b585[_0x897e('0x2e')]['includeAll']){_0x1beafe['include']=[{'all':!![]}];}_0x1beafe=_[_0x897e('0x43')]({},_0x1beafe,_0x48b585[_0x897e('0x44')]);return db[_0x897e('0x2a')]['find'](_0x1beafe)[_0x897e('0x23')](handleEntityNotFound(_0x31251a,null))[_0x897e('0x23')](respondWithResult(_0x31251a,null))[_0x897e('0x3f')](handleError(_0x31251a,null));};exports['create']=function(_0x5e5074,_0x6cd297){return db[_0x897e('0x2a')][_0x897e('0x45')](_0x5e5074['body'],{})[_0x897e('0x23')](respondWithResult(_0x6cd297,0xc9))[_0x897e('0x3f')](handleError(_0x6cd297,null));};exports[_0x897e('0x22')]=function(_0x577a3b,_0xa40fcf){if(_0x577a3b['body']['id']){delete _0x577a3b[_0x897e('0x46')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x577a3b[_0x897e('0x41')]['id']}})[_0x897e('0x23')](handleEntityNotFound(_0xa40fcf,null))[_0x897e('0x23')](saveUpdates(_0x577a3b[_0x897e('0x46')],null))[_0x897e('0x23')](respondWithResult(_0xa40fcf,null))[_0x897e('0x3f')](handleError(_0xa40fcf,null));};exports[_0x897e('0x24')]=function(_0x528a05,_0x1e35c3){return db[_0x897e('0x2a')][_0x897e('0x47')]({'where':{'id':_0x528a05['params']['id']}})['then'](handleEntityNotFound(_0x1e35c3,null))[_0x897e('0x23')](removeEntity(_0x1e35c3,null))[_0x897e('0x3f')](handleError(_0x1e35c3,null));}; \ No newline at end of file +var _0xd76c=['includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge','options'];(function(_0x26f6e2,_0x5daf41){var _0x2c7a1a=function(_0x3793db){while(--_0x3793db){_0x26f6e2['push'](_0x26f6e2['shift']());}};_0x2c7a1a(++_0x5daf41);}(_0xd76c,0x1d2));var _0xcd76=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xd76c[_0x496738];return _0xee1381;};'use strict';var emlformat=require(_0xcd76('0x0'));var rimraf=require(_0xcd76('0x1'));var zipdir=require(_0xcd76('0x2'));var jsonpatch=require(_0xcd76('0x3'));var rp=require(_0xcd76('0x4'));var moment=require(_0xcd76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd76('0x6'));var util=require(_0xcd76('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcd76('0x8'));var ejs=require(_0xcd76('0x9'));var fs=require('fs');var fs_extra=require(_0xcd76('0xa'));var _=require(_0xcd76('0xb'));var squel=require(_0xcd76('0xc'));var crypto=require(_0xcd76('0xd'));var jsforce=require(_0xcd76('0xe'));var deskjs=require(_0xcd76('0xf'));var toCsv=require(_0xcd76('0x8'));var querystring=require(_0xcd76('0x10'));var Papa=require(_0xcd76('0x11'));var Redis=require(_0xcd76('0x12'));var authService=require(_0xcd76('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd76('0x14'))(_0xcd76('0x15'));var utils=require(_0xcd76('0x16'));var config=require(_0xcd76('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd76('0x18'))['db'];function respondWithStatusCode(_0x383ace,_0x22939a){_0x22939a=_0x22939a||0xcc;return function(_0x5e6735){if(_0x5e6735){return _0x383ace[_0xcd76('0x19')](_0x22939a);}return _0x383ace['status'](_0x22939a)['end']();};}function respondWithResult(_0x1dbb4c,_0x5c3dfe){_0x5c3dfe=_0x5c3dfe||0xc8;return function(_0x223791){if(_0x223791){return _0x1dbb4c[_0xcd76('0x1a')](_0x5c3dfe)['json'](_0x223791);}};}function respondWithFilteredResult(_0x17efc7,_0x6344d3){return function(_0x37abef){if(_0x37abef){var _0x46f490=typeof _0x6344d3[_0xcd76('0x1b')]===_0xcd76('0x1c')&&typeof _0x6344d3['limit']===_0xcd76('0x1c');var _0x327ecf=_0x37abef['count'];var _0x12d376=_0x46f490?0x0:_0x6344d3[_0xcd76('0x1b')];var _0x670c95=_0x46f490?_0x37abef[_0xcd76('0x1d')]:_0x6344d3[_0xcd76('0x1b')]+_0x6344d3[_0xcd76('0x1e')];var _0x364abe;if(_0x670c95>=_0x327ecf){_0x670c95=_0x327ecf;_0x364abe=0xc8;}else{_0x364abe=0xce;}_0x17efc7[_0xcd76('0x1a')](_0x364abe);return _0x17efc7[_0xcd76('0x1f')](_0xcd76('0x20'),_0x12d376+'-'+_0x670c95+'/'+_0x327ecf)[_0xcd76('0x21')](_0x37abef);}return null;};}function patchUpdates(_0x4d908f){return function(_0x47b090){try{jsonpatch[_0xcd76('0x22')](_0x47b090,_0x4d908f,!![]);}catch(_0x1231fe){return BPromise[_0xcd76('0x23')](_0x1231fe);}return _0x47b090['save']();};}function saveUpdates(_0x4f9563,_0xa3fa08){return function(_0x162532){if(_0x162532){return _0x162532[_0xcd76('0x24')](_0x4f9563)[_0xcd76('0x25')](function(_0xe657ea){return _0xe657ea;});}return null;};}function removeEntity(_0x5c40f4,_0x1c1136){return function(_0x531b93){if(_0x531b93){return _0x531b93[_0xcd76('0x26')]()[_0xcd76('0x25')](function(){_0x5c40f4[_0xcd76('0x1a')](0xcc)[_0xcd76('0x27')]();});}};}function handleEntityNotFound(_0x3a4092,_0x49ee6d){return function(_0x5ba120){if(!_0x5ba120){_0x3a4092[_0xcd76('0x19')](0x194);}return _0x5ba120;};}function handleError(_0x875cd4,_0x1d1007){_0x1d1007=_0x1d1007||0x1f4;return function(_0x26f0ce){logger[_0xcd76('0x28')](_0x26f0ce['stack']);if(_0x26f0ce['name']){delete _0x26f0ce['name'];}_0x875cd4['status'](_0x1d1007)[_0xcd76('0x29')](_0x26f0ce);};}exports[_0xcd76('0x2a')]=function(_0x56abfd,_0xe34adb){var _0x579c6c={},_0x48ec85={},_0x58b4bb={'count':0x0,'rows':[]};var _0x313bc8=_[_0xcd76('0x2b')](db[_0xcd76('0x2c')][_0xcd76('0x2d')],function(_0x5cb55a){return{'name':_0x5cb55a[_0xcd76('0x2e')],'type':_0x5cb55a['type'][_0xcd76('0x2f')]};});_0x48ec85[_0xcd76('0x30')]=_[_0xcd76('0x2b')](_0x313bc8,_0xcd76('0x31'));_0x48ec85[_0xcd76('0x32')]=_[_0xcd76('0x33')](_0x56abfd[_0xcd76('0x32')]);_0x48ec85['filters']=_['intersection'](_0x48ec85['model'],_0x48ec85[_0xcd76('0x32')]);_0x579c6c[_0xcd76('0x34')]=_[_0xcd76('0x35')](_0x48ec85[_0xcd76('0x30')],qs[_0xcd76('0x36')](_0x56abfd[_0xcd76('0x32')][_0xcd76('0x36')]));_0x579c6c['attributes']=_0x579c6c[_0xcd76('0x34')][_0xcd76('0x37')]?_0x579c6c[_0xcd76('0x34')]:_0x48ec85[_0xcd76('0x30')];if(!_0x56abfd[_0xcd76('0x32')][_0xcd76('0x38')]('nolimit')){_0x579c6c[_0xcd76('0x1e')]=qs['limit'](_0x56abfd[_0xcd76('0x32')][_0xcd76('0x1e')]);_0x579c6c[_0xcd76('0x1b')]=qs[_0xcd76('0x1b')](_0x56abfd['query'][_0xcd76('0x1b')]);}_0x579c6c['order']=qs[_0xcd76('0x39')](_0x56abfd[_0xcd76('0x32')][_0xcd76('0x39')]);_0x579c6c[_0xcd76('0x3a')]=qs[_0xcd76('0x3b')](_[_0xcd76('0x3c')](_0x56abfd[_0xcd76('0x32')],_0x48ec85[_0xcd76('0x3b')]),_0x313bc8);if(_0x56abfd[_0xcd76('0x32')][_0xcd76('0x3d')]){_0x579c6c[_0xcd76('0x3a')]=_['merge'](_0x579c6c[_0xcd76('0x3a')],{'$or':_[_0xcd76('0x2b')](_0x313bc8,function(_0x3be8eb){if(_0x3be8eb[_0xcd76('0x3e')]!==_0xcd76('0x3f')){var _0x36c6bc={};_0x36c6bc[_0x3be8eb['name']]={'$like':'%'+_0x56abfd[_0xcd76('0x32')][_0xcd76('0x3d')]+'%'};return _0x36c6bc;}})});}_0x579c6c=_[_0xcd76('0x40')]({},_0x579c6c,_0x56abfd[_0xcd76('0x41')]);var _0x39be24={'where':_0x579c6c[_0xcd76('0x3a')]};return db[_0xcd76('0x2c')]['count'](_0x39be24)[_0xcd76('0x25')](function(_0x121862){_0x58b4bb[_0xcd76('0x1d')]=_0x121862;if(_0x56abfd[_0xcd76('0x32')][_0xcd76('0x42')]){_0x579c6c[_0xcd76('0x43')]=[{'all':!![]}];}return db['ServicenowField'][_0xcd76('0x44')](_0x579c6c);})[_0xcd76('0x25')](function(_0x11fa75){_0x58b4bb[_0xcd76('0x45')]=_0x11fa75;return _0x58b4bb;})['then'](respondWithFilteredResult(_0xe34adb,_0x579c6c))[_0xcd76('0x46')](handleError(_0xe34adb,null));};exports[_0xcd76('0x47')]=function(_0x1fe220,_0x519761){var _0x25001e={'raw':!![],'where':{'id':_0x1fe220[_0xcd76('0x48')]['id']}},_0x36434c={};_0x36434c[_0xcd76('0x30')]=_[_0xcd76('0x33')](db[_0xcd76('0x2c')][_0xcd76('0x2d')]);_0x36434c[_0xcd76('0x32')]=_[_0xcd76('0x33')](_0x1fe220['query']);_0x36434c[_0xcd76('0x3b')]=_[_0xcd76('0x35')](_0x36434c['model'],_0x36434c[_0xcd76('0x32')]);_0x25001e[_0xcd76('0x34')]=_[_0xcd76('0x35')](_0x36434c[_0xcd76('0x30')],qs[_0xcd76('0x36')](_0x1fe220[_0xcd76('0x32')]['fields']));_0x25001e[_0xcd76('0x34')]=_0x25001e['attributes']['length']?_0x25001e[_0xcd76('0x34')]:_0x36434c[_0xcd76('0x30')];if(_0x1fe220[_0xcd76('0x32')][_0xcd76('0x42')]){_0x25001e[_0xcd76('0x43')]=[{'all':!![]}];}_0x25001e=_[_0xcd76('0x40')]({},_0x25001e,_0x1fe220[_0xcd76('0x41')]);return db[_0xcd76('0x2c')][_0xcd76('0x49')](_0x25001e)['then'](handleEntityNotFound(_0x519761,null))[_0xcd76('0x25')](respondWithResult(_0x519761,null))[_0xcd76('0x46')](handleError(_0x519761,null));};exports[_0xcd76('0x4a')]=function(_0x2f210c,_0x10b0bd){return db[_0xcd76('0x2c')][_0xcd76('0x4a')](_0x2f210c[_0xcd76('0x4b')],{})['then'](respondWithResult(_0x10b0bd,0xc9))[_0xcd76('0x46')](handleError(_0x10b0bd,null));};exports[_0xcd76('0x24')]=function(_0x58ea0a,_0x2e419c){if(_0x58ea0a['body']['id']){delete _0x58ea0a[_0xcd76('0x4b')]['id'];}return db['ServicenowField'][_0xcd76('0x49')]({'where':{'id':_0x58ea0a[_0xcd76('0x48')]['id']}})[_0xcd76('0x25')](handleEntityNotFound(_0x2e419c,null))[_0xcd76('0x25')](saveUpdates(_0x58ea0a[_0xcd76('0x4b')],null))[_0xcd76('0x25')](respondWithResult(_0x2e419c,null))[_0xcd76('0x46')](handleError(_0x2e419c,null));};exports[_0xcd76('0x26')]=function(_0x37d30d,_0x19a810){return db[_0xcd76('0x2c')][_0xcd76('0x49')]({'where':{'id':_0x37d30d[_0xcd76('0x48')]['id']}})[_0xcd76('0x25')](handleEntityNotFound(_0x19a810,null))[_0xcd76('0x25')](removeEntity(_0x19a810,null))['catch'](handleError(_0x19a810,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 230cd45..577feee 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 _0xf6e4=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','lodash','util','../../config/logger'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0xf6e4,0x1a1));var _0x4f6e=function(_0x2f582b,_0x4fc550){_0x2f582b=_0x2f582b-0x0;var _0x594706=_0xf6e4[_0x2f582b];return _0x594706;};'use strict';var _=require(_0x4f6e('0x0'));var util=require(_0x4f6e('0x1'));var logger=require(_0x4f6e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f6e('0x3'));var fs=require('fs');var path=require(_0x4f6e('0x4'));var rimraf=require(_0x4f6e('0x5'));var config=require(_0x4f6e('0x6'));var attributes=require(_0x4f6e('0x7'));module[_0x4f6e('0x8')]=function(_0x3de06d,_0xed81){return _0x3de06d[_0x4f6e('0x9')]('ServicenowField',attributes,{'tableName':_0x4f6e('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4f6e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e31=['rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31e042,_0x1808fd){var _0x2c8005=function(_0x4ec0a3){while(--_0x4ec0a3){_0x31e042['push'](_0x31e042['shift']());}};_0x2c8005(++_0x1808fd);}(_0x8e31,0x139));var _0x18e3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x8e31[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x18e3('0x0'));var util=require('util');var logger=require(_0x18e3('0x1'))(_0x18e3('0x2'));var moment=require(_0x18e3('0x3'));var BPromise=require(_0x18e3('0x4'));var rp=require(_0x18e3('0x5'));var fs=require('fs');var path=require(_0x18e3('0x6'));var rimraf=require(_0x18e3('0x7'));var config=require('../../config/environment');var attributes=require(_0x18e3('0x8'));module[_0x18e3('0x9')]=function(_0x25644e,_0x16807a){return _0x25644e[_0x18e3('0xa')](_0x18e3('0xb'),attributes,{'tableName':_0x18e3('0xc'),'paranoid':![],'indexes':[{'name':_0x18e3('0xd'),'fields':[_0x18e3('0xe'),_0x18e3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index cf2d408..47d0ff8 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 _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0xf4eb,0xec));var _0xbf4e=function(_0x494237,_0x2e406b){_0x494237=_0x494237-0x0;var _0x4c994e=_0xf4eb[_0x494237];return _0x4c994e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 23ccbdd..cd92b48 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(_0xe651bc,_0x20f7f1){var _0x1876f5=function(_0x24a1fa){while(--_0x24a1fa){_0xe651bc['push'](_0xe651bc['shift']());}};_0x1876f5(++_0x20f7f1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x17c8e4,_0x568d53){var _0x2d5041=function(_0x76ad43){while(--_0x76ad43){_0x17c8e4['push'](_0x17c8e4['shift']());}};_0x2d5041(++_0x568d53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 668f4c2..75ccce8 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(_0x2eb2ee,_0x1bd381){var _0x59e579=function(_0x16bd1b){while(--_0x16bd1b){_0x2eb2ee['push'](_0x2eb2ee['shift']());}};_0x59e579(++_0x1bd381);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x116b2c,_0x35d54b){var _0x5bd021=function(_0x493757){while(--_0x493757){_0x116b2c['push'](_0x116b2c['shift']());}};_0x5bd021(++_0x35d54b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 fa7e863..ef5bdc1 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 _0x8869=['description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','substring','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','Password\x20Expired','POST','format','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../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','limit','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','getSubjects','channel','Descriptions','Subjects','assigned_user_id'];(function(_0x4ec46b,_0x47fdd6){var _0x297775=function(_0xc2e7a1){while(--_0xc2e7a1){_0x4ec46b['push'](_0x4ec46b['shift']());}};_0x297775(++_0x47fdd6);}(_0x8869,0x94));var _0x9886=function(_0x3200d2,_0x1f0325){_0x3200d2=_0x3200d2-0x0;var _0x81041c=_0x8869[_0x3200d2];return _0x81041c;};'use strict';var emlformat=require(_0x9886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9886('0x1'));var jsonpatch=require(_0x9886('0x2'));var rp=require('request-promise');var moment=require(_0x9886('0x3'));var BPromise=require(_0x9886('0x4'));var Mustache=require(_0x9886('0x5'));var util=require(_0x9886('0x6'));var path=require(_0x9886('0x7'));var sox=require(_0x9886('0x8'));var csv=require('to-csv');var ejs=require(_0x9886('0x9'));var fs=require('fs');var fs_extra=require(_0x9886('0xa'));var _=require('lodash');var squel=require(_0x9886('0xb'));var crypto=require('crypto');var jsforce=require(_0x9886('0xc'));var deskjs=require(_0x9886('0xd'));var toCsv=require(_0x9886('0xe'));var querystring=require(_0x9886('0xf'));var Papa=require(_0x9886('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9886('0x11'));var as=require(_0x9886('0x12'));var hardwareService=require(_0x9886('0x13'));var logger=require(_0x9886('0x14'))(_0x9886('0x15'));var utils=require(_0x9886('0x16'));var config=require(_0x9886('0x17'));var licenseUtil=require(_0x9886('0x18'));var db=require(_0x9886('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14dc2c,_0x25f4de){_0x25f4de=_0x25f4de||0xcc;return function(_0x157ea2){if(_0x157ea2){return _0x14dc2c[_0x9886('0x1a')](_0x25f4de);}return _0x14dc2c[_0x9886('0x1b')](_0x25f4de)[_0x9886('0x1c')]();};}function respondWithResult(_0x3ee199,_0x154902){_0x154902=_0x154902||0xc8;return function(_0x592d16){if(_0x592d16){return _0x3ee199[_0x9886('0x1b')](_0x154902)[_0x9886('0x1d')](_0x592d16);}};}function respondWithFilteredResult(_0x5a80e7,_0x4d7be8){return function(_0x35cfd3){if(_0x35cfd3){var _0x23eccc=typeof _0x4d7be8[_0x9886('0x1e')]==='undefined'&&typeof _0x4d7be8[_0x9886('0x1f')]===_0x9886('0x20');var _0x4e2f8d=_0x35cfd3[_0x9886('0x21')];var _0x47a40c=_0x23eccc?0x0:_0x4d7be8[_0x9886('0x1e')];var _0x31693d=_0x23eccc?_0x35cfd3['count']:_0x4d7be8[_0x9886('0x1e')]+_0x4d7be8[_0x9886('0x1f')];var _0x310dfc;if(_0x31693d>=_0x4e2f8d){_0x31693d=_0x4e2f8d;_0x310dfc=0xc8;}else{_0x310dfc=0xce;}_0x5a80e7[_0x9886('0x1b')](_0x310dfc);return _0x5a80e7['set'](_0x9886('0x22'),_0x47a40c+'-'+_0x31693d+'/'+_0x4e2f8d)[_0x9886('0x1d')](_0x35cfd3);}return null;};}function patchUpdates(_0x8440ac){return function(_0xd2f557){try{jsonpatch['apply'](_0xd2f557,_0x8440ac,!![]);}catch(_0x277254){return BPromise[_0x9886('0x23')](_0x277254);}return _0xd2f557[_0x9886('0x24')]();};}function saveUpdates(_0x2bebde,_0x5e5862){return function(_0x217e53){if(_0x217e53){return _0x217e53['update'](_0x2bebde)[_0x9886('0x25')](function(_0x5c0515){return _0x5c0515;});}return null;};}function removeEntity(_0xa57b88,_0x291ab3){return function(_0xe6b6f7){if(_0xe6b6f7){return _0xe6b6f7[_0x9886('0x26')]()['then'](function(){_0xa57b88['status'](0xcc)[_0x9886('0x1c')]();});}};}function handleEntityNotFound(_0x57fe9c,_0x25136f){return function(_0x4cd295){if(!_0x4cd295){_0x57fe9c[_0x9886('0x1a')](0x194);}return _0x4cd295;};}function handleError(_0xdc4340,_0x3ab8df){_0x3ab8df=_0x3ab8df||0x1f4;return function(_0x5b380){logger[_0x9886('0x27')](_0x5b380[_0x9886('0x28')]);if(_0x5b380[_0x9886('0x29')]){delete _0x5b380[_0x9886('0x29')];}_0xdc4340[_0x9886('0x1b')](_0x3ab8df)[_0x9886('0x2a')](_0x5b380);};}exports['index']=function(_0x410002,_0x3aa06a){var _0x2d035e={},_0x262f8f={},_0x303c87={'count':0x0,'rows':[]};var _0x20247d=_[_0x9886('0x2b')](db['SugarcrmAccount'][_0x9886('0x2c')],function(_0x3f88f3){return{'name':_0x3f88f3[_0x9886('0x2d')],'type':_0x3f88f3[_0x9886('0x2e')][_0x9886('0x2f')]};});_0x262f8f[_0x9886('0x30')]=_[_0x9886('0x2b')](_0x20247d,_0x9886('0x29'));_0x262f8f['query']=_[_0x9886('0x31')](_0x410002[_0x9886('0x32')]);_0x262f8f['filters']=_['intersection'](_0x262f8f[_0x9886('0x30')],_0x262f8f[_0x9886('0x32')]);_0x2d035e[_0x9886('0x33')]=_[_0x9886('0x34')](_0x262f8f[_0x9886('0x30')],qs['fields'](_0x410002['query'][_0x9886('0x35')]));_0x2d035e[_0x9886('0x33')]=_0x2d035e['attributes'][_0x9886('0x36')]?_0x2d035e[_0x9886('0x33')]:_0x262f8f[_0x9886('0x30')];if(!_0x410002['query'][_0x9886('0x37')](_0x9886('0x38'))){_0x2d035e[_0x9886('0x1f')]=qs[_0x9886('0x1f')](_0x410002[_0x9886('0x32')][_0x9886('0x1f')]);_0x2d035e['offset']=qs['offset'](_0x410002[_0x9886('0x32')]['offset']);}_0x2d035e[_0x9886('0x39')]=qs['sort'](_0x410002[_0x9886('0x32')][_0x9886('0x3a')]);_0x2d035e[_0x9886('0x3b')]=qs[_0x9886('0x3c')](_[_0x9886('0x3d')](_0x410002['query'],_0x262f8f['filters']),_0x20247d);if(_0x410002[_0x9886('0x32')][_0x9886('0x3e')]){_0x2d035e[_0x9886('0x3b')]=_[_0x9886('0x3f')](_0x2d035e[_0x9886('0x3b')],{'$or':_[_0x9886('0x2b')](_0x20247d,function(_0x344fca){if(_0x344fca[_0x9886('0x2e')]!=='VIRTUAL'){var _0x4cb2e0={};_0x4cb2e0[_0x344fca[_0x9886('0x29')]]={'$like':'%'+_0x410002['query'][_0x9886('0x3e')]+'%'};return _0x4cb2e0;}})});}_0x2d035e=_[_0x9886('0x3f')]({},_0x2d035e,_0x410002[_0x9886('0x40')]);var _0x5db349={'where':_0x2d035e[_0x9886('0x3b')]};return db[_0x9886('0x41')][_0x9886('0x21')](_0x5db349)[_0x9886('0x25')](function(_0xd9825){_0x303c87[_0x9886('0x21')]=_0xd9825;if(_0x410002[_0x9886('0x32')][_0x9886('0x42')]){_0x2d035e[_0x9886('0x43')]=[{'all':!![]}];}return db[_0x9886('0x41')][_0x9886('0x44')](_0x2d035e);})[_0x9886('0x25')](function(_0x24eab3){_0x303c87[_0x9886('0x45')]=_0x24eab3;return _0x303c87;})[_0x9886('0x25')](respondWithFilteredResult(_0x3aa06a,_0x2d035e))['catch'](handleError(_0x3aa06a,null));};exports[_0x9886('0x46')]=function(_0x333d5b,_0x3ddad2){var _0x5611dd={'raw':![],'where':{'id':_0x333d5b[_0x9886('0x47')]['id']}},_0x300814={};_0x300814[_0x9886('0x30')]=_[_0x9886('0x31')](db[_0x9886('0x41')][_0x9886('0x2c')]);_0x300814[_0x9886('0x32')]=_['keys'](_0x333d5b['query']);_0x300814['filters']=_[_0x9886('0x34')](_0x300814['model'],_0x300814[_0x9886('0x32')]);_0x5611dd[_0x9886('0x33')]=_['intersection'](_0x300814[_0x9886('0x30')],qs[_0x9886('0x35')](_0x333d5b['query'][_0x9886('0x35')]));_0x5611dd[_0x9886('0x33')]=_0x5611dd[_0x9886('0x33')][_0x9886('0x36')]?_0x5611dd[_0x9886('0x33')]:_0x300814['model'];if(_0x333d5b[_0x9886('0x32')]['includeAll']){_0x5611dd['include']=[{'all':!![]}];}_0x5611dd=_[_0x9886('0x3f')]({},_0x5611dd,_0x333d5b['options']);return db[_0x9886('0x41')][_0x9886('0x48')](_0x5611dd)[_0x9886('0x25')](handleEntityNotFound(_0x3ddad2,null))[_0x9886('0x25')](respondWithResult(_0x3ddad2,null))[_0x9886('0x49')](handleError(_0x3ddad2,null));};exports[_0x9886('0x4a')]=function(_0xac8d60,_0x155b64){return db['SugarcrmAccount']['create'](_0xac8d60[_0x9886('0x4b')],{})[_0x9886('0x25')](respondWithResult(_0x155b64,0xc9))[_0x9886('0x49')](handleError(_0x155b64,null));};exports[_0x9886('0x4c')]=function(_0x32f565,_0x52e3e9){if(_0x32f565[_0x9886('0x4b')]['id']){delete _0x32f565[_0x9886('0x4b')]['id'];}return db[_0x9886('0x41')][_0x9886('0x48')]({'where':{'id':_0x32f565[_0x9886('0x47')]['id']}})['then'](handleEntityNotFound(_0x52e3e9,null))[_0x9886('0x25')](saveUpdates(_0x32f565['body'],null))[_0x9886('0x25')](respondWithResult(_0x52e3e9,null))[_0x9886('0x49')](handleError(_0x52e3e9,null));};exports[_0x9886('0x26')]=function(_0x250ee3,_0x5a2559){return db[_0x9886('0x41')]['find']({'where':{'id':_0x250ee3['params']['id']}})['then'](handleEntityNotFound(_0x5a2559,null))[_0x9886('0x25')](removeEntity(_0x5a2559,null))[_0x9886('0x49')](handleError(_0x5a2559,null));};exports[_0x9886('0x4d')]=function(_0x4454c0,_0x3534aa,_0x31b331){var _0x426ce1={};var _0x39f34c={};var _0x5a8f07;var _0xa4b498;return db[_0x9886('0x41')][_0x9886('0x4e')]({'where':{'id':_0x4454c0['params']['id']}})['then'](handleEntityNotFound(_0x3534aa,null))['then'](function(_0x17ec14){if(_0x17ec14){_0x5a8f07=_0x17ec14;_0x39f34c[_0x9886('0x30')]=_[_0x9886('0x31')](db[_0x9886('0x4f')]['rawAttributes']);_0x39f34c[_0x9886('0x32')]=_[_0x9886('0x31')](_0x4454c0[_0x9886('0x32')]);_0x39f34c['filters']=_[_0x9886('0x34')](_0x39f34c[_0x9886('0x30')],_0x39f34c[_0x9886('0x32')]);_0x426ce1[_0x9886('0x33')]=_[_0x9886('0x34')](_0x39f34c['model'],qs[_0x9886('0x35')](_0x4454c0[_0x9886('0x32')]['fields']));_0x426ce1[_0x9886('0x33')]=_0x426ce1[_0x9886('0x33')][_0x9886('0x36')]?_0x426ce1['attributes']:_0x39f34c[_0x9886('0x30')];_0x426ce1['order']=qs[_0x9886('0x3a')](_0x4454c0['query'][_0x9886('0x3a')]);_0x426ce1[_0x9886('0x3b')]=qs[_0x9886('0x3c')](_[_0x9886('0x3d')](_0x4454c0[_0x9886('0x32')],_0x39f34c[_0x9886('0x3c')]));if(_0x4454c0[_0x9886('0x32')][_0x9886('0x3e')]){_0x426ce1[_0x9886('0x3b')]=_[_0x9886('0x3f')](_0x426ce1[_0x9886('0x3b')],{'$or':_[_0x9886('0x2b')](_0x426ce1[_0x9886('0x33')],function(_0x2ff17a){var _0x29af7d={};_0x29af7d[_0x2ff17a]={'$like':'%'+_0x4454c0['query'][_0x9886('0x3e')]+'%'};return _0x29af7d;})});}_0x426ce1=_[_0x9886('0x3f')]({},_0x426ce1,_0x4454c0[_0x9886('0x40')]);return _0x5a8f07['getConfigurations'](_0x426ce1);}})[_0x9886('0x25')](function(_0x25d38b){if(_0x25d38b){_0xa4b498=_0x25d38b[_0x9886('0x36')];if(!_0x4454c0[_0x9886('0x32')]['hasOwnProperty'](_0x9886('0x38'))){_0x426ce1[_0x9886('0x1f')]=qs[_0x9886('0x1f')](_0x4454c0[_0x9886('0x32')][_0x9886('0x1f')]);_0x426ce1[_0x9886('0x1e')]=qs['offset'](_0x4454c0[_0x9886('0x32')][_0x9886('0x1e')]);}return _0x5a8f07[_0x9886('0x4d')](_0x426ce1);}})[_0x9886('0x25')](function(_0x5af28d){if(_0x5af28d){return _0x5af28d?{'count':_0xa4b498,'rows':_0x5af28d}:null;}})['then'](respondWithResult(_0x3534aa,null))['catch'](handleError(_0x3534aa,null));};exports[_0x9886('0x50')]=function(_0xcd2e0f,_0x3a6a4f,_0x1c2717){if(_0xcd2e0f[_0x9886('0x4b')]['id']){delete _0xcd2e0f[_0x9886('0x4b')]['id'];}return db[_0x9886('0x41')][_0x9886('0x4e')]({'where':{'id':_0xcd2e0f[_0x9886('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a6a4f,null))[_0x9886('0x25')](function(_0x9cf262){if(_0x9cf262){_0xcd2e0f['body']['AccountId']=_0x9cf262['id'];_0xcd2e0f['body']['Subjects']=integrations[_0x9886('0x51')](_0xcd2e0f[_0x9886('0x4b')][_0x9886('0x52')],_0xcd2e0f[_0x9886('0x4b')][_0x9886('0x2e')]);_0xcd2e0f[_0x9886('0x4b')][_0x9886('0x53')]=integrations['getDescriptions'](_0xcd2e0f['body'][_0x9886('0x52')],_0xcd2e0f['body'][_0x9886('0x2e')]);return db['SugarcrmConfiguration'][_0x9886('0x4a')](_0xcd2e0f[_0x9886('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':_0x9886('0x54')},{'model':db['SugarcrmField'],'as':_0x9886('0x53')}]});}return null;})[_0x9886('0x25')](respondWithResult(_0x3a6a4f,null))['catch'](handleError(_0x3a6a4f,null));};exports['getFields']=function(_0x34dc0f,_0x35d798,_0x564582){var _0x59e31f='';var _0x3d945f=['id',_0x9886('0x29'),_0x9886('0x55'),'created_by',_0x9886('0x56'),_0x9886('0x57'),_0x9886('0x58'),_0x9886('0x59'),_0x9886('0x5a'),_0x9886('0x5b'),'parent_name',_0x9886('0x5c')];return db[_0x9886('0x41')][_0x9886('0x4e')]({'where':{'id':_0x34dc0f[_0x9886('0x47')]['id']},'attributes':['id',_0x9886('0x5d'),_0x9886('0x5e'),_0x9886('0x5f')]})['then'](handleEntityNotFound(_0x35d798,null))[_0x9886('0x25')](function(_0x2ec414){if(_0x2ec414){_0x59e31f=_0x2ec414[_0x9886('0x5f')];var _0x512567=_0x59e31f['slice'](-0x1);if(_0x512567==='/'){_0x59e31f=_0x59e31f[_0x9886('0x60')](0x0,_0x59e31f['lastIndexOf'](_0x512567));}return rp({'method':'POST','uri':util['format'](_0x9886('0x61'),_0x59e31f,_0x9886('0x62')),'json':!![],'form':{'method':'login','input_type':_0x9886('0x63'),'response_type':_0x9886('0x63'),'rest_data':JSON[_0x9886('0x64')]({'user_auth':{'user_name':_0x2ec414['username'],'password':_0x2ec414[_0x9886('0x5e')],'encryption':_0x9886('0x65')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x9886('0x25')](function(_0x21ab31){if(_0x21ab31&&_0x21ab31['name']!=='Invalid\x20Login'&&_0x21ab31[_0x9886('0x29')]!==_0x9886('0x66')){return rp({'method':_0x9886('0x67'),'uri':util[_0x9886('0x68')](_0x9886('0x61'),_0x59e31f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x9886('0x63'),'response_type':_0x9886('0x63'),'rest_data':JSON['stringify']({'session':_0x21ab31['id'],'module_name':_0x9886('0x69')})}})['then'](function(_0x4915ad){if(_0x4915ad){var _0x3c9bbd=_[_0x9886('0x6a')](_0x4915ad[_0x9886('0x6b')]);_[_0x9886('0x6c')](_0x3c9bbd,function(_0x4b0f2d){return _0x3d945f['includes'](_0x4b0f2d[_0x9886('0x29')]);});return{'count':_0x3c9bbd[_0x9886('0x36')],'rows':_[_0x9886('0x2b')](_0x3c9bbd,function(_0x3a18b7){return{'id':_0x3a18b7[_0x9886('0x29')],'name':_0x3a18b7[_0x9886('0x6d')],'custom':_[_0x9886('0x6e')](_0x3a18b7[_0x9886('0x29')],'_c')?!![]:![],'options':_0x3a18b7['options']?_['map'](_[_0x9886('0x6a')](_0x3a18b7[_0x9886('0x40')]),function(_0x42efb4){return{'name':_0x42efb4[_0x9886('0x6f')],'value':_0x42efb4[_0x9886('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x35d798,null))[_0x9886('0x49')](function(_0x5ed0c0){var _0x2f432a=_0x34dc0f[_0x9886('0x32')][_0x9886('0x70')]?0x1f4:_0x5ed0c0[_0x9886('0x71')]||0x1f4;logger[_0x9886('0x27')](_0x9886('0x72'),_0x9886('0x73'),_0x2f432a,JSON['stringify'](_0x5ed0c0));delete _0x5ed0c0[_0x9886('0x29')];if(_0x2f432a===0x191){_0x2f432a=0x190;}_0x35d798[_0x9886('0x1b')](_0x2f432a)[_0x9886('0x2a')](_0x34dc0f[_0x9886('0x32')][_0x9886('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x5ed0c0['statusCode']}:_0x5ed0c0);});}else{var _0x2f75d5=0x1f4;_0x35d798[_0x9886('0x1b')](_0x2f75d5)[_0x9886('0x2a')]({'message':_0x9886('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xcf92=['findAll','rows','catch','show','params','create','update','body','find','getConfigurations','findOne','pick','AccountId','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','Subjects','assigned_user_id','created_by','parent_id','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x591877,_0x1d3d65){var _0x33c7d7=function(_0x268a53){while(--_0x268a53){_0x591877['push'](_0x591877['shift']());}};_0x33c7d7(++_0x1d3d65);}(_0xcf92,0x182));var _0x2cf9=function(_0x3ed319,_0x2f7833){_0x3ed319=_0x3ed319-0x0;var _0x2b82f7=_0xcf92[_0x3ed319];return _0x2b82f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2cf9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf9('0x1'));var moment=require(_0x2cf9('0x2'));var BPromise=require(_0x2cf9('0x3'));var Mustache=require('mustache');var util=require(_0x2cf9('0x4'));var path=require('path');var sox=require(_0x2cf9('0x5'));var csv=require(_0x2cf9('0x6'));var ejs=require(_0x2cf9('0x7'));var fs=require('fs');var fs_extra=require(_0x2cf9('0x8'));var _=require('lodash');var squel=require(_0x2cf9('0x9'));var crypto=require('crypto');var jsforce=require(_0x2cf9('0xa'));var deskjs=require(_0x2cf9('0xb'));var toCsv=require(_0x2cf9('0x6'));var querystring=require(_0x2cf9('0xc'));var Papa=require(_0x2cf9('0xd'));var Redis=require(_0x2cf9('0xe'));var authService=require(_0x2cf9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2cf9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2cf9('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cf9('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2cf9('0x13'));function respondWithStatusCode(_0x1923c5,_0x3c4043){_0x3c4043=_0x3c4043||0xcc;return function(_0x227c0b){if(_0x227c0b){return _0x1923c5[_0x2cf9('0x14')](_0x3c4043);}return _0x1923c5[_0x2cf9('0x15')](_0x3c4043)[_0x2cf9('0x16')]();};}function respondWithResult(_0x317802,_0x2bc7da){_0x2bc7da=_0x2bc7da||0xc8;return function(_0x9c2acc){if(_0x9c2acc){return _0x317802[_0x2cf9('0x15')](_0x2bc7da)[_0x2cf9('0x17')](_0x9c2acc);}};}function respondWithFilteredResult(_0x36fea5,_0x2c3be3){return function(_0x54ea43){if(_0x54ea43){var _0x1c0356=typeof _0x2c3be3['offset']==='undefined'&&typeof _0x2c3be3[_0x2cf9('0x18')]===_0x2cf9('0x19');var _0x2ca88b=_0x54ea43[_0x2cf9('0x1a')];var _0x446ffe=_0x1c0356?0x0:_0x2c3be3[_0x2cf9('0x1b')];var _0x2f578b=_0x1c0356?_0x54ea43['count']:_0x2c3be3[_0x2cf9('0x1b')]+_0x2c3be3['limit'];var _0x5cf788;if(_0x2f578b>=_0x2ca88b){_0x2f578b=_0x2ca88b;_0x5cf788=0xc8;}else{_0x5cf788=0xce;}_0x36fea5[_0x2cf9('0x15')](_0x5cf788);return _0x36fea5[_0x2cf9('0x1c')](_0x2cf9('0x1d'),_0x446ffe+'-'+_0x2f578b+'/'+_0x2ca88b)[_0x2cf9('0x17')](_0x54ea43);}return null;};}function patchUpdates(_0x5e2237){return function(_0x248076){try{jsonpatch['apply'](_0x248076,_0x5e2237,!![]);}catch(_0x30854c){return BPromise[_0x2cf9('0x1e')](_0x30854c);}return _0x248076[_0x2cf9('0x1f')]();};}function saveUpdates(_0x19bbce,_0x50b594){return function(_0x5a77b4){if(_0x5a77b4){return _0x5a77b4['update'](_0x19bbce)[_0x2cf9('0x20')](function(_0x11bf5c){return _0x11bf5c;});}return null;};}function removeEntity(_0x3f9fe8,_0x4981f1){return function(_0x16c239){if(_0x16c239){return _0x16c239[_0x2cf9('0x21')]()[_0x2cf9('0x20')](function(){_0x3f9fe8[_0x2cf9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352b1f,_0x24dda0){return function(_0x29d425){if(!_0x29d425){_0x352b1f[_0x2cf9('0x14')](0x194);}return _0x29d425;};}function handleError(_0x184f36,_0x2752e0){_0x2752e0=_0x2752e0||0x1f4;return function(_0x57c5a3){logger[_0x2cf9('0x22')](_0x57c5a3[_0x2cf9('0x23')]);if(_0x57c5a3[_0x2cf9('0x24')]){delete _0x57c5a3[_0x2cf9('0x24')];}_0x184f36[_0x2cf9('0x15')](_0x2752e0)['send'](_0x57c5a3);};}exports[_0x2cf9('0x25')]=function(_0x9e2947,_0x4a6de4){var _0x41338a={},_0x2b6eb6={},_0x345879={'count':0x0,'rows':[]};var _0x3caaa7=_[_0x2cf9('0x26')](db[_0x2cf9('0x27')][_0x2cf9('0x28')],function(_0x50c708){return{'name':_0x50c708[_0x2cf9('0x29')],'type':_0x50c708['type'][_0x2cf9('0x2a')]};});_0x2b6eb6[_0x2cf9('0x2b')]=_[_0x2cf9('0x26')](_0x3caaa7,_0x2cf9('0x24'));_0x2b6eb6[_0x2cf9('0x2c')]=_[_0x2cf9('0x2d')](_0x9e2947[_0x2cf9('0x2c')]);_0x2b6eb6['filters']=_[_0x2cf9('0x2e')](_0x2b6eb6[_0x2cf9('0x2b')],_0x2b6eb6[_0x2cf9('0x2c')]);_0x41338a[_0x2cf9('0x2f')]=_[_0x2cf9('0x2e')](_0x2b6eb6['model'],qs[_0x2cf9('0x30')](_0x9e2947['query']['fields']));_0x41338a[_0x2cf9('0x2f')]=_0x41338a['attributes'][_0x2cf9('0x31')]?_0x41338a[_0x2cf9('0x2f')]:_0x2b6eb6['model'];if(!_0x9e2947[_0x2cf9('0x2c')]['hasOwnProperty'](_0x2cf9('0x32'))){_0x41338a['limit']=qs[_0x2cf9('0x18')](_0x9e2947[_0x2cf9('0x2c')][_0x2cf9('0x18')]);_0x41338a[_0x2cf9('0x1b')]=qs[_0x2cf9('0x1b')](_0x9e2947['query'][_0x2cf9('0x1b')]);}_0x41338a[_0x2cf9('0x33')]=qs[_0x2cf9('0x34')](_0x9e2947[_0x2cf9('0x2c')][_0x2cf9('0x34')]);_0x41338a[_0x2cf9('0x35')]=qs[_0x2cf9('0x36')](_['pick'](_0x9e2947[_0x2cf9('0x2c')],_0x2b6eb6[_0x2cf9('0x36')]),_0x3caaa7);if(_0x9e2947[_0x2cf9('0x2c')][_0x2cf9('0x37')]){_0x41338a[_0x2cf9('0x35')]=_[_0x2cf9('0x38')](_0x41338a[_0x2cf9('0x35')],{'$or':_['map'](_0x3caaa7,function(_0x1bec58){if(_0x1bec58[_0x2cf9('0x39')]!==_0x2cf9('0x3a')){var _0x1d7b8d={};_0x1d7b8d[_0x1bec58[_0x2cf9('0x24')]]={'$like':'%'+_0x9e2947[_0x2cf9('0x2c')][_0x2cf9('0x37')]+'%'};return _0x1d7b8d;}})});}_0x41338a=_[_0x2cf9('0x38')]({},_0x41338a,_0x9e2947[_0x2cf9('0x3b')]);var _0x703f97={'where':_0x41338a[_0x2cf9('0x35')]};return db['SugarcrmAccount'][_0x2cf9('0x1a')](_0x703f97)[_0x2cf9('0x20')](function(_0x5bacf0){_0x345879[_0x2cf9('0x1a')]=_0x5bacf0;if(_0x9e2947[_0x2cf9('0x2c')][_0x2cf9('0x3c')]){_0x41338a[_0x2cf9('0x3d')]=[{'all':!![]}];}return db[_0x2cf9('0x27')][_0x2cf9('0x3e')](_0x41338a);})['then'](function(_0xe92b37){_0x345879[_0x2cf9('0x3f')]=_0xe92b37;return _0x345879;})[_0x2cf9('0x20')](respondWithFilteredResult(_0x4a6de4,_0x41338a))[_0x2cf9('0x40')](handleError(_0x4a6de4,null));};exports[_0x2cf9('0x41')]=function(_0x1dc325,_0x23acc7){var _0x4b33f4={'raw':![],'where':{'id':_0x1dc325[_0x2cf9('0x42')]['id']}},_0x4c157a={};_0x4c157a['model']=_[_0x2cf9('0x2d')](db[_0x2cf9('0x27')][_0x2cf9('0x28')]);_0x4c157a[_0x2cf9('0x2c')]=_[_0x2cf9('0x2d')](_0x1dc325[_0x2cf9('0x2c')]);_0x4c157a[_0x2cf9('0x36')]=_[_0x2cf9('0x2e')](_0x4c157a[_0x2cf9('0x2b')],_0x4c157a['query']);_0x4b33f4[_0x2cf9('0x2f')]=_['intersection'](_0x4c157a['model'],qs['fields'](_0x1dc325[_0x2cf9('0x2c')]['fields']));_0x4b33f4[_0x2cf9('0x2f')]=_0x4b33f4[_0x2cf9('0x2f')][_0x2cf9('0x31')]?_0x4b33f4[_0x2cf9('0x2f')]:_0x4c157a[_0x2cf9('0x2b')];if(_0x1dc325[_0x2cf9('0x2c')]['includeAll']){_0x4b33f4[_0x2cf9('0x3d')]=[{'all':!![]}];}_0x4b33f4=_[_0x2cf9('0x38')]({},_0x4b33f4,_0x1dc325[_0x2cf9('0x3b')]);return db[_0x2cf9('0x27')]['find'](_0x4b33f4)[_0x2cf9('0x20')](handleEntityNotFound(_0x23acc7,null))[_0x2cf9('0x20')](respondWithResult(_0x23acc7,null))[_0x2cf9('0x40')](handleError(_0x23acc7,null));};exports[_0x2cf9('0x43')]=function(_0x46d624,_0x153cf1){return db[_0x2cf9('0x27')]['create'](_0x46d624['body'],{})[_0x2cf9('0x20')](respondWithResult(_0x153cf1,0xc9))[_0x2cf9('0x40')](handleError(_0x153cf1,null));};exports[_0x2cf9('0x44')]=function(_0x4c8b03,_0x49814e){if(_0x4c8b03['body']['id']){delete _0x4c8b03[_0x2cf9('0x45')]['id'];}return db[_0x2cf9('0x27')]['find']({'where':{'id':_0x4c8b03[_0x2cf9('0x42')]['id']}})['then'](handleEntityNotFound(_0x49814e,null))['then'](saveUpdates(_0x4c8b03[_0x2cf9('0x45')],null))[_0x2cf9('0x20')](respondWithResult(_0x49814e,null))[_0x2cf9('0x40')](handleError(_0x49814e,null));};exports[_0x2cf9('0x21')]=function(_0x2b89e5,_0x4074e9){return db[_0x2cf9('0x27')][_0x2cf9('0x46')]({'where':{'id':_0x2b89e5[_0x2cf9('0x42')]['id']}})[_0x2cf9('0x20')](handleEntityNotFound(_0x4074e9,null))[_0x2cf9('0x20')](removeEntity(_0x4074e9,null))[_0x2cf9('0x40')](handleError(_0x4074e9,null));};exports[_0x2cf9('0x47')]=function(_0x24300d,_0x416e4b,_0x1f82e0){var _0x29638d={};var _0x4189f5={};var _0x2154b3;var _0x3c9741;return db['SugarcrmAccount'][_0x2cf9('0x48')]({'where':{'id':_0x24300d['params']['id']}})['then'](handleEntityNotFound(_0x416e4b,null))['then'](function(_0x9b2def){if(_0x9b2def){_0x2154b3=_0x9b2def;_0x4189f5[_0x2cf9('0x2b')]=_['keys'](db['SugarcrmConfiguration'][_0x2cf9('0x28')]);_0x4189f5[_0x2cf9('0x2c')]=_[_0x2cf9('0x2d')](_0x24300d[_0x2cf9('0x2c')]);_0x4189f5['filters']=_[_0x2cf9('0x2e')](_0x4189f5['model'],_0x4189f5[_0x2cf9('0x2c')]);_0x29638d['attributes']=_[_0x2cf9('0x2e')](_0x4189f5[_0x2cf9('0x2b')],qs[_0x2cf9('0x30')](_0x24300d['query'][_0x2cf9('0x30')]));_0x29638d['attributes']=_0x29638d[_0x2cf9('0x2f')][_0x2cf9('0x31')]?_0x29638d[_0x2cf9('0x2f')]:_0x4189f5[_0x2cf9('0x2b')];_0x29638d[_0x2cf9('0x33')]=qs['sort'](_0x24300d[_0x2cf9('0x2c')][_0x2cf9('0x34')]);_0x29638d[_0x2cf9('0x35')]=qs[_0x2cf9('0x36')](_[_0x2cf9('0x49')](_0x24300d[_0x2cf9('0x2c')],_0x4189f5[_0x2cf9('0x36')]));if(_0x24300d['query']['filter']){_0x29638d[_0x2cf9('0x35')]=_[_0x2cf9('0x38')](_0x29638d['where'],{'$or':_['map'](_0x29638d['attributes'],function(_0xd1102b){var _0x3cae1e={};_0x3cae1e[_0xd1102b]={'$like':'%'+_0x24300d[_0x2cf9('0x2c')][_0x2cf9('0x37')]+'%'};return _0x3cae1e;})});}_0x29638d=_[_0x2cf9('0x38')]({},_0x29638d,_0x24300d[_0x2cf9('0x3b')]);return _0x2154b3[_0x2cf9('0x47')](_0x29638d);}})['then'](function(_0x1e083c){if(_0x1e083c){_0x3c9741=_0x1e083c[_0x2cf9('0x31')];if(!_0x24300d['query']['hasOwnProperty']('nolimit')){_0x29638d[_0x2cf9('0x18')]=qs[_0x2cf9('0x18')](_0x24300d['query']['limit']);_0x29638d[_0x2cf9('0x1b')]=qs[_0x2cf9('0x1b')](_0x24300d['query'][_0x2cf9('0x1b')]);}return _0x2154b3[_0x2cf9('0x47')](_0x29638d);}})[_0x2cf9('0x20')](function(_0x3ad22a){if(_0x3ad22a){return _0x3ad22a?{'count':_0x3c9741,'rows':_0x3ad22a}:null;}})[_0x2cf9('0x20')](respondWithResult(_0x416e4b,null))['catch'](handleError(_0x416e4b,null));};exports['addConfiguration']=function(_0xa0d070,_0x38473b,_0x5dc330){if(_0xa0d070[_0x2cf9('0x45')]['id']){delete _0xa0d070[_0x2cf9('0x45')]['id'];}return db[_0x2cf9('0x27')]['findOne']({'where':{'id':_0xa0d070[_0x2cf9('0x42')]['id']}})[_0x2cf9('0x20')](handleEntityNotFound(_0x38473b,null))[_0x2cf9('0x20')](function(_0x14947f){if(_0x14947f){_0xa0d070['body'][_0x2cf9('0x4a')]=_0x14947f['id'];_0xa0d070['body']['Subjects']=integrations['getSubjects'](_0xa0d070['body'][_0x2cf9('0x4b')],_0xa0d070[_0x2cf9('0x45')][_0x2cf9('0x39')]);_0xa0d070[_0x2cf9('0x45')][_0x2cf9('0x4c')]=integrations[_0x2cf9('0x4d')](_0xa0d070[_0x2cf9('0x45')][_0x2cf9('0x4b')],_0xa0d070[_0x2cf9('0x45')][_0x2cf9('0x39')]);return db[_0x2cf9('0x4e')][_0x2cf9('0x43')](_0xa0d070[_0x2cf9('0x45')],{'include':[{'model':db[_0x2cf9('0x4f')],'as':_0x2cf9('0x50')},{'model':db[_0x2cf9('0x4f')],'as':_0x2cf9('0x4c')}]});}return null;})[_0x2cf9('0x20')](respondWithResult(_0x38473b,null))[_0x2cf9('0x40')](handleError(_0x38473b,null));};exports['getFields']=function(_0x232edf,_0x5923bc,_0x54be78){var _0x2afb8b='';var _0x55e864=['id',_0x2cf9('0x24'),_0x2cf9('0x51'),_0x2cf9('0x52'),'description','date_start','duration_hours','duration_minutes',_0x2cf9('0x53'),'parent_type',_0x2cf9('0x54'),'direction'];return db[_0x2cf9('0x27')][_0x2cf9('0x48')]({'where':{'id':_0x232edf[_0x2cf9('0x42')]['id']},'attributes':['id',_0x2cf9('0x55'),_0x2cf9('0x56'),_0x2cf9('0x57')]})[_0x2cf9('0x20')](handleEntityNotFound(_0x5923bc,null))[_0x2cf9('0x20')](function(_0x414647){if(_0x414647){_0x2afb8b=_0x414647['remoteUri'];var _0x53df66=_0x2afb8b[_0x2cf9('0x58')](-0x1);if(_0x53df66==='/'){_0x2afb8b=_0x2afb8b[_0x2cf9('0x59')](0x0,_0x2afb8b[_0x2cf9('0x5a')](_0x53df66));}return rp({'method':'POST','uri':util[_0x2cf9('0x5b')](_0x2cf9('0x5c'),_0x2afb8b,_0x2cf9('0x5d')),'json':!![],'form':{'method':_0x2cf9('0x5e'),'input_type':_0x2cf9('0x5f'),'response_type':_0x2cf9('0x5f'),'rest_data':JSON[_0x2cf9('0x60')]({'user_auth':{'user_name':_0x414647['username'],'password':_0x414647[_0x2cf9('0x56')],'encryption':'PLAIN'},'application':_0x2cf9('0x61')})}});}})[_0x2cf9('0x20')](function(_0x412a24){if(_0x412a24&&_0x412a24['name']!==_0x2cf9('0x62')&&_0x412a24[_0x2cf9('0x24')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x2cf9('0x5b')](_0x2cf9('0x5c'),_0x2afb8b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2cf9('0x63'),'input_type':_0x2cf9('0x5f'),'response_type':_0x2cf9('0x5f'),'rest_data':JSON['stringify']({'session':_0x412a24['id'],'module_name':_0x2cf9('0x64')})}})[_0x2cf9('0x20')](function(_0x4dead9){if(_0x4dead9){var _0x11f4e3=_[_0x2cf9('0x65')](_0x4dead9[_0x2cf9('0x66')]);_['remove'](_0x11f4e3,function(_0x58774b){return _0x55e864['includes'](_0x58774b[_0x2cf9('0x24')]);});return{'count':_0x11f4e3[_0x2cf9('0x31')],'rows':_[_0x2cf9('0x26')](_0x11f4e3,function(_0x1b4c7b){return{'id':_0x1b4c7b[_0x2cf9('0x24')],'name':_0x1b4c7b[_0x2cf9('0x67')],'custom':_[_0x2cf9('0x68')](_0x1b4c7b[_0x2cf9('0x24')],'_c')?!![]:![],'options':_0x1b4c7b[_0x2cf9('0x3b')]?_[_0x2cf9('0x26')](_['values'](_0x1b4c7b['options']),function(_0x48aaff){return{'name':_0x48aaff[_0x2cf9('0x69')],'value':_0x48aaff[_0x2cf9('0x24')]};}):[]};})};}})[_0x2cf9('0x20')](respondWithResult(_0x5923bc,null))[_0x2cf9('0x40')](function(_0x125266){var _0x3de458=_0x232edf[_0x2cf9('0x2c')][_0x2cf9('0x6a')]?0x1f4:_0x125266[_0x2cf9('0x6b')]||0x1f4;logger[_0x2cf9('0x22')](_0x2cf9('0x6c'),_0x2cf9('0x6d'),_0x3de458,JSON[_0x2cf9('0x60')](_0x125266));delete _0x125266[_0x2cf9('0x24')];if(_0x3de458===0x191){_0x3de458=0x190;}_0x5923bc[_0x2cf9('0x15')](_0x3de458)['send'](_0x232edf[_0x2cf9('0x2c')][_0x2cf9('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x125266[_0x2cf9('0x6b')]}:_0x125266);});}else{var _0x5de11f=0x1f4;_0x5923bc['status'](_0x5de11f)[_0x2cf9('0x6e')]({'message':_0x2cf9('0x6f'),'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 a3c1f1f..22ae0df 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 _0x3059=['../../config/logger','api','moment','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util'];(function(_0x13970d,_0x3cf42e){var _0x176fc3=function(_0x4d5e66){while(--_0x4d5e66){_0x13970d['push'](_0x13970d['shift']());}};_0x176fc3(++_0x3cf42e);}(_0x3059,0x1df));var _0x9305=function(_0x4c15e3,_0x31a156){_0x4c15e3=_0x4c15e3-0x0;var _0x3f7012=_0x3059[_0x4c15e3];return _0x3f7012;};'use strict';var _=require('lodash');var util=require(_0x9305('0x0'));var logger=require(_0x9305('0x1'))(_0x9305('0x2'));var moment=require(_0x9305('0x3'));var BPromise=require('bluebird');var rp=require(_0x9305('0x4'));var fs=require('fs');var path=require(_0x9305('0x5'));var rimraf=require('rimraf');var config=require(_0x9305('0x6'));var attributes=require(_0x9305('0x7'));var integrations=require(_0x9305('0x8'));module[_0x9305('0x9')]=function(_0x184ec3,_0x519402){return _0x184ec3['define'](_0x9305('0xa'),attributes,{'tableName':_0x9305('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3cc=['../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xe3cc,0x122));var _0xce3c=function(_0xdecfdd,_0x375f9b){_0xdecfdd=_0xdecfdd-0x0;var _0x2fdb56=_0xe3cc[_0xdecfdd];return _0x2fdb56;};'use strict';var _=require(_0xce3c('0x0'));var util=require(_0xce3c('0x1'));var logger=require(_0xce3c('0x2'))('api');var moment=require(_0xce3c('0x3'));var BPromise=require(_0xce3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce3c('0x5'));var rimraf=require(_0xce3c('0x6'));var config=require(_0xce3c('0x7'));var attributes=require(_0xce3c('0x8'));var integrations=require(_0xce3c('0x9'));module[_0xce3c('0xa')]=function(_0x116073,_0x285f95){return _0x116073['define'](_0xce3c('0xb'),attributes,{'tableName':_0xce3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e4c83e5..30eb525 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 _0xe819=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowSugarcrmAccount','find','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4f89fa,_0x39546d){var _0x338542=function(_0x4cfe9d){while(--_0x4cfe9d){_0x4f89fa['push'](_0x4f89fa['shift']());}};_0x338542(++_0x39546d);}(_0xe819,0x96));var _0x9e81=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe819[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9e81('0x0'));var util=require(_0x9e81('0x1'));var moment=require(_0x9e81('0x2'));var BPromise=require(_0x9e81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e81('0x4'));var db=require(_0x9e81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e81('0x6'))(_0x9e81('0x7'));var config=require('../../config/environment');var jayson=require(_0x9e81('0x8'));var client=jayson[_0x9e81('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f59a3,_0x2d8761,_0x584d74){return new BPromise(function(_0x5d2012,_0xf5cfb9){return client[_0x9e81('0xa')](_0x4f59a3,_0x584d74)[_0x9e81('0xb')](function(_0x14bf90){logger[_0x9e81('0xc')](_0x9e81('0xd'),_0x2d8761,'request\x20sent');logger['debug'](_0x9e81('0xe'),_0x2d8761,_0x9e81('0xf'),JSON[_0x9e81('0x10')](_0x14bf90));if(_0x14bf90[_0x9e81('0x11')]){if(_0x14bf90[_0x9e81('0x11')]['code']===0x1f4){logger[_0x9e81('0x11')](_0x9e81('0xd'),_0x2d8761,_0x14bf90['error']['message']);return _0xf5cfb9(_0x14bf90[_0x9e81('0x11')][_0x9e81('0x12')]);}logger['error'](_0x9e81('0xd'),_0x2d8761,_0x14bf90[_0x9e81('0x11')][_0x9e81('0x12')]);return _0x5d2012(_0x14bf90['error'][_0x9e81('0x12')]);}else{logger['info'](_0x9e81('0xd'),_0x2d8761,_0x9e81('0xf'));_0x5d2012(_0x14bf90[_0x9e81('0x13')][_0x9e81('0x12')]);}})['catch'](function(_0x1ad662){logger[_0x9e81('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d8761,_0x1ad662);_0xf5cfb9(_0x1ad662);});});}exports[_0x9e81('0x14')]=function(_0x5a38e4){var _0x915dae=this;return new Promise(function(_0x10ec42,_0xbb8402){return db[_0x9e81('0x15')][_0x9e81('0x16')]({'raw':_0x5a38e4[_0x9e81('0x17')]?_0x5a38e4[_0x9e81('0x17')][_0x9e81('0x18')]===undefined?!![]:![]:!![],'where':_0x5a38e4[_0x9e81('0x17')]?_0x5a38e4[_0x9e81('0x17')][_0x9e81('0x19')]||null:null,'attributes':_0x5a38e4[_0x9e81('0x17')]?_0x5a38e4[_0x9e81('0x17')]['attributes']||null:null,'limit':_0x5a38e4[_0x9e81('0x17')]?_0x5a38e4[_0x9e81('0x17')][_0x9e81('0x1a')]||null:null,'include':_0x5a38e4['options']?_0x5a38e4['options'][_0x9e81('0x1b')]?_[_0x9e81('0x1c')](_0x5a38e4['options'][_0x9e81('0x1b')],function(_0x5dbd01){return{'model':db[_0x5dbd01[_0x9e81('0x1d')]],'as':_0x5dbd01['as'],'attributes':_0x5dbd01[_0x9e81('0x1e')],'include':_0x5dbd01[_0x9e81('0x1b')]?_[_0x9e81('0x1c')](_0x5dbd01[_0x9e81('0x1b')],function(_0x34ff40){return{'model':db[_0x34ff40['model']],'as':_0x34ff40['as'],'attributes':_0x34ff40[_0x9e81('0x1e')],'include':_0x34ff40['include']?_[_0x9e81('0x1c')](_0x34ff40[_0x9e81('0x1b')],function(_0x2e721e){return{'model':db[_0x2e721e[_0x9e81('0x1d')]],'as':_0x2e721e['as'],'attributes':_0x2e721e[_0x9e81('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2da22d){logger['info']('GetSugarcrmAccount',_0x5a38e4);logger['debug'](_0x9e81('0x14'),_0x5a38e4,JSON['stringify'](_0x2da22d));_0x10ec42(_0x2da22d);})['catch'](function(_0x4f0f7f){logger[_0x9e81('0x11')](_0x9e81('0x14'),_0x4f0f7f[_0x9e81('0x12')],_0x5a38e4);_0xbb8402(_0x915dae[_0x9e81('0x11')](0x1f4,_0x4f0f7f[_0x9e81('0x12')]));});});};exports[_0x9e81('0x1f')]=function(_0x6b95f){var _0x26efd4=this;return new Promise(function(_0x4b61a0,_0x477cf9){return db[_0x9e81('0x15')][_0x9e81('0x20')]({'raw':_0x6b95f[_0x9e81('0x17')]?_0x6b95f[_0x9e81('0x17')][_0x9e81('0x18')]===undefined?!![]:![]:!![],'where':_0x6b95f[_0x9e81('0x17')]?_0x6b95f['options'][_0x9e81('0x19')]||null:null,'attributes':_0x6b95f[_0x9e81('0x17')]?_0x6b95f[_0x9e81('0x17')][_0x9e81('0x1e')]||null:null,'include':_0x6b95f[_0x9e81('0x17')]?_0x6b95f[_0x9e81('0x17')]['include']?_[_0x9e81('0x1c')](_0x6b95f[_0x9e81('0x17')][_0x9e81('0x1b')],function(_0x4544d8){return{'model':db[_0x4544d8[_0x9e81('0x1d')]],'as':_0x4544d8['as'],'attributes':_0x4544d8[_0x9e81('0x1e')],'include':_0x4544d8[_0x9e81('0x1b')]?_[_0x9e81('0x1c')](_0x4544d8[_0x9e81('0x1b')],function(_0x406c07){return{'model':db[_0x406c07['model']],'as':_0x406c07['as'],'attributes':_0x406c07[_0x9e81('0x1e')],'include':_0x406c07[_0x9e81('0x1b')]?_[_0x9e81('0x1c')](_0x406c07[_0x9e81('0x1b')],function(_0x2c0978){return{'model':db[_0x2c0978[_0x9e81('0x1d')]],'as':_0x2c0978['as'],'attributes':_0x2c0978[_0x9e81('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9e81('0xb')](function(_0x27f23b){logger[_0x9e81('0xc')](_0x9e81('0x1f'),_0x6b95f);logger[_0x9e81('0x21')]('ShowSugarcrmAccount',_0x6b95f,JSON[_0x9e81('0x10')](_0x27f23b));_0x4b61a0(_0x27f23b);})['catch'](function(_0x2209ea){logger[_0x9e81('0x11')]('ShowSugarcrmAccount',_0x2209ea[_0x9e81('0x12')],_0x6b95f);_0x477cf9(_0x26efd4[_0x9e81('0x11')](0x1f4,_0x2209ea[_0x9e81('0x12')]));});});}; \ No newline at end of file +var _0xe5b1=['code','message','result','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','stringify','catch','ShowSugarcrmAccount','find','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x5d7acc,_0x19815c){var _0x4af4c7=function(_0x2e47a3){while(--_0x2e47a3){_0x5d7acc['push'](_0x5d7acc['shift']());}};_0x4af4c7(++_0x19815c);}(_0xe5b1,0x165));var _0x1e5b=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0xe5b1[_0x193ddf];return _0x5bc6df;};'use strict';var _=require(_0x1e5b('0x0'));var util=require('util');var moment=require(_0x1e5b('0x1'));var BPromise=require(_0x1e5b('0x2'));var rs=require(_0x1e5b('0x3'));var fs=require('fs');var Redis=require(_0x1e5b('0x4'));var db=require(_0x1e5b('0x5'))['db'];var utils=require(_0x1e5b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1e5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24be60,_0x8595ad,_0x2268a5){return new BPromise(function(_0x3fc63d,_0x5e146a){return client[_0x1e5b('0x9')](_0x24be60,_0x2268a5)[_0x1e5b('0xa')](function(_0x186957){logger[_0x1e5b('0xb')](_0x1e5b('0xc'),_0x8595ad,_0x1e5b('0xd'));logger[_0x1e5b('0xe')](_0x1e5b('0xf'),_0x8595ad,_0x1e5b('0xd'),JSON['stringify'](_0x186957));if(_0x186957[_0x1e5b('0x10')]){if(_0x186957[_0x1e5b('0x10')][_0x1e5b('0x11')]===0x1f4){logger[_0x1e5b('0x10')](_0x1e5b('0xc'),_0x8595ad,_0x186957['error'][_0x1e5b('0x12')]);return _0x5e146a(_0x186957[_0x1e5b('0x10')]['message']);}logger[_0x1e5b('0x10')](_0x1e5b('0xc'),_0x8595ad,_0x186957[_0x1e5b('0x10')]['message']);return _0x3fc63d(_0x186957['error'][_0x1e5b('0x12')]);}else{logger[_0x1e5b('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x8595ad,_0x1e5b('0xd'));_0x3fc63d(_0x186957[_0x1e5b('0x13')][_0x1e5b('0x12')]);}})['catch'](function(_0x271f8b){logger[_0x1e5b('0x10')](_0x1e5b('0xc'),_0x8595ad,_0x271f8b);_0x5e146a(_0x271f8b);});});}exports[_0x1e5b('0x14')]=function(_0x28dc1c){var _0x5c086d=this;return new Promise(function(_0x28a421,_0x2cc6cf){return db[_0x1e5b('0x15')]['findAll']({'raw':_0x28dc1c[_0x1e5b('0x16')]?_0x28dc1c[_0x1e5b('0x16')][_0x1e5b('0x17')]===undefined?!![]:![]:!![],'where':_0x28dc1c[_0x1e5b('0x16')]?_0x28dc1c[_0x1e5b('0x16')][_0x1e5b('0x18')]||null:null,'attributes':_0x28dc1c[_0x1e5b('0x16')]?_0x28dc1c[_0x1e5b('0x16')][_0x1e5b('0x19')]||null:null,'limit':_0x28dc1c[_0x1e5b('0x16')]?_0x28dc1c[_0x1e5b('0x16')][_0x1e5b('0x1a')]||null:null,'include':_0x28dc1c['options']?_0x28dc1c['options'][_0x1e5b('0x1b')]?_[_0x1e5b('0x1c')](_0x28dc1c['options'][_0x1e5b('0x1b')],function(_0x1c8b89){return{'model':db[_0x1c8b89['model']],'as':_0x1c8b89['as'],'attributes':_0x1c8b89[_0x1e5b('0x19')],'include':_0x1c8b89[_0x1e5b('0x1b')]?_[_0x1e5b('0x1c')](_0x1c8b89[_0x1e5b('0x1b')],function(_0x18166f){return{'model':db[_0x18166f['model']],'as':_0x18166f['as'],'attributes':_0x18166f['attributes'],'include':_0x18166f[_0x1e5b('0x1b')]?_[_0x1e5b('0x1c')](_0x18166f[_0x1e5b('0x1b')],function(_0x1a6d7b){return{'model':db[_0x1a6d7b['model']],'as':_0x1a6d7b['as'],'attributes':_0x1a6d7b[_0x1e5b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1e5b('0xa')](function(_0x432656){logger[_0x1e5b('0xb')](_0x1e5b('0x14'),_0x28dc1c);logger[_0x1e5b('0xe')](_0x1e5b('0x14'),_0x28dc1c,JSON[_0x1e5b('0x1d')](_0x432656));_0x28a421(_0x432656);})[_0x1e5b('0x1e')](function(_0x3eeb83){logger[_0x1e5b('0x10')](_0x1e5b('0x14'),_0x3eeb83[_0x1e5b('0x12')],_0x28dc1c);_0x2cc6cf(_0x5c086d[_0x1e5b('0x10')](0x1f4,_0x3eeb83[_0x1e5b('0x12')]));});});};exports[_0x1e5b('0x1f')]=function(_0x1930e8){var _0x20bad4=this;return new Promise(function(_0x27e382,_0x4364a8){return db[_0x1e5b('0x15')][_0x1e5b('0x20')]({'raw':_0x1930e8[_0x1e5b('0x16')]?_0x1930e8[_0x1e5b('0x16')][_0x1e5b('0x17')]===undefined?!![]:![]:!![],'where':_0x1930e8[_0x1e5b('0x16')]?_0x1930e8['options'][_0x1e5b('0x18')]||null:null,'attributes':_0x1930e8['options']?_0x1930e8[_0x1e5b('0x16')][_0x1e5b('0x19')]||null:null,'include':_0x1930e8[_0x1e5b('0x16')]?_0x1930e8[_0x1e5b('0x16')][_0x1e5b('0x1b')]?_[_0x1e5b('0x1c')](_0x1930e8[_0x1e5b('0x16')][_0x1e5b('0x1b')],function(_0x885369){return{'model':db[_0x885369[_0x1e5b('0x21')]],'as':_0x885369['as'],'attributes':_0x885369[_0x1e5b('0x19')],'include':_0x885369[_0x1e5b('0x1b')]?_[_0x1e5b('0x1c')](_0x885369[_0x1e5b('0x1b')],function(_0x14d7e3){return{'model':db[_0x14d7e3[_0x1e5b('0x21')]],'as':_0x14d7e3['as'],'attributes':_0x14d7e3[_0x1e5b('0x19')],'include':_0x14d7e3['include']?_[_0x1e5b('0x1c')](_0x14d7e3[_0x1e5b('0x1b')],function(_0x28e31d){return{'model':db[_0x28e31d[_0x1e5b('0x21')]],'as':_0x28e31d['as'],'attributes':_0x28e31d[_0x1e5b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x100fa3){logger[_0x1e5b('0xb')]('ShowSugarcrmAccount',_0x1930e8);logger['debug'](_0x1e5b('0x1f'),_0x1930e8,JSON[_0x1e5b('0x1d')](_0x100fa3));_0x27e382(_0x100fa3);})[_0x1e5b('0x1e')](function(_0x14284b){logger[_0x1e5b('0x10')](_0x1e5b('0x1f'),_0x14284b[_0x1e5b('0x12')],_0x1930e8);_0x4364a8(_0x20bad4[_0x1e5b('0x10')](0x1f4,_0x14284b[_0x1e5b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d2c43f3..f301b02 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 _0x9b0c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','post','update','/:id','destroy','exports'];(function(_0x4509cd,_0x43c125){var _0x1ab912=function(_0x91c4de){while(--_0x91c4de){_0x4509cd['push'](_0x4509cd['shift']());}};_0x1ab912(++_0x43c125);}(_0x9b0c,0x12b));var _0xc9b0=function(_0x1b3f75,_0x35d1b6){_0x1b3f75=_0x1b3f75-0x0;var _0x435741=_0x9b0c[_0x1b3f75];return _0x435741;};'use strict';var multer=require(_0xc9b0('0x0'));var util=require(_0xc9b0('0x1'));var path=require(_0xc9b0('0x2'));var timeout=require(_0xc9b0('0x3'));var express=require(_0xc9b0('0x4'));var router=express[_0xc9b0('0x5')]();var fs_extra=require(_0xc9b0('0x6'));var auth=require(_0xc9b0('0x7'));var interaction=require(_0xc9b0('0x8'));var config=require(_0xc9b0('0x9'));var controller=require(_0xc9b0('0xa'));router[_0xc9b0('0xb')]('/',auth[_0xc9b0('0xc')](),controller[_0xc9b0('0xd')]);router['get']('/:id',auth[_0xc9b0('0xc')](),controller[_0xc9b0('0xe')]);router[_0xc9b0('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc9b0('0xb')]('/:id/subjects',auth[_0xc9b0('0xc')](),controller[_0xc9b0('0xf')]);router[_0xc9b0('0xb')](_0xc9b0('0x10'),auth['isAuthenticated'](),controller[_0xc9b0('0x11')]);router[_0xc9b0('0x12')]('/',auth[_0xc9b0('0xc')](),controller['create']);router['put']('/:id',auth[_0xc9b0('0xc')](),controller[_0xc9b0('0x13')]);router['delete'](_0xc9b0('0x14'),auth[_0xc9b0('0xc')](),controller[_0xc9b0('0x15')]);module[_0xc9b0('0x16')]=router; \ No newline at end of file +var _0x51f2=['get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','index'];(function(_0x2f8223,_0x299659){var _0x3c327b=function(_0x2b882a){while(--_0x2b882a){_0x2f8223['push'](_0x2f8223['shift']());}};_0x3c327b(++_0x299659);}(_0x51f2,0x1f2));var _0x251f=function(_0x482173,_0x9a0d0f){_0x482173=_0x482173-0x0;var _0x659021=_0x51f2[_0x482173];return _0x659021;};'use strict';var multer=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var path=require(_0x251f('0x2'));var timeout=require(_0x251f('0x3'));var express=require('express');var router=express[_0x251f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x251f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x251f('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x251f('0x7')]);router[_0x251f('0x8')]('/:id',auth[_0x251f('0x9')](),controller['show']);router[_0x251f('0x8')](_0x251f('0xa'),auth[_0x251f('0x9')](),controller['getFields']);router['get'](_0x251f('0xb'),auth[_0x251f('0x9')](),controller[_0x251f('0xc')]);router[_0x251f('0x8')](_0x251f('0xd'),auth[_0x251f('0x9')](),controller[_0x251f('0xe')]);router[_0x251f('0xf')]('/',auth[_0x251f('0x9')](),controller[_0x251f('0x10')]);router[_0x251f('0x11')](_0x251f('0x12'),auth[_0x251f('0x9')](),controller[_0x251f('0x13')]);router[_0x251f('0x14')](_0x251f('0x12'),auth['isAuthenticated'](),controller[_0x251f('0x15')]);module[_0x251f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c852880..1add0a1 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 _0x3671=['STRING','exports'];(function(_0x1d1f35,_0x51bbee){var _0x50d1d8=function(_0x245ec9){while(--_0x245ec9){_0x1d1f35['push'](_0x1d1f35['shift']());}};_0x50d1d8(++_0x51bbee);}(_0x3671,0x183));var _0x1367=function(_0xde639e,_0x508b44){_0xde639e=_0xde639e-0x0;var _0x105a83=_0x3671[_0xde639e];return _0x105a83;};'use strict';var Sequelize=require('sequelize');module[_0x1367('0x0')]={'name':{'type':Sequelize[_0x1367('0x1')]},'description':{'type':Sequelize[_0x1367('0x1')]}}; \ No newline at end of file +var _0xeb96=['exports','STRING','sequelize'];(function(_0x13f0ab,_0x27f545){var _0x4b4acd=function(_0x32846a){while(--_0x32846a){_0x13f0ab['push'](_0x13f0ab['shift']());}};_0x4b4acd(++_0x27f545);}(_0xeb96,0x12b));var _0x6eb9=function(_0x1029f7,_0x3ed986){_0x1029f7=_0x1029f7-0x0;var _0x2f3c95=_0xeb96[_0x1029f7];return _0x2f3c95;};'use strict';var Sequelize=require(_0x6eb9('0x0'));module[_0x6eb9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eb9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 3d3dd00..fb0f35a 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 _0x00a4=['pick','getFields','nolimit','SugarcrmField','getSubjects','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','where','filter','merge','options','include','findAll','show','length','includeAll','find','catch','create','body','params','findOne','order'];(function(_0x228ece,_0x1a7d1e){var _0x591db6=function(_0x1f8961){while(--_0x1f8961){_0x228ece['push'](_0x228ece['shift']());}};_0x591db6(++_0x1a7d1e);}(_0x00a4,0x191));var _0x400a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00a4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x400a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x400a('0x1'));var moment=require(_0x400a('0x2'));var BPromise=require(_0x400a('0x3'));var Mustache=require(_0x400a('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x400a('0x5'));var fs=require('fs');var fs_extra=require(_0x400a('0x6'));var _=require(_0x400a('0x7'));var squel=require(_0x400a('0x8'));var crypto=require(_0x400a('0x9'));var jsforce=require(_0x400a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x400a('0xb'));var querystring=require(_0x400a('0xc'));var Papa=require(_0x400a('0xd'));var Redis=require(_0x400a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x400a('0xf'));var as=require(_0x400a('0x10'));var hardwareService=require(_0x400a('0x11'));var logger=require(_0x400a('0x12'))('api');var utils=require(_0x400a('0x13'));var config=require(_0x400a('0x14'));var licenseUtil=require(_0x400a('0x15'));var db=require(_0x400a('0x16'))['db'];function respondWithStatusCode(_0x5786fd,_0x42206c){_0x42206c=_0x42206c||0xcc;return function(_0x2e70ed){if(_0x2e70ed){return _0x5786fd[_0x400a('0x17')](_0x42206c);}return _0x5786fd[_0x400a('0x18')](_0x42206c)[_0x400a('0x19')]();};}function respondWithResult(_0x2bb1d3,_0x2ef54d){_0x2ef54d=_0x2ef54d||0xc8;return function(_0x1144a0){if(_0x1144a0){return _0x2bb1d3[_0x400a('0x18')](_0x2ef54d)[_0x400a('0x1a')](_0x1144a0);}};}function respondWithFilteredResult(_0x6d5a9f,_0x366e1d){return function(_0x54910e){if(_0x54910e){var _0x1af1a8=typeof _0x366e1d[_0x400a('0x1b')]===_0x400a('0x1c')&&typeof _0x366e1d[_0x400a('0x1d')]==='undefined';var _0x53be31=_0x54910e[_0x400a('0x1e')];var _0x21cc9b=_0x1af1a8?0x0:_0x366e1d[_0x400a('0x1b')];var _0x4dc1b7=_0x1af1a8?_0x54910e[_0x400a('0x1e')]:_0x366e1d[_0x400a('0x1b')]+_0x366e1d[_0x400a('0x1d')];var _0x3bc1b0;if(_0x4dc1b7>=_0x53be31){_0x4dc1b7=_0x53be31;_0x3bc1b0=0xc8;}else{_0x3bc1b0=0xce;}_0x6d5a9f[_0x400a('0x18')](_0x3bc1b0);return _0x6d5a9f[_0x400a('0x1f')](_0x400a('0x20'),_0x21cc9b+'-'+_0x4dc1b7+'/'+_0x53be31)['json'](_0x54910e);}return null;};}function patchUpdates(_0x51d3bf){return function(_0x32f782){try{jsonpatch['apply'](_0x32f782,_0x51d3bf,!![]);}catch(_0x229cb1){return BPromise[_0x400a('0x21')](_0x229cb1);}return _0x32f782[_0x400a('0x22')]();};}function saveUpdates(_0x551062,_0x48ce75){return function(_0x31fbf2){if(_0x31fbf2){return _0x31fbf2[_0x400a('0x23')](_0x551062)[_0x400a('0x24')](function(_0xe69f8f){return _0xe69f8f;});}return null;};}function removeEntity(_0x573adc,_0x7e6434){return function(_0x2ea7c3){if(_0x2ea7c3){return _0x2ea7c3[_0x400a('0x25')]()[_0x400a('0x24')](function(){_0x573adc['status'](0xcc)[_0x400a('0x19')]();});}};}function handleEntityNotFound(_0x1b7219,_0x14f992){return function(_0x3e7d23){if(!_0x3e7d23){_0x1b7219[_0x400a('0x17')](0x194);}return _0x3e7d23;};}function handleError(_0x3a58c7,_0x3d0103){_0x3d0103=_0x3d0103||0x1f4;return function(_0x38c0dd){logger[_0x400a('0x26')](_0x38c0dd[_0x400a('0x27')]);if(_0x38c0dd[_0x400a('0x28')]){delete _0x38c0dd[_0x400a('0x28')];}_0x3a58c7[_0x400a('0x18')](_0x3d0103)[_0x400a('0x29')](_0x38c0dd);};}exports[_0x400a('0x2a')]=function(_0x328646,_0x3860dc){var _0xd7fa75={},_0x5df6c1={},_0x34a80e={'count':0x0,'rows':[]};var _0x2246d8=_['map'](db[_0x400a('0x2b')][_0x400a('0x2c')],function(_0x3917ce){return{'name':_0x3917ce['fieldName'],'type':_0x3917ce[_0x400a('0x2d')][_0x400a('0x2e')]};});_0x5df6c1['model']=_[_0x400a('0x2f')](_0x2246d8,'name');_0x5df6c1[_0x400a('0x30')]=_[_0x400a('0x31')](_0x328646['query']);_0x5df6c1[_0x400a('0x32')]=_[_0x400a('0x33')](_0x5df6c1['model'],_0x5df6c1[_0x400a('0x30')]);_0xd7fa75[_0x400a('0x34')]=_['intersection'](_0x5df6c1[_0x400a('0x35')],qs[_0x400a('0x36')](_0x328646[_0x400a('0x30')][_0x400a('0x36')]));_0xd7fa75[_0x400a('0x34')]=_0xd7fa75[_0x400a('0x34')]['length']?_0xd7fa75[_0x400a('0x34')]:_0x5df6c1['model'];if(!_0x328646[_0x400a('0x30')][_0x400a('0x37')]('nolimit')){_0xd7fa75['limit']=qs['limit'](_0x328646[_0x400a('0x30')]['limit']);_0xd7fa75[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x328646[_0x400a('0x30')]['offset']);}_0xd7fa75['order']=qs['sort'](_0x328646[_0x400a('0x30')][_0x400a('0x38')]);_0xd7fa75[_0x400a('0x39')]=qs[_0x400a('0x32')](_['pick'](_0x328646[_0x400a('0x30')],_0x5df6c1['filters']),_0x2246d8);if(_0x328646[_0x400a('0x30')][_0x400a('0x3a')]){_0xd7fa75['where']=_[_0x400a('0x3b')](_0xd7fa75['where'],{'$or':_['map'](_0x2246d8,function(_0xadbb41){if(_0xadbb41[_0x400a('0x2d')]!=='VIRTUAL'){var _0x1674c5={};_0x1674c5[_0xadbb41[_0x400a('0x28')]]={'$like':'%'+_0x328646[_0x400a('0x30')][_0x400a('0x3a')]+'%'};return _0x1674c5;}})});}_0xd7fa75=_[_0x400a('0x3b')]({},_0xd7fa75,_0x328646[_0x400a('0x3c')]);var _0xf6bd64={'where':_0xd7fa75[_0x400a('0x39')]};return db[_0x400a('0x2b')]['count'](_0xf6bd64)[_0x400a('0x24')](function(_0x3f38e2){_0x34a80e[_0x400a('0x1e')]=_0x3f38e2;if(_0x328646['query']['includeAll']){_0xd7fa75[_0x400a('0x3d')]=[{'all':!![]}];}return db[_0x400a('0x2b')][_0x400a('0x3e')](_0xd7fa75);})[_0x400a('0x24')](function(_0x168388){_0x34a80e['rows']=_0x168388;return _0x34a80e;})['then'](respondWithFilteredResult(_0x3860dc,_0xd7fa75))['catch'](handleError(_0x3860dc,null));};exports[_0x400a('0x3f')]=function(_0x37bfb0,_0xf5ed63){var _0x10cefb={'raw':![],'where':{'id':_0x37bfb0['params']['id']}},_0x5555f1={};_0x5555f1['model']=_['keys'](db[_0x400a('0x2b')][_0x400a('0x2c')]);_0x5555f1['query']=_[_0x400a('0x31')](_0x37bfb0[_0x400a('0x30')]);_0x5555f1[_0x400a('0x32')]=_[_0x400a('0x33')](_0x5555f1[_0x400a('0x35')],_0x5555f1[_0x400a('0x30')]);_0x10cefb[_0x400a('0x34')]=_[_0x400a('0x33')](_0x5555f1[_0x400a('0x35')],qs[_0x400a('0x36')](_0x37bfb0[_0x400a('0x30')][_0x400a('0x36')]));_0x10cefb[_0x400a('0x34')]=_0x10cefb[_0x400a('0x34')][_0x400a('0x40')]?_0x10cefb[_0x400a('0x34')]:_0x5555f1[_0x400a('0x35')];if(_0x37bfb0[_0x400a('0x30')][_0x400a('0x41')]){_0x10cefb['include']=[{'all':!![]}];}_0x10cefb=_[_0x400a('0x3b')]({},_0x10cefb,_0x37bfb0[_0x400a('0x3c')]);return db[_0x400a('0x2b')][_0x400a('0x42')](_0x10cefb)[_0x400a('0x24')](handleEntityNotFound(_0xf5ed63,null))['then'](respondWithResult(_0xf5ed63,null))[_0x400a('0x43')](handleError(_0xf5ed63,null));};exports['create']=function(_0x4c95d1,_0x2e526e){return db[_0x400a('0x2b')][_0x400a('0x44')](_0x4c95d1[_0x400a('0x45')],{})[_0x400a('0x24')](respondWithResult(_0x2e526e,0xc9))[_0x400a('0x43')](handleError(_0x2e526e,null));};exports[_0x400a('0x23')]=function(_0x4db15c,_0x5b2557){if(_0x4db15c['body']['id']){delete _0x4db15c[_0x400a('0x45')]['id'];}return db[_0x400a('0x2b')]['find']({'where':{'id':_0x4db15c['params']['id']}})[_0x400a('0x24')](handleEntityNotFound(_0x5b2557,null))[_0x400a('0x24')](saveUpdates(_0x4db15c[_0x400a('0x45')],null))[_0x400a('0x24')](respondWithResult(_0x5b2557,null))['catch'](handleError(_0x5b2557,null));};exports[_0x400a('0x25')]=function(_0xe5d048,_0xf15d82){return db[_0x400a('0x2b')]['find']({'where':{'id':_0xe5d048[_0x400a('0x46')]['id']}})[_0x400a('0x24')](handleEntityNotFound(_0xf15d82,null))[_0x400a('0x24')](removeEntity(_0xf15d82,null))[_0x400a('0x43')](handleError(_0xf15d82,null));};exports['getFields']=function(_0x477745,_0x25f29a,_0x3f7392){var _0x421c5={};var _0x21741d={};var _0x38a0a7;var _0x332513;return db[_0x400a('0x2b')][_0x400a('0x47')]({'where':{'id':_0x477745['params']['id']}})[_0x400a('0x24')](handleEntityNotFound(_0x25f29a,null))[_0x400a('0x24')](function(_0x47b4ce){if(_0x47b4ce){_0x38a0a7=_0x47b4ce;_0x21741d['model']=_[_0x400a('0x31')](db['SugarcrmField']['rawAttributes']);_0x21741d[_0x400a('0x30')]=_[_0x400a('0x31')](_0x477745[_0x400a('0x30')]);_0x21741d['filters']=_[_0x400a('0x33')](_0x21741d['model'],_0x21741d[_0x400a('0x30')]);_0x421c5[_0x400a('0x34')]=_[_0x400a('0x33')](_0x21741d[_0x400a('0x35')],qs[_0x400a('0x36')](_0x477745[_0x400a('0x30')]['fields']));_0x421c5[_0x400a('0x34')]=_0x421c5[_0x400a('0x34')][_0x400a('0x40')]?_0x421c5[_0x400a('0x34')]:_0x21741d[_0x400a('0x35')];_0x421c5[_0x400a('0x48')]=qs['sort'](_0x477745[_0x400a('0x30')][_0x400a('0x38')]);_0x421c5[_0x400a('0x39')]=qs[_0x400a('0x32')](_[_0x400a('0x49')](_0x477745[_0x400a('0x30')],_0x21741d['filters']));if(_0x477745[_0x400a('0x30')]['filter']){_0x421c5[_0x400a('0x39')]=_[_0x400a('0x3b')](_0x421c5[_0x400a('0x39')],{'$or':_['map'](_0x421c5['attributes'],function(_0x3468b3){var _0x4a7171={};_0x4a7171[_0x3468b3]={'$like':'%'+_0x477745['query']['filter']+'%'};return _0x4a7171;})});}_0x421c5=_[_0x400a('0x3b')]({},_0x421c5,_0x477745[_0x400a('0x3c')]);return _0x38a0a7[_0x400a('0x4a')](_0x421c5);}})[_0x400a('0x24')](function(_0x357ea6){if(_0x357ea6){_0x332513=_0x357ea6[_0x400a('0x40')];if(!_0x477745[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x4b'))){_0x421c5['limit']=qs[_0x400a('0x1d')](_0x477745[_0x400a('0x30')][_0x400a('0x1d')]);_0x421c5[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x477745[_0x400a('0x30')][_0x400a('0x1b')]);}return _0x38a0a7['getFields'](_0x421c5);}})['then'](function(_0x4b8b45){if(_0x4b8b45){return _0x4b8b45?{'count':_0x332513,'rows':_0x4b8b45}:null;}})[_0x400a('0x24')](respondWithResult(_0x25f29a,null))[_0x400a('0x43')](handleError(_0x25f29a,null));};exports['getSubjects']=function(_0x38b993,_0x5425c5,_0x52674a){var _0x430e66={};var _0x51464c={};var _0x678369;var _0x59548c;return db[_0x400a('0x2b')][_0x400a('0x47')]({'where':{'id':_0x38b993['params']['id']}})[_0x400a('0x24')](handleEntityNotFound(_0x5425c5,null))[_0x400a('0x24')](function(_0x553c90){if(_0x553c90){_0x678369=_0x553c90;_0x51464c[_0x400a('0x35')]=_['keys'](db[_0x400a('0x4c')]['rawAttributes']);_0x51464c['query']=_[_0x400a('0x31')](_0x38b993[_0x400a('0x30')]);_0x51464c[_0x400a('0x32')]=_[_0x400a('0x33')](_0x51464c['model'],_0x51464c[_0x400a('0x30')]);_0x430e66[_0x400a('0x34')]=_[_0x400a('0x33')](_0x51464c[_0x400a('0x35')],qs['fields'](_0x38b993['query'][_0x400a('0x36')]));_0x430e66['attributes']=_0x430e66[_0x400a('0x34')][_0x400a('0x40')]?_0x430e66[_0x400a('0x34')]:_0x51464c[_0x400a('0x35')];_0x430e66[_0x400a('0x48')]=qs[_0x400a('0x38')](_0x38b993['query'][_0x400a('0x38')]);_0x430e66[_0x400a('0x39')]=qs[_0x400a('0x32')](_[_0x400a('0x49')](_0x38b993['query'],_0x51464c[_0x400a('0x32')]));if(_0x38b993['query'][_0x400a('0x3a')]){_0x430e66[_0x400a('0x39')]=_[_0x400a('0x3b')](_0x430e66[_0x400a('0x39')],{'$or':_[_0x400a('0x2f')](_0x430e66['attributes'],function(_0xa4319e){var _0x428b4a={};_0x428b4a[_0xa4319e]={'$like':'%'+_0x38b993[_0x400a('0x30')][_0x400a('0x3a')]+'%'};return _0x428b4a;})});}_0x430e66=_[_0x400a('0x3b')]({},_0x430e66,_0x38b993[_0x400a('0x3c')]);return _0x678369[_0x400a('0x4d')](_0x430e66);}})[_0x400a('0x24')](function(_0x2d42f5){if(_0x2d42f5){_0x59548c=_0x2d42f5[_0x400a('0x40')];if(!_0x38b993[_0x400a('0x30')]['hasOwnProperty'](_0x400a('0x4b'))){_0x430e66[_0x400a('0x1d')]=qs[_0x400a('0x1d')](_0x38b993[_0x400a('0x30')][_0x400a('0x1d')]);_0x430e66[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x38b993[_0x400a('0x30')]['offset']);}return _0x678369[_0x400a('0x4d')](_0x430e66);}})[_0x400a('0x24')](function(_0x2aa3df){if(_0x2aa3df){return _0x2aa3df?{'count':_0x59548c,'rows':_0x2aa3df}:null;}})[_0x400a('0x24')](respondWithResult(_0x5425c5,null))[_0x400a('0x43')](handleError(_0x5425c5,null));};exports['getDescriptions']=function(_0x1654a1,_0x1a6ba0,_0x1821d0){var _0x19f913={};var _0xb95d77={};var _0x4e1514;var _0xaa9fe9;return db[_0x400a('0x2b')][_0x400a('0x47')]({'where':{'id':_0x1654a1[_0x400a('0x46')]['id']}})[_0x400a('0x24')](handleEntityNotFound(_0x1a6ba0,null))['then'](function(_0x2869e3){if(_0x2869e3){_0x4e1514=_0x2869e3;_0xb95d77[_0x400a('0x35')]=_[_0x400a('0x31')](db[_0x400a('0x4c')][_0x400a('0x2c')]);_0xb95d77[_0x400a('0x30')]=_[_0x400a('0x31')](_0x1654a1[_0x400a('0x30')]);_0xb95d77['filters']=_[_0x400a('0x33')](_0xb95d77[_0x400a('0x35')],_0xb95d77['query']);_0x19f913['attributes']=_[_0x400a('0x33')](_0xb95d77[_0x400a('0x35')],qs['fields'](_0x1654a1['query'][_0x400a('0x36')]));_0x19f913[_0x400a('0x34')]=_0x19f913[_0x400a('0x34')]['length']?_0x19f913[_0x400a('0x34')]:_0xb95d77[_0x400a('0x35')];_0x19f913[_0x400a('0x48')]=qs[_0x400a('0x38')](_0x1654a1[_0x400a('0x30')]['sort']);_0x19f913[_0x400a('0x39')]=qs[_0x400a('0x32')](_[_0x400a('0x49')](_0x1654a1[_0x400a('0x30')],_0xb95d77[_0x400a('0x32')]));if(_0x1654a1['query'][_0x400a('0x3a')]){_0x19f913[_0x400a('0x39')]=_['merge'](_0x19f913[_0x400a('0x39')],{'$or':_['map'](_0x19f913[_0x400a('0x34')],function(_0x6c2aca){var _0x1396bc={};_0x1396bc[_0x6c2aca]={'$like':'%'+_0x1654a1['query'][_0x400a('0x3a')]+'%'};return _0x1396bc;})});}_0x19f913=_[_0x400a('0x3b')]({},_0x19f913,_0x1654a1['options']);return _0x4e1514[_0x400a('0x4e')](_0x19f913);}})[_0x400a('0x24')](function(_0x118a82){if(_0x118a82){_0xaa9fe9=_0x118a82[_0x400a('0x40')];if(!_0x1654a1['query'][_0x400a('0x37')]('nolimit')){_0x19f913['limit']=qs[_0x400a('0x1d')](_0x1654a1[_0x400a('0x30')]['limit']);_0x19f913[_0x400a('0x1b')]=qs['offset'](_0x1654a1[_0x400a('0x30')][_0x400a('0x1b')]);}return _0x4e1514[_0x400a('0x4e')](_0x19f913);}})[_0x400a('0x24')](function(_0x3c60c4){if(_0x3c60c4){return _0x3c60c4?{'count':_0xaa9fe9,'rows':_0x3c60c4}:null;}})['then'](respondWithResult(_0x1a6ba0,null))[_0x400a('0x43')](handleError(_0x1a6ba0,null));}; \ No newline at end of file +var _0x3354=['SugarcrmField','pick','filter','nolimit','getSubjects','findOne','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SugarcrmConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','update','body','params','find','getFields'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3354,0x1ec));var _0x4335=function(_0x370ed3,_0x33ac18){_0x370ed3=_0x370ed3-0x0;var _0x332338=_0x3354[_0x370ed3];return _0x332338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4335('0x0'));var zipdir=require(_0x4335('0x1'));var jsonpatch=require(_0x4335('0x2'));var rp=require('request-promise');var moment=require(_0x4335('0x3'));var BPromise=require(_0x4335('0x4'));var Mustache=require(_0x4335('0x5'));var util=require(_0x4335('0x6'));var path=require('path');var sox=require(_0x4335('0x7'));var csv=require(_0x4335('0x8'));var ejs=require(_0x4335('0x9'));var fs=require('fs');var fs_extra=require(_0x4335('0xa'));var _=require(_0x4335('0xb'));var squel=require(_0x4335('0xc'));var crypto=require(_0x4335('0xd'));var jsforce=require(_0x4335('0xe'));var deskjs=require(_0x4335('0xf'));var toCsv=require(_0x4335('0x8'));var querystring=require(_0x4335('0x10'));var Papa=require(_0x4335('0x11'));var Redis=require(_0x4335('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4335('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4335('0x14'));var logger=require(_0x4335('0x15'))('api');var utils=require(_0x4335('0x16'));var config=require(_0x4335('0x17'));var licenseUtil=require(_0x4335('0x18'));var db=require(_0x4335('0x19'))['db'];function respondWithStatusCode(_0x323a95,_0x19649e){_0x19649e=_0x19649e||0xcc;return function(_0x316639){if(_0x316639){return _0x323a95[_0x4335('0x1a')](_0x19649e);}return _0x323a95[_0x4335('0x1b')](_0x19649e)[_0x4335('0x1c')]();};}function respondWithResult(_0x3111cb,_0x4afee8){_0x4afee8=_0x4afee8||0xc8;return function(_0xe5d5cd){if(_0xe5d5cd){return _0x3111cb[_0x4335('0x1b')](_0x4afee8)[_0x4335('0x1d')](_0xe5d5cd);}};}function respondWithFilteredResult(_0x963190,_0x3778f9){return function(_0x21d535){if(_0x21d535){var _0x7a3ac1=typeof _0x3778f9[_0x4335('0x1e')]==='undefined'&&typeof _0x3778f9[_0x4335('0x1f')]==='undefined';var _0x59c055=_0x21d535[_0x4335('0x20')];var _0xd2cd40=_0x7a3ac1?0x0:_0x3778f9['offset'];var _0x4e56e0=_0x7a3ac1?_0x21d535['count']:_0x3778f9['offset']+_0x3778f9['limit'];var _0x16d6d4;if(_0x4e56e0>=_0x59c055){_0x4e56e0=_0x59c055;_0x16d6d4=0xc8;}else{_0x16d6d4=0xce;}_0x963190[_0x4335('0x1b')](_0x16d6d4);return _0x963190[_0x4335('0x21')](_0x4335('0x22'),_0xd2cd40+'-'+_0x4e56e0+'/'+_0x59c055)[_0x4335('0x1d')](_0x21d535);}return null;};}function patchUpdates(_0x45d959){return function(_0x102618){try{jsonpatch[_0x4335('0x23')](_0x102618,_0x45d959,!![]);}catch(_0x1fcb5c){return BPromise[_0x4335('0x24')](_0x1fcb5c);}return _0x102618[_0x4335('0x25')]();};}function saveUpdates(_0x102532,_0x1f4bfc){return function(_0x50ce9d){if(_0x50ce9d){return _0x50ce9d['update'](_0x102532)[_0x4335('0x26')](function(_0x4e0af9){return _0x4e0af9;});}return null;};}function removeEntity(_0x3e6277,_0x1cc0da){return function(_0x4f1f26){if(_0x4f1f26){return _0x4f1f26[_0x4335('0x27')]()[_0x4335('0x26')](function(){_0x3e6277[_0x4335('0x1b')](0xcc)[_0x4335('0x1c')]();});}};}function handleEntityNotFound(_0xa15eee,_0x18d8f8){return function(_0x2e8cd2){if(!_0x2e8cd2){_0xa15eee['sendStatus'](0x194);}return _0x2e8cd2;};}function handleError(_0xfdd660,_0x46b314){_0x46b314=_0x46b314||0x1f4;return function(_0x5cc080){logger['error'](_0x5cc080[_0x4335('0x28')]);if(_0x5cc080['name']){delete _0x5cc080[_0x4335('0x29')];}_0xfdd660[_0x4335('0x1b')](_0x46b314)[_0x4335('0x2a')](_0x5cc080);};}exports['index']=function(_0x42ce5b,_0x1a235b){var _0xa51396={},_0x5b0d09={},_0x5d8b4e={'count':0x0,'rows':[]};var _0x237876=_['map'](db[_0x4335('0x2b')][_0x4335('0x2c')],function(_0x26fc70){return{'name':_0x26fc70['fieldName'],'type':_0x26fc70[_0x4335('0x2d')][_0x4335('0x2e')]};});_0x5b0d09[_0x4335('0x2f')]=_[_0x4335('0x30')](_0x237876,'name');_0x5b0d09[_0x4335('0x31')]=_[_0x4335('0x32')](_0x42ce5b[_0x4335('0x31')]);_0x5b0d09[_0x4335('0x33')]=_['intersection'](_0x5b0d09[_0x4335('0x2f')],_0x5b0d09[_0x4335('0x31')]);_0xa51396[_0x4335('0x34')]=_[_0x4335('0x35')](_0x5b0d09[_0x4335('0x2f')],qs[_0x4335('0x36')](_0x42ce5b[_0x4335('0x31')][_0x4335('0x36')]));_0xa51396[_0x4335('0x34')]=_0xa51396[_0x4335('0x34')][_0x4335('0x37')]?_0xa51396['attributes']:_0x5b0d09[_0x4335('0x2f')];if(!_0x42ce5b[_0x4335('0x31')][_0x4335('0x38')]('nolimit')){_0xa51396[_0x4335('0x1f')]=qs['limit'](_0x42ce5b[_0x4335('0x31')][_0x4335('0x1f')]);_0xa51396[_0x4335('0x1e')]=qs['offset'](_0x42ce5b[_0x4335('0x31')][_0x4335('0x1e')]);}_0xa51396[_0x4335('0x39')]=qs[_0x4335('0x3a')](_0x42ce5b[_0x4335('0x31')][_0x4335('0x3a')]);_0xa51396[_0x4335('0x3b')]=qs[_0x4335('0x33')](_['pick'](_0x42ce5b[_0x4335('0x31')],_0x5b0d09['filters']),_0x237876);if(_0x42ce5b[_0x4335('0x31')]['filter']){_0xa51396['where']=_[_0x4335('0x3c')](_0xa51396[_0x4335('0x3b')],{'$or':_[_0x4335('0x30')](_0x237876,function(_0x5a90cf){if(_0x5a90cf[_0x4335('0x2d')]!==_0x4335('0x3d')){var _0x2411d5={};_0x2411d5[_0x5a90cf[_0x4335('0x29')]]={'$like':'%'+_0x42ce5b[_0x4335('0x31')]['filter']+'%'};return _0x2411d5;}})});}_0xa51396=_[_0x4335('0x3c')]({},_0xa51396,_0x42ce5b[_0x4335('0x3e')]);var _0x445bd={'where':_0xa51396['where']};return db['SugarcrmConfiguration'][_0x4335('0x20')](_0x445bd)[_0x4335('0x26')](function(_0x558e0b){_0x5d8b4e[_0x4335('0x20')]=_0x558e0b;if(_0x42ce5b[_0x4335('0x31')][_0x4335('0x3f')]){_0xa51396['include']=[{'all':!![]}];}return db[_0x4335('0x2b')][_0x4335('0x40')](_0xa51396);})[_0x4335('0x26')](function(_0x3f80bc){_0x5d8b4e[_0x4335('0x41')]=_0x3f80bc;return _0x5d8b4e;})[_0x4335('0x26')](respondWithFilteredResult(_0x1a235b,_0xa51396))[_0x4335('0x42')](handleError(_0x1a235b,null));};exports[_0x4335('0x43')]=function(_0x584319,_0x3608aa){var _0x24484c={'raw':![],'where':{'id':_0x584319['params']['id']}},_0x4cbe8d={};_0x4cbe8d[_0x4335('0x2f')]=_[_0x4335('0x32')](db[_0x4335('0x2b')][_0x4335('0x2c')]);_0x4cbe8d[_0x4335('0x31')]=_['keys'](_0x584319[_0x4335('0x31')]);_0x4cbe8d[_0x4335('0x33')]=_[_0x4335('0x35')](_0x4cbe8d['model'],_0x4cbe8d[_0x4335('0x31')]);_0x24484c['attributes']=_[_0x4335('0x35')](_0x4cbe8d[_0x4335('0x2f')],qs[_0x4335('0x36')](_0x584319['query'][_0x4335('0x36')]));_0x24484c['attributes']=_0x24484c[_0x4335('0x34')][_0x4335('0x37')]?_0x24484c[_0x4335('0x34')]:_0x4cbe8d[_0x4335('0x2f')];if(_0x584319['query'][_0x4335('0x3f')]){_0x24484c[_0x4335('0x44')]=[{'all':!![]}];}_0x24484c=_[_0x4335('0x3c')]({},_0x24484c,_0x584319['options']);return db[_0x4335('0x2b')]['find'](_0x24484c)['then'](handleEntityNotFound(_0x3608aa,null))[_0x4335('0x26')](respondWithResult(_0x3608aa,null))['catch'](handleError(_0x3608aa,null));};exports[_0x4335('0x45')]=function(_0x2c2284,_0xa551a9){return db[_0x4335('0x2b')]['create'](_0x2c2284['body'],{})[_0x4335('0x26')](respondWithResult(_0xa551a9,0xc9))[_0x4335('0x42')](handleError(_0xa551a9,null));};exports[_0x4335('0x46')]=function(_0x9f81cd,_0x1f5e88){if(_0x9f81cd[_0x4335('0x47')]['id']){delete _0x9f81cd[_0x4335('0x47')]['id'];}return db[_0x4335('0x2b')]['find']({'where':{'id':_0x9f81cd[_0x4335('0x48')]['id']}})[_0x4335('0x26')](handleEntityNotFound(_0x1f5e88,null))[_0x4335('0x26')](saveUpdates(_0x9f81cd[_0x4335('0x47')],null))['then'](respondWithResult(_0x1f5e88,null))['catch'](handleError(_0x1f5e88,null));};exports[_0x4335('0x27')]=function(_0x4208bc,_0x4c85b9){return db[_0x4335('0x2b')][_0x4335('0x49')]({'where':{'id':_0x4208bc[_0x4335('0x48')]['id']}})[_0x4335('0x26')](handleEntityNotFound(_0x4c85b9,null))['then'](removeEntity(_0x4c85b9,null))['catch'](handleError(_0x4c85b9,null));};exports[_0x4335('0x4a')]=function(_0x39a9c0,_0x44731a,_0x540e02){var _0x341203={};var _0x283717={};var _0x38edd2;var _0x139d0c;return db[_0x4335('0x2b')]['findOne']({'where':{'id':_0x39a9c0[_0x4335('0x48')]['id']}})['then'](handleEntityNotFound(_0x44731a,null))[_0x4335('0x26')](function(_0x2b7475){if(_0x2b7475){_0x38edd2=_0x2b7475;_0x283717['model']=_[_0x4335('0x32')](db[_0x4335('0x4b')]['rawAttributes']);_0x283717['query']=_[_0x4335('0x32')](_0x39a9c0[_0x4335('0x31')]);_0x283717['filters']=_[_0x4335('0x35')](_0x283717[_0x4335('0x2f')],_0x283717[_0x4335('0x31')]);_0x341203[_0x4335('0x34')]=_[_0x4335('0x35')](_0x283717[_0x4335('0x2f')],qs[_0x4335('0x36')](_0x39a9c0['query'][_0x4335('0x36')]));_0x341203[_0x4335('0x34')]=_0x341203[_0x4335('0x34')][_0x4335('0x37')]?_0x341203[_0x4335('0x34')]:_0x283717[_0x4335('0x2f')];_0x341203[_0x4335('0x39')]=qs['sort'](_0x39a9c0[_0x4335('0x31')][_0x4335('0x3a')]);_0x341203[_0x4335('0x3b')]=qs[_0x4335('0x33')](_[_0x4335('0x4c')](_0x39a9c0['query'],_0x283717[_0x4335('0x33')]));if(_0x39a9c0[_0x4335('0x31')][_0x4335('0x4d')]){_0x341203[_0x4335('0x3b')]=_[_0x4335('0x3c')](_0x341203['where'],{'$or':_[_0x4335('0x30')](_0x341203['attributes'],function(_0x1bfa95){var _0xaf4fc7={};_0xaf4fc7[_0x1bfa95]={'$like':'%'+_0x39a9c0[_0x4335('0x31')]['filter']+'%'};return _0xaf4fc7;})});}_0x341203=_[_0x4335('0x3c')]({},_0x341203,_0x39a9c0[_0x4335('0x3e')]);return _0x38edd2[_0x4335('0x4a')](_0x341203);}})[_0x4335('0x26')](function(_0x6e60da){if(_0x6e60da){_0x139d0c=_0x6e60da['length'];if(!_0x39a9c0['query'][_0x4335('0x38')](_0x4335('0x4e'))){_0x341203[_0x4335('0x1f')]=qs[_0x4335('0x1f')](_0x39a9c0[_0x4335('0x31')][_0x4335('0x1f')]);_0x341203[_0x4335('0x1e')]=qs[_0x4335('0x1e')](_0x39a9c0[_0x4335('0x31')][_0x4335('0x1e')]);}return _0x38edd2[_0x4335('0x4a')](_0x341203);}})[_0x4335('0x26')](function(_0x568487){if(_0x568487){return _0x568487?{'count':_0x139d0c,'rows':_0x568487}:null;}})[_0x4335('0x26')](respondWithResult(_0x44731a,null))[_0x4335('0x42')](handleError(_0x44731a,null));};exports[_0x4335('0x4f')]=function(_0x3c673b,_0x355788,_0x56b46b){var _0x33ed5e={};var _0x55e0c0={};var _0x81bcce;var _0x3e07bf;return db[_0x4335('0x2b')][_0x4335('0x50')]({'where':{'id':_0x3c673b['params']['id']}})[_0x4335('0x26')](handleEntityNotFound(_0x355788,null))[_0x4335('0x26')](function(_0x1b2055){if(_0x1b2055){_0x81bcce=_0x1b2055;_0x55e0c0[_0x4335('0x2f')]=_[_0x4335('0x32')](db[_0x4335('0x4b')][_0x4335('0x2c')]);_0x55e0c0[_0x4335('0x31')]=_[_0x4335('0x32')](_0x3c673b['query']);_0x55e0c0['filters']=_[_0x4335('0x35')](_0x55e0c0[_0x4335('0x2f')],_0x55e0c0[_0x4335('0x31')]);_0x33ed5e[_0x4335('0x34')]=_['intersection'](_0x55e0c0[_0x4335('0x2f')],qs[_0x4335('0x36')](_0x3c673b['query'][_0x4335('0x36')]));_0x33ed5e[_0x4335('0x34')]=_0x33ed5e[_0x4335('0x34')][_0x4335('0x37')]?_0x33ed5e[_0x4335('0x34')]:_0x55e0c0[_0x4335('0x2f')];_0x33ed5e[_0x4335('0x39')]=qs[_0x4335('0x3a')](_0x3c673b[_0x4335('0x31')]['sort']);_0x33ed5e[_0x4335('0x3b')]=qs[_0x4335('0x33')](_[_0x4335('0x4c')](_0x3c673b[_0x4335('0x31')],_0x55e0c0['filters']));if(_0x3c673b[_0x4335('0x31')]['filter']){_0x33ed5e['where']=_[_0x4335('0x3c')](_0x33ed5e[_0x4335('0x3b')],{'$or':_[_0x4335('0x30')](_0x33ed5e['attributes'],function(_0x590ebe){var _0x331b3c={};_0x331b3c[_0x590ebe]={'$like':'%'+_0x3c673b[_0x4335('0x31')][_0x4335('0x4d')]+'%'};return _0x331b3c;})});}_0x33ed5e=_['merge']({},_0x33ed5e,_0x3c673b[_0x4335('0x3e')]);return _0x81bcce[_0x4335('0x4f')](_0x33ed5e);}})['then'](function(_0x5bcb53){if(_0x5bcb53){_0x3e07bf=_0x5bcb53[_0x4335('0x37')];if(!_0x3c673b['query'][_0x4335('0x38')](_0x4335('0x4e'))){_0x33ed5e['limit']=qs[_0x4335('0x1f')](_0x3c673b[_0x4335('0x31')]['limit']);_0x33ed5e[_0x4335('0x1e')]=qs[_0x4335('0x1e')](_0x3c673b[_0x4335('0x31')][_0x4335('0x1e')]);}return _0x81bcce[_0x4335('0x4f')](_0x33ed5e);}})['then'](function(_0x9fa9b3){if(_0x9fa9b3){return _0x9fa9b3?{'count':_0x3e07bf,'rows':_0x9fa9b3}:null;}})[_0x4335('0x26')](respondWithResult(_0x355788,null))['catch'](handleError(_0x355788,null));};exports['getDescriptions']=function(_0x161388,_0x3db835,_0x14e1db){var _0x732b41={};var _0xca9654={};var _0x5a60e2;var _0xa72452;return db[_0x4335('0x2b')]['findOne']({'where':{'id':_0x161388[_0x4335('0x48')]['id']}})[_0x4335('0x26')](handleEntityNotFound(_0x3db835,null))[_0x4335('0x26')](function(_0x2aa2b2){if(_0x2aa2b2){_0x5a60e2=_0x2aa2b2;_0xca9654[_0x4335('0x2f')]=_[_0x4335('0x32')](db['SugarcrmField'][_0x4335('0x2c')]);_0xca9654[_0x4335('0x31')]=_[_0x4335('0x32')](_0x161388[_0x4335('0x31')]);_0xca9654[_0x4335('0x33')]=_[_0x4335('0x35')](_0xca9654[_0x4335('0x2f')],_0xca9654[_0x4335('0x31')]);_0x732b41[_0x4335('0x34')]=_[_0x4335('0x35')](_0xca9654[_0x4335('0x2f')],qs[_0x4335('0x36')](_0x161388['query'][_0x4335('0x36')]));_0x732b41[_0x4335('0x34')]=_0x732b41[_0x4335('0x34')][_0x4335('0x37')]?_0x732b41[_0x4335('0x34')]:_0xca9654['model'];_0x732b41[_0x4335('0x39')]=qs[_0x4335('0x3a')](_0x161388[_0x4335('0x31')]['sort']);_0x732b41[_0x4335('0x3b')]=qs['filters'](_[_0x4335('0x4c')](_0x161388[_0x4335('0x31')],_0xca9654[_0x4335('0x33')]));if(_0x161388[_0x4335('0x31')][_0x4335('0x4d')]){_0x732b41[_0x4335('0x3b')]=_[_0x4335('0x3c')](_0x732b41[_0x4335('0x3b')],{'$or':_['map'](_0x732b41[_0x4335('0x34')],function(_0x3cea98){var _0x5e296a={};_0x5e296a[_0x3cea98]={'$like':'%'+_0x161388[_0x4335('0x31')][_0x4335('0x4d')]+'%'};return _0x5e296a;})});}_0x732b41=_['merge']({},_0x732b41,_0x161388[_0x4335('0x3e')]);return _0x5a60e2['getDescriptions'](_0x732b41);}})['then'](function(_0x5e95c5){if(_0x5e95c5){_0xa72452=_0x5e95c5[_0x4335('0x37')];if(!_0x161388[_0x4335('0x31')][_0x4335('0x38')](_0x4335('0x4e'))){_0x732b41[_0x4335('0x1f')]=qs[_0x4335('0x1f')](_0x161388[_0x4335('0x31')][_0x4335('0x1f')]);_0x732b41[_0x4335('0x1e')]=qs[_0x4335('0x1e')](_0x161388[_0x4335('0x31')][_0x4335('0x1e')]);}return _0x5a60e2['getDescriptions'](_0x732b41);}})['then'](function(_0x18a66c){if(_0x18a66c){return _0x18a66c?{'count':_0xa72452,'rows':_0x18a66c}:null;}})[_0x4335('0x26')](respondWithResult(_0x3db835,null))[_0x4335('0x42')](handleError(_0x3db835,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6d34b26..5a46fea 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 _0xd9d8=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4ddbc9,_0xe7290){var _0x20d5da=function(_0x53fc98){while(--_0x53fc98){_0x4ddbc9['push'](_0x4ddbc9['shift']());}};_0x20d5da(++_0xe7290);}(_0xd9d8,0x1e8));var _0x8d9d=function(_0x24092d,_0x5ce107){_0x24092d=_0x24092d-0x0;var _0x4d434f=_0xd9d8[_0x24092d];return _0x4d434f;};'use strict';var _=require(_0x8d9d('0x0'));var util=require(_0x8d9d('0x1'));var logger=require(_0x8d9d('0x2'))(_0x8d9d('0x3'));var moment=require('moment');var BPromise=require(_0x8d9d('0x4'));var rp=require(_0x8d9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d9d('0x6'));var config=require(_0x8d9d('0x7'));var attributes=require(_0x8d9d('0x8'));module[_0x8d9d('0x9')]=function(_0x4a3616,_0xda8b73){return _0x4a3616[_0x8d9d('0xa')](_0x8d9d('0xb'),attributes,{'tableName':_0x8d9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f2e=['util','../../config/logger','api','moment','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x273890,_0x3b58ea){var _0x262402=function(_0x7aad43){while(--_0x7aad43){_0x273890['push'](_0x273890['shift']());}};_0x262402(++_0x3b58ea);}(_0x4f2e,0x16b));var _0xe4f2=function(_0x2e7698,_0x2d1bb8){_0x2e7698=_0x2e7698-0x0;var _0x438792=_0x4f2e[_0x2e7698];return _0x438792;};'use strict';var _=require(_0xe4f2('0x0'));var util=require(_0xe4f2('0x1'));var logger=require(_0xe4f2('0x2'))(_0xe4f2('0x3'));var moment=require(_0xe4f2('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4f2('0x5'));var fs=require('fs');var path=require(_0xe4f2('0x6'));var rimraf=require(_0xe4f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe4f2('0x8'));module[_0xe4f2('0x9')]=function(_0x391646,_0x3c2358){return _0x391646[_0xe4f2('0xa')](_0xe4f2('0xb'),attributes,{'tableName':_0xe4f2('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 3013578..0e8dcf1 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 _0x0363=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0363,0xe7));var _0x3036=function(_0xd94791,_0x1e1c23){_0xd94791=_0xd94791-0x0;var _0x21494d=_0x0363[_0xd94791];return _0x21494d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3036('0x0'));var BPromise=require(_0x3036('0x1'));var rs=require(_0x3036('0x2'));var fs=require('fs');var Redis=require(_0x3036('0x3'));var db=require(_0x3036('0x4'))['db'];var utils=require(_0x3036('0x5'));var logger=require(_0x3036('0x6'))(_0x3036('0x7'));var config=require(_0x3036('0x8'));var jayson=require(_0x3036('0x9'));var client=jayson[_0x3036('0xa')][_0x3036('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b041d,_0xaace4c,_0x43f56c){return new BPromise(function(_0x47db02,_0x17d1b4){return client[_0x3036('0xc')](_0x5b041d,_0x43f56c)['then'](function(_0x5da5e6){logger['info'](_0x3036('0xd'),_0xaace4c,'request\x20sent');logger[_0x3036('0xe')](_0x3036('0xf'),_0xaace4c,_0x3036('0x10'),JSON[_0x3036('0x11')](_0x5da5e6));if(_0x5da5e6[_0x3036('0x12')]){if(_0x5da5e6[_0x3036('0x12')][_0x3036('0x13')]===0x1f4){logger[_0x3036('0x12')](_0x3036('0xd'),_0xaace4c,_0x5da5e6[_0x3036('0x12')][_0x3036('0x14')]);return _0x17d1b4(_0x5da5e6['error'][_0x3036('0x14')]);}logger[_0x3036('0x12')](_0x3036('0xd'),_0xaace4c,_0x5da5e6[_0x3036('0x12')][_0x3036('0x14')]);return _0x47db02(_0x5da5e6[_0x3036('0x12')]['message']);}else{logger['info'](_0x3036('0xd'),_0xaace4c,_0x3036('0x10'));_0x47db02(_0x5da5e6[_0x3036('0x15')]['message']);}})[_0x3036('0x16')](function(_0x499d98){logger[_0x3036('0x12')](_0x3036('0xd'),_0xaace4c,_0x499d98);_0x17d1b4(_0x499d98);});});} \ No newline at end of file +var _0xad72=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xad72,0x19b));var _0x2ad7=function(_0x999ddd,_0x4bbd39){_0x999ddd=_0x999ddd-0x0;var _0x1f9f4d=_0xad72[_0x999ddd];return _0x1f9f4d;};'use strict';var _=require('lodash');var util=require(_0x2ad7('0x0'));var moment=require(_0x2ad7('0x1'));var BPromise=require(_0x2ad7('0x2'));var rs=require(_0x2ad7('0x3'));var fs=require('fs');var Redis=require(_0x2ad7('0x4'));var db=require(_0x2ad7('0x5'))['db'];var utils=require(_0x2ad7('0x6'));var logger=require(_0x2ad7('0x7'))('rpc');var config=require(_0x2ad7('0x8'));var jayson=require(_0x2ad7('0x9'));var client=jayson[_0x2ad7('0xa')][_0x2ad7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5137b4,_0x5cc94c,_0x11718c){return new BPromise(function(_0x1da808,_0x25d6f6){return client[_0x2ad7('0xc')](_0x5137b4,_0x11718c)[_0x2ad7('0xd')](function(_0x4ed790){logger['info'](_0x2ad7('0xe'),_0x5cc94c,_0x2ad7('0xf'));logger[_0x2ad7('0x10')](_0x2ad7('0x11'),_0x5cc94c,'request\x20sent',JSON[_0x2ad7('0x12')](_0x4ed790));if(_0x4ed790[_0x2ad7('0x13')]){if(_0x4ed790[_0x2ad7('0x13')][_0x2ad7('0x14')]===0x1f4){logger[_0x2ad7('0x13')](_0x2ad7('0xe'),_0x5cc94c,_0x4ed790[_0x2ad7('0x13')]['message']);return _0x25d6f6(_0x4ed790['error'][_0x2ad7('0x15')]);}logger['error'](_0x2ad7('0xe'),_0x5cc94c,_0x4ed790[_0x2ad7('0x13')][_0x2ad7('0x15')]);return _0x1da808(_0x4ed790[_0x2ad7('0x13')]['message']);}else{logger[_0x2ad7('0x16')](_0x2ad7('0xe'),_0x5cc94c,'request\x20sent');_0x1da808(_0x4ed790[_0x2ad7('0x17')][_0x2ad7('0x15')]);}})[_0x2ad7('0x18')](function(_0x3044ee){logger[_0x2ad7('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5cc94c,_0x3044ee);_0x25d6f6(_0x3044ee);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 695ccf7..9a87c6e 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 _0x9371=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x33a781,_0x4acbe6){var _0x6a341e=function(_0x15d684){while(--_0x15d684){_0x33a781['push'](_0x33a781['shift']());}};_0x6a341e(++_0x4acbe6);}(_0x9371,0x154));var _0x1937=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9371[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1937('0x0'));var util=require(_0x1937('0x1'));var path=require(_0x1937('0x2'));var timeout=require(_0x1937('0x3'));var express=require(_0x1937('0x4'));var router=express[_0x1937('0x5')]();var fs_extra=require(_0x1937('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1937('0x7'));var config=require(_0x1937('0x8'));var controller=require(_0x1937('0x9'));router[_0x1937('0xa')]('/',auth[_0x1937('0xb')](),controller[_0x1937('0xc')]);router[_0x1937('0xa')](_0x1937('0xd'),auth[_0x1937('0xb')](),controller[_0x1937('0xe')]);router[_0x1937('0xf')]('/',auth[_0x1937('0xb')](),controller[_0x1937('0x10')]);router[_0x1937('0x11')](_0x1937('0xd'),auth[_0x1937('0xb')](),controller[_0x1937('0x12')]);router[_0x1937('0x13')](_0x1937('0xd'),auth['isAuthenticated'](),controller[_0x1937('0x14')]);module[_0x1937('0x15')]=router; \ No newline at end of file +var _0x0bb8=['index','/:id','post','isAuthenticated','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x2073bd,_0x34b6b6){var _0x88f8d9=function(_0x4af44d){while(--_0x4af44d){_0x2073bd['push'](_0x2073bd['shift']());}};_0x88f8d9(++_0x34b6b6);}(_0x0bb8,0x112));var _0x80bb=function(_0x41b960,_0x25d61d){_0x41b960=_0x41b960-0x0;var _0x32b3f1=_0x0bb8[_0x41b960];return _0x32b3f1;};'use strict';var multer=require(_0x80bb('0x0'));var util=require(_0x80bb('0x1'));var path=require(_0x80bb('0x2'));var timeout=require(_0x80bb('0x3'));var express=require(_0x80bb('0x4'));var router=express[_0x80bb('0x5')]();var fs_extra=require(_0x80bb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x80bb('0x7'));var config=require(_0x80bb('0x8'));var controller=require(_0x80bb('0x9'));router[_0x80bb('0xa')]('/',auth['isAuthenticated'](),controller[_0x80bb('0xb')]);router[_0x80bb('0xa')](_0x80bb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x80bb('0xd')]('/',auth[_0x80bb('0xe')](),controller[_0x80bb('0xf')]);router[_0x80bb('0x10')](_0x80bb('0xc'),auth[_0x80bb('0xe')](),controller[_0x80bb('0x11')]);router[_0x80bb('0x12')](_0x80bb('0xc'),auth[_0x80bb('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index b0ea911..05eeca3 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 _0xa6c1=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa6c1,0xa5));var _0x1a6c=function(_0x3adb8e,_0x247ca2){_0x3adb8e=_0x3adb8e-0x0;var _0x3eacdb=_0xa6c1[_0x3adb8e];return _0x3eacdb;};'use strict';var Sequelize=require(_0x1a6c('0x0'));module[_0x1a6c('0x1')]={'type':{'type':Sequelize[_0x1a6c('0x2')](_0x1a6c('0x3'),_0x1a6c('0x4'),_0x1a6c('0x5'),_0x1a6c('0x6'),_0x1a6c('0x7')),'defaultValue':_0x1a6c('0x3')},'content':{'type':Sequelize[_0x1a6c('0x8')]},'key':{'type':Sequelize[_0x1a6c('0x8')]},'keyType':{'type':Sequelize[_0x1a6c('0x2')]('string',_0x1a6c('0x4'),_0x1a6c('0x5'))},'keyContent':{'type':Sequelize[_0x1a6c('0x8')]},'idField':{'type':Sequelize[_0x1a6c('0x8')]},'nameField':{'type':Sequelize[_0x1a6c('0x8')]},'customField':{'type':Sequelize[_0x1a6c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a6c('0x8')]}}; \ No newline at end of file +var _0x6e73=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x129d52,_0x1beadf){var _0x79ef89=function(_0x4913bb){while(--_0x4913bb){_0x129d52['push'](_0x129d52['shift']());}};_0x79ef89(++_0x1beadf);}(_0x6e73,0x147));var _0x36e7=function(_0x10c4ea,_0x2d310d){_0x10c4ea=_0x10c4ea-0x0;var _0x355478=_0x6e73[_0x10c4ea];return _0x355478;};'use strict';var Sequelize=require('sequelize');module[_0x36e7('0x0')]={'type':{'type':Sequelize[_0x36e7('0x1')](_0x36e7('0x2'),_0x36e7('0x3'),_0x36e7('0x4'),_0x36e7('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x36e7('0x6')]},'key':{'type':Sequelize[_0x36e7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x36e7('0x2'),_0x36e7('0x3'),_0x36e7('0x4'))},'keyContent':{'type':Sequelize[_0x36e7('0x6')]},'idField':{'type':Sequelize[_0x36e7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 31a6fc7..03b942c 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 _0x0423=['includeAll','include','find','create','body','destroy','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','merge','options','SugarcrmField','findAll','catch','params'];(function(_0x2e7d49,_0x26ae35){var _0x1b7bf6=function(_0x3a354f){while(--_0x3a354f){_0x2e7d49['push'](_0x2e7d49['shift']());}};_0x1b7bf6(++_0x26ae35);}(_0x0423,0x1c8));var _0x3042=function(_0x5a15fc,_0x55f7a5){_0x5a15fc=_0x5a15fc-0x0;var _0xc4f77e=_0x0423[_0x5a15fc];return _0xc4f77e;};'use strict';var emlformat=require(_0x3042('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3042('0x1'));var rp=require(_0x3042('0x2'));var moment=require('moment');var BPromise=require(_0x3042('0x3'));var Mustache=require(_0x3042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3042('0x5'));var csv=require(_0x3042('0x6'));var ejs=require(_0x3042('0x7'));var fs=require('fs');var fs_extra=require(_0x3042('0x8'));var _=require(_0x3042('0x9'));var squel=require(_0x3042('0xa'));var crypto=require(_0x3042('0xb'));var jsforce=require(_0x3042('0xc'));var deskjs=require(_0x3042('0xd'));var toCsv=require(_0x3042('0x6'));var querystring=require(_0x3042('0xe'));var Papa=require(_0x3042('0xf'));var Redis=require(_0x3042('0x10'));var authService=require(_0x3042('0x11'));var qs=require(_0x3042('0x12'));var as=require(_0x3042('0x13'));var hardwareService=require(_0x3042('0x14'));var logger=require(_0x3042('0x15'))(_0x3042('0x16'));var utils=require(_0x3042('0x17'));var config=require(_0x3042('0x18'));var licenseUtil=require(_0x3042('0x19'));var db=require(_0x3042('0x1a'))['db'];function respondWithStatusCode(_0x56db18,_0x18c157){_0x18c157=_0x18c157||0xcc;return function(_0x3f6444){if(_0x3f6444){return _0x56db18[_0x3042('0x1b')](_0x18c157);}return _0x56db18[_0x3042('0x1c')](_0x18c157)['end']();};}function respondWithResult(_0x2b6463,_0x3a26f9){_0x3a26f9=_0x3a26f9||0xc8;return function(_0x5df9db){if(_0x5df9db){return _0x2b6463[_0x3042('0x1c')](_0x3a26f9)[_0x3042('0x1d')](_0x5df9db);}};}function respondWithFilteredResult(_0x346af0,_0x34d52e){return function(_0x22982d){if(_0x22982d){var _0x11dcf7=typeof _0x34d52e['offset']==='undefined'&&typeof _0x34d52e[_0x3042('0x1e')]===_0x3042('0x1f');var _0x404e13=_0x22982d[_0x3042('0x20')];var _0x4c62f9=_0x11dcf7?0x0:_0x34d52e[_0x3042('0x21')];var _0x536426=_0x11dcf7?_0x22982d[_0x3042('0x20')]:_0x34d52e[_0x3042('0x21')]+_0x34d52e[_0x3042('0x1e')];var _0x1dac36;if(_0x536426>=_0x404e13){_0x536426=_0x404e13;_0x1dac36=0xc8;}else{_0x1dac36=0xce;}_0x346af0['status'](_0x1dac36);return _0x346af0[_0x3042('0x22')](_0x3042('0x23'),_0x4c62f9+'-'+_0x536426+'/'+_0x404e13)['json'](_0x22982d);}return null;};}function patchUpdates(_0x198ada){return function(_0x4d09f9){try{jsonpatch[_0x3042('0x24')](_0x4d09f9,_0x198ada,!![]);}catch(_0x3a57bb){return BPromise[_0x3042('0x25')](_0x3a57bb);}return _0x4d09f9['save']();};}function saveUpdates(_0x1ec678,_0x4c4ffd){return function(_0x200872){if(_0x200872){return _0x200872[_0x3042('0x26')](_0x1ec678)[_0x3042('0x27')](function(_0x3bb2c2){return _0x3bb2c2;});}return null;};}function removeEntity(_0x15d845,_0x2010f2){return function(_0x90a648){if(_0x90a648){return _0x90a648['destroy']()['then'](function(){_0x15d845[_0x3042('0x1c')](0xcc)[_0x3042('0x28')]();});}};}function handleEntityNotFound(_0x23c666,_0x2f51cb){return function(_0x5e31cd){if(!_0x5e31cd){_0x23c666[_0x3042('0x1b')](0x194);}return _0x5e31cd;};}function handleError(_0x3eb3a2,_0x56a336){_0x56a336=_0x56a336||0x1f4;return function(_0x42b6f7){logger[_0x3042('0x29')](_0x42b6f7[_0x3042('0x2a')]);if(_0x42b6f7[_0x3042('0x2b')]){delete _0x42b6f7['name'];}_0x3eb3a2[_0x3042('0x1c')](_0x56a336)[_0x3042('0x2c')](_0x42b6f7);};}exports['index']=function(_0x531184,_0x49662a){var _0x150abe={},_0x4619ec={},_0x21ad8e={'count':0x0,'rows':[]};var _0x49a829=_[_0x3042('0x2d')](db['SugarcrmField'][_0x3042('0x2e')],function(_0x4decfd){return{'name':_0x4decfd[_0x3042('0x2f')],'type':_0x4decfd[_0x3042('0x30')]['key']};});_0x4619ec[_0x3042('0x31')]=_['map'](_0x49a829,_0x3042('0x2b'));_0x4619ec['query']=_[_0x3042('0x32')](_0x531184[_0x3042('0x33')]);_0x4619ec['filters']=_['intersection'](_0x4619ec['model'],_0x4619ec[_0x3042('0x33')]);_0x150abe['attributes']=_[_0x3042('0x34')](_0x4619ec[_0x3042('0x31')],qs[_0x3042('0x35')](_0x531184[_0x3042('0x33')][_0x3042('0x35')]));_0x150abe[_0x3042('0x36')]=_0x150abe[_0x3042('0x36')][_0x3042('0x37')]?_0x150abe[_0x3042('0x36')]:_0x4619ec[_0x3042('0x31')];if(!_0x531184[_0x3042('0x33')][_0x3042('0x38')](_0x3042('0x39'))){_0x150abe[_0x3042('0x1e')]=qs[_0x3042('0x1e')](_0x531184['query'][_0x3042('0x1e')]);_0x150abe['offset']=qs['offset'](_0x531184['query'][_0x3042('0x21')]);}_0x150abe[_0x3042('0x3a')]=qs['sort'](_0x531184[_0x3042('0x33')]['sort']);_0x150abe[_0x3042('0x3b')]=qs[_0x3042('0x3c')](_['pick'](_0x531184[_0x3042('0x33')],_0x4619ec[_0x3042('0x3c')]),_0x49a829);if(_0x531184['query'][_0x3042('0x3d')]){_0x150abe['where']=_['merge'](_0x150abe[_0x3042('0x3b')],{'$or':_[_0x3042('0x2d')](_0x49a829,function(_0x45a79c){if(_0x45a79c[_0x3042('0x30')]!==_0x3042('0x3e')){var _0x250e0c={};_0x250e0c[_0x45a79c[_0x3042('0x2b')]]={'$like':'%'+_0x531184[_0x3042('0x33')][_0x3042('0x3d')]+'%'};return _0x250e0c;}})});}_0x150abe=_[_0x3042('0x3f')]({},_0x150abe,_0x531184[_0x3042('0x40')]);var _0x449de9={'where':_0x150abe[_0x3042('0x3b')]};return db['SugarcrmField']['count'](_0x449de9)[_0x3042('0x27')](function(_0xf628ab){_0x21ad8e[_0x3042('0x20')]=_0xf628ab;if(_0x531184[_0x3042('0x33')]['includeAll']){_0x150abe['include']=[{'all':!![]}];}return db[_0x3042('0x41')][_0x3042('0x42')](_0x150abe);})[_0x3042('0x27')](function(_0x1f6204){_0x21ad8e['rows']=_0x1f6204;return _0x21ad8e;})['then'](respondWithFilteredResult(_0x49662a,_0x150abe))[_0x3042('0x43')](handleError(_0x49662a,null));};exports['show']=function(_0x430442,_0x5e69d4){var _0x5272f8={'raw':!![],'where':{'id':_0x430442[_0x3042('0x44')]['id']}},_0x4ee573={};_0x4ee573[_0x3042('0x31')]=_[_0x3042('0x32')](db['SugarcrmField']['rawAttributes']);_0x4ee573['query']=_[_0x3042('0x32')](_0x430442[_0x3042('0x33')]);_0x4ee573[_0x3042('0x3c')]=_[_0x3042('0x34')](_0x4ee573[_0x3042('0x31')],_0x4ee573[_0x3042('0x33')]);_0x5272f8[_0x3042('0x36')]=_['intersection'](_0x4ee573['model'],qs[_0x3042('0x35')](_0x430442[_0x3042('0x33')][_0x3042('0x35')]));_0x5272f8[_0x3042('0x36')]=_0x5272f8[_0x3042('0x36')][_0x3042('0x37')]?_0x5272f8['attributes']:_0x4ee573[_0x3042('0x31')];if(_0x430442[_0x3042('0x33')][_0x3042('0x45')]){_0x5272f8[_0x3042('0x46')]=[{'all':!![]}];}_0x5272f8=_[_0x3042('0x3f')]({},_0x5272f8,_0x430442[_0x3042('0x40')]);return db[_0x3042('0x41')][_0x3042('0x47')](_0x5272f8)[_0x3042('0x27')](handleEntityNotFound(_0x5e69d4,null))[_0x3042('0x27')](respondWithResult(_0x5e69d4,null))[_0x3042('0x43')](handleError(_0x5e69d4,null));};exports['create']=function(_0x1a0f3f,_0x12c2e2){return db[_0x3042('0x41')][_0x3042('0x48')](_0x1a0f3f[_0x3042('0x49')],{})[_0x3042('0x27')](respondWithResult(_0x12c2e2,0xc9))[_0x3042('0x43')](handleError(_0x12c2e2,null));};exports['update']=function(_0x21dadb,_0x23b111){if(_0x21dadb[_0x3042('0x49')]['id']){delete _0x21dadb['body']['id'];}return db['SugarcrmField'][_0x3042('0x47')]({'where':{'id':_0x21dadb['params']['id']}})[_0x3042('0x27')](handleEntityNotFound(_0x23b111,null))[_0x3042('0x27')](saveUpdates(_0x21dadb['body'],null))[_0x3042('0x27')](respondWithResult(_0x23b111,null))[_0x3042('0x43')](handleError(_0x23b111,null));};exports[_0x3042('0x4a')]=function(_0x570467,_0x1d7c8a){return db['SugarcrmField']['find']({'where':{'id':_0x570467[_0x3042('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d7c8a,null))[_0x3042('0x27')](removeEntity(_0x1d7c8a,null))[_0x3042('0x43')](handleError(_0x1d7c8a,null));}; \ No newline at end of file +var _0xd6eb=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2c2491,_0x1df20){var _0x4c3971=function(_0x36d861){while(--_0x36d861){_0x2c2491['push'](_0x2c2491['shift']());}};_0x4c3971(++_0x1df20);}(_0xd6eb,0x15a));var _0xbd6e=function(_0x4fcfda,_0x45099a){_0x4fcfda=_0x4fcfda-0x0;var _0x12c8a5=_0xd6eb[_0x4fcfda];return _0x12c8a5;};'use strict';var emlformat=require(_0xbd6e('0x0'));var rimraf=require(_0xbd6e('0x1'));var zipdir=require(_0xbd6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd6e('0x3'));var BPromise=require(_0xbd6e('0x4'));var Mustache=require(_0xbd6e('0x5'));var util=require(_0xbd6e('0x6'));var path=require(_0xbd6e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd6e('0x9'));var squel=require(_0xbd6e('0xa'));var crypto=require(_0xbd6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbd6e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd6e('0xd'));var Redis=require(_0xbd6e('0xe'));var authService=require(_0xbd6e('0xf'));var qs=require(_0xbd6e('0x10'));var as=require(_0xbd6e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd6e('0x12'))('api');var utils=require(_0xbd6e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbd6e('0x14'));var db=require(_0xbd6e('0x15'))['db'];function respondWithStatusCode(_0x50883c,_0x4e3834){_0x4e3834=_0x4e3834||0xcc;return function(_0x25062b){if(_0x25062b){return _0x50883c[_0xbd6e('0x16')](_0x4e3834);}return _0x50883c[_0xbd6e('0x17')](_0x4e3834)[_0xbd6e('0x18')]();};}function respondWithResult(_0x331d09,_0x3c77e0){_0x3c77e0=_0x3c77e0||0xc8;return function(_0x1a5560){if(_0x1a5560){return _0x331d09[_0xbd6e('0x17')](_0x3c77e0)[_0xbd6e('0x19')](_0x1a5560);}};}function respondWithFilteredResult(_0x4049ff,_0x49e8cb){return function(_0x59a668){if(_0x59a668){var _0x5f424b=typeof _0x49e8cb[_0xbd6e('0x1a')]==='undefined'&&typeof _0x49e8cb[_0xbd6e('0x1b')]===_0xbd6e('0x1c');var _0x1889bd=_0x59a668[_0xbd6e('0x1d')];var _0x10be4e=_0x5f424b?0x0:_0x49e8cb[_0xbd6e('0x1a')];var _0x12fa5a=_0x5f424b?_0x59a668[_0xbd6e('0x1d')]:_0x49e8cb[_0xbd6e('0x1a')]+_0x49e8cb[_0xbd6e('0x1b')];var _0x2d96aa;if(_0x12fa5a>=_0x1889bd){_0x12fa5a=_0x1889bd;_0x2d96aa=0xc8;}else{_0x2d96aa=0xce;}_0x4049ff[_0xbd6e('0x17')](_0x2d96aa);return _0x4049ff[_0xbd6e('0x1e')](_0xbd6e('0x1f'),_0x10be4e+'-'+_0x12fa5a+'/'+_0x1889bd)[_0xbd6e('0x19')](_0x59a668);}return null;};}function patchUpdates(_0x3eb8ff){return function(_0x5c5905){try{jsonpatch['apply'](_0x5c5905,_0x3eb8ff,!![]);}catch(_0x126fa7){return BPromise[_0xbd6e('0x20')](_0x126fa7);}return _0x5c5905[_0xbd6e('0x21')]();};}function saveUpdates(_0x1a5f0b,_0x146959){return function(_0x52f20d){if(_0x52f20d){return _0x52f20d[_0xbd6e('0x22')](_0x1a5f0b)[_0xbd6e('0x23')](function(_0x4ca119){return _0x4ca119;});}return null;};}function removeEntity(_0x3bb490,_0x3e7f2e){return function(_0x81bd95){if(_0x81bd95){return _0x81bd95[_0xbd6e('0x24')]()[_0xbd6e('0x23')](function(){_0x3bb490[_0xbd6e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389a21,_0x3d7d25){return function(_0x39ad68){if(!_0x39ad68){_0x389a21[_0xbd6e('0x16')](0x194);}return _0x39ad68;};}function handleError(_0x2e273a,_0x42d38f){_0x42d38f=_0x42d38f||0x1f4;return function(_0x4a3f7f){logger[_0xbd6e('0x25')](_0x4a3f7f[_0xbd6e('0x26')]);if(_0x4a3f7f[_0xbd6e('0x27')]){delete _0x4a3f7f[_0xbd6e('0x27')];}_0x2e273a[_0xbd6e('0x17')](_0x42d38f)[_0xbd6e('0x28')](_0x4a3f7f);};}exports[_0xbd6e('0x29')]=function(_0x4520bd,_0x95bfdf){var _0x3f557c={},_0x543e83={},_0x3f0ff4={'count':0x0,'rows':[]};var _0x37e67d=_['map'](db[_0xbd6e('0x2a')][_0xbd6e('0x2b')],function(_0x410d3b){return{'name':_0x410d3b[_0xbd6e('0x2c')],'type':_0x410d3b['type']['key']};});_0x543e83[_0xbd6e('0x2d')]=_[_0xbd6e('0x2e')](_0x37e67d,_0xbd6e('0x27'));_0x543e83[_0xbd6e('0x2f')]=_[_0xbd6e('0x30')](_0x4520bd[_0xbd6e('0x2f')]);_0x543e83[_0xbd6e('0x31')]=_[_0xbd6e('0x32')](_0x543e83['model'],_0x543e83[_0xbd6e('0x2f')]);_0x3f557c[_0xbd6e('0x33')]=_[_0xbd6e('0x32')](_0x543e83[_0xbd6e('0x2d')],qs[_0xbd6e('0x34')](_0x4520bd[_0xbd6e('0x2f')][_0xbd6e('0x34')]));_0x3f557c[_0xbd6e('0x33')]=_0x3f557c[_0xbd6e('0x33')][_0xbd6e('0x35')]?_0x3f557c[_0xbd6e('0x33')]:_0x543e83['model'];if(!_0x4520bd['query'][_0xbd6e('0x36')]('nolimit')){_0x3f557c[_0xbd6e('0x1b')]=qs[_0xbd6e('0x1b')](_0x4520bd[_0xbd6e('0x2f')][_0xbd6e('0x1b')]);_0x3f557c[_0xbd6e('0x1a')]=qs['offset'](_0x4520bd['query']['offset']);}_0x3f557c[_0xbd6e('0x37')]=qs[_0xbd6e('0x38')](_0x4520bd[_0xbd6e('0x2f')][_0xbd6e('0x38')]);_0x3f557c[_0xbd6e('0x39')]=qs[_0xbd6e('0x31')](_[_0xbd6e('0x3a')](_0x4520bd['query'],_0x543e83[_0xbd6e('0x31')]),_0x37e67d);if(_0x4520bd['query'][_0xbd6e('0x3b')]){_0x3f557c[_0xbd6e('0x39')]=_[_0xbd6e('0x3c')](_0x3f557c[_0xbd6e('0x39')],{'$or':_['map'](_0x37e67d,function(_0x5a8cd7){if(_0x5a8cd7[_0xbd6e('0x3d')]!==_0xbd6e('0x3e')){var _0x235d55={};_0x235d55[_0x5a8cd7['name']]={'$like':'%'+_0x4520bd[_0xbd6e('0x2f')][_0xbd6e('0x3b')]+'%'};return _0x235d55;}})});}_0x3f557c=_[_0xbd6e('0x3c')]({},_0x3f557c,_0x4520bd['options']);var _0x52e109={'where':_0x3f557c['where']};return db[_0xbd6e('0x2a')][_0xbd6e('0x1d')](_0x52e109)[_0xbd6e('0x23')](function(_0x41ab89){_0x3f0ff4[_0xbd6e('0x1d')]=_0x41ab89;if(_0x4520bd['query']['includeAll']){_0x3f557c[_0xbd6e('0x3f')]=[{'all':!![]}];}return db[_0xbd6e('0x2a')][_0xbd6e('0x40')](_0x3f557c);})[_0xbd6e('0x23')](function(_0x4603a0){_0x3f0ff4['rows']=_0x4603a0;return _0x3f0ff4;})[_0xbd6e('0x23')](respondWithFilteredResult(_0x95bfdf,_0x3f557c))[_0xbd6e('0x41')](handleError(_0x95bfdf,null));};exports[_0xbd6e('0x42')]=function(_0x5e157b,_0x42d7e2){var _0xc621d={'raw':!![],'where':{'id':_0x5e157b[_0xbd6e('0x43')]['id']}},_0x3f07d0={};_0x3f07d0[_0xbd6e('0x2d')]=_[_0xbd6e('0x30')](db[_0xbd6e('0x2a')]['rawAttributes']);_0x3f07d0[_0xbd6e('0x2f')]=_['keys'](_0x5e157b[_0xbd6e('0x2f')]);_0x3f07d0['filters']=_[_0xbd6e('0x32')](_0x3f07d0[_0xbd6e('0x2d')],_0x3f07d0['query']);_0xc621d[_0xbd6e('0x33')]=_[_0xbd6e('0x32')](_0x3f07d0['model'],qs[_0xbd6e('0x34')](_0x5e157b[_0xbd6e('0x2f')][_0xbd6e('0x34')]));_0xc621d[_0xbd6e('0x33')]=_0xc621d[_0xbd6e('0x33')]['length']?_0xc621d[_0xbd6e('0x33')]:_0x3f07d0[_0xbd6e('0x2d')];if(_0x5e157b[_0xbd6e('0x2f')][_0xbd6e('0x44')]){_0xc621d[_0xbd6e('0x3f')]=[{'all':!![]}];}_0xc621d=_[_0xbd6e('0x3c')]({},_0xc621d,_0x5e157b[_0xbd6e('0x45')]);return db[_0xbd6e('0x2a')]['find'](_0xc621d)[_0xbd6e('0x23')](handleEntityNotFound(_0x42d7e2,null))[_0xbd6e('0x23')](respondWithResult(_0x42d7e2,null))[_0xbd6e('0x41')](handleError(_0x42d7e2,null));};exports[_0xbd6e('0x46')]=function(_0x5813d7,_0x4f839f){return db[_0xbd6e('0x2a')]['create'](_0x5813d7['body'],{})[_0xbd6e('0x23')](respondWithResult(_0x4f839f,0xc9))[_0xbd6e('0x41')](handleError(_0x4f839f,null));};exports[_0xbd6e('0x22')]=function(_0x49fad3,_0x2089c1){if(_0x49fad3[_0xbd6e('0x47')]['id']){delete _0x49fad3['body']['id'];}return db['SugarcrmField'][_0xbd6e('0x48')]({'where':{'id':_0x49fad3[_0xbd6e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2089c1,null))['then'](saveUpdates(_0x49fad3[_0xbd6e('0x47')],null))[_0xbd6e('0x23')](respondWithResult(_0x2089c1,null))[_0xbd6e('0x41')](handleError(_0x2089c1,null));};exports[_0xbd6e('0x24')]=function(_0x2e80ec,_0x1741bd){return db[_0xbd6e('0x2a')][_0xbd6e('0x48')]({'where':{'id':_0x2e80ec[_0xbd6e('0x43')]['id']}})[_0xbd6e('0x23')](handleEntityNotFound(_0x1741bd,null))['then'](removeEntity(_0x1741bd,null))[_0xbd6e('0x41')](handleError(_0x1741bd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7a4e6f1..5a90f58 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 _0xfe93=['sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x4b1b76,_0x79c949){var _0x4f4638=function(_0x200d90){while(--_0x200d90){_0x4b1b76['push'](_0x4b1b76['shift']());}};_0x4f4638(++_0x79c949);}(_0xfe93,0xf1));var _0x3fe9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xfe93[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x3fe9('0x0'));var logger=require(_0x3fe9('0x1'))(_0x3fe9('0x2'));var moment=require(_0x3fe9('0x3'));var BPromise=require(_0x3fe9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fe9('0x5'));var config=require(_0x3fe9('0x6'));var attributes=require(_0x3fe9('0x7'));module[_0x3fe9('0x8')]=function(_0x97c1bc,_0x1035d8){return _0x97c1bc[_0x3fe9('0x9')](_0x3fe9('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3fe9('0xb'),'fields':[_0x3fe9('0xc'),_0x3fe9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0daf=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x16cade,_0x49787d){var _0x1f9a74=function(_0x557eb8){while(--_0x557eb8){_0x16cade['push'](_0x16cade['shift']());}};_0x1f9a74(++_0x49787d);}(_0x0daf,0x121));var _0xf0da=function(_0x28015a,_0x37d2d7){_0x28015a=_0x28015a-0x0;var _0x43bbd5=_0x0daf[_0x28015a];return _0x43bbd5;};'use strict';var _=require(_0xf0da('0x0'));var util=require(_0xf0da('0x1'));var logger=require(_0xf0da('0x2'))(_0xf0da('0x3'));var moment=require(_0xf0da('0x4'));var BPromise=require(_0xf0da('0x5'));var rp=require(_0xf0da('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0da('0x7'));var config=require('../../config/environment');var attributes=require(_0xf0da('0x8'));module[_0xf0da('0x9')]=function(_0x3ac9bc,_0x582c2e){return _0x3ac9bc[_0xf0da('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xf0da('0xb')],'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 7c7b6e2..67ce16c 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 _0xf3c9=['request\x20sent','SugarcrmField,\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','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x44d146,_0x5ab748){var _0xead22=function(_0x274ce3){while(--_0x274ce3){_0x44d146['push'](_0x44d146['shift']());}};_0xead22(++_0x5ab748);}(_0xf3c9,0x17e));var _0x9f3c=function(_0x39533c,_0x29ff60){_0x39533c=_0x39533c-0x0;var _0x4b984e=_0xf3c9[_0x39533c];return _0x4b984e;};'use strict';var _=require(_0x9f3c('0x0'));var util=require(_0x9f3c('0x1'));var moment=require(_0x9f3c('0x2'));var BPromise=require(_0x9f3c('0x3'));var rs=require(_0x9f3c('0x4'));var fs=require('fs');var Redis=require(_0x9f3c('0x5'));var db=require(_0x9f3c('0x6'))['db'];var utils=require(_0x9f3c('0x7'));var logger=require(_0x9f3c('0x8'))(_0x9f3c('0x9'));var config=require(_0x9f3c('0xa'));var jayson=require(_0x9f3c('0xb'));var client=jayson[_0x9f3c('0xc')][_0x9f3c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x594464,_0x1be5ee,_0x516b20){return new BPromise(function(_0x486321,_0x58f152){return client[_0x9f3c('0xe')](_0x594464,_0x516b20)[_0x9f3c('0xf')](function(_0x1148b4){logger[_0x9f3c('0x10')](_0x9f3c('0x11'),_0x1be5ee,_0x9f3c('0x12'));logger['debug'](_0x9f3c('0x13'),_0x1be5ee,_0x9f3c('0x12'),JSON[_0x9f3c('0x14')](_0x1148b4));if(_0x1148b4['error']){if(_0x1148b4[_0x9f3c('0x15')][_0x9f3c('0x16')]===0x1f4){logger[_0x9f3c('0x15')](_0x9f3c('0x11'),_0x1be5ee,_0x1148b4[_0x9f3c('0x15')]['message']);return _0x58f152(_0x1148b4[_0x9f3c('0x15')]['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x1be5ee,_0x1148b4[_0x9f3c('0x15')][_0x9f3c('0x17')]);return _0x486321(_0x1148b4[_0x9f3c('0x15')][_0x9f3c('0x17')]);}else{logger['info'](_0x9f3c('0x11'),_0x1be5ee,_0x9f3c('0x12'));_0x486321(_0x1148b4['result'][_0x9f3c('0x17')]);}})[_0x9f3c('0x18')](function(_0x5804ba){logger[_0x9f3c('0x15')](_0x9f3c('0x11'),_0x1be5ee,_0x5804ba);_0x58f152(_0x5804ba);});});} \ No newline at end of file +var _0x45cd=['info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x49bdb1,_0x320ca2){var _0x183039=function(_0x1d0713){while(--_0x1d0713){_0x49bdb1['push'](_0x49bdb1['shift']());}};_0x183039(++_0x320ca2);}(_0x45cd,0xda));var _0xd45c=function(_0x1f10d9,_0x1b29cd){_0x1f10d9=_0x1f10d9-0x0;var _0x34fbfd=_0x45cd[_0x1f10d9];return _0x34fbfd;};'use strict';var _=require('lodash');var util=require(_0xd45c('0x0'));var moment=require(_0xd45c('0x1'));var BPromise=require(_0xd45c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd45c('0x3'))['db'];var utils=require(_0xd45c('0x4'));var logger=require(_0xd45c('0x5'))(_0xd45c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd45c('0x7')][_0xd45c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aa5ac,_0x36bc7c,_0x346b38){return new BPromise(function(_0x5aa83a,_0x10217f){return client[_0xd45c('0x9')](_0x4aa5ac,_0x346b38)['then'](function(_0xdea105){logger[_0xd45c('0xa')](_0xd45c('0xb'),_0x36bc7c,'request\x20sent');logger[_0xd45c('0xc')](_0xd45c('0xd'),_0x36bc7c,'request\x20sent',JSON[_0xd45c('0xe')](_0xdea105));if(_0xdea105[_0xd45c('0xf')]){if(_0xdea105['error'][_0xd45c('0x10')]===0x1f4){logger['error'](_0xd45c('0xb'),_0x36bc7c,_0xdea105['error'][_0xd45c('0x11')]);return _0x10217f(_0xdea105[_0xd45c('0xf')]['message']);}logger['error'](_0xd45c('0xb'),_0x36bc7c,_0xdea105[_0xd45c('0xf')]['message']);return _0x5aa83a(_0xdea105[_0xd45c('0xf')][_0xd45c('0x11')]);}else{logger['info'](_0xd45c('0xb'),_0x36bc7c,'request\x20sent');_0x5aa83a(_0xdea105['result'][_0xd45c('0x11')]);}})[_0xd45c('0x12')](function(_0x252b86){logger[_0xd45c('0xf')](_0xd45c('0xb'),_0x36bc7c,_0x252b86);_0x10217f(_0x252b86);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b29c5e3..561fdc9 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 _0xaaea=['get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index'];(function(_0x27eec4,_0x2c12b5){var _0x5a6571=function(_0xbd193b){while(--_0xbd193b){_0x27eec4['push'](_0x27eec4['shift']());}};_0x5a6571(++_0x2c12b5);}(_0xaaea,0x183));var _0xaaae=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xaaea[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0xaaae('0x0'));var path=require('path');var timeout=require(_0xaaae('0x1'));var express=require(_0xaaae('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaaae('0x3'));var interaction=require(_0xaaae('0x4'));var config=require(_0xaaae('0x5'));var controller=require(_0xaaae('0x6'));router['get']('/',auth[_0xaaae('0x7')](),controller[_0xaaae('0x8')]);router[_0xaaae('0x9')](_0xaaae('0xa'),auth['isAuthenticated'](),controller[_0xaaae('0xb')]);router[_0xaaae('0x9')]('/:id/configurations',auth[_0xaaae('0x7')](),controller[_0xaaae('0xc')]);router['get'](_0xaaae('0xd'),auth[_0xaaae('0x7')](),controller[_0xaaae('0xe')]);router[_0xaaae('0xf')]('/',auth[_0xaaae('0x7')](),controller[_0xaaae('0x10')]);router[_0xaaae('0xf')](_0xaaae('0x11'),auth[_0xaaae('0x7')](),controller[_0xaaae('0x12')]);router['put'](_0xaaae('0xa'),auth['isAuthenticated'](),controller[_0xaaae('0x13')]);router[_0xaaae('0x14')](_0xaaae('0xa'),auth[_0xaaae('0x7')](),controller[_0xaaae('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc831=['getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations'];(function(_0x554e2c,_0x47a7e3){var _0x5e1b49=function(_0x1b5677){while(--_0x1b5677){_0x554e2c['push'](_0x554e2c['shift']());}};_0x5e1b49(++_0x47a7e3);}(_0xc831,0x103));var _0x1c83=function(_0x9fe27b,_0x298af3){_0x9fe27b=_0x9fe27b-0x0;var _0x188392=_0xc831[_0x9fe27b];return _0x188392;};'use strict';var multer=require('multer');var util=require(_0x1c83('0x0'));var path=require(_0x1c83('0x1'));var timeout=require(_0x1c83('0x2'));var express=require(_0x1c83('0x3'));var router=express[_0x1c83('0x4')]();var fs_extra=require(_0x1c83('0x5'));var auth=require(_0x1c83('0x6'));var interaction=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var controller=require(_0x1c83('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c83('0xa')]);router['get'](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller[_0x1c83('0xd')]);router[_0x1c83('0xe')](_0x1c83('0xf'),auth['isAuthenticated'](),controller[_0x1c83('0x10')]);router[_0x1c83('0xe')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1c83('0x11')]);router[_0x1c83('0x12')]('/',auth[_0x1c83('0xc')](),controller['create']);router[_0x1c83('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1c83('0x13')]);router[_0x1c83('0x14')](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller[_0x1c83('0x15')]);router[_0x1c83('0x16')](_0x1c83('0xb'),auth['isAuthenticated'](),controller[_0x1c83('0x17')]);module[_0x1c83('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 0f41693..b85a6ec 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 _0x0108=['STRING','HelpDesk','sequelize','exports'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x0108,0x142));var _0x8010=function(_0x148c1d,_0x537052){_0x148c1d=_0x148c1d-0x0;var _0xed1bda=_0x0108[_0x148c1d];return _0xed1bda;};'use strict';var Sequelize=require(_0x8010('0x0'));module[_0x8010('0x1')]={'name':{'type':Sequelize[_0x8010('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8010('0x2')]},'username':{'type':Sequelize[_0x8010('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8010('0x2')],'allowNull':![],'defaultValue':_0x8010('0x3')},'remoteUri':{'type':Sequelize[_0x8010('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8010('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8010('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcd1d=['HelpDesk','sequelize','exports','STRING'];(function(_0xd2df56,_0x5b74ff){var _0x28fc24=function(_0xdc9521){while(--_0xdc9521){_0xd2df56['push'](_0xd2df56['shift']());}};_0x28fc24(++_0x5b74ff);}(_0xcd1d,0x1a1));var _0xdcd1=function(_0x2b76de,_0x4665ed){_0x2b76de=_0x2b76de-0x0;var _0x43986a=_0xcd1d[_0x2b76de];return _0x43986a;};'use strict';var Sequelize=require(_0xdcd1('0x0'));module[_0xdcd1('0x1')]={'name':{'type':Sequelize[_0xdcd1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdcd1('0x2')]},'username':{'type':Sequelize[_0xdcd1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xdcd1('0x2')],'allowNull':![],'defaultValue':_0xdcd1('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xdcd1('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xdcd1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index a6d39a3..48173c4 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 _0x0458=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','success','POST','login','result','token','describe','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x299214,_0x2bab88){var _0x4d89c1=function(_0x34a13b){while(--_0x34a13b){_0x299214['push'](_0x299214['shift']());}};_0x4d89c1(++_0x2bab88);}(_0x0458,0x13a));var _0x8045=function(_0x5a0208,_0x3512f0){_0x5a0208=_0x5a0208-0x0;var _0x285a6e=_0x0458[_0x5a0208];return _0x285a6e;};'use strict';var emlformat=require(_0x8045('0x0'));var rimraf=require(_0x8045('0x1'));var zipdir=require(_0x8045('0x2'));var jsonpatch=require(_0x8045('0x3'));var rp=require(_0x8045('0x4'));var moment=require(_0x8045('0x5'));var BPromise=require(_0x8045('0x6'));var Mustache=require(_0x8045('0x7'));var util=require(_0x8045('0x8'));var path=require('path');var sox=require(_0x8045('0x9'));var csv=require(_0x8045('0xa'));var ejs=require(_0x8045('0xb'));var fs=require('fs');var fs_extra=require(_0x8045('0xc'));var _=require(_0x8045('0xd'));var squel=require('squel');var crypto=require(_0x8045('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8045('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8045('0x10'));var Papa=require(_0x8045('0x11'));var Redis=require(_0x8045('0x12'));var authService=require(_0x8045('0x13'));var qs=require(_0x8045('0x14'));var as=require(_0x8045('0x15'));var hardwareService=require(_0x8045('0x16'));var logger=require('../../config/logger')(_0x8045('0x17'));var utils=require(_0x8045('0x18'));var config=require(_0x8045('0x19'));var licenseUtil=require(_0x8045('0x1a'));var db=require(_0x8045('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa272f0,_0x33a96d){_0x33a96d=_0x33a96d||0xcc;return function(_0x34b7fc){if(_0x34b7fc){return _0xa272f0[_0x8045('0x1c')](_0x33a96d);}return _0xa272f0[_0x8045('0x1d')](_0x33a96d)[_0x8045('0x1e')]();};}function respondWithResult(_0x294fdf,_0x599281){_0x599281=_0x599281||0xc8;return function(_0x1aac0d){if(_0x1aac0d){return _0x294fdf['status'](_0x599281)[_0x8045('0x1f')](_0x1aac0d);}};}function respondWithFilteredResult(_0x7e9409,_0x1a7e4e){return function(_0x2e8f5e){if(_0x2e8f5e){var _0x560f2a=typeof _0x1a7e4e[_0x8045('0x20')]===_0x8045('0x21')&&typeof _0x1a7e4e[_0x8045('0x22')]==='undefined';var _0x2d45f8=_0x2e8f5e[_0x8045('0x23')];var _0x352dcd=_0x560f2a?0x0:_0x1a7e4e[_0x8045('0x20')];var _0xcb0b51=_0x560f2a?_0x2e8f5e[_0x8045('0x23')]:_0x1a7e4e['offset']+_0x1a7e4e['limit'];var _0x359f74;if(_0xcb0b51>=_0x2d45f8){_0xcb0b51=_0x2d45f8;_0x359f74=0xc8;}else{_0x359f74=0xce;}_0x7e9409[_0x8045('0x1d')](_0x359f74);return _0x7e9409['set']('Content-Range',_0x352dcd+'-'+_0xcb0b51+'/'+_0x2d45f8)[_0x8045('0x1f')](_0x2e8f5e);}return null;};}function patchUpdates(_0x1af3d1){return function(_0x3e5e8f){try{jsonpatch[_0x8045('0x24')](_0x3e5e8f,_0x1af3d1,!![]);}catch(_0x22a422){return BPromise[_0x8045('0x25')](_0x22a422);}return _0x3e5e8f['save']();};}function saveUpdates(_0x3d56c1,_0x3cc38c){return function(_0x2d4e01){if(_0x2d4e01){return _0x2d4e01[_0x8045('0x26')](_0x3d56c1)['then'](function(_0x2f95a6){return _0x2f95a6;});}return null;};}function removeEntity(_0x46922f,_0x6af527){return function(_0x43f0d2){if(_0x43f0d2){return _0x43f0d2[_0x8045('0x27')]()[_0x8045('0x28')](function(){_0x46922f[_0x8045('0x1d')](0xcc)[_0x8045('0x1e')]();});}};}function handleEntityNotFound(_0x1e63d2,_0x3fede9){return function(_0x1bb983){if(!_0x1bb983){_0x1e63d2[_0x8045('0x1c')](0x194);}return _0x1bb983;};}function handleError(_0x4eccbb,_0x26b13a){_0x26b13a=_0x26b13a||0x1f4;return function(_0x3b7c04){logger[_0x8045('0x29')](_0x3b7c04[_0x8045('0x2a')]);if(_0x3b7c04[_0x8045('0x2b')]){delete _0x3b7c04[_0x8045('0x2b')];}_0x4eccbb['status'](_0x26b13a)[_0x8045('0x2c')](_0x3b7c04);};}exports[_0x8045('0x2d')]=function(_0x1071a8,_0x4316f0){var _0x3cbe74={},_0x4c953f={},_0x348c47={'count':0x0,'rows':[]};var _0x5d7368=_[_0x8045('0x2e')](db[_0x8045('0x2f')][_0x8045('0x30')],function(_0x178db0){return{'name':_0x178db0[_0x8045('0x31')],'type':_0x178db0[_0x8045('0x32')]['key']};});_0x4c953f[_0x8045('0x33')]=_[_0x8045('0x2e')](_0x5d7368,'name');_0x4c953f[_0x8045('0x34')]=_[_0x8045('0x35')](_0x1071a8[_0x8045('0x34')]);_0x4c953f[_0x8045('0x36')]=_[_0x8045('0x37')](_0x4c953f['model'],_0x4c953f[_0x8045('0x34')]);_0x3cbe74['attributes']=_[_0x8045('0x37')](_0x4c953f[_0x8045('0x33')],qs[_0x8045('0x38')](_0x1071a8[_0x8045('0x34')][_0x8045('0x38')]));_0x3cbe74['attributes']=_0x3cbe74[_0x8045('0x39')][_0x8045('0x3a')]?_0x3cbe74[_0x8045('0x39')]:_0x4c953f[_0x8045('0x33')];if(!_0x1071a8[_0x8045('0x34')]['hasOwnProperty'](_0x8045('0x3b'))){_0x3cbe74[_0x8045('0x22')]=qs[_0x8045('0x22')](_0x1071a8[_0x8045('0x34')][_0x8045('0x22')]);_0x3cbe74[_0x8045('0x20')]=qs[_0x8045('0x20')](_0x1071a8['query']['offset']);}_0x3cbe74[_0x8045('0x3c')]=qs[_0x8045('0x3d')](_0x1071a8[_0x8045('0x34')]['sort']);_0x3cbe74[_0x8045('0x3e')]=qs[_0x8045('0x36')](_[_0x8045('0x3f')](_0x1071a8['query'],_0x4c953f['filters']),_0x5d7368);if(_0x1071a8['query'][_0x8045('0x40')]){_0x3cbe74[_0x8045('0x3e')]=_[_0x8045('0x41')](_0x3cbe74['where'],{'$or':_['map'](_0x5d7368,function(_0x53a813){if(_0x53a813[_0x8045('0x32')]!==_0x8045('0x42')){var _0x3fc4a6={};_0x3fc4a6[_0x53a813[_0x8045('0x2b')]]={'$like':'%'+_0x1071a8[_0x8045('0x34')][_0x8045('0x40')]+'%'};return _0x3fc4a6;}})});}_0x3cbe74=_['merge']({},_0x3cbe74,_0x1071a8[_0x8045('0x43')]);var _0x433b86={'where':_0x3cbe74[_0x8045('0x3e')]};return db['VtigerAccount'][_0x8045('0x23')](_0x433b86)[_0x8045('0x28')](function(_0x3f30d2){_0x348c47[_0x8045('0x23')]=_0x3f30d2;if(_0x1071a8[_0x8045('0x34')]['includeAll']){_0x3cbe74['include']=[{'all':!![]}];}return db[_0x8045('0x2f')][_0x8045('0x44')](_0x3cbe74);})[_0x8045('0x28')](function(_0x4e30e8){_0x348c47[_0x8045('0x45')]=_0x4e30e8;return _0x348c47;})[_0x8045('0x28')](respondWithFilteredResult(_0x4316f0,_0x3cbe74))[_0x8045('0x46')](handleError(_0x4316f0,null));};exports[_0x8045('0x47')]=function(_0xe3ffc7,_0x53d8b0){var _0x19bf84={'raw':![],'where':{'id':_0xe3ffc7[_0x8045('0x48')]['id']}},_0x778aa3={};_0x778aa3[_0x8045('0x33')]=_[_0x8045('0x35')](db[_0x8045('0x2f')][_0x8045('0x30')]);_0x778aa3['query']=_['keys'](_0xe3ffc7[_0x8045('0x34')]);_0x778aa3['filters']=_[_0x8045('0x37')](_0x778aa3['model'],_0x778aa3[_0x8045('0x34')]);_0x19bf84['attributes']=_[_0x8045('0x37')](_0x778aa3[_0x8045('0x33')],qs['fields'](_0xe3ffc7[_0x8045('0x34')]['fields']));_0x19bf84[_0x8045('0x39')]=_0x19bf84['attributes'][_0x8045('0x3a')]?_0x19bf84[_0x8045('0x39')]:_0x778aa3[_0x8045('0x33')];if(_0xe3ffc7['query'][_0x8045('0x49')]){_0x19bf84['include']=[{'all':!![]}];}_0x19bf84=_[_0x8045('0x41')]({},_0x19bf84,_0xe3ffc7['options']);return db[_0x8045('0x2f')][_0x8045('0x4a')](_0x19bf84)[_0x8045('0x28')](handleEntityNotFound(_0x53d8b0,null))[_0x8045('0x28')](respondWithResult(_0x53d8b0,null))[_0x8045('0x46')](handleError(_0x53d8b0,null));};exports[_0x8045('0x4b')]=function(_0x13a8cd,_0x196f1d){return db['VtigerAccount']['create'](_0x13a8cd[_0x8045('0x4c')],{})[_0x8045('0x28')](respondWithResult(_0x196f1d,0xc9))[_0x8045('0x46')](handleError(_0x196f1d,null));};exports[_0x8045('0x26')]=function(_0x58bdbb,_0x362e5b){if(_0x58bdbb[_0x8045('0x4c')]['id']){delete _0x58bdbb[_0x8045('0x4c')]['id'];}return db[_0x8045('0x2f')][_0x8045('0x4a')]({'where':{'id':_0x58bdbb[_0x8045('0x48')]['id']}})[_0x8045('0x28')](handleEntityNotFound(_0x362e5b,null))[_0x8045('0x28')](saveUpdates(_0x58bdbb['body'],null))[_0x8045('0x28')](respondWithResult(_0x362e5b,null))[_0x8045('0x46')](handleError(_0x362e5b,null));};exports[_0x8045('0x27')]=function(_0x3dcf5c,_0x289579){return db[_0x8045('0x2f')]['find']({'where':{'id':_0x3dcf5c[_0x8045('0x48')]['id']}})[_0x8045('0x28')](handleEntityNotFound(_0x289579,null))[_0x8045('0x28')](removeEntity(_0x289579,null))[_0x8045('0x46')](handleError(_0x289579,null));};exports[_0x8045('0x4d')]=function(_0x165dc9,_0x364c63,_0x5a2b84){var _0x4ed06d={};var _0x2c7827={};var _0x14c4a5;var _0xd25ae9;return db['VtigerAccount']['findOne']({'where':{'id':_0x165dc9[_0x8045('0x48')]['id']}})[_0x8045('0x28')](handleEntityNotFound(_0x364c63,null))['then'](function(_0x298838){if(_0x298838){_0x14c4a5=_0x298838;_0x2c7827[_0x8045('0x33')]=_[_0x8045('0x35')](db[_0x8045('0x4e')][_0x8045('0x30')]);_0x2c7827[_0x8045('0x34')]=_[_0x8045('0x35')](_0x165dc9[_0x8045('0x34')]);_0x2c7827['filters']=_[_0x8045('0x37')](_0x2c7827[_0x8045('0x33')],_0x2c7827[_0x8045('0x34')]);_0x4ed06d[_0x8045('0x39')]=_[_0x8045('0x37')](_0x2c7827['model'],qs[_0x8045('0x38')](_0x165dc9[_0x8045('0x34')][_0x8045('0x38')]));_0x4ed06d[_0x8045('0x39')]=_0x4ed06d[_0x8045('0x39')][_0x8045('0x3a')]?_0x4ed06d['attributes']:_0x2c7827[_0x8045('0x33')];_0x4ed06d[_0x8045('0x3c')]=qs[_0x8045('0x3d')](_0x165dc9[_0x8045('0x34')][_0x8045('0x3d')]);_0x4ed06d[_0x8045('0x3e')]=qs[_0x8045('0x36')](_[_0x8045('0x3f')](_0x165dc9[_0x8045('0x34')],_0x2c7827[_0x8045('0x36')]));if(_0x165dc9[_0x8045('0x34')][_0x8045('0x40')]){_0x4ed06d[_0x8045('0x3e')]=_[_0x8045('0x41')](_0x4ed06d[_0x8045('0x3e')],{'$or':_[_0x8045('0x2e')](_0x4ed06d[_0x8045('0x39')],function(_0x25a576){var _0x192f1d={};_0x192f1d[_0x25a576]={'$like':'%'+_0x165dc9[_0x8045('0x34')][_0x8045('0x40')]+'%'};return _0x192f1d;})});}_0x4ed06d=_[_0x8045('0x41')]({},_0x4ed06d,_0x165dc9[_0x8045('0x43')]);return _0x14c4a5[_0x8045('0x4d')](_0x4ed06d);}})['then'](function(_0x3a4c36){if(_0x3a4c36){_0xd25ae9=_0x3a4c36[_0x8045('0x3a')];if(!_0x165dc9['query'][_0x8045('0x4f')](_0x8045('0x3b'))){_0x4ed06d['limit']=qs[_0x8045('0x22')](_0x165dc9[_0x8045('0x34')][_0x8045('0x22')]);_0x4ed06d[_0x8045('0x20')]=qs[_0x8045('0x20')](_0x165dc9[_0x8045('0x34')][_0x8045('0x20')]);}return _0x14c4a5[_0x8045('0x4d')](_0x4ed06d);}})['then'](function(_0x232fc1){if(_0x232fc1){return _0x232fc1?{'count':_0xd25ae9,'rows':_0x232fc1}:null;}})['then'](respondWithResult(_0x364c63,null))[_0x8045('0x46')](handleError(_0x364c63,null));};exports[_0x8045('0x50')]=function(_0x4ae67c,_0xa14a37,_0x44227b){if(_0x4ae67c[_0x8045('0x4c')]['id']){delete _0x4ae67c[_0x8045('0x4c')]['id'];}return db['VtigerAccount'][_0x8045('0x51')]({'where':{'id':_0x4ae67c['params']['id']}})[_0x8045('0x28')](handleEntityNotFound(_0xa14a37,null))[_0x8045('0x28')](function(_0x4d2f6e){if(_0x4d2f6e){_0x4ae67c['body'][_0x8045('0x52')]=_0x4d2f6e['id'];_0x4ae67c['body'][_0x8045('0x53')]=integrations['getSubjects'](_0x4ae67c[_0x8045('0x4c')][_0x8045('0x54')],_0x4ae67c[_0x8045('0x4c')][_0x8045('0x32')]);_0x4ae67c[_0x8045('0x4c')][_0x8045('0x55')]=integrations[_0x8045('0x56')](_0x4ae67c[_0x8045('0x4c')][_0x8045('0x54')],_0x4ae67c[_0x8045('0x4c')][_0x8045('0x32')]);return db[_0x8045('0x4e')][_0x8045('0x4b')](_0x4ae67c[_0x8045('0x4c')],{'include':[{'model':db[_0x8045('0x57')],'as':'Subjects'},{'model':db[_0x8045('0x57')],'as':_0x8045('0x55')}]});}return null;})[_0x8045('0x28')](respondWithResult(_0xa14a37,null))[_0x8045('0x46')](handleError(_0xa14a37,null));};var md5=require(_0x8045('0x58'));exports[_0x8045('0x59')]=function(_0x2baf69,_0x2cacba,_0x4dd485){var _0xdb810b=null;var _0x2d07b1=null;var _0x441b4f=null;var _0x5412c3=null;var _0x85567f='';return db[_0x8045('0x2f')][_0x8045('0x51')]({'where':{'id':_0x2baf69[_0x8045('0x48')]['id']},'attributes':['id',_0x8045('0x2b'),_0x8045('0x5a'),_0x8045('0x5b'),_0x8045('0x5c'),_0x8045('0x5d'),'serverUrl',_0x8045('0x5e')]})[_0x8045('0x28')](handleEntityNotFound(_0x2cacba,null))[_0x8045('0x28')](function(_0x509ca0){if(_0x509ca0){_0xdb810b=_0x509ca0[_0x8045('0x5a')];_0x2d07b1=_0x509ca0['accessKey'];_0x441b4f=_0x509ca0['moduleName'];_0x85567f=_0x509ca0[_0x8045('0x5d')];var _0x318f99=_0x85567f[_0x8045('0x5f')](-0x1);if(_0x318f99==='/'){_0x85567f=_0x85567f[_0x8045('0x60')](0x0,_0x85567f[_0x8045('0x61')](_0x318f99));}_0x5412c3=util[_0x8045('0x62')]('%s/webservice.php',_0x85567f);var _0x377ad3={'method':'GET','uri':_0x5412c3,'qs':{'operation':'getchallenge','username':_0x509ca0[_0x8045('0x5a')]},'json':!![]};return rp(_0x377ad3);}})[_0x8045('0x28')](function(_0x7a591d){if(_0x7a591d[_0x8045('0x63')]){var _0xbdd1f7={'method':_0x8045('0x64'),'uri':_0x5412c3,'form':{'operation':_0x8045('0x65'),'username':_0xdb810b,'accessKey':md5(_0x7a591d[_0x8045('0x66')][_0x8045('0x67')]+_0x2d07b1)},'json':!![]};return rp(_0xbdd1f7);}})[_0x8045('0x28')](function(_0xd3b144){if(_0xd3b144['success']){var _0x2e1846={'method':'GET','uri':_0x5412c3,'qs':{'operation':_0x8045('0x68'),'username':_0xdb810b,'sessionName':_0xd3b144[_0x8045('0x66')][_0x8045('0x69')],'elementType':_0x441b4f},'json':!![]};return rp(_0x2e1846);}})[_0x8045('0x28')](function(_0x498395){if(_0x498395[_0x8045('0x63')]){var _0x279f0a=['autogenerated',_0x8045('0x6a'),_0x8045('0x6b')];_[_0x8045('0x6c')](_0x498395[_0x8045('0x66')][_0x8045('0x38')],function(_0x2e0294){return _0x279f0a[_0x8045('0x6d')](_0x2e0294['type']['name']);});_[_0x8045('0x6c')](_0x498395[_0x8045('0x66')][_0x8045('0x38')],function(_0xd6056a){return _0xd6056a[_0x8045('0x6e')]===_0x8045('0x6f');});return{'count':_0x498395[_0x8045('0x66')]['fields'][_0x8045('0x3a')],'rows':_['map'](_0x498395[_0x8045('0x66')][_0x8045('0x38')],function(_0x1c1f01){return{'id':_0x1c1f01[_0x8045('0x2b')],'name':_0x1c1f01[_0x8045('0x70')],'custom':_[_0x8045('0x71')](_0x1c1f01['name'],_0x8045('0x72'))?!![]:![],'options':_0x1c1f01[_0x8045('0x32')][_0x8045('0x2b')]===_0x8045('0x73')&&_0x1c1f01[_0x8045('0x32')][_0x8045('0x74')][_0x8045('0x3a')]>0x0?_[_0x8045('0x2e')](_0x1c1f01[_0x8045('0x32')]['picklistValues'],function(_0x1eef1e){return{'name':_0x1eef1e[_0x8045('0x70')],'value':_0x1eef1e[_0x8045('0x75')]};}):[]};})};}})[_0x8045('0x28')](respondWithResult(_0x2cacba,null))[_0x8045('0x46')](function(_0x4088ef){console[_0x8045('0x76')](_0x8045('0x77')+_0x4088ef);var _0xb8adf2=_0x2baf69[_0x8045('0x34')]['test']?0x1f4:_0x4088ef['statusCode']||0x1f4;logger['error'](_0x8045('0x78'),'getFields',_0xb8adf2,JSON[_0x8045('0x79')](_0x4088ef));delete _0x4088ef[_0x8045('0x2b')];if(_0xb8adf2===0x191){_0xb8adf2=0x190;}_0x2cacba[_0x8045('0x1d')](_0xb8adf2)[_0x8045('0x2c')](_0x2baf69['query'][_0x8045('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x4088ef[_0x8045('0x7b')]}:_0x4088ef);});}; \ No newline at end of file +var _0x1085=['../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','send','map','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','options','VtigerAccount','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','accessKey','lastIndexOf','format','%s/webservice.php','success','login','token','describe','result','sessionName','autogenerated','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x568319,_0x4bd4bc){var _0x23435d=function(_0x278728){while(--_0x278728){_0x568319['push'](_0x568319['shift']());}};_0x23435d(++_0x4bd4bc);}(_0x1085,0xd7));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5108('0x0'));var jsonpatch=require(_0x5108('0x1'));var rp=require(_0x5108('0x2'));var moment=require(_0x5108('0x3'));var BPromise=require(_0x5108('0x4'));var Mustache=require('mustache');var util=require(_0x5108('0x5'));var path=require(_0x5108('0x6'));var sox=require(_0x5108('0x7'));var csv=require('to-csv');var ejs=require(_0x5108('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5108('0x9'));var squel=require(_0x5108('0xa'));var crypto=require(_0x5108('0xb'));var jsforce=require(_0x5108('0xc'));var deskjs=require(_0x5108('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5108('0xe'));var Papa=require(_0x5108('0xf'));var Redis=require(_0x5108('0x10'));var authService=require(_0x5108('0x11'));var qs=require(_0x5108('0x12'));var as=require(_0x5108('0x13'));var hardwareService=require(_0x5108('0x14'));var logger=require(_0x5108('0x15'))('api');var utils=require(_0x5108('0x16'));var config=require(_0x5108('0x17'));var licenseUtil=require(_0x5108('0x18'));var db=require(_0x5108('0x19'))['db'];var integrations=require(_0x5108('0x1a'));function respondWithStatusCode(_0x3e8d72,_0x406e51){_0x406e51=_0x406e51||0xcc;return function(_0x44b0fc){if(_0x44b0fc){return _0x3e8d72['sendStatus'](_0x406e51);}return _0x3e8d72[_0x5108('0x1b')](_0x406e51)['end']();};}function respondWithResult(_0x3846ed,_0x44f066){_0x44f066=_0x44f066||0xc8;return function(_0xdd50f5){if(_0xdd50f5){return _0x3846ed[_0x5108('0x1b')](_0x44f066)[_0x5108('0x1c')](_0xdd50f5);}};}function respondWithFilteredResult(_0x4e2e47,_0xaee9ab){return function(_0x3478d5){if(_0x3478d5){var _0x1aa959=typeof _0xaee9ab[_0x5108('0x1d')]===_0x5108('0x1e')&&typeof _0xaee9ab[_0x5108('0x1f')]===_0x5108('0x1e');var _0x23f3c3=_0x3478d5[_0x5108('0x20')];var _0x69fa3e=_0x1aa959?0x0:_0xaee9ab[_0x5108('0x1d')];var _0x525e1a=_0x1aa959?_0x3478d5['count']:_0xaee9ab[_0x5108('0x1d')]+_0xaee9ab['limit'];var _0x40f85a;if(_0x525e1a>=_0x23f3c3){_0x525e1a=_0x23f3c3;_0x40f85a=0xc8;}else{_0x40f85a=0xce;}_0x4e2e47[_0x5108('0x1b')](_0x40f85a);return _0x4e2e47[_0x5108('0x21')](_0x5108('0x22'),_0x69fa3e+'-'+_0x525e1a+'/'+_0x23f3c3)[_0x5108('0x1c')](_0x3478d5);}return null;};}function patchUpdates(_0x5f4913){return function(_0x2b885e){try{jsonpatch[_0x5108('0x23')](_0x2b885e,_0x5f4913,!![]);}catch(_0x4f77f8){return BPromise[_0x5108('0x24')](_0x4f77f8);}return _0x2b885e[_0x5108('0x25')]();};}function saveUpdates(_0xd2a613,_0x389576){return function(_0x2e4772){if(_0x2e4772){return _0x2e4772[_0x5108('0x26')](_0xd2a613)[_0x5108('0x27')](function(_0x11101e){return _0x11101e;});}return null;};}function removeEntity(_0xb9cb7e,_0x36c049){return function(_0x5c6e9c){if(_0x5c6e9c){return _0x5c6e9c[_0x5108('0x28')]()[_0x5108('0x27')](function(){_0xb9cb7e[_0x5108('0x1b')](0xcc)[_0x5108('0x29')]();});}};}function handleEntityNotFound(_0x3b8b17,_0x59623b){return function(_0x25830f){if(!_0x25830f){_0x3b8b17[_0x5108('0x2a')](0x194);}return _0x25830f;};}function handleError(_0x267571,_0x1376f3){_0x1376f3=_0x1376f3||0x1f4;return function(_0x4e09d8){logger[_0x5108('0x2b')](_0x4e09d8['stack']);if(_0x4e09d8['name']){delete _0x4e09d8['name'];}_0x267571[_0x5108('0x1b')](_0x1376f3)[_0x5108('0x2c')](_0x4e09d8);};}exports['index']=function(_0x62096,_0x3c93a7){var _0x2fe8f5={},_0x29e10c={},_0x17f7fd={'count':0x0,'rows':[]};var _0x26766a=_[_0x5108('0x2d')](db['VtigerAccount'][_0x5108('0x2e')],function(_0x311de5){return{'name':_0x311de5[_0x5108('0x2f')],'type':_0x311de5[_0x5108('0x30')]['key']};});_0x29e10c['model']=_[_0x5108('0x2d')](_0x26766a,_0x5108('0x31'));_0x29e10c[_0x5108('0x32')]=_[_0x5108('0x33')](_0x62096[_0x5108('0x32')]);_0x29e10c[_0x5108('0x34')]=_['intersection'](_0x29e10c['model'],_0x29e10c[_0x5108('0x32')]);_0x2fe8f5['attributes']=_[_0x5108('0x35')](_0x29e10c[_0x5108('0x36')],qs[_0x5108('0x37')](_0x62096[_0x5108('0x32')][_0x5108('0x37')]));_0x2fe8f5[_0x5108('0x38')]=_0x2fe8f5[_0x5108('0x38')][_0x5108('0x39')]?_0x2fe8f5[_0x5108('0x38')]:_0x29e10c[_0x5108('0x36')];if(!_0x62096['query'][_0x5108('0x3a')](_0x5108('0x3b'))){_0x2fe8f5[_0x5108('0x1f')]=qs[_0x5108('0x1f')](_0x62096['query']['limit']);_0x2fe8f5['offset']=qs[_0x5108('0x1d')](_0x62096['query'][_0x5108('0x1d')]);}_0x2fe8f5['order']=qs['sort'](_0x62096[_0x5108('0x32')]['sort']);_0x2fe8f5['where']=qs[_0x5108('0x34')](_['pick'](_0x62096[_0x5108('0x32')],_0x29e10c[_0x5108('0x34')]),_0x26766a);if(_0x62096[_0x5108('0x32')][_0x5108('0x3c')]){_0x2fe8f5[_0x5108('0x3d')]=_[_0x5108('0x3e')](_0x2fe8f5['where'],{'$or':_[_0x5108('0x2d')](_0x26766a,function(_0x2b16dc){if(_0x2b16dc[_0x5108('0x30')]!==_0x5108('0x3f')){var _0x265176={};_0x265176[_0x2b16dc[_0x5108('0x31')]]={'$like':'%'+_0x62096[_0x5108('0x32')]['filter']+'%'};return _0x265176;}})});}_0x2fe8f5=_[_0x5108('0x3e')]({},_0x2fe8f5,_0x62096[_0x5108('0x40')]);var _0x3a9832={'where':_0x2fe8f5[_0x5108('0x3d')]};return db[_0x5108('0x41')][_0x5108('0x20')](_0x3a9832)[_0x5108('0x27')](function(_0x68b26f){_0x17f7fd[_0x5108('0x20')]=_0x68b26f;if(_0x62096[_0x5108('0x32')][_0x5108('0x42')]){_0x2fe8f5[_0x5108('0x43')]=[{'all':!![]}];}return db['VtigerAccount'][_0x5108('0x44')](_0x2fe8f5);})[_0x5108('0x27')](function(_0x3df1f8){_0x17f7fd[_0x5108('0x45')]=_0x3df1f8;return _0x17f7fd;})[_0x5108('0x27')](respondWithFilteredResult(_0x3c93a7,_0x2fe8f5))[_0x5108('0x46')](handleError(_0x3c93a7,null));};exports['show']=function(_0x1c9b6b,_0x946ec8){var _0x5aabc7={'raw':![],'where':{'id':_0x1c9b6b[_0x5108('0x47')]['id']}},_0x158e52={};_0x158e52[_0x5108('0x36')]=_['keys'](db[_0x5108('0x41')][_0x5108('0x2e')]);_0x158e52[_0x5108('0x32')]=_['keys'](_0x1c9b6b['query']);_0x158e52[_0x5108('0x34')]=_[_0x5108('0x35')](_0x158e52[_0x5108('0x36')],_0x158e52[_0x5108('0x32')]);_0x5aabc7['attributes']=_[_0x5108('0x35')](_0x158e52[_0x5108('0x36')],qs['fields'](_0x1c9b6b[_0x5108('0x32')][_0x5108('0x37')]));_0x5aabc7[_0x5108('0x38')]=_0x5aabc7[_0x5108('0x38')][_0x5108('0x39')]?_0x5aabc7[_0x5108('0x38')]:_0x158e52[_0x5108('0x36')];if(_0x1c9b6b[_0x5108('0x32')]['includeAll']){_0x5aabc7['include']=[{'all':!![]}];}_0x5aabc7=_[_0x5108('0x3e')]({},_0x5aabc7,_0x1c9b6b[_0x5108('0x40')]);return db[_0x5108('0x41')][_0x5108('0x48')](_0x5aabc7)[_0x5108('0x27')](handleEntityNotFound(_0x946ec8,null))['then'](respondWithResult(_0x946ec8,null))[_0x5108('0x46')](handleError(_0x946ec8,null));};exports[_0x5108('0x49')]=function(_0x5bbe5f,_0x19c48a){return db['VtigerAccount'][_0x5108('0x49')](_0x5bbe5f[_0x5108('0x4a')],{})[_0x5108('0x27')](respondWithResult(_0x19c48a,0xc9))[_0x5108('0x46')](handleError(_0x19c48a,null));};exports[_0x5108('0x26')]=function(_0x2d1776,_0x5e4653){if(_0x2d1776[_0x5108('0x4a')]['id']){delete _0x2d1776['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x2d1776[_0x5108('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e4653,null))[_0x5108('0x27')](saveUpdates(_0x2d1776['body'],null))['then'](respondWithResult(_0x5e4653,null))['catch'](handleError(_0x5e4653,null));};exports['destroy']=function(_0xeb5cc4,_0x2c98ce){return db['VtigerAccount'][_0x5108('0x48')]({'where':{'id':_0xeb5cc4[_0x5108('0x47')]['id']}})[_0x5108('0x27')](handleEntityNotFound(_0x2c98ce,null))[_0x5108('0x27')](removeEntity(_0x2c98ce,null))[_0x5108('0x46')](handleError(_0x2c98ce,null));};exports[_0x5108('0x4b')]=function(_0x3eef85,_0x5a245d,_0x228388){var _0xdbb16e={};var _0x46da4b={};var _0x4fd7d7;var _0x4d9314;return db[_0x5108('0x41')][_0x5108('0x4c')]({'where':{'id':_0x3eef85[_0x5108('0x47')]['id']}})[_0x5108('0x27')](handleEntityNotFound(_0x5a245d,null))[_0x5108('0x27')](function(_0x237f7a){if(_0x237f7a){_0x4fd7d7=_0x237f7a;_0x46da4b[_0x5108('0x36')]=_[_0x5108('0x33')](db[_0x5108('0x4d')][_0x5108('0x2e')]);_0x46da4b[_0x5108('0x32')]=_['keys'](_0x3eef85['query']);_0x46da4b[_0x5108('0x34')]=_[_0x5108('0x35')](_0x46da4b[_0x5108('0x36')],_0x46da4b[_0x5108('0x32')]);_0xdbb16e[_0x5108('0x38')]=_[_0x5108('0x35')](_0x46da4b[_0x5108('0x36')],qs[_0x5108('0x37')](_0x3eef85['query'][_0x5108('0x37')]));_0xdbb16e[_0x5108('0x38')]=_0xdbb16e[_0x5108('0x38')]['length']?_0xdbb16e['attributes']:_0x46da4b[_0x5108('0x36')];_0xdbb16e['order']=qs['sort'](_0x3eef85[_0x5108('0x32')]['sort']);_0xdbb16e['where']=qs[_0x5108('0x34')](_[_0x5108('0x4e')](_0x3eef85[_0x5108('0x32')],_0x46da4b['filters']));if(_0x3eef85['query'][_0x5108('0x3c')]){_0xdbb16e[_0x5108('0x3d')]=_[_0x5108('0x3e')](_0xdbb16e[_0x5108('0x3d')],{'$or':_[_0x5108('0x2d')](_0xdbb16e[_0x5108('0x38')],function(_0x93cc0c){var _0x39197c={};_0x39197c[_0x93cc0c]={'$like':'%'+_0x3eef85[_0x5108('0x32')][_0x5108('0x3c')]+'%'};return _0x39197c;})});}_0xdbb16e=_['merge']({},_0xdbb16e,_0x3eef85[_0x5108('0x40')]);return _0x4fd7d7[_0x5108('0x4b')](_0xdbb16e);}})[_0x5108('0x27')](function(_0x442e75){if(_0x442e75){_0x4d9314=_0x442e75[_0x5108('0x39')];if(!_0x3eef85[_0x5108('0x32')][_0x5108('0x3a')](_0x5108('0x3b'))){_0xdbb16e['limit']=qs[_0x5108('0x1f')](_0x3eef85[_0x5108('0x32')][_0x5108('0x1f')]);_0xdbb16e[_0x5108('0x1d')]=qs[_0x5108('0x1d')](_0x3eef85['query'][_0x5108('0x1d')]);}return _0x4fd7d7[_0x5108('0x4b')](_0xdbb16e);}})['then'](function(_0x28cf6a){if(_0x28cf6a){return _0x28cf6a?{'count':_0x4d9314,'rows':_0x28cf6a}:null;}})[_0x5108('0x27')](respondWithResult(_0x5a245d,null))[_0x5108('0x46')](handleError(_0x5a245d,null));};exports[_0x5108('0x4f')]=function(_0xd1299c,_0x4cef0c,_0x2c5aed){if(_0xd1299c[_0x5108('0x4a')]['id']){delete _0xd1299c[_0x5108('0x4a')]['id'];}return db['VtigerAccount'][_0x5108('0x4c')]({'where':{'id':_0xd1299c[_0x5108('0x47')]['id']}})[_0x5108('0x27')](handleEntityNotFound(_0x4cef0c,null))[_0x5108('0x27')](function(_0x497275){if(_0x497275){_0xd1299c[_0x5108('0x4a')][_0x5108('0x50')]=_0x497275['id'];_0xd1299c['body'][_0x5108('0x51')]=integrations[_0x5108('0x52')](_0xd1299c[_0x5108('0x4a')][_0x5108('0x53')],_0xd1299c[_0x5108('0x4a')][_0x5108('0x30')]);_0xd1299c[_0x5108('0x4a')]['Descriptions']=integrations[_0x5108('0x54')](_0xd1299c[_0x5108('0x4a')]['channel'],_0xd1299c['body'][_0x5108('0x30')]);return db[_0x5108('0x4d')][_0x5108('0x49')](_0xd1299c[_0x5108('0x4a')],{'include':[{'model':db['VtigerField'],'as':_0x5108('0x51')},{'model':db[_0x5108('0x55')],'as':_0x5108('0x56')}]});}return null;})[_0x5108('0x27')](respondWithResult(_0x4cef0c,null))[_0x5108('0x46')](handleError(_0x4cef0c,null));};var md5=require(_0x5108('0x57'));exports[_0x5108('0x58')]=function(_0x4e76ce,_0x5bce92,_0x363e07){var _0x4996fd=null;var _0x2d8462=null;var _0x4ee8aa=null;var _0x4e0abe=null;var _0xc993af='';return db[_0x5108('0x41')][_0x5108('0x4c')]({'where':{'id':_0x4e76ce[_0x5108('0x47')]['id']},'attributes':['id',_0x5108('0x31'),_0x5108('0x59'),_0x5108('0x5a'),_0x5108('0x5b'),_0x5108('0x5c'),'serverUrl',_0x5108('0x5d')]})[_0x5108('0x27')](handleEntityNotFound(_0x5bce92,null))[_0x5108('0x27')](function(_0x4098ae){if(_0x4098ae){_0x4996fd=_0x4098ae['username'];_0x2d8462=_0x4098ae[_0x5108('0x5d')];_0x4ee8aa=_0x4098ae[_0x5108('0x5b')];_0xc993af=_0x4098ae[_0x5108('0x5c')];var _0x1bddc1=_0xc993af['slice'](-0x1);if(_0x1bddc1==='/'){_0xc993af=_0xc993af['substring'](0x0,_0xc993af[_0x5108('0x5e')](_0x1bddc1));}_0x4e0abe=util[_0x5108('0x5f')](_0x5108('0x60'),_0xc993af);var _0x32fc0f={'method':'GET','uri':_0x4e0abe,'qs':{'operation':'getchallenge','username':_0x4098ae['username']},'json':!![]};return rp(_0x32fc0f);}})[_0x5108('0x27')](function(_0x1e8f14){if(_0x1e8f14[_0x5108('0x61')]){var _0x1ff317={'method':'POST','uri':_0x4e0abe,'form':{'operation':_0x5108('0x62'),'username':_0x4996fd,'accessKey':md5(_0x1e8f14['result'][_0x5108('0x63')]+_0x2d8462)},'json':!![]};return rp(_0x1ff317);}})['then'](function(_0x5a51d5){if(_0x5a51d5[_0x5108('0x61')]){var _0x94a304={'method':'GET','uri':_0x4e0abe,'qs':{'operation':_0x5108('0x64'),'username':_0x4996fd,'sessionName':_0x5a51d5[_0x5108('0x65')][_0x5108('0x66')],'elementType':_0x4ee8aa},'json':!![]};return rp(_0x94a304);}})[_0x5108('0x27')](function(_0x10b1f8){if(_0x10b1f8['success']){var _0x460685=[_0x5108('0x67'),'reference','owner'];_[_0x5108('0x68')](_0x10b1f8[_0x5108('0x65')]['fields'],function(_0x3f498d){return _0x460685[_0x5108('0x69')](_0x3f498d[_0x5108('0x30')][_0x5108('0x31')]);});_[_0x5108('0x68')](_0x10b1f8[_0x5108('0x65')][_0x5108('0x37')],function(_0x2e150e){return _0x2e150e['editable']===_0x5108('0x6a');});return{'count':_0x10b1f8['result'][_0x5108('0x37')][_0x5108('0x39')],'rows':_[_0x5108('0x2d')](_0x10b1f8[_0x5108('0x65')][_0x5108('0x37')],function(_0x18897c){return{'id':_0x18897c[_0x5108('0x31')],'name':_0x18897c[_0x5108('0x6b')],'custom':_[_0x5108('0x6c')](_0x18897c[_0x5108('0x31')],_0x5108('0x6d'))?!![]:![],'options':_0x18897c['type'][_0x5108('0x31')]===_0x5108('0x6e')&&_0x18897c['type']['picklistValues'][_0x5108('0x39')]>0x0?_['map'](_0x18897c[_0x5108('0x30')][_0x5108('0x6f')],function(_0x2d1269){return{'name':_0x2d1269[_0x5108('0x6b')],'value':_0x2d1269[_0x5108('0x70')]};}):[]};})};}})[_0x5108('0x27')](respondWithResult(_0x5bce92,null))[_0x5108('0x46')](function(_0x139c79){console[_0x5108('0x71')](_0x5108('0x72')+_0x139c79);var _0x1748d4=_0x4e76ce[_0x5108('0x32')]['test']?0x1f4:_0x139c79[_0x5108('0x73')]||0x1f4;logger[_0x5108('0x2b')](_0x5108('0x74'),_0x5108('0x58'),_0x1748d4,JSON[_0x5108('0x75')](_0x139c79));delete _0x139c79[_0x5108('0x31')];if(_0x1748d4===0x191){_0x1748d4=0x190;}_0x5bce92[_0x5108('0x1b')](_0x1748d4)[_0x5108('0x2c')](_0x4e76ce[_0x5108('0x32')][_0x5108('0x76')]?{'message':_0x5108('0x77'),'statusCode':_0x139c79['statusCode']}:_0x139c79);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 91ebe1c..07153d0 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 _0xbd22=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbd22,0xf7));var _0x2bd2=function(_0x56bb23,_0x1d5b23){_0x56bb23=_0x56bb23-0x0;var _0x34e77f=_0xbd22[_0x56bb23];return _0x34e77f;};'use strict';var _=require(_0x2bd2('0x0'));var util=require(_0x2bd2('0x1'));var logger=require(_0x2bd2('0x2'))(_0x2bd2('0x3'));var moment=require(_0x2bd2('0x4'));var BPromise=require(_0x2bd2('0x5'));var rp=require(_0x2bd2('0x6'));var fs=require('fs');var path=require(_0x2bd2('0x7'));var rimraf=require(_0x2bd2('0x8'));var config=require(_0x2bd2('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2bd2('0xa'));module[_0x2bd2('0xb')]=function(_0x2f3872,_0x4bff6d){return _0x2f3872[_0x2bd2('0xc')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68c7=['define','VtigerAccount','lodash','util','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x108250,_0x10c11b){var _0x509782=function(_0x464332){while(--_0x464332){_0x108250['push'](_0x108250['shift']());}};_0x509782(++_0x10c11b);}(_0x68c7,0x16a));var _0x768c=function(_0x38a024,_0x32a7e5){_0x38a024=_0x38a024-0x0;var _0x35e7aa=_0x68c7[_0x38a024];return _0x35e7aa;};'use strict';var _=require(_0x768c('0x0'));var util=require(_0x768c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x768c('0x2'));var fs=require('fs');var path=require(_0x768c('0x3'));var rimraf=require(_0x768c('0x4'));var config=require('../../config/environment');var attributes=require(_0x768c('0x5'));var integrations=require(_0x768c('0x6'));module[_0x768c('0x7')]=function(_0x58390c,_0x59a471){return _0x58390c[_0x768c('0x8')](_0x768c('0x9'),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 0e02033..3bc95e5 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 _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x326cc8,_0x58d7d0){var _0x4dac8d=function(_0x56563f){while(--_0x56563f){_0x326cc8['push'](_0x326cc8['shift']());}};_0x4dac8d(++_0x58d7d0);}(_0x6c76,0x184));var _0x66c7=function(_0x353f0e,_0x51adf3){_0x353f0e=_0x353f0e-0x0;var _0x1f0654=_0x6c76[_0x353f0e];return _0x1f0654;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file +var _0x4e81=['find','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','map','include','model','attributes','ShowVtigerAccount'];(function(_0x5addbb,_0x1aa9cf){var _0x297dfd=function(_0x29dfbf){while(--_0x29dfbf){_0x5addbb['push'](_0x5addbb['shift']());}};_0x297dfd(++_0x1aa9cf);}(_0x4e81,0x1bc));var _0x14e8=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x4e81[_0x32b30c];return _0xcfc212;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')]({'raw':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0x10dc8b['options']?_0x10dc8b[_0x14e8('0x18')]['attributes']||null:null,'limit':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x1a')]||null:null,'include':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['include']?_[_0x14e8('0x1b')](_0x10dc8b['options'][_0x14e8('0x1c')],function(_0x185a0e){return{'model':db[_0x185a0e['model']],'as':_0x185a0e['as'],'attributes':_0x185a0e['attributes'],'include':_0x185a0e['include']?_[_0x14e8('0x1b')](_0x185a0e[_0x14e8('0x1c')],function(_0x3eae0b){return{'model':db[_0x3eae0b[_0x14e8('0x1d')]],'as':_0x3eae0b['as'],'attributes':_0x3eae0b[_0x14e8('0x1e')],'include':_0x3eae0b['include']?_[_0x14e8('0x1b')](_0x3eae0b[_0x14e8('0x1c')],function(_0x3c09cb){return{'model':db[_0x3c09cb[_0x14e8('0x1d')]],'as':_0x3c09cb['as'],'attributes':_0x3c09cb[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2813ae){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger[_0x14e8('0xd')](_0x14e8('0x15'),_0x10dc8b,JSON['stringify'](_0x2813ae));_0x5a38c1(_0x2813ae);})['catch'](function(_0x5cacd7){logger[_0x14e8('0x10')](_0x14e8('0x15'),_0x5cacd7['message'],_0x10dc8b);_0x328c5a(_0x462259[_0x14e8('0x10')](0x1f4,_0x5cacd7[_0x14e8('0x13')]));});});};exports[_0x14e8('0x1f')]=function(_0xa83433){var _0x5c2635=this;return new Promise(function(_0x1f1259,_0x260d51){return db[_0x14e8('0x16')][_0x14e8('0x20')]({'raw':_0xa83433[_0x14e8('0x18')]?_0xa83433['options'][_0x14e8('0x21')]===undefined?!![]:![]:!![],'where':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0xa83433['options']?_0xa83433[_0x14e8('0x18')]['attributes']||null:null,'include':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')],function(_0xbe9eab){return{'model':db[_0xbe9eab[_0x14e8('0x1d')]],'as':_0xbe9eab['as'],'attributes':_0xbe9eab[_0x14e8('0x1e')],'include':_0xbe9eab[_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xbe9eab[_0x14e8('0x1c')],function(_0x54e624){return{'model':db[_0x54e624['model']],'as':_0x54e624['as'],'attributes':_0x54e624['attributes'],'include':_0x54e624[_0x14e8('0x1c')]?_['map'](_0x54e624[_0x14e8('0x1c')],function(_0x5bdf42){return{'model':db[_0x5bdf42[_0x14e8('0x1d')]],'as':_0x5bdf42['as'],'attributes':_0x5bdf42[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2fc030){logger['info'](_0x14e8('0x1f'),_0xa83433);logger['debug'](_0x14e8('0x1f'),_0xa83433,JSON[_0x14e8('0xf')](_0x2fc030));_0x1f1259(_0x2fc030);})[_0x14e8('0x14')](function(_0x1fda35){logger[_0x14e8('0x10')](_0x14e8('0x1f'),_0x1fda35['message'],_0xa83433);_0x260d51(_0x5c2635[_0x14e8('0x10')](0x1f4,_0x1fda35['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6f78447..96ee1ac 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 _0x7360=['create','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7360,0xd4));var _0x0736=function(_0x1f050a,_0x2cbd15){_0x1f050a=_0x1f050a-0x0;var _0x4d459b=_0x7360[_0x1f050a];return _0x4d459b;};'use strict';var multer=require('multer');var util=require(_0x0736('0x0'));var path=require(_0x0736('0x1'));var timeout=require(_0x0736('0x2'));var express=require(_0x0736('0x3'));var router=express[_0x0736('0x4')]();var fs_extra=require(_0x0736('0x5'));var auth=require(_0x0736('0x6'));var interaction=require(_0x0736('0x7'));var config=require(_0x0736('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x0736('0x9')](),controller[_0x0736('0xa')]);router[_0x0736('0xb')](_0x0736('0xc'),auth['isAuthenticated'](),controller[_0x0736('0xd')]);router[_0x0736('0xb')]('/:id/fields',auth[_0x0736('0x9')](),controller[_0x0736('0xe')]);router['get'](_0x0736('0xf'),auth[_0x0736('0x9')](),controller[_0x0736('0x10')]);router[_0x0736('0xb')](_0x0736('0x11'),auth[_0x0736('0x9')](),controller['getDescriptions']);router[_0x0736('0x12')]('/',auth[_0x0736('0x9')](),controller[_0x0736('0x13')]);router['put'](_0x0736('0xc'),auth[_0x0736('0x9')](),controller[_0x0736('0x14')]);router['delete'](_0x0736('0xc'),auth[_0x0736('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1067=['delete','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','post','create'];(function(_0x55939b,_0x4790a4){var _0x1fb44f=function(_0x33b053){while(--_0x33b053){_0x55939b['push'](_0x55939b['shift']());}};_0x1fb44f(++_0x4790a4);}(_0x1067,0x144));var _0x7106=function(_0xb24c9d,_0x1b8dc8){_0xb24c9d=_0xb24c9d-0x0;var _0xc89d5=_0x1067[_0xb24c9d];return _0xc89d5;};'use strict';var multer=require(_0x7106('0x0'));var util=require('util');var path=require(_0x7106('0x1'));var timeout=require(_0x7106('0x2'));var express=require(_0x7106('0x3'));var router=express['Router']();var fs_extra=require(_0x7106('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7106('0x5'));var config=require(_0x7106('0x6'));var controller=require(_0x7106('0x7'));router[_0x7106('0x8')]('/',auth[_0x7106('0x9')](),controller[_0x7106('0xa')]);router['get'](_0x7106('0xb'),auth[_0x7106('0x9')](),controller[_0x7106('0xc')]);router[_0x7106('0x8')]('/:id/fields',auth[_0x7106('0x9')](),controller[_0x7106('0xd')]);router[_0x7106('0x8')](_0x7106('0xe'),auth[_0x7106('0x9')](),controller[_0x7106('0xf')]);router[_0x7106('0x8')]('/:id/descriptions',auth[_0x7106('0x9')](),controller['getDescriptions']);router[_0x7106('0x10')]('/',auth[_0x7106('0x9')](),controller[_0x7106('0x11')]);router['put'](_0x7106('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7106('0x12')](_0x7106('0xb'),auth[_0x7106('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index d9f36a3..1c2fde4 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 _0x61da=['STRING','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61da,0xa7));var _0xa61d=function(_0x5b1567,_0x33a4f4){_0x5b1567=_0x5b1567-0x0;var _0xfe7b4d=_0x61da[_0x5b1567];return _0xfe7b4d;};'use strict';var Sequelize=require('sequelize');module[_0xa61d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa61d('0x1')]}}; \ No newline at end of file +var _0xb074=['exports','STRING'];(function(_0x56af07,_0x381838){var _0x34611c=function(_0x155cec){while(--_0x155cec){_0x56af07['push'](_0x56af07['shift']());}};_0x34611c(++_0x381838);}(_0xb074,0xc0));var _0x4b07=function(_0x277ce9,_0x1742b6){_0x277ce9=_0x277ce9-0x0;var _0x435588=_0xb074[_0x277ce9];return _0x435588;};'use strict';var Sequelize=require('sequelize');module[_0x4b07('0x0')]={'name':{'type':Sequelize[_0x4b07('0x1')]},'description':{'type':Sequelize[_0x4b07('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 32bc720..c613a86 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 _0x7689=['end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','intersection','includeAll','find','create','body','params','findOne','length','getFields','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7689,0x17e));var _0x9768=function(_0x2ae12a,_0x5e3e70){_0x2ae12a=_0x2ae12a-0x0;var _0x529cf6=_0x7689[_0x2ae12a];return _0x529cf6;};'use strict';var emlformat=require(_0x9768('0x0'));var rimraf=require(_0x9768('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9768('0x2'));var rp=require(_0x9768('0x3'));var moment=require(_0x9768('0x4'));var BPromise=require(_0x9768('0x5'));var Mustache=require(_0x9768('0x6'));var util=require('util');var path=require(_0x9768('0x7'));var sox=require(_0x9768('0x8'));var csv=require('to-csv');var ejs=require(_0x9768('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9768('0xa'));var squel=require(_0x9768('0xb'));var crypto=require(_0x9768('0xc'));var jsforce=require(_0x9768('0xd'));var deskjs=require(_0x9768('0xe'));var toCsv=require(_0x9768('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9768('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9768('0x11'));var as=require(_0x9768('0x12'));var hardwareService=require(_0x9768('0x13'));var logger=require(_0x9768('0x14'))(_0x9768('0x15'));var utils=require(_0x9768('0x16'));var config=require(_0x9768('0x17'));var licenseUtil=require(_0x9768('0x18'));var db=require(_0x9768('0x19'))['db'];function respondWithStatusCode(_0x10747d,_0x9c9449){_0x9c9449=_0x9c9449||0xcc;return function(_0x27ced5){if(_0x27ced5){return _0x10747d[_0x9768('0x1a')](_0x9c9449);}return _0x10747d[_0x9768('0x1b')](_0x9c9449)[_0x9768('0x1c')]();};}function respondWithResult(_0x396f49,_0x35701a){_0x35701a=_0x35701a||0xc8;return function(_0x12f627){if(_0x12f627){return _0x396f49[_0x9768('0x1b')](_0x35701a)['json'](_0x12f627);}};}function respondWithFilteredResult(_0x2e2ea4,_0x24e91e){return function(_0x42e756){if(_0x42e756){var _0x45ff4a=typeof _0x24e91e[_0x9768('0x1d')]===_0x9768('0x1e')&&typeof _0x24e91e[_0x9768('0x1f')]===_0x9768('0x1e');var _0x4377c=_0x42e756[_0x9768('0x20')];var _0x19c12b=_0x45ff4a?0x0:_0x24e91e[_0x9768('0x1d')];var _0x7b239c=_0x45ff4a?_0x42e756[_0x9768('0x20')]:_0x24e91e['offset']+_0x24e91e[_0x9768('0x1f')];var _0x2da50f;if(_0x7b239c>=_0x4377c){_0x7b239c=_0x4377c;_0x2da50f=0xc8;}else{_0x2da50f=0xce;}_0x2e2ea4['status'](_0x2da50f);return _0x2e2ea4[_0x9768('0x21')](_0x9768('0x22'),_0x19c12b+'-'+_0x7b239c+'/'+_0x4377c)[_0x9768('0x23')](_0x42e756);}return null;};}function patchUpdates(_0x4ae73a){return function(_0x18b3b7){try{jsonpatch['apply'](_0x18b3b7,_0x4ae73a,!![]);}catch(_0x54cf12){return BPromise[_0x9768('0x24')](_0x54cf12);}return _0x18b3b7[_0x9768('0x25')]();};}function saveUpdates(_0x47e49e,_0x198b94){return function(_0x70aa4a){if(_0x70aa4a){return _0x70aa4a[_0x9768('0x26')](_0x47e49e)[_0x9768('0x27')](function(_0x539d21){return _0x539d21;});}return null;};}function removeEntity(_0x360b94,_0x478ff7){return function(_0xcf2a21){if(_0xcf2a21){return _0xcf2a21[_0x9768('0x28')]()[_0x9768('0x27')](function(){_0x360b94[_0x9768('0x1b')](0xcc)[_0x9768('0x1c')]();});}};}function handleEntityNotFound(_0x87c6ce,_0x32d5e1){return function(_0x212e27){if(!_0x212e27){_0x87c6ce[_0x9768('0x1a')](0x194);}return _0x212e27;};}function handleError(_0x9fff8f,_0x21bf3d){_0x21bf3d=_0x21bf3d||0x1f4;return function(_0x5596ef){logger[_0x9768('0x29')](_0x5596ef['stack']);if(_0x5596ef['name']){delete _0x5596ef[_0x9768('0x2a')];}_0x9fff8f[_0x9768('0x1b')](_0x21bf3d)[_0x9768('0x2b')](_0x5596ef);};}exports[_0x9768('0x2c')]=function(_0x4f421c,_0x661437){var _0x2e1583={},_0x56961b={},_0x286d6f={'count':0x0,'rows':[]};var _0x58e3f3=_['map'](db[_0x9768('0x2d')][_0x9768('0x2e')],function(_0x402923){return{'name':_0x402923[_0x9768('0x2f')],'type':_0x402923[_0x9768('0x30')][_0x9768('0x31')]};});_0x56961b[_0x9768('0x32')]=_[_0x9768('0x33')](_0x58e3f3,_0x9768('0x2a'));_0x56961b[_0x9768('0x34')]=_[_0x9768('0x35')](_0x4f421c[_0x9768('0x34')]);_0x56961b[_0x9768('0x36')]=_['intersection'](_0x56961b[_0x9768('0x32')],_0x56961b[_0x9768('0x34')]);_0x2e1583[_0x9768('0x37')]=_['intersection'](_0x56961b[_0x9768('0x32')],qs[_0x9768('0x38')](_0x4f421c[_0x9768('0x34')][_0x9768('0x38')]));_0x2e1583['attributes']=_0x2e1583[_0x9768('0x37')]['length']?_0x2e1583['attributes']:_0x56961b[_0x9768('0x32')];if(!_0x4f421c[_0x9768('0x34')][_0x9768('0x39')](_0x9768('0x3a'))){_0x2e1583['limit']=qs['limit'](_0x4f421c[_0x9768('0x34')][_0x9768('0x1f')]);_0x2e1583[_0x9768('0x1d')]=qs['offset'](_0x4f421c[_0x9768('0x34')]['offset']);}_0x2e1583[_0x9768('0x3b')]=qs[_0x9768('0x3c')](_0x4f421c['query'][_0x9768('0x3c')]);_0x2e1583[_0x9768('0x3d')]=qs[_0x9768('0x36')](_[_0x9768('0x3e')](_0x4f421c['query'],_0x56961b['filters']),_0x58e3f3);if(_0x4f421c[_0x9768('0x34')][_0x9768('0x3f')]){_0x2e1583['where']=_[_0x9768('0x40')](_0x2e1583[_0x9768('0x3d')],{'$or':_[_0x9768('0x33')](_0x58e3f3,function(_0x29989a){if(_0x29989a['type']!=='VIRTUAL'){var _0x3237ec={};_0x3237ec[_0x29989a[_0x9768('0x2a')]]={'$like':'%'+_0x4f421c[_0x9768('0x34')][_0x9768('0x3f')]+'%'};return _0x3237ec;}})});}_0x2e1583=_[_0x9768('0x40')]({},_0x2e1583,_0x4f421c[_0x9768('0x41')]);var _0x1e0062={'where':_0x2e1583['where']};return db['VtigerConfiguration']['count'](_0x1e0062)[_0x9768('0x27')](function(_0x4321be){_0x286d6f[_0x9768('0x20')]=_0x4321be;if(_0x4f421c[_0x9768('0x34')]['includeAll']){_0x2e1583[_0x9768('0x42')]=[{'all':!![]}];}return db[_0x9768('0x2d')][_0x9768('0x43')](_0x2e1583);})[_0x9768('0x27')](function(_0x5b14c6){_0x286d6f[_0x9768('0x44')]=_0x5b14c6;return _0x286d6f;})[_0x9768('0x27')](respondWithFilteredResult(_0x661437,_0x2e1583))[_0x9768('0x45')](handleError(_0x661437,null));};exports['show']=function(_0x538546,_0x3d3b5c){var _0x238728={'raw':![],'where':{'id':_0x538546['params']['id']}},_0xc3d31e={};_0xc3d31e[_0x9768('0x32')]=_[_0x9768('0x35')](db['VtigerConfiguration']['rawAttributes']);_0xc3d31e[_0x9768('0x34')]=_['keys'](_0x538546[_0x9768('0x34')]);_0xc3d31e['filters']=_[_0x9768('0x46')](_0xc3d31e[_0x9768('0x32')],_0xc3d31e[_0x9768('0x34')]);_0x238728[_0x9768('0x37')]=_['intersection'](_0xc3d31e[_0x9768('0x32')],qs[_0x9768('0x38')](_0x538546[_0x9768('0x34')][_0x9768('0x38')]));_0x238728[_0x9768('0x37')]=_0x238728[_0x9768('0x37')]['length']?_0x238728[_0x9768('0x37')]:_0xc3d31e[_0x9768('0x32')];if(_0x538546[_0x9768('0x34')][_0x9768('0x47')]){_0x238728[_0x9768('0x42')]=[{'all':!![]}];}_0x238728=_[_0x9768('0x40')]({},_0x238728,_0x538546['options']);return db[_0x9768('0x2d')][_0x9768('0x48')](_0x238728)[_0x9768('0x27')](handleEntityNotFound(_0x3d3b5c,null))[_0x9768('0x27')](respondWithResult(_0x3d3b5c,null))[_0x9768('0x45')](handleError(_0x3d3b5c,null));};exports[_0x9768('0x49')]=function(_0x2a2efc,_0x51f888){return db[_0x9768('0x2d')]['create'](_0x2a2efc[_0x9768('0x4a')],{})[_0x9768('0x27')](respondWithResult(_0x51f888,0xc9))[_0x9768('0x45')](handleError(_0x51f888,null));};exports['update']=function(_0xb32308,_0x558a64){if(_0xb32308[_0x9768('0x4a')]['id']){delete _0xb32308[_0x9768('0x4a')]['id'];}return db['VtigerConfiguration'][_0x9768('0x48')]({'where':{'id':_0xb32308[_0x9768('0x4b')]['id']}})[_0x9768('0x27')](handleEntityNotFound(_0x558a64,null))[_0x9768('0x27')](saveUpdates(_0xb32308[_0x9768('0x4a')],null))[_0x9768('0x27')](respondWithResult(_0x558a64,null))['catch'](handleError(_0x558a64,null));};exports[_0x9768('0x28')]=function(_0x10fe2a,_0x35c8a4){return db[_0x9768('0x2d')][_0x9768('0x48')]({'where':{'id':_0x10fe2a['params']['id']}})['then'](handleEntityNotFound(_0x35c8a4,null))[_0x9768('0x27')](removeEntity(_0x35c8a4,null))[_0x9768('0x45')](handleError(_0x35c8a4,null));};exports['getFields']=function(_0x18fcde,_0x1e195d,_0x5e555a){var _0x2a722d={};var _0x382e2f={};var _0x147dc6;var _0x1a4eb2;return db['VtigerConfiguration'][_0x9768('0x4c')]({'where':{'id':_0x18fcde['params']['id']}})[_0x9768('0x27')](handleEntityNotFound(_0x1e195d,null))[_0x9768('0x27')](function(_0x347c94){if(_0x347c94){_0x147dc6=_0x347c94;_0x382e2f[_0x9768('0x32')]=_[_0x9768('0x35')](db['VtigerField'][_0x9768('0x2e')]);_0x382e2f[_0x9768('0x34')]=_[_0x9768('0x35')](_0x18fcde[_0x9768('0x34')]);_0x382e2f[_0x9768('0x36')]=_[_0x9768('0x46')](_0x382e2f['model'],_0x382e2f['query']);_0x2a722d[_0x9768('0x37')]=_[_0x9768('0x46')](_0x382e2f[_0x9768('0x32')],qs[_0x9768('0x38')](_0x18fcde[_0x9768('0x34')][_0x9768('0x38')]));_0x2a722d[_0x9768('0x37')]=_0x2a722d[_0x9768('0x37')][_0x9768('0x4d')]?_0x2a722d[_0x9768('0x37')]:_0x382e2f[_0x9768('0x32')];_0x2a722d['order']=qs['sort'](_0x18fcde[_0x9768('0x34')][_0x9768('0x3c')]);_0x2a722d[_0x9768('0x3d')]=qs['filters'](_[_0x9768('0x3e')](_0x18fcde[_0x9768('0x34')],_0x382e2f[_0x9768('0x36')]));if(_0x18fcde['query'][_0x9768('0x3f')]){_0x2a722d[_0x9768('0x3d')]=_[_0x9768('0x40')](_0x2a722d[_0x9768('0x3d')],{'$or':_[_0x9768('0x33')](_0x2a722d['attributes'],function(_0x13aef0){var _0x3ab5b7={};_0x3ab5b7[_0x13aef0]={'$like':'%'+_0x18fcde[_0x9768('0x34')]['filter']+'%'};return _0x3ab5b7;})});}_0x2a722d=_[_0x9768('0x40')]({},_0x2a722d,_0x18fcde[_0x9768('0x41')]);return _0x147dc6[_0x9768('0x4e')](_0x2a722d);}})[_0x9768('0x27')](function(_0x20076a){if(_0x20076a){_0x1a4eb2=_0x20076a[_0x9768('0x4d')];if(!_0x18fcde['query'][_0x9768('0x39')]('nolimit')){_0x2a722d[_0x9768('0x1f')]=qs[_0x9768('0x1f')](_0x18fcde['query'][_0x9768('0x1f')]);_0x2a722d[_0x9768('0x1d')]=qs[_0x9768('0x1d')](_0x18fcde['query'][_0x9768('0x1d')]);}return _0x147dc6[_0x9768('0x4e')](_0x2a722d);}})[_0x9768('0x27')](function(_0x102120){if(_0x102120){return _0x102120?{'count':_0x1a4eb2,'rows':_0x102120}:null;}})[_0x9768('0x27')](respondWithResult(_0x1e195d,null))['catch'](handleError(_0x1e195d,null));};exports['getSubjects']=function(_0x3502b4,_0xbb3def,_0x2db957){var _0x20d270={};var _0x575769={};var _0x2930c9;var _0x211a3c;return db[_0x9768('0x2d')][_0x9768('0x4c')]({'where':{'id':_0x3502b4['params']['id']}})[_0x9768('0x27')](handleEntityNotFound(_0xbb3def,null))[_0x9768('0x27')](function(_0x206838){if(_0x206838){_0x2930c9=_0x206838;_0x575769[_0x9768('0x32')]=_['keys'](db[_0x9768('0x4f')][_0x9768('0x2e')]);_0x575769['query']=_[_0x9768('0x35')](_0x3502b4[_0x9768('0x34')]);_0x575769['filters']=_['intersection'](_0x575769[_0x9768('0x32')],_0x575769[_0x9768('0x34')]);_0x20d270[_0x9768('0x37')]=_[_0x9768('0x46')](_0x575769[_0x9768('0x32')],qs[_0x9768('0x38')](_0x3502b4[_0x9768('0x34')][_0x9768('0x38')]));_0x20d270[_0x9768('0x37')]=_0x20d270[_0x9768('0x37')][_0x9768('0x4d')]?_0x20d270['attributes']:_0x575769[_0x9768('0x32')];_0x20d270[_0x9768('0x3b')]=qs[_0x9768('0x3c')](_0x3502b4[_0x9768('0x34')][_0x9768('0x3c')]);_0x20d270['where']=qs[_0x9768('0x36')](_[_0x9768('0x3e')](_0x3502b4[_0x9768('0x34')],_0x575769[_0x9768('0x36')]));if(_0x3502b4[_0x9768('0x34')][_0x9768('0x3f')]){_0x20d270[_0x9768('0x3d')]=_['merge'](_0x20d270[_0x9768('0x3d')],{'$or':_['map'](_0x20d270[_0x9768('0x37')],function(_0x4c24d2){var _0x1903f6={};_0x1903f6[_0x4c24d2]={'$like':'%'+_0x3502b4[_0x9768('0x34')][_0x9768('0x3f')]+'%'};return _0x1903f6;})});}_0x20d270=_[_0x9768('0x40')]({},_0x20d270,_0x3502b4[_0x9768('0x41')]);return _0x2930c9[_0x9768('0x50')](_0x20d270);}})[_0x9768('0x27')](function(_0x1999ea){if(_0x1999ea){_0x211a3c=_0x1999ea[_0x9768('0x4d')];if(!_0x3502b4[_0x9768('0x34')][_0x9768('0x39')](_0x9768('0x3a'))){_0x20d270['limit']=qs[_0x9768('0x1f')](_0x3502b4[_0x9768('0x34')][_0x9768('0x1f')]);_0x20d270[_0x9768('0x1d')]=qs['offset'](_0x3502b4[_0x9768('0x34')][_0x9768('0x1d')]);}return _0x2930c9[_0x9768('0x50')](_0x20d270);}})[_0x9768('0x27')](function(_0x25f129){if(_0x25f129){return _0x25f129?{'count':_0x211a3c,'rows':_0x25f129}:null;}})[_0x9768('0x27')](respondWithResult(_0xbb3def,null))[_0x9768('0x45')](handleError(_0xbb3def,null));};exports[_0x9768('0x51')]=function(_0x5bbba1,_0x163b53,_0x5c7349){var _0x252829={};var _0x4a3c29={};var _0x74f0de;var _0x32b258;return db[_0x9768('0x2d')][_0x9768('0x4c')]({'where':{'id':_0x5bbba1[_0x9768('0x4b')]['id']}})[_0x9768('0x27')](handleEntityNotFound(_0x163b53,null))[_0x9768('0x27')](function(_0x57e892){if(_0x57e892){_0x74f0de=_0x57e892;_0x4a3c29[_0x9768('0x32')]=_[_0x9768('0x35')](db[_0x9768('0x4f')]['rawAttributes']);_0x4a3c29[_0x9768('0x34')]=_[_0x9768('0x35')](_0x5bbba1['query']);_0x4a3c29[_0x9768('0x36')]=_[_0x9768('0x46')](_0x4a3c29[_0x9768('0x32')],_0x4a3c29[_0x9768('0x34')]);_0x252829['attributes']=_['intersection'](_0x4a3c29[_0x9768('0x32')],qs[_0x9768('0x38')](_0x5bbba1['query'][_0x9768('0x38')]));_0x252829[_0x9768('0x37')]=_0x252829[_0x9768('0x37')][_0x9768('0x4d')]?_0x252829[_0x9768('0x37')]:_0x4a3c29[_0x9768('0x32')];_0x252829[_0x9768('0x3b')]=qs[_0x9768('0x3c')](_0x5bbba1[_0x9768('0x34')]['sort']);_0x252829[_0x9768('0x3d')]=qs[_0x9768('0x36')](_[_0x9768('0x3e')](_0x5bbba1[_0x9768('0x34')],_0x4a3c29[_0x9768('0x36')]));if(_0x5bbba1[_0x9768('0x34')][_0x9768('0x3f')]){_0x252829['where']=_['merge'](_0x252829['where'],{'$or':_[_0x9768('0x33')](_0x252829['attributes'],function(_0x40704a){var _0x46c6be={};_0x46c6be[_0x40704a]={'$like':'%'+_0x5bbba1[_0x9768('0x34')]['filter']+'%'};return _0x46c6be;})});}_0x252829=_[_0x9768('0x40')]({},_0x252829,_0x5bbba1[_0x9768('0x41')]);return _0x74f0de[_0x9768('0x51')](_0x252829);}})[_0x9768('0x27')](function(_0x417e49){if(_0x417e49){_0x32b258=_0x417e49[_0x9768('0x4d')];if(!_0x5bbba1[_0x9768('0x34')][_0x9768('0x39')](_0x9768('0x3a'))){_0x252829[_0x9768('0x1f')]=qs[_0x9768('0x1f')](_0x5bbba1[_0x9768('0x34')][_0x9768('0x1f')]);_0x252829[_0x9768('0x1d')]=qs[_0x9768('0x1d')](_0x5bbba1['query']['offset']);}return _0x74f0de[_0x9768('0x51')](_0x252829);}})[_0x9768('0x27')](function(_0x5380e4){if(_0x5380e4){return _0x5380e4?{'count':_0x32b258,'rows':_0x5380e4}:null;}})[_0x9768('0x27')](respondWithResult(_0x163b53,null))[_0x9768('0x45')](handleError(_0x163b53,null));}; \ No newline at end of file +var _0xbbd0=['keys','find','body','update','findOne','params','VtigerField','order','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','apply','reject','save','destroy','sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show'];(function(_0x3fcc24,_0x281d8d){var _0x2963cc=function(_0x561b7f){while(--_0x561b7f){_0x3fcc24['push'](_0x3fcc24['shift']());}};_0x2963cc(++_0x281d8d);}(_0xbbd0,0xad));var _0x0bbd=function(_0x10df12,_0x57dbec){_0x10df12=_0x10df12-0x0;var _0x5c3685=_0xbbd0[_0x10df12];return _0x5c3685;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bbd('0x0'));var zipdir=require(_0x0bbd('0x1'));var jsonpatch=require(_0x0bbd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0bbd('0x3'));var Mustache=require(_0x0bbd('0x4'));var util=require(_0x0bbd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0bbd('0x6'));var ejs=require(_0x0bbd('0x7'));var fs=require('fs');var fs_extra=require(_0x0bbd('0x8'));var _=require(_0x0bbd('0x9'));var squel=require(_0x0bbd('0xa'));var crypto=require(_0x0bbd('0xb'));var jsforce=require(_0x0bbd('0xc'));var deskjs=require(_0x0bbd('0xd'));var toCsv=require(_0x0bbd('0x6'));var querystring=require(_0x0bbd('0xe'));var Papa=require(_0x0bbd('0xf'));var Redis=require(_0x0bbd('0x10'));var authService=require(_0x0bbd('0x11'));var qs=require(_0x0bbd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bbd('0x13'))('api');var utils=require(_0x0bbd('0x14'));var config=require(_0x0bbd('0x15'));var licenseUtil=require(_0x0bbd('0x16'));var db=require(_0x0bbd('0x17'))['db'];function respondWithStatusCode(_0x5b792e,_0x29ccba){_0x29ccba=_0x29ccba||0xcc;return function(_0x34161b){if(_0x34161b){return _0x5b792e['sendStatus'](_0x29ccba);}return _0x5b792e[_0x0bbd('0x18')](_0x29ccba)[_0x0bbd('0x19')]();};}function respondWithResult(_0x388002,_0x56cc2a){_0x56cc2a=_0x56cc2a||0xc8;return function(_0xd0c64b){if(_0xd0c64b){return _0x388002['status'](_0x56cc2a)['json'](_0xd0c64b);}};}function respondWithFilteredResult(_0x1d07fc,_0x59467b){return function(_0xac7ccf){if(_0xac7ccf){var _0x1c0825=typeof _0x59467b['offset']===_0x0bbd('0x1a')&&typeof _0x59467b['limit']===_0x0bbd('0x1a');var _0x2d2000=_0xac7ccf[_0x0bbd('0x1b')];var _0x18250b=_0x1c0825?0x0:_0x59467b[_0x0bbd('0x1c')];var _0x160efc=_0x1c0825?_0xac7ccf['count']:_0x59467b[_0x0bbd('0x1c')]+_0x59467b[_0x0bbd('0x1d')];var _0x565a05;if(_0x160efc>=_0x2d2000){_0x160efc=_0x2d2000;_0x565a05=0xc8;}else{_0x565a05=0xce;}_0x1d07fc[_0x0bbd('0x18')](_0x565a05);return _0x1d07fc[_0x0bbd('0x1e')]('Content-Range',_0x18250b+'-'+_0x160efc+'/'+_0x2d2000)['json'](_0xac7ccf);}return null;};}function patchUpdates(_0x5813d4){return function(_0x360708){try{jsonpatch[_0x0bbd('0x1f')](_0x360708,_0x5813d4,!![]);}catch(_0x320d55){return BPromise[_0x0bbd('0x20')](_0x320d55);}return _0x360708[_0x0bbd('0x21')]();};}function saveUpdates(_0x320daf,_0x591a15){return function(_0x5959ee){if(_0x5959ee){return _0x5959ee['update'](_0x320daf)['then'](function(_0x251b31){return _0x251b31;});}return null;};}function removeEntity(_0x1d717a,_0x292826){return function(_0x5a1780){if(_0x5a1780){return _0x5a1780[_0x0bbd('0x22')]()['then'](function(){_0x1d717a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c9eb,_0x3e6672){return function(_0x2bb1b9){if(!_0x2bb1b9){_0x21c9eb[_0x0bbd('0x23')](0x194);}return _0x2bb1b9;};}function handleError(_0x292727,_0x5692d5){_0x5692d5=_0x5692d5||0x1f4;return function(_0x4e31a5){logger[_0x0bbd('0x24')](_0x4e31a5[_0x0bbd('0x25')]);if(_0x4e31a5[_0x0bbd('0x26')]){delete _0x4e31a5[_0x0bbd('0x26')];}_0x292727[_0x0bbd('0x18')](_0x5692d5)[_0x0bbd('0x27')](_0x4e31a5);};}exports['index']=function(_0x5ed29e,_0x2b7877){var _0x43fb85={},_0x40545e={},_0x45971f={'count':0x0,'rows':[]};var _0x54a83c=_[_0x0bbd('0x28')](db[_0x0bbd('0x29')][_0x0bbd('0x2a')],function(_0x3378f0){return{'name':_0x3378f0[_0x0bbd('0x2b')],'type':_0x3378f0[_0x0bbd('0x2c')][_0x0bbd('0x2d')]};});_0x40545e[_0x0bbd('0x2e')]=_[_0x0bbd('0x28')](_0x54a83c,_0x0bbd('0x26'));_0x40545e[_0x0bbd('0x2f')]=_['keys'](_0x5ed29e[_0x0bbd('0x2f')]);_0x40545e[_0x0bbd('0x30')]=_[_0x0bbd('0x31')](_0x40545e[_0x0bbd('0x2e')],_0x40545e[_0x0bbd('0x2f')]);_0x43fb85[_0x0bbd('0x32')]=_[_0x0bbd('0x31')](_0x40545e['model'],qs[_0x0bbd('0x33')](_0x5ed29e[_0x0bbd('0x2f')]['fields']));_0x43fb85['attributes']=_0x43fb85[_0x0bbd('0x32')][_0x0bbd('0x34')]?_0x43fb85[_0x0bbd('0x32')]:_0x40545e[_0x0bbd('0x2e')];if(!_0x5ed29e[_0x0bbd('0x2f')]['hasOwnProperty']('nolimit')){_0x43fb85[_0x0bbd('0x1d')]=qs[_0x0bbd('0x1d')](_0x5ed29e[_0x0bbd('0x2f')][_0x0bbd('0x1d')]);_0x43fb85[_0x0bbd('0x1c')]=qs[_0x0bbd('0x1c')](_0x5ed29e[_0x0bbd('0x2f')][_0x0bbd('0x1c')]);}_0x43fb85['order']=qs['sort'](_0x5ed29e['query'][_0x0bbd('0x35')]);_0x43fb85[_0x0bbd('0x36')]=qs['filters'](_[_0x0bbd('0x37')](_0x5ed29e[_0x0bbd('0x2f')],_0x40545e[_0x0bbd('0x30')]),_0x54a83c);if(_0x5ed29e[_0x0bbd('0x2f')][_0x0bbd('0x38')]){_0x43fb85[_0x0bbd('0x36')]=_[_0x0bbd('0x39')](_0x43fb85[_0x0bbd('0x36')],{'$or':_['map'](_0x54a83c,function(_0x6b8203){if(_0x6b8203[_0x0bbd('0x2c')]!==_0x0bbd('0x3a')){var _0x3f1dfd={};_0x3f1dfd[_0x6b8203[_0x0bbd('0x26')]]={'$like':'%'+_0x5ed29e['query']['filter']+'%'};return _0x3f1dfd;}})});}_0x43fb85=_[_0x0bbd('0x39')]({},_0x43fb85,_0x5ed29e[_0x0bbd('0x3b')]);var _0x43bd7b={'where':_0x43fb85[_0x0bbd('0x36')]};return db[_0x0bbd('0x29')][_0x0bbd('0x1b')](_0x43bd7b)[_0x0bbd('0x3c')](function(_0x546f32){_0x45971f[_0x0bbd('0x1b')]=_0x546f32;if(_0x5ed29e['query'][_0x0bbd('0x3d')]){_0x43fb85[_0x0bbd('0x3e')]=[{'all':!![]}];}return db[_0x0bbd('0x29')][_0x0bbd('0x3f')](_0x43fb85);})[_0x0bbd('0x3c')](function(_0x61e82d){_0x45971f[_0x0bbd('0x40')]=_0x61e82d;return _0x45971f;})[_0x0bbd('0x3c')](respondWithFilteredResult(_0x2b7877,_0x43fb85))[_0x0bbd('0x41')](handleError(_0x2b7877,null));};exports[_0x0bbd('0x42')]=function(_0x1f726a,_0x10680f){var _0x27cde4={'raw':![],'where':{'id':_0x1f726a['params']['id']}},_0x4c5e4a={};_0x4c5e4a[_0x0bbd('0x2e')]=_[_0x0bbd('0x43')](db[_0x0bbd('0x29')][_0x0bbd('0x2a')]);_0x4c5e4a[_0x0bbd('0x2f')]=_[_0x0bbd('0x43')](_0x1f726a[_0x0bbd('0x2f')]);_0x4c5e4a['filters']=_['intersection'](_0x4c5e4a[_0x0bbd('0x2e')],_0x4c5e4a[_0x0bbd('0x2f')]);_0x27cde4[_0x0bbd('0x32')]=_[_0x0bbd('0x31')](_0x4c5e4a[_0x0bbd('0x2e')],qs[_0x0bbd('0x33')](_0x1f726a[_0x0bbd('0x2f')][_0x0bbd('0x33')]));_0x27cde4[_0x0bbd('0x32')]=_0x27cde4[_0x0bbd('0x32')][_0x0bbd('0x34')]?_0x27cde4[_0x0bbd('0x32')]:_0x4c5e4a[_0x0bbd('0x2e')];if(_0x1f726a['query'][_0x0bbd('0x3d')]){_0x27cde4['include']=[{'all':!![]}];}_0x27cde4=_['merge']({},_0x27cde4,_0x1f726a['options']);return db[_0x0bbd('0x29')][_0x0bbd('0x44')](_0x27cde4)[_0x0bbd('0x3c')](handleEntityNotFound(_0x10680f,null))[_0x0bbd('0x3c')](respondWithResult(_0x10680f,null))[_0x0bbd('0x41')](handleError(_0x10680f,null));};exports['create']=function(_0x598b11,_0x486917){return db[_0x0bbd('0x29')]['create'](_0x598b11[_0x0bbd('0x45')],{})[_0x0bbd('0x3c')](respondWithResult(_0x486917,0xc9))[_0x0bbd('0x41')](handleError(_0x486917,null));};exports[_0x0bbd('0x46')]=function(_0x2bdd3b,_0x4d8c85){if(_0x2bdd3b[_0x0bbd('0x45')]['id']){delete _0x2bdd3b[_0x0bbd('0x45')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2bdd3b['params']['id']}})[_0x0bbd('0x3c')](handleEntityNotFound(_0x4d8c85,null))[_0x0bbd('0x3c')](saveUpdates(_0x2bdd3b[_0x0bbd('0x45')],null))[_0x0bbd('0x3c')](respondWithResult(_0x4d8c85,null))[_0x0bbd('0x41')](handleError(_0x4d8c85,null));};exports[_0x0bbd('0x22')]=function(_0x20f17d,_0x43da0a){return db['VtigerConfiguration'][_0x0bbd('0x44')]({'where':{'id':_0x20f17d['params']['id']}})[_0x0bbd('0x3c')](handleEntityNotFound(_0x43da0a,null))['then'](removeEntity(_0x43da0a,null))[_0x0bbd('0x41')](handleError(_0x43da0a,null));};exports['getFields']=function(_0x4aa38c,_0x40b874,_0x456efa){var _0x455919={};var _0x5ab0ce={};var _0x4606e7;var _0x558f60;return db['VtigerConfiguration'][_0x0bbd('0x47')]({'where':{'id':_0x4aa38c[_0x0bbd('0x48')]['id']}})['then'](handleEntityNotFound(_0x40b874,null))['then'](function(_0x509cad){if(_0x509cad){_0x4606e7=_0x509cad;_0x5ab0ce[_0x0bbd('0x2e')]=_[_0x0bbd('0x43')](db[_0x0bbd('0x49')]['rawAttributes']);_0x5ab0ce[_0x0bbd('0x2f')]=_[_0x0bbd('0x43')](_0x4aa38c[_0x0bbd('0x2f')]);_0x5ab0ce[_0x0bbd('0x30')]=_[_0x0bbd('0x31')](_0x5ab0ce['model'],_0x5ab0ce[_0x0bbd('0x2f')]);_0x455919[_0x0bbd('0x32')]=_[_0x0bbd('0x31')](_0x5ab0ce[_0x0bbd('0x2e')],qs[_0x0bbd('0x33')](_0x4aa38c['query'][_0x0bbd('0x33')]));_0x455919['attributes']=_0x455919[_0x0bbd('0x32')]['length']?_0x455919[_0x0bbd('0x32')]:_0x5ab0ce[_0x0bbd('0x2e')];_0x455919[_0x0bbd('0x4a')]=qs[_0x0bbd('0x35')](_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x35')]);_0x455919[_0x0bbd('0x36')]=qs[_0x0bbd('0x30')](_[_0x0bbd('0x37')](_0x4aa38c[_0x0bbd('0x2f')],_0x5ab0ce[_0x0bbd('0x30')]));if(_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x38')]){_0x455919[_0x0bbd('0x36')]=_['merge'](_0x455919[_0x0bbd('0x36')],{'$or':_[_0x0bbd('0x28')](_0x455919[_0x0bbd('0x32')],function(_0x22fa1c){var _0x49a239={};_0x49a239[_0x22fa1c]={'$like':'%'+_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x38')]+'%'};return _0x49a239;})});}_0x455919=_[_0x0bbd('0x39')]({},_0x455919,_0x4aa38c[_0x0bbd('0x3b')]);return _0x4606e7[_0x0bbd('0x4b')](_0x455919);}})[_0x0bbd('0x3c')](function(_0x46d277){if(_0x46d277){_0x558f60=_0x46d277[_0x0bbd('0x34')];if(!_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x4c')](_0x0bbd('0x4d'))){_0x455919[_0x0bbd('0x1d')]=qs['limit'](_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x1d')]);_0x455919[_0x0bbd('0x1c')]=qs[_0x0bbd('0x1c')](_0x4aa38c[_0x0bbd('0x2f')][_0x0bbd('0x1c')]);}return _0x4606e7[_0x0bbd('0x4b')](_0x455919);}})[_0x0bbd('0x3c')](function(_0x19db83){if(_0x19db83){return _0x19db83?{'count':_0x558f60,'rows':_0x19db83}:null;}})[_0x0bbd('0x3c')](respondWithResult(_0x40b874,null))[_0x0bbd('0x41')](handleError(_0x40b874,null));};exports[_0x0bbd('0x4e')]=function(_0x27efa6,_0x233052,_0xb966c4){var _0x491ff0={};var _0x2f1ff8={};var _0x1d0c3c;var _0x1b52c5;return db[_0x0bbd('0x29')]['findOne']({'where':{'id':_0x27efa6['params']['id']}})[_0x0bbd('0x3c')](handleEntityNotFound(_0x233052,null))[_0x0bbd('0x3c')](function(_0x3a1a01){if(_0x3a1a01){_0x1d0c3c=_0x3a1a01;_0x2f1ff8['model']=_['keys'](db[_0x0bbd('0x49')][_0x0bbd('0x2a')]);_0x2f1ff8[_0x0bbd('0x2f')]=_[_0x0bbd('0x43')](_0x27efa6[_0x0bbd('0x2f')]);_0x2f1ff8[_0x0bbd('0x30')]=_['intersection'](_0x2f1ff8[_0x0bbd('0x2e')],_0x2f1ff8['query']);_0x491ff0[_0x0bbd('0x32')]=_[_0x0bbd('0x31')](_0x2f1ff8['model'],qs[_0x0bbd('0x33')](_0x27efa6['query'][_0x0bbd('0x33')]));_0x491ff0[_0x0bbd('0x32')]=_0x491ff0[_0x0bbd('0x32')][_0x0bbd('0x34')]?_0x491ff0['attributes']:_0x2f1ff8[_0x0bbd('0x2e')];_0x491ff0[_0x0bbd('0x4a')]=qs[_0x0bbd('0x35')](_0x27efa6['query'][_0x0bbd('0x35')]);_0x491ff0[_0x0bbd('0x36')]=qs[_0x0bbd('0x30')](_[_0x0bbd('0x37')](_0x27efa6[_0x0bbd('0x2f')],_0x2f1ff8['filters']));if(_0x27efa6[_0x0bbd('0x2f')][_0x0bbd('0x38')]){_0x491ff0[_0x0bbd('0x36')]=_[_0x0bbd('0x39')](_0x491ff0[_0x0bbd('0x36')],{'$or':_['map'](_0x491ff0[_0x0bbd('0x32')],function(_0x35bbea){var _0xa44b41={};_0xa44b41[_0x35bbea]={'$like':'%'+_0x27efa6[_0x0bbd('0x2f')][_0x0bbd('0x38')]+'%'};return _0xa44b41;})});}_0x491ff0=_[_0x0bbd('0x39')]({},_0x491ff0,_0x27efa6[_0x0bbd('0x3b')]);return _0x1d0c3c[_0x0bbd('0x4e')](_0x491ff0);}})[_0x0bbd('0x3c')](function(_0x570f79){if(_0x570f79){_0x1b52c5=_0x570f79[_0x0bbd('0x34')];if(!_0x27efa6[_0x0bbd('0x2f')][_0x0bbd('0x4c')](_0x0bbd('0x4d'))){_0x491ff0[_0x0bbd('0x1d')]=qs[_0x0bbd('0x1d')](_0x27efa6[_0x0bbd('0x2f')][_0x0bbd('0x1d')]);_0x491ff0[_0x0bbd('0x1c')]=qs[_0x0bbd('0x1c')](_0x27efa6[_0x0bbd('0x2f')][_0x0bbd('0x1c')]);}return _0x1d0c3c[_0x0bbd('0x4e')](_0x491ff0);}})[_0x0bbd('0x3c')](function(_0x14948c){if(_0x14948c){return _0x14948c?{'count':_0x1b52c5,'rows':_0x14948c}:null;}})[_0x0bbd('0x3c')](respondWithResult(_0x233052,null))['catch'](handleError(_0x233052,null));};exports[_0x0bbd('0x4f')]=function(_0x436c9c,_0x37bf0d,_0x917554){var _0x2c39a6={};var _0x5cf8df={};var _0x221ad5;var _0xf31fcc;return db['VtigerConfiguration'][_0x0bbd('0x47')]({'where':{'id':_0x436c9c[_0x0bbd('0x48')]['id']}})[_0x0bbd('0x3c')](handleEntityNotFound(_0x37bf0d,null))['then'](function(_0x54e203){if(_0x54e203){_0x221ad5=_0x54e203;_0x5cf8df['model']=_['keys'](db['VtigerField'][_0x0bbd('0x2a')]);_0x5cf8df[_0x0bbd('0x2f')]=_['keys'](_0x436c9c[_0x0bbd('0x2f')]);_0x5cf8df[_0x0bbd('0x30')]=_[_0x0bbd('0x31')](_0x5cf8df[_0x0bbd('0x2e')],_0x5cf8df['query']);_0x2c39a6[_0x0bbd('0x32')]=_[_0x0bbd('0x31')](_0x5cf8df[_0x0bbd('0x2e')],qs[_0x0bbd('0x33')](_0x436c9c[_0x0bbd('0x2f')]['fields']));_0x2c39a6['attributes']=_0x2c39a6[_0x0bbd('0x32')][_0x0bbd('0x34')]?_0x2c39a6['attributes']:_0x5cf8df[_0x0bbd('0x2e')];_0x2c39a6[_0x0bbd('0x4a')]=qs[_0x0bbd('0x35')](_0x436c9c[_0x0bbd('0x2f')][_0x0bbd('0x35')]);_0x2c39a6[_0x0bbd('0x36')]=qs['filters'](_['pick'](_0x436c9c[_0x0bbd('0x2f')],_0x5cf8df[_0x0bbd('0x30')]));if(_0x436c9c[_0x0bbd('0x2f')][_0x0bbd('0x38')]){_0x2c39a6[_0x0bbd('0x36')]=_['merge'](_0x2c39a6[_0x0bbd('0x36')],{'$or':_[_0x0bbd('0x28')](_0x2c39a6[_0x0bbd('0x32')],function(_0x53891f){var _0x294242={};_0x294242[_0x53891f]={'$like':'%'+_0x436c9c[_0x0bbd('0x2f')]['filter']+'%'};return _0x294242;})});}_0x2c39a6=_[_0x0bbd('0x39')]({},_0x2c39a6,_0x436c9c['options']);return _0x221ad5[_0x0bbd('0x4f')](_0x2c39a6);}})[_0x0bbd('0x3c')](function(_0x4eca2b){if(_0x4eca2b){_0xf31fcc=_0x4eca2b[_0x0bbd('0x34')];if(!_0x436c9c['query'][_0x0bbd('0x4c')](_0x0bbd('0x4d'))){_0x2c39a6[_0x0bbd('0x1d')]=qs[_0x0bbd('0x1d')](_0x436c9c['query']['limit']);_0x2c39a6[_0x0bbd('0x1c')]=qs[_0x0bbd('0x1c')](_0x436c9c[_0x0bbd('0x2f')][_0x0bbd('0x1c')]);}return _0x221ad5['getDescriptions'](_0x2c39a6);}})['then'](function(_0x95ce84){if(_0x95ce84){return _0x95ce84?{'count':_0xf31fcc,'rows':_0x95ce84}:null;}})[_0x0bbd('0x3c')](respondWithResult(_0x37bf0d,null))[_0x0bbd('0x41')](handleError(_0x37bf0d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4d102d6..2a8a3d1 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 _0xd702=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes'];(function(_0x5ee367,_0x5aff0b){var _0x145dde=function(_0x1a23d0){while(--_0x1a23d0){_0x5ee367['push'](_0x5ee367['shift']());}};_0x145dde(++_0x5aff0b);}(_0xd702,0x100));var _0x2d70=function(_0x29deb7,_0x286041){_0x29deb7=_0x29deb7-0x0;var _0x2e4d8f=_0xd702[_0x29deb7];return _0x2e4d8f;};'use strict';var _=require(_0x2d70('0x0'));var util=require(_0x2d70('0x1'));var logger=require('../../config/logger')(_0x2d70('0x2'));var moment=require(_0x2d70('0x3'));var BPromise=require(_0x2d70('0x4'));var rp=require(_0x2d70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d70('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d70('0x7'));module[_0x2d70('0x8')]=function(_0xa04372,_0x3bf7a6){return _0xa04372[_0x2d70('0x9')](_0x2d70('0xa'),attributes,{'tableName':_0x2d70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcad9=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3da3fc,_0x4edb8e){var _0x1a5c9b=function(_0xaaeb77){while(--_0xaaeb77){_0x3da3fc['push'](_0x3da3fc['shift']());}};_0x1a5c9b(++_0x4edb8e);}(_0xcad9,0x7b));var _0x9cad=function(_0x4a5211,_0x58bad5){_0x4a5211=_0x4a5211-0x0;var _0x598945=_0xcad9[_0x4a5211];return _0x598945;};'use strict';var _=require(_0x9cad('0x0'));var util=require(_0x9cad('0x1'));var logger=require(_0x9cad('0x2'))(_0x9cad('0x3'));var moment=require(_0x9cad('0x4'));var BPromise=require('bluebird');var rp=require(_0x9cad('0x5'));var fs=require('fs');var path=require(_0x9cad('0x6'));var rimraf=require(_0x9cad('0x7'));var config=require(_0x9cad('0x8'));var attributes=require(_0x9cad('0x9'));module[_0x9cad('0xa')]=function(_0x514543,_0xea850a){return _0x514543['define'](_0x9cad('0xb'),attributes,{'tableName':_0x9cad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index bbfb0ac..eb725c5 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 _0xdf1c=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x2d0b89,_0x14126c){var _0x38dcdf=function(_0x30a867){while(--_0x30a867){_0x2d0b89['push'](_0x2d0b89['shift']());}};_0x38dcdf(++_0x14126c);}(_0xdf1c,0xcc));var _0xcdf1=function(_0x40d798,_0x5d07cf){_0x40d798=_0x40d798-0x0;var _0x41d0e0=_0xdf1c[_0x40d798];return _0x41d0e0;};'use strict';var _=require(_0xcdf1('0x0'));var util=require('util');var moment=require(_0xcdf1('0x1'));var BPromise=require(_0xcdf1('0x2'));var rs=require(_0xcdf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcdf1('0x4'));var logger=require('../../config/logger')(_0xcdf1('0x5'));var config=require(_0xcdf1('0x6'));var jayson=require(_0xcdf1('0x7'));var client=jayson['client'][_0xcdf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x451dc5,_0x50c5d0,_0xe1d3ca){return new BPromise(function(_0x50cc42,_0x48b1f0){return client[_0xcdf1('0x9')](_0x451dc5,_0xe1d3ca)['then'](function(_0x530897){logger[_0xcdf1('0xa')](_0xcdf1('0xb'),_0x50c5d0,_0xcdf1('0xc'));logger[_0xcdf1('0xd')](_0xcdf1('0xe'),_0x50c5d0,'request\x20sent',JSON['stringify'](_0x530897));if(_0x530897[_0xcdf1('0xf')]){if(_0x530897[_0xcdf1('0xf')][_0xcdf1('0x10')]===0x1f4){logger['error'](_0xcdf1('0xb'),_0x50c5d0,_0x530897[_0xcdf1('0xf')][_0xcdf1('0x11')]);return _0x48b1f0(_0x530897['error'][_0xcdf1('0x11')]);}logger['error'](_0xcdf1('0xb'),_0x50c5d0,_0x530897[_0xcdf1('0xf')]['message']);return _0x50cc42(_0x530897[_0xcdf1('0xf')][_0xcdf1('0x11')]);}else{logger[_0xcdf1('0xa')](_0xcdf1('0xb'),_0x50c5d0,_0xcdf1('0xc'));_0x50cc42(_0x530897[_0xcdf1('0x12')][_0xcdf1('0x11')]);}})[_0xcdf1('0x13')](function(_0x56be2b){logger[_0xcdf1('0xf')](_0xcdf1('0xb'),_0x50c5d0,_0x56be2b);_0x48b1f0(_0x56be2b);});});} \ No newline at end of file +var _0xffd8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x777641,_0x19607d){var _0x54a378=function(_0x501b92){while(--_0x501b92){_0x777641['push'](_0x777641['shift']());}};_0x54a378(++_0x19607d);}(_0xffd8,0x176));var _0x8ffd=function(_0x159605,_0xe9e3f7){_0x159605=_0x159605-0x0;var _0x19a090=_0xffd8[_0x159605];return _0x19a090;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ffd('0x0'));var BPromise=require(_0x8ffd('0x1'));var rs=require(_0x8ffd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ffd('0x3'))['db'];var utils=require(_0x8ffd('0x4'));var logger=require(_0x8ffd('0x5'))(_0x8ffd('0x6'));var config=require('../../config/environment');var jayson=require(_0x8ffd('0x7'));var client=jayson[_0x8ffd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe55add,_0x5ea922,_0x53e584){return new BPromise(function(_0xd7ee51,_0x50c507){return client[_0x8ffd('0x9')](_0xe55add,_0x53e584)[_0x8ffd('0xa')](function(_0xba1479){logger[_0x8ffd('0xb')](_0x8ffd('0xc'),_0x5ea922,_0x8ffd('0xd'));logger[_0x8ffd('0xe')](_0x8ffd('0xf'),_0x5ea922,_0x8ffd('0xd'),JSON[_0x8ffd('0x10')](_0xba1479));if(_0xba1479['error']){if(_0xba1479[_0x8ffd('0x11')]['code']===0x1f4){logger[_0x8ffd('0x11')](_0x8ffd('0xc'),_0x5ea922,_0xba1479[_0x8ffd('0x11')][_0x8ffd('0x12')]);return _0x50c507(_0xba1479['error'][_0x8ffd('0x12')]);}logger[_0x8ffd('0x11')](_0x8ffd('0xc'),_0x5ea922,_0xba1479['error'][_0x8ffd('0x12')]);return _0xd7ee51(_0xba1479[_0x8ffd('0x11')]['message']);}else{logger[_0x8ffd('0xb')](_0x8ffd('0xc'),_0x5ea922,_0x8ffd('0xd'));_0xd7ee51(_0xba1479[_0x8ffd('0x13')]['message']);}})[_0x8ffd('0x14')](function(_0x576c53){logger[_0x8ffd('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5ea922,_0x576c53);_0x50c507(_0x576c53);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e8c3993..a74cdf9 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 _0x5a99=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','post','create','put','update'];(function(_0x397149,_0xb3d7dc){var _0xb42332=function(_0x2a54fd){while(--_0x2a54fd){_0x397149['push'](_0x397149['shift']());}};_0xb42332(++_0xb3d7dc);}(_0x5a99,0x1d2));var _0x95a9=function(_0x57c088,_0xc39721){_0x57c088=_0x57c088-0x0;var _0x59b5c3=_0x5a99[_0x57c088];return _0x59b5c3;};'use strict';var multer=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var path=require(_0x95a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x95a9('0x3'));var router=express[_0x95a9('0x4')]();var fs_extra=require(_0x95a9('0x5'));var auth=require(_0x95a9('0x6'));var interaction=require(_0x95a9('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x95a9('0x8')](),controller['index']);router['get'](_0x95a9('0x9'),auth[_0x95a9('0x8')](),controller['show']);router[_0x95a9('0xa')]('/',auth[_0x95a9('0x8')](),controller[_0x95a9('0xb')]);router[_0x95a9('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x95a9('0xd')]);router[_0x95a9('0xe')]('/:id',auth[_0x95a9('0x8')](),controller[_0x95a9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfcf9=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x1524e8,_0x5ea63a){var _0x39c66d=function(_0x316591){while(--_0x316591){_0x1524e8['push'](_0x1524e8['shift']());}};_0x39c66d(++_0x5ea63a);}(_0xfcf9,0xae));var _0x9fcf=function(_0x243825,_0x51b32b){_0x243825=_0x243825-0x0;var _0x35be29=_0xfcf9[_0x243825];return _0x35be29;};'use strict';var multer=require(_0x9fcf('0x0'));var util=require(_0x9fcf('0x1'));var path=require(_0x9fcf('0x2'));var timeout=require(_0x9fcf('0x3'));var express=require(_0x9fcf('0x4'));var router=express[_0x9fcf('0x5')]();var fs_extra=require(_0x9fcf('0x6'));var auth=require(_0x9fcf('0x7'));var interaction=require(_0x9fcf('0x8'));var config=require(_0x9fcf('0x9'));var controller=require(_0x9fcf('0xa'));router[_0x9fcf('0xb')]('/',auth[_0x9fcf('0xc')](),controller[_0x9fcf('0xd')]);router[_0x9fcf('0xb')](_0x9fcf('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9fcf('0xc')](),controller[_0x9fcf('0xf')]);router[_0x9fcf('0x10')](_0x9fcf('0xe'),auth['isAuthenticated'](),controller[_0x9fcf('0x11')]);router[_0x9fcf('0x12')](_0x9fcf('0xe'),auth[_0x9fcf('0xc')](),controller[_0x9fcf('0x13')]);module[_0x9fcf('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 759080b..94f8fdb 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 _0x1bc7=['STRING','customVariable','exports','ENUM','string','variable','picklist'];(function(_0x5bebb0,_0x44ba9c){var _0x233936=function(_0x124cce){while(--_0x124cce){_0x5bebb0['push'](_0x5bebb0['shift']());}};_0x233936(++_0x44ba9c);}(_0x1bc7,0x160));var _0x71bc=function(_0x3f0a3c,_0x5f4c63){_0x3f0a3c=_0x3f0a3c-0x0;var _0x5e8f6e=_0x1bc7[_0x3f0a3c];return _0x5e8f6e;};'use strict';var Sequelize=require('sequelize');module[_0x71bc('0x0')]={'type':{'type':Sequelize[_0x71bc('0x1')](_0x71bc('0x2'),_0x71bc('0x3'),'customVariable','keyValue',_0x71bc('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x71bc('0x5')]},'key':{'type':Sequelize[_0x71bc('0x5')]},'keyType':{'type':Sequelize[_0x71bc('0x1')](_0x71bc('0x2'),_0x71bc('0x3'),_0x71bc('0x6'))},'keyContent':{'type':Sequelize[_0x71bc('0x5')]},'idField':{'type':Sequelize[_0x71bc('0x5')]},'nameField':{'type':Sequelize[_0x71bc('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x885a=['exports','string','variable','customVariable','STRING','ENUM','BOOLEAN','sequelize'];(function(_0xd5f414,_0x3506ed){var _0x338877=function(_0x1acfff){while(--_0x1acfff){_0xd5f414['push'](_0xd5f414['shift']());}};_0x338877(++_0x3506ed);}(_0x885a,0xbf));var _0xa885=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x885a[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xa885('0x0'));module[_0xa885('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa885('0x2'),_0xa885('0x3'),_0xa885('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa885('0x5')]},'keyType':{'type':Sequelize[_0xa885('0x6')]('string',_0xa885('0x3'),_0xa885('0x4'))},'keyContent':{'type':Sequelize[_0xa885('0x5')]},'idField':{'type':Sequelize[_0xa885('0x5')]},'nameField':{'type':Sequelize[_0xa885('0x5')]},'customField':{'type':Sequelize[_0xa885('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5dae332..b41c096 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 _0x2fa8=['intersection','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','length','find','create','body','catch','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','attributes'];(function(_0x12ac2e,_0x57afe9){var _0x5b21b9=function(_0x1f655e){while(--_0x1f655e){_0x12ac2e['push'](_0x12ac2e['shift']());}};_0x5b21b9(++_0x57afe9);}(_0x2fa8,0x142));var _0x82fa=function(_0x3c864c,_0x4b8b7f){_0x3c864c=_0x3c864c-0x0;var _0xdfbb71=_0x2fa8[_0x3c864c];return _0xdfbb71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82fa('0x1'));var moment=require(_0x82fa('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x82fa('0x3'));var util=require('util');var path=require(_0x82fa('0x4'));var sox=require(_0x82fa('0x5'));var csv=require(_0x82fa('0x6'));var ejs=require(_0x82fa('0x7'));var fs=require('fs');var fs_extra=require(_0x82fa('0x8'));var _=require('lodash');var squel=require(_0x82fa('0x9'));var crypto=require(_0x82fa('0xa'));var jsforce=require(_0x82fa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x82fa('0x6'));var querystring=require(_0x82fa('0xc'));var Papa=require(_0x82fa('0xd'));var Redis=require(_0x82fa('0xe'));var authService=require(_0x82fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x82fa('0x10'));var hardwareService=require(_0x82fa('0x11'));var logger=require(_0x82fa('0x12'))(_0x82fa('0x13'));var utils=require(_0x82fa('0x14'));var config=require(_0x82fa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x82fa('0x16'))['db'];function respondWithStatusCode(_0x5ab6ab,_0xf6f5f6){_0xf6f5f6=_0xf6f5f6||0xcc;return function(_0x49af56){if(_0x49af56){return _0x5ab6ab[_0x82fa('0x17')](_0xf6f5f6);}return _0x5ab6ab[_0x82fa('0x18')](_0xf6f5f6)['end']();};}function respondWithResult(_0x15da61,_0x2a3467){_0x2a3467=_0x2a3467||0xc8;return function(_0x260ef8){if(_0x260ef8){return _0x15da61[_0x82fa('0x18')](_0x2a3467)[_0x82fa('0x19')](_0x260ef8);}};}function respondWithFilteredResult(_0x22d57d,_0x42dc96){return function(_0x4fee38){if(_0x4fee38){var _0xae94e2=typeof _0x42dc96[_0x82fa('0x1a')]===_0x82fa('0x1b')&&typeof _0x42dc96[_0x82fa('0x1c')]==='undefined';var _0x4d3453=_0x4fee38['count'];var _0x1c8327=_0xae94e2?0x0:_0x42dc96[_0x82fa('0x1a')];var _0x107d53=_0xae94e2?_0x4fee38[_0x82fa('0x1d')]:_0x42dc96['offset']+_0x42dc96[_0x82fa('0x1c')];var _0x23bcb5;if(_0x107d53>=_0x4d3453){_0x107d53=_0x4d3453;_0x23bcb5=0xc8;}else{_0x23bcb5=0xce;}_0x22d57d[_0x82fa('0x18')](_0x23bcb5);return _0x22d57d[_0x82fa('0x1e')](_0x82fa('0x1f'),_0x1c8327+'-'+_0x107d53+'/'+_0x4d3453)[_0x82fa('0x19')](_0x4fee38);}return null;};}function patchUpdates(_0x6747da){return function(_0x359d5c){try{jsonpatch[_0x82fa('0x20')](_0x359d5c,_0x6747da,!![]);}catch(_0x30b6fd){return BPromise[_0x82fa('0x21')](_0x30b6fd);}return _0x359d5c[_0x82fa('0x22')]();};}function saveUpdates(_0x33f423,_0x2ddc55){return function(_0x4274b5){if(_0x4274b5){return _0x4274b5[_0x82fa('0x23')](_0x33f423)[_0x82fa('0x24')](function(_0x312dc2){return _0x312dc2;});}return null;};}function removeEntity(_0x314600,_0x8669e9){return function(_0x102dab){if(_0x102dab){return _0x102dab[_0x82fa('0x25')]()[_0x82fa('0x24')](function(){_0x314600[_0x82fa('0x18')](0xcc)[_0x82fa('0x26')]();});}};}function handleEntityNotFound(_0x4300e9,_0x283d6b){return function(_0x1b2e1f){if(!_0x1b2e1f){_0x4300e9['sendStatus'](0x194);}return _0x1b2e1f;};}function handleError(_0x152fe9,_0x4bfd5b){_0x4bfd5b=_0x4bfd5b||0x1f4;return function(_0x25c2ef){logger[_0x82fa('0x27')](_0x25c2ef[_0x82fa('0x28')]);if(_0x25c2ef[_0x82fa('0x29')]){delete _0x25c2ef[_0x82fa('0x29')];}_0x152fe9[_0x82fa('0x18')](_0x4bfd5b)['send'](_0x25c2ef);};}exports[_0x82fa('0x2a')]=function(_0x3a305b,_0x923125){var _0xfe4274={},_0x50b468={},_0x5b078d={'count':0x0,'rows':[]};var _0x11de58=_[_0x82fa('0x2b')](db[_0x82fa('0x2c')][_0x82fa('0x2d')],function(_0x574d98){return{'name':_0x574d98[_0x82fa('0x2e')],'type':_0x574d98[_0x82fa('0x2f')][_0x82fa('0x30')]};});_0x50b468[_0x82fa('0x31')]=_[_0x82fa('0x2b')](_0x11de58,_0x82fa('0x29'));_0x50b468[_0x82fa('0x32')]=_[_0x82fa('0x33')](_0x3a305b['query']);_0x50b468['filters']=_['intersection'](_0x50b468[_0x82fa('0x31')],_0x50b468[_0x82fa('0x32')]);_0xfe4274[_0x82fa('0x34')]=_[_0x82fa('0x35')](_0x50b468['model'],qs['fields'](_0x3a305b[_0x82fa('0x32')]['fields']));_0xfe4274[_0x82fa('0x34')]=_0xfe4274[_0x82fa('0x34')]['length']?_0xfe4274[_0x82fa('0x34')]:_0x50b468[_0x82fa('0x31')];if(!_0x3a305b[_0x82fa('0x32')]['hasOwnProperty'](_0x82fa('0x36'))){_0xfe4274[_0x82fa('0x1c')]=qs[_0x82fa('0x1c')](_0x3a305b[_0x82fa('0x32')][_0x82fa('0x1c')]);_0xfe4274[_0x82fa('0x1a')]=qs[_0x82fa('0x1a')](_0x3a305b[_0x82fa('0x32')][_0x82fa('0x1a')]);}_0xfe4274[_0x82fa('0x37')]=qs['sort'](_0x3a305b[_0x82fa('0x32')][_0x82fa('0x38')]);_0xfe4274[_0x82fa('0x39')]=qs[_0x82fa('0x3a')](_[_0x82fa('0x3b')](_0x3a305b[_0x82fa('0x32')],_0x50b468[_0x82fa('0x3a')]),_0x11de58);if(_0x3a305b[_0x82fa('0x32')][_0x82fa('0x3c')]){_0xfe4274[_0x82fa('0x39')]=_[_0x82fa('0x3d')](_0xfe4274['where'],{'$or':_['map'](_0x11de58,function(_0x5c873e){if(_0x5c873e[_0x82fa('0x2f')]!==_0x82fa('0x3e')){var _0x32fba0={};_0x32fba0[_0x5c873e['name']]={'$like':'%'+_0x3a305b['query']['filter']+'%'};return _0x32fba0;}})});}_0xfe4274=_[_0x82fa('0x3d')]({},_0xfe4274,_0x3a305b[_0x82fa('0x3f')]);var _0x44856c={'where':_0xfe4274[_0x82fa('0x39')]};return db[_0x82fa('0x2c')][_0x82fa('0x1d')](_0x44856c)[_0x82fa('0x24')](function(_0x21972b){_0x5b078d[_0x82fa('0x1d')]=_0x21972b;if(_0x3a305b[_0x82fa('0x32')][_0x82fa('0x40')]){_0xfe4274[_0x82fa('0x41')]=[{'all':!![]}];}return db[_0x82fa('0x2c')][_0x82fa('0x42')](_0xfe4274);})['then'](function(_0x37ee41){_0x5b078d[_0x82fa('0x43')]=_0x37ee41;return _0x5b078d;})[_0x82fa('0x24')](respondWithFilteredResult(_0x923125,_0xfe4274))['catch'](handleError(_0x923125,null));};exports['show']=function(_0x151769,_0x3b4168){var _0x44290d={'raw':!![],'where':{'id':_0x151769[_0x82fa('0x44')]['id']}},_0x10479c={};_0x10479c[_0x82fa('0x31')]=_[_0x82fa('0x33')](db[_0x82fa('0x2c')][_0x82fa('0x2d')]);_0x10479c[_0x82fa('0x32')]=_[_0x82fa('0x33')](_0x151769[_0x82fa('0x32')]);_0x10479c['filters']=_[_0x82fa('0x35')](_0x10479c[_0x82fa('0x31')],_0x10479c[_0x82fa('0x32')]);_0x44290d[_0x82fa('0x34')]=_[_0x82fa('0x35')](_0x10479c[_0x82fa('0x31')],qs[_0x82fa('0x45')](_0x151769[_0x82fa('0x32')][_0x82fa('0x45')]));_0x44290d[_0x82fa('0x34')]=_0x44290d[_0x82fa('0x34')][_0x82fa('0x46')]?_0x44290d[_0x82fa('0x34')]:_0x10479c[_0x82fa('0x31')];if(_0x151769[_0x82fa('0x32')][_0x82fa('0x40')]){_0x44290d['include']=[{'all':!![]}];}_0x44290d=_[_0x82fa('0x3d')]({},_0x44290d,_0x151769[_0x82fa('0x3f')]);return db[_0x82fa('0x2c')][_0x82fa('0x47')](_0x44290d)[_0x82fa('0x24')](handleEntityNotFound(_0x3b4168,null))[_0x82fa('0x24')](respondWithResult(_0x3b4168,null))['catch'](handleError(_0x3b4168,null));};exports[_0x82fa('0x48')]=function(_0x14cf62,_0x2967a0){return db[_0x82fa('0x2c')][_0x82fa('0x48')](_0x14cf62[_0x82fa('0x49')],{})['then'](respondWithResult(_0x2967a0,0xc9))['catch'](handleError(_0x2967a0,null));};exports['update']=function(_0x18b463,_0x5f3654){if(_0x18b463[_0x82fa('0x49')]['id']){delete _0x18b463[_0x82fa('0x49')]['id'];}return db[_0x82fa('0x2c')][_0x82fa('0x47')]({'where':{'id':_0x18b463[_0x82fa('0x44')]['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x5f3654,null))[_0x82fa('0x24')](saveUpdates(_0x18b463[_0x82fa('0x49')],null))[_0x82fa('0x24')](respondWithResult(_0x5f3654,null))[_0x82fa('0x4a')](handleError(_0x5f3654,null));};exports[_0x82fa('0x25')]=function(_0xb8636d,_0x230b3e){return db[_0x82fa('0x2c')][_0x82fa('0x47')]({'where':{'id':_0xb8636d['params']['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x230b3e,null))[_0x82fa('0x24')](removeEntity(_0x230b3e,null))[_0x82fa('0x4a')](handleError(_0x230b3e,null));}; \ No newline at end of file +var _0xc13d=['body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','json','apply','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','limit','offset','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','params','keys','find','create'];(function(_0x5d8fa1,_0x48f172){var _0x53a280=function(_0x256d98){while(--_0x256d98){_0x5d8fa1['push'](_0x5d8fa1['shift']());}};_0x53a280(++_0x48f172);}(_0xc13d,0x15b));var _0xdc13=function(_0x1a54b7,_0x4a85a0){_0x1a54b7=_0x1a54b7-0x0;var _0x4fa654=_0xc13d[_0x1a54b7];return _0x4fa654;};'use strict';var emlformat=require(_0xdc13('0x0'));var rimraf=require(_0xdc13('0x1'));var zipdir=require(_0xdc13('0x2'));var jsonpatch=require(_0xdc13('0x3'));var rp=require(_0xdc13('0x4'));var moment=require('moment');var BPromise=require(_0xdc13('0x5'));var Mustache=require(_0xdc13('0x6'));var util=require(_0xdc13('0x7'));var path=require('path');var sox=require(_0xdc13('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc13('0x9'));var squel=require(_0xdc13('0xa'));var crypto=require(_0xdc13('0xb'));var jsforce=require(_0xdc13('0xc'));var deskjs=require(_0xdc13('0xd'));var toCsv=require(_0xdc13('0xe'));var querystring=require(_0xdc13('0xf'));var Papa=require(_0xdc13('0x10'));var Redis=require(_0xdc13('0x11'));var authService=require(_0xdc13('0x12'));var qs=require(_0xdc13('0x13'));var as=require(_0xdc13('0x14'));var hardwareService=require(_0xdc13('0x15'));var logger=require('../../config/logger')(_0xdc13('0x16'));var utils=require(_0xdc13('0x17'));var config=require(_0xdc13('0x18'));var licenseUtil=require(_0xdc13('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc40c01,_0x4bb030){_0x4bb030=_0x4bb030||0xcc;return function(_0x44e3b2){if(_0x44e3b2){return _0xc40c01[_0xdc13('0x1a')](_0x4bb030);}return _0xc40c01[_0xdc13('0x1b')](_0x4bb030)[_0xdc13('0x1c')]();};}function respondWithResult(_0x384ab4,_0x554da2){_0x554da2=_0x554da2||0xc8;return function(_0x524ed1){if(_0x524ed1){return _0x384ab4[_0xdc13('0x1b')](_0x554da2)['json'](_0x524ed1);}};}function respondWithFilteredResult(_0x207b25,_0x11d95c){return function(_0x133ab6){if(_0x133ab6){var _0x796a23=typeof _0x11d95c['offset']===_0xdc13('0x1d')&&typeof _0x11d95c['limit']==='undefined';var _0x580643=_0x133ab6[_0xdc13('0x1e')];var _0x54c628=_0x796a23?0x0:_0x11d95c['offset'];var _0x55535a=_0x796a23?_0x133ab6['count']:_0x11d95c['offset']+_0x11d95c['limit'];var _0xed943d;if(_0x55535a>=_0x580643){_0x55535a=_0x580643;_0xed943d=0xc8;}else{_0xed943d=0xce;}_0x207b25[_0xdc13('0x1b')](_0xed943d);return _0x207b25['set']('Content-Range',_0x54c628+'-'+_0x55535a+'/'+_0x580643)[_0xdc13('0x1f')](_0x133ab6);}return null;};}function patchUpdates(_0x470cc3){return function(_0x446dd1){try{jsonpatch[_0xdc13('0x20')](_0x446dd1,_0x470cc3,!![]);}catch(_0x50ffed){return BPromise['reject'](_0x50ffed);}return _0x446dd1['save']();};}function saveUpdates(_0x2b9804,_0x164ca4){return function(_0x2b3028){if(_0x2b3028){return _0x2b3028[_0xdc13('0x21')](_0x2b9804)[_0xdc13('0x22')](function(_0x4ee4a1){return _0x4ee4a1;});}return null;};}function removeEntity(_0x501daf,_0x330eea){return function(_0x867fbf){if(_0x867fbf){return _0x867fbf[_0xdc13('0x23')]()['then'](function(){_0x501daf[_0xdc13('0x1b')](0xcc)[_0xdc13('0x1c')]();});}};}function handleEntityNotFound(_0x15d449,_0x267c44){return function(_0x426f01){if(!_0x426f01){_0x15d449[_0xdc13('0x1a')](0x194);}return _0x426f01;};}function handleError(_0x168d4a,_0x3ce010){_0x3ce010=_0x3ce010||0x1f4;return function(_0xa28d76){logger[_0xdc13('0x24')](_0xa28d76[_0xdc13('0x25')]);if(_0xa28d76[_0xdc13('0x26')]){delete _0xa28d76[_0xdc13('0x26')];}_0x168d4a[_0xdc13('0x1b')](_0x3ce010)['send'](_0xa28d76);};}exports[_0xdc13('0x27')]=function(_0x30f707,_0x2f66c8){var _0xcd7436={},_0x4e467b={},_0x34fe04={'count':0x0,'rows':[]};var _0x327929=_['map'](db[_0xdc13('0x28')][_0xdc13('0x29')],function(_0x42006a){return{'name':_0x42006a['fieldName'],'type':_0x42006a[_0xdc13('0x2a')][_0xdc13('0x2b')]};});_0x4e467b[_0xdc13('0x2c')]=_['map'](_0x327929,_0xdc13('0x26'));_0x4e467b[_0xdc13('0x2d')]=_['keys'](_0x30f707['query']);_0x4e467b[_0xdc13('0x2e')]=_['intersection'](_0x4e467b[_0xdc13('0x2c')],_0x4e467b[_0xdc13('0x2d')]);_0xcd7436['attributes']=_[_0xdc13('0x2f')](_0x4e467b[_0xdc13('0x2c')],qs['fields'](_0x30f707[_0xdc13('0x2d')][_0xdc13('0x30')]));_0xcd7436[_0xdc13('0x31')]=_0xcd7436[_0xdc13('0x31')][_0xdc13('0x32')]?_0xcd7436[_0xdc13('0x31')]:_0x4e467b[_0xdc13('0x2c')];if(!_0x30f707[_0xdc13('0x2d')]['hasOwnProperty']('nolimit')){_0xcd7436['limit']=qs[_0xdc13('0x33')](_0x30f707[_0xdc13('0x2d')]['limit']);_0xcd7436['offset']=qs[_0xdc13('0x34')](_0x30f707[_0xdc13('0x2d')][_0xdc13('0x34')]);}_0xcd7436['order']=qs[_0xdc13('0x35')](_0x30f707[_0xdc13('0x2d')][_0xdc13('0x35')]);_0xcd7436[_0xdc13('0x36')]=qs[_0xdc13('0x2e')](_[_0xdc13('0x37')](_0x30f707['query'],_0x4e467b[_0xdc13('0x2e')]),_0x327929);if(_0x30f707[_0xdc13('0x2d')][_0xdc13('0x38')]){_0xcd7436[_0xdc13('0x36')]=_[_0xdc13('0x39')](_0xcd7436[_0xdc13('0x36')],{'$or':_[_0xdc13('0x3a')](_0x327929,function(_0x249ce2){if(_0x249ce2[_0xdc13('0x2a')]!==_0xdc13('0x3b')){var _0x295498={};_0x295498[_0x249ce2[_0xdc13('0x26')]]={'$like':'%'+_0x30f707[_0xdc13('0x2d')][_0xdc13('0x38')]+'%'};return _0x295498;}})});}_0xcd7436=_[_0xdc13('0x39')]({},_0xcd7436,_0x30f707[_0xdc13('0x3c')]);var _0x49096d={'where':_0xcd7436[_0xdc13('0x36')]};return db[_0xdc13('0x28')][_0xdc13('0x1e')](_0x49096d)[_0xdc13('0x22')](function(_0x1e4ea0){_0x34fe04[_0xdc13('0x1e')]=_0x1e4ea0;if(_0x30f707[_0xdc13('0x2d')][_0xdc13('0x3d')]){_0xcd7436['include']=[{'all':!![]}];}return db[_0xdc13('0x28')][_0xdc13('0x3e')](_0xcd7436);})[_0xdc13('0x22')](function(_0x5dfa60){_0x34fe04['rows']=_0x5dfa60;return _0x34fe04;})[_0xdc13('0x22')](respondWithFilteredResult(_0x2f66c8,_0xcd7436))['catch'](handleError(_0x2f66c8,null));};exports['show']=function(_0x41822c,_0x3f0aab){var _0x23bc07={'raw':!![],'where':{'id':_0x41822c[_0xdc13('0x3f')]['id']}},_0x9a77eb={};_0x9a77eb[_0xdc13('0x2c')]=_[_0xdc13('0x40')](db[_0xdc13('0x28')][_0xdc13('0x29')]);_0x9a77eb[_0xdc13('0x2d')]=_[_0xdc13('0x40')](_0x41822c[_0xdc13('0x2d')]);_0x9a77eb['filters']=_['intersection'](_0x9a77eb[_0xdc13('0x2c')],_0x9a77eb['query']);_0x23bc07[_0xdc13('0x31')]=_['intersection'](_0x9a77eb[_0xdc13('0x2c')],qs[_0xdc13('0x30')](_0x41822c['query'][_0xdc13('0x30')]));_0x23bc07[_0xdc13('0x31')]=_0x23bc07[_0xdc13('0x31')][_0xdc13('0x32')]?_0x23bc07[_0xdc13('0x31')]:_0x9a77eb[_0xdc13('0x2c')];if(_0x41822c[_0xdc13('0x2d')]['includeAll']){_0x23bc07['include']=[{'all':!![]}];}_0x23bc07=_['merge']({},_0x23bc07,_0x41822c[_0xdc13('0x3c')]);return db['VtigerField'][_0xdc13('0x41')](_0x23bc07)[_0xdc13('0x22')](handleEntityNotFound(_0x3f0aab,null))[_0xdc13('0x22')](respondWithResult(_0x3f0aab,null))['catch'](handleError(_0x3f0aab,null));};exports[_0xdc13('0x42')]=function(_0x5b24bb,_0x569f23){return db[_0xdc13('0x28')][_0xdc13('0x42')](_0x5b24bb[_0xdc13('0x43')],{})['then'](respondWithResult(_0x569f23,0xc9))['catch'](handleError(_0x569f23,null));};exports[_0xdc13('0x21')]=function(_0x1d353d,_0x2e98c7){if(_0x1d353d[_0xdc13('0x43')]['id']){delete _0x1d353d['body']['id'];}return db[_0xdc13('0x28')][_0xdc13('0x41')]({'where':{'id':_0x1d353d[_0xdc13('0x3f')]['id']}})[_0xdc13('0x22')](handleEntityNotFound(_0x2e98c7,null))[_0xdc13('0x22')](saveUpdates(_0x1d353d['body'],null))[_0xdc13('0x22')](respondWithResult(_0x2e98c7,null))['catch'](handleError(_0x2e98c7,null));};exports[_0xdc13('0x23')]=function(_0xf75cf1,_0x4b10ed){return db[_0xdc13('0x28')][_0xdc13('0x41')]({'where':{'id':_0xf75cf1['params']['id']}})[_0xdc13('0x22')](handleEntityNotFound(_0x4b10ed,null))['then'](removeEntity(_0x4b10ed,null))[_0xdc13('0x44')](handleError(_0x4b10ed,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 391a029..172d526 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 _0x3a66=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x3c0f09,_0x379235){var _0x28ced9=function(_0x1b41cf){while(--_0x1b41cf){_0x3c0f09['push'](_0x3c0f09['shift']());}};_0x28ced9(++_0x379235);}(_0x3a66,0x174));var _0x63a6=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x3a66[_0x214a25];return _0x405988;};'use strict';var _=require(_0x63a6('0x0'));var util=require(_0x63a6('0x1'));var logger=require(_0x63a6('0x2'))(_0x63a6('0x3'));var moment=require(_0x63a6('0x4'));var BPromise=require(_0x63a6('0x5'));var rp=require(_0x63a6('0x6'));var fs=require('fs');var path=require(_0x63a6('0x7'));var rimraf=require(_0x63a6('0x8'));var config=require(_0x63a6('0x9'));var attributes=require(_0x63a6('0xa'));module['exports']=function(_0x386c3b,_0x1b0ed4){return _0x386c3b[_0x63a6('0xb')](_0x63a6('0xc'),attributes,{'tableName':_0x63a6('0xd'),'paranoid':![],'indexes':[{'name':_0x63a6('0xe'),'fields':[_0x63a6('0xf'),_0x63a6('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2423=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','VtigerField'];(function(_0x35f3c3,_0x520c73){var _0x1781e7=function(_0x2dce24){while(--_0x2dce24){_0x35f3c3['push'](_0x35f3c3['shift']());}};_0x1781e7(++_0x520c73);}(_0x2423,0x1b7));var _0x3242=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2423[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3242('0x0'));var util=require(_0x3242('0x1'));var logger=require(_0x3242('0x2'))(_0x3242('0x3'));var moment=require(_0x3242('0x4'));var BPromise=require(_0x3242('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3242('0x6'));var rimraf=require('rimraf');var config=require(_0x3242('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x3242('0x8')]=function(_0x3826af,_0x314979){return _0x3826af[_0x3242('0x9')](_0x3242('0xa'),attributes,{'tableName':_0x3242('0xb'),'paranoid':![],'indexes':[{'name':_0x3242('0xc'),'fields':[_0x3242('0xd'),_0x3242('0xe')],'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 a7c9095..b1387c1 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 _0x5692=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x37d514,_0xa1701b){var _0x56349c=function(_0x14230b){while(--_0x14230b){_0x37d514['push'](_0x37d514['shift']());}};_0x56349c(++_0xa1701b);}(_0x5692,0x158));var _0x2569=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5692[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2569('0x0'));var util=require('util');var moment=require(_0x2569('0x1'));var BPromise=require(_0x2569('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2569('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2569('0x4'));var logger=require('../../config/logger')(_0x2569('0x5'));var config=require(_0x2569('0x6'));var jayson=require(_0x2569('0x7'));var client=jayson[_0x2569('0x8')][_0x2569('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x228124,_0x35114d,_0x4d4b57){return new BPromise(function(_0x452e15,_0x53505e){return client[_0x2569('0xa')](_0x228124,_0x4d4b57)[_0x2569('0xb')](function(_0x51a533){logger['info']('VtigerField,\x20%s,\x20%s',_0x35114d,'request\x20sent');logger[_0x2569('0xc')](_0x2569('0xd'),_0x35114d,'request\x20sent',JSON[_0x2569('0xe')](_0x51a533));if(_0x51a533[_0x2569('0xf')]){if(_0x51a533[_0x2569('0xf')][_0x2569('0x10')]===0x1f4){logger[_0x2569('0xf')](_0x2569('0x11'),_0x35114d,_0x51a533[_0x2569('0xf')][_0x2569('0x12')]);return _0x53505e(_0x51a533[_0x2569('0xf')][_0x2569('0x12')]);}logger[_0x2569('0xf')](_0x2569('0x11'),_0x35114d,_0x51a533[_0x2569('0xf')]['message']);return _0x452e15(_0x51a533[_0x2569('0xf')][_0x2569('0x12')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x35114d,_0x2569('0x13'));_0x452e15(_0x51a533['result'][_0x2569('0x12')]);}})[_0x2569('0x14')](function(_0x43b0fb){logger['error'](_0x2569('0x11'),_0x35114d,_0x43b0fb);_0x53505e(_0x43b0fb);});});} \ No newline at end of file +var _0x0592=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x31e810,_0x18f146){var _0x4e0760=function(_0x481724){while(--_0x481724){_0x31e810['push'](_0x31e810['shift']());}};_0x4e0760(++_0x18f146);}(_0x0592,0x18e));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2059('0x0'));var util=require(_0x2059('0x1'));var moment=require(_0x2059('0x2'));var BPromise=require(_0x2059('0x3'));var rs=require(_0x2059('0x4'));var fs=require('fs');var Redis=require(_0x2059('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2059('0x6'));var logger=require('../../config/logger')(_0x2059('0x7'));var config=require(_0x2059('0x8'));var jayson=require(_0x2059('0x9'));var client=jayson[_0x2059('0xa')][_0x2059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x71adbb,_0x2653a4,_0x58530f){return new BPromise(function(_0x5cf05b,_0x575ce1){return client[_0x2059('0xc')](_0x71adbb,_0x58530f)[_0x2059('0xd')](function(_0x27d51e){logger[_0x2059('0xe')](_0x2059('0xf'),_0x2653a4,_0x2059('0x10'));logger['debug'](_0x2059('0x11'),_0x2653a4,_0x2059('0x10'),JSON[_0x2059('0x12')](_0x27d51e));if(_0x27d51e[_0x2059('0x13')]){if(_0x27d51e[_0x2059('0x13')][_0x2059('0x14')]===0x1f4){logger[_0x2059('0x13')]('VtigerField,\x20%s,\x20%s',_0x2653a4,_0x27d51e['error'][_0x2059('0x15')]);return _0x575ce1(_0x27d51e[_0x2059('0x13')][_0x2059('0x15')]);}logger[_0x2059('0x13')](_0x2059('0xf'),_0x2653a4,_0x27d51e['error'][_0x2059('0x15')]);return _0x5cf05b(_0x27d51e[_0x2059('0x13')][_0x2059('0x15')]);}else{logger[_0x2059('0xe')](_0x2059('0xf'),_0x2653a4,_0x2059('0x10'));_0x5cf05b(_0x27d51e[_0x2059('0x16')][_0x2059('0x15')]);}})[_0x2059('0x17')](function(_0x525353){logger['error'](_0x2059('0xf'),_0x2653a4,_0x525353);_0x575ce1(_0x525353);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 18ca3e2..1ae5544 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 _0xf8c8=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x50dcff,_0x3d80fe){var _0x1e1861=function(_0x395c74){while(--_0x395c74){_0x50dcff['push'](_0x50dcff['shift']());}};_0x1e1861(++_0x3d80fe);}(_0xf8c8,0x118));var _0x8f8c=function(_0x1cbd12,_0x576c7f){_0x1cbd12=_0x1cbd12-0x0;var _0xaa0bd6=_0xf8c8[_0x1cbd12];return _0xaa0bd6;};'use strict';var multer=require(_0x8f8c('0x0'));var util=require(_0x8f8c('0x1'));var path=require('path');var timeout=require(_0x8f8c('0x2'));var express=require(_0x8f8c('0x3'));var router=express['Router']();var fs_extra=require(_0x8f8c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f8c('0x5'));var config=require(_0x8f8c('0x6'));var controller=require(_0x8f8c('0x7'));router[_0x8f8c('0x8')]('/',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8f8c('0xb')]);router[_0x8f8c('0x8')](_0x8f8c('0xc'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xd')]);router[_0x8f8c('0x8')](_0x8f8c('0xe'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xf')]);router[_0x8f8c('0x10')]('/',auth['isAuthenticated'](),controller[_0x8f8c('0x11')]);router[_0x8f8c('0x10')](_0x8f8c('0xc'),auth['isAuthenticated'](),controller[_0x8f8c('0x12')]);router[_0x8f8c('0x13')](_0x8f8c('0x14'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x15')]);router[_0x8f8c('0x16')]('/:id',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x17')]);module[_0x8f8c('0x18')]=router; \ No newline at end of file +var _0x6500=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x419549,_0x455526){var _0x1eb427=function(_0x40cf2f){while(--_0x40cf2f){_0x419549['push'](_0x419549['shift']());}};_0x1eb427(++_0x455526);}(_0x6500,0x13b));var _0x0650=function(_0x34cad9,_0xe4d7c5){_0x34cad9=_0x34cad9-0x0;var _0x421786=_0x6500[_0x34cad9];return _0x421786;};'use strict';var multer=require('multer');var util=require(_0x0650('0x0'));var path=require(_0x0650('0x1'));var timeout=require(_0x0650('0x2'));var express=require('express');var router=express[_0x0650('0x3')]();var fs_extra=require(_0x0650('0x4'));var auth=require(_0x0650('0x5'));var interaction=require(_0x0650('0x6'));var config=require(_0x0650('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x0650('0x8')]('/',auth[_0x0650('0x9')](),controller['index']);router[_0x0650('0x8')](_0x0650('0xa'),auth[_0x0650('0x9')](),controller[_0x0650('0xb')]);router[_0x0650('0x8')]('/:id/configurations',auth[_0x0650('0x9')](),controller['getConfigurations']);router[_0x0650('0x8')](_0x0650('0xc'),auth[_0x0650('0x9')](),controller['getFields']);router[_0x0650('0xd')]('/',auth[_0x0650('0x9')](),controller[_0x0650('0xe')]);router[_0x0650('0xd')](_0x0650('0xf'),auth['isAuthenticated'](),controller[_0x0650('0x10')]);router['put'](_0x0650('0xa'),auth[_0x0650('0x9')](),controller['update']);router[_0x0650('0x11')]('/:id',auth[_0x0650('0x9')](),controller[_0x0650('0x12')]);module[_0x0650('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 986f6e5..827794b 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 _0xcedf=['STRING','username','remoteUri','password','ENUM','integrationTab','sequelize','exports'];(function(_0x403454,_0x4688ad){var _0x535214=function(_0x11b380){while(--_0x11b380){_0x403454['push'](_0x403454['shift']());}};_0x535214(++_0x4688ad);}(_0xcedf,0x1b6));var _0xfced=function(_0x4b1b19,_0x39b595){_0x4b1b19=_0x4b1b19-0x0;var _0x3de67d=_0xcedf[_0x4b1b19];return _0x3de67d;};'use strict';var Sequelize=require(_0xfced('0x0'));module[_0xfced('0x1')]={'name':{'type':Sequelize[_0xfced('0x2')]},'description':{'type':Sequelize[_0xfced('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xfced('0x3')},'password':{'type':Sequelize[_0xfced('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfced('0x4')},'authType':{'type':Sequelize['ENUM'](_0xfced('0x5'),'token'),'defaultValue':_0xfced('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfced('0x6')]('integrationTab','newTab'),'defaultValue':_0xfced('0x7')}}; \ No newline at end of file +var _0xdb8b=['ENUM','password','integrationTab','newTab','exports','STRING','remoteUri'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x5bd54e,_0x46621f){_0x5bd54e=_0x5bd54e-0x0;var _0x276fa7=_0xdb8b[_0x5bd54e];return _0x276fa7;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'name':{'type':Sequelize[_0xbdb8('0x1')]},'description':{'type':Sequelize[_0xbdb8('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xbdb8('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbdb8('0x1')],'unique':_0xbdb8('0x2')},'authType':{'type':Sequelize[_0xbdb8('0x3')](_0xbdb8('0x4'),'token'),'defaultValue':_0xbdb8('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbdb8('0x3')](_0xbdb8('0x5'),_0xbdb8('0x6')),'defaultValue':_0xbdb8('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2ba0726..400c69b 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 _0x04b8=['lodash','squel','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','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x11d610,_0x33a30b){var _0x529e47=function(_0x14e926){while(--_0x14e926){_0x11d610['push'](_0x11d610['shift']());}};_0x529e47(++_0x33a30b);}(_0x04b8,0x159));var _0x804b=function(_0x55311c,_0x4c6a2d){_0x55311c=_0x55311c-0x0;var _0x220908=_0x04b8[_0x55311c];return _0x220908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file +var _0x3266=['crypto','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','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','merge','options','create','body','find','params','destroy','findOne','ZendeskConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','username','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','test','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x3cff39,_0xc4335){var _0x3507f3=function(_0xcf58fd){while(--_0xcf58fd){_0x3cff39['push'](_0x3cff39['shift']());}};_0x3507f3(++_0xc4335);}(_0x3266,0x6a));var _0x6326=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x3266[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];var integrations=require(_0x6326('0x1c'));function respondWithStatusCode(_0x5c07e1,_0x5381d0){_0x5381d0=_0x5381d0||0xcc;return function(_0x301f34){if(_0x301f34){return _0x5c07e1[_0x6326('0x1d')](_0x5381d0);}return _0x5c07e1['status'](_0x5381d0)[_0x6326('0x1e')]();};}function respondWithResult(_0x4caef3,_0x2d2d9b){_0x2d2d9b=_0x2d2d9b||0xc8;return function(_0x20dcc6){if(_0x20dcc6){return _0x4caef3[_0x6326('0x1f')](_0x2d2d9b)[_0x6326('0x20')](_0x20dcc6);}};}function respondWithFilteredResult(_0x1ed3a3,_0x2c1879){return function(_0x55923a){if(_0x55923a){var _0x1104c5=typeof _0x2c1879['offset']==='undefined'&&typeof _0x2c1879['limit']==='undefined';var _0x5d402d=_0x55923a['count'];var _0xdf5ced=_0x1104c5?0x0:_0x2c1879[_0x6326('0x21')];var _0x2be78e=_0x1104c5?_0x55923a['count']:_0x2c1879['offset']+_0x2c1879[_0x6326('0x22')];var _0x42319c;if(_0x2be78e>=_0x5d402d){_0x2be78e=_0x5d402d;_0x42319c=0xc8;}else{_0x42319c=0xce;}_0x1ed3a3[_0x6326('0x1f')](_0x42319c);return _0x1ed3a3[_0x6326('0x23')](_0x6326('0x24'),_0xdf5ced+'-'+_0x2be78e+'/'+_0x5d402d)[_0x6326('0x20')](_0x55923a);}return null;};}function patchUpdates(_0x21ee7d){return function(_0x53b437){try{jsonpatch[_0x6326('0x25')](_0x53b437,_0x21ee7d,!![]);}catch(_0x549f07){return BPromise[_0x6326('0x26')](_0x549f07);}return _0x53b437[_0x6326('0x27')]();};}function saveUpdates(_0x2482ef,_0x24fb78){return function(_0x43cdfc){if(_0x43cdfc){return _0x43cdfc[_0x6326('0x28')](_0x2482ef)[_0x6326('0x29')](function(_0x429bb0){return _0x429bb0;});}return null;};}function removeEntity(_0x4781cc,_0x2d0d00){return function(_0x34954b){if(_0x34954b){return _0x34954b['destroy']()[_0x6326('0x29')](function(){_0x4781cc[_0x6326('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e272b,_0x4d28fd){return function(_0x405474){if(!_0x405474){_0x4e272b['sendStatus'](0x194);}return _0x405474;};}function handleError(_0x33c466,_0x1a48da){_0x1a48da=_0x1a48da||0x1f4;return function(_0x5a907f){logger[_0x6326('0x2a')](_0x5a907f[_0x6326('0x2b')]);if(_0x5a907f[_0x6326('0x2c')]){delete _0x5a907f[_0x6326('0x2c')];}_0x33c466[_0x6326('0x1f')](_0x1a48da)[_0x6326('0x2d')](_0x5a907f);};}exports[_0x6326('0x2e')]=function(_0x27802c,_0x461e0f){var _0x127744={},_0x4980f6={},_0x2a8873={'count':0x0,'rows':[]};var _0x331772=_[_0x6326('0x2f')](db[_0x6326('0x30')][_0x6326('0x31')],function(_0x520e57){return{'name':_0x520e57[_0x6326('0x32')],'type':_0x520e57[_0x6326('0x33')][_0x6326('0x34')]};});_0x4980f6['model']=_[_0x6326('0x2f')](_0x331772,'name');_0x4980f6['query']=_[_0x6326('0x35')](_0x27802c[_0x6326('0x36')]);_0x4980f6[_0x6326('0x37')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],_0x4980f6[_0x6326('0x36')]);_0x127744[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x27802c[_0x6326('0x36')][_0x6326('0x3b')]));_0x127744['attributes']=_0x127744[_0x6326('0x3a')][_0x6326('0x3c')]?_0x127744['attributes']:_0x4980f6[_0x6326('0x39')];if(!_0x27802c[_0x6326('0x36')][_0x6326('0x3d')]('nolimit')){_0x127744[_0x6326('0x22')]=qs['limit'](_0x27802c['query'][_0x6326('0x22')]);_0x127744[_0x6326('0x21')]=qs[_0x6326('0x21')](_0x27802c['query'][_0x6326('0x21')]);}_0x127744['order']=qs[_0x6326('0x3e')](_0x27802c['query'][_0x6326('0x3e')]);_0x127744[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0x27802c[_0x6326('0x36')],_0x4980f6[_0x6326('0x37')]),_0x331772);if(_0x27802c['query'][_0x6326('0x41')]){_0x127744[_0x6326('0x3f')]=_['merge'](_0x127744[_0x6326('0x3f')],{'$or':_['map'](_0x331772,function(_0x5607ea){if(_0x5607ea[_0x6326('0x33')]!==_0x6326('0x42')){var _0x3c170b={};_0x3c170b[_0x5607ea[_0x6326('0x2c')]]={'$like':'%'+_0x27802c[_0x6326('0x36')][_0x6326('0x41')]+'%'};return _0x3c170b;}})});}_0x127744=_['merge']({},_0x127744,_0x27802c['options']);var _0x32886f={'where':_0x127744['where']};return db[_0x6326('0x30')]['count'](_0x32886f)[_0x6326('0x29')](function(_0x517f6b){_0x2a8873[_0x6326('0x43')]=_0x517f6b;if(_0x27802c[_0x6326('0x36')][_0x6326('0x44')]){_0x127744[_0x6326('0x45')]=[{'all':!![]}];}return db[_0x6326('0x30')][_0x6326('0x46')](_0x127744);})[_0x6326('0x29')](function(_0x3998ba){_0x2a8873[_0x6326('0x47')]=_0x3998ba;return _0x2a8873;})['then'](respondWithFilteredResult(_0x461e0f,_0x127744))[_0x6326('0x48')](handleError(_0x461e0f,null));};exports['show']=function(_0x29f2fd,_0x1d9d4c){var _0x16fc33={'raw':![],'where':{'id':_0x29f2fd['params']['id']}},_0x50582a={};_0x50582a[_0x6326('0x39')]=_[_0x6326('0x35')](db['ZendeskAccount'][_0x6326('0x31')]);_0x50582a[_0x6326('0x36')]=_[_0x6326('0x35')](_0x29f2fd[_0x6326('0x36')]);_0x50582a['filters']=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],_0x50582a[_0x6326('0x36')]);_0x16fc33[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x29f2fd['query'][_0x6326('0x3b')]));_0x16fc33[_0x6326('0x3a')]=_0x16fc33[_0x6326('0x3a')][_0x6326('0x3c')]?_0x16fc33['attributes']:_0x50582a[_0x6326('0x39')];if(_0x29f2fd['query'][_0x6326('0x44')]){_0x16fc33[_0x6326('0x45')]=[{'all':!![]}];}_0x16fc33=_[_0x6326('0x49')]({},_0x16fc33,_0x29f2fd[_0x6326('0x4a')]);return db[_0x6326('0x30')]['find'](_0x16fc33)[_0x6326('0x29')](handleEntityNotFound(_0x1d9d4c,null))['then'](respondWithResult(_0x1d9d4c,null))['catch'](handleError(_0x1d9d4c,null));};exports[_0x6326('0x4b')]=function(_0x44cf9d,_0x5b14f4){return db[_0x6326('0x30')][_0x6326('0x4b')](_0x44cf9d[_0x6326('0x4c')],{})[_0x6326('0x29')](respondWithResult(_0x5b14f4,0xc9))[_0x6326('0x48')](handleError(_0x5b14f4,null));};exports['update']=function(_0x4af0ee,_0x2d82c0){if(_0x4af0ee[_0x6326('0x4c')]['id']){delete _0x4af0ee[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x4d')]({'where':{'id':_0x4af0ee[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x2d82c0,null))['then'](saveUpdates(_0x4af0ee[_0x6326('0x4c')],null))[_0x6326('0x29')](respondWithResult(_0x2d82c0,null))[_0x6326('0x48')](handleError(_0x2d82c0,null));};exports[_0x6326('0x4f')]=function(_0x1b5e9a,_0x4ff8e6){return db[_0x6326('0x30')]['find']({'where':{'id':_0x1b5e9a[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x4ff8e6,null))['then'](removeEntity(_0x4ff8e6,null))[_0x6326('0x48')](handleError(_0x4ff8e6,null));};exports['getConfigurations']=function(_0xaa4c9d,_0x202fd3,_0x2ee8df){var _0x35400e={};var _0x58731d={};var _0x42c8bc;var _0xbe6b3e;return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0xaa4c9d[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x202fd3,null))['then'](function(_0x2bece1){if(_0x2bece1){_0x42c8bc=_0x2bece1;_0x58731d[_0x6326('0x39')]=_['keys'](db[_0x6326('0x51')]['rawAttributes']);_0x58731d[_0x6326('0x36')]=_[_0x6326('0x35')](_0xaa4c9d[_0x6326('0x36')]);_0x58731d[_0x6326('0x37')]=_[_0x6326('0x38')](_0x58731d[_0x6326('0x39')],_0x58731d[_0x6326('0x36')]);_0x35400e['attributes']=_['intersection'](_0x58731d['model'],qs[_0x6326('0x3b')](_0xaa4c9d['query'][_0x6326('0x3b')]));_0x35400e[_0x6326('0x3a')]=_0x35400e[_0x6326('0x3a')][_0x6326('0x3c')]?_0x35400e[_0x6326('0x3a')]:_0x58731d['model'];_0x35400e[_0x6326('0x52')]=qs[_0x6326('0x3e')](_0xaa4c9d['query'][_0x6326('0x3e')]);_0x35400e[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0xaa4c9d[_0x6326('0x36')],_0x58731d[_0x6326('0x37')]));if(_0xaa4c9d[_0x6326('0x36')][_0x6326('0x41')]){_0x35400e[_0x6326('0x3f')]=_[_0x6326('0x49')](_0x35400e['where'],{'$or':_[_0x6326('0x2f')](_0x35400e[_0x6326('0x3a')],function(_0x3fc712){var _0x92f535={};_0x92f535[_0x3fc712]={'$like':'%'+_0xaa4c9d['query']['filter']+'%'};return _0x92f535;})});}_0x35400e=_[_0x6326('0x49')]({},_0x35400e,_0xaa4c9d[_0x6326('0x4a')]);return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})[_0x6326('0x29')](function(_0x3ac39d){if(_0x3ac39d){_0xbe6b3e=_0x3ac39d['length'];if(!_0xaa4c9d['query'][_0x6326('0x3d')](_0x6326('0x54'))){_0x35400e[_0x6326('0x22')]=qs[_0x6326('0x22')](_0xaa4c9d['query'][_0x6326('0x22')]);_0x35400e[_0x6326('0x21')]=qs[_0x6326('0x21')](_0xaa4c9d[_0x6326('0x36')][_0x6326('0x21')]);}return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})['then'](function(_0x2bc08a){if(_0x2bc08a){return _0x2bc08a?{'count':_0xbe6b3e,'rows':_0x2bc08a}:null;}})['then'](respondWithResult(_0x202fd3,null))[_0x6326('0x48')](handleError(_0x202fd3,null));};exports[_0x6326('0x55')]=function(_0x57dfde,_0x14d66c,_0x56fb58){if(_0x57dfde[_0x6326('0x4c')]['id']){delete _0x57dfde[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x50')]({'where':{'id':_0x57dfde[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x14d66c,null))[_0x6326('0x29')](function(_0x3f5e2e){if(_0x3f5e2e){_0x57dfde['body'][_0x6326('0x56')]=_0x3f5e2e['id'];_0x57dfde[_0x6326('0x4c')][_0x6326('0x57')]=integrations[_0x6326('0x58')](_0x57dfde[_0x6326('0x4c')]['channel'],_0x57dfde[_0x6326('0x4c')][_0x6326('0x33')]);_0x57dfde[_0x6326('0x4c')][_0x6326('0x59')]=integrations[_0x6326('0x5a')](_0x57dfde['body'][_0x6326('0x5b')],_0x57dfde['body']['type']);return db[_0x6326('0x51')][_0x6326('0x4b')](_0x57dfde[_0x6326('0x4c')],{'include':[{'model':db[_0x6326('0x5c')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x14d66c,null))[_0x6326('0x48')](handleError(_0x14d66c,null));};exports['getFields']=function(_0x303fef,_0x5f6273,_0x54730e){var _0x4c1d7e='';return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0x303fef['params']['id']},'attributes':['id',_0x6326('0x5d'),'password','token','authType','remoteUri']})[_0x6326('0x29')](handleEntityNotFound(_0x5f6273,null))['then'](function(_0xe2e249){if(_0xe2e249){_0x4c1d7e=_0xe2e249[_0x6326('0x5e')];var _0x50a1dc=_0x4c1d7e[_0x6326('0x5f')](-0x1);if(_0x50a1dc==='/'){_0x4c1d7e=_0x4c1d7e['substring'](0x0,_0x4c1d7e[_0x6326('0x60')](_0x50a1dc));}var _0x1dda23={'method':_0x6326('0x61'),'uri':util[_0x6326('0x62')](_0x6326('0x63'),_0x4c1d7e,_0x6326('0x64')),'json':!![]};switch(_0xe2e249[_0x6326('0x65')]){case _0x6326('0x66'):_0x1dda23[_0x6326('0x67')]={'Authorization':util[_0x6326('0x62')](_0x6326('0x68'),new Buffer(util[_0x6326('0x62')](_0x6326('0x69'),_0xe2e249[_0x6326('0x5d')],_0xe2e249[_0x6326('0x66')]))[_0x6326('0x6a')](_0x6326('0x6b')))};break;case'token':_0x1dda23['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6326('0x62')]('%s/token:%s',_0xe2e249['username'],_0xe2e249['token']))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x6326('0x6c'))](_0x6326('0x6d'));}return rp(_0x1dda23);}})['then'](function(_0x3b4bca){if(_0x3b4bca){var _0x2bfc43=[_0x6326('0x6e'),'description',_0x6326('0x6f'),_0x6326('0x70')];_[_0x6326('0x71')](_0x3b4bca[_0x6326('0x64')],function(_0x3e9477){return _0x2bfc43['includes'](_0x3e9477[_0x6326('0x33')]);});return{'count':_0x3b4bca['ticket_fields']['length'],'rows':_[_0x6326('0x2f')](_0x3b4bca['ticket_fields'],function(_0x57c845){return{'id':_0x57c845['id'],'name':_0x57c845['position']>0x7?_0x57c845['title']:_0x57c845['type'],'custom':_0x57c845['position']>0x7?!![]:![],'options':_0x57c845['system_field_options']?_0x57c845[_0x6326('0x72')]:_0x57c845[_0x6326('0x73')]?_0x57c845[_0x6326('0x73')]:[]};})};}})[_0x6326('0x29')](respondWithResult(_0x5f6273,null))['catch'](function(_0x484866){var _0x4b61c4=_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?0x1f4:_0x484866['statusCode']||0x1f4;logger[_0x6326('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4b61c4,JSON[_0x6326('0x75')](_0x484866));delete _0x484866[_0x6326('0x2c')];if(_0x4b61c4===0x191){_0x4b61c4=0x190;}_0x5f6273[_0x6326('0x1f')](_0x4b61c4)[_0x6326('0x2d')](_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?{'message':_0x6326('0x76'),'statusCode':_0x484866['statusCode']}:_0x484866);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 98fee17..e57dede 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 _0x9798=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x42c35f,_0x57ca0a){var _0x178b1c=function(_0x1e7c6d){while(--_0x1e7c6d){_0x42c35f['push'](_0x42c35f['shift']());}};_0x178b1c(++_0x57ca0a);}(_0x9798,0xff));var _0x8979=function(_0x3faa39,_0x51bc03){_0x3faa39=_0x3faa39-0x0;var _0x4821f4=_0x9798[_0x3faa39];return _0x4821f4;};'use strict';var _=require(_0x8979('0x0'));var util=require(_0x8979('0x1'));var logger=require(_0x8979('0x2'))(_0x8979('0x3'));var moment=require(_0x8979('0x4'));var BPromise=require(_0x8979('0x5'));var rp=require(_0x8979('0x6'));var fs=require('fs');var path=require(_0x8979('0x7'));var rimraf=require(_0x8979('0x8'));var config=require('../../config/environment');var attributes=require(_0x8979('0x9'));var integrations=require(_0x8979('0xa'));module[_0x8979('0xb')]=function(_0x118934,_0x15771b){return _0x118934['define'](_0x8979('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8949=['request-promise','path','../../components/integrations/configuration','exports','define','lodash','../../config/logger','bluebird'];(function(_0x33b8df,_0x2dc79a){var _0xa9e675=function(_0x45c285){while(--_0x45c285){_0x33b8df['push'](_0x33b8df['shift']());}};_0xa9e675(++_0x2dc79a);}(_0x8949,0x15d));var _0x9894=function(_0x2e5bb6,_0x4a569b){_0x2e5bb6=_0x2e5bb6-0x0;var _0xdae9ed=_0x8949[_0x2e5bb6];return _0xdae9ed;};'use strict';var _=require(_0x9894('0x0'));var util=require('util');var logger=require(_0x9894('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9894('0x2'));var rp=require(_0x9894('0x3'));var fs=require('fs');var path=require(_0x9894('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x9894('0x5'));module[_0x9894('0x6')]=function(_0x571a81,_0xeee487){return _0x571a81[_0x9894('0x7')]('ZendeskAccount',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 919d16d..7e49955 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 _0x8f77=['info','result','catch','ZendeskAccount','options','raw','where','attributes','limit','map','include','model','then','GetZendeskAccount','ShowZendeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x243155,_0x5ad66d){var _0x4e05a1=function(_0x400098){while(--_0x400098){_0x243155['push'](_0x243155['shift']());}};_0x4e05a1(++_0x5ad66d);}(_0x8f77,0x98));var _0x78f7=function(_0x39d7ce,_0x4317a9){_0x39d7ce=_0x39d7ce-0x0;var _0x13010f=_0x8f77[_0x39d7ce];return _0x13010f;};'use strict';var _=require(_0x78f7('0x0'));var util=require('util');var moment=require(_0x78f7('0x1'));var BPromise=require(_0x78f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f7('0x3'));var db=require(_0x78f7('0x4'))['db'];var utils=require(_0x78f7('0x5'));var logger=require(_0x78f7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78f7('0x7'));var client=jayson['client'][_0x78f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x405b41,_0x224869,_0x5e2863){return new BPromise(function(_0x38457b,_0x25ee5d){return client[_0x78f7('0x9')](_0x405b41,_0x5e2863)['then'](function(_0x5b0f65){logger['info'](_0x78f7('0xa'),_0x224869,_0x78f7('0xb'));logger[_0x78f7('0xc')](_0x78f7('0xd'),_0x224869,_0x78f7('0xb'),JSON[_0x78f7('0xe')](_0x5b0f65));if(_0x5b0f65[_0x78f7('0xf')]){if(_0x5b0f65[_0x78f7('0xf')][_0x78f7('0x10')]===0x1f4){logger[_0x78f7('0xf')](_0x78f7('0xa'),_0x224869,_0x5b0f65[_0x78f7('0xf')][_0x78f7('0x11')]);return _0x25ee5d(_0x5b0f65[_0x78f7('0xf')][_0x78f7('0x11')]);}logger[_0x78f7('0xf')](_0x78f7('0xa'),_0x224869,_0x5b0f65[_0x78f7('0xf')][_0x78f7('0x11')]);return _0x38457b(_0x5b0f65[_0x78f7('0xf')]['message']);}else{logger[_0x78f7('0x12')](_0x78f7('0xa'),_0x224869,'request\x20sent');_0x38457b(_0x5b0f65[_0x78f7('0x13')][_0x78f7('0x11')]);}})[_0x78f7('0x14')](function(_0x2645fb){logger[_0x78f7('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x224869,_0x2645fb);_0x25ee5d(_0x2645fb);});});}exports['GetZendeskAccount']=function(_0xba187d){var _0x50e01c=this;return new Promise(function(_0x407f40,_0x518809){return db[_0x78f7('0x15')]['findAll']({'raw':_0xba187d[_0x78f7('0x16')]?_0xba187d['options'][_0x78f7('0x17')]===undefined?!![]:![]:!![],'where':_0xba187d['options']?_0xba187d[_0x78f7('0x16')][_0x78f7('0x18')]||null:null,'attributes':_0xba187d[_0x78f7('0x16')]?_0xba187d[_0x78f7('0x16')][_0x78f7('0x19')]||null:null,'limit':_0xba187d[_0x78f7('0x16')]?_0xba187d[_0x78f7('0x16')][_0x78f7('0x1a')]||null:null,'include':_0xba187d[_0x78f7('0x16')]?_0xba187d['options']['include']?_[_0x78f7('0x1b')](_0xba187d[_0x78f7('0x16')]['include'],function(_0x27d7f8){return{'model':db[_0x27d7f8['model']],'as':_0x27d7f8['as'],'attributes':_0x27d7f8[_0x78f7('0x19')],'include':_0x27d7f8['include']?_[_0x78f7('0x1b')](_0x27d7f8[_0x78f7('0x1c')],function(_0x10d2f0){return{'model':db[_0x10d2f0['model']],'as':_0x10d2f0['as'],'attributes':_0x10d2f0['attributes'],'include':_0x10d2f0[_0x78f7('0x1c')]?_['map'](_0x10d2f0[_0x78f7('0x1c')],function(_0x54976e){return{'model':db[_0x54976e[_0x78f7('0x1d')]],'as':_0x54976e['as'],'attributes':_0x54976e[_0x78f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x78f7('0x1e')](function(_0x3c905c){logger[_0x78f7('0x12')]('GetZendeskAccount',_0xba187d);logger['debug'](_0x78f7('0x1f'),_0xba187d,JSON[_0x78f7('0xe')](_0x3c905c));_0x407f40(_0x3c905c);})[_0x78f7('0x14')](function(_0x59762b){logger[_0x78f7('0xf')](_0x78f7('0x1f'),_0x59762b[_0x78f7('0x11')],_0xba187d);_0x518809(_0x50e01c[_0x78f7('0xf')](0x1f4,_0x59762b['message']));});});};exports[_0x78f7('0x20')]=function(_0x2a0fbb){var _0x24bef4=this;return new Promise(function(_0x566055,_0x14f84f){return db[_0x78f7('0x15')][_0x78f7('0x21')]({'raw':_0x2a0fbb['options']?_0x2a0fbb[_0x78f7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a0fbb[_0x78f7('0x16')]?_0x2a0fbb[_0x78f7('0x16')][_0x78f7('0x18')]||null:null,'attributes':_0x2a0fbb[_0x78f7('0x16')]?_0x2a0fbb[_0x78f7('0x16')]['attributes']||null:null,'include':_0x2a0fbb[_0x78f7('0x16')]?_0x2a0fbb['options'][_0x78f7('0x1c')]?_[_0x78f7('0x1b')](_0x2a0fbb['options'][_0x78f7('0x1c')],function(_0x41a509){return{'model':db[_0x41a509[_0x78f7('0x1d')]],'as':_0x41a509['as'],'attributes':_0x41a509[_0x78f7('0x19')],'include':_0x41a509[_0x78f7('0x1c')]?_[_0x78f7('0x1b')](_0x41a509['include'],function(_0x11bfcc){return{'model':db[_0x11bfcc[_0x78f7('0x1d')]],'as':_0x11bfcc['as'],'attributes':_0x11bfcc[_0x78f7('0x19')],'include':_0x11bfcc['include']?_['map'](_0x11bfcc[_0x78f7('0x1c')],function(_0x491147){return{'model':db[_0x491147[_0x78f7('0x1d')]],'as':_0x491147['as'],'attributes':_0x491147[_0x78f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x78f7('0x1e')](function(_0x547f78){logger['info']('ShowZendeskAccount',_0x2a0fbb);logger[_0x78f7('0xc')](_0x78f7('0x20'),_0x2a0fbb,JSON['stringify'](_0x547f78));_0x566055(_0x547f78);})['catch'](function(_0x651ad7){logger[_0x78f7('0xf')](_0x78f7('0x20'),_0x651ad7['message'],_0x2a0fbb);_0x14f84f(_0x24bef4[_0x78f7('0xf')](0x1f4,_0x651ad7[_0x78f7('0x11')]));});});}; \ No newline at end of file +var _0x8e84=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','limit','include','model','attributes','map','stringify','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x4aa68d,_0x525f62){var _0x32781c=function(_0x427f36){while(--_0x427f36){_0x4aa68d['push'](_0x4aa68d['shift']());}};_0x32781c(++_0x525f62);}(_0x8e84,0x195));var _0x48e8=function(_0x205d34,_0x399b03){_0x205d34=_0x205d34-0x0;var _0x57af30=_0x8e84[_0x205d34];return _0x57af30;};'use strict';var _=require(_0x48e8('0x0'));var util=require(_0x48e8('0x1'));var moment=require(_0x48e8('0x2'));var BPromise=require(_0x48e8('0x3'));var rs=require(_0x48e8('0x4'));var fs=require('fs');var Redis=require(_0x48e8('0x5'));var db=require(_0x48e8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x48e8('0x7'))(_0x48e8('0x8'));var config=require(_0x48e8('0x9'));var jayson=require(_0x48e8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d51fa,_0x356d9a,_0x260cee){return new BPromise(function(_0x46f122,_0x38935e){return client[_0x48e8('0xb')](_0x4d51fa,_0x260cee)[_0x48e8('0xc')](function(_0x540142){logger[_0x48e8('0xd')](_0x48e8('0xe'),_0x356d9a,'request\x20sent');logger[_0x48e8('0xf')](_0x48e8('0x10'),_0x356d9a,_0x48e8('0x11'),JSON['stringify'](_0x540142));if(_0x540142['error']){if(_0x540142[_0x48e8('0x12')][_0x48e8('0x13')]===0x1f4){logger[_0x48e8('0x12')](_0x48e8('0xe'),_0x356d9a,_0x540142[_0x48e8('0x12')]['message']);return _0x38935e(_0x540142[_0x48e8('0x12')][_0x48e8('0x14')]);}logger[_0x48e8('0x12')](_0x48e8('0xe'),_0x356d9a,_0x540142[_0x48e8('0x12')][_0x48e8('0x14')]);return _0x46f122(_0x540142['error'][_0x48e8('0x14')]);}else{logger[_0x48e8('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x356d9a,_0x48e8('0x11'));_0x46f122(_0x540142[_0x48e8('0x15')][_0x48e8('0x14')]);}})[_0x48e8('0x16')](function(_0x16a482){logger[_0x48e8('0x12')](_0x48e8('0xe'),_0x356d9a,_0x16a482);_0x38935e(_0x16a482);});});}exports[_0x48e8('0x17')]=function(_0x14c487){var _0x4672b2=this;return new Promise(function(_0x3c17c2,_0x5c2a1d){return db[_0x48e8('0x18')]['findAll']({'raw':_0x14c487[_0x48e8('0x19')]?_0x14c487['options'][_0x48e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x14c487[_0x48e8('0x19')]?_0x14c487['options']['where']||null:null,'attributes':_0x14c487[_0x48e8('0x19')]?_0x14c487[_0x48e8('0x19')]['attributes']||null:null,'limit':_0x14c487['options']?_0x14c487[_0x48e8('0x19')][_0x48e8('0x1b')]||null:null,'include':_0x14c487[_0x48e8('0x19')]?_0x14c487[_0x48e8('0x19')][_0x48e8('0x1c')]?_['map'](_0x14c487[_0x48e8('0x19')][_0x48e8('0x1c')],function(_0x299e5d){return{'model':db[_0x299e5d[_0x48e8('0x1d')]],'as':_0x299e5d['as'],'attributes':_0x299e5d[_0x48e8('0x1e')],'include':_0x299e5d[_0x48e8('0x1c')]?_['map'](_0x299e5d[_0x48e8('0x1c')],function(_0x6f83d6){return{'model':db[_0x6f83d6[_0x48e8('0x1d')]],'as':_0x6f83d6['as'],'attributes':_0x6f83d6['attributes'],'include':_0x6f83d6[_0x48e8('0x1c')]?_[_0x48e8('0x1f')](_0x6f83d6[_0x48e8('0x1c')],function(_0x2167b9){return{'model':db[_0x2167b9['model']],'as':_0x2167b9['as'],'attributes':_0x2167b9[_0x48e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x48e8('0xc')](function(_0x235896){logger[_0x48e8('0xd')](_0x48e8('0x17'),_0x14c487);logger[_0x48e8('0xf')](_0x48e8('0x17'),_0x14c487,JSON[_0x48e8('0x20')](_0x235896));_0x3c17c2(_0x235896);})[_0x48e8('0x16')](function(_0x5e1ce7){logger[_0x48e8('0x12')](_0x48e8('0x17'),_0x5e1ce7['message'],_0x14c487);_0x5c2a1d(_0x4672b2[_0x48e8('0x12')](0x1f4,_0x5e1ce7[_0x48e8('0x14')]));});});};exports[_0x48e8('0x21')]=function(_0x4f37be){var _0x470177=this;return new Promise(function(_0x4040b5,_0x12b388){return db[_0x48e8('0x18')][_0x48e8('0x22')]({'raw':_0x4f37be[_0x48e8('0x19')]?_0x4f37be[_0x48e8('0x19')][_0x48e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f37be[_0x48e8('0x19')]?_0x4f37be[_0x48e8('0x19')]['where']||null:null,'attributes':_0x4f37be['options']?_0x4f37be[_0x48e8('0x19')][_0x48e8('0x1e')]||null:null,'include':_0x4f37be[_0x48e8('0x19')]?_0x4f37be['options']['include']?_['map'](_0x4f37be[_0x48e8('0x19')]['include'],function(_0x254b2c){return{'model':db[_0x254b2c['model']],'as':_0x254b2c['as'],'attributes':_0x254b2c[_0x48e8('0x1e')],'include':_0x254b2c[_0x48e8('0x1c')]?_[_0x48e8('0x1f')](_0x254b2c[_0x48e8('0x1c')],function(_0x391de5){return{'model':db[_0x391de5['model']],'as':_0x391de5['as'],'attributes':_0x391de5['attributes'],'include':_0x391de5[_0x48e8('0x1c')]?_[_0x48e8('0x1f')](_0x391de5[_0x48e8('0x1c')],function(_0x45038c){return{'model':db[_0x45038c[_0x48e8('0x1d')]],'as':_0x45038c['as'],'attributes':_0x45038c[_0x48e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x48e8('0xc')](function(_0x3b53e2){logger[_0x48e8('0xd')](_0x48e8('0x21'),_0x4f37be);logger[_0x48e8('0xf')](_0x48e8('0x21'),_0x4f37be,JSON['stringify'](_0x3b53e2));_0x4040b5(_0x3b53e2);})[_0x48e8('0x16')](function(_0x43558c){logger['error']('ShowZendeskAccount',_0x43558c[_0x48e8('0x14')],_0x4f37be);_0x12b388(_0x470177[_0x48e8('0x12')](0x1f4,_0x43558c[_0x48e8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 18847b1..170b090 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0xb688,0xcf));var _0x8b68=function(_0x144d90,_0xb56d47){_0x144d90=_0x144d90-0x0;var _0x35587d=_0xb688[_0x144d90];return _0x35587d;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=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(_0x163f48,_0x128fbd){var _0x5bc066=function(_0x58de89){while(--_0x58de89){_0x163f48['push'](_0x163f48['shift']());}};_0x5bc066(++_0x128fbd);}(_0x757a,0xde));var _0xa757=function(_0x3893b9,_0x4daa70){_0x3893b9=_0x3893b9-0x0;var _0x27c24a=_0x757a[_0x3893b9];return _0x27c24a;};'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 b11077f..1503727 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 _0xdf68=['sequelize','exports','STRING'];(function(_0x25efb1,_0x34fa50){var _0x59d64d=function(_0x491192){while(--_0x491192){_0x25efb1['push'](_0x25efb1['shift']());}};_0x59d64d(++_0x34fa50);}(_0xdf68,0xc0));var _0x8df6=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xdf68[_0x3da707];return _0x342ee7;};'use strict';var Sequelize=require(_0x8df6('0x0'));module[_0x8df6('0x1')]={'name':{'type':Sequelize[_0x8df6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf0e=['exports','STRING'];(function(_0x49506d,_0x15eae1){var _0x34fadb=function(_0x40014d){while(--_0x40014d){_0x49506d['push'](_0x49506d['shift']());}};_0x34fadb(++_0x15eae1);}(_0xbf0e,0xa8));var _0xebf0=function(_0x352921,_0x53c2c5){_0x352921=_0x352921-0x0;var _0x38d629=_0xbf0e[_0x352921];return _0x38d629;};'use strict';var Sequelize=require('sequelize');module[_0xebf0('0x0')]={'name':{'type':Sequelize[_0xebf0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8197035..8b6cad5 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 _0x01c8=['getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','ZendeskField','getFields','findOne','getSubjects','getDescriptions','Tag'];(function(_0x388ac9,_0x32a4fa){var _0x4cd151=function(_0x503ad4){while(--_0x503ad4){_0x388ac9['push'](_0x388ac9['shift']());}};_0x4cd151(++_0x32a4fa);}(_0x01c8,0x153));var _0x801c=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x01c8[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x801c('0x0'));var jsonpatch=require(_0x801c('0x1'));var rp=require(_0x801c('0x2'));var moment=require('moment');var BPromise=require(_0x801c('0x3'));var Mustache=require(_0x801c('0x4'));var util=require(_0x801c('0x5'));var path=require(_0x801c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x801c('0x7'));var fs=require('fs');var fs_extra=require(_0x801c('0x8'));var _=require(_0x801c('0x9'));var squel=require(_0x801c('0xa'));var crypto=require('crypto');var jsforce=require(_0x801c('0xb'));var deskjs=require(_0x801c('0xc'));var toCsv=require(_0x801c('0xd'));var querystring=require(_0x801c('0xe'));var Papa=require('papaparse');var Redis=require(_0x801c('0xf'));var authService=require(_0x801c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x801c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x801c('0x12'))(_0x801c('0x13'));var utils=require(_0x801c('0x14'));var config=require(_0x801c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x801c('0x16'))['db'];function respondWithStatusCode(_0x2647d3,_0x3988fe){_0x3988fe=_0x3988fe||0xcc;return function(_0x113edb){if(_0x113edb){return _0x2647d3[_0x801c('0x17')](_0x3988fe);}return _0x2647d3[_0x801c('0x18')](_0x3988fe)['end']();};}function respondWithResult(_0x23d91e,_0xa76d32){_0xa76d32=_0xa76d32||0xc8;return function(_0x3b8f61){if(_0x3b8f61){return _0x23d91e[_0x801c('0x18')](_0xa76d32)[_0x801c('0x19')](_0x3b8f61);}};}function respondWithFilteredResult(_0x19ff68,_0x3c2366){return function(_0x9142ac){if(_0x9142ac){var _0x15aa34=typeof _0x3c2366[_0x801c('0x1a')]===_0x801c('0x1b')&&typeof _0x3c2366[_0x801c('0x1c')]==='undefined';var _0x403227=_0x9142ac[_0x801c('0x1d')];var _0x58f149=_0x15aa34?0x0:_0x3c2366[_0x801c('0x1a')];var _0x73149f=_0x15aa34?_0x9142ac[_0x801c('0x1d')]:_0x3c2366[_0x801c('0x1a')]+_0x3c2366['limit'];var _0x8510be;if(_0x73149f>=_0x403227){_0x73149f=_0x403227;_0x8510be=0xc8;}else{_0x8510be=0xce;}_0x19ff68[_0x801c('0x18')](_0x8510be);return _0x19ff68['set']('Content-Range',_0x58f149+'-'+_0x73149f+'/'+_0x403227)[_0x801c('0x19')](_0x9142ac);}return null;};}function patchUpdates(_0x47af8e){return function(_0xf3648e){try{jsonpatch[_0x801c('0x1e')](_0xf3648e,_0x47af8e,!![]);}catch(_0x46aa4f){return BPromise[_0x801c('0x1f')](_0x46aa4f);}return _0xf3648e[_0x801c('0x20')]();};}function saveUpdates(_0x3eb3dc,_0x2bf659){return function(_0x493887){if(_0x493887){return _0x493887[_0x801c('0x21')](_0x3eb3dc)['then'](function(_0x236ceb){return _0x236ceb;});}return null;};}function removeEntity(_0x21a144,_0x55e7b4){return function(_0x1a517b){if(_0x1a517b){return _0x1a517b[_0x801c('0x22')]()[_0x801c('0x23')](function(){_0x21a144['status'](0xcc)[_0x801c('0x24')]();});}};}function handleEntityNotFound(_0x235397,_0x29bead){return function(_0xe6620d){if(!_0xe6620d){_0x235397[_0x801c('0x17')](0x194);}return _0xe6620d;};}function handleError(_0x3c99bc,_0xf79c9a){_0xf79c9a=_0xf79c9a||0x1f4;return function(_0x462efb){logger[_0x801c('0x25')](_0x462efb[_0x801c('0x26')]);if(_0x462efb[_0x801c('0x27')]){delete _0x462efb['name'];}_0x3c99bc[_0x801c('0x18')](_0xf79c9a)[_0x801c('0x28')](_0x462efb);};}exports[_0x801c('0x29')]=function(_0x6f1165,_0x2441ac){var _0x5d7d7d={},_0x182060={},_0x5dbefe={'count':0x0,'rows':[]};var _0x447ee2=_['map'](db[_0x801c('0x2a')][_0x801c('0x2b')],function(_0x313b3c){return{'name':_0x313b3c['fieldName'],'type':_0x313b3c[_0x801c('0x2c')][_0x801c('0x2d')]};});_0x182060[_0x801c('0x2e')]=_[_0x801c('0x2f')](_0x447ee2,'name');_0x182060[_0x801c('0x30')]=_[_0x801c('0x31')](_0x6f1165[_0x801c('0x30')]);_0x182060['filters']=_[_0x801c('0x32')](_0x182060[_0x801c('0x2e')],_0x182060[_0x801c('0x30')]);_0x5d7d7d[_0x801c('0x33')]=_['intersection'](_0x182060[_0x801c('0x2e')],qs[_0x801c('0x34')](_0x6f1165[_0x801c('0x30')][_0x801c('0x34')]));_0x5d7d7d[_0x801c('0x33')]=_0x5d7d7d[_0x801c('0x33')][_0x801c('0x35')]?_0x5d7d7d[_0x801c('0x33')]:_0x182060[_0x801c('0x2e')];if(!_0x6f1165['query'][_0x801c('0x36')](_0x801c('0x37'))){_0x5d7d7d[_0x801c('0x1c')]=qs[_0x801c('0x1c')](_0x6f1165[_0x801c('0x30')]['limit']);_0x5d7d7d['offset']=qs[_0x801c('0x1a')](_0x6f1165['query']['offset']);}_0x5d7d7d[_0x801c('0x38')]=qs[_0x801c('0x39')](_0x6f1165[_0x801c('0x30')][_0x801c('0x39')]);_0x5d7d7d['where']=qs['filters'](_[_0x801c('0x3a')](_0x6f1165['query'],_0x182060[_0x801c('0x3b')]),_0x447ee2);if(_0x6f1165[_0x801c('0x30')][_0x801c('0x3c')]){_0x5d7d7d[_0x801c('0x3d')]=_[_0x801c('0x3e')](_0x5d7d7d[_0x801c('0x3d')],{'$or':_['map'](_0x447ee2,function(_0x54101e){if(_0x54101e[_0x801c('0x2c')]!==_0x801c('0x3f')){var _0x4aa16d={};_0x4aa16d[_0x54101e[_0x801c('0x27')]]={'$like':'%'+_0x6f1165[_0x801c('0x30')][_0x801c('0x3c')]+'%'};return _0x4aa16d;}})});}_0x5d7d7d=_[_0x801c('0x3e')]({},_0x5d7d7d,_0x6f1165[_0x801c('0x40')]);var _0x248e87={'where':_0x5d7d7d[_0x801c('0x3d')]};return db['ZendeskConfiguration'][_0x801c('0x1d')](_0x248e87)[_0x801c('0x23')](function(_0x430b15){_0x5dbefe[_0x801c('0x1d')]=_0x430b15;if(_0x6f1165[_0x801c('0x30')][_0x801c('0x41')]){_0x5d7d7d['include']=[{'all':!![]}];}return db[_0x801c('0x2a')][_0x801c('0x42')](_0x5d7d7d);})[_0x801c('0x23')](function(_0x4b718b){_0x5dbefe[_0x801c('0x43')]=_0x4b718b;return _0x5dbefe;})[_0x801c('0x23')](respondWithFilteredResult(_0x2441ac,_0x5d7d7d))[_0x801c('0x44')](handleError(_0x2441ac,null));};exports[_0x801c('0x45')]=function(_0x5528d3,_0x2c292b){var _0x360f67={'raw':![],'where':{'id':_0x5528d3[_0x801c('0x46')]['id']}},_0x3f16bc={};_0x3f16bc[_0x801c('0x2e')]=_[_0x801c('0x31')](db[_0x801c('0x2a')][_0x801c('0x2b')]);_0x3f16bc[_0x801c('0x30')]=_[_0x801c('0x31')](_0x5528d3['query']);_0x3f16bc[_0x801c('0x3b')]=_[_0x801c('0x32')](_0x3f16bc[_0x801c('0x2e')],_0x3f16bc[_0x801c('0x30')]);_0x360f67[_0x801c('0x33')]=_[_0x801c('0x32')](_0x3f16bc[_0x801c('0x2e')],qs[_0x801c('0x34')](_0x5528d3['query'][_0x801c('0x34')]));_0x360f67['attributes']=_0x360f67[_0x801c('0x33')][_0x801c('0x35')]?_0x360f67[_0x801c('0x33')]:_0x3f16bc['model'];if(_0x5528d3[_0x801c('0x30')][_0x801c('0x41')]){_0x360f67[_0x801c('0x47')]=[{'all':!![]}];}_0x360f67=_['merge']({},_0x360f67,_0x5528d3[_0x801c('0x40')]);return db[_0x801c('0x2a')]['find'](_0x360f67)[_0x801c('0x23')](handleEntityNotFound(_0x2c292b,null))[_0x801c('0x23')](respondWithResult(_0x2c292b,null))[_0x801c('0x44')](handleError(_0x2c292b,null));};exports[_0x801c('0x48')]=function(_0x4cff2c,_0x10b99b){return db[_0x801c('0x2a')][_0x801c('0x48')](_0x4cff2c[_0x801c('0x49')],{})[_0x801c('0x23')](respondWithResult(_0x10b99b,0xc9))[_0x801c('0x44')](handleError(_0x10b99b,null));};exports[_0x801c('0x21')]=function(_0x40130d,_0x5a53db){if(_0x40130d[_0x801c('0x49')]['id']){delete _0x40130d[_0x801c('0x49')]['id'];}return db['ZendeskConfiguration'][_0x801c('0x4a')]({'where':{'id':_0x40130d[_0x801c('0x46')]['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x5a53db,null))[_0x801c('0x23')](saveUpdates(_0x40130d[_0x801c('0x49')],null))[_0x801c('0x23')](respondWithResult(_0x5a53db,null))['catch'](handleError(_0x5a53db,null));};exports[_0x801c('0x22')]=function(_0x3ae93d,_0x370aa9){return db[_0x801c('0x2a')][_0x801c('0x4a')]({'where':{'id':_0x3ae93d[_0x801c('0x46')]['id']}})['then'](handleEntityNotFound(_0x370aa9,null))['then'](removeEntity(_0x370aa9,null))['catch'](handleError(_0x370aa9,null));};exports['getFields']=function(_0x5456e0,_0x4071b1,_0x1d168a){var _0x54bf23={};var _0x2790e5={};var _0x2118c1;var _0x2a8db9;return db[_0x801c('0x2a')]['findOne']({'where':{'id':_0x5456e0['params']['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x4071b1,null))[_0x801c('0x23')](function(_0x378aeb){if(_0x378aeb){_0x2118c1=_0x378aeb;_0x2790e5['model']=_[_0x801c('0x31')](db[_0x801c('0x4b')][_0x801c('0x2b')]);_0x2790e5[_0x801c('0x30')]=_['keys'](_0x5456e0[_0x801c('0x30')]);_0x2790e5[_0x801c('0x3b')]=_['intersection'](_0x2790e5[_0x801c('0x2e')],_0x2790e5[_0x801c('0x30')]);_0x54bf23[_0x801c('0x33')]=_[_0x801c('0x32')](_0x2790e5[_0x801c('0x2e')],qs[_0x801c('0x34')](_0x5456e0[_0x801c('0x30')][_0x801c('0x34')]));_0x54bf23[_0x801c('0x33')]=_0x54bf23[_0x801c('0x33')][_0x801c('0x35')]?_0x54bf23[_0x801c('0x33')]:_0x2790e5[_0x801c('0x2e')];_0x54bf23['order']=qs[_0x801c('0x39')](_0x5456e0[_0x801c('0x30')]['sort']);_0x54bf23[_0x801c('0x3d')]=qs[_0x801c('0x3b')](_[_0x801c('0x3a')](_0x5456e0[_0x801c('0x30')],_0x2790e5[_0x801c('0x3b')]));if(_0x5456e0[_0x801c('0x30')][_0x801c('0x3c')]){_0x54bf23[_0x801c('0x3d')]=_['merge'](_0x54bf23[_0x801c('0x3d')],{'$or':_[_0x801c('0x2f')](_0x54bf23[_0x801c('0x33')],function(_0x31972d){var _0x3882d6={};_0x3882d6[_0x31972d]={'$like':'%'+_0x5456e0[_0x801c('0x30')][_0x801c('0x3c')]+'%'};return _0x3882d6;})});}_0x54bf23=_[_0x801c('0x3e')]({},_0x54bf23,_0x5456e0[_0x801c('0x40')]);return _0x2118c1['getFields'](_0x54bf23);}})[_0x801c('0x23')](function(_0x3e5e7e){if(_0x3e5e7e){_0x2a8db9=_0x3e5e7e[_0x801c('0x35')];if(!_0x5456e0['query'][_0x801c('0x36')](_0x801c('0x37'))){_0x54bf23[_0x801c('0x1c')]=qs['limit'](_0x5456e0[_0x801c('0x30')]['limit']);_0x54bf23[_0x801c('0x1a')]=qs[_0x801c('0x1a')](_0x5456e0['query']['offset']);}return _0x2118c1[_0x801c('0x4c')](_0x54bf23);}})[_0x801c('0x23')](function(_0x1722ca){if(_0x1722ca){return _0x1722ca?{'count':_0x2a8db9,'rows':_0x1722ca}:null;}})[_0x801c('0x23')](respondWithResult(_0x4071b1,null))[_0x801c('0x44')](handleError(_0x4071b1,null));};exports['getSubjects']=function(_0x55161f,_0x339b83,_0x321078){var _0x22766b={};var _0x1db070={};var _0x54124a;var _0x29c1f9;return db[_0x801c('0x2a')][_0x801c('0x4d')]({'where':{'id':_0x55161f[_0x801c('0x46')]['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x339b83,null))['then'](function(_0x3c58cb){if(_0x3c58cb){_0x54124a=_0x3c58cb;_0x1db070[_0x801c('0x2e')]=_[_0x801c('0x31')](db[_0x801c('0x4b')][_0x801c('0x2b')]);_0x1db070[_0x801c('0x30')]=_[_0x801c('0x31')](_0x55161f[_0x801c('0x30')]);_0x1db070[_0x801c('0x3b')]=_[_0x801c('0x32')](_0x1db070[_0x801c('0x2e')],_0x1db070[_0x801c('0x30')]);_0x22766b[_0x801c('0x33')]=_[_0x801c('0x32')](_0x1db070[_0x801c('0x2e')],qs[_0x801c('0x34')](_0x55161f[_0x801c('0x30')][_0x801c('0x34')]));_0x22766b['attributes']=_0x22766b[_0x801c('0x33')][_0x801c('0x35')]?_0x22766b[_0x801c('0x33')]:_0x1db070['model'];_0x22766b[_0x801c('0x38')]=qs[_0x801c('0x39')](_0x55161f['query']['sort']);_0x22766b[_0x801c('0x3d')]=qs['filters'](_[_0x801c('0x3a')](_0x55161f[_0x801c('0x30')],_0x1db070['filters']));if(_0x55161f[_0x801c('0x30')][_0x801c('0x3c')]){_0x22766b[_0x801c('0x3d')]=_[_0x801c('0x3e')](_0x22766b['where'],{'$or':_[_0x801c('0x2f')](_0x22766b[_0x801c('0x33')],function(_0x4e5186){var _0x378186={};_0x378186[_0x4e5186]={'$like':'%'+_0x55161f[_0x801c('0x30')]['filter']+'%'};return _0x378186;})});}_0x22766b=_['merge']({},_0x22766b,_0x55161f[_0x801c('0x40')]);return _0x54124a[_0x801c('0x4e')](_0x22766b);}})[_0x801c('0x23')](function(_0x3a6d2b){if(_0x3a6d2b){_0x29c1f9=_0x3a6d2b[_0x801c('0x35')];if(!_0x55161f['query']['hasOwnProperty'](_0x801c('0x37'))){_0x22766b[_0x801c('0x1c')]=qs[_0x801c('0x1c')](_0x55161f[_0x801c('0x30')][_0x801c('0x1c')]);_0x22766b[_0x801c('0x1a')]=qs[_0x801c('0x1a')](_0x55161f[_0x801c('0x30')][_0x801c('0x1a')]);}return _0x54124a[_0x801c('0x4e')](_0x22766b);}})[_0x801c('0x23')](function(_0x50582c){if(_0x50582c){return _0x50582c?{'count':_0x29c1f9,'rows':_0x50582c}:null;}})[_0x801c('0x23')](respondWithResult(_0x339b83,null))[_0x801c('0x44')](handleError(_0x339b83,null));};exports['getDescriptions']=function(_0x3763e9,_0x3713a5,_0x43b34a){var _0x51af08={};var _0x397194={};var _0x45c629;var _0x22db3d;return db[_0x801c('0x2a')][_0x801c('0x4d')]({'where':{'id':_0x3763e9[_0x801c('0x46')]['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x3713a5,null))[_0x801c('0x23')](function(_0x46a672){if(_0x46a672){_0x45c629=_0x46a672;_0x397194[_0x801c('0x2e')]=_[_0x801c('0x31')](db[_0x801c('0x4b')][_0x801c('0x2b')]);_0x397194['query']=_['keys'](_0x3763e9[_0x801c('0x30')]);_0x397194[_0x801c('0x3b')]=_[_0x801c('0x32')](_0x397194['model'],_0x397194[_0x801c('0x30')]);_0x51af08['attributes']=_[_0x801c('0x32')](_0x397194[_0x801c('0x2e')],qs['fields'](_0x3763e9[_0x801c('0x30')][_0x801c('0x34')]));_0x51af08[_0x801c('0x33')]=_0x51af08[_0x801c('0x33')][_0x801c('0x35')]?_0x51af08['attributes']:_0x397194[_0x801c('0x2e')];_0x51af08[_0x801c('0x38')]=qs[_0x801c('0x39')](_0x3763e9[_0x801c('0x30')][_0x801c('0x39')]);_0x51af08['where']=qs['filters'](_[_0x801c('0x3a')](_0x3763e9[_0x801c('0x30')],_0x397194[_0x801c('0x3b')]));if(_0x3763e9[_0x801c('0x30')][_0x801c('0x3c')]){_0x51af08[_0x801c('0x3d')]=_[_0x801c('0x3e')](_0x51af08['where'],{'$or':_[_0x801c('0x2f')](_0x51af08[_0x801c('0x33')],function(_0x4178fa){var _0x465127={};_0x465127[_0x4178fa]={'$like':'%'+_0x3763e9[_0x801c('0x30')][_0x801c('0x3c')]+'%'};return _0x465127;})});}_0x51af08=_[_0x801c('0x3e')]({},_0x51af08,_0x3763e9['options']);return _0x45c629[_0x801c('0x4f')](_0x51af08);}})['then'](function(_0x45eb14){if(_0x45eb14){_0x22db3d=_0x45eb14[_0x801c('0x35')];if(!_0x3763e9[_0x801c('0x30')][_0x801c('0x36')](_0x801c('0x37'))){_0x51af08['limit']=qs[_0x801c('0x1c')](_0x3763e9[_0x801c('0x30')][_0x801c('0x1c')]);_0x51af08[_0x801c('0x1a')]=qs[_0x801c('0x1a')](_0x3763e9[_0x801c('0x30')][_0x801c('0x1a')]);}return _0x45c629[_0x801c('0x4f')](_0x51af08);}})['then'](function(_0x5b2886){if(_0x5b2886){return _0x5b2886?{'count':_0x22db3d,'rows':_0x5b2886}:null;}})[_0x801c('0x23')](respondWithResult(_0x3713a5,null))[_0x801c('0x44')](handleError(_0x3713a5,null));};exports['getTags']=function(_0x3b433d,_0x570645,_0xdbef30){var _0x31613f={};var _0x3ab54f={};var _0x151dea;var _0x1bd764;return db[_0x801c('0x2a')][_0x801c('0x4d')]({'where':{'id':_0x3b433d['params']['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x570645,null))[_0x801c('0x23')](function(_0x5f4143){if(_0x5f4143){_0x151dea=_0x5f4143;_0x3ab54f[_0x801c('0x2e')]=_[_0x801c('0x31')](db[_0x801c('0x50')][_0x801c('0x2b')]);_0x3ab54f[_0x801c('0x30')]=_['keys'](_0x3b433d[_0x801c('0x30')]);_0x3ab54f[_0x801c('0x3b')]=_[_0x801c('0x32')](_0x3ab54f['model'],_0x3ab54f[_0x801c('0x30')]);_0x31613f['attributes']=_[_0x801c('0x32')](_0x3ab54f[_0x801c('0x2e')],qs[_0x801c('0x34')](_0x3b433d['query'][_0x801c('0x34')]));_0x31613f[_0x801c('0x33')]=_0x31613f['attributes'][_0x801c('0x35')]?_0x31613f[_0x801c('0x33')]:_0x3ab54f[_0x801c('0x2e')];_0x31613f[_0x801c('0x38')]=qs['sort'](_0x3b433d[_0x801c('0x30')]['sort']);_0x31613f[_0x801c('0x3d')]=qs['filters'](_[_0x801c('0x3a')](_0x3b433d[_0x801c('0x30')],_0x3ab54f[_0x801c('0x3b')]));if(_0x3b433d['query'][_0x801c('0x3c')]){_0x31613f['where']=_[_0x801c('0x3e')](_0x31613f['where'],{'$or':_[_0x801c('0x2f')](_0x31613f['attributes'],function(_0x45bb03){var _0x10977b={};_0x10977b[_0x45bb03]={'$like':'%'+_0x3b433d[_0x801c('0x30')][_0x801c('0x3c')]+'%'};return _0x10977b;})});}_0x31613f=_['merge']({},_0x31613f,_0x3b433d[_0x801c('0x40')]);return _0x151dea[_0x801c('0x51')](_0x31613f);}})['then'](function(_0x1b2e31){if(_0x1b2e31){_0x1bd764=_0x1b2e31[_0x801c('0x35')];if(!_0x3b433d[_0x801c('0x30')][_0x801c('0x36')](_0x801c('0x37'))){_0x31613f[_0x801c('0x1c')]=qs['limit'](_0x3b433d[_0x801c('0x30')]['limit']);_0x31613f[_0x801c('0x1a')]=qs[_0x801c('0x1a')](_0x3b433d[_0x801c('0x30')]['offset']);}return _0x151dea[_0x801c('0x51')](_0x31613f);}})[_0x801c('0x23')](function(_0x549fcf){if(_0x549fcf){return _0x549fcf?{'count':_0x1bd764,'rows':_0x549fcf}:null;}})[_0x801c('0x23')](respondWithResult(_0x570645,null))[_0x801c('0x44')](handleError(_0x570645,null));};exports['setTags']=function(_0x1ff250,_0x13c453,_0x426ab8){if(_0x1ff250[_0x801c('0x49')]['id']){delete _0x1ff250[_0x801c('0x49')]['id'];}return db[_0x801c('0x2a')][_0x801c('0x4d')]({'where':{'id':_0x1ff250[_0x801c('0x46')]['id']}})[_0x801c('0x23')](handleEntityNotFound(_0x13c453,null))[_0x801c('0x23')](function(_0x24e98e){if(_0x24e98e){return _0x24e98e[_0x801c('0x52')](_0x1ff250['body'][_0x801c('0x53')]||[]);}return null;})['then'](respondWithResult(_0x13c453,null))['catch'](handleError(_0x13c453,null));}; \ No newline at end of file +var _0x1b64=['attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','fields','create','body','find','getFields','ZendeskField','pick','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','hasOwnProperty','setTags','ids','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0xbecefa,_0x551907){var _0x19dab4=function(_0xf5c3db){while(--_0xf5c3db){_0xbecefa['push'](_0xbecefa['shift']());}};_0x19dab4(++_0x551907);}(_0x1b64,0x174));var _0x41b6=function(_0x1b2a16,_0x154b64){_0x1b2a16=_0x1b2a16-0x0;var _0x4853ea=_0x1b64[_0x1b2a16];return _0x4853ea;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x41b6('0x2'));var moment=require('moment');var BPromise=require(_0x41b6('0x3'));var Mustache=require(_0x41b6('0x4'));var util=require('util');var path=require(_0x41b6('0x5'));var sox=require('sox');var csv=require(_0x41b6('0x6'));var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require(_0x41b6('0x9'));var squel=require(_0x41b6('0xa'));var crypto=require(_0x41b6('0xb'));var jsforce=require(_0x41b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x41b6('0x6'));var querystring=require(_0x41b6('0xd'));var Papa=require('papaparse');var Redis=require(_0x41b6('0xe'));var authService=require(_0x41b6('0xf'));var qs=require(_0x41b6('0x10'));var as=require(_0x41b6('0x11'));var hardwareService=require(_0x41b6('0x12'));var logger=require(_0x41b6('0x13'))(_0x41b6('0x14'));var utils=require(_0x41b6('0x15'));var config=require(_0x41b6('0x16'));var licenseUtil=require(_0x41b6('0x17'));var db=require(_0x41b6('0x18'))['db'];function respondWithStatusCode(_0x259e0e,_0xa352d7){_0xa352d7=_0xa352d7||0xcc;return function(_0x52ef9c){if(_0x52ef9c){return _0x259e0e[_0x41b6('0x19')](_0xa352d7);}return _0x259e0e[_0x41b6('0x1a')](_0xa352d7)[_0x41b6('0x1b')]();};}function respondWithResult(_0x262695,_0x448412){_0x448412=_0x448412||0xc8;return function(_0x276666){if(_0x276666){return _0x262695[_0x41b6('0x1a')](_0x448412)[_0x41b6('0x1c')](_0x276666);}};}function respondWithFilteredResult(_0x27ba9f,_0x3d2636){return function(_0x21620d){if(_0x21620d){var _0x6b9766=typeof _0x3d2636['offset']===_0x41b6('0x1d')&&typeof _0x3d2636[_0x41b6('0x1e')]===_0x41b6('0x1d');var _0x5e0a8e=_0x21620d[_0x41b6('0x1f')];var _0x4c43c3=_0x6b9766?0x0:_0x3d2636[_0x41b6('0x20')];var _0x3952fd=_0x6b9766?_0x21620d['count']:_0x3d2636[_0x41b6('0x20')]+_0x3d2636[_0x41b6('0x1e')];var _0x224e1f;if(_0x3952fd>=_0x5e0a8e){_0x3952fd=_0x5e0a8e;_0x224e1f=0xc8;}else{_0x224e1f=0xce;}_0x27ba9f[_0x41b6('0x1a')](_0x224e1f);return _0x27ba9f[_0x41b6('0x21')](_0x41b6('0x22'),_0x4c43c3+'-'+_0x3952fd+'/'+_0x5e0a8e)[_0x41b6('0x1c')](_0x21620d);}return null;};}function patchUpdates(_0x2c9863){return function(_0x24490f){try{jsonpatch[_0x41b6('0x23')](_0x24490f,_0x2c9863,!![]);}catch(_0x1b31d8){return BPromise[_0x41b6('0x24')](_0x1b31d8);}return _0x24490f['save']();};}function saveUpdates(_0x1bb746,_0x5e90e2){return function(_0x6e60e5){if(_0x6e60e5){return _0x6e60e5['update'](_0x1bb746)[_0x41b6('0x25')](function(_0x206189){return _0x206189;});}return null;};}function removeEntity(_0x406780,_0x3beef2){return function(_0x189201){if(_0x189201){return _0x189201[_0x41b6('0x26')]()[_0x41b6('0x25')](function(){_0x406780[_0x41b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a50c,_0x356e99){return function(_0x25d86a){if(!_0x25d86a){_0x22a50c[_0x41b6('0x19')](0x194);}return _0x25d86a;};}function handleError(_0x5852b0,_0x385315){_0x385315=_0x385315||0x1f4;return function(_0xbce733){logger['error'](_0xbce733[_0x41b6('0x27')]);if(_0xbce733[_0x41b6('0x28')]){delete _0xbce733[_0x41b6('0x28')];}_0x5852b0[_0x41b6('0x1a')](_0x385315)[_0x41b6('0x29')](_0xbce733);};}exports[_0x41b6('0x2a')]=function(_0x224e16,_0x2258a4){var _0x1a710d={},_0xd81644={},_0x2e9af0={'count':0x0,'rows':[]};var _0x4818d6=_[_0x41b6('0x2b')](db[_0x41b6('0x2c')][_0x41b6('0x2d')],function(_0x461160){return{'name':_0x461160[_0x41b6('0x2e')],'type':_0x461160[_0x41b6('0x2f')][_0x41b6('0x30')]};});_0xd81644[_0x41b6('0x31')]=_[_0x41b6('0x2b')](_0x4818d6,_0x41b6('0x28'));_0xd81644['query']=_['keys'](_0x224e16[_0x41b6('0x32')]);_0xd81644[_0x41b6('0x33')]=_['intersection'](_0xd81644[_0x41b6('0x31')],_0xd81644[_0x41b6('0x32')]);_0x1a710d['attributes']=_[_0x41b6('0x34')](_0xd81644[_0x41b6('0x31')],qs['fields'](_0x224e16[_0x41b6('0x32')]['fields']));_0x1a710d[_0x41b6('0x35')]=_0x1a710d['attributes'][_0x41b6('0x36')]?_0x1a710d['attributes']:_0xd81644[_0x41b6('0x31')];if(!_0x224e16[_0x41b6('0x32')]['hasOwnProperty']('nolimit')){_0x1a710d[_0x41b6('0x1e')]=qs['limit'](_0x224e16[_0x41b6('0x32')][_0x41b6('0x1e')]);_0x1a710d[_0x41b6('0x20')]=qs[_0x41b6('0x20')](_0x224e16[_0x41b6('0x32')][_0x41b6('0x20')]);}_0x1a710d[_0x41b6('0x37')]=qs[_0x41b6('0x38')](_0x224e16[_0x41b6('0x32')][_0x41b6('0x38')]);_0x1a710d[_0x41b6('0x39')]=qs[_0x41b6('0x33')](_['pick'](_0x224e16[_0x41b6('0x32')],_0xd81644[_0x41b6('0x33')]),_0x4818d6);if(_0x224e16[_0x41b6('0x32')][_0x41b6('0x3a')]){_0x1a710d[_0x41b6('0x39')]=_[_0x41b6('0x3b')](_0x1a710d['where'],{'$or':_[_0x41b6('0x2b')](_0x4818d6,function(_0x24f143){if(_0x24f143[_0x41b6('0x2f')]!==_0x41b6('0x3c')){var _0x23bcb8={};_0x23bcb8[_0x24f143[_0x41b6('0x28')]]={'$like':'%'+_0x224e16[_0x41b6('0x32')][_0x41b6('0x3a')]+'%'};return _0x23bcb8;}})});}_0x1a710d=_[_0x41b6('0x3b')]({},_0x1a710d,_0x224e16[_0x41b6('0x3d')]);var _0x27e5c8={'where':_0x1a710d[_0x41b6('0x39')]};return db['ZendeskConfiguration'][_0x41b6('0x1f')](_0x27e5c8)[_0x41b6('0x25')](function(_0xb8e70e){_0x2e9af0[_0x41b6('0x1f')]=_0xb8e70e;if(_0x224e16[_0x41b6('0x32')][_0x41b6('0x3e')]){_0x1a710d['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x41b6('0x3f')](_0x1a710d);})[_0x41b6('0x25')](function(_0x43d51f){_0x2e9af0[_0x41b6('0x40')]=_0x43d51f;return _0x2e9af0;})[_0x41b6('0x25')](respondWithFilteredResult(_0x2258a4,_0x1a710d))[_0x41b6('0x41')](handleError(_0x2258a4,null));};exports[_0x41b6('0x42')]=function(_0x2e370e,_0x45e98d){var _0x51ca1f={'raw':![],'where':{'id':_0x2e370e[_0x41b6('0x43')]['id']}},_0x59ba1a={};_0x59ba1a[_0x41b6('0x31')]=_[_0x41b6('0x44')](db[_0x41b6('0x2c')][_0x41b6('0x2d')]);_0x59ba1a[_0x41b6('0x32')]=_['keys'](_0x2e370e[_0x41b6('0x32')]);_0x59ba1a[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x59ba1a[_0x41b6('0x31')],_0x59ba1a['query']);_0x51ca1f[_0x41b6('0x35')]=_['intersection'](_0x59ba1a[_0x41b6('0x31')],qs['fields'](_0x2e370e['query'][_0x41b6('0x45')]));_0x51ca1f[_0x41b6('0x35')]=_0x51ca1f['attributes']['length']?_0x51ca1f[_0x41b6('0x35')]:_0x59ba1a[_0x41b6('0x31')];if(_0x2e370e['query'][_0x41b6('0x3e')]){_0x51ca1f['include']=[{'all':!![]}];}_0x51ca1f=_[_0x41b6('0x3b')]({},_0x51ca1f,_0x2e370e[_0x41b6('0x3d')]);return db[_0x41b6('0x2c')]['find'](_0x51ca1f)[_0x41b6('0x25')](handleEntityNotFound(_0x45e98d,null))[_0x41b6('0x25')](respondWithResult(_0x45e98d,null))[_0x41b6('0x41')](handleError(_0x45e98d,null));};exports['create']=function(_0x3a8799,_0x249d4c){return db[_0x41b6('0x2c')][_0x41b6('0x46')](_0x3a8799[_0x41b6('0x47')],{})[_0x41b6('0x25')](respondWithResult(_0x249d4c,0xc9))[_0x41b6('0x41')](handleError(_0x249d4c,null));};exports['update']=function(_0x25e3f2,_0x346563){if(_0x25e3f2[_0x41b6('0x47')]['id']){delete _0x25e3f2[_0x41b6('0x47')]['id'];}return db[_0x41b6('0x2c')][_0x41b6('0x48')]({'where':{'id':_0x25e3f2[_0x41b6('0x43')]['id']}})[_0x41b6('0x25')](handleEntityNotFound(_0x346563,null))[_0x41b6('0x25')](saveUpdates(_0x25e3f2['body'],null))[_0x41b6('0x25')](respondWithResult(_0x346563,null))[_0x41b6('0x41')](handleError(_0x346563,null));};exports[_0x41b6('0x26')]=function(_0x280c21,_0xd49631){return db['ZendeskConfiguration']['find']({'where':{'id':_0x280c21[_0x41b6('0x43')]['id']}})['then'](handleEntityNotFound(_0xd49631,null))[_0x41b6('0x25')](removeEntity(_0xd49631,null))['catch'](handleError(_0xd49631,null));};exports[_0x41b6('0x49')]=function(_0x57ab7f,_0x1c7e96,_0x16245f){var _0x6dcaaf={};var _0x22a06d={};var _0x290098;var _0x477fe5;return db[_0x41b6('0x2c')]['findOne']({'where':{'id':_0x57ab7f[_0x41b6('0x43')]['id']}})[_0x41b6('0x25')](handleEntityNotFound(_0x1c7e96,null))[_0x41b6('0x25')](function(_0x1c041f){if(_0x1c041f){_0x290098=_0x1c041f;_0x22a06d[_0x41b6('0x31')]=_[_0x41b6('0x44')](db[_0x41b6('0x4a')][_0x41b6('0x2d')]);_0x22a06d[_0x41b6('0x32')]=_[_0x41b6('0x44')](_0x57ab7f[_0x41b6('0x32')]);_0x22a06d[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x22a06d[_0x41b6('0x31')],_0x22a06d[_0x41b6('0x32')]);_0x6dcaaf[_0x41b6('0x35')]=_[_0x41b6('0x34')](_0x22a06d[_0x41b6('0x31')],qs['fields'](_0x57ab7f[_0x41b6('0x32')]['fields']));_0x6dcaaf[_0x41b6('0x35')]=_0x6dcaaf[_0x41b6('0x35')][_0x41b6('0x36')]?_0x6dcaaf[_0x41b6('0x35')]:_0x22a06d['model'];_0x6dcaaf[_0x41b6('0x37')]=qs[_0x41b6('0x38')](_0x57ab7f[_0x41b6('0x32')][_0x41b6('0x38')]);_0x6dcaaf[_0x41b6('0x39')]=qs[_0x41b6('0x33')](_[_0x41b6('0x4b')](_0x57ab7f[_0x41b6('0x32')],_0x22a06d['filters']));if(_0x57ab7f[_0x41b6('0x32')]['filter']){_0x6dcaaf[_0x41b6('0x39')]=_[_0x41b6('0x3b')](_0x6dcaaf[_0x41b6('0x39')],{'$or':_[_0x41b6('0x2b')](_0x6dcaaf[_0x41b6('0x35')],function(_0x4b089c){var _0x55d7b0={};_0x55d7b0[_0x4b089c]={'$like':'%'+_0x57ab7f[_0x41b6('0x32')][_0x41b6('0x3a')]+'%'};return _0x55d7b0;})});}_0x6dcaaf=_[_0x41b6('0x3b')]({},_0x6dcaaf,_0x57ab7f['options']);return _0x290098[_0x41b6('0x49')](_0x6dcaaf);}})[_0x41b6('0x25')](function(_0xd42704){if(_0xd42704){_0x477fe5=_0xd42704['length'];if(!_0x57ab7f['query']['hasOwnProperty'](_0x41b6('0x4c'))){_0x6dcaaf[_0x41b6('0x1e')]=qs['limit'](_0x57ab7f['query'][_0x41b6('0x1e')]);_0x6dcaaf[_0x41b6('0x20')]=qs['offset'](_0x57ab7f[_0x41b6('0x32')][_0x41b6('0x20')]);}return _0x290098[_0x41b6('0x49')](_0x6dcaaf);}})['then'](function(_0x4e02fd){if(_0x4e02fd){return _0x4e02fd?{'count':_0x477fe5,'rows':_0x4e02fd}:null;}})[_0x41b6('0x25')](respondWithResult(_0x1c7e96,null))[_0x41b6('0x41')](handleError(_0x1c7e96,null));};exports[_0x41b6('0x4d')]=function(_0x43497a,_0x272a67,_0x457a61){var _0x2ee20e={};var _0x4b39ca={};var _0x5d7019;var _0x293c52;return db[_0x41b6('0x2c')]['findOne']({'where':{'id':_0x43497a[_0x41b6('0x43')]['id']}})[_0x41b6('0x25')](handleEntityNotFound(_0x272a67,null))[_0x41b6('0x25')](function(_0x744e9){if(_0x744e9){_0x5d7019=_0x744e9;_0x4b39ca[_0x41b6('0x31')]=_[_0x41b6('0x44')](db['ZendeskField'][_0x41b6('0x2d')]);_0x4b39ca[_0x41b6('0x32')]=_[_0x41b6('0x44')](_0x43497a[_0x41b6('0x32')]);_0x4b39ca[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x4b39ca[_0x41b6('0x31')],_0x4b39ca[_0x41b6('0x32')]);_0x2ee20e[_0x41b6('0x35')]=_[_0x41b6('0x34')](_0x4b39ca[_0x41b6('0x31')],qs['fields'](_0x43497a[_0x41b6('0x32')][_0x41b6('0x45')]));_0x2ee20e[_0x41b6('0x35')]=_0x2ee20e[_0x41b6('0x35')][_0x41b6('0x36')]?_0x2ee20e[_0x41b6('0x35')]:_0x4b39ca[_0x41b6('0x31')];_0x2ee20e[_0x41b6('0x37')]=qs[_0x41b6('0x38')](_0x43497a['query']['sort']);_0x2ee20e[_0x41b6('0x39')]=qs[_0x41b6('0x33')](_[_0x41b6('0x4b')](_0x43497a[_0x41b6('0x32')],_0x4b39ca[_0x41b6('0x33')]));if(_0x43497a['query'][_0x41b6('0x3a')]){_0x2ee20e[_0x41b6('0x39')]=_[_0x41b6('0x3b')](_0x2ee20e['where'],{'$or':_[_0x41b6('0x2b')](_0x2ee20e[_0x41b6('0x35')],function(_0x3a8a26){var _0x35352d={};_0x35352d[_0x3a8a26]={'$like':'%'+_0x43497a[_0x41b6('0x32')][_0x41b6('0x3a')]+'%'};return _0x35352d;})});}_0x2ee20e=_[_0x41b6('0x3b')]({},_0x2ee20e,_0x43497a[_0x41b6('0x3d')]);return _0x5d7019[_0x41b6('0x4d')](_0x2ee20e);}})[_0x41b6('0x25')](function(_0x3f359c){if(_0x3f359c){_0x293c52=_0x3f359c[_0x41b6('0x36')];if(!_0x43497a[_0x41b6('0x32')]['hasOwnProperty'](_0x41b6('0x4c'))){_0x2ee20e[_0x41b6('0x1e')]=qs['limit'](_0x43497a['query'][_0x41b6('0x1e')]);_0x2ee20e[_0x41b6('0x20')]=qs[_0x41b6('0x20')](_0x43497a[_0x41b6('0x32')][_0x41b6('0x20')]);}return _0x5d7019['getSubjects'](_0x2ee20e);}})[_0x41b6('0x25')](function(_0x38e6ce){if(_0x38e6ce){return _0x38e6ce?{'count':_0x293c52,'rows':_0x38e6ce}:null;}})[_0x41b6('0x25')](respondWithResult(_0x272a67,null))[_0x41b6('0x41')](handleError(_0x272a67,null));};exports['getDescriptions']=function(_0x336e39,_0x370b61,_0x43e253){var _0xd6abb6={};var _0x53c0f8={};var _0x50c8d6;var _0x4215c4;return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x336e39[_0x41b6('0x43')]['id']}})[_0x41b6('0x25')](handleEntityNotFound(_0x370b61,null))[_0x41b6('0x25')](function(_0x19b699){if(_0x19b699){_0x50c8d6=_0x19b699;_0x53c0f8[_0x41b6('0x31')]=_[_0x41b6('0x44')](db[_0x41b6('0x4a')]['rawAttributes']);_0x53c0f8['query']=_[_0x41b6('0x44')](_0x336e39['query']);_0x53c0f8[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x53c0f8[_0x41b6('0x31')],_0x53c0f8[_0x41b6('0x32')]);_0xd6abb6[_0x41b6('0x35')]=_[_0x41b6('0x34')](_0x53c0f8[_0x41b6('0x31')],qs['fields'](_0x336e39['query'][_0x41b6('0x45')]));_0xd6abb6[_0x41b6('0x35')]=_0xd6abb6[_0x41b6('0x35')][_0x41b6('0x36')]?_0xd6abb6[_0x41b6('0x35')]:_0x53c0f8[_0x41b6('0x31')];_0xd6abb6[_0x41b6('0x37')]=qs['sort'](_0x336e39['query'][_0x41b6('0x38')]);_0xd6abb6[_0x41b6('0x39')]=qs[_0x41b6('0x33')](_['pick'](_0x336e39[_0x41b6('0x32')],_0x53c0f8['filters']));if(_0x336e39[_0x41b6('0x32')][_0x41b6('0x3a')]){_0xd6abb6[_0x41b6('0x39')]=_[_0x41b6('0x3b')](_0xd6abb6[_0x41b6('0x39')],{'$or':_[_0x41b6('0x2b')](_0xd6abb6['attributes'],function(_0x1b896){var _0x266191={};_0x266191[_0x1b896]={'$like':'%'+_0x336e39['query'][_0x41b6('0x3a')]+'%'};return _0x266191;})});}_0xd6abb6=_['merge']({},_0xd6abb6,_0x336e39[_0x41b6('0x3d')]);return _0x50c8d6[_0x41b6('0x4f')](_0xd6abb6);}})[_0x41b6('0x25')](function(_0x4e8348){if(_0x4e8348){_0x4215c4=_0x4e8348[_0x41b6('0x36')];if(!_0x336e39[_0x41b6('0x32')]['hasOwnProperty'](_0x41b6('0x4c'))){_0xd6abb6[_0x41b6('0x1e')]=qs['limit'](_0x336e39['query'][_0x41b6('0x1e')]);_0xd6abb6[_0x41b6('0x20')]=qs[_0x41b6('0x20')](_0x336e39[_0x41b6('0x32')][_0x41b6('0x20')]);}return _0x50c8d6[_0x41b6('0x4f')](_0xd6abb6);}})[_0x41b6('0x25')](function(_0xeb3d13){if(_0xeb3d13){return _0xeb3d13?{'count':_0x4215c4,'rows':_0xeb3d13}:null;}})[_0x41b6('0x25')](respondWithResult(_0x370b61,null))[_0x41b6('0x41')](handleError(_0x370b61,null));};exports[_0x41b6('0x50')]=function(_0x4309ea,_0x540e3a,_0x4ef0b8){var _0x588291={};var _0x749061={};var _0x100c27;var _0xae50;return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x4309ea[_0x41b6('0x43')]['id']}})['then'](handleEntityNotFound(_0x540e3a,null))['then'](function(_0x2dc0da){if(_0x2dc0da){_0x100c27=_0x2dc0da;_0x749061['model']=_['keys'](db[_0x41b6('0x51')][_0x41b6('0x2d')]);_0x749061[_0x41b6('0x32')]=_[_0x41b6('0x44')](_0x4309ea[_0x41b6('0x32')]);_0x749061[_0x41b6('0x33')]=_['intersection'](_0x749061[_0x41b6('0x31')],_0x749061[_0x41b6('0x32')]);_0x588291[_0x41b6('0x35')]=_[_0x41b6('0x34')](_0x749061[_0x41b6('0x31')],qs[_0x41b6('0x45')](_0x4309ea[_0x41b6('0x32')][_0x41b6('0x45')]));_0x588291[_0x41b6('0x35')]=_0x588291[_0x41b6('0x35')][_0x41b6('0x36')]?_0x588291[_0x41b6('0x35')]:_0x749061['model'];_0x588291[_0x41b6('0x37')]=qs[_0x41b6('0x38')](_0x4309ea[_0x41b6('0x32')][_0x41b6('0x38')]);_0x588291['where']=qs[_0x41b6('0x33')](_[_0x41b6('0x4b')](_0x4309ea[_0x41b6('0x32')],_0x749061[_0x41b6('0x33')]));if(_0x4309ea[_0x41b6('0x32')][_0x41b6('0x3a')]){_0x588291['where']=_['merge'](_0x588291[_0x41b6('0x39')],{'$or':_[_0x41b6('0x2b')](_0x588291['attributes'],function(_0x11a6eb){var _0x78f6de={};_0x78f6de[_0x11a6eb]={'$like':'%'+_0x4309ea[_0x41b6('0x32')][_0x41b6('0x3a')]+'%'};return _0x78f6de;})});}_0x588291=_[_0x41b6('0x3b')]({},_0x588291,_0x4309ea[_0x41b6('0x3d')]);return _0x100c27[_0x41b6('0x50')](_0x588291);}})['then'](function(_0x2927b0){if(_0x2927b0){_0xae50=_0x2927b0['length'];if(!_0x4309ea[_0x41b6('0x32')][_0x41b6('0x52')](_0x41b6('0x4c'))){_0x588291['limit']=qs[_0x41b6('0x1e')](_0x4309ea[_0x41b6('0x32')][_0x41b6('0x1e')]);_0x588291[_0x41b6('0x20')]=qs[_0x41b6('0x20')](_0x4309ea[_0x41b6('0x32')][_0x41b6('0x20')]);}return _0x100c27[_0x41b6('0x50')](_0x588291);}})[_0x41b6('0x25')](function(_0x12cdd5){if(_0x12cdd5){return _0x12cdd5?{'count':_0xae50,'rows':_0x12cdd5}:null;}})['then'](respondWithResult(_0x540e3a,null))[_0x41b6('0x41')](handleError(_0x540e3a,null));};exports[_0x41b6('0x53')]=function(_0x330dfc,_0x4db5a9,_0x4b3e10){if(_0x330dfc[_0x41b6('0x47')]['id']){delete _0x330dfc[_0x41b6('0x47')]['id'];}return db[_0x41b6('0x2c')]['findOne']({'where':{'id':_0x330dfc['params']['id']}})[_0x41b6('0x25')](handleEntityNotFound(_0x4db5a9,null))['then'](function(_0x44351a){if(_0x44351a){return _0x44351a['setTags'](_0x330dfc[_0x41b6('0x47')][_0x41b6('0x54')]||[]);}return null;})[_0x41b6('0x25')](respondWithResult(_0x4db5a9,null))[_0x41b6('0x41')](handleError(_0x4db5a9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index efb51b1..b83f9e0 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 _0x80ed=['api','moment','request-promise','path','rimraf','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x51f9a2,_0x19086b){var _0x49998c=function(_0x323d54){while(--_0x323d54){_0x51f9a2['push'](_0x51f9a2['shift']());}};_0x49998c(++_0x19086b);}(_0x80ed,0x11c));var _0xd80e=function(_0x397545,_0x2fedc5){_0x397545=_0x397545-0x0;var _0x397f52=_0x80ed[_0x397545];return _0x397f52;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var logger=require(_0xd80e('0x1'))(_0xd80e('0x2'));var moment=require(_0xd80e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd80e('0x4'));var fs=require('fs');var path=require(_0xd80e('0x5'));var rimraf=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd80e('0x8')]=function(_0x2b4742,_0x252fec){return _0x2b4742['define'](_0xd80e('0x9'),attributes,{'tableName':_0xd80e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c00=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5de967,_0x515918){_0x5de967=_0x5de967-0x0;var _0x5b07a3=_0x9c00[_0x5de967];return _0x5b07a3;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ae9f40c..d422ab4 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 _0x8f4a=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x53b900,_0x39e38d){var _0x4ce320=function(_0x45a756){while(--_0x45a756){_0x53b900['push'](_0x53b900['shift']());}};_0x4ce320(++_0x39e38d);}(_0x8f4a,0x102));var _0xa8f4=function(_0x17c585,_0x2893fb){_0x17c585=_0x17c585-0x0;var _0x157fb9=_0x8f4a[_0x17c585];return _0x157fb9;};'use strict';var _=require(_0xa8f4('0x0'));var util=require(_0xa8f4('0x1'));var moment=require('moment');var BPromise=require(_0xa8f4('0x2'));var rs=require(_0xa8f4('0x3'));var fs=require('fs');var Redis=require(_0xa8f4('0x4'));var db=require(_0xa8f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8f4('0x6'))(_0xa8f4('0x7'));var config=require(_0xa8f4('0x8'));var jayson=require(_0xa8f4('0x9'));var client=jayson[_0xa8f4('0xa')][_0xa8f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243d86,_0x4aedc3,_0x41da9d){return new BPromise(function(_0x53b88b,_0x48f94b){return client[_0xa8f4('0xc')](_0x243d86,_0x41da9d)[_0xa8f4('0xd')](function(_0x358438){logger[_0xa8f4('0xe')](_0xa8f4('0xf'),_0x4aedc3,_0xa8f4('0x10'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4aedc3,'request\x20sent',JSON['stringify'](_0x358438));if(_0x358438[_0xa8f4('0x11')]){if(_0x358438[_0xa8f4('0x11')]['code']===0x1f4){logger['error'](_0xa8f4('0xf'),_0x4aedc3,_0x358438[_0xa8f4('0x11')][_0xa8f4('0x12')]);return _0x48f94b(_0x358438[_0xa8f4('0x11')][_0xa8f4('0x12')]);}logger[_0xa8f4('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4aedc3,_0x358438[_0xa8f4('0x11')]['message']);return _0x53b88b(_0x358438[_0xa8f4('0x11')]['message']);}else{logger[_0xa8f4('0xe')](_0xa8f4('0xf'),_0x4aedc3,_0xa8f4('0x10'));_0x53b88b(_0x358438[_0xa8f4('0x13')][_0xa8f4('0x12')]);}})[_0xa8f4('0x14')](function(_0x351fef){logger[_0xa8f4('0x11')](_0xa8f4('0xf'),_0x4aedc3,_0x351fef);_0x48f94b(_0x351fef);});});} \ No newline at end of file +var _0x28d0=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x98a2d0,_0x78a6fb){var _0x5ae4f3=function(_0x236c10){while(--_0x236c10){_0x98a2d0['push'](_0x98a2d0['shift']());}};_0x5ae4f3(++_0x78a6fb);}(_0x28d0,0x17c));var _0x028d=function(_0x2fbe06,_0xe7e67e){_0x2fbe06=_0x2fbe06-0x0;var _0x2efc5f=_0x28d0[_0x2fbe06];return _0x2efc5f;};'use strict';var _=require('lodash');var util=require(_0x028d('0x0'));var moment=require(_0x028d('0x1'));var BPromise=require('bluebird');var rs=require(_0x028d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x028d('0x3'))['db'];var utils=require(_0x028d('0x4'));var logger=require(_0x028d('0x5'))(_0x028d('0x6'));var config=require(_0x028d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x028d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d356a,_0x4ea0c8,_0x9317ce){return new BPromise(function(_0x51d953,_0x300816){return client[_0x028d('0x9')](_0x2d356a,_0x9317ce)[_0x028d('0xa')](function(_0x54e6f0){logger[_0x028d('0xb')](_0x028d('0xc'),_0x4ea0c8,_0x028d('0xd'));logger[_0x028d('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4ea0c8,_0x028d('0xd'),JSON[_0x028d('0xf')](_0x54e6f0));if(_0x54e6f0[_0x028d('0x10')]){if(_0x54e6f0[_0x028d('0x10')]['code']===0x1f4){logger[_0x028d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ea0c8,_0x54e6f0[_0x028d('0x10')][_0x028d('0x11')]);return _0x300816(_0x54e6f0['error']['message']);}logger[_0x028d('0x10')](_0x028d('0xc'),_0x4ea0c8,_0x54e6f0[_0x028d('0x10')][_0x028d('0x11')]);return _0x51d953(_0x54e6f0[_0x028d('0x10')][_0x028d('0x11')]);}else{logger[_0x028d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ea0c8,_0x028d('0xd'));_0x51d953(_0x54e6f0[_0x028d('0x12')][_0x028d('0x11')]);}})[_0x028d('0x13')](function(_0x2a13be){logger[_0x028d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ea0c8,_0x2a13be);_0x300816(_0x2a13be);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f618fac..52de845 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 _0xa3ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','show','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express'];(function(_0x463255,_0x579491){var _0x4cb0a7=function(_0x4fd385){while(--_0x4fd385){_0x463255['push'](_0x463255['shift']());}};_0x4cb0a7(++_0x579491);}(_0xa3ca,0x152));var _0xaa3c=function(_0x7afae5,_0x555945){_0x7afae5=_0x7afae5-0x0;var _0x2a76e7=_0xa3ca[_0x7afae5];return _0x2a76e7;};'use strict';var multer=require('multer');var util=require(_0xaa3c('0x0'));var path=require(_0xaa3c('0x1'));var timeout=require(_0xaa3c('0x2'));var express=require(_0xaa3c('0x3'));var router=express[_0xaa3c('0x4')]();var fs_extra=require(_0xaa3c('0x5'));var auth=require(_0xaa3c('0x6'));var interaction=require(_0xaa3c('0x7'));var config=require(_0xaa3c('0x8'));var controller=require(_0xaa3c('0x9'));router['get']('/',auth[_0xaa3c('0xa')](),controller[_0xaa3c('0xb')]);router['get']('/:id',auth[_0xaa3c('0xa')](),controller[_0xaa3c('0xc')]);router['post']('/',auth[_0xaa3c('0xa')](),controller[_0xaa3c('0xd')]);router[_0xaa3c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xaa3c('0xf')]);router['delete'](_0xaa3c('0x10'),auth[_0xaa3c('0xa')](),controller[_0xaa3c('0x11')]);module[_0xaa3c('0x12')]=router; \ No newline at end of file +var _0xcf4d=['create','put','delete','/:id','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','post'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0xcf4d,0x123));var _0xdcf4=function(_0x2d3830,_0x2e1240){_0x2d3830=_0x2d3830-0x0;var _0x5c1298=_0xcf4d[_0x2d3830];return _0x5c1298;};'use strict';var multer=require(_0xdcf4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdcf4('0x1'));var router=express[_0xdcf4('0x2')]();var fs_extra=require(_0xdcf4('0x3'));var auth=require(_0xdcf4('0x4'));var interaction=require(_0xdcf4('0x5'));var config=require(_0xdcf4('0x6'));var controller=require(_0xdcf4('0x7'));router[_0xdcf4('0x8')]('/',auth[_0xdcf4('0x9')](),controller[_0xdcf4('0xa')]);router[_0xdcf4('0x8')]('/:id',auth[_0xdcf4('0x9')](),controller[_0xdcf4('0xb')]);router[_0xdcf4('0xc')]('/',auth[_0xdcf4('0x9')](),controller[_0xdcf4('0xd')]);router[_0xdcf4('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdcf4('0xf')](_0xdcf4('0x10'),auth[_0xdcf4('0x9')](),controller[_0xdcf4('0x11')]);module[_0xdcf4('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 71632c6..e3b4406 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 _0xffdd=['variable','BOOLEAN','ENUM','string','customVariable','STRING'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0xffdd,0x152));var _0xdffd=function(_0x1ad148,_0x3d6142){_0x1ad148=_0x1ad148-0x0;var _0x1d62ba=_0xffdd[_0x1ad148];return _0x1d62ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdffd('0x0')](_0xdffd('0x1'),'variable',_0xdffd('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xdffd('0x3')]},'key':{'type':Sequelize[_0xdffd('0x3')]},'keyType':{'type':Sequelize[_0xdffd('0x0')](_0xdffd('0x1'),_0xdffd('0x4'),_0xdffd('0x2'))},'keyContent':{'type':Sequelize[_0xdffd('0x3')]},'idField':{'type':Sequelize[_0xdffd('0x3')]},'nameField':{'type':Sequelize[_0xdffd('0x3')]},'customField':{'type':Sequelize[_0xdffd('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdce4=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','ENUM','variable'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xdce4,0xa6));var _0x4dce=function(_0x23346e,_0x4731e1){_0x23346e=_0x23346e-0x0;var _0x3d4e7c=_0xdce4[_0x23346e];return _0x3d4e7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4dce('0x0')]('string',_0x4dce('0x1'),_0x4dce('0x2'),_0x4dce('0x3'),_0x4dce('0x4')),'defaultValue':_0x4dce('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4dce('0x6')]},'keyType':{'type':Sequelize[_0x4dce('0x0')](_0x4dce('0x5'),_0x4dce('0x1'),_0x4dce('0x2'))},'keyContent':{'type':Sequelize[_0x4dce('0x6')]},'idField':{'type':Sequelize[_0x4dce('0x6')]},'nameField':{'type':Sequelize[_0x4dce('0x6')]},'customField':{'type':Sequelize[_0x4dce('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4dce('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 314577c..5815be6 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 _0xec6b=['map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','ZendeskField','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xec6b,0x129));var _0xbec6=function(_0x30afd2,_0x4c51ad){_0x30afd2=_0x30afd2-0x0;var _0x4803d3=_0xec6b[_0x30afd2];return _0x4803d3;};'use strict';var emlformat=require(_0xbec6('0x0'));var rimraf=require(_0xbec6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbec6('0x2'));var rp=require('request-promise');var moment=require(_0xbec6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbec6('0x4'));var util=require(_0xbec6('0x5'));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('fs-extra');var _=require('lodash');var squel=require(_0xbec6('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbec6('0x7'));var toCsv=require(_0xbec6('0x8'));var querystring=require(_0xbec6('0x9'));var Papa=require(_0xbec6('0xa'));var Redis=require(_0xbec6('0xb'));var authService=require(_0xbec6('0xc'));var qs=require(_0xbec6('0xd'));var as=require(_0xbec6('0xe'));var hardwareService=require(_0xbec6('0xf'));var logger=require(_0xbec6('0x10'))(_0xbec6('0x11'));var utils=require(_0xbec6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbec6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27cb5c,_0x204245){_0x204245=_0x204245||0xcc;return function(_0x50b4b1){if(_0x50b4b1){return _0x27cb5c[_0xbec6('0x14')](_0x204245);}return _0x27cb5c['status'](_0x204245)[_0xbec6('0x15')]();};}function respondWithResult(_0x5b88b4,_0x335972){_0x335972=_0x335972||0xc8;return function(_0x4a674d){if(_0x4a674d){return _0x5b88b4[_0xbec6('0x16')](_0x335972)[_0xbec6('0x17')](_0x4a674d);}};}function respondWithFilteredResult(_0x276e74,_0x169cee){return function(_0x52b5f3){if(_0x52b5f3){var _0x15461c=typeof _0x169cee['offset']===_0xbec6('0x18')&&typeof _0x169cee[_0xbec6('0x19')]===_0xbec6('0x18');var _0xd9cf32=_0x52b5f3[_0xbec6('0x1a')];var _0x4a18bd=_0x15461c?0x0:_0x169cee[_0xbec6('0x1b')];var _0x98a9f3=_0x15461c?_0x52b5f3['count']:_0x169cee[_0xbec6('0x1b')]+_0x169cee[_0xbec6('0x19')];var _0x36b570;if(_0x98a9f3>=_0xd9cf32){_0x98a9f3=_0xd9cf32;_0x36b570=0xc8;}else{_0x36b570=0xce;}_0x276e74[_0xbec6('0x16')](_0x36b570);return _0x276e74['set'](_0xbec6('0x1c'),_0x4a18bd+'-'+_0x98a9f3+'/'+_0xd9cf32)[_0xbec6('0x17')](_0x52b5f3);}return null;};}function patchUpdates(_0x1ee928){return function(_0x26529c){try{jsonpatch['apply'](_0x26529c,_0x1ee928,!![]);}catch(_0x34a83e){return BPromise[_0xbec6('0x1d')](_0x34a83e);}return _0x26529c[_0xbec6('0x1e')]();};}function saveUpdates(_0x5835db,_0x3163c0){return function(_0x5bead7){if(_0x5bead7){return _0x5bead7[_0xbec6('0x1f')](_0x5835db)[_0xbec6('0x20')](function(_0x1fb151){return _0x1fb151;});}return null;};}function removeEntity(_0x404d91,_0x1d882a){return function(_0x44574e){if(_0x44574e){return _0x44574e[_0xbec6('0x21')]()[_0xbec6('0x20')](function(){_0x404d91[_0xbec6('0x16')](0xcc)[_0xbec6('0x15')]();});}};}function handleEntityNotFound(_0x59dea8,_0x1e9b41){return function(_0x2f5887){if(!_0x2f5887){_0x59dea8['sendStatus'](0x194);}return _0x2f5887;};}function handleError(_0x3c347b,_0x48c1ea){_0x48c1ea=_0x48c1ea||0x1f4;return function(_0x17b98d){logger[_0xbec6('0x22')](_0x17b98d[_0xbec6('0x23')]);if(_0x17b98d[_0xbec6('0x24')]){delete _0x17b98d[_0xbec6('0x24')];}_0x3c347b[_0xbec6('0x16')](_0x48c1ea)[_0xbec6('0x25')](_0x17b98d);};}exports['index']=function(_0x43729e,_0x7682e7){var _0x3ef4da={},_0x1e5bc0={},_0x5ce667={'count':0x0,'rows':[]};var _0x3cd4dd=_[_0xbec6('0x26')](db['ZendeskField'][_0xbec6('0x27')],function(_0x25132e){return{'name':_0x25132e[_0xbec6('0x28')],'type':_0x25132e[_0xbec6('0x29')]['key']};});_0x1e5bc0[_0xbec6('0x2a')]=_['map'](_0x3cd4dd,_0xbec6('0x24'));_0x1e5bc0['query']=_['keys'](_0x43729e[_0xbec6('0x2b')]);_0x1e5bc0[_0xbec6('0x2c')]=_['intersection'](_0x1e5bc0['model'],_0x1e5bc0[_0xbec6('0x2b')]);_0x3ef4da[_0xbec6('0x2d')]=_[_0xbec6('0x2e')](_0x1e5bc0[_0xbec6('0x2a')],qs[_0xbec6('0x2f')](_0x43729e['query'][_0xbec6('0x2f')]));_0x3ef4da[_0xbec6('0x2d')]=_0x3ef4da[_0xbec6('0x2d')]['length']?_0x3ef4da[_0xbec6('0x2d')]:_0x1e5bc0[_0xbec6('0x2a')];if(!_0x43729e[_0xbec6('0x2b')][_0xbec6('0x30')]('nolimit')){_0x3ef4da[_0xbec6('0x19')]=qs[_0xbec6('0x19')](_0x43729e[_0xbec6('0x2b')][_0xbec6('0x19')]);_0x3ef4da[_0xbec6('0x1b')]=qs['offset'](_0x43729e[_0xbec6('0x2b')][_0xbec6('0x1b')]);}_0x3ef4da['order']=qs[_0xbec6('0x31')](_0x43729e['query'][_0xbec6('0x31')]);_0x3ef4da[_0xbec6('0x32')]=qs['filters'](_[_0xbec6('0x33')](_0x43729e[_0xbec6('0x2b')],_0x1e5bc0[_0xbec6('0x2c')]),_0x3cd4dd);if(_0x43729e[_0xbec6('0x2b')]['filter']){_0x3ef4da['where']=_[_0xbec6('0x34')](_0x3ef4da[_0xbec6('0x32')],{'$or':_[_0xbec6('0x26')](_0x3cd4dd,function(_0x24a6c3){if(_0x24a6c3[_0xbec6('0x29')]!=='VIRTUAL'){var _0xaf1182={};_0xaf1182[_0x24a6c3[_0xbec6('0x24')]]={'$like':'%'+_0x43729e[_0xbec6('0x2b')][_0xbec6('0x35')]+'%'};return _0xaf1182;}})});}_0x3ef4da=_[_0xbec6('0x34')]({},_0x3ef4da,_0x43729e['options']);var _0x2a998b={'where':_0x3ef4da['where']};return db[_0xbec6('0x36')][_0xbec6('0x1a')](_0x2a998b)[_0xbec6('0x20')](function(_0x2614ae){_0x5ce667[_0xbec6('0x1a')]=_0x2614ae;if(_0x43729e['query'][_0xbec6('0x37')]){_0x3ef4da[_0xbec6('0x38')]=[{'all':!![]}];}return db[_0xbec6('0x36')][_0xbec6('0x39')](_0x3ef4da);})[_0xbec6('0x20')](function(_0x102c47){_0x5ce667[_0xbec6('0x3a')]=_0x102c47;return _0x5ce667;})[_0xbec6('0x20')](respondWithFilteredResult(_0x7682e7,_0x3ef4da))[_0xbec6('0x3b')](handleError(_0x7682e7,null));};exports[_0xbec6('0x3c')]=function(_0x3889e6,_0x4f04ab){var _0x2f6fac={'raw':!![],'where':{'id':_0x3889e6[_0xbec6('0x3d')]['id']}},_0x24d1d4={};_0x24d1d4[_0xbec6('0x2a')]=_[_0xbec6('0x3e')](db['ZendeskField']['rawAttributes']);_0x24d1d4['query']=_[_0xbec6('0x3e')](_0x3889e6['query']);_0x24d1d4['filters']=_[_0xbec6('0x2e')](_0x24d1d4[_0xbec6('0x2a')],_0x24d1d4[_0xbec6('0x2b')]);_0x2f6fac[_0xbec6('0x2d')]=_['intersection'](_0x24d1d4[_0xbec6('0x2a')],qs[_0xbec6('0x2f')](_0x3889e6['query']['fields']));_0x2f6fac['attributes']=_0x2f6fac[_0xbec6('0x2d')][_0xbec6('0x3f')]?_0x2f6fac[_0xbec6('0x2d')]:_0x24d1d4[_0xbec6('0x2a')];if(_0x3889e6['query']['includeAll']){_0x2f6fac[_0xbec6('0x38')]=[{'all':!![]}];}_0x2f6fac=_[_0xbec6('0x34')]({},_0x2f6fac,_0x3889e6[_0xbec6('0x40')]);return db[_0xbec6('0x36')][_0xbec6('0x41')](_0x2f6fac)[_0xbec6('0x20')](handleEntityNotFound(_0x4f04ab,null))[_0xbec6('0x20')](respondWithResult(_0x4f04ab,null))['catch'](handleError(_0x4f04ab,null));};exports['create']=function(_0x3ec213,_0x239a23){return db[_0xbec6('0x36')]['create'](_0x3ec213[_0xbec6('0x42')],{})[_0xbec6('0x20')](respondWithResult(_0x239a23,0xc9))[_0xbec6('0x3b')](handleError(_0x239a23,null));};exports[_0xbec6('0x1f')]=function(_0x1ef24a,_0x5c686f){if(_0x1ef24a['body']['id']){delete _0x1ef24a['body']['id'];}return db['ZendeskField'][_0xbec6('0x41')]({'where':{'id':_0x1ef24a[_0xbec6('0x3d')]['id']}})[_0xbec6('0x20')](handleEntityNotFound(_0x5c686f,null))[_0xbec6('0x20')](saveUpdates(_0x1ef24a[_0xbec6('0x42')],null))['then'](respondWithResult(_0x5c686f,null))[_0xbec6('0x3b')](handleError(_0x5c686f,null));};exports[_0xbec6('0x21')]=function(_0x4dedc7,_0x23590b){return db[_0xbec6('0x36')][_0xbec6('0x41')]({'where':{'id':_0x4dedc7['params']['id']}})[_0xbec6('0x20')](handleEntityNotFound(_0x23590b,null))['then'](removeEntity(_0x23590b,null))[_0xbec6('0x3b')](handleError(_0x23590b,null));}; \ No newline at end of file +var _0xcd1a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service'];(function(_0x16b730,_0x5b07a0){var _0x19e94c=function(_0x48085b){while(--_0x48085b){_0x16b730['push'](_0x16b730['shift']());}};_0x19e94c(++_0x5b07a0);}(_0xcd1a,0x115));var _0xacd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcd1a[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xacd1('0x0'));var rimraf=require(_0xacd1('0x1'));var zipdir=require(_0xacd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xacd1('0x3'));var moment=require(_0xacd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xacd1('0x5'));var util=require('util');var path=require(_0xacd1('0x6'));var sox=require(_0xacd1('0x7'));var csv=require(_0xacd1('0x8'));var ejs=require(_0xacd1('0x9'));var fs=require('fs');var fs_extra=require(_0xacd1('0xa'));var _=require('lodash');var squel=require(_0xacd1('0xb'));var crypto=require(_0xacd1('0xc'));var jsforce=require(_0xacd1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xacd1('0xe'));var qs=require(_0xacd1('0xf'));var as=require(_0xacd1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd1('0x11'))(_0xacd1('0x12'));var utils=require(_0xacd1('0x13'));var config=require(_0xacd1('0x14'));var licenseUtil=require(_0xacd1('0x15'));var db=require(_0xacd1('0x16'))['db'];function respondWithStatusCode(_0x2d1324,_0x179886){_0x179886=_0x179886||0xcc;return function(_0x44e7c7){if(_0x44e7c7){return _0x2d1324[_0xacd1('0x17')](_0x179886);}return _0x2d1324[_0xacd1('0x18')](_0x179886)['end']();};}function respondWithResult(_0x35b5d2,_0x2d0025){_0x2d0025=_0x2d0025||0xc8;return function(_0x139f4d){if(_0x139f4d){return _0x35b5d2[_0xacd1('0x18')](_0x2d0025)['json'](_0x139f4d);}};}function respondWithFilteredResult(_0x535285,_0x3c4de5){return function(_0x227279){if(_0x227279){var _0x338166=typeof _0x3c4de5['offset']==='undefined'&&typeof _0x3c4de5['limit']==='undefined';var _0x56d46b=_0x227279[_0xacd1('0x19')];var _0x1efa2c=_0x338166?0x0:_0x3c4de5[_0xacd1('0x1a')];var _0x709a09=_0x338166?_0x227279[_0xacd1('0x19')]:_0x3c4de5['offset']+_0x3c4de5['limit'];var _0x523c92;if(_0x709a09>=_0x56d46b){_0x709a09=_0x56d46b;_0x523c92=0xc8;}else{_0x523c92=0xce;}_0x535285[_0xacd1('0x18')](_0x523c92);return _0x535285[_0xacd1('0x1b')](_0xacd1('0x1c'),_0x1efa2c+'-'+_0x709a09+'/'+_0x56d46b)[_0xacd1('0x1d')](_0x227279);}return null;};}function patchUpdates(_0x373565){return function(_0x3a23f3){try{jsonpatch[_0xacd1('0x1e')](_0x3a23f3,_0x373565,!![]);}catch(_0x2cb9d8){return BPromise[_0xacd1('0x1f')](_0x2cb9d8);}return _0x3a23f3[_0xacd1('0x20')]();};}function saveUpdates(_0x27fc19,_0xc2371f){return function(_0xbfd9bb){if(_0xbfd9bb){return _0xbfd9bb['update'](_0x27fc19)[_0xacd1('0x21')](function(_0x340371){return _0x340371;});}return null;};}function removeEntity(_0x2301f2,_0x52a1d1){return function(_0x40a448){if(_0x40a448){return _0x40a448[_0xacd1('0x22')]()[_0xacd1('0x21')](function(){_0x2301f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f17b9,_0x4e4edb){return function(_0x3d6a1f){if(!_0x3d6a1f){_0x3f17b9['sendStatus'](0x194);}return _0x3d6a1f;};}function handleError(_0x3cf525,_0x12b531){_0x12b531=_0x12b531||0x1f4;return function(_0x45f6ee){logger[_0xacd1('0x23')](_0x45f6ee[_0xacd1('0x24')]);if(_0x45f6ee[_0xacd1('0x25')]){delete _0x45f6ee[_0xacd1('0x25')];}_0x3cf525['status'](_0x12b531)[_0xacd1('0x26')](_0x45f6ee);};}exports['index']=function(_0x5379ee,_0x46f0f4){var _0x4ee97d={},_0xb31f68={},_0x389082={'count':0x0,'rows':[]};var _0x1bd9c8=_[_0xacd1('0x27')](db['ZendeskField']['rawAttributes'],function(_0x3b13fa){return{'name':_0x3b13fa[_0xacd1('0x28')],'type':_0x3b13fa[_0xacd1('0x29')][_0xacd1('0x2a')]};});_0xb31f68['model']=_[_0xacd1('0x27')](_0x1bd9c8,'name');_0xb31f68[_0xacd1('0x2b')]=_[_0xacd1('0x2c')](_0x5379ee['query']);_0xb31f68[_0xacd1('0x2d')]=_[_0xacd1('0x2e')](_0xb31f68[_0xacd1('0x2f')],_0xb31f68['query']);_0x4ee97d[_0xacd1('0x30')]=_[_0xacd1('0x2e')](_0xb31f68[_0xacd1('0x2f')],qs[_0xacd1('0x31')](_0x5379ee[_0xacd1('0x2b')]['fields']));_0x4ee97d[_0xacd1('0x30')]=_0x4ee97d[_0xacd1('0x30')]['length']?_0x4ee97d['attributes']:_0xb31f68['model'];if(!_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x32')](_0xacd1('0x33'))){_0x4ee97d[_0xacd1('0x34')]=qs[_0xacd1('0x34')](_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x34')]);_0x4ee97d[_0xacd1('0x1a')]=qs['offset'](_0x5379ee[_0xacd1('0x2b')]['offset']);}_0x4ee97d['order']=qs[_0xacd1('0x35')](_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x35')]);_0x4ee97d[_0xacd1('0x36')]=qs[_0xacd1('0x2d')](_[_0xacd1('0x37')](_0x5379ee[_0xacd1('0x2b')],_0xb31f68['filters']),_0x1bd9c8);if(_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x38')]){_0x4ee97d[_0xacd1('0x36')]=_[_0xacd1('0x39')](_0x4ee97d[_0xacd1('0x36')],{'$or':_[_0xacd1('0x27')](_0x1bd9c8,function(_0x504297){if(_0x504297[_0xacd1('0x29')]!==_0xacd1('0x3a')){var _0x3ba0da={};_0x3ba0da[_0x504297['name']]={'$like':'%'+_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x38')]+'%'};return _0x3ba0da;}})});}_0x4ee97d=_[_0xacd1('0x39')]({},_0x4ee97d,_0x5379ee[_0xacd1('0x3b')]);var _0x333212={'where':_0x4ee97d[_0xacd1('0x36')]};return db[_0xacd1('0x3c')]['count'](_0x333212)[_0xacd1('0x21')](function(_0x415368){_0x389082['count']=_0x415368;if(_0x5379ee[_0xacd1('0x2b')][_0xacd1('0x3d')]){_0x4ee97d[_0xacd1('0x3e')]=[{'all':!![]}];}return db[_0xacd1('0x3c')][_0xacd1('0x3f')](_0x4ee97d);})[_0xacd1('0x21')](function(_0x37792f){_0x389082[_0xacd1('0x40')]=_0x37792f;return _0x389082;})['then'](respondWithFilteredResult(_0x46f0f4,_0x4ee97d))[_0xacd1('0x41')](handleError(_0x46f0f4,null));};exports[_0xacd1('0x42')]=function(_0x468635,_0x2928ec){var _0xa415b7={'raw':!![],'where':{'id':_0x468635[_0xacd1('0x43')]['id']}},_0x3d6e2e={};_0x3d6e2e[_0xacd1('0x2f')]=_['keys'](db[_0xacd1('0x3c')][_0xacd1('0x44')]);_0x3d6e2e[_0xacd1('0x2b')]=_[_0xacd1('0x2c')](_0x468635[_0xacd1('0x2b')]);_0x3d6e2e[_0xacd1('0x2d')]=_[_0xacd1('0x2e')](_0x3d6e2e[_0xacd1('0x2f')],_0x3d6e2e[_0xacd1('0x2b')]);_0xa415b7[_0xacd1('0x30')]=_[_0xacd1('0x2e')](_0x3d6e2e[_0xacd1('0x2f')],qs['fields'](_0x468635[_0xacd1('0x2b')][_0xacd1('0x31')]));_0xa415b7[_0xacd1('0x30')]=_0xa415b7[_0xacd1('0x30')][_0xacd1('0x45')]?_0xa415b7[_0xacd1('0x30')]:_0x3d6e2e['model'];if(_0x468635['query'][_0xacd1('0x3d')]){_0xa415b7[_0xacd1('0x3e')]=[{'all':!![]}];}_0xa415b7=_[_0xacd1('0x39')]({},_0xa415b7,_0x468635[_0xacd1('0x3b')]);return db['ZendeskField'][_0xacd1('0x46')](_0xa415b7)[_0xacd1('0x21')](handleEntityNotFound(_0x2928ec,null))[_0xacd1('0x21')](respondWithResult(_0x2928ec,null))[_0xacd1('0x41')](handleError(_0x2928ec,null));};exports[_0xacd1('0x47')]=function(_0x341c91,_0x3c4f45){return db['ZendeskField'][_0xacd1('0x47')](_0x341c91[_0xacd1('0x48')],{})[_0xacd1('0x21')](respondWithResult(_0x3c4f45,0xc9))[_0xacd1('0x41')](handleError(_0x3c4f45,null));};exports['update']=function(_0x4826b2,_0x2775d6){if(_0x4826b2[_0xacd1('0x48')]['id']){delete _0x4826b2[_0xacd1('0x48')]['id'];}return db[_0xacd1('0x3c')][_0xacd1('0x46')]({'where':{'id':_0x4826b2['params']['id']}})[_0xacd1('0x21')](handleEntityNotFound(_0x2775d6,null))[_0xacd1('0x21')](saveUpdates(_0x4826b2[_0xacd1('0x48')],null))[_0xacd1('0x21')](respondWithResult(_0x2775d6,null))[_0xacd1('0x41')](handleError(_0x2775d6,null));};exports[_0xacd1('0x22')]=function(_0x5e9e3f,_0x554f99){return db[_0xacd1('0x3c')]['find']({'where':{'id':_0x5e9e3f[_0xacd1('0x43')]['id']}})[_0xacd1('0x21')](handleEntityNotFound(_0x554f99,null))['then'](removeEntity(_0x554f99,null))[_0xacd1('0x41')](handleError(_0x554f99,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7c131bd..5483536 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 _0xd77e=['./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3511b0,_0x5261b0){var _0x3184ca=function(_0x3be926){while(--_0x3be926){_0x3511b0['push'](_0x3511b0['shift']());}};_0x3184ca(++_0x5261b0);}(_0xd77e,0x151));var _0xed77=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd77e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed77('0x0'))(_0xed77('0x1'));var moment=require(_0xed77('0x2'));var BPromise=require(_0xed77('0x3'));var rp=require(_0xed77('0x4'));var fs=require('fs');var path=require(_0xed77('0x5'));var rimraf=require(_0xed77('0x6'));var config=require(_0xed77('0x7'));var attributes=require(_0xed77('0x8'));module[_0xed77('0x9')]=function(_0x442c72,_0xef8aca){return _0x442c72['define'](_0xed77('0xa'),attributes,{'tableName':_0xed77('0xb'),'paranoid':![],'indexes':[{'name':_0xed77('0xc'),'fields':[_0xed77('0xd'),_0xed77('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f96=['define','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x462388,_0xb3f752){var _0x1f5daa=function(_0x5ef434){while(--_0x5ef434){_0x462388['push'](_0x462388['shift']());}};_0x1f5daa(++_0xb3f752);}(_0x8f96,0x1b1));var _0x68f9=function(_0x103f0b,_0x37a842){_0x103f0b=_0x103f0b-0x0;var _0x37671b=_0x8f96[_0x103f0b];return _0x37671b;};'use strict';var _=require('lodash');var util=require(_0x68f9('0x0'));var logger=require(_0x68f9('0x1'))(_0x68f9('0x2'));var moment=require('moment');var BPromise=require(_0x68f9('0x3'));var rp=require(_0x68f9('0x4'));var fs=require('fs');var path=require(_0x68f9('0x5'));var rimraf=require(_0x68f9('0x6'));var config=require(_0x68f9('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x68f9('0x8')]=function(_0x37296f,_0x5b1fc3){return _0x37296f[_0x68f9('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x68f9('0xa'),'fields':[_0x68f9('0xb'),_0x68f9('0xc')],'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 040eedd..7349d81 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 _0xe514=['jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe514,0x119));var _0x4e51=function(_0x58bccd,_0x440125){_0x58bccd=_0x58bccd-0x0;var _0x2c22f6=_0xe514[_0x58bccd];return _0x2c22f6;};'use strict';var _=require(_0x4e51('0x0'));var util=require('util');var moment=require(_0x4e51('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e51('0x2'));var db=require(_0x4e51('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e51('0x4'))(_0x4e51('0x5'));var config=require(_0x4e51('0x6'));var jayson=require(_0x4e51('0x7'));var client=jayson['client'][_0x4e51('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xceb28c,_0x1395b3,_0x4d6663){return new BPromise(function(_0x4d9e85,_0x3cdad2){return client[_0x4e51('0x9')](_0xceb28c,_0x4d6663)[_0x4e51('0xa')](function(_0x2ae89e){logger[_0x4e51('0xb')](_0x4e51('0xc'),_0x1395b3,_0x4e51('0xd'));logger['debug'](_0x4e51('0xe'),_0x1395b3,_0x4e51('0xd'),JSON['stringify'](_0x2ae89e));if(_0x2ae89e['error']){if(_0x2ae89e[_0x4e51('0xf')][_0x4e51('0x10')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x1395b3,_0x2ae89e[_0x4e51('0xf')]['message']);return _0x3cdad2(_0x2ae89e[_0x4e51('0xf')][_0x4e51('0x11')]);}logger[_0x4e51('0xf')](_0x4e51('0xc'),_0x1395b3,_0x2ae89e['error'][_0x4e51('0x11')]);return _0x4d9e85(_0x2ae89e['error'][_0x4e51('0x11')]);}else{logger[_0x4e51('0xb')](_0x4e51('0xc'),_0x1395b3,'request\x20sent');_0x4d9e85(_0x2ae89e['result'][_0x4e51('0x11')]);}})['catch'](function(_0x13b8ab){logger['error'](_0x4e51('0xc'),_0x1395b3,_0x13b8ab);_0x3cdad2(_0x13b8ab);});});} \ No newline at end of file +var _0xd7bc=['../../config/environment','http','request','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0xd7bc,0xf7));var _0xcd7b=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xd7bc[_0x29e35f];return _0x266b74;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd7b('0x0'));var db=require(_0xcd7b('0x1'))['db'];var utils=require(_0xcd7b('0x2'));var logger=require(_0xcd7b('0x3'))(_0xcd7b('0x4'));var config=require(_0xcd7b('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd7b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x21b5ed,_0xdcbd71,_0x365f7f){return new BPromise(function(_0x2ee759,_0x186bf1){return client[_0xcd7b('0x7')](_0x21b5ed,_0x365f7f)['then'](function(_0x555972){logger[_0xcd7b('0x8')]('ZendeskField,\x20%s,\x20%s',_0xdcbd71,_0xcd7b('0x9'));logger['debug'](_0xcd7b('0xa'),_0xdcbd71,'request\x20sent',JSON[_0xcd7b('0xb')](_0x555972));if(_0x555972[_0xcd7b('0xc')]){if(_0x555972['error'][_0xcd7b('0xd')]===0x1f4){logger[_0xcd7b('0xc')](_0xcd7b('0xe'),_0xdcbd71,_0x555972['error'][_0xcd7b('0xf')]);return _0x186bf1(_0x555972[_0xcd7b('0xc')][_0xcd7b('0xf')]);}logger[_0xcd7b('0xc')]('ZendeskField,\x20%s,\x20%s',_0xdcbd71,_0x555972[_0xcd7b('0xc')]['message']);return _0x2ee759(_0x555972['error'][_0xcd7b('0xf')]);}else{logger[_0xcd7b('0x8')]('ZendeskField,\x20%s,\x20%s',_0xdcbd71,_0xcd7b('0x9'));_0x2ee759(_0x555972[_0xcd7b('0x10')][_0xcd7b('0xf')]);}})[_0xcd7b('0x11')](function(_0x532c72){logger['error'](_0xcd7b('0xe'),_0xdcbd71,_0x532c72);_0x186bf1(_0x532c72);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 50003c5..c9449fb 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 _0x6571=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','multer','util','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6571,0x81));var _0x1657=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6571[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x1657('0x0'));var util=require(_0x1657('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1657('0x2'));var router=express['Router']();var fs_extra=require(_0x1657('0x3'));var auth=require(_0x1657('0x4'));var interaction=require(_0x1657('0x5'));var config=require(_0x1657('0x6'));var controller=require(_0x1657('0x7'));router[_0x1657('0x8')]('/',auth[_0x1657('0x9')](),controller[_0x1657('0xa')]);router['get'](_0x1657('0xb'),auth[_0x1657('0x9')](),controller[_0x1657('0xc')]);router['get'](_0x1657('0xd'),auth[_0x1657('0x9')](),controller['getConfigurations']);router[_0x1657('0x8')](_0x1657('0xe'),auth[_0x1657('0x9')](),controller[_0x1657('0xf')]);router[_0x1657('0x10')]('/',auth[_0x1657('0x9')](),controller[_0x1657('0x11')]);router[_0x1657('0x10')](_0x1657('0xd'),auth[_0x1657('0x9')](),controller[_0x1657('0x12')]);router['put'](_0x1657('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1657('0x13')](_0x1657('0xb'),auth[_0x1657('0x9')](),controller[_0x1657('0x14')]);module[_0x1657('0x15')]=router; \ No newline at end of file +var _0x1ff7=['./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x470ad5,_0x2d7f1b){var _0x3b8b64=function(_0x3ffd9f){while(--_0x3ffd9f){_0x470ad5['push'](_0x470ad5['shift']());}};_0x3b8b64(++_0x2d7f1b);}(_0x1ff7,0x9f));var _0x71ff=function(_0x38d02b,_0x447c94){_0x38d02b=_0x38d02b-0x0;var _0x1d9909=_0x1ff7[_0x38d02b];return _0x1d9909;};'use strict';var multer=require(_0x71ff('0x0'));var util=require(_0x71ff('0x1'));var path=require('path');var timeout=require(_0x71ff('0x2'));var express=require(_0x71ff('0x3'));var router=express[_0x71ff('0x4')]();var fs_extra=require(_0x71ff('0x5'));var auth=require(_0x71ff('0x6'));var interaction=require(_0x71ff('0x7'));var config=require(_0x71ff('0x8'));var controller=require(_0x71ff('0x9'));router[_0x71ff('0xa')]('/',auth[_0x71ff('0xb')](),controller[_0x71ff('0xc')]);router[_0x71ff('0xa')](_0x71ff('0xd'),auth['isAuthenticated'](),controller[_0x71ff('0xe')]);router[_0x71ff('0xa')](_0x71ff('0xf'),auth[_0x71ff('0xb')](),controller[_0x71ff('0x10')]);router[_0x71ff('0xa')](_0x71ff('0x11'),auth['isAuthenticated'](),controller[_0x71ff('0x12')]);router[_0x71ff('0x13')]('/',auth[_0x71ff('0xb')](),controller[_0x71ff('0x14')]);router[_0x71ff('0x13')]('/:id/configurations',auth[_0x71ff('0xb')](),controller['addConfiguration']);router['put'](_0x71ff('0xd'),auth[_0x71ff('0xb')](),controller[_0x71ff('0x15')]);router['delete']('/:id',auth[_0x71ff('0xb')](),controller[_0x71ff('0x16')]);module[_0x71ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b770646..6e6c574 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 _0x17ba=['sequelize','exports','STRING'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x17ba,0xab));var _0xa17b=function(_0x207e1e,_0x2ff9ed){_0x207e1e=_0x207e1e-0x0;var _0x41e948=_0x17ba[_0x207e1e];return _0x41e948;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file +var _0xd64b=['STRING','sequelize'];(function(_0x112e9c,_0x3c4766){var _0x5ecb1d=function(_0x1918bf){while(--_0x1918bf){_0x112e9c['push'](_0x112e9c['shift']());}};_0x5ecb1d(++_0x3c4766);}(_0xd64b,0xc1));var _0xbd64=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0xd64b[_0x2842b4];return _0x2b9521;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d9840f1..c09c6f6 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 _0x8b99=['lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','filter','includeAll','include','then','rows','show','params','catch','body','getConfigurations','findOne','ZohoConfiguration','pick','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','message','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','push','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x42e459,_0xb13ae2){var _0x425062=function(_0x31fcdf){while(--_0x31fcdf){_0x42e459['push'](_0x42e459['shift']());}};_0x425062(++_0xb13ae2);}(_0x8b99,0x156));var _0x98b9=function(_0x2ca10e,_0xf44f7a){_0x2ca10e=_0x2ca10e-0x0;var _0x2b4d51=_0x8b99[_0x2ca10e];return _0x2b4d51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98b9('0x0'));var zipdir=require(_0x98b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b9('0x2'));var moment=require(_0x98b9('0x3'));var BPromise=require(_0x98b9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98b9('0x5'));var sox=require('sox');var csv=require(_0x98b9('0x6'));var ejs=require(_0x98b9('0x7'));var fs=require('fs');var fs_extra=require(_0x98b9('0x8'));var _=require(_0x98b9('0x9'));var squel=require(_0x98b9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x98b9('0x6'));var querystring=require('querystring');var Papa=require(_0x98b9('0xb'));var Redis=require(_0x98b9('0xc'));var authService=require(_0x98b9('0xd'));var qs=require(_0x98b9('0xe'));var as=require(_0x98b9('0xf'));var hardwareService=require(_0x98b9('0x10'));var logger=require(_0x98b9('0x11'))('api');var utils=require(_0x98b9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x98b9('0x13'));var db=require(_0x98b9('0x14'))['db'];var integrations=require(_0x98b9('0x15'));function respondWithStatusCode(_0x2d38a7,_0x98383b){_0x98383b=_0x98383b||0xcc;return function(_0x20eb6a){if(_0x20eb6a){return _0x2d38a7['sendStatus'](_0x98383b);}return _0x2d38a7[_0x98b9('0x16')](_0x98383b)['end']();};}function respondWithResult(_0x127c35,_0x4ef5a9){_0x4ef5a9=_0x4ef5a9||0xc8;return function(_0x11921a){if(_0x11921a){return _0x127c35[_0x98b9('0x16')](_0x4ef5a9)[_0x98b9('0x17')](_0x11921a);}};}function respondWithFilteredResult(_0x572dc1,_0x226f1b){return function(_0x54fcbb){if(_0x54fcbb){var _0x4a47b5=typeof _0x226f1b['offset']===_0x98b9('0x18')&&typeof _0x226f1b[_0x98b9('0x19')]===_0x98b9('0x18');var _0xe579c5=_0x54fcbb[_0x98b9('0x1a')];var _0x14c2e1=_0x4a47b5?0x0:_0x226f1b[_0x98b9('0x1b')];var _0x3607a5=_0x4a47b5?_0x54fcbb[_0x98b9('0x1a')]:_0x226f1b[_0x98b9('0x1b')]+_0x226f1b['limit'];var _0x39160b;if(_0x3607a5>=_0xe579c5){_0x3607a5=_0xe579c5;_0x39160b=0xc8;}else{_0x39160b=0xce;}_0x572dc1[_0x98b9('0x16')](_0x39160b);return _0x572dc1[_0x98b9('0x1c')](_0x98b9('0x1d'),_0x14c2e1+'-'+_0x3607a5+'/'+_0xe579c5)[_0x98b9('0x17')](_0x54fcbb);}return null;};}function patchUpdates(_0x1c1f80){return function(_0x40f87e){try{jsonpatch['apply'](_0x40f87e,_0x1c1f80,!![]);}catch(_0x26ac76){return BPromise[_0x98b9('0x1e')](_0x26ac76);}return _0x40f87e[_0x98b9('0x1f')]();};}function saveUpdates(_0x5a621a,_0x5d4e36){return function(_0x5f2cca){if(_0x5f2cca){return _0x5f2cca[_0x98b9('0x20')](_0x5a621a)['then'](function(_0xa64632){return _0xa64632;});}return null;};}function removeEntity(_0x2329a7,_0x1914f4){return function(_0x6af7){if(_0x6af7){return _0x6af7[_0x98b9('0x21')]()['then'](function(){_0x2329a7['status'](0xcc)[_0x98b9('0x22')]();});}};}function handleEntityNotFound(_0x189f3d,_0x136c59){return function(_0x36408d){if(!_0x36408d){_0x189f3d['sendStatus'](0x194);}return _0x36408d;};}function handleError(_0x4e8b23,_0x8f3d10){_0x8f3d10=_0x8f3d10||0x1f4;return function(_0x215a24){logger[_0x98b9('0x23')](_0x215a24[_0x98b9('0x24')]);if(_0x215a24[_0x98b9('0x25')]){delete _0x215a24[_0x98b9('0x25')];}_0x4e8b23[_0x98b9('0x16')](_0x8f3d10)[_0x98b9('0x26')](_0x215a24);};}exports[_0x98b9('0x27')]=function(_0xb3f4b0,_0x8f72d7){var _0x17d88c={},_0x24182f={},_0x353624={'count':0x0,'rows':[]};var _0x35206e=_[_0x98b9('0x28')](db[_0x98b9('0x29')][_0x98b9('0x2a')],function(_0x176076){return{'name':_0x176076[_0x98b9('0x2b')],'type':_0x176076[_0x98b9('0x2c')]['key']};});_0x24182f[_0x98b9('0x2d')]=_[_0x98b9('0x28')](_0x35206e,'name');_0x24182f[_0x98b9('0x2e')]=_[_0x98b9('0x2f')](_0xb3f4b0[_0x98b9('0x2e')]);_0x24182f['filters']=_[_0x98b9('0x30')](_0x24182f[_0x98b9('0x2d')],_0x24182f['query']);_0x17d88c[_0x98b9('0x31')]=_[_0x98b9('0x30')](_0x24182f['model'],qs[_0x98b9('0x32')](_0xb3f4b0['query'][_0x98b9('0x32')]));_0x17d88c[_0x98b9('0x31')]=_0x17d88c[_0x98b9('0x31')][_0x98b9('0x33')]?_0x17d88c[_0x98b9('0x31')]:_0x24182f[_0x98b9('0x2d')];if(!_0xb3f4b0[_0x98b9('0x2e')][_0x98b9('0x34')]('nolimit')){_0x17d88c[_0x98b9('0x19')]=qs[_0x98b9('0x19')](_0xb3f4b0[_0x98b9('0x2e')][_0x98b9('0x19')]);_0x17d88c[_0x98b9('0x1b')]=qs[_0x98b9('0x1b')](_0xb3f4b0['query']['offset']);}_0x17d88c[_0x98b9('0x35')]=qs[_0x98b9('0x36')](_0xb3f4b0['query']['sort']);_0x17d88c[_0x98b9('0x37')]=qs['filters'](_['pick'](_0xb3f4b0[_0x98b9('0x2e')],_0x24182f[_0x98b9('0x38')]),_0x35206e);if(_0xb3f4b0[_0x98b9('0x2e')]['filter']){_0x17d88c[_0x98b9('0x37')]=_[_0x98b9('0x39')](_0x17d88c[_0x98b9('0x37')],{'$or':_[_0x98b9('0x28')](_0x35206e,function(_0x43a990){if(_0x43a990[_0x98b9('0x2c')]!=='VIRTUAL'){var _0x16b20b={};_0x16b20b[_0x43a990[_0x98b9('0x25')]]={'$like':'%'+_0xb3f4b0[_0x98b9('0x2e')][_0x98b9('0x3a')]+'%'};return _0x16b20b;}})});}_0x17d88c=_[_0x98b9('0x39')]({},_0x17d88c,_0xb3f4b0['options']);var _0x31ce96={'where':_0x17d88c[_0x98b9('0x37')]};return db[_0x98b9('0x29')][_0x98b9('0x1a')](_0x31ce96)['then'](function(_0x525146){_0x353624['count']=_0x525146;if(_0xb3f4b0[_0x98b9('0x2e')][_0x98b9('0x3b')]){_0x17d88c[_0x98b9('0x3c')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x17d88c);})[_0x98b9('0x3d')](function(_0x1c68ba){_0x353624[_0x98b9('0x3e')]=_0x1c68ba;return _0x353624;})[_0x98b9('0x3d')](respondWithFilteredResult(_0x8f72d7,_0x17d88c))['catch'](handleError(_0x8f72d7,null));};exports[_0x98b9('0x3f')]=function(_0x5ea992,_0x177192){var _0x541519={'raw':![],'where':{'id':_0x5ea992[_0x98b9('0x40')]['id']}},_0x597ee9={};_0x597ee9[_0x98b9('0x2d')]=_['keys'](db[_0x98b9('0x29')]['rawAttributes']);_0x597ee9[_0x98b9('0x2e')]=_[_0x98b9('0x2f')](_0x5ea992[_0x98b9('0x2e')]);_0x597ee9[_0x98b9('0x38')]=_[_0x98b9('0x30')](_0x597ee9[_0x98b9('0x2d')],_0x597ee9[_0x98b9('0x2e')]);_0x541519[_0x98b9('0x31')]=_['intersection'](_0x597ee9[_0x98b9('0x2d')],qs['fields'](_0x5ea992[_0x98b9('0x2e')][_0x98b9('0x32')]));_0x541519['attributes']=_0x541519['attributes'][_0x98b9('0x33')]?_0x541519[_0x98b9('0x31')]:_0x597ee9[_0x98b9('0x2d')];if(_0x5ea992[_0x98b9('0x2e')][_0x98b9('0x3b')]){_0x541519[_0x98b9('0x3c')]=[{'all':!![]}];}_0x541519=_['merge']({},_0x541519,_0x5ea992['options']);return db[_0x98b9('0x29')]['find'](_0x541519)['then'](handleEntityNotFound(_0x177192,null))[_0x98b9('0x3d')](respondWithResult(_0x177192,null))[_0x98b9('0x41')](handleError(_0x177192,null));};exports['create']=function(_0x22cf0b,_0x407a4d){return db[_0x98b9('0x29')]['create'](_0x22cf0b[_0x98b9('0x42')],{})[_0x98b9('0x3d')](respondWithResult(_0x407a4d,0xc9))['catch'](handleError(_0x407a4d,null));};exports[_0x98b9('0x20')]=function(_0x2c1481,_0x2d3266){if(_0x2c1481[_0x98b9('0x42')]['id']){delete _0x2c1481['body']['id'];}return db[_0x98b9('0x29')]['find']({'where':{'id':_0x2c1481['params']['id']}})['then'](handleEntityNotFound(_0x2d3266,null))[_0x98b9('0x3d')](saveUpdates(_0x2c1481[_0x98b9('0x42')],null))[_0x98b9('0x3d')](respondWithResult(_0x2d3266,null))[_0x98b9('0x41')](handleError(_0x2d3266,null));};exports[_0x98b9('0x21')]=function(_0x53fa74,_0x351410){return db[_0x98b9('0x29')]['find']({'where':{'id':_0x53fa74['params']['id']}})[_0x98b9('0x3d')](handleEntityNotFound(_0x351410,null))[_0x98b9('0x3d')](removeEntity(_0x351410,null))['catch'](handleError(_0x351410,null));};exports[_0x98b9('0x43')]=function(_0xaaf03a,_0x322252,_0x2d0f36){var _0x39994b={};var _0x534ef4={};var _0x4c5974;var _0x200eaa;return db[_0x98b9('0x29')][_0x98b9('0x44')]({'where':{'id':_0xaaf03a[_0x98b9('0x40')]['id']}})[_0x98b9('0x3d')](handleEntityNotFound(_0x322252,null))['then'](function(_0x364166){if(_0x364166){_0x4c5974=_0x364166;_0x534ef4['model']=_[_0x98b9('0x2f')](db[_0x98b9('0x45')][_0x98b9('0x2a')]);_0x534ef4['query']=_[_0x98b9('0x2f')](_0xaaf03a[_0x98b9('0x2e')]);_0x534ef4['filters']=_[_0x98b9('0x30')](_0x534ef4[_0x98b9('0x2d')],_0x534ef4['query']);_0x39994b[_0x98b9('0x31')]=_[_0x98b9('0x30')](_0x534ef4[_0x98b9('0x2d')],qs[_0x98b9('0x32')](_0xaaf03a['query']['fields']));_0x39994b['attributes']=_0x39994b[_0x98b9('0x31')][_0x98b9('0x33')]?_0x39994b[_0x98b9('0x31')]:_0x534ef4[_0x98b9('0x2d')];_0x39994b[_0x98b9('0x35')]=qs['sort'](_0xaaf03a[_0x98b9('0x2e')]['sort']);_0x39994b[_0x98b9('0x37')]=qs[_0x98b9('0x38')](_[_0x98b9('0x46')](_0xaaf03a[_0x98b9('0x2e')],_0x534ef4['filters']));if(_0xaaf03a[_0x98b9('0x2e')]['filter']){_0x39994b[_0x98b9('0x37')]=_[_0x98b9('0x39')](_0x39994b[_0x98b9('0x37')],{'$or':_[_0x98b9('0x28')](_0x39994b[_0x98b9('0x31')],function(_0xf077db){var _0x2fa278={};_0x2fa278[_0xf077db]={'$like':'%'+_0xaaf03a['query'][_0x98b9('0x3a')]+'%'};return _0x2fa278;})});}_0x39994b=_[_0x98b9('0x39')]({},_0x39994b,_0xaaf03a[_0x98b9('0x47')]);return _0x4c5974[_0x98b9('0x43')](_0x39994b);}})[_0x98b9('0x3d')](function(_0x22da36){if(_0x22da36){_0x200eaa=_0x22da36[_0x98b9('0x33')];if(!_0xaaf03a[_0x98b9('0x2e')][_0x98b9('0x34')]('nolimit')){_0x39994b[_0x98b9('0x19')]=qs[_0x98b9('0x19')](_0xaaf03a[_0x98b9('0x2e')]['limit']);_0x39994b['offset']=qs['offset'](_0xaaf03a[_0x98b9('0x2e')][_0x98b9('0x1b')]);}return _0x4c5974['getConfigurations'](_0x39994b);}})[_0x98b9('0x3d')](function(_0x563293){if(_0x563293){return _0x563293?{'count':_0x200eaa,'rows':_0x563293}:null;}})[_0x98b9('0x3d')](respondWithResult(_0x322252,null))[_0x98b9('0x41')](handleError(_0x322252,null));};exports[_0x98b9('0x48')]=function(_0x471a55,_0x3e3019,_0x173a79){if(_0x471a55['body']['id']){delete _0x471a55[_0x98b9('0x42')]['id'];}return db[_0x98b9('0x29')]['findOne']({'where':{'id':_0x471a55['params']['id']}})[_0x98b9('0x3d')](handleEntityNotFound(_0x3e3019,null))[_0x98b9('0x3d')](function(_0x43e1bc){if(_0x43e1bc){_0x471a55[_0x98b9('0x42')][_0x98b9('0x49')]=_0x43e1bc['id'];_0x471a55[_0x98b9('0x42')][_0x98b9('0x4a')]=integrations[_0x98b9('0x4b')](_0x471a55[_0x98b9('0x42')][_0x98b9('0x4c')],_0x471a55['body'][_0x98b9('0x2c')]);_0x471a55[_0x98b9('0x42')][_0x98b9('0x4d')]=integrations['getDescriptions'](_0x471a55['body'][_0x98b9('0x4c')],_0x471a55['body'][_0x98b9('0x2c')]);return db[_0x98b9('0x45')][_0x98b9('0x4e')](_0x471a55['body'],{'include':[{'model':db['ZohoField'],'as':_0x98b9('0x4a')},{'model':db[_0x98b9('0x4f')],'as':_0x98b9('0x4d')}]});}return null;})['then'](respondWithResult(_0x3e3019,null))['catch'](handleError(_0x3e3019,null));};function getAccessToken(_0x2d9fd8){return new Promise(function(_0x370547,_0x2893a4){var _0x289e73;switch(_0x2d9fd8[_0x98b9('0x50')]){case'US':_0x289e73='https://accounts.zoho.com';break;case'AU':_0x289e73=_0x98b9('0x51');break;case'EU':_0x289e73=_0x98b9('0x52');break;case'IN':_0x289e73=_0x98b9('0x53');break;case'CN':_0x289e73='https://accounts.zoho.com.cn';break;default:_0x289e73=_0x98b9('0x52');break;}var _0x3c35c0={'method':_0x98b9('0x54'),'uri':_0x289e73+'/oauth/v2/token','qs':{'refresh_token':_0x2d9fd8[_0x98b9('0x55')],'client_id':_0x2d9fd8[_0x98b9('0x56')],'client_secret':_0x2d9fd8[_0x98b9('0x57')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3c35c0)[_0x98b9('0x3d')](function(_0x488344){if(_0x488344['access_token']){_0x370547(_0x488344[_0x98b9('0x58')]);}else{_0x2893a4(_0x98b9('0x59'));}})[_0x98b9('0x41')](function(_0xb78a07){_0x2893a4(_0xb78a07);});});}exports[_0x98b9('0x5a')]=function(_0x5bbf5f,_0x574833,_0x56d064){var _0x5f5500,_0x3d1eb6,_0x39654b,_0x16b43a,_0x4cffb3;return db[_0x98b9('0x29')][_0x98b9('0x44')]({'where':{'id':_0x5bbf5f[_0x98b9('0x40')]['id']},'attributes':['id','host',_0x98b9('0x50'),'clientId',_0x98b9('0x57'),_0x98b9('0x5b'),_0x98b9('0x5c'),_0x98b9('0x55')]})['then'](handleEntityNotFound(_0x574833,null))[_0x98b9('0x3d')](function(_0x2d9990){_0x4cffb3=_0x2d9990;_0x5f5500=_0x4cffb3[_0x98b9('0x5d')];_0x3d1eb6=_0x5f5500==='zoho.eu'?'eu':'com';_0x39654b=_0x4cffb3[_0x98b9('0x5b')];var _0x3a39dc=_0x39654b['slice'](-0x1);if(_0x3a39dc==='/'||_0x3a39dc==='\x5c'||_0x3a39dc===':'){_0x39654b=_0x39654b['substring'](0x0,_0x39654b['lastIndexOf'](_0x3a39dc));}if(!_0x4cffb3['refreshToken']){throw new Error(_0x98b9('0x5e'));}return getAccessToken(_0x4cffb3);})[_0x98b9('0x3d')](function(_0x107674){if(_0x107674){return rp({'method':_0x98b9('0x5f'),'uri':util[_0x98b9('0x60')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3d1eb6),'qs':{'module':_0x98b9('0x61')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x107674},'json':!![]});}})[_0x98b9('0x3d')](function(_0x1378a2){if(_0x1378a2){if(_0x1378a2['response']&&_0x1378a2[_0x98b9('0x62')][_0x98b9('0x23')]){throw new Error(_0x1378a2[_0x98b9('0x62')][_0x98b9('0x23')][_0x98b9('0x63')]);}var _0x2afcd5=[];var _0x4ce2ac=[];var _0x40022c=[_0x98b9('0x64'),_0x98b9('0x65'),'Description',_0x98b9('0x66'),_0x98b9('0x67'),'Call_Result',_0x98b9('0x68'),'Call_Type'];_0x4ce2ac=_[_0x98b9('0x69')](_0x1378a2[_0x98b9('0x32')],function(_0x205875){return _0x40022c[_0x98b9('0x6a')](_0x205875[_0x98b9('0x6b')]);});for(var _0x146a0e=0x0;_0x146a0e<_0x4ce2ac[_0x98b9('0x33')];_0x146a0e++){if(_0x4ce2ac[_0x146a0e][_0x98b9('0x6c')]===![]){_0x2afcd5[_0x98b9('0x6d')]({'id':_0x4ce2ac[_0x146a0e]['id'],'name':_0x4ce2ac[_0x146a0e]['display_label'],'custom':_0x4ce2ac[_0x146a0e]['custom_field'],'options':_0x4ce2ac[_0x146a0e][_0x98b9('0x6e')]===_0x98b9('0x6f')&&_0x4ce2ac[_0x146a0e][_0x98b9('0x70')][_0x98b9('0x33')]>-0x1?_[_0x98b9('0x28')](_0x4ce2ac[_0x146a0e][_0x98b9('0x70')],function(_0x323d27){return{'name':_0x323d27,'value':_0x323d27};}):[]});}}return{'count':_0x2afcd5['length'],'rows':_0x2afcd5};}else{return{'count':0x0,'rows':[]};}})[_0x98b9('0x3d')](respondWithResult(_0x574833,null))['catch'](function(_0x465c78){var _0x40b0ba=_0x5bbf5f[_0x98b9('0x2e')][_0x98b9('0x71')]?0x1f4:_0x465c78[_0x98b9('0x72')]||0x1f4;logger[_0x98b9('0x23')](_0x98b9('0x73'),_0x98b9('0x5a'),_0x40b0ba,JSON[_0x98b9('0x74')](_0x465c78));delete _0x465c78['name'];if(_0x40b0ba===0x191){_0x40b0ba=0x190;}_0x574833[_0x98b9('0x16')](_0x40b0ba)[_0x98b9('0x26')](_0x5bbf5f[_0x98b9('0x2e')][_0x98b9('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x465c78['statusCode']}:_0x465c78);});}; \ No newline at end of file +var _0xc4ae=['Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','code','host','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','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','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','error','name','index','map','ZohoAccount','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','params','length','find','catch','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','access_token'];(function(_0x42f5d8,_0x3cf60a){var _0x37464b=function(_0x2497e7){while(--_0x2497e7){_0x42f5d8['push'](_0x42f5d8['shift']());}};_0x37464b(++_0x3cf60a);}(_0xc4ae,0x12b));var _0xec4a=function(_0x529781,_0x2c76f5){_0x529781=_0x529781-0x0;var _0x19f16e=_0xc4ae[_0x529781];return _0x19f16e;};'use strict';var emlformat=require(_0xec4a('0x0'));var rimraf=require(_0xec4a('0x1'));var zipdir=require(_0xec4a('0x2'));var jsonpatch=require(_0xec4a('0x3'));var rp=require(_0xec4a('0x4'));var moment=require(_0xec4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec4a('0x6'));var util=require('util');var path=require(_0xec4a('0x7'));var sox=require(_0xec4a('0x8'));var csv=require(_0xec4a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec4a('0xa'));var _=require('lodash');var squel=require(_0xec4a('0xb'));var crypto=require(_0xec4a('0xc'));var jsforce=require(_0xec4a('0xd'));var deskjs=require(_0xec4a('0xe'));var toCsv=require(_0xec4a('0x9'));var querystring=require(_0xec4a('0xf'));var Papa=require(_0xec4a('0x10'));var Redis=require('ioredis');var authService=require(_0xec4a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xec4a('0x12'));var hardwareService=require(_0xec4a('0x13'));var logger=require(_0xec4a('0x14'))(_0xec4a('0x15'));var utils=require(_0xec4a('0x16'));var config=require(_0xec4a('0x17'));var licenseUtil=require(_0xec4a('0x18'));var db=require(_0xec4a('0x19'))['db'];var integrations=require(_0xec4a('0x1a'));function respondWithStatusCode(_0x422e9a,_0x2f2e79){_0x2f2e79=_0x2f2e79||0xcc;return function(_0x747c68){if(_0x747c68){return _0x422e9a[_0xec4a('0x1b')](_0x2f2e79);}return _0x422e9a['status'](_0x2f2e79)[_0xec4a('0x1c')]();};}function respondWithResult(_0x4f3e7a,_0x393d14){_0x393d14=_0x393d14||0xc8;return function(_0x56f130){if(_0x56f130){return _0x4f3e7a[_0xec4a('0x1d')](_0x393d14)[_0xec4a('0x1e')](_0x56f130);}};}function respondWithFilteredResult(_0x5ab9eb,_0xaf8945){return function(_0x5c40fe){if(_0x5c40fe){var _0x44439f=typeof _0xaf8945[_0xec4a('0x1f')]==='undefined'&&typeof _0xaf8945['limit']===_0xec4a('0x20');var _0xc5ce62=_0x5c40fe[_0xec4a('0x21')];var _0x42430b=_0x44439f?0x0:_0xaf8945['offset'];var _0x4dca59=_0x44439f?_0x5c40fe[_0xec4a('0x21')]:_0xaf8945[_0xec4a('0x1f')]+_0xaf8945[_0xec4a('0x22')];var _0x1a5f8f;if(_0x4dca59>=_0xc5ce62){_0x4dca59=_0xc5ce62;_0x1a5f8f=0xc8;}else{_0x1a5f8f=0xce;}_0x5ab9eb['status'](_0x1a5f8f);return _0x5ab9eb[_0xec4a('0x23')](_0xec4a('0x24'),_0x42430b+'-'+_0x4dca59+'/'+_0xc5ce62)['json'](_0x5c40fe);}return null;};}function patchUpdates(_0x2711a3){return function(_0x496b7a){try{jsonpatch['apply'](_0x496b7a,_0x2711a3,!![]);}catch(_0x53cbed){return BPromise[_0xec4a('0x25')](_0x53cbed);}return _0x496b7a['save']();};}function saveUpdates(_0x434b44,_0x489a0a){return function(_0x4dcad3){if(_0x4dcad3){return _0x4dcad3[_0xec4a('0x26')](_0x434b44)['then'](function(_0x1c81d2){return _0x1c81d2;});}return null;};}function removeEntity(_0xe601e,_0x4790c9){return function(_0x3b99cf){if(_0x3b99cf){return _0x3b99cf[_0xec4a('0x27')]()['then'](function(){_0xe601e[_0xec4a('0x1d')](0xcc)[_0xec4a('0x1c')]();});}};}function handleEntityNotFound(_0x52faf2,_0x3ff24f){return function(_0x56cffc){if(!_0x56cffc){_0x52faf2[_0xec4a('0x1b')](0x194);}return _0x56cffc;};}function handleError(_0xb9e3c1,_0xbcf4cc){_0xbcf4cc=_0xbcf4cc||0x1f4;return function(_0xf7114c){logger[_0xec4a('0x28')](_0xf7114c['stack']);if(_0xf7114c[_0xec4a('0x29')]){delete _0xf7114c[_0xec4a('0x29')];}_0xb9e3c1[_0xec4a('0x1d')](_0xbcf4cc)['send'](_0xf7114c);};}exports[_0xec4a('0x2a')]=function(_0x183699,_0x502571){var _0x4bbdc5={},_0x2761ee={},_0x442ea8={'count':0x0,'rows':[]};var _0x459a7c=_[_0xec4a('0x2b')](db[_0xec4a('0x2c')][_0xec4a('0x2d')],function(_0x2586d6){return{'name':_0x2586d6['fieldName'],'type':_0x2586d6['type'][_0xec4a('0x2e')]};});_0x2761ee[_0xec4a('0x2f')]=_[_0xec4a('0x2b')](_0x459a7c,_0xec4a('0x29'));_0x2761ee[_0xec4a('0x30')]=_[_0xec4a('0x31')](_0x183699[_0xec4a('0x30')]);_0x2761ee['filters']=_[_0xec4a('0x32')](_0x2761ee['model'],_0x2761ee['query']);_0x4bbdc5[_0xec4a('0x33')]=_[_0xec4a('0x32')](_0x2761ee[_0xec4a('0x2f')],qs[_0xec4a('0x34')](_0x183699[_0xec4a('0x30')][_0xec4a('0x34')]));_0x4bbdc5[_0xec4a('0x33')]=_0x4bbdc5[_0xec4a('0x33')]['length']?_0x4bbdc5['attributes']:_0x2761ee['model'];if(!_0x183699['query'][_0xec4a('0x35')](_0xec4a('0x36'))){_0x4bbdc5[_0xec4a('0x22')]=qs[_0xec4a('0x22')](_0x183699['query'][_0xec4a('0x22')]);_0x4bbdc5[_0xec4a('0x1f')]=qs[_0xec4a('0x1f')](_0x183699[_0xec4a('0x30')][_0xec4a('0x1f')]);}_0x4bbdc5['order']=qs[_0xec4a('0x37')](_0x183699[_0xec4a('0x30')][_0xec4a('0x37')]);_0x4bbdc5[_0xec4a('0x38')]=qs[_0xec4a('0x39')](_[_0xec4a('0x3a')](_0x183699['query'],_0x2761ee[_0xec4a('0x39')]),_0x459a7c);if(_0x183699[_0xec4a('0x30')][_0xec4a('0x3b')]){_0x4bbdc5[_0xec4a('0x38')]=_[_0xec4a('0x3c')](_0x4bbdc5[_0xec4a('0x38')],{'$or':_[_0xec4a('0x2b')](_0x459a7c,function(_0x1b151f){if(_0x1b151f[_0xec4a('0x3d')]!==_0xec4a('0x3e')){var _0x19ae24={};_0x19ae24[_0x1b151f[_0xec4a('0x29')]]={'$like':'%'+_0x183699[_0xec4a('0x30')]['filter']+'%'};return _0x19ae24;}})});}_0x4bbdc5=_[_0xec4a('0x3c')]({},_0x4bbdc5,_0x183699[_0xec4a('0x3f')]);var _0x38382c={'where':_0x4bbdc5[_0xec4a('0x38')]};return db[_0xec4a('0x2c')]['count'](_0x38382c)[_0xec4a('0x40')](function(_0x8bd61b){_0x442ea8[_0xec4a('0x21')]=_0x8bd61b;if(_0x183699[_0xec4a('0x30')][_0xec4a('0x41')]){_0x4bbdc5[_0xec4a('0x42')]=[{'all':!![]}];}return db[_0xec4a('0x2c')][_0xec4a('0x43')](_0x4bbdc5);})['then'](function(_0x5eab2c){_0x442ea8[_0xec4a('0x44')]=_0x5eab2c;return _0x442ea8;})[_0xec4a('0x40')](respondWithFilteredResult(_0x502571,_0x4bbdc5))['catch'](handleError(_0x502571,null));};exports['show']=function(_0x2cbadc,_0x4eb1ba){var _0x590950={'raw':![],'where':{'id':_0x2cbadc[_0xec4a('0x45')]['id']}},_0x4d74f8={};_0x4d74f8['model']=_[_0xec4a('0x31')](db[_0xec4a('0x2c')][_0xec4a('0x2d')]);_0x4d74f8['query']=_[_0xec4a('0x31')](_0x2cbadc[_0xec4a('0x30')]);_0x4d74f8['filters']=_[_0xec4a('0x32')](_0x4d74f8[_0xec4a('0x2f')],_0x4d74f8[_0xec4a('0x30')]);_0x590950['attributes']=_['intersection'](_0x4d74f8[_0xec4a('0x2f')],qs[_0xec4a('0x34')](_0x2cbadc['query']['fields']));_0x590950[_0xec4a('0x33')]=_0x590950[_0xec4a('0x33')][_0xec4a('0x46')]?_0x590950['attributes']:_0x4d74f8[_0xec4a('0x2f')];if(_0x2cbadc[_0xec4a('0x30')][_0xec4a('0x41')]){_0x590950[_0xec4a('0x42')]=[{'all':!![]}];}_0x590950=_[_0xec4a('0x3c')]({},_0x590950,_0x2cbadc['options']);return db[_0xec4a('0x2c')][_0xec4a('0x47')](_0x590950)['then'](handleEntityNotFound(_0x4eb1ba,null))[_0xec4a('0x40')](respondWithResult(_0x4eb1ba,null))[_0xec4a('0x48')](handleError(_0x4eb1ba,null));};exports[_0xec4a('0x49')]=function(_0x4c00eb,_0x2a83de){return db['ZohoAccount'][_0xec4a('0x49')](_0x4c00eb['body'],{})['then'](respondWithResult(_0x2a83de,0xc9))['catch'](handleError(_0x2a83de,null));};exports[_0xec4a('0x26')]=function(_0x2c5d62,_0x3f91b1){if(_0x2c5d62[_0xec4a('0x4a')]['id']){delete _0x2c5d62[_0xec4a('0x4a')]['id'];}return db[_0xec4a('0x2c')][_0xec4a('0x47')]({'where':{'id':_0x2c5d62[_0xec4a('0x45')]['id']}})[_0xec4a('0x40')](handleEntityNotFound(_0x3f91b1,null))['then'](saveUpdates(_0x2c5d62[_0xec4a('0x4a')],null))[_0xec4a('0x40')](respondWithResult(_0x3f91b1,null))['catch'](handleError(_0x3f91b1,null));};exports[_0xec4a('0x27')]=function(_0x4e169e,_0xf2f219){return db[_0xec4a('0x2c')][_0xec4a('0x47')]({'where':{'id':_0x4e169e[_0xec4a('0x45')]['id']}})['then'](handleEntityNotFound(_0xf2f219,null))[_0xec4a('0x40')](removeEntity(_0xf2f219,null))[_0xec4a('0x48')](handleError(_0xf2f219,null));};exports[_0xec4a('0x4b')]=function(_0x507739,_0x4ade0b,_0x69d084){var _0xeb94e0={};var _0x4e0825={};var _0x5055df;var _0x4976bd;return db['ZohoAccount'][_0xec4a('0x4c')]({'where':{'id':_0x507739[_0xec4a('0x45')]['id']}})[_0xec4a('0x40')](handleEntityNotFound(_0x4ade0b,null))[_0xec4a('0x40')](function(_0x4df66c){if(_0x4df66c){_0x5055df=_0x4df66c;_0x4e0825[_0xec4a('0x2f')]=_[_0xec4a('0x31')](db['ZohoConfiguration'][_0xec4a('0x2d')]);_0x4e0825[_0xec4a('0x30')]=_['keys'](_0x507739[_0xec4a('0x30')]);_0x4e0825[_0xec4a('0x39')]=_['intersection'](_0x4e0825[_0xec4a('0x2f')],_0x4e0825[_0xec4a('0x30')]);_0xeb94e0['attributes']=_[_0xec4a('0x32')](_0x4e0825[_0xec4a('0x2f')],qs[_0xec4a('0x34')](_0x507739[_0xec4a('0x30')][_0xec4a('0x34')]));_0xeb94e0[_0xec4a('0x33')]=_0xeb94e0[_0xec4a('0x33')][_0xec4a('0x46')]?_0xeb94e0[_0xec4a('0x33')]:_0x4e0825[_0xec4a('0x2f')];_0xeb94e0[_0xec4a('0x4d')]=qs['sort'](_0x507739[_0xec4a('0x30')][_0xec4a('0x37')]);_0xeb94e0[_0xec4a('0x38')]=qs[_0xec4a('0x39')](_[_0xec4a('0x3a')](_0x507739['query'],_0x4e0825['filters']));if(_0x507739[_0xec4a('0x30')][_0xec4a('0x3b')]){_0xeb94e0[_0xec4a('0x38')]=_[_0xec4a('0x3c')](_0xeb94e0[_0xec4a('0x38')],{'$or':_['map'](_0xeb94e0['attributes'],function(_0x580030){var _0x5b34bb={};_0x5b34bb[_0x580030]={'$like':'%'+_0x507739[_0xec4a('0x30')][_0xec4a('0x3b')]+'%'};return _0x5b34bb;})});}_0xeb94e0=_['merge']({},_0xeb94e0,_0x507739[_0xec4a('0x3f')]);return _0x5055df[_0xec4a('0x4b')](_0xeb94e0);}})['then'](function(_0x497df1){if(_0x497df1){_0x4976bd=_0x497df1['length'];if(!_0x507739[_0xec4a('0x30')][_0xec4a('0x35')](_0xec4a('0x36'))){_0xeb94e0['limit']=qs[_0xec4a('0x22')](_0x507739['query']['limit']);_0xeb94e0[_0xec4a('0x1f')]=qs[_0xec4a('0x1f')](_0x507739[_0xec4a('0x30')]['offset']);}return _0x5055df[_0xec4a('0x4b')](_0xeb94e0);}})[_0xec4a('0x40')](function(_0x4abcf8){if(_0x4abcf8){return _0x4abcf8?{'count':_0x4976bd,'rows':_0x4abcf8}:null;}})[_0xec4a('0x40')](respondWithResult(_0x4ade0b,null))['catch'](handleError(_0x4ade0b,null));};exports[_0xec4a('0x4e')]=function(_0x12e21d,_0x3fe4e2,_0x5af7e8){if(_0x12e21d[_0xec4a('0x4a')]['id']){delete _0x12e21d[_0xec4a('0x4a')]['id'];}return db[_0xec4a('0x2c')][_0xec4a('0x4c')]({'where':{'id':_0x12e21d[_0xec4a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3fe4e2,null))['then'](function(_0x32b627){if(_0x32b627){_0x12e21d[_0xec4a('0x4a')][_0xec4a('0x4f')]=_0x32b627['id'];_0x12e21d[_0xec4a('0x4a')][_0xec4a('0x50')]=integrations[_0xec4a('0x51')](_0x12e21d[_0xec4a('0x4a')][_0xec4a('0x52')],_0x12e21d[_0xec4a('0x4a')]['type']);_0x12e21d[_0xec4a('0x4a')][_0xec4a('0x53')]=integrations[_0xec4a('0x54')](_0x12e21d[_0xec4a('0x4a')]['channel'],_0x12e21d['body']['type']);return db[_0xec4a('0x55')][_0xec4a('0x49')](_0x12e21d[_0xec4a('0x4a')],{'include':[{'model':db[_0xec4a('0x56')],'as':'Subjects'},{'model':db[_0xec4a('0x56')],'as':'Descriptions'}]});}return null;})[_0xec4a('0x40')](respondWithResult(_0x3fe4e2,null))[_0xec4a('0x48')](handleError(_0x3fe4e2,null));};function getAccessToken(_0x57422b){return new Promise(function(_0x2a7d79,_0x37cccc){var _0x3ca1b7;switch(_0x57422b[_0xec4a('0x57')]){case'US':_0x3ca1b7=_0xec4a('0x58');break;case'AU':_0x3ca1b7=_0xec4a('0x59');break;case'EU':_0x3ca1b7=_0xec4a('0x5a');break;case'IN':_0x3ca1b7=_0xec4a('0x5b');break;case'CN':_0x3ca1b7='https://accounts.zoho.com.cn';break;default:_0x3ca1b7='https://accounts.zoho.eu';break;}var _0x5e7bf7={'method':'POST','uri':_0x3ca1b7+'/oauth/v2/token','qs':{'refresh_token':_0x57422b[_0xec4a('0x5c')],'client_id':_0x57422b[_0xec4a('0x5d')],'client_secret':_0x57422b[_0xec4a('0x5e')],'grant_type':_0xec4a('0x5f')},'json':!![]};return rp(_0x5e7bf7)['then'](function(_0x495ff7){if(_0x495ff7[_0xec4a('0x60')]){_0x2a7d79(_0x495ff7['access_token']);}else{_0x37cccc(_0xec4a('0x61'));}})['catch'](function(_0x561d4c){_0x37cccc(_0x561d4c);});});}exports[_0xec4a('0x62')]=function(_0x21a920,_0x129ada,_0x3f07c1){var _0x23cb6e,_0x158348,_0xb1a580,_0x3a6c5b,_0x3eb412;return db['ZohoAccount'][_0xec4a('0x4c')]({'where':{'id':_0x21a920[_0xec4a('0x45')]['id']},'attributes':['id','host',_0xec4a('0x57'),'clientId','clientSecret','serverUrl',_0xec4a('0x63'),_0xec4a('0x5c')]})[_0xec4a('0x40')](handleEntityNotFound(_0x129ada,null))[_0xec4a('0x40')](function(_0x199c9a){_0x3eb412=_0x199c9a;_0x23cb6e=_0x3eb412[_0xec4a('0x64')];_0x158348=_0x23cb6e===_0xec4a('0x65')?'eu':_0xec4a('0x66');_0xb1a580=_0x3eb412['serverUrl'];var _0x5a64af=_0xb1a580['slice'](-0x1);if(_0x5a64af==='/'||_0x5a64af==='\x5c'||_0x5a64af===':'){_0xb1a580=_0xb1a580[_0xec4a('0x67')](0x0,_0xb1a580[_0xec4a('0x68')](_0x5a64af));}if(!_0x3eb412[_0xec4a('0x5c')]){throw new Error(_0xec4a('0x69'));}return getAccessToken(_0x3eb412);})[_0xec4a('0x40')](function(_0x732148){if(_0x732148){return rp({'method':_0xec4a('0x6a'),'uri':util[_0xec4a('0x6b')](_0xec4a('0x6c'),_0x158348),'qs':{'module':_0xec4a('0x6d')},'headers':{'Authorization':_0xec4a('0x6e')+_0x732148},'json':!![]});}})[_0xec4a('0x40')](function(_0x407983){if(_0x407983){if(_0x407983[_0xec4a('0x6f')]&&_0x407983[_0xec4a('0x6f')][_0xec4a('0x28')]){throw new Error(_0x407983[_0xec4a('0x6f')][_0xec4a('0x28')][_0xec4a('0x70')]);}var _0xbf4119=[];var _0x4745f6=[];var _0x2bb452=['Owner',_0xec4a('0x71'),_0xec4a('0x72'),_0xec4a('0x73'),_0xec4a('0x74'),_0xec4a('0x75'),_0xec4a('0x76'),'Call_Type'];_0x4745f6=_[_0xec4a('0x77')](_0x407983['fields'],function(_0x17fe36){return _0x2bb452['includes'](_0x17fe36[_0xec4a('0x78')]);});for(var _0x5c5121=0x0;_0x5c5121<_0x4745f6['length'];_0x5c5121++){if(_0x4745f6[_0x5c5121][_0xec4a('0x79')]===![]){_0xbf4119[_0xec4a('0x7a')]({'id':_0x4745f6[_0x5c5121]['id'],'name':_0x4745f6[_0x5c5121][_0xec4a('0x7b')],'custom':_0x4745f6[_0x5c5121][_0xec4a('0x7c')],'options':_0x4745f6[_0x5c5121]['data_type']==='picklist'&&_0x4745f6[_0x5c5121][_0xec4a('0x7d')][_0xec4a('0x46')]>-0x1?_[_0xec4a('0x2b')](_0x4745f6[_0x5c5121][_0xec4a('0x7d')],function(_0x560931){return{'name':_0x560931,'value':_0x560931};}):[]});}}return{'count':_0xbf4119[_0xec4a('0x46')],'rows':_0xbf4119};}else{return{'count':0x0,'rows':[]};}})[_0xec4a('0x40')](respondWithResult(_0x129ada,null))[_0xec4a('0x48')](function(_0x2299d3){var _0x2416f0=_0x21a920['query'][_0xec4a('0x7e')]?0x1f4:_0x2299d3[_0xec4a('0x7f')]||0x1f4;logger[_0xec4a('0x28')](_0xec4a('0x80'),_0xec4a('0x62'),_0x2416f0,JSON[_0xec4a('0x81')](_0x2299d3));delete _0x2299d3[_0xec4a('0x29')];if(_0x2416f0===0x191){_0x2416f0=0x190;}_0x129ada[_0xec4a('0x1d')](_0x2416f0)[_0xec4a('0x82')](_0x21a920[_0xec4a('0x30')][_0xec4a('0x7e')]?{'message':_0xec4a('0x83'),'statusCode':_0x2299d3[_0xec4a('0x7f')]}:_0x2299d3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 208dd22..761d93d 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 _0x0bb0=['error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','authorization_code','application/x-www-form-urlencoded','lodash','../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0xb625f8,_0x1765df){var _0x3779f6=function(_0xcfa125){while(--_0xcfa125){_0xb625f8['push'](_0xb625f8['shift']());}};_0x3779f6(++_0x1765df);}(_0x0bb0,0x11e));var _0x00bb=function(_0x2d9d50,_0x42bfc0){_0x2d9d50=_0x2d9d50-0x0;var _0x393a78=_0x0bb0[_0x2d9d50];return _0x393a78;};'use strict';var _=require(_0x00bb('0x0'));var util=require('util');var logger=require(_0x00bb('0x1'))(_0x00bb('0x2'));var moment=require(_0x00bb('0x3'));var BPromise=require(_0x00bb('0x4'));var rp=require(_0x00bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x00bb('0x6'));module[_0x00bb('0x7')]=function(_0x2cbaa5,_0x237e7c){return _0x2cbaa5[_0x00bb('0x8')](_0x00bb('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x102a16,_0x5a534e,_0x452857){if(_0x102a16[_0x00bb('0xa')](_0x00bb('0xb'))||_0x102a16[_0x00bb('0xa')](_0x00bb('0xc'))||_0x102a16[_0x00bb('0xa')](_0x00bb('0xd'))||_0x102a16[_0x00bb('0xa')](_0x00bb('0xe'))||_0x102a16['changed']('code')||_0x102a16[_0x00bb('0xa')](_0x00bb('0xf'))){var _0x25222,_0x1e8db8;_0x25222=_0x102a16['serverUrl'];var _0x463d1e=_0x25222[_0x00bb('0x10')](-0x1);if(_0x463d1e==='/'||_0x463d1e==='\x5c'||_0x463d1e===':'){_0x25222=_0x25222[_0x00bb('0x11')](0x0,_0x25222[_0x00bb('0x12')](_0x463d1e));}switch(_0x102a16[_0x00bb('0xb')]){case'US':_0x1e8db8=_0x00bb('0x13');break;case'AU':_0x1e8db8=_0x00bb('0x14');break;case'IN':_0x1e8db8=_0x00bb('0x15');break;case'CN':_0x1e8db8=_0x00bb('0x16');break;default:_0x1e8db8=_0x00bb('0x17');break;}var _0x1c70f6={'method':'POST','uri':_0x1e8db8+_0x00bb('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x102a16[_0x00bb('0xd')],'client_secret':_0x102a16['clientSecret'],'redirect_uri':_0x102a16[_0x00bb('0xc')],'code':_0x102a16[_0x00bb('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1c70f6)[_0x00bb('0x1a')](function(_0x13c31e){var _0x3f84dc=JSON[_0x00bb('0x1b')](_0x13c31e);if(_0x3f84dc[_0x00bb('0x1c')]){_0x102a16[_0x00bb('0x1d')]=_0x3f84dc[_0x00bb('0x1c')];logger[_0x00bb('0x1e')](util[_0x00bb('0x1f')](_0x00bb('0x20'),_0x102a16[_0x00bb('0x21')],_0x102a16['id']));}else{logger[_0x00bb('0x22')](util[_0x00bb('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x102a16[_0x00bb('0x21')],_0x102a16['id']),util[_0x00bb('0x23')](_0x3f84dc,{'showHidden':![],'depth':null}));}return _0x452857(null,_0x5a534e);})[_0x00bb('0x24')](function(_0x23c44d){logger[_0x00bb('0x22')](util[_0x00bb('0x1f')](_0x00bb('0x25'),_0x102a16[_0x00bb('0x21')],_0x102a16['id']),util[_0x00bb('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x452857(_0x23c44d);});}else{return _0x452857(null,_0x5a534e);}},'beforeUpdate':function(_0x2b1070,_0x1a1fff,_0x3b85dd){if(_0x2b1070[_0x00bb('0xa')]('zone')||_0x2b1070[_0x00bb('0xa')](_0x00bb('0xc'))||_0x2b1070[_0x00bb('0xa')](_0x00bb('0xd'))||_0x2b1070[_0x00bb('0xa')](_0x00bb('0xe'))||_0x2b1070[_0x00bb('0xa')](_0x00bb('0x19'))||_0x2b1070[_0x00bb('0xa')](_0x00bb('0xf'))){var _0x4d2e79,_0x42d4e2;_0x4d2e79=_0x2b1070['serverUrl'];var _0x1e7376=_0x4d2e79[_0x00bb('0x10')](-0x1);if(_0x1e7376==='/'||_0x1e7376==='\x5c'||_0x1e7376===':'){_0x4d2e79=_0x4d2e79[_0x00bb('0x11')](0x0,_0x4d2e79[_0x00bb('0x12')](_0x1e7376));}switch(_0x2b1070[_0x00bb('0xb')]){case'US':_0x42d4e2='https://accounts.zoho.com';break;case'AU':_0x42d4e2=_0x00bb('0x14');break;case'IN':_0x42d4e2=_0x00bb('0x15');break;case'CN':_0x42d4e2=_0x00bb('0x16');break;default:_0x42d4e2=_0x00bb('0x17');break;}var _0xffab86={'method':'POST','uri':_0x42d4e2+'/oauth/v2/token','form':{'grant_type':_0x00bb('0x26'),'client_id':_0x2b1070[_0x00bb('0xd')],'client_secret':_0x2b1070[_0x00bb('0xe')],'redirect_uri':_0x2b1070[_0x00bb('0xc')],'code':_0x2b1070[_0x00bb('0x19')]},'headers':{'Content-Type':_0x00bb('0x27')}};return rp(_0xffab86)[_0x00bb('0x1a')](function(_0x3d0660){var _0x2e5a6a=JSON['parse'](_0x3d0660);if(_0x2e5a6a['refresh_token']){_0x2b1070['refreshToken']=_0x2e5a6a[_0x00bb('0x1c')];logger[_0x00bb('0x1e')](util[_0x00bb('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2b1070[_0x00bb('0x21')],_0x2b1070['id']));}else{logger[_0x00bb('0x22')](util[_0x00bb('0x1f')](_0x00bb('0x25'),_0x2b1070[_0x00bb('0x21')],_0x2b1070['id']),util['inspect'](_0x2e5a6a,{'showHidden':![],'depth':null}));}return _0x3b85dd(null,_0x1a1fff);})[_0x00bb('0x24')](function(_0x3ee626){logger[_0x00bb('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2b1070[_0x00bb('0x21')],_0x2b1070['id']),util[_0x00bb('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b85dd(_0x3ee626);});}else{return _0x3b85dd(null,_0x1a1fff);}}}});}; \ No newline at end of file +var _0xa77c=['zone','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','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','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','authorization_code','lodash','util','api','moment','bluebird','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x50ae91,_0x5de6f1){var _0x3934ad=function(_0x5ac578){while(--_0x5ac578){_0x50ae91['push'](_0x50ae91['shift']());}};_0x3934ad(++_0x5de6f1);}(_0xa77c,0x112));var _0xca77=function(_0x56ed90,_0x17d67d){_0x56ed90=_0x56ed90-0x0;var _0x42a0fa=_0xa77c[_0x56ed90];return _0x42a0fa;};'use strict';var _=require(_0xca77('0x0'));var util=require(_0xca77('0x1'));var logger=require('../../config/logger')(_0xca77('0x2'));var moment=require(_0xca77('0x3'));var BPromise=require(_0xca77('0x4'));var rp=require(_0xca77('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xca77('0x6'));var integrations=require(_0xca77('0x7'));module[_0xca77('0x8')]=function(_0x5da321,_0x2b1b9a){return _0x5da321[_0xca77('0x9')]('ZohoAccount',attributes,{'tableName':_0xca77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f5663,_0x6d395c,_0x526298){if(_0x5f5663[_0xca77('0xb')]('zone')||_0x5f5663['changed'](_0xca77('0xc'))||_0x5f5663['changed'](_0xca77('0xd'))||_0x5f5663['changed'](_0xca77('0xe'))||_0x5f5663['changed'](_0xca77('0xf'))||_0x5f5663[_0xca77('0xb')](_0xca77('0x10'))){var _0x2993ef,_0x363be8;_0x2993ef=_0x5f5663[_0xca77('0xc')];var _0x2dd1b9=_0x2993ef[_0xca77('0x11')](-0x1);if(_0x2dd1b9==='/'||_0x2dd1b9==='\x5c'||_0x2dd1b9===':'){_0x2993ef=_0x2993ef[_0xca77('0x12')](0x0,_0x2993ef[_0xca77('0x13')](_0x2dd1b9));}switch(_0x5f5663[_0xca77('0x14')]){case'US':_0x363be8=_0xca77('0x15');break;case'AU':_0x363be8=_0xca77('0x16');break;case'IN':_0x363be8=_0xca77('0x17');break;case'CN':_0x363be8=_0xca77('0x18');break;default:_0x363be8=_0xca77('0x19');break;}var _0x433a05={'method':_0xca77('0x1a'),'uri':_0x363be8+_0xca77('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x5f5663[_0xca77('0xd')],'client_secret':_0x5f5663['clientSecret'],'redirect_uri':_0x5f5663[_0xca77('0xc')],'code':_0x5f5663[_0xca77('0xf')]},'headers':{'Content-Type':_0xca77('0x1c')}};return rp(_0x433a05)[_0xca77('0x1d')](function(_0xab404e){var _0x11f85d=JSON[_0xca77('0x1e')](_0xab404e);if(_0x11f85d[_0xca77('0x1f')]){_0x5f5663[_0xca77('0x20')]=_0x11f85d[_0xca77('0x1f')];logger[_0xca77('0x21')](util[_0xca77('0x22')](_0xca77('0x23'),_0x5f5663[_0xca77('0x24')],_0x5f5663['id']));}else{logger[_0xca77('0x25')](util[_0xca77('0x22')](_0xca77('0x26'),_0x5f5663[_0xca77('0x24')],_0x5f5663['id']),util['inspect'](_0x11f85d,{'showHidden':![],'depth':null}));}return _0x526298(null,_0x6d395c);})[_0xca77('0x27')](function(_0x513bd8){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5f5663[_0xca77('0x24')],_0x5f5663['id']),util[_0xca77('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x526298(_0x513bd8);});}else{return _0x526298(null,_0x6d395c);}},'beforeUpdate':function(_0x6c27e4,_0x1d8f31,_0x2cf6e4){if(_0x6c27e4[_0xca77('0xb')]('zone')||_0x6c27e4[_0xca77('0xb')](_0xca77('0xc'))||_0x6c27e4['changed'](_0xca77('0xd'))||_0x6c27e4[_0xca77('0xb')](_0xca77('0xe'))||_0x6c27e4[_0xca77('0xb')](_0xca77('0xf'))||_0x6c27e4[_0xca77('0xb')]('host')){var _0x32eba8,_0x12c3c7;_0x32eba8=_0x6c27e4['serverUrl'];var _0x1b87e7=_0x32eba8[_0xca77('0x11')](-0x1);if(_0x1b87e7==='/'||_0x1b87e7==='\x5c'||_0x1b87e7===':'){_0x32eba8=_0x32eba8[_0xca77('0x12')](0x0,_0x32eba8['lastIndexOf'](_0x1b87e7));}switch(_0x6c27e4[_0xca77('0x14')]){case'US':_0x12c3c7=_0xca77('0x15');break;case'AU':_0x12c3c7='https://accounts.zoho.com.au';break;case'IN':_0x12c3c7='https://accounts.zoho.in';break;case'CN':_0x12c3c7=_0xca77('0x18');break;default:_0x12c3c7='https://accounts.zoho.eu';break;}var _0x2ed879={'method':_0xca77('0x1a'),'uri':_0x12c3c7+'/oauth/v2/token','form':{'grant_type':_0xca77('0x29'),'client_id':_0x6c27e4['clientId'],'client_secret':_0x6c27e4[_0xca77('0xe')],'redirect_uri':_0x6c27e4[_0xca77('0xc')],'code':_0x6c27e4[_0xca77('0xf')]},'headers':{'Content-Type':_0xca77('0x1c')}};return rp(_0x2ed879)[_0xca77('0x1d')](function(_0x50d03b){var _0x5d2275=JSON[_0xca77('0x1e')](_0x50d03b);if(_0x5d2275[_0xca77('0x1f')]){_0x6c27e4[_0xca77('0x20')]=_0x5d2275[_0xca77('0x1f')];logger['info'](util[_0xca77('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x6c27e4[_0xca77('0x24')],_0x6c27e4['id']));}else{logger[_0xca77('0x25')](util[_0xca77('0x22')](_0xca77('0x26'),_0x6c27e4['name'],_0x6c27e4['id']),util[_0xca77('0x28')](_0x5d2275,{'showHidden':![],'depth':null}));}return _0x2cf6e4(null,_0x1d8f31);})[_0xca77('0x27')](function(_0x38b52f){logger['error'](util[_0xca77('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x6c27e4[_0xca77('0x24')],_0x6c27e4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2cf6e4(_0x38b52f);});}else{return _0x2cf6e4(null,_0x1d8f31);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 88de28b..c7a8cdc 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 _0x9666=['error','message','result','catch','GetZohoAccount','findAll','where','options','limit','include','map','model','attributes','then','ShowZohoAccount','ZohoAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa2db74,_0x31cb5e){var _0x181fa0=function(_0x362537){while(--_0x362537){_0xa2db74['push'](_0xa2db74['shift']());}};_0x181fa0(++_0x31cb5e);}(_0x9666,0x17a));var _0x6966=function(_0x24f39b,_0x299ee2){_0x24f39b=_0x24f39b-0x0;var _0x4252af=_0x9666[_0x24f39b];return _0x4252af;};'use strict';var _=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var moment=require(_0x6966('0x2'));var BPromise=require(_0x6966('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6966('0x4'));var db=require(_0x6966('0x5'))['db'];var utils=require(_0x6966('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6966('0x7'));var jayson=require(_0x6966('0x8'));var client=jayson[_0x6966('0x9')][_0x6966('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x363f5f,_0x18fa4c,_0x484a87){return new BPromise(function(_0xb381c4,_0x3d08bf){return client[_0x6966('0xb')](_0x363f5f,_0x484a87)['then'](function(_0x38aed6){logger[_0x6966('0xc')](_0x6966('0xd'),_0x18fa4c,_0x6966('0xe'));logger[_0x6966('0xf')](_0x6966('0x10'),_0x18fa4c,_0x6966('0xe'),JSON[_0x6966('0x11')](_0x38aed6));if(_0x38aed6[_0x6966('0x12')]){if(_0x38aed6[_0x6966('0x12')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x18fa4c,_0x38aed6[_0x6966('0x12')][_0x6966('0x13')]);return _0x3d08bf(_0x38aed6[_0x6966('0x12')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x18fa4c,_0x38aed6[_0x6966('0x12')][_0x6966('0x13')]);return _0xb381c4(_0x38aed6[_0x6966('0x12')][_0x6966('0x13')]);}else{logger[_0x6966('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x18fa4c,_0x6966('0xe'));_0xb381c4(_0x38aed6[_0x6966('0x14')]['message']);}})[_0x6966('0x15')](function(_0x30f650){logger[_0x6966('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x18fa4c,_0x30f650);_0x3d08bf(_0x30f650);});});}exports[_0x6966('0x16')]=function(_0x4bf5b8){var _0x43e2e9=this;return new Promise(function(_0x519049,_0x5a4ea7){return db['ZohoAccount'][_0x6966('0x17')]({'raw':_0x4bf5b8['options']?_0x4bf5b8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bf5b8['options']?_0x4bf5b8['options'][_0x6966('0x18')]||null:null,'attributes':_0x4bf5b8[_0x6966('0x19')]?_0x4bf5b8[_0x6966('0x19')]['attributes']||null:null,'limit':_0x4bf5b8[_0x6966('0x19')]?_0x4bf5b8[_0x6966('0x19')][_0x6966('0x1a')]||null:null,'include':_0x4bf5b8[_0x6966('0x19')]?_0x4bf5b8[_0x6966('0x19')][_0x6966('0x1b')]?_[_0x6966('0x1c')](_0x4bf5b8[_0x6966('0x19')][_0x6966('0x1b')],function(_0x509631){return{'model':db[_0x509631[_0x6966('0x1d')]],'as':_0x509631['as'],'attributes':_0x509631[_0x6966('0x1e')],'include':_0x509631[_0x6966('0x1b')]?_[_0x6966('0x1c')](_0x509631[_0x6966('0x1b')],function(_0x27db0e){return{'model':db[_0x27db0e[_0x6966('0x1d')]],'as':_0x27db0e['as'],'attributes':_0x27db0e['attributes'],'include':_0x27db0e[_0x6966('0x1b')]?_['map'](_0x27db0e[_0x6966('0x1b')],function(_0x4f7aa2){return{'model':db[_0x4f7aa2[_0x6966('0x1d')]],'as':_0x4f7aa2['as'],'attributes':_0x4f7aa2[_0x6966('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6966('0x1f')](function(_0x85106d){logger[_0x6966('0xc')](_0x6966('0x16'),_0x4bf5b8);logger[_0x6966('0xf')](_0x6966('0x16'),_0x4bf5b8,JSON[_0x6966('0x11')](_0x85106d));_0x519049(_0x85106d);})['catch'](function(_0x270919){logger[_0x6966('0x12')]('GetZohoAccount',_0x270919[_0x6966('0x13')],_0x4bf5b8);_0x5a4ea7(_0x43e2e9['error'](0x1f4,_0x270919[_0x6966('0x13')]));});});};exports[_0x6966('0x20')]=function(_0x171f19){var _0x452721=this;return new Promise(function(_0x40a50d,_0x472d75){return db[_0x6966('0x21')][_0x6966('0x22')]({'raw':_0x171f19[_0x6966('0x19')]?_0x171f19[_0x6966('0x19')][_0x6966('0x23')]===undefined?!![]:![]:!![],'where':_0x171f19[_0x6966('0x19')]?_0x171f19[_0x6966('0x19')][_0x6966('0x18')]||null:null,'attributes':_0x171f19[_0x6966('0x19')]?_0x171f19[_0x6966('0x19')]['attributes']||null:null,'include':_0x171f19[_0x6966('0x19')]?_0x171f19['options'][_0x6966('0x1b')]?_[_0x6966('0x1c')](_0x171f19[_0x6966('0x19')][_0x6966('0x1b')],function(_0x45a6ba){return{'model':db[_0x45a6ba[_0x6966('0x1d')]],'as':_0x45a6ba['as'],'attributes':_0x45a6ba[_0x6966('0x1e')],'include':_0x45a6ba[_0x6966('0x1b')]?_[_0x6966('0x1c')](_0x45a6ba[_0x6966('0x1b')],function(_0x5d9cb0){return{'model':db[_0x5d9cb0[_0x6966('0x1d')]],'as':_0x5d9cb0['as'],'attributes':_0x5d9cb0[_0x6966('0x1e')],'include':_0x5d9cb0[_0x6966('0x1b')]?_['map'](_0x5d9cb0['include'],function(_0xcfea9f){return{'model':db[_0xcfea9f[_0x6966('0x1d')]],'as':_0xcfea9f['as'],'attributes':_0xcfea9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6966('0x1f')](function(_0x54cd6a){logger['info'](_0x6966('0x20'),_0x171f19);logger[_0x6966('0xf')](_0x6966('0x20'),_0x171f19,JSON[_0x6966('0x11')](_0x54cd6a));_0x40a50d(_0x54cd6a);})['catch'](function(_0x40667f){logger[_0x6966('0x12')](_0x6966('0x20'),_0x40667f[_0x6966('0x13')],_0x171f19);_0x472d75(_0x452721[_0x6966('0x12')](0x1f4,_0x40667f[_0x6966('0x13')]));});});}; \ No newline at end of file +var _0xc6c0=['map','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','model'];(function(_0x10c257,_0x4d38a7){var _0x3c5e10=function(_0x469ea2){while(--_0x469ea2){_0x10c257['push'](_0x10c257['shift']());}};_0x3c5e10(++_0x4d38a7);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xc6c0[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1791cb,_0x223b4f,_0x51208d){return new BPromise(function(_0x2e0cd9,_0x15c862){return client[_0x0c6c('0xb')](_0x1791cb,_0x51208d)[_0x0c6c('0xc')](function(_0x317bcf){logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));logger[_0x0c6c('0x10')](_0x0c6c('0x11'),_0x223b4f,_0x0c6c('0xf'),JSON[_0x0c6c('0x12')](_0x317bcf));if(_0x317bcf['error']){if(_0x317bcf[_0x0c6c('0x13')]['code']===0x1f4){logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x15c862(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x2e0cd9(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}else{logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));_0x2e0cd9(_0x317bcf[_0x0c6c('0x15')]['message']);}})[_0x0c6c('0x16')](function(_0x527ade){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x223b4f,_0x527ade);_0x15c862(_0x527ade);});});}exports[_0x0c6c('0x17')]=function(_0x530333){var _0x9463e8=this;return new Promise(function(_0x50be43,_0x316dbe){return db[_0x0c6c('0x18')][_0x0c6c('0x19')]({'raw':_0x530333[_0x0c6c('0x1a')]?_0x530333['options'][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1d')]||null:null,'limit':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')]['limit']||null:null,'include':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_['map'](_0x530333[_0x0c6c('0x1a')]['include'],function(_0x76992){return{'model':db[_0x76992[_0x0c6c('0x1f')]],'as':_0x76992['as'],'attributes':_0x76992[_0x0c6c('0x1d')],'include':_0x76992['include']?_[_0x0c6c('0x20')](_0x76992[_0x0c6c('0x1e')],function(_0x200a47){return{'model':db[_0x200a47[_0x0c6c('0x1f')]],'as':_0x200a47['as'],'attributes':_0x200a47[_0x0c6c('0x1d')],'include':_0x200a47[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x200a47[_0x0c6c('0x1e')],function(_0x194637){return{'model':db[_0x194637[_0x0c6c('0x1f')]],'as':_0x194637['as'],'attributes':_0x194637['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c6c('0xc')](function(_0x557046){logger[_0x0c6c('0xd')]('GetZohoAccount',_0x530333);logger[_0x0c6c('0x10')](_0x0c6c('0x17'),_0x530333,JSON[_0x0c6c('0x12')](_0x557046));_0x50be43(_0x557046);})[_0x0c6c('0x16')](function(_0x2cbfc7){logger[_0x0c6c('0x13')](_0x0c6c('0x17'),_0x2cbfc7[_0x0c6c('0x14')],_0x530333);_0x316dbe(_0x9463e8['error'](0x1f4,_0x2cbfc7[_0x0c6c('0x14')]));});});};exports[_0x0c6c('0x21')]=function(_0x5ec5bc){var _0x40d708=this;return new Promise(function(_0x556dad,_0x37357b){return db[_0x0c6c('0x18')][_0x0c6c('0x22')]({'raw':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x5ec5bc['options']?_0x5ec5bc['options'][_0x0c6c('0x1d')]||null:null,'include':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5ec5bc[_0x0c6c('0x1a')]['include'],function(_0x3c97d1){return{'model':db[_0x3c97d1['model']],'as':_0x3c97d1['as'],'attributes':_0x3c97d1[_0x0c6c('0x1d')],'include':_0x3c97d1['include']?_[_0x0c6c('0x20')](_0x3c97d1[_0x0c6c('0x1e')],function(_0x5951f2){return{'model':db[_0x5951f2['model']],'as':_0x5951f2['as'],'attributes':_0x5951f2[_0x0c6c('0x1d')],'include':_0x5951f2[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5951f2[_0x0c6c('0x1e')],function(_0x4ed556){return{'model':db[_0x4ed556[_0x0c6c('0x1f')]],'as':_0x4ed556['as'],'attributes':_0x4ed556[_0x0c6c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9d6ee8){logger[_0x0c6c('0xd')](_0x0c6c('0x21'),_0x5ec5bc);logger['debug'](_0x0c6c('0x21'),_0x5ec5bc,JSON[_0x0c6c('0x12')](_0x9d6ee8));_0x556dad(_0x9d6ee8);})[_0x0c6c('0x16')](function(_0x93e98a){logger[_0x0c6c('0x13')](_0x0c6c('0x21'),_0x93e98a[_0x0c6c('0x14')],_0x5ec5bc);_0x37357b(_0x40d708[_0x0c6c('0x13')](0x1f4,_0x93e98a[_0x0c6c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index af3de9c..ec063cc 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 _0x6834=['../../config/environment','get','isAuthenticated','index','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1da3e6,_0x231168){var _0xb746fa=function(_0x29759c){while(--_0x29759c){_0x1da3e6['push'](_0x1da3e6['shift']());}};_0xb746fa(++_0x231168);}(_0x6834,0x121));var _0x4683=function(_0x34460d,_0x35410a){_0x34460d=_0x34460d-0x0;var _0x367b61=_0x6834[_0x34460d];return _0x367b61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4683('0x0'));var timeout=require('connect-timeout');var express=require(_0x4683('0x1'));var router=express['Router']();var fs_extra=require(_0x4683('0x2'));var auth=require(_0x4683('0x3'));var interaction=require(_0x4683('0x4'));var config=require(_0x4683('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x4683('0x6')]('/',auth[_0x4683('0x7')](),controller[_0x4683('0x8')]);router[_0x4683('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x4683('0x9'),auth[_0x4683('0x7')](),controller['getFields']);router[_0x4683('0x6')](_0x4683('0xa'),auth[_0x4683('0x7')](),controller['getSubjects']);router[_0x4683('0x6')](_0x4683('0xb'),auth[_0x4683('0x7')](),controller[_0x4683('0xc')]);router[_0x4683('0xd')]('/',auth[_0x4683('0x7')](),controller[_0x4683('0xe')]);router[_0x4683('0xf')]('/:id',auth[_0x4683('0x7')](),controller[_0x4683('0x10')]);router[_0x4683('0x11')](_0x4683('0x12'),auth[_0x4683('0x7')](),controller[_0x4683('0x13')]);module[_0x4683('0x14')]=router; \ No newline at end of file +var _0x702d=['isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x1db778,_0x5a17fd){var _0x152586=function(_0x52d82c){while(--_0x52d82c){_0x1db778['push'](_0x1db778['shift']());}};_0x152586(++_0x5a17fd);}(_0x702d,0x147));var _0xd702=function(_0x481158,_0x69bfe0){_0x481158=_0x481158-0x0;var _0x26e860=_0x702d[_0x481158];return _0x26e860;};'use strict';var multer=require(_0xd702('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd702('0x1'));var router=express[_0xd702('0x2')]();var fs_extra=require(_0xd702('0x3'));var auth=require(_0xd702('0x4'));var interaction=require(_0xd702('0x5'));var config=require(_0xd702('0x6'));var controller=require(_0xd702('0x7'));router[_0xd702('0x8')]('/',auth[_0xd702('0x9')](),controller[_0xd702('0xa')]);router['get'](_0xd702('0xb'),auth[_0xd702('0x9')](),controller['show']);router[_0xd702('0x8')](_0xd702('0xc'),auth[_0xd702('0x9')](),controller[_0xd702('0xd')]);router[_0xd702('0x8')](_0xd702('0xe'),auth[_0xd702('0x9')](),controller['getSubjects']);router[_0xd702('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xd702('0xf')]);router[_0xd702('0x10')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0x13')]);module[_0xd702('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9d79f03..06e6053 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 _0x2e10=['lead','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x2e60c4,_0x1f06c6){var _0xd92e53=function(_0x59586c){while(--_0x59586c){_0x2e60c4['push'](_0x2e60c4['shift']());}};_0xd92e53(++_0x1f06c6);}(_0x2e10,0xe7));var _0x02e1=function(_0x375a22,_0x2377a0){_0x375a22=_0x375a22-0x0;var _0x11729f=_0x2e10[_0x375a22];return _0x11729f;};'use strict';var Sequelize=require(_0x02e1('0x0'));module[_0x02e1('0x1')]={'name':{'type':Sequelize[_0x02e1('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x02e1('0x3'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x02e1('0x4')](_0x02e1('0x5'),'contact',_0x02e1('0x3')),'defaultValue':_0x02e1('0x5')},'description':{'type':Sequelize[_0x02e1('0x2')]}}; \ No newline at end of file +var _0x5a96=['contact','nothing','sequelize','exports','ENUM','lead'];(function(_0x1f79c3,_0x5bc43e){var _0x25fe27=function(_0x5415fe){while(--_0x5415fe){_0x1f79c3['push'](_0x1f79c3['shift']());}};_0x25fe27(++_0x5bc43e);}(_0x5a96,0xbc));var _0x65a9=function(_0xe558ed,_0x552a46){_0xe558ed=_0xe558ed-0x0;var _0x1df48=_0x5a96[_0xe558ed];return _0x1df48;};'use strict';var Sequelize=require(_0x65a9('0x0'));module[_0x65a9('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x65a9('0x2')](_0x65a9('0x3'),_0x65a9('0x4'),_0x65a9('0x5')),'defaultValue':_0x65a9('0x3')},'moduleSearch':{'type':Sequelize[_0x65a9('0x2')]('contact_lead',_0x65a9('0x4'),'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 2b8f4b2..28adebb 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 _0xdc94=['findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','error','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','params','keys','include','find','create','body','catch'];(function(_0x225e85,_0x2fd3b6){var _0x476964=function(_0x3389e7){while(--_0x3389e7){_0x225e85['push'](_0x225e85['shift']());}};_0x476964(++_0x2fd3b6);}(_0xdc94,0xaa));var _0x4dc9=function(_0x3bc1c4,_0x543c2a){_0x3bc1c4=_0x3bc1c4-0x0;var _0x1e65c4=_0xdc94[_0x3bc1c4];return _0x1e65c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4dc9('0x0'));var zipdir=require(_0x4dc9('0x1'));var jsonpatch=require(_0x4dc9('0x2'));var rp=require('request-promise');var moment=require(_0x4dc9('0x3'));var BPromise=require(_0x4dc9('0x4'));var Mustache=require(_0x4dc9('0x5'));var util=require(_0x4dc9('0x6'));var path=require(_0x4dc9('0x7'));var sox=require(_0x4dc9('0x8'));var csv=require(_0x4dc9('0x9'));var ejs=require(_0x4dc9('0xa'));var fs=require('fs');var fs_extra=require(_0x4dc9('0xb'));var _=require(_0x4dc9('0xc'));var squel=require(_0x4dc9('0xd'));var crypto=require(_0x4dc9('0xe'));var jsforce=require(_0x4dc9('0xf'));var deskjs=require(_0x4dc9('0x10'));var toCsv=require(_0x4dc9('0x9'));var querystring=require(_0x4dc9('0x11'));var Papa=require('papaparse');var Redis=require(_0x4dc9('0x12'));var authService=require(_0x4dc9('0x13'));var qs=require(_0x4dc9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dc9('0x15'));var logger=require(_0x4dc9('0x16'))(_0x4dc9('0x17'));var utils=require('../../config/utils');var config=require(_0x4dc9('0x18'));var licenseUtil=require(_0x4dc9('0x19'));var db=require(_0x4dc9('0x1a'))['db'];function respondWithStatusCode(_0x3e9ce9,_0x19f1ab){_0x19f1ab=_0x19f1ab||0xcc;return function(_0xe1faa4){if(_0xe1faa4){return _0x3e9ce9[_0x4dc9('0x1b')](_0x19f1ab);}return _0x3e9ce9[_0x4dc9('0x1c')](_0x19f1ab)[_0x4dc9('0x1d')]();};}function respondWithResult(_0x184be0,_0x26dacb){_0x26dacb=_0x26dacb||0xc8;return function(_0x5575a6){if(_0x5575a6){return _0x184be0['status'](_0x26dacb)[_0x4dc9('0x1e')](_0x5575a6);}};}function respondWithFilteredResult(_0x34d63d,_0x46f9ee){return function(_0x35ee2a){if(_0x35ee2a){var _0x3f123a=typeof _0x46f9ee[_0x4dc9('0x1f')]===_0x4dc9('0x20')&&typeof _0x46f9ee['limit']===_0x4dc9('0x20');var _0x163097=_0x35ee2a['count'];var _0x4944ce=_0x3f123a?0x0:_0x46f9ee[_0x4dc9('0x1f')];var _0x4ca2ba=_0x3f123a?_0x35ee2a[_0x4dc9('0x21')]:_0x46f9ee[_0x4dc9('0x1f')]+_0x46f9ee[_0x4dc9('0x22')];var _0x530613;if(_0x4ca2ba>=_0x163097){_0x4ca2ba=_0x163097;_0x530613=0xc8;}else{_0x530613=0xce;}_0x34d63d[_0x4dc9('0x1c')](_0x530613);return _0x34d63d[_0x4dc9('0x23')]('Content-Range',_0x4944ce+'-'+_0x4ca2ba+'/'+_0x163097)[_0x4dc9('0x1e')](_0x35ee2a);}return null;};}function patchUpdates(_0x5b9b90){return function(_0x286cb3){try{jsonpatch[_0x4dc9('0x24')](_0x286cb3,_0x5b9b90,!![]);}catch(_0x14e341){return BPromise[_0x4dc9('0x25')](_0x14e341);}return _0x286cb3[_0x4dc9('0x26')]();};}function saveUpdates(_0xde6513,_0x4b3b5c){return function(_0x4a4d77){if(_0x4a4d77){return _0x4a4d77[_0x4dc9('0x27')](_0xde6513)['then'](function(_0x1aee4f){return _0x1aee4f;});}return null;};}function removeEntity(_0x47f670,_0x599e78){return function(_0x427f1e){if(_0x427f1e){return _0x427f1e[_0x4dc9('0x28')]()[_0x4dc9('0x29')](function(){_0x47f670[_0x4dc9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10fb53,_0x4bf458){return function(_0x37c3a9){if(!_0x37c3a9){_0x10fb53[_0x4dc9('0x1b')](0x194);}return _0x37c3a9;};}function handleError(_0x320d5f,_0x4a482d){_0x4a482d=_0x4a482d||0x1f4;return function(_0x37cb66){logger[_0x4dc9('0x2a')](_0x37cb66['stack']);if(_0x37cb66['name']){delete _0x37cb66[_0x4dc9('0x2b')];}_0x320d5f[_0x4dc9('0x1c')](_0x4a482d)['send'](_0x37cb66);};}exports[_0x4dc9('0x2c')]=function(_0x1dab92,_0x329b28){var _0x11873f={},_0x1e721f={},_0x1ddf7b={'count':0x0,'rows':[]};var _0x5aa8c8=_[_0x4dc9('0x2d')](db[_0x4dc9('0x2e')][_0x4dc9('0x2f')],function(_0x471325){return{'name':_0x471325[_0x4dc9('0x30')],'type':_0x471325[_0x4dc9('0x31')][_0x4dc9('0x32')]};});_0x1e721f[_0x4dc9('0x33')]=_[_0x4dc9('0x2d')](_0x5aa8c8,_0x4dc9('0x2b'));_0x1e721f[_0x4dc9('0x34')]=_['keys'](_0x1dab92[_0x4dc9('0x34')]);_0x1e721f[_0x4dc9('0x35')]=_[_0x4dc9('0x36')](_0x1e721f['model'],_0x1e721f[_0x4dc9('0x34')]);_0x11873f[_0x4dc9('0x37')]=_[_0x4dc9('0x36')](_0x1e721f['model'],qs[_0x4dc9('0x38')](_0x1dab92[_0x4dc9('0x34')][_0x4dc9('0x38')]));_0x11873f['attributes']=_0x11873f[_0x4dc9('0x37')][_0x4dc9('0x39')]?_0x11873f[_0x4dc9('0x37')]:_0x1e721f[_0x4dc9('0x33')];if(!_0x1dab92[_0x4dc9('0x34')][_0x4dc9('0x3a')](_0x4dc9('0x3b'))){_0x11873f[_0x4dc9('0x22')]=qs[_0x4dc9('0x22')](_0x1dab92['query'][_0x4dc9('0x22')]);_0x11873f['offset']=qs['offset'](_0x1dab92[_0x4dc9('0x34')]['offset']);}_0x11873f[_0x4dc9('0x3c')]=qs['sort'](_0x1dab92[_0x4dc9('0x34')][_0x4dc9('0x3d')]);_0x11873f['where']=qs[_0x4dc9('0x35')](_['pick'](_0x1dab92['query'],_0x1e721f[_0x4dc9('0x35')]),_0x5aa8c8);if(_0x1dab92[_0x4dc9('0x34')][_0x4dc9('0x3e')]){_0x11873f[_0x4dc9('0x3f')]=_[_0x4dc9('0x40')](_0x11873f['where'],{'$or':_[_0x4dc9('0x2d')](_0x5aa8c8,function(_0x405c77){if(_0x405c77[_0x4dc9('0x31')]!==_0x4dc9('0x41')){var _0x5dae03={};_0x5dae03[_0x405c77[_0x4dc9('0x2b')]]={'$like':'%'+_0x1dab92['query'][_0x4dc9('0x3e')]+'%'};return _0x5dae03;}})});}_0x11873f=_['merge']({},_0x11873f,_0x1dab92[_0x4dc9('0x42')]);var _0x1cdb24={'where':_0x11873f[_0x4dc9('0x3f')]};return db[_0x4dc9('0x2e')][_0x4dc9('0x21')](_0x1cdb24)[_0x4dc9('0x29')](function(_0x14f304){_0x1ddf7b['count']=_0x14f304;if(_0x1dab92[_0x4dc9('0x34')][_0x4dc9('0x43')]){_0x11873f['include']=[{'all':!![]}];}return db[_0x4dc9('0x2e')][_0x4dc9('0x44')](_0x11873f);})[_0x4dc9('0x29')](function(_0x2d270a){_0x1ddf7b['rows']=_0x2d270a;return _0x1ddf7b;})[_0x4dc9('0x29')](respondWithFilteredResult(_0x329b28,_0x11873f))['catch'](handleError(_0x329b28,null));};exports['show']=function(_0x2f2ade,_0x47113f){var _0x2d24f2={'raw':![],'where':{'id':_0x2f2ade[_0x4dc9('0x45')]['id']}},_0x2ac653={};_0x2ac653[_0x4dc9('0x33')]=_[_0x4dc9('0x46')](db['ZohoConfiguration'][_0x4dc9('0x2f')]);_0x2ac653[_0x4dc9('0x34')]=_[_0x4dc9('0x46')](_0x2f2ade[_0x4dc9('0x34')]);_0x2ac653[_0x4dc9('0x35')]=_[_0x4dc9('0x36')](_0x2ac653[_0x4dc9('0x33')],_0x2ac653['query']);_0x2d24f2[_0x4dc9('0x37')]=_[_0x4dc9('0x36')](_0x2ac653['model'],qs[_0x4dc9('0x38')](_0x2f2ade[_0x4dc9('0x34')][_0x4dc9('0x38')]));_0x2d24f2[_0x4dc9('0x37')]=_0x2d24f2[_0x4dc9('0x37')][_0x4dc9('0x39')]?_0x2d24f2[_0x4dc9('0x37')]:_0x2ac653[_0x4dc9('0x33')];if(_0x2f2ade[_0x4dc9('0x34')]['includeAll']){_0x2d24f2[_0x4dc9('0x47')]=[{'all':!![]}];}_0x2d24f2=_[_0x4dc9('0x40')]({},_0x2d24f2,_0x2f2ade[_0x4dc9('0x42')]);return db[_0x4dc9('0x2e')][_0x4dc9('0x48')](_0x2d24f2)['then'](handleEntityNotFound(_0x47113f,null))[_0x4dc9('0x29')](respondWithResult(_0x47113f,null))['catch'](handleError(_0x47113f,null));};exports[_0x4dc9('0x49')]=function(_0x23d4e5,_0x2c50c3){return db['ZohoConfiguration'][_0x4dc9('0x49')](_0x23d4e5[_0x4dc9('0x4a')],{})[_0x4dc9('0x29')](respondWithResult(_0x2c50c3,0xc9))[_0x4dc9('0x4b')](handleError(_0x2c50c3,null));};exports[_0x4dc9('0x27')]=function(_0x26b314,_0x412760){if(_0x26b314['body']['id']){delete _0x26b314[_0x4dc9('0x4a')]['id'];}return db['ZohoConfiguration'][_0x4dc9('0x48')]({'where':{'id':_0x26b314['params']['id']}})[_0x4dc9('0x29')](handleEntityNotFound(_0x412760,null))[_0x4dc9('0x29')](saveUpdates(_0x26b314[_0x4dc9('0x4a')],null))[_0x4dc9('0x29')](respondWithResult(_0x412760,null))[_0x4dc9('0x4b')](handleError(_0x412760,null));};exports[_0x4dc9('0x28')]=function(_0x41c978,_0x2f89be){return db[_0x4dc9('0x2e')][_0x4dc9('0x48')]({'where':{'id':_0x41c978['params']['id']}})['then'](handleEntityNotFound(_0x2f89be,null))['then'](removeEntity(_0x2f89be,null))[_0x4dc9('0x4b')](handleError(_0x2f89be,null));};exports['getFields']=function(_0x313cfb,_0x411da1,_0x2a9cc1){var _0x56a01d={};var _0x16aca3={};var _0x30098d;var _0x58e8c4;return db[_0x4dc9('0x2e')][_0x4dc9('0x4c')]({'where':{'id':_0x313cfb[_0x4dc9('0x45')]['id']}})[_0x4dc9('0x29')](handleEntityNotFound(_0x411da1,null))[_0x4dc9('0x29')](function(_0x579226){if(_0x579226){_0x30098d=_0x579226;_0x16aca3['model']=_[_0x4dc9('0x46')](db[_0x4dc9('0x4d')]['rawAttributes']);_0x16aca3['query']=_[_0x4dc9('0x46')](_0x313cfb[_0x4dc9('0x34')]);_0x16aca3[_0x4dc9('0x35')]=_['intersection'](_0x16aca3['model'],_0x16aca3[_0x4dc9('0x34')]);_0x56a01d['attributes']=_[_0x4dc9('0x36')](_0x16aca3[_0x4dc9('0x33')],qs['fields'](_0x313cfb[_0x4dc9('0x34')][_0x4dc9('0x38')]));_0x56a01d[_0x4dc9('0x37')]=_0x56a01d['attributes']['length']?_0x56a01d['attributes']:_0x16aca3[_0x4dc9('0x33')];_0x56a01d[_0x4dc9('0x3c')]=qs[_0x4dc9('0x3d')](_0x313cfb['query'][_0x4dc9('0x3d')]);_0x56a01d[_0x4dc9('0x3f')]=qs['filters'](_[_0x4dc9('0x4e')](_0x313cfb['query'],_0x16aca3[_0x4dc9('0x35')]));if(_0x313cfb['query'][_0x4dc9('0x3e')]){_0x56a01d['where']=_[_0x4dc9('0x40')](_0x56a01d['where'],{'$or':_[_0x4dc9('0x2d')](_0x56a01d[_0x4dc9('0x37')],function(_0x4ea21b){var _0x2c0731={};_0x2c0731[_0x4ea21b]={'$like':'%'+_0x313cfb['query'][_0x4dc9('0x3e')]+'%'};return _0x2c0731;})});}_0x56a01d=_['merge']({},_0x56a01d,_0x313cfb[_0x4dc9('0x42')]);return _0x30098d[_0x4dc9('0x4f')](_0x56a01d);}})[_0x4dc9('0x29')](function(_0xa7148b){if(_0xa7148b){_0x58e8c4=_0xa7148b[_0x4dc9('0x39')];if(!_0x313cfb[_0x4dc9('0x34')]['hasOwnProperty'](_0x4dc9('0x3b'))){_0x56a01d['limit']=qs[_0x4dc9('0x22')](_0x313cfb[_0x4dc9('0x34')]['limit']);_0x56a01d['offset']=qs[_0x4dc9('0x1f')](_0x313cfb[_0x4dc9('0x34')]['offset']);}return _0x30098d[_0x4dc9('0x4f')](_0x56a01d);}})['then'](function(_0x1f008c){if(_0x1f008c){return _0x1f008c?{'count':_0x58e8c4,'rows':_0x1f008c}:null;}})[_0x4dc9('0x29')](respondWithResult(_0x411da1,null))['catch'](handleError(_0x411da1,null));};exports[_0x4dc9('0x50')]=function(_0x580b51,_0x120b0d,_0x1aee7a){var _0x5e4ffc={};var _0xbff9f0={};var _0x188fcc;var _0x362f7;return db[_0x4dc9('0x2e')]['findOne']({'where':{'id':_0x580b51['params']['id']}})[_0x4dc9('0x29')](handleEntityNotFound(_0x120b0d,null))[_0x4dc9('0x29')](function(_0x2e6725){if(_0x2e6725){_0x188fcc=_0x2e6725;_0xbff9f0['model']=_[_0x4dc9('0x46')](db[_0x4dc9('0x4d')][_0x4dc9('0x2f')]);_0xbff9f0[_0x4dc9('0x34')]=_['keys'](_0x580b51[_0x4dc9('0x34')]);_0xbff9f0[_0x4dc9('0x35')]=_[_0x4dc9('0x36')](_0xbff9f0[_0x4dc9('0x33')],_0xbff9f0['query']);_0x5e4ffc[_0x4dc9('0x37')]=_[_0x4dc9('0x36')](_0xbff9f0[_0x4dc9('0x33')],qs['fields'](_0x580b51['query'][_0x4dc9('0x38')]));_0x5e4ffc[_0x4dc9('0x37')]=_0x5e4ffc[_0x4dc9('0x37')][_0x4dc9('0x39')]?_0x5e4ffc[_0x4dc9('0x37')]:_0xbff9f0['model'];_0x5e4ffc[_0x4dc9('0x3c')]=qs[_0x4dc9('0x3d')](_0x580b51[_0x4dc9('0x34')]['sort']);_0x5e4ffc[_0x4dc9('0x3f')]=qs['filters'](_[_0x4dc9('0x4e')](_0x580b51[_0x4dc9('0x34')],_0xbff9f0[_0x4dc9('0x35')]));if(_0x580b51[_0x4dc9('0x34')][_0x4dc9('0x3e')]){_0x5e4ffc[_0x4dc9('0x3f')]=_[_0x4dc9('0x40')](_0x5e4ffc[_0x4dc9('0x3f')],{'$or':_[_0x4dc9('0x2d')](_0x5e4ffc[_0x4dc9('0x37')],function(_0x1de9af){var _0x46918a={};_0x46918a[_0x1de9af]={'$like':'%'+_0x580b51['query'][_0x4dc9('0x3e')]+'%'};return _0x46918a;})});}_0x5e4ffc=_[_0x4dc9('0x40')]({},_0x5e4ffc,_0x580b51[_0x4dc9('0x42')]);return _0x188fcc[_0x4dc9('0x50')](_0x5e4ffc);}})['then'](function(_0x111df6){if(_0x111df6){_0x362f7=_0x111df6['length'];if(!_0x580b51[_0x4dc9('0x34')][_0x4dc9('0x3a')]('nolimit')){_0x5e4ffc[_0x4dc9('0x22')]=qs[_0x4dc9('0x22')](_0x580b51[_0x4dc9('0x34')]['limit']);_0x5e4ffc[_0x4dc9('0x1f')]=qs[_0x4dc9('0x1f')](_0x580b51[_0x4dc9('0x34')][_0x4dc9('0x1f')]);}return _0x188fcc['getSubjects'](_0x5e4ffc);}})[_0x4dc9('0x29')](function(_0x3941ab){if(_0x3941ab){return _0x3941ab?{'count':_0x362f7,'rows':_0x3941ab}:null;}})[_0x4dc9('0x29')](respondWithResult(_0x120b0d,null))[_0x4dc9('0x4b')](handleError(_0x120b0d,null));};exports[_0x4dc9('0x51')]=function(_0x1f5578,_0x20fd40,_0x2ff175){var _0x5af369={};var _0x307642={};var _0x3a715b;var _0x9e41d1;return db[_0x4dc9('0x2e')][_0x4dc9('0x4c')]({'where':{'id':_0x1f5578[_0x4dc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x20fd40,null))[_0x4dc9('0x29')](function(_0x5e98e5){if(_0x5e98e5){_0x3a715b=_0x5e98e5;_0x307642[_0x4dc9('0x33')]=_[_0x4dc9('0x46')](db[_0x4dc9('0x4d')][_0x4dc9('0x2f')]);_0x307642[_0x4dc9('0x34')]=_[_0x4dc9('0x46')](_0x1f5578[_0x4dc9('0x34')]);_0x307642['filters']=_[_0x4dc9('0x36')](_0x307642['model'],_0x307642[_0x4dc9('0x34')]);_0x5af369[_0x4dc9('0x37')]=_[_0x4dc9('0x36')](_0x307642['model'],qs[_0x4dc9('0x38')](_0x1f5578[_0x4dc9('0x34')]['fields']));_0x5af369[_0x4dc9('0x37')]=_0x5af369[_0x4dc9('0x37')][_0x4dc9('0x39')]?_0x5af369[_0x4dc9('0x37')]:_0x307642[_0x4dc9('0x33')];_0x5af369['order']=qs['sort'](_0x1f5578['query'][_0x4dc9('0x3d')]);_0x5af369['where']=qs[_0x4dc9('0x35')](_['pick'](_0x1f5578[_0x4dc9('0x34')],_0x307642[_0x4dc9('0x35')]));if(_0x1f5578[_0x4dc9('0x34')]['filter']){_0x5af369[_0x4dc9('0x3f')]=_[_0x4dc9('0x40')](_0x5af369[_0x4dc9('0x3f')],{'$or':_[_0x4dc9('0x2d')](_0x5af369[_0x4dc9('0x37')],function(_0x480853){var _0x59bc23={};_0x59bc23[_0x480853]={'$like':'%'+_0x1f5578[_0x4dc9('0x34')][_0x4dc9('0x3e')]+'%'};return _0x59bc23;})});}_0x5af369=_[_0x4dc9('0x40')]({},_0x5af369,_0x1f5578[_0x4dc9('0x42')]);return _0x3a715b['getDescriptions'](_0x5af369);}})[_0x4dc9('0x29')](function(_0x4fd8bd){if(_0x4fd8bd){_0x9e41d1=_0x4fd8bd[_0x4dc9('0x39')];if(!_0x1f5578[_0x4dc9('0x34')][_0x4dc9('0x3a')](_0x4dc9('0x3b'))){_0x5af369['limit']=qs[_0x4dc9('0x22')](_0x1f5578[_0x4dc9('0x34')][_0x4dc9('0x22')]);_0x5af369[_0x4dc9('0x1f')]=qs[_0x4dc9('0x1f')](_0x1f5578[_0x4dc9('0x34')][_0x4dc9('0x1f')]);}return _0x3a715b['getDescriptions'](_0x5af369);}})[_0x4dc9('0x29')](function(_0x33fdea){if(_0x33fdea){return _0x33fdea?{'count':_0x9e41d1,'rows':_0x33fdea}:null;}})[_0x4dc9('0x29')](respondWithResult(_0x20fd40,null))[_0x4dc9('0x4b')](handleError(_0x20fd40,null));}; \ No newline at end of file +var _0x1d15=['error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','findAll','params','intersection','includeAll','find','create','body','catch','getFields','findOne','ZohoField','order','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy'];(function(_0x486008,_0x2b2d05){var _0x2fefc7=function(_0x4177fe){while(--_0x4177fe){_0x486008['push'](_0x486008['shift']());}};_0x2fefc7(++_0x2b2d05);}(_0x1d15,0x171));var _0x51d1=function(_0x35ba73,_0x364a8b){_0x35ba73=_0x35ba73-0x0;var _0x47ba46=_0x1d15[_0x35ba73];return _0x47ba46;};'use strict';var emlformat=require(_0x51d1('0x0'));var rimraf=require(_0x51d1('0x1'));var zipdir=require(_0x51d1('0x2'));var jsonpatch=require(_0x51d1('0x3'));var rp=require(_0x51d1('0x4'));var moment=require(_0x51d1('0x5'));var BPromise=require(_0x51d1('0x6'));var Mustache=require('mustache');var util=require(_0x51d1('0x7'));var path=require('path');var sox=require(_0x51d1('0x8'));var csv=require(_0x51d1('0x9'));var ejs=require(_0x51d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51d1('0xb'));var squel=require(_0x51d1('0xc'));var crypto=require(_0x51d1('0xd'));var jsforce=require(_0x51d1('0xe'));var deskjs=require(_0x51d1('0xf'));var toCsv=require(_0x51d1('0x9'));var querystring=require(_0x51d1('0x10'));var Papa=require(_0x51d1('0x11'));var Redis=require(_0x51d1('0x12'));var authService=require(_0x51d1('0x13'));var qs=require(_0x51d1('0x14'));var as=require(_0x51d1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51d1('0x16'))('api');var utils=require(_0x51d1('0x17'));var config=require(_0x51d1('0x18'));var licenseUtil=require(_0x51d1('0x19'));var db=require(_0x51d1('0x1a'))['db'];function respondWithStatusCode(_0x3f3b06,_0x466f86){_0x466f86=_0x466f86||0xcc;return function(_0x48c453){if(_0x48c453){return _0x3f3b06[_0x51d1('0x1b')](_0x466f86);}return _0x3f3b06[_0x51d1('0x1c')](_0x466f86)[_0x51d1('0x1d')]();};}function respondWithResult(_0x58528f,_0x468fe5){_0x468fe5=_0x468fe5||0xc8;return function(_0x2a4c58){if(_0x2a4c58){return _0x58528f[_0x51d1('0x1c')](_0x468fe5)[_0x51d1('0x1e')](_0x2a4c58);}};}function respondWithFilteredResult(_0x2c6cf7,_0x415ba1){return function(_0xd21d43){if(_0xd21d43){var _0x91088d=typeof _0x415ba1[_0x51d1('0x1f')]===_0x51d1('0x20')&&typeof _0x415ba1['limit']===_0x51d1('0x20');var _0x32a1cf=_0xd21d43[_0x51d1('0x21')];var _0x4cb64a=_0x91088d?0x0:_0x415ba1[_0x51d1('0x1f')];var _0x4a3d1d=_0x91088d?_0xd21d43[_0x51d1('0x21')]:_0x415ba1[_0x51d1('0x1f')]+_0x415ba1[_0x51d1('0x22')];var _0x945519;if(_0x4a3d1d>=_0x32a1cf){_0x4a3d1d=_0x32a1cf;_0x945519=0xc8;}else{_0x945519=0xce;}_0x2c6cf7['status'](_0x945519);return _0x2c6cf7['set']('Content-Range',_0x4cb64a+'-'+_0x4a3d1d+'/'+_0x32a1cf)['json'](_0xd21d43);}return null;};}function patchUpdates(_0x573c34){return function(_0x324211){try{jsonpatch[_0x51d1('0x23')](_0x324211,_0x573c34,!![]);}catch(_0x3c45c9){return BPromise[_0x51d1('0x24')](_0x3c45c9);}return _0x324211[_0x51d1('0x25')]();};}function saveUpdates(_0x4d9c88,_0x5870a5){return function(_0x47ae7b){if(_0x47ae7b){return _0x47ae7b[_0x51d1('0x26')](_0x4d9c88)[_0x51d1('0x27')](function(_0x321a19){return _0x321a19;});}return null;};}function removeEntity(_0x14c4c3,_0x420a4c){return function(_0x29b2c6){if(_0x29b2c6){return _0x29b2c6[_0x51d1('0x28')]()['then'](function(){_0x14c4c3['status'](0xcc)[_0x51d1('0x1d')]();});}};}function handleEntityNotFound(_0x3e28d6,_0x14400e){return function(_0x510dc5){if(!_0x510dc5){_0x3e28d6[_0x51d1('0x1b')](0x194);}return _0x510dc5;};}function handleError(_0x13e5c8,_0xf90406){_0xf90406=_0xf90406||0x1f4;return function(_0x3828d9){logger[_0x51d1('0x29')](_0x3828d9[_0x51d1('0x2a')]);if(_0x3828d9[_0x51d1('0x2b')]){delete _0x3828d9['name'];}_0x13e5c8[_0x51d1('0x1c')](_0xf90406)[_0x51d1('0x2c')](_0x3828d9);};}exports[_0x51d1('0x2d')]=function(_0x3e88f4,_0x20d8ef){var _0xfdcdb3={},_0x16ce7e={},_0x3131fe={'count':0x0,'rows':[]};var _0x387b6e=_[_0x51d1('0x2e')](db[_0x51d1('0x2f')][_0x51d1('0x30')],function(_0x4a8c71){return{'name':_0x4a8c71[_0x51d1('0x31')],'type':_0x4a8c71[_0x51d1('0x32')][_0x51d1('0x33')]};});_0x16ce7e[_0x51d1('0x34')]=_[_0x51d1('0x2e')](_0x387b6e,_0x51d1('0x2b'));_0x16ce7e[_0x51d1('0x35')]=_[_0x51d1('0x36')](_0x3e88f4[_0x51d1('0x35')]);_0x16ce7e[_0x51d1('0x37')]=_['intersection'](_0x16ce7e[_0x51d1('0x34')],_0x16ce7e[_0x51d1('0x35')]);_0xfdcdb3['attributes']=_['intersection'](_0x16ce7e[_0x51d1('0x34')],qs[_0x51d1('0x38')](_0x3e88f4['query'][_0x51d1('0x38')]));_0xfdcdb3[_0x51d1('0x39')]=_0xfdcdb3[_0x51d1('0x39')][_0x51d1('0x3a')]?_0xfdcdb3[_0x51d1('0x39')]:_0x16ce7e[_0x51d1('0x34')];if(!_0x3e88f4[_0x51d1('0x35')][_0x51d1('0x3b')]('nolimit')){_0xfdcdb3[_0x51d1('0x22')]=qs[_0x51d1('0x22')](_0x3e88f4['query'][_0x51d1('0x22')]);_0xfdcdb3[_0x51d1('0x1f')]=qs[_0x51d1('0x1f')](_0x3e88f4[_0x51d1('0x35')][_0x51d1('0x1f')]);}_0xfdcdb3['order']=qs[_0x51d1('0x3c')](_0x3e88f4[_0x51d1('0x35')][_0x51d1('0x3c')]);_0xfdcdb3[_0x51d1('0x3d')]=qs[_0x51d1('0x37')](_['pick'](_0x3e88f4['query'],_0x16ce7e['filters']),_0x387b6e);if(_0x3e88f4['query'][_0x51d1('0x3e')]){_0xfdcdb3[_0x51d1('0x3d')]=_[_0x51d1('0x3f')](_0xfdcdb3[_0x51d1('0x3d')],{'$or':_[_0x51d1('0x2e')](_0x387b6e,function(_0xff83fb){if(_0xff83fb[_0x51d1('0x32')]!==_0x51d1('0x40')){var _0x2566f6={};_0x2566f6[_0xff83fb[_0x51d1('0x2b')]]={'$like':'%'+_0x3e88f4[_0x51d1('0x35')][_0x51d1('0x3e')]+'%'};return _0x2566f6;}})});}_0xfdcdb3=_[_0x51d1('0x3f')]({},_0xfdcdb3,_0x3e88f4[_0x51d1('0x41')]);var _0xa7abf={'where':_0xfdcdb3['where']};return db[_0x51d1('0x2f')][_0x51d1('0x21')](_0xa7abf)[_0x51d1('0x27')](function(_0x7a3878){_0x3131fe[_0x51d1('0x21')]=_0x7a3878;if(_0x3e88f4[_0x51d1('0x35')]['includeAll']){_0xfdcdb3['include']=[{'all':!![]}];}return db[_0x51d1('0x2f')][_0x51d1('0x42')](_0xfdcdb3);})[_0x51d1('0x27')](function(_0x40a043){_0x3131fe['rows']=_0x40a043;return _0x3131fe;})[_0x51d1('0x27')](respondWithFilteredResult(_0x20d8ef,_0xfdcdb3))['catch'](handleError(_0x20d8ef,null));};exports['show']=function(_0x270e1b,_0x189e35){var _0x459bdf={'raw':![],'where':{'id':_0x270e1b[_0x51d1('0x43')]['id']}},_0x404b48={};_0x404b48['model']=_['keys'](db['ZohoConfiguration'][_0x51d1('0x30')]);_0x404b48[_0x51d1('0x35')]=_['keys'](_0x270e1b[_0x51d1('0x35')]);_0x404b48[_0x51d1('0x37')]=_[_0x51d1('0x44')](_0x404b48[_0x51d1('0x34')],_0x404b48[_0x51d1('0x35')]);_0x459bdf[_0x51d1('0x39')]=_['intersection'](_0x404b48['model'],qs['fields'](_0x270e1b[_0x51d1('0x35')]['fields']));_0x459bdf[_0x51d1('0x39')]=_0x459bdf['attributes'][_0x51d1('0x3a')]?_0x459bdf[_0x51d1('0x39')]:_0x404b48[_0x51d1('0x34')];if(_0x270e1b[_0x51d1('0x35')][_0x51d1('0x45')]){_0x459bdf['include']=[{'all':!![]}];}_0x459bdf=_[_0x51d1('0x3f')]({},_0x459bdf,_0x270e1b[_0x51d1('0x41')]);return db[_0x51d1('0x2f')][_0x51d1('0x46')](_0x459bdf)[_0x51d1('0x27')](handleEntityNotFound(_0x189e35,null))[_0x51d1('0x27')](respondWithResult(_0x189e35,null))['catch'](handleError(_0x189e35,null));};exports[_0x51d1('0x47')]=function(_0x471110,_0xa372c4){return db[_0x51d1('0x2f')][_0x51d1('0x47')](_0x471110[_0x51d1('0x48')],{})[_0x51d1('0x27')](respondWithResult(_0xa372c4,0xc9))[_0x51d1('0x49')](handleError(_0xa372c4,null));};exports['update']=function(_0x1f6ea6,_0x747c76){if(_0x1f6ea6['body']['id']){delete _0x1f6ea6[_0x51d1('0x48')]['id'];}return db[_0x51d1('0x2f')][_0x51d1('0x46')]({'where':{'id':_0x1f6ea6[_0x51d1('0x43')]['id']}})[_0x51d1('0x27')](handleEntityNotFound(_0x747c76,null))['then'](saveUpdates(_0x1f6ea6[_0x51d1('0x48')],null))['then'](respondWithResult(_0x747c76,null))[_0x51d1('0x49')](handleError(_0x747c76,null));};exports['destroy']=function(_0x209b42,_0x4fbea2){return db[_0x51d1('0x2f')][_0x51d1('0x46')]({'where':{'id':_0x209b42[_0x51d1('0x43')]['id']}})[_0x51d1('0x27')](handleEntityNotFound(_0x4fbea2,null))[_0x51d1('0x27')](removeEntity(_0x4fbea2,null))['catch'](handleError(_0x4fbea2,null));};exports[_0x51d1('0x4a')]=function(_0x35a7f8,_0x489b46,_0x4f657b){var _0x46ba47={};var _0x2950e7={};var _0xd693e1;var _0x47d549;return db['ZohoConfiguration'][_0x51d1('0x4b')]({'where':{'id':_0x35a7f8['params']['id']}})['then'](handleEntityNotFound(_0x489b46,null))[_0x51d1('0x27')](function(_0x287047){if(_0x287047){_0xd693e1=_0x287047;_0x2950e7[_0x51d1('0x34')]=_[_0x51d1('0x36')](db[_0x51d1('0x4c')]['rawAttributes']);_0x2950e7['query']=_[_0x51d1('0x36')](_0x35a7f8[_0x51d1('0x35')]);_0x2950e7[_0x51d1('0x37')]=_[_0x51d1('0x44')](_0x2950e7['model'],_0x2950e7[_0x51d1('0x35')]);_0x46ba47['attributes']=_[_0x51d1('0x44')](_0x2950e7['model'],qs['fields'](_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x38')]));_0x46ba47[_0x51d1('0x39')]=_0x46ba47[_0x51d1('0x39')][_0x51d1('0x3a')]?_0x46ba47[_0x51d1('0x39')]:_0x2950e7[_0x51d1('0x34')];_0x46ba47[_0x51d1('0x4d')]=qs[_0x51d1('0x3c')](_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x3c')]);_0x46ba47['where']=qs[_0x51d1('0x37')](_[_0x51d1('0x4e')](_0x35a7f8[_0x51d1('0x35')],_0x2950e7[_0x51d1('0x37')]));if(_0x35a7f8['query']['filter']){_0x46ba47[_0x51d1('0x3d')]=_[_0x51d1('0x3f')](_0x46ba47[_0x51d1('0x3d')],{'$or':_[_0x51d1('0x2e')](_0x46ba47['attributes'],function(_0x51fb73){var _0x5660c2={};_0x5660c2[_0x51fb73]={'$like':'%'+_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x3e')]+'%'};return _0x5660c2;})});}_0x46ba47=_[_0x51d1('0x3f')]({},_0x46ba47,_0x35a7f8[_0x51d1('0x41')]);return _0xd693e1[_0x51d1('0x4a')](_0x46ba47);}})['then'](function(_0xdb5130){if(_0xdb5130){_0x47d549=_0xdb5130['length'];if(!_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x3b')](_0x51d1('0x4f'))){_0x46ba47[_0x51d1('0x22')]=qs['limit'](_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x22')]);_0x46ba47[_0x51d1('0x1f')]=qs[_0x51d1('0x1f')](_0x35a7f8[_0x51d1('0x35')][_0x51d1('0x1f')]);}return _0xd693e1['getFields'](_0x46ba47);}})[_0x51d1('0x27')](function(_0xaec18){if(_0xaec18){return _0xaec18?{'count':_0x47d549,'rows':_0xaec18}:null;}})[_0x51d1('0x27')](respondWithResult(_0x489b46,null))[_0x51d1('0x49')](handleError(_0x489b46,null));};exports['getSubjects']=function(_0x323c35,_0x56aaab,_0x535e37){var _0xdf3b99={};var _0x9bae3b={};var _0x42e9ca;var _0x16afef;return db[_0x51d1('0x2f')][_0x51d1('0x4b')]({'where':{'id':_0x323c35[_0x51d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x56aaab,null))['then'](function(_0x4dbc8d){if(_0x4dbc8d){_0x42e9ca=_0x4dbc8d;_0x9bae3b['model']=_[_0x51d1('0x36')](db[_0x51d1('0x4c')][_0x51d1('0x30')]);_0x9bae3b[_0x51d1('0x35')]=_[_0x51d1('0x36')](_0x323c35['query']);_0x9bae3b[_0x51d1('0x37')]=_['intersection'](_0x9bae3b[_0x51d1('0x34')],_0x9bae3b['query']);_0xdf3b99[_0x51d1('0x39')]=_[_0x51d1('0x44')](_0x9bae3b[_0x51d1('0x34')],qs[_0x51d1('0x38')](_0x323c35[_0x51d1('0x35')]['fields']));_0xdf3b99[_0x51d1('0x39')]=_0xdf3b99[_0x51d1('0x39')][_0x51d1('0x3a')]?_0xdf3b99[_0x51d1('0x39')]:_0x9bae3b['model'];_0xdf3b99[_0x51d1('0x4d')]=qs[_0x51d1('0x3c')](_0x323c35[_0x51d1('0x35')][_0x51d1('0x3c')]);_0xdf3b99[_0x51d1('0x3d')]=qs[_0x51d1('0x37')](_[_0x51d1('0x4e')](_0x323c35[_0x51d1('0x35')],_0x9bae3b[_0x51d1('0x37')]));if(_0x323c35['query'][_0x51d1('0x3e')]){_0xdf3b99[_0x51d1('0x3d')]=_[_0x51d1('0x3f')](_0xdf3b99['where'],{'$or':_[_0x51d1('0x2e')](_0xdf3b99[_0x51d1('0x39')],function(_0xf697c6){var _0x236b4c={};_0x236b4c[_0xf697c6]={'$like':'%'+_0x323c35[_0x51d1('0x35')]['filter']+'%'};return _0x236b4c;})});}_0xdf3b99=_[_0x51d1('0x3f')]({},_0xdf3b99,_0x323c35[_0x51d1('0x41')]);return _0x42e9ca[_0x51d1('0x50')](_0xdf3b99);}})[_0x51d1('0x27')](function(_0x5f3703){if(_0x5f3703){_0x16afef=_0x5f3703[_0x51d1('0x3a')];if(!_0x323c35[_0x51d1('0x35')][_0x51d1('0x3b')](_0x51d1('0x4f'))){_0xdf3b99[_0x51d1('0x22')]=qs[_0x51d1('0x22')](_0x323c35[_0x51d1('0x35')]['limit']);_0xdf3b99['offset']=qs[_0x51d1('0x1f')](_0x323c35[_0x51d1('0x35')][_0x51d1('0x1f')]);}return _0x42e9ca['getSubjects'](_0xdf3b99);}})[_0x51d1('0x27')](function(_0x4f613e){if(_0x4f613e){return _0x4f613e?{'count':_0x16afef,'rows':_0x4f613e}:null;}})[_0x51d1('0x27')](respondWithResult(_0x56aaab,null))['catch'](handleError(_0x56aaab,null));};exports[_0x51d1('0x51')]=function(_0x234f57,_0xf6bdef,_0x4df14b){var _0x120698={};var _0x3264cc={};var _0x1e9372;var _0x4d2867;return db['ZohoConfiguration'][_0x51d1('0x4b')]({'where':{'id':_0x234f57[_0x51d1('0x43')]['id']}})[_0x51d1('0x27')](handleEntityNotFound(_0xf6bdef,null))[_0x51d1('0x27')](function(_0x4008ff){if(_0x4008ff){_0x1e9372=_0x4008ff;_0x3264cc['model']=_['keys'](db[_0x51d1('0x4c')][_0x51d1('0x30')]);_0x3264cc['query']=_[_0x51d1('0x36')](_0x234f57[_0x51d1('0x35')]);_0x3264cc['filters']=_[_0x51d1('0x44')](_0x3264cc[_0x51d1('0x34')],_0x3264cc[_0x51d1('0x35')]);_0x120698[_0x51d1('0x39')]=_['intersection'](_0x3264cc[_0x51d1('0x34')],qs[_0x51d1('0x38')](_0x234f57['query'][_0x51d1('0x38')]));_0x120698[_0x51d1('0x39')]=_0x120698[_0x51d1('0x39')]['length']?_0x120698['attributes']:_0x3264cc['model'];_0x120698[_0x51d1('0x4d')]=qs[_0x51d1('0x3c')](_0x234f57[_0x51d1('0x35')]['sort']);_0x120698[_0x51d1('0x3d')]=qs[_0x51d1('0x37')](_[_0x51d1('0x4e')](_0x234f57[_0x51d1('0x35')],_0x3264cc['filters']));if(_0x234f57[_0x51d1('0x35')][_0x51d1('0x3e')]){_0x120698[_0x51d1('0x3d')]=_['merge'](_0x120698[_0x51d1('0x3d')],{'$or':_[_0x51d1('0x2e')](_0x120698[_0x51d1('0x39')],function(_0x2c93bc){var _0x476fb2={};_0x476fb2[_0x2c93bc]={'$like':'%'+_0x234f57[_0x51d1('0x35')][_0x51d1('0x3e')]+'%'};return _0x476fb2;})});}_0x120698=_[_0x51d1('0x3f')]({},_0x120698,_0x234f57['options']);return _0x1e9372[_0x51d1('0x51')](_0x120698);}})[_0x51d1('0x27')](function(_0x3eef3f){if(_0x3eef3f){_0x4d2867=_0x3eef3f[_0x51d1('0x3a')];if(!_0x234f57[_0x51d1('0x35')][_0x51d1('0x3b')]('nolimit')){_0x120698[_0x51d1('0x22')]=qs[_0x51d1('0x22')](_0x234f57[_0x51d1('0x35')][_0x51d1('0x22')]);_0x120698['offset']=qs[_0x51d1('0x1f')](_0x234f57['query'][_0x51d1('0x1f')]);}return _0x1e9372[_0x51d1('0x51')](_0x120698);}})[_0x51d1('0x27')](function(_0x4ca5f1){if(_0x4ca5f1){return _0x4ca5f1?{'count':_0x4d2867,'rows':_0x4ca5f1}:null;}})[_0x51d1('0x27')](respondWithResult(_0xf6bdef,null))[_0x51d1('0x49')](handleError(_0xf6bdef,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 15ac745..7a07d14 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 _0x3f40=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0x3f40,0xb4));var _0x03f4=function(_0x213bf1,_0x15ad38){_0x213bf1=_0x213bf1-0x0;var _0x3dad58=_0x3f40[_0x213bf1];return _0x3dad58;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var logger=require('../../config/logger')(_0x03f4('0x2'));var moment=require(_0x03f4('0x3'));var BPromise=require(_0x03f4('0x4'));var rp=require(_0x03f4('0x5'));var fs=require('fs');var path=require(_0x03f4('0x6'));var rimraf=require(_0x03f4('0x7'));var config=require('../../config/environment');var attributes=require(_0x03f4('0x8'));module[_0x03f4('0x9')]=function(_0x57c1a9,_0x15a1d4){return _0x57c1a9[_0x03f4('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x03f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x395d=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0x395d,0xad));var _0xd395=function(_0x2b077f,_0x4bb113){_0x2b077f=_0x2b077f-0x0;var _0x59c231=_0x395d[_0x2b077f];return _0x59c231;};'use strict';var _=require(_0xd395('0x0'));var util=require(_0xd395('0x1'));var logger=require(_0xd395('0x2'))('api');var moment=require(_0xd395('0x3'));var BPromise=require(_0xd395('0x4'));var rp=require(_0xd395('0x5'));var fs=require('fs');var path=require(_0xd395('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd395('0x7'));module[_0xd395('0x8')]=function(_0x131d66,_0x293771){return _0x131d66[_0xd395('0x9')](_0xd395('0xa'),attributes,{'tableName':_0xd395('0xb'),'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 a65042b..0640572 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 _0x1bfc=['stringify','code','message','error','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x405f48,_0x2a3f51){var _0xc6368c=function(_0x34f5e4){while(--_0x34f5e4){_0x405f48['push'](_0x405f48['shift']());}};_0xc6368c(++_0x2a3f51);}(_0x1bfc,0x125));var _0xc1bf=function(_0x8a4d1b,_0x2240ed){_0x8a4d1b=_0x8a4d1b-0x0;var _0x1d1ad9=_0x1bfc[_0x8a4d1b];return _0x1d1ad9;};'use strict';var _=require(_0xc1bf('0x0'));var util=require(_0xc1bf('0x1'));var moment=require(_0xc1bf('0x2'));var BPromise=require(_0xc1bf('0x3'));var rs=require(_0xc1bf('0x4'));var fs=require('fs');var Redis=require(_0xc1bf('0x5'));var db=require(_0xc1bf('0x6'))['db'];var utils=require(_0xc1bf('0x7'));var logger=require(_0xc1bf('0x8'))(_0xc1bf('0x9'));var config=require(_0xc1bf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc1bf('0xb')][_0xc1bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33d7f6,_0x557fe0,_0x314a70){return new BPromise(function(_0x569441,_0xb94bbe){return client['request'](_0x33d7f6,_0x314a70)[_0xc1bf('0xd')](function(_0x2bb814){logger[_0xc1bf('0xe')](_0xc1bf('0xf'),_0x557fe0,_0xc1bf('0x10'));logger[_0xc1bf('0x11')](_0xc1bf('0x12'),_0x557fe0,_0xc1bf('0x10'),JSON[_0xc1bf('0x13')](_0x2bb814));if(_0x2bb814['error']){if(_0x2bb814['error'][_0xc1bf('0x14')]===0x1f4){logger['error'](_0xc1bf('0xf'),_0x557fe0,_0x2bb814['error'][_0xc1bf('0x15')]);return _0xb94bbe(_0x2bb814['error'][_0xc1bf('0x15')]);}logger[_0xc1bf('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x557fe0,_0x2bb814[_0xc1bf('0x16')]['message']);return _0x569441(_0x2bb814[_0xc1bf('0x16')]['message']);}else{logger[_0xc1bf('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x557fe0,_0xc1bf('0x10'));_0x569441(_0x2bb814[_0xc1bf('0x17')][_0xc1bf('0x15')]);}})['catch'](function(_0x2d46f5){logger[_0xc1bf('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x557fe0,_0x2d46f5);_0xb94bbe(_0x2d46f5);});});} \ No newline at end of file +var _0x4e9d=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x4e9d,0x171));var _0xd4e9=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x4e9d[_0x2b0a86];return _0x955940;};'use strict';var _=require(_0xd4e9('0x0'));var util=require(_0xd4e9('0x1'));var moment=require(_0xd4e9('0x2'));var BPromise=require(_0xd4e9('0x3'));var rs=require(_0xd4e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4e9('0x5'))['db'];var utils=require(_0xd4e9('0x6'));var logger=require(_0xd4e9('0x7'))(_0xd4e9('0x8'));var config=require('../../config/environment');var jayson=require(_0xd4e9('0x9'));var client=jayson[_0xd4e9('0xa')][_0xd4e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24b1dc,_0x1c0deb,_0x14dd00){return new BPromise(function(_0x216fd2,_0x53fd0c){return client[_0xd4e9('0xc')](_0x24b1dc,_0x14dd00)[_0xd4e9('0xd')](function(_0x41aa1f){logger[_0xd4e9('0xe')](_0xd4e9('0xf'),_0x1c0deb,'request\x20sent');logger[_0xd4e9('0x10')](_0xd4e9('0x11'),_0x1c0deb,_0xd4e9('0x12'),JSON['stringify'](_0x41aa1f));if(_0x41aa1f[_0xd4e9('0x13')]){if(_0x41aa1f[_0xd4e9('0x13')]['code']===0x1f4){logger[_0xd4e9('0x13')](_0xd4e9('0xf'),_0x1c0deb,_0x41aa1f[_0xd4e9('0x13')]['message']);return _0x53fd0c(_0x41aa1f[_0xd4e9('0x13')][_0xd4e9('0x14')]);}logger[_0xd4e9('0x13')](_0xd4e9('0xf'),_0x1c0deb,_0x41aa1f[_0xd4e9('0x13')][_0xd4e9('0x14')]);return _0x216fd2(_0x41aa1f[_0xd4e9('0x13')]['message']);}else{logger[_0xd4e9('0xe')](_0xd4e9('0xf'),_0x1c0deb,_0xd4e9('0x12'));_0x216fd2(_0x41aa1f[_0xd4e9('0x15')][_0xd4e9('0x14')]);}})[_0xd4e9('0x16')](function(_0x21217b){logger[_0xd4e9('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x1c0deb,_0x21217b);_0x53fd0c(_0x21217b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index eee3571..f755e33 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 _0x981b=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4cfa86,_0x1d0945){var _0x5c5fe0=function(_0x3b45ad){while(--_0x3b45ad){_0x4cfa86['push'](_0x4cfa86['shift']());}};_0x5c5fe0(++_0x1d0945);}(_0x981b,0xfd));var _0xb981=function(_0x1a900b,_0x22eefc){_0x1a900b=_0x1a900b-0x0;var _0x16dbbd=_0x981b[_0x1a900b];return _0x16dbbd;};'use strict';var multer=require(_0xb981('0x0'));var util=require(_0xb981('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb981('0x2'));var router=express[_0xb981('0x3')]();var fs_extra=require(_0xb981('0x4'));var auth=require(_0xb981('0x5'));var interaction=require(_0xb981('0x6'));var config=require(_0xb981('0x7'));var controller=require(_0xb981('0x8'));router[_0xb981('0x9')]('/',auth[_0xb981('0xa')](),controller[_0xb981('0xb')]);router['get'](_0xb981('0xc'),auth[_0xb981('0xa')](),controller[_0xb981('0xd')]);router[_0xb981('0xe')]('/',auth[_0xb981('0xa')](),controller[_0xb981('0xf')]);router[_0xb981('0x10')](_0xb981('0xc'),auth[_0xb981('0xa')](),controller['update']);router[_0xb981('0x11')](_0xb981('0xc'),auth[_0xb981('0xa')](),controller[_0xb981('0x12')]);module[_0xb981('0x13')]=router; \ No newline at end of file +var _0x0a6c=['./intZohoField.controller','isAuthenticated','index','/:id','show','post','create','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x103c64,_0x148b2d){var _0x23607c=function(_0x3ceeb3){while(--_0x3ceeb3){_0x103c64['push'](_0x103c64['shift']());}};_0x23607c(++_0x148b2d);}(_0x0a6c,0x159));var _0xc0a6=function(_0x251b98,_0xdb7c23){_0x251b98=_0x251b98-0x0;var _0x1c8880=_0x0a6c[_0x251b98];return _0x1c8880;};'use strict';var multer=require('multer');var util=require(_0xc0a6('0x0'));var path=require(_0xc0a6('0x1'));var timeout=require(_0xc0a6('0x2'));var express=require(_0xc0a6('0x3'));var router=express['Router']();var fs_extra=require(_0xc0a6('0x4'));var auth=require(_0xc0a6('0x5'));var interaction=require(_0xc0a6('0x6'));var config=require('../../config/environment');var controller=require(_0xc0a6('0x7'));router['get']('/',auth[_0xc0a6('0x8')](),controller[_0xc0a6('0x9')]);router['get'](_0xc0a6('0xa'),auth[_0xc0a6('0x8')](),controller[_0xc0a6('0xb')]);router[_0xc0a6('0xc')]('/',auth[_0xc0a6('0x8')](),controller[_0xc0a6('0xd')]);router['put'](_0xc0a6('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc0a6('0xa'),auth[_0xc0a6('0x8')](),controller[_0xc0a6('0xe')]);module[_0xc0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 27fdbc6..6a8c4b4 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 _0xe60a=['variable','BOOLEAN','sequelize','ENUM','string','customVariable','STRING'];(function(_0x444257,_0x125819){var _0x564feb=function(_0xf7eb98){while(--_0xf7eb98){_0x444257['push'](_0x444257['shift']());}};_0x564feb(++_0x125819);}(_0xe60a,0x191));var _0xae60=function(_0x4c7557,_0x49c195){_0x4c7557=_0x4c7557-0x0;var _0x22128f=_0xe60a[_0x4c7557];return _0x22128f;};'use strict';var Sequelize=require(_0xae60('0x0'));module['exports']={'type':{'type':Sequelize[_0xae60('0x1')](_0xae60('0x2'),'variable',_0xae60('0x3'),'keyValue','picklist'),'defaultValue':_0xae60('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xae60('0x4')]},'keyType':{'type':Sequelize[_0xae60('0x1')](_0xae60('0x2'),_0xae60('0x5'),_0xae60('0x3'))},'keyContent':{'type':Sequelize[_0xae60('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xae60('0x4')]},'customField':{'type':Sequelize[_0xae60('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae60('0x4')]}}; \ No newline at end of file +var _0xa730=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x335d2d,_0x26e065){var _0x379073=function(_0x51f553){while(--_0x51f553){_0x335d2d['push'](_0x335d2d['shift']());}};_0x379073(++_0x26e065);}(_0xa730,0x1df));var _0x0a73=function(_0x1ee1d7,_0x5b730d){_0x1ee1d7=_0x1ee1d7-0x0;var _0x2cd5cb=_0xa730[_0x1ee1d7];return _0x2cd5cb;};'use strict';var Sequelize=require(_0x0a73('0x0'));module[_0x0a73('0x1')]={'type':{'type':Sequelize[_0x0a73('0x2')]('string',_0x0a73('0x3'),_0x0a73('0x4'),_0x0a73('0x5'),_0x0a73('0x6')),'defaultValue':_0x0a73('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0a73('0x8')]},'keyType':{'type':Sequelize[_0x0a73('0x2')](_0x0a73('0x7'),_0x0a73('0x3'),_0x0a73('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0a73('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a73('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1c57256..8ba1f62 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 _0xf0be=['undefined','limit','count','set','Content-Range','reject','save','then','error','name','send','index','ZohoField','rawAttributes','fieldName','model','map','query','attributes','intersection','fields','length','order','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','update','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../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'];(function(_0x28285b,_0x9ca61a){var _0x137f9a=function(_0x4ec1e1){while(--_0x4ec1e1){_0x28285b['push'](_0x28285b['shift']());}};_0x137f9a(++_0x9ca61a);}(_0xf0be,0x1cf));var _0xef0b=function(_0x53dc95,_0x56f5e8){_0x53dc95=_0x53dc95-0x0;var _0x19ef04=_0xf0be[_0x53dc95];return _0x19ef04;};'use strict';var emlformat=require(_0xef0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef0b('0x1'));var jsonpatch=require(_0xef0b('0x2'));var rp=require(_0xef0b('0x3'));var moment=require(_0xef0b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xef0b('0x5'));var util=require('util');var path=require(_0xef0b('0x6'));var sox=require(_0xef0b('0x7'));var csv=require(_0xef0b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef0b('0x9'));var _=require(_0xef0b('0xa'));var squel=require(_0xef0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xef0b('0xc'));var deskjs=require(_0xef0b('0xd'));var toCsv=require(_0xef0b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef0b('0xe'));var qs=require(_0xef0b('0xf'));var as=require(_0xef0b('0x10'));var hardwareService=require(_0xef0b('0x11'));var logger=require(_0xef0b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xef0b('0x13'));var licenseUtil=require(_0xef0b('0x14'));var db=require(_0xef0b('0x15'))['db'];function respondWithStatusCode(_0x2d3fa5,_0x5519f6){_0x5519f6=_0x5519f6||0xcc;return function(_0x15b833){if(_0x15b833){return _0x2d3fa5[_0xef0b('0x16')](_0x5519f6);}return _0x2d3fa5[_0xef0b('0x17')](_0x5519f6)[_0xef0b('0x18')]();};}function respondWithResult(_0x4b8770,_0x5529b5){_0x5529b5=_0x5529b5||0xc8;return function(_0x2dcca1){if(_0x2dcca1){return _0x4b8770[_0xef0b('0x17')](_0x5529b5)[_0xef0b('0x19')](_0x2dcca1);}};}function respondWithFilteredResult(_0x306012,_0x190307){return function(_0x4fd66e){if(_0x4fd66e){var _0x7b841d=typeof _0x190307[_0xef0b('0x1a')]===_0xef0b('0x1b')&&typeof _0x190307[_0xef0b('0x1c')]===_0xef0b('0x1b');var _0x301932=_0x4fd66e['count'];var _0x5550a5=_0x7b841d?0x0:_0x190307['offset'];var _0x58d347=_0x7b841d?_0x4fd66e[_0xef0b('0x1d')]:_0x190307[_0xef0b('0x1a')]+_0x190307[_0xef0b('0x1c')];var _0x44bf41;if(_0x58d347>=_0x301932){_0x58d347=_0x301932;_0x44bf41=0xc8;}else{_0x44bf41=0xce;}_0x306012['status'](_0x44bf41);return _0x306012[_0xef0b('0x1e')](_0xef0b('0x1f'),_0x5550a5+'-'+_0x58d347+'/'+_0x301932)[_0xef0b('0x19')](_0x4fd66e);}return null;};}function patchUpdates(_0x57d0dc){return function(_0xf035d0){try{jsonpatch['apply'](_0xf035d0,_0x57d0dc,!![]);}catch(_0x3ba3fc){return BPromise[_0xef0b('0x20')](_0x3ba3fc);}return _0xf035d0[_0xef0b('0x21')]();};}function saveUpdates(_0x5e0842,_0xa87926){return function(_0x34623f){if(_0x34623f){return _0x34623f['update'](_0x5e0842)['then'](function(_0x389c27){return _0x389c27;});}return null;};}function removeEntity(_0x4e8919,_0x403612){return function(_0x5bf1d3){if(_0x5bf1d3){return _0x5bf1d3['destroy']()[_0xef0b('0x22')](function(){_0x4e8919[_0xef0b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5a81,_0x497f5c){return function(_0x23ca2e){if(!_0x23ca2e){_0x5a5a81['sendStatus'](0x194);}return _0x23ca2e;};}function handleError(_0x1f036e,_0x290945){_0x290945=_0x290945||0x1f4;return function(_0x3ec0c5){logger[_0xef0b('0x23')](_0x3ec0c5['stack']);if(_0x3ec0c5[_0xef0b('0x24')]){delete _0x3ec0c5[_0xef0b('0x24')];}_0x1f036e[_0xef0b('0x17')](_0x290945)[_0xef0b('0x25')](_0x3ec0c5);};}exports[_0xef0b('0x26')]=function(_0x3f4eee,_0x572093){var _0x28ee08={},_0x6a5187={},_0x5ee29a={'count':0x0,'rows':[]};var _0x5324cc=_['map'](db[_0xef0b('0x27')][_0xef0b('0x28')],function(_0x2e29f1){return{'name':_0x2e29f1[_0xef0b('0x29')],'type':_0x2e29f1['type']['key']};});_0x6a5187[_0xef0b('0x2a')]=_[_0xef0b('0x2b')](_0x5324cc,'name');_0x6a5187[_0xef0b('0x2c')]=_['keys'](_0x3f4eee[_0xef0b('0x2c')]);_0x6a5187['filters']=_['intersection'](_0x6a5187[_0xef0b('0x2a')],_0x6a5187['query']);_0x28ee08[_0xef0b('0x2d')]=_[_0xef0b('0x2e')](_0x6a5187[_0xef0b('0x2a')],qs['fields'](_0x3f4eee['query'][_0xef0b('0x2f')]));_0x28ee08['attributes']=_0x28ee08[_0xef0b('0x2d')][_0xef0b('0x30')]?_0x28ee08['attributes']:_0x6a5187[_0xef0b('0x2a')];if(!_0x3f4eee[_0xef0b('0x2c')]['hasOwnProperty']('nolimit')){_0x28ee08[_0xef0b('0x1c')]=qs[_0xef0b('0x1c')](_0x3f4eee['query'][_0xef0b('0x1c')]);_0x28ee08[_0xef0b('0x1a')]=qs['offset'](_0x3f4eee['query'][_0xef0b('0x1a')]);}_0x28ee08[_0xef0b('0x31')]=qs['sort'](_0x3f4eee['query']['sort']);_0x28ee08['where']=qs[_0xef0b('0x32')](_[_0xef0b('0x33')](_0x3f4eee[_0xef0b('0x2c')],_0x6a5187[_0xef0b('0x32')]),_0x5324cc);if(_0x3f4eee[_0xef0b('0x2c')][_0xef0b('0x34')]){_0x28ee08[_0xef0b('0x35')]=_[_0xef0b('0x36')](_0x28ee08[_0xef0b('0x35')],{'$or':_[_0xef0b('0x2b')](_0x5324cc,function(_0x13278a){if(_0x13278a[_0xef0b('0x37')]!==_0xef0b('0x38')){var _0x160553={};_0x160553[_0x13278a[_0xef0b('0x24')]]={'$like':'%'+_0x3f4eee[_0xef0b('0x2c')][_0xef0b('0x34')]+'%'};return _0x160553;}})});}_0x28ee08=_['merge']({},_0x28ee08,_0x3f4eee[_0xef0b('0x39')]);var _0x5c220b={'where':_0x28ee08[_0xef0b('0x35')]};return db['ZohoField'][_0xef0b('0x1d')](_0x5c220b)[_0xef0b('0x22')](function(_0x2bb84d){_0x5ee29a['count']=_0x2bb84d;if(_0x3f4eee[_0xef0b('0x2c')][_0xef0b('0x3a')]){_0x28ee08[_0xef0b('0x3b')]=[{'all':!![]}];}return db[_0xef0b('0x27')]['findAll'](_0x28ee08);})['then'](function(_0x52bdd4){_0x5ee29a[_0xef0b('0x3c')]=_0x52bdd4;return _0x5ee29a;})[_0xef0b('0x22')](respondWithFilteredResult(_0x572093,_0x28ee08))[_0xef0b('0x3d')](handleError(_0x572093,null));};exports[_0xef0b('0x3e')]=function(_0xee2c7,_0x523f10){var _0xa33e27={'raw':!![],'where':{'id':_0xee2c7[_0xef0b('0x3f')]['id']}},_0x2ddfe1={};_0x2ddfe1[_0xef0b('0x2a')]=_['keys'](db[_0xef0b('0x27')]['rawAttributes']);_0x2ddfe1['query']=_[_0xef0b('0x40')](_0xee2c7[_0xef0b('0x2c')]);_0x2ddfe1[_0xef0b('0x32')]=_[_0xef0b('0x2e')](_0x2ddfe1[_0xef0b('0x2a')],_0x2ddfe1[_0xef0b('0x2c')]);_0xa33e27[_0xef0b('0x2d')]=_['intersection'](_0x2ddfe1[_0xef0b('0x2a')],qs[_0xef0b('0x2f')](_0xee2c7['query'][_0xef0b('0x2f')]));_0xa33e27[_0xef0b('0x2d')]=_0xa33e27[_0xef0b('0x2d')][_0xef0b('0x30')]?_0xa33e27[_0xef0b('0x2d')]:_0x2ddfe1[_0xef0b('0x2a')];if(_0xee2c7['query'][_0xef0b('0x3a')]){_0xa33e27[_0xef0b('0x3b')]=[{'all':!![]}];}_0xa33e27=_['merge']({},_0xa33e27,_0xee2c7[_0xef0b('0x39')]);return db[_0xef0b('0x27')]['find'](_0xa33e27)[_0xef0b('0x22')](handleEntityNotFound(_0x523f10,null))[_0xef0b('0x22')](respondWithResult(_0x523f10,null))[_0xef0b('0x3d')](handleError(_0x523f10,null));};exports[_0xef0b('0x41')]=function(_0x2e03fc,_0x230e25){return db['ZohoField'][_0xef0b('0x41')](_0x2e03fc[_0xef0b('0x42')],{})['then'](respondWithResult(_0x230e25,0xc9))[_0xef0b('0x3d')](handleError(_0x230e25,null));};exports[_0xef0b('0x43')]=function(_0x315891,_0x2eaf8c){if(_0x315891[_0xef0b('0x42')]['id']){delete _0x315891[_0xef0b('0x42')]['id'];}return db[_0xef0b('0x27')]['find']({'where':{'id':_0x315891[_0xef0b('0x3f')]['id']}})[_0xef0b('0x22')](handleEntityNotFound(_0x2eaf8c,null))['then'](saveUpdates(_0x315891[_0xef0b('0x42')],null))[_0xef0b('0x22')](respondWithResult(_0x2eaf8c,null))[_0xef0b('0x3d')](handleError(_0x2eaf8c,null));};exports[_0xef0b('0x44')]=function(_0x5a979c,_0x481a50){return db[_0xef0b('0x27')][_0xef0b('0x45')]({'where':{'id':_0x5a979c[_0xef0b('0x3f')]['id']}})[_0xef0b('0x22')](handleEntityNotFound(_0x481a50,null))[_0xef0b('0x22')](removeEntity(_0x481a50,null))[_0xef0b('0x3d')](handleError(_0x481a50,null));}; \ No newline at end of file +var _0x0767=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','ZohoField','findAll','rows','catch','params','includeAll','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2a11c6,_0x12d7b8){var _0x4393ff=function(_0x2388d9){while(--_0x2388d9){_0x2a11c6['push'](_0x2a11c6['shift']());}};_0x4393ff(++_0x12d7b8);}(_0x0767,0xd2));var _0x7076=function(_0x4dc7f1,_0x26c9aa){_0x4dc7f1=_0x4dc7f1-0x0;var _0x1e348a=_0x0767[_0x4dc7f1];return _0x1e348a;};'use strict';var emlformat=require(_0x7076('0x0'));var rimraf=require(_0x7076('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7076('0x2'));var rp=require(_0x7076('0x3'));var moment=require('moment');var BPromise=require(_0x7076('0x4'));var Mustache=require(_0x7076('0x5'));var util=require('util');var path=require(_0x7076('0x6'));var sox=require(_0x7076('0x7'));var csv=require('to-csv');var ejs=require(_0x7076('0x8'));var fs=require('fs');var fs_extra=require(_0x7076('0x9'));var _=require(_0x7076('0xa'));var squel=require(_0x7076('0xb'));var crypto=require(_0x7076('0xc'));var jsforce=require(_0x7076('0xd'));var deskjs=require(_0x7076('0xe'));var toCsv=require(_0x7076('0xf'));var querystring=require(_0x7076('0x10'));var Papa=require(_0x7076('0x11'));var Redis=require(_0x7076('0x12'));var authService=require(_0x7076('0x13'));var qs=require(_0x7076('0x14'));var as=require(_0x7076('0x15'));var hardwareService=require(_0x7076('0x16'));var logger=require('../../config/logger')(_0x7076('0x17'));var utils=require('../../config/utils');var config=require(_0x7076('0x18'));var licenseUtil=require(_0x7076('0x19'));var db=require(_0x7076('0x1a'))['db'];function respondWithStatusCode(_0x4dd909,_0xe11e8c){_0xe11e8c=_0xe11e8c||0xcc;return function(_0x503428){if(_0x503428){return _0x4dd909[_0x7076('0x1b')](_0xe11e8c);}return _0x4dd909[_0x7076('0x1c')](_0xe11e8c)[_0x7076('0x1d')]();};}function respondWithResult(_0x99435e,_0x7acdb1){_0x7acdb1=_0x7acdb1||0xc8;return function(_0x260151){if(_0x260151){return _0x99435e[_0x7076('0x1c')](_0x7acdb1)[_0x7076('0x1e')](_0x260151);}};}function respondWithFilteredResult(_0x3241a0,_0x29573d){return function(_0x311c45){if(_0x311c45){var _0x53ea46=typeof _0x29573d[_0x7076('0x1f')]===_0x7076('0x20')&&typeof _0x29573d[_0x7076('0x21')]===_0x7076('0x20');var _0x2d9fc5=_0x311c45[_0x7076('0x22')];var _0x1c2c1e=_0x53ea46?0x0:_0x29573d[_0x7076('0x1f')];var _0x30ed93=_0x53ea46?_0x311c45[_0x7076('0x22')]:_0x29573d[_0x7076('0x1f')]+_0x29573d[_0x7076('0x21')];var _0x3351d2;if(_0x30ed93>=_0x2d9fc5){_0x30ed93=_0x2d9fc5;_0x3351d2=0xc8;}else{_0x3351d2=0xce;}_0x3241a0[_0x7076('0x1c')](_0x3351d2);return _0x3241a0['set'](_0x7076('0x23'),_0x1c2c1e+'-'+_0x30ed93+'/'+_0x2d9fc5)['json'](_0x311c45);}return null;};}function patchUpdates(_0x419f1b){return function(_0x937ae3){try{jsonpatch[_0x7076('0x24')](_0x937ae3,_0x419f1b,!![]);}catch(_0x214597){return BPromise[_0x7076('0x25')](_0x214597);}return _0x937ae3['save']();};}function saveUpdates(_0x41a162,_0x3ca2f1){return function(_0x3e6415){if(_0x3e6415){return _0x3e6415[_0x7076('0x26')](_0x41a162)[_0x7076('0x27')](function(_0x24de06){return _0x24de06;});}return null;};}function removeEntity(_0x3ff1a8,_0x23d415){return function(_0x4647b5){if(_0x4647b5){return _0x4647b5['destroy']()['then'](function(){_0x3ff1a8['status'](0xcc)[_0x7076('0x1d')]();});}};}function handleEntityNotFound(_0x325f6c,_0x93b1d6){return function(_0x174ff4){if(!_0x174ff4){_0x325f6c[_0x7076('0x1b')](0x194);}return _0x174ff4;};}function handleError(_0x505f63,_0x19c02a){_0x19c02a=_0x19c02a||0x1f4;return function(_0x36bec2){logger[_0x7076('0x28')](_0x36bec2[_0x7076('0x29')]);if(_0x36bec2[_0x7076('0x2a')]){delete _0x36bec2['name'];}_0x505f63[_0x7076('0x1c')](_0x19c02a)[_0x7076('0x2b')](_0x36bec2);};}exports[_0x7076('0x2c')]=function(_0x2dca44,_0x485f5d){var _0x526ea5={},_0x51fc78={},_0x139900={'count':0x0,'rows':[]};var _0xa177c6=_[_0x7076('0x2d')](db['ZohoField'][_0x7076('0x2e')],function(_0x24448e){return{'name':_0x24448e['fieldName'],'type':_0x24448e[_0x7076('0x2f')][_0x7076('0x30')]};});_0x51fc78['model']=_[_0x7076('0x2d')](_0xa177c6,_0x7076('0x2a'));_0x51fc78[_0x7076('0x31')]=_[_0x7076('0x32')](_0x2dca44[_0x7076('0x31')]);_0x51fc78[_0x7076('0x33')]=_[_0x7076('0x34')](_0x51fc78[_0x7076('0x35')],_0x51fc78['query']);_0x526ea5[_0x7076('0x36')]=_[_0x7076('0x34')](_0x51fc78[_0x7076('0x35')],qs[_0x7076('0x37')](_0x2dca44[_0x7076('0x31')][_0x7076('0x37')]));_0x526ea5[_0x7076('0x36')]=_0x526ea5['attributes'][_0x7076('0x38')]?_0x526ea5[_0x7076('0x36')]:_0x51fc78[_0x7076('0x35')];if(!_0x2dca44[_0x7076('0x31')][_0x7076('0x39')](_0x7076('0x3a'))){_0x526ea5[_0x7076('0x21')]=qs[_0x7076('0x21')](_0x2dca44[_0x7076('0x31')]['limit']);_0x526ea5[_0x7076('0x1f')]=qs[_0x7076('0x1f')](_0x2dca44[_0x7076('0x31')][_0x7076('0x1f')]);}_0x526ea5['order']=qs['sort'](_0x2dca44[_0x7076('0x31')][_0x7076('0x3b')]);_0x526ea5[_0x7076('0x3c')]=qs[_0x7076('0x33')](_[_0x7076('0x3d')](_0x2dca44[_0x7076('0x31')],_0x51fc78[_0x7076('0x33')]),_0xa177c6);if(_0x2dca44[_0x7076('0x31')]['filter']){_0x526ea5['where']=_[_0x7076('0x3e')](_0x526ea5[_0x7076('0x3c')],{'$or':_[_0x7076('0x2d')](_0xa177c6,function(_0x21ebb4){if(_0x21ebb4[_0x7076('0x2f')]!=='VIRTUAL'){var _0x2a7002={};_0x2a7002[_0x21ebb4[_0x7076('0x2a')]]={'$like':'%'+_0x2dca44[_0x7076('0x31')][_0x7076('0x3f')]+'%'};return _0x2a7002;}})});}_0x526ea5=_[_0x7076('0x3e')]({},_0x526ea5,_0x2dca44[_0x7076('0x40')]);var _0x363539={'where':_0x526ea5['where']};return db[_0x7076('0x41')]['count'](_0x363539)[_0x7076('0x27')](function(_0x377b79){_0x139900['count']=_0x377b79;if(_0x2dca44[_0x7076('0x31')]['includeAll']){_0x526ea5['include']=[{'all':!![]}];}return db[_0x7076('0x41')][_0x7076('0x42')](_0x526ea5);})[_0x7076('0x27')](function(_0x249a9a){_0x139900[_0x7076('0x43')]=_0x249a9a;return _0x139900;})['then'](respondWithFilteredResult(_0x485f5d,_0x526ea5))[_0x7076('0x44')](handleError(_0x485f5d,null));};exports['show']=function(_0x401674,_0x969d92){var _0x5f024c={'raw':!![],'where':{'id':_0x401674[_0x7076('0x45')]['id']}},_0x1186c2={};_0x1186c2[_0x7076('0x35')]=_[_0x7076('0x32')](db[_0x7076('0x41')][_0x7076('0x2e')]);_0x1186c2[_0x7076('0x31')]=_[_0x7076('0x32')](_0x401674[_0x7076('0x31')]);_0x1186c2[_0x7076('0x33')]=_[_0x7076('0x34')](_0x1186c2['model'],_0x1186c2[_0x7076('0x31')]);_0x5f024c[_0x7076('0x36')]=_['intersection'](_0x1186c2['model'],qs[_0x7076('0x37')](_0x401674['query'][_0x7076('0x37')]));_0x5f024c[_0x7076('0x36')]=_0x5f024c[_0x7076('0x36')]['length']?_0x5f024c['attributes']:_0x1186c2[_0x7076('0x35')];if(_0x401674['query'][_0x7076('0x46')]){_0x5f024c['include']=[{'all':!![]}];}_0x5f024c=_['merge']({},_0x5f024c,_0x401674[_0x7076('0x40')]);return db[_0x7076('0x41')][_0x7076('0x47')](_0x5f024c)[_0x7076('0x27')](handleEntityNotFound(_0x969d92,null))[_0x7076('0x27')](respondWithResult(_0x969d92,null))[_0x7076('0x44')](handleError(_0x969d92,null));};exports[_0x7076('0x48')]=function(_0x1d0805,_0x3d97a6){return db[_0x7076('0x41')][_0x7076('0x48')](_0x1d0805[_0x7076('0x49')],{})['then'](respondWithResult(_0x3d97a6,0xc9))[_0x7076('0x44')](handleError(_0x3d97a6,null));};exports['update']=function(_0x1bc849,_0x110215){if(_0x1bc849[_0x7076('0x49')]['id']){delete _0x1bc849[_0x7076('0x49')]['id'];}return db[_0x7076('0x41')][_0x7076('0x47')]({'where':{'id':_0x1bc849[_0x7076('0x45')]['id']}})[_0x7076('0x27')](handleEntityNotFound(_0x110215,null))[_0x7076('0x27')](saveUpdates(_0x1bc849['body'],null))[_0x7076('0x27')](respondWithResult(_0x110215,null))[_0x7076('0x44')](handleError(_0x110215,null));};exports[_0x7076('0x4a')]=function(_0x16a3fb,_0x5270fa){return db[_0x7076('0x41')]['find']({'where':{'id':_0x16a3fb[_0x7076('0x45')]['id']}})[_0x7076('0x27')](handleEntityNotFound(_0x5270fa,null))[_0x7076('0x27')](removeEntity(_0x5270fa,null))[_0x7076('0x44')](handleError(_0x5270fa,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f2b7924..9601ed1 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 _0x1261=['path','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1261,0x144));var _0x1126=function(_0x4f6f04,_0x59c6ba){_0x4f6f04=_0x4f6f04-0x0;var _0x606b2c=_0x1261[_0x4f6f04];return _0x606b2c;};'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')]('ZohoField',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xd'),_0x1126('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40381d,_0x33fa74){var _0x562178=function(_0x2d2980){while(--_0x2d2980){_0x40381d['push'](_0x40381d['shift']());}};_0x562178(++_0x33fa74);}(_0x2ef3,0xba));var _0x32ef=function(_0x23378e,_0x17cb9d){_0x23378e=_0x23378e-0x0;var _0x47a277=_0x2ef3[_0x23378e];return _0x47a277;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xe'),_0x32ef('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index b8a79ed..23ddc48 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 _0xb0e6=['info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x5e465a,_0x3e0f32){var _0x52c7db=function(_0x2c9dea){while(--_0x2c9dea){_0x5e465a['push'](_0x5e465a['shift']());}};_0x52c7db(++_0x3e0f32);}(_0xb0e6,0x13f));var _0x6b0e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb0e6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6b0e('0x0'));var util=require(_0x6b0e('0x1'));var moment=require('moment');var BPromise=require(_0x6b0e('0x2'));var rs=require(_0x6b0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b0e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b0e('0x5'))('rpc');var config=require(_0x6b0e('0x6'));var jayson=require(_0x6b0e('0x7'));var client=jayson[_0x6b0e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50c8d4,_0x466eb7,_0x5b0bc6){return new BPromise(function(_0x18ada1,_0x554ff8){return client[_0x6b0e('0x9')](_0x50c8d4,_0x5b0bc6)[_0x6b0e('0xa')](function(_0xf5ecd3){logger[_0x6b0e('0xb')]('ZohoField,\x20%s,\x20%s',_0x466eb7,'request\x20sent');logger[_0x6b0e('0xc')](_0x6b0e('0xd'),_0x466eb7,_0x6b0e('0xe'),JSON[_0x6b0e('0xf')](_0xf5ecd3));if(_0xf5ecd3[_0x6b0e('0x10')]){if(_0xf5ecd3[_0x6b0e('0x10')][_0x6b0e('0x11')]===0x1f4){logger[_0x6b0e('0x10')](_0x6b0e('0x12'),_0x466eb7,_0xf5ecd3['error'][_0x6b0e('0x13')]);return _0x554ff8(_0xf5ecd3[_0x6b0e('0x10')][_0x6b0e('0x13')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x466eb7,_0xf5ecd3['error'][_0x6b0e('0x13')]);return _0x18ada1(_0xf5ecd3[_0x6b0e('0x10')]['message']);}else{logger[_0x6b0e('0xb')](_0x6b0e('0x12'),_0x466eb7,_0x6b0e('0xe'));_0x18ada1(_0xf5ecd3[_0x6b0e('0x14')][_0x6b0e('0x13')]);}})[_0x6b0e('0x15')](function(_0x2195c2){logger['error'](_0x6b0e('0x12'),_0x466eb7,_0x2195c2);_0x554ff8(_0x2195c2);});});} \ No newline at end of file +var _0x4fdc=['info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x4297df,_0xd06f56){var _0x4ec650=function(_0x164b82){while(--_0x164b82){_0x4297df['push'](_0x4297df['shift']());}};_0x4ec650(++_0xd06f56);}(_0x4fdc,0x128));var _0xc4fd=function(_0x3cd481,_0x8843b3){_0x3cd481=_0x3cd481-0x0;var _0xe946b6=_0x4fdc[_0x3cd481];return _0xe946b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc4fd('0x0'));var BPromise=require(_0xc4fd('0x1'));var rs=require(_0xc4fd('0x2'));var fs=require('fs');var Redis=require(_0xc4fd('0x3'));var db=require(_0xc4fd('0x4'))['db'];var utils=require(_0xc4fd('0x5'));var logger=require(_0xc4fd('0x6'))('rpc');var config=require(_0xc4fd('0x7'));var jayson=require(_0xc4fd('0x8'));var client=jayson['client'][_0xc4fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8c824d,_0x2f685c,_0x37afd9){return new BPromise(function(_0x3242a0,_0x16e874){return client[_0xc4fd('0xa')](_0x8c824d,_0x37afd9)[_0xc4fd('0xb')](function(_0x2506f2){logger[_0xc4fd('0xc')](_0xc4fd('0xd'),_0x2f685c,'request\x20sent');logger['debug'](_0xc4fd('0xe'),_0x2f685c,_0xc4fd('0xf'),JSON[_0xc4fd('0x10')](_0x2506f2));if(_0x2506f2[_0xc4fd('0x11')]){if(_0x2506f2['error'][_0xc4fd('0x12')]===0x1f4){logger[_0xc4fd('0x11')](_0xc4fd('0xd'),_0x2f685c,_0x2506f2[_0xc4fd('0x11')][_0xc4fd('0x13')]);return _0x16e874(_0x2506f2[_0xc4fd('0x11')][_0xc4fd('0x13')]);}logger[_0xc4fd('0x11')](_0xc4fd('0xd'),_0x2f685c,_0x2506f2['error'][_0xc4fd('0x13')]);return _0x3242a0(_0x2506f2[_0xc4fd('0x11')]['message']);}else{logger[_0xc4fd('0xc')](_0xc4fd('0xd'),_0x2f685c,_0xc4fd('0xf'));_0x3242a0(_0x2506f2[_0xc4fd('0x14')][_0xc4fd('0x13')]);}})[_0xc4fd('0x15')](function(_0xeb2dd3){logger[_0xc4fd('0x11')](_0xc4fd('0xd'),_0x2f685c,_0xeb2dd3);_0x16e874(_0xeb2dd3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fb73e23..1d48ccd 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x30c598,_0x5b5435){var _0x2f2066=function(_0x3c6dd9){while(--_0x3c6dd9){_0x30c598['push'](_0x30c598['shift']());}};_0x2f2066(++_0x5b5435);}(_0xedd9,0xfc));var _0x9edd=function(_0x232bdb,_0x4283d0){_0x232bdb=_0x232bdb-0x0;var _0x55d557=_0xedd9[_0x232bdb];return _0x55d557;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x59c618,_0x494c31){var _0x6767e3=function(_0x15a77d){while(--_0x15a77d){_0x59c618['push'](_0x59c618['shift']());}};_0x6767e3(++_0x494c31);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xcb91[_0x35485a];return _0x5148e6;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c182c8d..3dcee41 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 _0x9b7e=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x4a6979,_0x5f3d1a){_0x4a6979=_0x4a6979-0x0;var _0x226f93=_0x9b7e[_0x4a6979];return _0x226f93;};'use strict';var Sequelize=require('sequelize');module[_0xe9b7('0x0')]={'name':{'type':Sequelize[_0xe9b7('0x1')],'allowNull':![],'unique':_0xe9b7('0x2')},'version':{'type':Sequelize[_0xe9b7('0x1')],'allowNull':![],'unique':_0xe9b7('0x2')},'main':{'type':Sequelize[_0xe9b7('0x1')],'defaultValue':_0xe9b7('0x3')},'filename':{'type':Sequelize[_0xe9b7('0x1')]},'path':{'type':Sequelize[_0xe9b7('0x1')]},'type':{'type':Sequelize[_0xe9b7('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xe9b7('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe9b7('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xe9b7('0x5')},'description':{'type':Sequelize[_0xe9b7('0x1')]},'title':{'type':Sequelize[_0xe9b7('0x1')]},'remoteUri':{'type':Sequelize[_0xe9b7('0x1')]},'link':{'type':Sequelize[_0xe9b7('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf322=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x25e373,_0x3f8304){var _0x522da5=function(_0x5e0afc){while(--_0x5e0afc){_0x25e373['push'](_0x25e373['shift']());}};_0x522da5(++_0x3f8304);}(_0xf322,0xac));var _0x2f32=function(_0x1fafde,_0x2b6b23){_0x1fafde=_0x1fafde-0x0;var _0x2dfc80=_0xf322[_0x1fafde];return _0x2dfc80;};'use strict';var Sequelize=require(_0x2f32('0x0'));module[_0x2f32('0x1')]={'name':{'type':Sequelize[_0x2f32('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x2f32('0x2')],'allowNull':![],'unique':_0x2f32('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x2f32('0x2')]},'type':{'type':Sequelize[_0x2f32('0x2')]},'size':{'type':Sequelize[_0x2f32('0x4')]},'active':{'type':Sequelize[_0x2f32('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x2f32('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x2f32('0x6')},'description':{'type':Sequelize[_0x2f32('0x2')]},'title':{'type':Sequelize[_0x2f32('0x2')]},'remoteUri':{'type':Sequelize[_0x2f32('0x2')]},'link':{'type':Sequelize[_0x2f32('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c7d402c..96219ac 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 _0x4819=['bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Integration','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4819,0xcd));var _0x9481=function(_0x9e1d73,_0xcf6479){_0x9e1d73=_0x9e1d73-0x0;var _0x1ba603=_0x4819[_0x9e1d73];return _0x1ba603;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['Integration']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Integration'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));}; \ No newline at end of file +var _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1511c3,_0x5b535f){var _0x12a6b0=function(_0x578aa2){while(--_0x578aa2){_0x1511c3['push'](_0x1511c3['shift']());}};_0x12a6b0(++_0x5b535f);}(_0x7096,0x10c));var _0x6709=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7096[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8ce7558..fbdc604 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 _0x0d0e=['path','../../config/environment','./integration.attributes','exports','define','integrations','util','api','bluebird','request-promise'];(function(_0x487939,_0x562e0e){var _0x165d57=function(_0x5af7e8){while(--_0x5af7e8){_0x487939['push'](_0x487939['shift']());}};_0x165d57(++_0x562e0e);}(_0x0d0e,0x6a));var _0xe0d0=function(_0x1463a1,_0x5a28ff){_0x1463a1=_0x1463a1-0x0;var _0x4b24a5=_0x0d0e[_0x1463a1];return _0x4b24a5;};'use strict';var _=require('lodash');var util=require(_0xe0d0('0x0'));var logger=require('../../config/logger')(_0xe0d0('0x1'));var moment=require('moment');var BPromise=require(_0xe0d0('0x2'));var rp=require(_0xe0d0('0x3'));var fs=require('fs');var path=require(_0xe0d0('0x4'));var rimraf=require('rimraf');var config=require(_0xe0d0('0x5'));var attributes=require(_0xe0d0('0x6'));module[_0xe0d0('0x7')]=function(_0x246f78,_0x2e945f){return _0x246f78[_0xe0d0('0x8')]('Integration',attributes,{'tableName':_0xe0d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d1a=['./integration.attributes','exports','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0x9d1a,0x158));var _0xa9d1=function(_0x30bdff,_0x308063){_0x30bdff=_0x30bdff-0x0;var _0x1e7ca9=_0x9d1a[_0x30bdff];return _0x1e7ca9;};'use strict';var _=require(_0xa9d1('0x0'));var util=require('util');var logger=require(_0xa9d1('0x1'))(_0xa9d1('0x2'));var moment=require(_0xa9d1('0x3'));var BPromise=require(_0xa9d1('0x4'));var rp=require(_0xa9d1('0x5'));var fs=require('fs');var path=require(_0xa9d1('0x6'));var rimraf=require('rimraf');var config=require(_0xa9d1('0x7'));var attributes=require(_0xa9d1('0x8'));module[_0xa9d1('0x9')]=function(_0x57e920,_0x33a96f){return _0x57e920['define']('Integration',attributes,{'tableName':_0xa9d1('0xa'),'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 2f7a0cb..6dc0b19 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5227ab,_0x514da4){var _0x3dc702=function(_0x592b15){while(--_0x592b15){_0x5227ab['push'](_0x5227ab['shift']());}};_0x3dc702(++_0x514da4);}(_0x14a0,0x8e));var _0x014a=function(_0x530ea0,_0x35360f){_0x530ea0=_0x530ea0-0x0;var _0x231715=_0x14a0[_0x530ea0];return _0x231715;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0x0b0e[_0x544072];return _0x590bf6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e9b6149..7585ae9 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 _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x4f3e36,_0x570044){var _0x321c33=function(_0x461efd){while(--_0x461efd){_0x4f3e36['push'](_0x4f3e36['shift']());}};_0x321c33(++_0x570044);}(_0x1261,0x144));var _0x1126=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x1261[_0x2431d6];return _0x4d0f9b;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x1967,0x173));var _0x7196=function(_0x527a2e,_0x5129fe){_0x527a2e=_0x527a2e-0x0;var _0x1ab57=_0x1967[_0x527a2e];return _0x1ab57;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 09fde20..8704713 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 _0xb23d=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x5454e2,_0x576f66){var _0x5b9409=function(_0x52b3dd){while(--_0x52b3dd){_0x5454e2['push'](_0x5454e2['shift']());}};_0x5b9409(++_0x576f66);}(_0xb23d,0xc7));var _0xdb23=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xb23d[_0x2c9b79];return _0x265032;};'use strict';var Sequelize=require('sequelize');module[_0xdb23('0x0')]={'integration':{'type':Sequelize[_0xdb23('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xdb23('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xdb23('0x2')]},'contacts':{'type':Sequelize[_0xdb23('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdb23('0x1')]},'calleridname':{'type':Sequelize[_0xdb23('0x1')]},'queue':{'type':Sequelize[_0xdb23('0x1')]},'interface':{'type':Sequelize[_0xdb23('0x1')]},'membername':{'type':Sequelize[_0xdb23('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xdb23('0x3')]},'holdtime':{'type':Sequelize[_0xdb23('0x2')]},'agentcomplete':{'type':Sequelize[_0xdb23('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdb23('0x3')]},'talktime':{'type':Sequelize[_0xdb23('0x2')]},'agentacw':{'type':Sequelize[_0xdb23('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xdb23('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xdb23('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xdb23('0x3')]},'lastevent':{'type':Sequelize[_0xdb23('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xdb23('0x2')]},'channelstatedesc':{'type':Sequelize[_0xdb23('0x1')]},'connectedlinenum':{'type':Sequelize[_0xdb23('0x1')]},'connectedlinename':{'type':Sequelize[_0xdb23('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xdb23('0x1')]},'exten':{'type':Sequelize[_0xdb23('0x1')]},'priority':{'type':Sequelize[_0xdb23('0x1')]},'destchannel':{'type':Sequelize[_0xdb23('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xdb23('0x1')]},'destcalleridnum':{'type':Sequelize[_0xdb23('0x1')]},'destcalleridname':{'type':Sequelize[_0xdb23('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xdb23('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xdb23('0x1')]},'destlanguage':{'type':Sequelize[_0xdb23('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xdb23('0x1')]},'destexten':{'type':Sequelize[_0xdb23('0x1')]},'destpriority':{'type':Sequelize[_0xdb23('0x1')]},'destuniqueid':{'type':Sequelize[_0xdb23('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xdb23('0x1')]},'from':{'type':Sequelize[_0xdb23('0x1')]},'to':{'type':Sequelize[_0xdb23('0x1')]},'cc':{'type':Sequelize[_0xdb23('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xdb23('0x5')]},'text':{'type':Sequelize[_0xdb23('0x5')]},'status':{'type':Sequelize[_0xdb23('0x6')](_0xdb23('0x7'),_0xdb23('0x8'),_0xdb23('0x9'),_0xdb23('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xdb23('0x1')]},'appdata':{'type':Sequelize[_0xdb23('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2044=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','SENT','SENDING','RECEIVED','FAILED'];(function(_0x3a1972,_0x194511){var _0xc7e0b5=function(_0x465312){while(--_0x465312){_0x3a1972['push'](_0x3a1972['shift']());}};_0xc7e0b5(++_0x194511);}(_0x2044,0x1d9));var _0x4204=function(_0x830588,_0x40a32d){_0x830588=_0x830588-0x0;var _0xfb1e75=_0x2044[_0x830588];return _0xfb1e75;};'use strict';var Sequelize=require(_0x4204('0x0'));module[_0x4204('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4204('0x2')]},'ticketId':{'type':Sequelize[_0x4204('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x4204('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4204('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4204('0x2')]},'interface':{'type':Sequelize[_0x4204('0x2')]},'membername':{'type':Sequelize[_0x4204('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4204('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4204('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4204('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4204('0x3')]},'talktime':{'type':Sequelize[_0x4204('0x5')]},'agentacw':{'type':Sequelize[_0x4204('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4204('0x5')]},'reason':{'type':Sequelize[_0x4204('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4204('0x3')]},'agentdump':{'type':Sequelize[_0x4204('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4204('0x3')]},'lastevent':{'type':Sequelize[_0x4204('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4204('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4204('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4204('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4204('0x2')]},'accountcode':{'type':Sequelize[_0x4204('0x2')]},'context':{'type':Sequelize[_0x4204('0x2')]},'exten':{'type':Sequelize[_0x4204('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4204('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x4204('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4204('0x2')]},'destcalleridname':{'type':Sequelize[_0x4204('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4204('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4204('0x2')]},'destcontext':{'type':Sequelize[_0x4204('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4204('0x2')]},'destuniqueid':{'type':Sequelize[_0x4204('0x2')]},'messageId':{'type':Sequelize[_0x4204('0x2')]},'inReplyTo':{'type':Sequelize[_0x4204('0x2')]},'subject':{'type':Sequelize[_0x4204('0x2')]},'from':{'type':Sequelize[_0x4204('0x2')]},'to':{'type':Sequelize[_0x4204('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4204('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x4204('0x7'),_0x4204('0x8'),_0x4204('0x9'),_0x4204('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4204('0x2')]},'appdata':{'type':Sequelize[_0x4204('0x2')]},'projectId':{'type':Sequelize[_0x4204('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0aa41c6..3d7528a 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 _0xdfbd=['sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','end','error','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','filter','merge','includeAll','findAll','catch','params','options','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','fs-extra','lodash','squel','crypto','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'];(function(_0x41f6b2,_0x32047b){var _0x570c61=function(_0x328117){while(--_0x328117){_0x41f6b2['push'](_0x41f6b2['shift']());}};_0x570c61(++_0x32047b);}(_0xdfbd,0xf5));var _0xddfb=function(_0x27ec0b,_0x10c1d5){_0x27ec0b=_0x27ec0b-0x0;var _0x529792=_0xdfbd[_0x27ec0b];return _0x529792;};'use strict';var emlformat=require(_0xddfb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xddfb('0x1'));var jsonpatch=require(_0xddfb('0x2'));var rp=require('request-promise');var moment=require(_0xddfb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xddfb('0x4'));var util=require('util');var path=require(_0xddfb('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddfb('0x6'));var _=require(_0xddfb('0x7'));var squel=require(_0xddfb('0x8'));var crypto=require(_0xddfb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xddfb('0xa'));var toCsv=require(_0xddfb('0xb'));var querystring=require(_0xddfb('0xc'));var Papa=require(_0xddfb('0xd'));var Redis=require('ioredis');var authService=require(_0xddfb('0xe'));var qs=require(_0xddfb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddfb('0x10'));var logger=require(_0xddfb('0x11'))(_0xddfb('0x12'));var utils=require(_0xddfb('0x13'));var config=require(_0xddfb('0x14'));var licenseUtil=require(_0xddfb('0x15'));var db=require(_0xddfb('0x16'))['db'];function respondWithStatusCode(_0x3f5cfa,_0x5ac3d5){_0x5ac3d5=_0x5ac3d5||0xcc;return function(_0x174003){if(_0x174003){return _0x3f5cfa[_0xddfb('0x17')](_0x5ac3d5);}return _0x3f5cfa[_0xddfb('0x18')](_0x5ac3d5)['end']();};}function respondWithResult(_0x35e891,_0x5b3777){_0x5b3777=_0x5b3777||0xc8;return function(_0x2bce5e){if(_0x2bce5e){return _0x35e891[_0xddfb('0x18')](_0x5b3777)['json'](_0x2bce5e);}};}function respondWithFilteredResult(_0xbb1674,_0x394808){return function(_0x17b018){if(_0x17b018){var _0x4f1fcf=typeof _0x394808[_0xddfb('0x19')]==='undefined'&&typeof _0x394808[_0xddfb('0x1a')]===_0xddfb('0x1b');var _0x2e0c67=_0x17b018[_0xddfb('0x1c')];var _0x4255dc=_0x4f1fcf?0x0:_0x394808[_0xddfb('0x19')];var _0x12fda1=_0x4f1fcf?_0x17b018['count']:_0x394808[_0xddfb('0x19')]+_0x394808[_0xddfb('0x1a')];var _0x4c4aaa;if(_0x12fda1>=_0x2e0c67){_0x12fda1=_0x2e0c67;_0x4c4aaa=0xc8;}else{_0x4c4aaa=0xce;}_0xbb1674[_0xddfb('0x18')](_0x4c4aaa);return _0xbb1674[_0xddfb('0x1d')](_0xddfb('0x1e'),_0x4255dc+'-'+_0x12fda1+'/'+_0x2e0c67)['json'](_0x17b018);}return null;};}function patchUpdates(_0x434d05){return function(_0xca6452){try{jsonpatch['apply'](_0xca6452,_0x434d05,!![]);}catch(_0x3c911e){return BPromise[_0xddfb('0x1f')](_0x3c911e);}return _0xca6452[_0xddfb('0x20')]();};}function saveUpdates(_0x468597,_0x1f277d){return function(_0x1edd4d){if(_0x1edd4d){return _0x1edd4d['update'](_0x468597)[_0xddfb('0x21')](function(_0x55c974){return _0x55c974;});}return null;};}function removeEntity(_0x40a097,_0x5a890c){return function(_0x250dfc){if(_0x250dfc){return _0x250dfc[_0xddfb('0x22')]()[_0xddfb('0x21')](function(){_0x40a097['status'](0xcc)[_0xddfb('0x23')]();});}};}function handleEntityNotFound(_0x4a2640,_0x1263e6){return function(_0x549028){if(!_0x549028){_0x4a2640['sendStatus'](0x194);}return _0x549028;};}function handleError(_0x26bb8d,_0xce7f67){_0xce7f67=_0xce7f67||0x1f4;return function(_0x187e8f){logger[_0xddfb('0x24')](_0x187e8f['stack']);if(_0x187e8f[_0xddfb('0x25')]){delete _0x187e8f[_0xddfb('0x25')];}_0x26bb8d[_0xddfb('0x18')](_0xce7f67)[_0xddfb('0x26')](_0x187e8f);};}exports['index']=function(_0x48a1d9,_0x595329){var _0x47c4cc={},_0x170ee4={},_0x52589b={'count':0x0,'rows':[]};var _0xd21ed5=_[_0xddfb('0x27')](db[_0xddfb('0x28')][_0xddfb('0x29')],function(_0x225843){return{'name':_0x225843[_0xddfb('0x2a')],'type':_0x225843[_0xddfb('0x2b')][_0xddfb('0x2c')]};});_0x170ee4[_0xddfb('0x2d')]=_[_0xddfb('0x27')](_0xd21ed5,_0xddfb('0x25'));_0x170ee4[_0xddfb('0x2e')]=_[_0xddfb('0x2f')](_0x48a1d9['query']);_0x170ee4[_0xddfb('0x30')]=_[_0xddfb('0x31')](_0x170ee4[_0xddfb('0x2d')],_0x170ee4[_0xddfb('0x2e')]);_0x47c4cc[_0xddfb('0x32')]=_[_0xddfb('0x31')](_0x170ee4[_0xddfb('0x2d')],qs[_0xddfb('0x33')](_0x48a1d9[_0xddfb('0x2e')][_0xddfb('0x33')]));_0x47c4cc[_0xddfb('0x32')]=_0x47c4cc[_0xddfb('0x32')][_0xddfb('0x34')]?_0x47c4cc['attributes']:_0x170ee4[_0xddfb('0x2d')];if(!_0x48a1d9[_0xddfb('0x2e')][_0xddfb('0x35')]('nolimit')){_0x47c4cc[_0xddfb('0x1a')]=qs['limit'](_0x48a1d9['query'][_0xddfb('0x1a')]);_0x47c4cc[_0xddfb('0x19')]=qs[_0xddfb('0x19')](_0x48a1d9['query'][_0xddfb('0x19')]);}_0x47c4cc['order']=qs['sort'](_0x48a1d9[_0xddfb('0x2e')]['sort']);_0x47c4cc[_0xddfb('0x36')]=qs['filters'](_['pick'](_0x48a1d9[_0xddfb('0x2e')],_0x170ee4[_0xddfb('0x30')]),_0xd21ed5);if(_0x48a1d9[_0xddfb('0x2e')][_0xddfb('0x37')]){_0x47c4cc[_0xddfb('0x36')]=_[_0xddfb('0x38')](_0x47c4cc['where'],{'$or':_[_0xddfb('0x27')](_0xd21ed5,function(_0x3380db){if(_0x3380db[_0xddfb('0x2b')]!=='VIRTUAL'){var _0x4628c6={};_0x4628c6[_0x3380db[_0xddfb('0x25')]]={'$like':'%'+_0x48a1d9[_0xddfb('0x2e')]['filter']+'%'};return _0x4628c6;}})});}_0x47c4cc=_['merge']({},_0x47c4cc,_0x48a1d9['options']);var _0x56ed7f={'where':_0x47c4cc[_0xddfb('0x36')]};return db[_0xddfb('0x28')][_0xddfb('0x1c')](_0x56ed7f)[_0xddfb('0x21')](function(_0x3aaaad){_0x52589b[_0xddfb('0x1c')]=_0x3aaaad;if(_0x48a1d9[_0xddfb('0x2e')][_0xddfb('0x39')]){_0x47c4cc['include']=[{'all':!![]}];}return db[_0xddfb('0x28')][_0xddfb('0x3a')](_0x47c4cc);})[_0xddfb('0x21')](function(_0x342b34){_0x52589b['rows']=_0x342b34;return _0x52589b;})[_0xddfb('0x21')](respondWithFilteredResult(_0x595329,_0x47c4cc))[_0xddfb('0x3b')](handleError(_0x595329,null));};exports['show']=function(_0x233378,_0x3c5078){var _0x510dcc={'raw':![],'where':{'id':_0x233378[_0xddfb('0x3c')]['id']}},_0x1b4184={};_0x1b4184['model']=_['keys'](db['IntegrationReport'][_0xddfb('0x29')]);_0x1b4184['query']=_[_0xddfb('0x2f')](_0x233378['query']);_0x1b4184[_0xddfb('0x30')]=_['intersection'](_0x1b4184[_0xddfb('0x2d')],_0x1b4184[_0xddfb('0x2e')]);_0x510dcc[_0xddfb('0x32')]=_['intersection'](_0x1b4184[_0xddfb('0x2d')],qs[_0xddfb('0x33')](_0x233378['query'][_0xddfb('0x33')]));_0x510dcc[_0xddfb('0x32')]=_0x510dcc[_0xddfb('0x32')]['length']?_0x510dcc[_0xddfb('0x32')]:_0x1b4184[_0xddfb('0x2d')];if(_0x233378['query'][_0xddfb('0x39')]){_0x510dcc['include']=[{'all':!![]}];}_0x510dcc=_['merge']({},_0x510dcc,_0x233378[_0xddfb('0x3d')]);return db['IntegrationReport'][_0xddfb('0x3e')](_0x510dcc)['then'](handleEntityNotFound(_0x3c5078,null))[_0xddfb('0x21')](respondWithResult(_0x3c5078,null))[_0xddfb('0x3b')](handleError(_0x3c5078,null));};exports['create']=function(_0x2e36cb,_0x7b1dda){return db['IntegrationReport'][_0xddfb('0x3f')](_0x2e36cb[_0xddfb('0x40')],{})[_0xddfb('0x21')](respondWithResult(_0x7b1dda,0xc9))[_0xddfb('0x3b')](handleError(_0x7b1dda,null));};exports[_0xddfb('0x41')]=function(_0x2fefda,_0x48ba08){if(_0x2fefda['body']['id']){delete _0x2fefda[_0xddfb('0x40')]['id'];}return db[_0xddfb('0x28')][_0xddfb('0x3e')]({'where':{'id':_0x2fefda['params']['id']}})[_0xddfb('0x21')](handleEntityNotFound(_0x48ba08,null))[_0xddfb('0x21')](saveUpdates(_0x2fefda[_0xddfb('0x40')],null))[_0xddfb('0x21')](respondWithResult(_0x48ba08,null))[_0xddfb('0x3b')](handleError(_0x48ba08,null));};exports[_0xddfb('0x22')]=function(_0x6b8963,_0x4f8000){return db[_0xddfb('0x28')]['find']({'where':{'id':_0x6b8963[_0xddfb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4f8000,null))[_0xddfb('0x21')](removeEntity(_0x4f8000,null))[_0xddfb('0x3b')](handleError(_0x4f8000,null));};exports['describe']=function(_0x107899,_0x460b65){return db[_0xddfb('0x28')][_0xddfb('0x42')]()[_0xddfb('0x21')](respondWithResult(_0x460b65,null))[_0xddfb('0x3b')](handleError(_0x460b65,null));}; \ No newline at end of file +var _0x2dc4=['fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','IntegrationReport','includeAll','include','rows','catch','show','params','length','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes'];(function(_0x1e1058,_0x30a95c){var _0x1bd2e5=function(_0x3156e0){while(--_0x3156e0){_0x1e1058['push'](_0x1e1058['shift']());}};_0x1bd2e5(++_0x30a95c);}(_0x2dc4,0x9f));var _0x42dc=function(_0x4106c5,_0x3e2730){_0x4106c5=_0x4106c5-0x0;var _0x229cc6=_0x2dc4[_0x4106c5];return _0x229cc6;};'use strict';var emlformat=require(_0x42dc('0x0'));var rimraf=require(_0x42dc('0x1'));var zipdir=require(_0x42dc('0x2'));var jsonpatch=require(_0x42dc('0x3'));var rp=require('request-promise');var moment=require(_0x42dc('0x4'));var BPromise=require(_0x42dc('0x5'));var Mustache=require(_0x42dc('0x6'));var util=require('util');var path=require(_0x42dc('0x7'));var sox=require('sox');var csv=require(_0x42dc('0x8'));var ejs=require(_0x42dc('0x9'));var fs=require('fs');var fs_extra=require(_0x42dc('0xa'));var _=require(_0x42dc('0xb'));var squel=require('squel');var crypto=require(_0x42dc('0xc'));var jsforce=require(_0x42dc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x42dc('0xe'));var Papa=require(_0x42dc('0xf'));var Redis=require(_0x42dc('0x10'));var authService=require(_0x42dc('0x11'));var qs=require(_0x42dc('0x12'));var as=require(_0x42dc('0x13'));var hardwareService=require(_0x42dc('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x42dc('0x15'));var licenseUtil=require(_0x42dc('0x16'));var db=require(_0x42dc('0x17'))['db'];function respondWithStatusCode(_0x5c5422,_0xfbe985){_0xfbe985=_0xfbe985||0xcc;return function(_0x57596c){if(_0x57596c){return _0x5c5422[_0x42dc('0x18')](_0xfbe985);}return _0x5c5422[_0x42dc('0x19')](_0xfbe985)['end']();};}function respondWithResult(_0x2c8713,_0x170352){_0x170352=_0x170352||0xc8;return function(_0x1d1f77){if(_0x1d1f77){return _0x2c8713['status'](_0x170352)[_0x42dc('0x1a')](_0x1d1f77);}};}function respondWithFilteredResult(_0x580e78,_0x49f986){return function(_0x337e11){if(_0x337e11){var _0x5d3250=typeof _0x49f986['offset']===_0x42dc('0x1b')&&typeof _0x49f986['limit']==='undefined';var _0x7228b4=_0x337e11['count'];var _0x2f954a=_0x5d3250?0x0:_0x49f986[_0x42dc('0x1c')];var _0x5ec018=_0x5d3250?_0x337e11[_0x42dc('0x1d')]:_0x49f986['offset']+_0x49f986[_0x42dc('0x1e')];var _0x1ac56b;if(_0x5ec018>=_0x7228b4){_0x5ec018=_0x7228b4;_0x1ac56b=0xc8;}else{_0x1ac56b=0xce;}_0x580e78['status'](_0x1ac56b);return _0x580e78[_0x42dc('0x1f')](_0x42dc('0x20'),_0x2f954a+'-'+_0x5ec018+'/'+_0x7228b4)[_0x42dc('0x1a')](_0x337e11);}return null;};}function patchUpdates(_0x8b9a5d){return function(_0x37e091){try{jsonpatch['apply'](_0x37e091,_0x8b9a5d,!![]);}catch(_0x5c2a06){return BPromise['reject'](_0x5c2a06);}return _0x37e091['save']();};}function saveUpdates(_0x3b13fe,_0x172be5){return function(_0x125d8f){if(_0x125d8f){return _0x125d8f[_0x42dc('0x21')](_0x3b13fe)[_0x42dc('0x22')](function(_0x3e9ac8){return _0x3e9ac8;});}return null;};}function removeEntity(_0x46de43,_0x57684d){return function(_0x43ed74){if(_0x43ed74){return _0x43ed74[_0x42dc('0x23')]()['then'](function(){_0x46de43[_0x42dc('0x19')](0xcc)[_0x42dc('0x24')]();});}};}function handleEntityNotFound(_0x34d86b,_0x1cb915){return function(_0x21fd5d){if(!_0x21fd5d){_0x34d86b[_0x42dc('0x18')](0x194);}return _0x21fd5d;};}function handleError(_0xa4fe48,_0x1f30fe){_0x1f30fe=_0x1f30fe||0x1f4;return function(_0x2a70a4){logger['error'](_0x2a70a4['stack']);if(_0x2a70a4[_0x42dc('0x25')]){delete _0x2a70a4[_0x42dc('0x25')];}_0xa4fe48[_0x42dc('0x19')](_0x1f30fe)[_0x42dc('0x26')](_0x2a70a4);};}exports['index']=function(_0x56cd4c,_0x44c29c){var _0x24a660={},_0x5a27f6={},_0x47d6b4={'count':0x0,'rows':[]};var _0x435548=_[_0x42dc('0x27')](db['IntegrationReport'][_0x42dc('0x28')],function(_0x305d3f){return{'name':_0x305d3f[_0x42dc('0x29')],'type':_0x305d3f[_0x42dc('0x2a')]['key']};});_0x5a27f6[_0x42dc('0x2b')]=_[_0x42dc('0x27')](_0x435548,_0x42dc('0x25'));_0x5a27f6[_0x42dc('0x2c')]=_[_0x42dc('0x2d')](_0x56cd4c[_0x42dc('0x2c')]);_0x5a27f6['filters']=_[_0x42dc('0x2e')](_0x5a27f6[_0x42dc('0x2b')],_0x5a27f6[_0x42dc('0x2c')]);_0x24a660[_0x42dc('0x2f')]=_[_0x42dc('0x2e')](_0x5a27f6['model'],qs[_0x42dc('0x30')](_0x56cd4c['query'][_0x42dc('0x30')]));_0x24a660['attributes']=_0x24a660[_0x42dc('0x2f')]['length']?_0x24a660['attributes']:_0x5a27f6['model'];if(!_0x56cd4c[_0x42dc('0x2c')][_0x42dc('0x31')](_0x42dc('0x32'))){_0x24a660[_0x42dc('0x1e')]=qs[_0x42dc('0x1e')](_0x56cd4c['query'][_0x42dc('0x1e')]);_0x24a660['offset']=qs[_0x42dc('0x1c')](_0x56cd4c[_0x42dc('0x2c')]['offset']);}_0x24a660[_0x42dc('0x33')]=qs[_0x42dc('0x34')](_0x56cd4c[_0x42dc('0x2c')][_0x42dc('0x34')]);_0x24a660[_0x42dc('0x35')]=qs[_0x42dc('0x36')](_['pick'](_0x56cd4c[_0x42dc('0x2c')],_0x5a27f6[_0x42dc('0x36')]),_0x435548);if(_0x56cd4c['query']['filter']){_0x24a660[_0x42dc('0x35')]=_[_0x42dc('0x37')](_0x24a660[_0x42dc('0x35')],{'$or':_[_0x42dc('0x27')](_0x435548,function(_0x32432e){if(_0x32432e[_0x42dc('0x2a')]!=='VIRTUAL'){var _0x1458b0={};_0x1458b0[_0x32432e[_0x42dc('0x25')]]={'$like':'%'+_0x56cd4c[_0x42dc('0x2c')][_0x42dc('0x38')]+'%'};return _0x1458b0;}})});}_0x24a660=_[_0x42dc('0x37')]({},_0x24a660,_0x56cd4c[_0x42dc('0x39')]);var _0x4ba5eb={'where':_0x24a660['where']};return db[_0x42dc('0x3a')][_0x42dc('0x1d')](_0x4ba5eb)[_0x42dc('0x22')](function(_0x2ada01){_0x47d6b4[_0x42dc('0x1d')]=_0x2ada01;if(_0x56cd4c[_0x42dc('0x2c')][_0x42dc('0x3b')]){_0x24a660[_0x42dc('0x3c')]=[{'all':!![]}];}return db[_0x42dc('0x3a')]['findAll'](_0x24a660);})[_0x42dc('0x22')](function(_0x712a0b){_0x47d6b4[_0x42dc('0x3d')]=_0x712a0b;return _0x47d6b4;})[_0x42dc('0x22')](respondWithFilteredResult(_0x44c29c,_0x24a660))[_0x42dc('0x3e')](handleError(_0x44c29c,null));};exports[_0x42dc('0x3f')]=function(_0x3dbcc0,_0x1ef296){var _0x53c037={'raw':![],'where':{'id':_0x3dbcc0[_0x42dc('0x40')]['id']}},_0x80bc79={};_0x80bc79[_0x42dc('0x2b')]=_[_0x42dc('0x2d')](db['IntegrationReport'][_0x42dc('0x28')]);_0x80bc79[_0x42dc('0x2c')]=_[_0x42dc('0x2d')](_0x3dbcc0[_0x42dc('0x2c')]);_0x80bc79[_0x42dc('0x36')]=_[_0x42dc('0x2e')](_0x80bc79[_0x42dc('0x2b')],_0x80bc79[_0x42dc('0x2c')]);_0x53c037[_0x42dc('0x2f')]=_[_0x42dc('0x2e')](_0x80bc79[_0x42dc('0x2b')],qs[_0x42dc('0x30')](_0x3dbcc0[_0x42dc('0x2c')][_0x42dc('0x30')]));_0x53c037['attributes']=_0x53c037[_0x42dc('0x2f')][_0x42dc('0x41')]?_0x53c037['attributes']:_0x80bc79[_0x42dc('0x2b')];if(_0x3dbcc0['query']['includeAll']){_0x53c037[_0x42dc('0x3c')]=[{'all':!![]}];}_0x53c037=_[_0x42dc('0x37')]({},_0x53c037,_0x3dbcc0[_0x42dc('0x39')]);return db['IntegrationReport'][_0x42dc('0x42')](_0x53c037)['then'](handleEntityNotFound(_0x1ef296,null))[_0x42dc('0x22')](respondWithResult(_0x1ef296,null))[_0x42dc('0x3e')](handleError(_0x1ef296,null));};exports['create']=function(_0x34a7d8,_0x3561e4){return db['IntegrationReport']['create'](_0x34a7d8[_0x42dc('0x43')],{})[_0x42dc('0x22')](respondWithResult(_0x3561e4,0xc9))[_0x42dc('0x3e')](handleError(_0x3561e4,null));};exports[_0x42dc('0x21')]=function(_0x1d6ce9,_0x35e926){if(_0x1d6ce9[_0x42dc('0x43')]['id']){delete _0x1d6ce9[_0x42dc('0x43')]['id'];}return db[_0x42dc('0x3a')][_0x42dc('0x42')]({'where':{'id':_0x1d6ce9[_0x42dc('0x40')]['id']}})[_0x42dc('0x22')](handleEntityNotFound(_0x35e926,null))[_0x42dc('0x22')](saveUpdates(_0x1d6ce9[_0x42dc('0x43')],null))[_0x42dc('0x22')](respondWithResult(_0x35e926,null))[_0x42dc('0x3e')](handleError(_0x35e926,null));};exports[_0x42dc('0x23')]=function(_0x18e027,_0x5a4a36){return db[_0x42dc('0x3a')][_0x42dc('0x42')]({'where':{'id':_0x18e027[_0x42dc('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a4a36,null))[_0x42dc('0x22')](removeEntity(_0x5a4a36,null))[_0x42dc('0x3e')](handleError(_0x5a4a36,null));};exports['describe']=function(_0x2681b7,_0x117b93){return db[_0x42dc('0x3a')][_0x42dc('0x44')]()[_0x42dc('0x22')](respondWithResult(_0x117b93,null))['catch'](handleError(_0x117b93,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ab9646d..f806e28 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 _0x185a=['moment','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x185a,0x127));var _0xa185=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x185a[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xa185('0x0'));var logger=require('../../config/logger')(_0xa185('0x1'));var moment=require(_0xa185('0x2'));var BPromise=require('bluebird');var rp=require(_0xa185('0x3'));var fs=require('fs');var path=require(_0xa185('0x4'));var rimraf=require('rimraf');var config=require(_0xa185('0x5'));var attributes=require(_0xa185('0x6'));module[_0xa185('0x7')]=function(_0x11520c,_0x4dd53f){return _0x11520c[_0xa185('0x8')](_0xa185('0x9'),attributes,{'tableName':_0xa185('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0b0=['bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','../../config/logger','moment'];(function(_0x4c94eb,_0x679a1e){var _0x59e3f3=function(_0x4fc035){while(--_0x4fc035){_0x4c94eb['push'](_0x4c94eb['shift']());}};_0x59e3f3(++_0x679a1e);}(_0xf0b0,0x1a2));var _0x0f0b=function(_0x32b2a0,_0x69db4f){_0x32b2a0=_0x32b2a0-0x0;var _0x456ee6=_0xf0b0[_0x32b2a0];return _0x456ee6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f0b('0x0'))('api');var moment=require(_0x0f0b('0x1'));var BPromise=require(_0x0f0b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f0b('0x3'));var rimraf=require(_0x0f0b('0x4'));var config=require(_0x0f0b('0x5'));var attributes=require(_0x0f0b('0x6'));module[_0x0f0b('0x7')]=function(_0x2640e7,_0xd40c06){return _0x2640e7[_0x0f0b('0x8')](_0x0f0b('0x9'),attributes,{'tableName':'report_integration','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 daea39c..a4b5e2f 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x814b,0x1a2));var _0xb814=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x814b[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x91cba2,_0x2b3b24){var _0x19549d=function(_0x1b08e9){while(--_0x1b08e9){_0x91cba2['push'](_0x91cba2['shift']());}};_0x19549d(++_0x2b3b24);}(_0x1261,0x144));var _0x1126=function(_0x10b7de,_0x51cf9d){_0x10b7de=_0x10b7de-0x0;var _0xd51c81=_0x1261[_0x10b7de];return _0xd51c81;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index e80f032..5491479 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 _0x5f71=['show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1f91f1,_0xdbc1a1){var _0x1df196=function(_0x470b0d){while(--_0x470b0d){_0x1f91f1['push'](_0x1f91f1['shift']());}};_0x1df196(++_0xdbc1a1);}(_0x5f71,0xc9));var _0x15f7=function(_0x46bd17,_0x196280){_0x46bd17=_0x46bd17-0x0;var _0x476b6e=_0x5f71[_0x46bd17];return _0x476b6e;};'use strict';var multer=require(_0x15f7('0x0'));var util=require('util');var path=require(_0x15f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x15f7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15f7('0x3'));var config=require(_0x15f7('0x4'));var controller=require('./interval.controller');router[_0x15f7('0x5')]('/',auth[_0x15f7('0x6')](),controller[_0x15f7('0x7')]);router[_0x15f7('0x5')](_0x15f7('0x8'),auth[_0x15f7('0x6')](),controller[_0x15f7('0x9')]);router[_0x15f7('0x5')](_0x15f7('0xa'),auth[_0x15f7('0x6')](),controller[_0x15f7('0xb')]);router[_0x15f7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15f7('0xc')](_0x15f7('0xa'),auth['isAuthenticated'](),controller[_0x15f7('0xd')]);router[_0x15f7('0xc')](_0x15f7('0xe'),auth[_0x15f7('0x6')](),controller[_0x15f7('0xf')]);router[_0x15f7('0x10')](_0x15f7('0x8'),auth['isAuthenticated'](),controller[_0x15f7('0x11')]);router[_0x15f7('0x12')](_0x15f7('0x8'),auth['isAuthenticated'](),controller[_0x15f7('0x13')]);module[_0x15f7('0x14')]=router; \ No newline at end of file +var _0xed1f=['/:id/sub_intervals','getIntervals','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show'];(function(_0x101a61,_0x43011c){var _0x51d456=function(_0x2be688){while(--_0x2be688){_0x101a61['push'](_0x101a61['shift']());}};_0x51d456(++_0x43011c);}(_0xed1f,0x170));var _0xfed1=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xed1f[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfed1('0x2'));var router=express['Router']();var fs_extra=require(_0xfed1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var controller=require(_0xfed1('0x6'));router[_0xfed1('0x7')]('/',auth[_0xfed1('0x8')](),controller[_0xfed1('0x9')]);router[_0xfed1('0x7')](_0xfed1('0xa'),auth[_0xfed1('0x8')](),controller[_0xfed1('0xb')]);router['get'](_0xfed1('0xc'),auth[_0xfed1('0x8')](),controller[_0xfed1('0xd')]);router['post']('/',auth[_0xfed1('0x8')](),controller['create']);router['post'](_0xfed1('0xc'),auth[_0xfed1('0x8')](),controller['addInterval']);router['post'](_0xfed1('0xe'),auth[_0xfed1('0x8')](),controller['addIntervals']);router[_0xfed1('0xf')]('/:id',auth[_0xfed1('0x8')](),controller[_0xfed1('0x10')]);router[_0xfed1('0x11')](_0xfed1('0xa'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module[_0xfed1('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f0a57a7..a8fda0f 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 _0xe768=['STRING','sequelize','exports'];(function(_0x12b43a,_0x7cb540){var _0x4fdef3=function(_0x33df5a){while(--_0x33df5a){_0x12b43a['push'](_0x12b43a['shift']());}};_0x4fdef3(++_0x7cb540);}(_0xe768,0x196));var _0x8e76=function(_0x3e8a27,_0x38f6e5){_0x3e8a27=_0x3e8a27-0x0;var _0x2e4b50=_0xe768[_0x3e8a27];return _0x2e4b50;};'use strict';var Sequelize=require(_0x8e76('0x0'));module[_0x8e76('0x1')]={'name':{'type':Sequelize[_0x8e76('0x2')]},'description':{'type':Sequelize[_0x8e76('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xaeb7=['exports','STRING','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xaeb7,0x119));var _0x7aeb=function(_0x1cf18d,_0x5e2510){_0x1cf18d=_0x1cf18d-0x0;var _0x91f753=_0xaeb7[_0x1cf18d];return _0x91f753;};'use strict';var Sequelize=require(_0x7aeb('0x0'));module[_0x7aeb('0x1')]={'name':{'type':Sequelize[_0x7aeb('0x2')]},'description':{'type':Sequelize[_0x7aeb('0x2')]},'interval':{'type':Sequelize[_0x7aeb('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 859d2ad..7581392 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 _0x76a9=['addIntervals','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','apply','reject','update','destroy','then','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','params','keys','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','IntervalId','getIntervals','findOne','rawAttributes','order','options'];(function(_0x1122ee,_0x316237){var _0x291622=function(_0x1ac419){while(--_0x1ac419){_0x1122ee['push'](_0x1122ee['shift']());}};_0x291622(++_0x316237);}(_0x76a9,0x160));var _0x976a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x76a9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x976a('0x0'));var jsonpatch=require(_0x976a('0x1'));var rp=require('request-promise');var moment=require(_0x976a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x976a('0x3'));var util=require('util');var path=require('path');var sox=require(_0x976a('0x4'));var csv=require(_0x976a('0x5'));var ejs=require(_0x976a('0x6'));var fs=require('fs');var fs_extra=require(_0x976a('0x7'));var _=require(_0x976a('0x8'));var squel=require('squel');var crypto=require(_0x976a('0x9'));var jsforce=require(_0x976a('0xa'));var deskjs=require(_0x976a('0xb'));var toCsv=require(_0x976a('0x5'));var querystring=require(_0x976a('0xc'));var Papa=require(_0x976a('0xd'));var Redis=require(_0x976a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x976a('0xf'));var hardwareService=require(_0x976a('0x10'));var logger=require(_0x976a('0x11'))(_0x976a('0x12'));var utils=require('../../config/utils');var config=require(_0x976a('0x13'));var licenseUtil=require(_0x976a('0x14'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x503a2b,_0x12984f){_0x12984f=_0x12984f||0xcc;return function(_0x5b37ee){if(_0x5b37ee){return _0x503a2b[_0x976a('0x15')](_0x12984f);}return _0x503a2b[_0x976a('0x16')](_0x12984f)[_0x976a('0x17')]();};}function respondWithResult(_0x658d87,_0x5c839f){_0x5c839f=_0x5c839f||0xc8;return function(_0x55ac6d){if(_0x55ac6d){return _0x658d87['status'](_0x5c839f)[_0x976a('0x18')](_0x55ac6d);}};}function respondWithFilteredResult(_0x31b09a,_0x54ac2e){return function(_0x41b6b1){if(_0x41b6b1){var _0x1f4c2f=typeof _0x54ac2e['offset']===_0x976a('0x19')&&typeof _0x54ac2e[_0x976a('0x1a')]===_0x976a('0x19');var _0x34f29a=_0x41b6b1['count'];var _0x251d23=_0x1f4c2f?0x0:_0x54ac2e[_0x976a('0x1b')];var _0x502135=_0x1f4c2f?_0x41b6b1['count']:_0x54ac2e[_0x976a('0x1b')]+_0x54ac2e[_0x976a('0x1a')];var _0x34bc09;if(_0x502135>=_0x34f29a){_0x502135=_0x34f29a;_0x34bc09=0xc8;}else{_0x34bc09=0xce;}_0x31b09a['status'](_0x34bc09);return _0x31b09a[_0x976a('0x1c')]('Content-Range',_0x251d23+'-'+_0x502135+'/'+_0x34f29a)['json'](_0x41b6b1);}return null;};}function patchUpdates(_0x33a467){return function(_0x2d18fc){try{jsonpatch[_0x976a('0x1d')](_0x2d18fc,_0x33a467,!![]);}catch(_0x505d2d){return BPromise[_0x976a('0x1e')](_0x505d2d);}return _0x2d18fc['save']();};}function saveUpdates(_0x56de0d,_0x34cdaa){return function(_0x29fee6){if(_0x29fee6){return _0x29fee6[_0x976a('0x1f')](_0x56de0d)['then'](function(_0x4dbb45){return _0x4dbb45;});}return null;};}function removeEntity(_0x12aafe,_0x5c83d4){return function(_0x521101){if(_0x521101){return _0x521101[_0x976a('0x20')]()[_0x976a('0x21')](function(){var _0x5d6a52=_0x521101[_0x976a('0x22')]({'plain':!![]});var _0x3168e7=_0x976a('0x23');return db[_0x976a('0x24')][_0x976a('0x20')]({'where':{'type':_0x3168e7,'resourceId':_0x5d6a52['id']}})[_0x976a('0x21')](function(){return _0x521101;});})['then'](function(){_0x12aafe[_0x976a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56bdff,_0x532b79){return function(_0x4e9158){if(!_0x4e9158){_0x56bdff[_0x976a('0x15')](0x194);}return _0x4e9158;};}function handleError(_0xc6acb2,_0x208f01){_0x208f01=_0x208f01||0x1f4;return function(_0x6398eb){logger['error'](_0x6398eb[_0x976a('0x25')]);if(_0x6398eb[_0x976a('0x26')]){delete _0x6398eb['name'];}_0xc6acb2['status'](_0x208f01)[_0x976a('0x27')](_0x6398eb);};}exports[_0x976a('0x28')]=function(_0x3c6b0b,_0x3c06e8){var _0x23065d={},_0x3f15b8={},_0x35da34={'count':0x0,'rows':[]};var _0x248069=_[_0x976a('0x29')](db[_0x976a('0x2a')]['rawAttributes'],function(_0x14fb25){return{'name':_0x14fb25[_0x976a('0x2b')],'type':_0x14fb25[_0x976a('0x2c')]['key']};});_0x3f15b8[_0x976a('0x2d')]=_['map'](_0x248069,'name');_0x3f15b8[_0x976a('0x2e')]=_['keys'](_0x3c6b0b[_0x976a('0x2e')]);_0x3f15b8[_0x976a('0x2f')]=_[_0x976a('0x30')](_0x3f15b8[_0x976a('0x2d')],_0x3f15b8['query']);_0x23065d[_0x976a('0x31')]=_['intersection'](_0x3f15b8[_0x976a('0x2d')],qs[_0x976a('0x32')](_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x32')]));_0x23065d[_0x976a('0x31')]=_0x23065d[_0x976a('0x31')][_0x976a('0x33')]?_0x23065d['attributes']:_0x3f15b8[_0x976a('0x2d')];if(!_0x3c6b0b['query'][_0x976a('0x34')](_0x976a('0x35'))){_0x23065d['limit']=qs[_0x976a('0x1a')](_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x1a')]);_0x23065d[_0x976a('0x1b')]=qs[_0x976a('0x1b')](_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x1b')]);}_0x23065d['order']=qs['sort'](_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x36')]);_0x23065d['where']=qs[_0x976a('0x2f')](_[_0x976a('0x37')](_0x3c6b0b['query'],_0x3f15b8[_0x976a('0x2f')]),_0x248069);if(_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x38')]){_0x23065d[_0x976a('0x39')]=_[_0x976a('0x3a')](_0x23065d[_0x976a('0x39')],{'$or':_['map'](_0x248069,function(_0x3f1aee){if(_0x3f1aee['type']!==_0x976a('0x3b')){var _0x4771bb={};_0x4771bb[_0x3f1aee[_0x976a('0x26')]]={'$like':'%'+_0x3c6b0b['query']['filter']+'%'};return _0x4771bb;}})});}_0x23065d=_[_0x976a('0x3a')]({},_0x23065d,_0x3c6b0b['options']);var _0x888411={'where':_0x23065d[_0x976a('0x39')]};return db['Interval'][_0x976a('0x3c')](_0x888411)[_0x976a('0x21')](function(_0x3873ca){_0x35da34[_0x976a('0x3c')]=_0x3873ca;if(_0x3c6b0b[_0x976a('0x2e')][_0x976a('0x3d')]){_0x23065d[_0x976a('0x3e')]=[{'all':!![]}];}return db[_0x976a('0x2a')][_0x976a('0x3f')](_0x23065d);})[_0x976a('0x21')](function(_0x481320){_0x35da34['rows']=_0x481320;return _0x35da34;})[_0x976a('0x21')](respondWithFilteredResult(_0x3c06e8,_0x23065d))[_0x976a('0x40')](handleError(_0x3c06e8,null));};exports['show']=function(_0x382f93,_0x105ca5){var _0x4a6894={'raw':!![],'where':{'id':_0x382f93[_0x976a('0x41')]['id']}},_0x333b92={};_0x333b92[_0x976a('0x2d')]=_[_0x976a('0x42')](db['Interval']['rawAttributes']);_0x333b92[_0x976a('0x2e')]=_[_0x976a('0x42')](_0x382f93['query']);_0x333b92['filters']=_[_0x976a('0x30')](_0x333b92['model'],_0x333b92['query']);_0x4a6894['attributes']=_[_0x976a('0x30')](_0x333b92[_0x976a('0x2d')],qs[_0x976a('0x32')](_0x382f93[_0x976a('0x2e')]['fields']));_0x4a6894[_0x976a('0x31')]=_0x4a6894['attributes']['length']?_0x4a6894[_0x976a('0x31')]:_0x333b92[_0x976a('0x2d')];if(_0x382f93[_0x976a('0x2e')]['includeAll']){_0x4a6894[_0x976a('0x3e')]=[{'all':!![]}];}_0x4a6894=_['merge']({},_0x4a6894,_0x382f93['options']);return db['Interval']['find'](_0x4a6894)[_0x976a('0x21')](handleEntityNotFound(_0x105ca5,null))[_0x976a('0x21')](respondWithResult(_0x105ca5,null))[_0x976a('0x40')](handleError(_0x105ca5,null));};exports[_0x976a('0x43')]=function(_0x3938e3,_0x418237){return db[_0x976a('0x2a')][_0x976a('0x43')](_0x3938e3[_0x976a('0x44')],{})[_0x976a('0x21')](function(_0x2ccacc){var _0x5c11da=_0x3938e3['user'][_0x976a('0x22')]({'plain':!![]});if(!_0x5c11da)throw new Error(_0x976a('0x45'));if(_0x5c11da[_0x976a('0x46')]===_0x976a('0x47')){var _0xd6a8f7=_0x2ccacc[_0x976a('0x22')]({'plain':!![]});var _0x127dbb='Intervals';return db[_0x976a('0x48')][_0x976a('0x49')]({'where':{'name':_0x127dbb,'userProfileId':_0x5c11da[_0x976a('0x4a')]},'raw':!![]})[_0x976a('0x21')](function(_0x30f622){if(_0x30f622&&_0x30f622[_0x976a('0x4b')]===0x0){return db[_0x976a('0x24')][_0x976a('0x43')]({'name':_0xd6a8f7[_0x976a('0x26')],'resourceId':_0xd6a8f7['id'],'type':_0x30f622[_0x976a('0x26')],'sectionId':_0x30f622['id']},{})[_0x976a('0x21')](function(){return _0x2ccacc;});}else{return _0x2ccacc;}})['catch'](function(_0x12f093){logger['error'](_0x976a('0x4c'),_0x12f093);throw _0x12f093;});}return _0x2ccacc;})[_0x976a('0x21')](respondWithResult(_0x418237,0xc9))['catch'](handleError(_0x418237,null));};exports[_0x976a('0x1f')]=function(_0x4d135b,_0x139915){if(_0x4d135b[_0x976a('0x44')]['id']){delete _0x4d135b[_0x976a('0x44')]['id'];}return db[_0x976a('0x2a')][_0x976a('0x49')]({'where':{'id':_0x4d135b['params']['id']}})[_0x976a('0x21')](handleEntityNotFound(_0x139915,null))['then'](saveUpdates(_0x4d135b[_0x976a('0x44')],null))[_0x976a('0x21')](respondWithResult(_0x139915,null))['catch'](handleError(_0x139915,null));};exports[_0x976a('0x20')]=function(_0x3e11ac,_0x1bc534){return db[_0x976a('0x2a')]['find']({'where':{'id':_0x3e11ac[_0x976a('0x41')]['id']}})[_0x976a('0x21')](handleEntityNotFound(_0x1bc534,null))[_0x976a('0x21')](removeEntity(_0x1bc534,null))[_0x976a('0x40')](handleError(_0x1bc534,null));};exports['addInterval']=function(_0x18ff83,_0x507c45,_0x5d2fff){if(_0x18ff83[_0x976a('0x44')]['id']){delete _0x18ff83[_0x976a('0x44')]['id'];}return db[_0x976a('0x2a')]['find']({'where':{'id':_0x18ff83[_0x976a('0x41')]['id']}})['then'](handleEntityNotFound(_0x507c45,null))[_0x976a('0x21')](function(_0xb55043){if(_0xb55043){_0x18ff83['body'][_0x976a('0x4d')]=_0xb55043['id'];return db[_0x976a('0x2a')]['create'](_0x18ff83[_0x976a('0x44')]);}})[_0x976a('0x21')](respondWithResult(_0x507c45,null))[_0x976a('0x40')](handleError(_0x507c45,null));};exports[_0x976a('0x4e')]=function(_0x2c22e0,_0x24166e,_0x2afa69){var _0x338328={};var _0x232a29={};var _0x286f2e;var _0x5a1c4d;return db[_0x976a('0x2a')][_0x976a('0x4f')]({'where':{'id':_0x2c22e0[_0x976a('0x41')]['id']}})[_0x976a('0x21')](handleEntityNotFound(_0x24166e,null))[_0x976a('0x21')](function(_0x554d49){if(_0x554d49){_0x286f2e=_0x554d49;_0x232a29[_0x976a('0x2d')]=_[_0x976a('0x42')](db[_0x976a('0x2a')][_0x976a('0x50')]);_0x232a29['query']=_[_0x976a('0x42')](_0x2c22e0['query']);_0x232a29[_0x976a('0x2f')]=_[_0x976a('0x30')](_0x232a29[_0x976a('0x2d')],_0x232a29[_0x976a('0x2e')]);_0x338328[_0x976a('0x31')]=_[_0x976a('0x30')](_0x232a29[_0x976a('0x2d')],qs[_0x976a('0x32')](_0x2c22e0['query']['fields']));_0x338328[_0x976a('0x31')]=_0x338328[_0x976a('0x31')][_0x976a('0x33')]?_0x338328['attributes']:_0x232a29[_0x976a('0x2d')];_0x338328[_0x976a('0x51')]=qs[_0x976a('0x36')](_0x2c22e0[_0x976a('0x2e')][_0x976a('0x36')]);_0x338328['where']=qs[_0x976a('0x2f')](_['pick'](_0x2c22e0[_0x976a('0x2e')],_0x232a29[_0x976a('0x2f')]));if(_0x2c22e0[_0x976a('0x2e')]['filter']){_0x338328[_0x976a('0x39')]=_['merge'](_0x338328['where'],{'$or':_[_0x976a('0x29')](_0x338328['attributes'],function(_0x1e1456){var _0x48d8b3={};_0x48d8b3[_0x1e1456]={'$like':'%'+_0x2c22e0[_0x976a('0x2e')]['filter']+'%'};return _0x48d8b3;})});}_0x338328=_['merge']({},_0x338328,_0x2c22e0[_0x976a('0x52')]);return _0x286f2e[_0x976a('0x4e')](_0x338328);}})['then'](function(_0x436aba){if(_0x436aba){_0x5a1c4d=_0x436aba[_0x976a('0x33')];if(!_0x2c22e0[_0x976a('0x2e')]['hasOwnProperty'](_0x976a('0x35'))){_0x338328[_0x976a('0x1a')]=qs[_0x976a('0x1a')](_0x2c22e0['query'][_0x976a('0x1a')]);_0x338328['offset']=qs['offset'](_0x2c22e0[_0x976a('0x2e')]['offset']);}return _0x286f2e[_0x976a('0x4e')](_0x338328);}})[_0x976a('0x21')](function(_0x9cd58f){if(_0x9cd58f){return _0x9cd58f?{'count':_0x5a1c4d,'rows':_0x9cd58f}:null;}})[_0x976a('0x21')](respondWithResult(_0x24166e,null))[_0x976a('0x40')](handleError(_0x24166e,null));};exports[_0x976a('0x53')]=function(_0x2f0332,_0x2fe180,_0x42f25e){return db['Interval'][_0x976a('0x4f')]({'where':{'id':_0x2f0332['params']['id']}})[_0x976a('0x21')](handleEntityNotFound(_0x2fe180,null))[_0x976a('0x21')](function(_0x19ec21){if(_0x19ec21){return db[_0x976a('0x54')][_0x976a('0x55')](function(_0x2de631){return db['Interval'][_0x976a('0x20')]({'where':{'IntervalId':_0x2f0332[_0x976a('0x41')]['id']},'transaction':_0x2de631})[_0x976a('0x21')](function(_0x4584c8){var _0x1c0698=_['map'](_0x2f0332['body'],function(_0x484cf7){delete _0x484cf7['id'];_0x484cf7[_0x976a('0x4d')]=_0x2f0332[_0x976a('0x41')]['id'];return _0x484cf7;});return db['Interval'][_0x976a('0x56')](_0x1c0698,{'transaction':_0x2de631});});})[_0x976a('0x21')](function(){return db[_0x976a('0x2a')][_0x976a('0x3f')]({'where':{'IntervalId':_0x2f0332[_0x976a('0x41')]['id']}});});}})[_0x976a('0x21')](respondWithResult(_0x2fe180,null))['catch'](handleError(_0x2fe180,null));}; \ No newline at end of file +var _0x9a6b=['UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','Intervals','end','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Interval','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x6a419d,_0x5de8f4){var _0x3536ef=function(_0x41154f){while(--_0x41154f){_0x6a419d['push'](_0x6a419d['shift']());}};_0x3536ef(++_0x5de8f4);}(_0x9a6b,0x11f));var _0xb9a6=function(_0x531c92,_0x11e331){_0x531c92=_0x531c92-0x0;var _0x2e886c=_0x9a6b[_0x531c92];return _0x2e886c;};'use strict';var emlformat=require(_0xb9a6('0x0'));var rimraf=require(_0xb9a6('0x1'));var zipdir=require(_0xb9a6('0x2'));var jsonpatch=require(_0xb9a6('0x3'));var rp=require(_0xb9a6('0x4'));var moment=require('moment');var BPromise=require(_0xb9a6('0x5'));var Mustache=require(_0xb9a6('0x6'));var util=require(_0xb9a6('0x7'));var path=require(_0xb9a6('0x8'));var sox=require(_0xb9a6('0x9'));var csv=require(_0xb9a6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9a6('0xb'));var _=require(_0xb9a6('0xc'));var squel=require(_0xb9a6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9a6('0xe'));var Papa=require(_0xb9a6('0xf'));var Redis=require(_0xb9a6('0x10'));var authService=require(_0xb9a6('0x11'));var qs=require(_0xb9a6('0x12'));var as=require(_0xb9a6('0x13'));var hardwareService=require(_0xb9a6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb9a6('0x15'));var config=require(_0xb9a6('0x16'));var licenseUtil=require(_0xb9a6('0x17'));var db=require(_0xb9a6('0x18'))['db'];var extensions=require(_0xb9a6('0x19'));function respondWithStatusCode(_0x3364f5,_0x493273){_0x493273=_0x493273||0xcc;return function(_0x115282){if(_0x115282){return _0x3364f5[_0xb9a6('0x1a')](_0x493273);}return _0x3364f5[_0xb9a6('0x1b')](_0x493273)['end']();};}function respondWithResult(_0x4d1497,_0x2e4641){_0x2e4641=_0x2e4641||0xc8;return function(_0x2d2edd){if(_0x2d2edd){return _0x4d1497[_0xb9a6('0x1b')](_0x2e4641)[_0xb9a6('0x1c')](_0x2d2edd);}};}function respondWithFilteredResult(_0x33ccd8,_0x4df703){return function(_0x44f0d3){if(_0x44f0d3){var _0x17286c=typeof _0x4df703[_0xb9a6('0x1d')]===_0xb9a6('0x1e')&&typeof _0x4df703[_0xb9a6('0x1f')]===_0xb9a6('0x1e');var _0x7ade6b=_0x44f0d3[_0xb9a6('0x20')];var _0x269453=_0x17286c?0x0:_0x4df703[_0xb9a6('0x1d')];var _0x4219ba=_0x17286c?_0x44f0d3[_0xb9a6('0x20')]:_0x4df703[_0xb9a6('0x1d')]+_0x4df703[_0xb9a6('0x1f')];var _0x5aeedb;if(_0x4219ba>=_0x7ade6b){_0x4219ba=_0x7ade6b;_0x5aeedb=0xc8;}else{_0x5aeedb=0xce;}_0x33ccd8['status'](_0x5aeedb);return _0x33ccd8[_0xb9a6('0x21')]('Content-Range',_0x269453+'-'+_0x4219ba+'/'+_0x7ade6b)['json'](_0x44f0d3);}return null;};}function patchUpdates(_0x270425){return function(_0x63bb9f){try{jsonpatch[_0xb9a6('0x22')](_0x63bb9f,_0x270425,!![]);}catch(_0x5b273b){return BPromise[_0xb9a6('0x23')](_0x5b273b);}return _0x63bb9f['save']();};}function saveUpdates(_0x1fc6c2,_0x5d4787){return function(_0x3a4f3d){if(_0x3a4f3d){return _0x3a4f3d['update'](_0x1fc6c2)[_0xb9a6('0x24')](function(_0x43caba){return _0x43caba;});}return null;};}function removeEntity(_0x4ea037,_0x134655){return function(_0x2c7727){if(_0x2c7727){return _0x2c7727[_0xb9a6('0x25')]()[_0xb9a6('0x24')](function(){var _0x219ec6=_0x2c7727['get']({'plain':!![]});var _0x4def1=_0xb9a6('0x26');return db['UserProfileResource'][_0xb9a6('0x25')]({'where':{'type':_0x4def1,'resourceId':_0x219ec6['id']}})[_0xb9a6('0x24')](function(){return _0x2c7727;});})[_0xb9a6('0x24')](function(){_0x4ea037[_0xb9a6('0x1b')](0xcc)[_0xb9a6('0x27')]();});}};}function handleEntityNotFound(_0x386dc4,_0x234f6f){return function(_0x1fb23d){if(!_0x1fb23d){_0x386dc4[_0xb9a6('0x1a')](0x194);}return _0x1fb23d;};}function handleError(_0x16fa54,_0x51c410){_0x51c410=_0x51c410||0x1f4;return function(_0x35dd4b){logger['error'](_0x35dd4b[_0xb9a6('0x28')]);if(_0x35dd4b[_0xb9a6('0x29')]){delete _0x35dd4b[_0xb9a6('0x29')];}_0x16fa54['status'](_0x51c410)[_0xb9a6('0x2a')](_0x35dd4b);};}exports['index']=function(_0xa209d0,_0x44be6f){var _0x1c64ca={},_0x30922c={},_0x5ac084={'count':0x0,'rows':[]};var _0x35848c=_[_0xb9a6('0x2b')](db['Interval']['rawAttributes'],function(_0x3a08a5){return{'name':_0x3a08a5['fieldName'],'type':_0x3a08a5[_0xb9a6('0x2c')][_0xb9a6('0x2d')]};});_0x30922c[_0xb9a6('0x2e')]=_['map'](_0x35848c,_0xb9a6('0x29'));_0x30922c[_0xb9a6('0x2f')]=_[_0xb9a6('0x30')](_0xa209d0[_0xb9a6('0x2f')]);_0x30922c[_0xb9a6('0x31')]=_[_0xb9a6('0x32')](_0x30922c[_0xb9a6('0x2e')],_0x30922c[_0xb9a6('0x2f')]);_0x1c64ca[_0xb9a6('0x33')]=_[_0xb9a6('0x32')](_0x30922c['model'],qs[_0xb9a6('0x34')](_0xa209d0[_0xb9a6('0x2f')][_0xb9a6('0x34')]));_0x1c64ca[_0xb9a6('0x33')]=_0x1c64ca['attributes'][_0xb9a6('0x35')]?_0x1c64ca[_0xb9a6('0x33')]:_0x30922c[_0xb9a6('0x2e')];if(!_0xa209d0[_0xb9a6('0x2f')][_0xb9a6('0x36')](_0xb9a6('0x37'))){_0x1c64ca[_0xb9a6('0x1f')]=qs[_0xb9a6('0x1f')](_0xa209d0['query']['limit']);_0x1c64ca[_0xb9a6('0x1d')]=qs['offset'](_0xa209d0[_0xb9a6('0x2f')][_0xb9a6('0x1d')]);}_0x1c64ca['order']=qs[_0xb9a6('0x38')](_0xa209d0[_0xb9a6('0x2f')][_0xb9a6('0x38')]);_0x1c64ca[_0xb9a6('0x39')]=qs[_0xb9a6('0x31')](_[_0xb9a6('0x3a')](_0xa209d0[_0xb9a6('0x2f')],_0x30922c[_0xb9a6('0x31')]),_0x35848c);if(_0xa209d0[_0xb9a6('0x2f')][_0xb9a6('0x3b')]){_0x1c64ca[_0xb9a6('0x39')]=_[_0xb9a6('0x3c')](_0x1c64ca[_0xb9a6('0x39')],{'$or':_['map'](_0x35848c,function(_0x4bf818){if(_0x4bf818['type']!==_0xb9a6('0x3d')){var _0x4f410c={};_0x4f410c[_0x4bf818['name']]={'$like':'%'+_0xa209d0['query'][_0xb9a6('0x3b')]+'%'};return _0x4f410c;}})});}_0x1c64ca=_[_0xb9a6('0x3c')]({},_0x1c64ca,_0xa209d0[_0xb9a6('0x3e')]);var _0x25d864={'where':_0x1c64ca[_0xb9a6('0x39')]};return db['Interval'][_0xb9a6('0x20')](_0x25d864)[_0xb9a6('0x24')](function(_0x26cd36){_0x5ac084[_0xb9a6('0x20')]=_0x26cd36;if(_0xa209d0['query'][_0xb9a6('0x3f')]){_0x1c64ca['include']=[{'all':!![]}];}return db[_0xb9a6('0x40')][_0xb9a6('0x41')](_0x1c64ca);})[_0xb9a6('0x24')](function(_0x26aecb){_0x5ac084[_0xb9a6('0x42')]=_0x26aecb;return _0x5ac084;})[_0xb9a6('0x24')](respondWithFilteredResult(_0x44be6f,_0x1c64ca))[_0xb9a6('0x43')](handleError(_0x44be6f,null));};exports[_0xb9a6('0x44')]=function(_0x3f32ec,_0x18a133){var _0x17c412={'raw':!![],'where':{'id':_0x3f32ec['params']['id']}},_0x26baf0={};_0x26baf0['model']=_['keys'](db[_0xb9a6('0x40')]['rawAttributes']);_0x26baf0['query']=_[_0xb9a6('0x30')](_0x3f32ec[_0xb9a6('0x2f')]);_0x26baf0[_0xb9a6('0x31')]=_[_0xb9a6('0x32')](_0x26baf0['model'],_0x26baf0[_0xb9a6('0x2f')]);_0x17c412[_0xb9a6('0x33')]=_['intersection'](_0x26baf0[_0xb9a6('0x2e')],qs[_0xb9a6('0x34')](_0x3f32ec[_0xb9a6('0x2f')][_0xb9a6('0x34')]));_0x17c412['attributes']=_0x17c412[_0xb9a6('0x33')][_0xb9a6('0x35')]?_0x17c412[_0xb9a6('0x33')]:_0x26baf0[_0xb9a6('0x2e')];if(_0x3f32ec['query'][_0xb9a6('0x3f')]){_0x17c412[_0xb9a6('0x45')]=[{'all':!![]}];}_0x17c412=_[_0xb9a6('0x3c')]({},_0x17c412,_0x3f32ec['options']);return db[_0xb9a6('0x40')][_0xb9a6('0x46')](_0x17c412)['then'](handleEntityNotFound(_0x18a133,null))[_0xb9a6('0x24')](respondWithResult(_0x18a133,null))[_0xb9a6('0x43')](handleError(_0x18a133,null));};exports[_0xb9a6('0x47')]=function(_0x4ab715,_0x4ca69c){return db[_0xb9a6('0x40')][_0xb9a6('0x47')](_0x4ab715[_0xb9a6('0x48')],{})[_0xb9a6('0x24')](function(_0x160064){var _0x1679c6=_0x4ab715[_0xb9a6('0x49')]['get']({'plain':!![]});if(!_0x1679c6)throw new Error(_0xb9a6('0x4a'));if(_0x1679c6[_0xb9a6('0x4b')]===_0xb9a6('0x49')){var _0x5e88aa=_0x160064[_0xb9a6('0x4c')]({'plain':!![]});var _0x391b1e=_0xb9a6('0x26');return db[_0xb9a6('0x4d')][_0xb9a6('0x46')]({'where':{'name':_0x391b1e,'userProfileId':_0x1679c6[_0xb9a6('0x4e')]},'raw':!![]})[_0xb9a6('0x24')](function(_0x4c7195){if(_0x4c7195&&_0x4c7195['autoAssociation']===0x0){return db['UserProfileResource'][_0xb9a6('0x47')]({'name':_0x5e88aa[_0xb9a6('0x29')],'resourceId':_0x5e88aa['id'],'type':_0x4c7195['name'],'sectionId':_0x4c7195['id']},{})['then'](function(){return _0x160064;});}else{return _0x160064;}})[_0xb9a6('0x43')](function(_0x3f1e33){logger[_0xb9a6('0x4f')](_0xb9a6('0x50'),_0x3f1e33);throw _0x3f1e33;});}return _0x160064;})[_0xb9a6('0x24')](respondWithResult(_0x4ca69c,0xc9))[_0xb9a6('0x43')](handleError(_0x4ca69c,null));};exports[_0xb9a6('0x51')]=function(_0x58aea0,_0x3c2f2e){if(_0x58aea0[_0xb9a6('0x48')]['id']){delete _0x58aea0['body']['id'];}return db[_0xb9a6('0x40')][_0xb9a6('0x46')]({'where':{'id':_0x58aea0['params']['id']}})[_0xb9a6('0x24')](handleEntityNotFound(_0x3c2f2e,null))[_0xb9a6('0x24')](saveUpdates(_0x58aea0[_0xb9a6('0x48')],null))[_0xb9a6('0x24')](respondWithResult(_0x3c2f2e,null))['catch'](handleError(_0x3c2f2e,null));};exports[_0xb9a6('0x25')]=function(_0x23638e,_0x555c99){return db[_0xb9a6('0x40')]['find']({'where':{'id':_0x23638e[_0xb9a6('0x52')]['id']}})[_0xb9a6('0x24')](handleEntityNotFound(_0x555c99,null))['then'](removeEntity(_0x555c99,null))['catch'](handleError(_0x555c99,null));};exports[_0xb9a6('0x53')]=function(_0x177ef6,_0x4be8fe,_0x3732a4){if(_0x177ef6['body']['id']){delete _0x177ef6[_0xb9a6('0x48')]['id'];}return db[_0xb9a6('0x40')][_0xb9a6('0x46')]({'where':{'id':_0x177ef6[_0xb9a6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4be8fe,null))['then'](function(_0x4807b4){if(_0x4807b4){_0x177ef6[_0xb9a6('0x48')][_0xb9a6('0x54')]=_0x4807b4['id'];return db['Interval'][_0xb9a6('0x47')](_0x177ef6[_0xb9a6('0x48')]);}})[_0xb9a6('0x24')](respondWithResult(_0x4be8fe,null))[_0xb9a6('0x43')](handleError(_0x4be8fe,null));};exports[_0xb9a6('0x55')]=function(_0x314805,_0x19fb86,_0x454d16){var _0x176706={};var _0x123c03={};var _0x50994a;var _0x5239d3;return db[_0xb9a6('0x40')][_0xb9a6('0x56')]({'where':{'id':_0x314805['params']['id']}})[_0xb9a6('0x24')](handleEntityNotFound(_0x19fb86,null))['then'](function(_0x33872b){if(_0x33872b){_0x50994a=_0x33872b;_0x123c03[_0xb9a6('0x2e')]=_[_0xb9a6('0x30')](db['Interval']['rawAttributes']);_0x123c03[_0xb9a6('0x2f')]=_[_0xb9a6('0x30')](_0x314805[_0xb9a6('0x2f')]);_0x123c03[_0xb9a6('0x31')]=_[_0xb9a6('0x32')](_0x123c03[_0xb9a6('0x2e')],_0x123c03[_0xb9a6('0x2f')]);_0x176706[_0xb9a6('0x33')]=_[_0xb9a6('0x32')](_0x123c03['model'],qs['fields'](_0x314805['query'][_0xb9a6('0x34')]));_0x176706['attributes']=_0x176706['attributes']['length']?_0x176706[_0xb9a6('0x33')]:_0x123c03['model'];_0x176706[_0xb9a6('0x57')]=qs[_0xb9a6('0x38')](_0x314805[_0xb9a6('0x2f')]['sort']);_0x176706[_0xb9a6('0x39')]=qs[_0xb9a6('0x31')](_[_0xb9a6('0x3a')](_0x314805['query'],_0x123c03['filters']));if(_0x314805[_0xb9a6('0x2f')][_0xb9a6('0x3b')]){_0x176706[_0xb9a6('0x39')]=_[_0xb9a6('0x3c')](_0x176706[_0xb9a6('0x39')],{'$or':_[_0xb9a6('0x2b')](_0x176706[_0xb9a6('0x33')],function(_0x56e487){var _0x294585={};_0x294585[_0x56e487]={'$like':'%'+_0x314805['query'][_0xb9a6('0x3b')]+'%'};return _0x294585;})});}_0x176706=_[_0xb9a6('0x3c')]({},_0x176706,_0x314805[_0xb9a6('0x3e')]);return _0x50994a[_0xb9a6('0x55')](_0x176706);}})[_0xb9a6('0x24')](function(_0x116095){if(_0x116095){_0x5239d3=_0x116095[_0xb9a6('0x35')];if(!_0x314805[_0xb9a6('0x2f')][_0xb9a6('0x36')]('nolimit')){_0x176706['limit']=qs['limit'](_0x314805[_0xb9a6('0x2f')][_0xb9a6('0x1f')]);_0x176706[_0xb9a6('0x1d')]=qs['offset'](_0x314805[_0xb9a6('0x2f')][_0xb9a6('0x1d')]);}return _0x50994a[_0xb9a6('0x55')](_0x176706);}})['then'](function(_0x1882ab){if(_0x1882ab){return _0x1882ab?{'count':_0x5239d3,'rows':_0x1882ab}:null;}})[_0xb9a6('0x24')](respondWithResult(_0x19fb86,null))[_0xb9a6('0x43')](handleError(_0x19fb86,null));};exports[_0xb9a6('0x58')]=function(_0x1315eb,_0x2c3089,_0x271eea){return db[_0xb9a6('0x40')][_0xb9a6('0x56')]({'where':{'id':_0x1315eb['params']['id']}})[_0xb9a6('0x24')](handleEntityNotFound(_0x2c3089,null))[_0xb9a6('0x24')](function(_0x55eedf){if(_0x55eedf){return db[_0xb9a6('0x59')]['transaction'](function(_0x51a7b1){return db[_0xb9a6('0x40')][_0xb9a6('0x25')]({'where':{'IntervalId':_0x1315eb['params']['id']},'transaction':_0x51a7b1})[_0xb9a6('0x24')](function(_0x1e2055){var _0x30914d=_[_0xb9a6('0x2b')](_0x1315eb[_0xb9a6('0x48')],function(_0x800f23){delete _0x800f23['id'];_0x800f23[_0xb9a6('0x54')]=_0x1315eb['params']['id'];return _0x800f23;});return db[_0xb9a6('0x40')][_0xb9a6('0x5a')](_0x30914d,{'transaction':_0x51a7b1});});})[_0xb9a6('0x24')](function(){return db[_0xb9a6('0x40')][_0xb9a6('0x41')]({'where':{'IntervalId':_0x1315eb[_0xb9a6('0x52')]['id']}});});}})[_0xb9a6('0x24')](respondWithResult(_0x2c3089,null))[_0xb9a6('0x43')](handleError(_0x2c3089,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ecc2a8d..da6ceed 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 _0xffd9=['./interval.attributes','define','rewrite','lodash','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x3ac3e7,_0x334531){var _0x4703ee=function(_0x507c5b){while(--_0x507c5b){_0x3ac3e7['push'](_0x3ac3e7['shift']());}};_0x4703ee(++_0x334531);}(_0xffd9,0x1db));var _0x9ffd=function(_0xb0ec22,_0x113fab){_0xb0ec22=_0xb0ec22-0x0;var _0x3a6733=_0xffd9[_0xb0ec22];return _0x3a6733;};'use strict';var _=require(_0x9ffd('0x0'));var util=require('util');var logger=require(_0x9ffd('0x1'))('api');var moment=require(_0x9ffd('0x2'));var BPromise=require(_0x9ffd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ffd('0x4'));var attributes=require(_0x9ffd('0x5'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x2525f5,_0x578e74){return _0x2525f5[_0x9ffd('0x6')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e51ec,_0x455678){extensions[_0x9ffd('0x7')](_0x2525f5,_0x4e51ec);},'afterBulkCreate':function(_0x59f2c9,_0x5bfbc5,_0x46f0a2){_0x46f0a2();extensions[_0x9ffd('0x7')](_0x2525f5,_0x59f2c9[0x0]);},'afterUpdate':function(_0x38780f,_0x2c2fdf){extensions['rewrite'](_0x2525f5,_0x38780f);},'afterDestroy':function(_0x513941,_0x2dd745){extensions[_0x9ffd('0x7')](_0x2525f5,_0x513941);}}});}; \ No newline at end of file +var _0xd507=['rewrite','api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval'];(function(_0x443b1e,_0xf7ffe9){var _0x3beb6f=function(_0x1cd133){while(--_0x1cd133){_0x443b1e['push'](_0x443b1e['shift']());}};_0x3beb6f(++_0xf7ffe9);}(_0xd507,0x114));var _0x7d50=function(_0x2b456e,_0x5d713a){_0x2b456e=_0x2b456e-0x0;var _0x47b420=_0xd507[_0x2b456e];return _0x47b420;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7d50('0x0'));var moment=require(_0x7d50('0x1'));var BPromise=require('bluebird');var rp=require(_0x7d50('0x2'));var fs=require('fs');var path=require(_0x7d50('0x3'));var rimraf=require(_0x7d50('0x4'));var config=require(_0x7d50('0x5'));var attributes=require(_0x7d50('0x6'));var extensions=require(_0x7d50('0x7'));module['exports']=function(_0x3d8396,_0x10aab0){return _0x3d8396[_0x7d50('0x8')](_0x7d50('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a4e56,_0x1bf1f8){extensions[_0x7d50('0xa')](_0x3d8396,_0x1a4e56);},'afterBulkCreate':function(_0x212658,_0x3b2c11,_0x169ad0){_0x169ad0();extensions[_0x7d50('0xa')](_0x3d8396,_0x212658[0x0]);},'afterUpdate':function(_0x57299e,_0x4ca1d3){extensions[_0x7d50('0xa')](_0x3d8396,_0x57299e);},'afterDestroy':function(_0x141dc3,_0x1e76ea){extensions['rewrite'](_0x3d8396,_0x141dc3);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a0a40e7..371faa4 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 92fd63d..60024fb 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x151dee,_0x3f620f){var _0x36879b=function(_0x5a7c23){while(--_0x5a7c23){_0x151dee['push'](_0x151dee['shift']());}};_0x36879b(++_0x3f620f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x283784,_0x2cca85){_0x283784=_0x283784-0x0;var _0x155b2b=_0x5f2f[_0x283784];return _0x155b2b;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1b2704,_0x345e20){var _0x4e3e41=function(_0x480222){while(--_0x480222){_0x1b2704['push'](_0x1b2704['shift']());}};_0x4e3e41(++_0x345e20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3bb9da,_0x502962){_0x3bb9da=_0x3bb9da-0x0;var _0x17eef7=_0x5f2f[_0x3bb9da];return _0x17eef7;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 45e5054..d1543f0 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 _0x4b6f=['customfield_11502','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding','utf8','end','status','json','parse','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','socket','remoteAddress','bluebird','https','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','customfield_11500','email','fields','customfield_11501','oldToken'];(function(_0x1d19fc,_0x182425){var _0x5667d0=function(_0x2dbd0d){while(--_0x2dbd0d){_0x1d19fc['push'](_0x1d19fc['shift']());}};_0x5667d0(++_0x182425);}(_0x4b6f,0x19e));var _0xf4b6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4b6f[_0x618414];return _0x21c19a;};'use strict';var BPromise=require(_0xf4b6('0x0'));var https=require(_0xf4b6('0x1'));var logger=require(_0xf4b6('0x2'))('api');var USERNAME=_0xf4b6('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x53bff7,_0x384ab4){var _0x1e815a={'fields':{'project':{'key':_0x53bff7[_0xf4b6('0x4')]||_0xf4b6('0x5')},'summary':(_0x53bff7[_0xf4b6('0x6')]||_0xf4b6('0x7'))+_0xf4b6('0x8')+_0x53bff7['ip'],'description':_0x53bff7['description']||JSON[_0xf4b6('0x9')](_0x53bff7),'issuetype':{'name':_0x53bff7[_0xf4b6('0xa')]||'Bug'}}};_0x1e815a['fields'][_0xf4b6('0xb')]=_0x53bff7[_0xf4b6('0xc')];_0x1e815a[_0xf4b6('0xd')][_0xf4b6('0xe')]=_0x53bff7[_0xf4b6('0xf')];_0x1e815a[_0xf4b6('0xd')][_0xf4b6('0x10')]=_0x53bff7['newToken'];_0x1e815a[_0xf4b6('0xd')][_0xf4b6('0x11')]=_0x53bff7[_0xf4b6('0x12')];_0x1e815a['fields']['customfield_11504']=_0x53bff7[_0xf4b6('0x13')];_0x1e815a[_0xf4b6('0xd')][_0xf4b6('0x14')]=_0x53bff7['ip'];var _0x3b62e2={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xf4b6('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xf4b6('0x16'),'Authorization':_0xf4b6('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xf4b6('0x18')](_0xf4b6('0x19'))}};var _0x65824b=JSON['stringify'](_0x1e815a);var _0x4ebd8b=https['request'](_0x3b62e2,function(_0x562020){_0x562020[_0xf4b6('0x1a')](_0xf4b6('0x1b'));var _0x315e65='';_0x562020['on']('data',function(_0x235c6b){_0x315e65+=_0x235c6b;});_0x562020['on'](_0xf4b6('0x1c'),function(){if(_0x384ab4){return _0x384ab4[_0xf4b6('0x1d')](_0x562020['statusCode'])[_0xf4b6('0x1e')](JSON[_0xf4b6('0x1f')](_0x315e65));}});});_0x4ebd8b['on']('error',function(_0x415cca){if(_0x384ab4){return _0x384ab4[_0xf4b6('0x1d')](0x1f4)[_0xf4b6('0x1e')]({'errors':[{'message':_0xf4b6('0x20'),'type':_0xf4b6('0x21')}]});}});_0x4ebd8b[_0xf4b6('0x22')](_0x65824b);_0x4ebd8b[_0xf4b6('0x1c')]();}exports[_0xf4b6('0x23')]=openIssue;exports[_0xf4b6('0x24')]=function(_0x199bf2,_0x243ee8){_0x199bf2[_0xf4b6('0x25')]['ip']=_0x199bf2[_0xf4b6('0x26')][_0xf4b6('0x27')]||_0x199bf2[_0xf4b6('0x28')]['remoteAddress']||_0x199bf2[_0xf4b6('0x29')][_0xf4b6('0x2a')]||_0x199bf2[_0xf4b6('0x28')][_0xf4b6('0x29')][_0xf4b6('0x2a')];return openIssue(_0x199bf2[_0xf4b6('0x25')],_0x243ee8);}; \ No newline at end of file +var _0x1c49=['Bug','email','customfield_11501','oldToken','fields','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','request','setEncoding','data','end','status','json','api.jira','openIssue','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify'];(function(_0x27cf94,_0x305114){var _0x9d473a=function(_0xf25d79){while(--_0xf25d79){_0x27cf94['push'](_0x27cf94['shift']());}};_0x9d473a(++_0x305114);}(_0x1c49,0xe6));var _0x91c4=function(_0x5f8af1,_0xf3ba33){_0x5f8af1=_0x5f8af1-0x0;var _0x411e24=_0x1c49[_0x5f8af1];return _0x411e24;};'use strict';var BPromise=require(_0x91c4('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x91c4('0x1'));var USERNAME=_0x91c4('0x2');var PASSWORD=_0x91c4('0x3');function openIssue(_0x1895e6,_0x191118){var _0x2a5232={'fields':{'project':{'key':_0x1895e6[_0x91c4('0x4')]||'MOTGUI'},'summary':(_0x1895e6[_0x91c4('0x5')]||_0x91c4('0x6'))+_0x91c4('0x7')+_0x1895e6['ip'],'description':_0x1895e6[_0x91c4('0x8')]||JSON[_0x91c4('0x9')](_0x1895e6),'issuetype':{'name':_0x1895e6['issuetype']||_0x91c4('0xa')}}};_0x2a5232['fields']['customfield_11500']=_0x1895e6[_0x91c4('0xb')];_0x2a5232['fields'][_0x91c4('0xc')]=_0x1895e6[_0x91c4('0xd')];_0x2a5232[_0x91c4('0xe')][_0x91c4('0xf')]=_0x1895e6['newToken'];_0x2a5232['fields'][_0x91c4('0x10')]=_0x1895e6[_0x91c4('0x11')];_0x2a5232[_0x91c4('0xe')][_0x91c4('0x12')]=_0x1895e6[_0x91c4('0x13')];_0x2a5232[_0x91c4('0xe')][_0x91c4('0x14')]=_0x1895e6['ip'];var _0x28508d={'host':_0x91c4('0x15'),'port':0x1bb,'path':_0x91c4('0x16'),'method':_0x91c4('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x91c4('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x91c4('0x19')]('base64')}};var _0x5e4fcd=JSON[_0x91c4('0x9')](_0x2a5232);var _0x4e51d7=https[_0x91c4('0x1a')](_0x28508d,function(_0x4c72f8){_0x4c72f8[_0x91c4('0x1b')]('utf8');var _0x12cb82='';_0x4c72f8['on'](_0x91c4('0x1c'),function(_0x4c7ab7){_0x12cb82+=_0x4c7ab7;});_0x4c72f8['on'](_0x91c4('0x1d'),function(){if(_0x191118){return _0x191118[_0x91c4('0x1e')](_0x4c72f8['statusCode'])[_0x91c4('0x1f')](JSON['parse'](_0x12cb82));}});});_0x4e51d7['on']('error',function(_0x42cefa){if(_0x191118){return _0x191118['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x91c4('0x20')}]});}});_0x4e51d7['write'](_0x5e4fcd);_0x4e51d7[_0x91c4('0x1d')]();}exports[_0x91c4('0x21')]=openIssue;exports[_0x91c4('0x22')]=function(_0x17eeb8,_0x414ee6){_0x17eeb8[_0x91c4('0x23')]['ip']=_0x17eeb8['headers'][_0x91c4('0x24')]||_0x17eeb8['connection'][_0x91c4('0x25')]||_0x17eeb8[_0x91c4('0x26')][_0x91c4('0x25')]||_0x17eeb8[_0x91c4('0x27')]['socket'][_0x91c4('0x25')];return openIssue(_0x17eeb8[_0x91c4('0x23')],_0x414ee6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b866a5f..f2873b6 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 _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2dae,0xc3));var _0xe2da=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x2dae[_0x2dc343];return _0x51eac5;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4e05bc,_0x2e0072){var _0x29f82b=function(_0x571d02){while(--_0x571d02){_0x4e05bc['push'](_0x4e05bc['shift']());}};_0x29f82b(++_0x2e0072);}(_0x22fb,0x192));var _0xb22f=function(_0x288aef,_0x2634d5){_0x288aef=_0x288aef-0x0;var _0x3c4599=_0x22fb[_0x288aef];return _0x3c4599;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e6edf7b..a5f00ea 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x30b98c,_0x2335e9){_0x30b98c=_0x30b98c-0x0;var _0x444cb6=_0x7a54[_0x30b98c];return _0x444cb6;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2cc258,_0x222576){_0x2cc258=_0x2cc258-0x0;var _0x194a34=_0x7a54[_0x2cc258];return _0x194a34;};'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 fdabfaa..a9413ad 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 _0x0bde=['end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','catch','params','length','includeAll','merge','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x36b474,_0x57d2e9){var _0x510f44=function(_0x251824){while(--_0x251824){_0x36b474['push'](_0x36b474['shift']());}};_0x510f44(++_0x57d2e9);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');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(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}exports['index']=function(_0x273b95,_0x3789a1){var _0x441475={},_0x23a317={},_0x2d7f2f={'count':0x0,'rows':[]};var _0x17e614=_[_0xe0bd('0x28')](db['JscriptyAnswerReport'][_0xe0bd('0x29')],function(_0x137206){return{'name':_0x137206[_0xe0bd('0x2a')],'type':_0x137206[_0xe0bd('0x2b')][_0xe0bd('0x2c')]};});_0x23a317[_0xe0bd('0x2d')]=_['map'](_0x17e614,_0xe0bd('0x27'));_0x23a317[_0xe0bd('0x2e')]=_[_0xe0bd('0x2f')](_0x273b95[_0xe0bd('0x2e')]);_0x23a317[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x23a317[_0xe0bd('0x2d')],_0x23a317[_0xe0bd('0x2e')]);_0x441475['attributes']=_['intersection'](_0x23a317[_0xe0bd('0x2d')],qs[_0xe0bd('0x32')](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x441475[_0xe0bd('0x33')]=_0x441475['attributes']['length']?_0x441475['attributes']:_0x23a317[_0xe0bd('0x2d')];if(!_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x34')](_0xe0bd('0x35'))){_0x441475[_0xe0bd('0x36')]=qs[_0xe0bd('0x36')](_0x273b95['query'][_0xe0bd('0x36')]);_0x441475[_0xe0bd('0x1e')]=qs[_0xe0bd('0x1e')](_0x273b95['query'][_0xe0bd('0x1e')]);}_0x441475[_0xe0bd('0x37')]=qs['sort'](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x38')]);_0x441475[_0xe0bd('0x39')]=qs['filters'](_[_0xe0bd('0x3a')](_0x273b95['query'],_0x23a317[_0xe0bd('0x30')]),_0x17e614);if(_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x3b')]){_0x441475[_0xe0bd('0x39')]=_['merge'](_0x441475[_0xe0bd('0x39')],{'$or':_[_0xe0bd('0x28')](_0x17e614,function(_0x7f9272){if(_0x7f9272['type']!=='VIRTUAL'){var _0x23064a={};_0x23064a[_0x7f9272[_0xe0bd('0x27')]]={'$like':'%'+_0x273b95[_0xe0bd('0x2e')]['filter']+'%'};return _0x23064a;}})});}_0x441475=_['merge']({},_0x441475,_0x273b95[_0xe0bd('0x3c')]);var _0x383b08={'where':_0x441475[_0xe0bd('0x39')]};return db[_0xe0bd('0x3d')]['count'](_0x383b08)[_0xe0bd('0x25')](function(_0x23b596){_0x2d7f2f[_0xe0bd('0x20')]=_0x23b596;if(_0x273b95['query']['includeAll']){_0x441475[_0xe0bd('0x3e')]=[{'all':!![]}];}return db[_0xe0bd('0x3d')][_0xe0bd('0x3f')](_0x441475);})[_0xe0bd('0x25')](function(_0x5ada76){_0x2d7f2f[_0xe0bd('0x40')]=_0x5ada76;return _0x2d7f2f;})[_0xe0bd('0x25')](respondWithFilteredResult(_0x3789a1,_0x441475))[_0xe0bd('0x41')](handleError(_0x3789a1,null));};exports['show']=function(_0x499e16,_0x27a582){var _0x52a0af={'raw':!![],'where':{'id':_0x499e16[_0xe0bd('0x42')]['id']}},_0x24be53={};_0x24be53['model']=_[_0xe0bd('0x2f')](db[_0xe0bd('0x3d')][_0xe0bd('0x29')]);_0x24be53['query']=_[_0xe0bd('0x2f')](_0x499e16[_0xe0bd('0x2e')]);_0x24be53[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x24be53[_0xe0bd('0x2d')],_0x24be53[_0xe0bd('0x2e')]);_0x52a0af[_0xe0bd('0x33')]=_[_0xe0bd('0x31')](_0x24be53['model'],qs[_0xe0bd('0x32')](_0x499e16[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x52a0af[_0xe0bd('0x33')]=_0x52a0af[_0xe0bd('0x33')][_0xe0bd('0x43')]?_0x52a0af[_0xe0bd('0x33')]:_0x24be53[_0xe0bd('0x2d')];if(_0x499e16['query'][_0xe0bd('0x44')]){_0x52a0af[_0xe0bd('0x3e')]=[{'all':!![]}];}_0x52a0af=_[_0xe0bd('0x45')]({},_0x52a0af,_0x499e16[_0xe0bd('0x3c')]);return db[_0xe0bd('0x3d')]['find'](_0x52a0af)[_0xe0bd('0x25')](handleEntityNotFound(_0x27a582,null))['then'](respondWithResult(_0x27a582,null))['catch'](handleError(_0x27a582,null));};exports['create']=function(_0x2d7e00,_0x55dd83){return db['JscriptyAnswerReport'][_0xe0bd('0x46')](_0x2d7e00[_0xe0bd('0x47')],{})[_0xe0bd('0x25')](respondWithResult(_0x55dd83,0xc9))[_0xe0bd('0x41')](handleError(_0x55dd83,null));};exports[_0xe0bd('0x48')]=function(_0x220147,_0xe2b989){if(_0x220147[_0xe0bd('0x47')]['id']){delete _0x220147[_0xe0bd('0x47')]['id'];}return db[_0xe0bd('0x3d')]['find']({'where':{'id':_0x220147[_0xe0bd('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2b989,null))['then'](saveUpdates(_0x220147[_0xe0bd('0x47')],null))[_0xe0bd('0x25')](respondWithResult(_0xe2b989,null))[_0xe0bd('0x41')](handleError(_0xe2b989,null));};exports['destroy']=function(_0x281a60,_0x3fe076){return db[_0xe0bd('0x3d')][_0xe0bd('0x49')]({'where':{'id':_0x281a60[_0xe0bd('0x42')]['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x3fe076,null))[_0xe0bd('0x25')](removeEntity(_0x3fe076,null))[_0xe0bd('0x41')](handleError(_0x3fe076,null));};exports[_0xe0bd('0x4a')]=function(_0x1f85ef,_0x29c7f8){return db[_0xe0bd('0x3d')]['describe']()[_0xe0bd('0x25')](respondWithResult(_0x29c7f8,null))[_0xe0bd('0x41')](handleError(_0x29c7f8,null));}; \ No newline at end of file +var _0x3bd7=['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','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv'];(function(_0x18cd9b,_0x5003b8){var _0x5e4b10=function(_0xb97db4){while(--_0xb97db4){_0x18cd9b['push'](_0x18cd9b['shift']());}};_0x5e4b10(++_0x5003b8);}(_0x3bd7,0x199));var _0x73bd=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x3bd7[_0x9b5bb2];return _0x2e1e92;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];function respondWithStatusCode(_0x31c882,_0x41f324){_0x41f324=_0x41f324||0xcc;return function(_0x2a5dea){if(_0x2a5dea){return _0x31c882[_0x73bd('0x14')](_0x41f324);}return _0x31c882['status'](_0x41f324)[_0x73bd('0x15')]();};}function respondWithResult(_0x5c4bc8,_0x189007){_0x189007=_0x189007||0xc8;return function(_0x3eab86){if(_0x3eab86){return _0x5c4bc8[_0x73bd('0x16')](_0x189007)[_0x73bd('0x17')](_0x3eab86);}};}function respondWithFilteredResult(_0x3e628a,_0x5ea8db){return function(_0x41663e){if(_0x41663e){var _0xfdf66=typeof _0x5ea8db[_0x73bd('0x18')]===_0x73bd('0x19')&&typeof _0x5ea8db[_0x73bd('0x1a')]===_0x73bd('0x19');var _0x10e371=_0x41663e[_0x73bd('0x1b')];var _0x21787b=_0xfdf66?0x0:_0x5ea8db['offset'];var _0x1e559b=_0xfdf66?_0x41663e[_0x73bd('0x1b')]:_0x5ea8db[_0x73bd('0x18')]+_0x5ea8db[_0x73bd('0x1a')];var _0x1cb0e3;if(_0x1e559b>=_0x10e371){_0x1e559b=_0x10e371;_0x1cb0e3=0xc8;}else{_0x1cb0e3=0xce;}_0x3e628a[_0x73bd('0x16')](_0x1cb0e3);return _0x3e628a[_0x73bd('0x1c')](_0x73bd('0x1d'),_0x21787b+'-'+_0x1e559b+'/'+_0x10e371)[_0x73bd('0x17')](_0x41663e);}return null;};}function patchUpdates(_0x57d1ec){return function(_0x459965){try{jsonpatch[_0x73bd('0x1e')](_0x459965,_0x57d1ec,!![]);}catch(_0x292f8c){return BPromise['reject'](_0x292f8c);}return _0x459965['save']();};}function saveUpdates(_0x4f23e6,_0x10b388){return function(_0x269e84){if(_0x269e84){return _0x269e84['update'](_0x4f23e6)[_0x73bd('0x1f')](function(_0x22574c){return _0x22574c;});}return null;};}function removeEntity(_0x5b7bbb,_0x325cc1){return function(_0x1e22c5){if(_0x1e22c5){return _0x1e22c5[_0x73bd('0x20')]()[_0x73bd('0x1f')](function(){_0x5b7bbb[_0x73bd('0x16')](0xcc)[_0x73bd('0x15')]();});}};}function handleEntityNotFound(_0x2dd70b,_0x36f7e0){return function(_0x840215){if(!_0x840215){_0x2dd70b[_0x73bd('0x14')](0x194);}return _0x840215;};}function handleError(_0x473527,_0x388698){_0x388698=_0x388698||0x1f4;return function(_0x52e910){logger['error'](_0x52e910[_0x73bd('0x21')]);if(_0x52e910[_0x73bd('0x22')]){delete _0x52e910['name'];}_0x473527[_0x73bd('0x16')](_0x388698)[_0x73bd('0x23')](_0x52e910);};}exports[_0x73bd('0x24')]=function(_0x5ada8d,_0x5ae04e){var _0x2f38fe={},_0x3f15f8={},_0x315318={'count':0x0,'rows':[]};var _0x5be8d6=_[_0x73bd('0x25')](db['JscriptyAnswerReport'][_0x73bd('0x26')],function(_0x2701da){return{'name':_0x2701da['fieldName'],'type':_0x2701da['type'][_0x73bd('0x27')]};});_0x3f15f8[_0x73bd('0x28')]=_[_0x73bd('0x25')](_0x5be8d6,_0x73bd('0x22'));_0x3f15f8['query']=_[_0x73bd('0x29')](_0x5ada8d['query']);_0x3f15f8[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],_0x3f15f8[_0x73bd('0x2c')]);_0x2f38fe['attributes']=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],qs[_0x73bd('0x2d')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x2f38fe[_0x73bd('0x2e')]=_0x2f38fe[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x2f38fe['attributes']:_0x3f15f8[_0x73bd('0x28')];if(!_0x5ada8d[_0x73bd('0x2c')]['hasOwnProperty'](_0x73bd('0x30'))){_0x2f38fe[_0x73bd('0x1a')]=qs['limit'](_0x5ada8d[_0x73bd('0x2c')]['limit']);_0x2f38fe[_0x73bd('0x18')]=qs['offset'](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x18')]);}_0x2f38fe[_0x73bd('0x31')]=qs[_0x73bd('0x32')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x32')]);_0x2f38fe[_0x73bd('0x33')]=qs['filters'](_[_0x73bd('0x34')](_0x5ada8d[_0x73bd('0x2c')],_0x3f15f8['filters']),_0x5be8d6);if(_0x5ada8d[_0x73bd('0x2c')]['filter']){_0x2f38fe[_0x73bd('0x33')]=_[_0x73bd('0x35')](_0x2f38fe[_0x73bd('0x33')],{'$or':_[_0x73bd('0x25')](_0x5be8d6,function(_0x367597){if(_0x367597['type']!==_0x73bd('0x36')){var _0x2de851={};_0x2de851[_0x367597[_0x73bd('0x22')]]={'$like':'%'+_0x5ada8d['query'][_0x73bd('0x37')]+'%'};return _0x2de851;}})});}_0x2f38fe=_[_0x73bd('0x35')]({},_0x2f38fe,_0x5ada8d[_0x73bd('0x38')]);var _0x30e148={'where':_0x2f38fe[_0x73bd('0x33')]};return db[_0x73bd('0x39')][_0x73bd('0x1b')](_0x30e148)[_0x73bd('0x1f')](function(_0x519c3c){_0x315318[_0x73bd('0x1b')]=_0x519c3c;if(_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x3a')]){_0x2f38fe[_0x73bd('0x3b')]=[{'all':!![]}];}return db[_0x73bd('0x39')][_0x73bd('0x3c')](_0x2f38fe);})[_0x73bd('0x1f')](function(_0x48fed7){_0x315318[_0x73bd('0x3d')]=_0x48fed7;return _0x315318;})[_0x73bd('0x1f')](respondWithFilteredResult(_0x5ae04e,_0x2f38fe))[_0x73bd('0x3e')](handleError(_0x5ae04e,null));};exports[_0x73bd('0x3f')]=function(_0x532afd,_0x142532){var _0x234de7={'raw':!![],'where':{'id':_0x532afd[_0x73bd('0x40')]['id']}},_0xe91596={};_0xe91596[_0x73bd('0x28')]=_['keys'](db[_0x73bd('0x39')]['rawAttributes']);_0xe91596[_0x73bd('0x2c')]=_['keys'](_0x532afd[_0x73bd('0x2c')]);_0xe91596[_0x73bd('0x2a')]=_['intersection'](_0xe91596[_0x73bd('0x28')],_0xe91596[_0x73bd('0x2c')]);_0x234de7[_0x73bd('0x2e')]=_[_0x73bd('0x2b')](_0xe91596[_0x73bd('0x28')],qs['fields'](_0x532afd[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x234de7[_0x73bd('0x2e')]=_0x234de7[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x234de7[_0x73bd('0x2e')]:_0xe91596[_0x73bd('0x28')];if(_0x532afd[_0x73bd('0x2c')]['includeAll']){_0x234de7['include']=[{'all':!![]}];}_0x234de7=_[_0x73bd('0x35')]({},_0x234de7,_0x532afd[_0x73bd('0x38')]);return db[_0x73bd('0x39')]['find'](_0x234de7)[_0x73bd('0x1f')](handleEntityNotFound(_0x142532,null))['then'](respondWithResult(_0x142532,null))[_0x73bd('0x3e')](handleError(_0x142532,null));};exports[_0x73bd('0x41')]=function(_0x57df9e,_0x4905a4){return db['JscriptyAnswerReport'][_0x73bd('0x41')](_0x57df9e['body'],{})[_0x73bd('0x1f')](respondWithResult(_0x4905a4,0xc9))['catch'](handleError(_0x4905a4,null));};exports[_0x73bd('0x42')]=function(_0x1e2e28,_0x7b4baf){if(_0x1e2e28[_0x73bd('0x43')]['id']){delete _0x1e2e28['body']['id'];}return db[_0x73bd('0x39')][_0x73bd('0x44')]({'where':{'id':_0x1e2e28[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x7b4baf,null))[_0x73bd('0x1f')](saveUpdates(_0x1e2e28[_0x73bd('0x43')],null))[_0x73bd('0x1f')](respondWithResult(_0x7b4baf,null))[_0x73bd('0x3e')](handleError(_0x7b4baf,null));};exports['destroy']=function(_0x8b88f5,_0x47397d){return db['JscriptyAnswerReport'][_0x73bd('0x44')]({'where':{'id':_0x8b88f5[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x47397d,null))['then'](removeEntity(_0x47397d,null))[_0x73bd('0x3e')](handleError(_0x47397d,null));};exports[_0x73bd('0x45')]=function(_0x23b5ad,_0x2201c7){return db[_0x73bd('0x39')]['describe']()['then'](respondWithResult(_0x2201c7,null))['catch'](handleError(_0x2201c7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 591c566..0594743 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 _0x236f=['./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd0edc7,_0x13ffd6){var _0x3daeed=function(_0x27118){while(--_0x27118){_0xd0edc7['push'](_0xd0edc7['shift']());}};_0x3daeed(++_0x13ffd6);}(_0x236f,0xad));var _0xf236=function(_0x5b9020,_0x59a581){_0x5b9020=_0x5b9020-0x0;var _0x56e303=_0x236f[_0x5b9020];return _0x56e303;};'use strict';var _=require(_0xf236('0x0'));var util=require(_0xf236('0x1'));var logger=require(_0xf236('0x2'))(_0xf236('0x3'));var moment=require('moment');var BPromise=require(_0xf236('0x4'));var rp=require(_0xf236('0x5'));var fs=require('fs');var path=require(_0xf236('0x6'));var rimraf=require(_0xf236('0x7'));var config=require(_0xf236('0x8'));var attributes=require(_0xf236('0x9'));module[_0xf236('0xa')]=function(_0x4b5b79,_0x247a35){return _0x4b5b79[_0xf236('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xf236('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc69=['rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','path'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xcc69,0x83));var _0x9cc6=function(_0x93b411,_0x4263ca){_0x93b411=_0x93b411-0x0;var _0x14ce11=_0xcc69[_0x93b411];return _0x14ce11;};'use strict';var _=require(_0x9cc6('0x0'));var util=require(_0x9cc6('0x1'));var logger=require('../../config/logger')(_0x9cc6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cc6('0x3'));var rimraf=require(_0x9cc6('0x4'));var config=require(_0x9cc6('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9cc6('0x6')]=function(_0x5d6e1e,_0x36d404){return _0x5d6e1e['define'](_0x9cc6('0x7'),attributes,{'tableName':_0x9cc6('0x8'),'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 926974f..9a9fa6b 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 _0x300b=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','debug'];(function(_0x307938,_0x199b8d){var _0x35f6b5=function(_0x5bf390){while(--_0x5bf390){_0x307938['push'](_0x307938['shift']());}};_0x35f6b5(++_0x199b8d);}(_0x300b,0x1a9));var _0xb300=function(_0x6195d5,_0x229f91){_0x6195d5=_0x6195d5-0x0;var _0xe64eda=_0x300b[_0x6195d5];return _0xe64eda;};'use strict';var _=require(_0xb300('0x0'));var util=require(_0xb300('0x1'));var moment=require(_0xb300('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb300('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb300('0x4'));var logger=require('../../config/logger')(_0xb300('0x5'));var config=require('../../config/environment');var jayson=require(_0xb300('0x6'));var client=jayson[_0xb300('0x7')][_0xb300('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b7b80,_0x4f1b2b,_0xbe5f8e){return new BPromise(function(_0x3a9cdf,_0x4de410){return client['request'](_0x4b7b80,_0xbe5f8e)[_0xb300('0x9')](function(_0x3a588b){logger[_0xb300('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f1b2b,'request\x20sent');logger[_0xb300('0xb')](_0xb300('0xc'),_0x4f1b2b,_0xb300('0xd'),JSON['stringify'](_0x3a588b));if(_0x3a588b[_0xb300('0xe')]){if(_0x3a588b[_0xb300('0xe')][_0xb300('0xf')]===0x1f4){logger[_0xb300('0xe')](_0xb300('0x10'),_0x4f1b2b,_0x3a588b[_0xb300('0xe')]['message']);return _0x4de410(_0x3a588b['error'][_0xb300('0x11')]);}logger[_0xb300('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f1b2b,_0x3a588b[_0xb300('0xe')][_0xb300('0x11')]);return _0x3a9cdf(_0x3a588b['error']['message']);}else{logger[_0xb300('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f1b2b,'request\x20sent');_0x3a9cdf(_0x3a588b[_0xb300('0x12')][_0xb300('0x11')]);}})['catch'](function(_0xa31f4f){logger[_0xb300('0xe')](_0xb300('0x10'),_0x4f1b2b,_0xa31f4f);_0x4de410(_0xa31f4f);});});} \ No newline at end of file +var _0xb482=['rpc','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x542a47,_0x2f1c92){var _0x3850fb=function(_0x301df4){while(--_0x301df4){_0x542a47['push'](_0x542a47['shift']());}};_0x3850fb(++_0x2f1c92);}(_0xb482,0x175));var _0x2b48=function(_0x13cf41,_0x406970){_0x13cf41=_0x13cf41-0x0;var _0x3f1b4e=_0xb482[_0x13cf41];return _0x3f1b4e;};'use strict';var _=require('lodash');var util=require(_0x2b48('0x0'));var moment=require(_0x2b48('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b48('0x2'));var fs=require('fs');var Redis=require(_0x2b48('0x3'));var db=require(_0x2b48('0x4'))['db'];var utils=require(_0x2b48('0x5'));var logger=require(_0x2b48('0x6'))(_0x2b48('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b48('0x8'));var client=jayson['client'][_0x2b48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8e8250,_0x284db1,_0x2c32d8){return new BPromise(function(_0xc8966c,_0x14909a){return client[_0x2b48('0xa')](_0x8e8250,_0x2c32d8)[_0x2b48('0xb')](function(_0x4948c4){logger[_0x2b48('0xc')](_0x2b48('0xd'),_0x284db1,'request\x20sent');logger[_0x2b48('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x284db1,'request\x20sent',JSON['stringify'](_0x4948c4));if(_0x4948c4[_0x2b48('0xf')]){if(_0x4948c4[_0x2b48('0xf')][_0x2b48('0x10')]===0x1f4){logger[_0x2b48('0xf')](_0x2b48('0xd'),_0x284db1,_0x4948c4[_0x2b48('0xf')]['message']);return _0x14909a(_0x4948c4[_0x2b48('0xf')][_0x2b48('0x11')]);}logger[_0x2b48('0xf')](_0x2b48('0xd'),_0x284db1,_0x4948c4['error'][_0x2b48('0x11')]);return _0xc8966c(_0x4948c4['error'][_0x2b48('0x11')]);}else{logger[_0x2b48('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x284db1,_0x2b48('0x12'));_0xc8966c(_0x4948c4[_0x2b48('0x13')]['message']);}})['catch'](function(_0x58aede){logger[_0x2b48('0xf')](_0x2b48('0xd'),_0x284db1,_0x58aede);_0x14909a(_0x58aede);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index bd7b624..9ec603e 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 _0x2931=['/:id/summary','getSummary','create','post','clone','put','update','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','show','getSessions','/:id/answers','getAnswers'];(function(_0x43318b,_0x259c69){var _0x5d13b9=function(_0xd85545){while(--_0xd85545){_0x43318b['push'](_0x43318b['shift']());}};_0x5d13b9(++_0x259c69);}(_0x2931,0x66));var _0x1293=function(_0x242bca,_0x450a13){_0x242bca=_0x242bca-0x0;var _0x4a96bd=_0x2931[_0x242bca];return _0x4a96bd;};'use strict';var multer=require(_0x1293('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1293('0x1'));var express=require(_0x1293('0x2'));var router=express[_0x1293('0x3')]();var fs_extra=require(_0x1293('0x4'));var auth=require(_0x1293('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1293('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x1293('0x7')](),controller['index']);router[_0x1293('0x8')]('/:id',auth[_0x1293('0x7')](),controller[_0x1293('0x9')]);router[_0x1293('0x8')]('/:id/sessions',auth[_0x1293('0x7')](),controller[_0x1293('0xa')]);router[_0x1293('0x8')](_0x1293('0xb'),auth[_0x1293('0x7')](),controller[_0x1293('0xc')]);router[_0x1293('0x8')](_0x1293('0xd'),auth[_0x1293('0x7')](),timeout('30s'),controller[_0x1293('0xe')]);router['post']('/',auth[_0x1293('0x7')](),controller[_0x1293('0xf')]);router[_0x1293('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0x1293('0x11')]);router[_0x1293('0x12')]('/:id',auth[_0x1293('0x7')](),controller[_0x1293('0x13')]);router['delete'](_0x1293('0x14'),auth['isAuthenticated'](),controller[_0x1293('0x15')]);module[_0x1293('0x16')]=router; \ No newline at end of file +var _0xaa21=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0xaa21,0x13e));var _0x1aa2=function(_0x200258,_0x5bdf12){_0x200258=_0x200258-0x0;var _0x1edc1d=_0xaa21[_0x200258];return _0x1edc1d;};'use strict';var multer=require(_0x1aa2('0x0'));var util=require(_0x1aa2('0x1'));var path=require(_0x1aa2('0x2'));var timeout=require(_0x1aa2('0x3'));var express=require(_0x1aa2('0x4'));var router=express['Router']();var fs_extra=require(_0x1aa2('0x5'));var auth=require(_0x1aa2('0x6'));var interaction=require(_0x1aa2('0x7'));var config=require(_0x1aa2('0x8'));var controller=require(_0x1aa2('0x9'));router[_0x1aa2('0xa')]('/',auth['isAuthenticated'](),controller[_0x1aa2('0xb')]);router[_0x1aa2('0xa')](_0x1aa2('0xc'),auth[_0x1aa2('0xd')](),controller[_0x1aa2('0xe')]);router[_0x1aa2('0xa')]('/:id/sessions',auth[_0x1aa2('0xd')](),controller[_0x1aa2('0xf')]);router['get'](_0x1aa2('0x10'),auth[_0x1aa2('0xd')](),controller[_0x1aa2('0x11')]);router[_0x1aa2('0xa')](_0x1aa2('0x12'),auth[_0x1aa2('0xd')](),timeout(_0x1aa2('0x13')),controller['getSummary']);router['post']('/',auth[_0x1aa2('0xd')](),controller['create']);router[_0x1aa2('0x14')](_0x1aa2('0x15'),auth[_0x1aa2('0xd')](),controller[_0x1aa2('0x16')]);router[_0x1aa2('0x17')](_0x1aa2('0xc'),auth['isAuthenticated'](),controller[_0x1aa2('0x18')]);router[_0x1aa2('0x19')](_0x1aa2('0xc'),auth[_0x1aa2('0xd')](),controller['destroy']);module[_0x1aa2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 73221cb..a8751ea 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 _0xcea2=['BOOLEAN','sequelize','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x371eb1,_0x39b49e){var _0x44c2a1=function(_0x594b7c){while(--_0x594b7c){_0x371eb1['push'](_0x371eb1['shift']());}};_0x44c2a1(++_0x39b49e);}(_0xcea2,0x141));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x2cea('0x0'));var _=require(_0x2cea('0x1'));var util=require(_0x2cea('0x2'));module[_0x2cea('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x2cea('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2cea('0x5')](_0x2cea('0x6')),'set':function(_0x491e88){if(_[_0x2cea('0x7')](_0x491e88)){this[_0x2cea('0x8')](_0x2cea('0x9'),JSON[_0x2cea('0xa')](_0x491e88));}else if(_[_0x2cea('0xb')](_0x491e88)){this['setDataValue'](_0x2cea('0x9'),_0x491e88);}else{this[_0x2cea('0x8')](_0x2cea('0x9'),util['format'](_0x2cea('0xc'),this[_0x2cea('0xd')](_0x2cea('0x4'))||'',this[_0x2cea('0xd')](_0x2cea('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2cea('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2cea('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xaa02=['lodash','util','exports','STRING','name','TEXT','long','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x31dad5,_0x4fab4d){var _0x35c684=function(_0x265448){while(--_0x265448){_0x31dad5['push'](_0x31dad5['shift']());}};_0x35c684(++_0x4fab4d);}(_0xaa02,0x7e));var _0x2aa0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa02[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2aa0('0x0'));var util=require(_0x2aa0('0x1'));module[_0x2aa0('0x2')]={'name':{'type':Sequelize[_0x2aa0('0x3')],'unique':_0x2aa0('0x4')},'description':{'type':Sequelize[_0x2aa0('0x3')]},'formData':{'type':Sequelize[_0x2aa0('0x5')](_0x2aa0('0x6')),'set':function(_0x5ea4e4){if(_['isObjectLike'](_0x5ea4e4)){this[_0x2aa0('0x7')](_0x2aa0('0x8'),JSON['stringify'](_0x5ea4e4));}else if(_[_0x2aa0('0x9')](_0x5ea4e4)){this[_0x2aa0('0x7')](_0x2aa0('0x8'),_0x5ea4e4);}else{this[_0x2aa0('0x7')](_0x2aa0('0x8'),util['format'](_0x2aa0('0xa'),this['getDataValue'](_0x2aa0('0x4'))||'',this[_0x2aa0('0xb')](_0x2aa0('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2aa0('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 46251b6..14c1e96 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 _0x6f54=['set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptyProject','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x3d70a6,_0x2c5730){var _0x33fe0c=function(_0x1eda0e){while(--_0x1eda0e){_0x3d70a6['push'](_0x3d70a6['shift']());}};_0x33fe0c(++_0x2c5730);}(_0x6f54,0xcf));var _0x46f5=function(_0x48a902,_0x262345){_0x48a902=_0x48a902-0x0;var _0x29ab3b=_0x6f54[_0x48a902];return _0x29ab3b;};'use strict';var emlformat=require(_0x46f5('0x0'));var rimraf=require(_0x46f5('0x1'));var zipdir=require(_0x46f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46f5('0x3'));var BPromise=require(_0x46f5('0x4'));var Mustache=require(_0x46f5('0x5'));var util=require(_0x46f5('0x6'));var path=require('path');var sox=require(_0x46f5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f5('0x8'));var _=require('lodash');var squel=require(_0x46f5('0x9'));var crypto=require(_0x46f5('0xa'));var jsforce=require(_0x46f5('0xb'));var deskjs=require(_0x46f5('0xc'));var toCsv=require(_0x46f5('0xd'));var querystring=require(_0x46f5('0xe'));var Papa=require(_0x46f5('0xf'));var Redis=require(_0x46f5('0x10'));var authService=require(_0x46f5('0x11'));var qs=require(_0x46f5('0x12'));var as=require(_0x46f5('0x13'));var hardwareService=require(_0x46f5('0x14'));var logger=require(_0x46f5('0x15'))(_0x46f5('0x16'));var utils=require('../../config/utils');var config=require(_0x46f5('0x17'));var licenseUtil=require(_0x46f5('0x18'));var db=require(_0x46f5('0x19'))['db'];function respondWithStatusCode(_0x5c6df5,_0x138e02){_0x138e02=_0x138e02||0xcc;return function(_0x9741d5){if(_0x9741d5){return _0x5c6df5['sendStatus'](_0x138e02);}return _0x5c6df5[_0x46f5('0x1a')](_0x138e02)[_0x46f5('0x1b')]();};}function respondWithResult(_0x1b1d34,_0x1190fc){_0x1190fc=_0x1190fc||0xc8;return function(_0x51a90a){if(_0x51a90a){return _0x1b1d34['status'](_0x1190fc)[_0x46f5('0x1c')](_0x51a90a);}};}function respondWithFilteredResult(_0x40a47e,_0x52674d){return function(_0xd57cc6){if(_0xd57cc6){var _0x3960e6=typeof _0x52674d[_0x46f5('0x1d')]===_0x46f5('0x1e')&&typeof _0x52674d[_0x46f5('0x1f')]===_0x46f5('0x1e');var _0x1adbb1=_0xd57cc6[_0x46f5('0x20')];var _0x551ee0=_0x3960e6?0x0:_0x52674d[_0x46f5('0x1d')];var _0x1b910b=_0x3960e6?_0xd57cc6[_0x46f5('0x20')]:_0x52674d[_0x46f5('0x1d')]+_0x52674d['limit'];var _0x389831;if(_0x1b910b>=_0x1adbb1){_0x1b910b=_0x1adbb1;_0x389831=0xc8;}else{_0x389831=0xce;}_0x40a47e[_0x46f5('0x1a')](_0x389831);return _0x40a47e[_0x46f5('0x21')](_0x46f5('0x22'),_0x551ee0+'-'+_0x1b910b+'/'+_0x1adbb1)[_0x46f5('0x1c')](_0xd57cc6);}return null;};}function patchUpdates(_0x425a2e){return function(_0x58195a){try{jsonpatch[_0x46f5('0x23')](_0x58195a,_0x425a2e,!![]);}catch(_0x3ed408){return BPromise[_0x46f5('0x24')](_0x3ed408);}return _0x58195a[_0x46f5('0x25')]();};}function saveUpdates(_0x49556c,_0x5d52bf){return function(_0x362033){if(_0x362033){return _0x362033[_0x46f5('0x26')](_0x49556c)[_0x46f5('0x27')](function(_0x2a004d){return _0x2a004d;});}return null;};}function removeEntity(_0x52e610,_0x4c6e30){return function(_0x2993f6){if(_0x2993f6){return _0x2993f6['destroy']()[_0x46f5('0x27')](function(){var _0xc096c6=_0x2993f6['get']({'plain':!![]});var _0x3aa949=_0x46f5('0x28');return db[_0x46f5('0x29')][_0x46f5('0x2a')]({'where':{'type':_0x3aa949,'resourceId':_0xc096c6['id']}})['then'](function(){return _0x2993f6;});})['then'](function(){_0x52e610[_0x46f5('0x1a')](0xcc)[_0x46f5('0x1b')]();});}};}function handleEntityNotFound(_0x4b2769,_0x4a2fe1){return function(_0x3156d5){if(!_0x3156d5){_0x4b2769[_0x46f5('0x2b')](0x194);}return _0x3156d5;};}function handleError(_0x6f3b1d,_0x548310){_0x548310=_0x548310||0x1f4;return function(_0x48b761){logger['error'](_0x48b761[_0x46f5('0x2c')]);if(_0x48b761[_0x46f5('0x2d')]){delete _0x48b761[_0x46f5('0x2d')];}_0x6f3b1d['status'](_0x548310)[_0x46f5('0x2e')](_0x48b761);};}exports[_0x46f5('0x2f')]=function(_0x47aab6,_0x48281a){var _0x36a4bb={},_0x456c02={},_0x1c8f58={'count':0x0,'rows':[]};var _0x317af7=_[_0x46f5('0x30')](db['JscriptyProject'][_0x46f5('0x31')],function(_0x413360){return{'name':_0x413360[_0x46f5('0x32')],'type':_0x413360['type']['key']};});_0x456c02['model']=_[_0x46f5('0x30')](_0x317af7,_0x46f5('0x2d'));_0x456c02[_0x46f5('0x33')]=_['keys'](_0x47aab6[_0x46f5('0x33')]);_0x456c02[_0x46f5('0x34')]=_['intersection'](_0x456c02[_0x46f5('0x35')],_0x456c02[_0x46f5('0x33')]);_0x36a4bb[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x456c02['model'],qs[_0x46f5('0x38')](_0x47aab6['query'][_0x46f5('0x38')]));_0x36a4bb['attributes']=_0x36a4bb[_0x46f5('0x36')][_0x46f5('0x39')]?_0x36a4bb[_0x46f5('0x36')]:_0x456c02['model'];if(!_0x47aab6[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x36a4bb[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x47aab6['query'][_0x46f5('0x1f')]);_0x36a4bb[_0x46f5('0x1d')]=qs[_0x46f5('0x1d')](_0x47aab6[_0x46f5('0x33')]['offset']);}_0x36a4bb[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x47aab6[_0x46f5('0x33')]['sort']);_0x36a4bb[_0x46f5('0x3e')]=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x47aab6[_0x46f5('0x33')],_0x456c02[_0x46f5('0x34')]),_0x317af7);if(_0x47aab6['query'][_0x46f5('0x40')]){_0x36a4bb[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x36a4bb[_0x46f5('0x3e')],{'$or':_[_0x46f5('0x30')](_0x317af7,function(_0x3a5980){if(_0x3a5980[_0x46f5('0x42')]!==_0x46f5('0x43')){var _0x4a31d0={};_0x4a31d0[_0x3a5980[_0x46f5('0x2d')]]={'$like':'%'+_0x47aab6[_0x46f5('0x33')]['filter']+'%'};return _0x4a31d0;}})});}_0x36a4bb=_[_0x46f5('0x41')]({},_0x36a4bb,_0x47aab6[_0x46f5('0x44')]);var _0xe79100={'where':_0x36a4bb[_0x46f5('0x3e')]};return db[_0x46f5('0x45')][_0x46f5('0x20')](_0xe79100)['then'](function(_0x29c47d){_0x1c8f58['count']=_0x29c47d;if(_0x47aab6[_0x46f5('0x33')]['includeAll']){_0x36a4bb[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x45')][_0x46f5('0x47')](_0x36a4bb);})[_0x46f5('0x27')](function(_0x53cb12){_0x1c8f58[_0x46f5('0x48')]=_0x53cb12;return _0x1c8f58;})[_0x46f5('0x27')](respondWithFilteredResult(_0x48281a,_0x36a4bb))[_0x46f5('0x49')](handleError(_0x48281a,null));};exports[_0x46f5('0x4a')]=function(_0x9f4676,_0x51c34e){var _0x20c69e={'raw':![],'where':{'id':_0x9f4676[_0x46f5('0x4b')]['id']}},_0x1a8f57={};_0x1a8f57['model']=_['keys'](db['JscriptyProject'][_0x46f5('0x31')]);_0x1a8f57[_0x46f5('0x33')]=_[_0x46f5('0x4c')](_0x9f4676[_0x46f5('0x33')]);_0x1a8f57[_0x46f5('0x34')]=_[_0x46f5('0x37')](_0x1a8f57[_0x46f5('0x35')],_0x1a8f57[_0x46f5('0x33')]);_0x20c69e[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x1a8f57['model'],qs[_0x46f5('0x38')](_0x9f4676['query'][_0x46f5('0x38')]));_0x20c69e['attributes']=_0x20c69e['attributes'][_0x46f5('0x39')]?_0x20c69e[_0x46f5('0x36')]:_0x1a8f57[_0x46f5('0x35')];if(_0x9f4676['query'][_0x46f5('0x4d')]){_0x20c69e[_0x46f5('0x46')]=[{'all':!![]}];}_0x20c69e=_[_0x46f5('0x41')]({},_0x20c69e,_0x9f4676[_0x46f5('0x44')]);return db['JscriptyProject'][_0x46f5('0x4e')](_0x20c69e)[_0x46f5('0x27')](handleEntityNotFound(_0x51c34e,null))[_0x46f5('0x27')](respondWithResult(_0x51c34e,null))['catch'](handleError(_0x51c34e,null));};exports[_0x46f5('0x4f')]=function(_0x236409,_0x276192){return db[_0x46f5('0x45')][_0x46f5('0x4f')](_0x236409[_0x46f5('0x50')],{})[_0x46f5('0x27')](function(_0x1216de){var _0x15594e=_0x236409[_0x46f5('0x51')]['get']({'plain':!![]});if(!_0x15594e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15594e[_0x46f5('0x52')]==='user'){var _0xbd2189=_0x1216de[_0x46f5('0x53')]({'plain':!![]});var _0x5305e9=_0x46f5('0x28');return db[_0x46f5('0x54')][_0x46f5('0x4e')]({'where':{'name':_0x5305e9,'userProfileId':_0x15594e[_0x46f5('0x55')]},'raw':!![]})[_0x46f5('0x27')](function(_0x302d29){if(_0x302d29&&_0x302d29['autoAssociation']===0x0){return db[_0x46f5('0x29')][_0x46f5('0x4f')]({'name':_0xbd2189[_0x46f5('0x2d')],'resourceId':_0xbd2189['id'],'type':_0x302d29[_0x46f5('0x2d')],'sectionId':_0x302d29['id']},{})[_0x46f5('0x27')](function(){return _0x1216de;});}else{return _0x1216de;}})[_0x46f5('0x49')](function(_0x5e26c6){logger['error'](_0x46f5('0x56'),_0x5e26c6);throw _0x5e26c6;});}return _0x1216de;})[_0x46f5('0x27')](respondWithResult(_0x276192,0xc9))[_0x46f5('0x49')](handleError(_0x276192,null));};exports['clone']=function(_0x4e3932,_0xf21b38){var _0x518a81={'where':{'id':_0x4e3932[_0x46f5('0x4b')]['id']}},_0x376006={};_0x376006[_0x46f5('0x35')]=_[_0x46f5('0x4c')](db[_0x46f5('0x45')]['rawAttributes']);_0x518a81[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x376006['model'],qs[_0x46f5('0x38')](_0x4e3932[_0x46f5('0x33')][_0x46f5('0x38')]));_0x518a81[_0x46f5('0x36')]=_0x518a81['attributes'][_0x46f5('0x39')]?_0x518a81[_0x46f5('0x36')]:_0x376006[_0x46f5('0x35')];if(_0x4e3932[_0x46f5('0x33')][_0x46f5('0x4d')]){_0x518a81[_0x46f5('0x46')]=[{'all':!![]}];}_0x518a81=_[_0x46f5('0x41')]({},_0x518a81,_0x4e3932['options']);return db[_0x46f5('0x45')]['find'](_0x518a81)['then'](handleEntityNotFound(_0xf21b38,null))['then'](function(_0x3c1c1a){if(_0x3c1c1a){var _0xcbe605=_0x3c1c1a['get']({'plain':!![]});_0xcbe605=qs[_0x46f5('0x57')](_0xcbe605,['id','createdAt',_0x46f5('0x58')]);_0x4e3932['body']=_[_0x46f5('0x57')](_0x4e3932[_0x46f5('0x50')],['id',_0x46f5('0x59'),_0x46f5('0x58')]);return db[_0x46f5('0x45')]['create'](_[_0x46f5('0x41')](_0xcbe605,_0x4e3932['body']),{'include':_0x4e3932[_0x46f5('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1ea05e){var _0x513ee2=_0x4e3932['user'][_0x46f5('0x53')]({'plain':!![]});if(!_0x513ee2)throw new Error(_0x46f5('0x5a'));if(_0x513ee2['role']==='user'){var _0x59b3bc=_0x1ea05e[_0x46f5('0x53')]({'plain':!![]});var _0x1487dd=_0x46f5('0x28');return db[_0x46f5('0x54')][_0x46f5('0x4e')]({'where':{'name':_0x1487dd,'userProfileId':_0x513ee2[_0x46f5('0x55')]},'raw':!![]})['then'](function(_0x12964b){if(_0x12964b&&_0x12964b[_0x46f5('0x5b')]===0x0){return db[_0x46f5('0x29')][_0x46f5('0x4f')]({'name':_0x59b3bc['name'],'resourceId':_0x59b3bc['id'],'type':_0x12964b[_0x46f5('0x2d')],'sectionId':_0x12964b['id']},{})['then'](function(){return _0x1ea05e;});}else{return _0x1ea05e;}})[_0x46f5('0x49')](function(_0x2054e1){logger[_0x46f5('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2054e1);throw _0x2054e1;});}return _0x1ea05e;});}})[_0x46f5('0x27')](respondWithResult(_0xf21b38,0xc9))['catch'](handleError(_0xf21b38,null));};exports['update']=function(_0x1e0bbb,_0x54e179){if(_0x1e0bbb[_0x46f5('0x50')]['id']){delete _0x1e0bbb[_0x46f5('0x50')]['id'];}return db['JscriptyProject'][_0x46f5('0x4e')]({'where':{'id':_0x1e0bbb[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x54e179,null))[_0x46f5('0x27')](saveUpdates(_0x1e0bbb[_0x46f5('0x50')],null))[_0x46f5('0x27')](respondWithResult(_0x54e179,null))[_0x46f5('0x49')](handleError(_0x54e179,null));};exports[_0x46f5('0x2a')]=function(_0x46acb3,_0xbe7698){return db[_0x46f5('0x45')][_0x46f5('0x4e')]({'where':{'id':_0x46acb3['params']['id']}})['then'](handleEntityNotFound(_0xbe7698,null))[_0x46f5('0x27')](removeEntity(_0xbe7698,null))['catch'](handleError(_0xbe7698,null));};exports[_0x46f5('0x5d')]=function(_0x24108a,_0x3bb638,_0xf370f8){var _0x58ef6d={'raw':!![],'where':{}};var _0x5286ff={};var _0x3629f7={'count':0x0,'rows':[]};return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x24108a[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x3bb638,null))['then'](function(_0x490b25){if(_0x490b25){_0x5286ff['model']=_[_0x46f5('0x4c')](db[_0x46f5('0x5f')][_0x46f5('0x31')]);_0x5286ff[_0x46f5('0x33')]=_[_0x46f5('0x4c')](_0x24108a[_0x46f5('0x33')]);_0x5286ff['filters']=_['intersection'](_0x5286ff['model'],_0x5286ff[_0x46f5('0x33')]);_0x58ef6d[_0x46f5('0x36')]=_['intersection'](_0x5286ff['model'],qs['fields'](_0x24108a['query'][_0x46f5('0x38')]));_0x58ef6d[_0x46f5('0x36')]=_0x58ef6d[_0x46f5('0x36')][_0x46f5('0x39')]?_0x58ef6d[_0x46f5('0x36')]:_0x5286ff[_0x46f5('0x35')];if(!_0x24108a[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x58ef6d[_0x46f5('0x1f')]=qs['limit'](_0x24108a[_0x46f5('0x33')]['limit']);_0x58ef6d[_0x46f5('0x1d')]=qs[_0x46f5('0x1d')](_0x24108a[_0x46f5('0x33')]['offset']);}_0x58ef6d['order']=qs[_0x46f5('0x3d')](_0x24108a[_0x46f5('0x33')]['sort']);_0x58ef6d['where']=qs[_0x46f5('0x34')](_[_0x46f5('0x3f')](_0x24108a[_0x46f5('0x33')],_0x5286ff[_0x46f5('0x34')]));_0x58ef6d['where'][_0x46f5('0x60')]=_0x490b25['id'];if(_0x24108a[_0x46f5('0x33')][_0x46f5('0x40')]){_0x58ef6d[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x58ef6d[_0x46f5('0x3e')],{'$or':_[_0x46f5('0x30')](_0x58ef6d[_0x46f5('0x36')],function(_0x13853f){var _0x3d888c={};_0x3d888c[_0x13853f]={'$like':'%'+_0x24108a[_0x46f5('0x33')][_0x46f5('0x40')]+'%'};return _0x3d888c;})});}_0x58ef6d=_[_0x46f5('0x41')]({},_0x58ef6d,_0x24108a[_0x46f5('0x44')]);return db[_0x46f5('0x5f')][_0x46f5('0x20')]({'where':_0x58ef6d[_0x46f5('0x3e')]})[_0x46f5('0x27')](function(_0x159faa){_0x3629f7[_0x46f5('0x20')]=_0x159faa;if(_0x24108a[_0x46f5('0x33')][_0x46f5('0x4d')]){_0x58ef6d[_0x46f5('0x46')]=[{'all':!![]}];}return db[_0x46f5('0x5f')][_0x46f5('0x47')](_0x58ef6d);})[_0x46f5('0x27')](function(_0x5c3eef){_0x3629f7[_0x46f5('0x48')]=_0x5c3eef;return _0x3629f7;});}})[_0x46f5('0x27')](respondWithFilteredResult(_0x3bb638,_0x58ef6d))[_0x46f5('0x49')](handleError(_0x3bb638,null));};exports['getAnswers']=function(_0x2b4f7f,_0x4068df,_0x3fac1e){var _0x1a83ea={'raw':!![],'where':{}};var _0x27389d={};var _0x3c4467={'count':0x0,'rows':[]};return db[_0x46f5('0x45')][_0x46f5('0x5e')]({'where':{'id':_0x2b4f7f[_0x46f5('0x4b')]['id']}})[_0x46f5('0x27')](handleEntityNotFound(_0x4068df,null))['then'](function(_0x371ed2){if(_0x371ed2){_0x27389d['model']=_['keys'](db[_0x46f5('0x61')][_0x46f5('0x31')]);_0x27389d[_0x46f5('0x33')]=_['keys'](_0x2b4f7f[_0x46f5('0x33')]);_0x27389d['filters']=_[_0x46f5('0x37')](_0x27389d[_0x46f5('0x35')],_0x27389d[_0x46f5('0x33')]);_0x1a83ea[_0x46f5('0x36')]=_[_0x46f5('0x37')](_0x27389d['model'],qs[_0x46f5('0x38')](_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x38')]));_0x1a83ea[_0x46f5('0x36')]=_0x1a83ea[_0x46f5('0x36')][_0x46f5('0x39')]?_0x1a83ea['attributes']:_0x27389d[_0x46f5('0x35')];if(!_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x3a')](_0x46f5('0x3b'))){_0x1a83ea[_0x46f5('0x1f')]=qs[_0x46f5('0x1f')](_0x2b4f7f['query'][_0x46f5('0x1f')]);_0x1a83ea['offset']=qs[_0x46f5('0x1d')](_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x1d')]);}_0x1a83ea[_0x46f5('0x3c')]=qs[_0x46f5('0x3d')](_0x2b4f7f['query'][_0x46f5('0x3d')]);_0x1a83ea['where']=qs['filters'](_[_0x46f5('0x3f')](_0x2b4f7f['query'],_0x27389d['filters']));_0x1a83ea[_0x46f5('0x3e')][_0x46f5('0x60')]=_0x371ed2['id'];if(_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x40')]){_0x1a83ea[_0x46f5('0x3e')]=_[_0x46f5('0x41')](_0x1a83ea[_0x46f5('0x3e')],{'$or':_['map'](_0x1a83ea[_0x46f5('0x36')],function(_0x188fa5){var _0x14dc1e={};_0x14dc1e[_0x188fa5]={'$like':'%'+_0x2b4f7f[_0x46f5('0x33')][_0x46f5('0x40')]+'%'};return _0x14dc1e;})});}_0x1a83ea=_['merge']({},_0x1a83ea,_0x2b4f7f['options']);return db['JscriptyAnswerReport'][_0x46f5('0x20')]({'where':_0x1a83ea[_0x46f5('0x3e')]})['then'](function(_0xabacc8){_0x3c4467['count']=_0xabacc8;if(_0x2b4f7f['query'][_0x46f5('0x4d')]){_0x1a83ea['include']=[{'all':!![]}];}return db[_0x46f5('0x61')]['findAll'](_0x1a83ea);})['then'](function(_0x23f81e){_0x3c4467[_0x46f5('0x48')]=_0x23f81e;return _0x3c4467;});}})[_0x46f5('0x27')](respondWithFilteredResult(_0x4068df,_0x1a83ea))['catch'](handleError(_0x4068df,null));};function char(_0xb55b31){return _0x46f5('0x62')===typeof _0xb55b31?String['fromCharCode']['apply'](null,arguments):_0xb55b31;}function needsEncapsulation(_0x447e09){return!!_0x447e09&&(_0x447e09['toString']()['indexOf'](char(0xd))>=0x0||_0x447e09[_0x46f5('0x63')]()[_0x46f5('0x64')](char(0xa))>=0x0||_0x447e09[_0x46f5('0x63')]()[_0x46f5('0x64')](char(0x2c))>=0x0||_0x447e09[_0x46f5('0x63')]()[_0x46f5('0x64')](char(0x22))>=0x0);}function encapsulate(_0x2aa4e3){var _0x128e44=char(0x22),_0x435403='\x5c'+char(0x22),_0x541f63=_0x2aa4e3[_0x46f5('0x63')]()[_0x46f5('0x65')](new RegExp(_0x128e44,'g'),_0x435403);return _0x128e44+_0x541f63+_0x128e44;}exports['getSummary']=function(_0x2fe69b,_0x5e30d2,_0x3bd6f9){var _0x56143d,_0x1af1d2;var _0x7c0307={'where':{'ProjectId':_0x2fe69b[_0x46f5('0x4b')]['id']}};if(_0x2fe69b[_0x46f5('0x33')]['startTime']){_0x7c0307['where'][_0x46f5('0x66')]=JSON[_0x46f5('0x67')](_0x2fe69b[_0x46f5('0x33')]['startTime']);}return db[_0x46f5('0x5f')]['findAll'](_0x7c0307)[_0x46f5('0x27')](handleEntityNotFound(_0x5e30d2,null))['then'](function(_0x4faaa0){if(_0x4faaa0){_0x56143d=_0x4faaa0;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x46f5('0x30')](_0x56143d,'id')},'ProjectId':_0x2fe69b[_0x46f5('0x4b')]['id']},'order':_0x46f5('0x68')});}})['then'](handleEntityNotFound(_0x5e30d2,null))['then'](function(_0x34f832){if(_0x34f832){_0x1af1d2=_0x34f832;var _0x308b95={};for(var _0x3c821f=0x0,_0x28710f=_0x1af1d2[_0x46f5('0x39')];_0x3c821f<_0x28710f;_0x3c821f++){if(!_0x308b95[_0x46f5('0x3a')](_0x1af1d2[_0x3c821f][_0x46f5('0x69')])){_0x308b95[_0x1af1d2[_0x3c821f][_0x46f5('0x69')]]=needsEncapsulation(_0x1af1d2[_0x3c821f][_0x46f5('0x6a')])?encapsulate(_0x1af1d2[_0x3c821f]['question']):_0x1af1d2[_0x3c821f]['question'];}}var _0x3c85c2=[],_0x23d53e={};for(var _0x13ec0b=0x0,_0x41c4f2=_0x56143d[_0x46f5('0x39')];_0x13ec0b<_0x41c4f2;_0x13ec0b++){_0x23d53e={'ProjectId':_0x2fe69b[_0x46f5('0x4b')]['id'],'SessionId':_0x56143d[_0x13ec0b]['id'],'StartTime':moment(_0x56143d[_0x13ec0b][_0x46f5('0x66')])[_0x46f5('0x6b')](_0x46f5('0x6c'))};for(var _0x481e5b=0x0,_0x45d617=_0x1af1d2[_0x46f5('0x39')];_0x481e5b<_0x45d617;_0x481e5b++){if(_0x1af1d2[_0x481e5b][_0x46f5('0x6d')]==_0x56143d[_0x13ec0b]['id']&&_0x308b95[_0x46f5('0x3a')](_0x1af1d2[_0x481e5b][_0x46f5('0x69')])){_0x23d53e[_0x308b95[_0x1af1d2[_0x481e5b][_0x46f5('0x69')]]]=_0x1af1d2[_0x481e5b][_0x46f5('0x6e')];}}for(var _0x3f48f0 in _0x308b95){if(!_0x23d53e['hasOwnProperty'](_0x308b95[_0x3f48f0])){_0x23d53e[_0x308b95[_0x3f48f0]]=null;}}_0x3c85c2[_0x46f5('0x6f')](_0x23d53e);}return _0x3c85c2;}})[_0x46f5('0x27')](function(_0x4f7e0){if(!_[_0x46f5('0x70')](_0x4f7e0)){var _0x1500cf=toCsv(_0x4f7e0);var _0x3109e2=Date['now']();fs[_0x46f5('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2fe69b[_0x46f5('0x4b')]['id'],_0x3109e2),_0x1500cf);_0x5e30d2[_0x46f5('0x72')]('Content-disposition',_0x46f5('0x73')+util[_0x46f5('0x6b')](_0x46f5('0x74'),_0x2fe69b[_0x46f5('0x4b')]['id'],_0x3109e2));_0x5e30d2[_0x46f5('0x72')]('Content-type',_0x46f5('0x75'));return _0x5e30d2[_0x46f5('0x76')](util[_0x46f5('0x6b')](_0x46f5('0x77'),_0x2fe69b[_0x46f5('0x4b')]['id'],_0x3109e2));}else{return _0x5e30d2[_0x46f5('0x2b')](0xcc);}})[_0x46f5('0x49')](handleError(_0x5e30d2,null));}; \ No newline at end of file +var _0x6d77=['error','stack','name','send','JscriptyProject','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','include','findAll','rows','show','filters','includeAll','options','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','userProfileId','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','get','Projects','UserProfileResource','end'];(function(_0x58ab93,_0xdf0e53){var _0x8e8faa=function(_0x48381b){while(--_0x48381b){_0x58ab93['push'](_0x58ab93['shift']());}};_0x8e8faa(++_0xdf0e53);}(_0x6d77,0x13a));var _0x76d7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d77[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x76d7('0x0'));var rimraf=require(_0x76d7('0x1'));var zipdir=require(_0x76d7('0x2'));var jsonpatch=require(_0x76d7('0x3'));var rp=require('request-promise');var moment=require(_0x76d7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76d7('0x5'));var util=require(_0x76d7('0x6'));var path=require(_0x76d7('0x7'));var sox=require(_0x76d7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76d7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x76d7('0xa'));var deskjs=require(_0x76d7('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x76d7('0xc'));var Redis=require('ioredis');var authService=require(_0x76d7('0xd'));var qs=require(_0x76d7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76d7('0xf'));var logger=require(_0x76d7('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x76d7('0x11'));var licenseUtil=require(_0x76d7('0x12'));var db=require(_0x76d7('0x13'))['db'];function respondWithStatusCode(_0xbb0b97,_0x1037d0){_0x1037d0=_0x1037d0||0xcc;return function(_0x393807){if(_0x393807){return _0xbb0b97[_0x76d7('0x14')](_0x1037d0);}return _0xbb0b97['status'](_0x1037d0)['end']();};}function respondWithResult(_0x242401,_0xc27df5){_0xc27df5=_0xc27df5||0xc8;return function(_0x27f33d){if(_0x27f33d){return _0x242401[_0x76d7('0x15')](_0xc27df5)[_0x76d7('0x16')](_0x27f33d);}};}function respondWithFilteredResult(_0x5c1aaa,_0x36a3ba){return function(_0x5876dd){if(_0x5876dd){var _0x1f6d75=typeof _0x36a3ba['offset']===_0x76d7('0x17')&&typeof _0x36a3ba['limit']===_0x76d7('0x17');var _0x54c965=_0x5876dd[_0x76d7('0x18')];var _0x2d7527=_0x1f6d75?0x0:_0x36a3ba['offset'];var _0x155322=_0x1f6d75?_0x5876dd[_0x76d7('0x18')]:_0x36a3ba[_0x76d7('0x19')]+_0x36a3ba[_0x76d7('0x1a')];var _0x5f586a;if(_0x155322>=_0x54c965){_0x155322=_0x54c965;_0x5f586a=0xc8;}else{_0x5f586a=0xce;}_0x5c1aaa[_0x76d7('0x15')](_0x5f586a);return _0x5c1aaa[_0x76d7('0x1b')]('Content-Range',_0x2d7527+'-'+_0x155322+'/'+_0x54c965)['json'](_0x5876dd);}return null;};}function patchUpdates(_0x54295d){return function(_0x22e2f0){try{jsonpatch[_0x76d7('0x1c')](_0x22e2f0,_0x54295d,!![]);}catch(_0x2a9b3c){return BPromise[_0x76d7('0x1d')](_0x2a9b3c);}return _0x22e2f0[_0x76d7('0x1e')]();};}function saveUpdates(_0x423161,_0x55c7a5){return function(_0x463300){if(_0x463300){return _0x463300['update'](_0x423161)[_0x76d7('0x1f')](function(_0x311e58){return _0x311e58;});}return null;};}function removeEntity(_0x5a97c3,_0x500521){return function(_0x27d6ff){if(_0x27d6ff){return _0x27d6ff[_0x76d7('0x20')]()[_0x76d7('0x1f')](function(){var _0x1371f7=_0x27d6ff[_0x76d7('0x21')]({'plain':!![]});var _0x2d5ecc=_0x76d7('0x22');return db[_0x76d7('0x23')][_0x76d7('0x20')]({'where':{'type':_0x2d5ecc,'resourceId':_0x1371f7['id']}})[_0x76d7('0x1f')](function(){return _0x27d6ff;});})[_0x76d7('0x1f')](function(){_0x5a97c3[_0x76d7('0x15')](0xcc)[_0x76d7('0x24')]();});}};}function handleEntityNotFound(_0x23604e,_0x10b0aa){return function(_0x2e22d5){if(!_0x2e22d5){_0x23604e['sendStatus'](0x194);}return _0x2e22d5;};}function handleError(_0x4c95ae,_0x4868c5){_0x4868c5=_0x4868c5||0x1f4;return function(_0x228a48){logger[_0x76d7('0x25')](_0x228a48[_0x76d7('0x26')]);if(_0x228a48[_0x76d7('0x27')]){delete _0x228a48['name'];}_0x4c95ae[_0x76d7('0x15')](_0x4868c5)[_0x76d7('0x28')](_0x228a48);};}exports['index']=function(_0x3660ea,_0x270f72){var _0x187360={},_0xea025d={},_0x32b002={'count':0x0,'rows':[]};var _0x2f6f73=_['map'](db[_0x76d7('0x29')][_0x76d7('0x2a')],function(_0x9757e8){return{'name':_0x9757e8[_0x76d7('0x2b')],'type':_0x9757e8['type'][_0x76d7('0x2c')]};});_0xea025d[_0x76d7('0x2d')]=_[_0x76d7('0x2e')](_0x2f6f73,_0x76d7('0x27'));_0xea025d[_0x76d7('0x2f')]=_[_0x76d7('0x30')](_0x3660ea['query']);_0xea025d['filters']=_['intersection'](_0xea025d[_0x76d7('0x2d')],_0xea025d[_0x76d7('0x2f')]);_0x187360[_0x76d7('0x31')]=_[_0x76d7('0x32')](_0xea025d['model'],qs['fields'](_0x3660ea[_0x76d7('0x2f')][_0x76d7('0x33')]));_0x187360[_0x76d7('0x31')]=_0x187360['attributes'][_0x76d7('0x34')]?_0x187360['attributes']:_0xea025d[_0x76d7('0x2d')];if(!_0x3660ea['query']['hasOwnProperty'](_0x76d7('0x35'))){_0x187360[_0x76d7('0x1a')]=qs[_0x76d7('0x1a')](_0x3660ea[_0x76d7('0x2f')][_0x76d7('0x1a')]);_0x187360[_0x76d7('0x19')]=qs[_0x76d7('0x19')](_0x3660ea[_0x76d7('0x2f')]['offset']);}_0x187360[_0x76d7('0x36')]=qs['sort'](_0x3660ea['query'][_0x76d7('0x37')]);_0x187360[_0x76d7('0x38')]=qs['filters'](_[_0x76d7('0x39')](_0x3660ea['query'],_0xea025d['filters']),_0x2f6f73);if(_0x3660ea['query']['filter']){_0x187360[_0x76d7('0x38')]=_['merge'](_0x187360[_0x76d7('0x38')],{'$or':_[_0x76d7('0x2e')](_0x2f6f73,function(_0x389466){if(_0x389466[_0x76d7('0x3a')]!==_0x76d7('0x3b')){var _0x2b8956={};_0x2b8956[_0x389466[_0x76d7('0x27')]]={'$like':'%'+_0x3660ea[_0x76d7('0x2f')][_0x76d7('0x3c')]+'%'};return _0x2b8956;}})});}_0x187360=_[_0x76d7('0x3d')]({},_0x187360,_0x3660ea['options']);var _0x5ae435={'where':_0x187360[_0x76d7('0x38')]};return db[_0x76d7('0x29')][_0x76d7('0x18')](_0x5ae435)[_0x76d7('0x1f')](function(_0x35cc85){_0x32b002[_0x76d7('0x18')]=_0x35cc85;if(_0x3660ea[_0x76d7('0x2f')]['includeAll']){_0x187360[_0x76d7('0x3e')]=[{'all':!![]}];}return db[_0x76d7('0x29')][_0x76d7('0x3f')](_0x187360);})[_0x76d7('0x1f')](function(_0x2f98c3){_0x32b002[_0x76d7('0x40')]=_0x2f98c3;return _0x32b002;})[_0x76d7('0x1f')](respondWithFilteredResult(_0x270f72,_0x187360))['catch'](handleError(_0x270f72,null));};exports[_0x76d7('0x41')]=function(_0xffe9e6,_0x176a30){var _0x2be5cf={'raw':![],'where':{'id':_0xffe9e6['params']['id']}},_0x11f988={};_0x11f988['model']=_[_0x76d7('0x30')](db['JscriptyProject'][_0x76d7('0x2a')]);_0x11f988['query']=_[_0x76d7('0x30')](_0xffe9e6['query']);_0x11f988[_0x76d7('0x42')]=_[_0x76d7('0x32')](_0x11f988['model'],_0x11f988['query']);_0x2be5cf[_0x76d7('0x31')]=_[_0x76d7('0x32')](_0x11f988['model'],qs[_0x76d7('0x33')](_0xffe9e6[_0x76d7('0x2f')]['fields']));_0x2be5cf['attributes']=_0x2be5cf[_0x76d7('0x31')][_0x76d7('0x34')]?_0x2be5cf[_0x76d7('0x31')]:_0x11f988['model'];if(_0xffe9e6[_0x76d7('0x2f')][_0x76d7('0x43')]){_0x2be5cf[_0x76d7('0x3e')]=[{'all':!![]}];}_0x2be5cf=_[_0x76d7('0x3d')]({},_0x2be5cf,_0xffe9e6[_0x76d7('0x44')]);return db['JscriptyProject'][_0x76d7('0x45')](_0x2be5cf)[_0x76d7('0x1f')](handleEntityNotFound(_0x176a30,null))[_0x76d7('0x1f')](respondWithResult(_0x176a30,null))['catch'](handleError(_0x176a30,null));};exports[_0x76d7('0x46')]=function(_0x485c8b,_0xf74298){return db['JscriptyProject'][_0x76d7('0x46')](_0x485c8b[_0x76d7('0x47')],{})['then'](function(_0x1b6fef){var _0x5874dc=_0x485c8b[_0x76d7('0x48')]['get']({'plain':!![]});if(!_0x5874dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5874dc[_0x76d7('0x49')]===_0x76d7('0x48')){var _0x3f8b5b=_0x1b6fef[_0x76d7('0x21')]({'plain':!![]});var _0x5e5300=_0x76d7('0x22');return db[_0x76d7('0x4a')]['find']({'where':{'name':_0x5e5300,'userProfileId':_0x5874dc['userProfileId']},'raw':!![]})[_0x76d7('0x1f')](function(_0x4dca94){if(_0x4dca94&&_0x4dca94[_0x76d7('0x4b')]===0x0){return db['UserProfileResource'][_0x76d7('0x46')]({'name':_0x3f8b5b[_0x76d7('0x27')],'resourceId':_0x3f8b5b['id'],'type':_0x4dca94[_0x76d7('0x27')],'sectionId':_0x4dca94['id']},{})[_0x76d7('0x1f')](function(){return _0x1b6fef;});}else{return _0x1b6fef;}})[_0x76d7('0x4c')](function(_0x28d7d9){logger[_0x76d7('0x25')](_0x76d7('0x4d'),_0x28d7d9);throw _0x28d7d9;});}return _0x1b6fef;})['then'](respondWithResult(_0xf74298,0xc9))[_0x76d7('0x4c')](handleError(_0xf74298,null));};exports[_0x76d7('0x4e')]=function(_0x13f9f6,_0x55edf){var _0x52fabb={'where':{'id':_0x13f9f6[_0x76d7('0x4f')]['id']}},_0x38f5de={};_0x38f5de[_0x76d7('0x2d')]=_[_0x76d7('0x30')](db[_0x76d7('0x29')][_0x76d7('0x2a')]);_0x52fabb[_0x76d7('0x31')]=_[_0x76d7('0x32')](_0x38f5de[_0x76d7('0x2d')],qs[_0x76d7('0x33')](_0x13f9f6[_0x76d7('0x2f')]['fields']));_0x52fabb['attributes']=_0x52fabb[_0x76d7('0x31')][_0x76d7('0x34')]?_0x52fabb['attributes']:_0x38f5de[_0x76d7('0x2d')];if(_0x13f9f6[_0x76d7('0x2f')][_0x76d7('0x43')]){_0x52fabb[_0x76d7('0x3e')]=[{'all':!![]}];}_0x52fabb=_[_0x76d7('0x3d')]({},_0x52fabb,_0x13f9f6[_0x76d7('0x44')]);return db[_0x76d7('0x29')][_0x76d7('0x45')](_0x52fabb)[_0x76d7('0x1f')](handleEntityNotFound(_0x55edf,null))[_0x76d7('0x1f')](function(_0x45920b){if(_0x45920b){var _0x4f65cf=_0x45920b[_0x76d7('0x21')]({'plain':!![]});_0x4f65cf=qs[_0x76d7('0x50')](_0x4f65cf,['id','createdAt','updatedAt']);_0x13f9f6[_0x76d7('0x47')]=_[_0x76d7('0x50')](_0x13f9f6['body'],['id','createdAt',_0x76d7('0x51')]);return db['JscriptyProject'][_0x76d7('0x46')](_[_0x76d7('0x3d')](_0x4f65cf,_0x13f9f6[_0x76d7('0x47')]),{'include':_0x13f9f6['query'][_0x76d7('0x43')]?[{'all':!![]}]:undefined})[_0x76d7('0x1f')](function(_0x117c1d){var _0x4a1e8c=_0x13f9f6[_0x76d7('0x48')][_0x76d7('0x21')]({'plain':!![]});if(!_0x4a1e8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a1e8c['role']===_0x76d7('0x48')){var _0x193e7c=_0x117c1d[_0x76d7('0x21')]({'plain':!![]});var _0x3cff2b=_0x76d7('0x22');return db[_0x76d7('0x4a')][_0x76d7('0x45')]({'where':{'name':_0x3cff2b,'userProfileId':_0x4a1e8c[_0x76d7('0x52')]},'raw':!![]})['then'](function(_0x4b3f7e){if(_0x4b3f7e&&_0x4b3f7e[_0x76d7('0x4b')]===0x0){return db[_0x76d7('0x23')][_0x76d7('0x46')]({'name':_0x193e7c['name'],'resourceId':_0x193e7c['id'],'type':_0x4b3f7e['name'],'sectionId':_0x4b3f7e['id']},{})[_0x76d7('0x1f')](function(){return _0x117c1d;});}else{return _0x117c1d;}})[_0x76d7('0x4c')](function(_0x1b8455){logger[_0x76d7('0x25')](_0x76d7('0x4d'),_0x1b8455);throw _0x1b8455;});}return _0x117c1d;});}})[_0x76d7('0x1f')](respondWithResult(_0x55edf,0xc9))[_0x76d7('0x4c')](handleError(_0x55edf,null));};exports[_0x76d7('0x53')]=function(_0x2304f3,_0x3acb42){if(_0x2304f3[_0x76d7('0x47')]['id']){delete _0x2304f3[_0x76d7('0x47')]['id'];}return db['JscriptyProject'][_0x76d7('0x45')]({'where':{'id':_0x2304f3[_0x76d7('0x4f')]['id']}})[_0x76d7('0x1f')](handleEntityNotFound(_0x3acb42,null))[_0x76d7('0x1f')](saveUpdates(_0x2304f3[_0x76d7('0x47')],null))['then'](respondWithResult(_0x3acb42,null))['catch'](handleError(_0x3acb42,null));};exports[_0x76d7('0x20')]=function(_0x28898a,_0x1b8637){return db[_0x76d7('0x29')][_0x76d7('0x45')]({'where':{'id':_0x28898a[_0x76d7('0x4f')]['id']}})[_0x76d7('0x1f')](handleEntityNotFound(_0x1b8637,null))[_0x76d7('0x1f')](removeEntity(_0x1b8637,null))[_0x76d7('0x4c')](handleError(_0x1b8637,null));};exports[_0x76d7('0x54')]=function(_0x3ee7eb,_0x4aab4a,_0x1310c9){var _0x517359={'raw':!![],'where':{}};var _0x10ec2d={};var _0x2bac30={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x76d7('0x55')]({'where':{'id':_0x3ee7eb[_0x76d7('0x4f')]['id']}})[_0x76d7('0x1f')](handleEntityNotFound(_0x4aab4a,null))['then'](function(_0x4f828c){if(_0x4f828c){_0x10ec2d[_0x76d7('0x2d')]=_[_0x76d7('0x30')](db[_0x76d7('0x56')][_0x76d7('0x2a')]);_0x10ec2d[_0x76d7('0x2f')]=_[_0x76d7('0x30')](_0x3ee7eb[_0x76d7('0x2f')]);_0x10ec2d[_0x76d7('0x42')]=_[_0x76d7('0x32')](_0x10ec2d[_0x76d7('0x2d')],_0x10ec2d[_0x76d7('0x2f')]);_0x517359[_0x76d7('0x31')]=_[_0x76d7('0x32')](_0x10ec2d[_0x76d7('0x2d')],qs[_0x76d7('0x33')](_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x33')]));_0x517359[_0x76d7('0x31')]=_0x517359['attributes'][_0x76d7('0x34')]?_0x517359[_0x76d7('0x31')]:_0x10ec2d[_0x76d7('0x2d')];if(!_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x57')](_0x76d7('0x35'))){_0x517359[_0x76d7('0x1a')]=qs['limit'](_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x1a')]);_0x517359[_0x76d7('0x19')]=qs[_0x76d7('0x19')](_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x19')]);}_0x517359['order']=qs['sort'](_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x37')]);_0x517359[_0x76d7('0x38')]=qs[_0x76d7('0x42')](_['pick'](_0x3ee7eb['query'],_0x10ec2d[_0x76d7('0x42')]));_0x517359[_0x76d7('0x38')]['ProjectId']=_0x4f828c['id'];if(_0x3ee7eb['query'][_0x76d7('0x3c')]){_0x517359[_0x76d7('0x38')]=_['merge'](_0x517359[_0x76d7('0x38')],{'$or':_['map'](_0x517359[_0x76d7('0x31')],function(_0x351b54){var _0xa1c2ba={};_0xa1c2ba[_0x351b54]={'$like':'%'+_0x3ee7eb['query'][_0x76d7('0x3c')]+'%'};return _0xa1c2ba;})});}_0x517359=_[_0x76d7('0x3d')]({},_0x517359,_0x3ee7eb[_0x76d7('0x44')]);return db[_0x76d7('0x56')]['count']({'where':_0x517359[_0x76d7('0x38')]})[_0x76d7('0x1f')](function(_0x537b4b){_0x2bac30[_0x76d7('0x18')]=_0x537b4b;if(_0x3ee7eb[_0x76d7('0x2f')][_0x76d7('0x43')]){_0x517359[_0x76d7('0x3e')]=[{'all':!![]}];}return db[_0x76d7('0x56')][_0x76d7('0x3f')](_0x517359);})[_0x76d7('0x1f')](function(_0x4142d2){_0x2bac30[_0x76d7('0x40')]=_0x4142d2;return _0x2bac30;});}})[_0x76d7('0x1f')](respondWithFilteredResult(_0x4aab4a,_0x517359))[_0x76d7('0x4c')](handleError(_0x4aab4a,null));};exports[_0x76d7('0x58')]=function(_0x3e5cdf,_0x59c569,_0xecb844){var _0x351ecb={'raw':!![],'where':{}};var _0x4a4891={};var _0x4744fa={'count':0x0,'rows':[]};return db[_0x76d7('0x29')][_0x76d7('0x55')]({'where':{'id':_0x3e5cdf[_0x76d7('0x4f')]['id']}})[_0x76d7('0x1f')](handleEntityNotFound(_0x59c569,null))[_0x76d7('0x1f')](function(_0x4bad57){if(_0x4bad57){_0x4a4891[_0x76d7('0x2d')]=_[_0x76d7('0x30')](db[_0x76d7('0x59')][_0x76d7('0x2a')]);_0x4a4891[_0x76d7('0x2f')]=_[_0x76d7('0x30')](_0x3e5cdf[_0x76d7('0x2f')]);_0x4a4891[_0x76d7('0x42')]=_[_0x76d7('0x32')](_0x4a4891[_0x76d7('0x2d')],_0x4a4891['query']);_0x351ecb[_0x76d7('0x31')]=_[_0x76d7('0x32')](_0x4a4891[_0x76d7('0x2d')],qs['fields'](_0x3e5cdf['query'][_0x76d7('0x33')]));_0x351ecb[_0x76d7('0x31')]=_0x351ecb[_0x76d7('0x31')][_0x76d7('0x34')]?_0x351ecb['attributes']:_0x4a4891['model'];if(!_0x3e5cdf[_0x76d7('0x2f')][_0x76d7('0x57')](_0x76d7('0x35'))){_0x351ecb[_0x76d7('0x1a')]=qs[_0x76d7('0x1a')](_0x3e5cdf[_0x76d7('0x2f')][_0x76d7('0x1a')]);_0x351ecb[_0x76d7('0x19')]=qs['offset'](_0x3e5cdf[_0x76d7('0x2f')][_0x76d7('0x19')]);}_0x351ecb[_0x76d7('0x36')]=qs[_0x76d7('0x37')](_0x3e5cdf[_0x76d7('0x2f')]['sort']);_0x351ecb['where']=qs[_0x76d7('0x42')](_[_0x76d7('0x39')](_0x3e5cdf[_0x76d7('0x2f')],_0x4a4891[_0x76d7('0x42')]));_0x351ecb[_0x76d7('0x38')]['ProjectId']=_0x4bad57['id'];if(_0x3e5cdf['query'][_0x76d7('0x3c')]){_0x351ecb[_0x76d7('0x38')]=_[_0x76d7('0x3d')](_0x351ecb[_0x76d7('0x38')],{'$or':_['map'](_0x351ecb['attributes'],function(_0x5f203e){var _0x17354d={};_0x17354d[_0x5f203e]={'$like':'%'+_0x3e5cdf[_0x76d7('0x2f')][_0x76d7('0x3c')]+'%'};return _0x17354d;})});}_0x351ecb=_[_0x76d7('0x3d')]({},_0x351ecb,_0x3e5cdf[_0x76d7('0x44')]);return db['JscriptyAnswerReport'][_0x76d7('0x18')]({'where':_0x351ecb[_0x76d7('0x38')]})['then'](function(_0x1efd86){_0x4744fa[_0x76d7('0x18')]=_0x1efd86;if(_0x3e5cdf[_0x76d7('0x2f')]['includeAll']){_0x351ecb[_0x76d7('0x3e')]=[{'all':!![]}];}return db[_0x76d7('0x59')][_0x76d7('0x3f')](_0x351ecb);})[_0x76d7('0x1f')](function(_0x5e8b50){_0x4744fa[_0x76d7('0x40')]=_0x5e8b50;return _0x4744fa;});}})[_0x76d7('0x1f')](respondWithFilteredResult(_0x59c569,_0x351ecb))[_0x76d7('0x4c')](handleError(_0x59c569,null));};function char(_0x18409e){return _0x76d7('0x5a')===typeof _0x18409e?String[_0x76d7('0x5b')]['apply'](null,arguments):_0x18409e;}function needsEncapsulation(_0x11ad40){return!!_0x11ad40&&(_0x11ad40[_0x76d7('0x5c')]()[_0x76d7('0x5d')](char(0xd))>=0x0||_0x11ad40[_0x76d7('0x5c')]()[_0x76d7('0x5d')](char(0xa))>=0x0||_0x11ad40[_0x76d7('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x11ad40['toString']()[_0x76d7('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x51da29){var _0x567e6d=char(0x22),_0x355d18='\x5c'+char(0x22),_0x1a6422=_0x51da29[_0x76d7('0x5c')]()[_0x76d7('0x5e')](new RegExp(_0x567e6d,'g'),_0x355d18);return _0x567e6d+_0x1a6422+_0x567e6d;}exports[_0x76d7('0x5f')]=function(_0x37e554,_0x31ab2c,_0x32be4e){var _0x393501,_0x19c47e;var _0x3d3b1={'where':{'ProjectId':_0x37e554['params']['id']}};if(_0x37e554[_0x76d7('0x2f')]['startTime']){_0x3d3b1[_0x76d7('0x38')][_0x76d7('0x60')]=JSON[_0x76d7('0x61')](_0x37e554['query'][_0x76d7('0x62')]);}return db[_0x76d7('0x56')][_0x76d7('0x3f')](_0x3d3b1)[_0x76d7('0x1f')](handleEntityNotFound(_0x31ab2c,null))[_0x76d7('0x1f')](function(_0x39ad43){if(_0x39ad43){_0x393501=_0x39ad43;return db[_0x76d7('0x63')][_0x76d7('0x3f')]({'where':{'SessionId':{'$in':_[_0x76d7('0x2e')](_0x393501,'id')},'ProjectId':_0x37e554[_0x76d7('0x4f')]['id']},'order':_0x76d7('0x64')});}})[_0x76d7('0x1f')](handleEntityNotFound(_0x31ab2c,null))['then'](function(_0x423f7c){if(_0x423f7c){_0x19c47e=_0x423f7c;var _0x2e7d85={};for(var _0x101145=0x0,_0x23d9f5=_0x19c47e['length'];_0x101145<_0x23d9f5;_0x101145++){if(!_0x2e7d85[_0x76d7('0x57')](_0x19c47e[_0x101145][_0x76d7('0x65')])){_0x2e7d85[_0x19c47e[_0x101145]['questionId']]=needsEncapsulation(_0x19c47e[_0x101145][_0x76d7('0x66')])?encapsulate(_0x19c47e[_0x101145][_0x76d7('0x66')]):_0x19c47e[_0x101145]['question'];}}var _0x5193ce=[],_0x3ab7d9={};for(var _0x294fb1=0x0,_0x44b3cc=_0x393501[_0x76d7('0x34')];_0x294fb1<_0x44b3cc;_0x294fb1++){_0x3ab7d9={'ProjectId':_0x37e554['params']['id'],'SessionId':_0x393501[_0x294fb1]['id'],'StartTime':moment(_0x393501[_0x294fb1][_0x76d7('0x60')])[_0x76d7('0x67')](_0x76d7('0x68'))};for(var _0x187cba=0x0,_0x33869d=_0x19c47e['length'];_0x187cba<_0x33869d;_0x187cba++){if(_0x19c47e[_0x187cba][_0x76d7('0x69')]==_0x393501[_0x294fb1]['id']&&_0x2e7d85[_0x76d7('0x57')](_0x19c47e[_0x187cba][_0x76d7('0x65')])){_0x3ab7d9[_0x2e7d85[_0x19c47e[_0x187cba][_0x76d7('0x65')]]]=_0x19c47e[_0x187cba][_0x76d7('0x6a')];}}for(var _0x5232b6 in _0x2e7d85){if(!_0x3ab7d9['hasOwnProperty'](_0x2e7d85[_0x5232b6])){_0x3ab7d9[_0x2e7d85[_0x5232b6]]=null;}}_0x5193ce[_0x76d7('0x6b')](_0x3ab7d9);}return _0x5193ce;}})[_0x76d7('0x1f')](function(_0x1ba0fb){if(!_['isEmpty'](_0x1ba0fb)){var _0x2cb8e9=toCsv(_0x1ba0fb);var _0x136e28=Date[_0x76d7('0x6c')]();fs[_0x76d7('0x6d')](util[_0x76d7('0x67')](_0x76d7('0x6e'),_0x37e554['params']['id'],_0x136e28),_0x2cb8e9);_0x31ab2c[_0x76d7('0x6f')](_0x76d7('0x70'),_0x76d7('0x71')+util[_0x76d7('0x67')](_0x76d7('0x72'),_0x37e554['params']['id'],_0x136e28));_0x31ab2c[_0x76d7('0x6f')](_0x76d7('0x73'),'text/csv');return _0x31ab2c[_0x76d7('0x74')](util[_0x76d7('0x67')](_0x76d7('0x6e'),_0x37e554[_0x76d7('0x4f')]['id'],_0x136e28));}else{return _0x31ab2c[_0x76d7('0x14')](0xcc);}})[_0x76d7('0x4c')](handleError(_0x31ab2c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 402846b..e01b233 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 _0x9f75=['path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','request-promise'];(function(_0x158e4b,_0x3071bb){var _0x3c3469=function(_0x54b238){while(--_0x54b238){_0x158e4b['push'](_0x158e4b['shift']());}};_0x3c3469(++_0x3071bb);}(_0x9f75,0x15a));var _0x59f7=function(_0x21c952,_0x709758){_0x21c952=_0x21c952-0x0;var _0x554104=_0x9f75[_0x21c952];return _0x554104;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc770=['path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','moment','bluebird','request-promise'];(function(_0x5e60a2,_0xe85ba3){var _0xb47bd=function(_0x19e91f){while(--_0x19e91f){_0x5e60a2['push'](_0x5e60a2['shift']());}};_0xb47bd(++_0xe85ba3);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('JscriptyProject',attributes,{'tableName':_0x0c77('0xb'),'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 4ab5621..f34af09 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x250f9c,_0x247ebe){var _0x55066b=function(_0x3649e6){while(--_0x3649e6){_0x250f9c['push'](_0x250f9c['shift']());}};_0x55066b(++_0x247ebe);}(_0xe706,0xa3));var _0x6e70=function(_0x59db34,_0x593726){_0x59db34=_0x59db34-0x0;var _0x568a53=_0xe706[_0x59db34];return _0x568a53;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x33cff6,_0x24664e){var _0x5f3171=function(_0x557624){while(--_0x557624){_0x33cff6['push'](_0x33cff6['shift']());}};_0x5f3171(++_0x24664e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x116bad,_0x42d6d2){_0x116bad=_0x116bad-0x0;var _0x53fdef=_0xb43b[_0x116bad];return _0x53fdef;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5703f6b..e3e25bc 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 _0xe0a8=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x582965,_0x58da5a){var _0x361185=function(_0x416939){while(--_0x416939){_0x582965['push'](_0x582965['shift']());}};_0x361185(++_0x58da5a);}(_0xe0a8,0x14d));var _0x8e0a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe0a8[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x8e0a('0x0'));var path=require('path');var timeout=require(_0x8e0a('0x1'));var express=require('express');var router=express[_0x8e0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8e0a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8e0a('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0x8e0a('0x5')]('/',auth[_0x8e0a('0x6')](),controller[_0x8e0a('0x7')]);router['get'](_0x8e0a('0x8'),auth[_0x8e0a('0x6')](),controller[_0x8e0a('0x9')]);router[_0x8e0a('0x5')](_0x8e0a('0xa'),auth[_0x8e0a('0x6')](),controller[_0x8e0a('0xb')]);router[_0x8e0a('0xc')]('/',auth[_0x8e0a('0x6')](),controller[_0x8e0a('0xd')]);router[_0x8e0a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8e0a('0xf')]);router['delete']('/:id',auth[_0x8e0a('0x6')](),controller[_0x8e0a('0x10')]);module[_0x8e0a('0x11')]=router; \ No newline at end of file +var _0xc0ff=['/describe','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x5c763f,_0xd5b7c9){var _0x1a6b7f=function(_0x1c3db4){while(--_0x1c3db4){_0x5c763f['push'](_0x5c763f['shift']());}};_0x1a6b7f(++_0xd5b7c9);}(_0xc0ff,0x134));var _0xfc0f=function(_0x571339,_0x5bcafb){_0x571339=_0x571339-0x0;var _0x5af8a6=_0xc0ff[_0x571339];return _0x5af8a6;};'use strict';var multer=require(_0xfc0f('0x0'));var util=require(_0xfc0f('0x1'));var path=require(_0xfc0f('0x2'));var timeout=require(_0xfc0f('0x3'));var express=require(_0xfc0f('0x4'));var router=express[_0xfc0f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc0f('0x6'));var interaction=require(_0xfc0f('0x7'));var config=require('../../config/environment');var controller=require(_0xfc0f('0x8'));router[_0xfc0f('0x9')]('/',auth[_0xfc0f('0xa')](),controller[_0xfc0f('0xb')]);router[_0xfc0f('0x9')](_0xfc0f('0xc'),auth[_0xfc0f('0xa')](),controller[_0xfc0f('0xd')]);router['get'](_0xfc0f('0xe'),auth[_0xfc0f('0xa')](),controller[_0xfc0f('0xf')]);router[_0xfc0f('0x10')]('/',auth['isAuthenticated'](),controller[_0xfc0f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfc0f('0x12')](_0xfc0f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xfc0f('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3cc0f74..999f435 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x46544d,_0x28dbfc){_0x46544d=_0x46544d-0x0;var _0x2d8f55=_0x7a54[_0x46544d];return _0x2d8f55;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x3d11c4,_0x3982a4){_0x3d11c4=_0x3d11c4-0x0;var _0x9c3996=_0x7a54[_0x3d11c4];return _0x9c3996;};'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 b730c10..caf7486 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 _0x3a1b=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','save','update','destroy','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','then','include','findAll','catch','show','params','length','includeAll','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x11a90,_0x5c53ce){var _0x1ce044=function(_0x51115f){while(--_0x51115f){_0x11a90['push'](_0x11a90['shift']());}};_0x1ce044(++_0x5c53ce);}(_0x3a1b,0x8b));var _0xb3a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a1b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb3a1('0x0'));var rimraf=require(_0xb3a1('0x1'));var zipdir=require(_0xb3a1('0x2'));var jsonpatch=require(_0xb3a1('0x3'));var rp=require(_0xb3a1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3a1('0x5'));var util=require(_0xb3a1('0x6'));var path=require('path');var sox=require(_0xb3a1('0x7'));var csv=require(_0xb3a1('0x8'));var ejs=require(_0xb3a1('0x9'));var fs=require('fs');var fs_extra=require(_0xb3a1('0xa'));var _=require(_0xb3a1('0xb'));var squel=require(_0xb3a1('0xc'));var crypto=require('crypto');var jsforce=require(_0xb3a1('0xd'));var deskjs=require(_0xb3a1('0xe'));var toCsv=require(_0xb3a1('0x8'));var querystring=require(_0xb3a1('0xf'));var Papa=require(_0xb3a1('0x10'));var Redis=require(_0xb3a1('0x11'));var authService=require(_0xb3a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb3a1('0x13'));var hardwareService=require(_0xb3a1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb3a1('0x15'));var config=require(_0xb3a1('0x16'));var licenseUtil=require(_0xb3a1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352c7c,_0x158211){_0x158211=_0x158211||0xcc;return function(_0xcf3386){if(_0xcf3386){return _0x352c7c[_0xb3a1('0x18')](_0x158211);}return _0x352c7c[_0xb3a1('0x19')](_0x158211)[_0xb3a1('0x1a')]();};}function respondWithResult(_0x305da0,_0x4e824f){_0x4e824f=_0x4e824f||0xc8;return function(_0x55c619){if(_0x55c619){return _0x305da0['status'](_0x4e824f)[_0xb3a1('0x1b')](_0x55c619);}};}function respondWithFilteredResult(_0x536dfd,_0x1891ab){return function(_0x2423fd){if(_0x2423fd){var _0x2beb60=typeof _0x1891ab['offset']===_0xb3a1('0x1c')&&typeof _0x1891ab[_0xb3a1('0x1d')]===_0xb3a1('0x1c');var _0x490210=_0x2423fd[_0xb3a1('0x1e')];var _0x12e2b3=_0x2beb60?0x0:_0x1891ab['offset'];var _0x3dd923=_0x2beb60?_0x2423fd[_0xb3a1('0x1e')]:_0x1891ab['offset']+_0x1891ab[_0xb3a1('0x1d')];var _0x36dac4;if(_0x3dd923>=_0x490210){_0x3dd923=_0x490210;_0x36dac4=0xc8;}else{_0x36dac4=0xce;}_0x536dfd[_0xb3a1('0x19')](_0x36dac4);return _0x536dfd[_0xb3a1('0x1f')](_0xb3a1('0x20'),_0x12e2b3+'-'+_0x3dd923+'/'+_0x490210)['json'](_0x2423fd);}return null;};}function patchUpdates(_0x34ee5b){return function(_0x113122){try{jsonpatch['apply'](_0x113122,_0x34ee5b,!![]);}catch(_0x2a4615){return BPromise['reject'](_0x2a4615);}return _0x113122[_0xb3a1('0x21')]();};}function saveUpdates(_0xb7c130,_0x6e5cb8){return function(_0x4a22bb){if(_0x4a22bb){return _0x4a22bb[_0xb3a1('0x22')](_0xb7c130)['then'](function(_0x2d6c01){return _0x2d6c01;});}return null;};}function removeEntity(_0x5d5fb5,_0x11acd0){return function(_0x244da9){if(_0x244da9){return _0x244da9[_0xb3a1('0x23')]()['then'](function(){_0x5d5fb5[_0xb3a1('0x19')](0xcc)[_0xb3a1('0x1a')]();});}};}function handleEntityNotFound(_0x375726,_0x21e43e){return function(_0x4938c7){if(!_0x4938c7){_0x375726['sendStatus'](0x194);}return _0x4938c7;};}function handleError(_0x5a4dcb,_0x54f2b9){_0x54f2b9=_0x54f2b9||0x1f4;return function(_0x2d090e){logger['error'](_0x2d090e[_0xb3a1('0x24')]);if(_0x2d090e[_0xb3a1('0x25')]){delete _0x2d090e[_0xb3a1('0x25')];}_0x5a4dcb['status'](_0x54f2b9)[_0xb3a1('0x26')](_0x2d090e);};}exports[_0xb3a1('0x27')]=function(_0xed518e,_0xcd1bb9){var _0x64b8a8={},_0x4dd654={},_0x26ffef={'count':0x0,'rows':[]};var _0x44c2b5=_['map'](db[_0xb3a1('0x28')][_0xb3a1('0x29')],function(_0x10887e){return{'name':_0x10887e[_0xb3a1('0x2a')],'type':_0x10887e[_0xb3a1('0x2b')][_0xb3a1('0x2c')]};});_0x4dd654[_0xb3a1('0x2d')]=_[_0xb3a1('0x2e')](_0x44c2b5,_0xb3a1('0x25'));_0x4dd654[_0xb3a1('0x2f')]=_[_0xb3a1('0x30')](_0xed518e[_0xb3a1('0x2f')]);_0x4dd654[_0xb3a1('0x31')]=_[_0xb3a1('0x32')](_0x4dd654[_0xb3a1('0x2d')],_0x4dd654[_0xb3a1('0x2f')]);_0x64b8a8[_0xb3a1('0x33')]=_[_0xb3a1('0x32')](_0x4dd654['model'],qs[_0xb3a1('0x34')](_0xed518e[_0xb3a1('0x2f')]['fields']));_0x64b8a8[_0xb3a1('0x33')]=_0x64b8a8['attributes']['length']?_0x64b8a8[_0xb3a1('0x33')]:_0x4dd654[_0xb3a1('0x2d')];if(!_0xed518e[_0xb3a1('0x2f')][_0xb3a1('0x35')](_0xb3a1('0x36'))){_0x64b8a8[_0xb3a1('0x1d')]=qs[_0xb3a1('0x1d')](_0xed518e[_0xb3a1('0x2f')][_0xb3a1('0x1d')]);_0x64b8a8[_0xb3a1('0x37')]=qs[_0xb3a1('0x37')](_0xed518e[_0xb3a1('0x2f')]['offset']);}_0x64b8a8[_0xb3a1('0x38')]=qs[_0xb3a1('0x39')](_0xed518e['query']['sort']);_0x64b8a8['where']=qs[_0xb3a1('0x31')](_[_0xb3a1('0x3a')](_0xed518e[_0xb3a1('0x2f')],_0x4dd654['filters']),_0x44c2b5);if(_0xed518e[_0xb3a1('0x2f')][_0xb3a1('0x3b')]){_0x64b8a8[_0xb3a1('0x3c')]=_[_0xb3a1('0x3d')](_0x64b8a8[_0xb3a1('0x3c')],{'$or':_['map'](_0x44c2b5,function(_0x5a4d5c){if(_0x5a4d5c['type']!==_0xb3a1('0x3e')){var _0x3c46ba={};_0x3c46ba[_0x5a4d5c[_0xb3a1('0x25')]]={'$like':'%'+_0xed518e[_0xb3a1('0x2f')][_0xb3a1('0x3b')]+'%'};return _0x3c46ba;}})});}_0x64b8a8=_[_0xb3a1('0x3d')]({},_0x64b8a8,_0xed518e['options']);var _0x5476af={'where':_0x64b8a8[_0xb3a1('0x3c')]};return db[_0xb3a1('0x28')]['count'](_0x5476af)[_0xb3a1('0x3f')](function(_0x49e6ec){_0x26ffef['count']=_0x49e6ec;if(_0xed518e[_0xb3a1('0x2f')]['includeAll']){_0x64b8a8[_0xb3a1('0x40')]=[{'all':!![]}];}return db[_0xb3a1('0x28')][_0xb3a1('0x41')](_0x64b8a8);})[_0xb3a1('0x3f')](function(_0x22aef1){_0x26ffef['rows']=_0x22aef1;return _0x26ffef;})[_0xb3a1('0x3f')](respondWithFilteredResult(_0xcd1bb9,_0x64b8a8))[_0xb3a1('0x42')](handleError(_0xcd1bb9,null));};exports[_0xb3a1('0x43')]=function(_0x3b1412,_0x27f642){var _0x2eed6c={'raw':!![],'where':{'id':_0x3b1412[_0xb3a1('0x44')]['id']}},_0x5b2169={};_0x5b2169[_0xb3a1('0x2d')]=_['keys'](db['JscriptyQuestionReport'][_0xb3a1('0x29')]);_0x5b2169[_0xb3a1('0x2f')]=_[_0xb3a1('0x30')](_0x3b1412[_0xb3a1('0x2f')]);_0x5b2169['filters']=_['intersection'](_0x5b2169[_0xb3a1('0x2d')],_0x5b2169[_0xb3a1('0x2f')]);_0x2eed6c[_0xb3a1('0x33')]=_[_0xb3a1('0x32')](_0x5b2169[_0xb3a1('0x2d')],qs[_0xb3a1('0x34')](_0x3b1412[_0xb3a1('0x2f')]['fields']));_0x2eed6c[_0xb3a1('0x33')]=_0x2eed6c[_0xb3a1('0x33')][_0xb3a1('0x45')]?_0x2eed6c[_0xb3a1('0x33')]:_0x5b2169['model'];if(_0x3b1412[_0xb3a1('0x2f')][_0xb3a1('0x46')]){_0x2eed6c[_0xb3a1('0x40')]=[{'all':!![]}];}_0x2eed6c=_[_0xb3a1('0x3d')]({},_0x2eed6c,_0x3b1412[_0xb3a1('0x47')]);return db[_0xb3a1('0x28')][_0xb3a1('0x48')](_0x2eed6c)[_0xb3a1('0x3f')](handleEntityNotFound(_0x27f642,null))[_0xb3a1('0x3f')](respondWithResult(_0x27f642,null))[_0xb3a1('0x42')](handleError(_0x27f642,null));};exports['create']=function(_0x2ea8c0,_0x528f4e){return db['JscriptyQuestionReport']['create'](_0x2ea8c0[_0xb3a1('0x49')],{})[_0xb3a1('0x3f')](respondWithResult(_0x528f4e,0xc9))[_0xb3a1('0x42')](handleError(_0x528f4e,null));};exports[_0xb3a1('0x22')]=function(_0x2e3d1d,_0x49cb56){if(_0x2e3d1d['body']['id']){delete _0x2e3d1d[_0xb3a1('0x49')]['id'];}return db[_0xb3a1('0x28')]['find']({'where':{'id':_0x2e3d1d[_0xb3a1('0x44')]['id']}})[_0xb3a1('0x3f')](handleEntityNotFound(_0x49cb56,null))[_0xb3a1('0x3f')](saveUpdates(_0x2e3d1d[_0xb3a1('0x49')],null))[_0xb3a1('0x3f')](respondWithResult(_0x49cb56,null))[_0xb3a1('0x42')](handleError(_0x49cb56,null));};exports[_0xb3a1('0x23')]=function(_0x53649c,_0x1b26cf){return db[_0xb3a1('0x28')][_0xb3a1('0x48')]({'where':{'id':_0x53649c[_0xb3a1('0x44')]['id']}})[_0xb3a1('0x3f')](handleEntityNotFound(_0x1b26cf,null))['then'](removeEntity(_0x1b26cf,null))[_0xb3a1('0x42')](handleError(_0x1b26cf,null));};exports['describe']=function(_0x17748a,_0x120595){return db[_0xb3a1('0x28')][_0xb3a1('0x4a')]()['then'](respondWithResult(_0x120595,null))[_0xb3a1('0x42')](handleError(_0x120595,null));}; \ No newline at end of file +var _0x4d44=['Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d44,0x135));var _0x44d4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4d44[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x44d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44d4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x44d4('0x3'));var csv=require(_0x44d4('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44d4('0x5'));var _=require(_0x44d4('0x6'));var squel=require(_0x44d4('0x7'));var crypto=require(_0x44d4('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x44d4('0x9'));var toCsv=require(_0x44d4('0x4'));var querystring=require('querystring');var Papa=require(_0x44d4('0xa'));var Redis=require(_0x44d4('0xb'));var authService=require(_0x44d4('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x44d4('0xd'));var hardwareService=require(_0x44d4('0xe'));var logger=require(_0x44d4('0xf'))(_0x44d4('0x10'));var utils=require('../../config/utils');var config=require(_0x44d4('0x11'));var licenseUtil=require(_0x44d4('0x12'));var db=require(_0x44d4('0x13'))['db'];function respondWithStatusCode(_0x4d112e,_0x656e1b){_0x656e1b=_0x656e1b||0xcc;return function(_0x18f087){if(_0x18f087){return _0x4d112e['sendStatus'](_0x656e1b);}return _0x4d112e[_0x44d4('0x14')](_0x656e1b)['end']();};}function respondWithResult(_0x52f7e9,_0x1656e){_0x1656e=_0x1656e||0xc8;return function(_0x3094eb){if(_0x3094eb){return _0x52f7e9[_0x44d4('0x14')](_0x1656e)[_0x44d4('0x15')](_0x3094eb);}};}function respondWithFilteredResult(_0x56a402,_0x5862ad){return function(_0x27ec7e){if(_0x27ec7e){var _0x3ae081=typeof _0x5862ad['offset']==='undefined'&&typeof _0x5862ad[_0x44d4('0x16')]==='undefined';var _0x27fbd0=_0x27ec7e[_0x44d4('0x17')];var _0x4aeda8=_0x3ae081?0x0:_0x5862ad['offset'];var _0x23c9a1=_0x3ae081?_0x27ec7e[_0x44d4('0x17')]:_0x5862ad[_0x44d4('0x18')]+_0x5862ad[_0x44d4('0x16')];var _0x51bc27;if(_0x23c9a1>=_0x27fbd0){_0x23c9a1=_0x27fbd0;_0x51bc27=0xc8;}else{_0x51bc27=0xce;}_0x56a402[_0x44d4('0x14')](_0x51bc27);return _0x56a402[_0x44d4('0x19')](_0x44d4('0x1a'),_0x4aeda8+'-'+_0x23c9a1+'/'+_0x27fbd0)[_0x44d4('0x15')](_0x27ec7e);}return null;};}function patchUpdates(_0x7a3ec2){return function(_0x3c5ece){try{jsonpatch[_0x44d4('0x1b')](_0x3c5ece,_0x7a3ec2,!![]);}catch(_0x49b5ec){return BPromise[_0x44d4('0x1c')](_0x49b5ec);}return _0x3c5ece[_0x44d4('0x1d')]();};}function saveUpdates(_0x4cc6af,_0x548917){return function(_0x2f253f){if(_0x2f253f){return _0x2f253f[_0x44d4('0x1e')](_0x4cc6af)[_0x44d4('0x1f')](function(_0x4df76e){return _0x4df76e;});}return null;};}function removeEntity(_0x17a966,_0x1f9d5d){return function(_0x2d3e08){if(_0x2d3e08){return _0x2d3e08[_0x44d4('0x20')]()[_0x44d4('0x1f')](function(){_0x17a966['status'](0xcc)[_0x44d4('0x21')]();});}};}function handleEntityNotFound(_0x45d32e,_0x3e54b3){return function(_0x3ecec2){if(!_0x3ecec2){_0x45d32e[_0x44d4('0x22')](0x194);}return _0x3ecec2;};}function handleError(_0x210198,_0x4e2142){_0x4e2142=_0x4e2142||0x1f4;return function(_0xdcddbe){logger[_0x44d4('0x23')](_0xdcddbe[_0x44d4('0x24')]);if(_0xdcddbe['name']){delete _0xdcddbe[_0x44d4('0x25')];}_0x210198[_0x44d4('0x14')](_0x4e2142)['send'](_0xdcddbe);};}exports[_0x44d4('0x26')]=function(_0xb00821,_0x3dcf24){var _0x2eb840={},_0x437d5a={},_0x366ad4={'count':0x0,'rows':[]};var _0xfbaf67=_['map'](db[_0x44d4('0x27')][_0x44d4('0x28')],function(_0x736c0b){return{'name':_0x736c0b['fieldName'],'type':_0x736c0b[_0x44d4('0x29')][_0x44d4('0x2a')]};});_0x437d5a[_0x44d4('0x2b')]=_[_0x44d4('0x2c')](_0xfbaf67,_0x44d4('0x25'));_0x437d5a[_0x44d4('0x2d')]=_['keys'](_0xb00821[_0x44d4('0x2d')]);_0x437d5a[_0x44d4('0x2e')]=_[_0x44d4('0x2f')](_0x437d5a['model'],_0x437d5a['query']);_0x2eb840['attributes']=_[_0x44d4('0x2f')](_0x437d5a[_0x44d4('0x2b')],qs['fields'](_0xb00821[_0x44d4('0x2d')][_0x44d4('0x30')]));_0x2eb840[_0x44d4('0x31')]=_0x2eb840[_0x44d4('0x31')][_0x44d4('0x32')]?_0x2eb840['attributes']:_0x437d5a[_0x44d4('0x2b')];if(!_0xb00821[_0x44d4('0x2d')]['hasOwnProperty']('nolimit')){_0x2eb840['limit']=qs['limit'](_0xb00821[_0x44d4('0x2d')][_0x44d4('0x16')]);_0x2eb840[_0x44d4('0x18')]=qs[_0x44d4('0x18')](_0xb00821[_0x44d4('0x2d')][_0x44d4('0x18')]);}_0x2eb840['order']=qs[_0x44d4('0x33')](_0xb00821[_0x44d4('0x2d')]['sort']);_0x2eb840[_0x44d4('0x34')]=qs[_0x44d4('0x2e')](_[_0x44d4('0x35')](_0xb00821['query'],_0x437d5a[_0x44d4('0x2e')]),_0xfbaf67);if(_0xb00821[_0x44d4('0x2d')][_0x44d4('0x36')]){_0x2eb840[_0x44d4('0x34')]=_[_0x44d4('0x37')](_0x2eb840[_0x44d4('0x34')],{'$or':_[_0x44d4('0x2c')](_0xfbaf67,function(_0x460921){if(_0x460921['type']!=='VIRTUAL'){var _0x9f1ea8={};_0x9f1ea8[_0x460921[_0x44d4('0x25')]]={'$like':'%'+_0xb00821['query'][_0x44d4('0x36')]+'%'};return _0x9f1ea8;}})});}_0x2eb840=_[_0x44d4('0x37')]({},_0x2eb840,_0xb00821[_0x44d4('0x38')]);var _0x17a6dd={'where':_0x2eb840[_0x44d4('0x34')]};return db[_0x44d4('0x27')][_0x44d4('0x17')](_0x17a6dd)['then'](function(_0x260c46){_0x366ad4[_0x44d4('0x17')]=_0x260c46;if(_0xb00821[_0x44d4('0x2d')][_0x44d4('0x39')]){_0x2eb840['include']=[{'all':!![]}];}return db[_0x44d4('0x27')][_0x44d4('0x3a')](_0x2eb840);})[_0x44d4('0x1f')](function(_0x43012e){_0x366ad4['rows']=_0x43012e;return _0x366ad4;})['then'](respondWithFilteredResult(_0x3dcf24,_0x2eb840))[_0x44d4('0x3b')](handleError(_0x3dcf24,null));};exports[_0x44d4('0x3c')]=function(_0x1b3045,_0x1d28b2){var _0x167a41={'raw':!![],'where':{'id':_0x1b3045[_0x44d4('0x3d')]['id']}},_0x53dcf8={};_0x53dcf8[_0x44d4('0x2b')]=_['keys'](db['JscriptyQuestionReport'][_0x44d4('0x28')]);_0x53dcf8['query']=_['keys'](_0x1b3045[_0x44d4('0x2d')]);_0x53dcf8['filters']=_[_0x44d4('0x2f')](_0x53dcf8[_0x44d4('0x2b')],_0x53dcf8[_0x44d4('0x2d')]);_0x167a41[_0x44d4('0x31')]=_[_0x44d4('0x2f')](_0x53dcf8[_0x44d4('0x2b')],qs[_0x44d4('0x30')](_0x1b3045[_0x44d4('0x2d')][_0x44d4('0x30')]));_0x167a41['attributes']=_0x167a41[_0x44d4('0x31')][_0x44d4('0x32')]?_0x167a41[_0x44d4('0x31')]:_0x53dcf8[_0x44d4('0x2b')];if(_0x1b3045[_0x44d4('0x2d')]['includeAll']){_0x167a41[_0x44d4('0x3e')]=[{'all':!![]}];}_0x167a41=_[_0x44d4('0x37')]({},_0x167a41,_0x1b3045['options']);return db[_0x44d4('0x27')][_0x44d4('0x3f')](_0x167a41)[_0x44d4('0x1f')](handleEntityNotFound(_0x1d28b2,null))[_0x44d4('0x1f')](respondWithResult(_0x1d28b2,null))[_0x44d4('0x3b')](handleError(_0x1d28b2,null));};exports[_0x44d4('0x40')]=function(_0x20b354,_0x5588d2){return db[_0x44d4('0x27')][_0x44d4('0x40')](_0x20b354[_0x44d4('0x41')],{})[_0x44d4('0x1f')](respondWithResult(_0x5588d2,0xc9))[_0x44d4('0x3b')](handleError(_0x5588d2,null));};exports['update']=function(_0x44c7ac,_0x2a5919){if(_0x44c7ac[_0x44d4('0x41')]['id']){delete _0x44c7ac['body']['id'];}return db[_0x44d4('0x27')][_0x44d4('0x3f')]({'where':{'id':_0x44c7ac['params']['id']}})[_0x44d4('0x1f')](handleEntityNotFound(_0x2a5919,null))[_0x44d4('0x1f')](saveUpdates(_0x44c7ac[_0x44d4('0x41')],null))[_0x44d4('0x1f')](respondWithResult(_0x2a5919,null))[_0x44d4('0x3b')](handleError(_0x2a5919,null));};exports[_0x44d4('0x20')]=function(_0x42e584,_0x28729f){return db[_0x44d4('0x27')][_0x44d4('0x3f')]({'where':{'id':_0x42e584['params']['id']}})['then'](handleEntityNotFound(_0x28729f,null))['then'](removeEntity(_0x28729f,null))[_0x44d4('0x3b')](handleError(_0x28729f,null));};exports[_0x44d4('0x42')]=function(_0x2fca43,_0x3adc5a){return db[_0x44d4('0x27')][_0x44d4('0x42')]()[_0x44d4('0x1f')](respondWithResult(_0x3adc5a,null))[_0x44d4('0x3b')](handleError(_0x3adc5a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 024d15e..bac3801 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 _0xd36e=['report_jscripty_questions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','JscriptyQuestionReport'];(function(_0x1aa4fd,_0x265057){var _0x289290=function(_0x2ab300){while(--_0x2ab300){_0x1aa4fd['push'](_0x1aa4fd['shift']());}};_0x289290(++_0x265057);}(_0xd36e,0x9b));var _0xed36=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd36e[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xed36('0x0'));var util=require(_0xed36('0x1'));var logger=require(_0xed36('0x2'))('api');var moment=require(_0xed36('0x3'));var BPromise=require('bluebird');var rp=require(_0xed36('0x4'));var fs=require('fs');var path=require(_0xed36('0x5'));var rimraf=require(_0xed36('0x6'));var config=require(_0xed36('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x438d02,_0x27699c){return _0x438d02[_0xed36('0x8')](_0xed36('0x9'),attributes,{'tableName':_0xed36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x798c=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x31ec0b,_0x1716ed){var _0x30d090=function(_0x2e7020){while(--_0x2e7020){_0x31ec0b['push'](_0x31ec0b['shift']());}};_0x30d090(++_0x1716ed);}(_0x798c,0x1b0));var _0xc798=function(_0x11248b,_0x5de4ad){_0x11248b=_0x11248b-0x0;var _0x474a6a=_0x798c[_0x11248b];return _0x474a6a;};'use strict';var _=require(_0xc798('0x0'));var util=require(_0xc798('0x1'));var logger=require(_0xc798('0x2'))('api');var moment=require(_0xc798('0x3'));var BPromise=require('bluebird');var rp=require(_0xc798('0x4'));var fs=require('fs');var path=require(_0xc798('0x5'));var rimraf=require(_0xc798('0x6'));var config=require(_0xc798('0x7'));var attributes=require(_0xc798('0x8'));module[_0xc798('0x9')]=function(_0x6dc99b,_0x19a802){return _0x6dc99b[_0xc798('0xa')](_0xc798('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index f21e3e4..76c2aea 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 _0x280d=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x280d,0x85));var _0xd280=function(_0x318d46,_0x106e5a){_0x318d46=_0x318d46-0x0;var _0x229f18=_0x280d[_0x318d46];return _0x229f18;};'use strict';var _=require(_0xd280('0x0'));var util=require(_0xd280('0x1'));var moment=require(_0xd280('0x2'));var BPromise=require('bluebird');var rs=require(_0xd280('0x3'));var fs=require('fs');var Redis=require(_0xd280('0x4'));var db=require(_0xd280('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd280('0x6'));var config=require(_0xd280('0x7'));var jayson=require(_0xd280('0x8'));var client=jayson[_0xd280('0x9')][_0xd280('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e3654,_0x3d612,_0x4684a7){return new BPromise(function(_0x38e232,_0x2280ff){return client[_0xd280('0xb')](_0x3e3654,_0x4684a7)[_0xd280('0xc')](function(_0x571a9a){logger['info'](_0xd280('0xd'),_0x3d612,_0xd280('0xe'));logger[_0xd280('0xf')](_0xd280('0x10'),_0x3d612,'request\x20sent',JSON['stringify'](_0x571a9a));if(_0x571a9a['error']){if(_0x571a9a[_0xd280('0x11')]['code']===0x1f4){logger[_0xd280('0x11')](_0xd280('0xd'),_0x3d612,_0x571a9a['error']['message']);return _0x2280ff(_0x571a9a['error'][_0xd280('0x12')]);}logger[_0xd280('0x11')](_0xd280('0xd'),_0x3d612,_0x571a9a[_0xd280('0x11')][_0xd280('0x12')]);return _0x38e232(_0x571a9a[_0xd280('0x11')][_0xd280('0x12')]);}else{logger[_0xd280('0x13')](_0xd280('0xd'),_0x3d612,_0xd280('0xe'));_0x38e232(_0x571a9a[_0xd280('0x14')]['message']);}})[_0xd280('0x15')](function(_0x5d8468){logger[_0xd280('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d612,_0x5d8468);_0x2280ff(_0x5d8468);});});} \ No newline at end of file +var _0x652f=['client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0xd00a4a,_0x6e3bbb){var _0x260456=function(_0x3211aa){while(--_0x3211aa){_0xd00a4a['push'](_0xd00a4a['shift']());}};_0x260456(++_0x6e3bbb);}(_0x652f,0x156));var _0xf652=function(_0x4f0360,_0x5af977){_0x4f0360=_0x4f0360-0x0;var _0x312e7d=_0x652f[_0x4f0360];return _0x312e7d;};'use strict';var _=require(_0xf652('0x0'));var util=require(_0xf652('0x1'));var moment=require(_0xf652('0x2'));var BPromise=require(_0xf652('0x3'));var rs=require(_0xf652('0x4'));var fs=require('fs');var Redis=require(_0xf652('0x5'));var db=require(_0xf652('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf652('0x7'))('rpc');var config=require(_0xf652('0x8'));var jayson=require(_0xf652('0x9'));var client=jayson[_0xf652('0xa')][_0xf652('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e05e9,_0x47d1ed,_0x1e9e17){return new BPromise(function(_0x53336e,_0x2d8803){return client[_0xf652('0xc')](_0x2e05e9,_0x1e9e17)[_0xf652('0xd')](function(_0x26639f){logger[_0xf652('0xe')](_0xf652('0xf'),_0x47d1ed,_0xf652('0x10'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x47d1ed,_0xf652('0x10'),JSON[_0xf652('0x11')](_0x26639f));if(_0x26639f[_0xf652('0x12')]){if(_0x26639f[_0xf652('0x12')]['code']===0x1f4){logger[_0xf652('0x12')](_0xf652('0xf'),_0x47d1ed,_0x26639f[_0xf652('0x12')][_0xf652('0x13')]);return _0x2d8803(_0x26639f[_0xf652('0x12')][_0xf652('0x13')]);}logger[_0xf652('0x12')](_0xf652('0xf'),_0x47d1ed,_0x26639f[_0xf652('0x12')][_0xf652('0x13')]);return _0x53336e(_0x26639f[_0xf652('0x12')]['message']);}else{logger[_0xf652('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47d1ed,'request\x20sent');_0x53336e(_0x26639f[_0xf652('0x14')][_0xf652('0x13')]);}})[_0xf652('0x15')](function(_0x378f64){logger[_0xf652('0x12')](_0xf652('0xf'),_0x47d1ed,_0x378f64);_0x2d8803(_0x378f64);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ccd9721..a1c2311 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 _0x15c5=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/questions','getQuestions','post','create','put','update','destroy','exports','multer','util'];(function(_0x395f83,_0x564700){var _0x7ed58f=function(_0x150e19){while(--_0x150e19){_0x395f83['push'](_0x395f83['shift']());}};_0x7ed58f(++_0x564700);}(_0x15c5,0x1ca));var _0x515c=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x15c5[_0x2136d5];return _0x3bee2e;};'use strict';var multer=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var path=require('path');var timeout=require(_0x515c('0x2'));var express=require('express');var router=express[_0x515c('0x3')]();var fs_extra=require(_0x515c('0x4'));var auth=require(_0x515c('0x5'));var interaction=require(_0x515c('0x6'));var config=require(_0x515c('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x515c('0x8')]('/',auth[_0x515c('0x9')](),controller['index']);router[_0x515c('0x8')](_0x515c('0xa'),auth[_0x515c('0x9')](),controller['describe']);router[_0x515c('0x8')](_0x515c('0xb'),auth[_0x515c('0x9')](),controller['show']);router[_0x515c('0x8')](_0x515c('0xc'),auth['isAuthenticated'](),controller[_0x515c('0xd')]);router[_0x515c('0xe')]('/',auth['isAuthenticated'](),controller[_0x515c('0xf')]);router[_0x515c('0x10')](_0x515c('0xb'),auth[_0x515c('0x9')](),controller[_0x515c('0x11')]);router['delete'](_0x515c('0xb'),auth[_0x515c('0x9')](),controller[_0x515c('0x12')]);module[_0x515c('0x13')]=router; \ No newline at end of file +var _0x13da=['index','/describe','describe','show','/:id/questions','getQuestions','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x13da,0xcd));var _0xa13d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x13da[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xa13d('0x0'));var util=require(_0xa13d('0x1'));var path=require('path');var timeout=require(_0xa13d('0x2'));var express=require(_0xa13d('0x3'));var router=express[_0xa13d('0x4')]();var fs_extra=require(_0xa13d('0x5'));var auth=require(_0xa13d('0x6'));var interaction=require(_0xa13d('0x7'));var config=require(_0xa13d('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xa13d('0x9')]('/',auth[_0xa13d('0xa')](),controller[_0xa13d('0xb')]);router[_0xa13d('0x9')](_0xa13d('0xc'),auth[_0xa13d('0xa')](),controller[_0xa13d('0xd')]);router[_0xa13d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa13d('0xe')]);router['get'](_0xa13d('0xf'),auth[_0xa13d('0xa')](),controller[_0xa13d('0x10')]);router[_0xa13d('0x11')]('/',auth[_0xa13d('0xa')](),controller[_0xa13d('0x12')]);router['put'](_0xa13d('0x13'),auth['isAuthenticated'](),controller[_0xa13d('0x14')]);router[_0xa13d('0x15')](_0xa13d('0x13'),auth[_0xa13d('0xa')](),controller[_0xa13d('0x16')]);module[_0xa13d('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c544e5f..d5ca35a 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 _0x76c1=['DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x137211,_0x59045c){var _0x3d3842=function(_0x331d87){while(--_0x331d87){_0x137211['push'](_0x137211['shift']());}};_0x3d3842(++_0x59045c);}(_0x76c1,0x15b));var _0x176c=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x76c1[_0xa45395];return _0x3c83d2;};'use strict';var moment=require(_0x176c('0x0'));var Sequelize=require(_0x176c('0x1'));module[_0x176c('0x2')]={'starttime':{'type':Sequelize[_0x176c('0x3')],'set':function(_0x131f72){this[_0x176c('0x4')]('starttime',_0x131f72);this['setDataValue'](_0x176c('0x5'),moment()[_0x176c('0x6')](_0x176c('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x176c('0x8')]},'queue':{'type':Sequelize[_0x176c('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x176c('0x8')]},'calleridnum':{'type':Sequelize[_0x176c('0x8')]},'completed':{'type':Sequelize[_0x176c('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x74f7=['sequelize','exports','DATE','setDataValue','endtime','STRING','BOOLEAN','moment'];(function(_0x237c08,_0x1cc97a){var _0x93df98=function(_0x1aecf8){while(--_0x1aecf8){_0x237c08['push'](_0x237c08['shift']());}};_0x93df98(++_0x1cc97a);}(_0x74f7,0xa7));var _0x774f=function(_0x41f96e,_0x333851){_0x41f96e=_0x41f96e-0x0;var _0x48a4ac=_0x74f7[_0x41f96e];return _0x48a4ac;};'use strict';var moment=require(_0x774f('0x0'));var Sequelize=require(_0x774f('0x1'));module[_0x774f('0x2')]={'starttime':{'type':Sequelize[_0x774f('0x3')],'set':function(_0x4caca3){this[_0x774f('0x4')]('starttime',_0x4caca3);this[_0x774f('0x4')](_0x774f('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x774f('0x3')]},'membername':{'type':Sequelize[_0x774f('0x6')]},'projectname':{'type':Sequelize[_0x774f('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x774f('0x6')]},'calleridname':{'type':Sequelize[_0x774f('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x774f('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 160c25c..cfe159e 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 _0x1599=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','filter','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x237dc3,_0x13c775){var _0x2654a0=function(_0x38ad26){while(--_0x38ad26){_0x237dc3['push'](_0x237dc3['shift']());}};_0x2654a0(++_0x13c775);}(_0x1599,0x138));var _0x9159=function(_0x1f8cb3,_0x5b81d8){_0x1f8cb3=_0x1f8cb3-0x0;var _0x2428e2=_0x1599[_0x1f8cb3];return _0x2428e2;};'use strict';var emlformat=require(_0x9159('0x0'));var rimraf=require(_0x9159('0x1'));var zipdir=require(_0x9159('0x2'));var jsonpatch=require(_0x9159('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9159('0x4'));var Mustache=require(_0x9159('0x5'));var util=require(_0x9159('0x6'));var path=require(_0x9159('0x7'));var sox=require(_0x9159('0x8'));var csv=require(_0x9159('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9159('0xa'));var _=require('lodash');var squel=require(_0x9159('0xb'));var crypto=require(_0x9159('0xc'));var jsforce=require(_0x9159('0xd'));var deskjs=require(_0x9159('0xe'));var toCsv=require(_0x9159('0x9'));var querystring=require('querystring');var Papa=require(_0x9159('0xf'));var Redis=require(_0x9159('0x10'));var authService=require(_0x9159('0x11'));var qs=require(_0x9159('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9159('0x13'));var logger=require(_0x9159('0x14'))(_0x9159('0x15'));var utils=require(_0x9159('0x16'));var config=require(_0x9159('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9159('0x18'))['db'];function respondWithStatusCode(_0xcc5168,_0x5f000f){_0x5f000f=_0x5f000f||0xcc;return function(_0x37173e){if(_0x37173e){return _0xcc5168[_0x9159('0x19')](_0x5f000f);}return _0xcc5168[_0x9159('0x1a')](_0x5f000f)['end']();};}function respondWithResult(_0x26a73a,_0x12c72b){_0x12c72b=_0x12c72b||0xc8;return function(_0x4ba13f){if(_0x4ba13f){return _0x26a73a[_0x9159('0x1a')](_0x12c72b)[_0x9159('0x1b')](_0x4ba13f);}};}function respondWithFilteredResult(_0x3e4870,_0x3a58cc){return function(_0xf30e43){if(_0xf30e43){var _0x5a56d5=typeof _0x3a58cc[_0x9159('0x1c')]===_0x9159('0x1d')&&typeof _0x3a58cc[_0x9159('0x1e')]===_0x9159('0x1d');var _0x4513e9=_0xf30e43[_0x9159('0x1f')];var _0x5af88d=_0x5a56d5?0x0:_0x3a58cc[_0x9159('0x1c')];var _0x259988=_0x5a56d5?_0xf30e43[_0x9159('0x1f')]:_0x3a58cc[_0x9159('0x1c')]+_0x3a58cc[_0x9159('0x1e')];var _0x2afc45;if(_0x259988>=_0x4513e9){_0x259988=_0x4513e9;_0x2afc45=0xc8;}else{_0x2afc45=0xce;}_0x3e4870['status'](_0x2afc45);return _0x3e4870[_0x9159('0x20')](_0x9159('0x21'),_0x5af88d+'-'+_0x259988+'/'+_0x4513e9)[_0x9159('0x1b')](_0xf30e43);}return null;};}function patchUpdates(_0x1ba346){return function(_0x23efbe){try{jsonpatch['apply'](_0x23efbe,_0x1ba346,!![]);}catch(_0x5c5cf9){return BPromise[_0x9159('0x22')](_0x5c5cf9);}return _0x23efbe['save']();};}function saveUpdates(_0x1e2e88,_0x43670f){return function(_0x2594bc){if(_0x2594bc){return _0x2594bc[_0x9159('0x23')](_0x1e2e88)[_0x9159('0x24')](function(_0x5627ab){return _0x5627ab;});}return null;};}function removeEntity(_0x3b20f5,_0x42094a){return function(_0x2ba428){if(_0x2ba428){return _0x2ba428[_0x9159('0x25')]()[_0x9159('0x24')](function(){_0x3b20f5['status'](0xcc)[_0x9159('0x26')]();});}};}function handleEntityNotFound(_0xc0b363,_0x1794c8){return function(_0x32af2f){if(!_0x32af2f){_0xc0b363[_0x9159('0x19')](0x194);}return _0x32af2f;};}function handleError(_0x57644d,_0x1e762b){_0x1e762b=_0x1e762b||0x1f4;return function(_0x1b5018){logger[_0x9159('0x27')](_0x1b5018[_0x9159('0x28')]);if(_0x1b5018[_0x9159('0x29')]){delete _0x1b5018[_0x9159('0x29')];}_0x57644d[_0x9159('0x1a')](_0x1e762b)[_0x9159('0x2a')](_0x1b5018);};}exports[_0x9159('0x2b')]=function(_0xef86d3,_0x557819){var _0x958b64={},_0xf81af1={},_0x5860db={'count':0x0,'rows':[]};var _0x141a1d=_[_0x9159('0x2c')](db[_0x9159('0x2d')][_0x9159('0x2e')],function(_0x12cdf9){return{'name':_0x12cdf9[_0x9159('0x2f')],'type':_0x12cdf9[_0x9159('0x30')][_0x9159('0x31')]};});_0xf81af1[_0x9159('0x32')]=_[_0x9159('0x2c')](_0x141a1d,'name');_0xf81af1[_0x9159('0x33')]=_[_0x9159('0x34')](_0xef86d3[_0x9159('0x33')]);_0xf81af1['filters']=_['intersection'](_0xf81af1['model'],_0xf81af1[_0x9159('0x33')]);_0x958b64[_0x9159('0x35')]=_[_0x9159('0x36')](_0xf81af1[_0x9159('0x32')],qs[_0x9159('0x37')](_0xef86d3[_0x9159('0x33')][_0x9159('0x37')]));_0x958b64[_0x9159('0x35')]=_0x958b64['attributes'][_0x9159('0x38')]?_0x958b64[_0x9159('0x35')]:_0xf81af1[_0x9159('0x32')];if(!_0xef86d3[_0x9159('0x33')][_0x9159('0x39')](_0x9159('0x3a'))){_0x958b64['limit']=qs[_0x9159('0x1e')](_0xef86d3['query'][_0x9159('0x1e')]);_0x958b64['offset']=qs[_0x9159('0x1c')](_0xef86d3[_0x9159('0x33')][_0x9159('0x1c')]);}_0x958b64['order']=qs[_0x9159('0x3b')](_0xef86d3['query'][_0x9159('0x3b')]);_0x958b64['where']=qs[_0x9159('0x3c')](_[_0x9159('0x3d')](_0xef86d3[_0x9159('0x33')],_0xf81af1[_0x9159('0x3c')]),_0x141a1d);if(_0xef86d3[_0x9159('0x33')]['filter']){_0x958b64[_0x9159('0x3e')]=_[_0x9159('0x3f')](_0x958b64[_0x9159('0x3e')],{'$or':_['map'](_0x141a1d,function(_0x174fd0){if(_0x174fd0['type']!==_0x9159('0x40')){var _0x44c49f={};_0x44c49f[_0x174fd0['name']]={'$like':'%'+_0xef86d3[_0x9159('0x33')]['filter']+'%'};return _0x44c49f;}})});}_0x958b64=_[_0x9159('0x3f')]({},_0x958b64,_0xef86d3[_0x9159('0x41')]);var _0x1cbebe={'where':_0x958b64['where']};return db['JscriptySessionReport'][_0x9159('0x1f')](_0x1cbebe)[_0x9159('0x24')](function(_0x2915ff){_0x5860db[_0x9159('0x1f')]=_0x2915ff;if(_0xef86d3['query'][_0x9159('0x42')]){_0x958b64['include']=[{'all':!![]}];}return db[_0x9159('0x2d')][_0x9159('0x43')](_0x958b64);})[_0x9159('0x24')](function(_0x254014){_0x5860db[_0x9159('0x44')]=_0x254014;return _0x5860db;})[_0x9159('0x24')](respondWithFilteredResult(_0x557819,_0x958b64))[_0x9159('0x45')](handleError(_0x557819,null));};exports['show']=function(_0x38d4c6,_0x410dd1){var _0x4c3523={'raw':!![],'where':{'id':_0x38d4c6[_0x9159('0x46')]['id']}},_0x43a532={};_0x43a532[_0x9159('0x32')]=_[_0x9159('0x34')](db[_0x9159('0x2d')]['rawAttributes']);_0x43a532[_0x9159('0x33')]=_[_0x9159('0x34')](_0x38d4c6[_0x9159('0x33')]);_0x43a532[_0x9159('0x3c')]=_['intersection'](_0x43a532[_0x9159('0x32')],_0x43a532[_0x9159('0x33')]);_0x4c3523[_0x9159('0x35')]=_[_0x9159('0x36')](_0x43a532[_0x9159('0x32')],qs[_0x9159('0x37')](_0x38d4c6[_0x9159('0x33')][_0x9159('0x37')]));_0x4c3523[_0x9159('0x35')]=_0x4c3523[_0x9159('0x35')][_0x9159('0x38')]?_0x4c3523[_0x9159('0x35')]:_0x43a532['model'];if(_0x38d4c6['query'][_0x9159('0x42')]){_0x4c3523[_0x9159('0x47')]=[{'all':!![]}];}_0x4c3523=_[_0x9159('0x3f')]({},_0x4c3523,_0x38d4c6['options']);return db[_0x9159('0x2d')][_0x9159('0x48')](_0x4c3523)[_0x9159('0x24')](handleEntityNotFound(_0x410dd1,null))[_0x9159('0x24')](respondWithResult(_0x410dd1,null))['catch'](handleError(_0x410dd1,null));};exports[_0x9159('0x49')]=function(_0x49a2d8,_0x1ab9a4){return db[_0x9159('0x2d')]['create'](_0x49a2d8[_0x9159('0x4a')],{})[_0x9159('0x24')](respondWithResult(_0x1ab9a4,0xc9))[_0x9159('0x45')](handleError(_0x1ab9a4,null));};exports[_0x9159('0x23')]=function(_0x328ff9,_0x31e485){if(_0x328ff9[_0x9159('0x4a')]['id']){delete _0x328ff9['body']['id'];}return db[_0x9159('0x2d')][_0x9159('0x48')]({'where':{'id':_0x328ff9[_0x9159('0x46')]['id']}})[_0x9159('0x24')](handleEntityNotFound(_0x31e485,null))['then'](saveUpdates(_0x328ff9[_0x9159('0x4a')],null))['then'](respondWithResult(_0x31e485,null))['catch'](handleError(_0x31e485,null));};exports[_0x9159('0x25')]=function(_0x1cc469,_0x150fee){return db[_0x9159('0x2d')][_0x9159('0x48')]({'where':{'id':_0x1cc469[_0x9159('0x46')]['id']}})[_0x9159('0x24')](handleEntityNotFound(_0x150fee,null))[_0x9159('0x24')](removeEntity(_0x150fee,null))[_0x9159('0x45')](handleError(_0x150fee,null));};exports[_0x9159('0x4b')]=function(_0x4ff63e,_0xb6c518){return db[_0x9159('0x2d')][_0x9159('0x4b')]()[_0x9159('0x24')](respondWithResult(_0xb6c518,null))[_0x9159('0x45')](handleError(_0xb6c518,null));};exports[_0x9159('0x4c')]=function(_0x520f81,_0x32c317,_0x180ed6){var _0x160c0e={'raw':!![],'where':{}};var _0x1a8ee3={};var _0x286341={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x9159('0x4d')]({'where':{'id':_0x520f81[_0x9159('0x46')]['id']}})['then'](handleEntityNotFound(_0x32c317,null))[_0x9159('0x24')](function(_0x4ba884){if(_0x4ba884){_0x1a8ee3[_0x9159('0x32')]=_[_0x9159('0x34')](db[_0x9159('0x4e')][_0x9159('0x2e')]);_0x1a8ee3[_0x9159('0x33')]=_[_0x9159('0x34')](_0x520f81[_0x9159('0x33')]);_0x1a8ee3[_0x9159('0x3c')]=_[_0x9159('0x36')](_0x1a8ee3[_0x9159('0x32')],_0x1a8ee3[_0x9159('0x33')]);_0x160c0e['attributes']=_[_0x9159('0x36')](_0x1a8ee3[_0x9159('0x32')],qs['fields'](_0x520f81[_0x9159('0x33')]['fields']));_0x160c0e[_0x9159('0x35')]=_0x160c0e['attributes'][_0x9159('0x38')]?_0x160c0e['attributes']:_0x1a8ee3[_0x9159('0x32')];if(!_0x520f81[_0x9159('0x33')][_0x9159('0x39')]('nolimit')){_0x160c0e[_0x9159('0x1e')]=qs['limit'](_0x520f81[_0x9159('0x33')][_0x9159('0x1e')]);_0x160c0e[_0x9159('0x1c')]=qs['offset'](_0x520f81[_0x9159('0x33')][_0x9159('0x1c')]);}_0x160c0e[_0x9159('0x4f')]=qs['sort'](_0x520f81[_0x9159('0x33')][_0x9159('0x3b')]);_0x160c0e[_0x9159('0x3e')]=qs[_0x9159('0x3c')](_['pick'](_0x520f81[_0x9159('0x33')],_0x1a8ee3[_0x9159('0x3c')]));_0x160c0e['where']['SessionId']=_0x4ba884['id'];if(_0x520f81[_0x9159('0x33')][_0x9159('0x50')]){_0x160c0e[_0x9159('0x3e')]=_[_0x9159('0x3f')](_0x160c0e[_0x9159('0x3e')],{'$or':_['map'](_0x160c0e[_0x9159('0x35')],function(_0x99bb5a){var _0x3a6e52={};_0x3a6e52[_0x99bb5a]={'$like':'%'+_0x520f81['query'][_0x9159('0x50')]+'%'};return _0x3a6e52;})});}_0x160c0e=_[_0x9159('0x3f')]({},_0x160c0e,_0x520f81[_0x9159('0x41')]);return db[_0x9159('0x4e')][_0x9159('0x1f')]({'where':_0x160c0e[_0x9159('0x3e')]})[_0x9159('0x24')](function(_0x2d6b21){_0x286341[_0x9159('0x1f')]=_0x2d6b21;if(_0x520f81[_0x9159('0x33')][_0x9159('0x42')]){_0x160c0e['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9159('0x43')](_0x160c0e);})[_0x9159('0x24')](function(_0x754f7d){_0x286341['rows']=_0x754f7d;return _0x286341;});}})[_0x9159('0x24')](respondWithFilteredResult(_0x32c317,_0x160c0e))['catch'](handleError(_0x32c317,null));}; \ No newline at end of file +var _0x9a25=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','options','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1f9443,_0x5d6500){var _0x49f109=function(_0x5f4222){while(--_0x5f4222){_0x1f9443['push'](_0x1f9443['shift']());}};_0x49f109(++_0x5d6500);}(_0x9a25,0x1e4));var _0x59a2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9a25[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x59a2('0x0'));var rimraf=require(_0x59a2('0x1'));var zipdir=require(_0x59a2('0x2'));var jsonpatch=require(_0x59a2('0x3'));var rp=require(_0x59a2('0x4'));var moment=require(_0x59a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x59a2('0x6'));var path=require(_0x59a2('0x7'));var sox=require(_0x59a2('0x8'));var csv=require(_0x59a2('0x9'));var ejs=require(_0x59a2('0xa'));var fs=require('fs');var fs_extra=require(_0x59a2('0xb'));var _=require(_0x59a2('0xc'));var squel=require(_0x59a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x59a2('0xe'));var deskjs=require(_0x59a2('0xf'));var toCsv=require(_0x59a2('0x9'));var querystring=require(_0x59a2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x59a2('0x11'));var qs=require(_0x59a2('0x12'));var as=require(_0x59a2('0x13'));var hardwareService=require(_0x59a2('0x14'));var logger=require(_0x59a2('0x15'))(_0x59a2('0x16'));var utils=require(_0x59a2('0x17'));var config=require(_0x59a2('0x18'));var licenseUtil=require(_0x59a2('0x19'));var db=require(_0x59a2('0x1a'))['db'];function respondWithStatusCode(_0xb6893e,_0x2b0d67){_0x2b0d67=_0x2b0d67||0xcc;return function(_0x1c012a){if(_0x1c012a){return _0xb6893e[_0x59a2('0x1b')](_0x2b0d67);}return _0xb6893e[_0x59a2('0x1c')](_0x2b0d67)[_0x59a2('0x1d')]();};}function respondWithResult(_0x16a9eb,_0x354180){_0x354180=_0x354180||0xc8;return function(_0x5972f1){if(_0x5972f1){return _0x16a9eb['status'](_0x354180)['json'](_0x5972f1);}};}function respondWithFilteredResult(_0x539c77,_0x2d1d36){return function(_0x40444e){if(_0x40444e){var _0x2bc5f3=typeof _0x2d1d36['offset']==='undefined'&&typeof _0x2d1d36[_0x59a2('0x1e')]===_0x59a2('0x1f');var _0x1f1798=_0x40444e[_0x59a2('0x20')];var _0x4449c1=_0x2bc5f3?0x0:_0x2d1d36[_0x59a2('0x21')];var _0x5b0459=_0x2bc5f3?_0x40444e[_0x59a2('0x20')]:_0x2d1d36[_0x59a2('0x21')]+_0x2d1d36[_0x59a2('0x1e')];var _0x43bd1b;if(_0x5b0459>=_0x1f1798){_0x5b0459=_0x1f1798;_0x43bd1b=0xc8;}else{_0x43bd1b=0xce;}_0x539c77[_0x59a2('0x1c')](_0x43bd1b);return _0x539c77[_0x59a2('0x22')](_0x59a2('0x23'),_0x4449c1+'-'+_0x5b0459+'/'+_0x1f1798)['json'](_0x40444e);}return null;};}function patchUpdates(_0x1558a7){return function(_0x5a37e8){try{jsonpatch[_0x59a2('0x24')](_0x5a37e8,_0x1558a7,!![]);}catch(_0x226ff3){return BPromise[_0x59a2('0x25')](_0x226ff3);}return _0x5a37e8[_0x59a2('0x26')]();};}function saveUpdates(_0x2f3292,_0x362da0){return function(_0x1d6161){if(_0x1d6161){return _0x1d6161[_0x59a2('0x27')](_0x2f3292)[_0x59a2('0x28')](function(_0x4e9237){return _0x4e9237;});}return null;};}function removeEntity(_0xa6013a,_0x3be0f9){return function(_0x54f09d){if(_0x54f09d){return _0x54f09d[_0x59a2('0x29')]()['then'](function(){_0xa6013a[_0x59a2('0x1c')](0xcc)[_0x59a2('0x1d')]();});}};}function handleEntityNotFound(_0x5c037d,_0x48d99a){return function(_0x399950){if(!_0x399950){_0x5c037d[_0x59a2('0x1b')](0x194);}return _0x399950;};}function handleError(_0x35c0e1,_0xba792f){_0xba792f=_0xba792f||0x1f4;return function(_0x2da7d9){logger['error'](_0x2da7d9[_0x59a2('0x2a')]);if(_0x2da7d9[_0x59a2('0x2b')]){delete _0x2da7d9[_0x59a2('0x2b')];}_0x35c0e1['status'](_0xba792f)[_0x59a2('0x2c')](_0x2da7d9);};}exports[_0x59a2('0x2d')]=function(_0x5a74f5,_0x5e6d77){var _0x4f83da={},_0x1ea346={},_0x1b6713={'count':0x0,'rows':[]};var _0x666861=_[_0x59a2('0x2e')](db[_0x59a2('0x2f')][_0x59a2('0x30')],function(_0x1ca20e){return{'name':_0x1ca20e[_0x59a2('0x31')],'type':_0x1ca20e[_0x59a2('0x32')]['key']};});_0x1ea346[_0x59a2('0x33')]=_[_0x59a2('0x2e')](_0x666861,_0x59a2('0x2b'));_0x1ea346[_0x59a2('0x34')]=_['keys'](_0x5a74f5[_0x59a2('0x34')]);_0x1ea346[_0x59a2('0x35')]=_[_0x59a2('0x36')](_0x1ea346[_0x59a2('0x33')],_0x1ea346[_0x59a2('0x34')]);_0x4f83da[_0x59a2('0x37')]=_[_0x59a2('0x36')](_0x1ea346[_0x59a2('0x33')],qs[_0x59a2('0x38')](_0x5a74f5[_0x59a2('0x34')]['fields']));_0x4f83da[_0x59a2('0x37')]=_0x4f83da['attributes'][_0x59a2('0x39')]?_0x4f83da[_0x59a2('0x37')]:_0x1ea346[_0x59a2('0x33')];if(!_0x5a74f5[_0x59a2('0x34')][_0x59a2('0x3a')](_0x59a2('0x3b'))){_0x4f83da[_0x59a2('0x1e')]=qs['limit'](_0x5a74f5[_0x59a2('0x34')][_0x59a2('0x1e')]);_0x4f83da[_0x59a2('0x21')]=qs[_0x59a2('0x21')](_0x5a74f5['query']['offset']);}_0x4f83da[_0x59a2('0x3c')]=qs[_0x59a2('0x3d')](_0x5a74f5[_0x59a2('0x34')][_0x59a2('0x3d')]);_0x4f83da[_0x59a2('0x3e')]=qs[_0x59a2('0x35')](_[_0x59a2('0x3f')](_0x5a74f5[_0x59a2('0x34')],_0x1ea346['filters']),_0x666861);if(_0x5a74f5[_0x59a2('0x34')]['filter']){_0x4f83da['where']=_[_0x59a2('0x40')](_0x4f83da['where'],{'$or':_[_0x59a2('0x2e')](_0x666861,function(_0x154667){if(_0x154667[_0x59a2('0x32')]!==_0x59a2('0x41')){var _0x3a7c68={};_0x3a7c68[_0x154667[_0x59a2('0x2b')]]={'$like':'%'+_0x5a74f5[_0x59a2('0x34')][_0x59a2('0x42')]+'%'};return _0x3a7c68;}})});}_0x4f83da=_[_0x59a2('0x40')]({},_0x4f83da,_0x5a74f5['options']);var _0x16ee06={'where':_0x4f83da[_0x59a2('0x3e')]};return db['JscriptySessionReport'][_0x59a2('0x20')](_0x16ee06)[_0x59a2('0x28')](function(_0x6c2fc9){_0x1b6713[_0x59a2('0x20')]=_0x6c2fc9;if(_0x5a74f5[_0x59a2('0x34')]['includeAll']){_0x4f83da[_0x59a2('0x43')]=[{'all':!![]}];}return db[_0x59a2('0x2f')][_0x59a2('0x44')](_0x4f83da);})[_0x59a2('0x28')](function(_0x17ee25){_0x1b6713[_0x59a2('0x45')]=_0x17ee25;return _0x1b6713;})[_0x59a2('0x28')](respondWithFilteredResult(_0x5e6d77,_0x4f83da))[_0x59a2('0x46')](handleError(_0x5e6d77,null));};exports[_0x59a2('0x47')]=function(_0x152266,_0x47368c){var _0x361397={'raw':!![],'where':{'id':_0x152266[_0x59a2('0x48')]['id']}},_0x316c30={};_0x316c30[_0x59a2('0x33')]=_[_0x59a2('0x49')](db[_0x59a2('0x2f')][_0x59a2('0x30')]);_0x316c30[_0x59a2('0x34')]=_[_0x59a2('0x49')](_0x152266[_0x59a2('0x34')]);_0x316c30[_0x59a2('0x35')]=_[_0x59a2('0x36')](_0x316c30[_0x59a2('0x33')],_0x316c30[_0x59a2('0x34')]);_0x361397[_0x59a2('0x37')]=_['intersection'](_0x316c30['model'],qs[_0x59a2('0x38')](_0x152266[_0x59a2('0x34')][_0x59a2('0x38')]));_0x361397['attributes']=_0x361397['attributes'][_0x59a2('0x39')]?_0x361397[_0x59a2('0x37')]:_0x316c30[_0x59a2('0x33')];if(_0x152266[_0x59a2('0x34')]['includeAll']){_0x361397[_0x59a2('0x43')]=[{'all':!![]}];}_0x361397=_[_0x59a2('0x40')]({},_0x361397,_0x152266['options']);return db[_0x59a2('0x2f')]['find'](_0x361397)['then'](handleEntityNotFound(_0x47368c,null))[_0x59a2('0x28')](respondWithResult(_0x47368c,null))[_0x59a2('0x46')](handleError(_0x47368c,null));};exports['create']=function(_0x2f62ba,_0x9bfd6f){return db['JscriptySessionReport'][_0x59a2('0x4a')](_0x2f62ba[_0x59a2('0x4b')],{})[_0x59a2('0x28')](respondWithResult(_0x9bfd6f,0xc9))[_0x59a2('0x46')](handleError(_0x9bfd6f,null));};exports[_0x59a2('0x27')]=function(_0x205bdf,_0x58bd68){if(_0x205bdf[_0x59a2('0x4b')]['id']){delete _0x205bdf[_0x59a2('0x4b')]['id'];}return db[_0x59a2('0x2f')][_0x59a2('0x4c')]({'where':{'id':_0x205bdf[_0x59a2('0x48')]['id']}})[_0x59a2('0x28')](handleEntityNotFound(_0x58bd68,null))[_0x59a2('0x28')](saveUpdates(_0x205bdf[_0x59a2('0x4b')],null))['then'](respondWithResult(_0x58bd68,null))[_0x59a2('0x46')](handleError(_0x58bd68,null));};exports[_0x59a2('0x29')]=function(_0x2fc040,_0x10d59a){return db[_0x59a2('0x2f')]['find']({'where':{'id':_0x2fc040[_0x59a2('0x48')]['id']}})[_0x59a2('0x28')](handleEntityNotFound(_0x10d59a,null))[_0x59a2('0x28')](removeEntity(_0x10d59a,null))[_0x59a2('0x46')](handleError(_0x10d59a,null));};exports[_0x59a2('0x4d')]=function(_0xa56e8d,_0xc24cb7){return db[_0x59a2('0x2f')][_0x59a2('0x4d')]()[_0x59a2('0x28')](respondWithResult(_0xc24cb7,null))['catch'](handleError(_0xc24cb7,null));};exports[_0x59a2('0x4e')]=function(_0x3e4f6b,_0x46b19e,_0x42b844){var _0x323421={'raw':!![],'where':{}};var _0x19bc6f={};var _0xae7159={'count':0x0,'rows':[]};return db[_0x59a2('0x2f')][_0x59a2('0x4f')]({'where':{'id':_0x3e4f6b[_0x59a2('0x48')]['id']}})[_0x59a2('0x28')](handleEntityNotFound(_0x46b19e,null))[_0x59a2('0x28')](function(_0x41b686){if(_0x41b686){_0x19bc6f[_0x59a2('0x33')]=_[_0x59a2('0x49')](db[_0x59a2('0x50')][_0x59a2('0x30')]);_0x19bc6f[_0x59a2('0x34')]=_[_0x59a2('0x49')](_0x3e4f6b[_0x59a2('0x34')]);_0x19bc6f['filters']=_[_0x59a2('0x36')](_0x19bc6f[_0x59a2('0x33')],_0x19bc6f[_0x59a2('0x34')]);_0x323421['attributes']=_[_0x59a2('0x36')](_0x19bc6f[_0x59a2('0x33')],qs[_0x59a2('0x38')](_0x3e4f6b['query'][_0x59a2('0x38')]));_0x323421[_0x59a2('0x37')]=_0x323421[_0x59a2('0x37')][_0x59a2('0x39')]?_0x323421[_0x59a2('0x37')]:_0x19bc6f[_0x59a2('0x33')];if(!_0x3e4f6b[_0x59a2('0x34')][_0x59a2('0x3a')](_0x59a2('0x3b'))){_0x323421[_0x59a2('0x1e')]=qs['limit'](_0x3e4f6b[_0x59a2('0x34')]['limit']);_0x323421[_0x59a2('0x21')]=qs[_0x59a2('0x21')](_0x3e4f6b['query'][_0x59a2('0x21')]);}_0x323421['order']=qs['sort'](_0x3e4f6b[_0x59a2('0x34')]['sort']);_0x323421[_0x59a2('0x3e')]=qs[_0x59a2('0x35')](_[_0x59a2('0x3f')](_0x3e4f6b[_0x59a2('0x34')],_0x19bc6f[_0x59a2('0x35')]));_0x323421[_0x59a2('0x3e')][_0x59a2('0x51')]=_0x41b686['id'];if(_0x3e4f6b[_0x59a2('0x34')][_0x59a2('0x42')]){_0x323421[_0x59a2('0x3e')]=_[_0x59a2('0x40')](_0x323421[_0x59a2('0x3e')],{'$or':_[_0x59a2('0x2e')](_0x323421[_0x59a2('0x37')],function(_0x4edfed){var _0x23bfb5={};_0x23bfb5[_0x4edfed]={'$like':'%'+_0x3e4f6b[_0x59a2('0x34')][_0x59a2('0x42')]+'%'};return _0x23bfb5;})});}_0x323421=_[_0x59a2('0x40')]({},_0x323421,_0x3e4f6b[_0x59a2('0x52')]);return db[_0x59a2('0x50')][_0x59a2('0x20')]({'where':_0x323421[_0x59a2('0x3e')]})[_0x59a2('0x28')](function(_0x18cddd){_0xae7159[_0x59a2('0x20')]=_0x18cddd;if(_0x3e4f6b[_0x59a2('0x34')][_0x59a2('0x53')]){_0x323421[_0x59a2('0x43')]=[{'all':!![]}];}return db[_0x59a2('0x50')][_0x59a2('0x44')](_0x323421);})[_0x59a2('0x28')](function(_0x1c42e4){_0xae7159[_0x59a2('0x45')]=_0x1c42e4;return _0xae7159;});}})[_0x59a2('0x28')](respondWithFilteredResult(_0x46b19e,_0x323421))[_0x59a2('0x46')](handleError(_0x46b19e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 378cd46..a1697c7 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 _0x326f=['report_jscripty_sessions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x5c9830,_0x30841d){var _0x407512=function(_0x9b5f18){while(--_0x9b5f18){_0x5c9830['push'](_0x5c9830['shift']());}};_0x407512(++_0x30841d);}(_0x326f,0xd1));var _0xf326=function(_0x40db5b,_0x23dcc5){_0x40db5b=_0x40db5b-0x0;var _0x39625b=_0x326f[_0x40db5b];return _0x39625b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions'];(function(_0x1f1647,_0xc6e878){var _0x5ce694=function(_0x234498){while(--_0x234498){_0x1f1647['push'](_0x1f1647['shift']());}};_0x5ce694(++_0xc6e878);}(_0x1261,0x144));var _0x1126=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0x1261[_0x137f1a];return _0x439923;};'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')]('JscriptySessionReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index a931a0a..8c38875 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x517c4c,_0x5ee263){var _0x5a403e=function(_0x35f80d){while(--_0x35f80d){_0x517c4c['push'](_0x517c4c['shift']());}};_0x5a403e(++_0x5ee263);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc90640,_0xde1f30){_0xc90640=_0xc90640-0x0;var _0x35ae81=_0x5f2f[_0xc90640];return _0x35ae81;};'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')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x2d72=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','JscriptySessionReport,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x123b81,_0x4069c1){var _0x5c9150=function(_0x1e10ae){while(--_0x1e10ae){_0x123b81['push'](_0x123b81['shift']());}};_0x5c9150(++_0x4069c1);}(_0x2d72,0xa8));var _0x22d7=function(_0x3b77bb,_0x11f7ec){_0x3b77bb=_0x3b77bb-0x0;var _0x23e0f5=_0x2d72[_0x3b77bb];return _0x23e0f5;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52a3e3,_0x23a731,_0x3791d6){return new BPromise(function(_0x492ca8,_0x3b12cd){return client[_0x22d7('0xe')](_0x52a3e3,_0x3791d6)[_0x22d7('0xf')](function(_0x3c694f){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x23a731,_0x22d7('0x10'));logger[_0x22d7('0x11')](_0x22d7('0x12'),_0x23a731,_0x22d7('0x10'),JSON[_0x22d7('0x13')](_0x3c694f));if(_0x3c694f['error']){if(_0x3c694f['error'][_0x22d7('0x14')]===0x1f4){logger['error'](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')]['message']);return _0x3b12cd(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);return _0x492ca8(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}else{logger['info'](_0x22d7('0x15'),_0x23a731,_0x22d7('0x10'));_0x492ca8(_0x3c694f[_0x22d7('0x18')]['message']);}})['catch'](function(_0x52b21c){logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x52b21c);_0x3b12cd(_0x52b21c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index abe269d..ae87573 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 _0xda59=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file'];(function(_0xb45498,_0x50295a){var _0x4e1885=function(_0x11c1f6){while(--_0x11c1f6){_0xb45498['push'](_0xb45498['shift']());}};_0x4e1885(++_0x50295a);}(_0xda59,0x1e0));var _0x9da5=function(_0x183481,_0x20511a){_0x183481=_0x183481-0x0;var _0x2b102d=_0xda59[_0x183481];return _0x2b102d;};'use strict';var multer=require(_0x9da5('0x0'));var util=require(_0x9da5('0x1'));var path=require(_0x9da5('0x2'));var timeout=require(_0x9da5('0x3'));var express=require(_0x9da5('0x4'));var router=express[_0x9da5('0x5')]();var fs_extra=require(_0x9da5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9da5('0x7'));var controller=require(_0x9da5('0x8'));router[_0x9da5('0x9')]('/',controller[_0x9da5('0xa')]);router[_0x9da5('0xb')](_0x9da5('0xc'),auth[_0x9da5('0xd')](),controller[_0x9da5('0xe')]);router['get'](_0x9da5('0xf'),auth[_0x9da5('0xd')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file +var _0x92ab=['path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util'];(function(_0x366bf8,_0x44ed87){var _0x3bb18e=function(_0x422357){while(--_0x422357){_0x366bf8['push'](_0x366bf8['shift']());}};_0x3bb18e(++_0x44ed87);}(_0x92ab,0x1a3));var _0xb92a=function(_0x4c52b0,_0x18da1f){_0x4c52b0=_0x4c52b0-0x0;var _0x4abb5f=_0x92ab[_0x4c52b0];return _0x4abb5f;};'use strict';var multer=require('multer');var util=require(_0xb92a('0x0'));var path=require(_0xb92a('0x1'));var timeout=require(_0xb92a('0x2'));var express=require(_0xb92a('0x3'));var router=express['Router']();var fs_extra=require(_0xb92a('0x4'));var auth=require(_0xb92a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0xb92a('0x6')]('/',controller[_0xb92a('0x7')]);router['put'](_0xb92a('0x8'),auth[_0xb92a('0x9')](),controller[_0xb92a('0xa')]);router['get'](_0xb92a('0xb'),auth[_0xb92a('0x9')](),controller[_0xb92a('0xc')]);module[_0xb92a('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 253e7ce..35b0456 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 _0x7ed5=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0x7ed5,0x143));var _0x57ed=function(_0x553451,_0x4a3c70){_0x553451=_0x553451-0x0;var _0x37d836=_0x7ed5[_0x553451];return _0x37d836;};'use strict';var Sequelize=require(_0x57ed('0x0'));module[_0x57ed('0x1')]={'license':{'type':Sequelize[_0x57ed('0x2')]},'data1':{'type':Sequelize[_0x57ed('0x3')]},'data2':{'type':Sequelize[_0x57ed('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x57ed('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x039d=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x32fe1d,_0x27756a){var _0xfd8ec9=function(_0x1b47ba){while(--_0x1b47ba){_0x32fe1d['push'](_0x32fe1d['shift']());}};_0xfd8ec9(++_0x27756a);}(_0x039d,0xf4));var _0xd039=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x039d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd039('0x0'));module[_0xd039('0x1')]={'license':{'type':Sequelize[_0xd039('0x2')]},'data1':{'type':Sequelize[_0xd039('0x3')]},'data2':{'type':Sequelize[_0xd039('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xd039('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a253436..da123b7 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 _0xe82d=['/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','filters','model','attributes','intersection','fields','merge','options','getLicense','catch','body','find','params','get','key','downloadLogFile','license-info.log','join'];(function(_0x532329,_0x4fdea2){var _0x3e1b20=function(_0x10b325){while(--_0x10b325){_0x532329['push'](_0x532329['shift']());}};_0x3e1b20(++_0x4fdea2);}(_0xe82d,0x1be));var _0xde82=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe82d[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0xde82('0x0'));var rimraf=require(_0xde82('0x1'));var zipdir=require(_0xde82('0x2'));var jsonpatch=require(_0xde82('0x3'));var rp=require(_0xde82('0x4'));var moment=require(_0xde82('0x5'));var BPromise=require(_0xde82('0x6'));var Mustache=require(_0xde82('0x7'));var util=require(_0xde82('0x8'));var path=require(_0xde82('0x9'));var sox=require(_0xde82('0xa'));var csv=require(_0xde82('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde82('0xc'));var _=require(_0xde82('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xde82('0xe'));var deskjs=require(_0xde82('0xf'));var toCsv=require(_0xde82('0xb'));var querystring=require('querystring');var Papa=require(_0xde82('0x10'));var Redis=require(_0xde82('0x11'));var authService=require(_0xde82('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde82('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde82('0x14'))(_0xde82('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xde82('0x16'));var db=require(_0xde82('0x17'))['db'];function respondWithStatusCode(_0x8aa91a,_0x3b92cd){_0x3b92cd=_0x3b92cd||0xcc;return function(_0x5e0b66){if(_0x5e0b66){return _0x8aa91a[_0xde82('0x18')](_0x3b92cd);}return _0x8aa91a[_0xde82('0x19')](_0x3b92cd)[_0xde82('0x1a')]();};}function respondWithResult(_0x2b83a4,_0x479fda){_0x479fda=_0x479fda||0xc8;return function(_0x19a918){if(_0x19a918){return _0x2b83a4[_0xde82('0x19')](_0x479fda)[_0xde82('0x1b')](_0x19a918);}};}function respondWithFilteredResult(_0x297c93,_0x426f29){return function(_0x137261){if(_0x137261){var _0x2254f1=typeof _0x426f29['offset']==='undefined'&&typeof _0x426f29[_0xde82('0x1c')]===_0xde82('0x1d');var _0x3037fa=_0x137261[_0xde82('0x1e')];var _0xe142bd=_0x2254f1?0x0:_0x426f29[_0xde82('0x1f')];var _0xe75374=_0x2254f1?_0x137261[_0xde82('0x1e')]:_0x426f29[_0xde82('0x1f')]+_0x426f29['limit'];var _0x515a73;if(_0xe75374>=_0x3037fa){_0xe75374=_0x3037fa;_0x515a73=0xc8;}else{_0x515a73=0xce;}_0x297c93['status'](_0x515a73);return _0x297c93[_0xde82('0x20')](_0xde82('0x21'),_0xe142bd+'-'+_0xe75374+'/'+_0x3037fa)[_0xde82('0x1b')](_0x137261);}return null;};}function patchUpdates(_0x395a2b){return function(_0x2c346f){try{jsonpatch[_0xde82('0x22')](_0x2c346f,_0x395a2b,!![]);}catch(_0x98604e){return BPromise['reject'](_0x98604e);}return _0x2c346f[_0xde82('0x23')]();};}function saveUpdates(_0x2d8399,_0x232d28){return function(_0x2d588a){if(_0x2d588a){return _0x2d588a[_0xde82('0x24')](_0x2d8399)[_0xde82('0x25')](function(_0x9fbf6d){return _0x9fbf6d;});}return null;};}function removeEntity(_0xc2193f,_0x162044){return function(_0x4bf33f){if(_0x4bf33f){return _0x4bf33f[_0xde82('0x26')]()[_0xde82('0x25')](function(){_0xc2193f[_0xde82('0x19')](0xcc)[_0xde82('0x1a')]();});}};}function handleEntityNotFound(_0x47cee0,_0x15f0d4){return function(_0x135e27){if(!_0x135e27){_0x47cee0[_0xde82('0x18')](0x194);}return _0x135e27;};}function handleError(_0xa157b1,_0x25aaa5){_0x25aaa5=_0x25aaa5||0x1f4;return function(_0x1ff068){logger[_0xde82('0x27')](_0x1ff068[_0xde82('0x28')]);if(_0x1ff068[_0xde82('0x29')]){delete _0x1ff068[_0xde82('0x29')];}_0xa157b1[_0xde82('0x19')](_0x25aaa5)[_0xde82('0x2a')](_0x1ff068);};}var utilLicense=require(_0xde82('0x16'));exports[_0xde82('0x2b')]=function(_0x4e8d7a,_0x1fff0e){var _0x4a9c1b={'raw':!![],'where':{'id':0x1}},_0x31e727={};_0x31e727['model']=_[_0xde82('0x2c')](db[_0xde82('0x2d')][_0xde82('0x2e')]);_0x31e727['query']=_['keys'](_0x4e8d7a[_0xde82('0x2f')]);_0x31e727[_0xde82('0x30')]=_['intersection'](_0x31e727[_0xde82('0x31')],_0x31e727[_0xde82('0x2f')]);_0x4a9c1b[_0xde82('0x32')]=_[_0xde82('0x33')](_0x31e727[_0xde82('0x31')],qs[_0xde82('0x34')](_0x4e8d7a[_0xde82('0x2f')][_0xde82('0x34')]));_0x4a9c1b[_0xde82('0x32')]=_0x4a9c1b[_0xde82('0x32')]['length']?_0x4a9c1b[_0xde82('0x32')]:_0x31e727[_0xde82('0x31')];_0x4a9c1b=_[_0xde82('0x35')]({},_0x4a9c1b,_0x4e8d7a[_0xde82('0x36')]);return utilLicense[_0xde82('0x37')](_0x4a9c1b)[_0xde82('0x25')](respondWithResult(_0x1fff0e,null))[_0xde82('0x38')](handleError(_0x1fff0e,null));};exports[_0xde82('0x24')]=function(_0x24de22,_0x5e2a15){if(_0x24de22[_0xde82('0x39')]['id']){delete _0x24de22[_0xde82('0x39')]['id'];}return db['License'][_0xde82('0x3a')]({'where':{'id':_0x24de22[_0xde82('0x3b')]['id']}})[_0xde82('0x25')](handleEntityNotFound(_0x5e2a15,null))['then'](function(_0x2c5166){var _0xa23589=_0x2c5166[_0xde82('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0xa23589,_0x24de22[_0xde82('0x39')][_0xde82('0x3d')]);})[_0xde82('0x25')](function(_0x15eb03){if(!_0x15eb03['demo']){return saveUpdates(_0x24de22['body'],null);}return _0x15eb03;})['then'](respondWithResult(_0x5e2a15,null))[_0xde82('0x38')](handleError(_0x5e2a15,null));};exports[_0xde82('0x3e')]=function(_0x467ea6,_0x27466d){var _0x1ba724=_0xde82('0x3f');var _0x2a050f=path[_0xde82('0x40')](_0xde82('0x41'),'log',_0xde82('0x42'),_0x1ba724);_0x27466d[_0xde82('0x43')](_0xde82('0x44'),_0xde82('0x45')+_0x1ba724);_0x27466d[_0xde82('0x20')](_0xde82('0x46'),_0xde82('0x47'));_0x27466d[_0xde82('0x48')](_0x2a050f);}; \ No newline at end of file +var _0xf69a=['offset','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','license-info.log','join','/var','xcally','setHeader','attachment;\x20filename=','Content-Type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xf69a,0x72));var _0xaf69=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0xf69a[_0x19ae7a];return _0x30d82e;};'use strict';var emlformat=require(_0xaf69('0x0'));var rimraf=require(_0xaf69('0x1'));var zipdir=require(_0xaf69('0x2'));var jsonpatch=require(_0xaf69('0x3'));var rp=require(_0xaf69('0x4'));var moment=require(_0xaf69('0x5'));var BPromise=require(_0xaf69('0x6'));var Mustache=require('mustache');var util=require(_0xaf69('0x7'));var path=require(_0xaf69('0x8'));var sox=require(_0xaf69('0x9'));var csv=require(_0xaf69('0xa'));var ejs=require(_0xaf69('0xb'));var fs=require('fs');var fs_extra=require(_0xaf69('0xc'));var _=require(_0xaf69('0xd'));var squel=require(_0xaf69('0xe'));var crypto=require('crypto');var jsforce=require(_0xaf69('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaf69('0xa'));var querystring=require(_0xaf69('0x10'));var Papa=require(_0xaf69('0x11'));var Redis=require('ioredis');var authService=require(_0xaf69('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaf69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf69('0x14'))(_0xaf69('0x15'));var utils=require(_0xaf69('0x16'));var config=require(_0xaf69('0x17'));var licenseUtil=require(_0xaf69('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dedf3,_0x3be491){_0x3be491=_0x3be491||0xcc;return function(_0x42dda1){if(_0x42dda1){return _0x5dedf3['sendStatus'](_0x3be491);}return _0x5dedf3[_0xaf69('0x19')](_0x3be491)[_0xaf69('0x1a')]();};}function respondWithResult(_0x19c204,_0x46edd1){_0x46edd1=_0x46edd1||0xc8;return function(_0x33e260){if(_0x33e260){return _0x19c204[_0xaf69('0x19')](_0x46edd1)['json'](_0x33e260);}};}function respondWithFilteredResult(_0x2767a4,_0x2b943c){return function(_0x520dce){if(_0x520dce){var _0x3a1aaf=typeof _0x2b943c['offset']===_0xaf69('0x1b')&&typeof _0x2b943c[_0xaf69('0x1c')]===_0xaf69('0x1b');var _0x34e7e7=_0x520dce[_0xaf69('0x1d')];var _0x24b140=_0x3a1aaf?0x0:_0x2b943c[_0xaf69('0x1e')];var _0x578025=_0x3a1aaf?_0x520dce[_0xaf69('0x1d')]:_0x2b943c[_0xaf69('0x1e')]+_0x2b943c[_0xaf69('0x1c')];var _0x345730;if(_0x578025>=_0x34e7e7){_0x578025=_0x34e7e7;_0x345730=0xc8;}else{_0x345730=0xce;}_0x2767a4[_0xaf69('0x19')](_0x345730);return _0x2767a4[_0xaf69('0x1f')]('Content-Range',_0x24b140+'-'+_0x578025+'/'+_0x34e7e7)[_0xaf69('0x20')](_0x520dce);}return null;};}function patchUpdates(_0x10c7a6){return function(_0x215ae7){try{jsonpatch[_0xaf69('0x21')](_0x215ae7,_0x10c7a6,!![]);}catch(_0x2f4926){return BPromise[_0xaf69('0x22')](_0x2f4926);}return _0x215ae7[_0xaf69('0x23')]();};}function saveUpdates(_0x2add49,_0x5ef9da){return function(_0x2034e1){if(_0x2034e1){return _0x2034e1[_0xaf69('0x24')](_0x2add49)[_0xaf69('0x25')](function(_0xf8fa3f){return _0xf8fa3f;});}return null;};}function removeEntity(_0x5dfbb6,_0x4ddf74){return function(_0x4baeae){if(_0x4baeae){return _0x4baeae[_0xaf69('0x26')]()[_0xaf69('0x25')](function(){_0x5dfbb6[_0xaf69('0x19')](0xcc)[_0xaf69('0x1a')]();});}};}function handleEntityNotFound(_0x2e08f0,_0x1627b9){return function(_0x5941e4){if(!_0x5941e4){_0x2e08f0[_0xaf69('0x27')](0x194);}return _0x5941e4;};}function handleError(_0x30b13d,_0x42667b){_0x42667b=_0x42667b||0x1f4;return function(_0x1528fb){logger[_0xaf69('0x28')](_0x1528fb['stack']);if(_0x1528fb[_0xaf69('0x29')]){delete _0x1528fb[_0xaf69('0x29')];}_0x30b13d[_0xaf69('0x19')](_0x42667b)[_0xaf69('0x2a')](_0x1528fb);};}var utilLicense=require('../../config/license/util');exports[_0xaf69('0x2b')]=function(_0x14ca83,_0x27c33a){var _0x3b30fe={'raw':!![],'where':{'id':0x1}},_0x15a867={};_0x15a867['model']=_[_0xaf69('0x2c')](db[_0xaf69('0x2d')][_0xaf69('0x2e')]);_0x15a867[_0xaf69('0x2f')]=_['keys'](_0x14ca83[_0xaf69('0x2f')]);_0x15a867[_0xaf69('0x30')]=_[_0xaf69('0x31')](_0x15a867[_0xaf69('0x32')],_0x15a867[_0xaf69('0x2f')]);_0x3b30fe[_0xaf69('0x33')]=_[_0xaf69('0x31')](_0x15a867[_0xaf69('0x32')],qs[_0xaf69('0x34')](_0x14ca83[_0xaf69('0x2f')][_0xaf69('0x34')]));_0x3b30fe[_0xaf69('0x33')]=_0x3b30fe[_0xaf69('0x33')][_0xaf69('0x35')]?_0x3b30fe[_0xaf69('0x33')]:_0x15a867[_0xaf69('0x32')];_0x3b30fe=_[_0xaf69('0x36')]({},_0x3b30fe,_0x14ca83[_0xaf69('0x37')]);return utilLicense[_0xaf69('0x38')](_0x3b30fe)[_0xaf69('0x25')](respondWithResult(_0x27c33a,null))[_0xaf69('0x39')](handleError(_0x27c33a,null));};exports[_0xaf69('0x24')]=function(_0x8cb763,_0x1f39ba){if(_0x8cb763['body']['id']){delete _0x8cb763[_0xaf69('0x3a')]['id'];}return db[_0xaf69('0x2d')][_0xaf69('0x3b')]({'where':{'id':_0x8cb763[_0xaf69('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1f39ba,null))[_0xaf69('0x25')](function(_0x556a70){var _0x56dcab=_0x556a70[_0xaf69('0x3d')]({'plain':!![]});return utilLicense[_0xaf69('0x3e')](_0x56dcab,_0x8cb763[_0xaf69('0x3a')][_0xaf69('0x3f')]);})['then'](function(_0x223cd2){if(!_0x223cd2[_0xaf69('0x40')]){return saveUpdates(_0x8cb763[_0xaf69('0x3a')],null);}return _0x223cd2;})[_0xaf69('0x25')](respondWithResult(_0x1f39ba,null))[_0xaf69('0x39')](handleError(_0x1f39ba,null));};exports['downloadLogFile']=function(_0x2b0c42,_0x5619cf){var _0x390e2d=_0xaf69('0x41');var _0x5c5a9c=path[_0xaf69('0x42')](_0xaf69('0x43'),'log',_0xaf69('0x44'),_0x390e2d);_0x5619cf[_0xaf69('0x45')]('Content-disposition',_0xaf69('0x46')+_0x390e2d);_0x5619cf[_0xaf69('0x1f')](_0xaf69('0x47'),'text/plain');_0x5619cf['download'](_0x5c5a9c);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index bd03b0a..c489b3b 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 _0x4634=['moment','request-promise','path','rimraf','./license.attributes','exports','define','License','license','lodash','util','api'];(function(_0x53e4e9,_0x42fef9){var _0x4fffc1=function(_0x1a5ccc){while(--_0x1a5ccc){_0x53e4e9['push'](_0x53e4e9['shift']());}};_0x4fffc1(++_0x42fef9);}(_0x4634,0x81));var _0x4463=function(_0x2e272d,_0x5ec8f7){_0x2e272d=_0x2e272d-0x0;var _0x1a9ea9=_0x4634[_0x2e272d];return _0x1a9ea9;};'use strict';var _=require(_0x4463('0x0'));var util=require(_0x4463('0x1'));var logger=require('../../config/logger')(_0x4463('0x2'));var moment=require(_0x4463('0x3'));var BPromise=require('bluebird');var rp=require(_0x4463('0x4'));var fs=require('fs');var path=require(_0x4463('0x5'));var rimraf=require(_0x4463('0x6'));var config=require('../../config/environment');var attributes=require(_0x4463('0x7'));module[_0x4463('0x8')]=function(_0x3e81ba,_0x27a4a0){return _0x3e81ba[_0x4463('0x9')](_0x4463('0xa'),attributes,{'tableName':_0x4463('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x308f=['lodash','util','api','bluebird','path','rimraf','../../config/environment','./license.attributes'];(function(_0x466783,_0x559750){var _0xe3828a=function(_0x10c710){while(--_0x10c710){_0x466783['push'](_0x466783['shift']());}};_0xe3828a(++_0x559750);}(_0x308f,0x188));var _0xf308=function(_0x46d76e,_0x3fd687){_0x46d76e=_0x46d76e-0x0;var _0x41a1f9=_0x308f[_0x46d76e];return _0x41a1f9;};'use strict';var _=require(_0xf308('0x0'));var util=require(_0xf308('0x1'));var logger=require('../../config/logger')(_0xf308('0x2'));var moment=require('moment');var BPromise=require(_0xf308('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf308('0x4'));var rimraf=require(_0xf308('0x5'));var config=require(_0xf308('0x6'));var attributes=require(_0xf308('0x7'));module['exports']=function(_0x543025,_0x3b360f){return _0x543025['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index e34b4f3..cf103f6 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 _0x45b3=['request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x179ad2,_0x586860){var _0xa8c1c=function(_0x1d483f){while(--_0x1d483f){_0x179ad2['push'](_0x179ad2['shift']());}};_0xa8c1c(++_0x586860);}(_0x45b3,0x1e1));var _0x345b=function(_0x53af8d,_0x577e1a){_0x53af8d=_0x53af8d-0x0;var _0x5548cc=_0x45b3[_0x53af8d];return _0x5548cc;};'use strict';var _=require(_0x345b('0x0'));var util=require(_0x345b('0x1'));var moment=require(_0x345b('0x2'));var BPromise=require(_0x345b('0x3'));var rs=require(_0x345b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x345b('0x5'))['db'];var utils=require(_0x345b('0x6'));var logger=require(_0x345b('0x7'))(_0x345b('0x8'));var config=require(_0x345b('0x9'));var jayson=require(_0x345b('0xa'));var client=jayson[_0x345b('0xb')][_0x345b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3048d1,_0xf7689e,_0x48e803){return new BPromise(function(_0x1c113e,_0xb372e3){return client[_0x345b('0xd')](_0x3048d1,_0x48e803)[_0x345b('0xe')](function(_0x16d9ea){logger[_0x345b('0xf')]('License,\x20%s,\x20%s',_0xf7689e,_0x345b('0x10'));logger[_0x345b('0x11')](_0x345b('0x12'),_0xf7689e,_0x345b('0x10'),JSON[_0x345b('0x13')](_0x16d9ea));if(_0x16d9ea[_0x345b('0x14')]){if(_0x16d9ea[_0x345b('0x14')][_0x345b('0x15')]===0x1f4){logger['error'](_0x345b('0x16'),_0xf7689e,_0x16d9ea[_0x345b('0x14')][_0x345b('0x17')]);return _0xb372e3(_0x16d9ea['error'][_0x345b('0x17')]);}logger['error']('License,\x20%s,\x20%s',_0xf7689e,_0x16d9ea['error'][_0x345b('0x17')]);return _0x1c113e(_0x16d9ea[_0x345b('0x14')][_0x345b('0x17')]);}else{logger[_0x345b('0xf')](_0x345b('0x16'),_0xf7689e,'request\x20sent');_0x1c113e(_0x16d9ea[_0x345b('0x18')]['message']);}})[_0x345b('0x19')](function(_0x13ab16){logger[_0x345b('0x14')]('License,\x20%s,\x20%s',_0xf7689e,_0x13ab16);_0xb372e3(_0x13ab16);});});} \ No newline at end of file +var _0x58d3=['request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x22f633,_0x520ec4){var _0x5bb204=function(_0x321a83){while(--_0x321a83){_0x22f633['push'](_0x22f633['shift']());}};_0x5bb204(++_0x520ec4);}(_0x58d3,0x9a));var _0x358d=function(_0x2c1f02,_0x44db72){_0x2c1f02=_0x2c1f02-0x0;var _0x265e7d=_0x58d3[_0x2c1f02];return _0x265e7d;};'use strict';var _=require('lodash');var util=require(_0x358d('0x0'));var moment=require(_0x358d('0x1'));var BPromise=require(_0x358d('0x2'));var rs=require(_0x358d('0x3'));var fs=require('fs');var Redis=require(_0x358d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x358d('0x5'));var logger=require(_0x358d('0x6'))(_0x358d('0x7'));var config=require(_0x358d('0x8'));var jayson=require(_0x358d('0x9'));var client=jayson[_0x358d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43274d,_0x3efc3c,_0x50fece){return new BPromise(function(_0x162e8a,_0x175e48){return client['request'](_0x43274d,_0x50fece)['then'](function(_0x2b94f5){logger[_0x358d('0xb')]('License,\x20%s,\x20%s',_0x3efc3c,'request\x20sent');logger[_0x358d('0xc')](_0x358d('0xd'),_0x3efc3c,_0x358d('0xe'),JSON[_0x358d('0xf')](_0x2b94f5));if(_0x2b94f5[_0x358d('0x10')]){if(_0x2b94f5[_0x358d('0x10')][_0x358d('0x11')]===0x1f4){logger[_0x358d('0x10')](_0x358d('0x12'),_0x3efc3c,_0x2b94f5[_0x358d('0x10')][_0x358d('0x13')]);return _0x175e48(_0x2b94f5[_0x358d('0x10')][_0x358d('0x13')]);}logger[_0x358d('0x10')](_0x358d('0x12'),_0x3efc3c,_0x2b94f5[_0x358d('0x10')][_0x358d('0x13')]);return _0x162e8a(_0x2b94f5[_0x358d('0x10')]['message']);}else{logger[_0x358d('0xb')]('License,\x20%s,\x20%s',_0x3efc3c,'request\x20sent');_0x162e8a(_0x2b94f5['result'][_0x358d('0x13')]);}})[_0x358d('0x14')](function(_0x210758){logger['error'](_0x358d('0x12'),_0x3efc3c,_0x210758);_0x175e48(_0x210758);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a66059f..08c7231 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 _0x3eb1=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout'];(function(_0x26aa24,_0xcd5d8c){var _0xf90f88=function(_0x113459){while(--_0x113459){_0x26aa24['push'](_0x26aa24['shift']());}};_0xf90f88(++_0xcd5d8c);}(_0x3eb1,0x101));var _0x13eb=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x3eb1[_0x22bdd3];return _0x44d9d9;};'use strict';var multer=require(_0x13eb('0x0'));var util=require(_0x13eb('0x1'));var path=require('path');var timeout=require(_0x13eb('0x2'));var express=require(_0x13eb('0x3'));var router=express['Router']();var fs_extra=require(_0x13eb('0x4'));var auth=require(_0x13eb('0x5'));var interaction=require(_0x13eb('0x6'));var config=require(_0x13eb('0x7'));var controller=require(_0x13eb('0x8'));router['get']('/',auth[_0x13eb('0x9')](),controller[_0x13eb('0xa')]);router[_0x13eb('0xb')](_0x13eb('0xc'),auth[_0x13eb('0x9')](),controller[_0x13eb('0xd')]);router[_0x13eb('0xb')](_0x13eb('0xe'),auth[_0x13eb('0x9')](),controller[_0x13eb('0xf')]);router['get'](_0x13eb('0x10'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x11')]);router[_0x13eb('0xb')](_0x13eb('0x12'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x13')]);router['get'](_0x13eb('0x14'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x15')]);router['get']('/:id/out_servers',auth[_0x13eb('0x9')](),controller[_0x13eb('0x16')]);router[_0x13eb('0xb')](_0x13eb('0x17'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x18')]);router[_0x13eb('0xb')](_0x13eb('0x19'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x1a')]);router[_0x13eb('0xb')](_0x13eb('0x1b'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x1c')]);router[_0x13eb('0xb')](_0x13eb('0x1d'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x13eb('0xb')](_0x13eb('0x1e'),auth[_0x13eb('0x9')](),controller['getAgents']);router[_0x13eb('0x1f')](_0x13eb('0x10'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x20')]);router['post'](_0x13eb('0x12'),auth['isAuthenticated'](),controller[_0x13eb('0x21')]);router['post']('/',auth[_0x13eb('0x9')](),controller['create']);router['post'](_0x13eb('0x14'),auth['isAuthenticated'](),controller[_0x13eb('0x22')]);router[_0x13eb('0x1f')](_0x13eb('0x23'),auth['isAuthenticated'](),controller[_0x13eb('0x24')]);router[_0x13eb('0x1f')](_0x13eb('0x17'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x25')]);router[_0x13eb('0x1f')](_0x13eb('0x19'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x26')]);router[_0x13eb('0x1f')](_0x13eb('0x27'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x28')]);router[_0x13eb('0x1f')]('/:id/users',auth[_0x13eb('0x9')](),controller[_0x13eb('0x29')]);router[_0x13eb('0x2a')](_0x13eb('0xe'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x2b')]);router[_0x13eb('0x2c')](_0x13eb('0x10'),auth['isAuthenticated'](),controller[_0x13eb('0x2d')]);router[_0x13eb('0x2c')](_0x13eb('0x12'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x2e')]);router[_0x13eb('0x2c')](_0x13eb('0x14'),auth['isAuthenticated'](),controller[_0x13eb('0x2f')]);router[_0x13eb('0x2c')](_0x13eb('0x23'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x30')]);router[_0x13eb('0x2c')](_0x13eb('0xe'),auth['isAuthenticated'](),controller[_0x13eb('0x31')]);router[_0x13eb('0x2c')](_0x13eb('0x1e'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x32')]);module[_0x13eb('0x33')]=router; \ No newline at end of file +var _0x28ae=['/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','addImap','addSmtp','addInteraction','addApplications'];(function(_0x3d9820,_0x31a719){var _0x45f12d=function(_0xee0eeb){while(--_0xee0eeb){_0x3d9820['push'](_0x3d9820['shift']());}};_0x45f12d(++_0x31a719);}(_0x28ae,0x1b4));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe28a('0x0'));var util=require(_0xe28a('0x1'));var path=require(_0xe28a('0x2'));var timeout=require(_0xe28a('0x3'));var express=require('express');var router=express[_0xe28a('0x4')]();var fs_extra=require(_0xe28a('0x5'));var auth=require(_0xe28a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe28a('0x7'));var controller=require(_0xe28a('0x8'));router[_0xe28a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe28a('0x9')](_0xe28a('0xa'),auth[_0xe28a('0xb')](),controller[_0xe28a('0xc')]);router[_0xe28a('0x9')](_0xe28a('0xd'),auth[_0xe28a('0xb')](),controller[_0xe28a('0xe')]);router['get'](_0xe28a('0xf'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x10')]);router[_0xe28a('0x9')](_0xe28a('0x11'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x12')]);router[_0xe28a('0x9')]('/:id/in_servers',auth[_0xe28a('0xb')](),controller['getImap']);router['get'](_0xe28a('0x13'),auth[_0xe28a('0xb')](),controller['getSmtp']);router[_0xe28a('0x9')](_0xe28a('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe28a('0x9')](_0xe28a('0x15'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x16')]);router['get'](_0xe28a('0x17'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x18')]);router[_0xe28a('0x9')](_0xe28a('0x19'),auth[_0xe28a('0xb')](),controller['verifySmtp']);router['get'](_0xe28a('0x1a'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x1b')]);router['post'](_0xe28a('0xf'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x1c')]);router[_0xe28a('0x1d')](_0xe28a('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0xe28a('0xb')](),controller['create']);router[_0xe28a('0x1d')]('/:id/in_servers',auth[_0xe28a('0xb')](),controller[_0xe28a('0x1e')]);router['post'](_0xe28a('0x13'),auth['isAuthenticated'](),controller[_0xe28a('0x1f')]);router[_0xe28a('0x1d')]('/:id/interactions',auth[_0xe28a('0xb')](),controller[_0xe28a('0x20')]);router[_0xe28a('0x1d')](_0xe28a('0x15'),auth['isAuthenticated'](),controller[_0xe28a('0x21')]);router[_0xe28a('0x1d')](_0xe28a('0x22'),auth['isAuthenticated'](),controller[_0xe28a('0x23')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xe28a('0x24')]);router[_0xe28a('0x25')](_0xe28a('0xd'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x26')]);router['delete'](_0xe28a('0xf'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x27')]);router[_0xe28a('0x28')](_0xe28a('0x11'),auth['isAuthenticated'](),controller[_0xe28a('0x29')]);router['delete']('/:id/in_servers',auth[_0xe28a('0xb')](),controller[_0xe28a('0x2a')]);router[_0xe28a('0x28')](_0xe28a('0x13'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x2b')]);router[_0xe28a('0x28')](_0xe28a('0xd'),auth[_0xe28a('0xb')](),controller[_0xe28a('0x2c')]);router[_0xe28a('0x28')]('/:id/users',auth[_0xe28a('0xb')](),controller[_0xe28a('0x2d')]);module[_0xe28a('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 640282e..7da9c4d 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 _0x0933=['INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0x4f8722,_0x47e4ae){var _0x1430eb=function(_0x2c8812){while(--_0x2c8812){_0x4f8722['push'](_0x4f8722['shift']());}};_0x1430eb(++_0x47e4ae);}(_0x0933,0xc7));var _0x3093=function(_0x41706f,_0x4ef0dc){_0x41706f=_0x41706f-0x0;var _0x59b26d=_0x0933[_0x41706f];return _0x59b26d;};'use strict';var Sequelize=require(_0x3093('0x0'));module[_0x3093('0x1')]={'description':{'type':Sequelize[_0x3093('0x2')]},'name':{'type':Sequelize[_0x3093('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3093('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3093('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x3093('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3093('0x4')},'fontSize':{'type':Sequelize[_0x3093('0x5')](0x2)[_0x3093('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3093('0x7')],'defaultValue':function(){return _0x3093('0x8');}},'notificationSound':{'type':Sequelize[_0x3093('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3093('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3093('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3093('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3093('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3093('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3093('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3093('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2bfe8a){if(!_0x2bfe8a)this[_0x3093('0x9')](_0x3093('0xa'),null);this[_0x3093('0x9')](_0x3093('0xb'),_0x2bfe8a);}},'provider':{'type':Sequelize[_0x3093('0xc')]('gmail',_0x3093('0xd'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x3093('0xe')]('provider'))return'custom';return this[_0x3093('0xe')](_0x3093('0xf'));},'set':function(_0x1d82e9){if(_0x1d82e9===_0x3093('0x10'))_0x1d82e9=null;return this[_0x3093('0x9')](_0x3093('0xf'),_0x1d82e9);}}}; \ No newline at end of file +var _0x6201=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN'];(function(_0x104165,_0x18e69d){var _0x98075e=function(_0x51638c){while(--_0x51638c){_0x104165['push'](_0x104165['shift']());}};_0x98075e(++_0x18e69d);}(_0x6201,0x1e3));var _0x1620=function(_0x333f1e,_0x38ec9a){_0x333f1e=_0x333f1e-0x0;var _0x1e5184=_0x6201[_0x333f1e];return _0x1e5184;};'use strict';var Sequelize=require('sequelize');module[_0x1620('0x0')]={'description':{'type':Sequelize[_0x1620('0x1')]},'name':{'type':Sequelize[_0x1620('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x1620('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1620('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1620('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x1620('0x3')]},'markAsUnread':{'type':Sequelize[_0x1620('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1620('0x3')],'defaultValue':function(){return _0x1620('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1620('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1620('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1620('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1620('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1620('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x1620('0x2')],'defaultValue':![],'comment':_0x1620('0x7'),'set':function(_0x5ad144){if(!_0x5ad144)this[_0x1620('0x8')]('mandatoryDispositionPauseId',null);this[_0x1620('0x8')](_0x1620('0x9'),_0x5ad144);}},'provider':{'type':Sequelize[_0x1620('0xa')](_0x1620('0xb'),_0x1620('0xc'),_0x1620('0xd'),_0x1620('0xe')),'defaultValue':null,'get':function(){if(!this[_0x1620('0xf')](_0x1620('0x10')))return _0x1620('0x11');return this[_0x1620('0xf')](_0x1620('0x10'));},'set':function(_0x28f773){if(_0x28f773===_0x1620('0x11'))_0x28f773=null;return this['setDataValue'](_0x1620('0x10'),_0x28f773);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f3cbc5f..aab484d 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 _0x069a=['then','info','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','end','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','body','modernAuthentication','CloudProviderId','mandatoryDispositionPause','update','describe','MailAccountId','create','getDispositions','findOne','Disposition','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','key','provider','custom','email','ListId','active','description','user','password','pass','service','port','username','authentication','host','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x069a,0x162));var _0xa069=function(_0x1fa1a9,_0x3bf729){_0x1fa1a9=_0x1fa1a9-0x0;var _0xed15f3=_0x069a[_0x1fa1a9];return _0xed15f3;};'use strict';var moment=require('moment');var BPromise=require(_0xa069('0x0'));var util=require(_0xa069('0x1'));var path=require(_0xa069('0x2'));var _=require(_0xa069('0x3'));var juice=require(_0xa069('0x4'));var Redis=require(_0xa069('0x5'));var qs=require(_0xa069('0x6'));var logger=require(_0xa069('0x7'))('api');var config=require(_0xa069('0x8'));var db=require(_0xa069('0x9'))['db'];config[_0xa069('0xa')]=_[_0xa069('0xb')](config['redis'],{'host':_0xa069('0xc'),'port':0x18eb});var socket=require(_0xa069('0xd'))(new Redis(config[_0xa069('0xa')]));require(_0xa069('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa069('0xf')][_0xa069('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x23ba01,_0x7ad6e5,_0x277594,_0x32b4aa){return new BPromise(function(_0x299564,_0x372f4b){var _0x3e62c1=_0x32b4aa||client;return _0x3e62c1[_0xa069('0x11')](_0x23ba01,_0x277594)[_0xa069('0x12')](function(_0xdbd8b){logger[_0xa069('0x13')]('MailAccount,\x20%s,\x20%s',_0x7ad6e5,'request\x20sent');logger['debug'](_0xa069('0x14'),_0x7ad6e5,'request\x20sent',JSON[_0xa069('0x15')](_0xdbd8b));if(_0xdbd8b[_0xa069('0x16')]){if(_0xdbd8b[_0xa069('0x16')][_0xa069('0x17')]===0x1f4){logger[_0xa069('0x16')](_0xa069('0x18'),_0x7ad6e5,_0xdbd8b['error'][_0xa069('0x19')]);return _0x372f4b(_0xdbd8b[_0xa069('0x16')][_0xa069('0x19')]);}logger[_0xa069('0x16')](_0xa069('0x18'),_0x7ad6e5,_0xdbd8b[_0xa069('0x16')][_0xa069('0x19')]);return _0x299564(_0xdbd8b[_0xa069('0x16')][_0xa069('0x19')]);}else{logger[_0xa069('0x13')]('MailAccount,\x20%s,\x20%s',_0x7ad6e5,_0xa069('0x1a'));_0x299564(_0xdbd8b[_0xa069('0x1b')][_0xa069('0x19')]);}})[_0xa069('0x1c')](function(_0x507489){logger[_0xa069('0x16')](_0xa069('0x18'),_0x7ad6e5,_0x507489);_0x372f4b(_0x507489);});});}function respondWithStatusCode(_0x475292,_0x464cdc){_0x464cdc=_0x464cdc||0xcc;return function(_0x309c1b){if(_0x309c1b){return _0x475292[_0xa069('0x1d')](_0x464cdc);}return _0x475292['status'](_0x464cdc)['end']();};}function respondWithResult(_0x4ffad6,_0x5ebfaf){_0x5ebfaf=_0x5ebfaf||0xc8;return function(_0xfaae62){if(_0xfaae62){return _0x4ffad6[_0xa069('0x1e')](_0x5ebfaf)[_0xa069('0x1f')](_0xfaae62);}};}function respondWithFilteredResult(_0x48b395,_0x2c705d){return function(_0x23fbe6){if(_0x23fbe6){var _0x4ebb12=typeof _0x2c705d[_0xa069('0x20')]===_0xa069('0x21')&&typeof _0x2c705d[_0xa069('0x22')]===_0xa069('0x21');var _0x3c1f8b=_0x23fbe6['count'];var _0x3712d0=_0x4ebb12?0x0:_0x2c705d['offset'];var _0x55a0a0=_0x4ebb12?_0x23fbe6[_0xa069('0x23')]:_0x2c705d[_0xa069('0x20')]+_0x2c705d['limit'];var _0x37e733;if(_0x55a0a0>=_0x3c1f8b){_0x55a0a0=_0x3c1f8b;_0x37e733=0xc8;}else{_0x37e733=0xce;}_0x48b395[_0xa069('0x1e')](_0x37e733);return _0x48b395[_0xa069('0x24')](_0xa069('0x25'),_0x3712d0+'-'+_0x55a0a0+'/'+_0x3c1f8b)[_0xa069('0x1f')](_0x23fbe6);}return null;};}function saveUpdates(_0x536467){return function(_0x59b8ed){if(_0x59b8ed){return _0x59b8ed['update'](_0x536467)[_0xa069('0x12')](function(_0x1cc1ad){return _0x1cc1ad;});}return null;};}function removeEntity(_0x266515){return function(_0x587dd7){if(_0x587dd7){return _0x587dd7[_0xa069('0x26')]()[_0xa069('0x12')](function(){var _0x4c9e8a=_0x587dd7[_0xa069('0x27')]({'plain':!![]});var _0x3f24ad=_0xa069('0x28');return db[_0xa069('0x29')][_0xa069('0x26')]({'where':{'type':_0x3f24ad,'resourceId':_0x4c9e8a['id']}})[_0xa069('0x12')](function(){return _0x587dd7;});})[_0xa069('0x12')](function(){_0x266515[_0xa069('0x1e')](0xcc)[_0xa069('0x2a')]();});}};}function handleEntityNotFound(_0x52ab66){return function(_0x4fdb74){if(!_0x4fdb74){_0x52ab66[_0xa069('0x1d')](0x194);}return _0x4fdb74;};}function handleError(_0xa6d61d,_0x3c3dd0){_0x3c3dd0=_0x3c3dd0||0x1f4;return function(_0x13a788){logger[_0xa069('0x16')](_0x13a788['stack']);if(_0x13a788[_0xa069('0x2b')]){delete _0x13a788[_0xa069('0x2b')];}_0xa6d61d['status'](_0x3c3dd0)[_0xa069('0x2c')](_0x13a788);};}exports['index']=function(_0xd51cc,_0x1671d1){var _0x238230={'include':[{'model':db[_0xa069('0x2d')],'as':_0xa069('0x2e')},{'model':db[_0xa069('0x2f')],'as':_0xa069('0x30')},{'model':db[_0xa069('0x31')],'as':'mandatoryDispositionPause'}]},_0x57da95={},_0x2c318f={'count':0x0,'rows':[]};var _0x5184a9=_[_0xa069('0x32')](db[_0xa069('0x33')]['rawAttributes'],function(_0x34eee0){return{'name':_0x34eee0[_0xa069('0x34')],'type':_0x34eee0['type']['key']};});_0x57da95['model']=_[_0xa069('0x32')](_0x5184a9,_0xa069('0x2b'));_0x57da95[_0xa069('0x35')]=_[_0xa069('0x36')](_0xd51cc['query']);_0x57da95[_0xa069('0x37')]=_[_0xa069('0x38')](_0x57da95['model'],_0x57da95[_0xa069('0x35')]);_0x238230[_0xa069('0x39')]=_[_0xa069('0x38')](_0x57da95[_0xa069('0x3a')],qs['fields'](_0xd51cc[_0xa069('0x35')][_0xa069('0x3b')]));_0x238230[_0xa069('0x39')]=_0x238230[_0xa069('0x39')][_0xa069('0x3c')]?_0x238230[_0xa069('0x39')]:_0x57da95[_0xa069('0x3a')];if(!_0xd51cc['query']['hasOwnProperty'](_0xa069('0x3d'))){_0x238230[_0xa069('0x22')]=qs[_0xa069('0x22')](_0xd51cc['query'][_0xa069('0x22')]);_0x238230[_0xa069('0x20')]=qs[_0xa069('0x20')](_0xd51cc[_0xa069('0x35')][_0xa069('0x20')]);}_0x238230[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0xd51cc[_0xa069('0x35')][_0xa069('0x3f')]);_0x238230[_0xa069('0x40')]=qs[_0xa069('0x37')](_[_0xa069('0x41')](_0xd51cc[_0xa069('0x35')],_0x57da95[_0xa069('0x37')]),_0x5184a9);if(_0xd51cc[_0xa069('0x35')][_0xa069('0x42')]){_0x238230['where']=_['merge'](_0x238230[_0xa069('0x40')],{'$or':_['map'](_0x5184a9,function(_0x4c1fa6){if(_0x4c1fa6[_0xa069('0x43')]!==_0xa069('0x44')){var _0x1ecec0={};_0x1ecec0[_0x4c1fa6[_0xa069('0x2b')]]={'$like':'%'+_0xd51cc[_0xa069('0x35')][_0xa069('0x42')]+'%'};return _0x1ecec0;}})});}_0x238230=_[_0xa069('0x45')]({},_0x238230,_0xd51cc[_0xa069('0x46')]);var _0x4f391a={'where':_0x238230[_0xa069('0x40')]};return db['MailAccount'][_0xa069('0x23')](_0x4f391a)['then'](function(_0x4a7bf5){_0x2c318f[_0xa069('0x23')]=_0x4a7bf5;if(_0xd51cc[_0xa069('0x35')][_0xa069('0x47')]){_0x238230[_0xa069('0x48')]=[{'all':!![]}];}return db[_0xa069('0x33')][_0xa069('0x49')](_0x238230);})[_0xa069('0x12')](function(_0x1e4be4){_0x2c318f['rows']=_0x1e4be4;return _0x2c318f;})[_0xa069('0x12')](respondWithFilteredResult(_0x1671d1,_0x238230))[_0xa069('0x1c')](handleError(_0x1671d1,null));};exports[_0xa069('0x4a')]=function(_0x4894b7,_0x1a8f5f){var _0x5557a6={'raw':![],'where':{'id':_0x4894b7[_0xa069('0x4b')]['id']},'include':[{'model':db[_0xa069('0x2d')],'as':_0xa069('0x2e')},{'model':db[_0xa069('0x2f')],'as':_0xa069('0x30')},{'model':db[_0xa069('0x31')],'as':'mandatoryDispositionPause'}]},_0x5d5839={};_0x5d5839['model']=_[_0xa069('0x36')](db[_0xa069('0x33')][_0xa069('0x4c')]);_0x5d5839[_0xa069('0x35')]=_[_0xa069('0x36')](_0x4894b7[_0xa069('0x35')]);_0x5d5839[_0xa069('0x37')]=_[_0xa069('0x38')](_0x5d5839[_0xa069('0x3a')],_0x5d5839['query']);_0x5557a6[_0xa069('0x39')]=_[_0xa069('0x38')](_0x5d5839[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x4894b7[_0xa069('0x35')][_0xa069('0x3b')]));_0x5557a6[_0xa069('0x39')]=_0x5557a6[_0xa069('0x39')]['length']?_0x5557a6[_0xa069('0x39')]:_0x5d5839['model'];if(_0x4894b7[_0xa069('0x35')][_0xa069('0x47')]){_0x5557a6[_0xa069('0x48')]=[{'all':!![]}];}_0x5557a6=_[_0xa069('0x45')]({},_0x5557a6,_0x4894b7[_0xa069('0x46')]);return db[_0xa069('0x33')][_0xa069('0x4d')](_0x5557a6)[_0xa069('0x12')](handleEntityNotFound(_0x1a8f5f,null))[_0xa069('0x12')](respondWithResult(_0x1a8f5f,null))[_0xa069('0x1c')](handleError(_0x1a8f5f,null));};exports['update']=function(_0xa625f,_0x1dfca4){if(_0xa625f[_0xa069('0x4e')]['id']){delete _0xa625f[_0xa069('0x4e')]['id'];}if(_0xa625f[_0xa069('0x4e')][_0xa069('0x2e')]){if(!_0xa625f[_0xa069('0x4e')][_0xa069('0x2e')][_0xa069('0x4f')]){_0xa625f['body'][_0xa069('0x2e')][_0xa069('0x50')]=null;}}if(_0xa625f['body'][_0xa069('0x30')]){if(!_0xa625f[_0xa069('0x4e')]['Smtp'][_0xa069('0x4f')]){_0xa625f['body'][_0xa069('0x30')][_0xa069('0x50')]=null;}}return db['MailAccount'][_0xa069('0x4d')]({'where':{'id':_0xa625f[_0xa069('0x4b')]['id']},'include':[{'model':db[_0xa069('0x2d')],'as':'Imap'},{'model':db[_0xa069('0x2f')],'as':_0xa069('0x30')},{'model':db[_0xa069('0x31')],'as':_0xa069('0x51')}]})[_0xa069('0x12')](handleEntityNotFound(_0x1dfca4,null))['then'](saveUpdates(_0xa625f[_0xa069('0x4e')],null))[_0xa069('0x12')](function(_0x41f5ba){if(_0x41f5ba&&_0xa625f[_0xa069('0x4e')][_0xa069('0x2e')]){return db[_0xa069('0x2d')][_0xa069('0x52')](_0xa625f['body'][_0xa069('0x2e')],{'where':{'MailAccountId':_0x41f5ba['id']}})['then'](function(){return _0x41f5ba;});}return _0x41f5ba;})[_0xa069('0x12')](function(_0x399671){if(_0x399671&&_0xa625f[_0xa069('0x4e')][_0xa069('0x30')]){return db[_0xa069('0x2f')]['update'](_0xa625f[_0xa069('0x4e')][_0xa069('0x30')],{'where':{'MailAccountId':_0x399671['id']}})[_0xa069('0x12')](function(){return _0x399671;});}return _0x399671;})[_0xa069('0x12')](respondWithResult(_0x1dfca4,null))[_0xa069('0x1c')](handleError(_0x1dfca4,null));};exports[_0xa069('0x53')]=function(_0x2d1ae9,_0x16e4ae){return db[_0xa069('0x33')]['describe']()['then'](respondWithResult(_0x16e4ae,null))[_0xa069('0x1c')](handleError(_0x16e4ae,null));};exports['addDisposition']=function(_0x2b59f0,_0x246dff){if(_0x2b59f0[_0xa069('0x4e')]['id']){delete _0x2b59f0[_0xa069('0x4e')]['id'];}return db['MailAccount'][_0xa069('0x4d')]({'where':{'id':_0x2b59f0['params']['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x246dff,null))[_0xa069('0x12')](function(_0x140fd0){if(_0x140fd0){_0x2b59f0[_0xa069('0x4e')][_0xa069('0x54')]=_0x140fd0['id'];return db['Disposition'][_0xa069('0x55')](_0x2b59f0[_0xa069('0x4e')]);}})[_0xa069('0x12')](respondWithResult(_0x246dff,null))[_0xa069('0x1c')](handleError(_0x246dff,null));};exports[_0xa069('0x56')]=function(_0x53d800,_0x203f2f){var _0x1be0ee={'raw':![],'where':{}};var _0x14b3d3={};var _0x1d86d6={'count':0x0,'rows':[]};return db['MailAccount'][_0xa069('0x57')]({'where':{'id':_0x53d800[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x203f2f,null))[_0xa069('0x12')](function(_0x8a2f15){if(_0x8a2f15){_0x14b3d3[_0xa069('0x3a')]=_[_0xa069('0x36')](db[_0xa069('0x58')]['rawAttributes']);_0x14b3d3[_0xa069('0x35')]=_[_0xa069('0x36')](_0x53d800[_0xa069('0x35')]);_0x14b3d3['filters']=_[_0xa069('0x38')](_0x14b3d3[_0xa069('0x3a')],_0x14b3d3[_0xa069('0x35')]);_0x1be0ee[_0xa069('0x39')]=_[_0xa069('0x38')](_0x14b3d3[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x53d800['query']['fields']));_0x1be0ee[_0xa069('0x39')]=_0x1be0ee[_0xa069('0x39')]['length']?_0x1be0ee[_0xa069('0x39')]:_0x14b3d3['model'];if(!_0x53d800[_0xa069('0x35')][_0xa069('0x59')](_0xa069('0x3d'))){_0x1be0ee[_0xa069('0x22')]=qs['limit'](_0x53d800[_0xa069('0x35')]['limit']);_0x1be0ee[_0xa069('0x20')]=qs[_0xa069('0x20')](_0x53d800['query'][_0xa069('0x20')]);}_0x1be0ee[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x53d800[_0xa069('0x35')][_0xa069('0x3f')]);_0x1be0ee[_0xa069('0x40')]=qs[_0xa069('0x37')](_['pick'](_0x53d800[_0xa069('0x35')],_0x14b3d3[_0xa069('0x37')]));_0x1be0ee['where'][_0xa069('0x54')]=_0x8a2f15['id'];if(_0x53d800[_0xa069('0x35')]['filter']){_0x1be0ee[_0xa069('0x40')]=_[_0xa069('0x45')](_0x1be0ee[_0xa069('0x40')],{'$or':_['map'](_0x1be0ee[_0xa069('0x39')],function(_0x44eb6a){var _0x893fff={};_0x893fff[_0x44eb6a]={'$like':'%'+_0x53d800[_0xa069('0x35')][_0xa069('0x42')]+'%'};return _0x893fff;})});}_0x1be0ee=_[_0xa069('0x45')]({},_0x1be0ee,_0x53d800[_0xa069('0x46')]);return db['Disposition'][_0xa069('0x23')]({'where':_0x1be0ee[_0xa069('0x40')]})[_0xa069('0x12')](function(_0x4b8f01){_0x1d86d6[_0xa069('0x23')]=_0x4b8f01;if(_0x53d800['query'][_0xa069('0x47')]){_0x1be0ee[_0xa069('0x48')]=[{'all':!![]}];}return db[_0xa069('0x58')][_0xa069('0x49')](_0x1be0ee);})[_0xa069('0x12')](function(_0x511d9e){_0x1d86d6[_0xa069('0x5a')]=_0x511d9e;return _0x1d86d6;});}})[_0xa069('0x12')](respondWithFilteredResult(_0x203f2f,_0x1be0ee))[_0xa069('0x1c')](handleError(_0x203f2f,null));};exports[_0xa069('0x5b')]=function(_0x4bcf09,_0xa28004){return db[_0xa069('0x33')]['find']({'where':{'id':_0x4bcf09[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0xa28004,null))[_0xa069('0x12')](function(_0x3679e3){if(_0x3679e3){return _0x3679e3['removeDispositions'](_0x4bcf09[_0xa069('0x35')][_0xa069('0x5c')]);}})[_0xa069('0x12')](respondWithStatusCode(_0xa28004,null))['catch'](handleError(_0xa28004,null));};exports[_0xa069('0x5d')]=function(_0x26d3bc,_0x1d6d3c){if(_0x26d3bc[_0xa069('0x4e')]['id']){delete _0x26d3bc['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x26d3bc[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x1d6d3c,null))['then'](function(_0x5b71b6){if(_0x5b71b6){_0x26d3bc[_0xa069('0x4e')][_0xa069('0x54')]=_0x5b71b6['id'];return db[_0xa069('0x5e')]['create'](_0x26d3bc[_0xa069('0x4e')]);}})[_0xa069('0x12')](respondWithResult(_0x1d6d3c,null))[_0xa069('0x1c')](handleError(_0x1d6d3c,null));};exports['getAnswers']=function(_0x4a3565,_0x732d99){var _0x45f7af={'raw':![],'where':{}};var _0x1a61cd={};var _0x5e8833={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4a3565[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x732d99,null))[_0xa069('0x12')](function(_0xd8a56b){if(_0xd8a56b){_0x1a61cd[_0xa069('0x3a')]=_[_0xa069('0x36')](db['CannedAnswer'][_0xa069('0x4c')]);_0x1a61cd[_0xa069('0x35')]=_[_0xa069('0x36')](_0x4a3565[_0xa069('0x35')]);_0x1a61cd[_0xa069('0x37')]=_['intersection'](_0x1a61cd[_0xa069('0x3a')],_0x1a61cd['query']);_0x45f7af['attributes']=_[_0xa069('0x38')](_0x1a61cd[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x4a3565[_0xa069('0x35')][_0xa069('0x3b')]));_0x45f7af[_0xa069('0x39')]=_0x45f7af['attributes'][_0xa069('0x3c')]?_0x45f7af['attributes']:_0x1a61cd[_0xa069('0x3a')];if(!_0x4a3565[_0xa069('0x35')][_0xa069('0x59')](_0xa069('0x3d'))){_0x45f7af['limit']=qs[_0xa069('0x22')](_0x4a3565[_0xa069('0x35')][_0xa069('0x22')]);_0x45f7af[_0xa069('0x20')]=qs[_0xa069('0x20')](_0x4a3565['query'][_0xa069('0x20')]);}_0x45f7af[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x4a3565['query'][_0xa069('0x3f')]);_0x45f7af[_0xa069('0x40')]=qs[_0xa069('0x37')](_[_0xa069('0x41')](_0x4a3565['query'],_0x1a61cd[_0xa069('0x37')]));_0x45f7af[_0xa069('0x40')]['MailAccountId']=_0xd8a56b['id'];if(_0x4a3565[_0xa069('0x35')][_0xa069('0x42')]){_0x45f7af[_0xa069('0x40')]=_['merge'](_0x45f7af[_0xa069('0x40')],{'$or':_['map'](_0x45f7af['attributes'],function(_0x377c73){var _0x5b9964={};_0x5b9964[_0x377c73]={'$like':'%'+_0x4a3565['query']['filter']+'%'};return _0x5b9964;})});}_0x45f7af=_[_0xa069('0x45')]({},_0x45f7af,_0x4a3565[_0xa069('0x46')]);return db['CannedAnswer'][_0xa069('0x23')]({'where':_0x45f7af[_0xa069('0x40')]})[_0xa069('0x12')](function(_0x5d0f11){_0x5e8833[_0xa069('0x23')]=_0x5d0f11;if(_0x4a3565['query']['includeAll']){_0x45f7af[_0xa069('0x48')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x45f7af);})[_0xa069('0x12')](function(_0x1e9316){_0x5e8833[_0xa069('0x5a')]=_0x1e9316;return _0x5e8833;});}})['then'](respondWithFilteredResult(_0x732d99,_0x45f7af))[_0xa069('0x1c')](handleError(_0x732d99,null));};exports[_0xa069('0x5f')]=function(_0x1aab78,_0x3dfd58){return db['MailAccount'][_0xa069('0x4d')]({'where':{'id':_0x1aab78[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3dfd58,null))[_0xa069('0x12')](function(_0x27f456){if(_0x27f456){return _0x27f456[_0xa069('0x5f')](_0x1aab78[_0xa069('0x35')][_0xa069('0x5c')]);}})[_0xa069('0x12')](respondWithStatusCode(_0x3dfd58,null))[_0xa069('0x1c')](handleError(_0x3dfd58,null));};exports[_0xa069('0x55')]=function(_0x1a2bd3,_0x362e3b){var _0x3d912a={'name':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x2b')],'key':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x60')],'provider':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x61')]===_0xa069('0x62')?null:_0x1a2bd3['body']['provider'],'email':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x63')],'ListId':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x64')],'active':!_['isNil'](_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x65')])?_0x1a2bd3[_0xa069('0x4e')]['active']:!![],'description':_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x66')]||null,'Imap':{},'Smtp':{}};if(_0x3d912a[_0xa069('0x61')]){_0x3d912a[_0xa069('0x2e')][_0xa069('0x67')]=_0x3d912a[_0xa069('0x30')]['user']=_0x1a2bd3[_0xa069('0x4e')]['username'];_0x3d912a[_0xa069('0x2e')][_0xa069('0x68')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x69')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x68')];if(_0x1a2bd3[_0xa069('0x4e')]['modernAuthentication']){_0x3d912a[_0xa069('0x2e')]['modernAuthentication']=_0x3d912a[_0xa069('0x30')][_0xa069('0x4f')]=!![];_0x3d912a['Imap'][_0xa069('0x50')]=_0x3d912a['Smtp'][_0xa069('0x50')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x50')];_0x3d912a[_0xa069('0x2e')][_0xa069('0x68')]=_0x3d912a['Smtp'][_0xa069('0x69')]=null;}else{_0x3d912a[_0xa069('0x2e')]['CloudProviderId']=_0x3d912a[_0xa069('0x30')][_0xa069('0x50')]=null;}_0x3d912a['Imap'][_0xa069('0x6a')]=_0x3d912a['Smtp']['service']=null;_0x3d912a['Imap']['host']=_0x3d912a['Smtp']['host']=null;_0x3d912a[_0xa069('0x2e')][_0xa069('0x6b')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x6b')]=null;}else{if(_0x1a2bd3[_0xa069('0x4e')]['authentication']){_0x3d912a[_0xa069('0x2e')][_0xa069('0x67')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x67')]=_0x1a2bd3['body'][_0xa069('0x6c')];_0x3d912a['Imap'][_0xa069('0x68')]=_0x3d912a['Smtp'][_0xa069('0x69')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x68')];}else{_0x3d912a['Imap'][_0xa069('0x6d')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x6d')]=![];_0x3d912a[_0xa069('0x2e')][_0xa069('0x67')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x67')]=null;_0x3d912a['Imap'][_0xa069('0x68')]=_0x3d912a[_0xa069('0x30')][_0xa069('0x69')]=null;}_0x3d912a['Imap'][_0xa069('0x6e')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x2e')][_0xa069('0x6e')];_0x3d912a[_0xa069('0x2e')][_0xa069('0x6b')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x2e')][_0xa069('0x6b')];_0x3d912a[_0xa069('0x30')][_0xa069('0x6e')]=_0x1a2bd3[_0xa069('0x4e')][_0xa069('0x30')]['host'];_0x3d912a[_0xa069('0x30')][_0xa069('0x6b')]=_0x1a2bd3['body'][_0xa069('0x30')][_0xa069('0x6b')];}return db['MailAccount'][_0xa069('0x55')](_0x3d912a,{'include':[{'model':db[_0xa069('0x2f')],'as':_0xa069('0x30')},{'model':db[_0xa069('0x2d')],'as':_0xa069('0x2e')}]})[_0xa069('0x12')](function(_0x42e3fc){var _0x24ea98=_0x1a2bd3['user'][_0xa069('0x27')]({'plain':!![]});if(!_0x24ea98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24ea98[_0xa069('0x6f')]==='user'){var _0x137307=_0x42e3fc['get']({'plain':!![]});return db[_0xa069('0x70')][_0xa069('0x4d')]({'where':{'name':_0xa069('0x28'),'userProfileId':_0x24ea98[_0xa069('0x71')]},'raw':!![]})['then'](function(_0x46719a){if(_0x46719a&&_0x46719a[_0xa069('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x137307[_0xa069('0x2b')],'resourceId':_0x137307['id'],'type':_0x46719a[_0xa069('0x2b')],'sectionId':_0x46719a['id']},{})[_0xa069('0x12')](function(){return _0x42e3fc;});}else{return _0x42e3fc;}})['catch'](function(_0x4dc936){logger[_0xa069('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dc936);throw _0x4dc936;});}return _0x42e3fc;})[_0xa069('0x12')](respondWithResult(_0x362e3b,0xc9))[_0xa069('0x1c')](handleError(_0x362e3b,null));};exports['getImap']=function(_0x348500,_0x2b8146){return db['MailAccount'][_0xa069('0x57')]({'where':{'id':_0x348500[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x2b8146,null))[_0xa069('0x12')](function(_0x8ebfca){if(_0x8ebfca){return _0x8ebfca[_0xa069('0x73')]();}return null;})[_0xa069('0x12')](respondWithResult(_0x2b8146,null))[_0xa069('0x1c')](handleError(_0x2b8146,null));};exports[_0xa069('0x74')]=function(_0x3b8f1a,_0x4aa04a){if(_0x3b8f1a[_0xa069('0x4e')]['id']){delete _0x3b8f1a[_0xa069('0x4e')]['id'];}return db[_0xa069('0x33')][_0xa069('0x4d')]({'where':{'id':_0x3b8f1a[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4aa04a,null))[_0xa069('0x12')](function(_0x4c1a90){if(_0x4c1a90){_0x3b8f1a[_0xa069('0x4e')][_0xa069('0x54')]=_0x4c1a90['id'];return db[_0xa069('0x2d')][_0xa069('0x55')](_0x3b8f1a['body']);}})[_0xa069('0x12')](respondWithResult(_0x4aa04a,null))[_0xa069('0x1c')](handleError(_0x4aa04a,null));};exports[_0xa069('0x75')]=function(_0x13beb1,_0x596d93){return db[_0xa069('0x33')]['findOne']({'where':{'id':_0x13beb1['params']['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x596d93,null))[_0xa069('0x12')](function(_0x2c19e8){if(_0x2c19e8){return _0x2c19e8[_0xa069('0x76')](null);}return null;})['then'](respondWithStatusCode(_0x596d93,null))['catch'](handleError(_0x596d93,null));};exports[_0xa069('0x77')]=function(_0x5d249f,_0x5a2dd9){return db[_0xa069('0x33')][_0xa069('0x57')]({'where':{'id':_0x5d249f['params']['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x5a2dd9,null))[_0xa069('0x12')](function(_0x41fb41){if(_0x41fb41){return _0x41fb41[_0xa069('0x77')]();}return null;})[_0xa069('0x12')](respondWithResult(_0x5a2dd9,null))[_0xa069('0x1c')](handleError(_0x5a2dd9,null));};exports['addSmtp']=function(_0x451175,_0x236cc0){if(_0x451175[_0xa069('0x4e')]['id']){delete _0x451175[_0xa069('0x4e')]['id'];}return db[_0xa069('0x33')]['find']({'where':{'id':_0x451175[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x236cc0,null))[_0xa069('0x12')](function(_0x48fc1c){if(_0x48fc1c){_0x451175[_0xa069('0x4e')][_0xa069('0x54')]=_0x48fc1c['id'];return db[_0xa069('0x2f')][_0xa069('0x55')](_0x451175[_0xa069('0x4e')]);}})[_0xa069('0x12')](respondWithResult(_0x236cc0,null))[_0xa069('0x1c')](handleError(_0x236cc0,null));};exports[_0xa069('0x78')]=function(_0x8a5fb4,_0x3acd41){return db['MailAccount']['findOne']({'where':{'id':_0x8a5fb4[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3acd41,null))[_0xa069('0x12')](function(_0x5d4163){if(_0x5d4163){return _0x5d4163['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x3acd41,null))['catch'](handleError(_0x3acd41,null));};exports[_0xa069('0x79')]=function(_0xe9c9b6,_0x30c70a){return db[_0xa069('0x7a')][_0xa069('0x4d')]({'where':{'id':_0xe9c9b6[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30c70a,null))[_0xa069('0x12')](function(_0x374d5f){if(_0x374d5f){return _0x374d5f[_0xa069('0x79')](_0xe9c9b6[_0xa069('0x4e')][_0xa069('0x5c')],_['omit'](_0xe9c9b6['body'],[_0xa069('0x5c'),'id'])||{});}})[_0xa069('0x12')](respondWithResult(_0x30c70a,null))[_0xa069('0x1c')](handleError(_0x30c70a,null));};exports['getInteractions']=function(_0x283463,_0x7a4f8b){var _0x67cba3={'raw':![],'where':{}};var _0x146e55={};var _0x51c707={'count':0x0,'rows':[]};return db['MailAccount'][_0xa069('0x57')]({'where':{'id':_0x283463[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x7a4f8b,null))[_0xa069('0x12')](function(_0xf984c6){if(_0xf984c6){_0x146e55['model']=_[_0xa069('0x36')](db[_0xa069('0x7a')]['rawAttributes']);_0x146e55[_0xa069('0x35')]=_[_0xa069('0x36')](_0x283463[_0xa069('0x35')]);_0x146e55[_0xa069('0x37')]=_[_0xa069('0x38')](_0x146e55[_0xa069('0x3a')],_0x146e55[_0xa069('0x35')]);_0x67cba3[_0xa069('0x39')]=_[_0xa069('0x38')](_0x146e55[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x283463[_0xa069('0x35')][_0xa069('0x3b')]));_0x67cba3[_0xa069('0x39')]=_0x67cba3[_0xa069('0x39')]['length']?_0x67cba3[_0xa069('0x39')]:_0x146e55['model'];if(!_0x283463[_0xa069('0x35')][_0xa069('0x59')](_0xa069('0x3d'))){_0x67cba3[_0xa069('0x22')]=qs['limit'](_0x283463[_0xa069('0x35')][_0xa069('0x22')]);_0x67cba3[_0xa069('0x20')]=qs[_0xa069('0x20')](_0x283463[_0xa069('0x35')]['offset']);}_0x67cba3[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x283463[_0xa069('0x35')][_0xa069('0x3f')]);_0x67cba3[_0xa069('0x40')]=qs[_0xa069('0x37')](_['pick'](_0x283463[_0xa069('0x35')],_0x146e55[_0xa069('0x37')]));_0x67cba3[_0xa069('0x40')][_0xa069('0x54')]=_0xf984c6['id'];if(_0x283463[_0xa069('0x35')][_0xa069('0x42')]){_0x67cba3[_0xa069('0x40')]=_['merge'](_0x67cba3[_0xa069('0x40')],{'$or':_['map'](_0x67cba3[_0xa069('0x39')],function(_0x8225f0){var _0x2e78df={};_0x2e78df[_0x8225f0]={'$like':'%'+_0x283463[_0xa069('0x35')][_0xa069('0x42')]+'%'};return _0x2e78df;})});}_0x67cba3=_[_0xa069('0x45')]({},_0x67cba3,_0x283463[_0xa069('0x46')]);return db[_0xa069('0x7a')][_0xa069('0x23')]({'where':_0x67cba3[_0xa069('0x40')]})[_0xa069('0x12')](function(_0x23c399){_0x51c707[_0xa069('0x23')]=_0x23c399;if(_0x283463[_0xa069('0x35')][_0xa069('0x47')]){_0x67cba3[_0xa069('0x48')]=[{'model':db[_0xa069('0x7b')],'as':_0xa069('0x7c'),'required':![]},{'model':db[_0xa069('0x7d')],'as':_0xa069('0x7e'),'attributes':[_0xa069('0x2b'),'fullname',_0xa069('0x7f')],'required':![]},{'model':db[_0xa069('0x80')],'as':_0xa069('0x81'),'attributes':['id','name',_0xa069('0x82')],'where':_0x283463[_0xa069('0x35')][_0xa069('0x83')]?{'id':_0x283463[_0xa069('0x35')][_0xa069('0x83')]}:undefined,'required':_0x283463[_0xa069('0x35')][_0xa069('0x83')]?!![]:![]}];}return db[_0xa069('0x7a')][_0xa069('0x49')](_0x67cba3);})[_0xa069('0x12')](function(_0x4b78d5){_0x51c707[_0xa069('0x5a')]=_0x4b78d5;return _0x51c707;});}})[_0xa069('0x12')](respondWithFilteredResult(_0x7a4f8b,_0x67cba3))['catch'](handleError(_0x7a4f8b,null));};exports['addApplications']=function addApplications(_0x4e502d,_0x3f9a01){var _0x346e6e=_0x4e502d['params']['id'];var _0x517605=_0x4e502d['body'];var _0x437ecc=0xc8;var _0xcf5648=null;return db[_0xa069('0x84')][_0xa069('0x85')]({'isolationLevel':db[_0xa069('0x84')][_0xa069('0x86')][_0xa069('0x87')][_0xa069('0x88')]},function(_0x40c17b){return db[_0xa069('0x33')]['findOne']({'where':{'id':_0x346e6e},'transaction':_0x40c17b})[_0xa069('0x12')](function(_0x3760a2){if(_0x3760a2){return db[_0xa069('0x89')][_0xa069('0x26')]({'where':{'MailAccountId':_0x346e6e},'transaction':_0x40c17b})['then'](function(){var _0x3e01de=_[_0xa069('0x32')](_0x517605,function(_0x33e4e2){_0x33e4e2[_0xa069('0x54')]=_0x346e6e;return _0x33e4e2;});return db[_0xa069('0x89')]['bulkCreate'](_0x3e01de,{'transaction':_0x40c17b});});}else{_0x437ecc=0x194;_0xcf5648=[];}});})[_0xa069('0x12')](function(){if(_0x437ecc!==0x194){return db[_0xa069('0x89')][_0xa069('0x8a')]({'where':{'MailAccountId':_0x346e6e},'order':'priority'})[_0xa069('0x12')](function(_0x1436cc){_0xcf5648=_0x1436cc;});}})[_0xa069('0x1c')](function(_0x235aab){_0x437ecc=0x1f4;logger[_0xa069('0x16')](_0x235aab[_0xa069('0x8b')]);if(_0x235aab[_0xa069('0x2b')]){delete _0x235aab[_0xa069('0x2b')];}_0xcf5648=_0x235aab;})[_0xa069('0x8c')](function(){if(_0xcf5648===null){_0x3f9a01[_0xa069('0x1d')](_0x437ecc);}else{if(_0x437ecc===0x1f4){_0x3f9a01[_0xa069('0x1e')](_0x437ecc)[_0xa069('0x2c')](_0xcf5648);}else{_0x3f9a01['status'](_0x437ecc)[_0xa069('0x1f')](_0xcf5648);}}});};exports[_0xa069('0x8d')]=function(_0x290c4a,_0x1ab64e){var _0xb28804={};var _0x3f1c8e={};var _0x139f70;var _0x1df4c0;return db[_0xa069('0x33')][_0xa069('0x57')]({'where':{'id':_0x290c4a[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x1ab64e,null))[_0xa069('0x12')](function(_0x27d294){if(_0x27d294){_0x139f70=_0x27d294;_0x3f1c8e[_0xa069('0x3a')]=_[_0xa069('0x36')](db[_0xa069('0x89')]['rawAttributes']);_0x3f1c8e['query']=_[_0xa069('0x36')](_0x290c4a[_0xa069('0x35')]);_0x3f1c8e[_0xa069('0x37')]=_['intersection'](_0x3f1c8e[_0xa069('0x3a')],_0x3f1c8e[_0xa069('0x35')]);_0xb28804[_0xa069('0x39')]=_['intersection'](_0x3f1c8e[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x290c4a['query'][_0xa069('0x3b')]));_0xb28804[_0xa069('0x39')]=_0xb28804[_0xa069('0x39')]['length']?_0xb28804[_0xa069('0x39')]:_0x3f1c8e[_0xa069('0x3a')];_0xb28804[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x290c4a['query'][_0xa069('0x3f')]);_0xb28804[_0xa069('0x40')]=qs[_0xa069('0x37')](_[_0xa069('0x41')](_0x290c4a[_0xa069('0x35')],_0x3f1c8e['filters']));if(_0x290c4a[_0xa069('0x35')][_0xa069('0x42')]){_0xb28804[_0xa069('0x40')]=_[_0xa069('0x45')](_0xb28804[_0xa069('0x40')],{'$or':_[_0xa069('0x32')](_0xb28804[_0xa069('0x39')],function(_0x1064de){var _0x373391={};_0x373391[_0x1064de]={'$like':'%'+_0x290c4a[_0xa069('0x35')]['filter']+'%'};return _0x373391;})});}_0xb28804=_[_0xa069('0x45')]({},_0xb28804,_0x290c4a[_0xa069('0x46')]);return _0x139f70[_0xa069('0x8d')](_0xb28804);}})[_0xa069('0x12')](function(_0x11cffa){if(_0x11cffa){_0x1df4c0=_0x11cffa[_0xa069('0x3c')];if(!_0x290c4a[_0xa069('0x35')][_0xa069('0x59')](_0xa069('0x3d'))){_0xb28804['limit']=qs[_0xa069('0x22')](_0x290c4a[_0xa069('0x35')][_0xa069('0x22')]);_0xb28804[_0xa069('0x20')]=qs['offset'](_0x290c4a[_0xa069('0x35')]['offset']);}return _0x139f70[_0xa069('0x8d')](_0xb28804);}})['then'](function(_0x5abea3){if(_0x5abea3){return _0x5abea3?{'count':_0x1df4c0,'rows':_0x5abea3}:null;}})[_0xa069('0x12')](respondWithResult(_0x1ab64e,null))['catch'](handleError(_0x1ab64e,null));};exports[_0xa069('0x8e')]=function(_0x485661,_0x5b5872){var _0x488fc5={'raw':!![],'where':{}};var _0x38de2c={};var _0x1f33b5={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x485661[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b5872,null))[_0xa069('0x12')](function(_0x16fa42){if(_0x16fa42){_0x38de2c['model']=_[_0xa069('0x36')](db[_0xa069('0x8f')][_0xa069('0x4c')]);_0x38de2c[_0xa069('0x35')]=_[_0xa069('0x36')](_0x485661[_0xa069('0x35')]);_0x38de2c[_0xa069('0x37')]=_[_0xa069('0x38')](_0x38de2c[_0xa069('0x3a')],_0x38de2c['query']);_0x488fc5[_0xa069('0x39')]=_[_0xa069('0x38')](_0x38de2c['model'],qs[_0xa069('0x3b')](_0x485661[_0xa069('0x35')][_0xa069('0x3b')]));_0x488fc5[_0xa069('0x39')]=_0x488fc5[_0xa069('0x39')][_0xa069('0x3c')]?_0x488fc5[_0xa069('0x39')]:_0x38de2c['model'];if(!_0x485661[_0xa069('0x35')]['hasOwnProperty'](_0xa069('0x3d'))){_0x488fc5[_0xa069('0x22')]=qs[_0xa069('0x22')](_0x485661['query'][_0xa069('0x22')]);_0x488fc5[_0xa069('0x20')]=qs[_0xa069('0x20')](_0x485661[_0xa069('0x35')][_0xa069('0x20')]);}_0x488fc5[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x485661[_0xa069('0x35')][_0xa069('0x3f')]);_0x488fc5['where']=qs[_0xa069('0x37')](_[_0xa069('0x41')](_0x485661['query'],_0x38de2c[_0xa069('0x37')]));_0x488fc5[_0xa069('0x40')][_0xa069('0x54')]=_0x16fa42['id'];if(_0x485661['query']['filter']){_0x488fc5[_0xa069('0x40')]=_['merge'](_0x488fc5[_0xa069('0x40')],{'$or':_[_0xa069('0x32')](_0x488fc5[_0xa069('0x39')],function(_0x2b3fc0){var _0x14924d={};_0x14924d[_0x2b3fc0]={'$like':'%'+_0x485661['query'][_0xa069('0x42')]+'%'};return _0x14924d;})});}if(_0x485661[_0xa069('0x35')][_0xa069('0x90')]){var _0x3ad036=_0x485661[_0xa069('0x35')][_0xa069('0x90')][_0xa069('0x91')](',');var _0x1fb57a={};_0x1fb57a[_0x3ad036[0x0]]={'$gte':moment(_0x3ad036[0x1])[_0xa069('0x92')](_0xa069('0x93'))};_0x488fc5[_0xa069('0x40')]=_['merge'](_0x488fc5[_0xa069('0x40')],_0x1fb57a);}_0x488fc5=_[_0xa069('0x45')]({},_0x488fc5,_0x485661[_0xa069('0x46')]);return db['MailMessage'][_0xa069('0x23')]({'where':_0x488fc5['where']})[_0xa069('0x12')](function(_0x17b87f){_0x1f33b5['count']=_0x17b87f;if(_0x485661[_0xa069('0x35')]['includeAll']){_0x488fc5[_0xa069('0x48')]=[{'all':!![]}];}return db['MailMessage'][_0xa069('0x49')](_0x488fc5);})[_0xa069('0x12')](function(_0x50a6e5){if(_0x485661['query'][_0xa069('0x94')]===_0xa069('0x95')){for(var _0x141fa1=0x0;_0x141fa1<_0x50a6e5[_0xa069('0x3c')];_0x141fa1++){_0x50a6e5[_0x141fa1][_0xa069('0x4e')]=juice(_0x50a6e5[_0x141fa1][_0xa069('0x4e')]);}}_0x1f33b5[_0xa069('0x5a')]=_0x50a6e5;return _0x1f33b5;});}})['then'](respondWithFilteredResult(_0x5b5872,_0x488fc5))[_0xa069('0x1c')](handleError(_0x5b5872,null));};exports['send']=function(_0x1d8adc,_0x9b9b35){var _0x5f1c99,_0x55dc9f={},_0x254ebe;if(_0x1d8adc[_0xa069('0x4e')]['to']){_0x254ebe=_0x1d8adc[_0xa069('0x4e')]['to'][_0xa069('0x91')](',')[0x0];}return db[_0xa069('0x33')][_0xa069('0x4d')]({'where':{'id':_0x1d8adc[_0xa069('0x4b')]['id']},'include':[{'model':db[_0xa069('0x96')],'as':_0xa069('0x97'),'include':[{'model':db[_0xa069('0x7b')],'as':_0xa069('0x98'),'where':{'email':_0x254ebe},'limit':0x1,'order':[[_0xa069('0x99'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xa069('0x30'),'raw':!![],'include':[{'model':db[_0xa069('0x9a')],'as':_0xa069('0x9a'),'raw':!![]}]}]})[_0xa069('0x12')](handleEntityNotFound(_0x9b9b35,null))[_0xa069('0x12')](function(_0x5c0c60){if(!_0x5c0c60)return;_0x5f1c99=_0x5c0c60;if(!_0x5c0c60[_0xa069('0x30')])throw new Error(_0xa069('0x9b'));if(_['isNil'](_0x1d8adc[_0xa069('0x4e')][_0xa069('0x9c')])){_0x1d8adc[_0xa069('0x4e')]['from']=util[_0xa069('0x92')](_0xa069('0x9d'),_0x5c0c60[_0xa069('0x2b')],_0x5c0c60['email']||_0x5c0c60[_0xa069('0x30')][_0xa069('0x67')]);}if(_0x1d8adc['body'][_0xa069('0x9e')]&&_0x1d8adc['body']['attachments']['length']){for(var _0x50c5de=0x0;_0x50c5de<_0x1d8adc['body'][_0xa069('0x9e')][_0xa069('0x3c')];_0x50c5de+=0x1){_0x1d8adc['body'][_0xa069('0x9e')][_0x50c5de]={'filename':_0x1d8adc['body'][_0xa069('0x9e')][_0x50c5de][_0xa069('0x2b')],'path':path[_0xa069('0x9f')](config[_0xa069('0xa0')],_0xa069('0xa1'),_0x1d8adc[_0xa069('0x4e')]['attachments'][_0x50c5de][_0xa069('0xa2')])};}}var _0x1ecab6=_0x5c0c60[_0xa069('0xa3')]();return respondWithRpcPromise(_0xa069('0xa4'),_0xa069('0xa5'),{'account':_0x1ecab6,'message':_0x1d8adc[_0xa069('0x4e')]});})[_0xa069('0x12')](function(_0x1b9361){if(!_0x1b9361)return;_0x55dc9f=_0x1b9361;if(!_0x5f1c99[_0xa069('0x97')])throw new Error(_0xa069('0xa6'));if(_0x5f1c99[_0xa069('0x97')][_0xa069('0x98')]['length'])return _0x5f1c99[_0xa069('0x97')]['Contacts'][0x0];return db['CmContact']['create'](_[_0xa069('0xb')](_0x1d8adc['body'],{'firstName':_0x1d8adc[_0xa069('0x4e')]['to'],'email':_0x1d8adc[_0xa069('0x4e')]['to'],'phone':_0x1d8adc[_0xa069('0x4e')]['to'],'ListId':_0x5f1c99[_0xa069('0x64')]}));})[_0xa069('0x12')](function(_0x18c7d0){if(!_0x18c7d0)return;var _0x172756={'UserId':_0x1d8adc[_0xa069('0x67')]['id'],'ContactId':_0x18c7d0['id'],'MailAccountId':_0x5f1c99['id'],'inReplyTo':_0x55dc9f[_0xa069('0xa7')],'to':_0x1d8adc[_0xa069('0x4e')]['from'],'cc':_0x1d8adc[_0xa069('0x4e')]['cc'],'subject':_0x1d8adc['body'][_0xa069('0xa8')],'attach':_0x1d8adc[_0xa069('0x4e')][_0xa069('0xa9')],'firstMsgDirection':_0xa069('0xaa'),'lastMsgAt':moment()[_0xa069('0x92')](_0xa069('0x93')),'lastMsgDirection':_0xa069('0xaa'),'Messages':[_[_0xa069('0x45')](_0x1d8adc[_0xa069('0x4e')],{'messageId':_0x55dc9f[_0xa069('0xa7')],'sentAt':moment()[_0xa069('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5f1c99['id'],'UserId':_0x1d8adc[_0xa069('0x67')]['id'],'ContactId':_0x18c7d0['id']})]};if(_0x1d8adc[_0xa069('0x4e')][_0xa069('0xab')]){_0x172756=_[_0xa069('0x45')](_0x172756,_0x1d8adc[_0xa069('0x4e')][_0xa069('0xab')]);}return db[_0xa069('0x7a')][_0xa069('0x55')](_0x172756,{'include':[{'model':db[_0xa069('0x8f')],'as':_0xa069('0xac')}]});})[_0xa069('0x12')](respondWithResult(_0x9b9b35,null))[_0xa069('0x1c')](handleError(_0x9b9b35,null));};exports['verifySmtp']=function(_0x4d7778,_0x25ffa){return db['MailAccount'][_0xa069('0x4d')]({'where':{'id':_0x4d7778[_0xa069('0x4b')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xa069('0x30'),'raw':!![],'include':[{'model':db[_0xa069('0x9a')],'as':_0xa069('0x9a'),'raw':!![]}]}]})[_0xa069('0x12')](handleEntityNotFound(_0x25ffa,null))['then'](function(_0xd8369b){if(!_0xd8369b[_0xa069('0x30')])return;var _0x4caa53=_0xd8369b[_0xa069('0xa3')]();return respondWithRpcPromise(_0xa069('0xad'),'verifySmtp',{'account':_0x4caa53});})[_0xa069('0x12')](respondWithResult(_0x25ffa,null))[_0xa069('0x1c')](handleError(_0x25ffa,null));};exports['destroy']=function(_0x3729e6,_0x5f0ae3){return db[_0xa069('0x33')]['find']({'where':{'id':_0x3729e6[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x5f0ae3,null))[_0xa069('0x12')](function(_0x37503b){if(_0x37503b&&_0x37503b[_0xa069('0x6a')]){throw new db[(_0xa069('0xae'))][(_0xa069('0xaf'))](_0xa069('0xb0'));}return _0x37503b;})[_0xa069('0x12')](removeEntity(_0x5f0ae3,null))[_0xa069('0x1c')](handleError(_0x5f0ae3,null));};exports['addAgents']=function(_0x57ab01,_0x183a94){return db[_0xa069('0x33')][_0xa069('0x4d')]({'where':{'id':_0x57ab01[_0xa069('0x4b')]['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x183a94,null))[_0xa069('0x12')](function(_0xe79f8){if(_0xe79f8){return _0xe79f8[_0xa069('0xb1')](_0x57ab01[_0xa069('0x4e')][_0xa069('0x5c')],_[_0xa069('0xb2')](_0x57ab01[_0xa069('0x4e')],[_0xa069('0x5c'),'id'])||{})[_0xa069('0xb3')](function(_0x2993bc){for(var _0x2e3bb1=0x0;_0x2e3bb1<_0x57ab01[_0xa069('0x4e')]['ids'][_0xa069('0x3c')];_0x2e3bb1+=0x1){socket[_0xa069('0xb4')](_0xa069('0xb5'),{'UserId':Number(_0x57ab01[_0xa069('0x4e')][_0xa069('0x5c')][_0x2e3bb1]),'MailAccountId':Number(_0x57ab01[_0xa069('0x4b')]['id'])});}return _0x2993bc;});}})[_0xa069('0x12')](respondWithResult(_0x183a94,null))['catch'](handleError(_0x183a94,null));};exports[_0xa069('0xb6')]=function(_0x3c60e6,_0x1b6963){return db['MailAccount']['find']({'where':{'id':_0x3c60e6['params']['id']}})[_0xa069('0x12')](handleEntityNotFound(_0x1b6963,null))[_0xa069('0x12')](function(_0x42ba03){if(_0x42ba03){return _0x42ba03[_0xa069('0xb6')](_0x3c60e6['query'][_0xa069('0x5c')])[_0xa069('0x12')](function(){if(_[_0xa069('0xb7')](_0x3c60e6[_0xa069('0x35')]['ids'])){for(var _0x37ec6f=0x0;_0x37ec6f<_0x3c60e6[_0xa069('0x35')][_0xa069('0x5c')]['length'];_0x37ec6f+=0x1){socket[_0xa069('0xb4')](_0xa069('0xb8'),{'UserId':Number(_0x3c60e6[_0xa069('0x35')]['ids'][_0x37ec6f]),'MailAccountId':Number(_0x3c60e6['params']['id'])});}}else{socket[_0xa069('0xb4')](_0xa069('0xb8'),{'UserId':Number(_0x3c60e6[_0xa069('0x35')][_0xa069('0x5c')]),'MailAccountId':Number(_0x3c60e6[_0xa069('0x4b')]['id'])});}});}})[_0xa069('0x12')](respondWithStatusCode(_0x1b6963,null))['catch'](handleError(_0x1b6963,null));};exports[_0xa069('0xb9')]=function(_0x1ae02e,_0x1b34ff){var _0x92d69={};var _0x356641={};var _0x5ad3a9;var _0xbf126e;return db[_0xa069('0x33')]['findOne']({'where':{'id':_0x1ae02e[_0xa069('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b34ff,null))[_0xa069('0x12')](function(_0x5f2183){if(_0x5f2183){_0x5ad3a9=_0x5f2183;_0x356641['model']=_['keys'](db['User']['rawAttributes']);_0x356641['query']=_['keys'](_0x1ae02e[_0xa069('0x35')]);_0x356641[_0xa069('0x37')]=_['intersection'](_0x356641[_0xa069('0x3a')],_0x356641[_0xa069('0x35')]);_0x92d69[_0xa069('0x39')]=_['intersection'](_0x356641[_0xa069('0x3a')],qs[_0xa069('0x3b')](_0x1ae02e[_0xa069('0x35')][_0xa069('0x3b')]));_0x92d69[_0xa069('0x39')]=_0x92d69[_0xa069('0x39')][_0xa069('0x3c')]?_0x92d69['attributes']:_0x356641[_0xa069('0x3a')];_0x92d69[_0xa069('0x3e')]=qs[_0xa069('0x3f')](_0x1ae02e[_0xa069('0x35')][_0xa069('0x3f')]);_0x92d69[_0xa069('0x40')]=qs['filters'](_[_0xa069('0x41')](_0x1ae02e[_0xa069('0x35')],_0x356641[_0xa069('0x37')]));if(_0x1ae02e[_0xa069('0x35')][_0xa069('0x42')]){_0x92d69[_0xa069('0x40')]=_['merge'](_0x92d69[_0xa069('0x40')],{'$or':_[_0xa069('0x32')](_0x92d69[_0xa069('0x39')],function(_0x43b86a){var _0x1a2776={};_0x1a2776[_0x43b86a]={'$like':'%'+_0x1ae02e['query'][_0xa069('0x42')]+'%'};return _0x1a2776;})});}_0x92d69=_[_0xa069('0x45')]({},_0x92d69,_0x1ae02e['options']);return _0x5ad3a9[_0xa069('0xb9')](_0x92d69);}})[_0xa069('0x12')](function(_0x2599e7){if(_0x2599e7){_0xbf126e=_0x2599e7['length'];if(!_0x1ae02e[_0xa069('0x35')][_0xa069('0x59')](_0xa069('0x3d'))){_0x92d69[_0xa069('0x22')]=qs['limit'](_0x1ae02e['query']['limit']);_0x92d69['offset']=qs[_0xa069('0x20')](_0x1ae02e[_0xa069('0x35')][_0xa069('0x20')]);}return _0x5ad3a9[_0xa069('0xb9')](_0x92d69);}})[_0xa069('0x12')](function(_0x36d70f){if(_0x36d70f){return _0x36d70f?{'count':_0xbf126e,'rows':_0x36d70f}:null;}})[_0xa069('0x12')](respondWithResult(_0x1b34ff,null))[_0xa069('0x1c')](handleError(_0x1b34ff,null));}; \ No newline at end of file +var _0xb9d3=['limit','undefined','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','MailAccount','includeAll','findAll','show','params','include','find','update','body','modernAuthentication','CloudProviderId','describe','addDisposition','MailAccountId','Disposition','findOne','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','create','ListId','isNil','active','description','provider','user','password','pass','service','host','port','authentication','username','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','CmContact','Contact','User','fullname','internal','Tags','tag','addApplications','Transaction','ISOLATION_LEVELS','bulkCreate','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','split','CmList','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','List','Contacts','messageId','attach','out','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','util','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','offset'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0xb9d3,0x149));var _0x3b9d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb9d3[_0x40220a];return _0x3903cc;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x3b9d('0x0'));var path=require('path');var _=require(_0x3b9d('0x1'));var juice=require(_0x3b9d('0x2'));var Redis=require(_0x3b9d('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x3b9d('0x4'))(_0x3b9d('0x5'));var config=require(_0x3b9d('0x6'));var db=require(_0x3b9d('0x7'))['db'];config[_0x3b9d('0x8')]=_[_0x3b9d('0x9')](config['redis'],{'host':_0x3b9d('0xa'),'port':0x18eb});var socket=require(_0x3b9d('0xb'))(new Redis(config[_0x3b9d('0x8')]));require(_0x3b9d('0xc'))['register'](socket);var jayson=require(_0x3b9d('0xd'));var client=jayson['client'][_0x3b9d('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x169cba,_0x293814,_0x472103,_0x3cc4d4){return new BPromise(function(_0x14d939,_0x3b80eb){var _0x1b5e1e=_0x3cc4d4||client;return _0x1b5e1e['request'](_0x169cba,_0x472103)[_0x3b9d('0xf')](function(_0x5ceca2){logger[_0x3b9d('0x10')](_0x3b9d('0x11'),_0x293814,_0x3b9d('0x12'));logger[_0x3b9d('0x13')](_0x3b9d('0x14'),_0x293814,_0x3b9d('0x12'),JSON[_0x3b9d('0x15')](_0x5ceca2));if(_0x5ceca2['error']){if(_0x5ceca2['error'][_0x3b9d('0x16')]===0x1f4){logger[_0x3b9d('0x17')](_0x3b9d('0x11'),_0x293814,_0x5ceca2[_0x3b9d('0x17')][_0x3b9d('0x18')]);return _0x3b80eb(_0x5ceca2[_0x3b9d('0x17')][_0x3b9d('0x18')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x293814,_0x5ceca2[_0x3b9d('0x17')][_0x3b9d('0x18')]);return _0x14d939(_0x5ceca2[_0x3b9d('0x17')]['message']);}else{logger[_0x3b9d('0x10')](_0x3b9d('0x11'),_0x293814,_0x3b9d('0x12'));_0x14d939(_0x5ceca2[_0x3b9d('0x19')][_0x3b9d('0x18')]);}})[_0x3b9d('0x1a')](function(_0x49ab79){logger[_0x3b9d('0x17')](_0x3b9d('0x11'),_0x293814,_0x49ab79);_0x3b80eb(_0x49ab79);});});}function respondWithStatusCode(_0x1c4e60,_0x48c2d1){_0x48c2d1=_0x48c2d1||0xcc;return function(_0x4202aa){if(_0x4202aa){return _0x1c4e60['sendStatus'](_0x48c2d1);}return _0x1c4e60[_0x3b9d('0x1b')](_0x48c2d1)[_0x3b9d('0x1c')]();};}function respondWithResult(_0x13bc89,_0x57c85e){_0x57c85e=_0x57c85e||0xc8;return function(_0x3e806f){if(_0x3e806f){return _0x13bc89[_0x3b9d('0x1b')](_0x57c85e)[_0x3b9d('0x1d')](_0x3e806f);}};}function respondWithFilteredResult(_0x3e0bf1,_0x6c22bd){return function(_0x45ce7e){if(_0x45ce7e){var _0x5c36a8=typeof _0x6c22bd[_0x3b9d('0x1e')]==='undefined'&&typeof _0x6c22bd[_0x3b9d('0x1f')]===_0x3b9d('0x20');var _0x41f9d0=_0x45ce7e[_0x3b9d('0x21')];var _0x316372=_0x5c36a8?0x0:_0x6c22bd[_0x3b9d('0x1e')];var _0x3be03b=_0x5c36a8?_0x45ce7e[_0x3b9d('0x21')]:_0x6c22bd[_0x3b9d('0x1e')]+_0x6c22bd[_0x3b9d('0x1f')];var _0x5c47f;if(_0x3be03b>=_0x41f9d0){_0x3be03b=_0x41f9d0;_0x5c47f=0xc8;}else{_0x5c47f=0xce;}_0x3e0bf1[_0x3b9d('0x1b')](_0x5c47f);return _0x3e0bf1[_0x3b9d('0x22')](_0x3b9d('0x23'),_0x316372+'-'+_0x3be03b+'/'+_0x41f9d0)[_0x3b9d('0x1d')](_0x45ce7e);}return null;};}function saveUpdates(_0x494435){return function(_0xecf9ed){if(_0xecf9ed){return _0xecf9ed['update'](_0x494435)[_0x3b9d('0xf')](function(_0x2e76e3){return _0x2e76e3;});}return null;};}function removeEntity(_0x122657){return function(_0x39df29){if(_0x39df29){return _0x39df29[_0x3b9d('0x24')]()['then'](function(){var _0x38b80c=_0x39df29[_0x3b9d('0x25')]({'plain':!![]});var _0x395873=_0x3b9d('0x26');return db[_0x3b9d('0x27')][_0x3b9d('0x24')]({'where':{'type':_0x395873,'resourceId':_0x38b80c['id']}})[_0x3b9d('0xf')](function(){return _0x39df29;});})[_0x3b9d('0xf')](function(){_0x122657[_0x3b9d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa702c3){return function(_0xf7bb7d){if(!_0xf7bb7d){_0xa702c3[_0x3b9d('0x28')](0x194);}return _0xf7bb7d;};}function handleError(_0x5c38fe,_0x4b28e9){_0x4b28e9=_0x4b28e9||0x1f4;return function(_0x2706be){logger[_0x3b9d('0x17')](_0x2706be[_0x3b9d('0x29')]);if(_0x2706be[_0x3b9d('0x2a')]){delete _0x2706be['name'];}_0x5c38fe['status'](_0x4b28e9)['send'](_0x2706be);};}exports['index']=function(_0x3437fe,_0x207bd3){var _0xda7b4={'include':[{'model':db[_0x3b9d('0x2b')],'as':_0x3b9d('0x2c')},{'model':db[_0x3b9d('0x2d')],'as':_0x3b9d('0x2e')},{'model':db[_0x3b9d('0x2f')],'as':_0x3b9d('0x30')}]},_0x3cc1ba={},_0x1ee4a7={'count':0x0,'rows':[]};var _0x1a37cb=_['map'](db['MailAccount'][_0x3b9d('0x31')],function(_0x198c16){return{'name':_0x198c16['fieldName'],'type':_0x198c16[_0x3b9d('0x32')][_0x3b9d('0x33')]};});_0x3cc1ba[_0x3b9d('0x34')]=_['map'](_0x1a37cb,'name');_0x3cc1ba[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x3437fe[_0x3b9d('0x35')]);_0x3cc1ba[_0x3b9d('0x37')]=_[_0x3b9d('0x38')](_0x3cc1ba[_0x3b9d('0x34')],_0x3cc1ba[_0x3b9d('0x35')]);_0xda7b4[_0x3b9d('0x39')]=_['intersection'](_0x3cc1ba[_0x3b9d('0x34')],qs[_0x3b9d('0x3a')](_0x3437fe[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0xda7b4[_0x3b9d('0x39')]=_0xda7b4[_0x3b9d('0x39')][_0x3b9d('0x3b')]?_0xda7b4[_0x3b9d('0x39')]:_0x3cc1ba[_0x3b9d('0x34')];if(!_0x3437fe['query'][_0x3b9d('0x3c')](_0x3b9d('0x3d'))){_0xda7b4[_0x3b9d('0x1f')]=qs['limit'](_0x3437fe[_0x3b9d('0x35')][_0x3b9d('0x1f')]);_0xda7b4[_0x3b9d('0x1e')]=qs[_0x3b9d('0x1e')](_0x3437fe['query']['offset']);}_0xda7b4[_0x3b9d('0x3e')]=qs[_0x3b9d('0x3f')](_0x3437fe[_0x3b9d('0x35')][_0x3b9d('0x3f')]);_0xda7b4[_0x3b9d('0x40')]=qs[_0x3b9d('0x37')](_[_0x3b9d('0x41')](_0x3437fe[_0x3b9d('0x35')],_0x3cc1ba[_0x3b9d('0x37')]),_0x1a37cb);if(_0x3437fe[_0x3b9d('0x35')]['filter']){_0xda7b4[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0xda7b4[_0x3b9d('0x40')],{'$or':_[_0x3b9d('0x43')](_0x1a37cb,function(_0x448fca){if(_0x448fca[_0x3b9d('0x32')]!==_0x3b9d('0x44')){var _0x56bc74={};_0x56bc74[_0x448fca['name']]={'$like':'%'+_0x3437fe[_0x3b9d('0x35')]['filter']+'%'};return _0x56bc74;}})});}_0xda7b4=_['merge']({},_0xda7b4,_0x3437fe[_0x3b9d('0x45')]);var _0x6db743={'where':_0xda7b4[_0x3b9d('0x40')]};return db[_0x3b9d('0x46')][_0x3b9d('0x21')](_0x6db743)[_0x3b9d('0xf')](function(_0x32f4fb){_0x1ee4a7['count']=_0x32f4fb;if(_0x3437fe['query'][_0x3b9d('0x47')]){_0xda7b4['include']=[{'all':!![]}];}return db[_0x3b9d('0x46')][_0x3b9d('0x48')](_0xda7b4);})[_0x3b9d('0xf')](function(_0x47e96d){_0x1ee4a7['rows']=_0x47e96d;return _0x1ee4a7;})[_0x3b9d('0xf')](respondWithFilteredResult(_0x207bd3,_0xda7b4))['catch'](handleError(_0x207bd3,null));};exports[_0x3b9d('0x49')]=function(_0x3e21d4,_0x4d183a){var _0x388b86={'raw':![],'where':{'id':_0x3e21d4[_0x3b9d('0x4a')]['id']},'include':[{'model':db[_0x3b9d('0x2b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x3b9d('0x2e')},{'model':db[_0x3b9d('0x2f')],'as':'mandatoryDispositionPause'}]},_0x1d4fe1={};_0x1d4fe1[_0x3b9d('0x34')]=_[_0x3b9d('0x36')](db[_0x3b9d('0x46')][_0x3b9d('0x31')]);_0x1d4fe1[_0x3b9d('0x35')]=_['keys'](_0x3e21d4[_0x3b9d('0x35')]);_0x1d4fe1['filters']=_['intersection'](_0x1d4fe1[_0x3b9d('0x34')],_0x1d4fe1['query']);_0x388b86['attributes']=_[_0x3b9d('0x38')](_0x1d4fe1['model'],qs[_0x3b9d('0x3a')](_0x3e21d4[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0x388b86[_0x3b9d('0x39')]=_0x388b86['attributes'][_0x3b9d('0x3b')]?_0x388b86[_0x3b9d('0x39')]:_0x1d4fe1[_0x3b9d('0x34')];if(_0x3e21d4[_0x3b9d('0x35')]['includeAll']){_0x388b86[_0x3b9d('0x4b')]=[{'all':!![]}];}_0x388b86=_['merge']({},_0x388b86,_0x3e21d4[_0x3b9d('0x45')]);return db[_0x3b9d('0x46')][_0x3b9d('0x4c')](_0x388b86)[_0x3b9d('0xf')](handleEntityNotFound(_0x4d183a,null))[_0x3b9d('0xf')](respondWithResult(_0x4d183a,null))[_0x3b9d('0x1a')](handleError(_0x4d183a,null));};exports[_0x3b9d('0x4d')]=function(_0x4dcacd,_0x1e837b){if(_0x4dcacd['body']['id']){delete _0x4dcacd[_0x3b9d('0x4e')]['id'];}if(_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2c')]){if(!_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2c')][_0x3b9d('0x4f')]){_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2c')][_0x3b9d('0x50')]=null;}}if(_0x4dcacd['body'][_0x3b9d('0x2e')]){if(!_0x4dcacd['body']['Smtp'][_0x3b9d('0x4f')]){_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2e')][_0x3b9d('0x50')]=null;}}return db[_0x3b9d('0x46')]['find']({'where':{'id':_0x4dcacd[_0x3b9d('0x4a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3b9d('0x2c')},{'model':db[_0x3b9d('0x2d')],'as':'Smtp'},{'model':db[_0x3b9d('0x2f')],'as':'mandatoryDispositionPause'}]})[_0x3b9d('0xf')](handleEntityNotFound(_0x1e837b,null))[_0x3b9d('0xf')](saveUpdates(_0x4dcacd[_0x3b9d('0x4e')],null))[_0x3b9d('0xf')](function(_0x388470){if(_0x388470&&_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2c')]){return db[_0x3b9d('0x2b')]['update'](_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2c')],{'where':{'MailAccountId':_0x388470['id']}})['then'](function(){return _0x388470;});}return _0x388470;})[_0x3b9d('0xf')](function(_0x32eba8){if(_0x32eba8&&_0x4dcacd['body'][_0x3b9d('0x2e')]){return db[_0x3b9d('0x2d')][_0x3b9d('0x4d')](_0x4dcacd[_0x3b9d('0x4e')][_0x3b9d('0x2e')],{'where':{'MailAccountId':_0x32eba8['id']}})[_0x3b9d('0xf')](function(){return _0x32eba8;});}return _0x32eba8;})[_0x3b9d('0xf')](respondWithResult(_0x1e837b,null))[_0x3b9d('0x1a')](handleError(_0x1e837b,null));};exports[_0x3b9d('0x51')]=function(_0x599996,_0x5ab677){return db['MailAccount'][_0x3b9d('0x51')]()[_0x3b9d('0xf')](respondWithResult(_0x5ab677,null))[_0x3b9d('0x1a')](handleError(_0x5ab677,null));};exports[_0x3b9d('0x52')]=function(_0x4392e6,_0x289f49){if(_0x4392e6[_0x3b9d('0x4e')]['id']){delete _0x4392e6[_0x3b9d('0x4e')]['id'];}return db['MailAccount'][_0x3b9d('0x4c')]({'where':{'id':_0x4392e6[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x289f49,null))[_0x3b9d('0xf')](function(_0x3b934e){if(_0x3b934e){_0x4392e6[_0x3b9d('0x4e')][_0x3b9d('0x53')]=_0x3b934e['id'];return db[_0x3b9d('0x54')]['create'](_0x4392e6[_0x3b9d('0x4e')]);}})[_0x3b9d('0xf')](respondWithResult(_0x289f49,null))[_0x3b9d('0x1a')](handleError(_0x289f49,null));};exports['getDispositions']=function(_0x57edf8,_0x4402eb){var _0x234add={'raw':![],'where':{}};var _0x3c325b={};var _0x4b2423={'count':0x0,'rows':[]};return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x57edf8[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x4402eb,null))[_0x3b9d('0xf')](function(_0x3f06e9){if(_0x3f06e9){_0x3c325b[_0x3b9d('0x34')]=_['keys'](db[_0x3b9d('0x54')][_0x3b9d('0x31')]);_0x3c325b[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x57edf8[_0x3b9d('0x35')]);_0x3c325b['filters']=_[_0x3b9d('0x38')](_0x3c325b['model'],_0x3c325b[_0x3b9d('0x35')]);_0x234add[_0x3b9d('0x39')]=_[_0x3b9d('0x38')](_0x3c325b[_0x3b9d('0x34')],qs['fields'](_0x57edf8['query'][_0x3b9d('0x3a')]));_0x234add[_0x3b9d('0x39')]=_0x234add[_0x3b9d('0x39')]['length']?_0x234add[_0x3b9d('0x39')]:_0x3c325b[_0x3b9d('0x34')];if(!_0x57edf8[_0x3b9d('0x35')][_0x3b9d('0x3c')]('nolimit')){_0x234add[_0x3b9d('0x1f')]=qs['limit'](_0x57edf8['query']['limit']);_0x234add[_0x3b9d('0x1e')]=qs['offset'](_0x57edf8[_0x3b9d('0x35')][_0x3b9d('0x1e')]);}_0x234add['order']=qs[_0x3b9d('0x3f')](_0x57edf8[_0x3b9d('0x35')][_0x3b9d('0x3f')]);_0x234add['where']=qs[_0x3b9d('0x37')](_['pick'](_0x57edf8[_0x3b9d('0x35')],_0x3c325b['filters']));_0x234add['where'][_0x3b9d('0x53')]=_0x3f06e9['id'];if(_0x57edf8[_0x3b9d('0x35')][_0x3b9d('0x56')]){_0x234add[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0x234add['where'],{'$or':_[_0x3b9d('0x43')](_0x234add['attributes'],function(_0x589009){var _0x2392ae={};_0x2392ae[_0x589009]={'$like':'%'+_0x57edf8[_0x3b9d('0x35')][_0x3b9d('0x56')]+'%'};return _0x2392ae;})});}_0x234add=_['merge']({},_0x234add,_0x57edf8['options']);return db['Disposition'][_0x3b9d('0x21')]({'where':_0x234add[_0x3b9d('0x40')]})[_0x3b9d('0xf')](function(_0x19519e){_0x4b2423[_0x3b9d('0x21')]=_0x19519e;if(_0x57edf8[_0x3b9d('0x35')]['includeAll']){_0x234add[_0x3b9d('0x4b')]=[{'all':!![]}];}return db[_0x3b9d('0x54')]['findAll'](_0x234add);})['then'](function(_0x21773b){_0x4b2423['rows']=_0x21773b;return _0x4b2423;});}})[_0x3b9d('0xf')](respondWithFilteredResult(_0x4402eb,_0x234add))[_0x3b9d('0x1a')](handleError(_0x4402eb,null));};exports[_0x3b9d('0x57')]=function(_0x51ff03,_0x34a856){return db[_0x3b9d('0x46')]['find']({'where':{'id':_0x51ff03['params']['id']}})['then'](handleEntityNotFound(_0x34a856,null))[_0x3b9d('0xf')](function(_0x49badd){if(_0x49badd){return _0x49badd[_0x3b9d('0x57')](_0x51ff03[_0x3b9d('0x35')][_0x3b9d('0x58')]);}})[_0x3b9d('0xf')](respondWithStatusCode(_0x34a856,null))[_0x3b9d('0x1a')](handleError(_0x34a856,null));};exports[_0x3b9d('0x59')]=function(_0x1b92d5,_0x4e85f3){if(_0x1b92d5[_0x3b9d('0x4e')]['id']){delete _0x1b92d5['body']['id'];}return db['MailAccount'][_0x3b9d('0x4c')]({'where':{'id':_0x1b92d5[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x4e85f3,null))[_0x3b9d('0xf')](function(_0x43d525){if(_0x43d525){_0x1b92d5['body']['MailAccountId']=_0x43d525['id'];return db[_0x3b9d('0x5a')]['create'](_0x1b92d5['body']);}})['then'](respondWithResult(_0x4e85f3,null))[_0x3b9d('0x1a')](handleError(_0x4e85f3,null));};exports[_0x3b9d('0x5b')]=function(_0x1f0049,_0x1f8978){var _0x39af43={'raw':![],'where':{}};var _0x92c41={};var _0x58c0d1={'count':0x0,'rows':[]};return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x1f0049['params']['id']}})['then'](handleEntityNotFound(_0x1f8978,null))[_0x3b9d('0xf')](function(_0x10c0b8){if(_0x10c0b8){_0x92c41[_0x3b9d('0x34')]=_[_0x3b9d('0x36')](db[_0x3b9d('0x5a')][_0x3b9d('0x31')]);_0x92c41[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x1f0049['query']);_0x92c41['filters']=_[_0x3b9d('0x38')](_0x92c41['model'],_0x92c41['query']);_0x39af43[_0x3b9d('0x39')]=_[_0x3b9d('0x38')](_0x92c41[_0x3b9d('0x34')],qs[_0x3b9d('0x3a')](_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0x39af43[_0x3b9d('0x39')]=_0x39af43[_0x3b9d('0x39')]['length']?_0x39af43[_0x3b9d('0x39')]:_0x92c41['model'];if(!_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x3c')](_0x3b9d('0x3d'))){_0x39af43[_0x3b9d('0x1f')]=qs[_0x3b9d('0x1f')](_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x1f')]);_0x39af43[_0x3b9d('0x1e')]=qs[_0x3b9d('0x1e')](_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x1e')]);}_0x39af43[_0x3b9d('0x3e')]=qs[_0x3b9d('0x3f')](_0x1f0049[_0x3b9d('0x35')]['sort']);_0x39af43['where']=qs['filters'](_[_0x3b9d('0x41')](_0x1f0049[_0x3b9d('0x35')],_0x92c41['filters']));_0x39af43['where'][_0x3b9d('0x53')]=_0x10c0b8['id'];if(_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x56')]){_0x39af43[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0x39af43[_0x3b9d('0x40')],{'$or':_[_0x3b9d('0x43')](_0x39af43[_0x3b9d('0x39')],function(_0xce4c0a){var _0x2fe63c={};_0x2fe63c[_0xce4c0a]={'$like':'%'+_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x56')]+'%'};return _0x2fe63c;})});}_0x39af43=_[_0x3b9d('0x42')]({},_0x39af43,_0x1f0049[_0x3b9d('0x45')]);return db[_0x3b9d('0x5a')][_0x3b9d('0x21')]({'where':_0x39af43[_0x3b9d('0x40')]})[_0x3b9d('0xf')](function(_0x2de825){_0x58c0d1[_0x3b9d('0x21')]=_0x2de825;if(_0x1f0049[_0x3b9d('0x35')][_0x3b9d('0x47')]){_0x39af43[_0x3b9d('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3b9d('0x48')](_0x39af43);})['then'](function(_0x432058){_0x58c0d1[_0x3b9d('0x5c')]=_0x432058;return _0x58c0d1;});}})['then'](respondWithFilteredResult(_0x1f8978,_0x39af43))[_0x3b9d('0x1a')](handleError(_0x1f8978,null));};exports[_0x3b9d('0x5d')]=function(_0x494d7f,_0x2fa8f7){return db[_0x3b9d('0x46')]['find']({'where':{'id':_0x494d7f['params']['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x2fa8f7,null))[_0x3b9d('0xf')](function(_0x22e70f){if(_0x22e70f){return _0x22e70f['removeAnswers'](_0x494d7f[_0x3b9d('0x35')][_0x3b9d('0x58')]);}})[_0x3b9d('0xf')](respondWithStatusCode(_0x2fa8f7,null))[_0x3b9d('0x1a')](handleError(_0x2fa8f7,null));};exports[_0x3b9d('0x5e')]=function(_0x196348,_0x5de4bb){var _0x1d23cd={'name':_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x2a')],'key':_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x33')],'provider':_0x196348[_0x3b9d('0x4e')]['provider']==='custom'?null:_0x196348[_0x3b9d('0x4e')]['provider'],'email':_0x196348[_0x3b9d('0x4e')]['email'],'ListId':_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x5f')],'active':!_[_0x3b9d('0x60')](_0x196348['body'][_0x3b9d('0x61')])?_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x61')]:!![],'description':_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x62')]||null,'Imap':{},'Smtp':{}};if(_0x1d23cd[_0x3b9d('0x63')]){_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x64')]=_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x64')]=_0x196348['body']['username'];_0x1d23cd['Imap'][_0x3b9d('0x65')]=_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x66')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x65')];if(_0x196348[_0x3b9d('0x4e')]['modernAuthentication']){_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x4f')]=_0x1d23cd[_0x3b9d('0x2e')]['modernAuthentication']=!![];_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x50')]=_0x1d23cd['Smtp'][_0x3b9d('0x50')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x50')];_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x65')]=_0x1d23cd[_0x3b9d('0x2e')]['pass']=null;}else{_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x50')]=_0x1d23cd['Smtp'][_0x3b9d('0x50')]=null;}_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x67')]=_0x1d23cd['Smtp'][_0x3b9d('0x67')]=null;_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x68')]=_0x1d23cd['Smtp'][_0x3b9d('0x68')]=null;_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x69')]=_0x1d23cd['Smtp'][_0x3b9d('0x69')]=null;}else{if(_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x6a')]){_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x64')]=_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x64')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x6b')];_0x1d23cd[_0x3b9d('0x2c')]['password']=_0x1d23cd['Smtp'][_0x3b9d('0x66')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x65')];}else{_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x6a')]=_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x6a')]=![];_0x1d23cd[_0x3b9d('0x2c')]['user']=_0x1d23cd['Smtp'][_0x3b9d('0x64')]=null;_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x65')]=_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x66')]=null;}_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x68')]=_0x196348['body'][_0x3b9d('0x2c')][_0x3b9d('0x68')];_0x1d23cd[_0x3b9d('0x2c')][_0x3b9d('0x69')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x2c')][_0x3b9d('0x69')];_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x68')]=_0x196348['body']['Smtp']['host'];_0x1d23cd[_0x3b9d('0x2e')][_0x3b9d('0x69')]=_0x196348[_0x3b9d('0x4e')][_0x3b9d('0x2e')][_0x3b9d('0x69')];}return db[_0x3b9d('0x46')]['create'](_0x1d23cd,{'include':[{'model':db['MailServerOut'],'as':_0x3b9d('0x2e')},{'model':db[_0x3b9d('0x2b')],'as':_0x3b9d('0x2c')}]})['then'](function(_0x1fc061){var _0x287e72=_0x196348['user'][_0x3b9d('0x25')]({'plain':!![]});if(!_0x287e72)throw new Error(_0x3b9d('0x6c'));if(_0x287e72['role']==='user'){var _0x4f4659=_0x1fc061[_0x3b9d('0x25')]({'plain':!![]});return db[_0x3b9d('0x6d')]['find']({'where':{'name':_0x3b9d('0x26'),'userProfileId':_0x287e72['userProfileId']},'raw':!![]})[_0x3b9d('0xf')](function(_0x2a6899){if(_0x2a6899&&_0x2a6899[_0x3b9d('0x6e')]===0x0){return db[_0x3b9d('0x27')]['create']({'name':_0x4f4659[_0x3b9d('0x2a')],'resourceId':_0x4f4659['id'],'type':_0x2a6899['name'],'sectionId':_0x2a6899['id']},{})[_0x3b9d('0xf')](function(){return _0x1fc061;});}else{return _0x1fc061;}})[_0x3b9d('0x1a')](function(_0x593799){logger['error'](_0x3b9d('0x6f'),_0x593799);throw _0x593799;});}return _0x1fc061;})[_0x3b9d('0xf')](respondWithResult(_0x5de4bb,0xc9))[_0x3b9d('0x1a')](handleError(_0x5de4bb,null));};exports[_0x3b9d('0x70')]=function(_0x378f21,_0x115637){return db['MailAccount'][_0x3b9d('0x55')]({'where':{'id':_0x378f21[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x115637,null))[_0x3b9d('0xf')](function(_0x12c87f){if(_0x12c87f){return _0x12c87f[_0x3b9d('0x70')]();}return null;})[_0x3b9d('0xf')](respondWithResult(_0x115637,null))['catch'](handleError(_0x115637,null));};exports[_0x3b9d('0x71')]=function(_0x5effbb,_0x3f5a06){if(_0x5effbb['body']['id']){delete _0x5effbb['body']['id'];}return db[_0x3b9d('0x46')][_0x3b9d('0x4c')]({'where':{'id':_0x5effbb[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x3f5a06,null))[_0x3b9d('0xf')](function(_0x87a2db){if(_0x87a2db){_0x5effbb[_0x3b9d('0x4e')]['MailAccountId']=_0x87a2db['id'];return db[_0x3b9d('0x2b')]['create'](_0x5effbb['body']);}})[_0x3b9d('0xf')](respondWithResult(_0x3f5a06,null))[_0x3b9d('0x1a')](handleError(_0x3f5a06,null));};exports[_0x3b9d('0x72')]=function(_0x7dbb17,_0x3aaf31){return db['MailAccount'][_0x3b9d('0x55')]({'where':{'id':_0x7dbb17[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x3aaf31,null))[_0x3b9d('0xf')](function(_0x452722){if(_0x452722){return _0x452722[_0x3b9d('0x73')](null);}return null;})[_0x3b9d('0xf')](respondWithStatusCode(_0x3aaf31,null))['catch'](handleError(_0x3aaf31,null));};exports['getSmtp']=function(_0x5fb907,_0x37a7d5){return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x5fb907[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x37a7d5,null))['then'](function(_0x5613c9){if(_0x5613c9){return _0x5613c9[_0x3b9d('0x74')]();}return null;})['then'](respondWithResult(_0x37a7d5,null))[_0x3b9d('0x1a')](handleError(_0x37a7d5,null));};exports['addSmtp']=function(_0x497b47,_0x541a4d){if(_0x497b47['body']['id']){delete _0x497b47['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x497b47[_0x3b9d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x541a4d,null))[_0x3b9d('0xf')](function(_0x2f765d){if(_0x2f765d){_0x497b47[_0x3b9d('0x4e')][_0x3b9d('0x53')]=_0x2f765d['id'];return db[_0x3b9d('0x2d')][_0x3b9d('0x5e')](_0x497b47[_0x3b9d('0x4e')]);}})['then'](respondWithResult(_0x541a4d,null))[_0x3b9d('0x1a')](handleError(_0x541a4d,null));};exports[_0x3b9d('0x75')]=function(_0x175e97,_0x231289){return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x175e97[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x231289,null))[_0x3b9d('0xf')](function(_0xf6d56b){if(_0xf6d56b){return _0xf6d56b[_0x3b9d('0x76')](null);}return null;})[_0x3b9d('0xf')](respondWithStatusCode(_0x231289,null))[_0x3b9d('0x1a')](handleError(_0x231289,null));};exports['addInteraction']=function(_0x230655,_0x4c416e){return db[_0x3b9d('0x77')][_0x3b9d('0x4c')]({'where':{'id':_0x230655[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x4c416e,null))['then'](function(_0x48ea8d){if(_0x48ea8d){return _0x48ea8d[_0x3b9d('0x78')](_0x230655[_0x3b9d('0x4e')][_0x3b9d('0x58')],_['omit'](_0x230655[_0x3b9d('0x4e')],['ids','id'])||{});}})['then'](respondWithResult(_0x4c416e,null))['catch'](handleError(_0x4c416e,null));};exports['getInteractions']=function(_0x5e177b,_0x188813){var _0x899f8e={'raw':![],'where':{}};var _0x544da7={};var _0x328d82={'count':0x0,'rows':[]};return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x5e177b[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x188813,null))[_0x3b9d('0xf')](function(_0x490234){if(_0x490234){_0x544da7[_0x3b9d('0x34')]=_['keys'](db[_0x3b9d('0x77')]['rawAttributes']);_0x544da7[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x5e177b[_0x3b9d('0x35')]);_0x544da7['filters']=_[_0x3b9d('0x38')](_0x544da7[_0x3b9d('0x34')],_0x544da7[_0x3b9d('0x35')]);_0x899f8e[_0x3b9d('0x39')]=_[_0x3b9d('0x38')](_0x544da7[_0x3b9d('0x34')],qs['fields'](_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0x899f8e[_0x3b9d('0x39')]=_0x899f8e[_0x3b9d('0x39')][_0x3b9d('0x3b')]?_0x899f8e[_0x3b9d('0x39')]:_0x544da7[_0x3b9d('0x34')];if(!_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x3c')]('nolimit')){_0x899f8e[_0x3b9d('0x1f')]=qs[_0x3b9d('0x1f')](_0x5e177b['query'][_0x3b9d('0x1f')]);_0x899f8e[_0x3b9d('0x1e')]=qs[_0x3b9d('0x1e')](_0x5e177b['query'][_0x3b9d('0x1e')]);}_0x899f8e[_0x3b9d('0x3e')]=qs[_0x3b9d('0x3f')](_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x3f')]);_0x899f8e[_0x3b9d('0x40')]=qs[_0x3b9d('0x37')](_['pick'](_0x5e177b[_0x3b9d('0x35')],_0x544da7[_0x3b9d('0x37')]));_0x899f8e[_0x3b9d('0x40')][_0x3b9d('0x53')]=_0x490234['id'];if(_0x5e177b[_0x3b9d('0x35')]['filter']){_0x899f8e['where']=_['merge'](_0x899f8e[_0x3b9d('0x40')],{'$or':_[_0x3b9d('0x43')](_0x899f8e[_0x3b9d('0x39')],function(_0x240be4){var _0x2bb29c={};_0x2bb29c[_0x240be4]={'$like':'%'+_0x5e177b['query']['filter']+'%'};return _0x2bb29c;})});}_0x899f8e=_[_0x3b9d('0x42')]({},_0x899f8e,_0x5e177b['options']);return db['MailInteraction'][_0x3b9d('0x21')]({'where':_0x899f8e[_0x3b9d('0x40')]})['then'](function(_0x3a6f96){_0x328d82[_0x3b9d('0x21')]=_0x3a6f96;if(_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x47')]){_0x899f8e['include']=[{'model':db[_0x3b9d('0x79')],'as':_0x3b9d('0x7a'),'required':![]},{'model':db[_0x3b9d('0x7b')],'as':'Owner','attributes':[_0x3b9d('0x2a'),_0x3b9d('0x7c'),_0x3b9d('0x7d')],'required':![]},{'model':db['Tag'],'as':_0x3b9d('0x7e'),'attributes':['id',_0x3b9d('0x2a'),'color'],'where':_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x7f')]?{'id':_0x5e177b[_0x3b9d('0x35')]['tag']}:undefined,'required':_0x5e177b[_0x3b9d('0x35')][_0x3b9d('0x7f')]?!![]:![]}];}return db[_0x3b9d('0x77')][_0x3b9d('0x48')](_0x899f8e);})[_0x3b9d('0xf')](function(_0x3acd67){_0x328d82['rows']=_0x3acd67;return _0x328d82;});}})['then'](respondWithFilteredResult(_0x188813,_0x899f8e))[_0x3b9d('0x1a')](handleError(_0x188813,null));};exports[_0x3b9d('0x80')]=function addApplications(_0x1c58a6,_0x34dc17){var _0x235bfd=_0x1c58a6['params']['id'];var _0x1ef3fc=_0x1c58a6[_0x3b9d('0x4e')];var _0x203a6f=0xc8;var _0x59288e=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x3b9d('0x81')][_0x3b9d('0x82')]['READ_COMMITTED']},function(_0x32ca25){return db[_0x3b9d('0x46')][_0x3b9d('0x55')]({'where':{'id':_0x235bfd},'transaction':_0x32ca25})[_0x3b9d('0xf')](function(_0x1ad090){if(_0x1ad090){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x235bfd},'transaction':_0x32ca25})['then'](function(){var _0xe9a48f=_[_0x3b9d('0x43')](_0x1ef3fc,function(_0x5812bb){_0x5812bb[_0x3b9d('0x53')]=_0x235bfd;return _0x5812bb;});return db['MailApplication'][_0x3b9d('0x83')](_0xe9a48f,{'transaction':_0x32ca25});});}else{_0x203a6f=0x194;_0x59288e=[];}});})[_0x3b9d('0xf')](function(){if(_0x203a6f!==0x194){return db[_0x3b9d('0x84')][_0x3b9d('0x85')]({'where':{'MailAccountId':_0x235bfd},'order':_0x3b9d('0x86')})[_0x3b9d('0xf')](function(_0x89f62a){_0x59288e=_0x89f62a;});}})[_0x3b9d('0x1a')](function(_0x499b6f){_0x203a6f=0x1f4;logger[_0x3b9d('0x17')](_0x499b6f[_0x3b9d('0x29')]);if(_0x499b6f[_0x3b9d('0x2a')]){delete _0x499b6f[_0x3b9d('0x2a')];}_0x59288e=_0x499b6f;})[_0x3b9d('0x87')](function(){if(_0x59288e===null){_0x34dc17[_0x3b9d('0x28')](_0x203a6f);}else{if(_0x203a6f===0x1f4){_0x34dc17['status'](_0x203a6f)['send'](_0x59288e);}else{_0x34dc17[_0x3b9d('0x1b')](_0x203a6f)[_0x3b9d('0x1d')](_0x59288e);}}});};exports['getApplications']=function(_0x157f14,_0x41cc73){var _0x13d313={};var _0x262e01={};var _0x5a3a87;var _0x237be1;return db[_0x3b9d('0x46')]['findOne']({'where':{'id':_0x157f14['params']['id']}})['then'](handleEntityNotFound(_0x41cc73,null))[_0x3b9d('0xf')](function(_0x3a2fe6){if(_0x3a2fe6){_0x5a3a87=_0x3a2fe6;_0x262e01[_0x3b9d('0x34')]=_[_0x3b9d('0x36')](db[_0x3b9d('0x84')][_0x3b9d('0x31')]);_0x262e01[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x157f14['query']);_0x262e01[_0x3b9d('0x37')]=_[_0x3b9d('0x38')](_0x262e01['model'],_0x262e01[_0x3b9d('0x35')]);_0x13d313['attributes']=_['intersection'](_0x262e01[_0x3b9d('0x34')],qs[_0x3b9d('0x3a')](_0x157f14[_0x3b9d('0x35')]['fields']));_0x13d313['attributes']=_0x13d313[_0x3b9d('0x39')][_0x3b9d('0x3b')]?_0x13d313[_0x3b9d('0x39')]:_0x262e01[_0x3b9d('0x34')];_0x13d313[_0x3b9d('0x3e')]=qs[_0x3b9d('0x3f')](_0x157f14[_0x3b9d('0x35')]['sort']);_0x13d313[_0x3b9d('0x40')]=qs[_0x3b9d('0x37')](_[_0x3b9d('0x41')](_0x157f14[_0x3b9d('0x35')],_0x262e01[_0x3b9d('0x37')]));if(_0x157f14[_0x3b9d('0x35')][_0x3b9d('0x56')]){_0x13d313['where']=_[_0x3b9d('0x42')](_0x13d313[_0x3b9d('0x40')],{'$or':_[_0x3b9d('0x43')](_0x13d313[_0x3b9d('0x39')],function(_0xd13b2c){var _0x5ed5ce={};_0x5ed5ce[_0xd13b2c]={'$like':'%'+_0x157f14[_0x3b9d('0x35')]['filter']+'%'};return _0x5ed5ce;})});}_0x13d313=_[_0x3b9d('0x42')]({},_0x13d313,_0x157f14[_0x3b9d('0x45')]);return _0x5a3a87['getApplications'](_0x13d313);}})[_0x3b9d('0xf')](function(_0x16b5af){if(_0x16b5af){_0x237be1=_0x16b5af['length'];if(!_0x157f14[_0x3b9d('0x35')]['hasOwnProperty'](_0x3b9d('0x3d'))){_0x13d313[_0x3b9d('0x1f')]=qs[_0x3b9d('0x1f')](_0x157f14['query']['limit']);_0x13d313[_0x3b9d('0x1e')]=qs['offset'](_0x157f14[_0x3b9d('0x35')][_0x3b9d('0x1e')]);}return _0x5a3a87[_0x3b9d('0x88')](_0x13d313);}})[_0x3b9d('0xf')](function(_0x134704){if(_0x134704){return _0x134704?{'count':_0x237be1,'rows':_0x134704}:null;}})[_0x3b9d('0xf')](respondWithResult(_0x41cc73,null))[_0x3b9d('0x1a')](handleError(_0x41cc73,null));};exports['getMessages']=function(_0x4e683f,_0x282950){var _0x4f0ced={'raw':!![],'where':{}};var _0x33dbb7={};var _0xf704b2={'count':0x0,'rows':[]};return db[_0x3b9d('0x46')]['findOne']({'where':{'id':_0x4e683f[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x282950,null))[_0x3b9d('0xf')](function(_0x57b134){if(_0x57b134){_0x33dbb7[_0x3b9d('0x34')]=_[_0x3b9d('0x36')](db[_0x3b9d('0x89')][_0x3b9d('0x31')]);_0x33dbb7[_0x3b9d('0x35')]=_['keys'](_0x4e683f[_0x3b9d('0x35')]);_0x33dbb7[_0x3b9d('0x37')]=_['intersection'](_0x33dbb7[_0x3b9d('0x34')],_0x33dbb7['query']);_0x4f0ced[_0x3b9d('0x39')]=_[_0x3b9d('0x38')](_0x33dbb7['model'],qs[_0x3b9d('0x3a')](_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0x4f0ced[_0x3b9d('0x39')]=_0x4f0ced['attributes'][_0x3b9d('0x3b')]?_0x4f0ced[_0x3b9d('0x39')]:_0x33dbb7[_0x3b9d('0x34')];if(!_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x3c')](_0x3b9d('0x3d'))){_0x4f0ced[_0x3b9d('0x1f')]=qs[_0x3b9d('0x1f')](_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x1f')]);_0x4f0ced['offset']=qs['offset'](_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x1e')]);}_0x4f0ced[_0x3b9d('0x3e')]=qs[_0x3b9d('0x3f')](_0x4e683f['query'][_0x3b9d('0x3f')]);_0x4f0ced[_0x3b9d('0x40')]=qs[_0x3b9d('0x37')](_[_0x3b9d('0x41')](_0x4e683f[_0x3b9d('0x35')],_0x33dbb7[_0x3b9d('0x37')]));_0x4f0ced[_0x3b9d('0x40')]['MailAccountId']=_0x57b134['id'];if(_0x4e683f[_0x3b9d('0x35')]['filter']){_0x4f0ced[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0x4f0ced[_0x3b9d('0x40')],{'$or':_[_0x3b9d('0x43')](_0x4f0ced[_0x3b9d('0x39')],function(_0x2e063f){var _0x15f4a2={};_0x15f4a2[_0x2e063f]={'$like':'%'+_0x4e683f['query'][_0x3b9d('0x56')]+'%'};return _0x15f4a2;})});}if(_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x8a')]){var _0x244e5b=_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x8a')]['split'](',');var _0x5786ce={};_0x5786ce[_0x244e5b[0x0]]={'$gte':moment(_0x244e5b[0x1])[_0x3b9d('0x8b')](_0x3b9d('0x8c'))};_0x4f0ced[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0x4f0ced['where'],_0x5786ce);}_0x4f0ced=_['merge']({},_0x4f0ced,_0x4e683f['options']);return db['MailMessage'][_0x3b9d('0x21')]({'where':_0x4f0ced['where']})[_0x3b9d('0xf')](function(_0x5766bb){_0xf704b2[_0x3b9d('0x21')]=_0x5766bb;if(_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x47')]){_0x4f0ced[_0x3b9d('0x4b')]=[{'all':!![]}];}return db[_0x3b9d('0x89')][_0x3b9d('0x48')](_0x4f0ced);})[_0x3b9d('0xf')](function(_0x487552){if(_0x4e683f[_0x3b9d('0x35')][_0x3b9d('0x8d')]===_0x3b9d('0x8e')){for(var _0x189398=0x0;_0x189398<_0x487552[_0x3b9d('0x3b')];_0x189398++){_0x487552[_0x189398][_0x3b9d('0x4e')]=juice(_0x487552[_0x189398][_0x3b9d('0x4e')]);}}_0xf704b2[_0x3b9d('0x5c')]=_0x487552;return _0xf704b2;});}})[_0x3b9d('0xf')](respondWithFilteredResult(_0x282950,_0x4f0ced))['catch'](handleError(_0x282950,null));};exports[_0x3b9d('0x8f')]=function(_0x3c60e2,_0x248133){var _0x4eee5a,_0x5c8efa={},_0x25eb0e;if(_0x3c60e2[_0x3b9d('0x4e')]['to']){_0x25eb0e=_0x3c60e2[_0x3b9d('0x4e')]['to'][_0x3b9d('0x90')](',')[0x0];}return db['MailAccount'][_0x3b9d('0x4c')]({'where':{'id':_0x3c60e2['params']['id']},'include':[{'model':db[_0x3b9d('0x91')],'as':'List','include':[{'model':db[_0x3b9d('0x79')],'as':'Contacts','where':{'email':_0x25eb0e},'limit':0x1,'order':[[_0x3b9d('0x92'),_0x3b9d('0x93')]]}]},{'model':db['MailServerOut'],'as':_0x3b9d('0x2e'),'raw':!![],'include':[{'model':db[_0x3b9d('0x94')],'as':_0x3b9d('0x94'),'raw':!![]}]}]})[_0x3b9d('0xf')](handleEntityNotFound(_0x248133,null))[_0x3b9d('0xf')](function(_0x596f98){if(!_0x596f98)return;_0x4eee5a=_0x596f98;if(!_0x596f98[_0x3b9d('0x2e')])throw new Error(_0x3b9d('0x95'));if(_[_0x3b9d('0x60')](_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0x96')])){_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0x96')]=util[_0x3b9d('0x8b')](_0x3b9d('0x97'),_0x596f98[_0x3b9d('0x2a')],_0x596f98[_0x3b9d('0x98')]||_0x596f98[_0x3b9d('0x2e')]['user']);}if(_0x3c60e2[_0x3b9d('0x4e')]['attachments']&&_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0x99')]['length']){for(var _0x139c0d=0x0;_0x139c0d<_0x3c60e2[_0x3b9d('0x4e')]['attachments'][_0x3b9d('0x3b')];_0x139c0d+=0x1){_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0x99')][_0x139c0d]={'filename':_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0x99')][_0x139c0d]['name'],'path':path[_0x3b9d('0x9a')](config[_0x3b9d('0x9b')],_0x3b9d('0x9c'),_0x3c60e2[_0x3b9d('0x4e')]['attachments'][_0x139c0d][_0x3b9d('0x9d')])};}}var _0x4d2479=_0x596f98['getSmtpOptions']();return respondWithRpcPromise(_0x3b9d('0x9e'),_0x3b9d('0x9f'),{'account':_0x4d2479,'message':_0x3c60e2[_0x3b9d('0x4e')]});})[_0x3b9d('0xf')](function(_0xfb36ea){if(!_0xfb36ea)return;_0x5c8efa=_0xfb36ea;if(!_0x4eee5a['List'])throw new Error(_0x3b9d('0xa0'));if(_0x4eee5a[_0x3b9d('0xa1')][_0x3b9d('0xa2')][_0x3b9d('0x3b')])return _0x4eee5a[_0x3b9d('0xa1')]['Contacts'][0x0];return db[_0x3b9d('0x79')]['create'](_[_0x3b9d('0x9')](_0x3c60e2[_0x3b9d('0x4e')],{'firstName':_0x3c60e2['body']['to'],'email':_0x3c60e2['body']['to'],'phone':_0x3c60e2['body']['to'],'ListId':_0x4eee5a['ListId']}));})['then'](function(_0x74b996){if(!_0x74b996)return;var _0x2f0747={'UserId':_0x3c60e2['user']['id'],'ContactId':_0x74b996['id'],'MailAccountId':_0x4eee5a['id'],'inReplyTo':_0x5c8efa[_0x3b9d('0xa3')],'to':_0x3c60e2[_0x3b9d('0x4e')]['from'],'cc':_0x3c60e2[_0x3b9d('0x4e')]['cc'],'subject':_0x3c60e2['body']['subject'],'attach':_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0xa4')],'firstMsgDirection':_0x3b9d('0xa5'),'lastMsgAt':moment()[_0x3b9d('0x8b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x3b9d('0xa5'),'Messages':[_['merge'](_0x3c60e2[_0x3b9d('0x4e')],{'messageId':_0x5c8efa[_0x3b9d('0xa3')],'sentAt':moment()[_0x3b9d('0x8b')](_0x3b9d('0x8c')),'read':!![],'MailAccountId':_0x4eee5a['id'],'UserId':_0x3c60e2[_0x3b9d('0x64')]['id'],'ContactId':_0x74b996['id']})]};if(_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0xa6')]){_0x2f0747=_['merge'](_0x2f0747,_0x3c60e2[_0x3b9d('0x4e')][_0x3b9d('0xa6')]);}return db[_0x3b9d('0x77')][_0x3b9d('0x5e')](_0x2f0747,{'include':[{'model':db[_0x3b9d('0x89')],'as':'Messages'}]});})[_0x3b9d('0xf')](respondWithResult(_0x248133,null))[_0x3b9d('0x1a')](handleError(_0x248133,null));};exports[_0x3b9d('0xa7')]=function(_0x18428b,_0x3c3839){return db[_0x3b9d('0x46')][_0x3b9d('0x4c')]({'where':{'id':_0x18428b[_0x3b9d('0x4a')]['id']},'include':[{'model':db[_0x3b9d('0x2d')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x3b9d('0xf')](handleEntityNotFound(_0x3c3839,null))[_0x3b9d('0xf')](function(_0x559049){if(!_0x559049[_0x3b9d('0x2e')])return;var _0x477466=_0x559049[_0x3b9d('0xa8')]();return respondWithRpcPromise(_0x3b9d('0xa9'),_0x3b9d('0xa7'),{'account':_0x477466});})['then'](respondWithResult(_0x3c3839,null))[_0x3b9d('0x1a')](handleError(_0x3c3839,null));};exports['destroy']=function(_0xa742da,_0x4ae79c){return db[_0x3b9d('0x46')][_0x3b9d('0x4c')]({'where':{'id':_0xa742da[_0x3b9d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ae79c,null))['then'](function(_0x2a3e48){if(_0x2a3e48&&_0x2a3e48['service']){throw new db[(_0x3b9d('0xaa'))][(_0x3b9d('0xab'))](_0x3b9d('0xac'));}return _0x2a3e48;})[_0x3b9d('0xf')](removeEntity(_0x4ae79c,null))[_0x3b9d('0x1a')](handleError(_0x4ae79c,null));};exports[_0x3b9d('0xad')]=function(_0x53fad9,_0x8c0e4e){return db[_0x3b9d('0x46')][_0x3b9d('0x4c')]({'where':{'id':_0x53fad9[_0x3b9d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8c0e4e,null))[_0x3b9d('0xf')](function(_0xdfdbfc){if(_0xdfdbfc){return _0xdfdbfc[_0x3b9d('0xad')](_0x53fad9[_0x3b9d('0x4e')][_0x3b9d('0x58')],_['omit'](_0x53fad9[_0x3b9d('0x4e')],[_0x3b9d('0x58'),'id'])||{})[_0x3b9d('0xae')](function(_0x1b841e){for(var _0x191812=0x0;_0x191812<_0x53fad9[_0x3b9d('0x4e')][_0x3b9d('0x58')][_0x3b9d('0x3b')];_0x191812+=0x1){socket['emit'](_0x3b9d('0xaf'),{'UserId':Number(_0x53fad9[_0x3b9d('0x4e')][_0x3b9d('0x58')][_0x191812]),'MailAccountId':Number(_0x53fad9[_0x3b9d('0x4a')]['id'])});}return _0x1b841e;});}})[_0x3b9d('0xf')](respondWithResult(_0x8c0e4e,null))['catch'](handleError(_0x8c0e4e,null));};exports['removeAgents']=function(_0x20f22d,_0x34cd83){return db['MailAccount'][_0x3b9d('0x4c')]({'where':{'id':_0x20f22d[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x34cd83,null))[_0x3b9d('0xf')](function(_0x131602){if(_0x131602){return _0x131602[_0x3b9d('0xb0')](_0x20f22d[_0x3b9d('0x35')][_0x3b9d('0x58')])[_0x3b9d('0xf')](function(){if(_['isArray'](_0x20f22d['query'][_0x3b9d('0x58')])){for(var _0x722e3c=0x0;_0x722e3c<_0x20f22d[_0x3b9d('0x35')]['ids'][_0x3b9d('0x3b')];_0x722e3c+=0x1){socket[_0x3b9d('0xb1')](_0x3b9d('0xb2'),{'UserId':Number(_0x20f22d[_0x3b9d('0x35')][_0x3b9d('0x58')][_0x722e3c]),'MailAccountId':Number(_0x20f22d[_0x3b9d('0x4a')]['id'])});}}else{socket[_0x3b9d('0xb1')]('userMailAccount:remove',{'UserId':Number(_0x20f22d[_0x3b9d('0x35')][_0x3b9d('0x58')]),'MailAccountId':Number(_0x20f22d[_0x3b9d('0x4a')]['id'])});}});}})[_0x3b9d('0xf')](respondWithStatusCode(_0x34cd83,null))[_0x3b9d('0x1a')](handleError(_0x34cd83,null));};exports[_0x3b9d('0xb3')]=function(_0x11a561,_0x5c73a9){var _0x4bd1ea={};var _0xb53f66={};var _0x330ad8;var _0x3e2470;return db[_0x3b9d('0x46')]['findOne']({'where':{'id':_0x11a561[_0x3b9d('0x4a')]['id']}})[_0x3b9d('0xf')](handleEntityNotFound(_0x5c73a9,null))[_0x3b9d('0xf')](function(_0x360bb5){if(_0x360bb5){_0x330ad8=_0x360bb5;_0xb53f66[_0x3b9d('0x34')]=_[_0x3b9d('0x36')](db[_0x3b9d('0x7b')][_0x3b9d('0x31')]);_0xb53f66[_0x3b9d('0x35')]=_[_0x3b9d('0x36')](_0x11a561['query']);_0xb53f66[_0x3b9d('0x37')]=_[_0x3b9d('0x38')](_0xb53f66[_0x3b9d('0x34')],_0xb53f66[_0x3b9d('0x35')]);_0x4bd1ea[_0x3b9d('0x39')]=_[_0x3b9d('0x38')](_0xb53f66[_0x3b9d('0x34')],qs[_0x3b9d('0x3a')](_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x3a')]));_0x4bd1ea[_0x3b9d('0x39')]=_0x4bd1ea[_0x3b9d('0x39')]['length']?_0x4bd1ea[_0x3b9d('0x39')]:_0xb53f66[_0x3b9d('0x34')];_0x4bd1ea['order']=qs[_0x3b9d('0x3f')](_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x3f')]);_0x4bd1ea[_0x3b9d('0x40')]=qs[_0x3b9d('0x37')](_[_0x3b9d('0x41')](_0x11a561[_0x3b9d('0x35')],_0xb53f66[_0x3b9d('0x37')]));if(_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x56')]){_0x4bd1ea[_0x3b9d('0x40')]=_[_0x3b9d('0x42')](_0x4bd1ea[_0x3b9d('0x40')],{'$or':_['map'](_0x4bd1ea[_0x3b9d('0x39')],function(_0x28975a){var _0x230488={};_0x230488[_0x28975a]={'$like':'%'+_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x56')]+'%'};return _0x230488;})});}_0x4bd1ea=_[_0x3b9d('0x42')]({},_0x4bd1ea,_0x11a561[_0x3b9d('0x45')]);return _0x330ad8[_0x3b9d('0xb3')](_0x4bd1ea);}})[_0x3b9d('0xf')](function(_0x27099b){if(_0x27099b){_0x3e2470=_0x27099b['length'];if(!_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x3c')](_0x3b9d('0x3d'))){_0x4bd1ea[_0x3b9d('0x1f')]=qs[_0x3b9d('0x1f')](_0x11a561[_0x3b9d('0x35')][_0x3b9d('0x1f')]);_0x4bd1ea[_0x3b9d('0x1e')]=qs[_0x3b9d('0x1e')](_0x11a561[_0x3b9d('0x35')]['offset']);}return _0x330ad8[_0x3b9d('0xb3')](_0x4bd1ea);}})['then'](function(_0x109de9){if(_0x109de9){return _0x109de9?{'count':_0x3e2470,'rows':_0x109de9}:null;}})[_0x3b9d('0xf')](respondWithResult(_0x5c73a9,null))[_0x3b9d('0x1a')](handleError(_0x5c73a9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index f878ce9..b18aa03 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 _0xece5=['hook','exports','events','../../mysqldb','MailAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x1bf8b1,_0x1b11cd){var _0x37fb94=function(_0x33a62c){while(--_0x33a62c){_0x1bf8b1['push'](_0x1bf8b1['shift']());}};_0x37fb94(++_0x1b11cd);}(_0xece5,0x12e));var _0x5ece=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xece5[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x5ece('0x0'));var MailAccount=require(_0x5ece('0x1'))['db'][_0x5ece('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ece('0x3'),'afterUpdate':_0x5ece('0x4'),'afterDestroy':_0x5ece('0x5')};function emitEvent(_0x3bb8c9){return function(_0x1f254c,_0xb4c64c,_0x435818){MailAccountEvents['emit'](_0x3bb8c9+':'+_0x1f254c['id'],_0x1f254c);MailAccountEvents[_0x5ece('0x6')](_0x3bb8c9,_0x1f254c);_0x435818(null);};}for(var e in events){if(events[_0x5ece('0x7')](e)){var event=events[e];MailAccount[_0x5ece('0x8')](e,emitEvent(event));}}module[_0x5ece('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xb9c6=['emit','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove'];(function(_0x487b93,_0x330c64){var _0x1f6c3c=function(_0x4cfcfc){while(--_0x4cfcfc){_0x487b93['push'](_0x487b93['shift']());}};_0x1f6c3c(++_0x330c64);}(_0xb9c6,0x1aa));var _0x6b9c=function(_0x5a552d,_0x15e0fd){_0x5a552d=_0x5a552d-0x0;var _0x5b2639=_0xb9c6[_0x5a552d];return _0x5b2639;};'use strict';var EventEmitter=require(_0x6b9c('0x0'));var MailAccount=require(_0x6b9c('0x1'))['db'][_0x6b9c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6b9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b9c('0x4'),'afterDestroy':_0x6b9c('0x5')};function emitEvent(_0x47b15e){return function(_0x5aad5b,_0x576925,_0x121b4d){MailAccountEvents[_0x6b9c('0x6')](_0x47b15e+':'+_0x5aad5b['id'],_0x5aad5b);MailAccountEvents[_0x6b9c('0x6')](_0x47b15e,_0x5aad5b);_0x121b4d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x6b9c('0x7')](e,emitEvent(event));}}module[_0x6b9c('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index eaf3920..d470935 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 _0x543a=['provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','pass','./mailAccount.attributes','define','MailAccount'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x543a,0xce));var _0xa543=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x543a[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xa543('0x0'));module['exports']=function(_0x1f8f7a){return _0x1f8f7a[_0xa543('0x1')](_0xa543('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x553218=this;var _0x5cd9a3={'id':_0x553218['id'],'tls':{'rejectUnauthorized':![]}};if(_0x553218[_0xa543('0x3')]!==_0xa543('0x4')){_0x5cd9a3[_0xa543('0x5')]=_0x553218[_0xa543('0x3')];}else{_0x5cd9a3[_0xa543('0x6')]=_0x553218[_0xa543('0x7')][_0xa543('0x6')];_0x5cd9a3[_0xa543('0x8')]=_0x553218[_0xa543('0x7')][_0xa543('0x8')];_0x5cd9a3[_0xa543('0x9')]=_0x553218[_0xa543('0x7')][_0xa543('0x9')];}if(_0x553218[_0xa543('0x7')][_0xa543('0xa')]){if(_0x553218[_0xa543('0x7')][_0xa543('0xb')]){if(!_0x553218[_0xa543('0x7')][_0xa543('0xc')])throw new Error(_0xa543('0xd'));_0x5cd9a3[_0xa543('0xe')]={'type':_0xa543('0xf'),'user':_0x553218['Smtp']['user'],'accessToken':_0x553218[_0xa543('0x7')][_0xa543('0xc')][_0xa543('0x10')]};}else{_0x5cd9a3[_0xa543('0xe')]={'user':_0x553218[_0xa543('0x7')][_0xa543('0x11')],'pass':_0x553218['Smtp'][_0xa543('0x12')]};}}return _0x5cd9a3;}}});}; \ No newline at end of file +var _0xf8e9=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','./mailAccount.attributes','define','provider','custom','service','host'];(function(_0x1b7330,_0x2ea8c1){var _0x4bdd4e=function(_0x1d7caf){while(--_0x1d7caf){_0x1b7330['push'](_0x1b7330['shift']());}};_0x4bdd4e(++_0x2ea8c1);}(_0xf8e9,0x13d));var _0x9f8e=function(_0x43133a,_0x29c235){_0x43133a=_0x43133a-0x0;var _0x2784d6=_0xf8e9[_0x43133a];return _0x2784d6;};'use strict';var attributes=require(_0x9f8e('0x0'));module['exports']=function(_0xb162e0){return _0xb162e0[_0x9f8e('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3332ef=this;var _0x1fe4cd={'id':_0x3332ef['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3332ef[_0x9f8e('0x2')]!==_0x9f8e('0x3')){_0x1fe4cd[_0x9f8e('0x4')]=_0x3332ef[_0x9f8e('0x2')];}else{_0x1fe4cd[_0x9f8e('0x5')]=_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0x5')];_0x1fe4cd[_0x9f8e('0x7')]=_0x3332ef['Smtp'][_0x9f8e('0x7')];_0x1fe4cd[_0x9f8e('0x8')]=_0x3332ef[_0x9f8e('0x6')]['secure'];}if(_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0x9')]){if(_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0xa')]){if(!_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x1fe4cd['auth']={'type':_0x9f8e('0xc'),'user':_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0xd')],'accessToken':_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0xb')][_0x9f8e('0xe')]};}else{_0x1fe4cd[_0x9f8e('0xf')]={'user':_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0xd')],'pass':_0x3332ef[_0x9f8e('0x6')][_0x9f8e('0x10')]};}}return _0x1fe4cd;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 4daed4a..a139382 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 _0x7a54=['find','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','get','smtpOptions','getSmtpOptions','applications','list','priority','asc','autoclose','length','close','*,*,*,*','List\x20not\x20found','messageId','subject','format','MailInteraction','MailMessage','Messages','create','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowMailAccount','MailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x28e23e,_0x3731fb){var _0x4160bd=function(_0x1bd6bc){while(--_0x1bd6bc){_0x28e23e['push'](_0x28e23e['shift']());}};_0x4160bd(++_0x3731fb);}(_0x7a54,0x106));var _0x47a5=function(_0x3cd36a,_0x1442c6){_0x3cd36a=_0x3cd36a-0x0;var _0x2a55f8=_0x7a54[_0x3cd36a];return _0x2a55f8;};'use strict';var _=require(_0x47a5('0x0'));var moment=require(_0x47a5('0x1'));var BPromise=require(_0x47a5('0x2'));var rs=require('randomstring');var Redis=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var jayson=require(_0x47a5('0x7'));var client=jayson[_0x47a5('0x8')][_0x47a5('0x9')]({'port':0x232c});config['redis']=_[_0x47a5('0xa')](config['redis'],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require(_0x47a5('0xc'))(new Redis(config['redis']));require(_0x47a5('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d90b3,_0x582352,_0x2a0e98){return new BPromise(function(_0x2baee7,_0x5e31dd){return client[_0x47a5('0xe')](_0x5d90b3,_0x2a0e98)['then'](function(_0x5de6d7){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x582352,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x582352,_0x47a5('0x11'),JSON[_0x47a5('0x14')](_0x5de6d7));if(_0x5de6d7['error']){if(_0x5de6d7[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x582352,_0x5de6d7[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x5e31dd(_0x5de6d7[_0x47a5('0x15')][_0x47a5('0x17')]);}logger['error'](_0x47a5('0x10'),_0x582352,_0x5de6d7[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2baee7(_0x5de6d7[_0x47a5('0x15')][_0x47a5('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x582352,_0x47a5('0x11'));_0x2baee7(_0x5de6d7['result']['message']);}})[_0x47a5('0x18')](function(_0xaf70a6){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x582352,_0xaf70a6);_0x5e31dd(_0xaf70a6);});});}exports[_0x47a5('0x19')]=function(_0x12b98e){var _0x2763d6=this;return new Promise(function(_0xe3c618,_0x3aed38){return db['MailAccount'][_0x47a5('0x1a')]({'raw':_0x12b98e[_0x47a5('0x1b')]?_0x12b98e['options'][_0x47a5('0x1c')]===undefined?!![]:![]:!![],'where':_0x12b98e[_0x47a5('0x1b')]?_0x12b98e[_0x47a5('0x1b')]['where']||null:null,'attributes':_0x12b98e[_0x47a5('0x1b')]?_0x12b98e[_0x47a5('0x1b')][_0x47a5('0x1d')]||null:null,'limit':_0x12b98e[_0x47a5('0x1b')]?_0x12b98e['options'][_0x47a5('0x1e')]||null:null,'include':_0x12b98e[_0x47a5('0x1b')]?_0x12b98e['options'][_0x47a5('0x1f')]?_[_0x47a5('0x20')](_0x12b98e[_0x47a5('0x1b')][_0x47a5('0x1f')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1f')]?_['map'](_0x3abd6a[_0x47a5('0x1f')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x21')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1d')],'include':_0x5b6c4e[_0x47a5('0x1f')]?_[_0x47a5('0x20')](_0x5b6c4e[_0x47a5('0x1f')],function(_0x3ba0b7){return{'model':db[_0x3ba0b7[_0x47a5('0x21')]],'as':_0x3ba0b7['as'],'attributes':_0x3ba0b7[_0x47a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x22')](function(_0x361bfa){logger[_0x47a5('0xf')](_0x47a5('0x19'),_0x12b98e);logger[_0x47a5('0x12')]('GetMailAccount',_0x12b98e,JSON[_0x47a5('0x14')](_0x361bfa));_0xe3c618(_0x361bfa);})['catch'](function(_0x2ef875){logger[_0x47a5('0x15')](_0x47a5('0x19'),_0x2ef875['message'],_0x12b98e);_0x3aed38(_0x2763d6[_0x47a5('0x15')](0x1f4,_0x2ef875[_0x47a5('0x17')]));});});};exports[_0x47a5('0x23')]=function(_0x1f1c68){var _0x51cc81=this;return new Promise(function(_0x50d875,_0x6f9a12){return db[_0x47a5('0x24')]['find']({'raw':_0x1f1c68['options']?_0x1f1c68[_0x47a5('0x1b')][_0x47a5('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f1c68['options']?_0x1f1c68[_0x47a5('0x1b')]['where']||null:null,'attributes':_0x1f1c68[_0x47a5('0x1b')]?_0x1f1c68[_0x47a5('0x1b')]['attributes']||null:null,'include':_0x1f1c68['options']?_0x1f1c68[_0x47a5('0x1b')]['include']?_[_0x47a5('0x20')](_0x1f1c68[_0x47a5('0x1b')][_0x47a5('0x1f')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x21')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x20')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1d')],'include':_0x25cce0[_0x47a5('0x1f')]?_[_0x47a5('0x20')](_0x25cce0[_0x47a5('0x1f')],function(_0x36add5){return{'model':db[_0x36add5[_0x47a5('0x21')]],'as':_0x36add5['as'],'attributes':_0x36add5[_0x47a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x22')](function(_0x1a0d23){logger['info'](_0x47a5('0x23'),_0x1f1c68);logger[_0x47a5('0x12')]('ShowMailAccount',_0x1f1c68,JSON[_0x47a5('0x14')](_0x1a0d23));_0x50d875(_0x1a0d23);})[_0x47a5('0x18')](function(_0x1d4348){logger['error'](_0x47a5('0x23'),_0x1d4348[_0x47a5('0x17')],_0x1f1c68);_0x6f9a12(_0x51cc81['error'](0x1f4,_0x1d4348[_0x47a5('0x17')]));});});};exports[_0x47a5('0x25')]=function(_0x54ae35){var _0x55c5eb=this;return new Promise(function(_0x5ebd8c,_0x12d9f2){var _0x5c569e={'body':_0x54ae35[_0x47a5('0x26')],'channel':_0x47a5('0x27')};var _0x301a85=_[_0x47a5('0x28')](_[_0x47a5('0x29')](db[_0x47a5('0x2a')][_0x47a5('0x2b')]),[_0x47a5('0x2c'),_0x47a5('0x2d'),_0x47a5('0x2e'),_0x47a5('0x2f')]);var _0x1658e8=![];if(_0x54ae35[_0x47a5('0x26')]['id']){delete _0x54ae35['body']['id'];}if(_[_0x47a5('0x30')](_0x54ae35[_0x47a5('0x26')][_0x47a5('0x31')])){return _0x12d9f2(_0x55c5eb[_0x47a5('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x47a5('0x30')](_0x54ae35['body']['body'])||_0x54ae35['body']['body']===''){return _0x12d9f2(_0x55c5eb[_0x47a5('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x47a5('0x30')](_0x54ae35[_0x47a5('0x26')][_0x47a5('0x32')])){return _0x12d9f2(_0x55c5eb['error'](0x1f4,_0x47a5('0x33')+_0x301a85));}if(!_[_0x47a5('0x34')](_0x301a85,_0x54ae35['body']['mapKey'])){return _0x12d9f2(_0x55c5eb[_0x47a5('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x301a85));}var _0x1609dc={};_0x1609dc[_0x54ae35[_0x47a5('0x26')][_0x47a5('0x32')]]=_0x54ae35[_0x47a5('0x26')][_0x47a5('0x31')];return db[_0x47a5('0x24')][_0x47a5('0x35')]({'where':{'id':_0x54ae35[_0x47a5('0x36')]['id']},'include':[{'model':db[_0x47a5('0x37')],'as':_0x47a5('0x38'),'include':[{'model':db[_0x47a5('0x2a')],'as':_0x47a5('0x39'),'where':_0x1609dc,'limit':0x1,'order':[[_0x47a5('0x2d'),_0x47a5('0x3a')]]}]},{'model':db[_0x47a5('0x3b')],'as':_0x47a5('0x3c')},{'model':db['MailServerOut'],'as':_0x47a5('0x3d'),'include':[{'model':db[_0x47a5('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0x3d0a88){if(_0x3d0a88&&_0x3d0a88['List']){var _0x13750d=_0x3d0a88[_0x47a5('0x3f')]({'plain':!![]});_0x5c569e['account']=_['omit'](_0x13750d,[_0x47a5('0x3c'),'List']);_0x5c569e[_0x47a5('0x36')][_0x47a5('0x40')]=_0x3d0a88[_0x47a5('0x41')]();_0x5c569e[_0x47a5('0x42')]=_0x13750d[_0x47a5('0x3c')];_0x5c569e[_0x47a5('0x43')]=_0x13750d[_0x47a5('0x38')];_0x5c569e['applications']=_['orderBy'](_0x5c569e[_0x47a5('0x42')],[_0x47a5('0x44')],[_0x47a5('0x45')]);if(_0x5c569e[_0x47a5('0x36')]&&_0x5c569e[_0x47a5('0x36')][_0x47a5('0x46')]){_0x5c569e[_0x47a5('0x42')]['push']({'id':0x0,'priority':_0x5c569e[_0x47a5('0x42')][_0x47a5('0x47')]+0x1,'app':_0x47a5('0x48'),'appdata':'autoclose','interval':_0x47a5('0x49')});}if(_0x5c569e['account'][_0x47a5('0x3c')]){delete _0x5c569e[_0x47a5('0x36')][_0x47a5('0x3c')];}if(_0x5c569e[_0x47a5('0x36')]['List']){delete _0x5c569e[_0x47a5('0x36')][_0x47a5('0x38')];}if(_0x13750d[_0x47a5('0x38')][_0x47a5('0x39')][_0x47a5('0x47')]){return _0x13750d[_0x47a5('0x38')][_0x47a5('0x39')][0x0];}var _0x481089=_[_0x47a5('0xa')](_0x54ae35[_0x47a5('0x26')],{'firstName':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x31')],'ListId':_0x13750d[_0x47a5('0x2f')]});_0x481089[_0x54ae35[_0x47a5('0x26')]['mapKey']]=_0x54ae35[_0x47a5('0x26')][_0x47a5('0x31')];return db[_0x47a5('0x2a')]['create'](_0x481089);}else{throw new Error(_0x47a5('0x4a'));}})[_0x47a5('0x22')](function(_0x183b3c){_0x5c569e['contact']=_0x183b3c;if(_0x183b3c){if(!_0x54ae35['body'][_0x47a5('0x17')][_0x47a5('0x4b')]){_0x54ae35['body']['message'][_0x47a5('0x4b')]=rs['generate']()+'\x20'+_0x54ae35[_0x47a5('0x26')]['message']['from'];}var _0x389ed9={'ContactId':_0x183b3c['id'],'MailAccountId':_0x54ae35[_0x47a5('0x36')]['id'],'inReplyTo':_0x54ae35['body'][_0x47a5('0x17')][_0x47a5('0x4b')],'to':_0x54ae35['body']['message'][_0x47a5('0x31')],'cc':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['cc'],'subject':_0x54ae35[_0x47a5('0x26')]['message'][_0x47a5('0x4c')],'attach':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['attach'],'lastMsgAt':moment()[_0x47a5('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x47a5('0x4e')][_0x47a5('0x35')]({'where':{'closed':![],'MailAccountId':_0x54ae35[_0x47a5('0x36')]['id']},'include':[{'model':db[_0x47a5('0x4f')],'as':_0x47a5('0x50'),'attributes':['messageId'],'where':{'messageId':_0x54ae35[_0x47a5('0x26')]['message']['inReplyTo']}}]})['then'](function(_0x4f8564){if(_0x4f8564){return[_0x4f8564,![]];}return db[_0x47a5('0x4e')][_0x47a5('0x51')](_0x389ed9)[_0x47a5('0x22')](function(_0x52e3ee){return[_0x52e3ee,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x47a5('0x52')](function(_0x23020b,_0x45d4b6){if(_0x23020b){_0x1658e8=_0x45d4b6;if(!_0x45d4b6){return _0x23020b[_0x47a5('0x53')]({'inReplyTo':_0x54ae35[_0x47a5('0x26')]['message'][_0x47a5('0x4b')],'to':_0x54ae35['body'][_0x47a5('0x17')][_0x47a5('0x31')],'cc':_0x54ae35['body'][_0x47a5('0x17')]['cc'],'subject':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')][_0x47a5('0x4c')],'attach':_0x23020b[_0x47a5('0x54')]?_0x23020b[_0x47a5('0x54')]:_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x47a5('0x4d')](_0x47a5('0x55')),'lastMsgAt':moment()[_0x47a5('0x4d')](_0x47a5('0x55')),'lastMsgDirection':'in'});}else{return _0x23020b;}}})[_0x47a5('0x22')](function(_0x4bbe14){_0x5c569e[_0x47a5('0x56')]=_0x4bbe14[_0x47a5('0x3f')]({'plain':!![]});_0x5c569e[_0x47a5('0x56')][_0x47a5('0x57')]=_0x1658e8;return db[_0x47a5('0x4f')][_0x47a5('0x51')]({'body':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x26')],'MailAccountId':_0x54ae35[_0x47a5('0x36')]['id'],'MailInteractionId':_0x4bbe14['id'],'direction':'in','ContactId':_0x5c569e[_0x47a5('0x58')]['id'],'messageId':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')][_0x47a5('0x4b')],'from':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['from'],'to':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['to'],'cc':_0x54ae35[_0x47a5('0x26')]['message']['cc'],'subject':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')][_0x47a5('0x4c')],'attach':_0x54ae35[_0x47a5('0x26')]['message'][_0x47a5('0x54')],'Attachments':_0x54ae35['body'][_0x47a5('0x17')]['attachments'],'originTo':_0x54ae35[_0x47a5('0x26')]['message'][_0x47a5('0x59')],'originCc':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')]['originCc'],'bcc':_0x54ae35['body']['message'][_0x47a5('0x5a')],'ChatWebsiteId':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')][_0x47a5('0x5b')]||null,'originChannel':_0x54ae35['body'][_0x47a5('0x17')][_0x47a5('0x5c')]||_0x47a5('0x5d'),'ChatOfflineMessageId':_0x54ae35[_0x47a5('0x26')][_0x47a5('0x17')][_0x47a5('0x5e')]||null},{'include':[{'model':db[_0x47a5('0x5f')],'as':_0x47a5('0x60')}]});})[_0x47a5('0x22')](function(_0xc69a68){_0x5c569e[_0x47a5('0x17')]=_0xc69a68;if(_0x5c569e[_0x47a5('0x56')]['UserId']){return db[_0x47a5('0x61')]['find']({'attributes':['id',_0x47a5('0x62')],'where':{'id':_0x5c569e[_0x47a5('0x56')][_0x47a5('0x63')]}})[_0x47a5('0x22')](function(_0x40e584){if(_0x40e584){_0x5c569e[_0x47a5('0x42')][_0x47a5('0x64')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x65'),'appdata':_0x40e584[_0x47a5('0x62')]+','+(_0x5c569e[_0x47a5('0x36')][_0x47a5('0x66')]||0xa),'interval':_0x47a5('0x49')});}return respondWithRpcPromise(_0x47a5('0x67'),_0x47a5('0x68'),_0x5c569e);});}return respondWithRpcPromise(_0x47a5('0x67'),'startRouting',_0x5c569e);})['then'](function(_0x5ccc89){_0x5ebd8c(_0x5ccc89);})['catch'](function(_0x490e28){_0x12d9f2(_0x55c5eb[_0x47a5('0x15')](0x1f4,_0x490e28['message']));});});}; \ No newline at end of file +var _0xb10b=['message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','find','ShowMailAccount','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','getSmtpOptions','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','MailMessage','originTo','originCc','bcc','originChannel','Email','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailAccount.socket','register','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0xb10b,0x12a));var _0xbb10=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0xb10b[_0x113e32];return _0x4ff939;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var BPromise=require(_0xbb10('0x1'));var rs=require(_0xbb10('0x2'));var Redis=require(_0xbb10('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var jayson=require(_0xbb10('0x7'));var client=jayson[_0xbb10('0x8')][_0xbb10('0x9')]({'port':0x232c});config['redis']=_[_0xbb10('0xa')](config[_0xbb10('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb10('0xc'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xd'))[_0xbb10('0xe')](socket);function respondWithRpcPromise(_0x2353ef,_0x1ce33e,_0x229887){return new BPromise(function(_0xa3adc8,_0x5ab04a){return client['request'](_0x2353ef,_0x229887)[_0xbb10('0xf')](function(_0x118a74){logger[_0xbb10('0x10')]('MailAccount,\x20%s,\x20%s',_0x1ce33e,_0xbb10('0x11'));logger['debug'](_0xbb10('0x12'),_0x1ce33e,_0xbb10('0x11'),JSON[_0xbb10('0x13')](_0x118a74));if(_0x118a74[_0xbb10('0x14')]){if(_0x118a74[_0xbb10('0x14')][_0xbb10('0x15')]===0x1f4){logger['error'](_0xbb10('0x16'),_0x1ce33e,_0x118a74[_0xbb10('0x14')][_0xbb10('0x17')]);return _0x5ab04a(_0x118a74[_0xbb10('0x14')][_0xbb10('0x17')]);}logger[_0xbb10('0x14')](_0xbb10('0x16'),_0x1ce33e,_0x118a74[_0xbb10('0x14')][_0xbb10('0x17')]);return _0xa3adc8(_0x118a74[_0xbb10('0x14')]['message']);}else{logger[_0xbb10('0x10')](_0xbb10('0x16'),_0x1ce33e,_0xbb10('0x11'));_0xa3adc8(_0x118a74[_0xbb10('0x18')][_0xbb10('0x17')]);}})[_0xbb10('0x19')](function(_0x575cca){logger[_0xbb10('0x14')](_0xbb10('0x16'),_0x1ce33e,_0x575cca);_0x5ab04a(_0x575cca);});});}exports[_0xbb10('0x1a')]=function(_0x48b6e9){var _0x5ff0cf=this;return new Promise(function(_0x19f48d,_0x388fab){return db[_0xbb10('0x1b')][_0xbb10('0x1c')]({'raw':_0x48b6e9[_0xbb10('0x1d')]?_0x48b6e9['options'][_0xbb10('0x1e')]===undefined?!![]:![]:!![],'where':_0x48b6e9[_0xbb10('0x1d')]?_0x48b6e9['options']['where']||null:null,'attributes':_0x48b6e9[_0xbb10('0x1d')]?_0x48b6e9[_0xbb10('0x1d')][_0xbb10('0x1f')]||null:null,'limit':_0x48b6e9[_0xbb10('0x1d')]?_0x48b6e9[_0xbb10('0x1d')][_0xbb10('0x20')]||null:null,'include':_0x48b6e9[_0xbb10('0x1d')]?_0x48b6e9[_0xbb10('0x1d')][_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x48b6e9[_0xbb10('0x1d')][_0xbb10('0x21')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x537898[_0xbb10('0x21')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x23')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1f')],'include':_0x4e25ff[_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x4e25ff[_0xbb10('0x21')],function(_0x20d946){return{'model':db[_0x20d946[_0xbb10('0x23')]],'as':_0x20d946['as'],'attributes':_0x20d946['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xf')](function(_0x21ac54){logger[_0xbb10('0x10')](_0xbb10('0x1a'),_0x48b6e9);logger[_0xbb10('0x24')](_0xbb10('0x1a'),_0x48b6e9,JSON['stringify'](_0x21ac54));_0x19f48d(_0x21ac54);})[_0xbb10('0x19')](function(_0x4ee02e){logger[_0xbb10('0x14')]('GetMailAccount',_0x4ee02e[_0xbb10('0x17')],_0x48b6e9);_0x388fab(_0x5ff0cf[_0xbb10('0x14')](0x1f4,_0x4ee02e[_0xbb10('0x17')]));});});};exports['ShowMailAccount']=function(_0x518d47){var _0x4c3744=this;return new Promise(function(_0x34f65e,_0x4f590d){return db[_0xbb10('0x1b')][_0xbb10('0x25')]({'raw':_0x518d47[_0xbb10('0x1d')]?_0x518d47[_0xbb10('0x1d')][_0xbb10('0x1e')]===undefined?!![]:![]:!![],'where':_0x518d47[_0xbb10('0x1d')]?_0x518d47[_0xbb10('0x1d')]['where']||null:null,'attributes':_0x518d47[_0xbb10('0x1d')]?_0x518d47[_0xbb10('0x1d')][_0xbb10('0x1f')]||null:null,'include':_0x518d47[_0xbb10('0x1d')]?_0x518d47[_0xbb10('0x1d')][_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x518d47[_0xbb10('0x1d')][_0xbb10('0x21')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x23')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1f')],'include':_0x56943c[_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes'],'include':_0x111762[_0xbb10('0x21')]?_[_0xbb10('0x22')](_0x111762[_0xbb10('0x21')],function(_0x120d21){return{'model':db[_0x120d21[_0xbb10('0x23')]],'as':_0x120d21['as'],'attributes':_0x120d21[_0xbb10('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e5bbd){logger[_0xbb10('0x10')]('ShowMailAccount',_0x518d47);logger['debug']('ShowMailAccount',_0x518d47,JSON[_0xbb10('0x13')](_0x1e5bbd));_0x34f65e(_0x1e5bbd);})[_0xbb10('0x19')](function(_0x2b658a){logger['error'](_0xbb10('0x26'),_0x2b658a[_0xbb10('0x17')],_0x518d47);_0x4f590d(_0x4c3744[_0xbb10('0x14')](0x1f4,_0x2b658a['message']));});});};exports[_0xbb10('0x27')]=function(_0x12238a){var _0x1dcd38=this;return new Promise(function(_0x446f49,_0x4f1cdd){var _0xd238e9={'body':_0x12238a[_0xbb10('0x28')],'channel':'mail'};var _0xe2040f=_[_0xbb10('0x29')](_[_0xbb10('0x2a')](db[_0xbb10('0x2b')][_0xbb10('0x2c')]),[_0xbb10('0x2d'),'updatedAt',_0xbb10('0x2e'),_0xbb10('0x2f')]);var _0x3e7b4c=![];if(_0x12238a[_0xbb10('0x28')]['id']){delete _0x12238a['body']['id'];}if(_[_0xbb10('0x30')](_0x12238a[_0xbb10('0x28')][_0xbb10('0x31')])){return _0x4f1cdd(_0x1dcd38[_0xbb10('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xbb10('0x30')](_0x12238a[_0xbb10('0x28')]['body'])||_0x12238a['body'][_0xbb10('0x28')]===''){return _0x4f1cdd(_0x1dcd38['error'](0x1f4,_0xbb10('0x32')));}if(_[_0xbb10('0x30')](_0x12238a['body'][_0xbb10('0x33')])){return _0x4f1cdd(_0x1dcd38[_0xbb10('0x14')](0x1f4,_0xbb10('0x34')+_0xe2040f));}if(!_['includes'](_0xe2040f,_0x12238a[_0xbb10('0x28')][_0xbb10('0x33')])){return _0x4f1cdd(_0x1dcd38[_0xbb10('0x14')](0x1f4,_0xbb10('0x35')+_0xe2040f));}var _0x36e1fa={};_0x36e1fa[_0x12238a[_0xbb10('0x28')][_0xbb10('0x33')]]=_0x12238a[_0xbb10('0x28')][_0xbb10('0x31')];return db[_0xbb10('0x1b')][_0xbb10('0x25')]({'where':{'id':_0x12238a[_0xbb10('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xbb10('0x37'),'include':[{'model':db[_0xbb10('0x2b')],'as':'Contacts','where':_0x36e1fa,'limit':0x1,'order':[[_0xbb10('0x38'),_0xbb10('0x39')]]}]},{'model':db[_0xbb10('0x3a')],'as':_0xbb10('0x3b')},{'model':db[_0xbb10('0x3c')],'as':_0xbb10('0x3d'),'include':[{'model':db[_0xbb10('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0xcb3354){if(_0xcb3354&&_0xcb3354[_0xbb10('0x37')]){var _0x2b12bd=_0xcb3354['get']({'plain':!![]});_0xd238e9['account']=_[_0xbb10('0x3f')](_0x2b12bd,[_0xbb10('0x3b'),_0xbb10('0x37')]);_0xd238e9[_0xbb10('0x36')][_0xbb10('0x40')]=_0xcb3354[_0xbb10('0x41')]();_0xd238e9[_0xbb10('0x42')]=_0x2b12bd[_0xbb10('0x3b')];_0xd238e9[_0xbb10('0x43')]=_0x2b12bd[_0xbb10('0x37')];_0xd238e9['applications']=_['orderBy'](_0xd238e9[_0xbb10('0x42')],[_0xbb10('0x44')],[_0xbb10('0x45')]);if(_0xd238e9[_0xbb10('0x36')]&&_0xd238e9[_0xbb10('0x36')][_0xbb10('0x46')]){_0xd238e9[_0xbb10('0x42')][_0xbb10('0x47')]({'id':0x0,'priority':_0xd238e9[_0xbb10('0x42')][_0xbb10('0x48')]+0x1,'app':_0xbb10('0x49'),'appdata':_0xbb10('0x46'),'interval':_0xbb10('0x4a')});}if(_0xd238e9[_0xbb10('0x36')][_0xbb10('0x3b')]){delete _0xd238e9['account'][_0xbb10('0x3b')];}if(_0xd238e9['account'][_0xbb10('0x37')]){delete _0xd238e9[_0xbb10('0x36')][_0xbb10('0x37')];}if(_0x2b12bd[_0xbb10('0x37')][_0xbb10('0x4b')][_0xbb10('0x48')]){return _0x2b12bd[_0xbb10('0x37')][_0xbb10('0x4b')][0x0];}var _0x180400=_[_0xbb10('0xa')](_0x12238a[_0xbb10('0x28')],{'firstName':_0x12238a[_0xbb10('0x28')][_0xbb10('0x31')],'ListId':_0x2b12bd[_0xbb10('0x2f')]});_0x180400[_0x12238a[_0xbb10('0x28')]['mapKey']]=_0x12238a[_0xbb10('0x28')][_0xbb10('0x31')];return db[_0xbb10('0x2b')][_0xbb10('0x4c')](_0x180400);}else{throw new Error(_0xbb10('0x4d'));}})[_0xbb10('0xf')](function(_0x4bedd0){_0xd238e9[_0xbb10('0x4e')]=_0x4bedd0;if(_0x4bedd0){if(!_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x4f')]){_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x4f')]=rs[_0xbb10('0x50')]()+'\x20'+_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x31')];}var _0x2a1ce1={'ContactId':_0x4bedd0['id'],'MailAccountId':_0x12238a[_0xbb10('0x36')]['id'],'inReplyTo':_0x12238a['body']['message'][_0xbb10('0x4f')],'to':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x31')],'cc':_0x12238a['body']['message']['cc'],'subject':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x51')],'attach':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x52')],'lastMsgAt':moment()[_0xbb10('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xbb10('0x54')][_0xbb10('0x25')]({'where':{'closed':![],'MailAccountId':_0x12238a['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xbb10('0x4f')],'where':{'messageId':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')]['inReplyTo']}}]})['then'](function(_0x5846d1){if(_0x5846d1){return[_0x5846d1,![]];}return db[_0xbb10('0x54')][_0xbb10('0x4c')](_0x2a1ce1)[_0xbb10('0xf')](function(_0x4e9fbd){return[_0x4e9fbd,!![]];});});}else{throw new Error(_0xbb10('0x55'));}})[_0xbb10('0x56')](function(_0x5a6538,_0x4a560c){if(_0x5a6538){_0x3e7b4c=_0x4a560c;if(!_0x4a560c){return _0x5a6538[_0xbb10('0x57')]({'inReplyTo':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x4f')],'to':_0x12238a['body'][_0xbb10('0x17')][_0xbb10('0x31')],'cc':_0x12238a[_0xbb10('0x28')]['message']['cc'],'subject':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x51')],'attach':_0x5a6538['attach']?_0x5a6538[_0xbb10('0x52')]:_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x52')],'substatus':null,'substatusAt':moment()['format'](_0xbb10('0x58')),'lastMsgAt':moment()[_0xbb10('0x53')](_0xbb10('0x58')),'lastMsgDirection':'in'});}else{return _0x5a6538;}}})[_0xbb10('0xf')](function(_0x56b3a3){_0xd238e9[_0xbb10('0x59')]=_0x56b3a3[_0xbb10('0x5a')]({'plain':!![]});_0xd238e9[_0xbb10('0x59')][_0xbb10('0x5b')]=_0x3e7b4c;return db[_0xbb10('0x5c')][_0xbb10('0x4c')]({'body':_0x12238a[_0xbb10('0x28')]['body'],'MailAccountId':_0x12238a['account']['id'],'MailInteractionId':_0x56b3a3['id'],'direction':'in','ContactId':_0xd238e9['contact']['id'],'messageId':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x4f')],'from':_0x12238a['body']['message'][_0xbb10('0x31')],'to':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')]['to'],'cc':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')]['cc'],'subject':_0x12238a[_0xbb10('0x28')]['message'][_0xbb10('0x51')],'attach':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x52')],'Attachments':_0x12238a[_0xbb10('0x28')]['message']['attachments'],'originTo':_0x12238a['body'][_0xbb10('0x17')][_0xbb10('0x5d')],'originCc':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x5e')],'bcc':_0x12238a[_0xbb10('0x28')]['message'][_0xbb10('0x5f')],'ChatWebsiteId':_0x12238a['body']['message']['ChatWebsiteId']||null,'originChannel':_0x12238a[_0xbb10('0x28')][_0xbb10('0x17')][_0xbb10('0x60')]||_0xbb10('0x61'),'ChatOfflineMessageId':_0x12238a['body'][_0xbb10('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xbb10('0x62')}]});})[_0xbb10('0xf')](function(_0x29529c){_0xd238e9[_0xbb10('0x17')]=_0x29529c;if(_0xd238e9[_0xbb10('0x59')]['UserId']){return db[_0xbb10('0x63')][_0xbb10('0x25')]({'attributes':['id',_0xbb10('0x64')],'where':{'id':_0xd238e9[_0xbb10('0x59')][_0xbb10('0x65')]}})[_0xbb10('0xf')](function(_0x174395){if(_0x174395){_0xd238e9['applications'][_0xbb10('0x66')]({'id':0x0,'priority':0x0,'app':_0xbb10('0x67'),'appdata':_0x174395[_0xbb10('0x64')]+','+(_0xd238e9[_0xbb10('0x36')][_0xbb10('0x68')]||0xa),'interval':_0xbb10('0x4a')});}return respondWithRpcPromise(_0xbb10('0x69'),_0xbb10('0x6a'),_0xd238e9);});}return respondWithRpcPromise('Start',_0xbb10('0x6a'),_0xd238e9);})[_0xbb10('0xf')](function(_0x145baf){_0x446f49(_0x145baf);})['catch'](function(_0x4ee101){_0x4f1cdd(_0x1dcd38['error'](0x1f4,_0x4ee101[_0xbb10('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 32fd7ab..20dc903 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 _0xd140=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x57b802,_0x2ca255){var _0x346577=function(_0x25470b){while(--_0x25470b){_0x57b802['push'](_0x57b802['shift']());}};_0x346577(++_0x2ca255);}(_0xd140,0x1d4));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var MailAccountEvents=require(_0x0d14('0x0'));var events=['save',_0x0d14('0x1'),_0x0d14('0x2')];function createListener(_0x243f0e,_0x37d5f8){return function(_0x1cce01){_0x37d5f8[_0x0d14('0x3')](_0x243f0e,_0x1cce01);};}function removeListener(_0x51569e,_0x235195){return function(){MailAccountEvents[_0x0d14('0x4')](_0x51569e,_0x235195);};}exports[_0x0d14('0x5')]=function(_0x4e6dfe){for(var _0xf33b6c=0x0,_0x237d70=events[_0x0d14('0x6')];_0xf33b6c<_0x237d70;_0xf33b6c++){var _0xfc2770=events[_0xf33b6c];var _0x3080a9=createListener(_0x0d14('0x7')+_0xfc2770,_0x4e6dfe);MailAccountEvents['on'](_0xfc2770,_0x3080a9);}}; \ No newline at end of file +var _0x7543=['remove','update','emit','removeListener','register','length','save'];(function(_0x585219,_0x23ba0b){var _0x32c6fe=function(_0x463370){while(--_0x463370){_0x585219['push'](_0x585219['shift']());}};_0x32c6fe(++_0x23ba0b);}(_0x7543,0xca));var _0x3754=function(_0x56e9a1,_0x44c06c){_0x56e9a1=_0x56e9a1-0x0;var _0x46f0f9=_0x7543[_0x56e9a1];return _0x46f0f9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3754('0x0'),_0x3754('0x1'),_0x3754('0x2')];function createListener(_0x41c08e,_0x34cba1){return function(_0x3af056){_0x34cba1[_0x3754('0x3')](_0x41c08e,_0x3af056);};}function removeListener(_0x276109,_0x3e5e4e){return function(){MailAccountEvents[_0x3754('0x4')](_0x276109,_0x3e5e4e);};}exports[_0x3754('0x5')]=function(_0x1e49a2){for(var _0x48c22f=0x0,_0x2304fb=events[_0x3754('0x6')];_0x48c22f<_0x2304fb;_0x48c22f++){var _0x11ef76=events[_0x48c22f];var _0x6852d5=createListener('mailAccount:'+_0x11ef76,_0x1e49a2);MailAccountEvents['on'](_0x11ef76,_0x6852d5);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 33dbc92..459d43f 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 _0xa727=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','util','path','connect-timeout','express','Router'];(function(_0x319c95,_0x1e73a9){var _0x39d768=function(_0x4cf1ed){while(--_0x4cf1ed){_0x319c95['push'](_0x319c95['shift']());}};_0x39d768(++_0x1e73a9);}(_0xa727,0xa0));var _0x7a72=function(_0x461470,_0x4906d0){_0x461470=_0x461470-0x0;var _0x152dfa=_0xa727[_0x461470];return _0x152dfa;};'use strict';var multer=require('multer');var util=require(_0x7a72('0x0'));var path=require(_0x7a72('0x1'));var timeout=require(_0x7a72('0x2'));var express=require(_0x7a72('0x3'));var router=express[_0x7a72('0x4')]();var fs_extra=require(_0x7a72('0x5'));var auth=require(_0x7a72('0x6'));var interaction=require(_0x7a72('0x7'));var config=require('../../config/environment');var controller=require(_0x7a72('0x8'));router[_0x7a72('0x9')](_0x7a72('0xa'),auth[_0x7a72('0xb')](),controller[_0x7a72('0xc')]);router['put'](_0x7a72('0xa'),auth[_0x7a72('0xb')](),controller[_0x7a72('0xd')]);router[_0x7a72('0xe')](_0x7a72('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc3a1=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update'];(function(_0x31d37c,_0x572b1f){var _0x25c904=function(_0x6358f0){while(--_0x6358f0){_0x31d37c['push'](_0x31d37c['shift']());}};_0x25c904(++_0x572b1f);}(_0xc3a1,0x1c3));var _0x1c3a=function(_0x240547,_0x20af7f){_0x240547=_0x240547-0x0;var _0x561d7d=_0xc3a1[_0x240547];return _0x561d7d;};'use strict';var multer=require('multer');var util=require(_0x1c3a('0x0'));var path=require(_0x1c3a('0x1'));var timeout=require(_0x1c3a('0x2'));var express=require(_0x1c3a('0x3'));var router=express[_0x1c3a('0x4')]();var fs_extra=require(_0x1c3a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1c3a('0x6'));var config=require('../../config/environment');var controller=require(_0x1c3a('0x7'));router[_0x1c3a('0x8')]('/:id',auth[_0x1c3a('0x9')](),controller[_0x1c3a('0xa')]);router[_0x1c3a('0xb')](_0x1c3a('0xc'),auth[_0x1c3a('0x9')](),controller[_0x1c3a('0xd')]);router['delete'](_0x1c3a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c3a('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 62b6be1..a29279f 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 _0xff94=['*,*,*,*','exports','STRING','noop'];(function(_0x16d937,_0x650453){var _0x25e106=function(_0x31811f){while(--_0x31811f){_0x16d937['push'](_0x16d937['shift']());}};_0x25e106(++_0x650453);}(_0xff94,0x145));var _0x4ff9=function(_0x36728b,_0x4a7ef3){_0x36728b=_0x36728b-0x0;var _0x5eb187=_0xff94[_0x36728b];return _0x5eb187;};'use strict';var Sequelize=require('sequelize');module[_0x4ff9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4ff9('0x1')],'allowNull':![],'defaultValue':_0x4ff9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4ff9('0x1')]},'interval':{'type':Sequelize[_0x4ff9('0x1')],'defaultValue':_0x4ff9('0x3')}}; \ No newline at end of file +var _0x3388=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3388,0x126));var _0x8338=function(_0x239e73,_0x236bd4){_0x239e73=_0x239e73-0x0;var _0x22e419=_0x3388[_0x239e73];return _0x22e419;};'use strict';var Sequelize=require(_0x8338('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8338('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8338('0x2')],'allowNull':![],'defaultValue':_0x8338('0x3')},'appdata':{'type':Sequelize[_0x8338('0x4')]()},'description':{'type':Sequelize[_0x8338('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8338('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6766e79..8c960e5 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x531e85,_0x4c5f38){var _0x197b70=function(_0x3feb49){while(--_0x3feb49){_0x531e85['push'](_0x531e85['shift']());}};_0x197b70(++_0x4c5f38);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2be7ac,_0x44e653){_0x2be7ac=_0x2be7ac-0x0;var _0x45c73f=_0x9bde[_0x2be7ac];return _0x45c73f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1612e9,_0x272ff8){var _0x5a39fd=function(_0x358eb9){while(--_0x358eb9){_0x1612e9['push'](_0x1612e9['shift']());}};_0x5a39fd(++_0x272ff8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3fd4e5,_0x525fd4){_0x3fd4e5=_0x3fd4e5-0x0;var _0x1b6b2d=_0x9bde[_0x3fd4e5];return _0x1b6b2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9f1542a..d5e5b4e 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 _0xd521=['path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0xe5ad35,_0x36b160){var _0x1f1d7a=function(_0x4d06b6){while(--_0x4d06b6){_0xe5ad35['push'](_0xe5ad35['shift']());}};_0x1f1d7a(++_0x36b160);}(_0xd521,0x168));var _0x1d52=function(_0x13453e,_0x409732){_0x13453e=_0x13453e-0x0;var _0x19d7ce=_0xd521[_0x13453e];return _0x19d7ce;};'use strict';var _=require(_0x1d52('0x0'));var util=require('util');var logger=require(_0x1d52('0x1'))(_0x1d52('0x2'));var moment=require('moment');var BPromise=require(_0x1d52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d52('0x4'));var rimraf=require('rimraf');var config=require(_0x1d52('0x5'));var attributes=require(_0x1d52('0x6'));module[_0x1d52('0x7')]=function(_0x522283,_0x3f0874){return _0x522283[_0x1d52('0x8')](_0x1d52('0x9'),attributes,{'tableName':_0x1d52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d52('0xb'),'collate':_0x1d52('0xc')});}; \ No newline at end of file +var _0xdb7d=['request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xdb7d,0xe5));var _0xddb7=function(_0x2f061f,_0xd744f2){_0x2f061f=_0x2f061f-0x0;var _0x24b187=_0xdb7d[_0x2f061f];return _0x24b187;};'use strict';var _=require(_0xddb7('0x0'));var util=require(_0xddb7('0x1'));var logger=require('../../config/logger')(_0xddb7('0x2'));var moment=require(_0xddb7('0x3'));var BPromise=require(_0xddb7('0x4'));var rp=require(_0xddb7('0x5'));var fs=require('fs');var path=require(_0xddb7('0x6'));var rimraf=require(_0xddb7('0x7'));var config=require(_0xddb7('0x8'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x94f9b5,_0x24e871){return _0x94f9b5['define'](_0xddb7('0x9'),attributes,{'tableName':_0xddb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xddb7('0xb'),'collate':_0xddb7('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e6af346..f1f7487 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 _0xbef7=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','lodash'];(function(_0x37d109,_0x56897d){var _0x5aec12=function(_0x445be7){while(--_0x445be7){_0x37d109['push'](_0x37d109['shift']());}};_0x5aec12(++_0x56897d);}(_0xbef7,0x10d));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7bef('0x0'));var util=require('util');var moment=require(_0x7bef('0x1'));var BPromise=require('bluebird');var rs=require(_0x7bef('0x2'));var fs=require('fs');var Redis=require(_0x7bef('0x3'));var db=require(_0x7bef('0x4'))['db'];var utils=require(_0x7bef('0x5'));var logger=require(_0x7bef('0x6'))(_0x7bef('0x7'));var config=require(_0x7bef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7bef('0x9')][_0x7bef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52a343,_0x3dc0ed,_0x95b336){return new BPromise(function(_0x56c3ec,_0x1c8933){return client[_0x7bef('0xb')](_0x52a343,_0x95b336)[_0x7bef('0xc')](function(_0x65a09b){logger[_0x7bef('0xd')](_0x7bef('0xe'),_0x3dc0ed,_0x7bef('0xf'));logger[_0x7bef('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3dc0ed,_0x7bef('0xf'),JSON[_0x7bef('0x11')](_0x65a09b));if(_0x65a09b['error']){if(_0x65a09b[_0x7bef('0x12')]['code']===0x1f4){logger[_0x7bef('0x12')](_0x7bef('0xe'),_0x3dc0ed,_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);return _0x1c8933(_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);}logger[_0x7bef('0x12')](_0x7bef('0xe'),_0x3dc0ed,_0x65a09b[_0x7bef('0x12')]['message']);return _0x56c3ec(_0x65a09b[_0x7bef('0x12')][_0x7bef('0x13')]);}else{logger[_0x7bef('0xd')](_0x7bef('0xe'),_0x3dc0ed,_0x7bef('0xf'));_0x56c3ec(_0x65a09b['result'][_0x7bef('0x13')]);}})[_0x7bef('0x14')](function(_0x133370){logger[_0x7bef('0x12')]('MailApplication,\x20%s,\x20%s',_0x3dc0ed,_0x133370);_0x1c8933(_0x133370);});});}exports['UpdateMailApplication']=function(_0x595cbc){var _0x31a6e3=this;return new Promise(function(_0x5d3192,_0x3ec256){return db[_0x7bef('0x15')][_0x7bef('0x16')](_0x595cbc[_0x7bef('0x17')],{'raw':_0x595cbc['options']?_0x595cbc[_0x7bef('0x18')][_0x7bef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595cbc[_0x7bef('0x18')]?_0x595cbc[_0x7bef('0x18')][_0x7bef('0x1a')]||null:null,'attributes':_0x595cbc[_0x7bef('0x18')]?_0x595cbc['options'][_0x7bef('0x1b')]||null:null,'limit':_0x595cbc[_0x7bef('0x18')]?_0x595cbc[_0x7bef('0x18')][_0x7bef('0x1c')]||null:null})['then'](function(_0x1df621){logger[_0x7bef('0xd')](_0x7bef('0x1d'),_0x595cbc);logger['debug'](_0x7bef('0x1d'),_0x595cbc,JSON[_0x7bef('0x11')](_0x1df621));_0x5d3192(_0x1df621);})[_0x7bef('0x14')](function(_0x424ff3){logger['error'](_0x7bef('0x1d'),_0x424ff3['message'],_0x595cbc);_0x3ec256(_0x31a6e3['error'](0x1f4,_0x424ff3['message']));});});}; \ No newline at end of file +var _0x41cb=['client','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37f9ab,_0x35d0cf){var _0x5735e9=function(_0x640615){while(--_0x640615){_0x37f9ab['push'](_0x37f9ab['shift']());}};_0x5735e9(++_0x35d0cf);}(_0x41cb,0xf6));var _0xb41c=function(_0xc6d868,_0x550be5){_0xc6d868=_0xc6d868-0x0;var _0x195cd1=_0x41cb[_0xc6d868];return _0x195cd1;};'use strict';var _=require('lodash');var util=require(_0xb41c('0x0'));var moment=require(_0xb41c('0x1'));var BPromise=require(_0xb41c('0x2'));var rs=require(_0xb41c('0x3'));var fs=require('fs');var Redis=require(_0xb41c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb41c('0x5'));var logger=require(_0xb41c('0x6'))(_0xb41c('0x7'));var config=require(_0xb41c('0x8'));var jayson=require(_0xb41c('0x9'));var client=jayson[_0xb41c('0xa')][_0xb41c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290da0,_0x1e6711,_0x113a1d){return new BPromise(function(_0xe0554d,_0x518a28){return client[_0xb41c('0xc')](_0x290da0,_0x113a1d)[_0xb41c('0xd')](function(_0x50ddad){logger['info'](_0xb41c('0xe'),_0x1e6711,'request\x20sent');logger[_0xb41c('0xf')](_0xb41c('0x10'),_0x1e6711,_0xb41c('0x11'),JSON[_0xb41c('0x12')](_0x50ddad));if(_0x50ddad[_0xb41c('0x13')]){if(_0x50ddad[_0xb41c('0x13')][_0xb41c('0x14')]===0x1f4){logger[_0xb41c('0x13')]('MailApplication,\x20%s,\x20%s',_0x1e6711,_0x50ddad[_0xb41c('0x13')][_0xb41c('0x15')]);return _0x518a28(_0x50ddad[_0xb41c('0x13')][_0xb41c('0x15')]);}logger[_0xb41c('0x13')](_0xb41c('0xe'),_0x1e6711,_0x50ddad['error']['message']);return _0xe0554d(_0x50ddad['error'][_0xb41c('0x15')]);}else{logger[_0xb41c('0x16')](_0xb41c('0xe'),_0x1e6711,_0xb41c('0x11'));_0xe0554d(_0x50ddad[_0xb41c('0x17')][_0xb41c('0x15')]);}})['catch'](function(_0x3bb552){logger[_0xb41c('0x13')](_0xb41c('0xe'),_0x1e6711,_0x3bb552);_0x518a28(_0x3bb552);});});}exports[_0xb41c('0x18')]=function(_0x11d3ce){var _0x51a7b2=this;return new Promise(function(_0x14d62e,_0x570982){return db[_0xb41c('0x19')][_0xb41c('0x1a')](_0x11d3ce[_0xb41c('0x1b')],{'raw':_0x11d3ce[_0xb41c('0x1c')]?_0x11d3ce['options'][_0xb41c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d3ce[_0xb41c('0x1c')]?_0x11d3ce[_0xb41c('0x1c')]['where']||null:null,'attributes':_0x11d3ce[_0xb41c('0x1c')]?_0x11d3ce[_0xb41c('0x1c')][_0xb41c('0x1e')]||null:null,'limit':_0x11d3ce[_0xb41c('0x1c')]?_0x11d3ce[_0xb41c('0x1c')]['limit']||null:null})['then'](function(_0x1ed902){logger[_0xb41c('0x16')](_0xb41c('0x18'),_0x11d3ce);logger['debug']('UpdateMailApplication',_0x11d3ce,JSON['stringify'](_0x1ed902));_0x14d62e(_0x1ed902);})[_0xb41c('0x1f')](function(_0x1f6bda){logger[_0xb41c('0x13')](_0xb41c('0x18'),_0x1f6bda[_0xb41c('0x15')],_0x11d3ce);_0x570982(_0x51a7b2[_0xb41c('0x13')](0x1f4,_0x1f6bda[_0xb41c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1454805..b3e32c8 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 _0xd175=['../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service'];(function(_0xfeed4f,_0x287cab){var _0x2c404a=function(_0x275147){while(--_0x275147){_0xfeed4f['push'](_0xfeed4f['shift']());}};_0x2c404a(++_0x287cab);}(_0xd175,0x1d2));var _0x5d17=function(_0x164aa5,_0x36a515){_0x164aa5=_0x164aa5-0x0;var _0x2c9123=_0xd175[_0x164aa5];return _0x2c9123;};'use strict';var express=require('express');var router=express[_0x5d17('0x0')]();var auth=require(_0x5d17('0x1'));var interaction=require(_0x5d17('0x2'));var controller=require(_0x5d17('0x3'));router[_0x5d17('0x4')]('/',auth['isAuthenticated'](),controller[_0x5d17('0x5')]);router[_0x5d17('0x4')]('/describe',auth[_0x5d17('0x6')](),controller[_0x5d17('0x7')]);router['get']('/:id',auth[_0x5d17('0x6')](),controller[_0x5d17('0x8')]);router[_0x5d17('0x4')](_0x5d17('0x9'),auth[_0x5d17('0x6')](),controller[_0x5d17('0xa')]);router[_0x5d17('0x4')](_0x5d17('0xb'),auth[_0x5d17('0x6')](),controller['download']);router[_0x5d17('0xc')]('/',auth[_0x5d17('0x6')](),controller['create']);router[_0x5d17('0xc')](_0x5d17('0x9'),auth['isAuthenticated'](),controller[_0x5d17('0xd')]);router[_0x5d17('0xc')](_0x5d17('0xe'),auth['isAuthenticated'](),interaction[_0x5d17('0xf')](_0x5d17('0x10'),'mailinteraction:addtags'),controller[_0x5d17('0x11')]);router[_0x5d17('0x12')](_0x5d17('0x13'),auth[_0x5d17('0x6')](),interaction[_0x5d17('0xf')](_0x5d17('0x10'),_0x5d17('0x14')),controller['update']);router[_0x5d17('0x15')]('/:id',auth[_0x5d17('0x6')](),interaction[_0x5d17('0xf')](_0x5d17('0x10'),_0x5d17('0x16')),controller[_0x5d17('0x17')]);router[_0x5d17('0x15')](_0x5d17('0xe'),auth[_0x5d17('0x6')](),controller[_0x5d17('0x18')]);module[_0x5d17('0x19')]=router; \ No newline at end of file +var _0x1344=['mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','mail'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x1344,0x14d));var _0x4134=function(_0x4ded16,_0x23fcbf){_0x4ded16=_0x4ded16-0x0;var _0x4a525a=_0x1344[_0x4ded16];return _0x4a525a;};'use strict';var express=require(_0x4134('0x0'));var router=express[_0x4134('0x1')]();var auth=require(_0x4134('0x2'));var interaction=require(_0x4134('0x3'));var controller=require('./mailInteraction.controller');router[_0x4134('0x4')]('/',auth[_0x4134('0x5')](),controller[_0x4134('0x6')]);router['get'](_0x4134('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x4134('0x4')](_0x4134('0x8'),auth[_0x4134('0x5')](),controller['show']);router['get'](_0x4134('0x9'),auth[_0x4134('0x5')](),controller[_0x4134('0xa')]);router[_0x4134('0x4')]('/:id/download',auth[_0x4134('0x5')](),controller[_0x4134('0xb')]);router['post']('/',auth[_0x4134('0x5')](),controller[_0x4134('0xc')]);router[_0x4134('0xd')](_0x4134('0x9'),auth['isAuthenticated'](),controller[_0x4134('0xe')]);router[_0x4134('0xd')](_0x4134('0xf'),auth[_0x4134('0x5')](),interaction[_0x4134('0x10')](_0x4134('0x11'),_0x4134('0x12')),controller['addTags']);router[_0x4134('0x13')](_0x4134('0x8'),auth[_0x4134('0x5')](),interaction[_0x4134('0x10')](_0x4134('0x11'),_0x4134('0x14')),controller[_0x4134('0x15')]);router[_0x4134('0x16')]('/:id',auth[_0x4134('0x5')](),interaction['tracked']('mail',_0x4134('0x17')),controller[_0x4134('0x18')]);router[_0x4134('0x16')](_0x4134('0xf'),auth[_0x4134('0x5')](),controller[_0x4134('0x19')]);module[_0x4134('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 30538c6..a859f4c 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 _0x5f02=['out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0xf2532a,_0x1a3d34){var _0x22891f=function(_0x1081a6){while(--_0x1081a6){_0xf2532a['push'](_0xf2532a['shift']());}};_0x22891f(++_0x1a3d34);}(_0x5f02,0x160));var _0x25f0=function(_0x4bf758,_0x355686){_0x4bf758=_0x4bf758-0x0;var _0x490fce=_0x5f02[_0x4bf758];return _0x490fce;};'use strict';var Sequelize=require(_0x25f0('0x0'));var iconv=require('iconv');module[_0x25f0('0x1')]={'closed':{'type':Sequelize[_0x25f0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x25f0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x25f0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x25f0('0x4')]},'inReplyTo':{'type':Sequelize[_0x25f0('0x4')](0x1fe)},'to':{'type':Sequelize[_0x25f0('0x4')]},'cc':{'type':Sequelize[_0x25f0('0x5')](_0x25f0('0x6'))},'subject':{'type':Sequelize[_0x25f0('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x25f0('0x3')]},'substatus':{'type':Sequelize[_0x25f0('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x25f0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x25f0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x25f0('0x7')]('in',_0x25f0('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x25f0('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1352=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x2074e3,_0x279dcc){var _0x1dd735=function(_0x2ad5f1){while(--_0x2ad5f1){_0x2074e3['push'](_0x2074e3['shift']());}};_0x1dd735(++_0x279dcc);}(_0x1352,0x17a));var _0x2135=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x1352[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x2135('0x0'));var iconv=require(_0x2135('0x1'));module[_0x2135('0x2')]={'closed':{'type':Sequelize[_0x2135('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2135('0x4')]},'disposition':{'type':Sequelize[_0x2135('0x5')]},'secondDisposition':{'type':Sequelize[_0x2135('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2135('0x5')]},'note':{'type':Sequelize[_0x2135('0x5')]},'inReplyTo':{'type':Sequelize[_0x2135('0x5')](0x1fe)},'to':{'type':Sequelize[_0x2135('0x5')]},'cc':{'type':Sequelize[_0x2135('0x6')](_0x2135('0x7'))},'subject':{'type':Sequelize[_0x2135('0x6')]()},'attach':{'type':Sequelize[_0x2135('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x2135('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x2135('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2135('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2135('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2135('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2135('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 02e3e12..be9d6af 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 _0xb470=['MailAccountId','where','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','merge','Account.key','i.id','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','all','rows','params','includeAll','options','create','body','describe','addMessage','ids','getMessages','hasOwnProperty','sort','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','addTags','setTags','omit','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','attachments','Attachment','Messages','bcc','subject','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','fullname','TagIds','Tags','split','forEach','MailMessage','findOne','out','-id','lastMsgText','trimStart','plainBody','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','MailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','pick','select','field','color','tools_tags','u.id','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','from','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty'];(function(_0xa250da,_0x56509d){var _0x34fa9a=function(_0x5d9a0b){while(--_0x5d9a0b){_0xa250da['push'](_0xa250da['shift']());}};_0x34fa9a(++_0x56509d);}(_0xb470,0x75));var _0x0b47=function(_0x5040f3,_0xbc7043){_0x5040f3=_0x5040f3-0x0;var _0x43f1b1=_0xb470[_0x5040f3];return _0x43f1b1;};'use strict';var emlformat=require(_0x0b47('0x0'));var rimraf=require(_0x0b47('0x1'));var zipdir=require(_0x0b47('0x2'));var moment=require(_0x0b47('0x3'));var BPromise=require('bluebird');var util=require(_0x0b47('0x4'));var path=require(_0x0b47('0x5'));var fs=require('fs');var _=require(_0x0b47('0x6'));var squel=require('squel');var juice=require(_0x0b47('0x7'));var Redis=require(_0x0b47('0x8'));var qs=require(_0x0b47('0x9'));var as=require(_0x0b47('0xa'));var logger=require(_0x0b47('0xb'))(_0x0b47('0xc'));var config=require(_0x0b47('0xd'));var db=require(_0x0b47('0xe'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config['redis'],{'host':_0x0b47('0xf'),'port':0x18eb});var socket=require(_0x0b47('0x10'))(new Redis(config['redis']));require(_0x0b47('0x11'))[_0x0b47('0x12')](socket);function respondWithStatusCode(_0x243f01,_0x7ba653){_0x7ba653=_0x7ba653||0xcc;return function(_0x3a7c83){if(_0x3a7c83){return _0x243f01[_0x0b47('0x13')](_0x7ba653);}return _0x243f01[_0x0b47('0x14')](_0x7ba653)[_0x0b47('0x15')]();};}function respondWithResult(_0x58b8d,_0x3d8949){_0x3d8949=_0x3d8949||0xc8;return function(_0x53ce05){if(_0x53ce05){return _0x58b8d['status'](_0x3d8949)[_0x0b47('0x16')](_0x53ce05);}};}function respondWithFilteredResult(_0x511b6e,_0x1e58a5){return function(_0x1e4988){if(_0x1e4988){var _0x4d427b=typeof _0x1e58a5[_0x0b47('0x17')]===_0x0b47('0x18')&&typeof _0x1e58a5[_0x0b47('0x19')]===_0x0b47('0x18');var _0x387084=_0x1e4988[_0x0b47('0x1a')];var _0x1e9588=_0x4d427b?0x0:_0x1e58a5[_0x0b47('0x17')];var _0x130a13=_0x4d427b?_0x1e4988[_0x0b47('0x1a')]:_0x1e58a5['offset']+_0x1e58a5[_0x0b47('0x19')];var _0x4e5f56;if(_0x130a13>=_0x387084){_0x130a13=_0x387084;_0x4e5f56=0xc8;}else{_0x4e5f56=0xce;}_0x511b6e[_0x0b47('0x14')](_0x4e5f56);return _0x511b6e[_0x0b47('0x1b')](_0x0b47('0x1c'),_0x1e9588+'-'+_0x130a13+'/'+_0x387084)['json'](_0x1e4988);}return null;};}function saveUpdates(_0x5cf426){return function(_0x5aee61){if(_0x5aee61){return _0x5aee61['update'](_0x5cf426)[_0x0b47('0x1d')](function(_0x395591){return _0x395591;});}return null;};}function removeEntity(_0x52071c){return function(_0x3f1c9c){if(_0x3f1c9c){return _0x3f1c9c['destroy']()[_0x0b47('0x1d')](function(){_0x52071c[_0x0b47('0x14')](0xcc)[_0x0b47('0x15')]();});}};}function handleEntityNotFound(_0x1b8f26){return function(_0x13180b){if(!_0x13180b){_0x1b8f26[_0x0b47('0x13')](0x194);}return _0x13180b;};}function handleError(_0x3bd7f1,_0x2dfdb4){_0x2dfdb4=_0x2dfdb4||0x1f4;return function(_0x3bff28){logger[_0x0b47('0x1e')](_0x3bff28[_0x0b47('0x1f')]);if(_0x3bff28['name']){delete _0x3bff28[_0x0b47('0x20')];}_0x3bd7f1[_0x0b47('0x14')](_0x2dfdb4)['send'](_0x3bff28);};}function getInteractionUsers(_0x32559d,_0x2a2287){return new BPromise(function(_0x27518e,_0xd9c35c){try{if(_0x2a2287[_0x32559d['id']]){_0x32559d['Users']=_['map'](_0x2a2287[_0x32559d['id']],function(_0x375983){return{'id':_0x375983['id'],'fullname':_0x375983[_0x0b47('0x21')]};});}}catch(_0x5950fa){_0xd9c35c(_0x5950fa);}_0x27518e(_0x32559d);});}function getInteractionTags(_0x138a03,_0x4509fc){return new BPromise(function(_0x3f0ab4,_0x195d5a){try{if(_0x138a03[_0x0b47('0x22')]){_0x138a03[_0x0b47('0x23')]=[];_0x138a03[_0x0b47('0x22')][_0x0b47('0x24')](',')[_0x0b47('0x25')](function(_0x15d877){_0x138a03[_0x0b47('0x23')]['push'](_0x4509fc[_0x15d877]);});}delete _0x138a03['TagIds'];}catch(_0x10c966){_0x195d5a(_0x10c966);}_0x3f0ab4(_0x138a03);});}function getLastMessageText(_0x4a446e){return new BPromise(function(_0x66f8cf,_0x9a2cc1){return db[_0x0b47('0x26')][_0x0b47('0x27')]({'where':{'$and':[{'MailInteractionId':_0x4a446e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0b47('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0b47('0x29'),'raw':!![]})[_0x0b47('0x1d')](function(_0x374589){if(_0x374589&&_0x374589['plainBody']){_0x4a446e[_0x0b47('0x2a')]=_[_0x0b47('0x2b')](_0x374589[_0x0b47('0x2c')]);}_0x66f8cf(_0x4a446e);})[_0x0b47('0x2d')](function(_0x417915){_0x9a2cc1(_0x417915);});});}function updateMailInteraction(_0x31942a,_0x5cdd7b,_0x56eeac,_0x2a8a9f){return new BPromise(function(_0x20a2d6,_0x125508){return getInteractionUsers(_0x31942a,_0x56eeac)[_0x0b47('0x1d')](function(_0xa631ff){return getInteractionTags(_0xa631ff,_0x5cdd7b);})[_0x0b47('0x1d')](function(_0x42fa6c){return getStateInteraction(_0x42fa6c);})[_0x0b47('0x1d')](function(_0x44131f){if(_0x2a8a9f){_0x20a2d6(getLastMessageText(_0x44131f));}else{_0x20a2d6(_0x44131f);}})[_0x0b47('0x2d')](function(_0x39a74a){_0x125508(_0x39a74a);});});}function getStateInteraction(_0x4bf8cb){return new BPromise(function(_0x50fd74){_0x4bf8cb[_0x0b47('0x2e')]=0x0;_0x4bf8cb['talking']=0x0;_0x4bf8cb[_0x0b47('0x2f')]=0x0;_0x4bf8cb[_0x0b47('0x30')]=0x0;_0x4bf8cb[_0x0b47('0x31')]=0x0;if(!_0x4bf8cb[_0x0b47('0x32')]&&!_0x4bf8cb[_0x0b47('0x33')]){_0x4bf8cb[_0x0b47('0x2e')]+=0x1;}if(!_0x4bf8cb['closed']&&_0x4bf8cb['UserId']){_0x4bf8cb['talking']+=0x1;if(_0x4bf8cb[_0x0b47('0x2e')]){_0x4bf8cb[_0x0b47('0x2e')]-=0x1;}}if(_0x4bf8cb[_0x0b47('0x32')]&&_0x4bf8cb[_0x0b47('0x33')]){_0x4bf8cb[_0x0b47('0x2f')]+=0x1;if(_0x4bf8cb[_0x0b47('0x34')]){_0x4bf8cb['talking']-=0x1;}}if(_0x4bf8cb[_0x0b47('0x32')]&&!_0x4bf8cb[_0x0b47('0x33')]){_0x4bf8cb[_0x0b47('0x30')]+=0x1;if(_0x4bf8cb[_0x0b47('0x2e')]){_0x4bf8cb['waiting']-=0x1;}}_0x4bf8cb['total']+=0x1;_0x50fd74(_0x4bf8cb);});}exports[_0x0b47('0x35')]=function(_0x46f0cf,_0x50b5a2){var _0x417db0={},_0x10e52b={},_0xa332b7={'count':0x0,'rows':[]};var _0x5cc3b6=_['map'](db[_0x0b47('0x36')][_0x0b47('0x37')],function(_0x139a16){return{'name':_0x139a16[_0x0b47('0x38')],'type':_0x139a16[_0x0b47('0x39')][_0x0b47('0x3a')]};});_0x10e52b[_0x0b47('0x3b')]=_[_0x0b47('0x3c')](_0x5cc3b6,_0x0b47('0x20'));_0x10e52b[_0x0b47('0x3d')]=_[_0x0b47('0x3e')](_0x46f0cf[_0x0b47('0x3d')]);_0x10e52b[_0x0b47('0x3f')]=_['intersection'](_0x10e52b['model'],_0x10e52b[_0x0b47('0x3d')]);_0x417db0['attributes']=_[_0x0b47('0x40')](_0x10e52b['model'],qs[_0x0b47('0x41')](_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x41')]));_0x417db0[_0x0b47('0x42')]=_0x417db0['attributes'][_0x0b47('0x43')]?_0x417db0[_0x0b47('0x42')]:_0x10e52b['model'];if(!_0x46f0cf[_0x0b47('0x3d')]['hasOwnProperty'](_0x0b47('0x44'))){_0x417db0[_0x0b47('0x19')]=qs[_0x0b47('0x19')](_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x19')]);_0x417db0[_0x0b47('0x17')]=qs[_0x0b47('0x17')](_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x17')]);}_0x417db0[_0x0b47('0x45')]=qs['sort'](_0x46f0cf['query']['sort']);_0x417db0['where']=qs[_0x0b47('0x3f')](_[_0x0b47('0x46')](_0x46f0cf['query'],_0x10e52b[_0x0b47('0x3f')]),_0x5cc3b6);var _0x540137=[];var _0x3e5b44=squel[_0x0b47('0x47')]()['field']('id')[_0x0b47('0x48')](_0x0b47('0x20'))[_0x0b47('0x48')](_0x0b47('0x49'))['from'](_0x0b47('0x4a'));var _0x209363=squel[_0x0b47('0x47')]()['field'](_0x0b47('0x4b'))[_0x0b47('0x48')]('u.fullname')[_0x0b47('0x48')]('ui.MailInteractionId')['from'](_0x0b47('0x4c'),'ui')[_0x0b47('0x4d')]('users','u',_0x0b47('0x4e'));var _0x53cefe=squel[_0x0b47('0x47')]()[_0x0b47('0x4f')](_0x0b47('0x50'),'i')['left_join']('cm_contacts','c',_0x0b47('0x51'))[_0x0b47('0x4d')](_0x0b47('0x52'),'o',_0x0b47('0x53'))[_0x0b47('0x4d')](_0x0b47('0x54'),'a',_0x0b47('0x55'))[_0x0b47('0x4d')](_0x0b47('0x56'),'me',_0x0b47('0x57'))[_0x0b47('0x4d')]('mail_interaction_has_tags','it',_0x0b47('0x58'))[_0x0b47('0x4d')](_0x0b47('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x57533e=squel['expr']();var _0x491ecf=[];var _0x3007bc=squel[_0x0b47('0x59')]();var _0x1e1ca1;if(_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x5a')]){_0x1e1ca1=as[_0x0b47('0x5b')](_0x46f0cf['query'][_0x0b47('0x5a')]);var _0x77b78c=_0x1e1ca1[_0x0b47('0x5c')];for(var _0x5e68a2=0x0;_0x5e68a2<_0x1e1ca1[_0x0b47('0x5d')][_0x0b47('0x43')];_0x5e68a2++){var _0x40b60f=_0x1e1ca1[_0x0b47('0x5d')][_0x5e68a2];var _0x2029c9='i';var _0x53050b=_['find'](_0x5cc3b6,[_0x0b47('0x20'),_0x40b60f[_0x0b47('0x48')]]);if(!_0x53050b){switch(_0x40b60f['field']){case _0x0b47('0x5e'):if(_0x40b60f[_0x0b47('0x5f')]==0x1){_0x53cefe[_0x0b47('0x60')]('`'+_0x40b60f[_0x0b47('0x48')]+_0x0b47('0x61'));}else{_0x53cefe[_0x0b47('0x60')]('`'+_0x40b60f[_0x0b47('0x48')]+_0x0b47('0x62'));}break;case'Contact':if(_0x40b60f[_0x0b47('0x63')]==='$substring'){if(_0x40b60f[_0x0b47('0x5f')][_0x0b47('0x24')]('\x20')[_0x0b47('0x43')]>0x1){_0x57533e[_0x77b78c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0b47('0x64')](_0x40b60f[_0x0b47('0x5f')]),null);}else{var _0x1c8516='%'+_0x40b60f[_0x0b47('0x5f')]+'%';_0x57533e[_0x77b78c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1c8516,_0x1c8516,_0x1c8516);}}else{_0x53050b=_[_0x0b47('0x65')](_0x5cc3b6,['name',_0x0b47('0x66')]);_0x40b60f[_0x0b47('0x48')]=_0x0b47('0x66');_0x430dce=as[_0x0b47('0x67')](_0x2029c9,_0x53050b[_0x0b47('0x39')],_0x40b60f);_0x57533e[_0x77b78c](_0x430dce[_0x0b47('0x68')],_0x430dce[_0x0b47('0x5f')][_0x0b47('0x69')],_0x430dce[_0x0b47('0x5f')][_0x0b47('0x15')]);}break;case _0x0b47('0x6a'):var _0x3ded91=_0x40b60f[_0x0b47('0x5f')][_0x0b47('0x24')](',')['map'](function(_0x46d973){return Number(_0x46d973);});_0x3ded91[_0x0b47('0x25')](function(_0x4d30b6){_0x3007bc['or'](_0x0b47('0x6b'),'%,'+_0x4d30b6+',%');});_0x491ecf=_[_0x0b47('0x6c')](_0x491ecf,_0x3ded91);break;case _0x0b47('0x6d'):if(_0x40b60f[_0x0b47('0x63')]===_0x0b47('0x6e')){_0x57533e[_0x77b78c](_0x0b47('0x6f'),'%'+_0x40b60f['value']+'%',null);}else{_0x53050b=_[_0x0b47('0x65')](_0x5cc3b6,[_0x0b47('0x20'),_0x0b47('0x33')]);_0x40b60f[_0x0b47('0x48')]='UserId';_0x430dce=as[_0x0b47('0x67')](_0x2029c9,_0x53050b[_0x0b47('0x39')],_0x40b60f);_0x57533e[_0x77b78c](_0x430dce[_0x0b47('0x68')],_0x430dce['value']['start'],_0x430dce[_0x0b47('0x5f')]['end']);}break;case _0x0b47('0x2c'):_0x430dce=as[_0x0b47('0x67')]('me',null,_0x40b60f);_0x57533e[_0x77b78c](_0x430dce[_0x0b47('0x68')],_0x430dce[_0x0b47('0x5f')]['start'],_0x430dce[_0x0b47('0x5f')][_0x0b47('0x15')]);break;}}else{var _0x430dce=as[_0x0b47('0x67')](_0x2029c9,_0x53050b[_0x0b47('0x39')],_0x40b60f);_0x57533e[_0x77b78c](_0x430dce['text'],_0x430dce['value'][_0x0b47('0x69')],_0x430dce[_0x0b47('0x5f')][_0x0b47('0x15')]);}}}else{var _0x5e34d0=_(_0x46f0cf[_0x0b47('0x3d')])['keys']()[_0x0b47('0x3c')](function(_0x3dd993){return _[_0x0b47('0x70')](_0x5cc3b6,[_0x0b47('0x20'),_0x3dd993])?_0x3dd993:undefined;})[_0x0b47('0x71')]()[_0x0b47('0x5f')]();if(!_[_0x0b47('0x72')](_0x5e34d0)){_0x5e34d0[_0x0b47('0x25')](function(_0x3a475a){if(_0x3a475a===_0x0b47('0x73')){_0x53cefe[_0x0b47('0x74')](_0x0b47('0x75'),[]['concat'](_0x46f0cf[_0x0b47('0x3d')][_0x3a475a]));}else if(_0x3a475a===_0x0b47('0x76')){var _0x110f99=JSON[_0x0b47('0x77')](_0x46f0cf[_0x0b47('0x3d')][_0x3a475a])[_0x0b47('0x78')];var _0x356189=JSON['parse'](_0x46f0cf[_0x0b47('0x3d')][_0x3a475a])[_0x0b47('0x79')];_0x53cefe['where'](_0x0b47('0x7a'),_0x110f99,_0x356189);}else{if(_0x46f0cf[_0x0b47('0x3d')][_0x3a475a]==='null'){_0x53cefe[_0x0b47('0x74')]('i.'+_0x3a475a+_0x0b47('0x7b'));}else{_0x53cefe[_0x0b47('0x74')]('i.'+_0x3a475a+_0x0b47('0x7c'),_0x46f0cf[_0x0b47('0x3d')][_0x3a475a]);}}});}if(_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x7d')]){if(_0x46f0cf[_0x0b47('0x3d')]['read']==0x1){_0x53cefe['having'](_0x0b47('0x7e'));}else{_0x53cefe[_0x0b47('0x60')](_0x0b47('0x7f'));}}if(_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x80')]){_0x491ecf=_[_0x0b47('0x81')](_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x80')])?_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x80')]:new Array(_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x80')]);_0x491ecf['forEach'](function(_0x2eeeff){_0x3007bc['or'](_0x0b47('0x6b'),'%,'+_0x2eeeff+',%');});}if(_0x46f0cf['query'][_0x0b47('0x82')]){var _0x1bdb6e=_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x82')][_0x0b47('0x83')]('\x5c','\x5c\x5c')[_0x0b47('0x83')](/'/g,'\x27\x27');if(qs[_0x0b47('0x84')](_0x1bdb6e)){_0x57533e['or'](_0x0b47('0x85'),_0x1bdb6e+'%');}else if(qs[_0x0b47('0x86')](_0x1bdb6e)){_0x57533e['or'](_0x0b47('0x87'),_0x1bdb6e+'%');}else{_0x57533e['or'](_0x0b47('0x88'),qs[_0x0b47('0x64')](_0x1bdb6e))['or'](_0x0b47('0x89'),qs[_0x0b47('0x64')](_0x1bdb6e));}}}_0x53cefe[_0x0b47('0x74')](_0x57533e);_0x53cefe[_0x0b47('0x8a')]('i.id');var _0x1f4238={'type':db[_0x0b47('0x8b')][_0x0b47('0x8c')][_0x0b47('0x8d')],'raw':!![]};var _0x466685=_0x53cefe['clone']();_0x466685[_0x0b47('0x48')]('i.id');_0x466685[_0x0b47('0x48')](_0x0b47('0x8e'),_0x0b47('0x5e'));if(_0x417db0[_0x0b47('0x45')]){_0x417db0['order'][_0x0b47('0x25')](function(_0x117518){var _0xf54f1a=_0x117518[0x0]===_0x0b47('0x8f')?_0x117518[0x0]:'i.'+_0x117518[0x0];_0x53cefe[_0x0b47('0x45')](_0xf54f1a,_0x117518[0x1]===_0x0b47('0x90')?![]:!![]);});}if(!_[_0x0b47('0x72')](_0x491ecf)){_0x53cefe[_0x0b47('0x60')](_0x3007bc);_0x466685['where'](_0x0b47('0x91'),_0x491ecf);}BPromise['resolve']()[_0x0b47('0x1d')](function(){if(!_0x1e1ca1){if(_0x46f0cf['query']['MailAccountId'])return;_0x466685[_0x0b47('0x74')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x53cefe[_0x0b47('0x74')](_0x0b47('0x92'));return;}if(_0x46f0cf[_0x0b47('0x93')][_0x0b47('0x94')]!==_0x0b47('0x95'))return;return _0x46f0cf[_0x0b47('0x93')][_0x0b47('0x96')]({'attributes':['id'],'raw':!![]})[_0x0b47('0x1d')](function(_0x2afe32){if(_[_0x0b47('0x72')](_0x2afe32)){_0x466685[_0x0b47('0x74')](_0x0b47('0x97'));_0x53cefe['where'](_0x0b47('0x97'));}else{_0x466685[_0x0b47('0x74')](_0x0b47('0x75'),_[_0x0b47('0x3c')](_0x2afe32,'id'));_0x53cefe['where'](_0x0b47('0x75'),_[_0x0b47('0x3c')](_0x2afe32,'id'));}});})[_0x0b47('0x1d')](function(){if(_0x46f0cf['user'][_0x0b47('0x94')]===_0x0b47('0x95')&&!_0x1e1ca1&&!_0x46f0cf[_0x0b47('0x3d')]['MailAccountId'])return[];return db['sequelize'][_0x0b47('0x3d')](_0x466685[_0x0b47('0x98')](),_0x1f4238);})[_0x0b47('0x1d')](function(_0x1e14af){_0xa332b7[_0x0b47('0x1a')]=_0x1e14af[_0x0b47('0x43')];if(_0xa332b7[_0x0b47('0x1a')]===0x0)return[];return db['sequelize']['query'](_0x3e5b44[_0x0b47('0x98')](),_0x1f4238)[_0x0b47('0x1d')](function(_0x3ef612){_0x540137=_['keyBy'](_0x3ef612,'id');_0x1f4238=_[_0x0b47('0x99')](_0x1f4238,{'model':db[_0x0b47('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x46f0cf[_0x0b47('0x3d')][_0x0b47('0x41')]){_0x417db0[_0x0b47('0x42')][_0x0b47('0x25')](function(_0x31e1c4){_0x53cefe[_0x0b47('0x48')]('i.'+_0x31e1c4);});}else{_0x53cefe['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0b47('0x5e'));_0x53cefe[_0x0b47('0x48')]('a.key',_0x0b47('0x9a'));_0x53cefe['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x53cefe['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x0b47('0x8f'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0x9b'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0x9c'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0x9d'));_0x53cefe[_0x0b47('0x48')]('i.closed');_0x53cefe[_0x0b47('0x48')](_0x0b47('0x9e'));_0x53cefe[_0x0b47('0x48')]('i.attach');_0x53cefe[_0x0b47('0x48')]('i.lastMsgAt');_0x53cefe[_0x0b47('0x48')](_0x0b47('0x9f'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xa0'));_0x53cefe[_0x0b47('0x48')]('i.disposition');_0x53cefe['field'](_0x0b47('0xa1'));_0x53cefe['field'](_0x0b47('0xa2'));_0x53cefe['field'](_0x0b47('0xa3'));_0x53cefe['field'](_0x0b47('0xa4'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xa5'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xa6'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xa7'));_0x53cefe[_0x0b47('0x48')]('c.firstName','Contact.firstName');_0x53cefe[_0x0b47('0x48')]('c.lastName',_0x0b47('0xa8'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xa9'),_0x0b47('0xaa'));_0x53cefe['field'](_0x0b47('0xab'),'Contact.phone');_0x53cefe[_0x0b47('0x48')](_0x0b47('0xac'),'Contact.mobile');_0x53cefe[_0x0b47('0x48')]('c.fax',_0x0b47('0xad'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xae'),_0x0b47('0xaf'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xb0'),_0x0b47('0xb1'));_0x53cefe[_0x0b47('0x48')](_0x0b47('0xb2'),_0x0b47('0x22'));}if(_0x417db0[_0x0b47('0x19')])_0x53cefe['limit'](_0x417db0['limit']);if(_0x417db0[_0x0b47('0x17')])_0x53cefe[_0x0b47('0x17')](_0x417db0[_0x0b47('0x17')]);return db[_0x0b47('0xb3')][_0x0b47('0x3d')](_0x53cefe[_0x0b47('0x98')](),_0x1f4238);})[_0x0b47('0x1d')](function(_0x3a137c){if(_0x3a137c[_0x0b47('0x43')]>0x0)_0x209363[_0x0b47('0x74')](_0x0b47('0xb4'),_[_0x0b47('0x3c')](_0x3a137c,'id'));return db['sequelize'][_0x0b47('0x3d')](_0x209363[_0x0b47('0x98')](),_0x1f4238)[_0x0b47('0x1d')](function(_0x191395){var _0x129e0d=_['groupBy'](_0x191395,_0x0b47('0xb5'));var _0x409399=[];return db[_0x0b47('0xb6')][_0x0b47('0x27')]({'attributes':[_0x0b47('0xb7')],'raw':!![]})['then'](function(_0x45f808){var _0x26926a=_0x45f808[_0x0b47('0xb7')];_0x3a137c[_0x0b47('0x25')](function(_0x4ee2f1){_0x409399[_0x0b47('0xb8')](updateMailInteraction(_0x4ee2f1,_0x540137,_0x129e0d,_0x26926a));});return BPromise[_0x0b47('0xb9')](_0x409399);});});});})[_0x0b47('0x1d')](function(_0x2cff35){_0xa332b7[_0x0b47('0xba')]=_0x2cff35;return _0xa332b7;})[_0x0b47('0x1d')](respondWithFilteredResult(_0x50b5a2,_0x417db0))[_0x0b47('0x2d')](handleError(_0x50b5a2,null));};exports['show']=function(_0x14a0c0,_0xf12ee4){var _0x113baa={'raw':![],'where':{'id':_0x14a0c0[_0x0b47('0xbb')]['id']}},_0x408243={};_0x408243['model']=_[_0x0b47('0x3e')](db['MailInteraction'][_0x0b47('0x37')]);_0x408243[_0x0b47('0x3d')]=_['keys'](_0x14a0c0[_0x0b47('0x3d')]);_0x408243[_0x0b47('0x3f')]=_['intersection'](_0x408243['model'],_0x408243[_0x0b47('0x3d')]);_0x113baa[_0x0b47('0x42')]=_['intersection'](_0x408243['model'],qs[_0x0b47('0x41')](_0x14a0c0[_0x0b47('0x3d')][_0x0b47('0x41')]));_0x113baa[_0x0b47('0x42')]=_0x113baa['attributes']['length']?_0x113baa[_0x0b47('0x42')]:_0x408243[_0x0b47('0x3b')];if(_0x14a0c0[_0x0b47('0x3d')][_0x0b47('0xbc')]){_0x113baa['include']=[{'all':!![]}];}_0x113baa=_[_0x0b47('0x99')]({},_0x113baa,_0x14a0c0[_0x0b47('0xbd')]);return db['MailInteraction'][_0x0b47('0x65')](_0x113baa)[_0x0b47('0x1d')](handleEntityNotFound(_0xf12ee4,null))[_0x0b47('0x1d')](respondWithResult(_0xf12ee4,null))[_0x0b47('0x2d')](handleError(_0xf12ee4,null));};exports[_0x0b47('0xbe')]=function(_0x553dde,_0x35a224){return db[_0x0b47('0x36')]['create'](_0x553dde[_0x0b47('0xbf')],{})['then'](respondWithResult(_0x35a224,0xc9))[_0x0b47('0x2d')](handleError(_0x35a224,null));};exports['update']=function(_0x12ba90,_0x4ec955){if(_0x12ba90[_0x0b47('0xbf')]['id']){delete _0x12ba90[_0x0b47('0xbf')]['id'];}return db[_0x0b47('0x36')]['find']({'where':{'id':_0x12ba90[_0x0b47('0xbb')]['id']}})['then'](handleEntityNotFound(_0x4ec955,null))[_0x0b47('0x1d')](saveUpdates(_0x12ba90['body'],null))[_0x0b47('0x1d')](respondWithResult(_0x4ec955,null))['catch'](handleError(_0x4ec955,null));};exports['destroy']=function(_0x175a9e,_0x5ab9e2){return db['MailInteraction'][_0x0b47('0x65')]({'where':{'id':_0x175a9e[_0x0b47('0xbb')]['id']}})[_0x0b47('0x1d')](handleEntityNotFound(_0x5ab9e2,null))[_0x0b47('0x1d')](removeEntity(_0x5ab9e2,null))[_0x0b47('0x2d')](handleError(_0x5ab9e2,null));};exports[_0x0b47('0xc0')]=function(_0x2cb6a1,_0x2d7394){return db[_0x0b47('0x36')][_0x0b47('0xc0')]()[_0x0b47('0x1d')](respondWithResult(_0x2d7394,null))[_0x0b47('0x2d')](handleError(_0x2d7394,null));};exports[_0x0b47('0xc1')]=function(_0x23cd4b,_0x4a76a0){return db[_0x0b47('0x26')][_0x0b47('0x65')]({'where':{'id':_0x23cd4b[_0x0b47('0xbb')]['id']}})[_0x0b47('0x1d')](handleEntityNotFound(_0x4a76a0,null))['then'](function(_0x5cdccd){if(_0x5cdccd){return _0x5cdccd['addMessage'](_0x23cd4b[_0x0b47('0xbf')][_0x0b47('0xc2')],_['omit'](_0x23cd4b[_0x0b47('0xbf')],[_0x0b47('0xc2'),'id'])||{});}})[_0x0b47('0x1d')](respondWithResult(_0x4a76a0,null))[_0x0b47('0x2d')](handleError(_0x4a76a0,null));};exports[_0x0b47('0xc3')]=function(_0x1c66a4,_0xef10e6){var _0x52d838={'raw':![],'where':{}};var _0x2d311b={};var _0x2d8377={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1c66a4[_0x0b47('0xbb')]['id']}})[_0x0b47('0x1d')](handleEntityNotFound(_0xef10e6,null))[_0x0b47('0x1d')](function(_0x4a4982){if(_0x4a4982){_0x2d311b['model']=_['keys'](db[_0x0b47('0x26')]['rawAttributes']);_0x2d311b[_0x0b47('0x3d')]=_[_0x0b47('0x3e')](_0x1c66a4[_0x0b47('0x3d')]);_0x2d311b[_0x0b47('0x3f')]=_[_0x0b47('0x40')](_0x2d311b['model'],_0x2d311b[_0x0b47('0x3d')]);_0x52d838[_0x0b47('0x42')]=_[_0x0b47('0x40')](_0x2d311b['model'],qs[_0x0b47('0x41')](_0x1c66a4['query'][_0x0b47('0x41')]));_0x52d838['attributes']=_0x52d838[_0x0b47('0x42')][_0x0b47('0x43')]?_0x52d838[_0x0b47('0x42')]:_0x2d311b[_0x0b47('0x3b')];if(!_0x1c66a4[_0x0b47('0x3d')][_0x0b47('0xc4')]('nolimit')){_0x52d838[_0x0b47('0x19')]=qs['limit'](_0x1c66a4[_0x0b47('0x3d')]['limit']);_0x52d838[_0x0b47('0x17')]=qs[_0x0b47('0x17')](_0x1c66a4['query'][_0x0b47('0x17')]);}_0x52d838[_0x0b47('0x45')]=qs[_0x0b47('0xc5')](_0x1c66a4[_0x0b47('0x3d')][_0x0b47('0xc5')]);_0x52d838[_0x0b47('0x74')]=qs[_0x0b47('0x3f')](_[_0x0b47('0x46')](_0x1c66a4[_0x0b47('0x3d')],_0x2d311b[_0x0b47('0x3f')]));_0x52d838[_0x0b47('0x74')]['MailInteractionId']=_0x4a4982['id'];if(_0x1c66a4[_0x0b47('0x3d')][_0x0b47('0x82')]){_0x52d838['where']=_[_0x0b47('0x99')](_0x52d838[_0x0b47('0x74')],{'$or':_['map'](_0x52d838[_0x0b47('0x42')],function(_0x5abb3f){var _0x2fc2cb={};_0x2fc2cb[_0x5abb3f]={'$like':'%'+_0x1c66a4[_0x0b47('0x3d')][_0x0b47('0x82')]+'%'};return _0x2fc2cb;})});}if(_0x1c66a4[_0x0b47('0x3d')]['$gte']){var _0x3c847b=_0x1c66a4[_0x0b47('0x3d')]['$gte'][_0x0b47('0x24')](',');var _0x33f4b8={};_0x33f4b8[_0x3c847b[0x0]]={'$gte':moment(_0x3c847b[0x1])[_0x0b47('0xc6')](_0x0b47('0xc7'))};_0x52d838[_0x0b47('0x74')]=_[_0x0b47('0x99')](_0x52d838[_0x0b47('0x74')],_0x33f4b8);}_0x52d838=_[_0x0b47('0x99')]({},_0x52d838,_0x1c66a4[_0x0b47('0xbd')]);return db[_0x0b47('0x26')][_0x0b47('0x1a')]({'where':_0x52d838['where']})[_0x0b47('0x1d')](function(_0x4ac809){_0x2d8377['count']=_0x4ac809;if(_0x1c66a4[_0x0b47('0x3d')][_0x0b47('0xbc')]){_0x52d838[_0x0b47('0xc8')]=[{'all':!![]}];}return db[_0x0b47('0x26')]['findAll'](_0x52d838);})[_0x0b47('0x1d')](function(_0x39dec2){if(_0x1c66a4['query'][_0x0b47('0xc9')]===_0x0b47('0xca')){for(var _0xf001c5=0x0;_0xf001c5<_0x39dec2[_0x0b47('0x43')];_0xf001c5++){_0x39dec2[_0xf001c5][_0x0b47('0xbf')]=juice(_0x39dec2[_0xf001c5][_0x0b47('0xbf')]);}}_0x2d8377[_0x0b47('0xba')]=_0x39dec2;return _0x2d8377;});}})['then'](respondWithFilteredResult(_0xef10e6,_0x52d838))['catch'](handleError(_0xef10e6,null));};exports[_0x0b47('0xcb')]=function(_0x572f18,_0x2267db){return db[_0x0b47('0x36')][_0x0b47('0x65')]({'where':{'id':_0x572f18['params']['id']}})[_0x0b47('0x1d')](handleEntityNotFound(_0x2267db,null))[_0x0b47('0x1d')](function(_0x1da7f1){if(_0x1da7f1){return _0x1da7f1[_0x0b47('0xcc')](_0x572f18['body'][_0x0b47('0xc2')],_[_0x0b47('0xcd')](_0x572f18[_0x0b47('0xbf')],['ids','id'])||{})[_0x0b47('0xce')](function(){return db['Tag'][_0x0b47('0xcf')]({'attributes':['id',_0x0b47('0x20'),_0x0b47('0x49')],'where':{'id':_0x572f18[_0x0b47('0xbf')]['ids']}});})[_0x0b47('0x1d')](function(_0x4c6d5e){socket[_0x0b47('0xd0')](_0x0b47('0xd1'),{'id':Number(_0x572f18[_0x0b47('0xbb')]['id']),'tags':_0x4c6d5e||[]});return{'id':Number(_0x572f18[_0x0b47('0xbb')]['id']),'tags':_0x4c6d5e||[]};});}})[_0x0b47('0x1d')](respondWithResult(_0x2267db,null))[_0x0b47('0x2d')](handleError(_0x2267db,null));};exports[_0x0b47('0xd2')]=function(_0x468e4f,_0x45e198){return db[_0x0b47('0x36')][_0x0b47('0x65')]({'where':{'id':_0x468e4f[_0x0b47('0xbb')]['id']}})[_0x0b47('0x1d')](handleEntityNotFound(_0x45e198,null))[_0x0b47('0x1d')](function(_0x4ccb19){if(_0x4ccb19){return _0x4ccb19[_0x0b47('0xd2')](_0x468e4f[_0x0b47('0x3d')][_0x0b47('0xc2')]);}})[_0x0b47('0x1d')](respondWithStatusCode(_0x45e198,null))[_0x0b47('0x2d')](handleError(_0x45e198,null));};exports[_0x0b47('0xd3')]=function(_0x3f486d,_0x2f33c6){var _0x2ec8b7=moment()[_0x0b47('0xd4')]()[_0x0b47('0x98')]();var _0x1471b4=path[_0x0b47('0xd5')](config[_0x0b47('0xd6')],'server',_0x0b47('0xd7'),'tmp');var _0x265073=path[_0x0b47('0xd5')](config[_0x0b47('0xd6')],'server',_0x0b47('0xd7'),_0x0b47('0xd8'));var _0x1f1b69=path['join'](_0x1471b4,_0x2ec8b7);var _0x1d67e6=util['format']('transcript-%d-%s.zip',_0x3f486d[_0x0b47('0xbb')]['id'],_0x2ec8b7);var _0x521586=path[_0x0b47('0xd5')](_0x1471b4,_0x1d67e6);var _0x4476f9=[];if(_0x3f486d[_0x0b47('0x3d')][_0x0b47('0xd8')]){_0x4476f9[_0x0b47('0xb8')]({'model':db[_0x0b47('0xd9')],'as':'Attachments','raw':!![]});}var _0x5d6a41=[{'model':db[_0x0b47('0x26')],'as':_0x0b47('0xda'),'attributes':['id',_0x0b47('0xbf'),_0x0b47('0x4f'),'to','cc',_0x0b47('0xdb'),_0x0b47('0xdc'),_0x0b47('0x76')],'where':{'secret':![]},'order':qs[_0x0b47('0xc5')]('id'),'include':_0x4476f9}];return db[_0x0b47('0x36')][_0x0b47('0x65')]({'where':{'id':_0x3f486d[_0x0b47('0xbb')]['id']},'include':_0x5d6a41})[_0x0b47('0x1d')](handleEntityNotFound(_0x2f33c6,null))[_0x0b47('0x1d')](function(_0xc20434){if(_0xc20434&&_0xc20434[_0x0b47('0xda')]){var _0x416578=_0xc20434[_0x0b47('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x1f1b69);return BPromise[_0x0b47('0xde')](_0x416578[_0x0b47('0xda')],function(_0x2092e0,_0x462142){var _0x363bf0={'from':_0x2092e0[_0x0b47('0x4f')],'to':_0x2092e0['to'],'subject':_0x2092e0[_0x0b47('0xdc')],'html':htmlEntities[_0x0b47('0xdf')](_0x2092e0[_0x0b47('0xbf')]),'headers':{'Date':moment(_0x2092e0['createdAt'])['format'](_0x0b47('0xe0'))},'attachments':[]};if(_0x2092e0['cc']){_0x363bf0[_0x0b47('0xe1')]['Cc']=_0x2092e0['cc'];}if(_0x2092e0[_0x0b47('0xdb')]){_0x363bf0['headers']['Bcc']=_0x2092e0[_0x0b47('0xdb')];}return new BPromise(function(_0x7ca0c7,_0x213ac1){if(_0x2092e0[_0x0b47('0xe2')]){for(var _0x70b833=0x0;_0x70b833<_0x2092e0[_0x0b47('0xe2')][_0x0b47('0x43')];_0x70b833++){var _0x4afe12=_0x2092e0[_0x0b47('0xe2')][_0x70b833];var _0x1ccfb5=path[_0x0b47('0xd5')](_0x265073,_0x4afe12[_0x0b47('0xe3')]);if(fs[_0x0b47('0xe4')](_0x1ccfb5)){_0x363bf0[_0x0b47('0xd8')][_0x0b47('0xb8')]({'name':_0x4afe12['name'],'contentType':_0x4afe12[_0x0b47('0x39')],'data':fs['readFileSync'](_0x1ccfb5)});}}}emlformat[_0x0b47('0xe5')](_0x363bf0,function(_0x12cd22,_0xbba407){if(_0x12cd22)return _0x213ac1(_0x12cd22);fs['writeFileSync'](path['join'](_0x1f1b69,util['format'](_0x0b47('0xe6'),_0x462142)),_0xbba407);return _0x7ca0c7(_0xbba407);});});})[_0x0b47('0x1d')](function(){return new BPromise(function(_0x2cfb53,_0x598958){zipdir(_0x1f1b69,{'saveTo':_0x521586},function(_0x10d45b,_0x182355){if(_0x10d45b)return _0x598958(_0x10d45b);return _0x2cfb53(_0x182355);});})['then'](function(){return new BPromise(function(_0x448f52,_0x2dae9d){rimraf(_0x1f1b69,function(_0x628df6){if(_0x628df6)_0x2dae9d(_0x628df6);return _0x448f52();});});})['then'](function(){return _0x2f33c6[_0x0b47('0xd3')](_0x521586,_0x1d67e6,function(_0xc3feef){if(!_0xc3feef)fs[_0x0b47('0xe7')](_0x521586);});});});}else{return _0x2f33c6[_0x0b47('0x13')](0xc8);}})[_0x0b47('0x2d')](handleError(_0x2f33c6,null));}; \ No newline at end of file +var _0x4753=['show','params','MailInteraction','options','create','body','describe','addMessage','ids','omit','format','include','findAll','inlineCss','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','createdAt','Messages','get','mkdirSync','each','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','sendStatus','error','stack','name','send','fullname','TagIds','split','forEach','Tags','push','MailMessage','findOne','-id','then','lastMsgText','trimStart','plainBody','catch','waiting','talking','answered','unmanaged','UserId','closed','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','MailAccountId','i.MailAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','t.id\x20IN\x20?','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','rows'];(function(_0x5bf147,_0x3fc58c){var _0x26230e=function(_0xa16692){while(--_0xa16692){_0x5bf147['push'](_0x5bf147['shift']());}};_0x26230e(++_0x3fc58c);}(_0x4753,0x1f4));var _0x3475=function(_0x5e7235,_0x86bdda){_0x5e7235=_0x5e7235-0x0;var _0x22a4d8=_0x4753[_0x5e7235];return _0x22a4d8;};'use strict';var emlformat=require(_0x3475('0x0'));var rimraf=require(_0x3475('0x1'));var zipdir=require(_0x3475('0x2'));var moment=require('moment');var BPromise=require(_0x3475('0x3'));var util=require(_0x3475('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x3475('0x5'));var squel=require('squel');var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x3475('0x6'));var logger=require(_0x3475('0x7'))('api');var config=require(_0x3475('0x8'));var db=require(_0x3475('0x9'))['db'];var htmlEntities=require(_0x3475('0xa'));config[_0x3475('0xb')]=_[_0x3475('0xc')](config[_0x3475('0xb')],{'host':_0x3475('0xd'),'port':0x18eb});var socket=require(_0x3475('0xe'))(new Redis(config[_0x3475('0xb')]));require(_0x3475('0xf'))['register'](socket);function respondWithStatusCode(_0x30f276,_0x2524d1){_0x2524d1=_0x2524d1||0xcc;return function(_0x32e7f4){if(_0x32e7f4){return _0x30f276['sendStatus'](_0x2524d1);}return _0x30f276[_0x3475('0x10')](_0x2524d1)[_0x3475('0x11')]();};}function respondWithResult(_0x49e0fa,_0x4510dc){_0x4510dc=_0x4510dc||0xc8;return function(_0x5a1f57){if(_0x5a1f57){return _0x49e0fa[_0x3475('0x10')](_0x4510dc)[_0x3475('0x12')](_0x5a1f57);}};}function respondWithFilteredResult(_0x1b9cfc,_0x4a4485){return function(_0x3fbdd5){if(_0x3fbdd5){var _0x36d593=typeof _0x4a4485[_0x3475('0x13')]===_0x3475('0x14')&&typeof _0x4a4485['limit']===_0x3475('0x14');var _0x56e77a=_0x3fbdd5['count'];var _0x3fd0d2=_0x36d593?0x0:_0x4a4485[_0x3475('0x13')];var _0x325fe5=_0x36d593?_0x3fbdd5[_0x3475('0x15')]:_0x4a4485[_0x3475('0x13')]+_0x4a4485['limit'];var _0x1e1cb0;if(_0x325fe5>=_0x56e77a){_0x325fe5=_0x56e77a;_0x1e1cb0=0xc8;}else{_0x1e1cb0=0xce;}_0x1b9cfc['status'](_0x1e1cb0);return _0x1b9cfc[_0x3475('0x16')](_0x3475('0x17'),_0x3fd0d2+'-'+_0x325fe5+'/'+_0x56e77a)[_0x3475('0x12')](_0x3fbdd5);}return null;};}function saveUpdates(_0x36a5b8){return function(_0x5983a8){if(_0x5983a8){return _0x5983a8[_0x3475('0x18')](_0x36a5b8)['then'](function(_0x3ab7a8){return _0x3ab7a8;});}return null;};}function removeEntity(_0x460c2a){return function(_0x2e53a9){if(_0x2e53a9){return _0x2e53a9[_0x3475('0x19')]()['then'](function(){_0x460c2a[_0x3475('0x10')](0xcc)[_0x3475('0x11')]();});}};}function handleEntityNotFound(_0x649ad){return function(_0x4e0221){if(!_0x4e0221){_0x649ad[_0x3475('0x1a')](0x194);}return _0x4e0221;};}function handleError(_0x381aea,_0x438992){_0x438992=_0x438992||0x1f4;return function(_0x38ea14){logger[_0x3475('0x1b')](_0x38ea14[_0x3475('0x1c')]);if(_0x38ea14[_0x3475('0x1d')]){delete _0x38ea14[_0x3475('0x1d')];}_0x381aea[_0x3475('0x10')](_0x438992)[_0x3475('0x1e')](_0x38ea14);};}function getInteractionUsers(_0x1d0e95,_0x1e8830){return new BPromise(function(_0x1c8ca6,_0x4ff2a1){try{if(_0x1e8830[_0x1d0e95['id']]){_0x1d0e95['Users']=_['map'](_0x1e8830[_0x1d0e95['id']],function(_0x552cc){return{'id':_0x552cc['id'],'fullname':_0x552cc[_0x3475('0x1f')]};});}}catch(_0x4ad783){_0x4ff2a1(_0x4ad783);}_0x1c8ca6(_0x1d0e95);});}function getInteractionTags(_0x1f3481,_0x3f4052){return new BPromise(function(_0x6a0197,_0x1203e7){try{if(_0x1f3481[_0x3475('0x20')]){_0x1f3481['Tags']=[];_0x1f3481['TagIds'][_0x3475('0x21')](',')[_0x3475('0x22')](function(_0x3e78a8){_0x1f3481[_0x3475('0x23')][_0x3475('0x24')](_0x3f4052[_0x3e78a8]);});}delete _0x1f3481[_0x3475('0x20')];}catch(_0x5e8cc3){_0x1203e7(_0x5e8cc3);}_0x6a0197(_0x1f3481);});}function getLastMessageText(_0xd07037){return new BPromise(function(_0x1b6ef3,_0x19943f){return db[_0x3475('0x25')][_0x3475('0x26')]({'where':{'$and':[{'MailInteractionId':_0xd07037['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x3475('0x27'),'raw':!![]})[_0x3475('0x28')](function(_0x18fd29){if(_0x18fd29&&_0x18fd29['plainBody']){_0xd07037[_0x3475('0x29')]=_[_0x3475('0x2a')](_0x18fd29[_0x3475('0x2b')]);}_0x1b6ef3(_0xd07037);})[_0x3475('0x2c')](function(_0x5a4774){_0x19943f(_0x5a4774);});});}function updateMailInteraction(_0x4362ad,_0xb4cc70,_0x580942,_0x7f22c3){return new BPromise(function(_0x3c6de4,_0x295c86){return getInteractionUsers(_0x4362ad,_0x580942)[_0x3475('0x28')](function(_0x1c01bf){return getInteractionTags(_0x1c01bf,_0xb4cc70);})[_0x3475('0x28')](function(_0x4d89dd){return getStateInteraction(_0x4d89dd);})[_0x3475('0x28')](function(_0x784ef8){if(_0x7f22c3){_0x3c6de4(getLastMessageText(_0x784ef8));}else{_0x3c6de4(_0x784ef8);}})[_0x3475('0x2c')](function(_0x501775){_0x295c86(_0x501775);});});}function getStateInteraction(_0x49d11d){return new BPromise(function(_0x229124){_0x49d11d[_0x3475('0x2d')]=0x0;_0x49d11d[_0x3475('0x2e')]=0x0;_0x49d11d[_0x3475('0x2f')]=0x0;_0x49d11d[_0x3475('0x30')]=0x0;_0x49d11d['total']=0x0;if(!_0x49d11d['closed']&&!_0x49d11d[_0x3475('0x31')]){_0x49d11d[_0x3475('0x2d')]+=0x1;}if(!_0x49d11d[_0x3475('0x32')]&&_0x49d11d[_0x3475('0x31')]){_0x49d11d['talking']+=0x1;if(_0x49d11d[_0x3475('0x2d')]){_0x49d11d[_0x3475('0x2d')]-=0x1;}}if(_0x49d11d[_0x3475('0x32')]&&_0x49d11d[_0x3475('0x31')]){_0x49d11d[_0x3475('0x2f')]+=0x1;if(_0x49d11d[_0x3475('0x2e')]){_0x49d11d[_0x3475('0x2e')]-=0x1;}}if(_0x49d11d[_0x3475('0x32')]&&!_0x49d11d[_0x3475('0x31')]){_0x49d11d[_0x3475('0x30')]+=0x1;if(_0x49d11d[_0x3475('0x2d')]){_0x49d11d['waiting']-=0x1;}}_0x49d11d['total']+=0x1;_0x229124(_0x49d11d);});}exports[_0x3475('0x33')]=function(_0x19760a,_0x3da549){var _0x1add5e={},_0x10dbdf={},_0x3c5495={'count':0x0,'rows':[]};var _0x2e6ad2=_[_0x3475('0x34')](db['MailInteraction'][_0x3475('0x35')],function(_0x378023){return{'name':_0x378023[_0x3475('0x36')],'type':_0x378023['type'][_0x3475('0x37')]};});_0x10dbdf[_0x3475('0x38')]=_[_0x3475('0x34')](_0x2e6ad2,_0x3475('0x1d'));_0x10dbdf['query']=_[_0x3475('0x39')](_0x19760a[_0x3475('0x3a')]);_0x10dbdf[_0x3475('0x3b')]=_['intersection'](_0x10dbdf[_0x3475('0x38')],_0x10dbdf['query']);_0x1add5e[_0x3475('0x3c')]=_[_0x3475('0x3d')](_0x10dbdf[_0x3475('0x38')],qs[_0x3475('0x3e')](_0x19760a[_0x3475('0x3a')]['fields']));_0x1add5e[_0x3475('0x3c')]=_0x1add5e['attributes']['length']?_0x1add5e[_0x3475('0x3c')]:_0x10dbdf[_0x3475('0x38')];if(!_0x19760a['query'][_0x3475('0x3f')](_0x3475('0x40'))){_0x1add5e[_0x3475('0x41')]=qs[_0x3475('0x41')](_0x19760a['query']['limit']);_0x1add5e[_0x3475('0x13')]=qs['offset'](_0x19760a['query']['offset']);}_0x1add5e[_0x3475('0x42')]=qs['sort'](_0x19760a[_0x3475('0x3a')][_0x3475('0x43')]);_0x1add5e[_0x3475('0x44')]=qs[_0x3475('0x3b')](_[_0x3475('0x45')](_0x19760a[_0x3475('0x3a')],_0x10dbdf['filters']),_0x2e6ad2);var _0x6c593b=[];var _0x5d1833=squel[_0x3475('0x46')]()[_0x3475('0x47')]('id')[_0x3475('0x47')](_0x3475('0x1d'))[_0x3475('0x47')](_0x3475('0x48'))['from'](_0x3475('0x49'));var _0x514cb1=squel[_0x3475('0x46')]()['field']('u.id')[_0x3475('0x47')](_0x3475('0x4a'))[_0x3475('0x47')]('ui.MailInteractionId')['from'](_0x3475('0x4b'),'ui')['left_join'](_0x3475('0x4c'),'u',_0x3475('0x4d'));var _0x42e5e6=squel[_0x3475('0x46')]()['from'](_0x3475('0x4e'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3475('0x4f')](_0x3475('0x4c'),'o',_0x3475('0x50'))['left_join'](_0x3475('0x51'),'a',_0x3475('0x52'))['left_join'](_0x3475('0x53'),'me',_0x3475('0x54'))[_0x3475('0x4f')](_0x3475('0x55'),'it',_0x3475('0x56'))['left_join'](_0x3475('0x49'),'t','t.id\x20=\x20it.TagId');var _0x10035d=squel[_0x3475('0x57')]();var _0x318b98=[];var _0x14e4a8=squel['expr']();var _0x9f0522;if(_0x19760a[_0x3475('0x3a')][_0x3475('0x58')]){_0x9f0522=as[_0x3475('0x59')](_0x19760a[_0x3475('0x3a')][_0x3475('0x58')]);var _0x270159=_0x9f0522['sqlOperator'];for(var _0x39941b=0x0;_0x39941b<_0x9f0522[_0x3475('0x5a')]['length'];_0x39941b++){var _0x2ec406=_0x9f0522[_0x3475('0x5a')][_0x39941b];var _0x573eab='i';var _0x114eef=_[_0x3475('0x5b')](_0x2e6ad2,['name',_0x2ec406[_0x3475('0x47')]]);if(!_0x114eef){switch(_0x2ec406[_0x3475('0x47')]){case _0x3475('0x5c'):if(_0x2ec406[_0x3475('0x5d')]==0x1){_0x42e5e6[_0x3475('0x5e')]('`'+_0x2ec406[_0x3475('0x47')]+_0x3475('0x5f'));}else{_0x42e5e6[_0x3475('0x5e')]('`'+_0x2ec406[_0x3475('0x47')]+_0x3475('0x60'));}break;case _0x3475('0x61'):if(_0x2ec406['operator']==='$substring'){if(_0x2ec406[_0x3475('0x5d')][_0x3475('0x21')]('\x20')[_0x3475('0x62')]>0x1){_0x10035d[_0x270159]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3475('0x63')](_0x2ec406[_0x3475('0x5d')]),null);}else{var _0x3cd513='%'+_0x2ec406[_0x3475('0x5d')]+'%';_0x10035d[_0x270159](_0x3475('0x64'),_0x3cd513,_0x3cd513,_0x3cd513);}}else{_0x114eef=_['find'](_0x2e6ad2,[_0x3475('0x1d'),_0x3475('0x65')]);_0x2ec406[_0x3475('0x47')]=_0x3475('0x65');_0x4bda43=as[_0x3475('0x66')](_0x573eab,_0x114eef[_0x3475('0x67')],_0x2ec406);_0x10035d[_0x270159](_0x4bda43[_0x3475('0x68')],_0x4bda43[_0x3475('0x5d')][_0x3475('0x69')],_0x4bda43['value'][_0x3475('0x11')]);}break;case _0x3475('0x6a'):var _0x36e6d4=_0x2ec406[_0x3475('0x5d')][_0x3475('0x21')](',')['map'](function(_0x32eecd){return Number(_0x32eecd);});_0x36e6d4['forEach'](function(_0x155923){_0x14e4a8['or'](_0x3475('0x6b'),'%,'+_0x155923+',%');});_0x318b98=_[_0x3475('0x6c')](_0x318b98,_0x36e6d4);break;case'User':if(_0x2ec406[_0x3475('0x6d')]===_0x3475('0x6e')){_0x10035d[_0x270159](_0x3475('0x6f'),'%'+_0x2ec406[_0x3475('0x5d')]+'%',null);}else{_0x114eef=_[_0x3475('0x5b')](_0x2e6ad2,[_0x3475('0x1d'),_0x3475('0x31')]);_0x2ec406[_0x3475('0x47')]='UserId';_0x4bda43=as['buildExpression'](_0x573eab,_0x114eef[_0x3475('0x67')],_0x2ec406);_0x10035d[_0x270159](_0x4bda43[_0x3475('0x68')],_0x4bda43['value'][_0x3475('0x69')],_0x4bda43['value'][_0x3475('0x11')]);}break;case _0x3475('0x2b'):_0x4bda43=as['buildExpression']('me',null,_0x2ec406);_0x10035d[_0x270159](_0x4bda43['text'],_0x4bda43['value']['start'],_0x4bda43['value']['end']);break;}}else{var _0x4bda43=as['buildExpression'](_0x573eab,_0x114eef[_0x3475('0x67')],_0x2ec406);_0x10035d[_0x270159](_0x4bda43['text'],_0x4bda43[_0x3475('0x5d')][_0x3475('0x69')],_0x4bda43[_0x3475('0x5d')][_0x3475('0x11')]);}}}else{var _0x4b1a4f=_(_0x19760a[_0x3475('0x3a')])[_0x3475('0x39')]()['map'](function(_0x23afde){return _['some'](_0x2e6ad2,[_0x3475('0x1d'),_0x23afde])?_0x23afde:undefined;})[_0x3475('0x70')]()[_0x3475('0x5d')]();if(!_['isEmpty'](_0x4b1a4f)){_0x4b1a4f[_0x3475('0x22')](function(_0x2ec78a){if(_0x2ec78a===_0x3475('0x71')){_0x42e5e6['where'](_0x3475('0x72'),[]['concat'](_0x19760a[_0x3475('0x3a')][_0x2ec78a]));}else if(_0x2ec78a==='createdAt'){var _0xdb9407=JSON[_0x3475('0x73')](_0x19760a[_0x3475('0x3a')][_0x2ec78a])[_0x3475('0x74')];var _0x3a1513=JSON['parse'](_0x19760a[_0x3475('0x3a')][_0x2ec78a])[_0x3475('0x75')];_0x42e5e6[_0x3475('0x44')](_0x3475('0x76'),_0xdb9407,_0x3a1513);}else{if(_0x19760a['query'][_0x2ec78a]===_0x3475('0x77')){_0x42e5e6[_0x3475('0x44')]('i.'+_0x2ec78a+_0x3475('0x78'));}else{_0x42e5e6[_0x3475('0x44')]('i.'+_0x2ec78a+_0x3475('0x79'),_0x19760a['query'][_0x2ec78a]);}}});}if(_0x19760a[_0x3475('0x3a')]['read']){if(_0x19760a[_0x3475('0x3a')]['read']==0x1){_0x42e5e6['having'](_0x3475('0x7a'));}else{_0x42e5e6[_0x3475('0x5e')](_0x3475('0x7b'));}}if(_0x19760a[_0x3475('0x3a')][_0x3475('0x7c')]){_0x318b98=_['isArray'](_0x19760a['query'][_0x3475('0x7c')])?_0x19760a[_0x3475('0x3a')][_0x3475('0x7c')]:new Array(_0x19760a[_0x3475('0x3a')]['tag']);_0x318b98['forEach'](function(_0x2dde51){_0x14e4a8['or'](_0x3475('0x6b'),'%,'+_0x2dde51+',%');});}if(_0x19760a['query'][_0x3475('0x7d')]){var _0x1ed305=_0x19760a['query']['filter'][_0x3475('0x7e')]('\x5c','\x5c\x5c')[_0x3475('0x7e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1ed305)){_0x10035d['or']('i.id\x20LIKE\x20?',_0x1ed305+'%');}else if(qs[_0x3475('0x7f')](_0x1ed305)){_0x10035d['or']('c.email\x20LIKE\x20?',_0x1ed305+'%');}else{_0x10035d['or'](_0x3475('0x80'),qs[_0x3475('0x63')](_0x1ed305))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3475('0x63')](_0x1ed305));}}}_0x42e5e6[_0x3475('0x44')](_0x10035d);_0x42e5e6[_0x3475('0x81')](_0x3475('0x82'));var _0x1f4b58={'type':db[_0x3475('0x83')][_0x3475('0x84')][_0x3475('0x85')],'raw':!![]};var _0x3c3aa0=_0x42e5e6[_0x3475('0x86')]();_0x3c3aa0['field'](_0x3475('0x82'));_0x3c3aa0[_0x3475('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3475('0x5c'));if(_0x1add5e[_0x3475('0x42')]){_0x1add5e[_0x3475('0x42')][_0x3475('0x22')](function(_0xeec30a){var _0xa86db0=_0xeec30a[0x0]===_0x3475('0x87')?_0xeec30a[0x0]:'i.'+_0xeec30a[0x0];_0x42e5e6[_0x3475('0x42')](_0xa86db0,_0xeec30a[0x1]===_0x3475('0x88')?![]:!![]);});}if(!_[_0x3475('0x89')](_0x318b98)){_0x42e5e6[_0x3475('0x5e')](_0x14e4a8);_0x3c3aa0[_0x3475('0x44')](_0x3475('0x8a'),_0x318b98);}BPromise['resolve']()[_0x3475('0x28')](function(){if(!_0x9f0522){if(_0x19760a[_0x3475('0x3a')][_0x3475('0x71')])return;_0x3c3aa0[_0x3475('0x44')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x42e5e6['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x19760a[_0x3475('0x8b')][_0x3475('0x8c')]!==_0x3475('0x8d'))return;return _0x19760a[_0x3475('0x8b')][_0x3475('0x8e')]({'attributes':['id'],'raw':!![]})[_0x3475('0x28')](function(_0x409099){if(_[_0x3475('0x89')](_0x409099)){_0x3c3aa0[_0x3475('0x44')](_0x3475('0x8f'));_0x42e5e6[_0x3475('0x44')](_0x3475('0x8f'));}else{_0x3c3aa0[_0x3475('0x44')](_0x3475('0x72'),_['map'](_0x409099,'id'));_0x42e5e6[_0x3475('0x44')](_0x3475('0x72'),_['map'](_0x409099,'id'));}});})['then'](function(){if(_0x19760a['user'][_0x3475('0x8c')]==='agent'&&!_0x9f0522&&!_0x19760a[_0x3475('0x3a')][_0x3475('0x71')])return[];return db[_0x3475('0x90')][_0x3475('0x3a')](_0x3c3aa0[_0x3475('0x91')](),_0x1f4b58);})[_0x3475('0x28')](function(_0x30e30b){_0x3c5495[_0x3475('0x15')]=_0x30e30b[_0x3475('0x62')];if(_0x3c5495[_0x3475('0x15')]===0x0)return[];return db[_0x3475('0x90')]['query'](_0x5d1833['toString'](),_0x1f4b58)[_0x3475('0x28')](function(_0x336c19){_0x6c593b=_[_0x3475('0x92')](_0x336c19,'id');_0x1f4b58=_[_0x3475('0x93')](_0x1f4b58,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19760a[_0x3475('0x3a')][_0x3475('0x3e')]){_0x1add5e['attributes'][_0x3475('0x22')](function(_0x11c38d){_0x42e5e6['field']('i.'+_0x11c38d);});}else{_0x42e5e6[_0x3475('0x47')](_0x3475('0x94'),_0x3475('0x5c'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x95'),_0x3475('0x96'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x97'),_0x3475('0x98'));_0x42e5e6[_0x3475('0x47')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3475('0x87'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x82'));_0x42e5e6['field'](_0x3475('0x99'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x9a'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x9b'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x9c'));_0x42e5e6[_0x3475('0x47')]('i.attach');_0x42e5e6[_0x3475('0x47')](_0x3475('0x9d'));_0x42e5e6['field']('i.lastMsgDirection');_0x42e5e6[_0x3475('0x47')](_0x3475('0x9e'));_0x42e5e6[_0x3475('0x47')](_0x3475('0x9f'));_0x42e5e6[_0x3475('0x47')]('i.secondDisposition');_0x42e5e6[_0x3475('0x47')](_0x3475('0xa0'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa1'));_0x42e5e6['field'](_0x3475('0xa2'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa3'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa4'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa5'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa6'),_0x3475('0xa7'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xa8'),'Contact.lastName');_0x42e5e6[_0x3475('0x47')](_0x3475('0xa9'),_0x3475('0xaa'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xab'),_0x3475('0xac'));_0x42e5e6[_0x3475('0x47')]('c.mobile',_0x3475('0xad'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xae'),_0x3475('0xaf'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xb0'),_0x3475('0xb1'));_0x42e5e6[_0x3475('0x47')](_0x3475('0xb2'),_0x3475('0xb3'));_0x42e5e6['field'](_0x3475('0xb4'),_0x3475('0x20'));}if(_0x1add5e[_0x3475('0x41')])_0x42e5e6['limit'](_0x1add5e['limit']);if(_0x1add5e[_0x3475('0x13')])_0x42e5e6[_0x3475('0x13')](_0x1add5e['offset']);return db[_0x3475('0x90')][_0x3475('0x3a')](_0x42e5e6['toString'](),_0x1f4b58);})[_0x3475('0x28')](function(_0x528c3c){if(_0x528c3c['length']>0x0)_0x514cb1[_0x3475('0x44')](_0x3475('0xb5'),_[_0x3475('0x34')](_0x528c3c,'id'));return db[_0x3475('0x90')]['query'](_0x514cb1[_0x3475('0x91')](),_0x1f4b58)['then'](function(_0x10a313){var _0x1ca077=_[_0x3475('0xb6')](_0x10a313,'MailInteractionId');var _0x259f4d=[];return db[_0x3475('0xb7')][_0x3475('0x26')]({'attributes':[_0x3475('0xb8')],'raw':!![]})[_0x3475('0x28')](function(_0x274aa8){var _0x25e77d=_0x274aa8['enableEmailPreview'];_0x528c3c[_0x3475('0x22')](function(_0x2ca6c3){_0x259f4d[_0x3475('0x24')](updateMailInteraction(_0x2ca6c3,_0x6c593b,_0x1ca077,_0x25e77d));});return BPromise[_0x3475('0xb9')](_0x259f4d);});});});})[_0x3475('0x28')](function(_0x3cf4d4){_0x3c5495[_0x3475('0xba')]=_0x3cf4d4;return _0x3c5495;})[_0x3475('0x28')](respondWithFilteredResult(_0x3da549,_0x1add5e))[_0x3475('0x2c')](handleError(_0x3da549,null));};exports[_0x3475('0xbb')]=function(_0x1e6762,_0x76e9e1){var _0x4f9fba={'raw':![],'where':{'id':_0x1e6762[_0x3475('0xbc')]['id']}},_0x3761a6={};_0x3761a6[_0x3475('0x38')]=_['keys'](db[_0x3475('0xbd')][_0x3475('0x35')]);_0x3761a6[_0x3475('0x3a')]=_[_0x3475('0x39')](_0x1e6762[_0x3475('0x3a')]);_0x3761a6[_0x3475('0x3b')]=_[_0x3475('0x3d')](_0x3761a6[_0x3475('0x38')],_0x3761a6[_0x3475('0x3a')]);_0x4f9fba[_0x3475('0x3c')]=_['intersection'](_0x3761a6['model'],qs['fields'](_0x1e6762[_0x3475('0x3a')][_0x3475('0x3e')]));_0x4f9fba[_0x3475('0x3c')]=_0x4f9fba['attributes'][_0x3475('0x62')]?_0x4f9fba[_0x3475('0x3c')]:_0x3761a6[_0x3475('0x38')];if(_0x1e6762[_0x3475('0x3a')]['includeAll']){_0x4f9fba['include']=[{'all':!![]}];}_0x4f9fba=_[_0x3475('0x93')]({},_0x4f9fba,_0x1e6762[_0x3475('0xbe')]);return db[_0x3475('0xbd')]['find'](_0x4f9fba)[_0x3475('0x28')](handleEntityNotFound(_0x76e9e1,null))['then'](respondWithResult(_0x76e9e1,null))['catch'](handleError(_0x76e9e1,null));};exports[_0x3475('0xbf')]=function(_0x2fa427,_0x2529f2){return db[_0x3475('0xbd')]['create'](_0x2fa427[_0x3475('0xc0')],{})['then'](respondWithResult(_0x2529f2,0xc9))[_0x3475('0x2c')](handleError(_0x2529f2,null));};exports[_0x3475('0x18')]=function(_0x5d5273,_0x17825e){if(_0x5d5273[_0x3475('0xc0')]['id']){delete _0x5d5273[_0x3475('0xc0')]['id'];}return db[_0x3475('0xbd')]['find']({'where':{'id':_0x5d5273[_0x3475('0xbc')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x17825e,null))[_0x3475('0x28')](saveUpdates(_0x5d5273[_0x3475('0xc0')],null))['then'](respondWithResult(_0x17825e,null))[_0x3475('0x2c')](handleError(_0x17825e,null));};exports[_0x3475('0x19')]=function(_0x420063,_0x5dbc49){return db[_0x3475('0xbd')]['find']({'where':{'id':_0x420063[_0x3475('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5dbc49,null))['then'](removeEntity(_0x5dbc49,null))[_0x3475('0x2c')](handleError(_0x5dbc49,null));};exports['describe']=function(_0xd4dcf0,_0x2a50af){return db[_0x3475('0xbd')][_0x3475('0xc1')]()[_0x3475('0x28')](respondWithResult(_0x2a50af,null))[_0x3475('0x2c')](handleError(_0x2a50af,null));};exports[_0x3475('0xc2')]=function(_0x5d2582,_0xe2b020){return db[_0x3475('0x25')][_0x3475('0x5b')]({'where':{'id':_0x5d2582[_0x3475('0xbc')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0xe2b020,null))['then'](function(_0x559054){if(_0x559054){return _0x559054[_0x3475('0xc2')](_0x5d2582['body'][_0x3475('0xc3')],_[_0x3475('0xc4')](_0x5d2582['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xe2b020,null))[_0x3475('0x2c')](handleError(_0xe2b020,null));};exports['getMessages']=function(_0x1b8a0b,_0x311802){var _0x21c864={'raw':![],'where':{}};var _0x484afe={};var _0x41dec8={'count':0x0,'rows':[]};return db[_0x3475('0xbd')][_0x3475('0x26')]({'where':{'id':_0x1b8a0b['params']['id']}})['then'](handleEntityNotFound(_0x311802,null))[_0x3475('0x28')](function(_0x32af1f){if(_0x32af1f){_0x484afe['model']=_['keys'](db['MailMessage'][_0x3475('0x35')]);_0x484afe[_0x3475('0x3a')]=_['keys'](_0x1b8a0b[_0x3475('0x3a')]);_0x484afe['filters']=_['intersection'](_0x484afe['model'],_0x484afe[_0x3475('0x3a')]);_0x21c864['attributes']=_[_0x3475('0x3d')](_0x484afe[_0x3475('0x38')],qs['fields'](_0x1b8a0b['query'][_0x3475('0x3e')]));_0x21c864['attributes']=_0x21c864[_0x3475('0x3c')][_0x3475('0x62')]?_0x21c864[_0x3475('0x3c')]:_0x484afe[_0x3475('0x38')];if(!_0x1b8a0b['query'][_0x3475('0x3f')](_0x3475('0x40'))){_0x21c864[_0x3475('0x41')]=qs[_0x3475('0x41')](_0x1b8a0b[_0x3475('0x3a')][_0x3475('0x41')]);_0x21c864[_0x3475('0x13')]=qs[_0x3475('0x13')](_0x1b8a0b[_0x3475('0x3a')][_0x3475('0x13')]);}_0x21c864[_0x3475('0x42')]=qs[_0x3475('0x43')](_0x1b8a0b[_0x3475('0x3a')][_0x3475('0x43')]);_0x21c864[_0x3475('0x44')]=qs[_0x3475('0x3b')](_[_0x3475('0x45')](_0x1b8a0b[_0x3475('0x3a')],_0x484afe[_0x3475('0x3b')]));_0x21c864[_0x3475('0x44')]['MailInteractionId']=_0x32af1f['id'];if(_0x1b8a0b['query'][_0x3475('0x7d')]){_0x21c864['where']=_[_0x3475('0x93')](_0x21c864[_0x3475('0x44')],{'$or':_[_0x3475('0x34')](_0x21c864[_0x3475('0x3c')],function(_0x1b2976){var _0x2015e7={};_0x2015e7[_0x1b2976]={'$like':'%'+_0x1b8a0b[_0x3475('0x3a')]['filter']+'%'};return _0x2015e7;})});}if(_0x1b8a0b['query']['$gte']){var _0xbc9932=_0x1b8a0b['query'][_0x3475('0x74')][_0x3475('0x21')](',');var _0x170ad3={};_0x170ad3[_0xbc9932[0x0]]={'$gte':moment(_0xbc9932[0x1])[_0x3475('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x21c864[_0x3475('0x44')]=_[_0x3475('0x93')](_0x21c864[_0x3475('0x44')],_0x170ad3);}_0x21c864=_[_0x3475('0x93')]({},_0x21c864,_0x1b8a0b[_0x3475('0xbe')]);return db[_0x3475('0x25')]['count']({'where':_0x21c864[_0x3475('0x44')]})[_0x3475('0x28')](function(_0x20b0ab){_0x41dec8[_0x3475('0x15')]=_0x20b0ab;if(_0x1b8a0b[_0x3475('0x3a')]['includeAll']){_0x21c864[_0x3475('0xc6')]=[{'all':!![]}];}return db[_0x3475('0x25')][_0x3475('0xc7')](_0x21c864);})[_0x3475('0x28')](function(_0x5eff44){if(_0x1b8a0b['query'][_0x3475('0xc8')]==='true'){for(var _0x2a3459=0x0;_0x2a3459<_0x5eff44['length'];_0x2a3459++){_0x5eff44[_0x2a3459][_0x3475('0xc0')]=juice(_0x5eff44[_0x2a3459][_0x3475('0xc0')]);}}_0x41dec8[_0x3475('0xba')]=_0x5eff44;return _0x41dec8;});}})[_0x3475('0x28')](respondWithFilteredResult(_0x311802,_0x21c864))[_0x3475('0x2c')](handleError(_0x311802,null));};exports['addTags']=function(_0x34049b,_0x59d7ed){return db['MailInteraction'][_0x3475('0x5b')]({'where':{'id':_0x34049b[_0x3475('0xbc')]['id']}})['then'](handleEntityNotFound(_0x59d7ed,null))[_0x3475('0x28')](function(_0x4eea8b){if(_0x4eea8b){return _0x4eea8b[_0x3475('0xc9')](_0x34049b[_0x3475('0xc0')][_0x3475('0xc3')],_[_0x3475('0xc4')](_0x34049b['body'],[_0x3475('0xc3'),'id'])||{})['spread'](function(){return db['Tag'][_0x3475('0xc7')]({'attributes':['id',_0x3475('0x1d'),_0x3475('0x48')],'where':{'id':_0x34049b[_0x3475('0xc0')]['ids']}});})['then'](function(_0x1b7f67){socket[_0x3475('0xca')](_0x3475('0xcb'),{'id':Number(_0x34049b[_0x3475('0xbc')]['id']),'tags':_0x1b7f67||[]});return{'id':Number(_0x34049b[_0x3475('0xbc')]['id']),'tags':_0x1b7f67||[]};});}})[_0x3475('0x28')](respondWithResult(_0x59d7ed,null))[_0x3475('0x2c')](handleError(_0x59d7ed,null));};exports[_0x3475('0xcc')]=function(_0x2a69e0,_0x267274){return db['MailInteraction'][_0x3475('0x5b')]({'where':{'id':_0x2a69e0[_0x3475('0xbc')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x267274,null))[_0x3475('0x28')](function(_0x5cfd01){if(_0x5cfd01){return _0x5cfd01[_0x3475('0xcc')](_0x2a69e0['query']['ids']);}})[_0x3475('0x28')](respondWithStatusCode(_0x267274,null))[_0x3475('0x2c')](handleError(_0x267274,null));};exports[_0x3475('0xcd')]=function(_0x20733d,_0x355fa3){var _0x408fdb=moment()[_0x3475('0xce')]()[_0x3475('0x91')]();var _0x2596de=path[_0x3475('0xcf')](config[_0x3475('0xd0')],'server',_0x3475('0xd1'),_0x3475('0xd2'));var _0x2bd7b0=path[_0x3475('0xcf')](config['root'],'server',_0x3475('0xd1'),_0x3475('0xd3'));var _0x43b235=path['join'](_0x2596de,_0x408fdb);var _0x4d337b=util['format'](_0x3475('0xd4'),_0x20733d[_0x3475('0xbc')]['id'],_0x408fdb);var _0x4fc142=path[_0x3475('0xcf')](_0x2596de,_0x4d337b);var _0x13c729=[];if(_0x20733d['query'][_0x3475('0xd3')]){_0x13c729[_0x3475('0x24')]({'model':db[_0x3475('0xd5')],'as':_0x3475('0xd6'),'raw':!![]});}var _0x12b3f5=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x3475('0xc0'),'from','to','cc',_0x3475('0xd7'),_0x3475('0xd8'),_0x3475('0xd9')],'where':{'secret':![]},'order':qs[_0x3475('0x43')]('id'),'include':_0x13c729}];return db[_0x3475('0xbd')][_0x3475('0x5b')]({'where':{'id':_0x20733d[_0x3475('0xbc')]['id']},'include':_0x12b3f5})['then'](handleEntityNotFound(_0x355fa3,null))[_0x3475('0x28')](function(_0x1da635){if(_0x1da635&&_0x1da635[_0x3475('0xda')]){var _0x21208c=_0x1da635[_0x3475('0xdb')]({'plain':!![]});fs[_0x3475('0xdc')](_0x43b235);return BPromise[_0x3475('0xdd')](_0x21208c[_0x3475('0xda')],function(_0x1ab6ee,_0x475b3d){var _0xa15377={'from':_0x1ab6ee[_0x3475('0xde')],'to':_0x1ab6ee['to'],'subject':_0x1ab6ee[_0x3475('0xd8')],'html':htmlEntities[_0x3475('0xdf')](_0x1ab6ee[_0x3475('0xc0')]),'headers':{'Date':moment(_0x1ab6ee[_0x3475('0xd9')])[_0x3475('0xc5')](_0x3475('0xe0'))},'attachments':[]};if(_0x1ab6ee['cc']){_0xa15377[_0x3475('0xe1')]['Cc']=_0x1ab6ee['cc'];}if(_0x1ab6ee[_0x3475('0xd7')]){_0xa15377['headers']['Bcc']=_0x1ab6ee['bcc'];}return new BPromise(function(_0x38cd0e,_0x4a7c1b){if(_0x1ab6ee[_0x3475('0xd6')]){for(var _0x5d17f7=0x0;_0x5d17f7<_0x1ab6ee['Attachments']['length'];_0x5d17f7++){var _0x374bf6=_0x1ab6ee[_0x3475('0xd6')][_0x5d17f7];var _0x3650c6=path[_0x3475('0xcf')](_0x2bd7b0,_0x374bf6[_0x3475('0xe2')]);if(fs[_0x3475('0xe3')](_0x3650c6)){_0xa15377['attachments'][_0x3475('0x24')]({'name':_0x374bf6[_0x3475('0x1d')],'contentType':_0x374bf6['type'],'data':fs[_0x3475('0xe4')](_0x3650c6)});}}}emlformat['build'](_0xa15377,function(_0x2fdf31,_0x9d08f2){if(_0x2fdf31)return _0x4a7c1b(_0x2fdf31);fs['writeFileSync'](path[_0x3475('0xcf')](_0x43b235,util['format']('message%d.eml',_0x475b3d)),_0x9d08f2);return _0x38cd0e(_0x9d08f2);});});})[_0x3475('0x28')](function(){return new BPromise(function(_0x55795a,_0x5b97c1){zipdir(_0x43b235,{'saveTo':_0x4fc142},function(_0x343287,_0x5b79b7){if(_0x343287)return _0x5b97c1(_0x343287);return _0x55795a(_0x5b79b7);});})[_0x3475('0x28')](function(){return new BPromise(function(_0x3af6a5,_0x23315e){rimraf(_0x43b235,function(_0x1dbbe9){if(_0x1dbbe9)_0x23315e(_0x1dbbe9);return _0x3af6a5();});});})['then'](function(){return _0x355fa3['download'](_0x4fc142,_0x4d337b,function(_0x46f586){if(!_0x46f586)fs['unlinkSync'](_0x4fc142);});});});}else{return _0x355fa3[_0x3475('0x1a')](0xc8);}})[_0x3475('0x2c')](handleError(_0x355fa3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 67a4021..9c1be05 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 _0xe282=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty'];(function(_0x5d5d25,_0x3b8c9d){var _0x4b25ca=function(_0x5ea089){while(--_0x5ea089){_0x5d5d25['push'](_0x5d5d25['shift']());}};_0x4b25ca(++_0x3b8c9d);}(_0xe282,0xde));var _0x2e28=function(_0x211704,_0x1b3329){_0x211704=_0x211704-0x0;var _0x4c65f7=_0xe282[_0x211704];return _0x4c65f7;};'use strict';var EventEmitter=require(_0x2e28('0x0'));var MailInteraction=require(_0x2e28('0x1'))['db'][_0x2e28('0x2')];var MailMessage=require(_0x2e28('0x1'))['db'][_0x2e28('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2e28('0x4')](0x0);var events={'afterCreate':_0x2e28('0x5'),'afterUpdate':_0x2e28('0x6'),'afterDestroy':_0x2e28('0x7')};function emitEvent(_0x47b22f){return function(_0x22790b,_0x190eeb,_0x591574){_0x22790b['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5281ba){_0x22790b[_0x2e28('0x8')](_0x2e28('0x9'),_0x5281ba[_0x2e28('0xa')](function(_0x4efcef){return{'id':_0x4efcef['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x22790b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2e28('0xb')](function(_0x5500ec){_0x22790b[_0x2e28('0x8')]('unreadMessages',_0x5500ec[_0x2e28('0xc')]);MailInteractionEvents[_0x2e28('0xd')](_0x47b22f+':'+_0x22790b['id'],_0x22790b);MailInteractionEvents['emit'](_0x47b22f,_0x22790b);_0x591574(null);})[_0x2e28('0xe')](_0x591574(null));};}for(var e in events){if(events[_0x2e28('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x2e28('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xec7a=['hook','exports','MailInteraction','../../mysqldb','setMaxListeners','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x2a891a,_0xcaf37c){var _0x335a16=function(_0xb4362b){while(--_0xb4362b){_0x2a891a['push'](_0x2a891a['shift']());}};_0x335a16(++_0xcaf37c);}(_0xec7a,0x64));var _0xaec7=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0xec7a[_0x57ec1a];return _0x2159ad;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xaec7('0x0')];var MailMessage=require(_0xaec7('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xaec7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xaec7('0x3')};function emitEvent(_0x2e157d){return function(_0x1500d5,_0x526764,_0xed5000){_0x1500d5['getUsers']({'attributes':['id'],'raw':!![]})[_0xaec7('0x4')](function(_0x1b3ce0){_0x1500d5[_0xaec7('0x5')](_0xaec7('0x6'),_0x1b3ce0[_0xaec7('0x7')](function(_0x2e0bef){return{'id':_0x2e0bef['id']};}));return MailMessage[_0xaec7('0x8')]({'where':{'MailInteractionId':_0x1500d5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaec7('0x4')](function(_0x2b8636){_0x1500d5[_0xaec7('0x5')](_0xaec7('0x9'),_0x2b8636['length']);MailInteractionEvents[_0xaec7('0xa')](_0x2e157d+':'+_0x1500d5['id'],_0x1500d5);MailInteractionEvents['emit'](_0x2e157d,_0x1500d5);_0xed5000(null);})[_0xaec7('0xb')](_0xed5000(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xaec7('0xc')](e,emitEvent(event));}}module[_0xaec7('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e9e8f46..e1f2b12 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 _0x3c51=['closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','substatusAt','models','get','MailMessage','then','catch','util','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','format'];(function(_0x1bc912,_0x719941){var _0x41a9aa=function(_0x1ad3ba){while(--_0x1ad3ba){_0x1bc912['push'](_0x1bc912['shift']());}};_0x41a9aa(++_0x719941);}(_0x3c51,0x82));var _0x13c5=function(_0x475042,_0x5eb445){_0x475042=_0x475042-0x0;var _0x5e38a2=_0x3c51[_0x475042];return _0x5e38a2;};'use strict';var _=require('lodash');var util=require(_0x13c5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x13c5('0x1'));var rp=require(_0x13c5('0x2'));var fs=require('fs');var path=require(_0x13c5('0x3'));var rimraf=require(_0x13c5('0x4'));var config=require(_0x13c5('0x5'));var attributes=require(_0x13c5('0x6'));module[_0x13c5('0x7')]=function(_0x513a4a,_0x12a5b9){return _0x513a4a['define'](_0x13c5('0x8'),attributes,{'tableName':_0x13c5('0x9'),'paranoid':![],'indexes':[{'name':_0x13c5('0xa'),'fields':['subject','to'],'type':_0x13c5('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x544202,_0x161d7f,_0x42fd25){if(_0x544202[_0x13c5('0xc')]){_0x544202['substatusAt']=moment()[_0x13c5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x544202['closed']){_0x544202[_0x13c5('0xe')]=moment()[_0x13c5('0xd')](_0x13c5('0xf'));}_0x42fd25(null,_0x161d7f);},'beforeUpdate':function(_0x22d7c2,_0x376271,_0xf651f1){if(_0x22d7c2['changed'](_0x13c5('0xc'))){_0x22d7c2['substatusAt']=_0x22d7c2[_0x13c5('0xc')]?moment()[_0x13c5('0xd')](_0x13c5('0xf')):null;}if(_0x22d7c2[_0x13c5('0x10')](_0x13c5('0x11'))){_0x22d7c2[_0x13c5('0xe')]=moment()[_0x13c5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x22d7c2[_0x13c5('0xc')]=null;_0x22d7c2[_0x13c5('0x12')]=null;}_0xf651f1(null,_0x22d7c2);},'afterUpdate':function(_0x35f43d,_0x3aa66d,_0x3ae3c9){var _0x42a0b6=_0x513a4a[_0x13c5('0x13')];var _0x12c46a=_0x35f43d[_0x13c5('0x14')]({'plain':!![]});if(_0x12c46a['closed']){return _0x42a0b6[_0x13c5('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x12c46a['id']}})[_0x13c5('0x16')](function(){_0x3ae3c9();})[_0x13c5('0x17')](function(_0x33ec33){_0x3ae3c9(_0x33ec33);});}else{_0x3ae3c9();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2882=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','update','catch','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2882,0xe6));var _0x2288=function(_0x3cf54a,_0x118dd9){_0x3cf54a=_0x3cf54a-0x0;var _0x2368a8=_0x2882[_0x3cf54a];return _0x2368a8;};'use strict';var _=require(_0x2288('0x0'));var util=require(_0x2288('0x1'));var logger=require(_0x2288('0x2'))(_0x2288('0x3'));var moment=require(_0x2288('0x4'));var BPromise=require(_0x2288('0x5'));var rp=require(_0x2288('0x6'));var fs=require('fs');var path=require(_0x2288('0x7'));var rimraf=require(_0x2288('0x8'));var config=require(_0x2288('0x9'));var attributes=require(_0x2288('0xa'));module[_0x2288('0xb')]=function(_0x1ffaa2,_0x41a702){return _0x1ffaa2[_0x2288('0xc')](_0x2288('0xd'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x2288('0xe'),'to'],'type':_0x2288('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b6919,_0x773be5,_0x217ab0){if(_0x3b6919[_0x2288('0x10')]){_0x3b6919[_0x2288('0x11')]=moment()[_0x2288('0x12')](_0x2288('0x13'));}if(_0x3b6919['closed']){_0x3b6919['closedAt']=moment()['format'](_0x2288('0x13'));}_0x217ab0(null,_0x773be5);},'beforeUpdate':function(_0x2bbb33,_0x2c4390,_0x7d73f2){if(_0x2bbb33[_0x2288('0x14')]('substatus')){_0x2bbb33[_0x2288('0x11')]=_0x2bbb33[_0x2288('0x10')]?moment()[_0x2288('0x12')](_0x2288('0x13')):null;}if(_0x2bbb33[_0x2288('0x14')](_0x2288('0x15'))){_0x2bbb33['closedAt']=moment()[_0x2288('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bbb33[_0x2288('0x10')]=null;_0x2bbb33['substatusAt']=null;}_0x7d73f2(null,_0x2bbb33);},'afterUpdate':function(_0x2bb12c,_0x425a2a,_0x575b41){var _0x402b7a=_0x1ffaa2[_0x2288('0x16')];var _0x425d52=_0x2bb12c['get']({'plain':!![]});if(_0x425d52[_0x2288('0x15')]){return _0x402b7a['MailMessage'][_0x2288('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x425d52['id']}})['then'](function(){_0x575b41();})[_0x2288('0x18')](function(_0x13b40e){_0x575b41(_0x13b40e);});}else{_0x575b41();}}},'charset':_0x2288('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c283e18..4638c4e 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 _0xa777=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','then','stringify','addTags','ids','omit','util'];(function(_0x299507,_0x353b53){var _0x1869ca=function(_0xe4a556){while(--_0xe4a556){_0x299507['push'](_0x299507['shift']());}};_0x1869ca(++_0x353b53);}(_0xa777,0x102));var _0x7a77=function(_0x3e14a8,_0xb21f66){_0x3e14a8=_0x3e14a8-0x0;var _0x222614=_0xa777[_0x3e14a8];return _0x222614;};'use strict';var _=require('lodash');var util=require(_0x7a77('0x0'));var moment=require(_0x7a77('0x1'));var BPromise=require(_0x7a77('0x2'));var rs=require(_0x7a77('0x3'));var fs=require('fs');var Redis=require(_0x7a77('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a77('0x5'));var logger=require(_0x7a77('0x6'))(_0x7a77('0x7'));var config=require(_0x7a77('0x8'));var jayson=require(_0x7a77('0x9'));var client=jayson['client'][_0x7a77('0xa')]({'port':0x232a});config[_0x7a77('0xb')]=_['defaults'](config['redis'],{'host':_0x7a77('0xc'),'port':0x18eb});var socket=require(_0x7a77('0xd'))(new Redis(config['redis']));require(_0x7a77('0xe'))[_0x7a77('0xf')](socket);function respondWithRpcPromise(_0x1065e8,_0x1acc0a,_0x453772){return new BPromise(function(_0x21b370,_0x25c1fd){return client[_0x7a77('0x10')](_0x1065e8,_0x453772)['then'](function(_0x164dad){logger[_0x7a77('0x11')](_0x7a77('0x12'),_0x1acc0a,_0x7a77('0x13'));logger[_0x7a77('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1acc0a,_0x7a77('0x13'),JSON['stringify'](_0x164dad));if(_0x164dad[_0x7a77('0x15')]){if(_0x164dad[_0x7a77('0x15')]['code']===0x1f4){logger[_0x7a77('0x15')](_0x7a77('0x12'),_0x1acc0a,_0x164dad['error'][_0x7a77('0x16')]);return _0x25c1fd(_0x164dad[_0x7a77('0x15')][_0x7a77('0x16')]);}logger[_0x7a77('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1acc0a,_0x164dad['error'][_0x7a77('0x16')]);return _0x21b370(_0x164dad['error']['message']);}else{logger['info'](_0x7a77('0x12'),_0x1acc0a,'request\x20sent');_0x21b370(_0x164dad[_0x7a77('0x17')]['message']);}})[_0x7a77('0x18')](function(_0x22d04b){logger[_0x7a77('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1acc0a,_0x22d04b);_0x25c1fd(_0x22d04b);});});}exports[_0x7a77('0x19')]=function(_0xe5f0db){var _0x9e81f4=this;return new Promise(function(_0x104688,_0x15b568){return db[_0x7a77('0x1a')][_0x7a77('0x1b')](_0xe5f0db[_0x7a77('0x1c')],{'raw':_0xe5f0db[_0x7a77('0x1d')]?_0xe5f0db[_0x7a77('0x1d')][_0x7a77('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe5f0db[_0x7a77('0x1d')]?_0xe5f0db[_0x7a77('0x1d')][_0x7a77('0x1f')]||null:null,'attributes':_0xe5f0db[_0x7a77('0x1d')]?_0xe5f0db['options']['attributes']||null:null,'limit':_0xe5f0db[_0x7a77('0x1d')]?_0xe5f0db['options']['limit']||null:null})[_0x7a77('0x20')](function(_0x1c927e){logger[_0x7a77('0x11')]('UpdateMailInteraction',_0xe5f0db);logger['debug'](_0x7a77('0x19'),_0xe5f0db,JSON[_0x7a77('0x21')](_0x1c927e));_0x104688(_0x1c927e);})[_0x7a77('0x18')](function(_0x24a532){logger[_0x7a77('0x15')](_0x7a77('0x19'),_0x24a532[_0x7a77('0x16')],_0xe5f0db);_0x15b568(_0x9e81f4[_0x7a77('0x15')](0x1f4,_0x24a532['message']));});});};exports['AddTagsToMailInteraction']=function(_0x47a65d){return new Promise(function(_0x33e4b6,_0x36a7c8){return db[_0x7a77('0x1a')]['find']({'where':_0x47a65d[_0x7a77('0x1d')]?_0x47a65d['options'][_0x7a77('0x1f')]||null:null})[_0x7a77('0x20')](function(_0x3fe3f8){if(_0x3fe3f8){return _0x3fe3f8[_0x7a77('0x22')](_0x47a65d[_0x7a77('0x1c')][_0x7a77('0x23')],_[_0x7a77('0x24')](_0x47a65d[_0x7a77('0x1c')],[_0x7a77('0x23'),'id'])||{});}})['spread'](function(_0x2d2db6){logger[_0x7a77('0x11')]('AddTags',_0x47a65d);logger[_0x7a77('0x14')]('AddTags',_0x47a65d,JSON[_0x7a77('0x21')](_0x2d2db6));_0x33e4b6(_0x2d2db6);})[_0x7a77('0x18')](function(_0x3b5e7e){logger['error']('AddTags',_0x3b5e7e['message'],_0x47a65d);_0x36a7c8(_this['error'](0x1f4,_0x3b5e7e[_0x7a77('0x16')]));});});}; \ No newline at end of file +var _0xa7ee=['debug','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes'];(function(_0x420974,_0x3ec965){var _0x1446fc=function(_0x39e253){while(--_0x39e253){_0x420974['push'](_0x420974['shift']());}};_0x1446fc(++_0x3ec965);}(_0xa7ee,0x167));var _0xea7e=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0xa7ee[_0xf91841];return _0x4b9c44;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var moment=require(_0xea7e('0x2'));var BPromise=require(_0xea7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea7e('0x4'));var db=require(_0xea7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea7e('0x6'))(_0xea7e('0x7'));var config=require(_0xea7e('0x8'));var jayson=require(_0xea7e('0x9'));var client=jayson[_0xea7e('0xa')][_0xea7e('0xb')]({'port':0x232a});config[_0xea7e('0xc')]=_[_0xea7e('0xd')](config[_0xea7e('0xc')],{'host':_0xea7e('0xe'),'port':0x18eb});var socket=require(_0xea7e('0xf'))(new Redis(config['redis']));require(_0xea7e('0x10'))[_0xea7e('0x11')](socket);function respondWithRpcPromise(_0x4ab5c5,_0x2ec47f,_0x2cb306){return new BPromise(function(_0x3ef42c,_0x52270e){return client[_0xea7e('0x12')](_0x4ab5c5,_0x2cb306)[_0xea7e('0x13')](function(_0x52ca49){logger[_0xea7e('0x14')]('MailInteraction,\x20%s,\x20%s',_0x2ec47f,'request\x20sent');logger['debug'](_0xea7e('0x15'),_0x2ec47f,_0xea7e('0x16'),JSON[_0xea7e('0x17')](_0x52ca49));if(_0x52ca49['error']){if(_0x52ca49[_0xea7e('0x18')][_0xea7e('0x19')]===0x1f4){logger[_0xea7e('0x18')](_0xea7e('0x1a'),_0x2ec47f,_0x52ca49[_0xea7e('0x18')][_0xea7e('0x1b')]);return _0x52270e(_0x52ca49[_0xea7e('0x18')]['message']);}logger[_0xea7e('0x18')](_0xea7e('0x1a'),_0x2ec47f,_0x52ca49[_0xea7e('0x18')]['message']);return _0x3ef42c(_0x52ca49[_0xea7e('0x18')]['message']);}else{logger[_0xea7e('0x14')](_0xea7e('0x1a'),_0x2ec47f,_0xea7e('0x16'));_0x3ef42c(_0x52ca49[_0xea7e('0x1c')][_0xea7e('0x1b')]);}})[_0xea7e('0x1d')](function(_0x380031){logger['error'](_0xea7e('0x1a'),_0x2ec47f,_0x380031);_0x52270e(_0x380031);});});}exports[_0xea7e('0x1e')]=function(_0x264af1){var _0x3a2eae=this;return new Promise(function(_0x1fff5c,_0x4ebdcf){return db[_0xea7e('0x1f')]['update'](_0x264af1[_0xea7e('0x20')],{'raw':_0x264af1['options']?_0x264af1[_0xea7e('0x21')][_0xea7e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x264af1[_0xea7e('0x21')]?_0x264af1[_0xea7e('0x21')][_0xea7e('0x23')]||null:null,'attributes':_0x264af1[_0xea7e('0x21')]?_0x264af1[_0xea7e('0x21')][_0xea7e('0x24')]||null:null,'limit':_0x264af1[_0xea7e('0x21')]?_0x264af1[_0xea7e('0x21')]['limit']||null:null})['then'](function(_0x5ec56d){logger[_0xea7e('0x14')](_0xea7e('0x1e'),_0x264af1);logger[_0xea7e('0x25')]('UpdateMailInteraction',_0x264af1,JSON[_0xea7e('0x17')](_0x5ec56d));_0x1fff5c(_0x5ec56d);})[_0xea7e('0x1d')](function(_0x51a891){logger[_0xea7e('0x18')](_0xea7e('0x1e'),_0x51a891[_0xea7e('0x1b')],_0x264af1);_0x4ebdcf(_0x3a2eae[_0xea7e('0x18')](0x1f4,_0x51a891[_0xea7e('0x1b')]));});});};exports[_0xea7e('0x26')]=function(_0x19854c){return new Promise(function(_0x1fa08c,_0x47f109){return db[_0xea7e('0x1f')][_0xea7e('0x27')]({'where':_0x19854c[_0xea7e('0x21')]?_0x19854c['options'][_0xea7e('0x23')]||null:null})[_0xea7e('0x13')](function(_0xff3b5a){if(_0xff3b5a){return _0xff3b5a['addTags'](_0x19854c[_0xea7e('0x20')][_0xea7e('0x28')],_[_0xea7e('0x29')](_0x19854c[_0xea7e('0x20')],['ids','id'])||{});}})[_0xea7e('0x2a')](function(_0x6e2c29){logger[_0xea7e('0x14')](_0xea7e('0x2b'),_0x19854c);logger[_0xea7e('0x25')](_0xea7e('0x2b'),_0x19854c,JSON[_0xea7e('0x17')](_0x6e2c29));_0x1fa08c(_0x6e2c29);})[_0xea7e('0x1d')](function(_0x21aafb){logger[_0xea7e('0x18')](_0xea7e('0x2b'),_0x21aafb[_0xea7e('0x1b')],_0x19854c);_0x47f109(_this[_0xea7e('0x18')](0x1f4,_0x21aafb[_0xea7e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9b483d8..02dc657 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 _0x3376=['remove','update','emit','removeListener','length','mailInteraction:','save'];(function(_0x1975c4,_0x6ba45e){var _0x4852ce=function(_0x43509e){while(--_0x43509e){_0x1975c4['push'](_0x1975c4['shift']());}};_0x4852ce(++_0x6ba45e);}(_0x3376,0x102));var _0x6337=function(_0x344570,_0x1eb4f9){_0x344570=_0x344570-0x0;var _0x1bb006=_0x3376[_0x344570];return _0x1bb006;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6337('0x0'),_0x6337('0x1'),_0x6337('0x2')];function createListener(_0x36f3b5,_0x342def){return function(_0x54a555){_0x342def[_0x6337('0x3')](_0x36f3b5,_0x54a555);};}function removeListener(_0x2e74ec,_0x24c744){return function(){MailInteractionEvents[_0x6337('0x4')](_0x2e74ec,_0x24c744);};}exports['register']=function(_0x91b782){for(var _0x30357a=0x0,_0x40ecd5=events[_0x6337('0x5')];_0x30357a<_0x40ecd5;_0x30357a++){var _0x53b57d=events[_0x30357a];var _0x8a1e42=createListener(_0x6337('0x6')+_0x53b57d,_0x91b782);MailInteractionEvents['on'](_0x53b57d,_0x8a1e42);}}; \ No newline at end of file +var _0x9308=['mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x2a1121,_0x395bdc){var _0x1be044=function(_0x11e707){while(--_0x11e707){_0x2a1121['push'](_0x2a1121['shift']());}};_0x1be044(++_0x395bdc);}(_0x9308,0xc1));var _0x8930=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9308[_0xfae23b];return _0x200640;};'use strict';var MailInteractionEvents=require(_0x8930('0x0'));var events=[_0x8930('0x1'),_0x8930('0x2'),'update'];function createListener(_0x207337,_0x42d839){return function(_0x503616){_0x42d839[_0x8930('0x3')](_0x207337,_0x503616);};}function removeListener(_0x57269d,_0x270b03){return function(){MailInteractionEvents[_0x8930('0x4')](_0x57269d,_0x270b03);};}exports[_0x8930('0x5')]=function(_0x535ea5){for(var _0x2adf52=0x0,_0x225827=events[_0x8930('0x6')];_0x2adf52<_0x225827;_0x2adf52++){var _0x58a78d=events[_0x2adf52];var _0x2a4370=createListener(_0x8930('0x7')+_0x58a78d,_0x535ea5);MailInteractionEvents['on'](_0x58a78d,_0x2a4370);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 71bfd96..c2331a5 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 _0x7fce=['describe','download','post','mail','mailmessage:create','/:id','update','accept','put','/:id/reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x35fb7c,_0x4ee512){var _0x3b319e=function(_0x381eaa){while(--_0x381eaa){_0x35fb7c['push'](_0x35fb7c['shift']());}};_0x3b319e(++_0x4ee512);}(_0x7fce,0xdc));var _0xe7fc=function(_0x5ab586,_0x4c3f87){_0x5ab586=_0x5ab586-0x0;var _0x589356=_0x7fce[_0x5ab586];return _0x589356;};'use strict';var multer=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var path=require(_0xe7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7fc('0x3'));var router=express['Router']();var fs_extra=require(_0xe7fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0xe7fc('0x7')](),controller['index']);router[_0xe7fc('0x8')](_0xe7fc('0x9'),auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xa')]);router[_0xe7fc('0x8')]('/:id',auth[_0xe7fc('0x7')](),controller['show']);router[_0xe7fc('0x8')]('/:id/download',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xb')]);router[_0xe7fc('0xc')]('/',auth[_0xe7fc('0x7')](),interaction['tracked'](_0xe7fc('0xd'),_0xe7fc('0xe')),controller['create']);router['put'](_0xe7fc('0xf'),auth['isAuthenticated'](),controller[_0xe7fc('0x10')]);router['put']('/:id/accept',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0x11')]);router[_0xe7fc('0x12')](_0xe7fc('0x13'),auth[_0xe7fc('0x7')](),controller['reject']);router[_0xe7fc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe7fc('0x15')]);module[_0xe7fc('0x16')]=router; \ No newline at end of file +var _0x6bc9=['./mailMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x217468,_0x202266){var _0x38b284=function(_0xe7f3ee){while(--_0xe7f3ee){_0x217468['push'](_0x217468['shift']());}};_0x38b284(++_0x202266);}(_0x6bc9,0x1c2));var _0x96bc=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x6bc9[_0x2a0738];return _0x159679;};'use strict';var multer=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var path=require('path');var timeout=require(_0x96bc('0x2'));var express=require(_0x96bc('0x3'));var router=express[_0x96bc('0x4')]();var fs_extra=require(_0x96bc('0x5'));var auth=require(_0x96bc('0x6'));var interaction=require(_0x96bc('0x7'));var config=require(_0x96bc('0x8'));var controller=require(_0x96bc('0x9'));router['get']('/',auth[_0x96bc('0xa')](),controller['index']);router['get'](_0x96bc('0xb'),auth['isAuthenticated'](),controller[_0x96bc('0xc')]);router[_0x96bc('0xd')](_0x96bc('0xe'),auth['isAuthenticated'](),controller[_0x96bc('0xf')]);router[_0x96bc('0xd')]('/:id/download',auth[_0x96bc('0xa')](),controller[_0x96bc('0x10')]);router[_0x96bc('0x11')]('/',auth[_0x96bc('0xa')](),interaction[_0x96bc('0x12')](_0x96bc('0x13'),_0x96bc('0x14')),controller[_0x96bc('0x15')]);router[_0x96bc('0x16')]('/:id',auth[_0x96bc('0xa')](),controller['update']);router[_0x96bc('0x16')](_0x96bc('0x17'),auth[_0x96bc('0xa')](),controller['accept']);router[_0x96bc('0x16')]('/:id/reject',auth[_0x96bc('0xa')](),controller[_0x96bc('0x18')]);router['delete']('/:id',auth[_0x96bc('0xa')](),controller[_0x96bc('0x19')]);module[_0x96bc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 570ce70..4519946 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 _0xb068=['INTEGER','Email','exports','TEXT','long','BOOLEAN','ENUM','out','DATE'];(function(_0x3941df,_0x1492cb){var _0xe2da73=function(_0x1dcdf6){while(--_0x1dcdf6){_0x3941df['push'](_0x3941df['shift']());}};_0xe2da73(++_0x1492cb);}(_0xb068,0x18e));var _0x8b06=function(_0x50efb2,_0x3419dc){_0x50efb2=_0x50efb2-0x0;var _0x36feae=_0xb068[_0x50efb2];return _0x36feae;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x8b06('0x0')]={'body':{'type':Sequelize[_0x8b06('0x1')](_0x8b06('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8b06('0x1')]('medium')},'read':{'type':Sequelize[_0x8b06('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b06('0x4')]('in','out'),'defaultValue':_0x8b06('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x8b06('0x2'))},'cc':{'type':Sequelize[_0x8b06('0x1')](_0x8b06('0x2'))},'bcc':{'type':Sequelize[_0x8b06('0x1')](_0x8b06('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x8b06('0x6')]},'attach':{'type':Sequelize[_0x8b06('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8b06('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8b06('0x6')]},'originTo':{'type':Sequelize['TEXT'](_0x8b06('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0x8b06('0x2'))},'originChannel':{'type':Sequelize[_0x8b06('0x4')](_0x8b06('0x8'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x754c=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x754c,0x161));var _0xc754=function(_0x5180d9,_0x3cb483){_0x5180d9=_0x5180d9-0x0;var _0x1c95ee=_0x754c[_0x5180d9];return _0x1c95ee;};'use strict';var Sequelize=require(_0xc754('0x0'));var _=require(_0xc754('0x1'));module[_0xc754('0x2')]={'body':{'type':Sequelize[_0xc754('0x3')](_0xc754('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc754('0x3')](_0xc754('0x5'))},'read':{'type':Sequelize[_0xc754('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc754('0x7')]('in','out'),'defaultValue':_0xc754('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc754('0x9')](0x1fe)},'from':{'type':Sequelize[_0xc754('0x9')]},'to':{'type':Sequelize['TEXT'](_0xc754('0x4'))},'cc':{'type':Sequelize[_0xc754('0x3')]('long')},'bcc':{'type':Sequelize[_0xc754('0x3')](_0xc754('0x4'))},'subject':{'type':Sequelize[_0xc754('0x3')]},'sentAt':{'type':Sequelize[_0xc754('0xa')]},'attach':{'type':Sequelize[_0xc754('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc754('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xc754('0x3')](_0xc754('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xc754('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0xc754('0xc'),_0xc754('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0be613e..ad6a1e5 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 _0xeccb=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','interface','rejectmessage','download','toString','files','tmp','server','from','createdAt','Attachments','subject','headers','Bcc','bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3bcc84,_0x1ec4ea){var _0x59e1b2=function(_0x1581f1){while(--_0x1581f1){_0x3bcc84['push'](_0x3bcc84['shift']());}};_0x59e1b2(++_0x1ec4ea);}(_0xeccb,0x64));var _0xbecc=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xeccb[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xbecc('0x0'));var moment=require(_0xbecc('0x1'));var BPromise=require(_0xbecc('0x2'));var util=require(_0xbecc('0x3'));var path=require(_0xbecc('0x4'));var fs=require('fs');var _=require(_0xbecc('0x5'));var Redis=require(_0xbecc('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xbecc('0x7'));var logger=require('../../config/logger')(_0xbecc('0x8'));var interaction_log=require('../../config/logger')(_0xbecc('0x9'));var config=require(_0xbecc('0xa'));var db=require(_0xbecc('0xb'))['db'];config[_0xbecc('0xc')]=_[_0xbecc('0xd')](config[_0xbecc('0xc')],{'host':_0xbecc('0xe'),'port':0x18eb});var socket=require(_0xbecc('0xf'))(new Redis(config[_0xbecc('0xc')]));var htmlEntities=require(_0xbecc('0x10'));require('./mailMessage.socket')[_0xbecc('0x11')](socket);var jayson=require(_0xbecc('0x12'));var client=jayson[_0xbecc('0x13')][_0xbecc('0x14')]({'port':0x232c});var client9003=jayson[_0xbecc('0x13')]['http']({'port':0x232b});var client9002=jayson[_0xbecc('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x521642,_0x51558b,_0x321176,_0x458e9f){return new BPromise(function(_0x3c7f99,_0x144464){var _0x53bdad=_0x458e9f||client;return _0x53bdad[_0xbecc('0x15')](_0x521642,_0x321176)[_0xbecc('0x16')](function(_0x40240c){logger[_0xbecc('0x17')](_0xbecc('0x18'),_0x51558b,'request\x20sent');logger[_0xbecc('0x19')](_0xbecc('0x1a'),_0x51558b,_0xbecc('0x1b'),JSON[_0xbecc('0x1c')](_0x40240c));if(_0x40240c[_0xbecc('0x1d')]){if(_0x40240c[_0xbecc('0x1d')]['code']===0x1f4){logger[_0xbecc('0x1d')](_0xbecc('0x18'),_0x51558b,_0x40240c[_0xbecc('0x1d')][_0xbecc('0x1e')]);return _0x144464(_0x40240c['error']['message']);}logger['error'](_0xbecc('0x18'),_0x51558b,_0x40240c[_0xbecc('0x1d')][_0xbecc('0x1e')]);return _0x3c7f99(_0x40240c[_0xbecc('0x1d')]['message']);}else{logger[_0xbecc('0x17')](_0xbecc('0x18'),_0x51558b,_0xbecc('0x1b'));_0x3c7f99(_0x40240c[_0xbecc('0x1f')][_0xbecc('0x1e')]);}})[_0xbecc('0x20')](function(_0x2c83fd){logger[_0xbecc('0x1d')](_0xbecc('0x18'),_0x51558b,_0x2c83fd);_0x144464(_0x2c83fd);});});}function respondWithResult(_0x2e926e,_0x3702ed){_0x3702ed=_0x3702ed||0xc8;return function(_0x555c78){if(_0x555c78){return _0x2e926e[_0xbecc('0x21')](_0x3702ed)[_0xbecc('0x22')](_0x555c78);}};}function respondWithFilteredResult(_0x5266a7,_0x4a2ca2){return function(_0x1f57f3){if(_0x1f57f3){var _0x588360=typeof _0x4a2ca2[_0xbecc('0x23')]===_0xbecc('0x24')&&typeof _0x4a2ca2[_0xbecc('0x25')]===_0xbecc('0x24');var _0x1d626b=_0x1f57f3[_0xbecc('0x26')];var _0x8ac205=_0x588360?0x0:_0x4a2ca2['offset'];var _0xec7d37=_0x588360?_0x1f57f3[_0xbecc('0x26')]:_0x4a2ca2[_0xbecc('0x23')]+_0x4a2ca2['limit'];var _0x3c1db1;if(_0xec7d37>=_0x1d626b){_0xec7d37=_0x1d626b;_0x3c1db1=0xc8;}else{_0x3c1db1=0xce;}_0x5266a7[_0xbecc('0x21')](_0x3c1db1);return _0x5266a7[_0xbecc('0x27')](_0xbecc('0x28'),_0x8ac205+'-'+_0xec7d37+'/'+_0x1d626b)['json'](_0x1f57f3);}return null;};}function saveUpdates(_0x3bfc19){return function(_0x15ebf7){if(_0x15ebf7){return _0x15ebf7[_0xbecc('0x29')](_0x3bfc19)[_0xbecc('0x16')](function(_0xbbe21f){return _0xbbe21f;});}return null;};}function removeEntity(_0xa8f226){return function(_0x319f8b){if(_0x319f8b){return _0x319f8b[_0xbecc('0x2a')]()[_0xbecc('0x16')](function(){_0xa8f226['status'](0xcc)[_0xbecc('0x2b')]();});}};}function handleEntityNotFound(_0x4c3b2d){return function(_0x52852f){if(!_0x52852f){_0x4c3b2d[_0xbecc('0x2c')](0x194);}return _0x52852f;};}function handleError(_0x599081,_0x309322){_0x309322=_0x309322||0x1f4;return function(_0x419707){logger[_0xbecc('0x1d')](_0x419707[_0xbecc('0x2d')]);if(_0x419707['name']){delete _0x419707[_0xbecc('0x2e')];}_0x599081[_0xbecc('0x21')](_0x309322)['send'](_0x419707);};}exports[_0xbecc('0x2f')]=function(_0x3a86c3,_0x2cbc13){var _0x4daae0={},_0x2b1553={},_0x1c4c2a={'count':0x0,'rows':[]};var _0x4a3fd4=_[_0xbecc('0x30')](db[_0xbecc('0x31')][_0xbecc('0x32')],function(_0x1b75e4){return{'name':_0x1b75e4[_0xbecc('0x33')],'type':_0x1b75e4[_0xbecc('0x34')][_0xbecc('0x35')]};});_0x2b1553['model']=_['map'](_0x4a3fd4,'name');_0x2b1553[_0xbecc('0x36')]=_[_0xbecc('0x37')](_0x3a86c3[_0xbecc('0x36')]);_0x2b1553[_0xbecc('0x38')]=_[_0xbecc('0x39')](_0x2b1553[_0xbecc('0x3a')],_0x2b1553[_0xbecc('0x36')]);_0x4daae0[_0xbecc('0x3b')]=_[_0xbecc('0x39')](_0x2b1553['model'],qs[_0xbecc('0x3c')](_0x3a86c3[_0xbecc('0x36')]['fields']));_0x4daae0['attributes']=_0x4daae0[_0xbecc('0x3b')][_0xbecc('0x3d')]?_0x4daae0[_0xbecc('0x3b')]:_0x2b1553['model'];if(!_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x3e')](_0xbecc('0x3f'))){_0x4daae0[_0xbecc('0x25')]=qs[_0xbecc('0x25')](_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x25')]);_0x4daae0['offset']=qs['offset'](_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x23')]);}_0x4daae0[_0xbecc('0x40')]=qs['sort'](_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x41')]);_0x4daae0[_0xbecc('0x42')]=qs[_0xbecc('0x38')](_['pick'](_0x3a86c3[_0xbecc('0x36')],_0x2b1553[_0xbecc('0x38')]),_0x4a3fd4);if(_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x43')]){_0x4daae0[_0xbecc('0x42')]=_[_0xbecc('0x44')](_0x4daae0['where'],{'$or':_['map'](_0x4a3fd4,function(_0x602d10){if(_0x602d10[_0xbecc('0x34')]!==_0xbecc('0x45')){var _0x2a49cf={};_0x2a49cf[_0x602d10[_0xbecc('0x2e')]]={'$like':'%'+_0x3a86c3['query'][_0xbecc('0x43')]+'%'};return _0x2a49cf;}})});}_0x4daae0=_['merge']({},_0x4daae0,_0x3a86c3[_0xbecc('0x46')]);var _0x3ddaea={'where':_0x4daae0[_0xbecc('0x42')]};return db[_0xbecc('0x31')][_0xbecc('0x26')](_0x3ddaea)[_0xbecc('0x16')](function(_0x510f0b){_0x1c4c2a[_0xbecc('0x26')]=_0x510f0b;if(_0x3a86c3[_0xbecc('0x36')][_0xbecc('0x47')]){_0x4daae0['include']=[{'all':!![]}];}return db['MailMessage'][_0xbecc('0x48')](_0x4daae0);})[_0xbecc('0x16')](function(_0x22edf7){_0x1c4c2a[_0xbecc('0x49')]=_0x22edf7;return _0x1c4c2a;})[_0xbecc('0x16')](respondWithFilteredResult(_0x2cbc13,_0x4daae0))['catch'](handleError(_0x2cbc13,null));};exports[_0xbecc('0x4a')]=function(_0x746f35,_0x121fea){var _0xb844={'raw':!![],'where':{'id':_0x746f35[_0xbecc('0x4b')]['id']}},_0x4e3ae4={};_0x4e3ae4['model']=_[_0xbecc('0x37')](db[_0xbecc('0x31')][_0xbecc('0x32')]);_0x4e3ae4[_0xbecc('0x36')]=_[_0xbecc('0x37')](_0x746f35[_0xbecc('0x36')]);_0x4e3ae4[_0xbecc('0x38')]=_[_0xbecc('0x39')](_0x4e3ae4['model'],_0x4e3ae4[_0xbecc('0x36')]);_0xb844[_0xbecc('0x3b')]=_[_0xbecc('0x39')](_0x4e3ae4[_0xbecc('0x3a')],qs['fields'](_0x746f35[_0xbecc('0x36')][_0xbecc('0x3c')]));_0xb844[_0xbecc('0x3b')]=_0xb844['attributes'][_0xbecc('0x3d')]?_0xb844['attributes']:_0x4e3ae4[_0xbecc('0x3a')];if(_0x746f35[_0xbecc('0x36')][_0xbecc('0x47')]){_0xb844[_0xbecc('0x4c')]=[{'all':!![]}];}_0xb844=_[_0xbecc('0x44')]({},_0xb844,_0x746f35[_0xbecc('0x46')]);return db['MailMessage'][_0xbecc('0x4d')](_0xb844)[_0xbecc('0x16')](handleEntityNotFound(_0x121fea,null))[_0xbecc('0x16')](respondWithResult(_0x121fea,null))['catch'](handleError(_0x121fea,null));};exports[_0xbecc('0x29')]=function(_0x23f930,_0x3cd1e7){if(_0x23f930['body']['id']){delete _0x23f930[_0xbecc('0x4e')]['id'];}return db[_0xbecc('0x31')][_0xbecc('0x4d')]({'where':{'id':_0x23f930[_0xbecc('0x4b')]['id']}})[_0xbecc('0x16')](handleEntityNotFound(_0x3cd1e7,null))[_0xbecc('0x16')](saveUpdates(_0x23f930[_0xbecc('0x4e')],null))['then'](respondWithResult(_0x3cd1e7,null))['catch'](handleError(_0x3cd1e7,null));};exports[_0xbecc('0x2a')]=function(_0x27e259,_0x4a78cc){return db[_0xbecc('0x31')][_0xbecc('0x4d')]({'where':{'id':_0x27e259[_0xbecc('0x4b')]['id']}})[_0xbecc('0x16')](handleEntityNotFound(_0x4a78cc,null))[_0xbecc('0x16')](removeEntity(_0x4a78cc,null))['catch'](handleError(_0x4a78cc,null));};exports[_0xbecc('0x4f')]=function(_0x2b1356,_0x563dc8){return db[_0xbecc('0x31')]['describe']()[_0xbecc('0x16')](respondWithResult(_0x563dc8,null))['catch'](handleError(_0x563dc8,null));};exports[_0xbecc('0x50')]=function(_0x239d8a,_0x12dd8a){return db[_0xbecc('0x31')][_0xbecc('0x50')](_0x239d8a[_0xbecc('0x4e')])['then'](function(_0x1fb70c){if(_0x1fb70c){if(_0x1fb70c['direction']===_0xbecc('0x51')&&!_0x1fb70c[_0xbecc('0x52')]){var _0x458fc0,_0x5b3481,_0x491c22;if(_0x239d8a[_0xbecc('0x4e')]['to']){_0x5b3481=_0x239d8a[_0xbecc('0x4e')]['to'][_0xbecc('0x53')](',')[0x0];}return db[_0xbecc('0x54')][_0xbecc('0x55')]({'where':{'id':_0x1fb70c[_0xbecc('0x56')]},'include':[{'model':db[_0xbecc('0x57')],'as':_0xbecc('0x58'),'include':[{'model':db[_0xbecc('0x59')],'as':'Contacts','where':{'email':_0x5b3481},'limit':0x1,'order':[[_0xbecc('0x5a'),_0xbecc('0x5b')]]}]},{'model':db[_0xbecc('0x5c')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xbecc('0x5d'),'raw':!![]}]}]})[_0xbecc('0x16')](function(_0x3d77ad){_0x458fc0=_0x3d77ad;if(!_0x458fc0||!_0x458fc0[_0xbecc('0x5e')])return;var _0x4ca159=_0x458fc0[_0xbecc('0x5f')]();if(_0x239d8a['body'][_0xbecc('0x60')]&&_0x239d8a['body'][_0xbecc('0x60')]['length']){for(var _0x15bc79=0x0;_0x15bc79<_0x239d8a[_0xbecc('0x4e')][_0xbecc('0x60')]['length'];_0x15bc79+=0x1){_0x239d8a[_0xbecc('0x4e')][_0xbecc('0x60')][_0x15bc79]={'filename':_0x239d8a[_0xbecc('0x4e')][_0xbecc('0x60')][_0x15bc79]['name'],'path':path[_0xbecc('0x61')](config[_0xbecc('0x62')],_0xbecc('0x63'),_0x239d8a[_0xbecc('0x4e')][_0xbecc('0x60')][_0x15bc79][_0xbecc('0x64')])};}}_0x491c22={'account':_0x4ca159,'message':_0x239d8a[_0xbecc('0x4e')]};return;})['then'](function(){if(_0x458fc0[_0xbecc('0x58')]){if(_0x458fc0['List']['Contacts'][_0xbecc('0x3d')]){return _0x458fc0[_0xbecc('0x58')]['Contacts'][0x0];}else{return db[_0xbecc('0x59')][_0xbecc('0x50')](_[_0xbecc('0xd')](_0x239d8a['body'],{'firstName':_0x239d8a[_0xbecc('0x4e')]['to'],'email':_0x239d8a[_0xbecc('0x4e')]['to'],'phone':_0x239d8a['body']['to'],'ListId':_0x458fc0[_0xbecc('0x65')]}));}}else{throw new Error(_0xbecc('0x66'));}})[_0xbecc('0x16')](function(){if(_0x491c22){return respondWithRpcPromise('SendMail',_0xbecc('0x67'),_0x491c22,client9003)[_0xbecc('0x16')](function(_0x2a7ee3){return _0x1fb70c[_0xbecc('0x29')]({'read':!![],'messageId':_0x2a7ee3['messageId'],'sentAt':moment()['format'](_0xbecc('0x68'))});})[_0xbecc('0x20')](function(_0x4625ca){logger[_0xbecc('0x1d')]('%s',JSON[_0xbecc('0x1c')](_0x4625ca));return _0x1fb70c;});}return _0x1fb70c;});}return _0x1fb70c;}})['then'](respondWithResult(_0x12dd8a,0xc9))['catch'](handleError(_0x12dd8a,null));};exports[_0xbecc('0x69')]=function(_0x339c32,_0x10f392){var _0x4b27b1={'agent':{},'channel':_0xbecc('0x6a')};if(_0x339c32['body']['id']){delete _0x339c32[_0xbecc('0x4e')]['id'];}_0x339c32[_0xbecc('0x4e')][_0xbecc('0x6b')]=!![];_0x339c32[_0xbecc('0x4e')]['readAt']=moment()[_0xbecc('0x6c')](_0xbecc('0x68'));_0x339c32[_0xbecc('0x4e')][_0xbecc('0x6d')]=_0x339c32[_0xbecc('0x4e')]['UserId']||_0x339c32[_0xbecc('0x6e')]['id'];_0x4b27b1[_0xbecc('0x6f')]['id']=_0x339c32[_0xbecc('0x4e')][_0xbecc('0x6d')];return db['MailMessage'][_0xbecc('0x4d')]({'where':{'id':_0x339c32[_0xbecc('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10f392,null))[_0xbecc('0x16')](saveUpdates(_0x339c32[_0xbecc('0x4e')],null))[_0xbecc('0x16')](function(_0x45b531){if(_0x45b531){_0x4b27b1[_0xbecc('0x1e')]=_0x45b531[_0xbecc('0x70')]({'plain':!![]});return db[_0xbecc('0x71')]['find']({'where':{'id':_0x45b531[_0xbecc('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x10f392,null))[_0xbecc('0x16')](function(_0x2a3b76){if(_0x2a3b76){return _0x2a3b76[_0xbecc('0x29')]({'UserId':_0x339c32[_0xbecc('0x4e')]['UserId'],'read1stAt':_[_0xbecc('0x73')](_0x2a3b76[_0xbecc('0x74')])?moment()['format'](_0xbecc('0x68')):undefined});}return null;})['then'](function(_0x40f175){if(_0x40f175){_0x4b27b1[_0xbecc('0x75')]=_0x40f175[_0xbecc('0x70')]({'plain':!![]});interaction_log[_0xbecc('0x17')](_0xbecc('0x76'),_0x339c32[_0xbecc('0x6e')]['id'],_0x339c32['user'][_0xbecc('0x2e')],_0x339c32[_0xbecc('0x6e')][_0xbecc('0x77')],_0x4b27b1[_0xbecc('0x75')]['id'],_0x339c32[_0xbecc('0x4e')]?JSON[_0xbecc('0x1c')](_0x339c32['body']):_0xbecc('0x78'));return respondWithRpcPromise(_0xbecc('0x79'),_0xbecc('0x7a'),_0x4b27b1);}return null;})['then'](function(_0x15a364){var _0x251284=_0xbecc('0x7b')+_0x15a364[_0xbecc('0x1e')][_0xbecc('0x7c')];return db[_0xbecc('0x7d')]['query'](_0x251284,{'type':db['Sequelize'][_0xbecc('0x7e')][_0xbecc('0x7f')],'raw':!![]})[_0xbecc('0x16')](function(_0x146efa){return _0x146efa;});})[_0xbecc('0x16')](function(_0x2a7df0){if(_0x2a7df0){_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x80')]=_0x2a7df0[0x0];if(!_0x339c32['body'][_0xbecc('0x6d')])return;return db[_0xbecc('0x81')][_0xbecc('0x4d')]({'where':{'id':_0x339c32[_0xbecc('0x4e')]['UserId'],'role':'agent'},'attributes':['id','name',_0xbecc('0x82'),'email','internal'],'raw':!![]});}return null;})[_0xbecc('0x16')](function(_0x3ec977){if(!_0x3ec977)return null;_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x6f')]=_0x3ec977;return _0x4b27b1;})[_0xbecc('0x16')](function(_0x106a6f){if(_0x106a6f){if(_0x339c32[_0xbecc('0x4e')][_0xbecc('0x83')]){_0x4b27b1['message']['interface']=util['format'](_0xbecc('0x84'),_0x339c32[_0xbecc('0x6e')]['name']);_0x4b27b1[_0xbecc('0x1e')]['channel']=_0x4b27b1[_0xbecc('0x85')];_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x86')]=_0x4b27b1['channel'];_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x87')]='accept';_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x4e')]=htmlToText[_0xbecc('0x88')](_0x4b27b1[_0xbecc('0x1e')][_0xbecc('0x4e')]);return respondWithRpcPromise(_0xbecc('0x89'),'EventManager',{'event':_0xbecc('0x8a'),'message':_0x4b27b1[_0xbecc('0x1e')]},client9002)['then'](function(){return _0x4b27b1;});}return _0x4b27b1;}return null;})[_0xbecc('0x16')](respondWithResult(_0x10f392,null))['catch'](handleError(_0x10f392,null));};exports[_0xbecc('0x8b')]=function(_0x47b4bc,_0xc838d7){var _0x3170b1={'agent':{},'channel':_0xbecc('0x6a')};if(_0x47b4bc[_0xbecc('0x4e')]['id']){delete _0x47b4bc[_0xbecc('0x4e')]['id'];}_0x47b4bc[_0xbecc('0x4e')][_0xbecc('0x6d')]=_0x47b4bc['body']['UserId']||_0x47b4bc[_0xbecc('0x6e')]['id'];_0x3170b1['agent']['id']=_0x47b4bc[_0xbecc('0x4e')]['UserId'];return db[_0xbecc('0x31')]['find']({'where':{'id':_0x47b4bc[_0xbecc('0x4b')]['id'],'UserId':null}})[_0xbecc('0x16')](handleEntityNotFound(_0xc838d7,null))[_0xbecc('0x16')](function(_0x47dd0e){if(_0x47dd0e){_0x3170b1[_0xbecc('0x1e')]=_0x47dd0e['get']({'plain':!![]});return db[_0xbecc('0x71')][_0xbecc('0x4d')]({'where':{'id':_0x47dd0e[_0xbecc('0x72')]}});}return null;})[_0xbecc('0x16')](handleEntityNotFound(_0xc838d7,null))[_0xbecc('0x16')](function(_0x44272e){if(_0x44272e){_0x3170b1[_0xbecc('0x75')]=_0x44272e['get']({'plain':!![]});interaction_log[_0xbecc('0x17')](_0xbecc('0x8c'),_0x47b4bc['user']['id'],_0x47b4bc[_0xbecc('0x6e')][_0xbecc('0x2e')],_0x47b4bc[_0xbecc('0x6e')][_0xbecc('0x77')],_0x3170b1[_0xbecc('0x75')]['id'],_0x47b4bc[_0xbecc('0x4e')]?JSON['stringify'](_0x47b4bc[_0xbecc('0x4e')]):_0xbecc('0x78'));return respondWithRpcPromise(_0xbecc('0x8d'),_0xbecc('0x8e'),_0x3170b1);}return null;})['then'](function(_0x3799ed){var _0x33a8ba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3799ed[_0xbecc('0x1e')]['ContactId'];return db[_0xbecc('0x7d')][_0xbecc('0x36')](_0x33a8ba,{'type':db['Sequelize'][_0xbecc('0x7e')][_0xbecc('0x7f')],'raw':!![]})[_0xbecc('0x16')](function(_0x41eb55){return _0x41eb55;});})[_0xbecc('0x16')](function(_0x5ec8e3){if(_0x5ec8e3){_0x3170b1['message']['contact']=_0x5ec8e3[0x0];if(!_0x47b4bc[_0xbecc('0x4e')]['UserId'])return;return db[_0xbecc('0x81')][_0xbecc('0x4d')]({'where':{'id':_0x47b4bc['body']['UserId'],'role':_0xbecc('0x6f')},'attributes':['id',_0xbecc('0x2e'),'fullname','email',_0xbecc('0x8f')],'raw':!![]});}return null;})['then'](function(_0x3787b8){if(!_0x3787b8)return null;_0x3170b1['message']['agent']=_0x3787b8;return _0x3170b1;})[_0xbecc('0x16')](function(_0x239f60){if(_0x239f60){_0x239f60[_0xbecc('0x1e')][_0xbecc('0x90')]=util[_0xbecc('0x6c')]('SIP/%s',_0x47b4bc[_0xbecc('0x6e')][_0xbecc('0x2e')]);_0x239f60[_0xbecc('0x1e')]['channel']=_0x3170b1[_0xbecc('0x85')];_0x239f60[_0xbecc('0x1e')][_0xbecc('0x86')]=_0x3170b1[_0xbecc('0x85')];_0x239f60[_0xbecc('0x1e')]['event']='reject';_0x239f60[_0xbecc('0x1e')][_0xbecc('0x4e')]=htmlToText[_0xbecc('0x88')](_0x3170b1[_0xbecc('0x1e')][_0xbecc('0x4e')]);respondWithRpcPromise(_0xbecc('0x89'),_0xbecc('0x89'),{'event':_0xbecc('0x91'),'message':_0x239f60[_0xbecc('0x1e')]},client9002);return _0x3170b1;}return null;})[_0xbecc('0x16')](respondWithResult(_0xc838d7,null))['catch'](handleError(_0xc838d7,null));};exports[_0xbecc('0x92')]=function(_0x447250,_0x52569d){var _0x44ac38=moment()['unix']()[_0xbecc('0x93')]();var _0x422651=path[_0xbecc('0x61')](config[_0xbecc('0x62')],'server',_0xbecc('0x94'),_0xbecc('0x95'));var _0x504d9f=path['join'](config[_0xbecc('0x62')],_0xbecc('0x96'),_0xbecc('0x94'),_0xbecc('0x60'));var _0x593426=util['format']('message-%s.eml',_0x44ac38);return db['MailMessage'][_0xbecc('0x4d')]({'where':{'id':_0x447250[_0xbecc('0x4b')]['id']},'attributes':['id',_0xbecc('0x4e'),_0xbecc('0x97'),'to','cc','bcc','subject',_0xbecc('0x98')],'include':_0x447250[_0xbecc('0x36')][_0xbecc('0x60')]?[{'model':db['Attachment'],'as':_0xbecc('0x99')}]:undefined})[_0xbecc('0x16')](handleEntityNotFound(_0x52569d,null))[_0xbecc('0x16')](function(_0x4b9989){if(_0x4b9989){var _0x469c80=_0x4b9989;var _0x1b955c={'from':_0x469c80[_0xbecc('0x97')],'to':_0x469c80['to'],'subject':_0x469c80[_0xbecc('0x9a')],'html':htmlEntities['decode'](_0x469c80[_0xbecc('0x4e')]),'headers':{'Date':moment(_0x469c80[_0xbecc('0x98')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4b9989['cc']){_0x1b955c[_0xbecc('0x9b')]['Cc']=_0x4b9989['cc'];}if(_0x4b9989['bcc']){_0x1b955c['headers'][_0xbecc('0x9c')]=_0x4b9989[_0xbecc('0x9d')];}return new BPromise(function(_0xf21ca8,_0x115030){if(_0x4b9989['Attachments']){for(var _0x18d8b6=0x0;_0x18d8b6<_0x4b9989[_0xbecc('0x99')][_0xbecc('0x3d')];_0x18d8b6++){var _0x181dcd=_0x4b9989['Attachments'][_0x18d8b6];var _0xa4e991=path[_0xbecc('0x61')](_0x504d9f,_0x181dcd[_0xbecc('0x64')]);if(fs[_0xbecc('0x9e')](_0xa4e991)){_0x1b955c[_0xbecc('0x60')][_0xbecc('0x9f')]({'name':_0x181dcd['name'],'contentType':_0x181dcd['type'],'data':fs[_0xbecc('0xa0')](_0xa4e991)});}}}emlformat[_0xbecc('0xa1')](_0x1b955c,function(_0x217f53,_0x22a3f1){if(_0x217f53)return _0x115030(_0x217f53);fs[_0xbecc('0xa2')](path[_0xbecc('0x61')](_0x422651,_0x593426),_0x22a3f1);return _0xf21ca8(_0x22a3f1);});});}})['then'](function(_0x135833){if(_0x135833){return _0x52569d[_0xbecc('0x92')](path[_0xbecc('0x61')](_0x422651,_0x593426),_0x593426,function(_0x3a2bcc){if(!_0x3a2bcc)fs[_0xbecc('0xa3')](path[_0xbecc('0x61')](_0x422651,_0x593426));});}})['catch'](handleError(_0x52569d,null));}; \ No newline at end of file +var _0x0bef=['decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','json','offset','undefined','count','limit','set','Content-Range','end','stack','name','status','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','intersection','include','update','body','find','params','destroy','describe','create','direction','out','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','stringify','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','internal','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachments','subject'];(function(_0x9195b7,_0x27d089){var _0x17182b=function(_0x5ece60){while(--_0x5ece60){_0x9195b7['push'](_0x9195b7['shift']());}};_0x17182b(++_0x27d089);}(_0x0bef,0xa8));var _0xf0be=function(_0x126c86,_0x37c9a0){_0x126c86=_0x126c86-0x0;var _0x36a46b=_0x0bef[_0x126c86];return _0x36a46b;};'use strict';var emlformat=require('eml-format');var moment=require(_0xf0be('0x0'));var BPromise=require(_0xf0be('0x1'));var util=require('util');var path=require(_0xf0be('0x2'));var fs=require('fs');var _=require(_0xf0be('0x3'));var Redis=require(_0xf0be('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xf0be('0x5'))(_0xf0be('0x6'));var interaction_log=require(_0xf0be('0x5'))(_0xf0be('0x7'));var config=require(_0xf0be('0x8'));var db=require(_0xf0be('0x9'))['db'];config[_0xf0be('0xa')]=_['defaults'](config[_0xf0be('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0be('0xb'))(new Redis(config[_0xf0be('0xa')]));var htmlEntities=require(_0xf0be('0xc'));require(_0xf0be('0xd'))[_0xf0be('0xe')](socket);var jayson=require(_0xf0be('0xf'));var client=jayson[_0xf0be('0x10')][_0xf0be('0x11')]({'port':0x232c});var client9003=jayson['client'][_0xf0be('0x11')]({'port':0x232b});var client9002=jayson[_0xf0be('0x10')][_0xf0be('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x133178,_0x355c2a,_0x3c21fd,_0x4f8e5b){return new BPromise(function(_0x47bd45,_0x5db935){var _0x140772=_0x4f8e5b||client;return _0x140772[_0xf0be('0x12')](_0x133178,_0x3c21fd)[_0xf0be('0x13')](function(_0x74305c){logger[_0xf0be('0x14')](_0xf0be('0x15'),_0x355c2a,_0xf0be('0x16'));logger[_0xf0be('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x355c2a,'request\x20sent',JSON['stringify'](_0x74305c));if(_0x74305c[_0xf0be('0x18')]){if(_0x74305c[_0xf0be('0x18')][_0xf0be('0x19')]===0x1f4){logger[_0xf0be('0x18')](_0xf0be('0x15'),_0x355c2a,_0x74305c['error'][_0xf0be('0x1a')]);return _0x5db935(_0x74305c[_0xf0be('0x18')][_0xf0be('0x1a')]);}logger['error'](_0xf0be('0x15'),_0x355c2a,_0x74305c[_0xf0be('0x18')][_0xf0be('0x1a')]);return _0x47bd45(_0x74305c[_0xf0be('0x18')][_0xf0be('0x1a')]);}else{logger['info'](_0xf0be('0x15'),_0x355c2a,_0xf0be('0x16'));_0x47bd45(_0x74305c[_0xf0be('0x1b')][_0xf0be('0x1a')]);}})['catch'](function(_0x13bbe5){logger[_0xf0be('0x18')](_0xf0be('0x15'),_0x355c2a,_0x13bbe5);_0x5db935(_0x13bbe5);});});}function respondWithResult(_0x2290de,_0x8892af){_0x8892af=_0x8892af||0xc8;return function(_0x4306ec){if(_0x4306ec){return _0x2290de['status'](_0x8892af)[_0xf0be('0x1c')](_0x4306ec);}};}function respondWithFilteredResult(_0x891893,_0x22e4d6){return function(_0x2fd01e){if(_0x2fd01e){var _0x147c27=typeof _0x22e4d6[_0xf0be('0x1d')]===_0xf0be('0x1e')&&typeof _0x22e4d6['limit']==='undefined';var _0x166517=_0x2fd01e['count'];var _0xac49ab=_0x147c27?0x0:_0x22e4d6[_0xf0be('0x1d')];var _0x5c3ba6=_0x147c27?_0x2fd01e[_0xf0be('0x1f')]:_0x22e4d6['offset']+_0x22e4d6[_0xf0be('0x20')];var _0x559268;if(_0x5c3ba6>=_0x166517){_0x5c3ba6=_0x166517;_0x559268=0xc8;}else{_0x559268=0xce;}_0x891893['status'](_0x559268);return _0x891893[_0xf0be('0x21')](_0xf0be('0x22'),_0xac49ab+'-'+_0x5c3ba6+'/'+_0x166517)[_0xf0be('0x1c')](_0x2fd01e);}return null;};}function saveUpdates(_0xc8c473){return function(_0x3b501b){if(_0x3b501b){return _0x3b501b['update'](_0xc8c473)[_0xf0be('0x13')](function(_0x5cc16c){return _0x5cc16c;});}return null;};}function removeEntity(_0x39770d){return function(_0x197375){if(_0x197375){return _0x197375['destroy']()['then'](function(){_0x39770d['status'](0xcc)[_0xf0be('0x23')]();});}};}function handleEntityNotFound(_0x5e48ff){return function(_0x5c7652){if(!_0x5c7652){_0x5e48ff['sendStatus'](0x194);}return _0x5c7652;};}function handleError(_0x4e4bea,_0x589808){_0x589808=_0x589808||0x1f4;return function(_0x120b6){logger[_0xf0be('0x18')](_0x120b6[_0xf0be('0x24')]);if(_0x120b6[_0xf0be('0x25')]){delete _0x120b6[_0xf0be('0x25')];}_0x4e4bea[_0xf0be('0x26')](_0x589808)['send'](_0x120b6);};}exports['index']=function(_0x2a9d07,_0x1bb474){var _0x208bc4={},_0x309452={},_0x283ea0={'count':0x0,'rows':[]};var _0x4e4f2e=_[_0xf0be('0x27')](db[_0xf0be('0x28')][_0xf0be('0x29')],function(_0x178674){return{'name':_0x178674[_0xf0be('0x2a')],'type':_0x178674[_0xf0be('0x2b')][_0xf0be('0x2c')]};});_0x309452[_0xf0be('0x2d')]=_['map'](_0x4e4f2e,_0xf0be('0x25'));_0x309452[_0xf0be('0x2e')]=_[_0xf0be('0x2f')](_0x2a9d07[_0xf0be('0x2e')]);_0x309452[_0xf0be('0x30')]=_['intersection'](_0x309452[_0xf0be('0x2d')],_0x309452[_0xf0be('0x2e')]);_0x208bc4[_0xf0be('0x31')]=_['intersection'](_0x309452[_0xf0be('0x2d')],qs[_0xf0be('0x32')](_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x32')]));_0x208bc4[_0xf0be('0x31')]=_0x208bc4[_0xf0be('0x31')][_0xf0be('0x33')]?_0x208bc4['attributes']:_0x309452[_0xf0be('0x2d')];if(!_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x34')](_0xf0be('0x35'))){_0x208bc4['limit']=qs['limit'](_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x20')]);_0x208bc4['offset']=qs[_0xf0be('0x1d')](_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x1d')]);}_0x208bc4[_0xf0be('0x36')]=qs[_0xf0be('0x37')](_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x37')]);_0x208bc4[_0xf0be('0x38')]=qs['filters'](_['pick'](_0x2a9d07[_0xf0be('0x2e')],_0x309452[_0xf0be('0x30')]),_0x4e4f2e);if(_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x39')]){_0x208bc4[_0xf0be('0x38')]=_['merge'](_0x208bc4[_0xf0be('0x38')],{'$or':_[_0xf0be('0x27')](_0x4e4f2e,function(_0xe72482){if(_0xe72482[_0xf0be('0x2b')]!==_0xf0be('0x3a')){var _0xc00635={};_0xc00635[_0xe72482[_0xf0be('0x25')]]={'$like':'%'+_0x2a9d07['query']['filter']+'%'};return _0xc00635;}})});}_0x208bc4=_[_0xf0be('0x3b')]({},_0x208bc4,_0x2a9d07[_0xf0be('0x3c')]);var _0xa69cdc={'where':_0x208bc4[_0xf0be('0x38')]};return db[_0xf0be('0x28')][_0xf0be('0x1f')](_0xa69cdc)[_0xf0be('0x13')](function(_0x597e90){_0x283ea0[_0xf0be('0x1f')]=_0x597e90;if(_0x2a9d07[_0xf0be('0x2e')][_0xf0be('0x3d')]){_0x208bc4['include']=[{'all':!![]}];}return db[_0xf0be('0x28')][_0xf0be('0x3e')](_0x208bc4);})[_0xf0be('0x13')](function(_0x1af595){_0x283ea0['rows']=_0x1af595;return _0x283ea0;})[_0xf0be('0x13')](respondWithFilteredResult(_0x1bb474,_0x208bc4))[_0xf0be('0x3f')](handleError(_0x1bb474,null));};exports['show']=function(_0x53f41d,_0x22c027){var _0x1f1b6d={'raw':!![],'where':{'id':_0x53f41d['params']['id']}},_0x52c580={};_0x52c580[_0xf0be('0x2d')]=_[_0xf0be('0x2f')](db[_0xf0be('0x28')][_0xf0be('0x29')]);_0x52c580['query']=_[_0xf0be('0x2f')](_0x53f41d['query']);_0x52c580[_0xf0be('0x30')]=_[_0xf0be('0x40')](_0x52c580[_0xf0be('0x2d')],_0x52c580[_0xf0be('0x2e')]);_0x1f1b6d[_0xf0be('0x31')]=_['intersection'](_0x52c580['model'],qs[_0xf0be('0x32')](_0x53f41d[_0xf0be('0x2e')][_0xf0be('0x32')]));_0x1f1b6d['attributes']=_0x1f1b6d[_0xf0be('0x31')][_0xf0be('0x33')]?_0x1f1b6d[_0xf0be('0x31')]:_0x52c580[_0xf0be('0x2d')];if(_0x53f41d[_0xf0be('0x2e')][_0xf0be('0x3d')]){_0x1f1b6d[_0xf0be('0x41')]=[{'all':!![]}];}_0x1f1b6d=_[_0xf0be('0x3b')]({},_0x1f1b6d,_0x53f41d[_0xf0be('0x3c')]);return db[_0xf0be('0x28')]['find'](_0x1f1b6d)[_0xf0be('0x13')](handleEntityNotFound(_0x22c027,null))[_0xf0be('0x13')](respondWithResult(_0x22c027,null))['catch'](handleError(_0x22c027,null));};exports[_0xf0be('0x42')]=function(_0x1d42fe,_0x5a8aca){if(_0x1d42fe['body']['id']){delete _0x1d42fe[_0xf0be('0x43')]['id'];}return db[_0xf0be('0x28')][_0xf0be('0x44')]({'where':{'id':_0x1d42fe[_0xf0be('0x45')]['id']}})[_0xf0be('0x13')](handleEntityNotFound(_0x5a8aca,null))[_0xf0be('0x13')](saveUpdates(_0x1d42fe[_0xf0be('0x43')],null))[_0xf0be('0x13')](respondWithResult(_0x5a8aca,null))['catch'](handleError(_0x5a8aca,null));};exports[_0xf0be('0x46')]=function(_0x39f488,_0x1b5489){return db[_0xf0be('0x28')]['find']({'where':{'id':_0x39f488['params']['id']}})['then'](handleEntityNotFound(_0x1b5489,null))[_0xf0be('0x13')](removeEntity(_0x1b5489,null))['catch'](handleError(_0x1b5489,null));};exports[_0xf0be('0x47')]=function(_0x2c1e40,_0x2a3b3d){return db['MailMessage'][_0xf0be('0x47')]()[_0xf0be('0x13')](respondWithResult(_0x2a3b3d,null))[_0xf0be('0x3f')](handleError(_0x2a3b3d,null));};exports['create']=function(_0x39960c,_0x55e947){return db[_0xf0be('0x28')][_0xf0be('0x48')](_0x39960c[_0xf0be('0x43')])[_0xf0be('0x13')](function(_0x496d8e){if(_0x496d8e){if(_0x496d8e[_0xf0be('0x49')]===_0xf0be('0x4a')&&!_0x496d8e['secret']){var _0x516862,_0x30e60e,_0x3d8a0f;if(_0x39960c['body']['to']){_0x30e60e=_0x39960c[_0xf0be('0x43')]['to']['split'](',')[0x0];}return db[_0xf0be('0x4b')][_0xf0be('0x4c')]({'where':{'id':_0x496d8e[_0xf0be('0x4d')]},'include':[{'model':db[_0xf0be('0x4e')],'as':_0xf0be('0x4f'),'include':[{'model':db['CmContact'],'as':_0xf0be('0x50'),'where':{'email':_0x30e60e},'limit':0x1,'order':[[_0xf0be('0x51'),_0xf0be('0x52')]]}]},{'model':db[_0xf0be('0x53')],'as':_0xf0be('0x54'),'raw':!![],'include':[{'model':db[_0xf0be('0x55')],'as':_0xf0be('0x55'),'raw':!![]}]}]})[_0xf0be('0x13')](function(_0xdca327){_0x516862=_0xdca327;if(!_0x516862||!_0x516862[_0xf0be('0x54')])return;var _0x3d59c8=_0x516862[_0xf0be('0x56')]();if(_0x39960c[_0xf0be('0x43')][_0xf0be('0x57')]&&_0x39960c['body'][_0xf0be('0x57')][_0xf0be('0x33')]){for(var _0x25c735=0x0;_0x25c735<_0x39960c[_0xf0be('0x43')][_0xf0be('0x57')]['length'];_0x25c735+=0x1){_0x39960c['body'][_0xf0be('0x57')][_0x25c735]={'filename':_0x39960c[_0xf0be('0x43')]['attachments'][_0x25c735][_0xf0be('0x25')],'path':path[_0xf0be('0x58')](config[_0xf0be('0x59')],'server/files/attachments',_0x39960c[_0xf0be('0x43')][_0xf0be('0x57')][_0x25c735][_0xf0be('0x5a')])};}}_0x3d8a0f={'account':_0x3d59c8,'message':_0x39960c['body']};return;})['then'](function(){if(_0x516862['List']){if(_0x516862[_0xf0be('0x4f')][_0xf0be('0x50')][_0xf0be('0x33')]){return _0x516862['List']['Contacts'][0x0];}else{return db['CmContact'][_0xf0be('0x48')](_[_0xf0be('0x5b')](_0x39960c['body'],{'firstName':_0x39960c[_0xf0be('0x43')]['to'],'email':_0x39960c[_0xf0be('0x43')]['to'],'phone':_0x39960c['body']['to'],'ListId':_0x516862[_0xf0be('0x5c')]}));}}else{throw new Error(_0xf0be('0x5d'));}})[_0xf0be('0x13')](function(){if(_0x3d8a0f){return respondWithRpcPromise(_0xf0be('0x5e'),_0xf0be('0x5f'),_0x3d8a0f,client9003)[_0xf0be('0x13')](function(_0x33a1e9){return _0x496d8e[_0xf0be('0x42')]({'read':!![],'messageId':_0x33a1e9[_0xf0be('0x60')],'sentAt':moment()[_0xf0be('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xf0be('0x3f')](function(_0x3e5591){logger[_0xf0be('0x18')]('%s',JSON[_0xf0be('0x62')](_0x3e5591));return _0x496d8e;});}return _0x496d8e;});}return _0x496d8e;}})[_0xf0be('0x13')](respondWithResult(_0x55e947,0xc9))['catch'](handleError(_0x55e947,null));};exports['accept']=function(_0x2563b8,_0x418611){var _0x202165={'agent':{},'channel':_0xf0be('0x63')};if(_0x2563b8[_0xf0be('0x43')]['id']){delete _0x2563b8[_0xf0be('0x43')]['id'];}_0x2563b8[_0xf0be('0x43')]['read']=!![];_0x2563b8[_0xf0be('0x43')][_0xf0be('0x64')]=moment()[_0xf0be('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x2563b8[_0xf0be('0x43')][_0xf0be('0x65')]=_0x2563b8[_0xf0be('0x43')]['UserId']||_0x2563b8[_0xf0be('0x66')]['id'];_0x202165[_0xf0be('0x67')]['id']=_0x2563b8[_0xf0be('0x43')][_0xf0be('0x65')];return db[_0xf0be('0x28')][_0xf0be('0x44')]({'where':{'id':_0x2563b8[_0xf0be('0x45')]['id'],'UserId':null}})[_0xf0be('0x13')](handleEntityNotFound(_0x418611,null))[_0xf0be('0x13')](saveUpdates(_0x2563b8[_0xf0be('0x43')],null))[_0xf0be('0x13')](function(_0x275eb4){if(_0x275eb4){_0x202165[_0xf0be('0x1a')]=_0x275eb4[_0xf0be('0x68')]({'plain':!![]});return db[_0xf0be('0x69')][_0xf0be('0x44')]({'where':{'id':_0x275eb4[_0xf0be('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x418611,null))['then'](function(_0x14b395){if(_0x14b395){return _0x14b395[_0xf0be('0x42')]({'UserId':_0x2563b8['body']['UserId'],'read1stAt':_[_0xf0be('0x6b')](_0x14b395[_0xf0be('0x6c')])?moment()[_0xf0be('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf0be('0x13')](function(_0xbd2767){if(_0xbd2767){_0x202165[_0xf0be('0x6d')]=_0xbd2767[_0xf0be('0x68')]({'plain':!![]});interaction_log[_0xf0be('0x14')](_0xf0be('0x6e'),_0x2563b8['user']['id'],_0x2563b8[_0xf0be('0x66')][_0xf0be('0x25')],_0x2563b8[_0xf0be('0x66')]['role'],_0x202165[_0xf0be('0x6d')]['id'],_0x2563b8['body']?JSON[_0xf0be('0x62')](_0x2563b8[_0xf0be('0x43')]):_0xf0be('0x6f'));return respondWithRpcPromise(_0xf0be('0x70'),'acceptMessage',_0x202165);}return null;})['then'](function(_0x351589){var _0x1cb707=_0xf0be('0x71')+_0x351589['message']['ContactId'];return db[_0xf0be('0x72')][_0xf0be('0x2e')](_0x1cb707,{'type':db[_0xf0be('0x73')][_0xf0be('0x74')][_0xf0be('0x75')],'raw':!![]})[_0xf0be('0x13')](function(_0xcc4b5a){return _0xcc4b5a;});})[_0xf0be('0x13')](function(_0x2e1b48){if(_0x2e1b48){_0x202165[_0xf0be('0x1a')][_0xf0be('0x76')]=_0x2e1b48[0x0];if(!_0x2563b8['body'][_0xf0be('0x65')])return;return db[_0xf0be('0x77')]['find']({'where':{'id':_0x2563b8[_0xf0be('0x43')][_0xf0be('0x65')],'role':_0xf0be('0x67')},'attributes':['id',_0xf0be('0x25'),_0xf0be('0x78'),_0xf0be('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4a7395){if(!_0x4a7395)return null;_0x202165[_0xf0be('0x1a')][_0xf0be('0x67')]=_0x4a7395;return _0x202165;})['then'](function(_0x3c8963){if(_0x3c8963){if(_0x2563b8[_0xf0be('0x43')][_0xf0be('0x7a')]){_0x202165[_0xf0be('0x1a')][_0xf0be('0x7b')]=util[_0xf0be('0x61')](_0xf0be('0x7c'),_0x2563b8[_0xf0be('0x66')][_0xf0be('0x25')]);_0x202165[_0xf0be('0x1a')][_0xf0be('0x7d')]=_0x202165[_0xf0be('0x7d')];_0x202165['message'][_0xf0be('0x7e')]=_0x202165[_0xf0be('0x7d')];_0x202165['message'][_0xf0be('0x7f')]='accept';_0x202165[_0xf0be('0x1a')]['body']=htmlToText[_0xf0be('0x80')](_0x202165[_0xf0be('0x1a')][_0xf0be('0x43')]);return respondWithRpcPromise('EventManager',_0xf0be('0x81'),{'event':_0xf0be('0x82'),'message':_0x202165[_0xf0be('0x1a')]},client9002)[_0xf0be('0x13')](function(){return _0x202165;});}return _0x202165;}return null;})[_0xf0be('0x13')](respondWithResult(_0x418611,null))[_0xf0be('0x3f')](handleError(_0x418611,null));};exports[_0xf0be('0x83')]=function(_0x2235a3,_0x373a6d){var _0x35eaea={'agent':{},'channel':_0xf0be('0x63')};if(_0x2235a3[_0xf0be('0x43')]['id']){delete _0x2235a3[_0xf0be('0x43')]['id'];}_0x2235a3[_0xf0be('0x43')]['UserId']=_0x2235a3[_0xf0be('0x43')]['UserId']||_0x2235a3[_0xf0be('0x66')]['id'];_0x35eaea['agent']['id']=_0x2235a3[_0xf0be('0x43')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x2235a3[_0xf0be('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x373a6d,null))['then'](function(_0x48eb70){if(_0x48eb70){_0x35eaea[_0xf0be('0x1a')]=_0x48eb70[_0xf0be('0x68')]({'plain':!![]});return db[_0xf0be('0x69')][_0xf0be('0x44')]({'where':{'id':_0x48eb70['MailInteractionId']}});}return null;})[_0xf0be('0x13')](handleEntityNotFound(_0x373a6d,null))[_0xf0be('0x13')](function(_0x95092d){if(_0x95092d){_0x35eaea['interaction']=_0x95092d[_0xf0be('0x68')]({'plain':!![]});interaction_log[_0xf0be('0x14')](_0xf0be('0x84'),_0x2235a3['user']['id'],_0x2235a3[_0xf0be('0x66')][_0xf0be('0x25')],_0x2235a3[_0xf0be('0x66')][_0xf0be('0x85')],_0x35eaea[_0xf0be('0x6d')]['id'],_0x2235a3[_0xf0be('0x43')]?JSON[_0xf0be('0x62')](_0x2235a3[_0xf0be('0x43')]):_0xf0be('0x6f'));return respondWithRpcPromise('RejectMessage',_0xf0be('0x86'),_0x35eaea);}return null;})['then'](function(_0x514c00){var _0x5d22aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x514c00[_0xf0be('0x1a')][_0xf0be('0x87')];return db['sequelize']['query'](_0x5d22aa,{'type':db[_0xf0be('0x73')]['QueryTypes'][_0xf0be('0x75')],'raw':!![]})['then'](function(_0x24faff){return _0x24faff;});})['then'](function(_0x4a880a){if(_0x4a880a){_0x35eaea[_0xf0be('0x1a')][_0xf0be('0x76')]=_0x4a880a[0x0];if(!_0x2235a3['body']['UserId'])return;return db['User'][_0xf0be('0x44')]({'where':{'id':_0x2235a3['body'][_0xf0be('0x65')],'role':'agent'},'attributes':['id','name',_0xf0be('0x78'),'email',_0xf0be('0x88')],'raw':!![]});}return null;})['then'](function(_0x4425e2){if(!_0x4425e2)return null;_0x35eaea[_0xf0be('0x1a')][_0xf0be('0x67')]=_0x4425e2;return _0x35eaea;})['then'](function(_0x47a6d2){if(_0x47a6d2){_0x47a6d2[_0xf0be('0x1a')][_0xf0be('0x7b')]=util[_0xf0be('0x61')](_0xf0be('0x7c'),_0x2235a3[_0xf0be('0x66')][_0xf0be('0x25')]);_0x47a6d2[_0xf0be('0x1a')][_0xf0be('0x7d')]=_0x35eaea[_0xf0be('0x7d')];_0x47a6d2[_0xf0be('0x1a')][_0xf0be('0x7e')]=_0x35eaea[_0xf0be('0x7d')];_0x47a6d2[_0xf0be('0x1a')][_0xf0be('0x7f')]='reject';_0x47a6d2[_0xf0be('0x1a')][_0xf0be('0x43')]=htmlToText[_0xf0be('0x80')](_0x35eaea[_0xf0be('0x1a')][_0xf0be('0x43')]);respondWithRpcPromise(_0xf0be('0x81'),'EventManager',{'event':_0xf0be('0x89'),'message':_0x47a6d2[_0xf0be('0x1a')]},client9002);return _0x35eaea;}return null;})[_0xf0be('0x13')](respondWithResult(_0x373a6d,null))[_0xf0be('0x3f')](handleError(_0x373a6d,null));};exports[_0xf0be('0x8a')]=function(_0x3268d3,_0x191041){var _0x13d77d=moment()[_0xf0be('0x8b')]()[_0xf0be('0x8c')]();var _0x34ba79=path[_0xf0be('0x58')](config[_0xf0be('0x59')],_0xf0be('0x8d'),_0xf0be('0x8e'),_0xf0be('0x8f'));var _0x174d94=path[_0xf0be('0x58')](config[_0xf0be('0x59')],_0xf0be('0x8d'),_0xf0be('0x8e'),_0xf0be('0x57'));var _0x49f8cb=util[_0xf0be('0x61')](_0xf0be('0x90'),_0x13d77d);return db[_0xf0be('0x28')][_0xf0be('0x44')]({'where':{'id':_0x3268d3['params']['id']},'attributes':['id',_0xf0be('0x43'),_0xf0be('0x91'),'to','cc',_0xf0be('0x92'),'subject',_0xf0be('0x93')],'include':_0x3268d3[_0xf0be('0x2e')]['attachments']?[{'model':db['Attachment'],'as':_0xf0be('0x94')}]:undefined})[_0xf0be('0x13')](handleEntityNotFound(_0x191041,null))[_0xf0be('0x13')](function(_0x22cf7b){if(_0x22cf7b){var _0x1e401f=_0x22cf7b;var _0x1e337e={'from':_0x1e401f[_0xf0be('0x91')],'to':_0x1e401f['to'],'subject':_0x1e401f[_0xf0be('0x95')],'html':htmlEntities[_0xf0be('0x96')](_0x1e401f[_0xf0be('0x43')]),'headers':{'Date':moment(_0x1e401f['createdAt'])['format'](_0xf0be('0x97'))},'attachments':[]};if(_0x22cf7b['cc']){_0x1e337e[_0xf0be('0x98')]['Cc']=_0x22cf7b['cc'];}if(_0x22cf7b[_0xf0be('0x92')]){_0x1e337e['headers'][_0xf0be('0x99')]=_0x22cf7b[_0xf0be('0x92')];}return new BPromise(function(_0x127e29,_0x4c2252){if(_0x22cf7b[_0xf0be('0x94')]){for(var _0xf5fc7a=0x0;_0xf5fc7a<_0x22cf7b[_0xf0be('0x94')]['length'];_0xf5fc7a++){var _0x1c0c4f=_0x22cf7b[_0xf0be('0x94')][_0xf5fc7a];var _0x136397=path[_0xf0be('0x58')](_0x174d94,_0x1c0c4f[_0xf0be('0x5a')]);if(fs[_0xf0be('0x9a')](_0x136397)){_0x1e337e[_0xf0be('0x57')][_0xf0be('0x9b')]({'name':_0x1c0c4f[_0xf0be('0x25')],'contentType':_0x1c0c4f[_0xf0be('0x2b')],'data':fs[_0xf0be('0x9c')](_0x136397)});}}}emlformat['build'](_0x1e337e,function(_0x2bd4fd,_0x338542){if(_0x2bd4fd)return _0x4c2252(_0x2bd4fd);fs[_0xf0be('0x9d')](path[_0xf0be('0x58')](_0x34ba79,_0x49f8cb),_0x338542);return _0x127e29(_0x338542);});});}})['then'](function(_0x3a8ceb){if(_0x3a8ceb){return _0x191041[_0xf0be('0x8a')](path[_0xf0be('0x58')](_0x34ba79,_0x49f8cb),_0x49f8cb,function(_0x33b7a7){if(!_0x33b7a7)fs[_0xf0be('0x9e')](path[_0xf0be('0x58')](_0x34ba79,_0x49f8cb));});}})[_0xf0be('0x3f')](handleError(_0x191041,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7b60b3e..4d8129f 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 _0x6908=['events','../../mysqldb','MailMessage','save','emit','hasOwnProperty','hook'];(function(_0xe073a3,_0x72504a){var _0x38577e=function(_0x1e26d1){while(--_0x1e26d1){_0xe073a3['push'](_0xe073a3['shift']());}};_0x38577e(++_0x72504a);}(_0x6908,0x9a));var _0x8690=function(_0x1fbd37,_0xfc796c){_0x1fbd37=_0x1fbd37-0x0;var _0x2012a9=_0x6908[_0x1fbd37];return _0x2012a9;};'use strict';var EventEmitter=require(_0x8690('0x0'));var MailMessage=require(_0x8690('0x1'))['db'][_0x8690('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8690('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3fa748){return function(_0x3818be,_0x4ffa77,_0x1fad48){MailMessageEvents[_0x8690('0x4')](_0x3fa748+':'+_0x3818be['id'],_0x3818be);MailMessageEvents[_0x8690('0x4')](_0x3fa748,_0x3818be);_0x1fad48(null);};}for(var e in events){if(events[_0x8690('0x5')](e)){var event=events[e];MailMessage[_0x8690('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xaffc=['events','MailMessage','remove','emit','hook'];(function(_0x22b254,_0x65fb18){var _0x10fdec=function(_0x7db39b){while(--_0x7db39b){_0x22b254['push'](_0x22b254['shift']());}};_0x10fdec(++_0x65fb18);}(_0xaffc,0x1ef));var _0xcaff=function(_0x2a20fe,_0x4e40e3){_0x2a20fe=_0x2a20fe-0x0;var _0x26335c=_0xaffc[_0x2a20fe];return _0x26335c;};'use strict';var EventEmitter=require(_0xcaff('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xcaff('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcaff('0x2')};function emitEvent(_0x2eac4a){return function(_0x5d78e9,_0x5ab67d,_0x56ae37){MailMessageEvents[_0xcaff('0x3')](_0x2eac4a+':'+_0x5d78e9['id'],_0x5d78e9);MailMessageEvents[_0xcaff('0x3')](_0x2eac4a,_0x5d78e9);_0x56ae37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xcaff('0x4')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3e45d45..487293b 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 _0x4ea2=['fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId'];(function(_0x343e76,_0x5593cb){var _0x47537f=function(_0x1f265f){while(--_0x1f265f){_0x343e76['push'](_0x343e76['shift']());}};_0x47537f(++_0x5593cb);}(_0x4ea2,0xa5));var _0x24ea=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x4ea2[_0x2b31a8];return _0x1175a5;};'use strict';var _=require(_0x24ea('0x0'));var util=require(_0x24ea('0x1'));var logger=require(_0x24ea('0x2'))(_0x24ea('0x3'));var moment=require(_0x24ea('0x4'));var BPromise=require(_0x24ea('0x5'));var rp=require(_0x24ea('0x6'));var htmlToText=require(_0x24ea('0x7'));var fs=require('fs');var path=require(_0x24ea('0x8'));var rimraf=require(_0x24ea('0x9'));var config=require(_0x24ea('0xa'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x1a343c,_0x44264b){return _0x1a343c[_0x24ea('0xb')](_0x24ea('0xc'),attributes,{'tableName':_0x24ea('0xd'),'paranoid':![],'indexes':[{'name':_0x24ea('0xe'),'fields':[_0x24ea('0xe')]},{'name':_0x24ea('0xf'),'fields':[_0x24ea('0x10'),_0x24ea('0x11')],'type':_0x24ea('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cce8d,_0x47dd7e,_0x4c275c){if(_0x3cce8d[_0x24ea('0x13')]){_0x3cce8d[_0x24ea('0x10')]=htmlToText['fromString'](_0x3cce8d[_0x24ea('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c275c(null,_0x47dd7e);},'afterCreate':function(_0x1ffd74,_0x1cee1b,_0x3e6497){var _0x5706a9=_0x1a343c[_0x24ea('0x14')];var _0x131e36=_0x1ffd74[_0x24ea('0x15')]({'plain':!![]});if(_0x131e36[_0x24ea('0x16')][_0x24ea('0x17')]()==='in'||_0x131e36[_0x24ea('0x16')][_0x24ea('0x17')]()==='out'&&!_0x131e36[_0x24ea('0x18')]&&!_[_0x24ea('0x19')](_0x131e36[_0x24ea('0x1a')])){_0x5706a9[_0x24ea('0x1b')][_0x24ea('0x1c')]({'where':{'id':_0x131e36[_0x24ea('0x1d')]}})['then'](function(_0x1f6ba7){if(_0x1f6ba7){_0x1f6ba7[_0x24ea('0x1e')]({'lastMsgAt':_0x131e36[_0x24ea('0x1f')],'lastMsgDirection':_0x131e36[_0x24ea('0x16')][_0x24ea('0x17')]()});}})[_0x24ea('0x20')](function(_0x572558){console[_0x24ea('0x21')](_0x572558);});}_0x3e6497();}},'charset':_0x24ea('0x22'),'collate':_0x24ea('0x23')});}; \ No newline at end of file +var _0x7673=['then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','fromString','models','get','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId'];(function(_0x2c3242,_0x32c5ef){var _0x4c9f9a=function(_0x4c675f){while(--_0x4c675f){_0x2c3242['push'](_0x2c3242['shift']());}};_0x4c9f9a(++_0x32c5ef);}(_0x7673,0x152));var _0x3767=function(_0x1b81b9,_0x1d314a){_0x1b81b9=_0x1b81b9-0x0;var _0x27a94d=_0x7673[_0x1b81b9];return _0x27a94d;};'use strict';var _=require(_0x3767('0x0'));var util=require(_0x3767('0x1'));var logger=require('../../config/logger')(_0x3767('0x2'));var moment=require('moment');var BPromise=require(_0x3767('0x3'));var rp=require(_0x3767('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3767('0x5'));var rimraf=require(_0x3767('0x6'));var config=require('../../config/environment');var attributes=require(_0x3767('0x7'));module[_0x3767('0x8')]=function(_0x157fa8,_0x26d1b0){return _0x157fa8[_0x3767('0x9')](_0x3767('0xa'),attributes,{'tableName':_0x3767('0xb'),'paranoid':![],'indexes':[{'name':_0x3767('0xc'),'fields':[_0x3767('0xc')]},{'name':'fti_mail_messages','fields':[_0x3767('0xd'),'subject'],'type':_0x3767('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46ea6e,_0x4a18f9,_0x5af7d3){if(_0x46ea6e['body']){_0x46ea6e[_0x3767('0xd')]=htmlToText[_0x3767('0xf')](_0x46ea6e['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5af7d3(null,_0x4a18f9);},'afterCreate':function(_0x25884b,_0x461439,_0x40b083){var _0x570619=_0x157fa8[_0x3767('0x10')];var _0x10c327=_0x25884b[_0x3767('0x11')]({'plain':!![]});if(_0x10c327['direction'][_0x3767('0x12')]()==='in'||_0x10c327['direction'][_0x3767('0x12')]()===_0x3767('0x13')&&!_0x10c327[_0x3767('0x14')]&&!_[_0x3767('0x15')](_0x10c327['UserId'])){_0x570619[_0x3767('0x16')][_0x3767('0x17')]({'where':{'id':_0x10c327[_0x3767('0x18')]}})[_0x3767('0x19')](function(_0x5dda19){if(_0x5dda19){_0x5dda19[_0x3767('0x1a')]({'lastMsgAt':_0x10c327[_0x3767('0x1b')],'lastMsgDirection':_0x10c327[_0x3767('0x1c')]['toLowerCase']()});}})[_0x3767('0x1d')](function(_0x4fced5){console[_0x3767('0x1e')](_0x4fced5);});}_0x40b083();}},'charset':_0x3767('0x1f'),'collate':_0x3767('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c0c37ed..afbdd3e 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 _0x4888=['code','message','request\x20sent','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x2a655e,_0x419bc6){var _0x8a2d2d=function(_0x1b87a9){while(--_0x1b87a9){_0x2a655e['push'](_0x2a655e['shift']());}};_0x8a2d2d(++_0x419bc6);}(_0x4888,0x198));var _0x8488=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x4888[_0x138293];return _0x34c4a2;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});}exports[_0x8488('0x1a')]=function(_0x3dd93e){var _0x554ec6=this;return new Promise(function(_0x4a1b45,_0x340d6b){return db[_0x8488('0x1b')][_0x8488('0x1c')](_0x3dd93e[_0x8488('0x1d')],{'raw':_0x3dd93e[_0x8488('0x1e')]?_0x3dd93e[_0x8488('0x1e')][_0x8488('0x1f')]===undefined?!![]:![]:!![]})[_0x8488('0xf')](function(_0x39dd43){logger['info'](_0x8488('0x1a'),_0x3dd93e);logger[_0x8488('0x12')](_0x8488('0x1a'),_0x3dd93e,JSON[_0x8488('0x20')](_0x39dd43));_0x4a1b45(_0x39dd43);})[_0x8488('0x19')](function(_0x54ecda){logger['error']('CreateMailMessage',_0x54ecda['message'],_0x3dd93e);_0x340d6b(_0x554ec6[_0x8488('0x14')](0x1f4,_0x54ecda['message']));});});}; \ No newline at end of file +var _0x7880=['redis','defaults','localhost','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailMessage','create','body','options','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x277541,_0x4d8a9b){var _0x4b975b=function(_0x30b55b){while(--_0x30b55b){_0x277541['push'](_0x277541['shift']());}};_0x4b975b(++_0x4d8a9b);}(_0x7880,0x1f4));var _0x0788=function(_0x4c4cbf,_0x1e6e6){_0x4c4cbf=_0x4c4cbf-0x0;var _0xa65774=_0x7880[_0x4c4cbf];return _0xa65774;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./mailMessage.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('MailMessage,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});}exports['CreateMailMessage']=function(_0x11ea01){var _0x5173d6=this;return new Promise(function(_0x7d0869,_0x48bc5f){return db[_0x0788('0x1b')][_0x0788('0x1c')](_0x11ea01[_0x0788('0x1d')],{'raw':_0x11ea01[_0x0788('0x1e')]?_0x11ea01[_0x0788('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2270d4){logger[_0x0788('0x11')](_0x0788('0x1f'),_0x11ea01);logger[_0x0788('0x14')]('CreateMailMessage',_0x11ea01,JSON['stringify'](_0x2270d4));_0x7d0869(_0x2270d4);})[_0x0788('0x1a')](function(_0x18cc33){logger[_0x0788('0x16')]('CreateMailMessage',_0x18cc33['message'],_0x11ea01);_0x48bc5f(_0x5173d6[_0x0788('0x16')](0x1f4,_0x18cc33[_0x0788('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a22aac0..7ee5cd4 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 _0xe035=['register','length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe035,0x1eb));var _0x5e03=function(_0x18259c,_0x1fd94a){_0x18259c=_0x18259c-0x0;var _0x3a5911=_0xe035[_0x18259c];return _0x3a5911;};'use strict';var MailMessageEvents=require(_0x5e03('0x0'));var events=[_0x5e03('0x1'),_0x5e03('0x2'),'update'];function createListener(_0x568463,_0x288a20){return function(_0x3142a4){_0x288a20[_0x5e03('0x3')](_0x568463,_0x3142a4);};}function removeListener(_0x24f1d7,_0x41a5d4){return function(){MailMessageEvents[_0x5e03('0x4')](_0x24f1d7,_0x41a5d4);};}exports[_0x5e03('0x5')]=function(_0x1f8c8e){for(var _0x1cfa7d=0x0,_0x10b696=events[_0x5e03('0x6')];_0x1cfa7d<_0x10b696;_0x1cfa7d++){var _0x223503=events[_0x1cfa7d];var _0x4eefff=createListener(_0x5e03('0x7')+_0x223503,_0x1f8c8e);MailMessageEvents['on'](_0x223503,_0x4eefff);}}; \ No newline at end of file +var _0x4862=['removeListener','length','./mailMessage.events','remove','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4862,0x129));var _0x2486=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0x4862[_0x401a4d];return _0x1faaff;};'use strict';var MailMessageEvents=require(_0x2486('0x0'));var events=['save',_0x2486('0x1'),_0x2486('0x2')];function createListener(_0x29ca2e,_0x598e5e){return function(_0x37a398){_0x598e5e['emit'](_0x29ca2e,_0x37a398);};}function removeListener(_0x4de75c,_0x211669){return function(){MailMessageEvents[_0x2486('0x3')](_0x4de75c,_0x211669);};}exports['register']=function(_0x249414){for(var _0x571ca2=0x0,_0xc39ab1=events[_0x2486('0x4')];_0x571ca2<_0xc39ab1;_0x571ca2++){var _0x1eadb2=events[_0x571ca2];var _0x460bdf=createListener('mailMessage:'+_0x1eadb2,_0x249414);MailMessageEvents['on'](_0x1eadb2,_0x460bdf);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 883f1f9..b4ecb9f 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 _0x5502=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy'];(function(_0x4bd7e5,_0x3139ee){var _0x2f5300=function(_0x2754d4){while(--_0x2754d4){_0x4bd7e5['push'](_0x4bd7e5['shift']());}};_0x2f5300(++_0x3139ee);}(_0x5502,0xd9));var _0x2550=function(_0x18eb9d,_0x5d9c1e){_0x18eb9d=_0x18eb9d-0x0;var _0xbb16ab=_0x5502[_0x18eb9d];return _0xbb16ab;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require('express');var router=express[_0x2550('0x4')]();var fs_extra=require(_0x2550('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2550('0x6'));var config=require(_0x2550('0x7'));var controller=require(_0x2550('0x8'));router['get']('/',auth[_0x2550('0x9')](),controller[_0x2550('0xa')]);router[_0x2550('0xb')]('/describe',auth[_0x2550('0x9')](),controller['describe']);router['get'](_0x2550('0xc'),auth[_0x2550('0x9')](),controller[_0x2550('0xd')]);router[_0x2550('0xb')](_0x2550('0xe'),auth[_0x2550('0x9')](),controller[_0x2550('0xf')]);router[_0x2550('0xb')](_0x2550('0x10'),auth[_0x2550('0x9')](),controller['getTeams']);router[_0x2550('0xb')](_0x2550('0x11'),auth[_0x2550('0x9')](),controller['getAgents']);router[_0x2550('0x12')]('/',auth[_0x2550('0x9')](),controller[_0x2550('0x13')]);router['post']('/:id/teams',auth[_0x2550('0x9')](),controller[_0x2550('0x14')]);router[_0x2550('0x12')](_0x2550('0x11'),auth[_0x2550('0x9')](),controller[_0x2550('0x15')]);router[_0x2550('0x16')](_0x2550('0xc'),auth[_0x2550('0x9')](),controller[_0x2550('0x17')]);router[_0x2550('0x18')](_0x2550('0xc'),auth[_0x2550('0x9')](),controller[_0x2550('0x19')]);router[_0x2550('0x18')](_0x2550('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2550('0x9')](),controller['removeAgents']);module[_0x2550('0x1a')]=router; \ No newline at end of file +var _0x7596=['getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/:id','isAuthenticated','/:id/members'];(function(_0x1eced4,_0xc5070f){var _0x1a91e5=function(_0xcc3a6c){while(--_0xcc3a6c){_0x1eced4['push'](_0x1eced4['shift']());}};_0x1a91e5(++_0xc5070f);}(_0x7596,0x15f));var _0x6759=function(_0x1671c7,_0x36f775){_0x1671c7=_0x1671c7-0x0;var _0x160b76=_0x7596[_0x1671c7];return _0x160b76;};'use strict';var multer=require(_0x6759('0x0'));var util=require('util');var path=require(_0x6759('0x1'));var timeout=require(_0x6759('0x2'));var express=require(_0x6759('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6759('0x4'));var interaction=require(_0x6759('0x5'));var config=require(_0x6759('0x6'));var controller=require(_0x6759('0x7'));router[_0x6759('0x8')]('/',auth['isAuthenticated'](),controller[_0x6759('0x9')]);router[_0x6759('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6759('0x8')](_0x6759('0xa'),auth[_0x6759('0xb')](),controller['show']);router['get'](_0x6759('0xc'),auth['isAuthenticated'](),controller[_0x6759('0xd')]);router[_0x6759('0x8')](_0x6759('0xe'),auth[_0x6759('0xb')](),controller[_0x6759('0xf')]);router[_0x6759('0x8')]('/:id/users',auth[_0x6759('0xb')](),controller[_0x6759('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6759('0x11')](_0x6759('0xe'),auth[_0x6759('0xb')](),controller[_0x6759('0x12')]);router[_0x6759('0x11')](_0x6759('0x13'),auth['isAuthenticated'](),controller[_0x6759('0x14')]);router[_0x6759('0x15')](_0x6759('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6759('0x16')](_0x6759('0xa'),auth[_0x6759('0xb')](),controller['destroy']);router['delete'](_0x6759('0xe'),auth[_0x6759('0xb')](),controller[_0x6759('0x17')]);router[_0x6759('0x16')](_0x6759('0x13'),auth['isAuthenticated'](),controller[_0x6759('0x18')]);module[_0x6759('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5d6f8a0..5b039b9 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 _0xafa6=['STRING','rrmemory','beepall','sequelize','exports'];(function(_0x2a4b21,_0x3568c0){var _0x4789c3=function(_0x54a79b){while(--_0x54a79b){_0x2a4b21['push'](_0x2a4b21['shift']());}};_0x4789c3(++_0x3568c0);}(_0xafa6,0xfd));var _0x6afa=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xafa6[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x6afa('0x0'));module[_0x6afa('0x1')]={'name':{'type':Sequelize[_0x6afa('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6afa('0x3'),_0x6afa('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x448f=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3e4516,_0x37dec7){var _0x1ca3d4=function(_0x388cd6){while(--_0x388cd6){_0x3e4516['push'](_0x3e4516['shift']());}};_0x1ca3d4(++_0x37dec7);}(_0x448f,0x66));var _0xf448=function(_0x27c25b,_0x1b78c3){_0x27c25b=_0x27c25b-0x0;var _0x240519=_0x448f[_0x27c25b];return _0x240519;};'use strict';var Sequelize=require(_0xf448('0x0'));module[_0xf448('0x1')]={'name':{'type':Sequelize[_0xf448('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf448('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf448('0x4')](_0xf448('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index d388da5..a98c575 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 _0x05ba=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','error','stack','name','MailQueue','fieldName','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','rawAttributes','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','hasOwnProperty','MailQueueId','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','createdAt','format','SIP','mailPause','updatedAt','Team','options','getTeams','addTeams','ids','interface','flatMap','sequelize','each','findOrCreate','forEach','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','emit','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x236f74,_0x169ca6){var _0x2a15b0=function(_0x29c804){while(--_0x29c804){_0x236f74['push'](_0x236f74['shift']());}};_0x2a15b0(++_0x169ca6);}(_0x05ba,0x116));var _0xa05b=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x05ba[_0x5cc3d4];return _0x17ca31;};'use strict';var emlformat=require(_0xa05b('0x0'));var rimraf=require(_0xa05b('0x1'));var zipdir=require(_0xa05b('0x2'));var jsonpatch=require(_0xa05b('0x3'));var rp=require(_0xa05b('0x4'));var moment=require(_0xa05b('0x5'));var BPromise=require(_0xa05b('0x6'));var Mustache=require(_0xa05b('0x7'));var util=require(_0xa05b('0x8'));var path=require(_0xa05b('0x9'));var sox=require(_0xa05b('0xa'));var csv=require(_0xa05b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa05b('0xc'));var _=require('lodash');var squel=require(_0xa05b('0xd'));var crypto=require(_0xa05b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa05b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa05b('0x10'));var Papa=require('papaparse');var Redis=require(_0xa05b('0x11'));var authService=require(_0xa05b('0x12'));var qs=require(_0xa05b('0x13'));var as=require(_0xa05b('0x14'));var hardwareService=require(_0xa05b('0x15'));var logger=require(_0xa05b('0x16'))(_0xa05b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa05b('0x18'));var db=require('../../mysqldb')['db'];config[_0xa05b('0x19')]=_['defaults'](config[_0xa05b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa05b('0x1a'))(new Redis(config[_0xa05b('0x19')]));require(_0xa05b('0x1b'))[_0xa05b('0x1c')](socket);function respondWithStatusCode(_0x5e7209,_0x3011bc){_0x3011bc=_0x3011bc||0xcc;return function(_0x480ad3){if(_0x480ad3){return _0x5e7209[_0xa05b('0x1d')](_0x3011bc);}return _0x5e7209['status'](_0x3011bc)['end']();};}function respondWithResult(_0x96f37,_0x3e273c){_0x3e273c=_0x3e273c||0xc8;return function(_0x10e454){if(_0x10e454){return _0x96f37[_0xa05b('0x1e')](_0x3e273c)[_0xa05b('0x1f')](_0x10e454);}};}function respondWithFilteredResult(_0x431adb,_0x404c54){return function(_0x350620){if(_0x350620){var _0x40accb=typeof _0x404c54[_0xa05b('0x20')]===_0xa05b('0x21')&&typeof _0x404c54['limit']===_0xa05b('0x21');var _0x1b7a1f=_0x350620['count'];var _0x4c34ed=_0x40accb?0x0:_0x404c54[_0xa05b('0x20')];var _0x24f8e4=_0x40accb?_0x350620[_0xa05b('0x22')]:_0x404c54['offset']+_0x404c54[_0xa05b('0x23')];var _0x18b998;if(_0x24f8e4>=_0x1b7a1f){_0x24f8e4=_0x1b7a1f;_0x18b998=0xc8;}else{_0x18b998=0xce;}_0x431adb[_0xa05b('0x1e')](_0x18b998);return _0x431adb['set'](_0xa05b('0x24'),_0x4c34ed+'-'+_0x24f8e4+'/'+_0x1b7a1f)[_0xa05b('0x1f')](_0x350620);}return null;};}function patchUpdates(_0x4fc9b7){return function(_0x26809c){try{jsonpatch[_0xa05b('0x25')](_0x26809c,_0x4fc9b7,!![]);}catch(_0x34f519){return BPromise[_0xa05b('0x26')](_0x34f519);}return _0x26809c[_0xa05b('0x27')]();};}function saveUpdates(_0x11e26d,_0x1048ca){return function(_0x412f47){if(_0x412f47){return _0x412f47[_0xa05b('0x28')](_0x11e26d)[_0xa05b('0x29')](function(_0x52003f){return _0x52003f;});}return null;};}function removeEntity(_0xf42218,_0x43e41c){return function(_0x2c022c){if(_0x2c022c){return _0x2c022c[_0xa05b('0x2a')]()[_0xa05b('0x29')](function(){var _0x49fb1d=_0x2c022c[_0xa05b('0x2b')]({'plain':!![]});var _0x28fc3d=_0xa05b('0x2c');return db['UserProfileResource'][_0xa05b('0x2a')]({'where':{'type':_0x28fc3d,'resourceId':_0x49fb1d['id']}})[_0xa05b('0x29')](function(){return _0x2c022c;});})[_0xa05b('0x29')](function(){_0xf42218[_0xa05b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x431d61,_0x39cb2d){return function(_0x49b355){if(!_0x49b355){_0x431d61['sendStatus'](0x194);}return _0x49b355;};}function handleError(_0x50babc,_0x529d80){_0x529d80=_0x529d80||0x1f4;return function(_0x26bc3d){logger[_0xa05b('0x2d')](_0x26bc3d[_0xa05b('0x2e')]);if(_0x26bc3d[_0xa05b('0x2f')]){delete _0x26bc3d[_0xa05b('0x2f')];}_0x50babc['status'](_0x529d80)['send'](_0x26bc3d);};}exports['index']=function(_0x21650c,_0xb245ef){var _0x4e8fc2={},_0x52fbce={},_0x1dd36e={'count':0x0,'rows':[]};var _0x2e3d85=_['map'](db[_0xa05b('0x30')]['rawAttributes'],function(_0x3331e3){return{'name':_0x3331e3[_0xa05b('0x31')],'type':_0x3331e3['type']['key']};});_0x52fbce[_0xa05b('0x32')]=_[_0xa05b('0x33')](_0x2e3d85,_0xa05b('0x2f'));_0x52fbce[_0xa05b('0x34')]=_[_0xa05b('0x35')](_0x21650c[_0xa05b('0x34')]);_0x52fbce[_0xa05b('0x36')]=_[_0xa05b('0x37')](_0x52fbce[_0xa05b('0x32')],_0x52fbce[_0xa05b('0x34')]);_0x4e8fc2['attributes']=_[_0xa05b('0x37')](_0x52fbce[_0xa05b('0x32')],qs[_0xa05b('0x38')](_0x21650c[_0xa05b('0x34')][_0xa05b('0x38')]));_0x4e8fc2[_0xa05b('0x39')]=_0x4e8fc2[_0xa05b('0x39')]['length']?_0x4e8fc2[_0xa05b('0x39')]:_0x52fbce[_0xa05b('0x32')];if(!_0x21650c[_0xa05b('0x34')]['hasOwnProperty'](_0xa05b('0x3a'))){_0x4e8fc2['limit']=qs[_0xa05b('0x23')](_0x21650c['query']['limit']);_0x4e8fc2[_0xa05b('0x20')]=qs[_0xa05b('0x20')](_0x21650c[_0xa05b('0x34')][_0xa05b('0x20')]);}_0x4e8fc2[_0xa05b('0x3b')]=qs[_0xa05b('0x3c')](_0x21650c[_0xa05b('0x34')][_0xa05b('0x3c')]);_0x4e8fc2[_0xa05b('0x3d')]=qs[_0xa05b('0x36')](_[_0xa05b('0x3e')](_0x21650c['query'],_0x52fbce[_0xa05b('0x36')]),_0x2e3d85);if(_0x21650c[_0xa05b('0x34')][_0xa05b('0x3f')]){_0x4e8fc2[_0xa05b('0x3d')]=_[_0xa05b('0x40')](_0x4e8fc2[_0xa05b('0x3d')],{'$or':_[_0xa05b('0x33')](_0x2e3d85,function(_0x4d9bff){if(_0x4d9bff[_0xa05b('0x41')]!==_0xa05b('0x42')){var _0x310926={};_0x310926[_0x4d9bff[_0xa05b('0x2f')]]={'$like':'%'+_0x21650c['query'][_0xa05b('0x3f')]+'%'};return _0x310926;}})});}_0x4e8fc2=_['merge']({},_0x4e8fc2,_0x21650c['options']);var _0x591a42={'where':_0x4e8fc2['where']};return db[_0xa05b('0x30')][_0xa05b('0x22')](_0x591a42)[_0xa05b('0x29')](function(_0x19e710){_0x1dd36e[_0xa05b('0x22')]=_0x19e710;if(_0x21650c[_0xa05b('0x34')][_0xa05b('0x43')]){_0x4e8fc2[_0xa05b('0x44')]=[{'all':!![]}];}return db[_0xa05b('0x30')]['findAll'](_0x4e8fc2);})['then'](function(_0x1f064c){_0x1dd36e[_0xa05b('0x45')]=_0x1f064c;return _0x1dd36e;})[_0xa05b('0x29')](respondWithFilteredResult(_0xb245ef,_0x4e8fc2))[_0xa05b('0x46')](handleError(_0xb245ef,null));};exports['show']=function(_0x7e770e,_0x5e9929){var _0x38a56f={'raw':!![],'where':{'id':_0x7e770e['params']['id']}},_0x443f40={};_0x443f40['model']=_[_0xa05b('0x35')](db['MailQueue'][_0xa05b('0x47')]);_0x443f40[_0xa05b('0x34')]=_[_0xa05b('0x35')](_0x7e770e[_0xa05b('0x34')]);_0x443f40[_0xa05b('0x36')]=_[_0xa05b('0x37')](_0x443f40[_0xa05b('0x32')],_0x443f40[_0xa05b('0x34')]);_0x38a56f[_0xa05b('0x39')]=_[_0xa05b('0x37')](_0x443f40[_0xa05b('0x32')],qs[_0xa05b('0x38')](_0x7e770e['query'][_0xa05b('0x38')]));_0x38a56f[_0xa05b('0x39')]=_0x38a56f[_0xa05b('0x39')][_0xa05b('0x48')]?_0x38a56f['attributes']:_0x443f40[_0xa05b('0x32')];if(_0x7e770e['query'][_0xa05b('0x43')]){_0x38a56f['include']=[{'all':!![]}];}_0x38a56f=_[_0xa05b('0x40')]({},_0x38a56f,_0x7e770e['options']);return db[_0xa05b('0x30')][_0xa05b('0x49')](_0x38a56f)[_0xa05b('0x29')](handleEntityNotFound(_0x5e9929,null))[_0xa05b('0x29')](respondWithResult(_0x5e9929,null))[_0xa05b('0x46')](handleError(_0x5e9929,null));};exports['create']=function(_0xae8f5d,_0x241b1c){return db[_0xa05b('0x30')][_0xa05b('0x4a')](_0xae8f5d[_0xa05b('0x4b')],{})[_0xa05b('0x29')](function(_0x54767e){var _0x243ed0=_0xae8f5d[_0xa05b('0x4c')][_0xa05b('0x2b')]({'plain':!![]});if(!_0x243ed0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x243ed0[_0xa05b('0x4d')]===_0xa05b('0x4c')){var _0x2bdbfe=_0x54767e[_0xa05b('0x2b')]({'plain':!![]});var _0x469a58=_0xa05b('0x2c');return db[_0xa05b('0x4e')][_0xa05b('0x49')]({'where':{'name':_0x469a58,'userProfileId':_0x243ed0[_0xa05b('0x4f')]},'raw':!![]})[_0xa05b('0x29')](function(_0x154fae){if(_0x154fae&&_0x154fae[_0xa05b('0x50')]===0x0){return db[_0xa05b('0x51')]['create']({'name':_0x2bdbfe[_0xa05b('0x2f')],'resourceId':_0x2bdbfe['id'],'type':_0x154fae['name'],'sectionId':_0x154fae['id']},{})[_0xa05b('0x29')](function(){return _0x54767e;});}else{return _0x54767e;}})[_0xa05b('0x46')](function(_0x2e1b70){logger[_0xa05b('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e1b70);throw _0x2e1b70;});}return _0x54767e;})[_0xa05b('0x29')](respondWithResult(_0x241b1c,0xc9))['catch'](handleError(_0x241b1c,null));};exports[_0xa05b('0x28')]=function(_0x204886,_0x4ea58c){if(_0x204886[_0xa05b('0x4b')]['id']){delete _0x204886['body']['id'];}return db[_0xa05b('0x30')][_0xa05b('0x49')]({'where':{'id':_0x204886[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x4ea58c,null))[_0xa05b('0x29')](saveUpdates(_0x204886['body'],null))[_0xa05b('0x29')](respondWithResult(_0x4ea58c,null))['catch'](handleError(_0x4ea58c,null));};exports[_0xa05b('0x2a')]=function(_0x1183b1,_0x56d9bd){return db[_0xa05b('0x30')][_0xa05b('0x49')]({'where':{'id':_0x1183b1[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x56d9bd,null))[_0xa05b('0x29')](removeEntity(_0x56d9bd,null))['catch'](handleError(_0x56d9bd,null));};exports[_0xa05b('0x53')]=function(_0x3395bc,_0x27cba9){return db[_0xa05b('0x30')]['describe']()['then'](respondWithResult(_0x27cba9,null))[_0xa05b('0x46')](handleError(_0x27cba9,null));};exports[_0xa05b('0x54')]=function(_0x45db7d,_0x1c00ed,_0x2f3081){var _0x2a6076={'raw':!![],'where':{}},_0x421f22={},_0x4b8397;return db['MailQueue'][_0xa05b('0x55')]({'where':{'id':_0x45db7d[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x1c00ed,null))[_0xa05b('0x29')](function(_0x17442d){if(_0x17442d){_0x4b8397=_0x17442d[_0xa05b('0x2b')]({'plain':!![]});_0x421f22[_0xa05b('0x32')]=_['keys'](db['UserMailQueue'][_0xa05b('0x47')]);_0x421f22['query']=_['keys'](_0x45db7d[_0xa05b('0x34')]);_0x421f22[_0xa05b('0x36')]=_[_0xa05b('0x37')](_0x421f22[_0xa05b('0x32')],_0x421f22[_0xa05b('0x34')]);_0x2a6076[_0xa05b('0x39')]=_['intersection'](_0x421f22['model'],qs[_0xa05b('0x38')](_0x45db7d[_0xa05b('0x34')][_0xa05b('0x38')]));_0x2a6076['attributes']=_0x2a6076['attributes'][_0xa05b('0x48')]?_0x2a6076[_0xa05b('0x39')]:_0x421f22[_0xa05b('0x32')];if(!_0x45db7d['query'][_0xa05b('0x56')](_0xa05b('0x3a'))){_0x2a6076[_0xa05b('0x23')]=qs[_0xa05b('0x23')](_0x45db7d[_0xa05b('0x34')][_0xa05b('0x23')]);_0x2a6076[_0xa05b('0x20')]=qs[_0xa05b('0x20')](_0x45db7d[_0xa05b('0x34')][_0xa05b('0x20')]);}_0x2a6076[_0xa05b('0x3b')]=qs[_0xa05b('0x3c')](_0x45db7d[_0xa05b('0x34')][_0xa05b('0x3c')]);_0x2a6076['where']=qs[_0xa05b('0x36')](_['pick'](_0x45db7d[_0xa05b('0x34')],_0x421f22[_0xa05b('0x36')]));_0x2a6076[_0xa05b('0x3d')][_0xa05b('0x57')]=_0x17442d['id'];if(_0x45db7d[_0xa05b('0x34')][_0xa05b('0x3f')]){_0x2a6076[_0xa05b('0x3d')]=_[_0xa05b('0x40')](_0x2a6076[_0xa05b('0x3d')],{'$or':_[_0xa05b('0x33')](_0x2a6076[_0xa05b('0x39')],function(_0x162fdb){var _0x1de25e={};_0x1de25e[_0x162fdb]={'$like':'%'+_0x45db7d[_0xa05b('0x34')][_0xa05b('0x3f')]+'%'};return _0x1de25e;})});}_0x2a6076=_[_0xa05b('0x40')]({},_0x2a6076,_0x45db7d['options']);return db[_0xa05b('0x58')][_0xa05b('0x59')](_0x2a6076);}})['then'](function(_0x44d95d){if(_0x44d95d){return db[_0xa05b('0x5a')][_0xa05b('0x5b')]({'where':{'id':_['map'](_0x44d95d,_0xa05b('0x5c')),'role':_0xa05b('0x5d')},'attributes':['id','name','mailPause','updatedAt',_0xa05b('0x5e')]});}})[_0xa05b('0x29')](function(_0x58e24f){if(_0x58e24f){return{'count':_0x58e24f[_0xa05b('0x22')],'rows':_[_0xa05b('0x33')](_0x58e24f['rows'],function(_0xd77033){return{'membername':_0xd77033['name'],'UserId':_0xd77033['id'],'queue_name':_0x4b8397['name'],'MailQueueId':_0x4b8397['id'],'interface':util[_0xa05b('0x5f')]('%s/%s',_0xa05b('0x60'),_0xd77033[_0xa05b('0x2f')]),'penalty':0x0,'paused':_0xd77033[_0xa05b('0x61')],'createdAt':_0xd77033[_0xa05b('0x5e')],'updatedAt':_0xd77033[_0xa05b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa05b('0x29')](respondWithFilteredResult(_0x1c00ed,_0x2a6076))[_0xa05b('0x46')](handleError(_0x1c00ed,null));};exports['getTeams']=function(_0x177c62,_0x3e50a9,_0xe5506){var _0x44f935={};var _0x4b6c63={};var _0x100662;var _0x104732;return db[_0xa05b('0x30')][_0xa05b('0x55')]({'where':{'id':_0x177c62[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x3e50a9,null))['then'](function(_0xe53799){if(_0xe53799){_0x100662=_0xe53799;_0x4b6c63[_0xa05b('0x32')]=_['keys'](db[_0xa05b('0x63')]['rawAttributes']);_0x4b6c63[_0xa05b('0x34')]=_[_0xa05b('0x35')](_0x177c62[_0xa05b('0x34')]);_0x4b6c63['filters']=_[_0xa05b('0x37')](_0x4b6c63[_0xa05b('0x32')],_0x4b6c63[_0xa05b('0x34')]);_0x44f935[_0xa05b('0x39')]=_[_0xa05b('0x37')](_0x4b6c63[_0xa05b('0x32')],qs[_0xa05b('0x38')](_0x177c62[_0xa05b('0x34')][_0xa05b('0x38')]));_0x44f935[_0xa05b('0x39')]=_0x44f935[_0xa05b('0x39')][_0xa05b('0x48')]?_0x44f935[_0xa05b('0x39')]:_0x4b6c63['model'];_0x44f935[_0xa05b('0x3b')]=qs[_0xa05b('0x3c')](_0x177c62[_0xa05b('0x34')]['sort']);_0x44f935['where']=qs[_0xa05b('0x36')](_[_0xa05b('0x3e')](_0x177c62[_0xa05b('0x34')],_0x4b6c63['filters']));if(_0x177c62[_0xa05b('0x34')][_0xa05b('0x3f')]){_0x44f935[_0xa05b('0x3d')]=_[_0xa05b('0x40')](_0x44f935[_0xa05b('0x3d')],{'$or':_[_0xa05b('0x33')](_0x44f935[_0xa05b('0x39')],function(_0x247911){var _0x717675={};_0x717675[_0x247911]={'$like':'%'+_0x177c62[_0xa05b('0x34')][_0xa05b('0x3f')]+'%'};return _0x717675;})});}_0x44f935=_[_0xa05b('0x40')]({},_0x44f935,_0x177c62[_0xa05b('0x64')]);return _0x100662[_0xa05b('0x65')](_0x44f935);}})[_0xa05b('0x29')](function(_0xf6a845){if(_0xf6a845){_0x104732=_0xf6a845[_0xa05b('0x48')];if(!_0x177c62['query'][_0xa05b('0x56')]('nolimit')){_0x44f935[_0xa05b('0x23')]=qs['limit'](_0x177c62[_0xa05b('0x34')]['limit']);_0x44f935[_0xa05b('0x20')]=qs[_0xa05b('0x20')](_0x177c62[_0xa05b('0x34')][_0xa05b('0x20')]);}return _0x100662[_0xa05b('0x65')](_0x44f935);}})[_0xa05b('0x29')](function(_0x46946f){if(_0x46946f){return _0x46946f?{'count':_0x104732,'rows':_0x46946f}:null;}})[_0xa05b('0x29')](respondWithResult(_0x3e50a9,null))[_0xa05b('0x46')](handleError(_0x3e50a9,null));};exports[_0xa05b('0x66')]=function(_0x403998,_0x1d5b0c,_0xcc85e7){var _0xa8559b=_0x403998[_0xa05b('0x4b')][_0xa05b('0x67')];return db[_0xa05b('0x63')][_0xa05b('0x59')]({'where':{'id':_0xa8559b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0xa05b('0x68')],'raw':!![]}]})[_0xa05b('0x29')](function(_0x279e0d){if(_0x279e0d){var _0x25b773=_[_0xa05b('0x69')](_0x279e0d,function(_0x553481){var _0x287b90=_0x553481[_0xa05b('0x2b')]({'plain':!![]});return _0x287b90['Agents'];});return db[_0xa05b('0x30')][_0xa05b('0x49')]({'where':{'id':_0x403998['params']['id']}})[_0xa05b('0x29')](function(_0x1da094){return db[_0xa05b('0x6a')]['transaction'](function(_0x1f2c70){return _0x1da094['addTeams'](_0xa8559b,{'transaction':_0x1f2c70})[_0xa05b('0x29')](function(){return BPromise[_0xa05b('0x6b')](_0x25b773,function(_0x49490d){return db[_0xa05b('0x58')][_0xa05b('0x6c')]({'where':{'UserId':_0x49490d['id'],'MailQueueId':_0x403998[_0xa05b('0x52')]['id']},'transaction':_0x1f2c70});});})[_0xa05b('0x29')](function(){_0x25b773[_0xa05b('0x6d')](function(_0x38a8ad){socket['emit'](_0xa05b('0x6e'),{'UserId':_0x38a8ad['id'],'MailQueueId':_0x1da094['id']});});});});});}})[_0xa05b('0x29')](respondWithStatusCode(_0x1d5b0c,null))[_0xa05b('0x46')](handleError(_0x1d5b0c,null));};exports[_0xa05b('0x6f')]=function(_0x471c2e,_0x52ef83,_0x1fe4f4){return db['Team'][_0xa05b('0x59')]({'where':{'id':_0x471c2e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa05b('0x5a')],'as':_0xa05b('0x70'),'attributes':['id'],'raw':!![]}]})[_0xa05b('0x29')](handleEntityNotFound(_0x52ef83,null))[_0xa05b('0x29')](function(_0xb548c0){var _0x29348b=_[_0xa05b('0x33')](_0xb548c0,'id');var _0x302b49=[];var _0x259ecc=[];var _0x126228=squel[_0xa05b('0x71')]();_0x126228[_0xa05b('0x72')](_0xa05b('0x73'))[_0xa05b('0x74')](_0xa05b('0x75'),'tq')['join'](_0xa05b('0x76'),'ut',_0xa05b('0x77'))['where'](_0xa05b('0x78'),_0x471c2e[_0xa05b('0x52')]['id']);for(var _0x5a8d83=0x0;_0x5a8d83<_0xb548c0[_0xa05b('0x48')];_0x5a8d83+=0x1){let _0x3004f3=_0xb548c0[_0x5a8d83];for(var _0x551dcc=0x0;_0x551dcc<_0x3004f3['Agents'][_0xa05b('0x48')];_0x551dcc+=0x1){let _0x31def6=_0x3004f3[_0xa05b('0x70')][_0x551dcc];var _0x2ff80a=_0x126228[_0xa05b('0x79')]();_0x2ff80a[_0xa05b('0x3d')](_0xa05b('0x7a'),_0x31def6['id']);_0x259ecc[_0xa05b('0x7b')](db[_0xa05b('0x6a')][_0xa05b('0x34')](_0x2ff80a[_0xa05b('0x7c')](),{'type':db[_0xa05b('0x6a')][_0xa05b('0x7d')]['SELECT']})[_0xa05b('0x29')](function(_0x241a71){if(_0x241a71[_0xa05b('0x48')]===0x1){return _0x31def6['id'];}else{var _0xff6c2a=_[_0xa05b('0x7e')](_[_0xa05b('0x33')](_0x241a71,_0xa05b('0x7f')),function(_0x21e4d1){return _[_0xa05b('0x80')](_0x29348b,_0x21e4d1);});if(_0xff6c2a){return _0x31def6['id'];}}}));}}return BPromise[_0xa05b('0x81')](_0x259ecc)[_0xa05b('0x29')](function(_0x2bfd67){_0x302b49=_(_0x302b49)[_0xa05b('0x82')](_0x2bfd67)[_0xa05b('0x83')]()[_0xa05b('0x84')]();return db[_0xa05b('0x30')][_0xa05b('0x49')]({'where':{'id':_0x471c2e[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](function(_0x5b3640){return db[_0xa05b('0x6a')][_0xa05b('0x85')](function(_0x2a51a6){return _0x5b3640[_0xa05b('0x6f')](_0x471c2e[_0xa05b('0x34')][_0xa05b('0x67')],{'transaction':_0x2a51a6})['then'](function(){if(!_['isEmpty'](_0x302b49)){return _0x5b3640['removeAgents'](_0x302b49,{'transaction':_0x2a51a6});}})[_0xa05b('0x29')](function(){_0x302b49[_0xa05b('0x6d')](function(_0x315a65){socket[_0xa05b('0x86')](_0xa05b('0x87'),{'UserId':_0x315a65,'MailQueueId':_0x5b3640['id']});});});});});});})['then'](respondWithStatusCode(_0x52ef83,null))['catch'](handleError(_0x52ef83,null));};exports[_0xa05b('0x88')]=function(_0x4213db,_0x2f3384,_0x334c37){return db[_0xa05b('0x30')][_0xa05b('0x49')]({'where':{'id':_0x4213db[_0xa05b('0x52')]['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x2f3384,null))[_0xa05b('0x29')](function(_0x386e33){if(_0x386e33){return _0x386e33['addAgents'](_0x4213db['body'][_0xa05b('0x67')],_['omit'](_0x4213db['body'],[_0xa05b('0x67'),'id'])||{})[_0xa05b('0x89')](function(_0x339514){for(var _0x122611=0x0;_0x122611<_0x4213db['body'][_0xa05b('0x67')][_0xa05b('0x48')];_0x122611+=0x1){socket[_0xa05b('0x86')](_0xa05b('0x6e'),{'UserId':Number(_0x4213db[_0xa05b('0x4b')]['ids'][_0x122611]),'MailQueueId':Number(_0x4213db[_0xa05b('0x52')]['id'])});}return _0x339514;});}})['then'](respondWithResult(_0x2f3384,null))['catch'](handleError(_0x2f3384,null));};exports['removeAgents']=function(_0x27abc9,_0x1bfa37,_0x1ce99d){return db['MailQueue']['find']({'where':{'id':_0x27abc9['params']['id']}})['then'](handleEntityNotFound(_0x1bfa37,null))[_0xa05b('0x29')](function(_0x1d149e){if(_0x1d149e){return _0x1d149e[_0xa05b('0x8a')](_0x27abc9[_0xa05b('0x34')][_0xa05b('0x67')])[_0xa05b('0x29')](function(){if(_[_0xa05b('0x8b')](_0x27abc9[_0xa05b('0x34')]['ids'])){for(var _0x5a72cd=0x0;_0x5a72cd<_0x27abc9['query'][_0xa05b('0x67')]['length'];_0x5a72cd+=0x1){socket[_0xa05b('0x86')](_0xa05b('0x87'),{'UserId':Number(_0x27abc9[_0xa05b('0x34')]['ids'][_0x5a72cd]),'MailQueueId':Number(_0x27abc9[_0xa05b('0x52')]['id'])});}}else{socket[_0xa05b('0x86')](_0xa05b('0x87'),{'UserId':Number(_0x27abc9[_0xa05b('0x34')][_0xa05b('0x67')]),'MailQueueId':Number(_0x27abc9[_0xa05b('0x52')]['id'])});}});}})[_0xa05b('0x29')](respondWithStatusCode(_0x1bfa37,null))['catch'](handleError(_0x1bfa37,null));};exports[_0xa05b('0x8c')]=function(_0x5a0c8f,_0x3fe18a,_0x18ab5a){var _0x4694fd={};var _0x34354f={};var _0xc9009;var _0x1d78e5;return db[_0xa05b('0x30')]['findOne']({'where':{'id':_0x5a0c8f['params']['id']}})[_0xa05b('0x29')](handleEntityNotFound(_0x3fe18a,null))[_0xa05b('0x29')](function(_0x3d7efe){if(_0x3d7efe){_0xc9009=_0x3d7efe;_0x34354f[_0xa05b('0x32')]=_['keys'](db['User']['rawAttributes']);_0x34354f[_0xa05b('0x34')]=_['keys'](_0x5a0c8f[_0xa05b('0x34')]);_0x34354f['filters']=_[_0xa05b('0x37')](_0x34354f[_0xa05b('0x32')],_0x34354f[_0xa05b('0x34')]);_0x4694fd[_0xa05b('0x39')]=_['intersection'](_0x34354f['model'],qs[_0xa05b('0x38')](_0x5a0c8f[_0xa05b('0x34')][_0xa05b('0x38')]));_0x4694fd['attributes']=_0x4694fd[_0xa05b('0x39')][_0xa05b('0x48')]?_0x4694fd[_0xa05b('0x39')]:_0x34354f[_0xa05b('0x32')];_0x4694fd[_0xa05b('0x3b')]=qs[_0xa05b('0x3c')](_0x5a0c8f[_0xa05b('0x34')][_0xa05b('0x3c')]);_0x4694fd[_0xa05b('0x3d')]=qs['filters'](_[_0xa05b('0x3e')](_0x5a0c8f[_0xa05b('0x34')],_0x34354f[_0xa05b('0x36')]));if(_0x5a0c8f['query'][_0xa05b('0x3f')]){_0x4694fd['where']=_[_0xa05b('0x40')](_0x4694fd['where'],{'$or':_[_0xa05b('0x33')](_0x4694fd[_0xa05b('0x39')],function(_0x477da1){var _0x1e181e={};_0x1e181e[_0x477da1]={'$like':'%'+_0x5a0c8f['query']['filter']+'%'};return _0x1e181e;})});}_0x4694fd=_[_0xa05b('0x40')]({},_0x4694fd,_0x5a0c8f['options']);return _0xc9009[_0xa05b('0x8c')](_0x4694fd);}})[_0xa05b('0x29')](function(_0x1e0f3d){if(_0x1e0f3d){_0x1d78e5=_0x1e0f3d[_0xa05b('0x48')];if(!_0x5a0c8f['query'][_0xa05b('0x56')](_0xa05b('0x3a'))){_0x4694fd['limit']=qs[_0xa05b('0x23')](_0x5a0c8f[_0xa05b('0x34')][_0xa05b('0x23')]);_0x4694fd[_0xa05b('0x20')]=qs['offset'](_0x5a0c8f[_0xa05b('0x34')]['offset']);}return _0xc9009['getAgents'](_0x4694fd);}})['then'](function(_0x33d091){if(_0x33d091){return _0x33d091?{'count':_0x1d78e5,'rows':_0x33d091}:null;}})['then'](respondWithResult(_0x3fe18a,null))[_0xa05b('0x46')](handleError(_0x3fe18a,null));}; \ No newline at end of file +var _0x8b30=['TeamId','includes','all','union','compact','value','transaction','isEmpty','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','hasOwnProperty','addTeams','Team','Agents','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString'];(function(_0x235e52,_0x5293b0){var _0xa089f9=function(_0x5b2466){while(--_0x5b2466){_0x235e52['push'](_0x235e52['shift']());}};_0xa089f9(++_0x5293b0);}(_0x8b30,0x1c7));var _0x08b3=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x8b30[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0x08b3('0x0'));var rimraf=require(_0x08b3('0x1'));var zipdir=require(_0x08b3('0x2'));var jsonpatch=require(_0x08b3('0x3'));var rp=require(_0x08b3('0x4'));var moment=require(_0x08b3('0x5'));var BPromise=require(_0x08b3('0x6'));var Mustache=require(_0x08b3('0x7'));var util=require(_0x08b3('0x8'));var path=require(_0x08b3('0x9'));var sox=require(_0x08b3('0xa'));var csv=require(_0x08b3('0xb'));var ejs=require(_0x08b3('0xc'));var fs=require('fs');var fs_extra=require(_0x08b3('0xd'));var _=require('lodash');var squel=require(_0x08b3('0xe'));var crypto=require(_0x08b3('0xf'));var jsforce=require(_0x08b3('0x10'));var deskjs=require(_0x08b3('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x08b3('0x12'));var Redis=require(_0x08b3('0x13'));var authService=require(_0x08b3('0x14'));var qs=require(_0x08b3('0x15'));var as=require(_0x08b3('0x16'));var hardwareService=require(_0x08b3('0x17'));var logger=require(_0x08b3('0x18'))('api');var utils=require(_0x08b3('0x19'));var config=require(_0x08b3('0x1a'));var licenseUtil=require(_0x08b3('0x1b'));var db=require('../../mysqldb')['db'];config[_0x08b3('0x1c')]=_[_0x08b3('0x1d')](config[_0x08b3('0x1c')],{'host':_0x08b3('0x1e'),'port':0x18eb});var socket=require(_0x08b3('0x1f'))(new Redis(config[_0x08b3('0x1c')]));require('./mailQueue.socket')[_0x08b3('0x20')](socket);function respondWithStatusCode(_0x33789b,_0x383e85){_0x383e85=_0x383e85||0xcc;return function(_0x241a78){if(_0x241a78){return _0x33789b['sendStatus'](_0x383e85);}return _0x33789b['status'](_0x383e85)[_0x08b3('0x21')]();};}function respondWithResult(_0x757469,_0x15e4c7){_0x15e4c7=_0x15e4c7||0xc8;return function(_0xe12877){if(_0xe12877){return _0x757469[_0x08b3('0x22')](_0x15e4c7)[_0x08b3('0x23')](_0xe12877);}};}function respondWithFilteredResult(_0x46cd25,_0x2fe7cc){return function(_0x533ff0){if(_0x533ff0){var _0x2e7a56=typeof _0x2fe7cc[_0x08b3('0x24')]===_0x08b3('0x25')&&typeof _0x2fe7cc[_0x08b3('0x26')]===_0x08b3('0x25');var _0x3b3053=_0x533ff0[_0x08b3('0x27')];var _0x1ae857=_0x2e7a56?0x0:_0x2fe7cc[_0x08b3('0x24')];var _0x5c5704=_0x2e7a56?_0x533ff0[_0x08b3('0x27')]:_0x2fe7cc['offset']+_0x2fe7cc['limit'];var _0x41a850;if(_0x5c5704>=_0x3b3053){_0x5c5704=_0x3b3053;_0x41a850=0xc8;}else{_0x41a850=0xce;}_0x46cd25[_0x08b3('0x22')](_0x41a850);return _0x46cd25['set']('Content-Range',_0x1ae857+'-'+_0x5c5704+'/'+_0x3b3053)['json'](_0x533ff0);}return null;};}function patchUpdates(_0x464c23){return function(_0x2407b5){try{jsonpatch[_0x08b3('0x28')](_0x2407b5,_0x464c23,!![]);}catch(_0xa8e0fc){return BPromise[_0x08b3('0x29')](_0xa8e0fc);}return _0x2407b5[_0x08b3('0x2a')]();};}function saveUpdates(_0x155fd7,_0x15e584){return function(_0x33e94d){if(_0x33e94d){return _0x33e94d[_0x08b3('0x2b')](_0x155fd7)[_0x08b3('0x2c')](function(_0x1c11da){return _0x1c11da;});}return null;};}function removeEntity(_0x71718d,_0x13d9c5){return function(_0x73b6a){if(_0x73b6a){return _0x73b6a[_0x08b3('0x2d')]()[_0x08b3('0x2c')](function(){var _0x2db265=_0x73b6a[_0x08b3('0x2e')]({'plain':!![]});var _0x478cc2=_0x08b3('0x2f');return db[_0x08b3('0x30')][_0x08b3('0x2d')]({'where':{'type':_0x478cc2,'resourceId':_0x2db265['id']}})['then'](function(){return _0x73b6a;});})[_0x08b3('0x2c')](function(){_0x71718d[_0x08b3('0x22')](0xcc)[_0x08b3('0x21')]();});}};}function handleEntityNotFound(_0x360ed4,_0x5dc81a){return function(_0x21bd28){if(!_0x21bd28){_0x360ed4[_0x08b3('0x31')](0x194);}return _0x21bd28;};}function handleError(_0x331fc4,_0x43dc44){_0x43dc44=_0x43dc44||0x1f4;return function(_0x4e2732){logger[_0x08b3('0x32')](_0x4e2732[_0x08b3('0x33')]);if(_0x4e2732[_0x08b3('0x34')]){delete _0x4e2732['name'];}_0x331fc4['status'](_0x43dc44)[_0x08b3('0x35')](_0x4e2732);};}exports[_0x08b3('0x36')]=function(_0x408f9a,_0x5189d9){var _0x39941c={},_0x34f528={},_0x4bb25f={'count':0x0,'rows':[]};var _0x53d687=_[_0x08b3('0x37')](db['MailQueue'][_0x08b3('0x38')],function(_0x2624ed){return{'name':_0x2624ed[_0x08b3('0x39')],'type':_0x2624ed[_0x08b3('0x3a')][_0x08b3('0x3b')]};});_0x34f528[_0x08b3('0x3c')]=_[_0x08b3('0x37')](_0x53d687,_0x08b3('0x34'));_0x34f528[_0x08b3('0x3d')]=_['keys'](_0x408f9a['query']);_0x34f528[_0x08b3('0x3e')]=_[_0x08b3('0x3f')](_0x34f528[_0x08b3('0x3c')],_0x34f528[_0x08b3('0x3d')]);_0x39941c[_0x08b3('0x40')]=_[_0x08b3('0x3f')](_0x34f528[_0x08b3('0x3c')],qs['fields'](_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x41')]));_0x39941c[_0x08b3('0x40')]=_0x39941c[_0x08b3('0x40')][_0x08b3('0x42')]?_0x39941c[_0x08b3('0x40')]:_0x34f528[_0x08b3('0x3c')];if(!_0x408f9a[_0x08b3('0x3d')]['hasOwnProperty'](_0x08b3('0x43'))){_0x39941c[_0x08b3('0x26')]=qs['limit'](_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x26')]);_0x39941c['offset']=qs[_0x08b3('0x24')](_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x24')]);}_0x39941c[_0x08b3('0x44')]=qs[_0x08b3('0x45')](_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x45')]);_0x39941c[_0x08b3('0x46')]=qs['filters'](_[_0x08b3('0x47')](_0x408f9a[_0x08b3('0x3d')],_0x34f528[_0x08b3('0x3e')]),_0x53d687);if(_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x48')]){_0x39941c[_0x08b3('0x46')]=_[_0x08b3('0x49')](_0x39941c[_0x08b3('0x46')],{'$or':_[_0x08b3('0x37')](_0x53d687,function(_0x1350be){if(_0x1350be['type']!==_0x08b3('0x4a')){var _0x5c943c={};_0x5c943c[_0x1350be[_0x08b3('0x34')]]={'$like':'%'+_0x408f9a['query']['filter']+'%'};return _0x5c943c;}})});}_0x39941c=_[_0x08b3('0x49')]({},_0x39941c,_0x408f9a[_0x08b3('0x4b')]);var _0x1e10d9={'where':_0x39941c[_0x08b3('0x46')]};return db[_0x08b3('0x4c')][_0x08b3('0x27')](_0x1e10d9)[_0x08b3('0x2c')](function(_0x272af1){_0x4bb25f[_0x08b3('0x27')]=_0x272af1;if(_0x408f9a[_0x08b3('0x3d')][_0x08b3('0x4d')]){_0x39941c['include']=[{'all':!![]}];}return db[_0x08b3('0x4c')][_0x08b3('0x4e')](_0x39941c);})[_0x08b3('0x2c')](function(_0x2847fa){_0x4bb25f[_0x08b3('0x4f')]=_0x2847fa;return _0x4bb25f;})[_0x08b3('0x2c')](respondWithFilteredResult(_0x5189d9,_0x39941c))[_0x08b3('0x50')](handleError(_0x5189d9,null));};exports[_0x08b3('0x51')]=function(_0x187040,_0x16303e){var _0x2402ae={'raw':!![],'where':{'id':_0x187040[_0x08b3('0x52')]['id']}},_0x35a3fc={};_0x35a3fc[_0x08b3('0x3c')]=_[_0x08b3('0x53')](db[_0x08b3('0x4c')]['rawAttributes']);_0x35a3fc['query']=_[_0x08b3('0x53')](_0x187040[_0x08b3('0x3d')]);_0x35a3fc[_0x08b3('0x3e')]=_['intersection'](_0x35a3fc[_0x08b3('0x3c')],_0x35a3fc[_0x08b3('0x3d')]);_0x2402ae[_0x08b3('0x40')]=_[_0x08b3('0x3f')](_0x35a3fc[_0x08b3('0x3c')],qs[_0x08b3('0x41')](_0x187040[_0x08b3('0x3d')]['fields']));_0x2402ae['attributes']=_0x2402ae[_0x08b3('0x40')][_0x08b3('0x42')]?_0x2402ae[_0x08b3('0x40')]:_0x35a3fc[_0x08b3('0x3c')];if(_0x187040['query'][_0x08b3('0x4d')]){_0x2402ae[_0x08b3('0x54')]=[{'all':!![]}];}_0x2402ae=_[_0x08b3('0x49')]({},_0x2402ae,_0x187040[_0x08b3('0x4b')]);return db[_0x08b3('0x4c')][_0x08b3('0x55')](_0x2402ae)[_0x08b3('0x2c')](handleEntityNotFound(_0x16303e,null))[_0x08b3('0x2c')](respondWithResult(_0x16303e,null))[_0x08b3('0x50')](handleError(_0x16303e,null));};exports[_0x08b3('0x56')]=function(_0x4df33f,_0x463572){return db['MailQueue'][_0x08b3('0x56')](_0x4df33f[_0x08b3('0x57')],{})[_0x08b3('0x2c')](function(_0x41cecf){var _0x19cc34=_0x4df33f[_0x08b3('0x58')][_0x08b3('0x2e')]({'plain':!![]});if(!_0x19cc34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19cc34[_0x08b3('0x59')]===_0x08b3('0x58')){var _0x253e6f=_0x41cecf['get']({'plain':!![]});var _0x1282c5=_0x08b3('0x2f');return db[_0x08b3('0x5a')][_0x08b3('0x55')]({'where':{'name':_0x1282c5,'userProfileId':_0x19cc34[_0x08b3('0x5b')]},'raw':!![]})[_0x08b3('0x2c')](function(_0x54044d){if(_0x54044d&&_0x54044d[_0x08b3('0x5c')]===0x0){return db[_0x08b3('0x30')][_0x08b3('0x56')]({'name':_0x253e6f[_0x08b3('0x34')],'resourceId':_0x253e6f['id'],'type':_0x54044d[_0x08b3('0x34')],'sectionId':_0x54044d['id']},{})['then'](function(){return _0x41cecf;});}else{return _0x41cecf;}})[_0x08b3('0x50')](function(_0x15d4cf){logger[_0x08b3('0x32')](_0x08b3('0x5d'),_0x15d4cf);throw _0x15d4cf;});}return _0x41cecf;})[_0x08b3('0x2c')](respondWithResult(_0x463572,0xc9))[_0x08b3('0x50')](handleError(_0x463572,null));};exports[_0x08b3('0x2b')]=function(_0x4582a9,_0x1e0929){if(_0x4582a9['body']['id']){delete _0x4582a9['body']['id'];}return db[_0x08b3('0x4c')][_0x08b3('0x55')]({'where':{'id':_0x4582a9[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x1e0929,null))[_0x08b3('0x2c')](saveUpdates(_0x4582a9[_0x08b3('0x57')],null))[_0x08b3('0x2c')](respondWithResult(_0x1e0929,null))[_0x08b3('0x50')](handleError(_0x1e0929,null));};exports[_0x08b3('0x2d')]=function(_0x6b847d,_0x47e85a){return db[_0x08b3('0x4c')][_0x08b3('0x55')]({'where':{'id':_0x6b847d[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x47e85a,null))[_0x08b3('0x2c')](removeEntity(_0x47e85a,null))[_0x08b3('0x50')](handleError(_0x47e85a,null));};exports['describe']=function(_0x2a3ae5,_0x3678d5){return db['MailQueue'][_0x08b3('0x5e')]()['then'](respondWithResult(_0x3678d5,null))[_0x08b3('0x50')](handleError(_0x3678d5,null));};exports[_0x08b3('0x5f')]=function(_0x1eccf5,_0x58fb3e,_0x226af1){var _0x3b53c8={'raw':!![],'where':{}},_0xed9581={},_0x9f68df;return db[_0x08b3('0x4c')][_0x08b3('0x60')]({'where':{'id':_0x1eccf5[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x58fb3e,null))[_0x08b3('0x2c')](function(_0xf40873){if(_0xf40873){_0x9f68df=_0xf40873[_0x08b3('0x2e')]({'plain':!![]});_0xed9581['model']=_[_0x08b3('0x53')](db['UserMailQueue']['rawAttributes']);_0xed9581[_0x08b3('0x3d')]=_['keys'](_0x1eccf5[_0x08b3('0x3d')]);_0xed9581['filters']=_['intersection'](_0xed9581[_0x08b3('0x3c')],_0xed9581[_0x08b3('0x3d')]);_0x3b53c8['attributes']=_[_0x08b3('0x3f')](_0xed9581[_0x08b3('0x3c')],qs[_0x08b3('0x41')](_0x1eccf5[_0x08b3('0x3d')][_0x08b3('0x41')]));_0x3b53c8[_0x08b3('0x40')]=_0x3b53c8[_0x08b3('0x40')][_0x08b3('0x42')]?_0x3b53c8['attributes']:_0xed9581['model'];if(!_0x1eccf5[_0x08b3('0x3d')]['hasOwnProperty'](_0x08b3('0x43'))){_0x3b53c8[_0x08b3('0x26')]=qs[_0x08b3('0x26')](_0x1eccf5[_0x08b3('0x3d')]['limit']);_0x3b53c8[_0x08b3('0x24')]=qs[_0x08b3('0x24')](_0x1eccf5['query'][_0x08b3('0x24')]);}_0x3b53c8['order']=qs[_0x08b3('0x45')](_0x1eccf5['query'][_0x08b3('0x45')]);_0x3b53c8[_0x08b3('0x46')]=qs[_0x08b3('0x3e')](_['pick'](_0x1eccf5[_0x08b3('0x3d')],_0xed9581[_0x08b3('0x3e')]));_0x3b53c8['where'][_0x08b3('0x61')]=_0xf40873['id'];if(_0x1eccf5[_0x08b3('0x3d')][_0x08b3('0x48')]){_0x3b53c8[_0x08b3('0x46')]=_[_0x08b3('0x49')](_0x3b53c8[_0x08b3('0x46')],{'$or':_[_0x08b3('0x37')](_0x3b53c8[_0x08b3('0x40')],function(_0x36c87b){var _0x28def8={};_0x28def8[_0x36c87b]={'$like':'%'+_0x1eccf5[_0x08b3('0x3d')][_0x08b3('0x48')]+'%'};return _0x28def8;})});}_0x3b53c8=_['merge']({},_0x3b53c8,_0x1eccf5[_0x08b3('0x4b')]);return db[_0x08b3('0x62')][_0x08b3('0x4e')](_0x3b53c8);}})[_0x08b3('0x2c')](function(_0x1999a5){if(_0x1999a5){return db[_0x08b3('0x63')]['findAndCountAll']({'where':{'id':_[_0x08b3('0x37')](_0x1999a5,_0x08b3('0x64')),'role':_0x08b3('0x65')},'attributes':['id',_0x08b3('0x34'),'mailPause',_0x08b3('0x66'),_0x08b3('0x67')]});}})[_0x08b3('0x2c')](function(_0x5f4922){if(_0x5f4922){return{'count':_0x5f4922[_0x08b3('0x27')],'rows':_['map'](_0x5f4922[_0x08b3('0x4f')],function(_0x5bb5bf){return{'membername':_0x5bb5bf[_0x08b3('0x34')],'UserId':_0x5bb5bf['id'],'queue_name':_0x9f68df['name'],'MailQueueId':_0x9f68df['id'],'interface':util['format'](_0x08b3('0x68'),_0x08b3('0x69'),_0x5bb5bf[_0x08b3('0x34')]),'penalty':0x0,'paused':_0x5bb5bf[_0x08b3('0x6a')],'createdAt':_0x5bb5bf[_0x08b3('0x67')],'updatedAt':_0x5bb5bf[_0x08b3('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x08b3('0x2c')](respondWithFilteredResult(_0x58fb3e,_0x3b53c8))[_0x08b3('0x50')](handleError(_0x58fb3e,null));};exports[_0x08b3('0x6b')]=function(_0x4d7453,_0x28fbb7,_0x1acab2){var _0x358bb5={};var _0x145289={};var _0x5e9933;var _0x1eb86a;return db[_0x08b3('0x4c')][_0x08b3('0x60')]({'where':{'id':_0x4d7453[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x28fbb7,null))['then'](function(_0xba5dbe){if(_0xba5dbe){_0x5e9933=_0xba5dbe;_0x145289[_0x08b3('0x3c')]=_[_0x08b3('0x53')](db['Team'][_0x08b3('0x38')]);_0x145289[_0x08b3('0x3d')]=_[_0x08b3('0x53')](_0x4d7453[_0x08b3('0x3d')]);_0x145289[_0x08b3('0x3e')]=_['intersection'](_0x145289[_0x08b3('0x3c')],_0x145289[_0x08b3('0x3d')]);_0x358bb5[_0x08b3('0x40')]=_[_0x08b3('0x3f')](_0x145289['model'],qs[_0x08b3('0x41')](_0x4d7453[_0x08b3('0x3d')][_0x08b3('0x41')]));_0x358bb5[_0x08b3('0x40')]=_0x358bb5[_0x08b3('0x40')][_0x08b3('0x42')]?_0x358bb5['attributes']:_0x145289[_0x08b3('0x3c')];_0x358bb5[_0x08b3('0x44')]=qs[_0x08b3('0x45')](_0x4d7453[_0x08b3('0x3d')][_0x08b3('0x45')]);_0x358bb5[_0x08b3('0x46')]=qs[_0x08b3('0x3e')](_[_0x08b3('0x47')](_0x4d7453[_0x08b3('0x3d')],_0x145289[_0x08b3('0x3e')]));if(_0x4d7453[_0x08b3('0x3d')]['filter']){_0x358bb5['where']=_[_0x08b3('0x49')](_0x358bb5[_0x08b3('0x46')],{'$or':_['map'](_0x358bb5[_0x08b3('0x40')],function(_0x38335b){var _0x29a553={};_0x29a553[_0x38335b]={'$like':'%'+_0x4d7453[_0x08b3('0x3d')][_0x08b3('0x48')]+'%'};return _0x29a553;})});}_0x358bb5=_[_0x08b3('0x49')]({},_0x358bb5,_0x4d7453[_0x08b3('0x4b')]);return _0x5e9933[_0x08b3('0x6b')](_0x358bb5);}})['then'](function(_0xe55d5d){if(_0xe55d5d){_0x1eb86a=_0xe55d5d[_0x08b3('0x42')];if(!_0x4d7453[_0x08b3('0x3d')][_0x08b3('0x6c')]('nolimit')){_0x358bb5[_0x08b3('0x26')]=qs[_0x08b3('0x26')](_0x4d7453[_0x08b3('0x3d')][_0x08b3('0x26')]);_0x358bb5[_0x08b3('0x24')]=qs[_0x08b3('0x24')](_0x4d7453['query'][_0x08b3('0x24')]);}return _0x5e9933[_0x08b3('0x6b')](_0x358bb5);}})['then'](function(_0x3fabdd){if(_0x3fabdd){return _0x3fabdd?{'count':_0x1eb86a,'rows':_0x3fabdd}:null;}})[_0x08b3('0x2c')](respondWithResult(_0x28fbb7,null))[_0x08b3('0x50')](handleError(_0x28fbb7,null));};exports[_0x08b3('0x6d')]=function(_0xeaf2e4,_0x6c7674,_0x1a80af){var _0x317fc3=_0xeaf2e4[_0x08b3('0x57')]['ids'];return db[_0x08b3('0x6e')][_0x08b3('0x4e')]({'where':{'id':_0x317fc3},'attributes':['id'],'include':[{'model':db[_0x08b3('0x63')],'as':_0x08b3('0x6f'),'attributes':['id',_0x08b3('0x34'),'online',_0x08b3('0x70'),_0x08b3('0x71')],'raw':!![]}]})[_0x08b3('0x2c')](function(_0x32a4e3){if(_0x32a4e3){var _0x59da3d=_[_0x08b3('0x72')](_0x32a4e3,function(_0x1db13d){var _0x519bd1=_0x1db13d[_0x08b3('0x2e')]({'plain':!![]});return _0x519bd1['Agents'];});return db[_0x08b3('0x4c')][_0x08b3('0x55')]({'where':{'id':_0xeaf2e4['params']['id']}})[_0x08b3('0x2c')](function(_0x5f1e7b){return db['sequelize']['transaction'](function(_0x544504){return _0x5f1e7b[_0x08b3('0x6d')](_0x317fc3,{'transaction':_0x544504})[_0x08b3('0x2c')](function(){return BPromise[_0x08b3('0x73')](_0x59da3d,function(_0x4de3ad){return db[_0x08b3('0x62')][_0x08b3('0x74')]({'where':{'UserId':_0x4de3ad['id'],'MailQueueId':_0xeaf2e4[_0x08b3('0x52')]['id']},'transaction':_0x544504});});})[_0x08b3('0x2c')](function(){_0x59da3d[_0x08b3('0x75')](function(_0x1fe17e){socket[_0x08b3('0x76')](_0x08b3('0x77'),{'UserId':_0x1fe17e['id'],'MailQueueId':_0x5f1e7b['id']});});});});});}})['then'](respondWithStatusCode(_0x6c7674,null))['catch'](handleError(_0x6c7674,null));};exports[_0x08b3('0x78')]=function(_0x1dd4ee,_0x4d3925,_0x5edf04){return db[_0x08b3('0x6e')]['findAll']({'where':{'id':_0x1dd4ee[_0x08b3('0x3d')][_0x08b3('0x79')]},'attributes':['id'],'include':[{'model':db[_0x08b3('0x63')],'as':_0x08b3('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x08b3('0x2c')](handleEntityNotFound(_0x4d3925,null))[_0x08b3('0x2c')](function(_0x3e1be6){var _0x2045c7=_['map'](_0x3e1be6,'id');var _0x23e3f9=[];var _0x5b3433=[];var _0x266c48=squel['select']();_0x266c48[_0x08b3('0x7a')]('tq.TeamId')[_0x08b3('0x7b')](_0x08b3('0x7c'),'tq')[_0x08b3('0x7d')](_0x08b3('0x7e'),'ut',_0x08b3('0x7f'))['where'](_0x08b3('0x80'),_0x1dd4ee[_0x08b3('0x52')]['id']);for(var _0x3ed493=0x0;_0x3ed493<_0x3e1be6[_0x08b3('0x42')];_0x3ed493+=0x1){let _0x132cc9=_0x3e1be6[_0x3ed493];for(var _0x125ed4=0x0;_0x125ed4<_0x132cc9[_0x08b3('0x6f')]['length'];_0x125ed4+=0x1){let _0x4c5fd0=_0x132cc9[_0x08b3('0x6f')][_0x125ed4];var _0xe1c996=_0x266c48[_0x08b3('0x81')]();_0xe1c996['where'](_0x08b3('0x82'),_0x4c5fd0['id']);_0x5b3433[_0x08b3('0x83')](db['sequelize'][_0x08b3('0x3d')](_0xe1c996[_0x08b3('0x84')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x08b3('0x2c')](function(_0x45081e){if(_0x45081e['length']===0x1){return _0x4c5fd0['id'];}else{var _0x304b58=_['every'](_[_0x08b3('0x37')](_0x45081e,_0x08b3('0x85')),function(_0x206d67){return _[_0x08b3('0x86')](_0x2045c7,_0x206d67);});if(_0x304b58){return _0x4c5fd0['id'];}}}));}}return BPromise[_0x08b3('0x87')](_0x5b3433)[_0x08b3('0x2c')](function(_0x245136){_0x23e3f9=_(_0x23e3f9)[_0x08b3('0x88')](_0x245136)[_0x08b3('0x89')]()[_0x08b3('0x8a')]();return db[_0x08b3('0x4c')][_0x08b3('0x55')]({'where':{'id':_0x1dd4ee[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](function(_0x1338f2){return db['sequelize'][_0x08b3('0x8b')](function(_0x8d6f52){return _0x1338f2['removeTeams'](_0x1dd4ee['query'][_0x08b3('0x79')],{'transaction':_0x8d6f52})[_0x08b3('0x2c')](function(){if(!_[_0x08b3('0x8c')](_0x23e3f9)){return _0x1338f2['removeAgents'](_0x23e3f9,{'transaction':_0x8d6f52});}})[_0x08b3('0x2c')](function(){_0x23e3f9[_0x08b3('0x75')](function(_0x227ea3){socket['emit'](_0x08b3('0x8d'),{'UserId':_0x227ea3,'MailQueueId':_0x1338f2['id']});});});});});});})[_0x08b3('0x2c')](respondWithStatusCode(_0x4d3925,null))[_0x08b3('0x50')](handleError(_0x4d3925,null));};exports['addAgents']=function(_0x1e62c6,_0x823b19,_0x3b3e2e){return db['MailQueue'][_0x08b3('0x55')]({'where':{'id':_0x1e62c6['params']['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x823b19,null))['then'](function(_0x2748ec){if(_0x2748ec){return _0x2748ec[_0x08b3('0x8e')](_0x1e62c6[_0x08b3('0x57')][_0x08b3('0x79')],_['omit'](_0x1e62c6[_0x08b3('0x57')],[_0x08b3('0x79'),'id'])||{})[_0x08b3('0x8f')](function(_0x50fc9e){for(var _0x456017=0x0;_0x456017<_0x1e62c6['body'][_0x08b3('0x79')]['length'];_0x456017+=0x1){socket[_0x08b3('0x76')]('userMailQueue:save',{'UserId':Number(_0x1e62c6['body'][_0x08b3('0x79')][_0x456017]),'MailQueueId':Number(_0x1e62c6['params']['id'])});}return _0x50fc9e;});}})[_0x08b3('0x2c')](respondWithResult(_0x823b19,null))[_0x08b3('0x50')](handleError(_0x823b19,null));};exports[_0x08b3('0x90')]=function(_0x22990a,_0x3c3741,_0x233951){return db['MailQueue'][_0x08b3('0x55')]({'where':{'id':_0x22990a[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x3c3741,null))[_0x08b3('0x2c')](function(_0x890d0){if(_0x890d0){return _0x890d0[_0x08b3('0x90')](_0x22990a[_0x08b3('0x3d')][_0x08b3('0x79')])[_0x08b3('0x2c')](function(){if(_[_0x08b3('0x91')](_0x22990a['query'][_0x08b3('0x79')])){for(var _0x4eb7b5=0x0;_0x4eb7b5<_0x22990a['query'][_0x08b3('0x79')][_0x08b3('0x42')];_0x4eb7b5+=0x1){socket[_0x08b3('0x76')](_0x08b3('0x8d'),{'UserId':Number(_0x22990a[_0x08b3('0x3d')][_0x08b3('0x79')][_0x4eb7b5]),'MailQueueId':Number(_0x22990a[_0x08b3('0x52')]['id'])});}}else{socket[_0x08b3('0x76')]('userMailQueue:remove',{'UserId':Number(_0x22990a[_0x08b3('0x3d')][_0x08b3('0x79')]),'MailQueueId':Number(_0x22990a[_0x08b3('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c3741,null))[_0x08b3('0x50')](handleError(_0x3c3741,null));};exports[_0x08b3('0x92')]=function(_0x57b225,_0x1f4de0,_0x1035f2){var _0x361309={};var _0x6ad0b7={};var _0x32181b;var _0x3f8dac;return db[_0x08b3('0x4c')][_0x08b3('0x60')]({'where':{'id':_0x57b225[_0x08b3('0x52')]['id']}})[_0x08b3('0x2c')](handleEntityNotFound(_0x1f4de0,null))[_0x08b3('0x2c')](function(_0x74b828){if(_0x74b828){_0x32181b=_0x74b828;_0x6ad0b7[_0x08b3('0x3c')]=_[_0x08b3('0x53')](db[_0x08b3('0x63')]['rawAttributes']);_0x6ad0b7['query']=_[_0x08b3('0x53')](_0x57b225[_0x08b3('0x3d')]);_0x6ad0b7[_0x08b3('0x3e')]=_[_0x08b3('0x3f')](_0x6ad0b7[_0x08b3('0x3c')],_0x6ad0b7[_0x08b3('0x3d')]);_0x361309[_0x08b3('0x40')]=_[_0x08b3('0x3f')](_0x6ad0b7['model'],qs[_0x08b3('0x41')](_0x57b225[_0x08b3('0x3d')][_0x08b3('0x41')]));_0x361309[_0x08b3('0x40')]=_0x361309[_0x08b3('0x40')][_0x08b3('0x42')]?_0x361309[_0x08b3('0x40')]:_0x6ad0b7['model'];_0x361309['order']=qs[_0x08b3('0x45')](_0x57b225[_0x08b3('0x3d')][_0x08b3('0x45')]);_0x361309[_0x08b3('0x46')]=qs[_0x08b3('0x3e')](_['pick'](_0x57b225[_0x08b3('0x3d')],_0x6ad0b7['filters']));if(_0x57b225[_0x08b3('0x3d')][_0x08b3('0x48')]){_0x361309['where']=_[_0x08b3('0x49')](_0x361309[_0x08b3('0x46')],{'$or':_[_0x08b3('0x37')](_0x361309[_0x08b3('0x40')],function(_0x6d0d8a){var _0xbb1d8a={};_0xbb1d8a[_0x6d0d8a]={'$like':'%'+_0x57b225['query'][_0x08b3('0x48')]+'%'};return _0xbb1d8a;})});}_0x361309=_[_0x08b3('0x49')]({},_0x361309,_0x57b225[_0x08b3('0x4b')]);return _0x32181b[_0x08b3('0x92')](_0x361309);}})[_0x08b3('0x2c')](function(_0x3fd9c0){if(_0x3fd9c0){_0x3f8dac=_0x3fd9c0['length'];if(!_0x57b225['query'][_0x08b3('0x6c')](_0x08b3('0x43'))){_0x361309[_0x08b3('0x26')]=qs['limit'](_0x57b225[_0x08b3('0x3d')][_0x08b3('0x26')]);_0x361309[_0x08b3('0x24')]=qs[_0x08b3('0x24')](_0x57b225[_0x08b3('0x3d')]['offset']);}return _0x32181b[_0x08b3('0x92')](_0x361309);}})['then'](function(_0x5c523e){if(_0x5c523e){return _0x5c523e?{'count':_0x3f8dac,'rows':_0x5c523e}:null;}})['then'](respondWithResult(_0x1f4de0,null))[_0x08b3('0x50')](handleError(_0x1f4de0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f3b3742..ef7ea28 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 _0x5e62=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x43e013,_0x15c4c6){var _0x4d214b=function(_0x285ab5){while(--_0x285ab5){_0x43e013['push'](_0x43e013['shift']());}};_0x4d214b(++_0x15c4c6);}(_0x5e62,0x124));var _0x25e6=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x5e62[_0x485b5a];return _0xd2b34d;};'use strict';var EventEmitter=require(_0x25e6('0x0'));var MailQueue=require(_0x25e6('0x1'))['db'][_0x25e6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x25e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x25e6('0x4'),'afterDestroy':_0x25e6('0x5')};function emitEvent(_0x3d12fb){return function(_0x16a308,_0x4f471b,_0x3ecd2a){MailQueueEvents['emit'](_0x3d12fb+':'+_0x16a308['id'],_0x16a308);MailQueueEvents[_0x25e6('0x6')](_0x3d12fb,_0x16a308);_0x3ecd2a(null);};}for(var e in events){if(events[_0x25e6('0x7')](e)){var event=events[e];MailQueue[_0x25e6('0x8')](e,emitEvent(event));}}module[_0x25e6('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x9dd8=['setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x4cdd3a,_0x3d70fc){var _0x1b6da9=function(_0x50451c){while(--_0x50451c){_0x4cdd3a['push'](_0x4cdd3a['shift']());}};_0x1b6da9(++_0x3d70fc);}(_0x9dd8,0xb9));var _0x89dd=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x9dd8[_0x1a7846];return _0x48049;};'use strict';var EventEmitter=require(_0x89dd('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x89dd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x89dd('0x2')};function emitEvent(_0x165510){return function(_0x488369,_0xecc9f9,_0x499e90){MailQueueEvents[_0x89dd('0x3')](_0x165510+':'+_0x488369['id'],_0x488369);MailQueueEvents[_0x89dd('0x3')](_0x165510,_0x488369);_0x499e90(null);};}for(var e in events){if(events[_0x89dd('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x89dd('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 287f36c..3a5fe58 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 _0x7aff=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7aff,0x1a4));var _0xf7af=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7aff[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf7af('0x0'));var util=require(_0xf7af('0x1'));var logger=require(_0xf7af('0x2'))(_0xf7af('0x3'));var moment=require(_0xf7af('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7af('0x5'));var fs=require('fs');var path=require(_0xf7af('0x6'));var rimraf=require(_0xf7af('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7af('0x8'));module[_0xf7af('0x9')]=function(_0x36737a,_0x55878b){return _0x36737a[_0xf7af('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e4=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue'];(function(_0xf2662b,_0x4d8f41){var _0x257dc7=function(_0x46b1d1){while(--_0x46b1d1){_0xf2662b['push'](_0xf2662b['shift']());}};_0x257dc7(++_0x4d8f41);}(_0xc1e4,0x14a));var _0x4c1e=function(_0x8838bb,_0x12c791){_0x8838bb=_0x8838bb-0x0;var _0x451aea=_0xc1e4[_0x8838bb];return _0x451aea;};'use strict';var _=require(_0x4c1e('0x0'));var util=require(_0x4c1e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4c1e('0x2'));var rp=require(_0x4c1e('0x3'));var fs=require('fs');var path=require(_0x4c1e('0x4'));var rimraf=require(_0x4c1e('0x5'));var config=require(_0x4c1e('0x6'));var attributes=require(_0x4c1e('0x7'));module[_0x4c1e('0x8')]=function(_0x1be384,_0x62fb68){return _0x1be384['define'](_0x4c1e('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d2c6c28..7e1031f 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 _0xabbe=['ShowMailQueue','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','find'];(function(_0x3a87b5,_0xdf92e5){var _0x26955a=function(_0x179649){while(--_0x179649){_0x3a87b5['push'](_0x3a87b5['shift']());}};_0x26955a(++_0xdf92e5);}(_0xabbe,0x70));var _0xeabb=function(_0x19e75b,_0x5a58d1){_0x19e75b=_0x19e75b-0x0;var _0x4a29c6=_0xabbe[_0x19e75b];return _0x4a29c6;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var moment=require(_0xeabb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeabb('0x2'));var fs=require('fs');var Redis=require(_0xeabb('0x3'));var db=require(_0xeabb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeabb('0x5'));var config=require(_0xeabb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeabb('0x7')][_0xeabb('0x8')]({'port':0x232a});config['redis']=_[_0xeabb('0x9')](config[_0xeabb('0xa')],{'host':_0xeabb('0xb'),'port':0x18eb});var socket=require(_0xeabb('0xc'))(new Redis(config[_0xeabb('0xa')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x355f3c,_0x3cc959,_0x35fc70){return new BPromise(function(_0x4b5ca1,_0x11747f){return client[_0xeabb('0xd')](_0x355f3c,_0x35fc70)[_0xeabb('0xe')](function(_0x2e4ad4){logger[_0xeabb('0xf')](_0xeabb('0x10'),_0x3cc959,'request\x20sent');logger[_0xeabb('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3cc959,_0xeabb('0x12'),JSON[_0xeabb('0x13')](_0x2e4ad4));if(_0x2e4ad4[_0xeabb('0x14')]){if(_0x2e4ad4[_0xeabb('0x14')][_0xeabb('0x15')]===0x1f4){logger[_0xeabb('0x14')](_0xeabb('0x10'),_0x3cc959,_0x2e4ad4['error'][_0xeabb('0x16')]);return _0x11747f(_0x2e4ad4['error'][_0xeabb('0x16')]);}logger['error'](_0xeabb('0x10'),_0x3cc959,_0x2e4ad4[_0xeabb('0x14')][_0xeabb('0x16')]);return _0x4b5ca1(_0x2e4ad4[_0xeabb('0x14')][_0xeabb('0x16')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x3cc959,_0xeabb('0x12'));_0x4b5ca1(_0x2e4ad4[_0xeabb('0x17')][_0xeabb('0x16')]);}})[_0xeabb('0x18')](function(_0x2388de){logger[_0xeabb('0x14')]('MailQueue,\x20%s,\x20%s',_0x3cc959,_0x2388de);_0x11747f(_0x2388de);});});}exports[_0xeabb('0x19')]=function(_0x3fd4de){var _0x51c385=this;return new Promise(function(_0x3ffff1,_0x1e6704){return db[_0xeabb('0x1a')][_0xeabb('0x1b')]({'raw':_0x3fd4de[_0xeabb('0x1c')]?_0x3fd4de['options'][_0xeabb('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fd4de[_0xeabb('0x1c')]?_0x3fd4de[_0xeabb('0x1c')][_0xeabb('0x1e')]||null:null,'attributes':_0x3fd4de[_0xeabb('0x1c')]?_0x3fd4de[_0xeabb('0x1c')][_0xeabb('0x1f')]||null:null,'limit':_0x3fd4de[_0xeabb('0x1c')]?_0x3fd4de[_0xeabb('0x1c')]['limit']||null:null,'include':_0x3fd4de['options']?_0x3fd4de[_0xeabb('0x1c')][_0xeabb('0x20')]?_[_0xeabb('0x21')](_0x3fd4de[_0xeabb('0x1c')][_0xeabb('0x20')],function(_0x403b93){return{'model':db[_0x403b93[_0xeabb('0x22')]],'as':_0x403b93['as'],'attributes':_0x403b93[_0xeabb('0x1f')],'include':_0x403b93[_0xeabb('0x20')]?_['map'](_0x403b93['include'],function(_0x4834c3){return{'model':db[_0x4834c3['model']],'as':_0x4834c3['as'],'attributes':_0x4834c3['attributes'],'include':_0x4834c3[_0xeabb('0x20')]?_[_0xeabb('0x21')](_0x4834c3['include'],function(_0x443846){return{'model':db[_0x443846['model']],'as':_0x443846['as'],'attributes':_0x443846[_0xeabb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeabb('0xe')](function(_0x316fbd){logger[_0xeabb('0xf')](_0xeabb('0x19'),_0x3fd4de);logger[_0xeabb('0x11')](_0xeabb('0x19'),_0x3fd4de,JSON[_0xeabb('0x13')](_0x316fbd));_0x3ffff1(_0x316fbd);})[_0xeabb('0x18')](function(_0x5449dd){logger[_0xeabb('0x14')](_0xeabb('0x19'),_0x5449dd[_0xeabb('0x16')],_0x3fd4de);_0x1e6704(_0x51c385[_0xeabb('0x14')](0x1f4,_0x5449dd[_0xeabb('0x16')]));});});};exports['ShowMailQueue']=function(_0x34f263){var _0x37a214=this;return new Promise(function(_0x1a4fec,_0xa1f965){return db[_0xeabb('0x1a')][_0xeabb('0x23')]({'raw':_0x34f263['options']?_0x34f263[_0xeabb('0x1c')][_0xeabb('0x1d')]===undefined?!![]:![]:!![],'where':_0x34f263[_0xeabb('0x1c')]?_0x34f263['options'][_0xeabb('0x1e')]||null:null,'attributes':_0x34f263[_0xeabb('0x1c')]?_0x34f263[_0xeabb('0x1c')][_0xeabb('0x1f')]||null:null,'include':_0x34f263[_0xeabb('0x1c')]?_0x34f263[_0xeabb('0x1c')][_0xeabb('0x20')]?_['map'](_0x34f263[_0xeabb('0x1c')][_0xeabb('0x20')],function(_0x4a0e04){return{'model':db[_0x4a0e04[_0xeabb('0x22')]],'as':_0x4a0e04['as'],'attributes':_0x4a0e04[_0xeabb('0x1f')],'include':_0x4a0e04[_0xeabb('0x20')]?_[_0xeabb('0x21')](_0x4a0e04['include'],function(_0x46d3df){return{'model':db[_0x46d3df['model']],'as':_0x46d3df['as'],'attributes':_0x46d3df[_0xeabb('0x1f')],'include':_0x46d3df[_0xeabb('0x20')]?_[_0xeabb('0x21')](_0x46d3df['include'],function(_0x210a8d){return{'model':db[_0x210a8d[_0xeabb('0x22')]],'as':_0x210a8d['as'],'attributes':_0x210a8d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e5a93){logger[_0xeabb('0xf')](_0xeabb('0x24'),_0x34f263);logger[_0xeabb('0x11')](_0xeabb('0x24'),_0x34f263,JSON[_0xeabb('0x13')](_0x2e5a93));_0x1a4fec(_0x2e5a93);})[_0xeabb('0x18')](function(_0x40e47f){logger[_0xeabb('0x14')](_0xeabb('0x24'),_0x40e47f[_0xeabb('0x16')],_0x34f263);_0xa1f965(_0x37a214['error'](0x1f4,_0x40e47f[_0xeabb('0x16')]));});});}; \ No newline at end of file +var _0x4c72=['error','code','message','result','options','raw','where','limit','include','map','model','attributes','GetMailQueue','ShowMailQueue','MailQueue','find','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x4c72,0x179));var _0x24c7=function(_0x5f2dea,_0x136d7f){_0x5f2dea=_0x5f2dea-0x0;var _0x3724f7=_0x4c72[_0x5f2dea];return _0x3724f7;};'use strict';var _=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var moment=require(_0x24c7('0x2'));var BPromise=require(_0x24c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24c7('0x4'))['db'];var utils=require(_0x24c7('0x5'));var logger=require(_0x24c7('0x6'))(_0x24c7('0x7'));var config=require(_0x24c7('0x8'));var jayson=require(_0x24c7('0x9'));var client=jayson['client'][_0x24c7('0xa')]({'port':0x232a});config['redis']=_[_0x24c7('0xb')](config['redis'],{'host':_0x24c7('0xc'),'port':0x18eb});var socket=require(_0x24c7('0xd'))(new Redis(config[_0x24c7('0xe')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x35e7d4,_0x21f971,_0x2926c5){return new BPromise(function(_0x4f6711,_0xa1d967){return client[_0x24c7('0xf')](_0x35e7d4,_0x2926c5)[_0x24c7('0x10')](function(_0x5edb33){logger[_0x24c7('0x11')](_0x24c7('0x12'),_0x21f971,_0x24c7('0x13'));logger[_0x24c7('0x14')](_0x24c7('0x15'),_0x21f971,_0x24c7('0x13'),JSON[_0x24c7('0x16')](_0x5edb33));if(_0x5edb33[_0x24c7('0x17')]){if(_0x5edb33['error'][_0x24c7('0x18')]===0x1f4){logger[_0x24c7('0x17')](_0x24c7('0x12'),_0x21f971,_0x5edb33[_0x24c7('0x17')][_0x24c7('0x19')]);return _0xa1d967(_0x5edb33[_0x24c7('0x17')][_0x24c7('0x19')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x21f971,_0x5edb33[_0x24c7('0x17')][_0x24c7('0x19')]);return _0x4f6711(_0x5edb33['error'][_0x24c7('0x19')]);}else{logger[_0x24c7('0x11')](_0x24c7('0x12'),_0x21f971,'request\x20sent');_0x4f6711(_0x5edb33[_0x24c7('0x1a')][_0x24c7('0x19')]);}})['catch'](function(_0x4b7194){logger[_0x24c7('0x17')](_0x24c7('0x12'),_0x21f971,_0x4b7194);_0xa1d967(_0x4b7194);});});}exports['GetMailQueue']=function(_0x21cec6){var _0x2fc667=this;return new Promise(function(_0x4f0903,_0x33ccf2){return db['MailQueue']['findAll']({'raw':_0x21cec6[_0x24c7('0x1b')]?_0x21cec6['options'][_0x24c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x21cec6[_0x24c7('0x1b')]?_0x21cec6[_0x24c7('0x1b')][_0x24c7('0x1d')]||null:null,'attributes':_0x21cec6[_0x24c7('0x1b')]?_0x21cec6['options']['attributes']||null:null,'limit':_0x21cec6[_0x24c7('0x1b')]?_0x21cec6[_0x24c7('0x1b')][_0x24c7('0x1e')]||null:null,'include':_0x21cec6[_0x24c7('0x1b')]?_0x21cec6[_0x24c7('0x1b')][_0x24c7('0x1f')]?_[_0x24c7('0x20')](_0x21cec6[_0x24c7('0x1b')][_0x24c7('0x1f')],function(_0x309b06){return{'model':db[_0x309b06[_0x24c7('0x21')]],'as':_0x309b06['as'],'attributes':_0x309b06[_0x24c7('0x22')],'include':_0x309b06[_0x24c7('0x1f')]?_['map'](_0x309b06[_0x24c7('0x1f')],function(_0x5a58f4){return{'model':db[_0x5a58f4[_0x24c7('0x21')]],'as':_0x5a58f4['as'],'attributes':_0x5a58f4[_0x24c7('0x22')],'include':_0x5a58f4[_0x24c7('0x1f')]?_[_0x24c7('0x20')](_0x5a58f4[_0x24c7('0x1f')],function(_0x41d84e){return{'model':db[_0x41d84e[_0x24c7('0x21')]],'as':_0x41d84e['as'],'attributes':_0x41d84e[_0x24c7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x24c7('0x10')](function(_0x161f43){logger[_0x24c7('0x11')](_0x24c7('0x23'),_0x21cec6);logger[_0x24c7('0x14')]('GetMailQueue',_0x21cec6,JSON[_0x24c7('0x16')](_0x161f43));_0x4f0903(_0x161f43);})['catch'](function(_0x44d995){logger[_0x24c7('0x17')](_0x24c7('0x23'),_0x44d995[_0x24c7('0x19')],_0x21cec6);_0x33ccf2(_0x2fc667[_0x24c7('0x17')](0x1f4,_0x44d995[_0x24c7('0x19')]));});});};exports[_0x24c7('0x24')]=function(_0x274e18){var _0x4c25f1=this;return new Promise(function(_0x11c1fe,_0x4186dd){return db[_0x24c7('0x25')][_0x24c7('0x26')]({'raw':_0x274e18[_0x24c7('0x1b')]?_0x274e18[_0x24c7('0x1b')][_0x24c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x274e18[_0x24c7('0x1b')]?_0x274e18[_0x24c7('0x1b')]['where']||null:null,'attributes':_0x274e18['options']?_0x274e18['options'][_0x24c7('0x22')]||null:null,'include':_0x274e18['options']?_0x274e18[_0x24c7('0x1b')][_0x24c7('0x1f')]?_[_0x24c7('0x20')](_0x274e18[_0x24c7('0x1b')][_0x24c7('0x1f')],function(_0x39128d){return{'model':db[_0x39128d[_0x24c7('0x21')]],'as':_0x39128d['as'],'attributes':_0x39128d['attributes'],'include':_0x39128d['include']?_[_0x24c7('0x20')](_0x39128d['include'],function(_0x416542){return{'model':db[_0x416542[_0x24c7('0x21')]],'as':_0x416542['as'],'attributes':_0x416542['attributes'],'include':_0x416542[_0x24c7('0x1f')]?_[_0x24c7('0x20')](_0x416542[_0x24c7('0x1f')],function(_0xd3ae8c){return{'model':db[_0xd3ae8c[_0x24c7('0x21')]],'as':_0xd3ae8c['as'],'attributes':_0xd3ae8c[_0x24c7('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c6af6){logger[_0x24c7('0x11')](_0x24c7('0x24'),_0x274e18);logger['debug'](_0x24c7('0x24'),_0x274e18,JSON['stringify'](_0x1c6af6));_0x11c1fe(_0x1c6af6);})[_0x24c7('0x27')](function(_0x364ec7){logger[_0x24c7('0x17')]('ShowMailQueue',_0x364ec7[_0x24c7('0x19')],_0x274e18);_0x4186dd(_0x4c25f1[_0x24c7('0x17')](0x1f4,_0x364ec7[_0x24c7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index feac499..3fd3a6d 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 _0xccd7=['save','remove','update','emit','./mailQueue.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xccd7,0x185));var _0x7ccd=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xccd7[_0x406115];return _0xbbabdb;};'use strict';var MailQueueEvents=require(_0x7ccd('0x0'));var events=[_0x7ccd('0x1'),_0x7ccd('0x2'),_0x7ccd('0x3')];function createListener(_0x4a89c5,_0x5fc33c){return function(_0x27a82a){_0x5fc33c[_0x7ccd('0x4')](_0x4a89c5,_0x27a82a);};}function removeListener(_0x444498,_0x344a64){return function(){MailQueueEvents['removeListener'](_0x444498,_0x344a64);};}exports['register']=function(_0x165799){for(var _0x5c1788=0x0,_0x34ea24=events['length'];_0x5c1788<_0x34ea24;_0x5c1788++){var _0x22fad7=events[_0x5c1788];var _0x4ac450=createListener('mailQueue:'+_0x22fad7,_0x165799);MailQueueEvents['on'](_0x22fad7,_0x4ac450);}}; \ No newline at end of file +var _0x9cc0=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x1c02c8,_0x37dbfc){var _0x1e5ff8=function(_0x609e92){while(--_0x609e92){_0x1c02c8['push'](_0x1c02c8['shift']());}};_0x1e5ff8(++_0x37dbfc);}(_0x9cc0,0x81));var _0x09cc=function(_0x4d120d,_0x55a2c9){_0x4d120d=_0x4d120d-0x0;var _0x12b156=_0x9cc0[_0x4d120d];return _0x12b156;};'use strict';var MailQueueEvents=require(_0x09cc('0x0'));var events=[_0x09cc('0x1'),_0x09cc('0x2'),_0x09cc('0x3')];function createListener(_0x35e952,_0x2264f8){return function(_0x1d9c3c){_0x2264f8[_0x09cc('0x4')](_0x35e952,_0x1d9c3c);};}function removeListener(_0x447bee,_0x521f79){return function(){MailQueueEvents[_0x09cc('0x5')](_0x447bee,_0x521f79);};}exports[_0x09cc('0x6')]=function(_0x16d6b9){for(var _0xc7fbd1=0x0,_0x58029e=events['length'];_0xc7fbd1<_0x58029e;_0xc7fbd1++){var _0x822d79=events[_0xc7fbd1];var _0x3b1135=createListener(_0x09cc('0x7')+_0x822d79,_0x16d6b9);MailQueueEvents['on'](_0x822d79,_0x3b1135);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 20b08eb..c356f6f 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 _0xd25e=['update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put'];(function(_0x425236,_0x1a3064){var _0x5d0b03=function(_0x3f239a){while(--_0x3f239a){_0x425236['push'](_0x425236['shift']());}};_0x5d0b03(++_0x1a3064);}(_0xd25e,0x191));var _0xed25=function(_0x2d4b7d,_0x374ae5){_0x2d4b7d=_0x2d4b7d-0x0;var _0x106150=_0xd25e[_0x2d4b7d];return _0x106150;};'use strict';var multer=require(_0xed25('0x0'));var util=require(_0xed25('0x1'));var path=require(_0xed25('0x2'));var timeout=require('connect-timeout');var express=require(_0xed25('0x3'));var router=express[_0xed25('0x4')]();var fs_extra=require(_0xed25('0x5'));var auth=require(_0xed25('0x6'));var interaction=require(_0xed25('0x7'));var config=require(_0xed25('0x8'));var controller=require(_0xed25('0x9'));router['get']('/',auth[_0xed25('0xa')](),controller['index']);router[_0xed25('0xb')](_0xed25('0xc'),auth['isAuthenticated'](),controller[_0xed25('0xd')]);router[_0xed25('0xb')](_0xed25('0xe'),auth[_0xed25('0xa')](),controller[_0xed25('0xf')]);router[_0xed25('0x10')]('/',auth[_0xed25('0xa')](),controller[_0xed25('0x11')]);router[_0xed25('0x12')]('/:id',auth[_0xed25('0xa')](),controller[_0xed25('0x13')]);router[_0xed25('0x14')](_0xed25('0xe'),auth[_0xed25('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1ab6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x34eb20,_0x276d5a){var _0x42e34a=function(_0x1b33c9){while(--_0x1b33c9){_0x34eb20['push'](_0x34eb20['shift']());}};_0x42e34a(++_0x276d5a);}(_0x1ab6,0x186));var _0x61ab=function(_0x413fb1,_0x1e9e75){_0x413fb1=_0x413fb1-0x0;var _0x1e9371=_0x1ab6[_0x413fb1];return _0x1e9371;};'use strict';var multer=require(_0x61ab('0x0'));var util=require(_0x61ab('0x1'));var path=require(_0x61ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x61ab('0x3'));var router=express[_0x61ab('0x4')]();var fs_extra=require(_0x61ab('0x5'));var auth=require(_0x61ab('0x6'));var interaction=require(_0x61ab('0x7'));var config=require(_0x61ab('0x8'));var controller=require(_0x61ab('0x9'));router[_0x61ab('0xa')]('/',auth['isAuthenticated'](),controller[_0x61ab('0xb')]);router['get'](_0x61ab('0xc'),auth[_0x61ab('0xd')](),controller[_0x61ab('0xe')]);router[_0x61ab('0xa')](_0x61ab('0xf'),auth[_0x61ab('0xd')](),controller[_0x61ab('0x10')]);router['post']('/',auth[_0x61ab('0xd')](),controller[_0x61ab('0x11')]);router[_0x61ab('0x12')](_0x61ab('0xf'),auth[_0x61ab('0xd')](),controller[_0x61ab('0x13')]);router[_0x61ab('0x14')]('/:id',auth[_0x61ab('0xd')](),controller[_0x61ab('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 51fbd42..a3a54c5 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 _0xe126=['STRING','DATE','sequelize'];(function(_0x3b611f,_0x2e8440){var _0x5e542b=function(_0x35f178){while(--_0x35f178){_0x3b611f['push'](_0x3b611f['shift']());}};_0x5e542b(++_0x2e8440);}(_0xe126,0xf2));var _0x6e12=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe126[_0x4b2436];return _0x4f5ab2;};'use strict';var moment=require('moment');var Sequelize=require(_0x6e12('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6e12('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6e12('0x2')]},'leaveAt':{'type':Sequelize[_0x6e12('0x2')]},'acceptAt':{'type':Sequelize[_0x6e12('0x2')]},'exitAt':{'type':Sequelize[_0x6e12('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x455d=['DATE','exports','STRING'];(function(_0xfd084b,_0x26977e){var _0x375d60=function(_0xfec175){while(--_0xfec175){_0xfd084b['push'](_0xfd084b['shift']());}};_0x375d60(++_0x26977e);}(_0x455d,0x190));var _0xd455=function(_0x37b485,_0x199066){_0x37b485=_0x37b485-0x0;var _0x498e89=_0x455d[_0x37b485];return _0x498e89;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd455('0x0')]={'uniqueid':{'type':Sequelize[_0xd455('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd455('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd455('0x2')]},'acceptAt':{'type':Sequelize[_0xd455('0x2')]},'exitAt':{'type':Sequelize[_0xd455('0x2')]},'reason':{'type':Sequelize[_0xd455('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6b47071..1e1c114 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x2d7bc9,_0x4c4c3b){var _0x28ba8e=function(_0x548080){while(--_0x548080){_0x2d7bc9['push'](_0x2d7bc9['shift']());}};_0x28ba8e(++_0x4c4c3b);}(_0x9582,0x95));var _0x2958=function(_0x3ce8c6,_0x564b9a){_0x3ce8c6=_0x3ce8c6-0x0;var _0x4e26e1=_0x9582[_0x3ce8c6];return _0x4e26e1;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':!![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['MailQueueReport'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','MailQueueReport','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x51e62,_0x57fc9e){var _0x4f1b90=function(_0x186235){while(--_0x186235){_0x51e62['push'](_0x51e62['shift']());}};_0x4f1b90(++_0x57fc9e);}(_0x90b1,0x1bb));var _0x190b=function(_0x101152,_0x397ab0){_0x101152=_0x101152-0x0;var _0xe1c465=_0x90b1[_0x101152];return _0xe1c465;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['MailQueueReport'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['MailQueueReport'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9a69255..c9cc382 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 _0x4bf6=['api','moment','bluebird','request-promise','path','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util'];(function(_0xb0daef,_0xefb45b){var _0x433e97=function(_0x42bf8c){while(--_0x42bf8c){_0xb0daef['push'](_0xb0daef['shift']());}};_0x433e97(++_0xefb45b);}(_0x4bf6,0xcb));var _0x64bf=function(_0x4875b7,_0x242853){_0x4875b7=_0x4875b7-0x0;var _0x38e290=_0x4bf6[_0x4875b7];return _0x38e290;};'use strict';var _=require('lodash');var util=require(_0x64bf('0x0'));var logger=require('../../config/logger')(_0x64bf('0x1'));var moment=require(_0x64bf('0x2'));var BPromise=require(_0x64bf('0x3'));var rp=require(_0x64bf('0x4'));var fs=require('fs');var path=require(_0x64bf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64bf('0x6'));module[_0x64bf('0x7')]=function(_0xc25de3,_0x105526){return _0xc25de3[_0x64bf('0x8')](_0x64bf('0x9'),attributes,{'tableName':_0x64bf('0xa'),'paranoid':![],'indexes':[{'name':_0x64bf('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80ea=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue'];(function(_0x920b69,_0x24d1c8){var _0xeb2bea=function(_0x33fe00){while(--_0x33fe00){_0x920b69['push'](_0x920b69['shift']());}};_0xeb2bea(++_0x24d1c8);}(_0x80ea,0x1cf));var _0xa80e=function(_0x53e87d,_0xa1ad1f){_0x53e87d=_0x53e87d-0x0;var _0x1bb55d=_0x80ea[_0x53e87d];return _0x1bb55d;};'use strict';var _=require(_0xa80e('0x0'));var util=require(_0xa80e('0x1'));var logger=require(_0xa80e('0x2'))(_0xa80e('0x3'));var moment=require(_0xa80e('0x4'));var BPromise=require(_0xa80e('0x5'));var rp=require(_0xa80e('0x6'));var fs=require('fs');var path=require(_0xa80e('0x7'));var rimraf=require(_0xa80e('0x8'));var config=require(_0xa80e('0x9'));var attributes=require(_0xa80e('0xa'));module['exports']=function(_0x5a1c7f,_0x44985b){return _0x5a1c7f['define'](_0xa80e('0xb'),attributes,{'tableName':_0xa80e('0xc'),'paranoid':![],'indexes':[{'name':_0xa80e('0xd'),'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 e683567..7b37d85 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x158495,_0x40907b){var _0x3c0cad=function(_0x2e3ed5){while(--_0x2e3ed5){_0x158495['push'](_0x158495['shift']());}};_0x3c0cad(++_0x40907b);}(_0x7a54,0x106));var _0x47a5=function(_0x543bd1,_0x4c1875){_0x543bd1=_0x543bd1-0x0;var _0x2280c4=_0x7a54[_0x543bd1];return _0x2280c4;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x328718,_0x26e2c2){var _0x2d8f14=function(_0x389f90){while(--_0x389f90){_0x328718['push'](_0x328718['shift']());}};_0x2d8f14(++_0x26e2c2);}(_0xdb28,0x106));var _0x8db2=function(_0x27027e,_0x46875b){_0x27027e=_0x27027e-0x0;var _0xed80ae=_0xdb28[_0x27027e];return _0xed80ae;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c948c76..56afecf 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x213ae6,_0x37be6c){var _0x1b0e06=function(_0x1cda48){while(--_0x1cda48){_0x213ae6['push'](_0x213ae6['shift']());}};_0x1b0e06(++_0x37be6c);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2b3b8e,_0x30949e){var _0x1ae282=function(_0x1673ef){while(--_0x1673ef){_0x2b3b8e['push'](_0x2b3b8e['shift']());}};_0x1ae282(++_0x30949e);}(_0xedd9,0xfc));var _0x9edd=function(_0x1595c1,_0x629d82){_0x1595c1=_0x1595c1-0x0;var _0x58bba3=_0xedd9[_0x1595c1];return _0x58bba3;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 68bc82d..8b059f8 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 _0xf87d=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x91ff52,_0x2cde3c){var _0x37d193=function(_0x5cb450){while(--_0x5cb450){_0x91ff52['push'](_0x91ff52['shift']());}};_0x37d193(++_0x2cde3c);}(_0xf87d,0xc1));var _0xdf87=function(_0x123210,_0x2cca73){_0x123210=_0x123210-0x0;var _0x1e9e00=_0xf87d[_0x123210];return _0x1e9e00;};'use strict';var Sequelize=require(_0xdf87('0x0'));module[_0xdf87('0x1')]={'description':{'type':Sequelize[_0xdf87('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xdf87('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xdf87('0x2')]},'password':{'type':Sequelize[_0xdf87('0x2')]},'port':{'type':Sequelize[_0xdf87('0x4')]},'tls':{'type':Sequelize[_0xdf87('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xdf87('0x2')],'defaultValue':_0xdf87('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xdf87('0x2')]},'modernAuthentication':{'type':Sequelize[_0xdf87('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7c2c=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7c2c,0xaf));var _0xc7c2=function(_0x1e5e31,_0x5a0775){_0x1e5e31=_0x1e5e31-0x0;var _0x4a1750=_0x7c2c[_0x1e5e31];return _0x4a1750;};'use strict';var Sequelize=require(_0xc7c2('0x0'));module[_0xc7c2('0x1')]={'description':{'type':Sequelize[_0xc7c2('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc7c2('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc7c2('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc7c2('0x4')]},'tls':{'type':Sequelize[_0xc7c2('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc7c2('0x2')],'defaultValue':_0xc7c2('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc7c2('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc7c2('0x2')]},'modernAuthentication':{'type':Sequelize[_0xc7c2('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5e59780..6e1d961 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 _0xa23a=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4101a6,_0x7dc814){var _0x146f2a=function(_0x3f1ef1){while(--_0x3f1ef1){_0x4101a6['push'](_0x4101a6['shift']());}};_0x146f2a(++_0x7dc814);}(_0xa23a,0xab));var _0xaa23=function(_0x5aef12,_0x1edd9d){_0x5aef12=_0x5aef12-0x0;var _0x245089=_0xa23a[_0x5aef12];return _0x245089;};'use strict';var _=require(_0xaa23('0x0'));var util=require(_0xaa23('0x1'));var logger=require(_0xaa23('0x2'))(_0xaa23('0x3'));var moment=require(_0xaa23('0x4'));var BPromise=require(_0xaa23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa23('0x6'));var rimraf=require(_0xaa23('0x7'));var config=require(_0xaa23('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xaa23('0x9')]=function(_0x2e39ce,_0xbd4d38){return _0x2e39ce[_0xaa23('0xa')](_0xaa23('0xb'),attributes,{'tableName':_0xaa23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe1d=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','api','bluebird','request-promise'];(function(_0x1e1e07,_0xa99d3b){var _0x4e7455=function(_0x5d1846){while(--_0x5d1846){_0x1e1e07['push'](_0x1e1e07['shift']());}};_0x4e7455(++_0xa99d3b);}(_0xbe1d,0x10f));var _0xdbe1=function(_0x54d0b1,_0x1abf62){_0x54d0b1=_0x54d0b1-0x0;var _0x26a67c=_0xbe1d[_0x54d0b1];return _0x26a67c;};'use strict';var _=require(_0xdbe1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbe1('0x1'));var moment=require('moment');var BPromise=require(_0xdbe1('0x2'));var rp=require(_0xdbe1('0x3'));var fs=require('fs');var path=require(_0xdbe1('0x4'));var rimraf=require(_0xdbe1('0x5'));var config=require(_0xdbe1('0x6'));var attributes=require(_0xdbe1('0x7'));module[_0xdbe1('0x8')]=function(_0x5f2e86,_0x9f706b){return _0x5f2e86[_0xdbe1('0x9')](_0xdbe1('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 39c7f9a..50d8eee 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 _0x77f4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','model','map','include','lodash','util','moment'];(function(_0x3cf0c1,_0x266733){var _0x2475ef=function(_0x1d09a5){while(--_0x1d09a5){_0x3cf0c1['push'](_0x3cf0c1['shift']());}};_0x2475ef(++_0x266733);}(_0x77f4,0x1a1));var _0x477f=function(_0x34a97b,_0x34a373){_0x34a97b=_0x34a97b-0x0;var _0x3c2c23=_0x77f4[_0x34a97b];return _0x3c2c23;};'use strict';var _=require(_0x477f('0x0'));var util=require(_0x477f('0x1'));var moment=require(_0x477f('0x2'));var BPromise=require(_0x477f('0x3'));var rs=require(_0x477f('0x4'));var fs=require('fs');var Redis=require(_0x477f('0x5'));var db=require(_0x477f('0x6'))['db'];var utils=require(_0x477f('0x7'));var logger=require('../../config/logger')(_0x477f('0x8'));var config=require('../../config/environment');var jayson=require(_0x477f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16eb7d,_0x56912c,_0x16fa8d){return new BPromise(function(_0x462569,_0x1c3100){return client[_0x477f('0xa')](_0x16eb7d,_0x16fa8d)['then'](function(_0x4f60ca){logger[_0x477f('0xb')](_0x477f('0xc'),_0x56912c,'request\x20sent');logger[_0x477f('0xd')](_0x477f('0xe'),_0x56912c,_0x477f('0xf'),JSON[_0x477f('0x10')](_0x4f60ca));if(_0x4f60ca[_0x477f('0x11')]){if(_0x4f60ca[_0x477f('0x11')]['code']===0x1f4){logger[_0x477f('0x11')](_0x477f('0xc'),_0x56912c,_0x4f60ca['error'][_0x477f('0x12')]);return _0x1c3100(_0x4f60ca['error']['message']);}logger[_0x477f('0x11')](_0x477f('0xc'),_0x56912c,_0x4f60ca[_0x477f('0x11')][_0x477f('0x12')]);return _0x462569(_0x4f60ca[_0x477f('0x11')][_0x477f('0x12')]);}else{logger['info'](_0x477f('0xc'),_0x56912c,_0x477f('0xf'));_0x462569(_0x4f60ca['result'][_0x477f('0x12')]);}})[_0x477f('0x13')](function(_0x230a2f){logger['error'](_0x477f('0xc'),_0x56912c,_0x230a2f);_0x1c3100(_0x230a2f);});});}exports[_0x477f('0x14')]=function(_0x1f92cc){var _0x215719=this;return new Promise(function(_0x48fe64,_0x124d10){return db[_0x477f('0x15')][_0x477f('0x16')]({'raw':_0x1f92cc[_0x477f('0x17')]?_0x1f92cc[_0x477f('0x17')][_0x477f('0x18')]===undefined?!![]:![]:!![],'where':_0x1f92cc[_0x477f('0x17')]?_0x1f92cc[_0x477f('0x17')][_0x477f('0x19')]||null:null,'attributes':_0x1f92cc[_0x477f('0x17')]?_0x1f92cc['options'][_0x477f('0x1a')]||null:null,'limit':_0x1f92cc['options']?_0x1f92cc['options']['limit']||null:null,'include':_0x1f92cc[_0x477f('0x17')]?_0x1f92cc[_0x477f('0x17')]['include']?_['map'](_0x1f92cc[_0x477f('0x17')]['include'],function(_0x28a355){return{'model':db[_0x28a355[_0x477f('0x1b')]],'as':_0x28a355['as'],'attributes':_0x28a355[_0x477f('0x1a')],'include':_0x28a355['include']?_[_0x477f('0x1c')](_0x28a355[_0x477f('0x1d')],function(_0x296347){return{'model':db[_0x296347[_0x477f('0x1b')]],'as':_0x296347['as'],'attributes':_0x296347[_0x477f('0x1a')],'include':_0x296347['include']?_[_0x477f('0x1c')](_0x296347['include'],function(_0x59d5f7){return{'model':db[_0x59d5f7[_0x477f('0x1b')]],'as':_0x59d5f7['as'],'attributes':_0x59d5f7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52f4ed){logger[_0x477f('0xb')](_0x477f('0x14'),_0x1f92cc);logger[_0x477f('0xd')](_0x477f('0x14'),_0x1f92cc,JSON[_0x477f('0x10')](_0x52f4ed));_0x48fe64(_0x52f4ed);})[_0x477f('0x13')](function(_0x3b9db0){logger[_0x477f('0x11')](_0x477f('0x14'),_0x3b9db0[_0x477f('0x12')],_0x1f92cc);_0x124d10(_0x215719[_0x477f('0x11')](0x1f4,_0x3b9db0[_0x477f('0x12')]));});});}; \ No newline at end of file +var _0xeec0=['client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','raw','options','where','limit','include','map','model','attributes','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0xeec0,0x177));var _0x0eec=function(_0x449e55,_0x53912a){_0x449e55=_0x449e55-0x0;var _0x5f5aa2=_0xeec0[_0x449e55];return _0x5f5aa2;};'use strict';var _=require(_0x0eec('0x0'));var util=require(_0x0eec('0x1'));var moment=require(_0x0eec('0x2'));var BPromise=require(_0x0eec('0x3'));var rs=require(_0x0eec('0x4'));var fs=require('fs');var Redis=require(_0x0eec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0eec('0x6'));var logger=require(_0x0eec('0x7'))(_0x0eec('0x8'));var config=require('../../config/environment');var jayson=require(_0x0eec('0x9'));var client=jayson[_0x0eec('0xa')][_0x0eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a85ec,_0x2c50ba,_0x583ac8){return new BPromise(function(_0x57f557,_0x1618eb){return client[_0x0eec('0xc')](_0x4a85ec,_0x583ac8)['then'](function(_0x149b87){logger[_0x0eec('0xd')](_0x0eec('0xe'),_0x2c50ba,_0x0eec('0xf'));logger['debug'](_0x0eec('0x10'),_0x2c50ba,_0x0eec('0xf'),JSON['stringify'](_0x149b87));if(_0x149b87[_0x0eec('0x11')]){if(_0x149b87[_0x0eec('0x11')][_0x0eec('0x12')]===0x1f4){logger[_0x0eec('0x11')](_0x0eec('0xe'),_0x2c50ba,_0x149b87['error']['message']);return _0x1618eb(_0x149b87[_0x0eec('0x11')][_0x0eec('0x13')]);}logger[_0x0eec('0x11')](_0x0eec('0xe'),_0x2c50ba,_0x149b87[_0x0eec('0x11')][_0x0eec('0x13')]);return _0x57f557(_0x149b87[_0x0eec('0x11')][_0x0eec('0x13')]);}else{logger[_0x0eec('0xd')](_0x0eec('0xe'),_0x2c50ba,_0x0eec('0xf'));_0x57f557(_0x149b87['result'][_0x0eec('0x13')]);}})[_0x0eec('0x14')](function(_0x249ed8){logger[_0x0eec('0x11')](_0x0eec('0xe'),_0x2c50ba,_0x249ed8);_0x1618eb(_0x249ed8);});});}exports[_0x0eec('0x15')]=function(_0x5658d4){var _0x772966=this;return new Promise(function(_0x5c0449,_0x523533){return db[_0x0eec('0x16')][_0x0eec('0x17')]({'raw':_0x5658d4['options']?_0x5658d4['options'][_0x0eec('0x18')]===undefined?!![]:![]:!![],'where':_0x5658d4[_0x0eec('0x19')]?_0x5658d4[_0x0eec('0x19')][_0x0eec('0x1a')]||null:null,'attributes':_0x5658d4[_0x0eec('0x19')]?_0x5658d4['options']['attributes']||null:null,'limit':_0x5658d4[_0x0eec('0x19')]?_0x5658d4[_0x0eec('0x19')][_0x0eec('0x1b')]||null:null,'include':_0x5658d4[_0x0eec('0x19')]?_0x5658d4[_0x0eec('0x19')][_0x0eec('0x1c')]?_[_0x0eec('0x1d')](_0x5658d4[_0x0eec('0x19')][_0x0eec('0x1c')],function(_0x1d9485){return{'model':db[_0x1d9485[_0x0eec('0x1e')]],'as':_0x1d9485['as'],'attributes':_0x1d9485['attributes'],'include':_0x1d9485[_0x0eec('0x1c')]?_[_0x0eec('0x1d')](_0x1d9485[_0x0eec('0x1c')],function(_0x327ad5){return{'model':db[_0x327ad5[_0x0eec('0x1e')]],'as':_0x327ad5['as'],'attributes':_0x327ad5[_0x0eec('0x1f')],'include':_0x327ad5['include']?_[_0x0eec('0x1d')](_0x327ad5[_0x0eec('0x1c')],function(_0x4664b3){return{'model':db[_0x4664b3[_0x0eec('0x1e')]],'as':_0x4664b3['as'],'attributes':_0x4664b3[_0x0eec('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0eec('0x20')](function(_0x100234){logger[_0x0eec('0xd')](_0x0eec('0x15'),_0x5658d4);logger[_0x0eec('0x21')](_0x0eec('0x15'),_0x5658d4,JSON[_0x0eec('0x22')](_0x100234));_0x5c0449(_0x100234);})['catch'](function(_0x24f873){logger[_0x0eec('0x11')](_0x0eec('0x15'),_0x24f873[_0x0eec('0x13')],_0x5658d4);_0x523533(_0x772966['error'](0x1f4,_0x24f873[_0x0eec('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6403ef1..0de717a 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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x45c646,_0x386de2){_0x45c646=_0x45c646-0x0;var _0x1ddaf1=_0x7a54[_0x45c646];return _0x1ddaf1;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 2de765f..c92d3a4 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 _0x97c1=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5d9762,_0x174292){var _0x1c1628=function(_0x3dc4fe){while(--_0x3dc4fe){_0x5d9762['push'](_0x5d9762['shift']());}};_0x1c1628(++_0x174292);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x197c('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x197c('0x3')]},'secure':{'type':Sequelize[_0x197c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x197c('0x2')]},'authentication':{'type':Sequelize[_0x197c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x197c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xda3f=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0xda3f,0xec));var _0xfda3=function(_0x44f98b,_0x705a21){_0x44f98b=_0x44f98b-0x0;var _0x87a325=_0xda3f[_0x44f98b];return _0x87a325;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'description':{'type':Sequelize[_0xfda3('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfda3('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xfda3('0x1')]},'authentication':{'type':Sequelize[_0xfda3('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2de023d..25f3dc1 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 _0x8e93=['Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','moment','bluebird','util','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','status','end','json','offset','undefined','count','limit'];(function(_0x26d4c8,_0xc9496b){var _0x5f0eb9=function(_0x538cd7){while(--_0x538cd7){_0x26d4c8['push'](_0x26d4c8['shift']());}};_0x5f0eb9(++_0xc9496b);}(_0x8e93,0x108));var _0x38e9=function(_0x3bcb43,_0x402ff8){_0x3bcb43=_0x3bcb43-0x0;var _0x255ff1=_0x8e93[_0x3bcb43];return _0x255ff1;};'use strict';var emlformat=require(_0x38e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38e9('0x2'));var BPromise=require(_0x38e9('0x3'));var Mustache=require('mustache');var util=require(_0x38e9('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x38e9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38e9('0x6'));var _=require(_0x38e9('0x7'));var squel=require(_0x38e9('0x8'));var crypto=require(_0x38e9('0x9'));var jsforce=require(_0x38e9('0xa'));var deskjs=require(_0x38e9('0xb'));var toCsv=require(_0x38e9('0x5'));var querystring=require(_0x38e9('0xc'));var Papa=require(_0x38e9('0xd'));var Redis=require(_0x38e9('0xe'));var authService=require(_0x38e9('0xf'));var qs=require(_0x38e9('0x10'));var as=require(_0x38e9('0x11'));var hardwareService=require(_0x38e9('0x12'));var logger=require(_0x38e9('0x13'))(_0x38e9('0x14'));var utils=require(_0x38e9('0x15'));var config=require(_0x38e9('0x16'));var licenseUtil=require(_0x38e9('0x17'));var db=require(_0x38e9('0x18'))['db'];function respondWithStatusCode(_0x75dd03,_0x14fe7c){_0x14fe7c=_0x14fe7c||0xcc;return function(_0x42df7c){if(_0x42df7c){return _0x75dd03['sendStatus'](_0x14fe7c);}return _0x75dd03[_0x38e9('0x19')](_0x14fe7c)[_0x38e9('0x1a')]();};}function respondWithResult(_0x4d5158,_0x1a6e35){_0x1a6e35=_0x1a6e35||0xc8;return function(_0x4e40b8){if(_0x4e40b8){return _0x4d5158[_0x38e9('0x19')](_0x1a6e35)[_0x38e9('0x1b')](_0x4e40b8);}};}function respondWithFilteredResult(_0x48c49e,_0x1e721e){return function(_0x2f37f0){if(_0x2f37f0){var _0x41ca8d=typeof _0x1e721e[_0x38e9('0x1c')]===_0x38e9('0x1d')&&typeof _0x1e721e['limit']==='undefined';var _0x3f5f67=_0x2f37f0['count'];var _0x242196=_0x41ca8d?0x0:_0x1e721e['offset'];var _0x3d8cda=_0x41ca8d?_0x2f37f0[_0x38e9('0x1e')]:_0x1e721e[_0x38e9('0x1c')]+_0x1e721e[_0x38e9('0x1f')];var _0x499b4a;if(_0x3d8cda>=_0x3f5f67){_0x3d8cda=_0x3f5f67;_0x499b4a=0xc8;}else{_0x499b4a=0xce;}_0x48c49e[_0x38e9('0x19')](_0x499b4a);return _0x48c49e['set'](_0x38e9('0x20'),_0x242196+'-'+_0x3d8cda+'/'+_0x3f5f67)['json'](_0x2f37f0);}return null;};}function patchUpdates(_0x36b17d){return function(_0x5f4e9b){try{jsonpatch['apply'](_0x5f4e9b,_0x36b17d,!![]);}catch(_0x8b7310){return BPromise[_0x38e9('0x21')](_0x8b7310);}return _0x5f4e9b[_0x38e9('0x22')]();};}function saveUpdates(_0x290b9b,_0x4ebf33){return function(_0x1fa25d){if(_0x1fa25d){return _0x1fa25d['update'](_0x290b9b)[_0x38e9('0x23')](function(_0x4242fb){return _0x4242fb;});}return null;};}function removeEntity(_0x1a17a4,_0xbeae69){return function(_0x4036ef){if(_0x4036ef){return _0x4036ef[_0x38e9('0x24')]()['then'](function(){_0x1a17a4['status'](0xcc)[_0x38e9('0x1a')]();});}};}function handleEntityNotFound(_0x3c7539,_0x35425e){return function(_0x1afffb){if(!_0x1afffb){_0x3c7539[_0x38e9('0x25')](0x194);}return _0x1afffb;};}function handleError(_0x436de1,_0x51d160){_0x51d160=_0x51d160||0x1f4;return function(_0x398607){logger[_0x38e9('0x26')](_0x398607[_0x38e9('0x27')]);if(_0x398607['name']){delete _0x398607[_0x38e9('0x28')];}_0x436de1[_0x38e9('0x19')](_0x51d160)[_0x38e9('0x29')](_0x398607);};}exports[_0x38e9('0x2a')]=function(_0x3482c0,_0xb2ad67){var _0x33af71={},_0x169043={},_0xf7e9a9={'count':0x0,'rows':[]};var _0x4303fb=_['map'](db[_0x38e9('0x2b')][_0x38e9('0x2c')],function(_0x8fc864){return{'name':_0x8fc864[_0x38e9('0x2d')],'type':_0x8fc864[_0x38e9('0x2e')][_0x38e9('0x2f')]};});_0x169043[_0x38e9('0x30')]=_[_0x38e9('0x31')](_0x4303fb,_0x38e9('0x28'));_0x169043[_0x38e9('0x32')]=_['keys'](_0x3482c0['query']);_0x169043[_0x38e9('0x33')]=_['intersection'](_0x169043['model'],_0x169043[_0x38e9('0x32')]);_0x33af71[_0x38e9('0x34')]=_[_0x38e9('0x35')](_0x169043[_0x38e9('0x30')],qs[_0x38e9('0x36')](_0x3482c0['query'][_0x38e9('0x36')]));_0x33af71['attributes']=_0x33af71['attributes'][_0x38e9('0x37')]?_0x33af71[_0x38e9('0x34')]:_0x169043[_0x38e9('0x30')];if(!_0x3482c0['query']['hasOwnProperty'](_0x38e9('0x38'))){_0x33af71[_0x38e9('0x1f')]=qs[_0x38e9('0x1f')](_0x3482c0[_0x38e9('0x32')][_0x38e9('0x1f')]);_0x33af71[_0x38e9('0x1c')]=qs[_0x38e9('0x1c')](_0x3482c0[_0x38e9('0x32')][_0x38e9('0x1c')]);}_0x33af71['order']=qs[_0x38e9('0x39')](_0x3482c0['query'][_0x38e9('0x39')]);_0x33af71[_0x38e9('0x3a')]=qs[_0x38e9('0x33')](_[_0x38e9('0x3b')](_0x3482c0['query'],_0x169043['filters']),_0x4303fb);if(_0x3482c0[_0x38e9('0x32')][_0x38e9('0x3c')]){_0x33af71[_0x38e9('0x3a')]=_[_0x38e9('0x3d')](_0x33af71[_0x38e9('0x3a')],{'$or':_[_0x38e9('0x31')](_0x4303fb,function(_0x53a856){if(_0x53a856[_0x38e9('0x2e')]!=='VIRTUAL'){var _0x5286d1={};_0x5286d1[_0x53a856[_0x38e9('0x28')]]={'$like':'%'+_0x3482c0[_0x38e9('0x32')][_0x38e9('0x3c')]+'%'};return _0x5286d1;}})});}_0x33af71=_['merge']({},_0x33af71,_0x3482c0[_0x38e9('0x3e')]);var _0x5bb1b0={'where':_0x33af71[_0x38e9('0x3a')]};return db[_0x38e9('0x2b')][_0x38e9('0x1e')](_0x5bb1b0)[_0x38e9('0x23')](function(_0x50a615){_0xf7e9a9['count']=_0x50a615;if(_0x3482c0[_0x38e9('0x32')][_0x38e9('0x3f')]){_0x33af71[_0x38e9('0x40')]=[{'all':!![]}];}return db[_0x38e9('0x2b')][_0x38e9('0x41')](_0x33af71);})[_0x38e9('0x23')](function(_0x764ffc){_0xf7e9a9[_0x38e9('0x42')]=_0x764ffc;return _0xf7e9a9;})['then'](respondWithFilteredResult(_0xb2ad67,_0x33af71))[_0x38e9('0x43')](handleError(_0xb2ad67,null));};exports[_0x38e9('0x44')]=function(_0x35eab7,_0x37e464){var _0x325b5a={'raw':!![],'where':{'id':_0x35eab7[_0x38e9('0x45')]['id']}},_0x451715={};_0x451715[_0x38e9('0x30')]=_[_0x38e9('0x46')](db[_0x38e9('0x2b')][_0x38e9('0x2c')]);_0x451715[_0x38e9('0x32')]=_[_0x38e9('0x46')](_0x35eab7['query']);_0x451715['filters']=_[_0x38e9('0x35')](_0x451715['model'],_0x451715[_0x38e9('0x32')]);_0x325b5a['attributes']=_[_0x38e9('0x35')](_0x451715[_0x38e9('0x30')],qs[_0x38e9('0x36')](_0x35eab7['query'][_0x38e9('0x36')]));_0x325b5a[_0x38e9('0x34')]=_0x325b5a[_0x38e9('0x34')][_0x38e9('0x37')]?_0x325b5a[_0x38e9('0x34')]:_0x451715[_0x38e9('0x30')];if(_0x35eab7[_0x38e9('0x32')][_0x38e9('0x3f')]){_0x325b5a[_0x38e9('0x40')]=[{'all':!![]}];}_0x325b5a=_[_0x38e9('0x3d')]({},_0x325b5a,_0x35eab7[_0x38e9('0x3e')]);return db[_0x38e9('0x2b')][_0x38e9('0x47')](_0x325b5a)[_0x38e9('0x23')](handleEntityNotFound(_0x37e464,null))[_0x38e9('0x23')](respondWithResult(_0x37e464,null))[_0x38e9('0x43')](handleError(_0x37e464,null));};exports[_0x38e9('0x48')]=function(_0x29937f,_0x41b8ba){return db[_0x38e9('0x2b')][_0x38e9('0x48')](_0x29937f[_0x38e9('0x49')],{})[_0x38e9('0x23')](respondWithResult(_0x41b8ba,0xc9))['catch'](handleError(_0x41b8ba,null));};exports['update']=function(_0x5062e2,_0x507400){if(_0x5062e2[_0x38e9('0x49')]['id']){delete _0x5062e2[_0x38e9('0x49')]['id'];}return db[_0x38e9('0x2b')][_0x38e9('0x47')]({'where':{'id':_0x5062e2['params']['id']}})[_0x38e9('0x23')](handleEntityNotFound(_0x507400,null))[_0x38e9('0x23')](saveUpdates(_0x5062e2[_0x38e9('0x49')],null))[_0x38e9('0x23')](respondWithResult(_0x507400,null))[_0x38e9('0x43')](handleError(_0x507400,null));};exports[_0x38e9('0x24')]=function(_0x1a1990,_0x18b9b4){return db[_0x38e9('0x2b')][_0x38e9('0x47')]({'where':{'id':_0x1a1990[_0x38e9('0x45')]['id']}})[_0x38e9('0x23')](handleEntityNotFound(_0x18b9b4,null))[_0x38e9('0x23')](removeEntity(_0x18b9b4,null))[_0x38e9('0x43')](handleError(_0x18b9b4,null));}; \ No newline at end of file +var _0x8e02=['save','update','destroy','then','end','stack','name','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','rawAttributes','includeAll','options','find','create','body','catch','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','apply','reject'];(function(_0x54b458,_0x4da21b){var _0x18d704=function(_0x3ca278){while(--_0x3ca278){_0x54b458['push'](_0x54b458['shift']());}};_0x18d704(++_0x4da21b);}(_0x8e02,0x13e));var _0x28e0=function(_0x506b4b,_0x53ef7c){_0x506b4b=_0x506b4b-0x0;var _0x3dd016=_0x8e02[_0x506b4b];return _0x3dd016;};'use strict';var emlformat=require(_0x28e0('0x0'));var rimraf=require(_0x28e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28e0('0x2'));var rp=require(_0x28e0('0x3'));var moment=require('moment');var BPromise=require(_0x28e0('0x4'));var Mustache=require(_0x28e0('0x5'));var util=require(_0x28e0('0x6'));var path=require(_0x28e0('0x7'));var sox=require('sox');var csv=require(_0x28e0('0x8'));var ejs=require(_0x28e0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28e0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28e0('0xb'));var deskjs=require(_0x28e0('0xc'));var toCsv=require(_0x28e0('0x8'));var querystring=require(_0x28e0('0xd'));var Papa=require('papaparse');var Redis=require(_0x28e0('0xe'));var authService=require(_0x28e0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28e0('0x10'));var logger=require(_0x28e0('0x11'))(_0x28e0('0x12'));var utils=require(_0x28e0('0x13'));var config=require(_0x28e0('0x14'));var licenseUtil=require(_0x28e0('0x15'));var db=require(_0x28e0('0x16'))['db'];function respondWithStatusCode(_0x548f50,_0x44f353){_0x44f353=_0x44f353||0xcc;return function(_0x34dc2c){if(_0x34dc2c){return _0x548f50[_0x28e0('0x17')](_0x44f353);}return _0x548f50[_0x28e0('0x18')](_0x44f353)['end']();};}function respondWithResult(_0x4c0113,_0x4f5c4a){_0x4f5c4a=_0x4f5c4a||0xc8;return function(_0xe74684){if(_0xe74684){return _0x4c0113['status'](_0x4f5c4a)[_0x28e0('0x19')](_0xe74684);}};}function respondWithFilteredResult(_0x48aa6f,_0x23bb6d){return function(_0x3c8b6e){if(_0x3c8b6e){var _0x3635bc=typeof _0x23bb6d[_0x28e0('0x1a')]==='undefined'&&typeof _0x23bb6d['limit']==='undefined';var _0x52fe1e=_0x3c8b6e[_0x28e0('0x1b')];var _0x3702a8=_0x3635bc?0x0:_0x23bb6d[_0x28e0('0x1a')];var _0x32ba24=_0x3635bc?_0x3c8b6e[_0x28e0('0x1b')]:_0x23bb6d['offset']+_0x23bb6d['limit'];var _0x49ff42;if(_0x32ba24>=_0x52fe1e){_0x32ba24=_0x52fe1e;_0x49ff42=0xc8;}else{_0x49ff42=0xce;}_0x48aa6f[_0x28e0('0x18')](_0x49ff42);return _0x48aa6f[_0x28e0('0x1c')](_0x28e0('0x1d'),_0x3702a8+'-'+_0x32ba24+'/'+_0x52fe1e)['json'](_0x3c8b6e);}return null;};}function patchUpdates(_0x1c6071){return function(_0x2cfec4){try{jsonpatch[_0x28e0('0x1e')](_0x2cfec4,_0x1c6071,!![]);}catch(_0x3c121c){return BPromise[_0x28e0('0x1f')](_0x3c121c);}return _0x2cfec4[_0x28e0('0x20')]();};}function saveUpdates(_0x145545,_0x488410){return function(_0xacdc40){if(_0xacdc40){return _0xacdc40[_0x28e0('0x21')](_0x145545)['then'](function(_0x37e2eb){return _0x37e2eb;});}return null;};}function removeEntity(_0x3608b5,_0xd9a599){return function(_0x56b0e0){if(_0x56b0e0){return _0x56b0e0[_0x28e0('0x22')]()[_0x28e0('0x23')](function(){_0x3608b5[_0x28e0('0x18')](0xcc)[_0x28e0('0x24')]();});}};}function handleEntityNotFound(_0x423453,_0x41dc18){return function(_0x1bdc42){if(!_0x1bdc42){_0x423453[_0x28e0('0x17')](0x194);}return _0x1bdc42;};}function handleError(_0x59f63e,_0x4a741c){_0x4a741c=_0x4a741c||0x1f4;return function(_0x5e63ca){logger['error'](_0x5e63ca[_0x28e0('0x25')]);if(_0x5e63ca[_0x28e0('0x26')]){delete _0x5e63ca[_0x28e0('0x26')];}_0x59f63e[_0x28e0('0x18')](_0x4a741c)['send'](_0x5e63ca);};}exports['index']=function(_0x1937bb,_0x39b016){var _0xf460ea={},_0x339cb0={},_0x1eb92f={'count':0x0,'rows':[]};var _0x2ef557=_[_0x28e0('0x27')](db[_0x28e0('0x28')]['rawAttributes'],function(_0x264628){return{'name':_0x264628[_0x28e0('0x29')],'type':_0x264628[_0x28e0('0x2a')][_0x28e0('0x2b')]};});_0x339cb0[_0x28e0('0x2c')]=_[_0x28e0('0x27')](_0x2ef557,_0x28e0('0x26'));_0x339cb0[_0x28e0('0x2d')]=_[_0x28e0('0x2e')](_0x1937bb[_0x28e0('0x2d')]);_0x339cb0[_0x28e0('0x2f')]=_[_0x28e0('0x30')](_0x339cb0[_0x28e0('0x2c')],_0x339cb0['query']);_0xf460ea[_0x28e0('0x31')]=_['intersection'](_0x339cb0['model'],qs[_0x28e0('0x32')](_0x1937bb['query'][_0x28e0('0x32')]));_0xf460ea['attributes']=_0xf460ea['attributes'][_0x28e0('0x33')]?_0xf460ea['attributes']:_0x339cb0[_0x28e0('0x2c')];if(!_0x1937bb['query'][_0x28e0('0x34')]('nolimit')){_0xf460ea['limit']=qs[_0x28e0('0x35')](_0x1937bb[_0x28e0('0x2d')]['limit']);_0xf460ea[_0x28e0('0x1a')]=qs['offset'](_0x1937bb['query'][_0x28e0('0x1a')]);}_0xf460ea[_0x28e0('0x36')]=qs[_0x28e0('0x37')](_0x1937bb[_0x28e0('0x2d')][_0x28e0('0x37')]);_0xf460ea[_0x28e0('0x38')]=qs[_0x28e0('0x2f')](_['pick'](_0x1937bb[_0x28e0('0x2d')],_0x339cb0['filters']),_0x2ef557);if(_0x1937bb[_0x28e0('0x2d')][_0x28e0('0x39')]){_0xf460ea[_0x28e0('0x38')]=_[_0x28e0('0x3a')](_0xf460ea[_0x28e0('0x38')],{'$or':_[_0x28e0('0x27')](_0x2ef557,function(_0x9e4187){if(_0x9e4187[_0x28e0('0x2a')]!==_0x28e0('0x3b')){var _0x1a3ab4={};_0x1a3ab4[_0x9e4187[_0x28e0('0x26')]]={'$like':'%'+_0x1937bb[_0x28e0('0x2d')][_0x28e0('0x39')]+'%'};return _0x1a3ab4;}})});}_0xf460ea=_[_0x28e0('0x3a')]({},_0xf460ea,_0x1937bb['options']);var _0x24c892={'where':_0xf460ea[_0x28e0('0x38')]};return db['MailServerOut'][_0x28e0('0x1b')](_0x24c892)[_0x28e0('0x23')](function(_0x248fe2){_0x1eb92f[_0x28e0('0x1b')]=_0x248fe2;if(_0x1937bb[_0x28e0('0x2d')]['includeAll']){_0xf460ea['include']=[{'all':!![]}];}return db[_0x28e0('0x28')][_0x28e0('0x3c')](_0xf460ea);})['then'](function(_0x1ab9fa){_0x1eb92f[_0x28e0('0x3d')]=_0x1ab9fa;return _0x1eb92f;})[_0x28e0('0x23')](respondWithFilteredResult(_0x39b016,_0xf460ea))['catch'](handleError(_0x39b016,null));};exports['show']=function(_0x22396b,_0x27b24d){var _0x341775={'raw':!![],'where':{'id':_0x22396b['params']['id']}},_0x37f07d={};_0x37f07d[_0x28e0('0x2c')]=_[_0x28e0('0x2e')](db['MailServerOut'][_0x28e0('0x3e')]);_0x37f07d[_0x28e0('0x2d')]=_[_0x28e0('0x2e')](_0x22396b['query']);_0x37f07d[_0x28e0('0x2f')]=_[_0x28e0('0x30')](_0x37f07d['model'],_0x37f07d[_0x28e0('0x2d')]);_0x341775['attributes']=_[_0x28e0('0x30')](_0x37f07d[_0x28e0('0x2c')],qs[_0x28e0('0x32')](_0x22396b['query']['fields']));_0x341775[_0x28e0('0x31')]=_0x341775['attributes'][_0x28e0('0x33')]?_0x341775[_0x28e0('0x31')]:_0x37f07d[_0x28e0('0x2c')];if(_0x22396b['query'][_0x28e0('0x3f')]){_0x341775['include']=[{'all':!![]}];}_0x341775=_[_0x28e0('0x3a')]({},_0x341775,_0x22396b[_0x28e0('0x40')]);return db[_0x28e0('0x28')][_0x28e0('0x41')](_0x341775)['then'](handleEntityNotFound(_0x27b24d,null))['then'](respondWithResult(_0x27b24d,null))['catch'](handleError(_0x27b24d,null));};exports[_0x28e0('0x42')]=function(_0x48ebc9,_0x3ef3ef){return db['MailServerOut'][_0x28e0('0x42')](_0x48ebc9[_0x28e0('0x43')],{})['then'](respondWithResult(_0x3ef3ef,0xc9))[_0x28e0('0x44')](handleError(_0x3ef3ef,null));};exports['update']=function(_0x3015bb,_0x5b0437){if(_0x3015bb['body']['id']){delete _0x3015bb[_0x28e0('0x43')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x3015bb[_0x28e0('0x45')]['id']}})[_0x28e0('0x23')](handleEntityNotFound(_0x5b0437,null))[_0x28e0('0x23')](saveUpdates(_0x3015bb['body'],null))[_0x28e0('0x23')](respondWithResult(_0x5b0437,null))['catch'](handleError(_0x5b0437,null));};exports[_0x28e0('0x22')]=function(_0x163ef3,_0x2bc800){return db[_0x28e0('0x28')]['find']({'where':{'id':_0x163ef3['params']['id']}})[_0x28e0('0x23')](handleEntityNotFound(_0x2bc800,null))['then'](removeEntity(_0x2bc800,null))[_0x28e0('0x44')](handleError(_0x2bc800,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b4aaced..b91243a 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 _0x364b=['request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','util','api','moment','bluebird'];(function(_0x2803dc,_0x1cdaf1){var _0x552ae4=function(_0x15f1ef){while(--_0x15f1ef){_0x2803dc['push'](_0x2803dc['shift']());}};_0x552ae4(++_0x1cdaf1);}(_0x364b,0x15c));var _0xb364=function(_0xfcbdc0,_0x1d432a){_0xfcbdc0=_0xfcbdc0-0x0;var _0x402200=_0x364b[_0xfcbdc0];return _0x402200;};'use strict';var _=require('lodash');var util=require(_0xb364('0x0'));var logger=require('../../config/logger')(_0xb364('0x1'));var moment=require(_0xb364('0x2'));var BPromise=require(_0xb364('0x3'));var rp=require(_0xb364('0x4'));var fs=require('fs');var path=require(_0xb364('0x5'));var rimraf=require(_0xb364('0x6'));var config=require(_0xb364('0x7'));var attributes=require(_0xb364('0x8'));module[_0xb364('0x9')]=function(_0x588a17,_0x5c5a30){return _0x588a17['define'](_0xb364('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a01=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./mailServerOut.attributes','exports','define'];(function(_0x2ab3aa,_0x3208fe){var _0x28d945=function(_0x38028b){while(--_0x38028b){_0x2ab3aa['push'](_0x2ab3aa['shift']());}};_0x28d945(++_0x3208fe);}(_0x9a01,0x8c));var _0x19a0=function(_0x4e7b6a,_0x234514){_0x4e7b6a=_0x4e7b6a-0x0;var _0x2994a9=_0x9a01[_0x4e7b6a];return _0x2994a9;};'use strict';var _=require(_0x19a0('0x0'));var util=require('util');var logger=require(_0x19a0('0x1'))(_0x19a0('0x2'));var moment=require(_0x19a0('0x3'));var BPromise=require('bluebird');var rp=require(_0x19a0('0x4'));var fs=require('fs');var path=require(_0x19a0('0x5'));var rimraf=require(_0x19a0('0x6'));var config=require('../../config/environment');var attributes=require(_0x19a0('0x7'));module[_0x19a0('0x8')]=function(_0x19f3bd,_0x498557){return _0x19f3bd[_0x19a0('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d75fb41..9cb4656 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(_0x3cf2ce,_0x4a34f6){var _0x47d881=function(_0x1fb7d3){while(--_0x1fb7d3){_0x3cf2ce['push'](_0x3cf2ce['shift']());}};_0x47d881(++_0x4a34f6);}(_0x2ef3,0xba));var _0x32ef=function(_0x2ba6b1,_0x108d84){_0x2ba6b1=_0x2ba6b1-0x0;var _0x295a8c=_0x2ef3[_0x2ba6b1];return _0x295a8c;};'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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x144632,_0x1e1547){var _0x502b63=function(_0x1198d0){while(--_0x1198d0){_0x144632['push'](_0x144632['shift']());}};_0x502b63(++_0x1e1547);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 3f892c0..deeeb8a 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 _0x56a9=['update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','get','describe','/:id','show','create','put'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x56a9,0x103));var _0x956a=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x56a9[_0x174a72];return _0x32cecd;};'use strict';var multer=require('multer');var util=require(_0x956a('0x0'));var path=require(_0x956a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x956a('0x2'));var auth=require(_0x956a('0x3'));var interaction=require(_0x956a('0x4'));var config=require('../../config/environment');var controller=require(_0x956a('0x5'));router['get']('/',auth[_0x956a('0x6')](),controller['index']);router[_0x956a('0x7')]('/describe',auth[_0x956a('0x6')](),controller[_0x956a('0x8')]);router['get'](_0x956a('0x9'),auth['isAuthenticated'](),controller[_0x956a('0xa')]);router['post']('/',auth[_0x956a('0x6')](),controller[_0x956a('0xb')]);router[_0x956a('0xc')](_0x956a('0x9'),auth[_0x956a('0x6')](),controller[_0x956a('0xd')]);router[_0x956a('0xe')](_0x956a('0x9'),auth['isAuthenticated'](),controller[_0x956a('0xf')]);module[_0x956a('0x10')]=router; \ No newline at end of file +var _0xac8b=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x3f3053,_0x51df08){var _0x1e19e0=function(_0x2c835b){while(--_0x2c835b){_0x3f3053['push'](_0x3f3053['shift']());}};_0x1e19e0(++_0x51df08);}(_0xac8b,0x8e));var _0xbac8=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xac8b[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xbac8('0x0'));var util=require(_0xbac8('0x1'));var path=require(_0xbac8('0x2'));var timeout=require(_0xbac8('0x3'));var express=require(_0xbac8('0x4'));var router=express[_0xbac8('0x5')]();var fs_extra=require(_0xbac8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbac8('0x7'));var config=require(_0xbac8('0x8'));var controller=require('./mailSubstatus.controller');router[_0xbac8('0x9')]('/',auth['isAuthenticated'](),controller[_0xbac8('0xa')]);router['get']('/describe',auth[_0xbac8('0xb')](),controller[_0xbac8('0xc')]);router[_0xbac8('0x9')](_0xbac8('0xd'),auth[_0xbac8('0xb')](),controller[_0xbac8('0xe')]);router[_0xbac8('0xf')]('/',auth[_0xbac8('0xb')](),controller[_0xbac8('0x10')]);router[_0xbac8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbac8('0x12')]);router[_0xbac8('0x13')](_0xbac8('0xd'),auth[_0xbac8('0xb')](),controller[_0xbac8('0x14')]);module[_0xbac8('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3ebe86f..eb28220 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(_0x6292ad,_0x16941c){var _0x1d1fde=function(_0x2bf415){while(--_0x2bf415){_0x6292ad['push'](_0x6292ad['shift']());}};_0x1d1fde(++_0x16941c);}(_0x53ec,0x192));var _0xc53e=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x53ec[_0x5dbb84];return _0x1d6eae;};'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 _0x126e=['exports','STRING','name'];(function(_0x5431ad,_0x2c8593){var _0x2423ae=function(_0x274fca){while(--_0x274fca){_0x5431ad['push'](_0x5431ad['shift']());}};_0x2423ae(++_0x2c8593);}(_0x126e,0x108));var _0xe126=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x126e[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe126('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0127b76..f1e1891 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 _0x4ee3=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','set','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','map','type','VIRTUAL','filter','options','include','rows','catch','show','params','length','includeAll','find'];(function(_0x3de464,_0x1553c2){var _0x444579=function(_0x504ce3){while(--_0x504ce3){_0x3de464['push'](_0x3de464['shift']());}};_0x444579(++_0x1553c2);}(_0x4ee3,0x1cb));var _0x34ee=function(_0x37762c,_0x3c6a24){_0x37762c=_0x37762c-0x0;var _0x4f0935=_0x4ee3[_0x37762c];return _0x4f0935;};'use strict';var emlformat=require(_0x34ee('0x0'));var rimraf=require(_0x34ee('0x1'));var zipdir=require(_0x34ee('0x2'));var jsonpatch=require(_0x34ee('0x3'));var rp=require(_0x34ee('0x4'));var moment=require(_0x34ee('0x5'));var BPromise=require(_0x34ee('0x6'));var Mustache=require(_0x34ee('0x7'));var util=require('util');var path=require(_0x34ee('0x8'));var sox=require(_0x34ee('0x9'));var csv=require('to-csv');var ejs=require(_0x34ee('0xa'));var fs=require('fs');var fs_extra=require(_0x34ee('0xb'));var _=require('lodash');var squel=require(_0x34ee('0xc'));var crypto=require('crypto');var jsforce=require(_0x34ee('0xd'));var deskjs=require(_0x34ee('0xe'));var toCsv=require(_0x34ee('0xf'));var querystring=require(_0x34ee('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x34ee('0x11'));var qs=require(_0x34ee('0x12'));var as=require(_0x34ee('0x13'));var hardwareService=require(_0x34ee('0x14'));var logger=require(_0x34ee('0x15'))(_0x34ee('0x16'));var utils=require(_0x34ee('0x17'));var config=require(_0x34ee('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x34ee('0x19'))['db'];function respondWithStatusCode(_0x201f18,_0x5d8177){_0x5d8177=_0x5d8177||0xcc;return function(_0x3902b5){if(_0x3902b5){return _0x201f18['sendStatus'](_0x5d8177);}return _0x201f18[_0x34ee('0x1a')](_0x5d8177)['end']();};}function respondWithResult(_0x58d3bd,_0x2882e0){_0x2882e0=_0x2882e0||0xc8;return function(_0x39ad84){if(_0x39ad84){return _0x58d3bd[_0x34ee('0x1a')](_0x2882e0)['json'](_0x39ad84);}};}function respondWithFilteredResult(_0x4d52ba,_0x1bec6b){return function(_0x40b602){if(_0x40b602){var _0x12133b=typeof _0x1bec6b[_0x34ee('0x1b')]==='undefined'&&typeof _0x1bec6b['limit']===_0x34ee('0x1c');var _0x2569bf=_0x40b602[_0x34ee('0x1d')];var _0x4fbf45=_0x12133b?0x0:_0x1bec6b[_0x34ee('0x1b')];var _0x307be7=_0x12133b?_0x40b602[_0x34ee('0x1d')]:_0x1bec6b[_0x34ee('0x1b')]+_0x1bec6b['limit'];var _0x2017f3;if(_0x307be7>=_0x2569bf){_0x307be7=_0x2569bf;_0x2017f3=0xc8;}else{_0x2017f3=0xce;}_0x4d52ba['status'](_0x2017f3);return _0x4d52ba[_0x34ee('0x1e')]('Content-Range',_0x4fbf45+'-'+_0x307be7+'/'+_0x2569bf)['json'](_0x40b602);}return null;};}function patchUpdates(_0x4dc9f9){return function(_0x48e1ec){try{jsonpatch[_0x34ee('0x1f')](_0x48e1ec,_0x4dc9f9,!![]);}catch(_0x1ed7b9){return BPromise[_0x34ee('0x20')](_0x1ed7b9);}return _0x48e1ec[_0x34ee('0x21')]();};}function saveUpdates(_0x8088c2,_0x3efcd1){return function(_0xcb04cf){if(_0xcb04cf){return _0xcb04cf[_0x34ee('0x22')](_0x8088c2)[_0x34ee('0x23')](function(_0x547848){return _0x547848;});}return null;};}function removeEntity(_0x641de6,_0x601905){return function(_0x227b1a){if(_0x227b1a){return _0x227b1a[_0x34ee('0x24')]()['then'](function(){_0x641de6[_0x34ee('0x1a')](0xcc)[_0x34ee('0x25')]();});}};}function handleEntityNotFound(_0x15d89a,_0x21d6aa){return function(_0x222512){if(!_0x222512){_0x15d89a[_0x34ee('0x26')](0x194);}return _0x222512;};}function handleError(_0x117978,_0x16b62c){_0x16b62c=_0x16b62c||0x1f4;return function(_0x3cfdc1){logger['error'](_0x3cfdc1['stack']);if(_0x3cfdc1[_0x34ee('0x27')]){delete _0x3cfdc1[_0x34ee('0x27')];}_0x117978[_0x34ee('0x1a')](_0x16b62c)[_0x34ee('0x28')](_0x3cfdc1);};}exports[_0x34ee('0x29')]=function(_0x997a55,_0x314e2c){var _0x1e329e={},_0xb2dac7={},_0x2c8e21={'count':0x0,'rows':[]};var _0x326390=_['map'](db[_0x34ee('0x2a')][_0x34ee('0x2b')],function(_0x4b8d3b){return{'name':_0x4b8d3b[_0x34ee('0x2c')],'type':_0x4b8d3b['type'][_0x34ee('0x2d')]};});_0xb2dac7[_0x34ee('0x2e')]=_['map'](_0x326390,_0x34ee('0x27'));_0xb2dac7['query']=_[_0x34ee('0x2f')](_0x997a55[_0x34ee('0x30')]);_0xb2dac7[_0x34ee('0x31')]=_['intersection'](_0xb2dac7[_0x34ee('0x2e')],_0xb2dac7[_0x34ee('0x30')]);_0x1e329e[_0x34ee('0x32')]=_[_0x34ee('0x33')](_0xb2dac7[_0x34ee('0x2e')],qs[_0x34ee('0x34')](_0x997a55['query'][_0x34ee('0x34')]));_0x1e329e[_0x34ee('0x32')]=_0x1e329e[_0x34ee('0x32')]['length']?_0x1e329e[_0x34ee('0x32')]:_0xb2dac7[_0x34ee('0x2e')];if(!_0x997a55[_0x34ee('0x30')][_0x34ee('0x35')](_0x34ee('0x36'))){_0x1e329e[_0x34ee('0x37')]=qs[_0x34ee('0x37')](_0x997a55[_0x34ee('0x30')]['limit']);_0x1e329e[_0x34ee('0x1b')]=qs[_0x34ee('0x1b')](_0x997a55[_0x34ee('0x30')]['offset']);}_0x1e329e[_0x34ee('0x38')]=qs[_0x34ee('0x39')](_0x997a55[_0x34ee('0x30')][_0x34ee('0x39')]);_0x1e329e[_0x34ee('0x3a')]=qs['filters'](_['pick'](_0x997a55[_0x34ee('0x30')],_0xb2dac7['filters']),_0x326390);if(_0x997a55[_0x34ee('0x30')]['filter']){_0x1e329e[_0x34ee('0x3a')]=_[_0x34ee('0x3b')](_0x1e329e[_0x34ee('0x3a')],{'$or':_[_0x34ee('0x3c')](_0x326390,function(_0x2a48c5){if(_0x2a48c5[_0x34ee('0x3d')]!==_0x34ee('0x3e')){var _0x1ab43a={};_0x1ab43a[_0x2a48c5[_0x34ee('0x27')]]={'$like':'%'+_0x997a55[_0x34ee('0x30')][_0x34ee('0x3f')]+'%'};return _0x1ab43a;}})});}_0x1e329e=_['merge']({},_0x1e329e,_0x997a55[_0x34ee('0x40')]);var _0x163d70={'where':_0x1e329e[_0x34ee('0x3a')]};return db[_0x34ee('0x2a')]['count'](_0x163d70)['then'](function(_0x3b17c9){_0x2c8e21[_0x34ee('0x1d')]=_0x3b17c9;if(_0x997a55[_0x34ee('0x30')]['includeAll']){_0x1e329e[_0x34ee('0x41')]=[{'all':!![]}];}return db[_0x34ee('0x2a')]['findAll'](_0x1e329e);})[_0x34ee('0x23')](function(_0x3355d9){_0x2c8e21[_0x34ee('0x42')]=_0x3355d9;return _0x2c8e21;})[_0x34ee('0x23')](respondWithFilteredResult(_0x314e2c,_0x1e329e))[_0x34ee('0x43')](handleError(_0x314e2c,null));};exports[_0x34ee('0x44')]=function(_0x267449,_0x1f5017){var _0x5aac08={'raw':!![],'where':{'id':_0x267449[_0x34ee('0x45')]['id']}},_0x654e7c={};_0x654e7c[_0x34ee('0x2e')]=_[_0x34ee('0x2f')](db[_0x34ee('0x2a')][_0x34ee('0x2b')]);_0x654e7c['query']=_[_0x34ee('0x2f')](_0x267449[_0x34ee('0x30')]);_0x654e7c[_0x34ee('0x31')]=_[_0x34ee('0x33')](_0x654e7c[_0x34ee('0x2e')],_0x654e7c['query']);_0x5aac08[_0x34ee('0x32')]=_[_0x34ee('0x33')](_0x654e7c[_0x34ee('0x2e')],qs[_0x34ee('0x34')](_0x267449[_0x34ee('0x30')][_0x34ee('0x34')]));_0x5aac08[_0x34ee('0x32')]=_0x5aac08['attributes'][_0x34ee('0x46')]?_0x5aac08[_0x34ee('0x32')]:_0x654e7c[_0x34ee('0x2e')];if(_0x267449['query'][_0x34ee('0x47')]){_0x5aac08[_0x34ee('0x41')]=[{'all':!![]}];}_0x5aac08=_[_0x34ee('0x3b')]({},_0x5aac08,_0x267449[_0x34ee('0x40')]);return db[_0x34ee('0x2a')][_0x34ee('0x48')](_0x5aac08)[_0x34ee('0x23')](handleEntityNotFound(_0x1f5017,null))[_0x34ee('0x23')](respondWithResult(_0x1f5017,null))[_0x34ee('0x43')](handleError(_0x1f5017,null));};exports[_0x34ee('0x49')]=function(_0x317113,_0x3d0e0d){return db[_0x34ee('0x2a')]['create'](_0x317113[_0x34ee('0x4a')],{})[_0x34ee('0x23')](respondWithResult(_0x3d0e0d,0xc9))[_0x34ee('0x43')](handleError(_0x3d0e0d,null));};exports['update']=function(_0x47cf0c,_0x5ee156){if(_0x47cf0c[_0x34ee('0x4a')]['id']){delete _0x47cf0c[_0x34ee('0x4a')]['id'];}return db[_0x34ee('0x2a')][_0x34ee('0x48')]({'where':{'id':_0x47cf0c[_0x34ee('0x45')]['id']}})[_0x34ee('0x23')](handleEntityNotFound(_0x5ee156,null))[_0x34ee('0x23')](saveUpdates(_0x47cf0c[_0x34ee('0x4a')],null))[_0x34ee('0x23')](respondWithResult(_0x5ee156,null))[_0x34ee('0x43')](handleError(_0x5ee156,null));};exports[_0x34ee('0x24')]=function(_0x4c65ac,_0x1d68a1){return db[_0x34ee('0x2a')][_0x34ee('0x48')]({'where':{'id':_0x4c65ac['params']['id']}})[_0x34ee('0x23')](handleEntityNotFound(_0x1d68a1,null))[_0x34ee('0x23')](removeEntity(_0x1d68a1,null))[_0x34ee('0x43')](handleError(_0x1d68a1,null));};exports[_0x34ee('0x4b')]=function(_0x955e6c,_0x46e9e6){return db[_0x34ee('0x2a')][_0x34ee('0x4b')]()[_0x34ee('0x23')](respondWithResult(_0x46e9e6,null))[_0x34ee('0x43')](handleError(_0x46e9e6,null));}; \ No newline at end of file +var _0x0908=['nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','then','include','findAll','rows','show','params','fields','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','stack','name','send','index','map','MailSubstatus','fieldName','model','query','keys','intersection','attributes','length','hasOwnProperty'];(function(_0x335dc3,_0x349fe3){var _0x5ddcc6=function(_0x940123){while(--_0x940123){_0x335dc3['push'](_0x335dc3['shift']());}};_0x5ddcc6(++_0x349fe3);}(_0x0908,0x1a8));var _0x8090=function(_0x28a03a,_0x8d22d2){_0x28a03a=_0x28a03a-0x0;var _0x519921=_0x0908[_0x28a03a];return _0x519921;};'use strict';var emlformat=require(_0x8090('0x0'));var rimraf=require(_0x8090('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8090('0x2'));var rp=require(_0x8090('0x3'));var moment=require(_0x8090('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8090('0x5'));var util=require(_0x8090('0x6'));var path=require(_0x8090('0x7'));var sox=require(_0x8090('0x8'));var csv=require(_0x8090('0x9'));var ejs=require(_0x8090('0xa'));var fs=require('fs');var fs_extra=require(_0x8090('0xb'));var _=require(_0x8090('0xc'));var squel=require(_0x8090('0xd'));var crypto=require(_0x8090('0xe'));var jsforce=require(_0x8090('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8090('0x9'));var querystring=require(_0x8090('0x10'));var Papa=require(_0x8090('0x11'));var Redis=require(_0x8090('0x12'));var authService=require(_0x8090('0x13'));var qs=require(_0x8090('0x14'));var as=require(_0x8090('0x15'));var hardwareService=require(_0x8090('0x16'));var logger=require('../../config/logger')(_0x8090('0x17'));var utils=require(_0x8090('0x18'));var config=require(_0x8090('0x19'));var licenseUtil=require(_0x8090('0x1a'));var db=require(_0x8090('0x1b'))['db'];function respondWithStatusCode(_0x1c7761,_0x559b9f){_0x559b9f=_0x559b9f||0xcc;return function(_0x3221cd){if(_0x3221cd){return _0x1c7761[_0x8090('0x1c')](_0x559b9f);}return _0x1c7761['status'](_0x559b9f)[_0x8090('0x1d')]();};}function respondWithResult(_0x2eedbd,_0xf27147){_0xf27147=_0xf27147||0xc8;return function(_0x85b2f){if(_0x85b2f){return _0x2eedbd['status'](_0xf27147)[_0x8090('0x1e')](_0x85b2f);}};}function respondWithFilteredResult(_0x5e3074,_0x4e0a61){return function(_0x3cef11){if(_0x3cef11){var _0x131762=typeof _0x4e0a61[_0x8090('0x1f')]===_0x8090('0x20')&&typeof _0x4e0a61[_0x8090('0x21')]==='undefined';var _0x4d7f19=_0x3cef11['count'];var _0x10ea27=_0x131762?0x0:_0x4e0a61[_0x8090('0x1f')];var _0x177060=_0x131762?_0x3cef11[_0x8090('0x22')]:_0x4e0a61[_0x8090('0x1f')]+_0x4e0a61[_0x8090('0x21')];var _0xa2e014;if(_0x177060>=_0x4d7f19){_0x177060=_0x4d7f19;_0xa2e014=0xc8;}else{_0xa2e014=0xce;}_0x5e3074[_0x8090('0x23')](_0xa2e014);return _0x5e3074[_0x8090('0x24')]('Content-Range',_0x10ea27+'-'+_0x177060+'/'+_0x4d7f19)[_0x8090('0x1e')](_0x3cef11);}return null;};}function patchUpdates(_0x314867){return function(_0x15aa20){try{jsonpatch[_0x8090('0x25')](_0x15aa20,_0x314867,!![]);}catch(_0x39e4f4){return BPromise[_0x8090('0x26')](_0x39e4f4);}return _0x15aa20[_0x8090('0x27')]();};}function saveUpdates(_0x2f4d5d,_0x3b5cad){return function(_0x515515){if(_0x515515){return _0x515515[_0x8090('0x28')](_0x2f4d5d)['then'](function(_0x3a918e){return _0x3a918e;});}return null;};}function removeEntity(_0x385507,_0x3869bd){return function(_0x2fb0c9){if(_0x2fb0c9){return _0x2fb0c9[_0x8090('0x29')]()['then'](function(){_0x385507[_0x8090('0x23')](0xcc)[_0x8090('0x1d')]();});}};}function handleEntityNotFound(_0x287d4a,_0x279603){return function(_0x646d5d){if(!_0x646d5d){_0x287d4a[_0x8090('0x1c')](0x194);}return _0x646d5d;};}function handleError(_0xe28849,_0x343ae2){_0x343ae2=_0x343ae2||0x1f4;return function(_0x2dc1a0){logger['error'](_0x2dc1a0[_0x8090('0x2a')]);if(_0x2dc1a0[_0x8090('0x2b')]){delete _0x2dc1a0[_0x8090('0x2b')];}_0xe28849[_0x8090('0x23')](_0x343ae2)[_0x8090('0x2c')](_0x2dc1a0);};}exports[_0x8090('0x2d')]=function(_0x1679d2,_0x5ab018){var _0x5cf7d2={},_0x3bc624={},_0x3784eb={'count':0x0,'rows':[]};var _0xc4d2d0=_[_0x8090('0x2e')](db[_0x8090('0x2f')]['rawAttributes'],function(_0x33549c){return{'name':_0x33549c[_0x8090('0x30')],'type':_0x33549c['type']['key']};});_0x3bc624[_0x8090('0x31')]=_[_0x8090('0x2e')](_0xc4d2d0,_0x8090('0x2b'));_0x3bc624[_0x8090('0x32')]=_[_0x8090('0x33')](_0x1679d2[_0x8090('0x32')]);_0x3bc624['filters']=_[_0x8090('0x34')](_0x3bc624['model'],_0x3bc624['query']);_0x5cf7d2[_0x8090('0x35')]=_[_0x8090('0x34')](_0x3bc624[_0x8090('0x31')],qs['fields'](_0x1679d2[_0x8090('0x32')]['fields']));_0x5cf7d2[_0x8090('0x35')]=_0x5cf7d2[_0x8090('0x35')][_0x8090('0x36')]?_0x5cf7d2[_0x8090('0x35')]:_0x3bc624['model'];if(!_0x1679d2['query'][_0x8090('0x37')](_0x8090('0x38'))){_0x5cf7d2[_0x8090('0x21')]=qs[_0x8090('0x21')](_0x1679d2[_0x8090('0x32')]['limit']);_0x5cf7d2[_0x8090('0x1f')]=qs[_0x8090('0x1f')](_0x1679d2['query'][_0x8090('0x1f')]);}_0x5cf7d2[_0x8090('0x39')]=qs['sort'](_0x1679d2[_0x8090('0x32')][_0x8090('0x3a')]);_0x5cf7d2['where']=qs[_0x8090('0x3b')](_[_0x8090('0x3c')](_0x1679d2[_0x8090('0x32')],_0x3bc624[_0x8090('0x3b')]),_0xc4d2d0);if(_0x1679d2[_0x8090('0x32')][_0x8090('0x3d')]){_0x5cf7d2['where']=_[_0x8090('0x3e')](_0x5cf7d2[_0x8090('0x3f')],{'$or':_[_0x8090('0x2e')](_0xc4d2d0,function(_0x53436a){if(_0x53436a[_0x8090('0x40')]!==_0x8090('0x41')){var _0x2f0206={};_0x2f0206[_0x53436a['name']]={'$like':'%'+_0x1679d2[_0x8090('0x32')][_0x8090('0x3d')]+'%'};return _0x2f0206;}})});}_0x5cf7d2=_[_0x8090('0x3e')]({},_0x5cf7d2,_0x1679d2[_0x8090('0x42')]);var _0x6b67dc={'where':_0x5cf7d2['where']};return db[_0x8090('0x2f')][_0x8090('0x22')](_0x6b67dc)[_0x8090('0x43')](function(_0x2a5e56){_0x3784eb['count']=_0x2a5e56;if(_0x1679d2['query']['includeAll']){_0x5cf7d2[_0x8090('0x44')]=[{'all':!![]}];}return db[_0x8090('0x2f')][_0x8090('0x45')](_0x5cf7d2);})[_0x8090('0x43')](function(_0x36a4da){_0x3784eb[_0x8090('0x46')]=_0x36a4da;return _0x3784eb;})[_0x8090('0x43')](respondWithFilteredResult(_0x5ab018,_0x5cf7d2))['catch'](handleError(_0x5ab018,null));};exports[_0x8090('0x47')]=function(_0x18411a,_0x3a282f){var _0x175891={'raw':!![],'where':{'id':_0x18411a[_0x8090('0x48')]['id']}},_0x3ee9d8={};_0x3ee9d8[_0x8090('0x31')]=_[_0x8090('0x33')](db[_0x8090('0x2f')]['rawAttributes']);_0x3ee9d8[_0x8090('0x32')]=_['keys'](_0x18411a['query']);_0x3ee9d8[_0x8090('0x3b')]=_[_0x8090('0x34')](_0x3ee9d8[_0x8090('0x31')],_0x3ee9d8[_0x8090('0x32')]);_0x175891[_0x8090('0x35')]=_[_0x8090('0x34')](_0x3ee9d8[_0x8090('0x31')],qs[_0x8090('0x49')](_0x18411a['query'][_0x8090('0x49')]));_0x175891[_0x8090('0x35')]=_0x175891['attributes'][_0x8090('0x36')]?_0x175891[_0x8090('0x35')]:_0x3ee9d8[_0x8090('0x31')];if(_0x18411a[_0x8090('0x32')][_0x8090('0x4a')]){_0x175891[_0x8090('0x44')]=[{'all':!![]}];}_0x175891=_['merge']({},_0x175891,_0x18411a[_0x8090('0x42')]);return db[_0x8090('0x2f')][_0x8090('0x4b')](_0x175891)[_0x8090('0x43')](handleEntityNotFound(_0x3a282f,null))[_0x8090('0x43')](respondWithResult(_0x3a282f,null))[_0x8090('0x4c')](handleError(_0x3a282f,null));};exports[_0x8090('0x4d')]=function(_0x4d8467,_0x5e6ead){return db[_0x8090('0x2f')][_0x8090('0x4d')](_0x4d8467[_0x8090('0x4e')],{})['then'](respondWithResult(_0x5e6ead,0xc9))['catch'](handleError(_0x5e6ead,null));};exports[_0x8090('0x28')]=function(_0x276fe2,_0x3246e4){if(_0x276fe2[_0x8090('0x4e')]['id']){delete _0x276fe2[_0x8090('0x4e')]['id'];}return db[_0x8090('0x2f')][_0x8090('0x4b')]({'where':{'id':_0x276fe2[_0x8090('0x48')]['id']}})['then'](handleEntityNotFound(_0x3246e4,null))['then'](saveUpdates(_0x276fe2['body'],null))[_0x8090('0x43')](respondWithResult(_0x3246e4,null))[_0x8090('0x4c')](handleError(_0x3246e4,null));};exports['destroy']=function(_0x29e66c,_0x49385c){return db['MailSubstatus'][_0x8090('0x4b')]({'where':{'id':_0x29e66c[_0x8090('0x48')]['id']}})[_0x8090('0x43')](handleEntityNotFound(_0x49385c,null))['then'](removeEntity(_0x49385c,null))[_0x8090('0x4c')](handleError(_0x49385c,null));};exports[_0x8090('0x4f')]=function(_0x35c9a6,_0x1d454a){return db[_0x8090('0x2f')][_0x8090('0x4f')]()[_0x8090('0x43')](respondWithResult(_0x1d454a,null))[_0x8090('0x4c')](handleError(_0x1d454a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 52a76be..d5567ad 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 _0x631a=['../../mysqldb','MailSubstatus','update','emit','hasOwnProperty','exports'];(function(_0x163b05,_0x1c0394){var _0x437ccd=function(_0x1d2b6e){while(--_0x1d2b6e){_0x163b05['push'](_0x163b05['shift']());}};_0x437ccd(++_0x1c0394);}(_0x631a,0x90));var _0xa631=function(_0x20f132,_0x4ee1e3){_0x20f132=_0x20f132-0x0;var _0x17218b=_0x631a[_0x20f132];return _0x17218b;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xa631('0x0'))['db'][_0xa631('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xa631('0x2')};function emitEvent(_0x9b890a){return function(_0x2d1cc7,_0x243a05,_0x148827){MailSubstatusEvents[_0xa631('0x3')](_0x9b890a+':'+_0x2d1cc7['id'],_0x2d1cc7);MailSubstatusEvents['emit'](_0x9b890a,_0x2d1cc7);_0x148827(null);};}for(var e in events){if(events[_0xa631('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xa631('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x0001=['hook','exports','events','../../mysqldb','MailSubstatus','update','emit','hasOwnProperty'];(function(_0x3911a0,_0x399077){var _0xf3dd14=function(_0x40561d){while(--_0x40561d){_0x3911a0['push'](_0x3911a0['shift']());}};_0xf3dd14(++_0x399077);}(_0x0001,0xd2));var _0x1000=function(_0x397ad5,_0x2e4ddd){_0x397ad5=_0x397ad5-0x0;var _0x162d3c=_0x0001[_0x397ad5];return _0x162d3c;};'use strict';var EventEmitter=require(_0x1000('0x0'));var MailSubstatus=require(_0x1000('0x1'))['db'][_0x1000('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x1000('0x3')};function emitEvent(_0xb1dd47){return function(_0x5378e2,_0x1797ce,_0x3328c7){MailSubstatusEvents[_0x1000('0x4')](_0xb1dd47+':'+_0x5378e2['id'],_0x5378e2);MailSubstatusEvents[_0x1000('0x4')](_0xb1dd47,_0x5378e2);_0x3328c7(null);};}for(var e in events){if(events[_0x1000('0x5')](e)){var event=events[e];MailSubstatus[_0x1000('0x6')](e,emitEvent(event));}}module[_0x1000('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5997860..b0f74a0 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 _0x4892=['update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x4892,0x1cd));var _0x2489=function(_0x5f0d47,_0x1f1ef3){_0x5f0d47=_0x5f0d47-0x0;var _0x46286c=_0x4892[_0x5f0d47];return _0x46286c;};'use strict';var attributes=require(_0x2489('0x0'));module[_0x2489('0x1')]=function(_0x55e43d){var _0x2e7fa3=_0x55e43d[_0x2489('0x2')];return _0x55e43d[_0x2489('0x3')](_0x2489('0x4'),attributes,{'tableName':_0x2489('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x455ebf,_0x19d2fc,_0x54ec07){return _0x2e7fa3[_0x2489('0x6')][_0x2489('0x7')]({'value':_0x455ebf['name']},{'where':{'field':_0x2489('0x8'),'value':_0x455ebf[_0x2489('0x9')][_0x2489('0xa')]}})[_0x2489('0xb')](function(){_0x54ec07();})[_0x2489('0xc')](function(_0x57b619){_0x54ec07(_0x57b619);});}}});}; \ No newline at end of file +var _0x213d=['name','then','catch','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x213d,0x1bc));var _0xd213=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x213d[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xd213('0x0'));module[_0xd213('0x1')]=function(_0x215fc7){var _0x4b0d2d=_0x215fc7['models'];return _0x215fc7['define'](_0xd213('0x2'),attributes,{'tableName':_0xd213('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x27a573,_0x457599,_0x354ef2){return _0x4b0d2d['Condition']['update']({'value':_0x27a573[_0xd213('0x4')]},{'where':{'field':'mailSubstatus','value':_0x27a573['_previousDataValues'][_0xd213('0x4')]}})[_0xd213('0x5')](function(){_0x354ef2();})[_0xd213('0x6')](function(_0xb7ced5){_0x354ef2(_0xb7ced5);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index acb3f8d..754458c 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 _0x53f3=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x14a281,_0x270893){var _0xbfae5f=function(_0x48888d){while(--_0x48888d){_0x14a281['push'](_0x14a281['shift']());}};_0xbfae5f(++_0x270893);}(_0x53f3,0xe0));var _0x353f=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0x53f3[_0x395155];return _0x179767;};'use strict';var _=require(_0x353f('0x0'));var util=require(_0x353f('0x1'));var moment=require(_0x353f('0x2'));var BPromise=require(_0x353f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x353f('0x4'));var db=require(_0x353f('0x5'))['db'];var utils=require(_0x353f('0x6'));var logger=require(_0x353f('0x7'))(_0x353f('0x8'));var config=require(_0x353f('0x9'));var jayson=require(_0x353f('0xa'));var client=jayson[_0x353f('0xb')][_0x353f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x226337,_0x2692d5,_0x528023){return new BPromise(function(_0x3cf8d0,_0x2c7334){return client[_0x353f('0xd')](_0x226337,_0x528023)['then'](function(_0x2f41f4){logger[_0x353f('0xe')](_0x353f('0xf'),_0x2692d5,_0x353f('0x10'));logger['debug'](_0x353f('0x11'),_0x2692d5,_0x353f('0x10'),JSON[_0x353f('0x12')](_0x2f41f4));if(_0x2f41f4[_0x353f('0x13')]){if(_0x2f41f4[_0x353f('0x13')][_0x353f('0x14')]===0x1f4){logger[_0x353f('0x13')](_0x353f('0xf'),_0x2692d5,_0x2f41f4[_0x353f('0x13')][_0x353f('0x15')]);return _0x2c7334(_0x2f41f4[_0x353f('0x13')][_0x353f('0x15')]);}logger[_0x353f('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2692d5,_0x2f41f4[_0x353f('0x13')][_0x353f('0x15')]);return _0x3cf8d0(_0x2f41f4['error'][_0x353f('0x15')]);}else{logger[_0x353f('0xe')](_0x353f('0xf'),_0x2692d5,_0x353f('0x10'));_0x3cf8d0(_0x2f41f4[_0x353f('0x16')]['message']);}})[_0x353f('0x17')](function(_0x237f71){logger[_0x353f('0x13')](_0x353f('0xf'),_0x2692d5,_0x237f71);_0x2c7334(_0x237f71);});});} \ No newline at end of file +var _0xac60=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xac60,0x199));var _0x0ac6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xac60[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0ac6('0x0'));var util=require(_0x0ac6('0x1'));var moment=require(_0x0ac6('0x2'));var BPromise=require(_0x0ac6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ac6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ac6('0x5'));var logger=require(_0x0ac6('0x6'))(_0x0ac6('0x7'));var config=require(_0x0ac6('0x8'));var jayson=require(_0x0ac6('0x9'));var client=jayson[_0x0ac6('0xa')][_0x0ac6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x407a9d,_0x24a3c0,_0x5470b0){return new BPromise(function(_0x43d1b4,_0x35b24b){return client[_0x0ac6('0xc')](_0x407a9d,_0x5470b0)[_0x0ac6('0xd')](function(_0x4d80f4){logger['info'](_0x0ac6('0xe'),_0x24a3c0,'request\x20sent');logger[_0x0ac6('0xf')](_0x0ac6('0x10'),_0x24a3c0,_0x0ac6('0x11'),JSON['stringify'](_0x4d80f4));if(_0x4d80f4[_0x0ac6('0x12')]){if(_0x4d80f4['error']['code']===0x1f4){logger[_0x0ac6('0x12')](_0x0ac6('0xe'),_0x24a3c0,_0x4d80f4[_0x0ac6('0x12')]['message']);return _0x35b24b(_0x4d80f4[_0x0ac6('0x12')][_0x0ac6('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x24a3c0,_0x4d80f4[_0x0ac6('0x12')][_0x0ac6('0x13')]);return _0x43d1b4(_0x4d80f4[_0x0ac6('0x12')][_0x0ac6('0x13')]);}else{logger[_0x0ac6('0x14')](_0x0ac6('0xe'),_0x24a3c0,_0x0ac6('0x11'));_0x43d1b4(_0x4d80f4[_0x0ac6('0x15')]['message']);}})[_0x0ac6('0x16')](function(_0x5c4d2c){logger[_0x0ac6('0x12')](_0x0ac6('0xe'),_0x24a3c0,_0x5c4d2c);_0x35b24b(_0x5c4d2c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8334bd9..dc4a955 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 _0xc771=['delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xc771,0xf9));var _0x1c77=function(_0x11390a,_0x6d6f41){_0x11390a=_0x11390a-0x0;var _0x31bc62=_0xc771[_0x11390a];return _0x31bc62;};'use strict';var multer=require('multer');var util=require(_0x1c77('0x0'));var path=require(_0x1c77('0x1'));var timeout=require(_0x1c77('0x2'));var express=require('express');var router=express[_0x1c77('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c77('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c77('0x5'));var controller=require(_0x1c77('0x6'));router[_0x1c77('0x7')]('/',auth[_0x1c77('0x8')](),controller[_0x1c77('0x9')]);router['get'](_0x1c77('0xa'),auth[_0x1c77('0x8')](),controller[_0x1c77('0xb')]);router[_0x1c77('0x7')](_0x1c77('0xc'),auth[_0x1c77('0x8')](),controller[_0x1c77('0xd')]);router[_0x1c77('0xe')]('/',auth[_0x1c77('0x8')](),controller['create']);router[_0x1c77('0xf')](_0x1c77('0xc'),auth[_0x1c77('0x8')](),controller[_0x1c77('0x10')]);router[_0x1c77('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1c77('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfb16=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x217777,_0x451ff6){var _0x4cfff1=function(_0x268d07){while(--_0x268d07){_0x217777['push'](_0x217777['shift']());}};_0x4cfff1(++_0x451ff6);}(_0xfb16,0xd4));var _0x6fb1=function(_0x342e61,_0x5d14f6){_0x342e61=_0x342e61-0x0;var _0x4fd286=_0xfb16[_0x342e61];return _0x4fd286;};'use strict';var multer=require(_0x6fb1('0x0'));var util=require('util');var path=require(_0x6fb1('0x1'));var timeout=require(_0x6fb1('0x2'));var express=require(_0x6fb1('0x3'));var router=express[_0x6fb1('0x4')]();var fs_extra=require(_0x6fb1('0x5'));var auth=require(_0x6fb1('0x6'));var interaction=require(_0x6fb1('0x7'));var config=require(_0x6fb1('0x8'));var controller=require(_0x6fb1('0x9'));router[_0x6fb1('0xa')]('/',auth[_0x6fb1('0xb')](),controller[_0x6fb1('0xc')]);router[_0x6fb1('0xa')](_0x6fb1('0xd'),auth[_0x6fb1('0xb')](),controller[_0x6fb1('0xe')]);router[_0x6fb1('0xa')](_0x6fb1('0xf'),auth['isAuthenticated'](),controller[_0x6fb1('0x10')]);router[_0x6fb1('0x11')]('/',auth[_0x6fb1('0xb')](),controller['create']);router[_0x6fb1('0x12')](_0x6fb1('0xf'),auth[_0x6fb1('0xb')](),controller['update']);router['delete'](_0x6fb1('0xf'),auth[_0x6fb1('0xb')](),controller[_0x6fb1('0x13')]);module[_0x6fb1('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6df3d66..c1d60c0 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x45829c,_0x318a74){_0x45829c=_0x45829c-0x0;var _0x12ec52=_0xb43b[_0x45829c];return _0x12ec52;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5a511c,_0xf1975e){var _0x497b55=function(_0x4794f2){while(--_0x4794f2){_0x5a511c['push'](_0x5a511c['shift']());}};_0x497b55(++_0xf1975e);}(_0xedd9,0xfc));var _0x9edd=function(_0x53cedd,_0x1413c9){_0x53cedd=_0x53cedd-0x0;var _0xe52eb2=_0xedd9[_0x53cedd];return _0xe52eb2;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5b9e39a..5868a8a 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 _0xa337=['includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','then','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa337,0x1c0));var _0x7a33=function(_0x3f1ec6,_0x47a292){_0x3f1ec6=_0x3f1ec6-0x0;var _0x507638=_0xa337[_0x3f1ec6];return _0x507638;};'use strict';var emlformat=require(_0x7a33('0x0'));var rimraf=require(_0x7a33('0x1'));var zipdir=require(_0x7a33('0x2'));var jsonpatch=require(_0x7a33('0x3'));var rp=require('request-promise');var moment=require(_0x7a33('0x4'));var BPromise=require(_0x7a33('0x5'));var Mustache=require(_0x7a33('0x6'));var util=require(_0x7a33('0x7'));var path=require(_0x7a33('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a33('0x9'));var fs=require('fs');var fs_extra=require(_0x7a33('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7a33('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7a33('0xc'));var toCsv=require(_0x7a33('0xd'));var querystring=require('querystring');var Papa=require(_0x7a33('0xe'));var Redis=require(_0x7a33('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a33('0x10'));var as=require(_0x7a33('0x11'));var hardwareService=require(_0x7a33('0x12'));var logger=require(_0x7a33('0x13'))('api');var utils=require(_0x7a33('0x14'));var config=require(_0x7a33('0x15'));var licenseUtil=require(_0x7a33('0x16'));var db=require(_0x7a33('0x17'))['db'];function respondWithStatusCode(_0x12965a,_0x59e9e9){_0x59e9e9=_0x59e9e9||0xcc;return function(_0x4708ee){if(_0x4708ee){return _0x12965a[_0x7a33('0x18')](_0x59e9e9);}return _0x12965a[_0x7a33('0x19')](_0x59e9e9)[_0x7a33('0x1a')]();};}function respondWithResult(_0x306190,_0x4991d7){_0x4991d7=_0x4991d7||0xc8;return function(_0x45d320){if(_0x45d320){return _0x306190[_0x7a33('0x19')](_0x4991d7)[_0x7a33('0x1b')](_0x45d320);}};}function respondWithFilteredResult(_0x5b81c9,_0x5f20f2){return function(_0x4c7dd5){if(_0x4c7dd5){var _0x37c87a=typeof _0x5f20f2['offset']===_0x7a33('0x1c')&&typeof _0x5f20f2[_0x7a33('0x1d')]===_0x7a33('0x1c');var _0x74edd0=_0x4c7dd5['count'];var _0x274b8d=_0x37c87a?0x0:_0x5f20f2[_0x7a33('0x1e')];var _0x15a7db=_0x37c87a?_0x4c7dd5[_0x7a33('0x1f')]:_0x5f20f2['offset']+_0x5f20f2[_0x7a33('0x1d')];var _0x4b6c49;if(_0x15a7db>=_0x74edd0){_0x15a7db=_0x74edd0;_0x4b6c49=0xc8;}else{_0x4b6c49=0xce;}_0x5b81c9[_0x7a33('0x19')](_0x4b6c49);return _0x5b81c9[_0x7a33('0x20')]('Content-Range',_0x274b8d+'-'+_0x15a7db+'/'+_0x74edd0)[_0x7a33('0x1b')](_0x4c7dd5);}return null;};}function patchUpdates(_0x217108){return function(_0x5d7c8a){try{jsonpatch[_0x7a33('0x21')](_0x5d7c8a,_0x217108,!![]);}catch(_0x35c485){return BPromise[_0x7a33('0x22')](_0x35c485);}return _0x5d7c8a[_0x7a33('0x23')]();};}function saveUpdates(_0x3b0f03,_0xbc6b09){return function(_0x43af25){if(_0x43af25){return _0x43af25[_0x7a33('0x24')](_0x3b0f03)['then'](function(_0x282409){return _0x282409;});}return null;};}function removeEntity(_0xcc5a8b,_0xaff149){return function(_0x28b799){if(_0x28b799){return _0x28b799[_0x7a33('0x25')]()[_0x7a33('0x26')](function(){_0xcc5a8b[_0x7a33('0x19')](0xcc)[_0x7a33('0x1a')]();});}};}function handleEntityNotFound(_0x21dc70,_0x11f60c){return function(_0x314ad1){if(!_0x314ad1){_0x21dc70[_0x7a33('0x18')](0x194);}return _0x314ad1;};}function handleError(_0x245d82,_0x25ad93){_0x25ad93=_0x25ad93||0x1f4;return function(_0x1f038e){logger[_0x7a33('0x27')](_0x1f038e['stack']);if(_0x1f038e['name']){delete _0x1f038e[_0x7a33('0x28')];}_0x245d82[_0x7a33('0x19')](_0x25ad93)[_0x7a33('0x29')](_0x1f038e);};}exports['index']=function(_0x454be1,_0x5a096e){var _0x44857c={},_0x4603cf={},_0x3aa572={'count':0x0,'rows':[]};var _0x31aef1=_[_0x7a33('0x2a')](db[_0x7a33('0x2b')][_0x7a33('0x2c')],function(_0x178bee){return{'name':_0x178bee[_0x7a33('0x2d')],'type':_0x178bee[_0x7a33('0x2e')][_0x7a33('0x2f')]};});_0x4603cf['model']=_[_0x7a33('0x2a')](_0x31aef1,_0x7a33('0x28'));_0x4603cf[_0x7a33('0x30')]=_[_0x7a33('0x31')](_0x454be1['query']);_0x4603cf['filters']=_[_0x7a33('0x32')](_0x4603cf['model'],_0x4603cf[_0x7a33('0x30')]);_0x44857c[_0x7a33('0x33')]=_[_0x7a33('0x32')](_0x4603cf[_0x7a33('0x34')],qs[_0x7a33('0x35')](_0x454be1[_0x7a33('0x30')][_0x7a33('0x35')]));_0x44857c['attributes']=_0x44857c['attributes'][_0x7a33('0x36')]?_0x44857c[_0x7a33('0x33')]:_0x4603cf[_0x7a33('0x34')];if(!_0x454be1['query'][_0x7a33('0x37')]('nolimit')){_0x44857c[_0x7a33('0x1d')]=qs[_0x7a33('0x1d')](_0x454be1[_0x7a33('0x30')][_0x7a33('0x1d')]);_0x44857c['offset']=qs['offset'](_0x454be1[_0x7a33('0x30')][_0x7a33('0x1e')]);}_0x44857c['order']=qs[_0x7a33('0x38')](_0x454be1['query'][_0x7a33('0x38')]);_0x44857c['where']=qs[_0x7a33('0x39')](_['pick'](_0x454be1[_0x7a33('0x30')],_0x4603cf[_0x7a33('0x39')]),_0x31aef1);if(_0x454be1[_0x7a33('0x30')][_0x7a33('0x3a')]){_0x44857c[_0x7a33('0x3b')]=_[_0x7a33('0x3c')](_0x44857c[_0x7a33('0x3b')],{'$or':_[_0x7a33('0x2a')](_0x31aef1,function(_0x359ef3){if(_0x359ef3[_0x7a33('0x2e')]!==_0x7a33('0x3d')){var _0x1eef92={};_0x1eef92[_0x359ef3[_0x7a33('0x28')]]={'$like':'%'+_0x454be1[_0x7a33('0x30')][_0x7a33('0x3a')]+'%'};return _0x1eef92;}})});}_0x44857c=_[_0x7a33('0x3c')]({},_0x44857c,_0x454be1[_0x7a33('0x3e')]);var _0x2f1e58={'where':_0x44857c['where']};return db[_0x7a33('0x2b')][_0x7a33('0x1f')](_0x2f1e58)['then'](function(_0x5f1338){_0x3aa572['count']=_0x5f1338;if(_0x454be1['query'][_0x7a33('0x3f')]){_0x44857c[_0x7a33('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x44857c);})[_0x7a33('0x26')](function(_0x424486){_0x3aa572[_0x7a33('0x41')]=_0x424486;return _0x3aa572;})['then'](respondWithFilteredResult(_0x5a096e,_0x44857c))[_0x7a33('0x42')](handleError(_0x5a096e,null));};exports[_0x7a33('0x43')]=function(_0x113bc0,_0x2a1368){var _0x1f2a80={'raw':!![],'where':{'id':_0x113bc0['params']['id']}},_0x4956ed={};_0x4956ed['model']=_[_0x7a33('0x31')](db[_0x7a33('0x2b')][_0x7a33('0x2c')]);_0x4956ed['query']=_['keys'](_0x113bc0[_0x7a33('0x30')]);_0x4956ed[_0x7a33('0x39')]=_[_0x7a33('0x32')](_0x4956ed[_0x7a33('0x34')],_0x4956ed[_0x7a33('0x30')]);_0x1f2a80[_0x7a33('0x33')]=_[_0x7a33('0x32')](_0x4956ed[_0x7a33('0x34')],qs[_0x7a33('0x35')](_0x113bc0['query'][_0x7a33('0x35')]));_0x1f2a80[_0x7a33('0x33')]=_0x1f2a80[_0x7a33('0x33')][_0x7a33('0x36')]?_0x1f2a80['attributes']:_0x4956ed[_0x7a33('0x34')];if(_0x113bc0[_0x7a33('0x30')][_0x7a33('0x3f')]){_0x1f2a80[_0x7a33('0x40')]=[{'all':!![]}];}_0x1f2a80=_[_0x7a33('0x3c')]({},_0x1f2a80,_0x113bc0[_0x7a33('0x3e')]);return db[_0x7a33('0x2b')][_0x7a33('0x44')](_0x1f2a80)[_0x7a33('0x26')](handleEntityNotFound(_0x2a1368,null))['then'](respondWithResult(_0x2a1368,null))[_0x7a33('0x42')](handleError(_0x2a1368,null));};exports[_0x7a33('0x45')]=function(_0x133e20,_0x582e4e){return db[_0x7a33('0x2b')]['create'](_0x133e20[_0x7a33('0x46')],{})[_0x7a33('0x26')](respondWithResult(_0x582e4e,0xc9))[_0x7a33('0x42')](handleError(_0x582e4e,null));};exports['update']=function(_0x363089,_0xef13bc){if(_0x363089[_0x7a33('0x46')]['id']){delete _0x363089['body']['id'];}return db[_0x7a33('0x2b')][_0x7a33('0x44')]({'where':{'id':_0x363089[_0x7a33('0x47')]['id']}})[_0x7a33('0x26')](handleEntityNotFound(_0xef13bc,null))[_0x7a33('0x26')](saveUpdates(_0x363089[_0x7a33('0x46')],null))[_0x7a33('0x26')](respondWithResult(_0xef13bc,null))[_0x7a33('0x42')](handleError(_0xef13bc,null));};exports[_0x7a33('0x25')]=function(_0x19cd83,_0x2e1b7f){return db[_0x7a33('0x2b')][_0x7a33('0x44')]({'where':{'id':_0x19cd83[_0x7a33('0x47')]['id']}})[_0x7a33('0x26')](handleEntityNotFound(_0x2e1b7f,null))[_0x7a33('0x26')](removeEntity(_0x2e1b7f,null))[_0x7a33('0x42')](handleError(_0x2e1b7f,null));};exports[_0x7a33('0x48')]=function(_0x4e53d3,_0x8e8efc){return db[_0x7a33('0x2b')][_0x7a33('0x48')]()[_0x7a33('0x26')](respondWithResult(_0x8e8efc,null))[_0x7a33('0x42')](handleError(_0x8e8efc,null));}; \ No newline at end of file +var _0x734e=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','params','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x5b28e0,_0x67359){var _0x1bdcb1=function(_0x195148){while(--_0x195148){_0x5b28e0['push'](_0x5b28e0['shift']());}};_0x1bdcb1(++_0x67359);}(_0x734e,0x158));var _0xe734=function(_0x1acc01,_0x5cb80c){_0x1acc01=_0x1acc01-0x0;var _0x5603f1=_0x734e[_0x1acc01];return _0x5603f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe734('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe734('0x1'));var rp=require(_0xe734('0x2'));var moment=require(_0xe734('0x3'));var BPromise=require(_0xe734('0x4'));var Mustache=require(_0xe734('0x5'));var util=require(_0xe734('0x6'));var path=require(_0xe734('0x7'));var sox=require('sox');var csv=require(_0xe734('0x8'));var ejs=require(_0xe734('0x9'));var fs=require('fs');var fs_extra=require(_0xe734('0xa'));var _=require(_0xe734('0xb'));var squel=require(_0xe734('0xc'));var crypto=require(_0xe734('0xd'));var jsforce=require(_0xe734('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe734('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe734('0xf'));var authService=require(_0xe734('0x10'));var qs=require(_0xe734('0x11'));var as=require(_0xe734('0x12'));var hardwareService=require(_0xe734('0x13'));var logger=require(_0xe734('0x14'))(_0xe734('0x15'));var utils=require(_0xe734('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe734('0x17'));var db=require(_0xe734('0x18'))['db'];function respondWithStatusCode(_0x4198cc,_0x26d774){_0x26d774=_0x26d774||0xcc;return function(_0x20b23b){if(_0x20b23b){return _0x4198cc[_0xe734('0x19')](_0x26d774);}return _0x4198cc[_0xe734('0x1a')](_0x26d774)['end']();};}function respondWithResult(_0x4985c7,_0x3ee125){_0x3ee125=_0x3ee125||0xc8;return function(_0xf12cfd){if(_0xf12cfd){return _0x4985c7[_0xe734('0x1a')](_0x3ee125)[_0xe734('0x1b')](_0xf12cfd);}};}function respondWithFilteredResult(_0x1fe0a0,_0x578d06){return function(_0x1c9ec9){if(_0x1c9ec9){var _0x1427df=typeof _0x578d06['offset']==='undefined'&&typeof _0x578d06[_0xe734('0x1c')]===_0xe734('0x1d');var _0x2e0b3f=_0x1c9ec9[_0xe734('0x1e')];var _0x22d620=_0x1427df?0x0:_0x578d06[_0xe734('0x1f')];var _0x33822c=_0x1427df?_0x1c9ec9[_0xe734('0x1e')]:_0x578d06['offset']+_0x578d06[_0xe734('0x1c')];var _0x85e93f;if(_0x33822c>=_0x2e0b3f){_0x33822c=_0x2e0b3f;_0x85e93f=0xc8;}else{_0x85e93f=0xce;}_0x1fe0a0[_0xe734('0x1a')](_0x85e93f);return _0x1fe0a0[_0xe734('0x20')](_0xe734('0x21'),_0x22d620+'-'+_0x33822c+'/'+_0x2e0b3f)[_0xe734('0x1b')](_0x1c9ec9);}return null;};}function patchUpdates(_0xc9bfc2){return function(_0x57b45a){try{jsonpatch[_0xe734('0x22')](_0x57b45a,_0xc9bfc2,!![]);}catch(_0x691446){return BPromise[_0xe734('0x23')](_0x691446);}return _0x57b45a[_0xe734('0x24')]();};}function saveUpdates(_0x44097a,_0x73e2fc){return function(_0x11cb27){if(_0x11cb27){return _0x11cb27[_0xe734('0x25')](_0x44097a)['then'](function(_0x289009){return _0x289009;});}return null;};}function removeEntity(_0x1b74bf,_0x3e63cd){return function(_0x102dc9){if(_0x102dc9){return _0x102dc9[_0xe734('0x26')]()['then'](function(){_0x1b74bf[_0xe734('0x1a')](0xcc)[_0xe734('0x27')]();});}};}function handleEntityNotFound(_0x3b6c37,_0x154cfc){return function(_0x42c48c){if(!_0x42c48c){_0x3b6c37[_0xe734('0x19')](0x194);}return _0x42c48c;};}function handleError(_0x137409,_0x2cd584){_0x2cd584=_0x2cd584||0x1f4;return function(_0x1ae2c5){logger[_0xe734('0x28')](_0x1ae2c5[_0xe734('0x29')]);if(_0x1ae2c5[_0xe734('0x2a')]){delete _0x1ae2c5[_0xe734('0x2a')];}_0x137409[_0xe734('0x1a')](_0x2cd584)[_0xe734('0x2b')](_0x1ae2c5);};}exports[_0xe734('0x2c')]=function(_0x17390b,_0xd5ec8b){var _0x341b91={},_0x1ae35f={},_0x54a052={'count':0x0,'rows':[]};var _0x1e6c56=_[_0xe734('0x2d')](db[_0xe734('0x2e')][_0xe734('0x2f')],function(_0x58bb7a){return{'name':_0x58bb7a[_0xe734('0x30')],'type':_0x58bb7a[_0xe734('0x31')][_0xe734('0x32')]};});_0x1ae35f[_0xe734('0x33')]=_[_0xe734('0x2d')](_0x1e6c56,_0xe734('0x2a'));_0x1ae35f['query']=_[_0xe734('0x34')](_0x17390b[_0xe734('0x35')]);_0x1ae35f[_0xe734('0x36')]=_[_0xe734('0x37')](_0x1ae35f['model'],_0x1ae35f[_0xe734('0x35')]);_0x341b91[_0xe734('0x38')]=_['intersection'](_0x1ae35f[_0xe734('0x33')],qs[_0xe734('0x39')](_0x17390b[_0xe734('0x35')][_0xe734('0x39')]));_0x341b91[_0xe734('0x38')]=_0x341b91['attributes'][_0xe734('0x3a')]?_0x341b91[_0xe734('0x38')]:_0x1ae35f['model'];if(!_0x17390b[_0xe734('0x35')][_0xe734('0x3b')](_0xe734('0x3c'))){_0x341b91[_0xe734('0x1c')]=qs[_0xe734('0x1c')](_0x17390b[_0xe734('0x35')][_0xe734('0x1c')]);_0x341b91[_0xe734('0x1f')]=qs['offset'](_0x17390b[_0xe734('0x35')][_0xe734('0x1f')]);}_0x341b91[_0xe734('0x3d')]=qs['sort'](_0x17390b['query'][_0xe734('0x3e')]);_0x341b91[_0xe734('0x3f')]=qs[_0xe734('0x36')](_[_0xe734('0x40')](_0x17390b[_0xe734('0x35')],_0x1ae35f[_0xe734('0x36')]),_0x1e6c56);if(_0x17390b[_0xe734('0x35')][_0xe734('0x41')]){_0x341b91[_0xe734('0x3f')]=_[_0xe734('0x42')](_0x341b91['where'],{'$or':_['map'](_0x1e6c56,function(_0x194bee){if(_0x194bee[_0xe734('0x31')]!==_0xe734('0x43')){var _0x2f3685={};_0x2f3685[_0x194bee[_0xe734('0x2a')]]={'$like':'%'+_0x17390b[_0xe734('0x35')]['filter']+'%'};return _0x2f3685;}})});}_0x341b91=_[_0xe734('0x42')]({},_0x341b91,_0x17390b['options']);var _0x44b301={'where':_0x341b91[_0xe734('0x3f')]};return db[_0xe734('0x2e')][_0xe734('0x1e')](_0x44b301)[_0xe734('0x44')](function(_0x11346f){_0x54a052['count']=_0x11346f;if(_0x17390b['query'][_0xe734('0x45')]){_0x341b91[_0xe734('0x46')]=[{'all':!![]}];}return db[_0xe734('0x2e')]['findAll'](_0x341b91);})['then'](function(_0x5afd2a){_0x54a052[_0xe734('0x47')]=_0x5afd2a;return _0x54a052;})[_0xe734('0x44')](respondWithFilteredResult(_0xd5ec8b,_0x341b91))[_0xe734('0x48')](handleError(_0xd5ec8b,null));};exports[_0xe734('0x49')]=function(_0xaf1e1e,_0x563c44){var _0x5b6f90={'raw':!![],'where':{'id':_0xaf1e1e[_0xe734('0x4a')]['id']}},_0x5acf78={};_0x5acf78[_0xe734('0x33')]=_['keys'](db[_0xe734('0x2e')][_0xe734('0x2f')]);_0x5acf78[_0xe734('0x35')]=_[_0xe734('0x34')](_0xaf1e1e[_0xe734('0x35')]);_0x5acf78[_0xe734('0x36')]=_[_0xe734('0x37')](_0x5acf78[_0xe734('0x33')],_0x5acf78[_0xe734('0x35')]);_0x5b6f90[_0xe734('0x38')]=_[_0xe734('0x37')](_0x5acf78[_0xe734('0x33')],qs[_0xe734('0x39')](_0xaf1e1e[_0xe734('0x35')][_0xe734('0x39')]));_0x5b6f90[_0xe734('0x38')]=_0x5b6f90[_0xe734('0x38')][_0xe734('0x3a')]?_0x5b6f90[_0xe734('0x38')]:_0x5acf78[_0xe734('0x33')];if(_0xaf1e1e[_0xe734('0x35')][_0xe734('0x45')]){_0x5b6f90[_0xe734('0x46')]=[{'all':!![]}];}_0x5b6f90=_['merge']({},_0x5b6f90,_0xaf1e1e[_0xe734('0x4b')]);return db[_0xe734('0x2e')][_0xe734('0x4c')](_0x5b6f90)[_0xe734('0x44')](handleEntityNotFound(_0x563c44,null))[_0xe734('0x44')](respondWithResult(_0x563c44,null))['catch'](handleError(_0x563c44,null));};exports[_0xe734('0x4d')]=function(_0x284ccf,_0x2b61e6){return db['MailTransferReport']['create'](_0x284ccf[_0xe734('0x4e')],{})[_0xe734('0x44')](respondWithResult(_0x2b61e6,0xc9))['catch'](handleError(_0x2b61e6,null));};exports[_0xe734('0x25')]=function(_0x52469f,_0x1a211d){if(_0x52469f[_0xe734('0x4e')]['id']){delete _0x52469f[_0xe734('0x4e')]['id'];}return db['MailTransferReport'][_0xe734('0x4c')]({'where':{'id':_0x52469f[_0xe734('0x4a')]['id']}})[_0xe734('0x44')](handleEntityNotFound(_0x1a211d,null))[_0xe734('0x44')](saveUpdates(_0x52469f[_0xe734('0x4e')],null))[_0xe734('0x44')](respondWithResult(_0x1a211d,null))[_0xe734('0x48')](handleError(_0x1a211d,null));};exports['destroy']=function(_0xfbc815,_0x4c2159){return db[_0xe734('0x2e')][_0xe734('0x4c')]({'where':{'id':_0xfbc815[_0xe734('0x4a')]['id']}})[_0xe734('0x44')](handleEntityNotFound(_0x4c2159,null))[_0xe734('0x44')](removeEntity(_0x4c2159,null))[_0xe734('0x48')](handleError(_0x4c2159,null));};exports[_0xe734('0x4f')]=function(_0x46639e,_0x2aa0b8){return db['MailTransferReport']['describe']()[_0xe734('0x44')](respondWithResult(_0x2aa0b8,null))['catch'](handleError(_0x2aa0b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4103d22..8fa8bc4 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 _0xc492=['../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x4e59e8,_0x4cb70a){var _0x5f8aa=function(_0x49887a){while(--_0x49887a){_0x4e59e8['push'](_0x4e59e8['shift']());}};_0x5f8aa(++_0x4cb70a);}(_0xc492,0xd7));var _0x2c49=function(_0x4d3096,_0x2edfa5){_0x4d3096=_0x4d3096-0x0;var _0xd68839=_0xc492[_0x4d3096];return _0xd68839;};'use strict';var _=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var logger=require(_0x2c49('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2c49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c49('0x4'));var config=require(_0x2c49('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0x2c49('0x6')]=function(_0x499c4e,_0x3ad911){return _0x499c4e[_0x2c49('0x7')]('MailTransferReport',attributes,{'tableName':_0x2c49('0x8'),'paranoid':![],'indexes':[{'name':_0x2c49('0x9'),'fields':[_0x2c49('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3d1=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xbad110,_0x3bf3a7){var _0x5e94af=function(_0x46c9c2){while(--_0x46c9c2){_0xbad110['push'](_0xbad110['shift']());}};_0x5e94af(++_0x3bf3a7);}(_0xa3d1,0x126));var _0x1a3d=function(_0xaee481,_0x3dc091){_0xaee481=_0xaee481-0x0;var _0x54893a=_0xa3d1[_0xaee481];return _0x54893a;};'use strict';var _=require(_0x1a3d('0x0'));var util=require(_0x1a3d('0x1'));var logger=require(_0x1a3d('0x2'))('api');var moment=require(_0x1a3d('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a3d('0x4'));var fs=require('fs');var path=require(_0x1a3d('0x5'));var rimraf=require(_0x1a3d('0x6'));var config=require(_0x1a3d('0x7'));var attributes=require(_0x1a3d('0x8'));module[_0x1a3d('0x9')]=function(_0x3a4a57,_0x144a93){return _0x3a4a57['define'](_0x1a3d('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x1a3d('0xb'),'fields':[_0x1a3d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e55f88b..3bd85f8 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 _0xff97=['request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','MailTransferReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x43130c,_0x1a0e3e){var _0x570f1a=function(_0x4d2eca){while(--_0x4d2eca){_0x43130c['push'](_0x43130c['shift']());}};_0x570f1a(++_0x1a0e3e);}(_0xff97,0x17c));var _0x7ff9=function(_0x2435a5,_0x33069f){_0x2435a5=_0x2435a5-0x0;var _0x45cb35=_0xff97[_0x2435a5];return _0x45cb35;};'use strict';var _=require(_0x7ff9('0x0'));var util=require(_0x7ff9('0x1'));var moment=require(_0x7ff9('0x2'));var BPromise=require(_0x7ff9('0x3'));var rs=require(_0x7ff9('0x4'));var fs=require('fs');var Redis=require(_0x7ff9('0x5'));var db=require(_0x7ff9('0x6'))['db'];var utils=require(_0x7ff9('0x7'));var logger=require('../../config/logger')(_0x7ff9('0x8'));var config=require('../../config/environment');var jayson=require(_0x7ff9('0x9'));var client=jayson[_0x7ff9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5dc8,_0x2dcc2d,_0x4c64e0){return new BPromise(function(_0x51bed5,_0xd44039){return client[_0x7ff9('0xb')](_0x4b5dc8,_0x4c64e0)[_0x7ff9('0xc')](function(_0x205dd0){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2dcc2d,_0x7ff9('0xd'));logger[_0x7ff9('0xe')](_0x7ff9('0xf'),_0x2dcc2d,'request\x20sent',JSON['stringify'](_0x205dd0));if(_0x205dd0[_0x7ff9('0x10')]){if(_0x205dd0[_0x7ff9('0x10')][_0x7ff9('0x11')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2dcc2d,_0x205dd0[_0x7ff9('0x10')]['message']);return _0xd44039(_0x205dd0[_0x7ff9('0x10')][_0x7ff9('0x12')]);}logger[_0x7ff9('0x10')](_0x7ff9('0x13'),_0x2dcc2d,_0x205dd0[_0x7ff9('0x10')][_0x7ff9('0x12')]);return _0x51bed5(_0x205dd0[_0x7ff9('0x10')][_0x7ff9('0x12')]);}else{logger[_0x7ff9('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x2dcc2d,_0x7ff9('0xd'));_0x51bed5(_0x205dd0[_0x7ff9('0x15')][_0x7ff9('0x12')]);}})[_0x7ff9('0x16')](function(_0x19b209){logger[_0x7ff9('0x10')](_0x7ff9('0x13'),_0x2dcc2d,_0x19b209);_0xd44039(_0x19b209);});});} \ No newline at end of file +var _0x6c22=['request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x5b94fd,_0x4d9684){var _0x4a64e4=function(_0xf752ec){while(--_0xf752ec){_0x5b94fd['push'](_0x5b94fd['shift']());}};_0x4a64e4(++_0x4d9684);}(_0x6c22,0x1bc));var _0x26c2=function(_0x3fb23b,_0x4ee81f){_0x3fb23b=_0x3fb23b-0x0;var _0xc01a25=_0x6c22[_0x3fb23b];return _0xc01a25;};'use strict';var _=require(_0x26c2('0x0'));var util=require(_0x26c2('0x1'));var moment=require(_0x26c2('0x2'));var BPromise=require(_0x26c2('0x3'));var rs=require(_0x26c2('0x4'));var fs=require('fs');var Redis=require(_0x26c2('0x5'));var db=require(_0x26c2('0x6'))['db'];var utils=require(_0x26c2('0x7'));var logger=require('../../config/logger')(_0x26c2('0x8'));var config=require(_0x26c2('0x9'));var jayson=require(_0x26c2('0xa'));var client=jayson[_0x26c2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174c64,_0x1e75aa,_0x14dd1c){return new BPromise(function(_0x125b6e,_0x31e86){return client[_0x26c2('0xc')](_0x174c64,_0x14dd1c)[_0x26c2('0xd')](function(_0x372bd6){logger[_0x26c2('0xe')](_0x26c2('0xf'),_0x1e75aa,_0x26c2('0x10'));logger['debug'](_0x26c2('0x11'),_0x1e75aa,_0x26c2('0x10'),JSON[_0x26c2('0x12')](_0x372bd6));if(_0x372bd6[_0x26c2('0x13')]){if(_0x372bd6[_0x26c2('0x13')][_0x26c2('0x14')]===0x1f4){logger[_0x26c2('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1e75aa,_0x372bd6['error'][_0x26c2('0x15')]);return _0x31e86(_0x372bd6[_0x26c2('0x13')][_0x26c2('0x15')]);}logger['error'](_0x26c2('0xf'),_0x1e75aa,_0x372bd6[_0x26c2('0x13')][_0x26c2('0x15')]);return _0x125b6e(_0x372bd6[_0x26c2('0x13')][_0x26c2('0x15')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x1e75aa,_0x26c2('0x10'));_0x125b6e(_0x372bd6['result']['message']);}})[_0x26c2('0x16')](function(_0x4cf088){logger[_0x26c2('0x13')](_0x26c2('0xf'),_0x1e75aa,_0x4cf088);_0x31e86(_0x4cf088);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 02e5e4d..f4b1f80 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 _0x7661=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x46fcf2,_0x2e8341){var _0x5258c1=function(_0xe0f26b){while(--_0xe0f26b){_0x46fcf2['push'](_0x46fcf2['shift']());}};_0x5258c1(++_0x2e8341);}(_0x7661,0x1c8));var _0x1766=function(_0x27e226,_0x4a1d20){_0x27e226=_0x27e226-0x0;var _0x16c724=_0x7661[_0x27e226];return _0x16c724;};'use strict';var multer=require(_0x1766('0x0'));var util=require(_0x1766('0x1'));var path=require('path');var timeout=require(_0x1766('0x2'));var express=require(_0x1766('0x3'));var router=express[_0x1766('0x4')]();var fs_extra=require(_0x1766('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1766('0x6'));var config=require(_0x1766('0x7'));var controller=require(_0x1766('0x8'));router[_0x1766('0x9')]('/',auth['isAuthenticated'](),controller[_0x1766('0xa')]);router[_0x1766('0x9')](_0x1766('0xb'),auth[_0x1766('0xc')](),controller[_0x1766('0xd')]);router[_0x1766('0x9')]('/:id',auth[_0x1766('0xc')](),controller[_0x1766('0xe')]);router[_0x1766('0xf')]('/',auth['isAuthenticated'](),controller[_0x1766('0x10')]);router[_0x1766('0x11')](_0x1766('0x12'),auth[_0x1766('0xc')](),controller[_0x1766('0x13')]);router['delete'](_0x1766('0x12'),auth['isAuthenticated'](),controller[_0x1766('0x14')]);module[_0x1766('0x15')]=router; \ No newline at end of file +var _0xdaab=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','util','path','express'];(function(_0xb1ccbe,_0x4ed22c){var _0x11033b=function(_0x27cf25){while(--_0x27cf25){_0xb1ccbe['push'](_0xb1ccbe['shift']());}};_0x11033b(++_0x4ed22c);}(_0xdaab,0x1dd));var _0xbdaa=function(_0x4a6cb7,_0x48a3d5){_0x4a6cb7=_0x4a6cb7-0x0;var _0x3cc689=_0xdaab[_0x4a6cb7];return _0x3cc689;};'use strict';var multer=require('multer');var util=require(_0xbdaa('0x0'));var path=require(_0xbdaa('0x1'));var timeout=require('connect-timeout');var express=require(_0xbdaa('0x2'));var router=express['Router']();var fs_extra=require(_0xbdaa('0x3'));var auth=require(_0xbdaa('0x4'));var interaction=require(_0xbdaa('0x5'));var config=require(_0xbdaa('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbdaa('0x7')]);router[_0xbdaa('0x8')](_0xbdaa('0x9'),auth[_0xbdaa('0xa')](),controller[_0xbdaa('0xb')]);router[_0xbdaa('0x8')]('/:id',auth[_0xbdaa('0xa')](),controller['show']);router[_0xbdaa('0xc')]('/',auth[_0xbdaa('0xa')](),controller[_0xbdaa('0xd')]);router[_0xbdaa('0xe')](_0xbdaa('0xf'),auth[_0xbdaa('0xa')](),controller[_0xbdaa('0x10')]);router[_0xbdaa('0x11')](_0xbdaa('0xf'),auth[_0xbdaa('0xa')](),controller[_0xbdaa('0x12')]);module[_0xbdaa('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index fbff4ea..fb9f76c 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 _0xcfc6=['diff','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xcfc6,0x16e));var _0x6cfc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfc6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6cfc('0x0'));var moment=require(_0x6cfc('0x1'));module[_0x6cfc('0x2')]={'channel':{'type':Sequelize[_0x6cfc('0x3')]},'membername':{'type':Sequelize[_0x6cfc('0x3')]},'interface':{'type':Sequelize[_0x6cfc('0x3')]},'type':{'type':Sequelize[_0x6cfc('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x6cfc('0x4')},'duration':{'type':Sequelize[_0x6cfc('0x5')]},'enterAt':{'type':Sequelize[_0x6cfc('0x6')]},'exitAt':{'type':Sequelize[_0x6cfc('0x6')],'set':function(_0xcbebe5){var _0x35cdf4=moment(_0xcbebe5);var _0x43fb56=moment(this[_0x6cfc('0x7')](_0x6cfc('0x8')));var _0x2c7741=_0x35cdf4[_0x6cfc('0x9')](_0x43fb56,'seconds');this[_0x6cfc('0xa')](_0x6cfc('0xb'),_0xcbebe5);this['setDataValue'](_0x6cfc('0xc'),_0x2c7741>=0x0?_0x2c7741:null);}},'data1':{'type':Sequelize[_0x6cfc('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x6cfc('0x3')],'comment':_0x6cfc('0xd')},'data3':{'type':Sequelize[_0x6cfc('0x3')],'comment':_0x6cfc('0xe')},'data4':{'type':Sequelize[_0x6cfc('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6cfc('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x6cfc('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x6cfc('0x3')]}}; \ No newline at end of file +var _0x88ce=['exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x1d98a7,_0x3c9405){var _0x3d573f=function(_0x39e6ef){while(--_0x39e6ef){_0x1d98a7['push'](_0x1d98a7['shift']());}};_0x3d573f(++_0x3c9405);}(_0x88ce,0x1ee));var _0xe88c=function(_0xd06ea2,_0x4e0693){_0xd06ea2=_0xd06ea2-0x0;var _0x4ef9df=_0x88ce[_0xd06ea2];return _0x4ef9df;};'use strict';var Sequelize=require(_0xe88c('0x0'));var moment=require(_0xe88c('0x1'));module[_0xe88c('0x2')]={'channel':{'type':Sequelize[_0xe88c('0x3')]},'membername':{'type':Sequelize[_0xe88c('0x3')]},'interface':{'type':Sequelize[_0xe88c('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe88c('0x4')},'duration':{'type':Sequelize[_0xe88c('0x5')]},'enterAt':{'type':Sequelize[_0xe88c('0x6')]},'exitAt':{'type':Sequelize[_0xe88c('0x6')],'set':function(_0x31c048){var _0x50a4ab=moment(_0x31c048);var _0x56a677=moment(this[_0xe88c('0x7')](_0xe88c('0x8')));var _0x243c3c=_0x50a4ab['diff'](_0x56a677,_0xe88c('0x9'));this[_0xe88c('0xa')]('exitAt',_0x31c048);this[_0xe88c('0xa')](_0xe88c('0xb'),_0x243c3c>=0x0?_0x243c3c:null);}},'data1':{'type':Sequelize[_0xe88c('0x3')],'comment':_0xe88c('0xc')},'data2':{'type':Sequelize[_0xe88c('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe88c('0x3')],'comment':_0xe88c('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xe88c('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xe88c('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe88c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3a00351..542b7ab 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55ca,0x126));var _0xa55c=function(_0x56e2a0,_0x13b891){_0x56e2a0=_0x56e2a0-0x0;var _0x1b3b78=_0x55ca[_0x56e2a0];return _0x1b3b78;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xedd9,0xfc));var _0x9edd=function(_0x38b360,_0x4fd106){_0x38b360=_0x38b360-0x0;var _0x29932f=_0xedd9[_0x38b360];return _0x29932f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8abe9de..7361b99 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 _0xf969=['report_member','interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./memberReport.attributes','exports','MemberReport'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xf969,0xc5));var _0x9f96=function(_0x1b39e7,_0x185328){_0x1b39e7=_0x1b39e7-0x0;var _0x24936b=_0xf969[_0x1b39e7];return _0x24936b;};'use strict';var _=require(_0x9f96('0x0'));var util=require(_0x9f96('0x1'));var logger=require(_0x9f96('0x2'))(_0x9f96('0x3'));var moment=require(_0x9f96('0x4'));var BPromise=require(_0x9f96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f96('0x6'));var rimraf=require('rimraf');var config=require(_0x9f96('0x7'));var attributes=require(_0x9f96('0x8'));module[_0x9f96('0x9')]=function(_0x45ccd5,_0x5955b1){return _0x45ccd5['define'](_0x9f96('0xa'),attributes,{'tableName':_0x9f96('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x9f96('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc765=['define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports'];(function(_0x37998b,_0x27ed44){var _0x2bc1ce=function(_0x5072ba){while(--_0x5072ba){_0x37998b['push'](_0x37998b['shift']());}};_0x2bc1ce(++_0x27ed44);}(_0xc765,0xf5));var _0x5c76=function(_0x2cfeff,_0x49afb3){_0x2cfeff=_0x2cfeff-0x0;var _0x325d72=_0xc765[_0x2cfeff];return _0x325d72;};'use strict';var _=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var logger=require(_0x5c76('0x2'))(_0x5c76('0x3'));var moment=require(_0x5c76('0x4'));var BPromise=require(_0x5c76('0x5'));var rp=require(_0x5c76('0x6'));var fs=require('fs');var path=require(_0x5c76('0x7'));var rimraf=require('rimraf');var config=require(_0x5c76('0x8'));var attributes=require(_0x5c76('0x9'));module[_0x5c76('0xa')]=function(_0x7ae090,_0x3a2123){return _0x7ae090[_0x5c76('0xb')](_0x5c76('0xc'),attributes,{'tableName':_0x5c76('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5c76('0xe'),_0x5c76('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index aa768d6..44eb99e 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 _0xe928=['raw','attributes','limit','model','include','map','CreateMemberReport','create','update','UpdateMemberReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options'];(function(_0x998b12,_0x2b32fb){var _0x3000d5=function(_0x45bb9b){while(--_0x45bb9b){_0x998b12['push'](_0x998b12['shift']());}};_0x3000d5(++_0x2b32fb);}(_0xe928,0x145));var _0x8e92=function(_0x4739e0,_0x58b895){_0x4739e0=_0x4739e0-0x0;var _0xb5c74d=_0xe928[_0x4739e0];return _0xb5c74d;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e92('0x4'))['db'];var utils=require(_0x8e92('0x5'));var logger=require(_0x8e92('0x6'))(_0x8e92('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e92('0x8'));var client=jayson['client'][_0x8e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4eff3,_0x14811b,_0x76e11){return new BPromise(function(_0x59e109,_0x361fd2){return client['request'](_0xe4eff3,_0x76e11)[_0x8e92('0xa')](function(_0x8cc27a){logger[_0x8e92('0xb')](_0x8e92('0xc'),_0x14811b,_0x8e92('0xd'));logger[_0x8e92('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'),JSON[_0x8e92('0xf')](_0x8cc27a));if(_0x8cc27a[_0x8e92('0x10')]){if(_0x8cc27a['error'][_0x8e92('0x11')]===0x1f4){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);return _0x361fd2(_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);}logger['error'](_0x8e92('0xc'),_0x14811b,_0x8cc27a['error'][_0x8e92('0x12')]);return _0x59e109(_0x8cc27a[_0x8e92('0x10')]['message']);}else{logger[_0x8e92('0xb')]('MemberReport,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'));_0x59e109(_0x8cc27a[_0x8e92('0x13')][_0x8e92('0x12')]);}})[_0x8e92('0x14')](function(_0x1c4b12){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x1c4b12);_0x361fd2(_0x1c4b12);});});}exports[_0x8e92('0x15')]=function(_0x55f325){var _0x3dfb4c=this;return new Promise(function(_0x192b0b,_0x3a7417){return db[_0x8e92('0x16')][_0x8e92('0x17')]({'raw':_0x55f325['options']?_0x55f325[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![],'where':_0x55f325['options']?_0x55f325['options']['where']||null:null,'attributes':_0x55f325[_0x8e92('0x18')]?_0x55f325['options'][_0x8e92('0x1a')]||null:null,'limit':_0x55f325[_0x8e92('0x18')]?_0x55f325[_0x8e92('0x18')][_0x8e92('0x1b')]||null:null,'include':_0x55f325[_0x8e92('0x18')]?_0x55f325[_0x8e92('0x18')]['include']?_['map'](_0x55f325['options']['include'],function(_0x322765){return{'model':db[_0x322765[_0x8e92('0x1c')]],'as':_0x322765['as'],'attributes':_0x322765[_0x8e92('0x1a')],'include':_0x322765[_0x8e92('0x1d')]?_[_0x8e92('0x1e')](_0x322765[_0x8e92('0x1d')],function(_0x585adb){return{'model':db[_0x585adb[_0x8e92('0x1c')]],'as':_0x585adb['as'],'attributes':_0x585adb[_0x8e92('0x1a')],'include':_0x585adb[_0x8e92('0x1d')]?_[_0x8e92('0x1e')](_0x585adb[_0x8e92('0x1d')],function(_0x2aaf1d){return{'model':db[_0x2aaf1d['model']],'as':_0x2aaf1d['as'],'attributes':_0x2aaf1d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3df5){logger['info'](_0x8e92('0x15'),_0x55f325);logger['debug'](_0x8e92('0x15'),_0x55f325,JSON['stringify'](_0x1d3df5));_0x192b0b(_0x1d3df5);})[_0x8e92('0x14')](function(_0x57c4de){logger[_0x8e92('0x10')](_0x8e92('0x15'),_0x57c4de[_0x8e92('0x12')],_0x55f325);_0x3a7417(_0x3dfb4c[_0x8e92('0x10')](0x1f4,_0x57c4de['message']));});});};exports[_0x8e92('0x1f')]=function(_0x405df5){var _0x4c11ef=this;return new Promise(function(_0x2dbd8f,_0x4ddfea){return db[_0x8e92('0x16')][_0x8e92('0x20')](_0x405df5['body'],{'raw':_0x405df5[_0x8e92('0x18')]?_0x405df5[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![]})[_0x8e92('0xa')](function(_0x158fb2){logger[_0x8e92('0xb')](_0x8e92('0x1f'),_0x405df5);logger[_0x8e92('0xe')](_0x8e92('0x1f'),_0x405df5,JSON['stringify'](_0x158fb2));_0x2dbd8f(_0x158fb2);})['catch'](function(_0x456914){logger['error']('CreateMemberReport',_0x456914[_0x8e92('0x12')],_0x405df5);_0x4ddfea(_0x4c11ef[_0x8e92('0x10')](0x1f4,_0x456914[_0x8e92('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2fdbe5){var _0x316593=this;return new Promise(function(_0x300be0,_0x5c462b){return db['MemberReport'][_0x8e92('0x21')](_0x2fdbe5['body'],{'raw':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')][_0x8e92('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')]['where']||null:null,'attributes':_0x2fdbe5[_0x8e92('0x18')]?_0x2fdbe5[_0x8e92('0x18')][_0x8e92('0x1a')]||null:null,'limit':_0x2fdbe5['options']?_0x2fdbe5['options'][_0x8e92('0x1b')]||null:null})['then'](function(_0x20777d){logger[_0x8e92('0xb')](_0x8e92('0x22'),_0x2fdbe5);logger[_0x8e92('0xe')]('UpdateMemberReport',_0x2fdbe5,JSON['stringify'](_0x20777d));_0x300be0(_0x20777d);})['catch'](function(_0x206534){logger['error'](_0x8e92('0x22'),_0x206534['message'],_0x2fdbe5);_0x5c462b(_0x316593['error'](0x1f4,_0x206534['message']));});});}; \ No newline at end of file +var _0x3c6c=['raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','MemberReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','findAll','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x4db9a2,_0x28eeb2){_0x4db9a2=_0x4db9a2-0x0;var _0x15bd51=_0x3c6c[_0x4db9a2];return _0x15bd51;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var moment=require(_0xc3c6('0x1'));var BPromise=require(_0xc3c6('0x2'));var rs=require(_0xc3c6('0x3'));var fs=require('fs');var Redis=require(_0xc3c6('0x4'));var db=require(_0xc3c6('0x5'))['db'];var utils=require(_0xc3c6('0x6'));var logger=require(_0xc3c6('0x7'))(_0xc3c6('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3c6('0x9'));var client=jayson['client'][_0xc3c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7ae6,_0x50cd05,_0x4aed87){return new BPromise(function(_0x5185c3,_0x4f39dd){return client[_0xc3c6('0xb')](_0x4d7ae6,_0x4aed87)[_0xc3c6('0xc')](function(_0x5bc1c1){logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));logger[_0xc3c6('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x50cd05,_0xc3c6('0xf'),JSON[_0xc3c6('0x11')](_0x5bc1c1));if(_0x5bc1c1[_0xc3c6('0x12')]){if(_0x5bc1c1['error']['code']===0x1f4){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x4f39dd(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x5185c3(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}else{logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));_0x5185c3(_0x5bc1c1[_0xc3c6('0x14')][_0xc3c6('0x13')]);}})[_0xc3c6('0x15')](function(_0x33920c){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x33920c);_0x4f39dd(_0x33920c);});});}exports[_0xc3c6('0x16')]=function(_0x26c9b0){var _0x11df9a=this;return new Promise(function(_0x3003e1,_0x470592){return db['MemberReport'][_0xc3c6('0x17')]({'raw':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![],'where':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1a')]||null:null,'attributes':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1b')]||null:null,'limit':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1c')]||null:null,'include':_0x26c9b0[_0xc3c6('0x18')]?_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1d')]?_['map'](_0x26c9b0[_0xc3c6('0x18')][_0xc3c6('0x1d')],function(_0x2bced6){return{'model':db[_0x2bced6['model']],'as':_0x2bced6['as'],'attributes':_0x2bced6[_0xc3c6('0x1b')],'include':_0x2bced6[_0xc3c6('0x1d')]?_[_0xc3c6('0x1e')](_0x2bced6[_0xc3c6('0x1d')],function(_0x2bc9bf){return{'model':db[_0x2bc9bf[_0xc3c6('0x1f')]],'as':_0x2bc9bf['as'],'attributes':_0x2bc9bf[_0xc3c6('0x1b')],'include':_0x2bc9bf['include']?_[_0xc3c6('0x1e')](_0x2bc9bf[_0xc3c6('0x1d')],function(_0x4ca76f){return{'model':db[_0x4ca76f[_0xc3c6('0x1f')]],'as':_0x4ca76f['as'],'attributes':_0x4ca76f[_0xc3c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0xc')](function(_0xdad009){logger[_0xc3c6('0xd')](_0xc3c6('0x16'),_0x26c9b0);logger[_0xc3c6('0x10')](_0xc3c6('0x16'),_0x26c9b0,JSON[_0xc3c6('0x11')](_0xdad009));_0x3003e1(_0xdad009);})['catch'](function(_0xb047b1){logger[_0xc3c6('0x12')](_0xc3c6('0x16'),_0xb047b1[_0xc3c6('0x13')],_0x26c9b0);_0x470592(_0x11df9a['error'](0x1f4,_0xb047b1[_0xc3c6('0x13')]));});});};exports[_0xc3c6('0x20')]=function(_0x223d34){var _0x75066f=this;return new Promise(function(_0x3189dd,_0x354797){return db['MemberReport'][_0xc3c6('0x21')](_0x223d34[_0xc3c6('0x22')],{'raw':_0x223d34[_0xc3c6('0x18')]?_0x223d34[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x34453d){logger[_0xc3c6('0xd')](_0xc3c6('0x20'),_0x223d34);logger[_0xc3c6('0x10')](_0xc3c6('0x20'),_0x223d34,JSON[_0xc3c6('0x11')](_0x34453d));_0x3189dd(_0x34453d);})[_0xc3c6('0x15')](function(_0x53b4c6){logger[_0xc3c6('0x12')]('CreateMemberReport',_0x53b4c6[_0xc3c6('0x13')],_0x223d34);_0x354797(_0x75066f[_0xc3c6('0x12')](0x1f4,_0x53b4c6[_0xc3c6('0x13')]));});});};exports[_0xc3c6('0x23')]=function(_0x1c96d0){var _0x1b8e52=this;return new Promise(function(_0x4ba1ae,_0x36562e){return db[_0xc3c6('0x24')]['update'](_0x1c96d0[_0xc3c6('0x22')],{'raw':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x1a')]||null:null,'attributes':_0x1c96d0['options']?_0x1c96d0['options'][_0xc3c6('0x1b')]||null:null,'limit':_0x1c96d0[_0xc3c6('0x18')]?_0x1c96d0[_0xc3c6('0x18')][_0xc3c6('0x1c')]||null:null})[_0xc3c6('0xc')](function(_0x5cbbe3){logger[_0xc3c6('0xd')](_0xc3c6('0x23'),_0x1c96d0);logger[_0xc3c6('0x10')](_0xc3c6('0x23'),_0x1c96d0,JSON[_0xc3c6('0x11')](_0x5cbbe3));_0x4ba1ae(_0x5cbbe3);})[_0xc3c6('0x15')](function(_0x2b69fd){logger[_0xc3c6('0x12')](_0xc3c6('0x23'),_0x2b69fd['message'],_0x1c96d0);_0x36562e(_0x1b8e52[_0xc3c6('0x12')](0x1f4,_0x2b69fd[_0xc3c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4ba01f0..9a0ee22 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 _0xfb67=['./migration.controller','get','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x496ca4,_0x7cc3fa){var _0x5e1e22=function(_0x5f03a1){while(--_0x5f03a1){_0x496ca4['push'](_0x496ca4['shift']());}};_0x5e1e22(++_0x7cc3fa);}(_0xfb67,0x1f2));var _0x7fb6=function(_0x2e9ebf,_0x264263){_0x2e9ebf=_0x2e9ebf-0x0;var _0x20fc91=_0xfb67[_0x2e9ebf];return _0x20fc91;};'use strict';var multer=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var path=require(_0x7fb6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fb6('0x3'));var router=express[_0x7fb6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7fb6('0x5'));var config=require('../../config/environment');var controller=require(_0x7fb6('0x6'));router[_0x7fb6('0x7')]('/',controller['index']);module[_0x7fb6('0x8')]=router; \ No newline at end of file +var _0x3568=['../../config/environment','./migration.controller','index','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2e791b,_0x216426){var _0x391b9f=function(_0x3a2e96){while(--_0x3a2e96){_0x2e791b['push'](_0x2e791b['shift']());}};_0x391b9f(++_0x216426);}(_0x3568,0xc2));var _0x8356=function(_0x158906,_0x417b00){_0x158906=_0x158906-0x0;var _0xcb6c5f=_0x3568[_0x158906];return _0xcb6c5f;};'use strict';var multer=require(_0x8356('0x0'));var util=require(_0x8356('0x1'));var path=require('path');var timeout=require(_0x8356('0x2'));var express=require(_0x8356('0x3'));var router=express['Router']();var fs_extra=require(_0x8356('0x4'));var auth=require(_0x8356('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8356('0x6'));var controller=require(_0x8356('0x7'));router['get']('/',controller[_0x8356('0x8')]);module[_0x8356('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9325d94..fab46c4 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 _0xdf54=['version','exports','STRING'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xdf54,0x9d));var _0x4df5=function(_0x941d1b,_0x1649de){_0x941d1b=_0x941d1b-0x0;var _0x37ae15=_0xdf54[_0x941d1b];return _0x37ae15;};'use strict';var Sequelize=require('sequelize');module[_0x4df5('0x0')]={'version':{'type':Sequelize[_0x4df5('0x1')],'unique':_0x4df5('0x2')}}; \ No newline at end of file +var _0x5902=['sequelize','exports','STRING','version'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x5902,0x68));var _0x2590=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5902[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x2590('0x0'));module[_0x2590('0x1')]={'version':{'type':Sequelize[_0x2590('0x2')],'unique':_0x2590('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f7c75bb..5559c86 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 _0xb3f8=['merge','options','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','Migration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','VIRTUAL','filter'];(function(_0x3a81f3,_0x218733){var _0x3693d1=function(_0x37c804){while(--_0x37c804){_0x3a81f3['push'](_0x3a81f3['shift']());}};_0x3693d1(++_0x218733);}(_0xb3f8,0x83));var _0x8b3f=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xb3f8[_0x3ef2d5];return _0x2fefb2;};'use strict';var emlformat=require(_0x8b3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b3f('0x1'));var jsonpatch=require(_0x8b3f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8b3f('0x3'));var Mustache=require(_0x8b3f('0x4'));var util=require(_0x8b3f('0x5'));var path=require(_0x8b3f('0x6'));var sox=require(_0x8b3f('0x7'));var csv=require(_0x8b3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b3f('0x9'));var squel=require(_0x8b3f('0xa'));var crypto=require(_0x8b3f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8b3f('0xc'));var Papa=require('papaparse');var Redis=require(_0x8b3f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8b3f('0xe'));var as=require(_0x8b3f('0xf'));var hardwareService=require(_0x8b3f('0x10'));var logger=require(_0x8b3f('0x11'))(_0x8b3f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b3f('0x13'))['db'];function respondWithStatusCode(_0x541820,_0x3edb1c){_0x3edb1c=_0x3edb1c||0xcc;return function(_0x270395){if(_0x270395){return _0x541820[_0x8b3f('0x14')](_0x3edb1c);}return _0x541820['status'](_0x3edb1c)['end']();};}function respondWithResult(_0x1cc67b,_0x1643f4){_0x1643f4=_0x1643f4||0xc8;return function(_0xdc4aad){if(_0xdc4aad){return _0x1cc67b[_0x8b3f('0x15')](_0x1643f4)[_0x8b3f('0x16')](_0xdc4aad);}};}function respondWithFilteredResult(_0x25ee31,_0x4ca515){return function(_0x1b9b22){if(_0x1b9b22){var _0xe89ae6=typeof _0x4ca515[_0x8b3f('0x17')]===_0x8b3f('0x18')&&typeof _0x4ca515[_0x8b3f('0x19')]===_0x8b3f('0x18');var _0x423e7f=_0x1b9b22['count'];var _0x10e753=_0xe89ae6?0x0:_0x4ca515[_0x8b3f('0x17')];var _0x59ae3c=_0xe89ae6?_0x1b9b22[_0x8b3f('0x1a')]:_0x4ca515['offset']+_0x4ca515[_0x8b3f('0x19')];var _0x1c55ef;if(_0x59ae3c>=_0x423e7f){_0x59ae3c=_0x423e7f;_0x1c55ef=0xc8;}else{_0x1c55ef=0xce;}_0x25ee31['status'](_0x1c55ef);return _0x25ee31[_0x8b3f('0x1b')](_0x8b3f('0x1c'),_0x10e753+'-'+_0x59ae3c+'/'+_0x423e7f)[_0x8b3f('0x16')](_0x1b9b22);}return null;};}function patchUpdates(_0x1c03c1){return function(_0x357fa5){try{jsonpatch['apply'](_0x357fa5,_0x1c03c1,!![]);}catch(_0x5d6d10){return BPromise['reject'](_0x5d6d10);}return _0x357fa5['save']();};}function saveUpdates(_0x35fccf,_0x17210d){return function(_0x5bec30){if(_0x5bec30){return _0x5bec30[_0x8b3f('0x1d')](_0x35fccf)[_0x8b3f('0x1e')](function(_0x314e4e){return _0x314e4e;});}return null;};}function removeEntity(_0x3ffaf0,_0x3af349){return function(_0x1f9c6e){if(_0x1f9c6e){return _0x1f9c6e[_0x8b3f('0x1f')]()[_0x8b3f('0x1e')](function(){_0x3ffaf0[_0x8b3f('0x15')](0xcc)[_0x8b3f('0x20')]();});}};}function handleEntityNotFound(_0x149140,_0x20ece7){return function(_0xcfc0b3){if(!_0xcfc0b3){_0x149140[_0x8b3f('0x14')](0x194);}return _0xcfc0b3;};}function handleError(_0x254965,_0x51153d){_0x51153d=_0x51153d||0x1f4;return function(_0x41cd47){logger[_0x8b3f('0x21')](_0x41cd47[_0x8b3f('0x22')]);if(_0x41cd47[_0x8b3f('0x23')]){delete _0x41cd47[_0x8b3f('0x23')];}_0x254965[_0x8b3f('0x15')](_0x51153d)[_0x8b3f('0x24')](_0x41cd47);};}exports['index']=function(_0x8f89db,_0x481f22){var _0x2ec6d9={},_0x23aa9d={},_0x197a35={'count':0x0,'rows':[]};var _0x2cd5e3=_[_0x8b3f('0x25')](db[_0x8b3f('0x26')][_0x8b3f('0x27')],function(_0x493c33){return{'name':_0x493c33[_0x8b3f('0x28')],'type':_0x493c33[_0x8b3f('0x29')]['key']};});_0x23aa9d[_0x8b3f('0x2a')]=_[_0x8b3f('0x25')](_0x2cd5e3,_0x8b3f('0x23'));_0x23aa9d[_0x8b3f('0x2b')]=_['keys'](_0x8f89db[_0x8b3f('0x2b')]);_0x23aa9d[_0x8b3f('0x2c')]=_[_0x8b3f('0x2d')](_0x23aa9d['model'],_0x23aa9d[_0x8b3f('0x2b')]);_0x2ec6d9[_0x8b3f('0x2e')]=_[_0x8b3f('0x2d')](_0x23aa9d[_0x8b3f('0x2a')],qs[_0x8b3f('0x2f')](_0x8f89db['query']['fields']));_0x2ec6d9['attributes']=_0x2ec6d9[_0x8b3f('0x2e')][_0x8b3f('0x30')]?_0x2ec6d9[_0x8b3f('0x2e')]:_0x23aa9d[_0x8b3f('0x2a')];if(!_0x8f89db['query']['hasOwnProperty'](_0x8b3f('0x31'))){_0x2ec6d9[_0x8b3f('0x19')]=qs['limit'](_0x8f89db[_0x8b3f('0x2b')][_0x8b3f('0x19')]);_0x2ec6d9[_0x8b3f('0x17')]=qs[_0x8b3f('0x17')](_0x8f89db['query'][_0x8b3f('0x17')]);}_0x2ec6d9[_0x8b3f('0x32')]=qs['sort'](_0x8f89db[_0x8b3f('0x2b')]['sort']);_0x2ec6d9[_0x8b3f('0x33')]=qs['filters'](_[_0x8b3f('0x34')](_0x8f89db[_0x8b3f('0x2b')],_0x23aa9d['filters']),_0x2cd5e3);if(_0x8f89db[_0x8b3f('0x2b')]['filter']){_0x2ec6d9[_0x8b3f('0x33')]=_['merge'](_0x2ec6d9[_0x8b3f('0x33')],{'$or':_[_0x8b3f('0x25')](_0x2cd5e3,function(_0x517817){if(_0x517817[_0x8b3f('0x29')]!==_0x8b3f('0x35')){var _0x5c1fc3={};_0x5c1fc3[_0x517817['name']]={'$like':'%'+_0x8f89db[_0x8b3f('0x2b')][_0x8b3f('0x36')]+'%'};return _0x5c1fc3;}})});}_0x2ec6d9=_[_0x8b3f('0x37')]({},_0x2ec6d9,_0x8f89db[_0x8b3f('0x38')]);var _0x27ab64={'where':_0x2ec6d9[_0x8b3f('0x33')]};return db[_0x8b3f('0x26')][_0x8b3f('0x1a')](_0x27ab64)[_0x8b3f('0x1e')](function(_0x3d6163){_0x197a35['count']=_0x3d6163;if(_0x8f89db['query'][_0x8b3f('0x39')]){_0x2ec6d9[_0x8b3f('0x3a')]=[{'all':!![]}];}return db[_0x8b3f('0x26')][_0x8b3f('0x3b')](_0x2ec6d9);})[_0x8b3f('0x1e')](function(_0xdaa757){_0x197a35[_0x8b3f('0x3c')]=_0xdaa757;return _0x197a35;})[_0x8b3f('0x1e')](respondWithFilteredResult(_0x481f22,_0x2ec6d9))[_0x8b3f('0x3d')](handleError(_0x481f22,null));}; \ No newline at end of file +var _0xe279=['name','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack'];(function(_0x54f043,_0x5bb3bb){var _0x4839e4=function(_0x3f9336){while(--_0x3f9336){_0x54f043['push'](_0x54f043['shift']());}};_0x4839e4(++_0x5bb3bb);}(_0xe279,0xa5));var _0x9e27=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xe279[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x9e27('0x0'));var rimraf=require(_0x9e27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9e27('0x2'));var moment=require(_0x9e27('0x3'));var BPromise=require(_0x9e27('0x4'));var Mustache=require('mustache');var util=require(_0x9e27('0x5'));var path=require(_0x9e27('0x6'));var sox=require('sox');var csv=require(_0x9e27('0x7'));var ejs=require(_0x9e27('0x8'));var fs=require('fs');var fs_extra=require(_0x9e27('0x9'));var _=require(_0x9e27('0xa'));var squel=require(_0x9e27('0xb'));var crypto=require(_0x9e27('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9e27('0xd'));var Papa=require(_0x9e27('0xe'));var Redis=require(_0x9e27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e27('0x10'));var as=require(_0x9e27('0x11'));var hardwareService=require(_0x9e27('0x12'));var logger=require(_0x9e27('0x13'))(_0x9e27('0x14'));var utils=require(_0x9e27('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9e27('0x16'));var db=require(_0x9e27('0x17'))['db'];function respondWithStatusCode(_0x56e7f0,_0x36a2fa){_0x36a2fa=_0x36a2fa||0xcc;return function(_0x5d00fe){if(_0x5d00fe){return _0x56e7f0['sendStatus'](_0x36a2fa);}return _0x56e7f0[_0x9e27('0x18')](_0x36a2fa)['end']();};}function respondWithResult(_0xfd8131,_0xe7cf92){_0xe7cf92=_0xe7cf92||0xc8;return function(_0x2e74f6){if(_0x2e74f6){return _0xfd8131[_0x9e27('0x18')](_0xe7cf92)[_0x9e27('0x19')](_0x2e74f6);}};}function respondWithFilteredResult(_0x8fecc6,_0x41086e){return function(_0x34e744){if(_0x34e744){var _0x241296=typeof _0x41086e[_0x9e27('0x1a')]==='undefined'&&typeof _0x41086e['limit']===_0x9e27('0x1b');var _0x19230b=_0x34e744[_0x9e27('0x1c')];var _0x2e95ec=_0x241296?0x0:_0x41086e[_0x9e27('0x1a')];var _0x21079a=_0x241296?_0x34e744[_0x9e27('0x1c')]:_0x41086e[_0x9e27('0x1a')]+_0x41086e[_0x9e27('0x1d')];var _0xe1bd9f;if(_0x21079a>=_0x19230b){_0x21079a=_0x19230b;_0xe1bd9f=0xc8;}else{_0xe1bd9f=0xce;}_0x8fecc6[_0x9e27('0x18')](_0xe1bd9f);return _0x8fecc6['set'](_0x9e27('0x1e'),_0x2e95ec+'-'+_0x21079a+'/'+_0x19230b)['json'](_0x34e744);}return null;};}function patchUpdates(_0xb0a275){return function(_0x7bc162){try{jsonpatch['apply'](_0x7bc162,_0xb0a275,!![]);}catch(_0x4371d0){return BPromise[_0x9e27('0x1f')](_0x4371d0);}return _0x7bc162[_0x9e27('0x20')]();};}function saveUpdates(_0x3588dd,_0x1658f7){return function(_0x2bbe28){if(_0x2bbe28){return _0x2bbe28[_0x9e27('0x21')](_0x3588dd)[_0x9e27('0x22')](function(_0x58a52e){return _0x58a52e;});}return null;};}function removeEntity(_0x5de775,_0x5d9dc3){return function(_0x592965){if(_0x592965){return _0x592965[_0x9e27('0x23')]()[_0x9e27('0x22')](function(){_0x5de775[_0x9e27('0x18')](0xcc)[_0x9e27('0x24')]();});}};}function handleEntityNotFound(_0x3b89c2,_0x34420e){return function(_0xde1ca0){if(!_0xde1ca0){_0x3b89c2[_0x9e27('0x25')](0x194);}return _0xde1ca0;};}function handleError(_0x115b8c,_0x134fe6){_0x134fe6=_0x134fe6||0x1f4;return function(_0x563928){logger['error'](_0x563928[_0x9e27('0x26')]);if(_0x563928[_0x9e27('0x27')]){delete _0x563928['name'];}_0x115b8c[_0x9e27('0x18')](_0x134fe6)['send'](_0x563928);};}exports[_0x9e27('0x28')]=function(_0x319f03,_0x2c01d0){var _0x18f878={},_0x1b6b5d={},_0x1fcde4={'count':0x0,'rows':[]};var _0x4f9839=_[_0x9e27('0x29')](db[_0x9e27('0x2a')][_0x9e27('0x2b')],function(_0x3eac1b){return{'name':_0x3eac1b[_0x9e27('0x2c')],'type':_0x3eac1b[_0x9e27('0x2d')][_0x9e27('0x2e')]};});_0x1b6b5d['model']=_['map'](_0x4f9839,_0x9e27('0x27'));_0x1b6b5d[_0x9e27('0x2f')]=_[_0x9e27('0x30')](_0x319f03[_0x9e27('0x2f')]);_0x1b6b5d[_0x9e27('0x31')]=_[_0x9e27('0x32')](_0x1b6b5d['model'],_0x1b6b5d[_0x9e27('0x2f')]);_0x18f878[_0x9e27('0x33')]=_[_0x9e27('0x32')](_0x1b6b5d[_0x9e27('0x34')],qs[_0x9e27('0x35')](_0x319f03[_0x9e27('0x2f')][_0x9e27('0x35')]));_0x18f878[_0x9e27('0x33')]=_0x18f878[_0x9e27('0x33')][_0x9e27('0x36')]?_0x18f878[_0x9e27('0x33')]:_0x1b6b5d[_0x9e27('0x34')];if(!_0x319f03[_0x9e27('0x2f')][_0x9e27('0x37')](_0x9e27('0x38'))){_0x18f878['limit']=qs['limit'](_0x319f03[_0x9e27('0x2f')]['limit']);_0x18f878[_0x9e27('0x1a')]=qs[_0x9e27('0x1a')](_0x319f03[_0x9e27('0x2f')][_0x9e27('0x1a')]);}_0x18f878['order']=qs[_0x9e27('0x39')](_0x319f03[_0x9e27('0x2f')][_0x9e27('0x39')]);_0x18f878[_0x9e27('0x3a')]=qs[_0x9e27('0x31')](_[_0x9e27('0x3b')](_0x319f03['query'],_0x1b6b5d[_0x9e27('0x31')]),_0x4f9839);if(_0x319f03['query'][_0x9e27('0x3c')]){_0x18f878[_0x9e27('0x3a')]=_['merge'](_0x18f878[_0x9e27('0x3a')],{'$or':_['map'](_0x4f9839,function(_0x41f3e2){if(_0x41f3e2[_0x9e27('0x2d')]!=='VIRTUAL'){var _0x459920={};_0x459920[_0x41f3e2[_0x9e27('0x27')]]={'$like':'%'+_0x319f03[_0x9e27('0x2f')][_0x9e27('0x3c')]+'%'};return _0x459920;}})});}_0x18f878=_[_0x9e27('0x3d')]({},_0x18f878,_0x319f03[_0x9e27('0x3e')]);var _0x3566f4={'where':_0x18f878[_0x9e27('0x3a')]};return db['Migration']['count'](_0x3566f4)[_0x9e27('0x22')](function(_0x30f681){_0x1fcde4[_0x9e27('0x1c')]=_0x30f681;if(_0x319f03[_0x9e27('0x2f')][_0x9e27('0x3f')]){_0x18f878[_0x9e27('0x40')]=[{'all':!![]}];}return db[_0x9e27('0x2a')][_0x9e27('0x41')](_0x18f878);})['then'](function(_0x457773){_0x1fcde4[_0x9e27('0x42')]=_0x457773;return _0x1fcde4;})[_0x9e27('0x22')](respondWithFilteredResult(_0x2c01d0,_0x18f878))[_0x9e27('0x43')](handleError(_0x2c01d0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9ba806b..a358026 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 _0xde04=['rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x225d87,_0x840e09){var _0x457240=function(_0x3d5333){while(--_0x3d5333){_0x225d87['push'](_0x225d87['shift']());}};_0x457240(++_0x840e09);}(_0xde04,0xbc));var _0x4de0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4de0('0x0'));var util=require('util');var logger=require(_0x4de0('0x1'))(_0x4de0('0x2'));var moment=require(_0x4de0('0x3'));var BPromise=require(_0x4de0('0x4'));var rp=require(_0x4de0('0x5'));var fs=require('fs');var path=require(_0x4de0('0x6'));var rimraf=require(_0x4de0('0x7'));var config=require('../../config/environment');var attributes=require(_0x4de0('0x8'));module[_0x4de0('0x9')]=function(_0x518a90,_0x11d054){return _0x518a90[_0x4de0('0xa')](_0x4de0('0xb'),attributes,{'tableName':_0x4de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5601=['path','rimraf','../../config/environment','./migration.attributes','exports','define','lodash','util','moment','bluebird'];(function(_0x4534e3,_0x129fc4){var _0x477e12=function(_0x40c25c){while(--_0x40c25c){_0x4534e3['push'](_0x4534e3['shift']());}};_0x477e12(++_0x129fc4);}(_0x5601,0xb0));var _0x1560=function(_0x1a49bf,_0x15b960){_0x1a49bf=_0x1a49bf-0x0;var _0x55c62d=_0x5601[_0x1a49bf];return _0x55c62d;};'use strict';var _=require(_0x1560('0x0'));var util=require(_0x1560('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1560('0x2'));var BPromise=require(_0x1560('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1560('0x4'));var rimraf=require(_0x1560('0x5'));var config=require(_0x1560('0x6'));var attributes=require(_0x1560('0x7'));module[_0x1560('0x8')]=function(_0x159a0a,_0x45a3f4){return _0x159a0a[_0x1560('0x9')]('Migration',attributes,{'tableName':'migrations','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 085fec5..004337b 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 _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x5baf32,_0x103278){var _0x539cae=function(_0x43c0c2){while(--_0x43c0c2){_0x5baf32['push'](_0x5baf32['shift']());}};_0x539cae(++_0x103278);}(_0x13f6,0x124));var _0x613f=function(_0xfefdd7,_0xe404a1){_0xfefdd7=_0xfefdd7-0x0;var _0x32c2eb=_0x13f6[_0xfefdd7];return _0x32c2eb;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('Migration,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('Migration,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file +var _0xf089=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','Migration,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xf089,0xba));var _0x9f08=function(_0x257527,_0x7808ed){_0x257527=_0x257527-0x0;var _0x51e37e=_0xf089[_0x257527];return _0x51e37e;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var moment=require(_0x9f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f08('0x2'));var fs=require('fs');var Redis=require(_0x9f08('0x3'));var db=require(_0x9f08('0x4'))['db'];var utils=require(_0x9f08('0x5'));var logger=require('../../config/logger')(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var jayson=require(_0x9f08('0x8'));var client=jayson[_0x9f08('0x9')][_0x9f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39abe2,_0x5341c9,_0x9cfade){return new BPromise(function(_0x4b37fc,_0x39e238){return client['request'](_0x39abe2,_0x9cfade)[_0x9f08('0xb')](function(_0x286809){logger[_0x9f08('0xc')]('Migration,\x20%s,\x20%s',_0x5341c9,_0x9f08('0xd'));logger[_0x9f08('0xe')](_0x9f08('0xf'),_0x5341c9,'request\x20sent',JSON['stringify'](_0x286809));if(_0x286809[_0x9f08('0x10')]){if(_0x286809[_0x9f08('0x10')]['code']===0x1f4){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x39e238(_0x286809['error'][_0x9f08('0x12')]);}logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x4b37fc(_0x286809[_0x9f08('0x10')][_0x9f08('0x12')]);}else{logger[_0x9f08('0xc')](_0x9f08('0x11'),_0x5341c9,_0x9f08('0xd'));_0x4b37fc(_0x286809['result'][_0x9f08('0x12')]);}})['catch'](function(_0x5a562c){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x5a562c);_0x39e238(_0x5a562c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6d5cc94..a30e2f1 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 _0x2cfd=['destroy','exports','util','path','connect-timeout','Router','fs-extra','./network.controller','get','index','/:id','isAuthenticated','create','update','delete'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2cfd,0x179));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xd2cf('0x0'));var path=require(_0xd2cf('0x1'));var timeout=require(_0xd2cf('0x2'));var express=require('express');var router=express[_0xd2cf('0x3')]();var fs_extra=require(_0xd2cf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2cf('0x5'));router[_0xd2cf('0x6')]('/',auth['isAuthenticated'](),controller[_0xd2cf('0x7')]);router[_0xd2cf('0x6')](_0xd2cf('0x8'),auth[_0xd2cf('0x9')](),controller['show']);router['post']('/',auth[_0xd2cf('0x9')](),controller[_0xd2cf('0xa')]);router['put']('/:id',auth[_0xd2cf('0x9')](),controller[_0xd2cf('0xb')]);router[_0xd2cf('0xc')]('/:id',auth[_0xd2cf('0x9')](),controller[_0xd2cf('0xd')]);module[_0xd2cf('0xe')]=router; \ No newline at end of file +var _0x700c=['isAuthenticated','show','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x700c,0x127));var _0xc700=function(_0x7b7117,_0x5b098e){_0x7b7117=_0x7b7117-0x0;var _0x497323=_0x700c[_0x7b7117];return _0x497323;};'use strict';var multer=require('multer');var util=require(_0xc700('0x0'));var path=require(_0xc700('0x1'));var timeout=require(_0xc700('0x2'));var express=require(_0xc700('0x3'));var router=express[_0xc700('0x4')]();var fs_extra=require(_0xc700('0x5'));var auth=require(_0xc700('0x6'));var interaction=require(_0xc700('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xc700('0x8')]('/',auth['isAuthenticated'](),controller[_0xc700('0x9')]);router[_0xc700('0x8')](_0xc700('0xa'),auth[_0xc700('0xb')](),controller[_0xc700('0xc')]);router['post']('/',auth[_0xc700('0xb')](),controller[_0xc700('0xd')]);router['put'](_0xc700('0xa'),auth[_0xc700('0xb')](),controller[_0xc700('0xe')]);router['delete'](_0xc700('0xa'),auth[_0xc700('0xb')](),controller[_0xc700('0xf')]);module[_0xc700('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b8b0915..c897eda 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 _0x03c3=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x21d642,_0x5e733b){var _0x2815f8=function(_0x103dcd){while(--_0x103dcd){_0x21d642['push'](_0x21d642['shift']());}};_0x2815f8(++_0x5e733b);}(_0x03c3,0x1e6));var _0x303c=function(_0x279679,_0x19605a){_0x279679=_0x279679-0x0;var _0x4e4b87=_0x03c3[_0x279679];return _0x4e4b87;};'use strict';var Sequelize=require(_0x303c('0x0'));module[_0x303c('0x1')]={'type':{'type':Sequelize[_0x303c('0x2')]('localnet',_0x303c('0x3'),_0x303c('0x4'),_0x303c('0x5'))},'value':{'type':Sequelize[_0x303c('0x6')]},'username':{'type':Sequelize[_0x303c('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4811=['exports','localnet','externip','stun','STRING'];(function(_0xf5eac2,_0xb4f2da){var _0xf81959=function(_0x189645){while(--_0x189645){_0xf5eac2['push'](_0xf5eac2['shift']());}};_0xf81959(++_0xb4f2da);}(_0x4811,0xe1));var _0x1481=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x4811[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require('sequelize');module[_0x1481('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1481('0x1'),_0x1481('0x2'),_0x1481('0x3'),'turn')},'value':{'type':Sequelize[_0x1481('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1481('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 33e7637..2bbb5e8 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 _0x4379=['limit','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','Network','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','merge','includeAll','include','show','params','options','create','sequelize','transaction','body','findAll','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','find','TURN','server/files/templates/network.ejs','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined'];(function(_0x57d6a1,_0x5eb7d3){var _0x4d09d5=function(_0x90db35){while(--_0x90db35){_0x57d6a1['push'](_0x57d6a1['shift']());}};_0x4d09d5(++_0x5eb7d3);}(_0x4379,0x1e6));var _0x9437=function(_0xcb095d,_0x5972e6){_0xcb095d=_0xcb095d-0x0;var _0x1a79e4=_0x4379[_0xcb095d];return _0x1a79e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9437('0x0'));var jsonpatch=require(_0x9437('0x1'));var rp=require(_0x9437('0x2'));var moment=require(_0x9437('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9437('0x4'));var util=require(_0x9437('0x5'));var path=require(_0x9437('0x6'));var sox=require(_0x9437('0x7'));var csv=require(_0x9437('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9437('0x9'));var _=require('lodash');var squel=require(_0x9437('0xa'));var crypto=require(_0x9437('0xb'));var jsforce=require(_0x9437('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9437('0x8'));var querystring=require(_0x9437('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9437('0xe'));var qs=require(_0x9437('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9437('0x10'));var logger=require(_0x9437('0x11'))(_0x9437('0x12'));var utils=require('../../config/utils');var config=require(_0x9437('0x13'));var licenseUtil=require(_0x9437('0x14'));var db=require(_0x9437('0x15'))['db'];var jayson=require(_0x9437('0x16'));var client=jayson['client'][_0x9437('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5c1b11,_0x5606e4,_0x5d6a81,_0x17a73a){return new BPromise(function(_0x126772,_0x3ba574){var _0x278558=_0x17a73a||client;return _0x278558[_0x9437('0x18')](_0x5c1b11,_0x5d6a81)[_0x9437('0x19')](function(_0xf00dcc){logger['info'](_0x9437('0x1a'),_0x5606e4,'request\x20sent');logger[_0x9437('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x5606e4,_0x9437('0x1c'),JSON[_0x9437('0x1d')](_0xf00dcc));if(_0xf00dcc[_0x9437('0x1e')]){if(_0xf00dcc[_0x9437('0x1e')][_0x9437('0x1f')]===0x1f4){logger[_0x9437('0x1e')]('Network,\x20%s,\x20%s',_0x5606e4,_0xf00dcc[_0x9437('0x1e')][_0x9437('0x20')]);return _0x3ba574(_0xf00dcc['error'][_0x9437('0x20')]);}logger['error'](_0x9437('0x1a'),_0x5606e4,_0xf00dcc[_0x9437('0x1e')][_0x9437('0x20')]);return _0x126772(_0xf00dcc['error'][_0x9437('0x20')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x5606e4,_0x9437('0x1c'));_0x126772(_0xf00dcc[_0x9437('0x21')][_0x9437('0x20')]);}})[_0x9437('0x22')](function(_0x93c1ed){logger[_0x9437('0x1e')](_0x9437('0x1a'),_0x5606e4,_0x93c1ed);_0x3ba574(_0x93c1ed);});});}function respondWithStatusCode(_0x315516,_0x526bde){_0x526bde=_0x526bde||0xcc;return function(_0x4be545){if(_0x4be545){return _0x315516['sendStatus'](_0x526bde);}return _0x315516[_0x9437('0x23')](_0x526bde)[_0x9437('0x24')]();};}function respondWithResult(_0x3219b9,_0x4bff85){_0x4bff85=_0x4bff85||0xc8;return function(_0xcf9c7a){if(_0xcf9c7a){return _0x3219b9['status'](_0x4bff85)[_0x9437('0x25')](_0xcf9c7a);}};}function respondWithFilteredResult(_0x50b269,_0x41fa3b){return function(_0x3de742){if(_0x3de742){var _0x3d8d93=typeof _0x41fa3b['offset']===_0x9437('0x26')&&typeof _0x41fa3b[_0x9437('0x27')]===_0x9437('0x26');var _0x473b3e=_0x3de742[_0x9437('0x28')];var _0x53e348=_0x3d8d93?0x0:_0x41fa3b[_0x9437('0x29')];var _0xc5c226=_0x3d8d93?_0x3de742['count']:_0x41fa3b[_0x9437('0x29')]+_0x41fa3b[_0x9437('0x27')];var _0x232eea;if(_0xc5c226>=_0x473b3e){_0xc5c226=_0x473b3e;_0x232eea=0xc8;}else{_0x232eea=0xce;}_0x50b269['status'](_0x232eea);return _0x50b269[_0x9437('0x2a')](_0x9437('0x2b'),_0x53e348+'-'+_0xc5c226+'/'+_0x473b3e)[_0x9437('0x25')](_0x3de742);}return null;};}function patchUpdates(_0x3d9cb1){return function(_0x481def){try{jsonpatch[_0x9437('0x2c')](_0x481def,_0x3d9cb1,!![]);}catch(_0x9bc354){return BPromise[_0x9437('0x2d')](_0x9bc354);}return _0x481def[_0x9437('0x2e')]();};}function saveUpdates(_0x458e1a,_0x16e1e6){return function(_0x5dbb3e){if(_0x5dbb3e){return _0x5dbb3e['update'](_0x458e1a)[_0x9437('0x19')](function(_0x4e38d6){return _0x4e38d6;});}return null;};}function removeEntity(_0x3d2f58,_0x3fe081){return function(_0x5eaa56){if(_0x5eaa56){return _0x5eaa56[_0x9437('0x2f')]()['then'](function(){_0x3d2f58[_0x9437('0x23')](0xcc)[_0x9437('0x24')]();});}};}function handleEntityNotFound(_0x2a1d7a,_0xbe1140){return function(_0x5c14fe){if(!_0x5c14fe){_0x2a1d7a[_0x9437('0x30')](0x194);}return _0x5c14fe;};}function handleError(_0x2adfa2,_0x505956){_0x505956=_0x505956||0x1f4;return function(_0x238ce9){logger[_0x9437('0x1e')](_0x238ce9[_0x9437('0x31')]);if(_0x238ce9[_0x9437('0x32')]){delete _0x238ce9[_0x9437('0x32')];}_0x2adfa2[_0x9437('0x23')](_0x505956)['send'](_0x238ce9);};}exports[_0x9437('0x33')]=function(_0x18c29e,_0xab68cf){var _0x58ddab={},_0x31f2cd={},_0x2dc438={'count':0x0,'rows':[]};var _0x1b14ba=_['map'](db[_0x9437('0x34')][_0x9437('0x35')],function(_0x58ee11){return{'name':_0x58ee11['fieldName'],'type':_0x58ee11[_0x9437('0x36')][_0x9437('0x37')]};});_0x31f2cd['model']=_['map'](_0x1b14ba,_0x9437('0x32'));_0x31f2cd[_0x9437('0x38')]=_[_0x9437('0x39')](_0x18c29e[_0x9437('0x38')]);_0x31f2cd['filters']=_[_0x9437('0x3a')](_0x31f2cd[_0x9437('0x3b')],_0x31f2cd[_0x9437('0x38')]);_0x58ddab[_0x9437('0x3c')]=_[_0x9437('0x3a')](_0x31f2cd[_0x9437('0x3b')],qs[_0x9437('0x3d')](_0x18c29e[_0x9437('0x38')]['fields']));_0x58ddab[_0x9437('0x3c')]=_0x58ddab[_0x9437('0x3c')][_0x9437('0x3e')]?_0x58ddab[_0x9437('0x3c')]:_0x31f2cd[_0x9437('0x3b')];if(!_0x18c29e[_0x9437('0x38')][_0x9437('0x3f')](_0x9437('0x40'))){_0x58ddab[_0x9437('0x27')]=qs[_0x9437('0x27')](_0x18c29e['query'][_0x9437('0x27')]);_0x58ddab['offset']=qs[_0x9437('0x29')](_0x18c29e[_0x9437('0x38')][_0x9437('0x29')]);}_0x58ddab[_0x9437('0x41')]=qs[_0x9437('0x42')](_0x18c29e[_0x9437('0x38')]['sort']);_0x58ddab[_0x9437('0x43')]=qs[_0x9437('0x44')](_[_0x9437('0x45')](_0x18c29e[_0x9437('0x38')],_0x31f2cd[_0x9437('0x44')]),_0x1b14ba);if(_0x18c29e[_0x9437('0x38')][_0x9437('0x46')]){_0x58ddab[_0x9437('0x43')]=_['merge'](_0x58ddab['where'],{'$or':_[_0x9437('0x47')](_0x1b14ba,function(_0x3eaf78){if(_0x3eaf78[_0x9437('0x36')]!=='VIRTUAL'){var _0x417a5d={};_0x417a5d[_0x3eaf78[_0x9437('0x32')]]={'$like':'%'+_0x18c29e[_0x9437('0x38')][_0x9437('0x46')]+'%'};return _0x417a5d;}})});}_0x58ddab=_[_0x9437('0x48')]({},_0x58ddab,_0x18c29e['options']);var _0x3eaa44={'where':_0x58ddab[_0x9437('0x43')]};return db['Network'][_0x9437('0x28')](_0x3eaa44)[_0x9437('0x19')](function(_0x2c085f){_0x2dc438['count']=_0x2c085f;if(_0x18c29e['query'][_0x9437('0x49')]){_0x58ddab[_0x9437('0x4a')]=[{'all':!![]}];}return db[_0x9437('0x34')]['findAll'](_0x58ddab);})[_0x9437('0x19')](function(_0x2148f4){_0x2dc438['rows']=_0x2148f4;return _0x2dc438;})[_0x9437('0x19')](respondWithFilteredResult(_0xab68cf,_0x58ddab))[_0x9437('0x22')](handleError(_0xab68cf,null));};exports[_0x9437('0x4b')]=function(_0x32a4e5,_0x197def){var _0x4b37ed={'raw':!![],'where':{'id':_0x32a4e5[_0x9437('0x4c')]['id']}},_0x2289be={};_0x2289be['model']=_['keys'](db[_0x9437('0x34')][_0x9437('0x35')]);_0x2289be['query']=_[_0x9437('0x39')](_0x32a4e5[_0x9437('0x38')]);_0x2289be[_0x9437('0x44')]=_[_0x9437('0x3a')](_0x2289be[_0x9437('0x3b')],_0x2289be[_0x9437('0x38')]);_0x4b37ed[_0x9437('0x3c')]=_[_0x9437('0x3a')](_0x2289be['model'],qs[_0x9437('0x3d')](_0x32a4e5[_0x9437('0x38')]['fields']));_0x4b37ed[_0x9437('0x3c')]=_0x4b37ed['attributes'][_0x9437('0x3e')]?_0x4b37ed[_0x9437('0x3c')]:_0x2289be[_0x9437('0x3b')];if(_0x32a4e5[_0x9437('0x38')][_0x9437('0x49')]){_0x4b37ed[_0x9437('0x4a')]=[{'all':!![]}];}_0x4b37ed=_[_0x9437('0x48')]({},_0x4b37ed,_0x32a4e5[_0x9437('0x4d')]);return db['Network']['find'](_0x4b37ed)['then'](handleEntityNotFound(_0x197def,null))['then'](respondWithResult(_0x197def,null))['catch'](handleError(_0x197def,null));};exports[_0x9437('0x4e')]=function(_0x3954e6,_0x56ccda,_0x4924f8){var _0x33a5e2;return db[_0x9437('0x4f')][_0x9437('0x50')](function(_0x10ee5b){return db[_0x9437('0x34')][_0x9437('0x4e')](_0x3954e6[_0x9437('0x51')],{'raw':!![]})[_0x9437('0x19')](function(_0xc06c4f){_0x33a5e2=_0xc06c4f;return db[_0x9437('0x34')][_0x9437('0x52')]({'where':{'type':_0x3954e6[_0x9437('0x51')]['type']},'raw':!![]});})['then'](function(_0x41c847){if(_0x33a5e2[_0x9437('0x36')]['toUpperCase']()==_0x9437('0x53')){var _0x36893c=fs[_0x9437('0x54')](path['join'](config[_0x9437('0x55')],_0x9437('0x56')),_0x9437('0x57'));var _0x5e59f9=ejs['render'](_0x36893c,{'networks':_0x41c847||[]});fs[_0x9437('0x58')](_0x9437('0x59'),_0x5e59f9);return respondWithRpcPromise('Reload','create',{'module':_0x9437('0x5a')});}else if(_0x33a5e2['type'][_0x9437('0x5b')]()=='TURN'){var _0x3d4607=fs[_0x9437('0x54')](path[_0x9437('0x5c')](config[_0x9437('0x55')],_0x9437('0x5d')),_0x9437('0x57'));var _0x1b4730=ejs[_0x9437('0x5e')](_0x3d4607,{'networks':_0x41c847||[]});fs[_0x9437('0x58')](_0x9437('0x5f'),_0x1b4730);return respondWithRpcPromise('Reload',_0x9437('0x4e'),{'module':_0x9437('0x5a')});}else{var _0x3b9809=fs[_0x9437('0x54')](path[_0x9437('0x5c')](config['root'],'server/files/templates/network.ejs'),_0x9437('0x57'));var _0x1e95a4=ejs[_0x9437('0x5e')](_0x3b9809,{'networks':_0x41c847||[]});fs['writeFileSync'](util[_0x9437('0x60')](_0x9437('0x61'),_0x3954e6[_0x9437('0x51')][_0x9437('0x36')][_0x9437('0x62')]()),_0x1e95a4);return respondWithRpcPromise(_0x9437('0x63'),_0x9437('0x4e'),{'module':_0x9437('0x64')});}return null;})[_0x9437('0x19')](function(){return _0x33a5e2;});})[_0x9437('0x19')](respondWithResult(_0x56ccda,0xc9))[_0x9437('0x22')](handleError(_0x56ccda,null));};exports[_0x9437('0x65')]=function(_0x5a15e7,_0xca2e7e,_0x5141b9){var _0x31b3d7;return db[_0x9437('0x4f')][_0x9437('0x50')](function(_0x2e7fa0){return db['Network'][_0x9437('0x66')]({'where':{'id':_0x5a15e7['params']['id']}})[_0x9437('0x19')](handleEntityNotFound(_0xca2e7e,null))[_0x9437('0x19')](saveUpdates(_0x5a15e7[_0x9437('0x51')],null))[_0x9437('0x19')](function(_0x26a03c){if(_0x26a03c){_0x31b3d7=_0x26a03c;return db[_0x9437('0x34')][_0x9437('0x52')]({'where':{'type':_0x31b3d7[_0x9437('0x36')]},'raw':!![]});}return null;})[_0x9437('0x19')](function(_0x1d5c8d){if(_0x31b3d7[_0x9437('0x36')]['toUpperCase']()==_0x9437('0x53')){var _0x6bfc14=fs[_0x9437('0x54')](path[_0x9437('0x5c')](config[_0x9437('0x55')],_0x9437('0x56')),_0x9437('0x57'));var _0x38b47e=ejs[_0x9437('0x5e')](_0x6bfc14,{'networks':_0x1d5c8d||[]});fs[_0x9437('0x58')](_0x9437('0x59'),_0x38b47e);return respondWithRpcPromise(_0x9437('0x63'),_0x9437('0x65'),{'module':_0x9437('0x5a')});}else if(_0x31b3d7[_0x9437('0x36')][_0x9437('0x5b')]()==_0x9437('0x67')){var _0x409f4a=fs['readFileSync'](path[_0x9437('0x5c')](config[_0x9437('0x55')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x109b79=ejs[_0x9437('0x5e')](_0x409f4a,{'networks':_0x1d5c8d||[]});fs['writeFileSync'](_0x9437('0x5f'),_0x109b79);return respondWithRpcPromise('Reload',_0x9437('0x65'),{'module':_0x9437('0x5a')});}else{var _0x5ca569=fs[_0x9437('0x54')](path['join'](config[_0x9437('0x55')],_0x9437('0x68')),_0x9437('0x57'));var _0x96f6c1=ejs[_0x9437('0x5e')](_0x5ca569,{'networks':_0x1d5c8d||[]});fs[_0x9437('0x58')](util['format'](_0x9437('0x61'),_0x5a15e7[_0x9437('0x51')][_0x9437('0x36')][_0x9437('0x62')]()),_0x96f6c1);return respondWithRpcPromise('Reload',_0x9437('0x65'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xe55c57){if(_0xe55c57){return _0x31b3d7;}return null;});})['then'](respondWithResult(_0xca2e7e,null))[_0x9437('0x22')](handleError(_0xca2e7e,null));};exports[_0x9437('0x2f')]=function(_0x5d669f,_0x229c52,_0x3dcce3){var _0x2063a9;return db['Network']['find']({'where':{'id':_0x5d669f[_0x9437('0x4c')]['id']}})[_0x9437('0x19')](function(_0x5385be){_0x2063a9=_0x5385be;return _0x5385be;})[_0x9437('0x19')](handleEntityNotFound(_0x229c52,null))[_0x9437('0x19')](removeEntity(_0x229c52,null))[_0x9437('0x19')](function(){if(_0x2063a9){return db[_0x9437('0x34')]['findAll']({'where':{'type':_0x2063a9[_0x9437('0x36')]},'raw':!![]});}})[_0x9437('0x19')](function(_0x23ee9d){if(_0x2063a9[_0x9437('0x36')][_0x9437('0x5b')]()==_0x9437('0x53')){var _0x138e9d=fs[_0x9437('0x54')](path[_0x9437('0x5c')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9437('0x57'));var _0x460ee0=ejs[_0x9437('0x5e')](_0x138e9d,{'networks':_0x23ee9d||[]});fs['writeFileSync'](_0x9437('0x59'),_0x460ee0);return respondWithRpcPromise('Reload',_0x9437('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x2063a9[_0x9437('0x36')][_0x9437('0x5b')]()==_0x9437('0x67')){var _0x15c4fd=fs[_0x9437('0x54')](path[_0x9437('0x5c')](config[_0x9437('0x55')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x552408=ejs['render'](_0x15c4fd,{'networks':_0x23ee9d||[]});fs['writeFileSync'](_0x9437('0x5f'),_0x552408);return respondWithRpcPromise(_0x9437('0x63'),_0x9437('0x2f'),{'module':_0x9437('0x5a')});}else{var _0x219b4a=fs['readFileSync'](path[_0x9437('0x5c')](config['root'],_0x9437('0x68')),'utf8');var _0x11d419=ejs['render'](_0x219b4a,{'networks':_0x23ee9d||[]});fs['writeFileSync'](util[_0x9437('0x60')](_0x9437('0x61'),_0x5d669f['body']['type'][_0x9437('0x62')]()),_0x11d419);return respondWithRpcPromise('Reload',_0x9437('0x2f'),{'module':'chan_sip.so'});}return null;})[_0x9437('0x22')](handleError(_0x229c52,null));}; \ No newline at end of file +var _0x6108=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','Network,\x20%s,\x20%s','message','info','result','sendStatus','status','undefined','limit','count','offset','set','apply','save','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','catch','sequelize','transaction','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','create','toUpperCase','TURN','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','STUN','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/network.ejs','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc73fa7,_0x464936){var _0x416880=function(_0xaf973e){while(--_0xaf973e){_0xc73fa7['push'](_0xc73fa7['shift']());}};_0x416880(++_0x464936);}(_0x6108,0xbc));var _0x8610=function(_0x1b71c5,_0x4fae33){_0x1b71c5=_0x1b71c5-0x0;var _0x256195=_0x6108[_0x1b71c5];return _0x256195;};'use strict';var emlformat=require(_0x8610('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8610('0x1'));var jsonpatch=require(_0x8610('0x2'));var rp=require(_0x8610('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8610('0x4'));var util=require(_0x8610('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8610('0x6'));var ejs=require(_0x8610('0x7'));var fs=require('fs');var fs_extra=require(_0x8610('0x8'));var _=require(_0x8610('0x9'));var squel=require('squel');var crypto=require(_0x8610('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8610('0xb'));var toCsv=require(_0x8610('0x6'));var querystring=require(_0x8610('0xc'));var Papa=require('papaparse');var Redis=require(_0x8610('0xd'));var authService=require(_0x8610('0xe'));var qs=require(_0x8610('0xf'));var as=require(_0x8610('0x10'));var hardwareService=require(_0x8610('0x11'));var logger=require(_0x8610('0x12'))('api');var utils=require(_0x8610('0x13'));var config=require(_0x8610('0x14'));var licenseUtil=require(_0x8610('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8610('0x16'));var client=jayson['client'][_0x8610('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x42e660,_0x413324,_0x277942,_0x3f5223){return new BPromise(function(_0x4eacbf,_0x49edbe){var _0x3ba11a=_0x3f5223||client;return _0x3ba11a[_0x8610('0x18')](_0x42e660,_0x277942)[_0x8610('0x19')](function(_0x5526b5){logger['info']('Network,\x20%s,\x20%s',_0x413324,_0x8610('0x1a'));logger[_0x8610('0x1b')](_0x8610('0x1c'),_0x413324,_0x8610('0x1a'),JSON['stringify'](_0x5526b5));if(_0x5526b5['error']){if(_0x5526b5[_0x8610('0x1d')]['code']===0x1f4){logger['error'](_0x8610('0x1e'),_0x413324,_0x5526b5['error']['message']);return _0x49edbe(_0x5526b5[_0x8610('0x1d')][_0x8610('0x1f')]);}logger['error'](_0x8610('0x1e'),_0x413324,_0x5526b5[_0x8610('0x1d')][_0x8610('0x1f')]);return _0x4eacbf(_0x5526b5[_0x8610('0x1d')][_0x8610('0x1f')]);}else{logger[_0x8610('0x20')](_0x8610('0x1e'),_0x413324,_0x8610('0x1a'));_0x4eacbf(_0x5526b5[_0x8610('0x21')][_0x8610('0x1f')]);}})['catch'](function(_0x71d01f){logger['error'](_0x8610('0x1e'),_0x413324,_0x71d01f);_0x49edbe(_0x71d01f);});});}function respondWithStatusCode(_0x2b8e7f,_0x8866a){_0x8866a=_0x8866a||0xcc;return function(_0x5103ad){if(_0x5103ad){return _0x2b8e7f[_0x8610('0x22')](_0x8866a);}return _0x2b8e7f['status'](_0x8866a)['end']();};}function respondWithResult(_0x4b3e6a,_0x5997da){_0x5997da=_0x5997da||0xc8;return function(_0x2e9cfd){if(_0x2e9cfd){return _0x4b3e6a[_0x8610('0x23')](_0x5997da)['json'](_0x2e9cfd);}};}function respondWithFilteredResult(_0x3cc4d2,_0x58daba){return function(_0xd97599){if(_0xd97599){var _0x2503bc=typeof _0x58daba['offset']===_0x8610('0x24')&&typeof _0x58daba[_0x8610('0x25')]===_0x8610('0x24');var _0x260fdc=_0xd97599[_0x8610('0x26')];var _0x3ad532=_0x2503bc?0x0:_0x58daba['offset'];var _0x42a104=_0x2503bc?_0xd97599[_0x8610('0x26')]:_0x58daba[_0x8610('0x27')]+_0x58daba['limit'];var _0x6fd01c;if(_0x42a104>=_0x260fdc){_0x42a104=_0x260fdc;_0x6fd01c=0xc8;}else{_0x6fd01c=0xce;}_0x3cc4d2['status'](_0x6fd01c);return _0x3cc4d2[_0x8610('0x28')]('Content-Range',_0x3ad532+'-'+_0x42a104+'/'+_0x260fdc)['json'](_0xd97599);}return null;};}function patchUpdates(_0x111256){return function(_0x1b4064){try{jsonpatch[_0x8610('0x29')](_0x1b4064,_0x111256,!![]);}catch(_0x53f7ac){return BPromise['reject'](_0x53f7ac);}return _0x1b4064[_0x8610('0x2a')]();};}function saveUpdates(_0x51e682,_0x1c4160){return function(_0x3a4a6b){if(_0x3a4a6b){return _0x3a4a6b[_0x8610('0x2b')](_0x51e682)[_0x8610('0x19')](function(_0x576a5a){return _0x576a5a;});}return null;};}function removeEntity(_0x2c228c,_0x3d8482){return function(_0x1bdfcd){if(_0x1bdfcd){return _0x1bdfcd[_0x8610('0x2c')]()[_0x8610('0x19')](function(){_0x2c228c[_0x8610('0x23')](0xcc)[_0x8610('0x2d')]();});}};}function handleEntityNotFound(_0x2d633e,_0x56601b){return function(_0x5cc619){if(!_0x5cc619){_0x2d633e[_0x8610('0x22')](0x194);}return _0x5cc619;};}function handleError(_0x1bf88a,_0x349c62){_0x349c62=_0x349c62||0x1f4;return function(_0x25949f){logger[_0x8610('0x1d')](_0x25949f[_0x8610('0x2e')]);if(_0x25949f[_0x8610('0x2f')]){delete _0x25949f[_0x8610('0x2f')];}_0x1bf88a[_0x8610('0x23')](_0x349c62)[_0x8610('0x30')](_0x25949f);};}exports[_0x8610('0x31')]=function(_0x5dc6dc,_0x32f264){var _0x573999={},_0x29fb41={},_0x566eaa={'count':0x0,'rows':[]};var _0x59b923=_[_0x8610('0x32')](db[_0x8610('0x33')][_0x8610('0x34')],function(_0x2233f3){return{'name':_0x2233f3[_0x8610('0x35')],'type':_0x2233f3['type']['key']};});_0x29fb41[_0x8610('0x36')]=_[_0x8610('0x32')](_0x59b923,_0x8610('0x2f'));_0x29fb41['query']=_['keys'](_0x5dc6dc[_0x8610('0x37')]);_0x29fb41[_0x8610('0x38')]=_[_0x8610('0x39')](_0x29fb41[_0x8610('0x36')],_0x29fb41[_0x8610('0x37')]);_0x573999[_0x8610('0x3a')]=_[_0x8610('0x39')](_0x29fb41[_0x8610('0x36')],qs[_0x8610('0x3b')](_0x5dc6dc[_0x8610('0x37')][_0x8610('0x3b')]));_0x573999['attributes']=_0x573999['attributes'][_0x8610('0x3c')]?_0x573999[_0x8610('0x3a')]:_0x29fb41[_0x8610('0x36')];if(!_0x5dc6dc['query']['hasOwnProperty'](_0x8610('0x3d'))){_0x573999[_0x8610('0x25')]=qs[_0x8610('0x25')](_0x5dc6dc[_0x8610('0x37')][_0x8610('0x25')]);_0x573999['offset']=qs[_0x8610('0x27')](_0x5dc6dc['query']['offset']);}_0x573999[_0x8610('0x3e')]=qs[_0x8610('0x3f')](_0x5dc6dc[_0x8610('0x37')][_0x8610('0x3f')]);_0x573999[_0x8610('0x40')]=qs[_0x8610('0x38')](_[_0x8610('0x41')](_0x5dc6dc[_0x8610('0x37')],_0x29fb41['filters']),_0x59b923);if(_0x5dc6dc[_0x8610('0x37')][_0x8610('0x42')]){_0x573999[_0x8610('0x40')]=_[_0x8610('0x43')](_0x573999['where'],{'$or':_[_0x8610('0x32')](_0x59b923,function(_0x59d9a5){if(_0x59d9a5[_0x8610('0x44')]!==_0x8610('0x45')){var _0x412824={};_0x412824[_0x59d9a5[_0x8610('0x2f')]]={'$like':'%'+_0x5dc6dc[_0x8610('0x37')][_0x8610('0x42')]+'%'};return _0x412824;}})});}_0x573999=_[_0x8610('0x43')]({},_0x573999,_0x5dc6dc[_0x8610('0x46')]);var _0x94bf23={'where':_0x573999[_0x8610('0x40')]};return db[_0x8610('0x33')]['count'](_0x94bf23)[_0x8610('0x19')](function(_0x3d9ce4){_0x566eaa[_0x8610('0x26')]=_0x3d9ce4;if(_0x5dc6dc['query'][_0x8610('0x47')]){_0x573999['include']=[{'all':!![]}];}return db[_0x8610('0x33')][_0x8610('0x48')](_0x573999);})[_0x8610('0x19')](function(_0x1d7241){_0x566eaa[_0x8610('0x49')]=_0x1d7241;return _0x566eaa;})[_0x8610('0x19')](respondWithFilteredResult(_0x32f264,_0x573999))['catch'](handleError(_0x32f264,null));};exports['show']=function(_0xc9abaf,_0x5d2544){var _0x5755e8={'raw':!![],'where':{'id':_0xc9abaf[_0x8610('0x4a')]['id']}},_0x536197={};_0x536197[_0x8610('0x36')]=_[_0x8610('0x4b')](db[_0x8610('0x33')]['rawAttributes']);_0x536197[_0x8610('0x37')]=_['keys'](_0xc9abaf['query']);_0x536197[_0x8610('0x38')]=_[_0x8610('0x39')](_0x536197[_0x8610('0x36')],_0x536197[_0x8610('0x37')]);_0x5755e8['attributes']=_['intersection'](_0x536197['model'],qs[_0x8610('0x3b')](_0xc9abaf[_0x8610('0x37')][_0x8610('0x3b')]));_0x5755e8[_0x8610('0x3a')]=_0x5755e8[_0x8610('0x3a')]['length']?_0x5755e8[_0x8610('0x3a')]:_0x536197[_0x8610('0x36')];if(_0xc9abaf[_0x8610('0x37')][_0x8610('0x47')]){_0x5755e8[_0x8610('0x4c')]=[{'all':!![]}];}_0x5755e8=_['merge']({},_0x5755e8,_0xc9abaf[_0x8610('0x46')]);return db[_0x8610('0x33')][_0x8610('0x4d')](_0x5755e8)[_0x8610('0x19')](handleEntityNotFound(_0x5d2544,null))['then'](respondWithResult(_0x5d2544,null))[_0x8610('0x4e')](handleError(_0x5d2544,null));};exports['create']=function(_0x18001c,_0x54058f,_0x52ed2f){var _0x4b9f68;return db[_0x8610('0x4f')][_0x8610('0x50')](function(_0x1b4789){return db[_0x8610('0x33')]['create'](_0x18001c[_0x8610('0x51')],{'raw':!![]})[_0x8610('0x19')](function(_0x21e506){_0x4b9f68=_0x21e506;return db[_0x8610('0x33')][_0x8610('0x48')]({'where':{'type':_0x18001c[_0x8610('0x51')][_0x8610('0x44')]},'raw':!![]});})['then'](function(_0x4a3015){if(_0x4b9f68['type']['toUpperCase']()=='STUN'){var _0x3e2138=fs[_0x8610('0x52')](path[_0x8610('0x53')](config[_0x8610('0x54')],_0x8610('0x55')),_0x8610('0x56'));var _0x30ef9f=ejs[_0x8610('0x57')](_0x3e2138,{'networks':_0x4a3015||[]});fs[_0x8610('0x58')]('/etc/asterisk/stun_xcally.conf',_0x30ef9f);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x5a'),{'module':'res_stun_monitor.so'});}else if(_0x4b9f68[_0x8610('0x44')][_0x8610('0x5b')]()==_0x8610('0x5c')){var _0xfca91d=fs[_0x8610('0x52')](path[_0x8610('0x53')](config[_0x8610('0x54')],'server/files/templates/turn_multiple.ejs'),_0x8610('0x56'));var _0x1a9cbd=ejs['render'](_0xfca91d,{'networks':_0x4a3015||[]});fs[_0x8610('0x58')](_0x8610('0x5d'),_0x1a9cbd);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x5a'),{'module':'res_stun_monitor.so'});}else{var _0xef55c7=fs[_0x8610('0x52')](path[_0x8610('0x53')](config['root'],'server/files/templates/network.ejs'),_0x8610('0x56'));var _0x105a36=ejs['render'](_0xef55c7,{'networks':_0x4a3015||[]});fs[_0x8610('0x58')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x18001c[_0x8610('0x51')][_0x8610('0x44')][_0x8610('0x5e')]()),_0x105a36);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x5a'),{'module':_0x8610('0x5f')});}return null;})[_0x8610('0x19')](function(){return _0x4b9f68;});})[_0x8610('0x19')](respondWithResult(_0x54058f,0xc9))[_0x8610('0x4e')](handleError(_0x54058f,null));};exports[_0x8610('0x2b')]=function(_0x245484,_0x52f082,_0x1ca674){var _0x5ae321;return db[_0x8610('0x4f')]['transaction'](function(_0x3c7d79){return db[_0x8610('0x33')][_0x8610('0x4d')]({'where':{'id':_0x245484[_0x8610('0x4a')]['id']}})[_0x8610('0x19')](handleEntityNotFound(_0x52f082,null))['then'](saveUpdates(_0x245484[_0x8610('0x51')],null))[_0x8610('0x19')](function(_0xa5d651){if(_0xa5d651){_0x5ae321=_0xa5d651;return db['Network']['findAll']({'where':{'type':_0x5ae321[_0x8610('0x44')]},'raw':!![]});}return null;})[_0x8610('0x19')](function(_0x47522d){if(_0x5ae321[_0x8610('0x44')]['toUpperCase']()==_0x8610('0x60')){var _0x1e0458=fs['readFileSync'](path[_0x8610('0x53')](config['root'],_0x8610('0x55')),'utf8');var _0x16ce97=ejs[_0x8610('0x57')](_0x1e0458,{'networks':_0x47522d||[]});fs[_0x8610('0x58')](_0x8610('0x61'),_0x16ce97);return respondWithRpcPromise('Reload',_0x8610('0x2b'),{'module':_0x8610('0x62')});}else if(_0x5ae321[_0x8610('0x44')][_0x8610('0x5b')]()==_0x8610('0x5c')){var _0x2a2599=fs[_0x8610('0x52')](path[_0x8610('0x53')](config['root'],_0x8610('0x63')),_0x8610('0x56'));var _0x459eee=ejs[_0x8610('0x57')](_0x2a2599,{'networks':_0x47522d||[]});fs['writeFileSync'](_0x8610('0x5d'),_0x459eee);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x2b'),{'module':_0x8610('0x62')});}else{var _0x1bc417=fs[_0x8610('0x52')](path[_0x8610('0x53')](config[_0x8610('0x54')],'server/files/templates/network.ejs'),_0x8610('0x56'));var _0x4b4663=ejs[_0x8610('0x57')](_0x1bc417,{'networks':_0x47522d||[]});fs[_0x8610('0x58')](util[_0x8610('0x64')](_0x8610('0x65'),_0x245484[_0x8610('0x51')][_0x8610('0x44')][_0x8610('0x5e')]()),_0x4b4663);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x2b'),{'module':_0x8610('0x5f')});}return null;})[_0x8610('0x19')](function(_0x3a66a9){if(_0x3a66a9){return _0x5ae321;}return null;});})[_0x8610('0x19')](respondWithResult(_0x52f082,null))['catch'](handleError(_0x52f082,null));};exports[_0x8610('0x2c')]=function(_0x15b1df,_0x5bd42e,_0x106024){var _0x552884;return db[_0x8610('0x33')]['find']({'where':{'id':_0x15b1df[_0x8610('0x4a')]['id']}})[_0x8610('0x19')](function(_0x49570a){_0x552884=_0x49570a;return _0x49570a;})[_0x8610('0x19')](handleEntityNotFound(_0x5bd42e,null))['then'](removeEntity(_0x5bd42e,null))[_0x8610('0x19')](function(){if(_0x552884){return db['Network']['findAll']({'where':{'type':_0x552884['type']},'raw':!![]});}})[_0x8610('0x19')](function(_0x2663b1){if(_0x552884[_0x8610('0x44')][_0x8610('0x5b')]()==_0x8610('0x60')){var _0x5bae3b=fs['readFileSync'](path[_0x8610('0x53')](config[_0x8610('0x54')],_0x8610('0x55')),_0x8610('0x56'));var _0x54fdda=ejs[_0x8610('0x57')](_0x5bae3b,{'networks':_0x2663b1||[]});fs[_0x8610('0x58')](_0x8610('0x61'),_0x54fdda);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x2c'),{'module':'res_stun_monitor.so'});}else if(_0x552884[_0x8610('0x44')][_0x8610('0x5b')]()=='TURN'){var _0x4ab387=fs[_0x8610('0x52')](path[_0x8610('0x53')](config['root'],_0x8610('0x63')),_0x8610('0x56'));var _0x300b24=ejs[_0x8610('0x57')](_0x4ab387,{'networks':_0x2663b1||[]});fs[_0x8610('0x58')]('/etc/asterisk/turn_xcally.conf',_0x300b24);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x2c'),{'module':_0x8610('0x62')});}else{var _0x48375c=fs[_0x8610('0x52')](path['join'](config[_0x8610('0x54')],_0x8610('0x66')),_0x8610('0x56'));var _0x1a56a9=ejs['render'](_0x48375c,{'networks':_0x2663b1||[]});fs[_0x8610('0x58')](util[_0x8610('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x15b1df[_0x8610('0x51')][_0x8610('0x44')][_0x8610('0x5e')]()),_0x1a56a9);return respondWithRpcPromise(_0x8610('0x59'),_0x8610('0x2c'),{'module':_0x8610('0x5f')});}return null;})[_0x8610('0x4e')](handleError(_0x5bd42e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 10ca72f..a724840 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 _0x235a=['exports','Network','network','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x1fddfd,_0x153a74){var _0x595b32=function(_0x2512d4){while(--_0x2512d4){_0x1fddfd['push'](_0x1fddfd['shift']());}};_0x595b32(++_0x153a74);}(_0x235a,0x1ef));var _0xa235=function(_0x470bd6,_0xe0cae6){_0x470bd6=_0x470bd6-0x0;var _0x304b54=_0x235a[_0x470bd6];return _0x304b54;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))('api');var moment=require(_0xa235('0x3'));var BPromise=require('bluebird');var rp=require(_0xa235('0x4'));var fs=require('fs');var path=require(_0xa235('0x5'));var rimraf=require(_0xa235('0x6'));var config=require(_0xa235('0x7'));var attributes=require(_0xa235('0x8'));module[_0xa235('0x9')]=function(_0x2961c8,_0x1707fc){return _0x2961c8['define'](_0xa235('0xa'),attributes,{'tableName':_0xa235('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','lodash','api','moment'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x2e54,0x1dd));var _0x42e5=function(_0x415ab3,_0x486b05){_0x415ab3=_0x415ab3-0x0;var _0x573807=_0x2e54[_0x415ab3];return _0x573807;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require(_0x42e5('0x5'));var rimraf=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var attributes=require('./network.attributes');module[_0x42e5('0x8')]=function(_0x455f48,_0x38cb1b){return _0x455f48['define'](_0x42e5('0x9'),attributes,{'tableName':'network','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 5644e2c..d1da953 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(_0x519f44,_0x15bcf1){_0x519f44=_0x519f44-0x0;var _0xeb9301=_0x7a54[_0x519f44];return _0xeb9301;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x392d2f,_0x4901cc){_0x392d2f=_0x392d2f-0x0;var _0x44ef87=_0x7a54[_0x392d2f];return _0x44ef87;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 47e441e..3df9b1f 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 _0xea72=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/users','/:id/send','put','update','delete','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x40b3d4,_0x46e731){var _0x2b317b=function(_0x253829){while(--_0x253829){_0x40b3d4['push'](_0x40b3d4['shift']());}};_0x2b317b(++_0x46e731);}(_0xea72,0xf4));var _0x2ea7=function(_0x69745b,_0x493b54){_0x69745b=_0x69745b-0x0;var _0xd32538=_0xea72[_0x69745b];return _0xd32538;};'use strict';var multer=require(_0x2ea7('0x0'));var util=require(_0x2ea7('0x1'));var path=require('path');var timeout=require(_0x2ea7('0x2'));var express=require(_0x2ea7('0x3'));var router=express[_0x2ea7('0x4')]();var fs_extra=require(_0x2ea7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2ea7('0x6'));var config=require('../../config/environment');var controller=require(_0x2ea7('0x7'));router[_0x2ea7('0x8')]('/',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xa')]);router[_0x2ea7('0x8')](_0x2ea7('0xb'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xc')]);router[_0x2ea7('0x8')](_0x2ea7('0xd'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xe')]);router[_0x2ea7('0x8')](_0x2ea7('0xf'),auth['isAuthenticated'](),controller[_0x2ea7('0x10')]);router[_0x2ea7('0x8')](_0x2ea7('0x11'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x12')]);router[_0x2ea7('0x8')]('/:id/applications',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x13')]);router[_0x2ea7('0x8')](_0x2ea7('0x14'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x2ea7('0x16')]);router[_0x2ea7('0x17')]('/',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x18')]);router[_0x2ea7('0x17')](_0x2ea7('0xf'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x19')]);router[_0x2ea7('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2ea7('0x1a')]);router[_0x2ea7('0x17')](_0x2ea7('0x1b'),controller['notify']);router['post'](_0x2ea7('0x1c'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x1d')]);router[_0x2ea7('0x17')](_0x2ea7('0x1e'),auth[_0x2ea7('0x9')](),controller['addAgents']);router[_0x2ea7('0x17')](_0x2ea7('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x2ea7('0x20')]('/:id',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x21')]);router[_0x2ea7('0x22')]('/:id',auth[_0x2ea7('0x9')](),controller['destroy']);router[_0x2ea7('0x22')](_0x2ea7('0xf'),auth['isAuthenticated'](),controller[_0x2ea7('0x23')]);router[_0x2ea7('0x22')](_0x2ea7('0x11'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x24')]);router[_0x2ea7('0x22')](_0x2ea7('0x1e'),auth[_0x2ea7('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf4f4=['getApplications','/:id/interactions','getInteractions','getAgents','addDisposition','post','/:id/canned_answers','notify','addApplications','/:id/users','addAgents','/:id/send','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications'];(function(_0x2c34f9,_0x3c9896){var _0x3b1e39=function(_0x1ec963){while(--_0x1ec963){_0x2c34f9['push'](_0x2c34f9['shift']());}};_0x3b1e39(++_0x3c9896);}(_0xf4f4,0x140));var _0x4f4f=function(_0x591565,_0x5371f8){_0x591565=_0x591565-0x0;var _0x17666b=_0xf4f4[_0x591565];return _0x17666b;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require(_0x4f4f('0x2'));var timeout=require(_0x4f4f('0x3'));var express=require(_0x4f4f('0x4'));var router=express['Router']();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require(_0x4f4f('0x7'));var config=require(_0x4f4f('0x8'));var controller=require(_0x4f4f('0x9'));router[_0x4f4f('0xa')]('/',auth[_0x4f4f('0xb')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xa')](_0x4f4f('0xf'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0xa')](_0x4f4f('0x11'),auth[_0x4f4f('0xb')](),controller['getDispositions']);router[_0x4f4f('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0xa')](_0x4f4f('0x13'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x14')]);router[_0x4f4f('0xa')](_0x4f4f('0x15'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x16')]);router[_0x4f4f('0xa')]('/:id/users',auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x17')]);router['post']('/',auth[_0x4f4f('0xb')](),controller['create']);router['post'](_0x4f4f('0x11'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x4f4f('0x1b')]);router[_0x4f4f('0x19')](_0x4f4f('0x13'),auth[_0x4f4f('0xb')](),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);router[_0x4f4f('0x19')](_0x4f4f('0x1f'),auth[_0x4f4f('0xb')](),controller['send']);router['put'](_0x4f4f('0xf'),auth[_0x4f4f('0xb')](),controller['update']);router[_0x4f4f('0x20')](_0x4f4f('0xf'),auth[_0x4f4f('0xb')](),controller['destroy']);router[_0x4f4f('0x20')]('/:id/dispositions',auth[_0x4f4f('0xb')](),controller['removeDispositions']);router[_0x4f4f('0x20')](_0x4f4f('0x1a'),auth[_0x4f4f('0xb')](),controller['removeAnswers']);router[_0x4f4f('0x20')]('/:id/users',auth[_0x4f4f('0xb')](),controller['removeAgents']);module[_0x4f4f('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b31bd6d..0e85649 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 _0xb02c=['setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','BOOLEAN','INTEGER'];(function(_0x1460bc,_0x509d3b){var _0x1bb22c=function(_0x57b4f5){while(--_0x57b4f5){_0x1460bc['push'](_0x1460bc['shift']());}};_0x1bb22c(++_0x509d3b);}(_0xb02c,0xbf));var _0xcb02=function(_0x308f41,_0x4a2164){_0x308f41=_0x308f41-0x0;var _0x10957e=_0xb02c[_0x308f41];return _0x10957e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcb02('0x0'));module[_0xcb02('0x1')]={'name':{'type':Sequelize[_0xcb02('0x2')],'unique':_0xcb02('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcb02('0x2')]},'token':{'type':Sequelize[_0xcb02('0x2')],'defaultValue':function(){return rs[_0xcb02('0x4')]();}},'replyUri':{'type':Sequelize[_0xcb02('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcb02('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcb02('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb02('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcb02('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb02('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb02('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb02('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb02('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcb02('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43a0ac){if(!_0x43a0ac)this[_0xcb02('0x7')](_0xcb02('0x8'),null);this[_0xcb02('0x7')]('mandatoryDisposition',_0x43a0ac);}}}; \ No newline at end of file +var _0x0c35=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5d54a5,_0x1a889a){var _0x62b2e1=function(_0x113141){while(--_0x113141){_0x5d54a5['push'](_0x5d54a5['shift']());}};_0x62b2e1(++_0x1a889a);}(_0x0c35,0x6b));var _0x50c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c35[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x50c3('0x0'));var rs=require(_0x50c3('0x1'));module[_0x50c3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x50c3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x50c3('0x4')]},'token':{'type':Sequelize[_0x50c3('0x4')],'defaultValue':function(){return rs[_0x50c3('0x5')]();}},'replyUri':{'type':Sequelize[_0x50c3('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x50c3('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x50c3('0x6')],'defaultValue':function(){return _0x50c3('0x7');}},'notificationSound':{'type':Sequelize[_0x50c3('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50c3('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x50c3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x50c3('0x4')]},'queueTransfer':{'type':Sequelize[_0x50c3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50c3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x50c3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x50c3('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x50c3('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x50c3('0x8')],'defaultValue':![],'comment':_0x50c3('0xb'),'set':function(_0x5f29a4){if(!_0x5f29a4)this[_0x50c3('0xc')](_0x50c3('0xd'),null);this[_0x50c3('0xc')](_0x50c3('0xe'),_0x5f29a4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ee86bcd..bf43ca5 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 _0x163c=['mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','findAll','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','sendStatus','send','getApplications','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','dataValues','Messages','eml-format','rimraf','zip-dir','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/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','get','OpenchannelAccounts','destroy','name','index','Pause','map','OpenchannelAccount','fieldName','model','query','keys','filters','intersection','fields','length','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x6ba4de,_0x3cb045){var _0x27d232=function(_0x5daeb9){while(--_0x5daeb9){_0x6ba4de['push'](_0x6ba4de['shift']());}};_0x27d232(++_0x3cb045);}(_0x163c,0x1ea));var _0xc163=function(_0x3d0965,_0x1916ae){_0x3d0965=_0x3d0965-0x0;var _0x36c787=_0x163c[_0x3d0965];return _0x36c787;};'use strict';var emlformat=require(_0xc163('0x0'));var rimraf=require(_0xc163('0x1'));var zipdir=require(_0xc163('0x2'));var jsonpatch=require(_0xc163('0x3'));var rp=require('request-promise');var moment=require(_0xc163('0x4'));var BPromise=require(_0xc163('0x5'));var Mustache=require(_0xc163('0x6'));var util=require(_0xc163('0x7'));var path=require(_0xc163('0x8'));var sox=require(_0xc163('0x9'));var csv=require(_0xc163('0xa'));var ejs=require(_0xc163('0xb'));var fs=require('fs');var fs_extra=require(_0xc163('0xc'));var _=require('lodash');var squel=require(_0xc163('0xd'));var crypto=require(_0xc163('0xe'));var jsforce=require(_0xc163('0xf'));var deskjs=require(_0xc163('0x10'));var toCsv=require(_0xc163('0xa'));var querystring=require(_0xc163('0x11'));var Papa=require(_0xc163('0x12'));var Redis=require(_0xc163('0x13'));var authService=require(_0xc163('0x14'));var qs=require(_0xc163('0x15'));var as=require(_0xc163('0x16'));var hardwareService=require(_0xc163('0x17'));var logger=require('../../config/logger')(_0xc163('0x18'));var utils=require('../../config/utils');var config=require(_0xc163('0x19'));var licenseUtil=require(_0xc163('0x1a'));var db=require(_0xc163('0x1b'))['db'];config[_0xc163('0x1c')]=_['defaults'](config[_0xc163('0x1c')],{'host':_0xc163('0x1d'),'port':0x18eb});var socket=require(_0xc163('0x1e'))(new Redis(config[_0xc163('0x1c')]));require(_0xc163('0x1f'))['register'](socket);var jayson=require(_0xc163('0x20'));var client=jayson[_0xc163('0x21')][_0xc163('0x22')]({'port':0x232c});var client9002=jayson[_0xc163('0x21')][_0xc163('0x22')]({'port':0x232a});function respondWithRpcPromise(_0xb78465,_0x34b0d7,_0x2e98bb,_0x5f30e0){return new BPromise(function(_0x7a4915,_0x3749c9){var _0x1de3de=_0x5f30e0||client;return _0x1de3de[_0xc163('0x23')](_0xb78465,_0x2e98bb)['then'](function(_0x5075a7){logger[_0xc163('0x24')](_0xc163('0x25'),_0x34b0d7,_0xc163('0x26'));logger[_0xc163('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x34b0d7,_0xc163('0x26'),JSON[_0xc163('0x28')](_0x5075a7));if(_0x5075a7['error']){if(_0x5075a7[_0xc163('0x29')][_0xc163('0x2a')]===0x1f4){logger[_0xc163('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x34b0d7,_0x5075a7[_0xc163('0x29')][_0xc163('0x2b')]);return _0x3749c9(_0x5075a7[_0xc163('0x29')][_0xc163('0x2b')]);}logger['error'](_0xc163('0x25'),_0x34b0d7,_0x5075a7[_0xc163('0x29')]['message']);return _0x7a4915(_0x5075a7['error'][_0xc163('0x2b')]);}else{logger['info'](_0xc163('0x25'),_0x34b0d7,_0xc163('0x26'));_0x7a4915(_0x5075a7[_0xc163('0x2c')]['message']);}})['catch'](function(_0xd07b84){logger['error'](_0xc163('0x25'),_0x34b0d7,_0xd07b84);_0x3749c9(_0xd07b84);});});}function respondWithStatusCode(_0x5829b3,_0x122ff7){_0x122ff7=_0x122ff7||0xcc;return function(_0x384eec){if(_0x384eec){return _0x5829b3['sendStatus'](_0x122ff7);}return _0x5829b3['status'](_0x122ff7)[_0xc163('0x2d')]();};}function respondWithResult(_0x9f181d,_0x21f6f2){_0x21f6f2=_0x21f6f2||0xc8;return function(_0x27a30f){if(_0x27a30f){return _0x9f181d['status'](_0x21f6f2)[_0xc163('0x2e')](_0x27a30f);}};}function respondWithFilteredResult(_0x3baba5,_0x492bfc){return function(_0x271302){if(_0x271302){var _0x22ac16=typeof _0x492bfc[_0xc163('0x2f')]===_0xc163('0x30')&&typeof _0x492bfc[_0xc163('0x31')]===_0xc163('0x30');var _0x4958df=_0x271302['count'];var _0x1a3921=_0x22ac16?0x0:_0x492bfc['offset'];var _0x4cdafe=_0x22ac16?_0x271302[_0xc163('0x32')]:_0x492bfc[_0xc163('0x2f')]+_0x492bfc[_0xc163('0x31')];var _0x198ba7;if(_0x4cdafe>=_0x4958df){_0x4cdafe=_0x4958df;_0x198ba7=0xc8;}else{_0x198ba7=0xce;}_0x3baba5[_0xc163('0x33')](_0x198ba7);return _0x3baba5[_0xc163('0x34')](_0xc163('0x35'),_0x1a3921+'-'+_0x4cdafe+'/'+_0x4958df)[_0xc163('0x2e')](_0x271302);}return null;};}function patchUpdates(_0x472d3c){return function(_0x3c5a99){try{jsonpatch[_0xc163('0x36')](_0x3c5a99,_0x472d3c,!![]);}catch(_0x5b2da5){return BPromise[_0xc163('0x37')](_0x5b2da5);}return _0x3c5a99['save']();};}function saveUpdates(_0x2e3642,_0x35c035){return function(_0x407712){if(_0x407712){return _0x407712[_0xc163('0x38')](_0x2e3642)[_0xc163('0x39')](function(_0x388dc8){return _0x388dc8;});}return null;};}function removeEntity(_0x32fd4d,_0xf8dc90){return function(_0x5541b0){if(_0x5541b0){return _0x5541b0['destroy']()[_0xc163('0x39')](function(){var _0x48ec7c=_0x5541b0[_0xc163('0x3a')]({'plain':!![]});var _0x19f4b4=_0xc163('0x3b');return db['UserProfileResource'][_0xc163('0x3c')]({'where':{'type':_0x19f4b4,'resourceId':_0x48ec7c['id']}})['then'](function(){return _0x5541b0;});})[_0xc163('0x39')](function(){_0x32fd4d[_0xc163('0x33')](0xcc)[_0xc163('0x2d')]();});}};}function handleEntityNotFound(_0x381856,_0x466d0c){return function(_0x207987){if(!_0x207987){_0x381856['sendStatus'](0x194);}return _0x207987;};}function handleError(_0x37be1e,_0x4466c7){_0x4466c7=_0x4466c7||0x1f4;return function(_0x1874b8){logger[_0xc163('0x29')](_0x1874b8['stack']);if(_0x1874b8[_0xc163('0x3d')]){delete _0x1874b8[_0xc163('0x3d')];}_0x37be1e['status'](_0x4466c7)['send'](_0x1874b8);};}exports[_0xc163('0x3e')]=function(_0x1f3044,_0x27c555){var _0x39b391={'include':[{'model':db[_0xc163('0x3f')],'as':'mandatoryDispositionPause'}]},_0x10377b={},_0x4247df={'count':0x0,'rows':[]};var _0x188b33=_[_0xc163('0x40')](db[_0xc163('0x41')]['rawAttributes'],function(_0x49709d){return{'name':_0x49709d[_0xc163('0x42')],'type':_0x49709d['type']['key']};});_0x10377b[_0xc163('0x43')]=_[_0xc163('0x40')](_0x188b33,_0xc163('0x3d'));_0x10377b[_0xc163('0x44')]=_[_0xc163('0x45')](_0x1f3044[_0xc163('0x44')]);_0x10377b[_0xc163('0x46')]=_[_0xc163('0x47')](_0x10377b[_0xc163('0x43')],_0x10377b['query']);_0x39b391['attributes']=_['intersection'](_0x10377b['model'],qs[_0xc163('0x48')](_0x1f3044[_0xc163('0x44')]['fields']));_0x39b391['attributes']=_0x39b391['attributes'][_0xc163('0x49')]?_0x39b391[_0xc163('0x4a')]:_0x10377b[_0xc163('0x43')];if(!_0x1f3044[_0xc163('0x44')]['hasOwnProperty']('nolimit')){_0x39b391[_0xc163('0x31')]=qs[_0xc163('0x31')](_0x1f3044['query'][_0xc163('0x31')]);_0x39b391[_0xc163('0x2f')]=qs[_0xc163('0x2f')](_0x1f3044[_0xc163('0x44')][_0xc163('0x2f')]);}_0x39b391[_0xc163('0x4b')]=qs[_0xc163('0x4c')](_0x1f3044[_0xc163('0x44')][_0xc163('0x4c')]);_0x39b391[_0xc163('0x4d')]=qs['filters'](_[_0xc163('0x4e')](_0x1f3044['query'],_0x10377b[_0xc163('0x46')]),_0x188b33);if(_0x1f3044[_0xc163('0x44')][_0xc163('0x4f')]){_0x39b391[_0xc163('0x4d')]=_[_0xc163('0x50')](_0x39b391[_0xc163('0x4d')],{'$or':_[_0xc163('0x40')](_0x188b33,function(_0x2f7eb2){if(_0x2f7eb2[_0xc163('0x51')]!==_0xc163('0x52')){var _0x3a8002={};_0x3a8002[_0x2f7eb2[_0xc163('0x3d')]]={'$like':'%'+_0x1f3044[_0xc163('0x44')][_0xc163('0x4f')]+'%'};return _0x3a8002;}})});}_0x39b391=_['merge']({},_0x39b391,_0x1f3044[_0xc163('0x53')]);var _0x146627={'where':_0x39b391[_0xc163('0x4d')]};return db[_0xc163('0x41')][_0xc163('0x32')](_0x146627)['then'](function(_0x1d6526){_0x4247df[_0xc163('0x32')]=_0x1d6526;if(_0x1f3044['query'][_0xc163('0x54')]){_0x39b391[_0xc163('0x55')]=[{'all':!![]}];}return db[_0xc163('0x41')]['findAll'](_0x39b391);})[_0xc163('0x39')](function(_0x22ccc6){_0x4247df[_0xc163('0x56')]=_0x22ccc6;return _0x4247df;})['then'](respondWithFilteredResult(_0x27c555,_0x39b391))[_0xc163('0x57')](handleError(_0x27c555,null));};exports['show']=function(_0x3bcff7,_0x5c93d2){var _0x33d6f9={'raw':![],'where':{'id':_0x3bcff7[_0xc163('0x58')]['id']},'include':[{'model':db[_0xc163('0x3f')],'as':_0xc163('0x59')}]},_0x523eb9={};_0x523eb9[_0xc163('0x43')]=_[_0xc163('0x45')](db[_0xc163('0x41')][_0xc163('0x5a')]);_0x523eb9[_0xc163('0x44')]=_['keys'](_0x3bcff7[_0xc163('0x44')]);_0x523eb9['filters']=_[_0xc163('0x47')](_0x523eb9['model'],_0x523eb9[_0xc163('0x44')]);_0x33d6f9[_0xc163('0x4a')]=_[_0xc163('0x47')](_0x523eb9[_0xc163('0x43')],qs['fields'](_0x3bcff7[_0xc163('0x44')][_0xc163('0x48')]));_0x33d6f9[_0xc163('0x4a')]=_0x33d6f9['attributes'][_0xc163('0x49')]?_0x33d6f9['attributes']:_0x523eb9[_0xc163('0x43')];if(_0x3bcff7[_0xc163('0x44')][_0xc163('0x54')]){_0x33d6f9[_0xc163('0x55')]=[{'all':!![]}];}_0x33d6f9=_[_0xc163('0x50')]({},_0x33d6f9,_0x3bcff7[_0xc163('0x53')]);return db[_0xc163('0x41')][_0xc163('0x5b')](_0x33d6f9)[_0xc163('0x39')](handleEntityNotFound(_0x5c93d2,null))[_0xc163('0x39')](respondWithResult(_0x5c93d2,null))[_0xc163('0x57')](handleError(_0x5c93d2,null));};exports[_0xc163('0x5c')]=function(_0x5f37ee,_0x154c81){return db[_0xc163('0x41')][_0xc163('0x5c')](_0x5f37ee[_0xc163('0x5d')],{})[_0xc163('0x39')](function(_0x1d346a){var _0x1a88a2=_0x5f37ee[_0xc163('0x5e')][_0xc163('0x3a')]({'plain':!![]});if(!_0x1a88a2)throw new Error(_0xc163('0x5f'));if(_0x1a88a2['role']===_0xc163('0x5e')){var _0x26c013=_0x1d346a[_0xc163('0x3a')]({'plain':!![]});var _0x32884d=_0xc163('0x3b');return db[_0xc163('0x60')][_0xc163('0x5b')]({'where':{'name':_0x32884d,'userProfileId':_0x1a88a2[_0xc163('0x61')]},'raw':!![]})[_0xc163('0x39')](function(_0xb2a9c9){if(_0xb2a9c9&&_0xb2a9c9[_0xc163('0x62')]===0x0){return db['UserProfileResource'][_0xc163('0x5c')]({'name':_0x26c013[_0xc163('0x3d')],'resourceId':_0x26c013['id'],'type':_0xb2a9c9[_0xc163('0x3d')],'sectionId':_0xb2a9c9['id']},{})[_0xc163('0x39')](function(){return _0x1d346a;});}else{return _0x1d346a;}})[_0xc163('0x57')](function(_0x54ab0e){logger[_0xc163('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54ab0e);throw _0x54ab0e;});}return _0x1d346a;})['then'](respondWithResult(_0x154c81,0xc9))[_0xc163('0x57')](handleError(_0x154c81,null));};exports[_0xc163('0x38')]=function(_0x331e67,_0x376a8b){if(_0x331e67['body']['id']){delete _0x331e67[_0xc163('0x5d')]['id'];}return db[_0xc163('0x41')][_0xc163('0x5b')]({'where':{'id':_0x331e67[_0xc163('0x58')]['id']},'include':[{'model':db[_0xc163('0x3f')],'as':_0xc163('0x59')}]})['then'](handleEntityNotFound(_0x376a8b,null))[_0xc163('0x39')](saveUpdates(_0x331e67['body'],null))[_0xc163('0x39')](respondWithResult(_0x376a8b,null))[_0xc163('0x57')](handleError(_0x376a8b,null));};exports[_0xc163('0x3c')]=function(_0x5916d7,_0x296094){return db[_0xc163('0x41')]['find']({'where':{'id':_0x5916d7[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x296094,null))[_0xc163('0x39')](removeEntity(_0x296094,null))[_0xc163('0x57')](handleError(_0x296094,null));};exports[_0xc163('0x63')]=function(_0x3a99e5,_0xfa1a3c){return db[_0xc163('0x41')]['describe']()[_0xc163('0x39')](respondWithResult(_0xfa1a3c,null))[_0xc163('0x57')](handleError(_0xfa1a3c,null));};exports['addDisposition']=function(_0x5acff0,_0x1bff45,_0x4d4403){if(_0x5acff0['body']['id']){delete _0x5acff0[_0xc163('0x5d')]['id'];}return db['OpenchannelAccount'][_0xc163('0x5b')]({'where':{'id':_0x5acff0[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x1bff45,null))['then'](function(_0x3baf28){if(_0x3baf28){_0x5acff0[_0xc163('0x5d')][_0xc163('0x64')]=_0x3baf28['id'];return db[_0xc163('0x65')][_0xc163('0x5c')](_0x5acff0['body']);}})[_0xc163('0x39')](respondWithResult(_0x1bff45,null))[_0xc163('0x57')](handleError(_0x1bff45,null));};exports[_0xc163('0x66')]=function(_0x277d32,_0x49f78b,_0x50d374){var _0x21c016={'raw':![],'where':{}};var _0x1dfaa8={};var _0x57c203={'count':0x0,'rows':[]};return db[_0xc163('0x41')][_0xc163('0x67')]({'where':{'id':_0x277d32[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x49f78b,null))[_0xc163('0x39')](function(_0xbfcee){if(_0xbfcee){_0x1dfaa8[_0xc163('0x43')]=_[_0xc163('0x45')](db[_0xc163('0x65')][_0xc163('0x5a')]);_0x1dfaa8[_0xc163('0x44')]=_['keys'](_0x277d32[_0xc163('0x44')]);_0x1dfaa8[_0xc163('0x46')]=_[_0xc163('0x47')](_0x1dfaa8[_0xc163('0x43')],_0x1dfaa8[_0xc163('0x44')]);_0x21c016[_0xc163('0x4a')]=_[_0xc163('0x47')](_0x1dfaa8[_0xc163('0x43')],qs[_0xc163('0x48')](_0x277d32[_0xc163('0x44')][_0xc163('0x48')]));_0x21c016[_0xc163('0x4a')]=_0x21c016[_0xc163('0x4a')]['length']?_0x21c016[_0xc163('0x4a')]:_0x1dfaa8['model'];if(!_0x277d32['query'][_0xc163('0x68')](_0xc163('0x69'))){_0x21c016['limit']=qs[_0xc163('0x31')](_0x277d32['query']['limit']);_0x21c016['offset']=qs[_0xc163('0x2f')](_0x277d32[_0xc163('0x44')][_0xc163('0x2f')]);}_0x21c016['order']=qs['sort'](_0x277d32[_0xc163('0x44')][_0xc163('0x4c')]);_0x21c016[_0xc163('0x4d')]=qs[_0xc163('0x46')](_[_0xc163('0x4e')](_0x277d32[_0xc163('0x44')],_0x1dfaa8[_0xc163('0x46')]));_0x21c016[_0xc163('0x4d')][_0xc163('0x64')]=_0xbfcee['id'];if(_0x277d32[_0xc163('0x44')][_0xc163('0x4f')]){_0x21c016[_0xc163('0x4d')]=_[_0xc163('0x50')](_0x21c016[_0xc163('0x4d')],{'$or':_[_0xc163('0x40')](_0x21c016[_0xc163('0x4a')],function(_0x2b3eb5){var _0x70a1fb={};_0x70a1fb[_0x2b3eb5]={'$like':'%'+_0x277d32[_0xc163('0x44')][_0xc163('0x4f')]+'%'};return _0x70a1fb;})});}_0x21c016=_['merge']({},_0x21c016,_0x277d32['options']);return db['Disposition'][_0xc163('0x32')]({'where':_0x21c016[_0xc163('0x4d')]})[_0xc163('0x39')](function(_0x4ec898){_0x57c203[_0xc163('0x32')]=_0x4ec898;if(_0x277d32[_0xc163('0x44')]['includeAll']){_0x21c016[_0xc163('0x55')]=[{'all':!![]}];}return db[_0xc163('0x65')][_0xc163('0x6a')](_0x21c016);})[_0xc163('0x39')](function(_0x22d68c){_0x57c203['rows']=_0x22d68c;return _0x57c203;});}})[_0xc163('0x39')](respondWithFilteredResult(_0x49f78b,_0x21c016))['catch'](handleError(_0x49f78b,null));};exports['removeDispositions']=function(_0x247bcd,_0x29f1db,_0x25e10f){return db[_0xc163('0x41')]['find']({'where':{'id':_0x247bcd['params']['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x29f1db,null))[_0xc163('0x39')](function(_0x545d23){if(_0x545d23){return _0x545d23['removeDispositions'](_0x247bcd[_0xc163('0x44')][_0xc163('0x6b')]);}})['then'](respondWithStatusCode(_0x29f1db,null))[_0xc163('0x57')](handleError(_0x29f1db,null));};exports[_0xc163('0x6c')]=function(_0x1fa844,_0x509484,_0x29d610){if(_0x1fa844['body']['id']){delete _0x1fa844['body']['id'];}return db[_0xc163('0x41')]['find']({'where':{'id':_0x1fa844[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x509484,null))[_0xc163('0x39')](function(_0x43dc02){if(_0x43dc02){_0x1fa844[_0xc163('0x5d')]['OpenchannelAccountId']=_0x43dc02['id'];return db[_0xc163('0x6d')][_0xc163('0x5c')](_0x1fa844[_0xc163('0x5d')]);}})[_0xc163('0x39')](respondWithResult(_0x509484,null))[_0xc163('0x57')](handleError(_0x509484,null));};exports[_0xc163('0x6e')]=function(_0x4bf29e,_0x202a22,_0x14c1d6){var _0x4b5021={'raw':![],'where':{}};var _0xe235b5={};var _0x24d8bb={'count':0x0,'rows':[]};return db[_0xc163('0x41')]['findOne']({'where':{'id':_0x4bf29e[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x202a22,null))[_0xc163('0x39')](function(_0x36470c){if(_0x36470c){_0xe235b5[_0xc163('0x43')]=_['keys'](db[_0xc163('0x6d')]['rawAttributes']);_0xe235b5[_0xc163('0x44')]=_[_0xc163('0x45')](_0x4bf29e[_0xc163('0x44')]);_0xe235b5[_0xc163('0x46')]=_[_0xc163('0x47')](_0xe235b5['model'],_0xe235b5['query']);_0x4b5021[_0xc163('0x4a')]=_[_0xc163('0x47')](_0xe235b5[_0xc163('0x43')],qs[_0xc163('0x48')](_0x4bf29e[_0xc163('0x44')]['fields']));_0x4b5021[_0xc163('0x4a')]=_0x4b5021[_0xc163('0x4a')][_0xc163('0x49')]?_0x4b5021['attributes']:_0xe235b5[_0xc163('0x43')];if(!_0x4bf29e[_0xc163('0x44')]['hasOwnProperty'](_0xc163('0x69'))){_0x4b5021[_0xc163('0x31')]=qs['limit'](_0x4bf29e['query'][_0xc163('0x31')]);_0x4b5021[_0xc163('0x2f')]=qs[_0xc163('0x2f')](_0x4bf29e[_0xc163('0x44')][_0xc163('0x2f')]);}_0x4b5021['order']=qs[_0xc163('0x4c')](_0x4bf29e[_0xc163('0x44')]['sort']);_0x4b5021['where']=qs['filters'](_[_0xc163('0x4e')](_0x4bf29e[_0xc163('0x44')],_0xe235b5['filters']));_0x4b5021[_0xc163('0x4d')]['OpenchannelAccountId']=_0x36470c['id'];if(_0x4bf29e[_0xc163('0x44')][_0xc163('0x4f')]){_0x4b5021[_0xc163('0x4d')]=_[_0xc163('0x50')](_0x4b5021[_0xc163('0x4d')],{'$or':_[_0xc163('0x40')](_0x4b5021[_0xc163('0x4a')],function(_0x3e6817){var _0x1ed843={};_0x1ed843[_0x3e6817]={'$like':'%'+_0x4bf29e[_0xc163('0x44')][_0xc163('0x4f')]+'%'};return _0x1ed843;})});}_0x4b5021=_[_0xc163('0x50')]({},_0x4b5021,_0x4bf29e[_0xc163('0x53')]);return db[_0xc163('0x6d')][_0xc163('0x32')]({'where':_0x4b5021[_0xc163('0x4d')]})['then'](function(_0x191117){_0x24d8bb[_0xc163('0x32')]=_0x191117;if(_0x4bf29e[_0xc163('0x44')][_0xc163('0x54')]){_0x4b5021[_0xc163('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc163('0x6a')](_0x4b5021);})[_0xc163('0x39')](function(_0xb107c3){_0x24d8bb[_0xc163('0x56')]=_0xb107c3;return _0x24d8bb;});}})[_0xc163('0x39')](respondWithFilteredResult(_0x202a22,_0x4b5021))['catch'](handleError(_0x202a22,null));};exports[_0xc163('0x6f')]=function(_0x19bcd3,_0x1de9ac,_0x41321d){return db[_0xc163('0x41')]['find']({'where':{'id':_0x19bcd3[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x1de9ac,null))[_0xc163('0x39')](function(_0xb536d4){if(_0xb536d4){return _0xb536d4['removeAnswers'](_0x19bcd3[_0xc163('0x44')][_0xc163('0x6b')]);}})[_0xc163('0x39')](respondWithStatusCode(_0x1de9ac,null))['catch'](handleError(_0x1de9ac,null));};exports[_0xc163('0x70')]=function(_0x4f25c4,_0x32382d,_0x20b3ea){var _0x6320bd={'body':_0x4f25c4['body'],'channel':_0xc163('0x71')};var _0x505593=[];var _0xabe587=[];var _0x8f2169={};var _0x9b65d9=![];return db[_0xc163('0x72')][_0xc163('0x63')]()['then'](function(_0x168f2c){if(!_0x168f2c){throw new db[(_0xc163('0x73'))]['ValidationError'](_0xc163('0x74'));}_0x505593=_['difference'](_[_0xc163('0x45')](_0x168f2c),[_0xc163('0x75'),_0xc163('0x76')]);_0xabe587=_[_0xc163('0x77')](_[_0xc163('0x45')](_0x168f2c),[_0xc163('0x75'),_0xc163('0x76'),'CompanyId',_0xc163('0x78')]);if(_0x4f25c4['body']['id']){delete _0x4f25c4[_0xc163('0x5d')]['id'];}if(_[_0xc163('0x79')](_0x4f25c4[_0xc163('0x5d')][_0xc163('0x7a')])){throw new db[(_0xc163('0x73'))]['ValidationError'](_0xc163('0x7b'));}if(_[_0xc163('0x79')](_0x4f25c4[_0xc163('0x5d')][_0xc163('0x5d')])||_0x4f25c4[_0xc163('0x5d')][_0xc163('0x5d')]===''){throw new db[(_0xc163('0x73'))][(_0xc163('0x7c'))](_0xc163('0x7d'));}if(_[_0xc163('0x79')](_0x4f25c4['body'][_0xc163('0x7e')])){throw new db[(_0xc163('0x73'))][(_0xc163('0x7c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xabe587);}if(!_[_0xc163('0x7f')](_0xabe587,_0x4f25c4[_0xc163('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0xc163('0x7c'))](_0xc163('0x80')+_0xabe587);}_0x8f2169[_0x4f25c4[_0xc163('0x5d')]['mapKey']]=_0x4f25c4[_0xc163('0x5d')][_0xc163('0x7a')];})[_0xc163('0x39')](function(){return db['OpenchannelAccount'][_0xc163('0x5b')]({'where':{'id':_0x4f25c4[_0xc163('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xc163('0x81'),'include':[{'model':db[_0xc163('0x72')],'as':_0xc163('0x82'),'where':_0x8f2169,'limit':0x1,'order':[[_0xc163('0x76'),'DESC']]}]},{'model':db[_0xc163('0x83')],'as':_0xc163('0x84')}]});})[_0xc163('0x39')](handleEntityNotFound(_0x32382d,null))['then'](function(_0x466247){if(_0x466247&&_0x466247[_0xc163('0x81')]){_0x6320bd[_0xc163('0x85')]=_0x466247;_0x6320bd['applications']=_0x466247[_0xc163('0x84')];_0x6320bd[_0xc163('0x86')]=_0x466247['List'];_0x6320bd[_0xc163('0x87')]=_[_0xc163('0x88')](_0x6320bd['applications'],[_0xc163('0x89')],[_0xc163('0x8a')]);if(_0x6320bd[_0xc163('0x85')][_0xc163('0x84')]){delete _0x6320bd['account'][_0xc163('0x84')];}if(_0x6320bd['account'][_0xc163('0x81')]&&_0x6320bd[_0xc163('0x85')][_0xc163('0x81')][_0xc163('0x82')][_0xc163('0x49')]){return _0x6320bd[_0xc163('0x85')]['List'][_0xc163('0x82')][0x0];}var _0x9a215f=_[_0xc163('0x8b')](_0x4f25c4['body'],{'firstName':_0x4f25c4[_0xc163('0x5d')][_0xc163('0x7a')],'ListId':_0x466247['ListId']});_0x9a215f[_0x4f25c4[_0xc163('0x5d')][_0xc163('0x7e')]]=_0x4f25c4[_0xc163('0x5d')][_0xc163('0x7a')];return db[_0xc163('0x72')][_0xc163('0x5c')](_0x9a215f,{'fields':_0x505593,'raw':!![]});}})[_0xc163('0x39')](handleEntityNotFound(_0x32382d,null))[_0xc163('0x39')](function(_0x1722e0){_0x6320bd['contact']=_0x1722e0;if(_0x1722e0){var _0x2233d0={'ContactId':_0x1722e0['id'],'OpenchannelAccountId':_0x4f25c4['params']['id'],'from':(_0x1722e0[_0xc163('0x8c')]||'')+'\x20'+(_0x1722e0[_0xc163('0x8d')]||'')};var _0x52cee0={'OpenchannelAccountId':_0x4f25c4[_0xc163('0x58')]['id'],'closed':![]};if(_0x4f25c4[_0xc163('0x5d')][_0xc163('0x8e')]){_0x52cee0[_0xc163('0x8e')]=_0x4f25c4[_0xc163('0x5d')][_0xc163('0x8e')];return db[_0xc163('0x8f')][_0xc163('0x5b')]({'where':_0x52cee0})[_0xc163('0x39')](function(_0x526d70){if(_0x526d70){return[_0x526d70,![]];}_0x2233d0[_0xc163('0x8e')]=_0x4f25c4[_0xc163('0x5d')][_0xc163('0x8e')];_0x2233d0['externalUrl']=_0x4f25c4[_0xc163('0x5d')][_0xc163('0x90')];return db[_0xc163('0x8f')]['create'](_0x2233d0)[_0xc163('0x39')](function(_0x336813){return[_0x336813,!![]];});});}else{_0x52cee0[_0xc163('0x8e')]=null;}_0x52cee0['ContactId']=_0x1722e0['id'];return db['OpenchannelInteraction'][_0xc163('0x5b')]({'where':_0x52cee0})[_0xc163('0x39')](function(_0x17e1c5){if(_0x17e1c5){return[_0x17e1c5,![]];}return db[_0xc163('0x8f')][_0xc163('0x5c')](_0x2233d0)[_0xc163('0x39')](function(_0x428b75){return[_0x428b75,!![]];});});}})[_0xc163('0x91')](function(_0xef106,_0x46c53d){if(_0xef106){_0x9b65d9=_0x46c53d;if(!_0x46c53d){var _0x3a6027={'from':(_0x6320bd[_0xc163('0x92')][_0xc163('0x8c')]||'')+'\x20'+(_0x6320bd[_0xc163('0x92')]['lastName']||'')};if(_0x4f25c4['body'][_0xc163('0x8e')]&&_0x4f25c4[_0xc163('0x5d')][_0xc163('0x93')]&&_0x4f25c4['body'][_0xc163('0x8e')]!=_0x4f25c4['body'][_0xc163('0x93')]){_0x3a6027[_0xc163('0x8e')]=_0x4f25c4['body'][_0xc163('0x93')];}return _0xef106[_0xc163('0x38')](_0x3a6027);}else{return _0xef106;}}})[_0xc163('0x39')](function(_0x82d9c2){_0x6320bd[_0xc163('0x94')]=_0x82d9c2['get']({'plain':!![]});_0x6320bd[_0xc163('0x94')][_0xc163('0x95')]=_0x9b65d9;if(_0x6320bd[_0xc163('0x94')][_0xc163('0x95')]){if(_0x6320bd[_0xc163('0x85')][_0xc163('0x96')]){_0x6320bd['applications'][_0xc163('0x97')]({'id':0x0,'priority':_0x6320bd[_0xc163('0x87')][_0xc163('0x49')]+0x1,'app':_0xc163('0x98'),'appdata':_0xc163('0x99'),'interval':'*,*,*,*'});}}return db[_0xc163('0x9a')][_0xc163('0x5c')]({'body':_0x4f25c4[_0xc163('0x5d')][_0xc163('0x5d')],'OpenchannelAccountId':_0x4f25c4['params']['id'],'OpenchannelInteractionId':_0x82d9c2['id'],'direction':'in','ContactId':_0x6320bd[_0xc163('0x92')]['id'],'AttachmentId':_0x4f25c4[_0xc163('0x5d')][_0xc163('0x9b')]});})[_0xc163('0x39')](function(_0x44a8b6){_0x6320bd[_0xc163('0x2b')]=_0x44a8b6;if(_0x6320bd[_0xc163('0x94')][_0xc163('0x9c')]){return db[_0xc163('0x9d')][_0xc163('0x5b')]({'attributes':['id','name'],'where':{'id':_0x6320bd['interaction'][_0xc163('0x9c')]}})[_0xc163('0x39')](function(_0x2b0d49){if(_0x2b0d49){_0x6320bd['applications'][_0xc163('0x9e')]({'id':0x0,'priority':0x0,'app':_0xc163('0x9f'),'appdata':_0x2b0d49[_0xc163('0x3d')]+','+(_0x6320bd[_0xc163('0x85')][_0xc163('0xa0')]||0xa),'interval':_0xc163('0xa1')});_0x6320bd[_0xc163('0xa2')]=![];}return respondWithRpcPromise(_0xc163('0xa3'),_0xc163('0xa4'),_0x6320bd);});}return respondWithRpcPromise(_0xc163('0xa3'),'startRouting',_0x6320bd);})[_0xc163('0x39')](function(_0x5b52a1){respondWithRpcPromise('EventManager',_0xc163('0xa5'),{'event':_0xc163('0x70'),'message':_0x5b52a1},client9002);return _0x5b52a1;})['then'](respondWithResult(_0x32382d,null))[_0xc163('0x57')](handleError(_0x32382d,null));};exports[_0xc163('0xa6')]=function(_0x7de435,_0x463c9a){var _0x2fdede=_0x7de435[_0xc163('0x58')]['id'];var _0x5c4de2=_0x7de435[_0xc163('0x5d')];var _0x33e2df=0xc8;var _0x383a07=null;return db[_0xc163('0xa7')]['transaction']({'isolationLevel':db[_0xc163('0xa7')][_0xc163('0xa8')][_0xc163('0xa9')][_0xc163('0xaa')]},function(_0x26bff6){return db[_0xc163('0x41')][_0xc163('0x67')]({'where':{'id':_0x2fdede},'transaction':_0x26bff6})['then'](function(_0xf9ad9b){if(_0xf9ad9b){return db['OpenchannelApplication'][_0xc163('0x3c')]({'where':{'OpenchannelAccountId':_0x2fdede},'transaction':_0x26bff6})[_0xc163('0x39')](function(){var _0x427fd1=_[_0xc163('0x40')](_0x5c4de2,function(_0x3c4b29){_0x3c4b29['OpenchannelAccountId']=_0x2fdede;return _0x3c4b29;});return db['OpenchannelApplication'][_0xc163('0xab')](_0x427fd1,{'transaction':_0x26bff6});});}else{_0x33e2df=0x194;_0x383a07=[];}});})['then'](function(){if(_0x33e2df!==0x194){return db['OpenchannelApplication'][_0xc163('0xac')]({'where':{'OpenchannelAccountId':_0x2fdede},'order':_0xc163('0x89')})[_0xc163('0x39')](function(_0x27b099){_0x383a07=_0x27b099;});}})[_0xc163('0x57')](function(_0x2cc016){_0x33e2df=0x1f4;logger[_0xc163('0x29')](_0x2cc016['stack']);if(_0x2cc016[_0xc163('0x3d')]){delete _0x2cc016[_0xc163('0x3d')];}_0x383a07=_0x2cc016;})['finally'](function(){if(_0x383a07===null){_0x463c9a[_0xc163('0xad')](_0x33e2df);}else{if(_0x33e2df===0x1f4){_0x463c9a[_0xc163('0x33')](_0x33e2df)[_0xc163('0xae')](_0x383a07);}else{_0x463c9a['status'](_0x33e2df)[_0xc163('0x2e')](_0x383a07);}}});};exports[_0xc163('0xaf')]=function(_0x15e721,_0x4631a1,_0x2cb904){var _0x3ff364={};var _0x3fbaee={};var _0xff66d6;var _0x11e973;return db[_0xc163('0x41')]['findOne']({'where':{'id':_0x15e721[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x4631a1,null))[_0xc163('0x39')](function(_0x5677b1){if(_0x5677b1){_0xff66d6=_0x5677b1;_0x3fbaee[_0xc163('0x43')]=_[_0xc163('0x45')](db['OpenchannelApplication']['rawAttributes']);_0x3fbaee[_0xc163('0x44')]=_['keys'](_0x15e721[_0xc163('0x44')]);_0x3fbaee[_0xc163('0x46')]=_['intersection'](_0x3fbaee['model'],_0x3fbaee[_0xc163('0x44')]);_0x3ff364[_0xc163('0x4a')]=_[_0xc163('0x47')](_0x3fbaee['model'],qs[_0xc163('0x48')](_0x15e721[_0xc163('0x44')][_0xc163('0x48')]));_0x3ff364[_0xc163('0x4a')]=_0x3ff364[_0xc163('0x4a')][_0xc163('0x49')]?_0x3ff364[_0xc163('0x4a')]:_0x3fbaee['model'];_0x3ff364['order']=qs[_0xc163('0x4c')](_0x15e721[_0xc163('0x44')][_0xc163('0x4c')]);_0x3ff364[_0xc163('0x4d')]=qs[_0xc163('0x46')](_[_0xc163('0x4e')](_0x15e721[_0xc163('0x44')],_0x3fbaee[_0xc163('0x46')]));if(_0x15e721[_0xc163('0x44')]['filter']){_0x3ff364['where']=_[_0xc163('0x50')](_0x3ff364['where'],{'$or':_[_0xc163('0x40')](_0x3ff364['attributes'],function(_0x5209dd){var _0xb7b46e={};_0xb7b46e[_0x5209dd]={'$like':'%'+_0x15e721[_0xc163('0x44')][_0xc163('0x4f')]+'%'};return _0xb7b46e;})});}_0x3ff364=_[_0xc163('0x50')]({},_0x3ff364,_0x15e721[_0xc163('0x53')]);return _0xff66d6[_0xc163('0xaf')](_0x3ff364);}})[_0xc163('0x39')](function(_0x4b9c90){if(_0x4b9c90){_0x11e973=_0x4b9c90['length'];if(!_0x15e721[_0xc163('0x44')][_0xc163('0x68')]('nolimit')){_0x3ff364['limit']=qs[_0xc163('0x31')](_0x15e721[_0xc163('0x44')][_0xc163('0x31')]);_0x3ff364[_0xc163('0x2f')]=qs['offset'](_0x15e721[_0xc163('0x44')][_0xc163('0x2f')]);}return _0xff66d6['getApplications'](_0x3ff364);}})[_0xc163('0x39')](function(_0x4abd72){if(_0x4abd72){return _0x4abd72?{'count':_0x11e973,'rows':_0x4abd72}:null;}})[_0xc163('0x39')](respondWithResult(_0x4631a1,null))[_0xc163('0x57')](handleError(_0x4631a1,null));};exports['getInteractions']=function(_0x105d46,_0x3cd8a6,_0x2544fa){var _0x1957cc={'raw':![],'where':{}};var _0x4fe614={};var _0x2dfddd={'count':0x0,'rows':[]};return db[_0xc163('0x41')][_0xc163('0x67')]({'where':{'id':_0x105d46['params']['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x3cd8a6,null))[_0xc163('0x39')](function(_0x8c2302){if(_0x8c2302){_0x4fe614[_0xc163('0x43')]=_['keys'](db[_0xc163('0x8f')][_0xc163('0x5a')]);_0x4fe614[_0xc163('0x44')]=_[_0xc163('0x45')](_0x105d46[_0xc163('0x44')]);_0x4fe614['filters']=_[_0xc163('0x47')](_0x4fe614['model'],_0x4fe614[_0xc163('0x44')]);_0x1957cc[_0xc163('0x4a')]=_['intersection'](_0x4fe614[_0xc163('0x43')],qs[_0xc163('0x48')](_0x105d46[_0xc163('0x44')][_0xc163('0x48')]));_0x1957cc[_0xc163('0x4a')]=_0x1957cc[_0xc163('0x4a')]['length']?_0x1957cc[_0xc163('0x4a')]:_0x4fe614[_0xc163('0x43')];if(!_0x105d46[_0xc163('0x44')]['hasOwnProperty'](_0xc163('0x69'))){_0x1957cc[_0xc163('0x31')]=qs['limit'](_0x105d46['query'][_0xc163('0x31')]);_0x1957cc[_0xc163('0x2f')]=qs[_0xc163('0x2f')](_0x105d46[_0xc163('0x44')]['offset']);}_0x1957cc['order']=qs[_0xc163('0x4c')](_0x105d46[_0xc163('0x44')][_0xc163('0x4c')]);_0x1957cc[_0xc163('0x4d')]=qs[_0xc163('0x46')](_[_0xc163('0x4e')](_0x105d46[_0xc163('0x44')],_0x4fe614[_0xc163('0x46')]));_0x1957cc[_0xc163('0x4d')][_0xc163('0x64')]=_0x8c2302['id'];if(_0x105d46[_0xc163('0x44')][_0xc163('0x4f')]){_0x1957cc[_0xc163('0x4d')]=_['merge'](_0x1957cc['where'],{'$or':_[_0xc163('0x40')](_0x1957cc[_0xc163('0x4a')],function(_0x44ed1a){var _0x3ccec8={};_0x3ccec8[_0x44ed1a]={'$like':'%'+_0x105d46[_0xc163('0x44')][_0xc163('0x4f')]+'%'};return _0x3ccec8;})});}_0x1957cc=_[_0xc163('0x50')]({},_0x1957cc,_0x105d46[_0xc163('0x53')]);return db[_0xc163('0x8f')]['count']({'where':_0x1957cc[_0xc163('0x4d')]})[_0xc163('0x39')](function(_0x519426){_0x2dfddd[_0xc163('0x32')]=_0x519426;if(_0x105d46['query'][_0xc163('0x54')]){_0x1957cc[_0xc163('0x55')]=[{'model':db[_0xc163('0x72')],'as':'Contact','required':![]},{'model':db[_0xc163('0x9d')],'as':'Owner','attributes':[_0xc163('0x3d'),'fullname',_0xc163('0xb0')],'required':![]},{'model':db['Tag'],'as':_0xc163('0xb1'),'attributes':['id','name',_0xc163('0xb2')],'where':_0x105d46[_0xc163('0x44')][_0xc163('0xb3')]?{'id':_0x105d46[_0xc163('0x44')][_0xc163('0xb3')]}:undefined,'required':_0x105d46['query'][_0xc163('0xb3')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xc163('0x6a')](_0x1957cc);})[_0xc163('0x39')](function(_0x282ffd){_0x2dfddd['rows']=_0x282ffd;return _0x2dfddd;});}})[_0xc163('0x39')](respondWithFilteredResult(_0x3cd8a6,_0x1957cc))['catch'](handleError(_0x3cd8a6,null));};exports['addAgents']=function(_0x1cff10,_0x864d1f,_0xeb845f){return db[_0xc163('0x41')][_0xc163('0x5b')]({'where':{'id':_0x1cff10['params']['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x864d1f,null))[_0xc163('0x39')](function(_0x350cc8){if(_0x350cc8){return _0x350cc8[_0xc163('0xb4')](_0x1cff10[_0xc163('0x5d')]['ids'],_[_0xc163('0xb5')](_0x1cff10['body'],[_0xc163('0x6b'),'id'])||{})['spread'](function(_0x550ddd){for(var _0x110d77=0x0;_0x110d77<_0x1cff10[_0xc163('0x5d')][_0xc163('0x6b')][_0xc163('0x49')];_0x110d77+=0x1){socket[_0xc163('0xb6')](_0xc163('0xb7'),{'UserId':Number(_0x1cff10[_0xc163('0x5d')][_0xc163('0x6b')][_0x110d77]),'OpenchannelAccountId':Number(_0x1cff10['params']['id'])});}return _0x550ddd;});}})['then'](respondWithResult(_0x864d1f,null))[_0xc163('0x57')](handleError(_0x864d1f,null));};exports[_0xc163('0xb8')]=function(_0x16055d,_0x508dda,_0x2fbb69){return db[_0xc163('0x41')][_0xc163('0x5b')]({'where':{'id':_0x16055d[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x508dda,null))['then'](function(_0x58f5ce){if(_0x58f5ce){return _0x58f5ce[_0xc163('0xb8')](_0x16055d[_0xc163('0x44')]['ids'])['then'](function(){if(_[_0xc163('0xb9')](_0x16055d[_0xc163('0x44')]['ids'])){for(var _0x11706c=0x0;_0x11706c<_0x16055d['query']['ids'][_0xc163('0x49')];_0x11706c+=0x1){socket[_0xc163('0xb6')](_0xc163('0xba'),{'UserId':Number(_0x16055d['query'][_0xc163('0x6b')][_0x11706c]),'OpenchannelAccountId':Number(_0x16055d[_0xc163('0x58')]['id'])});}}else{socket[_0xc163('0xb6')](_0xc163('0xba'),{'UserId':Number(_0x16055d[_0xc163('0x44')][_0xc163('0x6b')]),'OpenchannelAccountId':Number(_0x16055d['params']['id'])});}});}})[_0xc163('0x39')](respondWithStatusCode(_0x508dda,null))['catch'](handleError(_0x508dda,null));};exports[_0xc163('0xbb')]=function(_0x5e77d3,_0x4a8fae,_0x31cab9){var _0x1de9a2={};var _0x1dfcca={};var _0x4299c1;var _0x47d22a;return db[_0xc163('0x41')][_0xc163('0x67')]({'where':{'id':_0x5e77d3[_0xc163('0x58')]['id']}})[_0xc163('0x39')](handleEntityNotFound(_0x4a8fae,null))['then'](function(_0x392422){if(_0x392422){_0x4299c1=_0x392422;_0x1dfcca[_0xc163('0x43')]=_[_0xc163('0x45')](db[_0xc163('0x9d')][_0xc163('0x5a')]);_0x1dfcca[_0xc163('0x44')]=_[_0xc163('0x45')](_0x5e77d3[_0xc163('0x44')]);_0x1dfcca[_0xc163('0x46')]=_[_0xc163('0x47')](_0x1dfcca[_0xc163('0x43')],_0x1dfcca[_0xc163('0x44')]);_0x1de9a2[_0xc163('0x4a')]=_['intersection'](_0x1dfcca['model'],qs[_0xc163('0x48')](_0x5e77d3['query'][_0xc163('0x48')]));_0x1de9a2[_0xc163('0x4a')]=_0x1de9a2['attributes'][_0xc163('0x49')]?_0x1de9a2[_0xc163('0x4a')]:_0x1dfcca['model'];_0x1de9a2[_0xc163('0x4b')]=qs[_0xc163('0x4c')](_0x5e77d3['query'][_0xc163('0x4c')]);_0x1de9a2[_0xc163('0x4d')]=qs[_0xc163('0x46')](_[_0xc163('0x4e')](_0x5e77d3[_0xc163('0x44')],_0x1dfcca[_0xc163('0x46')]));if(_0x5e77d3[_0xc163('0x44')][_0xc163('0x4f')]){_0x1de9a2['where']=_[_0xc163('0x50')](_0x1de9a2['where'],{'$or':_['map'](_0x1de9a2['attributes'],function(_0x4ec1f4){var _0x2094b2={};_0x2094b2[_0x4ec1f4]={'$like':'%'+_0x5e77d3['query'][_0xc163('0x4f')]+'%'};return _0x2094b2;})});}_0x1de9a2=_[_0xc163('0x50')]({},_0x1de9a2,_0x5e77d3[_0xc163('0x53')]);return _0x4299c1['getAgents'](_0x1de9a2);}})[_0xc163('0x39')](function(_0x416477){if(_0x416477){_0x47d22a=_0x416477[_0xc163('0x49')];if(!_0x5e77d3[_0xc163('0x44')][_0xc163('0x68')](_0xc163('0x69'))){_0x1de9a2[_0xc163('0x31')]=qs[_0xc163('0x31')](_0x5e77d3[_0xc163('0x44')][_0xc163('0x31')]);_0x1de9a2['offset']=qs['offset'](_0x5e77d3[_0xc163('0x44')][_0xc163('0x2f')]);}return _0x4299c1[_0xc163('0xbb')](_0x1de9a2);}})[_0xc163('0x39')](function(_0x3fd904){if(_0x3fd904){return _0x3fd904?{'count':_0x47d22a,'rows':_0x3fd904}:null;}})[_0xc163('0x39')](respondWithResult(_0x4a8fae,null))[_0xc163('0x57')](handleError(_0x4a8fae,null));};exports[_0xc163('0xae')]=function(_0x1c0161,_0x154bc4,_0x42d618){var _0x78df40,_0x3c7a34,_0x125780;if(_[_0xc163('0x79')](_0x1c0161[_0xc163('0x5d')][_0xc163('0x5d')])||_0x1c0161[_0xc163('0x5d')][_0xc163('0x5d')]===''){throw new db[(_0xc163('0x73'))][(_0xc163('0x7c'))](_0xc163('0x7d'));}if(_[_0xc163('0x79')](_0x1c0161[_0xc163('0x5d')]['to'])){}_0x78df40=_0x1c0161[_0xc163('0x5d')]['to'];return db['OpenchannelAccount'][_0xc163('0x67')]({'where':{'id':_0x1c0161[_0xc163('0x58')]['id']}})['then'](handleEntityNotFound(_0x154bc4,null))['then'](function(_0x392bcd){if(_0x392bcd){return db[_0xc163('0x41')][_0xc163('0x5b')]({'where':{'id':_0x392bcd['id']},'include':[{'model':db[_0xc163('0xbc')],'as':_0xc163('0x81'),'include':[{'model':db[_0xc163('0x72')],'as':_0xc163('0x82'),'where':{[_0x392bcd[_0xc163('0x7e')]]:_0x78df40},'limit':0x1,'order':[[_0xc163('0x76'),_0xc163('0xbd')]]}]}]})[_0xc163('0x39')](handleEntityNotFound(_0x154bc4,null))['then'](function(_0x215a0e){if(_0x215a0e&&_0x215a0e['List']){_0x3c7a34=_0x215a0e[_0xc163('0x3a')]({'plain':!![]});if(_0x3c7a34[_0xc163('0x81')]&&_0x3c7a34[_0xc163('0x81')][_0xc163('0x82')][_0xc163('0x49')]){return _0x3c7a34[_0xc163('0x81')][_0xc163('0x82')][0x0];}return db[_0xc163('0x72')][_0xc163('0x5c')](_[_0xc163('0x8b')](_0x1c0161[_0xc163('0x5d')],{'firstName':_0x78df40,[_0x215a0e[_0xc163('0x7e')]]:_0x78df40,'phone':_0x78df40,'ListId':_0x3c7a34[_0xc163('0x78')]}));}})[_0xc163('0x39')](handleEntityNotFound(_0x154bc4,null))[_0xc163('0x39')](function(_0x43a511){if(_0x43a511){_0x125780=_0x43a511;return db[_0xc163('0x8f')][_0xc163('0x5b')]({'where':{'ContactId':_0x125780['id'],'closed':![],'OpenchannelAccountId':_0x3c7a34['id']}})[_0xc163('0x39')](function(_0x532b06){if(_0x532b06){return[_0x532b06,![]];}return db['OpenchannelInteraction'][_0xc163('0x5c')]({'UserId':_0x1c0161[_0xc163('0x5e')]['id'],'ContactId':_0x125780['id'],'OpenchannelAccountId':_0x3c7a34['id'],'lastMsgDirection':_0xc163('0xbe'),'Messages':[_['merge'](_0x1c0161[_0xc163('0x5d')],{'read':![],'body':_0x1c0161['body'][_0xc163('0x5d')],'OpenchannelAccountId':_0x3c7a34['id'],'UserId':_0x1c0161[_0xc163('0x5e')]['id'],'ContactId':_0x125780['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xc163('0x39')](function(_0x4383a5){return[_0x4383a5,!![]];});});}})[_0xc163('0x91')](function(_0x27cb28,_0x544285){if(_0x544285){return _0x27cb28;}return db[_0xc163('0x9a')][_0xc163('0x5c')](_[_0xc163('0x50')](_0x1c0161['body'],{'read':![],'body':_0x1c0161['body'][_0xc163('0x5d')],'OpenchannelAccountId':_0x3c7a34['id'],'OpenchannelInteractionId':_0x27cb28['id'],'UserId':_0x1c0161[_0xc163('0x5e')]['id'],'ContactId':_0x125780['id']}))[_0xc163('0x39')](function(_0x3eff44){_0x27cb28[_0xc163('0xbf')][_0xc163('0xc0')]=[];_0x27cb28[_0xc163('0xbf')][_0xc163('0xc0')][_0xc163('0x97')](_0x3eff44['dataValues']);return _0x27cb28;});});}})[_0xc163('0x39')](respondWithResult(_0x154bc4,null))[_0xc163('0x57')](handleError(_0x154bc4,null));}; \ No newline at end of file +var _0xeef7=['VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getDispositions','findOne','Disposition','order','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','asc','account','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','ListId','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','offset','undefined','limit','status','json','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','merge'];(function(_0x155574,_0x4e0b0b){var _0x56b559=function(_0x1a4b1d){while(--_0x1a4b1d){_0x155574['push'](_0x155574['shift']());}};_0x56b559(++_0x4e0b0b);}(_0xeef7,0x1ed));var _0x7eef=function(_0x1c6f10,_0x5eed05){_0x1c6f10=_0x1c6f10-0x0;var _0x5a9683=_0xeef7[_0x1c6f10];return _0x5a9683;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7eef('0x0'));var zipdir=require(_0x7eef('0x1'));var jsonpatch=require(_0x7eef('0x2'));var rp=require(_0x7eef('0x3'));var moment=require(_0x7eef('0x4'));var BPromise=require(_0x7eef('0x5'));var Mustache=require(_0x7eef('0x6'));var util=require(_0x7eef('0x7'));var path=require('path');var sox=require(_0x7eef('0x8'));var csv=require(_0x7eef('0x9'));var ejs=require(_0x7eef('0xa'));var fs=require('fs');var fs_extra=require(_0x7eef('0xb'));var _=require(_0x7eef('0xc'));var squel=require(_0x7eef('0xd'));var crypto=require(_0x7eef('0xe'));var jsforce=require(_0x7eef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7eef('0x9'));var querystring=require(_0x7eef('0x10'));var Papa=require(_0x7eef('0x11'));var Redis=require(_0x7eef('0x12'));var authService=require(_0x7eef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7eef('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eef('0x15'))(_0x7eef('0x16'));var utils=require(_0x7eef('0x17'));var config=require(_0x7eef('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7eef('0x19'))['db'];config[_0x7eef('0x1a')]=_[_0x7eef('0x1b')](config[_0x7eef('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7eef('0x1c'))(new Redis(config[_0x7eef('0x1a')]));require(_0x7eef('0x1d'))[_0x7eef('0x1e')](socket);var jayson=require(_0x7eef('0x1f'));var client=jayson[_0x7eef('0x20')][_0x7eef('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2333,_0x11dcd7,_0x16fa91,_0x20115f){return new BPromise(function(_0x1e887e,_0x24fab2){var _0x3e232e=_0x20115f||client;return _0x3e232e[_0x7eef('0x22')](_0x1a2333,_0x16fa91)[_0x7eef('0x23')](function(_0x52a202){logger[_0x7eef('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x11dcd7,_0x7eef('0x25'));logger[_0x7eef('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11dcd7,_0x7eef('0x25'),JSON['stringify'](_0x52a202));if(_0x52a202['error']){if(_0x52a202[_0x7eef('0x27')][_0x7eef('0x28')]===0x1f4){logger['error'](_0x7eef('0x29'),_0x11dcd7,_0x52a202[_0x7eef('0x27')]['message']);return _0x24fab2(_0x52a202[_0x7eef('0x27')][_0x7eef('0x2a')]);}logger[_0x7eef('0x27')](_0x7eef('0x29'),_0x11dcd7,_0x52a202[_0x7eef('0x27')][_0x7eef('0x2a')]);return _0x1e887e(_0x52a202[_0x7eef('0x27')][_0x7eef('0x2a')]);}else{logger['info'](_0x7eef('0x29'),_0x11dcd7,_0x7eef('0x25'));_0x1e887e(_0x52a202['result']['message']);}})[_0x7eef('0x2b')](function(_0x45555c){logger[_0x7eef('0x27')](_0x7eef('0x29'),_0x11dcd7,_0x45555c);_0x24fab2(_0x45555c);});});}function respondWithStatusCode(_0x3c3ccb,_0xc61803){_0xc61803=_0xc61803||0xcc;return function(_0x396f96){if(_0x396f96){return _0x3c3ccb[_0x7eef('0x2c')](_0xc61803);}return _0x3c3ccb['status'](_0xc61803)['end']();};}function respondWithResult(_0x1e5588,_0x58bf58){_0x58bf58=_0x58bf58||0xc8;return function(_0x1c9864){if(_0x1c9864){return _0x1e5588['status'](_0x58bf58)['json'](_0x1c9864);}};}function respondWithFilteredResult(_0x4b9985,_0x2a6c13){return function(_0x3b7b84){if(_0x3b7b84){var _0x5dbf5f=typeof _0x2a6c13[_0x7eef('0x2d')]==='undefined'&&typeof _0x2a6c13['limit']===_0x7eef('0x2e');var _0x5db96c=_0x3b7b84['count'];var _0x4bf7f4=_0x5dbf5f?0x0:_0x2a6c13['offset'];var _0x1af3e8=_0x5dbf5f?_0x3b7b84['count']:_0x2a6c13['offset']+_0x2a6c13[_0x7eef('0x2f')];var _0x4ef47e;if(_0x1af3e8>=_0x5db96c){_0x1af3e8=_0x5db96c;_0x4ef47e=0xc8;}else{_0x4ef47e=0xce;}_0x4b9985[_0x7eef('0x30')](_0x4ef47e);return _0x4b9985['set']('Content-Range',_0x4bf7f4+'-'+_0x1af3e8+'/'+_0x5db96c)[_0x7eef('0x31')](_0x3b7b84);}return null;};}function patchUpdates(_0xd190c){return function(_0x2368a6){try{jsonpatch[_0x7eef('0x32')](_0x2368a6,_0xd190c,!![]);}catch(_0x4af286){return BPromise['reject'](_0x4af286);}return _0x2368a6[_0x7eef('0x33')]();};}function saveUpdates(_0x4bedeb,_0x373aa0){return function(_0x2a3650){if(_0x2a3650){return _0x2a3650[_0x7eef('0x34')](_0x4bedeb)[_0x7eef('0x23')](function(_0x4a81db){return _0x4a81db;});}return null;};}function removeEntity(_0x2f54a0,_0x5b152e){return function(_0x5d7fbc){if(_0x5d7fbc){return _0x5d7fbc[_0x7eef('0x35')]()[_0x7eef('0x23')](function(){var _0x18f8e5=_0x5d7fbc[_0x7eef('0x36')]({'plain':!![]});var _0xfcc391=_0x7eef('0x37');return db[_0x7eef('0x38')]['destroy']({'where':{'type':_0xfcc391,'resourceId':_0x18f8e5['id']}})['then'](function(){return _0x5d7fbc;});})['then'](function(){_0x2f54a0[_0x7eef('0x30')](0xcc)[_0x7eef('0x39')]();});}};}function handleEntityNotFound(_0xecb65b,_0x4ee39b){return function(_0x57b555){if(!_0x57b555){_0xecb65b['sendStatus'](0x194);}return _0x57b555;};}function handleError(_0x1c79ba,_0x325c19){_0x325c19=_0x325c19||0x1f4;return function(_0x3d1a57){logger[_0x7eef('0x27')](_0x3d1a57[_0x7eef('0x3a')]);if(_0x3d1a57['name']){delete _0x3d1a57[_0x7eef('0x3b')];}_0x1c79ba[_0x7eef('0x30')](_0x325c19)[_0x7eef('0x3c')](_0x3d1a57);};}exports[_0x7eef('0x3d')]=function(_0x49a3be,_0xc3c4af){var _0x58848c={'include':[{'model':db['Pause'],'as':_0x7eef('0x3e')}]},_0x2abdc3={},_0x59a5d4={'count':0x0,'rows':[]};var _0x245b90=_[_0x7eef('0x3f')](db[_0x7eef('0x40')][_0x7eef('0x41')],function(_0x10a4ce){return{'name':_0x10a4ce['fieldName'],'type':_0x10a4ce[_0x7eef('0x42')][_0x7eef('0x43')]};});_0x2abdc3['model']=_[_0x7eef('0x3f')](_0x245b90,_0x7eef('0x3b'));_0x2abdc3[_0x7eef('0x44')]=_[_0x7eef('0x45')](_0x49a3be[_0x7eef('0x44')]);_0x2abdc3[_0x7eef('0x46')]=_[_0x7eef('0x47')](_0x2abdc3[_0x7eef('0x48')],_0x2abdc3['query']);_0x58848c['attributes']=_[_0x7eef('0x47')](_0x2abdc3[_0x7eef('0x48')],qs['fields'](_0x49a3be['query']['fields']));_0x58848c[_0x7eef('0x49')]=_0x58848c[_0x7eef('0x49')][_0x7eef('0x4a')]?_0x58848c[_0x7eef('0x49')]:_0x2abdc3['model'];if(!_0x49a3be[_0x7eef('0x44')][_0x7eef('0x4b')](_0x7eef('0x4c'))){_0x58848c['limit']=qs[_0x7eef('0x2f')](_0x49a3be[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x58848c[_0x7eef('0x2d')]=qs['offset'](_0x49a3be[_0x7eef('0x44')][_0x7eef('0x2d')]);}_0x58848c['order']=qs[_0x7eef('0x4d')](_0x49a3be['query']['sort']);_0x58848c[_0x7eef('0x4e')]=qs[_0x7eef('0x46')](_['pick'](_0x49a3be['query'],_0x2abdc3['filters']),_0x245b90);if(_0x49a3be[_0x7eef('0x44')]['filter']){_0x58848c[_0x7eef('0x4e')]=_[_0x7eef('0x4f')](_0x58848c[_0x7eef('0x4e')],{'$or':_[_0x7eef('0x3f')](_0x245b90,function(_0x36b0bb){if(_0x36b0bb[_0x7eef('0x42')]!==_0x7eef('0x50')){var _0x595895={};_0x595895[_0x36b0bb[_0x7eef('0x3b')]]={'$like':'%'+_0x49a3be[_0x7eef('0x44')][_0x7eef('0x51')]+'%'};return _0x595895;}})});}_0x58848c=_[_0x7eef('0x4f')]({},_0x58848c,_0x49a3be[_0x7eef('0x52')]);var _0x5a32ea={'where':_0x58848c[_0x7eef('0x4e')]};return db[_0x7eef('0x40')][_0x7eef('0x53')](_0x5a32ea)[_0x7eef('0x23')](function(_0x22ef58){_0x59a5d4['count']=_0x22ef58;if(_0x49a3be[_0x7eef('0x44')][_0x7eef('0x54')]){_0x58848c[_0x7eef('0x55')]=[{'all':!![]}];}return db[_0x7eef('0x40')][_0x7eef('0x56')](_0x58848c);})[_0x7eef('0x23')](function(_0x2e7725){_0x59a5d4[_0x7eef('0x57')]=_0x2e7725;return _0x59a5d4;})[_0x7eef('0x23')](respondWithFilteredResult(_0xc3c4af,_0x58848c))[_0x7eef('0x2b')](handleError(_0xc3c4af,null));};exports[_0x7eef('0x58')]=function(_0x13b3d9,_0x861c88){var _0x447cc6={'raw':![],'where':{'id':_0x13b3d9[_0x7eef('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x7eef('0x3e')}]},_0x109138={};_0x109138[_0x7eef('0x48')]=_[_0x7eef('0x45')](db['OpenchannelAccount'][_0x7eef('0x41')]);_0x109138['query']=_[_0x7eef('0x45')](_0x13b3d9[_0x7eef('0x44')]);_0x109138[_0x7eef('0x46')]=_['intersection'](_0x109138[_0x7eef('0x48')],_0x109138[_0x7eef('0x44')]);_0x447cc6[_0x7eef('0x49')]=_[_0x7eef('0x47')](_0x109138['model'],qs[_0x7eef('0x5a')](_0x13b3d9[_0x7eef('0x44')]['fields']));_0x447cc6[_0x7eef('0x49')]=_0x447cc6['attributes'][_0x7eef('0x4a')]?_0x447cc6[_0x7eef('0x49')]:_0x109138[_0x7eef('0x48')];if(_0x13b3d9[_0x7eef('0x44')][_0x7eef('0x54')]){_0x447cc6[_0x7eef('0x55')]=[{'all':!![]}];}_0x447cc6=_[_0x7eef('0x4f')]({},_0x447cc6,_0x13b3d9['options']);return db[_0x7eef('0x40')][_0x7eef('0x5b')](_0x447cc6)[_0x7eef('0x23')](handleEntityNotFound(_0x861c88,null))[_0x7eef('0x23')](respondWithResult(_0x861c88,null))[_0x7eef('0x2b')](handleError(_0x861c88,null));};exports[_0x7eef('0x5c')]=function(_0x3f465b,_0x496952){return db[_0x7eef('0x40')][_0x7eef('0x5c')](_0x3f465b['body'],{})['then'](function(_0x974d7a){var _0x2604a2=_0x3f465b[_0x7eef('0x5d')][_0x7eef('0x36')]({'plain':!![]});if(!_0x2604a2)throw new Error(_0x7eef('0x5e'));if(_0x2604a2['role']===_0x7eef('0x5d')){var _0x14129a=_0x974d7a['get']({'plain':!![]});var _0x4ceb53=_0x7eef('0x37');return db[_0x7eef('0x5f')][_0x7eef('0x5b')]({'where':{'name':_0x4ceb53,'userProfileId':_0x2604a2['userProfileId']},'raw':!![]})[_0x7eef('0x23')](function(_0xc203bf){if(_0xc203bf&&_0xc203bf['autoAssociation']===0x0){return db[_0x7eef('0x38')][_0x7eef('0x5c')]({'name':_0x14129a['name'],'resourceId':_0x14129a['id'],'type':_0xc203bf[_0x7eef('0x3b')],'sectionId':_0xc203bf['id']},{})[_0x7eef('0x23')](function(){return _0x974d7a;});}else{return _0x974d7a;}})[_0x7eef('0x2b')](function(_0x3a3a9d){logger[_0x7eef('0x27')](_0x7eef('0x60'),_0x3a3a9d);throw _0x3a3a9d;});}return _0x974d7a;})[_0x7eef('0x23')](respondWithResult(_0x496952,0xc9))[_0x7eef('0x2b')](handleError(_0x496952,null));};exports[_0x7eef('0x34')]=function(_0x1bd00e,_0x91fd8f){if(_0x1bd00e[_0x7eef('0x61')]['id']){delete _0x1bd00e[_0x7eef('0x61')]['id'];}return db[_0x7eef('0x40')][_0x7eef('0x5b')]({'where':{'id':_0x1bd00e['params']['id']},'include':[{'model':db['Pause'],'as':_0x7eef('0x3e')}]})[_0x7eef('0x23')](handleEntityNotFound(_0x91fd8f,null))[_0x7eef('0x23')](saveUpdates(_0x1bd00e[_0x7eef('0x61')],null))[_0x7eef('0x23')](respondWithResult(_0x91fd8f,null))[_0x7eef('0x2b')](handleError(_0x91fd8f,null));};exports[_0x7eef('0x35')]=function(_0xf19554,_0x5904fb){return db[_0x7eef('0x40')][_0x7eef('0x5b')]({'where':{'id':_0xf19554[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x5904fb,null))[_0x7eef('0x23')](removeEntity(_0x5904fb,null))['catch'](handleError(_0x5904fb,null));};exports['describe']=function(_0x164fc5,_0x1cac7c){return db[_0x7eef('0x40')]['describe']()[_0x7eef('0x23')](respondWithResult(_0x1cac7c,null))[_0x7eef('0x2b')](handleError(_0x1cac7c,null));};exports['addDisposition']=function(_0x40123e,_0x2e8f7a,_0x42d1b2){if(_0x40123e[_0x7eef('0x61')]['id']){delete _0x40123e['body']['id'];}return db[_0x7eef('0x40')]['find']({'where':{'id':_0x40123e[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x2e8f7a,null))['then'](function(_0x9491f7){if(_0x9491f7){_0x40123e[_0x7eef('0x61')]['OpenchannelAccountId']=_0x9491f7['id'];return db['Disposition'][_0x7eef('0x5c')](_0x40123e['body']);}})['then'](respondWithResult(_0x2e8f7a,null))[_0x7eef('0x2b')](handleError(_0x2e8f7a,null));};exports[_0x7eef('0x62')]=function(_0x4e85c5,_0x29b313,_0x1a26dd){var _0x2f1d78={'raw':![],'where':{}};var _0x428d16={};var _0xb40661={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7eef('0x63')]({'where':{'id':_0x4e85c5[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x29b313,null))[_0x7eef('0x23')](function(_0x2b8df5){if(_0x2b8df5){_0x428d16['model']=_[_0x7eef('0x45')](db[_0x7eef('0x64')]['rawAttributes']);_0x428d16['query']=_['keys'](_0x4e85c5['query']);_0x428d16['filters']=_[_0x7eef('0x47')](_0x428d16[_0x7eef('0x48')],_0x428d16['query']);_0x2f1d78['attributes']=_[_0x7eef('0x47')](_0x428d16[_0x7eef('0x48')],qs[_0x7eef('0x5a')](_0x4e85c5[_0x7eef('0x44')]['fields']));_0x2f1d78[_0x7eef('0x49')]=_0x2f1d78[_0x7eef('0x49')]['length']?_0x2f1d78[_0x7eef('0x49')]:_0x428d16['model'];if(!_0x4e85c5[_0x7eef('0x44')]['hasOwnProperty'](_0x7eef('0x4c'))){_0x2f1d78['limit']=qs['limit'](_0x4e85c5[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x2f1d78[_0x7eef('0x2d')]=qs[_0x7eef('0x2d')](_0x4e85c5[_0x7eef('0x44')][_0x7eef('0x2d')]);}_0x2f1d78[_0x7eef('0x65')]=qs[_0x7eef('0x4d')](_0x4e85c5['query']['sort']);_0x2f1d78[_0x7eef('0x4e')]=qs['filters'](_[_0x7eef('0x66')](_0x4e85c5['query'],_0x428d16['filters']));_0x2f1d78[_0x7eef('0x4e')][_0x7eef('0x67')]=_0x2b8df5['id'];if(_0x4e85c5[_0x7eef('0x44')][_0x7eef('0x51')]){_0x2f1d78[_0x7eef('0x4e')]=_[_0x7eef('0x4f')](_0x2f1d78['where'],{'$or':_[_0x7eef('0x3f')](_0x2f1d78['attributes'],function(_0x19910a){var _0x37fd18={};_0x37fd18[_0x19910a]={'$like':'%'+_0x4e85c5[_0x7eef('0x44')]['filter']+'%'};return _0x37fd18;})});}_0x2f1d78=_['merge']({},_0x2f1d78,_0x4e85c5['options']);return db[_0x7eef('0x64')][_0x7eef('0x53')]({'where':_0x2f1d78[_0x7eef('0x4e')]})[_0x7eef('0x23')](function(_0x517fd1){_0xb40661[_0x7eef('0x53')]=_0x517fd1;if(_0x4e85c5[_0x7eef('0x44')][_0x7eef('0x54')]){_0x2f1d78[_0x7eef('0x55')]=[{'all':!![]}];}return db[_0x7eef('0x64')][_0x7eef('0x56')](_0x2f1d78);})[_0x7eef('0x23')](function(_0x4f31ec){_0xb40661[_0x7eef('0x57')]=_0x4f31ec;return _0xb40661;});}})[_0x7eef('0x23')](respondWithFilteredResult(_0x29b313,_0x2f1d78))[_0x7eef('0x2b')](handleError(_0x29b313,null));};exports[_0x7eef('0x68')]=function(_0x3d1f25,_0x139f58,_0x17579b){return db[_0x7eef('0x40')][_0x7eef('0x5b')]({'where':{'id':_0x3d1f25[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x139f58,null))[_0x7eef('0x23')](function(_0x40225d){if(_0x40225d){return _0x40225d[_0x7eef('0x68')](_0x3d1f25[_0x7eef('0x44')][_0x7eef('0x69')]);}})[_0x7eef('0x23')](respondWithStatusCode(_0x139f58,null))[_0x7eef('0x2b')](handleError(_0x139f58,null));};exports[_0x7eef('0x6a')]=function(_0x138894,_0xb4e157,_0x21ecee){if(_0x138894[_0x7eef('0x61')]['id']){delete _0x138894[_0x7eef('0x61')]['id'];}return db['OpenchannelAccount'][_0x7eef('0x5b')]({'where':{'id':_0x138894[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0xb4e157,null))[_0x7eef('0x23')](function(_0x358a5e){if(_0x358a5e){_0x138894[_0x7eef('0x61')][_0x7eef('0x67')]=_0x358a5e['id'];return db[_0x7eef('0x6b')][_0x7eef('0x5c')](_0x138894['body']);}})[_0x7eef('0x23')](respondWithResult(_0xb4e157,null))[_0x7eef('0x2b')](handleError(_0xb4e157,null));};exports[_0x7eef('0x6c')]=function(_0x1e3a58,_0x596f84,_0x169699){var _0x33c6b8={'raw':![],'where':{}};var _0x586d3d={};var _0x4093be={'count':0x0,'rows':[]};return db[_0x7eef('0x40')][_0x7eef('0x63')]({'where':{'id':_0x1e3a58[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x596f84,null))[_0x7eef('0x23')](function(_0x570990){if(_0x570990){_0x586d3d['model']=_['keys'](db[_0x7eef('0x6b')][_0x7eef('0x41')]);_0x586d3d[_0x7eef('0x44')]=_[_0x7eef('0x45')](_0x1e3a58[_0x7eef('0x44')]);_0x586d3d[_0x7eef('0x46')]=_[_0x7eef('0x47')](_0x586d3d[_0x7eef('0x48')],_0x586d3d[_0x7eef('0x44')]);_0x33c6b8['attributes']=_[_0x7eef('0x47')](_0x586d3d[_0x7eef('0x48')],qs[_0x7eef('0x5a')](_0x1e3a58[_0x7eef('0x44')]['fields']));_0x33c6b8[_0x7eef('0x49')]=_0x33c6b8[_0x7eef('0x49')][_0x7eef('0x4a')]?_0x33c6b8[_0x7eef('0x49')]:_0x586d3d[_0x7eef('0x48')];if(!_0x1e3a58[_0x7eef('0x44')][_0x7eef('0x4b')]('nolimit')){_0x33c6b8[_0x7eef('0x2f')]=qs[_0x7eef('0x2f')](_0x1e3a58[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x33c6b8[_0x7eef('0x2d')]=qs['offset'](_0x1e3a58[_0x7eef('0x44')][_0x7eef('0x2d')]);}_0x33c6b8[_0x7eef('0x65')]=qs[_0x7eef('0x4d')](_0x1e3a58[_0x7eef('0x44')]['sort']);_0x33c6b8[_0x7eef('0x4e')]=qs[_0x7eef('0x46')](_[_0x7eef('0x66')](_0x1e3a58['query'],_0x586d3d['filters']));_0x33c6b8[_0x7eef('0x4e')]['OpenchannelAccountId']=_0x570990['id'];if(_0x1e3a58[_0x7eef('0x44')]['filter']){_0x33c6b8['where']=_['merge'](_0x33c6b8[_0x7eef('0x4e')],{'$or':_[_0x7eef('0x3f')](_0x33c6b8[_0x7eef('0x49')],function(_0x2f40e3){var _0x36c8bc={};_0x36c8bc[_0x2f40e3]={'$like':'%'+_0x1e3a58[_0x7eef('0x44')][_0x7eef('0x51')]+'%'};return _0x36c8bc;})});}_0x33c6b8=_[_0x7eef('0x4f')]({},_0x33c6b8,_0x1e3a58[_0x7eef('0x52')]);return db[_0x7eef('0x6b')]['count']({'where':_0x33c6b8['where']})[_0x7eef('0x23')](function(_0x54a3da){_0x4093be[_0x7eef('0x53')]=_0x54a3da;if(_0x1e3a58[_0x7eef('0x44')][_0x7eef('0x54')]){_0x33c6b8[_0x7eef('0x55')]=[{'all':!![]}];}return db[_0x7eef('0x6b')]['findAll'](_0x33c6b8);})[_0x7eef('0x23')](function(_0x35aaa6){_0x4093be[_0x7eef('0x57')]=_0x35aaa6;return _0x4093be;});}})[_0x7eef('0x23')](respondWithFilteredResult(_0x596f84,_0x33c6b8))[_0x7eef('0x2b')](handleError(_0x596f84,null));};exports[_0x7eef('0x6d')]=function(_0x5dbefc,_0x40da23,_0x290840){return db['OpenchannelAccount'][_0x7eef('0x5b')]({'where':{'id':_0x5dbefc['params']['id']}})['then'](handleEntityNotFound(_0x40da23,null))[_0x7eef('0x23')](function(_0x55725a){if(_0x55725a){return _0x55725a[_0x7eef('0x6d')](_0x5dbefc[_0x7eef('0x44')][_0x7eef('0x69')]);}})['then'](respondWithStatusCode(_0x40da23,null))['catch'](handleError(_0x40da23,null));};exports[_0x7eef('0x6e')]=function(_0x439a1f,_0x196f8a,_0x3f4066){var _0x50cf02={'body':_0x439a1f[_0x7eef('0x61')],'channel':_0x7eef('0x6f')};var _0x592f96=[];var _0x40de14=[];var _0x55607a={};var _0x5da82b=![];return db[_0x7eef('0x70')]['describe']()[_0x7eef('0x23')](function(_0x3997b5){if(!_0x3997b5){throw new db[(_0x7eef('0x71'))][(_0x7eef('0x72'))](_0x7eef('0x73'));}_0x592f96=_[_0x7eef('0x74')](_[_0x7eef('0x45')](_0x3997b5),['createdAt',_0x7eef('0x75')]);_0x40de14=_['difference'](_[_0x7eef('0x45')](_0x3997b5),[_0x7eef('0x76'),_0x7eef('0x75'),_0x7eef('0x77'),'ListId']);if(_0x439a1f[_0x7eef('0x61')]['id']){delete _0x439a1f[_0x7eef('0x61')]['id'];}if(_[_0x7eef('0x78')](_0x439a1f[_0x7eef('0x61')]['from'])){throw new db[(_0x7eef('0x71'))][(_0x7eef('0x72'))](_0x7eef('0x79'));}if(_[_0x7eef('0x78')](_0x439a1f[_0x7eef('0x61')][_0x7eef('0x61')])||_0x439a1f['body'][_0x7eef('0x61')]===''){throw new db[(_0x7eef('0x71'))][(_0x7eef('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x439a1f['body']['mapKey'])){throw new db[(_0x7eef('0x71'))]['ValidationError'](_0x7eef('0x7a')+_0x40de14);}if(!_[_0x7eef('0x7b')](_0x40de14,_0x439a1f[_0x7eef('0x61')][_0x7eef('0x7c')])){throw new db[(_0x7eef('0x71'))][(_0x7eef('0x72'))](_0x7eef('0x7d')+_0x40de14);}_0x55607a[_0x439a1f[_0x7eef('0x61')][_0x7eef('0x7c')]]=_0x439a1f['body'][_0x7eef('0x7e')];})[_0x7eef('0x23')](function(){return db[_0x7eef('0x40')]['find']({'where':{'id':_0x439a1f[_0x7eef('0x59')]['id']},'include':[{'model':db[_0x7eef('0x7f')],'as':'List','include':[{'model':db[_0x7eef('0x70')],'as':_0x7eef('0x80'),'where':_0x55607a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x7eef('0x81')],'as':_0x7eef('0x82')}]});})['then'](handleEntityNotFound(_0x196f8a,null))[_0x7eef('0x23')](function(_0x5b9a27){if(_0x5b9a27&&_0x5b9a27[_0x7eef('0x83')]){_0x50cf02['account']=_0x5b9a27;_0x50cf02[_0x7eef('0x84')]=_0x5b9a27['Applications'];_0x50cf02[_0x7eef('0x85')]=_0x5b9a27[_0x7eef('0x83')];_0x50cf02[_0x7eef('0x84')]=_[_0x7eef('0x86')](_0x50cf02[_0x7eef('0x84')],[_0x7eef('0x87')],[_0x7eef('0x88')]);if(_0x50cf02[_0x7eef('0x89')][_0x7eef('0x82')]){delete _0x50cf02[_0x7eef('0x89')][_0x7eef('0x82')];}if(_0x50cf02['account'][_0x7eef('0x83')]&&_0x50cf02['account']['List'][_0x7eef('0x80')][_0x7eef('0x4a')]){return _0x50cf02[_0x7eef('0x89')]['List'][_0x7eef('0x80')][0x0];}var _0x10a058=_[_0x7eef('0x1b')](_0x439a1f[_0x7eef('0x61')],{'firstName':_0x439a1f[_0x7eef('0x61')][_0x7eef('0x7e')],'ListId':_0x5b9a27['ListId']});_0x10a058[_0x439a1f['body'][_0x7eef('0x7c')]]=_0x439a1f[_0x7eef('0x61')][_0x7eef('0x7e')];return db['CmContact'][_0x7eef('0x5c')](_0x10a058,{'fields':_0x592f96,'raw':!![]});}})[_0x7eef('0x23')](handleEntityNotFound(_0x196f8a,null))[_0x7eef('0x23')](function(_0x3af799){_0x50cf02['contact']=_0x3af799;if(_0x3af799){var _0x3d6741={'ContactId':_0x3af799['id'],'OpenchannelAccountId':_0x439a1f[_0x7eef('0x59')]['id'],'from':(_0x3af799[_0x7eef('0x8a')]||'')+'\x20'+(_0x3af799['lastName']||'')};var _0x15eed0={'OpenchannelAccountId':_0x439a1f[_0x7eef('0x59')]['id'],'closed':![]};if(_0x439a1f[_0x7eef('0x61')]['threadId']){_0x15eed0['threadId']=_0x439a1f['body'][_0x7eef('0x8b')];return db[_0x7eef('0x8c')][_0x7eef('0x5b')]({'where':_0x15eed0})[_0x7eef('0x23')](function(_0x3420f2){if(_0x3420f2){return[_0x3420f2,![]];}_0x3d6741[_0x7eef('0x8b')]=_0x439a1f[_0x7eef('0x61')]['threadId'];_0x3d6741[_0x7eef('0x8d')]=_0x439a1f['body']['externalUrl'];return db['OpenchannelInteraction'][_0x7eef('0x5c')](_0x3d6741)['then'](function(_0x12da71){return[_0x12da71,!![]];});});}else{_0x15eed0['threadId']=null;}_0x15eed0[_0x7eef('0x8e')]=_0x3af799['id'];return db['OpenchannelInteraction'][_0x7eef('0x5b')]({'where':_0x15eed0})['then'](function(_0x483bf1){if(_0x483bf1){return[_0x483bf1,![]];}return db[_0x7eef('0x8c')][_0x7eef('0x5c')](_0x3d6741)[_0x7eef('0x23')](function(_0x172e05){return[_0x172e05,!![]];});});}})[_0x7eef('0x8f')](function(_0x1c6a93,_0x358c5d){if(_0x1c6a93){_0x5da82b=_0x358c5d;if(!_0x358c5d){var _0x2eca09={'from':(_0x50cf02[_0x7eef('0x90')][_0x7eef('0x8a')]||'')+'\x20'+(_0x50cf02[_0x7eef('0x90')][_0x7eef('0x91')]||'')};if(_0x439a1f[_0x7eef('0x61')][_0x7eef('0x8b')]&&_0x439a1f[_0x7eef('0x61')]['messageId']&&_0x439a1f[_0x7eef('0x61')]['threadId']!=_0x439a1f[_0x7eef('0x61')][_0x7eef('0x92')]){_0x2eca09['threadId']=_0x439a1f[_0x7eef('0x61')]['messageId'];}return _0x1c6a93[_0x7eef('0x34')](_0x2eca09);}else{return _0x1c6a93;}}})[_0x7eef('0x23')](function(_0x63b84e){_0x50cf02[_0x7eef('0x93')]=_0x63b84e[_0x7eef('0x36')]({'plain':!![]});_0x50cf02[_0x7eef('0x93')][_0x7eef('0x94')]=_0x5da82b;if(_0x50cf02[_0x7eef('0x93')][_0x7eef('0x94')]){if(_0x50cf02[_0x7eef('0x89')][_0x7eef('0x95')]){_0x50cf02['applications']['push']({'id':0x0,'priority':_0x50cf02[_0x7eef('0x84')][_0x7eef('0x4a')]+0x1,'app':_0x7eef('0x96'),'appdata':_0x7eef('0x97'),'interval':_0x7eef('0x98')});}}return db[_0x7eef('0x99')][_0x7eef('0x5c')]({'body':_0x439a1f[_0x7eef('0x61')][_0x7eef('0x61')],'OpenchannelAccountId':_0x439a1f[_0x7eef('0x59')]['id'],'OpenchannelInteractionId':_0x63b84e['id'],'direction':'in','ContactId':_0x50cf02[_0x7eef('0x90')]['id'],'AttachmentId':_0x439a1f[_0x7eef('0x61')][_0x7eef('0x9a')]});})[_0x7eef('0x23')](function(_0x565918){_0x50cf02['message']=_0x565918;if(_0x50cf02[_0x7eef('0x93')][_0x7eef('0x9b')]){return db[_0x7eef('0x9c')][_0x7eef('0x5b')]({'attributes':['id','name'],'where':{'id':_0x50cf02[_0x7eef('0x93')]['UserId']}})[_0x7eef('0x23')](function(_0x2c128a){if(_0x2c128a){_0x50cf02[_0x7eef('0x84')][_0x7eef('0x9d')]({'id':0x0,'priority':0x0,'app':_0x7eef('0x9e'),'appdata':_0x2c128a[_0x7eef('0x3b')]+','+(_0x50cf02[_0x7eef('0x89')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x50cf02[_0x7eef('0x9f')]=![];}return respondWithRpcPromise(_0x7eef('0xa0'),_0x7eef('0xa1'),_0x50cf02);});}return respondWithRpcPromise(_0x7eef('0xa0'),_0x7eef('0xa1'),_0x50cf02);})[_0x7eef('0x23')](function(_0x1b1834){respondWithRpcPromise('EventManager',_0x7eef('0xa2'),{'event':'notify','message':_0x1b1834},client9002);return _0x1b1834;})['then'](respondWithResult(_0x196f8a,null))[_0x7eef('0x2b')](handleError(_0x196f8a,null));};exports[_0x7eef('0xa3')]=function(_0x596938,_0x15089b){var _0x4ddcf5=_0x596938[_0x7eef('0x59')]['id'];var _0x70c8f7=_0x596938[_0x7eef('0x61')];var _0x2acb56=0xc8;var _0x3ad685=null;return db['sequelize'][_0x7eef('0xa4')]({'isolationLevel':db[_0x7eef('0xa5')][_0x7eef('0xa6')][_0x7eef('0xa7')][_0x7eef('0xa8')]},function(_0x1ead7c){return db[_0x7eef('0x40')][_0x7eef('0x63')]({'where':{'id':_0x4ddcf5},'transaction':_0x1ead7c})[_0x7eef('0x23')](function(_0x1a9362){if(_0x1a9362){return db[_0x7eef('0x81')][_0x7eef('0x35')]({'where':{'OpenchannelAccountId':_0x4ddcf5},'transaction':_0x1ead7c})[_0x7eef('0x23')](function(){var _0x76f357=_[_0x7eef('0x3f')](_0x70c8f7,function(_0x241dc0){_0x241dc0[_0x7eef('0x67')]=_0x4ddcf5;return _0x241dc0;});return db[_0x7eef('0x81')][_0x7eef('0xa9')](_0x76f357,{'transaction':_0x1ead7c});});}else{_0x2acb56=0x194;_0x3ad685=[];}});})[_0x7eef('0x23')](function(){if(_0x2acb56!==0x194){return db['OpenchannelApplication'][_0x7eef('0xaa')]({'where':{'OpenchannelAccountId':_0x4ddcf5},'order':_0x7eef('0x87')})[_0x7eef('0x23')](function(_0x5713a0){_0x3ad685=_0x5713a0;});}})[_0x7eef('0x2b')](function(_0x4d88c2){_0x2acb56=0x1f4;logger['error'](_0x4d88c2[_0x7eef('0x3a')]);if(_0x4d88c2['name']){delete _0x4d88c2['name'];}_0x3ad685=_0x4d88c2;})[_0x7eef('0xab')](function(){if(_0x3ad685===null){_0x15089b['sendStatus'](_0x2acb56);}else{if(_0x2acb56===0x1f4){_0x15089b[_0x7eef('0x30')](_0x2acb56)[_0x7eef('0x3c')](_0x3ad685);}else{_0x15089b[_0x7eef('0x30')](_0x2acb56)[_0x7eef('0x31')](_0x3ad685);}}});};exports[_0x7eef('0xac')]=function(_0x2bfaa0,_0x4da011,_0x1d8372){var _0x2f1f2a={};var _0x37b9f5={};var _0x13adfe;var _0x367c87;return db['OpenchannelAccount'][_0x7eef('0x63')]({'where':{'id':_0x2bfaa0[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x4da011,null))[_0x7eef('0x23')](function(_0x469e75){if(_0x469e75){_0x13adfe=_0x469e75;_0x37b9f5['model']=_[_0x7eef('0x45')](db['OpenchannelApplication'][_0x7eef('0x41')]);_0x37b9f5[_0x7eef('0x44')]=_[_0x7eef('0x45')](_0x2bfaa0[_0x7eef('0x44')]);_0x37b9f5[_0x7eef('0x46')]=_[_0x7eef('0x47')](_0x37b9f5[_0x7eef('0x48')],_0x37b9f5['query']);_0x2f1f2a['attributes']=_[_0x7eef('0x47')](_0x37b9f5['model'],qs['fields'](_0x2bfaa0['query'][_0x7eef('0x5a')]));_0x2f1f2a[_0x7eef('0x49')]=_0x2f1f2a[_0x7eef('0x49')][_0x7eef('0x4a')]?_0x2f1f2a[_0x7eef('0x49')]:_0x37b9f5[_0x7eef('0x48')];_0x2f1f2a[_0x7eef('0x65')]=qs[_0x7eef('0x4d')](_0x2bfaa0[_0x7eef('0x44')]['sort']);_0x2f1f2a[_0x7eef('0x4e')]=qs[_0x7eef('0x46')](_['pick'](_0x2bfaa0['query'],_0x37b9f5[_0x7eef('0x46')]));if(_0x2bfaa0[_0x7eef('0x44')][_0x7eef('0x51')]){_0x2f1f2a['where']=_['merge'](_0x2f1f2a['where'],{'$or':_[_0x7eef('0x3f')](_0x2f1f2a[_0x7eef('0x49')],function(_0x3972e3){var _0x278b55={};_0x278b55[_0x3972e3]={'$like':'%'+_0x2bfaa0[_0x7eef('0x44')]['filter']+'%'};return _0x278b55;})});}_0x2f1f2a=_[_0x7eef('0x4f')]({},_0x2f1f2a,_0x2bfaa0['options']);return _0x13adfe[_0x7eef('0xac')](_0x2f1f2a);}})[_0x7eef('0x23')](function(_0x36d355){if(_0x36d355){_0x367c87=_0x36d355['length'];if(!_0x2bfaa0[_0x7eef('0x44')][_0x7eef('0x4b')](_0x7eef('0x4c'))){_0x2f1f2a['limit']=qs['limit'](_0x2bfaa0[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x2f1f2a[_0x7eef('0x2d')]=qs[_0x7eef('0x2d')](_0x2bfaa0[_0x7eef('0x44')][_0x7eef('0x2d')]);}return _0x13adfe[_0x7eef('0xac')](_0x2f1f2a);}})[_0x7eef('0x23')](function(_0x207d7e){if(_0x207d7e){return _0x207d7e?{'count':_0x367c87,'rows':_0x207d7e}:null;}})[_0x7eef('0x23')](respondWithResult(_0x4da011,null))[_0x7eef('0x2b')](handleError(_0x4da011,null));};exports[_0x7eef('0xad')]=function(_0x3a89ed,_0x1e4406,_0x325042){var _0x361794={'raw':![],'where':{}};var _0x153382={};var _0x2f3848={'count':0x0,'rows':[]};return db[_0x7eef('0x40')][_0x7eef('0x63')]({'where':{'id':_0x3a89ed[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x1e4406,null))[_0x7eef('0x23')](function(_0x5492bc){if(_0x5492bc){_0x153382['model']=_['keys'](db['OpenchannelInteraction'][_0x7eef('0x41')]);_0x153382[_0x7eef('0x44')]=_[_0x7eef('0x45')](_0x3a89ed[_0x7eef('0x44')]);_0x153382[_0x7eef('0x46')]=_[_0x7eef('0x47')](_0x153382[_0x7eef('0x48')],_0x153382[_0x7eef('0x44')]);_0x361794[_0x7eef('0x49')]=_[_0x7eef('0x47')](_0x153382['model'],qs[_0x7eef('0x5a')](_0x3a89ed[_0x7eef('0x44')][_0x7eef('0x5a')]));_0x361794[_0x7eef('0x49')]=_0x361794['attributes'][_0x7eef('0x4a')]?_0x361794[_0x7eef('0x49')]:_0x153382[_0x7eef('0x48')];if(!_0x3a89ed[_0x7eef('0x44')][_0x7eef('0x4b')](_0x7eef('0x4c'))){_0x361794[_0x7eef('0x2f')]=qs['limit'](_0x3a89ed[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x361794[_0x7eef('0x2d')]=qs['offset'](_0x3a89ed[_0x7eef('0x44')][_0x7eef('0x2d')]);}_0x361794[_0x7eef('0x65')]=qs[_0x7eef('0x4d')](_0x3a89ed['query'][_0x7eef('0x4d')]);_0x361794['where']=qs[_0x7eef('0x46')](_[_0x7eef('0x66')](_0x3a89ed[_0x7eef('0x44')],_0x153382[_0x7eef('0x46')]));_0x361794['where'][_0x7eef('0x67')]=_0x5492bc['id'];if(_0x3a89ed['query'][_0x7eef('0x51')]){_0x361794['where']=_[_0x7eef('0x4f')](_0x361794['where'],{'$or':_[_0x7eef('0x3f')](_0x361794[_0x7eef('0x49')],function(_0x1f4763){var _0x4394ba={};_0x4394ba[_0x1f4763]={'$like':'%'+_0x3a89ed[_0x7eef('0x44')][_0x7eef('0x51')]+'%'};return _0x4394ba;})});}_0x361794=_[_0x7eef('0x4f')]({},_0x361794,_0x3a89ed[_0x7eef('0x52')]);return db['OpenchannelInteraction'][_0x7eef('0x53')]({'where':_0x361794[_0x7eef('0x4e')]})[_0x7eef('0x23')](function(_0x20ce12){_0x2f3848['count']=_0x20ce12;if(_0x3a89ed[_0x7eef('0x44')]['includeAll']){_0x361794[_0x7eef('0x55')]=[{'model':db[_0x7eef('0x70')],'as':_0x7eef('0xae'),'required':![]},{'model':db[_0x7eef('0x9c')],'as':_0x7eef('0xaf'),'attributes':[_0x7eef('0x3b'),_0x7eef('0xb0'),_0x7eef('0xb1')],'required':![]},{'model':db['Tag'],'as':_0x7eef('0xb2'),'attributes':['id',_0x7eef('0x3b'),_0x7eef('0xb3')],'where':_0x3a89ed[_0x7eef('0x44')]['tag']?{'id':_0x3a89ed[_0x7eef('0x44')]['tag']}:undefined,'required':_0x3a89ed[_0x7eef('0x44')]['tag']?!![]:![]}];}return db[_0x7eef('0x8c')][_0x7eef('0x56')](_0x361794);})[_0x7eef('0x23')](function(_0x2eaa23){_0x2f3848[_0x7eef('0x57')]=_0x2eaa23;return _0x2f3848;});}})[_0x7eef('0x23')](respondWithFilteredResult(_0x1e4406,_0x361794))[_0x7eef('0x2b')](handleError(_0x1e4406,null));};exports['addAgents']=function(_0x4876ad,_0x428ca1,_0x110b74){return db[_0x7eef('0x40')]['find']({'where':{'id':_0x4876ad['params']['id']}})['then'](handleEntityNotFound(_0x428ca1,null))[_0x7eef('0x23')](function(_0x3eb978){if(_0x3eb978){return _0x3eb978[_0x7eef('0xb4')](_0x4876ad['body'][_0x7eef('0x69')],_[_0x7eef('0xb5')](_0x4876ad[_0x7eef('0x61')],[_0x7eef('0x69'),'id'])||{})['spread'](function(_0x4a8cfc){for(var _0x28397a=0x0;_0x28397a<_0x4876ad[_0x7eef('0x61')][_0x7eef('0x69')][_0x7eef('0x4a')];_0x28397a+=0x1){socket[_0x7eef('0xb6')]('userOpenchannelAccount:save',{'UserId':Number(_0x4876ad[_0x7eef('0x61')]['ids'][_0x28397a]),'OpenchannelAccountId':Number(_0x4876ad[_0x7eef('0x59')]['id'])});}return _0x4a8cfc;});}})[_0x7eef('0x23')](respondWithResult(_0x428ca1,null))[_0x7eef('0x2b')](handleError(_0x428ca1,null));};exports[_0x7eef('0xb7')]=function(_0xa5020d,_0x1b1a8c,_0x5d91c7){return db[_0x7eef('0x40')][_0x7eef('0x5b')]({'where':{'id':_0xa5020d[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x1b1a8c,null))[_0x7eef('0x23')](function(_0x516eb2){if(_0x516eb2){return _0x516eb2[_0x7eef('0xb7')](_0xa5020d[_0x7eef('0x44')][_0x7eef('0x69')])[_0x7eef('0x23')](function(){if(_['isArray'](_0xa5020d[_0x7eef('0x44')][_0x7eef('0x69')])){for(var _0x56e711=0x0;_0x56e711<_0xa5020d[_0x7eef('0x44')][_0x7eef('0x69')][_0x7eef('0x4a')];_0x56e711+=0x1){socket[_0x7eef('0xb6')](_0x7eef('0xb8'),{'UserId':Number(_0xa5020d[_0x7eef('0x44')][_0x7eef('0x69')][_0x56e711]),'OpenchannelAccountId':Number(_0xa5020d[_0x7eef('0x59')]['id'])});}}else{socket[_0x7eef('0xb6')](_0x7eef('0xb8'),{'UserId':Number(_0xa5020d['query'][_0x7eef('0x69')]),'OpenchannelAccountId':Number(_0xa5020d[_0x7eef('0x59')]['id'])});}});}})[_0x7eef('0x23')](respondWithStatusCode(_0x1b1a8c,null))[_0x7eef('0x2b')](handleError(_0x1b1a8c,null));};exports[_0x7eef('0xb9')]=function(_0xf289b7,_0x339c90,_0x18c126){var _0x5288b0={};var _0x57c949={};var _0x57d4ae;var _0x4d32d4;return db[_0x7eef('0x40')][_0x7eef('0x63')]({'where':{'id':_0xf289b7[_0x7eef('0x59')]['id']}})['then'](handleEntityNotFound(_0x339c90,null))[_0x7eef('0x23')](function(_0x410420){if(_0x410420){_0x57d4ae=_0x410420;_0x57c949['model']=_['keys'](db[_0x7eef('0x9c')][_0x7eef('0x41')]);_0x57c949[_0x7eef('0x44')]=_[_0x7eef('0x45')](_0xf289b7['query']);_0x57c949[_0x7eef('0x46')]=_['intersection'](_0x57c949[_0x7eef('0x48')],_0x57c949[_0x7eef('0x44')]);_0x5288b0['attributes']=_[_0x7eef('0x47')](_0x57c949['model'],qs[_0x7eef('0x5a')](_0xf289b7[_0x7eef('0x44')][_0x7eef('0x5a')]));_0x5288b0[_0x7eef('0x49')]=_0x5288b0[_0x7eef('0x49')][_0x7eef('0x4a')]?_0x5288b0[_0x7eef('0x49')]:_0x57c949[_0x7eef('0x48')];_0x5288b0[_0x7eef('0x65')]=qs[_0x7eef('0x4d')](_0xf289b7[_0x7eef('0x44')][_0x7eef('0x4d')]);_0x5288b0[_0x7eef('0x4e')]=qs[_0x7eef('0x46')](_[_0x7eef('0x66')](_0xf289b7[_0x7eef('0x44')],_0x57c949[_0x7eef('0x46')]));if(_0xf289b7[_0x7eef('0x44')]['filter']){_0x5288b0[_0x7eef('0x4e')]=_['merge'](_0x5288b0[_0x7eef('0x4e')],{'$or':_[_0x7eef('0x3f')](_0x5288b0[_0x7eef('0x49')],function(_0xa43c1f){var _0x2a1ad2={};_0x2a1ad2[_0xa43c1f]={'$like':'%'+_0xf289b7['query'][_0x7eef('0x51')]+'%'};return _0x2a1ad2;})});}_0x5288b0=_[_0x7eef('0x4f')]({},_0x5288b0,_0xf289b7[_0x7eef('0x52')]);return _0x57d4ae[_0x7eef('0xb9')](_0x5288b0);}})[_0x7eef('0x23')](function(_0x4d83aa){if(_0x4d83aa){_0x4d32d4=_0x4d83aa[_0x7eef('0x4a')];if(!_0xf289b7[_0x7eef('0x44')][_0x7eef('0x4b')](_0x7eef('0x4c'))){_0x5288b0[_0x7eef('0x2f')]=qs['limit'](_0xf289b7[_0x7eef('0x44')][_0x7eef('0x2f')]);_0x5288b0[_0x7eef('0x2d')]=qs[_0x7eef('0x2d')](_0xf289b7[_0x7eef('0x44')]['offset']);}return _0x57d4ae[_0x7eef('0xb9')](_0x5288b0);}})[_0x7eef('0x23')](function(_0x6fea4d){if(_0x6fea4d){return _0x6fea4d?{'count':_0x4d32d4,'rows':_0x6fea4d}:null;}})[_0x7eef('0x23')](respondWithResult(_0x339c90,null))['catch'](handleError(_0x339c90,null));};exports[_0x7eef('0x3c')]=function(_0x1b617a,_0x5c63a1,_0x2376e9){var _0x573fcd,_0x45ae68,_0x1a4cd0;if(_[_0x7eef('0x78')](_0x1b617a[_0x7eef('0x61')][_0x7eef('0x61')])||_0x1b617a['body'][_0x7eef('0x61')]===''){throw new db['Sequelize'][(_0x7eef('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7eef('0x78')](_0x1b617a[_0x7eef('0x61')]['to'])){}_0x573fcd=_0x1b617a[_0x7eef('0x61')]['to'];return db['OpenchannelAccount'][_0x7eef('0x63')]({'where':{'id':_0x1b617a[_0x7eef('0x59')]['id']}})[_0x7eef('0x23')](handleEntityNotFound(_0x5c63a1,null))[_0x7eef('0x23')](function(_0x120aa0){if(_0x120aa0){return db[_0x7eef('0x40')][_0x7eef('0x5b')]({'where':{'id':_0x120aa0['id']},'include':[{'model':db[_0x7eef('0x7f')],'as':_0x7eef('0x83'),'include':[{'model':db[_0x7eef('0x70')],'as':_0x7eef('0x80'),'where':{[_0x120aa0[_0x7eef('0x7c')]]:_0x573fcd},'limit':0x1,'order':[[_0x7eef('0x75'),_0x7eef('0xba')]]}]}]})['then'](handleEntityNotFound(_0x5c63a1,null))[_0x7eef('0x23')](function(_0x47bf18){if(_0x47bf18&&_0x47bf18[_0x7eef('0x83')]){_0x45ae68=_0x47bf18[_0x7eef('0x36')]({'plain':!![]});if(_0x45ae68[_0x7eef('0x83')]&&_0x45ae68[_0x7eef('0x83')]['Contacts']['length']){return _0x45ae68[_0x7eef('0x83')][_0x7eef('0x80')][0x0];}return db[_0x7eef('0x70')][_0x7eef('0x5c')](_[_0x7eef('0x1b')](_0x1b617a[_0x7eef('0x61')],{'firstName':_0x573fcd,[_0x47bf18[_0x7eef('0x7c')]]:_0x573fcd,'phone':_0x573fcd,'ListId':_0x45ae68[_0x7eef('0xbb')]}));}})[_0x7eef('0x23')](handleEntityNotFound(_0x5c63a1,null))[_0x7eef('0x23')](function(_0x138f41){if(_0x138f41){_0x1a4cd0=_0x138f41;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x1a4cd0['id'],'closed':![],'OpenchannelAccountId':_0x45ae68['id']}})['then'](function(_0x5ad747){if(_0x5ad747){return[_0x5ad747,![]];}return db[_0x7eef('0x8c')][_0x7eef('0x5c')]({'UserId':_0x1b617a['user']['id'],'ContactId':_0x1a4cd0['id'],'OpenchannelAccountId':_0x45ae68['id'],'lastMsgDirection':_0x7eef('0xbc'),'Messages':[_[_0x7eef('0x4f')](_0x1b617a[_0x7eef('0x61')],{'read':![],'body':_0x1b617a[_0x7eef('0x61')][_0x7eef('0x61')],'OpenchannelAccountId':_0x45ae68['id'],'UserId':_0x1b617a[_0x7eef('0x5d')]['id'],'ContactId':_0x1a4cd0['id']})]},{'include':[{'model':db[_0x7eef('0x99')],'as':'Messages'}]})[_0x7eef('0x23')](function(_0x58c94d){return[_0x58c94d,!![]];});});}})[_0x7eef('0x8f')](function(_0x41d251,_0x1499e7){if(_0x1499e7){return _0x41d251;}return db[_0x7eef('0x99')][_0x7eef('0x5c')](_[_0x7eef('0x4f')](_0x1b617a[_0x7eef('0x61')],{'read':![],'body':_0x1b617a[_0x7eef('0x61')][_0x7eef('0x61')],'OpenchannelAccountId':_0x45ae68['id'],'OpenchannelInteractionId':_0x41d251['id'],'UserId':_0x1b617a[_0x7eef('0x5d')]['id'],'ContactId':_0x1a4cd0['id']}))[_0x7eef('0x23')](function(_0x44f59a){_0x41d251[_0x7eef('0xbd')][_0x7eef('0xbe')]=[];_0x41d251['dataValues'][_0x7eef('0xbe')]['push'](_0x44f59a[_0x7eef('0xbd')]);return _0x41d251;});});}})[_0x7eef('0x23')](respondWithResult(_0x5c63a1,null))[_0x7eef('0x2b')](handleError(_0x5c63a1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0d6379b..de405ec 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 _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xda55,0x6d));var _0x5da5=function(_0x1b9764,_0x361ac4){_0x1b9764=_0x1b9764-0x0;var _0x4303c3=_0xda55[_0x1b9764];return _0x4303c3;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe5b5=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x17dc95,_0x18e685){var _0x1fd5f3=function(_0x3f58ff){while(--_0x3f58ff){_0x17dc95['push'](_0x17dc95['shift']());}};_0x1fd5f3(++_0x18e685);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe5b5[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x5e5b('0x0'));var OpenchannelAccount=require(_0x5e5b('0x1'))['db'][_0x5e5b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5e5b('0x3')](0x0);var events={'afterCreate':_0x5e5b('0x4'),'afterUpdate':_0x5e5b('0x5'),'afterDestroy':_0x5e5b('0x6')};function emitEvent(_0x3dc763){return function(_0xf20c6a,_0x20a50c,_0xdc6616){OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763+':'+_0xf20c6a['id'],_0xf20c6a);OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763,_0xf20c6a);_0xdc6616(null);};}for(var e in events){if(events[_0x5e5b('0x8')](e)){var event=events[e];OpenchannelAccount[_0x5e5b('0x9')](e,emitEvent(event));}}module[_0x5e5b('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 36b8e5e..1e1f344 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(_0x30ae50,_0x58f4e9){var _0x1938f1=function(_0x3c90fd){while(--_0x3c90fd){_0x30ae50['push'](_0x30ae50['shift']());}};_0x1938f1(++_0x58f4e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x46ed9f,_0x4e4f23){var _0x27d71e=function(_0x429835){while(--_0x429835){_0x46ed9f['push'](_0x46ed9f['shift']());}};_0x27d71e(++_0x4e4f23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 e6e18fc..1955181 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 _0xde2c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x48d968,_0x352369){var _0xd147c9=function(_0x31fad1){while(--_0x31fad1){_0x48d968['push'](_0x48d968['shift']());}};_0xd147c9(++_0x352369);}(_0xde2c,0x7f));var _0xcde2=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xde2c[_0x2c2980];return _0x2a20a9;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});config['redis']=_[_0xcde2('0xd')](config[_0xcde2('0xe')],{'host':_0xcde2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcde2('0x10'))[_0xcde2('0x11')](socket);function respondWithRpcPromise(_0x4e9749,_0x181a73,_0x29f7e0){return new BPromise(function(_0x12a287,_0x127358){return client['request'](_0x4e9749,_0x29f7e0)['then'](function(_0x25677f){logger[_0xcde2('0x12')](_0xcde2('0x13'),_0x181a73,_0xcde2('0x14'));logger[_0xcde2('0x15')](_0xcde2('0x16'),_0x181a73,'request\x20sent',JSON[_0xcde2('0x17')](_0x25677f));if(_0x25677f['error']){if(_0x25677f[_0xcde2('0x18')]['code']===0x1f4){logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);return _0x127358(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f['error'][_0xcde2('0x19')]);return _0x12a287(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}else{logger[_0xcde2('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x181a73,'request\x20sent');_0x12a287(_0x25677f['result'][_0xcde2('0x19')]);}})['catch'](function(_0x285ac7){logger[_0xcde2('0x18')](_0xcde2('0x13'),_0x181a73,_0x285ac7);_0x127358(_0x285ac7);});});} \ No newline at end of file +var _0x55f1=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost'];(function(_0xce57f9,_0xfa44e7){var _0x3d9ef3=function(_0x4eead1){while(--_0x4eead1){_0xce57f9['push'](_0xce57f9['shift']());}};_0x3d9ef3(++_0xfa44e7);}(_0x55f1,0x9b));var _0x155f=function(_0x4fe44d,_0x3c66fc){_0x4fe44d=_0x4fe44d-0x0;var _0x58d9b1=_0x55f1[_0x4fe44d];return _0x58d9b1;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});config[_0x155f('0xa')]=_[_0x155f('0xb')](config[_0x155f('0xa')],{'host':_0x155f('0xc'),'port':0x18eb});var socket=require(_0x155f('0xd'))(new Redis(config[_0x155f('0xa')]));require(_0x155f('0xe'))[_0x155f('0xf')](socket);function respondWithRpcPromise(_0x281c5a,_0x11c946,_0x39d85a){return new BPromise(function(_0x5b9e3b,_0x9fb9a){return client[_0x155f('0x10')](_0x281c5a,_0x39d85a)[_0x155f('0x11')](function(_0x3575d8){logger['info'](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));logger[_0x155f('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11c946,'request\x20sent',JSON[_0x155f('0x15')](_0x3575d8));if(_0x3575d8[_0x155f('0x16')]){if(_0x3575d8[_0x155f('0x16')][_0x155f('0x17')]===0x1f4){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')]['message']);return _0x9fb9a(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}logger['error'](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);return _0x5b9e3b(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}else{logger[_0x155f('0x19')](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));_0x5b9e3b(_0x3575d8[_0x155f('0x1a')][_0x155f('0x18')]);}})[_0x155f('0x1b')](function(_0x3bdede){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3bdede);_0x9fb9a(_0x3bdede);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 35f2190..3240535 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 _0xb07f=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb07f,0x109));var _0xfb07=function(_0x31fb43,_0x5d6efd){_0x31fb43=_0x31fb43-0x0;var _0x5893c6=_0xb07f[_0x31fb43];return _0x5893c6;};'use strict';var OpenchannelAccountEvents=require(_0xfb07('0x0'));var events=[_0xfb07('0x1'),_0xfb07('0x2'),_0xfb07('0x3')];function createListener(_0x2e561d,_0xc9317c){return function(_0x3a262e){_0xc9317c[_0xfb07('0x4')](_0x2e561d,_0x3a262e);};}function removeListener(_0x3b3c05,_0x2fc1ce){return function(){OpenchannelAccountEvents[_0xfb07('0x5')](_0x3b3c05,_0x2fc1ce);};}exports['register']=function(_0x3c79a9){for(var _0x934f98=0x0,_0x14fc69=events[_0xfb07('0x6')];_0x934f98<_0x14fc69;_0x934f98++){var _0x41d73a=events[_0x934f98];var _0x3bb9cf=createListener(_0xfb07('0x7')+_0x41d73a,_0x3c79a9);OpenchannelAccountEvents['on'](_0x41d73a,_0x3bb9cf);}}; \ No newline at end of file +var _0x6e16=['length','openchannelAccount:','remove','emit','register'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x6e16,0x1d3));var _0x66e1=function(_0x9d38b2,_0x30df2c){_0x9d38b2=_0x9d38b2-0x0;var _0x1735c6=_0x6e16[_0x9d38b2];return _0x1735c6;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x66e1('0x0'),'update'];function createListener(_0xac185,_0x4e3854){return function(_0x4f811b){_0x4e3854[_0x66e1('0x1')](_0xac185,_0x4f811b);};}function removeListener(_0x491345,_0x892e60){return function(){OpenchannelAccountEvents['removeListener'](_0x491345,_0x892e60);};}exports[_0x66e1('0x2')]=function(_0x204db8){for(var _0x3f95fa=0x0,_0x5d1175=events[_0x66e1('0x3')];_0x3f95fa<_0x5d1175;_0x3f95fa++){var _0x43b549=events[_0x3f95fa];var _0x257ecd=createListener(_0x66e1('0x4')+_0x43b549,_0x204db8);OpenchannelAccountEvents['on'](_0x43b549,_0x257ecd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7a075f0..ba18f51 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 _0xd27d=['./openchannelApplication.controller','get','index','show','put','/:id','isAuthenticated','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4528ee,_0xcf06bf){var _0x43b2fe=function(_0x49559b){while(--_0x49559b){_0x4528ee['push'](_0x4528ee['shift']());}};_0x43b2fe(++_0xcf06bf);}(_0xd27d,0x6f));var _0xdd27=function(_0x4ec863,_0x85080a){_0x4ec863=_0x4ec863-0x0;var _0x2071fc=_0xd27d[_0x4ec863];return _0x2071fc;};'use strict';var multer=require(_0xdd27('0x0'));var util=require(_0xdd27('0x1'));var path=require('path');var timeout=require(_0xdd27('0x2'));var express=require(_0xdd27('0x3'));var router=express['Router']();var fs_extra=require(_0xdd27('0x4'));var auth=require(_0xdd27('0x5'));var interaction=require(_0xdd27('0x6'));var config=require(_0xdd27('0x7'));var controller=require(_0xdd27('0x8'));router[_0xdd27('0x9')]('/',auth['isAuthenticated'](),controller[_0xdd27('0xa')]);router[_0xdd27('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdd27('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdd27('0xc')](_0xdd27('0xd'),auth[_0xdd27('0xe')](),controller[_0xdd27('0xf')]);router[_0xdd27('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7908=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','delete','/:id','exports'];(function(_0x1d5029,_0x3b90dc){var _0x2d21e1=function(_0x230a1f){while(--_0x230a1f){_0x1d5029['push'](_0x1d5029['shift']());}};_0x2d21e1(++_0x3b90dc);}(_0x7908,0xd8));var _0x8790=function(_0x5905a9,_0x50331c){_0x5905a9=_0x5905a9-0x0;var _0x168ab5=_0x7908[_0x5905a9];return _0x168ab5;};'use strict';var multer=require(_0x8790('0x0'));var util=require('util');var path=require(_0x8790('0x1'));var timeout=require('connect-timeout');var express=require(_0x8790('0x2'));var router=express[_0x8790('0x3')]();var fs_extra=require(_0x8790('0x4'));var auth=require(_0x8790('0x5'));var interaction=require(_0x8790('0x6'));var config=require(_0x8790('0x7'));var controller=require('./openchannelApplication.controller');router[_0x8790('0x8')]('/',auth[_0x8790('0x9')](),controller[_0x8790('0xa')]);router['get']('/:id',auth[_0x8790('0x9')](),controller['show']);router[_0x8790('0xb')]('/',auth[_0x8790('0x9')](),controller[_0x8790('0xc')]);router[_0x8790('0xd')]('/:id',auth[_0x8790('0x9')](),controller[_0x8790('0xe')]);router[_0x8790('0xf')](_0x8790('0x10'),auth[_0x8790('0x9')](),controller['destroy']);module[_0x8790('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 92b3735..e5eb172 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 _0xa42f=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xa42f,0x8e));var _0xfa42=function(_0x35bd35,_0x234893){_0x35bd35=_0x35bd35-0x0;var _0x10aa11=_0xa42f[_0x35bd35];return _0x10aa11;};'use strict';var Sequelize=require(_0xfa42('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfa42('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfa42('0x2')],'allowNull':![],'defaultValue':_0xfa42('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfa42('0x2')]},'interval':{'type':Sequelize[_0xfa42('0x2')],'defaultValue':_0xfa42('0x4')}}; \ No newline at end of file +var _0xf6dc=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x3b3edd,_0x32fd0a){var _0x284f03=function(_0x2e1e7a){while(--_0x2e1e7a){_0x3b3edd['push'](_0x3b3edd['shift']());}};_0x284f03(++_0x32fd0a);}(_0xf6dc,0x1bb));var _0xcf6d=function(_0x12e22b,_0x52f025){_0x12e22b=_0x12e22b-0x0;var _0x2a6eb8=_0xf6dc[_0x12e22b];return _0x2a6eb8;};'use strict';var Sequelize=require(_0xcf6d('0x0'));module[_0xcf6d('0x1')]={'priority':{'type':Sequelize[_0xcf6d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcf6d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcf6d('0x4')]},'interval':{'type':Sequelize[_0xcf6d('0x4')],'defaultValue':_0xcf6d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 33f23eb..a6dfbb2 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 _0x455a=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','query','keys','intersection'];(function(_0x5ebf95,_0x4e8aef){var _0x28693c=function(_0x23bc7e){while(--_0x23bc7e){_0x5ebf95['push'](_0x5ebf95['shift']());}};_0x28693c(++_0x4e8aef);}(_0x455a,0xf6));var _0xa455=function(_0x2245c7,_0x47951d){_0x2245c7=_0x2245c7-0x0;var _0x267daa=_0x455a[_0x2245c7];return _0x267daa;};'use strict';var emlformat=require(_0xa455('0x0'));var rimraf=require(_0xa455('0x1'));var zipdir=require(_0xa455('0x2'));var jsonpatch=require(_0xa455('0x3'));var rp=require(_0xa455('0x4'));var moment=require(_0xa455('0x5'));var BPromise=require(_0xa455('0x6'));var Mustache=require(_0xa455('0x7'));var util=require(_0xa455('0x8'));var path=require(_0xa455('0x9'));var sox=require(_0xa455('0xa'));var csv=require(_0xa455('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa455('0xc'));var squel=require('squel');var crypto=require(_0xa455('0xd'));var jsforce=require(_0xa455('0xe'));var deskjs=require(_0xa455('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa455('0x10'));var Papa=require(_0xa455('0x11'));var Redis=require('ioredis');var authService=require(_0xa455('0x12'));var qs=require(_0xa455('0x13'));var as=require(_0xa455('0x14'));var hardwareService=require(_0xa455('0x15'));var logger=require(_0xa455('0x16'))(_0xa455('0x17'));var utils=require(_0xa455('0x18'));var config=require(_0xa455('0x19'));var licenseUtil=require(_0xa455('0x1a'));var db=require(_0xa455('0x1b'))['db'];function respondWithStatusCode(_0xf7ecaf,_0x2360bd){_0x2360bd=_0x2360bd||0xcc;return function(_0x5b2da5){if(_0x5b2da5){return _0xf7ecaf[_0xa455('0x1c')](_0x2360bd);}return _0xf7ecaf[_0xa455('0x1d')](_0x2360bd)[_0xa455('0x1e')]();};}function respondWithResult(_0x3c8611,_0x3e4ea9){_0x3e4ea9=_0x3e4ea9||0xc8;return function(_0x4aaa53){if(_0x4aaa53){return _0x3c8611['status'](_0x3e4ea9)['json'](_0x4aaa53);}};}function respondWithFilteredResult(_0x16d9d5,_0x3a12fd){return function(_0x3d14c6){if(_0x3d14c6){var _0x5dcb04=typeof _0x3a12fd[_0xa455('0x1f')]==='undefined'&&typeof _0x3a12fd[_0xa455('0x20')]==='undefined';var _0x34967a=_0x3d14c6[_0xa455('0x21')];var _0x53e54a=_0x5dcb04?0x0:_0x3a12fd['offset'];var _0x4b5d48=_0x5dcb04?_0x3d14c6['count']:_0x3a12fd[_0xa455('0x1f')]+_0x3a12fd[_0xa455('0x20')];var _0x2252f7;if(_0x4b5d48>=_0x34967a){_0x4b5d48=_0x34967a;_0x2252f7=0xc8;}else{_0x2252f7=0xce;}_0x16d9d5['status'](_0x2252f7);return _0x16d9d5[_0xa455('0x22')](_0xa455('0x23'),_0x53e54a+'-'+_0x4b5d48+'/'+_0x34967a)['json'](_0x3d14c6);}return null;};}function patchUpdates(_0x1cfa25){return function(_0x3b0d8d){try{jsonpatch[_0xa455('0x24')](_0x3b0d8d,_0x1cfa25,!![]);}catch(_0x3fc359){return BPromise[_0xa455('0x25')](_0x3fc359);}return _0x3b0d8d['save']();};}function saveUpdates(_0x308dd7,_0x5ce08f){return function(_0x12fa80){if(_0x12fa80){return _0x12fa80[_0xa455('0x26')](_0x308dd7)[_0xa455('0x27')](function(_0x56db1e){return _0x56db1e;});}return null;};}function removeEntity(_0x504ddb,_0x59d13d){return function(_0x559f8b){if(_0x559f8b){return _0x559f8b[_0xa455('0x28')]()['then'](function(){_0x504ddb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4704ba,_0x352087){return function(_0x2de353){if(!_0x2de353){_0x4704ba['sendStatus'](0x194);}return _0x2de353;};}function handleError(_0x4a5b35,_0x5053a8){_0x5053a8=_0x5053a8||0x1f4;return function(_0x18fd00){logger[_0xa455('0x29')](_0x18fd00[_0xa455('0x2a')]);if(_0x18fd00[_0xa455('0x2b')]){delete _0x18fd00[_0xa455('0x2b')];}_0x4a5b35[_0xa455('0x1d')](_0x5053a8)[_0xa455('0x2c')](_0x18fd00);};}exports[_0xa455('0x2d')]=function(_0x52f2c8,_0x4166d0){var _0x3f4e9e={},_0x2a4040={},_0x164cca={'count':0x0,'rows':[]};var _0x3eb68f=_[_0xa455('0x2e')](db[_0xa455('0x2f')][_0xa455('0x30')],function(_0x52615f){return{'name':_0x52615f[_0xa455('0x31')],'type':_0x52615f[_0xa455('0x32')]['key']};});_0x2a4040['model']=_['map'](_0x3eb68f,_0xa455('0x2b'));_0x2a4040[_0xa455('0x33')]=_[_0xa455('0x34')](_0x52f2c8[_0xa455('0x33')]);_0x2a4040['filters']=_[_0xa455('0x35')](_0x2a4040[_0xa455('0x36')],_0x2a4040[_0xa455('0x33')]);_0x3f4e9e[_0xa455('0x37')]=_[_0xa455('0x35')](_0x2a4040[_0xa455('0x36')],qs[_0xa455('0x38')](_0x52f2c8[_0xa455('0x33')][_0xa455('0x38')]));_0x3f4e9e[_0xa455('0x37')]=_0x3f4e9e[_0xa455('0x37')]['length']?_0x3f4e9e[_0xa455('0x37')]:_0x2a4040[_0xa455('0x36')];if(!_0x52f2c8['query'][_0xa455('0x39')](_0xa455('0x3a'))){_0x3f4e9e[_0xa455('0x20')]=qs[_0xa455('0x20')](_0x52f2c8[_0xa455('0x33')][_0xa455('0x20')]);_0x3f4e9e[_0xa455('0x1f')]=qs['offset'](_0x52f2c8[_0xa455('0x33')][_0xa455('0x1f')]);}_0x3f4e9e[_0xa455('0x3b')]=qs[_0xa455('0x3c')](_0x52f2c8[_0xa455('0x33')]['sort']);_0x3f4e9e[_0xa455('0x3d')]=qs[_0xa455('0x3e')](_['pick'](_0x52f2c8[_0xa455('0x33')],_0x2a4040[_0xa455('0x3e')]),_0x3eb68f);if(_0x52f2c8[_0xa455('0x33')][_0xa455('0x3f')]){_0x3f4e9e[_0xa455('0x3d')]=_[_0xa455('0x40')](_0x3f4e9e[_0xa455('0x3d')],{'$or':_[_0xa455('0x2e')](_0x3eb68f,function(_0x2d2928){if(_0x2d2928['type']!==_0xa455('0x41')){var _0x2c8baf={};_0x2c8baf[_0x2d2928['name']]={'$like':'%'+_0x52f2c8[_0xa455('0x33')]['filter']+'%'};return _0x2c8baf;}})});}_0x3f4e9e=_[_0xa455('0x40')]({},_0x3f4e9e,_0x52f2c8[_0xa455('0x42')]);var _0x596801={'where':_0x3f4e9e[_0xa455('0x3d')]};return db[_0xa455('0x2f')][_0xa455('0x21')](_0x596801)[_0xa455('0x27')](function(_0x26a58d){_0x164cca['count']=_0x26a58d;if(_0x52f2c8[_0xa455('0x33')][_0xa455('0x43')]){_0x3f4e9e[_0xa455('0x44')]=[{'all':!![]}];}return db[_0xa455('0x2f')][_0xa455('0x45')](_0x3f4e9e);})[_0xa455('0x27')](function(_0x32480b){_0x164cca['rows']=_0x32480b;return _0x164cca;})[_0xa455('0x27')](respondWithFilteredResult(_0x4166d0,_0x3f4e9e))[_0xa455('0x46')](handleError(_0x4166d0,null));};exports[_0xa455('0x47')]=function(_0x5d90ab,_0x10960b){var _0x5f263e={'raw':!![],'where':{'id':_0x5d90ab[_0xa455('0x48')]['id']}},_0x18da34={};_0x18da34[_0xa455('0x36')]=_[_0xa455('0x34')](db[_0xa455('0x2f')][_0xa455('0x30')]);_0x18da34['query']=_[_0xa455('0x34')](_0x5d90ab['query']);_0x18da34[_0xa455('0x3e')]=_[_0xa455('0x35')](_0x18da34['model'],_0x18da34[_0xa455('0x33')]);_0x5f263e[_0xa455('0x37')]=_[_0xa455('0x35')](_0x18da34[_0xa455('0x36')],qs[_0xa455('0x38')](_0x5d90ab[_0xa455('0x33')][_0xa455('0x38')]));_0x5f263e['attributes']=_0x5f263e['attributes']['length']?_0x5f263e['attributes']:_0x18da34[_0xa455('0x36')];if(_0x5d90ab['query'][_0xa455('0x43')]){_0x5f263e['include']=[{'all':!![]}];}_0x5f263e=_['merge']({},_0x5f263e,_0x5d90ab[_0xa455('0x42')]);return db[_0xa455('0x2f')]['find'](_0x5f263e)[_0xa455('0x27')](handleEntityNotFound(_0x10960b,null))[_0xa455('0x27')](respondWithResult(_0x10960b,null))[_0xa455('0x46')](handleError(_0x10960b,null));};exports[_0xa455('0x49')]=function(_0x7ae61,_0x4811d1){return db[_0xa455('0x2f')][_0xa455('0x49')](_0x7ae61[_0xa455('0x4a')],{})[_0xa455('0x27')](respondWithResult(_0x4811d1,0xc9))[_0xa455('0x46')](handleError(_0x4811d1,null));};exports[_0xa455('0x26')]=function(_0x4a5002,_0x2d4012){if(_0x4a5002[_0xa455('0x4a')]['id']){delete _0x4a5002[_0xa455('0x4a')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x4a5002[_0xa455('0x48')]['id']}})[_0xa455('0x27')](handleEntityNotFound(_0x2d4012,null))[_0xa455('0x27')](saveUpdates(_0x4a5002[_0xa455('0x4a')],null))[_0xa455('0x27')](respondWithResult(_0x2d4012,null))['catch'](handleError(_0x2d4012,null));};exports[_0xa455('0x28')]=function(_0x21100b,_0x19b80a){return db[_0xa455('0x2f')]['find']({'where':{'id':_0x21100b[_0xa455('0x48')]['id']}})['then'](handleEntityNotFound(_0x19b80a,null))[_0xa455('0x27')](removeEntity(_0x19b80a,null))[_0xa455('0x46')](handleError(_0x19b80a,null));}; \ No newline at end of file +var _0x3f6b=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','include','rows','catch','show','params','includeAll','options','find','create','body','update','rimraf'];(function(_0x1f5d0e,_0x41e4c0){var _0x3240c3=function(_0x14be82){while(--_0x14be82){_0x1f5d0e['push'](_0x1f5d0e['shift']());}};_0x3240c3(++_0x41e4c0);}(_0x3f6b,0x8f));var _0xb3f6=function(_0x15b443,_0x3c5cfa){_0x15b443=_0x15b443-0x0;var _0x1fe008=_0x3f6b[_0x15b443];return _0x1fe008;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3f6('0x0'));var zipdir=require(_0xb3f6('0x1'));var jsonpatch=require(_0xb3f6('0x2'));var rp=require(_0xb3f6('0x3'));var moment=require(_0xb3f6('0x4'));var BPromise=require(_0xb3f6('0x5'));var Mustache=require(_0xb3f6('0x6'));var util=require(_0xb3f6('0x7'));var path=require(_0xb3f6('0x8'));var sox=require(_0xb3f6('0x9'));var csv=require(_0xb3f6('0xa'));var ejs=require(_0xb3f6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3f6('0xc'));var jsforce=require(_0xb3f6('0xd'));var deskjs=require(_0xb3f6('0xe'));var toCsv=require(_0xb3f6('0xa'));var querystring=require(_0xb3f6('0xf'));var Papa=require(_0xb3f6('0x10'));var Redis=require(_0xb3f6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb3f6('0x12'));var as=require(_0xb3f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb3f6('0x14'));var config=require(_0xb3f6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3f6('0x16'))['db'];function respondWithStatusCode(_0x24bd15,_0x1428bf){_0x1428bf=_0x1428bf||0xcc;return function(_0x1d9071){if(_0x1d9071){return _0x24bd15[_0xb3f6('0x17')](_0x1428bf);}return _0x24bd15[_0xb3f6('0x18')](_0x1428bf)['end']();};}function respondWithResult(_0x45d524,_0x263f1d){_0x263f1d=_0x263f1d||0xc8;return function(_0xcb0b72){if(_0xcb0b72){return _0x45d524[_0xb3f6('0x18')](_0x263f1d)[_0xb3f6('0x19')](_0xcb0b72);}};}function respondWithFilteredResult(_0x5578bb,_0x124162){return function(_0x7d1908){if(_0x7d1908){var _0x4fa7bd=typeof _0x124162[_0xb3f6('0x1a')]===_0xb3f6('0x1b')&&typeof _0x124162[_0xb3f6('0x1c')]===_0xb3f6('0x1b');var _0x4da3ae=_0x7d1908[_0xb3f6('0x1d')];var _0x29384a=_0x4fa7bd?0x0:_0x124162[_0xb3f6('0x1a')];var _0x5f0bd6=_0x4fa7bd?_0x7d1908[_0xb3f6('0x1d')]:_0x124162[_0xb3f6('0x1a')]+_0x124162[_0xb3f6('0x1c')];var _0x7d903d;if(_0x5f0bd6>=_0x4da3ae){_0x5f0bd6=_0x4da3ae;_0x7d903d=0xc8;}else{_0x7d903d=0xce;}_0x5578bb[_0xb3f6('0x18')](_0x7d903d);return _0x5578bb[_0xb3f6('0x1e')](_0xb3f6('0x1f'),_0x29384a+'-'+_0x5f0bd6+'/'+_0x4da3ae)[_0xb3f6('0x19')](_0x7d1908);}return null;};}function patchUpdates(_0x4dbe78){return function(_0xa82f8d){try{jsonpatch[_0xb3f6('0x20')](_0xa82f8d,_0x4dbe78,!![]);}catch(_0x1fca48){return BPromise[_0xb3f6('0x21')](_0x1fca48);}return _0xa82f8d[_0xb3f6('0x22')]();};}function saveUpdates(_0x33989a,_0x1b0e28){return function(_0x2d4c38){if(_0x2d4c38){return _0x2d4c38['update'](_0x33989a)[_0xb3f6('0x23')](function(_0x268666){return _0x268666;});}return null;};}function removeEntity(_0x310b71,_0x4b3280){return function(_0x123412){if(_0x123412){return _0x123412[_0xb3f6('0x24')]()[_0xb3f6('0x23')](function(){_0x310b71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f330d,_0x1866fa){return function(_0x342a90){if(!_0x342a90){_0x9f330d[_0xb3f6('0x17')](0x194);}return _0x342a90;};}function handleError(_0x2a519f,_0x340689){_0x340689=_0x340689||0x1f4;return function(_0x2a3279){logger['error'](_0x2a3279[_0xb3f6('0x25')]);if(_0x2a3279['name']){delete _0x2a3279[_0xb3f6('0x26')];}_0x2a519f[_0xb3f6('0x18')](_0x340689)[_0xb3f6('0x27')](_0x2a3279);};}exports['index']=function(_0x33110a,_0x443dbe){var _0x3cd144={},_0x16f653={},_0x31ba9d={'count':0x0,'rows':[]};var _0xc3bdd=_[_0xb3f6('0x28')](db[_0xb3f6('0x29')][_0xb3f6('0x2a')],function(_0x193f38){return{'name':_0x193f38[_0xb3f6('0x2b')],'type':_0x193f38[_0xb3f6('0x2c')][_0xb3f6('0x2d')]};});_0x16f653[_0xb3f6('0x2e')]=_[_0xb3f6('0x28')](_0xc3bdd,_0xb3f6('0x26'));_0x16f653[_0xb3f6('0x2f')]=_[_0xb3f6('0x30')](_0x33110a[_0xb3f6('0x2f')]);_0x16f653[_0xb3f6('0x31')]=_[_0xb3f6('0x32')](_0x16f653[_0xb3f6('0x2e')],_0x16f653[_0xb3f6('0x2f')]);_0x3cd144[_0xb3f6('0x33')]=_[_0xb3f6('0x32')](_0x16f653['model'],qs['fields'](_0x33110a[_0xb3f6('0x2f')][_0xb3f6('0x34')]));_0x3cd144[_0xb3f6('0x33')]=_0x3cd144[_0xb3f6('0x33')]['length']?_0x3cd144[_0xb3f6('0x33')]:_0x16f653[_0xb3f6('0x2e')];if(!_0x33110a['query'][_0xb3f6('0x35')](_0xb3f6('0x36'))){_0x3cd144[_0xb3f6('0x1c')]=qs['limit'](_0x33110a['query']['limit']);_0x3cd144[_0xb3f6('0x1a')]=qs[_0xb3f6('0x1a')](_0x33110a['query'][_0xb3f6('0x1a')]);}_0x3cd144[_0xb3f6('0x37')]=qs[_0xb3f6('0x38')](_0x33110a[_0xb3f6('0x2f')][_0xb3f6('0x38')]);_0x3cd144['where']=qs[_0xb3f6('0x31')](_['pick'](_0x33110a[_0xb3f6('0x2f')],_0x16f653[_0xb3f6('0x31')]),_0xc3bdd);if(_0x33110a['query'][_0xb3f6('0x39')]){_0x3cd144[_0xb3f6('0x3a')]=_['merge'](_0x3cd144['where'],{'$or':_[_0xb3f6('0x28')](_0xc3bdd,function(_0x270965){if(_0x270965[_0xb3f6('0x2c')]!==_0xb3f6('0x3b')){var _0x1679f0={};_0x1679f0[_0x270965['name']]={'$like':'%'+_0x33110a[_0xb3f6('0x2f')][_0xb3f6('0x39')]+'%'};return _0x1679f0;}})});}_0x3cd144=_[_0xb3f6('0x3c')]({},_0x3cd144,_0x33110a['options']);var _0x122484={'where':_0x3cd144['where']};return db[_0xb3f6('0x29')][_0xb3f6('0x1d')](_0x122484)[_0xb3f6('0x23')](function(_0x538f7a){_0x31ba9d[_0xb3f6('0x1d')]=_0x538f7a;if(_0x33110a[_0xb3f6('0x2f')]['includeAll']){_0x3cd144[_0xb3f6('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x3cd144);})[_0xb3f6('0x23')](function(_0x2b3562){_0x31ba9d[_0xb3f6('0x3e')]=_0x2b3562;return _0x31ba9d;})[_0xb3f6('0x23')](respondWithFilteredResult(_0x443dbe,_0x3cd144))[_0xb3f6('0x3f')](handleError(_0x443dbe,null));};exports[_0xb3f6('0x40')]=function(_0x522498,_0x3e7514){var _0x44f5af={'raw':!![],'where':{'id':_0x522498[_0xb3f6('0x41')]['id']}},_0x587df2={};_0x587df2[_0xb3f6('0x2e')]=_['keys'](db['OpenchannelApplication'][_0xb3f6('0x2a')]);_0x587df2[_0xb3f6('0x2f')]=_[_0xb3f6('0x30')](_0x522498[_0xb3f6('0x2f')]);_0x587df2[_0xb3f6('0x31')]=_[_0xb3f6('0x32')](_0x587df2[_0xb3f6('0x2e')],_0x587df2[_0xb3f6('0x2f')]);_0x44f5af['attributes']=_[_0xb3f6('0x32')](_0x587df2[_0xb3f6('0x2e')],qs['fields'](_0x522498['query'][_0xb3f6('0x34')]));_0x44f5af[_0xb3f6('0x33')]=_0x44f5af['attributes']['length']?_0x44f5af[_0xb3f6('0x33')]:_0x587df2[_0xb3f6('0x2e')];if(_0x522498[_0xb3f6('0x2f')][_0xb3f6('0x42')]){_0x44f5af[_0xb3f6('0x3d')]=[{'all':!![]}];}_0x44f5af=_[_0xb3f6('0x3c')]({},_0x44f5af,_0x522498[_0xb3f6('0x43')]);return db[_0xb3f6('0x29')][_0xb3f6('0x44')](_0x44f5af)[_0xb3f6('0x23')](handleEntityNotFound(_0x3e7514,null))[_0xb3f6('0x23')](respondWithResult(_0x3e7514,null))[_0xb3f6('0x3f')](handleError(_0x3e7514,null));};exports[_0xb3f6('0x45')]=function(_0x2cca61,_0x16b072){return db[_0xb3f6('0x29')]['create'](_0x2cca61[_0xb3f6('0x46')],{})[_0xb3f6('0x23')](respondWithResult(_0x16b072,0xc9))[_0xb3f6('0x3f')](handleError(_0x16b072,null));};exports[_0xb3f6('0x47')]=function(_0x5e117d,_0x5c18ef){if(_0x5e117d['body']['id']){delete _0x5e117d[_0xb3f6('0x46')]['id'];}return db['OpenchannelApplication'][_0xb3f6('0x44')]({'where':{'id':_0x5e117d['params']['id']}})['then'](handleEntityNotFound(_0x5c18ef,null))[_0xb3f6('0x23')](saveUpdates(_0x5e117d[_0xb3f6('0x46')],null))[_0xb3f6('0x23')](respondWithResult(_0x5c18ef,null))[_0xb3f6('0x3f')](handleError(_0x5c18ef,null));};exports[_0xb3f6('0x24')]=function(_0x5de120,_0x30e308){return db[_0xb3f6('0x29')][_0xb3f6('0x44')]({'where':{'id':_0x5de120[_0xb3f6('0x41')]['id']}})[_0xb3f6('0x23')](handleEntityNotFound(_0x30e308,null))[_0xb3f6('0x23')](removeEntity(_0x30e308,null))[_0xb3f6('0x3f')](handleError(_0x30e308,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1faba1b..13724fa 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 _0x2f87=['../../config/logger','api','moment','bluebird','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x254849,_0x321ff6){var _0x4f73d1=function(_0x489d88){while(--_0x489d88){_0x254849['push'](_0x254849['shift']());}};_0x4f73d1(++_0x321ff6);}(_0x2f87,0x124));var _0x72f8=function(_0x24b707,_0x1152a9){_0x24b707=_0x24b707-0x0;var _0x256e0b=_0x2f87[_0x24b707];return _0x256e0b;};'use strict';var _=require(_0x72f8('0x0'));var util=require(_0x72f8('0x1'));var logger=require(_0x72f8('0x2'))(_0x72f8('0x3'));var moment=require(_0x72f8('0x4'));var BPromise=require(_0x72f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x72f8('0x6'));var attributes=require(_0x72f8('0x7'));module[_0x72f8('0x8')]=function(_0x3f3745,_0x1318b1){return _0x3f3745[_0x72f8('0x9')](_0x72f8('0xa'),attributes,{'tableName':_0x72f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72f8('0xc'),'collate':_0x72f8('0xd')});}; \ No newline at end of file +var _0x06a6=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x06a6,0xc9));var _0x606a=function(_0x40f696,_0x4e9e1a){_0x40f696=_0x40f696-0x0;var _0x126fc6=_0x06a6[_0x40f696];return _0x126fc6;};'use strict';var _=require(_0x606a('0x0'));var util=require(_0x606a('0x1'));var logger=require(_0x606a('0x2'))(_0x606a('0x3'));var moment=require(_0x606a('0x4'));var BPromise=require('bluebird');var rp=require(_0x606a('0x5'));var fs=require('fs');var path=require(_0x606a('0x6'));var rimraf=require(_0x606a('0x7'));var config=require(_0x606a('0x8'));var attributes=require(_0x606a('0x9'));module[_0x606a('0xa')]=function(_0x1089aa,_0x419f7e){return _0x1089aa[_0x606a('0xb')](_0x606a('0xc'),attributes,{'tableName':_0x606a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x606a('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2ede84b..da90960 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 _0xbfac=['where','limit','info','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw'];(function(_0x47bf43,_0x4f8dd4){var _0x570bac=function(_0x13415f){while(--_0x13415f){_0x47bf43['push'](_0x47bf43['shift']());}};_0x570bac(++_0x4f8dd4);}(_0xbfac,0x67));var _0xcbfa=function(_0x5499d9,_0x1abd4f){_0x5499d9=_0x5499d9-0x0;var _0x52054c=_0xbfac[_0x5499d9];return _0x52054c;};'use strict';var _=require('lodash');var util=require(_0xcbfa('0x0'));var moment=require(_0xcbfa('0x1'));var BPromise=require(_0xcbfa('0x2'));var rs=require(_0xcbfa('0x3'));var fs=require('fs');var Redis=require(_0xcbfa('0x4'));var db=require(_0xcbfa('0x5'))['db'];var utils=require(_0xcbfa('0x6'));var logger=require(_0xcbfa('0x7'))(_0xcbfa('0x8'));var config=require(_0xcbfa('0x9'));var jayson=require(_0xcbfa('0xa'));var client=jayson[_0xcbfa('0xb')][_0xcbfa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22ae64,_0x1f9999,_0x549742){return new BPromise(function(_0x1fa56d,_0x4c1e3f){return client[_0xcbfa('0xd')](_0x22ae64,_0x549742)['then'](function(_0x924029){logger['info'](_0xcbfa('0xe'),_0x1f9999,'request\x20sent');logger['debug'](_0xcbfa('0xf'),_0x1f9999,_0xcbfa('0x10'),JSON[_0xcbfa('0x11')](_0x924029));if(_0x924029[_0xcbfa('0x12')]){if(_0x924029[_0xcbfa('0x12')][_0xcbfa('0x13')]===0x1f4){logger['error'](_0xcbfa('0xe'),_0x1f9999,_0x924029[_0xcbfa('0x12')]['message']);return _0x4c1e3f(_0x924029['error']['message']);}logger[_0xcbfa('0x12')](_0xcbfa('0xe'),_0x1f9999,_0x924029[_0xcbfa('0x12')][_0xcbfa('0x14')]);return _0x1fa56d(_0x924029[_0xcbfa('0x12')][_0xcbfa('0x14')]);}else{logger['info'](_0xcbfa('0xe'),_0x1f9999,'request\x20sent');_0x1fa56d(_0x924029[_0xcbfa('0x15')]['message']);}})[_0xcbfa('0x16')](function(_0x384fec){logger[_0xcbfa('0x12')](_0xcbfa('0xe'),_0x1f9999,_0x384fec);_0x4c1e3f(_0x384fec);});});}exports[_0xcbfa('0x17')]=function(_0x481275){var _0x10f48e=this;return new Promise(function(_0x4b2118,_0x2a712f){return db[_0xcbfa('0x18')][_0xcbfa('0x19')](_0x481275[_0xcbfa('0x1a')],{'raw':_0x481275['options']?_0x481275[_0xcbfa('0x1b')][_0xcbfa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x481275[_0xcbfa('0x1b')]?_0x481275[_0xcbfa('0x1b')][_0xcbfa('0x1d')]||null:null,'attributes':_0x481275['options']?_0x481275[_0xcbfa('0x1b')]['attributes']||null:null,'limit':_0x481275[_0xcbfa('0x1b')]?_0x481275[_0xcbfa('0x1b')][_0xcbfa('0x1e')]||null:null})['then'](function(_0x12398e){logger[_0xcbfa('0x1f')](_0xcbfa('0x17'),_0x481275);logger[_0xcbfa('0x20')](_0xcbfa('0x17'),_0x481275,JSON[_0xcbfa('0x11')](_0x12398e));_0x4b2118(_0x12398e);})[_0xcbfa('0x16')](function(_0x53c7f3){logger['error'](_0xcbfa('0x17'),_0x53c7f3['message'],_0x481275);_0x2a712f(_0x10f48e[_0xcbfa('0x12')](0x1f4,_0x53c7f3[_0xcbfa('0x14')]));});});}; \ No newline at end of file +var _0xf79c=['request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf79c,0xeb));var _0xcf79=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xf79c[_0x2335e6];return _0x370a50;};'use strict';var _=require(_0xcf79('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf79('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf79('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf79('0x3'));var logger=require(_0xcf79('0x4'))(_0xcf79('0x5'));var config=require(_0xcf79('0x6'));var jayson=require(_0xcf79('0x7'));var client=jayson[_0xcf79('0x8')][_0xcf79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49280e,_0x52e07b,_0x12bfc2){return new BPromise(function(_0x3bc44a,_0x379b71){return client['request'](_0x49280e,_0x12bfc2)[_0xcf79('0xa')](function(_0x3bca00){logger[_0xcf79('0xb')](_0xcf79('0xc'),_0x52e07b,_0xcf79('0xd'));logger[_0xcf79('0xe')](_0xcf79('0xf'),_0x52e07b,_0xcf79('0xd'),JSON[_0xcf79('0x10')](_0x3bca00));if(_0x3bca00[_0xcf79('0x11')]){if(_0x3bca00[_0xcf79('0x11')][_0xcf79('0x12')]===0x1f4){logger[_0xcf79('0x11')](_0xcf79('0xc'),_0x52e07b,_0x3bca00[_0xcf79('0x11')][_0xcf79('0x13')]);return _0x379b71(_0x3bca00['error'][_0xcf79('0x13')]);}logger[_0xcf79('0x11')](_0xcf79('0xc'),_0x52e07b,_0x3bca00[_0xcf79('0x11')]['message']);return _0x3bc44a(_0x3bca00[_0xcf79('0x11')][_0xcf79('0x13')]);}else{logger[_0xcf79('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x52e07b,_0xcf79('0xd'));_0x3bc44a(_0x3bca00[_0xcf79('0x14')]['message']);}})['catch'](function(_0x43f37c){logger[_0xcf79('0x11')](_0xcf79('0xc'),_0x52e07b,_0x43f37c);_0x379b71(_0x43f37c);});});}exports[_0xcf79('0x15')]=function(_0x4cca2b){var _0x2371fc=this;return new Promise(function(_0x1b50a0,_0x26768d){return db[_0xcf79('0x16')][_0xcf79('0x17')](_0x4cca2b[_0xcf79('0x18')],{'raw':_0x4cca2b['options']?_0x4cca2b[_0xcf79('0x19')][_0xcf79('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cca2b['options']?_0x4cca2b[_0xcf79('0x19')][_0xcf79('0x1b')]||null:null,'attributes':_0x4cca2b['options']?_0x4cca2b['options'][_0xcf79('0x1c')]||null:null,'limit':_0x4cca2b[_0xcf79('0x19')]?_0x4cca2b[_0xcf79('0x19')][_0xcf79('0x1d')]||null:null})[_0xcf79('0xa')](function(_0x445a1f){logger[_0xcf79('0xb')](_0xcf79('0x15'),_0x4cca2b);logger['debug'](_0xcf79('0x15'),_0x4cca2b,JSON[_0xcf79('0x10')](_0x445a1f));_0x1b50a0(_0x445a1f);})[_0xcf79('0x1e')](function(_0x1a5813){logger[_0xcf79('0x11')](_0xcf79('0x15'),_0x1a5813[_0xcf79('0x13')],_0x4cca2b);_0x26768d(_0x2371fc[_0xcf79('0x11')](0x1f4,_0x1a5813['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b27cbd0..50957ff 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 _0x22cb=['/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x478264,_0x354250){var _0x3d29e0=function(_0x208ed9){while(--_0x208ed9){_0x478264['push'](_0x478264['shift']());}};_0x3d29e0(++_0x354250);}(_0x22cb,0x17e));var _0xb22c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x22cb[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xb22c('0x0'));var util=require(_0xb22c('0x1'));var path=require(_0xb22c('0x2'));var timeout=require(_0xb22c('0x3'));var express=require(_0xb22c('0x4'));var router=express[_0xb22c('0x5')]();var fs_extra=require(_0xb22c('0x6'));var auth=require(_0xb22c('0x7'));var interaction=require(_0xb22c('0x8'));var config=require(_0xb22c('0x9'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xb22c('0xa')](),controller['index']);router[_0xb22c('0xb')](_0xb22c('0xc'),auth[_0xb22c('0xa')](),controller[_0xb22c('0xd')]);router[_0xb22c('0xb')](_0xb22c('0xe'),auth[_0xb22c('0xa')](),controller[_0xb22c('0xf')]);router[_0xb22c('0xb')](_0xb22c('0x10'),auth[_0xb22c('0xa')](),controller[_0xb22c('0x11')]);router['get'](_0xb22c('0x12'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xb22c('0xa')](),controller[_0xb22c('0x13')]);router[_0xb22c('0x14')](_0xb22c('0x10'),auth[_0xb22c('0xa')](),controller[_0xb22c('0x15')]);router['post'](_0xb22c('0x16'),auth['isAuthenticated'](),interaction[_0xb22c('0x17')](_0xb22c('0x18'),_0xb22c('0x19')),controller[_0xb22c('0x1a')]);router[_0xb22c('0x1b')]('/:id',auth[_0xb22c('0xa')](),interaction[_0xb22c('0x17')](_0xb22c('0x18'),'openchannelinteraction:update'),controller[_0xb22c('0x1c')]);router[_0xb22c('0x1d')](_0xb22c('0xe'),auth[_0xb22c('0xa')](),interaction['tracked'](_0xb22c('0x18'),_0xb22c('0x1e')),controller[_0xb22c('0x1f')]);router['delete'](_0xb22c('0x16'),auth[_0xb22c('0xa')](),controller['removeTags']);module[_0xb22c('0x20')]=router; \ No newline at end of file +var _0x9c22=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0x3c5ca4,_0x3abbde){var _0x375f82=function(_0x291b8d){while(--_0x291b8d){_0x3c5ca4['push'](_0x3c5ca4['shift']());}};_0x375f82(++_0x3abbde);}(_0x9c22,0x117));var _0x29c2=function(_0x48d2f9,_0x2e4981){_0x48d2f9=_0x48d2f9-0x0;var _0x2d9527=_0x9c22[_0x48d2f9];return _0x2d9527;};'use strict';var multer=require(_0x29c2('0x0'));var util=require(_0x29c2('0x1'));var path=require(_0x29c2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x29c2('0x3'));var auth=require(_0x29c2('0x4'));var interaction=require(_0x29c2('0x5'));var config=require(_0x29c2('0x6'));var controller=require(_0x29c2('0x7'));router[_0x29c2('0x8')]('/',auth[_0x29c2('0x9')](),controller[_0x29c2('0xa')]);router[_0x29c2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x29c2('0xb')]);router[_0x29c2('0x8')]('/:id',auth[_0x29c2('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0x29c2('0x9')](),controller['getMessages']);router[_0x29c2('0x8')](_0x29c2('0xc'),auth['isAuthenticated'](),controller[_0x29c2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29c2('0xe')]);router[_0x29c2('0xf')](_0x29c2('0x10'),auth[_0x29c2('0x9')](),controller[_0x29c2('0x11')]);router['post'](_0x29c2('0x12'),auth[_0x29c2('0x9')](),interaction[_0x29c2('0x13')](_0x29c2('0x14'),_0x29c2('0x15')),controller[_0x29c2('0x16')]);router[_0x29c2('0x17')](_0x29c2('0x18'),auth[_0x29c2('0x9')](),interaction[_0x29c2('0x13')](_0x29c2('0x14'),_0x29c2('0x19')),controller['update']);router[_0x29c2('0x1a')](_0x29c2('0x18'),auth[_0x29c2('0x9')](),interaction['tracked'](_0x29c2('0x14'),_0x29c2('0x1b')),controller[_0x29c2('0x1c')]);router['delete']('/:id/tags',auth[_0x29c2('0x9')](),controller[_0x29c2('0x1d')]);module[_0x29c2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9d35ad9..07ebcb9 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 _0x121d=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x55b10f,_0x216487){var _0x1727a3=function(_0x3a387e){while(--_0x3a387e){_0x55b10f['push'](_0x55b10f['shift']());}};_0x1727a3(++_0x216487);}(_0x121d,0xea));var _0xd121=function(_0x45fa2a,_0x2762f4){_0x45fa2a=_0x45fa2a-0x0;var _0x1eaa4d=_0x121d[_0x45fa2a];return _0x1eaa4d;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'closed':{'type':Sequelize[_0xd121('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd121('0x3')]},'disposition':{'type':Sequelize[_0xd121('0x4')]},'secondDisposition':{'type':Sequelize[_0xd121('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd121('0x4')]},'note':{'type':Sequelize[_0xd121('0x4')]},'read1stAt':{'type':Sequelize[_0xd121('0x3')]},'threadId':{'type':Sequelize[_0xd121('0x4')]},'externalUrl':{'type':Sequelize[_0xd121('0x4')]},'lastMsgAt':{'type':Sequelize[_0xd121('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd121('0x5')]('in',_0xd121('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xd121('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x14ee=['BOOLEAN','sequelize','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ee,0x115));var _0xe14e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x14ee[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe14e('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe14e('0x1')]},'disposition':{'type':Sequelize[_0xe14e('0x2')]},'secondDisposition':{'type':Sequelize[_0xe14e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe14e('0x2')]},'note':{'type':Sequelize[_0xe14e('0x2')]},'read1stAt':{'type':Sequelize[_0xe14e('0x1')]},'threadId':{'type':Sequelize[_0xe14e('0x2')]},'externalUrl':{'type':Sequelize[_0xe14e('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe14e('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xe14e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b3f8089..9d62b46 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 _0x0c45=['addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','download','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','createWriteStream','out','basename','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','TagIds','split','Tags','push','waiting','talking','answered','unmanaged','total','closed','UserId','OpenchannelInteraction','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','rawAttributes','includeAll','include','merge','options','create','describe'];(function(_0x310d1b,_0x28df82){var _0x1f5919=function(_0x419983){while(--_0x419983){_0x310d1b['push'](_0x310d1b['shift']());}};_0x1f5919(++_0x28df82);}(_0x0c45,0x128));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x50c4('0x0'));var rimraf=require(_0x50c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50c4('0x2'));var moment=require(_0x50c4('0x3'));var BPromise=require(_0x50c4('0x4'));var Mustache=require('mustache');var util=require(_0x50c4('0x5'));var path=require(_0x50c4('0x6'));var sox=require(_0x50c4('0x7'));var csv=require('to-csv');var ejs=require(_0x50c4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50c4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x50c4('0xa'));var deskjs=require(_0x50c4('0xb'));var toCsv=require(_0x50c4('0xc'));var querystring=require(_0x50c4('0xd'));var Papa=require(_0x50c4('0xe'));var Redis=require(_0x50c4('0xf'));var authService=require(_0x50c4('0x10'));var qs=require(_0x50c4('0x11'));var as=require(_0x50c4('0x12'));var pdf=require(_0x50c4('0x13'));var hardwareService=require(_0x50c4('0x14'));var logger=require(_0x50c4('0x15'))(_0x50c4('0x16'));var utils=require(_0x50c4('0x17'));var config=require(_0x50c4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x50c4('0x19'))['db'];config[_0x50c4('0x1a')]=_[_0x50c4('0x1b')](config['redis'],{'host':_0x50c4('0x1c'),'port':0x18eb});var socket=require(_0x50c4('0x1d'))(new Redis(config[_0x50c4('0x1a')]));require('./openchannelInteraction.socket')[_0x50c4('0x1e')](socket);function respondWithStatusCode(_0x271514,_0x2ca603){_0x2ca603=_0x2ca603||0xcc;return function(_0x252eb0){if(_0x252eb0){return _0x271514[_0x50c4('0x1f')](_0x2ca603);}return _0x271514[_0x50c4('0x20')](_0x2ca603)[_0x50c4('0x21')]();};}function respondWithResult(_0x15c51a,_0x12ba45){_0x12ba45=_0x12ba45||0xc8;return function(_0x10fc58){if(_0x10fc58){return _0x15c51a['status'](_0x12ba45)[_0x50c4('0x22')](_0x10fc58);}};}function respondWithFilteredResult(_0x527ca9,_0x369052){return function(_0x397e08){if(_0x397e08){var _0x36fb3e=typeof _0x369052[_0x50c4('0x23')]===_0x50c4('0x24')&&typeof _0x369052[_0x50c4('0x25')]==='undefined';var _0x1659db=_0x397e08[_0x50c4('0x26')];var _0x4f2c90=_0x36fb3e?0x0:_0x369052[_0x50c4('0x23')];var _0x4ba3a8=_0x36fb3e?_0x397e08[_0x50c4('0x26')]:_0x369052[_0x50c4('0x23')]+_0x369052['limit'];var _0x2961a6;if(_0x4ba3a8>=_0x1659db){_0x4ba3a8=_0x1659db;_0x2961a6=0xc8;}else{_0x2961a6=0xce;}_0x527ca9[_0x50c4('0x20')](_0x2961a6);return _0x527ca9[_0x50c4('0x27')]('Content-Range',_0x4f2c90+'-'+_0x4ba3a8+'/'+_0x1659db)[_0x50c4('0x22')](_0x397e08);}return null;};}function patchUpdates(_0x17daac){return function(_0x5ac3ed){try{jsonpatch[_0x50c4('0x28')](_0x5ac3ed,_0x17daac,!![]);}catch(_0x37c35f){return BPromise[_0x50c4('0x29')](_0x37c35f);}return _0x5ac3ed[_0x50c4('0x2a')]();};}function saveUpdates(_0x1d9f49,_0x362003){return function(_0x263e0a){if(_0x263e0a){return _0x263e0a[_0x50c4('0x2b')](_0x1d9f49)[_0x50c4('0x2c')](function(_0x31b23f){return _0x31b23f;});}return null;};}function removeEntity(_0x38a7bb,_0x2590ee){return function(_0xeaa6c){if(_0xeaa6c){return _0xeaa6c[_0x50c4('0x2d')]()[_0x50c4('0x2c')](function(){_0x38a7bb[_0x50c4('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5e96,_0x1da1d5){return function(_0x159540){if(!_0x159540){_0x2d5e96[_0x50c4('0x1f')](0x194);}return _0x159540;};}function handleError(_0x19067b,_0x4134f6){_0x4134f6=_0x4134f6||0x1f4;return function(_0x356a74){logger[_0x50c4('0x2e')](_0x356a74[_0x50c4('0x2f')]);if(_0x356a74[_0x50c4('0x30')]){delete _0x356a74[_0x50c4('0x30')];}_0x19067b[_0x50c4('0x20')](_0x4134f6)[_0x50c4('0x31')](_0x356a74);};}function getInteractionUsers(_0x16e7fd,_0x1cb07b){return new BPromise(function(_0x4d2eb9,_0x2eb9c7){try{if(_0x1cb07b[_0x16e7fd['id']]){_0x16e7fd['Users']=_[_0x50c4('0x32')](_0x1cb07b[_0x16e7fd['id']],function(_0x16aeb3){return{'id':_0x16aeb3['id'],'fullname':_0x16aeb3['fullname']};});}}catch(_0x361544){_0x2eb9c7(_0x361544);}_0x4d2eb9(_0x16e7fd);});}function getInteractionTags(_0x4dc5cd,_0xa0d246){return new BPromise(function(_0x1868f1,_0x1ea558){try{if(_0x4dc5cd[_0x50c4('0x33')]){_0x4dc5cd['Tags']=[];_0x4dc5cd[_0x50c4('0x33')][_0x50c4('0x34')](',')['forEach'](function(_0x21426f){_0x4dc5cd[_0x50c4('0x35')][_0x50c4('0x36')](_0xa0d246[_0x21426f]);});}delete _0x4dc5cd[_0x50c4('0x33')];}catch(_0x1664de){_0x1ea558(_0x1664de);}_0x1868f1(_0x4dc5cd);});}function updateOpenchannelInteraction(_0x3af4e5,_0x114547,_0x3b3250){return new BPromise(function(_0x398e56,_0x52071d){return getInteractionUsers(_0x3af4e5,_0x3b3250)['then'](function(_0xcb8d){return getInteractionTags(_0xcb8d,_0x114547);})[_0x50c4('0x2c')](function(_0x1aee06){return getStateInteraction(_0x1aee06);})[_0x50c4('0x2c')](function(_0xc2a6ba){_0x398e56(_0xc2a6ba);})['catch'](function(_0x3aa2c5){_0x52071d(_0x3aa2c5);});});}function getStateInteraction(_0x40b68e){return new BPromise(function(_0x1e7a44){_0x40b68e[_0x50c4('0x37')]=0x0;_0x40b68e[_0x50c4('0x38')]=0x0;_0x40b68e[_0x50c4('0x39')]=0x0;_0x40b68e[_0x50c4('0x3a')]=0x0;_0x40b68e[_0x50c4('0x3b')]=0x0;if(!_0x40b68e[_0x50c4('0x3c')]&&!_0x40b68e['UserId']){_0x40b68e['waiting']+=0x1;}if(!_0x40b68e[_0x50c4('0x3c')]&&_0x40b68e[_0x50c4('0x3d')]){_0x40b68e[_0x50c4('0x38')]+=0x1;if(_0x40b68e[_0x50c4('0x37')]){_0x40b68e['waiting']-=0x1;}}if(_0x40b68e[_0x50c4('0x3c')]&&_0x40b68e[_0x50c4('0x3d')]){_0x40b68e['answered']+=0x1;if(_0x40b68e[_0x50c4('0x38')]){_0x40b68e[_0x50c4('0x38')]-=0x1;}}if(_0x40b68e['closed']&&!_0x40b68e[_0x50c4('0x3d')]){_0x40b68e['unmanaged']+=0x1;if(_0x40b68e[_0x50c4('0x37')]){_0x40b68e['waiting']-=0x1;}}_0x40b68e[_0x50c4('0x3b')]+=0x1;_0x1e7a44(_0x40b68e);});}exports['index']=function(_0x516587,_0x5e695a){var _0x4d62dd={},_0xe209d={},_0x97d95={'count':0x0,'rows':[]};var _0xf4cdcd=_[_0x50c4('0x32')](db[_0x50c4('0x3e')]['rawAttributes'],function(_0x290dc7){return{'name':_0x290dc7['fieldName'],'type':_0x290dc7[_0x50c4('0x3f')]['key']};});_0xe209d[_0x50c4('0x40')]=_['map'](_0xf4cdcd,_0x50c4('0x30'));_0xe209d['query']=_[_0x50c4('0x41')](_0x516587[_0x50c4('0x42')]);_0xe209d[_0x50c4('0x43')]=_['intersection'](_0xe209d[_0x50c4('0x40')],_0xe209d['query']);_0x4d62dd[_0x50c4('0x44')]=_[_0x50c4('0x45')](_0xe209d[_0x50c4('0x40')],qs[_0x50c4('0x46')](_0x516587[_0x50c4('0x42')][_0x50c4('0x46')]));_0x4d62dd['attributes']=_0x4d62dd[_0x50c4('0x44')]['length']?_0x4d62dd[_0x50c4('0x44')]:_0xe209d['model'];if(!_0x516587['query'][_0x50c4('0x47')]('nolimit')){_0x4d62dd[_0x50c4('0x25')]=qs[_0x50c4('0x25')](_0x516587[_0x50c4('0x42')][_0x50c4('0x25')]);_0x4d62dd[_0x50c4('0x23')]=qs[_0x50c4('0x23')](_0x516587[_0x50c4('0x42')][_0x50c4('0x23')]);}_0x4d62dd['order']=qs['sort'](_0x516587['query'][_0x50c4('0x48')]);_0x4d62dd[_0x50c4('0x49')]=qs['filters'](_['pick'](_0x516587[_0x50c4('0x42')],_0xe209d['filters']),_0xf4cdcd);var _0x523ce9=[];var _0x2b2447=squel['select']()[_0x50c4('0x4a')]('id')[_0x50c4('0x4a')](_0x50c4('0x30'))['field'](_0x50c4('0x4b'))[_0x50c4('0x4c')]('tools_tags');var _0xd8d0ca=squel['select']()[_0x50c4('0x4a')](_0x50c4('0x4d'))[_0x50c4('0x4a')](_0x50c4('0x4e'))['field']('ui.OpenchannelInteractionId')[_0x50c4('0x4c')](_0x50c4('0x4f'),'ui')[_0x50c4('0x50')](_0x50c4('0x51'),'u',_0x50c4('0x52'));var _0x1cc840=squel[_0x50c4('0x53')]()['from'](_0x50c4('0x54'),'i')[_0x50c4('0x50')](_0x50c4('0x55'),'c',_0x50c4('0x56'))[_0x50c4('0x50')](_0x50c4('0x51'),'o',_0x50c4('0x57'))[_0x50c4('0x50')](_0x50c4('0x58'),'a',_0x50c4('0x59'))['left_join'](_0x50c4('0x5a'),'me',_0x50c4('0x5b'))[_0x50c4('0x50')]('openchannel_interaction_has_tags','it',_0x50c4('0x5c'))['left_join'](_0x50c4('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x3ca34e=squel[_0x50c4('0x5e')]();var _0xbed8d1=[];var _0xf1ffa2=squel[_0x50c4('0x5e')]();var _0x4a58a5;if(_0x516587['query'][_0x50c4('0x5f')]){_0x4a58a5=as[_0x50c4('0x60')](_0x516587['query'][_0x50c4('0x5f')]);var _0x264df5=_0x4a58a5[_0x50c4('0x61')];for(var _0x586af5=0x0;_0x586af5<_0x4a58a5[_0x50c4('0x62')][_0x50c4('0x63')];_0x586af5++){var _0x51f3b4=_0x4a58a5[_0x50c4('0x62')][_0x586af5];var _0x2a6007='i';var _0x4043b8=_[_0x50c4('0x64')](_0xf4cdcd,['name',_0x51f3b4[_0x50c4('0x4a')]]);if(!_0x4043b8){switch(_0x51f3b4[_0x50c4('0x4a')]){case _0x50c4('0x65'):if(_0x51f3b4[_0x50c4('0x66')]==0x1){_0x1cc840[_0x50c4('0x67')]('`'+_0x51f3b4[_0x50c4('0x4a')]+'`\x20=\x200');}else{_0x1cc840['having']('`'+_0x51f3b4[_0x50c4('0x4a')]+_0x50c4('0x68'));}break;case _0x50c4('0x69'):if(_0x51f3b4[_0x50c4('0x6a')]===_0x50c4('0x6b')){if(_0x51f3b4[_0x50c4('0x66')][_0x50c4('0x34')]('\x20')[_0x50c4('0x63')]>0x1){_0x3ca34e[_0x264df5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x50c4('0x6c')](_0x51f3b4[_0x50c4('0x66')]),null);}else{var _0x11a55e='%'+_0x51f3b4[_0x50c4('0x66')]+'%';_0x3ca34e[_0x264df5](_0x50c4('0x6d'),_0x11a55e,_0x11a55e,_0x11a55e);}}else{_0x4043b8=_[_0x50c4('0x64')](_0xf4cdcd,['name',_0x50c4('0x6e')]);_0x51f3b4[_0x50c4('0x4a')]=_0x50c4('0x6e');_0x18f0a6=as[_0x50c4('0x6f')](_0x2a6007,_0x4043b8[_0x50c4('0x3f')],_0x51f3b4);_0x3ca34e[_0x264df5](_0x18f0a6['text'],_0x18f0a6[_0x50c4('0x66')][_0x50c4('0x70')],_0x18f0a6['value'][_0x50c4('0x21')]);}break;case _0x50c4('0x71'):var _0x2b3b45=_0x51f3b4[_0x50c4('0x66')][_0x50c4('0x34')](',')[_0x50c4('0x32')](function(_0x461633){return Number(_0x461633);});_0x2b3b45[_0x50c4('0x72')](function(_0x53a25d){_0xf1ffa2['or'](_0x50c4('0x73'),'%,'+_0x53a25d+',%');});_0xbed8d1=_[_0x50c4('0x74')](_0xbed8d1,_0x2b3b45);break;case _0x50c4('0x75'):if(_0x51f3b4[_0x50c4('0x6a')]===_0x50c4('0x6b')){_0x3ca34e[_0x264df5](_0x50c4('0x76'),'%'+_0x51f3b4['value']+'%',null);}else{_0x4043b8=_['find'](_0xf4cdcd,[_0x50c4('0x30'),_0x50c4('0x3d')]);_0x51f3b4[_0x50c4('0x4a')]=_0x50c4('0x3d');_0x18f0a6=as[_0x50c4('0x6f')](_0x2a6007,_0x4043b8[_0x50c4('0x3f')],_0x51f3b4);_0x3ca34e[_0x264df5](_0x18f0a6[_0x50c4('0x77')],_0x18f0a6[_0x50c4('0x66')][_0x50c4('0x70')],_0x18f0a6[_0x50c4('0x66')][_0x50c4('0x21')]);}break;case _0x50c4('0x78'):_0x18f0a6=as[_0x50c4('0x6f')]('me',null,_0x51f3b4);_0x3ca34e[_0x264df5](_0x18f0a6[_0x50c4('0x77')],_0x18f0a6['value'][_0x50c4('0x70')],_0x18f0a6[_0x50c4('0x66')][_0x50c4('0x21')]);break;}}else{var _0x18f0a6=as[_0x50c4('0x6f')](_0x2a6007,_0x4043b8['type'],_0x51f3b4);_0x3ca34e[_0x264df5](_0x18f0a6[_0x50c4('0x77')],_0x18f0a6['value']['start'],_0x18f0a6[_0x50c4('0x66')][_0x50c4('0x21')]);}}}else{var _0x21a16b=_(_0x516587['query'])[_0x50c4('0x41')]()[_0x50c4('0x32')](function(_0x9f343e){return _['some'](_0xf4cdcd,[_0x50c4('0x30'),_0x9f343e])?_0x9f343e:undefined;})['compact']()['value']();if(!_[_0x50c4('0x79')](_0x21a16b)){_0x21a16b['forEach'](function(_0x22b4a9){if(_0x22b4a9===_0x50c4('0x7a')){_0x1cc840[_0x50c4('0x49')](_0x50c4('0x7b'),[]['concat'](_0x516587['query'][_0x22b4a9]));}else if(_0x22b4a9===_0x50c4('0x7c')){var _0xdc02=JSON[_0x50c4('0x7d')](_0x516587[_0x50c4('0x42')][_0x22b4a9])[_0x50c4('0x7e')];var _0x10a0b2=JSON[_0x50c4('0x7d')](_0x516587['query'][_0x22b4a9])['$lte'];_0x1cc840[_0x50c4('0x49')](_0x50c4('0x7f'),_0xdc02,_0x10a0b2);}else{if(_0x516587[_0x50c4('0x42')][_0x22b4a9]==='null'){_0x1cc840[_0x50c4('0x49')]('i.'+_0x22b4a9+_0x50c4('0x80'));}else{_0x1cc840['where']('i.'+_0x22b4a9+'\x20=\x20?',_0x516587[_0x50c4('0x42')][_0x22b4a9]);}}});}if(_0x516587[_0x50c4('0x42')][_0x50c4('0x81')]){if(_0x516587[_0x50c4('0x42')][_0x50c4('0x81')]==0x1){_0x1cc840[_0x50c4('0x67')]('`unreadMessages`\x20=\x200');}else{_0x1cc840[_0x50c4('0x67')](_0x50c4('0x82'));}}if(_0x516587[_0x50c4('0x42')][_0x50c4('0x83')]){_0xbed8d1=_['isArray'](_0x516587['query'][_0x50c4('0x83')])?_0x516587['query']['tag']:new Array(_0x516587[_0x50c4('0x42')][_0x50c4('0x83')]);_0xbed8d1[_0x50c4('0x72')](function(_0x592c17){_0xf1ffa2['or'](_0x50c4('0x73'),'%,'+_0x592c17+',%');});}if(_0x516587[_0x50c4('0x42')][_0x50c4('0x84')]){var _0x37dc5b=_0x516587['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x50c4('0x85')](/'/g,'\x27\x27');if(qs[_0x50c4('0x86')](_0x37dc5b)){_0x3ca34e['or'](_0x50c4('0x87'),_0x37dc5b+'%');}else{_0x3ca34e['or'](_0x50c4('0x88'),qs[_0x50c4('0x6c')](_0x37dc5b))['or'](_0x50c4('0x89'),_0x37dc5b+'%')['or'](_0x50c4('0x8a'),_0x37dc5b+'%');}}}_0x1cc840[_0x50c4('0x49')](_0x3ca34e);_0x1cc840[_0x50c4('0x8b')](_0x50c4('0x8c'));var _0x3064f3={'type':db['Sequelize'][_0x50c4('0x8d')][_0x50c4('0x8e')],'raw':!![]};var _0x14dd50=_0x1cc840['clone']();_0x14dd50[_0x50c4('0x4a')](_0x50c4('0x8c'));_0x14dd50['field'](_0x50c4('0x8f'),_0x50c4('0x65'));if(_0x4d62dd[_0x50c4('0x90')]){_0x4d62dd[_0x50c4('0x90')][_0x50c4('0x72')](function(_0x4c0367){var _0x14af50=_0x4c0367[0x0]===_0x50c4('0x91')?_0x4c0367[0x0]:'i.'+_0x4c0367[0x0];_0x1cc840[_0x50c4('0x90')](_0x14af50,_0x4c0367[0x1]==='DESC'?![]:!![]);});}if(!_[_0x50c4('0x79')](_0xbed8d1)){_0x1cc840[_0x50c4('0x67')](_0xf1ffa2);_0x14dd50[_0x50c4('0x49')](_0x50c4('0x92'),_0xbed8d1);}BPromise[_0x50c4('0x93')]()[_0x50c4('0x2c')](function(){if(!_0x4a58a5){if(_0x516587[_0x50c4('0x42')]['OpenchannelAccountId'])return;_0x14dd50[_0x50c4('0x49')](_0x50c4('0x94'));_0x1cc840[_0x50c4('0x49')](_0x50c4('0x94'));return;}if(_0x516587[_0x50c4('0x95')][_0x50c4('0x96')]!=='agent')return;return _0x516587[_0x50c4('0x95')][_0x50c4('0x97')]({'attributes':['id'],'raw':!![]})[_0x50c4('0x2c')](function(_0x3c5987){if(_[_0x50c4('0x79')](_0x3c5987)){_0x14dd50[_0x50c4('0x49')](_0x50c4('0x98'));_0x1cc840[_0x50c4('0x49')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x14dd50[_0x50c4('0x49')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x50c4('0x32')](_0x3c5987,'id'));_0x1cc840[_0x50c4('0x49')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x50c4('0x32')](_0x3c5987,'id'));}});})[_0x50c4('0x2c')](function(){if(_0x516587[_0x50c4('0x95')]['role']==='agent'&&!_0x4a58a5&&!_0x516587[_0x50c4('0x42')][_0x50c4('0x7a')])return[];return db[_0x50c4('0x99')][_0x50c4('0x42')](_0x14dd50[_0x50c4('0x9a')](),_0x3064f3);})['then'](function(_0x45ef85){_0x97d95[_0x50c4('0x26')]=_0x45ef85[_0x50c4('0x63')];if(_0x97d95[_0x50c4('0x26')]===0x0)return[];return db[_0x50c4('0x99')][_0x50c4('0x42')](_0x2b2447[_0x50c4('0x9a')](),_0x3064f3)[_0x50c4('0x2c')](function(_0x18e186){_0x523ce9=_[_0x50c4('0x9b')](_0x18e186,'id');_0x3064f3=_['merge'](_0x3064f3,{'model':db[_0x50c4('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x516587[_0x50c4('0x42')][_0x50c4('0x46')]){_0x4d62dd[_0x50c4('0x44')][_0x50c4('0x72')](function(_0x146f19){_0x1cc840[_0x50c4('0x4a')]('i.'+_0x146f19);});}else{_0x1cc840['field'](_0x50c4('0x8f'),_0x50c4('0x65'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0x9c'),'Account.key');_0x1cc840[_0x50c4('0x4a')](_0x50c4('0x9d'),_0x50c4('0x9e'));_0x1cc840['field'](_0x50c4('0x9f'),_0x50c4('0x91'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0xa0'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0xa1'),'Contact.firstName');_0x1cc840['field'](_0x50c4('0xa2'),_0x50c4('0xa3'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0xa4'),_0x50c4('0xa5'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0xa6'),_0x50c4('0xa7'));_0x1cc840[_0x50c4('0x4a')](_0x50c4('0xa8'),'Contact.mobile');_0x1cc840[_0x50c4('0x4a')]('c.fax',_0x50c4('0xa9'));_0x1cc840[_0x50c4('0x4a')]('o.fullname',_0x50c4('0xaa'));_0x1cc840['field'](_0x50c4('0xab'),_0x50c4('0xac'));_0x1cc840['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4d62dd[_0x50c4('0x25')])_0x1cc840['limit'](_0x4d62dd['limit']);if(_0x4d62dd[_0x50c4('0x23')])_0x1cc840[_0x50c4('0x23')](_0x4d62dd[_0x50c4('0x23')]);return db['sequelize'][_0x50c4('0x42')](_0x1cc840[_0x50c4('0x9a')](),_0x3064f3);})[_0x50c4('0x2c')](function(_0x1b4e56){if(_0x1b4e56[_0x50c4('0x63')]>0x0)_0xd8d0ca[_0x50c4('0x49')](_0x50c4('0xad'),_['map'](_0x1b4e56,'id'));return db[_0x50c4('0x99')][_0x50c4('0x42')](_0xd8d0ca[_0x50c4('0x9a')](),_0x3064f3)[_0x50c4('0x2c')](function(_0x5da628){var _0x1fc47d=_[_0x50c4('0xae')](_0x5da628,_0x50c4('0xaf'));var _0x4228b6=[];_0x1b4e56['forEach'](function(_0x28c3ab){_0x4228b6['push'](updateOpenchannelInteraction(_0x28c3ab,_0x523ce9,_0x1fc47d));});return BPromise[_0x50c4('0xb0')](_0x4228b6);});});})[_0x50c4('0x2c')](function(_0x260c68){_0x97d95[_0x50c4('0xb1')]=_0x260c68;return _0x97d95;})[_0x50c4('0x2c')](respondWithFilteredResult(_0x5e695a,_0x4d62dd))[_0x50c4('0xb2')](handleError(_0x5e695a,null));};exports[_0x50c4('0xb3')]=function(_0x41d745,_0xdf5157){var _0x552aa0={};if(_0x41d745[_0x50c4('0x42')][_0x50c4('0x3f')]&&_0x41d745['query'][_0x50c4('0x3f')]===_0x50c4('0x4c')){_0x552aa0[_0x50c4('0x4c')]=_0x41d745[_0x50c4('0xb4')]['id'];}else{_0x552aa0['id']=_0x41d745[_0x50c4('0xb4')]['id'];}var _0x11f72a={'raw':![],'where':_0x552aa0},_0x2cf791={};_0x2cf791['model']=_[_0x50c4('0x41')](db[_0x50c4('0x3e')][_0x50c4('0xb5')]);_0x2cf791[_0x50c4('0x42')]=_[_0x50c4('0x41')](_0x41d745['query']);_0x2cf791[_0x50c4('0x43')]=_[_0x50c4('0x45')](_0x2cf791[_0x50c4('0x40')],_0x2cf791[_0x50c4('0x42')]);_0x11f72a[_0x50c4('0x44')]=_['intersection'](_0x2cf791[_0x50c4('0x40')],qs['fields'](_0x41d745[_0x50c4('0x42')][_0x50c4('0x46')]));_0x11f72a[_0x50c4('0x44')]=_0x11f72a['attributes']['length']?_0x11f72a[_0x50c4('0x44')]:_0x2cf791['model'];if(_0x41d745[_0x50c4('0x42')][_0x50c4('0xb6')]){_0x11f72a[_0x50c4('0xb7')]=[{'all':!![]}];}_0x11f72a=_[_0x50c4('0xb8')]({},_0x11f72a,_0x41d745[_0x50c4('0xb9')]);return db[_0x50c4('0x3e')]['find'](_0x11f72a)[_0x50c4('0x2c')](handleEntityNotFound(_0xdf5157,null))[_0x50c4('0x2c')](respondWithResult(_0xdf5157,null))[_0x50c4('0xb2')](handleError(_0xdf5157,null));};exports[_0x50c4('0xba')]=function(_0x18b156,_0x70875c){return db['OpenchannelInteraction'][_0x50c4('0xba')](_0x18b156[_0x50c4('0x78')],{})[_0x50c4('0x2c')](respondWithResult(_0x70875c,0xc9))[_0x50c4('0xb2')](handleError(_0x70875c,null));};exports[_0x50c4('0x2b')]=function(_0x49703b,_0x224d29){if(_0x49703b[_0x50c4('0x78')]['id']){delete _0x49703b[_0x50c4('0x78')]['id'];}return db[_0x50c4('0x3e')]['find']({'where':{'id':_0x49703b[_0x50c4('0xb4')]['id']}})[_0x50c4('0x2c')](handleEntityNotFound(_0x224d29,null))[_0x50c4('0x2c')](saveUpdates(_0x49703b[_0x50c4('0x78')],null))['then'](respondWithResult(_0x224d29,null))[_0x50c4('0xb2')](handleError(_0x224d29,null));};exports[_0x50c4('0x2d')]=function(_0x58b525,_0xcfb3c3){return db['OpenchannelInteraction'][_0x50c4('0x64')]({'where':{'id':_0x58b525[_0x50c4('0xb4')]['id']}})[_0x50c4('0x2c')](handleEntityNotFound(_0xcfb3c3,null))['then'](removeEntity(_0xcfb3c3,null))[_0x50c4('0xb2')](handleError(_0xcfb3c3,null));};exports['describe']=function(_0x791c66,_0x4e8eac){return db[_0x50c4('0x3e')][_0x50c4('0xbb')]()[_0x50c4('0x2c')](respondWithResult(_0x4e8eac,null))[_0x50c4('0xb2')](handleError(_0x4e8eac,null));};exports[_0x50c4('0xbc')]=function(_0xe71d89,_0x3864ee,_0x52963f){return db[_0x50c4('0xbd')][_0x50c4('0x64')]({'where':{'id':_0xe71d89[_0x50c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x3864ee,null))[_0x50c4('0x2c')](function(_0x1618bf){if(_0x1618bf){return _0x1618bf[_0x50c4('0xbc')](_0xe71d89[_0x50c4('0x78')][_0x50c4('0xbe')],_[_0x50c4('0xbf')](_0xe71d89[_0x50c4('0x78')],[_0x50c4('0xbe'),'id'])||{});}})[_0x50c4('0x2c')](respondWithResult(_0x3864ee,null))[_0x50c4('0xb2')](handleError(_0x3864ee,null));};exports[_0x50c4('0xc0')]=function(_0x2a81bf,_0x55326e,_0x4c3069){var _0x2de72c={'raw':![],'where':{}};var _0xfd903b={};var _0x23ef1e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x50c4('0xc1')]({'where':{'id':_0x2a81bf[_0x50c4('0xb4')]['id']}})[_0x50c4('0x2c')](handleEntityNotFound(_0x55326e,null))['then'](function(_0x11e028){if(_0x11e028){_0xfd903b[_0x50c4('0x40')]=_[_0x50c4('0x41')](db[_0x50c4('0xbd')][_0x50c4('0xb5')]);_0xfd903b['query']=_['keys'](_0x2a81bf[_0x50c4('0x42')]);_0xfd903b[_0x50c4('0x43')]=_['intersection'](_0xfd903b[_0x50c4('0x40')],_0xfd903b[_0x50c4('0x42')]);_0x2de72c['attributes']=_[_0x50c4('0x45')](_0xfd903b[_0x50c4('0x40')],qs[_0x50c4('0x46')](_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x46')]));_0x2de72c[_0x50c4('0x44')]=_0x2de72c[_0x50c4('0x44')][_0x50c4('0x63')]?_0x2de72c[_0x50c4('0x44')]:_0xfd903b['model'];if(!_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x47')]('nolimit')){_0x2de72c[_0x50c4('0x25')]=qs[_0x50c4('0x25')](_0x2a81bf[_0x50c4('0x42')]['limit']);_0x2de72c[_0x50c4('0x23')]=qs[_0x50c4('0x23')](_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x23')]);}_0x2de72c[_0x50c4('0x90')]=qs['sort'](_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x48')]);_0x2de72c[_0x50c4('0x49')]=qs[_0x50c4('0x43')](_['pick'](_0x2a81bf[_0x50c4('0x42')],_0xfd903b['filters']));_0x2de72c[_0x50c4('0x49')][_0x50c4('0xaf')]=_0x11e028['id'];if(_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x84')]){_0x2de72c[_0x50c4('0x49')]=_['merge'](_0x2de72c[_0x50c4('0x49')],{'$or':_[_0x50c4('0x32')](_0x2de72c[_0x50c4('0x44')],function(_0x53b209){var _0x6086a7={};_0x6086a7[_0x53b209]={'$like':'%'+_0x2a81bf[_0x50c4('0x42')]['filter']+'%'};return _0x6086a7;})});}if(_0x2a81bf['query'][_0x50c4('0x7e')]){var _0x5109a6=_0x2a81bf[_0x50c4('0x42')][_0x50c4('0x7e')][_0x50c4('0x34')](',');var _0x499ecb={};_0x499ecb[_0x5109a6[0x0]]={'$gte':moment(_0x5109a6[0x1])['format'](_0x50c4('0xc2'))};_0x2de72c['where']=_[_0x50c4('0xb8')](_0x2de72c[_0x50c4('0x49')],_0x499ecb);}_0x2de72c=_['merge']({},_0x2de72c,_0x2a81bf[_0x50c4('0xb9')]);return db[_0x50c4('0xbd')]['count']({'where':_0x2de72c[_0x50c4('0x49')]})[_0x50c4('0x2c')](function(_0x2ab33e){_0x23ef1e[_0x50c4('0x26')]=_0x2ab33e;if(_0x2a81bf['query'][_0x50c4('0xb6')]){_0x2de72c[_0x50c4('0xb7')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x50c4('0xc3')](_0x2de72c);})[_0x50c4('0x2c')](function(_0x50020f){_0x23ef1e[_0x50c4('0xb1')]=_0x50020f;return _0x23ef1e;});}})[_0x50c4('0x2c')](respondWithFilteredResult(_0x55326e,_0x2de72c))['catch'](handleError(_0x55326e,null));};exports[_0x50c4('0xc4')]=function(_0x4af3d0,_0xf2f3f3,_0x54b8a1){return db[_0x50c4('0x3e')]['find']({'where':{'id':_0x4af3d0[_0x50c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0xf2f3f3,null))[_0x50c4('0x2c')](function(_0x2277a1){if(_0x2277a1){return _0x2277a1[_0x50c4('0xc5')](_0x4af3d0[_0x50c4('0x78')][_0x50c4('0xbe')],_['omit'](_0x4af3d0[_0x50c4('0x78')],[_0x50c4('0xbe'),'id'])||{})[_0x50c4('0xc6')](function(){return db[_0x50c4('0x71')][_0x50c4('0xc3')]({'attributes':['id','name',_0x50c4('0x4b')],'where':{'id':_0x4af3d0[_0x50c4('0x78')]['ids']}});})[_0x50c4('0x2c')](function(_0x3e9414){socket[_0x50c4('0xc7')]('openchannelInteractionTags:save',{'id':Number(_0x4af3d0[_0x50c4('0xb4')]['id']),'tags':_0x3e9414||[]});return{'id':Number(_0x4af3d0[_0x50c4('0xb4')]['id']),'tags':_0x3e9414||[]};});}})['then'](respondWithResult(_0xf2f3f3,null))[_0x50c4('0xb2')](handleError(_0xf2f3f3,null));};exports['removeTags']=function(_0x55f9f9,_0x5f2af6,_0x5d7d7c){return db[_0x50c4('0x3e')]['find']({'where':{'id':_0x55f9f9[_0x50c4('0xb4')]['id']}})[_0x50c4('0x2c')](handleEntityNotFound(_0x5f2af6,null))[_0x50c4('0x2c')](function(_0x105245){if(_0x105245){return _0x105245['removeTags'](_0x55f9f9['query'][_0x50c4('0xbe')]);}})[_0x50c4('0x2c')](respondWithStatusCode(_0x5f2af6,null))[_0x50c4('0xb2')](handleError(_0x5f2af6,null));};exports[_0x50c4('0xc8')]=function(_0x3b3130,_0x1210ac){var _0x179d4b=moment()['unix']()[_0x50c4('0x9a')]();var _0x4a9ac5=path['join'](config['root'],_0x50c4('0xc9'),_0x50c4('0xca'),_0x50c4('0xcb'));var _0x3e3316=path[_0x50c4('0xcc')](config[_0x50c4('0xcd')],_0x50c4('0xc9'),_0x50c4('0xca'),_0x50c4('0xce'));var _0x2443c1=path[_0x50c4('0xcc')](_0x4a9ac5,_0x179d4b);var _0xd35923=util[_0x50c4('0xcf')](_0x50c4('0xd0'),_0x3b3130[_0x50c4('0xb4')]['id'],_0x179d4b);var _0x2c6ac4=path['join'](_0x4a9ac5,_0xd35923);var _0x4b57b2=[];_0x4b57b2[_0x50c4('0x36')]({'model':db[_0x50c4('0x75')],'as':_0x50c4('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x4b57b2[_0x50c4('0x36')]({'model':db[_0x50c4('0xd1')],'as':_0x50c4('0x69'),'attributes':['id',_0x50c4('0xd2'),_0x50c4('0xd3')],'raw':!![]});if(_0x3b3130[_0x50c4('0x42')]['attachments']){_0x4b57b2[_0x50c4('0x36')]({'model':db[_0x50c4('0xd4')],'as':_0x50c4('0xd4'),'raw':!![]});}var _0x53e4aa=[{'model':db['OpenchannelMessage'],'as':_0x50c4('0xd5'),'attributes':['id','body',_0x50c4('0x7c'),_0x50c4('0xd6'),_0x50c4('0xd7'),'read'],'include':_0x4b57b2}];_0x53e4aa['push']({'model':db[_0x50c4('0xd8')],'as':_0x50c4('0xd9'),'attributes':['id',_0x50c4('0x30')]});_0x53e4aa[_0x50c4('0x36')]({'model':db['User'],'as':_0x50c4('0xda'),'attributes':['id',_0x50c4('0xdb')]});return db[_0x50c4('0x3e')][_0x50c4('0x64')]({'where':{'id':_0x3b3130['params']['id']},'include':_0x53e4aa})[_0x50c4('0x2c')](handleEntityNotFound(_0x1210ac,null))[_0x50c4('0x2c')](function(_0x1c18a1){if(_0x1c18a1){var _0xba2f10=_0x1c18a1[_0x50c4('0xdc')]({'plain':!![]});fs[_0x50c4('0xdd')](_0x2443c1);var _0x472105={'channel':_0x50c4('0xde'),'account':_0xba2f10[_0x50c4('0xd9')][_0x50c4('0x30')],'agent':_0xba2f10[_0x50c4('0xda')]?_0xba2f10[_0x50c4('0xda')][_0x50c4('0xdb')]:_0x50c4('0xdf'),'createdAt':moment(_0xba2f10[_0x50c4('0x7c')])[_0x50c4('0xcf')](_0x50c4('0xc2'))[_0x50c4('0x9a')](),'closedAt':_0xba2f10[_0x50c4('0x3c')]?moment(_0xba2f10[_0x50c4('0xe0')])[_0x50c4('0xcf')](_0x50c4('0xc2'))[_0x50c4('0x9a')]():'','disposition':_0xba2f10[_0x50c4('0xe1')],'visibility':_0xba2f10[_0x50c4('0xe2')]?_0x50c4('0xe3'):_0x50c4('0xe4'),'messages':_(_0xba2f10[_0x50c4('0xd5')])[_0x50c4('0x84')]({'secret':![]})[_0x50c4('0x32')](function(_0x5601be){if(_0x5601be[_0x50c4('0xd4')]){var _0x45e68a=path['join'](_0x3e3316,_0x5601be[_0x50c4('0xd4')]['basename']);if(fs[_0x50c4('0xe5')](_0x45e68a)){fs[_0x50c4('0xe6')](_0x45e68a)['pipe'](fs[_0x50c4('0xe7')](path[_0x50c4('0xcc')](_0x2443c1,_0x5601be[_0x50c4('0xd4')]['basename'])));}}return{'date':moment(_0x5601be[_0x50c4('0x7c')])['format'](_0x50c4('0xc2'))['toString'](),'sender':_0x5601be[_0x50c4('0xd6')]===_0x50c4('0xe8')?_0x5601be[_0x50c4('0x75')]?_0x5601be[_0x50c4('0x75')][_0x50c4('0xdb')]:'System':_0x5601be[_0x50c4('0x69')]['firstName']+(_0x5601be[_0x50c4('0x69')]['lastName']?'\x20'+_0x5601be['Contact'][_0x50c4('0xd3')]:''),'body':_0x5601be['Attachment']?_0x5601be[_0x50c4('0xd4')][_0x50c4('0xe9')]:_0x5601be[_0x50c4('0x78')],'direction':_0x5601be[_0x50c4('0xd6')]===_0x50c4('0xe8')?'A':'C','secret':_0x5601be[_0x50c4('0xd7')],'read':_0x5601be['read'],'attachment':_0x5601be[_0x50c4('0xd4')]};})[_0x50c4('0x66')]()};return ejs[_0x50c4('0xea')](path['join'](config['root'],'server',_0x50c4('0xeb'),_0x50c4('0xec')),{'interaction':_0x472105})[_0x50c4('0x2c')](function(_0x3b7f35){var _0x49b298=path[_0x50c4('0xcc')](_0x2443c1,_0x50c4('0xed')+_0xba2f10['id']+'-'+_0x179d4b+_0x50c4('0xee'));var _0xd91957={'path':_0x49b298,'channel':'Openchannel','interactionId':_0xba2f10['id']};return pdf[_0x50c4('0xef')](_0x3b7f35,_0xd91957);})['then'](function(){return new BPromise(function(_0x4af05f,_0x5c2355){zipdir(_0x2443c1,{'saveTo':_0x2c6ac4},function(_0x1421d4,_0x4115b0){if(_0x1421d4)return _0x5c2355(_0x1421d4);return _0x4af05f(_0x4115b0);});})[_0x50c4('0x2c')](function(){return new BPromise(function(_0x1c19bb,_0x31c5e7){rimraf(_0x2443c1,function(_0x46578a){if(_0x46578a)_0x31c5e7(_0x46578a);return _0x1c19bb();});});})['then'](function(){return _0x1210ac[_0x50c4('0xc8')](_0x2c6ac4,_0xd35923,function(_0x248748){if(_0x248748){console[_0x50c4('0xf0')]('err',_0x248748);}else{fs[_0x50c4('0xf1')](_0x2c6ac4);}});});});}else{return _0x1210ac[_0x50c4('0x1f')](0xc8);}})[_0x50c4('0xb2')](handleError(_0x1210ac,null));}; \ No newline at end of file +var _0x5679=['renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','Users','map','fullname','TagIds','forEach','Tags','catch','waiting','unmanaged','total','closed','UserId','talking','answered','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','some','compact','isEmpty','OpenchannelAccountId','where','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','merge','options','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','join','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','Owner','get','mkdirSync','Account','threadId','basename','existsSync','pipe','createWriteStream','System','lastName','out'];(function(_0x45cf76,_0x5789fa){var _0x57d6ce=function(_0x21bbf5){while(--_0x21bbf5){_0x45cf76['push'](_0x45cf76['shift']());}};_0x57d6ce(++_0x5789fa);}(_0x5679,0x1eb));var _0x9567=function(_0x11b382,_0x517d49){_0x11b382=_0x11b382-0x0;var _0x12f989=_0x5679[_0x11b382];return _0x12f989;};'use strict';var emlformat=require(_0x9567('0x0'));var rimraf=require(_0x9567('0x1'));var zipdir=require(_0x9567('0x2'));var jsonpatch=require(_0x9567('0x3'));var rp=require(_0x9567('0x4'));var moment=require(_0x9567('0x5'));var BPromise=require(_0x9567('0x6'));var Mustache=require('mustache');var util=require(_0x9567('0x7'));var path=require(_0x9567('0x8'));var sox=require(_0x9567('0x9'));var csv=require('to-csv');var ejs=require(_0x9567('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9567('0xb'));var squel=require(_0x9567('0xc'));var crypto=require(_0x9567('0xd'));var jsforce=require(_0x9567('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9567('0xf'));var querystring=require('querystring');var Papa=require(_0x9567('0x10'));var Redis=require(_0x9567('0x11'));var authService=require(_0x9567('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9567('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x9567('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9567('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9567('0x16'));var db=require(_0x9567('0x17'))['db'];config[_0x9567('0x18')]=_[_0x9567('0x19')](config['redis'],{'host':_0x9567('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9567('0x18')]));require(_0x9567('0x1b'))[_0x9567('0x1c')](socket);function respondWithStatusCode(_0x17db04,_0x393f5d){_0x393f5d=_0x393f5d||0xcc;return function(_0x485be5){if(_0x485be5){return _0x17db04[_0x9567('0x1d')](_0x393f5d);}return _0x17db04[_0x9567('0x1e')](_0x393f5d)['end']();};}function respondWithResult(_0x2098c8,_0x414f4a){_0x414f4a=_0x414f4a||0xc8;return function(_0x51d9a9){if(_0x51d9a9){return _0x2098c8['status'](_0x414f4a)[_0x9567('0x1f')](_0x51d9a9);}};}function respondWithFilteredResult(_0x1c39a0,_0x27e18c){return function(_0x47a867){if(_0x47a867){var _0x43c0f8=typeof _0x27e18c[_0x9567('0x20')]===_0x9567('0x21')&&typeof _0x27e18c[_0x9567('0x22')]==='undefined';var _0x22e99d=_0x47a867[_0x9567('0x23')];var _0x4e875a=_0x43c0f8?0x0:_0x27e18c[_0x9567('0x20')];var _0x4466fd=_0x43c0f8?_0x47a867['count']:_0x27e18c[_0x9567('0x20')]+_0x27e18c[_0x9567('0x22')];var _0xe87541;if(_0x4466fd>=_0x22e99d){_0x4466fd=_0x22e99d;_0xe87541=0xc8;}else{_0xe87541=0xce;}_0x1c39a0['status'](_0xe87541);return _0x1c39a0[_0x9567('0x24')]('Content-Range',_0x4e875a+'-'+_0x4466fd+'/'+_0x22e99d)[_0x9567('0x1f')](_0x47a867);}return null;};}function patchUpdates(_0x11a45a){return function(_0x3824b0){try{jsonpatch[_0x9567('0x25')](_0x3824b0,_0x11a45a,!![]);}catch(_0xa5cfd3){return BPromise[_0x9567('0x26')](_0xa5cfd3);}return _0x3824b0[_0x9567('0x27')]();};}function saveUpdates(_0x361228,_0x784ede){return function(_0x1fe8a6){if(_0x1fe8a6){return _0x1fe8a6[_0x9567('0x28')](_0x361228)[_0x9567('0x29')](function(_0x2ce982){return _0x2ce982;});}return null;};}function removeEntity(_0x24b658,_0x126e67){return function(_0x50dc83){if(_0x50dc83){return _0x50dc83[_0x9567('0x2a')]()[_0x9567('0x29')](function(){_0x24b658[_0x9567('0x1e')](0xcc)[_0x9567('0x2b')]();});}};}function handleEntityNotFound(_0x7d2b14,_0x3b73ef){return function(_0x19ee92){if(!_0x19ee92){_0x7d2b14['sendStatus'](0x194);}return _0x19ee92;};}function handleError(_0x24f6e9,_0x4a7f05){_0x4a7f05=_0x4a7f05||0x1f4;return function(_0x2040cd){logger[_0x9567('0x2c')](_0x2040cd[_0x9567('0x2d')]);if(_0x2040cd[_0x9567('0x2e')]){delete _0x2040cd[_0x9567('0x2e')];}_0x24f6e9[_0x9567('0x1e')](_0x4a7f05)['send'](_0x2040cd);};}function getInteractionUsers(_0x2e3363,_0x1a1725){return new BPromise(function(_0x5bb90f,_0x5b178b){try{if(_0x1a1725[_0x2e3363['id']]){_0x2e3363[_0x9567('0x2f')]=_[_0x9567('0x30')](_0x1a1725[_0x2e3363['id']],function(_0x226a0f){return{'id':_0x226a0f['id'],'fullname':_0x226a0f[_0x9567('0x31')]};});}}catch(_0x58001b){_0x5b178b(_0x58001b);}_0x5bb90f(_0x2e3363);});}function getInteractionTags(_0x2ad68f,_0xa19e74){return new BPromise(function(_0x2ec67e,_0x5e231f){try{if(_0x2ad68f[_0x9567('0x32')]){_0x2ad68f['Tags']=[];_0x2ad68f['TagIds']['split'](',')[_0x9567('0x33')](function(_0x11c116){_0x2ad68f[_0x9567('0x34')]['push'](_0xa19e74[_0x11c116]);});}delete _0x2ad68f['TagIds'];}catch(_0x19c54f){_0x5e231f(_0x19c54f);}_0x2ec67e(_0x2ad68f);});}function updateOpenchannelInteraction(_0x2b5c3b,_0x317893,_0x3b30fb){return new BPromise(function(_0x522761,_0x54c67a){return getInteractionUsers(_0x2b5c3b,_0x3b30fb)[_0x9567('0x29')](function(_0x59e825){return getInteractionTags(_0x59e825,_0x317893);})[_0x9567('0x29')](function(_0x3a4548){return getStateInteraction(_0x3a4548);})['then'](function(_0x492879){_0x522761(_0x492879);})[_0x9567('0x35')](function(_0x3a327c){_0x54c67a(_0x3a327c);});});}function getStateInteraction(_0x31034c){return new BPromise(function(_0x19a9e4){_0x31034c[_0x9567('0x36')]=0x0;_0x31034c['talking']=0x0;_0x31034c['answered']=0x0;_0x31034c[_0x9567('0x37')]=0x0;_0x31034c[_0x9567('0x38')]=0x0;if(!_0x31034c[_0x9567('0x39')]&&!_0x31034c[_0x9567('0x3a')]){_0x31034c[_0x9567('0x36')]+=0x1;}if(!_0x31034c[_0x9567('0x39')]&&_0x31034c[_0x9567('0x3a')]){_0x31034c[_0x9567('0x3b')]+=0x1;if(_0x31034c[_0x9567('0x36')]){_0x31034c[_0x9567('0x36')]-=0x1;}}if(_0x31034c[_0x9567('0x39')]&&_0x31034c[_0x9567('0x3a')]){_0x31034c[_0x9567('0x3c')]+=0x1;if(_0x31034c[_0x9567('0x3b')]){_0x31034c[_0x9567('0x3b')]-=0x1;}}if(_0x31034c['closed']&&!_0x31034c[_0x9567('0x3a')]){_0x31034c[_0x9567('0x37')]+=0x1;if(_0x31034c[_0x9567('0x36')]){_0x31034c['waiting']-=0x1;}}_0x31034c[_0x9567('0x38')]+=0x1;_0x19a9e4(_0x31034c);});}exports[_0x9567('0x3d')]=function(_0x56455d,_0x78732){var _0x28aed6={},_0x48ebc4={},_0xd37e2e={'count':0x0,'rows':[]};var _0x5c8fb5=_[_0x9567('0x30')](db[_0x9567('0x3e')][_0x9567('0x3f')],function(_0x54020e){return{'name':_0x54020e[_0x9567('0x40')],'type':_0x54020e['type'][_0x9567('0x41')]};});_0x48ebc4[_0x9567('0x42')]=_[_0x9567('0x30')](_0x5c8fb5,'name');_0x48ebc4['query']=_[_0x9567('0x43')](_0x56455d[_0x9567('0x44')]);_0x48ebc4[_0x9567('0x45')]=_[_0x9567('0x46')](_0x48ebc4[_0x9567('0x42')],_0x48ebc4['query']);_0x28aed6[_0x9567('0x47')]=_[_0x9567('0x46')](_0x48ebc4[_0x9567('0x42')],qs[_0x9567('0x48')](_0x56455d[_0x9567('0x44')][_0x9567('0x48')]));_0x28aed6[_0x9567('0x47')]=_0x28aed6[_0x9567('0x47')]['length']?_0x28aed6[_0x9567('0x47')]:_0x48ebc4[_0x9567('0x42')];if(!_0x56455d[_0x9567('0x44')][_0x9567('0x49')](_0x9567('0x4a'))){_0x28aed6[_0x9567('0x22')]=qs[_0x9567('0x22')](_0x56455d[_0x9567('0x44')][_0x9567('0x22')]);_0x28aed6[_0x9567('0x20')]=qs[_0x9567('0x20')](_0x56455d[_0x9567('0x44')][_0x9567('0x20')]);}_0x28aed6[_0x9567('0x4b')]=qs[_0x9567('0x4c')](_0x56455d[_0x9567('0x44')][_0x9567('0x4c')]);_0x28aed6['where']=qs['filters'](_['pick'](_0x56455d[_0x9567('0x44')],_0x48ebc4[_0x9567('0x45')]),_0x5c8fb5);var _0x21b645=[];var _0x8ff89c=squel[_0x9567('0x4d')]()[_0x9567('0x4e')]('id')[_0x9567('0x4e')]('name')['field'](_0x9567('0x4f'))[_0x9567('0x50')](_0x9567('0x51'));var _0x794038=squel[_0x9567('0x4d')]()[_0x9567('0x4e')]('u.id')[_0x9567('0x4e')]('u.fullname')['field'](_0x9567('0x52'))['from']('user_has_openchannel_interactions','ui')[_0x9567('0x53')](_0x9567('0x54'),'u',_0x9567('0x55'));var _0x124489=squel[_0x9567('0x4d')]()[_0x9567('0x50')](_0x9567('0x56'),'i')[_0x9567('0x53')](_0x9567('0x57'),'c',_0x9567('0x58'))[_0x9567('0x53')]('users','o',_0x9567('0x59'))['left_join'](_0x9567('0x5a'),'a',_0x9567('0x5b'))[_0x9567('0x53')]('openchannel_messages','me',_0x9567('0x5c'))[_0x9567('0x53')]('openchannel_interaction_has_tags','it',_0x9567('0x5d'))[_0x9567('0x53')](_0x9567('0x51'),'t','t.id\x20=\x20it.TagId');var _0x11f294=squel[_0x9567('0x5e')]();var _0x41eebd=[];var _0x48127f=squel[_0x9567('0x5e')]();var _0x2991b3;if(_0x56455d[_0x9567('0x44')][_0x9567('0x5f')]){_0x2991b3=as[_0x9567('0x60')](_0x56455d[_0x9567('0x44')]['search']);var _0x33fe9b=_0x2991b3['sqlOperator'];for(var _0x5754a0=0x0;_0x5754a0<_0x2991b3[_0x9567('0x61')][_0x9567('0x62')];_0x5754a0++){var _0x571bf0=_0x2991b3[_0x9567('0x61')][_0x5754a0];var _0x44f6b8='i';var _0x5ad628=_[_0x9567('0x63')](_0x5c8fb5,[_0x9567('0x2e'),_0x571bf0[_0x9567('0x4e')]]);if(!_0x5ad628){switch(_0x571bf0[_0x9567('0x4e')]){case'unreadMessages':if(_0x571bf0['value']==0x1){_0x124489[_0x9567('0x64')]('`'+_0x571bf0[_0x9567('0x4e')]+_0x9567('0x65'));}else{_0x124489[_0x9567('0x64')]('`'+_0x571bf0['field']+_0x9567('0x66'));}break;case _0x9567('0x67'):if(_0x571bf0[_0x9567('0x68')]===_0x9567('0x69')){if(_0x571bf0[_0x9567('0x6a')][_0x9567('0x6b')]('\x20')['length']>0x1){_0x11f294[_0x33fe9b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x571bf0['value']),null);}else{var _0x4542d3='%'+_0x571bf0['value']+'%';_0x11f294[_0x33fe9b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4542d3,_0x4542d3,_0x4542d3);}}else{_0x5ad628=_[_0x9567('0x63')](_0x5c8fb5,['name',_0x9567('0x6c')]);_0x571bf0[_0x9567('0x4e')]=_0x9567('0x6c');_0x51e302=as[_0x9567('0x6d')](_0x44f6b8,_0x5ad628['type'],_0x571bf0);_0x11f294[_0x33fe9b](_0x51e302[_0x9567('0x6e')],_0x51e302[_0x9567('0x6a')][_0x9567('0x6f')],_0x51e302['value'][_0x9567('0x2b')]);}break;case _0x9567('0x70'):var _0x2d709c=_0x571bf0['value'][_0x9567('0x6b')](',')[_0x9567('0x30')](function(_0x4bbef4){return Number(_0x4bbef4);});_0x2d709c[_0x9567('0x33')](function(_0x4f93b9){_0x48127f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f93b9+',%');});_0x41eebd=_[_0x9567('0x71')](_0x41eebd,_0x2d709c);break;case'User':if(_0x571bf0[_0x9567('0x68')]===_0x9567('0x69')){_0x11f294[_0x33fe9b](_0x9567('0x72'),'%'+_0x571bf0[_0x9567('0x6a')]+'%',null);}else{_0x5ad628=_[_0x9567('0x63')](_0x5c8fb5,[_0x9567('0x2e'),'UserId']);_0x571bf0[_0x9567('0x4e')]=_0x9567('0x3a');_0x51e302=as[_0x9567('0x6d')](_0x44f6b8,_0x5ad628[_0x9567('0x73')],_0x571bf0);_0x11f294[_0x33fe9b](_0x51e302[_0x9567('0x6e')],_0x51e302[_0x9567('0x6a')][_0x9567('0x6f')],_0x51e302['value'][_0x9567('0x2b')]);}break;case'body':_0x51e302=as['buildExpression']('me',null,_0x571bf0);_0x11f294[_0x33fe9b](_0x51e302['text'],_0x51e302['value']['start'],_0x51e302[_0x9567('0x6a')][_0x9567('0x2b')]);break;}}else{var _0x51e302=as['buildExpression'](_0x44f6b8,_0x5ad628[_0x9567('0x73')],_0x571bf0);_0x11f294[_0x33fe9b](_0x51e302[_0x9567('0x6e')],_0x51e302['value'][_0x9567('0x6f')],_0x51e302[_0x9567('0x6a')]['end']);}}}else{var _0x11eb66=_(_0x56455d[_0x9567('0x44')])['keys']()[_0x9567('0x30')](function(_0x344bc6){return _[_0x9567('0x74')](_0x5c8fb5,[_0x9567('0x2e'),_0x344bc6])?_0x344bc6:undefined;})[_0x9567('0x75')]()[_0x9567('0x6a')]();if(!_[_0x9567('0x76')](_0x11eb66)){_0x11eb66['forEach'](function(_0x2864e4){if(_0x2864e4===_0x9567('0x77')){_0x124489[_0x9567('0x78')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x9567('0x79')](_0x56455d[_0x9567('0x44')][_0x2864e4]));}else if(_0x2864e4==='createdAt'){var _0x2ba702=JSON[_0x9567('0x7a')](_0x56455d[_0x9567('0x44')][_0x2864e4])[_0x9567('0x7b')];var _0x19bab3=JSON[_0x9567('0x7a')](_0x56455d[_0x9567('0x44')][_0x2864e4])[_0x9567('0x7c')];_0x124489[_0x9567('0x78')](_0x9567('0x7d'),_0x2ba702,_0x19bab3);}else{if(_0x56455d[_0x9567('0x44')][_0x2864e4]===_0x9567('0x7e')){_0x124489[_0x9567('0x78')]('i.'+_0x2864e4+_0x9567('0x7f'));}else{_0x124489[_0x9567('0x78')]('i.'+_0x2864e4+_0x9567('0x80'),_0x56455d[_0x9567('0x44')][_0x2864e4]);}}});}if(_0x56455d[_0x9567('0x44')][_0x9567('0x81')]){if(_0x56455d[_0x9567('0x44')]['read']==0x1){_0x124489[_0x9567('0x64')](_0x9567('0x82'));}else{_0x124489[_0x9567('0x64')](_0x9567('0x83'));}}if(_0x56455d['query'][_0x9567('0x84')]){_0x41eebd=_[_0x9567('0x85')](_0x56455d['query']['tag'])?_0x56455d['query'][_0x9567('0x84')]:new Array(_0x56455d['query'][_0x9567('0x84')]);_0x41eebd[_0x9567('0x33')](function(_0x3ac9cf){_0x48127f['or'](_0x9567('0x86'),'%,'+_0x3ac9cf+',%');});}if(_0x56455d['query'][_0x9567('0x87')]){var _0x56d085=_0x56455d[_0x9567('0x44')][_0x9567('0x87')][_0x9567('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9567('0x89')](_0x56d085)){_0x11f294['or'](_0x9567('0x8a'),_0x56d085+'%');}else{_0x11f294['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9567('0x8b')](_0x56d085))['or'](_0x9567('0x8c'),_0x56d085+'%')['or'](_0x9567('0x8d'),_0x56d085+'%');}}}_0x124489[_0x9567('0x78')](_0x11f294);_0x124489[_0x9567('0x8e')](_0x9567('0x8f'));var _0xf834df={'type':db['Sequelize'][_0x9567('0x90')]['SELECT'],'raw':!![]};var _0x568e4a=_0x124489[_0x9567('0x91')]();_0x568e4a[_0x9567('0x4e')]('i.id');_0x568e4a[_0x9567('0x4e')](_0x9567('0x92'),_0x9567('0x93'));if(_0x28aed6[_0x9567('0x4b')]){_0x28aed6[_0x9567('0x4b')][_0x9567('0x33')](function(_0x311d60){var _0x12bac8=_0x311d60[0x0]==='contactName'?_0x311d60[0x0]:'i.'+_0x311d60[0x0];_0x124489[_0x9567('0x4b')](_0x12bac8,_0x311d60[0x1]===_0x9567('0x94')?![]:!![]);});}if(!_[_0x9567('0x76')](_0x41eebd)){_0x124489[_0x9567('0x64')](_0x48127f);_0x568e4a[_0x9567('0x78')](_0x9567('0x95'),_0x41eebd);}BPromise['resolve']()['then'](function(){if(!_0x2991b3){if(_0x56455d[_0x9567('0x44')][_0x9567('0x77')])return;_0x568e4a[_0x9567('0x78')](_0x9567('0x96'));_0x124489['where'](_0x9567('0x96'));return;}if(_0x56455d[_0x9567('0x97')][_0x9567('0x98')]!==_0x9567('0x99'))return;return _0x56455d[_0x9567('0x97')][_0x9567('0x9a')]({'attributes':['id'],'raw':!![]})[_0x9567('0x29')](function(_0x514c0c){if(_[_0x9567('0x76')](_0x514c0c)){_0x568e4a['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x124489[_0x9567('0x78')](_0x9567('0x9b'));}else{_0x568e4a[_0x9567('0x78')](_0x9567('0x9c'),_[_0x9567('0x30')](_0x514c0c,'id'));_0x124489[_0x9567('0x78')](_0x9567('0x9c'),_[_0x9567('0x30')](_0x514c0c,'id'));}});})['then'](function(){if(_0x56455d[_0x9567('0x97')][_0x9567('0x98')]==='agent'&&!_0x2991b3&&!_0x56455d['query']['OpenchannelAccountId'])return[];return db[_0x9567('0x9d')]['query'](_0x568e4a['toString'](),_0xf834df);})['then'](function(_0x747d6){_0xd37e2e[_0x9567('0x23')]=_0x747d6['length'];if(_0xd37e2e[_0x9567('0x23')]===0x0)return[];return db[_0x9567('0x9d')][_0x9567('0x44')](_0x8ff89c['toString'](),_0xf834df)['then'](function(_0x21c78e){_0x21b645=_['keyBy'](_0x21c78e,'id');_0xf834df=_['merge'](_0xf834df,{'model':db[_0x9567('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56455d['query'][_0x9567('0x48')]){_0x28aed6[_0x9567('0x47')][_0x9567('0x33')](function(_0x1e2f80){_0x124489['field']('i.'+_0x1e2f80);});}else{_0x124489['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x124489[_0x9567('0x4e')](_0x9567('0x9e'),_0x9567('0x9f'));_0x124489[_0x9567('0x4e')]('a.mandatoryDisposition',_0x9567('0xa0'));_0x124489[_0x9567('0x4e')](_0x9567('0xa1'),'contactName');_0x124489[_0x9567('0x4e')](_0x9567('0xa2'));_0x124489[_0x9567('0x4e')]('c.firstName',_0x9567('0xa3'));_0x124489[_0x9567('0x4e')](_0x9567('0xa4'),_0x9567('0xa5'));_0x124489[_0x9567('0x4e')](_0x9567('0xa6'),_0x9567('0xa7'));_0x124489['field'](_0x9567('0xa8'),'Contact.phone');_0x124489[_0x9567('0x4e')]('c.mobile',_0x9567('0xa9'));_0x124489[_0x9567('0x4e')](_0x9567('0xaa'),_0x9567('0xab'));_0x124489[_0x9567('0x4e')](_0x9567('0xac'),'Owner.fullname');_0x124489[_0x9567('0x4e')](_0x9567('0xad'),_0x9567('0xae'));_0x124489[_0x9567('0x4e')](_0x9567('0xaf'),_0x9567('0x32'));}if(_0x28aed6['limit'])_0x124489[_0x9567('0x22')](_0x28aed6[_0x9567('0x22')]);if(_0x28aed6[_0x9567('0x20')])_0x124489[_0x9567('0x20')](_0x28aed6[_0x9567('0x20')]);return db['sequelize'][_0x9567('0x44')](_0x124489[_0x9567('0xb0')](),_0xf834df);})[_0x9567('0x29')](function(_0x51d02e){if(_0x51d02e[_0x9567('0x62')]>0x0)_0x794038[_0x9567('0x78')](_0x9567('0xb1'),_['map'](_0x51d02e,'id'));return db['sequelize'][_0x9567('0x44')](_0x794038[_0x9567('0xb0')](),_0xf834df)['then'](function(_0x23c7f0){var _0xa4f57=_[_0x9567('0xb2')](_0x23c7f0,_0x9567('0xb3'));var _0x160889=[];_0x51d02e[_0x9567('0x33')](function(_0x302031){_0x160889['push'](updateOpenchannelInteraction(_0x302031,_0x21b645,_0xa4f57));});return BPromise[_0x9567('0xb4')](_0x160889);});});})['then'](function(_0x2d32ba){_0xd37e2e[_0x9567('0xb5')]=_0x2d32ba;return _0xd37e2e;})[_0x9567('0x29')](respondWithFilteredResult(_0x78732,_0x28aed6))[_0x9567('0x35')](handleError(_0x78732,null));};exports[_0x9567('0xb6')]=function(_0x9be454,_0x12c163){var _0x4f8f08={};if(_0x9be454[_0x9567('0x44')]['type']&&_0x9be454[_0x9567('0x44')]['type']===_0x9567('0x50')){_0x4f8f08['from']=_0x9be454[_0x9567('0xb7')]['id'];}else{_0x4f8f08['id']=_0x9be454['params']['id'];}var _0x1856e1={'raw':![],'where':_0x4f8f08},_0x14223e={};_0x14223e[_0x9567('0x42')]=_[_0x9567('0x43')](db[_0x9567('0x3e')][_0x9567('0x3f')]);_0x14223e[_0x9567('0x44')]=_['keys'](_0x9be454['query']);_0x14223e[_0x9567('0x45')]=_[_0x9567('0x46')](_0x14223e[_0x9567('0x42')],_0x14223e[_0x9567('0x44')]);_0x1856e1[_0x9567('0x47')]=_[_0x9567('0x46')](_0x14223e[_0x9567('0x42')],qs['fields'](_0x9be454[_0x9567('0x44')]['fields']));_0x1856e1['attributes']=_0x1856e1[_0x9567('0x47')][_0x9567('0x62')]?_0x1856e1[_0x9567('0x47')]:_0x14223e['model'];if(_0x9be454[_0x9567('0x44')]['includeAll']){_0x1856e1[_0x9567('0xb8')]=[{'all':!![]}];}_0x1856e1=_[_0x9567('0xb9')]({},_0x1856e1,_0x9be454[_0x9567('0xba')]);return db[_0x9567('0x3e')]['find'](_0x1856e1)[_0x9567('0x29')](handleEntityNotFound(_0x12c163,null))['then'](respondWithResult(_0x12c163,null))['catch'](handleError(_0x12c163,null));};exports['create']=function(_0x28bd16,_0x58b31b){return db[_0x9567('0x3e')]['create'](_0x28bd16['body'],{})[_0x9567('0x29')](respondWithResult(_0x58b31b,0xc9))[_0x9567('0x35')](handleError(_0x58b31b,null));};exports[_0x9567('0x28')]=function(_0x543d2e,_0x2b1ebc){if(_0x543d2e['body']['id']){delete _0x543d2e[_0x9567('0xbb')]['id'];}return db[_0x9567('0x3e')][_0x9567('0x63')]({'where':{'id':_0x543d2e[_0x9567('0xb7')]['id']}})['then'](handleEntityNotFound(_0x2b1ebc,null))[_0x9567('0x29')](saveUpdates(_0x543d2e[_0x9567('0xbb')],null))['then'](respondWithResult(_0x2b1ebc,null))[_0x9567('0x35')](handleError(_0x2b1ebc,null));};exports['destroy']=function(_0x5733ca,_0xd215a9){return db[_0x9567('0x3e')]['find']({'where':{'id':_0x5733ca[_0x9567('0xb7')]['id']}})[_0x9567('0x29')](handleEntityNotFound(_0xd215a9,null))[_0x9567('0x29')](removeEntity(_0xd215a9,null))[_0x9567('0x35')](handleError(_0xd215a9,null));};exports[_0x9567('0xbc')]=function(_0x538a1d,_0x47d4f5){return db[_0x9567('0x3e')]['describe']()['then'](respondWithResult(_0x47d4f5,null))['catch'](handleError(_0x47d4f5,null));};exports['addMessage']=function(_0x4767b9,_0xe16cc3,_0x1db046){return db[_0x9567('0xbd')][_0x9567('0x63')]({'where':{'id':_0x4767b9[_0x9567('0xb7')]['id']}})[_0x9567('0x29')](handleEntityNotFound(_0xe16cc3,null))[_0x9567('0x29')](function(_0x256175){if(_0x256175){return _0x256175[_0x9567('0xbe')](_0x4767b9[_0x9567('0xbb')][_0x9567('0xbf')],_[_0x9567('0xc0')](_0x4767b9[_0x9567('0xbb')],['ids','id'])||{});}})[_0x9567('0x29')](respondWithResult(_0xe16cc3,null))[_0x9567('0x35')](handleError(_0xe16cc3,null));};exports[_0x9567('0xc1')]=function(_0x4a88ba,_0xaecac2,_0x267b2c){var _0x440d7a={'raw':![],'where':{}};var _0xb17fc3={};var _0x49aa2a={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x9567('0xc2')]({'where':{'id':_0x4a88ba[_0x9567('0xb7')]['id']}})[_0x9567('0x29')](handleEntityNotFound(_0xaecac2,null))[_0x9567('0x29')](function(_0x516b60){if(_0x516b60){_0xb17fc3['model']=_[_0x9567('0x43')](db[_0x9567('0xbd')]['rawAttributes']);_0xb17fc3[_0x9567('0x44')]=_[_0x9567('0x43')](_0x4a88ba[_0x9567('0x44')]);_0xb17fc3[_0x9567('0x45')]=_['intersection'](_0xb17fc3[_0x9567('0x42')],_0xb17fc3[_0x9567('0x44')]);_0x440d7a[_0x9567('0x47')]=_[_0x9567('0x46')](_0xb17fc3['model'],qs[_0x9567('0x48')](_0x4a88ba['query'][_0x9567('0x48')]));_0x440d7a[_0x9567('0x47')]=_0x440d7a[_0x9567('0x47')][_0x9567('0x62')]?_0x440d7a[_0x9567('0x47')]:_0xb17fc3[_0x9567('0x42')];if(!_0x4a88ba[_0x9567('0x44')][_0x9567('0x49')]('nolimit')){_0x440d7a['limit']=qs[_0x9567('0x22')](_0x4a88ba[_0x9567('0x44')]['limit']);_0x440d7a[_0x9567('0x20')]=qs[_0x9567('0x20')](_0x4a88ba[_0x9567('0x44')][_0x9567('0x20')]);}_0x440d7a[_0x9567('0x4b')]=qs[_0x9567('0x4c')](_0x4a88ba[_0x9567('0x44')][_0x9567('0x4c')]);_0x440d7a[_0x9567('0x78')]=qs['filters'](_['pick'](_0x4a88ba[_0x9567('0x44')],_0xb17fc3[_0x9567('0x45')]));_0x440d7a[_0x9567('0x78')][_0x9567('0xb3')]=_0x516b60['id'];if(_0x4a88ba[_0x9567('0x44')]['filter']){_0x440d7a['where']=_[_0x9567('0xb9')](_0x440d7a[_0x9567('0x78')],{'$or':_['map'](_0x440d7a[_0x9567('0x47')],function(_0x566c7e){var _0x230e2f={};_0x230e2f[_0x566c7e]={'$like':'%'+_0x4a88ba[_0x9567('0x44')][_0x9567('0x87')]+'%'};return _0x230e2f;})});}if(_0x4a88ba[_0x9567('0x44')]['$gte']){var _0x297e21=_0x4a88ba[_0x9567('0x44')][_0x9567('0x7b')][_0x9567('0x6b')](',');var _0x2e6874={};_0x2e6874[_0x297e21[0x0]]={'$gte':moment(_0x297e21[0x1])[_0x9567('0xc3')](_0x9567('0xc4'))};_0x440d7a[_0x9567('0x78')]=_[_0x9567('0xb9')](_0x440d7a[_0x9567('0x78')],_0x2e6874);}_0x440d7a=_['merge']({},_0x440d7a,_0x4a88ba[_0x9567('0xba')]);return db[_0x9567('0xbd')][_0x9567('0x23')]({'where':_0x440d7a['where']})['then'](function(_0x4e322b){_0x49aa2a[_0x9567('0x23')]=_0x4e322b;if(_0x4a88ba[_0x9567('0x44')][_0x9567('0xc5')]){_0x440d7a[_0x9567('0xb8')]=[{'all':!![]}];}return db[_0x9567('0xbd')][_0x9567('0xc6')](_0x440d7a);})[_0x9567('0x29')](function(_0x944d51){_0x49aa2a[_0x9567('0xb5')]=_0x944d51;return _0x49aa2a;});}})[_0x9567('0x29')](respondWithFilteredResult(_0xaecac2,_0x440d7a))['catch'](handleError(_0xaecac2,null));};exports['addTags']=function(_0x344a06,_0x3489a7,_0x51b6ac){return db['OpenchannelInteraction'][_0x9567('0x63')]({'where':{'id':_0x344a06[_0x9567('0xb7')]['id']}})[_0x9567('0x29')](handleEntityNotFound(_0x3489a7,null))[_0x9567('0x29')](function(_0x16e9ae){if(_0x16e9ae){return _0x16e9ae[_0x9567('0xc7')](_0x344a06[_0x9567('0xbb')][_0x9567('0xbf')],_[_0x9567('0xc0')](_0x344a06[_0x9567('0xbb')],['ids','id'])||{})[_0x9567('0xc8')](function(){return db[_0x9567('0x70')]['findAll']({'attributes':['id',_0x9567('0x2e'),_0x9567('0x4f')],'where':{'id':_0x344a06[_0x9567('0xbb')][_0x9567('0xbf')]}});})[_0x9567('0x29')](function(_0x269e19){socket[_0x9567('0xc9')](_0x9567('0xca'),{'id':Number(_0x344a06['params']['id']),'tags':_0x269e19||[]});return{'id':Number(_0x344a06[_0x9567('0xb7')]['id']),'tags':_0x269e19||[]};});}})[_0x9567('0x29')](respondWithResult(_0x3489a7,null))[_0x9567('0x35')](handleError(_0x3489a7,null));};exports[_0x9567('0xcb')]=function(_0x179845,_0x3c029c,_0x2e3020){return db[_0x9567('0x3e')]['find']({'where':{'id':_0x179845[_0x9567('0xb7')]['id']}})[_0x9567('0x29')](handleEntityNotFound(_0x3c029c,null))[_0x9567('0x29')](function(_0xbc0801){if(_0xbc0801){return _0xbc0801[_0x9567('0xcb')](_0x179845[_0x9567('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x3c029c,null))['catch'](handleError(_0x3c029c,null));};exports[_0x9567('0xcc')]=function(_0x3e8d60,_0x380794){var _0xb9cef2=moment()['unix']()['toString']();var _0x1f0730=path[_0x9567('0xcd')](config['root'],'server',_0x9567('0xce'),_0x9567('0xcf'));var _0x4adac8=path[_0x9567('0xcd')](config['root'],_0x9567('0xd0'),_0x9567('0xce'),_0x9567('0xd1'));var _0x5f1554=path[_0x9567('0xcd')](_0x1f0730,_0xb9cef2);var _0x19c47b=util[_0x9567('0xc3')](_0x9567('0xd2'),_0x3e8d60[_0x9567('0xb7')]['id'],_0xb9cef2);var _0xb469b8=path[_0x9567('0xcd')](_0x1f0730,_0x19c47b);var _0xb0d5ee=[];_0xb0d5ee[_0x9567('0xd3')]({'model':db['User'],'as':_0x9567('0xd4'),'attributes':['id','fullname'],'raw':!![]});_0xb0d5ee['push']({'model':db[_0x9567('0xd5')],'as':_0x9567('0x67'),'attributes':['id',_0x9567('0xd6'),'lastName'],'raw':!![]});if(_0x3e8d60['query'][_0x9567('0xd1')]){_0xb0d5ee['push']({'model':db[_0x9567('0xd7')],'as':_0x9567('0xd7'),'raw':!![]});}var _0x59728d=[{'model':db[_0x9567('0xbd')],'as':_0x9567('0xd8'),'attributes':['id',_0x9567('0xbb'),_0x9567('0xd9'),_0x9567('0xda'),_0x9567('0xdb'),'read'],'include':_0xb0d5ee}];_0x59728d[_0x9567('0xd3')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x59728d[_0x9567('0xd3')]({'model':db[_0x9567('0xd4')],'as':_0x9567('0xdc'),'attributes':['id','fullname']});return db[_0x9567('0x3e')][_0x9567('0x63')]({'where':{'id':_0x3e8d60[_0x9567('0xb7')]['id']},'include':_0x59728d})['then'](handleEntityNotFound(_0x380794,null))[_0x9567('0x29')](function(_0x32730e){if(_0x32730e){var _0x24da44=_0x32730e[_0x9567('0xdd')]({'plain':!![]});fs[_0x9567('0xde')](_0x5f1554);var _0x3fe89c={'channel':'Openchannel','account':_0x24da44[_0x9567('0xdf')][_0x9567('0x2e')],'agent':_0x24da44[_0x9567('0xdc')]?_0x24da44['Owner'][_0x9567('0x31')]:'N.A.','createdAt':moment(_0x24da44[_0x9567('0xd9')])[_0x9567('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9567('0xb0')](),'closedAt':_0x24da44[_0x9567('0x39')]?moment(_0x24da44['closedAt'])[_0x9567('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9567('0xb0')]():'','disposition':_0x24da44['disposition'],'visibility':_0x24da44[_0x9567('0xe0')]?'Public':'Private','messages':_(_0x24da44['Messages'])['filter']({'secret':![]})['map'](function(_0x59c45c){if(_0x59c45c['Attachment']){var _0x49e7bc=path[_0x9567('0xcd')](_0x4adac8,_0x59c45c[_0x9567('0xd7')][_0x9567('0xe1')]);if(fs[_0x9567('0xe2')](_0x49e7bc)){fs['createReadStream'](_0x49e7bc)[_0x9567('0xe3')](fs[_0x9567('0xe4')](path[_0x9567('0xcd')](_0x5f1554,_0x59c45c[_0x9567('0xd7')]['basename'])));}}return{'date':moment(_0x59c45c['createdAt'])[_0x9567('0xc3')](_0x9567('0xc4'))[_0x9567('0xb0')](),'sender':_0x59c45c[_0x9567('0xda')]==='out'?_0x59c45c[_0x9567('0xd4')]?_0x59c45c[_0x9567('0xd4')][_0x9567('0x31')]:_0x9567('0xe5'):_0x59c45c[_0x9567('0x67')][_0x9567('0xd6')]+(_0x59c45c[_0x9567('0x67')][_0x9567('0xe6')]?'\x20'+_0x59c45c[_0x9567('0x67')]['lastName']:''),'body':_0x59c45c[_0x9567('0xd7')]?_0x59c45c[_0x9567('0xd7')][_0x9567('0xe1')]:_0x59c45c['body'],'direction':_0x59c45c[_0x9567('0xda')]===_0x9567('0xe7')?'A':'C','secret':_0x59c45c['secret'],'read':_0x59c45c[_0x9567('0x81')],'attachment':_0x59c45c['Attachment']};})['value']()};return ejs[_0x9567('0xe8')](path['join'](config[_0x9567('0xe9')],_0x9567('0xd0'),_0x9567('0xea'),_0x9567('0xeb')),{'interaction':_0x3fe89c})[_0x9567('0x29')](function(_0x38d64a){var _0x433298=path['join'](_0x5f1554,_0x9567('0xec')+_0x24da44['id']+'-'+_0xb9cef2+_0x9567('0xed'));var _0x49834b={'path':_0x433298,'channel':_0x9567('0xee'),'interactionId':_0x24da44['id']};return pdf['createPdfFromHTML'](_0x38d64a,_0x49834b);})['then'](function(){return new BPromise(function(_0x541cc9,_0x5517d3){zipdir(_0x5f1554,{'saveTo':_0xb469b8},function(_0x2b4790,_0x2d7f3d){if(_0x2b4790)return _0x5517d3(_0x2b4790);return _0x541cc9(_0x2d7f3d);});})[_0x9567('0x29')](function(){return new BPromise(function(_0x34665b,_0x2b2a76){rimraf(_0x5f1554,function(_0x2d0aab){if(_0x2d0aab)_0x2b2a76(_0x2d0aab);return _0x34665b();});});})['then'](function(){return _0x380794[_0x9567('0xcc')](_0xb469b8,_0x19c47b,function(_0x4f9847){if(_0x4f9847){console[_0x9567('0xef')]('err',_0x4f9847);}else{fs[_0x9567('0xf0')](_0xb469b8);}});});});}else{return _0x380794[_0x9567('0x1d')](0xc8);}})[_0x9567('0x35')](handleError(_0x380794,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b442744..00ac161 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 _0x5e29=['map','findAll','unreadMessages','length','emit','catch','hook','events','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5bdf15,_0x39f070){var _0x1c7939=function(_0x2895e9){while(--_0x2895e9){_0x5bdf15['push'](_0x5bdf15['shift']());}};_0x1c7939(++_0x39f070);}(_0x5e29,0xa7));var _0x95e2=function(_0x42235f,_0x5dabfd){_0x42235f=_0x42235f-0x0;var _0x3f5fab=_0x5e29[_0x42235f];return _0x3f5fab;};'use strict';var EventEmitter=require(_0x95e2('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x95e2('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x95e2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95e2('0x3'),'afterDestroy':_0x95e2('0x4')};function emitEvent(_0x3ee4e1){return function(_0x273860,_0x384276,_0xc72e11){_0x273860[_0x95e2('0x5')]({'attributes':['id'],'raw':!![]})[_0x95e2('0x6')](function(_0x5140c8){_0x273860[_0x95e2('0x7')](_0x95e2('0x8'),_0x5140c8[_0x95e2('0x9')](function(_0x2e31d3){return{'id':_0x2e31d3['id']};}));return OpenchannelMessage[_0x95e2('0xa')]({'where':{'OpenchannelInteractionId':_0x273860['id'],'direction':'in','read':![]},'raw':!![]});})[_0x95e2('0x6')](function(_0x4a6b43){_0x273860[_0x95e2('0x7')](_0x95e2('0xb'),_0x4a6b43[_0x95e2('0xc')]);OpenchannelInteractionEvents[_0x95e2('0xd')](_0x3ee4e1+':'+_0x273860['id'],_0x273860);OpenchannelInteractionEvents[_0x95e2('0xd')](_0x3ee4e1,_0x273860);_0xc72e11(null);})[_0x95e2('0xe')](_0xc72e11(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x95e2('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x38f1=['findAll','length','emit','catch','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','getUsers','then','setDataValue','Users'];(function(_0x4dd0a7,_0xb4399f){var _0x487e9b=function(_0x355738){while(--_0x355738){_0x4dd0a7['push'](_0x4dd0a7['shift']());}};_0x487e9b(++_0xb4399f);}(_0x38f1,0xae));var _0x138f=function(_0x23516c,_0x16ea34){_0x23516c=_0x23516c-0x0;var _0x591310=_0x38f1[_0x23516c];return _0x591310;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x138f('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x138f('0x0'))['db'][_0x138f('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x138f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x138f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b78b9){return function(_0x2f0838,_0x4b6762,_0x236dca){_0x2f0838[_0x138f('0x4')]({'attributes':['id'],'raw':!![]})[_0x138f('0x5')](function(_0x4b4c2c){_0x2f0838[_0x138f('0x6')](_0x138f('0x7'),_0x4b4c2c['map'](function(_0x1cd972){return{'id':_0x1cd972['id']};}));return OpenchannelMessage[_0x138f('0x8')]({'where':{'OpenchannelInteractionId':_0x2f0838['id'],'direction':'in','read':![]},'raw':!![]});})[_0x138f('0x5')](function(_0x1aa5bd){_0x2f0838[_0x138f('0x6')]('unreadMessages',_0x1aa5bd[_0x138f('0x9')]);OpenchannelInteractionEvents['emit'](_0x2b78b9+':'+_0x2f0838['id'],_0x2f0838);OpenchannelInteractionEvents[_0x138f('0xa')](_0x2b78b9,_0x2f0838);_0x236dca(null);})[_0x138f('0xb')](_0x236dca(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x138f('0xc')](e,emitEvent(event));}}module[_0x138f('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6481508..fe7b0fc 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 _0xf02e=['util','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','format'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xf02e,0x68));var _0xef02=function(_0x31a308,_0x448a53){_0x31a308=_0x31a308-0x0;var _0x353a67=_0xf02e[_0x31a308];return _0x353a67;};'use strict';var _=require('lodash');var util=require(_0xef02('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef02('0x1'));var rp=require(_0xef02('0x2'));var fs=require('fs');var path=require(_0xef02('0x3'));var rimraf=require('rimraf');var config=require(_0xef02('0x4'));var attributes=require(_0xef02('0x5'));module[_0xef02('0x6')]=function(_0x9ac2b1,_0x4fd0d2){return _0x9ac2b1[_0xef02('0x7')](_0xef02('0x8'),attributes,{'tableName':_0xef02('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x28f393,_0x432f6c,_0xb05e58){if(_0x28f393[_0xef02('0xa')]('closed')){_0x28f393[_0xef02('0xb')]=moment()[_0xef02('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0xb05e58(null,_0x28f393);}}});}; \ No newline at end of file +var _0x8ead=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format'];(function(_0x36e9df,_0x3749ff){var _0x3ddf0d=function(_0x51b462){while(--_0x51b462){_0x36e9df['push'](_0x36e9df['shift']());}};_0x3ddf0d(++_0x3749ff);}(_0x8ead,0x133));var _0xd8ea=function(_0x4342a4,_0x5c38d7){_0x4342a4=_0x4342a4-0x0;var _0x48fce6=_0x8ead[_0x4342a4];return _0x48fce6;};'use strict';var _=require(_0xd8ea('0x0'));var util=require('util');var logger=require(_0xd8ea('0x1'))(_0xd8ea('0x2'));var moment=require(_0xd8ea('0x3'));var BPromise=require(_0xd8ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8ea('0x5'));var config=require(_0xd8ea('0x6'));var attributes=require(_0xd8ea('0x7'));module[_0xd8ea('0x8')]=function(_0x348514,_0xa05dd){return _0x348514[_0xd8ea('0x9')](_0xd8ea('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd8ea('0xb'),'collate':_0xd8ea('0xc'),'hooks':{'beforeUpdate':function(_0x15a65b,_0x21cf1d,_0x4c8098){if(_0x15a65b['changed'](_0xd8ea('0xd'))){_0x15a65b[_0xd8ea('0xe')]=moment()[_0xd8ea('0xf')](_0xd8ea('0x10'));}_0x4c8098(null,_0x15a65b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6b50bac..521306a 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 _0xb4d2=['redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','where','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x114cbc,_0x5d447f){var _0xafba69=function(_0x1a4488){while(--_0x1a4488){_0x114cbc['push'](_0x114cbc['shift']());}};_0xafba69(++_0x5d447f);}(_0xb4d2,0x1d9));var _0x2b4d=function(_0x330c91,_0x28ea88){_0x330c91=_0x330c91-0x0;var _0x194b10=_0xb4d2[_0x330c91];return _0x194b10;};'use strict';var _=require('lodash');var util=require(_0x2b4d('0x0'));var moment=require(_0x2b4d('0x1'));var BPromise=require(_0x2b4d('0x2'));var rs=require(_0x2b4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b4d('0x4'))['db'];var utils=require(_0x2b4d('0x5'));var logger=require(_0x2b4d('0x6'))('rpc');var config=require(_0x2b4d('0x7'));var jayson=require(_0x2b4d('0x8'));var client=jayson[_0x2b4d('0x9')][_0x2b4d('0xa')]({'port':0x232a});config[_0x2b4d('0xb')]=_['defaults'](config['redis'],{'host':_0x2b4d('0xc'),'port':0x18eb});var socket=require(_0x2b4d('0xd'))(new Redis(config[_0x2b4d('0xb')]));require(_0x2b4d('0xe'))[_0x2b4d('0xf')](socket);function respondWithRpcPromise(_0x57d3ef,_0x558cfa,_0x569d6b){return new BPromise(function(_0x1e31b0,_0x58f2c2){return client[_0x2b4d('0x10')](_0x57d3ef,_0x569d6b)[_0x2b4d('0x11')](function(_0x1a44cd){logger[_0x2b4d('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x558cfa,_0x2b4d('0x13'));logger[_0x2b4d('0x14')](_0x2b4d('0x15'),_0x558cfa,_0x2b4d('0x13'),JSON[_0x2b4d('0x16')](_0x1a44cd));if(_0x1a44cd['error']){if(_0x1a44cd['error'][_0x2b4d('0x17')]===0x1f4){logger[_0x2b4d('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x558cfa,_0x1a44cd[_0x2b4d('0x18')][_0x2b4d('0x19')]);return _0x58f2c2(_0x1a44cd[_0x2b4d('0x18')][_0x2b4d('0x19')]);}logger['error'](_0x2b4d('0x1a'),_0x558cfa,_0x1a44cd[_0x2b4d('0x18')][_0x2b4d('0x19')]);return _0x1e31b0(_0x1a44cd['error'][_0x2b4d('0x19')]);}else{logger[_0x2b4d('0x12')](_0x2b4d('0x1a'),_0x558cfa,_0x2b4d('0x13'));_0x1e31b0(_0x1a44cd[_0x2b4d('0x1b')]['message']);}})[_0x2b4d('0x1c')](function(_0x387846){logger[_0x2b4d('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x558cfa,_0x387846);_0x58f2c2(_0x387846);});});}exports['UpdateOpenchannelInteraction']=function(_0x515cf4){var _0x358e69=this;return new Promise(function(_0x8a17cd,_0x39bfdc){return db[_0x2b4d('0x1d')][_0x2b4d('0x1e')](_0x515cf4[_0x2b4d('0x1f')],{'raw':_0x515cf4[_0x2b4d('0x20')]?_0x515cf4['options'][_0x2b4d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515cf4['options']?_0x515cf4[_0x2b4d('0x20')]['where']||null:null,'attributes':_0x515cf4[_0x2b4d('0x20')]?_0x515cf4['options'][_0x2b4d('0x22')]||null:null,'limit':_0x515cf4[_0x2b4d('0x20')]?_0x515cf4[_0x2b4d('0x20')][_0x2b4d('0x23')]||null:null})[_0x2b4d('0x11')](function(_0x57a1a0){logger[_0x2b4d('0x12')](_0x2b4d('0x24'),_0x515cf4);logger[_0x2b4d('0x14')](_0x2b4d('0x24'),_0x515cf4,JSON[_0x2b4d('0x16')](_0x57a1a0));_0x8a17cd(_0x57a1a0);})[_0x2b4d('0x1c')](function(_0x3e2340){logger[_0x2b4d('0x18')](_0x2b4d('0x24'),_0x3e2340['message'],_0x515cf4);_0x39bfdc(_0x358e69[_0x2b4d('0x18')](0x1f4,_0x3e2340[_0x2b4d('0x19')]));});});};exports[_0x2b4d('0x25')]=function(_0x5e7b45){return new Promise(function(_0xab9b84,_0x4bcf16){return db['OpenchannelInteraction'][_0x2b4d('0x26')]({'where':_0x5e7b45[_0x2b4d('0x20')]?_0x5e7b45[_0x2b4d('0x20')][_0x2b4d('0x27')]||null:null})[_0x2b4d('0x11')](function(_0x4ed739){if(_0x4ed739){return _0x4ed739[_0x2b4d('0x28')](_0x5e7b45[_0x2b4d('0x1f')]['ids'],_['omit'](_0x5e7b45[_0x2b4d('0x1f')],[_0x2b4d('0x29'),'id'])||{});}})[_0x2b4d('0x2a')](function(_0x2cf7f3){logger['info'](_0x2b4d('0x2b'),_0x5e7b45);logger[_0x2b4d('0x14')](_0x2b4d('0x2b'),_0x5e7b45,JSON[_0x2b4d('0x16')](_0x2cf7f3));_0xab9b84(_0x2cf7f3);})[_0x2b4d('0x1c')](function(_0x1a30e2){logger[_0x2b4d('0x18')](_0x2b4d('0x2b'),_0x1a30e2['message'],_0x5e7b45);_0x4bcf16(_this[_0x2b4d('0x18')](0x1f4,_0x1a30e2[_0x2b4d('0x19')]));});});}; \ No newline at end of file +var _0xa9b2=['AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','info','debug'];(function(_0x383f4b,_0x5218d2){var _0xef69b4=function(_0x4f43e2){while(--_0x4f43e2){_0x383f4b['push'](_0x383f4b['shift']());}};_0xef69b4(++_0x5218d2);}(_0xa9b2,0xeb));var _0x2a9b=function(_0x2986fb,_0x9482a0){_0x2986fb=_0x2986fb-0x0;var _0xb3c156=_0xa9b2[_0x2986fb];return _0xb3c156;};'use strict';var _=require('lodash');var util=require(_0x2a9b('0x0'));var moment=require('moment');var BPromise=require(_0x2a9b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a9b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a9b('0x3'));var logger=require(_0x2a9b('0x4'))(_0x2a9b('0x5'));var config=require(_0x2a9b('0x6'));var jayson=require(_0x2a9b('0x7'));var client=jayson[_0x2a9b('0x8')]['http']({'port':0x232a});config[_0x2a9b('0x9')]=_[_0x2a9b('0xa')](config[_0x2a9b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2a9b('0xb'))[_0x2a9b('0xc')](socket);function respondWithRpcPromise(_0x247756,_0x590fd6,_0x4b3434){return new BPromise(function(_0x31ce44,_0x4145cc){return client[_0x2a9b('0xd')](_0x247756,_0x4b3434)[_0x2a9b('0xe')](function(_0x472fb7){logger['info'](_0x2a9b('0xf'),_0x590fd6,_0x2a9b('0x10'));logger['debug'](_0x2a9b('0x11'),_0x590fd6,_0x2a9b('0x10'),JSON[_0x2a9b('0x12')](_0x472fb7));if(_0x472fb7[_0x2a9b('0x13')]){if(_0x472fb7[_0x2a9b('0x13')][_0x2a9b('0x14')]===0x1f4){logger[_0x2a9b('0x13')](_0x2a9b('0xf'),_0x590fd6,_0x472fb7[_0x2a9b('0x13')]['message']);return _0x4145cc(_0x472fb7[_0x2a9b('0x13')][_0x2a9b('0x15')]);}logger[_0x2a9b('0x13')](_0x2a9b('0xf'),_0x590fd6,_0x472fb7[_0x2a9b('0x13')][_0x2a9b('0x15')]);return _0x31ce44(_0x472fb7[_0x2a9b('0x13')][_0x2a9b('0x15')]);}else{logger['info'](_0x2a9b('0xf'),_0x590fd6,'request\x20sent');_0x31ce44(_0x472fb7[_0x2a9b('0x16')][_0x2a9b('0x15')]);}})[_0x2a9b('0x17')](function(_0x28a47c){logger[_0x2a9b('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x590fd6,_0x28a47c);_0x4145cc(_0x28a47c);});});}exports['UpdateOpenchannelInteraction']=function(_0x96750e){var _0x31a87a=this;return new Promise(function(_0x50d026,_0x5d5c02){return db[_0x2a9b('0x18')][_0x2a9b('0x19')](_0x96750e[_0x2a9b('0x1a')],{'raw':_0x96750e['options']?_0x96750e[_0x2a9b('0x1b')][_0x2a9b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96750e['options']?_0x96750e[_0x2a9b('0x1b')]['where']||null:null,'attributes':_0x96750e['options']?_0x96750e[_0x2a9b('0x1b')]['attributes']||null:null,'limit':_0x96750e[_0x2a9b('0x1b')]?_0x96750e[_0x2a9b('0x1b')][_0x2a9b('0x1d')]||null:null})[_0x2a9b('0xe')](function(_0x44b2af){logger['info']('UpdateOpenchannelInteraction',_0x96750e);logger['debug'](_0x2a9b('0x1e'),_0x96750e,JSON[_0x2a9b('0x12')](_0x44b2af));_0x50d026(_0x44b2af);})[_0x2a9b('0x17')](function(_0x170cdd){logger[_0x2a9b('0x13')](_0x2a9b('0x1e'),_0x170cdd[_0x2a9b('0x15')],_0x96750e);_0x5d5c02(_0x31a87a['error'](0x1f4,_0x170cdd[_0x2a9b('0x15')]));});});};exports[_0x2a9b('0x1f')]=function(_0x5c7d17){return new Promise(function(_0x2f73f5,_0x1bf97f){return db[_0x2a9b('0x18')]['find']({'where':_0x5c7d17[_0x2a9b('0x1b')]?_0x5c7d17[_0x2a9b('0x1b')]['where']||null:null})[_0x2a9b('0xe')](function(_0x1bec19){if(_0x1bec19){return _0x1bec19[_0x2a9b('0x20')](_0x5c7d17[_0x2a9b('0x1a')][_0x2a9b('0x21')],_[_0x2a9b('0x22')](_0x5c7d17['body'],[_0x2a9b('0x21'),'id'])||{});}})[_0x2a9b('0x23')](function(_0x2d4ef6){logger[_0x2a9b('0x24')]('AddTags',_0x5c7d17);logger[_0x2a9b('0x25')]('AddTags',_0x5c7d17,JSON[_0x2a9b('0x12')](_0x2d4ef6));_0x2f73f5(_0x2d4ef6);})[_0x2a9b('0x17')](function(_0x58ad5e){logger[_0x2a9b('0x13')](_0x2a9b('0x26'),_0x58ad5e['message'],_0x5c7d17);_0x1bf97f(_this[_0x2a9b('0x13')](0x1f4,_0x58ad5e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 904d29b..b2bf7ef 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 _0x5c20=['length','openchannelInteraction:','./openchannelInteraction.events','remove','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c20,0x198));var _0x05c2=function(_0x230ea7,_0x5225da){_0x230ea7=_0x230ea7-0x0;var _0x123485=_0x5c20[_0x230ea7];return _0x123485;};'use strict';var OpenchannelInteractionEvents=require(_0x05c2('0x0'));var events=['save',_0x05c2('0x1'),'update'];function createListener(_0x4302ba,_0x510278){return function(_0x26fd7e){_0x510278[_0x05c2('0x2')](_0x4302ba,_0x26fd7e);};}function removeListener(_0x24dea9,_0x53c272){return function(){OpenchannelInteractionEvents[_0x05c2('0x3')](_0x24dea9,_0x53c272);};}exports[_0x05c2('0x4')]=function(_0x46bd6b){for(var _0x58eb50=0x0,_0x14de0f=events[_0x05c2('0x5')];_0x58eb50<_0x14de0f;_0x58eb50++){var _0x2a509e=events[_0x58eb50];var _0x3e1b05=createListener(_0x05c2('0x6')+_0x2a509e,_0x46bd6b);OpenchannelInteractionEvents['on'](_0x2a509e,_0x3e1b05);}}; \ No newline at end of file +var _0xc245=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','register'];(function(_0xfe179b,_0x3c1ac5){var _0x4ac023=function(_0x322612){while(--_0x322612){_0xfe179b['push'](_0xfe179b['shift']());}};_0x4ac023(++_0x3c1ac5);}(_0xc245,0x1c2));var _0x5c24=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc245[_0x57b54c];return _0x59cc19;};'use strict';var OpenchannelInteractionEvents=require(_0x5c24('0x0'));var events=[_0x5c24('0x1'),_0x5c24('0x2'),_0x5c24('0x3')];function createListener(_0x259f9c,_0x2cd8d2){return function(_0x601d27){_0x2cd8d2[_0x5c24('0x4')](_0x259f9c,_0x601d27);};}function removeListener(_0x5ac022,_0x578cf2){return function(){OpenchannelInteractionEvents['removeListener'](_0x5ac022,_0x578cf2);};}exports[_0x5c24('0x5')]=function(_0x364d6f){for(var _0x2d2862=0x0,_0x48a46c=events[_0x5c24('0x6')];_0x2d2862<_0x48a46c;_0x2d2862++){var _0x130fd2=events[_0x2d2862];var _0xe198ee=createListener(_0x5c24('0x7')+_0x130fd2,_0x364d6f);OpenchannelInteractionEvents['on'](_0x130fd2,_0xe198ee);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c30c0ca..3890fbf 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x21dc11,_0x55fbf3){var _0x54137c=function(_0x2113fd){while(--_0x2113fd){_0x21dc11['push'](_0x21dc11['shift']());}};_0x54137c(++_0x55fbf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x3728f1,_0x12a4f9){var _0x6c515b=function(_0x2310ef){while(--_0x2310ef){_0x3728f1['push'](_0x3728f1['shift']());}};_0x6c515b(++_0x12a4f9);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);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 bcd1902..2b64bba 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 _0x17a7=['STRING','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x17a7,0xc2));var _0x717a=function(_0x2d9130,_0x570dee){_0x2d9130=_0x2d9130-0x0;var _0x46a7b3=_0x17a7[_0x2d9130];return _0x46a7b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x717a('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x717a('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x717a('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x717a('0x2')]('in','out'),'defaultValue':_0x717a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x717a('0x4')]},'providerResponse':{'type':Sequelize[_0x717a('0x5')]}}; \ No newline at end of file +var _0x73a1=['medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x4b6a01,_0x386039){var _0xc374a3=function(_0x49791b){while(--_0x49791b){_0x4b6a01['push'](_0x4b6a01['shift']());}};_0xc374a3(++_0x386039);}(_0x73a1,0x161));var _0x173a=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x73a1[_0x1aa3fe];return _0x163cee;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x173a('0x0')](_0x173a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x173a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x173a('0x3')]('in',_0x173a('0x4')),'defaultValue':_0x173a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x173a('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 700bbf9..54b9494 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 _0xfb65=['event','EventManager','acceptmessage','../../config/logger','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','sequelize','SIP/%s','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','map','OpenchannelMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','include','find','create','body','describe','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','format','channel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfb65,0x8c));var _0x5fb6=function(_0x5d2ebe,_0x2ac299){_0x5d2ebe=_0x5d2ebe-0x0;var _0x96421b=_0xfb65[_0x5d2ebe];return _0x96421b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fb6('0x0'));var zipdir=require(_0x5fb6('0x1'));var jsonpatch=require(_0x5fb6('0x2'));var rp=require(_0x5fb6('0x3'));var moment=require(_0x5fb6('0x4'));var BPromise=require(_0x5fb6('0x5'));var Mustache=require('mustache');var util=require(_0x5fb6('0x6'));var path=require(_0x5fb6('0x7'));var sox=require('sox');var csv=require(_0x5fb6('0x8'));var ejs=require(_0x5fb6('0x9'));var fs=require('fs');var fs_extra=require(_0x5fb6('0xa'));var _=require('lodash');var squel=require(_0x5fb6('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fb6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5fb6('0xd'));var Papa=require(_0x5fb6('0xe'));var Redis=require(_0x5fb6('0xf'));var authService=require(_0x5fb6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5fb6('0x11'));var hardwareService=require(_0x5fb6('0x12'));var logger=require('../../config/logger')(_0x5fb6('0x13'));var utils=require(_0x5fb6('0x14'));var config=require(_0x5fb6('0x15'));var licenseUtil=require(_0x5fb6('0x16'));var db=require(_0x5fb6('0x17'))['db'];config[_0x5fb6('0x18')]=_['defaults'](config[_0x5fb6('0x18')],{'host':_0x5fb6('0x19'),'port':0x18eb});var socket=require(_0x5fb6('0x1a'))(new Redis(config['redis']));require(_0x5fb6('0x1b'))['register'](socket);var jayson=require(_0x5fb6('0x1c'));var client=jayson[_0x5fb6('0x1d')][_0x5fb6('0x1e')]({'port':0x232c});var client9002=jayson[_0x5fb6('0x1d')][_0x5fb6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43828b,_0x4c1cdf,_0xe6e7fb,_0x1168c4){return new BPromise(function(_0x2930a7,_0x581c31){var _0x518020=_0x1168c4||client;return _0x518020[_0x5fb6('0x1f')](_0x43828b,_0xe6e7fb)['then'](function(_0x3b0b87){logger[_0x5fb6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c1cdf,_0x5fb6('0x21'));logger[_0x5fb6('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4c1cdf,'request\x20sent',JSON[_0x5fb6('0x23')](_0x3b0b87));if(_0x3b0b87[_0x5fb6('0x24')]){if(_0x3b0b87[_0x5fb6('0x24')][_0x5fb6('0x25')]===0x1f4){logger[_0x5fb6('0x24')](_0x5fb6('0x26'),_0x4c1cdf,_0x3b0b87[_0x5fb6('0x24')]['message']);return _0x581c31(_0x3b0b87[_0x5fb6('0x24')]['message']);}logger[_0x5fb6('0x24')](_0x5fb6('0x26'),_0x4c1cdf,_0x3b0b87[_0x5fb6('0x24')][_0x5fb6('0x27')]);return _0x2930a7(_0x3b0b87['error'][_0x5fb6('0x27')]);}else{logger[_0x5fb6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c1cdf,_0x5fb6('0x21'));_0x2930a7(_0x3b0b87['result'][_0x5fb6('0x27')]);}})[_0x5fb6('0x28')](function(_0x4fa1e0){logger[_0x5fb6('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c1cdf,_0x4fa1e0);_0x581c31(_0x4fa1e0);});});}function respondWithStatusCode(_0x55fa52,_0x169817){_0x169817=_0x169817||0xcc;return function(_0x7bea12){if(_0x7bea12){return _0x55fa52[_0x5fb6('0x29')](_0x169817);}return _0x55fa52[_0x5fb6('0x2a')](_0x169817)['end']();};}function respondWithResult(_0x41ea87,_0x309bc0){_0x309bc0=_0x309bc0||0xc8;return function(_0x802306){if(_0x802306){return _0x41ea87['status'](_0x309bc0)[_0x5fb6('0x2b')](_0x802306);}};}function respondWithFilteredResult(_0x753de9,_0x249e51){return function(_0x57437d){if(_0x57437d){var _0x68b491=typeof _0x249e51[_0x5fb6('0x2c')]===_0x5fb6('0x2d')&&typeof _0x249e51['limit']===_0x5fb6('0x2d');var _0x303c4a=_0x57437d[_0x5fb6('0x2e')];var _0x52ea14=_0x68b491?0x0:_0x249e51[_0x5fb6('0x2c')];var _0x5f27fc=_0x68b491?_0x57437d[_0x5fb6('0x2e')]:_0x249e51[_0x5fb6('0x2c')]+_0x249e51[_0x5fb6('0x2f')];var _0x2b167f;if(_0x5f27fc>=_0x303c4a){_0x5f27fc=_0x303c4a;_0x2b167f=0xc8;}else{_0x2b167f=0xce;}_0x753de9['status'](_0x2b167f);return _0x753de9[_0x5fb6('0x30')](_0x5fb6('0x31'),_0x52ea14+'-'+_0x5f27fc+'/'+_0x303c4a)[_0x5fb6('0x2b')](_0x57437d);}return null;};}function patchUpdates(_0xfe78ba){return function(_0x41f184){try{jsonpatch[_0x5fb6('0x32')](_0x41f184,_0xfe78ba,!![]);}catch(_0x20c89e){return BPromise[_0x5fb6('0x33')](_0x20c89e);}return _0x41f184[_0x5fb6('0x34')]();};}function saveUpdates(_0x2d8e99,_0x21ddfb){return function(_0x20b80f){if(_0x20b80f){return _0x20b80f[_0x5fb6('0x35')](_0x2d8e99)[_0x5fb6('0x36')](function(_0x5dd68a){return _0x5dd68a;});}return null;};}function removeEntity(_0x54466b,_0x5c0dab){return function(_0x3825e1){if(_0x3825e1){return _0x3825e1['destroy']()[_0x5fb6('0x36')](function(){_0x54466b['status'](0xcc)[_0x5fb6('0x37')]();});}};}function handleEntityNotFound(_0x29658c,_0x1e0fc1){return function(_0x7c8e2){if(!_0x7c8e2){_0x29658c['sendStatus'](0x194);}return _0x7c8e2;};}function handleError(_0x379652,_0x60d892){_0x60d892=_0x60d892||0x1f4;return function(_0x5d32d4){logger[_0x5fb6('0x24')](_0x5d32d4[_0x5fb6('0x38')]);if(_0x5d32d4['name']){delete _0x5d32d4[_0x5fb6('0x39')];}_0x379652[_0x5fb6('0x2a')](_0x60d892)[_0x5fb6('0x3a')](_0x5d32d4);};}exports['index']=function(_0x5bfb54,_0x295edc){var _0x39a66c={},_0xdc76cf={},_0x48f5e8={'count':0x0,'rows':[]};var _0x40991b=_[_0x5fb6('0x3b')](db[_0x5fb6('0x3c')][_0x5fb6('0x3d')],function(_0x4582c7){return{'name':_0x4582c7['fieldName'],'type':_0x4582c7[_0x5fb6('0x3e')]['key']};});_0xdc76cf[_0x5fb6('0x3f')]=_['map'](_0x40991b,_0x5fb6('0x39'));_0xdc76cf[_0x5fb6('0x40')]=_[_0x5fb6('0x41')](_0x5bfb54[_0x5fb6('0x40')]);_0xdc76cf[_0x5fb6('0x42')]=_[_0x5fb6('0x43')](_0xdc76cf[_0x5fb6('0x3f')],_0xdc76cf['query']);_0x39a66c[_0x5fb6('0x44')]=_[_0x5fb6('0x43')](_0xdc76cf[_0x5fb6('0x3f')],qs[_0x5fb6('0x45')](_0x5bfb54[_0x5fb6('0x40')][_0x5fb6('0x45')]));_0x39a66c[_0x5fb6('0x44')]=_0x39a66c[_0x5fb6('0x44')]['length']?_0x39a66c[_0x5fb6('0x44')]:_0xdc76cf[_0x5fb6('0x3f')];if(!_0x5bfb54[_0x5fb6('0x40')][_0x5fb6('0x46')](_0x5fb6('0x47'))){_0x39a66c['limit']=qs[_0x5fb6('0x2f')](_0x5bfb54['query'][_0x5fb6('0x2f')]);_0x39a66c['offset']=qs[_0x5fb6('0x2c')](_0x5bfb54[_0x5fb6('0x40')][_0x5fb6('0x2c')]);}_0x39a66c[_0x5fb6('0x48')]=qs['sort'](_0x5bfb54[_0x5fb6('0x40')][_0x5fb6('0x49')]);_0x39a66c[_0x5fb6('0x4a')]=qs[_0x5fb6('0x42')](_['pick'](_0x5bfb54[_0x5fb6('0x40')],_0xdc76cf['filters']),_0x40991b);if(_0x5bfb54['query'][_0x5fb6('0x4b')]){_0x39a66c['where']=_[_0x5fb6('0x4c')](_0x39a66c[_0x5fb6('0x4a')],{'$or':_[_0x5fb6('0x3b')](_0x40991b,function(_0x18a481){if(_0x18a481[_0x5fb6('0x3e')]!==_0x5fb6('0x4d')){var _0x18c99d={};_0x18c99d[_0x18a481[_0x5fb6('0x39')]]={'$like':'%'+_0x5bfb54[_0x5fb6('0x40')][_0x5fb6('0x4b')]+'%'};return _0x18c99d;}})});}_0x39a66c=_['merge']({},_0x39a66c,_0x5bfb54[_0x5fb6('0x4e')]);var _0x168e9f={'where':_0x39a66c[_0x5fb6('0x4a')]};return db[_0x5fb6('0x3c')]['count'](_0x168e9f)[_0x5fb6('0x36')](function(_0x58c34c){_0x48f5e8['count']=_0x58c34c;if(_0x5bfb54['query'][_0x5fb6('0x4f')]){_0x39a66c['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x39a66c);})[_0x5fb6('0x36')](function(_0x54e388){_0x48f5e8[_0x5fb6('0x50')]=_0x54e388;return _0x48f5e8;})[_0x5fb6('0x36')](respondWithFilteredResult(_0x295edc,_0x39a66c))['catch'](handleError(_0x295edc,null));};exports[_0x5fb6('0x51')]=function(_0x35dc2d,_0x7817de){var _0xd91779={'raw':!![],'where':{'id':_0x35dc2d[_0x5fb6('0x52')]['id']}},_0x52383d={};_0x52383d[_0x5fb6('0x3f')]=_[_0x5fb6('0x41')](db[_0x5fb6('0x3c')][_0x5fb6('0x3d')]);_0x52383d['query']=_[_0x5fb6('0x41')](_0x35dc2d[_0x5fb6('0x40')]);_0x52383d[_0x5fb6('0x42')]=_[_0x5fb6('0x43')](_0x52383d[_0x5fb6('0x3f')],_0x52383d['query']);_0xd91779[_0x5fb6('0x44')]=_['intersection'](_0x52383d[_0x5fb6('0x3f')],qs[_0x5fb6('0x45')](_0x35dc2d['query'][_0x5fb6('0x45')]));_0xd91779['attributes']=_0xd91779[_0x5fb6('0x44')][_0x5fb6('0x53')]?_0xd91779[_0x5fb6('0x44')]:_0x52383d[_0x5fb6('0x3f')];if(_0x35dc2d[_0x5fb6('0x40')]['includeAll']){_0xd91779[_0x5fb6('0x54')]=[{'all':!![]}];}_0xd91779=_[_0x5fb6('0x4c')]({},_0xd91779,_0x35dc2d['options']);return db[_0x5fb6('0x3c')][_0x5fb6('0x55')](_0xd91779)[_0x5fb6('0x36')](handleEntityNotFound(_0x7817de,null))['then'](respondWithResult(_0x7817de,null))[_0x5fb6('0x28')](handleError(_0x7817de,null));};exports['create']=function(_0x30f5c1,_0x56075a){return db[_0x5fb6('0x3c')][_0x5fb6('0x56')](_0x30f5c1['body'],{})[_0x5fb6('0x36')](respondWithResult(_0x56075a,0xc9))[_0x5fb6('0x28')](handleError(_0x56075a,null));};exports['update']=function(_0x356056,_0x1140c0){if(_0x356056['body']['id']){delete _0x356056[_0x5fb6('0x57')]['id'];}return db[_0x5fb6('0x3c')]['find']({'where':{'id':_0x356056[_0x5fb6('0x52')]['id']}})['then'](handleEntityNotFound(_0x1140c0,null))[_0x5fb6('0x36')](saveUpdates(_0x356056[_0x5fb6('0x57')],null))[_0x5fb6('0x36')](respondWithResult(_0x1140c0,null))[_0x5fb6('0x28')](handleError(_0x1140c0,null));};exports['destroy']=function(_0x374007,_0x21f06b){return db[_0x5fb6('0x3c')][_0x5fb6('0x55')]({'where':{'id':_0x374007[_0x5fb6('0x52')]['id']}})['then'](handleEntityNotFound(_0x21f06b,null))[_0x5fb6('0x36')](removeEntity(_0x21f06b,null))[_0x5fb6('0x28')](handleError(_0x21f06b,null));};exports[_0x5fb6('0x58')]=function(_0x20eac3,_0x1a035f){return db['OpenchannelMessage'][_0x5fb6('0x58')]()['then'](respondWithResult(_0x1a035f,null))[_0x5fb6('0x28')](handleError(_0x1a035f,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x5fb6('0x59')]=function(_0x569f85,_0x43e6dc,_0x9a9122){var _0xed5f1={'agent':{},'channel':_0x5fb6('0x5a')};if(_0x569f85[_0x5fb6('0x57')]['id']){delete _0x569f85['body']['id'];}_0x569f85[_0x5fb6('0x57')][_0x5fb6('0x5b')]=!![];_0x569f85[_0x5fb6('0x57')]['readAt']=moment()['format'](_0x5fb6('0x5c'));_0x569f85[_0x5fb6('0x57')][_0x5fb6('0x5d')]=_0x569f85[_0x5fb6('0x57')]['UserId']||_0x569f85[_0x5fb6('0x5e')]['id'];_0xed5f1[_0x5fb6('0x5f')]['id']=_0x569f85[_0x5fb6('0x57')][_0x5fb6('0x5d')];return db[_0x5fb6('0x3c')][_0x5fb6('0x55')]({'where':{'id':_0x569f85[_0x5fb6('0x52')]['id'],'UserId':null}})[_0x5fb6('0x36')](handleEntityNotFound(_0x43e6dc,null))[_0x5fb6('0x36')](saveUpdates(_0x569f85[_0x5fb6('0x57')],null))['then'](function(_0x154347){if(_0x154347){_0xed5f1[_0x5fb6('0x27')]=_0x154347[_0x5fb6('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5fb6('0x55')]({'where':{'id':_0x154347[_0x5fb6('0x61')]}});}return null;})[_0x5fb6('0x36')](handleEntityNotFound(_0x43e6dc,null))[_0x5fb6('0x36')](function(_0x21ba9f){if(_0x21ba9f){return _0x21ba9f[_0x5fb6('0x35')]({'UserId':_0x569f85[_0x5fb6('0x57')][_0x5fb6('0x5d')],'read1stAt':_[_0x5fb6('0x62')](_0x21ba9f[_0x5fb6('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x193baa){if(_0x193baa){_0xed5f1[_0x5fb6('0x64')]=_0x193baa[_0x5fb6('0x60')]({'plain':!![]});interaction_log[_0x5fb6('0x20')](_0x5fb6('0x65'),_0x569f85[_0x5fb6('0x5e')]['id'],_0x569f85['user'][_0x5fb6('0x39')],_0x569f85[_0x5fb6('0x5e')][_0x5fb6('0x66')],_0xed5f1[_0x5fb6('0x64')]['id'],_0x569f85[_0x5fb6('0x57')]?JSON[_0x5fb6('0x23')](_0x569f85[_0x5fb6('0x57')]):_0x5fb6('0x67'));return respondWithRpcPromise(_0x5fb6('0x68'),_0x5fb6('0x69'),_0xed5f1);}return null;})['then'](function(_0x41cc11){var _0x1d838f=_0x5fb6('0x6a')+_0x41cc11['message']['ContactId'];return db['sequelize'][_0x5fb6('0x40')](_0x1d838f,{'type':db[_0x5fb6('0x6b')][_0x5fb6('0x6c')][_0x5fb6('0x6d')],'raw':!![]})[_0x5fb6('0x36')](function(_0x3c39f0){return _0x3c39f0;});})[_0x5fb6('0x36')](function(_0x22f6bc){if(_0x22f6bc){_0xed5f1[_0x5fb6('0x27')][_0x5fb6('0x6e')]=_0x22f6bc[0x0];if(!_0x569f85[_0x5fb6('0x57')][_0x5fb6('0x5d')])return;return db[_0x5fb6('0x6f')]['find']({'where':{'id':_0x569f85['body'][_0x5fb6('0x5d')],'role':'agent'},'attributes':['id',_0x5fb6('0x39'),_0x5fb6('0x70'),'email',_0x5fb6('0x71')],'raw':!![]});}return null;})['then'](function(_0x49af0b){if(!_0x49af0b)return null;_0xed5f1[_0x5fb6('0x27')][_0x5fb6('0x5f')]=_0x49af0b;return _0xed5f1;})['then'](function(_0x3ba43f){if(_0x3ba43f){if(_0x569f85[_0x5fb6('0x57')]['manual']){_0xed5f1['message']['interface']=util[_0x5fb6('0x72')]('SIP/%s',_0x569f85[_0x5fb6('0x5e')][_0x5fb6('0x39')]);_0xed5f1['message']['channel']=_0xed5f1[_0x5fb6('0x73')];_0xed5f1['message']['motionChannel']=_0xed5f1['channel'];_0xed5f1['message'][_0x5fb6('0x74')]=_0x5fb6('0x59');return respondWithRpcPromise(_0x5fb6('0x75'),_0x5fb6('0x75'),{'event':_0x5fb6('0x76'),'message':_0xed5f1['message']},client9002)['then'](function(){return _0xed5f1;});}return _0xed5f1;}return null;})[_0x5fb6('0x36')](respondWithResult(_0x43e6dc,null))[_0x5fb6('0x28')](handleError(_0x43e6dc,null));};var interaction_log=require(_0x5fb6('0x77'))(_0x5fb6('0x78'));exports[_0x5fb6('0x33')]=function(_0x23071e,_0x2775c0,_0x5587d4){var _0x49291a={'agent':{},'channel':_0x5fb6('0x5a')};if(_0x23071e[_0x5fb6('0x57')]['id']){delete _0x23071e[_0x5fb6('0x57')]['id'];}_0x23071e['body']['UserId']=_0x23071e['body'][_0x5fb6('0x5d')]||_0x23071e[_0x5fb6('0x5e')]['id'];_0x49291a[_0x5fb6('0x5f')]['id']=_0x23071e[_0x5fb6('0x57')][_0x5fb6('0x5d')];return db[_0x5fb6('0x3c')][_0x5fb6('0x55')]({'where':{'id':_0x23071e[_0x5fb6('0x52')]['id'],'UserId':null}})[_0x5fb6('0x36')](handleEntityNotFound(_0x2775c0,null))[_0x5fb6('0x36')](function(_0x54b14f){if(_0x54b14f){_0x49291a['message']=_0x54b14f[_0x5fb6('0x60')]({'plain':!![]});return db[_0x5fb6('0x79')]['find']({'where':{'id':_0x54b14f[_0x5fb6('0x61')]}});}return null;})[_0x5fb6('0x36')](handleEntityNotFound(_0x2775c0,null))['then'](function(_0x3755b6){if(_0x3755b6){_0x49291a['interaction']=_0x3755b6[_0x5fb6('0x60')]({'plain':!![]});interaction_log[_0x5fb6('0x20')](_0x5fb6('0x7a'),_0x23071e[_0x5fb6('0x5e')]['id'],_0x23071e[_0x5fb6('0x5e')][_0x5fb6('0x39')],_0x23071e[_0x5fb6('0x5e')]['role'],_0x49291a['interaction']['id'],_0x23071e['body']?JSON['stringify'](_0x23071e['body']):_0x5fb6('0x67'));return respondWithRpcPromise(_0x5fb6('0x7b'),'rejectMessage',_0x49291a);}return null;})['then'](function(_0x51eeb5){var _0x4c7e4d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51eeb5[_0x5fb6('0x27')][_0x5fb6('0x7c')];return db[_0x5fb6('0x7d')][_0x5fb6('0x40')](_0x4c7e4d,{'type':db[_0x5fb6('0x6b')][_0x5fb6('0x6c')][_0x5fb6('0x6d')],'raw':!![]})[_0x5fb6('0x36')](function(_0x5662f8){return _0x5662f8;});})[_0x5fb6('0x36')](function(_0x431685){if(_0x431685){_0x49291a['message'][_0x5fb6('0x6e')]=_0x431685[0x0];if(!_0x23071e[_0x5fb6('0x57')][_0x5fb6('0x5d')])return;return db['User'][_0x5fb6('0x55')]({'where':{'id':_0x23071e[_0x5fb6('0x57')]['UserId'],'role':_0x5fb6('0x5f')},'attributes':['id',_0x5fb6('0x39'),_0x5fb6('0x70'),'email',_0x5fb6('0x71')],'raw':!![]});}return null;})[_0x5fb6('0x36')](function(_0x2b9d8f){if(!_0x2b9d8f)return null;_0x49291a[_0x5fb6('0x27')][_0x5fb6('0x5f')]=_0x2b9d8f;return _0x49291a;})['then'](function(_0x39902b){if(_0x39902b){_0x39902b['message']['interface']=util[_0x5fb6('0x72')](_0x5fb6('0x7e'),_0x23071e[_0x5fb6('0x5e')][_0x5fb6('0x39')]);_0x39902b['message'][_0x5fb6('0x73')]=_0x49291a[_0x5fb6('0x73')];_0x39902b[_0x5fb6('0x27')][_0x5fb6('0x7f')]=_0x49291a[_0x5fb6('0x73')];_0x39902b[_0x5fb6('0x27')][_0x5fb6('0x74')]=_0x5fb6('0x33');respondWithRpcPromise(_0x5fb6('0x75'),_0x5fb6('0x75'),{'event':'rejectmessage','message':_0x39902b[_0x5fb6('0x27')]},client9002);return _0x49291a;}return null;})[_0x5fb6('0x36')](respondWithResult(_0x2775c0,null))[_0x5fb6('0x28')](handleError(_0x2775c0,null));}; \ No newline at end of file +var _0x2168=['./openchannelMessage.socket','register','client','http','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','OpenchannelMessage','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','contact','User','interface','rejectmessage','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x4c5bf2,_0x4a775f){var _0x1a2fbc=function(_0x2124c1){while(--_0x2124c1){_0x4c5bf2['push'](_0x4c5bf2['shift']());}};_0x1a2fbc(++_0x4a775f);}(_0x2168,0x6a));var _0x8216=function(_0x398f53,_0x264570){_0x398f53=_0x398f53-0x0;var _0xa451fa=_0x2168[_0x398f53];return _0xa451fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8216('0x0'));var zipdir=require(_0x8216('0x1'));var jsonpatch=require(_0x8216('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8216('0x3'));var Mustache=require(_0x8216('0x4'));var util=require('util');var path=require(_0x8216('0x5'));var sox=require(_0x8216('0x6'));var csv=require(_0x8216('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8216('0x8'));var _=require('lodash');var squel=require(_0x8216('0x9'));var crypto=require(_0x8216('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8216('0xb'));var toCsv=require(_0x8216('0x7'));var querystring=require('querystring');var Papa=require(_0x8216('0xc'));var Redis=require(_0x8216('0xd'));var authService=require(_0x8216('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8216('0xf'));var hardwareService=require(_0x8216('0x10'));var logger=require(_0x8216('0x11'))('api');var utils=require(_0x8216('0x12'));var config=require(_0x8216('0x13'));var licenseUtil=require(_0x8216('0x14'));var db=require('../../mysqldb')['db'];config[_0x8216('0x15')]=_[_0x8216('0x16')](config['redis'],{'host':_0x8216('0x17'),'port':0x18eb});var socket=require(_0x8216('0x18'))(new Redis(config[_0x8216('0x15')]));require(_0x8216('0x19'))[_0x8216('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8216('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x8216('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1e940a,_0x1b543a,_0x57c8e5,_0xdcba77){return new BPromise(function(_0x4e96ba,_0xfb3928){var _0x420812=_0xdcba77||client;return _0x420812['request'](_0x1e940a,_0x57c8e5)['then'](function(_0x4069f3){logger[_0x8216('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b543a,_0x8216('0x1e'));logger['debug'](_0x8216('0x1f'),_0x1b543a,_0x8216('0x1e'),JSON['stringify'](_0x4069f3));if(_0x4069f3[_0x8216('0x20')]){if(_0x4069f3[_0x8216('0x20')]['code']===0x1f4){logger[_0x8216('0x20')](_0x8216('0x21'),_0x1b543a,_0x4069f3['error'][_0x8216('0x22')]);return _0xfb3928(_0x4069f3['error'][_0x8216('0x22')]);}logger[_0x8216('0x20')](_0x8216('0x21'),_0x1b543a,_0x4069f3[_0x8216('0x20')][_0x8216('0x22')]);return _0x4e96ba(_0x4069f3['error'][_0x8216('0x22')]);}else{logger[_0x8216('0x1d')](_0x8216('0x21'),_0x1b543a,_0x8216('0x1e'));_0x4e96ba(_0x4069f3[_0x8216('0x23')]['message']);}})['catch'](function(_0x2aab0b){logger[_0x8216('0x20')](_0x8216('0x21'),_0x1b543a,_0x2aab0b);_0xfb3928(_0x2aab0b);});});}function respondWithStatusCode(_0x38e88e,_0x21d317){_0x21d317=_0x21d317||0xcc;return function(_0x4b9810){if(_0x4b9810){return _0x38e88e[_0x8216('0x24')](_0x21d317);}return _0x38e88e[_0x8216('0x25')](_0x21d317)['end']();};}function respondWithResult(_0x43c8b8,_0x3f8504){_0x3f8504=_0x3f8504||0xc8;return function(_0x1c8512){if(_0x1c8512){return _0x43c8b8[_0x8216('0x25')](_0x3f8504)[_0x8216('0x26')](_0x1c8512);}};}function respondWithFilteredResult(_0x5d8325,_0x4ea217){return function(_0x853cc1){if(_0x853cc1){var _0x20b5d0=typeof _0x4ea217['offset']==='undefined'&&typeof _0x4ea217[_0x8216('0x27')]===_0x8216('0x28');var _0x62909d=_0x853cc1[_0x8216('0x29')];var _0x880fd8=_0x20b5d0?0x0:_0x4ea217[_0x8216('0x2a')];var _0x33bc44=_0x20b5d0?_0x853cc1['count']:_0x4ea217[_0x8216('0x2a')]+_0x4ea217[_0x8216('0x27')];var _0x5d83d8;if(_0x33bc44>=_0x62909d){_0x33bc44=_0x62909d;_0x5d83d8=0xc8;}else{_0x5d83d8=0xce;}_0x5d8325[_0x8216('0x25')](_0x5d83d8);return _0x5d8325[_0x8216('0x2b')](_0x8216('0x2c'),_0x880fd8+'-'+_0x33bc44+'/'+_0x62909d)[_0x8216('0x26')](_0x853cc1);}return null;};}function patchUpdates(_0x1ec85d){return function(_0x2fb416){try{jsonpatch[_0x8216('0x2d')](_0x2fb416,_0x1ec85d,!![]);}catch(_0x5ca01d){return BPromise[_0x8216('0x2e')](_0x5ca01d);}return _0x2fb416[_0x8216('0x2f')]();};}function saveUpdates(_0x3cc178,_0x4fab0e){return function(_0x3d7e64){if(_0x3d7e64){return _0x3d7e64[_0x8216('0x30')](_0x3cc178)[_0x8216('0x31')](function(_0x353edc){return _0x353edc;});}return null;};}function removeEntity(_0x1d7f6e,_0x154345){return function(_0x2b912d){if(_0x2b912d){return _0x2b912d[_0x8216('0x32')]()[_0x8216('0x31')](function(){_0x1d7f6e[_0x8216('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8eeea4,_0x429e39){return function(_0x32cb8b){if(!_0x32cb8b){_0x8eeea4[_0x8216('0x24')](0x194);}return _0x32cb8b;};}function handleError(_0x35f7e4,_0x1c725d){_0x1c725d=_0x1c725d||0x1f4;return function(_0x65afd9){logger['error'](_0x65afd9[_0x8216('0x33')]);if(_0x65afd9[_0x8216('0x34')]){delete _0x65afd9['name'];}_0x35f7e4[_0x8216('0x25')](_0x1c725d)[_0x8216('0x35')](_0x65afd9);};}exports['index']=function(_0x4c4d40,_0x5dae5f){var _0x3ff46e={},_0xe4ded5={},_0x3692de={'count':0x0,'rows':[]};var _0x1ec406=_[_0x8216('0x36')](db['OpenchannelMessage'][_0x8216('0x37')],function(_0xedc2f1){return{'name':_0xedc2f1['fieldName'],'type':_0xedc2f1[_0x8216('0x38')][_0x8216('0x39')]};});_0xe4ded5[_0x8216('0x3a')]=_[_0x8216('0x36')](_0x1ec406,'name');_0xe4ded5[_0x8216('0x3b')]=_[_0x8216('0x3c')](_0x4c4d40['query']);_0xe4ded5[_0x8216('0x3d')]=_['intersection'](_0xe4ded5[_0x8216('0x3a')],_0xe4ded5[_0x8216('0x3b')]);_0x3ff46e[_0x8216('0x3e')]=_[_0x8216('0x3f')](_0xe4ded5[_0x8216('0x3a')],qs[_0x8216('0x40')](_0x4c4d40[_0x8216('0x3b')][_0x8216('0x40')]));_0x3ff46e[_0x8216('0x3e')]=_0x3ff46e['attributes'][_0x8216('0x41')]?_0x3ff46e['attributes']:_0xe4ded5[_0x8216('0x3a')];if(!_0x4c4d40['query'][_0x8216('0x42')](_0x8216('0x43'))){_0x3ff46e[_0x8216('0x27')]=qs[_0x8216('0x27')](_0x4c4d40[_0x8216('0x3b')][_0x8216('0x27')]);_0x3ff46e[_0x8216('0x2a')]=qs[_0x8216('0x2a')](_0x4c4d40['query']['offset']);}_0x3ff46e[_0x8216('0x44')]=qs['sort'](_0x4c4d40[_0x8216('0x3b')][_0x8216('0x45')]);_0x3ff46e[_0x8216('0x46')]=qs[_0x8216('0x3d')](_[_0x8216('0x47')](_0x4c4d40['query'],_0xe4ded5[_0x8216('0x3d')]),_0x1ec406);if(_0x4c4d40['query'][_0x8216('0x48')]){_0x3ff46e[_0x8216('0x46')]=_[_0x8216('0x49')](_0x3ff46e['where'],{'$or':_['map'](_0x1ec406,function(_0xd0ede2){if(_0xd0ede2['type']!==_0x8216('0x4a')){var _0x3c7444={};_0x3c7444[_0xd0ede2[_0x8216('0x34')]]={'$like':'%'+_0x4c4d40['query'][_0x8216('0x48')]+'%'};return _0x3c7444;}})});}_0x3ff46e=_[_0x8216('0x49')]({},_0x3ff46e,_0x4c4d40[_0x8216('0x4b')]);var _0x4921d3={'where':_0x3ff46e[_0x8216('0x46')]};return db['OpenchannelMessage'][_0x8216('0x29')](_0x4921d3)[_0x8216('0x31')](function(_0x15a57c){_0x3692de['count']=_0x15a57c;if(_0x4c4d40['query'][_0x8216('0x4c')]){_0x3ff46e['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3ff46e);})[_0x8216('0x31')](function(_0x23127c){_0x3692de[_0x8216('0x4d')]=_0x23127c;return _0x3692de;})[_0x8216('0x31')](respondWithFilteredResult(_0x5dae5f,_0x3ff46e))[_0x8216('0x4e')](handleError(_0x5dae5f,null));};exports[_0x8216('0x4f')]=function(_0x41a540,_0x5cddf0){var _0x844c25={'raw':!![],'where':{'id':_0x41a540[_0x8216('0x50')]['id']}},_0x294d3d={};_0x294d3d['model']=_[_0x8216('0x3c')](db[_0x8216('0x51')][_0x8216('0x37')]);_0x294d3d[_0x8216('0x3b')]=_[_0x8216('0x3c')](_0x41a540[_0x8216('0x3b')]);_0x294d3d[_0x8216('0x3d')]=_['intersection'](_0x294d3d[_0x8216('0x3a')],_0x294d3d[_0x8216('0x3b')]);_0x844c25[_0x8216('0x3e')]=_[_0x8216('0x3f')](_0x294d3d[_0x8216('0x3a')],qs[_0x8216('0x40')](_0x41a540[_0x8216('0x3b')][_0x8216('0x40')]));_0x844c25[_0x8216('0x3e')]=_0x844c25[_0x8216('0x3e')][_0x8216('0x41')]?_0x844c25['attributes']:_0x294d3d[_0x8216('0x3a')];if(_0x41a540[_0x8216('0x3b')]['includeAll']){_0x844c25['include']=[{'all':!![]}];}_0x844c25=_[_0x8216('0x49')]({},_0x844c25,_0x41a540['options']);return db[_0x8216('0x51')][_0x8216('0x52')](_0x844c25)[_0x8216('0x31')](handleEntityNotFound(_0x5cddf0,null))[_0x8216('0x31')](respondWithResult(_0x5cddf0,null))[_0x8216('0x4e')](handleError(_0x5cddf0,null));};exports[_0x8216('0x53')]=function(_0x558dcd,_0x151ba3){return db['OpenchannelMessage'][_0x8216('0x53')](_0x558dcd['body'],{})[_0x8216('0x31')](respondWithResult(_0x151ba3,0xc9))[_0x8216('0x4e')](handleError(_0x151ba3,null));};exports[_0x8216('0x30')]=function(_0x566c77,_0x4f12ef){if(_0x566c77['body']['id']){delete _0x566c77[_0x8216('0x54')]['id'];}return db[_0x8216('0x51')][_0x8216('0x52')]({'where':{'id':_0x566c77[_0x8216('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f12ef,null))[_0x8216('0x31')](saveUpdates(_0x566c77[_0x8216('0x54')],null))['then'](respondWithResult(_0x4f12ef,null))[_0x8216('0x4e')](handleError(_0x4f12ef,null));};exports[_0x8216('0x32')]=function(_0x400536,_0x1033c2){return db[_0x8216('0x51')][_0x8216('0x52')]({'where':{'id':_0x400536[_0x8216('0x50')]['id']}})[_0x8216('0x31')](handleEntityNotFound(_0x1033c2,null))[_0x8216('0x31')](removeEntity(_0x1033c2,null))[_0x8216('0x4e')](handleError(_0x1033c2,null));};exports[_0x8216('0x55')]=function(_0x7f4d6c,_0x148633){return db[_0x8216('0x51')][_0x8216('0x55')]()[_0x8216('0x31')](respondWithResult(_0x148633,null))['catch'](handleError(_0x148633,null));};var interaction_log=require(_0x8216('0x11'))('openchannel-interactions');exports[_0x8216('0x56')]=function(_0x2ee783,_0xefe3c2,_0x549051){var _0x2bcff2={'agent':{},'channel':_0x8216('0x57')};if(_0x2ee783[_0x8216('0x54')]['id']){delete _0x2ee783[_0x8216('0x54')]['id'];}_0x2ee783['body'][_0x8216('0x58')]=!![];_0x2ee783[_0x8216('0x54')][_0x8216('0x59')]=moment()[_0x8216('0x5a')](_0x8216('0x5b'));_0x2ee783['body'][_0x8216('0x5c')]=_0x2ee783[_0x8216('0x54')][_0x8216('0x5c')]||_0x2ee783['user']['id'];_0x2bcff2[_0x8216('0x5d')]['id']=_0x2ee783[_0x8216('0x54')][_0x8216('0x5c')];return db[_0x8216('0x51')][_0x8216('0x52')]({'where':{'id':_0x2ee783[_0x8216('0x50')]['id'],'UserId':null}})[_0x8216('0x31')](handleEntityNotFound(_0xefe3c2,null))['then'](saveUpdates(_0x2ee783[_0x8216('0x54')],null))[_0x8216('0x31')](function(_0x23300c){if(_0x23300c){_0x2bcff2[_0x8216('0x22')]=_0x23300c['get']({'plain':!![]});return db[_0x8216('0x5e')][_0x8216('0x52')]({'where':{'id':_0x23300c[_0x8216('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0xefe3c2,null))[_0x8216('0x31')](function(_0x583d46){if(_0x583d46){return _0x583d46[_0x8216('0x30')]({'UserId':_0x2ee783['body'][_0x8216('0x5c')],'read1stAt':_[_0x8216('0x60')](_0x583d46[_0x8216('0x61')])?moment()['format'](_0x8216('0x5b')):undefined});}return null;})[_0x8216('0x31')](function(_0x146259){if(_0x146259){_0x2bcff2['interaction']=_0x146259[_0x8216('0x62')]({'plain':!![]});interaction_log['info'](_0x8216('0x63'),_0x2ee783[_0x8216('0x64')]['id'],_0x2ee783[_0x8216('0x64')][_0x8216('0x34')],_0x2ee783[_0x8216('0x64')][_0x8216('0x65')],_0x2bcff2[_0x8216('0x66')]['id'],_0x2ee783['body']?JSON[_0x8216('0x67')](_0x2ee783[_0x8216('0x54')]):'null');return respondWithRpcPromise(_0x8216('0x68'),_0x8216('0x69'),_0x2bcff2);}return null;})[_0x8216('0x31')](function(_0x34a2e5){var _0xbf0490=_0x8216('0x6a')+_0x34a2e5[_0x8216('0x22')][_0x8216('0x6b')];return db['sequelize'][_0x8216('0x3b')](_0xbf0490,{'type':db[_0x8216('0x6c')][_0x8216('0x6d')][_0x8216('0x6e')],'raw':!![]})[_0x8216('0x31')](function(_0x39d27f){return _0x39d27f;});})['then'](function(_0x14d780){if(_0x14d780){_0x2bcff2['message']['contact']=_0x14d780[0x0];if(!_0x2ee783[_0x8216('0x54')]['UserId'])return;return db['User'][_0x8216('0x52')]({'where':{'id':_0x2ee783[_0x8216('0x54')][_0x8216('0x5c')],'role':_0x8216('0x5d')},'attributes':['id',_0x8216('0x34'),_0x8216('0x6f'),_0x8216('0x70'),_0x8216('0x71')],'raw':!![]});}return null;})[_0x8216('0x31')](function(_0x5ed69b){if(!_0x5ed69b)return null;_0x2bcff2[_0x8216('0x22')]['agent']=_0x5ed69b;return _0x2bcff2;})[_0x8216('0x31')](function(_0x16e990){if(_0x16e990){if(_0x2ee783[_0x8216('0x54')][_0x8216('0x72')]){_0x2bcff2['message']['interface']=util['format'](_0x8216('0x73'),_0x2ee783[_0x8216('0x64')]['name']);_0x2bcff2['message'][_0x8216('0x74')]=_0x2bcff2[_0x8216('0x74')];_0x2bcff2['message'][_0x8216('0x75')]=_0x2bcff2['channel'];_0x2bcff2[_0x8216('0x22')][_0x8216('0x76')]=_0x8216('0x56');return respondWithRpcPromise(_0x8216('0x77'),_0x8216('0x77'),{'event':_0x8216('0x78'),'message':_0x2bcff2[_0x8216('0x22')]},client9002)[_0x8216('0x31')](function(){return _0x2bcff2;});}return _0x2bcff2;}return null;})[_0x8216('0x31')](respondWithResult(_0xefe3c2,null))[_0x8216('0x4e')](handleError(_0xefe3c2,null));};var interaction_log=require(_0x8216('0x11'))(_0x8216('0x79'));exports[_0x8216('0x2e')]=function(_0x1a8475,_0x47e70f,_0x8b7ad3){var _0x52e4e4={'agent':{},'channel':_0x8216('0x57')};if(_0x1a8475[_0x8216('0x54')]['id']){delete _0x1a8475['body']['id'];}_0x1a8475[_0x8216('0x54')][_0x8216('0x5c')]=_0x1a8475[_0x8216('0x54')]['UserId']||_0x1a8475['user']['id'];_0x52e4e4[_0x8216('0x5d')]['id']=_0x1a8475[_0x8216('0x54')][_0x8216('0x5c')];return db['OpenchannelMessage'][_0x8216('0x52')]({'where':{'id':_0x1a8475[_0x8216('0x50')]['id'],'UserId':null}})[_0x8216('0x31')](handleEntityNotFound(_0x47e70f,null))['then'](function(_0xf22561){if(_0xf22561){_0x52e4e4[_0x8216('0x22')]=_0xf22561[_0x8216('0x62')]({'plain':!![]});return db[_0x8216('0x5e')][_0x8216('0x52')]({'where':{'id':_0xf22561[_0x8216('0x5f')]}});}return null;})[_0x8216('0x31')](handleEntityNotFound(_0x47e70f,null))[_0x8216('0x31')](function(_0x1b121c){if(_0x1b121c){_0x52e4e4['interaction']=_0x1b121c[_0x8216('0x62')]({'plain':!![]});interaction_log[_0x8216('0x1d')](_0x8216('0x7a'),_0x1a8475['user']['id'],_0x1a8475[_0x8216('0x64')][_0x8216('0x34')],_0x1a8475[_0x8216('0x64')][_0x8216('0x65')],_0x52e4e4['interaction']['id'],_0x1a8475[_0x8216('0x54')]?JSON[_0x8216('0x67')](_0x1a8475[_0x8216('0x54')]):_0x8216('0x7b'));return respondWithRpcPromise(_0x8216('0x7c'),_0x8216('0x7d'),_0x52e4e4);}return null;})['then'](function(_0x4297c0){var _0x21369e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4297c0[_0x8216('0x22')][_0x8216('0x6b')];return db[_0x8216('0x7e')]['query'](_0x21369e,{'type':db[_0x8216('0x6c')][_0x8216('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x5ba73e){return _0x5ba73e;});})['then'](function(_0x40892a){if(_0x40892a){_0x52e4e4[_0x8216('0x22')][_0x8216('0x7f')]=_0x40892a[0x0];if(!_0x1a8475[_0x8216('0x54')][_0x8216('0x5c')])return;return db[_0x8216('0x80')][_0x8216('0x52')]({'where':{'id':_0x1a8475['body'][_0x8216('0x5c')],'role':'agent'},'attributes':['id','name',_0x8216('0x6f'),'email',_0x8216('0x71')],'raw':!![]});}return null;})['then'](function(_0x38b175){if(!_0x38b175)return null;_0x52e4e4['message'][_0x8216('0x5d')]=_0x38b175;return _0x52e4e4;})[_0x8216('0x31')](function(_0x38e311){if(_0x38e311){_0x38e311[_0x8216('0x22')][_0x8216('0x81')]=util['format'](_0x8216('0x73'),_0x1a8475[_0x8216('0x64')]['name']);_0x38e311['message']['channel']=_0x52e4e4[_0x8216('0x74')];_0x38e311[_0x8216('0x22')]['motionChannel']=_0x52e4e4['channel'];_0x38e311[_0x8216('0x22')]['event']=_0x8216('0x2e');respondWithRpcPromise(_0x8216('0x77'),'EventManager',{'event':_0x8216('0x82'),'message':_0x38e311[_0x8216('0x22')]},client9002);return _0x52e4e4;}return null;})[_0x8216('0x31')](respondWithResult(_0x47e70f,null))[_0x8216('0x4e')](handleError(_0x47e70f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c06cd77..db84508 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 _0xe25f=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xe25f,0x119));var _0xfe25=function(_0x39db3d,_0x39a60d){_0x39db3d=_0x39db3d-0x0;var _0x39b5e1=_0xe25f[_0x39db3d];return _0x39b5e1;};'use strict';var EventEmitter=require(_0xfe25('0x0'));var OpenchannelMessage=require(_0xfe25('0x1'))['db'][_0xfe25('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfe25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe25('0x4'),'afterDestroy':_0xfe25('0x5')};function emitEvent(_0x3d0f03){return function(_0x2d41e2,_0x4cd28a,_0x192d54){OpenchannelMessageEvents[_0xfe25('0x6')](_0x3d0f03+':'+_0x2d41e2['id'],_0x2d41e2);OpenchannelMessageEvents[_0xfe25('0x6')](_0x3d0f03,_0x2d41e2);_0x192d54(null);};}for(var e in events){if(events[_0xfe25('0x7')](e)){var event=events[e];OpenchannelMessage[_0xfe25('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xe83d=['update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x23e5fd,_0x2c6da6){var _0xab592b=function(_0x75559a){while(--_0x75559a){_0x23e5fd['push'](_0x23e5fd['shift']());}};_0xab592b(++_0x2c6da6);}(_0xe83d,0x1ac));var _0xde83=function(_0x3b0fcd,_0x2c6ea5){_0x3b0fcd=_0x3b0fcd-0x0;var _0x534db1=_0xe83d[_0x3b0fcd];return _0x534db1;};'use strict';var EventEmitter=require(_0xde83('0x0'));var OpenchannelMessage=require(_0xde83('0x1'))['db'][_0xde83('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xde83('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde83('0x4'),'afterDestroy':_0xde83('0x5')};function emitEvent(_0x142862){return function(_0x22ad90,_0x3d7a8e,_0x16f3de){OpenchannelMessageEvents['emit'](_0x142862+':'+_0x22ad90['id'],_0x22ad90);OpenchannelMessageEvents[_0xde83('0x6')](_0x142862,_0x22ad90);_0x16f3de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xde83('0x7')](e,emitEvent(event));}}module[_0xde83('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 27fc5bb..f7b5a7a 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 _0xa571=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions'];(function(_0x196cc3,_0x3e4899){var _0x5b4f97=function(_0x37ede4){while(--_0x37ede4){_0x196cc3['push'](_0x196cc3['shift']());}};_0x5b4f97(++_0x3e4899);}(_0xa571,0x107));var _0x1a57=function(_0x1c7382,_0x3b7223){_0x1c7382=_0x1c7382-0x0;var _0x13f9e8=_0xa571[_0x1c7382];return _0x13f9e8;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1a57('0xb')],'type':_0x1a57('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3631d6,_0x58e266,_0x3c8182){var _0x1f7086=_0xd97a33[_0x1a57('0xd')];var _0x289dc0=_0x3631d6[_0x1a57('0xe')]({'plain':!![]});if(_0x289dc0[_0x1a57('0xf')][_0x1a57('0x10')]()==='in'||_0x289dc0[_0x1a57('0xf')]['toLowerCase']()==='out'&&!_0x289dc0[_0x1a57('0x11')]&&!_[_0x1a57('0x12')](_0x289dc0[_0x1a57('0x13')])){_0x1f7086['OpenchannelInteraction'][_0x1a57('0x14')]({'where':{'id':_0x289dc0[_0x1a57('0x15')]}})['then'](function(_0x503278){if(_0x503278){_0x503278['update']({'lastMsgAt':_0x289dc0[_0x1a57('0x16')],'lastMsgDirection':_0x289dc0[_0x1a57('0xf')][_0x1a57('0x10')]()});}})[_0x1a57('0x17')](function(_0x5802d6){console[_0x1a57('0x18')](_0x5802d6);});}if(_0x289dc0['direction']==='out'&&!_0x289dc0[_0x1a57('0x11')]){var _0x1c537f;_0x1f7086[_0x1a57('0x19')]['describe']()[_0x1a57('0x1a')](function(_0x1662a3){return _0x1f7086[_0x1a57('0x1b')]['find']({'where':{'id':_0x289dc0[_0x1a57('0x1c')]},'include':[{'model':_0x1f7086[_0x1a57('0x1d')],'as':_0x1a57('0x1e'),'where':{'id':_0x289dc0[_0x1a57('0x15')]},'limit':0x1,'include':[{'model':_0x1f7086[_0x1a57('0x19')],'as':'Contact','attributes':_['keys'](_0x1662a3)}]}]});})[_0x1a57('0x1a')](function(_0x21e811){_0x1c537f=_0x21e811[_0x1a57('0xe')]({'plain':!![]});if(_0x1c537f&&_0x1c537f['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1a57('0x1f'),util[_0x1a57('0x20')](_0x1a57('0x21'),_0x289dc0['id'],_0x1c537f[_0x1a57('0x22')]));if(_0x1c537f[_0x1a57('0x1e')]&&_0x1c537f[_0x1a57('0x1e')][_0x1a57('0x23')]){_0x289dc0[_0x1a57('0x24')]=_[_0x1a57('0x25')](_0x1c537f[_0x1a57('0x1e')][0x0],_0x1a57('0x26'));_0x289dc0[_0x1a57('0x26')]=_0x1c537f[_0x1a57('0x1e')][0x0][_0x1a57('0x26')];}var _0x58e266={'method':_0x1a57('0x27'),'uri':encodeURI(_0x1c537f[_0x1a57('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58e266[_0x1a57('0x28')]){case _0x1a57('0x29'):_0x58e266['qs']=_0x289dc0;break;case _0x1a57('0x27'):_0x58e266[_0x1a57('0xb')]=_0x289dc0;break;}return rp(_0x58e266)[_0x1a57('0x1a')](function(_0x5a53c8){logger['info'](_0x1a57('0x2a'),_0x1a57('0x1f'),util['format'](_0x1a57('0x2b'),_0x289dc0['id'],_0x1c537f['replyUri']));if(_0x5a53c8[_0x1a57('0xb')][_0x1a57('0x2c')]&&_0x5a53c8['body'][_0x1a57('0x2c')]!=_0x289dc0[_0x1a57('0x24')][_0x1a57('0x2c')]){return _0x1f7086[_0x1a57('0x1d')]['update']({'threadId':_0x5a53c8[_0x1a57('0xb')][_0x1a57('0x2c')]},{'logging':!![],'where':{'id':_0x289dc0[_0x1a57('0x24')]['id']}});}else{return;}})[_0x1a57('0x1a')](function(){return _0x3631d6['update']({'read':!![]});})[_0x1a57('0x17')](function(_0x251a54){logger[_0x1a57('0x18')](_0x1a57('0x2a'),_0x1a57('0x1f'),util[_0x1a57('0x2d')](_0x251a54,{'showHidden':![],'depth':null}));_0x3c8182();});}else{_0x3c8182();}})[_0x1a57('0x2e')](function(){_0x3c8182();});}else{_0x3c8182();}}},'charset':_0x1a57('0x2f'),'collate':_0x1a57('0x30')});}; \ No newline at end of file +var _0xef0f=['POST','method','GET','body','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','omit','Contact'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0xef0f,0x168));var _0xfef0=function(_0x3ed254,_0x1cdd52){_0x3ed254=_0x3ed254-0x0;var _0x46f3f1=_0xef0f[_0x3ed254];return _0x46f3f1;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xfef0('0xb'),'fields':['body'],'type':_0xfef0('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x100e3a,_0x3a81cc,_0x2d42dc){var _0x334e74=_0x2697df[_0xfef0('0xd')];var _0xc177db=_0x100e3a[_0xfef0('0xe')]({'plain':!![]});if(_0xc177db[_0xfef0('0xf')][_0xfef0('0x10')]()==='in'||_0xc177db[_0xfef0('0xf')][_0xfef0('0x10')]()===_0xfef0('0x11')&&!_0xc177db[_0xfef0('0x12')]&&!_['isNil'](_0xc177db[_0xfef0('0x13')])){_0x334e74[_0xfef0('0x14')][_0xfef0('0x15')]({'where':{'id':_0xc177db[_0xfef0('0x16')]}})[_0xfef0('0x17')](function(_0x45599a){if(_0x45599a){_0x45599a[_0xfef0('0x18')]({'lastMsgAt':_0xc177db['createdAt'],'lastMsgDirection':_0xc177db[_0xfef0('0xf')]['toLowerCase']()});}})['catch'](function(_0x5acdd0){console[_0xfef0('0x19')](_0x5acdd0);});}if(_0xc177db[_0xfef0('0xf')]===_0xfef0('0x11')&&!_0xc177db[_0xfef0('0x12')]){var _0x2a96d9;_0x334e74[_0xfef0('0x1a')][_0xfef0('0x1b')]()[_0xfef0('0x17')](function(_0x581459){return _0x334e74[_0xfef0('0x1c')][_0xfef0('0x1d')]({'where':{'id':_0xc177db[_0xfef0('0x1e')]},'include':[{'model':_0x334e74[_0xfef0('0x14')],'as':_0xfef0('0x1f'),'where':{'id':_0xc177db['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x334e74[_0xfef0('0x1a')],'as':'Contact','attributes':_[_0xfef0('0x20')](_0x581459)}]}]});})[_0xfef0('0x17')](function(_0x28dee1){_0x2a96d9=_0x28dee1['get']({'plain':!![]});if(_0x2a96d9&&_0x2a96d9[_0xfef0('0x21')]){logger['info'](_0xfef0('0x22'),_0xfef0('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0xc177db['id'],_0x2a96d9['replyUri']));if(_0x2a96d9[_0xfef0('0x1f')]&&_0x2a96d9['Interactions'][_0xfef0('0x24')]){_0xc177db[_0xfef0('0x25')]=_[_0xfef0('0x26')](_0x2a96d9[_0xfef0('0x1f')][0x0],_0xfef0('0x27'));_0xc177db[_0xfef0('0x27')]=_0x2a96d9['Interactions'][0x0]['Contact'];}var _0x3a81cc={'method':_0xfef0('0x28'),'uri':encodeURI(_0x2a96d9[_0xfef0('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3a81cc[_0xfef0('0x29')]){case _0xfef0('0x2a'):_0x3a81cc['qs']=_0xc177db;break;case _0xfef0('0x28'):_0x3a81cc[_0xfef0('0x2b')]=_0xc177db;break;}return rp(_0x3a81cc)[_0xfef0('0x17')](function(_0x391279){logger['info'](_0xfef0('0x22'),_0xfef0('0x23'),util[_0xfef0('0x2c')](_0xfef0('0x2d'),_0xc177db['id'],_0x2a96d9[_0xfef0('0x21')]));if(_0x391279[_0xfef0('0x2b')][_0xfef0('0x2e')]&&_0x391279[_0xfef0('0x2b')][_0xfef0('0x2e')]!=_0xc177db[_0xfef0('0x25')][_0xfef0('0x2e')]){return _0x334e74[_0xfef0('0x14')]['update']({'threadId':_0x391279[_0xfef0('0x2b')]['threadId']},{'logging':!![],'where':{'id':_0xc177db['Interaction']['id']}});}else{return;}})[_0xfef0('0x17')](function(){return _0x100e3a[_0xfef0('0x18')]({'read':!![]});})['catch'](function(_0x4bbdba){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xfef0('0x2f')](_0x4bbdba,{'showHidden':![],'depth':null}));_0x2d42dc();});}else{_0x2d42dc();}})[_0xfef0('0x30')](function(){_0x2d42dc();});}else{_0x2d42dc();}}},'charset':_0xfef0('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f8736dd..aa743ea 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xe55770,_0x3840cc){var _0x49ce96=function(_0x338a86){while(--_0x338a86){_0xe55770['push'](_0xe55770['shift']());}};_0x49ce96(++_0x3840cc);}(_0x7a54,0x106));var _0x47a5=function(_0x4a593b,_0x25f8b2){_0x4a593b=_0x4a593b-0x0;var _0x408010=_0x7a54[_0x4a593b];return _0x408010;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['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(_0x265fa2,_0x284aaf){var _0x3e7e41=function(_0x45b5cf){while(--_0x45b5cf){_0x265fa2['push'](_0x265fa2['shift']());}};_0x3e7e41(++_0x284aaf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11bc77,_0x5e4b18){_0x11bc77=_0x11bc77-0x0;var _0xa06cbf=_0x5f2f[_0x11bc77];return _0xa06cbf;};'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 13aac61..559eed6 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 _0x0e50=['removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit'];(function(_0x2d6840,_0xa9c39f){var _0x390a5e=function(_0x3990b6){while(--_0x3990b6){_0x2d6840['push'](_0x2d6840['shift']());}};_0x390a5e(++_0xa9c39f);}(_0x0e50,0x168));var _0x00e5=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x0e50[_0x5a776b];return _0xbbef59;};'use strict';var OpenchannelMessageEvents=require(_0x00e5('0x0'));var events=[_0x00e5('0x1'),_0x00e5('0x2'),'update'];function createListener(_0x1b3523,_0xa345ef){return function(_0x4a0533){_0xa345ef[_0x00e5('0x3')](_0x1b3523,_0x4a0533);};}function removeListener(_0x3d2263,_0x4f38ad){return function(){OpenchannelMessageEvents[_0x00e5('0x4')](_0x3d2263,_0x4f38ad);};}exports['register']=function(_0x3efbe7){for(var _0xeb6242=0x0,_0x255aec=events[_0x00e5('0x5')];_0xeb6242<_0x255aec;_0xeb6242++){var _0x40b93e=events[_0xeb6242];var _0x4c91eb=createListener(_0x00e5('0x6')+_0x40b93e,_0x3efbe7);OpenchannelMessageEvents['on'](_0x40b93e,_0x4c91eb);}}; \ No newline at end of file +var _0x0bec=['removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x3d01e4,_0x41546e){var _0x440197=function(_0x229ab7){while(--_0x229ab7){_0x3d01e4['push'](_0x3d01e4['shift']());}};_0x440197(++_0x41546e);}(_0x0bec,0x173));var _0xc0be=function(_0x3e1d58,_0x2d3de0){_0x3e1d58=_0x3e1d58-0x0;var _0x14802b=_0x0bec[_0x3e1d58];return _0x14802b;};'use strict';var OpenchannelMessageEvents=require(_0xc0be('0x0'));var events=[_0xc0be('0x1'),_0xc0be('0x2'),_0xc0be('0x3')];function createListener(_0x15d179,_0x7dcc3b){return function(_0x231709){_0x7dcc3b[_0xc0be('0x4')](_0x15d179,_0x231709);};}function removeListener(_0x566223,_0x4f6eb4){return function(){OpenchannelMessageEvents[_0xc0be('0x5')](_0x566223,_0x4f6eb4);};}exports['register']=function(_0x59c5e4){for(var _0x3a6cef=0x0,_0x2a8c0e=events[_0xc0be('0x6')];_0x3a6cef<_0x2a8c0e;_0x3a6cef++){var _0x72efc1=events[_0x3a6cef];var _0x1ec806=createListener(_0xc0be('0x7')+_0x72efc1,_0x59c5e4);OpenchannelMessageEvents['on'](_0x72efc1,_0x1ec806);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 98047e6..a007fca 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 _0x4eae=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x28547e,_0x100df3){var _0x5382da=function(_0x281bbf){while(--_0x281bbf){_0x28547e['push'](_0x28547e['shift']());}};_0x5382da(++_0x100df3);}(_0x4eae,0x102));var _0xe4ea=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x4eae[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require('multer');var util=require(_0xe4ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4ea('0x1'));var router=express[_0xe4ea('0x2')]();var fs_extra=require(_0xe4ea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ea('0x4'));var config=require(_0xe4ea('0x5'));var controller=require('./openchannelQueue.controller');router[_0xe4ea('0x6')]('/',auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x8')]);router[_0xe4ea('0x6')](_0xe4ea('0x9'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0xa')]);router[_0xe4ea('0x6')](_0xe4ea('0xb'),auth[_0xe4ea('0x7')](),controller['show']);router[_0xe4ea('0x6')](_0xe4ea('0xc'),auth[_0xe4ea('0x7')](),controller['getMembers']);router[_0xe4ea('0x6')](_0xe4ea('0xd'),auth['isAuthenticated'](),controller[_0xe4ea('0xe')]);router[_0xe4ea('0x6')](_0xe4ea('0xf'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x10')]);router[_0xe4ea('0x11')]('/',auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x12')]);router[_0xe4ea('0x11')](_0xe4ea('0xd'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x13')]);router[_0xe4ea('0x11')](_0xe4ea('0xf'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x14')]);router[_0xe4ea('0x15')](_0xe4ea('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe4ea('0x16')](_0xe4ea('0xb'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x17')]);router[_0xe4ea('0x16')](_0xe4ea('0xd'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x18')]);router[_0xe4ea('0x16')](_0xe4ea('0xf'),auth[_0xe4ea('0x7')](),controller[_0xe4ea('0x19')]);module[_0xe4ea('0x1a')]=router; \ No newline at end of file +var _0x8c5e=['get','isAuthenticated','/describe','describe','/:id','show','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller'];(function(_0x5c9c41,_0x10e953){var _0x1ced02=function(_0x52aef9){while(--_0x52aef9){_0x5c9c41['push'](_0x5c9c41['shift']());}};_0x1ced02(++_0x10e953);}(_0x8c5e,0xb6));var _0xe8c5=function(_0x1c120e,_0x7ec399){_0x1c120e=_0x1c120e-0x0;var _0x3d5bb5=_0x8c5e[_0x1c120e];return _0x3d5bb5;};'use strict';var multer=require('multer');var util=require(_0xe8c5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe8c5('0x1'));var router=express[_0xe8c5('0x2')]();var fs_extra=require(_0xe8c5('0x3'));var auth=require(_0xe8c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe8c5('0x5'));var controller=require(_0xe8c5('0x6'));router[_0xe8c5('0x7')]('/',auth[_0xe8c5('0x8')](),controller['index']);router[_0xe8c5('0x7')](_0xe8c5('0x9'),auth[_0xe8c5('0x8')](),controller[_0xe8c5('0xa')]);router[_0xe8c5('0x7')](_0xe8c5('0xb'),auth['isAuthenticated'](),controller[_0xe8c5('0xc')]);router[_0xe8c5('0x7')]('/:id/members',auth[_0xe8c5('0x8')](),controller[_0xe8c5('0xd')]);router[_0xe8c5('0x7')]('/:id/teams',auth[_0xe8c5('0x8')](),controller[_0xe8c5('0xe')]);router[_0xe8c5('0x7')](_0xe8c5('0xf'),auth[_0xe8c5('0x8')](),controller['getAgents']);router[_0xe8c5('0x10')]('/',auth[_0xe8c5('0x8')](),controller[_0xe8c5('0x11')]);router[_0xe8c5('0x10')](_0xe8c5('0x12'),auth[_0xe8c5('0x8')](),controller[_0xe8c5('0x13')]);router[_0xe8c5('0x10')](_0xe8c5('0xf'),auth[_0xe8c5('0x8')](),controller['addAgents']);router[_0xe8c5('0x14')](_0xe8c5('0xb'),auth[_0xe8c5('0x8')](),controller[_0xe8c5('0x15')]);router[_0xe8c5('0x16')](_0xe8c5('0xb'),auth[_0xe8c5('0x8')](),controller[_0xe8c5('0x17')]);router['delete'](_0xe8c5('0x12'),auth['isAuthenticated'](),controller[_0xe8c5('0x18')]);router[_0xe8c5('0x16')](_0xe8c5('0xf'),auth[_0xe8c5('0x8')](),controller[_0xe8c5('0x19')]);module[_0xe8c5('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 0ae03a9..2d055b1 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 _0x4195=['exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x4195,0x1d4));var _0x5419=function(_0x146bf6,_0x3a3461){_0x146bf6=_0x146bf6-0x0;var _0x4af2c3=_0x4195[_0x146bf6];return _0x4af2c3;};'use strict';var Sequelize=require('sequelize');module[_0x5419('0x0')]={'name':{'type':Sequelize[_0x5419('0x1')],'unique':_0x5419('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5419('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5419('0x4'),'beepall',_0x5419('0x5'))}}; \ No newline at end of file +var _0x33b3=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x33b3,0xbb));var _0x333b=function(_0x500396,_0x4fe4ea){_0x500396=_0x500396-0x0;var _0x28093b=_0x33b3[_0x500396];return _0x28093b;};'use strict';var Sequelize=require(_0x333b('0x0'));module[_0x333b('0x1')]={'name':{'type':Sequelize[_0x333b('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x333b('0x2')]},'timeout':{'type':Sequelize[_0x333b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x333b('0x4')](_0x333b('0x5'),_0x333b('0x6'),_0x333b('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9e73a0c..89e00e7 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 _0x1368=['nolimit','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1368,0xc4));var _0x8136=function(_0x83178,_0x20224f){_0x83178=_0x83178-0x0;var _0x2c7776=_0x1368[_0x83178];return _0x2c7776;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8136('0x0'));var zipdir=require(_0x8136('0x1'));var jsonpatch=require(_0x8136('0x2'));var rp=require(_0x8136('0x3'));var moment=require(_0x8136('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8136('0x5'));var path=require(_0x8136('0x6'));var sox=require(_0x8136('0x7'));var csv=require(_0x8136('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8136('0x9'));var _=require(_0x8136('0xa'));var squel=require(_0x8136('0xb'));var crypto=require(_0x8136('0xc'));var jsforce=require(_0x8136('0xd'));var deskjs=require(_0x8136('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8136('0xf'));var Papa=require(_0x8136('0x10'));var Redis=require('ioredis');var authService=require(_0x8136('0x11'));var qs=require(_0x8136('0x12'));var as=require(_0x8136('0x13'));var hardwareService=require(_0x8136('0x14'));var logger=require(_0x8136('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8136('0x16'));var licenseUtil=require(_0x8136('0x17'));var db=require(_0x8136('0x18'))['db'];config[_0x8136('0x19')]=_[_0x8136('0x1a')](config[_0x8136('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8136('0x1b'))(new Redis(config[_0x8136('0x19')]));require(_0x8136('0x1c'))[_0x8136('0x1d')](socket);function respondWithStatusCode(_0x48f05a,_0x3cac26){_0x3cac26=_0x3cac26||0xcc;return function(_0x452d61){if(_0x452d61){return _0x48f05a['sendStatus'](_0x3cac26);}return _0x48f05a[_0x8136('0x1e')](_0x3cac26)[_0x8136('0x1f')]();};}function respondWithResult(_0x383bb5,_0x2c7339){_0x2c7339=_0x2c7339||0xc8;return function(_0x4a834c){if(_0x4a834c){return _0x383bb5[_0x8136('0x1e')](_0x2c7339)[_0x8136('0x20')](_0x4a834c);}};}function respondWithFilteredResult(_0x4c3e31,_0x113f25){return function(_0x511d29){if(_0x511d29){var _0xe0c330=typeof _0x113f25[_0x8136('0x21')]===_0x8136('0x22')&&typeof _0x113f25[_0x8136('0x23')]===_0x8136('0x22');var _0x2ee197=_0x511d29[_0x8136('0x24')];var _0x582105=_0xe0c330?0x0:_0x113f25[_0x8136('0x21')];var _0xadf415=_0xe0c330?_0x511d29[_0x8136('0x24')]:_0x113f25['offset']+_0x113f25[_0x8136('0x23')];var _0x3c02d8;if(_0xadf415>=_0x2ee197){_0xadf415=_0x2ee197;_0x3c02d8=0xc8;}else{_0x3c02d8=0xce;}_0x4c3e31[_0x8136('0x1e')](_0x3c02d8);return _0x4c3e31[_0x8136('0x25')](_0x8136('0x26'),_0x582105+'-'+_0xadf415+'/'+_0x2ee197)[_0x8136('0x20')](_0x511d29);}return null;};}function patchUpdates(_0x3f7d51){return function(_0x1f3be6){try{jsonpatch[_0x8136('0x27')](_0x1f3be6,_0x3f7d51,!![]);}catch(_0x3c3cd5){return BPromise[_0x8136('0x28')](_0x3c3cd5);}return _0x1f3be6['save']();};}function saveUpdates(_0x2097a3,_0x43ecc3){return function(_0x4e88b8){if(_0x4e88b8){return _0x4e88b8[_0x8136('0x29')](_0x2097a3)[_0x8136('0x2a')](function(_0x14b034){return _0x14b034;});}return null;};}function removeEntity(_0x2593c7,_0xbcc912){return function(_0x178344){if(_0x178344){return _0x178344[_0x8136('0x2b')]()[_0x8136('0x2a')](function(){var _0x3a3c42=_0x178344['get']({'plain':!![]});var _0x54f3be=_0x8136('0x2c');return db[_0x8136('0x2d')][_0x8136('0x2b')]({'where':{'type':_0x54f3be,'resourceId':_0x3a3c42['id']}})[_0x8136('0x2a')](function(){return _0x178344;});})['then'](function(){_0x2593c7['status'](0xcc)[_0x8136('0x1f')]();});}};}function handleEntityNotFound(_0x759cf6,_0x2daf07){return function(_0x329fb2){if(!_0x329fb2){_0x759cf6[_0x8136('0x2e')](0x194);}return _0x329fb2;};}function handleError(_0x2e9e9a,_0x45303c){_0x45303c=_0x45303c||0x1f4;return function(_0x8fc0de){logger['error'](_0x8fc0de[_0x8136('0x2f')]);if(_0x8fc0de[_0x8136('0x30')]){delete _0x8fc0de[_0x8136('0x30')];}_0x2e9e9a[_0x8136('0x1e')](_0x45303c)[_0x8136('0x31')](_0x8fc0de);};}exports[_0x8136('0x32')]=function(_0x13b5f6,_0x4e34f0){var _0x3f3e86={},_0x145405={},_0x52306b={'count':0x0,'rows':[]};var _0x255f79=_[_0x8136('0x33')](db[_0x8136('0x34')][_0x8136('0x35')],function(_0x4f365f){return{'name':_0x4f365f[_0x8136('0x36')],'type':_0x4f365f[_0x8136('0x37')][_0x8136('0x38')]};});_0x145405[_0x8136('0x39')]=_[_0x8136('0x33')](_0x255f79,'name');_0x145405[_0x8136('0x3a')]=_[_0x8136('0x3b')](_0x13b5f6[_0x8136('0x3a')]);_0x145405[_0x8136('0x3c')]=_[_0x8136('0x3d')](_0x145405[_0x8136('0x39')],_0x145405['query']);_0x3f3e86['attributes']=_['intersection'](_0x145405[_0x8136('0x39')],qs[_0x8136('0x3e')](_0x13b5f6['query']['fields']));_0x3f3e86[_0x8136('0x3f')]=_0x3f3e86[_0x8136('0x3f')][_0x8136('0x40')]?_0x3f3e86[_0x8136('0x3f')]:_0x145405[_0x8136('0x39')];if(!_0x13b5f6[_0x8136('0x3a')][_0x8136('0x41')]('nolimit')){_0x3f3e86[_0x8136('0x23')]=qs[_0x8136('0x23')](_0x13b5f6[_0x8136('0x3a')][_0x8136('0x23')]);_0x3f3e86[_0x8136('0x21')]=qs['offset'](_0x13b5f6['query'][_0x8136('0x21')]);}_0x3f3e86[_0x8136('0x42')]=qs[_0x8136('0x43')](_0x13b5f6[_0x8136('0x3a')][_0x8136('0x43')]);_0x3f3e86[_0x8136('0x44')]=qs[_0x8136('0x3c')](_[_0x8136('0x45')](_0x13b5f6[_0x8136('0x3a')],_0x145405[_0x8136('0x3c')]),_0x255f79);if(_0x13b5f6[_0x8136('0x3a')]['filter']){_0x3f3e86['where']=_[_0x8136('0x46')](_0x3f3e86[_0x8136('0x44')],{'$or':_['map'](_0x255f79,function(_0x402d82){if(_0x402d82['type']!==_0x8136('0x47')){var _0x39a51f={};_0x39a51f[_0x402d82['name']]={'$like':'%'+_0x13b5f6['query']['filter']+'%'};return _0x39a51f;}})});}_0x3f3e86=_[_0x8136('0x46')]({},_0x3f3e86,_0x13b5f6['options']);var _0xdbc29b={'where':_0x3f3e86['where']};return db[_0x8136('0x34')][_0x8136('0x24')](_0xdbc29b)[_0x8136('0x2a')](function(_0x45dcdd){_0x52306b[_0x8136('0x24')]=_0x45dcdd;if(_0x13b5f6[_0x8136('0x3a')][_0x8136('0x48')]){_0x3f3e86[_0x8136('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8136('0x4a')](_0x3f3e86);})[_0x8136('0x2a')](function(_0x49f235){_0x52306b['rows']=_0x49f235;return _0x52306b;})[_0x8136('0x2a')](respondWithFilteredResult(_0x4e34f0,_0x3f3e86))[_0x8136('0x4b')](handleError(_0x4e34f0,null));};exports[_0x8136('0x4c')]=function(_0x44ff03,_0x33a31b){var _0x1cfff1={'raw':!![],'where':{'id':_0x44ff03[_0x8136('0x4d')]['id']}},_0x161091={};_0x161091['model']=_[_0x8136('0x3b')](db['OpenchannelQueue']['rawAttributes']);_0x161091[_0x8136('0x3a')]=_[_0x8136('0x3b')](_0x44ff03[_0x8136('0x3a')]);_0x161091[_0x8136('0x3c')]=_[_0x8136('0x3d')](_0x161091['model'],_0x161091[_0x8136('0x3a')]);_0x1cfff1[_0x8136('0x3f')]=_['intersection'](_0x161091['model'],qs[_0x8136('0x3e')](_0x44ff03['query'][_0x8136('0x3e')]));_0x1cfff1[_0x8136('0x3f')]=_0x1cfff1['attributes'][_0x8136('0x40')]?_0x1cfff1[_0x8136('0x3f')]:_0x161091[_0x8136('0x39')];if(_0x44ff03[_0x8136('0x3a')][_0x8136('0x48')]){_0x1cfff1['include']=[{'all':!![]}];}_0x1cfff1=_[_0x8136('0x46')]({},_0x1cfff1,_0x44ff03[_0x8136('0x4e')]);return db[_0x8136('0x34')][_0x8136('0x4f')](_0x1cfff1)[_0x8136('0x2a')](handleEntityNotFound(_0x33a31b,null))[_0x8136('0x2a')](respondWithResult(_0x33a31b,null))[_0x8136('0x4b')](handleError(_0x33a31b,null));};exports[_0x8136('0x50')]=function(_0x5181a0,_0x6a5b90){return db['OpenchannelQueue'][_0x8136('0x50')](_0x5181a0['body'],{})['then'](function(_0x146b7a){var _0x42b634=_0x5181a0[_0x8136('0x51')]['get']({'plain':!![]});if(!_0x42b634)throw new Error(_0x8136('0x52'));if(_0x42b634['role']===_0x8136('0x51')){var _0x3b1a37=_0x146b7a[_0x8136('0x53')]({'plain':!![]});var _0x478c07='OpenchannelQueues';return db[_0x8136('0x54')][_0x8136('0x4f')]({'where':{'name':_0x478c07,'userProfileId':_0x42b634['userProfileId']},'raw':!![]})[_0x8136('0x2a')](function(_0x2913aa){if(_0x2913aa&&_0x2913aa[_0x8136('0x55')]===0x0){return db[_0x8136('0x2d')][_0x8136('0x50')]({'name':_0x3b1a37[_0x8136('0x30')],'resourceId':_0x3b1a37['id'],'type':_0x2913aa[_0x8136('0x30')],'sectionId':_0x2913aa['id']},{})[_0x8136('0x2a')](function(){return _0x146b7a;});}else{return _0x146b7a;}})[_0x8136('0x4b')](function(_0x29d1a1){logger['error'](_0x8136('0x56'),_0x29d1a1);throw _0x29d1a1;});}return _0x146b7a;})[_0x8136('0x2a')](respondWithResult(_0x6a5b90,0xc9))['catch'](handleError(_0x6a5b90,null));};exports[_0x8136('0x29')]=function(_0x4c8f56,_0x215b23){if(_0x4c8f56[_0x8136('0x57')]['id']){delete _0x4c8f56[_0x8136('0x57')]['id'];}return db[_0x8136('0x34')][_0x8136('0x4f')]({'where':{'id':_0x4c8f56[_0x8136('0x4d')]['id']}})['then'](handleEntityNotFound(_0x215b23,null))[_0x8136('0x2a')](saveUpdates(_0x4c8f56[_0x8136('0x57')],null))[_0x8136('0x2a')](respondWithResult(_0x215b23,null))['catch'](handleError(_0x215b23,null));};exports[_0x8136('0x2b')]=function(_0x40fc33,_0x55a4e6){return db[_0x8136('0x34')][_0x8136('0x4f')]({'where':{'id':_0x40fc33[_0x8136('0x4d')]['id']}})[_0x8136('0x2a')](handleEntityNotFound(_0x55a4e6,null))[_0x8136('0x2a')](removeEntity(_0x55a4e6,null))['catch'](handleError(_0x55a4e6,null));};exports[_0x8136('0x58')]=function(_0x2a40ce,_0x571a0e){return db[_0x8136('0x34')][_0x8136('0x58')]()[_0x8136('0x2a')](respondWithResult(_0x571a0e,null))[_0x8136('0x4b')](handleError(_0x571a0e,null));};exports[_0x8136('0x59')]=function(_0x4743ca,_0x332560,_0x218ece){var _0x15e56f={'raw':!![],'where':{}},_0x22e258={},_0x373fc5;return db['OpenchannelQueue'][_0x8136('0x5a')]({'where':{'id':_0x4743ca[_0x8136('0x4d')]['id']}})[_0x8136('0x2a')](handleEntityNotFound(_0x332560,null))['then'](function(_0x3bd2de){if(_0x3bd2de){_0x373fc5=_0x3bd2de[_0x8136('0x53')]({'plain':!![]});_0x22e258[_0x8136('0x39')]=_[_0x8136('0x3b')](db[_0x8136('0x5b')]['rawAttributes']);_0x22e258['query']=_['keys'](_0x4743ca['query']);_0x22e258[_0x8136('0x3c')]=_[_0x8136('0x3d')](_0x22e258[_0x8136('0x39')],_0x22e258[_0x8136('0x3a')]);_0x15e56f[_0x8136('0x3f')]=_[_0x8136('0x3d')](_0x22e258[_0x8136('0x39')],qs['fields'](_0x4743ca['query']['fields']));_0x15e56f[_0x8136('0x3f')]=_0x15e56f[_0x8136('0x3f')][_0x8136('0x40')]?_0x15e56f[_0x8136('0x3f')]:_0x22e258['model'];if(!_0x4743ca[_0x8136('0x3a')][_0x8136('0x41')](_0x8136('0x5c'))){_0x15e56f[_0x8136('0x23')]=qs[_0x8136('0x23')](_0x4743ca['query'][_0x8136('0x23')]);_0x15e56f[_0x8136('0x21')]=qs[_0x8136('0x21')](_0x4743ca[_0x8136('0x3a')][_0x8136('0x21')]);}_0x15e56f[_0x8136('0x42')]=qs[_0x8136('0x43')](_0x4743ca[_0x8136('0x3a')][_0x8136('0x43')]);_0x15e56f[_0x8136('0x44')]=qs[_0x8136('0x3c')](_['pick'](_0x4743ca[_0x8136('0x3a')],_0x22e258[_0x8136('0x3c')]));_0x15e56f[_0x8136('0x44')]['OpenchannelQueueId']=_0x3bd2de['id'];if(_0x4743ca['query'][_0x8136('0x5d')]){_0x15e56f[_0x8136('0x44')]=_[_0x8136('0x46')](_0x15e56f[_0x8136('0x44')],{'$or':_['map'](_0x15e56f[_0x8136('0x3f')],function(_0x3375d2){var _0x4b0c8={};_0x4b0c8[_0x3375d2]={'$like':'%'+_0x4743ca[_0x8136('0x3a')][_0x8136('0x5d')]+'%'};return _0x4b0c8;})});}_0x15e56f=_[_0x8136('0x46')]({},_0x15e56f,_0x4743ca[_0x8136('0x4e')]);return db[_0x8136('0x5b')][_0x8136('0x4a')](_0x15e56f);}})['then'](function(_0x534513){if(_0x534513){return db[_0x8136('0x5e')][_0x8136('0x5f')]({'where':{'id':_[_0x8136('0x33')](_0x534513,_0x8136('0x60')),'role':_0x8136('0x61')},'attributes':['id',_0x8136('0x30'),_0x8136('0x62'),_0x8136('0x63'),'createdAt']});}})['then'](function(_0x504789){if(_0x504789){return{'count':_0x504789[_0x8136('0x24')],'rows':_[_0x8136('0x33')](_0x504789[_0x8136('0x64')],function(_0x20875d){return{'membername':_0x20875d['name'],'UserId':_0x20875d['id'],'queue_name':_0x373fc5[_0x8136('0x30')],'OpenchannelQueueId':_0x373fc5['id'],'interface':util[_0x8136('0x65')](_0x8136('0x66'),_0x8136('0x67'),_0x20875d[_0x8136('0x30')]),'penalty':0x0,'paused':_0x20875d[_0x8136('0x62')],'createdAt':_0x20875d[_0x8136('0x68')],'updatedAt':_0x20875d[_0x8136('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8136('0x2a')](respondWithFilteredResult(_0x332560,_0x15e56f))['catch'](handleError(_0x332560,null));};exports['getTeams']=function(_0x2f1f81,_0x22da0b,_0x22c79d){var _0x406065={};var _0x5bfdb3={};var _0x49bfad;var _0x54f347;return db[_0x8136('0x34')][_0x8136('0x5a')]({'where':{'id':_0x2f1f81[_0x8136('0x4d')]['id']}})[_0x8136('0x2a')](handleEntityNotFound(_0x22da0b,null))[_0x8136('0x2a')](function(_0x512047){if(_0x512047){_0x49bfad=_0x512047;_0x5bfdb3[_0x8136('0x39')]=_[_0x8136('0x3b')](db[_0x8136('0x69')]['rawAttributes']);_0x5bfdb3[_0x8136('0x3a')]=_[_0x8136('0x3b')](_0x2f1f81[_0x8136('0x3a')]);_0x5bfdb3[_0x8136('0x3c')]=_[_0x8136('0x3d')](_0x5bfdb3[_0x8136('0x39')],_0x5bfdb3['query']);_0x406065[_0x8136('0x3f')]=_[_0x8136('0x3d')](_0x5bfdb3[_0x8136('0x39')],qs[_0x8136('0x3e')](_0x2f1f81[_0x8136('0x3a')][_0x8136('0x3e')]));_0x406065[_0x8136('0x3f')]=_0x406065['attributes'][_0x8136('0x40')]?_0x406065['attributes']:_0x5bfdb3[_0x8136('0x39')];_0x406065['order']=qs[_0x8136('0x43')](_0x2f1f81['query'][_0x8136('0x43')]);_0x406065['where']=qs['filters'](_[_0x8136('0x45')](_0x2f1f81[_0x8136('0x3a')],_0x5bfdb3[_0x8136('0x3c')]));if(_0x2f1f81[_0x8136('0x3a')][_0x8136('0x5d')]){_0x406065[_0x8136('0x44')]=_['merge'](_0x406065[_0x8136('0x44')],{'$or':_[_0x8136('0x33')](_0x406065[_0x8136('0x3f')],function(_0x1d3532){var _0x3d061c={};_0x3d061c[_0x1d3532]={'$like':'%'+_0x2f1f81[_0x8136('0x3a')][_0x8136('0x5d')]+'%'};return _0x3d061c;})});}_0x406065=_[_0x8136('0x46')]({},_0x406065,_0x2f1f81[_0x8136('0x4e')]);return _0x49bfad[_0x8136('0x6a')](_0x406065);}})[_0x8136('0x2a')](function(_0x2f8630){if(_0x2f8630){_0x54f347=_0x2f8630[_0x8136('0x40')];if(!_0x2f1f81[_0x8136('0x3a')]['hasOwnProperty'](_0x8136('0x5c'))){_0x406065[_0x8136('0x23')]=qs[_0x8136('0x23')](_0x2f1f81['query'][_0x8136('0x23')]);_0x406065['offset']=qs[_0x8136('0x21')](_0x2f1f81[_0x8136('0x3a')][_0x8136('0x21')]);}return _0x49bfad['getTeams'](_0x406065);}})[_0x8136('0x2a')](function(_0x1d3a24){if(_0x1d3a24){return _0x1d3a24?{'count':_0x54f347,'rows':_0x1d3a24}:null;}})[_0x8136('0x2a')](respondWithResult(_0x22da0b,null))[_0x8136('0x4b')](handleError(_0x22da0b,null));};exports[_0x8136('0x6b')]=function(_0x4f27da,_0x39c1c3,_0x3c9f0d){var _0x26d855=_0x4f27da[_0x8136('0x57')][_0x8136('0x6c')];return db[_0x8136('0x69')][_0x8136('0x4a')]({'where':{'id':_0x26d855},'attributes':['id'],'include':[{'model':db[_0x8136('0x5e')],'as':_0x8136('0x6d'),'attributes':['id',_0x8136('0x30'),_0x8136('0x6e'),_0x8136('0x6f'),'interface'],'raw':!![]}]})[_0x8136('0x2a')](function(_0x116cd5){if(_0x116cd5){var _0x237122=_[_0x8136('0x70')](_0x116cd5,function(_0x5d6dfd){var _0x471285=_0x5d6dfd['get']({'plain':!![]});return _0x471285['Agents'];});return db[_0x8136('0x34')][_0x8136('0x4f')]({'where':{'id':_0x4f27da[_0x8136('0x4d')]['id']}})['then'](function(_0x16fb46){return db[_0x8136('0x71')][_0x8136('0x72')](function(_0x5ec0d6){return _0x16fb46['addTeams'](_0x26d855,{'transaction':_0x5ec0d6})[_0x8136('0x2a')](function(){return BPromise['each'](_0x237122,function(_0x383ab3){return db[_0x8136('0x5b')][_0x8136('0x73')]({'where':{'UserId':_0x383ab3['id'],'OpenchannelQueueId':_0x4f27da[_0x8136('0x4d')]['id']},'transaction':_0x5ec0d6});});})[_0x8136('0x2a')](function(){_0x237122[_0x8136('0x74')](function(_0x1f4fc1){socket[_0x8136('0x75')](_0x8136('0x76'),{'UserId':_0x1f4fc1['id'],'OpenchannelQueueId':_0x16fb46['id']});});});});});}})[_0x8136('0x2a')](respondWithStatusCode(_0x39c1c3,null))['catch'](handleError(_0x39c1c3,null));};exports[_0x8136('0x77')]=function(_0x2c13fe,_0x4e21a0,_0xa06a34){return db[_0x8136('0x69')][_0x8136('0x4a')]({'where':{'id':_0x2c13fe[_0x8136('0x3a')][_0x8136('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x8136('0x5e')],'as':_0x8136('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4e21a0,null))['then'](function(_0x2ddbb0){var _0x5f55bd=_[_0x8136('0x33')](_0x2ddbb0,'id');var _0x2e699=[];var _0x4659e4=[];var _0x307783=squel[_0x8136('0x78')]();_0x307783[_0x8136('0x79')]('tq.TeamId')[_0x8136('0x7a')](_0x8136('0x7b'),'tq')['join'](_0x8136('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8136('0x44')]('OpenchannelQueueId\x20=\x20?',_0x2c13fe[_0x8136('0x4d')]['id']);for(var _0x388bdb=0x0;_0x388bdb<_0x2ddbb0[_0x8136('0x40')];_0x388bdb+=0x1){let _0xac6dc4=_0x2ddbb0[_0x388bdb];for(var _0x39d3f1=0x0;_0x39d3f1<_0xac6dc4[_0x8136('0x6d')]['length'];_0x39d3f1+=0x1){let _0x51c029=_0xac6dc4[_0x8136('0x6d')][_0x39d3f1];var _0x45970c=_0x307783['clone']();_0x45970c['where'](_0x8136('0x7d'),_0x51c029['id']);_0x4659e4[_0x8136('0x7e')](db[_0x8136('0x71')][_0x8136('0x3a')](_0x45970c[_0x8136('0x7f')](),{'type':db[_0x8136('0x71')][_0x8136('0x80')]['SELECT']})[_0x8136('0x2a')](function(_0x3f1e50){if(_0x3f1e50[_0x8136('0x40')]===0x1){return _0x51c029['id'];}else{var _0x56b794=_[_0x8136('0x81')](_[_0x8136('0x33')](_0x3f1e50,_0x8136('0x82')),function(_0x53c3b0){return _[_0x8136('0x83')](_0x5f55bd,_0x53c3b0);});if(_0x56b794){return _0x51c029['id'];}}}));}}return BPromise[_0x8136('0x84')](_0x4659e4)['then'](function(_0x7f1f38){_0x2e699=_(_0x2e699)[_0x8136('0x85')](_0x7f1f38)[_0x8136('0x86')]()[_0x8136('0x87')]();return db[_0x8136('0x34')]['find']({'where':{'id':_0x2c13fe['params']['id']}})[_0x8136('0x2a')](function(_0x513b99){return db[_0x8136('0x71')][_0x8136('0x72')](function(_0x42c2fc){return _0x513b99[_0x8136('0x77')](_0x2c13fe[_0x8136('0x3a')][_0x8136('0x6c')],{'transaction':_0x42c2fc})[_0x8136('0x2a')](function(){if(!_[_0x8136('0x88')](_0x2e699)){return _0x513b99[_0x8136('0x89')](_0x2e699,{'transaction':_0x42c2fc});}})[_0x8136('0x2a')](function(){_0x2e699[_0x8136('0x74')](function(_0x94d677){socket[_0x8136('0x75')]('userOpenchannelQueue:remove',{'UserId':_0x94d677,'OpenchannelQueueId':_0x513b99['id']});});});});});});})[_0x8136('0x2a')](respondWithStatusCode(_0x4e21a0,null))['catch'](handleError(_0x4e21a0,null));};exports[_0x8136('0x8a')]=function(_0x32bccb,_0x43ce46,_0x3be951){return db[_0x8136('0x34')]['find']({'where':{'id':_0x32bccb[_0x8136('0x4d')]['id']}})[_0x8136('0x2a')](handleEntityNotFound(_0x43ce46,null))[_0x8136('0x2a')](function(_0x252bef){if(_0x252bef){return _0x252bef['addAgents'](_0x32bccb[_0x8136('0x57')]['ids'],_[_0x8136('0x8b')](_0x32bccb[_0x8136('0x57')],[_0x8136('0x6c'),'id'])||{})[_0x8136('0x8c')](function(_0x415299){for(var _0x589652=0x0;_0x589652<_0x32bccb[_0x8136('0x57')][_0x8136('0x6c')][_0x8136('0x40')];_0x589652+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x32bccb[_0x8136('0x57')][_0x8136('0x6c')][_0x589652]),'OpenchannelQueueId':Number(_0x32bccb['params']['id'])});}return _0x415299;});}})['then'](respondWithResult(_0x43ce46,null))[_0x8136('0x4b')](handleError(_0x43ce46,null));};exports[_0x8136('0x89')]=function(_0x404ee5,_0x1595a2,_0x390818){return db[_0x8136('0x34')][_0x8136('0x4f')]({'where':{'id':_0x404ee5['params']['id']}})[_0x8136('0x2a')](handleEntityNotFound(_0x1595a2,null))['then'](function(_0x582b4d){if(_0x582b4d){return _0x582b4d['removeAgents'](_0x404ee5[_0x8136('0x3a')][_0x8136('0x6c')])[_0x8136('0x2a')](function(){if(_[_0x8136('0x8d')](_0x404ee5['query']['ids'])){for(var _0x22afcb=0x0;_0x22afcb<_0x404ee5['query'][_0x8136('0x6c')][_0x8136('0x40')];_0x22afcb+=0x1){socket[_0x8136('0x75')](_0x8136('0x8e'),{'UserId':Number(_0x404ee5[_0x8136('0x3a')][_0x8136('0x6c')][_0x22afcb]),'OpenchannelQueueId':Number(_0x404ee5[_0x8136('0x4d')]['id'])});}}else{socket[_0x8136('0x75')](_0x8136('0x8e'),{'UserId':Number(_0x404ee5[_0x8136('0x3a')][_0x8136('0x6c')]),'OpenchannelQueueId':Number(_0x404ee5[_0x8136('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1595a2,null))[_0x8136('0x4b')](handleError(_0x1595a2,null));};exports[_0x8136('0x8f')]=function(_0x22bf11,_0x44a02c,_0x54fed6){var _0x4e0714={};var _0x18bd9c={};var _0x53d1b0;var _0x4c65b1;return db[_0x8136('0x34')][_0x8136('0x5a')]({'where':{'id':_0x22bf11['params']['id']}})['then'](handleEntityNotFound(_0x44a02c,null))['then'](function(_0x4998bb){if(_0x4998bb){_0x53d1b0=_0x4998bb;_0x18bd9c[_0x8136('0x39')]=_[_0x8136('0x3b')](db['User'][_0x8136('0x35')]);_0x18bd9c[_0x8136('0x3a')]=_[_0x8136('0x3b')](_0x22bf11['query']);_0x18bd9c[_0x8136('0x3c')]=_[_0x8136('0x3d')](_0x18bd9c[_0x8136('0x39')],_0x18bd9c['query']);_0x4e0714[_0x8136('0x3f')]=_[_0x8136('0x3d')](_0x18bd9c[_0x8136('0x39')],qs[_0x8136('0x3e')](_0x22bf11[_0x8136('0x3a')][_0x8136('0x3e')]));_0x4e0714[_0x8136('0x3f')]=_0x4e0714['attributes']['length']?_0x4e0714['attributes']:_0x18bd9c[_0x8136('0x39')];_0x4e0714[_0x8136('0x42')]=qs[_0x8136('0x43')](_0x22bf11[_0x8136('0x3a')]['sort']);_0x4e0714[_0x8136('0x44')]=qs[_0x8136('0x3c')](_[_0x8136('0x45')](_0x22bf11[_0x8136('0x3a')],_0x18bd9c[_0x8136('0x3c')]));if(_0x22bf11[_0x8136('0x3a')][_0x8136('0x5d')]){_0x4e0714[_0x8136('0x44')]=_['merge'](_0x4e0714[_0x8136('0x44')],{'$or':_[_0x8136('0x33')](_0x4e0714[_0x8136('0x3f')],function(_0x3e6df5){var _0x5132b3={};_0x5132b3[_0x3e6df5]={'$like':'%'+_0x22bf11[_0x8136('0x3a')][_0x8136('0x5d')]+'%'};return _0x5132b3;})});}_0x4e0714=_[_0x8136('0x46')]({},_0x4e0714,_0x22bf11['options']);return _0x53d1b0['getAgents'](_0x4e0714);}})['then'](function(_0x260e04){if(_0x260e04){_0x4c65b1=_0x260e04['length'];if(!_0x22bf11[_0x8136('0x3a')][_0x8136('0x41')]('nolimit')){_0x4e0714[_0x8136('0x23')]=qs[_0x8136('0x23')](_0x22bf11[_0x8136('0x3a')][_0x8136('0x23')]);_0x4e0714[_0x8136('0x21')]=qs[_0x8136('0x21')](_0x22bf11[_0x8136('0x3a')]['offset']);}return _0x53d1b0[_0x8136('0x8f')](_0x4e0714);}})[_0x8136('0x2a')](function(_0x35369c){if(_0x35369c){return _0x35369c?{'count':_0x4c65b1,'rows':_0x35369c}:null;}})[_0x8136('0x2a')](respondWithResult(_0x44a02c,null))[_0x8136('0x4b')](handleError(_0x44a02c,null));}; \ No newline at end of file +var _0x11be=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','OpenchannelQueue','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields'];(function(_0x5925f5,_0x7f29a7){var _0x3f87c6=function(_0x37b8d0){while(--_0x37b8d0){_0x5925f5['push'](_0x5925f5['shift']());}};_0x3f87c6(++_0x7f29a7);}(_0x11be,0xde));var _0xe11b=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x11be[_0x2353fe];return _0x4d43f6;};'use strict';var emlformat=require(_0xe11b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe11b('0x1'));var jsonpatch=require(_0xe11b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe11b('0x3'));var Mustache=require(_0xe11b('0x4'));var util=require('util');var path=require(_0xe11b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe11b('0x6'));var _=require(_0xe11b('0x7'));var squel=require(_0xe11b('0x8'));var crypto=require(_0xe11b('0x9'));var jsforce=require(_0xe11b('0xa'));var deskjs=require(_0xe11b('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe11b('0xc'));var Papa=require(_0xe11b('0xd'));var Redis=require(_0xe11b('0xe'));var authService=require(_0xe11b('0xf'));var qs=require(_0xe11b('0x10'));var as=require(_0xe11b('0x11'));var hardwareService=require(_0xe11b('0x12'));var logger=require(_0xe11b('0x13'))(_0xe11b('0x14'));var utils=require(_0xe11b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe11b('0x16'));var db=require(_0xe11b('0x17'))['db'];config[_0xe11b('0x18')]=_[_0xe11b('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe11b('0x18')]));require(_0xe11b('0x1a'))[_0xe11b('0x1b')](socket);function respondWithStatusCode(_0x5602f1,_0x4bb426){_0x4bb426=_0x4bb426||0xcc;return function(_0x5bdd21){if(_0x5bdd21){return _0x5602f1[_0xe11b('0x1c')](_0x4bb426);}return _0x5602f1[_0xe11b('0x1d')](_0x4bb426)[_0xe11b('0x1e')]();};}function respondWithResult(_0x46224f,_0x2cddd8){_0x2cddd8=_0x2cddd8||0xc8;return function(_0x3652ec){if(_0x3652ec){return _0x46224f[_0xe11b('0x1d')](_0x2cddd8)[_0xe11b('0x1f')](_0x3652ec);}};}function respondWithFilteredResult(_0x2d358a,_0x237f37){return function(_0x4643ea){if(_0x4643ea){var _0x457444=typeof _0x237f37[_0xe11b('0x20')]===_0xe11b('0x21')&&typeof _0x237f37[_0xe11b('0x22')]==='undefined';var _0x354f15=_0x4643ea[_0xe11b('0x23')];var _0x1f455c=_0x457444?0x0:_0x237f37[_0xe11b('0x20')];var _0x53f685=_0x457444?_0x4643ea[_0xe11b('0x23')]:_0x237f37[_0xe11b('0x20')]+_0x237f37[_0xe11b('0x22')];var _0x4cd907;if(_0x53f685>=_0x354f15){_0x53f685=_0x354f15;_0x4cd907=0xc8;}else{_0x4cd907=0xce;}_0x2d358a['status'](_0x4cd907);return _0x2d358a[_0xe11b('0x24')](_0xe11b('0x25'),_0x1f455c+'-'+_0x53f685+'/'+_0x354f15)['json'](_0x4643ea);}return null;};}function patchUpdates(_0x230870){return function(_0x327036){try{jsonpatch[_0xe11b('0x26')](_0x327036,_0x230870,!![]);}catch(_0x2d1f2d){return BPromise[_0xe11b('0x27')](_0x2d1f2d);}return _0x327036[_0xe11b('0x28')]();};}function saveUpdates(_0x3f9a09,_0xd7ff7b){return function(_0x2b3658){if(_0x2b3658){return _0x2b3658['update'](_0x3f9a09)[_0xe11b('0x29')](function(_0x907a27){return _0x907a27;});}return null;};}function removeEntity(_0x529af0,_0x49d2a3){return function(_0x51e861){if(_0x51e861){return _0x51e861[_0xe11b('0x2a')]()[_0xe11b('0x29')](function(){var _0x6cea95=_0x51e861[_0xe11b('0x2b')]({'plain':!![]});var _0x4c23a4=_0xe11b('0x2c');return db[_0xe11b('0x2d')]['destroy']({'where':{'type':_0x4c23a4,'resourceId':_0x6cea95['id']}})['then'](function(){return _0x51e861;});})[_0xe11b('0x29')](function(){_0x529af0['status'](0xcc)[_0xe11b('0x1e')]();});}};}function handleEntityNotFound(_0x570b42,_0x2930b5){return function(_0x437512){if(!_0x437512){_0x570b42[_0xe11b('0x1c')](0x194);}return _0x437512;};}function handleError(_0x5911ca,_0x43e107){_0x43e107=_0x43e107||0x1f4;return function(_0x5b1371){logger['error'](_0x5b1371[_0xe11b('0x2e')]);if(_0x5b1371[_0xe11b('0x2f')]){delete _0x5b1371['name'];}_0x5911ca[_0xe11b('0x1d')](_0x43e107)[_0xe11b('0x30')](_0x5b1371);};}exports[_0xe11b('0x31')]=function(_0x24e869,_0x160514){var _0xd213b0={},_0x28a254={},_0x5e5cb8={'count':0x0,'rows':[]};var _0x21b3ad=_[_0xe11b('0x32')](db['OpenchannelQueue'][_0xe11b('0x33')],function(_0x554adc){return{'name':_0x554adc[_0xe11b('0x34')],'type':_0x554adc[_0xe11b('0x35')][_0xe11b('0x36')]};});_0x28a254['model']=_['map'](_0x21b3ad,'name');_0x28a254['query']=_[_0xe11b('0x37')](_0x24e869[_0xe11b('0x38')]);_0x28a254[_0xe11b('0x39')]=_['intersection'](_0x28a254[_0xe11b('0x3a')],_0x28a254[_0xe11b('0x38')]);_0xd213b0[_0xe11b('0x3b')]=_[_0xe11b('0x3c')](_0x28a254[_0xe11b('0x3a')],qs[_0xe11b('0x3d')](_0x24e869[_0xe11b('0x38')][_0xe11b('0x3d')]));_0xd213b0[_0xe11b('0x3b')]=_0xd213b0['attributes'][_0xe11b('0x3e')]?_0xd213b0[_0xe11b('0x3b')]:_0x28a254[_0xe11b('0x3a')];if(!_0x24e869['query'][_0xe11b('0x3f')](_0xe11b('0x40'))){_0xd213b0[_0xe11b('0x22')]=qs['limit'](_0x24e869['query'][_0xe11b('0x22')]);_0xd213b0[_0xe11b('0x20')]=qs['offset'](_0x24e869['query'][_0xe11b('0x20')]);}_0xd213b0[_0xe11b('0x41')]=qs['sort'](_0x24e869[_0xe11b('0x38')][_0xe11b('0x42')]);_0xd213b0[_0xe11b('0x43')]=qs['filters'](_[_0xe11b('0x44')](_0x24e869[_0xe11b('0x38')],_0x28a254[_0xe11b('0x39')]),_0x21b3ad);if(_0x24e869[_0xe11b('0x38')][_0xe11b('0x45')]){_0xd213b0['where']=_['merge'](_0xd213b0[_0xe11b('0x43')],{'$or':_[_0xe11b('0x32')](_0x21b3ad,function(_0x2abded){if(_0x2abded[_0xe11b('0x35')]!==_0xe11b('0x46')){var _0x42083f={};_0x42083f[_0x2abded['name']]={'$like':'%'+_0x24e869['query']['filter']+'%'};return _0x42083f;}})});}_0xd213b0=_[_0xe11b('0x47')]({},_0xd213b0,_0x24e869[_0xe11b('0x48')]);var _0x59a48a={'where':_0xd213b0[_0xe11b('0x43')]};return db['OpenchannelQueue']['count'](_0x59a48a)['then'](function(_0x403a06){_0x5e5cb8['count']=_0x403a06;if(_0x24e869['query'][_0xe11b('0x49')]){_0xd213b0['include']=[{'all':!![]}];}return db[_0xe11b('0x4a')][_0xe11b('0x4b')](_0xd213b0);})[_0xe11b('0x29')](function(_0x4e9393){_0x5e5cb8[_0xe11b('0x4c')]=_0x4e9393;return _0x5e5cb8;})[_0xe11b('0x29')](respondWithFilteredResult(_0x160514,_0xd213b0))[_0xe11b('0x4d')](handleError(_0x160514,null));};exports[_0xe11b('0x4e')]=function(_0x3c2e2c,_0x477714){var _0x2a9118={'raw':!![],'where':{'id':_0x3c2e2c[_0xe11b('0x4f')]['id']}},_0x4fdec5={};_0x4fdec5[_0xe11b('0x3a')]=_[_0xe11b('0x37')](db[_0xe11b('0x4a')]['rawAttributes']);_0x4fdec5[_0xe11b('0x38')]=_['keys'](_0x3c2e2c['query']);_0x4fdec5['filters']=_[_0xe11b('0x3c')](_0x4fdec5[_0xe11b('0x3a')],_0x4fdec5[_0xe11b('0x38')]);_0x2a9118[_0xe11b('0x3b')]=_[_0xe11b('0x3c')](_0x4fdec5[_0xe11b('0x3a')],qs[_0xe11b('0x3d')](_0x3c2e2c[_0xe11b('0x38')]['fields']));_0x2a9118['attributes']=_0x2a9118['attributes'][_0xe11b('0x3e')]?_0x2a9118['attributes']:_0x4fdec5['model'];if(_0x3c2e2c['query']['includeAll']){_0x2a9118['include']=[{'all':!![]}];}_0x2a9118=_['merge']({},_0x2a9118,_0x3c2e2c[_0xe11b('0x48')]);return db[_0xe11b('0x4a')]['find'](_0x2a9118)[_0xe11b('0x29')](handleEntityNotFound(_0x477714,null))[_0xe11b('0x29')](respondWithResult(_0x477714,null))['catch'](handleError(_0x477714,null));};exports[_0xe11b('0x50')]=function(_0x2ad87e,_0x4ab949){return db[_0xe11b('0x4a')][_0xe11b('0x50')](_0x2ad87e[_0xe11b('0x51')],{})[_0xe11b('0x29')](function(_0x8aca39){var _0x35d09c=_0x2ad87e[_0xe11b('0x52')][_0xe11b('0x2b')]({'plain':!![]});if(!_0x35d09c)throw new Error(_0xe11b('0x53'));if(_0x35d09c['role']===_0xe11b('0x52')){var _0xd8ad3b=_0x8aca39[_0xe11b('0x2b')]({'plain':!![]});var _0x24454a=_0xe11b('0x2c');return db[_0xe11b('0x54')][_0xe11b('0x55')]({'where':{'name':_0x24454a,'userProfileId':_0x35d09c[_0xe11b('0x56')]},'raw':!![]})[_0xe11b('0x29')](function(_0x1f64c1){if(_0x1f64c1&&_0x1f64c1['autoAssociation']===0x0){return db[_0xe11b('0x2d')]['create']({'name':_0xd8ad3b[_0xe11b('0x2f')],'resourceId':_0xd8ad3b['id'],'type':_0x1f64c1[_0xe11b('0x2f')],'sectionId':_0x1f64c1['id']},{})[_0xe11b('0x29')](function(){return _0x8aca39;});}else{return _0x8aca39;}})[_0xe11b('0x4d')](function(_0xf272f4){logger[_0xe11b('0x57')](_0xe11b('0x58'),_0xf272f4);throw _0xf272f4;});}return _0x8aca39;})[_0xe11b('0x29')](respondWithResult(_0x4ab949,0xc9))[_0xe11b('0x4d')](handleError(_0x4ab949,null));};exports[_0xe11b('0x59')]=function(_0x469ee6,_0x284422){if(_0x469ee6['body']['id']){delete _0x469ee6['body']['id'];}return db[_0xe11b('0x4a')]['find']({'where':{'id':_0x469ee6[_0xe11b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x284422,null))[_0xe11b('0x29')](saveUpdates(_0x469ee6['body'],null))[_0xe11b('0x29')](respondWithResult(_0x284422,null))[_0xe11b('0x4d')](handleError(_0x284422,null));};exports[_0xe11b('0x2a')]=function(_0xc3be88,_0x1c2641){return db[_0xe11b('0x4a')][_0xe11b('0x55')]({'where':{'id':_0xc3be88['params']['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x1c2641,null))[_0xe11b('0x29')](removeEntity(_0x1c2641,null))[_0xe11b('0x4d')](handleError(_0x1c2641,null));};exports[_0xe11b('0x5a')]=function(_0x1be8c8,_0x295aad){return db['OpenchannelQueue'][_0xe11b('0x5a')]()[_0xe11b('0x29')](respondWithResult(_0x295aad,null))[_0xe11b('0x4d')](handleError(_0x295aad,null));};exports[_0xe11b('0x5b')]=function(_0x5a78e1,_0x25b6cf,_0x4af36d){var _0x5a8fa4={'raw':!![],'where':{}},_0x271d74={},_0x545851;return db[_0xe11b('0x4a')][_0xe11b('0x5c')]({'where':{'id':_0x5a78e1[_0xe11b('0x4f')]['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x25b6cf,null))['then'](function(_0x456e48){if(_0x456e48){_0x545851=_0x456e48['get']({'plain':!![]});_0x271d74['model']=_[_0xe11b('0x37')](db[_0xe11b('0x5d')][_0xe11b('0x33')]);_0x271d74[_0xe11b('0x38')]=_['keys'](_0x5a78e1[_0xe11b('0x38')]);_0x271d74[_0xe11b('0x39')]=_[_0xe11b('0x3c')](_0x271d74[_0xe11b('0x3a')],_0x271d74[_0xe11b('0x38')]);_0x5a8fa4[_0xe11b('0x3b')]=_['intersection'](_0x271d74[_0xe11b('0x3a')],qs[_0xe11b('0x3d')](_0x5a78e1['query'][_0xe11b('0x3d')]));_0x5a8fa4[_0xe11b('0x3b')]=_0x5a8fa4[_0xe11b('0x3b')][_0xe11b('0x3e')]?_0x5a8fa4[_0xe11b('0x3b')]:_0x271d74[_0xe11b('0x3a')];if(!_0x5a78e1[_0xe11b('0x38')][_0xe11b('0x3f')](_0xe11b('0x40'))){_0x5a8fa4[_0xe11b('0x22')]=qs[_0xe11b('0x22')](_0x5a78e1[_0xe11b('0x38')][_0xe11b('0x22')]);_0x5a8fa4[_0xe11b('0x20')]=qs[_0xe11b('0x20')](_0x5a78e1['query'][_0xe11b('0x20')]);}_0x5a8fa4[_0xe11b('0x41')]=qs[_0xe11b('0x42')](_0x5a78e1[_0xe11b('0x38')][_0xe11b('0x42')]);_0x5a8fa4[_0xe11b('0x43')]=qs['filters'](_['pick'](_0x5a78e1[_0xe11b('0x38')],_0x271d74['filters']));_0x5a8fa4['where'][_0xe11b('0x5e')]=_0x456e48['id'];if(_0x5a78e1[_0xe11b('0x38')][_0xe11b('0x45')]){_0x5a8fa4[_0xe11b('0x43')]=_['merge'](_0x5a8fa4[_0xe11b('0x43')],{'$or':_[_0xe11b('0x32')](_0x5a8fa4[_0xe11b('0x3b')],function(_0x3ca502){var _0x27712c={};_0x27712c[_0x3ca502]={'$like':'%'+_0x5a78e1[_0xe11b('0x38')][_0xe11b('0x45')]+'%'};return _0x27712c;})});}_0x5a8fa4=_['merge']({},_0x5a8fa4,_0x5a78e1['options']);return db[_0xe11b('0x5d')][_0xe11b('0x4b')](_0x5a8fa4);}})[_0xe11b('0x29')](function(_0x168e9a){if(_0x168e9a){return db[_0xe11b('0x5f')][_0xe11b('0x60')]({'where':{'id':_[_0xe11b('0x32')](_0x168e9a,'UserId'),'role':'agent'},'attributes':['id',_0xe11b('0x2f'),_0xe11b('0x61'),'updatedAt',_0xe11b('0x62')]});}})[_0xe11b('0x29')](function(_0xce99e2){if(_0xce99e2){return{'count':_0xce99e2[_0xe11b('0x23')],'rows':_[_0xe11b('0x32')](_0xce99e2['rows'],function(_0x2bd4ce){return{'membername':_0x2bd4ce[_0xe11b('0x2f')],'UserId':_0x2bd4ce['id'],'queue_name':_0x545851[_0xe11b('0x2f')],'OpenchannelQueueId':_0x545851['id'],'interface':util[_0xe11b('0x63')]('%s/%s',_0xe11b('0x64'),_0x2bd4ce[_0xe11b('0x2f')]),'penalty':0x0,'paused':_0x2bd4ce[_0xe11b('0x61')],'createdAt':_0x2bd4ce[_0xe11b('0x62')],'updatedAt':_0x2bd4ce[_0xe11b('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe11b('0x29')](respondWithFilteredResult(_0x25b6cf,_0x5a8fa4))[_0xe11b('0x4d')](handleError(_0x25b6cf,null));};exports[_0xe11b('0x66')]=function(_0x2745e6,_0x3190fe,_0x220648){var _0x49fb00={};var _0xe0fa1c={};var _0x78fa79;var _0x3ea238;return db[_0xe11b('0x4a')][_0xe11b('0x5c')]({'where':{'id':_0x2745e6['params']['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x3190fe,null))['then'](function(_0x5d3e0d){if(_0x5d3e0d){_0x78fa79=_0x5d3e0d;_0xe0fa1c[_0xe11b('0x3a')]=_['keys'](db[_0xe11b('0x67')]['rawAttributes']);_0xe0fa1c[_0xe11b('0x38')]=_[_0xe11b('0x37')](_0x2745e6[_0xe11b('0x38')]);_0xe0fa1c[_0xe11b('0x39')]=_[_0xe11b('0x3c')](_0xe0fa1c['model'],_0xe0fa1c[_0xe11b('0x38')]);_0x49fb00['attributes']=_[_0xe11b('0x3c')](_0xe0fa1c[_0xe11b('0x3a')],qs[_0xe11b('0x3d')](_0x2745e6['query'][_0xe11b('0x3d')]));_0x49fb00['attributes']=_0x49fb00[_0xe11b('0x3b')]['length']?_0x49fb00[_0xe11b('0x3b')]:_0xe0fa1c['model'];_0x49fb00['order']=qs[_0xe11b('0x42')](_0x2745e6['query'][_0xe11b('0x42')]);_0x49fb00['where']=qs[_0xe11b('0x39')](_[_0xe11b('0x44')](_0x2745e6['query'],_0xe0fa1c['filters']));if(_0x2745e6[_0xe11b('0x38')][_0xe11b('0x45')]){_0x49fb00[_0xe11b('0x43')]=_[_0xe11b('0x47')](_0x49fb00[_0xe11b('0x43')],{'$or':_['map'](_0x49fb00[_0xe11b('0x3b')],function(_0x48abb8){var _0x8688e0={};_0x8688e0[_0x48abb8]={'$like':'%'+_0x2745e6[_0xe11b('0x38')][_0xe11b('0x45')]+'%'};return _0x8688e0;})});}_0x49fb00=_[_0xe11b('0x47')]({},_0x49fb00,_0x2745e6[_0xe11b('0x48')]);return _0x78fa79[_0xe11b('0x66')](_0x49fb00);}})[_0xe11b('0x29')](function(_0x527547){if(_0x527547){_0x3ea238=_0x527547[_0xe11b('0x3e')];if(!_0x2745e6[_0xe11b('0x38')][_0xe11b('0x3f')](_0xe11b('0x40'))){_0x49fb00[_0xe11b('0x22')]=qs[_0xe11b('0x22')](_0x2745e6[_0xe11b('0x38')][_0xe11b('0x22')]);_0x49fb00['offset']=qs['offset'](_0x2745e6['query'][_0xe11b('0x20')]);}return _0x78fa79['getTeams'](_0x49fb00);}})[_0xe11b('0x29')](function(_0x321793){if(_0x321793){return _0x321793?{'count':_0x3ea238,'rows':_0x321793}:null;}})[_0xe11b('0x29')](respondWithResult(_0x3190fe,null))['catch'](handleError(_0x3190fe,null));};exports['addTeams']=function(_0x438eae,_0x11cc76,_0x10abbe){var _0x1d9dbc=_0x438eae[_0xe11b('0x51')][_0xe11b('0x68')];return db[_0xe11b('0x67')][_0xe11b('0x4b')]({'where':{'id':_0x1d9dbc},'attributes':['id'],'include':[{'model':db[_0xe11b('0x5f')],'as':_0xe11b('0x69'),'attributes':['id','name',_0xe11b('0x6a'),_0xe11b('0x6b'),_0xe11b('0x6c')],'raw':!![]}]})[_0xe11b('0x29')](function(_0x4122ce){if(_0x4122ce){var _0x5302f0=_['flatMap'](_0x4122ce,function(_0x4b761a){var _0x1cf00b=_0x4b761a[_0xe11b('0x2b')]({'plain':!![]});return _0x1cf00b[_0xe11b('0x69')];});return db[_0xe11b('0x4a')][_0xe11b('0x55')]({'where':{'id':_0x438eae['params']['id']}})[_0xe11b('0x29')](function(_0x43ce70){return db[_0xe11b('0x6d')][_0xe11b('0x6e')](function(_0x4172f6){return _0x43ce70['addTeams'](_0x1d9dbc,{'transaction':_0x4172f6})['then'](function(){return BPromise[_0xe11b('0x6f')](_0x5302f0,function(_0x2ea496){return db[_0xe11b('0x5d')][_0xe11b('0x70')]({'where':{'UserId':_0x2ea496['id'],'OpenchannelQueueId':_0x438eae['params']['id']},'transaction':_0x4172f6});});})[_0xe11b('0x29')](function(){_0x5302f0[_0xe11b('0x71')](function(_0x205607){socket[_0xe11b('0x72')]('userOpenchannelQueue:save',{'UserId':_0x205607['id'],'OpenchannelQueueId':_0x43ce70['id']});});});});});}})[_0xe11b('0x29')](respondWithStatusCode(_0x11cc76,null))[_0xe11b('0x4d')](handleError(_0x11cc76,null));};exports[_0xe11b('0x73')]=function(_0x54219a,_0xf01de3,_0x120204){return db[_0xe11b('0x67')][_0xe11b('0x4b')]({'where':{'id':_0x54219a[_0xe11b('0x38')][_0xe11b('0x68')]},'attributes':['id'],'include':[{'model':db[_0xe11b('0x5f')],'as':_0xe11b('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe11b('0x29')](handleEntityNotFound(_0xf01de3,null))[_0xe11b('0x29')](function(_0x235bd4){var _0x4ea9eb=_[_0xe11b('0x32')](_0x235bd4,'id');var _0x569ded=[];var _0x40338e=[];var _0x964e72=squel[_0xe11b('0x74')]();_0x964e72[_0xe11b('0x75')](_0xe11b('0x76'))[_0xe11b('0x77')]('team_has_openchannel_queues','tq')[_0xe11b('0x78')]('user_has_teams','ut',_0xe11b('0x79'))[_0xe11b('0x43')](_0xe11b('0x7a'),_0x54219a[_0xe11b('0x4f')]['id']);for(var _0x308b0a=0x0;_0x308b0a<_0x235bd4[_0xe11b('0x3e')];_0x308b0a+=0x1){let _0x416754=_0x235bd4[_0x308b0a];for(var _0x6fcec3=0x0;_0x6fcec3<_0x416754[_0xe11b('0x69')][_0xe11b('0x3e')];_0x6fcec3+=0x1){let _0x5000a9=_0x416754[_0xe11b('0x69')][_0x6fcec3];var _0x38a773=_0x964e72['clone']();_0x38a773['where'](_0xe11b('0x7b'),_0x5000a9['id']);_0x40338e[_0xe11b('0x7c')](db[_0xe11b('0x6d')][_0xe11b('0x38')](_0x38a773[_0xe11b('0x7d')](),{'type':db[_0xe11b('0x6d')][_0xe11b('0x7e')][_0xe11b('0x7f')]})[_0xe11b('0x29')](function(_0x54ea37){if(_0x54ea37[_0xe11b('0x3e')]===0x1){return _0x5000a9['id'];}else{var _0x1cafab=_[_0xe11b('0x80')](_[_0xe11b('0x32')](_0x54ea37,_0xe11b('0x81')),function(_0x59d356){return _[_0xe11b('0x82')](_0x4ea9eb,_0x59d356);});if(_0x1cafab){return _0x5000a9['id'];}}}));}}return BPromise[_0xe11b('0x83')](_0x40338e)[_0xe11b('0x29')](function(_0x30dab6){_0x569ded=_(_0x569ded)['union'](_0x30dab6)[_0xe11b('0x84')]()[_0xe11b('0x85')]();return db[_0xe11b('0x4a')][_0xe11b('0x55')]({'where':{'id':_0x54219a[_0xe11b('0x4f')]['id']}})[_0xe11b('0x29')](function(_0x269fd7){return db[_0xe11b('0x6d')][_0xe11b('0x6e')](function(_0x5402ce){return _0x269fd7[_0xe11b('0x73')](_0x54219a['query'][_0xe11b('0x68')],{'transaction':_0x5402ce})[_0xe11b('0x29')](function(){if(!_[_0xe11b('0x86')](_0x569ded)){return _0x269fd7['removeAgents'](_0x569ded,{'transaction':_0x5402ce});}})[_0xe11b('0x29')](function(){_0x569ded[_0xe11b('0x71')](function(_0x286589){socket[_0xe11b('0x72')](_0xe11b('0x87'),{'UserId':_0x286589,'OpenchannelQueueId':_0x269fd7['id']});});});});});});})[_0xe11b('0x29')](respondWithStatusCode(_0xf01de3,null))['catch'](handleError(_0xf01de3,null));};exports[_0xe11b('0x88')]=function(_0x39e9c1,_0x44641d,_0x1a8acf){return db[_0xe11b('0x4a')][_0xe11b('0x55')]({'where':{'id':_0x39e9c1['params']['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x44641d,null))['then'](function(_0x15c314){if(_0x15c314){return _0x15c314[_0xe11b('0x88')](_0x39e9c1['body'][_0xe11b('0x68')],_['omit'](_0x39e9c1[_0xe11b('0x51')],[_0xe11b('0x68'),'id'])||{})[_0xe11b('0x89')](function(_0x554b5){for(var _0x5b4901=0x0;_0x5b4901<_0x39e9c1[_0xe11b('0x51')][_0xe11b('0x68')]['length'];_0x5b4901+=0x1){socket[_0xe11b('0x72')](_0xe11b('0x8a'),{'UserId':Number(_0x39e9c1['body'][_0xe11b('0x68')][_0x5b4901]),'OpenchannelQueueId':Number(_0x39e9c1[_0xe11b('0x4f')]['id'])});}return _0x554b5;});}})['then'](respondWithResult(_0x44641d,null))[_0xe11b('0x4d')](handleError(_0x44641d,null));};exports['removeAgents']=function(_0x3790e6,_0x1c383c,_0x389b11){return db[_0xe11b('0x4a')]['find']({'where':{'id':_0x3790e6[_0xe11b('0x4f')]['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x1c383c,null))[_0xe11b('0x29')](function(_0x4dda96){if(_0x4dda96){return _0x4dda96[_0xe11b('0x8b')](_0x3790e6[_0xe11b('0x38')][_0xe11b('0x68')])[_0xe11b('0x29')](function(){if(_[_0xe11b('0x8c')](_0x3790e6[_0xe11b('0x38')][_0xe11b('0x68')])){for(var _0x443cf6=0x0;_0x443cf6<_0x3790e6[_0xe11b('0x38')][_0xe11b('0x68')][_0xe11b('0x3e')];_0x443cf6+=0x1){socket['emit'](_0xe11b('0x87'),{'UserId':Number(_0x3790e6['query'][_0xe11b('0x68')][_0x443cf6]),'OpenchannelQueueId':Number(_0x3790e6['params']['id'])});}}else{socket['emit'](_0xe11b('0x87'),{'UserId':Number(_0x3790e6['query'][_0xe11b('0x68')]),'OpenchannelQueueId':Number(_0x3790e6[_0xe11b('0x4f')]['id'])});}});}})[_0xe11b('0x29')](respondWithStatusCode(_0x1c383c,null))[_0xe11b('0x4d')](handleError(_0x1c383c,null));};exports[_0xe11b('0x8d')]=function(_0x13b19d,_0x325152,_0x4ec727){var _0x278580={};var _0x56fa8b={};var _0x1cb784;var _0xce2292;return db[_0xe11b('0x4a')]['findOne']({'where':{'id':_0x13b19d[_0xe11b('0x4f')]['id']}})[_0xe11b('0x29')](handleEntityNotFound(_0x325152,null))[_0xe11b('0x29')](function(_0x175bdb){if(_0x175bdb){_0x1cb784=_0x175bdb;_0x56fa8b[_0xe11b('0x3a')]=_[_0xe11b('0x37')](db[_0xe11b('0x5f')][_0xe11b('0x33')]);_0x56fa8b[_0xe11b('0x38')]=_['keys'](_0x13b19d[_0xe11b('0x38')]);_0x56fa8b[_0xe11b('0x39')]=_[_0xe11b('0x3c')](_0x56fa8b[_0xe11b('0x3a')],_0x56fa8b[_0xe11b('0x38')]);_0x278580[_0xe11b('0x3b')]=_[_0xe11b('0x3c')](_0x56fa8b['model'],qs[_0xe11b('0x3d')](_0x13b19d[_0xe11b('0x38')]['fields']));_0x278580['attributes']=_0x278580[_0xe11b('0x3b')][_0xe11b('0x3e')]?_0x278580['attributes']:_0x56fa8b[_0xe11b('0x3a')];_0x278580[_0xe11b('0x41')]=qs[_0xe11b('0x42')](_0x13b19d[_0xe11b('0x38')][_0xe11b('0x42')]);_0x278580['where']=qs[_0xe11b('0x39')](_[_0xe11b('0x44')](_0x13b19d['query'],_0x56fa8b[_0xe11b('0x39')]));if(_0x13b19d[_0xe11b('0x38')][_0xe11b('0x45')]){_0x278580[_0xe11b('0x43')]=_[_0xe11b('0x47')](_0x278580[_0xe11b('0x43')],{'$or':_['map'](_0x278580['attributes'],function(_0xd91cf1){var _0x4e22db={};_0x4e22db[_0xd91cf1]={'$like':'%'+_0x13b19d[_0xe11b('0x38')][_0xe11b('0x45')]+'%'};return _0x4e22db;})});}_0x278580=_[_0xe11b('0x47')]({},_0x278580,_0x13b19d['options']);return _0x1cb784[_0xe11b('0x8d')](_0x278580);}})[_0xe11b('0x29')](function(_0x791aaf){if(_0x791aaf){_0xce2292=_0x791aaf[_0xe11b('0x3e')];if(!_0x13b19d[_0xe11b('0x38')][_0xe11b('0x3f')](_0xe11b('0x40'))){_0x278580[_0xe11b('0x22')]=qs[_0xe11b('0x22')](_0x13b19d['query']['limit']);_0x278580['offset']=qs[_0xe11b('0x20')](_0x13b19d[_0xe11b('0x38')][_0xe11b('0x20')]);}return _0x1cb784['getAgents'](_0x278580);}})['then'](function(_0x3bafce){if(_0x3bafce){return _0x3bafce?{'count':_0xce2292,'rows':_0x3bafce}:null;}})[_0xe11b('0x29')](respondWithResult(_0x325152,null))['catch'](handleError(_0x325152,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9ce0f40..8cb3938 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 _0xe80c=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0xa36e97,_0x4a32db){var _0x511b49=function(_0xa25854){while(--_0xa25854){_0xa36e97['push'](_0xa36e97['shift']());}};_0x511b49(++_0x4a32db);}(_0xe80c,0x1b3));var _0xce80=function(_0x11c3fb,_0x46980c){_0x11c3fb=_0x11c3fb-0x0;var _0x27f7a0=_0xe80c[_0x11c3fb];return _0x27f7a0;};'use strict';var EventEmitter=require(_0xce80('0x0'));var OpenchannelQueue=require(_0xce80('0x1'))['db'][_0xce80('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xce80('0x3')](0x0);var events={'afterCreate':_0xce80('0x4'),'afterUpdate':_0xce80('0x5'),'afterDestroy':_0xce80('0x6')};function emitEvent(_0x6eb6f8){return function(_0x51c3d4,_0x1b6c30,_0x93e822){OpenchannelQueueEvents[_0xce80('0x7')](_0x6eb6f8+':'+_0x51c3d4['id'],_0x51c3d4);OpenchannelQueueEvents['emit'](_0x6eb6f8,_0x51c3d4);_0x93e822(null);};}for(var e in events){if(events[_0xce80('0x8')](e)){var event=events[e];OpenchannelQueue[_0xce80('0x9')](e,emitEvent(event));}}module[_0xce80('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xfb44=['remove','emit','hasOwnProperty','hook','exports','OpenchannelQueue','update'];(function(_0x27b246,_0x41885a){var _0x4ae881=function(_0x15b228){while(--_0x15b228){_0x27b246['push'](_0x27b246['shift']());}};_0x4ae881(++_0x41885a);}(_0xfb44,0x101));var _0x4fb4=function(_0x2e1d3a,_0xe29a0b){_0x2e1d3a=_0x2e1d3a-0x0;var _0xcefa9a=_0xfb44[_0x2e1d3a];return _0xcefa9a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x4fb4('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fb4('0x1'),'afterDestroy':_0x4fb4('0x2')};function emitEvent(_0x4290e2){return function(_0x479f9d,_0x1d3142,_0x1e6266){OpenchannelQueueEvents[_0x4fb4('0x3')](_0x4290e2+':'+_0x479f9d['id'],_0x479f9d);OpenchannelQueueEvents[_0x4fb4('0x3')](_0x4290e2,_0x479f9d);_0x1e6266(null);};}for(var e in events){if(events[_0x4fb4('0x4')](e)){var event=events[e];OpenchannelQueue[_0x4fb4('0x5')](e,emitEvent(event));}}module[_0x4fb4('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6d5bebe..cc0c88a 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 _0x004c=['path','rimraf','OpenchannelQueue','openchannel_queues','util','api','moment','bluebird'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x004c,0xd4));var _0xc004=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x004c[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0xc004('0x0'));var logger=require('../../config/logger')(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc004('0x4'));var rimraf=require(_0xc004('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x20a337,_0x58bb1c){return _0x20a337['define'](_0xc004('0x6'),attributes,{'tableName':_0xc004('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ee=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','moment'];(function(_0x447e7f,_0x2fc8e9){var _0x1c9e69=function(_0x59820e){while(--_0x59820e){_0x447e7f['push'](_0x447e7f['shift']());}};_0x1c9e69(++_0x2fc8e9);}(_0x17ee,0x1b6));var _0xe17e=function(_0x457e25,_0x15dd63){_0x457e25=_0x457e25-0x0;var _0x2ba3b7=_0x17ee[_0x457e25];return _0x2ba3b7;};'use strict';var _=require(_0xe17e('0x0'));var util=require(_0xe17e('0x1'));var logger=require(_0xe17e('0x2'))('api');var moment=require(_0xe17e('0x3'));var BPromise=require(_0xe17e('0x4'));var rp=require(_0xe17e('0x5'));var fs=require('fs');var path=require(_0xe17e('0x6'));var rimraf=require(_0xe17e('0x7'));var config=require(_0xe17e('0x8'));var attributes=require(_0xe17e('0x9'));module[_0xe17e('0xa')]=function(_0x43779d,_0x46b44d){return _0x43779d[_0xe17e('0xb')]('OpenchannelQueue',attributes,{'tableName':_0xe17e('0xc'),'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 27d2e9a..d8bdff7 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 _0x7739=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','lodash'];(function(_0x1534e9,_0x1c062c){var _0x3d9d86=function(_0x3a0a91){while(--_0x3a0a91){_0x1534e9['push'](_0x1534e9['shift']());}};_0x3d9d86(++_0x1c062c);}(_0x7739,0x1c7));var _0x9773=function(_0x45b5f6,_0x490fb2){_0x45b5f6=_0x45b5f6-0x0;var _0x1b2a71=_0x7739[_0x45b5f6];return _0x1b2a71;};'use strict';var _=require(_0x9773('0x0'));var util=require(_0x9773('0x1'));var moment=require('moment');var BPromise=require(_0x9773('0x2'));var rs=require(_0x9773('0x3'));var fs=require('fs');var Redis=require(_0x9773('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9773('0x5'));var logger=require(_0x9773('0x6'))('rpc');var config=require(_0x9773('0x7'));var jayson=require(_0x9773('0x8'));var client=jayson[_0x9773('0x9')][_0x9773('0xa')]({'port':0x232a});config[_0x9773('0xb')]=_[_0x9773('0xc')](config[_0x9773('0xb')],{'host':_0x9773('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9773('0xb')]));require('./openchannelQueue.socket')[_0x9773('0xe')](socket);function respondWithRpcPromise(_0x381120,_0x57c49a,_0x1e1e7a){return new BPromise(function(_0x5959c5,_0x2cda07){return client['request'](_0x381120,_0x1e1e7a)[_0x9773('0xf')](function(_0x1e9d70){logger[_0x9773('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x57c49a,'request\x20sent');logger[_0x9773('0x11')](_0x9773('0x12'),_0x57c49a,'request\x20sent',JSON['stringify'](_0x1e9d70));if(_0x1e9d70[_0x9773('0x13')]){if(_0x1e9d70[_0x9773('0x13')][_0x9773('0x14')]===0x1f4){logger[_0x9773('0x13')](_0x9773('0x15'),_0x57c49a,_0x1e9d70[_0x9773('0x13')][_0x9773('0x16')]);return _0x2cda07(_0x1e9d70['error'][_0x9773('0x16')]);}logger[_0x9773('0x13')](_0x9773('0x15'),_0x57c49a,_0x1e9d70[_0x9773('0x13')][_0x9773('0x16')]);return _0x5959c5(_0x1e9d70[_0x9773('0x13')][_0x9773('0x16')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x57c49a,_0x9773('0x17'));_0x5959c5(_0x1e9d70[_0x9773('0x18')][_0x9773('0x16')]);}})[_0x9773('0x19')](function(_0x4e5bf5){logger[_0x9773('0x13')](_0x9773('0x15'),_0x57c49a,_0x4e5bf5);_0x2cda07(_0x4e5bf5);});});}exports['GetOpenchannelQueue']=function(_0x361598){var _0x182d83=this;return new Promise(function(_0x2d9c9b,_0x2c2243){return db[_0x9773('0x1a')][_0x9773('0x1b')]({'raw':_0x361598['options']?_0x361598[_0x9773('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x361598[_0x9773('0x1c')]?_0x361598[_0x9773('0x1c')][_0x9773('0x1d')]||null:null,'attributes':_0x361598[_0x9773('0x1c')]?_0x361598['options'][_0x9773('0x1e')]||null:null,'limit':_0x361598[_0x9773('0x1c')]?_0x361598[_0x9773('0x1c')][_0x9773('0x1f')]||null:null,'include':_0x361598[_0x9773('0x1c')]?_0x361598['options'][_0x9773('0x20')]?_[_0x9773('0x21')](_0x361598[_0x9773('0x1c')][_0x9773('0x20')],function(_0x14d516){return{'model':db[_0x14d516[_0x9773('0x22')]],'as':_0x14d516['as'],'attributes':_0x14d516['attributes'],'include':_0x14d516[_0x9773('0x20')]?_[_0x9773('0x21')](_0x14d516[_0x9773('0x20')],function(_0x1e0b79){return{'model':db[_0x1e0b79[_0x9773('0x22')]],'as':_0x1e0b79['as'],'attributes':_0x1e0b79[_0x9773('0x1e')],'include':_0x1e0b79[_0x9773('0x20')]?_['map'](_0x1e0b79[_0x9773('0x20')],function(_0x167245){return{'model':db[_0x167245[_0x9773('0x22')]],'as':_0x167245['as'],'attributes':_0x167245['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33a46d){logger[_0x9773('0x10')](_0x9773('0x23'),_0x361598);logger['debug'](_0x9773('0x23'),_0x361598,JSON[_0x9773('0x24')](_0x33a46d));_0x2d9c9b(_0x33a46d);})[_0x9773('0x19')](function(_0x83ec41){logger[_0x9773('0x13')]('GetOpenchannelQueue',_0x83ec41[_0x9773('0x16')],_0x361598);_0x2c2243(_0x182d83[_0x9773('0x13')](0x1f4,_0x83ec41[_0x9773('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x4890d8){var _0x5e94c3=this;return new Promise(function(_0x3a45e9,_0x198689){return db[_0x9773('0x1a')]['find']({'raw':_0x4890d8['options']?_0x4890d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4890d8['options']?_0x4890d8[_0x9773('0x1c')][_0x9773('0x1d')]||null:null,'attributes':_0x4890d8[_0x9773('0x1c')]?_0x4890d8[_0x9773('0x1c')][_0x9773('0x1e')]||null:null,'include':_0x4890d8[_0x9773('0x1c')]?_0x4890d8[_0x9773('0x1c')][_0x9773('0x20')]?_[_0x9773('0x21')](_0x4890d8['options'][_0x9773('0x20')],function(_0x33283f){return{'model':db[_0x33283f[_0x9773('0x22')]],'as':_0x33283f['as'],'attributes':_0x33283f['attributes'],'include':_0x33283f[_0x9773('0x20')]?_[_0x9773('0x21')](_0x33283f[_0x9773('0x20')],function(_0x17e6a7){return{'model':db[_0x17e6a7[_0x9773('0x22')]],'as':_0x17e6a7['as'],'attributes':_0x17e6a7[_0x9773('0x1e')],'include':_0x17e6a7[_0x9773('0x20')]?_[_0x9773('0x21')](_0x17e6a7['include'],function(_0x10e428){return{'model':db[_0x10e428[_0x9773('0x22')]],'as':_0x10e428['as'],'attributes':_0x10e428[_0x9773('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27371c){logger[_0x9773('0x10')]('ShowOpenchannelQueue',_0x4890d8);logger[_0x9773('0x11')](_0x9773('0x25'),_0x4890d8,JSON[_0x9773('0x24')](_0x27371c));_0x3a45e9(_0x27371c);})['catch'](function(_0x44b5da){logger['error'](_0x9773('0x25'),_0x44b5da[_0x9773('0x16')],_0x4890d8);_0x198689(_0x5e94c3['error'](0x1f4,_0x44b5da[_0x9773('0x16')]));});});}; \ No newline at end of file +var _0xaf96=['http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xaf96,0x15d));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6af9('0x0'));var util=require(_0x6af9('0x1'));var moment=require(_0x6af9('0x2'));var BPromise=require(_0x6af9('0x3'));var rs=require(_0x6af9('0x4'));var fs=require('fs');var Redis=require(_0x6af9('0x5'));var db=require(_0x6af9('0x6'))['db'];var utils=require(_0x6af9('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6af9('0x8'));var jayson=require(_0x6af9('0x9'));var client=jayson[_0x6af9('0xa')][_0x6af9('0xb')]({'port':0x232a});config['redis']=_[_0x6af9('0xc')](config[_0x6af9('0xd')],{'host':_0x6af9('0xe'),'port':0x18eb});var socket=require(_0x6af9('0xf'))(new Redis(config[_0x6af9('0xd')]));require(_0x6af9('0x10'))['register'](socket);function respondWithRpcPromise(_0x345f8e,_0x563344,_0x553666){return new BPromise(function(_0x1e7a98,_0x2d064d){return client[_0x6af9('0x11')](_0x345f8e,_0x553666)[_0x6af9('0x12')](function(_0x3af056){logger[_0x6af9('0x13')](_0x6af9('0x14'),_0x563344,_0x6af9('0x15'));logger[_0x6af9('0x16')](_0x6af9('0x17'),_0x563344,_0x6af9('0x15'),JSON[_0x6af9('0x18')](_0x3af056));if(_0x3af056[_0x6af9('0x19')]){if(_0x3af056[_0x6af9('0x19')]['code']===0x1f4){logger[_0x6af9('0x19')](_0x6af9('0x14'),_0x563344,_0x3af056['error'][_0x6af9('0x1a')]);return _0x2d064d(_0x3af056[_0x6af9('0x19')][_0x6af9('0x1a')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x563344,_0x3af056[_0x6af9('0x19')][_0x6af9('0x1a')]);return _0x1e7a98(_0x3af056[_0x6af9('0x19')][_0x6af9('0x1a')]);}else{logger[_0x6af9('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x563344,_0x6af9('0x15'));_0x1e7a98(_0x3af056['result']['message']);}})[_0x6af9('0x1b')](function(_0x2980ea){logger['error'](_0x6af9('0x14'),_0x563344,_0x2980ea);_0x2d064d(_0x2980ea);});});}exports['GetOpenchannelQueue']=function(_0xfbff49){var _0x165786=this;return new Promise(function(_0x1f3811,_0x105fa4){return db[_0x6af9('0x1c')][_0x6af9('0x1d')]({'raw':_0xfbff49['options']?_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x1f')]===undefined?!![]:![]:!![],'where':_0xfbff49['options']?_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x20')]||null:null,'attributes':_0xfbff49[_0x6af9('0x1e')]?_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x21')]||null:null,'limit':_0xfbff49[_0x6af9('0x1e')]?_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x22')]||null:null,'include':_0xfbff49[_0x6af9('0x1e')]?_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x23')]?_[_0x6af9('0x24')](_0xfbff49[_0x6af9('0x1e')][_0x6af9('0x23')],function(_0x27a8f1){return{'model':db[_0x27a8f1[_0x6af9('0x25')]],'as':_0x27a8f1['as'],'attributes':_0x27a8f1[_0x6af9('0x21')],'include':_0x27a8f1[_0x6af9('0x23')]?_[_0x6af9('0x24')](_0x27a8f1[_0x6af9('0x23')],function(_0x59979d){return{'model':db[_0x59979d[_0x6af9('0x25')]],'as':_0x59979d['as'],'attributes':_0x59979d[_0x6af9('0x21')],'include':_0x59979d[_0x6af9('0x23')]?_[_0x6af9('0x24')](_0x59979d['include'],function(_0x3436c2){return{'model':db[_0x3436c2['model']],'as':_0x3436c2['as'],'attributes':_0x3436c2[_0x6af9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6af9('0x12')](function(_0x554f22){logger[_0x6af9('0x13')](_0x6af9('0x26'),_0xfbff49);logger[_0x6af9('0x16')](_0x6af9('0x26'),_0xfbff49,JSON[_0x6af9('0x18')](_0x554f22));_0x1f3811(_0x554f22);})[_0x6af9('0x1b')](function(_0x43067f){logger[_0x6af9('0x19')]('GetOpenchannelQueue',_0x43067f[_0x6af9('0x1a')],_0xfbff49);_0x105fa4(_0x165786[_0x6af9('0x19')](0x1f4,_0x43067f[_0x6af9('0x1a')]));});});};exports[_0x6af9('0x27')]=function(_0x182fe5){var _0x54dcbd=this;return new Promise(function(_0x2ef598,_0x5009ac){return db[_0x6af9('0x1c')]['find']({'raw':_0x182fe5['options']?_0x182fe5[_0x6af9('0x1e')][_0x6af9('0x1f')]===undefined?!![]:![]:!![],'where':_0x182fe5[_0x6af9('0x1e')]?_0x182fe5[_0x6af9('0x1e')]['where']||null:null,'attributes':_0x182fe5['options']?_0x182fe5[_0x6af9('0x1e')][_0x6af9('0x21')]||null:null,'include':_0x182fe5[_0x6af9('0x1e')]?_0x182fe5['options'][_0x6af9('0x23')]?_['map'](_0x182fe5['options'][_0x6af9('0x23')],function(_0x20fe75){return{'model':db[_0x20fe75[_0x6af9('0x25')]],'as':_0x20fe75['as'],'attributes':_0x20fe75[_0x6af9('0x21')],'include':_0x20fe75['include']?_[_0x6af9('0x24')](_0x20fe75[_0x6af9('0x23')],function(_0x47bfb4){return{'model':db[_0x47bfb4[_0x6af9('0x25')]],'as':_0x47bfb4['as'],'attributes':_0x47bfb4[_0x6af9('0x21')],'include':_0x47bfb4['include']?_['map'](_0x47bfb4[_0x6af9('0x23')],function(_0x4e2726){return{'model':db[_0x4e2726[_0x6af9('0x25')]],'as':_0x4e2726['as'],'attributes':_0x4e2726[_0x6af9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6af9('0x12')](function(_0x106d29){logger[_0x6af9('0x13')](_0x6af9('0x27'),_0x182fe5);logger['debug']('ShowOpenchannelQueue',_0x182fe5,JSON[_0x6af9('0x18')](_0x106d29));_0x2ef598(_0x106d29);})[_0x6af9('0x1b')](function(_0x3e2d40){logger['error']('ShowOpenchannelQueue',_0x3e2d40[_0x6af9('0x1a')],_0x182fe5);_0x5009ac(_0x54dcbd[_0x6af9('0x19')](0x1f4,_0x3e2d40[_0x6af9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9d04953..51be1fc 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 _0xe3b0=['length','./openchannelQueue.events','save','remove','update','emit'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xe3b0,0x67));var _0x0e3b=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xe3b0[_0x52085a];return _0x5afc1a;};'use strict';var OpenchannelQueueEvents=require(_0x0e3b('0x0'));var events=[_0x0e3b('0x1'),_0x0e3b('0x2'),_0x0e3b('0x3')];function createListener(_0xfad3bf,_0x5ce55b){return function(_0x3a1658){_0x5ce55b[_0x0e3b('0x4')](_0xfad3bf,_0x3a1658);};}function removeListener(_0x505c44,_0x3128be){return function(){OpenchannelQueueEvents['removeListener'](_0x505c44,_0x3128be);};}exports['register']=function(_0x1e0297){for(var _0x4094cb=0x0,_0x733932=events[_0x0e3b('0x5')];_0x4094cb<_0x733932;_0x4094cb++){var _0x15d829=events[_0x4094cb];var _0x180484=createListener('openchannelQueue:'+_0x15d829,_0x1e0297);OpenchannelQueueEvents['on'](_0x15d829,_0x180484);}}; \ No newline at end of file +var _0x51b5=['length','openchannelQueue:','./openchannelQueue.events','remove','emit','removeListener','register'];(function(_0x2f50ab,_0x4dfe90){var _0x1e9b19=function(_0x4c4ab3){while(--_0x4c4ab3){_0x2f50ab['push'](_0x2f50ab['shift']());}};_0x1e9b19(++_0x4dfe90);}(_0x51b5,0x18a));var _0x551b=function(_0x593b0c,_0xb0c83b){_0x593b0c=_0x593b0c-0x0;var _0x110a19=_0x51b5[_0x593b0c];return _0x110a19;};'use strict';var OpenchannelQueueEvents=require(_0x551b('0x0'));var events=['save',_0x551b('0x1'),'update'];function createListener(_0x23b1e0,_0x4cd9c3){return function(_0x5b9f22){_0x4cd9c3[_0x551b('0x2')](_0x23b1e0,_0x5b9f22);};}function removeListener(_0x184ed4,_0x41a64c){return function(){OpenchannelQueueEvents[_0x551b('0x3')](_0x184ed4,_0x41a64c);};}exports[_0x551b('0x4')]=function(_0x243298){for(var _0x54d588=0x0,_0x1d44a6=events[_0x551b('0x5')];_0x54d588<_0x1d44a6;_0x54d588++){var _0x31724c=events[_0x54d588];var _0x30456f=createListener(_0x551b('0x6')+_0x31724c,_0x243298);OpenchannelQueueEvents['on'](_0x31724c,_0x30456f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7e1c51a..2a8b23d 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 _0xfd50=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xfd50,0xbe));var _0x0fd5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfd50[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0fd5('0x0'));var util=require(_0x0fd5('0x1'));var path=require('path');var timeout=require(_0x0fd5('0x2'));var express=require(_0x0fd5('0x3'));var router=express[_0x0fd5('0x4')]();var fs_extra=require(_0x0fd5('0x5'));var auth=require(_0x0fd5('0x6'));var interaction=require(_0x0fd5('0x7'));var config=require(_0x0fd5('0x8'));var controller=require(_0x0fd5('0x9'));router[_0x0fd5('0xa')]('/',auth['isAuthenticated'](),controller[_0x0fd5('0xb')]);router[_0x0fd5('0xa')]('/describe',auth[_0x0fd5('0xc')](),controller['describe']);router['get'](_0x0fd5('0xd'),auth[_0x0fd5('0xc')](),controller[_0x0fd5('0xe')]);router[_0x0fd5('0xf')]('/',auth['isAuthenticated'](),controller[_0x0fd5('0x10')]);router[_0x0fd5('0x11')](_0x0fd5('0xd'),auth[_0x0fd5('0xc')](),controller[_0x0fd5('0x12')]);router[_0x0fd5('0x13')]('/:id',auth[_0x0fd5('0xc')](),controller['destroy']);module[_0x0fd5('0x14')]=router; \ No newline at end of file +var _0x5a65=['../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x5a65,0x175));var _0x55a6=function(_0x27c3a3,_0x3c96a0){_0x27c3a3=_0x27c3a3-0x0;var _0x2925f1=_0x5a65[_0x27c3a3];return _0x2925f1;};'use strict';var multer=require(_0x55a6('0x0'));var util=require(_0x55a6('0x1'));var path=require(_0x55a6('0x2'));var timeout=require(_0x55a6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x55a6('0x4'));var auth=require(_0x55a6('0x5'));var interaction=require(_0x55a6('0x6'));var config=require(_0x55a6('0x7'));var controller=require(_0x55a6('0x8'));router['get']('/',auth[_0x55a6('0x9')](),controller[_0x55a6('0xa')]);router[_0x55a6('0xb')](_0x55a6('0xc'),auth[_0x55a6('0x9')](),controller[_0x55a6('0xd')]);router[_0x55a6('0xb')](_0x55a6('0xe'),auth[_0x55a6('0x9')](),controller[_0x55a6('0xf')]);router[_0x55a6('0x10')]('/',auth[_0x55a6('0x9')](),controller['create']);router['put'](_0x55a6('0xe'),auth[_0x55a6('0x9')](),controller['update']);router[_0x55a6('0x11')]('/:id',auth[_0x55a6('0x9')](),controller[_0x55a6('0x12')]);module[_0x55a6('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5b284a6..4738eb8 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 _0x2f86=['STRING','DATE','sequelize','exports'];(function(_0x29c1ef,_0x40d082){var _0x61a486=function(_0x3865a6){while(--_0x3865a6){_0x29c1ef['push'](_0x29c1ef['shift']());}};_0x61a486(++_0x40d082);}(_0x2f86,0x18e));var _0x62f8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2f86[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require('moment');var Sequelize=require(_0x62f8('0x0'));module[_0x62f8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x62f8('0x2')]},'joinAt':{'type':Sequelize[_0x62f8('0x3')]},'leaveAt':{'type':Sequelize[_0x62f8('0x3')]},'acceptAt':{'type':Sequelize[_0x62f8('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x62f8('0x2')]}}; \ No newline at end of file +var _0x12b6=['sequelize','exports','STRING','DATE','moment'];(function(_0x20f7db,_0x20f85e){var _0x4d4568=function(_0x897c7f){while(--_0x897c7f){_0x20f7db['push'](_0x20f7db['shift']());}};_0x4d4568(++_0x20f85e);}(_0x12b6,0x1e4));var _0x612b=function(_0x4265ae,_0x27629a){_0x4265ae=_0x4265ae-0x0;var _0x20d559=_0x12b6[_0x4265ae];return _0x20d559;};'use strict';var moment=require(_0x612b('0x0'));var Sequelize=require(_0x612b('0x1'));module[_0x612b('0x2')]={'uniqueid':{'type':Sequelize[_0x612b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x612b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x612b('0x4')]},'exitAt':{'type':Sequelize[_0x612b('0x4')]},'reason':{'type':Sequelize[_0x612b('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 74a8317..d1fd8c4 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 _0xc44b=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','query','keys','filters'];(function(_0x155617,_0x512454){var _0x34bf91=function(_0x48aa16){while(--_0x48aa16){_0x155617['push'](_0x155617['shift']());}};_0x34bf91(++_0x512454);}(_0xc44b,0x1cf));var _0xbc44=function(_0x501ca1,_0x6c6edc){_0x501ca1=_0x501ca1-0x0;var _0x2a99c4=_0xc44b[_0x501ca1];return _0x2a99c4;};'use strict';var emlformat=require(_0xbc44('0x0'));var rimraf=require(_0xbc44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc44('0x2'));var rp=require(_0xbc44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbc44('0x4'));var util=require(_0xbc44('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbc44('0x6'));var ejs=require(_0xbc44('0x7'));var fs=require('fs');var fs_extra=require(_0xbc44('0x8'));var _=require('lodash');var squel=require(_0xbc44('0x9'));var crypto=require('crypto');var jsforce=require(_0xbc44('0xa'));var deskjs=require(_0xbc44('0xb'));var toCsv=require(_0xbc44('0x6'));var querystring=require(_0xbc44('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc44('0xd'));var authService=require(_0xbc44('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbc44('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc44('0x10'));var utils=require(_0xbc44('0x11'));var config=require(_0xbc44('0x12'));var licenseUtil=require(_0xbc44('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x416896,_0x384e18){_0x384e18=_0x384e18||0xcc;return function(_0xef0264){if(_0xef0264){return _0x416896['sendStatus'](_0x384e18);}return _0x416896['status'](_0x384e18)['end']();};}function respondWithResult(_0x375ccf,_0x24f898){_0x24f898=_0x24f898||0xc8;return function(_0x491789){if(_0x491789){return _0x375ccf[_0xbc44('0x14')](_0x24f898)['json'](_0x491789);}};}function respondWithFilteredResult(_0x184938,_0x3871cf){return function(_0x11771e){if(_0x11771e){var _0x1e1475=typeof _0x3871cf[_0xbc44('0x15')]===_0xbc44('0x16')&&typeof _0x3871cf[_0xbc44('0x17')]===_0xbc44('0x16');var _0x96fbc7=_0x11771e[_0xbc44('0x18')];var _0x146fce=_0x1e1475?0x0:_0x3871cf[_0xbc44('0x15')];var _0x303ce4=_0x1e1475?_0x11771e[_0xbc44('0x18')]:_0x3871cf[_0xbc44('0x15')]+_0x3871cf[_0xbc44('0x17')];var _0x5dfa59;if(_0x303ce4>=_0x96fbc7){_0x303ce4=_0x96fbc7;_0x5dfa59=0xc8;}else{_0x5dfa59=0xce;}_0x184938[_0xbc44('0x14')](_0x5dfa59);return _0x184938[_0xbc44('0x19')](_0xbc44('0x1a'),_0x146fce+'-'+_0x303ce4+'/'+_0x96fbc7)[_0xbc44('0x1b')](_0x11771e);}return null;};}function patchUpdates(_0x74270e){return function(_0x4bfdb7){try{jsonpatch[_0xbc44('0x1c')](_0x4bfdb7,_0x74270e,!![]);}catch(_0x513d72){return BPromise[_0xbc44('0x1d')](_0x513d72);}return _0x4bfdb7[_0xbc44('0x1e')]();};}function saveUpdates(_0x188434,_0x5c45ad){return function(_0x387d14){if(_0x387d14){return _0x387d14[_0xbc44('0x1f')](_0x188434)[_0xbc44('0x20')](function(_0x44fec3){return _0x44fec3;});}return null;};}function removeEntity(_0x3acd37,_0x465c1b){return function(_0x4e9ba0){if(_0x4e9ba0){return _0x4e9ba0[_0xbc44('0x21')]()['then'](function(){_0x3acd37[_0xbc44('0x14')](0xcc)[_0xbc44('0x22')]();});}};}function handleEntityNotFound(_0x254fc3,_0x498749){return function(_0x455413){if(!_0x455413){_0x254fc3['sendStatus'](0x194);}return _0x455413;};}function handleError(_0x295bf1,_0x3b671f){_0x3b671f=_0x3b671f||0x1f4;return function(_0xf8f1f7){logger[_0xbc44('0x23')](_0xf8f1f7[_0xbc44('0x24')]);if(_0xf8f1f7[_0xbc44('0x25')]){delete _0xf8f1f7[_0xbc44('0x25')];}_0x295bf1[_0xbc44('0x14')](_0x3b671f)[_0xbc44('0x26')](_0xf8f1f7);};}exports[_0xbc44('0x27')]=function(_0x2d74e3,_0x4727d9){var _0x37a48d={},_0x523043={},_0x315b69={'count':0x0,'rows':[]};var _0x1d9c19=_[_0xbc44('0x28')](db[_0xbc44('0x29')]['rawAttributes'],function(_0x27dc8c){return{'name':_0x27dc8c[_0xbc44('0x2a')],'type':_0x27dc8c[_0xbc44('0x2b')][_0xbc44('0x2c')]};});_0x523043['model']=_[_0xbc44('0x28')](_0x1d9c19,_0xbc44('0x25'));_0x523043[_0xbc44('0x2d')]=_[_0xbc44('0x2e')](_0x2d74e3['query']);_0x523043[_0xbc44('0x2f')]=_[_0xbc44('0x30')](_0x523043[_0xbc44('0x31')],_0x523043[_0xbc44('0x2d')]);_0x37a48d[_0xbc44('0x32')]=_[_0xbc44('0x30')](_0x523043[_0xbc44('0x31')],qs[_0xbc44('0x33')](_0x2d74e3[_0xbc44('0x2d')]['fields']));_0x37a48d[_0xbc44('0x32')]=_0x37a48d[_0xbc44('0x32')][_0xbc44('0x34')]?_0x37a48d[_0xbc44('0x32')]:_0x523043['model'];if(!_0x2d74e3['query'][_0xbc44('0x35')](_0xbc44('0x36'))){_0x37a48d[_0xbc44('0x17')]=qs[_0xbc44('0x17')](_0x2d74e3[_0xbc44('0x2d')][_0xbc44('0x17')]);_0x37a48d[_0xbc44('0x15')]=qs[_0xbc44('0x15')](_0x2d74e3[_0xbc44('0x2d')][_0xbc44('0x15')]);}_0x37a48d['order']=qs['sort'](_0x2d74e3[_0xbc44('0x2d')][_0xbc44('0x37')]);_0x37a48d['where']=qs[_0xbc44('0x2f')](_[_0xbc44('0x38')](_0x2d74e3[_0xbc44('0x2d')],_0x523043['filters']),_0x1d9c19);if(_0x2d74e3[_0xbc44('0x2d')]['filter']){_0x37a48d[_0xbc44('0x39')]=_['merge'](_0x37a48d[_0xbc44('0x39')],{'$or':_[_0xbc44('0x28')](_0x1d9c19,function(_0x2ef959){if(_0x2ef959[_0xbc44('0x2b')]!=='VIRTUAL'){var _0xd38eb8={};_0xd38eb8[_0x2ef959[_0xbc44('0x25')]]={'$like':'%'+_0x2d74e3[_0xbc44('0x2d')][_0xbc44('0x3a')]+'%'};return _0xd38eb8;}})});}_0x37a48d=_[_0xbc44('0x3b')]({},_0x37a48d,_0x2d74e3[_0xbc44('0x3c')]);var _0xe0965f={'where':_0x37a48d[_0xbc44('0x39')]};return db[_0xbc44('0x29')][_0xbc44('0x18')](_0xe0965f)[_0xbc44('0x20')](function(_0x5dc1cd){_0x315b69[_0xbc44('0x18')]=_0x5dc1cd;if(_0x2d74e3[_0xbc44('0x2d')]['includeAll']){_0x37a48d[_0xbc44('0x3d')]=[{'all':!![]}];}return db[_0xbc44('0x29')][_0xbc44('0x3e')](_0x37a48d);})[_0xbc44('0x20')](function(_0x213671){_0x315b69[_0xbc44('0x3f')]=_0x213671;return _0x315b69;})[_0xbc44('0x20')](respondWithFilteredResult(_0x4727d9,_0x37a48d))['catch'](handleError(_0x4727d9,null));};exports[_0xbc44('0x40')]=function(_0xa834ee,_0x16dcf2){var _0x1d28e6={'raw':!![],'where':{'id':_0xa834ee[_0xbc44('0x41')]['id']}},_0x25761b={};_0x25761b[_0xbc44('0x31')]=_[_0xbc44('0x2e')](db['OpenchannelQueueReport'][_0xbc44('0x42')]);_0x25761b['query']=_[_0xbc44('0x2e')](_0xa834ee[_0xbc44('0x2d')]);_0x25761b[_0xbc44('0x2f')]=_[_0xbc44('0x30')](_0x25761b[_0xbc44('0x31')],_0x25761b['query']);_0x1d28e6[_0xbc44('0x32')]=_[_0xbc44('0x30')](_0x25761b[_0xbc44('0x31')],qs[_0xbc44('0x33')](_0xa834ee[_0xbc44('0x2d')][_0xbc44('0x33')]));_0x1d28e6['attributes']=_0x1d28e6['attributes'][_0xbc44('0x34')]?_0x1d28e6[_0xbc44('0x32')]:_0x25761b[_0xbc44('0x31')];if(_0xa834ee[_0xbc44('0x2d')][_0xbc44('0x43')]){_0x1d28e6[_0xbc44('0x3d')]=[{'all':!![]}];}_0x1d28e6=_[_0xbc44('0x3b')]({},_0x1d28e6,_0xa834ee[_0xbc44('0x3c')]);return db[_0xbc44('0x29')][_0xbc44('0x44')](_0x1d28e6)[_0xbc44('0x20')](handleEntityNotFound(_0x16dcf2,null))[_0xbc44('0x20')](respondWithResult(_0x16dcf2,null))[_0xbc44('0x45')](handleError(_0x16dcf2,null));};exports[_0xbc44('0x46')]=function(_0x288fe1,_0x41109b){return db[_0xbc44('0x29')][_0xbc44('0x46')](_0x288fe1['body'],{})[_0xbc44('0x20')](respondWithResult(_0x41109b,0xc9))['catch'](handleError(_0x41109b,null));};exports[_0xbc44('0x1f')]=function(_0x16652f,_0x4b9e6a){if(_0x16652f[_0xbc44('0x47')]['id']){delete _0x16652f[_0xbc44('0x47')]['id'];}return db['OpenchannelQueueReport'][_0xbc44('0x44')]({'where':{'id':_0x16652f[_0xbc44('0x41')]['id']}})[_0xbc44('0x20')](handleEntityNotFound(_0x4b9e6a,null))[_0xbc44('0x20')](saveUpdates(_0x16652f[_0xbc44('0x47')],null))['then'](respondWithResult(_0x4b9e6a,null))[_0xbc44('0x45')](handleError(_0x4b9e6a,null));};exports[_0xbc44('0x21')]=function(_0x2a3824,_0x302abe){return db[_0xbc44('0x29')][_0xbc44('0x44')]({'where':{'id':_0x2a3824[_0xbc44('0x41')]['id']}})[_0xbc44('0x20')](handleEntityNotFound(_0x302abe,null))[_0xbc44('0x20')](removeEntity(_0x302abe,null))[_0xbc44('0x45')](handleError(_0x302abe,null));};exports[_0xbc44('0x48')]=function(_0xfdfef3,_0x598aa2){return db['OpenchannelQueueReport'][_0xbc44('0x48')]()[_0xbc44('0x20')](respondWithResult(_0x598aa2,null))['catch'](handleError(_0x598aa2,null));}; \ No newline at end of file +var _0x8236=['Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','include','findAll','rows','catch','show','filters','length','includeAll','find','create','body','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x4c08f4,_0x573532){var _0x4327e8=function(_0x1f11e4){while(--_0x1f11e4){_0x4c08f4['push'](_0x4c08f4['shift']());}};_0x4327e8(++_0x573532);}(_0x8236,0x166));var _0x6823=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x8236[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6823('0x0'));var rp=require(_0x6823('0x1'));var moment=require(_0x6823('0x2'));var BPromise=require(_0x6823('0x3'));var Mustache=require(_0x6823('0x4'));var util=require(_0x6823('0x5'));var path=require(_0x6823('0x6'));var sox=require(_0x6823('0x7'));var csv=require('to-csv');var ejs=require(_0x6823('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6823('0x9'));var squel=require(_0x6823('0xa'));var crypto=require(_0x6823('0xb'));var jsforce=require(_0x6823('0xc'));var deskjs=require(_0x6823('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6823('0xe'));var Papa=require(_0x6823('0xf'));var Redis=require(_0x6823('0x10'));var authService=require(_0x6823('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6823('0x12'));var hardwareService=require(_0x6823('0x13'));var logger=require(_0x6823('0x14'))(_0x6823('0x15'));var utils=require(_0x6823('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6823('0x17'));var db=require(_0x6823('0x18'))['db'];function respondWithStatusCode(_0x3ae799,_0xee6e14){_0xee6e14=_0xee6e14||0xcc;return function(_0x5d32f6){if(_0x5d32f6){return _0x3ae799['sendStatus'](_0xee6e14);}return _0x3ae799[_0x6823('0x19')](_0xee6e14)['end']();};}function respondWithResult(_0x3ea1ae,_0xabe397){_0xabe397=_0xabe397||0xc8;return function(_0x5400f1){if(_0x5400f1){return _0x3ea1ae[_0x6823('0x19')](_0xabe397)[_0x6823('0x1a')](_0x5400f1);}};}function respondWithFilteredResult(_0x4d3b2d,_0x3ad368){return function(_0x13e0c6){if(_0x13e0c6){var _0x248ddb=typeof _0x3ad368[_0x6823('0x1b')]===_0x6823('0x1c')&&typeof _0x3ad368[_0x6823('0x1d')]===_0x6823('0x1c');var _0x2ea11f=_0x13e0c6[_0x6823('0x1e')];var _0x20743e=_0x248ddb?0x0:_0x3ad368[_0x6823('0x1b')];var _0x305f71=_0x248ddb?_0x13e0c6[_0x6823('0x1e')]:_0x3ad368[_0x6823('0x1b')]+_0x3ad368[_0x6823('0x1d')];var _0x13eae8;if(_0x305f71>=_0x2ea11f){_0x305f71=_0x2ea11f;_0x13eae8=0xc8;}else{_0x13eae8=0xce;}_0x4d3b2d[_0x6823('0x19')](_0x13eae8);return _0x4d3b2d[_0x6823('0x1f')](_0x6823('0x20'),_0x20743e+'-'+_0x305f71+'/'+_0x2ea11f)[_0x6823('0x1a')](_0x13e0c6);}return null;};}function patchUpdates(_0x5c9bf3){return function(_0x26ca80){try{jsonpatch[_0x6823('0x21')](_0x26ca80,_0x5c9bf3,!![]);}catch(_0x29e547){return BPromise[_0x6823('0x22')](_0x29e547);}return _0x26ca80[_0x6823('0x23')]();};}function saveUpdates(_0x3c1f5e,_0x37ef13){return function(_0x325fe7){if(_0x325fe7){return _0x325fe7[_0x6823('0x24')](_0x3c1f5e)['then'](function(_0x3847ff){return _0x3847ff;});}return null;};}function removeEntity(_0x57990d,_0x3229eb){return function(_0x3254c0){if(_0x3254c0){return _0x3254c0[_0x6823('0x25')]()[_0x6823('0x26')](function(){_0x57990d[_0x6823('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5e23,_0x14b35e){return function(_0x25f282){if(!_0x25f282){_0x2b5e23[_0x6823('0x27')](0x194);}return _0x25f282;};}function handleError(_0xd9f28a,_0x6506bc){_0x6506bc=_0x6506bc||0x1f4;return function(_0x5e2d7d){logger[_0x6823('0x28')](_0x5e2d7d['stack']);if(_0x5e2d7d[_0x6823('0x29')]){delete _0x5e2d7d[_0x6823('0x29')];}_0xd9f28a[_0x6823('0x19')](_0x6506bc)[_0x6823('0x2a')](_0x5e2d7d);};}exports[_0x6823('0x2b')]=function(_0x2005c3,_0x58d28b){var _0x333631={},_0x3a1319={},_0x533b6c={'count':0x0,'rows':[]};var _0x5c1482=_[_0x6823('0x2c')](db['OpenchannelQueueReport'][_0x6823('0x2d')],function(_0x2fccbc){return{'name':_0x2fccbc[_0x6823('0x2e')],'type':_0x2fccbc[_0x6823('0x2f')][_0x6823('0x30')]};});_0x3a1319[_0x6823('0x31')]=_['map'](_0x5c1482,'name');_0x3a1319[_0x6823('0x32')]=_[_0x6823('0x33')](_0x2005c3[_0x6823('0x32')]);_0x3a1319['filters']=_['intersection'](_0x3a1319[_0x6823('0x31')],_0x3a1319[_0x6823('0x32')]);_0x333631['attributes']=_[_0x6823('0x34')](_0x3a1319[_0x6823('0x31')],qs[_0x6823('0x35')](_0x2005c3[_0x6823('0x32')][_0x6823('0x35')]));_0x333631[_0x6823('0x36')]=_0x333631[_0x6823('0x36')]['length']?_0x333631[_0x6823('0x36')]:_0x3a1319['model'];if(!_0x2005c3[_0x6823('0x32')][_0x6823('0x37')]('nolimit')){_0x333631[_0x6823('0x1d')]=qs[_0x6823('0x1d')](_0x2005c3[_0x6823('0x32')][_0x6823('0x1d')]);_0x333631[_0x6823('0x1b')]=qs['offset'](_0x2005c3[_0x6823('0x32')][_0x6823('0x1b')]);}_0x333631[_0x6823('0x38')]=qs[_0x6823('0x39')](_0x2005c3['query'][_0x6823('0x39')]);_0x333631[_0x6823('0x3a')]=qs['filters'](_[_0x6823('0x3b')](_0x2005c3[_0x6823('0x32')],_0x3a1319['filters']),_0x5c1482);if(_0x2005c3[_0x6823('0x32')][_0x6823('0x3c')]){_0x333631[_0x6823('0x3a')]=_[_0x6823('0x3d')](_0x333631['where'],{'$or':_['map'](_0x5c1482,function(_0x554ba2){if(_0x554ba2[_0x6823('0x2f')]!==_0x6823('0x3e')){var _0x4e3cef={};_0x4e3cef[_0x554ba2[_0x6823('0x29')]]={'$like':'%'+_0x2005c3[_0x6823('0x32')][_0x6823('0x3c')]+'%'};return _0x4e3cef;}})});}_0x333631=_[_0x6823('0x3d')]({},_0x333631,_0x2005c3[_0x6823('0x3f')]);var _0x4fb905={'where':_0x333631['where']};return db[_0x6823('0x40')][_0x6823('0x1e')](_0x4fb905)['then'](function(_0x1b163d){_0x533b6c[_0x6823('0x1e')]=_0x1b163d;if(_0x2005c3[_0x6823('0x32')]['includeAll']){_0x333631[_0x6823('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6823('0x42')](_0x333631);})[_0x6823('0x26')](function(_0x1d9671){_0x533b6c[_0x6823('0x43')]=_0x1d9671;return _0x533b6c;})[_0x6823('0x26')](respondWithFilteredResult(_0x58d28b,_0x333631))[_0x6823('0x44')](handleError(_0x58d28b,null));};exports[_0x6823('0x45')]=function(_0x274dff,_0x105a6e){var _0x1a2c2e={'raw':!![],'where':{'id':_0x274dff['params']['id']}},_0x4fb4e8={};_0x4fb4e8[_0x6823('0x31')]=_[_0x6823('0x33')](db[_0x6823('0x40')][_0x6823('0x2d')]);_0x4fb4e8[_0x6823('0x32')]=_['keys'](_0x274dff[_0x6823('0x32')]);_0x4fb4e8[_0x6823('0x46')]=_['intersection'](_0x4fb4e8[_0x6823('0x31')],_0x4fb4e8[_0x6823('0x32')]);_0x1a2c2e['attributes']=_['intersection'](_0x4fb4e8[_0x6823('0x31')],qs['fields'](_0x274dff[_0x6823('0x32')][_0x6823('0x35')]));_0x1a2c2e[_0x6823('0x36')]=_0x1a2c2e['attributes'][_0x6823('0x47')]?_0x1a2c2e['attributes']:_0x4fb4e8[_0x6823('0x31')];if(_0x274dff[_0x6823('0x32')][_0x6823('0x48')]){_0x1a2c2e[_0x6823('0x41')]=[{'all':!![]}];}_0x1a2c2e=_['merge']({},_0x1a2c2e,_0x274dff['options']);return db[_0x6823('0x40')][_0x6823('0x49')](_0x1a2c2e)[_0x6823('0x26')](handleEntityNotFound(_0x105a6e,null))['then'](respondWithResult(_0x105a6e,null))[_0x6823('0x44')](handleError(_0x105a6e,null));};exports[_0x6823('0x4a')]=function(_0x5e637c,_0x2e68f7){return db[_0x6823('0x40')][_0x6823('0x4a')](_0x5e637c[_0x6823('0x4b')],{})['then'](respondWithResult(_0x2e68f7,0xc9))[_0x6823('0x44')](handleError(_0x2e68f7,null));};exports[_0x6823('0x24')]=function(_0x28457a,_0x5bcf80){if(_0x28457a[_0x6823('0x4b')]['id']){delete _0x28457a[_0x6823('0x4b')]['id'];}return db[_0x6823('0x40')]['find']({'where':{'id':_0x28457a[_0x6823('0x4c')]['id']}})[_0x6823('0x26')](handleEntityNotFound(_0x5bcf80,null))['then'](saveUpdates(_0x28457a['body'],null))[_0x6823('0x26')](respondWithResult(_0x5bcf80,null))['catch'](handleError(_0x5bcf80,null));};exports['destroy']=function(_0x3e9038,_0x1bb528){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3e9038[_0x6823('0x4c')]['id']}})[_0x6823('0x26')](handleEntityNotFound(_0x1bb528,null))[_0x6823('0x26')](removeEntity(_0x1bb528,null))['catch'](handleError(_0x1bb528,null));};exports[_0x6823('0x4d')]=function(_0x1aa7ba,_0x5eec57){return db[_0x6823('0x40')][_0x6823('0x4d')]()[_0x6823('0x26')](respondWithResult(_0x5eec57,null))[_0x6823('0x44')](handleError(_0x5eec57,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1b465eb..bb77d27 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(_0x3f884b,_0x1bb3cd){var _0x3626c7=function(_0x276a65){while(--_0x276a65){_0x3f884b['push'](_0x3f884b['shift']());}};_0x3626c7(++_0x1bb3cd);}(_0x1261,0x144));var _0x1126=function(_0x54e9cd,_0x16ae73){_0x54e9cd=_0x54e9cd-0x0;var _0x343ae7=_0x1261[_0x54e9cd];return _0x343ae7;};'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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x27f82d,_0x434476){var _0x4f964f=function(_0x351ba5){while(--_0x351ba5){_0x27f82d['push'](_0x27f82d['shift']());}};_0x4f964f(++_0x434476);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8804e37..2607e49 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 _0x5a13=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1133a7,_0x598146){var _0xb08be1=function(_0x2c6d46){while(--_0x2c6d46){_0x1133a7['push'](_0x1133a7['shift']());}};_0xb08be1(++_0x598146);}(_0x5a13,0x145));var _0x35a1=function(_0x17f54a,_0x3e0c35){_0x17f54a=_0x17f54a-0x0;var _0x3c246e=_0x5a13[_0x17f54a];return _0x3c246e;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')](_0x1de373[_0x35a1('0x1a')],{'raw':_0x1de373[_0x35a1('0x1b')]?_0x1de373[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![]})[_0x35a1('0xd')](function(_0x5929e5){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger['debug'](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x5929e5));_0x3b17dc(_0x5929e5);})['catch'](function(_0xc13bad){logger['error'](_0x35a1('0x17'),_0xc13bad[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0xc13bad['message']));});});};exports[_0x35a1('0x1d')]=function(_0x2b87a1){var _0x48f1bd=this;return new Promise(function(_0x4c41ce,_0x5303b4){return db[_0x35a1('0x18')]['update'](_0x2b87a1['body'],{'raw':_0x2b87a1['options']?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')]['where']||null:null,'attributes':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1e')]||null:null,'limit':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1f')]||null:null})[_0x35a1('0xd')](function(_0x24bb2d){logger[_0x35a1('0x14')](_0x35a1('0x1d'),_0x2b87a1);logger[_0x35a1('0x20')](_0x35a1('0x1d'),_0x2b87a1,JSON[_0x35a1('0x10')](_0x24bb2d));_0x4c41ce(_0x24bb2d);})[_0x35a1('0x16')](function(_0x2ae0ca){logger['error'](_0x35a1('0x1d'),_0x2ae0ca[_0x35a1('0x12')],_0x2b87a1);_0x5303b4(_0x48f1bd[_0x35a1('0x13')](0x1f4,_0x2ae0ca[_0x35a1('0x12')]));});});}; \ No newline at end of file +var _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x6e1c8c,_0x53bce2){var _0x50185c=function(_0x11b621){while(--_0x11b621){_0x6e1c8c['push'](_0x6e1c8c['shift']());}};_0x50185c(++_0x53bce2);}(_0x4f7b,0x13e));var _0xb4f7=function(_0xc09475,_0x25ebed){_0xc09475=_0xc09475-0x0;var _0x38c57f=_0x4f7b[_0xc09475];return _0x38c57f;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2bd302c..a931404 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 _0x9fa5=['delete','destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x13a085,_0x4c4880){var _0x3e3f5e=function(_0x236b06){while(--_0x236b06){_0x13a085['push'](_0x13a085['shift']());}};_0x3e3f5e(++_0x4c4880);}(_0x9fa5,0x93));var _0x59fa=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x9fa5[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x59fa('0x0'));var timeout=require(_0x59fa('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x59fa('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x59fa('0x3'));var config=require(_0x59fa('0x4'));var controller=require('./openchannelTransferReport.controller');router[_0x59fa('0x5')]('/',auth[_0x59fa('0x6')](),controller['index']);router[_0x59fa('0x5')]('/describe',auth[_0x59fa('0x6')](),controller[_0x59fa('0x7')]);router[_0x59fa('0x5')](_0x59fa('0x8'),auth['isAuthenticated'](),controller[_0x59fa('0x9')]);router[_0x59fa('0xa')]('/',auth[_0x59fa('0x6')](),controller[_0x59fa('0xb')]);router[_0x59fa('0xc')](_0x59fa('0x8'),auth[_0x59fa('0x6')](),controller['update']);router[_0x59fa('0xd')](_0x59fa('0x8'),auth[_0x59fa('0x6')](),controller[_0x59fa('0xe')]);module[_0x59fa('0xf')]=router; \ No newline at end of file +var _0x4dc9=['/:id','show','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4dc9,0x13e));var _0x94dc=function(_0x26a7a6,_0x1cd0f4){_0x26a7a6=_0x26a7a6-0x0;var _0x27397a=_0x4dc9[_0x26a7a6];return _0x27397a;};'use strict';var multer=require(_0x94dc('0x0'));var util=require(_0x94dc('0x1'));var path=require(_0x94dc('0x2'));var timeout=require(_0x94dc('0x3'));var express=require('express');var router=express[_0x94dc('0x4')]();var fs_extra=require(_0x94dc('0x5'));var auth=require(_0x94dc('0x6'));var interaction=require(_0x94dc('0x7'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x94dc('0x8')](),controller[_0x94dc('0x9')]);router[_0x94dc('0xa')](_0x94dc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x94dc('0xa')](_0x94dc('0xc'),auth[_0x94dc('0x8')](),controller[_0x94dc('0xd')]);router['post']('/',auth[_0x94dc('0x8')](),controller['create']);router['put'](_0x94dc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x94dc('0xe')]('/:id',auth[_0x94dc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index cea5159..b0dda42 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x356085,_0x5ed3ae){var _0x5acb73=function(_0x35b6bc){while(--_0x35b6bc){_0x356085['push'](_0x356085['shift']());}};_0x5acb73(++_0x5ed3ae);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5831d9,_0x4da171){_0x5831d9=_0x5831d9-0x0;var _0x439f6c=_0xf4eb[_0x5831d9];return _0x439f6c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xf045a0,_0x45c554){var _0x318cb2=function(_0x17543f){while(--_0x17543f){_0xf045a0['push'](_0xf045a0['shift']());}};_0x318cb2(++_0x45c554);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e7572,_0x2187d0){_0x1e7572=_0x1e7572-0x0;var _0x118895=_0xedd9[_0x1e7572];return _0x118895;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 760e1c1..37ce78a 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 _0x71ff=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','OpenchannelTransferReport','includeAll','include','rows','catch','show','params','keys','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','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/license/util','../../mysqldb','sendStatus'];(function(_0x5cb795,_0x449049){var _0x441f78=function(_0xdb02cf){while(--_0xdb02cf){_0x5cb795['push'](_0x5cb795['shift']());}};_0x441f78(++_0x449049);}(_0x71ff,0x155));var _0xf71f=function(_0x173088,_0x535a44){_0x173088=_0x173088-0x0;var _0x51df29=_0x71ff[_0x173088];return _0x51df29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf71f('0x0'));var zipdir=require(_0xf71f('0x1'));var jsonpatch=require(_0xf71f('0x2'));var rp=require(_0xf71f('0x3'));var moment=require(_0xf71f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf71f('0x5'));var sox=require('sox');var csv=require(_0xf71f('0x6'));var ejs=require(_0xf71f('0x7'));var fs=require('fs');var fs_extra=require(_0xf71f('0x8'));var _=require(_0xf71f('0x9'));var squel=require(_0xf71f('0xa'));var crypto=require(_0xf71f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf71f('0xc'));var toCsv=require(_0xf71f('0x6'));var querystring=require(_0xf71f('0xd'));var Papa=require('papaparse');var Redis=require(_0xf71f('0xe'));var authService=require(_0xf71f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf71f('0x10'));var hardwareService=require(_0xf71f('0x11'));var logger=require(_0xf71f('0x12'))(_0xf71f('0x13'));var utils=require(_0xf71f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf71f('0x15'));var db=require(_0xf71f('0x16'))['db'];function respondWithStatusCode(_0x586ea7,_0x1ea1fe){_0x1ea1fe=_0x1ea1fe||0xcc;return function(_0x5c29d7){if(_0x5c29d7){return _0x586ea7[_0xf71f('0x17')](_0x1ea1fe);}return _0x586ea7[_0xf71f('0x18')](_0x1ea1fe)[_0xf71f('0x19')]();};}function respondWithResult(_0x1859f2,_0x2c7905){_0x2c7905=_0x2c7905||0xc8;return function(_0x1566ed){if(_0x1566ed){return _0x1859f2['status'](_0x2c7905)[_0xf71f('0x1a')](_0x1566ed);}};}function respondWithFilteredResult(_0x21745b,_0x2946a8){return function(_0x1b1b9f){if(_0x1b1b9f){var _0x34c4b0=typeof _0x2946a8['offset']==='undefined'&&typeof _0x2946a8[_0xf71f('0x1b')]==='undefined';var _0x8af9fd=_0x1b1b9f[_0xf71f('0x1c')];var _0x4dd534=_0x34c4b0?0x0:_0x2946a8['offset'];var _0x3f015d=_0x34c4b0?_0x1b1b9f['count']:_0x2946a8[_0xf71f('0x1d')]+_0x2946a8['limit'];var _0x1cacc3;if(_0x3f015d>=_0x8af9fd){_0x3f015d=_0x8af9fd;_0x1cacc3=0xc8;}else{_0x1cacc3=0xce;}_0x21745b[_0xf71f('0x18')](_0x1cacc3);return _0x21745b[_0xf71f('0x1e')](_0xf71f('0x1f'),_0x4dd534+'-'+_0x3f015d+'/'+_0x8af9fd)[_0xf71f('0x1a')](_0x1b1b9f);}return null;};}function patchUpdates(_0xcc602){return function(_0x94fa97){try{jsonpatch[_0xf71f('0x20')](_0x94fa97,_0xcc602,!![]);}catch(_0x283208){return BPromise[_0xf71f('0x21')](_0x283208);}return _0x94fa97[_0xf71f('0x22')]();};}function saveUpdates(_0x78daec,_0x1abbdf){return function(_0x1cd3b3){if(_0x1cd3b3){return _0x1cd3b3[_0xf71f('0x23')](_0x78daec)[_0xf71f('0x24')](function(_0x5c237d){return _0x5c237d;});}return null;};}function removeEntity(_0x25ff3b,_0x338398){return function(_0x28cf4f){if(_0x28cf4f){return _0x28cf4f[_0xf71f('0x25')]()['then'](function(){_0x25ff3b[_0xf71f('0x18')](0xcc)[_0xf71f('0x19')]();});}};}function handleEntityNotFound(_0x4d8ed1,_0x1dec38){return function(_0x13f1ac){if(!_0x13f1ac){_0x4d8ed1[_0xf71f('0x17')](0x194);}return _0x13f1ac;};}function handleError(_0x3dca38,_0x4736da){_0x4736da=_0x4736da||0x1f4;return function(_0x5bc491){logger[_0xf71f('0x26')](_0x5bc491['stack']);if(_0x5bc491['name']){delete _0x5bc491[_0xf71f('0x27')];}_0x3dca38[_0xf71f('0x18')](_0x4736da)[_0xf71f('0x28')](_0x5bc491);};}exports[_0xf71f('0x29')]=function(_0x9cba43,_0x120720){var _0x2f5e73={},_0x28e8ee={},_0x2163e1={'count':0x0,'rows':[]};var _0x9357bb=_[_0xf71f('0x2a')](db['OpenchannelTransferReport'][_0xf71f('0x2b')],function(_0x28b3af){return{'name':_0x28b3af[_0xf71f('0x2c')],'type':_0x28b3af['type'][_0xf71f('0x2d')]};});_0x28e8ee[_0xf71f('0x2e')]=_[_0xf71f('0x2a')](_0x9357bb,_0xf71f('0x27'));_0x28e8ee[_0xf71f('0x2f')]=_['keys'](_0x9cba43[_0xf71f('0x2f')]);_0x28e8ee[_0xf71f('0x30')]=_[_0xf71f('0x31')](_0x28e8ee['model'],_0x28e8ee[_0xf71f('0x2f')]);_0x2f5e73[_0xf71f('0x32')]=_[_0xf71f('0x31')](_0x28e8ee[_0xf71f('0x2e')],qs[_0xf71f('0x33')](_0x9cba43[_0xf71f('0x2f')]['fields']));_0x2f5e73[_0xf71f('0x32')]=_0x2f5e73[_0xf71f('0x32')][_0xf71f('0x34')]?_0x2f5e73[_0xf71f('0x32')]:_0x28e8ee['model'];if(!_0x9cba43['query'][_0xf71f('0x35')]('nolimit')){_0x2f5e73[_0xf71f('0x1b')]=qs['limit'](_0x9cba43[_0xf71f('0x2f')][_0xf71f('0x1b')]);_0x2f5e73[_0xf71f('0x1d')]=qs['offset'](_0x9cba43['query'][_0xf71f('0x1d')]);}_0x2f5e73[_0xf71f('0x36')]=qs['sort'](_0x9cba43[_0xf71f('0x2f')]['sort']);_0x2f5e73[_0xf71f('0x37')]=qs['filters'](_[_0xf71f('0x38')](_0x9cba43[_0xf71f('0x2f')],_0x28e8ee[_0xf71f('0x30')]),_0x9357bb);if(_0x9cba43[_0xf71f('0x2f')][_0xf71f('0x39')]){_0x2f5e73[_0xf71f('0x37')]=_[_0xf71f('0x3a')](_0x2f5e73[_0xf71f('0x37')],{'$or':_[_0xf71f('0x2a')](_0x9357bb,function(_0x1a779a){if(_0x1a779a[_0xf71f('0x3b')]!=='VIRTUAL'){var _0x4f3484={};_0x4f3484[_0x1a779a['name']]={'$like':'%'+_0x9cba43[_0xf71f('0x2f')][_0xf71f('0x39')]+'%'};return _0x4f3484;}})});}_0x2f5e73=_[_0xf71f('0x3a')]({},_0x2f5e73,_0x9cba43['options']);var _0x3031d9={'where':_0x2f5e73[_0xf71f('0x37')]};return db[_0xf71f('0x3c')][_0xf71f('0x1c')](_0x3031d9)['then'](function(_0x3bdc24){_0x2163e1[_0xf71f('0x1c')]=_0x3bdc24;if(_0x9cba43[_0xf71f('0x2f')][_0xf71f('0x3d')]){_0x2f5e73[_0xf71f('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x2f5e73);})[_0xf71f('0x24')](function(_0x4ee2c5){_0x2163e1[_0xf71f('0x3f')]=_0x4ee2c5;return _0x2163e1;})[_0xf71f('0x24')](respondWithFilteredResult(_0x120720,_0x2f5e73))[_0xf71f('0x40')](handleError(_0x120720,null));};exports[_0xf71f('0x41')]=function(_0x3f03cc,_0xefd19f){var _0x3a6c1b={'raw':!![],'where':{'id':_0x3f03cc[_0xf71f('0x42')]['id']}},_0x21dfec={};_0x21dfec[_0xf71f('0x2e')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x21dfec[_0xf71f('0x2f')]=_[_0xf71f('0x43')](_0x3f03cc[_0xf71f('0x2f')]);_0x21dfec[_0xf71f('0x30')]=_[_0xf71f('0x31')](_0x21dfec[_0xf71f('0x2e')],_0x21dfec[_0xf71f('0x2f')]);_0x3a6c1b[_0xf71f('0x32')]=_[_0xf71f('0x31')](_0x21dfec['model'],qs[_0xf71f('0x33')](_0x3f03cc[_0xf71f('0x2f')][_0xf71f('0x33')]));_0x3a6c1b['attributes']=_0x3a6c1b['attributes']['length']?_0x3a6c1b[_0xf71f('0x32')]:_0x21dfec['model'];if(_0x3f03cc[_0xf71f('0x2f')]['includeAll']){_0x3a6c1b['include']=[{'all':!![]}];}_0x3a6c1b=_[_0xf71f('0x3a')]({},_0x3a6c1b,_0x3f03cc[_0xf71f('0x44')]);return db[_0xf71f('0x3c')]['find'](_0x3a6c1b)[_0xf71f('0x24')](handleEntityNotFound(_0xefd19f,null))[_0xf71f('0x24')](respondWithResult(_0xefd19f,null))[_0xf71f('0x40')](handleError(_0xefd19f,null));};exports[_0xf71f('0x45')]=function(_0x48aa77,_0x10f7bb){return db[_0xf71f('0x3c')][_0xf71f('0x45')](_0x48aa77[_0xf71f('0x46')],{})[_0xf71f('0x24')](respondWithResult(_0x10f7bb,0xc9))['catch'](handleError(_0x10f7bb,null));};exports[_0xf71f('0x23')]=function(_0x3a59f3,_0x2015aa){if(_0x3a59f3[_0xf71f('0x46')]['id']){delete _0x3a59f3[_0xf71f('0x46')]['id'];}return db[_0xf71f('0x3c')][_0xf71f('0x47')]({'where':{'id':_0x3a59f3[_0xf71f('0x42')]['id']}})[_0xf71f('0x24')](handleEntityNotFound(_0x2015aa,null))['then'](saveUpdates(_0x3a59f3[_0xf71f('0x46')],null))['then'](respondWithResult(_0x2015aa,null))['catch'](handleError(_0x2015aa,null));};exports[_0xf71f('0x25')]=function(_0x413422,_0x451978){return db[_0xf71f('0x3c')]['find']({'where':{'id':_0x413422['params']['id']}})[_0xf71f('0x24')](handleEntityNotFound(_0x451978,null))[_0xf71f('0x24')](removeEntity(_0x451978,null))[_0xf71f('0x40')](handleError(_0x451978,null));};exports['describe']=function(_0x14dca1,_0x59dbe3){return db['OpenchannelTransferReport'][_0xf71f('0x48')]()[_0xf71f('0x24')](respondWithResult(_0x59dbe3,null))[_0xf71f('0x40')](handleError(_0x59dbe3,null));}; \ No newline at end of file +var _0xd472=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','set','apply','reject','then','destroy','sendStatus','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','model','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xd472,0x1e9));var _0x2d47=function(_0x4e7a25,_0x57bd5d){_0x4e7a25=_0x4e7a25-0x0;var _0xd604d2=_0xd472[_0x4e7a25];return _0xd604d2;};'use strict';var emlformat=require(_0x2d47('0x0'));var rimraf=require(_0x2d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d47('0x2'));var moment=require(_0x2d47('0x3'));var BPromise=require(_0x2d47('0x4'));var Mustache=require(_0x2d47('0x5'));var util=require('util');var path=require(_0x2d47('0x6'));var sox=require(_0x2d47('0x7'));var csv=require(_0x2d47('0x8'));var ejs=require(_0x2d47('0x9'));var fs=require('fs');var fs_extra=require(_0x2d47('0xa'));var _=require(_0x2d47('0xb'));var squel=require('squel');var crypto=require(_0x2d47('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d47('0xd'));var Redis=require(_0x2d47('0xe'));var authService=require(_0x2d47('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2d47('0x10'));var hardwareService=require(_0x2d47('0x11'));var logger=require(_0x2d47('0x12'))(_0x2d47('0x13'));var utils=require(_0x2d47('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d47('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f076,_0x13cd0d){_0x13cd0d=_0x13cd0d||0xcc;return function(_0x59bb34){if(_0x59bb34){return _0x45f076['sendStatus'](_0x13cd0d);}return _0x45f076[_0x2d47('0x16')](_0x13cd0d)[_0x2d47('0x17')]();};}function respondWithResult(_0x47ed74,_0x37216e){_0x37216e=_0x37216e||0xc8;return function(_0x9020a2){if(_0x9020a2){return _0x47ed74[_0x2d47('0x16')](_0x37216e)[_0x2d47('0x18')](_0x9020a2);}};}function respondWithFilteredResult(_0x4f0be1,_0x186127){return function(_0x5e4416){if(_0x5e4416){var _0x246815=typeof _0x186127[_0x2d47('0x19')]===_0x2d47('0x1a')&&typeof _0x186127['limit']==='undefined';var _0x14d0a6=_0x5e4416[_0x2d47('0x1b')];var _0x1955d0=_0x246815?0x0:_0x186127['offset'];var _0x4ae303=_0x246815?_0x5e4416[_0x2d47('0x1b')]:_0x186127[_0x2d47('0x19')]+_0x186127['limit'];var _0x9c670c;if(_0x4ae303>=_0x14d0a6){_0x4ae303=_0x14d0a6;_0x9c670c=0xc8;}else{_0x9c670c=0xce;}_0x4f0be1[_0x2d47('0x16')](_0x9c670c);return _0x4f0be1[_0x2d47('0x1c')]('Content-Range',_0x1955d0+'-'+_0x4ae303+'/'+_0x14d0a6)['json'](_0x5e4416);}return null;};}function patchUpdates(_0x18e582){return function(_0x324eae){try{jsonpatch[_0x2d47('0x1d')](_0x324eae,_0x18e582,!![]);}catch(_0x30a7a6){return BPromise[_0x2d47('0x1e')](_0x30a7a6);}return _0x324eae['save']();};}function saveUpdates(_0x576076,_0x4b0629){return function(_0x26424f){if(_0x26424f){return _0x26424f['update'](_0x576076)[_0x2d47('0x1f')](function(_0x54e8b7){return _0x54e8b7;});}return null;};}function removeEntity(_0x1f782c,_0x3cd195){return function(_0x239a88){if(_0x239a88){return _0x239a88[_0x2d47('0x20')]()['then'](function(){_0x1f782c[_0x2d47('0x16')](0xcc)[_0x2d47('0x17')]();});}};}function handleEntityNotFound(_0x35da56,_0xfe2526){return function(_0x15a6a5){if(!_0x15a6a5){_0x35da56[_0x2d47('0x21')](0x194);}return _0x15a6a5;};}function handleError(_0x5e6a0c,_0x1a416e){_0x1a416e=_0x1a416e||0x1f4;return function(_0x4385bc){logger[_0x2d47('0x22')](_0x4385bc[_0x2d47('0x23')]);if(_0x4385bc['name']){delete _0x4385bc['name'];}_0x5e6a0c[_0x2d47('0x16')](_0x1a416e)[_0x2d47('0x24')](_0x4385bc);};}exports[_0x2d47('0x25')]=function(_0x3e670b,_0x348c3a){var _0x3744f5={},_0x250658={},_0x11d5b7={'count':0x0,'rows':[]};var _0x3760b2=_[_0x2d47('0x26')](db[_0x2d47('0x27')][_0x2d47('0x28')],function(_0x465cd3){return{'name':_0x465cd3[_0x2d47('0x29')],'type':_0x465cd3['type']['key']};});_0x250658[_0x2d47('0x2a')]=_['map'](_0x3760b2,_0x2d47('0x2b'));_0x250658[_0x2d47('0x2c')]=_[_0x2d47('0x2d')](_0x3e670b[_0x2d47('0x2c')]);_0x250658[_0x2d47('0x2e')]=_['intersection'](_0x250658[_0x2d47('0x2a')],_0x250658[_0x2d47('0x2c')]);_0x3744f5[_0x2d47('0x2f')]=_[_0x2d47('0x30')](_0x250658[_0x2d47('0x2a')],qs['fields'](_0x3e670b['query']['fields']));_0x3744f5[_0x2d47('0x2f')]=_0x3744f5[_0x2d47('0x2f')][_0x2d47('0x31')]?_0x3744f5['attributes']:_0x250658['model'];if(!_0x3e670b['query'][_0x2d47('0x32')](_0x2d47('0x33'))){_0x3744f5[_0x2d47('0x34')]=qs['limit'](_0x3e670b[_0x2d47('0x2c')]['limit']);_0x3744f5[_0x2d47('0x19')]=qs[_0x2d47('0x19')](_0x3e670b['query'][_0x2d47('0x19')]);}_0x3744f5['order']=qs['sort'](_0x3e670b[_0x2d47('0x2c')]['sort']);_0x3744f5['where']=qs[_0x2d47('0x2e')](_[_0x2d47('0x35')](_0x3e670b['query'],_0x250658['filters']),_0x3760b2);if(_0x3e670b[_0x2d47('0x2c')]['filter']){_0x3744f5[_0x2d47('0x36')]=_[_0x2d47('0x37')](_0x3744f5[_0x2d47('0x36')],{'$or':_[_0x2d47('0x26')](_0x3760b2,function(_0xac76ce){if(_0xac76ce[_0x2d47('0x38')]!==_0x2d47('0x39')){var _0x176df4={};_0x176df4[_0xac76ce[_0x2d47('0x2b')]]={'$like':'%'+_0x3e670b[_0x2d47('0x2c')]['filter']+'%'};return _0x176df4;}})});}_0x3744f5=_['merge']({},_0x3744f5,_0x3e670b[_0x2d47('0x3a')]);var _0x30ac6e={'where':_0x3744f5[_0x2d47('0x36')]};return db[_0x2d47('0x27')][_0x2d47('0x1b')](_0x30ac6e)[_0x2d47('0x1f')](function(_0x12bbe2){_0x11d5b7['count']=_0x12bbe2;if(_0x3e670b['query'][_0x2d47('0x3b')]){_0x3744f5[_0x2d47('0x3c')]=[{'all':!![]}];}return db[_0x2d47('0x27')][_0x2d47('0x3d')](_0x3744f5);})[_0x2d47('0x1f')](function(_0x277055){_0x11d5b7[_0x2d47('0x3e')]=_0x277055;return _0x11d5b7;})[_0x2d47('0x1f')](respondWithFilteredResult(_0x348c3a,_0x3744f5))[_0x2d47('0x3f')](handleError(_0x348c3a,null));};exports[_0x2d47('0x40')]=function(_0x4a42ed,_0x3475df){var _0xee6017={'raw':!![],'where':{'id':_0x4a42ed[_0x2d47('0x41')]['id']}},_0x359f66={};_0x359f66['model']=_[_0x2d47('0x2d')](db[_0x2d47('0x27')][_0x2d47('0x28')]);_0x359f66[_0x2d47('0x2c')]=_[_0x2d47('0x2d')](_0x4a42ed[_0x2d47('0x2c')]);_0x359f66['filters']=_[_0x2d47('0x30')](_0x359f66[_0x2d47('0x2a')],_0x359f66[_0x2d47('0x2c')]);_0xee6017[_0x2d47('0x2f')]=_[_0x2d47('0x30')](_0x359f66['model'],qs[_0x2d47('0x42')](_0x4a42ed[_0x2d47('0x2c')][_0x2d47('0x42')]));_0xee6017[_0x2d47('0x2f')]=_0xee6017[_0x2d47('0x2f')][_0x2d47('0x31')]?_0xee6017[_0x2d47('0x2f')]:_0x359f66[_0x2d47('0x2a')];if(_0x4a42ed['query'][_0x2d47('0x3b')]){_0xee6017[_0x2d47('0x3c')]=[{'all':!![]}];}_0xee6017=_['merge']({},_0xee6017,_0x4a42ed[_0x2d47('0x3a')]);return db[_0x2d47('0x27')][_0x2d47('0x43')](_0xee6017)[_0x2d47('0x1f')](handleEntityNotFound(_0x3475df,null))[_0x2d47('0x1f')](respondWithResult(_0x3475df,null))[_0x2d47('0x3f')](handleError(_0x3475df,null));};exports[_0x2d47('0x44')]=function(_0x153dde,_0x2e63d3){return db[_0x2d47('0x27')]['create'](_0x153dde[_0x2d47('0x45')],{})[_0x2d47('0x1f')](respondWithResult(_0x2e63d3,0xc9))[_0x2d47('0x3f')](handleError(_0x2e63d3,null));};exports[_0x2d47('0x46')]=function(_0x698a5c,_0x101185){if(_0x698a5c[_0x2d47('0x45')]['id']){delete _0x698a5c[_0x2d47('0x45')]['id'];}return db[_0x2d47('0x27')][_0x2d47('0x43')]({'where':{'id':_0x698a5c['params']['id']}})[_0x2d47('0x1f')](handleEntityNotFound(_0x101185,null))[_0x2d47('0x1f')](saveUpdates(_0x698a5c[_0x2d47('0x45')],null))[_0x2d47('0x1f')](respondWithResult(_0x101185,null))[_0x2d47('0x3f')](handleError(_0x101185,null));};exports[_0x2d47('0x20')]=function(_0x3eba32,_0x8e7f7e){return db[_0x2d47('0x27')][_0x2d47('0x43')]({'where':{'id':_0x3eba32['params']['id']}})['then'](handleEntityNotFound(_0x8e7f7e,null))[_0x2d47('0x1f')](removeEntity(_0x8e7f7e,null))[_0x2d47('0x3f')](handleError(_0x8e7f7e,null));};exports[_0x2d47('0x47')]=function(_0x4a043c,_0x52fcae){return db[_0x2d47('0x27')][_0x2d47('0x47')]()[_0x2d47('0x1f')](respondWithResult(_0x52fcae,null))[_0x2d47('0x3f')](handleError(_0x52fcae,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 535603b..f5dae71 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 _0xbaf8=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x3243f5,_0x163290){var _0x2187fb=function(_0x3022e6){while(--_0x3022e6){_0x3243f5['push'](_0x3243f5['shift']());}};_0x2187fb(++_0x163290);}(_0xbaf8,0x1b1));var _0x8baf=function(_0x10c2d3,_0x2f5914){_0x10c2d3=_0x10c2d3-0x0;var _0x5a0b13=_0xbaf8[_0x10c2d3];return _0x5a0b13;};'use strict';var _=require('lodash');var util=require(_0x8baf('0x0'));var logger=require(_0x8baf('0x1'))(_0x8baf('0x2'));var moment=require(_0x8baf('0x3'));var BPromise=require(_0x8baf('0x4'));var rp=require(_0x8baf('0x5'));var fs=require('fs');var path=require(_0x8baf('0x6'));var rimraf=require('rimraf');var config=require(_0x8baf('0x7'));var attributes=require(_0x8baf('0x8'));module['exports']=function(_0x525202,_0x20da25){return _0x525202['define'](_0x8baf('0x9'),attributes,{'tableName':_0x8baf('0xa'),'paranoid':![],'indexes':[{'name':_0x8baf('0xb'),'fields':[_0x8baf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d83=['lodash','util','moment','request-promise','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x34a686,_0x402659){var _0x10c51c=function(_0x1998b1){while(--_0x1998b1){_0x34a686['push'](_0x34a686['shift']());}};_0x10c51c(++_0x402659);}(_0x6d83,0x18c));var _0x36d8=function(_0x325199,_0x333f43){_0x325199=_0x325199-0x0;var _0x408b81=_0x6d83[_0x325199];return _0x408b81;};'use strict';var _=require(_0x36d8('0x0'));var util=require(_0x36d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x36d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x36d8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36d8('0x4'));var config=require('../../config/environment');var attributes=require(_0x36d8('0x5'));module[_0x36d8('0x6')]=function(_0x45b037,_0x2b1c06){return _0x45b037[_0x36d8('0x7')](_0x36d8('0x8'),attributes,{'tableName':_0x36d8('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x36d8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d824723..6ab559f 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 _0x78d3=['../../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','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3829a1,_0x2cea90){var _0xc1bda8=function(_0x45cba6){while(--_0x45cba6){_0x3829a1['push'](_0x3829a1['shift']());}};_0xc1bda8(++_0x2cea90);}(_0x78d3,0x73));var _0x378d=function(_0x450049,_0x103e25){_0x450049=_0x450049-0x0;var _0x4744fa=_0x78d3[_0x450049];return _0x4744fa;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47a99f,_0x4fef30,_0x1c880e){return new BPromise(function(_0x4b3ef5,_0x14112d){return client[_0x378d('0xe')](_0x47a99f,_0x1c880e)[_0x378d('0xf')](function(_0x4698d9){logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');logger[_0x378d('0x12')](_0x378d('0x13'),_0x4fef30,_0x378d('0x14'),JSON['stringify'](_0x4698d9));if(_0x4698d9[_0x378d('0x15')]){if(_0x4698d9['error']['code']===0x1f4){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x14112d(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}logger['error'](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x4b3ef5(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}else{logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');_0x4b3ef5(_0x4698d9[_0x378d('0x17')]['message']);}})[_0x378d('0x18')](function(_0x1602f9){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x1602f9);_0x14112d(_0x1602f9);});});} \ No newline at end of file +var _0x0309=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x39a1ff,_0xb953e9){var _0x5ef27f=function(_0x51f5f8){while(--_0x51f5f8){_0x39a1ff['push'](_0x39a1ff['shift']());}};_0x5ef27f(++_0xb953e9);}(_0x0309,0x165));var _0x9030=function(_0x230397,_0x48aa3c){_0x230397=_0x230397-0x0;var _0x1ae9f9=_0x0309[_0x230397];return _0x1ae9f9;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var moment=require(_0x9030('0x1'));var BPromise=require('bluebird');var rs=require(_0x9030('0x2'));var fs=require('fs');var Redis=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];var utils=require(_0x9030('0x5'));var logger=require(_0x9030('0x6'))(_0x9030('0x7'));var config=require(_0x9030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x105c15,_0x4f2d84,_0xb53eb4){return new BPromise(function(_0x4e6c7b,_0x1e2360){return client[_0x9030('0xa')](_0x105c15,_0xb53eb4)[_0x9030('0xb')](function(_0x5711b4){logger[_0x9030('0xc')](_0x9030('0xd'),_0x4f2d84,_0x9030('0xe'));logger['debug'](_0x9030('0xf'),_0x4f2d84,_0x9030('0xe'),JSON[_0x9030('0x10')](_0x5711b4));if(_0x5711b4[_0x9030('0x11')]){if(_0x5711b4[_0x9030('0x11')][_0x9030('0x12')]===0x1f4){logger[_0x9030('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f2d84,_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);return _0x1e2360(_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);}logger['error'](_0x9030('0xd'),_0x4f2d84,_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);return _0x4e6c7b(_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);}else{logger[_0x9030('0xc')](_0x9030('0xd'),_0x4f2d84,_0x9030('0xe'));_0x4e6c7b(_0x5711b4[_0x9030('0x14')]['message']);}})[_0x9030('0x15')](function(_0x17e80d){logger[_0x9030('0x11')](_0x9030('0xd'),_0x4f2d84,_0x17e80d);_0x1e2360(_0x17e80d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0d4e5a8..0e3daab 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 _0x60b4=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','put','update','delete'];(function(_0x313b92,_0x2faef7){var _0x23e17a=function(_0x2ac590){while(--_0x2ac590){_0x313b92['push'](_0x313b92['shift']());}};_0x23e17a(++_0x2faef7);}(_0x60b4,0xb5));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x460b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x460b('0x1'));var express=require(_0x460b('0x2'));var router=express[_0x460b('0x3')]();var fs_extra=require(_0x460b('0x4'));var auth=require(_0x460b('0x5'));var interaction=require(_0x460b('0x6'));var config=require(_0x460b('0x7'));var controller=require(_0x460b('0x8'));router['get']('/',auth[_0x460b('0x9')](),controller[_0x460b('0xa')]);router[_0x460b('0xb')](_0x460b('0xc'),auth['isAuthenticated'](),controller[_0x460b('0xd')]);router['post']('/',auth[_0x460b('0x9')](),controller['create']);router[_0x460b('0xe')](_0x460b('0xc'),auth[_0x460b('0x9')](),controller[_0x460b('0xf')]);router[_0x460b('0x10')](_0x460b('0xc'),auth['isAuthenticated'](),controller[_0x460b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x78db=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x974954,_0x32d46d){var _0x35c77c=function(_0x1e8574){while(--_0x1e8574){_0x974954['push'](_0x974954['shift']());}};_0x35c77c(++_0x32d46d);}(_0x78db,0xcc));var _0xb78d=function(_0x52bcbd,_0x8dcc55){_0x52bcbd=_0x52bcbd-0x0;var _0x2c4072=_0x78db[_0x52bcbd];return _0x2c4072;};'use strict';var multer=require(_0xb78d('0x0'));var util=require(_0xb78d('0x1'));var path=require(_0xb78d('0x2'));var timeout=require(_0xb78d('0x3'));var express=require(_0xb78d('0x4'));var router=express[_0xb78d('0x5')]();var fs_extra=require(_0xb78d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb78d('0x7'));var config=require(_0xb78d('0x8'));var controller=require('./pause.controller');router[_0xb78d('0x9')]('/',auth['isAuthenticated'](),controller[_0xb78d('0xa')]);router[_0xb78d('0x9')](_0xb78d('0xb'),auth[_0xb78d('0xc')](),controller[_0xb78d('0xd')]);router[_0xb78d('0xe')]('/',auth[_0xb78d('0xc')](),controller['create']);router[_0xb78d('0xf')](_0xb78d('0xb'),auth[_0xb78d('0xc')](),controller[_0xb78d('0x10')]);router[_0xb78d('0x11')](_0xb78d('0xb'),auth[_0xb78d('0xc')](),controller[_0xb78d('0x12')]);module[_0xb78d('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9cb3911..56d0827 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 _0xf69c=['exports','name','STRING'];(function(_0x3c10d9,_0x219f97){var _0x244991=function(_0x479473){while(--_0x479473){_0x3c10d9['push'](_0x3c10d9['shift']());}};_0x244991(++_0x219f97);}(_0xf69c,0x126));var _0xcf69=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0xf69c[_0x2c2781];return _0x3fe469;};'use strict';var Sequelize=require('sequelize');module[_0xcf69('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf69('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xcf69('0x2')]}}; \ No newline at end of file +var _0xbac3=['STRING','name','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbac3,0x122));var _0x3bac=function(_0x1fe5f5,_0x171ac6){_0x1fe5f5=_0x1fe5f5-0x0;var _0x4b6d9d=_0xbac3[_0x1fe5f5];return _0x4b6d9d;};'use strict';var Sequelize=require(_0x3bac('0x0'));module[_0x3bac('0x1')]={'name':{'type':Sequelize[_0x3bac('0x2')],'unique':_0x3bac('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 8aa4116..daf91c6 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 _0xe308=['keys','filters','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','key','model'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xe308,0xcf));var _0x8e30=function(_0x4a7b6a,_0x5c1526){_0x4a7b6a=_0x4a7b6a-0x0;var _0x1e01f8=_0xe308[_0x4a7b6a];return _0x1e01f8;};'use strict';var emlformat=require(_0x8e30('0x0'));var rimraf=require(_0x8e30('0x1'));var zipdir=require(_0x8e30('0x2'));var jsonpatch=require(_0x8e30('0x3'));var rp=require(_0x8e30('0x4'));var moment=require(_0x8e30('0x5'));var BPromise=require(_0x8e30('0x6'));var Mustache=require(_0x8e30('0x7'));var util=require(_0x8e30('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8e30('0x9'));var ejs=require(_0x8e30('0xa'));var fs=require('fs');var fs_extra=require(_0x8e30('0xb'));var _=require(_0x8e30('0xc'));var squel=require(_0x8e30('0xd'));var crypto=require(_0x8e30('0xe'));var jsforce=require(_0x8e30('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8e30('0x9'));var querystring=require(_0x8e30('0x10'));var Papa=require(_0x8e30('0x11'));var Redis=require(_0x8e30('0x12'));var authService=require(_0x8e30('0x13'));var qs=require(_0x8e30('0x14'));var as=require(_0x8e30('0x15'));var hardwareService=require(_0x8e30('0x16'));var logger=require(_0x8e30('0x17'))(_0x8e30('0x18'));var utils=require(_0x8e30('0x19'));var config=require(_0x8e30('0x1a'));var licenseUtil=require(_0x8e30('0x1b'));var db=require(_0x8e30('0x1c'))['db'];function respondWithStatusCode(_0xf74e43,_0x58bd82){_0x58bd82=_0x58bd82||0xcc;return function(_0x975661){if(_0x975661){return _0xf74e43[_0x8e30('0x1d')](_0x58bd82);}return _0xf74e43[_0x8e30('0x1e')](_0x58bd82)[_0x8e30('0x1f')]();};}function respondWithResult(_0x4ed26d,_0x4afc5a){_0x4afc5a=_0x4afc5a||0xc8;return function(_0x2b0263){if(_0x2b0263){return _0x4ed26d[_0x8e30('0x1e')](_0x4afc5a)[_0x8e30('0x20')](_0x2b0263);}};}function respondWithFilteredResult(_0xfbad92,_0x52758f){return function(_0x583507){if(_0x583507){var _0x4819c4=typeof _0x52758f[_0x8e30('0x21')]===_0x8e30('0x22')&&typeof _0x52758f[_0x8e30('0x23')]===_0x8e30('0x22');var _0xc03601=_0x583507[_0x8e30('0x24')];var _0x50d36a=_0x4819c4?0x0:_0x52758f[_0x8e30('0x21')];var _0x107c2d=_0x4819c4?_0x583507[_0x8e30('0x24')]:_0x52758f[_0x8e30('0x21')]+_0x52758f['limit'];var _0x50cc7f;if(_0x107c2d>=_0xc03601){_0x107c2d=_0xc03601;_0x50cc7f=0xc8;}else{_0x50cc7f=0xce;}_0xfbad92[_0x8e30('0x1e')](_0x50cc7f);return _0xfbad92[_0x8e30('0x25')](_0x8e30('0x26'),_0x50d36a+'-'+_0x107c2d+'/'+_0xc03601)['json'](_0x583507);}return null;};}function patchUpdates(_0x541b86){return function(_0x120ee3){try{jsonpatch[_0x8e30('0x27')](_0x120ee3,_0x541b86,!![]);}catch(_0x244d05){return BPromise[_0x8e30('0x28')](_0x244d05);}return _0x120ee3[_0x8e30('0x29')]();};}function saveUpdates(_0x48af2a,_0x22eae0){return function(_0x2abdec){if(_0x2abdec){return _0x2abdec[_0x8e30('0x2a')](_0x48af2a)[_0x8e30('0x2b')](function(_0x596a14){return _0x596a14;});}return null;};}function removeEntity(_0x2f16ad,_0x45c4f2){return function(_0x42b25c){if(_0x42b25c){return _0x42b25c[_0x8e30('0x2c')]()[_0x8e30('0x2b')](function(){var _0xf56431=_0x42b25c[_0x8e30('0x2d')]({'plain':!![]});var _0xa2f145=_0x8e30('0x2e');return db[_0x8e30('0x2f')]['destroy']({'where':{'type':_0xa2f145,'resourceId':_0xf56431['id']}})[_0x8e30('0x2b')](function(){return _0x42b25c;});})['then'](function(){_0x2f16ad[_0x8e30('0x1e')](0xcc)[_0x8e30('0x1f')]();});}};}function handleEntityNotFound(_0x52b3c7,_0x3d7a72){return function(_0x238991){if(!_0x238991){_0x52b3c7[_0x8e30('0x1d')](0x194);}return _0x238991;};}function handleError(_0x2538a6,_0x5b3624){_0x5b3624=_0x5b3624||0x1f4;return function(_0x50eee7){logger[_0x8e30('0x30')](_0x50eee7[_0x8e30('0x31')]);if(_0x50eee7['name']){delete _0x50eee7[_0x8e30('0x32')];}_0x2538a6['status'](_0x5b3624)[_0x8e30('0x33')](_0x50eee7);};}exports['index']=function(_0x4bef83,_0x77822e){var _0x312af8={},_0x46a7fe={},_0x3ba590={'count':0x0,'rows':[]};var _0x13ef57=_[_0x8e30('0x34')](db[_0x8e30('0x35')][_0x8e30('0x36')],function(_0x30dd79){return{'name':_0x30dd79['fieldName'],'type':_0x30dd79['type'][_0x8e30('0x37')]};});_0x46a7fe[_0x8e30('0x38')]=_[_0x8e30('0x34')](_0x13ef57,_0x8e30('0x32'));_0x46a7fe['query']=_[_0x8e30('0x39')](_0x4bef83['query']);_0x46a7fe[_0x8e30('0x3a')]=_['intersection'](_0x46a7fe['model'],_0x46a7fe[_0x8e30('0x3b')]);_0x312af8['attributes']=_[_0x8e30('0x3c')](_0x46a7fe['model'],qs[_0x8e30('0x3d')](_0x4bef83[_0x8e30('0x3b')]['fields']));_0x312af8['attributes']=_0x312af8[_0x8e30('0x3e')]['length']?_0x312af8['attributes']:_0x46a7fe['model'];if(!_0x4bef83[_0x8e30('0x3b')][_0x8e30('0x3f')]('nolimit')){_0x312af8['limit']=qs[_0x8e30('0x23')](_0x4bef83[_0x8e30('0x3b')]['limit']);_0x312af8[_0x8e30('0x21')]=qs[_0x8e30('0x21')](_0x4bef83[_0x8e30('0x3b')][_0x8e30('0x21')]);}_0x312af8[_0x8e30('0x40')]=qs[_0x8e30('0x41')](_0x4bef83['query'][_0x8e30('0x41')]);_0x312af8[_0x8e30('0x42')]=qs[_0x8e30('0x3a')](_[_0x8e30('0x43')](_0x4bef83[_0x8e30('0x3b')],_0x46a7fe['filters']),_0x13ef57);if(_0x4bef83[_0x8e30('0x3b')][_0x8e30('0x44')]){_0x312af8[_0x8e30('0x42')]=_[_0x8e30('0x45')](_0x312af8[_0x8e30('0x42')],{'$or':_[_0x8e30('0x34')](_0x13ef57,function(_0x5249bf){if(_0x5249bf[_0x8e30('0x46')]!==_0x8e30('0x47')){var _0x53a624={};_0x53a624[_0x5249bf[_0x8e30('0x32')]]={'$like':'%'+_0x4bef83[_0x8e30('0x3b')][_0x8e30('0x44')]+'%'};return _0x53a624;}})});}_0x312af8=_[_0x8e30('0x45')]({},_0x312af8,_0x4bef83[_0x8e30('0x48')]);var _0x3431dd={'where':_0x312af8[_0x8e30('0x42')]};return db[_0x8e30('0x35')][_0x8e30('0x24')](_0x3431dd)[_0x8e30('0x2b')](function(_0x2f45f8){_0x3ba590['count']=_0x2f45f8;if(_0x4bef83[_0x8e30('0x3b')][_0x8e30('0x49')]){_0x312af8[_0x8e30('0x4a')]=[{'all':!![]}];}return db[_0x8e30('0x35')][_0x8e30('0x4b')](_0x312af8);})['then'](function(_0x22d6ba){_0x3ba590[_0x8e30('0x4c')]=_0x22d6ba;return _0x3ba590;})[_0x8e30('0x2b')](respondWithFilteredResult(_0x77822e,_0x312af8))[_0x8e30('0x4d')](handleError(_0x77822e,null));};exports[_0x8e30('0x4e')]=function(_0x28f1dc,_0x9d0794){var _0x55d7d5={'raw':!![],'where':{'id':_0x28f1dc[_0x8e30('0x4f')]['id']}},_0xd8dbfc={};_0xd8dbfc[_0x8e30('0x38')]=_['keys'](db[_0x8e30('0x35')]['rawAttributes']);_0xd8dbfc[_0x8e30('0x3b')]=_[_0x8e30('0x39')](_0x28f1dc['query']);_0xd8dbfc['filters']=_['intersection'](_0xd8dbfc[_0x8e30('0x38')],_0xd8dbfc[_0x8e30('0x3b')]);_0x55d7d5['attributes']=_[_0x8e30('0x3c')](_0xd8dbfc[_0x8e30('0x38')],qs[_0x8e30('0x3d')](_0x28f1dc[_0x8e30('0x3b')]['fields']));_0x55d7d5['attributes']=_0x55d7d5['attributes'][_0x8e30('0x50')]?_0x55d7d5[_0x8e30('0x3e')]:_0xd8dbfc[_0x8e30('0x38')];if(_0x28f1dc[_0x8e30('0x3b')][_0x8e30('0x49')]){_0x55d7d5[_0x8e30('0x4a')]=[{'all':!![]}];}_0x55d7d5=_[_0x8e30('0x45')]({},_0x55d7d5,_0x28f1dc[_0x8e30('0x48')]);return db[_0x8e30('0x35')][_0x8e30('0x51')](_0x55d7d5)[_0x8e30('0x2b')](handleEntityNotFound(_0x9d0794,null))[_0x8e30('0x2b')](respondWithResult(_0x9d0794,null))[_0x8e30('0x4d')](handleError(_0x9d0794,null));};exports[_0x8e30('0x52')]=function(_0x38e137,_0x1f8a49){return db['Pause'][_0x8e30('0x52')](_0x38e137[_0x8e30('0x53')],{})['then'](function(_0x2f63d8){var _0x1f9ea2=_0x38e137['user']['get']({'plain':!![]});if(!_0x1f9ea2)throw new Error(_0x8e30('0x54'));if(_0x1f9ea2[_0x8e30('0x55')]==='user'){var _0x203b32=_0x2f63d8['get']({'plain':!![]});var _0x17cf89='Pauses';return db[_0x8e30('0x56')][_0x8e30('0x51')]({'where':{'name':_0x17cf89,'userProfileId':_0x1f9ea2[_0x8e30('0x57')]},'raw':!![]})['then'](function(_0x5d1c93){if(_0x5d1c93&&_0x5d1c93['autoAssociation']===0x0){return db[_0x8e30('0x2f')][_0x8e30('0x52')]({'name':_0x203b32[_0x8e30('0x32')],'resourceId':_0x203b32['id'],'type':_0x5d1c93[_0x8e30('0x32')],'sectionId':_0x5d1c93['id']},{})[_0x8e30('0x2b')](function(){return _0x2f63d8;});}else{return _0x2f63d8;}})['catch'](function(_0x380f22){logger[_0x8e30('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x380f22);throw _0x380f22;});}return _0x2f63d8;})[_0x8e30('0x2b')](respondWithResult(_0x1f8a49,0xc9))[_0x8e30('0x4d')](handleError(_0x1f8a49,null));};exports[_0x8e30('0x2a')]=function(_0x3704b3,_0x5c56b0){if(_0x3704b3[_0x8e30('0x53')]['id']){delete _0x3704b3[_0x8e30('0x53')]['id'];}return db['Pause']['find']({'where':{'id':_0x3704b3['params']['id']}})[_0x8e30('0x2b')](handleEntityNotFound(_0x5c56b0,null))['then'](saveUpdates(_0x3704b3[_0x8e30('0x53')],null))['then'](respondWithResult(_0x5c56b0,null))['catch'](handleError(_0x5c56b0,null));};exports[_0x8e30('0x2c')]=function(_0x27899b,_0x5514f0){return db[_0x8e30('0x35')][_0x8e30('0x51')]({'where':{'id':_0x27899b['params']['id']}})['then'](handleEntityNotFound(_0x5514f0,null))['then'](removeEntity(_0x5514f0,null))[_0x8e30('0x4d')](handleError(_0x5514f0,null));}; \ No newline at end of file +var _0x1960=['catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','Pause','includeAll','findAll','rows'];(function(_0x35e975,_0x552679){var _0x5a7d7b=function(_0x475a1b){while(--_0x475a1b){_0x35e975['push'](_0x35e975['shift']());}};_0x5a7d7b(++_0x552679);}(_0x1960,0x1ac));var _0x0196=function(_0x8a8893,_0x1d0554){_0x8a8893=_0x8a8893-0x0;var _0x40790e=_0x1960[_0x8a8893];return _0x40790e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0196('0x0'));var zipdir=require(_0x0196('0x1'));var jsonpatch=require(_0x0196('0x2'));var rp=require(_0x0196('0x3'));var moment=require('moment');var BPromise=require(_0x0196('0x4'));var Mustache=require(_0x0196('0x5'));var util=require(_0x0196('0x6'));var path=require(_0x0196('0x7'));var sox=require('sox');var csv=require(_0x0196('0x8'));var ejs=require(_0x0196('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0196('0xa'));var squel=require(_0x0196('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0196('0x8'));var querystring=require(_0x0196('0xc'));var Papa=require(_0x0196('0xd'));var Redis=require('ioredis');var authService=require(_0x0196('0xe'));var qs=require(_0x0196('0xf'));var as=require(_0x0196('0x10'));var hardwareService=require(_0x0196('0x11'));var logger=require(_0x0196('0x12'))(_0x0196('0x13'));var utils=require(_0x0196('0x14'));var config=require(_0x0196('0x15'));var licenseUtil=require(_0x0196('0x16'));var db=require(_0x0196('0x17'))['db'];function respondWithStatusCode(_0x5c2877,_0x1cbbe3){_0x1cbbe3=_0x1cbbe3||0xcc;return function(_0x2c2a56){if(_0x2c2a56){return _0x5c2877[_0x0196('0x18')](_0x1cbbe3);}return _0x5c2877[_0x0196('0x19')](_0x1cbbe3)[_0x0196('0x1a')]();};}function respondWithResult(_0x1b8f1b,_0xe4b78f){_0xe4b78f=_0xe4b78f||0xc8;return function(_0x2db071){if(_0x2db071){return _0x1b8f1b[_0x0196('0x19')](_0xe4b78f)[_0x0196('0x1b')](_0x2db071);}};}function respondWithFilteredResult(_0x49c37e,_0x59c1cc){return function(_0x15945a){if(_0x15945a){var _0xff5c9f=typeof _0x59c1cc['offset']==='undefined'&&typeof _0x59c1cc[_0x0196('0x1c')]===_0x0196('0x1d');var _0x1566eb=_0x15945a[_0x0196('0x1e')];var _0x7ba70=_0xff5c9f?0x0:_0x59c1cc['offset'];var _0x4ddd7c=_0xff5c9f?_0x15945a['count']:_0x59c1cc['offset']+_0x59c1cc[_0x0196('0x1c')];var _0xe9d326;if(_0x4ddd7c>=_0x1566eb){_0x4ddd7c=_0x1566eb;_0xe9d326=0xc8;}else{_0xe9d326=0xce;}_0x49c37e[_0x0196('0x19')](_0xe9d326);return _0x49c37e[_0x0196('0x1f')]('Content-Range',_0x7ba70+'-'+_0x4ddd7c+'/'+_0x1566eb)[_0x0196('0x1b')](_0x15945a);}return null;};}function patchUpdates(_0x21cfc2){return function(_0x40924f){try{jsonpatch['apply'](_0x40924f,_0x21cfc2,!![]);}catch(_0x2ca989){return BPromise[_0x0196('0x20')](_0x2ca989);}return _0x40924f[_0x0196('0x21')]();};}function saveUpdates(_0x72158b,_0x30e1a3){return function(_0x534688){if(_0x534688){return _0x534688[_0x0196('0x22')](_0x72158b)[_0x0196('0x23')](function(_0x521d4d){return _0x521d4d;});}return null;};}function removeEntity(_0x22d4b0,_0x79e0a0){return function(_0x3ae949){if(_0x3ae949){return _0x3ae949[_0x0196('0x24')]()['then'](function(){var _0x3335e7=_0x3ae949[_0x0196('0x25')]({'plain':!![]});var _0x1985a4=_0x0196('0x26');return db[_0x0196('0x27')]['destroy']({'where':{'type':_0x1985a4,'resourceId':_0x3335e7['id']}})['then'](function(){return _0x3ae949;});})[_0x0196('0x23')](function(){_0x22d4b0[_0x0196('0x19')](0xcc)[_0x0196('0x1a')]();});}};}function handleEntityNotFound(_0x516678,_0x138e23){return function(_0xf3fcc8){if(!_0xf3fcc8){_0x516678['sendStatus'](0x194);}return _0xf3fcc8;};}function handleError(_0x280d50,_0x142b45){_0x142b45=_0x142b45||0x1f4;return function(_0x1fdd64){logger[_0x0196('0x28')](_0x1fdd64[_0x0196('0x29')]);if(_0x1fdd64[_0x0196('0x2a')]){delete _0x1fdd64[_0x0196('0x2a')];}_0x280d50['status'](_0x142b45)[_0x0196('0x2b')](_0x1fdd64);};}exports[_0x0196('0x2c')]=function(_0x2dae68,_0x59fc2a){var _0x454b1d={},_0x2a4a17={},_0x5a53b0={'count':0x0,'rows':[]};var _0x31dbee=_[_0x0196('0x2d')](db['Pause'][_0x0196('0x2e')],function(_0x235e7f){return{'name':_0x235e7f[_0x0196('0x2f')],'type':_0x235e7f[_0x0196('0x30')][_0x0196('0x31')]};});_0x2a4a17[_0x0196('0x32')]=_[_0x0196('0x2d')](_0x31dbee,_0x0196('0x2a'));_0x2a4a17[_0x0196('0x33')]=_[_0x0196('0x34')](_0x2dae68[_0x0196('0x33')]);_0x2a4a17[_0x0196('0x35')]=_['intersection'](_0x2a4a17[_0x0196('0x32')],_0x2a4a17['query']);_0x454b1d[_0x0196('0x36')]=_[_0x0196('0x37')](_0x2a4a17[_0x0196('0x32')],qs[_0x0196('0x38')](_0x2dae68[_0x0196('0x33')][_0x0196('0x38')]));_0x454b1d[_0x0196('0x36')]=_0x454b1d[_0x0196('0x36')][_0x0196('0x39')]?_0x454b1d[_0x0196('0x36')]:_0x2a4a17['model'];if(!_0x2dae68[_0x0196('0x33')][_0x0196('0x3a')]('nolimit')){_0x454b1d[_0x0196('0x1c')]=qs[_0x0196('0x1c')](_0x2dae68[_0x0196('0x33')][_0x0196('0x1c')]);_0x454b1d['offset']=qs['offset'](_0x2dae68[_0x0196('0x33')]['offset']);}_0x454b1d['order']=qs[_0x0196('0x3b')](_0x2dae68[_0x0196('0x33')][_0x0196('0x3b')]);_0x454b1d['where']=qs['filters'](_[_0x0196('0x3c')](_0x2dae68[_0x0196('0x33')],_0x2a4a17['filters']),_0x31dbee);if(_0x2dae68['query'][_0x0196('0x3d')]){_0x454b1d[_0x0196('0x3e')]=_['merge'](_0x454b1d[_0x0196('0x3e')],{'$or':_[_0x0196('0x2d')](_0x31dbee,function(_0x4c73dd){if(_0x4c73dd['type']!==_0x0196('0x3f')){var _0x1cfc3c={};_0x1cfc3c[_0x4c73dd[_0x0196('0x2a')]]={'$like':'%'+_0x2dae68[_0x0196('0x33')]['filter']+'%'};return _0x1cfc3c;}})});}_0x454b1d=_[_0x0196('0x40')]({},_0x454b1d,_0x2dae68[_0x0196('0x41')]);var _0x25b4bb={'where':_0x454b1d['where']};return db[_0x0196('0x42')][_0x0196('0x1e')](_0x25b4bb)[_0x0196('0x23')](function(_0x2b500d){_0x5a53b0[_0x0196('0x1e')]=_0x2b500d;if(_0x2dae68[_0x0196('0x33')][_0x0196('0x43')]){_0x454b1d['include']=[{'all':!![]}];}return db['Pause'][_0x0196('0x44')](_0x454b1d);})['then'](function(_0x231d90){_0x5a53b0[_0x0196('0x45')]=_0x231d90;return _0x5a53b0;})[_0x0196('0x23')](respondWithFilteredResult(_0x59fc2a,_0x454b1d))[_0x0196('0x46')](handleError(_0x59fc2a,null));};exports[_0x0196('0x47')]=function(_0x12d51f,_0x50113a){var _0x42b9d1={'raw':!![],'where':{'id':_0x12d51f[_0x0196('0x48')]['id']}},_0x466808={};_0x466808[_0x0196('0x32')]=_[_0x0196('0x34')](db[_0x0196('0x42')][_0x0196('0x2e')]);_0x466808[_0x0196('0x33')]=_['keys'](_0x12d51f['query']);_0x466808['filters']=_['intersection'](_0x466808[_0x0196('0x32')],_0x466808[_0x0196('0x33')]);_0x42b9d1[_0x0196('0x36')]=_['intersection'](_0x466808[_0x0196('0x32')],qs['fields'](_0x12d51f[_0x0196('0x33')]['fields']));_0x42b9d1[_0x0196('0x36')]=_0x42b9d1['attributes'][_0x0196('0x39')]?_0x42b9d1[_0x0196('0x36')]:_0x466808['model'];if(_0x12d51f[_0x0196('0x33')]['includeAll']){_0x42b9d1[_0x0196('0x49')]=[{'all':!![]}];}_0x42b9d1=_[_0x0196('0x40')]({},_0x42b9d1,_0x12d51f[_0x0196('0x41')]);return db[_0x0196('0x42')][_0x0196('0x4a')](_0x42b9d1)[_0x0196('0x23')](handleEntityNotFound(_0x50113a,null))['then'](respondWithResult(_0x50113a,null))[_0x0196('0x46')](handleError(_0x50113a,null));};exports[_0x0196('0x4b')]=function(_0x3f8f17,_0x3d3e68){return db['Pause'][_0x0196('0x4b')](_0x3f8f17['body'],{})[_0x0196('0x23')](function(_0x137013){var _0x4031ef=_0x3f8f17[_0x0196('0x4c')]['get']({'plain':!![]});if(!_0x4031ef)throw new Error(_0x0196('0x4d'));if(_0x4031ef[_0x0196('0x4e')]===_0x0196('0x4c')){var _0x4d3ac6=_0x137013[_0x0196('0x25')]({'plain':!![]});var _0x139753=_0x0196('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x139753,'userProfileId':_0x4031ef[_0x0196('0x4f')]},'raw':!![]})[_0x0196('0x23')](function(_0x2ff21e){if(_0x2ff21e&&_0x2ff21e[_0x0196('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4d3ac6[_0x0196('0x2a')],'resourceId':_0x4d3ac6['id'],'type':_0x2ff21e[_0x0196('0x2a')],'sectionId':_0x2ff21e['id']},{})['then'](function(){return _0x137013;});}else{return _0x137013;}})['catch'](function(_0x2eeadd){logger[_0x0196('0x28')](_0x0196('0x51'),_0x2eeadd);throw _0x2eeadd;});}return _0x137013;})[_0x0196('0x23')](respondWithResult(_0x3d3e68,0xc9))[_0x0196('0x46')](handleError(_0x3d3e68,null));};exports[_0x0196('0x22')]=function(_0x367487,_0x4568c1){if(_0x367487[_0x0196('0x52')]['id']){delete _0x367487[_0x0196('0x52')]['id'];}return db[_0x0196('0x42')][_0x0196('0x4a')]({'where':{'id':_0x367487[_0x0196('0x48')]['id']}})[_0x0196('0x23')](handleEntityNotFound(_0x4568c1,null))[_0x0196('0x23')](saveUpdates(_0x367487[_0x0196('0x52')],null))[_0x0196('0x23')](respondWithResult(_0x4568c1,null))[_0x0196('0x46')](handleError(_0x4568c1,null));};exports['destroy']=function(_0x9df453,_0x22abde){return db['Pause']['find']({'where':{'id':_0x9df453[_0x0196('0x48')]['id']}})[_0x0196('0x23')](handleEntityNotFound(_0x22abde,null))[_0x0196('0x23')](removeEntity(_0x22abde,null))['catch'](handleError(_0x22abde,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3dd4194..7ac9bd4 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x5a7d91,_0x429bfc){var _0x2e94bd=function(_0x496b11){while(--_0x496b11){_0x5a7d91['push'](_0x5a7d91['shift']());}};_0x2e94bd(++_0x429bfc);}(_0x814b,0x1a2));var _0xb814=function(_0x38616d,_0x22fbe5){_0x38616d=_0x38616d-0x0;var _0x505626=_0x814b[_0x38616d];return _0x505626;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 2c6b0c0..51badec 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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3b76a2,_0x2d37b3){var _0x327e21=function(_0x5d57d1){while(--_0x5d57d1){_0x3b76a2['push'](_0x3b76a2['shift']());}};_0x327e21(++_0x2d37b3);}(_0x7a54,0x106));var _0x47a5=function(_0x4c7b21,_0x268e66){_0x4c7b21=_0x4c7b21-0x0;var _0x3ceb95=_0x7a54[_0x4c7b21];return _0x3ceb95;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x409ac7,_0x52978c){var _0xe4d96a=function(_0x265fbc){while(--_0x265fbc){_0x409ac7['push'](_0x409ac7['shift']());}};_0xe4d96a(++_0x52978c);}(_0x7a54,0x106));var _0x47a5=function(_0x5b55ca,_0x590bfa){_0x5b55ca=_0x5b55ca-0x0;var _0x1e42f7=_0x7a54[_0x5b55ca];return _0x1e42f7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index dc186fc..aac426a 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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x386569,_0x531de2){var _0x3c9872=function(_0x4cdf3c){while(--_0x4cdf3c){_0x386569['push'](_0x386569['shift']());}};_0x3c9872(++_0x531de2);}(_0xe14d,0x1ee));var _0xde14=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xe14d[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file +var _0x5c12=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/:id','show','download','diskStorage','join','root','originalname','basename','extname','now','upload','post','put','update','delete','exports'];(function(_0xb26201,_0x31c0a4){var _0x15d202=function(_0x16a448){while(--_0x16a448){_0xb26201['push'](_0xb26201['shift']());}};_0x15d202(++_0x31c0a4);}(_0x5c12,0x188));var _0x25c1=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5c12[_0x3070dc];return _0x431489;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/webhook',controller['webhookGet']);router[_0x25c1('0xb')](_0x25c1('0xc'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xb')]('/:id/download',auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);var upload=multer({'storage':multer[_0x25c1('0xf')]({'destination':function(_0x81f0f4,_0x2872b2,_0x5e44e2){_0x5e44e2(null,path[_0x25c1('0x10')](config[_0x25c1('0x11')],'server/files/plugins'));},'filename':function(_0x256ecd,_0x209af5,_0x323d3c){_0x209af5[_0x25c1('0x12')]=_0x209af5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d3c(null,util['format']('%s-%s%s',path[_0x25c1('0x13')](_0x209af5[_0x25c1('0x12')],path[_0x25c1('0x14')](_0x209af5[_0x25c1('0x12')])),Date[_0x25c1('0x15')](),path['extname'](_0x209af5[_0x25c1('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0x25c1('0x16')]);router[_0x25c1('0x17')]('/webhook',controller['webhookPost']);router[_0x25c1('0x18')]('/:id',auth[_0x25c1('0x9')](),controller[_0x25c1('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x25c1('0x1a')]);module[_0x25c1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 06c5f84..4698498 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 _0x7aad=['ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x7d1853,_0x4df35a){var _0x3b4409=function(_0x45efc3){while(--_0x45efc3){_0x7d1853['push'](_0x7d1853['shift']());}};_0x3b4409(++_0x4df35a);}(_0x7aad,0x1cb));var _0xd7aa=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7aad[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0xd7aa('0x0'));module[_0xd7aa('0x1')]={'name':{'type':Sequelize[_0xd7aa('0x2')]},'type':{'type':Sequelize[_0xd7aa('0x3')]('html','script')},'description':{'type':Sequelize[_0xd7aa('0x4')]},'version':{'type':Sequelize[_0xd7aa('0x4')]},'path':{'type':Sequelize[_0xd7aa('0x2')],'comment':_0xd7aa('0x5')},'active':{'type':Sequelize[_0xd7aa('0x6')],'defaultValue':0x0,'comment':_0xd7aa('0x7')},'sidebar':{'type':Sequelize[_0xd7aa('0x3')](_0xd7aa('0x8'),'agentOnly',_0xd7aa('0x9'),'never'),'defaultValue':'always','comment':_0xd7aa('0xa')},'icon':{'type':Sequelize[_0xd7aa('0x2')]},'adminUrl':{'type':Sequelize[_0xd7aa('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xd7aa('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x651f=['ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','sequelize','exports','STRING'];(function(_0x14691c,_0xe1c878){var _0xbec98=function(_0x100b9e){while(--_0x100b9e){_0x14691c['push'](_0x14691c['shift']());}};_0xbec98(++_0xe1c878);}(_0x651f,0x159));var _0xf651=function(_0x57b04d,_0x1fcb43){_0x57b04d=_0x57b04d-0x0;var _0x4452a7=_0x651f[_0x57b04d];return _0x4452a7;};'use strict';var Sequelize=require(_0xf651('0x0'));module[_0xf651('0x1')]={'name':{'type':Sequelize[_0xf651('0x2')]},'type':{'type':Sequelize[_0xf651('0x3')](_0xf651('0x4'),_0xf651('0x5'))},'description':{'type':Sequelize[_0xf651('0x6')]},'version':{'type':Sequelize[_0xf651('0x6')]},'path':{'type':Sequelize[_0xf651('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf651('0x7')],'defaultValue':0x0,'comment':_0xf651('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xf651('0x9'),_0xf651('0xa'),_0xf651('0xb')),'defaultValue':_0xf651('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xf651('0x2')]},'adminUrl':{'type':Sequelize[_0xf651('0x2')]},'agentUrl':{'type':Sequelize[_0xf651('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf651('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 00c3f5b..a158a38 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 _0x77d7=['desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','Plugin','includeAll','findAll','catch','show','params','length','include','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','dirname','node_modules/**/*','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','%s%s','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x77d7,0x9e));var _0x777d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x77d7[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x777d('0x0'));var jsonpatch=require(_0x777d('0x1'));var rp=require(_0x777d('0x2'));var moment=require(_0x777d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x777d('0x4'));var util=require(_0x777d('0x5'));var path=require(_0x777d('0x6'));var sox=require('sox');var csv=require(_0x777d('0x7'));var ejs=require(_0x777d('0x8'));var fs=require('fs');var fs_extra=require(_0x777d('0x9'));var _=require(_0x777d('0xa'));var squel=require(_0x777d('0xb'));var crypto=require(_0x777d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x777d('0xd'));var toCsv=require(_0x777d('0x7'));var querystring=require(_0x777d('0xe'));var Papa=require(_0x777d('0xf'));var extract=require(_0x777d('0x10'));var rimraf=require(_0x777d('0x11'));var archiver=require(_0x777d('0x12'));var Redis=require(_0x777d('0x13'));var authService=require(_0x777d('0x14'));var qs=require(_0x777d('0x15'));var as=require(_0x777d('0x16'));var hardwareService=require(_0x777d('0x17'));var logger=require(_0x777d('0x18'))(_0x777d('0x19'));var utils=require('../../config/utils');var config=require(_0x777d('0x1a'));var licenseUtil=require(_0x777d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x777d('0x1c')]=_[_0x777d('0x1d')](config[_0x777d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x777d('0x1c')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x1972cc,_0x82442d){_0x82442d=_0x82442d||0xcc;return function(_0xdcfe0f){if(_0xdcfe0f){return _0x1972cc[_0x777d('0x1e')](_0x82442d);}return _0x1972cc[_0x777d('0x1f')](_0x82442d)[_0x777d('0x20')]();};}function respondWithResult(_0x5523c4,_0x246fb6){_0x246fb6=_0x246fb6||0xc8;return function(_0x45327d){if(_0x45327d){return _0x5523c4['status'](_0x246fb6)[_0x777d('0x21')](_0x45327d);}};}function respondWithFilteredResult(_0xe6528e,_0x21a123){return function(_0x565170){if(_0x565170){var _0x55ba30=typeof _0x21a123['offset']==='undefined'&&typeof _0x21a123[_0x777d('0x22')]===_0x777d('0x23');var _0x7c6fc1=_0x565170[_0x777d('0x24')];var _0x21b4c2=_0x55ba30?0x0:_0x21a123[_0x777d('0x25')];var _0x4097d1=_0x55ba30?_0x565170['count']:_0x21a123[_0x777d('0x25')]+_0x21a123[_0x777d('0x22')];var _0x4f3241;if(_0x4097d1>=_0x7c6fc1){_0x4097d1=_0x7c6fc1;_0x4f3241=0xc8;}else{_0x4f3241=0xce;}_0xe6528e['status'](_0x4f3241);return _0xe6528e[_0x777d('0x26')](_0x777d('0x27'),_0x21b4c2+'-'+_0x4097d1+'/'+_0x7c6fc1)[_0x777d('0x21')](_0x565170);}return null;};}function patchUpdates(_0x22baef){return function(_0x5220ca){try{jsonpatch[_0x777d('0x28')](_0x5220ca,_0x22baef,!![]);}catch(_0x3c275b){return BPromise[_0x777d('0x29')](_0x3c275b);}return _0x5220ca[_0x777d('0x2a')]();};}function saveUpdates(_0x12b1f7,_0xd77db4){return function(_0x130097){if(_0x130097){return _0x130097[_0x777d('0x2b')](_0x12b1f7)[_0x777d('0x2c')](function(_0x39e76f){return _0x39e76f;});}return null;};}function removeEntity(_0x5f1994,_0x474381){return function(_0x58ae27){if(_0x58ae27){return _0x58ae27[_0x777d('0x2d')]()['then'](function(){var _0x4743ac=_0x58ae27['get']({'plain':!![]});var _0x4181d9='Plugins';return db[_0x777d('0x2e')]['destroy']({'where':{'type':_0x4181d9,'resourceId':_0x4743ac['id']}})[_0x777d('0x2c')](function(){return _0x58ae27;});})['then'](function(){_0x5f1994[_0x777d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427001,_0x4f968e){return function(_0x3b7e57){if(!_0x3b7e57){_0x427001[_0x777d('0x1e')](0x194);}return _0x3b7e57;};}function handleError(_0x336ead,_0x5daf77){_0x5daf77=_0x5daf77||0x1f4;return function(_0x5b52a4){logger['error'](_0x5b52a4[_0x777d('0x2f')]);if(_0x5b52a4[_0x777d('0x30')]){delete _0x5b52a4['name'];}_0x336ead[_0x777d('0x1f')](_0x5daf77)[_0x777d('0x31')](_0x5b52a4);};}exports[_0x777d('0x32')]=function(_0x7b9107,_0x33f067){var _0x226f4a={},_0x5a4a1d={},_0x3c16eb={'count':0x0,'rows':[]};var _0x386d73=_[_0x777d('0x33')](db['Plugin'][_0x777d('0x34')],function(_0x3c1d81){return{'name':_0x3c1d81[_0x777d('0x35')],'type':_0x3c1d81[_0x777d('0x36')][_0x777d('0x37')]};});_0x5a4a1d[_0x777d('0x38')]=_[_0x777d('0x33')](_0x386d73,_0x777d('0x30'));_0x5a4a1d[_0x777d('0x39')]=_[_0x777d('0x3a')](_0x7b9107[_0x777d('0x39')]);_0x5a4a1d[_0x777d('0x3b')]=_[_0x777d('0x3c')](_0x5a4a1d[_0x777d('0x38')],_0x5a4a1d[_0x777d('0x39')]);_0x226f4a[_0x777d('0x3d')]=_['intersection'](_0x5a4a1d[_0x777d('0x38')],qs[_0x777d('0x3e')](_0x7b9107[_0x777d('0x39')][_0x777d('0x3e')]));_0x226f4a['attributes']=_0x226f4a[_0x777d('0x3d')]['length']?_0x226f4a['attributes']:_0x5a4a1d[_0x777d('0x38')];if(!_0x7b9107[_0x777d('0x39')][_0x777d('0x3f')]('nolimit')){_0x226f4a[_0x777d('0x22')]=qs[_0x777d('0x22')](_0x7b9107['query'][_0x777d('0x22')]);_0x226f4a[_0x777d('0x25')]=qs[_0x777d('0x25')](_0x7b9107[_0x777d('0x39')]['offset']);}_0x226f4a[_0x777d('0x40')]=qs[_0x777d('0x41')](_0x7b9107['query'][_0x777d('0x41')]);_0x226f4a[_0x777d('0x42')]=qs['filters'](_[_0x777d('0x43')](_0x7b9107[_0x777d('0x39')],_0x5a4a1d[_0x777d('0x3b')]),_0x386d73);if(_0x7b9107[_0x777d('0x39')][_0x777d('0x44')]){_0x226f4a[_0x777d('0x42')]=_['merge'](_0x226f4a[_0x777d('0x42')],{'$or':_[_0x777d('0x33')](_0x386d73,function(_0x4795a5){if(_0x4795a5[_0x777d('0x36')]!==_0x777d('0x45')){var _0x2b7585={};_0x2b7585[_0x4795a5[_0x777d('0x30')]]={'$like':'%'+_0x7b9107[_0x777d('0x39')]['filter']+'%'};return _0x2b7585;}})});}_0x226f4a=_[_0x777d('0x46')]({},_0x226f4a,_0x7b9107['options']);var _0x1e9ac8={'where':_0x226f4a[_0x777d('0x42')]};return db[_0x777d('0x47')]['count'](_0x1e9ac8)[_0x777d('0x2c')](function(_0x3016a4){_0x3c16eb[_0x777d('0x24')]=_0x3016a4;if(_0x7b9107[_0x777d('0x39')][_0x777d('0x48')]){_0x226f4a['include']=[{'all':!![]}];}return db[_0x777d('0x47')][_0x777d('0x49')](_0x226f4a);})['then'](function(_0x50b510){_0x3c16eb['rows']=_0x50b510;return _0x3c16eb;})['then'](respondWithFilteredResult(_0x33f067,_0x226f4a))[_0x777d('0x4a')](handleError(_0x33f067,null));};exports[_0x777d('0x4b')]=function(_0x58b1a5,_0x40dac5){var _0x1c8404={'raw':!![],'where':{'id':_0x58b1a5[_0x777d('0x4c')]['id']}},_0xa3f34c={};_0xa3f34c[_0x777d('0x38')]=_['keys'](db[_0x777d('0x47')][_0x777d('0x34')]);_0xa3f34c[_0x777d('0x39')]=_['keys'](_0x58b1a5[_0x777d('0x39')]);_0xa3f34c[_0x777d('0x3b')]=_['intersection'](_0xa3f34c[_0x777d('0x38')],_0xa3f34c[_0x777d('0x39')]);_0x1c8404[_0x777d('0x3d')]=_[_0x777d('0x3c')](_0xa3f34c[_0x777d('0x38')],qs[_0x777d('0x3e')](_0x58b1a5[_0x777d('0x39')][_0x777d('0x3e')]));_0x1c8404[_0x777d('0x3d')]=_0x1c8404[_0x777d('0x3d')][_0x777d('0x4d')]?_0x1c8404[_0x777d('0x3d')]:_0xa3f34c[_0x777d('0x38')];if(_0x58b1a5[_0x777d('0x39')]['includeAll']){_0x1c8404[_0x777d('0x4e')]=[{'all':!![]}];}_0x1c8404=_[_0x777d('0x46')]({},_0x1c8404,_0x58b1a5['options']);return db[_0x777d('0x47')][_0x777d('0x4f')](_0x1c8404)[_0x777d('0x2c')](handleEntityNotFound(_0x40dac5,null))[_0x777d('0x2c')](respondWithResult(_0x40dac5,null))[_0x777d('0x4a')](handleError(_0x40dac5,null));};exports[_0x777d('0x50')]=function(_0x5f21d1,_0x2a04c7,_0x386950){return db['Plugin']['find']({'where':{'id':_0x5f21d1[_0x777d('0x4c')]['id']},'attributes':[_0x777d('0x30'),_0x777d('0x6')],'raw':!![]})[_0x777d('0x2c')](handleEntityNotFound(_0x2a04c7,null))[_0x777d('0x2c')](function(_0x18c36e){if(_0x18c36e){var _0x2ccf31=path[_0x777d('0x51')](config['root'],_0x777d('0x52'),util[_0x777d('0x53')](_0x777d('0x54'),path[_0x777d('0x55')](_0x18c36e[_0x777d('0x6')])));var _0xbeaa8a=fs[_0x777d('0x56')](_0x2ccf31);var _0x475ef5=archiver(_0x777d('0x57'),{'zlib':{'level':0x9}});_0x475ef5['on'](_0x777d('0x58'),function(_0x321e46){if(_0x321e46[_0x777d('0x59')]==='ENOENT'){logger[_0x777d('0x5a')](_0x321e46);}else{throw new db[(_0x777d('0x5b'))][(_0x777d('0x5c'))](_0x777d('0x5d'));}});_0x475ef5['on']('error',function(_0x2a9a62){throw new db[(_0x777d('0x5b'))]['Error'](_0x777d('0x5d'));});_0x475ef5[_0x777d('0x5e')](_0xbeaa8a);_0x475ef5['glob'](_0x777d('0x5f'),{'cwd':path['join'](config[_0x777d('0x60')],_0x777d('0x52'),path[_0x777d('0x61')](_0x18c36e['path'])),'ignore':[path[_0x777d('0x51')](path[_0x777d('0x55')](_0x18c36e[_0x777d('0x6')]),_0x777d('0x62')),path[_0x777d('0x51')](path['basename'](_0x18c36e[_0x777d('0x6')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0xbeaa8a['on'](_0x777d('0x63'),function(){if(!fs['existsSync'](_0x2ccf31)){throw new db[(_0x777d('0x5b'))][(_0x777d('0x5c'))](_0x777d('0x64'));}return _0x2a04c7[_0x777d('0x50')](_0x2ccf31,util[_0x777d('0x53')]('%s.zip',path[_0x777d('0x55')](_0x18c36e[_0x777d('0x6')])),function(_0x54c8ff){if(_0x54c8ff){throw new db[(_0x777d('0x5b'))]['Error'](_0x777d('0x65'));}fs[_0x777d('0x66')](_0x2ccf31);logger[_0x777d('0x67')]('Download\x20completed');logger[_0x777d('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x777d('0x4a')](handleError(_0x2a04c7,null));};exports['upload']=function(_0x259e2e,_0x40cf1f,_0x124cfa){var _0x2375b2=path['basename'](_0x259e2e[_0x777d('0x68')][_0x777d('0x69')],path[_0x777d('0x6a')](_0x259e2e['file'][_0x777d('0x69')]));var _0x4f3b5b=path[_0x777d('0x51')](config[_0x777d('0x60')],_0x777d('0x52'),_0x259e2e[_0x777d('0x68')]['filename']);var _0xc5acce=path[_0x777d('0x51')](config['root'],'server/files/plugins',_0x2375b2);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x4f3b5b);logger[_0x777d('0x67')](_0x777d('0x6b'),_0xc5acce);try{fs[_0x777d('0x6c')](_0x4f3b5b,parseInt(_0x777d('0x6d'),0x8));extract(_0x4f3b5b,{'dir':_0xc5acce},function(_0x13ecb3){if(_0x13ecb3){logger['error'](_0x13ecb3);handleError(_0x13ecb3,!![]);};var _0x166dfb=fs[_0x777d('0x6e')](_0xc5acce);if(_0x166dfb[_0x777d('0x4d')]>0x1){removeReferences(_0x4f3b5b,_0xc5acce);logger[_0x777d('0x5a')](_0x777d('0x6f'));return _0x124cfa(new Error(_0x777d('0x6f')));}var _0x5e52a0=fs[_0x777d('0x70')](path[_0x777d('0x51')](_0xc5acce,_0x166dfb[0x0]));if(_0x5e52a0[_0x777d('0x71')]()){removeReferences(_0x4f3b5b,_0xc5acce);logger[_0x777d('0x5a')]('Invalid\x20plugin\x20structure');return _0x124cfa(new Error('Invalid\x20plugin\x20structure'));}if(_0x5e52a0[_0x777d('0x72')]()){var _0x31105d=fs[_0x777d('0x6e')](path[_0x777d('0x51')](_0xc5acce,_0x166dfb[0x0]));if(_0x31105d[_0x777d('0x4d')]===0x0){removeReferences(_0x4f3b5b,_0xc5acce);logger[_0x777d('0x5a')](_0x777d('0x6f'));return _0x124cfa(new Error('Invalid\x20plugin\x20structure'));}var _0x2c22de=_0x31105d[_0x777d('0x73')](function(_0x8b558){return _0x8b558===_0x777d('0x74');});if(!_0x2c22de){return _0x124cfa(new Error(_0x777d('0x75')));}var _0x28b518=fs['readFileSync'](path[_0x777d('0x51')](_0xc5acce,_0x166dfb[0x0],'manifest.json'));var _0x4c9331=JSON['parse'](_0x28b518);if(_0x777d('0x23')==typeof _0x4c9331[_0x777d('0x30')]){return _0x124cfa(new Error(_0x777d('0x76')));}if(_0x777d('0x23')==typeof _0x4c9331[_0x777d('0x36')]){return _0x124cfa(new Error(_0x777d('0x77')));}if('undefined'==typeof _0x4c9331[_0x777d('0x78')]){return _0x124cfa(new Error(_0x777d('0x79')));}if(_0x777d('0x23')==typeof _0x4c9331[_0x777d('0x7a')]){return _0x124cfa(new Error(_0x777d('0x7b')));}if(_0x4c9331['type']===_0x777d('0x7c')){if(_0x777d('0x23')==typeof _0x4c9331['parameters'][_0x777d('0x7d')]){return _0x124cfa(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x4c9331['parameters'][_0x777d('0x7d')][_0x777d('0x7e')]&&_0x777d('0x23')==typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7f')]){return _0x124cfa(new Error(_0x777d('0x80')));}}else if(_0x4c9331[_0x777d('0x36')]===_0x777d('0x81')){if('undefined'==typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x82')]){return _0x124cfa(new Error(_0x777d('0x83')));}if(_0x777d('0x23')==typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x84')]){return _0x124cfa(new Error(_0x777d('0x85')));}}else{return _0x124cfa(new Error(_0x777d('0x86')));}var _0x5d1c1b=_0x4c9331[_0x777d('0x30')];var _0x5201ae=_0x4c9331[_0x777d('0x87')];var _0x100d38=_0x4c9331[_0x777d('0x36')];var _0x8b64d5=_0x4c9331[_0x777d('0x88')]?_0x4c9331[_0x777d('0x88')]:_0x777d('0x89');var _0x1426c0=_0x4c9331[_0x777d('0x8a')]?_0x4c9331[_0x777d('0x8a')]:_0x777d('0x8b');var _0x2f37ce='';var _0x47736a='';var _0x7e709='';var _0x5a4aa1='';var _0x37f286=_0x4c9331[_0x777d('0x78')];if(_0x100d38===_0x777d('0x7c')){if(_0x777d('0x23')!=typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7e')]){var _0x433422=_0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8c')](_0x433422)){_0x2f37ce=path[_0x777d('0x51')](_0x777d('0x8d'),_0x2375b2,_0x166dfb[0x0],_0x433422);}else{_0x2f37ce=_0x433422;}}else{logger['info'](_0x777d('0x8e'));}if(_0x777d('0x23')!=typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7f')]){var _0x43e5a9=_0x4c9331[_0x777d('0x7a')]['views'][_0x777d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8c')](_0x43e5a9)){_0x47736a=path['join'](_0x777d('0x8d'),_0x2375b2,_0x166dfb[0x0],_0x43e5a9);}else{_0x47736a=_0x43e5a9;}}else{logger['info'](_0x777d('0x8f'));}}else if(_0x100d38===_0x777d('0x81')){_0x7e709=_0x4c9331[_0x777d('0x7a')][_0x777d('0x82')];_0x5a4aa1=_0x4c9331[_0x777d('0x7a')][_0x777d('0x84')];if('undefined'!=typeof _0x4c9331[_0x777d('0x7a')]['views']){if('undefined'!=typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7e')]){var _0x433422=_0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8c')](_0x433422)){_0x2f37ce=path[_0x777d('0x51')](_0x777d('0x8d'),_0x2375b2,_0x166dfb[0x0],_0x433422);}else{_0x2f37ce=_0x433422;}}if('undefined'!=typeof _0x4c9331[_0x777d('0x7a')][_0x777d('0x7d')][_0x777d('0x7f')]){var _0x43e5a9=_0x4c9331['parameters'][_0x777d('0x7d')][_0x777d('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x43e5a9)){_0x47736a=path[_0x777d('0x51')](_0x777d('0x8d'),_0x2375b2,_0x166dfb[0x0],_0x43e5a9);}else{_0x47736a=_0x43e5a9;}}}}var _0x14cdbc={'name':_0x5d1c1b,'description':_0x5201ae,'path':path[_0x777d('0x51')](_0x2375b2,_0x166dfb[0x0]),'type':_0x100d38,'sidebar':_0x8b64d5,'icon':_0x1426c0,'adminUrl':_0x2f37ce,'agentUrl':_0x47736a,'scriptName':_0x7e709,'scriptPath':_0x5a4aa1,'version':_0x37f286};removeReferences(_0x4f3b5b,null);return db[_0x777d('0x47')][_0x777d('0x90')](_0x14cdbc)[_0x777d('0x2c')](function(_0x4985d8){var _0x157820={'role':_0x259e2e[_0x777d('0x91')][_0x777d('0x92')],'userProfileId':_0x259e2e[_0x777d('0x91')][_0x777d('0x93')]};if(!_0x157820)throw new Error(_0x777d('0x94'));if(_0x157820[_0x777d('0x92')]==='user'){var _0x428443=_0x4985d8[_0x777d('0x95')]({'plain':!![]});return db['UserProfileSection'][_0x777d('0x4f')]({'where':{'name':_0x777d('0x96'),'userProfileId':_0x157820[_0x777d('0x93')]},'raw':!![]})[_0x777d('0x2c')](function(_0x21f4b2){if(_0x21f4b2&&_0x21f4b2[_0x777d('0x97')]===0x0){return db[_0x777d('0x2e')][_0x777d('0x90')]({'name':_0x428443['name'],'resourceId':_0x428443['id'],'type':_0x21f4b2[_0x777d('0x30')],'sectionId':_0x21f4b2['id']},{})[_0x777d('0x2c')](function(){return _0x4985d8;});}else{return _0x4985d8;}})[_0x777d('0x4a')](function(_0x3afd60){logger[_0x777d('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3afd60);throw _0x3afd60;});}return _0x4985d8;})[_0x777d('0x2c')](respondWithResult(_0x40cf1f,null))['catch'](handleError(_0x40cf1f,null));}});}catch(_0x337207){_0x40cf1f['status'](0x1f4)[_0x777d('0x31')](_0x337207);}};function removeReferences(_0x277e1c,_0x4a7798){try{if(_0x277e1c){fs[_0x777d('0x66')](_0x277e1c);logger['info'](_0x777d('0x98'));}if(_0x4a7798){rimraf(_0x4a7798,function(){});logger[_0x777d('0x67')](_0x777d('0x99'));}}catch(_0x275659){logger['error'](_0x275659);}}exports[_0x777d('0x2b')]=function(_0x330498,_0x50b30b,_0x4f6ec6){return db[_0x777d('0x47')][_0x777d('0x4f')]({'where':{'id':_0x330498['params']['id']}})[_0x777d('0x2c')](handleEntityNotFound(_0x50b30b,null))[_0x777d('0x2c')](saveUpdates(_0x330498[_0x777d('0x91')],null))[_0x777d('0x2c')](respondWithResult(_0x50b30b,null))[_0x777d('0x4a')](handleError(_0x50b30b,null));};exports[_0x777d('0x9a')]=function(_0x575450,_0x160a67,_0x145ee9){return db[_0x777d('0x47')]['find']({'where':{'id':_0x575450[_0x777d('0x4c')]['id']}})[_0x777d('0x2c')](function(_0x4ca181){if(_0x4ca181){return _0x4ca181[_0x777d('0x2d')]();}})[_0x777d('0x2c')](function(_0x1ac3c1){rimraf(path['join'](config['root'],'server/files/plugins',path['dirname'](_0x1ac3c1[_0x777d('0x6')])),function(){});return _0x1ac3c1;})[_0x777d('0x2c')](handleEntityNotFound(_0x160a67,null))['then'](respondWithStatusCode(_0x160a67,null))[_0x777d('0x4a')](handleError(_0x160a67,null));};exports[_0x777d('0x9b')]=function(_0x519fc3,_0x1b3223,_0x351765){return BPromise[_0x777d('0x9c')]()[_0x777d('0x2c')](function(){if(!_0x519fc3['query'][_0x777d('0x6')]){throw new Error(_0x777d('0x9d'));}if(!_0x519fc3[_0x777d('0x39')][_0x777d('0x9e')]){throw new Error(_0x777d('0x9f'));}var _0x2d16ed=_0x519fc3[_0x777d('0x39')][_0x777d('0xa0')]?_0x519fc3[_0x777d('0x39')][_0x777d('0xa0')]+':'+_0x519fc3[_0x777d('0x39')][_0x777d('0x9e')]:'http://localhost:'+_0x519fc3[_0x777d('0x39')][_0x777d('0x9e')];var _0x54b8b1=_0x519fc3[_0x777d('0x39')][_0x777d('0x21')]?_0x519fc3['query'][_0x777d('0x21')]:!![];var _0x372229=_0x519fc3[_0x777d('0x39')][_0x777d('0xa1')]?_0x519fc3['query'][_0x777d('0xa1')]:null;var _0x1e82c3={'method':_0x519fc3[_0x777d('0xa2')],'uri':util[_0x777d('0x53')]('%s%s',_0x2d16ed,_0x519fc3[_0x777d('0x39')]['path']),'json':_0x54b8b1,'resolveWithFullResponse':!![],'encoding':_0x372229,'qs':_0x519fc3['query']};if(_0x519fc3[_0x777d('0xa3')]){_0x1e82c3['headers']=_0x519fc3[_0x777d('0xa3')];if(_0x1e82c3[_0x777d('0xa3')][_0x777d('0xa4')]){delete _0x1e82c3['headers'][_0x777d('0xa4')];}}if(_0x1e82c3['headers'][_0x777d('0xa5')]){delete _0x1e82c3[_0x777d('0xa3')][_0x777d('0xa5')];}return rp(_0x1e82c3);})['then'](function(_0x722117){if(_0x722117){_0x1b3223[_0x777d('0x26')](_0x722117[_0x777d('0xa3')]);logger[_0x777d('0x67')](_0x722117[_0x777d('0x91')]);if(_[_0x777d('0xa6')](_0x519fc3[_0x777d('0x39')][_0x777d('0x6')],_0x777d('0x50'))&&_0x722117['statusCode']==0x1f4){return _0x1b3223[_0x777d('0x1e')](_0x722117[_0x777d('0xa7')]);}else{return _0x1b3223[_0x777d('0x1f')](_0x722117[_0x777d('0xa7')])[_0x777d('0x31')](_0x722117['body']);}}else{return _0x1b3223[_0x777d('0x1e')](0xc8);}})[_0x777d('0x4a')](handleError(_0x1b3223,null));};exports[_0x777d('0xa8')]=function(_0x48bfc9,_0x141314,_0xec41fb){return BPromise[_0x777d('0x9c')]()[_0x777d('0x2c')](function(){if(!_0x48bfc9[_0x777d('0x39')][_0x777d('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x48bfc9[_0x777d('0x39')][_0x777d('0x9e')]){throw new Error(_0x777d('0x9f'));}var _0x46af20=_0x48bfc9[_0x777d('0x39')][_0x777d('0xa0')]?_0x48bfc9[_0x777d('0x39')][_0x777d('0xa0')]+':'+_0x48bfc9[_0x777d('0x39')]['port']:_0x777d('0xa9')+_0x48bfc9[_0x777d('0x39')][_0x777d('0x9e')];var _0x58222d=_0x48bfc9[_0x777d('0x39')][_0x777d('0x21')]?_0x48bfc9[_0x777d('0x39')][_0x777d('0x21')]:!![];var _0x1fb351=_0x48bfc9['query'][_0x777d('0xa1')]?_0x48bfc9[_0x777d('0x39')][_0x777d('0xa1')]:null;var _0x54120c={'method':_0x48bfc9[_0x777d('0xa2')],'uri':util[_0x777d('0x53')](_0x777d('0xaa'),_0x46af20,_0x48bfc9[_0x777d('0x39')][_0x777d('0x6')]),'json':_0x58222d,'resolveWithFullResponse':!![],'encoding':_0x1fb351,'body':_0x48bfc9[_0x777d('0x91')]};if(_0x48bfc9[_0x777d('0xa3')]){_0x54120c[_0x777d('0xa3')]=_0x48bfc9['headers'];if(_0x54120c[_0x777d('0xa3')][_0x777d('0xa4')]){delete _0x54120c[_0x777d('0xa3')]['content-length'];}}if(_0x54120c[_0x777d('0xa3')]['content-type']){delete _0x54120c[_0x777d('0xa3')][_0x777d('0xa5')];}return rp(_0x54120c);})[_0x777d('0x2c')](function(_0x986518){if(_0x986518){_0x141314[_0x777d('0x26')](_0x986518['headers']);logger[_0x777d('0x67')](_0x986518[_0x777d('0x91')]);return _0x141314['status'](_0x986518['statusCode'])[_0x777d('0x31')](_0x986518['body']);}else{return _0x141314[_0x777d('0x1e')](0xc8);}})[_0x777d('0x4a')](handleError(_0x141314,null));}; \ No newline at end of file +var _0xa82c=['filters','pick','merge','VIRTUAL','filter','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','path','join','server/files/plugins','format','%s.zip','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','basename','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','scriptName','scriptPath','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','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','download','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa82c,0x1be));var _0xca82=function(_0x119485,_0x4c964d){_0x119485=_0x119485-0x0;var _0x4a1fab=_0xa82c[_0x119485];return _0x4a1fab;};'use strict';var emlformat=require(_0xca82('0x0'));var rimraf=require(_0xca82('0x1'));var zipdir=require(_0xca82('0x2'));var jsonpatch=require(_0xca82('0x3'));var rp=require(_0xca82('0x4'));var moment=require(_0xca82('0x5'));var BPromise=require(_0xca82('0x6'));var Mustache=require(_0xca82('0x7'));var util=require(_0xca82('0x8'));var path=require('path');var sox=require(_0xca82('0x9'));var csv=require('to-csv');var ejs=require(_0xca82('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xca82('0xb'));var toCsv=require('to-csv');var querystring=require(_0xca82('0xc'));var Papa=require(_0xca82('0xd'));var extract=require(_0xca82('0xe'));var rimraf=require(_0xca82('0x1'));var archiver=require('archiver');var Redis=require(_0xca82('0xf'));var authService=require(_0xca82('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xca82('0x11'));var hardwareService=require(_0xca82('0x12'));var logger=require(_0xca82('0x13'))('api');var utils=require(_0xca82('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xca82('0x15'));var db=require(_0xca82('0x16'))['db'];config[_0xca82('0x17')]=_[_0xca82('0x18')](config[_0xca82('0x17')],{'host':_0xca82('0x19'),'port':0x18eb});var socket=require(_0xca82('0x1a'))(new Redis(config[_0xca82('0x17')]));require('./plugin.socket')[_0xca82('0x1b')](socket);function respondWithStatusCode(_0x3ecf7f,_0xc6c4c4){_0xc6c4c4=_0xc6c4c4||0xcc;return function(_0x34f10e){if(_0x34f10e){return _0x3ecf7f[_0xca82('0x1c')](_0xc6c4c4);}return _0x3ecf7f[_0xca82('0x1d')](_0xc6c4c4)['end']();};}function respondWithResult(_0x4d737b,_0x76aa84){_0x76aa84=_0x76aa84||0xc8;return function(_0x36428b){if(_0x36428b){return _0x4d737b[_0xca82('0x1d')](_0x76aa84)[_0xca82('0x1e')](_0x36428b);}};}function respondWithFilteredResult(_0x82f589,_0x41795b){return function(_0x49caef){if(_0x49caef){var _0x13abfd=typeof _0x41795b[_0xca82('0x1f')]==='undefined'&&typeof _0x41795b[_0xca82('0x20')]===_0xca82('0x21');var _0x14dbf1=_0x49caef[_0xca82('0x22')];var _0xebc61f=_0x13abfd?0x0:_0x41795b[_0xca82('0x1f')];var _0x5499a3=_0x13abfd?_0x49caef[_0xca82('0x22')]:_0x41795b[_0xca82('0x1f')]+_0x41795b[_0xca82('0x20')];var _0x3f0db0;if(_0x5499a3>=_0x14dbf1){_0x5499a3=_0x14dbf1;_0x3f0db0=0xc8;}else{_0x3f0db0=0xce;}_0x82f589['status'](_0x3f0db0);return _0x82f589[_0xca82('0x23')](_0xca82('0x24'),_0xebc61f+'-'+_0x5499a3+'/'+_0x14dbf1)[_0xca82('0x1e')](_0x49caef);}return null;};}function patchUpdates(_0x579c69){return function(_0x5a72a0){try{jsonpatch[_0xca82('0x25')](_0x5a72a0,_0x579c69,!![]);}catch(_0x4e7391){return BPromise['reject'](_0x4e7391);}return _0x5a72a0[_0xca82('0x26')]();};}function saveUpdates(_0x51e906,_0x3eb714){return function(_0x5b827a){if(_0x5b827a){return _0x5b827a[_0xca82('0x27')](_0x51e906)[_0xca82('0x28')](function(_0x3ae959){return _0x3ae959;});}return null;};}function removeEntity(_0x59b32f,_0x5819ad){return function(_0x26c20b){if(_0x26c20b){return _0x26c20b[_0xca82('0x29')]()['then'](function(){var _0x5bdebd=_0x26c20b[_0xca82('0x2a')]({'plain':!![]});var _0x403c04=_0xca82('0x2b');return db[_0xca82('0x2c')][_0xca82('0x29')]({'where':{'type':_0x403c04,'resourceId':_0x5bdebd['id']}})['then'](function(){return _0x26c20b;});})[_0xca82('0x28')](function(){_0x59b32f[_0xca82('0x1d')](0xcc)[_0xca82('0x2d')]();});}};}function handleEntityNotFound(_0x249670,_0x38145e){return function(_0x232364){if(!_0x232364){_0x249670[_0xca82('0x1c')](0x194);}return _0x232364;};}function handleError(_0x28a3e3,_0x3938ae){_0x3938ae=_0x3938ae||0x1f4;return function(_0x4b1e80){logger[_0xca82('0x2e')](_0x4b1e80[_0xca82('0x2f')]);if(_0x4b1e80['name']){delete _0x4b1e80[_0xca82('0x30')];}_0x28a3e3[_0xca82('0x1d')](_0x3938ae)[_0xca82('0x31')](_0x4b1e80);};}exports[_0xca82('0x32')]=function(_0x197ffb,_0x330b51){var _0x363d1a={},_0x4dfede={},_0x5f2f88={'count':0x0,'rows':[]};var _0x5affc5=_['map'](db['Plugin'][_0xca82('0x33')],function(_0x3b96c2){return{'name':_0x3b96c2[_0xca82('0x34')],'type':_0x3b96c2[_0xca82('0x35')][_0xca82('0x36')]};});_0x4dfede[_0xca82('0x37')]=_[_0xca82('0x38')](_0x5affc5,'name');_0x4dfede[_0xca82('0x39')]=_[_0xca82('0x3a')](_0x197ffb[_0xca82('0x39')]);_0x4dfede['filters']=_[_0xca82('0x3b')](_0x4dfede[_0xca82('0x37')],_0x4dfede[_0xca82('0x39')]);_0x363d1a['attributes']=_[_0xca82('0x3b')](_0x4dfede['model'],qs[_0xca82('0x3c')](_0x197ffb[_0xca82('0x39')][_0xca82('0x3c')]));_0x363d1a[_0xca82('0x3d')]=_0x363d1a[_0xca82('0x3d')][_0xca82('0x3e')]?_0x363d1a[_0xca82('0x3d')]:_0x4dfede['model'];if(!_0x197ffb[_0xca82('0x39')]['hasOwnProperty'](_0xca82('0x3f'))){_0x363d1a[_0xca82('0x20')]=qs[_0xca82('0x20')](_0x197ffb[_0xca82('0x39')][_0xca82('0x20')]);_0x363d1a[_0xca82('0x1f')]=qs['offset'](_0x197ffb[_0xca82('0x39')][_0xca82('0x1f')]);}_0x363d1a[_0xca82('0x40')]=qs[_0xca82('0x41')](_0x197ffb[_0xca82('0x39')][_0xca82('0x41')]);_0x363d1a[_0xca82('0x42')]=qs[_0xca82('0x43')](_[_0xca82('0x44')](_0x197ffb[_0xca82('0x39')],_0x4dfede[_0xca82('0x43')]),_0x5affc5);if(_0x197ffb[_0xca82('0x39')]['filter']){_0x363d1a['where']=_[_0xca82('0x45')](_0x363d1a['where'],{'$or':_[_0xca82('0x38')](_0x5affc5,function(_0x588a7a){if(_0x588a7a[_0xca82('0x35')]!==_0xca82('0x46')){var _0x75836c={};_0x75836c[_0x588a7a['name']]={'$like':'%'+_0x197ffb[_0xca82('0x39')][_0xca82('0x47')]+'%'};return _0x75836c;}})});}_0x363d1a=_[_0xca82('0x45')]({},_0x363d1a,_0x197ffb[_0xca82('0x48')]);var _0x28961f={'where':_0x363d1a['where']};return db[_0xca82('0x49')][_0xca82('0x22')](_0x28961f)[_0xca82('0x28')](function(_0xe89d96){_0x5f2f88['count']=_0xe89d96;if(_0x197ffb[_0xca82('0x39')][_0xca82('0x4a')]){_0x363d1a[_0xca82('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0xca82('0x4c')](_0x363d1a);})['then'](function(_0x1a261e){_0x5f2f88[_0xca82('0x4d')]=_0x1a261e;return _0x5f2f88;})[_0xca82('0x28')](respondWithFilteredResult(_0x330b51,_0x363d1a))[_0xca82('0x4e')](handleError(_0x330b51,null));};exports[_0xca82('0x4f')]=function(_0x311c1b,_0x31851d){var _0x86e10d={'raw':!![],'where':{'id':_0x311c1b[_0xca82('0x50')]['id']}},_0x3e8e66={};_0x3e8e66[_0xca82('0x37')]=_[_0xca82('0x3a')](db[_0xca82('0x49')][_0xca82('0x33')]);_0x3e8e66[_0xca82('0x39')]=_['keys'](_0x311c1b[_0xca82('0x39')]);_0x3e8e66[_0xca82('0x43')]=_['intersection'](_0x3e8e66[_0xca82('0x37')],_0x3e8e66[_0xca82('0x39')]);_0x86e10d[_0xca82('0x3d')]=_[_0xca82('0x3b')](_0x3e8e66[_0xca82('0x37')],qs[_0xca82('0x3c')](_0x311c1b['query'][_0xca82('0x3c')]));_0x86e10d[_0xca82('0x3d')]=_0x86e10d[_0xca82('0x3d')][_0xca82('0x3e')]?_0x86e10d[_0xca82('0x3d')]:_0x3e8e66[_0xca82('0x37')];if(_0x311c1b[_0xca82('0x39')][_0xca82('0x4a')]){_0x86e10d[_0xca82('0x4b')]=[{'all':!![]}];}_0x86e10d=_[_0xca82('0x45')]({},_0x86e10d,_0x311c1b[_0xca82('0x48')]);return db[_0xca82('0x49')]['find'](_0x86e10d)[_0xca82('0x28')](handleEntityNotFound(_0x31851d,null))[_0xca82('0x28')](respondWithResult(_0x31851d,null))[_0xca82('0x4e')](handleError(_0x31851d,null));};exports['download']=function(_0x3106be,_0x2efa3c,_0x3caa3d){return db[_0xca82('0x49')][_0xca82('0x51')]({'where':{'id':_0x3106be[_0xca82('0x50')]['id']},'attributes':[_0xca82('0x30'),_0xca82('0x52')],'raw':!![]})[_0xca82('0x28')](handleEntityNotFound(_0x2efa3c,null))[_0xca82('0x28')](function(_0x5cd0be){if(_0x5cd0be){var _0x330ad6=path[_0xca82('0x53')](config['root'],_0xca82('0x54'),util[_0xca82('0x55')](_0xca82('0x56'),path['basename'](_0x5cd0be[_0xca82('0x52')])));var _0x24063a=fs['createWriteStream'](_0x330ad6);var _0x28def4=archiver(_0xca82('0x57'),{'zlib':{'level':0x9}});_0x28def4['on'](_0xca82('0x58'),function(_0x82324e){if(_0x82324e[_0xca82('0x59')]===_0xca82('0x5a')){logger[_0xca82('0x2e')](_0x82324e);}else{throw new db['Sequelize'][(_0xca82('0x5b'))](_0xca82('0x5c'));}});_0x28def4['on'](_0xca82('0x2e'),function(_0x3b86d9){throw new db[(_0xca82('0x5d'))][(_0xca82('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x28def4[_0xca82('0x5e')](_0x24063a);_0x28def4[_0xca82('0x5f')](_0xca82('0x60'),{'cwd':path['join'](config['root'],_0xca82('0x54'),path[_0xca82('0x61')](_0x5cd0be['path'])),'ignore':[path[_0xca82('0x53')](path[_0xca82('0x62')](_0x5cd0be['path']),_0xca82('0x63')),path[_0xca82('0x53')](path[_0xca82('0x62')](_0x5cd0be[_0xca82('0x52')]),'attachments/**/*')],'nodir':!![]})[_0xca82('0x64')]();_0x24063a['on']('close',function(){if(!fs[_0xca82('0x65')](_0x330ad6)){throw new db[(_0xca82('0x5d'))][(_0xca82('0x5b'))](_0xca82('0x66'));}return _0x2efa3c['download'](_0x330ad6,util[_0xca82('0x55')](_0xca82('0x56'),path[_0xca82('0x62')](_0x5cd0be[_0xca82('0x52')])),function(_0x56200c){if(_0x56200c){throw new db[(_0xca82('0x5d'))]['Error'](_0xca82('0x67'));}fs['unlinkSync'](_0x330ad6);logger[_0xca82('0x68')](_0xca82('0x69'));logger[_0xca82('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x2efa3c,null));};exports[_0xca82('0x6a')]=function(_0x173294,_0xbb999,_0x33f8ab){var _0x37dcb9=path['basename'](_0x173294[_0xca82('0x6b')][_0xca82('0x6c')],path[_0xca82('0x6d')](_0x173294[_0xca82('0x6b')][_0xca82('0x6c')]));var _0x5da378=path['join'](config[_0xca82('0x6e')],'server/files/plugins',_0x173294[_0xca82('0x6b')][_0xca82('0x6c')]);var _0x108ba0=path['join'](config[_0xca82('0x6e')],_0xca82('0x54'),_0x37dcb9);logger[_0xca82('0x68')](_0xca82('0x6f'),_0x5da378);logger[_0xca82('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x108ba0);try{fs[_0xca82('0x70')](_0x5da378,parseInt(_0xca82('0x71'),0x8));extract(_0x5da378,{'dir':_0x108ba0},function(_0x13c49b){if(_0x13c49b){logger[_0xca82('0x2e')](_0x13c49b);handleError(_0x13c49b,!![]);};var _0x354cd0=fs[_0xca82('0x72')](_0x108ba0);if(_0x354cd0[_0xca82('0x3e')]>0x1){removeReferences(_0x5da378,_0x108ba0);logger[_0xca82('0x2e')](_0xca82('0x73'));return _0x33f8ab(new Error(_0xca82('0x73')));}var _0x2cb83b=fs[_0xca82('0x74')](path[_0xca82('0x53')](_0x108ba0,_0x354cd0[0x0]));if(_0x2cb83b[_0xca82('0x75')]()){removeReferences(_0x5da378,_0x108ba0);logger[_0xca82('0x2e')](_0xca82('0x73'));return _0x33f8ab(new Error('Invalid\x20plugin\x20structure'));}if(_0x2cb83b[_0xca82('0x76')]()){var _0x20f255=fs[_0xca82('0x72')](path[_0xca82('0x53')](_0x108ba0,_0x354cd0[0x0]));if(_0x20f255[_0xca82('0x3e')]===0x0){removeReferences(_0x5da378,_0x108ba0);logger[_0xca82('0x2e')](_0xca82('0x73'));return _0x33f8ab(new Error(_0xca82('0x73')));}var _0x171874=_0x20f255[_0xca82('0x77')](function(_0xd565ca){return _0xd565ca===_0xca82('0x78');});if(!_0x171874){return _0x33f8ab(new Error(_0xca82('0x79')));}var _0x3e35d2=fs[_0xca82('0x7a')](path['join'](_0x108ba0,_0x354cd0[0x0],_0xca82('0x78')));var _0x5757f8=JSON['parse'](_0x3e35d2);if(_0xca82('0x21')==typeof _0x5757f8[_0xca82('0x30')]){return _0x33f8ab(new Error(_0xca82('0x7b')));}if('undefined'==typeof _0x5757f8[_0xca82('0x35')]){return _0x33f8ab(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xca82('0x21')==typeof _0x5757f8[_0xca82('0x7c')]){return _0x33f8ab(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x5757f8['parameters']){return _0x33f8ab(new Error(_0xca82('0x7d')));}if(_0x5757f8['type']===_0xca82('0x7e')){if('undefined'==typeof _0x5757f8[_0xca82('0x7f')]['views']){return _0x33f8ab(new Error(_0xca82('0x80')));}if('undefined'==typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')][_0xca82('0x82')]&&_0xca82('0x21')==typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['agent']){return _0x33f8ab(new Error(_0xca82('0x83')));}}else if(_0x5757f8[_0xca82('0x35')]===_0xca82('0x84')){if(_0xca82('0x21')==typeof _0x5757f8[_0xca82('0x7f')]['scriptName']){return _0x33f8ab(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xca82('0x21')==typeof _0x5757f8[_0xca82('0x7f')]['scriptPath']){return _0x33f8ab(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x33f8ab(new Error(_0xca82('0x85')));}var _0x384b79=_0x5757f8[_0xca82('0x30')];var _0x146f9c=_0x5757f8[_0xca82('0x86')];var _0x4f68df=_0x5757f8[_0xca82('0x35')];var _0x24519f=_0x5757f8['sidebar']?_0x5757f8[_0xca82('0x87')]:_0xca82('0x88');var _0x1f2700=_0x5757f8[_0xca82('0x89')]?_0x5757f8[_0xca82('0x89')]:_0xca82('0x8a');var _0xfc0adb='';var _0x32a307='';var _0x5d9d65='';var _0x39c2c8='';var _0x52fe3d=_0x5757f8[_0xca82('0x7c')];if(_0x4f68df==='html'){if('undefined'!=typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['admin']){var _0x47b97a=_0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x47b97a)){_0xfc0adb=path[_0xca82('0x53')](_0xca82('0x8b'),_0x37dcb9,_0x354cd0[0x0],_0x47b97a);}else{_0xfc0adb=_0x47b97a;}}else{logger[_0xca82('0x68')](_0xca82('0x8c'));}if(_0xca82('0x21')!=typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')][_0xca82('0x8d')]){var _0x8892dc=_0x5757f8['parameters']['views'][_0xca82('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xca82('0x8e')](_0x8892dc)){_0x32a307=path[_0xca82('0x53')](_0xca82('0x8b'),_0x37dcb9,_0x354cd0[0x0],_0x8892dc);}else{_0x32a307=_0x8892dc;}}else{logger[_0xca82('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4f68df===_0xca82('0x84')){_0x5d9d65=_0x5757f8[_0xca82('0x7f')][_0xca82('0x8f')];_0x39c2c8=_0x5757f8['parameters'][_0xca82('0x90')];if(_0xca82('0x21')!=typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]){if(_0xca82('0x21')!=typeof _0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['admin']){var _0x47b97a=_0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x47b97a)){_0xfc0adb=path[_0xca82('0x53')]('plugins',_0x37dcb9,_0x354cd0[0x0],_0x47b97a);}else{_0xfc0adb=_0x47b97a;}}if(_0xca82('0x21')!=typeof _0x5757f8['parameters']['views'][_0xca82('0x8d')]){var _0x8892dc=_0x5757f8[_0xca82('0x7f')][_0xca82('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x8892dc)){_0x32a307=path[_0xca82('0x53')](_0xca82('0x8b'),_0x37dcb9,_0x354cd0[0x0],_0x8892dc);}else{_0x32a307=_0x8892dc;}}}}var _0x2ce9b7={'name':_0x384b79,'description':_0x146f9c,'path':path[_0xca82('0x53')](_0x37dcb9,_0x354cd0[0x0]),'type':_0x4f68df,'sidebar':_0x24519f,'icon':_0x1f2700,'adminUrl':_0xfc0adb,'agentUrl':_0x32a307,'scriptName':_0x5d9d65,'scriptPath':_0x39c2c8,'version':_0x52fe3d};removeReferences(_0x5da378,null);return db['Plugin']['create'](_0x2ce9b7)[_0xca82('0x28')](function(_0x52c86b){var _0x487f97={'role':_0x173294[_0xca82('0x91')]['role'],'userProfileId':_0x173294['body'][_0xca82('0x92')]};if(!_0x487f97)throw new Error(_0xca82('0x93'));if(_0x487f97['role']===_0xca82('0x94')){var _0x310106=_0x52c86b[_0xca82('0x2a')]({'plain':!![]});return db[_0xca82('0x95')]['find']({'where':{'name':_0xca82('0x2b'),'userProfileId':_0x487f97[_0xca82('0x92')]},'raw':!![]})[_0xca82('0x28')](function(_0x430ca1){if(_0x430ca1&&_0x430ca1[_0xca82('0x96')]===0x0){return db[_0xca82('0x2c')][_0xca82('0x97')]({'name':_0x310106[_0xca82('0x30')],'resourceId':_0x310106['id'],'type':_0x430ca1[_0xca82('0x30')],'sectionId':_0x430ca1['id']},{})['then'](function(){return _0x52c86b;});}else{return _0x52c86b;}})[_0xca82('0x4e')](function(_0x1a787b){logger[_0xca82('0x2e')](_0xca82('0x98'),_0x1a787b);throw _0x1a787b;});}return _0x52c86b;})[_0xca82('0x28')](respondWithResult(_0xbb999,null))[_0xca82('0x4e')](handleError(_0xbb999,null));}});}catch(_0x4bb6d8){_0xbb999['status'](0x1f4)[_0xca82('0x31')](_0x4bb6d8);}};function removeReferences(_0x532321,_0x440e76){try{if(_0x532321){fs['unlinkSync'](_0x532321);logger[_0xca82('0x68')](_0xca82('0x99'));}if(_0x440e76){rimraf(_0x440e76,function(){});logger['info'](_0xca82('0x9a'));}}catch(_0x282e8f){logger[_0xca82('0x2e')](_0x282e8f);}}exports[_0xca82('0x27')]=function(_0x1d2f3b,_0x55e297,_0x8832a3){return db[_0xca82('0x49')][_0xca82('0x51')]({'where':{'id':_0x1d2f3b[_0xca82('0x50')]['id']}})[_0xca82('0x28')](handleEntityNotFound(_0x55e297,null))['then'](saveUpdates(_0x1d2f3b[_0xca82('0x91')],null))[_0xca82('0x28')](respondWithResult(_0x55e297,null))['catch'](handleError(_0x55e297,null));};exports['delete']=function(_0x419563,_0x1b1fb4,_0x1e1e01){return db['Plugin']['find']({'where':{'id':_0x419563[_0xca82('0x50')]['id']}})['then'](function(_0x40a191){if(_0x40a191){return _0x40a191[_0xca82('0x29')]();}})[_0xca82('0x28')](function(_0x33d989){rimraf(path[_0xca82('0x53')](config[_0xca82('0x6e')],_0xca82('0x54'),path[_0xca82('0x61')](_0x33d989['path'])),function(){});return _0x33d989;})[_0xca82('0x28')](handleEntityNotFound(_0x1b1fb4,null))['then'](respondWithStatusCode(_0x1b1fb4,null))[_0xca82('0x4e')](handleError(_0x1b1fb4,null));};exports[_0xca82('0x9b')]=function(_0x5a11e3,_0x1ee879,_0x5d8591){return BPromise[_0xca82('0x9c')]()[_0xca82('0x28')](function(){if(!_0x5a11e3['query'][_0xca82('0x52')]){throw new Error(_0xca82('0x9d'));}if(!_0x5a11e3[_0xca82('0x39')][_0xca82('0x9e')]){throw new Error(_0xca82('0x9f'));}var _0x2904cb=_0x5a11e3[_0xca82('0x39')]['hostname']?_0x5a11e3[_0xca82('0x39')][_0xca82('0xa0')]+':'+_0x5a11e3[_0xca82('0x39')][_0xca82('0x9e')]:_0xca82('0xa1')+_0x5a11e3['query'][_0xca82('0x9e')];var _0x1d2394=_0x5a11e3['query']['json']?_0x5a11e3[_0xca82('0x39')]['json']:!![];var _0xb82bc2=_0x5a11e3[_0xca82('0x39')][_0xca82('0xa2')]?_0x5a11e3['query'][_0xca82('0xa2')]:null;var _0x5ec7fd={'method':_0x5a11e3[_0xca82('0xa3')],'uri':util['format'](_0xca82('0xa4'),_0x2904cb,_0x5a11e3['query'][_0xca82('0x52')]),'json':_0x1d2394,'resolveWithFullResponse':!![],'encoding':_0xb82bc2,'qs':_0x5a11e3[_0xca82('0x39')]};if(_0x5a11e3[_0xca82('0xa5')]){_0x5ec7fd[_0xca82('0xa5')]=_0x5a11e3['headers'];if(_0x5ec7fd[_0xca82('0xa5')][_0xca82('0xa6')]){delete _0x5ec7fd['headers'][_0xca82('0xa6')];}}if(_0x5ec7fd[_0xca82('0xa5')][_0xca82('0xa7')]){delete _0x5ec7fd['headers'][_0xca82('0xa7')];}return rp(_0x5ec7fd);})['then'](function(_0x478b5d){if(_0x478b5d){_0x1ee879['set'](_0x478b5d[_0xca82('0xa5')]);logger[_0xca82('0x68')](_0x478b5d[_0xca82('0x91')]);if(_['endsWith'](_0x5a11e3[_0xca82('0x39')][_0xca82('0x52')],_0xca82('0xa8'))&&_0x478b5d[_0xca82('0xa9')]==0x1f4){return _0x1ee879[_0xca82('0x1c')](_0x478b5d[_0xca82('0xa9')]);}else{return _0x1ee879['status'](_0x478b5d[_0xca82('0xa9')])['send'](_0x478b5d['body']);}}else{return _0x1ee879[_0xca82('0x1c')](0xc8);}})[_0xca82('0x4e')](handleError(_0x1ee879,null));};exports[_0xca82('0xaa')]=function(_0x2f5946,_0x2c580d,_0xcb06b0){return BPromise[_0xca82('0x9c')]()['then'](function(){if(!_0x2f5946[_0xca82('0x39')]['path']){throw new Error(_0xca82('0x9d'));}if(!_0x2f5946[_0xca82('0x39')][_0xca82('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x40a268=_0x2f5946[_0xca82('0x39')][_0xca82('0xa0')]?_0x2f5946[_0xca82('0x39')][_0xca82('0xa0')]+':'+_0x2f5946[_0xca82('0x39')][_0xca82('0x9e')]:_0xca82('0xa1')+_0x2f5946['query'][_0xca82('0x9e')];var _0x3fbf65=_0x2f5946[_0xca82('0x39')][_0xca82('0x1e')]?_0x2f5946['query'][_0xca82('0x1e')]:!![];var _0x12db75=_0x2f5946['query'][_0xca82('0xa2')]?_0x2f5946[_0xca82('0x39')]['encoding']:null;var _0x39811b={'method':_0x2f5946[_0xca82('0xa3')],'uri':util['format']('%s%s',_0x40a268,_0x2f5946[_0xca82('0x39')]['path']),'json':_0x3fbf65,'resolveWithFullResponse':!![],'encoding':_0x12db75,'body':_0x2f5946[_0xca82('0x91')]};if(_0x2f5946[_0xca82('0xa5')]){_0x39811b[_0xca82('0xa5')]=_0x2f5946[_0xca82('0xa5')];if(_0x39811b[_0xca82('0xa5')][_0xca82('0xa6')]){delete _0x39811b[_0xca82('0xa5')][_0xca82('0xa6')];}}if(_0x39811b[_0xca82('0xa5')][_0xca82('0xa7')]){delete _0x39811b['headers'][_0xca82('0xa7')];}return rp(_0x39811b);})['then'](function(_0x36d401){if(_0x36d401){_0x2c580d[_0xca82('0x23')](_0x36d401[_0xca82('0xa5')]);logger[_0xca82('0x68')](_0x36d401[_0xca82('0x91')]);return _0x2c580d['status'](_0x36d401['statusCode'])[_0xca82('0x31')](_0x36d401['body']);}else{return _0x2c580d[_0xca82('0x1c')](0xc8);}})['catch'](handleError(_0x2c580d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b061098..1db835d 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 _0xed5f=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','Plugin'];(function(_0x5d4eaf,_0x979935){var _0x126415=function(_0x5a9e4a){while(--_0x5a9e4a){_0x5d4eaf['push'](_0x5d4eaf['shift']());}};_0x126415(++_0x979935);}(_0xed5f,0x1e6));var _0xfed5=function(_0x1fd2ba,_0x3dbdc3){_0x1fd2ba=_0x1fd2ba-0x0;var _0x4c9d98=_0xed5f[_0x1fd2ba];return _0x4c9d98;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfed5('0x0'))['db'][_0xfed5('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xfed5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfed5('0x3'),'afterDestroy':_0xfed5('0x4')};function emitEvent(_0x387c6e){return function(_0x1e5aae,_0x5df01a,_0x1abffa){PluginEvents[_0xfed5('0x5')](_0x387c6e+':'+_0x1e5aae['id'],_0x1e5aae);PluginEvents[_0xfed5('0x5')](_0x387c6e,_0x1e5aae);_0x1abffa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xfed5('0x6')](e,emitEvent(event));}}module[_0xfed5('0x7')]=PluginEvents; \ No newline at end of file +var _0xab3f=['save','update','remove','emit','hook','exports','events','Plugin','setMaxListeners'];(function(_0x44cb5d,_0x97f385){var _0x175c40=function(_0x2c1e34){while(--_0x2c1e34){_0x44cb5d['push'](_0x44cb5d['shift']());}};_0x175c40(++_0x97f385);}(_0xab3f,0x72));var _0xfab3=function(_0x9ef61e,_0x2837d9){_0x9ef61e=_0x9ef61e-0x0;var _0x1fc375=_0xab3f[_0x9ef61e];return _0x1fc375;};'use strict';var EventEmitter=require(_0xfab3('0x0'));var Plugin=require('../../mysqldb')['db'][_0xfab3('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xfab3('0x2')](0x0);var events={'afterCreate':_0xfab3('0x3'),'afterUpdate':_0xfab3('0x4'),'afterDestroy':_0xfab3('0x5')};function emitEvent(_0x12c3ab){return function(_0x394308,_0x4387f8,_0x3e2de2){PluginEvents[_0xfab3('0x6')](_0x12c3ab+':'+_0x394308['id'],_0x394308);PluginEvents[_0xfab3('0x6')](_0x12c3ab,_0x394308);_0x3e2de2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xfab3('0x7')](e,emitEvent(event));}}module[_0xfab3('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9a68ed1..5094b5a 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 _0xa535=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Plugin'];(function(_0x2d05cf,_0x58750d){var _0x36421a=function(_0x45e48c){while(--_0x45e48c){_0x2d05cf['push'](_0x2d05cf['shift']());}};_0x36421a(++_0x58750d);}(_0xa535,0x1ad));var _0x5a53=function(_0x44bb8c,_0x2ae84f){_0x44bb8c=_0x44bb8c-0x0;var _0x33ece4=_0xa535[_0x44bb8c];return _0x33ece4;};'use strict';var _=require(_0x5a53('0x0'));var util=require(_0x5a53('0x1'));var logger=require(_0x5a53('0x2'))(_0x5a53('0x3'));var moment=require(_0x5a53('0x4'));var BPromise=require(_0x5a53('0x5'));var rp=require(_0x5a53('0x6'));var fs=require('fs');var path=require(_0x5a53('0x7'));var rimraf=require(_0x5a53('0x8'));var config=require(_0x5a53('0x9'));var attributes=require('./plugin.attributes');module[_0x5a53('0xa')]=function(_0x17da54,_0x1123ff){return _0x17da54[_0x5a53('0xb')](_0x5a53('0xc'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50a=['request-promise','path','rimraf','./plugin.attributes','define','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xe50a,0x1c2));var _0xae50=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xe50a[_0x26bf51];return _0x503415;};'use strict';var _=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var logger=require(_0xae50('0x2'))(_0xae50('0x3'));var moment=require(_0xae50('0x4'));var BPromise=require(_0xae50('0x5'));var rp=require(_0xae50('0x6'));var fs=require('fs');var path=require(_0xae50('0x7'));var rimraf=require(_0xae50('0x8'));var config=require('../../config/environment');var attributes=require(_0xae50('0x9'));module['exports']=function(_0x4d83bf,_0x50fb89){return _0x4d83bf[_0xae50('0xa')]('Plugin',attributes,{'tableName':_0xae50('0xb'),'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 a77cd3a..765839f 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 _0x59fe=['request','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','info','result','catch','CreatePlugin','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','register'];(function(_0x5575f9,_0x59232c){var _0x2715f0=function(_0x575bcd){while(--_0x575bcd){_0x5575f9['push'](_0x5575f9['shift']());}};_0x2715f0(++_0x59232c);}(_0x59fe,0x146));var _0xe59f=function(_0x2efad5,_0x209696){_0x2efad5=_0x2efad5-0x0;var _0x54f45e=_0x59fe[_0x2efad5];return _0x54f45e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe59f('0x0'));var BPromise=require(_0xe59f('0x1'));var rs=require(_0xe59f('0x2'));var fs=require('fs');var Redis=require(_0xe59f('0x3'));var db=require(_0xe59f('0x4'))['db'];var utils=require(_0xe59f('0x5'));var logger=require(_0xe59f('0x6'))(_0xe59f('0x7'));var config=require(_0xe59f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe59f('0x9')][_0xe59f('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xe59f('0xb'),'port':0x18eb});var socket=require(_0xe59f('0xc'))(new Redis(config[_0xe59f('0xd')]));require('./plugin.socket')[_0xe59f('0xe')](socket);function respondWithRpcPromise(_0x4bb565,_0xf732e8,_0x113330){return new BPromise(function(_0x479490,_0x32bb6d){return client[_0xe59f('0xf')](_0x4bb565,_0x113330)['then'](function(_0x4dfd48){logger['info']('Plugin,\x20%s,\x20%s',_0xf732e8,_0xe59f('0x10'));logger[_0xe59f('0x11')](_0xe59f('0x12'),_0xf732e8,'request\x20sent',JSON[_0xe59f('0x13')](_0x4dfd48));if(_0x4dfd48[_0xe59f('0x14')]){if(_0x4dfd48[_0xe59f('0x14')]['code']===0x1f4){logger[_0xe59f('0x14')]('Plugin,\x20%s,\x20%s',_0xf732e8,_0x4dfd48[_0xe59f('0x14')][_0xe59f('0x15')]);return _0x32bb6d(_0x4dfd48[_0xe59f('0x14')]['message']);}logger['error'](_0xe59f('0x16'),_0xf732e8,_0x4dfd48[_0xe59f('0x14')][_0xe59f('0x15')]);return _0x479490(_0x4dfd48[_0xe59f('0x14')]['message']);}else{logger[_0xe59f('0x17')](_0xe59f('0x16'),_0xf732e8,_0xe59f('0x10'));_0x479490(_0x4dfd48[_0xe59f('0x18')][_0xe59f('0x15')]);}})[_0xe59f('0x19')](function(_0x20375f){logger[_0xe59f('0x14')](_0xe59f('0x16'),_0xf732e8,_0x20375f);_0x32bb6d(_0x20375f);});});}exports[_0xe59f('0x1a')]=function(_0x10ef0f){var _0x4b57cc=this;return new Promise(function(_0x24834e,_0x1c880d){return db['Plugin'][_0xe59f('0x1b')](_0x10ef0f[_0xe59f('0x1c')],{'raw':_0x10ef0f[_0xe59f('0x1d')]?_0x10ef0f[_0xe59f('0x1d')][_0xe59f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x14d91b){logger['info']('CreatePlugin',_0x10ef0f);logger['debug'](_0xe59f('0x1a'),_0x10ef0f,JSON[_0xe59f('0x13')](_0x14d91b));_0x24834e(_0x14d91b);})[_0xe59f('0x19')](function(_0x11a8d4){logger[_0xe59f('0x14')](_0xe59f('0x1a'),_0x11a8d4[_0xe59f('0x15')],_0x10ef0f);_0x1c880d(_0x4b57cc[_0xe59f('0x14')](0x1f4,_0x11a8d4[_0xe59f('0x15')]));});});}; \ No newline at end of file +var _0x0276=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','body','options','CreatePlugin','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','redis','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0276,0x157));var _0x6027=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0x0276[_0x1aeb39];return _0x439790;};'use strict';var _=require(_0x6027('0x0'));var util=require(_0x6027('0x1'));var moment=require(_0x6027('0x2'));var BPromise=require('bluebird');var rs=require(_0x6027('0x3'));var fs=require('fs');var Redis=require(_0x6027('0x4'));var db=require(_0x6027('0x5'))['db'];var utils=require(_0x6027('0x6'));var logger=require(_0x6027('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6027('0x8'));var client=jayson[_0x6027('0x9')][_0x6027('0xa')]({'port':0x232a});config['redis']=_[_0x6027('0xb')](config['redis'],{'host':_0x6027('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6027('0xd')]));require(_0x6027('0xe'))[_0x6027('0xf')](socket);function respondWithRpcPromise(_0x3c5f69,_0x2f79a0,_0xd105ac){return new BPromise(function(_0x3890eb,_0x4f5316){return client['request'](_0x3c5f69,_0xd105ac)[_0x6027('0x10')](function(_0x2f108d){logger[_0x6027('0x11')](_0x6027('0x12'),_0x2f79a0,_0x6027('0x13'));logger[_0x6027('0x14')](_0x6027('0x15'),_0x2f79a0,_0x6027('0x13'),JSON[_0x6027('0x16')](_0x2f108d));if(_0x2f108d['error']){if(_0x2f108d[_0x6027('0x17')][_0x6027('0x18')]===0x1f4){logger[_0x6027('0x17')](_0x6027('0x12'),_0x2f79a0,_0x2f108d[_0x6027('0x17')][_0x6027('0x19')]);return _0x4f5316(_0x2f108d[_0x6027('0x17')]['message']);}logger[_0x6027('0x17')](_0x6027('0x12'),_0x2f79a0,_0x2f108d[_0x6027('0x17')][_0x6027('0x19')]);return _0x3890eb(_0x2f108d['error']['message']);}else{logger['info'](_0x6027('0x12'),_0x2f79a0,_0x6027('0x13'));_0x3890eb(_0x2f108d[_0x6027('0x1a')][_0x6027('0x19')]);}})[_0x6027('0x1b')](function(_0x20df03){logger[_0x6027('0x17')](_0x6027('0x12'),_0x2f79a0,_0x20df03);_0x4f5316(_0x20df03);});});}exports['CreatePlugin']=function(_0x4475ba){var _0x3efdfe=this;return new Promise(function(_0x35c03f,_0x238321){return db[_0x6027('0x1c')][_0x6027('0x1d')](_0x4475ba[_0x6027('0x1e')],{'raw':_0x4475ba[_0x6027('0x1f')]?_0x4475ba[_0x6027('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x6027('0x10')](function(_0x4a64fc){logger[_0x6027('0x11')](_0x6027('0x20'),_0x4475ba);logger[_0x6027('0x14')](_0x6027('0x20'),_0x4475ba,JSON[_0x6027('0x16')](_0x4a64fc));_0x35c03f(_0x4a64fc);})[_0x6027('0x1b')](function(_0x5e903c){logger[_0x6027('0x17')]('CreatePlugin',_0x5e903c[_0x6027('0x19')],_0x4475ba);_0x238321(_0x3efdfe[_0x6027('0x17')](0x1f4,_0x5e903c[_0x6027('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 44cdc9c..795a26d 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 _0x27a7=['register','length','plugin:','./plugin.events','remove','update','emit','removeListener'];(function(_0x41752b,_0x12fe91){var _0x192ee7=function(_0xe5c354){while(--_0xe5c354){_0x41752b['push'](_0x41752b['shift']());}};_0x192ee7(++_0x12fe91);}(_0x27a7,0xeb));var _0x727a=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x27a7[_0x3b5ad9];return _0x611ae9;};'use strict';var PluginEvents=require(_0x727a('0x0'));var events=['save',_0x727a('0x1'),_0x727a('0x2')];function createListener(_0x553b9a,_0x399e58){return function(_0x57b9ab){_0x399e58[_0x727a('0x3')](_0x553b9a,_0x57b9ab);};}function removeListener(_0xb3c8ae,_0x12b6ad){return function(){PluginEvents[_0x727a('0x4')](_0xb3c8ae,_0x12b6ad);};}exports[_0x727a('0x5')]=function(_0x34c2b5){for(var _0x3cd661=0x0,_0x2829f6=events[_0x727a('0x6')];_0x3cd661<_0x2829f6;_0x3cd661++){var _0x539581=events[_0x3cd661];var _0xa72085=createListener(_0x727a('0x7')+_0x539581,_0x34c2b5);PluginEvents['on'](_0x539581,_0xa72085);}}; \ No newline at end of file +var _0x82b1=['register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x4eece9,_0xda1918){var _0x211477=function(_0x62cfd3){while(--_0x62cfd3){_0x4eece9['push'](_0x4eece9['shift']());}};_0x211477(++_0xda1918);}(_0x82b1,0x175));var _0x182b=function(_0x1281e0,_0x1d420b){_0x1281e0=_0x1281e0-0x0;var _0x3ef3b4=_0x82b1[_0x1281e0];return _0x3ef3b4;};'use strict';var PluginEvents=require(_0x182b('0x0'));var events=[_0x182b('0x1'),_0x182b('0x2'),_0x182b('0x3')];function createListener(_0x5d63b0,_0x183074){return function(_0x7d1a09){_0x183074[_0x182b('0x4')](_0x5d63b0,_0x7d1a09);};}function removeListener(_0x377ead,_0x367bbf){return function(){PluginEvents['removeListener'](_0x377ead,_0x367bbf);};}exports[_0x182b('0x5')]=function(_0x4df25e){for(var _0x382dd3=0x0,_0x187fc3=events['length'];_0x382dd3<_0x187fc3;_0x382dd3++){var _0x47138e=events[_0x382dd3];var _0xe77c71=createListener(_0x182b('0x6')+_0x47138e,_0x4df25e);PluginEvents['on'](_0x47138e,_0xe77c71);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d0075ab..7ae09bf 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(_0x496486,_0x3bb6a7){var _0x56b92a=function(_0x19d620){while(--_0x19d620){_0x496486['push'](_0x496486['shift']());}};_0x56b92a(++_0x3bb6a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x1c77e4,_0x1d5ed8){var _0x17014d=function(_0xf48d06){while(--_0xf48d06){_0x1c77e4['push'](_0x1c77e4['shift']());}};_0x17014d(++_0x1d5ed8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 d91f6ea..50aafa1 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 _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x60cc61,_0x563ce9){var _0x4824b6=function(_0x4529d8){while(--_0x4529d8){_0x60cc61['push'](_0x60cc61['shift']());}};_0x4824b6(++_0x563ce9);}(_0x2750,0x13b));var _0x0275=function(_0x44a27c,_0x5dd152){_0x44a27c=_0x44a27c-0x0;var _0x97387b=_0x2750[_0x44a27c];return _0x97387b;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x9b9b=['Unknown\x20status','delete','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','name','npm\x20install','info','error','index','list','reject','express','motion2','length','then','show','describe','params','catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','update','restart','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b9b,0x114));var _0xb9b9=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0x9b9b[_0x14540b];return _0x394822;};'use strict';var _=require('lodash');var pm2=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var path=require(_0xb9b9('0x1'));var exec=require(_0xb9b9('0x2'))[_0xb9b9('0x3')];var BPromise=require(_0xb9b9('0x4'));function handleEntityNotFound(_0x1d6ab6,_0x43c8ff){return function(_0x23b016){if(!_0x23b016){_0x1d6ab6[_0xb9b9('0x5')](0x194);;}return _0x23b016;};}function respondWithResult(_0x79dd,_0x3d1a95){_0x3d1a95=_0x3d1a95||0xc8;return function(_0x85eec){if(_0x85eec){return _0x79dd[_0xb9b9('0x6')](_0x3d1a95)[_0xb9b9('0x7')](_0x85eec);}return null;};}function handleError(_0x297cb6,_0x222cba){_0x222cba=_0x222cba||0x1f4;return function(_0x319bb8){logger['error'](_0x319bb8['stack']);if(_0x319bb8[_0xb9b9('0x8')]){delete _0x319bb8[_0xb9b9('0x8')];}_0x297cb6[_0xb9b9('0x6')](_0x222cba)['send'](_0x319bb8);};}function execChildProcess(){return new BPromise(function(_0x3949d0,_0x3b6bb9){exec(_0xb9b9('0x9'),function(_0x4d8856,_0x3430a6,_0x277d86){logger[_0xb9b9('0xa')](_0x3430a6);logger[_0xb9b9('0xa')](_0x277d86);if(_0x4d8856){logger[_0xb9b9('0xb')](_0x4d8856);return _0x3b6bb9(_0x4d8856);}return _0x3949d0(_0x3430a6);});});}exports[_0xb9b9('0xc')]=function(_0x5bd18c,_0x539449){return pm2[_0xb9b9('0xd')]()['then'](function(_0xe78d58){if(_0xe78d58){var _0x50e5d6=_[_0xb9b9('0xe')](_0xe78d58,function(_0x23bac9){return _0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0xf')||_0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0x10');});return{'rows':_0x50e5d6,'count':_0x50e5d6[_0xb9b9('0x11')]};}return null;})[_0xb9b9('0x12')](respondWithResult(_0x539449,null))['catch'](handleError(_0x539449,null));};exports[_0xb9b9('0x13')]=function(_0x48d9ae,_0x403a5b){return pm2[_0xb9b9('0x14')](_0x48d9ae[_0xb9b9('0x15')]['id'])[_0xb9b9('0x12')](respondWithResult(_0x403a5b,null))['then'](handleEntityNotFound(_0x403a5b,null))[_0xb9b9('0x16')](handleError(_0x403a5b,null));};exports[_0xb9b9('0x17')]=function(_0x398f3d,_0xb01198){if(_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')]&&_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]){var _0xb16391=path[_0xb9b9('0x1a')](__dirname,_0xb9b9('0x1b'),_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]);var _0x4e33a0=process[_0xb9b9('0x1c')]();process[_0xb9b9('0x1d')](path[_0xb9b9('0x1e')](_0xb16391));return execChildProcess()['then'](function(_0x9898bc){process[_0xb9b9('0x1d')](_0x4e33a0);return pm2['start']({'name':_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')],'script':_0xb16391});})[_0xb9b9('0x12')](function(_0x40b801){pm2[_0xb9b9('0x1f')]();return _0x40b801[0x0];})['then'](respondWithResult(_0xb01198,0xc9))['catch'](handleError(_0xb01198,null));}else{return _0xb01198[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb9b9('0x21')]=function(_0x134ed6,_0x20ffc1){if(_0x134ed6[_0xb9b9('0x18')]['id']){delete _0x134ed6[_0xb9b9('0x18')]['id'];}var _0x54bf18={'online':_0xb9b9('0x22'),'stopped':'stop'};if(_0x54bf18[_0xb9b9('0x23')](_0x134ed6[_0xb9b9('0x18')]['status'])){return pm2[_0x54bf18[_0x134ed6[_0xb9b9('0x18')][_0xb9b9('0x6')]]](_0x134ed6[_0xb9b9('0x15')]['id'])['then'](respondWithResult(_0x20ffc1,0xc8))[_0xb9b9('0x16')](handleError(_0x20ffc1,null));}else{return _0x20ffc1[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x24')});}};exports['destroy']=function(_0xc40dda,_0xdbc1f1){if(_0xc40dda['body']['id']){delete _0xc40dda[_0xb9b9('0x18')]['id'];}if(_0xc40dda[_0xb9b9('0x15')]['id']){return pm2[_0xb9b9('0x25')](_0xc40dda[_0xb9b9('0x15')]['id'])['then'](function(_0xd66ace){pm2[_0xb9b9('0x1f')]();return _0xd66ace[0x0];})[_0xb9b9('0x12')](respondWithResult(_0xdbc1f1,null))[_0xb9b9('0x16')](handleError(_0xdbc1f1,null));}else{return _0xdbc1f1['status'](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7c74898..d18d989 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 _0x14e1=['exports','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents','/queues'];(function(_0x48b185,_0x4664a0){var _0x3c832a=function(_0x73774d){while(--_0x73774d){_0x48b185['push'](_0x48b185['shift']());}};_0x3c832a(++_0x4664a0);}(_0x14e1,0x129));var _0x114e=function(_0x39b933,_0x7c9c8){_0x39b933=_0x39b933-0x0;var _0x445f14=_0x14e1[_0x39b933];return _0x445f14;};'use strict';var express=require('express');var router=express[_0x114e('0x0')]();var auth=require(_0x114e('0x1'));var controller=require(_0x114e('0x2'));router[_0x114e('0x3')]('/agents',auth[_0x114e('0x4')](),controller[_0x114e('0x5')]);router[_0x114e('0x3')](_0x114e('0x6'),auth[_0x114e('0x4')](),controller['getQueues']);module[_0x114e('0x7')]=router; \ No newline at end of file +var _0x695f=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getQueues','express','Router'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0x695f,0xb6));var _0xf695=function(_0x27693c,_0x1bdbc7){_0x27693c=_0x27693c-0x0;var _0x55366f=_0x695f[_0x27693c];return _0x55366f;};'use strict';var express=require(_0xf695('0x0'));var router=express[_0xf695('0x1')]();var auth=require(_0xf695('0x2'));var controller=require(_0xf695('0x3'));router[_0xf695('0x4')](_0xf695('0x5'),auth[_0xf695('0x6')](),controller['getAgents']);router[_0xf695('0x4')]('/queues',auth['isAuthenticated'](),controller[_0xf695('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 9659127..da84a43 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 _0x2eb2=['voice','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','agents','loggedInDb','waiting','talking','busy','merge','pick','filter','queue','length','connectedlinenum','internal','toString','find','getMembers','UserId','accountcode','online','voiceStatus','User','startCase','Pause','unknown','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','every','idle','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','lastLoginAt','lastPauseAt','pauseType','address','mailPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','type','query','role','getOptions','raw','user','agent','nolimit','sort','UserProfile','findAndCountAll','rows','omit','globalStatus','pauseTypeFilter','getQueues','mail','fax','whatsapp','Invalid\x20channel','key','Queues','getResources','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','set','Content-Range','error','stack','name','status','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x2eb2[_0x31cb5f];return _0x586042;};'use strict';var util=require('util');var _=require(_0x22eb('0x0'));var jayson=require(_0x22eb('0x1'));var qs=require(_0x22eb('0x2'));var logger=require(_0x22eb('0x3'))(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var amiClient=jayson['client'][_0x22eb('0x6')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x1dfef7,_0x10e116){return function(_0x35dd5b){if(_0x35dd5b){var _0x2a9850=typeof _0x10e116[_0x22eb('0x7')]===_0x22eb('0x8')&&typeof _0x10e116[_0x22eb('0x9')]===_0x22eb('0x8');var _0x419601=_0x35dd5b[_0x22eb('0xa')];var _0xb9c8a4=_0x2a9850?0x0:_0x10e116[_0x22eb('0x7')];var _0x489260=_0x2a9850?_0x35dd5b[_0x22eb('0xa')]:_0x10e116['offset']+_0x10e116['limit'];var _0x1aa348;if(_0x489260>=_0x419601){_0x489260=_0x419601;_0x1aa348=0xc8;}else{_0x1aa348=0xce;}_0x1dfef7['status'](_0x1aa348);return _0x1dfef7[_0x22eb('0xb')](_0x22eb('0xc'),_0xb9c8a4+'-'+_0x489260+'/'+_0x419601)['json'](_0x35dd5b);}return null;};}function handleError(_0x5068ea,_0x1f286c){_0x1f286c=_0x1f286c||0x1f4;return function(_0x189f05){logger[_0x22eb('0xd')](_0x189f05[_0x22eb('0xe')]);if(_0x189f05[_0x22eb('0xf')]){delete _0x189f05['name'];}_0x5068ea[_0x22eb('0x10')](_0x1f286c)['send'](_0x189f05);};}function getRealtimeAgents(){return new Promise(function(_0x1f5089,_0x55ede8){return amiClient[_0x22eb('0x11')](_0x22eb('0x12'),{})['then'](function(_0x48b63c){if(_0x48b63c['error'])throw new Error(_0x22eb('0x13'));var _0x5245fe=_0x48b63c['result'];return routingClient[_0x22eb('0x11')]('Agents',{})['then'](function(_0xb7a73a){if(_0xb7a73a[_0x22eb('0xd')])throw new Error(_0x22eb('0x14'));var _0x1ff041=_0xb7a73a[_0x22eb('0x15')];return _0x1f5089(_['merge']({},_0x5245fe,_0x1ff041));});})[_0x22eb('0x16')](function(_0x12bbd1){_0x55ede8(_0x12bbd1);});});}function getRealtimeQueues(_0x10d182,_0x410c25){return new Promise(function(_0x36be50,_0x517313){var _0x2eb115=_0x410c25===_0x22eb('0x17')?amiClient:routingClient;return _0x2eb115[_0x22eb('0x11')](_['startCase'](_0x410c25)+'Queues',_0x10d182)[_0x22eb('0x18')](function(_0x267d97){if(_0x267d97[_0x22eb('0xd')])throw new Error(util[_0x22eb('0x19')](_0x22eb('0x1a'),_0x410c25));return _0x36be50(_0x267d97[_0x22eb('0x15')]);})[_0x22eb('0x16')](function(_0x4e7e69){_0x517313(_0x4e7e69);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2e8f7c,_0x11edbd){return amiClient[_0x22eb('0x11')](_0x22eb('0x1b'),{})[_0x22eb('0x18')](function(_0x4da252){if(_0x4da252[_0x22eb('0xd')])throw new Error(_0x22eb('0x1c'));return _0x2e8f7c(_0x4da252[_0x22eb('0x15')]);})['catch'](function(_0xe0783c){_0x11edbd(_0xe0783c);});});}function initializeQueues(_0x259847,_0x4b409a,_0x32a4b6,_0x222ef3){var _0x1e3015=[_0x22eb('0x1d'),_0x22eb('0x1e'),'waiting','talking',_0x22eb('0x1f')];if(_0x32a4b6===_0x22eb('0x17')&&_0x222ef3===_0x22eb('0x20')){_0x1e3015[_0x22eb('0x21')](_0x22eb('0x22'),_0x22eb('0x23'),_0x22eb('0x24'),_0x22eb('0x25'),_0x22eb('0x26'),_0x22eb('0x27'),_0x22eb('0x28'),_0x22eb('0x29'),'erlangCalls',_0x22eb('0x2a'),'erlangAbandonmentRate',_0x22eb('0x2b'),_0x22eb('0x2c'),_0x22eb('0x2d'),_0x22eb('0x2e'),_0x22eb('0x2f'),_0x22eb('0x30'),_0x22eb('0x31'),_0x22eb('0x32'),_0x22eb('0x33'),_0x22eb('0x34'),'predictiveIntervalAvgTalktime');}return _0x259847['map'](function(_0x239a41){var _0x5ceec1=_0x239a41['get']({'plain':!![]});_0x5ceec1[_0x22eb('0x35')]=[];_0x5ceec1[_0x22eb('0x1f')]=0x0;_0x5ceec1[_0x22eb('0x36')]=0x0;_0x5ceec1[_0x22eb('0x1d')]=0x0;_0x5ceec1[_0x22eb('0x1e')]=0x0;_0x5ceec1[_0x22eb('0x37')]=0x0;if(_0x32a4b6===_0x22eb('0x17')){_0x5ceec1[_0x22eb('0x38')]=0x0;_0x5ceec1[_0x22eb('0x39')]=0x0;if(_0x222ef3===_0x22eb('0x20')){_0x5ceec1['pTalking']=0x0;_0x5ceec1[_0x22eb('0x23')]=0x0;}}var _0x47be01=_['find'](_0x4b409a,['id',_0x5ceec1['id']]);if(_0x47be01)_[_0x22eb('0x3a')](_0x5ceec1,_[_0x22eb('0x3b')](_0x47be01,_0x1e3015));return _0x5ceec1;});}function updateAgentVoiceStatus(_0x48e47e,_0x42e9bd,_0x121c04){var _0x236def=_[_0x22eb('0x3c')](_0x121c04,[_0x22eb('0x3d'),_0x42e9bd['name']]);if(_0x236def[_0x22eb('0x3e')]===0x0)return _0x48e47e[_0x22eb('0x39')]=!![];if(_['some'](_0x236def,[_0x22eb('0x3f'),_0x48e47e[_0x22eb('0x40')][_0x22eb('0x41')]()]))return _0x48e47e[_0x22eb('0x38')]=!![];if(!_0x48e47e[_0x22eb('0x38')])return _0x48e47e['busy']=!![];}function getVoiceQueueAgents(_0x51c8b5,_0x2b1ae1,_0x6cd651,_0x541153){var _0x595d76=_[_0x22eb('0x42')](_0x2b1ae1,['id',_0x51c8b5['id']]);if(!_0x595d76)return _0x51c8b5;return _0x595d76[_0x22eb('0x43')]({'raw':!![]})['then'](function(_0x1d977c){for(var _0x3377eb=0x0;_0x3377eb<_0x1d977c[_0x22eb('0x3e')];_0x3377eb++){var _0x2a8517=_[_0x22eb('0x42')](_0x6cd651,['id',_0x1d977c[_0x3377eb][_0x22eb('0x44')]]);if(!_0x2a8517){_0x2a8517={'id':_0x1d977c[_0x3377eb]['UserId'],'name':_0x1d977c[_0x3377eb][_0x22eb('0x44')],'accountcode':'','online':![]};}var _0x3d2d1d={'id':_0x2a8517['id'],'name':_0x2a8517['name'],'internal':_0x2a8517[_0x22eb('0x45')],'online':Boolean(_0x2a8517[_0x22eb('0x46')]),'paused':Boolean(_0x1d977c[_0x3377eb][_0x22eb('0x1f')])};if(_0x2a8517[_0x22eb('0x47')]===_0x22eb('0x38'))updateAgentVoiceStatus(_0x3d2d1d,_0x51c8b5,_0x541153);if(_0x3d2d1d[_0x22eb('0x46')])_0x51c8b5[_0x22eb('0x36')]++;if(_0x3d2d1d[_0x22eb('0x39')])_0x51c8b5[_0x22eb('0x39')]++;if(_0x3d2d1d[_0x22eb('0x1f')]&&!_0x3d2d1d[_0x22eb('0x39')]&&!_0x3d2d1d[_0x22eb('0x38')])_0x51c8b5[_0x22eb('0x1f')]++;_0x51c8b5[_0x22eb('0x35')][_0x22eb('0x21')](_0x3d2d1d);}return _0x51c8b5;});}function getQueueAgents(_0x471657,_0x6996b4,_0x46e3ec){var _0x507f21=_0x22eb('0x48')+_[_0x22eb('0x49')](_0x46e3ec)+'Queue';var _0x10462d=_0x46e3ec+_0x22eb('0x4a');return db[_0x507f21]['findAll']({'where':{[_['startCase'](_0x46e3ec)+'QueueId']:_0x471657['id']},'raw':!![]})[_0x22eb('0x18')](function(_0x1efc65){for(var _0x4e4c6d=0x0;_0x4e4c6d<_0x1efc65['length'];_0x4e4c6d++){var _0xa7c642=_[_0x22eb('0x42')](_0x6996b4,['id',_0x1efc65[_0x4e4c6d][_0x22eb('0x44')]]);if(!_0xa7c642){_0xa7c642={'id':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'name':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'online':![],['pauseField']:![]};}var _0x3b30a3={'id':_0xa7c642['id'],'name':_0xa7c642[_0x22eb('0xf')],'online':Boolean(_0xa7c642[_0x22eb('0x46')]),'paused':Boolean(_0xa7c642[_0x10462d])};if(_0x3b30a3['online'])_0x471657['loggedInDb']++;_0x471657[_0x22eb('0x35')]['push'](_0x3b30a3);}return _0x471657;});}function isIdle(_0x5e695c){return _0x5e695c==='idle'||_0x5e695c===_0x22eb('0x4b')||_0x5e695c==='unavailable'||_0x5e695c==='ringing'||_['isNil'](_0x5e695c);}function isAgentPaused(_0x517784,_0x36b174){var _0x4b5c03=[_0x517784[_0x22eb('0x4c')],_0x517784[_0x22eb('0x4d')],_0x517784['mailPause'],_0x517784[_0x22eb('0x4e')],_0x517784['smsPause'],_0x517784[_0x22eb('0x4f')],_0x517784[_0x22eb('0x50')]];if(!_0x36b174)return _[_0x22eb('0x51')](_0x4b5c03);var _0x111cbe=_[_0x22eb('0x3c')](_0x4b5c03);return _0x111cbe[_0x22eb('0x3e')]>0x0&&_0x111cbe[_0x22eb('0x3e')]<_0x4b5c03[_0x22eb('0x3e')]?!![]:![];}function isAgentIdle(_0x11942d){if(_0x11942d['voiceStatus']!==_0x22eb('0x52')&&_0x11942d[_0x22eb('0x4f')]){_0x11942d['voiceStatus']=_0x22eb('0x53');return![];}return _[_0x22eb('0x51')]([_0x11942d[_0x22eb('0x54')],_0x11942d[_0x22eb('0x55')],_0x11942d['mailStatus'],_0x11942d[_0x22eb('0x56')],_0x11942d[_0x22eb('0x57')],_0x11942d[_0x22eb('0x47')],_0x11942d[_0x22eb('0x58')]],isIdle);}function getAgentStatus(_0x447177){var _0x10393b='unknown';if(isAgentPaused(_0x447177))_0x10393b=_0x22eb('0x53');else if(isAgentPaused(_0x447177,!![]))_0x10393b='*pause';else if(isAgentIdle(_0x447177))_0x10393b=_0x22eb('0x52');else _0x10393b='busy';return _0x10393b;}exports[_0x22eb('0x59')]=function(_0x254b53,_0x4028ef){var _0x2c1b87={'count':0x0,'rows':[]},_0x3f03df={},_0x4aa0c5,_0x4896ed,_0xfbf2e7=['userpic',_0x22eb('0x46'),_0x22eb('0x5a'),_0x22eb('0x5b'),_0x22eb('0x5c'),_0x22eb('0x5b'),_0x22eb('0x40'),_0x22eb('0x5d'),_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),'whatsappPause',_0x22eb('0x4d'),_0x22eb('0x4f'),_0x22eb('0x60'),_0x22eb('0x61'),_0x22eb('0x62'),_0x22eb('0x63'),_0x22eb('0x64'),_0x22eb('0x65'),_0x22eb('0x66'),_0x22eb('0x67'),_0x22eb('0x68'),_0x22eb('0x69'),_0x22eb('0x6a'),_0x22eb('0x6b'),'chatStatus','openchannelStatus',_0x22eb('0x6c'),_0x22eb('0x57'),_0x22eb('0x58'),_0x22eb('0x55'),_0x22eb('0x47'),'chatStatusTime',_0x22eb('0x6d'),_0x22eb('0x6e'),'smsStatusTime','whatsappStatusTime',_0x22eb('0x6f'),_0x22eb('0x70'),_0x22eb('0x3d'),_0x22eb('0x71'),_0x22eb('0x72'),_0x22eb('0x73'),_0x22eb('0x74'),_0x22eb('0x75')],_0x8e3864=[_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),_0x22eb('0x50'),_0x22eb('0x4d'),'voicePause',_0x22eb('0x46')];Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){var _0x5dbc43=_[_0x22eb('0x77')](db['User'][_0x22eb('0x78')],function(_0x5347b4){return{'name':_0x5347b4[_0x22eb('0x79')],'type':_0x5347b4[_0x22eb('0x7a')]['key']};});_0x254b53[_0x22eb('0x7b')][_0x22eb('0x7c')]='agent';_0x254b53['query'][_0x22eb('0x46')]=!![];_0x3f03df=qs[_0x22eb('0x7d')](_0x5dbc43,_0x254b53);_0x3f03df[_0x22eb('0x7e')]=!![];if(_0x254b53[_0x22eb('0x7f')][_0x22eb('0x7c')]===_0x22eb('0x7f')){var _0x4f5eee={'params':{'id':_0x254b53[_0x22eb('0x7f')]['userProfileId']},'query':{'section':'Agents','role':_0x22eb('0x80'),'online':!![],'nolimit':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x81')],'sort':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x82')],'filter':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x3c')],'raw':!![]}};return db[_0x22eb('0x83')]['getResources'](_0x4f5eee);}return db['User'][_0x22eb('0x84')](_0x3f03df);})[_0x22eb('0x18')](function(_0x49f182){_0x2c1b87[_0x22eb('0xa')]=_0x49f182[_0x22eb('0xa')];_0x4aa0c5=_0x49f182[_0x22eb('0x85')];return getRealtimeAgents();})[_0x22eb('0x18')](function(_0x40faf6){_0x4896ed=_0x40faf6[_0x22eb('0x85')];return _0x4aa0c5['map'](function(_0x3dd49b){var _0x29d4a7=_[_0x22eb('0x42')](_0x4896ed,['id',_0x3dd49b['id']]);if(_0x29d4a7)_['merge'](_0x3dd49b,_['pick'](_[_0x22eb('0x86')](_0x29d4a7,_0x8e3864),_0xfbf2e7));_0x3dd49b[_0x22eb('0x87')]=getAgentStatus(_0x3dd49b);return _0x3dd49b;});})[_0x22eb('0x18')](function(_0x5ebeb5){if(_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']){var _0x1a305d=_[_0x22eb('0x3c')](_0x5ebeb5,[_0x22eb('0x87'),_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']]);if(_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]){_0x1a305d=_[_0x22eb('0x3c')](_0x1a305d,[_0x22eb('0x5c'),_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]]);}}_0x2c1b87[_0x22eb('0x85')]=_0x1a305d||_0x5ebeb5;return _0x2c1b87;})[_0x22eb('0x18')](respondWithFilteredResult(_0x4028ef,_0x3f03df))[_0x22eb('0x16')](handleError(_0x4028ef,null));};exports[_0x22eb('0x89')]=function(_0x14006f,_0x5b4e6a){var _0x1d0749=[_0x22eb('0x8a'),'chat','sms','openchannel',_0x22eb('0x8b'),_0x22eb('0x8c'),'voice'];var _0x10726f={'count':0x0,'rows':[]},_0x15e08a={},_0xe6e71d,_0x41c50e,_0x8cbc83,_0x4ab4f8,_0x5e01b5;Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){if(_0x14006f[_0x22eb('0x7b')]['channel']){if(!_['includes'](_0x1d0749,_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']()))throw new Error(_0x22eb('0x8d'));_0xe6e71d=_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']();}var _0x1e393a=_[_0x22eb('0x49')](_0xe6e71d)+'Queue';var _0x17f51b=_[_0x22eb('0x77')](db[_0x1e393a][_0x22eb('0x78')],function(_0x5823d0){return{'name':_0x5823d0[_0x22eb('0x79')],'type':_0x5823d0[_0x22eb('0x7a')][_0x22eb('0x8e')]};});_0x15e08a=qs[_0x22eb('0x7d')](_0x17f51b,_0x14006f);if(_0x14006f[_0x22eb('0x7f')]['role']===_0x22eb('0x7f')){var _0x2ecc24={'params':{'id':_0x14006f[_0x22eb('0x7f')]['userProfileId']},'query':{'section':_0xe6e71d==='voice'&&_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]===_0x22eb('0x20')?'QueueCampaigns':_[_0x22eb('0x49')](_0xe6e71d)+_0x22eb('0x8f'),'type':_0x14006f[_0x22eb('0x7b')]['type'],'nolimit':!![],'sort':_0x22eb('0xf'),'filter':_0x14006f['query']['filter']}};return db[_0x22eb('0x83')][_0x22eb('0x90')](_0x2ecc24);}return db[_0x1e393a][_0x22eb('0x84')](_0x15e08a);})['then'](function(_0x3fc402){_0x10726f[_0x22eb('0xa')]=_0x3fc402[_0x22eb('0xa')];_0x41c50e=_0x3fc402[_0x22eb('0x85')];return getRealtimeQueues(_0x14006f,_0xe6e71d);})[_0x22eb('0x18')](function(_0x545c0a){_0x4ab4f8=_0x545c0a[_0x22eb('0x85')];return getRealtimeAgents();})['then'](function(_0x36dde2){_0x8cbc83=_0x36dde2[_0x22eb('0x85')];if(_0xe6e71d!=_0x22eb('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0xe19621){_0x5e01b5=_0xe19621?_0xe19621[_0x22eb('0x85')]:[];return initializeQueues(_0x41c50e,_0x4ab4f8,_0xe6e71d,_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]);})[_0x22eb('0x18')](function(_0xeaf655){var _0x45b691=_0xeaf655[_0x22eb('0x77')](function(_0x1ef974){if(_0xe6e71d===_0x22eb('0x17'))return getVoiceQueueAgents(_0x1ef974,_0x41c50e,_0x8cbc83,_0x5e01b5);else return getQueueAgents(_0x1ef974,_0x8cbc83,_0xe6e71d);});return Promise[_0x22eb('0x91')](_0x45b691);})['then'](function(_0x30e721){_0x10726f[_0x22eb('0x85')]=_0x30e721;return _0x10726f;})[_0x22eb('0x18')](respondWithFilteredResult(_0x5b4e6a,_0x15e08a))[_0x22eb('0x16')](handleError(_0x5b4e6a,null));}; \ No newline at end of file +var _0x1cb9=['mailStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','type','key','query','role','getOptions','raw','user','agent','nolimit','sort','UserProfile','getResources','rows','pick','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','sms','openchannel','fax','toLowerCase','Invalid\x20channel','channel','userProfileId','outbound','QueueCampaigns','findAndCountAll','all','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','http','offset','limit','count','status','set','Content-Range','error','stack','name','then','result','Agents','catch','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','available','waiting','talking','paused','voice','push','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','pTalking','find','merge','length','some','connectedlinenum','toString','busy','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','agents','User','Pause','QueueId','idle','unknown','unavailable','ringing','chatPause','mailPause','whatsappPause','every','filter','voicePause','chatStatus','mailStatus','smsStatus','whatsappStatus','pause','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','internal','address','openchannelPause','smsPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','faxStatus'];(function(_0x1f9d51,_0x3d7473){var _0x331e64=function(_0x2b2690){while(--_0x2b2690){_0x1f9d51['push'](_0x1f9d51['shift']());}};_0x331e64(++_0x3d7473);}(_0x1cb9,0x14e));var _0x91cb=function(_0x63335b,_0x4efc59){_0x63335b=_0x63335b-0x0;var _0x48c8e4=_0x1cb9[_0x63335b];return _0x48c8e4;};'use strict';var util=require(_0x91cb('0x0'));var _=require('lodash');var jayson=require(_0x91cb('0x1'));var qs=require(_0x91cb('0x2'));var logger=require(_0x91cb('0x3'))(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x91cb('0x5')][_0x91cb('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0x91cb('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3640f9,_0x186dc3){return function(_0x28543e){if(_0x28543e){var _0x3b9d98=typeof _0x186dc3[_0x91cb('0x7')]==='undefined'&&typeof _0x186dc3[_0x91cb('0x8')]==='undefined';var _0x2fdfce=_0x28543e['count'];var _0xa43e7a=_0x3b9d98?0x0:_0x186dc3[_0x91cb('0x7')];var _0x45317f=_0x3b9d98?_0x28543e[_0x91cb('0x9')]:_0x186dc3[_0x91cb('0x7')]+_0x186dc3[_0x91cb('0x8')];var _0x21a0a5;if(_0x45317f>=_0x2fdfce){_0x45317f=_0x2fdfce;_0x21a0a5=0xc8;}else{_0x21a0a5=0xce;}_0x3640f9[_0x91cb('0xa')](_0x21a0a5);return _0x3640f9[_0x91cb('0xb')](_0x91cb('0xc'),_0xa43e7a+'-'+_0x45317f+'/'+_0x2fdfce)['json'](_0x28543e);}return null;};}function handleError(_0x3c1f56,_0x366f09){_0x366f09=_0x366f09||0x1f4;return function(_0x4ba2f2){logger[_0x91cb('0xd')](_0x4ba2f2[_0x91cb('0xe')]);if(_0x4ba2f2[_0x91cb('0xf')]){delete _0x4ba2f2[_0x91cb('0xf')];}_0x3c1f56['status'](_0x366f09)['send'](_0x4ba2f2);};}function getRealtimeAgents(){return new Promise(function(_0x4aae25,_0x3d22b7){return amiClient['request']('Agents',{})[_0x91cb('0x10')](function(_0xc3629e){if(_0xc3629e[_0x91cb('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x238f11=_0xc3629e[_0x91cb('0x11')];return routingClient['request'](_0x91cb('0x12'),{})[_0x91cb('0x10')](function(_0x1cd34b){if(_0x1cd34b[_0x91cb('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x3fba4f=_0x1cd34b[_0x91cb('0x11')];return _0x4aae25(_['merge']({},_0x238f11,_0x3fba4f));});})[_0x91cb('0x13')](function(_0x4c9fb2){_0x3d22b7(_0x4c9fb2);});});}function getRealtimeQueues(_0x55042a,_0x281ff3){return new Promise(function(_0x160ded,_0x56e409){var _0x51a1d5=_0x281ff3==='voice'?amiClient:routingClient;return _0x51a1d5[_0x91cb('0x14')](_[_0x91cb('0x15')](_0x281ff3)+_0x91cb('0x16'),_0x55042a)[_0x91cb('0x10')](function(_0x5c6a15){if(_0x5c6a15[_0x91cb('0xd')])throw new Error(util[_0x91cb('0x17')](_0x91cb('0x18'),_0x281ff3));return _0x160ded(_0x5c6a15['result']);})[_0x91cb('0x13')](function(_0x1a7a54){_0x56e409(_0x1a7a54);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2447e7,_0x422d14){return amiClient[_0x91cb('0x14')](_0x91cb('0x19'),{})[_0x91cb('0x10')](function(_0x423c4f){if(_0x423c4f[_0x91cb('0xd')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x2447e7(_0x423c4f['result']);})[_0x91cb('0x13')](function(_0x554350){_0x422d14(_0x554350);});});}function initializeQueues(_0x1c67d2,_0x34d372,_0x318031,_0x5595c5){var _0x9b26a6=['loggedIn',_0x91cb('0x1a'),_0x91cb('0x1b'),_0x91cb('0x1c'),_0x91cb('0x1d')];if(_0x318031===_0x91cb('0x1e')&&_0x5595c5==='outbound'){_0x9b26a6[_0x91cb('0x1f')]('pTalking',_0x91cb('0x20'),_0x91cb('0x21'),_0x91cb('0x22'),'dialMethod',_0x91cb('0x23'),_0x91cb('0x24'),_0x91cb('0x25'),_0x91cb('0x26'),_0x91cb('0x27'),_0x91cb('0x28'),_0x91cb('0x29'),_0x91cb('0x2a'),_0x91cb('0x2b'),'dialPredictiveIntervalMinThreshold',_0x91cb('0x2c'),_0x91cb('0x2d'),_0x91cb('0x2e'),_0x91cb('0x2f'),_0x91cb('0x30'),'predictiveIntervalAvgHoldtime',_0x91cb('0x31'));}return _0x1c67d2[_0x91cb('0x32')](function(_0x2e317c){var _0x46db02=_0x2e317c[_0x91cb('0x33')]({'plain':!![]});_0x46db02['agents']=[];_0x46db02[_0x91cb('0x1d')]=0x0;_0x46db02['loggedInDb']=0x0;_0x46db02['loggedIn']=0x0;_0x46db02['available']=0x0;_0x46db02[_0x91cb('0x1b')]=0x0;if(_0x318031==='voice'){_0x46db02[_0x91cb('0x1c')]=0x0;_0x46db02['busy']=0x0;if(_0x5595c5==='outbound'){_0x46db02[_0x91cb('0x34')]=0x0;_0x46db02[_0x91cb('0x20')]=0x0;}}var _0x1deabb=_[_0x91cb('0x35')](_0x34d372,['id',_0x46db02['id']]);if(_0x1deabb)_[_0x91cb('0x36')](_0x46db02,_['pick'](_0x1deabb,_0x9b26a6));return _0x46db02;});}function updateAgentVoiceStatus(_0x8beb3a,_0x3ddc0b,_0x13a5ea){var _0x8496a3=_['filter'](_0x13a5ea,['queue',_0x3ddc0b[_0x91cb('0xf')]]);if(_0x8496a3[_0x91cb('0x37')]===0x0)return _0x8beb3a['busy']=!![];if(_[_0x91cb('0x38')](_0x8496a3,[_0x91cb('0x39'),_0x8beb3a['internal'][_0x91cb('0x3a')]()]))return _0x8beb3a[_0x91cb('0x1c')]=!![];if(!_0x8beb3a['talking'])return _0x8beb3a[_0x91cb('0x3b')]=!![];}function getVoiceQueueAgents(_0x545687,_0x4117db,_0xabe6a3,_0x9de25d){var _0x279ad5=_[_0x91cb('0x35')](_0x4117db,['id',_0x545687['id']]);if(!_0x279ad5)return _0x545687;return _0x279ad5[_0x91cb('0x3c')]({'raw':!![]})['then'](function(_0xa90111){for(var _0x425fa4=0x0;_0x425fa4<_0xa90111['length'];_0x425fa4++){var _0x312581=_['find'](_0xabe6a3,['id',_0xa90111[_0x425fa4][_0x91cb('0x3d')]]);if(!_0x312581){_0x312581={'id':_0xa90111[_0x425fa4][_0x91cb('0x3d')],'name':_0xa90111[_0x425fa4][_0x91cb('0x3d')],'accountcode':'','online':![]};}var _0x174794={'id':_0x312581['id'],'name':_0x312581['name'],'internal':_0x312581[_0x91cb('0x3e')],'online':Boolean(_0x312581[_0x91cb('0x3f')]),'paused':Boolean(_0xa90111[_0x425fa4][_0x91cb('0x1d')])};if(_0x312581[_0x91cb('0x40')]===_0x91cb('0x1c'))updateAgentVoiceStatus(_0x174794,_0x545687,_0x9de25d);if(_0x174794[_0x91cb('0x3f')])_0x545687[_0x91cb('0x41')]++;if(_0x174794[_0x91cb('0x3b')])_0x545687[_0x91cb('0x3b')]++;if(_0x174794[_0x91cb('0x1d')]&&!_0x174794['busy']&&!_0x174794[_0x91cb('0x1c')])_0x545687['paused']++;_0x545687[_0x91cb('0x42')]['push'](_0x174794);}return _0x545687;});}function getQueueAgents(_0x335879,_0x52e82c,_0x138f48){var _0x477131=_0x91cb('0x43')+_[_0x91cb('0x15')](_0x138f48)+'Queue';var _0x2cdb61=_0x138f48+_0x91cb('0x44');return db[_0x477131]['findAll']({'where':{[_[_0x91cb('0x15')](_0x138f48)+_0x91cb('0x45')]:_0x335879['id']},'raw':!![]})[_0x91cb('0x10')](function(_0x32517d){for(var _0x267efb=0x0;_0x267efb<_0x32517d[_0x91cb('0x37')];_0x267efb++){var _0x17d319=_[_0x91cb('0x35')](_0x52e82c,['id',_0x32517d[_0x267efb][_0x91cb('0x3d')]]);if(!_0x17d319){_0x17d319={'id':_0x32517d[_0x267efb]['UserId'],'name':_0x32517d[_0x267efb][_0x91cb('0x3d')],'online':![],['pauseField']:![]};}var _0x3e20d1={'id':_0x17d319['id'],'name':_0x17d319[_0x91cb('0xf')],'online':Boolean(_0x17d319[_0x91cb('0x3f')]),'paused':Boolean(_0x17d319[_0x2cdb61])};if(_0x3e20d1[_0x91cb('0x3f')])_0x335879[_0x91cb('0x41')]++;_0x335879[_0x91cb('0x42')][_0x91cb('0x1f')](_0x3e20d1);}return _0x335879;});}function isIdle(_0x4830d3){return _0x4830d3===_0x91cb('0x46')||_0x4830d3===_0x91cb('0x47')||_0x4830d3===_0x91cb('0x48')||_0x4830d3===_0x91cb('0x49')||_['isNil'](_0x4830d3);}function isAgentPaused(_0x9dae06,_0x1aa461){var _0x4fad1b=[_0x9dae06[_0x91cb('0x4a')],_0x9dae06['faxPause'],_0x9dae06[_0x91cb('0x4b')],_0x9dae06['openchannelPause'],_0x9dae06['smsPause'],_0x9dae06['voicePause'],_0x9dae06[_0x91cb('0x4c')]];if(!_0x1aa461)return _[_0x91cb('0x4d')](_0x4fad1b);var _0x3d62c4=_[_0x91cb('0x4e')](_0x4fad1b);return _0x3d62c4[_0x91cb('0x37')]>0x0&&_0x3d62c4['length']<_0x4fad1b['length']?!![]:![];}function isAgentIdle(_0x1d26b8){if(_0x1d26b8[_0x91cb('0x40')]!==_0x91cb('0x46')&&_0x1d26b8[_0x91cb('0x4f')]){_0x1d26b8['voiceStatus']='pause';return![];}return _['every']([_0x1d26b8[_0x91cb('0x50')],_0x1d26b8['faxStatus'],_0x1d26b8[_0x91cb('0x51')],_0x1d26b8['openchannelStatus'],_0x1d26b8[_0x91cb('0x52')],_0x1d26b8[_0x91cb('0x40')],_0x1d26b8[_0x91cb('0x53')]],isIdle);}function getAgentStatus(_0x649976){var _0x1884bc=_0x91cb('0x47');if(isAgentPaused(_0x649976))_0x1884bc=_0x91cb('0x54');else if(isAgentPaused(_0x649976,!![]))_0x1884bc=_0x91cb('0x55');else if(isAgentIdle(_0x649976))_0x1884bc=_0x91cb('0x46');else _0x1884bc=_0x91cb('0x3b');return _0x1884bc;}exports[_0x91cb('0x56')]=function(_0x5752ed,_0x1e445a){var _0x1fa45a={'count':0x0,'rows':[]},_0x4d7a34={},_0x3f719b,_0x32fb40,_0x4bab7d=[_0x91cb('0x57'),_0x91cb('0x3f'),_0x91cb('0x58'),_0x91cb('0x59'),_0x91cb('0x5a'),_0x91cb('0x59'),_0x91cb('0x5b'),_0x91cb('0x5c'),_0x91cb('0x4a'),_0x91cb('0x5d'),'mailPause',_0x91cb('0x5e'),'whatsappPause',_0x91cb('0x5f'),'voicePause',_0x91cb('0x60'),_0x91cb('0x61'),_0x91cb('0x62'),'smsCapacity',_0x91cb('0x63'),_0x91cb('0x64'),'chatCurrentCapacity',_0x91cb('0x65'),_0x91cb('0x66'),_0x91cb('0x67'),_0x91cb('0x68'),'faxCurrentCapacity',_0x91cb('0x50'),_0x91cb('0x69'),_0x91cb('0x51'),_0x91cb('0x52'),'whatsappStatus',_0x91cb('0x6a'),_0x91cb('0x40'),'chatStatusTime','openchannelStatusTime',_0x91cb('0x6b'),'smsStatusTime',_0x91cb('0x6c'),_0x91cb('0x6d'),'voiceStatusTime','queue',_0x91cb('0x6e'),'screenrecording',_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x71')],_0x2f5311=['chatPause',_0x91cb('0x5d'),'mailPause',_0x91cb('0x5e'),_0x91cb('0x4c'),_0x91cb('0x5f'),_0x91cb('0x4f'),'online'];Promise[_0x91cb('0x72')]()[_0x91cb('0x10')](function(){var _0x1c8179=_[_0x91cb('0x32')](db[_0x91cb('0x43')][_0x91cb('0x73')],function(_0x14114d){return{'name':_0x14114d[_0x91cb('0x74')],'type':_0x14114d[_0x91cb('0x75')][_0x91cb('0x76')]};});_0x5752ed[_0x91cb('0x77')][_0x91cb('0x78')]='agent';_0x5752ed[_0x91cb('0x77')][_0x91cb('0x3f')]=!![];_0x4d7a34=qs[_0x91cb('0x79')](_0x1c8179,_0x5752ed);_0x4d7a34[_0x91cb('0x7a')]=!![];if(_0x5752ed[_0x91cb('0x7b')][_0x91cb('0x78')]===_0x91cb('0x7b')){var _0x47bd4d={'params':{'id':_0x5752ed[_0x91cb('0x7b')]['userProfileId']},'query':{'section':_0x91cb('0x12'),'role':_0x91cb('0x7c'),'online':!![],'nolimit':_0x5752ed[_0x91cb('0x77')][_0x91cb('0x7d')],'sort':_0x5752ed['query'][_0x91cb('0x7e')],'filter':_0x5752ed[_0x91cb('0x77')][_0x91cb('0x4e')],'raw':!![]}};return db[_0x91cb('0x7f')][_0x91cb('0x80')](_0x47bd4d);}return db[_0x91cb('0x43')]['findAndCountAll'](_0x4d7a34);})[_0x91cb('0x10')](function(_0x28bfe5){_0x1fa45a[_0x91cb('0x9')]=_0x28bfe5[_0x91cb('0x9')];_0x3f719b=_0x28bfe5[_0x91cb('0x81')];return getRealtimeAgents();})[_0x91cb('0x10')](function(_0x18b812){_0x32fb40=_0x18b812[_0x91cb('0x81')];return _0x3f719b[_0x91cb('0x32')](function(_0x457f81){var _0x1347df=_[_0x91cb('0x35')](_0x32fb40,['id',_0x457f81['id']]);if(_0x1347df)_[_0x91cb('0x36')](_0x457f81,_[_0x91cb('0x82')](_[_0x91cb('0x83')](_0x1347df,_0x2f5311),_0x4bab7d));_0x457f81[_0x91cb('0x84')]=getAgentStatus(_0x457f81);return _0x457f81;});})[_0x91cb('0x10')](function(_0x4866aa){if(_0x5752ed[_0x91cb('0x77')][_0x91cb('0x85')]){var _0x4b639d=_[_0x91cb('0x4e')](_0x4866aa,[_0x91cb('0x84'),_0x5752ed[_0x91cb('0x77')]['globalStatusFilter']]);if(_0x5752ed[_0x91cb('0x77')][_0x91cb('0x86')]){_0x4b639d=_['filter'](_0x4b639d,['pauseType',_0x5752ed[_0x91cb('0x77')]['pauseTypeFilter']]);}}_0x1fa45a[_0x91cb('0x81')]=_0x4b639d||_0x4866aa;return _0x1fa45a;})[_0x91cb('0x10')](respondWithFilteredResult(_0x1e445a,_0x4d7a34))['catch'](handleError(_0x1e445a,null));};exports[_0x91cb('0x87')]=function(_0x4ad2ea,_0x2c44ca){var _0x73febc=['mail','chat',_0x91cb('0x88'),_0x91cb('0x89'),_0x91cb('0x8a'),'whatsapp',_0x91cb('0x1e')];var _0x23a458={'count':0x0,'rows':[]},_0x98fb94={},_0x127b93,_0x570f6b,_0x440209,_0x4ee1e3,_0x342587;Promise[_0x91cb('0x72')]()[_0x91cb('0x10')](function(){if(_0x4ad2ea[_0x91cb('0x77')]['channel']){if(!_['includes'](_0x73febc,_0x4ad2ea[_0x91cb('0x77')]['channel'][_0x91cb('0x8b')]()))throw new Error(_0x91cb('0x8c'));_0x127b93=_0x4ad2ea[_0x91cb('0x77')][_0x91cb('0x8d')][_0x91cb('0x8b')]();}var _0x46874e=_[_0x91cb('0x15')](_0x127b93)+'Queue';var _0xcf93d0=_[_0x91cb('0x32')](db[_0x46874e]['rawAttributes'],function(_0x10ec48){return{'name':_0x10ec48['fieldName'],'type':_0x10ec48[_0x91cb('0x75')][_0x91cb('0x76')]};});_0x98fb94=qs[_0x91cb('0x79')](_0xcf93d0,_0x4ad2ea);if(_0x4ad2ea[_0x91cb('0x7b')][_0x91cb('0x78')]===_0x91cb('0x7b')){var _0x1459c4={'params':{'id':_0x4ad2ea[_0x91cb('0x7b')][_0x91cb('0x8e')]},'query':{'section':_0x127b93===_0x91cb('0x1e')&&_0x4ad2ea[_0x91cb('0x77')][_0x91cb('0x75')]===_0x91cb('0x8f')?_0x91cb('0x90'):_[_0x91cb('0x15')](_0x127b93)+_0x91cb('0x16'),'type':_0x4ad2ea['query'][_0x91cb('0x75')],'nolimit':!![],'sort':'name','filter':_0x4ad2ea[_0x91cb('0x77')][_0x91cb('0x4e')]}};return db[_0x91cb('0x7f')][_0x91cb('0x80')](_0x1459c4);}return db[_0x46874e][_0x91cb('0x91')](_0x98fb94);})[_0x91cb('0x10')](function(_0x324bdb){_0x23a458[_0x91cb('0x9')]=_0x324bdb['count'];_0x570f6b=_0x324bdb[_0x91cb('0x81')];return getRealtimeQueues(_0x4ad2ea,_0x127b93);})[_0x91cb('0x10')](function(_0x59defe){_0x4ee1e3=_0x59defe['rows'];return getRealtimeAgents();})[_0x91cb('0x10')](function(_0x4dfa8b){_0x440209=_0x4dfa8b['rows'];if(_0x127b93!=_0x91cb('0x1e'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x3cb938){_0x342587=_0x3cb938?_0x3cb938['rows']:[];return initializeQueues(_0x570f6b,_0x4ee1e3,_0x127b93,_0x4ad2ea[_0x91cb('0x77')][_0x91cb('0x75')]);})[_0x91cb('0x10')](function(_0x443c01){var _0x4e899c=_0x443c01[_0x91cb('0x32')](function(_0x1b5137){if(_0x127b93===_0x91cb('0x1e'))return getVoiceQueueAgents(_0x1b5137,_0x570f6b,_0x440209,_0x342587);else return getQueueAgents(_0x1b5137,_0x440209,_0x127b93);});return Promise[_0x91cb('0x92')](_0x4e899c);})[_0x91cb('0x10')](function(_0x22f871){_0x23a458[_0x91cb('0x81')]=_0x22f871;return _0x23a458;})[_0x91cb('0x10')](respondWithFilteredResult(_0x2c44ca,_0x98fb94))[_0x91cb('0x13')](handleError(_0x2c44ca,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4895b58..18bc41c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3677b4,_0x22651e){var _0x4636de=function(_0xe324d0){while(--_0xe324d0){_0x3677b4['push'](_0x3677b4['shift']());}};_0x4636de(++_0x22651e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51942a,_0x3bd294){var _0x2ad705=function(_0x111eaf){while(--_0x111eaf){_0x51942a['push'](_0x51942a['shift']());}};_0x2ad705(++_0x3bd294);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2961d92..88679d4 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 _0x82f8=['INTEGER','DATE','STRING','exports'];(function(_0x9683dd,_0x334a98){var _0x42758e=function(_0x5e3961){while(--_0x5e3961){_0x9683dd['push'](_0x9683dd['shift']());}};_0x42758e(++_0x334a98);}(_0x82f8,0x157));var _0x882f=function(_0x4de94e,_0x473230){_0x4de94e=_0x4de94e-0x0;var _0x452fb8=_0x82f8[_0x4de94e];return _0x452fb8;};'use strict';var Sequelize=require('sequelize');module[_0x882f('0x0')]={'state':{'type':Sequelize[_0x882f('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x882f('0x2')]},'uniqueid':{'type':Sequelize[_0x882f('0x3')]},'starttime':{'type':Sequelize[_0x882f('0x2')]},'responsetime':{'type':Sequelize[_0x882f('0x2')]},'ringtime':{'type':Sequelize[_0x882f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x882f('0x3')]},'campaigntype':{'type':Sequelize[_0x882f('0x3')]},'membername':{'type':Sequelize[_0x882f('0x3')]}}; \ No newline at end of file +var _0xa280=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa280,0xc4));var _0x0a28=function(_0x1e2bda,_0x432fdf){_0x1e2bda=_0x1e2bda-0x0;var _0x5b7278=_0xa280[_0x1e2bda];return _0x5b7278;};'use strict';var Sequelize=require(_0x0a28('0x0'));module[_0x0a28('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0a28('0x2')]},'scheduledat':{'type':Sequelize[_0x0a28('0x3')]},'uniqueid':{'type':Sequelize[_0x0a28('0x2')]},'starttime':{'type':Sequelize[_0x0a28('0x3')]},'responsetime':{'type':Sequelize[_0x0a28('0x3')]},'ringtime':{'type':Sequelize[_0x0a28('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0a28('0x2')]},'campaigntype':{'type':Sequelize[_0x0a28('0x2')]},'membername':{'type':Sequelize[_0x0a28('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 628eb76..56efe56 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 _0x0643=['../../config/logger','moment','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','util'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0x0643,0x1af));var _0x3064=function(_0x36029c,_0x392087){_0x36029c=_0x36029c-0x0;var _0xd82b6=_0x0643[_0x36029c];return _0xd82b6;};'use strict';var _=require('lodash');var util=require(_0x3064('0x0'));var logger=require(_0x3064('0x1'))('api');var moment=require(_0x3064('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3064('0x3'));var rimraf=require('rimraf');var config=require(_0x3064('0x4'));var attributes=require(_0x3064('0x5'));module['exports']=function(_0x31657c,_0x7217b4){return _0x31657c['define'](_0x3064('0x6'),attributes,{'tableName':_0x3064('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1829=['rimraf','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','api','moment','request-promise'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x1829,0x159));var _0x9182=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1829[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9182('0x0'));var util=require(_0x9182('0x1'));var logger=require('../../config/logger')(_0x9182('0x2'));var moment=require(_0x9182('0x3'));var BPromise=require('bluebird');var rp=require(_0x9182('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9182('0x5'));var config=require('../../config/environment');var attributes=require(_0x9182('0x6'));module[_0x9182('0x7')]=function(_0x4c31d0,_0xef1f35){return _0x4c31d0[_0x9182('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x9182('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 c4e7ea8..df02bc3 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 _0x1a6b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','code','error','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','create','stringify','lodash','util'];(function(_0x3eca70,_0x491b92){var _0x242de7=function(_0x101925){while(--_0x101925){_0x3eca70['push'](_0x3eca70['shift']());}};_0x242de7(++_0x491b92);}(_0x1a6b,0x94));var _0xb1a6=function(_0x4d798a,_0x422042){_0x4d798a=_0x4d798a-0x0;var _0x475310=_0x1a6b[_0x4d798a];return _0x475310;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var moment=require(_0xb1a6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1a6('0x3'));var fs=require('fs');var Redis=require(_0xb1a6('0x4'));var db=require(_0xb1a6('0x5'))['db'];var utils=require(_0xb1a6('0x6'));var logger=require('../../config/logger')(_0xb1a6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1a6('0x8'));var client=jayson[_0xb1a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcef30f,_0x47acc5,_0x2c3e2e){return new BPromise(function(_0x1ff4f9,_0x498095){return client[_0xb1a6('0xa')](_0xcef30f,_0x2c3e2e)[_0xb1a6('0xb')](function(_0x433d5c){logger[_0xb1a6('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x47acc5,_0xb1a6('0xd'));logger[_0xb1a6('0xe')](_0xb1a6('0xf'),_0x47acc5,'request\x20sent',JSON['stringify'](_0x433d5c));if(_0x433d5c['error']){if(_0x433d5c['error'][_0xb1a6('0x10')]===0x1f4){logger[_0xb1a6('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x47acc5,_0x433d5c[_0xb1a6('0x11')]['message']);return _0x498095(_0x433d5c['error'][_0xb1a6('0x12')]);}logger['error'](_0xb1a6('0x13'),_0x47acc5,_0x433d5c['error'][_0xb1a6('0x12')]);return _0x1ff4f9(_0x433d5c[_0xb1a6('0x11')][_0xb1a6('0x12')]);}else{logger['info'](_0xb1a6('0x13'),_0x47acc5,'request\x20sent');_0x1ff4f9(_0x433d5c[_0xb1a6('0x14')]['message']);}})[_0xb1a6('0x15')](function(_0x4e3018){logger[_0xb1a6('0x11')](_0xb1a6('0x13'),_0x47acc5,_0x4e3018);_0x498095(_0x4e3018);});});}exports[_0xb1a6('0x16')]=function(_0x3b4711){var _0x3d2f5f=this;return new Promise(function(_0x3e2d29,_0x1a3af3){return db['ReportAgentPreview'][_0xb1a6('0x17')](_0x3b4711['body'],{'raw':_0x3b4711['options']?_0x3b4711['options']['raw']===undefined?!![]:![]:!![]})[_0xb1a6('0xb')](function(_0x155a30){logger[_0xb1a6('0xc')]('CreateReportAgentPreview',_0x3b4711);logger[_0xb1a6('0xe')](_0xb1a6('0x16'),_0x3b4711,JSON[_0xb1a6('0x18')](_0x155a30));_0x3e2d29(_0x155a30);})['catch'](function(_0x4daf67){logger['error'](_0xb1a6('0x16'),_0x4daf67['message'],_0x3b4711);_0x1a3af3(_0x3d2f5f[_0xb1a6('0x11')](0x1f4,_0x4daf67[_0xb1a6('0x12')]));});});}; \ No newline at end of file +var _0x9547=['http','request','then','info','request\x20sent','debug','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x11ea11,_0x2fb490){var _0x568fd5=function(_0x337642){while(--_0x337642){_0x11ea11['push'](_0x11ea11['shift']());}};_0x568fd5(++_0x2fb490);}(_0x9547,0xd9));var _0x7954=function(_0xa57abd,_0xd091a1){_0xa57abd=_0xa57abd-0x0;var _0x160009=_0x9547[_0xa57abd];return _0x160009;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7954('0x0'));var BPromise=require(_0x7954('0x1'));var rs=require(_0x7954('0x2'));var fs=require('fs');var Redis=require(_0x7954('0x3'));var db=require(_0x7954('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7954('0x5'))(_0x7954('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7954('0x7')][_0x7954('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe9080b,_0x2daa56,_0x3effaa){return new BPromise(function(_0x333275,_0x27f9a7){return client[_0x7954('0x9')](_0xe9080b,_0x3effaa)[_0x7954('0xa')](function(_0x515248){logger[_0x7954('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x2daa56,_0x7954('0xc'));logger[_0x7954('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2daa56,_0x7954('0xc'),JSON['stringify'](_0x515248));if(_0x515248[_0x7954('0xe')]){if(_0x515248['error'][_0x7954('0xf')]===0x1f4){logger[_0x7954('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x2daa56,_0x515248['error'][_0x7954('0x10')]);return _0x27f9a7(_0x515248[_0x7954('0xe')][_0x7954('0x10')]);}logger['error'](_0x7954('0x11'),_0x2daa56,_0x515248[_0x7954('0xe')][_0x7954('0x10')]);return _0x333275(_0x515248['error'][_0x7954('0x10')]);}else{logger[_0x7954('0xb')](_0x7954('0x11'),_0x2daa56,_0x7954('0xc'));_0x333275(_0x515248[_0x7954('0x12')]['message']);}})[_0x7954('0x13')](function(_0xebf8ff){logger[_0x7954('0xe')](_0x7954('0x11'),_0x2daa56,_0xebf8ff);_0x27f9a7(_0xebf8ff);});});}exports[_0x7954('0x14')]=function(_0x4173ff){var _0x4ea9ba=this;return new Promise(function(_0x4353bb,_0x215124){return db[_0x7954('0x15')][_0x7954('0x16')](_0x4173ff['body'],{'raw':_0x4173ff[_0x7954('0x17')]?_0x4173ff[_0x7954('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7954('0xa')](function(_0x262aec){logger[_0x7954('0xb')](_0x7954('0x14'),_0x4173ff);logger['debug'](_0x7954('0x14'),_0x4173ff,JSON[_0x7954('0x18')](_0x262aec));_0x4353bb(_0x262aec);})[_0x7954('0x13')](function(_0x28e42e){logger['error'](_0x7954('0x14'),_0x28e42e[_0x7954('0x10')],_0x4173ff);_0x215124(_0x4ea9ba[_0x7954('0xe')](0x1f4,_0x28e42e[_0x7954('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index fe13093..0bc69e8 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 _0x2a78=['/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues'];(function(_0x2be6ab,_0x215ff7){var _0x253862=function(_0x1e853a){while(--_0x1e853a){_0x2be6ab['push'](_0x2be6ab['shift']());}};_0x253862(++_0x215ff7);}(_0x2a78,0x1e7));var _0x82a7=function(_0x4fc22b,_0x409a04){_0x4fc22b=_0x4fc22b-0x0;var _0x5cd908=_0x2a78[_0x4fc22b];return _0x5cd908;};'use strict';var multer=require(_0x82a7('0x0'));var util=require(_0x82a7('0x1'));var path=require('path');var express=require(_0x82a7('0x2'));var router=express[_0x82a7('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x82a7('0x4'));router['get'](_0x82a7('0x5'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x7')]);router['get'](_0x82a7('0x8'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x9')]);router[_0x82a7('0xa')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x82a7('0xb')]);router[_0x82a7('0xa')](_0x82a7('0xc'),auth['isAuthenticated'](),controller[_0x82a7('0xd')]);router['get'](_0x82a7('0xe'),auth[_0x82a7('0x6')](),controller[_0x82a7('0xf')]);router[_0x82a7('0xa')](_0x82a7('0x10'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x11')]);router['get'](_0x82a7('0x12'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x13')]);router[_0x82a7('0xa')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x82a7('0x14')]);router[_0x82a7('0xa')](_0x82a7('0x15'),auth['isAuthenticated'](),controller[_0x82a7('0x16')]);router[_0x82a7('0xa')](_0x82a7('0x17'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x18')]);router[_0x82a7('0xa')](_0x82a7('0x19'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x1a')]);router[_0x82a7('0xa')](_0x82a7('0x1b'),auth['isAuthenticated'](),controller[_0x82a7('0x1c')]);router[_0x82a7('0xa')]('/voice/queues/channels',auth[_0x82a7('0x6')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x82a7('0x6')](),controller[_0x82a7('0x1d')]);router[_0x82a7('0xa')](_0x82a7('0x1e'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x1f')]);router[_0x82a7('0xa')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x82a7('0x6')](),controller[_0x82a7('0x20')]);router['get']('/voice/queues/:id',auth[_0x82a7('0x6')](),controller['showVoiceQueues']);router[_0x82a7('0x21')](_0x82a7('0x22'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x23')]);router['get'](_0x82a7('0x24'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x25')]);router[_0x82a7('0xa')]('/outbound/channels',auth[_0x82a7('0x6')](),controller['outboundChannels']);router[_0x82a7('0xa')](_0x82a7('0x26'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x27')]);router[_0x82a7('0x21')](_0x82a7('0x28'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x29')]);router[_0x82a7('0xa')](_0x82a7('0x2a'),auth[_0x82a7('0x6')](),controller['telephones']);router[_0x82a7('0xa')](_0x82a7('0x2b'),auth[_0x82a7('0x6')](),controller['trunks']);router[_0x82a7('0xa')](_0x82a7('0x2c'),auth[_0x82a7('0x6')](),controller['campaigns']);router['get'](_0x82a7('0x2d'),auth['isAuthenticated'](),controller[_0x82a7('0x2e')]);router[_0x82a7('0xa')](_0x82a7('0x2f'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x30')]);router[_0x82a7('0xa')](_0x82a7('0x31'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x32')]);router[_0x82a7('0xa')](_0x82a7('0x33'),auth[_0x82a7('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x82a7('0x34'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x35')]);router['get']('/sms/queues/waitinginteractions',auth[_0x82a7('0x6')](),controller[_0x82a7('0x36')]);router[_0x82a7('0xa')](_0x82a7('0x37'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x38')]);router[_0x82a7('0xa')](_0x82a7('0x39'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x3a')]);router['post'](_0x82a7('0x3b'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x3c')]('mail'));router[_0x82a7('0xa')](_0x82a7('0x3d'),auth['isAuthenticated'](),controller[_0x82a7('0x3e')]);router[_0x82a7('0x3f')](_0x82a7('0x40'),auth['isAuthenticated'](),controller[_0x82a7('0x3c')](_0x82a7('0x41')));router[_0x82a7('0xa')]('/chat/queues/:id',auth[_0x82a7('0x6')](),controller[_0x82a7('0x42')]);router['post'](_0x82a7('0x43'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x3c')]('fax'));router[_0x82a7('0xa')](_0x82a7('0x44'),auth[_0x82a7('0x6')](),controller['showFaxQueues']);router[_0x82a7('0x3f')](_0x82a7('0x45'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x3c')](_0x82a7('0x46')));router[_0x82a7('0xa')](_0x82a7('0x47'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x48')]);router[_0x82a7('0x3f')](_0x82a7('0x49'),auth[_0x82a7('0x6')](),controller[_0x82a7('0x3c')](_0x82a7('0x4a')));router[_0x82a7('0x3f')]('/whatsapp/queues/:id/notify',auth[_0x82a7('0x6')](),controller[_0x82a7('0x3c')](_0x82a7('0x4b')));router[_0x82a7('0xa')]('/sms/queues/:id',auth[_0x82a7('0x6')](),controller[_0x82a7('0x4c')]);router[_0x82a7('0xa')]('/whatsapp/queues/:id',auth[_0x82a7('0x6')](),controller[_0x82a7('0x4d')]);router[_0x82a7('0x3f')]('/agents/:id/notify',auth[_0x82a7('0x6')](),controller[_0x82a7('0x4e')]);module[_0x82a7('0x4f')]=router; \ No newline at end of file +var _0x13ac=['/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues'];(function(_0x3c86b4,_0x431782){var _0x268334=function(_0x77a2cc){while(--_0x77a2cc){_0x3c86b4['push'](_0x3c86b4['shift']());}};_0x268334(++_0x431782);}(_0x13ac,0xfa));var _0xc13a=function(_0x3e12ef,_0x4350f0){_0x3e12ef=_0x3e12ef-0x0;var _0x1f895f=_0x13ac[_0x3e12ef];return _0x1f895f;};'use strict';var multer=require(_0xc13a('0x0'));var util=require(_0xc13a('0x1'));var path=require('path');var express=require(_0xc13a('0x2'));var router=express[_0xc13a('0x3')]();var auth=require(_0xc13a('0x4'));var controller=require(_0xc13a('0x5'));router[_0xc13a('0x6')]('/voice/channels',auth[_0xc13a('0x7')](),controller[_0xc13a('0x8')]);router[_0xc13a('0x6')](_0xc13a('0x9'),auth[_0xc13a('0x7')](),controller[_0xc13a('0xa')]);router[_0xc13a('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xc13a('0x7')](),controller[_0xc13a('0xb')]);router[_0xc13a('0x6')](_0xc13a('0xc'),auth[_0xc13a('0x7')](),controller[_0xc13a('0xd')]);router[_0xc13a('0x6')](_0xc13a('0xe'),auth[_0xc13a('0x7')](),controller[_0xc13a('0xf')]);router[_0xc13a('0x6')](_0xc13a('0x10'),auth['isAuthenticated'](),controller[_0xc13a('0x11')]);router[_0xc13a('0x6')]('/mail/accounts',auth[_0xc13a('0x7')](),controller[_0xc13a('0x12')]);router[_0xc13a('0x6')]('/openchannel/queues',auth[_0xc13a('0x7')](),controller['openchannelQueues']);router[_0xc13a('0x6')]('/sms/queues',auth[_0xc13a('0x7')](),controller[_0xc13a('0x13')]);router[_0xc13a('0x6')]('/whatsapp/queues',auth[_0xc13a('0x7')](),controller[_0xc13a('0x14')]);router[_0xc13a('0x6')](_0xc13a('0x15'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x16')]);router[_0xc13a('0x6')](_0xc13a('0x17'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x18')]);router[_0xc13a('0x6')](_0xc13a('0x19'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x1a')]);router[_0xc13a('0x6')](_0xc13a('0x1b'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x1c')]);router[_0xc13a('0x6')](_0xc13a('0x1d'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x1e')]);router[_0xc13a('0x6')](_0xc13a('0x1f'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x20')]);router[_0xc13a('0x6')](_0xc13a('0x21'),auth[_0xc13a('0x7')](),controller['showVoiceQueues']);router['put'](_0xc13a('0x21'),auth['isAuthenticated'](),controller[_0xc13a('0x22')]);router['get'](_0xc13a('0x23'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x24')]);router[_0xc13a('0x6')]('/outbound/channels',auth[_0xc13a('0x7')](),controller['outboundChannels']);router[_0xc13a('0x6')](_0xc13a('0x25'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x26')]);router['put'](_0xc13a('0x27'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x28')]);router[_0xc13a('0x6')](_0xc13a('0x29'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x2a')]);router[_0xc13a('0x6')](_0xc13a('0x2b'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x2c')]);router[_0xc13a('0x6')]('/campaigns',auth[_0xc13a('0x7')](),controller[_0xc13a('0x2d')]);router[_0xc13a('0x6')]('/fax/accounts',auth[_0xc13a('0x7')](),controller['faxAccounts']);router['get'](_0xc13a('0x2e'),auth['isAuthenticated'](),controller[_0xc13a('0x2f')]);router[_0xc13a('0x6')]('/mail/queues/waitinginteractions',auth[_0xc13a('0x7')](),controller[_0xc13a('0x30')]);router[_0xc13a('0x6')](_0xc13a('0x31'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x32')]);router[_0xc13a('0x6')](_0xc13a('0x33'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x34')]);router[_0xc13a('0x6')](_0xc13a('0x35'),auth['isAuthenticated'](),controller[_0xc13a('0x36')]);router[_0xc13a('0x6')](_0xc13a('0x37'),auth[_0xc13a('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xc13a('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc13a('0x38')]);router[_0xc13a('0x39')](_0xc13a('0x3a'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x3b')]('mail'));router[_0xc13a('0x6')](_0xc13a('0x3c'),auth['isAuthenticated'](),controller[_0xc13a('0x3d')]);router['post'](_0xc13a('0x3e'),auth[_0xc13a('0x7')](),controller['queueNotify'](_0xc13a('0x3f')));router[_0xc13a('0x6')]('/chat/queues/:id',auth[_0xc13a('0x7')](),controller[_0xc13a('0x40')]);router[_0xc13a('0x39')](_0xc13a('0x41'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x3b')]('fax'));router[_0xc13a('0x6')]('/fax/queues/:id',auth[_0xc13a('0x7')](),controller[_0xc13a('0x42')]);router['post'](_0xc13a('0x43'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x3b')](_0xc13a('0x44')));router[_0xc13a('0x6')]('/openchannel/queues/:id',auth[_0xc13a('0x7')](),controller[_0xc13a('0x45')]);router[_0xc13a('0x39')](_0xc13a('0x46'),auth['isAuthenticated'](),controller[_0xc13a('0x3b')](_0xc13a('0x47')));router[_0xc13a('0x39')](_0xc13a('0x48'),auth[_0xc13a('0x7')](),controller['queueNotify'](_0xc13a('0x49')));router['get'](_0xc13a('0x4a'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x4b')]);router[_0xc13a('0x6')](_0xc13a('0x4c'),auth[_0xc13a('0x7')](),controller[_0xc13a('0x4d')]);router['post'](_0xc13a('0x4e'),auth[_0xc13a('0x7')](),controller['agentNotify']);module[_0xc13a('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index dfad1a4..21a2fb8 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 _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x1348df,_0x4124ef){var _0x44f99b=function(_0x2d0169){while(--_0x2d0169){_0x1348df['push'](_0x1348df['shift']());}};_0x44f99b(++_0x4124ef);}(_0x2d17,0x17e));var _0x72d1=function(_0x563451,_0x225bca){_0x563451=_0x563451-0x0;var _0x43f99e=_0x2d17[_0x563451];return _0x43f99e;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));}; \ No newline at end of file +var _0x1cb9=['query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','agent','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','merge'];(function(_0x449216,_0x33b40f){var _0x23443c=function(_0x42be42){while(--_0x42be42){_0x449216['push'](_0x449216['shift']());}};_0x23443c(++_0x33b40f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2905dd,_0x1a93c5){_0x2905dd=_0x2905dd-0x0;var _0x438692=_0x1cb9[_0x2905dd];return _0x438692;};'use strict';var BPromise=require(_0x91cb('0x0'));var moment=require('moment');var _=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var db=require(_0x91cb('0x3'))['db'];var logger=require(_0x91cb('0x4'))('api');var jayson=require(_0x91cb('0x5'));var amiClient=jayson[_0x91cb('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232b});var routingClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){var _0x2fdfce=_0x4c1f56?_0x4c1f56:amiClient;return _0x2fdfce['request'](_0x3b9d98,_0x8f8a3b)[_0x91cb('0x8')](function(_0x317df0){if(_0x317df0[_0x91cb('0x9')]){if(_0x317df0[_0x91cb('0x9')][_0x91cb('0xa')]===0x1f4){return _0x5bda2f(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}return _0x15c517(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}else{_0x15c517(_0x317df0[_0x91cb('0xc')]);}})['catch'](function(_0x3c1f56){_0x5bda2f(_0x3c1f56);});});}function respondWithResult(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xc8;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0xd')](_0x4ba2f2)[_0x91cb('0xe')](_0x20e6e0);}return _0x366f09[_0x91cb('0xf')](0x194);};}function handleError(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0x1f4;return function(_0x4aae25){logger[_0x91cb('0x9')](_0x4aae25['stack']);if(_0x4aae25['name']){delete _0x4aae25[_0x91cb('0x10')];}_0x4a7d45[_0x91cb('0xd')](_0x4cc6ef)[_0x91cb('0x11')](_0x4aae25);};}function findById(_0x5ea796){return function(_0x238f11){if(!_[_0x91cb('0x12')](_0x5ea796)&&!_['isNil'](_0x238f11)&&!_[_0x91cb('0x12')](_0x238f11[_0x91cb('0x13')])){return _[_0x91cb('0x14')](_0x238f11[_0x91cb('0x13')],function(_0x5cc1c3){return _0x5cc1c3['id']==_0x5ea796;});}return null;};}exports[_0x91cb('0x15')]=function(_0x7dcf60,_0x4ca8e8){return respondWithRpcPromise(_0x91cb('0x16'),_0x7dcf60['query'])['then'](respondWithResult(_0x4ca8e8,null))[_0x91cb('0x17')](handleError(_0x4ca8e8,null));};exports[_0x91cb('0x18')]=function(_0x56e409,_0x51a1d5){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x91cb('0x19')](_0x56e409[_0x91cb('0x1a')],_0x56e409[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x51a1d5,null))['catch'](handleError(_0x51a1d5,null));};exports[_0x91cb('0x1c')]=function(_0x43881c,_0x1fa837){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x91cb('0x19')](_0x43881c[_0x91cb('0x1a')],_0x43881c[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x1fa837,null))[_0x91cb('0x17')](handleError(_0x1fa837,null));};exports[_0x91cb('0x1d')]=function(_0x414e60,_0x423c4f){return respondWithRpcPromise(_0x91cb('0x1e'),_0x414e60['query'])['then'](respondWithResult(_0x423c4f,null))[_0x91cb('0x17')](handleError(_0x423c4f,null));};exports['showVoiceQueues']=function(_0x1c67d2,_0x34d372){return respondWithRpcPromise(_0x91cb('0x1e'),_0x1c67d2['query'])[_0x91cb('0x8')](findById(_0x1c67d2['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x34d372,null))[_0x91cb('0x17')](handleError(_0x34d372,null));};exports[_0x91cb('0x1f')]=function(_0x2fb473,_0x468908){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x91cb('0x19')](_0x2fb473['body'],_0x2fb473[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x468908,null))[_0x91cb('0x17')](handleError(_0x468908,null));};exports['voiceQueuesPreview']=function(_0x775c25,_0x146e1f){return respondWithRpcPromise(_0x91cb('0x20'),_[_0x91cb('0x19')](_0x775c25[_0x91cb('0x1a')],_0x775c25[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x146e1f,null))[_0x91cb('0x17')](handleError(_0x146e1f,null));};exports[_0x91cb('0x21')]=function(_0x5e6ed3,_0x2ccf6e){return respondWithRpcPromise(_0x91cb('0x22'),_0x5e6ed3[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x2ccf6e,null))[_0x91cb('0x17')](handleError(_0x2ccf6e,null));};exports['voiceQueuesChannel']=function(_0x2409d3,_0x74b443){return respondWithRpcPromise(_0x91cb('0x23'),_[_0x91cb('0x19')](_0x2409d3[_0x91cb('0x1a')],_0x2409d3['params']))[_0x91cb('0x8')](respondWithResult(_0x74b443,null))['catch'](handleError(_0x74b443,null));};exports['voiceQueuesChannelHangup']=function(_0x479968,_0x2011fc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x91cb('0x19')](_0x479968['query'],_0x479968['params']))[_0x91cb('0x8')](respondWithResult(_0x2011fc,null))[_0x91cb('0x17')](handleError(_0x2011fc,null));};exports[_0x91cb('0x24')]=function(_0x14319b,_0x2d8fb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x91cb('0x19')](_0x14319b[_0x91cb('0x1a')],_0x14319b[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x2d8fb9,null))['catch'](handleError(_0x2d8fb9,null));};exports['outbound']=function(_0x1eed21,_0x135bf1){return respondWithRpcPromise('Outbound',_0x1eed21[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x135bf1,null))['catch'](handleError(_0x135bf1,null));};exports[_0x91cb('0x25')]=function(_0xddc409,_0x5f456c){return respondWithRpcPromise(_0x91cb('0x26'),_0xddc409['query'])[_0x91cb('0x8')](respondWithResult(_0x5f456c,null))[_0x91cb('0x17')](handleError(_0x5f456c,null));};exports[_0x91cb('0x27')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50;return respondWithRpcPromise('Agents',_0x279ad5[_0x91cb('0x1a')])[_0x91cb('0x8')](function(_0x4e5b4b){_0x20bf50=_0x4e5b4b;return respondWithRpcPromise(_0x91cb('0x28'),_0x279ad5['query'],routingClient);})[_0x91cb('0x8')](function(_0x2eac87){return _[_0x91cb('0x19')]({},_0x2eac87,_0x20bf50);})[_0x91cb('0x8')](respondWithResult(_0x51d0ea,null))['catch'](handleError(_0x51d0ea,null));};exports[_0x91cb('0x29')]=function(_0x5af0e6,_0x2cf27e){if(_0x5af0e6[_0x91cb('0x2a')]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')]&&_0x5af0e6[_0x91cb('0x2c')]&&_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')]){for(var _0x3cc4c1 in _0x5af0e6['body'][_0x91cb('0x2b')]){if(_0x5af0e6['body'][_0x91cb('0x2b')]['hasOwnProperty'](_0x3cc4c1)){db[_0x91cb('0x2d')]['findAll']({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')],'type':_0x91cb('0x2e'),'exitAt':null,'uniqueid':_0x5af0e6[_0x91cb('0x2a')]['interaction'][_0x3cc4c1]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]['length']?{'$notIn':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]}:{'$ne':null}}})[_0x91cb('0x8')](function(_0x32517d){var _0x267efb=moment()[_0x91cb('0x2f')](_0x91cb('0x30'));for(var _0x29d5a1=0x0,_0x396b81=_0x32517d['length'];_0x29d5a1<_0x396b81;_0x29d5a1+=0x1){_0x32517d[_0x29d5a1][_0x91cb('0x31')]({'exitAt':_0x267efb});}});for(var _0x3e20d1=0x0;_0x3e20d1<_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x91cb('0x32')];_0x3e20d1+=0x1){db[_0x91cb('0x2d')][_0x91cb('0x33')]({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'type':_0x91cb('0x2e'),'uniqueid':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1],'exitAt':null},'defaults':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'interface':_[_0x91cb('0x12')](_0x5af0e6[_0x91cb('0x2c')]['interface'])?util[_0x91cb('0x2f')]('SIP/%s',_0x5af0e6[_0x91cb('0x2c')]['name']):_0x5af0e6['user']['interface'],'type':_0x91cb('0x2e'),'enterAt':moment()[_0x91cb('0x2f')](_0x91cb('0x30')),'role':_0x91cb('0x34'),'internal':_0x5af0e6[_0x91cb('0x2c')]['internal'],'uniqueid':_0x5af0e6['body'][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1]}});}}}}return respondWithRpcPromise(_0x91cb('0x35'),{'id':_0x5af0e6[_0x91cb('0x1b')]['id'],'capacity':_0x5af0e6[_0x91cb('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x2cf27e,null))['catch'](handleError(_0x2cf27e,null));};exports[_0x91cb('0x36')]=function(_0x490417,_0x3f22a1){return respondWithRpcPromise('Telephones',_0x490417[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3f22a1,null))[_0x91cb('0x17')](handleError(_0x3f22a1,null));};exports[_0x91cb('0x37')]=function(_0x1884bc,_0x362532){return respondWithRpcPromise(_0x91cb('0x38'),_0x1884bc[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x362532,null))[_0x91cb('0x17')](handleError(_0x362532,null));};exports[_0x91cb('0x39')]=function(_0x5752ed,_0x1e445a){return respondWithRpcPromise(_0x91cb('0x3a'),_0x5752ed['query'])[_0x91cb('0x8')](respondWithResult(_0x1e445a,null))[_0x91cb('0x17')](handleError(_0x1e445a,null));};exports['chatQueues']=function(_0x2f5311,_0x166eeb){return respondWithRpcPromise(_0x91cb('0x3b'),_0x2f5311[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x166eeb,null))[_0x91cb('0x17')](handleError(_0x166eeb,null));};exports[_0x91cb('0x3c')]=function(_0x274fff,_0x3320bd){return respondWithRpcPromise(_0x91cb('0x3b'),_0x274fff[_0x91cb('0x1a')],routingClient)['then'](findById(_0x274fff[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x3320bd,null))[_0x91cb('0x17')](handleError(_0x3320bd,null));};exports['mailQueues']=function(_0x3dfff9,_0x1b2fec){return respondWithRpcPromise(_0x91cb('0x3d'),_0x3dfff9['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1b2fec,null))[_0x91cb('0x17')](handleError(_0x1b2fec,null));};exports['showMailQueues']=function(_0xef4754,_0x102025){return respondWithRpcPromise(_0x91cb('0x3d'),_0xef4754[_0x91cb('0x1a')],routingClient)['then'](findById(_0xef4754[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x102025,null))[_0x91cb('0x17')](handleError(_0x102025,null));};exports[_0x91cb('0x3e')]=function(_0x55a0e3,_0x11025a){return respondWithRpcPromise(_0x91cb('0x3f'),_0x55a0e3['query'],mailClient)['then'](respondWithResult(_0x11025a,null))[_0x91cb('0x17')](handleError(_0x11025a,null));};exports['openchannelQueues']=function(_0x1180ac,_0x1237fd){return respondWithRpcPromise('OpenchannelQueues',_0x1180ac['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1237fd,null))['catch'](handleError(_0x1237fd,null));};exports[_0x91cb('0x40')]=function(_0x961ebf,_0x33de58){return respondWithRpcPromise('OpenchannelQueues',_0x961ebf[_0x91cb('0x1a')],routingClient)['then'](findById(_0x961ebf[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x33de58,null))[_0x91cb('0x17')](handleError(_0x33de58,null));};exports[_0x91cb('0x41')]=function(_0x483172,_0xb37f8e){return respondWithRpcPromise(_0x91cb('0x42'),_0x483172[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0xb37f8e,null))[_0x91cb('0x17')](handleError(_0xb37f8e,null));};exports[_0x91cb('0x43')]=function(_0x14114d,_0x2785f9){return respondWithRpcPromise(_0x91cb('0x42'),_0x14114d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x14114d[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x2785f9,null))[_0x91cb('0x17')](handleError(_0x2785f9,null));};exports[_0x91cb('0x44')]=function(_0x474682,_0x51ab8a){return respondWithRpcPromise(_0x91cb('0x45'),_0x474682[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x51ab8a,null))['catch'](handleError(_0x51ab8a,null));};exports[_0x91cb('0x46')]=function(_0x5a3c7d,_0x4484d6){return respondWithRpcPromise(_0x91cb('0x45'),_0x5a3c7d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x5a3c7d['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x4484d6,null))[_0x91cb('0x17')](handleError(_0x4484d6,null));};exports[_0x91cb('0x47')]=function(_0x404b50,_0x1bb16f){return respondWithRpcPromise(_0x91cb('0x48'),_0x404b50['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1bb16f,null))[_0x91cb('0x17')](handleError(_0x1bb16f,null));};exports[_0x91cb('0x49')]=function(_0x1f0ba2,_0x891569){return respondWithRpcPromise(_0x91cb('0x48'),_0x1f0ba2[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x1f0ba2[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x891569,null))[_0x91cb('0x17')](handleError(_0x891569,null));};exports[_0x91cb('0x4a')]=function(_0xda123b,_0x3eead5){return respondWithRpcPromise(_0x91cb('0x4b'),_0xda123b[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3eead5,null))['catch'](handleError(_0x3eead5,null));};exports[_0x91cb('0x4c')]=function(_0x1455cd,_0x4b639d){return respondWithRpcPromise(_0x91cb('0x4d'),_0x1455cd[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x4b639d,null))['catch'](handleError(_0x4b639d,null));};exports[_0x91cb('0x4e')]=function(_0x6ecba8,_0x5cd31c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x6ecba8[_0x91cb('0x1a')],routingClient)['then'](respondWithResult(_0x5cd31c,null))[_0x91cb('0x17')](handleError(_0x5cd31c,null));};exports[_0x91cb('0x4f')]=function(_0x4e11e3,_0x43a8b1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4e11e3[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x43a8b1,null))['catch'](handleError(_0x43a8b1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x16a21f,_0x43be3e){return respondWithRpcPromise(_0x91cb('0x50'),_0x16a21f['query'],routingClient)[_0x91cb('0x8')](function(_0x23a458){if(_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')]!==undefined){var _0x570f6b=_(_0x23a458[_0x91cb('0x13')])['filter']([_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')],_0x16a21f[_0x91cb('0x1b')]['id']])[_0x91cb('0x52')]('queue_id')['uniq']()[_0x91cb('0x53')]();return _0x23a458['rows'][_0x91cb('0x54')](function(_0x3dc6f9){return _0x570f6b[_0x91cb('0x55')](_0x3dc6f9[_0x91cb('0x56')])>-0x1;});}else{return _0x23a458[_0x91cb('0x13')][_0x91cb('0x54')](function(_0x12d3d1){return _0x12d3d1['queue_id']===parseInt(_0x16a21f[_0x91cb('0x1b')]['id']);});}})[_0x91cb('0x8')](respondWithResult(_0x43be3e,null))['catch'](handleError(_0x43be3e,null));};exports[_0x91cb('0x57')]=function(_0x4d5862,_0x35525c){return respondWithRpcPromise(_0x91cb('0x58'),_0x4d5862[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x35525c,null))[_0x91cb('0x17')](handleError(_0x35525c,null));};exports[_0x91cb('0x59')]=function(_0x1459c4,_0x30259d){return respondWithRpcPromise(_0x91cb('0x5a'),_0x1459c4[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x30259d,null))[_0x91cb('0x17')](handleError(_0x30259d,null));};exports[_0x91cb('0x5b')]=function(_0x14882d,_0x22ba54){return respondWithRpcPromise(_0x91cb('0x5c'),_0x14882d['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x22ba54,null))['catch'](handleError(_0x22ba54,null));};exports[_0x91cb('0x5d')]=function(_0x123d72){return function(_0x13f358,_0x422928){var _0x319289,_0x1fa3c7;var _0x324bdb=_[_0x91cb('0x5e')](_0x123d72);var _0x569df1=_0x123d72===_0x91cb('0x5f')?_0x91cb('0x60'):'Account';return db[_0x324bdb+'Queue'][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x13f358['params']['id']}})['then'](function(_0x95f2de){if(_['isNil'](_0x95f2de)){throw new Error(_0x324bdb+_0x91cb('0x62'));}_0x319289=_0x95f2de;return db[_0x324bdb+'Message'][_0x91cb('0x61')]({'where':{'id':_0x13f358[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x324bdb+_0x91cb('0x64')],'as':'Interaction'},{'model':db[_0x324bdb+_0x569df1],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x42d07b){if(_[_0x91cb('0x12')](_0x42d07b)){throw new Error(_0x324bdb+_0x91cb('0x66'));}_0x1fa3c7=_0x42d07b;return _0x42d07b[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x3cf8c5={'uniqueid':_0x123d72+'.'+_0x1fa3c7['id']+'.'+_0x1fa3c7[_0x91cb('0x64')]['id'],'FromUserId':_0x13f358[_0x91cb('0x2c')]['id'],'type':_0x91cb('0x68')};_0x3cf8c5[_0x324bdb+_0x91cb('0x69')]=_0x1fa3c7['id'];_0x3cf8c5[_0x324bdb+_0x91cb('0x6a')]=_0x1fa3c7[_0x91cb('0x64')]['id'];_0x3cf8c5[_0x91cb('0x6b')+_0x324bdb+_0x569df1+'Id']=_0x1fa3c7[_0x91cb('0x65')]['id'];_0x3cf8c5['To'+_0x324bdb+_0x91cb('0x6c')]=_0x319289['id'];return db[_0x324bdb+_0x91cb('0x6d')][_0x91cb('0x6e')](_0x3cf8c5);})[_0x91cb('0x8')](function(){return respondWithRpcPromise(_0x91cb('0x6f'),{'channel':_0x123d72,'interaction':_0x1fa3c7[_0x91cb('0x64')],'message':_0x1fa3c7,'account':_0x1fa3c7[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x68'),'appdata':_0x319289[_0x91cb('0x10')]+','+(_0x1fa3c7['Account'][_0x91cb('0x70')]||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x422928,null))[_0x91cb('0x17')](handleError(_0x422928,null));};};exports[_0x91cb('0x72')]=function(_0x650ac9,_0x404457){var _0xa9de8b,_0x3bf154;if(_[_0x91cb('0x12')](_0x650ac9[_0x91cb('0x2a')]['channel'])){throw new Error(_0x91cb('0x73'));}var _0x4c459a=_0x650ac9['body'][_0x91cb('0x74')];var _0x265ffb=_[_0x91cb('0x5e')](_0x4c459a);var _0x446738=_0x4c459a===_0x91cb('0x5f')?_0x91cb('0x60'):_0x91cb('0x65');return db[_0x91cb('0x75')][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x650ac9[_0x91cb('0x1b')]['id'],'role':'agent'}})[_0x91cb('0x8')](function(_0xb784d5){if(_['isNil'](_0xb784d5)){throw new Error(_0x91cb('0x76'));}_0xa9de8b=_0xb784d5;return db[_0x265ffb+_0x91cb('0x77')]['findOne']({'where':{'id':_0x650ac9[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x265ffb+_0x91cb('0x64')],'as':_0x91cb('0x64')},{'model':db[_0x265ffb+_0x446738],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x65c551){if(_[_0x91cb('0x12')](_0x65c551)){throw new Error(_0x265ffb+_0x91cb('0x66'));}_0x3bf154=_0x65c551;return _0x65c551[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x378cd0={'uniqueid':_0x4c459a+'.'+_0x3bf154['id']+'.'+_0x3bf154['Interaction']['id'],'FromUserId':_0x650ac9['user']['id'],'type':_0x91cb('0x68'),'ToUserId':_0xa9de8b['id']};_0x378cd0[_0x265ffb+_0x91cb('0x69')]=_0x3bf154['id'];_0x378cd0[_0x265ffb+_0x91cb('0x6a')]=_0x3bf154[_0x91cb('0x64')]['id'];_0x378cd0[_0x91cb('0x6b')+_0x265ffb+_0x446738+'Id']=_0x3bf154[_0x91cb('0x65')]['id'];return db[_0x265ffb+_0x91cb('0x6d')]['create'](_0x378cd0);})[_0x91cb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4c459a,'interaction':_0x3bf154[_0x91cb('0x64')],'message':_0x3bf154,'account':_0x3bf154[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x34'),'appdata':_0xa9de8b[_0x91cb('0x10')]+','+(_0x3bf154[_0x91cb('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x404457,null))[_0x91cb('0x17')](handleError(_0x404457,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d8500e1..432ef65 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 _0x34bc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','update','exports','multer','util','path','express'];(function(_0x23f9c0,_0x46bb19){var _0x5a27cd=function(_0x3c09d0){while(--_0x3c09d0){_0x23f9c0['push'](_0x23f9c0['shift']());}};_0x5a27cd(++_0x46bb19);}(_0x34bc,0x14c));var _0xc34b=function(_0x3e542d,_0x210259){_0x3e542d=_0x3e542d-0x0;var _0x3830a8=_0x34bc[_0x3e542d];return _0x3830a8;};'use strict';var multer=require(_0xc34b('0x0'));var util=require(_0xc34b('0x1'));var path=require(_0xc34b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc34b('0x3'));var router=express[_0xc34b('0x4')]();var fs_extra=require(_0xc34b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc34b('0x6'));var config=require(_0xc34b('0x7'));var controller=require(_0xc34b('0x8'));router[_0xc34b('0x9')]('/',auth[_0xc34b('0xa')](),controller[_0xc34b('0xb')]);router[_0xc34b('0x9')]('/:id',auth[_0xc34b('0xa')](),controller[_0xc34b('0xc')]);router['get'](_0xc34b('0xd'),auth['isAuthenticated'](),controller[_0xc34b('0xe')]);router[_0xc34b('0xf')]('/',auth[_0xc34b('0xa')](),controller[_0xc34b('0x10')]);router[_0xc34b('0x11')](_0xc34b('0x12'),auth[_0xc34b('0xa')](),controller[_0xc34b('0x13')]);router['delete'](_0xc34b('0x12'),auth[_0xc34b('0xa')](),controller['destroy']);module[_0xc34b('0x14')]=router; \ No newline at end of file +var _0x00b7=['delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show','run','post','put','update'];(function(_0x5d90ff,_0xe1e7ab){var _0x50995c=function(_0x562a5d){while(--_0x562a5d){_0x5d90ff['push'](_0x5d90ff['shift']());}};_0x50995c(++_0xe1e7ab);}(_0x00b7,0xbf));var _0x700b=function(_0x39313b,_0x573802){_0x39313b=_0x39313b-0x0;var _0x45791b=_0x00b7[_0x39313b];return _0x45791b;};'use strict';var multer=require(_0x700b('0x0'));var util=require(_0x700b('0x1'));var path=require(_0x700b('0x2'));var timeout=require(_0x700b('0x3'));var express=require(_0x700b('0x4'));var router=express['Router']();var fs_extra=require(_0x700b('0x5'));var auth=require(_0x700b('0x6'));var interaction=require(_0x700b('0x7'));var config=require(_0x700b('0x8'));var controller=require(_0x700b('0x9'));router[_0x700b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x700b('0xa')](_0x700b('0xb'),auth[_0x700b('0xc')](),controller[_0x700b('0xd')]);router[_0x700b('0xa')]('/:id/run',auth[_0x700b('0xc')](),controller[_0x700b('0xe')]);router[_0x700b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x700b('0x10')](_0x700b('0xb'),auth[_0x700b('0xc')](),controller[_0x700b('0x11')]);router[_0x700b('0x12')]('/:id',auth[_0x700b('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 868395a..dbb374c 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 _0xfd2f=['minutes','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','months','days','hours'];(function(_0x3dab34,_0x48e9a){var _0x26f968=function(_0x1d3d61){while(--_0x1d3d61){_0x3dab34['push'](_0x3dab34['shift']());}};_0x26f968(++_0x48e9a);}(_0xfd2f,0x135));var _0xffd2=function(_0x97f219,_0x2f4c3a){_0x97f219=_0x97f219-0x0;var _0x54d14f=_0xfd2f[_0x97f219];return _0x54d14f;};'use strict';var Sequelize=require(_0xffd2('0x0'));module[_0xffd2('0x1')]={'name':{'type':Sequelize[_0xffd2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xffd2('0x2')]},'active':{'type':Sequelize[_0xffd2('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xffd2('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xffd2('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xffd2('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xffd2('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xffd2('0x6')](_0xffd2('0x7'),'quarters',_0xffd2('0x8'),'weeks',_0xffd2('0x9'),_0xffd2('0xa'),_0xffd2('0xb')),'allowNull':![],'defaultValue':_0xffd2('0x9')},'output':{'type':Sequelize['ENUM'](_0xffd2('0xc'),_0xffd2('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xffd2('0xc')},'type':{'type':Sequelize[_0xffd2('0x6')](_0xffd2('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xffd2('0xf')]},'bcc':{'type':Sequelize[_0xffd2('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xffd2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9cfd=['years','quarters','months','weeks','minutes','days','ENUM','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE'];(function(_0x2cba09,_0x23ee85){var _0x10d084=function(_0x11d2e4){while(--_0x11d2e4){_0x2cba09['push'](_0x2cba09['shift']());}};_0x10d084(++_0x23ee85);}(_0x9cfd,0xb8));var _0xd9cf=function(_0x85d1fa,_0x479283){_0x85d1fa=_0x85d1fa-0x0;var _0x1c2be8=_0x9cfd[_0x85d1fa];return _0x1c2be8;};'use strict';var Sequelize=require(_0xd9cf('0x0'));module[_0xd9cf('0x1')]={'name':{'type':Sequelize[_0xd9cf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd9cf('0x2')]},'active':{'type':Sequelize[_0xd9cf('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd9cf('0x2')],'allowNull':![],'defaultValue':_0xd9cf('0x4')},'startAt':{'type':Sequelize[_0xd9cf('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd9cf('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd9cf('0x6'),_0xd9cf('0x7'),_0xd9cf('0x8'),_0xd9cf('0x9'),'days','hours',_0xd9cf('0xa')),'allowNull':![],'defaultValue':_0xd9cf('0xb')},'output':{'type':Sequelize[_0xd9cf('0xc')]('csv',_0xd9cf('0xd'),_0xd9cf('0xe')),'allowNull':![],'defaultValue':_0xd9cf('0xf')},'type':{'type':Sequelize[_0xd9cf('0xc')](_0xd9cf('0x10'),_0xd9cf('0x11')),'allowNull':![],'defaultValue':_0xd9cf('0x10')},'sendMail':{'type':Sequelize[_0xd9cf('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd9cf('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd9cf('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd9cf('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 22280ea..5845772 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 _0x3feb=['body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','run','../../config/schedule','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','end','sendStatus','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','include','options','find','create'];(function(_0x2e6321,_0x5c9e40){var _0x163f0b=function(_0x283229){while(--_0x283229){_0x2e6321['push'](_0x2e6321['shift']());}};_0x163f0b(++_0x5c9e40);}(_0x3feb,0x1ee));var _0xb3fe=function(_0x3842da,_0xa23321){_0x3842da=_0x3842da-0x0;var _0x255239=_0x3feb[_0x3842da];return _0x255239;};'use strict';var emlformat=require(_0xb3fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3fe('0x2'));var BPromise=require(_0xb3fe('0x3'));var Mustache=require(_0xb3fe('0x4'));var util=require(_0xb3fe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb3fe('0x6'));var ejs=require(_0xb3fe('0x7'));var fs=require('fs');var fs_extra=require(_0xb3fe('0x8'));var _=require(_0xb3fe('0x9'));var squel=require(_0xb3fe('0xa'));var crypto=require(_0xb3fe('0xb'));var jsforce=require(_0xb3fe('0xc'));var deskjs=require(_0xb3fe('0xd'));var toCsv=require(_0xb3fe('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb3fe('0xe'));var authService=require(_0xb3fe('0xf'));var qs=require(_0xb3fe('0x10'));var as=require(_0xb3fe('0x11'));var hardwareService=require(_0xb3fe('0x12'));var logger=require(_0xb3fe('0x13'))(_0xb3fe('0x14'));var utils=require('../../config/utils');var config=require(_0xb3fe('0x15'));var licenseUtil=require(_0xb3fe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2deca1,_0x3d34da){_0x3d34da=_0x3d34da||0xcc;return function(_0x3e670f){if(_0x3e670f){return _0x2deca1['sendStatus'](_0x3d34da);}return _0x2deca1[_0xb3fe('0x17')](_0x3d34da)['end']();};}function respondWithResult(_0xa58f95,_0x37c108){_0x37c108=_0x37c108||0xc8;return function(_0x5eb6f9){if(_0x5eb6f9){return _0xa58f95[_0xb3fe('0x17')](_0x37c108)[_0xb3fe('0x18')](_0x5eb6f9);}};}function respondWithFilteredResult(_0x13dfa3,_0x50a74b){return function(_0x1c057c){if(_0x1c057c){var _0x26dcb8=typeof _0x50a74b[_0xb3fe('0x19')]===_0xb3fe('0x1a')&&typeof _0x50a74b[_0xb3fe('0x1b')]===_0xb3fe('0x1a');var _0x3df5f4=_0x1c057c[_0xb3fe('0x1c')];var _0x22ab48=_0x26dcb8?0x0:_0x50a74b[_0xb3fe('0x19')];var _0x349403=_0x26dcb8?_0x1c057c[_0xb3fe('0x1c')]:_0x50a74b[_0xb3fe('0x19')]+_0x50a74b[_0xb3fe('0x1b')];var _0x13188e;if(_0x349403>=_0x3df5f4){_0x349403=_0x3df5f4;_0x13188e=0xc8;}else{_0x13188e=0xce;}_0x13dfa3['status'](_0x13188e);return _0x13dfa3[_0xb3fe('0x1d')](_0xb3fe('0x1e'),_0x22ab48+'-'+_0x349403+'/'+_0x3df5f4)[_0xb3fe('0x18')](_0x1c057c);}return null;};}function patchUpdates(_0x2d1efb){return function(_0x1a3bc0){try{jsonpatch[_0xb3fe('0x1f')](_0x1a3bc0,_0x2d1efb,!![]);}catch(_0x3a2dc6){return BPromise['reject'](_0x3a2dc6);}return _0x1a3bc0[_0xb3fe('0x20')]();};}function saveUpdates(_0x45cf88,_0x29d29f){return function(_0x131e12){if(_0x131e12){return _0x131e12[_0xb3fe('0x21')](_0x45cf88)[_0xb3fe('0x22')](function(_0x3696e1){return _0x3696e1;});}return null;};}function removeEntity(_0x36a18c,_0x67c428){return function(_0x44d897){if(_0x44d897){return _0x44d897[_0xb3fe('0x23')]()[_0xb3fe('0x22')](function(){var _0x379b54=_0x44d897[_0xb3fe('0x24')]({'plain':!![]});var _0xf95914=_0xb3fe('0x25');return db['UserProfileResource'][_0xb3fe('0x23')]({'where':{'type':_0xf95914,'resourceId':_0x379b54['id']}})['then'](function(){return _0x44d897;});})['then'](function(){_0x36a18c['status'](0xcc)[_0xb3fe('0x26')]();});}};}function handleEntityNotFound(_0x211fc7,_0x47c735){return function(_0x40c1b3){if(!_0x40c1b3){_0x211fc7[_0xb3fe('0x27')](0x194);}return _0x40c1b3;};}function handleError(_0x39714f,_0x35a678){_0x35a678=_0x35a678||0x1f4;return function(_0x9270e7){logger[_0xb3fe('0x28')](_0x9270e7[_0xb3fe('0x29')]);if(_0x9270e7[_0xb3fe('0x2a')]){delete _0x9270e7[_0xb3fe('0x2a')];}_0x39714f[_0xb3fe('0x17')](_0x35a678)[_0xb3fe('0x2b')](_0x9270e7);};}exports['index']=function(_0x4cd685,_0x4da9d7){var _0x55c6ae={},_0x5ca5cf={},_0x47f238={'count':0x0,'rows':[]};var _0x133b8a=_[_0xb3fe('0x2c')](db[_0xb3fe('0x2d')][_0xb3fe('0x2e')],function(_0x1ed778){return{'name':_0x1ed778[_0xb3fe('0x2f')],'type':_0x1ed778[_0xb3fe('0x30')][_0xb3fe('0x31')]};});_0x5ca5cf[_0xb3fe('0x32')]=_[_0xb3fe('0x2c')](_0x133b8a,_0xb3fe('0x2a'));_0x5ca5cf['query']=_[_0xb3fe('0x33')](_0x4cd685[_0xb3fe('0x34')]);_0x5ca5cf[_0xb3fe('0x35')]=_[_0xb3fe('0x36')](_0x5ca5cf[_0xb3fe('0x32')],_0x5ca5cf['query']);_0x55c6ae['attributes']=_[_0xb3fe('0x36')](_0x5ca5cf['model'],qs['fields'](_0x4cd685['query'][_0xb3fe('0x37')]));_0x55c6ae['attributes']=_0x55c6ae[_0xb3fe('0x38')]['length']?_0x55c6ae['attributes']:_0x5ca5cf[_0xb3fe('0x32')];if(!_0x4cd685['query'][_0xb3fe('0x39')]('nolimit')){_0x55c6ae['limit']=qs[_0xb3fe('0x1b')](_0x4cd685['query'][_0xb3fe('0x1b')]);_0x55c6ae[_0xb3fe('0x19')]=qs[_0xb3fe('0x19')](_0x4cd685['query'][_0xb3fe('0x19')]);}_0x55c6ae[_0xb3fe('0x3a')]=qs[_0xb3fe('0x3b')](_0x4cd685[_0xb3fe('0x34')]['sort']);_0x55c6ae[_0xb3fe('0x3c')]=qs[_0xb3fe('0x35')](_[_0xb3fe('0x3d')](_0x4cd685['query'],_0x5ca5cf[_0xb3fe('0x35')]),_0x133b8a);if(_0x4cd685[_0xb3fe('0x34')][_0xb3fe('0x3e')]){_0x55c6ae[_0xb3fe('0x3c')]=_[_0xb3fe('0x3f')](_0x55c6ae[_0xb3fe('0x3c')],{'$or':_['map'](_0x133b8a,function(_0x1dd845){if(_0x1dd845[_0xb3fe('0x30')]!=='VIRTUAL'){var _0x402d89={};_0x402d89[_0x1dd845[_0xb3fe('0x2a')]]={'$like':'%'+_0x4cd685[_0xb3fe('0x34')][_0xb3fe('0x3e')]+'%'};return _0x402d89;}})});}_0x55c6ae=_[_0xb3fe('0x3f')]({},_0x55c6ae,_0x4cd685['options']);var _0x244b39={'where':_0x55c6ae[_0xb3fe('0x3c')]};return db[_0xb3fe('0x2d')]['count'](_0x244b39)[_0xb3fe('0x22')](function(_0xc7f39b){_0x47f238['count']=_0xc7f39b;if(_0x4cd685[_0xb3fe('0x34')][_0xb3fe('0x40')]){_0x55c6ae['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x55c6ae);})[_0xb3fe('0x22')](function(_0x332a49){_0x47f238[_0xb3fe('0x41')]=_0x332a49;return _0x47f238;})[_0xb3fe('0x22')](respondWithFilteredResult(_0x4da9d7,_0x55c6ae))[_0xb3fe('0x42')](handleError(_0x4da9d7,null));};exports[_0xb3fe('0x43')]=function(_0x51d2c4,_0x363c60){var _0x2a1aef={'raw':![],'where':{'id':_0x51d2c4[_0xb3fe('0x44')]['id']}},_0x5ba28f={};_0x5ba28f[_0xb3fe('0x32')]=_[_0xb3fe('0x33')](db[_0xb3fe('0x2d')][_0xb3fe('0x2e')]);_0x5ba28f['query']=_[_0xb3fe('0x33')](_0x51d2c4[_0xb3fe('0x34')]);_0x5ba28f[_0xb3fe('0x35')]=_[_0xb3fe('0x36')](_0x5ba28f[_0xb3fe('0x32')],_0x5ba28f[_0xb3fe('0x34')]);_0x2a1aef['attributes']=_[_0xb3fe('0x36')](_0x5ba28f[_0xb3fe('0x32')],qs[_0xb3fe('0x37')](_0x51d2c4[_0xb3fe('0x34')]['fields']));_0x2a1aef[_0xb3fe('0x38')]=_0x2a1aef[_0xb3fe('0x38')]['length']?_0x2a1aef['attributes']:_0x5ba28f['model'];if(_0x51d2c4['query'][_0xb3fe('0x40')]){_0x2a1aef[_0xb3fe('0x45')]=[{'all':!![]}];}_0x2a1aef=_['merge']({},_0x2a1aef,_0x51d2c4[_0xb3fe('0x46')]);return db[_0xb3fe('0x2d')][_0xb3fe('0x47')](_0x2a1aef)['then'](handleEntityNotFound(_0x363c60,null))[_0xb3fe('0x22')](respondWithResult(_0x363c60,null))[_0xb3fe('0x42')](handleError(_0x363c60,null));};exports['create']=function(_0x57267f,_0x44ac96){return db[_0xb3fe('0x2d')][_0xb3fe('0x48')](_0x57267f[_0xb3fe('0x49')],{})[_0xb3fe('0x22')](function(_0x38a1b6){var _0x3aeb6c=_0x57267f[_0xb3fe('0x4a')]['get']({'plain':!![]});if(!_0x3aeb6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3aeb6c['role']===_0xb3fe('0x4a')){var _0x3c16ac=_0x38a1b6[_0xb3fe('0x24')]({'plain':!![]});var _0x4d8b57=_0xb3fe('0x25');return db[_0xb3fe('0x4b')][_0xb3fe('0x47')]({'where':{'name':_0x4d8b57,'userProfileId':_0x3aeb6c[_0xb3fe('0x4c')]},'raw':!![]})[_0xb3fe('0x22')](function(_0x6bd478){if(_0x6bd478&&_0x6bd478[_0xb3fe('0x4d')]===0x0){return db[_0xb3fe('0x4e')][_0xb3fe('0x48')]({'name':_0x3c16ac[_0xb3fe('0x2a')],'resourceId':_0x3c16ac['id'],'type':_0x6bd478[_0xb3fe('0x2a')],'sectionId':_0x6bd478['id']},{})[_0xb3fe('0x22')](function(){return _0x38a1b6;});}else{return _0x38a1b6;}})['catch'](function(_0x4c60c3){logger[_0xb3fe('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c60c3);throw _0x4c60c3;});}return _0x38a1b6;})[_0xb3fe('0x22')](respondWithResult(_0x44ac96,0xc9))[_0xb3fe('0x42')](handleError(_0x44ac96,null));};exports[_0xb3fe('0x21')]=function(_0xfef2e0,_0x7829e5){if(_0xfef2e0[_0xb3fe('0x49')]['id']){delete _0xfef2e0['body']['id'];}return db[_0xb3fe('0x2d')]['find']({'where':{'id':_0xfef2e0[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x22')](handleEntityNotFound(_0x7829e5,null))[_0xb3fe('0x22')](saveUpdates(_0xfef2e0[_0xb3fe('0x49')],null))[_0xb3fe('0x22')](respondWithResult(_0x7829e5,null))[_0xb3fe('0x42')](handleError(_0x7829e5,null));};exports[_0xb3fe('0x23')]=function(_0x5b78dc,_0x4c1934){return db[_0xb3fe('0x2d')]['find']({'where':{'id':_0x5b78dc['params']['id']}})[_0xb3fe('0x22')](handleEntityNotFound(_0x4c1934,null))[_0xb3fe('0x22')](removeEntity(_0x4c1934,null))[_0xb3fe('0x42')](handleError(_0x4c1934,null));};exports[_0xb3fe('0x4f')]=function(_0x4b983a,_0x27232c,_0x32655a){var _0x21dad7=require(_0xb3fe('0x50'));return db['Schedule'][_0xb3fe('0x47')]({'where':{'id':_0x4b983a[_0xb3fe('0x44')]['id']},'raw':!![]})[_0xb3fe('0x22')](handleEntityNotFound(_0x27232c,null))[_0xb3fe('0x22')](function(){_0x21dad7[_0xb3fe('0x4f')](_0x4b983a['params']['id']);})['then'](respondWithStatusCode(_0x27232c,null))[_0xb3fe('0x42')](handleError(_0x27232c,null));}; \ No newline at end of file +var _0xb218=['params','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0xb218,0x169));var _0x8b21=function(_0x8871dd,_0x1ccd88){_0x8871dd=_0x8871dd-0x0;var _0x30319e=_0xb218[_0x8871dd];return _0x30319e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b21('0x0'));var jsonpatch=require(_0x8b21('0x1'));var rp=require(_0x8b21('0x2'));var moment=require(_0x8b21('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8b21('0x4'));var util=require(_0x8b21('0x5'));var path=require(_0x8b21('0x6'));var sox=require(_0x8b21('0x7'));var csv=require(_0x8b21('0x8'));var ejs=require(_0x8b21('0x9'));var fs=require('fs');var fs_extra=require(_0x8b21('0xa'));var _=require(_0x8b21('0xb'));var squel=require('squel');var crypto=require(_0x8b21('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b21('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b21('0xe'));var Redis=require(_0x8b21('0xf'));var authService=require(_0x8b21('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8b21('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b21('0x12'))(_0x8b21('0x13'));var utils=require(_0x8b21('0x14'));var config=require(_0x8b21('0x15'));var licenseUtil=require(_0x8b21('0x16'));var db=require(_0x8b21('0x17'))['db'];function respondWithStatusCode(_0x4f8501,_0x2e3542){_0x2e3542=_0x2e3542||0xcc;return function(_0x4bf241){if(_0x4bf241){return _0x4f8501[_0x8b21('0x18')](_0x2e3542);}return _0x4f8501['status'](_0x2e3542)[_0x8b21('0x19')]();};}function respondWithResult(_0x506803,_0xb52fc9){_0xb52fc9=_0xb52fc9||0xc8;return function(_0x570d94){if(_0x570d94){return _0x506803[_0x8b21('0x1a')](_0xb52fc9)[_0x8b21('0x1b')](_0x570d94);}};}function respondWithFilteredResult(_0xb0b98d,_0x549233){return function(_0x443534){if(_0x443534){var _0x1c1ed4=typeof _0x549233[_0x8b21('0x1c')]===_0x8b21('0x1d')&&typeof _0x549233[_0x8b21('0x1e')]===_0x8b21('0x1d');var _0x4c17c3=_0x443534['count'];var _0x2cd50c=_0x1c1ed4?0x0:_0x549233[_0x8b21('0x1c')];var _0x28cc17=_0x1c1ed4?_0x443534['count']:_0x549233['offset']+_0x549233['limit'];var _0x590603;if(_0x28cc17>=_0x4c17c3){_0x28cc17=_0x4c17c3;_0x590603=0xc8;}else{_0x590603=0xce;}_0xb0b98d['status'](_0x590603);return _0xb0b98d['set'](_0x8b21('0x1f'),_0x2cd50c+'-'+_0x28cc17+'/'+_0x4c17c3)[_0x8b21('0x1b')](_0x443534);}return null;};}function patchUpdates(_0x243372){return function(_0x362b69){try{jsonpatch[_0x8b21('0x20')](_0x362b69,_0x243372,!![]);}catch(_0x430528){return BPromise[_0x8b21('0x21')](_0x430528);}return _0x362b69[_0x8b21('0x22')]();};}function saveUpdates(_0x1b5eec,_0x366105){return function(_0x1ce581){if(_0x1ce581){return _0x1ce581['update'](_0x1b5eec)[_0x8b21('0x23')](function(_0x434400){return _0x434400;});}return null;};}function removeEntity(_0x2b9f54,_0x23d29f){return function(_0xdc41ba){if(_0xdc41ba){return _0xdc41ba[_0x8b21('0x24')]()[_0x8b21('0x23')](function(){var _0x4e103e=_0xdc41ba[_0x8b21('0x25')]({'plain':!![]});var _0x3264dd=_0x8b21('0x26');return db[_0x8b21('0x27')][_0x8b21('0x24')]({'where':{'type':_0x3264dd,'resourceId':_0x4e103e['id']}})[_0x8b21('0x23')](function(){return _0xdc41ba;});})['then'](function(){_0x2b9f54['status'](0xcc)[_0x8b21('0x19')]();});}};}function handleEntityNotFound(_0x1e0276,_0x5a469b){return function(_0x1b826c){if(!_0x1b826c){_0x1e0276[_0x8b21('0x18')](0x194);}return _0x1b826c;};}function handleError(_0x416693,_0x38fb58){_0x38fb58=_0x38fb58||0x1f4;return function(_0x456793){logger['error'](_0x456793[_0x8b21('0x28')]);if(_0x456793[_0x8b21('0x29')]){delete _0x456793[_0x8b21('0x29')];}_0x416693[_0x8b21('0x1a')](_0x38fb58)[_0x8b21('0x2a')](_0x456793);};}exports[_0x8b21('0x2b')]=function(_0x4f52ea,_0x42fe51){var _0x204dac={},_0x193d94={},_0x2d6f9f={'count':0x0,'rows':[]};var _0x68b8b8=_[_0x8b21('0x2c')](db[_0x8b21('0x2d')][_0x8b21('0x2e')],function(_0x34a8c3){return{'name':_0x34a8c3[_0x8b21('0x2f')],'type':_0x34a8c3[_0x8b21('0x30')][_0x8b21('0x31')]};});_0x193d94['model']=_[_0x8b21('0x2c')](_0x68b8b8,'name');_0x193d94[_0x8b21('0x32')]=_[_0x8b21('0x33')](_0x4f52ea[_0x8b21('0x32')]);_0x193d94[_0x8b21('0x34')]=_[_0x8b21('0x35')](_0x193d94[_0x8b21('0x36')],_0x193d94[_0x8b21('0x32')]);_0x204dac['attributes']=_['intersection'](_0x193d94[_0x8b21('0x36')],qs[_0x8b21('0x37')](_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x37')]));_0x204dac[_0x8b21('0x38')]=_0x204dac['attributes'][_0x8b21('0x39')]?_0x204dac[_0x8b21('0x38')]:_0x193d94[_0x8b21('0x36')];if(!_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x3a')](_0x8b21('0x3b'))){_0x204dac[_0x8b21('0x1e')]=qs[_0x8b21('0x1e')](_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x1e')]);_0x204dac[_0x8b21('0x1c')]=qs['offset'](_0x4f52ea[_0x8b21('0x32')]['offset']);}_0x204dac[_0x8b21('0x3c')]=qs[_0x8b21('0x3d')](_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x3d')]);_0x204dac['where']=qs[_0x8b21('0x34')](_[_0x8b21('0x3e')](_0x4f52ea[_0x8b21('0x32')],_0x193d94['filters']),_0x68b8b8);if(_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x3f')]){_0x204dac[_0x8b21('0x40')]=_[_0x8b21('0x41')](_0x204dac[_0x8b21('0x40')],{'$or':_[_0x8b21('0x2c')](_0x68b8b8,function(_0x451974){if(_0x451974['type']!==_0x8b21('0x42')){var _0x4ef001={};_0x4ef001[_0x451974[_0x8b21('0x29')]]={'$like':'%'+_0x4f52ea[_0x8b21('0x32')][_0x8b21('0x3f')]+'%'};return _0x4ef001;}})});}_0x204dac=_[_0x8b21('0x41')]({},_0x204dac,_0x4f52ea[_0x8b21('0x43')]);var _0x38c1b4={'where':_0x204dac[_0x8b21('0x40')]};return db[_0x8b21('0x2d')]['count'](_0x38c1b4)[_0x8b21('0x23')](function(_0x4c8894){_0x2d6f9f[_0x8b21('0x44')]=_0x4c8894;if(_0x4f52ea['query'][_0x8b21('0x45')]){_0x204dac[_0x8b21('0x46')]=[{'all':!![]}];}return db[_0x8b21('0x2d')]['findAll'](_0x204dac);})[_0x8b21('0x23')](function(_0x8a227e){_0x2d6f9f[_0x8b21('0x47')]=_0x8a227e;return _0x2d6f9f;})[_0x8b21('0x23')](respondWithFilteredResult(_0x42fe51,_0x204dac))[_0x8b21('0x48')](handleError(_0x42fe51,null));};exports[_0x8b21('0x49')]=function(_0x13adfb,_0x5a12be){var _0x6098db={'raw':![],'where':{'id':_0x13adfb[_0x8b21('0x4a')]['id']}},_0x45f9ea={};_0x45f9ea[_0x8b21('0x36')]=_[_0x8b21('0x33')](db[_0x8b21('0x2d')][_0x8b21('0x2e')]);_0x45f9ea[_0x8b21('0x32')]=_['keys'](_0x13adfb['query']);_0x45f9ea['filters']=_[_0x8b21('0x35')](_0x45f9ea[_0x8b21('0x36')],_0x45f9ea['query']);_0x6098db[_0x8b21('0x38')]=_[_0x8b21('0x35')](_0x45f9ea[_0x8b21('0x36')],qs[_0x8b21('0x37')](_0x13adfb[_0x8b21('0x32')][_0x8b21('0x37')]));_0x6098db[_0x8b21('0x38')]=_0x6098db[_0x8b21('0x38')]['length']?_0x6098db[_0x8b21('0x38')]:_0x45f9ea[_0x8b21('0x36')];if(_0x13adfb['query'][_0x8b21('0x45')]){_0x6098db['include']=[{'all':!![]}];}_0x6098db=_[_0x8b21('0x41')]({},_0x6098db,_0x13adfb[_0x8b21('0x43')]);return db['Schedule'][_0x8b21('0x4b')](_0x6098db)[_0x8b21('0x23')](handleEntityNotFound(_0x5a12be,null))[_0x8b21('0x23')](respondWithResult(_0x5a12be,null))[_0x8b21('0x48')](handleError(_0x5a12be,null));};exports[_0x8b21('0x4c')]=function(_0x3f3f0d,_0x467e57){return db['Schedule'][_0x8b21('0x4c')](_0x3f3f0d[_0x8b21('0x4d')],{})[_0x8b21('0x23')](function(_0x606d0e){var _0x1ec264=_0x3f3f0d[_0x8b21('0x4e')]['get']({'plain':!![]});if(!_0x1ec264)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ec264[_0x8b21('0x4f')]===_0x8b21('0x4e')){var _0xfea55f=_0x606d0e[_0x8b21('0x25')]({'plain':!![]});var _0x2acca3='Scheduler';return db[_0x8b21('0x50')]['find']({'where':{'name':_0x2acca3,'userProfileId':_0x1ec264[_0x8b21('0x51')]},'raw':!![]})['then'](function(_0x4bdf16){if(_0x4bdf16&&_0x4bdf16['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xfea55f[_0x8b21('0x29')],'resourceId':_0xfea55f['id'],'type':_0x4bdf16[_0x8b21('0x29')],'sectionId':_0x4bdf16['id']},{})['then'](function(){return _0x606d0e;});}else{return _0x606d0e;}})[_0x8b21('0x48')](function(_0x1b9bcf){logger[_0x8b21('0x52')](_0x8b21('0x53'),_0x1b9bcf);throw _0x1b9bcf;});}return _0x606d0e;})[_0x8b21('0x23')](respondWithResult(_0x467e57,0xc9))[_0x8b21('0x48')](handleError(_0x467e57,null));};exports[_0x8b21('0x54')]=function(_0x23f87a,_0xb7c98a){if(_0x23f87a[_0x8b21('0x4d')]['id']){delete _0x23f87a[_0x8b21('0x4d')]['id'];}return db[_0x8b21('0x2d')][_0x8b21('0x4b')]({'where':{'id':_0x23f87a['params']['id']}})[_0x8b21('0x23')](handleEntityNotFound(_0xb7c98a,null))['then'](saveUpdates(_0x23f87a[_0x8b21('0x4d')],null))[_0x8b21('0x23')](respondWithResult(_0xb7c98a,null))[_0x8b21('0x48')](handleError(_0xb7c98a,null));};exports[_0x8b21('0x24')]=function(_0xfdb7dc,_0x12a100){return db[_0x8b21('0x2d')][_0x8b21('0x4b')]({'where':{'id':_0xfdb7dc[_0x8b21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12a100,null))[_0x8b21('0x23')](removeEntity(_0x12a100,null))[_0x8b21('0x48')](handleError(_0x12a100,null));};exports[_0x8b21('0x55')]=function(_0x39938e,_0x492e29,_0x5db430){var _0x58d298=require(_0x8b21('0x56'));return db[_0x8b21('0x2d')][_0x8b21('0x4b')]({'where':{'id':_0x39938e[_0x8b21('0x4a')]['id']},'raw':!![]})[_0x8b21('0x23')](handleEntityNotFound(_0x492e29,null))[_0x8b21('0x23')](function(){_0x58d298[_0x8b21('0x55')](_0x39938e[_0x8b21('0x4a')]['id']);})[_0x8b21('0x23')](respondWithStatusCode(_0x492e29,null))[_0x8b21('0x48')](handleError(_0x492e29,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c65c406..09c14de 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 _0x4835=['exports','define','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4835,0xc3));var _0x5483=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4835[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x5483('0x0'));var util=require(_0x5483('0x1'));var logger=require(_0x5483('0x2'))('api');var moment=require(_0x5483('0x3'));var BPromise=require(_0x5483('0x4'));var rp=require(_0x5483('0x5'));var fs=require('fs');var path=require(_0x5483('0x6'));var rimraf=require('rimraf');var config=require(_0x5483('0x7'));var attributes=require(_0x5483('0x8'));module[_0x5483('0x9')]=function(_0xc5da3a,_0x51b059){return _0xc5da3a[_0x5483('0xa')]('Schedule',attributes,{'tableName':_0x5483('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0de=['rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4c3533,_0x378f98){var _0x4a60cc=function(_0x199a0d){while(--_0x199a0d){_0x4c3533['push'](_0x4c3533['shift']());}};_0x4a60cc(++_0x378f98);}(_0xa0de,0x89));var _0xea0d=function(_0x167147,_0x20a159){_0x167147=_0x167147-0x0;var _0x39c6c0=_0xa0de[_0x167147];return _0x39c6c0;};'use strict';var _=require(_0xea0d('0x0'));var util=require(_0xea0d('0x1'));var logger=require(_0xea0d('0x2'))('api');var moment=require(_0xea0d('0x3'));var BPromise=require(_0xea0d('0x4'));var rp=require(_0xea0d('0x5'));var fs=require('fs');var path=require(_0xea0d('0x6'));var rimraf=require(_0xea0d('0x7'));var config=require(_0xea0d('0x8'));var attributes=require(_0xea0d('0x9'));module[_0xea0d('0xa')]=function(_0xd729a3,_0x1e9513){return _0xd729a3['define'](_0xea0d('0xb'),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 e23a654..8ed2d5c 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 _0x33d2=['request','then','debug','request\x20sent','stringify','error','code','message','Schedule,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3e1b6b,_0x31208f){var _0x493bcf=function(_0x11d354){while(--_0x11d354){_0x3e1b6b['push'](_0x3e1b6b['shift']());}};_0x493bcf(++_0x31208f);}(_0x33d2,0x75));var _0x233d=function(_0x28c870,_0x1bf349){_0x28c870=_0x28c870-0x0;var _0x5e4de6=_0x33d2[_0x28c870];return _0x5e4de6;};'use strict';var _=require(_0x233d('0x0'));var util=require('util');var moment=require(_0x233d('0x1'));var BPromise=require(_0x233d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x233d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x233d('0x4'))(_0x233d('0x5'));var config=require('../../config/environment');var jayson=require(_0x233d('0x6'));var client=jayson[_0x233d('0x7')][_0x233d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2abc3f,_0x5c54cc,_0x3823a5){return new BPromise(function(_0x3c3a7f,_0x3ea131){return client[_0x233d('0x9')](_0x2abc3f,_0x3823a5)[_0x233d('0xa')](function(_0x2b2b3d){logger['info']('Schedule,\x20%s,\x20%s',_0x5c54cc,'request\x20sent');logger[_0x233d('0xb')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5c54cc,_0x233d('0xc'),JSON[_0x233d('0xd')](_0x2b2b3d));if(_0x2b2b3d[_0x233d('0xe')]){if(_0x2b2b3d[_0x233d('0xe')][_0x233d('0xf')]===0x1f4){logger[_0x233d('0xe')]('Schedule,\x20%s,\x20%s',_0x5c54cc,_0x2b2b3d[_0x233d('0xe')][_0x233d('0x10')]);return _0x3ea131(_0x2b2b3d['error'][_0x233d('0x10')]);}logger[_0x233d('0xe')](_0x233d('0x11'),_0x5c54cc,_0x2b2b3d[_0x233d('0xe')]['message']);return _0x3c3a7f(_0x2b2b3d[_0x233d('0xe')][_0x233d('0x10')]);}else{logger[_0x233d('0x12')](_0x233d('0x11'),_0x5c54cc,_0x233d('0xc'));_0x3c3a7f(_0x2b2b3d[_0x233d('0x13')][_0x233d('0x10')]);}})[_0x233d('0x14')](function(_0x380877){logger['error']('Schedule,\x20%s,\x20%s',_0x5c54cc,_0x380877);_0x3ea131(_0x380877);});});} \ No newline at end of file +var _0x2658=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x2658,0x1a9));var _0x8265=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0x2658[_0x549ffa];return _0x378324;};'use strict';var _=require(_0x8265('0x0'));var util=require('util');var moment=require(_0x8265('0x1'));var BPromise=require(_0x8265('0x2'));var rs=require(_0x8265('0x3'));var fs=require('fs');var Redis=require(_0x8265('0x4'));var db=require(_0x8265('0x5'))['db'];var utils=require(_0x8265('0x6'));var logger=require(_0x8265('0x7'))(_0x8265('0x8'));var config=require(_0x8265('0x9'));var jayson=require(_0x8265('0xa'));var client=jayson[_0x8265('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adc8b,_0x5963f2,_0x5a04e8){return new BPromise(function(_0x2c4ad7,_0x2c9df4){return client[_0x8265('0xc')](_0x2adc8b,_0x5a04e8)[_0x8265('0xd')](function(_0x1f9671){logger[_0x8265('0xe')](_0x8265('0xf'),_0x5963f2,_0x8265('0x10'));logger[_0x8265('0x11')](_0x8265('0x12'),_0x5963f2,_0x8265('0x10'),JSON[_0x8265('0x13')](_0x1f9671));if(_0x1f9671[_0x8265('0x14')]){if(_0x1f9671[_0x8265('0x14')][_0x8265('0x15')]===0x1f4){logger[_0x8265('0x14')](_0x8265('0xf'),_0x5963f2,_0x1f9671[_0x8265('0x14')][_0x8265('0x16')]);return _0x2c9df4(_0x1f9671[_0x8265('0x14')][_0x8265('0x16')]);}logger[_0x8265('0x14')]('Schedule,\x20%s,\x20%s',_0x5963f2,_0x1f9671[_0x8265('0x14')][_0x8265('0x16')]);return _0x2c4ad7(_0x1f9671[_0x8265('0x14')]['message']);}else{logger[_0x8265('0xe')](_0x8265('0xf'),_0x5963f2,_0x8265('0x10'));_0x2c4ad7(_0x1f9671[_0x8265('0x17')][_0x8265('0x16')]);}})['catch'](function(_0x1d7547){logger[_0x8265('0x14')](_0x8265('0xf'),_0x5963f2,_0x1d7547);_0x2c9df4(_0x1d7547);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 30233a5..38dcc5c 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 _0xddc7=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58cc71,_0x2191c8){var _0x49fc9e=function(_0xcbca19){while(--_0xcbca19){_0x58cc71['push'](_0x58cc71['shift']());}};_0x49fc9e(++_0x2191c8);}(_0xddc7,0x1b0));var _0x7ddc=function(_0x928aa1,_0x16bd67){_0x928aa1=_0x928aa1-0x0;var _0x37b02b=_0xddc7[_0x928aa1];return _0x37b02b;};'use strict';var multer=require(_0x7ddc('0x0'));var util=require(_0x7ddc('0x1'));var path=require(_0x7ddc('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ddc('0x3'));var router=express[_0x7ddc('0x4')]();var fs_extra=require(_0x7ddc('0x5'));var auth=require(_0x7ddc('0x6'));var interaction=require(_0x7ddc('0x7'));var config=require(_0x7ddc('0x8'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7ddc('0x9')]);router[_0x7ddc('0xa')](_0x7ddc('0xb'),auth[_0x7ddc('0xc')](),controller[_0x7ddc('0xd')]);router[_0x7ddc('0xa')](_0x7ddc('0xe'),auth[_0x7ddc('0xc')](),controller[_0x7ddc('0xf')]);router[_0x7ddc('0xa')](_0x7ddc('0x10'),auth[_0x7ddc('0xc')](),controller[_0x7ddc('0x11')]);router[_0x7ddc('0x12')]('/',auth[_0x7ddc('0xc')](),controller[_0x7ddc('0x13')]);router[_0x7ddc('0x14')](_0x7ddc('0xe'),auth[_0x7ddc('0xc')](),controller['update']);router['delete']('/:id',auth[_0x7ddc('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x363f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x228d70,_0x44ff20){var _0x34c41=function(_0xa4af96){while(--_0xa4af96){_0x228d70['push'](_0x228d70['shift']());}};_0x34c41(++_0x44ff20);}(_0x363f,0x179));var _0xf363=function(_0x201990,_0x1cfbc8){_0x201990=_0x201990-0x0;var _0x3490d5=_0x363f[_0x201990];return _0x3490d5;};'use strict';var multer=require(_0xf363('0x0'));var util=require(_0xf363('0x1'));var path=require(_0xf363('0x2'));var timeout=require('connect-timeout');var express=require(_0xf363('0x3'));var router=express[_0xf363('0x4')]();var fs_extra=require(_0xf363('0x5'));var auth=require(_0xf363('0x6'));var interaction=require(_0xf363('0x7'));var config=require(_0xf363('0x8'));var controller=require('./screenRecording.controller');router[_0xf363('0x9')]('/',auth[_0xf363('0xa')](),controller['index']);router[_0xf363('0x9')](_0xf363('0xb'),auth['isAuthenticated'](),controller[_0xf363('0xc')]);router[_0xf363('0x9')](_0xf363('0xd'),auth['isAuthenticated'](),controller[_0xf363('0xe')]);router[_0xf363('0x9')](_0xf363('0xf'),auth[_0xf363('0xa')](),controller[_0xf363('0x10')]);router[_0xf363('0x11')]('/',auth['isAuthenticated'](),controller[_0xf363('0x12')]);router[_0xf363('0x13')](_0xf363('0xd'),auth['isAuthenticated'](),controller[_0xf363('0x14')]);router[_0xf363('0x15')](_0xf363('0xd'),auth[_0xf363('0xa')](),controller[_0xf363('0x16')]);module[_0xf363('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4e6d62e..c1d36d3 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 _0x2884=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER','closedAt','duration','DATE','startedAt'];(function(_0x282419,_0x2809b6){var _0x317df2=function(_0xd07b9c){while(--_0xd07b9c){_0x282419['push'](_0x282419['shift']());}};_0x317df2(++_0x2809b6);}(_0x2884,0x1eb));var _0x4288=function(_0x96ad7d,_0x1017ba){_0x96ad7d=_0x96ad7d-0x0;var _0x32d63a=_0x2884[_0x96ad7d];return _0x32d63a;};'use strict';var Sequelize=require(_0x4288('0x0'));var moment=require('moment');var path=require(_0x4288('0x1'));var config=require(_0x4288('0x2'));module[_0x4288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4288('0x4')](_0x4288('0x5'))?path['extname'](this['getDataValue'](_0x4288('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4288('0x6')]},'channel':{'type':Sequelize[_0x4288('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x526a07){var _0x3a930e=_0x526a07['replace'](/\\/g,'/');this[_0x4288('0x7')](_0x4288('0x5'),_0x3a930e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4288('0x8')],'set':function(_0x3c8d6e){this[_0x4288('0x7')]('startedAt',moment()['subtract'](_0x3c8d6e,'ms'));this[_0x4288('0x7')](_0x4288('0x9'),moment());this[_0x4288('0x7')](_0x4288('0xa'),_0x3c8d6e);}},'startedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0xc')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'closedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')]('closedAt'))[_0x4288('0xf')](_0x4288('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this['getDataValue'](_0x4288('0x10')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'updatedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0x11')))[_0x4288('0xf')](_0x4288('0xd'))[_0x4288('0xe')]();}}}; \ No newline at end of file +var _0x5bc1=['createdAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','DATE','toString'];(function(_0x2cacc8,_0x2efb89){var _0xce30fc=function(_0x9cd784){while(--_0x9cd784){_0x2cacc8['push'](_0x2cacc8['shift']());}};_0xce30fc(++_0x2efb89);}(_0x5bc1,0xb5));var _0x15bc=function(_0x245772,_0x2c0818){_0x245772=_0x245772-0x0;var _0x1a1c3b=_0x5bc1[_0x245772];return _0x1a1c3b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x15bc('0x0'));var path=require(_0x15bc('0x1'));var config=require(_0x15bc('0x2'));module[_0x15bc('0x3')]={'format':{'type':Sequelize[_0x15bc('0x4')],'get':function(){return this[_0x15bc('0x5')]('value')?path['extname'](this[_0x15bc('0x5')](_0x15bc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x15bc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x15bc('0x7')],'set':function(_0x483c6d){var _0x344121=_0x483c6d[_0x15bc('0x8')](/\\/g,'/');this[_0x15bc('0x9')](_0x15bc('0x6'),_0x344121);}},'rating':{'type':Sequelize[_0x15bc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x15bc('0xa')],'set':function(_0x2bc60a){this[_0x15bc('0x9')](_0x15bc('0xb'),moment()[_0x15bc('0xc')](_0x2bc60a,'ms'));this['setDataValue'](_0x15bc('0xd'),moment());this[_0x15bc('0x9')](_0x15bc('0xe'),_0x2bc60a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0xb')))[_0x15bc('0xf')](_0x15bc('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0xd')))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}},'createdAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0x13')))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}},'updatedAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')]('updatedAt'))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 69a1b08..ca1113f 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 _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xf40dd5,_0x4fce75){_0xf40dd5=_0xf40dd5-0x0;var _0x165f41=_0x9c5a[_0xf40dd5];return _0x165f41;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file +var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xe41cb8,_0x79d5e8){var _0x579ec1=function(_0x1a19c5){while(--_0x1a19c5){_0xe41cb8['push'](_0xe41cb8['shift']());}};_0x579ec1(++_0x79d5e8);}(_0xee14,0x13a));var _0x4ee1=function(_0x222e34,_0x1c3062){_0x222e34=_0x222e34-0x0;var _0x1a16c8=_0xee14[_0x222e34];return _0x1a16c8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 23570f3..ad0f071 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 _0x0b3e=['moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger','api'];(function(_0x2641c3,_0x3511a2){var _0xef0386=function(_0x523099){while(--_0x523099){_0x2641c3['push'](_0x2641c3['shift']());}};_0xef0386(++_0x3511a2);}(_0x0b3e,0x142));var _0xe0b3=function(_0x2f182c,_0x102927){_0x2f182c=_0x2f182c-0x0;var _0x2898bc=_0x0b3e[_0x2f182c];return _0x2898bc;};'use strict';var _=require('lodash');var util=require(_0xe0b3('0x0'));var logger=require(_0xe0b3('0x1'))(_0xe0b3('0x2'));var moment=require(_0xe0b3('0x3'));var BPromise=require(_0xe0b3('0x4'));var rp=require(_0xe0b3('0x5'));var fs=require('fs');var path=require(_0xe0b3('0x6'));var rimraf=require('rimraf');var config=require(_0xe0b3('0x7'));var attributes=require(_0xe0b3('0x8'));module[_0xe0b3('0x9')]=function(_0x3d2ccb,_0x119d75){return _0x3d2ccb[_0xe0b3('0xa')]('ScreenRecording',attributes,{'tableName':_0xe0b3('0xb'),'paranoid':![],'indexes':[{'name':_0xe0b3('0xc'),'fields':[_0xe0b3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74ce=['request-promise','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird'];(function(_0x52acd3,_0x5cf75c){var _0x102b9d=function(_0x408601){while(--_0x408601){_0x52acd3['push'](_0x52acd3['shift']());}};_0x102b9d(++_0x5cf75c);}(_0x74ce,0x1e7));var _0xe74c=function(_0x2ba2db,_0x3779fc){_0x2ba2db=_0x2ba2db-0x0;var _0x5eb644=_0x74ce[_0x2ba2db];return _0x5eb644;};'use strict';var _=require('lodash');var util=require(_0xe74c('0x0'));var logger=require(_0xe74c('0x1'))(_0xe74c('0x2'));var moment=require(_0xe74c('0x3'));var BPromise=require(_0xe74c('0x4'));var rp=require(_0xe74c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe74c('0x6'));var config=require('../../config/environment');var attributes=require(_0xe74c('0x7'));module[_0xe74c('0x8')]=function(_0x3ed12d,_0x381bf5){return _0x3ed12d[_0xe74c('0x9')]('ScreenRecording',attributes,{'tableName':_0xe74c('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xe74c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 1f25365..e59f042 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 _0x8c98=['info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x1f8541,_0x478be6){var _0x58d505=function(_0x4ad5c3){while(--_0x4ad5c3){_0x1f8541['push'](_0x1f8541['shift']());}};_0x58d505(++_0x478be6);}(_0x8c98,0x172));var _0x88c9=function(_0x30fd00,_0x33a97f){_0x30fd00=_0x30fd00-0x0;var _0x2626f2=_0x8c98[_0x30fd00];return _0x2626f2;};'use strict';var _=require(_0x88c9('0x0'));var util=require(_0x88c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88c9('0x2'));var fs=require('fs');var Redis=require(_0x88c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x88c9('0x4'));var logger=require(_0x88c9('0x5'))('rpc');var config=require(_0x88c9('0x6'));var jayson=require(_0x88c9('0x7'));var client=jayson['client'][_0x88c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x206765,_0x2ef759,_0x3e888f){return new BPromise(function(_0x440d73,_0x207817){return client[_0x88c9('0x9')](_0x206765,_0x3e888f)['then'](function(_0x502810){logger[_0x88c9('0xa')](_0x88c9('0xb'),_0x2ef759,_0x88c9('0xc'));logger['debug'](_0x88c9('0xd'),_0x2ef759,'request\x20sent',JSON[_0x88c9('0xe')](_0x502810));if(_0x502810[_0x88c9('0xf')]){if(_0x502810[_0x88c9('0xf')][_0x88c9('0x10')]===0x1f4){logger[_0x88c9('0xf')](_0x88c9('0xb'),_0x2ef759,_0x502810[_0x88c9('0xf')][_0x88c9('0x11')]);return _0x207817(_0x502810[_0x88c9('0xf')][_0x88c9('0x11')]);}logger[_0x88c9('0xf')](_0x88c9('0xb'),_0x2ef759,_0x502810[_0x88c9('0xf')][_0x88c9('0x11')]);return _0x440d73(_0x502810[_0x88c9('0xf')][_0x88c9('0x11')]);}else{logger[_0x88c9('0xa')](_0x88c9('0xb'),_0x2ef759,_0x88c9('0xc'));_0x440d73(_0x502810['result'][_0x88c9('0x11')]);}})[_0x88c9('0x12')](function(_0x3cd67a){logger[_0x88c9('0xf')](_0x88c9('0xb'),_0x2ef759,_0x3cd67a);_0x207817(_0x3cd67a);});});} \ No newline at end of file +var _0x31bb=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x54675f,_0x5d2c19){var _0x302c74=function(_0x2bfc1c){while(--_0x2bfc1c){_0x54675f['push'](_0x54675f['shift']());}};_0x302c74(++_0x5d2c19);}(_0x31bb,0x121));var _0xb31b=function(_0x11c15b,_0x48aa13){_0x11c15b=_0x11c15b-0x0;var _0x124402=_0x31bb[_0x11c15b];return _0x124402;};'use strict';var _=require(_0xb31b('0x0'));var util=require(_0xb31b('0x1'));var moment=require(_0xb31b('0x2'));var BPromise=require(_0xb31b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb31b('0x4'));var db=require(_0xb31b('0x5'))['db'];var utils=require(_0xb31b('0x6'));var logger=require(_0xb31b('0x7'))(_0xb31b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb31b('0x9')][_0xb31b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235bc6,_0x2b5654,_0x47eca4){return new BPromise(function(_0x49ec1c,_0x336918){return client[_0xb31b('0xb')](_0x235bc6,_0x47eca4)[_0xb31b('0xc')](function(_0x16be21){logger[_0xb31b('0xd')](_0xb31b('0xe'),_0x2b5654,'request\x20sent');logger[_0xb31b('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x2b5654,_0xb31b('0x10'),JSON[_0xb31b('0x11')](_0x16be21));if(_0x16be21[_0xb31b('0x12')]){if(_0x16be21['error'][_0xb31b('0x13')]===0x1f4){logger[_0xb31b('0x12')](_0xb31b('0xe'),_0x2b5654,_0x16be21[_0xb31b('0x12')][_0xb31b('0x14')]);return _0x336918(_0x16be21[_0xb31b('0x12')][_0xb31b('0x14')]);}logger[_0xb31b('0x12')](_0xb31b('0xe'),_0x2b5654,_0x16be21[_0xb31b('0x12')][_0xb31b('0x14')]);return _0x49ec1c(_0x16be21['error']['message']);}else{logger[_0xb31b('0xd')](_0xb31b('0xe'),_0x2b5654,'request\x20sent');_0x49ec1c(_0x16be21[_0xb31b('0x15')][_0xb31b('0x14')]);}})[_0xb31b('0x16')](function(_0xae82ba){logger[_0xb31b('0x12')](_0xb31b('0xe'),_0x2b5654,_0xae82ba);_0x336918(_0xae82ba);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 511fa24..0ae0b83 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 _0x1c09=['/:id/preferred','addPreferred','favicon','addFavicon','put','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','getDate','/:id','show','getLogoLogin','/:id/gdpr','gdpr','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','logologin','/:id/logo_login','single','preferred'];(function(_0x1e7060,_0x453e1a){var _0x4233cf=function(_0x456a3e){while(--_0x456a3e){_0x1e7060['push'](_0x1e7060['shift']());}};_0x4233cf(++_0x453e1a);}(_0x1c09,0x101));var _0x91c0=function(_0x3c1c49,_0x127345){_0x3c1c49=_0x3c1c49-0x0;var _0x346bb6=_0x1c09[_0x3c1c49];return _0x346bb6;};'use strict';var multer=require(_0x91c0('0x0'));var util=require('util');var path=require(_0x91c0('0x1'));var timeout=require(_0x91c0('0x2'));var express=require(_0x91c0('0x3'));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(_0x91c0('0x9'));router['get']('/',auth[_0x91c0('0xa')](),controller[_0x91c0('0xb')]);router[_0x91c0('0xc')]('/now',controller[_0x91c0('0xd')]);router[_0x91c0('0xc')](_0x91c0('0xe'),controller[_0x91c0('0xf')]);router[_0x91c0('0xc')]('/:id/logo',controller['getLogo']);router['get']('/:id/logo_login',controller[_0x91c0('0x10')]);router[_0x91c0('0xc')](_0x91c0('0x11'),controller[_0x91c0('0x12')]);router[_0x91c0('0xc')]('/:id/preferred',controller[_0x91c0('0x13')]);router[_0x91c0('0xc')]('/:id/favicon',controller[_0x91c0('0x14')]);var upload=multer({'storage':multer[_0x91c0('0x15')]({'destination':function(_0x1c0d84,_0x3ea322,_0x16acf5){_0x16acf5(null,path[_0x91c0('0x16')](config[_0x91c0('0x17')],_0x91c0('0x18')));},'filename':function(_0x3e0ccd,_0x595ad6,_0x37d5ab){_0x37d5ab(null,util[_0x91c0('0x19')](_0x91c0('0x1a'),_0x91c0('0x1b'),path[_0x91c0('0x1c')](_0x595ad6[_0x91c0('0x1d')])));}})});router[_0x91c0('0x1e')]('/:id/logo',upload['single'](_0x91c0('0x1f')),controller[_0x91c0('0x20')]);var upload=multer({'storage':multer[_0x91c0('0x15')]({'destination':function(_0x1df7e7,_0x5f590b,_0x152138){_0x152138(null,path[_0x91c0('0x16')](config[_0x91c0('0x17')],_0x91c0('0x18')));},'filename':function(_0x1583a7,_0x25111c,_0x1f70ab){_0x1f70ab(null,util[_0x91c0('0x19')](_0x91c0('0x1a'),_0x91c0('0x21'),path[_0x91c0('0x1c')](_0x25111c[_0x91c0('0x1d')])));}})});router['post'](_0x91c0('0x22'),upload[_0x91c0('0x23')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x91c0('0x15')]({'destination':function(_0x4cc1f3,_0x5e36f6,_0x26173f){_0x26173f(null,path[_0x91c0('0x16')](config[_0x91c0('0x17')],_0x91c0('0x18')));},'filename':function(_0x1b87ee,_0x4e3430,_0x2aaa8d){_0x2aaa8d(null,util[_0x91c0('0x19')](_0x91c0('0x1a'),_0x91c0('0x24'),path[_0x91c0('0x1c')](_0x4e3430['originalname'])));}})});router[_0x91c0('0x1e')](_0x91c0('0x25'),upload[_0x91c0('0x23')](_0x91c0('0x1f')),controller[_0x91c0('0x26')]);var upload=multer({'storage':multer[_0x91c0('0x15')]({'destination':function(_0x2f95f3,_0x2defcc,_0x37f45e){_0x37f45e(null,path[_0x91c0('0x16')](config[_0x91c0('0x17')],_0x91c0('0x18')));},'filename':function(_0x258d14,_0x252245,_0x2228f6){_0x2228f6(null,util[_0x91c0('0x19')]('%s%s',_0x91c0('0x27'),path[_0x91c0('0x1c')](_0x252245[_0x91c0('0x1d')])));}})});router[_0x91c0('0x1e')]('/:id/favicon',upload[_0x91c0('0x23')](_0x91c0('0x1f')),controller[_0x91c0('0x28')]);router[_0x91c0('0x29')](_0x91c0('0xe'),auth[_0x91c0('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x3eb2=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','index','get','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','format','%s%s','logo','extname','originalname','post','single','file','addLogo','root','server/files/images/logos/','logologin','addLogoLogin','preferred','addPreferred','addFavicon','put','exports'];(function(_0x34dd7d,_0x292398){var _0x2cd95b=function(_0x24e7d8){while(--_0x24e7d8){_0x34dd7d['push'](_0x34dd7d['shift']());}};_0x2cd95b(++_0x292398);}(_0x3eb2,0x171));var _0x23eb=function(_0x38154f,_0xf0d239){_0x38154f=_0x38154f-0x0;var _0x9e29fe=_0x3eb2[_0x38154f];return _0x9e29fe;};'use strict';var multer=require(_0x23eb('0x0'));var util=require('util');var path=require(_0x23eb('0x1'));var timeout=require(_0x23eb('0x2'));var express=require('express');var router=express[_0x23eb('0x3')]();var fs_extra=require(_0x23eb('0x4'));var auth=require(_0x23eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x23eb('0x6'));var controller=require(_0x23eb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x23eb('0x8')]);router[_0x23eb('0x9')]('/now',controller[_0x23eb('0xa')]);router[_0x23eb('0x9')](_0x23eb('0xb'),controller[_0x23eb('0xc')]);router[_0x23eb('0x9')]('/:id/logo',controller[_0x23eb('0xd')]);router[_0x23eb('0x9')](_0x23eb('0xe'),controller[_0x23eb('0xf')]);router[_0x23eb('0x9')](_0x23eb('0x10'),controller[_0x23eb('0x11')]);router['get'](_0x23eb('0x12'),controller['getPreferred']);router[_0x23eb('0x9')](_0x23eb('0x13'),controller[_0x23eb('0x14')]);var upload=multer({'storage':multer[_0x23eb('0x15')]({'destination':function(_0x148766,_0x1ff20a,_0x5c7e6f){_0x5c7e6f(null,path[_0x23eb('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1a5fa4,_0x532fca,_0x1ff22f){_0x1ff22f(null,util[_0x23eb('0x17')](_0x23eb('0x18'),_0x23eb('0x19'),path[_0x23eb('0x1a')](_0x532fca[_0x23eb('0x1b')])));}})});router[_0x23eb('0x1c')]('/:id/logo',upload[_0x23eb('0x1d')](_0x23eb('0x1e')),controller[_0x23eb('0x1f')]);var upload=multer({'storage':multer[_0x23eb('0x15')]({'destination':function(_0x1bf7ea,_0x3e98b1,_0x3fed28){_0x3fed28(null,path[_0x23eb('0x16')](config[_0x23eb('0x20')],_0x23eb('0x21')));},'filename':function(_0x344d05,_0x8baf2a,_0x1c7e67){_0x1c7e67(null,util[_0x23eb('0x17')](_0x23eb('0x18'),_0x23eb('0x22'),path[_0x23eb('0x1a')](_0x8baf2a[_0x23eb('0x1b')])));}})});router['post'](_0x23eb('0xe'),upload[_0x23eb('0x1d')]('file'),controller[_0x23eb('0x23')]);var upload=multer({'storage':multer[_0x23eb('0x15')]({'destination':function(_0xa61281,_0x3c7d3a,_0x45debc){_0x45debc(null,path[_0x23eb('0x16')](config[_0x23eb('0x20')],_0x23eb('0x21')));},'filename':function(_0x188db4,_0x497606,_0xd1913d){_0xd1913d(null,util['format']('%s%s',_0x23eb('0x24'),path[_0x23eb('0x1a')](_0x497606[_0x23eb('0x1b')])));}})});router[_0x23eb('0x1c')](_0x23eb('0x12'),upload[_0x23eb('0x1d')](_0x23eb('0x1e')),controller[_0x23eb('0x25')]);var upload=multer({'storage':multer[_0x23eb('0x15')]({'destination':function(_0x5c094b,_0x50d80a,_0x5df825){_0x5df825(null,path[_0x23eb('0x16')](config[_0x23eb('0x20')],_0x23eb('0x21')));},'filename':function(_0x5be538,_0x2ab505,_0x3a0969){_0x3a0969(null,util[_0x23eb('0x17')](_0x23eb('0x18'),'favicon',path[_0x23eb('0x1a')](_0x2ab505[_0x23eb('0x1b')])));}})});router[_0x23eb('0x1c')](_0x23eb('0x13'),upload[_0x23eb('0x1d')](_0x23eb('0x1e')),controller[_0x23eb('0x26')]);router[_0x23eb('0x27')](_0x23eb('0xb'),auth['isAuthenticated'](),controller['update']);module[_0x23eb('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 715add3..d7efba3 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 _0xf4ce=['min_internal','INTEGER','min_mailbox','BOOLEAN','STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x264d7d,_0x1f2358){var _0x55ca61=function(_0x10503e){while(--_0x10503e){_0x264d7d['push'](_0x264d7d['shift']());}};_0x55ca61(++_0x1f2358);}(_0xf4ce,0xf2));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xef4c('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xef4c('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xef4c('0x2')](0xb),'unique':_0xef4c('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xef4c('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xef4c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xef4c('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xef4c('0x5')]},'turnpassword':{'type':Sequelize[_0xef4c('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xef4c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xef4c('0x5')],'defaultValue':_0xef4c('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xef4c('0x5')],'defaultValue':_0xef4c('0x7')},'chatTimeout':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xef4c('0x5')]},'defaultPreferred':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xef4c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xef4c('0x5')]},'defaultFavicon':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xef4c('0x2')]},'transcribeRegion':{'type':Sequelize[_0xef4c('0x5')]},'sentiment':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xef4c('0x2')]},'sentimentRegion':{'type':Sequelize[_0xef4c('0x5')]},'language':{'type':Sequelize[_0xef4c('0x5')]},'bucket':{'type':Sequelize[_0xef4c('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xef4c('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xef4c('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xef4c('0x2')](0x2)[_0xef4c('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xef4c('0x2')](0x2)[_0xef4c('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xef4c('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xef4c('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xaf9f=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1108ce,_0x588fd9){var _0x2b13cf=function(_0x283d87){while(--_0x283d87){_0x1108ce['push'](_0x1108ce['shift']());}};_0x2b13cf(++_0x588fd9);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xaf9f[_0x261522];return _0x98a25a;};'use strict';var Sequelize=require(_0xfaf9('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xfaf9('0x1')](0xb),'unique':_0xfaf9('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xfaf9('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xfaf9('0x3')],'defaultValue':_0xfaf9('0x4')},'logo':{'type':Sequelize[_0xfaf9('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xfaf9('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xfaf9('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xfaf9('0x3')]},'turnpassword':{'type':Sequelize[_0xfaf9('0x3')]},'pageTitle':{'type':Sequelize[_0xfaf9('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xfaf9('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xfaf9('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xfaf9('0x7')},'chatTimeout':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xfaf9('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xfaf9('0x3')]},'defaultFavicon':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xfaf9('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xfaf9('0x1')]},'sentimentRegion':{'type':Sequelize[_0xfaf9('0x3')]},'language':{'type':Sequelize[_0xfaf9('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xfaf9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xfaf9('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xfaf9('0x1')](0x2)[_0xfaf9('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xfaf9('0x1')](0x2)[_0xfaf9('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xfaf9('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xfaf9('0x1')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c637418..f0da88f 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 _0xc095=['defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','upperFirst','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','preferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','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/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','client','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','body','find','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo'];(function(_0x17ae09,_0x1f326d){var _0x152e29=function(_0x3f159a){while(--_0x3f159a){_0x17ae09['push'](_0x17ae09['shift']());}};_0x152e29(++_0x1f326d);}(_0xc095,0x18c));var _0x5c09=function(_0x4e1340,_0x11ed37){_0x4e1340=_0x4e1340-0x0;var _0xb389a2=_0xc095[_0x4e1340];return _0xb389a2;};'use strict';var emlformat=require(_0x5c09('0x0'));var rimraf=require(_0x5c09('0x1'));var zipdir=require(_0x5c09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c09('0x3'));var moment=require(_0x5c09('0x4'));var BPromise=require(_0x5c09('0x5'));var Mustache=require(_0x5c09('0x6'));var util=require(_0x5c09('0x7'));var path=require(_0x5c09('0x8'));var sox=require(_0x5c09('0x9'));var csv=require(_0x5c09('0xa'));var ejs=require(_0x5c09('0xb'));var fs=require('fs');var fs_extra=require(_0x5c09('0xc'));var _=require(_0x5c09('0xd'));var squel=require(_0x5c09('0xe'));var crypto=require(_0x5c09('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5c09('0x10'));var toCsv=require(_0x5c09('0xa'));var querystring=require(_0x5c09('0x11'));var Papa=require(_0x5c09('0x12'));var Redis=require('ioredis');var authService=require(_0x5c09('0x13'));var qs=require(_0x5c09('0x14'));var as=require(_0x5c09('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c09('0x16'));var utils=require(_0x5c09('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5c09('0x18'));var db=require(_0x5c09('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5c09('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213f9f,_0x5b7ffc,_0x9fa051,_0x19579c){return new BPromise(function(_0x1a29f4,_0x432f5a){var _0xcdb0cf=_0x19579c||client;return _0xcdb0cf[_0x5c09('0x1b')](_0x213f9f,_0x9fa051)[_0x5c09('0x1c')](function(_0x11dae2){logger[_0x5c09('0x1d')](_0x5c09('0x1e'),_0x5b7ffc,'request\x20sent');logger[_0x5c09('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x5b7ffc,_0x5c09('0x20'),JSON[_0x5c09('0x21')](_0x11dae2));if(_0x11dae2[_0x5c09('0x22')]){if(_0x11dae2[_0x5c09('0x22')]['code']===0x1f4){logger[_0x5c09('0x22')](_0x5c09('0x1e'),_0x5b7ffc,_0x11dae2[_0x5c09('0x22')][_0x5c09('0x23')]);return _0x432f5a(_0x11dae2[_0x5c09('0x22')][_0x5c09('0x23')]);}logger[_0x5c09('0x22')](_0x5c09('0x1e'),_0x5b7ffc,_0x11dae2[_0x5c09('0x22')][_0x5c09('0x23')]);return _0x1a29f4(_0x11dae2[_0x5c09('0x22')][_0x5c09('0x23')]);}else{logger[_0x5c09('0x1d')](_0x5c09('0x1e'),_0x5b7ffc,_0x5c09('0x20'));_0x1a29f4(_0x11dae2[_0x5c09('0x24')][_0x5c09('0x23')]);}})['catch'](function(_0x3aecab){logger[_0x5c09('0x22')](_0x5c09('0x1e'),_0x5b7ffc,_0x3aecab);_0x432f5a(_0x3aecab);});});}function respondWithStatusCode(_0x32b1d4,_0x4ff239){_0x4ff239=_0x4ff239||0xcc;return function(_0x2492e1){if(_0x2492e1){return _0x32b1d4[_0x5c09('0x25')](_0x4ff239);}return _0x32b1d4['status'](_0x4ff239)[_0x5c09('0x26')]();};}function respondWithResult(_0x5c3ad7,_0x112f11){_0x112f11=_0x112f11||0xc8;return function(_0x241edf){if(_0x241edf){return _0x5c3ad7[_0x5c09('0x27')](_0x112f11)[_0x5c09('0x28')](_0x241edf);}};}function respondWithFilteredResult(_0x2ea46f,_0x5f5e19){return function(_0x56587a){if(_0x56587a){var _0x1df169=typeof _0x5f5e19[_0x5c09('0x29')]===_0x5c09('0x2a')&&typeof _0x5f5e19[_0x5c09('0x2b')]===_0x5c09('0x2a');var _0x11938d=_0x56587a[_0x5c09('0x2c')];var _0x4825ed=_0x1df169?0x0:_0x5f5e19['offset'];var _0x28563b=_0x1df169?_0x56587a[_0x5c09('0x2c')]:_0x5f5e19[_0x5c09('0x29')]+_0x5f5e19['limit'];var _0x329e1f;if(_0x28563b>=_0x11938d){_0x28563b=_0x11938d;_0x329e1f=0xc8;}else{_0x329e1f=0xce;}_0x2ea46f[_0x5c09('0x27')](_0x329e1f);return _0x2ea46f[_0x5c09('0x2d')](_0x5c09('0x2e'),_0x4825ed+'-'+_0x28563b+'/'+_0x11938d)[_0x5c09('0x28')](_0x56587a);}return null;};}function patchUpdates(_0x579de8){return function(_0x558fdb){try{jsonpatch[_0x5c09('0x2f')](_0x558fdb,_0x579de8,!![]);}catch(_0xa59aac){return BPromise['reject'](_0xa59aac);}return _0x558fdb[_0x5c09('0x30')]();};}function saveUpdates(_0xa3d069,_0x486f26){return function(_0x52bcbd){if(_0x52bcbd){return _0x52bcbd[_0x5c09('0x31')](_0xa3d069)['then'](function(_0xa654a4){return _0xa654a4;});}return null;};}function removeEntity(_0x14ec23,_0x44d63c){return function(_0x8dd4a3){if(_0x8dd4a3){return _0x8dd4a3['destroy']()[_0x5c09('0x1c')](function(){_0x14ec23[_0x5c09('0x27')](0xcc)[_0x5c09('0x26')]();});}};}function handleEntityNotFound(_0x16a010,_0x658517){return function(_0x45ba0c){if(!_0x45ba0c){_0x16a010[_0x5c09('0x25')](0x194);}return _0x45ba0c;};}function handleError(_0x191531,_0x46167d){_0x46167d=_0x46167d||0x1f4;return function(_0x316d54){logger['error'](_0x316d54[_0x5c09('0x32')]);if(_0x316d54['name']){delete _0x316d54[_0x5c09('0x33')];}_0x191531['status'](_0x46167d)['send'](_0x316d54);};}exports[_0x5c09('0x34')]=function(_0x754280,_0x1d9d1c){var _0x3311c0={},_0x6fe33f={},_0x375b6f={'count':0x0,'rows':[]};var _0x287d73=_[_0x5c09('0x35')](db[_0x5c09('0x36')]['rawAttributes'],function(_0x2d60d8){return{'name':_0x2d60d8[_0x5c09('0x37')],'type':_0x2d60d8[_0x5c09('0x38')][_0x5c09('0x39')]};});_0x6fe33f[_0x5c09('0x3a')]=_[_0x5c09('0x35')](_0x287d73,_0x5c09('0x33'));_0x6fe33f[_0x5c09('0x3b')]=_[_0x5c09('0x3c')](_0x754280[_0x5c09('0x3b')]);_0x6fe33f[_0x5c09('0x3d')]=_[_0x5c09('0x3e')](_0x6fe33f[_0x5c09('0x3a')],_0x6fe33f[_0x5c09('0x3b')]);_0x3311c0[_0x5c09('0x3f')]=_['intersection'](_0x6fe33f[_0x5c09('0x3a')],qs[_0x5c09('0x40')](_0x754280[_0x5c09('0x3b')][_0x5c09('0x40')]));_0x3311c0[_0x5c09('0x3f')]=_0x3311c0['attributes'][_0x5c09('0x41')]?_0x3311c0[_0x5c09('0x3f')]:_0x6fe33f['model'];if(!_0x754280[_0x5c09('0x3b')]['hasOwnProperty'](_0x5c09('0x42'))){_0x3311c0['limit']=qs[_0x5c09('0x2b')](_0x754280['query']['limit']);_0x3311c0[_0x5c09('0x29')]=qs[_0x5c09('0x29')](_0x754280['query'][_0x5c09('0x29')]);}_0x3311c0['order']=qs[_0x5c09('0x43')](_0x754280[_0x5c09('0x3b')][_0x5c09('0x43')]);_0x3311c0[_0x5c09('0x44')]=qs[_0x5c09('0x3d')](_[_0x5c09('0x45')](_0x754280['query'],_0x6fe33f['filters']),_0x287d73);if(_0x754280['query'][_0x5c09('0x46')]){_0x3311c0[_0x5c09('0x44')]=_[_0x5c09('0x47')](_0x3311c0[_0x5c09('0x44')],{'$or':_[_0x5c09('0x35')](_0x287d73,function(_0xd617c){if(_0xd617c['type']!==_0x5c09('0x48')){var _0x3fe8b8={};_0x3fe8b8[_0xd617c[_0x5c09('0x33')]]={'$like':'%'+_0x754280[_0x5c09('0x3b')][_0x5c09('0x46')]+'%'};return _0x3fe8b8;}})});}_0x3311c0=_[_0x5c09('0x47')]({},_0x3311c0,_0x754280[_0x5c09('0x49')]);var _0x1af222={'where':_0x3311c0[_0x5c09('0x44')]};return db[_0x5c09('0x36')]['count'](_0x1af222)[_0x5c09('0x1c')](function(_0x41f7e5){_0x375b6f['count']=_0x41f7e5;if(_0x754280[_0x5c09('0x3b')]['includeAll']){_0x3311c0[_0x5c09('0x4a')]=[{'all':!![]}];}return db[_0x5c09('0x36')][_0x5c09('0x4b')](_0x3311c0);})[_0x5c09('0x1c')](function(_0x20b98a){_0x375b6f[_0x5c09('0x4c')]=_0x20b98a;return _0x375b6f;})[_0x5c09('0x1c')](respondWithFilteredResult(_0x1d9d1c,_0x3311c0))[_0x5c09('0x4d')](handleError(_0x1d9d1c,null));};exports[_0x5c09('0x4e')]=function(_0x188dcf,_0x12fa73){var _0x2a68a6={'raw':![],'where':{'id':_0x188dcf[_0x5c09('0x4f')]['id']}},_0x5d4dd4={};_0x5d4dd4['model']=_[_0x5c09('0x3c')](db[_0x5c09('0x36')][_0x5c09('0x50')]);_0x5d4dd4['query']=_[_0x5c09('0x3c')](_0x188dcf['query']);_0x5d4dd4['filters']=_[_0x5c09('0x3e')](_0x5d4dd4['model'],_0x5d4dd4[_0x5c09('0x3b')]);_0x2a68a6[_0x5c09('0x3f')]=_[_0x5c09('0x3e')](_0x5d4dd4[_0x5c09('0x3a')],qs['fields'](_0x188dcf[_0x5c09('0x3b')][_0x5c09('0x40')]));_0x2a68a6[_0x5c09('0x3f')]=_0x2a68a6[_0x5c09('0x3f')][_0x5c09('0x41')]?_0x2a68a6[_0x5c09('0x3f')]:_0x5d4dd4[_0x5c09('0x3a')];if(_0x188dcf[_0x5c09('0x3b')]['includeAll']){_0x2a68a6[_0x5c09('0x4a')]=[{'all':!![]}];}_0x2a68a6=_[_0x5c09('0x47')]({},_0x2a68a6,_0x188dcf[_0x5c09('0x49')]);return db[_0x5c09('0x36')]['find'](_0x2a68a6)[_0x5c09('0x1c')](handleEntityNotFound(_0x12fa73,null))[_0x5c09('0x1c')](respondWithResult(_0x12fa73,null))[_0x5c09('0x4d')](handleError(_0x12fa73,null));};exports[_0x5c09('0x31')]=function(_0x8eacc9,_0x59d057){if(_0x8eacc9[_0x5c09('0x51')]['id']){delete _0x8eacc9[_0x5c09('0x51')]['id'];}return db[_0x5c09('0x36')][_0x5c09('0x52')]({'where':{'id':_0x8eacc9[_0x5c09('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59d057,null))[_0x5c09('0x1c')](saveUpdates(_0x8eacc9[_0x5c09('0x51')],null))[_0x5c09('0x1c')](respondWithResult(_0x59d057,null))[_0x5c09('0x4d')](handleError(_0x59d057,null));};exports['addLogo']=function(_0x559ee6,_0x321430,_0x21b9a3){if(_0x559ee6['file']&&_0x559ee6[_0x5c09('0x53')][_0x5c09('0x54')]){_0x559ee6[_0x5c09('0x51')][_0x5c09('0x55')]=_0x559ee6[_0x5c09('0x53')][_0x5c09('0x54')];}return db['Setting'][_0x5c09('0x52')]({'where':{'id':_0x559ee6['params']['id']}})[_0x5c09('0x1c')](handleEntityNotFound(_0x321430,null))[_0x5c09('0x1c')](saveUpdates(_0x559ee6[_0x5c09('0x51')],null))[_0x5c09('0x1c')](respondWithResult(_0x321430,null))[_0x5c09('0x4d')](handleError(_0x321430,null));};exports['addLogoLogin']=function(_0x831777,_0x3051f5,_0x5052c2){if(_0x831777[_0x5c09('0x53')]&&_0x831777[_0x5c09('0x53')][_0x5c09('0x54')]){_0x831777[_0x5c09('0x51')][_0x5c09('0x56')]=_0x831777[_0x5c09('0x53')][_0x5c09('0x54')];}return db[_0x5c09('0x36')][_0x5c09('0x52')]({'where':{'id':_0x831777[_0x5c09('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3051f5,null))[_0x5c09('0x1c')](saveUpdates(_0x831777[_0x5c09('0x51')],null))[_0x5c09('0x1c')](respondWithResult(_0x3051f5,null))[_0x5c09('0x4d')](handleError(_0x3051f5,null));};var utilLicense=require(_0x5c09('0x18'));exports[_0x5c09('0x57')]=function(_0x221652,_0x38835e,_0x3a8b96){var _0xb40017=_0x5c09('0x58');var _0x2e98af={'custom':![]};return utilLicense[_0x5c09('0x59')]()['then'](function(_0x1f178c){if(_0x1f178c){_0x2e98af=_0x1f178c;}return db[_0x5c09('0x36')][_0x5c09('0x52')]({'where':{'id':_0x221652[_0x5c09('0x4f')]['id']},'attributes':[_0x5c09('0x55'),_0x5c09('0x56'),'preferred',_0x5c09('0x5a'),_0x5c09('0x5b'),_0x5c09('0x5c'),'defaultPreferred',_0x5c09('0x5d')],'raw':!![]});})[_0x5c09('0x1c')](handleEntityNotFound(_0x38835e,null))[_0x5c09('0x1c')](function(_0x52ba4c){if(_0x52ba4c){var _0x117aa9=_0x52ba4c['logo']&&fs[_0x5c09('0x5e')](path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0xb40017,_[_0x5c09('0x61')](_0x52ba4c['logo'])))?path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0xb40017,_[_0x5c09('0x61')](_0x52ba4c[_0x5c09('0x55')])):path['join'](config['root'],_0xb40017,_['toLower'](_0x5c09('0x62')));var _0x579b86=_0x5c09('0x63')+_['upperFirst'](_0x5c09('0x55'));if(_0x52ba4c[_0x579b86]||!_0x2e98af[_0x5c09('0x64')]){_0x117aa9=path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0xb40017,_[_0x5c09('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0x117aa9)){throw new db[(_0x5c09('0x65'))]['ValidationError'](_[_0x5c09('0x66')]('logo')+'\x20not\x20found');}return _0x38835e[_0x5c09('0x67')](_0x117aa9);}})[_0x5c09('0x4d')](handleError(_0x38835e,null));};var utilLicense=require('../../config/license/util');exports[_0x5c09('0x68')]=function(_0x38eaa2,_0x33a6d9,_0x33f22e){var _0x2dadc1=_0x5c09('0x58');var _0x41c115={'custom':![]};return utilLicense[_0x5c09('0x59')]()['then'](function(_0x2cd5ee){if(_0x2cd5ee){_0x41c115=_0x2cd5ee;}return db[_0x5c09('0x36')][_0x5c09('0x52')]({'where':{'id':_0x38eaa2[_0x5c09('0x4f')]['id']},'attributes':[_0x5c09('0x55'),_0x5c09('0x56'),'preferred',_0x5c09('0x5a'),'defaultLogo',_0x5c09('0x5c'),_0x5c09('0x69'),'defaultFavicon'],'raw':!![]});})[_0x5c09('0x1c')](handleEntityNotFound(_0x33a6d9,null))[_0x5c09('0x1c')](function(_0x410847){if(_0x410847){var _0x5b1b6a=_0x410847[_0x5c09('0x56')]&&fs['existsSync'](path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x2dadc1,_['toLower'](_0x410847[_0x5c09('0x56')])))?path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x2dadc1,_[_0x5c09('0x61')](_0x410847['loginLogo'])):path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x2dadc1,_[_0x5c09('0x61')](_0x5c09('0x6a')));var _0x3b9aea=_0x5c09('0x63')+_[_0x5c09('0x66')](_0x5c09('0x56'));if(_0x410847[_0x3b9aea]||!_0x41c115[_0x5c09('0x64')]){_0x5b1b6a=path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x2dadc1,_['toLower'](_0x5c09('0x6a')));}if(!fs[_0x5c09('0x5e')](_0x5b1b6a)){throw new db[(_0x5c09('0x65'))][(_0x5c09('0x6b'))](_[_0x5c09('0x66')]('loginLogo')+_0x5c09('0x6c'));}return _0x33a6d9[_0x5c09('0x67')](_0x5b1b6a);}})[_0x5c09('0x4d')](handleError(_0x33a6d9,null));};exports[_0x5c09('0x6d')]=function(_0x2236d9,_0x3e5a99){return db[_0x5c09('0x36')][_0x5c09('0x52')]({'where':{'id':_0x2236d9[_0x5c09('0x4f')]['id']},'attributes':[_0x5c09('0x6e')]})[_0x5c09('0x1c')](respondWithResult(_0x3e5a99,null))['catch'](handleError(_0x3e5a99,null));};exports[_0x5c09('0x6f')]=function(_0x2220e4,_0x2d7bbc,_0x47712c){if(_0x2220e4[_0x5c09('0x53')]&&_0x2220e4[_0x5c09('0x53')][_0x5c09('0x54')]){_0x2220e4[_0x5c09('0x51')][_0x5c09('0x70')]=_0x2220e4[_0x5c09('0x53')][_0x5c09('0x54')];}return db[_0x5c09('0x36')]['find']({'where':{'id':_0x2220e4[_0x5c09('0x4f')]['id']}})[_0x5c09('0x1c')](handleEntityNotFound(_0x2d7bbc,null))[_0x5c09('0x1c')](saveUpdates(_0x2220e4[_0x5c09('0x51')],null))[_0x5c09('0x1c')](respondWithResult(_0x2d7bbc,null))['catch'](handleError(_0x2d7bbc,null));};var utilLicense=require('../../config/license/util');exports[_0x5c09('0x71')]=function(_0x54de8b,_0x3e2ad7,_0x5dcd62){var _0x394b5d=_0x5c09('0x58');var _0x3e886a={'custom':![]};return utilLicense[_0x5c09('0x59')]()[_0x5c09('0x1c')](function(_0x105173){if(_0x105173){_0x3e886a=_0x105173;}return db['Setting']['find']({'where':{'id':_0x54de8b['params']['id']},'attributes':[_0x5c09('0x55'),_0x5c09('0x56'),_0x5c09('0x70'),'favicon','defaultLogo',_0x5c09('0x5c'),'defaultPreferred',_0x5c09('0x5d')],'raw':!![]});})[_0x5c09('0x1c')](handleEntityNotFound(_0x3e2ad7,null))[_0x5c09('0x1c')](function(_0x3530b5){if(_0x3530b5){var _0x53ee9c=_0x3530b5[_0x5c09('0x70')]&&fs['existsSync'](path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x394b5d,_['toLower'](_0x3530b5['preferred'])))?path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x394b5d,_[_0x5c09('0x61')](_0x3530b5[_0x5c09('0x70')])):path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x394b5d,_[_0x5c09('0x61')](_0x5c09('0x72')));var _0x36225b=_0x5c09('0x63')+_[_0x5c09('0x66')]('preferred');if(_0x3530b5[_0x36225b]||!_0x3e886a['custom']||!_0x3e886a[_0x5c09('0x70')]){_0x53ee9c=path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x394b5d,_[_0x5c09('0x61')](_0x5c09('0x72')));}if(!fs[_0x5c09('0x5e')](_0x53ee9c)){throw new db[(_0x5c09('0x65'))][(_0x5c09('0x6b'))](_[_0x5c09('0x66')](_0x5c09('0x70'))+_0x5c09('0x6c'));}return _0x3e2ad7[_0x5c09('0x67')](_0x53ee9c);}})[_0x5c09('0x4d')](handleError(_0x3e2ad7,null));};exports['addFavicon']=function(_0x12146a,_0x987e43,_0x5601ee){if(_0x12146a[_0x5c09('0x53')]&&_0x12146a['file'][_0x5c09('0x54')]){_0x12146a['body']['favicon']=_0x12146a['file'][_0x5c09('0x54')];}return db['Setting'][_0x5c09('0x52')]({'where':{'id':_0x12146a[_0x5c09('0x4f')]['id']}})['then'](handleEntityNotFound(_0x987e43,null))[_0x5c09('0x1c')](saveUpdates(_0x12146a[_0x5c09('0x51')],null))[_0x5c09('0x1c')](respondWithResult(_0x987e43,null))[_0x5c09('0x4d')](handleError(_0x987e43,null));};var utilLicense=require(_0x5c09('0x18'));exports[_0x5c09('0x73')]=function(_0x18e473,_0x23ae60,_0x219c82){var _0x16f1b1=_0x5c09('0x58');var _0x31a3a3={'custom':![]};return utilLicense[_0x5c09('0x59')]()[_0x5c09('0x1c')](function(_0x115c89){if(_0x115c89){_0x31a3a3=_0x115c89;}return db[_0x5c09('0x36')]['find']({'where':{'id':_0x18e473[_0x5c09('0x4f')]['id']},'attributes':['logo',_0x5c09('0x56'),'preferred',_0x5c09('0x5a'),'defaultLogo',_0x5c09('0x5c'),_0x5c09('0x69'),_0x5c09('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x23ae60,null))[_0x5c09('0x1c')](function(_0x11d015){if(_0x11d015){var _0x50ea14=_0x11d015[_0x5c09('0x5a')]&&fs[_0x5c09('0x5e')](path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x16f1b1,_[_0x5c09('0x61')](_0x11d015[_0x5c09('0x5a')])))?path[_0x5c09('0x5f')](config[_0x5c09('0x60')],_0x16f1b1,_['toLower'](_0x11d015[_0x5c09('0x5a')])):path['join'](config['root'],_0x16f1b1,_[_0x5c09('0x61')](_0x5c09('0x74')));var _0x9543de=_0x5c09('0x63')+_['upperFirst'](_0x5c09('0x5a'));if(_0x11d015[_0x9543de]||!_0x31a3a3[_0x5c09('0x64')]){_0x50ea14=path[_0x5c09('0x5f')](config['root'],_0x16f1b1,_[_0x5c09('0x61')](_0x5c09('0x74')));}if(!fs['existsSync'](_0x50ea14)){throw new db['Sequelize'][(_0x5c09('0x6b'))](_[_0x5c09('0x66')]('favicon')+_0x5c09('0x6c'));}return _0x23ae60[_0x5c09('0x67')](_0x50ea14);}})[_0x5c09('0x4d')](handleError(_0x23ae60,null));};exports[_0x5c09('0x75')]=function(_0x1263a1,_0x52faae){var _0x2d1b0f={'offset':moment()[_0x5c09('0x76')]()};_0x2d1b0f['now']=moment()['utcOffset'](_0x2d1b0f[_0x5c09('0x29')])[_0x5c09('0x77')](_0x5c09('0x78'));return _0x52faae[_0x5c09('0x27')](0xc8)[_0x5c09('0x79')](_0x2d1b0f);}; \ No newline at end of file +var _0x6ede=['limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','Setting','fieldName','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','findAll','params','rawAttributes','length','includeAll','options','body','find','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','getLogoLogin','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','default_preferred.png','custom','download','addFavicon','../../config/license/util','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','count'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x6ede,0x140));var _0xe6ed=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x6ede[_0x74892f];return _0x10ee61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6ed('0x1'));var rp=require(_0xe6ed('0x2'));var moment=require(_0xe6ed('0x3'));var BPromise=require(_0xe6ed('0x4'));var Mustache=require(_0xe6ed('0x5'));var util=require(_0xe6ed('0x6'));var path=require(_0xe6ed('0x7'));var sox=require('sox');var csv=require(_0xe6ed('0x8'));var ejs=require(_0xe6ed('0x9'));var fs=require('fs');var fs_extra=require(_0xe6ed('0xa'));var _=require(_0xe6ed('0xb'));var squel=require(_0xe6ed('0xc'));var crypto=require(_0xe6ed('0xd'));var jsforce=require(_0xe6ed('0xe'));var deskjs=require(_0xe6ed('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe6ed('0x10'));var authService=require(_0xe6ed('0x11'));var qs=require(_0xe6ed('0x12'));var as=require(_0xe6ed('0x13'));var hardwareService=require(_0xe6ed('0x14'));var logger=require(_0xe6ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe6ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6ed('0x17'))['db'];var jayson=require(_0xe6ed('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f74ed,_0x438894,_0x5a143a,_0x47cbc8){return new BPromise(function(_0x3022e7,_0x2c82db){var _0x778106=_0x47cbc8||client;return _0x778106[_0xe6ed('0x19')](_0x4f74ed,_0x5a143a)[_0xe6ed('0x1a')](function(_0x1ef166){logger[_0xe6ed('0x1b')](_0xe6ed('0x1c'),_0x438894,_0xe6ed('0x1d'));logger[_0xe6ed('0x1e')](_0xe6ed('0x1f'),_0x438894,_0xe6ed('0x1d'),JSON[_0xe6ed('0x20')](_0x1ef166));if(_0x1ef166['error']){if(_0x1ef166[_0xe6ed('0x21')]['code']===0x1f4){logger[_0xe6ed('0x21')]('Setting,\x20%s,\x20%s',_0x438894,_0x1ef166['error'][_0xe6ed('0x22')]);return _0x2c82db(_0x1ef166[_0xe6ed('0x21')][_0xe6ed('0x22')]);}logger[_0xe6ed('0x21')]('Setting,\x20%s,\x20%s',_0x438894,_0x1ef166[_0xe6ed('0x21')]['message']);return _0x3022e7(_0x1ef166[_0xe6ed('0x21')]['message']);}else{logger[_0xe6ed('0x1b')]('Setting,\x20%s,\x20%s',_0x438894,'request\x20sent');_0x3022e7(_0x1ef166[_0xe6ed('0x23')][_0xe6ed('0x22')]);}})[_0xe6ed('0x24')](function(_0x1344dc){logger['error'](_0xe6ed('0x1c'),_0x438894,_0x1344dc);_0x2c82db(_0x1344dc);});});}function respondWithStatusCode(_0x24a019,_0x5cb139){_0x5cb139=_0x5cb139||0xcc;return function(_0x11546f){if(_0x11546f){return _0x24a019[_0xe6ed('0x25')](_0x5cb139);}return _0x24a019['status'](_0x5cb139)['end']();};}function respondWithResult(_0x1315ea,_0x1c9ac4){_0x1c9ac4=_0x1c9ac4||0xc8;return function(_0x3f4bfd){if(_0x3f4bfd){return _0x1315ea[_0xe6ed('0x26')](_0x1c9ac4)[_0xe6ed('0x27')](_0x3f4bfd);}};}function respondWithFilteredResult(_0x43c547,_0x19064c){return function(_0x136068){if(_0x136068){var _0x13dbe8=typeof _0x19064c[_0xe6ed('0x28')]===_0xe6ed('0x29')&&typeof _0x19064c['limit']===_0xe6ed('0x29');var _0x144257=_0x136068[_0xe6ed('0x2a')];var _0x58238e=_0x13dbe8?0x0:_0x19064c[_0xe6ed('0x28')];var _0x339795=_0x13dbe8?_0x136068[_0xe6ed('0x2a')]:_0x19064c[_0xe6ed('0x28')]+_0x19064c[_0xe6ed('0x2b')];var _0x1c881d;if(_0x339795>=_0x144257){_0x339795=_0x144257;_0x1c881d=0xc8;}else{_0x1c881d=0xce;}_0x43c547[_0xe6ed('0x26')](_0x1c881d);return _0x43c547[_0xe6ed('0x2c')](_0xe6ed('0x2d'),_0x58238e+'-'+_0x339795+'/'+_0x144257)['json'](_0x136068);}return null;};}function patchUpdates(_0x185b6e){return function(_0x524ded){try{jsonpatch[_0xe6ed('0x2e')](_0x524ded,_0x185b6e,!![]);}catch(_0x5445fe){return BPromise['reject'](_0x5445fe);}return _0x524ded[_0xe6ed('0x2f')]();};}function saveUpdates(_0x2314b0,_0x332fb5){return function(_0x77e8c5){if(_0x77e8c5){return _0x77e8c5[_0xe6ed('0x30')](_0x2314b0)[_0xe6ed('0x1a')](function(_0x34ed72){return _0x34ed72;});}return null;};}function removeEntity(_0x430318,_0x1a3abe){return function(_0x71c99c){if(_0x71c99c){return _0x71c99c[_0xe6ed('0x31')]()[_0xe6ed('0x1a')](function(){_0x430318[_0xe6ed('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7c36,_0x23015a){return function(_0x32f1ae){if(!_0x32f1ae){_0x3d7c36[_0xe6ed('0x25')](0x194);}return _0x32f1ae;};}function handleError(_0x230fca,_0x47dd68){_0x47dd68=_0x47dd68||0x1f4;return function(_0x3d93fe){logger[_0xe6ed('0x21')](_0x3d93fe[_0xe6ed('0x32')]);if(_0x3d93fe[_0xe6ed('0x33')]){delete _0x3d93fe[_0xe6ed('0x33')];}_0x230fca['status'](_0x47dd68)[_0xe6ed('0x34')](_0x3d93fe);};}exports[_0xe6ed('0x35')]=function(_0x50df4b,_0x111853){var _0x5fddef={},_0x411c8b={},_0x3d4a9b={'count':0x0,'rows':[]};var _0x8386e4=_[_0xe6ed('0x36')](db[_0xe6ed('0x37')]['rawAttributes'],function(_0x317a1d){return{'name':_0x317a1d[_0xe6ed('0x38')],'type':_0x317a1d['type']['key']};});_0x411c8b['model']=_[_0xe6ed('0x36')](_0x8386e4,_0xe6ed('0x33'));_0x411c8b['query']=_[_0xe6ed('0x39')](_0x50df4b[_0xe6ed('0x3a')]);_0x411c8b[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x411c8b[_0xe6ed('0x3d')],_0x411c8b['query']);_0x5fddef[_0xe6ed('0x3e')]=_[_0xe6ed('0x3c')](_0x411c8b[_0xe6ed('0x3d')],qs[_0xe6ed('0x3f')](_0x50df4b[_0xe6ed('0x3a')]['fields']));_0x5fddef['attributes']=_0x5fddef[_0xe6ed('0x3e')]['length']?_0x5fddef[_0xe6ed('0x3e')]:_0x411c8b[_0xe6ed('0x3d')];if(!_0x50df4b[_0xe6ed('0x3a')][_0xe6ed('0x40')](_0xe6ed('0x41'))){_0x5fddef['limit']=qs[_0xe6ed('0x2b')](_0x50df4b[_0xe6ed('0x3a')][_0xe6ed('0x2b')]);_0x5fddef[_0xe6ed('0x28')]=qs[_0xe6ed('0x28')](_0x50df4b['query'][_0xe6ed('0x28')]);}_0x5fddef['order']=qs[_0xe6ed('0x42')](_0x50df4b['query']['sort']);_0x5fddef[_0xe6ed('0x43')]=qs[_0xe6ed('0x3b')](_[_0xe6ed('0x44')](_0x50df4b[_0xe6ed('0x3a')],_0x411c8b['filters']),_0x8386e4);if(_0x50df4b['query'][_0xe6ed('0x45')]){_0x5fddef['where']=_[_0xe6ed('0x46')](_0x5fddef['where'],{'$or':_[_0xe6ed('0x36')](_0x8386e4,function(_0x53ce95){if(_0x53ce95[_0xe6ed('0x47')]!==_0xe6ed('0x48')){var _0x5d5529={};_0x5d5529[_0x53ce95[_0xe6ed('0x33')]]={'$like':'%'+_0x50df4b[_0xe6ed('0x3a')][_0xe6ed('0x45')]+'%'};return _0x5d5529;}})});}_0x5fddef=_[_0xe6ed('0x46')]({},_0x5fddef,_0x50df4b['options']);var _0x5a417d={'where':_0x5fddef[_0xe6ed('0x43')]};return db[_0xe6ed('0x37')]['count'](_0x5a417d)[_0xe6ed('0x1a')](function(_0x44583e){_0x3d4a9b['count']=_0x44583e;if(_0x50df4b[_0xe6ed('0x3a')]['includeAll']){_0x5fddef['include']=[{'all':!![]}];}return db['Setting'][_0xe6ed('0x49')](_0x5fddef);})[_0xe6ed('0x1a')](function(_0x39e1ea){_0x3d4a9b['rows']=_0x39e1ea;return _0x3d4a9b;})[_0xe6ed('0x1a')](respondWithFilteredResult(_0x111853,_0x5fddef))[_0xe6ed('0x24')](handleError(_0x111853,null));};exports['show']=function(_0xc0844e,_0x18122b){var _0x3ac16c={'raw':![],'where':{'id':_0xc0844e[_0xe6ed('0x4a')]['id']}},_0x5624d2={};_0x5624d2[_0xe6ed('0x3d')]=_[_0xe6ed('0x39')](db[_0xe6ed('0x37')][_0xe6ed('0x4b')]);_0x5624d2['query']=_[_0xe6ed('0x39')](_0xc0844e[_0xe6ed('0x3a')]);_0x5624d2[_0xe6ed('0x3b')]=_['intersection'](_0x5624d2['model'],_0x5624d2[_0xe6ed('0x3a')]);_0x3ac16c[_0xe6ed('0x3e')]=_[_0xe6ed('0x3c')](_0x5624d2[_0xe6ed('0x3d')],qs['fields'](_0xc0844e[_0xe6ed('0x3a')][_0xe6ed('0x3f')]));_0x3ac16c[_0xe6ed('0x3e')]=_0x3ac16c[_0xe6ed('0x3e')][_0xe6ed('0x4c')]?_0x3ac16c['attributes']:_0x5624d2[_0xe6ed('0x3d')];if(_0xc0844e['query'][_0xe6ed('0x4d')]){_0x3ac16c['include']=[{'all':!![]}];}_0x3ac16c=_[_0xe6ed('0x46')]({},_0x3ac16c,_0xc0844e[_0xe6ed('0x4e')]);return db[_0xe6ed('0x37')]['find'](_0x3ac16c)['then'](handleEntityNotFound(_0x18122b,null))[_0xe6ed('0x1a')](respondWithResult(_0x18122b,null))[_0xe6ed('0x24')](handleError(_0x18122b,null));};exports['update']=function(_0x4e1384,_0x4ff932){if(_0x4e1384[_0xe6ed('0x4f')]['id']){delete _0x4e1384[_0xe6ed('0x4f')]['id'];}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x4e1384[_0xe6ed('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ff932,null))['then'](saveUpdates(_0x4e1384[_0xe6ed('0x4f')],null))['then'](respondWithResult(_0x4ff932,null))[_0xe6ed('0x24')](handleError(_0x4ff932,null));};exports[_0xe6ed('0x51')]=function(_0x3c7e42,_0x3bc47a,_0x2370e6){if(_0x3c7e42[_0xe6ed('0x52')]&&_0x3c7e42[_0xe6ed('0x52')]['filename']){_0x3c7e42[_0xe6ed('0x4f')][_0xe6ed('0x53')]=_0x3c7e42[_0xe6ed('0x52')][_0xe6ed('0x54')];}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x3c7e42[_0xe6ed('0x4a')]['id']}})[_0xe6ed('0x1a')](handleEntityNotFound(_0x3bc47a,null))[_0xe6ed('0x1a')](saveUpdates(_0x3c7e42[_0xe6ed('0x4f')],null))['then'](respondWithResult(_0x3bc47a,null))[_0xe6ed('0x24')](handleError(_0x3bc47a,null));};exports[_0xe6ed('0x55')]=function(_0x178df8,_0xd45d57,_0xbb088a){if(_0x178df8['file']&&_0x178df8[_0xe6ed('0x52')][_0xe6ed('0x54')]){_0x178df8[_0xe6ed('0x4f')][_0xe6ed('0x56')]=_0x178df8[_0xe6ed('0x52')][_0xe6ed('0x54')];}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x178df8[_0xe6ed('0x4a')]['id']}})[_0xe6ed('0x1a')](handleEntityNotFound(_0xd45d57,null))[_0xe6ed('0x1a')](saveUpdates(_0x178df8[_0xe6ed('0x4f')],null))['then'](respondWithResult(_0xd45d57,null))[_0xe6ed('0x24')](handleError(_0xd45d57,null));};var utilLicense=require('../../config/license/util');exports[_0xe6ed('0x57')]=function(_0x2af41c,_0x1d2e4f,_0x474e5d){var _0x5249f0=_0xe6ed('0x58');var _0x47d6df={'custom':![]};return utilLicense[_0xe6ed('0x59')]()[_0xe6ed('0x1a')](function(_0x43d527){if(_0x43d527){_0x47d6df=_0x43d527;}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x2af41c[_0xe6ed('0x4a')]['id']},'attributes':[_0xe6ed('0x53'),_0xe6ed('0x56'),_0xe6ed('0x5a'),_0xe6ed('0x5b'),_0xe6ed('0x5c'),_0xe6ed('0x5d'),_0xe6ed('0x5e'),_0xe6ed('0x5f')],'raw':!![]});})[_0xe6ed('0x1a')](handleEntityNotFound(_0x1d2e4f,null))['then'](function(_0x3202d6){if(_0x3202d6){var _0x4849e5=_0x3202d6[_0xe6ed('0x53')]&&fs[_0xe6ed('0x60')](path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x5249f0,_[_0xe6ed('0x63')](_0x3202d6['logo'])))?path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x5249f0,_[_0xe6ed('0x63')](_0x3202d6[_0xe6ed('0x53')])):path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x5249f0,_[_0xe6ed('0x63')](_0xe6ed('0x64')));var _0x335451=_0xe6ed('0x65')+_[_0xe6ed('0x66')](_0xe6ed('0x53'));if(_0x3202d6[_0x335451]||!_0x47d6df['custom']){_0x4849e5=path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x5249f0,_[_0xe6ed('0x63')](_0xe6ed('0x64')));}if(!fs['existsSync'](_0x4849e5)){throw new db[(_0xe6ed('0x67'))][(_0xe6ed('0x68'))](_[_0xe6ed('0x66')](_0xe6ed('0x53'))+'\x20not\x20found');}return _0x1d2e4f['download'](_0x4849e5);}})[_0xe6ed('0x24')](handleError(_0x1d2e4f,null));};var utilLicense=require('../../config/license/util');exports[_0xe6ed('0x69')]=function(_0x2e12f4,_0x26c593,_0x44eaed){var _0x3dc5ab=_0xe6ed('0x58');var _0x228e89={'custom':![]};return utilLicense[_0xe6ed('0x59')]()[_0xe6ed('0x1a')](function(_0x1fcd93){if(_0x1fcd93){_0x228e89=_0x1fcd93;}return db['Setting'][_0xe6ed('0x50')]({'where':{'id':_0x2e12f4[_0xe6ed('0x4a')]['id']},'attributes':[_0xe6ed('0x53'),'loginLogo','preferred',_0xe6ed('0x5b'),_0xe6ed('0x5c'),_0xe6ed('0x5d'),_0xe6ed('0x5e'),_0xe6ed('0x5f')],'raw':!![]});})[_0xe6ed('0x1a')](handleEntityNotFound(_0x26c593,null))['then'](function(_0x5d02dc){if(_0x5d02dc){var _0x2d730d=_0x5d02dc[_0xe6ed('0x56')]&&fs[_0xe6ed('0x60')](path['join'](config[_0xe6ed('0x62')],_0x3dc5ab,_['toLower'](_0x5d02dc[_0xe6ed('0x56')])))?path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x3dc5ab,_['toLower'](_0x5d02dc[_0xe6ed('0x56')])):path[_0xe6ed('0x61')](config['root'],_0x3dc5ab,_[_0xe6ed('0x63')](_0xe6ed('0x6a')));var _0x3a02d9=_0xe6ed('0x65')+_[_0xe6ed('0x66')](_0xe6ed('0x56'));if(_0x5d02dc[_0x3a02d9]||!_0x228e89['custom']){_0x2d730d=path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x3dc5ab,_['toLower'](_0xe6ed('0x6a')));}if(!fs[_0xe6ed('0x60')](_0x2d730d)){throw new db[(_0xe6ed('0x67'))][(_0xe6ed('0x68'))](_[_0xe6ed('0x66')](_0xe6ed('0x56'))+_0xe6ed('0x6b'));}return _0x26c593['download'](_0x2d730d);}})[_0xe6ed('0x24')](handleError(_0x26c593,null));};exports['gdpr']=function(_0x5a93fa,_0x3f9747){return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x5a93fa['params']['id']},'attributes':[_0xe6ed('0x6c')]})[_0xe6ed('0x1a')](respondWithResult(_0x3f9747,null))['catch'](handleError(_0x3f9747,null));};exports[_0xe6ed('0x6d')]=function(_0x3371cd,_0x5f7c9f,_0xb1cd9c){if(_0x3371cd['file']&&_0x3371cd[_0xe6ed('0x52')]['filename']){_0x3371cd[_0xe6ed('0x4f')][_0xe6ed('0x5a')]=_0x3371cd[_0xe6ed('0x52')][_0xe6ed('0x54')];}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x3371cd['params']['id']}})[_0xe6ed('0x1a')](handleEntityNotFound(_0x5f7c9f,null))['then'](saveUpdates(_0x3371cd[_0xe6ed('0x4f')],null))['then'](respondWithResult(_0x5f7c9f,null))[_0xe6ed('0x24')](handleError(_0x5f7c9f,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x49740a,_0x1d5850,_0x50e902){var _0x1da3b0='server/files/images/logos';var _0x1eb902={'custom':![]};return utilLicense[_0xe6ed('0x59')]()[_0xe6ed('0x1a')](function(_0x1747cc){if(_0x1747cc){_0x1eb902=_0x1747cc;}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x49740a['params']['id']},'attributes':[_0xe6ed('0x53'),_0xe6ed('0x56'),_0xe6ed('0x5a'),_0xe6ed('0x5b'),_0xe6ed('0x5c'),'defaultLoginLogo',_0xe6ed('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1d5850,null))[_0xe6ed('0x1a')](function(_0x40ab10){if(_0x40ab10){var _0x46e484=_0x40ab10[_0xe6ed('0x5a')]&&fs[_0xe6ed('0x60')](path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x1da3b0,_['toLower'](_0x40ab10[_0xe6ed('0x5a')])))?path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x1da3b0,_[_0xe6ed('0x63')](_0x40ab10[_0xe6ed('0x5a')])):path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x1da3b0,_[_0xe6ed('0x63')](_0xe6ed('0x6e')));var _0x2db1e6=_0xe6ed('0x65')+_['upperFirst']('preferred');if(_0x40ab10[_0x2db1e6]||!_0x1eb902[_0xe6ed('0x6f')]||!_0x1eb902[_0xe6ed('0x5a')]){_0x46e484=path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x1da3b0,_['toLower'](_0xe6ed('0x6e')));}if(!fs[_0xe6ed('0x60')](_0x46e484)){throw new db['Sequelize']['ValidationError'](_[_0xe6ed('0x66')](_0xe6ed('0x5a'))+_0xe6ed('0x6b'));}return _0x1d5850[_0xe6ed('0x70')](_0x46e484);}})[_0xe6ed('0x24')](handleError(_0x1d5850,null));};exports[_0xe6ed('0x71')]=function(_0x46b082,_0x2ec46d,_0x21d5f2){if(_0x46b082['file']&&_0x46b082['file'][_0xe6ed('0x54')]){_0x46b082[_0xe6ed('0x4f')][_0xe6ed('0x5b')]=_0x46b082[_0xe6ed('0x52')][_0xe6ed('0x54')];}return db['Setting']['find']({'where':{'id':_0x46b082[_0xe6ed('0x4a')]['id']}})[_0xe6ed('0x1a')](handleEntityNotFound(_0x2ec46d,null))['then'](saveUpdates(_0x46b082[_0xe6ed('0x4f')],null))[_0xe6ed('0x1a')](respondWithResult(_0x2ec46d,null))['catch'](handleError(_0x2ec46d,null));};var utilLicense=require(_0xe6ed('0x72'));exports[_0xe6ed('0x73')]=function(_0x1b3620,_0x4d50df,_0x5567e6){var _0x3f0abd=_0xe6ed('0x58');var _0xfc0ae2={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xcd43de){if(_0xcd43de){_0xfc0ae2=_0xcd43de;}return db[_0xe6ed('0x37')][_0xe6ed('0x50')]({'where':{'id':_0x1b3620[_0xe6ed('0x4a')]['id']},'attributes':[_0xe6ed('0x53'),_0xe6ed('0x56'),'preferred',_0xe6ed('0x5b'),_0xe6ed('0x5c'),'defaultLoginLogo','defaultPreferred',_0xe6ed('0x5f')],'raw':!![]});})[_0xe6ed('0x1a')](handleEntityNotFound(_0x4d50df,null))['then'](function(_0x196a59){if(_0x196a59){var _0x26c8b4=_0x196a59[_0xe6ed('0x5b')]&&fs[_0xe6ed('0x60')](path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x3f0abd,_[_0xe6ed('0x63')](_0x196a59[_0xe6ed('0x5b')])))?path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x3f0abd,_[_0xe6ed('0x63')](_0x196a59[_0xe6ed('0x5b')])):path[_0xe6ed('0x61')](config['root'],_0x3f0abd,_[_0xe6ed('0x63')](_0xe6ed('0x74')));var _0x165b32=_0xe6ed('0x65')+_[_0xe6ed('0x66')](_0xe6ed('0x5b'));if(_0x196a59[_0x165b32]||!_0xfc0ae2[_0xe6ed('0x6f')]){_0x26c8b4=path[_0xe6ed('0x61')](config[_0xe6ed('0x62')],_0x3f0abd,_[_0xe6ed('0x63')](_0xe6ed('0x74')));}if(!fs[_0xe6ed('0x60')](_0x26c8b4)){throw new db['Sequelize'][(_0xe6ed('0x68'))](_[_0xe6ed('0x66')]('favicon')+_0xe6ed('0x6b'));}return _0x4d50df[_0xe6ed('0x70')](_0x26c8b4);}})[_0xe6ed('0x24')](handleError(_0x4d50df,null));};exports[_0xe6ed('0x75')]=function(_0x14cf9a,_0x2d80ee){var _0x3dcb46={'offset':moment()[_0xe6ed('0x76')]()};_0x3dcb46['now']=moment()[_0xe6ed('0x76')](_0x3dcb46[_0xe6ed('0x28')])[_0xe6ed('0x77')](_0xe6ed('0x78'));return _0x2d80ee[_0xe6ed('0x26')](0xc8)['send'](_0x3dcb46);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 74c6727..d63891b 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1a596b,_0xeb0492){var _0x4710bb=function(_0x5a0ef6){while(--_0x5a0ef6){_0x1a596b['push'](_0x1a596b['shift']());}};_0x4710bb(++_0xeb0492);}(_0x34e8,0x12c));var _0x834e=function(_0x2ec157,_0x116344){_0x2ec157=_0x2ec157-0x0;var _0x40c22d=_0x34e8[_0x2ec157];return _0x40c22d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0x008c,0x188));var _0xc008=function(_0x22e690,_0x5f570e){_0x22e690=_0x22e690-0x0;var _0x2b515f=_0x008c[_0x22e690];return _0x2b515f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c211918..986df82 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 _0xa35f=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowSetting','find','options','raw','where','attributes','include','map','model','debug','catch','lodash','util','bluebird','randomstring'];(function(_0x4ae9aa,_0x4f5010){var _0x3e0e6f=function(_0x3d2043){while(--_0x3d2043){_0x4ae9aa['push'](_0x4ae9aa['shift']());}};_0x3e0e6f(++_0x4f5010);}(_0xa35f,0xb0));var _0xfa35=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0xa35f[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0xfa35('0x0'));var util=require(_0xfa35('0x1'));var moment=require('moment');var BPromise=require(_0xfa35('0x2'));var rs=require(_0xfa35('0x3'));var fs=require('fs');var Redis=require(_0xfa35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa35('0x5'));var logger=require(_0xfa35('0x6'))('rpc');var config=require(_0xfa35('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa35('0x8')][_0xfa35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d4b07,_0x114629,_0x325a8f){return new BPromise(function(_0x253123,_0x400003){return client['request'](_0x1d4b07,_0x325a8f)[_0xfa35('0xa')](function(_0x28a136){logger['info'](_0xfa35('0xb'),_0x114629,'request\x20sent');logger['debug'](_0xfa35('0xc'),_0x114629,'request\x20sent',JSON[_0xfa35('0xd')](_0x28a136));if(_0x28a136[_0xfa35('0xe')]){if(_0x28a136['error'][_0xfa35('0xf')]===0x1f4){logger['error'](_0xfa35('0xb'),_0x114629,_0x28a136['error'][_0xfa35('0x10')]);return _0x400003(_0x28a136['error'][_0xfa35('0x10')]);}logger['error'](_0xfa35('0xb'),_0x114629,_0x28a136[_0xfa35('0xe')][_0xfa35('0x10')]);return _0x253123(_0x28a136[_0xfa35('0xe')][_0xfa35('0x10')]);}else{logger[_0xfa35('0x11')](_0xfa35('0xb'),_0x114629,'request\x20sent');_0x253123(_0x28a136[_0xfa35('0x12')]['message']);}})['catch'](function(_0x582546){logger[_0xfa35('0xe')](_0xfa35('0xb'),_0x114629,_0x582546);_0x400003(_0x582546);});});}exports[_0xfa35('0x13')]=function(_0x155f05){var _0x256258=this;return new Promise(function(_0x4a030d,_0x426220){return db['Setting'][_0xfa35('0x14')]({'raw':_0x155f05[_0xfa35('0x15')]?_0x155f05[_0xfa35('0x15')][_0xfa35('0x16')]===undefined?!![]:![]:!![],'where':_0x155f05[_0xfa35('0x15')]?_0x155f05['options'][_0xfa35('0x17')]||null:null,'attributes':_0x155f05['options']?_0x155f05[_0xfa35('0x15')][_0xfa35('0x18')]||null:null,'include':_0x155f05['options']?_0x155f05['options'][_0xfa35('0x19')]?_[_0xfa35('0x1a')](_0x155f05[_0xfa35('0x15')][_0xfa35('0x19')],function(_0x3bf569){return{'model':db[_0x3bf569['model']],'as':_0x3bf569['as'],'attributes':_0x3bf569[_0xfa35('0x18')],'include':_0x3bf569[_0xfa35('0x19')]?_['map'](_0x3bf569['include'],function(_0x1f83de){return{'model':db[_0x1f83de[_0xfa35('0x1b')]],'as':_0x1f83de['as'],'attributes':_0x1f83de[_0xfa35('0x18')],'include':_0x1f83de['include']?_[_0xfa35('0x1a')](_0x1f83de['include'],function(_0x2c18a9){return{'model':db[_0x2c18a9[_0xfa35('0x1b')]],'as':_0x2c18a9['as'],'attributes':_0x2c18a9[_0xfa35('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfa35('0xa')](function(_0x22cf6f){logger[_0xfa35('0x11')](_0xfa35('0x13'),_0x155f05);logger[_0xfa35('0x1c')](_0xfa35('0x13'),_0x155f05,JSON[_0xfa35('0xd')](_0x22cf6f));_0x4a030d(_0x22cf6f);})[_0xfa35('0x1d')](function(_0x39c63d){logger[_0xfa35('0xe')](_0xfa35('0x13'),_0x39c63d['message'],_0x155f05);_0x426220(_0x256258['error'](0x1f4,_0x39c63d[_0xfa35('0x10')]));});});}; \ No newline at end of file +var _0xa7cf=['http','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSetting','Setting','find','options','where','attributes','include','model','map','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56ae16,_0x4ae602){var _0x5465c3=function(_0x491587){while(--_0x491587){_0x56ae16['push'](_0x56ae16['shift']());}};_0x5465c3(++_0x4ae602);}(_0xa7cf,0x1c6));var _0xfa7c=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0xa7cf[_0x429948];return _0x35d5d1;};'use strict';var _=require(_0xfa7c('0x0'));var util=require(_0xfa7c('0x1'));var moment=require(_0xfa7c('0x2'));var BPromise=require(_0xfa7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa7c('0x5'));var logger=require(_0xfa7c('0x6'))(_0xfa7c('0x7'));var config=require(_0xfa7c('0x8'));var jayson=require(_0xfa7c('0x9'));var client=jayson[_0xfa7c('0xa')][_0xfa7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf840f7,_0x1112d1,_0x52044a){return new BPromise(function(_0x2970ce,_0x350b0b){return client['request'](_0xf840f7,_0x52044a)['then'](function(_0x1a137f){logger['info'](_0xfa7c('0xc'),_0x1112d1,_0xfa7c('0xd'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1112d1,_0xfa7c('0xd'),JSON[_0xfa7c('0xe')](_0x1a137f));if(_0x1a137f['error']){if(_0x1a137f[_0xfa7c('0xf')][_0xfa7c('0x10')]===0x1f4){logger[_0xfa7c('0xf')](_0xfa7c('0xc'),_0x1112d1,_0x1a137f[_0xfa7c('0xf')][_0xfa7c('0x11')]);return _0x350b0b(_0x1a137f[_0xfa7c('0xf')][_0xfa7c('0x11')]);}logger[_0xfa7c('0xf')]('Setting,\x20%s,\x20%s',_0x1112d1,_0x1a137f[_0xfa7c('0xf')][_0xfa7c('0x11')]);return _0x2970ce(_0x1a137f[_0xfa7c('0xf')]['message']);}else{logger[_0xfa7c('0x12')](_0xfa7c('0xc'),_0x1112d1,'request\x20sent');_0x2970ce(_0x1a137f[_0xfa7c('0x13')][_0xfa7c('0x11')]);}})[_0xfa7c('0x14')](function(_0x580969){logger[_0xfa7c('0xf')](_0xfa7c('0xc'),_0x1112d1,_0x580969);_0x350b0b(_0x580969);});});}exports[_0xfa7c('0x15')]=function(_0x1c9167){var _0x549e72=this;return new Promise(function(_0xe03e47,_0xce99e8){return db[_0xfa7c('0x16')][_0xfa7c('0x17')]({'raw':_0x1c9167[_0xfa7c('0x18')]?_0x1c9167['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c9167[_0xfa7c('0x18')]?_0x1c9167['options'][_0xfa7c('0x19')]||null:null,'attributes':_0x1c9167[_0xfa7c('0x18')]?_0x1c9167[_0xfa7c('0x18')][_0xfa7c('0x1a')]||null:null,'include':_0x1c9167[_0xfa7c('0x18')]?_0x1c9167[_0xfa7c('0x18')][_0xfa7c('0x1b')]?_['map'](_0x1c9167[_0xfa7c('0x18')][_0xfa7c('0x1b')],function(_0x2a9c94){return{'model':db[_0x2a9c94[_0xfa7c('0x1c')]],'as':_0x2a9c94['as'],'attributes':_0x2a9c94[_0xfa7c('0x1a')],'include':_0x2a9c94[_0xfa7c('0x1b')]?_[_0xfa7c('0x1d')](_0x2a9c94[_0xfa7c('0x1b')],function(_0xb8f6cc){return{'model':db[_0xb8f6cc[_0xfa7c('0x1c')]],'as':_0xb8f6cc['as'],'attributes':_0xb8f6cc[_0xfa7c('0x1a')],'include':_0xb8f6cc[_0xfa7c('0x1b')]?_[_0xfa7c('0x1d')](_0xb8f6cc['include'],function(_0x164ee3){return{'model':db[_0x164ee3['model']],'as':_0x164ee3['as'],'attributes':_0x164ee3[_0xfa7c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfa7c('0x1e')](function(_0x151454){logger['info'](_0xfa7c('0x15'),_0x1c9167);logger['debug']('ShowSetting',_0x1c9167,JSON[_0xfa7c('0xe')](_0x151454));_0xe03e47(_0x151454);})['catch'](function(_0x48b796){logger[_0xfa7c('0xf')](_0xfa7c('0x15'),_0x48b796[_0xfa7c('0x11')],_0x1c9167);_0xce99e8(_0x549e72[_0xfa7c('0xf')](0x1f4,_0x48b796[_0xfa7c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c39f163..d43af5e 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x61c3b0,_0x364f6b){_0x61c3b0=_0x61c3b0-0x0;var _0x4eacf3=_0xf494[_0x61c3b0];return _0x4eacf3;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c02b279..be8594d 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 _0xb41f=['twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xb41f,0x10e));var _0xfb41=function(_0x1e553e,_0x38d687){_0x1e553e=_0x1e553e-0x0;var _0x328c2c=_0xb41f[_0x1e553e];return _0x328c2c;};'use strict';var Sequelize=require(_0xfb41('0x0'));var rs=require(_0xfb41('0x1'));module[_0xfb41('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xfb41('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xfb41('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xfb41('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xfb41('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xfb41('0x4')]},'type':{'type':Sequelize[_0xfb41('0x5')](_0xfb41('0x6'),'skebby',_0xfb41('0x7'),_0xfb41('0x8'),_0xfb41('0x9'),_0xfb41('0xa'),_0xfb41('0xb'),_0xfb41('0xc'),_0xfb41('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xfb41('0x4')]},'authId':{'type':Sequelize[_0xfb41('0x4')]},'authToken':{'type':Sequelize[_0xfb41('0x4')]},'smsMethod':{'type':Sequelize[_0xfb41('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfb41('0x4')]},'password':{'type':Sequelize[_0xfb41('0x4')]},'apiKey':{'type':Sequelize[_0xfb41('0x4')]},'applicationId':{'type':Sequelize[_0xfb41('0x4')]},'accountId':{'type':Sequelize[_0xfb41('0x4')]},'senderString':{'type':Sequelize[_0xfb41('0x4')]},'deliveryReport':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xfb41('0x4')]},'notificationTemplate':{'type':Sequelize[_0xfb41('0xf')],'defaultValue':function(){return _0xfb41('0x10');}},'notificationSound':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfb41('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfb41('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfb41('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfb41('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfb41('0x11')],'comment':_0xfb41('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xfb41('0xe')],'defaultValue':![],'comment':_0xfb41('0x13'),'set':function(_0x3aecca){if(!_0x3aecca)this[_0xfb41('0x14')](_0xfb41('0x15'),null);this[_0xfb41('0x14')](_0xfb41('0x16'),_0x3aecca);}}}; \ No newline at end of file +var _0xa38d=['ENUM','skebby','connectel','clicksend','clickatell','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','name','STRING','generate'];(function(_0x5df0d8,_0x47cb63){var _0x3c64fe=function(_0x5e19bb){while(--_0x5e19bb){_0x5df0d8['push'](_0x5df0d8['shift']());}};_0x3c64fe(++_0x47cb63);}(_0xa38d,0x13e));var _0xda38=function(_0x598d84,_0x19f182){_0x598d84=_0x598d84-0x0;var _0x18423e=_0xa38d[_0x598d84];return _0x18423e;};'use strict';var Sequelize=require(_0xda38('0x0'));var rs=require('randomstring');module[_0xda38('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xda38('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xda38('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xda38('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xda38('0x3')],'defaultValue':function(){return rs[_0xda38('0x4')]();}},'phone':{'type':Sequelize[_0xda38('0x3')]},'type':{'type':Sequelize[_0xda38('0x5')]('twilio',_0xda38('0x6'),_0xda38('0x7'),_0xda38('0x8'),'plivo',_0xda38('0x9'),'bandwidth','csc',_0xda38('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xda38('0x3')]},'authId':{'type':Sequelize[_0xda38('0x3')]},'authToken':{'type':Sequelize[_0xda38('0x3')]},'smsMethod':{'type':Sequelize[_0xda38('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xda38('0x3')]},'password':{'type':Sequelize[_0xda38('0x3')]},'apiKey':{'type':Sequelize[_0xda38('0x3')]},'applicationId':{'type':Sequelize[_0xda38('0x3')]},'accountId':{'type':Sequelize[_0xda38('0x3')]},'senderString':{'type':Sequelize[_0xda38('0x3')]},'deliveryReport':{'type':Sequelize[_0xda38('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xda38('0x3')]},'notificationTemplate':{'type':Sequelize[_0xda38('0xc')],'defaultValue':function(){return _0xda38('0xd');}},'notificationSound':{'type':Sequelize[_0xda38('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xda38('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xda38('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xda38('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xda38('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xda38('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xda38('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xda38('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xda38('0xe')],'comment':_0xda38('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xda38('0x10'),'set':function(_0x445ae7){if(!_0x445ae7)this[_0xda38('0x11')](_0xda38('0x12'),null);this[_0xda38('0x11')]('mandatoryDisposition',_0x445ae7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f6f1227..c887d6f 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 _0x18a9=['inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','infobip','DELIVERED_TO_GATEWAY','update','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','client','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','SmsAccounts','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','mandatoryDispositionPause','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','skebby','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','unshift','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Owner','fullname','internal','color','tag','List','SmsMessage','Messages','dataValues','push'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x18a9,0x1df));var _0x918a=function(_0x1a691a,_0x349066){_0x1a691a=_0x1a691a-0x0;var _0x539f77=_0x18a9[_0x1a691a];return _0x539f77;};'use strict';var emlformat=require(_0x918a('0x0'));var rimraf=require(_0x918a('0x1'));var zipdir=require(_0x918a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x918a('0x3'));var moment=require(_0x918a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x918a('0x5'));var util=require(_0x918a('0x6'));var path=require(_0x918a('0x7'));var sox=require(_0x918a('0x8'));var csv=require(_0x918a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x918a('0xa'));var crypto=require(_0x918a('0xb'));var jsforce=require(_0x918a('0xc'));var deskjs=require(_0x918a('0xd'));var toCsv=require(_0x918a('0x9'));var querystring=require(_0x918a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x918a('0xf'));var qs=require(_0x918a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x918a('0x11'))('api');var utils=require(_0x918a('0x12'));var config=require(_0x918a('0x13'));var licenseUtil=require(_0x918a('0x14'));var db=require(_0x918a('0x15'))['db'];config[_0x918a('0x16')]=_[_0x918a('0x17')](config[_0x918a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x918a('0x18'))(new Redis(config['redis']));require(_0x918a('0x19'))[_0x918a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x918a('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x57e715,_0x743767,_0x15b470,_0x46a687){return new BPromise(function(_0x4823d7,_0xa1d555){var _0x130ed3=_0x46a687||client;return _0x130ed3[_0x918a('0x1c')](_0x57e715,_0x15b470)[_0x918a('0x1d')](function(_0x160c06){logger[_0x918a('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x743767,'request\x20sent');logger[_0x918a('0x1f')](_0x918a('0x20'),_0x743767,_0x918a('0x21'),JSON[_0x918a('0x22')](_0x160c06));if(_0x160c06[_0x918a('0x23')]){if(_0x160c06[_0x918a('0x23')][_0x918a('0x24')]===0x1f4){logger[_0x918a('0x23')](_0x918a('0x25'),_0x743767,_0x160c06[_0x918a('0x23')][_0x918a('0x26')]);return _0xa1d555(_0x160c06[_0x918a('0x23')][_0x918a('0x26')]);}logger[_0x918a('0x23')](_0x918a('0x25'),_0x743767,_0x160c06[_0x918a('0x23')][_0x918a('0x26')]);return _0x4823d7(_0x160c06['error']['message']);}else{logger['info'](_0x918a('0x25'),_0x743767,'request\x20sent');_0x4823d7(_0x160c06[_0x918a('0x27')][_0x918a('0x26')]);}})[_0x918a('0x28')](function(_0x3a51de){logger['error'](_0x918a('0x25'),_0x743767,_0x3a51de);_0xa1d555(_0x3a51de);});});}function respondWithStatusCode(_0x32c704,_0x4a4274){_0x4a4274=_0x4a4274||0xcc;return function(_0x48cbda){if(_0x48cbda){return _0x32c704[_0x918a('0x29')](_0x4a4274);}return _0x32c704[_0x918a('0x2a')](_0x4a4274)[_0x918a('0x2b')]();};}function respondWithResult(_0x4a082f,_0x2034a4){_0x2034a4=_0x2034a4||0xc8;return function(_0x57b83a){if(_0x57b83a){return _0x4a082f[_0x918a('0x2a')](_0x2034a4)[_0x918a('0x2c')](_0x57b83a);}};}function respondWithFilteredResult(_0xe79af2,_0x56a497){return function(_0x34f19a){if(_0x34f19a){var _0x1f4593=typeof _0x56a497[_0x918a('0x2d')]===_0x918a('0x2e')&&typeof _0x56a497[_0x918a('0x2f')]===_0x918a('0x2e');var _0x3ee5d5=_0x34f19a[_0x918a('0x30')];var _0x3db109=_0x1f4593?0x0:_0x56a497['offset'];var _0x4367f1=_0x1f4593?_0x34f19a['count']:_0x56a497['offset']+_0x56a497[_0x918a('0x2f')];var _0x41bb6a;if(_0x4367f1>=_0x3ee5d5){_0x4367f1=_0x3ee5d5;_0x41bb6a=0xc8;}else{_0x41bb6a=0xce;}_0xe79af2[_0x918a('0x2a')](_0x41bb6a);return _0xe79af2[_0x918a('0x31')](_0x918a('0x32'),_0x3db109+'-'+_0x4367f1+'/'+_0x3ee5d5)[_0x918a('0x2c')](_0x34f19a);}return null;};}function patchUpdates(_0x4835ee){return function(_0x28ffb0){try{jsonpatch[_0x918a('0x33')](_0x28ffb0,_0x4835ee,!![]);}catch(_0x43c62b){return BPromise[_0x918a('0x34')](_0x43c62b);}return _0x28ffb0[_0x918a('0x35')]();};}function saveUpdates(_0x3f2a7f,_0x5579ff){return function(_0x7a075){if(_0x7a075){return _0x7a075['update'](_0x3f2a7f)[_0x918a('0x1d')](function(_0x1da315){return _0x1da315;});}return null;};}function removeEntity(_0x33d2ef,_0x2e930a){return function(_0x28e494){if(_0x28e494){return _0x28e494[_0x918a('0x36')]()[_0x918a('0x1d')](function(){var _0x538f6b=_0x28e494[_0x918a('0x37')]({'plain':!![]});var _0x517476=_0x918a('0x38');return db['UserProfileResource'][_0x918a('0x36')]({'where':{'type':_0x517476,'resourceId':_0x538f6b['id']}})['then'](function(){return _0x28e494;});})[_0x918a('0x1d')](function(){_0x33d2ef[_0x918a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f0e1,_0x164d14){return function(_0x34b571){if(!_0x34b571){_0x11f0e1['sendStatus'](0x194);}return _0x34b571;};}function handleError(_0x288a0e,_0x2aaeea){_0x2aaeea=_0x2aaeea||0x1f4;return function(_0x579101){logger[_0x918a('0x23')](_0x579101[_0x918a('0x39')]);if(_0x579101[_0x918a('0x3a')]){delete _0x579101[_0x918a('0x3a')];}_0x288a0e['status'](_0x2aaeea)[_0x918a('0x3b')](_0x579101);};}exports[_0x918a('0x3c')]=function(_0x4656f8,_0x399037){var _0x3dd4e6={'include':[{'model':db[_0x918a('0x3d')],'as':'mandatoryDispositionPause'}]},_0xf6bec9={},_0x3282d9={'count':0x0,'rows':[]};var _0x105428=_['map'](db[_0x918a('0x3e')][_0x918a('0x3f')],function(_0x27f256){return{'name':_0x27f256[_0x918a('0x40')],'type':_0x27f256[_0x918a('0x41')]['key']};});_0xf6bec9[_0x918a('0x42')]=_[_0x918a('0x43')](_0x105428,_0x918a('0x3a'));_0xf6bec9[_0x918a('0x44')]=_[_0x918a('0x45')](_0x4656f8[_0x918a('0x44')]);_0xf6bec9[_0x918a('0x46')]=_['intersection'](_0xf6bec9[_0x918a('0x42')],_0xf6bec9[_0x918a('0x44')]);_0x3dd4e6[_0x918a('0x47')]=_['intersection'](_0xf6bec9['model'],qs[_0x918a('0x48')](_0x4656f8[_0x918a('0x44')][_0x918a('0x48')]));_0x3dd4e6['attributes']=_0x3dd4e6[_0x918a('0x47')][_0x918a('0x49')]?_0x3dd4e6[_0x918a('0x47')]:_0xf6bec9['model'];if(!_0x4656f8[_0x918a('0x44')][_0x918a('0x4a')](_0x918a('0x4b'))){_0x3dd4e6[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0x4656f8[_0x918a('0x44')][_0x918a('0x2f')]);_0x3dd4e6[_0x918a('0x2d')]=qs[_0x918a('0x2d')](_0x4656f8[_0x918a('0x44')][_0x918a('0x2d')]);}_0x3dd4e6[_0x918a('0x4c')]=qs['sort'](_0x4656f8[_0x918a('0x44')][_0x918a('0x4d')]);_0x3dd4e6[_0x918a('0x4e')]=qs[_0x918a('0x46')](_[_0x918a('0x4f')](_0x4656f8[_0x918a('0x44')],_0xf6bec9['filters']),_0x105428);if(_0x4656f8[_0x918a('0x44')]['filter']){_0x3dd4e6[_0x918a('0x4e')]=_[_0x918a('0x50')](_0x3dd4e6[_0x918a('0x4e')],{'$or':_[_0x918a('0x43')](_0x105428,function(_0x4307e8){if(_0x4307e8[_0x918a('0x41')]!=='VIRTUAL'){var _0x43da52={};_0x43da52[_0x4307e8[_0x918a('0x3a')]]={'$like':'%'+_0x4656f8['query'][_0x918a('0x51')]+'%'};return _0x43da52;}})});}_0x3dd4e6=_[_0x918a('0x50')]({},_0x3dd4e6,_0x4656f8[_0x918a('0x52')]);var _0x55b837={'where':_0x3dd4e6[_0x918a('0x4e')]};return db[_0x918a('0x3e')]['count'](_0x55b837)[_0x918a('0x1d')](function(_0xa23d7e){_0x3282d9[_0x918a('0x30')]=_0xa23d7e;if(_0x4656f8[_0x918a('0x44')]['includeAll']){_0x3dd4e6[_0x918a('0x53')]=[{'all':!![]}];}return db[_0x918a('0x3e')][_0x918a('0x54')](_0x3dd4e6);})[_0x918a('0x1d')](function(_0x5da06e){_0x3282d9[_0x918a('0x55')]=_0x5da06e;return _0x3282d9;})['then'](respondWithFilteredResult(_0x399037,_0x3dd4e6))['catch'](handleError(_0x399037,null));};exports[_0x918a('0x56')]=function(_0x42058a,_0x2a4745){var _0x332567={'raw':![],'where':{'id':_0x42058a[_0x918a('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x918a('0x58')}]},_0x14ba08={};_0x14ba08['model']=_[_0x918a('0x45')](db[_0x918a('0x3e')][_0x918a('0x3f')]);_0x14ba08['query']=_[_0x918a('0x45')](_0x42058a[_0x918a('0x44')]);_0x14ba08[_0x918a('0x46')]=_[_0x918a('0x59')](_0x14ba08[_0x918a('0x42')],_0x14ba08[_0x918a('0x44')]);_0x332567['attributes']=_[_0x918a('0x59')](_0x14ba08[_0x918a('0x42')],qs[_0x918a('0x48')](_0x42058a[_0x918a('0x44')]['fields']));_0x332567[_0x918a('0x47')]=_0x332567[_0x918a('0x47')]['length']?_0x332567['attributes']:_0x14ba08[_0x918a('0x42')];if(_0x42058a[_0x918a('0x44')]['includeAll']){_0x332567[_0x918a('0x53')]=[{'all':!![]}];}_0x332567=_[_0x918a('0x50')]({},_0x332567,_0x42058a[_0x918a('0x52')]);return db[_0x918a('0x3e')][_0x918a('0x5a')](_0x332567)[_0x918a('0x1d')](handleEntityNotFound(_0x2a4745,null))[_0x918a('0x1d')](respondWithResult(_0x2a4745,null))['catch'](handleError(_0x2a4745,null));};exports['create']=function(_0x48f2f2,_0x3a1077){return db[_0x918a('0x3e')][_0x918a('0x5b')](_0x48f2f2[_0x918a('0x5c')],{})['then'](function(_0x31aaaf){var _0x1b2a13=_0x48f2f2[_0x918a('0x5d')][_0x918a('0x37')]({'plain':!![]});if(!_0x1b2a13)throw new Error(_0x918a('0x5e'));if(_0x1b2a13[_0x918a('0x5f')]==='user'){var _0x54b718=_0x31aaaf[_0x918a('0x37')]({'plain':!![]});var _0x30741a=_0x918a('0x38');return db['UserProfileSection']['find']({'where':{'name':_0x30741a,'userProfileId':_0x1b2a13[_0x918a('0x60')]},'raw':!![]})[_0x918a('0x1d')](function(_0x909a6d){if(_0x909a6d&&_0x909a6d['autoAssociation']===0x0){return db[_0x918a('0x61')][_0x918a('0x5b')]({'name':_0x54b718[_0x918a('0x3a')],'resourceId':_0x54b718['id'],'type':_0x909a6d[_0x918a('0x3a')],'sectionId':_0x909a6d['id']},{})[_0x918a('0x1d')](function(){return _0x31aaaf;});}else{return _0x31aaaf;}})[_0x918a('0x28')](function(_0x56cb93){logger[_0x918a('0x23')](_0x918a('0x62'),_0x56cb93);throw _0x56cb93;});}return _0x31aaaf;})[_0x918a('0x1d')](respondWithResult(_0x3a1077,0xc9))['catch'](handleError(_0x3a1077,null));};exports['update']=function(_0x39fedf,_0x1c361e){if(_0x39fedf[_0x918a('0x5c')]['id']){delete _0x39fedf[_0x918a('0x5c')]['id'];}return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x39fedf[_0x918a('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x918a('0x58')}]})[_0x918a('0x1d')](handleEntityNotFound(_0x1c361e,null))[_0x918a('0x1d')](saveUpdates(_0x39fedf[_0x918a('0x5c')],null))[_0x918a('0x1d')](respondWithResult(_0x1c361e,null))[_0x918a('0x28')](handleError(_0x1c361e,null));};exports[_0x918a('0x36')]=function(_0xf0b3af,_0x287021){return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0xf0b3af[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x287021,null))['then'](removeEntity(_0x287021,null))[_0x918a('0x28')](handleError(_0x287021,null));};exports['describe']=function(_0x3a6339,_0x53f7d1){return db[_0x918a('0x3e')][_0x918a('0x63')]()[_0x918a('0x1d')](respondWithResult(_0x53f7d1,null))['catch'](handleError(_0x53f7d1,null));};exports[_0x918a('0x64')]=function(_0x33a6ff,_0x172813,_0x482826){if(_0x33a6ff[_0x918a('0x5c')]['id']){delete _0x33a6ff[_0x918a('0x5c')]['id'];}return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x33a6ff[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x172813,null))[_0x918a('0x1d')](function(_0xdcce2d){if(_0xdcce2d){_0x33a6ff[_0x918a('0x5c')][_0x918a('0x65')]=_0xdcce2d['id'];return db[_0x918a('0x66')][_0x918a('0x5b')](_0x33a6ff[_0x918a('0x5c')]);}})[_0x918a('0x1d')](respondWithResult(_0x172813,null))[_0x918a('0x28')](handleError(_0x172813,null));};exports[_0x918a('0x67')]=function(_0xe4da02,_0x5dbd75,_0x462367){var _0x9c8422={'raw':![],'where':{}};var _0x2fb685={};var _0x78e41a={'count':0x0,'rows':[]};return db[_0x918a('0x3e')][_0x918a('0x68')]({'where':{'id':_0xe4da02['params']['id']}})['then'](handleEntityNotFound(_0x5dbd75,null))[_0x918a('0x1d')](function(_0x4fb496){if(_0x4fb496){_0x2fb685[_0x918a('0x42')]=_[_0x918a('0x45')](db[_0x918a('0x66')][_0x918a('0x3f')]);_0x2fb685[_0x918a('0x44')]=_[_0x918a('0x45')](_0xe4da02['query']);_0x2fb685['filters']=_[_0x918a('0x59')](_0x2fb685[_0x918a('0x42')],_0x2fb685['query']);_0x9c8422[_0x918a('0x47')]=_[_0x918a('0x59')](_0x2fb685['model'],qs[_0x918a('0x48')](_0xe4da02[_0x918a('0x44')]['fields']));_0x9c8422[_0x918a('0x47')]=_0x9c8422[_0x918a('0x47')][_0x918a('0x49')]?_0x9c8422[_0x918a('0x47')]:_0x2fb685[_0x918a('0x42')];if(!_0xe4da02[_0x918a('0x44')]['hasOwnProperty'](_0x918a('0x4b'))){_0x9c8422[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0xe4da02[_0x918a('0x44')]['limit']);_0x9c8422[_0x918a('0x2d')]=qs[_0x918a('0x2d')](_0xe4da02['query'][_0x918a('0x2d')]);}_0x9c8422[_0x918a('0x4c')]=qs[_0x918a('0x4d')](_0xe4da02[_0x918a('0x44')][_0x918a('0x4d')]);_0x9c8422[_0x918a('0x4e')]=qs['filters'](_[_0x918a('0x4f')](_0xe4da02['query'],_0x2fb685[_0x918a('0x46')]));_0x9c8422[_0x918a('0x4e')][_0x918a('0x65')]=_0x4fb496['id'];if(_0xe4da02[_0x918a('0x44')]['filter']){_0x9c8422['where']=_[_0x918a('0x50')](_0x9c8422['where'],{'$or':_[_0x918a('0x43')](_0x9c8422['attributes'],function(_0x5ddfbd){var _0x298bee={};_0x298bee[_0x5ddfbd]={'$like':'%'+_0xe4da02[_0x918a('0x44')][_0x918a('0x51')]+'%'};return _0x298bee;})});}_0x9c8422=_[_0x918a('0x50')]({},_0x9c8422,_0xe4da02['options']);return db['Disposition']['count']({'where':_0x9c8422[_0x918a('0x4e')]})[_0x918a('0x1d')](function(_0xf880d8){_0x78e41a[_0x918a('0x30')]=_0xf880d8;if(_0xe4da02['query'][_0x918a('0x69')]){_0x9c8422[_0x918a('0x53')]=[{'all':!![]}];}return db[_0x918a('0x66')][_0x918a('0x54')](_0x9c8422);})['then'](function(_0x47108e){_0x78e41a['rows']=_0x47108e;return _0x78e41a;});}})[_0x918a('0x1d')](respondWithFilteredResult(_0x5dbd75,_0x9c8422))[_0x918a('0x28')](handleError(_0x5dbd75,null));};exports[_0x918a('0x6a')]=function(_0x1ac7ac,_0x46593f,_0x1cd0b0){return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x1ac7ac[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x46593f,null))[_0x918a('0x1d')](function(_0x37691f){if(_0x37691f){return _0x37691f[_0x918a('0x6a')](_0x1ac7ac[_0x918a('0x44')][_0x918a('0x6b')]);}})['then'](respondWithStatusCode(_0x46593f,null))[_0x918a('0x28')](handleError(_0x46593f,null));};exports['addAnswer']=function(_0x33fb9a,_0x2f2da2,_0x38173b){if(_0x33fb9a[_0x918a('0x5c')]['id']){delete _0x33fb9a['body']['id'];}return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x33fb9a[_0x918a('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f2da2,null))[_0x918a('0x1d')](function(_0x31ada4){if(_0x31ada4){_0x33fb9a[_0x918a('0x5c')][_0x918a('0x65')]=_0x31ada4['id'];return db[_0x918a('0x6c')][_0x918a('0x5b')](_0x33fb9a[_0x918a('0x5c')]);}})[_0x918a('0x1d')](respondWithResult(_0x2f2da2,null))[_0x918a('0x28')](handleError(_0x2f2da2,null));};exports[_0x918a('0x6d')]=function(_0x53384c,_0x49a067,_0x404be9){var _0x1cd267={'raw':![],'where':{}};var _0x3e91b4={};var _0x446a0a={'count':0x0,'rows':[]};return db[_0x918a('0x3e')][_0x918a('0x68')]({'where':{'id':_0x53384c[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x49a067,null))[_0x918a('0x1d')](function(_0x5b6a28){if(_0x5b6a28){_0x3e91b4[_0x918a('0x42')]=_['keys'](db[_0x918a('0x6c')][_0x918a('0x3f')]);_0x3e91b4[_0x918a('0x44')]=_[_0x918a('0x45')](_0x53384c[_0x918a('0x44')]);_0x3e91b4[_0x918a('0x46')]=_[_0x918a('0x59')](_0x3e91b4[_0x918a('0x42')],_0x3e91b4['query']);_0x1cd267['attributes']=_[_0x918a('0x59')](_0x3e91b4[_0x918a('0x42')],qs[_0x918a('0x48')](_0x53384c[_0x918a('0x44')][_0x918a('0x48')]));_0x1cd267[_0x918a('0x47')]=_0x1cd267[_0x918a('0x47')][_0x918a('0x49')]?_0x1cd267['attributes']:_0x3e91b4['model'];if(!_0x53384c[_0x918a('0x44')][_0x918a('0x4a')](_0x918a('0x4b'))){_0x1cd267[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0x53384c[_0x918a('0x44')][_0x918a('0x2f')]);_0x1cd267['offset']=qs[_0x918a('0x2d')](_0x53384c[_0x918a('0x44')][_0x918a('0x2d')]);}_0x1cd267[_0x918a('0x4c')]=qs[_0x918a('0x4d')](_0x53384c[_0x918a('0x44')]['sort']);_0x1cd267['where']=qs['filters'](_['pick'](_0x53384c[_0x918a('0x44')],_0x3e91b4[_0x918a('0x46')]));_0x1cd267[_0x918a('0x4e')][_0x918a('0x65')]=_0x5b6a28['id'];if(_0x53384c['query']['filter']){_0x1cd267[_0x918a('0x4e')]=_[_0x918a('0x50')](_0x1cd267[_0x918a('0x4e')],{'$or':_[_0x918a('0x43')](_0x1cd267[_0x918a('0x47')],function(_0x2b7130){var _0x514a5d={};_0x514a5d[_0x2b7130]={'$like':'%'+_0x53384c[_0x918a('0x44')]['filter']+'%'};return _0x514a5d;})});}_0x1cd267=_['merge']({},_0x1cd267,_0x53384c[_0x918a('0x52')]);return db[_0x918a('0x6c')]['count']({'where':_0x1cd267[_0x918a('0x4e')]})[_0x918a('0x1d')](function(_0x2e0171){_0x446a0a[_0x918a('0x30')]=_0x2e0171;if(_0x53384c[_0x918a('0x44')]['includeAll']){_0x1cd267['include']=[{'all':!![]}];}return db[_0x918a('0x6c')][_0x918a('0x54')](_0x1cd267);})[_0x918a('0x1d')](function(_0x3a8724){_0x446a0a[_0x918a('0x55')]=_0x3a8724;return _0x446a0a;});}})[_0x918a('0x1d')](respondWithFilteredResult(_0x49a067,_0x1cd267))['catch'](handleError(_0x49a067,null));};exports[_0x918a('0x6e')]=function(_0x100e7b,_0x9fe7c2,_0x415234){return db['SmsAccount'][_0x918a('0x5a')]({'where':{'id':_0x100e7b[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x9fe7c2,null))[_0x918a('0x1d')](function(_0x162219){if(_0x162219){return _0x162219[_0x918a('0x6e')](_0x100e7b['query'][_0x918a('0x6b')]);}})['then'](respondWithStatusCode(_0x9fe7c2,null))[_0x918a('0x28')](handleError(_0x9fe7c2,null));};exports['notify']=function(_0x99a84,_0x2d3a9d,_0x39e9bb){var _0x2ba6b0={'channel':_0x918a('0x6f')};var _0x32fb35=[];var _0x4ef00b=[];var _0x21417a={};return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x99a84['params']['id']},'include':[{'model':db[_0x918a('0x70')],'as':_0x918a('0x71')}]})[_0x918a('0x1d')](handleEntityNotFound(_0x2d3a9d,null))[_0x918a('0x1d')](function(_0x4e1d78){_0x2ba6b0['account']=_0x4e1d78;_0x2ba6b0[_0x918a('0x72')]=_[_0x918a('0x73')](_0x4e1d78[_0x918a('0x71')],['priority'],[_0x918a('0x74')]);if(_0x2ba6b0['account'][_0x918a('0x71')]){delete _0x2ba6b0[_0x918a('0x75')][_0x918a('0x71')];}return db[_0x918a('0x76')][_0x918a('0x63')]();})[_0x918a('0x1d')](function(_0x5731f7){if(!_0x5731f7){throw new db[(_0x918a('0x77'))][(_0x918a('0x78'))](_0x918a('0x79'));}_0x32fb35=_[_0x918a('0x7a')](_['keys'](_0x5731f7),['createdAt',_0x918a('0x7b')]);_0x4ef00b=_['difference'](_[_0x918a('0x45')](_0x5731f7),['createdAt',_0x918a('0x7b'),_0x918a('0x7c'),_0x918a('0x7d')]);_0x2ba6b0[_0x918a('0x5c')]={'mapKey':_0x918a('0x7e')};if(_0x2ba6b0[_0x918a('0x75')][_0x918a('0x41')]){switch(_0x2ba6b0[_0x918a('0x75')][_0x918a('0x41')]){case _0x918a('0x7f'):_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84['body'][_0x918a('0x81')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84['body'][_0x918a('0x82')];_0x2ba6b0[_0x918a('0x5c')]['messageId']=_0x99a84[_0x918a('0x5c')]['MessageSid'];break;case _0x918a('0x83'):_0x2ba6b0[_0x918a('0x5c')]['from']='+'+_0x99a84['body']['sender'];_0x2ba6b0['body']['body']=_0x99a84[_0x918a('0x5c')][_0x918a('0x84')];break;case _0x918a('0x85'):_0x2ba6b0[_0x918a('0x5c')]['from']=_0x99a84[_0x918a('0x5c')][_0x918a('0x80')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x26')];break;case _0x918a('0x86'):_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x80')];_0x2ba6b0[_0x918a('0x5c')]['body']=_0x99a84['body'][_0x918a('0x5c')];_0x2ba6b0['body'][_0x918a('0x87')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x88')];break;case _0x918a('0x89'):_0x2ba6b0['body']['from']=_0x99a84[_0x918a('0x5c')][_0x918a('0x81')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84['body'][_0x918a('0x8a')];_0x2ba6b0['body'][_0x918a('0x87')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x8b')];break;case'infobip':_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]='+'+_0x99a84[_0x918a('0x5c')][_0x918a('0x8c')][0x0][_0x918a('0x80')];_0x2ba6b0[_0x918a('0x5c')]['body']=_0x99a84['body'][_0x918a('0x8c')][0x0][_0x918a('0x84')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x87')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x8c')][0x0][_0x918a('0x87')];break;case _0x918a('0x8d'):_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x8e')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x8f')][_0x918a('0x26')];break;case _0x918a('0x90'):_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x91')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x84')];_0x2ba6b0['body'][_0x918a('0x87')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x92')];break;case _0x918a('0x93'):_0x2ba6b0[_0x918a('0x5c')]['messageId']=_0x99a84['body'][0x0][_0x918a('0x26')]['id'];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84[_0x918a('0x5c')][0x0][_0x918a('0x26')]['from'];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84[_0x918a('0x5c')][0x0]['message'][_0x918a('0x84')];break;case _0x918a('0x94'):_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x80')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')]=_0x99a84['body'][_0x918a('0x26')];_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x87')]=_0x99a84[_0x918a('0x5c')][_0x918a('0x95')];break;}}if(_0x2ba6b0[_0x918a('0x5c')]['id']){delete _0x2ba6b0[_0x918a('0x5c')]['id'];}if(_['isNil'](_0x2ba6b0['body'][_0x918a('0x80')])){throw new db['Sequelize'][(_0x918a('0x78'))](_0x918a('0x96'));}if(_[_0x918a('0x97')](_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')])||_0x2ba6b0['body'][_0x918a('0x5c')]===''){throw new db[(_0x918a('0x77'))][(_0x918a('0x78'))](_0x918a('0x98'));}if(_['isNil'](_0x2ba6b0['body']['mapKey'])){throw new db[(_0x918a('0x77'))][(_0x918a('0x78'))](_0x918a('0x99')+_0x4ef00b);}if(!_[_0x918a('0x9a')](_0x4ef00b,_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x9b')])){throw new db['Sequelize'][(_0x918a('0x78'))](_0x918a('0x9c')+_0x4ef00b);}_0x21417a[_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x9b')]]=_0x2ba6b0['body'][_0x918a('0x80')];return db[_0x918a('0x9d')]['find']({'where':{'id':_0x2ba6b0[_0x918a('0x75')][_0x918a('0x7d')]},'include':[{'model':db['CmContact'],'as':_0x918a('0x9e'),'where':_0x21417a,'limit':0x1,'order':[[_0x918a('0x7b'),_0x918a('0x9f')]]}]});})[_0x918a('0x1d')](handleEntityNotFound(_0x2d3a9d,null))['then'](function(_0x4b23c4){if(_0x4b23c4){_0x2ba6b0['list']=_[_0x918a('0xa0')](_0x4b23c4,[_0x918a('0x9e')]);if(_0x4b23c4['Contacts'][_0x918a('0x49')]){return _0x4b23c4[_0x918a('0x9e')][0x0];}var _0x58b79d=_[_0x918a('0x17')](_0x2ba6b0['body'],{'firstName':_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')],'ListId':_0x4b23c4['id']});_0x58b79d[_0x2ba6b0[_0x918a('0x5c')]['mapKey']]=_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')];return db[_0x918a('0x76')][_0x918a('0x5b')](_0x58b79d,{'fields':_0x32fb35,'raw':!![]});}})[_0x918a('0x1d')](handleEntityNotFound(_0x2d3a9d,null))[_0x918a('0x1d')](function(_0x260d73){if(_0x260d73){_0x2ba6b0[_0x918a('0xa1')]=_0x260d73;var _0xa74c={'ContactId':_0x260d73['id'],'phone':_0x2ba6b0['body'][_0x918a('0x80')],'SmsAccountId':_0x99a84[_0x918a('0x57')]['id']};var _0x4e14af={'ContactId':_0x260d73['id'],'SmsAccountId':_0x99a84[_0x918a('0x57')]['id'],'closed':![]};return db[_0x918a('0xa2')][_0x918a('0x5a')]({'where':_0x4e14af})[_0x918a('0x1d')](function(_0x396ae0){if(_0x396ae0){return[_0x396ae0,![]];}return db[_0x918a('0xa2')][_0x918a('0x5b')](_0xa74c)[_0x918a('0x1d')](function(_0x220973){return[_0x220973,!![]];});});}})[_0x918a('0xa3')](function(_0x16a4aa,_0x2f3be4){_0x2ba6b0[_0x918a('0xa4')]=_0x16a4aa[_0x918a('0x37')]({'plain':!![]});_0x2ba6b0[_0x918a('0xa4')][_0x918a('0xa5')]=![];if(_0x2f3be4){if(_0x2ba6b0[_0x918a('0x75')][_0x918a('0xa6')]){_0x2ba6b0['applications']['push']({'id':0x0,'priority':_0x2ba6b0['applications']['length']+0x1,'app':_0x918a('0xa7'),'appdata':_0x918a('0xa8'),'interval':_0x918a('0xa9')});}_0x2ba6b0[_0x918a('0xa4')][_0x918a('0xa5')]=!![];}return db['SmsMessage'][_0x918a('0x5b')]({'phone':_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x80')],'messageId':_0x2ba6b0[_0x918a('0x5c')]['messageId'],'body':_0x2ba6b0[_0x918a('0x5c')][_0x918a('0x5c')],'SmsAccountId':_0x99a84[_0x918a('0x57')]['id'],'SmsInteractionId':_0x16a4aa['id'],'direction':'in','ContactId':_0x16a4aa[_0x918a('0xaa')],'AttachmentId':_0x2ba6b0[_0x918a('0x5c')][_0x918a('0xab')]});})[_0x918a('0x1d')](function(_0x5573c7){_0x2ba6b0[_0x918a('0x26')]=_0x5573c7;if(_0x2ba6b0[_0x918a('0xa4')]['UserId']){return db[_0x918a('0xac')][_0x918a('0x5a')]({'attributes':['id',_0x918a('0x3a')],'where':{'id':_0x2ba6b0['interaction']['UserId']}})[_0x918a('0x1d')](function(_0x19bf80){if(_0x19bf80){_0x2ba6b0[_0x918a('0x72')][_0x918a('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x19bf80['name']+','+(_0x2ba6b0[_0x918a('0x75')]['waitForTheAssignedAgent']||0xa),'interval':_0x918a('0xa9')});}return respondWithRpcPromise(_0x918a('0xae'),_0x918a('0xaf'),_0x2ba6b0);});}return respondWithRpcPromise(_0x918a('0xae'),_0x918a('0xaf'),_0x2ba6b0);})['then'](function(_0x27b1b4){if(_0x27b1b4){var _0x3ee680=0xc8;var _0x1954bd='receiveMessage';logger['info'](_0x918a('0x20'),_0x1954bd,_0x3ee680,_0x918a('0xb0'));logger[_0x918a('0x1f')](_0x918a('0xb1'),_0x1954bd,_0x3ee680,'entity\x20found',JSON['stringify'](_0x27b1b4));if(_0x2ba6b0['account'][_0x918a('0x41')]===_0x918a('0x7f')){return _0x2d3a9d[_0x918a('0x2a')](_0x3ee680)['set'](_0x918a('0xb2'),'text/xml')['send'](_0x918a('0xb3'));}else{return _0x2d3a9d[_0x918a('0x2a')](_0x3ee680)['json'](_0x27b1b4);}}})['catch'](handleError(_0x2d3a9d,null));};exports[_0x918a('0xb4')]=function(_0x2ec1dd,_0x43ae2c){var _0x1f14f9=_0x2ec1dd[_0x918a('0x57')]['id'];var _0x3c3852=_0x2ec1dd['body'];var _0x53a351=0xc8;var _0x5baad5=null;return db['sequelize'][_0x918a('0xb5')]({'isolationLevel':db[_0x918a('0xb6')][_0x918a('0xb7')][_0x918a('0xb8')][_0x918a('0xb9')]},function(_0x161745){return db[_0x918a('0x3e')]['findOne']({'where':{'id':_0x1f14f9},'transaction':_0x161745})['then'](function(_0x103d83){if(_0x103d83){return db['SmsApplication'][_0x918a('0x36')]({'where':{'SmsAccountId':_0x1f14f9},'transaction':_0x161745})[_0x918a('0x1d')](function(){var _0x322887=_[_0x918a('0x43')](_0x3c3852,function(_0x7d84b3){_0x7d84b3['SmsAccountId']=_0x1f14f9;return _0x7d84b3;});return db[_0x918a('0x70')][_0x918a('0xba')](_0x322887,{'transaction':_0x161745});});}else{_0x53a351=0x194;_0x5baad5=[];}});})[_0x918a('0x1d')](function(){if(_0x53a351!==0x194){return db[_0x918a('0x70')][_0x918a('0xbb')]({'where':{'SmsAccountId':_0x1f14f9},'order':_0x918a('0xbc')})['then'](function(_0x5e2365){_0x5baad5=_0x5e2365;});}})[_0x918a('0x28')](function(_0x39e683){_0x53a351=0x1f4;logger[_0x918a('0x23')](_0x39e683[_0x918a('0x39')]);if(_0x39e683[_0x918a('0x3a')]){delete _0x39e683[_0x918a('0x3a')];}_0x5baad5=_0x39e683;})[_0x918a('0xbd')](function(){if(_0x5baad5===null){_0x43ae2c[_0x918a('0x29')](_0x53a351);}else{if(_0x53a351===0x1f4){_0x43ae2c[_0x918a('0x2a')](_0x53a351)[_0x918a('0x3b')](_0x5baad5);}else{_0x43ae2c[_0x918a('0x2a')](_0x53a351)['json'](_0x5baad5);}}});};exports['getApplications']=function(_0x25db31,_0x58a5d7,_0x5be719){var _0x429584={};var _0x556f13={};var _0x228e61;var _0x5ee664;return db[_0x918a('0x3e')][_0x918a('0x68')]({'where':{'id':_0x25db31[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x58a5d7,null))['then'](function(_0x59009a){if(_0x59009a){_0x228e61=_0x59009a;_0x556f13[_0x918a('0x42')]=_[_0x918a('0x45')](db[_0x918a('0x70')][_0x918a('0x3f')]);_0x556f13[_0x918a('0x44')]=_['keys'](_0x25db31[_0x918a('0x44')]);_0x556f13[_0x918a('0x46')]=_['intersection'](_0x556f13[_0x918a('0x42')],_0x556f13[_0x918a('0x44')]);_0x429584[_0x918a('0x47')]=_[_0x918a('0x59')](_0x556f13[_0x918a('0x42')],qs[_0x918a('0x48')](_0x25db31[_0x918a('0x44')]['fields']));_0x429584[_0x918a('0x47')]=_0x429584['attributes'][_0x918a('0x49')]?_0x429584[_0x918a('0x47')]:_0x556f13[_0x918a('0x42')];_0x429584[_0x918a('0x4c')]=qs[_0x918a('0x4d')](_0x25db31[_0x918a('0x44')][_0x918a('0x4d')]);_0x429584[_0x918a('0x4e')]=qs[_0x918a('0x46')](_[_0x918a('0x4f')](_0x25db31[_0x918a('0x44')],_0x556f13[_0x918a('0x46')]));if(_0x25db31['query'][_0x918a('0x51')]){_0x429584[_0x918a('0x4e')]=_[_0x918a('0x50')](_0x429584[_0x918a('0x4e')],{'$or':_[_0x918a('0x43')](_0x429584['attributes'],function(_0x1dce82){var _0x52c4d5={};_0x52c4d5[_0x1dce82]={'$like':'%'+_0x25db31[_0x918a('0x44')][_0x918a('0x51')]+'%'};return _0x52c4d5;})});}_0x429584=_['merge']({},_0x429584,_0x25db31[_0x918a('0x52')]);return _0x228e61[_0x918a('0xbe')](_0x429584);}})['then'](function(_0x39b859){if(_0x39b859){_0x5ee664=_0x39b859[_0x918a('0x49')];if(!_0x25db31[_0x918a('0x44')]['hasOwnProperty'](_0x918a('0x4b'))){_0x429584['limit']=qs[_0x918a('0x2f')](_0x25db31[_0x918a('0x44')][_0x918a('0x2f')]);_0x429584[_0x918a('0x2d')]=qs[_0x918a('0x2d')](_0x25db31['query'][_0x918a('0x2d')]);}return _0x228e61[_0x918a('0xbe')](_0x429584);}})[_0x918a('0x1d')](function(_0x32edc3){if(_0x32edc3){return _0x32edc3?{'count':_0x5ee664,'rows':_0x32edc3}:null;}})[_0x918a('0x1d')](respondWithResult(_0x58a5d7,null))[_0x918a('0x28')](handleError(_0x58a5d7,null));};exports[_0x918a('0xbf')]=function(_0x1ab897,_0x15a41a,_0x14e6f3){var _0x3d53e6={'raw':![],'where':{}};var _0x4ce755={};var _0x3112e8={'count':0x0,'rows':[]};return db[_0x918a('0x3e')]['findOne']({'where':{'id':_0x1ab897[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x15a41a,null))[_0x918a('0x1d')](function(_0x50786a){if(_0x50786a){_0x4ce755[_0x918a('0x42')]=_[_0x918a('0x45')](db[_0x918a('0xa2')][_0x918a('0x3f')]);_0x4ce755[_0x918a('0x44')]=_[_0x918a('0x45')](_0x1ab897['query']);_0x4ce755[_0x918a('0x46')]=_['intersection'](_0x4ce755[_0x918a('0x42')],_0x4ce755['query']);_0x3d53e6[_0x918a('0x47')]=_[_0x918a('0x59')](_0x4ce755['model'],qs[_0x918a('0x48')](_0x1ab897[_0x918a('0x44')]['fields']));_0x3d53e6[_0x918a('0x47')]=_0x3d53e6[_0x918a('0x47')][_0x918a('0x49')]?_0x3d53e6[_0x918a('0x47')]:_0x4ce755[_0x918a('0x42')];if(!_0x1ab897[_0x918a('0x44')][_0x918a('0x4a')]('nolimit')){_0x3d53e6[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0x1ab897[_0x918a('0x44')][_0x918a('0x2f')]);_0x3d53e6[_0x918a('0x2d')]=qs['offset'](_0x1ab897[_0x918a('0x44')][_0x918a('0x2d')]);}_0x3d53e6['order']=qs[_0x918a('0x4d')](_0x1ab897['query'][_0x918a('0x4d')]);_0x3d53e6[_0x918a('0x4e')]=qs[_0x918a('0x46')](_['pick'](_0x1ab897[_0x918a('0x44')],_0x4ce755['filters']));_0x3d53e6[_0x918a('0x4e')][_0x918a('0x65')]=_0x50786a['id'];if(_0x1ab897['query']['filter']){_0x3d53e6['where']=_[_0x918a('0x50')](_0x3d53e6[_0x918a('0x4e')],{'$or':_['map'](_0x3d53e6[_0x918a('0x47')],function(_0x1952e0){var _0x6153a7={};_0x6153a7[_0x1952e0]={'$like':'%'+_0x1ab897[_0x918a('0x44')]['filter']+'%'};return _0x6153a7;})});}_0x3d53e6=_[_0x918a('0x50')]({},_0x3d53e6,_0x1ab897['options']);return db[_0x918a('0xa2')][_0x918a('0x30')]({'where':_0x3d53e6[_0x918a('0x4e')]})[_0x918a('0x1d')](function(_0x11bcbe){_0x3112e8[_0x918a('0x30')]=_0x11bcbe;if(_0x1ab897[_0x918a('0x44')][_0x918a('0x69')]){_0x3d53e6['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x918a('0xac')],'as':_0x918a('0xc0'),'attributes':[_0x918a('0x3a'),_0x918a('0xc1'),_0x918a('0xc2')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x918a('0x3a'),_0x918a('0xc3')],'where':_0x1ab897[_0x918a('0x44')]['tag']?{'id':_0x1ab897[_0x918a('0x44')][_0x918a('0xc4')]}:undefined,'required':_0x1ab897[_0x918a('0x44')][_0x918a('0xc4')]?!![]:![]}];}return db[_0x918a('0xa2')]['findAll'](_0x3d53e6);})[_0x918a('0x1d')](function(_0x22815f){_0x3112e8[_0x918a('0x55')]=_0x22815f;return _0x3112e8;});}})[_0x918a('0x1d')](respondWithFilteredResult(_0x15a41a,_0x3d53e6))['catch'](handleError(_0x15a41a,null));};exports[_0x918a('0x3b')]=function(_0x96a96b,_0x3a586e,_0xaa8fd){var _0x2c94b2,_0x4d57b9,_0x1a66f8;if(_[_0x918a('0x97')](_0x96a96b['body'][_0x918a('0x5c')])||_0x96a96b[_0x918a('0x5c')][_0x918a('0x5c')]===''){throw new db[(_0x918a('0x77'))][(_0x918a('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x918a('0x97')](_0x96a96b['body']['to'])){throw new db[(_0x918a('0x77'))][(_0x918a('0x78'))]('to\x20is\x20mandatory');}_0x2c94b2=_0x96a96b[_0x918a('0x5c')]['to'];return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x96a96b['params']['id']},'include':[{'model':db[_0x918a('0x9d')],'as':_0x918a('0xc5'),'include':[{'model':db[_0x918a('0x76')],'as':_0x918a('0x9e'),'where':{'mobile':_0x2c94b2},'limit':0x1,'order':[[_0x918a('0x7b'),_0x918a('0x9f')]]}]}]})[_0x918a('0x1d')](handleEntityNotFound(_0x3a586e,null))[_0x918a('0x1d')](function(_0x22af45){if(_0x22af45&&_0x22af45[_0x918a('0xc5')]){_0x4d57b9=_0x22af45[_0x918a('0x37')]({'plain':!![]});if(_0x4d57b9[_0x918a('0xc5')]&&_0x4d57b9[_0x918a('0xc5')][_0x918a('0x9e')][_0x918a('0x49')]){return _0x4d57b9['List'][_0x918a('0x9e')][0x0];}return db['CmContact'][_0x918a('0x5b')](_[_0x918a('0x17')](_0x96a96b['body'],{'firstName':_0x2c94b2,'mobile':_0x2c94b2,'phone':_0x2c94b2,'ListId':_0x4d57b9[_0x918a('0x7d')]}));}})['then'](handleEntityNotFound(_0x3a586e,null))[_0x918a('0x1d')](function(_0x22df21){if(_0x22df21){_0x1a66f8=_0x22df21;return db['SmsInteraction']['find']({'where':{'ContactId':_0x1a66f8['id'],'closed':![],'SmsAccountId':_0x4d57b9['id']}})['then'](function(_0x5349c7){if(_0x5349c7){return[_0x5349c7,![]];}return db[_0x918a('0xa2')][_0x918a('0x5b')]({'UserId':_0x96a96b['user']['id'],'ContactId':_0x1a66f8['id'],'SmsAccountId':_0x4d57b9['id'],'phone':_0x2c94b2,'firstMsgDirection':'out','Messages':[_['merge'](_0x96a96b[_0x918a('0x5c')],{'read':![],'body':_0x96a96b['body'][_0x918a('0x5c')],'phone':_0x2c94b2,'SmsAccountId':_0x4d57b9['id'],'UserId':_0x96a96b[_0x918a('0x5d')]['id'],'ContactId':_0x1a66f8['id']})]},{'include':[{'model':db[_0x918a('0xc6')],'as':_0x918a('0xc7')}]})[_0x918a('0x1d')](function(_0x24fb71){return[_0x24fb71,!![]];});});}})[_0x918a('0xa3')](function(_0x1023f9,_0x566b1e){if(_0x566b1e){return _0x1023f9;}return db[_0x918a('0xc6')][_0x918a('0x5b')](_[_0x918a('0x50')](_0x96a96b['body'],{'read':![],'body':_0x96a96b[_0x918a('0x5c')][_0x918a('0x5c')],'phone':_0x2c94b2,'SmsAccountId':_0x4d57b9['id'],'SmsInteractionId':_0x1023f9['id'],'UserId':_0x96a96b[_0x918a('0x5d')]['id'],'ContactId':_0x1a66f8['id']}))[_0x918a('0x1d')](function(_0x51ec15){_0x1023f9[_0x918a('0xc8')][_0x918a('0xc7')]=[];_0x1023f9[_0x918a('0xc8')][_0x918a('0xc7')][_0x918a('0xc9')](_0x51ec15[_0x918a('0xc8')]);return _0x1023f9;});})[_0x918a('0x1d')](respondWithResult(_0x3a586e,null))[_0x918a('0x28')](handleError(_0x3a586e,null));};exports[_0x918a('0x2a')]=function(_0x16fcdc,_0x40f542,_0x4f7a64){if(_0x16fcdc[_0x918a('0x5c')]['id']){delete _0x16fcdc[_0x918a('0x5c')]['id'];}var _0x11ebba,_0x1ff6e8,_0x4e5af7;return db['SmsAccount']['find']({'where':{'id':_0x16fcdc[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x40f542,null))['then'](function(_0x3dc3be){if(_0x3dc3be){_0x4e5af7=_0x3dc3be;logger[_0x918a('0x1f')](_0x918a('0x20'),_0x918a('0x2a'),'received\x20delivery\x20report\x20from',_0x3dc3be[_0x918a('0x41')],util[_0x918a('0xca')](_0x16fcdc['body'],{'showHidden':![],'depth':null}));switch(_0x3dc3be[_0x918a('0x41')]){case _0x918a('0x83'):if(_0x16fcdc[_0x918a('0x5c')][_0x918a('0xcb')]&&_0x16fcdc[_0x918a('0x5c')][_0x918a('0x2a')]){_0x1ff6e8=_0x16fcdc[_0x918a('0x5c')][_0x918a('0x2a')];return db[_0x918a('0xc6')][_0x918a('0x5a')]({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')][_0x918a('0xcb')]}});}break;case'connectel':if(_0x16fcdc['body'][_0x918a('0xcc')]&&_0x16fcdc[_0x918a('0x5c')]['statusInt']){_0x1ff6e8=_0x16fcdc['body'][_0x918a('0xcd')];return db[_0x918a('0xc6')]['find']({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')][_0x918a('0xcc')]}});}break;case _0x918a('0x86'):if(_0x16fcdc[_0x918a('0x5c')][_0x918a('0x88')]&&_0x16fcdc['body'][_0x918a('0xce')]){_0x1ff6e8=_0x16fcdc[_0x918a('0x5c')]['status_code'];return db['SmsMessage'][_0x918a('0x5a')]({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')][_0x918a('0x88')]}});}break;case'infobip':var _0x3b2965=_0x16fcdc[_0x918a('0x5c')][_0x918a('0x8c')][0x0];if(_0x3b2965[_0x918a('0x87')]&&_0x3b2965[_0x918a('0x2a')][_0x918a('0xcf')]===_0x918a('0xd0')){_0x1ff6e8=_0x3b2965[_0x918a('0x2a')][_0x918a('0xcf')];return db['SmsMessage'][_0x918a('0x5a')]({'where':{'messageId':_0x3b2965[_0x918a('0x87')]}});}break;case _0x918a('0x90'):if(_0x16fcdc[_0x918a('0x5c')]['messageId']&&_0x16fcdc[_0x918a('0x5c')][_0x918a('0x2a')]){_0x1ff6e8=_0x16fcdc[_0x918a('0x5c')][_0x918a('0x2a')];return db[_0x918a('0xc6')][_0x918a('0x5a')]({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')][_0x918a('0x87')]}});}break;case _0x918a('0x93'):if(_0x16fcdc[_0x918a('0x5c')][0x0][_0x918a('0x26')]['id']){_0x1ff6e8=_0x16fcdc['body'][0x0][_0x918a('0x41')];return db[_0x918a('0xc6')][_0x918a('0x5a')]({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')][0x0][_0x918a('0x26')]['id']}});}break;case _0x918a('0x94'):if(_0x16fcdc[_0x918a('0x5c')][_0x918a('0xd1')]&&_0x16fcdc['body'][_0x918a('0x2a')]){_0x1ff6e8=_0x16fcdc['body'][_0x918a('0x2a')];return db['SmsMessage'][_0x918a('0x5a')]({'where':{'messageId':_0x16fcdc[_0x918a('0x5c')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x40f542,null))[_0x918a('0x1d')](function(_0x336313){if(_0x336313){_0x11ebba=_0x336313;switch(_0x4e5af7[_0x918a('0x41')]){case'skebby':if(_0x1ff6e8===_0x918a('0xd0')){return _0x11ebba['update']({'read':!![]});}else{logger[_0x918a('0x23')](_0x918a('0x20'),_0x918a('0x2a'),_0x918a('0x83'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x918a('0x85'):if(_0x1ff6e8==='1'){return _0x11ebba['update']({'read':!![]});}else{logger[_0x918a('0x23')](_0x918a('0x20'),_0x918a('0x2a'),_0x918a('0x83'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x918a('0x86'):if(!_0x16fcdc[_0x918a('0x5c')][_0x918a('0xd2')]&&_0x1ff6e8>=0xc8&&_0x1ff6e8<=0xce){return _0x11ebba['update']({'read':!![]});}else{logger[_0x918a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x918a('0x2a'),_0x918a('0x86'),util['inspect'](_0x16fcdc['body'],{'showHidden':![],'depth':null}));}break;case _0x918a('0xd3'):var _0x18dcaf=_0x16fcdc[_0x918a('0x5c')]['results'][0x0];if(_0x18dcaf[_0x918a('0x2a')]['groupName']===_0x918a('0xd0')){return _0x11ebba['update']({'read':!![]});}else{logger[_0x918a('0x23')](_0x918a('0x20'),_0x918a('0x2a'),_0x918a('0xd3'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x918a('0x90'):if(_0x1ff6e8==_0x918a('0xd4')||_0x1ff6e8=='RECEIVED_BY_RECIPIENT'){return _0x11ebba[_0x918a('0xd5')]({'read':!![]});}else{logger[_0x918a('0x23')](_0x918a('0x20'),'status',_0x918a('0x90'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1ff6e8==_0x918a('0xd6')){return _0x11ebba[_0x918a('0xd5')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x918a('0x93'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x918a('0x94'):if(_0x1ff6e8===_0x918a('0xd7')||_0x1ff6e8==='ACCEPTD'){return _0x11ebba[_0x918a('0xd5')]({'read':!![]});}else{logger['error'](_0x918a('0x20'),'status',_0x918a('0x94'),util[_0x918a('0xca')](_0x16fcdc[_0x918a('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x11ebba;}})['then'](respondWithResult(_0x40f542,null))['catch'](handleError(_0x40f542,null));};exports[_0x918a('0xd8')]=function(_0x3be8fc,_0x22bc17,_0x33a095){var _0x350f38,_0x13b321,_0xdf268a;return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x3be8fc[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x22bc17,null))['then'](function(_0x22f004){if(_0x22f004){_0xdf268a=_0x22f004;logger[_0x918a('0x1f')](_0x918a('0x20'),_0x918a('0x2a'),_0x918a('0xd9'),_0x22f004[_0x918a('0x41')],util[_0x918a('0xca')](_0x3be8fc[_0x918a('0x44')],{'showHidden':![],'depth':null}));switch(_0x22f004[_0x918a('0x41')]){case _0x918a('0x8d'):if(_0x3be8fc[_0x918a('0x44')]['message-id']&&_0x3be8fc[_0x918a('0x44')]['state']){_0x13b321=_0x3be8fc[_0x918a('0x44')][_0x918a('0xda')];return db[_0x918a('0xc6')][_0x918a('0x5a')]({'where':{'messageId':_0x3be8fc[_0x918a('0x44')][_0x918a('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x22bc17,null))[_0x918a('0x1d')](function(_0x52a666){if(_0x52a666){_0x350f38=_0x52a666;switch(_0xdf268a[_0x918a('0x41')]){case _0x918a('0x8d'):if(_0x13b321==='2'||_0x13b321==='6'){return _0x350f38[_0x918a('0xd5')]({'read':!![]});}else{logger['error'](_0x918a('0x20'),'status','csc',util[_0x918a('0xca')](_0x3be8fc[_0x918a('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x350f38;}})['then'](respondWithResult(_0x22bc17,null))[_0x918a('0x28')](handleError(_0x22bc17,null));};exports[_0x918a('0xdc')]=function(_0x1c219b,_0x3113ad,_0x481d2a){return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x1c219b['params']['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x3113ad,null))[_0x918a('0x1d')](function(_0x5a1189){if(_0x5a1189){return _0x5a1189[_0x918a('0xdc')](_0x1c219b[_0x918a('0x5c')][_0x918a('0x6b')],_[_0x918a('0xa0')](_0x1c219b['body'],['ids','id'])||{})['spread'](function(_0x4a4893){for(var _0x598d8c=0x0;_0x598d8c<_0x1c219b[_0x918a('0x5c')]['ids'][_0x918a('0x49')];_0x598d8c+=0x1){socket['emit'](_0x918a('0xdd'),{'UserId':Number(_0x1c219b[_0x918a('0x5c')]['ids'][_0x598d8c]),'SmsAccountId':Number(_0x1c219b[_0x918a('0x57')]['id'])});}return _0x4a4893;});}})['then'](respondWithResult(_0x3113ad,null))[_0x918a('0x28')](handleError(_0x3113ad,null));};exports[_0x918a('0xde')]=function(_0x20232b,_0x42b6a6,_0x3fa05c){return db[_0x918a('0x3e')][_0x918a('0x5a')]({'where':{'id':_0x20232b[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x42b6a6,null))[_0x918a('0x1d')](function(_0x1295aa){if(_0x1295aa){return _0x1295aa[_0x918a('0xde')](_0x20232b['query'][_0x918a('0x6b')])[_0x918a('0x1d')](function(){if(_[_0x918a('0xdf')](_0x20232b['query']['ids'])){for(var _0x372cbc=0x0;_0x372cbc<_0x20232b[_0x918a('0x44')][_0x918a('0x6b')][_0x918a('0x49')];_0x372cbc+=0x1){socket[_0x918a('0xe0')](_0x918a('0xe1'),{'UserId':Number(_0x20232b[_0x918a('0x44')][_0x918a('0x6b')][_0x372cbc]),'SmsAccountId':Number(_0x20232b[_0x918a('0x57')]['id'])});}}else{socket[_0x918a('0xe0')](_0x918a('0xe1'),{'UserId':Number(_0x20232b[_0x918a('0x44')][_0x918a('0x6b')]),'SmsAccountId':Number(_0x20232b[_0x918a('0x57')]['id'])});}});}})[_0x918a('0x1d')](respondWithStatusCode(_0x42b6a6,null))[_0x918a('0x28')](handleError(_0x42b6a6,null));};exports[_0x918a('0xe2')]=function(_0x5cfeac,_0x5e89aa,_0x27f629){var _0x3a5081={};var _0x5c856c={};var _0x4bf4cf;var _0x39557f;return db[_0x918a('0x3e')]['findOne']({'where':{'id':_0x5cfeac[_0x918a('0x57')]['id']}})[_0x918a('0x1d')](handleEntityNotFound(_0x5e89aa,null))[_0x918a('0x1d')](function(_0x66af73){if(_0x66af73){_0x4bf4cf=_0x66af73;_0x5c856c[_0x918a('0x42')]=_[_0x918a('0x45')](db[_0x918a('0xac')][_0x918a('0x3f')]);_0x5c856c[_0x918a('0x44')]=_[_0x918a('0x45')](_0x5cfeac[_0x918a('0x44')]);_0x5c856c[_0x918a('0x46')]=_['intersection'](_0x5c856c[_0x918a('0x42')],_0x5c856c[_0x918a('0x44')]);_0x3a5081[_0x918a('0x47')]=_[_0x918a('0x59')](_0x5c856c[_0x918a('0x42')],qs['fields'](_0x5cfeac[_0x918a('0x44')][_0x918a('0x48')]));_0x3a5081[_0x918a('0x47')]=_0x3a5081[_0x918a('0x47')][_0x918a('0x49')]?_0x3a5081[_0x918a('0x47')]:_0x5c856c[_0x918a('0x42')];_0x3a5081[_0x918a('0x4c')]=qs[_0x918a('0x4d')](_0x5cfeac[_0x918a('0x44')]['sort']);_0x3a5081[_0x918a('0x4e')]=qs[_0x918a('0x46')](_['pick'](_0x5cfeac[_0x918a('0x44')],_0x5c856c[_0x918a('0x46')]));if(_0x5cfeac[_0x918a('0x44')][_0x918a('0x51')]){_0x3a5081['where']=_[_0x918a('0x50')](_0x3a5081[_0x918a('0x4e')],{'$or':_['map'](_0x3a5081[_0x918a('0x47')],function(_0x6ed8f6){var _0x5019db={};_0x5019db[_0x6ed8f6]={'$like':'%'+_0x5cfeac[_0x918a('0x44')][_0x918a('0x51')]+'%'};return _0x5019db;})});}_0x3a5081=_['merge']({},_0x3a5081,_0x5cfeac[_0x918a('0x52')]);return _0x4bf4cf[_0x918a('0xe2')](_0x3a5081);}})[_0x918a('0x1d')](function(_0x278c12){if(_0x278c12){_0x39557f=_0x278c12[_0x918a('0x49')];if(!_0x5cfeac['query'][_0x918a('0x4a')](_0x918a('0x4b'))){_0x3a5081['limit']=qs[_0x918a('0x2f')](_0x5cfeac[_0x918a('0x44')][_0x918a('0x2f')]);_0x3a5081[_0x918a('0x2d')]=qs['offset'](_0x5cfeac['query'][_0x918a('0x2d')]);}return _0x4bf4cf[_0x918a('0xe2')](_0x3a5081);}})[_0x918a('0x1d')](function(_0x295df1){if(_0x295df1){return _0x295df1?{'count':_0x39557f,'rows':_0x295df1}:null;}})[_0x918a('0x1d')](respondWithResult(_0x5e89aa,null))['catch'](handleError(_0x5e89aa,null));}; \ No newline at end of file +var _0x9b14=['User','unshift','agent','startRouting','Start','Content-Type','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','DESC','List','out','Messages','dataValues','push','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','message-delivered','received\x20delivery\x20report\x20from','state','addAgents','omit','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','http','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','get','SmsAccounts','stack','name','send','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Disposition','getDispositions','findOne','nolimit','pick','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','map','removeAnswers','ids','notify','sms','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','Body','MessageSid','skebby','text','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','SmsInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId'];(function(_0x280f00,_0x332f60){var _0x4619ae=function(_0x14eaf9){while(--_0x14eaf9){_0x280f00['push'](_0x280f00['shift']());}};_0x4619ae(++_0x332f60);}(_0x9b14,0x1e8));var _0x49b1=function(_0x49e533,_0x5daa8a){_0x49e533=_0x49e533-0x0;var _0x17769d=_0x9b14[_0x49e533];return _0x17769d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49b1('0x0'));var jsonpatch=require(_0x49b1('0x1'));var rp=require('request-promise');var moment=require(_0x49b1('0x2'));var BPromise=require(_0x49b1('0x3'));var Mustache=require(_0x49b1('0x4'));var util=require(_0x49b1('0x5'));var path=require(_0x49b1('0x6'));var sox=require(_0x49b1('0x7'));var csv=require(_0x49b1('0x8'));var ejs=require(_0x49b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x49b1('0xa'));var crypto=require(_0x49b1('0xb'));var jsforce=require(_0x49b1('0xc'));var deskjs=require(_0x49b1('0xd'));var toCsv=require(_0x49b1('0x8'));var querystring=require(_0x49b1('0xe'));var Papa=require(_0x49b1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49b1('0x10'));var logger=require('../../config/logger')(_0x49b1('0x11'));var utils=require(_0x49b1('0x12'));var config=require(_0x49b1('0x13'));var licenseUtil=require(_0x49b1('0x14'));var db=require('../../mysqldb')['db'];config[_0x49b1('0x15')]=_[_0x49b1('0x16')](config[_0x49b1('0x15')],{'host':_0x49b1('0x17'),'port':0x18eb});var socket=require(_0x49b1('0x18'))(new Redis(config[_0x49b1('0x15')]));require(_0x49b1('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x49b1('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x188e6d,_0x284fed,_0x54f703,_0x1b00b8){return new BPromise(function(_0x2042fe,_0x486d73){var _0x52e86a=_0x1b00b8||client;return _0x52e86a['request'](_0x188e6d,_0x54f703)[_0x49b1('0x1b')](function(_0x1e99e0){logger[_0x49b1('0x1c')](_0x49b1('0x1d'),_0x284fed,'request\x20sent');logger[_0x49b1('0x1e')](_0x49b1('0x1f'),_0x284fed,_0x49b1('0x20'),JSON['stringify'](_0x1e99e0));if(_0x1e99e0[_0x49b1('0x21')]){if(_0x1e99e0[_0x49b1('0x21')][_0x49b1('0x22')]===0x1f4){logger[_0x49b1('0x21')](_0x49b1('0x1d'),_0x284fed,_0x1e99e0[_0x49b1('0x21')][_0x49b1('0x23')]);return _0x486d73(_0x1e99e0['error'][_0x49b1('0x23')]);}logger[_0x49b1('0x21')](_0x49b1('0x1d'),_0x284fed,_0x1e99e0['error'][_0x49b1('0x23')]);return _0x2042fe(_0x1e99e0[_0x49b1('0x21')][_0x49b1('0x23')]);}else{logger[_0x49b1('0x1c')]('SmsAccount,\x20%s,\x20%s',_0x284fed,_0x49b1('0x20'));_0x2042fe(_0x1e99e0['result'][_0x49b1('0x23')]);}})['catch'](function(_0x4228de){logger['error']('SmsAccount,\x20%s,\x20%s',_0x284fed,_0x4228de);_0x486d73(_0x4228de);});});}function respondWithStatusCode(_0x2caaae,_0xbfd7d1){_0xbfd7d1=_0xbfd7d1||0xcc;return function(_0x2b5928){if(_0x2b5928){return _0x2caaae[_0x49b1('0x24')](_0xbfd7d1);}return _0x2caaae[_0x49b1('0x25')](_0xbfd7d1)[_0x49b1('0x26')]();};}function respondWithResult(_0x334c7b,_0x17d6af){_0x17d6af=_0x17d6af||0xc8;return function(_0x368019){if(_0x368019){return _0x334c7b[_0x49b1('0x25')](_0x17d6af)[_0x49b1('0x27')](_0x368019);}};}function respondWithFilteredResult(_0x745b83,_0x4b2559){return function(_0x3a3ee5){if(_0x3a3ee5){var _0x3dd24e=typeof _0x4b2559['offset']===_0x49b1('0x28')&&typeof _0x4b2559['limit']===_0x49b1('0x28');var _0x188c7e=_0x3a3ee5[_0x49b1('0x29')];var _0x21d254=_0x3dd24e?0x0:_0x4b2559[_0x49b1('0x2a')];var _0x3bd3ba=_0x3dd24e?_0x3a3ee5[_0x49b1('0x29')]:_0x4b2559[_0x49b1('0x2a')]+_0x4b2559[_0x49b1('0x2b')];var _0x11da2a;if(_0x3bd3ba>=_0x188c7e){_0x3bd3ba=_0x188c7e;_0x11da2a=0xc8;}else{_0x11da2a=0xce;}_0x745b83[_0x49b1('0x25')](_0x11da2a);return _0x745b83[_0x49b1('0x2c')](_0x49b1('0x2d'),_0x21d254+'-'+_0x3bd3ba+'/'+_0x188c7e)[_0x49b1('0x27')](_0x3a3ee5);}return null;};}function patchUpdates(_0x36ede3){return function(_0x19106e){try{jsonpatch['apply'](_0x19106e,_0x36ede3,!![]);}catch(_0x504983){return BPromise['reject'](_0x504983);}return _0x19106e[_0x49b1('0x2e')]();};}function saveUpdates(_0x3e13db,_0x27945b){return function(_0x3faeec){if(_0x3faeec){return _0x3faeec[_0x49b1('0x2f')](_0x3e13db)[_0x49b1('0x1b')](function(_0x47d795){return _0x47d795;});}return null;};}function removeEntity(_0x5efc2b,_0x2202c2){return function(_0xbd521){if(_0xbd521){return _0xbd521[_0x49b1('0x30')]()[_0x49b1('0x1b')](function(){var _0x4dd032=_0xbd521[_0x49b1('0x31')]({'plain':!![]});var _0x178979=_0x49b1('0x32');return db['UserProfileResource'][_0x49b1('0x30')]({'where':{'type':_0x178979,'resourceId':_0x4dd032['id']}})[_0x49b1('0x1b')](function(){return _0xbd521;});})['then'](function(){_0x5efc2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bcd83,_0x261397){return function(_0xa63e46){if(!_0xa63e46){_0x5bcd83[_0x49b1('0x24')](0x194);}return _0xa63e46;};}function handleError(_0x5b8223,_0x3a6016){_0x3a6016=_0x3a6016||0x1f4;return function(_0x23ddc){logger['error'](_0x23ddc[_0x49b1('0x33')]);if(_0x23ddc['name']){delete _0x23ddc[_0x49b1('0x34')];}_0x5b8223[_0x49b1('0x25')](_0x3a6016)[_0x49b1('0x35')](_0x23ddc);};}exports['index']=function(_0x17a756,_0x203810){var _0x73f153={'include':[{'model':db[_0x49b1('0x36')],'as':'mandatoryDispositionPause'}]},_0x140861={},_0x2dec94={'count':0x0,'rows':[]};var _0x51b41d=_['map'](db[_0x49b1('0x37')][_0x49b1('0x38')],function(_0x53461d){return{'name':_0x53461d[_0x49b1('0x39')],'type':_0x53461d[_0x49b1('0x3a')][_0x49b1('0x3b')]};});_0x140861[_0x49b1('0x3c')]=_['map'](_0x51b41d,_0x49b1('0x34'));_0x140861[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x17a756[_0x49b1('0x3d')]);_0x140861[_0x49b1('0x3f')]=_['intersection'](_0x140861[_0x49b1('0x3c')],_0x140861[_0x49b1('0x3d')]);_0x73f153[_0x49b1('0x40')]=_['intersection'](_0x140861[_0x49b1('0x3c')],qs[_0x49b1('0x41')](_0x17a756['query'][_0x49b1('0x41')]));_0x73f153[_0x49b1('0x40')]=_0x73f153['attributes'][_0x49b1('0x42')]?_0x73f153[_0x49b1('0x40')]:_0x140861['model'];if(!_0x17a756[_0x49b1('0x3d')][_0x49b1('0x43')]('nolimit')){_0x73f153[_0x49b1('0x2b')]=qs['limit'](_0x17a756[_0x49b1('0x3d')][_0x49b1('0x2b')]);_0x73f153[_0x49b1('0x2a')]=qs[_0x49b1('0x2a')](_0x17a756[_0x49b1('0x3d')]['offset']);}_0x73f153[_0x49b1('0x44')]=qs['sort'](_0x17a756[_0x49b1('0x3d')][_0x49b1('0x45')]);_0x73f153[_0x49b1('0x46')]=qs[_0x49b1('0x3f')](_['pick'](_0x17a756[_0x49b1('0x3d')],_0x140861['filters']),_0x51b41d);if(_0x17a756[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x73f153[_0x49b1('0x46')]=_[_0x49b1('0x48')](_0x73f153['where'],{'$or':_['map'](_0x51b41d,function(_0x25acd9){if(_0x25acd9[_0x49b1('0x3a')]!==_0x49b1('0x49')){var _0xc207a2={};_0xc207a2[_0x25acd9[_0x49b1('0x34')]]={'$like':'%'+_0x17a756[_0x49b1('0x3d')]['filter']+'%'};return _0xc207a2;}})});}_0x73f153=_[_0x49b1('0x48')]({},_0x73f153,_0x17a756[_0x49b1('0x4a')]);var _0x2d8f1c={'where':_0x73f153['where']};return db[_0x49b1('0x37')]['count'](_0x2d8f1c)['then'](function(_0x1e5ec0){_0x2dec94[_0x49b1('0x29')]=_0x1e5ec0;if(_0x17a756[_0x49b1('0x3d')][_0x49b1('0x4b')]){_0x73f153[_0x49b1('0x4c')]=[{'all':!![]}];}return db['SmsAccount'][_0x49b1('0x4d')](_0x73f153);})[_0x49b1('0x1b')](function(_0x279f78){_0x2dec94[_0x49b1('0x4e')]=_0x279f78;return _0x2dec94;})[_0x49b1('0x1b')](respondWithFilteredResult(_0x203810,_0x73f153))[_0x49b1('0x4f')](handleError(_0x203810,null));};exports[_0x49b1('0x50')]=function(_0x1e3418,_0x541d90){var _0x18dd83={'raw':![],'where':{'id':_0x1e3418[_0x49b1('0x51')]['id']},'include':[{'model':db[_0x49b1('0x36')],'as':_0x49b1('0x52')}]},_0x55daea={};_0x55daea[_0x49b1('0x3c')]=_[_0x49b1('0x3e')](db[_0x49b1('0x37')][_0x49b1('0x38')]);_0x55daea[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x1e3418['query']);_0x55daea[_0x49b1('0x3f')]=_[_0x49b1('0x53')](_0x55daea[_0x49b1('0x3c')],_0x55daea['query']);_0x18dd83[_0x49b1('0x40')]=_[_0x49b1('0x53')](_0x55daea[_0x49b1('0x3c')],qs[_0x49b1('0x41')](_0x1e3418['query'][_0x49b1('0x41')]));_0x18dd83[_0x49b1('0x40')]=_0x18dd83[_0x49b1('0x40')]['length']?_0x18dd83[_0x49b1('0x40')]:_0x55daea[_0x49b1('0x3c')];if(_0x1e3418[_0x49b1('0x3d')][_0x49b1('0x4b')]){_0x18dd83[_0x49b1('0x4c')]=[{'all':!![]}];}_0x18dd83=_[_0x49b1('0x48')]({},_0x18dd83,_0x1e3418[_0x49b1('0x4a')]);return db['SmsAccount']['find'](_0x18dd83)[_0x49b1('0x1b')](handleEntityNotFound(_0x541d90,null))[_0x49b1('0x1b')](respondWithResult(_0x541d90,null))[_0x49b1('0x4f')](handleError(_0x541d90,null));};exports[_0x49b1('0x54')]=function(_0x1bf13b,_0x317c43){return db[_0x49b1('0x37')]['create'](_0x1bf13b[_0x49b1('0x55')],{})[_0x49b1('0x1b')](function(_0x4c8cb2){var _0x357a9f=_0x1bf13b['user']['get']({'plain':!![]});if(!_0x357a9f)throw new Error(_0x49b1('0x56'));if(_0x357a9f[_0x49b1('0x57')]===_0x49b1('0x58')){var _0x1c0f16=_0x4c8cb2[_0x49b1('0x31')]({'plain':!![]});var _0x168b8b=_0x49b1('0x32');return db[_0x49b1('0x59')][_0x49b1('0x5a')]({'where':{'name':_0x168b8b,'userProfileId':_0x357a9f[_0x49b1('0x5b')]},'raw':!![]})['then'](function(_0x5a4346){if(_0x5a4346&&_0x5a4346[_0x49b1('0x5c')]===0x0){return db[_0x49b1('0x5d')]['create']({'name':_0x1c0f16[_0x49b1('0x34')],'resourceId':_0x1c0f16['id'],'type':_0x5a4346[_0x49b1('0x34')],'sectionId':_0x5a4346['id']},{})[_0x49b1('0x1b')](function(){return _0x4c8cb2;});}else{return _0x4c8cb2;}})[_0x49b1('0x4f')](function(_0x5db606){logger[_0x49b1('0x21')](_0x49b1('0x5e'),_0x5db606);throw _0x5db606;});}return _0x4c8cb2;})[_0x49b1('0x1b')](respondWithResult(_0x317c43,0xc9))[_0x49b1('0x4f')](handleError(_0x317c43,null));};exports[_0x49b1('0x2f')]=function(_0x1d97e7,_0x45ff8d){if(_0x1d97e7[_0x49b1('0x55')]['id']){delete _0x1d97e7[_0x49b1('0x55')]['id'];}return db[_0x49b1('0x37')][_0x49b1('0x5a')]({'where':{'id':_0x1d97e7[_0x49b1('0x51')]['id']},'include':[{'model':db[_0x49b1('0x36')],'as':'mandatoryDispositionPause'}]})[_0x49b1('0x1b')](handleEntityNotFound(_0x45ff8d,null))['then'](saveUpdates(_0x1d97e7[_0x49b1('0x55')],null))[_0x49b1('0x1b')](respondWithResult(_0x45ff8d,null))[_0x49b1('0x4f')](handleError(_0x45ff8d,null));};exports[_0x49b1('0x30')]=function(_0x22ba7f,_0x41e9f7){return db['SmsAccount']['find']({'where':{'id':_0x22ba7f[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x41e9f7,null))[_0x49b1('0x1b')](removeEntity(_0x41e9f7,null))[_0x49b1('0x4f')](handleError(_0x41e9f7,null));};exports['describe']=function(_0x3e9f77,_0x2b81a0){return db['SmsAccount']['describe']()[_0x49b1('0x1b')](respondWithResult(_0x2b81a0,null))[_0x49b1('0x4f')](handleError(_0x2b81a0,null));};exports['addDisposition']=function(_0x6e9249,_0x10ca0e,_0x4cf354){if(_0x6e9249['body']['id']){delete _0x6e9249['body']['id'];}return db[_0x49b1('0x37')]['find']({'where':{'id':_0x6e9249[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x10ca0e,null))[_0x49b1('0x1b')](function(_0x4f7c11){if(_0x4f7c11){_0x6e9249['body']['SmsAccountId']=_0x4f7c11['id'];return db[_0x49b1('0x5f')][_0x49b1('0x54')](_0x6e9249[_0x49b1('0x55')]);}})[_0x49b1('0x1b')](respondWithResult(_0x10ca0e,null))[_0x49b1('0x4f')](handleError(_0x10ca0e,null));};exports[_0x49b1('0x60')]=function(_0x5ed96c,_0x5c90a8,_0x12ea15){var _0x5b8fb8={'raw':![],'where':{}};var _0x38bde6={};var _0x51ceb4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x49b1('0x61')]({'where':{'id':_0x5ed96c[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x5c90a8,null))[_0x49b1('0x1b')](function(_0x58c407){if(_0x58c407){_0x38bde6[_0x49b1('0x3c')]=_[_0x49b1('0x3e')](db[_0x49b1('0x5f')][_0x49b1('0x38')]);_0x38bde6[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x5ed96c[_0x49b1('0x3d')]);_0x38bde6[_0x49b1('0x3f')]=_['intersection'](_0x38bde6[_0x49b1('0x3c')],_0x38bde6[_0x49b1('0x3d')]);_0x5b8fb8[_0x49b1('0x40')]=_[_0x49b1('0x53')](_0x38bde6[_0x49b1('0x3c')],qs['fields'](_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x41')]));_0x5b8fb8[_0x49b1('0x40')]=_0x5b8fb8[_0x49b1('0x40')]['length']?_0x5b8fb8[_0x49b1('0x40')]:_0x38bde6[_0x49b1('0x3c')];if(!_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x43')](_0x49b1('0x62'))){_0x5b8fb8[_0x49b1('0x2b')]=qs['limit'](_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x2b')]);_0x5b8fb8['offset']=qs[_0x49b1('0x2a')](_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x2a')]);}_0x5b8fb8[_0x49b1('0x44')]=qs['sort'](_0x5ed96c[_0x49b1('0x3d')]['sort']);_0x5b8fb8[_0x49b1('0x46')]=qs[_0x49b1('0x3f')](_[_0x49b1('0x63')](_0x5ed96c['query'],_0x38bde6[_0x49b1('0x3f')]));_0x5b8fb8[_0x49b1('0x46')][_0x49b1('0x64')]=_0x58c407['id'];if(_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x5b8fb8[_0x49b1('0x46')]=_[_0x49b1('0x48')](_0x5b8fb8[_0x49b1('0x46')],{'$or':_['map'](_0x5b8fb8[_0x49b1('0x40')],function(_0x1cc37d){var _0x420ab1={};_0x420ab1[_0x1cc37d]={'$like':'%'+_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x47')]+'%'};return _0x420ab1;})});}_0x5b8fb8=_[_0x49b1('0x48')]({},_0x5b8fb8,_0x5ed96c['options']);return db[_0x49b1('0x5f')][_0x49b1('0x29')]({'where':_0x5b8fb8[_0x49b1('0x46')]})[_0x49b1('0x1b')](function(_0x25aad1){_0x51ceb4[_0x49b1('0x29')]=_0x25aad1;if(_0x5ed96c[_0x49b1('0x3d')][_0x49b1('0x4b')]){_0x5b8fb8[_0x49b1('0x4c')]=[{'all':!![]}];}return db[_0x49b1('0x5f')][_0x49b1('0x4d')](_0x5b8fb8);})[_0x49b1('0x1b')](function(_0x284450){_0x51ceb4[_0x49b1('0x4e')]=_0x284450;return _0x51ceb4;});}})[_0x49b1('0x1b')](respondWithFilteredResult(_0x5c90a8,_0x5b8fb8))[_0x49b1('0x4f')](handleError(_0x5c90a8,null));};exports[_0x49b1('0x65')]=function(_0x51c16e,_0x10eb14,_0x1bbdd9){return db['SmsAccount']['find']({'where':{'id':_0x51c16e['params']['id']}})['then'](handleEntityNotFound(_0x10eb14,null))[_0x49b1('0x1b')](function(_0x144f97){if(_0x144f97){return _0x144f97[_0x49b1('0x65')](_0x51c16e[_0x49b1('0x3d')]['ids']);}})[_0x49b1('0x1b')](respondWithStatusCode(_0x10eb14,null))['catch'](handleError(_0x10eb14,null));};exports[_0x49b1('0x66')]=function(_0x56ed44,_0x1987a7,_0x1df0f1){if(_0x56ed44[_0x49b1('0x55')]['id']){delete _0x56ed44[_0x49b1('0x55')]['id'];}return db[_0x49b1('0x37')][_0x49b1('0x5a')]({'where':{'id':_0x56ed44[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x1987a7,null))['then'](function(_0x403dd7){if(_0x403dd7){_0x56ed44[_0x49b1('0x55')][_0x49b1('0x64')]=_0x403dd7['id'];return db[_0x49b1('0x67')][_0x49b1('0x54')](_0x56ed44['body']);}})['then'](respondWithResult(_0x1987a7,null))[_0x49b1('0x4f')](handleError(_0x1987a7,null));};exports['getAnswers']=function(_0x49ed87,_0x129c8d,_0x1cb4a9){var _0x280d44={'raw':![],'where':{}};var _0x35dbf8={};var _0x4e599c={'count':0x0,'rows':[]};return db[_0x49b1('0x37')]['findOne']({'where':{'id':_0x49ed87['params']['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x129c8d,null))['then'](function(_0x1cfd0b){if(_0x1cfd0b){_0x35dbf8['model']=_[_0x49b1('0x3e')](db[_0x49b1('0x67')][_0x49b1('0x38')]);_0x35dbf8['query']=_[_0x49b1('0x3e')](_0x49ed87[_0x49b1('0x3d')]);_0x35dbf8[_0x49b1('0x3f')]=_[_0x49b1('0x53')](_0x35dbf8[_0x49b1('0x3c')],_0x35dbf8[_0x49b1('0x3d')]);_0x280d44[_0x49b1('0x40')]=_[_0x49b1('0x53')](_0x35dbf8[_0x49b1('0x3c')],qs[_0x49b1('0x41')](_0x49ed87['query']['fields']));_0x280d44['attributes']=_0x280d44[_0x49b1('0x40')]['length']?_0x280d44[_0x49b1('0x40')]:_0x35dbf8[_0x49b1('0x3c')];if(!_0x49ed87[_0x49b1('0x3d')]['hasOwnProperty'](_0x49b1('0x62'))){_0x280d44[_0x49b1('0x2b')]=qs[_0x49b1('0x2b')](_0x49ed87[_0x49b1('0x3d')]['limit']);_0x280d44[_0x49b1('0x2a')]=qs['offset'](_0x49ed87[_0x49b1('0x3d')][_0x49b1('0x2a')]);}_0x280d44['order']=qs[_0x49b1('0x45')](_0x49ed87[_0x49b1('0x3d')][_0x49b1('0x45')]);_0x280d44[_0x49b1('0x46')]=qs['filters'](_[_0x49b1('0x63')](_0x49ed87[_0x49b1('0x3d')],_0x35dbf8[_0x49b1('0x3f')]));_0x280d44[_0x49b1('0x46')][_0x49b1('0x64')]=_0x1cfd0b['id'];if(_0x49ed87[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x280d44[_0x49b1('0x46')]=_['merge'](_0x280d44[_0x49b1('0x46')],{'$or':_[_0x49b1('0x68')](_0x280d44[_0x49b1('0x40')],function(_0x2fba39){var _0x3fecf3={};_0x3fecf3[_0x2fba39]={'$like':'%'+_0x49ed87[_0x49b1('0x3d')][_0x49b1('0x47')]+'%'};return _0x3fecf3;})});}_0x280d44=_[_0x49b1('0x48')]({},_0x280d44,_0x49ed87[_0x49b1('0x4a')]);return db['CannedAnswer'][_0x49b1('0x29')]({'where':_0x280d44['where']})['then'](function(_0x2da18f){_0x4e599c[_0x49b1('0x29')]=_0x2da18f;if(_0x49ed87[_0x49b1('0x3d')][_0x49b1('0x4b')]){_0x280d44['include']=[{'all':!![]}];}return db[_0x49b1('0x67')][_0x49b1('0x4d')](_0x280d44);})[_0x49b1('0x1b')](function(_0x3995fa){_0x4e599c[_0x49b1('0x4e')]=_0x3995fa;return _0x4e599c;});}})[_0x49b1('0x1b')](respondWithFilteredResult(_0x129c8d,_0x280d44))[_0x49b1('0x4f')](handleError(_0x129c8d,null));};exports[_0x49b1('0x69')]=function(_0x46536d,_0x37a6d3,_0x5e0e9b){return db[_0x49b1('0x37')][_0x49b1('0x5a')]({'where':{'id':_0x46536d['params']['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x37a6d3,null))[_0x49b1('0x1b')](function(_0x467481){if(_0x467481){return _0x467481[_0x49b1('0x69')](_0x46536d[_0x49b1('0x3d')][_0x49b1('0x6a')]);}})[_0x49b1('0x1b')](respondWithStatusCode(_0x37a6d3,null))[_0x49b1('0x4f')](handleError(_0x37a6d3,null));};exports[_0x49b1('0x6b')]=function(_0x2d14b8,_0x190ad8,_0x2a9bb4){var _0x2dba0d={'channel':_0x49b1('0x6c')};var _0x3bb146=[];var _0x4888a9=[];var _0x3b1120={};return db['SmsAccount'][_0x49b1('0x5a')]({'where':{'id':_0x2d14b8[_0x49b1('0x51')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x49b1('0x6d')}]})[_0x49b1('0x1b')](handleEntityNotFound(_0x190ad8,null))[_0x49b1('0x1b')](function(_0x1d7414){_0x2dba0d['account']=_0x1d7414;_0x2dba0d[_0x49b1('0x6e')]=_[_0x49b1('0x6f')](_0x1d7414['Applications'],[_0x49b1('0x70')],[_0x49b1('0x71')]);if(_0x2dba0d[_0x49b1('0x72')]['Applications']){delete _0x2dba0d['account'][_0x49b1('0x6d')];}return db[_0x49b1('0x73')]['describe']();})[_0x49b1('0x1b')](function(_0x3743fb){if(!_0x3743fb){throw new db[(_0x49b1('0x74'))][(_0x49b1('0x75'))](_0x49b1('0x76'));}_0x3bb146=_[_0x49b1('0x77')](_[_0x49b1('0x3e')](_0x3743fb),['createdAt',_0x49b1('0x78')]);_0x4888a9=_[_0x49b1('0x77')](_[_0x49b1('0x3e')](_0x3743fb),[_0x49b1('0x79'),_0x49b1('0x78'),'CompanyId',_0x49b1('0x7a')]);_0x2dba0d['body']={'mapKey':_0x49b1('0x7b')};if(_0x2dba0d[_0x49b1('0x72')][_0x49b1('0x3a')]){switch(_0x2dba0d['account'][_0x49b1('0x3a')]){case _0x49b1('0x7c'):_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')]=_0x2d14b8[_0x49b1('0x55')]['From'];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x7e')];_0x2dba0d['body']['messageId']=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x7f')];break;case _0x49b1('0x80'):_0x2dba0d['body'][_0x49b1('0x7d')]='+'+_0x2d14b8[_0x49b1('0x55')]['sender'];_0x2dba0d[_0x49b1('0x55')]['body']=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x81')];break;case'connectel':_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x7d')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')]['message'];break;case _0x49b1('0x82'):_0x2dba0d['body'][_0x49b1('0x7d')]=_0x2d14b8['body'][_0x49b1('0x7d')];_0x2dba0d['body'][_0x49b1('0x55')]=_0x2d14b8['body'][_0x49b1('0x55')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x83')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x84')];break;case _0x49b1('0x85'):_0x2dba0d['body'][_0x49b1('0x7d')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x86')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x87')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x83')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x88')];break;case _0x49b1('0x89'):_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')]='+'+_0x2d14b8['body'][_0x49b1('0x8a')][0x0][_0x49b1('0x7d')];_0x2dba0d['body'][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x8a')][0x0][_0x49b1('0x81')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x83')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x8a')][0x0]['messageId'];break;case _0x49b1('0x8b'):_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x8c')];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x8d')]['message'];break;case _0x49b1('0x8e'):_0x2dba0d[_0x49b1('0x55')]['from']=_0x2d14b8[_0x49b1('0x55')]['fromNumber'];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x81')];_0x2dba0d['body']['messageId']=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x8f')];break;case _0x49b1('0x90'):_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x83')]=_0x2d14b8[_0x49b1('0x55')][0x0][_0x49b1('0x23')]['id'];_0x2dba0d['body'][_0x49b1('0x7d')]=_0x2d14b8['body'][0x0][_0x49b1('0x23')][_0x49b1('0x7d')];_0x2dba0d['body']['body']=_0x2d14b8[_0x49b1('0x55')][0x0]['message']['text'];break;case'intelepeer':_0x2dba0d['body']['from']=_0x2d14b8[_0x49b1('0x55')][_0x49b1('0x7d')];_0x2dba0d['body'][_0x49b1('0x55')]=_0x2d14b8[_0x49b1('0x55')]['message'];_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x83')]=_0x2d14b8[_0x49b1('0x55')]['refid'];break;}}if(_0x2dba0d['body']['id']){delete _0x2dba0d[_0x49b1('0x55')]['id'];}if(_[_0x49b1('0x91')](_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')])){throw new db[(_0x49b1('0x74'))][(_0x49b1('0x75'))](_0x49b1('0x92'));}if(_[_0x49b1('0x91')](_0x2dba0d['body']['body'])||_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x55')]===''){throw new db['Sequelize'][(_0x49b1('0x75'))](_0x49b1('0x93'));}if(_['isNil'](_0x2dba0d['body'][_0x49b1('0x94')])){throw new db[(_0x49b1('0x74'))][(_0x49b1('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4888a9);}if(!_[_0x49b1('0x95')](_0x4888a9,_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x94')])){throw new db[(_0x49b1('0x74'))]['ValidationError'](_0x49b1('0x96')+_0x4888a9);}_0x3b1120[_0x2dba0d[_0x49b1('0x55')]['mapKey']]=_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')];return db[_0x49b1('0x97')]['find']({'where':{'id':_0x2dba0d[_0x49b1('0x72')]['ListId']},'include':[{'model':db[_0x49b1('0x73')],'as':_0x49b1('0x98'),'where':_0x3b1120,'limit':0x1,'order':[[_0x49b1('0x78'),'DESC']]}]});})['then'](handleEntityNotFound(_0x190ad8,null))[_0x49b1('0x1b')](function(_0x48430e){if(_0x48430e){_0x2dba0d[_0x49b1('0x99')]=_['omit'](_0x48430e,[_0x49b1('0x98')]);if(_0x48430e[_0x49b1('0x98')][_0x49b1('0x42')]){return _0x48430e['Contacts'][0x0];}var _0x4547cb=_[_0x49b1('0x16')](_0x2dba0d[_0x49b1('0x55')],{'firstName':_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')],'ListId':_0x48430e['id']});_0x4547cb[_0x2dba0d['body'][_0x49b1('0x94')]]=_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')];return db['CmContact'][_0x49b1('0x54')](_0x4547cb,{'fields':_0x3bb146,'raw':!![]});}})[_0x49b1('0x1b')](handleEntityNotFound(_0x190ad8,null))['then'](function(_0xf982ea){if(_0xf982ea){_0x2dba0d[_0x49b1('0x9a')]=_0xf982ea;var _0x1f27db={'ContactId':_0xf982ea['id'],'phone':_0x2dba0d[_0x49b1('0x55')][_0x49b1('0x7d')],'SmsAccountId':_0x2d14b8[_0x49b1('0x51')]['id']};var _0x128e9e={'ContactId':_0xf982ea['id'],'SmsAccountId':_0x2d14b8[_0x49b1('0x51')]['id'],'closed':![]};return db['SmsInteraction'][_0x49b1('0x5a')]({'where':_0x128e9e})[_0x49b1('0x1b')](function(_0xce0b71){if(_0xce0b71){return[_0xce0b71,![]];}return db[_0x49b1('0x9b')][_0x49b1('0x54')](_0x1f27db)[_0x49b1('0x1b')](function(_0x6e3a97){return[_0x6e3a97,!![]];});});}})['spread'](function(_0x5ac718,_0x141b2e){_0x2dba0d[_0x49b1('0x9c')]=_0x5ac718['get']({'plain':!![]});_0x2dba0d[_0x49b1('0x9c')]['created']=![];if(_0x141b2e){if(_0x2dba0d[_0x49b1('0x72')][_0x49b1('0x9d')]){_0x2dba0d['applications']['push']({'id':0x0,'priority':_0x2dba0d[_0x49b1('0x6e')][_0x49b1('0x42')]+0x1,'app':_0x49b1('0x9e'),'appdata':_0x49b1('0x9f'),'interval':_0x49b1('0xa0')});}_0x2dba0d[_0x49b1('0x9c')][_0x49b1('0xa1')]=!![];}return db[_0x49b1('0xa2')][_0x49b1('0x54')]({'phone':_0x2dba0d['body'][_0x49b1('0x7d')],'messageId':_0x2dba0d['body']['messageId'],'body':_0x2dba0d['body']['body'],'SmsAccountId':_0x2d14b8[_0x49b1('0x51')]['id'],'SmsInteractionId':_0x5ac718['id'],'direction':'in','ContactId':_0x5ac718[_0x49b1('0xa3')],'AttachmentId':_0x2dba0d['body'][_0x49b1('0xa4')]});})[_0x49b1('0x1b')](function(_0x42d1e1){_0x2dba0d[_0x49b1('0x23')]=_0x42d1e1;if(_0x2dba0d[_0x49b1('0x9c')][_0x49b1('0xa5')]){return db[_0x49b1('0xa6')][_0x49b1('0x5a')]({'attributes':['id','name'],'where':{'id':_0x2dba0d[_0x49b1('0x9c')]['UserId']}})['then'](function(_0x2799a7){if(_0x2799a7){_0x2dba0d[_0x49b1('0x6e')][_0x49b1('0xa7')]({'id':0x0,'priority':0x0,'app':_0x49b1('0xa8'),'appdata':_0x2799a7[_0x49b1('0x34')]+','+(_0x2dba0d[_0x49b1('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0x49b1('0xa0')});}return respondWithRpcPromise('Start',_0x49b1('0xa9'),_0x2dba0d);});}return respondWithRpcPromise(_0x49b1('0xaa'),'startRouting',_0x2dba0d);})[_0x49b1('0x1b')](function(_0x35e648){if(_0x35e648){var _0x3cb3dc=0xc8;var _0xbcd337='receiveMessage';logger[_0x49b1('0x1c')](_0x49b1('0x1f'),_0xbcd337,_0x3cb3dc,'entity\x20found');logger[_0x49b1('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xbcd337,_0x3cb3dc,'entity\x20found',JSON['stringify'](_0x35e648));if(_0x2dba0d[_0x49b1('0x72')]['type']===_0x49b1('0x7c')){return _0x190ad8[_0x49b1('0x25')](_0x3cb3dc)['set'](_0x49b1('0xab'),'text/xml')[_0x49b1('0x35')](_0x49b1('0xac'));}else{return _0x190ad8['status'](_0x3cb3dc)[_0x49b1('0x27')](_0x35e648);}}})[_0x49b1('0x4f')](handleError(_0x190ad8,null));};exports['addApplications']=function(_0x43260a,_0x220086){var _0x55de85=_0x43260a['params']['id'];var _0x2543f7=_0x43260a[_0x49b1('0x55')];var _0x24e8cc=0xc8;var _0x529545=null;return db[_0x49b1('0xad')][_0x49b1('0xae')]({'isolationLevel':db['sequelize'][_0x49b1('0xaf')][_0x49b1('0xb0')]['READ_COMMITTED']},function(_0x10a9b5){return db[_0x49b1('0x37')][_0x49b1('0x61')]({'where':{'id':_0x55de85},'transaction':_0x10a9b5})[_0x49b1('0x1b')](function(_0x512a43){if(_0x512a43){return db[_0x49b1('0xb1')][_0x49b1('0x30')]({'where':{'SmsAccountId':_0x55de85},'transaction':_0x10a9b5})[_0x49b1('0x1b')](function(){var _0x110340=_[_0x49b1('0x68')](_0x2543f7,function(_0x2b8fac){_0x2b8fac[_0x49b1('0x64')]=_0x55de85;return _0x2b8fac;});return db[_0x49b1('0xb1')][_0x49b1('0xb2')](_0x110340,{'transaction':_0x10a9b5});});}else{_0x24e8cc=0x194;_0x529545=[];}});})[_0x49b1('0x1b')](function(){if(_0x24e8cc!==0x194){return db[_0x49b1('0xb1')]['findAndCountAll']({'where':{'SmsAccountId':_0x55de85},'order':_0x49b1('0x70')})[_0x49b1('0x1b')](function(_0x2f3870){_0x529545=_0x2f3870;});}})[_0x49b1('0x4f')](function(_0xbc118d){_0x24e8cc=0x1f4;logger[_0x49b1('0x21')](_0xbc118d[_0x49b1('0x33')]);if(_0xbc118d[_0x49b1('0x34')]){delete _0xbc118d['name'];}_0x529545=_0xbc118d;})[_0x49b1('0xb3')](function(){if(_0x529545===null){_0x220086[_0x49b1('0x24')](_0x24e8cc);}else{if(_0x24e8cc===0x1f4){_0x220086[_0x49b1('0x25')](_0x24e8cc)[_0x49b1('0x35')](_0x529545);}else{_0x220086[_0x49b1('0x25')](_0x24e8cc)[_0x49b1('0x27')](_0x529545);}}});};exports[_0x49b1('0xb4')]=function(_0x194fc3,_0x435c5b,_0x5816c7){var _0x24b66f={};var _0x2ead6f={};var _0x361eae;var _0x145d23;return db[_0x49b1('0x37')][_0x49b1('0x61')]({'where':{'id':_0x194fc3[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x435c5b,null))[_0x49b1('0x1b')](function(_0x318535){if(_0x318535){_0x361eae=_0x318535;_0x2ead6f['model']=_[_0x49b1('0x3e')](db['SmsApplication'][_0x49b1('0x38')]);_0x2ead6f[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x194fc3[_0x49b1('0x3d')]);_0x2ead6f[_0x49b1('0x3f')]=_[_0x49b1('0x53')](_0x2ead6f[_0x49b1('0x3c')],_0x2ead6f[_0x49b1('0x3d')]);_0x24b66f[_0x49b1('0x40')]=_[_0x49b1('0x53')](_0x2ead6f[_0x49b1('0x3c')],qs[_0x49b1('0x41')](_0x194fc3[_0x49b1('0x3d')]['fields']));_0x24b66f[_0x49b1('0x40')]=_0x24b66f[_0x49b1('0x40')][_0x49b1('0x42')]?_0x24b66f[_0x49b1('0x40')]:_0x2ead6f[_0x49b1('0x3c')];_0x24b66f[_0x49b1('0x44')]=qs['sort'](_0x194fc3[_0x49b1('0x3d')]['sort']);_0x24b66f['where']=qs[_0x49b1('0x3f')](_[_0x49b1('0x63')](_0x194fc3[_0x49b1('0x3d')],_0x2ead6f[_0x49b1('0x3f')]));if(_0x194fc3[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x24b66f[_0x49b1('0x46')]=_[_0x49b1('0x48')](_0x24b66f[_0x49b1('0x46')],{'$or':_[_0x49b1('0x68')](_0x24b66f[_0x49b1('0x40')],function(_0x4f117f){var _0x54f1f5={};_0x54f1f5[_0x4f117f]={'$like':'%'+_0x194fc3[_0x49b1('0x3d')][_0x49b1('0x47')]+'%'};return _0x54f1f5;})});}_0x24b66f=_['merge']({},_0x24b66f,_0x194fc3[_0x49b1('0x4a')]);return _0x361eae[_0x49b1('0xb4')](_0x24b66f);}})[_0x49b1('0x1b')](function(_0x17b183){if(_0x17b183){_0x145d23=_0x17b183['length'];if(!_0x194fc3[_0x49b1('0x3d')][_0x49b1('0x43')](_0x49b1('0x62'))){_0x24b66f[_0x49b1('0x2b')]=qs['limit'](_0x194fc3[_0x49b1('0x3d')][_0x49b1('0x2b')]);_0x24b66f['offset']=qs[_0x49b1('0x2a')](_0x194fc3[_0x49b1('0x3d')][_0x49b1('0x2a')]);}return _0x361eae[_0x49b1('0xb4')](_0x24b66f);}})[_0x49b1('0x1b')](function(_0x564ab2){if(_0x564ab2){return _0x564ab2?{'count':_0x145d23,'rows':_0x564ab2}:null;}})[_0x49b1('0x1b')](respondWithResult(_0x435c5b,null))[_0x49b1('0x4f')](handleError(_0x435c5b,null));};exports[_0x49b1('0xb5')]=function(_0x4de37f,_0x73086b,_0x28c766){var _0x276dad={'raw':![],'where':{}};var _0x4da96c={};var _0x22c703={'count':0x0,'rows':[]};return db[_0x49b1('0x37')][_0x49b1('0x61')]({'where':{'id':_0x4de37f[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x73086b,null))[_0x49b1('0x1b')](function(_0x4cda33){if(_0x4cda33){_0x4da96c['model']=_[_0x49b1('0x3e')](db['SmsInteraction'][_0x49b1('0x38')]);_0x4da96c[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x4de37f[_0x49b1('0x3d')]);_0x4da96c['filters']=_['intersection'](_0x4da96c[_0x49b1('0x3c')],_0x4da96c['query']);_0x276dad['attributes']=_[_0x49b1('0x53')](_0x4da96c[_0x49b1('0x3c')],qs[_0x49b1('0x41')](_0x4de37f[_0x49b1('0x3d')]['fields']));_0x276dad['attributes']=_0x276dad[_0x49b1('0x40')]['length']?_0x276dad[_0x49b1('0x40')]:_0x4da96c['model'];if(!_0x4de37f['query'][_0x49b1('0x43')]('nolimit')){_0x276dad[_0x49b1('0x2b')]=qs[_0x49b1('0x2b')](_0x4de37f[_0x49b1('0x3d')][_0x49b1('0x2b')]);_0x276dad['offset']=qs[_0x49b1('0x2a')](_0x4de37f[_0x49b1('0x3d')][_0x49b1('0x2a')]);}_0x276dad[_0x49b1('0x44')]=qs[_0x49b1('0x45')](_0x4de37f['query'][_0x49b1('0x45')]);_0x276dad['where']=qs['filters'](_[_0x49b1('0x63')](_0x4de37f['query'],_0x4da96c[_0x49b1('0x3f')]));_0x276dad[_0x49b1('0x46')]['SmsAccountId']=_0x4cda33['id'];if(_0x4de37f[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x276dad[_0x49b1('0x46')]=_['merge'](_0x276dad['where'],{'$or':_[_0x49b1('0x68')](_0x276dad[_0x49b1('0x40')],function(_0x44e7c6){var _0x257321={};_0x257321[_0x44e7c6]={'$like':'%'+_0x4de37f[_0x49b1('0x3d')]['filter']+'%'};return _0x257321;})});}_0x276dad=_[_0x49b1('0x48')]({},_0x276dad,_0x4de37f[_0x49b1('0x4a')]);return db[_0x49b1('0x9b')][_0x49b1('0x29')]({'where':_0x276dad['where']})[_0x49b1('0x1b')](function(_0x1e25af){_0x22c703[_0x49b1('0x29')]=_0x1e25af;if(_0x4de37f['query'][_0x49b1('0x4b')]){_0x276dad[_0x49b1('0x4c')]=[{'model':db[_0x49b1('0x73')],'as':_0x49b1('0xb6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x49b1('0xb7'),_0x49b1('0xb8')],'required':![]},{'model':db[_0x49b1('0xb9')],'as':_0x49b1('0xba'),'attributes':['id',_0x49b1('0x34'),_0x49b1('0xbb')],'where':_0x4de37f['query'][_0x49b1('0xbc')]?{'id':_0x4de37f[_0x49b1('0x3d')]['tag']}:undefined,'required':_0x4de37f[_0x49b1('0x3d')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x49b1('0x4d')](_0x276dad);})[_0x49b1('0x1b')](function(_0x18a33c){_0x22c703[_0x49b1('0x4e')]=_0x18a33c;return _0x22c703;});}})[_0x49b1('0x1b')](respondWithFilteredResult(_0x73086b,_0x276dad))[_0x49b1('0x4f')](handleError(_0x73086b,null));};exports[_0x49b1('0x35')]=function(_0x341585,_0x3441e5,_0x1018b5){var _0x554dc1,_0x309167,_0x512235;if(_[_0x49b1('0x91')](_0x341585[_0x49b1('0x55')]['body'])||_0x341585[_0x49b1('0x55')][_0x49b1('0x55')]===''){throw new db[(_0x49b1('0x74'))][(_0x49b1('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49b1('0x91')](_0x341585[_0x49b1('0x55')]['to'])){throw new db[(_0x49b1('0x74'))][(_0x49b1('0x75'))]('to\x20is\x20mandatory');}_0x554dc1=_0x341585[_0x49b1('0x55')]['to'];return db[_0x49b1('0x37')]['find']({'where':{'id':_0x341585[_0x49b1('0x51')]['id']},'include':[{'model':db[_0x49b1('0x97')],'as':'List','include':[{'model':db[_0x49b1('0x73')],'as':_0x49b1('0x98'),'where':{'mobile':_0x554dc1},'limit':0x1,'order':[[_0x49b1('0x78'),_0x49b1('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x3441e5,null))['then'](function(_0x451f40){if(_0x451f40&&_0x451f40[_0x49b1('0xbe')]){_0x309167=_0x451f40[_0x49b1('0x31')]({'plain':!![]});if(_0x309167['List']&&_0x309167[_0x49b1('0xbe')][_0x49b1('0x98')][_0x49b1('0x42')]){return _0x309167[_0x49b1('0xbe')][_0x49b1('0x98')][0x0];}return db[_0x49b1('0x73')]['create'](_[_0x49b1('0x16')](_0x341585[_0x49b1('0x55')],{'firstName':_0x554dc1,'mobile':_0x554dc1,'phone':_0x554dc1,'ListId':_0x309167[_0x49b1('0x7a')]}));}})[_0x49b1('0x1b')](handleEntityNotFound(_0x3441e5,null))[_0x49b1('0x1b')](function(_0x18dd89){if(_0x18dd89){_0x512235=_0x18dd89;return db[_0x49b1('0x9b')][_0x49b1('0x5a')]({'where':{'ContactId':_0x512235['id'],'closed':![],'SmsAccountId':_0x309167['id']}})[_0x49b1('0x1b')](function(_0x27fb6d){if(_0x27fb6d){return[_0x27fb6d,![]];}return db[_0x49b1('0x9b')]['create']({'UserId':_0x341585[_0x49b1('0x58')]['id'],'ContactId':_0x512235['id'],'SmsAccountId':_0x309167['id'],'phone':_0x554dc1,'firstMsgDirection':_0x49b1('0xbf'),'Messages':[_['merge'](_0x341585[_0x49b1('0x55')],{'read':![],'body':_0x341585['body'][_0x49b1('0x55')],'phone':_0x554dc1,'SmsAccountId':_0x309167['id'],'UserId':_0x341585['user']['id'],'ContactId':_0x512235['id']})]},{'include':[{'model':db[_0x49b1('0xa2')],'as':_0x49b1('0xc0')}]})['then'](function(_0xcd7b85){return[_0xcd7b85,!![]];});});}})['spread'](function(_0x1ea644,_0x4689f2){if(_0x4689f2){return _0x1ea644;}return db[_0x49b1('0xa2')][_0x49b1('0x54')](_[_0x49b1('0x48')](_0x341585[_0x49b1('0x55')],{'read':![],'body':_0x341585[_0x49b1('0x55')][_0x49b1('0x55')],'phone':_0x554dc1,'SmsAccountId':_0x309167['id'],'SmsInteractionId':_0x1ea644['id'],'UserId':_0x341585[_0x49b1('0x58')]['id'],'ContactId':_0x512235['id']}))[_0x49b1('0x1b')](function(_0xbc7e32){_0x1ea644[_0x49b1('0xc1')][_0x49b1('0xc0')]=[];_0x1ea644[_0x49b1('0xc1')][_0x49b1('0xc0')][_0x49b1('0xc2')](_0xbc7e32[_0x49b1('0xc1')]);return _0x1ea644;});})[_0x49b1('0x1b')](respondWithResult(_0x3441e5,null))['catch'](handleError(_0x3441e5,null));};exports[_0x49b1('0x25')]=function(_0x3325b1,_0x4f491b,_0x1f903d){if(_0x3325b1[_0x49b1('0x55')]['id']){delete _0x3325b1[_0x49b1('0x55')]['id'];}var _0x3db982,_0x175028,_0xfc4485;return db[_0x49b1('0x37')]['find']({'where':{'id':_0x3325b1[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x4f491b,null))[_0x49b1('0x1b')](function(_0xf67583){if(_0xf67583){_0xfc4485=_0xf67583;logger[_0x49b1('0x1e')](_0x49b1('0x1f'),_0x49b1('0x25'),'received\x20delivery\x20report\x20from',_0xf67583[_0x49b1('0x3a')],util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));switch(_0xf67583[_0x49b1('0x3a')]){case'skebby':if(_0x3325b1[_0x49b1('0x55')][_0x49b1('0xc4')]&&_0x3325b1[_0x49b1('0x55')][_0x49b1('0x25')]){_0x175028=_0x3325b1[_0x49b1('0x55')][_0x49b1('0x25')];return db[_0x49b1('0xa2')]['find']({'where':{'messageId':_0x3325b1[_0x49b1('0x55')][_0x49b1('0xc4')]}});}break;case _0x49b1('0xc5'):if(_0x3325b1['body'][_0x49b1('0xc6')]&&_0x3325b1[_0x49b1('0x55')][_0x49b1('0xc7')]){_0x175028=_0x3325b1[_0x49b1('0x55')][_0x49b1('0xc7')];return db[_0x49b1('0xa2')][_0x49b1('0x5a')]({'where':{'messageId':_0x3325b1['body'][_0x49b1('0xc6')]}});}break;case _0x49b1('0x82'):if(_0x3325b1[_0x49b1('0x55')][_0x49b1('0x84')]&&_0x3325b1[_0x49b1('0x55')][_0x49b1('0xc8')]){_0x175028=_0x3325b1[_0x49b1('0x55')]['status_code'];return db[_0x49b1('0xa2')]['find']({'where':{'messageId':_0x3325b1[_0x49b1('0x55')][_0x49b1('0x84')]}});}break;case _0x49b1('0x89'):var _0x9867de=_0x3325b1[_0x49b1('0x55')][_0x49b1('0x8a')][0x0];if(_0x9867de[_0x49b1('0x83')]&&_0x9867de['status'][_0x49b1('0xc9')]===_0x49b1('0xca')){_0x175028=_0x9867de[_0x49b1('0x25')][_0x49b1('0xc9')];return db[_0x49b1('0xa2')]['find']({'where':{'messageId':_0x9867de[_0x49b1('0x83')]}});}break;case'clickatell':if(_0x3325b1[_0x49b1('0x55')]['messageId']&&_0x3325b1['body']['status']){_0x175028=_0x3325b1[_0x49b1('0x55')]['status'];return db[_0x49b1('0xa2')]['find']({'where':{'messageId':_0x3325b1[_0x49b1('0x55')][_0x49b1('0x83')]}});}break;case _0x49b1('0x90'):if(_0x3325b1[_0x49b1('0x55')][0x0][_0x49b1('0x23')]['id']){_0x175028=_0x3325b1[_0x49b1('0x55')][0x0][_0x49b1('0x3a')];return db['SmsMessage'][_0x49b1('0x5a')]({'where':{'messageId':_0x3325b1['body'][0x0]['message']['id']}});}break;case _0x49b1('0xcb'):if(_0x3325b1[_0x49b1('0x55')][_0x49b1('0xcc')]&&_0x3325b1[_0x49b1('0x55')]['status']){_0x175028=_0x3325b1[_0x49b1('0x55')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x3325b1[_0x49b1('0x55')][_0x49b1('0xcc')]}});}break;}}})[_0x49b1('0x1b')](handleEntityNotFound(_0x4f491b,null))[_0x49b1('0x1b')](function(_0x5e2c2e){if(_0x5e2c2e){_0x3db982=_0x5e2c2e;switch(_0xfc4485[_0x49b1('0x3a')]){case _0x49b1('0x80'):if(_0x175028===_0x49b1('0xca')){return _0x3db982['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49b1('0x25'),_0x49b1('0x80'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x49b1('0xc5'):if(_0x175028==='1'){return _0x3db982['update']({'read':!![]});}else{logger['error'](_0x49b1('0x1f'),'status',_0x49b1('0x80'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x49b1('0x82'):if(!_0x3325b1[_0x49b1('0x55')][_0x49b1('0xcd')]&&_0x175028>=0xc8&&_0x175028<=0xce){return _0x3db982['update']({'read':!![]});}else{logger['error'](_0x49b1('0x1f'),_0x49b1('0x25'),_0x49b1('0x82'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x49b1('0x89'):var _0xaeb721=_0x3325b1[_0x49b1('0x55')][_0x49b1('0x8a')][0x0];if(_0xaeb721[_0x49b1('0x25')][_0x49b1('0xc9')]===_0x49b1('0xca')){return _0x3db982[_0x49b1('0x2f')]({'read':!![]});}else{logger[_0x49b1('0x21')](_0x49b1('0x1f'),_0x49b1('0x25'),_0x49b1('0x89'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x175028=='DELIVERED_TO_GATEWAY'||_0x175028=='RECEIVED_BY_RECIPIENT'){return _0x3db982[_0x49b1('0x2f')]({'read':!![]});}else{logger[_0x49b1('0x21')](_0x49b1('0x1f'),_0x49b1('0x25'),_0x49b1('0x8e'),util['inspect'](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x49b1('0x90'):if(_0x175028==_0x49b1('0xce')){return _0x3db982[_0x49b1('0x2f')]({'read':!![]});}else{logger[_0x49b1('0x21')](_0x49b1('0x1f'),_0x49b1('0x25'),_0x49b1('0x90'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x49b1('0xcb'):if(_0x175028==='DELIVRD'||_0x175028==='ACCEPTD'){return _0x3db982['update']({'read':!![]});}else{logger[_0x49b1('0x21')](_0x49b1('0x1f'),'status',_0x49b1('0xcb'),util[_0x49b1('0xc3')](_0x3325b1[_0x49b1('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x3db982;}})['then'](respondWithResult(_0x4f491b,null))[_0x49b1('0x4f')](handleError(_0x4f491b,null));};exports['statusGet']=function(_0x1b7361,_0x502af4,_0x207a7b){var _0x2752ae,_0x89adae,_0x3001ca;return db[_0x49b1('0x37')][_0x49b1('0x5a')]({'where':{'id':_0x1b7361[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x502af4,null))[_0x49b1('0x1b')](function(_0x12092e){if(_0x12092e){_0x3001ca=_0x12092e;logger[_0x49b1('0x1e')](_0x49b1('0x1f'),_0x49b1('0x25'),_0x49b1('0xcf'),_0x12092e['type'],util[_0x49b1('0xc3')](_0x1b7361[_0x49b1('0x3d')],{'showHidden':![],'depth':null}));switch(_0x12092e['type']){case'csc':if(_0x1b7361[_0x49b1('0x3d')]['message-id']&&_0x1b7361[_0x49b1('0x3d')][_0x49b1('0xd0')]){_0x89adae=_0x1b7361[_0x49b1('0x3d')]['state'];return db[_0x49b1('0xa2')][_0x49b1('0x5a')]({'where':{'messageId':_0x1b7361[_0x49b1('0x3d')]['message-id']}});}break;}}})[_0x49b1('0x1b')](handleEntityNotFound(_0x502af4,null))[_0x49b1('0x1b')](function(_0x51a8a7){if(_0x51a8a7){_0x2752ae=_0x51a8a7;switch(_0x3001ca[_0x49b1('0x3a')]){case'csc':if(_0x89adae==='2'||_0x89adae==='6'){return _0x2752ae['update']({'read':!![]});}else{logger[_0x49b1('0x21')](_0x49b1('0x1f'),_0x49b1('0x25'),'csc',util[_0x49b1('0xc3')](_0x1b7361[_0x49b1('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x2752ae;}})[_0x49b1('0x1b')](respondWithResult(_0x502af4,null))['catch'](handleError(_0x502af4,null));};exports[_0x49b1('0xd1')]=function(_0x1706ea,_0x2b5b87,_0x2e4f95){return db[_0x49b1('0x37')][_0x49b1('0x5a')]({'where':{'id':_0x1706ea['params']['id']}})['then'](handleEntityNotFound(_0x2b5b87,null))[_0x49b1('0x1b')](function(_0x89ffb8){if(_0x89ffb8){return _0x89ffb8[_0x49b1('0xd1')](_0x1706ea[_0x49b1('0x55')][_0x49b1('0x6a')],_[_0x49b1('0xd2')](_0x1706ea['body'],[_0x49b1('0x6a'),'id'])||{})[_0x49b1('0xd3')](function(_0x42cd52){for(var _0x4b7086=0x0;_0x4b7086<_0x1706ea[_0x49b1('0x55')][_0x49b1('0x6a')][_0x49b1('0x42')];_0x4b7086+=0x1){socket[_0x49b1('0xd4')](_0x49b1('0xd5'),{'UserId':Number(_0x1706ea['body']['ids'][_0x4b7086]),'SmsAccountId':Number(_0x1706ea[_0x49b1('0x51')]['id'])});}return _0x42cd52;});}})[_0x49b1('0x1b')](respondWithResult(_0x2b5b87,null))[_0x49b1('0x4f')](handleError(_0x2b5b87,null));};exports[_0x49b1('0xd6')]=function(_0x4902f1,_0x391153,_0x170c5f){return db[_0x49b1('0x37')]['find']({'where':{'id':_0x4902f1['params']['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x391153,null))['then'](function(_0x585e57){if(_0x585e57){return _0x585e57[_0x49b1('0xd6')](_0x4902f1['query']['ids'])[_0x49b1('0x1b')](function(){if(_[_0x49b1('0xd7')](_0x4902f1['query'][_0x49b1('0x6a')])){for(var _0x5798bd=0x0;_0x5798bd<_0x4902f1[_0x49b1('0x3d')]['ids']['length'];_0x5798bd+=0x1){socket[_0x49b1('0xd4')]('userSmsAccount:remove',{'UserId':Number(_0x4902f1['query'][_0x49b1('0x6a')][_0x5798bd]),'SmsAccountId':Number(_0x4902f1[_0x49b1('0x51')]['id'])});}}else{socket[_0x49b1('0xd4')](_0x49b1('0xd8'),{'UserId':Number(_0x4902f1['query'][_0x49b1('0x6a')]),'SmsAccountId':Number(_0x4902f1['params']['id'])});}});}})[_0x49b1('0x1b')](respondWithStatusCode(_0x391153,null))['catch'](handleError(_0x391153,null));};exports[_0x49b1('0xd9')]=function(_0x554d65,_0x203825,_0x1a092d){var _0x53f19d={};var _0x2b9b9b={};var _0x20d547;var _0x5ee8cf;return db[_0x49b1('0x37')][_0x49b1('0x61')]({'where':{'id':_0x554d65[_0x49b1('0x51')]['id']}})[_0x49b1('0x1b')](handleEntityNotFound(_0x203825,null))[_0x49b1('0x1b')](function(_0x29bfed){if(_0x29bfed){_0x20d547=_0x29bfed;_0x2b9b9b[_0x49b1('0x3c')]=_['keys'](db[_0x49b1('0xa6')][_0x49b1('0x38')]);_0x2b9b9b[_0x49b1('0x3d')]=_[_0x49b1('0x3e')](_0x554d65[_0x49b1('0x3d')]);_0x2b9b9b[_0x49b1('0x3f')]=_[_0x49b1('0x53')](_0x2b9b9b[_0x49b1('0x3c')],_0x2b9b9b[_0x49b1('0x3d')]);_0x53f19d[_0x49b1('0x40')]=_[_0x49b1('0x53')](_0x2b9b9b['model'],qs[_0x49b1('0x41')](_0x554d65['query']['fields']));_0x53f19d[_0x49b1('0x40')]=_0x53f19d[_0x49b1('0x40')][_0x49b1('0x42')]?_0x53f19d[_0x49b1('0x40')]:_0x2b9b9b[_0x49b1('0x3c')];_0x53f19d['order']=qs[_0x49b1('0x45')](_0x554d65[_0x49b1('0x3d')][_0x49b1('0x45')]);_0x53f19d[_0x49b1('0x46')]=qs[_0x49b1('0x3f')](_[_0x49b1('0x63')](_0x554d65[_0x49b1('0x3d')],_0x2b9b9b[_0x49b1('0x3f')]));if(_0x554d65[_0x49b1('0x3d')][_0x49b1('0x47')]){_0x53f19d[_0x49b1('0x46')]=_[_0x49b1('0x48')](_0x53f19d['where'],{'$or':_[_0x49b1('0x68')](_0x53f19d[_0x49b1('0x40')],function(_0x5ef359){var _0x3db761={};_0x3db761[_0x5ef359]={'$like':'%'+_0x554d65[_0x49b1('0x3d')][_0x49b1('0x47')]+'%'};return _0x3db761;})});}_0x53f19d=_[_0x49b1('0x48')]({},_0x53f19d,_0x554d65[_0x49b1('0x4a')]);return _0x20d547[_0x49b1('0xd9')](_0x53f19d);}})['then'](function(_0x38ad02){if(_0x38ad02){_0x5ee8cf=_0x38ad02[_0x49b1('0x42')];if(!_0x554d65[_0x49b1('0x3d')][_0x49b1('0x43')]('nolimit')){_0x53f19d[_0x49b1('0x2b')]=qs[_0x49b1('0x2b')](_0x554d65[_0x49b1('0x3d')][_0x49b1('0x2b')]);_0x53f19d[_0x49b1('0x2a')]=qs[_0x49b1('0x2a')](_0x554d65[_0x49b1('0x3d')][_0x49b1('0x2a')]);}return _0x20d547[_0x49b1('0xd9')](_0x53f19d);}})[_0x49b1('0x1b')](function(_0x5a3e13){if(_0x5a3e13){return _0x5a3e13?{'count':_0x5ee8cf,'rows':_0x5a3e13}:null;}})[_0x49b1('0x1b')](respondWithResult(_0x203825,null))[_0x49b1('0x4f')](handleError(_0x203825,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 0d7bab2..7246e41 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 _0xb28f=['setMaxListeners','save','update','remove','emit','hook','exports','SmsAccount'];(function(_0x346477,_0x1ec366){var _0x1d859a=function(_0x19ba4e){while(--_0x19ba4e){_0x346477['push'](_0x346477['shift']());}};_0x1d859a(++_0x1ec366);}(_0xb28f,0x1c7));var _0xfb28=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb28f[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xfb28('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfb28('0x1')](0x0);var events={'afterCreate':_0xfb28('0x2'),'afterUpdate':_0xfb28('0x3'),'afterDestroy':_0xfb28('0x4')};function emitEvent(_0x5b219e){return function(_0x31dbc6,_0x530778,_0x14835a){SmsAccountEvents['emit'](_0x5b219e+':'+_0x31dbc6['id'],_0x31dbc6);SmsAccountEvents[_0xfb28('0x5')](_0x5b219e,_0x31dbc6);_0x14835a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xfb28('0x6')](e,emitEvent(event));}}module[_0xfb28('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x7da0=['../../mysqldb','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x443bdf,_0x2dea9c){var _0x2d1684=function(_0x3b361c){while(--_0x3b361c){_0x443bdf['push'](_0x443bdf['shift']());}};_0x2d1684(++_0x2dea9c);}(_0x7da0,0x9a));var _0x07da=function(_0x47ae9a,_0x11e77e){_0x47ae9a=_0x47ae9a-0x0;var _0x3820e4=_0x7da0[_0x47ae9a];return _0x3820e4;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x07da('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x07da('0x1'),'afterDestroy':_0x07da('0x2')};function emitEvent(_0x4e63c7){return function(_0x7c90ee,_0x59163f,_0x265dc7){SmsAccountEvents['emit'](_0x4e63c7+':'+_0x7c90ee['id'],_0x7c90ee);SmsAccountEvents[_0x07da('0x3')](_0x4e63c7,_0x7c90ee);_0x265dc7(null);};}for(var e in events){if(events[_0x07da('0x4')](e)){var event=events[e];SmsAccount[_0x07da('0x5')](e,emitEvent(event));}}module[_0x07da('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 24a6e51..5b2bb42 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 _0x1c5f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger'];(function(_0x249c44,_0x18a728){var _0x50389c=function(_0x882bcc){while(--_0x882bcc){_0x249c44['push'](_0x249c44['shift']());}};_0x50389c(++_0x18a728);}(_0x1c5f,0x1ea));var _0xf1c5=function(_0x4819b7,_0x3f5d2f){_0x4819b7=_0x4819b7-0x0;var _0x5ac37b=_0x1c5f[_0x4819b7];return _0x5ac37b;};'use strict';var _=require(_0xf1c5('0x0'));var util=require('util');var logger=require(_0xf1c5('0x1'))(_0xf1c5('0x2'));var moment=require('moment');var BPromise=require(_0xf1c5('0x3'));var rp=require(_0xf1c5('0x4'));var fs=require('fs');var path=require(_0xf1c5('0x5'));var rimraf=require(_0xf1c5('0x6'));var config=require(_0xf1c5('0x7'));var attributes=require(_0xf1c5('0x8'));module['exports']=function(_0x3d684a,_0x330768){return _0x3d684a[_0xf1c5('0x9')](_0xf1c5('0xa'),attributes,{'tableName':_0xf1c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb1=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','rimraf','./smsAccount.attributes','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xadb1,0x1bb));var _0x1adb=function(_0x1ed016,_0x1102c7){_0x1ed016=_0x1ed016-0x0;var _0x507d36=_0xadb1[_0x1ed016];return _0x507d36;};'use strict';var _=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var logger=require(_0x1adb('0x2'))(_0x1adb('0x3'));var moment=require(_0x1adb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1adb('0x5'));var config=require('../../config/environment');var attributes=require(_0x1adb('0x6'));module[_0x1adb('0x7')]=function(_0x182ef9,_0x5f1209){return _0x182ef9[_0x1adb('0x8')](_0x1adb('0x9'),attributes,{'tableName':_0x1adb('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 ec31fb2..4e27b17 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 _0x09bf=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','options','raw','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x16c619,_0x6cac5){var _0x87d66c=function(_0x1acdbd){while(--_0x1acdbd){_0x16c619['push'](_0x16c619['shift']());}};_0x87d66c(++_0x6cac5);}(_0x09bf,0xa1));var _0xf09b=function(_0x21aea2,_0x65e0e2){_0x21aea2=_0x21aea2-0x0;var _0x27793c=_0x09bf[_0x21aea2];return _0x27793c;};'use strict';var _=require(_0xf09b('0x0'));var util=require(_0xf09b('0x1'));var moment=require(_0xf09b('0x2'));var BPromise=require(_0xf09b('0x3'));var rs=require(_0xf09b('0x4'));var fs=require('fs');var Redis=require(_0xf09b('0x5'));var db=require(_0xf09b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf09b('0x7'))(_0xf09b('0x8'));var config=require(_0xf09b('0x9'));var jayson=require(_0xf09b('0xa'));var client=jayson[_0xf09b('0xb')]['http']({'port':0x232a});config[_0xf09b('0xc')]=_['defaults'](config['redis'],{'host':_0xf09b('0xd'),'port':0x18eb});var socket=require(_0xf09b('0xe'))(new Redis(config['redis']));require(_0xf09b('0xf'))[_0xf09b('0x10')](socket);function respondWithRpcPromise(_0x159097,_0x2e1c10,_0x29b5a4){return new BPromise(function(_0x5dbf81,_0x2a5488){return client[_0xf09b('0x11')](_0x159097,_0x29b5a4)[_0xf09b('0x12')](function(_0x147f53){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2e1c10,_0xf09b('0x13'));logger[_0xf09b('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2e1c10,_0xf09b('0x13'),JSON[_0xf09b('0x15')](_0x147f53));if(_0x147f53[_0xf09b('0x16')]){if(_0x147f53[_0xf09b('0x16')]['code']===0x1f4){logger[_0xf09b('0x16')](_0xf09b('0x17'),_0x2e1c10,_0x147f53[_0xf09b('0x16')][_0xf09b('0x18')]);return _0x2a5488(_0x147f53[_0xf09b('0x16')][_0xf09b('0x18')]);}logger['error'](_0xf09b('0x17'),_0x2e1c10,_0x147f53['error'][_0xf09b('0x18')]);return _0x5dbf81(_0x147f53[_0xf09b('0x16')][_0xf09b('0x18')]);}else{logger['info'](_0xf09b('0x17'),_0x2e1c10,'request\x20sent');_0x5dbf81(_0x147f53[_0xf09b('0x19')][_0xf09b('0x18')]);}})[_0xf09b('0x1a')](function(_0x42635c){logger[_0xf09b('0x16')](_0xf09b('0x17'),_0x2e1c10,_0x42635c);_0x2a5488(_0x42635c);});});}exports[_0xf09b('0x1b')]=function(_0x4d2403){var _0x43810b=this;return new Promise(function(_0x27bfc4,_0x4b5d76){return db['SmsAccount']['find']({'raw':_0x4d2403[_0xf09b('0x1c')]?_0x4d2403[_0xf09b('0x1c')][_0xf09b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d2403[_0xf09b('0x1c')]?_0x4d2403[_0xf09b('0x1c')]['where']||null:null,'attributes':_0x4d2403[_0xf09b('0x1c')]?_0x4d2403[_0xf09b('0x1c')][_0xf09b('0x1e')]||null:null,'include':_0x4d2403['options']?_0x4d2403['options']['include']?_[_0xf09b('0x1f')](_0x4d2403[_0xf09b('0x1c')][_0xf09b('0x20')],function(_0x238571){return{'model':db[_0x238571[_0xf09b('0x21')]],'as':_0x238571['as'],'attributes':_0x238571[_0xf09b('0x1e')],'include':_0x238571[_0xf09b('0x20')]?_['map'](_0x238571[_0xf09b('0x20')],function(_0x1c0198){return{'model':db[_0x1c0198[_0xf09b('0x21')]],'as':_0x1c0198['as'],'attributes':_0x1c0198['attributes'],'include':_0x1c0198['include']?_[_0xf09b('0x1f')](_0x1c0198[_0xf09b('0x20')],function(_0x37c37e){return{'model':db[_0x37c37e[_0xf09b('0x21')]],'as':_0x37c37e['as'],'attributes':_0x37c37e[_0xf09b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf09b('0x12')](function(_0x62469f){logger['info']('ShowSmsAccount',_0x4d2403);logger['debug'](_0xf09b('0x1b'),_0x4d2403,JSON[_0xf09b('0x15')](_0x62469f));_0x27bfc4(_0x62469f);})[_0xf09b('0x1a')](function(_0x3bad9d){logger[_0xf09b('0x16')](_0xf09b('0x1b'),_0x3bad9d[_0xf09b('0x18')],_0x4d2403);_0x4b5d76(_0x43810b['error'](0x1f4,_0x3bad9d[_0xf09b('0x18')]));});});}; \ No newline at end of file +var _0x6923=['socket.io-emitter','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x13169c,_0x2c2300){var _0x1cc09e=function(_0x4c6dbe){while(--_0x4c6dbe){_0x13169c['push'](_0x13169c['shift']());}};_0x1cc09e(++_0x2c2300);}(_0x6923,0xcb));var _0x3692=function(_0x4336df,_0x3a0320){_0x4336df=_0x4336df-0x0;var _0x5c2607=_0x6923[_0x4336df];return _0x5c2607;};'use strict';var _=require(_0x3692('0x0'));var util=require('util');var moment=require(_0x3692('0x1'));var BPromise=require(_0x3692('0x2'));var rs=require(_0x3692('0x3'));var fs=require('fs');var Redis=require(_0x3692('0x4'));var db=require(_0x3692('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3692('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3692('0x7'));var client=jayson[_0x3692('0x8')][_0x3692('0x9')]({'port':0x232a});config[_0x3692('0xa')]=_[_0x3692('0xb')](config['redis'],{'host':_0x3692('0xc'),'port':0x18eb});var socket=require(_0x3692('0xd'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x31eec5,_0x30414d,_0x451a19){return new BPromise(function(_0x4a3822,_0x15c156){return client[_0x3692('0xe')](_0x31eec5,_0x451a19)[_0x3692('0xf')](function(_0x28cb48){logger['info']('SmsAccount,\x20%s,\x20%s',_0x30414d,_0x3692('0x10'));logger[_0x3692('0x11')](_0x3692('0x12'),_0x30414d,_0x3692('0x10'),JSON[_0x3692('0x13')](_0x28cb48));if(_0x28cb48['error']){if(_0x28cb48[_0x3692('0x14')][_0x3692('0x15')]===0x1f4){logger[_0x3692('0x14')](_0x3692('0x16'),_0x30414d,_0x28cb48['error']['message']);return _0x15c156(_0x28cb48[_0x3692('0x14')][_0x3692('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x30414d,_0x28cb48[_0x3692('0x14')][_0x3692('0x17')]);return _0x4a3822(_0x28cb48['error'][_0x3692('0x17')]);}else{logger[_0x3692('0x18')](_0x3692('0x16'),_0x30414d,_0x3692('0x10'));_0x4a3822(_0x28cb48[_0x3692('0x19')]['message']);}})['catch'](function(_0x383ef7){logger['error'](_0x3692('0x16'),_0x30414d,_0x383ef7);_0x15c156(_0x383ef7);});});}exports[_0x3692('0x1a')]=function(_0x329156){var _0x5959bc=this;return new Promise(function(_0x49a297,_0x2b35ce){return db['SmsAccount'][_0x3692('0x1b')]({'raw':_0x329156[_0x3692('0x1c')]?_0x329156['options'][_0x3692('0x1d')]===undefined?!![]:![]:!![],'where':_0x329156[_0x3692('0x1c')]?_0x329156[_0x3692('0x1c')][_0x3692('0x1e')]||null:null,'attributes':_0x329156[_0x3692('0x1c')]?_0x329156['options'][_0x3692('0x1f')]||null:null,'include':_0x329156['options']?_0x329156['options'][_0x3692('0x20')]?_[_0x3692('0x21')](_0x329156[_0x3692('0x1c')]['include'],function(_0x20fa40){return{'model':db[_0x20fa40[_0x3692('0x22')]],'as':_0x20fa40['as'],'attributes':_0x20fa40[_0x3692('0x1f')],'include':_0x20fa40['include']?_[_0x3692('0x21')](_0x20fa40['include'],function(_0x59c87d){return{'model':db[_0x59c87d[_0x3692('0x22')]],'as':_0x59c87d['as'],'attributes':_0x59c87d[_0x3692('0x1f')],'include':_0x59c87d[_0x3692('0x20')]?_[_0x3692('0x21')](_0x59c87d['include'],function(_0x3c5825){return{'model':db[_0x3c5825[_0x3692('0x22')]],'as':_0x3c5825['as'],'attributes':_0x3c5825[_0x3692('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3692('0xf')](function(_0x7dd4c8){logger['info']('ShowSmsAccount',_0x329156);logger[_0x3692('0x11')](_0x3692('0x1a'),_0x329156,JSON['stringify'](_0x7dd4c8));_0x49a297(_0x7dd4c8);})[_0x3692('0x23')](function(_0x4725bf){logger['error'](_0x3692('0x1a'),_0x4725bf[_0x3692('0x17')],_0x329156);_0x2b35ce(_0x5959bc[_0x3692('0x14')](0x1f4,_0x4725bf[_0x3692('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a1f0c81..8644325 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 69d4ed5..b3fd88e 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1971a0,_0x50cda3){var _0x1f2934=function(_0xe49d16){while(--_0xe49d16){_0x1971a0['push'](_0x1971a0['shift']());}};_0x1f2934(++_0x50cda3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b5fa1,_0x4597e9){_0x5b5fa1=_0x5b5fa1-0x0;var _0x12a4a4=_0xedd9[_0x5b5fa1];return _0x12a4a4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a8bca,_0x675137){var _0x5a2703=function(_0xfd4bf8){while(--_0xfd4bf8){_0x5a8bca['push'](_0x5a8bca['shift']());}};_0x5a2703(++_0x675137);}(_0x34e8,0x12c));var _0x834e=function(_0x12aae6,_0x1b878a){_0x12aae6=_0x12aae6-0x0;var _0x47acf9=_0x34e8[_0x12aae6];return _0x47acf9;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cd949c7..ffc1c86 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 _0x90f8=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x90f8,0x9a));var _0x890f=function(_0x332a2c,_0x7adc98){_0x332a2c=_0x332a2c-0x0;var _0x318f7f=_0x90f8[_0x332a2c];return _0x318f7f;};'use strict';var Sequelize=require(_0x890f('0x0'));module[_0x890f('0x1')]={'priority':{'type':Sequelize[_0x890f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x890f('0x3')],'allowNull':![],'defaultValue':_0x890f('0x4')},'appdata':{'type':Sequelize[_0x890f('0x5')]()},'description':{'type':Sequelize[_0x890f('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6251=['STRING','*,*,*,*','sequelize','noop','TEXT'];(function(_0x4692df,_0x274c73){var _0x581e45=function(_0x17ba15){while(--_0x17ba15){_0x4692df['push'](_0x4692df['shift']());}};_0x581e45(++_0x274c73);}(_0x6251,0xde));var _0x1625=function(_0x56260c,_0x3594bc){_0x56260c=_0x56260c-0x0;var _0x3293b9=_0x6251[_0x56260c];return _0x3293b9;};'use strict';var Sequelize=require(_0x1625('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1625('0x1')},'appdata':{'type':Sequelize[_0x1625('0x2')]()},'description':{'type':Sequelize[_0x1625('0x3')]},'interval':{'type':Sequelize[_0x1625('0x3')],'defaultValue':_0x1625('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fedb778..9a5d50e 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 _0xa978=['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','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','show','params','intersection','find','create','catch','update','body','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x12d8d9,_0x36e47b){var _0x44f4f3=function(_0xa3935d){while(--_0xa3935d){_0x12d8d9['push'](_0x12d8d9['shift']());}};_0x44f4f3(++_0x36e47b);}(_0xa978,0xd9));var _0x8a97=function(_0x5c512e,_0x23dfb9){_0x5c512e=_0x5c512e-0x0;var _0x95381d=_0xa978[_0x5c512e];return _0x95381d;};'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(_0x8a97('0x0'));var moment=require(_0x8a97('0x1'));var BPromise=require(_0x8a97('0x2'));var Mustache=require(_0x8a97('0x3'));var util=require(_0x8a97('0x4'));var path=require(_0x8a97('0x5'));var sox=require(_0x8a97('0x6'));var csv=require('to-csv');var ejs=require(_0x8a97('0x7'));var fs=require('fs');var fs_extra=require(_0x8a97('0x8'));var _=require(_0x8a97('0x9'));var squel=require(_0x8a97('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a97('0xb'));var deskjs=require(_0x8a97('0xc'));var toCsv=require(_0x8a97('0xd'));var querystring=require(_0x8a97('0xe'));var Papa=require(_0x8a97('0xf'));var Redis=require('ioredis');var authService=require(_0x8a97('0x10'));var qs=require(_0x8a97('0x11'));var as=require(_0x8a97('0x12'));var hardwareService=require(_0x8a97('0x13'));var logger=require(_0x8a97('0x14'))(_0x8a97('0x15'));var utils=require(_0x8a97('0x16'));var config=require(_0x8a97('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a97('0x18'))['db'];function respondWithStatusCode(_0x10c98f,_0x6e6373){_0x6e6373=_0x6e6373||0xcc;return function(_0x21f8b6){if(_0x21f8b6){return _0x10c98f['sendStatus'](_0x6e6373);}return _0x10c98f['status'](_0x6e6373)[_0x8a97('0x19')]();};}function respondWithResult(_0x33f8dc,_0x162c2f){_0x162c2f=_0x162c2f||0xc8;return function(_0x1d02ef){if(_0x1d02ef){return _0x33f8dc[_0x8a97('0x1a')](_0x162c2f)[_0x8a97('0x1b')](_0x1d02ef);}};}function respondWithFilteredResult(_0x5966b0,_0x4862fc){return function(_0x4459d1){if(_0x4459d1){var _0x4637d4=typeof _0x4862fc[_0x8a97('0x1c')]===_0x8a97('0x1d')&&typeof _0x4862fc[_0x8a97('0x1e')]===_0x8a97('0x1d');var _0x1b6e6c=_0x4459d1[_0x8a97('0x1f')];var _0x418d23=_0x4637d4?0x0:_0x4862fc['offset'];var _0xffdf78=_0x4637d4?_0x4459d1[_0x8a97('0x1f')]:_0x4862fc[_0x8a97('0x1c')]+_0x4862fc['limit'];var _0x40d536;if(_0xffdf78>=_0x1b6e6c){_0xffdf78=_0x1b6e6c;_0x40d536=0xc8;}else{_0x40d536=0xce;}_0x5966b0[_0x8a97('0x1a')](_0x40d536);return _0x5966b0[_0x8a97('0x20')]('Content-Range',_0x418d23+'-'+_0xffdf78+'/'+_0x1b6e6c)[_0x8a97('0x1b')](_0x4459d1);}return null;};}function patchUpdates(_0x52db3e){return function(_0x23a16d){try{jsonpatch[_0x8a97('0x21')](_0x23a16d,_0x52db3e,!![]);}catch(_0x2d624e){return BPromise['reject'](_0x2d624e);}return _0x23a16d['save']();};}function saveUpdates(_0x2e8b9f,_0x4cc54){return function(_0x2aa1da){if(_0x2aa1da){return _0x2aa1da['update'](_0x2e8b9f)[_0x8a97('0x22')](function(_0x225059){return _0x225059;});}return null;};}function removeEntity(_0x439497,_0xb983dc){return function(_0x1f3096){if(_0x1f3096){return _0x1f3096[_0x8a97('0x23')]()[_0x8a97('0x22')](function(){_0x439497[_0x8a97('0x1a')](0xcc)[_0x8a97('0x19')]();});}};}function handleEntityNotFound(_0xc16e39,_0x505996){return function(_0x46f054){if(!_0x46f054){_0xc16e39[_0x8a97('0x24')](0x194);}return _0x46f054;};}function handleError(_0x14c12e,_0x4122ba){_0x4122ba=_0x4122ba||0x1f4;return function(_0x228537){logger[_0x8a97('0x25')](_0x228537[_0x8a97('0x26')]);if(_0x228537[_0x8a97('0x27')]){delete _0x228537[_0x8a97('0x27')];}_0x14c12e[_0x8a97('0x1a')](_0x4122ba)[_0x8a97('0x28')](_0x228537);};}exports[_0x8a97('0x29')]=function(_0x5da692,_0x4f4a80){var _0x356c7c={},_0x2742c5={},_0x508d29={'count':0x0,'rows':[]};var _0x182b11=_['map'](db['SmsApplication'][_0x8a97('0x2a')],function(_0x1e61a4){return{'name':_0x1e61a4[_0x8a97('0x2b')],'type':_0x1e61a4[_0x8a97('0x2c')][_0x8a97('0x2d')]};});_0x2742c5[_0x8a97('0x2e')]=_[_0x8a97('0x2f')](_0x182b11,_0x8a97('0x27'));_0x2742c5['query']=_[_0x8a97('0x30')](_0x5da692['query']);_0x2742c5[_0x8a97('0x31')]=_['intersection'](_0x2742c5[_0x8a97('0x2e')],_0x2742c5[_0x8a97('0x32')]);_0x356c7c['attributes']=_['intersection'](_0x2742c5[_0x8a97('0x2e')],qs['fields'](_0x5da692[_0x8a97('0x32')][_0x8a97('0x33')]));_0x356c7c['attributes']=_0x356c7c[_0x8a97('0x34')][_0x8a97('0x35')]?_0x356c7c[_0x8a97('0x34')]:_0x2742c5[_0x8a97('0x2e')];if(!_0x5da692[_0x8a97('0x32')][_0x8a97('0x36')]('nolimit')){_0x356c7c[_0x8a97('0x1e')]=qs['limit'](_0x5da692['query'][_0x8a97('0x1e')]);_0x356c7c[_0x8a97('0x1c')]=qs[_0x8a97('0x1c')](_0x5da692['query'][_0x8a97('0x1c')]);}_0x356c7c[_0x8a97('0x37')]=qs['sort'](_0x5da692[_0x8a97('0x32')][_0x8a97('0x38')]);_0x356c7c[_0x8a97('0x39')]=qs[_0x8a97('0x31')](_[_0x8a97('0x3a')](_0x5da692['query'],_0x2742c5[_0x8a97('0x31')]),_0x182b11);if(_0x5da692[_0x8a97('0x32')][_0x8a97('0x3b')]){_0x356c7c[_0x8a97('0x39')]=_[_0x8a97('0x3c')](_0x356c7c[_0x8a97('0x39')],{'$or':_['map'](_0x182b11,function(_0x2af262){if(_0x2af262[_0x8a97('0x2c')]!==_0x8a97('0x3d')){var _0x283f0d={};_0x283f0d[_0x2af262[_0x8a97('0x27')]]={'$like':'%'+_0x5da692[_0x8a97('0x32')][_0x8a97('0x3b')]+'%'};return _0x283f0d;}})});}_0x356c7c=_[_0x8a97('0x3c')]({},_0x356c7c,_0x5da692[_0x8a97('0x3e')]);var _0x235b20={'where':_0x356c7c[_0x8a97('0x39')]};return db[_0x8a97('0x3f')][_0x8a97('0x1f')](_0x235b20)[_0x8a97('0x22')](function(_0x5819f9){_0x508d29[_0x8a97('0x1f')]=_0x5819f9;if(_0x5da692[_0x8a97('0x32')][_0x8a97('0x40')]){_0x356c7c[_0x8a97('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x8a97('0x42')](_0x356c7c);})[_0x8a97('0x22')](function(_0x27c342){_0x508d29[_0x8a97('0x43')]=_0x27c342;return _0x508d29;})[_0x8a97('0x22')](respondWithFilteredResult(_0x4f4a80,_0x356c7c))['catch'](handleError(_0x4f4a80,null));};exports[_0x8a97('0x44')]=function(_0x3c81f4,_0x48fdcd){var _0x4c56a7={'raw':!![],'where':{'id':_0x3c81f4[_0x8a97('0x45')]['id']}},_0x23aacf={};_0x23aacf[_0x8a97('0x2e')]=_[_0x8a97('0x30')](db[_0x8a97('0x3f')][_0x8a97('0x2a')]);_0x23aacf['query']=_['keys'](_0x3c81f4[_0x8a97('0x32')]);_0x23aacf[_0x8a97('0x31')]=_[_0x8a97('0x46')](_0x23aacf[_0x8a97('0x2e')],_0x23aacf[_0x8a97('0x32')]);_0x4c56a7['attributes']=_[_0x8a97('0x46')](_0x23aacf[_0x8a97('0x2e')],qs[_0x8a97('0x33')](_0x3c81f4[_0x8a97('0x32')][_0x8a97('0x33')]));_0x4c56a7[_0x8a97('0x34')]=_0x4c56a7[_0x8a97('0x34')][_0x8a97('0x35')]?_0x4c56a7[_0x8a97('0x34')]:_0x23aacf[_0x8a97('0x2e')];if(_0x3c81f4[_0x8a97('0x32')][_0x8a97('0x40')]){_0x4c56a7[_0x8a97('0x41')]=[{'all':!![]}];}_0x4c56a7=_['merge']({},_0x4c56a7,_0x3c81f4[_0x8a97('0x3e')]);return db[_0x8a97('0x3f')][_0x8a97('0x47')](_0x4c56a7)[_0x8a97('0x22')](handleEntityNotFound(_0x48fdcd,null))['then'](respondWithResult(_0x48fdcd,null))['catch'](handleError(_0x48fdcd,null));};exports['create']=function(_0x4fb494,_0x3b5cfa){return db[_0x8a97('0x3f')][_0x8a97('0x48')](_0x4fb494['body'],{})[_0x8a97('0x22')](respondWithResult(_0x3b5cfa,0xc9))[_0x8a97('0x49')](handleError(_0x3b5cfa,null));};exports[_0x8a97('0x4a')]=function(_0x8eaadd,_0x47811c){if(_0x8eaadd[_0x8a97('0x4b')]['id']){delete _0x8eaadd[_0x8a97('0x4b')]['id'];}return db[_0x8a97('0x3f')][_0x8a97('0x47')]({'where':{'id':_0x8eaadd['params']['id']}})[_0x8a97('0x22')](handleEntityNotFound(_0x47811c,null))[_0x8a97('0x22')](saveUpdates(_0x8eaadd['body'],null))[_0x8a97('0x22')](respondWithResult(_0x47811c,null))[_0x8a97('0x49')](handleError(_0x47811c,null));};exports[_0x8a97('0x23')]=function(_0x14b07f,_0x47dd8d){return db[_0x8a97('0x3f')][_0x8a97('0x47')]({'where':{'id':_0x14b07f[_0x8a97('0x45')]['id']}})[_0x8a97('0x22')](handleEntityNotFound(_0x47dd8d,null))[_0x8a97('0x22')](removeEntity(_0x47dd8d,null))[_0x8a97('0x49')](handleError(_0x47dd8d,null));}; \ No newline at end of file +var _0xcdf4=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','SmsApplication','includeAll','rows','show','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20bedd,_0x39694b){var _0x3041f3=function(_0x1f53ee){while(--_0x1f53ee){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3041f3(++_0x39694b);}(_0xcdf4,0x1b9));var _0x4cdf=function(_0x164b98,_0xe91fad){_0x164b98=_0x164b98-0x0;var _0x53e8f8=_0xcdf4[_0x164b98];return _0x53e8f8;};'use strict';var emlformat=require(_0x4cdf('0x0'));var rimraf=require(_0x4cdf('0x1'));var zipdir=require(_0x4cdf('0x2'));var jsonpatch=require(_0x4cdf('0x3'));var rp=require('request-promise');var moment=require(_0x4cdf('0x4'));var BPromise=require(_0x4cdf('0x5'));var Mustache=require(_0x4cdf('0x6'));var util=require(_0x4cdf('0x7'));var path=require(_0x4cdf('0x8'));var sox=require('sox');var csv=require(_0x4cdf('0x9'));var ejs=require(_0x4cdf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cdf('0xb'));var squel=require(_0x4cdf('0xc'));var crypto=require(_0x4cdf('0xd'));var jsforce=require(_0x4cdf('0xe'));var deskjs=require(_0x4cdf('0xf'));var toCsv=require(_0x4cdf('0x9'));var querystring=require(_0x4cdf('0x10'));var Papa=require(_0x4cdf('0x11'));var Redis=require(_0x4cdf('0x12'));var authService=require(_0x4cdf('0x13'));var qs=require(_0x4cdf('0x14'));var as=require(_0x4cdf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cdf('0x16'))(_0x4cdf('0x17'));var utils=require(_0x4cdf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4cdf('0x19'));var db=require(_0x4cdf('0x1a'))['db'];function respondWithStatusCode(_0x5088a6,_0x1674c7){_0x1674c7=_0x1674c7||0xcc;return function(_0x492a62){if(_0x492a62){return _0x5088a6[_0x4cdf('0x1b')](_0x1674c7);}return _0x5088a6['status'](_0x1674c7)['end']();};}function respondWithResult(_0x55e003,_0x5f0a12){_0x5f0a12=_0x5f0a12||0xc8;return function(_0x2daab8){if(_0x2daab8){return _0x55e003[_0x4cdf('0x1c')](_0x5f0a12)[_0x4cdf('0x1d')](_0x2daab8);}};}function respondWithFilteredResult(_0x2f7d29,_0x28ba89){return function(_0x563c8c){if(_0x563c8c){var _0x1c1e46=typeof _0x28ba89[_0x4cdf('0x1e')]===_0x4cdf('0x1f')&&typeof _0x28ba89[_0x4cdf('0x20')]===_0x4cdf('0x1f');var _0x58a6ae=_0x563c8c['count'];var _0x28c62c=_0x1c1e46?0x0:_0x28ba89['offset'];var _0xb21263=_0x1c1e46?_0x563c8c[_0x4cdf('0x21')]:_0x28ba89['offset']+_0x28ba89[_0x4cdf('0x20')];var _0x376eae;if(_0xb21263>=_0x58a6ae){_0xb21263=_0x58a6ae;_0x376eae=0xc8;}else{_0x376eae=0xce;}_0x2f7d29['status'](_0x376eae);return _0x2f7d29[_0x4cdf('0x22')](_0x4cdf('0x23'),_0x28c62c+'-'+_0xb21263+'/'+_0x58a6ae)['json'](_0x563c8c);}return null;};}function patchUpdates(_0xfe15a9){return function(_0x517e18){try{jsonpatch[_0x4cdf('0x24')](_0x517e18,_0xfe15a9,!![]);}catch(_0x47cb50){return BPromise[_0x4cdf('0x25')](_0x47cb50);}return _0x517e18[_0x4cdf('0x26')]();};}function saveUpdates(_0x56e2d8,_0x464b11){return function(_0x17eaeb){if(_0x17eaeb){return _0x17eaeb[_0x4cdf('0x27')](_0x56e2d8)[_0x4cdf('0x28')](function(_0x140fc3){return _0x140fc3;});}return null;};}function removeEntity(_0x238d8d,_0x32b8a0){return function(_0x26801d){if(_0x26801d){return _0x26801d[_0x4cdf('0x29')]()['then'](function(){_0x238d8d['status'](0xcc)[_0x4cdf('0x2a')]();});}};}function handleEntityNotFound(_0x9c1384,_0x5085cd){return function(_0x20a0a8){if(!_0x20a0a8){_0x9c1384[_0x4cdf('0x1b')](0x194);}return _0x20a0a8;};}function handleError(_0x974618,_0x101de4){_0x101de4=_0x101de4||0x1f4;return function(_0x2de4ed){logger[_0x4cdf('0x2b')](_0x2de4ed[_0x4cdf('0x2c')]);if(_0x2de4ed[_0x4cdf('0x2d')]){delete _0x2de4ed[_0x4cdf('0x2d')];}_0x974618[_0x4cdf('0x1c')](_0x101de4)[_0x4cdf('0x2e')](_0x2de4ed);};}exports[_0x4cdf('0x2f')]=function(_0x149849,_0x30e3d9){var _0x3289a5={},_0x2c538b={},_0xce246a={'count':0x0,'rows':[]};var _0x5e2a0d=_[_0x4cdf('0x30')](db['SmsApplication'][_0x4cdf('0x31')],function(_0x5241fa){return{'name':_0x5241fa[_0x4cdf('0x32')],'type':_0x5241fa[_0x4cdf('0x33')][_0x4cdf('0x34')]};});_0x2c538b[_0x4cdf('0x35')]=_[_0x4cdf('0x30')](_0x5e2a0d,_0x4cdf('0x2d'));_0x2c538b[_0x4cdf('0x36')]=_[_0x4cdf('0x37')](_0x149849[_0x4cdf('0x36')]);_0x2c538b['filters']=_[_0x4cdf('0x38')](_0x2c538b[_0x4cdf('0x35')],_0x2c538b[_0x4cdf('0x36')]);_0x3289a5[_0x4cdf('0x39')]=_[_0x4cdf('0x38')](_0x2c538b[_0x4cdf('0x35')],qs[_0x4cdf('0x3a')](_0x149849[_0x4cdf('0x36')][_0x4cdf('0x3a')]));_0x3289a5[_0x4cdf('0x39')]=_0x3289a5[_0x4cdf('0x39')][_0x4cdf('0x3b')]?_0x3289a5['attributes']:_0x2c538b[_0x4cdf('0x35')];if(!_0x149849[_0x4cdf('0x36')][_0x4cdf('0x3c')](_0x4cdf('0x3d'))){_0x3289a5[_0x4cdf('0x20')]=qs[_0x4cdf('0x20')](_0x149849[_0x4cdf('0x36')]['limit']);_0x3289a5[_0x4cdf('0x1e')]=qs[_0x4cdf('0x1e')](_0x149849[_0x4cdf('0x36')][_0x4cdf('0x1e')]);}_0x3289a5['order']=qs[_0x4cdf('0x3e')](_0x149849[_0x4cdf('0x36')]['sort']);_0x3289a5[_0x4cdf('0x3f')]=qs[_0x4cdf('0x40')](_['pick'](_0x149849[_0x4cdf('0x36')],_0x2c538b['filters']),_0x5e2a0d);if(_0x149849[_0x4cdf('0x36')][_0x4cdf('0x41')]){_0x3289a5[_0x4cdf('0x3f')]=_[_0x4cdf('0x42')](_0x3289a5[_0x4cdf('0x3f')],{'$or':_[_0x4cdf('0x30')](_0x5e2a0d,function(_0x2adc21){if(_0x2adc21[_0x4cdf('0x33')]!=='VIRTUAL'){var _0x59f17c={};_0x59f17c[_0x2adc21[_0x4cdf('0x2d')]]={'$like':'%'+_0x149849[_0x4cdf('0x36')][_0x4cdf('0x41')]+'%'};return _0x59f17c;}})});}_0x3289a5=_[_0x4cdf('0x42')]({},_0x3289a5,_0x149849['options']);var _0x58ac44={'where':_0x3289a5['where']};return db[_0x4cdf('0x43')][_0x4cdf('0x21')](_0x58ac44)[_0x4cdf('0x28')](function(_0x3e1932){_0xce246a['count']=_0x3e1932;if(_0x149849[_0x4cdf('0x36')][_0x4cdf('0x44')]){_0x3289a5['include']=[{'all':!![]}];}return db[_0x4cdf('0x43')]['findAll'](_0x3289a5);})['then'](function(_0x1c345a){_0xce246a[_0x4cdf('0x45')]=_0x1c345a;return _0xce246a;})[_0x4cdf('0x28')](respondWithFilteredResult(_0x30e3d9,_0x3289a5))['catch'](handleError(_0x30e3d9,null));};exports[_0x4cdf('0x46')]=function(_0x4661a8,_0x5251fc){var _0x44ab63={'raw':!![],'where':{'id':_0x4661a8['params']['id']}},_0x3d73d1={};_0x3d73d1['model']=_[_0x4cdf('0x37')](db[_0x4cdf('0x43')]['rawAttributes']);_0x3d73d1[_0x4cdf('0x36')]=_[_0x4cdf('0x37')](_0x4661a8['query']);_0x3d73d1[_0x4cdf('0x40')]=_['intersection'](_0x3d73d1[_0x4cdf('0x35')],_0x3d73d1[_0x4cdf('0x36')]);_0x44ab63[_0x4cdf('0x39')]=_[_0x4cdf('0x38')](_0x3d73d1[_0x4cdf('0x35')],qs['fields'](_0x4661a8[_0x4cdf('0x36')][_0x4cdf('0x3a')]));_0x44ab63[_0x4cdf('0x39')]=_0x44ab63[_0x4cdf('0x39')]['length']?_0x44ab63['attributes']:_0x3d73d1[_0x4cdf('0x35')];if(_0x4661a8['query'][_0x4cdf('0x44')]){_0x44ab63[_0x4cdf('0x47')]=[{'all':!![]}];}_0x44ab63=_[_0x4cdf('0x42')]({},_0x44ab63,_0x4661a8['options']);return db['SmsApplication'][_0x4cdf('0x48')](_0x44ab63)['then'](handleEntityNotFound(_0x5251fc,null))[_0x4cdf('0x28')](respondWithResult(_0x5251fc,null))[_0x4cdf('0x49')](handleError(_0x5251fc,null));};exports['create']=function(_0x410d39,_0x5306da){return db['SmsApplication'][_0x4cdf('0x4a')](_0x410d39[_0x4cdf('0x4b')],{})[_0x4cdf('0x28')](respondWithResult(_0x5306da,0xc9))[_0x4cdf('0x49')](handleError(_0x5306da,null));};exports[_0x4cdf('0x27')]=function(_0x53ea7c,_0x3c7eb4){if(_0x53ea7c[_0x4cdf('0x4b')]['id']){delete _0x53ea7c['body']['id'];}return db[_0x4cdf('0x43')]['find']({'where':{'id':_0x53ea7c[_0x4cdf('0x4c')]['id']}})[_0x4cdf('0x28')](handleEntityNotFound(_0x3c7eb4,null))['then'](saveUpdates(_0x53ea7c[_0x4cdf('0x4b')],null))['then'](respondWithResult(_0x3c7eb4,null))[_0x4cdf('0x49')](handleError(_0x3c7eb4,null));};exports[_0x4cdf('0x29')]=function(_0x45ea97,_0x1ab073){return db[_0x4cdf('0x43')][_0x4cdf('0x48')]({'where':{'id':_0x45ea97[_0x4cdf('0x4c')]['id']}})[_0x4cdf('0x28')](handleEntityNotFound(_0x1ab073,null))[_0x4cdf('0x28')](removeEntity(_0x1ab073,null))[_0x4cdf('0x49')](handleError(_0x1ab073,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b789710..df7be6c 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 _0xf4e5=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications'];(function(_0x9cd194,_0x2bd0e3){var _0x1950fe=function(_0x1353da){while(--_0x1353da){_0x9cd194['push'](_0x9cd194['shift']());}};_0x1950fe(++_0x2bd0e3);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x4c716c,_0x41588c){_0x4c716c=_0x4c716c-0x0;var _0x305dd9=_0xf4e5[_0x4c716c];return _0x305dd9;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var logger=require(_0x5f4e('0x2'))(_0x5f4e('0x3'));var moment=require(_0x5f4e('0x4'));var BPromise=require(_0x5f4e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f4e('0x6'));var config=require(_0x5f4e('0x7'));var attributes=require(_0x5f4e('0x8'));module['exports']=function(_0x1cff58,_0x44e9e4){return _0x1cff58[_0x5f4e('0x9')](_0x5f4e('0xa'),attributes,{'tableName':_0x5f4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f4e('0xc'),'collate':_0x5f4e('0xd')});}; \ No newline at end of file +var _0x2fac=['exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x2fac,0x1a5));var _0xc2fa=function(_0x2e5f47,_0x5c6f40){_0x2e5f47=_0x2e5f47-0x0;var _0x4b9b30=_0x2fac[_0x2e5f47];return _0x4b9b30;};'use strict';var _=require(_0xc2fa('0x0'));var util=require(_0xc2fa('0x1'));var logger=require(_0xc2fa('0x2'))(_0xc2fa('0x3'));var moment=require(_0xc2fa('0x4'));var BPromise=require(_0xc2fa('0x5'));var rp=require(_0xc2fa('0x6'));var fs=require('fs');var path=require(_0xc2fa('0x7'));var rimraf=require(_0xc2fa('0x8'));var config=require(_0xc2fa('0x9'));var attributes=require(_0xc2fa('0xa'));module[_0xc2fa('0xb')]=function(_0x356c25,_0x39d0c3){return _0x356c25[_0xc2fa('0xc')](_0xc2fa('0xd'),attributes,{'tableName':_0xc2fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc2fa('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ff37ce6..6412a1c 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 _0x186d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x186d,0x1ca));var _0xd186=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x186d[_0x48b5e0];return _0x4287ea;};'use strict';var _=require('lodash');var util=require(_0xd186('0x0'));var moment=require(_0xd186('0x1'));var BPromise=require(_0xd186('0x2'));var rs=require(_0xd186('0x3'));var fs=require('fs');var Redis=require(_0xd186('0x4'));var db=require(_0xd186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd186('0x6'))(_0xd186('0x7'));var config=require(_0xd186('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd186('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x60fc96,_0x2ecccd,_0x4970a3){return new BPromise(function(_0x36fdc3,_0xd76bc8){return client[_0xd186('0xa')](_0x60fc96,_0x4970a3)['then'](function(_0x1ef64a){logger[_0xd186('0xb')](_0xd186('0xc'),_0x2ecccd,_0xd186('0xd'));logger[_0xd186('0xe')](_0xd186('0xf'),_0x2ecccd,'request\x20sent',JSON['stringify'](_0x1ef64a));if(_0x1ef64a[_0xd186('0x10')]){if(_0x1ef64a['error'][_0xd186('0x11')]===0x1f4){logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x1ef64a['error'][_0xd186('0x12')]);return _0xd76bc8(_0x1ef64a['error'][_0xd186('0x12')]);}logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x1ef64a[_0xd186('0x10')][_0xd186('0x12')]);return _0x36fdc3(_0x1ef64a[_0xd186('0x10')][_0xd186('0x12')]);}else{logger[_0xd186('0xb')](_0xd186('0xc'),_0x2ecccd,_0xd186('0xd'));_0x36fdc3(_0x1ef64a[_0xd186('0x13')]['message']);}})[_0xd186('0x14')](function(_0x94b224){logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x94b224);_0xd76bc8(_0x94b224);});});} \ No newline at end of file +var _0xa456=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xa456,0x142));var _0x6a45=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa456[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('SmsApplication,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f4ae9d8..1326de9 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 _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x58025a,_0x1f4ae9){var _0x2d89bc=function(_0x2952d9){while(--_0x2952d9){_0x58025a['push'](_0x58025a['shift']());}};_0x2d89bc(++_0x1f4ae9);}(_0x6324,0x142));var _0x4632=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x6324[_0x421e36];return _0x20b3e3;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file +var _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x358cd7,_0x2b1d6e){_0x358cd7=_0x358cd7-0x0;var _0x34c4c0=_0x4483[_0x358cd7];return _0x34c4c0;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f7d1ca9..4a0feb0 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 _0x9a14=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a14,0xa8));var _0x49a1=function(_0xf8ba59,_0x26eb0a){_0xf8ba59=_0xf8ba59-0x0;var _0x4a31cc=_0x9a14[_0xf8ba59];return _0x4a31cc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x49a1('0x0')]={'closed':{'type':Sequelize[_0x49a1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x49a1('0x2')]},'disposition':{'type':Sequelize[_0x49a1('0x3')]},'secondDisposition':{'type':Sequelize[_0x49a1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x49a1('0x3')]},'note':{'type':Sequelize[_0x49a1('0x3')]},'phone':{'type':Sequelize[_0x49a1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x49a1('0x4')]('in',_0x49a1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x49a1('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x43fd=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x310766,_0x225f39){var _0x4db545=function(_0x386323){while(--_0x386323){_0x310766['push'](_0x310766['shift']());}};_0x4db545(++_0x225f39);}(_0x43fd,0x1ec));var _0xd43f=function(_0x593a56,_0x414a16){_0x593a56=_0x593a56-0x0;var _0x102320=_0x43fd[_0x593a56];return _0x102320;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd43f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd43f('0x1')]},'disposition':{'type':Sequelize[_0xd43f('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd43f('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd43f('0x2')]},'read1stAt':{'type':Sequelize[_0xd43f('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xd43f('0x3')]('in',_0xd43f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd43f('0x3')]('in',_0xd43f('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd43f('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2273b47..642f4e4 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 _0x0cfa=['SmsInteraction','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','o.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','rows','show','params','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','spread','Tag','emit','smsInteractionTags:save','removeTags','download','root','files','tmp','attachments','join','transcript-%d-%s.zip','User','fullname','CmContact','firstName','Messages','get','mkdirSync','Sms','Account','Owner','closedAt','disposition','direction','out','System','lastName','secret','renderFile','server','views','downloadInteraction.ejs','createPdfFromHTML','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','stack','name','Users','map','Tags','TagIds','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index'];(function(_0x510bd8,_0x46c1e6){var _0xcd6e09=function(_0x4adabe){while(--_0x4adabe){_0x510bd8['push'](_0x510bd8['shift']());}};_0xcd6e09(++_0x46c1e6);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x5c46ee,_0x1b0c4d){_0x5c46ee=_0x5c46ee-0x0;var _0x399890=_0x0cfa[_0x5c46ee];return _0x399890;};'use strict';var emlformat=require(_0xa0cf('0x0'));var rimraf=require(_0xa0cf('0x1'));var zipdir=require(_0xa0cf('0x2'));var jsonpatch=require(_0xa0cf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa0cf('0x4'));var util=require('util');var path=require(_0xa0cf('0x5'));var sox=require(_0xa0cf('0x6'));var csv=require(_0xa0cf('0x7'));var ejs=require(_0xa0cf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0cf('0x9'));var squel=require('squel');var crypto=require(_0xa0cf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa0cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa0cf('0xc'));var Papa=require(_0xa0cf('0xd'));var Redis=require(_0xa0cf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa0cf('0xf'));var as=require(_0xa0cf('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0cf('0x11'))(_0xa0cf('0x12'));var utils=require(_0xa0cf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa0cf('0x14'));var db=require(_0xa0cf('0x15'))['db'];config[_0xa0cf('0x16')]=_[_0xa0cf('0x17')](config[_0xa0cf('0x16')],{'host':_0xa0cf('0x18'),'port':0x18eb});var socket=require(_0xa0cf('0x19'))(new Redis(config['redis']));require(_0xa0cf('0x1a'))[_0xa0cf('0x1b')](socket);function respondWithStatusCode(_0x219f1e,_0x4848ed){_0x4848ed=_0x4848ed||0xcc;return function(_0x1e8234){if(_0x1e8234){return _0x219f1e[_0xa0cf('0x1c')](_0x4848ed);}return _0x219f1e[_0xa0cf('0x1d')](_0x4848ed)[_0xa0cf('0x1e')]();};}function respondWithResult(_0x31951b,_0x4cbe8a){_0x4cbe8a=_0x4cbe8a||0xc8;return function(_0x19e263){if(_0x19e263){return _0x31951b[_0xa0cf('0x1d')](_0x4cbe8a)['json'](_0x19e263);}};}function respondWithFilteredResult(_0x351038,_0x36c524){return function(_0x53a186){if(_0x53a186){var _0x112ced=typeof _0x36c524[_0xa0cf('0x1f')]===_0xa0cf('0x20')&&typeof _0x36c524[_0xa0cf('0x21')]===_0xa0cf('0x20');var _0x8bb2ab=_0x53a186['count'];var _0x3a57b0=_0x112ced?0x0:_0x36c524[_0xa0cf('0x1f')];var _0x3551df=_0x112ced?_0x53a186[_0xa0cf('0x22')]:_0x36c524[_0xa0cf('0x1f')]+_0x36c524[_0xa0cf('0x21')];var _0xc516be;if(_0x3551df>=_0x8bb2ab){_0x3551df=_0x8bb2ab;_0xc516be=0xc8;}else{_0xc516be=0xce;}_0x351038[_0xa0cf('0x1d')](_0xc516be);return _0x351038[_0xa0cf('0x23')](_0xa0cf('0x24'),_0x3a57b0+'-'+_0x3551df+'/'+_0x8bb2ab)[_0xa0cf('0x25')](_0x53a186);}return null;};}function patchUpdates(_0x49c107){return function(_0x5f275c){try{jsonpatch['apply'](_0x5f275c,_0x49c107,!![]);}catch(_0x555973){return BPromise['reject'](_0x555973);}return _0x5f275c[_0xa0cf('0x26')]();};}function saveUpdates(_0x30070e,_0x5ce4bd){return function(_0x21fc4e){if(_0x21fc4e){return _0x21fc4e[_0xa0cf('0x27')](_0x30070e)[_0xa0cf('0x28')](function(_0x1a9e25){return _0x1a9e25;});}return null;};}function removeEntity(_0x5a39f9,_0x180722){return function(_0x3f03ff){if(_0x3f03ff){return _0x3f03ff['destroy']()['then'](function(){_0x5a39f9[_0xa0cf('0x1d')](0xcc)[_0xa0cf('0x1e')]();});}};}function handleEntityNotFound(_0x432b5,_0x3d78f0){return function(_0x36ce2b){if(!_0x36ce2b){_0x432b5[_0xa0cf('0x1c')](0x194);}return _0x36ce2b;};}function handleError(_0x4c36ed,_0x57b088){_0x57b088=_0x57b088||0x1f4;return function(_0x1ef1d4){logger['error'](_0x1ef1d4[_0xa0cf('0x29')]);if(_0x1ef1d4[_0xa0cf('0x2a')]){delete _0x1ef1d4[_0xa0cf('0x2a')];}_0x4c36ed[_0xa0cf('0x1d')](_0x57b088)['send'](_0x1ef1d4);};}function getInteractionUsers(_0x1b26ab,_0x285778){return new BPromise(function(_0x3f4fcf,_0x22e162){try{if(_0x285778[_0x1b26ab['id']]){_0x1b26ab[_0xa0cf('0x2b')]=_[_0xa0cf('0x2c')](_0x285778[_0x1b26ab['id']],function(_0x991102){return{'id':_0x991102['id'],'fullname':_0x991102['fullname']};});}}catch(_0x217649){_0x22e162(_0x217649);}_0x3f4fcf(_0x1b26ab);});}function getInteractionTags(_0x2e00ff,_0x5aeddc){return new BPromise(function(_0x304445,_0x1f6ad6){try{if(_0x2e00ff['TagIds']){_0x2e00ff[_0xa0cf('0x2d')]=[];_0x2e00ff[_0xa0cf('0x2e')]['split'](',')['forEach'](function(_0x2bef36){_0x2e00ff[_0xa0cf('0x2d')][_0xa0cf('0x2f')](_0x5aeddc[_0x2bef36]);});}delete _0x2e00ff[_0xa0cf('0x2e')];}catch(_0x355d26){_0x1f6ad6(_0x355d26);}_0x304445(_0x2e00ff);});}function updateSmsInteraction(_0x24cf22,_0x1b3ecd,_0x3049e9){return new BPromise(function(_0x489f1b,_0x1d04cd){return getInteractionUsers(_0x24cf22,_0x3049e9)[_0xa0cf('0x28')](function(_0x12edd1){return getInteractionTags(_0x12edd1,_0x1b3ecd);})[_0xa0cf('0x28')](function(_0x2bdc06){return getStateInteraction(_0x2bdc06);})['then'](function(_0x334c22){_0x489f1b(_0x334c22);})[_0xa0cf('0x30')](function(_0x4b247c){_0x1d04cd(_0x4b247c);});});}function getStateInteraction(_0x44b2b2){return new BPromise(function(_0x54c2c0){_0x44b2b2[_0xa0cf('0x31')]=0x0;_0x44b2b2[_0xa0cf('0x32')]=0x0;_0x44b2b2[_0xa0cf('0x33')]=0x0;_0x44b2b2[_0xa0cf('0x34')]=0x0;_0x44b2b2[_0xa0cf('0x35')]=0x0;if(!_0x44b2b2[_0xa0cf('0x36')]&&!_0x44b2b2[_0xa0cf('0x37')]){_0x44b2b2[_0xa0cf('0x31')]+=0x1;}if(!_0x44b2b2['closed']&&_0x44b2b2['UserId']){_0x44b2b2[_0xa0cf('0x32')]+=0x1;if(_0x44b2b2[_0xa0cf('0x31')]){_0x44b2b2[_0xa0cf('0x31')]-=0x1;}}if(_0x44b2b2[_0xa0cf('0x36')]&&_0x44b2b2['UserId']){_0x44b2b2[_0xa0cf('0x33')]+=0x1;if(_0x44b2b2[_0xa0cf('0x32')]){_0x44b2b2[_0xa0cf('0x32')]-=0x1;}}if(_0x44b2b2['closed']&&!_0x44b2b2[_0xa0cf('0x37')]){_0x44b2b2[_0xa0cf('0x34')]+=0x1;if(_0x44b2b2['waiting']){_0x44b2b2[_0xa0cf('0x31')]-=0x1;}}_0x44b2b2[_0xa0cf('0x35')]+=0x1;_0x54c2c0(_0x44b2b2);});}exports[_0xa0cf('0x38')]=function(_0x3f2b8e,_0x4cf2e1){var _0x1d3363={},_0x172c54={},_0x34a101={'count':0x0,'rows':[]};var _0x43ec67=_[_0xa0cf('0x2c')](db[_0xa0cf('0x39')][_0xa0cf('0x3a')],function(_0x2ad771){return{'name':_0x2ad771[_0xa0cf('0x3b')],'type':_0x2ad771['type']['key']};});_0x172c54[_0xa0cf('0x3c')]=_[_0xa0cf('0x2c')](_0x43ec67,_0xa0cf('0x2a'));_0x172c54['query']=_[_0xa0cf('0x3d')](_0x3f2b8e['query']);_0x172c54[_0xa0cf('0x3e')]=_[_0xa0cf('0x3f')](_0x172c54[_0xa0cf('0x3c')],_0x172c54[_0xa0cf('0x40')]);_0x1d3363[_0xa0cf('0x41')]=_[_0xa0cf('0x3f')](_0x172c54[_0xa0cf('0x3c')],qs[_0xa0cf('0x42')](_0x3f2b8e[_0xa0cf('0x40')]['fields']));_0x1d3363[_0xa0cf('0x41')]=_0x1d3363['attributes'][_0xa0cf('0x43')]?_0x1d3363[_0xa0cf('0x41')]:_0x172c54[_0xa0cf('0x3c')];if(!_0x3f2b8e[_0xa0cf('0x40')]['hasOwnProperty'](_0xa0cf('0x44'))){_0x1d3363['limit']=qs['limit'](_0x3f2b8e[_0xa0cf('0x40')]['limit']);_0x1d3363[_0xa0cf('0x1f')]=qs[_0xa0cf('0x1f')](_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x1f')]);}_0x1d3363[_0xa0cf('0x45')]=qs[_0xa0cf('0x46')](_0x3f2b8e['query']['sort']);_0x1d3363[_0xa0cf('0x47')]=qs[_0xa0cf('0x3e')](_[_0xa0cf('0x48')](_0x3f2b8e[_0xa0cf('0x40')],_0x172c54[_0xa0cf('0x3e')]),_0x43ec67);var _0x13778a=[];var _0x5572a3=squel[_0xa0cf('0x49')]()['field']('id')[_0xa0cf('0x4a')](_0xa0cf('0x2a'))[_0xa0cf('0x4a')](_0xa0cf('0x4b'))[_0xa0cf('0x4c')]('tools_tags');var _0x2ca1da=squel[_0xa0cf('0x49')]()['field'](_0xa0cf('0x4d'))[_0xa0cf('0x4a')](_0xa0cf('0x4e'))[_0xa0cf('0x4a')](_0xa0cf('0x4f'))[_0xa0cf('0x4c')](_0xa0cf('0x50'),'ui')['left_join'](_0xa0cf('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x252953=squel['select']()[_0xa0cf('0x4c')](_0xa0cf('0x52'),'i')[_0xa0cf('0x53')](_0xa0cf('0x54'),'c',_0xa0cf('0x55'))[_0xa0cf('0x53')](_0xa0cf('0x51'),'o','o.id\x20=\x20i.UserId')[_0xa0cf('0x53')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xa0cf('0x53')](_0xa0cf('0x56'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xa0cf('0x53')](_0xa0cf('0x57'),'it',_0xa0cf('0x58'))['left_join'](_0xa0cf('0x59'),'t',_0xa0cf('0x5a'));var _0x465340=squel[_0xa0cf('0x5b')]();var _0x474157=[];var _0x58b628=squel[_0xa0cf('0x5b')]();var _0x12a383;if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x5c')]){_0x12a383=as[_0xa0cf('0x5d')](_0x3f2b8e[_0xa0cf('0x40')]['search']);var _0x589d0b=_0x12a383['sqlOperator'];for(var _0x2cd33e=0x0;_0x2cd33e<_0x12a383[_0xa0cf('0x5e')][_0xa0cf('0x43')];_0x2cd33e++){var _0xcbf54d=_0x12a383[_0xa0cf('0x5e')][_0x2cd33e];var _0x376616='i';var _0x5beaa8=_[_0xa0cf('0x5f')](_0x43ec67,[_0xa0cf('0x2a'),_0xcbf54d[_0xa0cf('0x4a')]]);if(!_0x5beaa8){switch(_0xcbf54d[_0xa0cf('0x4a')]){case'unreadMessages':if(_0xcbf54d['value']==0x1){_0x252953[_0xa0cf('0x60')]('`'+_0xcbf54d[_0xa0cf('0x4a')]+_0xa0cf('0x61'));}else{_0x252953[_0xa0cf('0x60')]('`'+_0xcbf54d[_0xa0cf('0x4a')]+_0xa0cf('0x62'));}break;case _0xa0cf('0x63'):if(_0xcbf54d[_0xa0cf('0x64')]===_0xa0cf('0x65')){if(_0xcbf54d[_0xa0cf('0x66')][_0xa0cf('0x67')]('\x20')[_0xa0cf('0x43')]>0x1){_0x465340[_0x589d0b](_0xa0cf('0x68'),qs[_0xa0cf('0x69')](_0xcbf54d[_0xa0cf('0x66')]),null);}else{var _0x24798b='%'+_0xcbf54d[_0xa0cf('0x66')]+'%';_0x465340[_0x589d0b](_0xa0cf('0x6a'),_0x24798b,_0x24798b,_0x24798b);}}else{_0x5beaa8=_[_0xa0cf('0x5f')](_0x43ec67,[_0xa0cf('0x2a'),_0xa0cf('0x6b')]);_0xcbf54d[_0xa0cf('0x4a')]='ContactId';_0x270f76=as[_0xa0cf('0x6c')](_0x376616,_0x5beaa8[_0xa0cf('0x6d')],_0xcbf54d);_0x465340[_0x589d0b](_0x270f76[_0xa0cf('0x6e')],_0x270f76[_0xa0cf('0x66')][_0xa0cf('0x6f')],_0x270f76[_0xa0cf('0x66')]['end']);}break;case'Tag':var _0x585e3d=_0xcbf54d['value'][_0xa0cf('0x67')](',')[_0xa0cf('0x2c')](function(_0x57a61e){return Number(_0x57a61e);});_0x585e3d[_0xa0cf('0x70')](function(_0x4cd7b8){_0x58b628['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4cd7b8+',%');});_0x474157=_[_0xa0cf('0x71')](_0x474157,_0x585e3d);break;case'User':if(_0xcbf54d[_0xa0cf('0x64')]===_0xa0cf('0x65')){_0x465340[_0x589d0b](_0xa0cf('0x72'),'%'+_0xcbf54d[_0xa0cf('0x66')]+'%',null);}else{_0x5beaa8=_[_0xa0cf('0x5f')](_0x43ec67,['name','UserId']);_0xcbf54d[_0xa0cf('0x4a')]='UserId';_0x270f76=as[_0xa0cf('0x6c')](_0x376616,_0x5beaa8[_0xa0cf('0x6d')],_0xcbf54d);_0x465340[_0x589d0b](_0x270f76[_0xa0cf('0x6e')],_0x270f76[_0xa0cf('0x66')]['start'],_0x270f76[_0xa0cf('0x66')][_0xa0cf('0x1e')]);}break;case _0xa0cf('0x73'):_0x270f76=as[_0xa0cf('0x6c')]('me',null,_0xcbf54d);_0x465340[_0x589d0b](_0x270f76[_0xa0cf('0x6e')],_0x270f76['value']['start'],_0x270f76[_0xa0cf('0x66')][_0xa0cf('0x1e')]);break;}}else{var _0x270f76=as[_0xa0cf('0x6c')](_0x376616,_0x5beaa8[_0xa0cf('0x6d')],_0xcbf54d);_0x465340[_0x589d0b](_0x270f76['text'],_0x270f76[_0xa0cf('0x66')][_0xa0cf('0x6f')],_0x270f76[_0xa0cf('0x66')][_0xa0cf('0x1e')]);}}}else{var _0x4c54ea=_(_0x3f2b8e[_0xa0cf('0x40')])['keys']()['map'](function(_0x5d63e5){return _[_0xa0cf('0x74')](_0x43ec67,[_0xa0cf('0x2a'),_0x5d63e5])?_0x5d63e5:undefined;})[_0xa0cf('0x75')]()[_0xa0cf('0x66')]();if(!_['isEmpty'](_0x4c54ea)){_0x4c54ea[_0xa0cf('0x70')](function(_0x5aadf5){if(_0x5aadf5===_0xa0cf('0x76')){_0x252953[_0xa0cf('0x47')](_0xa0cf('0x77'),[]['concat'](_0x3f2b8e[_0xa0cf('0x40')][_0x5aadf5]));}else if(_0x5aadf5===_0xa0cf('0x78')){var _0x9418e8=JSON[_0xa0cf('0x79')](_0x3f2b8e[_0xa0cf('0x40')][_0x5aadf5])['$gte'];var _0xa63d53=JSON[_0xa0cf('0x79')](_0x3f2b8e[_0xa0cf('0x40')][_0x5aadf5])['$lte'];_0x252953[_0xa0cf('0x47')](_0xa0cf('0x7a'),_0x9418e8,_0xa63d53);}else{if(_0x3f2b8e[_0xa0cf('0x40')][_0x5aadf5]===_0xa0cf('0x7b')){_0x252953[_0xa0cf('0x47')]('i.'+_0x5aadf5+'\x20IS\x20NULL');}else{_0x252953['where']('i.'+_0x5aadf5+_0xa0cf('0x7c'),_0x3f2b8e[_0xa0cf('0x40')][_0x5aadf5]);}}});}if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x7d')]){if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x7d')]==0x1){_0x252953[_0xa0cf('0x60')]('`unreadMessages`\x20=\x200');}else{_0x252953['having'](_0xa0cf('0x7e'));}}if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x7f')]){_0x474157=_[_0xa0cf('0x80')](_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x7f')])?_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x7f')]:new Array(_0x3f2b8e['query'][_0xa0cf('0x7f')]);_0x474157[_0xa0cf('0x70')](function(_0x1b2840){_0x58b628['or'](_0xa0cf('0x81'),'%,'+_0x1b2840+',%');});}if(_0x3f2b8e[_0xa0cf('0x40')]['filter']){var _0x210216=_0x3f2b8e[_0xa0cf('0x40')]['filter'][_0xa0cf('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa0cf('0x83')](_0x210216)){_0x465340['or'](_0xa0cf('0x84'),_0x210216+'%')['or'](_0xa0cf('0x85'),_0x210216+'%');}else{_0x465340['or'](_0xa0cf('0x86'),qs['getFullTextValue'](_0x210216))['or'](_0xa0cf('0x87'),_0x210216+'%');}}}_0x252953[_0xa0cf('0x47')](_0x465340);_0x252953[_0xa0cf('0x88')]('i.id');var _0x400a9f={'type':db[_0xa0cf('0x89')][_0xa0cf('0x8a')][_0xa0cf('0x8b')],'raw':!![]};var _0x4676a2=_0x252953[_0xa0cf('0x8c')]();_0x4676a2[_0xa0cf('0x4a')](_0xa0cf('0x8d'));_0x4676a2[_0xa0cf('0x4a')](_0xa0cf('0x8e'),_0xa0cf('0x8f'));if(_0x1d3363[_0xa0cf('0x45')]){_0x1d3363[_0xa0cf('0x45')][_0xa0cf('0x70')](function(_0x448096){var _0xa31aaa=_0x448096[0x0]===_0xa0cf('0x90')?_0x448096[0x0]:'i.'+_0x448096[0x0];_0x252953[_0xa0cf('0x45')](_0xa31aaa,_0x448096[0x1]===_0xa0cf('0x91')?![]:!![]);});}if(!_[_0xa0cf('0x92')](_0x474157)){_0x252953[_0xa0cf('0x60')](_0x58b628);_0x4676a2[_0xa0cf('0x47')]('t.id\x20IN\x20?',_0x474157);}BPromise[_0xa0cf('0x93')]()['then'](function(){if(!_0x12a383){if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x76')])return;_0x4676a2['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x252953[_0xa0cf('0x47')](_0xa0cf('0x94'));return;}if(_0x3f2b8e['user']['role']!==_0xa0cf('0x95'))return;return _0x3f2b8e[_0xa0cf('0x96')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x24f4c9){if(_[_0xa0cf('0x92')](_0x24f4c9)){_0x4676a2[_0xa0cf('0x47')](_0xa0cf('0x97'));_0x252953[_0xa0cf('0x47')](_0xa0cf('0x97'));}else{_0x4676a2['where'](_0xa0cf('0x77'),_[_0xa0cf('0x2c')](_0x24f4c9,'id'));_0x252953[_0xa0cf('0x47')](_0xa0cf('0x77'),_['map'](_0x24f4c9,'id'));}});})[_0xa0cf('0x28')](function(){if(_0x3f2b8e['user'][_0xa0cf('0x98')]===_0xa0cf('0x95')&&!_0x12a383&&!_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x76')])return[];return db[_0xa0cf('0x99')][_0xa0cf('0x40')](_0x4676a2[_0xa0cf('0x9a')](),_0x400a9f);})[_0xa0cf('0x28')](function(_0x47a115){_0x34a101['count']=_0x47a115['length'];if(_0x34a101['count']===0x0)return[];return db[_0xa0cf('0x99')][_0xa0cf('0x40')](_0x5572a3[_0xa0cf('0x9a')](),_0x400a9f)[_0xa0cf('0x28')](function(_0x23a5e8){_0x13778a=_[_0xa0cf('0x9b')](_0x23a5e8,'id');_0x400a9f=_[_0xa0cf('0x9c')](_0x400a9f,{'model':db[_0xa0cf('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f2b8e[_0xa0cf('0x40')][_0xa0cf('0x42')]){_0x1d3363['attributes'][_0xa0cf('0x70')](function(_0x1e357d){_0x252953[_0xa0cf('0x4a')]('i.'+_0x1e357d);});}else{_0x252953['field'](_0xa0cf('0x8e'),_0xa0cf('0x8f'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0x9d'),_0xa0cf('0x9e'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0x9f'),_0xa0cf('0xa0'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xa1'),_0xa0cf('0x90'));_0x252953['field'](_0xa0cf('0xa2'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xa3'),'Contact.firstName');_0x252953[_0xa0cf('0x4a')]('c.lastName',_0xa0cf('0xa4'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xa5'),_0xa0cf('0xa6'));_0x252953[_0xa0cf('0x4a')]('c.phone',_0xa0cf('0xa7'));_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xa8'),_0xa0cf('0xa9'));_0x252953[_0xa0cf('0x4a')]('c.fax','Contact.fax');_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xaa'),'Owner.fullname');_0x252953[_0xa0cf('0x4a')](_0xa0cf('0xab'),'Owner.internal');_0x252953['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa0cf('0x2e'));}if(_0x1d3363[_0xa0cf('0x21')])_0x252953[_0xa0cf('0x21')](_0x1d3363[_0xa0cf('0x21')]);if(_0x1d3363[_0xa0cf('0x1f')])_0x252953[_0xa0cf('0x1f')](_0x1d3363[_0xa0cf('0x1f')]);return db[_0xa0cf('0x99')][_0xa0cf('0x40')](_0x252953[_0xa0cf('0x9a')](),_0x400a9f);})[_0xa0cf('0x28')](function(_0x30f4f1){if(_0x30f4f1[_0xa0cf('0x43')]>0x0)_0x2ca1da[_0xa0cf('0x47')](_0xa0cf('0xac'),_[_0xa0cf('0x2c')](_0x30f4f1,'id'));return db[_0xa0cf('0x99')][_0xa0cf('0x40')](_0x2ca1da[_0xa0cf('0x9a')](),_0x400a9f)['then'](function(_0x4862a4){var _0x560bda=_[_0xa0cf('0xad')](_0x4862a4,'SmsInteractionId');var _0x295ec3=[];_0x30f4f1['forEach'](function(_0x52619b){_0x295ec3[_0xa0cf('0x2f')](updateSmsInteraction(_0x52619b,_0x13778a,_0x560bda));});return BPromise['all'](_0x295ec3);});});})[_0xa0cf('0x28')](function(_0x112ff9){_0x34a101[_0xa0cf('0xae')]=_0x112ff9;return _0x34a101;})[_0xa0cf('0x28')](respondWithFilteredResult(_0x4cf2e1,_0x1d3363))[_0xa0cf('0x30')](handleError(_0x4cf2e1,null));};exports[_0xa0cf('0xaf')]=function(_0x3ec5da,_0x33d981){var _0x48aa3f={'raw':![],'where':{'id':_0x3ec5da[_0xa0cf('0xb0')]['id']}},_0x53704b={};_0x53704b[_0xa0cf('0x3c')]=_['keys'](db[_0xa0cf('0x39')][_0xa0cf('0x3a')]);_0x53704b[_0xa0cf('0x40')]=_[_0xa0cf('0x3d')](_0x3ec5da[_0xa0cf('0x40')]);_0x53704b[_0xa0cf('0x3e')]=_[_0xa0cf('0x3f')](_0x53704b[_0xa0cf('0x3c')],_0x53704b[_0xa0cf('0x40')]);_0x48aa3f[_0xa0cf('0x41')]=_[_0xa0cf('0x3f')](_0x53704b[_0xa0cf('0x3c')],qs[_0xa0cf('0x42')](_0x3ec5da['query'][_0xa0cf('0x42')]));_0x48aa3f[_0xa0cf('0x41')]=_0x48aa3f[_0xa0cf('0x41')][_0xa0cf('0x43')]?_0x48aa3f[_0xa0cf('0x41')]:_0x53704b[_0xa0cf('0x3c')];if(_0x3ec5da['query']['includeAll']){_0x48aa3f['include']=[{'all':!![]}];}_0x48aa3f=_[_0xa0cf('0x9c')]({},_0x48aa3f,_0x3ec5da[_0xa0cf('0xb1')]);return db['SmsInteraction'][_0xa0cf('0x5f')](_0x48aa3f)[_0xa0cf('0x28')](handleEntityNotFound(_0x33d981,null))[_0xa0cf('0x28')](respondWithResult(_0x33d981,null))['catch'](handleError(_0x33d981,null));};exports['create']=function(_0x33668a,_0x20b9c5){return db['SmsInteraction'][_0xa0cf('0xb2')](_0x33668a['body'],{})[_0xa0cf('0x28')](respondWithResult(_0x20b9c5,0xc9))[_0xa0cf('0x30')](handleError(_0x20b9c5,null));};exports[_0xa0cf('0x27')]=function(_0x238f2b,_0x527986){if(_0x238f2b[_0xa0cf('0x73')]['id']){delete _0x238f2b[_0xa0cf('0x73')]['id'];}return db[_0xa0cf('0x39')]['find']({'where':{'id':_0x238f2b[_0xa0cf('0xb0')]['id']}})[_0xa0cf('0x28')](handleEntityNotFound(_0x527986,null))[_0xa0cf('0x28')](saveUpdates(_0x238f2b['body'],null))[_0xa0cf('0x28')](respondWithResult(_0x527986,null))[_0xa0cf('0x30')](handleError(_0x527986,null));};exports['destroy']=function(_0x2ccf0e,_0x53947c){return db[_0xa0cf('0x39')][_0xa0cf('0x5f')]({'where':{'id':_0x2ccf0e['params']['id']}})[_0xa0cf('0x28')](handleEntityNotFound(_0x53947c,null))[_0xa0cf('0x28')](removeEntity(_0x53947c,null))[_0xa0cf('0x30')](handleError(_0x53947c,null));};exports['describe']=function(_0x350a5f,_0x4609ce){return db[_0xa0cf('0x39')][_0xa0cf('0xb3')]()[_0xa0cf('0x28')](respondWithResult(_0x4609ce,null))[_0xa0cf('0x30')](handleError(_0x4609ce,null));};exports[_0xa0cf('0xb4')]=function(_0x4c3374,_0x45822c,_0x17ac48){return db[_0xa0cf('0xb5')][_0xa0cf('0x5f')]({'where':{'id':_0x4c3374[_0xa0cf('0xb0')]['id']}})[_0xa0cf('0x28')](handleEntityNotFound(_0x45822c,null))['then'](function(_0xd60b6f){if(_0xd60b6f){return _0xd60b6f[_0xa0cf('0xb4')](_0x4c3374['body'][_0xa0cf('0xb6')],_[_0xa0cf('0xb7')](_0x4c3374['body'],[_0xa0cf('0xb6'),'id'])||{});}})[_0xa0cf('0x28')](respondWithResult(_0x45822c,null))[_0xa0cf('0x30')](handleError(_0x45822c,null));};exports[_0xa0cf('0xb8')]=function(_0x16eae1,_0x3a5a0c,_0x1bd0f4){var _0x22a22e={'raw':![],'where':{}};var _0x3450f4={};var _0x1710e7={'count':0x0,'rows':[]};return db[_0xa0cf('0x39')][_0xa0cf('0xb9')]({'where':{'id':_0x16eae1['params']['id']}})[_0xa0cf('0x28')](handleEntityNotFound(_0x3a5a0c,null))[_0xa0cf('0x28')](function(_0x3f088c){if(_0x3f088c){_0x3450f4[_0xa0cf('0x3c')]=_['keys'](db[_0xa0cf('0xb5')]['rawAttributes']);_0x3450f4[_0xa0cf('0x40')]=_[_0xa0cf('0x3d')](_0x16eae1[_0xa0cf('0x40')]);_0x3450f4[_0xa0cf('0x3e')]=_[_0xa0cf('0x3f')](_0x3450f4[_0xa0cf('0x3c')],_0x3450f4[_0xa0cf('0x40')]);_0x22a22e[_0xa0cf('0x41')]=_[_0xa0cf('0x3f')](_0x3450f4['model'],qs['fields'](_0x16eae1[_0xa0cf('0x40')]['fields']));_0x22a22e['attributes']=_0x22a22e[_0xa0cf('0x41')][_0xa0cf('0x43')]?_0x22a22e[_0xa0cf('0x41')]:_0x3450f4[_0xa0cf('0x3c')];if(!_0x16eae1['query'][_0xa0cf('0xba')](_0xa0cf('0x44'))){_0x22a22e['limit']=qs[_0xa0cf('0x21')](_0x16eae1['query'][_0xa0cf('0x21')]);_0x22a22e[_0xa0cf('0x1f')]=qs[_0xa0cf('0x1f')](_0x16eae1[_0xa0cf('0x40')][_0xa0cf('0x1f')]);}_0x22a22e[_0xa0cf('0x45')]=qs[_0xa0cf('0x46')](_0x16eae1[_0xa0cf('0x40')][_0xa0cf('0x46')]);_0x22a22e[_0xa0cf('0x47')]=qs['filters'](_[_0xa0cf('0x48')](_0x16eae1[_0xa0cf('0x40')],_0x3450f4['filters']));_0x22a22e[_0xa0cf('0x47')]['SmsInteractionId']=_0x3f088c['id'];if(_0x16eae1[_0xa0cf('0x40')][_0xa0cf('0xbb')]){_0x22a22e[_0xa0cf('0x47')]=_[_0xa0cf('0x9c')](_0x22a22e[_0xa0cf('0x47')],{'$or':_[_0xa0cf('0x2c')](_0x22a22e[_0xa0cf('0x41')],function(_0x10609c){var _0x4f5fee={};_0x4f5fee[_0x10609c]={'$like':'%'+_0x16eae1['query'][_0xa0cf('0xbb')]+'%'};return _0x4f5fee;})});}if(_0x16eae1['query'][_0xa0cf('0xbc')]){var _0xbda535=_0x16eae1['query']['$gte'][_0xa0cf('0x67')](',');var _0x2cccb5={};_0x2cccb5[_0xbda535[0x0]]={'$gte':moment(_0xbda535[0x1])[_0xa0cf('0xbd')](_0xa0cf('0xbe'))};_0x22a22e[_0xa0cf('0x47')]=_[_0xa0cf('0x9c')](_0x22a22e[_0xa0cf('0x47')],_0x2cccb5);}_0x22a22e=_[_0xa0cf('0x9c')]({},_0x22a22e,_0x16eae1[_0xa0cf('0xb1')]);return db[_0xa0cf('0xb5')][_0xa0cf('0x22')]({'where':_0x22a22e[_0xa0cf('0x47')]})[_0xa0cf('0x28')](function(_0x434e34){_0x1710e7[_0xa0cf('0x22')]=_0x434e34;if(_0x16eae1[_0xa0cf('0x40')][_0xa0cf('0xbf')]){_0x22a22e[_0xa0cf('0xc0')]=[{'all':!![]}];}return db[_0xa0cf('0xb5')][_0xa0cf('0xc1')](_0x22a22e);})[_0xa0cf('0x28')](function(_0x5f2808){_0x1710e7[_0xa0cf('0xae')]=_0x5f2808;return _0x1710e7;});}})[_0xa0cf('0x28')](respondWithFilteredResult(_0x3a5a0c,_0x22a22e))['catch'](handleError(_0x3a5a0c,null));};exports['addTags']=function(_0x4d9126,_0x30b066,_0x13184e){return db[_0xa0cf('0x39')][_0xa0cf('0x5f')]({'where':{'id':_0x4d9126[_0xa0cf('0xb0')]['id']}})[_0xa0cf('0x28')](handleEntityNotFound(_0x30b066,null))['then'](function(_0x1424f0){if(_0x1424f0){return _0x1424f0['setTags'](_0x4d9126[_0xa0cf('0x73')][_0xa0cf('0xb6')],_[_0xa0cf('0xb7')](_0x4d9126['body'],['ids','id'])||{})[_0xa0cf('0xc2')](function(){return db[_0xa0cf('0xc3')][_0xa0cf('0xc1')]({'attributes':['id','name',_0xa0cf('0x4b')],'where':{'id':_0x4d9126['body']['ids']}});})[_0xa0cf('0x28')](function(_0x3e77f4){socket[_0xa0cf('0xc4')](_0xa0cf('0xc5'),{'id':Number(_0x4d9126[_0xa0cf('0xb0')]['id']),'tags':_0x3e77f4||[]});return{'id':Number(_0x4d9126[_0xa0cf('0xb0')]['id']),'tags':_0x3e77f4||[]};});}})[_0xa0cf('0x28')](respondWithResult(_0x30b066,null))['catch'](handleError(_0x30b066,null));};exports[_0xa0cf('0xc6')]=function(_0x432135,_0x84740e,_0x209898){return db['SmsInteraction'][_0xa0cf('0x5f')]({'where':{'id':_0x432135[_0xa0cf('0xb0')]['id']}})['then'](handleEntityNotFound(_0x84740e,null))[_0xa0cf('0x28')](function(_0x2e37fe){if(_0x2e37fe){return _0x2e37fe['removeTags'](_0x432135[_0xa0cf('0x40')][_0xa0cf('0xb6')]);}})[_0xa0cf('0x28')](respondWithStatusCode(_0x84740e,null))[_0xa0cf('0x30')](handleError(_0x84740e,null));};exports[_0xa0cf('0xc7')]=function(_0x153513,_0x596b9b){var _0x493cd3=moment()['unix']()[_0xa0cf('0x9a')]();var _0x510b0d=path['join'](config[_0xa0cf('0xc8')],'server',_0xa0cf('0xc9'),_0xa0cf('0xca'));var _0x3a4ec5=path['join'](config[_0xa0cf('0xc8')],'server',_0xa0cf('0xc9'),_0xa0cf('0xcb'));var _0x1af64f=path[_0xa0cf('0xcc')](_0x510b0d,_0x493cd3);var _0x164393=util['format'](_0xa0cf('0xcd'),_0x153513[_0xa0cf('0xb0')]['id'],_0x493cd3);var _0x56cad0=path[_0xa0cf('0xcc')](_0x510b0d,_0x164393);var _0x3fb8ee=[];_0x3fb8ee[_0xa0cf('0x2f')]({'model':db['User'],'as':_0xa0cf('0xce'),'attributes':['id',_0xa0cf('0xcf')],'raw':!![]});_0x3fb8ee[_0xa0cf('0x2f')]({'model':db[_0xa0cf('0xd0')],'as':_0xa0cf('0x63'),'attributes':['id',_0xa0cf('0xd1'),'lastName'],'raw':!![]});var _0x2ad78d=[{'model':db[_0xa0cf('0xb5')],'as':_0xa0cf('0xd2'),'attributes':['id',_0xa0cf('0x73'),_0xa0cf('0x78'),'direction','secret',_0xa0cf('0x7d')],'include':_0x3fb8ee}];_0x2ad78d['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xa0cf('0x2a')]});_0x2ad78d[_0xa0cf('0x2f')]({'model':db[_0xa0cf('0xce')],'as':'Owner','attributes':['id',_0xa0cf('0xcf')]});return db[_0xa0cf('0x39')]['find']({'where':{'id':_0x153513[_0xa0cf('0xb0')]['id']},'include':_0x2ad78d})[_0xa0cf('0x28')](handleEntityNotFound(_0x596b9b,null))[_0xa0cf('0x28')](function(_0x11807f){if(_0x11807f){var _0x48d7c5=_0x11807f[_0xa0cf('0xd3')]({'plain':!![]});fs[_0xa0cf('0xd4')](_0x1af64f);var _0x45adf0={'channel':_0xa0cf('0xd5'),'account':_0x48d7c5[_0xa0cf('0xd6')][_0xa0cf('0x2a')],'agent':_0x48d7c5[_0xa0cf('0xd7')]?_0x48d7c5[_0xa0cf('0xd7')][_0xa0cf('0xcf')]:'N.A.','createdAt':moment(_0x48d7c5['createdAt'])[_0xa0cf('0xbd')](_0xa0cf('0xbe'))[_0xa0cf('0x9a')](),'closedAt':_0x48d7c5[_0xa0cf('0x36')]?moment(_0x48d7c5[_0xa0cf('0xd8')])['format'](_0xa0cf('0xbe'))[_0xa0cf('0x9a')]():'','disposition':_0x48d7c5[_0xa0cf('0xd9')],'messages':_(_0x48d7c5[_0xa0cf('0xd2')])[_0xa0cf('0xbb')]({'secret':![]})[_0xa0cf('0x2c')](function(_0x51e696){return{'date':moment(_0x51e696[_0xa0cf('0x78')])[_0xa0cf('0xbd')](_0xa0cf('0xbe'))[_0xa0cf('0x9a')](),'sender':_0x51e696[_0xa0cf('0xda')]===_0xa0cf('0xdb')?_0x51e696[_0xa0cf('0xce')]?_0x51e696[_0xa0cf('0xce')][_0xa0cf('0xcf')]:_0xa0cf('0xdc'):_0x51e696[_0xa0cf('0x63')]['firstName']+(_0x51e696[_0xa0cf('0x63')][_0xa0cf('0xdd')]?'\x20'+_0x51e696[_0xa0cf('0x63')][_0xa0cf('0xdd')]:''),'body':_0x51e696['body'],'direction':_0x51e696['direction']===_0xa0cf('0xdb')?'A':'C','secret':_0x51e696[_0xa0cf('0xde')],'read':_0x51e696[_0xa0cf('0x7d')]};})[_0xa0cf('0x66')]()};return ejs[_0xa0cf('0xdf')](path[_0xa0cf('0xcc')](config[_0xa0cf('0xc8')],_0xa0cf('0xe0'),_0xa0cf('0xe1'),_0xa0cf('0xe2')),{'interaction':_0x45adf0})[_0xa0cf('0x28')](function(_0x53bd3e){var _0x3acbf2=path[_0xa0cf('0xcc')](_0x1af64f,'transcript-'+_0x48d7c5['id']+'-'+_0x493cd3+'.pdf');var _0x453227={'path':_0x3acbf2,'channel':'Sms','interactionId':_0x48d7c5['id']};return pdf[_0xa0cf('0xe3')](_0x53bd3e,_0x453227);})[_0xa0cf('0x28')](function(){return new BPromise(function(_0x4abe19,_0x1b13c1){zipdir(_0x1af64f,{'saveTo':_0x56cad0},function(_0x31821b,_0x1f37f1){if(_0x31821b)return _0x1b13c1(_0x31821b);return _0x4abe19(_0x1f37f1);});})[_0xa0cf('0x28')](function(){return new BPromise(function(_0x222b42,_0x5952ef){rimraf(_0x1af64f,function(_0x522a4e){if(_0x522a4e)_0x5952ef(_0x522a4e);return _0x222b42();});});})[_0xa0cf('0x28')](function(){return _0x596b9b['download'](_0x56cad0,_0x164393,function(_0x17b0a4){if(_0x17b0a4){console['log']('err',_0x17b0a4);}else{fs['unlinkSync'](_0x56cad0);}});});});}else{return _0x596b9b[_0xa0cf('0x1c')](0xc8);}})['catch'](handleError(_0x596b9b,null));}; \ No newline at end of file +var _0x5e16=['secret','renderFile','root','downloadInteraction.ejs','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','defaults','localhost','./smsInteraction.socket','register','status','json','undefined','count','offset','limit','reject','save','update','then','end','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','waiting','answered','unmanaged','total','UserId','closed','talking','index','SmsInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','select','field','color','u.id','u.fullname','from','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','forEach','SmsAccountId','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','includeAll','include','options','create','params','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','pick','format','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','server','tmp','join','files','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','Owner','get','mkdirSync','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','System'];(function(_0x59b03e,_0x39defa){var _0xcda858=function(_0x35fb6a){while(--_0x35fb6a){_0x59b03e['push'](_0x59b03e['shift']());}};_0xcda858(++_0x39defa);}(_0x5e16,0xf7));var _0x65e1=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x5e16[_0x427217];return _0x5b28fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65e1('0x0'));var zipdir=require(_0x65e1('0x1'));var jsonpatch=require(_0x65e1('0x2'));var rp=require(_0x65e1('0x3'));var moment=require(_0x65e1('0x4'));var BPromise=require(_0x65e1('0x5'));var Mustache=require(_0x65e1('0x6'));var util=require(_0x65e1('0x7'));var path=require(_0x65e1('0x8'));var sox=require(_0x65e1('0x9'));var csv=require(_0x65e1('0xa'));var ejs=require(_0x65e1('0xb'));var fs=require('fs');var fs_extra=require(_0x65e1('0xc'));var _=require(_0x65e1('0xd'));var squel=require(_0x65e1('0xe'));var crypto=require('crypto');var jsforce=require(_0x65e1('0xf'));var deskjs=require(_0x65e1('0x10'));var toCsv=require(_0x65e1('0xa'));var querystring=require(_0x65e1('0x11'));var Papa=require(_0x65e1('0x12'));var Redis=require(_0x65e1('0x13'));var authService=require(_0x65e1('0x14'));var qs=require(_0x65e1('0x15'));var as=require(_0x65e1('0x16'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x65e1('0x17'));var config=require(_0x65e1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x65e1('0x19')]=_[_0x65e1('0x1a')](config[_0x65e1('0x19')],{'host':_0x65e1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x65e1('0x1c'))[_0x65e1('0x1d')](socket);function respondWithStatusCode(_0x5457eb,_0x1e48fb){_0x1e48fb=_0x1e48fb||0xcc;return function(_0x2b8b93){if(_0x2b8b93){return _0x5457eb['sendStatus'](_0x1e48fb);}return _0x5457eb['status'](_0x1e48fb)['end']();};}function respondWithResult(_0x2eb228,_0xf43c22){_0xf43c22=_0xf43c22||0xc8;return function(_0x383c73){if(_0x383c73){return _0x2eb228[_0x65e1('0x1e')](_0xf43c22)[_0x65e1('0x1f')](_0x383c73);}};}function respondWithFilteredResult(_0x6e8920,_0x3934de){return function(_0x522fed){if(_0x522fed){var _0x3c2ace=typeof _0x3934de['offset']===_0x65e1('0x20')&&typeof _0x3934de['limit']===_0x65e1('0x20');var _0x5134af=_0x522fed[_0x65e1('0x21')];var _0x3041fc=_0x3c2ace?0x0:_0x3934de[_0x65e1('0x22')];var _0x448ed9=_0x3c2ace?_0x522fed['count']:_0x3934de[_0x65e1('0x22')]+_0x3934de[_0x65e1('0x23')];var _0x3f497b;if(_0x448ed9>=_0x5134af){_0x448ed9=_0x5134af;_0x3f497b=0xc8;}else{_0x3f497b=0xce;}_0x6e8920['status'](_0x3f497b);return _0x6e8920['set']('Content-Range',_0x3041fc+'-'+_0x448ed9+'/'+_0x5134af)['json'](_0x522fed);}return null;};}function patchUpdates(_0x3f81d1){return function(_0x372112){try{jsonpatch['apply'](_0x372112,_0x3f81d1,!![]);}catch(_0x600ff5){return BPromise[_0x65e1('0x24')](_0x600ff5);}return _0x372112[_0x65e1('0x25')]();};}function saveUpdates(_0x6361dc,_0x5037c9){return function(_0x535f28){if(_0x535f28){return _0x535f28[_0x65e1('0x26')](_0x6361dc)[_0x65e1('0x27')](function(_0x33cf54){return _0x33cf54;});}return null;};}function removeEntity(_0x28fe8f,_0x2b636b){return function(_0x3b117d){if(_0x3b117d){return _0x3b117d['destroy']()[_0x65e1('0x27')](function(){_0x28fe8f[_0x65e1('0x1e')](0xcc)[_0x65e1('0x28')]();});}};}function handleEntityNotFound(_0x1eaa63,_0x3fd72f){return function(_0x10ba35){if(!_0x10ba35){_0x1eaa63[_0x65e1('0x29')](0x194);}return _0x10ba35;};}function handleError(_0x58cd3f,_0x482b26){_0x482b26=_0x482b26||0x1f4;return function(_0x3d0468){logger[_0x65e1('0x2a')](_0x3d0468[_0x65e1('0x2b')]);if(_0x3d0468[_0x65e1('0x2c')]){delete _0x3d0468['name'];}_0x58cd3f[_0x65e1('0x1e')](_0x482b26)[_0x65e1('0x2d')](_0x3d0468);};}function getInteractionUsers(_0x5a907f,_0x5b1f0c){return new BPromise(function(_0x30ed4d,_0x1fbee0){try{if(_0x5b1f0c[_0x5a907f['id']]){_0x5a907f[_0x65e1('0x2e')]=_['map'](_0x5b1f0c[_0x5a907f['id']],function(_0x57da7d){return{'id':_0x57da7d['id'],'fullname':_0x57da7d[_0x65e1('0x2f')]};});}}catch(_0x5611f9){_0x1fbee0(_0x5611f9);}_0x30ed4d(_0x5a907f);});}function getInteractionTags(_0x14cc38,_0x3771b1){return new BPromise(function(_0x5104ef,_0x491f55){try{if(_0x14cc38[_0x65e1('0x30')]){_0x14cc38[_0x65e1('0x31')]=[];_0x14cc38[_0x65e1('0x30')][_0x65e1('0x32')](',')['forEach'](function(_0x1fbdbf){_0x14cc38[_0x65e1('0x31')][_0x65e1('0x33')](_0x3771b1[_0x1fbdbf]);});}delete _0x14cc38[_0x65e1('0x30')];}catch(_0x5af90a){_0x491f55(_0x5af90a);}_0x5104ef(_0x14cc38);});}function updateSmsInteraction(_0x14fdf9,_0x2ab0bb,_0x234ef5){return new BPromise(function(_0x380cbb,_0x1168ab){return getInteractionUsers(_0x14fdf9,_0x234ef5)[_0x65e1('0x27')](function(_0xae19f2){return getInteractionTags(_0xae19f2,_0x2ab0bb);})[_0x65e1('0x27')](function(_0x3c0b4f){return getStateInteraction(_0x3c0b4f);})[_0x65e1('0x27')](function(_0x41a35d){_0x380cbb(_0x41a35d);})[_0x65e1('0x34')](function(_0x2c799f){_0x1168ab(_0x2c799f);});});}function getStateInteraction(_0x85520){return new BPromise(function(_0x531942){_0x85520[_0x65e1('0x35')]=0x0;_0x85520['talking']=0x0;_0x85520[_0x65e1('0x36')]=0x0;_0x85520[_0x65e1('0x37')]=0x0;_0x85520[_0x65e1('0x38')]=0x0;if(!_0x85520['closed']&&!_0x85520[_0x65e1('0x39')]){_0x85520['waiting']+=0x1;}if(!_0x85520[_0x65e1('0x3a')]&&_0x85520[_0x65e1('0x39')]){_0x85520[_0x65e1('0x3b')]+=0x1;if(_0x85520[_0x65e1('0x35')]){_0x85520[_0x65e1('0x35')]-=0x1;}}if(_0x85520['closed']&&_0x85520[_0x65e1('0x39')]){_0x85520[_0x65e1('0x36')]+=0x1;if(_0x85520['talking']){_0x85520[_0x65e1('0x3b')]-=0x1;}}if(_0x85520['closed']&&!_0x85520[_0x65e1('0x39')]){_0x85520[_0x65e1('0x37')]+=0x1;if(_0x85520[_0x65e1('0x35')]){_0x85520['waiting']-=0x1;}}_0x85520[_0x65e1('0x38')]+=0x1;_0x531942(_0x85520);});}exports[_0x65e1('0x3c')]=function(_0x3edf3a,_0x36e3f8){var _0x3347ca={},_0x3cd381={},_0xbbd84f={'count':0x0,'rows':[]};var _0x254ce6=_['map'](db[_0x65e1('0x3d')][_0x65e1('0x3e')],function(_0x13e489){return{'name':_0x13e489[_0x65e1('0x3f')],'type':_0x13e489[_0x65e1('0x40')][_0x65e1('0x41')]};});_0x3cd381[_0x65e1('0x42')]=_[_0x65e1('0x43')](_0x254ce6,'name');_0x3cd381[_0x65e1('0x44')]=_[_0x65e1('0x45')](_0x3edf3a[_0x65e1('0x44')]);_0x3cd381[_0x65e1('0x46')]=_[_0x65e1('0x47')](_0x3cd381[_0x65e1('0x42')],_0x3cd381['query']);_0x3347ca['attributes']=_[_0x65e1('0x47')](_0x3cd381['model'],qs[_0x65e1('0x48')](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x48')]));_0x3347ca['attributes']=_0x3347ca[_0x65e1('0x49')][_0x65e1('0x4a')]?_0x3347ca[_0x65e1('0x49')]:_0x3cd381[_0x65e1('0x42')];if(!_0x3edf3a['query'][_0x65e1('0x4b')]('nolimit')){_0x3347ca['limit']=qs['limit'](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x23')]);_0x3347ca[_0x65e1('0x22')]=qs[_0x65e1('0x22')](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x22')]);}_0x3347ca[_0x65e1('0x4c')]=qs[_0x65e1('0x4d')](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x4d')]);_0x3347ca[_0x65e1('0x4e')]=qs[_0x65e1('0x46')](_['pick'](_0x3edf3a[_0x65e1('0x44')],_0x3cd381[_0x65e1('0x46')]),_0x254ce6);var _0x1014cd=[];var _0x9e119f=squel[_0x65e1('0x4f')]()[_0x65e1('0x50')]('id')[_0x65e1('0x50')](_0x65e1('0x2c'))['field'](_0x65e1('0x51'))['from']('tools_tags');var _0x4bdf56=squel[_0x65e1('0x4f')]()['field'](_0x65e1('0x52'))[_0x65e1('0x50')](_0x65e1('0x53'))[_0x65e1('0x50')]('ui.SmsInteractionId')[_0x65e1('0x54')](_0x65e1('0x55'),'ui')[_0x65e1('0x56')]('users','u',_0x65e1('0x57'));var _0x4840cc=squel[_0x65e1('0x4f')]()[_0x65e1('0x54')](_0x65e1('0x58'),'i')['left_join']('cm_contacts','c',_0x65e1('0x59'))[_0x65e1('0x56')]('users','o','o.id\x20=\x20i.UserId')[_0x65e1('0x56')]('sms_accounts','a',_0x65e1('0x5a'))['left_join'](_0x65e1('0x5b'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x65e1('0x56')](_0x65e1('0x5c'),'it',_0x65e1('0x5d'))['left_join'](_0x65e1('0x5e'),'t',_0x65e1('0x5f'));var _0x1df2eb=squel[_0x65e1('0x60')]();var _0x38c123=[];var _0xcb5388=squel[_0x65e1('0x60')]();var _0xf51ab8;if(_0x3edf3a[_0x65e1('0x44')]['search']){_0xf51ab8=as[_0x65e1('0x61')](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x62')]);var _0x563ee7=_0xf51ab8['sqlOperator'];for(var _0x8bad5b=0x0;_0x8bad5b<_0xf51ab8['conditions'][_0x65e1('0x4a')];_0x8bad5b++){var _0x2f1e9d=_0xf51ab8[_0x65e1('0x63')][_0x8bad5b];var _0x13ec79='i';var _0x397271=_[_0x65e1('0x64')](_0x254ce6,['name',_0x2f1e9d[_0x65e1('0x50')]]);if(!_0x397271){switch(_0x2f1e9d['field']){case _0x65e1('0x65'):if(_0x2f1e9d[_0x65e1('0x66')]==0x1){_0x4840cc['having']('`'+_0x2f1e9d[_0x65e1('0x50')]+_0x65e1('0x67'));}else{_0x4840cc['having']('`'+_0x2f1e9d['field']+_0x65e1('0x68'));}break;case _0x65e1('0x69'):if(_0x2f1e9d[_0x65e1('0x6a')]===_0x65e1('0x6b')){if(_0x2f1e9d[_0x65e1('0x66')][_0x65e1('0x32')]('\x20')[_0x65e1('0x4a')]>0x1){_0x1df2eb[_0x563ee7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x65e1('0x6c')](_0x2f1e9d[_0x65e1('0x66')]),null);}else{var _0x2881ca='%'+_0x2f1e9d[_0x65e1('0x66')]+'%';_0x1df2eb[_0x563ee7](_0x65e1('0x6d'),_0x2881ca,_0x2881ca,_0x2881ca);}}else{_0x397271=_['find'](_0x254ce6,['name',_0x65e1('0x6e')]);_0x2f1e9d['field']=_0x65e1('0x6e');_0x446682=as[_0x65e1('0x6f')](_0x13ec79,_0x397271[_0x65e1('0x40')],_0x2f1e9d);_0x1df2eb[_0x563ee7](_0x446682[_0x65e1('0x70')],_0x446682[_0x65e1('0x66')][_0x65e1('0x71')],_0x446682['value'][_0x65e1('0x28')]);}break;case _0x65e1('0x72'):var _0x5e9ee1=_0x2f1e9d[_0x65e1('0x66')]['split'](',')[_0x65e1('0x43')](function(_0x2d846a){return Number(_0x2d846a);});_0x5e9ee1['forEach'](function(_0x8d8023){_0xcb5388['or'](_0x65e1('0x73'),'%,'+_0x8d8023+',%');});_0x38c123=_[_0x65e1('0x74')](_0x38c123,_0x5e9ee1);break;case _0x65e1('0x75'):if(_0x2f1e9d['operator']==='$substring'){_0x1df2eb[_0x563ee7](_0x65e1('0x76'),'%'+_0x2f1e9d[_0x65e1('0x66')]+'%',null);}else{_0x397271=_[_0x65e1('0x64')](_0x254ce6,[_0x65e1('0x2c'),_0x65e1('0x39')]);_0x2f1e9d['field']=_0x65e1('0x39');_0x446682=as[_0x65e1('0x6f')](_0x13ec79,_0x397271[_0x65e1('0x40')],_0x2f1e9d);_0x1df2eb[_0x563ee7](_0x446682[_0x65e1('0x70')],_0x446682[_0x65e1('0x66')][_0x65e1('0x71')],_0x446682[_0x65e1('0x66')][_0x65e1('0x28')]);}break;case _0x65e1('0x77'):_0x446682=as[_0x65e1('0x6f')]('me',null,_0x2f1e9d);_0x1df2eb[_0x563ee7](_0x446682[_0x65e1('0x70')],_0x446682[_0x65e1('0x66')][_0x65e1('0x71')],_0x446682[_0x65e1('0x66')]['end']);break;}}else{var _0x446682=as['buildExpression'](_0x13ec79,_0x397271[_0x65e1('0x40')],_0x2f1e9d);_0x1df2eb[_0x563ee7](_0x446682['text'],_0x446682[_0x65e1('0x66')]['start'],_0x446682[_0x65e1('0x66')][_0x65e1('0x28')]);}}}else{var _0x1d7772=_(_0x3edf3a[_0x65e1('0x44')])[_0x65e1('0x45')]()[_0x65e1('0x43')](function(_0x363ec8){return _[_0x65e1('0x78')](_0x254ce6,['name',_0x363ec8])?_0x363ec8:undefined;})[_0x65e1('0x79')]()[_0x65e1('0x66')]();if(!_[_0x65e1('0x7a')](_0x1d7772)){_0x1d7772[_0x65e1('0x7b')](function(_0x5445f2){if(_0x5445f2===_0x65e1('0x7c')){_0x4840cc[_0x65e1('0x4e')]('i.SmsAccountId\x20IN\x20?',[][_0x65e1('0x7d')](_0x3edf3a['query'][_0x5445f2]));}else if(_0x5445f2==='createdAt'){var _0x285cc8=JSON[_0x65e1('0x7e')](_0x3edf3a[_0x65e1('0x44')][_0x5445f2])[_0x65e1('0x7f')];var _0x50dd98=JSON[_0x65e1('0x7e')](_0x3edf3a['query'][_0x5445f2])['$lte'];_0x4840cc[_0x65e1('0x4e')](_0x65e1('0x80'),_0x285cc8,_0x50dd98);}else{if(_0x3edf3a[_0x65e1('0x44')][_0x5445f2]==='null'){_0x4840cc[_0x65e1('0x4e')]('i.'+_0x5445f2+_0x65e1('0x81'));}else{_0x4840cc[_0x65e1('0x4e')]('i.'+_0x5445f2+_0x65e1('0x82'),_0x3edf3a[_0x65e1('0x44')][_0x5445f2]);}}});}if(_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x83')]){if(_0x3edf3a[_0x65e1('0x44')]['read']==0x1){_0x4840cc[_0x65e1('0x84')](_0x65e1('0x85'));}else{_0x4840cc[_0x65e1('0x84')](_0x65e1('0x86'));}}if(_0x3edf3a['query'][_0x65e1('0x87')]){_0x38c123=_[_0x65e1('0x88')](_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x87')])?_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x87')]:new Array(_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x87')]);_0x38c123[_0x65e1('0x7b')](function(_0xadf587){_0xcb5388['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xadf587+',%');});}if(_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x89')]){var _0x41ac45=_0x3edf3a[_0x65e1('0x44')][_0x65e1('0x89')][_0x65e1('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x65e1('0x8b')](_0x41ac45)){_0x1df2eb['or'](_0x65e1('0x8c'),_0x41ac45+'%')['or'](_0x65e1('0x8d'),_0x41ac45+'%');}else{_0x1df2eb['or'](_0x65e1('0x8e'),qs['getFullTextValue'](_0x41ac45))['or'](_0x65e1('0x8f'),_0x41ac45+'%');}}}_0x4840cc[_0x65e1('0x4e')](_0x1df2eb);_0x4840cc[_0x65e1('0x90')](_0x65e1('0x91'));var _0x56bd94={'type':db[_0x65e1('0x92')][_0x65e1('0x93')][_0x65e1('0x94')],'raw':!![]};var _0x2712fd=_0x4840cc[_0x65e1('0x95')]();_0x2712fd[_0x65e1('0x50')]('i.id');_0x2712fd[_0x65e1('0x50')](_0x65e1('0x96'),_0x65e1('0x65'));if(_0x3347ca[_0x65e1('0x4c')]){_0x3347ca[_0x65e1('0x4c')][_0x65e1('0x7b')](function(_0x2f0b16){var _0x38b584=_0x2f0b16[0x0]===_0x65e1('0x97')?_0x2f0b16[0x0]:'i.'+_0x2f0b16[0x0];_0x4840cc[_0x65e1('0x4c')](_0x38b584,_0x2f0b16[0x1]==='DESC'?![]:!![]);});}if(!_[_0x65e1('0x7a')](_0x38c123)){_0x4840cc[_0x65e1('0x84')](_0xcb5388);_0x2712fd['where'](_0x65e1('0x98'),_0x38c123);}BPromise[_0x65e1('0x99')]()[_0x65e1('0x27')](function(){if(!_0xf51ab8){if(_0x3edf3a[_0x65e1('0x44')]['SmsAccountId'])return;_0x2712fd[_0x65e1('0x4e')](_0x65e1('0x9a'));_0x4840cc['where'](_0x65e1('0x9a'));return;}if(_0x3edf3a[_0x65e1('0x9b')]['role']!==_0x65e1('0x9c'))return;return _0x3edf3a['user'][_0x65e1('0x9d')]({'attributes':['id'],'raw':!![]})[_0x65e1('0x27')](function(_0x98a1e0){if(_[_0x65e1('0x7a')](_0x98a1e0)){_0x2712fd[_0x65e1('0x4e')](_0x65e1('0x9e'));_0x4840cc['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x2712fd[_0x65e1('0x4e')](_0x65e1('0x9f'),_[_0x65e1('0x43')](_0x98a1e0,'id'));_0x4840cc[_0x65e1('0x4e')]('i.SmsAccountId\x20IN\x20?',_[_0x65e1('0x43')](_0x98a1e0,'id'));}});})['then'](function(){if(_0x3edf3a[_0x65e1('0x9b')][_0x65e1('0xa0')]===_0x65e1('0x9c')&&!_0xf51ab8&&!_0x3edf3a['query'][_0x65e1('0x7c')])return[];return db[_0x65e1('0xa1')]['query'](_0x2712fd[_0x65e1('0xa2')](),_0x56bd94);})[_0x65e1('0x27')](function(_0x4f948f){_0xbbd84f[_0x65e1('0x21')]=_0x4f948f[_0x65e1('0x4a')];if(_0xbbd84f[_0x65e1('0x21')]===0x0)return[];return db['sequelize'][_0x65e1('0x44')](_0x9e119f[_0x65e1('0xa2')](),_0x56bd94)[_0x65e1('0x27')](function(_0x33cc8e){_0x1014cd=_['keyBy'](_0x33cc8e,'id');_0x56bd94=_[_0x65e1('0xa3')](_0x56bd94,{'model':db[_0x65e1('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3edf3a[_0x65e1('0x44')]['fields']){_0x3347ca[_0x65e1('0x49')]['forEach'](function(_0x30547d){_0x4840cc[_0x65e1('0x50')]('i.'+_0x30547d);});}else{_0x4840cc[_0x65e1('0x50')](_0x65e1('0x96'),'unreadMessages');_0x4840cc[_0x65e1('0x50')](_0x65e1('0xa4'),_0x65e1('0xa5'));_0x4840cc[_0x65e1('0x50')](_0x65e1('0xa6'),_0x65e1('0xa7'));_0x4840cc['field']('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',_0x65e1('0x97'));_0x4840cc['field'](_0x65e1('0xa8'));_0x4840cc[_0x65e1('0x50')](_0x65e1('0xa9'),_0x65e1('0xaa'));_0x4840cc[_0x65e1('0x50')](_0x65e1('0xab'),_0x65e1('0xac'));_0x4840cc[_0x65e1('0x50')]('c.email',_0x65e1('0xad'));_0x4840cc[_0x65e1('0x50')]('c.phone','Contact.phone');_0x4840cc[_0x65e1('0x50')](_0x65e1('0xae'),_0x65e1('0xaf'));_0x4840cc[_0x65e1('0x50')](_0x65e1('0xb0'),_0x65e1('0xb1'));_0x4840cc[_0x65e1('0x50')](_0x65e1('0xb2'),'Owner.fullname');_0x4840cc[_0x65e1('0x50')](_0x65e1('0xb3'),_0x65e1('0xb4'));_0x4840cc['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3347ca['limit'])_0x4840cc[_0x65e1('0x23')](_0x3347ca[_0x65e1('0x23')]);if(_0x3347ca[_0x65e1('0x22')])_0x4840cc['offset'](_0x3347ca['offset']);return db[_0x65e1('0xa1')]['query'](_0x4840cc[_0x65e1('0xa2')](),_0x56bd94);})['then'](function(_0x4eba35){if(_0x4eba35['length']>0x0)_0x4bdf56[_0x65e1('0x4e')](_0x65e1('0xb5'),_[_0x65e1('0x43')](_0x4eba35,'id'));return db[_0x65e1('0xa1')][_0x65e1('0x44')](_0x4bdf56['toString'](),_0x56bd94)['then'](function(_0x1a7663){var _0x4d1eba=_[_0x65e1('0xb6')](_0x1a7663,_0x65e1('0xb7'));var _0x11292b=[];_0x4eba35[_0x65e1('0x7b')](function(_0x47137e){_0x11292b[_0x65e1('0x33')](updateSmsInteraction(_0x47137e,_0x1014cd,_0x4d1eba));});return BPromise['all'](_0x11292b);});});})['then'](function(_0x415250){_0xbbd84f[_0x65e1('0xb8')]=_0x415250;return _0xbbd84f;})['then'](respondWithFilteredResult(_0x36e3f8,_0x3347ca))['catch'](handleError(_0x36e3f8,null));};exports[_0x65e1('0xb9')]=function(_0x5024c4,_0x4c00d2){var _0xf7ddf7={'raw':![],'where':{'id':_0x5024c4['params']['id']}},_0xc76822={};_0xc76822[_0x65e1('0x42')]=_[_0x65e1('0x45')](db[_0x65e1('0x3d')][_0x65e1('0x3e')]);_0xc76822[_0x65e1('0x44')]=_[_0x65e1('0x45')](_0x5024c4[_0x65e1('0x44')]);_0xc76822[_0x65e1('0x46')]=_[_0x65e1('0x47')](_0xc76822[_0x65e1('0x42')],_0xc76822[_0x65e1('0x44')]);_0xf7ddf7[_0x65e1('0x49')]=_[_0x65e1('0x47')](_0xc76822[_0x65e1('0x42')],qs[_0x65e1('0x48')](_0x5024c4[_0x65e1('0x44')][_0x65e1('0x48')]));_0xf7ddf7['attributes']=_0xf7ddf7[_0x65e1('0x49')][_0x65e1('0x4a')]?_0xf7ddf7['attributes']:_0xc76822[_0x65e1('0x42')];if(_0x5024c4[_0x65e1('0x44')][_0x65e1('0xba')]){_0xf7ddf7[_0x65e1('0xbb')]=[{'all':!![]}];}_0xf7ddf7=_[_0x65e1('0xa3')]({},_0xf7ddf7,_0x5024c4[_0x65e1('0xbc')]);return db[_0x65e1('0x3d')][_0x65e1('0x64')](_0xf7ddf7)[_0x65e1('0x27')](handleEntityNotFound(_0x4c00d2,null))[_0x65e1('0x27')](respondWithResult(_0x4c00d2,null))[_0x65e1('0x34')](handleError(_0x4c00d2,null));};exports[_0x65e1('0xbd')]=function(_0x47bb2a,_0xcccb91){return db[_0x65e1('0x3d')][_0x65e1('0xbd')](_0x47bb2a[_0x65e1('0x77')],{})[_0x65e1('0x27')](respondWithResult(_0xcccb91,0xc9))[_0x65e1('0x34')](handleError(_0xcccb91,null));};exports[_0x65e1('0x26')]=function(_0x2359a0,_0x5b82df){if(_0x2359a0[_0x65e1('0x77')]['id']){delete _0x2359a0['body']['id'];}return db[_0x65e1('0x3d')][_0x65e1('0x64')]({'where':{'id':_0x2359a0[_0x65e1('0xbe')]['id']}})[_0x65e1('0x27')](handleEntityNotFound(_0x5b82df,null))[_0x65e1('0x27')](saveUpdates(_0x2359a0[_0x65e1('0x77')],null))[_0x65e1('0x27')](respondWithResult(_0x5b82df,null))[_0x65e1('0x34')](handleError(_0x5b82df,null));};exports[_0x65e1('0xbf')]=function(_0x42460,_0x477927){return db[_0x65e1('0x3d')][_0x65e1('0x64')]({'where':{'id':_0x42460[_0x65e1('0xbe')]['id']}})['then'](handleEntityNotFound(_0x477927,null))[_0x65e1('0x27')](removeEntity(_0x477927,null))[_0x65e1('0x34')](handleError(_0x477927,null));};exports[_0x65e1('0xc0')]=function(_0x479e5a,_0x31ae2b){return db[_0x65e1('0x3d')][_0x65e1('0xc0')]()[_0x65e1('0x27')](respondWithResult(_0x31ae2b,null))[_0x65e1('0x34')](handleError(_0x31ae2b,null));};exports[_0x65e1('0xc1')]=function(_0x3a4693,_0xfadea6,_0x575bfb){return db[_0x65e1('0xc2')]['find']({'where':{'id':_0x3a4693['params']['id']}})[_0x65e1('0x27')](handleEntityNotFound(_0xfadea6,null))[_0x65e1('0x27')](function(_0x4cdeee){if(_0x4cdeee){return _0x4cdeee[_0x65e1('0xc1')](_0x3a4693[_0x65e1('0x77')][_0x65e1('0xc3')],_[_0x65e1('0xc4')](_0x3a4693['body'],[_0x65e1('0xc3'),'id'])||{});}})[_0x65e1('0x27')](respondWithResult(_0xfadea6,null))[_0x65e1('0x34')](handleError(_0xfadea6,null));};exports[_0x65e1('0xc5')]=function(_0x4861ee,_0x2a0c7c,_0x560b99){var _0x5b7ec5={'raw':![],'where':{}};var _0x4c8719={};var _0x35b7d8={'count':0x0,'rows':[]};return db[_0x65e1('0x3d')][_0x65e1('0xc6')]({'where':{'id':_0x4861ee[_0x65e1('0xbe')]['id']}})[_0x65e1('0x27')](handleEntityNotFound(_0x2a0c7c,null))['then'](function(_0x3aaaa3){if(_0x3aaaa3){_0x4c8719[_0x65e1('0x42')]=_[_0x65e1('0x45')](db[_0x65e1('0xc2')]['rawAttributes']);_0x4c8719[_0x65e1('0x44')]=_[_0x65e1('0x45')](_0x4861ee[_0x65e1('0x44')]);_0x4c8719[_0x65e1('0x46')]=_[_0x65e1('0x47')](_0x4c8719['model'],_0x4c8719[_0x65e1('0x44')]);_0x5b7ec5[_0x65e1('0x49')]=_[_0x65e1('0x47')](_0x4c8719[_0x65e1('0x42')],qs[_0x65e1('0x48')](_0x4861ee[_0x65e1('0x44')][_0x65e1('0x48')]));_0x5b7ec5['attributes']=_0x5b7ec5['attributes'][_0x65e1('0x4a')]?_0x5b7ec5['attributes']:_0x4c8719['model'];if(!_0x4861ee[_0x65e1('0x44')][_0x65e1('0x4b')](_0x65e1('0xc7'))){_0x5b7ec5[_0x65e1('0x23')]=qs[_0x65e1('0x23')](_0x4861ee['query'][_0x65e1('0x23')]);_0x5b7ec5[_0x65e1('0x22')]=qs[_0x65e1('0x22')](_0x4861ee[_0x65e1('0x44')][_0x65e1('0x22')]);}_0x5b7ec5[_0x65e1('0x4c')]=qs[_0x65e1('0x4d')](_0x4861ee[_0x65e1('0x44')]['sort']);_0x5b7ec5[_0x65e1('0x4e')]=qs['filters'](_[_0x65e1('0xc8')](_0x4861ee[_0x65e1('0x44')],_0x4c8719['filters']));_0x5b7ec5['where'][_0x65e1('0xb7')]=_0x3aaaa3['id'];if(_0x4861ee[_0x65e1('0x44')][_0x65e1('0x89')]){_0x5b7ec5[_0x65e1('0x4e')]=_['merge'](_0x5b7ec5[_0x65e1('0x4e')],{'$or':_['map'](_0x5b7ec5['attributes'],function(_0x2936ea){var _0x179d8e={};_0x179d8e[_0x2936ea]={'$like':'%'+_0x4861ee['query'][_0x65e1('0x89')]+'%'};return _0x179d8e;})});}if(_0x4861ee[_0x65e1('0x44')]['$gte']){var _0x521b41=_0x4861ee['query'][_0x65e1('0x7f')][_0x65e1('0x32')](',');var _0xfc0c42={};_0xfc0c42[_0x521b41[0x0]]={'$gte':moment(_0x521b41[0x1])[_0x65e1('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b7ec5[_0x65e1('0x4e')]=_[_0x65e1('0xa3')](_0x5b7ec5['where'],_0xfc0c42);}_0x5b7ec5=_[_0x65e1('0xa3')]({},_0x5b7ec5,_0x4861ee[_0x65e1('0xbc')]);return db[_0x65e1('0xc2')][_0x65e1('0x21')]({'where':_0x5b7ec5[_0x65e1('0x4e')]})[_0x65e1('0x27')](function(_0x4d949f){_0x35b7d8[_0x65e1('0x21')]=_0x4d949f;if(_0x4861ee['query'][_0x65e1('0xba')]){_0x5b7ec5[_0x65e1('0xbb')]=[{'all':!![]}];}return db[_0x65e1('0xc2')][_0x65e1('0xca')](_0x5b7ec5);})[_0x65e1('0x27')](function(_0xbe2112){_0x35b7d8['rows']=_0xbe2112;return _0x35b7d8;});}})[_0x65e1('0x27')](respondWithFilteredResult(_0x2a0c7c,_0x5b7ec5))[_0x65e1('0x34')](handleError(_0x2a0c7c,null));};exports[_0x65e1('0xcb')]=function(_0x200474,_0x51a687,_0x2715b0){return db['SmsInteraction']['find']({'where':{'id':_0x200474[_0x65e1('0xbe')]['id']}})[_0x65e1('0x27')](handleEntityNotFound(_0x51a687,null))[_0x65e1('0x27')](function(_0xe60e0a){if(_0xe60e0a){return _0xe60e0a[_0x65e1('0xcc')](_0x200474['body'][_0x65e1('0xc3')],_[_0x65e1('0xc4')](_0x200474[_0x65e1('0x77')],['ids','id'])||{})[_0x65e1('0xcd')](function(){return db[_0x65e1('0x72')][_0x65e1('0xca')]({'attributes':['id',_0x65e1('0x2c'),_0x65e1('0x51')],'where':{'id':_0x200474[_0x65e1('0x77')][_0x65e1('0xc3')]}});})['then'](function(_0x3b98be){socket[_0x65e1('0xce')](_0x65e1('0xcf'),{'id':Number(_0x200474[_0x65e1('0xbe')]['id']),'tags':_0x3b98be||[]});return{'id':Number(_0x200474['params']['id']),'tags':_0x3b98be||[]};});}})['then'](respondWithResult(_0x51a687,null))[_0x65e1('0x34')](handleError(_0x51a687,null));};exports[_0x65e1('0xd0')]=function(_0x2216f3,_0x1d02a2,_0x5a20e3){return db[_0x65e1('0x3d')][_0x65e1('0x64')]({'where':{'id':_0x2216f3[_0x65e1('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1d02a2,null))[_0x65e1('0x27')](function(_0x276842){if(_0x276842){return _0x276842['removeTags'](_0x2216f3[_0x65e1('0x44')][_0x65e1('0xc3')]);}})[_0x65e1('0x27')](respondWithStatusCode(_0x1d02a2,null))[_0x65e1('0x34')](handleError(_0x1d02a2,null));};exports['download']=function(_0x590a37,_0x5781c3){var _0x2f1664=moment()[_0x65e1('0xd1')]()['toString']();var _0x49cd05=path['join'](config['root'],_0x65e1('0xd2'),'files',_0x65e1('0xd3'));var _0x501f32=path[_0x65e1('0xd4')](config['root'],_0x65e1('0xd2'),_0x65e1('0xd5'),'attachments');var _0x52ed7b=path[_0x65e1('0xd4')](_0x49cd05,_0x2f1664);var _0x3b9635=util['format'](_0x65e1('0xd6'),_0x590a37['params']['id'],_0x2f1664);var _0x49cda1=path[_0x65e1('0xd4')](_0x49cd05,_0x3b9635);var _0x344c61=[];_0x344c61[_0x65e1('0x33')]({'model':db[_0x65e1('0x75')],'as':_0x65e1('0x75'),'attributes':['id',_0x65e1('0x2f')],'raw':!![]});_0x344c61['push']({'model':db['CmContact'],'as':_0x65e1('0x69'),'attributes':['id',_0x65e1('0xd7'),_0x65e1('0xd8')],'raw':!![]});var _0x2b1b04=[{'model':db[_0x65e1('0xc2')],'as':'Messages','attributes':['id','body',_0x65e1('0xd9'),_0x65e1('0xda'),'secret',_0x65e1('0x83')],'include':_0x344c61}];_0x2b1b04[_0x65e1('0x33')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x65e1('0x2c')]});_0x2b1b04[_0x65e1('0x33')]({'model':db[_0x65e1('0x75')],'as':_0x65e1('0xdb'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x65e1('0x64')]({'where':{'id':_0x590a37[_0x65e1('0xbe')]['id']},'include':_0x2b1b04})['then'](handleEntityNotFound(_0x5781c3,null))['then'](function(_0xd10f8c){if(_0xd10f8c){var _0x10360b=_0xd10f8c[_0x65e1('0xdc')]({'plain':!![]});fs[_0x65e1('0xdd')](_0x52ed7b);var _0x26a7d6={'channel':_0x65e1('0xde'),'account':_0x10360b[_0x65e1('0xdf')][_0x65e1('0x2c')],'agent':_0x10360b[_0x65e1('0xdb')]?_0x10360b[_0x65e1('0xdb')][_0x65e1('0x2f')]:_0x65e1('0xe0'),'createdAt':moment(_0x10360b[_0x65e1('0xd9')])[_0x65e1('0xc9')](_0x65e1('0xe1'))[_0x65e1('0xa2')](),'closedAt':_0x10360b[_0x65e1('0x3a')]?moment(_0x10360b[_0x65e1('0xe2')])[_0x65e1('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x65e1('0xa2')]():'','disposition':_0x10360b['disposition'],'messages':_(_0x10360b['Messages'])['filter']({'secret':![]})[_0x65e1('0x43')](function(_0x21af1b){return{'date':moment(_0x21af1b[_0x65e1('0xd9')])[_0x65e1('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x65e1('0xa2')](),'sender':_0x21af1b[_0x65e1('0xda')]===_0x65e1('0xe3')?_0x21af1b['User']?_0x21af1b[_0x65e1('0x75')][_0x65e1('0x2f')]:_0x65e1('0xe4'):_0x21af1b[_0x65e1('0x69')][_0x65e1('0xd7')]+(_0x21af1b[_0x65e1('0x69')][_0x65e1('0xd8')]?'\x20'+_0x21af1b[_0x65e1('0x69')][_0x65e1('0xd8')]:''),'body':_0x21af1b[_0x65e1('0x77')],'direction':_0x21af1b[_0x65e1('0xda')]===_0x65e1('0xe3')?'A':'C','secret':_0x21af1b[_0x65e1('0xe5')],'read':_0x21af1b['read']};})[_0x65e1('0x66')]()};return ejs[_0x65e1('0xe6')](path[_0x65e1('0xd4')](config[_0x65e1('0xe7')],'server','views',_0x65e1('0xe8')),{'interaction':_0x26a7d6})[_0x65e1('0x27')](function(_0x450ab3){var _0x1a95e6=path['join'](_0x52ed7b,'transcript-'+_0x10360b['id']+'-'+_0x2f1664+_0x65e1('0xe9'));var _0x2cbab6={'path':_0x1a95e6,'channel':_0x65e1('0xde'),'interactionId':_0x10360b['id']};return pdf['createPdfFromHTML'](_0x450ab3,_0x2cbab6);})[_0x65e1('0x27')](function(){return new BPromise(function(_0x283297,_0x3ccbf0){zipdir(_0x52ed7b,{'saveTo':_0x49cda1},function(_0x3b24c0,_0x2b3d51){if(_0x3b24c0)return _0x3ccbf0(_0x3b24c0);return _0x283297(_0x2b3d51);});})['then'](function(){return new BPromise(function(_0x675509,_0x53beb7){rimraf(_0x52ed7b,function(_0x42341d){if(_0x42341d)_0x53beb7(_0x42341d);return _0x675509();});});})[_0x65e1('0x27')](function(){return _0x5781c3[_0x65e1('0xea')](_0x49cda1,_0x3b9635,function(_0x47d19c){if(_0x47d19c){console[_0x65e1('0xeb')](_0x65e1('0xec'),_0x47d19c);}else{fs[_0x65e1('0xed')](_0x49cda1);}});});});}else{return _0x5781c3['sendStatus'](0xc8);}})[_0x65e1('0x34')](handleError(_0x5781c3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 555d5d7..142f64d 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 _0xe511=['Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0xbd1066,_0x9d97f){var _0x197794=function(_0x51214f){while(--_0x51214f){_0xbd1066['push'](_0xbd1066['shift']());}};_0x197794(++_0x9d97f);}(_0xe511,0x16f));var _0x1e51=function(_0x1682a9,_0x34b75f){_0x1682a9=_0x1682a9-0x0;var _0x1cdf47=_0xe511[_0x1682a9];return _0x1cdf47;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var SmsInteraction=require(_0x1e51('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x1e51('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':_0x1e51('0x3'),'afterUpdate':'update','afterDestroy':_0x1e51('0x4')};function emitEvent(_0x2be2b7){return function(_0x204da7,_0x16ec99,_0x480cca){_0x204da7[_0x1e51('0x5')]({'attributes':['id'],'raw':!![]})[_0x1e51('0x6')](function(_0x5c4590){_0x204da7['setDataValue'](_0x1e51('0x7'),_0x5c4590[_0x1e51('0x8')](function(_0x4fa8a9){return{'id':_0x4fa8a9['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x204da7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e51('0x6')](function(_0x2712e0){_0x204da7[_0x1e51('0x9')](_0x1e51('0xa'),_0x2712e0[_0x1e51('0xb')]);SmsInteractionEvents[_0x1e51('0xc')](_0x2be2b7+':'+_0x204da7['id'],_0x204da7);SmsInteractionEvents['emit'](_0x2be2b7,_0x204da7);_0x480cca(null);})[_0x1e51('0xd')](_0x480cca(null));};}for(var e in events){if(events[_0x1e51('0xe')](e)){var event=events[e];SmsInteraction[_0x1e51('0xf')](e,emitEvent(event));}}module[_0x1e51('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xb574=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsMessage','save','update','remove','getUsers','map','findAll','then'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xb574,0x106));var _0x4b57=function(_0x4e51f0,_0x43c7a5){_0x4e51f0=_0x4e51f0-0x0;var _0x36cd3c=_0xb574[_0x4e51f0];return _0x36cd3c;};'use strict';var EventEmitter=require(_0x4b57('0x0'));var SmsInteraction=require(_0x4b57('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4b57('0x1'))['db'][_0x4b57('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b57('0x3'),'afterUpdate':_0x4b57('0x4'),'afterDestroy':_0x4b57('0x5')};function emitEvent(_0x919851){return function(_0xe2ae86,_0x4a3efa,_0x4eb019){_0xe2ae86[_0x4b57('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x585d86){_0xe2ae86['setDataValue']('Users',_0x585d86[_0x4b57('0x7')](function(_0x2bf397){return{'id':_0x2bf397['id']};}));return SmsMessage[_0x4b57('0x8')]({'where':{'SmsInteractionId':_0xe2ae86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b57('0x9')](function(_0xce47ad){_0xe2ae86[_0x4b57('0xa')](_0x4b57('0xb'),_0xce47ad[_0x4b57('0xc')]);SmsInteractionEvents['emit'](_0x919851+':'+_0xe2ae86['id'],_0xe2ae86);SmsInteractionEvents[_0x4b57('0xd')](_0x919851,_0xe2ae86);_0x4eb019(null);})[_0x4b57('0xe')](_0x4eb019(null));};}for(var e in events){if(events[_0x4b57('0xf')](e)){var event=events[e];SmsInteraction['hook'](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 301671b..b8957da 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 _0x5e65=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','define','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x5e65,0x193));var _0x55e6=function(_0x53a976,_0xf87685){_0x53a976=_0x53a976-0x0;var _0x802014=_0x5e65[_0x53a976];return _0x802014;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var logger=require(_0x55e6('0x2'))(_0x55e6('0x3'));var moment=require(_0x55e6('0x4'));var BPromise=require(_0x55e6('0x5'));var rp=require(_0x55e6('0x6'));var fs=require('fs');var path=require(_0x55e6('0x7'));var rimraf=require(_0x55e6('0x8'));var config=require('../../config/environment');var attributes=require(_0x55e6('0x9'));module['exports']=function(_0x39bc99,_0x598ee4){return _0x39bc99[_0x55e6('0xa')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c3bad,_0x25b4d2,_0x211fe0){if(_0x5c3bad[_0x55e6('0xb')]('closed')){_0x5c3bad[_0x55e6('0xc')]=moment()[_0x55e6('0xd')](_0x55e6('0xe'));}_0x211fe0(null,_0x5c3bad);}}});}; \ No newline at end of file +var _0xc949=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','rimraf','./smsInteraction.attributes','define','closed'];(function(_0x652303,_0x1170be){var _0x22998d=function(_0x50bc8b){while(--_0x50bc8b){_0x652303['push'](_0x652303['shift']());}};_0x22998d(++_0x1170be);}(_0xc949,0x1a5));var _0x9c94=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc949[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x9c94('0x0'));var util=require(_0x9c94('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9c94('0x2'));var BPromise=require(_0x9c94('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c94('0x4'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x5'));module['exports']=function(_0x430467,_0x56e5f0){return _0x430467[_0x9c94('0x6')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x104596,_0xdcf6b8,_0x3091cf){if(_0x104596['changed'](_0x9c94('0x7'))){_0x104596[_0x9c94('0x8')]=moment()[_0x9c94('0x9')](_0x9c94('0xa'));}_0x3091cf(null,_0x104596);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d49853f..d083319 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 _0x0abc=['stringify','error','code','message','info','result','SmsInteraction','body','options','where','attributes','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','then','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0abc,0x94));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0ab('0x0'));var util=require(_0xc0ab('0x1'));var moment=require(_0xc0ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0ab('0x4'))['db'];var utils=require(_0xc0ab('0x5'));var logger=require(_0xc0ab('0x6'))(_0xc0ab('0x7'));var config=require(_0xc0ab('0x8'));var jayson=require(_0xc0ab('0x9'));var client=jayson[_0xc0ab('0xa')]['http']({'port':0x232a});config[_0xc0ab('0xb')]=_[_0xc0ab('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc0ab('0xd'))(new Redis(config[_0xc0ab('0xb')]));require(_0xc0ab('0xe'))[_0xc0ab('0xf')](socket);function respondWithRpcPromise(_0x480c24,_0x8f061a,_0x2b6e56){return new BPromise(function(_0x437759,_0x2a1ee0){return client[_0xc0ab('0x10')](_0x480c24,_0x2b6e56)['then'](function(_0x58b0d7){logger['info'](_0xc0ab('0x11'),_0x8f061a,_0xc0ab('0x12'));logger[_0xc0ab('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x8f061a,_0xc0ab('0x12'),JSON[_0xc0ab('0x14')](_0x58b0d7));if(_0x58b0d7['error']){if(_0x58b0d7[_0xc0ab('0x15')][_0xc0ab('0x16')]===0x1f4){logger[_0xc0ab('0x15')](_0xc0ab('0x11'),_0x8f061a,_0x58b0d7[_0xc0ab('0x15')][_0xc0ab('0x17')]);return _0x2a1ee0(_0x58b0d7[_0xc0ab('0x15')][_0xc0ab('0x17')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x8f061a,_0x58b0d7[_0xc0ab('0x15')]['message']);return _0x437759(_0x58b0d7[_0xc0ab('0x15')][_0xc0ab('0x17')]);}else{logger[_0xc0ab('0x18')](_0xc0ab('0x11'),_0x8f061a,_0xc0ab('0x12'));_0x437759(_0x58b0d7[_0xc0ab('0x19')][_0xc0ab('0x17')]);}})['catch'](function(_0xadb157){logger[_0xc0ab('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x8f061a,_0xadb157);_0x2a1ee0(_0xadb157);});});}exports['UpdateSmsInteraction']=function(_0x5bec74){var _0x346c99=this;return new Promise(function(_0xdb0c02,_0x508e80){return db[_0xc0ab('0x1a')]['update'](_0x5bec74[_0xc0ab('0x1b')],{'raw':_0x5bec74[_0xc0ab('0x1c')]?_0x5bec74[_0xc0ab('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bec74[_0xc0ab('0x1c')]?_0x5bec74[_0xc0ab('0x1c')][_0xc0ab('0x1d')]||null:null,'attributes':_0x5bec74[_0xc0ab('0x1c')]?_0x5bec74[_0xc0ab('0x1c')][_0xc0ab('0x1e')]||null:null,'limit':_0x5bec74[_0xc0ab('0x1c')]?_0x5bec74[_0xc0ab('0x1c')][_0xc0ab('0x1f')]||null:null})['then'](function(_0x19dbf4){logger[_0xc0ab('0x18')](_0xc0ab('0x20'),_0x5bec74);logger[_0xc0ab('0x13')](_0xc0ab('0x20'),_0x5bec74,JSON[_0xc0ab('0x14')](_0x19dbf4));_0xdb0c02(_0x19dbf4);})[_0xc0ab('0x21')](function(_0x2a7fa5){logger['error'](_0xc0ab('0x20'),_0x2a7fa5['message'],_0x5bec74);_0x508e80(_0x346c99[_0xc0ab('0x15')](0x1f4,_0x2a7fa5[_0xc0ab('0x17')]));});});};exports[_0xc0ab('0x22')]=function(_0x3c610d){return new Promise(function(_0x3eac04,_0x414eeb){return db['SmsInteraction'][_0xc0ab('0x23')]({'where':_0x3c610d['options']?_0x3c610d[_0xc0ab('0x1c')]['where']||null:null})[_0xc0ab('0x24')](function(_0xaf4fd){if(_0xaf4fd){return _0xaf4fd[_0xc0ab('0x25')](_0x3c610d['body']['ids'],_[_0xc0ab('0x26')](_0x3c610d['body'],[_0xc0ab('0x27'),'id'])||{});}})[_0xc0ab('0x28')](function(_0x1e8c31){logger[_0xc0ab('0x18')](_0xc0ab('0x29'),_0x3c610d);logger[_0xc0ab('0x13')](_0xc0ab('0x29'),_0x3c610d,JSON[_0xc0ab('0x14')](_0x1e8c31));_0x3eac04(_0x1e8c31);})['catch'](function(_0x274ac){logger[_0xc0ab('0x15')](_0xc0ab('0x29'),_0x274ac[_0xc0ab('0x17')],_0x3c610d);_0x414eeb(_this[_0xc0ab('0x15')](0x1f4,_0x274ac['message']));});});}; \ No newline at end of file +var _0x79d0=['update','body','options','raw','attributes','limit','debug','catch','AddTagsToSmsInteraction','where','addTags','ids','omit','spread','AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','UpdateSmsInteraction','SmsInteraction'];(function(_0x4233d4,_0x1bafaa){var _0xc5440b=function(_0x369cc1){while(--_0x369cc1){_0x4233d4['push'](_0x4233d4['shift']());}};_0xc5440b(++_0x1bafaa);}(_0x79d0,0x1de));var _0x079d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x79d0[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x079d('0x0'));var util=require('util');var moment=require(_0x079d('0x1'));var BPromise=require(_0x079d('0x2'));var rs=require(_0x079d('0x3'));var fs=require('fs');var Redis=require(_0x079d('0x4'));var db=require(_0x079d('0x5'))['db'];var utils=require(_0x079d('0x6'));var logger=require(_0x079d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x079d('0x8'));var client=jayson[_0x079d('0x9')][_0x079d('0xa')]({'port':0x232a});config[_0x079d('0xb')]=_[_0x079d('0xc')](config['redis'],{'host':_0x079d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x079d('0xe')](socket);function respondWithRpcPromise(_0x166ed0,_0x366f86,_0x1255d5){return new BPromise(function(_0x3a4cce,_0x2984a7){return client[_0x079d('0xf')](_0x166ed0,_0x1255d5)[_0x079d('0x10')](function(_0xb15beb){logger['info'](_0x079d('0x11'),_0x366f86,'request\x20sent');logger['debug'](_0x079d('0x12'),_0x366f86,_0x079d('0x13'),JSON['stringify'](_0xb15beb));if(_0xb15beb['error']){if(_0xb15beb[_0x079d('0x14')]['code']===0x1f4){logger[_0x079d('0x14')](_0x079d('0x11'),_0x366f86,_0xb15beb[_0x079d('0x14')]['message']);return _0x2984a7(_0xb15beb['error'][_0x079d('0x15')]);}logger[_0x079d('0x14')](_0x079d('0x11'),_0x366f86,_0xb15beb['error'][_0x079d('0x15')]);return _0x3a4cce(_0xb15beb[_0x079d('0x14')][_0x079d('0x15')]);}else{logger[_0x079d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x366f86,'request\x20sent');_0x3a4cce(_0xb15beb[_0x079d('0x17')][_0x079d('0x15')]);}})['catch'](function(_0xc2f94){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x366f86,_0xc2f94);_0x2984a7(_0xc2f94);});});}exports[_0x079d('0x18')]=function(_0x2c6411){var _0x522562=this;return new Promise(function(_0x5037f1,_0x187b5b){return db[_0x079d('0x19')][_0x079d('0x1a')](_0x2c6411[_0x079d('0x1b')],{'raw':_0x2c6411['options']?_0x2c6411[_0x079d('0x1c')][_0x079d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6411[_0x079d('0x1c')]?_0x2c6411[_0x079d('0x1c')]['where']||null:null,'attributes':_0x2c6411[_0x079d('0x1c')]?_0x2c6411[_0x079d('0x1c')][_0x079d('0x1e')]||null:null,'limit':_0x2c6411[_0x079d('0x1c')]?_0x2c6411['options'][_0x079d('0x1f')]||null:null})['then'](function(_0x973b4c){logger['info'](_0x079d('0x18'),_0x2c6411);logger[_0x079d('0x20')](_0x079d('0x18'),_0x2c6411,JSON['stringify'](_0x973b4c));_0x5037f1(_0x973b4c);})[_0x079d('0x21')](function(_0x46b407){logger[_0x079d('0x14')](_0x079d('0x18'),_0x46b407[_0x079d('0x15')],_0x2c6411);_0x187b5b(_0x522562['error'](0x1f4,_0x46b407[_0x079d('0x15')]));});});};exports[_0x079d('0x22')]=function(_0x3451ce){return new Promise(function(_0x440267,_0x180f26){return db['SmsInteraction']['find']({'where':_0x3451ce[_0x079d('0x1c')]?_0x3451ce[_0x079d('0x1c')][_0x079d('0x23')]||null:null})[_0x079d('0x10')](function(_0x4bc1d4){if(_0x4bc1d4){return _0x4bc1d4[_0x079d('0x24')](_0x3451ce[_0x079d('0x1b')][_0x079d('0x25')],_[_0x079d('0x26')](_0x3451ce[_0x079d('0x1b')],[_0x079d('0x25'),'id'])||{});}})[_0x079d('0x27')](function(_0x156bdc){logger['info']('AddTags',_0x3451ce);logger[_0x079d('0x20')](_0x079d('0x28'),_0x3451ce,JSON[_0x079d('0x29')](_0x156bdc));_0x440267(_0x156bdc);})[_0x079d('0x21')](function(_0xd1d931){logger[_0x079d('0x14')](_0x079d('0x28'),_0xd1d931[_0x079d('0x15')],_0x3451ce);_0x180f26(_this[_0x079d('0x14')](0x1f4,_0xd1d931['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 7f1a46e..a172d6c 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 _0x9270=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x3337b9,_0x4c176f){var _0x580945=function(_0x2f52f7){while(--_0x2f52f7){_0x3337b9['push'](_0x3337b9['shift']());}};_0x580945(++_0x4c176f);}(_0x9270,0x1dc));var _0x0927=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x9270[_0x47b15f];return _0x55bf25;};'use strict';var SmsInteractionEvents=require(_0x0927('0x0'));var events=[_0x0927('0x1'),_0x0927('0x2'),_0x0927('0x3')];function createListener(_0x176920,_0x581fc5){return function(_0xd0e62d){_0x581fc5[_0x0927('0x4')](_0x176920,_0xd0e62d);};}function removeListener(_0x160225,_0x525f40){return function(){SmsInteractionEvents[_0x0927('0x5')](_0x160225,_0x525f40);};}exports[_0x0927('0x6')]=function(_0x359606){for(var _0x519ba6=0x0,_0x163aff=events[_0x0927('0x7')];_0x519ba6<_0x163aff;_0x519ba6++){var _0x7306d1=events[_0x519ba6];var _0x3e237d=createListener(_0x0927('0x8')+_0x7306d1,_0x359606);SmsInteractionEvents['on'](_0x7306d1,_0x3e237d);}}; \ No newline at end of file +var _0xbc48=['length','smsInteraction:','./smsInteraction.events','save','remove','update','removeListener','register'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbc48,0x102));var _0x8bc4=function(_0x5f3057,_0x4b72da){_0x5f3057=_0x5f3057-0x0;var _0x3f985d=_0xbc48[_0x5f3057];return _0x3f985d;};'use strict';var SmsInteractionEvents=require(_0x8bc4('0x0'));var events=[_0x8bc4('0x1'),_0x8bc4('0x2'),_0x8bc4('0x3')];function createListener(_0x40f460,_0x456d1b){return function(_0x4d2a57){_0x456d1b['emit'](_0x40f460,_0x4d2a57);};}function removeListener(_0xc0574b,_0x4fad1d){return function(){SmsInteractionEvents[_0x8bc4('0x4')](_0xc0574b,_0x4fad1d);};}exports[_0x8bc4('0x5')]=function(_0x48f992){for(var _0x4a7923=0x0,_0x23dbd2=events[_0x8bc4('0x6')];_0x4a7923<_0x23dbd2;_0x4a7923++){var _0x58d776=events[_0x4a7923];var _0x19ce87=createListener(_0x8bc4('0x7')+_0x58d776,_0x48f992);SmsInteractionEvents['on'](_0x58d776,_0x19ce87);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 544f28a..ec7b24a 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 _0x6635=['post','status','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create'];(function(_0x4926d2,_0x4a91c9){var _0x1eefd2=function(_0x26e7e6){while(--_0x26e7e6){_0x4926d2['push'](_0x4926d2['shift']());}};_0x1eefd2(++_0x4a91c9);}(_0x6635,0x90));var _0x5663=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x6635[_0x39096d];return _0x13da4f;};'use strict';var multer=require('multer');var util=require(_0x5663('0x0'));var path=require(_0x5663('0x1'));var timeout=require(_0x5663('0x2'));var express=require(_0x5663('0x3'));var router=express['Router']();var fs_extra=require(_0x5663('0x4'));var auth=require(_0x5663('0x5'));var interaction=require(_0x5663('0x6'));var config=require(_0x5663('0x7'));var controller=require('./smsMessage.controller');router[_0x5663('0x8')]('/',auth[_0x5663('0x9')](),controller['index']);router[_0x5663('0x8')](_0x5663('0xa'),auth[_0x5663('0x9')](),controller[_0x5663('0xb')]);router[_0x5663('0x8')](_0x5663('0xc'),auth['isAuthenticated'](),controller[_0x5663('0xd')]);router['post']('/',auth[_0x5663('0x9')](),interaction[_0x5663('0xe')](_0x5663('0xf'),_0x5663('0x10')),controller[_0x5663('0x11')]);router[_0x5663('0x12')]('/:id/status',controller[_0x5663('0x13')]);router[_0x5663('0x14')](_0x5663('0xc'),auth[_0x5663('0x9')](),controller[_0x5663('0x15')]);router[_0x5663('0x14')]('/:id/accept',auth[_0x5663('0x9')](),controller[_0x5663('0x16')]);router[_0x5663('0x14')](_0x5663('0x17'),auth[_0x5663('0x9')](),controller[_0x5663('0x18')]);router[_0x5663('0x19')](_0x5663('0xc'),auth[_0x5663('0x9')](),controller['destroy']);module[_0x5663('0x1a')]=router; \ No newline at end of file +var _0x2ebe=['tracked','sms','smsmessage:create','create','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0xee8d40,_0x48f91d){var _0x6b2606=function(_0x4d707c){while(--_0x4d707c){_0xee8d40['push'](_0xee8d40['shift']());}};_0x6b2606(++_0x48f91d);}(_0x2ebe,0x125));var _0xe2eb=function(_0x565459,_0x1c2242){_0x565459=_0x565459-0x0;var _0xfbb8e3=_0x2ebe[_0x565459];return _0xfbb8e3;};'use strict';var multer=require(_0xe2eb('0x0'));var util=require(_0xe2eb('0x1'));var path=require(_0xe2eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe2eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe2eb('0x4'));var interaction=require(_0xe2eb('0x5'));var config=require(_0xe2eb('0x6'));var controller=require(_0xe2eb('0x7'));router[_0xe2eb('0x8')]('/',auth[_0xe2eb('0x9')](),controller[_0xe2eb('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe2eb('0xb')]);router[_0xe2eb('0x8')](_0xe2eb('0xc'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0xd')]);router[_0xe2eb('0xe')]('/',auth[_0xe2eb('0x9')](),interaction[_0xe2eb('0xf')](_0xe2eb('0x10'),_0xe2eb('0x11')),controller[_0xe2eb('0x12')]);router[_0xe2eb('0xe')]('/:id/status',controller[_0xe2eb('0x13')]);router['put'](_0xe2eb('0xc'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x14')]);router['put'](_0xe2eb('0x15'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x16')]);router[_0xe2eb('0x17')](_0xe2eb('0x18'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x19')]);router[_0xe2eb('0x1a')]('/:id',auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ac0b864..b884448 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 _0xbeec=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x1fa7da,_0x82cb97){var _0x809b2f=function(_0x8fb22a){while(--_0x8fb22a){_0x1fa7da['push'](_0x1fa7da['shift']());}};_0x809b2f(++_0x82cb97);}(_0xbeec,0x76));var _0xcbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xcbee('0x0')](_0xcbee('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xcbee('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcbee('0x3')]('in',_0xcbee('0x4')),'defaultValue':_0xcbee('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcbee('0x5')](0xbe)},'phone':{'type':Sequelize[_0xcbee('0x5')]},'readAt':{'type':Sequelize[_0xcbee('0x6')]},'secret':{'type':Sequelize[_0xcbee('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcbee('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbc6b=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xbc6b,0x14b));var _0xbbc6=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xbc6b[_0x46428c];return _0x16a677;};'use strict';var Sequelize=require(_0xbbc6('0x0'));module[_0xbbc6('0x1')]={'body':{'type':Sequelize[_0xbbc6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbbc6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbbc6('0x4')]('in',_0xbbc6('0x5')),'defaultValue':_0xbbc6('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbbc6('0x6')]},'readAt':{'type':Sequelize[_0xbbc6('0x7')]},'secret':{'type':Sequelize[_0xbbc6('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbbc6('0x6')]},'providerResponse':{'type':Sequelize[_0xbbc6('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b2d2958..154e3f9 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 _0xe354=['reject','save','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','type','VIRTUAL','merge','options','SmsMessage','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','update','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','count','set','apply'];(function(_0x53308b,_0x28dc1a){var _0x5eac23=function(_0x30fe72){while(--_0x30fe72){_0x53308b['push'](_0x53308b['shift']());}};_0x5eac23(++_0x28dc1a);}(_0xe354,0x187));var _0x4e35=function(_0x557112,_0x507e55){_0x557112=_0x557112-0x0;var _0xd48f2c=_0xe354[_0x557112];return _0xd48f2c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e35('0x0'));var jsonpatch=require(_0x4e35('0x1'));var rp=require('request-promise');var moment=require(_0x4e35('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e35('0x3'));var util=require(_0x4e35('0x4'));var path=require(_0x4e35('0x5'));var sox=require(_0x4e35('0x6'));var csv=require(_0x4e35('0x7'));var ejs=require(_0x4e35('0x8'));var fs=require('fs');var fs_extra=require(_0x4e35('0x9'));var _=require(_0x4e35('0xa'));var squel=require('squel');var crypto=require(_0x4e35('0xb'));var jsforce=require(_0x4e35('0xc'));var deskjs=require(_0x4e35('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e35('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e35('0xf'));var as=require(_0x4e35('0x10'));var hardwareService=require(_0x4e35('0x11'));var logger=require(_0x4e35('0x12'))(_0x4e35('0x13'));var utils=require(_0x4e35('0x14'));var config=require(_0x4e35('0x15'));var licenseUtil=require(_0x4e35('0x16'));var db=require(_0x4e35('0x17'))['db'];config[_0x4e35('0x18')]=_['defaults'](config['redis'],{'host':_0x4e35('0x19'),'port':0x18eb});var socket=require(_0x4e35('0x1a'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x4e35('0x1b')](socket);var jayson=require(_0x4e35('0x1c'));var client=jayson[_0x4e35('0x1d')][_0x4e35('0x1e')]({'port':0x232c});var client9002=jayson[_0x4e35('0x1d')][_0x4e35('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xfe9f0a,_0x579029,_0x307d65,_0x3377ec){return new BPromise(function(_0x4aa4c8,_0x112ecf){var _0x2a6103=_0x3377ec||client;return _0x2a6103['request'](_0xfe9f0a,_0x307d65)[_0x4e35('0x1f')](function(_0x2270e4){logger[_0x4e35('0x20')]('SmsMessage,\x20%s,\x20%s',_0x579029,'request\x20sent');logger[_0x4e35('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x579029,_0x4e35('0x22'),JSON[_0x4e35('0x23')](_0x2270e4));if(_0x2270e4[_0x4e35('0x24')]){if(_0x2270e4['error'][_0x4e35('0x25')]===0x1f4){logger[_0x4e35('0x24')](_0x4e35('0x26'),_0x579029,_0x2270e4[_0x4e35('0x24')]['message']);return _0x112ecf(_0x2270e4[_0x4e35('0x24')][_0x4e35('0x27')]);}logger[_0x4e35('0x24')](_0x4e35('0x26'),_0x579029,_0x2270e4[_0x4e35('0x24')][_0x4e35('0x27')]);return _0x4aa4c8(_0x2270e4[_0x4e35('0x24')][_0x4e35('0x27')]);}else{logger['info'](_0x4e35('0x26'),_0x579029,_0x4e35('0x22'));_0x4aa4c8(_0x2270e4[_0x4e35('0x28')][_0x4e35('0x27')]);}})[_0x4e35('0x29')](function(_0x171533){logger['error']('SmsMessage,\x20%s,\x20%s',_0x579029,_0x171533);_0x112ecf(_0x171533);});});}function respondWithStatusCode(_0x1c0bbb,_0x573d9d){_0x573d9d=_0x573d9d||0xcc;return function(_0x3e6805){if(_0x3e6805){return _0x1c0bbb['sendStatus'](_0x573d9d);}return _0x1c0bbb[_0x4e35('0x2a')](_0x573d9d)[_0x4e35('0x2b')]();};}function respondWithResult(_0x5e0a03,_0x1c0f71){_0x1c0f71=_0x1c0f71||0xc8;return function(_0x19a1b0){if(_0x19a1b0){return _0x5e0a03[_0x4e35('0x2a')](_0x1c0f71)[_0x4e35('0x2c')](_0x19a1b0);}};}function respondWithFilteredResult(_0x2b5505,_0x4689e7){return function(_0x1b89fa){if(_0x1b89fa){var _0x2afe93=typeof _0x4689e7[_0x4e35('0x2d')]==='undefined'&&typeof _0x4689e7[_0x4e35('0x2e')]==='undefined';var _0xef4db4=_0x1b89fa[_0x4e35('0x2f')];var _0x32e07b=_0x2afe93?0x0:_0x4689e7[_0x4e35('0x2d')];var _0x49f217=_0x2afe93?_0x1b89fa['count']:_0x4689e7[_0x4e35('0x2d')]+_0x4689e7[_0x4e35('0x2e')];var _0x44637e;if(_0x49f217>=_0xef4db4){_0x49f217=_0xef4db4;_0x44637e=0xc8;}else{_0x44637e=0xce;}_0x2b5505[_0x4e35('0x2a')](_0x44637e);return _0x2b5505[_0x4e35('0x30')]('Content-Range',_0x32e07b+'-'+_0x49f217+'/'+_0xef4db4)[_0x4e35('0x2c')](_0x1b89fa);}return null;};}function patchUpdates(_0x2e4b5e){return function(_0x42154b){try{jsonpatch[_0x4e35('0x31')](_0x42154b,_0x2e4b5e,!![]);}catch(_0x2844af){return BPromise[_0x4e35('0x32')](_0x2844af);}return _0x42154b[_0x4e35('0x33')]();};}function saveUpdates(_0x516048,_0x138f27){return function(_0x3d4865){if(_0x3d4865){return _0x3d4865['update'](_0x516048)[_0x4e35('0x1f')](function(_0x3cd9b3){return _0x3cd9b3;});}return null;};}function removeEntity(_0x102fb3,_0x24b672){return function(_0x4f45ad){if(_0x4f45ad){return _0x4f45ad[_0x4e35('0x34')]()[_0x4e35('0x1f')](function(){_0x102fb3[_0x4e35('0x2a')](0xcc)[_0x4e35('0x2b')]();});}};}function handleEntityNotFound(_0x39d19d,_0x36a12e){return function(_0x21ef0b){if(!_0x21ef0b){_0x39d19d[_0x4e35('0x35')](0x194);}return _0x21ef0b;};}function handleError(_0x3e42d3,_0x562496){_0x562496=_0x562496||0x1f4;return function(_0x55115d){logger[_0x4e35('0x24')](_0x55115d[_0x4e35('0x36')]);if(_0x55115d['name']){delete _0x55115d[_0x4e35('0x37')];}_0x3e42d3[_0x4e35('0x2a')](_0x562496)['send'](_0x55115d);};}exports[_0x4e35('0x38')]=function(_0x14a2c7,_0x5cc1de){var _0x28154f={},_0x1d159d={},_0x4e41a9={'count':0x0,'rows':[]};var _0x5f5887=_[_0x4e35('0x39')](db['SmsMessage'][_0x4e35('0x3a')],function(_0x446ef0){return{'name':_0x446ef0[_0x4e35('0x3b')],'type':_0x446ef0['type'][_0x4e35('0x3c')]};});_0x1d159d[_0x4e35('0x3d')]=_[_0x4e35('0x39')](_0x5f5887,_0x4e35('0x37'));_0x1d159d[_0x4e35('0x3e')]=_[_0x4e35('0x3f')](_0x14a2c7[_0x4e35('0x3e')]);_0x1d159d[_0x4e35('0x40')]=_[_0x4e35('0x41')](_0x1d159d[_0x4e35('0x3d')],_0x1d159d[_0x4e35('0x3e')]);_0x28154f[_0x4e35('0x42')]=_['intersection'](_0x1d159d[_0x4e35('0x3d')],qs['fields'](_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x43')]));_0x28154f[_0x4e35('0x42')]=_0x28154f['attributes'][_0x4e35('0x44')]?_0x28154f[_0x4e35('0x42')]:_0x1d159d[_0x4e35('0x3d')];if(!_0x14a2c7[_0x4e35('0x3e')]['hasOwnProperty'](_0x4e35('0x45'))){_0x28154f[_0x4e35('0x2e')]=qs[_0x4e35('0x2e')](_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x2e')]);_0x28154f[_0x4e35('0x2d')]=qs[_0x4e35('0x2d')](_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x2d')]);}_0x28154f['order']=qs['sort'](_0x14a2c7[_0x4e35('0x3e')]['sort']);_0x28154f['where']=qs[_0x4e35('0x40')](_[_0x4e35('0x46')](_0x14a2c7['query'],_0x1d159d[_0x4e35('0x40')]),_0x5f5887);if(_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x47')]){_0x28154f[_0x4e35('0x48')]=_['merge'](_0x28154f[_0x4e35('0x48')],{'$or':_[_0x4e35('0x39')](_0x5f5887,function(_0x3ed68a){if(_0x3ed68a[_0x4e35('0x49')]!==_0x4e35('0x4a')){var _0x26f456={};_0x26f456[_0x3ed68a[_0x4e35('0x37')]]={'$like':'%'+_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x47')]+'%'};return _0x26f456;}})});}_0x28154f=_[_0x4e35('0x4b')]({},_0x28154f,_0x14a2c7[_0x4e35('0x4c')]);var _0x2a2781={'where':_0x28154f[_0x4e35('0x48')]};return db[_0x4e35('0x4d')]['count'](_0x2a2781)[_0x4e35('0x1f')](function(_0x4d5391){_0x4e41a9['count']=_0x4d5391;if(_0x14a2c7[_0x4e35('0x3e')][_0x4e35('0x4e')]){_0x28154f[_0x4e35('0x4f')]=[{'all':!![]}];}return db[_0x4e35('0x4d')][_0x4e35('0x50')](_0x28154f);})[_0x4e35('0x1f')](function(_0x1eeaf6){_0x4e41a9['rows']=_0x1eeaf6;return _0x4e41a9;})[_0x4e35('0x1f')](respondWithFilteredResult(_0x5cc1de,_0x28154f))[_0x4e35('0x29')](handleError(_0x5cc1de,null));};exports[_0x4e35('0x51')]=function(_0x54383e,_0x549c17){var _0x45c55b={'raw':!![],'where':{'id':_0x54383e[_0x4e35('0x52')]['id']}},_0x7c5243={};_0x7c5243[_0x4e35('0x3d')]=_[_0x4e35('0x3f')](db[_0x4e35('0x4d')]['rawAttributes']);_0x7c5243[_0x4e35('0x3e')]=_[_0x4e35('0x3f')](_0x54383e['query']);_0x7c5243[_0x4e35('0x40')]=_['intersection'](_0x7c5243[_0x4e35('0x3d')],_0x7c5243['query']);_0x45c55b[_0x4e35('0x42')]=_[_0x4e35('0x41')](_0x7c5243['model'],qs['fields'](_0x54383e[_0x4e35('0x3e')]['fields']));_0x45c55b[_0x4e35('0x42')]=_0x45c55b[_0x4e35('0x42')]['length']?_0x45c55b[_0x4e35('0x42')]:_0x7c5243[_0x4e35('0x3d')];if(_0x54383e[_0x4e35('0x3e')]['includeAll']){_0x45c55b['include']=[{'all':!![]}];}_0x45c55b=_[_0x4e35('0x4b')]({},_0x45c55b,_0x54383e[_0x4e35('0x4c')]);return db[_0x4e35('0x4d')][_0x4e35('0x53')](_0x45c55b)[_0x4e35('0x1f')](handleEntityNotFound(_0x549c17,null))[_0x4e35('0x1f')](respondWithResult(_0x549c17,null))[_0x4e35('0x29')](handleError(_0x549c17,null));};exports['create']=function(_0xb27cd8,_0x4c74a){return db[_0x4e35('0x4d')][_0x4e35('0x54')](_0xb27cd8[_0x4e35('0x55')],{})['then'](respondWithResult(_0x4c74a,0xc9))['catch'](handleError(_0x4c74a,null));};exports['update']=function(_0x14f8dd,_0x475344){if(_0x14f8dd[_0x4e35('0x55')]['id']){delete _0x14f8dd[_0x4e35('0x55')]['id'];}return db[_0x4e35('0x4d')][_0x4e35('0x53')]({'where':{'id':_0x14f8dd[_0x4e35('0x52')]['id']}})[_0x4e35('0x1f')](handleEntityNotFound(_0x475344,null))[_0x4e35('0x1f')](saveUpdates(_0x14f8dd[_0x4e35('0x55')],null))[_0x4e35('0x1f')](respondWithResult(_0x475344,null))[_0x4e35('0x29')](handleError(_0x475344,null));};exports[_0x4e35('0x34')]=function(_0xb592f7,_0x109627){return db[_0x4e35('0x4d')][_0x4e35('0x53')]({'where':{'id':_0xb592f7[_0x4e35('0x52')]['id']}})[_0x4e35('0x1f')](handleEntityNotFound(_0x109627,null))[_0x4e35('0x1f')](removeEntity(_0x109627,null))[_0x4e35('0x29')](handleError(_0x109627,null));};exports[_0x4e35('0x56')]=function(_0x3c7199,_0x3e149e){return db[_0x4e35('0x4d')][_0x4e35('0x56')]()['then'](respondWithResult(_0x3e149e,null))[_0x4e35('0x29')](handleError(_0x3e149e,null));};var interaction_log=require(_0x4e35('0x12'))(_0x4e35('0x57'));exports[_0x4e35('0x58')]=function(_0x1151fc,_0x5d2b84,_0x10fafd){var _0x39ea66={'agent':{},'channel':_0x4e35('0x59')};if(_0x1151fc[_0x4e35('0x55')]['id']){delete _0x1151fc[_0x4e35('0x55')]['id'];}_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5a')]=!![];_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5b')]=moment()[_0x4e35('0x5c')](_0x4e35('0x5d'));_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5e')]=_0x1151fc[_0x4e35('0x55')]['UserId']||_0x1151fc[_0x4e35('0x5f')]['id'];_0x39ea66[_0x4e35('0x60')]['id']=_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5e')];return db['SmsMessage'][_0x4e35('0x53')]({'where':{'id':_0x1151fc[_0x4e35('0x52')]['id'],'UserId':null}})[_0x4e35('0x1f')](handleEntityNotFound(_0x5d2b84,null))['then'](saveUpdates(_0x1151fc['body'],null))[_0x4e35('0x1f')](function(_0x99cb1){if(_0x99cb1){_0x39ea66[_0x4e35('0x27')]=_0x99cb1[_0x4e35('0x61')]({'plain':!![]});return db['SmsInteraction'][_0x4e35('0x53')]({'where':{'id':_0x99cb1['SmsInteractionId']}});}return null;})[_0x4e35('0x1f')](handleEntityNotFound(_0x5d2b84,null))['then'](function(_0x4b9991){if(_0x4b9991){return _0x4b9991[_0x4e35('0x62')]({'UserId':_0x1151fc['body']['UserId'],'read1stAt':_[_0x4e35('0x63')](_0x4b9991[_0x4e35('0x64')])?moment()['format'](_0x4e35('0x5d')):undefined});}return null;})[_0x4e35('0x1f')](function(_0x193662){if(_0x193662){_0x39ea66[_0x4e35('0x65')]=_0x193662['get']({'plain':!![]});interaction_log['info'](_0x4e35('0x66'),_0x1151fc[_0x4e35('0x5f')]['id'],_0x1151fc[_0x4e35('0x5f')][_0x4e35('0x37')],_0x1151fc[_0x4e35('0x5f')][_0x4e35('0x67')],_0x39ea66[_0x4e35('0x65')]['id'],_0x1151fc[_0x4e35('0x55')]?JSON[_0x4e35('0x23')](_0x1151fc['body']):_0x4e35('0x68'));return respondWithRpcPromise(_0x4e35('0x69'),'acceptMessage',_0x39ea66);}return null;})[_0x4e35('0x1f')](function(_0x53350f){var _0x2dbc34=_0x4e35('0x6a')+_0x53350f[_0x4e35('0x27')][_0x4e35('0x6b')];return db[_0x4e35('0x6c')][_0x4e35('0x3e')](_0x2dbc34,{'type':db[_0x4e35('0x6d')][_0x4e35('0x6e')][_0x4e35('0x6f')],'raw':!![]})[_0x4e35('0x1f')](function(_0x495bab){return _0x495bab;});})['then'](function(_0x158a45){if(_0x158a45){_0x39ea66[_0x4e35('0x27')][_0x4e35('0x70')]=_0x158a45[0x0];if(!_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5e')])return;return db[_0x4e35('0x71')][_0x4e35('0x53')]({'where':{'id':_0x1151fc[_0x4e35('0x55')][_0x4e35('0x5e')],'role':'agent'},'attributes':['id','name',_0x4e35('0x72'),_0x4e35('0x73'),_0x4e35('0x74')],'raw':!![]});}return null;})[_0x4e35('0x1f')](function(_0x286db3){if(!_0x286db3)return null;_0x39ea66[_0x4e35('0x27')][_0x4e35('0x60')]=_0x286db3;return _0x39ea66;})[_0x4e35('0x1f')](function(_0x8660f3){if(_0x8660f3){if(_0x1151fc[_0x4e35('0x55')]['manual']){_0x39ea66[_0x4e35('0x27')][_0x4e35('0x75')]=util[_0x4e35('0x5c')](_0x4e35('0x76'),_0x1151fc['user'][_0x4e35('0x37')]);_0x39ea66[_0x4e35('0x27')][_0x4e35('0x77')]=_0x39ea66[_0x4e35('0x77')];_0x39ea66[_0x4e35('0x27')][_0x4e35('0x78')]=_0x39ea66[_0x4e35('0x77')];_0x39ea66[_0x4e35('0x27')][_0x4e35('0x79')]=_0x4e35('0x58');return respondWithRpcPromise('EventManager',_0x4e35('0x7a'),{'event':'acceptmessage','message':_0x39ea66['message']},client9002)[_0x4e35('0x1f')](function(){return _0x39ea66;});}return _0x39ea66;}return null;})[_0x4e35('0x1f')](respondWithResult(_0x5d2b84,null))[_0x4e35('0x29')](handleError(_0x5d2b84,null));};var interaction_log=require(_0x4e35('0x12'))('sms-interactions');exports['reject']=function(_0x407d03,_0x230713,_0x266c9d){var _0x820ebb={'agent':{},'channel':'sms'};if(_0x407d03['body']['id']){delete _0x407d03[_0x4e35('0x55')]['id'];}_0x407d03[_0x4e35('0x55')][_0x4e35('0x5e')]=_0x407d03['body'][_0x4e35('0x5e')]||_0x407d03[_0x4e35('0x5f')]['id'];_0x820ebb['agent']['id']=_0x407d03[_0x4e35('0x55')][_0x4e35('0x5e')];return db[_0x4e35('0x4d')][_0x4e35('0x53')]({'where':{'id':_0x407d03[_0x4e35('0x52')]['id'],'UserId':null}})[_0x4e35('0x1f')](handleEntityNotFound(_0x230713,null))[_0x4e35('0x1f')](function(_0x6f2a5b){if(_0x6f2a5b){_0x820ebb[_0x4e35('0x27')]=_0x6f2a5b[_0x4e35('0x61')]({'plain':!![]});return db[_0x4e35('0x7b')][_0x4e35('0x53')]({'where':{'id':_0x6f2a5b[_0x4e35('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x230713,null))[_0x4e35('0x1f')](function(_0x30563f){if(_0x30563f){_0x820ebb[_0x4e35('0x65')]=_0x30563f[_0x4e35('0x61')]({'plain':!![]});interaction_log['info'](_0x4e35('0x7d'),_0x407d03['user']['id'],_0x407d03['user'][_0x4e35('0x37')],_0x407d03['user']['role'],_0x820ebb[_0x4e35('0x65')]['id'],_0x407d03[_0x4e35('0x55')]?JSON[_0x4e35('0x23')](_0x407d03[_0x4e35('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x4e35('0x7e'),_0x820ebb);}return null;})['then'](function(_0x5db221){var _0x25d28a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5db221['message']['ContactId'];return db[_0x4e35('0x6c')]['query'](_0x25d28a,{'type':db[_0x4e35('0x6d')][_0x4e35('0x6e')]['SELECT'],'raw':!![]})[_0x4e35('0x1f')](function(_0x401775){return _0x401775;});})['then'](function(_0x283a00){if(_0x283a00){_0x820ebb['message'][_0x4e35('0x70')]=_0x283a00[0x0];if(!_0x407d03[_0x4e35('0x55')][_0x4e35('0x5e')])return;return db['User'][_0x4e35('0x53')]({'where':{'id':_0x407d03[_0x4e35('0x55')][_0x4e35('0x5e')],'role':_0x4e35('0x60')},'attributes':['id',_0x4e35('0x37'),_0x4e35('0x72'),_0x4e35('0x73'),_0x4e35('0x74')],'raw':!![]});}return null;})[_0x4e35('0x1f')](function(_0x27510a){if(!_0x27510a)return null;_0x820ebb['message'][_0x4e35('0x60')]=_0x27510a;return _0x820ebb;})[_0x4e35('0x1f')](function(_0x2bf9e8){if(_0x2bf9e8){_0x2bf9e8[_0x4e35('0x27')]['interface']=util[_0x4e35('0x5c')]('SIP/%s',_0x407d03[_0x4e35('0x5f')][_0x4e35('0x37')]);_0x2bf9e8[_0x4e35('0x27')]['channel']=_0x820ebb[_0x4e35('0x77')];_0x2bf9e8['message'][_0x4e35('0x78')]=_0x820ebb[_0x4e35('0x77')];_0x2bf9e8[_0x4e35('0x27')][_0x4e35('0x79')]=_0x4e35('0x32');respondWithRpcPromise('EventManager',_0x4e35('0x7a'),{'event':_0x4e35('0x7f'),'message':_0x2bf9e8[_0x4e35('0x27')]},client9002);return _0x820ebb;}return null;})['then'](respondWithResult(_0x230713,null))[_0x4e35('0x29')](handleError(_0x230713,null));};exports['status']=function(_0x5763c0,_0x40f4b2,_0x2d8914){if(_0x5763c0[_0x4e35('0x55')]['id']){delete _0x5763c0['body']['id'];}var _0x2472ab;return db[_0x4e35('0x4d')]['find']({'where':{'id':_0x5763c0[_0x4e35('0x52')]['id']}})[_0x4e35('0x1f')](handleEntityNotFound(_0x40f4b2,null))[_0x4e35('0x1f')](function(_0xbb1035){if(_0xbb1035){_0x2472ab=_0xbb1035;return db[_0x4e35('0x80')][_0x4e35('0x53')]({'where':{'id':_0xbb1035[_0x4e35('0x81')]}});}})[_0x4e35('0x1f')](handleEntityNotFound(_0x40f4b2,null))[_0x4e35('0x1f')](function(_0x4bde20){if(_0x4bde20){logger[_0x4e35('0x21')](_0x4e35('0x82'),_0x4e35('0x2a'),_0x4e35('0x83'),_0x4bde20[_0x4e35('0x49')],util['inspect'](_0x5763c0[_0x4e35('0x55')],{'showHidden':![],'depth':null}));switch(_0x4bde20[_0x4e35('0x49')]){case _0x4e35('0x84'):if(_0x5763c0[_0x4e35('0x55')]['MessageSid']&&_0x5763c0[_0x4e35('0x55')][_0x4e35('0x85')]===_0x2472ab['messageId']){return _0x2472ab[_0x4e35('0x62')]({'read':!![]});}else{logger[_0x4e35('0x24')](_0x4e35('0x86'),_0x4e35('0x2a'),_0x4e35('0x84'),util[_0x4e35('0x87')](_0x5763c0[_0x4e35('0x55')],{'showHidden':![],'depth':null}));}break;case _0x4e35('0x88'):if(_0x5763c0[_0x4e35('0x55')][_0x4e35('0x89')]&&_0x5763c0[_0x4e35('0x55')]['MessageUUID']===_0x2472ab['messageId']&&_[_0x4e35('0x8a')]([_0x4e35('0x8b'),_0x4e35('0x8c')],_0x5763c0[_0x4e35('0x55')][_0x4e35('0x8d')])>=0x0){return _0x2472ab[_0x4e35('0x62')]({'read':!![]});}else{logger[_0x4e35('0x24')](_0x4e35('0x86'),_0x4e35('0x2a'),_0x4e35('0x8e'),util[_0x4e35('0x87')](_0x5763c0[_0x4e35('0x55')],{'showHidden':![],'depth':null}));}break;case _0x4e35('0x8f'):var _0x3d3ff3=_0x5763c0[_0x4e35('0x55')][_0x4e35('0x90')][0x0];if(_0x3d3ff3[_0x4e35('0x2a')][_0x4e35('0x91')]===_0x4e35('0x92')){return _0x2472ab[_0x4e35('0x62')]({'read':!![]});}else{logger[_0x4e35('0x24')](_0x4e35('0x86'),_0x4e35('0x2a'),_0x4e35('0x8f'),util['inspect'](_0x5763c0[_0x4e35('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2472ab;}})['then'](respondWithResult(_0x40f4b2,null))[_0x4e35('0x29')](handleError(_0x40f4b2,null));}; \ No newline at end of file +var _0x6606=['json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','name','send','index','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','create','body','update','params','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','User','agent','email','manual','interface','channel','event','EventManager','acceptmessage','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','QueryTypes','SELECT','fullname','SIP/%s','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','SmsMessage,\x20%s,\x20%s','catch','sendStatus','end'];(function(_0x3e1ece,_0x321203){var _0x7be675=function(_0x5480b2){while(--_0x5480b2){_0x3e1ece['push'](_0x3e1ece['shift']());}};_0x7be675(++_0x321203);}(_0x6606,0x6a));var _0x6660=function(_0x4649ca,_0x45c299){_0x4649ca=_0x4649ca-0x0;var _0x71f7cc=_0x6606[_0x4649ca];return _0x71f7cc;};'use strict';var emlformat=require(_0x6660('0x0'));var rimraf=require(_0x6660('0x1'));var zipdir=require(_0x6660('0x2'));var jsonpatch=require(_0x6660('0x3'));var rp=require(_0x6660('0x4'));var moment=require(_0x6660('0x5'));var BPromise=require(_0x6660('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6660('0x7'));var sox=require('sox');var csv=require(_0x6660('0x8'));var ejs=require(_0x6660('0x9'));var fs=require('fs');var fs_extra=require(_0x6660('0xa'));var _=require(_0x6660('0xb'));var squel=require('squel');var crypto=require(_0x6660('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6660('0x8'));var querystring=require(_0x6660('0xd'));var Papa=require(_0x6660('0xe'));var Redis=require(_0x6660('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6660('0x10'));var logger=require('../../config/logger')(_0x6660('0x11'));var utils=require(_0x6660('0x12'));var config=require(_0x6660('0x13'));var licenseUtil=require(_0x6660('0x14'));var db=require('../../mysqldb')['db'];config[_0x6660('0x15')]=_['defaults'](config[_0x6660('0x15')],{'host':_0x6660('0x16'),'port':0x18eb});var socket=require(_0x6660('0x17'))(new Redis(config[_0x6660('0x15')]));require(_0x6660('0x18'))['register'](socket);var jayson=require(_0x6660('0x19'));var client=jayson[_0x6660('0x1a')][_0x6660('0x1b')]({'port':0x232c});var client9002=jayson[_0x6660('0x1a')][_0x6660('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x116a22,_0x414abc,_0x34551e,_0x531d78){return new BPromise(function(_0x41d891,_0x125bba){var _0x85bc01=_0x531d78||client;return _0x85bc01[_0x6660('0x1c')](_0x116a22,_0x34551e)[_0x6660('0x1d')](function(_0x1bf802){logger[_0x6660('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x414abc,_0x6660('0x1f'));logger[_0x6660('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x414abc,'request\x20sent',JSON['stringify'](_0x1bf802));if(_0x1bf802[_0x6660('0x21')]){if(_0x1bf802['error']['code']===0x1f4){logger[_0x6660('0x21')]('SmsMessage,\x20%s,\x20%s',_0x414abc,_0x1bf802['error'][_0x6660('0x22')]);return _0x125bba(_0x1bf802[_0x6660('0x21')][_0x6660('0x22')]);}logger[_0x6660('0x21')](_0x6660('0x23'),_0x414abc,_0x1bf802[_0x6660('0x21')]['message']);return _0x41d891(_0x1bf802[_0x6660('0x21')][_0x6660('0x22')]);}else{logger[_0x6660('0x1e')](_0x6660('0x23'),_0x414abc,_0x6660('0x1f'));_0x41d891(_0x1bf802['result'][_0x6660('0x22')]);}})[_0x6660('0x24')](function(_0x323a4a){logger['error']('SmsMessage,\x20%s,\x20%s',_0x414abc,_0x323a4a);_0x125bba(_0x323a4a);});});}function respondWithStatusCode(_0x520f8f,_0x53736c){_0x53736c=_0x53736c||0xcc;return function(_0x5b8c3b){if(_0x5b8c3b){return _0x520f8f[_0x6660('0x25')](_0x53736c);}return _0x520f8f['status'](_0x53736c)[_0x6660('0x26')]();};}function respondWithResult(_0x5c8b81,_0x141b6d){_0x141b6d=_0x141b6d||0xc8;return function(_0x29ece6){if(_0x29ece6){return _0x5c8b81['status'](_0x141b6d)[_0x6660('0x27')](_0x29ece6);}};}function respondWithFilteredResult(_0x25be51,_0x4b782c){return function(_0xbd7375){if(_0xbd7375){var _0x58a20f=typeof _0x4b782c[_0x6660('0x28')]===_0x6660('0x29')&&typeof _0x4b782c[_0x6660('0x2a')]===_0x6660('0x29');var _0x5662ea=_0xbd7375[_0x6660('0x2b')];var _0x34f9d3=_0x58a20f?0x0:_0x4b782c[_0x6660('0x28')];var _0x1c27da=_0x58a20f?_0xbd7375[_0x6660('0x2b')]:_0x4b782c[_0x6660('0x28')]+_0x4b782c[_0x6660('0x2a')];var _0x19e756;if(_0x1c27da>=_0x5662ea){_0x1c27da=_0x5662ea;_0x19e756=0xc8;}else{_0x19e756=0xce;}_0x25be51[_0x6660('0x2c')](_0x19e756);return _0x25be51[_0x6660('0x2d')](_0x6660('0x2e'),_0x34f9d3+'-'+_0x1c27da+'/'+_0x5662ea)[_0x6660('0x27')](_0xbd7375);}return null;};}function patchUpdates(_0x33b3e2){return function(_0x432828){try{jsonpatch[_0x6660('0x2f')](_0x432828,_0x33b3e2,!![]);}catch(_0x22f8f8){return BPromise[_0x6660('0x30')](_0x22f8f8);}return _0x432828[_0x6660('0x31')]();};}function saveUpdates(_0x44cb5c,_0x3c8761){return function(_0x1864b2){if(_0x1864b2){return _0x1864b2['update'](_0x44cb5c)[_0x6660('0x1d')](function(_0x2c0c63){return _0x2c0c63;});}return null;};}function removeEntity(_0xfc404c,_0x17fef1){return function(_0x4568eb){if(_0x4568eb){return _0x4568eb[_0x6660('0x32')]()['then'](function(){_0xfc404c['status'](0xcc)[_0x6660('0x26')]();});}};}function handleEntityNotFound(_0x147bb8,_0x39f0c3){return function(_0x46fa86){if(!_0x46fa86){_0x147bb8[_0x6660('0x25')](0x194);}return _0x46fa86;};}function handleError(_0x2fc96f,_0x1f745b){_0x1f745b=_0x1f745b||0x1f4;return function(_0x3c050a){logger[_0x6660('0x21')](_0x3c050a['stack']);if(_0x3c050a[_0x6660('0x33')]){delete _0x3c050a[_0x6660('0x33')];}_0x2fc96f[_0x6660('0x2c')](_0x1f745b)[_0x6660('0x34')](_0x3c050a);};}exports[_0x6660('0x35')]=function(_0x47fd1,_0x4a42a0){var _0x352af5={},_0x1d0b97={},_0x1723c1={'count':0x0,'rows':[]};var _0x5dc5c5=_[_0x6660('0x36')](db[_0x6660('0x37')]['rawAttributes'],function(_0x489f13){return{'name':_0x489f13[_0x6660('0x38')],'type':_0x489f13[_0x6660('0x39')][_0x6660('0x3a')]};});_0x1d0b97[_0x6660('0x3b')]=_['map'](_0x5dc5c5,_0x6660('0x33'));_0x1d0b97[_0x6660('0x3c')]=_[_0x6660('0x3d')](_0x47fd1[_0x6660('0x3c')]);_0x1d0b97[_0x6660('0x3e')]=_[_0x6660('0x3f')](_0x1d0b97[_0x6660('0x3b')],_0x1d0b97[_0x6660('0x3c')]);_0x352af5[_0x6660('0x40')]=_[_0x6660('0x3f')](_0x1d0b97[_0x6660('0x3b')],qs[_0x6660('0x41')](_0x47fd1[_0x6660('0x3c')][_0x6660('0x41')]));_0x352af5[_0x6660('0x40')]=_0x352af5[_0x6660('0x40')][_0x6660('0x42')]?_0x352af5['attributes']:_0x1d0b97['model'];if(!_0x47fd1[_0x6660('0x3c')][_0x6660('0x43')](_0x6660('0x44'))){_0x352af5[_0x6660('0x2a')]=qs['limit'](_0x47fd1['query'][_0x6660('0x2a')]);_0x352af5[_0x6660('0x28')]=qs[_0x6660('0x28')](_0x47fd1[_0x6660('0x3c')][_0x6660('0x28')]);}_0x352af5['order']=qs[_0x6660('0x45')](_0x47fd1[_0x6660('0x3c')][_0x6660('0x45')]);_0x352af5['where']=qs[_0x6660('0x3e')](_[_0x6660('0x46')](_0x47fd1[_0x6660('0x3c')],_0x1d0b97[_0x6660('0x3e')]),_0x5dc5c5);if(_0x47fd1[_0x6660('0x3c')][_0x6660('0x47')]){_0x352af5[_0x6660('0x48')]=_[_0x6660('0x49')](_0x352af5[_0x6660('0x48')],{'$or':_['map'](_0x5dc5c5,function(_0x3d812f){if(_0x3d812f[_0x6660('0x39')]!==_0x6660('0x4a')){var _0x39c722={};_0x39c722[_0x3d812f[_0x6660('0x33')]]={'$like':'%'+_0x47fd1[_0x6660('0x3c')]['filter']+'%'};return _0x39c722;}})});}_0x352af5=_[_0x6660('0x49')]({},_0x352af5,_0x47fd1[_0x6660('0x4b')]);var _0x2e3ee5={'where':_0x352af5['where']};return db[_0x6660('0x37')][_0x6660('0x2b')](_0x2e3ee5)[_0x6660('0x1d')](function(_0x12f894){_0x1723c1[_0x6660('0x2b')]=_0x12f894;if(_0x47fd1['query'][_0x6660('0x4c')]){_0x352af5[_0x6660('0x4d')]=[{'all':!![]}];}return db[_0x6660('0x37')][_0x6660('0x4e')](_0x352af5);})[_0x6660('0x1d')](function(_0x1849fb){_0x1723c1[_0x6660('0x4f')]=_0x1849fb;return _0x1723c1;})[_0x6660('0x1d')](respondWithFilteredResult(_0x4a42a0,_0x352af5))[_0x6660('0x24')](handleError(_0x4a42a0,null));};exports['show']=function(_0x4d1abe,_0x3c7813){var _0x1d79fb={'raw':!![],'where':{'id':_0x4d1abe['params']['id']}},_0x208268={};_0x208268[_0x6660('0x3b')]=_[_0x6660('0x3d')](db[_0x6660('0x37')][_0x6660('0x50')]);_0x208268[_0x6660('0x3c')]=_[_0x6660('0x3d')](_0x4d1abe['query']);_0x208268[_0x6660('0x3e')]=_[_0x6660('0x3f')](_0x208268['model'],_0x208268[_0x6660('0x3c')]);_0x1d79fb[_0x6660('0x40')]=_[_0x6660('0x3f')](_0x208268['model'],qs[_0x6660('0x41')](_0x4d1abe['query']['fields']));_0x1d79fb[_0x6660('0x40')]=_0x1d79fb[_0x6660('0x40')][_0x6660('0x42')]?_0x1d79fb[_0x6660('0x40')]:_0x208268[_0x6660('0x3b')];if(_0x4d1abe[_0x6660('0x3c')]['includeAll']){_0x1d79fb['include']=[{'all':!![]}];}_0x1d79fb=_[_0x6660('0x49')]({},_0x1d79fb,_0x4d1abe['options']);return db['SmsMessage'][_0x6660('0x51')](_0x1d79fb)[_0x6660('0x1d')](handleEntityNotFound(_0x3c7813,null))[_0x6660('0x1d')](respondWithResult(_0x3c7813,null))['catch'](handleError(_0x3c7813,null));};exports['create']=function(_0x4ae38a,_0x5d270a){return db['SmsMessage'][_0x6660('0x52')](_0x4ae38a[_0x6660('0x53')],{})[_0x6660('0x1d')](respondWithResult(_0x5d270a,0xc9))[_0x6660('0x24')](handleError(_0x5d270a,null));};exports[_0x6660('0x54')]=function(_0x3b7c17,_0x2df982){if(_0x3b7c17[_0x6660('0x53')]['id']){delete _0x3b7c17['body']['id'];}return db[_0x6660('0x37')][_0x6660('0x51')]({'where':{'id':_0x3b7c17['params']['id']}})['then'](handleEntityNotFound(_0x2df982,null))[_0x6660('0x1d')](saveUpdates(_0x3b7c17[_0x6660('0x53')],null))[_0x6660('0x1d')](respondWithResult(_0x2df982,null))[_0x6660('0x24')](handleError(_0x2df982,null));};exports[_0x6660('0x32')]=function(_0x5377f5,_0xf1d80a){return db['SmsMessage'][_0x6660('0x51')]({'where':{'id':_0x5377f5[_0x6660('0x55')]['id']}})[_0x6660('0x1d')](handleEntityNotFound(_0xf1d80a,null))[_0x6660('0x1d')](removeEntity(_0xf1d80a,null))[_0x6660('0x24')](handleError(_0xf1d80a,null));};exports[_0x6660('0x56')]=function(_0x31f962,_0x140ac1){return db[_0x6660('0x37')][_0x6660('0x56')]()[_0x6660('0x1d')](respondWithResult(_0x140ac1,null))[_0x6660('0x24')](handleError(_0x140ac1,null));};var interaction_log=require(_0x6660('0x57'))(_0x6660('0x58'));exports[_0x6660('0x59')]=function(_0x2667dd,_0x4d323e,_0x5cfedf){var _0x36c6d3={'agent':{},'channel':_0x6660('0x5a')};if(_0x2667dd[_0x6660('0x53')]['id']){delete _0x2667dd[_0x6660('0x53')]['id'];}_0x2667dd['body'][_0x6660('0x5b')]=!![];_0x2667dd[_0x6660('0x53')][_0x6660('0x5c')]=moment()[_0x6660('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2667dd[_0x6660('0x53')][_0x6660('0x5e')]=_0x2667dd['body'][_0x6660('0x5e')]||_0x2667dd[_0x6660('0x5f')]['id'];_0x36c6d3['agent']['id']=_0x2667dd['body']['UserId'];return db[_0x6660('0x37')][_0x6660('0x51')]({'where':{'id':_0x2667dd['params']['id'],'UserId':null}})[_0x6660('0x1d')](handleEntityNotFound(_0x4d323e,null))[_0x6660('0x1d')](saveUpdates(_0x2667dd[_0x6660('0x53')],null))[_0x6660('0x1d')](function(_0x1186d3){if(_0x1186d3){_0x36c6d3[_0x6660('0x22')]=_0x1186d3['get']({'plain':!![]});return db['SmsInteraction'][_0x6660('0x51')]({'where':{'id':_0x1186d3[_0x6660('0x60')]}});}return null;})[_0x6660('0x1d')](handleEntityNotFound(_0x4d323e,null))[_0x6660('0x1d')](function(_0x53d3a1){if(_0x53d3a1){return _0x53d3a1[_0x6660('0x54')]({'UserId':_0x2667dd[_0x6660('0x53')]['UserId'],'read1stAt':_[_0x6660('0x61')](_0x53d3a1['read1stAt'])?moment()[_0x6660('0x5d')](_0x6660('0x62')):undefined});}return null;})[_0x6660('0x1d')](function(_0x2b6fa0){if(_0x2b6fa0){_0x36c6d3[_0x6660('0x63')]=_0x2b6fa0['get']({'plain':!![]});interaction_log['info'](_0x6660('0x64'),_0x2667dd[_0x6660('0x5f')]['id'],_0x2667dd[_0x6660('0x5f')]['name'],_0x2667dd['user'][_0x6660('0x65')],_0x36c6d3[_0x6660('0x63')]['id'],_0x2667dd['body']?JSON[_0x6660('0x66')](_0x2667dd[_0x6660('0x53')]):_0x6660('0x67'));return respondWithRpcPromise(_0x6660('0x68'),_0x6660('0x69'),_0x36c6d3);}return null;})[_0x6660('0x1d')](function(_0x1f54df){var _0x122462=_0x6660('0x6a')+_0x1f54df[_0x6660('0x22')]['ContactId'];return db[_0x6660('0x6b')][_0x6660('0x3c')](_0x122462,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x6660('0x1d')](function(_0x945c1a){return _0x945c1a;});})['then'](function(_0x2ffbe6){if(_0x2ffbe6){_0x36c6d3[_0x6660('0x22')][_0x6660('0x6c')]=_0x2ffbe6[0x0];if(!_0x2667dd['body'][_0x6660('0x5e')])return;return db[_0x6660('0x6d')][_0x6660('0x51')]({'where':{'id':_0x2667dd[_0x6660('0x53')]['UserId'],'role':_0x6660('0x6e')},'attributes':['id',_0x6660('0x33'),'fullname',_0x6660('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1565d3){if(!_0x1565d3)return null;_0x36c6d3[_0x6660('0x22')]['agent']=_0x1565d3;return _0x36c6d3;})[_0x6660('0x1d')](function(_0x2bb49c){if(_0x2bb49c){if(_0x2667dd[_0x6660('0x53')][_0x6660('0x70')]){_0x36c6d3[_0x6660('0x22')][_0x6660('0x71')]=util[_0x6660('0x5d')]('SIP/%s',_0x2667dd[_0x6660('0x5f')][_0x6660('0x33')]);_0x36c6d3[_0x6660('0x22')][_0x6660('0x72')]=_0x36c6d3[_0x6660('0x72')];_0x36c6d3['message']['motionChannel']=_0x36c6d3[_0x6660('0x72')];_0x36c6d3['message'][_0x6660('0x73')]='accept';return respondWithRpcPromise(_0x6660('0x74'),_0x6660('0x74'),{'event':_0x6660('0x75'),'message':_0x36c6d3[_0x6660('0x22')]},client9002)[_0x6660('0x1d')](function(){return _0x36c6d3;});}return _0x36c6d3;}return null;})[_0x6660('0x1d')](respondWithResult(_0x4d323e,null))[_0x6660('0x24')](handleError(_0x4d323e,null));};var interaction_log=require(_0x6660('0x57'))(_0x6660('0x58'));exports[_0x6660('0x30')]=function(_0x9b4c08,_0x5bf4f4,_0x164edf){var _0x56d8cf={'agent':{},'channel':'sms'};if(_0x9b4c08['body']['id']){delete _0x9b4c08[_0x6660('0x53')]['id'];}_0x9b4c08[_0x6660('0x53')][_0x6660('0x5e')]=_0x9b4c08[_0x6660('0x53')]['UserId']||_0x9b4c08[_0x6660('0x5f')]['id'];_0x56d8cf['agent']['id']=_0x9b4c08[_0x6660('0x53')][_0x6660('0x5e')];return db[_0x6660('0x37')]['find']({'where':{'id':_0x9b4c08[_0x6660('0x55')]['id'],'UserId':null}})[_0x6660('0x1d')](handleEntityNotFound(_0x5bf4f4,null))['then'](function(_0x29715d){if(_0x29715d){_0x56d8cf[_0x6660('0x22')]=_0x29715d[_0x6660('0x76')]({'plain':!![]});return db['SmsInteraction'][_0x6660('0x51')]({'where':{'id':_0x29715d['SmsInteractionId']}});}return null;})[_0x6660('0x1d')](handleEntityNotFound(_0x5bf4f4,null))[_0x6660('0x1d')](function(_0x3076a4){if(_0x3076a4){_0x56d8cf[_0x6660('0x63')]=_0x3076a4[_0x6660('0x76')]({'plain':!![]});interaction_log[_0x6660('0x1e')](_0x6660('0x77'),_0x9b4c08['user']['id'],_0x9b4c08['user'][_0x6660('0x33')],_0x9b4c08['user']['role'],_0x56d8cf[_0x6660('0x63')]['id'],_0x9b4c08[_0x6660('0x53')]?JSON[_0x6660('0x66')](_0x9b4c08[_0x6660('0x53')]):_0x6660('0x67'));return respondWithRpcPromise('RejectMessage',_0x6660('0x78'),_0x56d8cf);}return null;})[_0x6660('0x1d')](function(_0x1a3b82){var _0xbf675='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1a3b82['message'][_0x6660('0x79')];return db[_0x6660('0x6b')][_0x6660('0x3c')](_0xbf675,{'type':db['Sequelize'][_0x6660('0x7a')][_0x6660('0x7b')],'raw':!![]})[_0x6660('0x1d')](function(_0x38d6a9){return _0x38d6a9;});})[_0x6660('0x1d')](function(_0x430ec2){if(_0x430ec2){_0x56d8cf['message'][_0x6660('0x6c')]=_0x430ec2[0x0];if(!_0x9b4c08['body'][_0x6660('0x5e')])return;return db[_0x6660('0x6d')][_0x6660('0x51')]({'where':{'id':_0x9b4c08['body'][_0x6660('0x5e')],'role':'agent'},'attributes':['id',_0x6660('0x33'),_0x6660('0x7c'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x419035){if(!_0x419035)return null;_0x56d8cf[_0x6660('0x22')][_0x6660('0x6e')]=_0x419035;return _0x56d8cf;})[_0x6660('0x1d')](function(_0x3a992e){if(_0x3a992e){_0x3a992e[_0x6660('0x22')][_0x6660('0x71')]=util[_0x6660('0x5d')](_0x6660('0x7d'),_0x9b4c08[_0x6660('0x5f')][_0x6660('0x33')]);_0x3a992e[_0x6660('0x22')][_0x6660('0x72')]=_0x56d8cf[_0x6660('0x72')];_0x3a992e[_0x6660('0x22')]['motionChannel']=_0x56d8cf[_0x6660('0x72')];_0x3a992e[_0x6660('0x22')][_0x6660('0x73')]=_0x6660('0x30');respondWithRpcPromise(_0x6660('0x74'),_0x6660('0x74'),{'event':_0x6660('0x7e'),'message':_0x3a992e[_0x6660('0x22')]},client9002);return _0x56d8cf;}return null;})[_0x6660('0x1d')](respondWithResult(_0x5bf4f4,null))[_0x6660('0x24')](handleError(_0x5bf4f4,null));};exports[_0x6660('0x2c')]=function(_0x3b59b8,_0x168a08,_0x325bf3){if(_0x3b59b8[_0x6660('0x53')]['id']){delete _0x3b59b8['body']['id'];}var _0x15c059;return db[_0x6660('0x37')][_0x6660('0x51')]({'where':{'id':_0x3b59b8[_0x6660('0x55')]['id']}})[_0x6660('0x1d')](handleEntityNotFound(_0x168a08,null))['then'](function(_0x4a4433){if(_0x4a4433){_0x15c059=_0x4a4433;return db[_0x6660('0x7f')][_0x6660('0x51')]({'where':{'id':_0x4a4433['SmsAccountId']}});}})[_0x6660('0x1d')](handleEntityNotFound(_0x168a08,null))['then'](function(_0x57248a){if(_0x57248a){logger[_0x6660('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6660('0x2c'),_0x6660('0x80'),_0x57248a[_0x6660('0x39')],util['inspect'](_0x3b59b8[_0x6660('0x53')],{'showHidden':![],'depth':null}));switch(_0x57248a[_0x6660('0x39')]){case _0x6660('0x81'):if(_0x3b59b8['body'][_0x6660('0x82')]&&_0x3b59b8[_0x6660('0x53')][_0x6660('0x82')]===_0x15c059[_0x6660('0x83')]){return _0x15c059[_0x6660('0x54')]({'read':!![]});}else{logger[_0x6660('0x21')](_0x6660('0x84'),_0x6660('0x2c'),'twilio',util[_0x6660('0x85')](_0x3b59b8[_0x6660('0x53')],{'showHidden':![],'depth':null}));}break;case _0x6660('0x86'):if(_0x3b59b8['body']['MessageUUID']&&_0x3b59b8[_0x6660('0x53')][_0x6660('0x87')]===_0x15c059[_0x6660('0x83')]&&_[_0x6660('0x88')]([_0x6660('0x89'),_0x6660('0x8a')],_0x3b59b8[_0x6660('0x53')][_0x6660('0x8b')])>=0x0){return _0x15c059['update']({'read':!![]});}else{logger[_0x6660('0x21')](_0x6660('0x84'),_0x6660('0x2c'),_0x6660('0x8c'),util[_0x6660('0x85')](_0x3b59b8['body'],{'showHidden':![],'depth':null}));}break;case _0x6660('0x8d'):var _0x1335e8=_0x3b59b8[_0x6660('0x53')][_0x6660('0x8e')][0x0];if(_0x1335e8[_0x6660('0x2c')][_0x6660('0x8f')]===_0x6660('0x90')){return _0x15c059[_0x6660('0x54')]({'read':!![]});}else{logger['error'](_0x6660('0x84'),'status',_0x6660('0x8d'),util[_0x6660('0x85')](_0x3b59b8['body'],{'showHidden':![],'depth':null}));}break;}return _0x15c059;}})['then'](respondWithResult(_0x168a08,null))[_0x6660('0x24')](handleError(_0x168a08,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e98d1fa..1f1ab01 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 _0x8f4d=['../../mysqldb','SmsMessage','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x4ef395,_0x45faed){var _0x155d7d=function(_0x562ca0){while(--_0x562ca0){_0x4ef395['push'](_0x4ef395['shift']());}};_0x155d7d(++_0x45faed);}(_0x8f4d,0x117));var _0xd8f4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f4d[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xd8f4('0x0'));var SmsMessage=require(_0xd8f4('0x1'))['db'][_0xd8f4('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd8f4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8f4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f2c16){return function(_0x59ae54,_0xcbe2b5,_0xf8dede){SmsMessageEvents[_0xd8f4('0x5')](_0x5f2c16+':'+_0x59ae54['id'],_0x59ae54);SmsMessageEvents[_0xd8f4('0x5')](_0x5f2c16,_0x59ae54);_0xf8dede(null);};}for(var e in events){if(events[_0xd8f4('0x6')](e)){var event=events[e];SmsMessage[_0xd8f4('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xaefe=['hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','remove','emit'];(function(_0x36b8da,_0x4162ce){var _0x4c95d5=function(_0x47c093){while(--_0x47c093){_0x36b8da['push'](_0x36b8da['shift']());}};_0x4c95d5(++_0x4162ce);}(_0xaefe,0x113));var _0xeaef=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xaefe[_0x3c8e9a];return _0x2d4c57;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xeaef('0x0'))['db'][_0xeaef('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xeaef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeaef('0x3')};function emitEvent(_0x4758ab){return function(_0x1dc9fb,_0x2766fb,_0x4e3159){SmsMessageEvents[_0xeaef('0x4')](_0x4758ab+':'+_0x1dc9fb['id'],_0x1dc9fb);SmsMessageEvents[_0xeaef('0x4')](_0x4758ab,_0x1dc9fb);_0x4e3159(null);};}for(var e in events){if(events[_0xeaef('0x5')](e)){var event=events[e];SmsMessage[_0xeaef('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index abd4978..a1c000b 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 _0xce03=['phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','split','sms','POST','user_key','session_key','deliveryReport','read','skebby','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','csc','crypto','apiKey','login','sender','text','keys','sort','length','createHash','md5','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken'];(function(_0x44166f,_0x3e71e2){var _0x5f390a=function(_0x4876fb){while(--_0x4876fb){_0x44166f['push'](_0x44166f['shift']());}};_0x5f390a(++_0x3e71e2);}(_0xce03,0x1b9));var _0x3ce0=function(_0x9cc5d8,_0x11b7ef){_0x9cc5d8=_0x9cc5d8-0x0;var _0x57109b=_0xce03[_0x9cc5d8];return _0x57109b;};'use strict';var _=require('lodash');var util=require(_0x3ce0('0x0'));var logger=require(_0x3ce0('0x1'))(_0x3ce0('0x2'));var moment=require(_0x3ce0('0x3'));var BPromise=require(_0x3ce0('0x4'));var rp=require(_0x3ce0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ce0('0x6'));var config=require(_0x3ce0('0x7'));var attributes=require('./smsMessage.attributes');module[_0x3ce0('0x8')]=function(_0x457218,_0x886984){return _0x457218[_0x3ce0('0x9')](_0x3ce0('0xa'),attributes,{'tableName':_0x3ce0('0xb'),'paranoid':![],'indexes':[{'name':_0x3ce0('0xc'),'fields':[_0x3ce0('0xc')]},{'name':_0x3ce0('0xd'),'fields':[_0x3ce0('0xe')],'type':_0x3ce0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22a44f,_0x9a9360,_0x5c8dc3){var _0xa1d377=_0x457218[_0x3ce0('0x10')];var _0x4b2533=_0x22a44f['get']({'plain':!![]});if(_0x4b2533[_0x3ce0('0x11')][_0x3ce0('0x12')]()==='in'||_0x4b2533['direction'][_0x3ce0('0x12')]()===_0x3ce0('0x13')&&!_0x4b2533[_0x3ce0('0x14')]&&!_[_0x3ce0('0x15')](_0x4b2533[_0x3ce0('0x16')])&&!_[_0x3ce0('0x15')](_0x4b2533['SmsInteractionId'])){_0xa1d377[_0x3ce0('0x17')]['findOne']({'where':{'id':_0x4b2533[_0x3ce0('0x18')]}})[_0x3ce0('0x19')](function(_0x37d412){if(_0x37d412){_0x37d412[_0x3ce0('0x1a')]({'lastMsgAt':_0x4b2533['createdAt'],'lastMsgDirection':_0x4b2533[_0x3ce0('0x11')][_0x3ce0('0x12')]()});}})['catch'](function(_0x29079c){console[_0x3ce0('0x1b')](_0x29079c);});}if(_0x4b2533[_0x3ce0('0x11')]===_0x3ce0('0x13')&&!_0x4b2533[_0x3ce0('0x14')]){var _0x2ba171;_0xa1d377[_0x3ce0('0x1c')][_0x3ce0('0x1d')]({'where':{'id':_0x4b2533[_0x3ce0('0x1e')]},'raw':!![]})[_0x3ce0('0x19')](function(_0x57c338){_0x2ba171=_0x57c338;if(_0x2ba171&&_0x2ba171['type']){switch(_0x2ba171[_0x3ce0('0x1f')]){case _0x3ce0('0x20'):var _0x9c1b6d=require('twilio');if(_0x2ba171[_0x3ce0('0x21')]&&_0x2ba171[_0x3ce0('0x22')]&&_0x2ba171[_0x3ce0('0x23')]){var _0x11341c=new _0x9c1b6d(_0x2ba171[_0x3ce0('0x21')],_0x2ba171[_0x3ce0('0x22')]);_0x11341c[_0x3ce0('0x24')][_0x3ce0('0x25')]({'body':_0x4b2533[_0x3ce0('0xe')],'to':_0x4b2533[_0x3ce0('0x23')],'from':_0x2ba171['phone'],'statusCallback':_0x2ba171[_0x3ce0('0x26')]+_0x3ce0('0x27')+_0x4b2533['id']+_0x3ce0('0x28')+_0x2ba171[_0x3ce0('0x29')]})[_0x3ce0('0x19')](function(_0x46365c){if(_0x46365c[_0x3ce0('0x2a')]){return _0x22a44f[_0x3ce0('0x1a')]({'messageId':_0x46365c['sid']});}})['catch'](function(_0xd23f41){logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'twilio',util[_0x3ce0('0x2d')](_0xd23f41,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x1c3a02=_0x3ce0('0x2e');if(_0x2ba171[_0x3ce0('0x2f')]&&_0x2ba171['password']){var _0x516ae5={'recipient':[_0x4b2533[_0x3ce0('0x23')]],'message':_0x4b2533[_0x3ce0('0xe')],'message_type':_0x2ba171['smsMethod']};if(_0x2ba171[_0x3ce0('0x30')]&&_0x2ba171[_0x3ce0('0x30')]!=='SI'){_0x516ae5['sender']=_0x2ba171[_0x3ce0('0x23')];}var _0x114c24={'url':_0x1c3a02+_0x3ce0('0x31')+_0x2ba171[_0x3ce0('0x2f')]+_0x3ce0('0x32')+_0x2ba171[_0x3ce0('0x33')],'method':'GET'};rp(_0x114c24)[_0x3ce0('0x19')](function(_0x40d8a5){var _0x218f7f=_0x40d8a5[_0x3ce0('0x34')](';');var _0x1c52f2={'user_key':_0x218f7f[0x0],'session_key':_0x218f7f[0x1]};_0x114c24={'url':_0x1c3a02+_0x3ce0('0x35'),'method':_0x3ce0('0x36'),'headers':{'user_key':_0x1c52f2[_0x3ce0('0x37')],'Session_key':_0x1c52f2[_0x3ce0('0x38')]},'json':!![],'body':_0x516ae5};return rp(_0x114c24);})[_0x3ce0('0x19')](function(_0x19bba8){if(_0x19bba8['total_sent']>=0x1){var _0x4c0213={'messageId':_0x19bba8['internal_order_id']};if(_0x2ba171['smsMethod']!=='GP'||!_0x2ba171[_0x3ce0('0x39')]){_0x4c0213[_0x3ce0('0x3a')]=!![];}return _0x22a44f[_0x3ce0('0x1a')](_0x4c0213);}else{return logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x3b'),util[_0x3ce0('0x2d')](_0x19bba8,{'showHidden':![],'depth':null}));}})[_0x3ce0('0x3c')](function(_0x5f4a0c){return logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),'afterCreate',_0x3ce0('0x3b'),util['inspect'](_0x5f4a0c,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),'afterCreate',_0x3ce0('0x3b'),_0x3ce0('0x3d'));}break;case _0x3ce0('0x3e'):if(_0x2ba171[_0x3ce0('0x22')]){var _0x488f99={'recipient':_0x4b2533[_0x3ce0('0x23')],'message':_0x4b2533[_0x3ce0('0xe')],'sender':_0x2ba171[_0x3ce0('0x3f')]||_0x2ba171['phone'],'authorization':_0x2ba171[_0x3ce0('0x22')]};var _0x9a9360={'method':_0x3ce0('0x36'),'uri':_0x3ce0('0x40'),'body':_0x488f99,'json':!![]};rp(_0x9a9360)[_0x3ce0('0x19')](function(_0x1f5c83){var _0xe4bea3={'messageId':_0x1f5c83[_0x3ce0('0x41')]};if(!_0x2ba171[_0x3ce0('0x39')]){_0xe4bea3['read']=!![];}return _0x22a44f[_0x3ce0('0x1a')](_0xe4bea3);})[_0x3ce0('0x3c')](function(_0x160a41){logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x3e'),util['inspect'](_0x160a41,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x2ba171[_0x3ce0('0x2f')]&&_0x2ba171['password']){var _0x488f99={'messages':[{'source':_0x3ce0('0x42'),'to':_0x4b2533[_0x3ce0('0x23')],'body':_0x4b2533['body'],'from':_0x2ba171['senderString']||_0x2ba171[_0x3ce0('0x23')]}]};var _0x484cf4=util[_0x3ce0('0x43')](_0x3ce0('0x44'),_0x2ba171['username'],_0x2ba171['password']);var _0x9a9360={'method':_0x3ce0('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x488f99,'headers':{'Authorization':util[_0x3ce0('0x43')](_0x3ce0('0x45'),new Buffer(_0x484cf4)[_0x3ce0('0x46')](_0x3ce0('0x47')))},'json':!![]};rp(_0x9a9360)[_0x3ce0('0x19')](function(_0x644c53){if(_0x644c53[_0x3ce0('0x48')]>=0xc8&&_0x644c53[_0x3ce0('0x48')]<=0xce){if(_0x644c53[_0x3ce0('0x49')]&&_0x644c53[_0x3ce0('0x49')][_0x3ce0('0x4a')]>0x0){var _0x1bcc75=_[_0x3ce0('0x4b')](_0x644c53['data']['messages']);var _0x55518c={'messageId':_0x1bcc75['message_id']};if(!_0x2ba171[_0x3ce0('0x39')]){_0x55518c['read']=!![];}return _0x22a44f[_0x3ce0('0x1a')](_0x55518c);}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'clickSend',util['inspect'](_0x644c53,{'showHidden':![],'depth':null}));}}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x4c'),util['inspect'](_0x644c53,{'showHidden':![],'depth':null}));}})['catch'](function(_0x126d49){logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x4c'),util[_0x3ce0('0x2d')](_0x126d49,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x4c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3ce0('0x4d'):if(_0x2ba171['authId']&&_0x2ba171[_0x3ce0('0x22')]){var _0x488f99={'dst':_0x4b2533[_0x3ce0('0x23')],'text':_0x4b2533[_0x3ce0('0xe')],'src':_0x2ba171[_0x3ce0('0x3f')]||_0x2ba171[_0x3ce0('0x23')],'url':_0x2ba171[_0x3ce0('0x26')]+_0x3ce0('0x27')+_0x4b2533['id']+_0x3ce0('0x28')+_0x2ba171[_0x3ce0('0x29')]};var _0x484cf4=util[_0x3ce0('0x43')](_0x3ce0('0x44'),_0x2ba171['authId'],_0x2ba171[_0x3ce0('0x22')]);var _0x9a9360={'method':_0x3ce0('0x36'),'uri':util[_0x3ce0('0x43')](_0x3ce0('0x4e'),_0x2ba171['authId']),'body':_0x488f99,'headers':{'Authorization':util['format'](_0x3ce0('0x45'),new Buffer(_0x484cf4)[_0x3ce0('0x46')](_0x3ce0('0x47')))},'json':!![]};rp(_0x9a9360)[_0x3ce0('0x19')](function(_0x3a390a){var _0x4d0945={'messageId':_0x3a390a[_0x3ce0('0x4f')][0x0]};return _0x22a44f[_0x3ce0('0x1a')](_0x4d0945);})[_0x3ce0('0x3c')](function(_0x4d3c92){logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),'afterCreate',_0x3ce0('0x4d'),util[_0x3ce0('0x2d')](_0x4d3c92,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x4d'),_0x3ce0('0x50'));}break;case _0x3ce0('0x51'):if(_0x2ba171[_0x3ce0('0x2f')]&&_0x2ba171[_0x3ce0('0x33')]){if(_0x2ba171[_0x3ce0('0x52')]){var _0x5f0328={'method':_0x3ce0('0x36'),'uri':_0x2ba171['baseUrl']+'/auth/1/session','body':{'username':_0x2ba171[_0x3ce0('0x2f')],'password':_0x2ba171['password']},'json':!![]};return rp(_0x5f0328)[_0x3ce0('0x19')](function(_0x3f575b){var _0x458cc0={'method':_0x3ce0('0x36'),'uri':_0x2ba171[_0x3ce0('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2ba171[_0x3ce0('0x23')],'destinations':[{'to':_0x4b2533[_0x3ce0('0x23')]}],'text':_0x4b2533[_0x3ce0('0xe')],'notifyUrl':_0x2ba171[_0x3ce0('0x26')]+'/api/sms/messages/'+_0x4b2533['id']+_0x3ce0('0x28')+_0x2ba171[_0x3ce0('0x29')],'notifyContentType':'application/json','callbackData':_0x2ba171['phone']+';'+_0x4b2533[_0x3ce0('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3f575b[_0x3ce0('0x29')]},'json':!![]};return rp(_0x458cc0)['then'](function(_0x4b70bc){if(_0x4b70bc[_0x3ce0('0x24')]){var _0x3851be={'messageId':_0x4b70bc['messages'][0x0][_0x3ce0('0xc')]};if(!_0x2ba171['deliveryReport']){_0x3851be[_0x3ce0('0x3a')]=!![];}return _0x22a44f['update'](_0x3851be);}else{return logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'infobip',util[_0x3ce0('0x2d')](_0x4b70bc,{'showHidden':![],'depth':null}));}});})[_0x3ce0('0x3c')](function(_0x3b2514){return logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'infobip',util[_0x3ce0('0x2d')](_0x3b2514,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x51'),_0x3ce0('0x3d'));}break;case _0x3ce0('0x53'):var _0x105b1a=require(_0x3ce0('0x54'));if(_0x2ba171[_0x3ce0('0x55')]){var _0x18fa5a={};_0x18fa5a[_0x3ce0('0x56')]=_0x2ba171[_0x3ce0('0x2f')];_0x18fa5a[_0x3ce0('0x23')]=_0x4b2533['phone'];_0x18fa5a[_0x3ce0('0x57')]=_0x2ba171[_0x3ce0('0x23')];_0x18fa5a[_0x3ce0('0x58')]=_0x4b2533[_0x3ce0('0xe')];_0x18fa5a['timestamp']=+new Date();var _0x3e5509='';var _0x29839e='';var _0x495863=Object[_0x3ce0('0x59')](_0x18fa5a);_0x495863[_0x3ce0('0x5a')]();for(var _0x35d31c=0x0;_0x35d31c<_0x495863[_0x3ce0('0x5b')];_0x35d31c++){if(_0x3e5509!=''){_0x3e5509+='&';}_0x3e5509+=_0x495863[_0x35d31c]+'='+encodeURIComponent(_0x18fa5a[_0x495863[_0x35d31c]]);_0x29839e+=_0x18fa5a[_0x495863[_0x35d31c]];}_0x29839e+=_0x2ba171[_0x3ce0('0x55')];_0x29839e=_0x105b1a[_0x3ce0('0x5c')](_0x3ce0('0x5d'))[_0x3ce0('0x1a')](_0x29839e)['digest'](_0x3ce0('0x5e'));if(_0x3e5509!==''){_0x3e5509+='&';}_0x3e5509+=_0x3ce0('0x5f')+_0x29839e;var _0x114c24={'method':_0x3ce0('0x60'),'uri':_0x2ba171['baseUrl']+_0x3ce0('0x61')+_0x3e5509,'json':!![]};return rp(_0x114c24)[_0x3ce0('0x19')](function(_0x2db251){var _0x17107f=Object[_0x3ce0('0x59')](_0x2db251);if(_0x2db251[_0x17107f[0x0]]['error']&&parseInt(_0x2db251[_0x17107f[0x0]]['error'])===0x0){var _0xe02bae={'messageId':_0x2db251[_0x17107f[0x0]][_0x3ce0('0x62')]};if(!_0x2ba171['deliveryReport']){_0xe02bae['read']=!![];}return _0x22a44f[_0x3ce0('0x1a')](_0xe02bae);}else{return logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'csc',util[_0x3ce0('0x2d')](_0x2db251[_0x3ce0('0x1b')],{'showHidden':![],'depth':null}));}})[_0x3ce0('0x3c')](function(_0x31656d){return logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'csc',util[_0x3ce0('0x2d')](_0x31656d,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x53'),_0x3ce0('0x63'));}break;case _0x3ce0('0x64'):if(_0x2ba171[_0x3ce0('0x55')]){var _0x43e086={'method':_0x3ce0('0x36'),'uri':_0x3ce0('0x65'),'headers':{'Authorization':_0x2ba171['apiKey']},'body':{'content':_0x4b2533[_0x3ce0('0xe')],'to':[_0x4b2533['phone']],'from':_0x2ba171['phone'],'binary':![],'clientMessageId':_0x3ce0('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x43e086)['then'](function(_0x57d472){if(!_0x57d472[_0x3ce0('0x1b')]){var _0x21771a={'messageId':_0x57d472[_0x3ce0('0x24')][0x0][_0x3ce0('0x67')]};if(!_0x2ba171['deliveryReport']){_0x21771a[_0x3ce0('0x3a')]=!![];}return _0x22a44f[_0x3ce0('0x1a')](_0x21771a);}else{return logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),'afterCreate','clickatell',util[_0x3ce0('0x2d')](_0x57d472['error'],{'showHidden':![],'depth':null}));}})[_0x3ce0('0x3c')](function(_0x4232d9){return logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'clickatell',util[_0x3ce0('0x2d')](_0x4232d9,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')](_0x3ce0('0x2b'),_0x3ce0('0x2c'),'clickatell',_0x3ce0('0x63'));}break;case _0x3ce0('0x68'):if(_0x2ba171['username']&&_0x2ba171[_0x3ce0('0x33')]){var _0x484cf4=util[_0x3ce0('0x43')]('%s:%s',_0x2ba171[_0x3ce0('0x2f')],_0x2ba171[_0x3ce0('0x33')]);var _0x9a9360={'method':'POST','uri':_0x3ce0('0x69')+_0x2ba171[_0x3ce0('0x6a')]+_0x3ce0('0x6b'),'body':{'to':[_0x4b2533[_0x3ce0('0x23')]],'text':_0x4b2533[_0x3ce0('0xe')],'from':_0x2ba171[_0x3ce0('0x23')],'applicationId':_0x2ba171[_0x3ce0('0x6c')]},'headers':{'Authorization':util[_0x3ce0('0x43')]('Basic\x20%s',new Buffer(_0x484cf4)[_0x3ce0('0x46')](_0x3ce0('0x47')))},'json':!![]};rp(_0x9a9360)[_0x3ce0('0x19')](function(_0x545fd6){if(_0x545fd6['id']){var _0x215656={'messageId':_0x545fd6['id']};return _0x22a44f['update'](_0x215656);}else{logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),'bandwidth',util[_0x3ce0('0x2d')](_0x545fd6,{'showHidden':![],'depth':null}));}})[_0x3ce0('0x3c')](function(_0x44145e){logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),'bandwidth',util['inspect'](_0x44145e,{'showHidden':![],'depth':null}));});}else{logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x68'),_0x3ce0('0x3d'));}break;case _0x3ce0('0x6d'):if(_0x2ba171[_0x3ce0('0x55')]){var _0x2eb8b2={};var _0x114c24={'method':_0x3ce0('0x36'),'uri':_0x3ce0('0x6e'),'headers':{'Authorization':_0x3ce0('0x6f')+_0x2ba171[_0x3ce0('0x55')],'Content-Type':_0x3ce0('0x70')},'body':{'from':_0x2ba171[_0x3ce0('0x23')],'to':_0x4b2533[_0x3ce0('0x23')],'text':_0x4b2533[_0x3ce0('0xe')]},'json':!![]};return rp(_0x114c24)[_0x3ce0('0x19')](function(_0x131c86){if(_0x131c86['code']==0xca){_0x2eb8b2['message']=_0x131c86;var _0x38b8a5={'method':_0x3ce0('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3ce0('0x6f')+_0x2ba171[_0x3ce0('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x2eb8b2[_0x3ce0('0x71')][_0x3ce0('0x72')]},'json':!![]};return rp(_0x38b8a5)['then'](function(_0x5372fc){_0x2eb8b2[_0x3ce0('0x73')]=_0x5372fc;var _0x19daf0={'messageId':_0x2eb8b2[_0x3ce0('0x71')][_0x3ce0('0x72')],'read':!![]};return _0x22a44f['update'](_0x19daf0);});}else{return logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x6d'),util[_0x3ce0('0x2d')](_0x131c86,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49deca){return logger['error'](_0x3ce0('0x2b'),_0x3ce0('0x2c'),_0x3ce0('0x6d'),util[_0x3ce0('0x2d')](_0x49deca,{'showHidden':![],'depth':null}));});}else{return logger[_0x3ce0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ce0('0x2c'),_0x3ce0('0x6d'),_0x3ce0('0x74'));}break;}}})['finally'](function(){_0x5c8dc3();});}else{_0x5c8dc3();}}},'charset':_0x3ce0('0x75'),'collate':_0x3ce0('0x76')});}; \ No newline at end of file +var _0xd372=['format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','application/json','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','timestamp','keys','createHash','md5','digest','hex','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','messages','create','remote','/status?token=','token','sid','update','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','read','skebby','connectel','senderString','authToken','https://smsapi.connectel.se/api/v2/send/','clicksend','xCALLY\x20Motion'];(function(_0x523577,_0x465598){var _0x522e1e=function(_0x163650){while(--_0x163650){_0x523577['push'](_0x523577['shift']());}};_0x522e1e(++_0x465598);}(_0xd372,0x12b));var _0x2d37=function(_0x2e104a,_0x162311){_0x2e104a=_0x2e104a-0x0;var _0x343fc8=_0xd372[_0x2e104a];return _0x343fc8;};'use strict';var _=require(_0x2d37('0x0'));var util=require(_0x2d37('0x1'));var logger=require(_0x2d37('0x2'))(_0x2d37('0x3'));var moment=require(_0x2d37('0x4'));var BPromise=require(_0x2d37('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d37('0x6'));var rimraf=require(_0x2d37('0x7'));var config=require(_0x2d37('0x8'));var attributes=require('./smsMessage.attributes');module[_0x2d37('0x9')]=function(_0x177e42,_0x1dc5bf){return _0x177e42[_0x2d37('0xa')](_0x2d37('0xb'),attributes,{'tableName':_0x2d37('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2d37('0xd')]},{'name':_0x2d37('0xe'),'fields':[_0x2d37('0xf')],'type':_0x2d37('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x191bec,_0x42f1bb,_0xa0363){var _0x566e2a=_0x177e42[_0x2d37('0x11')];var _0x23f0ee=_0x191bec['get']({'plain':!![]});if(_0x23f0ee[_0x2d37('0x12')][_0x2d37('0x13')]()==='in'||_0x23f0ee[_0x2d37('0x12')][_0x2d37('0x13')]()===_0x2d37('0x14')&&!_0x23f0ee['secret']&&!_[_0x2d37('0x15')](_0x23f0ee[_0x2d37('0x16')])&&!_[_0x2d37('0x15')](_0x23f0ee[_0x2d37('0x17')])){_0x566e2a[_0x2d37('0x18')][_0x2d37('0x19')]({'where':{'id':_0x23f0ee[_0x2d37('0x17')]}})[_0x2d37('0x1a')](function(_0x449378){if(_0x449378){_0x449378['update']({'lastMsgAt':_0x23f0ee[_0x2d37('0x1b')],'lastMsgDirection':_0x23f0ee[_0x2d37('0x12')][_0x2d37('0x13')]()});}})[_0x2d37('0x1c')](function(_0x50c886){console[_0x2d37('0x1d')](_0x50c886);});}if(_0x23f0ee[_0x2d37('0x12')]===_0x2d37('0x14')&&!_0x23f0ee[_0x2d37('0x1e')]){var _0x49733c;_0x566e2a[_0x2d37('0x1f')][_0x2d37('0x20')]({'where':{'id':_0x23f0ee[_0x2d37('0x21')]},'raw':!![]})['then'](function(_0x944b77){_0x49733c=_0x944b77;if(_0x49733c&&_0x49733c[_0x2d37('0x22')]){switch(_0x49733c[_0x2d37('0x22')]){case _0x2d37('0x23'):var _0x2e0420=require('twilio');if(_0x49733c[_0x2d37('0x24')]&&_0x49733c['authToken']&&_0x49733c[_0x2d37('0x25')]){var _0xbf3817=new _0x2e0420(_0x49733c[_0x2d37('0x24')],_0x49733c['authToken']);_0xbf3817[_0x2d37('0x26')][_0x2d37('0x27')]({'body':_0x23f0ee[_0x2d37('0xf')],'to':_0x23f0ee[_0x2d37('0x25')],'from':_0x49733c[_0x2d37('0x25')],'statusCallback':_0x49733c[_0x2d37('0x28')]+'/api/sms/messages/'+_0x23f0ee['id']+_0x2d37('0x29')+_0x49733c[_0x2d37('0x2a')]})['then'](function(_0x2c220f){if(_0x2c220f[_0x2d37('0x2b')]){return _0x191bec[_0x2d37('0x2c')]({'messageId':_0x2c220f[_0x2d37('0x2b')]});}})[_0x2d37('0x1c')](function(_0x460fa3){logger[_0x2d37('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d37('0x2d'),_0x2d37('0x23'),util[_0x2d37('0x2e')](_0x460fa3,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x23'),_0x2d37('0x30'));}break;case'skebby':var _0x4b3fc7=_0x2d37('0x31');if(_0x49733c[_0x2d37('0x32')]&&_0x49733c[_0x2d37('0x33')]){var _0xc4336e={'recipient':[_0x23f0ee['phone']],'message':_0x23f0ee[_0x2d37('0xf')],'message_type':_0x49733c['smsMethod']};if(_0x49733c[_0x2d37('0x34')]&&_0x49733c[_0x2d37('0x34')]!=='SI'){_0xc4336e[_0x2d37('0x35')]=_0x49733c[_0x2d37('0x25')];}var _0x2f1c9f={'url':_0x4b3fc7+'login?username='+_0x49733c['username']+_0x2d37('0x36')+_0x49733c[_0x2d37('0x33')],'method':_0x2d37('0x37')};rp(_0x2f1c9f)['then'](function(_0x5c50ec){var _0xc0e6db=_0x5c50ec['split'](';');var _0xa0b8bd={'user_key':_0xc0e6db[0x0],'session_key':_0xc0e6db[0x1]};_0x2f1c9f={'url':_0x4b3fc7+_0x2d37('0x38'),'method':_0x2d37('0x39'),'headers':{'user_key':_0xa0b8bd[_0x2d37('0x3a')],'Session_key':_0xa0b8bd[_0x2d37('0x3b')]},'json':!![],'body':_0xc4336e};return rp(_0x2f1c9f);})['then'](function(_0x19c699){if(_0x19c699[_0x2d37('0x3c')]>=0x1){var _0x46b11e={'messageId':_0x19c699['internal_order_id']};if(_0x49733c[_0x2d37('0x34')]!=='GP'||!_0x49733c[_0x2d37('0x3d')]){_0x46b11e[_0x2d37('0x3e')]=!![];}return _0x191bec[_0x2d37('0x2c')](_0x46b11e);}else{return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x3f'),util[_0x2d37('0x2e')](_0x19c699,{'showHidden':![],'depth':null}));}})[_0x2d37('0x1c')](function(_0x2990fa){return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x3f'),util[_0x2d37('0x2e')](_0x2990fa,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2d37('0x3f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2d37('0x40'):if(_0x49733c['authToken']){var _0x237146={'recipient':_0x23f0ee[_0x2d37('0x25')],'message':_0x23f0ee[_0x2d37('0xf')],'sender':_0x49733c[_0x2d37('0x41')]||_0x49733c[_0x2d37('0x25')],'authorization':_0x49733c[_0x2d37('0x42')]};var _0x42f1bb={'method':_0x2d37('0x39'),'uri':_0x2d37('0x43'),'body':_0x237146,'json':!![]};rp(_0x42f1bb)[_0x2d37('0x1a')](function(_0x31ecba){var _0x1e0384={'messageId':_0x31ecba['requestid']};if(!_0x49733c[_0x2d37('0x3d')]){_0x1e0384['read']=!![];}return _0x191bec[_0x2d37('0x2c')](_0x1e0384);})[_0x2d37('0x1c')](function(_0x4f3c09){logger[_0x2d37('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d37('0x2d'),_0x2d37('0x40'),util[_0x2d37('0x2e')](_0x4f3c09,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x2d37('0x44'):if(_0x49733c[_0x2d37('0x32')]&&_0x49733c[_0x2d37('0x33')]){var _0x237146={'messages':[{'source':_0x2d37('0x45'),'to':_0x23f0ee[_0x2d37('0x25')],'body':_0x23f0ee['body'],'from':_0x49733c[_0x2d37('0x41')]||_0x49733c[_0x2d37('0x25')]}]};var _0x32ea91=util[_0x2d37('0x46')](_0x2d37('0x47'),_0x49733c[_0x2d37('0x32')],_0x49733c[_0x2d37('0x33')]);var _0x42f1bb={'method':'POST','uri':_0x2d37('0x48'),'body':_0x237146,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x32ea91)[_0x2d37('0x49')](_0x2d37('0x4a')))},'json':!![]};rp(_0x42f1bb)[_0x2d37('0x1a')](function(_0x188751){if(_0x188751[_0x2d37('0x4b')]>=0xc8&&_0x188751[_0x2d37('0x4b')]<=0xce){if(_0x188751['data']&&_0x188751[_0x2d37('0x4c')][_0x2d37('0x4d')]>0x0){var _0xe21554=_['head'](_0x188751['data'][_0x2d37('0x26')]);var _0x35caa7={'messageId':_0xe21554['message_id']};if(!_0x49733c['deliveryReport']){_0x35caa7[_0x2d37('0x3e')]=!![];}return _0x191bec[_0x2d37('0x2c')](_0x35caa7);}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x4e'),util[_0x2d37('0x2e')](_0x188751,{'showHidden':![],'depth':null}));}}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x4e'),util['inspect'](_0x188751,{'showHidden':![],'depth':null}));}})['catch'](function(_0x69f554){logger[_0x2d37('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d37('0x2d'),_0x2d37('0x4e'),util[_0x2d37('0x2e')](_0x69f554,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x49733c[_0x2d37('0x4f')]&&_0x49733c['authToken']){var _0x237146={'dst':_0x23f0ee['phone'],'text':_0x23f0ee['body'],'src':_0x49733c[_0x2d37('0x41')]||_0x49733c[_0x2d37('0x25')],'url':_0x49733c['remote']+'/api/sms/messages/'+_0x23f0ee['id']+_0x2d37('0x29')+_0x49733c[_0x2d37('0x2a')]};var _0x32ea91=util[_0x2d37('0x46')](_0x2d37('0x47'),_0x49733c[_0x2d37('0x4f')],_0x49733c[_0x2d37('0x42')]);var _0x42f1bb={'method':_0x2d37('0x39'),'uri':util[_0x2d37('0x46')](_0x2d37('0x50'),_0x49733c[_0x2d37('0x4f')]),'body':_0x237146,'headers':{'Authorization':util[_0x2d37('0x46')](_0x2d37('0x51'),new Buffer(_0x32ea91)[_0x2d37('0x49')](_0x2d37('0x4a')))},'json':!![]};rp(_0x42f1bb)[_0x2d37('0x1a')](function(_0x9e73c2){var _0x3e59e6={'messageId':_0x9e73c2[_0x2d37('0x52')][0x0]};return _0x191bec[_0x2d37('0x2c')](_0x3e59e6);})[_0x2d37('0x1c')](function(_0x1bc8f7){logger['error'](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x53'),util[_0x2d37('0x2e')](_0x1bc8f7,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x53'),_0x2d37('0x54'));}break;case _0x2d37('0x55'):if(_0x49733c['username']&&_0x49733c[_0x2d37('0x33')]){if(_0x49733c[_0x2d37('0x56')]){var _0x209e6d={'method':_0x2d37('0x39'),'uri':_0x49733c[_0x2d37('0x56')]+_0x2d37('0x57'),'body':{'username':_0x49733c[_0x2d37('0x32')],'password':_0x49733c[_0x2d37('0x33')]},'json':!![]};return rp(_0x209e6d)[_0x2d37('0x1a')](function(_0x149ae3){var _0x3b1b9e={'method':_0x2d37('0x39'),'uri':_0x49733c[_0x2d37('0x56')]+_0x2d37('0x58'),'body':{'messages':[{'from':_0x49733c[_0x2d37('0x25')],'destinations':[{'to':_0x23f0ee[_0x2d37('0x25')]}],'text':_0x23f0ee[_0x2d37('0xf')],'notifyUrl':_0x49733c[_0x2d37('0x28')]+_0x2d37('0x59')+_0x23f0ee['id']+_0x2d37('0x29')+_0x49733c[_0x2d37('0x2a')],'notifyContentType':_0x2d37('0x5a'),'callbackData':_0x49733c[_0x2d37('0x25')]+';'+_0x23f0ee[_0x2d37('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x149ae3[_0x2d37('0x2a')]},'json':!![]};return rp(_0x3b1b9e)[_0x2d37('0x1a')](function(_0x5cf364){if(_0x5cf364[_0x2d37('0x26')]){var _0x268649={'messageId':_0x5cf364[_0x2d37('0x26')][0x0][_0x2d37('0xd')]};if(!_0x49733c['deliveryReport']){_0x268649[_0x2d37('0x3e')]=!![];}return _0x191bec[_0x2d37('0x2c')](_0x268649);}else{return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x55'),util['inspect'](_0x5cf364,{'showHidden':![],'depth':null}));}});})[_0x2d37('0x1c')](function(_0x2e7ef8){return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),'infobip',util['inspect'](_0x2e7ef8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d37('0x2d'),_0x2d37('0x55'),_0x2d37('0x5b'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2d37('0x55'),_0x2d37('0x5c'));}break;case _0x2d37('0x5d'):var _0x1b395c=require(_0x2d37('0x5e'));if(_0x49733c[_0x2d37('0x5f')]){var _0x16ea12={};_0x16ea12['login']=_0x49733c[_0x2d37('0x32')];_0x16ea12['phone']=_0x23f0ee['phone'];_0x16ea12[_0x2d37('0x35')]=_0x49733c[_0x2d37('0x25')];_0x16ea12['text']=_0x23f0ee['body'];_0x16ea12[_0x2d37('0x60')]=+new Date();var _0x527399='';var _0x2cd833='';var _0x534ec8=Object[_0x2d37('0x61')](_0x16ea12);_0x534ec8['sort']();for(var _0x79ec8f=0x0;_0x79ec8f<_0x534ec8['length'];_0x79ec8f++){if(_0x527399!=''){_0x527399+='&';}_0x527399+=_0x534ec8[_0x79ec8f]+'='+encodeURIComponent(_0x16ea12[_0x534ec8[_0x79ec8f]]);_0x2cd833+=_0x16ea12[_0x534ec8[_0x79ec8f]];}_0x2cd833+=_0x49733c[_0x2d37('0x5f')];_0x2cd833=_0x1b395c[_0x2d37('0x62')](_0x2d37('0x63'))[_0x2d37('0x2c')](_0x2cd833)[_0x2d37('0x64')](_0x2d37('0x65'));if(_0x527399!==''){_0x527399+='&';}_0x527399+='signature='+_0x2cd833;var _0x2f1c9f={'method':_0x2d37('0x37'),'uri':_0x49733c['baseUrl']+_0x2d37('0x66')+_0x527399,'json':!![]};return rp(_0x2f1c9f)[_0x2d37('0x1a')](function(_0x1e33b0){var _0x34cbfb=Object[_0x2d37('0x61')](_0x1e33b0);if(_0x1e33b0[_0x34cbfb[0x0]][_0x2d37('0x1d')]&&parseInt(_0x1e33b0[_0x34cbfb[0x0]]['error'])===0x0){var _0x2b71af={'messageId':_0x1e33b0[_0x34cbfb[0x0]]['id_sms']};if(!_0x49733c[_0x2d37('0x3d')]){_0x2b71af[_0x2d37('0x3e')]=!![];}return _0x191bec['update'](_0x2b71af);}else{return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x5d'),util[_0x2d37('0x2e')](_0x1e33b0['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x240610){return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),'csc',util[_0x2d37('0x2e')](_0x240610,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x5d'),'Missing\x20parameters:\x20apiKey');}break;case _0x2d37('0x67'):if(_0x49733c['apiKey']){var _0x37cee3={'method':_0x2d37('0x39'),'uri':_0x2d37('0x68'),'headers':{'Authorization':_0x49733c['apiKey']},'body':{'content':_0x23f0ee[_0x2d37('0xf')],'to':[_0x23f0ee[_0x2d37('0x25')]],'from':_0x49733c[_0x2d37('0x25')],'binary':![],'clientMessageId':_0x2d37('0x69'),'charset':_0x2d37('0x6a')},'json':!![]};rp(_0x37cee3)[_0x2d37('0x1a')](function(_0x18591b){if(!_0x18591b[_0x2d37('0x1d')]){var _0x3aa34e={'messageId':_0x18591b['messages'][0x0]['apiMessageId']};if(!_0x49733c['deliveryReport']){_0x3aa34e[_0x2d37('0x3e')]=!![];}return _0x191bec[_0x2d37('0x2c')](_0x3aa34e);}else{return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x67'),util['inspect'](_0x18591b['error'],{'showHidden':![],'depth':null}));}})[_0x2d37('0x1c')](function(_0x4c5e17){return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x67'),util[_0x2d37('0x2e')](_0x4c5e17,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d37('0x2d'),_0x2d37('0x67'),_0x2d37('0x6b'));}break;case _0x2d37('0x6c'):if(_0x49733c['username']&&_0x49733c[_0x2d37('0x33')]){var _0x32ea91=util[_0x2d37('0x46')](_0x2d37('0x47'),_0x49733c[_0x2d37('0x32')],_0x49733c['password']);var _0x42f1bb={'method':_0x2d37('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x49733c[_0x2d37('0x6d')]+_0x2d37('0x6e'),'body':{'to':[_0x23f0ee[_0x2d37('0x25')]],'text':_0x23f0ee[_0x2d37('0xf')],'from':_0x49733c['phone'],'applicationId':_0x49733c[_0x2d37('0x6f')]},'headers':{'Authorization':util['format'](_0x2d37('0x51'),new Buffer(_0x32ea91)[_0x2d37('0x49')](_0x2d37('0x4a')))},'json':!![]};rp(_0x42f1bb)['then'](function(_0x1f82a3){if(_0x1f82a3['id']){var _0x514123={'messageId':_0x1f82a3['id']};return _0x191bec[_0x2d37('0x2c')](_0x514123);}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x6c'),util[_0x2d37('0x2e')](_0x1f82a3,{'showHidden':![],'depth':null}));}})[_0x2d37('0x1c')](function(_0x38591a){logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x6c'),util[_0x2d37('0x2e')](_0x38591a,{'showHidden':![],'depth':null}));});}else{logger[_0x2d37('0x1d')](_0x2d37('0x2f'),'afterCreate',_0x2d37('0x6c'),_0x2d37('0x5c'));}break;case _0x2d37('0x70'):if(_0x49733c[_0x2d37('0x5f')]){var _0x124da6={};var _0x2f1c9f={'method':_0x2d37('0x39'),'uri':_0x2d37('0x71'),'headers':{'Authorization':_0x2d37('0x72')+_0x49733c[_0x2d37('0x5f')],'Content-Type':_0x2d37('0x5a')},'body':{'from':_0x49733c[_0x2d37('0x25')],'to':_0x23f0ee[_0x2d37('0x25')],'text':_0x23f0ee[_0x2d37('0xf')]},'json':!![]};return rp(_0x2f1c9f)['then'](function(_0x136a4f){if(_0x136a4f[_0x2d37('0x73')]==0xca){_0x124da6[_0x2d37('0x74')]=_0x136a4f;var _0xa3203c={'method':_0x2d37('0x39'),'uri':_0x2d37('0x75'),'headers':{'Authorization':_0x2d37('0x72')+_0x49733c[_0x2d37('0x5f')],'Content-Type':_0x2d37('0x5a')},'body':{'refid':_0x124da6[_0x2d37('0x74')][_0x2d37('0x76')]},'json':!![]};return rp(_0xa3203c)['then'](function(_0x3a66e3){_0x124da6['status']=_0x3a66e3;var _0x17fd0f={'messageId':_0x124da6[_0x2d37('0x74')][_0x2d37('0x76')],'read':!![]};return _0x191bec[_0x2d37('0x2c')](_0x17fd0f);});}else{return logger[_0x2d37('0x1d')](_0x2d37('0x2f'),_0x2d37('0x2d'),'intelepeer',util[_0x2d37('0x2e')](_0x136a4f,{'showHidden':![],'depth':null}));}})[_0x2d37('0x1c')](function(_0x3af547){return logger['error'](_0x2d37('0x2f'),_0x2d37('0x2d'),'intelepeer',util[_0x2d37('0x2e')](_0x3af547,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x2d37('0x2f'),_0x2d37('0x2d'),_0x2d37('0x70'),_0x2d37('0x77'));}break;}}})[_0x2d37('0x78')](function(){_0xa0363();});}else{_0xa0363();}}},'charset':_0x2d37('0x79'),'collate':_0x2d37('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 501b041..7960050 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 _0x5bbe=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xe02996,_0x1c9fd5){var _0x458538=function(_0x43303d){while(--_0x43303d){_0xe02996['push'](_0xe02996['shift']());}};_0x458538(++_0x1c9fd5);}(_0x5bbe,0x110));var _0xe5bb=function(_0x3b19a8,_0x2616ad){_0x3b19a8=_0x3b19a8-0x0;var _0x68afc3=_0x5bbe[_0x3b19a8];return _0x68afc3;};'use strict';var _=require(_0xe5bb('0x0'));var util=require(_0xe5bb('0x1'));var moment=require(_0xe5bb('0x2'));var BPromise=require(_0xe5bb('0x3'));var rs=require(_0xe5bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5bb('0x5'))['db'];var utils=require(_0xe5bb('0x6'));var logger=require(_0xe5bb('0x7'))(_0xe5bb('0x8'));var config=require(_0xe5bb('0x9'));var jayson=require(_0xe5bb('0xa'));var client=jayson[_0xe5bb('0xb')]['http']({'port':0x232a});config[_0xe5bb('0xc')]=_[_0xe5bb('0xd')](config['redis'],{'host':_0xe5bb('0xe'),'port':0x18eb});var socket=require(_0xe5bb('0xf'))(new Redis(config[_0xe5bb('0xc')]));require(_0xe5bb('0x10'))[_0xe5bb('0x11')](socket);function respondWithRpcPromise(_0x4d38ca,_0x574a4e,_0x109d13){return new BPromise(function(_0x18817c,_0x596cae){return client['request'](_0x4d38ca,_0x109d13)[_0xe5bb('0x12')](function(_0x42d856){logger[_0xe5bb('0x13')]('SmsMessage,\x20%s,\x20%s',_0x574a4e,_0xe5bb('0x14'));logger[_0xe5bb('0x15')](_0xe5bb('0x16'),_0x574a4e,_0xe5bb('0x14'),JSON[_0xe5bb('0x17')](_0x42d856));if(_0x42d856[_0xe5bb('0x18')]){if(_0x42d856[_0xe5bb('0x18')][_0xe5bb('0x19')]===0x1f4){logger['error'](_0xe5bb('0x1a'),_0x574a4e,_0x42d856[_0xe5bb('0x18')][_0xe5bb('0x1b')]);return _0x596cae(_0x42d856['error'][_0xe5bb('0x1b')]);}logger['error'](_0xe5bb('0x1a'),_0x574a4e,_0x42d856[_0xe5bb('0x18')]['message']);return _0x18817c(_0x42d856[_0xe5bb('0x18')][_0xe5bb('0x1b')]);}else{logger[_0xe5bb('0x13')]('SmsMessage,\x20%s,\x20%s',_0x574a4e,_0xe5bb('0x14'));_0x18817c(_0x42d856[_0xe5bb('0x1c')]['message']);}})[_0xe5bb('0x1d')](function(_0x172140){logger['error'](_0xe5bb('0x1a'),_0x574a4e,_0x172140);_0x596cae(_0x172140);});});}exports[_0xe5bb('0x1e')]=function(_0x19190f){var _0x20a4c6=this;return new Promise(function(_0x400372,_0x33930d){return db[_0xe5bb('0x1f')][_0xe5bb('0x20')](_0x19190f[_0xe5bb('0x21')],{'raw':_0x19190f[_0xe5bb('0x22')]?_0x19190f['options']['raw']===undefined?!![]:![]:!![]})[_0xe5bb('0x12')](function(_0x2c1aad){logger[_0xe5bb('0x13')](_0xe5bb('0x1e'),_0x19190f);logger[_0xe5bb('0x15')](_0xe5bb('0x1e'),_0x19190f,JSON['stringify'](_0x2c1aad));_0x400372(_0x2c1aad);})[_0xe5bb('0x1d')](function(_0x35ba89){logger['error'](_0xe5bb('0x1e'),_0x35ba89['message'],_0x19190f);_0x33930d(_0x20a4c6[_0xe5bb('0x18')](0x1f4,_0x35ba89['message']));});});}; \ No newline at end of file +var _0x249c=['http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','debug','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e8097,_0x4a6af4){var _0xadc1f2=function(_0x2c41d4){while(--_0x2c41d4){_0x1e8097['push'](_0x1e8097['shift']());}};_0xadc1f2(++_0x4a6af4);}(_0x249c,0xe8));var _0xc249=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x249c[_0x3de873];return _0x380b8c;};'use strict';var _=require('lodash');var util=require(_0xc249('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc249('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc249('0x2'))['db'];var utils=require(_0xc249('0x3'));var logger=require('../../config/logger')(_0xc249('0x4'));var config=require(_0xc249('0x5'));var jayson=require(_0xc249('0x6'));var client=jayson[_0xc249('0x7')][_0xc249('0x8')]({'port':0x232a});config[_0xc249('0x9')]=_[_0xc249('0xa')](config[_0xc249('0x9')],{'host':_0xc249('0xb'),'port':0x18eb});var socket=require(_0xc249('0xc'))(new Redis(config['redis']));require(_0xc249('0xd'))[_0xc249('0xe')](socket);function respondWithRpcPromise(_0x5e7833,_0x3f32c0,_0x4438b3){return new BPromise(function(_0x53dff8,_0x1fa468){return client['request'](_0x5e7833,_0x4438b3)['then'](function(_0x2db3c6){logger['info'](_0xc249('0xf'),_0x3f32c0,_0xc249('0x10'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f32c0,_0xc249('0x10'),JSON[_0xc249('0x11')](_0x2db3c6));if(_0x2db3c6[_0xc249('0x12')]){if(_0x2db3c6[_0xc249('0x12')][_0xc249('0x13')]===0x1f4){logger[_0xc249('0x12')]('SmsMessage,\x20%s,\x20%s',_0x3f32c0,_0x2db3c6[_0xc249('0x12')][_0xc249('0x14')]);return _0x1fa468(_0x2db3c6['error'][_0xc249('0x14')]);}logger['error'](_0xc249('0xf'),_0x3f32c0,_0x2db3c6['error'][_0xc249('0x14')]);return _0x53dff8(_0x2db3c6['error']['message']);}else{logger[_0xc249('0x15')](_0xc249('0xf'),_0x3f32c0,_0xc249('0x10'));_0x53dff8(_0x2db3c6[_0xc249('0x16')]['message']);}})[_0xc249('0x17')](function(_0x450b45){logger[_0xc249('0x12')](_0xc249('0xf'),_0x3f32c0,_0x450b45);_0x1fa468(_0x450b45);});});}exports[_0xc249('0x18')]=function(_0x3118a8){var _0x398f47=this;return new Promise(function(_0x134884,_0x52b6d2){return db[_0xc249('0x19')][_0xc249('0x1a')](_0x3118a8['body'],{'raw':_0x3118a8[_0xc249('0x1b')]?_0x3118a8[_0xc249('0x1b')][_0xc249('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29f5cb){logger['info'](_0xc249('0x18'),_0x3118a8);logger[_0xc249('0x1d')](_0xc249('0x18'),_0x3118a8,JSON[_0xc249('0x11')](_0x29f5cb));_0x134884(_0x29f5cb);})['catch'](function(_0x3f837d){logger[_0xc249('0x12')](_0xc249('0x18'),_0x3f837d[_0xc249('0x14')],_0x3118a8);_0x52b6d2(_0x398f47[_0xc249('0x12')](0x1f4,_0x3f837d[_0xc249('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9194985..38966c7 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 _0x4aad=['remove','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x4aad,0x10e));var _0xd4aa=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4aad[_0x273c39];return _0x46d6b5;};'use strict';var SmsMessageEvents=require(_0xd4aa('0x0'));var events=[_0xd4aa('0x1'),_0xd4aa('0x2'),'update'];function createListener(_0x2c5bb4,_0x4dd83d){return function(_0x4e218a){_0x4dd83d[_0xd4aa('0x3')](_0x2c5bb4,_0x4e218a);};}function removeListener(_0x576559,_0x4c5074){return function(){SmsMessageEvents[_0xd4aa('0x4')](_0x576559,_0x4c5074);};}exports[_0xd4aa('0x5')]=function(_0x3cdfab){for(var _0x518283=0x0,_0x53eab6=events[_0xd4aa('0x6')];_0x518283<_0x53eab6;_0x518283++){var _0x5bfa17=events[_0x518283];var _0x924b76=createListener(_0xd4aa('0x7')+_0x5bfa17,_0x3cdfab);SmsMessageEvents['on'](_0x5bfa17,_0x924b76);}}; \ No newline at end of file +var _0xa520=['update','emit','removeListener','register','length','./smsMessage.events','save','remove'];(function(_0x25d494,_0x93e50){var _0x26be99=function(_0x12c0e9){while(--_0x12c0e9){_0x25d494['push'](_0x25d494['shift']());}};_0x26be99(++_0x93e50);}(_0xa520,0x125));var _0x0a52=function(_0x1bc10c,_0x4b5d84){_0x1bc10c=_0x1bc10c-0x0;var _0x502203=_0xa520[_0x1bc10c];return _0x502203;};'use strict';var SmsMessageEvents=require(_0x0a52('0x0'));var events=[_0x0a52('0x1'),_0x0a52('0x2'),_0x0a52('0x3')];function createListener(_0x1e4099,_0x5e032f){return function(_0x49a6a6){_0x5e032f[_0x0a52('0x4')](_0x1e4099,_0x49a6a6);};}function removeListener(_0x11a7fc,_0xe94dc8){return function(){SmsMessageEvents[_0x0a52('0x5')](_0x11a7fc,_0xe94dc8);};}exports[_0x0a52('0x6')]=function(_0x50026e){for(var _0x4e8ac5=0x0,_0x2a4b60=events[_0x0a52('0x7')];_0x4e8ac5<_0x2a4b60;_0x4e8ac5++){var _0x511b8c=events[_0x4e8ac5];var _0x417ae0=createListener('smsMessage:'+_0x511b8c,_0x50026e);SmsMessageEvents['on'](_0x511b8c,_0x417ae0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 4e22c3b..3a06b05 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 _0xb82d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x25ea25,_0x570998){var _0x1d453c=function(_0x2a5c09){while(--_0x2a5c09){_0x25ea25['push'](_0x25ea25['shift']());}};_0x1d453c(++_0x570998);}(_0xb82d,0x1cc));var _0xdb82=function(_0x29ff84,_0x40de7b){_0x29ff84=_0x29ff84-0x0;var _0x4e81a0=_0xb82d[_0x29ff84];return _0x4e81a0;};'use strict';var multer=require(_0xdb82('0x0'));var util=require(_0xdb82('0x1'));var path=require('path');var timeout=require(_0xdb82('0x2'));var express=require(_0xdb82('0x3'));var router=express[_0xdb82('0x4')]();var fs_extra=require(_0xdb82('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb82('0x6'));var config=require(_0xdb82('0x7'));var controller=require(_0xdb82('0x8'));router[_0xdb82('0x9')]('/',auth[_0xdb82('0xa')](),controller[_0xdb82('0xb')]);router[_0xdb82('0x9')]('/describe',auth[_0xdb82('0xa')](),controller[_0xdb82('0xc')]);router['get'](_0xdb82('0xd'),auth[_0xdb82('0xa')](),controller[_0xdb82('0xe')]);router[_0xdb82('0x9')](_0xdb82('0xf'),auth['isAuthenticated'](),controller[_0xdb82('0x10')]);router['get'](_0xdb82('0x11'),auth[_0xdb82('0xa')](),controller['getTeams']);router[_0xdb82('0x9')](_0xdb82('0x12'),auth[_0xdb82('0xa')](),controller[_0xdb82('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb82('0x14')]);router[_0xdb82('0x15')](_0xdb82('0x11'),auth['isAuthenticated'](),controller[_0xdb82('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xdb82('0x17')]);router['put'](_0xdb82('0xd'),auth[_0xdb82('0xa')](),controller[_0xdb82('0x18')]);router[_0xdb82('0x19')](_0xdb82('0xd'),auth[_0xdb82('0xa')](),controller[_0xdb82('0x1a')]);router['delete'](_0xdb82('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xdb82('0x12'),auth[_0xdb82('0xa')](),controller[_0xdb82('0x1b')]);module[_0xdb82('0x1c')]=router; \ No newline at end of file +var _0x1528=['Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','show','/:id/members','/:id/teams','getTeams','getAgents','post','addAgents','put','/:id','update','destroy','delete','removeTeams','/:id/users','multer','path','connect-timeout','express'];(function(_0x188cc7,_0xf28746){var _0x54c1a8=function(_0x5bcd24){while(--_0x5bcd24){_0x188cc7['push'](_0x188cc7['shift']());}};_0x54c1a8(++_0xf28746);}(_0x1528,0x128));var _0x8152=function(_0x51e0f9,_0x1c6826){_0x51e0f9=_0x51e0f9-0x0;var _0x1001c0=_0x1528[_0x51e0f9];return _0x1001c0;};'use strict';var multer=require(_0x8152('0x0'));var util=require('util');var path=require(_0x8152('0x1'));var timeout=require(_0x8152('0x2'));var express=require(_0x8152('0x3'));var router=express[_0x8152('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8152('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8152('0x6'));var controller=require(_0x8152('0x7'));router[_0x8152('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8152('0x8')](_0x8152('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x8152('0xa')](),controller[_0x8152('0xb')]);router[_0x8152('0x8')](_0x8152('0xc'),auth[_0x8152('0xa')](),controller['getMembers']);router[_0x8152('0x8')](_0x8152('0xd'),auth['isAuthenticated'](),controller[_0x8152('0xe')]);router[_0x8152('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x8152('0xf')]);router[_0x8152('0x10')]('/',auth[_0x8152('0xa')](),controller['create']);router['post'](_0x8152('0xd'),auth[_0x8152('0xa')](),controller['addTeams']);router[_0x8152('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x8152('0x11')]);router[_0x8152('0x12')](_0x8152('0x13'),auth[_0x8152('0xa')](),controller[_0x8152('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8152('0x15')]);router[_0x8152('0x16')]('/:id/teams',auth[_0x8152('0xa')](),controller[_0x8152('0x17')]);router['delete'](_0x8152('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index fb964f6..d714d26 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 _0x01ff=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x29b189,_0x542f7b){var _0x1c30c5=function(_0x10af2c){while(--_0x10af2c){_0x29b189['push'](_0x29b189['shift']());}};_0x1c30c5(++_0x542f7b);}(_0x01ff,0x17b));var _0xf01f=function(_0x1d133a,_0x5ee33d){_0x1d133a=_0x1d133a-0x0;var _0x186f0d=_0x01ff[_0x1d133a];return _0x186f0d;};'use strict';var Sequelize=require(_0xf01f('0x0'));module[_0xf01f('0x1')]={'name':{'type':Sequelize[_0xf01f('0x2')],'unique':_0xf01f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf01f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf01f('0x5'),_0xf01f('0x6'),_0xf01f('0x7'))}}; \ No newline at end of file +var _0xb8e1=['rrmemory','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3b87e8,_0x1ef38e){var _0x49c031=function(_0x1704a7){while(--_0x1704a7){_0x3b87e8['push'](_0x3b87e8['shift']());}};_0x49c031(++_0x1ef38e);}(_0xb8e1,0x159));var _0x1b8e=function(_0x19da65,_0x4c94c6){_0x19da65=_0x19da65-0x0;var _0xf17e38=_0xb8e1[_0x19da65];return _0xf17e38;};'use strict';var Sequelize=require(_0x1b8e('0x0'));module[_0x1b8e('0x1')]={'name':{'type':Sequelize[_0x1b8e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1b8e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b8e('0x4')](_0x1b8e('0x5'),'beepall',_0x1b8e('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c6b4d8e..1658d50 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 _0x3c45=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserSmsQueue','pick','User','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','destroy','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0x348802,_0x31c11d){var _0xd94a77=function(_0x19eaca){while(--_0x19eaca){_0x348802['push'](_0x348802['shift']());}};_0xd94a77(++_0x31c11d);}(_0x3c45,0xd8));var _0x53c4=function(_0x135b3d,_0x2b645a){_0x135b3d=_0x135b3d-0x0;var _0x1fbad2=_0x3c45[_0x135b3d];return _0x1fbad2;};'use strict';var emlformat=require(_0x53c4('0x0'));var rimraf=require(_0x53c4('0x1'));var zipdir=require(_0x53c4('0x2'));var jsonpatch=require(_0x53c4('0x3'));var rp=require(_0x53c4('0x4'));var moment=require(_0x53c4('0x5'));var BPromise=require(_0x53c4('0x6'));var Mustache=require(_0x53c4('0x7'));var util=require(_0x53c4('0x8'));var path=require(_0x53c4('0x9'));var sox=require('sox');var csv=require(_0x53c4('0xa'));var ejs=require(_0x53c4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53c4('0xc'));var squel=require('squel');var crypto=require(_0x53c4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53c4('0xa'));var querystring=require('querystring');var Papa=require(_0x53c4('0xe'));var Redis=require(_0x53c4('0xf'));var authService=require(_0x53c4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x53c4('0x11'));var hardwareService=require(_0x53c4('0x12'));var logger=require(_0x53c4('0x13'))('api');var utils=require(_0x53c4('0x14'));var config=require(_0x53c4('0x15'));var licenseUtil=require(_0x53c4('0x16'));var db=require(_0x53c4('0x17'))['db'];config[_0x53c4('0x18')]=_[_0x53c4('0x19')](config['redis'],{'host':_0x53c4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53c4('0x18')]));require(_0x53c4('0x1b'))[_0x53c4('0x1c')](socket);function respondWithStatusCode(_0x25bdb9,_0xe06b17){_0xe06b17=_0xe06b17||0xcc;return function(_0x3c0c03){if(_0x3c0c03){return _0x25bdb9[_0x53c4('0x1d')](_0xe06b17);}return _0x25bdb9[_0x53c4('0x1e')](_0xe06b17)['end']();};}function respondWithResult(_0x2adf02,_0x22a281){_0x22a281=_0x22a281||0xc8;return function(_0x9578c4){if(_0x9578c4){return _0x2adf02[_0x53c4('0x1e')](_0x22a281)[_0x53c4('0x1f')](_0x9578c4);}};}function respondWithFilteredResult(_0x19415b,_0x5ce5a0){return function(_0x4f487e){if(_0x4f487e){var _0x10d46b=typeof _0x5ce5a0[_0x53c4('0x20')]===_0x53c4('0x21')&&typeof _0x5ce5a0[_0x53c4('0x22')]===_0x53c4('0x21');var _0x1404c5=_0x4f487e[_0x53c4('0x23')];var _0xac4694=_0x10d46b?0x0:_0x5ce5a0[_0x53c4('0x20')];var _0x29f8e7=_0x10d46b?_0x4f487e[_0x53c4('0x23')]:_0x5ce5a0[_0x53c4('0x20')]+_0x5ce5a0[_0x53c4('0x22')];var _0x170511;if(_0x29f8e7>=_0x1404c5){_0x29f8e7=_0x1404c5;_0x170511=0xc8;}else{_0x170511=0xce;}_0x19415b[_0x53c4('0x1e')](_0x170511);return _0x19415b[_0x53c4('0x24')](_0x53c4('0x25'),_0xac4694+'-'+_0x29f8e7+'/'+_0x1404c5)[_0x53c4('0x1f')](_0x4f487e);}return null;};}function patchUpdates(_0x1f1ae4){return function(_0x234107){try{jsonpatch[_0x53c4('0x26')](_0x234107,_0x1f1ae4,!![]);}catch(_0x19b69f){return BPromise[_0x53c4('0x27')](_0x19b69f);}return _0x234107[_0x53c4('0x28')]();};}function saveUpdates(_0x471bd8,_0x1520b4){return function(_0x32461a){if(_0x32461a){return _0x32461a[_0x53c4('0x29')](_0x471bd8)['then'](function(_0x4c8f1a){return _0x4c8f1a;});}return null;};}function removeEntity(_0x2f364a,_0x3b4488){return function(_0x2aae6f){if(_0x2aae6f){return _0x2aae6f['destroy']()[_0x53c4('0x2a')](function(){var _0x5a07c3=_0x2aae6f[_0x53c4('0x2b')]({'plain':!![]});var _0x1566e8=_0x53c4('0x2c');return db['UserProfileResource'][_0x53c4('0x2d')]({'where':{'type':_0x1566e8,'resourceId':_0x5a07c3['id']}})[_0x53c4('0x2a')](function(){return _0x2aae6f;});})[_0x53c4('0x2a')](function(){_0x2f364a['status'](0xcc)[_0x53c4('0x2e')]();});}};}function handleEntityNotFound(_0x40a42d,_0x16492f){return function(_0x447f6e){if(!_0x447f6e){_0x40a42d[_0x53c4('0x1d')](0x194);}return _0x447f6e;};}function handleError(_0x3b51d6,_0x4c1f16){_0x4c1f16=_0x4c1f16||0x1f4;return function(_0x3cbbe9){logger[_0x53c4('0x2f')](_0x3cbbe9[_0x53c4('0x30')]);if(_0x3cbbe9[_0x53c4('0x31')]){delete _0x3cbbe9[_0x53c4('0x31')];}_0x3b51d6[_0x53c4('0x1e')](_0x4c1f16)[_0x53c4('0x32')](_0x3cbbe9);};}exports[_0x53c4('0x33')]=function(_0x337713,_0x3e517c){var _0x3e70b3={},_0x3fb169={},_0x41987c={'count':0x0,'rows':[]};var _0x12c0b7=_[_0x53c4('0x34')](db[_0x53c4('0x35')][_0x53c4('0x36')],function(_0x46520f){return{'name':_0x46520f[_0x53c4('0x37')],'type':_0x46520f['type'][_0x53c4('0x38')]};});_0x3fb169['model']=_[_0x53c4('0x34')](_0x12c0b7,_0x53c4('0x31'));_0x3fb169[_0x53c4('0x39')]=_[_0x53c4('0x3a')](_0x337713['query']);_0x3fb169[_0x53c4('0x3b')]=_[_0x53c4('0x3c')](_0x3fb169[_0x53c4('0x3d')],_0x3fb169[_0x53c4('0x39')]);_0x3e70b3['attributes']=_[_0x53c4('0x3c')](_0x3fb169[_0x53c4('0x3d')],qs[_0x53c4('0x3e')](_0x337713['query'][_0x53c4('0x3e')]));_0x3e70b3[_0x53c4('0x3f')]=_0x3e70b3[_0x53c4('0x3f')][_0x53c4('0x40')]?_0x3e70b3['attributes']:_0x3fb169[_0x53c4('0x3d')];if(!_0x337713[_0x53c4('0x39')][_0x53c4('0x41')](_0x53c4('0x42'))){_0x3e70b3[_0x53c4('0x22')]=qs['limit'](_0x337713['query'][_0x53c4('0x22')]);_0x3e70b3[_0x53c4('0x20')]=qs[_0x53c4('0x20')](_0x337713[_0x53c4('0x39')][_0x53c4('0x20')]);}_0x3e70b3[_0x53c4('0x43')]=qs[_0x53c4('0x44')](_0x337713['query']['sort']);_0x3e70b3[_0x53c4('0x45')]=qs[_0x53c4('0x3b')](_['pick'](_0x337713[_0x53c4('0x39')],_0x3fb169[_0x53c4('0x3b')]),_0x12c0b7);if(_0x337713[_0x53c4('0x39')][_0x53c4('0x46')]){_0x3e70b3[_0x53c4('0x45')]=_[_0x53c4('0x47')](_0x3e70b3[_0x53c4('0x45')],{'$or':_[_0x53c4('0x34')](_0x12c0b7,function(_0x4d709b){if(_0x4d709b['type']!=='VIRTUAL'){var _0x3e0945={};_0x3e0945[_0x4d709b[_0x53c4('0x31')]]={'$like':'%'+_0x337713[_0x53c4('0x39')][_0x53c4('0x46')]+'%'};return _0x3e0945;}})});}_0x3e70b3=_[_0x53c4('0x47')]({},_0x3e70b3,_0x337713[_0x53c4('0x48')]);var _0x5c4f18={'where':_0x3e70b3[_0x53c4('0x45')]};return db[_0x53c4('0x35')][_0x53c4('0x23')](_0x5c4f18)[_0x53c4('0x2a')](function(_0x5c2874){_0x41987c[_0x53c4('0x23')]=_0x5c2874;if(_0x337713[_0x53c4('0x39')][_0x53c4('0x49')]){_0x3e70b3[_0x53c4('0x4a')]=[{'all':!![]}];}return db[_0x53c4('0x35')][_0x53c4('0x4b')](_0x3e70b3);})['then'](function(_0x5839c0){_0x41987c[_0x53c4('0x4c')]=_0x5839c0;return _0x41987c;})[_0x53c4('0x2a')](respondWithFilteredResult(_0x3e517c,_0x3e70b3))[_0x53c4('0x4d')](handleError(_0x3e517c,null));};exports['show']=function(_0x59cbe0,_0x463e46){var _0x4edfb9={'raw':!![],'where':{'id':_0x59cbe0['params']['id']}},_0x3f48c5={};_0x3f48c5[_0x53c4('0x3d')]=_[_0x53c4('0x3a')](db[_0x53c4('0x35')][_0x53c4('0x36')]);_0x3f48c5['query']=_[_0x53c4('0x3a')](_0x59cbe0[_0x53c4('0x39')]);_0x3f48c5[_0x53c4('0x3b')]=_['intersection'](_0x3f48c5['model'],_0x3f48c5[_0x53c4('0x39')]);_0x4edfb9[_0x53c4('0x3f')]=_[_0x53c4('0x3c')](_0x3f48c5[_0x53c4('0x3d')],qs['fields'](_0x59cbe0[_0x53c4('0x39')]['fields']));_0x4edfb9[_0x53c4('0x3f')]=_0x4edfb9['attributes'][_0x53c4('0x40')]?_0x4edfb9[_0x53c4('0x3f')]:_0x3f48c5[_0x53c4('0x3d')];if(_0x59cbe0[_0x53c4('0x39')][_0x53c4('0x49')]){_0x4edfb9[_0x53c4('0x4a')]=[{'all':!![]}];}_0x4edfb9=_[_0x53c4('0x47')]({},_0x4edfb9,_0x59cbe0['options']);return db['SmsQueue']['find'](_0x4edfb9)['then'](handleEntityNotFound(_0x463e46,null))['then'](respondWithResult(_0x463e46,null))[_0x53c4('0x4d')](handleError(_0x463e46,null));};exports[_0x53c4('0x4e')]=function(_0x41ddd0,_0x2bac83){return db[_0x53c4('0x35')][_0x53c4('0x4e')](_0x41ddd0['body'],{})['then'](function(_0x1de693){var _0x3cd41b=_0x41ddd0[_0x53c4('0x4f')][_0x53c4('0x2b')]({'plain':!![]});if(!_0x3cd41b)throw new Error(_0x53c4('0x50'));if(_0x3cd41b[_0x53c4('0x51')]===_0x53c4('0x4f')){var _0x22d24c=_0x1de693[_0x53c4('0x2b')]({'plain':!![]});var _0x43c42a='SmsQueues';return db[_0x53c4('0x52')][_0x53c4('0x53')]({'where':{'name':_0x43c42a,'userProfileId':_0x3cd41b[_0x53c4('0x54')]},'raw':!![]})['then'](function(_0x2b68ae){if(_0x2b68ae&&_0x2b68ae[_0x53c4('0x55')]===0x0){return db['UserProfileResource'][_0x53c4('0x4e')]({'name':_0x22d24c[_0x53c4('0x31')],'resourceId':_0x22d24c['id'],'type':_0x2b68ae['name'],'sectionId':_0x2b68ae['id']},{})[_0x53c4('0x2a')](function(){return _0x1de693;});}else{return _0x1de693;}})[_0x53c4('0x4d')](function(_0x584d4d){logger[_0x53c4('0x2f')](_0x53c4('0x56'),_0x584d4d);throw _0x584d4d;});}return _0x1de693;})[_0x53c4('0x2a')](respondWithResult(_0x2bac83,0xc9))[_0x53c4('0x4d')](handleError(_0x2bac83,null));};exports[_0x53c4('0x29')]=function(_0x60ca68,_0x267c16){if(_0x60ca68[_0x53c4('0x57')]['id']){delete _0x60ca68[_0x53c4('0x57')]['id'];}return db[_0x53c4('0x35')][_0x53c4('0x53')]({'where':{'id':_0x60ca68[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0x267c16,null))[_0x53c4('0x2a')](saveUpdates(_0x60ca68['body'],null))[_0x53c4('0x2a')](respondWithResult(_0x267c16,null))['catch'](handleError(_0x267c16,null));};exports[_0x53c4('0x2d')]=function(_0x31f3c8,_0x3e8568){return db['SmsQueue'][_0x53c4('0x53')]({'where':{'id':_0x31f3c8[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0x3e8568,null))['then'](removeEntity(_0x3e8568,null))[_0x53c4('0x4d')](handleError(_0x3e8568,null));};exports[_0x53c4('0x59')]=function(_0x55c89f,_0x2338f2){return db[_0x53c4('0x35')]['describe']()[_0x53c4('0x2a')](respondWithResult(_0x2338f2,null))[_0x53c4('0x4d')](handleError(_0x2338f2,null));};exports[_0x53c4('0x5a')]=function(_0x49bd79,_0x24d21c,_0x2d1fcf){var _0x3a52d4={'raw':!![],'where':{}},_0x5c42f3={},_0x53400d;return db['SmsQueue'][_0x53c4('0x5b')]({'where':{'id':_0x49bd79[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0x24d21c,null))[_0x53c4('0x2a')](function(_0x5de0e6){if(_0x5de0e6){_0x53400d=_0x5de0e6[_0x53c4('0x2b')]({'plain':!![]});_0x5c42f3['model']=_[_0x53c4('0x3a')](db[_0x53c4('0x5c')][_0x53c4('0x36')]);_0x5c42f3[_0x53c4('0x39')]=_[_0x53c4('0x3a')](_0x49bd79[_0x53c4('0x39')]);_0x5c42f3['filters']=_[_0x53c4('0x3c')](_0x5c42f3[_0x53c4('0x3d')],_0x5c42f3[_0x53c4('0x39')]);_0x3a52d4[_0x53c4('0x3f')]=_[_0x53c4('0x3c')](_0x5c42f3['model'],qs[_0x53c4('0x3e')](_0x49bd79[_0x53c4('0x39')][_0x53c4('0x3e')]));_0x3a52d4[_0x53c4('0x3f')]=_0x3a52d4[_0x53c4('0x3f')][_0x53c4('0x40')]?_0x3a52d4[_0x53c4('0x3f')]:_0x5c42f3[_0x53c4('0x3d')];if(!_0x49bd79[_0x53c4('0x39')]['hasOwnProperty'](_0x53c4('0x42'))){_0x3a52d4[_0x53c4('0x22')]=qs[_0x53c4('0x22')](_0x49bd79[_0x53c4('0x39')]['limit']);_0x3a52d4[_0x53c4('0x20')]=qs[_0x53c4('0x20')](_0x49bd79[_0x53c4('0x39')][_0x53c4('0x20')]);}_0x3a52d4[_0x53c4('0x43')]=qs[_0x53c4('0x44')](_0x49bd79[_0x53c4('0x39')]['sort']);_0x3a52d4[_0x53c4('0x45')]=qs[_0x53c4('0x3b')](_[_0x53c4('0x5d')](_0x49bd79['query'],_0x5c42f3[_0x53c4('0x3b')]));_0x3a52d4[_0x53c4('0x45')]['SmsQueueId']=_0x5de0e6['id'];if(_0x49bd79['query'][_0x53c4('0x46')]){_0x3a52d4[_0x53c4('0x45')]=_[_0x53c4('0x47')](_0x3a52d4[_0x53c4('0x45')],{'$or':_[_0x53c4('0x34')](_0x3a52d4[_0x53c4('0x3f')],function(_0x47bca3){var _0x3ac466={};_0x3ac466[_0x47bca3]={'$like':'%'+_0x49bd79[_0x53c4('0x39')][_0x53c4('0x46')]+'%'};return _0x3ac466;})});}_0x3a52d4=_[_0x53c4('0x47')]({},_0x3a52d4,_0x49bd79[_0x53c4('0x48')]);return db[_0x53c4('0x5c')]['findAll'](_0x3a52d4);}})['then'](function(_0x504d7a){if(_0x504d7a){return db[_0x53c4('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x504d7a,'UserId'),'role':_0x53c4('0x5f')},'attributes':['id',_0x53c4('0x31'),_0x53c4('0x60'),_0x53c4('0x61'),'createdAt']});}})[_0x53c4('0x2a')](function(_0x317eaf){if(_0x317eaf){return{'count':_0x317eaf[_0x53c4('0x23')],'rows':_[_0x53c4('0x34')](_0x317eaf[_0x53c4('0x4c')],function(_0x34e13e){return{'membername':_0x34e13e['name'],'UserId':_0x34e13e['id'],'queue_name':_0x53400d[_0x53c4('0x31')],'SmsQueueId':_0x53400d['id'],'interface':util[_0x53c4('0x62')](_0x53c4('0x63'),_0x53c4('0x64'),_0x34e13e[_0x53c4('0x31')]),'penalty':0x0,'paused':_0x34e13e[_0x53c4('0x60')],'createdAt':_0x34e13e[_0x53c4('0x65')],'updatedAt':_0x34e13e[_0x53c4('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x53c4('0x2a')](respondWithFilteredResult(_0x24d21c,_0x3a52d4))[_0x53c4('0x4d')](handleError(_0x24d21c,null));};exports[_0x53c4('0x66')]=function(_0x9c43a8,_0x53b6d6,_0x2d8f88){var _0x41a9a8={};var _0x1820ff={};var _0xf328c5;var _0x4cfe1;return db['SmsQueue']['findOne']({'where':{'id':_0x9c43a8[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0x53b6d6,null))[_0x53c4('0x2a')](function(_0x2ec9aa){if(_0x2ec9aa){_0xf328c5=_0x2ec9aa;_0x1820ff[_0x53c4('0x3d')]=_[_0x53c4('0x3a')](db[_0x53c4('0x67')][_0x53c4('0x36')]);_0x1820ff[_0x53c4('0x39')]=_['keys'](_0x9c43a8['query']);_0x1820ff[_0x53c4('0x3b')]=_[_0x53c4('0x3c')](_0x1820ff[_0x53c4('0x3d')],_0x1820ff[_0x53c4('0x39')]);_0x41a9a8[_0x53c4('0x3f')]=_[_0x53c4('0x3c')](_0x1820ff[_0x53c4('0x3d')],qs[_0x53c4('0x3e')](_0x9c43a8[_0x53c4('0x39')][_0x53c4('0x3e')]));_0x41a9a8['attributes']=_0x41a9a8[_0x53c4('0x3f')]['length']?_0x41a9a8[_0x53c4('0x3f')]:_0x1820ff[_0x53c4('0x3d')];_0x41a9a8[_0x53c4('0x43')]=qs[_0x53c4('0x44')](_0x9c43a8[_0x53c4('0x39')]['sort']);_0x41a9a8[_0x53c4('0x45')]=qs[_0x53c4('0x3b')](_[_0x53c4('0x5d')](_0x9c43a8[_0x53c4('0x39')],_0x1820ff[_0x53c4('0x3b')]));if(_0x9c43a8['query'][_0x53c4('0x46')]){_0x41a9a8[_0x53c4('0x45')]=_[_0x53c4('0x47')](_0x41a9a8[_0x53c4('0x45')],{'$or':_['map'](_0x41a9a8['attributes'],function(_0x36b82b){var _0x1847bb={};_0x1847bb[_0x36b82b]={'$like':'%'+_0x9c43a8[_0x53c4('0x39')][_0x53c4('0x46')]+'%'};return _0x1847bb;})});}_0x41a9a8=_[_0x53c4('0x47')]({},_0x41a9a8,_0x9c43a8[_0x53c4('0x48')]);return _0xf328c5[_0x53c4('0x66')](_0x41a9a8);}})[_0x53c4('0x2a')](function(_0x467ed9){if(_0x467ed9){_0x4cfe1=_0x467ed9[_0x53c4('0x40')];if(!_0x9c43a8[_0x53c4('0x39')][_0x53c4('0x41')](_0x53c4('0x42'))){_0x41a9a8[_0x53c4('0x22')]=qs[_0x53c4('0x22')](_0x9c43a8[_0x53c4('0x39')][_0x53c4('0x22')]);_0x41a9a8['offset']=qs['offset'](_0x9c43a8['query']['offset']);}return _0xf328c5[_0x53c4('0x66')](_0x41a9a8);}})[_0x53c4('0x2a')](function(_0x2909c3){if(_0x2909c3){return _0x2909c3?{'count':_0x4cfe1,'rows':_0x2909c3}:null;}})['then'](respondWithResult(_0x53b6d6,null))['catch'](handleError(_0x53b6d6,null));};exports[_0x53c4('0x68')]=function(_0x5bf814,_0xa59bf7,_0xc2abd4){var _0x4a1056=_0x5bf814[_0x53c4('0x57')][_0x53c4('0x69')];return db[_0x53c4('0x67')]['findAll']({'where':{'id':_0x4a1056},'attributes':['id'],'include':[{'model':db['User'],'as':_0x53c4('0x6a'),'attributes':['id',_0x53c4('0x31'),_0x53c4('0x6b'),_0x53c4('0x6c'),_0x53c4('0x6d')],'raw':!![]}]})['then'](function(_0x38cc07){if(_0x38cc07){var _0x231aa8=_[_0x53c4('0x6e')](_0x38cc07,function(_0x2f338f){var _0xa5a1ff=_0x2f338f[_0x53c4('0x2b')]({'plain':!![]});return _0xa5a1ff[_0x53c4('0x6a')];});return db[_0x53c4('0x35')][_0x53c4('0x53')]({'where':{'id':_0x5bf814[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](function(_0x4f9bff){return db['sequelize'][_0x53c4('0x6f')](function(_0x18ca2e){return _0x4f9bff[_0x53c4('0x68')](_0x4a1056,{'transaction':_0x18ca2e})['then'](function(){return BPromise[_0x53c4('0x70')](_0x231aa8,function(_0x377c2a){return db[_0x53c4('0x5c')]['findOrCreate']({'where':{'UserId':_0x377c2a['id'],'SmsQueueId':_0x5bf814[_0x53c4('0x58')]['id']},'transaction':_0x18ca2e});});})[_0x53c4('0x2a')](function(){_0x231aa8[_0x53c4('0x71')](function(_0x215959){socket[_0x53c4('0x72')]('userSmsQueue:save',{'UserId':_0x215959['id'],'SmsQueueId':_0x4f9bff['id']});});});});});}})[_0x53c4('0x2a')](respondWithStatusCode(_0xa59bf7,null))['catch'](handleError(_0xa59bf7,null));};exports['removeTeams']=function(_0x7e4727,_0x3a3f94,_0x40e5ea){return db['Team'][_0x53c4('0x4b')]({'where':{'id':_0x7e4727[_0x53c4('0x39')][_0x53c4('0x69')]},'attributes':['id'],'include':[{'model':db[_0x53c4('0x5e')],'as':_0x53c4('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x53c4('0x2a')](handleEntityNotFound(_0x3a3f94,null))[_0x53c4('0x2a')](function(_0x2161f7){var _0x334b4a=_[_0x53c4('0x34')](_0x2161f7,'id');var _0x11d82a=[];var _0x25883a=[];var _0x69846d=squel[_0x53c4('0x73')]();_0x69846d[_0x53c4('0x74')](_0x53c4('0x75'))['from']('team_has_sms_queues','tq')[_0x53c4('0x76')](_0x53c4('0x77'),'ut',_0x53c4('0x78'))['where'](_0x53c4('0x79'),_0x7e4727['params']['id']);for(var _0x79150a=0x0;_0x79150a<_0x2161f7[_0x53c4('0x40')];_0x79150a+=0x1){let _0x3855e6=_0x2161f7[_0x79150a];for(var _0x7aad70=0x0;_0x7aad70<_0x3855e6['Agents']['length'];_0x7aad70+=0x1){let _0x1ceae6=_0x3855e6['Agents'][_0x7aad70];var _0x58c83f=_0x69846d[_0x53c4('0x7a')]();_0x58c83f[_0x53c4('0x45')](_0x53c4('0x7b'),_0x1ceae6['id']);_0x25883a['push'](db[_0x53c4('0x7c')][_0x53c4('0x39')](_0x58c83f['toString'](),{'type':db[_0x53c4('0x7c')][_0x53c4('0x7d')]['SELECT']})[_0x53c4('0x2a')](function(_0x39adcf){if(_0x39adcf[_0x53c4('0x40')]===0x1){return _0x1ceae6['id'];}else{var _0x3b80b6=_[_0x53c4('0x7e')](_[_0x53c4('0x34')](_0x39adcf,_0x53c4('0x7f')),function(_0x35119b){return _[_0x53c4('0x80')](_0x334b4a,_0x35119b);});if(_0x3b80b6){return _0x1ceae6['id'];}}}));}}return BPromise[_0x53c4('0x81')](_0x25883a)[_0x53c4('0x2a')](function(_0x497a02){_0x11d82a=_(_0x11d82a)[_0x53c4('0x82')](_0x497a02)[_0x53c4('0x83')]()['value']();return db['SmsQueue'][_0x53c4('0x53')]({'where':{'id':_0x7e4727[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](function(_0x59d30f){return db['sequelize']['transaction'](function(_0x1bac47){return _0x59d30f['removeTeams'](_0x7e4727['query'][_0x53c4('0x69')],{'transaction':_0x1bac47})['then'](function(){if(!_[_0x53c4('0x84')](_0x11d82a)){return _0x59d30f[_0x53c4('0x85')](_0x11d82a,{'transaction':_0x1bac47});}})['then'](function(){_0x11d82a[_0x53c4('0x71')](function(_0x7872f4){socket[_0x53c4('0x72')](_0x53c4('0x86'),{'UserId':_0x7872f4,'SmsQueueId':_0x59d30f['id']});});});});});});})['then'](respondWithStatusCode(_0x3a3f94,null))[_0x53c4('0x4d')](handleError(_0x3a3f94,null));};exports[_0x53c4('0x87')]=function(_0x34703b,_0x848e90,_0xf3f187){return db[_0x53c4('0x35')][_0x53c4('0x53')]({'where':{'id':_0x34703b[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0x848e90,null))[_0x53c4('0x2a')](function(_0x41b861){if(_0x41b861){return _0x41b861[_0x53c4('0x87')](_0x34703b[_0x53c4('0x57')][_0x53c4('0x69')],_['omit'](_0x34703b[_0x53c4('0x57')],[_0x53c4('0x69'),'id'])||{})[_0x53c4('0x88')](function(_0x445fb2){for(var _0x902c9e=0x0;_0x902c9e<_0x34703b[_0x53c4('0x57')]['ids'][_0x53c4('0x40')];_0x902c9e+=0x1){socket[_0x53c4('0x72')](_0x53c4('0x89'),{'UserId':Number(_0x34703b[_0x53c4('0x57')]['ids'][_0x902c9e]),'SmsQueueId':Number(_0x34703b[_0x53c4('0x58')]['id'])});}return _0x445fb2;});}})['then'](respondWithResult(_0x848e90,null))[_0x53c4('0x4d')](handleError(_0x848e90,null));};exports['removeAgents']=function(_0x2167cd,_0xdca269,_0x377e9c){return db[_0x53c4('0x35')]['find']({'where':{'id':_0x2167cd[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0xdca269,null))[_0x53c4('0x2a')](function(_0x538b6e){if(_0x538b6e){return _0x538b6e[_0x53c4('0x85')](_0x2167cd['query'][_0x53c4('0x69')])[_0x53c4('0x2a')](function(){if(_[_0x53c4('0x8a')](_0x2167cd[_0x53c4('0x39')][_0x53c4('0x69')])){for(var _0x270731=0x0;_0x270731<_0x2167cd['query'][_0x53c4('0x69')]['length'];_0x270731+=0x1){socket[_0x53c4('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x2167cd[_0x53c4('0x39')][_0x53c4('0x69')][_0x270731]),'SmsQueueId':Number(_0x2167cd[_0x53c4('0x58')]['id'])});}}else{socket[_0x53c4('0x72')](_0x53c4('0x86'),{'UserId':Number(_0x2167cd[_0x53c4('0x39')][_0x53c4('0x69')]),'SmsQueueId':Number(_0x2167cd[_0x53c4('0x58')]['id'])});}});}})[_0x53c4('0x2a')](respondWithStatusCode(_0xdca269,null))[_0x53c4('0x4d')](handleError(_0xdca269,null));};exports['getAgents']=function(_0x4f7857,_0xb22ecd,_0x1a3db7){var _0x8aed2={};var _0x4b33be={};var _0x14fe32;var _0x4d39a9;return db[_0x53c4('0x35')][_0x53c4('0x5b')]({'where':{'id':_0x4f7857[_0x53c4('0x58')]['id']}})[_0x53c4('0x2a')](handleEntityNotFound(_0xb22ecd,null))[_0x53c4('0x2a')](function(_0x10e0a3){if(_0x10e0a3){_0x14fe32=_0x10e0a3;_0x4b33be[_0x53c4('0x3d')]=_[_0x53c4('0x3a')](db[_0x53c4('0x5e')][_0x53c4('0x36')]);_0x4b33be[_0x53c4('0x39')]=_[_0x53c4('0x3a')](_0x4f7857[_0x53c4('0x39')]);_0x4b33be[_0x53c4('0x3b')]=_[_0x53c4('0x3c')](_0x4b33be[_0x53c4('0x3d')],_0x4b33be[_0x53c4('0x39')]);_0x8aed2[_0x53c4('0x3f')]=_[_0x53c4('0x3c')](_0x4b33be[_0x53c4('0x3d')],qs[_0x53c4('0x3e')](_0x4f7857['query']['fields']));_0x8aed2['attributes']=_0x8aed2['attributes']['length']?_0x8aed2[_0x53c4('0x3f')]:_0x4b33be[_0x53c4('0x3d')];_0x8aed2[_0x53c4('0x43')]=qs[_0x53c4('0x44')](_0x4f7857[_0x53c4('0x39')][_0x53c4('0x44')]);_0x8aed2[_0x53c4('0x45')]=qs['filters'](_[_0x53c4('0x5d')](_0x4f7857[_0x53c4('0x39')],_0x4b33be[_0x53c4('0x3b')]));if(_0x4f7857[_0x53c4('0x39')][_0x53c4('0x46')]){_0x8aed2[_0x53c4('0x45')]=_[_0x53c4('0x47')](_0x8aed2['where'],{'$or':_[_0x53c4('0x34')](_0x8aed2['attributes'],function(_0x3d0645){var _0x327944={};_0x327944[_0x3d0645]={'$like':'%'+_0x4f7857[_0x53c4('0x39')][_0x53c4('0x46')]+'%'};return _0x327944;})});}_0x8aed2=_[_0x53c4('0x47')]({},_0x8aed2,_0x4f7857[_0x53c4('0x48')]);return _0x14fe32[_0x53c4('0x8b')](_0x8aed2);}})[_0x53c4('0x2a')](function(_0x3bf343){if(_0x3bf343){_0x4d39a9=_0x3bf343[_0x53c4('0x40')];if(!_0x4f7857[_0x53c4('0x39')][_0x53c4('0x41')]('nolimit')){_0x8aed2[_0x53c4('0x22')]=qs[_0x53c4('0x22')](_0x4f7857[_0x53c4('0x39')][_0x53c4('0x22')]);_0x8aed2[_0x53c4('0x20')]=qs[_0x53c4('0x20')](_0x4f7857[_0x53c4('0x39')][_0x53c4('0x20')]);}return _0x14fe32[_0x53c4('0x8b')](_0x8aed2);}})[_0x53c4('0x2a')](function(_0x1dde4f){if(_0x1dde4f){return _0x1dde4f?{'count':_0x4d39a9,'rows':_0x1dde4f}:null;}})[_0x53c4('0x2a')](respondWithResult(_0xb22ecd,null))[_0x53c4('0x4d')](handleError(_0xb22ecd,null));}; \ No newline at end of file +var _0xa486=['sendStatus','status','end','json','offset','undefined','count','limit','set','reject','get','SmsQueues','UserProfileResource','then','stack','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','show','keys','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','params','destroy','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','SIP','smsPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','union','removeTeams','removeAgents','emit','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa486,0x17d));var _0x6a48=function(_0x49c2f0,_0x3e0104){_0x49c2f0=_0x49c2f0-0x0;var _0x179020=_0xa486[_0x49c2f0];return _0x179020;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a48('0x2'));var moment=require('moment');var BPromise=require(_0x6a48('0x3'));var Mustache=require(_0x6a48('0x4'));var util=require(_0x6a48('0x5'));var path=require(_0x6a48('0x6'));var sox=require(_0x6a48('0x7'));var csv=require(_0x6a48('0x8'));var ejs=require(_0x6a48('0x9'));var fs=require('fs');var fs_extra=require(_0x6a48('0xa'));var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x8'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var licenseUtil=require(_0x6a48('0x19'));var db=require(_0x6a48('0x1a'))['db'];config[_0x6a48('0x1b')]=_[_0x6a48('0x1c')](config[_0x6a48('0x1b')],{'host':_0x6a48('0x1d'),'port':0x18eb});var socket=require(_0x6a48('0x1e'))(new Redis(config[_0x6a48('0x1b')]));require(_0x6a48('0x1f'))[_0x6a48('0x20')](socket);function respondWithStatusCode(_0xcbcb4b,_0x4ab8c6){_0x4ab8c6=_0x4ab8c6||0xcc;return function(_0x180319){if(_0x180319){return _0xcbcb4b[_0x6a48('0x21')](_0x4ab8c6);}return _0xcbcb4b[_0x6a48('0x22')](_0x4ab8c6)[_0x6a48('0x23')]();};}function respondWithResult(_0x231930,_0xaf303c){_0xaf303c=_0xaf303c||0xc8;return function(_0xad96d0){if(_0xad96d0){return _0x231930[_0x6a48('0x22')](_0xaf303c)[_0x6a48('0x24')](_0xad96d0);}};}function respondWithFilteredResult(_0x20cab5,_0x506bd2){return function(_0xab0913){if(_0xab0913){var _0x23a1fe=typeof _0x506bd2[_0x6a48('0x25')]===_0x6a48('0x26')&&typeof _0x506bd2['limit']===_0x6a48('0x26');var _0x43a80d=_0xab0913[_0x6a48('0x27')];var _0x4a252e=_0x23a1fe?0x0:_0x506bd2[_0x6a48('0x25')];var _0x6a0206=_0x23a1fe?_0xab0913[_0x6a48('0x27')]:_0x506bd2['offset']+_0x506bd2[_0x6a48('0x28')];var _0x24c549;if(_0x6a0206>=_0x43a80d){_0x6a0206=_0x43a80d;_0x24c549=0xc8;}else{_0x24c549=0xce;}_0x20cab5[_0x6a48('0x22')](_0x24c549);return _0x20cab5[_0x6a48('0x29')]('Content-Range',_0x4a252e+'-'+_0x6a0206+'/'+_0x43a80d)[_0x6a48('0x24')](_0xab0913);}return null;};}function patchUpdates(_0x230220){return function(_0x59b031){try{jsonpatch['apply'](_0x59b031,_0x230220,!![]);}catch(_0x11b488){return BPromise[_0x6a48('0x2a')](_0x11b488);}return _0x59b031['save']();};}function saveUpdates(_0x2eae9f,_0x4846bf){return function(_0x508432){if(_0x508432){return _0x508432['update'](_0x2eae9f)['then'](function(_0x2a14d5){return _0x2a14d5;});}return null;};}function removeEntity(_0x5eeef8,_0x19594c){return function(_0x52de7c){if(_0x52de7c){return _0x52de7c['destroy']()['then'](function(){var _0x5d62a6=_0x52de7c[_0x6a48('0x2b')]({'plain':!![]});var _0x29cfd2=_0x6a48('0x2c');return db[_0x6a48('0x2d')]['destroy']({'where':{'type':_0x29cfd2,'resourceId':_0x5d62a6['id']}})[_0x6a48('0x2e')](function(){return _0x52de7c;});})[_0x6a48('0x2e')](function(){_0x5eeef8[_0x6a48('0x22')](0xcc)[_0x6a48('0x23')]();});}};}function handleEntityNotFound(_0x5188e8,_0x57522a){return function(_0x39f2ee){if(!_0x39f2ee){_0x5188e8[_0x6a48('0x21')](0x194);}return _0x39f2ee;};}function handleError(_0x4168f2,_0x38e417){_0x38e417=_0x38e417||0x1f4;return function(_0x437622){logger['error'](_0x437622[_0x6a48('0x2f')]);if(_0x437622['name']){delete _0x437622['name'];}_0x4168f2[_0x6a48('0x22')](_0x38e417)[_0x6a48('0x30')](_0x437622);};}exports[_0x6a48('0x31')]=function(_0xd53693,_0x24aa89){var _0x81fa3c={},_0x346ebc={},_0xcd6f39={'count':0x0,'rows':[]};var _0x1372ef=_[_0x6a48('0x32')](db[_0x6a48('0x33')][_0x6a48('0x34')],function(_0x5aa79c){return{'name':_0x5aa79c[_0x6a48('0x35')],'type':_0x5aa79c[_0x6a48('0x36')][_0x6a48('0x37')]};});_0x346ebc['model']=_[_0x6a48('0x32')](_0x1372ef,'name');_0x346ebc[_0x6a48('0x38')]=_['keys'](_0xd53693[_0x6a48('0x38')]);_0x346ebc[_0x6a48('0x39')]=_[_0x6a48('0x3a')](_0x346ebc['model'],_0x346ebc[_0x6a48('0x38')]);_0x81fa3c[_0x6a48('0x3b')]=_['intersection'](_0x346ebc['model'],qs[_0x6a48('0x3c')](_0xd53693[_0x6a48('0x38')][_0x6a48('0x3c')]));_0x81fa3c[_0x6a48('0x3b')]=_0x81fa3c[_0x6a48('0x3b')][_0x6a48('0x3d')]?_0x81fa3c[_0x6a48('0x3b')]:_0x346ebc[_0x6a48('0x3e')];if(!_0xd53693['query'][_0x6a48('0x3f')](_0x6a48('0x40'))){_0x81fa3c[_0x6a48('0x28')]=qs[_0x6a48('0x28')](_0xd53693[_0x6a48('0x38')][_0x6a48('0x28')]);_0x81fa3c[_0x6a48('0x25')]=qs[_0x6a48('0x25')](_0xd53693[_0x6a48('0x38')][_0x6a48('0x25')]);}_0x81fa3c[_0x6a48('0x41')]=qs[_0x6a48('0x42')](_0xd53693[_0x6a48('0x38')][_0x6a48('0x42')]);_0x81fa3c['where']=qs[_0x6a48('0x39')](_[_0x6a48('0x43')](_0xd53693['query'],_0x346ebc[_0x6a48('0x39')]),_0x1372ef);if(_0xd53693[_0x6a48('0x38')][_0x6a48('0x44')]){_0x81fa3c[_0x6a48('0x45')]=_['merge'](_0x81fa3c[_0x6a48('0x45')],{'$or':_[_0x6a48('0x32')](_0x1372ef,function(_0x2190bb){if(_0x2190bb[_0x6a48('0x36')]!==_0x6a48('0x46')){var _0xd4e2b0={};_0xd4e2b0[_0x2190bb[_0x6a48('0x47')]]={'$like':'%'+_0xd53693['query']['filter']+'%'};return _0xd4e2b0;}})});}_0x81fa3c=_[_0x6a48('0x48')]({},_0x81fa3c,_0xd53693[_0x6a48('0x49')]);var _0x484e45={'where':_0x81fa3c[_0x6a48('0x45')]};return db[_0x6a48('0x33')]['count'](_0x484e45)[_0x6a48('0x2e')](function(_0x2abea4){_0xcd6f39[_0x6a48('0x27')]=_0x2abea4;if(_0xd53693[_0x6a48('0x38')][_0x6a48('0x4a')]){_0x81fa3c['include']=[{'all':!![]}];}return db[_0x6a48('0x33')]['findAll'](_0x81fa3c);})['then'](function(_0x1af9e8){_0xcd6f39['rows']=_0x1af9e8;return _0xcd6f39;})[_0x6a48('0x2e')](respondWithFilteredResult(_0x24aa89,_0x81fa3c))['catch'](handleError(_0x24aa89,null));};exports[_0x6a48('0x4b')]=function(_0xab4236,_0xd37fc6){var _0x4eddc7={'raw':!![],'where':{'id':_0xab4236['params']['id']}},_0x1b1b27={};_0x1b1b27['model']=_['keys'](db[_0x6a48('0x33')]['rawAttributes']);_0x1b1b27[_0x6a48('0x38')]=_[_0x6a48('0x4c')](_0xab4236[_0x6a48('0x38')]);_0x1b1b27[_0x6a48('0x39')]=_['intersection'](_0x1b1b27[_0x6a48('0x3e')],_0x1b1b27['query']);_0x4eddc7[_0x6a48('0x3b')]=_[_0x6a48('0x3a')](_0x1b1b27['model'],qs['fields'](_0xab4236[_0x6a48('0x38')][_0x6a48('0x3c')]));_0x4eddc7['attributes']=_0x4eddc7[_0x6a48('0x3b')][_0x6a48('0x3d')]?_0x4eddc7[_0x6a48('0x3b')]:_0x1b1b27[_0x6a48('0x3e')];if(_0xab4236[_0x6a48('0x38')][_0x6a48('0x4a')]){_0x4eddc7[_0x6a48('0x4d')]=[{'all':!![]}];}_0x4eddc7=_['merge']({},_0x4eddc7,_0xab4236[_0x6a48('0x49')]);return db[_0x6a48('0x33')]['find'](_0x4eddc7)[_0x6a48('0x2e')](handleEntityNotFound(_0xd37fc6,null))[_0x6a48('0x2e')](respondWithResult(_0xd37fc6,null))[_0x6a48('0x4e')](handleError(_0xd37fc6,null));};exports[_0x6a48('0x4f')]=function(_0x375358,_0x58b400){return db[_0x6a48('0x33')][_0x6a48('0x4f')](_0x375358[_0x6a48('0x50')],{})[_0x6a48('0x2e')](function(_0x1243bc){var _0x56cddc=_0x375358['user'][_0x6a48('0x2b')]({'plain':!![]});if(!_0x56cddc)throw new Error(_0x6a48('0x51'));if(_0x56cddc[_0x6a48('0x52')]==='user'){var _0x62856f=_0x1243bc['get']({'plain':!![]});var _0x28a57f=_0x6a48('0x2c');return db['UserProfileSection'][_0x6a48('0x53')]({'where':{'name':_0x28a57f,'userProfileId':_0x56cddc[_0x6a48('0x54')]},'raw':!![]})[_0x6a48('0x2e')](function(_0x2cfd79){if(_0x2cfd79&&_0x2cfd79[_0x6a48('0x55')]===0x0){return db[_0x6a48('0x2d')][_0x6a48('0x4f')]({'name':_0x62856f['name'],'resourceId':_0x62856f['id'],'type':_0x2cfd79[_0x6a48('0x47')],'sectionId':_0x2cfd79['id']},{})[_0x6a48('0x2e')](function(){return _0x1243bc;});}else{return _0x1243bc;}})['catch'](function(_0x5751ce){logger[_0x6a48('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5751ce);throw _0x5751ce;});}return _0x1243bc;})['then'](respondWithResult(_0x58b400,0xc9))[_0x6a48('0x4e')](handleError(_0x58b400,null));};exports['update']=function(_0x3efac2,_0x3099e2){if(_0x3efac2[_0x6a48('0x50')]['id']){delete _0x3efac2['body']['id'];}return db[_0x6a48('0x33')][_0x6a48('0x53')]({'where':{'id':_0x3efac2[_0x6a48('0x57')]['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x3099e2,null))[_0x6a48('0x2e')](saveUpdates(_0x3efac2[_0x6a48('0x50')],null))['then'](respondWithResult(_0x3099e2,null))[_0x6a48('0x4e')](handleError(_0x3099e2,null));};exports[_0x6a48('0x58')]=function(_0x2e3a0b,_0x55c643){return db[_0x6a48('0x33')]['find']({'where':{'id':_0x2e3a0b['params']['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x55c643,null))[_0x6a48('0x2e')](removeEntity(_0x55c643,null))[_0x6a48('0x4e')](handleError(_0x55c643,null));};exports['describe']=function(_0x4ca7c4,_0x3f6ed5){return db[_0x6a48('0x33')][_0x6a48('0x59')]()['then'](respondWithResult(_0x3f6ed5,null))[_0x6a48('0x4e')](handleError(_0x3f6ed5,null));};exports[_0x6a48('0x5a')]=function(_0x47cb9a,_0x476ef6,_0x4a0baa){var _0x4314ac={'raw':!![],'where':{}},_0x70b605={},_0x276f1e;return db[_0x6a48('0x33')][_0x6a48('0x5b')]({'where':{'id':_0x47cb9a[_0x6a48('0x57')]['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x476ef6,null))['then'](function(_0xcede73){if(_0xcede73){_0x276f1e=_0xcede73[_0x6a48('0x2b')]({'plain':!![]});_0x70b605[_0x6a48('0x3e')]=_[_0x6a48('0x4c')](db[_0x6a48('0x5c')][_0x6a48('0x34')]);_0x70b605[_0x6a48('0x38')]=_[_0x6a48('0x4c')](_0x47cb9a[_0x6a48('0x38')]);_0x70b605[_0x6a48('0x39')]=_[_0x6a48('0x3a')](_0x70b605['model'],_0x70b605[_0x6a48('0x38')]);_0x4314ac[_0x6a48('0x3b')]=_[_0x6a48('0x3a')](_0x70b605[_0x6a48('0x3e')],qs[_0x6a48('0x3c')](_0x47cb9a[_0x6a48('0x38')]['fields']));_0x4314ac['attributes']=_0x4314ac['attributes'][_0x6a48('0x3d')]?_0x4314ac[_0x6a48('0x3b')]:_0x70b605[_0x6a48('0x3e')];if(!_0x47cb9a[_0x6a48('0x38')]['hasOwnProperty'](_0x6a48('0x40'))){_0x4314ac['limit']=qs[_0x6a48('0x28')](_0x47cb9a[_0x6a48('0x38')][_0x6a48('0x28')]);_0x4314ac[_0x6a48('0x25')]=qs['offset'](_0x47cb9a[_0x6a48('0x38')][_0x6a48('0x25')]);}_0x4314ac[_0x6a48('0x41')]=qs[_0x6a48('0x42')](_0x47cb9a[_0x6a48('0x38')][_0x6a48('0x42')]);_0x4314ac[_0x6a48('0x45')]=qs[_0x6a48('0x39')](_[_0x6a48('0x43')](_0x47cb9a[_0x6a48('0x38')],_0x70b605[_0x6a48('0x39')]));_0x4314ac[_0x6a48('0x45')][_0x6a48('0x5d')]=_0xcede73['id'];if(_0x47cb9a[_0x6a48('0x38')][_0x6a48('0x44')]){_0x4314ac[_0x6a48('0x45')]=_[_0x6a48('0x48')](_0x4314ac[_0x6a48('0x45')],{'$or':_[_0x6a48('0x32')](_0x4314ac[_0x6a48('0x3b')],function(_0x36b8ad){var _0x1c5cdb={};_0x1c5cdb[_0x36b8ad]={'$like':'%'+_0x47cb9a[_0x6a48('0x38')][_0x6a48('0x44')]+'%'};return _0x1c5cdb;})});}_0x4314ac=_['merge']({},_0x4314ac,_0x47cb9a[_0x6a48('0x49')]);return db['UserSmsQueue'][_0x6a48('0x5e')](_0x4314ac);}})[_0x6a48('0x2e')](function(_0x5c1d99){if(_0x5c1d99){return db[_0x6a48('0x5f')][_0x6a48('0x60')]({'where':{'id':_['map'](_0x5c1d99,_0x6a48('0x61')),'role':'agent'},'attributes':['id',_0x6a48('0x47'),'smsPause',_0x6a48('0x62'),_0x6a48('0x63')]});}})[_0x6a48('0x2e')](function(_0x4e4219){if(_0x4e4219){return{'count':_0x4e4219[_0x6a48('0x27')],'rows':_[_0x6a48('0x32')](_0x4e4219['rows'],function(_0x535fde){return{'membername':_0x535fde[_0x6a48('0x47')],'UserId':_0x535fde['id'],'queue_name':_0x276f1e['name'],'SmsQueueId':_0x276f1e['id'],'interface':util['format']('%s/%s',_0x6a48('0x64'),_0x535fde[_0x6a48('0x47')]),'penalty':0x0,'paused':_0x535fde[_0x6a48('0x65')],'createdAt':_0x535fde[_0x6a48('0x63')],'updatedAt':_0x535fde[_0x6a48('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x476ef6,_0x4314ac))[_0x6a48('0x4e')](handleError(_0x476ef6,null));};exports[_0x6a48('0x66')]=function(_0x81ab7a,_0x4745f7,_0x26f3c6){var _0x3c7fc5={};var _0x42b2ac={};var _0x232a9c;var _0x1cd1d2;return db['SmsQueue'][_0x6a48('0x5b')]({'where':{'id':_0x81ab7a[_0x6a48('0x57')]['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x4745f7,null))[_0x6a48('0x2e')](function(_0x533a67){if(_0x533a67){_0x232a9c=_0x533a67;_0x42b2ac[_0x6a48('0x3e')]=_[_0x6a48('0x4c')](db[_0x6a48('0x67')][_0x6a48('0x34')]);_0x42b2ac['query']=_[_0x6a48('0x4c')](_0x81ab7a['query']);_0x42b2ac[_0x6a48('0x39')]=_[_0x6a48('0x3a')](_0x42b2ac['model'],_0x42b2ac[_0x6a48('0x38')]);_0x3c7fc5[_0x6a48('0x3b')]=_[_0x6a48('0x3a')](_0x42b2ac['model'],qs[_0x6a48('0x3c')](_0x81ab7a[_0x6a48('0x38')][_0x6a48('0x3c')]));_0x3c7fc5[_0x6a48('0x3b')]=_0x3c7fc5[_0x6a48('0x3b')][_0x6a48('0x3d')]?_0x3c7fc5[_0x6a48('0x3b')]:_0x42b2ac[_0x6a48('0x3e')];_0x3c7fc5[_0x6a48('0x41')]=qs['sort'](_0x81ab7a[_0x6a48('0x38')][_0x6a48('0x42')]);_0x3c7fc5['where']=qs[_0x6a48('0x39')](_['pick'](_0x81ab7a[_0x6a48('0x38')],_0x42b2ac[_0x6a48('0x39')]));if(_0x81ab7a[_0x6a48('0x38')][_0x6a48('0x44')]){_0x3c7fc5[_0x6a48('0x45')]=_[_0x6a48('0x48')](_0x3c7fc5[_0x6a48('0x45')],{'$or':_[_0x6a48('0x32')](_0x3c7fc5[_0x6a48('0x3b')],function(_0x18580e){var _0x4dda0c={};_0x4dda0c[_0x18580e]={'$like':'%'+_0x81ab7a[_0x6a48('0x38')][_0x6a48('0x44')]+'%'};return _0x4dda0c;})});}_0x3c7fc5=_[_0x6a48('0x48')]({},_0x3c7fc5,_0x81ab7a[_0x6a48('0x49')]);return _0x232a9c[_0x6a48('0x66')](_0x3c7fc5);}})[_0x6a48('0x2e')](function(_0x1dffa4){if(_0x1dffa4){_0x1cd1d2=_0x1dffa4['length'];if(!_0x81ab7a['query'][_0x6a48('0x3f')](_0x6a48('0x40'))){_0x3c7fc5['limit']=qs['limit'](_0x81ab7a[_0x6a48('0x38')][_0x6a48('0x28')]);_0x3c7fc5[_0x6a48('0x25')]=qs[_0x6a48('0x25')](_0x81ab7a[_0x6a48('0x38')]['offset']);}return _0x232a9c[_0x6a48('0x66')](_0x3c7fc5);}})['then'](function(_0x127f69){if(_0x127f69){return _0x127f69?{'count':_0x1cd1d2,'rows':_0x127f69}:null;}})[_0x6a48('0x2e')](respondWithResult(_0x4745f7,null))[_0x6a48('0x4e')](handleError(_0x4745f7,null));};exports[_0x6a48('0x68')]=function(_0x16f273,_0x6ba2d9,_0x3a3eee){var _0x590adc=_0x16f273[_0x6a48('0x50')][_0x6a48('0x69')];return db[_0x6a48('0x67')]['findAll']({'where':{'id':_0x590adc},'attributes':['id'],'include':[{'model':db[_0x6a48('0x5f')],'as':_0x6a48('0x6a'),'attributes':['id',_0x6a48('0x47'),_0x6a48('0x6b'),_0x6a48('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0x2028b8){if(_0x2028b8){var _0x5ba0db=_[_0x6a48('0x6d')](_0x2028b8,function(_0x3cc28a){var _0x356c7a=_0x3cc28a[_0x6a48('0x2b')]({'plain':!![]});return _0x356c7a[_0x6a48('0x6a')];});return db['SmsQueue']['find']({'where':{'id':_0x16f273[_0x6a48('0x57')]['id']}})['then'](function(_0x35ebb3){return db['sequelize'][_0x6a48('0x6e')](function(_0x3d8496){return _0x35ebb3[_0x6a48('0x68')](_0x590adc,{'transaction':_0x3d8496})[_0x6a48('0x2e')](function(){return BPromise['each'](_0x5ba0db,function(_0x13a19f){return db[_0x6a48('0x5c')][_0x6a48('0x6f')]({'where':{'UserId':_0x13a19f['id'],'SmsQueueId':_0x16f273['params']['id']},'transaction':_0x3d8496});});})[_0x6a48('0x2e')](function(){_0x5ba0db[_0x6a48('0x70')](function(_0x57042b){socket['emit'](_0x6a48('0x71'),{'UserId':_0x57042b['id'],'SmsQueueId':_0x35ebb3['id']});});});});});}})[_0x6a48('0x2e')](respondWithStatusCode(_0x6ba2d9,null))['catch'](handleError(_0x6ba2d9,null));};exports['removeTeams']=function(_0x1c1e2f,_0x5c2206,_0x15b678){return db[_0x6a48('0x67')][_0x6a48('0x5e')]({'where':{'id':_0x1c1e2f[_0x6a48('0x38')][_0x6a48('0x69')]},'attributes':['id'],'include':[{'model':db[_0x6a48('0x5f')],'as':_0x6a48('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x6a48('0x2e')](handleEntityNotFound(_0x5c2206,null))[_0x6a48('0x2e')](function(_0x4e9211){var _0x593302=_[_0x6a48('0x32')](_0x4e9211,'id');var _0x49d4db=[];var _0x3d890d=[];var _0x23cedd=squel[_0x6a48('0x72')]();_0x23cedd[_0x6a48('0x73')](_0x6a48('0x74'))[_0x6a48('0x75')](_0x6a48('0x76'),'tq')[_0x6a48('0x77')]('user_has_teams','ut',_0x6a48('0x78'))[_0x6a48('0x45')](_0x6a48('0x79'),_0x1c1e2f[_0x6a48('0x57')]['id']);for(var _0x4e58f0=0x0;_0x4e58f0<_0x4e9211[_0x6a48('0x3d')];_0x4e58f0+=0x1){let _0x413e4c=_0x4e9211[_0x4e58f0];for(var _0x829ab0=0x0;_0x829ab0<_0x413e4c[_0x6a48('0x6a')][_0x6a48('0x3d')];_0x829ab0+=0x1){let _0x5346ea=_0x413e4c[_0x6a48('0x6a')][_0x829ab0];var _0x24a2ae=_0x23cedd['clone']();_0x24a2ae[_0x6a48('0x45')](_0x6a48('0x7a'),_0x5346ea['id']);_0x3d890d[_0x6a48('0x7b')](db[_0x6a48('0x7c')][_0x6a48('0x38')](_0x24a2ae[_0x6a48('0x7d')](),{'type':db[_0x6a48('0x7c')]['QueryTypes'][_0x6a48('0x7e')]})[_0x6a48('0x2e')](function(_0x42000e){if(_0x42000e[_0x6a48('0x3d')]===0x1){return _0x5346ea['id'];}else{var _0x54e984=_[_0x6a48('0x7f')](_[_0x6a48('0x32')](_0x42000e,_0x6a48('0x80')),function(_0x23174a){return _['includes'](_0x593302,_0x23174a);});if(_0x54e984){return _0x5346ea['id'];}}}));}}return BPromise['all'](_0x3d890d)[_0x6a48('0x2e')](function(_0x2a731d){_0x49d4db=_(_0x49d4db)[_0x6a48('0x81')](_0x2a731d)['compact']()['value']();return db[_0x6a48('0x33')][_0x6a48('0x53')]({'where':{'id':_0x1c1e2f[_0x6a48('0x57')]['id']}})['then'](function(_0x330a5d){return db['sequelize'][_0x6a48('0x6e')](function(_0x6b9737){return _0x330a5d[_0x6a48('0x82')](_0x1c1e2f['query'][_0x6a48('0x69')],{'transaction':_0x6b9737})['then'](function(){if(!_['isEmpty'](_0x49d4db)){return _0x330a5d[_0x6a48('0x83')](_0x49d4db,{'transaction':_0x6b9737});}})['then'](function(){_0x49d4db[_0x6a48('0x70')](function(_0x2335c8){socket[_0x6a48('0x84')](_0x6a48('0x85'),{'UserId':_0x2335c8,'SmsQueueId':_0x330a5d['id']});});});});});});})[_0x6a48('0x2e')](respondWithStatusCode(_0x5c2206,null))[_0x6a48('0x4e')](handleError(_0x5c2206,null));};exports[_0x6a48('0x86')]=function(_0x348615,_0x4c3eac,_0x5b0137){return db[_0x6a48('0x33')][_0x6a48('0x53')]({'where':{'id':_0x348615[_0x6a48('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c3eac,null))[_0x6a48('0x2e')](function(_0xd408bc){if(_0xd408bc){return _0xd408bc[_0x6a48('0x86')](_0x348615[_0x6a48('0x50')]['ids'],_['omit'](_0x348615[_0x6a48('0x50')],['ids','id'])||{})[_0x6a48('0x87')](function(_0x1094d3){for(var _0x3204cf=0x0;_0x3204cf<_0x348615[_0x6a48('0x50')][_0x6a48('0x69')]['length'];_0x3204cf+=0x1){socket[_0x6a48('0x84')](_0x6a48('0x71'),{'UserId':Number(_0x348615[_0x6a48('0x50')][_0x6a48('0x69')][_0x3204cf]),'SmsQueueId':Number(_0x348615['params']['id'])});}return _0x1094d3;});}})[_0x6a48('0x2e')](respondWithResult(_0x4c3eac,null))[_0x6a48('0x4e')](handleError(_0x4c3eac,null));};exports[_0x6a48('0x83')]=function(_0x27635a,_0x570ce9,_0x37b697){return db[_0x6a48('0x33')][_0x6a48('0x53')]({'where':{'id':_0x27635a[_0x6a48('0x57')]['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x570ce9,null))['then'](function(_0x420085){if(_0x420085){return _0x420085['removeAgents'](_0x27635a['query'][_0x6a48('0x69')])[_0x6a48('0x2e')](function(){if(_[_0x6a48('0x88')](_0x27635a[_0x6a48('0x38')]['ids'])){for(var _0x208b3d=0x0;_0x208b3d<_0x27635a[_0x6a48('0x38')][_0x6a48('0x69')]['length'];_0x208b3d+=0x1){socket[_0x6a48('0x84')](_0x6a48('0x85'),{'UserId':Number(_0x27635a['query'][_0x6a48('0x69')][_0x208b3d]),'SmsQueueId':Number(_0x27635a[_0x6a48('0x57')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x27635a['query'][_0x6a48('0x69')]),'SmsQueueId':Number(_0x27635a[_0x6a48('0x57')]['id'])});}});}})[_0x6a48('0x2e')](respondWithStatusCode(_0x570ce9,null))[_0x6a48('0x4e')](handleError(_0x570ce9,null));};exports[_0x6a48('0x89')]=function(_0x2606b5,_0x5412c8,_0x32088f){var _0x4f4a17={};var _0x253ddb={};var _0x35888b;var _0x247964;return db[_0x6a48('0x33')][_0x6a48('0x5b')]({'where':{'id':_0x2606b5[_0x6a48('0x57')]['id']}})[_0x6a48('0x2e')](handleEntityNotFound(_0x5412c8,null))['then'](function(_0x4b494d){if(_0x4b494d){_0x35888b=_0x4b494d;_0x253ddb[_0x6a48('0x3e')]=_['keys'](db[_0x6a48('0x5f')][_0x6a48('0x34')]);_0x253ddb[_0x6a48('0x38')]=_[_0x6a48('0x4c')](_0x2606b5[_0x6a48('0x38')]);_0x253ddb[_0x6a48('0x39')]=_[_0x6a48('0x3a')](_0x253ddb['model'],_0x253ddb[_0x6a48('0x38')]);_0x4f4a17[_0x6a48('0x3b')]=_[_0x6a48('0x3a')](_0x253ddb['model'],qs['fields'](_0x2606b5['query'][_0x6a48('0x3c')]));_0x4f4a17[_0x6a48('0x3b')]=_0x4f4a17[_0x6a48('0x3b')][_0x6a48('0x3d')]?_0x4f4a17['attributes']:_0x253ddb[_0x6a48('0x3e')];_0x4f4a17['order']=qs[_0x6a48('0x42')](_0x2606b5[_0x6a48('0x38')][_0x6a48('0x42')]);_0x4f4a17[_0x6a48('0x45')]=qs[_0x6a48('0x39')](_[_0x6a48('0x43')](_0x2606b5[_0x6a48('0x38')],_0x253ddb[_0x6a48('0x39')]));if(_0x2606b5[_0x6a48('0x38')][_0x6a48('0x44')]){_0x4f4a17[_0x6a48('0x45')]=_[_0x6a48('0x48')](_0x4f4a17[_0x6a48('0x45')],{'$or':_[_0x6a48('0x32')](_0x4f4a17['attributes'],function(_0x381649){var _0x210401={};_0x210401[_0x381649]={'$like':'%'+_0x2606b5['query'][_0x6a48('0x44')]+'%'};return _0x210401;})});}_0x4f4a17=_[_0x6a48('0x48')]({},_0x4f4a17,_0x2606b5[_0x6a48('0x49')]);return _0x35888b[_0x6a48('0x89')](_0x4f4a17);}})[_0x6a48('0x2e')](function(_0xcdc9b4){if(_0xcdc9b4){_0x247964=_0xcdc9b4[_0x6a48('0x3d')];if(!_0x2606b5[_0x6a48('0x38')][_0x6a48('0x3f')](_0x6a48('0x40'))){_0x4f4a17[_0x6a48('0x28')]=qs[_0x6a48('0x28')](_0x2606b5[_0x6a48('0x38')]['limit']);_0x4f4a17[_0x6a48('0x25')]=qs[_0x6a48('0x25')](_0x2606b5['query'][_0x6a48('0x25')]);}return _0x35888b['getAgents'](_0x4f4a17);}})[_0x6a48('0x2e')](function(_0x1b6111){if(_0x1b6111){return _0x1b6111?{'count':_0x247964,'rows':_0x1b6111}:null;}})[_0x6a48('0x2e')](respondWithResult(_0x5412c8,null))['catch'](handleError(_0x5412c8,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5f31492..3f63ce5 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 _0xb3af=['SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x30a70c,_0x53a2f7){var _0x182bcc=function(_0x38012e){while(--_0x38012e){_0x30a70c['push'](_0x30a70c['shift']());}};_0x182bcc(++_0x53a2f7);}(_0xb3af,0x1b7));var _0xfb3a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb3af[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xfb3a('0x0'))['db'][_0xfb3a('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb3a('0x2')](0x0);var events={'afterCreate':_0xfb3a('0x3'),'afterUpdate':_0xfb3a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5d90bc){return function(_0x37f7a0,_0x3bb430,_0x3abd34){SmsQueueEvents[_0xfb3a('0x5')](_0x5d90bc+':'+_0x37f7a0['id'],_0x37f7a0);SmsQueueEvents[_0xfb3a('0x5')](_0x5d90bc,_0x37f7a0);_0x3abd34(null);};}for(var e in events){if(events[_0xfb3a('0x6')](e)){var event=events[e];SmsQueue[_0xfb3a('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x2efd=['hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x248eaa,_0x381bb6){var _0x5be70f=function(_0x2458c0){while(--_0x2458c0){_0x248eaa['push'](_0x248eaa['shift']());}};_0x5be70f(++_0x381bb6);}(_0x2efd,0xcb));var _0xd2ef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2efd[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xd2ef('0x0'))['db'][_0xd2ef('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd2ef('0x2')](0x0);var events={'afterCreate':_0xd2ef('0x3'),'afterUpdate':_0xd2ef('0x4'),'afterDestroy':_0xd2ef('0x5')};function emitEvent(_0x2f288d){return function(_0x5bfffe,_0xb045b2,_0xd2d43e){SmsQueueEvents[_0xd2ef('0x6')](_0x2f288d+':'+_0x5bfffe['id'],_0x5bfffe);SmsQueueEvents['emit'](_0x2f288d,_0x5bfffe);_0xd2d43e(null);};}for(var e in events){if(events[_0xd2ef('0x7')](e)){var event=events[e];SmsQueue[_0xd2ef('0x8')](e,emitEvent(event));}}module[_0xd2ef('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f1f6d3b..1204cba 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 _0x41e2=['exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes'];(function(_0x5dd391,_0x4763e3){var _0x47eccc=function(_0x85998e){while(--_0x85998e){_0x5dd391['push'](_0x5dd391['shift']());}};_0x47eccc(++_0x4763e3);}(_0x41e2,0x197));var _0x241e=function(_0x28f550,_0x5ec7d4){_0x28f550=_0x28f550-0x0;var _0x3d8001=_0x41e2[_0x28f550];return _0x3d8001;};'use strict';var _=require(_0x241e('0x0'));var util=require('util');var logger=require(_0x241e('0x1'))(_0x241e('0x2'));var moment=require(_0x241e('0x3'));var BPromise=require(_0x241e('0x4'));var rp=require(_0x241e('0x5'));var fs=require('fs');var path=require(_0x241e('0x6'));var rimraf=require(_0x241e('0x7'));var config=require('../../config/environment');var attributes=require(_0x241e('0x8'));module[_0x241e('0x9')]=function(_0xb543fb,_0x55ecca){return _0xb543fb[_0x241e('0xa')](_0x241e('0xb'),attributes,{'tableName':_0x241e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca86=['exports','define','SmsQueue','sms_queues','lodash','api','moment','request-promise','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xca86,0x1a6));var _0x6ca8=function(_0x4d051b,_0x1c31d2){_0x4d051b=_0x4d051b-0x0;var _0x12e0ca=_0xca86[_0x4d051b];return _0x12e0ca;};'use strict';var _=require(_0x6ca8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca8('0x1'));var moment=require(_0x6ca8('0x2'));var BPromise=require('bluebird');var rp=require(_0x6ca8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ca8('0x4'));var config=require(_0x6ca8('0x5'));var attributes=require(_0x6ca8('0x6'));module[_0x6ca8('0x7')]=function(_0x8a1d5e,_0x586899){return _0x8a1d5e[_0x6ca8('0x8')](_0x6ca8('0x9'),attributes,{'tableName':_0x6ca8('0xa'),'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 b2775ae..d4c4238 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 _0xc775=['ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where','include','model','attributes','map','GetSmsQueue','catch'];(function(_0x294ca4,_0x2014a4){var _0x187cc0=function(_0x49fa8a){while(--_0x49fa8a){_0x294ca4['push'](_0x294ca4['shift']());}};_0x187cc0(++_0x2014a4);}(_0xc775,0x78));var _0x5c77=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc775[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5c77('0x0'));var util=require(_0x5c77('0x1'));var moment=require(_0x5c77('0x2'));var BPromise=require(_0x5c77('0x3'));var rs=require(_0x5c77('0x4'));var fs=require('fs');var Redis=require(_0x5c77('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c77('0x6'));var logger=require(_0x5c77('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5c77('0x8'));var client=jayson[_0x5c77('0x9')][_0x5c77('0xa')]({'port':0x232a});config['redis']=_[_0x5c77('0xb')](config[_0x5c77('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c77('0xd'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5c77('0xe')](socket);function respondWithRpcPromise(_0x1321ca,_0x4b15dd,_0x1e0d9a){return new BPromise(function(_0x15c18d,_0x596265){return client[_0x5c77('0xf')](_0x1321ca,_0x1e0d9a)[_0x5c77('0x10')](function(_0x285206){logger['info'](_0x5c77('0x11'),_0x4b15dd,_0x5c77('0x12'));logger[_0x5c77('0x13')](_0x5c77('0x14'),_0x4b15dd,_0x5c77('0x12'),JSON[_0x5c77('0x15')](_0x285206));if(_0x285206[_0x5c77('0x16')]){if(_0x285206['error'][_0x5c77('0x17')]===0x1f4){logger[_0x5c77('0x16')](_0x5c77('0x11'),_0x4b15dd,_0x285206[_0x5c77('0x16')][_0x5c77('0x18')]);return _0x596265(_0x285206['error'][_0x5c77('0x18')]);}logger[_0x5c77('0x16')](_0x5c77('0x11'),_0x4b15dd,_0x285206['error']['message']);return _0x15c18d(_0x285206[_0x5c77('0x16')][_0x5c77('0x18')]);}else{logger[_0x5c77('0x19')](_0x5c77('0x11'),_0x4b15dd,_0x5c77('0x12'));_0x15c18d(_0x285206[_0x5c77('0x1a')][_0x5c77('0x18')]);}})['catch'](function(_0x444d9c){logger[_0x5c77('0x16')](_0x5c77('0x11'),_0x4b15dd,_0x444d9c);_0x596265(_0x444d9c);});});}exports['GetSmsQueue']=function(_0x26d69e){var _0x28eb2d=this;return new Promise(function(_0x109524,_0x131f39){return db['SmsQueue'][_0x5c77('0x1b')]({'raw':_0x26d69e[_0x5c77('0x1c')]?_0x26d69e['options']['raw']===undefined?!![]:![]:!![],'where':_0x26d69e[_0x5c77('0x1c')]?_0x26d69e[_0x5c77('0x1c')][_0x5c77('0x1d')]||null:null,'attributes':_0x26d69e[_0x5c77('0x1c')]?_0x26d69e[_0x5c77('0x1c')]['attributes']||null:null,'limit':_0x26d69e['options']?_0x26d69e[_0x5c77('0x1c')]['limit']||null:null,'include':_0x26d69e['options']?_0x26d69e['options']['include']?_['map'](_0x26d69e['options'][_0x5c77('0x1e')],function(_0x6c9d9e){return{'model':db[_0x6c9d9e[_0x5c77('0x1f')]],'as':_0x6c9d9e['as'],'attributes':_0x6c9d9e[_0x5c77('0x20')],'include':_0x6c9d9e[_0x5c77('0x1e')]?_[_0x5c77('0x21')](_0x6c9d9e[_0x5c77('0x1e')],function(_0x4d2438){return{'model':db[_0x4d2438['model']],'as':_0x4d2438['as'],'attributes':_0x4d2438[_0x5c77('0x20')],'include':_0x4d2438['include']?_['map'](_0x4d2438[_0x5c77('0x1e')],function(_0x291e1e){return{'model':db[_0x291e1e[_0x5c77('0x1f')]],'as':_0x291e1e['as'],'attributes':_0x291e1e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c77('0x10')](function(_0x45893c){logger['info'](_0x5c77('0x22'),_0x26d69e);logger[_0x5c77('0x13')](_0x5c77('0x22'),_0x26d69e,JSON[_0x5c77('0x15')](_0x45893c));_0x109524(_0x45893c);})[_0x5c77('0x23')](function(_0x5ef3fd){logger[_0x5c77('0x16')](_0x5c77('0x22'),_0x5ef3fd[_0x5c77('0x18')],_0x26d69e);_0x131f39(_0x28eb2d['error'](0x1f4,_0x5ef3fd['message']));});});};exports[_0x5c77('0x24')]=function(_0x4d7b77){var _0x170e21=this;return new Promise(function(_0x2f0a87,_0x2a3454){return db['SmsQueue'][_0x5c77('0x25')]({'raw':_0x4d7b77[_0x5c77('0x1c')]?_0x4d7b77[_0x5c77('0x1c')][_0x5c77('0x26')]===undefined?!![]:![]:!![],'where':_0x4d7b77['options']?_0x4d7b77[_0x5c77('0x1c')][_0x5c77('0x1d')]||null:null,'attributes':_0x4d7b77[_0x5c77('0x1c')]?_0x4d7b77[_0x5c77('0x1c')][_0x5c77('0x20')]||null:null,'include':_0x4d7b77['options']?_0x4d7b77[_0x5c77('0x1c')][_0x5c77('0x1e')]?_[_0x5c77('0x21')](_0x4d7b77[_0x5c77('0x1c')][_0x5c77('0x1e')],function(_0x4324d5){return{'model':db[_0x4324d5['model']],'as':_0x4324d5['as'],'attributes':_0x4324d5['attributes'],'include':_0x4324d5[_0x5c77('0x1e')]?_[_0x5c77('0x21')](_0x4324d5[_0x5c77('0x1e')],function(_0x54896d){return{'model':db[_0x54896d['model']],'as':_0x54896d['as'],'attributes':_0x54896d['attributes'],'include':_0x54896d[_0x5c77('0x1e')]?_['map'](_0x54896d[_0x5c77('0x1e')],function(_0x3db7fa){return{'model':db[_0x3db7fa[_0x5c77('0x1f')]],'as':_0x3db7fa['as'],'attributes':_0x3db7fa[_0x5c77('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5c77('0x10')](function(_0x32bf6e){logger[_0x5c77('0x19')](_0x5c77('0x24'),_0x4d7b77);logger[_0x5c77('0x13')](_0x5c77('0x24'),_0x4d7b77,JSON[_0x5c77('0x15')](_0x32bf6e));_0x2f0a87(_0x32bf6e);})[_0x5c77('0x23')](function(_0x4d4b6a){logger[_0x5c77('0x16')](_0x5c77('0x24'),_0x4d4b6a['message'],_0x4d7b77);_0x2a3454(_0x170e21[_0x5c77('0x16')](0x1f4,_0x4d4b6a[_0x5c77('0x18')]));});});}; \ No newline at end of file +var _0xd1f1=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSmsQueue','SmsQueue','options','raw','where','limit','map','include','model','attributes','then','find','ShowSmsQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xb49f68,_0x3b2899){var _0x503f83=function(_0x332838){while(--_0x332838){_0xb49f68['push'](_0xb49f68['shift']());}};_0x503f83(++_0x3b2899);}(_0xd1f1,0xab));var _0x1d1f=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0xd1f1[_0x366e75];return _0x3b167b;};'use strict';var _=require(_0x1d1f('0x0'));var util=require('util');var moment=require(_0x1d1f('0x1'));var BPromise=require(_0x1d1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d1f('0x3'));var db=require(_0x1d1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d1f('0x5'))('rpc');var config=require(_0x1d1f('0x6'));var jayson=require(_0x1d1f('0x7'));var client=jayson[_0x1d1f('0x8')][_0x1d1f('0x9')]({'port':0x232a});config[_0x1d1f('0xa')]=_[_0x1d1f('0xb')](config[_0x1d1f('0xa')],{'host':_0x1d1f('0xc'),'port':0x18eb});var socket=require(_0x1d1f('0xd'))(new Redis(config[_0x1d1f('0xa')]));require(_0x1d1f('0xe'))['register'](socket);function respondWithRpcPromise(_0x194cff,_0x38d4b4,_0x268ea9){return new BPromise(function(_0x265b7c,_0x49d6a1){return client[_0x1d1f('0xf')](_0x194cff,_0x268ea9)['then'](function(_0x3f4a5e){logger[_0x1d1f('0x10')](_0x1d1f('0x11'),_0x38d4b4,_0x1d1f('0x12'));logger[_0x1d1f('0x13')](_0x1d1f('0x14'),_0x38d4b4,_0x1d1f('0x12'),JSON[_0x1d1f('0x15')](_0x3f4a5e));if(_0x3f4a5e[_0x1d1f('0x16')]){if(_0x3f4a5e[_0x1d1f('0x16')]['code']===0x1f4){logger[_0x1d1f('0x16')](_0x1d1f('0x11'),_0x38d4b4,_0x3f4a5e[_0x1d1f('0x16')]['message']);return _0x49d6a1(_0x3f4a5e[_0x1d1f('0x16')]['message']);}logger[_0x1d1f('0x16')](_0x1d1f('0x11'),_0x38d4b4,_0x3f4a5e[_0x1d1f('0x16')][_0x1d1f('0x17')]);return _0x265b7c(_0x3f4a5e[_0x1d1f('0x16')][_0x1d1f('0x17')]);}else{logger[_0x1d1f('0x10')](_0x1d1f('0x11'),_0x38d4b4,_0x1d1f('0x12'));_0x265b7c(_0x3f4a5e['result'][_0x1d1f('0x17')]);}})[_0x1d1f('0x18')](function(_0x210b4d){logger[_0x1d1f('0x16')](_0x1d1f('0x11'),_0x38d4b4,_0x210b4d);_0x49d6a1(_0x210b4d);});});}exports[_0x1d1f('0x19')]=function(_0xcf8e14){var _0x401c7a=this;return new Promise(function(_0x40b8b5,_0x5dccee){return db[_0x1d1f('0x1a')]['findAll']({'raw':_0xcf8e14[_0x1d1f('0x1b')]?_0xcf8e14['options'][_0x1d1f('0x1c')]===undefined?!![]:![]:!![],'where':_0xcf8e14[_0x1d1f('0x1b')]?_0xcf8e14[_0x1d1f('0x1b')][_0x1d1f('0x1d')]||null:null,'attributes':_0xcf8e14['options']?_0xcf8e14[_0x1d1f('0x1b')]['attributes']||null:null,'limit':_0xcf8e14['options']?_0xcf8e14[_0x1d1f('0x1b')][_0x1d1f('0x1e')]||null:null,'include':_0xcf8e14[_0x1d1f('0x1b')]?_0xcf8e14[_0x1d1f('0x1b')]['include']?_[_0x1d1f('0x1f')](_0xcf8e14['options'][_0x1d1f('0x20')],function(_0x5927b8){return{'model':db[_0x5927b8[_0x1d1f('0x21')]],'as':_0x5927b8['as'],'attributes':_0x5927b8[_0x1d1f('0x22')],'include':_0x5927b8[_0x1d1f('0x20')]?_['map'](_0x5927b8[_0x1d1f('0x20')],function(_0x5455aa){return{'model':db[_0x5455aa[_0x1d1f('0x21')]],'as':_0x5455aa['as'],'attributes':_0x5455aa[_0x1d1f('0x22')],'include':_0x5455aa[_0x1d1f('0x20')]?_[_0x1d1f('0x1f')](_0x5455aa['include'],function(_0x14ffaa){return{'model':db[_0x14ffaa[_0x1d1f('0x21')]],'as':_0x14ffaa['as'],'attributes':_0x14ffaa['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d1f('0x23')](function(_0xb2fcf6){logger['info']('GetSmsQueue',_0xcf8e14);logger['debug']('GetSmsQueue',_0xcf8e14,JSON[_0x1d1f('0x15')](_0xb2fcf6));_0x40b8b5(_0xb2fcf6);})[_0x1d1f('0x18')](function(_0x4d7d5c){logger[_0x1d1f('0x16')](_0x1d1f('0x19'),_0x4d7d5c[_0x1d1f('0x17')],_0xcf8e14);_0x5dccee(_0x401c7a[_0x1d1f('0x16')](0x1f4,_0x4d7d5c[_0x1d1f('0x17')]));});});};exports['ShowSmsQueue']=function(_0x49d6a3){var _0x3829bd=this;return new Promise(function(_0x3f7237,_0x7c2ef6){return db['SmsQueue'][_0x1d1f('0x24')]({'raw':_0x49d6a3['options']?_0x49d6a3['options'][_0x1d1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x49d6a3[_0x1d1f('0x1b')]?_0x49d6a3[_0x1d1f('0x1b')][_0x1d1f('0x1d')]||null:null,'attributes':_0x49d6a3['options']?_0x49d6a3['options'][_0x1d1f('0x22')]||null:null,'include':_0x49d6a3[_0x1d1f('0x1b')]?_0x49d6a3[_0x1d1f('0x1b')][_0x1d1f('0x20')]?_[_0x1d1f('0x1f')](_0x49d6a3['options'][_0x1d1f('0x20')],function(_0x1f22d3){return{'model':db[_0x1f22d3[_0x1d1f('0x21')]],'as':_0x1f22d3['as'],'attributes':_0x1f22d3[_0x1d1f('0x22')],'include':_0x1f22d3['include']?_[_0x1d1f('0x1f')](_0x1f22d3[_0x1d1f('0x20')],function(_0x250d1d){return{'model':db[_0x250d1d[_0x1d1f('0x21')]],'as':_0x250d1d['as'],'attributes':_0x250d1d['attributes'],'include':_0x250d1d[_0x1d1f('0x20')]?_[_0x1d1f('0x1f')](_0x250d1d[_0x1d1f('0x20')],function(_0x269cb1){return{'model':db[_0x269cb1['model']],'as':_0x269cb1['as'],'attributes':_0x269cb1[_0x1d1f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1d1f('0x23')](function(_0x23dbb2){logger[_0x1d1f('0x10')](_0x1d1f('0x25'),_0x49d6a3);logger['debug'](_0x1d1f('0x25'),_0x49d6a3,JSON[_0x1d1f('0x15')](_0x23dbb2));_0x3f7237(_0x23dbb2);})[_0x1d1f('0x18')](function(_0x1e2f2b){logger[_0x1d1f('0x16')](_0x1d1f('0x25'),_0x1e2f2b[_0x1d1f('0x17')],_0x49d6a3);_0x7c2ef6(_0x3829bd[_0x1d1f('0x16')](0x1f4,_0x1e2f2b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b5e3dee..35320ba 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 _0x4a42=['update','removeListener','register','length','./smsQueue.events','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4a42,0x10c));var _0x24a4=function(_0x1b7dcb,_0x384c62){_0x1b7dcb=_0x1b7dcb-0x0;var _0x5ee56c=_0x4a42[_0x1b7dcb];return _0x5ee56c;};'use strict';var SmsQueueEvents=require(_0x24a4('0x0'));var events=['save',_0x24a4('0x1'),_0x24a4('0x2')];function createListener(_0x4e264c,_0x1e7e30){return function(_0x2df252){_0x1e7e30['emit'](_0x4e264c,_0x2df252);};}function removeListener(_0x153cb3,_0x20fe52){return function(){SmsQueueEvents[_0x24a4('0x3')](_0x153cb3,_0x20fe52);};}exports[_0x24a4('0x4')]=function(_0xbdde61){for(var _0x45594b=0x0,_0x1248f1=events[_0x24a4('0x5')];_0x45594b<_0x1248f1;_0x45594b++){var _0x253680=events[_0x45594b];var _0x5341ae=createListener('smsQueue:'+_0x253680,_0xbdde61);SmsQueueEvents['on'](_0x253680,_0x5341ae);}}; \ No newline at end of file +var _0x7e2e=['length','smsQueue:','save','remove','update','emit','register'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x7e2e,0xb1));var _0xe7e2=function(_0x186798,_0x6e997c){_0x186798=_0x186798-0x0;var _0x5b46ea=_0x7e2e[_0x186798];return _0x5b46ea;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xe7e2('0x0'),_0xe7e2('0x1'),_0xe7e2('0x2')];function createListener(_0x1e3f28,_0x40b031){return function(_0x14cefd){_0x40b031[_0xe7e2('0x3')](_0x1e3f28,_0x14cefd);};}function removeListener(_0x3bcd67,_0x53dc33){return function(){SmsQueueEvents['removeListener'](_0x3bcd67,_0x53dc33);};}exports[_0xe7e2('0x4')]=function(_0x265a58){for(var _0x5e7385=0x0,_0x3cf6ae=events[_0xe7e2('0x5')];_0x5e7385<_0x3cf6ae;_0x5e7385++){var _0x1731ab=events[_0x5e7385];var _0x27d70=createListener(_0xe7e2('0x6')+_0x1731ab,_0x265a58);SmsQueueEvents['on'](_0x1731ab,_0x27d70);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4cf16ed..ac57432 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 _0xb714=['post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x34f6e4,_0x4b8c1a){var _0x15d736=function(_0xceb2b5){while(--_0xceb2b5){_0x34f6e4['push'](_0x34f6e4['shift']());}};_0x15d736(++_0x4b8c1a);}(_0xb714,0x196));var _0x4b71=function(_0x38bf74,_0x1164bd){_0x38bf74=_0x38bf74-0x0;var _0x414e5b=_0xb714[_0x38bf74];return _0x414e5b;};'use strict';var multer=require(_0x4b71('0x0'));var util=require(_0x4b71('0x1'));var path=require(_0x4b71('0x2'));var timeout=require(_0x4b71('0x3'));var express=require('express');var router=express[_0x4b71('0x4')]();var fs_extra=require(_0x4b71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4b71('0x6'));var config=require(_0x4b71('0x7'));var controller=require('./smsQueueReport.controller');router[_0x4b71('0x8')]('/',auth[_0x4b71('0x9')](),controller[_0x4b71('0xa')]);router['get'](_0x4b71('0xb'),auth[_0x4b71('0x9')](),controller['describe']);router[_0x4b71('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b71('0xc')]('/',auth[_0x4b71('0x9')](),controller[_0x4b71('0xd')]);router[_0x4b71('0xe')](_0x4b71('0xf'),auth[_0x4b71('0x9')](),controller['update']);router[_0x4b71('0x10')](_0x4b71('0xf'),auth['isAuthenticated'](),controller[_0x4b71('0x11')]);module[_0x4b71('0x12')]=router; \ No newline at end of file +var _0x3cd2=['/:id','show','post','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x13c052,_0x25c434){var _0x11de4f=function(_0x455187){while(--_0x455187){_0x13c052['push'](_0x13c052['shift']());}};_0x11de4f(++_0x25c434);}(_0x3cd2,0x115));var _0x23cd=function(_0x2c8ddf,_0x2eb7ac){_0x2c8ddf=_0x2c8ddf-0x0;var _0x5f0f03=_0x3cd2[_0x2c8ddf];return _0x5f0f03;};'use strict';var multer=require(_0x23cd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x23cd('0x1'));var router=express[_0x23cd('0x2')]();var fs_extra=require(_0x23cd('0x3'));var auth=require(_0x23cd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x23cd('0x5'));var controller=require(_0x23cd('0x6'));router['get']('/',auth[_0x23cd('0x7')](),controller['index']);router[_0x23cd('0x8')](_0x23cd('0x9'),auth['isAuthenticated'](),controller[_0x23cd('0xa')]);router[_0x23cd('0x8')](_0x23cd('0xb'),auth['isAuthenticated'](),controller[_0x23cd('0xc')]);router[_0x23cd('0xd')]('/',auth[_0x23cd('0x7')](),controller['create']);router[_0x23cd('0xe')]('/:id',auth[_0x23cd('0x7')](),controller['update']);router[_0x23cd('0xf')](_0x23cd('0xb'),auth[_0x23cd('0x7')](),controller[_0x23cd('0x10')]);module[_0x23cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1eaae4b..7ccc53e 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 _0x37b1=['moment','STRING','DATE'];(function(_0x7befab,_0x5435cc){var _0x499368=function(_0x4f53b8){while(--_0x4f53b8){_0x7befab['push'](_0x7befab['shift']());}};_0x499368(++_0x5435cc);}(_0x37b1,0x10b));var _0x137b=function(_0x3d627d,_0x1c4b6e){_0x3d627d=_0x3d627d-0x0;var _0x39aa67=_0x37b1[_0x3d627d];return _0x39aa67;};'use strict';var moment=require(_0x137b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x137b('0x1')]},'joinAt':{'type':Sequelize[_0x137b('0x2')]},'leaveAt':{'type':Sequelize[_0x137b('0x2')]},'acceptAt':{'type':Sequelize[_0x137b('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01e3=['moment','sequelize','exports','STRING','DATE'];(function(_0x4194d1,_0x151f26){var _0x580f65=function(_0x2c3422){while(--_0x2c3422){_0x4194d1['push'](_0x4194d1['shift']());}};_0x580f65(++_0x151f26);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x301e('0x0'));var Sequelize=require(_0x301e('0x1'));module[_0x301e('0x2')]={'uniqueid':{'type':Sequelize[_0x301e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x301e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x301e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x301e('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f64cd17..2d40084 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 _0x0b5f=['show','params','length','includeAll','options','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','findAll','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b5f,0xf1));var _0xf0b5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0b5f[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xf0b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0b5('0x1'));var jsonpatch=require(_0xf0b5('0x2'));var rp=require(_0xf0b5('0x3'));var moment=require('moment');var BPromise=require(_0xf0b5('0x4'));var Mustache=require(_0xf0b5('0x5'));var util=require(_0xf0b5('0x6'));var path=require(_0xf0b5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf0b5('0x8'));var fs=require('fs');var fs_extra=require(_0xf0b5('0x9'));var _=require(_0xf0b5('0xa'));var squel=require(_0xf0b5('0xb'));var crypto=require('crypto');var jsforce=require(_0xf0b5('0xc'));var deskjs=require(_0xf0b5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf0b5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf0b5('0xf'));var as=require(_0xf0b5('0x10'));var hardwareService=require(_0xf0b5('0x11'));var logger=require(_0xf0b5('0x12'))(_0xf0b5('0x13'));var utils=require(_0xf0b5('0x14'));var config=require(_0xf0b5('0x15'));var licenseUtil=require(_0xf0b5('0x16'));var db=require(_0xf0b5('0x17'))['db'];function respondWithStatusCode(_0x36e303,_0x488f62){_0x488f62=_0x488f62||0xcc;return function(_0x34d51a){if(_0x34d51a){return _0x36e303['sendStatus'](_0x488f62);}return _0x36e303[_0xf0b5('0x18')](_0x488f62)['end']();};}function respondWithResult(_0x182545,_0x167d04){_0x167d04=_0x167d04||0xc8;return function(_0x501801){if(_0x501801){return _0x182545[_0xf0b5('0x18')](_0x167d04)[_0xf0b5('0x19')](_0x501801);}};}function respondWithFilteredResult(_0x4dfe9c,_0x1fdc40){return function(_0x3e400a){if(_0x3e400a){var _0x119981=typeof _0x1fdc40[_0xf0b5('0x1a')]===_0xf0b5('0x1b')&&typeof _0x1fdc40[_0xf0b5('0x1c')]===_0xf0b5('0x1b');var _0x12b15d=_0x3e400a[_0xf0b5('0x1d')];var _0x3bb645=_0x119981?0x0:_0x1fdc40[_0xf0b5('0x1a')];var _0x532781=_0x119981?_0x3e400a[_0xf0b5('0x1d')]:_0x1fdc40[_0xf0b5('0x1a')]+_0x1fdc40[_0xf0b5('0x1c')];var _0x65830e;if(_0x532781>=_0x12b15d){_0x532781=_0x12b15d;_0x65830e=0xc8;}else{_0x65830e=0xce;}_0x4dfe9c['status'](_0x65830e);return _0x4dfe9c[_0xf0b5('0x1e')](_0xf0b5('0x1f'),_0x3bb645+'-'+_0x532781+'/'+_0x12b15d)['json'](_0x3e400a);}return null;};}function patchUpdates(_0x238632){return function(_0x342b0d){try{jsonpatch[_0xf0b5('0x20')](_0x342b0d,_0x238632,!![]);}catch(_0x20b5c2){return BPromise[_0xf0b5('0x21')](_0x20b5c2);}return _0x342b0d[_0xf0b5('0x22')]();};}function saveUpdates(_0xc005c9,_0x2c2443){return function(_0x57f407){if(_0x57f407){return _0x57f407['update'](_0xc005c9)[_0xf0b5('0x23')](function(_0xd82da2){return _0xd82da2;});}return null;};}function removeEntity(_0xa894f0,_0x3c09e1){return function(_0x2ebfdd){if(_0x2ebfdd){return _0x2ebfdd[_0xf0b5('0x24')]()[_0xf0b5('0x23')](function(){_0xa894f0[_0xf0b5('0x18')](0xcc)[_0xf0b5('0x25')]();});}};}function handleEntityNotFound(_0x234d52,_0x25eb39){return function(_0x2a23f0){if(!_0x2a23f0){_0x234d52[_0xf0b5('0x26')](0x194);}return _0x2a23f0;};}function handleError(_0x50e61c,_0x456e3a){_0x456e3a=_0x456e3a||0x1f4;return function(_0x16cefa){logger[_0xf0b5('0x27')](_0x16cefa[_0xf0b5('0x28')]);if(_0x16cefa[_0xf0b5('0x29')]){delete _0x16cefa[_0xf0b5('0x29')];}_0x50e61c[_0xf0b5('0x18')](_0x456e3a)['send'](_0x16cefa);};}exports[_0xf0b5('0x2a')]=function(_0xaa8eba,_0x486f56){var _0x2a66b6={},_0x1c451b={},_0x3b9182={'count':0x0,'rows':[]};var _0x2afab2=_[_0xf0b5('0x2b')](db[_0xf0b5('0x2c')][_0xf0b5('0x2d')],function(_0x26fcc4){return{'name':_0x26fcc4[_0xf0b5('0x2e')],'type':_0x26fcc4[_0xf0b5('0x2f')][_0xf0b5('0x30')]};});_0x1c451b[_0xf0b5('0x31')]=_[_0xf0b5('0x2b')](_0x2afab2,_0xf0b5('0x29'));_0x1c451b[_0xf0b5('0x32')]=_[_0xf0b5('0x33')](_0xaa8eba['query']);_0x1c451b[_0xf0b5('0x34')]=_['intersection'](_0x1c451b[_0xf0b5('0x31')],_0x1c451b[_0xf0b5('0x32')]);_0x2a66b6['attributes']=_[_0xf0b5('0x35')](_0x1c451b['model'],qs['fields'](_0xaa8eba[_0xf0b5('0x32')][_0xf0b5('0x36')]));_0x2a66b6[_0xf0b5('0x37')]=_0x2a66b6['attributes']['length']?_0x2a66b6[_0xf0b5('0x37')]:_0x1c451b[_0xf0b5('0x31')];if(!_0xaa8eba['query'][_0xf0b5('0x38')](_0xf0b5('0x39'))){_0x2a66b6['limit']=qs[_0xf0b5('0x1c')](_0xaa8eba[_0xf0b5('0x32')]['limit']);_0x2a66b6[_0xf0b5('0x1a')]=qs[_0xf0b5('0x1a')](_0xaa8eba[_0xf0b5('0x32')][_0xf0b5('0x1a')]);}_0x2a66b6[_0xf0b5('0x3a')]=qs[_0xf0b5('0x3b')](_0xaa8eba[_0xf0b5('0x32')][_0xf0b5('0x3b')]);_0x2a66b6[_0xf0b5('0x3c')]=qs['filters'](_[_0xf0b5('0x3d')](_0xaa8eba[_0xf0b5('0x32')],_0x1c451b[_0xf0b5('0x34')]),_0x2afab2);if(_0xaa8eba[_0xf0b5('0x32')]['filter']){_0x2a66b6[_0xf0b5('0x3c')]=_[_0xf0b5('0x3e')](_0x2a66b6[_0xf0b5('0x3c')],{'$or':_['map'](_0x2afab2,function(_0x5c2752){if(_0x5c2752[_0xf0b5('0x2f')]!=='VIRTUAL'){var _0x198278={};_0x198278[_0x5c2752[_0xf0b5('0x29')]]={'$like':'%'+_0xaa8eba[_0xf0b5('0x32')][_0xf0b5('0x3f')]+'%'};return _0x198278;}})});}_0x2a66b6=_[_0xf0b5('0x3e')]({},_0x2a66b6,_0xaa8eba['options']);var _0x108383={'where':_0x2a66b6['where']};return db['SmsQueueReport'][_0xf0b5('0x1d')](_0x108383)[_0xf0b5('0x23')](function(_0x15c71a){_0x3b9182[_0xf0b5('0x1d')]=_0x15c71a;if(_0xaa8eba['query']['includeAll']){_0x2a66b6[_0xf0b5('0x40')]=[{'all':!![]}];}return db[_0xf0b5('0x2c')][_0xf0b5('0x41')](_0x2a66b6);})['then'](function(_0x4e66e7){_0x3b9182['rows']=_0x4e66e7;return _0x3b9182;})[_0xf0b5('0x23')](respondWithFilteredResult(_0x486f56,_0x2a66b6))[_0xf0b5('0x42')](handleError(_0x486f56,null));};exports[_0xf0b5('0x43')]=function(_0x5657aa,_0xb88a62){var _0x4f6c9b={'raw':!![],'where':{'id':_0x5657aa[_0xf0b5('0x44')]['id']}},_0x65d83e={};_0x65d83e['model']=_['keys'](db[_0xf0b5('0x2c')][_0xf0b5('0x2d')]);_0x65d83e[_0xf0b5('0x32')]=_['keys'](_0x5657aa[_0xf0b5('0x32')]);_0x65d83e['filters']=_['intersection'](_0x65d83e[_0xf0b5('0x31')],_0x65d83e['query']);_0x4f6c9b[_0xf0b5('0x37')]=_['intersection'](_0x65d83e[_0xf0b5('0x31')],qs[_0xf0b5('0x36')](_0x5657aa['query'][_0xf0b5('0x36')]));_0x4f6c9b[_0xf0b5('0x37')]=_0x4f6c9b[_0xf0b5('0x37')][_0xf0b5('0x45')]?_0x4f6c9b[_0xf0b5('0x37')]:_0x65d83e['model'];if(_0x5657aa['query'][_0xf0b5('0x46')]){_0x4f6c9b[_0xf0b5('0x40')]=[{'all':!![]}];}_0x4f6c9b=_[_0xf0b5('0x3e')]({},_0x4f6c9b,_0x5657aa[_0xf0b5('0x47')]);return db[_0xf0b5('0x2c')][_0xf0b5('0x48')](_0x4f6c9b)[_0xf0b5('0x23')](handleEntityNotFound(_0xb88a62,null))[_0xf0b5('0x23')](respondWithResult(_0xb88a62,null))[_0xf0b5('0x42')](handleError(_0xb88a62,null));};exports['create']=function(_0x1a0397,_0x1e9b77){return db['SmsQueueReport'][_0xf0b5('0x49')](_0x1a0397['body'],{})[_0xf0b5('0x23')](respondWithResult(_0x1e9b77,0xc9))['catch'](handleError(_0x1e9b77,null));};exports[_0xf0b5('0x4a')]=function(_0x518b10,_0x536aa9){if(_0x518b10[_0xf0b5('0x4b')]['id']){delete _0x518b10[_0xf0b5('0x4b')]['id'];}return db[_0xf0b5('0x2c')][_0xf0b5('0x48')]({'where':{'id':_0x518b10['params']['id']}})[_0xf0b5('0x23')](handleEntityNotFound(_0x536aa9,null))[_0xf0b5('0x23')](saveUpdates(_0x518b10[_0xf0b5('0x4b')],null))['then'](respondWithResult(_0x536aa9,null))[_0xf0b5('0x42')](handleError(_0x536aa9,null));};exports[_0xf0b5('0x24')]=function(_0x1e6db4,_0x3ff2ed){return db[_0xf0b5('0x2c')][_0xf0b5('0x48')]({'where':{'id':_0x1e6db4['params']['id']}})['then'](handleEntityNotFound(_0x3ff2ed,null))[_0xf0b5('0x23')](removeEntity(_0x3ff2ed,null))[_0xf0b5('0x42')](handleError(_0x3ff2ed,null));};exports['describe']=function(_0x366c5c,_0x3302fb){return db[_0xf0b5('0x2c')][_0xf0b5('0x4c')]()[_0xf0b5('0x23')](respondWithResult(_0x3302fb,null))[_0xf0b5('0x42')](handleError(_0x3302fb,null));}; \ No newline at end of file +var _0x72db=['set','apply','reject','save','then','destroy','end','error','stack','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','json','offset','limit','undefined','count'];(function(_0x467347,_0x42b8d5){var _0xb070e0=function(_0x3841a1){while(--_0x3841a1){_0x467347['push'](_0x467347['shift']());}};_0xb070e0(++_0x42b8d5);}(_0x72db,0x1ea));var _0xb72d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x72db[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb72d('0x0'));var zipdir=require(_0xb72d('0x1'));var jsonpatch=require(_0xb72d('0x2'));var rp=require(_0xb72d('0x3'));var moment=require(_0xb72d('0x4'));var BPromise=require(_0xb72d('0x5'));var Mustache=require(_0xb72d('0x6'));var util=require('util');var path=require(_0xb72d('0x7'));var sox=require('sox');var csv=require(_0xb72d('0x8'));var ejs=require(_0xb72d('0x9'));var fs=require('fs');var fs_extra=require(_0xb72d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb72d('0xb'));var jsforce=require(_0xb72d('0xc'));var deskjs=require(_0xb72d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb72d('0xe'));var Redis=require('ioredis');var authService=require(_0xb72d('0xf'));var qs=require(_0xb72d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb72d('0x11'));var logger=require(_0xb72d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb72d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb72d('0x14'))['db'];function respondWithStatusCode(_0x478e05,_0x486347){_0x486347=_0x486347||0xcc;return function(_0x139172){if(_0x139172){return _0x478e05[_0xb72d('0x15')](_0x486347);}return _0x478e05[_0xb72d('0x16')](_0x486347)['end']();};}function respondWithResult(_0x4a0788,_0x1006de){_0x1006de=_0x1006de||0xc8;return function(_0x4195c6){if(_0x4195c6){return _0x4a0788['status'](_0x1006de)[_0xb72d('0x17')](_0x4195c6);}};}function respondWithFilteredResult(_0x264521,_0x16a040){return function(_0x3cee45){if(_0x3cee45){var _0x1ae243=typeof _0x16a040[_0xb72d('0x18')]==='undefined'&&typeof _0x16a040[_0xb72d('0x19')]===_0xb72d('0x1a');var _0x109b90=_0x3cee45[_0xb72d('0x1b')];var _0x3d8137=_0x1ae243?0x0:_0x16a040[_0xb72d('0x18')];var _0x1ea5ef=_0x1ae243?_0x3cee45[_0xb72d('0x1b')]:_0x16a040[_0xb72d('0x18')]+_0x16a040[_0xb72d('0x19')];var _0x1ea247;if(_0x1ea5ef>=_0x109b90){_0x1ea5ef=_0x109b90;_0x1ea247=0xc8;}else{_0x1ea247=0xce;}_0x264521[_0xb72d('0x16')](_0x1ea247);return _0x264521[_0xb72d('0x1c')]('Content-Range',_0x3d8137+'-'+_0x1ea5ef+'/'+_0x109b90)[_0xb72d('0x17')](_0x3cee45);}return null;};}function patchUpdates(_0x44dbd2){return function(_0x139040){try{jsonpatch[_0xb72d('0x1d')](_0x139040,_0x44dbd2,!![]);}catch(_0x4db985){return BPromise[_0xb72d('0x1e')](_0x4db985);}return _0x139040[_0xb72d('0x1f')]();};}function saveUpdates(_0x552a23,_0xe3705d){return function(_0x3d4c25){if(_0x3d4c25){return _0x3d4c25['update'](_0x552a23)[_0xb72d('0x20')](function(_0xe5d905){return _0xe5d905;});}return null;};}function removeEntity(_0x134848,_0x299f12){return function(_0x1559ea){if(_0x1559ea){return _0x1559ea[_0xb72d('0x21')]()[_0xb72d('0x20')](function(){_0x134848['status'](0xcc)[_0xb72d('0x22')]();});}};}function handleEntityNotFound(_0x292609,_0x43cf8b){return function(_0x4c4cc0){if(!_0x4c4cc0){_0x292609[_0xb72d('0x15')](0x194);}return _0x4c4cc0;};}function handleError(_0x207b98,_0x4ec70f){_0x4ec70f=_0x4ec70f||0x1f4;return function(_0x1f986b){logger[_0xb72d('0x23')](_0x1f986b[_0xb72d('0x24')]);if(_0x1f986b['name']){delete _0x1f986b['name'];}_0x207b98[_0xb72d('0x16')](_0x4ec70f)[_0xb72d('0x25')](_0x1f986b);};}exports[_0xb72d('0x26')]=function(_0x3a5c77,_0x26558b){var _0x5bf74a={},_0x2c2485={},_0x274ad0={'count':0x0,'rows':[]};var _0x5bbfa1=_[_0xb72d('0x27')](db[_0xb72d('0x28')][_0xb72d('0x29')],function(_0x160acb){return{'name':_0x160acb[_0xb72d('0x2a')],'type':_0x160acb[_0xb72d('0x2b')][_0xb72d('0x2c')]};});_0x2c2485[_0xb72d('0x2d')]=_['map'](_0x5bbfa1,'name');_0x2c2485[_0xb72d('0x2e')]=_['keys'](_0x3a5c77['query']);_0x2c2485[_0xb72d('0x2f')]=_['intersection'](_0x2c2485[_0xb72d('0x2d')],_0x2c2485[_0xb72d('0x2e')]);_0x5bf74a['attributes']=_[_0xb72d('0x30')](_0x2c2485[_0xb72d('0x2d')],qs['fields'](_0x3a5c77['query'][_0xb72d('0x31')]));_0x5bf74a[_0xb72d('0x32')]=_0x5bf74a[_0xb72d('0x32')][_0xb72d('0x33')]?_0x5bf74a[_0xb72d('0x32')]:_0x2c2485['model'];if(!_0x3a5c77[_0xb72d('0x2e')][_0xb72d('0x34')]('nolimit')){_0x5bf74a[_0xb72d('0x19')]=qs[_0xb72d('0x19')](_0x3a5c77[_0xb72d('0x2e')][_0xb72d('0x19')]);_0x5bf74a[_0xb72d('0x18')]=qs['offset'](_0x3a5c77['query'][_0xb72d('0x18')]);}_0x5bf74a[_0xb72d('0x35')]=qs[_0xb72d('0x36')](_0x3a5c77[_0xb72d('0x2e')]['sort']);_0x5bf74a['where']=qs[_0xb72d('0x2f')](_[_0xb72d('0x37')](_0x3a5c77[_0xb72d('0x2e')],_0x2c2485['filters']),_0x5bbfa1);if(_0x3a5c77[_0xb72d('0x2e')][_0xb72d('0x38')]){_0x5bf74a[_0xb72d('0x39')]=_[_0xb72d('0x3a')](_0x5bf74a[_0xb72d('0x39')],{'$or':_[_0xb72d('0x27')](_0x5bbfa1,function(_0x19d7e0){if(_0x19d7e0[_0xb72d('0x2b')]!==_0xb72d('0x3b')){var _0x150e3c={};_0x150e3c[_0x19d7e0[_0xb72d('0x3c')]]={'$like':'%'+_0x3a5c77[_0xb72d('0x2e')][_0xb72d('0x38')]+'%'};return _0x150e3c;}})});}_0x5bf74a=_[_0xb72d('0x3a')]({},_0x5bf74a,_0x3a5c77['options']);var _0x3bca16={'where':_0x5bf74a['where']};return db[_0xb72d('0x28')][_0xb72d('0x1b')](_0x3bca16)[_0xb72d('0x20')](function(_0x5e8958){_0x274ad0[_0xb72d('0x1b')]=_0x5e8958;if(_0x3a5c77['query'][_0xb72d('0x3d')]){_0x5bf74a[_0xb72d('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb72d('0x3f')](_0x5bf74a);})[_0xb72d('0x20')](function(_0x3ed331){_0x274ad0[_0xb72d('0x40')]=_0x3ed331;return _0x274ad0;})[_0xb72d('0x20')](respondWithFilteredResult(_0x26558b,_0x5bf74a))[_0xb72d('0x41')](handleError(_0x26558b,null));};exports[_0xb72d('0x42')]=function(_0x3076d5,_0x286c70){var _0x365f87={'raw':!![],'where':{'id':_0x3076d5[_0xb72d('0x43')]['id']}},_0x1b7977={};_0x1b7977['model']=_['keys'](db[_0xb72d('0x28')][_0xb72d('0x29')]);_0x1b7977['query']=_['keys'](_0x3076d5[_0xb72d('0x2e')]);_0x1b7977[_0xb72d('0x2f')]=_[_0xb72d('0x30')](_0x1b7977[_0xb72d('0x2d')],_0x1b7977[_0xb72d('0x2e')]);_0x365f87['attributes']=_[_0xb72d('0x30')](_0x1b7977[_0xb72d('0x2d')],qs[_0xb72d('0x31')](_0x3076d5[_0xb72d('0x2e')]['fields']));_0x365f87[_0xb72d('0x32')]=_0x365f87[_0xb72d('0x32')][_0xb72d('0x33')]?_0x365f87[_0xb72d('0x32')]:_0x1b7977['model'];if(_0x3076d5[_0xb72d('0x2e')]['includeAll']){_0x365f87[_0xb72d('0x3e')]=[{'all':!![]}];}_0x365f87=_[_0xb72d('0x3a')]({},_0x365f87,_0x3076d5[_0xb72d('0x44')]);return db[_0xb72d('0x28')][_0xb72d('0x45')](_0x365f87)[_0xb72d('0x20')](handleEntityNotFound(_0x286c70,null))[_0xb72d('0x20')](respondWithResult(_0x286c70,null))[_0xb72d('0x41')](handleError(_0x286c70,null));};exports[_0xb72d('0x46')]=function(_0x43671f,_0x3b703a){return db[_0xb72d('0x28')][_0xb72d('0x46')](_0x43671f[_0xb72d('0x47')],{})['then'](respondWithResult(_0x3b703a,0xc9))['catch'](handleError(_0x3b703a,null));};exports[_0xb72d('0x48')]=function(_0x4a4c6b,_0x410468){if(_0x4a4c6b[_0xb72d('0x47')]['id']){delete _0x4a4c6b[_0xb72d('0x47')]['id'];}return db['SmsQueueReport'][_0xb72d('0x45')]({'where':{'id':_0x4a4c6b[_0xb72d('0x43')]['id']}})[_0xb72d('0x20')](handleEntityNotFound(_0x410468,null))[_0xb72d('0x20')](saveUpdates(_0x4a4c6b['body'],null))['then'](respondWithResult(_0x410468,null))[_0xb72d('0x41')](handleError(_0x410468,null));};exports[_0xb72d('0x21')]=function(_0x4af1c5,_0x510785){return db[_0xb72d('0x28')]['find']({'where':{'id':_0x4af1c5[_0xb72d('0x43')]['id']}})[_0xb72d('0x20')](handleEntityNotFound(_0x510785,null))['then'](removeEntity(_0x510785,null))['catch'](handleError(_0x510785,null));};exports[_0xb72d('0x49')]=function(_0x48f142,_0x5ae906){return db['SmsQueueReport'][_0xb72d('0x49')]()[_0xb72d('0x20')](respondWithResult(_0x5ae906,null))[_0xb72d('0x41')](handleError(_0x5ae906,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b05d41a..dbfeec1 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x58fe63,_0xf6ae1a){var _0x8264c9=function(_0x3d07ef){while(--_0x3d07ef){_0x58fe63['push'](_0x58fe63['shift']());}};_0x8264c9(++_0xf6ae1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xcb91[_0x5302fb];return _0x43e6a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ac61a,_0x5e7e88){var _0x5e703e=function(_0x184e6d){while(--_0x184e6d){_0x4ac61a['push'](_0x4ac61a['shift']());}};_0x5e703e(++_0x5e7e88);}(_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 e059b75..e830bf5 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 _0xaee1=['stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','where','UpdateSmsQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13015c,_0x4ebb51){var _0x30a9ac=function(_0x184a17){while(--_0x184a17){_0x13015c['push'](_0x13015c['shift']());}};_0x30a9ac(++_0x4ebb51);}(_0xaee1,0x144));var _0x1aee=function(_0x4613b0,_0x278b0a){_0x4613b0=_0x4613b0-0x0;var _0x4b811b=_0xaee1[_0x4613b0];return _0x4b811b;};'use strict';var _=require(_0x1aee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1aee('0x1'));var rs=require(_0x1aee('0x2'));var fs=require('fs');var Redis=require(_0x1aee('0x3'));var db=require(_0x1aee('0x4'))['db'];var utils=require(_0x1aee('0x5'));var logger=require(_0x1aee('0x6'))('rpc');var config=require(_0x1aee('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1aee('0x8')][_0x1aee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14a985,_0x1b458f,_0x53a63){return new BPromise(function(_0xa3e0c,_0x1ac942){return client[_0x1aee('0xa')](_0x14a985,_0x53a63)[_0x1aee('0xb')](function(_0x1ad328){logger[_0x1aee('0xc')](_0x1aee('0xd'),_0x1b458f,'request\x20sent');logger[_0x1aee('0xe')](_0x1aee('0xf'),_0x1b458f,_0x1aee('0x10'),JSON[_0x1aee('0x11')](_0x1ad328));if(_0x1ad328['error']){if(_0x1ad328[_0x1aee('0x12')][_0x1aee('0x13')]===0x1f4){logger[_0x1aee('0x12')](_0x1aee('0xd'),_0x1b458f,_0x1ad328[_0x1aee('0x12')][_0x1aee('0x14')]);return _0x1ac942(_0x1ad328['error']['message']);}logger[_0x1aee('0x12')](_0x1aee('0xd'),_0x1b458f,_0x1ad328['error']['message']);return _0xa3e0c(_0x1ad328[_0x1aee('0x12')]['message']);}else{logger[_0x1aee('0xc')](_0x1aee('0xd'),_0x1b458f,_0x1aee('0x10'));_0xa3e0c(_0x1ad328[_0x1aee('0x15')][_0x1aee('0x14')]);}})[_0x1aee('0x16')](function(_0x64f74b){logger[_0x1aee('0x12')](_0x1aee('0xd'),_0x1b458f,_0x64f74b);_0x1ac942(_0x64f74b);});});}exports[_0x1aee('0x17')]=function(_0x6867c4){var _0x298640=this;return new Promise(function(_0x429e6b,_0x3e94d7){return db[_0x1aee('0x18')][_0x1aee('0x19')](_0x6867c4[_0x1aee('0x1a')],{'raw':_0x6867c4[_0x1aee('0x1b')]?_0x6867c4['options']['raw']===undefined?!![]:![]:!![]})[_0x1aee('0xb')](function(_0x245fa0){logger[_0x1aee('0xc')](_0x1aee('0x17'),_0x6867c4);logger[_0x1aee('0xe')]('CreateSmsQueueReport',_0x6867c4,JSON[_0x1aee('0x11')](_0x245fa0));_0x429e6b(_0x245fa0);})[_0x1aee('0x16')](function(_0x2e5d5c){logger[_0x1aee('0x12')](_0x1aee('0x17'),_0x2e5d5c[_0x1aee('0x14')],_0x6867c4);_0x3e94d7(_0x298640['error'](0x1f4,_0x2e5d5c[_0x1aee('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x5c0a26){var _0x1059c6=this;return new Promise(function(_0x347b27,_0x6667b){return db[_0x1aee('0x18')][_0x1aee('0x1c')](_0x5c0a26['body'],{'raw':_0x5c0a26[_0x1aee('0x1b')]?_0x5c0a26[_0x1aee('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0a26[_0x1aee('0x1b')]?_0x5c0a26['options'][_0x1aee('0x1d')]||null:null,'attributes':_0x5c0a26[_0x1aee('0x1b')]?_0x5c0a26[_0x1aee('0x1b')]['attributes']||null:null,'limit':_0x5c0a26['options']?_0x5c0a26[_0x1aee('0x1b')]['limit']||null:null})['then'](function(_0x2c6fa5){logger[_0x1aee('0xc')]('UpdateSmsQueueReport',_0x5c0a26);logger['debug'](_0x1aee('0x1e'),_0x5c0a26,JSON[_0x1aee('0x11')](_0x2c6fa5));_0x347b27(_0x2c6fa5);})[_0x1aee('0x16')](function(_0x80ac62){logger[_0x1aee('0x12')](_0x1aee('0x1e'),_0x80ac62[_0x1aee('0x14')],_0x5c0a26);_0x6667b(_0x1059c6[_0x1aee('0x12')](0x1f4,_0x80ac62[_0x1aee('0x14')]));});});}; \ No newline at end of file +var _0xd6b2=['raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueueReport','create','body','options'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xd6b2,0x116));var _0x2d6b=function(_0x5a2d18,_0x5b72c9){_0x5a2d18=_0x5a2d18-0x0;var _0x5e057f=_0xd6b2[_0x5a2d18];return _0x5e057f;};'use strict';var _=require(_0x2d6b('0x0'));var util=require(_0x2d6b('0x1'));var moment=require(_0x2d6b('0x2'));var BPromise=require(_0x2d6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d6b('0x4'));var db=require(_0x2d6b('0x5'))['db'];var utils=require(_0x2d6b('0x6'));var logger=require(_0x2d6b('0x7'))(_0x2d6b('0x8'));var config=require(_0x2d6b('0x9'));var jayson=require(_0x2d6b('0xa'));var client=jayson['client'][_0x2d6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4363ed,_0x59a953,_0x51d3fa){return new BPromise(function(_0x4cb1e6,_0x49eba1){return client[_0x2d6b('0xc')](_0x4363ed,_0x51d3fa)[_0x2d6b('0xd')](function(_0x17bbca){logger[_0x2d6b('0xe')](_0x2d6b('0xf'),_0x59a953,_0x2d6b('0x10'));logger[_0x2d6b('0x11')](_0x2d6b('0x12'),_0x59a953,'request\x20sent',JSON[_0x2d6b('0x13')](_0x17bbca));if(_0x17bbca['error']){if(_0x17bbca[_0x2d6b('0x14')]['code']===0x1f4){logger[_0x2d6b('0x14')](_0x2d6b('0xf'),_0x59a953,_0x17bbca[_0x2d6b('0x14')]['message']);return _0x49eba1(_0x17bbca[_0x2d6b('0x14')]['message']);}logger[_0x2d6b('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x59a953,_0x17bbca[_0x2d6b('0x14')][_0x2d6b('0x15')]);return _0x4cb1e6(_0x17bbca[_0x2d6b('0x14')][_0x2d6b('0x15')]);}else{logger['info'](_0x2d6b('0xf'),_0x59a953,'request\x20sent');_0x4cb1e6(_0x17bbca[_0x2d6b('0x16')][_0x2d6b('0x15')]);}})[_0x2d6b('0x17')](function(_0x208c1c){logger[_0x2d6b('0x14')](_0x2d6b('0xf'),_0x59a953,_0x208c1c);_0x49eba1(_0x208c1c);});});}exports['CreateSmsQueueReport']=function(_0x1ad97d){var _0x436bf7=this;return new Promise(function(_0x2ff8ad,_0x3f4155){return db[_0x2d6b('0x18')][_0x2d6b('0x19')](_0x1ad97d[_0x2d6b('0x1a')],{'raw':_0x1ad97d['options']?_0x1ad97d[_0x2d6b('0x1b')][_0x2d6b('0x1c')]===undefined?!![]:![]:!![]})[_0x2d6b('0xd')](function(_0x3f947c){logger['info'](_0x2d6b('0x1d'),_0x1ad97d);logger['debug']('CreateSmsQueueReport',_0x1ad97d,JSON[_0x2d6b('0x13')](_0x3f947c));_0x2ff8ad(_0x3f947c);})['catch'](function(_0x254cb8){logger[_0x2d6b('0x14')]('CreateSmsQueueReport',_0x254cb8[_0x2d6b('0x15')],_0x1ad97d);_0x3f4155(_0x436bf7['error'](0x1f4,_0x254cb8['message']));});});};exports[_0x2d6b('0x1e')]=function(_0x18b5bc){var _0x47a5e1=this;return new Promise(function(_0x3aa54d,_0x212c55){return db[_0x2d6b('0x18')][_0x2d6b('0x1f')](_0x18b5bc[_0x2d6b('0x1a')],{'raw':_0x18b5bc['options']?_0x18b5bc[_0x2d6b('0x1b')][_0x2d6b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b5bc['options']?_0x18b5bc[_0x2d6b('0x1b')][_0x2d6b('0x20')]||null:null,'attributes':_0x18b5bc['options']?_0x18b5bc[_0x2d6b('0x1b')]['attributes']||null:null,'limit':_0x18b5bc[_0x2d6b('0x1b')]?_0x18b5bc[_0x2d6b('0x1b')][_0x2d6b('0x21')]||null:null})[_0x2d6b('0xd')](function(_0x241f63){logger['info'](_0x2d6b('0x1e'),_0x18b5bc);logger[_0x2d6b('0x11')]('UpdateSmsQueueReport',_0x18b5bc,JSON[_0x2d6b('0x13')](_0x241f63));_0x3aa54d(_0x241f63);})[_0x2d6b('0x17')](function(_0x57447d){logger[_0x2d6b('0x14')](_0x2d6b('0x1e'),_0x57447d['message'],_0x18b5bc);_0x212c55(_0x47a5e1[_0x2d6b('0x14')](0x1f4,_0x57447d[_0x2d6b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 360b0eb..2515373 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 _0x207c=['/:id','show','post','isAuthenticated','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','describe'];(function(_0x39acf8,_0x158e5a){var _0x378ac3=function(_0x2f00e0){while(--_0x2f00e0){_0x39acf8['push'](_0x39acf8['shift']());}};_0x378ac3(++_0x158e5a);}(_0x207c,0x1e8));var _0xc207=function(_0x4ed7,_0x14f3ba){_0x4ed7=_0x4ed7-0x0;var _0x584b32=_0x207c[_0x4ed7];return _0x584b32;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0xe')]('/',auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x11')](_0xc207('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0x12')]);module[_0xc207('0x13')]=router; \ No newline at end of file +var _0xe198=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe198,0x6f));var _0x8e19=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe198[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e19('0x2'));var router=express[_0x8e19('0x3')]();var fs_extra=require(_0x8e19('0x4'));var auth=require(_0x8e19('0x5'));var interaction=require(_0x8e19('0x6'));var config=require('../../config/environment');var controller=require(_0x8e19('0x7'));router[_0x8e19('0x8')]('/',auth[_0x8e19('0x9')](),controller[_0x8e19('0xa')]);router[_0x8e19('0x8')](_0x8e19('0xb'),auth[_0x8e19('0x9')](),controller[_0x8e19('0xc')]);router[_0x8e19('0x8')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller[_0x8e19('0xe')]);router[_0x8e19('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e19('0x10')]);router[_0x8e19('0x11')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller[_0x8e19('0x12')]);router[_0x8e19('0x13')](_0x8e19('0xd'),auth[_0x8e19('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 49356db..3eba117 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x10dcb8,_0x49ea5d){var _0x3b910b=function(_0x54789f){while(--_0x54789f){_0x10dcb8['push'](_0x10dcb8['shift']());}};_0x3b910b(++_0x49ea5d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x101ba2,_0x4091d5){_0x101ba2=_0x101ba2-0x0;var _0x4aa9c0=_0xf4eb[_0x101ba2];return _0x4aa9c0;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4177b8,_0xc83423){_0x4177b8=_0x4177b8-0x0;var _0x2fbf2e=_0x9bde[_0x4177b8];return _0x2fbf2e;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 82694f0..0c19441 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 _0xffb9=['sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','SmsTransferReport','findAll','catch','show','params','length','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','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','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x36c4a6,_0x150f42){var _0x45626f=function(_0x36edda){while(--_0x36edda){_0x36c4a6['push'](_0x36c4a6['shift']());}};_0x45626f(++_0x150f42);}(_0xffb9,0x113));var _0x9ffb=function(_0x183ebe,_0x23e777){_0x183ebe=_0x183ebe-0x0;var _0x37f310=_0xffb9[_0x183ebe];return _0x37f310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ffb('0x0'));var zipdir=require(_0x9ffb('0x1'));var jsonpatch=require(_0x9ffb('0x2'));var rp=require('request-promise');var moment=require(_0x9ffb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9ffb('0x4'));var util=require('util');var path=require(_0x9ffb('0x5'));var sox=require(_0x9ffb('0x6'));var csv=require(_0x9ffb('0x7'));var ejs=require(_0x9ffb('0x8'));var fs=require('fs');var fs_extra=require(_0x9ffb('0x9'));var _=require(_0x9ffb('0xa'));var squel=require(_0x9ffb('0xb'));var crypto=require(_0x9ffb('0xc'));var jsforce=require(_0x9ffb('0xd'));var deskjs=require(_0x9ffb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ffb('0xf'));var Papa=require(_0x9ffb('0x10'));var Redis=require(_0x9ffb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ffb('0x12'));var as=require(_0x9ffb('0x13'));var hardwareService=require(_0x9ffb('0x14'));var logger=require(_0x9ffb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9ffb('0x16'));var licenseUtil=require(_0x9ffb('0x17'));var db=require(_0x9ffb('0x18'))['db'];function respondWithStatusCode(_0x1b4ff3,_0x567a37){_0x567a37=_0x567a37||0xcc;return function(_0x5eed9e){if(_0x5eed9e){return _0x1b4ff3[_0x9ffb('0x19')](_0x567a37);}return _0x1b4ff3[_0x9ffb('0x1a')](_0x567a37)[_0x9ffb('0x1b')]();};}function respondWithResult(_0x50533c,_0x2f3e5a){_0x2f3e5a=_0x2f3e5a||0xc8;return function(_0x187a07){if(_0x187a07){return _0x50533c['status'](_0x2f3e5a)[_0x9ffb('0x1c')](_0x187a07);}};}function respondWithFilteredResult(_0x17200e,_0x3e51ec){return function(_0x49717c){if(_0x49717c){var _0x2e0527=typeof _0x3e51ec[_0x9ffb('0x1d')]==='undefined'&&typeof _0x3e51ec[_0x9ffb('0x1e')]===_0x9ffb('0x1f');var _0x24d593=_0x49717c['count'];var _0x826979=_0x2e0527?0x0:_0x3e51ec[_0x9ffb('0x1d')];var _0x54a851=_0x2e0527?_0x49717c[_0x9ffb('0x20')]:_0x3e51ec[_0x9ffb('0x1d')]+_0x3e51ec['limit'];var _0x279ba1;if(_0x54a851>=_0x24d593){_0x54a851=_0x24d593;_0x279ba1=0xc8;}else{_0x279ba1=0xce;}_0x17200e['status'](_0x279ba1);return _0x17200e[_0x9ffb('0x21')](_0x9ffb('0x22'),_0x826979+'-'+_0x54a851+'/'+_0x24d593)[_0x9ffb('0x1c')](_0x49717c);}return null;};}function patchUpdates(_0x185b17){return function(_0x2ed7b7){try{jsonpatch[_0x9ffb('0x23')](_0x2ed7b7,_0x185b17,!![]);}catch(_0x1ad9a1){return BPromise[_0x9ffb('0x24')](_0x1ad9a1);}return _0x2ed7b7[_0x9ffb('0x25')]();};}function saveUpdates(_0x473b12,_0x285682){return function(_0x5da63e){if(_0x5da63e){return _0x5da63e['update'](_0x473b12)[_0x9ffb('0x26')](function(_0x43f091){return _0x43f091;});}return null;};}function removeEntity(_0x320f8b,_0x5d255f){return function(_0x3a8c69){if(_0x3a8c69){return _0x3a8c69[_0x9ffb('0x27')]()[_0x9ffb('0x26')](function(){_0x320f8b['status'](0xcc)[_0x9ffb('0x1b')]();});}};}function handleEntityNotFound(_0x5d96fb,_0x52d844){return function(_0x286e44){if(!_0x286e44){_0x5d96fb['sendStatus'](0x194);}return _0x286e44;};}function handleError(_0x4f654f,_0x4c82ff){_0x4c82ff=_0x4c82ff||0x1f4;return function(_0x574d14){logger[_0x9ffb('0x28')](_0x574d14[_0x9ffb('0x29')]);if(_0x574d14[_0x9ffb('0x2a')]){delete _0x574d14[_0x9ffb('0x2a')];}_0x4f654f[_0x9ffb('0x1a')](_0x4c82ff)['send'](_0x574d14);};}exports[_0x9ffb('0x2b')]=function(_0x2da6b8,_0x31056c){var _0x54a892={},_0x5c094f={},_0x2dd799={'count':0x0,'rows':[]};var _0xa3f617=_[_0x9ffb('0x2c')](db['SmsTransferReport'][_0x9ffb('0x2d')],function(_0x143b94){return{'name':_0x143b94['fieldName'],'type':_0x143b94[_0x9ffb('0x2e')][_0x9ffb('0x2f')]};});_0x5c094f[_0x9ffb('0x30')]=_['map'](_0xa3f617,_0x9ffb('0x2a'));_0x5c094f[_0x9ffb('0x31')]=_[_0x9ffb('0x32')](_0x2da6b8[_0x9ffb('0x31')]);_0x5c094f['filters']=_['intersection'](_0x5c094f['model'],_0x5c094f[_0x9ffb('0x31')]);_0x54a892[_0x9ffb('0x33')]=_[_0x9ffb('0x34')](_0x5c094f[_0x9ffb('0x30')],qs[_0x9ffb('0x35')](_0x2da6b8['query'][_0x9ffb('0x35')]));_0x54a892[_0x9ffb('0x33')]=_0x54a892[_0x9ffb('0x33')]['length']?_0x54a892['attributes']:_0x5c094f[_0x9ffb('0x30')];if(!_0x2da6b8[_0x9ffb('0x31')][_0x9ffb('0x36')](_0x9ffb('0x37'))){_0x54a892[_0x9ffb('0x1e')]=qs[_0x9ffb('0x1e')](_0x2da6b8[_0x9ffb('0x31')]['limit']);_0x54a892[_0x9ffb('0x1d')]=qs[_0x9ffb('0x1d')](_0x2da6b8[_0x9ffb('0x31')]['offset']);}_0x54a892[_0x9ffb('0x38')]=qs[_0x9ffb('0x39')](_0x2da6b8[_0x9ffb('0x31')][_0x9ffb('0x39')]);_0x54a892[_0x9ffb('0x3a')]=qs[_0x9ffb('0x3b')](_[_0x9ffb('0x3c')](_0x2da6b8[_0x9ffb('0x31')],_0x5c094f[_0x9ffb('0x3b')]),_0xa3f617);if(_0x2da6b8['query']['filter']){_0x54a892[_0x9ffb('0x3a')]=_[_0x9ffb('0x3d')](_0x54a892[_0x9ffb('0x3a')],{'$or':_[_0x9ffb('0x2c')](_0xa3f617,function(_0x21026d){if(_0x21026d[_0x9ffb('0x2e')]!=='VIRTUAL'){var _0x240cb9={};_0x240cb9[_0x21026d[_0x9ffb('0x2a')]]={'$like':'%'+_0x2da6b8['query'][_0x9ffb('0x3e')]+'%'};return _0x240cb9;}})});}_0x54a892=_[_0x9ffb('0x3d')]({},_0x54a892,_0x2da6b8['options']);var _0x2fe068={'where':_0x54a892[_0x9ffb('0x3a')]};return db['SmsTransferReport']['count'](_0x2fe068)[_0x9ffb('0x26')](function(_0x48d604){_0x2dd799[_0x9ffb('0x20')]=_0x48d604;if(_0x2da6b8[_0x9ffb('0x31')][_0x9ffb('0x3f')]){_0x54a892[_0x9ffb('0x40')]=[{'all':!![]}];}return db[_0x9ffb('0x41')][_0x9ffb('0x42')](_0x54a892);})['then'](function(_0x3db0b3){_0x2dd799['rows']=_0x3db0b3;return _0x2dd799;})['then'](respondWithFilteredResult(_0x31056c,_0x54a892))[_0x9ffb('0x43')](handleError(_0x31056c,null));};exports[_0x9ffb('0x44')]=function(_0x2487da,_0x22eca5){var _0x136170={'raw':!![],'where':{'id':_0x2487da[_0x9ffb('0x45')]['id']}},_0x41d5d8={};_0x41d5d8[_0x9ffb('0x30')]=_[_0x9ffb('0x32')](db[_0x9ffb('0x41')][_0x9ffb('0x2d')]);_0x41d5d8['query']=_[_0x9ffb('0x32')](_0x2487da['query']);_0x41d5d8[_0x9ffb('0x3b')]=_['intersection'](_0x41d5d8[_0x9ffb('0x30')],_0x41d5d8[_0x9ffb('0x31')]);_0x136170[_0x9ffb('0x33')]=_['intersection'](_0x41d5d8[_0x9ffb('0x30')],qs[_0x9ffb('0x35')](_0x2487da[_0x9ffb('0x31')][_0x9ffb('0x35')]));_0x136170[_0x9ffb('0x33')]=_0x136170['attributes'][_0x9ffb('0x46')]?_0x136170[_0x9ffb('0x33')]:_0x41d5d8[_0x9ffb('0x30')];if(_0x2487da[_0x9ffb('0x31')][_0x9ffb('0x3f')]){_0x136170[_0x9ffb('0x40')]=[{'all':!![]}];}_0x136170=_[_0x9ffb('0x3d')]({},_0x136170,_0x2487da[_0x9ffb('0x47')]);return db[_0x9ffb('0x41')][_0x9ffb('0x48')](_0x136170)[_0x9ffb('0x26')](handleEntityNotFound(_0x22eca5,null))['then'](respondWithResult(_0x22eca5,null))[_0x9ffb('0x43')](handleError(_0x22eca5,null));};exports[_0x9ffb('0x49')]=function(_0x24f7fd,_0x4d203e){return db['SmsTransferReport'][_0x9ffb('0x49')](_0x24f7fd[_0x9ffb('0x4a')],{})[_0x9ffb('0x26')](respondWithResult(_0x4d203e,0xc9))[_0x9ffb('0x43')](handleError(_0x4d203e,null));};exports['update']=function(_0x231ac2,_0xacba72){if(_0x231ac2[_0x9ffb('0x4a')]['id']){delete _0x231ac2[_0x9ffb('0x4a')]['id'];}return db[_0x9ffb('0x41')][_0x9ffb('0x48')]({'where':{'id':_0x231ac2[_0x9ffb('0x45')]['id']}})['then'](handleEntityNotFound(_0xacba72,null))[_0x9ffb('0x26')](saveUpdates(_0x231ac2[_0x9ffb('0x4a')],null))[_0x9ffb('0x26')](respondWithResult(_0xacba72,null))[_0x9ffb('0x43')](handleError(_0xacba72,null));};exports[_0x9ffb('0x27')]=function(_0x52afdb,_0x47b409){return db[_0x9ffb('0x41')][_0x9ffb('0x48')]({'where':{'id':_0x52afdb[_0x9ffb('0x45')]['id']}})[_0x9ffb('0x26')](handleEntityNotFound(_0x47b409,null))[_0x9ffb('0x26')](removeEntity(_0x47b409,null))['catch'](handleError(_0x47b409,null));};exports['describe']=function(_0x1677c2,_0x50ff7b){return db['SmsTransferReport']['describe']()[_0x9ffb('0x26')](respondWithResult(_0x50ff7b,null))[_0x9ffb('0x43')](handleError(_0x50ff7b,null));}; \ No newline at end of file +var _0xecba=['destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','sendStatus','stack','name','index','SmsTransferReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','find','catch','create','body','params'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xecba,0x94));var _0xaecb=function(_0x2ff505,_0x451e0f){_0x2ff505=_0x2ff505-0x0;var _0x2013ac=_0xecba[_0x2ff505];return _0x2013ac;};'use strict';var emlformat=require(_0xaecb('0x0'));var rimraf=require(_0xaecb('0x1'));var zipdir=require(_0xaecb('0x2'));var jsonpatch=require(_0xaecb('0x3'));var rp=require('request-promise');var moment=require(_0xaecb('0x4'));var BPromise=require(_0xaecb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xaecb('0x6'));var csv=require('to-csv');var ejs=require(_0xaecb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaecb('0x8'));var squel=require(_0xaecb('0x9'));var crypto=require(_0xaecb('0xa'));var jsforce=require(_0xaecb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaecb('0xc'));var querystring=require(_0xaecb('0xd'));var Papa=require('papaparse');var Redis=require(_0xaecb('0xe'));var authService=require(_0xaecb('0xf'));var qs=require(_0xaecb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaecb('0x11'));var logger=require(_0xaecb('0x12'))(_0xaecb('0x13'));var utils=require(_0xaecb('0x14'));var config=require(_0xaecb('0x15'));var licenseUtil=require(_0xaecb('0x16'));var db=require(_0xaecb('0x17'))['db'];function respondWithStatusCode(_0xb17710,_0x4f4506){_0x4f4506=_0x4f4506||0xcc;return function(_0x1da7d0){if(_0x1da7d0){return _0xb17710['sendStatus'](_0x4f4506);}return _0xb17710[_0xaecb('0x18')](_0x4f4506)[_0xaecb('0x19')]();};}function respondWithResult(_0x51d7f7,_0x390463){_0x390463=_0x390463||0xc8;return function(_0x109b06){if(_0x109b06){return _0x51d7f7[_0xaecb('0x18')](_0x390463)[_0xaecb('0x1a')](_0x109b06);}};}function respondWithFilteredResult(_0x4c03ee,_0x190d8e){return function(_0x2b55ca){if(_0x2b55ca){var _0x9ff69b=typeof _0x190d8e['offset']==='undefined'&&typeof _0x190d8e[_0xaecb('0x1b')]===_0xaecb('0x1c');var _0xe91a81=_0x2b55ca[_0xaecb('0x1d')];var _0x3bcd19=_0x9ff69b?0x0:_0x190d8e['offset'];var _0x1cd008=_0x9ff69b?_0x2b55ca['count']:_0x190d8e[_0xaecb('0x1e')]+_0x190d8e[_0xaecb('0x1b')];var _0x46f535;if(_0x1cd008>=_0xe91a81){_0x1cd008=_0xe91a81;_0x46f535=0xc8;}else{_0x46f535=0xce;}_0x4c03ee['status'](_0x46f535);return _0x4c03ee[_0xaecb('0x1f')](_0xaecb('0x20'),_0x3bcd19+'-'+_0x1cd008+'/'+_0xe91a81)['json'](_0x2b55ca);}return null;};}function patchUpdates(_0x409f20){return function(_0x5ee9cb){try{jsonpatch[_0xaecb('0x21')](_0x5ee9cb,_0x409f20,!![]);}catch(_0x350d20){return BPromise['reject'](_0x350d20);}return _0x5ee9cb[_0xaecb('0x22')]();};}function saveUpdates(_0x176f59,_0x2ea3aa){return function(_0x16404b){if(_0x16404b){return _0x16404b[_0xaecb('0x23')](_0x176f59)[_0xaecb('0x24')](function(_0x5d8a50){return _0x5d8a50;});}return null;};}function removeEntity(_0x4f8e53,_0x25f510){return function(_0x103c79){if(_0x103c79){return _0x103c79['destroy']()['then'](function(){_0x4f8e53['status'](0xcc)[_0xaecb('0x19')]();});}};}function handleEntityNotFound(_0x12b102,_0x4d44b4){return function(_0x20f293){if(!_0x20f293){_0x12b102[_0xaecb('0x25')](0x194);}return _0x20f293;};}function handleError(_0x184502,_0x5e75f7){_0x5e75f7=_0x5e75f7||0x1f4;return function(_0x53a411){logger['error'](_0x53a411[_0xaecb('0x26')]);if(_0x53a411[_0xaecb('0x27')]){delete _0x53a411[_0xaecb('0x27')];}_0x184502['status'](_0x5e75f7)['send'](_0x53a411);};}exports[_0xaecb('0x28')]=function(_0x21c412,_0x15a2d0){var _0x53b465={},_0x1133cb={},_0x224e69={'count':0x0,'rows':[]};var _0x40abe3=_['map'](db[_0xaecb('0x29')][_0xaecb('0x2a')],function(_0x15bc23){return{'name':_0x15bc23[_0xaecb('0x2b')],'type':_0x15bc23['type'][_0xaecb('0x2c')]};});_0x1133cb['model']=_[_0xaecb('0x2d')](_0x40abe3,_0xaecb('0x27'));_0x1133cb['query']=_[_0xaecb('0x2e')](_0x21c412[_0xaecb('0x2f')]);_0x1133cb[_0xaecb('0x30')]=_[_0xaecb('0x31')](_0x1133cb[_0xaecb('0x32')],_0x1133cb[_0xaecb('0x2f')]);_0x53b465['attributes']=_['intersection'](_0x1133cb[_0xaecb('0x32')],qs[_0xaecb('0x33')](_0x21c412[_0xaecb('0x2f')]['fields']));_0x53b465[_0xaecb('0x34')]=_0x53b465[_0xaecb('0x34')][_0xaecb('0x35')]?_0x53b465[_0xaecb('0x34')]:_0x1133cb[_0xaecb('0x32')];if(!_0x21c412[_0xaecb('0x2f')][_0xaecb('0x36')]('nolimit')){_0x53b465[_0xaecb('0x1b')]=qs[_0xaecb('0x1b')](_0x21c412[_0xaecb('0x2f')][_0xaecb('0x1b')]);_0x53b465[_0xaecb('0x1e')]=qs[_0xaecb('0x1e')](_0x21c412[_0xaecb('0x2f')]['offset']);}_0x53b465[_0xaecb('0x37')]=qs[_0xaecb('0x38')](_0x21c412['query'][_0xaecb('0x38')]);_0x53b465[_0xaecb('0x39')]=qs[_0xaecb('0x30')](_['pick'](_0x21c412[_0xaecb('0x2f')],_0x1133cb[_0xaecb('0x30')]),_0x40abe3);if(_0x21c412[_0xaecb('0x2f')][_0xaecb('0x3a')]){_0x53b465['where']=_[_0xaecb('0x3b')](_0x53b465[_0xaecb('0x39')],{'$or':_[_0xaecb('0x2d')](_0x40abe3,function(_0x3ffb46){if(_0x3ffb46[_0xaecb('0x3c')]!=='VIRTUAL'){var _0x5d2e23={};_0x5d2e23[_0x3ffb46[_0xaecb('0x27')]]={'$like':'%'+_0x21c412[_0xaecb('0x2f')][_0xaecb('0x3a')]+'%'};return _0x5d2e23;}})});}_0x53b465=_[_0xaecb('0x3b')]({},_0x53b465,_0x21c412[_0xaecb('0x3d')]);var _0x1656cc={'where':_0x53b465['where']};return db[_0xaecb('0x29')][_0xaecb('0x1d')](_0x1656cc)[_0xaecb('0x24')](function(_0x57671d){_0x224e69['count']=_0x57671d;if(_0x21c412[_0xaecb('0x2f')][_0xaecb('0x3e')]){_0x53b465[_0xaecb('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xaecb('0x40')](_0x53b465);})['then'](function(_0x159d12){_0x224e69[_0xaecb('0x41')]=_0x159d12;return _0x224e69;})['then'](respondWithFilteredResult(_0x15a2d0,_0x53b465))['catch'](handleError(_0x15a2d0,null));};exports['show']=function(_0x24650c,_0x1ef012){var _0x477fb6={'raw':!![],'where':{'id':_0x24650c['params']['id']}},_0x37d564={};_0x37d564[_0xaecb('0x32')]=_[_0xaecb('0x2e')](db['SmsTransferReport'][_0xaecb('0x2a')]);_0x37d564[_0xaecb('0x2f')]=_[_0xaecb('0x2e')](_0x24650c[_0xaecb('0x2f')]);_0x37d564[_0xaecb('0x30')]=_[_0xaecb('0x31')](_0x37d564[_0xaecb('0x32')],_0x37d564[_0xaecb('0x2f')]);_0x477fb6[_0xaecb('0x34')]=_[_0xaecb('0x31')](_0x37d564[_0xaecb('0x32')],qs['fields'](_0x24650c[_0xaecb('0x2f')]['fields']));_0x477fb6['attributes']=_0x477fb6['attributes'][_0xaecb('0x35')]?_0x477fb6[_0xaecb('0x34')]:_0x37d564[_0xaecb('0x32')];if(_0x24650c['query']['includeAll']){_0x477fb6[_0xaecb('0x3f')]=[{'all':!![]}];}_0x477fb6=_[_0xaecb('0x3b')]({},_0x477fb6,_0x24650c[_0xaecb('0x3d')]);return db[_0xaecb('0x29')][_0xaecb('0x42')](_0x477fb6)[_0xaecb('0x24')](handleEntityNotFound(_0x1ef012,null))[_0xaecb('0x24')](respondWithResult(_0x1ef012,null))[_0xaecb('0x43')](handleError(_0x1ef012,null));};exports[_0xaecb('0x44')]=function(_0x19642c,_0x1cf426){return db['SmsTransferReport'][_0xaecb('0x44')](_0x19642c[_0xaecb('0x45')],{})[_0xaecb('0x24')](respondWithResult(_0x1cf426,0xc9))[_0xaecb('0x43')](handleError(_0x1cf426,null));};exports[_0xaecb('0x23')]=function(_0x39d6ad,_0x5141f3){if(_0x39d6ad[_0xaecb('0x45')]['id']){delete _0x39d6ad[_0xaecb('0x45')]['id'];}return db[_0xaecb('0x29')][_0xaecb('0x42')]({'where':{'id':_0x39d6ad[_0xaecb('0x46')]['id']}})[_0xaecb('0x24')](handleEntityNotFound(_0x5141f3,null))[_0xaecb('0x24')](saveUpdates(_0x39d6ad[_0xaecb('0x45')],null))['then'](respondWithResult(_0x5141f3,null))[_0xaecb('0x43')](handleError(_0x5141f3,null));};exports[_0xaecb('0x47')]=function(_0x352868,_0x576ffc){return db[_0xaecb('0x29')][_0xaecb('0x42')]({'where':{'id':_0x352868[_0xaecb('0x46')]['id']}})['then'](handleEntityNotFound(_0x576ffc,null))[_0xaecb('0x24')](removeEntity(_0x576ffc,null))[_0xaecb('0x43')](handleError(_0x576ffc,null));};exports['describe']=function(_0x40e829,_0x4bdb0f){return db['SmsTransferReport'][_0xaecb('0x48')]()['then'](respondWithResult(_0x4bdb0f,null))[_0xaecb('0x43')](handleError(_0x4bdb0f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5b48ea2..6939ae6 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 _0x89b2=['./smsTransferReport.attributes','exports','report_sms_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23adf6,_0x29e9dc){var _0x5db754=function(_0x5b24bc){while(--_0x5b24bc){_0x23adf6['push'](_0x23adf6['shift']());}};_0x5db754(++_0x29e9dc);}(_0x89b2,0xc6));var _0x289b=function(_0x3a121b,_0x16de2b){_0x3a121b=_0x3a121b-0x0;var _0x16958e=_0x89b2[_0x3a121b];return _0x16958e;};'use strict';var _=require(_0x289b('0x0'));var util=require(_0x289b('0x1'));var logger=require(_0x289b('0x2'))(_0x289b('0x3'));var moment=require(_0x289b('0x4'));var BPromise=require(_0x289b('0x5'));var rp=require(_0x289b('0x6'));var fs=require('fs');var path=require(_0x289b('0x7'));var rimraf=require(_0x289b('0x8'));var config=require(_0x289b('0x9'));var attributes=require(_0x289b('0xa'));module[_0x289b('0xb')]=function(_0x5a6cc7,_0x1f7062){return _0x5a6cc7['define']('SmsTransferReport',attributes,{'tableName':_0x289b('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa952=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x21dea0,_0xa7bb96){var _0x40b721=function(_0x23e59a){while(--_0x23e59a){_0x21dea0['push'](_0x21dea0['shift']());}};_0x40b721(++_0xa7bb96);}(_0xa952,0x1b2));var _0x2a95=function(_0x31bd16,_0x494d75){_0x31bd16=_0x31bd16-0x0;var _0xe24a51=_0xa952[_0x31bd16];return _0xe24a51;};'use strict';var _=require(_0x2a95('0x0'));var util=require(_0x2a95('0x1'));var logger=require(_0x2a95('0x2'))(_0x2a95('0x3'));var moment=require(_0x2a95('0x4'));var BPromise=require(_0x2a95('0x5'));var rp=require(_0x2a95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a95('0x7'));var config=require(_0x2a95('0x8'));var attributes=require(_0x2a95('0x9'));module[_0x2a95('0xa')]=function(_0x53c54f,_0x153806){return _0x53c54f[_0x2a95('0xb')](_0x2a95('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x2a95('0xd'),'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 dffd2ec..3c6e786 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 _0x43fd=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x43fd,0x1ec));var _0xd43f=function(_0x12216a,_0x2f4a8c){_0x12216a=_0x12216a-0x0;var _0x507751=_0x43fd[_0x12216a];return _0x507751;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file +var _0x394e=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ac8c2,_0x2e68a2){var _0x4942b8=function(_0xad1b5b){while(--_0xad1b5b){_0x1ac8c2['push'](_0x1ac8c2['shift']());}};_0x4942b8(++_0x2e68a2);}(_0x394e,0x88));var _0xe394=function(_0x2de9c0,_0x2ae1f2){_0x2de9c0=_0x2de9c0-0x0;var _0x1c4daa=_0x394e[_0x2de9c0];return _0x1c4daa;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var moment=require('moment');var BPromise=require(_0xe394('0x2'));var rs=require(_0xe394('0x3'));var fs=require('fs');var Redis=require(_0xe394('0x4'));var db=require(_0xe394('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe394('0x6'))(_0xe394('0x7'));var config=require(_0xe394('0x8'));var jayson=require(_0xe394('0x9'));var client=jayson[_0xe394('0xa')][_0xe394('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337bff,_0x169910,_0xad826e){return new BPromise(function(_0x267d68,_0x1220a2){return client['request'](_0x337bff,_0xad826e)['then'](function(_0x5962d2){logger[_0xe394('0xc')](_0xe394('0xd'),_0x169910,_0xe394('0xe'));logger[_0xe394('0xf')](_0xe394('0x10'),_0x169910,_0xe394('0xe'),JSON[_0xe394('0x11')](_0x5962d2));if(_0x5962d2[_0xe394('0x12')]){if(_0x5962d2[_0xe394('0x12')][_0xe394('0x13')]===0x1f4){logger[_0xe394('0x12')](_0xe394('0xd'),_0x169910,_0x5962d2['error']['message']);return _0x1220a2(_0x5962d2['error'][_0xe394('0x14')]);}logger[_0xe394('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x169910,_0x5962d2[_0xe394('0x12')][_0xe394('0x14')]);return _0x267d68(_0x5962d2[_0xe394('0x12')][_0xe394('0x14')]);}else{logger[_0xe394('0xc')](_0xe394('0xd'),_0x169910,'request\x20sent');_0x267d68(_0x5962d2['result'][_0xe394('0x14')]);}})[_0xe394('0x15')](function(_0x3f11e7){logger[_0xe394('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x169910,_0x3f11e7);_0x1220a2(_0x3f11e7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index f2d8f28..993e0ae 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 _0x0402=['download','join','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x3c5aa6,_0x4c4f86){var _0x49e397=function(_0x37004d){while(--_0x37004d){_0x3c5aa6['push'](_0x3c5aa6['shift']());}};_0x49e397(++_0x4c4f86);}(_0x0402,0x1a6));var _0x2040=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x0402[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x2040('0x0'));var util=require('util');var path=require(_0x2040('0x1'));var timeout=require(_0x2040('0x2'));var express=require(_0x2040('0x3'));var router=express[_0x2040('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2040('0x5'));var config=require(_0x2040('0x6'));var controller=require(_0x2040('0x7'));router[_0x2040('0x8')]('/',auth[_0x2040('0x9')](),controller['index']);router[_0x2040('0x8')](_0x2040('0xa'),auth[_0x2040('0x9')](),controller[_0x2040('0xb')]);router[_0x2040('0x8')](_0x2040('0xc'),auth[_0x2040('0x9')](),controller[_0x2040('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1127a5,_0xebccf8,_0x489d66){_0x489d66(null,path[_0x2040('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x57fb76,_0x58b4b0,_0x575292){_0x58b4b0[_0x2040('0xf')]=_0x58b4b0[_0x2040('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x575292(null,util[_0x2040('0x10')](_0x2040('0x11'),path[_0x2040('0x12')](_0x58b4b0[_0x2040('0xf')],path[_0x2040('0x13')](_0x58b4b0[_0x2040('0xf')])),Date[_0x2040('0x14')](),path[_0x2040('0x13')](_0x58b4b0['originalname'])));}})});router[_0x2040('0x15')]('/',upload[_0x2040('0x16')](_0x2040('0x17')),controller[_0x2040('0x18')]);router[_0x2040('0x19')](_0x2040('0xa'),auth[_0x2040('0x9')](),controller[_0x2040('0x1a')]);router[_0x2040('0x1b')](_0x2040('0xa'),auth['isAuthenticated'](),controller[_0x2040('0x1b')]);module[_0x2040('0x1c')]=router; \ No newline at end of file +var _0xab0f=['replace','format','basename','now','extname','single','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','originalname'];(function(_0x114180,_0x48a3c2){var _0x932c84=function(_0x5174e2){while(--_0x5174e2){_0x114180['push'](_0x114180['shift']());}};_0x932c84(++_0x48a3c2);}(_0xab0f,0x7e));var _0xfab0=function(_0x375d33,_0x326f0b){_0x375d33=_0x375d33-0x0;var _0x3ca04a=_0xab0f[_0x375d33];return _0x3ca04a;};'use strict';var multer=require(_0xfab0('0x0'));var util=require(_0xfab0('0x1'));var path=require('path');var timeout=require(_0xfab0('0x2'));var express=require(_0xfab0('0x3'));var router=express[_0xfab0('0x4')]();var fs_extra=require(_0xfab0('0x5'));var auth=require(_0xfab0('0x6'));var interaction=require(_0xfab0('0x7'));var config=require(_0xfab0('0x8'));var controller=require('./sound.controller');router[_0xfab0('0x9')]('/',auth[_0xfab0('0xa')](),controller['index']);router['get'](_0xfab0('0xb'),auth['isAuthenticated'](),controller[_0xfab0('0xc')]);router[_0xfab0('0x9')](_0xfab0('0xd'),auth['isAuthenticated'](),controller[_0xfab0('0xe')]);var upload=multer({'storage':multer[_0xfab0('0xf')]({'destination':function(_0x347d39,_0x2e063c,_0x116a31){_0x116a31(null,path[_0xfab0('0x10')](config[_0xfab0('0x11')],'server/files/sounds/original/'));},'filename':function(_0x48c84a,_0x1624ee,_0xade9c7){_0x1624ee[_0xfab0('0x12')]=_0x1624ee[_0xfab0('0x12')][_0xfab0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xade9c7(null,util[_0xfab0('0x14')]('%s-%s%s',path[_0xfab0('0x15')](_0x1624ee[_0xfab0('0x12')],path['extname'](_0x1624ee[_0xfab0('0x12')])),Date[_0xfab0('0x16')](),path[_0xfab0('0x17')](_0x1624ee['originalname'])));}})});router['post']('/',upload[_0xfab0('0x18')]('file'),controller[_0xfab0('0x19')]);router[_0xfab0('0x1a')](_0xfab0('0xb'),auth[_0xfab0('0xa')](),controller['update']);router[_0xfab0('0x1b')]('/:id',auth[_0xfab0('0xa')](),controller[_0xfab0('0x1b')]);module[_0xfab0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index aa4c7a6..893c3f0 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 _0x82fb=['STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82fb,0x1b7));var _0xb82f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82fb[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xb82f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb82f('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xb82f('0x1')]},'display_name':{'type':Sequelize[_0xb82f('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb82f('0x1')]},'original_format':{'type':Sequelize[_0xb82f('0x1')]},'original_duration':{'type':Sequelize[_0xb82f('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xb82f('0x3')]},'original_sampleRate':{'type':Sequelize[_0xb82f('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb82f('0x3')]},'converted_channelCount':{'type':Sequelize[_0xb82f('0x4')]},'converted_bitRate':{'type':Sequelize[_0xb82f('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xb82f('0x4')]}}; \ No newline at end of file +var _0x39c6=['sequelize','STRING','FLOAT','INTEGER'];(function(_0x5be67d,_0x22bc72){var _0x455675=function(_0x159b66){while(--_0x159b66){_0x5be67d['push'](_0x5be67d['shift']());}};_0x455675(++_0x22bc72);}(_0x39c6,0x1c0));var _0x639c=function(_0x84ade9,_0x2c0fdf){_0x84ade9=_0x84ade9-0x0;var _0xdb6bc0=_0x39c6[_0x84ade9];return _0xdb6bc0;};'use strict';var Sequelize=require(_0x639c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x639c('0x1')]},'display_name':{'type':Sequelize[_0x639c('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x639c('0x1')]},'original_format':{'type':Sequelize[_0x639c('0x1')]},'original_duration':{'type':Sequelize[_0x639c('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x639c('0x3')]},'converted_format':{'type':Sequelize[_0x639c('0x1')]},'converted_duration':{'type':Sequelize[_0x639c('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x639c('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 602b3e9..7d1a9bc 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 _0xc1bb=['params','include','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sound\x20not\x20found','download','format','basename','file','originalname','extname','filename','wav','join','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_sampleRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show'];(function(_0x5b0d50,_0x14474a){var _0x239b89=function(_0x5b700e){while(--_0x5b700e){_0x5b0d50['push'](_0x5b0d50['shift']());}};_0x239b89(++_0x14474a);}(_0xc1bb,0x19b));var _0xbc1b=function(_0x4a46f4,_0x42c898){_0x4a46f4=_0x4a46f4-0x0;var _0x158273=_0xc1bb[_0x4a46f4];return _0x158273;};'use strict';var emlformat=require(_0xbc1b('0x0'));var rimraf=require(_0xbc1b('0x1'));var zipdir=require(_0xbc1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc1b('0x3'));var moment=require(_0xbc1b('0x4'));var BPromise=require(_0xbc1b('0x5'));var Mustache=require(_0xbc1b('0x6'));var util=require('util');var path=require(_0xbc1b('0x7'));var sox=require(_0xbc1b('0x8'));var csv=require(_0xbc1b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc1b('0xa'));var _=require('lodash');var squel=require(_0xbc1b('0xb'));var crypto=require(_0xbc1b('0xc'));var jsforce=require(_0xbc1b('0xd'));var deskjs=require(_0xbc1b('0xe'));var toCsv=require(_0xbc1b('0x9'));var querystring=require('querystring');var Papa=require(_0xbc1b('0xf'));var Redis=require(_0xbc1b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbc1b('0x11'));var as=require(_0xbc1b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc1b('0x13'))(_0xbc1b('0x14'));var utils=require(_0xbc1b('0x15'));var config=require(_0xbc1b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3189d8,_0x1ba594){_0x1ba594=_0x1ba594||0xcc;return function(_0x26cbc4){if(_0x26cbc4){return _0x3189d8['sendStatus'](_0x1ba594);}return _0x3189d8[_0xbc1b('0x17')](_0x1ba594)[_0xbc1b('0x18')]();};}function respondWithResult(_0x48a603,_0xa98b9d){_0xa98b9d=_0xa98b9d||0xc8;return function(_0x1073f9){if(_0x1073f9){return _0x48a603[_0xbc1b('0x17')](_0xa98b9d)['json'](_0x1073f9);}};}function respondWithFilteredResult(_0x498077,_0x9c5ea){return function(_0x1367a3){if(_0x1367a3){var _0x272c0e=typeof _0x9c5ea['offset']==='undefined'&&typeof _0x9c5ea[_0xbc1b('0x19')]===_0xbc1b('0x1a');var _0x39f1c7=_0x1367a3[_0xbc1b('0x1b')];var _0x2d18e7=_0x272c0e?0x0:_0x9c5ea[_0xbc1b('0x1c')];var _0x2e8e82=_0x272c0e?_0x1367a3[_0xbc1b('0x1b')]:_0x9c5ea[_0xbc1b('0x1c')]+_0x9c5ea['limit'];var _0x3d08ea;if(_0x2e8e82>=_0x39f1c7){_0x2e8e82=_0x39f1c7;_0x3d08ea=0xc8;}else{_0x3d08ea=0xce;}_0x498077[_0xbc1b('0x17')](_0x3d08ea);return _0x498077[_0xbc1b('0x1d')](_0xbc1b('0x1e'),_0x2d18e7+'-'+_0x2e8e82+'/'+_0x39f1c7)[_0xbc1b('0x1f')](_0x1367a3);}return null;};}function patchUpdates(_0x1b586f){return function(_0x418332){try{jsonpatch[_0xbc1b('0x20')](_0x418332,_0x1b586f,!![]);}catch(_0x4997c9){return BPromise[_0xbc1b('0x21')](_0x4997c9);}return _0x418332[_0xbc1b('0x22')]();};}function saveUpdates(_0x1ba036,_0x53937e){return function(_0x4ec140){if(_0x4ec140){return _0x4ec140[_0xbc1b('0x23')](_0x1ba036)[_0xbc1b('0x24')](function(_0x2e85e9){return _0x2e85e9;});}return null;};}function removeEntity(_0x2239e4,_0x1dceab){return function(_0x3e82b2){if(_0x3e82b2){return _0x3e82b2[_0xbc1b('0x25')]()[_0xbc1b('0x24')](function(){var _0x258206=_0x3e82b2[_0xbc1b('0x26')]({'plain':!![]});var _0x30a0e2=_0xbc1b('0x27');return db[_0xbc1b('0x28')]['destroy']({'where':{'type':_0x30a0e2,'resourceId':_0x258206['id']}})[_0xbc1b('0x24')](function(){return _0x3e82b2;});})[_0xbc1b('0x24')](function(){_0x2239e4[_0xbc1b('0x17')](0xcc)[_0xbc1b('0x18')]();});}};}function handleEntityNotFound(_0x77b7f,_0x514f93){return function(_0x44493b){if(!_0x44493b){_0x77b7f[_0xbc1b('0x29')](0x194);}return _0x44493b;};}function handleError(_0x28efcc,_0x32872e){_0x32872e=_0x32872e||0x1f4;return function(_0x58990d){logger[_0xbc1b('0x2a')](_0x58990d[_0xbc1b('0x2b')]);if(_0x58990d[_0xbc1b('0x2c')]){delete _0x58990d[_0xbc1b('0x2c')];}_0x28efcc[_0xbc1b('0x17')](_0x32872e)['send'](_0x58990d);};}exports['index']=function(_0x51179f,_0x4f4397){var _0xae056b={},_0xbe0ec={},_0xaa59ba={'count':0x0,'rows':[]};var _0x37a9f1=_['map'](db[_0xbc1b('0x2d')][_0xbc1b('0x2e')],function(_0x3c2821){return{'name':_0x3c2821[_0xbc1b('0x2f')],'type':_0x3c2821[_0xbc1b('0x30')][_0xbc1b('0x31')]};});_0xbe0ec[_0xbc1b('0x32')]=_[_0xbc1b('0x33')](_0x37a9f1,_0xbc1b('0x2c'));_0xbe0ec['query']=_[_0xbc1b('0x34')](_0x51179f[_0xbc1b('0x35')]);_0xbe0ec[_0xbc1b('0x36')]=_[_0xbc1b('0x37')](_0xbe0ec['model'],_0xbe0ec['query']);_0xae056b[_0xbc1b('0x38')]=_[_0xbc1b('0x37')](_0xbe0ec[_0xbc1b('0x32')],qs[_0xbc1b('0x39')](_0x51179f['query'][_0xbc1b('0x39')]));_0xae056b['attributes']=_0xae056b[_0xbc1b('0x38')][_0xbc1b('0x3a')]?_0xae056b[_0xbc1b('0x38')]:_0xbe0ec[_0xbc1b('0x32')];if(!_0x51179f[_0xbc1b('0x35')][_0xbc1b('0x3b')]('nolimit')){_0xae056b['limit']=qs[_0xbc1b('0x19')](_0x51179f[_0xbc1b('0x35')][_0xbc1b('0x19')]);_0xae056b[_0xbc1b('0x1c')]=qs[_0xbc1b('0x1c')](_0x51179f['query'][_0xbc1b('0x1c')]);}_0xae056b[_0xbc1b('0x3c')]=qs[_0xbc1b('0x3d')](_0x51179f['query']['sort']);_0xae056b[_0xbc1b('0x3e')]=qs[_0xbc1b('0x36')](_[_0xbc1b('0x3f')](_0x51179f[_0xbc1b('0x35')],_0xbe0ec[_0xbc1b('0x36')]),_0x37a9f1);if(_0x51179f[_0xbc1b('0x35')]['filter']){_0xae056b[_0xbc1b('0x3e')]=_[_0xbc1b('0x40')](_0xae056b[_0xbc1b('0x3e')],{'$or':_['map'](_0x37a9f1,function(_0x70151f){if(_0x70151f[_0xbc1b('0x30')]!==_0xbc1b('0x41')){var _0x3d0376={};_0x3d0376[_0x70151f[_0xbc1b('0x2c')]]={'$like':'%'+_0x51179f['query'][_0xbc1b('0x42')]+'%'};return _0x3d0376;}})});}_0xae056b=_[_0xbc1b('0x40')]({},_0xae056b,_0x51179f[_0xbc1b('0x43')]);var _0x28693e={'where':_0xae056b[_0xbc1b('0x3e')]};return db['Sound'][_0xbc1b('0x1b')](_0x28693e)[_0xbc1b('0x24')](function(_0x2c26f5){_0xaa59ba['count']=_0x2c26f5;if(_0x51179f[_0xbc1b('0x35')][_0xbc1b('0x44')]){_0xae056b['include']=[{'all':!![]}];}return db[_0xbc1b('0x2d')][_0xbc1b('0x45')](_0xae056b);})['then'](function(_0x4ad340){_0xaa59ba[_0xbc1b('0x46')]=_0x4ad340;return _0xaa59ba;})['then'](respondWithFilteredResult(_0x4f4397,_0xae056b))[_0xbc1b('0x47')](handleError(_0x4f4397,null));};exports[_0xbc1b('0x48')]=function(_0x2ed8d4,_0x42c019){var _0xbfb664={'raw':!![],'where':{'id':_0x2ed8d4[_0xbc1b('0x49')]['id']}},_0x2703fc={};_0x2703fc[_0xbc1b('0x32')]=_[_0xbc1b('0x34')](db[_0xbc1b('0x2d')]['rawAttributes']);_0x2703fc['query']=_[_0xbc1b('0x34')](_0x2ed8d4['query']);_0x2703fc[_0xbc1b('0x36')]=_[_0xbc1b('0x37')](_0x2703fc['model'],_0x2703fc['query']);_0xbfb664[_0xbc1b('0x38')]=_[_0xbc1b('0x37')](_0x2703fc[_0xbc1b('0x32')],qs[_0xbc1b('0x39')](_0x2ed8d4[_0xbc1b('0x35')][_0xbc1b('0x39')]));_0xbfb664[_0xbc1b('0x38')]=_0xbfb664[_0xbc1b('0x38')][_0xbc1b('0x3a')]?_0xbfb664[_0xbc1b('0x38')]:_0x2703fc[_0xbc1b('0x32')];if(_0x2ed8d4[_0xbc1b('0x35')][_0xbc1b('0x44')]){_0xbfb664[_0xbc1b('0x4a')]=[{'all':!![]}];}_0xbfb664=_['merge']({},_0xbfb664,_0x2ed8d4['options']);return db[_0xbc1b('0x2d')][_0xbc1b('0x4b')](_0xbfb664)[_0xbc1b('0x24')](handleEntityNotFound(_0x42c019,null))[_0xbc1b('0x24')](respondWithResult(_0x42c019,null))[_0xbc1b('0x47')](handleError(_0x42c019,null));};exports['download']=function(_0x3ff3f7,_0x2de177,_0x433f6d){return db[_0xbc1b('0x2d')][_0xbc1b('0x4b')]({'where':{'id':_0x3ff3f7[_0xbc1b('0x49')]['id']},'attributes':[_0xbc1b('0x2c'),_0xbc1b('0x4c'),_0xbc1b('0x4d')],'raw':!![]})[_0xbc1b('0x24')](handleEntityNotFound(_0x2de177,null))[_0xbc1b('0x24')](function(_0x3201ec){if(_0x3201ec){if(!fs[_0xbc1b('0x4e')](path['join'](config[_0xbc1b('0x4f')],_0xbc1b('0x50'),_0x3201ec[_0xbc1b('0x4c')]+'.'+_0x3201ec[_0xbc1b('0x4d')]))){throw new db['Sequelize']['ValidationError'](_0xbc1b('0x51'));}return _0x2de177[_0xbc1b('0x52')](path['join'](config[_0xbc1b('0x4f')],_0xbc1b('0x50'),util[_0xbc1b('0x53')]('%s.%s',_0x3201ec['save_name'],_0x3201ec[_0xbc1b('0x4d')])),util[_0xbc1b('0x53')]('%s.%s',_0x3201ec['name'],_0x3201ec[_0xbc1b('0x4d')]));}return null;})['catch'](handleError(_0x2de177,null));};exports['create']=function(_0x3a4649,_0x2aaee0,_0x4fc468){var _0x526bb1={'name':path[_0xbc1b('0x54')](_0x3a4649[_0xbc1b('0x55')][_0xbc1b('0x56')],path[_0xbc1b('0x57')](_0x3a4649['file']['originalname'])),'save_name':path[_0xbc1b('0x54')](_0x3a4649['file']['filename'],path[_0xbc1b('0x57')](_0x3a4649[_0xbc1b('0x55')][_0xbc1b('0x58')])),'original_format':path[_0xbc1b('0x57')](_0x3a4649[_0xbc1b('0x55')][_0xbc1b('0x56')])['substring'](0x1),'converted_format':_0xbc1b('0x59')};var _0x5bd745=path[_0xbc1b('0x5a')](config['root'],_0xbc1b('0x5b'),_0x3a4649['file'][_0xbc1b('0x58')]);var _0x463c07=path[_0xbc1b('0x5a')](config['root'],'server/files/sounds/converted',util[_0xbc1b('0x53')](_0xbc1b('0x5c'),path['basename'](_0x3a4649[_0xbc1b('0x55')][_0xbc1b('0x58')],path[_0xbc1b('0x57')](_0x3a4649[_0xbc1b('0x55')]['filename'])),_0x526bb1[_0xbc1b('0x4d')]));logger[_0xbc1b('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x5bd745);logger['info'](_0xbc1b('0x5e'),_0x463c07);try{fs[_0xbc1b('0x5f')](_0x5bd745,parseInt(_0xbc1b('0x60'),0x8));var _0x40ad4d=sox['transcode'](_0x5bd745,_0x463c07,{'sampleRate':0x1f40,'format':_0xbc1b('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x40ad4d['on'](_0xbc1b('0x2a'),function(_0x254f15){fs[_0xbc1b('0x61')](_0x5bd745);_0x2aaee0['status'](0x1f4)[_0xbc1b('0x62')](_0x254f15);});_0x40ad4d['on'](_0xbc1b('0x63'),function(_0x58de93){_0x526bb1[_0xbc1b('0x64')]=isNaN(_0x58de93[_0xbc1b('0x65')])?null:_0x58de93[_0xbc1b('0x65')]*0x3e8;_0x526bb1[_0xbc1b('0x66')]=isNaN(_0x58de93['sampleCount'])?null:_0x58de93['sampleCount'];_0x526bb1['original_channelCount']=isNaN(_0x58de93[_0xbc1b('0x67')])?null:_0x58de93['channelCount'];_0x526bb1[_0xbc1b('0x68')]=isNaN(_0x58de93[_0xbc1b('0x69')])?null:_0x58de93[_0xbc1b('0x69')];_0x526bb1['original_sampleRate']=isNaN(_0x58de93[_0xbc1b('0x6a')])?null:_0x58de93[_0xbc1b('0x6a')];});_0x40ad4d['on'](_0xbc1b('0x6b'),function(_0x1bf610){_0x526bb1[_0xbc1b('0x6c')]=isNaN(_0x1bf610[_0xbc1b('0x65')])?null:_0x1bf610[_0xbc1b('0x65')]*0x3e8;_0x526bb1[_0xbc1b('0x6d')]=isNaN(_0x1bf610[_0xbc1b('0x6e')])?null:_0x1bf610[_0xbc1b('0x6e')];_0x526bb1[_0xbc1b('0x6f')]=isNaN(_0x1bf610[_0xbc1b('0x67')])?null:_0x1bf610[_0xbc1b('0x67')];_0x526bb1['converted_bitRate']=isNaN(_0x1bf610[_0xbc1b('0x69')])?null:_0x1bf610[_0xbc1b('0x69')];_0x526bb1[_0xbc1b('0x70')]=isNaN(_0x1bf610[_0xbc1b('0x6a')])?null:_0x1bf610[_0xbc1b('0x6a')];});_0x40ad4d['on']('end',function(){fs[_0xbc1b('0x5f')](_0x463c07,parseInt('0777',0x8));return db['Sound'][_0xbc1b('0x71')](_0x526bb1)['then'](function(_0xbd00bb){var _0x464e25={'role':_0x3a4649[_0xbc1b('0x72')]['role'],'userProfileId':_0x3a4649[_0xbc1b('0x72')][_0xbc1b('0x73')]};if(!_0x464e25)throw new Error(_0xbc1b('0x74'));if(_0x464e25['role']===_0xbc1b('0x75')){var _0xa02df6=_0xbd00bb[_0xbc1b('0x26')]({'plain':!![]});return db[_0xbc1b('0x76')][_0xbc1b('0x4b')]({'where':{'name':_0xbc1b('0x27'),'userProfileId':_0x464e25[_0xbc1b('0x73')]},'raw':!![]})[_0xbc1b('0x24')](function(_0x3c0f4d){if(_0x3c0f4d&&_0x3c0f4d['autoAssociation']===0x0){return db[_0xbc1b('0x28')][_0xbc1b('0x71')]({'name':_0xa02df6['name'],'resourceId':_0xa02df6['id'],'type':_0x3c0f4d[_0xbc1b('0x2c')],'sectionId':_0x3c0f4d['id']},{})[_0xbc1b('0x24')](function(){return _0xbd00bb;});}else{return _0xbd00bb;}})[_0xbc1b('0x47')](function(_0x1f5ef3){logger[_0xbc1b('0x2a')](_0xbc1b('0x77'),_0x1f5ef3);throw _0x1f5ef3;});}return _0xbd00bb;})[_0xbc1b('0x24')](respondWithResult(_0x2aaee0,null))[_0xbc1b('0x47')](handleError(_0x2aaee0,null));});_0x40ad4d['start']();}catch(_0x36eea0){_0x2aaee0['status'](0x1f4)[_0xbc1b('0x62')](_0x36eea0);}};exports['update']=function(_0x583f7a,_0x1260bf,_0x28da31){return db['Sound'][_0xbc1b('0x4b')]({'where':{'id':_0x583f7a['params']['id']}})[_0xbc1b('0x24')](handleEntityNotFound(_0x1260bf,null))[_0xbc1b('0x24')](saveUpdates(_['pick'](_0x583f7a['body'],[_0xbc1b('0x2c'),_0xbc1b('0x78')]),null))[_0xbc1b('0x24')](respondWithResult(_0x1260bf,null))[_0xbc1b('0x47')](handleError(_0x1260bf,null));};exports['delete']=function(_0x5a8af3,_0x3f5a3d,_0x4dc8e7){return db['Sound'][_0xbc1b('0x4b')]({'where':{'id':_0x5a8af3['params']['id']}})[_0xbc1b('0x24')](function(_0x1c9859){if(_0x1c9859){return _0x1c9859[_0xbc1b('0x25')]();}})[_0xbc1b('0x24')](function(_0x2f2bf0){var _0x39a4fe=path[_0xbc1b('0x5a')](config[_0xbc1b('0x4f')],_0xbc1b('0x5b'),util[_0xbc1b('0x53')](_0xbc1b('0x5c'),_0x2f2bf0[_0xbc1b('0x4c')],_0x2f2bf0['original_format']));var _0xd52b20=path['join'](config['root'],_0xbc1b('0x50'),util[_0xbc1b('0x53')](_0xbc1b('0x5c'),_0x2f2bf0[_0xbc1b('0x4c')],_0x2f2bf0[_0xbc1b('0x4d')]));fs[_0xbc1b('0x61')](_0x39a4fe);fs['unlinkSync'](_0xd52b20);return _0x2f2bf0;})['then'](function(_0xb18f87){if(_0xb18f87){return _0x3f5a3d[_0xbc1b('0x17')](0xcc)[_0xbc1b('0x18')]();}})[_0xbc1b('0x24')](handleEntityNotFound(_0x3f5a3d,null))['catch'](handleError(_0x3f5a3d,null));}; \ No newline at end of file +var _0x9ea6=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','UserProfileResource','update','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','Sounds','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_channelCount','sampleRate','body','role','userProfileId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ea6,0x103));var _0x69ea=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9ea6[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x69ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69ea('0x1'));var jsonpatch=require(_0x69ea('0x2'));var rp=require(_0x69ea('0x3'));var moment=require(_0x69ea('0x4'));var BPromise=require(_0x69ea('0x5'));var Mustache=require(_0x69ea('0x6'));var util=require(_0x69ea('0x7'));var path=require(_0x69ea('0x8'));var sox=require(_0x69ea('0x9'));var csv=require(_0x69ea('0xa'));var ejs=require(_0x69ea('0xb'));var fs=require('fs');var fs_extra=require(_0x69ea('0xc'));var _=require(_0x69ea('0xd'));var squel=require(_0x69ea('0xe'));var crypto=require(_0x69ea('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x69ea('0x10'));var toCsv=require(_0x69ea('0xa'));var querystring=require('querystring');var Papa=require(_0x69ea('0x11'));var Redis=require(_0x69ea('0x12'));var authService=require(_0x69ea('0x13'));var qs=require(_0x69ea('0x14'));var as=require(_0x69ea('0x15'));var hardwareService=require(_0x69ea('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x69ea('0x17'));var config=require(_0x69ea('0x18'));var licenseUtil=require(_0x69ea('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x234328,_0x32f65e){_0x32f65e=_0x32f65e||0xcc;return function(_0x7b7760){if(_0x7b7760){return _0x234328[_0x69ea('0x1a')](_0x32f65e);}return _0x234328[_0x69ea('0x1b')](_0x32f65e)[_0x69ea('0x1c')]();};}function respondWithResult(_0x41aa5a,_0x3492d7){_0x3492d7=_0x3492d7||0xc8;return function(_0x38bd5a){if(_0x38bd5a){return _0x41aa5a[_0x69ea('0x1b')](_0x3492d7)[_0x69ea('0x1d')](_0x38bd5a);}};}function respondWithFilteredResult(_0x309e1c,_0x1bcc45){return function(_0x2770b8){if(_0x2770b8){var _0xb214ca=typeof _0x1bcc45[_0x69ea('0x1e')]===_0x69ea('0x1f')&&typeof _0x1bcc45[_0x69ea('0x20')]===_0x69ea('0x1f');var _0x506f05=_0x2770b8[_0x69ea('0x21')];var _0x3fd6c1=_0xb214ca?0x0:_0x1bcc45[_0x69ea('0x1e')];var _0xc6959c=_0xb214ca?_0x2770b8[_0x69ea('0x21')]:_0x1bcc45[_0x69ea('0x1e')]+_0x1bcc45[_0x69ea('0x20')];var _0x7274ef;if(_0xc6959c>=_0x506f05){_0xc6959c=_0x506f05;_0x7274ef=0xc8;}else{_0x7274ef=0xce;}_0x309e1c['status'](_0x7274ef);return _0x309e1c[_0x69ea('0x22')]('Content-Range',_0x3fd6c1+'-'+_0xc6959c+'/'+_0x506f05)['json'](_0x2770b8);}return null;};}function patchUpdates(_0x374c42){return function(_0x588af7){try{jsonpatch[_0x69ea('0x23')](_0x588af7,_0x374c42,!![]);}catch(_0x1e1a33){return BPromise[_0x69ea('0x24')](_0x1e1a33);}return _0x588af7['save']();};}function saveUpdates(_0x31eaba,_0x21bf65){return function(_0x3cc577){if(_0x3cc577){return _0x3cc577['update'](_0x31eaba)['then'](function(_0x5bedb3){return _0x5bedb3;});}return null;};}function removeEntity(_0x4e85ca,_0x4ad30b){return function(_0x7f734a){if(_0x7f734a){return _0x7f734a[_0x69ea('0x25')]()[_0x69ea('0x26')](function(){var _0x40bb21=_0x7f734a['get']({'plain':!![]});var _0x1c2d65=_0x69ea('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c2d65,'resourceId':_0x40bb21['id']}})['then'](function(){return _0x7f734a;});})['then'](function(){_0x4e85ca[_0x69ea('0x1b')](0xcc)[_0x69ea('0x1c')]();});}};}function handleEntityNotFound(_0x3deefc,_0x14d9ad){return function(_0x4843df){if(!_0x4843df){_0x3deefc['sendStatus'](0x194);}return _0x4843df;};}function handleError(_0x129c97,_0x2f2b85){_0x2f2b85=_0x2f2b85||0x1f4;return function(_0x2bfd36){logger[_0x69ea('0x28')](_0x2bfd36[_0x69ea('0x29')]);if(_0x2bfd36['name']){delete _0x2bfd36[_0x69ea('0x2a')];}_0x129c97[_0x69ea('0x1b')](_0x2f2b85)[_0x69ea('0x2b')](_0x2bfd36);};}exports[_0x69ea('0x2c')]=function(_0x4ae3bd,_0x4e248c){var _0x115fa5={},_0x4c1b3f={},_0xf08df8={'count':0x0,'rows':[]};var _0x30be2e=_[_0x69ea('0x2d')](db[_0x69ea('0x2e')][_0x69ea('0x2f')],function(_0x130ba0){return{'name':_0x130ba0[_0x69ea('0x30')],'type':_0x130ba0[_0x69ea('0x31')][_0x69ea('0x32')]};});_0x4c1b3f[_0x69ea('0x33')]=_[_0x69ea('0x2d')](_0x30be2e,_0x69ea('0x2a'));_0x4c1b3f[_0x69ea('0x34')]=_['keys'](_0x4ae3bd['query']);_0x4c1b3f[_0x69ea('0x35')]=_[_0x69ea('0x36')](_0x4c1b3f[_0x69ea('0x33')],_0x4c1b3f[_0x69ea('0x34')]);_0x115fa5[_0x69ea('0x37')]=_[_0x69ea('0x36')](_0x4c1b3f[_0x69ea('0x33')],qs[_0x69ea('0x38')](_0x4ae3bd['query']['fields']));_0x115fa5['attributes']=_0x115fa5[_0x69ea('0x37')]['length']?_0x115fa5['attributes']:_0x4c1b3f[_0x69ea('0x33')];if(!_0x4ae3bd[_0x69ea('0x34')]['hasOwnProperty'](_0x69ea('0x39'))){_0x115fa5[_0x69ea('0x20')]=qs[_0x69ea('0x20')](_0x4ae3bd['query']['limit']);_0x115fa5[_0x69ea('0x1e')]=qs[_0x69ea('0x1e')](_0x4ae3bd['query']['offset']);}_0x115fa5[_0x69ea('0x3a')]=qs[_0x69ea('0x3b')](_0x4ae3bd[_0x69ea('0x34')][_0x69ea('0x3b')]);_0x115fa5[_0x69ea('0x3c')]=qs['filters'](_[_0x69ea('0x3d')](_0x4ae3bd[_0x69ea('0x34')],_0x4c1b3f[_0x69ea('0x35')]),_0x30be2e);if(_0x4ae3bd[_0x69ea('0x34')][_0x69ea('0x3e')]){_0x115fa5[_0x69ea('0x3c')]=_[_0x69ea('0x3f')](_0x115fa5[_0x69ea('0x3c')],{'$or':_[_0x69ea('0x2d')](_0x30be2e,function(_0x306d5b){if(_0x306d5b[_0x69ea('0x31')]!=='VIRTUAL'){var _0x37036a={};_0x37036a[_0x306d5b[_0x69ea('0x2a')]]={'$like':'%'+_0x4ae3bd[_0x69ea('0x34')]['filter']+'%'};return _0x37036a;}})});}_0x115fa5=_[_0x69ea('0x3f')]({},_0x115fa5,_0x4ae3bd[_0x69ea('0x40')]);var _0x2d2f80={'where':_0x115fa5[_0x69ea('0x3c')]};return db[_0x69ea('0x2e')][_0x69ea('0x21')](_0x2d2f80)[_0x69ea('0x26')](function(_0x31fc19){_0xf08df8[_0x69ea('0x21')]=_0x31fc19;if(_0x4ae3bd[_0x69ea('0x34')][_0x69ea('0x41')]){_0x115fa5['include']=[{'all':!![]}];}return db[_0x69ea('0x2e')][_0x69ea('0x42')](_0x115fa5);})[_0x69ea('0x26')](function(_0x4af9fd){_0xf08df8[_0x69ea('0x43')]=_0x4af9fd;return _0xf08df8;})[_0x69ea('0x26')](respondWithFilteredResult(_0x4e248c,_0x115fa5))[_0x69ea('0x44')](handleError(_0x4e248c,null));};exports[_0x69ea('0x45')]=function(_0x5c1d8b,_0x67933f){var _0xdf1542={'raw':!![],'where':{'id':_0x5c1d8b[_0x69ea('0x46')]['id']}},_0x54c104={};_0x54c104[_0x69ea('0x33')]=_[_0x69ea('0x47')](db[_0x69ea('0x2e')]['rawAttributes']);_0x54c104[_0x69ea('0x34')]=_[_0x69ea('0x47')](_0x5c1d8b['query']);_0x54c104[_0x69ea('0x35')]=_[_0x69ea('0x36')](_0x54c104[_0x69ea('0x33')],_0x54c104['query']);_0xdf1542['attributes']=_[_0x69ea('0x36')](_0x54c104[_0x69ea('0x33')],qs[_0x69ea('0x38')](_0x5c1d8b[_0x69ea('0x34')][_0x69ea('0x38')]));_0xdf1542[_0x69ea('0x37')]=_0xdf1542[_0x69ea('0x37')]['length']?_0xdf1542[_0x69ea('0x37')]:_0x54c104[_0x69ea('0x33')];if(_0x5c1d8b[_0x69ea('0x34')][_0x69ea('0x41')]){_0xdf1542['include']=[{'all':!![]}];}_0xdf1542=_[_0x69ea('0x3f')]({},_0xdf1542,_0x5c1d8b[_0x69ea('0x40')]);return db[_0x69ea('0x2e')][_0x69ea('0x48')](_0xdf1542)[_0x69ea('0x26')](handleEntityNotFound(_0x67933f,null))['then'](respondWithResult(_0x67933f,null))['catch'](handleError(_0x67933f,null));};exports[_0x69ea('0x49')]=function(_0xa9d5e7,_0x1f6949,_0x17a2fe){return db['Sound'][_0x69ea('0x48')]({'where':{'id':_0xa9d5e7[_0x69ea('0x46')]['id']},'attributes':[_0x69ea('0x2a'),_0x69ea('0x4a'),_0x69ea('0x4b')],'raw':!![]})[_0x69ea('0x26')](handleEntityNotFound(_0x1f6949,null))['then'](function(_0x330d64){if(_0x330d64){if(!fs[_0x69ea('0x4c')](path['join'](config[_0x69ea('0x4d')],_0x69ea('0x4e'),_0x330d64[_0x69ea('0x4a')]+'.'+_0x330d64['converted_format']))){throw new db[(_0x69ea('0x4f'))][(_0x69ea('0x50'))]('Sound\x20not\x20found');}return _0x1f6949[_0x69ea('0x49')](path['join'](config['root'],_0x69ea('0x4e'),util[_0x69ea('0x51')]('%s.%s',_0x330d64[_0x69ea('0x4a')],_0x330d64[_0x69ea('0x4b')])),util[_0x69ea('0x51')](_0x69ea('0x52'),_0x330d64[_0x69ea('0x2a')],_0x330d64[_0x69ea('0x4b')]));}return null;})[_0x69ea('0x44')](handleError(_0x1f6949,null));};exports[_0x69ea('0x53')]=function(_0x301bc1,_0x476e54,_0xfb14f4){var _0x1f4112={'name':path['basename'](_0x301bc1[_0x69ea('0x54')][_0x69ea('0x55')],path[_0x69ea('0x56')](_0x301bc1[_0x69ea('0x54')]['originalname'])),'save_name':path[_0x69ea('0x57')](_0x301bc1[_0x69ea('0x54')][_0x69ea('0x58')],path['extname'](_0x301bc1['file'][_0x69ea('0x58')])),'original_format':path[_0x69ea('0x56')](_0x301bc1[_0x69ea('0x54')][_0x69ea('0x55')])[_0x69ea('0x59')](0x1),'converted_format':_0x69ea('0x5a')};var _0x25c442=path['join'](config['root'],_0x69ea('0x5b'),_0x301bc1['file'][_0x69ea('0x58')]);var _0x2627d0=path[_0x69ea('0x5c')](config[_0x69ea('0x4d')],_0x69ea('0x4e'),util[_0x69ea('0x51')](_0x69ea('0x52'),path[_0x69ea('0x57')](_0x301bc1[_0x69ea('0x54')][_0x69ea('0x58')],path[_0x69ea('0x56')](_0x301bc1[_0x69ea('0x54')][_0x69ea('0x58')])),_0x1f4112[_0x69ea('0x4b')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x25c442);logger[_0x69ea('0x5d')](_0x69ea('0x5e'),_0x2627d0);try{fs[_0x69ea('0x5f')](_0x25c442,parseInt(_0x69ea('0x60'),0x8));var _0x397d5a=sox[_0x69ea('0x61')](_0x25c442,_0x2627d0,{'sampleRate':0x1f40,'format':_0x69ea('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x397d5a['on'](_0x69ea('0x28'),function(_0x4d8406){fs[_0x69ea('0x62')](_0x25c442);_0x476e54['status'](0x1f4)['send'](_0x4d8406);});_0x397d5a['on'](_0x69ea('0x63'),function(_0x4f06f9){_0x1f4112[_0x69ea('0x64')]=isNaN(_0x4f06f9['duration'])?null:_0x4f06f9['duration']*0x3e8;_0x1f4112['original_sampleCount']=isNaN(_0x4f06f9[_0x69ea('0x65')])?null:_0x4f06f9[_0x69ea('0x65')];_0x1f4112[_0x69ea('0x66')]=isNaN(_0x4f06f9[_0x69ea('0x67')])?null:_0x4f06f9['channelCount'];_0x1f4112[_0x69ea('0x68')]=isNaN(_0x4f06f9[_0x69ea('0x69')])?null:_0x4f06f9[_0x69ea('0x69')];_0x1f4112[_0x69ea('0x6a')]=isNaN(_0x4f06f9['sampleRate'])?null:_0x4f06f9['sampleRate'];});_0x397d5a['on'](_0x69ea('0x6b'),function(_0x2655ed){_0x1f4112[_0x69ea('0x6c')]=isNaN(_0x2655ed[_0x69ea('0x6d')])?null:_0x2655ed[_0x69ea('0x6d')]*0x3e8;_0x1f4112[_0x69ea('0x6e')]=isNaN(_0x2655ed[_0x69ea('0x65')])?null:_0x2655ed[_0x69ea('0x65')];_0x1f4112[_0x69ea('0x6f')]=isNaN(_0x2655ed[_0x69ea('0x67')])?null:_0x2655ed[_0x69ea('0x67')];_0x1f4112['converted_bitRate']=isNaN(_0x2655ed['bitRate'])?null:_0x2655ed['bitRate'];_0x1f4112['converted_sampleRate']=isNaN(_0x2655ed[_0x69ea('0x70')])?null:_0x2655ed[_0x69ea('0x70')];});_0x397d5a['on'](_0x69ea('0x1c'),function(){fs['chmodSync'](_0x2627d0,parseInt('0777',0x8));return db[_0x69ea('0x2e')][_0x69ea('0x53')](_0x1f4112)['then'](function(_0x3c7ccb){var _0x2bb021={'role':_0x301bc1[_0x69ea('0x71')][_0x69ea('0x72')],'userProfileId':_0x301bc1[_0x69ea('0x71')][_0x69ea('0x73')]};if(!_0x2bb021)throw new Error(_0x69ea('0x74'));if(_0x2bb021[_0x69ea('0x72')]===_0x69ea('0x75')){var _0xa6ae9=_0x3c7ccb[_0x69ea('0x76')]({'plain':!![]});return db[_0x69ea('0x77')][_0x69ea('0x48')]({'where':{'name':_0x69ea('0x27'),'userProfileId':_0x2bb021[_0x69ea('0x73')]},'raw':!![]})[_0x69ea('0x26')](function(_0x141fbc){if(_0x141fbc&&_0x141fbc['autoAssociation']===0x0){return db[_0x69ea('0x78')][_0x69ea('0x53')]({'name':_0xa6ae9['name'],'resourceId':_0xa6ae9['id'],'type':_0x141fbc[_0x69ea('0x2a')],'sectionId':_0x141fbc['id']},{})[_0x69ea('0x26')](function(){return _0x3c7ccb;});}else{return _0x3c7ccb;}})['catch'](function(_0x52b29e){logger[_0x69ea('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52b29e);throw _0x52b29e;});}return _0x3c7ccb;})['then'](respondWithResult(_0x476e54,null))['catch'](handleError(_0x476e54,null));});_0x397d5a['start']();}catch(_0x571e44){_0x476e54[_0x69ea('0x1b')](0x1f4)[_0x69ea('0x2b')](_0x571e44);}};exports[_0x69ea('0x79')]=function(_0x67beb1,_0x2e46d0,_0x290289){return db['Sound'][_0x69ea('0x48')]({'where':{'id':_0x67beb1['params']['id']}})[_0x69ea('0x26')](handleEntityNotFound(_0x2e46d0,null))[_0x69ea('0x26')](saveUpdates(_[_0x69ea('0x3d')](_0x67beb1[_0x69ea('0x71')],[_0x69ea('0x2a'),_0x69ea('0x7a')]),null))[_0x69ea('0x26')](respondWithResult(_0x2e46d0,null))[_0x69ea('0x44')](handleError(_0x2e46d0,null));};exports[_0x69ea('0x7b')]=function(_0x3f5b7f,_0x436c68,_0xe5ebc8){return db[_0x69ea('0x2e')]['find']({'where':{'id':_0x3f5b7f['params']['id']}})[_0x69ea('0x26')](function(_0x23a459){if(_0x23a459){return _0x23a459['destroy']();}})[_0x69ea('0x26')](function(_0x556613){var _0x3977e9=path[_0x69ea('0x5c')](config[_0x69ea('0x4d')],_0x69ea('0x5b'),util[_0x69ea('0x51')](_0x69ea('0x52'),_0x556613[_0x69ea('0x4a')],_0x556613[_0x69ea('0x7c')]));var _0x1bfc08=path[_0x69ea('0x5c')](config['root'],_0x69ea('0x4e'),util[_0x69ea('0x51')]('%s.%s',_0x556613[_0x69ea('0x4a')],_0x556613['converted_format']));fs['unlinkSync'](_0x3977e9);fs['unlinkSync'](_0x1bfc08);return _0x556613;})[_0x69ea('0x26')](function(_0x31198c){if(_0x31198c){return _0x436c68[_0x69ea('0x1b')](0xcc)[_0x69ea('0x1c')]();}})['then'](handleEntityNotFound(_0x436c68,null))[_0x69ea('0x44')](handleError(_0x436c68,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index cb9ccbc..603f197 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 _0x99db=['moment','bluebird','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api'];(function(_0x511111,_0x4ab3d8){var _0x265601=function(_0x5cba3b){while(--_0x5cba3b){_0x511111['push'](_0x511111['shift']());}};_0x265601(++_0x4ab3d8);}(_0x99db,0x141));var _0xb99d=function(_0x4d9403,_0x33c5f0){_0x4d9403=_0x4d9403-0x0;var _0x5eef11=_0x99db[_0x4d9403];return _0x5eef11;};'use strict';var _=require('lodash');var util=require(_0xb99d('0x0'));var logger=require(_0xb99d('0x1'))(_0xb99d('0x2'));var moment=require(_0xb99d('0x3'));var BPromise=require(_0xb99d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb99d('0x5'));var config=require(_0xb99d('0x6'));var attributes=require(_0xb99d('0x7'));module[_0xb99d('0x8')]=function(_0x11974a,_0x4f16c2){return _0x11974a[_0xb99d('0x9')](_0xb99d('0xa'),attributes,{'tableName':_0xb99d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x322b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment'];(function(_0x1258fc,_0x31f45c){var _0x5138d8=function(_0x1c3046){while(--_0x1c3046){_0x1258fc['push'](_0x1258fc['shift']());}};_0x5138d8(++_0x31f45c);}(_0x322b,0x104));var _0xb322=function(_0x3e7b34,_0x58f43c){_0x3e7b34=_0x3e7b34-0x0;var _0xceb31f=_0x322b[_0x3e7b34];return _0xceb31f;};'use strict';var _=require('lodash');var util=require(_0xb322('0x0'));var logger=require(_0xb322('0x1'))(_0xb322('0x2'));var moment=require(_0xb322('0x3'));var BPromise=require(_0xb322('0x4'));var rp=require(_0xb322('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb322('0x6'));var config=require(_0xb322('0x7'));var attributes=require('./sound.attributes');module[_0xb322('0x8')]=function(_0x5717d9,_0x4a7c81){return _0x5717d9[_0xb322('0x9')](_0xb322('0xa'),attributes,{'tableName':_0xb322('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 bca14c6..905fd19 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 _0x3512=['error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0x3512,0x6f));var _0x2351=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3512[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x2351('0x0'));var moment=require(_0x2351('0x1'));var BPromise=require(_0x2351('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2351('0x3'));var db=require(_0x2351('0x4'))['db'];var utils=require(_0x2351('0x5'));var logger=require(_0x2351('0x6'))(_0x2351('0x7'));var config=require(_0x2351('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2351('0x9')][_0x2351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f479,_0xcf4ea7,_0x1b2dd8){return new BPromise(function(_0xb30f3c,_0x30db46){return client[_0x2351('0xb')](_0x28f479,_0x1b2dd8)[_0x2351('0xc')](function(_0x3ef855){logger[_0x2351('0xd')]('Sound,\x20%s,\x20%s',_0xcf4ea7,_0x2351('0xe'));logger[_0x2351('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xcf4ea7,_0x2351('0xe'),JSON[_0x2351('0x10')](_0x3ef855));if(_0x3ef855['error']){if(_0x3ef855[_0x2351('0x11')][_0x2351('0x12')]===0x1f4){logger[_0x2351('0x11')](_0x2351('0x13'),_0xcf4ea7,_0x3ef855['error'][_0x2351('0x14')]);return _0x30db46(_0x3ef855[_0x2351('0x11')][_0x2351('0x14')]);}logger[_0x2351('0x11')](_0x2351('0x13'),_0xcf4ea7,_0x3ef855[_0x2351('0x11')][_0x2351('0x14')]);return _0xb30f3c(_0x3ef855['error']['message']);}else{logger[_0x2351('0xd')](_0x2351('0x13'),_0xcf4ea7,_0x2351('0xe'));_0xb30f3c(_0x3ef855[_0x2351('0x15')][_0x2351('0x14')]);}})[_0x2351('0x16')](function(_0x27eff5){logger[_0x2351('0x11')](_0x2351('0x13'),_0xcf4ea7,_0x27eff5);_0x30db46(_0x27eff5);});});}exports[_0x2351('0x17')]=function(_0x173a31){var _0x183f3e=this;return new Promise(function(_0x22a00c,_0x40482){return db[_0x2351('0x18')][_0x2351('0x19')]({'raw':_0x173a31['options']?_0x173a31[_0x2351('0x1a')][_0x2351('0x1b')]===undefined?!![]:![]:!![],'where':_0x173a31['options']?_0x173a31['options']['where']||null:null,'attributes':_0x173a31[_0x2351('0x1a')]?_0x173a31['options'][_0x2351('0x1c')]||null:null,'include':_0x173a31[_0x2351('0x1a')]?_0x173a31['options'][_0x2351('0x1d')]?_[_0x2351('0x1e')](_0x173a31[_0x2351('0x1a')][_0x2351('0x1d')],function(_0x932cc9){return{'model':db[_0x932cc9['model']],'as':_0x932cc9['as'],'attributes':_0x932cc9[_0x2351('0x1c')],'include':_0x932cc9[_0x2351('0x1d')]?_[_0x2351('0x1e')](_0x932cc9[_0x2351('0x1d')],function(_0x3021e7){return{'model':db[_0x3021e7[_0x2351('0x1f')]],'as':_0x3021e7['as'],'attributes':_0x3021e7[_0x2351('0x1c')],'include':_0x3021e7[_0x2351('0x1d')]?_[_0x2351('0x1e')](_0x3021e7[_0x2351('0x1d')],function(_0x1b4eb0){return{'model':db[_0x1b4eb0[_0x2351('0x1f')]],'as':_0x1b4eb0['as'],'attributes':_0x1b4eb0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2351('0xc')](function(_0xc0001c){logger[_0x2351('0xd')](_0x2351('0x17'),_0x173a31);logger[_0x2351('0xf')]('ShowSound',_0x173a31,JSON[_0x2351('0x10')](_0xc0001c));_0x22a00c(_0xc0001c);})[_0x2351('0x16')](function(_0x524796){logger['error'](_0x2351('0x17'),_0x524796[_0x2351('0x14')],_0x173a31);_0x40482(_0x183f3e[_0x2351('0x11')](0x1f4,_0x524796[_0x2351('0x14')]));});});}; \ No newline at end of file +var _0x2d34=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','then','debug','util'];(function(_0x1dd53f,_0x3126cb){var _0x418c84=function(_0x2cd28e){while(--_0x2cd28e){_0x1dd53f['push'](_0x1dd53f['shift']());}};_0x418c84(++_0x3126cb);}(_0x2d34,0x197));var _0x42d3=function(_0x4d9134,_0x315f9a){_0x4d9134=_0x4d9134-0x0;var _0x1d8628=_0x2d34[_0x4d9134];return _0x1d8628;};'use strict';var _=require('lodash');var util=require(_0x42d3('0x0'));var moment=require(_0x42d3('0x1'));var BPromise=require(_0x42d3('0x2'));var rs=require(_0x42d3('0x3'));var fs=require('fs');var Redis=require(_0x42d3('0x4'));var db=require(_0x42d3('0x5'))['db'];var utils=require(_0x42d3('0x6'));var logger=require(_0x42d3('0x7'))(_0x42d3('0x8'));var config=require(_0x42d3('0x9'));var jayson=require(_0x42d3('0xa'));var client=jayson[_0x42d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x507255,_0x4ca66d,_0x437c0e){return new BPromise(function(_0x6ee382,_0x52cff6){return client[_0x42d3('0xc')](_0x507255,_0x437c0e)['then'](function(_0x470fc2){logger[_0x42d3('0xd')](_0x42d3('0xe'),_0x4ca66d,_0x42d3('0xf'));logger['debug'](_0x42d3('0x10'),_0x4ca66d,_0x42d3('0xf'),JSON[_0x42d3('0x11')](_0x470fc2));if(_0x470fc2['error']){if(_0x470fc2[_0x42d3('0x12')][_0x42d3('0x13')]===0x1f4){logger[_0x42d3('0x12')](_0x42d3('0xe'),_0x4ca66d,_0x470fc2[_0x42d3('0x12')][_0x42d3('0x14')]);return _0x52cff6(_0x470fc2['error']['message']);}logger[_0x42d3('0x12')](_0x42d3('0xe'),_0x4ca66d,_0x470fc2['error'][_0x42d3('0x14')]);return _0x6ee382(_0x470fc2[_0x42d3('0x12')][_0x42d3('0x14')]);}else{logger[_0x42d3('0xd')](_0x42d3('0xe'),_0x4ca66d,_0x42d3('0xf'));_0x6ee382(_0x470fc2[_0x42d3('0x15')]['message']);}})[_0x42d3('0x16')](function(_0x512f37){logger['error']('Sound,\x20%s,\x20%s',_0x4ca66d,_0x512f37);_0x52cff6(_0x512f37);});});}exports[_0x42d3('0x17')]=function(_0x272bce){var _0x3fe4f8=this;return new Promise(function(_0x2310c9,_0x3b1a7b){return db[_0x42d3('0x18')][_0x42d3('0x19')]({'raw':_0x272bce[_0x42d3('0x1a')]?_0x272bce[_0x42d3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x272bce[_0x42d3('0x1a')]?_0x272bce[_0x42d3('0x1a')][_0x42d3('0x1b')]||null:null,'attributes':_0x272bce['options']?_0x272bce[_0x42d3('0x1a')][_0x42d3('0x1c')]||null:null,'include':_0x272bce[_0x42d3('0x1a')]?_0x272bce[_0x42d3('0x1a')][_0x42d3('0x1d')]?_[_0x42d3('0x1e')](_0x272bce[_0x42d3('0x1a')][_0x42d3('0x1d')],function(_0x47a098){return{'model':db[_0x47a098['model']],'as':_0x47a098['as'],'attributes':_0x47a098['attributes'],'include':_0x47a098[_0x42d3('0x1d')]?_[_0x42d3('0x1e')](_0x47a098[_0x42d3('0x1d')],function(_0x3de5fa){return{'model':db[_0x3de5fa['model']],'as':_0x3de5fa['as'],'attributes':_0x3de5fa['attributes'],'include':_0x3de5fa[_0x42d3('0x1d')]?_['map'](_0x3de5fa[_0x42d3('0x1d')],function(_0x19d321){return{'model':db[_0x19d321[_0x42d3('0x1f')]],'as':_0x19d321['as'],'attributes':_0x19d321[_0x42d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x42d3('0x20')](function(_0x28024a){logger[_0x42d3('0xd')]('ShowSound',_0x272bce);logger[_0x42d3('0x21')](_0x42d3('0x17'),_0x272bce,JSON[_0x42d3('0x11')](_0x28024a));_0x2310c9(_0x28024a);})[_0x42d3('0x16')](function(_0x5ce577){logger['error'](_0x42d3('0x17'),_0x5ce577[_0x42d3('0x14')],_0x272bce);_0x3b1a7b(_0x3fe4f8[_0x42d3('0x12')](0x1f4,_0x5ce577[_0x42d3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d18aa7a..7e026ca 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5beb9a,_0x4bbfb3){_0x5beb9a=_0x5beb9a-0x0;var _0x4530d5=_0x9ffd[_0x5beb9a];return _0x4530d5;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18d181,_0x27e7ca){var _0x3d4374=function(_0x5630c5){while(--_0x5630c5){_0x18d181['push'](_0x18d181['shift']());}};_0x3d4374(++_0x27e7ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f7b43,_0x119c22){_0x4f7b43=_0x4f7b43-0x0;var _0x2fcdf3=_0xb10b[_0x4f7b43];return _0x2fcdf3;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 311961f..e29b773 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 _0x0976=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x0976,0xa6));var _0x6097=function(_0x56c231,_0x4d95f9){_0x56c231=_0x56c231-0x0;var _0x18be20=_0x0976[_0x56c231];return _0x18be20;};'use strict';var Sequelize=require(_0x6097('0x0'));module[_0x6097('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6097('0x2')](_0x6097('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6097('0x4')]('in','out'),'defaultValue':_0x6097('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6097('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x76be=['TEXT','out','STRING','sequelize'];(function(_0x297cf0,_0x61297d){var _0x3dadd1=function(_0x30d61d){while(--_0x30d61d){_0x297cf0['push'](_0x297cf0['shift']());}};_0x3dadd1(++_0x61297d);}(_0x76be,0xbf));var _0xe76b=function(_0xdf6241,_0x16d87c){_0xdf6241=_0xdf6241-0x0;var _0x93720=_0x76be[_0xdf6241];return _0x93720;};'use strict';var Sequelize=require(_0xe76b('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xe76b('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe76b('0x2')),'defaultValue':_0xe76b('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe76b('0x3')]},'providerResponse':{'type':Sequelize[_0xe76b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 22c3f09..c4fbaf4 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 _0xa1cc=['ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x3cf84c,_0x343e87){var _0x17ade1=function(_0x1df8a9){while(--_0x1df8a9){_0x3cf84c['push'](_0x3cf84c['shift']());}};_0x17ade1(++_0x343e87);}(_0xa1cc,0x10f));var _0xca1c=function(_0x18f443,_0x5e41d5){_0x18f443=_0x18f443-0x0;var _0x3f6991=_0xa1cc[_0x18f443];return _0x3f6991;};'use strict';var emlformat=require(_0xca1c('0x0'));var rimraf=require(_0xca1c('0x1'));var zipdir=require(_0xca1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca1c('0x3'));var moment=require(_0xca1c('0x4'));var BPromise=require(_0xca1c('0x5'));var Mustache=require('mustache');var util=require(_0xca1c('0x6'));var path=require('path');var sox=require(_0xca1c('0x7'));var csv=require(_0xca1c('0x8'));var ejs=require(_0xca1c('0x9'));var fs=require('fs');var fs_extra=require(_0xca1c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1c('0xb'));var jsforce=require(_0xca1c('0xc'));var deskjs=require(_0xca1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca1c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xca1c('0xf'));var as=require(_0xca1c('0x10'));var hardwareService=require(_0xca1c('0x11'));var logger=require(_0xca1c('0x12'))(_0xca1c('0x13'));var utils=require('../../config/utils');var config=require(_0xca1c('0x14'));var licenseUtil=require(_0xca1c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3029fd,_0x5d60df){_0x5d60df=_0x5d60df||0xcc;return function(_0x292272){if(_0x292272){return _0x3029fd[_0xca1c('0x16')](_0x5d60df);}return _0x3029fd[_0xca1c('0x17')](_0x5d60df)['end']();};}function respondWithResult(_0x344d4c,_0x222a56){_0x222a56=_0x222a56||0xc8;return function(_0x5c7c21){if(_0x5c7c21){return _0x344d4c['status'](_0x222a56)[_0xca1c('0x18')](_0x5c7c21);}};}function respondWithFilteredResult(_0x2b55fd,_0x196a66){return function(_0x18e6ac){if(_0x18e6ac){var _0x2644f0=typeof _0x196a66[_0xca1c('0x19')]===_0xca1c('0x1a')&&typeof _0x196a66[_0xca1c('0x1b')]===_0xca1c('0x1a');var _0x882fd4=_0x18e6ac[_0xca1c('0x1c')];var _0x10b126=_0x2644f0?0x0:_0x196a66[_0xca1c('0x19')];var _0x447547=_0x2644f0?_0x18e6ac[_0xca1c('0x1c')]:_0x196a66[_0xca1c('0x19')]+_0x196a66['limit'];var _0x1b2d8d;if(_0x447547>=_0x882fd4){_0x447547=_0x882fd4;_0x1b2d8d=0xc8;}else{_0x1b2d8d=0xce;}_0x2b55fd[_0xca1c('0x17')](_0x1b2d8d);return _0x2b55fd['set']('Content-Range',_0x10b126+'-'+_0x447547+'/'+_0x882fd4)[_0xca1c('0x18')](_0x18e6ac);}return null;};}function patchUpdates(_0x10f801){return function(_0x31aa79){try{jsonpatch[_0xca1c('0x1d')](_0x31aa79,_0x10f801,!![]);}catch(_0x140e90){return BPromise[_0xca1c('0x1e')](_0x140e90);}return _0x31aa79[_0xca1c('0x1f')]();};}function saveUpdates(_0x5d23ac,_0x115b4d){return function(_0x540596){if(_0x540596){return _0x540596[_0xca1c('0x20')](_0x5d23ac)[_0xca1c('0x21')](function(_0x3fac0d){return _0x3fac0d;});}return null;};}function removeEntity(_0x40b169,_0x5f2d76){return function(_0x1c06dc){if(_0x1c06dc){return _0x1c06dc[_0xca1c('0x22')]()['then'](function(){_0x40b169[_0xca1c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1639da,_0x13ff50){return function(_0x2868c4){if(!_0x2868c4){_0x1639da[_0xca1c('0x16')](0x194);}return _0x2868c4;};}function handleError(_0x4aacb8,_0x1c3056){_0x1c3056=_0x1c3056||0x1f4;return function(_0xa1a686){logger[_0xca1c('0x23')](_0xa1a686[_0xca1c('0x24')]);if(_0xa1a686[_0xca1c('0x25')]){delete _0xa1a686[_0xca1c('0x25')];}_0x4aacb8[_0xca1c('0x17')](_0x1c3056)['send'](_0xa1a686);};}exports[_0xca1c('0x26')]=function(_0x5408c6,_0x573fc){var _0x31042a={},_0x4a2406={},_0xb2db36={'count':0x0,'rows':[]};var _0x3ffa43=_[_0xca1c('0x27')](db[_0xca1c('0x28')]['rawAttributes'],function(_0x404579){return{'name':_0x404579[_0xca1c('0x29')],'type':_0x404579[_0xca1c('0x2a')][_0xca1c('0x2b')]};});_0x4a2406['model']=_[_0xca1c('0x27')](_0x3ffa43,'name');_0x4a2406['query']=_[_0xca1c('0x2c')](_0x5408c6[_0xca1c('0x2d')]);_0x4a2406[_0xca1c('0x2e')]=_[_0xca1c('0x2f')](_0x4a2406[_0xca1c('0x30')],_0x4a2406['query']);_0x31042a['attributes']=_[_0xca1c('0x2f')](_0x4a2406[_0xca1c('0x30')],qs[_0xca1c('0x31')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x31')]));_0x31042a['attributes']=_0x31042a[_0xca1c('0x32')]['length']?_0x31042a[_0xca1c('0x32')]:_0x4a2406[_0xca1c('0x30')];if(!_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x33')]('nolimit')){_0x31042a[_0xca1c('0x1b')]=qs[_0xca1c('0x1b')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x1b')]);_0x31042a[_0xca1c('0x19')]=qs[_0xca1c('0x19')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x19')]);}_0x31042a[_0xca1c('0x34')]=qs[_0xca1c('0x35')](_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x35')]);_0x31042a['where']=qs[_0xca1c('0x2e')](_[_0xca1c('0x36')](_0x5408c6['query'],_0x4a2406[_0xca1c('0x2e')]),_0x3ffa43);if(_0x5408c6[_0xca1c('0x2d')]['filter']){_0x31042a[_0xca1c('0x37')]=_[_0xca1c('0x38')](_0x31042a[_0xca1c('0x37')],{'$or':_['map'](_0x3ffa43,function(_0x2f3a87){if(_0x2f3a87[_0xca1c('0x2a')]!=='VIRTUAL'){var _0x2ffdab={};_0x2ffdab[_0x2f3a87['name']]={'$like':'%'+_0x5408c6['query'][_0xca1c('0x39')]+'%'};return _0x2ffdab;}})});}_0x31042a=_[_0xca1c('0x38')]({},_0x31042a,_0x5408c6[_0xca1c('0x3a')]);var _0x56e943={'where':_0x31042a[_0xca1c('0x37')]};return db[_0xca1c('0x28')][_0xca1c('0x1c')](_0x56e943)[_0xca1c('0x21')](function(_0x2c37b8){_0xb2db36[_0xca1c('0x1c')]=_0x2c37b8;if(_0x5408c6[_0xca1c('0x2d')][_0xca1c('0x3b')]){_0x31042a[_0xca1c('0x3c')]=[{'all':!![]}];}return db[_0xca1c('0x28')][_0xca1c('0x3d')](_0x31042a);})[_0xca1c('0x21')](function(_0x15fd6f){_0xb2db36[_0xca1c('0x3e')]=_0x15fd6f;return _0xb2db36;})[_0xca1c('0x21')](respondWithFilteredResult(_0x573fc,_0x31042a))[_0xca1c('0x3f')](handleError(_0x573fc,null));};exports['show']=function(_0x248722,_0x3f81ae){var _0x55fb2a={'raw':!![],'where':{'id':_0x248722[_0xca1c('0x40')]['id']}},_0x34609c={};_0x34609c[_0xca1c('0x30')]=_[_0xca1c('0x2c')](db[_0xca1c('0x28')][_0xca1c('0x41')]);_0x34609c[_0xca1c('0x2d')]=_['keys'](_0x248722['query']);_0x34609c[_0xca1c('0x2e')]=_[_0xca1c('0x2f')](_0x34609c[_0xca1c('0x30')],_0x34609c['query']);_0x55fb2a[_0xca1c('0x32')]=_[_0xca1c('0x2f')](_0x34609c['model'],qs[_0xca1c('0x31')](_0x248722[_0xca1c('0x2d')][_0xca1c('0x31')]));_0x55fb2a[_0xca1c('0x32')]=_0x55fb2a['attributes'][_0xca1c('0x42')]?_0x55fb2a['attributes']:_0x34609c[_0xca1c('0x30')];if(_0x248722['query'][_0xca1c('0x3b')]){_0x55fb2a[_0xca1c('0x3c')]=[{'all':!![]}];}_0x55fb2a=_['merge']({},_0x55fb2a,_0x248722['options']);return db[_0xca1c('0x28')][_0xca1c('0x43')](_0x55fb2a)[_0xca1c('0x21')](handleEntityNotFound(_0x3f81ae,null))[_0xca1c('0x21')](respondWithResult(_0x3f81ae,null))[_0xca1c('0x3f')](handleError(_0x3f81ae,null));};exports[_0xca1c('0x44')]=function(_0x26d107,_0x227a80){return db['SquareMessage'][_0xca1c('0x44')](_0x26d107[_0xca1c('0x45')],{})[_0xca1c('0x21')](respondWithResult(_0x227a80,0xc9))[_0xca1c('0x3f')](handleError(_0x227a80,null));};exports[_0xca1c('0x20')]=function(_0x166d45,_0x26c8cf){if(_0x166d45[_0xca1c('0x45')]['id']){delete _0x166d45[_0xca1c('0x45')]['id'];}return db[_0xca1c('0x28')][_0xca1c('0x43')]({'where':{'id':_0x166d45['params']['id']}})[_0xca1c('0x21')](handleEntityNotFound(_0x26c8cf,null))[_0xca1c('0x21')](saveUpdates(_0x166d45[_0xca1c('0x45')],null))['then'](respondWithResult(_0x26c8cf,null))['catch'](handleError(_0x26c8cf,null));};exports[_0xca1c('0x22')]=function(_0x43c0c1,_0x2b4eb4){return db['SquareMessage']['find']({'where':{'id':_0x43c0c1[_0xca1c('0x40')]['id']}})[_0xca1c('0x21')](handleEntityNotFound(_0x2b4eb4,null))['then'](removeEntity(_0x2b4eb4,null))[_0xca1c('0x3f')](handleError(_0x2b4eb4,null));}; \ No newline at end of file +var _0xc130=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2fe768,_0x144767){var _0x101337=function(_0x548f90){while(--_0x548f90){_0x2fe768['push'](_0x2fe768['shift']());}};_0x101337(++_0x144767);}(_0xc130,0x170));var _0x0c13=function(_0xf3e813,_0x374b3c){_0xf3e813=_0xf3e813-0x0;var _0x4825bc=_0xc130[_0xf3e813];return _0x4825bc;};'use strict';var emlformat=require(_0x0c13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c13('0x1'));var jsonpatch=require(_0x0c13('0x2'));var rp=require('request-promise');var moment=require(_0x0c13('0x3'));var BPromise=require(_0x0c13('0x4'));var Mustache=require(_0x0c13('0x5'));var util=require(_0x0c13('0x6'));var path=require(_0x0c13('0x7'));var sox=require(_0x0c13('0x8'));var csv=require(_0x0c13('0x9'));var ejs=require(_0x0c13('0xa'));var fs=require('fs');var fs_extra=require(_0x0c13('0xb'));var _=require(_0x0c13('0xc'));var squel=require('squel');var crypto=require(_0x0c13('0xd'));var jsforce=require(_0x0c13('0xe'));var deskjs=require(_0x0c13('0xf'));var toCsv=require(_0x0c13('0x9'));var querystring=require(_0x0c13('0x10'));var Papa=require('papaparse');var Redis=require(_0x0c13('0x11'));var authService=require(_0x0c13('0x12'));var qs=require(_0x0c13('0x13'));var as=require(_0x0c13('0x14'));var hardwareService=require(_0x0c13('0x15'));var logger=require(_0x0c13('0x16'))(_0x0c13('0x17'));var utils=require(_0x0c13('0x18'));var config=require(_0x0c13('0x19'));var licenseUtil=require(_0x0c13('0x1a'));var db=require(_0x0c13('0x1b'))['db'];function respondWithStatusCode(_0x6ede08,_0x2bd7a2){_0x2bd7a2=_0x2bd7a2||0xcc;return function(_0x3f298a){if(_0x3f298a){return _0x6ede08['sendStatus'](_0x2bd7a2);}return _0x6ede08[_0x0c13('0x1c')](_0x2bd7a2)[_0x0c13('0x1d')]();};}function respondWithResult(_0x112107,_0x3dbff4){_0x3dbff4=_0x3dbff4||0xc8;return function(_0x1e8bea){if(_0x1e8bea){return _0x112107[_0x0c13('0x1c')](_0x3dbff4)[_0x0c13('0x1e')](_0x1e8bea);}};}function respondWithFilteredResult(_0x4fa851,_0x2a8930){return function(_0x5bc799){if(_0x5bc799){var _0xfb9b01=typeof _0x2a8930[_0x0c13('0x1f')]===_0x0c13('0x20')&&typeof _0x2a8930['limit']===_0x0c13('0x20');var _0x12daec=_0x5bc799[_0x0c13('0x21')];var _0x245384=_0xfb9b01?0x0:_0x2a8930[_0x0c13('0x1f')];var _0x47fb0a=_0xfb9b01?_0x5bc799['count']:_0x2a8930[_0x0c13('0x1f')]+_0x2a8930[_0x0c13('0x22')];var _0x2edd0f;if(_0x47fb0a>=_0x12daec){_0x47fb0a=_0x12daec;_0x2edd0f=0xc8;}else{_0x2edd0f=0xce;}_0x4fa851[_0x0c13('0x1c')](_0x2edd0f);return _0x4fa851[_0x0c13('0x23')](_0x0c13('0x24'),_0x245384+'-'+_0x47fb0a+'/'+_0x12daec)['json'](_0x5bc799);}return null;};}function patchUpdates(_0x407cc0){return function(_0x55467d){try{jsonpatch[_0x0c13('0x25')](_0x55467d,_0x407cc0,!![]);}catch(_0xe1670c){return BPromise['reject'](_0xe1670c);}return _0x55467d[_0x0c13('0x26')]();};}function saveUpdates(_0x2be050,_0x213891){return function(_0x28a786){if(_0x28a786){return _0x28a786[_0x0c13('0x27')](_0x2be050)[_0x0c13('0x28')](function(_0x49078a){return _0x49078a;});}return null;};}function removeEntity(_0x15bc40,_0x56ede5){return function(_0x1c9ee1){if(_0x1c9ee1){return _0x1c9ee1[_0x0c13('0x29')]()[_0x0c13('0x28')](function(){_0x15bc40[_0x0c13('0x1c')](0xcc)[_0x0c13('0x1d')]();});}};}function handleEntityNotFound(_0x426026,_0x936e2d){return function(_0x1b2b4e){if(!_0x1b2b4e){_0x426026['sendStatus'](0x194);}return _0x1b2b4e;};}function handleError(_0x2fc0af,_0x516b57){_0x516b57=_0x516b57||0x1f4;return function(_0x43e169){logger['error'](_0x43e169['stack']);if(_0x43e169['name']){delete _0x43e169[_0x0c13('0x2a')];}_0x2fc0af[_0x0c13('0x1c')](_0x516b57)[_0x0c13('0x2b')](_0x43e169);};}exports[_0x0c13('0x2c')]=function(_0x38a965,_0x58c1a7){var _0x31a4c7={},_0x1476f4={},_0x5dac22={'count':0x0,'rows':[]};var _0x3dedb6=_['map'](db['SquareMessage']['rawAttributes'],function(_0x2dadd3){return{'name':_0x2dadd3['fieldName'],'type':_0x2dadd3[_0x0c13('0x2d')][_0x0c13('0x2e')]};});_0x1476f4[_0x0c13('0x2f')]=_[_0x0c13('0x30')](_0x3dedb6,_0x0c13('0x2a'));_0x1476f4[_0x0c13('0x31')]=_[_0x0c13('0x32')](_0x38a965['query']);_0x1476f4[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x1476f4[_0x0c13('0x2f')],_0x1476f4[_0x0c13('0x31')]);_0x31a4c7[_0x0c13('0x35')]=_[_0x0c13('0x34')](_0x1476f4[_0x0c13('0x2f')],qs[_0x0c13('0x36')](_0x38a965['query']['fields']));_0x31a4c7[_0x0c13('0x35')]=_0x31a4c7[_0x0c13('0x35')]['length']?_0x31a4c7[_0x0c13('0x35')]:_0x1476f4['model'];if(!_0x38a965['query']['hasOwnProperty'](_0x0c13('0x37'))){_0x31a4c7[_0x0c13('0x22')]=qs[_0x0c13('0x22')](_0x38a965['query'][_0x0c13('0x22')]);_0x31a4c7[_0x0c13('0x1f')]=qs[_0x0c13('0x1f')](_0x38a965[_0x0c13('0x31')][_0x0c13('0x1f')]);}_0x31a4c7[_0x0c13('0x38')]=qs[_0x0c13('0x39')](_0x38a965[_0x0c13('0x31')]['sort']);_0x31a4c7[_0x0c13('0x3a')]=qs[_0x0c13('0x33')](_[_0x0c13('0x3b')](_0x38a965[_0x0c13('0x31')],_0x1476f4[_0x0c13('0x33')]),_0x3dedb6);if(_0x38a965[_0x0c13('0x31')][_0x0c13('0x3c')]){_0x31a4c7[_0x0c13('0x3a')]=_[_0x0c13('0x3d')](_0x31a4c7[_0x0c13('0x3a')],{'$or':_[_0x0c13('0x30')](_0x3dedb6,function(_0x575b8b){if(_0x575b8b[_0x0c13('0x2d')]!==_0x0c13('0x3e')){var _0x139311={};_0x139311[_0x575b8b[_0x0c13('0x2a')]]={'$like':'%'+_0x38a965[_0x0c13('0x31')][_0x0c13('0x3c')]+'%'};return _0x139311;}})});}_0x31a4c7=_[_0x0c13('0x3d')]({},_0x31a4c7,_0x38a965[_0x0c13('0x3f')]);var _0x37fc98={'where':_0x31a4c7[_0x0c13('0x3a')]};return db[_0x0c13('0x40')][_0x0c13('0x21')](_0x37fc98)[_0x0c13('0x28')](function(_0x4ad7e5){_0x5dac22[_0x0c13('0x21')]=_0x4ad7e5;if(_0x38a965[_0x0c13('0x31')][_0x0c13('0x41')]){_0x31a4c7[_0x0c13('0x42')]=[{'all':!![]}];}return db[_0x0c13('0x40')][_0x0c13('0x43')](_0x31a4c7);})['then'](function(_0x2ab6fd){_0x5dac22[_0x0c13('0x44')]=_0x2ab6fd;return _0x5dac22;})[_0x0c13('0x28')](respondWithFilteredResult(_0x58c1a7,_0x31a4c7))['catch'](handleError(_0x58c1a7,null));};exports['show']=function(_0x425dbb,_0x2e036f){var _0x2999ee={'raw':!![],'where':{'id':_0x425dbb[_0x0c13('0x45')]['id']}},_0x2f51f6={};_0x2f51f6[_0x0c13('0x2f')]=_[_0x0c13('0x32')](db[_0x0c13('0x40')][_0x0c13('0x46')]);_0x2f51f6[_0x0c13('0x31')]=_[_0x0c13('0x32')](_0x425dbb[_0x0c13('0x31')]);_0x2f51f6[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x2f51f6[_0x0c13('0x2f')],_0x2f51f6[_0x0c13('0x31')]);_0x2999ee[_0x0c13('0x35')]=_['intersection'](_0x2f51f6[_0x0c13('0x2f')],qs[_0x0c13('0x36')](_0x425dbb['query'][_0x0c13('0x36')]));_0x2999ee['attributes']=_0x2999ee['attributes'][_0x0c13('0x47')]?_0x2999ee[_0x0c13('0x35')]:_0x2f51f6[_0x0c13('0x2f')];if(_0x425dbb[_0x0c13('0x31')]['includeAll']){_0x2999ee[_0x0c13('0x42')]=[{'all':!![]}];}_0x2999ee=_['merge']({},_0x2999ee,_0x425dbb[_0x0c13('0x3f')]);return db['SquareMessage'][_0x0c13('0x48')](_0x2999ee)[_0x0c13('0x28')](handleEntityNotFound(_0x2e036f,null))[_0x0c13('0x28')](respondWithResult(_0x2e036f,null))[_0x0c13('0x49')](handleError(_0x2e036f,null));};exports[_0x0c13('0x4a')]=function(_0x4aefbd,_0x2a6d89){return db[_0x0c13('0x40')][_0x0c13('0x4a')](_0x4aefbd[_0x0c13('0x4b')],{})[_0x0c13('0x28')](respondWithResult(_0x2a6d89,0xc9))[_0x0c13('0x49')](handleError(_0x2a6d89,null));};exports[_0x0c13('0x27')]=function(_0x24f2fb,_0x118b00){if(_0x24f2fb[_0x0c13('0x4b')]['id']){delete _0x24f2fb[_0x0c13('0x4b')]['id'];}return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x24f2fb[_0x0c13('0x45')]['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x118b00,null))[_0x0c13('0x28')](saveUpdates(_0x24f2fb[_0x0c13('0x4b')],null))[_0x0c13('0x28')](respondWithResult(_0x118b00,null))['catch'](handleError(_0x118b00,null));};exports[_0x0c13('0x29')]=function(_0x687dc8,_0x482c3a){return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x687dc8['params']['id']}})[_0x0c13('0x28')](handleEntityNotFound(_0x482c3a,null))[_0x0c13('0x28')](removeEntity(_0x482c3a,null))[_0x0c13('0x49')](handleError(_0x482c3a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 130d618..2183ecd 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 _0x990a=['./squareMessage.attributes','SquareMessage','square_messages','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x990a,0x111));var _0xa990=function(_0x4bd1ae,_0xbc16fa){_0x4bd1ae=_0x4bd1ae-0x0;var _0x252bde=_0x990a[_0x4bd1ae];return _0x252bde;};'use strict';var _=require(_0xa990('0x0'));var util=require(_0xa990('0x1'));var logger=require('../../config/logger')(_0xa990('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa990('0x3'));var fs=require('fs');var path=require(_0xa990('0x4'));var rimraf=require(_0xa990('0x5'));var config=require(_0xa990('0x6'));var attributes=require(_0xa990('0x7'));module['exports']=function(_0x3d3228,_0x50003e){return _0x3d3228['define'](_0xa990('0x8'),attributes,{'tableName':_0xa990('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3891=['square_messages','lodash','util','api','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x3f9649,_0x2a7fa2){var _0x33b6d4=function(_0x1636e9){while(--_0x1636e9){_0x3f9649['push'](_0x3f9649['shift']());}};_0x33b6d4(++_0x2a7fa2);}(_0x3891,0x109));var _0x1389=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x3891[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x1389('0x0'));var util=require(_0x1389('0x1'));var logger=require('../../config/logger')(_0x1389('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1389('0x3'));var fs=require('fs');var path=require(_0x1389('0x4'));var rimraf=require(_0x1389('0x5'));var config=require(_0x1389('0x6'));var attributes=require(_0x1389('0x7'));module[_0x1389('0x8')]=function(_0xc50944,_0x55e46e){return _0xc50944[_0x1389('0x9')]('SquareMessage',attributes,{'tableName':_0x1389('0xa'),'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 1c8d2f5..7f4b372 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 _0x79e0=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','body','options','raw'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x79e0,0x1b3));var _0x079e=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x79e0[_0x214a25];return _0x405988;};'use strict';var _=require(_0x079e('0x0'));var util=require(_0x079e('0x1'));var moment=require(_0x079e('0x2'));var BPromise=require(_0x079e('0x3'));var rs=require(_0x079e('0x4'));var fs=require('fs');var Redis=require(_0x079e('0x5'));var db=require(_0x079e('0x6'))['db'];var utils=require(_0x079e('0x7'));var logger=require(_0x079e('0x8'))(_0x079e('0x9'));var config=require(_0x079e('0xa'));var jayson=require(_0x079e('0xb'));var client=jayson[_0x079e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x291a5a,_0x6ee728,_0x5c3b59){return new BPromise(function(_0x23a6ba,_0x241a0d){return client['request'](_0x291a5a,_0x5c3b59)[_0x079e('0xd')](function(_0x2e6cee){logger['info'](_0x079e('0xe'),_0x6ee728,_0x079e('0xf'));logger[_0x079e('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x6ee728,_0x079e('0xf'),JSON[_0x079e('0x11')](_0x2e6cee));if(_0x2e6cee['error']){if(_0x2e6cee[_0x079e('0x12')][_0x079e('0x13')]===0x1f4){logger['error'](_0x079e('0xe'),_0x6ee728,_0x2e6cee['error'][_0x079e('0x14')]);return _0x241a0d(_0x2e6cee[_0x079e('0x12')]['message']);}logger['error'](_0x079e('0xe'),_0x6ee728,_0x2e6cee['error']['message']);return _0x23a6ba(_0x2e6cee[_0x079e('0x12')][_0x079e('0x14')]);}else{logger[_0x079e('0x15')](_0x079e('0xe'),_0x6ee728,'request\x20sent');_0x23a6ba(_0x2e6cee[_0x079e('0x16')]['message']);}})[_0x079e('0x17')](function(_0x1aa44d){logger[_0x079e('0x12')](_0x079e('0xe'),_0x6ee728,_0x1aa44d);_0x241a0d(_0x1aa44d);});});}exports[_0x079e('0x18')]=function(_0x1c8b52){var _0xf3c96a=this;return new Promise(function(_0x31d255,_0x37ab3b){return db[_0x079e('0x19')]['create'](_0x1c8b52[_0x079e('0x1a')],{'raw':_0x1c8b52[_0x079e('0x1b')]?_0x1c8b52['options'][_0x079e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5bf494){logger[_0x079e('0x15')](_0x079e('0x18'),_0x1c8b52);logger[_0x079e('0x10')]('CreateSquareMessage',_0x1c8b52,JSON[_0x079e('0x11')](_0x5bf494));_0x31d255(_0x5bf494);})[_0x079e('0x17')](function(_0xd6ca7f){logger['error']('CreateSquareMessage',_0xd6ca7f[_0x079e('0x14')],_0x1c8b52);_0x37ab3b(_0xf3c96a[_0x079e('0x12')](0x1f4,_0xd6ca7f[_0x079e('0x14')]));});});}; \ No newline at end of file +var _0x1f1a=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSquareMessage','SquareMessage','create','options','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x13216c,_0x6617d6){var _0xee8ab9=function(_0x25ff2){while(--_0x25ff2){_0x13216c['push'](_0x13216c['shift']());}};_0xee8ab9(++_0x6617d6);}(_0x1f1a,0x140));var _0xa1f1=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1f1a[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xa1f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa1f1('0x1'));var rs=require(_0xa1f1('0x2'));var fs=require('fs');var Redis=require(_0xa1f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1f1('0x4'))('rpc');var config=require(_0xa1f1('0x5'));var jayson=require(_0xa1f1('0x6'));var client=jayson[_0xa1f1('0x7')][_0xa1f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e7957,_0x43e0c8,_0x38e824){return new BPromise(function(_0x102dd5,_0x313ff6){return client['request'](_0x4e7957,_0x38e824)[_0xa1f1('0x9')](function(_0x410a73){logger[_0xa1f1('0xa')](_0xa1f1('0xb'),_0x43e0c8,_0xa1f1('0xc'));logger[_0xa1f1('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x43e0c8,'request\x20sent',JSON[_0xa1f1('0xe')](_0x410a73));if(_0x410a73[_0xa1f1('0xf')]){if(_0x410a73[_0xa1f1('0xf')]['code']===0x1f4){logger['error'](_0xa1f1('0xb'),_0x43e0c8,_0x410a73[_0xa1f1('0xf')]['message']);return _0x313ff6(_0x410a73[_0xa1f1('0xf')][_0xa1f1('0x10')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x43e0c8,_0x410a73[_0xa1f1('0xf')][_0xa1f1('0x10')]);return _0x102dd5(_0x410a73[_0xa1f1('0xf')][_0xa1f1('0x10')]);}else{logger['info'](_0xa1f1('0xb'),_0x43e0c8,_0xa1f1('0xc'));_0x102dd5(_0x410a73['result'][_0xa1f1('0x10')]);}})[_0xa1f1('0x11')](function(_0x157cb1){logger[_0xa1f1('0xf')](_0xa1f1('0xb'),_0x43e0c8,_0x157cb1);_0x313ff6(_0x157cb1);});});}exports[_0xa1f1('0x12')]=function(_0x136d59){var _0x33b2f0=this;return new Promise(function(_0x4d6c11,_0x1cd3e8){return db[_0xa1f1('0x13')][_0xa1f1('0x14')](_0x136d59['body'],{'raw':_0x136d59['options']?_0x136d59[_0xa1f1('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa1f1('0x9')](function(_0x11d8c1){logger[_0xa1f1('0xa')](_0xa1f1('0x12'),_0x136d59);logger[_0xa1f1('0xd')](_0xa1f1('0x12'),_0x136d59,JSON['stringify'](_0x11d8c1));_0x4d6c11(_0x11d8c1);})[_0xa1f1('0x11')](function(_0x174ebe){logger[_0xa1f1('0xf')](_0xa1f1('0x12'),_0x174ebe[_0xa1f1('0x10')],_0x136d59);_0x1cd3e8(_0x33b2f0[_0xa1f1('0xf')](0x1f4,_0x174ebe[_0xa1f1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d9be8cf..ed4bd5b 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 _0x6d94=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','put','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6d94,0x7b));var _0x46d9=function(_0x223221,_0x5b614a){_0x223221=_0x223221-0x0;var _0x5e9e7c=_0x6d94[_0x223221];return _0x5e9e7c;};'use strict';var multer=require(_0x46d9('0x0'));var util=require(_0x46d9('0x1'));var path=require(_0x46d9('0x2'));var timeout=require(_0x46d9('0x3'));var express=require(_0x46d9('0x4'));var router=express[_0x46d9('0x5')]();var fs_extra=require(_0x46d9('0x6'));var auth=require(_0x46d9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x46d9('0x8'));var controller=require(_0x46d9('0x9'));router[_0x46d9('0xa')]('/',auth[_0x46d9('0xb')](),controller[_0x46d9('0xc')]);router[_0x46d9('0xa')](_0x46d9('0xd'),auth[_0x46d9('0xb')](),controller[_0x46d9('0xe')]);router[_0x46d9('0xa')](_0x46d9('0xf'),auth[_0x46d9('0xb')](),timeout(_0x46d9('0x10')),controller[_0x46d9('0x11')]);router[_0x46d9('0x12')]('/',auth[_0x46d9('0xb')](),controller['create']);router[_0x46d9('0x13')](_0x46d9('0xd'),auth[_0x46d9('0xb')](),controller[_0x46d9('0x14')]);router[_0x46d9('0x15')](_0x46d9('0xd'),auth[_0x46d9('0xb')](),controller[_0x46d9('0x16')]);module[_0x46d9('0x17')]=router; \ No newline at end of file +var _0x56c8=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','test','post','create','put','/:id','destroy'];(function(_0x21c1ee,_0x547d6e){var _0x507f31=function(_0x373f28){while(--_0x373f28){_0x21c1ee['push'](_0x21c1ee['shift']());}};_0x507f31(++_0x547d6e);}(_0x56c8,0x1e6));var _0x856c=function(_0x5f434a,_0x5baad2){_0x5f434a=_0x5f434a-0x0;var _0x431215=_0x56c8[_0x5f434a];return _0x431215;};'use strict';var multer=require(_0x856c('0x0'));var util=require('util');var path=require(_0x856c('0x1'));var timeout=require(_0x856c('0x2'));var express=require('express');var router=express[_0x856c('0x3')]();var fs_extra=require(_0x856c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x856c('0x5'));var config=require(_0x856c('0x6'));var controller=require(_0x856c('0x7'));router[_0x856c('0x8')]('/',auth[_0x856c('0x9')](),controller['index']);router[_0x856c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x856c('0xa')]);router[_0x856c('0x8')](_0x856c('0xb'),auth[_0x856c('0x9')](),timeout('15s'),controller[_0x856c('0xc')]);router[_0x856c('0xd')]('/',auth['isAuthenticated'](),controller[_0x856c('0xe')]);router[_0x856c('0xf')](_0x856c('0x10'),auth[_0x856c('0x9')](),controller['update']);router['delete'](_0x856c('0x10'),auth[_0x856c('0x9')](),controller[_0x856c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d14e228..fdf955e 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 _0x9bfd=['STRING','sequelize','name'];(function(_0x242876,_0x40c095){var _0x2e2718=function(_0x335d22){while(--_0x335d22){_0x242876['push'](_0x242876['shift']());}};_0x2e2718(++_0x40c095);}(_0x9bfd,0x1db));var _0xd9bf=function(_0x3fa61a,_0x3a9ffc){_0x3fa61a=_0x3fa61a-0x0;var _0x130630=_0x9bfd[_0x3fa61a];return _0x130630;};'use strict';var Sequelize=require(_0xd9bf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd9bf('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd9bf('0x2')]},'description':{'type':Sequelize[_0xd9bf('0x2')]}}; \ No newline at end of file +var _0x18c9=['STRING','name','sequelize','exports'];(function(_0x59b535,_0x27f8b5){var _0x23a505=function(_0x43aadb){while(--_0x43aadb){_0x59b535['push'](_0x59b535['shift']());}};_0x23a505(++_0x27f8b5);}(_0x18c9,0x1ba));var _0x918c=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x18c9[_0x490be3];return _0x3f5140;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'name':{'type':Sequelize[_0x918c('0x2')],'unique':_0x918c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x918c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9248cdc..b8e8335 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 _0x7cf1=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','destroy','get','ODBC','UserProfileResource','then','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','create','body','user','find','userProfileId'];(function(_0x2e6b99,_0xf7f807){var _0x6a1926=function(_0x1e4271){while(--_0x1e4271){_0x2e6b99['push'](_0x2e6b99['shift']());}};_0x6a1926(++_0xf7f807);}(_0x7cf1,0x1a5));var _0x17cf=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x7cf1[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x17cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17cf('0x1'));var jsonpatch=require(_0x17cf('0x2'));var rp=require(_0x17cf('0x3'));var moment=require('moment');var BPromise=require(_0x17cf('0x4'));var Mustache=require(_0x17cf('0x5'));var util=require(_0x17cf('0x6'));var path=require(_0x17cf('0x7'));var sox=require('sox');var csv=require(_0x17cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17cf('0x9'));var _=require('lodash');var squel=require(_0x17cf('0xa'));var crypto=require('crypto');var jsforce=require(_0x17cf('0xb'));var deskjs=require(_0x17cf('0xc'));var toCsv=require(_0x17cf('0x8'));var querystring=require(_0x17cf('0xd'));var Papa=require('papaparse');var Redis=require(_0x17cf('0xe'));var authService=require(_0x17cf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x17cf('0x10'));var hardwareService=require(_0x17cf('0x11'));var logger=require(_0x17cf('0x12'))(_0x17cf('0x13'));var utils=require('../../config/utils');var config=require(_0x17cf('0x14'));var licenseUtil=require(_0x17cf('0x15'));var db=require(_0x17cf('0x16'))['db'];function respondWithStatusCode(_0x5b15c,_0x15805b){_0x15805b=_0x15805b||0xcc;return function(_0x3a4615){if(_0x3a4615){return _0x5b15c[_0x17cf('0x17')](_0x15805b);}return _0x5b15c[_0x17cf('0x18')](_0x15805b)[_0x17cf('0x19')]();};}function respondWithResult(_0x24e0fa,_0x352997){_0x352997=_0x352997||0xc8;return function(_0x4e95d4){if(_0x4e95d4){return _0x24e0fa[_0x17cf('0x18')](_0x352997)['json'](_0x4e95d4);}};}function respondWithFilteredResult(_0x246b31,_0x5194a6){return function(_0x47de8f){if(_0x47de8f){var _0x32380f=typeof _0x5194a6[_0x17cf('0x1a')]===_0x17cf('0x1b')&&typeof _0x5194a6[_0x17cf('0x1c')]===_0x17cf('0x1b');var _0x1f39fb=_0x47de8f['count'];var _0x576899=_0x32380f?0x0:_0x5194a6['offset'];var _0x154b3b=_0x32380f?_0x47de8f[_0x17cf('0x1d')]:_0x5194a6['offset']+_0x5194a6['limit'];var _0x5cf16b;if(_0x154b3b>=_0x1f39fb){_0x154b3b=_0x1f39fb;_0x5cf16b=0xc8;}else{_0x5cf16b=0xce;}_0x246b31[_0x17cf('0x18')](_0x5cf16b);return _0x246b31['set'](_0x17cf('0x1e'),_0x576899+'-'+_0x154b3b+'/'+_0x1f39fb)[_0x17cf('0x1f')](_0x47de8f);}return null;};}function patchUpdates(_0x1697eb){return function(_0x51350c){try{jsonpatch[_0x17cf('0x20')](_0x51350c,_0x1697eb,!![]);}catch(_0x545ffb){return BPromise['reject'](_0x545ffb);}return _0x51350c[_0x17cf('0x21')]();};}function saveUpdates(_0x1071e3,_0x1aef9b){return function(_0x5270d4){if(_0x5270d4){return _0x5270d4['update'](_0x1071e3)['then'](function(_0x2814e1){return _0x2814e1;});}return null;};}function removeEntity(_0x19f223,_0x905293){return function(_0x28a281){if(_0x28a281){return _0x28a281[_0x17cf('0x22')]()['then'](function(){var _0x90a9fe=_0x28a281[_0x17cf('0x23')]({'plain':!![]});var _0x16da43=_0x17cf('0x24');return db[_0x17cf('0x25')]['destroy']({'where':{'type':_0x16da43,'resourceId':_0x90a9fe['id']}})[_0x17cf('0x26')](function(){return _0x28a281;});})[_0x17cf('0x26')](function(){_0x19f223[_0x17cf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa485,_0x9e3ee6){return function(_0x425732){if(!_0x425732){_0x5aa485[_0x17cf('0x17')](0x194);}return _0x425732;};}function handleError(_0x2f7692,_0x335d5e){_0x335d5e=_0x335d5e||0x1f4;return function(_0x4a0284){logger[_0x17cf('0x27')](_0x4a0284['stack']);if(_0x4a0284['name']){delete _0x4a0284[_0x17cf('0x28')];}_0x2f7692[_0x17cf('0x18')](_0x335d5e)[_0x17cf('0x29')](_0x4a0284);};}exports[_0x17cf('0x2a')]=function(_0x2a6ae6,_0x31fbef){var _0x2d0a23={},_0x3c1ba3={},_0xb3a4d3={'count':0x0,'rows':[]};var _0x2f2830=_[_0x17cf('0x2b')](db[_0x17cf('0x2c')][_0x17cf('0x2d')],function(_0x439341){return{'name':_0x439341['fieldName'],'type':_0x439341[_0x17cf('0x2e')][_0x17cf('0x2f')]};});_0x3c1ba3['model']=_[_0x17cf('0x2b')](_0x2f2830,'name');_0x3c1ba3[_0x17cf('0x30')]=_['keys'](_0x2a6ae6[_0x17cf('0x30')]);_0x3c1ba3[_0x17cf('0x31')]=_[_0x17cf('0x32')](_0x3c1ba3['model'],_0x3c1ba3[_0x17cf('0x30')]);_0x2d0a23['attributes']=_[_0x17cf('0x32')](_0x3c1ba3[_0x17cf('0x33')],qs[_0x17cf('0x34')](_0x2a6ae6[_0x17cf('0x30')]['fields']));_0x2d0a23['attributes']=_0x2d0a23[_0x17cf('0x35')][_0x17cf('0x36')]?_0x2d0a23['attributes']:_0x3c1ba3[_0x17cf('0x33')];if(!_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x37')](_0x17cf('0x38'))){_0x2d0a23[_0x17cf('0x1c')]=qs[_0x17cf('0x1c')](_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x1c')]);_0x2d0a23[_0x17cf('0x1a')]=qs['offset'](_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x1a')]);}_0x2d0a23[_0x17cf('0x39')]=qs[_0x17cf('0x3a')](_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x3a')]);_0x2d0a23['where']=qs[_0x17cf('0x31')](_[_0x17cf('0x3b')](_0x2a6ae6[_0x17cf('0x30')],_0x3c1ba3['filters']),_0x2f2830);if(_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x3c')]){_0x2d0a23['where']=_[_0x17cf('0x3d')](_0x2d0a23[_0x17cf('0x3e')],{'$or':_[_0x17cf('0x2b')](_0x2f2830,function(_0x32b88b){if(_0x32b88b[_0x17cf('0x2e')]!==_0x17cf('0x3f')){var _0xc592c={};_0xc592c[_0x32b88b['name']]={'$like':'%'+_0x2a6ae6[_0x17cf('0x30')][_0x17cf('0x3c')]+'%'};return _0xc592c;}})});}_0x2d0a23=_[_0x17cf('0x3d')]({},_0x2d0a23,_0x2a6ae6[_0x17cf('0x40')]);var _0x536a3f={'where':_0x2d0a23['where']};return db[_0x17cf('0x2c')][_0x17cf('0x1d')](_0x536a3f)['then'](function(_0x319066){_0xb3a4d3['count']=_0x319066;if(_0x2a6ae6['query']['includeAll']){_0x2d0a23[_0x17cf('0x41')]=[{'all':!![]}];}return db[_0x17cf('0x2c')][_0x17cf('0x42')](_0x2d0a23);})[_0x17cf('0x26')](function(_0x59923c){_0xb3a4d3[_0x17cf('0x43')]=_0x59923c;return _0xb3a4d3;})[_0x17cf('0x26')](respondWithFilteredResult(_0x31fbef,_0x2d0a23))[_0x17cf('0x44')](handleError(_0x31fbef,null));};exports[_0x17cf('0x45')]=function(_0xb4dfd5,_0x3a5968){var _0x510ba7={'raw':!![],'where':{'id':_0xb4dfd5[_0x17cf('0x46')]['id']}},_0x2109d4={};_0x2109d4[_0x17cf('0x33')]=_[_0x17cf('0x47')](db[_0x17cf('0x2c')][_0x17cf('0x2d')]);_0x2109d4[_0x17cf('0x30')]=_['keys'](_0xb4dfd5[_0x17cf('0x30')]);_0x2109d4[_0x17cf('0x31')]=_[_0x17cf('0x32')](_0x2109d4[_0x17cf('0x33')],_0x2109d4['query']);_0x510ba7[_0x17cf('0x35')]=_[_0x17cf('0x32')](_0x2109d4['model'],qs[_0x17cf('0x34')](_0xb4dfd5[_0x17cf('0x30')][_0x17cf('0x34')]));_0x510ba7[_0x17cf('0x35')]=_0x510ba7['attributes'][_0x17cf('0x36')]?_0x510ba7[_0x17cf('0x35')]:_0x2109d4[_0x17cf('0x33')];if(_0xb4dfd5['query']['includeAll']){_0x510ba7['include']=[{'all':!![]}];}_0x510ba7=_[_0x17cf('0x3d')]({},_0x510ba7,_0xb4dfd5[_0x17cf('0x40')]);return db[_0x17cf('0x2c')]['find'](_0x510ba7)[_0x17cf('0x26')](handleEntityNotFound(_0x3a5968,null))[_0x17cf('0x26')](respondWithResult(_0x3a5968,null))[_0x17cf('0x44')](handleError(_0x3a5968,null));};exports[_0x17cf('0x48')]=function(_0x8581a8,_0x95c46f){return db[_0x17cf('0x2c')][_0x17cf('0x48')](_0x8581a8[_0x17cf('0x49')],{})[_0x17cf('0x26')](function(_0x5110c3){var _0x34f001=_0x8581a8[_0x17cf('0x4a')][_0x17cf('0x23')]({'plain':!![]});if(!_0x34f001)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34f001['role']==='user'){var _0x452747=_0x5110c3[_0x17cf('0x23')]({'plain':!![]});var _0x3c05c4=_0x17cf('0x24');return db['UserProfileSection'][_0x17cf('0x4b')]({'where':{'name':_0x3c05c4,'userProfileId':_0x34f001[_0x17cf('0x4c')]},'raw':!![]})['then'](function(_0x43fed0){if(_0x43fed0&&_0x43fed0[_0x17cf('0x4d')]===0x0){return db[_0x17cf('0x25')]['create']({'name':_0x452747[_0x17cf('0x28')],'resourceId':_0x452747['id'],'type':_0x43fed0[_0x17cf('0x28')],'sectionId':_0x43fed0['id']},{})['then'](function(){return _0x5110c3;});}else{return _0x5110c3;}})[_0x17cf('0x44')](function(_0x1b78ff){logger[_0x17cf('0x27')](_0x17cf('0x4e'),_0x1b78ff);throw _0x1b78ff;});}return _0x5110c3;})[_0x17cf('0x26')](respondWithResult(_0x95c46f,0xc9))['catch'](handleError(_0x95c46f,null));};exports[_0x17cf('0x4f')]=function(_0x294ad6,_0x341b97){if(_0x294ad6['body']['id']){delete _0x294ad6[_0x17cf('0x49')]['id'];}return db[_0x17cf('0x2c')][_0x17cf('0x4b')]({'where':{'id':_0x294ad6[_0x17cf('0x46')]['id']}})[_0x17cf('0x26')](handleEntityNotFound(_0x341b97,null))[_0x17cf('0x26')](saveUpdates(_0x294ad6[_0x17cf('0x49')],null))['then'](respondWithResult(_0x341b97,null))[_0x17cf('0x44')](handleError(_0x341b97,null));};exports[_0x17cf('0x22')]=function(_0x2535aa,_0x4e8fce){return db['SquareOdbc']['find']({'where':{'id':_0x2535aa['params']['id']}})[_0x17cf('0x26')](handleEntityNotFound(_0x4e8fce,null))[_0x17cf('0x26')](removeEntity(_0x4e8fce,null))[_0x17cf('0x44')](handleError(_0x4e8fce,null));};exports[_0x17cf('0x50')]=function(_0x43c1b9,_0x1e94ca,_0x624725){var _0x4f8458;return db['SquareOdbc'][_0x17cf('0x4b')]({'where':{'id':_0x43c1b9['params']['id']},'attributes':['id',_0x17cf('0x51')]})[_0x17cf('0x26')](handleEntityNotFound(_0x1e94ca,null))[_0x17cf('0x26')](function(_0x1f0550){if(_0x1f0550){var _0x27392f=require('odbc')();_0x27392f['openSync'](_0x1f0550[_0x17cf('0x51')]);_0x27392f[_0x17cf('0x52')]();return _0x1f0550;}})[_0x17cf('0x26')](respondWithResult(_0x1e94ca,null))[_0x17cf('0x44')](handleError(_0x1e94ca,null));}; \ No newline at end of file +var _0x3934=['SquareOdbc','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','ODBC','UserProfileResource','end','stack','name','send','index','map'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x3934,0x18c));var _0x4393=function(_0x55e659,_0x233aa4){_0x55e659=_0x55e659-0x0;var _0xca08c7=_0x3934[_0x55e659];return _0xca08c7;};'use strict';var emlformat=require(_0x4393('0x0'));var rimraf=require(_0x4393('0x1'));var zipdir=require(_0x4393('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4393('0x3'));var moment=require(_0x4393('0x4'));var BPromise=require(_0x4393('0x5'));var Mustache=require(_0x4393('0x6'));var util=require(_0x4393('0x7'));var path=require(_0x4393('0x8'));var sox=require('sox');var csv=require(_0x4393('0x9'));var ejs=require(_0x4393('0xa'));var fs=require('fs');var fs_extra=require(_0x4393('0xb'));var _=require(_0x4393('0xc'));var squel=require(_0x4393('0xd'));var crypto=require(_0x4393('0xe'));var jsforce=require(_0x4393('0xf'));var deskjs=require(_0x4393('0x10'));var toCsv=require(_0x4393('0x9'));var querystring=require(_0x4393('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4393('0x12'));var qs=require(_0x4393('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4393('0x14'));var logger=require(_0x4393('0x15'))(_0x4393('0x16'));var utils=require(_0x4393('0x17'));var config=require(_0x4393('0x18'));var licenseUtil=require(_0x4393('0x19'));var db=require(_0x4393('0x1a'))['db'];function respondWithStatusCode(_0x4c99ce,_0x53cc5e){_0x53cc5e=_0x53cc5e||0xcc;return function(_0x19f225){if(_0x19f225){return _0x4c99ce[_0x4393('0x1b')](_0x53cc5e);}return _0x4c99ce[_0x4393('0x1c')](_0x53cc5e)['end']();};}function respondWithResult(_0xc9e6cc,_0x363500){_0x363500=_0x363500||0xc8;return function(_0x54732f){if(_0x54732f){return _0xc9e6cc[_0x4393('0x1c')](_0x363500)[_0x4393('0x1d')](_0x54732f);}};}function respondWithFilteredResult(_0x2df36a,_0x3275a0){return function(_0x147098){if(_0x147098){var _0x400839=typeof _0x3275a0[_0x4393('0x1e')]==='undefined'&&typeof _0x3275a0[_0x4393('0x1f')]===_0x4393('0x20');var _0x3521a4=_0x147098[_0x4393('0x21')];var _0x5eb836=_0x400839?0x0:_0x3275a0['offset'];var _0x4ed59a=_0x400839?_0x147098[_0x4393('0x21')]:_0x3275a0[_0x4393('0x1e')]+_0x3275a0[_0x4393('0x1f')];var _0x2a7e80;if(_0x4ed59a>=_0x3521a4){_0x4ed59a=_0x3521a4;_0x2a7e80=0xc8;}else{_0x2a7e80=0xce;}_0x2df36a[_0x4393('0x1c')](_0x2a7e80);return _0x2df36a[_0x4393('0x22')](_0x4393('0x23'),_0x5eb836+'-'+_0x4ed59a+'/'+_0x3521a4)[_0x4393('0x1d')](_0x147098);}return null;};}function patchUpdates(_0x4cad02){return function(_0x24b057){try{jsonpatch[_0x4393('0x24')](_0x24b057,_0x4cad02,!![]);}catch(_0x22ec31){return BPromise['reject'](_0x22ec31);}return _0x24b057[_0x4393('0x25')]();};}function saveUpdates(_0x18a727,_0x37c7d8){return function(_0x232e18){if(_0x232e18){return _0x232e18['update'](_0x18a727)[_0x4393('0x26')](function(_0x6aa51f){return _0x6aa51f;});}return null;};}function removeEntity(_0x34985a,_0x582694){return function(_0x1d53da){if(_0x1d53da){return _0x1d53da[_0x4393('0x27')]()[_0x4393('0x26')](function(){var _0x2c28b4=_0x1d53da[_0x4393('0x28')]({'plain':!![]});var _0x595aac=_0x4393('0x29');return db[_0x4393('0x2a')]['destroy']({'where':{'type':_0x595aac,'resourceId':_0x2c28b4['id']}})[_0x4393('0x26')](function(){return _0x1d53da;});})['then'](function(){_0x34985a['status'](0xcc)[_0x4393('0x2b')]();});}};}function handleEntityNotFound(_0x265915,_0x92dab1){return function(_0x4b529d){if(!_0x4b529d){_0x265915[_0x4393('0x1b')](0x194);}return _0x4b529d;};}function handleError(_0x36e300,_0x64e291){_0x64e291=_0x64e291||0x1f4;return function(_0x45b32d){logger['error'](_0x45b32d[_0x4393('0x2c')]);if(_0x45b32d[_0x4393('0x2d')]){delete _0x45b32d['name'];}_0x36e300[_0x4393('0x1c')](_0x64e291)[_0x4393('0x2e')](_0x45b32d);};}exports[_0x4393('0x2f')]=function(_0x1c5af7,_0x10f9c5){var _0xeb80c3={},_0x1433b2={},_0x5e701d={'count':0x0,'rows':[]};var _0x30b52d=_[_0x4393('0x30')](db[_0x4393('0x31')][_0x4393('0x32')],function(_0x1d2f7f){return{'name':_0x1d2f7f[_0x4393('0x33')],'type':_0x1d2f7f[_0x4393('0x34')][_0x4393('0x35')]};});_0x1433b2['model']=_[_0x4393('0x30')](_0x30b52d,_0x4393('0x2d'));_0x1433b2[_0x4393('0x36')]=_['keys'](_0x1c5af7[_0x4393('0x36')]);_0x1433b2[_0x4393('0x37')]=_['intersection'](_0x1433b2[_0x4393('0x38')],_0x1433b2['query']);_0xeb80c3[_0x4393('0x39')]=_[_0x4393('0x3a')](_0x1433b2[_0x4393('0x38')],qs[_0x4393('0x3b')](_0x1c5af7[_0x4393('0x36')]['fields']));_0xeb80c3[_0x4393('0x39')]=_0xeb80c3[_0x4393('0x39')][_0x4393('0x3c')]?_0xeb80c3[_0x4393('0x39')]:_0x1433b2[_0x4393('0x38')];if(!_0x1c5af7['query']['hasOwnProperty'](_0x4393('0x3d'))){_0xeb80c3[_0x4393('0x1f')]=qs['limit'](_0x1c5af7[_0x4393('0x36')]['limit']);_0xeb80c3['offset']=qs[_0x4393('0x1e')](_0x1c5af7[_0x4393('0x36')]['offset']);}_0xeb80c3['order']=qs[_0x4393('0x3e')](_0x1c5af7[_0x4393('0x36')]['sort']);_0xeb80c3[_0x4393('0x3f')]=qs[_0x4393('0x37')](_[_0x4393('0x40')](_0x1c5af7[_0x4393('0x36')],_0x1433b2[_0x4393('0x37')]),_0x30b52d);if(_0x1c5af7[_0x4393('0x36')]['filter']){_0xeb80c3[_0x4393('0x3f')]=_['merge'](_0xeb80c3[_0x4393('0x3f')],{'$or':_[_0x4393('0x30')](_0x30b52d,function(_0x18e5a9){if(_0x18e5a9['type']!==_0x4393('0x41')){var _0x542723={};_0x542723[_0x18e5a9[_0x4393('0x2d')]]={'$like':'%'+_0x1c5af7['query'][_0x4393('0x42')]+'%'};return _0x542723;}})});}_0xeb80c3=_['merge']({},_0xeb80c3,_0x1c5af7[_0x4393('0x43')]);var _0x344826={'where':_0xeb80c3[_0x4393('0x3f')]};return db[_0x4393('0x31')][_0x4393('0x21')](_0x344826)[_0x4393('0x26')](function(_0x1d5de0){_0x5e701d[_0x4393('0x21')]=_0x1d5de0;if(_0x1c5af7[_0x4393('0x36')][_0x4393('0x44')]){_0xeb80c3[_0x4393('0x45')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0xeb80c3);})[_0x4393('0x26')](function(_0x1acfaf){_0x5e701d[_0x4393('0x46')]=_0x1acfaf;return _0x5e701d;})[_0x4393('0x26')](respondWithFilteredResult(_0x10f9c5,_0xeb80c3))[_0x4393('0x47')](handleError(_0x10f9c5,null));};exports[_0x4393('0x48')]=function(_0x2b3696,_0x5b9b5e){var _0x4fa397={'raw':!![],'where':{'id':_0x2b3696[_0x4393('0x49')]['id']}},_0x29ce5d={};_0x29ce5d[_0x4393('0x38')]=_['keys'](db[_0x4393('0x31')][_0x4393('0x32')]);_0x29ce5d[_0x4393('0x36')]=_[_0x4393('0x4a')](_0x2b3696[_0x4393('0x36')]);_0x29ce5d['filters']=_[_0x4393('0x3a')](_0x29ce5d['model'],_0x29ce5d[_0x4393('0x36')]);_0x4fa397[_0x4393('0x39')]=_['intersection'](_0x29ce5d['model'],qs[_0x4393('0x3b')](_0x2b3696[_0x4393('0x36')][_0x4393('0x3b')]));_0x4fa397[_0x4393('0x39')]=_0x4fa397[_0x4393('0x39')][_0x4393('0x3c')]?_0x4fa397[_0x4393('0x39')]:_0x29ce5d[_0x4393('0x38')];if(_0x2b3696['query'][_0x4393('0x44')]){_0x4fa397[_0x4393('0x45')]=[{'all':!![]}];}_0x4fa397=_[_0x4393('0x4b')]({},_0x4fa397,_0x2b3696['options']);return db['SquareOdbc'][_0x4393('0x4c')](_0x4fa397)[_0x4393('0x26')](handleEntityNotFound(_0x5b9b5e,null))[_0x4393('0x26')](respondWithResult(_0x5b9b5e,null))[_0x4393('0x47')](handleError(_0x5b9b5e,null));};exports[_0x4393('0x4d')]=function(_0x397582,_0x327da9){return db[_0x4393('0x31')][_0x4393('0x4d')](_0x397582[_0x4393('0x4e')],{})['then'](function(_0x5946f0){var _0x2cd1a4=_0x397582['user'][_0x4393('0x28')]({'plain':!![]});if(!_0x2cd1a4)throw new Error(_0x4393('0x4f'));if(_0x2cd1a4[_0x4393('0x50')]===_0x4393('0x51')){var _0x1f54ee=_0x5946f0[_0x4393('0x28')]({'plain':!![]});var _0x50007b=_0x4393('0x29');return db[_0x4393('0x52')][_0x4393('0x4c')]({'where':{'name':_0x50007b,'userProfileId':_0x2cd1a4['userProfileId']},'raw':!![]})[_0x4393('0x26')](function(_0x2b41cf){if(_0x2b41cf&&_0x2b41cf[_0x4393('0x53')]===0x0){return db[_0x4393('0x2a')][_0x4393('0x4d')]({'name':_0x1f54ee[_0x4393('0x2d')],'resourceId':_0x1f54ee['id'],'type':_0x2b41cf[_0x4393('0x2d')],'sectionId':_0x2b41cf['id']},{})[_0x4393('0x26')](function(){return _0x5946f0;});}else{return _0x5946f0;}})[_0x4393('0x47')](function(_0x3c8e64){logger['error'](_0x4393('0x54'),_0x3c8e64);throw _0x3c8e64;});}return _0x5946f0;})[_0x4393('0x26')](respondWithResult(_0x327da9,0xc9))['catch'](handleError(_0x327da9,null));};exports[_0x4393('0x55')]=function(_0x1e38d2,_0x309083){if(_0x1e38d2[_0x4393('0x4e')]['id']){delete _0x1e38d2[_0x4393('0x4e')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x1e38d2[_0x4393('0x49')]['id']}})['then'](handleEntityNotFound(_0x309083,null))['then'](saveUpdates(_0x1e38d2[_0x4393('0x4e')],null))[_0x4393('0x26')](respondWithResult(_0x309083,null))[_0x4393('0x47')](handleError(_0x309083,null));};exports[_0x4393('0x27')]=function(_0x3a614a,_0x584eda){return db[_0x4393('0x31')][_0x4393('0x4c')]({'where':{'id':_0x3a614a['params']['id']}})[_0x4393('0x26')](handleEntityNotFound(_0x584eda,null))[_0x4393('0x26')](removeEntity(_0x584eda,null))[_0x4393('0x47')](handleError(_0x584eda,null));};exports['test']=function(_0xacb871,_0x28fb97,_0x5f6e5a){var _0x447015;return db[_0x4393('0x31')]['find']({'where':{'id':_0xacb871['params']['id']},'attributes':['id',_0x4393('0x56')]})[_0x4393('0x26')](handleEntityNotFound(_0x28fb97,null))[_0x4393('0x26')](function(_0x31cc71){if(_0x31cc71){var _0x4d7808=require(_0x4393('0x57'))();_0x4d7808['openSync'](_0x31cc71[_0x4393('0x56')]);_0x4d7808[_0x4393('0x58')]();return _0x31cc71;}})[_0x4393('0x26')](respondWithResult(_0x28fb97,null))[_0x4393('0x47')](handleError(_0x28fb97,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d388002..0a3d1fb 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 _0x11a8=['SquareOdbc','square_odbc','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x11a8,0x1e2));var _0x811a=function(_0x332e65,_0x368a12){_0x332e65=_0x332e65-0x0;var _0x1b19dc=_0x11a8[_0x332e65];return _0x1b19dc;};'use strict';var _=require(_0x811a('0x0'));var util=require('util');var logger=require(_0x811a('0x1'))('api');var moment=require(_0x811a('0x2'));var BPromise=require('bluebird');var rp=require(_0x811a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x811a('0x4'));var config=require(_0x811a('0x5'));var attributes=require(_0x811a('0x6'));module[_0x811a('0x7')]=function(_0x254c4c,_0x81f3f2){return _0x254c4c['define'](_0x811a('0x8'),attributes,{'tableName':_0x811a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8289=['define','SquareOdbc','square_odbc','lodash','../../config/logger','moment','bluebird','path','rimraf','./squareOdbc.attributes','exports'];(function(_0x4cc828,_0x53403e){var _0x233e7e=function(_0x34589d){while(--_0x34589d){_0x4cc828['push'](_0x4cc828['shift']());}};_0x233e7e(++_0x53403e);}(_0x8289,0x1bb));var _0x9828=function(_0x630c98,_0x515c64){_0x630c98=_0x630c98-0x0;var _0x8ce66f=_0x8289[_0x630c98];return _0x8ce66f;};'use strict';var _=require(_0x9828('0x0'));var util=require('util');var logger=require(_0x9828('0x1'))('api');var moment=require(_0x9828('0x2'));var BPromise=require(_0x9828('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9828('0x4'));var rimraf=require(_0x9828('0x5'));var config=require('../../config/environment');var attributes=require(_0x9828('0x6'));module[_0x9828('0x7')]=function(_0x6b71cb,_0x53b41c){return _0x6b71cb[_0x9828('0x8')](_0x9828('0x9'),attributes,{'tableName':_0x9828('0xa'),'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 9b910e7..e8bff38 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 _0x923e=['message','result','catch','ShowSquareOdbc','options','raw','where','attributes','map','include','model','then','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x308a4e,_0x5b6c19){var _0x7e11c4=function(_0x4bd716){while(--_0x4bd716){_0x308a4e['push'](_0x308a4e['shift']());}};_0x7e11c4(++_0x5b6c19);}(_0x923e,0xa8));var _0xe923=function(_0x367d25,_0x11e20c){_0x367d25=_0x367d25-0x0;var _0x486919=_0x923e[_0x367d25];return _0x486919;};'use strict';var _=require('lodash');var util=require(_0xe923('0x0'));var moment=require(_0xe923('0x1'));var BPromise=require(_0xe923('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe923('0x3'))['db'];var utils=require(_0xe923('0x4'));var logger=require(_0xe923('0x5'))(_0xe923('0x6'));var config=require(_0xe923('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe923('0x8')][_0xe923('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa42c11,_0x2cfb2a,_0x2f8804){return new BPromise(function(_0x3361e6,_0x534ca1){return client[_0xe923('0xa')](_0xa42c11,_0x2f8804)['then'](function(_0x5c9686){logger['info'](_0xe923('0xb'),_0x2cfb2a,_0xe923('0xc'));logger[_0xe923('0xd')](_0xe923('0xe'),_0x2cfb2a,'request\x20sent',JSON[_0xe923('0xf')](_0x5c9686));if(_0x5c9686['error']){if(_0x5c9686[_0xe923('0x10')][_0xe923('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x2cfb2a,_0x5c9686[_0xe923('0x10')][_0xe923('0x12')]);return _0x534ca1(_0x5c9686[_0xe923('0x10')][_0xe923('0x12')]);}logger[_0xe923('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x2cfb2a,_0x5c9686[_0xe923('0x10')]['message']);return _0x3361e6(_0x5c9686[_0xe923('0x10')][_0xe923('0x12')]);}else{logger['info'](_0xe923('0xb'),_0x2cfb2a,'request\x20sent');_0x3361e6(_0x5c9686[_0xe923('0x13')]['message']);}})[_0xe923('0x14')](function(_0x3c68df){logger[_0xe923('0x10')](_0xe923('0xb'),_0x2cfb2a,_0x3c68df);_0x534ca1(_0x3c68df);});});}exports[_0xe923('0x15')]=function(_0x49c650){var _0x27cea1=this;return new Promise(function(_0x535ccc,_0x457823){return db['SquareOdbc']['find']({'raw':_0x49c650[_0xe923('0x16')]?_0x49c650[_0xe923('0x16')][_0xe923('0x17')]===undefined?!![]:![]:!![],'where':_0x49c650[_0xe923('0x16')]?_0x49c650[_0xe923('0x16')][_0xe923('0x18')]||null:null,'attributes':_0x49c650[_0xe923('0x16')]?_0x49c650[_0xe923('0x16')][_0xe923('0x19')]||null:null,'include':_0x49c650['options']?_0x49c650[_0xe923('0x16')]['include']?_[_0xe923('0x1a')](_0x49c650[_0xe923('0x16')][_0xe923('0x1b')],function(_0x4468a1){return{'model':db[_0x4468a1[_0xe923('0x1c')]],'as':_0x4468a1['as'],'attributes':_0x4468a1[_0xe923('0x19')],'include':_0x4468a1[_0xe923('0x1b')]?_[_0xe923('0x1a')](_0x4468a1[_0xe923('0x1b')],function(_0x7ea92c){return{'model':db[_0x7ea92c[_0xe923('0x1c')]],'as':_0x7ea92c['as'],'attributes':_0x7ea92c[_0xe923('0x19')],'include':_0x7ea92c[_0xe923('0x1b')]?_[_0xe923('0x1a')](_0x7ea92c[_0xe923('0x1b')],function(_0x43a4d7){return{'model':db[_0x43a4d7[_0xe923('0x1c')]],'as':_0x43a4d7['as'],'attributes':_0x43a4d7[_0xe923('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe923('0x1d')](function(_0x1a6566){logger[_0xe923('0x1e')](_0xe923('0x15'),_0x49c650);logger[_0xe923('0xd')](_0xe923('0x15'),_0x49c650,JSON['stringify'](_0x1a6566));_0x535ccc(_0x1a6566);})[_0xe923('0x14')](function(_0x52628f){logger[_0xe923('0x10')](_0xe923('0x15'),_0x52628f['message'],_0x49c650);_0x457823(_0x27cea1[_0xe923('0x10')](0x1f4,_0x52628f[_0xe923('0x12')]));});});}; \ No newline at end of file +var _0xa96d=['stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','request\x20sent','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','lodash','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa96d,0x17c));var _0xda96=function(_0x241207,_0x39a50c){_0x241207=_0x241207-0x0;var _0x26f4ce=_0xa96d[_0x241207];return _0x26f4ce;};'use strict';var _=require(_0xda96('0x0'));var util=require('util');var moment=require(_0xda96('0x1'));var BPromise=require('bluebird');var rs=require(_0xda96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda96('0x3'));var logger=require('../../config/logger')(_0xda96('0x4'));var config=require('../../config/environment');var jayson=require(_0xda96('0x5'));var client=jayson[_0xda96('0x6')][_0xda96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e2de9,_0x38178d,_0x23814f){return new BPromise(function(_0x312d01,_0x17885c){return client[_0xda96('0x8')](_0x1e2de9,_0x23814f)[_0xda96('0x9')](function(_0x2e23c2){logger[_0xda96('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x38178d,'request\x20sent');logger['debug'](_0xda96('0xb'),_0x38178d,'request\x20sent',JSON[_0xda96('0xc')](_0x2e23c2));if(_0x2e23c2[_0xda96('0xd')]){if(_0x2e23c2[_0xda96('0xd')][_0xda96('0xe')]===0x1f4){logger['error'](_0xda96('0xf'),_0x38178d,_0x2e23c2['error'][_0xda96('0x10')]);return _0x17885c(_0x2e23c2[_0xda96('0xd')]['message']);}logger[_0xda96('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x38178d,_0x2e23c2[_0xda96('0xd')][_0xda96('0x10')]);return _0x312d01(_0x2e23c2[_0xda96('0xd')][_0xda96('0x10')]);}else{logger[_0xda96('0xa')](_0xda96('0xf'),_0x38178d,_0xda96('0x11'));_0x312d01(_0x2e23c2['result'][_0xda96('0x10')]);}})['catch'](function(_0x89eefc){logger['error'](_0xda96('0xf'),_0x38178d,_0x89eefc);_0x17885c(_0x89eefc);});});}exports[_0xda96('0x12')]=function(_0x3de6aa){var _0x2bc6db=this;return new Promise(function(_0x499930,_0x33daed){return db[_0xda96('0x13')][_0xda96('0x14')]({'raw':_0x3de6aa['options']?_0x3de6aa[_0xda96('0x15')][_0xda96('0x16')]===undefined?!![]:![]:!![],'where':_0x3de6aa[_0xda96('0x15')]?_0x3de6aa[_0xda96('0x15')][_0xda96('0x17')]||null:null,'attributes':_0x3de6aa['options']?_0x3de6aa[_0xda96('0x15')][_0xda96('0x18')]||null:null,'include':_0x3de6aa[_0xda96('0x15')]?_0x3de6aa[_0xda96('0x15')]['include']?_[_0xda96('0x19')](_0x3de6aa[_0xda96('0x15')][_0xda96('0x1a')],function(_0x2b4032){return{'model':db[_0x2b4032['model']],'as':_0x2b4032['as'],'attributes':_0x2b4032['attributes'],'include':_0x2b4032['include']?_[_0xda96('0x19')](_0x2b4032[_0xda96('0x1a')],function(_0x4ebac2){return{'model':db[_0x4ebac2[_0xda96('0x1b')]],'as':_0x4ebac2['as'],'attributes':_0x4ebac2[_0xda96('0x18')],'include':_0x4ebac2[_0xda96('0x1a')]?_[_0xda96('0x19')](_0x4ebac2[_0xda96('0x1a')],function(_0xf225f){return{'model':db[_0xf225f[_0xda96('0x1b')]],'as':_0xf225f['as'],'attributes':_0xf225f['attributes']};}):[]};}):[]};}):[]:[]})[_0xda96('0x9')](function(_0x50d3eb){logger[_0xda96('0xa')](_0xda96('0x12'),_0x3de6aa);logger['debug'](_0xda96('0x12'),_0x3de6aa,JSON[_0xda96('0xc')](_0x50d3eb));_0x499930(_0x50d3eb);})['catch'](function(_0x41b456){logger['error'](_0xda96('0x12'),_0x41b456[_0xda96('0x10')],_0x3de6aa);_0x33daed(_0x2bc6db['error'](0x1f4,_0x41b456[_0xda96('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9c72fde..05670d4 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 _0xd4a2=['/:id','show','/:id/users','getUsers','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd4a2,0x173));var _0x2d4a=function(_0x13e6f7,_0x2cadf7){_0x13e6f7=_0x13e6f7-0x0;var _0x280cd0=_0xd4a2[_0x13e6f7];return _0x280cd0;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xd')](_0x2d4a('0xb'),auth['isAuthenticated'](),controller['addUsers']);router[_0x2d4a('0xf')]('/:id',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x10')]);router[_0x2d4a('0x11')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x12')]);router[_0x2d4a('0x11')](_0x2d4a('0xb'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x2d4a('0x13')]=router; \ No newline at end of file +var _0x8893=['show','/:id/users','getUsers','post','create','addUsers','put','delete','/:id','destroy','removeUsers','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x8893,0x1ae));var _0x3889=function(_0x3241a3,_0x3b91ab){_0x3241a3=_0x3241a3-0x0;var _0x230e35=_0x8893[_0x3241a3];return _0x230e35;};'use strict';var multer=require('multer');var util=require(_0x3889('0x0'));var path=require(_0x3889('0x1'));var timeout=require(_0x3889('0x2'));var express=require('express');var router=express[_0x3889('0x3')]();var fs_extra=require(_0x3889('0x4'));var auth=require(_0x3889('0x5'));var interaction=require(_0x3889('0x6'));var config=require('../../config/environment');var controller=require(_0x3889('0x7'));router[_0x3889('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3889('0x8')]('/:id',auth[_0x3889('0x9')](),controller[_0x3889('0xa')]);router[_0x3889('0x8')](_0x3889('0xb'),auth['isAuthenticated'](),controller[_0x3889('0xc')]);router[_0x3889('0xd')]('/',auth['isAuthenticated'](),controller[_0x3889('0xe')]);router['post'](_0x3889('0xb'),auth[_0x3889('0x9')](),controller[_0x3889('0xf')]);router[_0x3889('0x10')]('/:id',auth[_0x3889('0x9')](),controller['update']);router[_0x3889('0x11')](_0x3889('0x12'),auth[_0x3889('0x9')](),controller[_0x3889('0x13')]);router['delete'](_0x3889('0xb'),auth[_0x3889('0x9')](),controller[_0x3889('0x14')]);module[_0x3889('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0b78b58..124fadd 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 _0x5943=['long','getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x5943,0x1f2));var _0x3594=function(_0x2c36f3,_0x200f12){_0x2c36f3=_0x2c36f3-0x0;var _0x5c6451=_0x5943[_0x2c36f3];return _0x5c6451;};'use strict';var Sequelize=require(_0x3594('0x0'));module[_0x3594('0x1')]={'name':{'type':Sequelize[_0x3594('0x2')],'unique':_0x3594('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3594('0x2')]},'notes':{'type':Sequelize[_0x3594('0x4')]},'preproduction':{'type':Sequelize[_0x3594('0x5')](_0x3594('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x3594('0x7')]('preproduction')[_0x3594('0x8')](_0x3594('0x9'));}}},'production':{'type':Sequelize[_0x3594('0x5')](_0x3594('0x6')),'get':function(){if(this[_0x3594('0x7')](_0x3594('0xa'))){return this[_0x3594('0x7')]('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x3594('0xb')]},'publishedAt':{'type':Sequelize[_0x3594('0xb')]}}; \ No newline at end of file +var _0x27a0=['STRING','name','TEXT','getDataValue','preproduction','toString','utf8','BLOB','long','production','DATE','exports'];(function(_0x2979ce,_0x4b8d29){var _0x1a38ec=function(_0x549e80){while(--_0x549e80){_0x2979ce['push'](_0x2979ce['shift']());}};_0x1a38ec(++_0x4b8d29);}(_0x27a0,0xbf));var _0x027a=function(_0x19eed7,_0x13ed26){_0x19eed7=_0x19eed7-0x0;var _0x17be03=_0x27a0[_0x19eed7];return _0x17be03;};'use strict';var Sequelize=require('sequelize');module[_0x027a('0x0')]={'name':{'type':Sequelize[_0x027a('0x1')],'unique':_0x027a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x027a('0x1')]},'notes':{'type':Sequelize[_0x027a('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x027a('0x4')](_0x027a('0x5'))[_0x027a('0x6')](_0x027a('0x7'));}}},'production':{'type':Sequelize[_0x027a('0x8')](_0x027a('0x9')),'get':function(){if(this['getDataValue'](_0x027a('0xa'))){return this[_0x027a('0x4')](_0x027a('0xa'))['toString'](_0x027a('0x7'));}}},'savedAt':{'type':Sequelize[_0x027a('0xb')]},'publishedAt':{'type':Sequelize[_0x027a('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e6889a1..c1b5743 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 _0xcb9d=['limit','count','Content-Range','update','destroy','then','get','SquareProjects','stringify','error','stack','name','net','Socket','connect','agi','127.0.0.1','index','map','SquareProject','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','filter','merge','includeAll','include','findAll','rows','params','rawAttributes','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','spread','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','keys','User','getUsers','lodash','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined'];(function(_0x48100b,_0x22674a){var _0x35dd0b=function(_0x1e1f2c){while(--_0x1e1f2c){_0x48100b['push'](_0x48100b['shift']());}};_0x35dd0b(++_0x22674a);}(_0xcb9d,0x13c));var _0xdcb9=function(_0x5d579a,_0x6918c7){_0x5d579a=_0x5d579a-0x0;var _0x2d0610=_0xcb9d[_0x5d579a];return _0x2d0610;};'use strict';var _=require(_0xdcb9('0x0'));var Redis=require(_0xdcb9('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xdcb9('0x2'))('api');var config=require('../../config/environment');var db=require(_0xdcb9('0x3'))['db'];config[_0xdcb9('0x4')]=_[_0xdcb9('0x5')](config['redis'],{'host':_0xdcb9('0x6'),'port':0x18eb});var socket=require(_0xdcb9('0x7'))(new Redis(config[_0xdcb9('0x4')]));require(_0xdcb9('0x8'))[_0xdcb9('0x9')](socket);function respondWithStatusCode(_0x5acca7,_0x406a5e){_0x406a5e=_0x406a5e||0xcc;return function(_0x5792fb){if(_0x5792fb){return _0x5acca7[_0xdcb9('0xa')](_0x406a5e);}return _0x5acca7['status'](_0x406a5e)[_0xdcb9('0xb')]();};}function respondWithResult(_0xcab6ac,_0x35aa40){_0x35aa40=_0x35aa40||0xc8;return function(_0x4b9a87){if(_0x4b9a87){return _0xcab6ac[_0xdcb9('0xc')](_0x35aa40)[_0xdcb9('0xd')](_0x4b9a87);}};}function respondWithFilteredResult(_0x1199e2,_0x375dab){return function(_0x1f2908){if(_0x1f2908){var _0x34ba03=typeof _0x375dab[_0xdcb9('0xe')]===_0xdcb9('0xf')&&typeof _0x375dab[_0xdcb9('0x10')]===_0xdcb9('0xf');var _0x564ec5=_0x1f2908[_0xdcb9('0x11')];var _0x47e9a4=_0x34ba03?0x0:_0x375dab[_0xdcb9('0xe')];var _0x131b7d=_0x34ba03?_0x1f2908[_0xdcb9('0x11')]:_0x375dab[_0xdcb9('0xe')]+_0x375dab[_0xdcb9('0x10')];var _0x3e63c4;if(_0x131b7d>=_0x564ec5){_0x131b7d=_0x564ec5;_0x3e63c4=0xc8;}else{_0x3e63c4=0xce;}_0x1199e2[_0xdcb9('0xc')](_0x3e63c4);return _0x1199e2['set'](_0xdcb9('0x12'),_0x47e9a4+'-'+_0x131b7d+'/'+_0x564ec5)['json'](_0x1f2908);}return null;};}function saveUpdates(_0xd49b45){return function(_0x58b867){if(_0x58b867){return _0x58b867[_0xdcb9('0x13')](_0xd49b45)['then'](function(_0x4075be){return _0x4075be;});}return null;};}function removeEntity(_0x4a8d8c){return function(_0x2d3c4d){if(_0x2d3c4d){return _0x2d3c4d[_0xdcb9('0x14')]()[_0xdcb9('0x15')](function(){var _0x2a280c=_0x2d3c4d[_0xdcb9('0x16')]({'plain':!![]});var _0x117ef8=_0xdcb9('0x17');return db['UserProfileResource'][_0xdcb9('0x14')]({'where':{'type':_0x117ef8,'resourceId':_0x2a280c['id']}})['then'](function(){return _0x2d3c4d;});})['then'](function(){return createAgiSocket();})[_0xdcb9('0x15')](function(_0x1a37e6){_0x1a37e6['end'](JSON[_0xdcb9('0x18')]({'id':_0x2d3c4d['id'],'deleted':!![]}));})[_0xdcb9('0x15')](function(){_0x4a8d8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1127b0){return function(_0x42ce6c){if(!_0x42ce6c){_0x1127b0[_0xdcb9('0xa')](0x194);}return _0x42ce6c;};}function handleError(_0x258806,_0x54f19e){_0x54f19e=_0x54f19e||0x1f4;return function(_0xaa3400){logger[_0xdcb9('0x19')](_0xaa3400[_0xdcb9('0x1a')]);if(_0xaa3400[_0xdcb9('0x1b')]){delete _0xaa3400['name'];}_0x258806['status'](_0x54f19e)['send'](_0xaa3400);};}function createAgiSocket(){try{var _0xc95fc2=require(_0xdcb9('0x1c'));var _0x161f6d=new _0xc95fc2[(_0xdcb9('0x1d'))]();return _0x161f6d[_0xdcb9('0x1e')](config[_0xdcb9('0x1f')]['port']||0x11dd,_0xdcb9('0x20'));}catch(_0x22ba14){throw _0x22ba14;}}exports[_0xdcb9('0x21')]=function(_0x4df2cb,_0x9289cf){var _0x5b1848={},_0x4a826b={},_0x51a81a={'count':0x0,'rows':[]};var _0x46164d=_[_0xdcb9('0x22')](db[_0xdcb9('0x23')]['rawAttributes'],function(_0x24c958){return{'name':_0x24c958[_0xdcb9('0x24')],'type':_0x24c958['type']['key']};});_0x4a826b[_0xdcb9('0x25')]=_[_0xdcb9('0x22')](_0x46164d,_0xdcb9('0x1b'));_0x4a826b[_0xdcb9('0x26')]=_['keys'](_0x4df2cb[_0xdcb9('0x26')]);_0x4a826b['filters']=_[_0xdcb9('0x27')](_0x4a826b[_0xdcb9('0x25')],_0x4a826b[_0xdcb9('0x26')]);_0x5b1848['attributes']=_[_0xdcb9('0x27')](_0x4a826b[_0xdcb9('0x25')],qs[_0xdcb9('0x28')](_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x28')]));_0x5b1848[_0xdcb9('0x29')]=_0x5b1848[_0xdcb9('0x29')][_0xdcb9('0x2a')]?_0x5b1848[_0xdcb9('0x29')]:_0x4a826b['model'];if(!_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x2b')](_0xdcb9('0x2c'))){_0x5b1848[_0xdcb9('0x10')]=qs[_0xdcb9('0x10')](_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x10')]);_0x5b1848[_0xdcb9('0xe')]=qs['offset'](_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0xe')]);}_0x5b1848[_0xdcb9('0x2d')]=qs['sort'](_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x2e')]);_0x5b1848[_0xdcb9('0x2f')]=qs[_0xdcb9('0x30')](_[_0xdcb9('0x31')](_0x4df2cb[_0xdcb9('0x26')],_0x4a826b[_0xdcb9('0x30')]),_0x46164d);if(_0x4df2cb[_0xdcb9('0x26')]['filter']){_0x5b1848[_0xdcb9('0x2f')]=_['merge'](_0x5b1848['where'],{'$or':_[_0xdcb9('0x22')](_0x46164d,function(_0x949e39){if(_0x949e39[_0xdcb9('0x32')]!=='VIRTUAL'){var _0x460880={};_0x460880[_0x949e39['name']]={'$like':'%'+_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x33')]+'%'};return _0x460880;}})});}_0x5b1848=_[_0xdcb9('0x34')]({},_0x5b1848,_0x4df2cb['options']);var _0x5708fc={'where':_0x5b1848[_0xdcb9('0x2f')]};return db[_0xdcb9('0x23')][_0xdcb9('0x11')](_0x5708fc)[_0xdcb9('0x15')](function(_0x30c4d7){_0x51a81a[_0xdcb9('0x11')]=_0x30c4d7;if(_0x4df2cb[_0xdcb9('0x26')][_0xdcb9('0x35')]){_0x5b1848[_0xdcb9('0x36')]=[{'all':!![]}];}return db[_0xdcb9('0x23')][_0xdcb9('0x37')](_0x5b1848);})[_0xdcb9('0x15')](function(_0xc14fb1){_0x51a81a[_0xdcb9('0x38')]=_0xc14fb1;return _0x51a81a;})[_0xdcb9('0x15')](respondWithFilteredResult(_0x9289cf,_0x5b1848))['catch'](handleError(_0x9289cf,null));};exports['show']=function(_0x133fe8,_0x3117b0){var _0xf526d1={'raw':![],'where':{'id':_0x133fe8[_0xdcb9('0x39')]['id']}},_0x291309={};_0x291309[_0xdcb9('0x25')]=_['keys'](db[_0xdcb9('0x23')][_0xdcb9('0x3a')]);_0x291309[_0xdcb9('0x26')]=_['keys'](_0x133fe8[_0xdcb9('0x26')]);_0x291309['filters']=_[_0xdcb9('0x27')](_0x291309[_0xdcb9('0x25')],_0x291309[_0xdcb9('0x26')]);_0xf526d1[_0xdcb9('0x29')]=_['intersection'](_0x291309[_0xdcb9('0x25')],qs[_0xdcb9('0x28')](_0x133fe8[_0xdcb9('0x26')][_0xdcb9('0x28')]));_0xf526d1['attributes']=_0xf526d1['attributes'][_0xdcb9('0x2a')]?_0xf526d1[_0xdcb9('0x29')]:_0x291309['model'];if(_0x133fe8[_0xdcb9('0x26')]['includeAll']){_0xf526d1[_0xdcb9('0x36')]=[{'all':!![]}];}_0xf526d1=_[_0xdcb9('0x34')]({},_0xf526d1,_0x133fe8[_0xdcb9('0x3b')]);return db[_0xdcb9('0x23')]['find'](_0xf526d1)[_0xdcb9('0x15')](handleEntityNotFound(_0x3117b0,null))[_0xdcb9('0x15')](respondWithResult(_0x3117b0,null))[_0xdcb9('0x3c')](handleError(_0x3117b0,null));};exports[_0xdcb9('0x3d')]=function(_0x5218de,_0x2e9a6a){return db[_0xdcb9('0x23')]['create'](_0x5218de[_0xdcb9('0x3e')],{})[_0xdcb9('0x15')](function(_0x3527b6){var _0x4a7b1e=_0x5218de[_0xdcb9('0x3f')][_0xdcb9('0x16')]({'plain':!![]});if(!_0x4a7b1e)throw new Error(_0xdcb9('0x40'));if(_0x4a7b1e['role']===_0xdcb9('0x3f')){var _0x1b9faa=_0x3527b6[_0xdcb9('0x16')]({'plain':!![]});var _0x13ad77='SquareProjects';return db[_0xdcb9('0x41')][_0xdcb9('0x42')]({'where':{'name':_0x13ad77,'userProfileId':_0x4a7b1e['userProfileId']},'raw':!![]})['then'](function(_0x331547){if(_0x331547&&_0x331547[_0xdcb9('0x43')]===0x0){return db[_0xdcb9('0x44')][_0xdcb9('0x3d')]({'name':_0x1b9faa[_0xdcb9('0x1b')],'resourceId':_0x1b9faa['id'],'type':_0x331547[_0xdcb9('0x1b')],'sectionId':_0x331547['id']},{})[_0xdcb9('0x15')](function(){return _0x3527b6;});}else{return _0x3527b6;}})[_0xdcb9('0x3c')](function(_0x1dd1c0){logger['error'](_0xdcb9('0x45'),_0x1dd1c0);throw _0x1dd1c0;});}return _0x3527b6;})[_0xdcb9('0x15')](respondWithResult(_0x2e9a6a,0xc9))[_0xdcb9('0x3c')](handleError(_0x2e9a6a,null));};exports[_0xdcb9('0x13')]=function(_0x1cde26,_0x223137){if(_0x1cde26['body']['id']){delete _0x1cde26['body']['id'];}return db[_0xdcb9('0x23')][_0xdcb9('0x42')]({'where':{'id':_0x1cde26[_0xdcb9('0x39')]['id']}})['then'](handleEntityNotFound(_0x223137,null))[_0xdcb9('0x15')](saveUpdates(_0x1cde26[_0xdcb9('0x3e')],null))[_0xdcb9('0x15')](function(_0x2bc54b){if(!_0x2bc54b)return;var _0x57254d=_0x2bc54b['get']({'plain':!![]});return[createAgiSocket(),_0x57254d];})[_0xdcb9('0x46')](function(_0x372bbf,_0x39644c){_0x372bbf[_0xdcb9('0xb')](JSON[_0xdcb9('0x18')](_[_0xdcb9('0x31')](_0x39644c,['id','name',_0xdcb9('0x47')])));return _0x39644c;})[_0xdcb9('0x15')](respondWithResult(_0x223137,null))[_0xdcb9('0x3c')](handleError(_0x223137,null));};exports['destroy']=function(_0x3ff462,_0x558bc4){return db[_0xdcb9('0x23')][_0xdcb9('0x42')]({'where':{'id':_0x3ff462[_0xdcb9('0x39')]['id']}})[_0xdcb9('0x15')](handleEntityNotFound(_0x558bc4,null))[_0xdcb9('0x15')](removeEntity(_0x558bc4,null))[_0xdcb9('0x3c')](handleError(_0x558bc4,null));};exports[_0xdcb9('0x48')]=function(_0x4930bb,_0x4ceaa7){return db[_0xdcb9('0x23')][_0xdcb9('0x42')]({'where':{'id':_0x4930bb['params']['id']}})[_0xdcb9('0x15')](handleEntityNotFound(_0x4ceaa7,null))[_0xdcb9('0x15')](function(_0x2ceb4f){if(_0x2ceb4f){return _0x2ceb4f[_0xdcb9('0x48')](_0x4930bb['body'][_0xdcb9('0x49')],_[_0xdcb9('0x4a')](_0x4930bb[_0xdcb9('0x3e')],['ids','id'])||{});}})[_0xdcb9('0x15')](respondWithResult(_0x4ceaa7,null))[_0xdcb9('0x3c')](handleError(_0x4ceaa7,null));};exports['removeUsers']=function(_0x4e16e9,_0x529178){return db[_0xdcb9('0x23')][_0xdcb9('0x42')]({'where':{'id':_0x4e16e9[_0xdcb9('0x39')]['id']}})['then'](handleEntityNotFound(_0x529178,null))[_0xdcb9('0x15')](function(_0x34058f){if(_0x34058f){return _0x34058f[_0xdcb9('0x4b')](_0x4e16e9[_0xdcb9('0x26')][_0xdcb9('0x49')])[_0xdcb9('0x15')](function(){if(_[_0xdcb9('0x4c')](_0x4e16e9[_0xdcb9('0x26')]['ids'])){for(var _0xab21b0=0x0;_0xab21b0<_0x4e16e9[_0xdcb9('0x26')][_0xdcb9('0x49')][_0xdcb9('0x2a')];_0xab21b0+=0x1){socket[_0xdcb9('0x4d')](_0xdcb9('0x4e'),{'UserId':Number(_0x4e16e9[_0xdcb9('0x26')][_0xdcb9('0x49')][_0xab21b0]),'SquareProjectId':Number(_0x4e16e9[_0xdcb9('0x39')]['id'])});}}else{socket[_0xdcb9('0x4d')]('userSquareProject:remove',{'UserId':Number(_0x4e16e9[_0xdcb9('0x26')][_0xdcb9('0x49')]),'SquareProjectId':Number(_0x4e16e9[_0xdcb9('0x39')]['id'])});}});}})[_0xdcb9('0x15')](respondWithStatusCode(_0x529178,null))[_0xdcb9('0x3c')](handleError(_0x529178,null));};exports['getUsers']=function(_0x2024dd,_0x29fd88){var _0x186a8f={};var _0x33f71e={};var _0x3bdadd;var _0x5f4b95;return db[_0xdcb9('0x23')][_0xdcb9('0x4f')]({'where':{'id':_0x2024dd[_0xdcb9('0x39')]['id']}})[_0xdcb9('0x15')](handleEntityNotFound(_0x29fd88,null))[_0xdcb9('0x15')](function(_0x4bed5d){if(_0x4bed5d){_0x3bdadd=_0x4bed5d;_0x33f71e[_0xdcb9('0x25')]=_[_0xdcb9('0x50')](db[_0xdcb9('0x51')][_0xdcb9('0x3a')]);_0x33f71e[_0xdcb9('0x26')]=_[_0xdcb9('0x50')](_0x2024dd[_0xdcb9('0x26')]);_0x33f71e[_0xdcb9('0x30')]=_[_0xdcb9('0x27')](_0x33f71e[_0xdcb9('0x25')],_0x33f71e[_0xdcb9('0x26')]);_0x186a8f['attributes']=_[_0xdcb9('0x27')](_0x33f71e['model'],qs['fields'](_0x2024dd[_0xdcb9('0x26')][_0xdcb9('0x28')]));_0x186a8f['attributes']=_0x186a8f[_0xdcb9('0x29')]['length']?_0x186a8f[_0xdcb9('0x29')]:_0x33f71e[_0xdcb9('0x25')];_0x186a8f[_0xdcb9('0x2d')]=qs['sort'](_0x2024dd[_0xdcb9('0x26')][_0xdcb9('0x2e')]);_0x186a8f[_0xdcb9('0x2f')]=qs['filters'](_[_0xdcb9('0x31')](_0x2024dd[_0xdcb9('0x26')],_0x33f71e[_0xdcb9('0x30')]));if(_0x2024dd[_0xdcb9('0x26')]['filter']){_0x186a8f[_0xdcb9('0x2f')]=_['merge'](_0x186a8f[_0xdcb9('0x2f')],{'$or':_[_0xdcb9('0x22')](_0x186a8f[_0xdcb9('0x29')],function(_0x2a19c0){var _0x44d63a={};_0x44d63a[_0x2a19c0]={'$like':'%'+_0x2024dd[_0xdcb9('0x26')][_0xdcb9('0x33')]+'%'};return _0x44d63a;})});}_0x186a8f=_[_0xdcb9('0x34')]({},_0x186a8f,_0x2024dd['options']);return _0x3bdadd[_0xdcb9('0x52')](_0x186a8f);}})[_0xdcb9('0x15')](function(_0x4961a7){if(_0x4961a7){_0x5f4b95=_0x4961a7[_0xdcb9('0x2a')];if(!_0x2024dd[_0xdcb9('0x26')][_0xdcb9('0x2b')]('nolimit')){_0x186a8f[_0xdcb9('0x10')]=qs[_0xdcb9('0x10')](_0x2024dd[_0xdcb9('0x26')]['limit']);_0x186a8f[_0xdcb9('0xe')]=qs[_0xdcb9('0xe')](_0x2024dd[_0xdcb9('0x26')][_0xdcb9('0xe')]);}return _0x3bdadd['getUsers'](_0x186a8f);}})[_0xdcb9('0x15')](function(_0x302c42){if(_0x302c42){return _0x302c42?{'count':_0x5f4b95,'rows':_0x302c42}:null;}})['then'](respondWithResult(_0x29fd88,null))[_0xdcb9('0x3c')](handleError(_0x29fd88,null));}; \ No newline at end of file +var _0x8256=['error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','keys','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','save','update','destroy','get','SquareProjects','UserProfileResource','then'];(function(_0x3c5a32,_0x161d13){var _0x3f35d0=function(_0x262976){while(--_0x262976){_0x3c5a32['push'](_0x3c5a32['shift']());}};_0x3f35d0(++_0x161d13);}(_0x8256,0x1b3));var _0x6825=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8256[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6825('0x0'));var rimraf=require(_0x6825('0x1'));var zipdir=require(_0x6825('0x2'));var jsonpatch=require(_0x6825('0x3'));var rp=require(_0x6825('0x4'));var moment=require(_0x6825('0x5'));var BPromise=require(_0x6825('0x6'));var Mustache=require(_0x6825('0x7'));var util=require('util');var path=require(_0x6825('0x8'));var sox=require(_0x6825('0x9'));var csv=require(_0x6825('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6825('0xb'));var squel=require('squel');var crypto=require(_0x6825('0xc'));var jsforce=require(_0x6825('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6825('0xa'));var querystring=require('querystring');var Papa=require(_0x6825('0xe'));var Redis=require(_0x6825('0xf'));var authService=require(_0x6825('0x10'));var qs=require(_0x6825('0x11'));var as=require(_0x6825('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6825('0x13'))('api');var utils=require(_0x6825('0x14'));var config=require(_0x6825('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6825('0x16'))['db'];config[_0x6825('0x17')]=_[_0x6825('0x18')](config[_0x6825('0x17')],{'host':_0x6825('0x19'),'port':0x18eb});var socket=require(_0x6825('0x1a'))(new Redis(config[_0x6825('0x17')]));require('./squareProject.socket')[_0x6825('0x1b')](socket);function respondWithStatusCode(_0xdc9479,_0x5e5794){_0x5e5794=_0x5e5794||0xcc;return function(_0x48fa05){if(_0x48fa05){return _0xdc9479[_0x6825('0x1c')](_0x5e5794);}return _0xdc9479['status'](_0x5e5794)[_0x6825('0x1d')]();};}function respondWithResult(_0x43b875,_0x1c2401){_0x1c2401=_0x1c2401||0xc8;return function(_0x2594b4){if(_0x2594b4){return _0x43b875['status'](_0x1c2401)[_0x6825('0x1e')](_0x2594b4);}};}function respondWithFilteredResult(_0x10c360,_0x4899a0){return function(_0x6934ff){if(_0x6934ff){var _0x54bcb4=typeof _0x4899a0[_0x6825('0x1f')]===_0x6825('0x20')&&typeof _0x4899a0['limit']===_0x6825('0x20');var _0x1c0c37=_0x6934ff[_0x6825('0x21')];var _0x59a31c=_0x54bcb4?0x0:_0x4899a0[_0x6825('0x1f')];var _0x514632=_0x54bcb4?_0x6934ff[_0x6825('0x21')]:_0x4899a0[_0x6825('0x1f')]+_0x4899a0[_0x6825('0x22')];var _0x5eb2fa;if(_0x514632>=_0x1c0c37){_0x514632=_0x1c0c37;_0x5eb2fa=0xc8;}else{_0x5eb2fa=0xce;}_0x10c360[_0x6825('0x23')](_0x5eb2fa);return _0x10c360[_0x6825('0x24')]('Content-Range',_0x59a31c+'-'+_0x514632+'/'+_0x1c0c37)['json'](_0x6934ff);}return null;};}function patchUpdates(_0x1f90df){return function(_0x2a028a){try{jsonpatch[_0x6825('0x25')](_0x2a028a,_0x1f90df,!![]);}catch(_0x22eff9){return BPromise['reject'](_0x22eff9);}return _0x2a028a[_0x6825('0x26')]();};}function saveUpdates(_0x42e26e,_0x5e184f){return function(_0x5c6816){if(_0x5c6816){return _0x5c6816[_0x6825('0x27')](_0x42e26e)['then'](function(_0x272b19){return _0x272b19;});}return null;};}function removeEntity(_0x4a9a8d,_0x27160c){return function(_0x24056e){if(_0x24056e){return _0x24056e[_0x6825('0x28')]()['then'](function(){var _0x1dee6b=_0x24056e[_0x6825('0x29')]({'plain':!![]});var _0xbc9836=_0x6825('0x2a');return db[_0x6825('0x2b')][_0x6825('0x28')]({'where':{'type':_0xbc9836,'resourceId':_0x1dee6b['id']}})[_0x6825('0x2c')](function(){return _0x24056e;});})['then'](function(){_0x4a9a8d[_0x6825('0x23')](0xcc)[_0x6825('0x1d')]();});}};}function handleEntityNotFound(_0x10ed08,_0x59110e){return function(_0x34e2f8){if(!_0x34e2f8){_0x10ed08[_0x6825('0x1c')](0x194);}return _0x34e2f8;};}function handleError(_0x28ee2d,_0x1527ac){_0x1527ac=_0x1527ac||0x1f4;return function(_0x4ef90c){logger[_0x6825('0x2d')](_0x4ef90c['stack']);if(_0x4ef90c[_0x6825('0x2e')]){delete _0x4ef90c[_0x6825('0x2e')];}_0x28ee2d[_0x6825('0x23')](_0x1527ac)[_0x6825('0x2f')](_0x4ef90c);};}exports[_0x6825('0x30')]=function(_0xf9aa10,_0x53c5e3){var _0x3f208e={},_0x251570={},_0x335008={'count':0x0,'rows':[]};var _0x4524c4=_[_0x6825('0x31')](db[_0x6825('0x32')][_0x6825('0x33')],function(_0x25c5b0){return{'name':_0x25c5b0[_0x6825('0x34')],'type':_0x25c5b0[_0x6825('0x35')][_0x6825('0x36')]};});_0x251570[_0x6825('0x37')]=_[_0x6825('0x31')](_0x4524c4,'name');_0x251570[_0x6825('0x38')]=_['keys'](_0xf9aa10['query']);_0x251570[_0x6825('0x39')]=_[_0x6825('0x3a')](_0x251570['model'],_0x251570['query']);_0x3f208e[_0x6825('0x3b')]=_[_0x6825('0x3a')](_0x251570['model'],qs['fields'](_0xf9aa10[_0x6825('0x38')][_0x6825('0x3c')]));_0x3f208e[_0x6825('0x3b')]=_0x3f208e[_0x6825('0x3b')][_0x6825('0x3d')]?_0x3f208e[_0x6825('0x3b')]:_0x251570[_0x6825('0x37')];if(!_0xf9aa10[_0x6825('0x38')][_0x6825('0x3e')](_0x6825('0x3f'))){_0x3f208e['limit']=qs[_0x6825('0x22')](_0xf9aa10['query'][_0x6825('0x22')]);_0x3f208e[_0x6825('0x1f')]=qs[_0x6825('0x1f')](_0xf9aa10[_0x6825('0x38')]['offset']);}_0x3f208e['order']=qs[_0x6825('0x40')](_0xf9aa10[_0x6825('0x38')][_0x6825('0x40')]);_0x3f208e[_0x6825('0x41')]=qs[_0x6825('0x39')](_[_0x6825('0x42')](_0xf9aa10[_0x6825('0x38')],_0x251570['filters']),_0x4524c4);if(_0xf9aa10[_0x6825('0x38')][_0x6825('0x43')]){_0x3f208e[_0x6825('0x41')]=_['merge'](_0x3f208e[_0x6825('0x41')],{'$or':_[_0x6825('0x31')](_0x4524c4,function(_0x2b88bc){if(_0x2b88bc[_0x6825('0x35')]!==_0x6825('0x44')){var _0x42f028={};_0x42f028[_0x2b88bc[_0x6825('0x2e')]]={'$like':'%'+_0xf9aa10[_0x6825('0x38')][_0x6825('0x43')]+'%'};return _0x42f028;}})});}_0x3f208e=_[_0x6825('0x45')]({},_0x3f208e,_0xf9aa10['options']);var _0x138bd={'where':_0x3f208e[_0x6825('0x41')]};return db[_0x6825('0x32')][_0x6825('0x21')](_0x138bd)[_0x6825('0x2c')](function(_0x231aec){_0x335008[_0x6825('0x21')]=_0x231aec;if(_0xf9aa10['query']['includeAll']){_0x3f208e['include']=[{'all':!![]}];}return db[_0x6825('0x32')][_0x6825('0x46')](_0x3f208e);})['then'](function(_0xf8395d){_0x335008[_0x6825('0x47')]=_0xf8395d;return _0x335008;})['then'](respondWithFilteredResult(_0x53c5e3,_0x3f208e))[_0x6825('0x48')](handleError(_0x53c5e3,null));};exports[_0x6825('0x49')]=function(_0x42068d,_0x35f723){var _0x19bff2={'raw':![],'where':{'id':_0x42068d[_0x6825('0x4a')]['id']}},_0x2802b1={};_0x2802b1[_0x6825('0x37')]=_[_0x6825('0x4b')](db[_0x6825('0x32')][_0x6825('0x33')]);_0x2802b1[_0x6825('0x38')]=_[_0x6825('0x4b')](_0x42068d[_0x6825('0x38')]);_0x2802b1[_0x6825('0x39')]=_[_0x6825('0x3a')](_0x2802b1['model'],_0x2802b1[_0x6825('0x38')]);_0x19bff2[_0x6825('0x3b')]=_['intersection'](_0x2802b1[_0x6825('0x37')],qs[_0x6825('0x3c')](_0x42068d[_0x6825('0x38')]['fields']));_0x19bff2[_0x6825('0x3b')]=_0x19bff2[_0x6825('0x3b')]['length']?_0x19bff2['attributes']:_0x2802b1['model'];if(_0x42068d[_0x6825('0x38')][_0x6825('0x4c')]){_0x19bff2[_0x6825('0x4d')]=[{'all':!![]}];}_0x19bff2=_[_0x6825('0x45')]({},_0x19bff2,_0x42068d[_0x6825('0x4e')]);return db[_0x6825('0x32')][_0x6825('0x4f')](_0x19bff2)[_0x6825('0x2c')](handleEntityNotFound(_0x35f723,null))[_0x6825('0x2c')](respondWithResult(_0x35f723,null))[_0x6825('0x48')](handleError(_0x35f723,null));};exports['create']=function(_0x174363,_0x508fd1){return db[_0x6825('0x32')][_0x6825('0x50')](_0x174363[_0x6825('0x51')],{})[_0x6825('0x2c')](function(_0x2e5e04){var _0x166f7d=_0x174363['user']['get']({'plain':!![]});if(!_0x166f7d)throw new Error(_0x6825('0x52'));if(_0x166f7d[_0x6825('0x53')]===_0x6825('0x54')){var _0x21527a=_0x2e5e04[_0x6825('0x29')]({'plain':!![]});var _0x50f822=_0x6825('0x2a');return db[_0x6825('0x55')][_0x6825('0x4f')]({'where':{'name':_0x50f822,'userProfileId':_0x166f7d[_0x6825('0x56')]},'raw':!![]})[_0x6825('0x2c')](function(_0x50c564){if(_0x50c564&&_0x50c564[_0x6825('0x57')]===0x0){return db[_0x6825('0x2b')][_0x6825('0x50')]({'name':_0x21527a[_0x6825('0x2e')],'resourceId':_0x21527a['id'],'type':_0x50c564['name'],'sectionId':_0x50c564['id']},{})['then'](function(){return _0x2e5e04;});}else{return _0x2e5e04;}})[_0x6825('0x48')](function(_0x5912af){logger[_0x6825('0x2d')](_0x6825('0x58'),_0x5912af);throw _0x5912af;});}return _0x2e5e04;})[_0x6825('0x2c')](respondWithResult(_0x508fd1,0xc9))[_0x6825('0x48')](handleError(_0x508fd1,null));};exports['update']=function(_0x4eed2a,_0x25787f){if(_0x4eed2a['body']['id']){delete _0x4eed2a[_0x6825('0x51')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x4eed2a['params']['id']}})[_0x6825('0x2c')](handleEntityNotFound(_0x25787f,null))[_0x6825('0x2c')](saveUpdates(_0x4eed2a[_0x6825('0x51')],null))[_0x6825('0x2c')](respondWithResult(_0x25787f,null))['catch'](handleError(_0x25787f,null));};exports[_0x6825('0x28')]=function(_0x47d413,_0x58e466){return db['SquareProject'][_0x6825('0x4f')]({'where':{'id':_0x47d413['params']['id']}})['then'](handleEntityNotFound(_0x58e466,null))[_0x6825('0x2c')](removeEntity(_0x58e466,null))[_0x6825('0x48')](handleError(_0x58e466,null));};exports['addUsers']=function(_0x2fe7af,_0x2925e4,_0x3810da){return db['SquareProject']['find']({'where':{'id':_0x2fe7af[_0x6825('0x4a')]['id']}})[_0x6825('0x2c')](handleEntityNotFound(_0x2925e4,null))[_0x6825('0x2c')](function(_0x5043b6){if(_0x5043b6){return _0x5043b6['addUsers'](_0x2fe7af['body'][_0x6825('0x59')],_[_0x6825('0x5a')](_0x2fe7af[_0x6825('0x51')],[_0x6825('0x59'),'id'])||{});}})[_0x6825('0x2c')](respondWithResult(_0x2925e4,null))[_0x6825('0x48')](handleError(_0x2925e4,null));};exports[_0x6825('0x5b')]=function(_0x315cd0,_0x1d2e4e,_0x2118fd){return db[_0x6825('0x32')][_0x6825('0x4f')]({'where':{'id':_0x315cd0[_0x6825('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d2e4e,null))[_0x6825('0x2c')](function(_0x49c83f){if(_0x49c83f){return _0x49c83f[_0x6825('0x5b')](_0x315cd0[_0x6825('0x38')][_0x6825('0x59')])[_0x6825('0x2c')](function(){if(_[_0x6825('0x5c')](_0x315cd0[_0x6825('0x38')]['ids'])){for(var _0x24adea=0x0;_0x24adea<_0x315cd0[_0x6825('0x38')]['ids'][_0x6825('0x3d')];_0x24adea+=0x1){socket[_0x6825('0x5d')](_0x6825('0x5e'),{'UserId':Number(_0x315cd0[_0x6825('0x38')][_0x6825('0x59')][_0x24adea]),'SquareProjectId':Number(_0x315cd0[_0x6825('0x4a')]['id'])});}}else{socket['emit'](_0x6825('0x5e'),{'UserId':Number(_0x315cd0[_0x6825('0x38')][_0x6825('0x59')]),'SquareProjectId':Number(_0x315cd0[_0x6825('0x4a')]['id'])});}});}})[_0x6825('0x2c')](respondWithStatusCode(_0x1d2e4e,null))[_0x6825('0x48')](handleError(_0x1d2e4e,null));};exports[_0x6825('0x5f')]=function(_0x55206d,_0x417a10,_0x25af28){var _0x4fbe82={};var _0x46fc57={};var _0x14333e;var _0xe1f96d;return db['SquareProject']['findOne']({'where':{'id':_0x55206d[_0x6825('0x4a')]['id']}})[_0x6825('0x2c')](handleEntityNotFound(_0x417a10,null))[_0x6825('0x2c')](function(_0x4356f9){if(_0x4356f9){_0x14333e=_0x4356f9;_0x46fc57['model']=_['keys'](db['User'][_0x6825('0x33')]);_0x46fc57[_0x6825('0x38')]=_['keys'](_0x55206d[_0x6825('0x38')]);_0x46fc57['filters']=_[_0x6825('0x3a')](_0x46fc57['model'],_0x46fc57[_0x6825('0x38')]);_0x4fbe82[_0x6825('0x3b')]=_[_0x6825('0x3a')](_0x46fc57[_0x6825('0x37')],qs['fields'](_0x55206d[_0x6825('0x38')][_0x6825('0x3c')]));_0x4fbe82[_0x6825('0x3b')]=_0x4fbe82[_0x6825('0x3b')][_0x6825('0x3d')]?_0x4fbe82[_0x6825('0x3b')]:_0x46fc57[_0x6825('0x37')];_0x4fbe82['order']=qs['sort'](_0x55206d[_0x6825('0x38')][_0x6825('0x40')]);_0x4fbe82[_0x6825('0x41')]=qs[_0x6825('0x39')](_[_0x6825('0x42')](_0x55206d[_0x6825('0x38')],_0x46fc57[_0x6825('0x39')]));if(_0x55206d[_0x6825('0x38')]['filter']){_0x4fbe82[_0x6825('0x41')]=_['merge'](_0x4fbe82[_0x6825('0x41')],{'$or':_[_0x6825('0x31')](_0x4fbe82[_0x6825('0x3b')],function(_0x303c40){var _0x403401={};_0x403401[_0x303c40]={'$like':'%'+_0x55206d[_0x6825('0x38')][_0x6825('0x43')]+'%'};return _0x403401;})});}_0x4fbe82=_[_0x6825('0x45')]({},_0x4fbe82,_0x55206d[_0x6825('0x4e')]);return _0x14333e[_0x6825('0x5f')](_0x4fbe82);}})[_0x6825('0x2c')](function(_0x51463d){if(_0x51463d){_0xe1f96d=_0x51463d[_0x6825('0x3d')];if(!_0x55206d['query']['hasOwnProperty']('nolimit')){_0x4fbe82['limit']=qs[_0x6825('0x22')](_0x55206d[_0x6825('0x38')][_0x6825('0x22')]);_0x4fbe82[_0x6825('0x1f')]=qs[_0x6825('0x1f')](_0x55206d[_0x6825('0x38')][_0x6825('0x1f')]);}return _0x14333e[_0x6825('0x5f')](_0x4fbe82);}})[_0x6825('0x2c')](function(_0x59ba91){if(_0x59ba91){return _0x59ba91?{'count':_0xe1f96d,'rows':_0x59ba91}:null;}})[_0x6825('0x2c')](respondWithResult(_0x417a10,null))[_0x6825('0x48')](handleError(_0x417a10,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2e15762..1fa5374 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 _0x1f6a=['save','update','remove','emit','hook','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x18eeaa,_0x4380b6){var _0x23d240=function(_0x864c98){while(--_0x864c98){_0x18eeaa['push'](_0x18eeaa['shift']());}};_0x23d240(++_0x4380b6);}(_0x1f6a,0x152));var _0xa1f6=function(_0x2f5297,_0x2b93fc){_0x2f5297=_0x2f5297-0x0;var _0x446f62=_0x1f6a[_0x2f5297];return _0x446f62;};'use strict';var EventEmitter=require(_0xa1f6('0x0'));var SquareProject=require(_0xa1f6('0x1'))['db'][_0xa1f6('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa1f6('0x3')](0x0);var events={'afterCreate':_0xa1f6('0x4'),'afterUpdate':_0xa1f6('0x5'),'afterDestroy':_0xa1f6('0x6')};function emitEvent(_0x54c196){return function(_0x1ad6d5,_0x2eee8e,_0x3b1fe4){SquareProjectEvents[_0xa1f6('0x7')](_0x54c196+':'+_0x1ad6d5['id'],_0x1ad6d5);SquareProjectEvents[_0xa1f6('0x7')](_0x54c196,_0x1ad6d5);_0x3b1fe4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa1f6('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xe97c=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe97c,0xf3));var _0xce97=function(_0x48b938,_0x5f25ea){_0x48b938=_0x48b938-0x0;var _0x1be762=_0xe97c[_0x48b938];return _0x1be762;};'use strict';var EventEmitter=require(_0xce97('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xce97('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xce97('0x2')](0x0);var events={'afterCreate':_0xce97('0x3'),'afterUpdate':_0xce97('0x4'),'afterDestroy':_0xce97('0x5')};function emitEvent(_0x23a85f){return function(_0x2ab626,_0x5db404,_0xccd889){SquareProjectEvents[_0xce97('0x6')](_0x23a85f+':'+_0x2ab626['id'],_0x2ab626);SquareProjectEvents[_0xce97('0x6')](_0x23a85f,_0x2ab626);_0xccd889(null);};}for(var e in events){if(events[_0xce97('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xce97('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0546f05..05931f8 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 _0x9a66=['SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5490,_0x5dfa44){var _0x5c04d2=function(_0x2dce2b){while(--_0x2dce2b){_0x5490['push'](_0x5490['shift']());}};_0x5c04d2(++_0x5dfa44);}(_0x9a66,0x179));var _0x69a6=function(_0x1f123a,_0x56897d){_0x1f123a=_0x1f123a-0x0;var _0x44433a=_0x9a66[_0x1f123a];return _0x44433a;};'use strict';var _=require('lodash');var util=require(_0x69a6('0x0'));var logger=require(_0x69a6('0x1'))(_0x69a6('0x2'));var moment=require(_0x69a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x69a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69a6('0x5'));var config=require(_0x69a6('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x15ec88,_0x51a3fc){return _0x15ec88['define'](_0x69a6('0x7'),attributes,{'tableName':_0x69a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ab906,_0x4e5ab7,_0x2611b5){if(_0x4ab906[_0x69a6('0x9')](_0x69a6('0xa'))){_0x4ab906[_0x69a6('0xb')]=moment()[_0x69a6('0xc')](_0x69a6('0xd'));}if(_0x4ab906[_0x69a6('0x9')](_0x69a6('0xe'))){_0x4ab906[_0x69a6('0xf')]=moment()[_0x69a6('0xc')](_0x69a6('0xd'));}_0x2611b5(null,_0x4ab906);}}});}; \ No newline at end of file +var _0x6b29=['../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5ca259,_0x145448){var _0x30d5d8=function(_0x3a0a32){while(--_0x3a0a32){_0x5ca259['push'](_0x5ca259['shift']());}};_0x30d5d8(++_0x145448);}(_0x6b29,0xd6));var _0x96b2=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x6b29[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require('lodash');var util=require(_0x96b2('0x0'));var logger=require(_0x96b2('0x1'))(_0x96b2('0x2'));var moment=require(_0x96b2('0x3'));var BPromise=require(_0x96b2('0x4'));var rp=require(_0x96b2('0x5'));var fs=require('fs');var path=require(_0x96b2('0x6'));var rimraf=require('rimraf');var config=require(_0x96b2('0x7'));var attributes=require('./squareProject.attributes');module[_0x96b2('0x8')]=function(_0x59c9ad,_0xb9954f){return _0x59c9ad[_0x96b2('0x9')]('SquareProject',attributes,{'tableName':_0x96b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x377db0,_0x1d4275,_0x2fd05f){if(_0x377db0[_0x96b2('0xb')](_0x96b2('0xc'))){_0x377db0[_0x96b2('0xd')]=moment()[_0x96b2('0xe')](_0x96b2('0xf'));}if(_0x377db0[_0x96b2('0xb')](_0x96b2('0x10'))){_0x377db0['publishedAt']=moment()[_0x96b2('0xe')](_0x96b2('0xf'));}_0x2fd05f(null,_0x377db0);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index acef235..49bd2a7 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 _0xf6c3=['SquareProject','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','error','message','ShowSquareProject','find','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects'];(function(_0x3e5134,_0xf81cb9){var _0x550cd4=function(_0x30ddc7){while(--_0x30ddc7){_0x3e5134['push'](_0x3e5134['shift']());}};_0x550cd4(++_0xf81cb9);}(_0xf6c3,0x11f));var _0x3f6c=function(_0x30213b,_0x2f0782){_0x30213b=_0x30213b-0x0;var _0x2c78e6=_0xf6c3[_0x30213b];return _0x2c78e6;};'use strict';var _=require(_0x3f6c('0x0'));var Redis=require(_0x3f6c('0x1'));var db=require(_0x3f6c('0x2'))['db'];var logger=require(_0x3f6c('0x3'))(_0x3f6c('0x4'));var config=require(_0x3f6c('0x5'));config[_0x3f6c('0x6')]=_[_0x3f6c('0x7')](config[_0x3f6c('0x6')],{'host':_0x3f6c('0x8'),'port':0x18eb});var socket=require(_0x3f6c('0x9'))(new Redis(config[_0x3f6c('0x6')]));require(_0x3f6c('0xa'))[_0x3f6c('0xb')](socket);exports[_0x3f6c('0xc')]=function(_0x31c61c){var _0x5aa970=this;return new Promise(function(_0x101aa6,_0x3c0d19){return db[_0x3f6c('0xd')]['findAll']({'raw':_0x31c61c[_0x3f6c('0xe')]?_0x31c61c['options'][_0x3f6c('0xf')]===undefined?!![]:![]:!![],'where':_0x31c61c[_0x3f6c('0xe')]?_0x31c61c[_0x3f6c('0xe')]['where']||null:null,'attributes':_0x31c61c[_0x3f6c('0xe')]?_0x31c61c[_0x3f6c('0xe')][_0x3f6c('0x10')]||null:null,'limit':_0x31c61c[_0x3f6c('0xe')]?_0x31c61c[_0x3f6c('0xe')][_0x3f6c('0x11')]||null:null,'include':_0x31c61c[_0x3f6c('0xe')]?_0x31c61c[_0x3f6c('0xe')][_0x3f6c('0x12')]?_[_0x3f6c('0x13')](_0x31c61c[_0x3f6c('0xe')][_0x3f6c('0x12')],function(_0x37badc){return{'model':db[_0x37badc[_0x3f6c('0x14')]],'as':_0x37badc['as'],'attributes':_0x37badc['attributes'],'include':_0x37badc['include']?_[_0x3f6c('0x13')](_0x37badc[_0x3f6c('0x12')],function(_0x3fb0b4){return{'model':db[_0x3fb0b4['model']],'as':_0x3fb0b4['as'],'attributes':_0x3fb0b4[_0x3f6c('0x10')],'include':_0x3fb0b4[_0x3f6c('0x12')]?_[_0x3f6c('0x13')](_0x3fb0b4[_0x3f6c('0x12')],function(_0x59e554){return{'model':db[_0x59e554[_0x3f6c('0x14')]],'as':_0x59e554['as'],'attributes':_0x59e554[_0x3f6c('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3f6c('0x15')](function(_0x5d2dda){logger[_0x3f6c('0x16')](_0x3f6c('0xc'),_0x31c61c);logger[_0x3f6c('0x17')](_0x3f6c('0xc'),_0x31c61c,JSON[_0x3f6c('0x18')](_0x5d2dda));_0x101aa6(_0x5d2dda);})['catch'](function(_0xa1c67e){logger[_0x3f6c('0x19')]('GetSquareProjects',_0xa1c67e[_0x3f6c('0x1a')],_0x31c61c);_0x3c0d19(_0x5aa970[_0x3f6c('0x19')](0x1f4,_0xa1c67e['message']));});});};exports[_0x3f6c('0x1b')]=function(_0xc818b5){var _0x13ee88=this;return new Promise(function(_0x1103e0,_0x57c594){return db[_0x3f6c('0xd')][_0x3f6c('0x1c')]({'raw':_0xc818b5[_0x3f6c('0xe')]?_0xc818b5[_0x3f6c('0xe')][_0x3f6c('0xf')]===undefined?!![]:![]:!![],'where':_0xc818b5[_0x3f6c('0xe')]?_0xc818b5[_0x3f6c('0xe')]['where']||null:null,'attributes':_0xc818b5[_0x3f6c('0xe')]?_0xc818b5[_0x3f6c('0xe')][_0x3f6c('0x10')]||null:null,'include':_0xc818b5['options']?_0xc818b5[_0x3f6c('0xe')]['include']?_[_0x3f6c('0x13')](_0xc818b5[_0x3f6c('0xe')][_0x3f6c('0x12')],function(_0x47dd61){return{'model':db[_0x47dd61[_0x3f6c('0x14')]],'as':_0x47dd61['as'],'attributes':_0x47dd61[_0x3f6c('0x10')],'include':_0x47dd61['include']?_['map'](_0x47dd61['include'],function(_0x31bfcb){return{'model':db[_0x31bfcb[_0x3f6c('0x14')]],'as':_0x31bfcb['as'],'attributes':_0x31bfcb[_0x3f6c('0x10')],'include':_0x31bfcb[_0x3f6c('0x12')]?_[_0x3f6c('0x13')](_0x31bfcb[_0x3f6c('0x12')],function(_0x51755c){return{'model':db[_0x51755c[_0x3f6c('0x14')]],'as':_0x51755c['as'],'attributes':_0x51755c[_0x3f6c('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26d5f7){logger[_0x3f6c('0x16')](_0x3f6c('0x1b'),_0xc818b5);logger[_0x3f6c('0x17')](_0x3f6c('0x1b'),_0xc818b5,JSON[_0x3f6c('0x18')](_0x26d5f7));_0x1103e0(_0x26d5f7);})[_0x3f6c('0x1d')](function(_0x1387d8){logger['error'](_0x3f6c('0x1b'),_0x1387d8[_0x3f6c('0x1a')],_0xc818b5);_0x57c594(_0x13ee88[_0x3f6c('0x19')](0x1f4,_0x1387d8[_0x3f6c('0x1a')]));});});}; \ No newline at end of file +var _0xad52=['result','catch','ShowSquareProject','find','options','attributes','map','include','model','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xad52,0x72));var _0x2ad5=function(_0x140f92,_0x533825){_0x140f92=_0x140f92-0x0;var _0x3f918d=_0xad52[_0x140f92];return _0x3f918d;};'use strict';var _=require(_0x2ad5('0x0'));var util=require('util');var moment=require(_0x2ad5('0x1'));var BPromise=require(_0x2ad5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ad5('0x3'));var db=require(_0x2ad5('0x4'))['db'];var utils=require(_0x2ad5('0x5'));var logger=require(_0x2ad5('0x6'))('rpc');var config=require(_0x2ad5('0x7'));var jayson=require(_0x2ad5('0x8'));var client=jayson[_0x2ad5('0x9')][_0x2ad5('0xa')]({'port':0x232a});config['redis']=_[_0x2ad5('0xb')](config[_0x2ad5('0xc')],{'host':_0x2ad5('0xd'),'port':0x18eb});var socket=require(_0x2ad5('0xe'))(new Redis(config['redis']));require(_0x2ad5('0xf'))[_0x2ad5('0x10')](socket);function respondWithRpcPromise(_0x34b179,_0x513d7b,_0x40aeab){return new BPromise(function(_0x53aa09,_0x419468){return client['request'](_0x34b179,_0x40aeab)[_0x2ad5('0x11')](function(_0x192c1d){logger[_0x2ad5('0x12')](_0x2ad5('0x13'),_0x513d7b,_0x2ad5('0x14'));logger['debug'](_0x2ad5('0x15'),_0x513d7b,_0x2ad5('0x14'),JSON[_0x2ad5('0x16')](_0x192c1d));if(_0x192c1d[_0x2ad5('0x17')]){if(_0x192c1d[_0x2ad5('0x17')][_0x2ad5('0x18')]===0x1f4){logger[_0x2ad5('0x17')](_0x2ad5('0x13'),_0x513d7b,_0x192c1d[_0x2ad5('0x17')][_0x2ad5('0x19')]);return _0x419468(_0x192c1d[_0x2ad5('0x17')][_0x2ad5('0x19')]);}logger['error'](_0x2ad5('0x13'),_0x513d7b,_0x192c1d[_0x2ad5('0x17')]['message']);return _0x53aa09(_0x192c1d[_0x2ad5('0x17')][_0x2ad5('0x19')]);}else{logger['info'](_0x2ad5('0x13'),_0x513d7b,'request\x20sent');_0x53aa09(_0x192c1d[_0x2ad5('0x1a')][_0x2ad5('0x19')]);}})[_0x2ad5('0x1b')](function(_0x143ed8){logger[_0x2ad5('0x17')](_0x2ad5('0x13'),_0x513d7b,_0x143ed8);_0x419468(_0x143ed8);});});}exports[_0x2ad5('0x1c')]=function(_0xd26fcf){var _0x5d01a9=this;return new Promise(function(_0x12d430,_0x1ec68e){return db['SquareProject'][_0x2ad5('0x1d')]({'raw':_0xd26fcf[_0x2ad5('0x1e')]?_0xd26fcf[_0x2ad5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd26fcf[_0x2ad5('0x1e')]?_0xd26fcf[_0x2ad5('0x1e')]['where']||null:null,'attributes':_0xd26fcf[_0x2ad5('0x1e')]?_0xd26fcf[_0x2ad5('0x1e')][_0x2ad5('0x1f')]||null:null,'include':_0xd26fcf[_0x2ad5('0x1e')]?_0xd26fcf['options']['include']?_[_0x2ad5('0x20')](_0xd26fcf[_0x2ad5('0x1e')][_0x2ad5('0x21')],function(_0x12e4c0){return{'model':db[_0x12e4c0[_0x2ad5('0x22')]],'as':_0x12e4c0['as'],'attributes':_0x12e4c0['attributes'],'include':_0x12e4c0[_0x2ad5('0x21')]?_['map'](_0x12e4c0[_0x2ad5('0x21')],function(_0x232f2c){return{'model':db[_0x232f2c['model']],'as':_0x232f2c['as'],'attributes':_0x232f2c[_0x2ad5('0x1f')],'include':_0x232f2c['include']?_[_0x2ad5('0x20')](_0x232f2c[_0x2ad5('0x21')],function(_0x5f0d00){return{'model':db[_0x5f0d00[_0x2ad5('0x22')]],'as':_0x5f0d00['as'],'attributes':_0x5f0d00[_0x2ad5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2ad5('0x11')](function(_0x32ffb7){logger['info'](_0x2ad5('0x1c'),_0xd26fcf);logger['debug'](_0x2ad5('0x1c'),_0xd26fcf,JSON[_0x2ad5('0x16')](_0x32ffb7));_0x12d430(_0x32ffb7);})['catch'](function(_0x2b1ea9){logger[_0x2ad5('0x17')](_0x2ad5('0x1c'),_0x2b1ea9[_0x2ad5('0x19')],_0xd26fcf);_0x1ec68e(_0x5d01a9[_0x2ad5('0x17')](0x1f4,_0x2b1ea9[_0x2ad5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 5150be7..479a7d7 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 _0xbcc1=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0xf28865,_0x3bb4a0){var _0x3d73d8=function(_0x5ae2d2){while(--_0x5ae2d2){_0xf28865['push'](_0xf28865['shift']());}};_0x3d73d8(++_0x3bb4a0);}(_0xbcc1,0xe9));var _0x1bcc=function(_0xea583c,_0x2a89cc){_0xea583c=_0xea583c-0x0;var _0x13dc09=_0xbcc1[_0xea583c];return _0x13dc09;};'use strict';var SquareProjectEvents=require(_0x1bcc('0x0'));var events=[_0x1bcc('0x1'),_0x1bcc('0x2'),_0x1bcc('0x3')];function createListener(_0x37391c,_0xaf0c1){return function(_0x42f252){_0xaf0c1[_0x1bcc('0x4')](_0x37391c,_0x42f252);};}function removeListener(_0x37baa7,_0x30a176){return function(){SquareProjectEvents[_0x1bcc('0x5')](_0x37baa7,_0x30a176);};}exports[_0x1bcc('0x6')]=function(_0x5b3597){for(var _0x3c293e=0x0,_0x582e6d=events[_0x1bcc('0x7')];_0x3c293e<_0x582e6d;_0x3c293e++){var _0x480966=events[_0x3c293e];var _0x25ff28=createListener(_0x1bcc('0x8')+_0x480966,_0x5b3597);SquareProjectEvents['on'](_0x480966,_0x25ff28);}}; \ No newline at end of file +var _0xdf42=['register','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x520d8d,_0x236ee2){var _0x2ebe1=function(_0x4edf73){while(--_0x4edf73){_0x520d8d['push'](_0x520d8d['shift']());}};_0x2ebe1(++_0x236ee2);}(_0xdf42,0x182));var _0x2df4=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xdf42[_0x341e0f];return _0x59555a;};'use strict';var SquareProjectEvents=require(_0x2df4('0x0'));var events=[_0x2df4('0x1'),_0x2df4('0x2'),_0x2df4('0x3')];function createListener(_0x3d8e87,_0x3bf72f){return function(_0x2dfe92){_0x3bf72f[_0x2df4('0x4')](_0x3d8e87,_0x2dfe92);};}function removeListener(_0xe1f2b8,_0x29acb8){return function(){SquareProjectEvents[_0x2df4('0x5')](_0xe1f2b8,_0x29acb8);};}exports[_0x2df4('0x6')]=function(_0x2719f6){for(var _0x14d8c7=0x0,_0x17b88f=events['length'];_0x14d8c7<_0x17b88f;_0x14d8c7++){var _0xf23779=events[_0x14d8c7];var _0x1cfff0=createListener(_0x2df4('0x7')+_0xf23779,_0x2719f6);SquareProjectEvents['on'](_0xf23779,_0x1cfff0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0facf93..3ab14c3 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x1d519d,_0x332a4e){var _0x5922ad=function(_0x2d7261){while(--_0x2d7261){_0x1d519d['push'](_0x1d519d['shift']());}};_0x5922ad(++_0x332a4e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'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['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=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(_0x289f16,_0x441291){var _0x114eb9=function(_0x3f911b){while(--_0x3f911b){_0x289f16['push'](_0x289f16['shift']());}};_0x114eb9(++_0x441291);}(_0xe14b,0x93));var _0xbe14=function(_0xf6fae2,_0x51c235){_0xf6fae2=_0xf6fae2-0x0;var _0x186341=_0xe14b[_0xf6fae2];return _0x186341;};'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 e4cd315..f9975c0 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 _0x55ca=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x314bc6,_0x1e99bd){var _0x1449de=function(_0x5a4872){while(--_0x5a4872){_0x314bc6['push'](_0x314bc6['shift']());}};_0x1449de(++_0x1e99bd);}(_0x55ca,0x126));var _0xa55c=function(_0x20d73e,_0x39f9ec){_0x20d73e=_0x20d73e-0x0;var _0x52e84b=_0x55ca[_0x20d73e];return _0x52e84b;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa55c('0x2')]},'extension':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'dnid':{'type':Sequelize[_0xa55c('0x2')]},'projectName':{'type':Sequelize[_0xa55c('0x2')]},'saveName':{'type':Sequelize[_0xa55c('0x2')]},'filename':{'type':Sequelize[_0xa55c('0x2')]},'savePath':{'type':Sequelize[_0xa55c('0x2')]},'format':{'type':Sequelize[_0xa55c('0x3')],'get':function(){var _0x4d0624='';var _0x2121fd=this[_0xa55c('0x4')]('savePath');if(_0x2121fd){_0x4d0624=_0x2121fd[_0xa55c('0x5')](_0x2121fd[_0xa55c('0x6')]('.'));}return _0x4d0624;}}}; \ No newline at end of file +var _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x50312d,_0x1d1cc2){var _0x2376ad=function(_0x4b9c17){while(--_0x4b9c17){_0x50312d['push'](_0x50312d['shift']());}};_0x2376ad(++_0x1d1cc2);}(_0xee14,0x13a));var _0x4ee1=function(_0x1ad6c6,_0x482b7b){_0x1ad6c6=_0x1ad6c6-0x0;var _0x9dcb73=_0xee14[_0x1ad6c6];return _0x9dcb73;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f5dc063..76bb531 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 _0xd240=['../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','rows','catch','show','params','merge','create','body','update','download','../../components/encryptor','uniqueid','find','filename','format','decryptFile','secrets','recording','savePath','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd240,0x111));var _0x0d24=function(_0x5bc531,_0x254c66){_0x5bc531=_0x5bc531-0x0;var _0x12af2d=_0xd240[_0x5bc531];return _0x12af2d;};'use strict';var emlformat=require(_0x0d24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d24('0x1'));var jsonpatch=require(_0x0d24('0x2'));var rp=require(_0x0d24('0x3'));var moment=require(_0x0d24('0x4'));var BPromise=require(_0x0d24('0x5'));var Mustache=require(_0x0d24('0x6'));var util=require('util');var path=require(_0x0d24('0x7'));var sox=require('sox');var csv=require(_0x0d24('0x8'));var ejs=require(_0x0d24('0x9'));var fs=require('fs');var fs_extra=require(_0x0d24('0xa'));var _=require(_0x0d24('0xb'));var squel=require(_0x0d24('0xc'));var crypto=require(_0x0d24('0xd'));var jsforce=require(_0x0d24('0xe'));var deskjs=require(_0x0d24('0xf'));var toCsv=require(_0x0d24('0x8'));var querystring=require('querystring');var Papa=require(_0x0d24('0x10'));var Redis=require(_0x0d24('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d24('0x12'));var as=require(_0x0d24('0x13'));var hardwareService=require(_0x0d24('0x14'));var logger=require(_0x0d24('0x15'))(_0x0d24('0x16'));var utils=require(_0x0d24('0x17'));var config=require(_0x0d24('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d24('0x19'))['db'];function respondWithStatusCode(_0x34f00e,_0x444988){_0x444988=_0x444988||0xcc;return function(_0x3300cd){if(_0x3300cd){return _0x34f00e['sendStatus'](_0x444988);}return _0x34f00e[_0x0d24('0x1a')](_0x444988)[_0x0d24('0x1b')]();};}function respondWithResult(_0x4c0549,_0x3e6daf){_0x3e6daf=_0x3e6daf||0xc8;return function(_0x25a871){if(_0x25a871){return _0x4c0549[_0x0d24('0x1a')](_0x3e6daf)['json'](_0x25a871);}};}function respondWithFilteredResult(_0x3c8023,_0xe73d29){return function(_0x1a0c2e){if(_0x1a0c2e){var _0x59aaae=typeof _0xe73d29[_0x0d24('0x1c')]==='undefined'&&typeof _0xe73d29['limit']===_0x0d24('0x1d');var _0x42ae19=_0x1a0c2e['count'];var _0x543aaa=_0x59aaae?0x0:_0xe73d29[_0x0d24('0x1c')];var _0x42af8a=_0x59aaae?_0x1a0c2e[_0x0d24('0x1e')]:_0xe73d29[_0x0d24('0x1c')]+_0xe73d29[_0x0d24('0x1f')];var _0xecd983;if(_0x42af8a>=_0x42ae19){_0x42af8a=_0x42ae19;_0xecd983=0xc8;}else{_0xecd983=0xce;}_0x3c8023[_0x0d24('0x1a')](_0xecd983);return _0x3c8023['set'](_0x0d24('0x20'),_0x543aaa+'-'+_0x42af8a+'/'+_0x42ae19)['json'](_0x1a0c2e);}return null;};}function patchUpdates(_0x4a915a){return function(_0x1ab050){try{jsonpatch[_0x0d24('0x21')](_0x1ab050,_0x4a915a,!![]);}catch(_0x48defd){return BPromise[_0x0d24('0x22')](_0x48defd);}return _0x1ab050[_0x0d24('0x23')]();};}function saveUpdates(_0x29b6a5,_0x34a347){return function(_0x3b88da){if(_0x3b88da){return _0x3b88da['update'](_0x29b6a5)[_0x0d24('0x24')](function(_0x2a5805){return _0x2a5805;});}return null;};}function removeEntity(_0x435a32,_0x3ad15c){return function(_0x1c5a57){if(_0x1c5a57){return _0x1c5a57['destroy']()[_0x0d24('0x24')](function(){_0x435a32['status'](0xcc)[_0x0d24('0x1b')]();});}};}function handleEntityNotFound(_0x13a977,_0x334841){return function(_0xf73cbc){if(!_0xf73cbc){_0x13a977[_0x0d24('0x25')](0x194);}return _0xf73cbc;};}function handleError(_0x43b117,_0x428cfe){_0x428cfe=_0x428cfe||0x1f4;return function(_0x1adb0c){logger[_0x0d24('0x26')](_0x1adb0c[_0x0d24('0x27')]);if(_0x1adb0c[_0x0d24('0x28')]){delete _0x1adb0c[_0x0d24('0x28')];}_0x43b117['status'](_0x428cfe)[_0x0d24('0x29')](_0x1adb0c);};}exports['index']=function(_0x5a1692,_0x565571){var _0x482a69={},_0x663db3={},_0x291b78={'count':0x0,'rows':[]};var _0x97d693=_[_0x0d24('0x2a')](db[_0x0d24('0x2b')][_0x0d24('0x2c')],function(_0x1486c5){return{'name':_0x1486c5[_0x0d24('0x2d')],'type':_0x1486c5[_0x0d24('0x2e')][_0x0d24('0x2f')]};});_0x663db3['model']=_['map'](_0x97d693,_0x0d24('0x28'));_0x663db3[_0x0d24('0x30')]=_[_0x0d24('0x31')](_0x5a1692['query']);_0x663db3['filters']=_[_0x0d24('0x32')](_0x663db3[_0x0d24('0x33')],_0x663db3[_0x0d24('0x30')]);_0x482a69[_0x0d24('0x34')]=_[_0x0d24('0x32')](_0x663db3[_0x0d24('0x33')],qs[_0x0d24('0x35')](_0x5a1692['query'][_0x0d24('0x35')]));_0x482a69['attributes']=_0x482a69[_0x0d24('0x34')][_0x0d24('0x36')]?_0x482a69[_0x0d24('0x34')]:_0x663db3[_0x0d24('0x33')];if(!_0x5a1692['query'][_0x0d24('0x37')](_0x0d24('0x38'))){_0x482a69[_0x0d24('0x1f')]=qs[_0x0d24('0x1f')](_0x5a1692[_0x0d24('0x30')][_0x0d24('0x1f')]);_0x482a69['offset']=qs[_0x0d24('0x1c')](_0x5a1692[_0x0d24('0x30')][_0x0d24('0x1c')]);}_0x482a69[_0x0d24('0x39')]=qs[_0x0d24('0x3a')](_0x5a1692[_0x0d24('0x30')]['sort']);_0x482a69[_0x0d24('0x3b')]=qs[_0x0d24('0x3c')](_[_0x0d24('0x3d')](_0x5a1692[_0x0d24('0x30')],_0x663db3[_0x0d24('0x3c')]),_0x97d693);if(_0x5a1692[_0x0d24('0x30')][_0x0d24('0x3e')]){_0x482a69['where']=_['merge'](_0x482a69[_0x0d24('0x3b')],{'$or':_[_0x0d24('0x2a')](_0x97d693,function(_0x38a723){if(_0x38a723['type']!=='VIRTUAL'){var _0x3ddaa5={};_0x3ddaa5[_0x38a723[_0x0d24('0x28')]]={'$like':'%'+_0x5a1692['query']['filter']+'%'};return _0x3ddaa5;}})});}_0x482a69=_['merge']({},_0x482a69,_0x5a1692[_0x0d24('0x3f')]);var _0x349772={'where':_0x482a69['where']};return db[_0x0d24('0x2b')][_0x0d24('0x1e')](_0x349772)[_0x0d24('0x24')](function(_0x35c780){_0x291b78[_0x0d24('0x1e')]=_0x35c780;if(_0x5a1692[_0x0d24('0x30')][_0x0d24('0x40')]){_0x482a69[_0x0d24('0x41')]=[{'all':!![]}];}return db[_0x0d24('0x2b')]['findAll'](_0x482a69);})[_0x0d24('0x24')](function(_0x5aed19){_0x291b78[_0x0d24('0x42')]=_0x5aed19;return _0x291b78;})['then'](respondWithFilteredResult(_0x565571,_0x482a69))[_0x0d24('0x43')](handleError(_0x565571,null));};exports[_0x0d24('0x44')]=function(_0x529161,_0xeb4c65){var _0x2dcf53={'raw':!![],'where':{'id':_0x529161[_0x0d24('0x45')]['id']}},_0x3465d6={};_0x3465d6['model']=_['keys'](db['SquareRecording'][_0x0d24('0x2c')]);_0x3465d6[_0x0d24('0x30')]=_[_0x0d24('0x31')](_0x529161[_0x0d24('0x30')]);_0x3465d6[_0x0d24('0x3c')]=_['intersection'](_0x3465d6['model'],_0x3465d6[_0x0d24('0x30')]);_0x2dcf53[_0x0d24('0x34')]=_[_0x0d24('0x32')](_0x3465d6[_0x0d24('0x33')],qs[_0x0d24('0x35')](_0x529161[_0x0d24('0x30')]['fields']));_0x2dcf53[_0x0d24('0x34')]=_0x2dcf53['attributes'][_0x0d24('0x36')]?_0x2dcf53[_0x0d24('0x34')]:_0x3465d6['model'];if(_0x529161[_0x0d24('0x30')][_0x0d24('0x40')]){_0x2dcf53[_0x0d24('0x41')]=[{'all':!![]}];}_0x2dcf53=_[_0x0d24('0x46')]({},_0x2dcf53,_0x529161['options']);return db[_0x0d24('0x2b')]['find'](_0x2dcf53)[_0x0d24('0x24')](handleEntityNotFound(_0xeb4c65,null))['then'](respondWithResult(_0xeb4c65,null))[_0x0d24('0x43')](handleError(_0xeb4c65,null));};exports[_0x0d24('0x47')]=function(_0x521dcc,_0x4e7b84){return db[_0x0d24('0x2b')][_0x0d24('0x47')](_0x521dcc[_0x0d24('0x48')],{})[_0x0d24('0x24')](respondWithResult(_0x4e7b84,0xc9))['catch'](handleError(_0x4e7b84,null));};exports[_0x0d24('0x49')]=function(_0x752930,_0xce0522){if(_0x752930[_0x0d24('0x48')]['id']){delete _0x752930[_0x0d24('0x48')]['id'];}return db[_0x0d24('0x2b')]['find']({'where':{'id':_0x752930['params']['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0xce0522,null))[_0x0d24('0x24')](saveUpdates(_0x752930[_0x0d24('0x48')],null))[_0x0d24('0x24')](respondWithResult(_0xce0522,null))['catch'](handleError(_0xce0522,null));};exports[_0x0d24('0x4a')]=function(_0x57449a,_0xa30ec6,_0x1a0ed0){var _0xda282f=require(_0x0d24('0x4b'));var _0x300cd5=![];var _0x291d0f={};if(_0x57449a[_0x0d24('0x30')][_0x0d24('0x2e')]&&_0x57449a[_0x0d24('0x30')][_0x0d24('0x2e')]==='uniqueid'){_0x291d0f[_0x0d24('0x4c')]=_0x57449a[_0x0d24('0x45')]['id'];}else{_0x291d0f['id']=_0x57449a[_0x0d24('0x45')]['id'];}return db['SquareRecording'][_0x0d24('0x4d')]({'where':_0x291d0f,'attributes':['id','savePath',_0x0d24('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0xa30ec6,null))[_0x0d24('0x24')](function(_0x49c562){if(_0x49c562){var _0x3b3153=_0x49c562['savePath'];var _0x323046=util[_0x0d24('0x4f')]('%s.cypher',_0x3b3153);if(fs['existsSync'](_0x323046)){_0x300cd5=!![];return _0xda282f[_0x0d24('0x50')](_0x323046,_0x3b3153,config[_0x0d24('0x51')][_0x0d24('0x52')])[_0x0d24('0x24')](function(){return _0x49c562;});}return _0x49c562;}})[_0x0d24('0x24')](function(_0x411ae7){if(_0x411ae7){var _0x383582=_0x411ae7[_0x0d24('0x53')];if(!fs[_0x0d24('0x54')](_0x383582)){throw new db[(_0x0d24('0x55'))][(_0x0d24('0x56'))](_0x0d24('0x57'));}if(_0x411ae7[_0x0d24('0x4e')]){return _0xa30ec6['download'](_0x383582,_0x411ae7[_0x0d24('0x4e')]+path[_0x0d24('0x58')](_0x383582),function(){if(_0x300cd5){fs[_0x0d24('0x59')](_0x383582);}});}else{return _0xa30ec6[_0x0d24('0x4a')](_0x383582,function(_0x43ed31){if(_0x300cd5){fs['unlink'](_0x383582);}});}}})[_0x0d24('0x43')](function(_0x2c8387){if(_0x2c8387[_0x0d24('0x5a')]===_0x0d24('0x57')){_0xa30ec6['status'](0x194)[_0x0d24('0x29')]('Not\x20found');}else{return handleError(_0xa30ec6,null);}});};exports['destroy']=function(_0x156ac9,_0x2bf96d){return db[_0x0d24('0x2b')][_0x0d24('0x4d')]({'where':{'id':_0x156ac9[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](function(_0x212e37){if(_[_0x0d24('0x5b')](_0x212e37)){throw new ReferenceError(_0x0d24('0x5c'));}return _0x212e37;})['then'](function(_0xc006b6){var _0x973c98=_0xc006b6[_0x0d24('0x53')];logger[_0x0d24('0x5d')](_0x0d24('0x5e'),_0x973c98);if(!_['isNil'](_0xc006b6[_0x0d24('0x53')])&&fs[_0x0d24('0x54')](_0x973c98)){logger['info']('File:\x20\x22'+_0x973c98+_0x0d24('0x5f'));fs[_0x0d24('0x60')](_0x973c98);}_0x973c98=_0x973c98+'.cypher';if(!_['isNil'](_0xc006b6['savePath'])&&fs[_0x0d24('0x54')](_0x973c98)){logger[_0x0d24('0x5d')](_0x0d24('0x61')+_0x973c98+_0x0d24('0x5f'));fs[_0x0d24('0x60')](_0x973c98);}return _0xc006b6;})[_0x0d24('0x24')](function(_0x520f33){if(!_0x520f33)throw new InternalError();return _0x520f33[_0x0d24('0x62')]();})[_0x0d24('0x24')](function(){_0x2bf96d[_0x0d24('0x1a')](0xcc)[_0x0d24('0x1b')]();})['catch'](handleError(_0x2bf96d,null));}; \ No newline at end of file +var _0x1ae2=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareRecording','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','body','../../components/encryptor','uniqueid','filename','savePath','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1ad901,_0x308bcc){var _0x36d37d=function(_0x32318e){while(--_0x32318e){_0x1ad901['push'](_0x1ad901['shift']());}};_0x36d37d(++_0x308bcc);}(_0x1ae2,0xb8));var _0x21ae=function(_0x236548,_0x5d0bcd){_0x236548=_0x236548-0x0;var _0x2d6c82=_0x1ae2[_0x236548];return _0x2d6c82;};'use strict';var emlformat=require(_0x21ae('0x0'));var rimraf=require(_0x21ae('0x1'));var zipdir=require(_0x21ae('0x2'));var jsonpatch=require(_0x21ae('0x3'));var rp=require(_0x21ae('0x4'));var moment=require('moment');var BPromise=require(_0x21ae('0x5'));var Mustache=require('mustache');var util=require(_0x21ae('0x6'));var path=require(_0x21ae('0x7'));var sox=require(_0x21ae('0x8'));var csv=require(_0x21ae('0x9'));var ejs=require(_0x21ae('0xa'));var fs=require('fs');var fs_extra=require(_0x21ae('0xb'));var _=require(_0x21ae('0xc'));var squel=require(_0x21ae('0xd'));var crypto=require(_0x21ae('0xe'));var jsforce=require(_0x21ae('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x21ae('0x9'));var querystring=require(_0x21ae('0x10'));var Papa=require(_0x21ae('0x11'));var Redis=require(_0x21ae('0x12'));var authService=require(_0x21ae('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x21ae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x21ae('0x15'));var utils=require(_0x21ae('0x16'));var config=require(_0x21ae('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffa81,_0x16a908){_0x16a908=_0x16a908||0xcc;return function(_0xbf83eb){if(_0xbf83eb){return _0x2ffa81['sendStatus'](_0x16a908);}return _0x2ffa81['status'](_0x16a908)[_0x21ae('0x18')]();};}function respondWithResult(_0x794521,_0x46cb79){_0x46cb79=_0x46cb79||0xc8;return function(_0x624c08){if(_0x624c08){return _0x794521[_0x21ae('0x19')](_0x46cb79)[_0x21ae('0x1a')](_0x624c08);}};}function respondWithFilteredResult(_0x266bb1,_0x39d5db){return function(_0x239922){if(_0x239922){var _0x4aba65=typeof _0x39d5db[_0x21ae('0x1b')]===_0x21ae('0x1c')&&typeof _0x39d5db[_0x21ae('0x1d')]===_0x21ae('0x1c');var _0xe0657f=_0x239922[_0x21ae('0x1e')];var _0x571824=_0x4aba65?0x0:_0x39d5db['offset'];var _0x15ec84=_0x4aba65?_0x239922[_0x21ae('0x1e')]:_0x39d5db[_0x21ae('0x1b')]+_0x39d5db[_0x21ae('0x1d')];var _0x1acaaf;if(_0x15ec84>=_0xe0657f){_0x15ec84=_0xe0657f;_0x1acaaf=0xc8;}else{_0x1acaaf=0xce;}_0x266bb1['status'](_0x1acaaf);return _0x266bb1[_0x21ae('0x1f')]('Content-Range',_0x571824+'-'+_0x15ec84+'/'+_0xe0657f)[_0x21ae('0x1a')](_0x239922);}return null;};}function patchUpdates(_0x5ad8ca){return function(_0x5c224f){try{jsonpatch[_0x21ae('0x20')](_0x5c224f,_0x5ad8ca,!![]);}catch(_0x122648){return BPromise['reject'](_0x122648);}return _0x5c224f[_0x21ae('0x21')]();};}function saveUpdates(_0x5e13c1,_0x4a6c0c){return function(_0x33a081){if(_0x33a081){return _0x33a081[_0x21ae('0x22')](_0x5e13c1)[_0x21ae('0x23')](function(_0x212b1a){return _0x212b1a;});}return null;};}function removeEntity(_0x5285cf,_0x8c6b25){return function(_0x2630ed){if(_0x2630ed){return _0x2630ed[_0x21ae('0x24')]()[_0x21ae('0x23')](function(){_0x5285cf[_0x21ae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57cb20,_0x198f13){return function(_0x47dcbb){if(!_0x47dcbb){_0x57cb20[_0x21ae('0x25')](0x194);}return _0x47dcbb;};}function handleError(_0xdea95b,_0x4ef16a){_0x4ef16a=_0x4ef16a||0x1f4;return function(_0x169b4b){logger[_0x21ae('0x26')](_0x169b4b[_0x21ae('0x27')]);if(_0x169b4b['name']){delete _0x169b4b[_0x21ae('0x28')];}_0xdea95b[_0x21ae('0x19')](_0x4ef16a)[_0x21ae('0x29')](_0x169b4b);};}exports[_0x21ae('0x2a')]=function(_0x50dde8,_0x20f3b1){var _0x4bd79b={},_0x41e3b1={},_0x1c02dd={'count':0x0,'rows':[]};var _0x10d937=_['map'](db[_0x21ae('0x2b')]['rawAttributes'],function(_0x533563){return{'name':_0x533563[_0x21ae('0x2c')],'type':_0x533563[_0x21ae('0x2d')][_0x21ae('0x2e')]};});_0x41e3b1[_0x21ae('0x2f')]=_['map'](_0x10d937,_0x21ae('0x28'));_0x41e3b1[_0x21ae('0x30')]=_['keys'](_0x50dde8[_0x21ae('0x30')]);_0x41e3b1['filters']=_['intersection'](_0x41e3b1[_0x21ae('0x2f')],_0x41e3b1['query']);_0x4bd79b[_0x21ae('0x31')]=_['intersection'](_0x41e3b1[_0x21ae('0x2f')],qs[_0x21ae('0x32')](_0x50dde8[_0x21ae('0x30')]['fields']));_0x4bd79b[_0x21ae('0x31')]=_0x4bd79b[_0x21ae('0x31')][_0x21ae('0x33')]?_0x4bd79b[_0x21ae('0x31')]:_0x41e3b1[_0x21ae('0x2f')];if(!_0x50dde8['query'][_0x21ae('0x34')](_0x21ae('0x35'))){_0x4bd79b[_0x21ae('0x1d')]=qs[_0x21ae('0x1d')](_0x50dde8['query'][_0x21ae('0x1d')]);_0x4bd79b[_0x21ae('0x1b')]=qs[_0x21ae('0x1b')](_0x50dde8['query'][_0x21ae('0x1b')]);}_0x4bd79b[_0x21ae('0x36')]=qs[_0x21ae('0x37')](_0x50dde8[_0x21ae('0x30')][_0x21ae('0x37')]);_0x4bd79b['where']=qs[_0x21ae('0x38')](_[_0x21ae('0x39')](_0x50dde8[_0x21ae('0x30')],_0x41e3b1[_0x21ae('0x38')]),_0x10d937);if(_0x50dde8['query']['filter']){_0x4bd79b[_0x21ae('0x3a')]=_['merge'](_0x4bd79b[_0x21ae('0x3a')],{'$or':_[_0x21ae('0x3b')](_0x10d937,function(_0x2888ef){if(_0x2888ef[_0x21ae('0x2d')]!==_0x21ae('0x3c')){var _0x24dc07={};_0x24dc07[_0x2888ef[_0x21ae('0x28')]]={'$like':'%'+_0x50dde8[_0x21ae('0x30')][_0x21ae('0x3d')]+'%'};return _0x24dc07;}})});}_0x4bd79b=_[_0x21ae('0x3e')]({},_0x4bd79b,_0x50dde8[_0x21ae('0x3f')]);var _0xaef4e0={'where':_0x4bd79b[_0x21ae('0x3a')]};return db['SquareRecording'][_0x21ae('0x1e')](_0xaef4e0)[_0x21ae('0x23')](function(_0x389fa9){_0x1c02dd[_0x21ae('0x1e')]=_0x389fa9;if(_0x50dde8['query']['includeAll']){_0x4bd79b[_0x21ae('0x40')]=[{'all':!![]}];}return db[_0x21ae('0x2b')][_0x21ae('0x41')](_0x4bd79b);})[_0x21ae('0x23')](function(_0x25fffe){_0x1c02dd[_0x21ae('0x42')]=_0x25fffe;return _0x1c02dd;})['then'](respondWithFilteredResult(_0x20f3b1,_0x4bd79b))[_0x21ae('0x43')](handleError(_0x20f3b1,null));};exports[_0x21ae('0x44')]=function(_0x8ebf58,_0x5303e1){var _0x296a1e={'raw':!![],'where':{'id':_0x8ebf58[_0x21ae('0x45')]['id']}},_0x45d840={};_0x45d840['model']=_[_0x21ae('0x46')](db[_0x21ae('0x2b')]['rawAttributes']);_0x45d840['query']=_[_0x21ae('0x46')](_0x8ebf58[_0x21ae('0x30')]);_0x45d840[_0x21ae('0x38')]=_[_0x21ae('0x47')](_0x45d840[_0x21ae('0x2f')],_0x45d840['query']);_0x296a1e[_0x21ae('0x31')]=_[_0x21ae('0x47')](_0x45d840[_0x21ae('0x2f')],qs[_0x21ae('0x32')](_0x8ebf58[_0x21ae('0x30')][_0x21ae('0x32')]));_0x296a1e[_0x21ae('0x31')]=_0x296a1e['attributes'][_0x21ae('0x33')]?_0x296a1e[_0x21ae('0x31')]:_0x45d840['model'];if(_0x8ebf58[_0x21ae('0x30')][_0x21ae('0x48')]){_0x296a1e['include']=[{'all':!![]}];}_0x296a1e=_[_0x21ae('0x3e')]({},_0x296a1e,_0x8ebf58['options']);return db[_0x21ae('0x2b')][_0x21ae('0x49')](_0x296a1e)[_0x21ae('0x23')](handleEntityNotFound(_0x5303e1,null))[_0x21ae('0x23')](respondWithResult(_0x5303e1,null))[_0x21ae('0x43')](handleError(_0x5303e1,null));};exports[_0x21ae('0x4a')]=function(_0x3465a8,_0x1c1ade){return db[_0x21ae('0x2b')][_0x21ae('0x4a')](_0x3465a8[_0x21ae('0x4b')],{})[_0x21ae('0x23')](respondWithResult(_0x1c1ade,0xc9))[_0x21ae('0x43')](handleError(_0x1c1ade,null));};exports[_0x21ae('0x22')]=function(_0x33ea40,_0x2d7a62){if(_0x33ea40['body']['id']){delete _0x33ea40[_0x21ae('0x4b')]['id'];}return db[_0x21ae('0x2b')][_0x21ae('0x49')]({'where':{'id':_0x33ea40[_0x21ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d7a62,null))[_0x21ae('0x23')](saveUpdates(_0x33ea40[_0x21ae('0x4b')],null))[_0x21ae('0x23')](respondWithResult(_0x2d7a62,null))[_0x21ae('0x43')](handleError(_0x2d7a62,null));};exports['download']=function(_0x11b450,_0x3439a9,_0x3a805e){var _0xebe9b7=require(_0x21ae('0x4c'));var _0x2b5044=![];var _0x272897={};if(_0x11b450[_0x21ae('0x30')][_0x21ae('0x2d')]&&_0x11b450[_0x21ae('0x30')][_0x21ae('0x2d')]===_0x21ae('0x4d')){_0x272897[_0x21ae('0x4d')]=_0x11b450[_0x21ae('0x45')]['id'];}else{_0x272897['id']=_0x11b450['params']['id'];}return db[_0x21ae('0x2b')][_0x21ae('0x49')]({'where':_0x272897,'attributes':['id','savePath',_0x21ae('0x4e')],'raw':!![]})[_0x21ae('0x23')](handleEntityNotFound(_0x3439a9,null))[_0x21ae('0x23')](function(_0x44c6cb){if(_0x44c6cb){var _0x54f2ba=_0x44c6cb[_0x21ae('0x4f')];var _0x4f8aca=util['format']('%s.cypher',_0x54f2ba);if(fs[_0x21ae('0x50')](_0x4f8aca)){_0x2b5044=!![];return _0xebe9b7[_0x21ae('0x51')](_0x4f8aca,_0x54f2ba,config[_0x21ae('0x52')][_0x21ae('0x53')])[_0x21ae('0x23')](function(){return _0x44c6cb;});}return _0x44c6cb;}})[_0x21ae('0x23')](function(_0x82afc1){if(_0x82afc1){var _0x28c1a0=_0x82afc1['savePath'];if(!fs[_0x21ae('0x50')](_0x28c1a0)){throw new db['Sequelize'][(_0x21ae('0x54'))](_0x21ae('0x55'));}if(_0x82afc1[_0x21ae('0x4e')]){return _0x3439a9[_0x21ae('0x56')](_0x28c1a0,_0x82afc1['filename']+path[_0x21ae('0x57')](_0x28c1a0),function(){if(_0x2b5044){fs[_0x21ae('0x58')](_0x28c1a0);}});}else{return _0x3439a9[_0x21ae('0x56')](_0x28c1a0,function(_0x1e90ec){if(_0x2b5044){fs[_0x21ae('0x58')](_0x28c1a0);}});}}})['catch'](function(_0x1604a3){if(_0x1604a3[_0x21ae('0x59')]===_0x21ae('0x55')){_0x3439a9[_0x21ae('0x19')](0x194)[_0x21ae('0x29')](_0x21ae('0x5a'));}else{return handleError(_0x3439a9,null);}});};exports[_0x21ae('0x24')]=function(_0x17cd4a,_0x415252){return db[_0x21ae('0x2b')][_0x21ae('0x49')]({'where':{'id':_0x17cd4a[_0x21ae('0x45')]['id']}})['then'](function(_0x5e74d4){if(_[_0x21ae('0x5b')](_0x5e74d4)){throw new ReferenceError(_0x21ae('0x5c'));}return _0x5e74d4;})[_0x21ae('0x23')](function(_0x1c5e54){var _0x144fe6=_0x1c5e54[_0x21ae('0x4f')];logger[_0x21ae('0x5d')](_0x21ae('0x5e'),_0x144fe6);if(!_[_0x21ae('0x5b')](_0x1c5e54[_0x21ae('0x4f')])&&fs[_0x21ae('0x50')](_0x144fe6)){logger[_0x21ae('0x5d')](_0x21ae('0x5f')+_0x144fe6+_0x21ae('0x60'));fs[_0x21ae('0x61')](_0x144fe6);}_0x144fe6=_0x144fe6+_0x21ae('0x62');if(!_['isNil'](_0x1c5e54[_0x21ae('0x4f')])&&fs['existsSync'](_0x144fe6)){logger[_0x21ae('0x5d')](_0x21ae('0x5f')+_0x144fe6+_0x21ae('0x60'));fs[_0x21ae('0x61')](_0x144fe6);}return _0x1c5e54;})[_0x21ae('0x23')](function(_0x1cef82){if(!_0x1cef82)throw new InternalError();return _0x1cef82[_0x21ae('0x24')]();})[_0x21ae('0x23')](function(){_0x415252[_0x21ae('0x19')](0xcc)[_0x21ae('0x18')]();})[_0x21ae('0x43')](handleError(_0x415252,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8232559..4629ebf 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 _0x444e=['moment','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','lodash','../../config/logger'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0x444e,0xe8));var _0xe444=function(_0x33c818,_0x3f06ff){_0x33c818=_0x33c818-0x0;var _0x102413=_0x444e[_0x33c818];return _0x102413;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9fb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','square_recordings','lodash','util','../../config/logger'];(function(_0x54547d,_0x24d51f){var _0x333c1d=function(_0x4deeae){while(--_0x4deeae){_0x54547d['push'](_0x54547d['shift']());}};_0x333c1d(++_0x24d51f);}(_0xd9fb,0x189));var _0xbd9f=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xd9fb[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var logger=require(_0xbd9f('0x2'))(_0xbd9f('0x3'));var moment=require(_0xbd9f('0x4'));var BPromise=require(_0xbd9f('0x5'));var rp=require(_0xbd9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd9f('0x7'));var config=require(_0xbd9f('0x8'));var attributes=require('./squareRecording.attributes');module[_0xbd9f('0x9')]=function(_0x5b6052,_0x2e7eea){return _0x5b6052[_0xbd9f('0xa')]('SquareRecording',attributes,{'tableName':_0xbd9f('0xb'),'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 650baec..4acd7a3 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 _0xe84f=['create','body','options','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording'];(function(_0x23f0d8,_0x337357){var _0x52a486=function(_0x1ad078){while(--_0x1ad078){_0x23f0d8['push'](_0x23f0d8['shift']());}};_0x52a486(++_0x337357);}(_0xe84f,0x155));var _0xfe84=function(_0x3b8dbd,_0x2c2129){_0x3b8dbd=_0x3b8dbd-0x0;var _0x53a86c=_0xe84f[_0x3b8dbd];return _0x53a86c;};'use strict';var _=require(_0xfe84('0x0'));var util=require('util');var moment=require(_0xfe84('0x1'));var BPromise=require(_0xfe84('0x2'));var rs=require(_0xfe84('0x3'));var fs=require('fs');var Redis=require(_0xfe84('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe84('0x5'));var config=require(_0xfe84('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe84('0x7')][_0xfe84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fa3c2,_0x28b2c4,_0xaa0dc2){return new BPromise(function(_0x2ce724,_0x2b06ea){return client[_0xfe84('0x9')](_0x2fa3c2,_0xaa0dc2)[_0xfe84('0xa')](function(_0x459ff4){logger[_0xfe84('0xb')](_0xfe84('0xc'),_0x28b2c4,_0xfe84('0xd'));logger[_0xfe84('0xe')](_0xfe84('0xf'),_0x28b2c4,_0xfe84('0xd'),JSON[_0xfe84('0x10')](_0x459ff4));if(_0x459ff4[_0xfe84('0x11')]){if(_0x459ff4['error'][_0xfe84('0x12')]===0x1f4){logger['error'](_0xfe84('0xc'),_0x28b2c4,_0x459ff4[_0xfe84('0x11')][_0xfe84('0x13')]);return _0x2b06ea(_0x459ff4['error'][_0xfe84('0x13')]);}logger[_0xfe84('0x11')](_0xfe84('0xc'),_0x28b2c4,_0x459ff4[_0xfe84('0x11')]['message']);return _0x2ce724(_0x459ff4[_0xfe84('0x11')][_0xfe84('0x13')]);}else{logger['info'](_0xfe84('0xc'),_0x28b2c4,_0xfe84('0xd'));_0x2ce724(_0x459ff4[_0xfe84('0x14')][_0xfe84('0x13')]);}})['catch'](function(_0x5e3b5d){logger[_0xfe84('0x11')](_0xfe84('0xc'),_0x28b2c4,_0x5e3b5d);_0x2b06ea(_0x5e3b5d);});});}exports[_0xfe84('0x15')]=function(_0x1715a0){var _0x152101=this;return new Promise(function(_0x250f0d,_0xc8d423){return db[_0xfe84('0x16')][_0xfe84('0x17')](_0x1715a0[_0xfe84('0x18')],{'raw':_0x1715a0[_0xfe84('0x19')]?_0x1715a0[_0xfe84('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfe84('0xa')](function(_0x50a9a6){logger[_0xfe84('0xb')](_0xfe84('0x15'),_0x1715a0);logger[_0xfe84('0xe')]('CreateSquareRecording',_0x1715a0,JSON[_0xfe84('0x10')](_0x50a9a6));_0x250f0d(_0x50a9a6);})['catch'](function(_0x26b892){logger[_0xfe84('0x11')]('CreateSquareRecording',_0x26b892[_0xfe84('0x13')],_0x1715a0);_0xc8d423(_0x152101[_0xfe84('0x11')](0x1f4,_0x26b892['message']));});});}; \ No newline at end of file +var _0x88e8=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','options','then','debug','moment','bluebird'];(function(_0x1e8f8e,_0x4d974e){var _0x4ed7ba=function(_0x5d275d){while(--_0x5d275d){_0x1e8f8e['push'](_0x1e8f8e['shift']());}};_0x4ed7ba(++_0x4d974e);}(_0x88e8,0x16e));var _0x888e=function(_0x227bfa,_0x51bedc){_0x227bfa=_0x227bfa-0x0;var _0x331aba=_0x88e8[_0x227bfa];return _0x331aba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x888e('0x0'));var BPromise=require(_0x888e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x888e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x888e('0x3'))(_0x888e('0x4'));var config=require(_0x888e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x888e('0x6')][_0x888e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x515052,_0x4a14ef,_0x4c47b1){return new BPromise(function(_0x52b058,_0x3be31f){return client['request'](_0x515052,_0x4c47b1)['then'](function(_0x54a857){logger[_0x888e('0x8')](_0x888e('0x9'),_0x4a14ef,_0x888e('0xa'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4a14ef,_0x888e('0xa'),JSON[_0x888e('0xb')](_0x54a857));if(_0x54a857[_0x888e('0xc')]){if(_0x54a857[_0x888e('0xc')][_0x888e('0xd')]===0x1f4){logger[_0x888e('0xc')]('SquareRecording,\x20%s,\x20%s',_0x4a14ef,_0x54a857[_0x888e('0xc')][_0x888e('0xe')]);return _0x3be31f(_0x54a857['error'][_0x888e('0xe')]);}logger[_0x888e('0xc')](_0x888e('0x9'),_0x4a14ef,_0x54a857[_0x888e('0xc')][_0x888e('0xe')]);return _0x52b058(_0x54a857[_0x888e('0xc')]['message']);}else{logger[_0x888e('0x8')](_0x888e('0x9'),_0x4a14ef,'request\x20sent');_0x52b058(_0x54a857[_0x888e('0xf')]['message']);}})[_0x888e('0x10')](function(_0x840fc1){logger[_0x888e('0xc')]('SquareRecording,\x20%s,\x20%s',_0x4a14ef,_0x840fc1);_0x3be31f(_0x840fc1);});});}exports[_0x888e('0x11')]=function(_0x19dbc0){var _0x58a28e=this;return new Promise(function(_0xfa3b4a,_0x753960){return db[_0x888e('0x12')]['create'](_0x19dbc0[_0x888e('0x13')],{'raw':_0x19dbc0[_0x888e('0x14')]?_0x19dbc0[_0x888e('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x888e('0x15')](function(_0x3997b0){logger[_0x888e('0x8')]('CreateSquareRecording',_0x19dbc0);logger[_0x888e('0x16')](_0x888e('0x11'),_0x19dbc0,JSON['stringify'](_0x3997b0));_0xfa3b4a(_0x3997b0);})[_0x888e('0x10')](function(_0x4f90f9){logger[_0x888e('0xc')](_0x888e('0x11'),_0x4f90f9[_0x888e('0xe')],_0x19dbc0);_0x753960(_0x58a28e[_0x888e('0xc')](0x1f4,_0x4f90f9[_0x888e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6fa5f21..eff0879 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3121ef,_0x2db327){var _0x167958=function(_0x369fef){while(--_0x369fef){_0x3121ef['push'](_0x3121ef['shift']());}};_0x167958(++_0x2db327);}(_0xe706,0xa3));var _0x6e70=function(_0x39d625,_0xcbd247){_0x39d625=_0x39d625-0x0;var _0x45bafa=_0xe706[_0x39d625];return _0x45bafa;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1fdcb6,_0xc8986e){var _0xda3086=function(_0x43b044){while(--_0x43b044){_0x1fdcb6['push'](_0x1fdcb6['shift']());}};_0xda3086(++_0xc8986e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3c71b75..be3c7a8 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 _0xa161=['BOOLEAN','exports','STRING','DATE'];(function(_0x133139,_0x5d98dd){var _0x9581f8=function(_0x19e453){while(--_0x19e453){_0x133139['push'](_0x133139['shift']());}};_0x9581f8(++_0x5d98dd);}(_0xa161,0xd1));var _0x1a16=function(_0x4bb7ab,_0x2ec9cd){_0x4bb7ab=_0x4bb7ab-0x0;var _0x1a51e9=_0xa161[_0x4bb7ab];return _0x1a51e9;};'use strict';var Sequelize=require('sequelize');module[_0x1a16('0x0')]={'network':{'type':Sequelize[_0x1a16('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x1a16('0x1')]},'channel':{'type':Sequelize[_0x1a16('0x1')]},'language':{'type':Sequelize[_0x1a16('0x1')]},'type':{'type':Sequelize[_0x1a16('0x1')]},'uniqueid':{'type':Sequelize[_0x1a16('0x1')]},'version':{'type':Sequelize[_0x1a16('0x1')]},'callerid':{'type':Sequelize[_0x1a16('0x1')]},'calleridname':{'type':Sequelize[_0x1a16('0x1')]},'callingpres':{'type':Sequelize[_0x1a16('0x1')]},'callingani2':{'type':Sequelize[_0x1a16('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x1a16('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1a16('0x1')]},'extension':{'type':Sequelize[_0x1a16('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1a16('0x1')]},'accountcode':{'type':Sequelize[_0x1a16('0x1')]},'threadid':{'type':Sequelize[_0x1a16('0x1')]},'project_name':{'type':Sequelize[_0x1a16('0x1')]},'joinAt':{'type':Sequelize[_0x1a16('0x2')]},'leaveAt':{'type':Sequelize[_0x1a16('0x2')]},'bot':{'type':Sequelize[_0x1a16('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x30aa=['STRING','DATE','BOOLEAN','exports'];(function(_0x41dcab,_0x35e42d){var _0x24d1c8=function(_0x27987c){while(--_0x27987c){_0x41dcab['push'](_0x41dcab['shift']());}};_0x24d1c8(++_0x35e42d);}(_0x30aa,0x17b));var _0xa30a=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x30aa[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0xa30a('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xa30a('0x1')]},'request':{'type':Sequelize[_0xa30a('0x1')]},'channel':{'type':Sequelize[_0xa30a('0x1')]},'language':{'type':Sequelize[_0xa30a('0x1')]},'type':{'type':Sequelize[_0xa30a('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa30a('0x1')]},'calleridname':{'type':Sequelize[_0xa30a('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xa30a('0x1')]},'callington':{'type':Sequelize[_0xa30a('0x1')]},'callingtns':{'type':Sequelize[_0xa30a('0x1')]},'dnid':{'type':Sequelize[_0xa30a('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa30a('0x1')]},'extension':{'type':Sequelize[_0xa30a('0x1')]},'priority':{'type':Sequelize[_0xa30a('0x1')]},'enhanced':{'type':Sequelize[_0xa30a('0x1')]},'accountcode':{'type':Sequelize[_0xa30a('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa30a('0x1')]},'joinAt':{'type':Sequelize[_0xa30a('0x2')]},'leaveAt':{'type':Sequelize[_0xa30a('0x2')]},'bot':{'type':Sequelize[_0xa30a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a4bcc68..84440c6 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 _0x372c=['send','map','SquareReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','nolimit','order','where','pick','filters','filter','merge','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','name'];(function(_0x121660,_0xa161ef){var _0x5ca38d=function(_0xaabcdf){while(--_0xaabcdf){_0x121660['push'](_0x121660['shift']());}};_0x5ca38d(++_0xa161ef);}(_0x372c,0xe9));var _0xc372=function(_0x46f89d,_0x2e4c42){_0x46f89d=_0x46f89d-0x0;var _0x2162f1=_0x372c[_0x46f89d];return _0x2162f1;};'use strict';var emlformat=require(_0xc372('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc372('0x1'));var jsonpatch=require(_0xc372('0x2'));var rp=require(_0xc372('0x3'));var moment=require(_0xc372('0x4'));var BPromise=require(_0xc372('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc372('0x6'));var sox=require(_0xc372('0x7'));var csv=require(_0xc372('0x8'));var ejs=require(_0xc372('0x9'));var fs=require('fs');var fs_extra=require(_0xc372('0xa'));var _=require(_0xc372('0xb'));var squel=require(_0xc372('0xc'));var crypto=require(_0xc372('0xd'));var jsforce=require(_0xc372('0xe'));var deskjs=require(_0xc372('0xf'));var toCsv=require(_0xc372('0x8'));var querystring=require('querystring');var Papa=require(_0xc372('0x10'));var Redis=require(_0xc372('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc372('0x12'));var hardwareService=require(_0xc372('0x13'));var logger=require(_0xc372('0x14'))('api');var utils=require(_0xc372('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc372('0x16'));var db=require(_0xc372('0x17'))['db'];function respondWithStatusCode(_0x565b34,_0x475a91){_0x475a91=_0x475a91||0xcc;return function(_0x52c764){if(_0x52c764){return _0x565b34[_0xc372('0x18')](_0x475a91);}return _0x565b34[_0xc372('0x19')](_0x475a91)[_0xc372('0x1a')]();};}function respondWithResult(_0x3cd014,_0x3b17f2){_0x3b17f2=_0x3b17f2||0xc8;return function(_0x104135){if(_0x104135){return _0x3cd014[_0xc372('0x19')](_0x3b17f2)[_0xc372('0x1b')](_0x104135);}};}function respondWithFilteredResult(_0x103635,_0x8ad8){return function(_0x3c9c77){if(_0x3c9c77){var _0x3e7bf6=typeof _0x8ad8[_0xc372('0x1c')]===_0xc372('0x1d')&&typeof _0x8ad8['limit']===_0xc372('0x1d');var _0x1723e=_0x3c9c77[_0xc372('0x1e')];var _0x28cbaa=_0x3e7bf6?0x0:_0x8ad8[_0xc372('0x1c')];var _0x96f8a=_0x3e7bf6?_0x3c9c77[_0xc372('0x1e')]:_0x8ad8[_0xc372('0x1c')]+_0x8ad8[_0xc372('0x1f')];var _0x5d50ae;if(_0x96f8a>=_0x1723e){_0x96f8a=_0x1723e;_0x5d50ae=0xc8;}else{_0x5d50ae=0xce;}_0x103635[_0xc372('0x19')](_0x5d50ae);return _0x103635['set'](_0xc372('0x20'),_0x28cbaa+'-'+_0x96f8a+'/'+_0x1723e)[_0xc372('0x1b')](_0x3c9c77);}return null;};}function patchUpdates(_0x52d881){return function(_0x44fb9a){try{jsonpatch['apply'](_0x44fb9a,_0x52d881,!![]);}catch(_0x25332a){return BPromise['reject'](_0x25332a);}return _0x44fb9a[_0xc372('0x21')]();};}function saveUpdates(_0x48b5e3,_0x1ca2d8){return function(_0x529352){if(_0x529352){return _0x529352[_0xc372('0x22')](_0x48b5e3)[_0xc372('0x23')](function(_0xa0b7e5){return _0xa0b7e5;});}return null;};}function removeEntity(_0x4c07c6,_0x2e4237){return function(_0x54ced1){if(_0x54ced1){return _0x54ced1[_0xc372('0x24')]()[_0xc372('0x23')](function(){_0x4c07c6[_0xc372('0x19')](0xcc)[_0xc372('0x1a')]();});}};}function handleEntityNotFound(_0x32387c,_0x9fd7ac){return function(_0x4cd267){if(!_0x4cd267){_0x32387c[_0xc372('0x18')](0x194);}return _0x4cd267;};}function handleError(_0x1dd8a7,_0x32cb6d){_0x32cb6d=_0x32cb6d||0x1f4;return function(_0x3b4570){logger[_0xc372('0x25')](_0x3b4570['stack']);if(_0x3b4570[_0xc372('0x26')]){delete _0x3b4570[_0xc372('0x26')];}_0x1dd8a7[_0xc372('0x19')](_0x32cb6d)[_0xc372('0x27')](_0x3b4570);};}exports['index']=function(_0x51eaf8,_0x46fe9f){var _0x594b1e={},_0xbc4d2c={},_0x525ee8={'count':0x0,'rows':[]};var _0x7acac6=_[_0xc372('0x28')](db[_0xc372('0x29')][_0xc372('0x2a')],function(_0x33c991){return{'name':_0x33c991['fieldName'],'type':_0x33c991[_0xc372('0x2b')]['key']};});_0xbc4d2c[_0xc372('0x2c')]=_[_0xc372('0x28')](_0x7acac6,_0xc372('0x26'));_0xbc4d2c[_0xc372('0x2d')]=_[_0xc372('0x2e')](_0x51eaf8[_0xc372('0x2d')]);_0xbc4d2c['filters']=_['intersection'](_0xbc4d2c[_0xc372('0x2c')],_0xbc4d2c[_0xc372('0x2d')]);_0x594b1e['attributes']=_[_0xc372('0x2f')](_0xbc4d2c['model'],qs[_0xc372('0x30')](_0x51eaf8[_0xc372('0x2d')][_0xc372('0x30')]));_0x594b1e[_0xc372('0x31')]=_0x594b1e[_0xc372('0x31')]['length']?_0x594b1e[_0xc372('0x31')]:_0xbc4d2c[_0xc372('0x2c')];if(!_0x51eaf8[_0xc372('0x2d')]['hasOwnProperty'](_0xc372('0x32'))){_0x594b1e[_0xc372('0x1f')]=qs['limit'](_0x51eaf8[_0xc372('0x2d')]['limit']);_0x594b1e[_0xc372('0x1c')]=qs[_0xc372('0x1c')](_0x51eaf8['query'][_0xc372('0x1c')]);}_0x594b1e[_0xc372('0x33')]=qs['sort'](_0x51eaf8['query']['sort']);_0x594b1e[_0xc372('0x34')]=qs['filters'](_[_0xc372('0x35')](_0x51eaf8[_0xc372('0x2d')],_0xbc4d2c[_0xc372('0x36')]),_0x7acac6);if(_0x51eaf8[_0xc372('0x2d')][_0xc372('0x37')]){_0x594b1e['where']=_['merge'](_0x594b1e[_0xc372('0x34')],{'$or':_[_0xc372('0x28')](_0x7acac6,function(_0x66720e){if(_0x66720e['type']!=='VIRTUAL'){var _0x15b160={};_0x15b160[_0x66720e[_0xc372('0x26')]]={'$like':'%'+_0x51eaf8[_0xc372('0x2d')][_0xc372('0x37')]+'%'};return _0x15b160;}})});}_0x594b1e=_[_0xc372('0x38')]({},_0x594b1e,_0x51eaf8['options']);var _0x6904fa={'where':_0x594b1e[_0xc372('0x34')]};return db[_0xc372('0x29')]['count'](_0x6904fa)[_0xc372('0x23')](function(_0x9b5477){_0x525ee8[_0xc372('0x1e')]=_0x9b5477;if(_0x51eaf8[_0xc372('0x2d')]['includeAll']){_0x594b1e['include']=[{'all':!![]}];}return db['SquareReport'][_0xc372('0x39')](_0x594b1e);})[_0xc372('0x23')](function(_0x8cb793){_0x525ee8[_0xc372('0x3a')]=_0x8cb793;return _0x525ee8;})[_0xc372('0x23')](respondWithFilteredResult(_0x46fe9f,_0x594b1e))[_0xc372('0x3b')](handleError(_0x46fe9f,null));};exports[_0xc372('0x3c')]=function(_0x5da5b9,_0x82414a){var _0x2aee9b={'raw':!![],'where':{'id':_0x5da5b9[_0xc372('0x3d')]['id']}},_0x376436={};_0x376436[_0xc372('0x2c')]=_[_0xc372('0x2e')](db['SquareReport'][_0xc372('0x2a')]);_0x376436[_0xc372('0x2d')]=_[_0xc372('0x2e')](_0x5da5b9['query']);_0x376436[_0xc372('0x36')]=_[_0xc372('0x2f')](_0x376436['model'],_0x376436['query']);_0x2aee9b[_0xc372('0x31')]=_[_0xc372('0x2f')](_0x376436['model'],qs[_0xc372('0x30')](_0x5da5b9['query'][_0xc372('0x30')]));_0x2aee9b[_0xc372('0x31')]=_0x2aee9b[_0xc372('0x31')]['length']?_0x2aee9b[_0xc372('0x31')]:_0x376436[_0xc372('0x2c')];if(_0x5da5b9[_0xc372('0x2d')][_0xc372('0x3e')]){_0x2aee9b[_0xc372('0x3f')]=[{'all':!![]}];}_0x2aee9b=_[_0xc372('0x38')]({},_0x2aee9b,_0x5da5b9['options']);return db[_0xc372('0x29')][_0xc372('0x40')](_0x2aee9b)[_0xc372('0x23')](handleEntityNotFound(_0x82414a,null))[_0xc372('0x23')](respondWithResult(_0x82414a,null))[_0xc372('0x3b')](handleError(_0x82414a,null));};exports['create']=function(_0x46dc1d,_0x57ceee){return db['SquareReport'][_0xc372('0x41')](_0x46dc1d[_0xc372('0x42')],{})['then'](respondWithResult(_0x57ceee,0xc9))[_0xc372('0x3b')](handleError(_0x57ceee,null));};exports['update']=function(_0x341958,_0x159bdd){if(_0x341958[_0xc372('0x42')]['id']){delete _0x341958[_0xc372('0x42')]['id'];}return db['SquareReport'][_0xc372('0x40')]({'where':{'id':_0x341958[_0xc372('0x3d')]['id']}})[_0xc372('0x23')](handleEntityNotFound(_0x159bdd,null))[_0xc372('0x23')](saveUpdates(_0x341958[_0xc372('0x42')],null))[_0xc372('0x23')](respondWithResult(_0x159bdd,null))[_0xc372('0x3b')](handleError(_0x159bdd,null));};exports['destroy']=function(_0xe3c598,_0xd4a4dc){return db['SquareReport']['find']({'where':{'id':_0xe3c598['params']['id']}})['then'](handleEntityNotFound(_0xd4a4dc,null))[_0xc372('0x23')](removeEntity(_0xd4a4dc,null))[_0xc372('0x3b')](handleError(_0xd4a4dc,null));};exports['describe']=function(_0x580e9e,_0x151b9c){return db['SquareReport'][_0xc372('0x43')]()[_0xc372('0x23')](respondWithResult(_0x151b9c,null))['catch'](handleError(_0x151b9c,null));}; \ No newline at end of file +var _0x6b22=['index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send'];(function(_0x54801d,_0x1baea4){var _0x1ef8a5=function(_0x481c4b){while(--_0x481c4b){_0x54801d['push'](_0x54801d['shift']());}};_0x1ef8a5(++_0x1baea4);}(_0x6b22,0x1eb));var _0x26b2=function(_0x806c7f,_0x5cc0b2){_0x806c7f=_0x806c7f-0x0;var _0x29f346=_0x6b22[_0x806c7f];return _0x29f346;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26b2('0x0'));var zipdir=require(_0x26b2('0x1'));var jsonpatch=require(_0x26b2('0x2'));var rp=require(_0x26b2('0x3'));var moment=require('moment');var BPromise=require(_0x26b2('0x4'));var Mustache=require(_0x26b2('0x5'));var util=require('util');var path=require(_0x26b2('0x6'));var sox=require(_0x26b2('0x7'));var csv=require(_0x26b2('0x8'));var ejs=require(_0x26b2('0x9'));var fs=require('fs');var fs_extra=require(_0x26b2('0xa'));var _=require(_0x26b2('0xb'));var squel=require(_0x26b2('0xc'));var crypto=require(_0x26b2('0xd'));var jsforce=require(_0x26b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x26b2('0x8'));var querystring=require(_0x26b2('0xf'));var Papa=require(_0x26b2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x26b2('0x11'));var as=require(_0x26b2('0x12'));var hardwareService=require(_0x26b2('0x13'));var logger=require(_0x26b2('0x14'))(_0x26b2('0x15'));var utils=require(_0x26b2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26b2('0x17'))['db'];function respondWithStatusCode(_0x33e481,_0x32e62a){_0x32e62a=_0x32e62a||0xcc;return function(_0x3c8676){if(_0x3c8676){return _0x33e481['sendStatus'](_0x32e62a);}return _0x33e481[_0x26b2('0x18')](_0x32e62a)[_0x26b2('0x19')]();};}function respondWithResult(_0x9dc7a6,_0x757408){_0x757408=_0x757408||0xc8;return function(_0xa3e496){if(_0xa3e496){return _0x9dc7a6[_0x26b2('0x18')](_0x757408)[_0x26b2('0x1a')](_0xa3e496);}};}function respondWithFilteredResult(_0x2628fc,_0x20a032){return function(_0xdb48b2){if(_0xdb48b2){var _0x24d22b=typeof _0x20a032[_0x26b2('0x1b')]===_0x26b2('0x1c')&&typeof _0x20a032['limit']===_0x26b2('0x1c');var _0x106bc5=_0xdb48b2['count'];var _0x26c8ea=_0x24d22b?0x0:_0x20a032[_0x26b2('0x1b')];var _0x3d94b2=_0x24d22b?_0xdb48b2[_0x26b2('0x1d')]:_0x20a032[_0x26b2('0x1b')]+_0x20a032[_0x26b2('0x1e')];var _0x5646f8;if(_0x3d94b2>=_0x106bc5){_0x3d94b2=_0x106bc5;_0x5646f8=0xc8;}else{_0x5646f8=0xce;}_0x2628fc['status'](_0x5646f8);return _0x2628fc['set'](_0x26b2('0x1f'),_0x26c8ea+'-'+_0x3d94b2+'/'+_0x106bc5)[_0x26b2('0x1a')](_0xdb48b2);}return null;};}function patchUpdates(_0x16149c){return function(_0x38d2a6){try{jsonpatch['apply'](_0x38d2a6,_0x16149c,!![]);}catch(_0x1ec557){return BPromise[_0x26b2('0x20')](_0x1ec557);}return _0x38d2a6[_0x26b2('0x21')]();};}function saveUpdates(_0x5449f2,_0x287f25){return function(_0x37fc50){if(_0x37fc50){return _0x37fc50[_0x26b2('0x22')](_0x5449f2)[_0x26b2('0x23')](function(_0x5137c5){return _0x5137c5;});}return null;};}function removeEntity(_0x311e47,_0x4b6a9f){return function(_0x495965){if(_0x495965){return _0x495965[_0x26b2('0x24')]()[_0x26b2('0x23')](function(){_0x311e47[_0x26b2('0x18')](0xcc)[_0x26b2('0x19')]();});}};}function handleEntityNotFound(_0x1c3fe1,_0x3f12c0){return function(_0xb429ca){if(!_0xb429ca){_0x1c3fe1[_0x26b2('0x25')](0x194);}return _0xb429ca;};}function handleError(_0x40177d,_0x1c4a5a){_0x1c4a5a=_0x1c4a5a||0x1f4;return function(_0x1230ea){logger['error'](_0x1230ea[_0x26b2('0x26')]);if(_0x1230ea[_0x26b2('0x27')]){delete _0x1230ea['name'];}_0x40177d[_0x26b2('0x18')](_0x1c4a5a)[_0x26b2('0x28')](_0x1230ea);};}exports[_0x26b2('0x29')]=function(_0x2b610f,_0x1c9c69){var _0x13f542={},_0x245416={},_0x41f7d5={'count':0x0,'rows':[]};var _0x50c502=_[_0x26b2('0x2a')](db['SquareReport'][_0x26b2('0x2b')],function(_0x3d987f){return{'name':_0x3d987f[_0x26b2('0x2c')],'type':_0x3d987f[_0x26b2('0x2d')][_0x26b2('0x2e')]};});_0x245416['model']=_[_0x26b2('0x2a')](_0x50c502,_0x26b2('0x27'));_0x245416[_0x26b2('0x2f')]=_['keys'](_0x2b610f[_0x26b2('0x2f')]);_0x245416['filters']=_[_0x26b2('0x30')](_0x245416['model'],_0x245416[_0x26b2('0x2f')]);_0x13f542[_0x26b2('0x31')]=_[_0x26b2('0x30')](_0x245416[_0x26b2('0x32')],qs[_0x26b2('0x33')](_0x2b610f['query']['fields']));_0x13f542['attributes']=_0x13f542[_0x26b2('0x31')][_0x26b2('0x34')]?_0x13f542[_0x26b2('0x31')]:_0x245416['model'];if(!_0x2b610f[_0x26b2('0x2f')]['hasOwnProperty'](_0x26b2('0x35'))){_0x13f542[_0x26b2('0x1e')]=qs[_0x26b2('0x1e')](_0x2b610f[_0x26b2('0x2f')]['limit']);_0x13f542[_0x26b2('0x1b')]=qs[_0x26b2('0x1b')](_0x2b610f['query'][_0x26b2('0x1b')]);}_0x13f542[_0x26b2('0x36')]=qs['sort'](_0x2b610f[_0x26b2('0x2f')][_0x26b2('0x37')]);_0x13f542[_0x26b2('0x38')]=qs[_0x26b2('0x39')](_[_0x26b2('0x3a')](_0x2b610f[_0x26b2('0x2f')],_0x245416[_0x26b2('0x39')]),_0x50c502);if(_0x2b610f[_0x26b2('0x2f')][_0x26b2('0x3b')]){_0x13f542[_0x26b2('0x38')]=_[_0x26b2('0x3c')](_0x13f542['where'],{'$or':_[_0x26b2('0x2a')](_0x50c502,function(_0xb18355){if(_0xb18355['type']!==_0x26b2('0x3d')){var _0x519654={};_0x519654[_0xb18355[_0x26b2('0x27')]]={'$like':'%'+_0x2b610f[_0x26b2('0x2f')]['filter']+'%'};return _0x519654;}})});}_0x13f542=_['merge']({},_0x13f542,_0x2b610f[_0x26b2('0x3e')]);var _0x260a1f={'where':_0x13f542[_0x26b2('0x38')]};return db[_0x26b2('0x3f')][_0x26b2('0x1d')](_0x260a1f)['then'](function(_0x519dbd){_0x41f7d5[_0x26b2('0x1d')]=_0x519dbd;if(_0x2b610f[_0x26b2('0x2f')][_0x26b2('0x40')]){_0x13f542[_0x26b2('0x41')]=[{'all':!![]}];}return db[_0x26b2('0x3f')][_0x26b2('0x42')](_0x13f542);})[_0x26b2('0x23')](function(_0x3b1f06){_0x41f7d5[_0x26b2('0x43')]=_0x3b1f06;return _0x41f7d5;})[_0x26b2('0x23')](respondWithFilteredResult(_0x1c9c69,_0x13f542))['catch'](handleError(_0x1c9c69,null));};exports[_0x26b2('0x44')]=function(_0x51c6ba,_0x32d89b){var _0x5d542d={'raw':!![],'where':{'id':_0x51c6ba[_0x26b2('0x45')]['id']}},_0x451167={};_0x451167['model']=_[_0x26b2('0x46')](db[_0x26b2('0x3f')][_0x26b2('0x2b')]);_0x451167[_0x26b2('0x2f')]=_['keys'](_0x51c6ba[_0x26b2('0x2f')]);_0x451167[_0x26b2('0x39')]=_[_0x26b2('0x30')](_0x451167[_0x26b2('0x32')],_0x451167[_0x26b2('0x2f')]);_0x5d542d[_0x26b2('0x31')]=_[_0x26b2('0x30')](_0x451167[_0x26b2('0x32')],qs[_0x26b2('0x33')](_0x51c6ba[_0x26b2('0x2f')]['fields']));_0x5d542d[_0x26b2('0x31')]=_0x5d542d[_0x26b2('0x31')][_0x26b2('0x34')]?_0x5d542d[_0x26b2('0x31')]:_0x451167[_0x26b2('0x32')];if(_0x51c6ba[_0x26b2('0x2f')][_0x26b2('0x40')]){_0x5d542d[_0x26b2('0x41')]=[{'all':!![]}];}_0x5d542d=_[_0x26b2('0x3c')]({},_0x5d542d,_0x51c6ba[_0x26b2('0x3e')]);return db[_0x26b2('0x3f')][_0x26b2('0x47')](_0x5d542d)[_0x26b2('0x23')](handleEntityNotFound(_0x32d89b,null))[_0x26b2('0x23')](respondWithResult(_0x32d89b,null))[_0x26b2('0x48')](handleError(_0x32d89b,null));};exports[_0x26b2('0x49')]=function(_0x59ec7a,_0x507bb3){return db['SquareReport']['create'](_0x59ec7a[_0x26b2('0x4a')],{})['then'](respondWithResult(_0x507bb3,0xc9))[_0x26b2('0x48')](handleError(_0x507bb3,null));};exports[_0x26b2('0x22')]=function(_0x4e656e,_0x4d0153){if(_0x4e656e[_0x26b2('0x4a')]['id']){delete _0x4e656e['body']['id'];}return db['SquareReport'][_0x26b2('0x47')]({'where':{'id':_0x4e656e[_0x26b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d0153,null))[_0x26b2('0x23')](saveUpdates(_0x4e656e[_0x26b2('0x4a')],null))[_0x26b2('0x23')](respondWithResult(_0x4d0153,null))[_0x26b2('0x48')](handleError(_0x4d0153,null));};exports[_0x26b2('0x24')]=function(_0x2aa55b,_0x58d557){return db['SquareReport'][_0x26b2('0x47')]({'where':{'id':_0x2aa55b[_0x26b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x58d557,null))[_0x26b2('0x23')](removeEntity(_0x58d557,null))[_0x26b2('0x48')](handleError(_0x58d557,null));};exports['describe']=function(_0x3a68c7,_0xf1239f){return db[_0x26b2('0x3f')][_0x26b2('0x4b')]()[_0x26b2('0x23')](respondWithResult(_0xf1239f,null))[_0x26b2('0x48')](handleError(_0xf1239f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index afc24f1..63e9498 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 _0x3748=['uniqueid','leaveAt','lodash','util','api','moment','request-promise','path','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname'];(function(_0x56092a,_0x291ce5){var _0x1c9558=function(_0x5bf0c5){while(--_0x5bf0c5){_0x56092a['push'](_0x56092a['shift']());}};_0x1c9558(++_0x291ce5);}(_0x3748,0xaa));var _0x8374=function(_0x1ffef2,_0x1b0032){_0x1ffef2=_0x1ffef2-0x0;var _0x2c3407=_0x3748[_0x1ffef2];return _0x2c3407;};'use strict';var _=require(_0x8374('0x0'));var util=require(_0x8374('0x1'));var logger=require('../../config/logger')(_0x8374('0x2'));var moment=require(_0x8374('0x3'));var BPromise=require('bluebird');var rp=require(_0x8374('0x4'));var fs=require('fs');var path=require(_0x8374('0x5'));var rimraf=require(_0x8374('0x6'));var config=require('../../config/environment');var attributes=require(_0x8374('0x7'));module['exports']=function(_0x5b3b86,_0x556211){return _0x5b3b86[_0x8374('0x8')](_0x8374('0x9'),attributes,{'tableName':_0x8374('0xa'),'paranoid':![],'indexes':[{'name':_0x8374('0xb'),'fields':[_0x8374('0xc'),'project_name']},{'name':_0x8374('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa5c=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2d6c26,_0x3f7a58){var _0x730030=function(_0x28d7e6){while(--_0x28d7e6){_0x2d6c26['push'](_0x2d6c26['shift']());}};_0x730030(++_0x3f7a58);}(_0xfa5c,0x71));var _0xcfa5=function(_0x194f8c,_0x3faf0d){_0x194f8c=_0x194f8c-0x0;var _0x32e3c9=_0xfa5c[_0x194f8c];return _0x32e3c9;};'use strict';var _=require(_0xcfa5('0x0'));var util=require(_0xcfa5('0x1'));var logger=require(_0xcfa5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcfa5('0x3'));var rp=require(_0xcfa5('0x4'));var fs=require('fs');var path=require(_0xcfa5('0x5'));var rimraf=require(_0xcfa5('0x6'));var config=require('../../config/environment');var attributes=require(_0xcfa5('0x7'));module[_0xcfa5('0x8')]=function(_0x576359,_0x2fa61){return _0x576359[_0xcfa5('0x9')](_0xcfa5('0xa'),attributes,{'tableName':_0xcfa5('0xb'),'paranoid':![],'indexes':[{'name':_0xcfa5('0xc'),'fields':[_0xcfa5('0xd'),_0xcfa5('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0dd3a64..5df59f1 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 _0x89a2=['options','UpdateSquareReport','update','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','body'];(function(_0x5d2bd4,_0x210353){var _0x2b0012=function(_0x491403){while(--_0x491403){_0x5d2bd4['push'](_0x5d2bd4['shift']());}};_0x2b0012(++_0x210353);}(_0x89a2,0x127));var _0x289a=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x89a2[_0x444e8b];return _0x35eb37;};'use strict';var _=require(_0x289a('0x0'));var util=require('util');var moment=require(_0x289a('0x1'));var BPromise=require('bluebird');var rs=require(_0x289a('0x2'));var fs=require('fs');var Redis=require(_0x289a('0x3'));var db=require(_0x289a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x289a('0x5'))(_0x289a('0x6'));var config=require(_0x289a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x289a('0x8')][_0x289a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c08e1,_0x17d589,_0x3b18ac){return new BPromise(function(_0x342727,_0x16036f){return client[_0x289a('0xa')](_0x2c08e1,_0x3b18ac)[_0x289a('0xb')](function(_0x552964){logger[_0x289a('0xc')](_0x289a('0xd'),_0x17d589,_0x289a('0xe'));logger['debug'](_0x289a('0xf'),_0x17d589,_0x289a('0xe'),JSON[_0x289a('0x10')](_0x552964));if(_0x552964[_0x289a('0x11')]){if(_0x552964['error'][_0x289a('0x12')]===0x1f4){logger[_0x289a('0x11')](_0x289a('0xd'),_0x17d589,_0x552964[_0x289a('0x11')][_0x289a('0x13')]);return _0x16036f(_0x552964[_0x289a('0x11')][_0x289a('0x13')]);}logger['error'](_0x289a('0xd'),_0x17d589,_0x552964[_0x289a('0x11')]['message']);return _0x342727(_0x552964[_0x289a('0x11')][_0x289a('0x13')]);}else{logger[_0x289a('0xc')](_0x289a('0xd'),_0x17d589,_0x289a('0xe'));_0x342727(_0x552964['result'][_0x289a('0x13')]);}})[_0x289a('0x14')](function(_0x26d77e){logger[_0x289a('0x11')](_0x289a('0xd'),_0x17d589,_0x26d77e);_0x16036f(_0x26d77e);});});}exports[_0x289a('0x15')]=function(_0x15e3c9){var _0x29e59d=this;return new Promise(function(_0x1128e1,_0x2a63f7){return db[_0x289a('0x16')][_0x289a('0x17')](_0x15e3c9[_0x289a('0x18')],{'raw':_0x15e3c9['options']?_0x15e3c9[_0x289a('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x403d3e){logger['info'](_0x289a('0x15'),_0x15e3c9);logger['debug'](_0x289a('0x15'),_0x15e3c9,JSON[_0x289a('0x10')](_0x403d3e));_0x1128e1(_0x403d3e);})['catch'](function(_0x4e1929){logger[_0x289a('0x11')](_0x289a('0x15'),_0x4e1929[_0x289a('0x13')],_0x15e3c9);_0x2a63f7(_0x29e59d['error'](0x1f4,_0x4e1929[_0x289a('0x13')]));});});};exports[_0x289a('0x1a')]=function(_0x2c7cf0){var _0x40ec9f=this;return new Promise(function(_0x500c71,_0x43c76e){return db[_0x289a('0x16')][_0x289a('0x1b')](_0x2c7cf0[_0x289a('0x18')],{'raw':_0x2c7cf0['options']?_0x2c7cf0['options'][_0x289a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7cf0[_0x289a('0x19')]?_0x2c7cf0[_0x289a('0x19')][_0x289a('0x1d')]||null:null,'attributes':_0x2c7cf0[_0x289a('0x19')]?_0x2c7cf0['options'][_0x289a('0x1e')]||null:null,'limit':_0x2c7cf0['options']?_0x2c7cf0[_0x289a('0x19')][_0x289a('0x1f')]||null:null})[_0x289a('0xb')](function(_0xf3b58c){logger[_0x289a('0xc')](_0x289a('0x1a'),_0x2c7cf0);logger['debug'](_0x289a('0x1a'),_0x2c7cf0,JSON[_0x289a('0x10')](_0xf3b58c));_0x500c71(_0xf3b58c);})[_0x289a('0x14')](function(_0x399b5b){logger[_0x289a('0x11')]('UpdateSquareReport',_0x399b5b[_0x289a('0x13')],_0x2c7cf0);_0x43c76e(_0x40ec9f[_0x289a('0x11')](0x1f4,_0x399b5b[_0x289a('0x13')]));});});}; \ No newline at end of file +var _0xd83c=['http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd83c,0x197));var _0xcd83=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xd83c[_0x249d99];return _0x5bfb05;};'use strict';var _=require('lodash');var util=require(_0xcd83('0x0'));var moment=require('moment');var BPromise=require(_0xcd83('0x1'));var rs=require(_0xcd83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd83('0x3'))['db'];var utils=require(_0xcd83('0x4'));var logger=require(_0xcd83('0x5'))(_0xcd83('0x6'));var config=require(_0xcd83('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcd83('0x8')][_0xcd83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa51914,_0x2dc8e4,_0x2fe261){return new BPromise(function(_0x412ffb,_0x706b62){return client['request'](_0xa51914,_0x2fe261)[_0xcd83('0xa')](function(_0x7e4a07){logger[_0xcd83('0xb')](_0xcd83('0xc'),_0x2dc8e4,_0xcd83('0xd'));logger['debug'](_0xcd83('0xe'),_0x2dc8e4,_0xcd83('0xd'),JSON[_0xcd83('0xf')](_0x7e4a07));if(_0x7e4a07[_0xcd83('0x10')]){if(_0x7e4a07[_0xcd83('0x10')][_0xcd83('0x11')]===0x1f4){logger['error'](_0xcd83('0xc'),_0x2dc8e4,_0x7e4a07['error'][_0xcd83('0x12')]);return _0x706b62(_0x7e4a07[_0xcd83('0x10')][_0xcd83('0x12')]);}logger[_0xcd83('0x10')]('SquareReport,\x20%s,\x20%s',_0x2dc8e4,_0x7e4a07['error'][_0xcd83('0x12')]);return _0x412ffb(_0x7e4a07[_0xcd83('0x10')][_0xcd83('0x12')]);}else{logger[_0xcd83('0xb')](_0xcd83('0xc'),_0x2dc8e4,_0xcd83('0xd'));_0x412ffb(_0x7e4a07['result'][_0xcd83('0x12')]);}})[_0xcd83('0x13')](function(_0xef8880){logger['error'](_0xcd83('0xc'),_0x2dc8e4,_0xef8880);_0x706b62(_0xef8880);});});}exports[_0xcd83('0x14')]=function(_0x4b8f3d){var _0x4d8db5=this;return new Promise(function(_0x2c0c33,_0x22c4a3){return db[_0xcd83('0x15')][_0xcd83('0x16')](_0x4b8f3d[_0xcd83('0x17')],{'raw':_0x4b8f3d[_0xcd83('0x18')]?_0x4b8f3d[_0xcd83('0x18')][_0xcd83('0x19')]===undefined?!![]:![]:!![]})[_0xcd83('0xa')](function(_0x10494e){logger['info']('CreateSquareReport',_0x4b8f3d);logger[_0xcd83('0x1a')](_0xcd83('0x14'),_0x4b8f3d,JSON[_0xcd83('0xf')](_0x10494e));_0x2c0c33(_0x10494e);})[_0xcd83('0x13')](function(_0x202159){logger[_0xcd83('0x10')](_0xcd83('0x14'),_0x202159[_0xcd83('0x12')],_0x4b8f3d);_0x22c4a3(_0x4d8db5[_0xcd83('0x10')](0x1f4,_0x202159[_0xcd83('0x12')]));});});};exports[_0xcd83('0x1b')]=function(_0x95cd88){var _0x50d55d=this;return new Promise(function(_0x120aff,_0x16f304){return db[_0xcd83('0x15')][_0xcd83('0x1c')](_0x95cd88['body'],{'raw':_0x95cd88[_0xcd83('0x18')]?_0x95cd88[_0xcd83('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95cd88[_0xcd83('0x18')]?_0x95cd88[_0xcd83('0x18')][_0xcd83('0x1d')]||null:null,'attributes':_0x95cd88[_0xcd83('0x18')]?_0x95cd88['options'][_0xcd83('0x1e')]||null:null,'limit':_0x95cd88[_0xcd83('0x18')]?_0x95cd88[_0xcd83('0x18')][_0xcd83('0x1f')]||null:null})[_0xcd83('0xa')](function(_0x1e125c){logger[_0xcd83('0xb')](_0xcd83('0x1b'),_0x95cd88);logger[_0xcd83('0x1a')](_0xcd83('0x1b'),_0x95cd88,JSON[_0xcd83('0xf')](_0x1e125c));_0x120aff(_0x1e125c);})['catch'](function(_0x6b12e3){logger[_0xcd83('0x10')]('UpdateSquareReport',_0x6b12e3[_0xcd83('0x12')],_0x95cd88);_0x16f304(_0x50d55d[_0xcd83('0x10')](0x1f4,_0x6b12e3[_0xcd83('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index fee57fc..c2778b0 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 _0x4b07=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x5e492e,_0x54ecec){var _0x339e70=function(_0x109353){while(--_0x109353){_0x5e492e['push'](_0x5e492e['shift']());}};_0x339e70(++_0x54ecec);}(_0x4b07,0x89));var _0x74b0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x4b07[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x74b0('0x0'));var util=require('util');var path=require(_0x74b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x74b0('0x3'));var interaction=require(_0x74b0('0x4'));var config=require(_0x74b0('0x5'));var controller=require('./squareReportDetail.controller');router[_0x74b0('0x6')]('/',auth[_0x74b0('0x7')](),controller[_0x74b0('0x8')]);router[_0x74b0('0x6')](_0x74b0('0x9'),auth[_0x74b0('0x7')](),controller[_0x74b0('0xa')]);router['get'](_0x74b0('0xb'),auth[_0x74b0('0x7')](),controller[_0x74b0('0xc')]);router[_0x74b0('0xd')]('/',auth[_0x74b0('0x7')](),controller[_0x74b0('0xe')]);router[_0x74b0('0xf')]('/:id',auth[_0x74b0('0x7')](),controller[_0x74b0('0x10')]);router[_0x74b0('0x11')](_0x74b0('0xb'),auth[_0x74b0('0x7')](),controller[_0x74b0('0x12')]);module[_0x74b0('0x13')]=router; \ No newline at end of file +var _0x6722=['update','delete','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6722,0x18e));var _0x2672=function(_0x44bbd1,_0x53627e){_0x44bbd1=_0x44bbd1-0x0;var _0x15e716=_0x6722[_0x44bbd1];return _0x15e716;};'use strict';var multer=require(_0x2672('0x0'));var util=require(_0x2672('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2672('0x2')]();var fs_extra=require(_0x2672('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2672('0x4'));var config=require(_0x2672('0x5'));var controller=require(_0x2672('0x6'));router[_0x2672('0x7')]('/',auth[_0x2672('0x8')](),controller['index']);router[_0x2672('0x7')](_0x2672('0x9'),auth['isAuthenticated'](),controller[_0x2672('0xa')]);router[_0x2672('0x7')](_0x2672('0xb'),auth[_0x2672('0x8')](),controller[_0x2672('0xc')]);router[_0x2672('0xd')]('/',auth[_0x2672('0x8')](),controller[_0x2672('0xe')]);router[_0x2672('0xf')]('/:id',auth[_0x2672('0x8')](),controller[_0x2672('0x10')]);router[_0x2672('0x11')]('/:id',auth[_0x2672('0x8')](),controller['destroy']);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 cda1b04..2ad024e 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 _0x2494=['TEXT','sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2494,0xf5));var _0x4249=function(_0x204d23,_0x32f4cf){_0x204d23=_0x204d23-0x0;var _0x38d614=_0x2494[_0x204d23];return _0x38d614;};'use strict';var Sequelize=require(_0x4249('0x0'));module[_0x4249('0x1')]={'uniqueid':{'type':Sequelize[_0x4249('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x4249('0x3')]},'project_name':{'type':Sequelize[_0x4249('0x2')]},'callerid':{'type':Sequelize[_0x4249('0x2')]}}; \ No newline at end of file +var _0xeccc=['exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeccc,0x147));var _0xcecc=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xeccc[_0x568a61];return _0x334c3b;};'use strict';var Sequelize=require('sequelize');module[_0xcecc('0x0')]={'uniqueid':{'type':Sequelize[_0xcecc('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xcecc('0x2')]},'project_name':{'type':Sequelize[_0xcecc('0x1')]},'callerid':{'type':Sequelize[_0xcecc('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b6168a8..3401e3a 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 _0xa211=['reject','save','update','destroy','then','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range'];(function(_0x5ae761,_0x9afc7c){var _0x42add3=function(_0x5e0fa8){while(--_0x5e0fa8){_0x5ae761['push'](_0x5ae761['shift']());}};_0x42add3(++_0x9afc7c);}(_0xa211,0x10c));var _0x1a21=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa211[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x1a21('0x0'));var rimraf=require(_0x1a21('0x1'));var zipdir=require(_0x1a21('0x2'));var jsonpatch=require(_0x1a21('0x3'));var rp=require(_0x1a21('0x4'));var moment=require(_0x1a21('0x5'));var BPromise=require(_0x1a21('0x6'));var Mustache=require(_0x1a21('0x7'));var util=require(_0x1a21('0x8'));var path=require(_0x1a21('0x9'));var sox=require('sox');var csv=require(_0x1a21('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a21('0xb'));var _=require(_0x1a21('0xc'));var squel=require(_0x1a21('0xd'));var crypto=require(_0x1a21('0xe'));var jsforce=require(_0x1a21('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1a21('0xa'));var querystring=require('querystring');var Papa=require(_0x1a21('0x10'));var Redis=require(_0x1a21('0x11'));var authService=require(_0x1a21('0x12'));var qs=require(_0x1a21('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a21('0x14'));var logger=require(_0x1a21('0x15'))(_0x1a21('0x16'));var utils=require(_0x1a21('0x17'));var config=require(_0x1a21('0x18'));var licenseUtil=require(_0x1a21('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x89e569,_0x274dd7){_0x274dd7=_0x274dd7||0xcc;return function(_0x1f02d1){if(_0x1f02d1){return _0x89e569[_0x1a21('0x1a')](_0x274dd7);}return _0x89e569['status'](_0x274dd7)[_0x1a21('0x1b')]();};}function respondWithResult(_0x4c18db,_0x106b5d){_0x106b5d=_0x106b5d||0xc8;return function(_0xc8630c){if(_0xc8630c){return _0x4c18db['status'](_0x106b5d)[_0x1a21('0x1c')](_0xc8630c);}};}function respondWithFilteredResult(_0x3d80d4,_0x1fa2ab){return function(_0x51704d){if(_0x51704d){var _0x2c8093=typeof _0x1fa2ab[_0x1a21('0x1d')]===_0x1a21('0x1e')&&typeof _0x1fa2ab['limit']===_0x1a21('0x1e');var _0x16eaa6=_0x51704d[_0x1a21('0x1f')];var _0x316155=_0x2c8093?0x0:_0x1fa2ab[_0x1a21('0x1d')];var _0x1249d2=_0x2c8093?_0x51704d[_0x1a21('0x1f')]:_0x1fa2ab[_0x1a21('0x1d')]+_0x1fa2ab[_0x1a21('0x20')];var _0x320897;if(_0x1249d2>=_0x16eaa6){_0x1249d2=_0x16eaa6;_0x320897=0xc8;}else{_0x320897=0xce;}_0x3d80d4[_0x1a21('0x21')](_0x320897);return _0x3d80d4[_0x1a21('0x22')](_0x1a21('0x23'),_0x316155+'-'+_0x1249d2+'/'+_0x16eaa6)[_0x1a21('0x1c')](_0x51704d);}return null;};}function patchUpdates(_0x44135b){return function(_0x53365a){try{jsonpatch['apply'](_0x53365a,_0x44135b,!![]);}catch(_0x131f98){return BPromise[_0x1a21('0x24')](_0x131f98);}return _0x53365a[_0x1a21('0x25')]();};}function saveUpdates(_0x4f0a23,_0x4c7132){return function(_0x356f3f){if(_0x356f3f){return _0x356f3f[_0x1a21('0x26')](_0x4f0a23)['then'](function(_0x1b902d){return _0x1b902d;});}return null;};}function removeEntity(_0x3587d2,_0x264ffe){return function(_0x244ed5){if(_0x244ed5){return _0x244ed5[_0x1a21('0x27')]()[_0x1a21('0x28')](function(){_0x3587d2['status'](0xcc)[_0x1a21('0x1b')]();});}};}function handleEntityNotFound(_0x11a0f1,_0x482536){return function(_0x5d6197){if(!_0x5d6197){_0x11a0f1[_0x1a21('0x1a')](0x194);}return _0x5d6197;};}function handleError(_0x140876,_0x3b2b5a){_0x3b2b5a=_0x3b2b5a||0x1f4;return function(_0x459650){logger[_0x1a21('0x29')](_0x459650[_0x1a21('0x2a')]);if(_0x459650[_0x1a21('0x2b')]){delete _0x459650['name'];}_0x140876[_0x1a21('0x21')](_0x3b2b5a)[_0x1a21('0x2c')](_0x459650);};}exports['index']=function(_0x1e6ab6,_0x2ea4e9){var _0x371b95={},_0x3afc55={},_0x23c0b2={'count':0x0,'rows':[]};var _0x279caf=_[_0x1a21('0x2d')](db[_0x1a21('0x2e')][_0x1a21('0x2f')],function(_0x156a00){return{'name':_0x156a00['fieldName'],'type':_0x156a00[_0x1a21('0x30')][_0x1a21('0x31')]};});_0x3afc55[_0x1a21('0x32')]=_['map'](_0x279caf,_0x1a21('0x2b'));_0x3afc55[_0x1a21('0x33')]=_['keys'](_0x1e6ab6[_0x1a21('0x33')]);_0x3afc55['filters']=_[_0x1a21('0x34')](_0x3afc55[_0x1a21('0x32')],_0x3afc55[_0x1a21('0x33')]);_0x371b95[_0x1a21('0x35')]=_[_0x1a21('0x34')](_0x3afc55[_0x1a21('0x32')],qs[_0x1a21('0x36')](_0x1e6ab6[_0x1a21('0x33')][_0x1a21('0x36')]));_0x371b95[_0x1a21('0x35')]=_0x371b95[_0x1a21('0x35')]['length']?_0x371b95[_0x1a21('0x35')]:_0x3afc55[_0x1a21('0x32')];if(!_0x1e6ab6[_0x1a21('0x33')][_0x1a21('0x37')](_0x1a21('0x38'))){_0x371b95[_0x1a21('0x20')]=qs['limit'](_0x1e6ab6[_0x1a21('0x33')]['limit']);_0x371b95[_0x1a21('0x1d')]=qs[_0x1a21('0x1d')](_0x1e6ab6[_0x1a21('0x33')]['offset']);}_0x371b95[_0x1a21('0x39')]=qs[_0x1a21('0x3a')](_0x1e6ab6[_0x1a21('0x33')][_0x1a21('0x3a')]);_0x371b95[_0x1a21('0x3b')]=qs['filters'](_[_0x1a21('0x3c')](_0x1e6ab6[_0x1a21('0x33')],_0x3afc55['filters']),_0x279caf);if(_0x1e6ab6[_0x1a21('0x33')][_0x1a21('0x3d')]){_0x371b95['where']=_[_0x1a21('0x3e')](_0x371b95['where'],{'$or':_['map'](_0x279caf,function(_0x2faa80){if(_0x2faa80['type']!=='VIRTUAL'){var _0x13f15e={};_0x13f15e[_0x2faa80['name']]={'$like':'%'+_0x1e6ab6['query'][_0x1a21('0x3d')]+'%'};return _0x13f15e;}})});}_0x371b95=_[_0x1a21('0x3e')]({},_0x371b95,_0x1e6ab6[_0x1a21('0x3f')]);var _0x35a767={'where':_0x371b95[_0x1a21('0x3b')]};return db['SquareDetailsReport'][_0x1a21('0x1f')](_0x35a767)[_0x1a21('0x28')](function(_0x2e5128){_0x23c0b2[_0x1a21('0x1f')]=_0x2e5128;if(_0x1e6ab6[_0x1a21('0x33')][_0x1a21('0x40')]){_0x371b95[_0x1a21('0x41')]=[{'all':!![]}];}return db[_0x1a21('0x2e')][_0x1a21('0x42')](_0x371b95);})[_0x1a21('0x28')](function(_0x297734){_0x23c0b2[_0x1a21('0x43')]=_0x297734;return _0x23c0b2;})[_0x1a21('0x28')](respondWithFilteredResult(_0x2ea4e9,_0x371b95))[_0x1a21('0x44')](handleError(_0x2ea4e9,null));};exports['show']=function(_0x4d5272,_0x450d03){var _0x4880de={'raw':!![],'where':{'id':_0x4d5272['params']['id']}},_0x5b3293={};_0x5b3293[_0x1a21('0x32')]=_[_0x1a21('0x45')](db[_0x1a21('0x2e')]['rawAttributes']);_0x5b3293[_0x1a21('0x33')]=_[_0x1a21('0x45')](_0x4d5272[_0x1a21('0x33')]);_0x5b3293['filters']=_[_0x1a21('0x34')](_0x5b3293[_0x1a21('0x32')],_0x5b3293[_0x1a21('0x33')]);_0x4880de[_0x1a21('0x35')]=_[_0x1a21('0x34')](_0x5b3293[_0x1a21('0x32')],qs[_0x1a21('0x36')](_0x4d5272[_0x1a21('0x33')]['fields']));_0x4880de[_0x1a21('0x35')]=_0x4880de[_0x1a21('0x35')][_0x1a21('0x46')]?_0x4880de[_0x1a21('0x35')]:_0x5b3293[_0x1a21('0x32')];if(_0x4d5272[_0x1a21('0x33')][_0x1a21('0x40')]){_0x4880de['include']=[{'all':!![]}];}_0x4880de=_[_0x1a21('0x3e')]({},_0x4880de,_0x4d5272[_0x1a21('0x3f')]);return db['SquareDetailsReport'][_0x1a21('0x47')](_0x4880de)['then'](handleEntityNotFound(_0x450d03,null))[_0x1a21('0x28')](respondWithResult(_0x450d03,null))[_0x1a21('0x44')](handleError(_0x450d03,null));};exports['create']=function(_0x231a01,_0x2795b5){return db['SquareDetailsReport'][_0x1a21('0x48')](_0x231a01['body'],{})[_0x1a21('0x28')](respondWithResult(_0x2795b5,0xc9))[_0x1a21('0x44')](handleError(_0x2795b5,null));};exports[_0x1a21('0x26')]=function(_0x1941b6,_0x10b03d){if(_0x1941b6[_0x1a21('0x49')]['id']){delete _0x1941b6[_0x1a21('0x49')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x1941b6[_0x1a21('0x4a')]['id']}})[_0x1a21('0x28')](handleEntityNotFound(_0x10b03d,null))['then'](saveUpdates(_0x1941b6[_0x1a21('0x49')],null))[_0x1a21('0x28')](respondWithResult(_0x10b03d,null))['catch'](handleError(_0x10b03d,null));};exports['destroy']=function(_0x4b4e70,_0x10a0d6){return db[_0x1a21('0x2e')][_0x1a21('0x47')]({'where':{'id':_0x4b4e70[_0x1a21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10a0d6,null))[_0x1a21('0x28')](removeEntity(_0x10a0d6,null))[_0x1a21('0x44')](handleError(_0x10a0d6,null));};exports[_0x1a21('0x4b')]=function(_0x4fe4f7,_0x4031e2){return db['SquareDetailsReport'][_0x1a21('0x4b')]()['then'](respondWithResult(_0x4031e2,null))[_0x1a21('0x44')](handleError(_0x4031e2,null));}; \ No newline at end of file +var _0x24ee=['rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','keys','rawAttributes','catch','create','body','find','params','describe','eml-format'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x24ee,0x1af));var _0xe24e=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x24ee[_0x3a2295];return _0x569710;};'use strict';var emlformat=require(_0xe24e('0x0'));var rimraf=require(_0xe24e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe24e('0x2'));var moment=require('moment');var BPromise=require(_0xe24e('0x3'));var Mustache=require(_0xe24e('0x4'));var util=require(_0xe24e('0x5'));var path=require(_0xe24e('0x6'));var sox=require(_0xe24e('0x7'));var csv=require(_0xe24e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe24e('0x9'));var _=require('lodash');var squel=require(_0xe24e('0xa'));var crypto=require('crypto');var jsforce=require(_0xe24e('0xb'));var deskjs=require(_0xe24e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe24e('0xd'));var Redis=require(_0xe24e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe24e('0xf'));var logger=require(_0xe24e('0x10'))('api');var utils=require(_0xe24e('0x11'));var config=require(_0xe24e('0x12'));var licenseUtil=require(_0xe24e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51bea5,_0x4605ad){_0x4605ad=_0x4605ad||0xcc;return function(_0x383c94){if(_0x383c94){return _0x51bea5['sendStatus'](_0x4605ad);}return _0x51bea5[_0xe24e('0x14')](_0x4605ad)[_0xe24e('0x15')]();};}function respondWithResult(_0x15a387,_0x4c6d10){_0x4c6d10=_0x4c6d10||0xc8;return function(_0x4e66b9){if(_0x4e66b9){return _0x15a387['status'](_0x4c6d10)[_0xe24e('0x16')](_0x4e66b9);}};}function respondWithFilteredResult(_0x314acd,_0x12f47b){return function(_0x1424c9){if(_0x1424c9){var _0x2cb79e=typeof _0x12f47b[_0xe24e('0x17')]===_0xe24e('0x18')&&typeof _0x12f47b[_0xe24e('0x19')]==='undefined';var _0x5cbf07=_0x1424c9['count'];var _0x56da9a=_0x2cb79e?0x0:_0x12f47b[_0xe24e('0x17')];var _0x26e51f=_0x2cb79e?_0x1424c9['count']:_0x12f47b[_0xe24e('0x17')]+_0x12f47b[_0xe24e('0x19')];var _0xddaaed;if(_0x26e51f>=_0x5cbf07){_0x26e51f=_0x5cbf07;_0xddaaed=0xc8;}else{_0xddaaed=0xce;}_0x314acd[_0xe24e('0x14')](_0xddaaed);return _0x314acd[_0xe24e('0x1a')](_0xe24e('0x1b'),_0x56da9a+'-'+_0x26e51f+'/'+_0x5cbf07)['json'](_0x1424c9);}return null;};}function patchUpdates(_0x3e5be6){return function(_0x7e9bf3){try{jsonpatch[_0xe24e('0x1c')](_0x7e9bf3,_0x3e5be6,!![]);}catch(_0x7924c1){return BPromise[_0xe24e('0x1d')](_0x7924c1);}return _0x7e9bf3[_0xe24e('0x1e')]();};}function saveUpdates(_0x2b0716,_0xff6369){return function(_0x180b7c){if(_0x180b7c){return _0x180b7c[_0xe24e('0x1f')](_0x2b0716)['then'](function(_0x49c058){return _0x49c058;});}return null;};}function removeEntity(_0x3c4709,_0xf4bea6){return function(_0x4dcd07){if(_0x4dcd07){return _0x4dcd07[_0xe24e('0x20')]()[_0xe24e('0x21')](function(){_0x3c4709[_0xe24e('0x14')](0xcc)[_0xe24e('0x15')]();});}};}function handleEntityNotFound(_0x33560d,_0x25600b){return function(_0x2fc1b9){if(!_0x2fc1b9){_0x33560d[_0xe24e('0x22')](0x194);}return _0x2fc1b9;};}function handleError(_0x3be7bd,_0x3cbac3){_0x3cbac3=_0x3cbac3||0x1f4;return function(_0x2d6baa){logger['error'](_0x2d6baa[_0xe24e('0x23')]);if(_0x2d6baa[_0xe24e('0x24')]){delete _0x2d6baa[_0xe24e('0x24')];}_0x3be7bd['status'](_0x3cbac3)[_0xe24e('0x25')](_0x2d6baa);};}exports[_0xe24e('0x26')]=function(_0x16962b,_0x97b599){var _0xee6c6b={},_0x16e758={},_0x34bd55={'count':0x0,'rows':[]};var _0x105992=_[_0xe24e('0x27')](db[_0xe24e('0x28')]['rawAttributes'],function(_0x4fdc07){return{'name':_0x4fdc07[_0xe24e('0x29')],'type':_0x4fdc07[_0xe24e('0x2a')][_0xe24e('0x2b')]};});_0x16e758[_0xe24e('0x2c')]=_[_0xe24e('0x27')](_0x105992,_0xe24e('0x24'));_0x16e758[_0xe24e('0x2d')]=_['keys'](_0x16962b[_0xe24e('0x2d')]);_0x16e758[_0xe24e('0x2e')]=_[_0xe24e('0x2f')](_0x16e758[_0xe24e('0x2c')],_0x16e758[_0xe24e('0x2d')]);_0xee6c6b[_0xe24e('0x30')]=_['intersection'](_0x16e758[_0xe24e('0x2c')],qs[_0xe24e('0x31')](_0x16962b[_0xe24e('0x2d')]['fields']));_0xee6c6b['attributes']=_0xee6c6b['attributes'][_0xe24e('0x32')]?_0xee6c6b[_0xe24e('0x30')]:_0x16e758[_0xe24e('0x2c')];if(!_0x16962b[_0xe24e('0x2d')]['hasOwnProperty']('nolimit')){_0xee6c6b['limit']=qs[_0xe24e('0x19')](_0x16962b[_0xe24e('0x2d')][_0xe24e('0x19')]);_0xee6c6b[_0xe24e('0x17')]=qs[_0xe24e('0x17')](_0x16962b['query']['offset']);}_0xee6c6b[_0xe24e('0x33')]=qs[_0xe24e('0x34')](_0x16962b[_0xe24e('0x2d')][_0xe24e('0x34')]);_0xee6c6b[_0xe24e('0x35')]=qs[_0xe24e('0x2e')](_[_0xe24e('0x36')](_0x16962b['query'],_0x16e758[_0xe24e('0x2e')]),_0x105992);if(_0x16962b[_0xe24e('0x2d')][_0xe24e('0x37')]){_0xee6c6b['where']=_[_0xe24e('0x38')](_0xee6c6b[_0xe24e('0x35')],{'$or':_['map'](_0x105992,function(_0x5b0039){if(_0x5b0039[_0xe24e('0x2a')]!==_0xe24e('0x39')){var _0x1d4115={};_0x1d4115[_0x5b0039[_0xe24e('0x24')]]={'$like':'%'+_0x16962b[_0xe24e('0x2d')]['filter']+'%'};return _0x1d4115;}})});}_0xee6c6b=_[_0xe24e('0x38')]({},_0xee6c6b,_0x16962b[_0xe24e('0x3a')]);var _0x6c0bf2={'where':_0xee6c6b[_0xe24e('0x35')]};return db[_0xe24e('0x28')][_0xe24e('0x3b')](_0x6c0bf2)[_0xe24e('0x21')](function(_0x1c1f86){_0x34bd55['count']=_0x1c1f86;if(_0x16962b['query'][_0xe24e('0x3c')]){_0xee6c6b[_0xe24e('0x3d')]=[{'all':!![]}];}return db[_0xe24e('0x28')][_0xe24e('0x3e')](_0xee6c6b);})[_0xe24e('0x21')](function(_0x456236){_0x34bd55['rows']=_0x456236;return _0x34bd55;})[_0xe24e('0x21')](respondWithFilteredResult(_0x97b599,_0xee6c6b))['catch'](handleError(_0x97b599,null));};exports[_0xe24e('0x3f')]=function(_0x39f257,_0x29dddc){var _0x93cdc={'raw':!![],'where':{'id':_0x39f257['params']['id']}},_0x534dba={};_0x534dba['model']=_[_0xe24e('0x40')](db[_0xe24e('0x28')][_0xe24e('0x41')]);_0x534dba[_0xe24e('0x2d')]=_[_0xe24e('0x40')](_0x39f257[_0xe24e('0x2d')]);_0x534dba[_0xe24e('0x2e')]=_[_0xe24e('0x2f')](_0x534dba[_0xe24e('0x2c')],_0x534dba[_0xe24e('0x2d')]);_0x93cdc[_0xe24e('0x30')]=_[_0xe24e('0x2f')](_0x534dba[_0xe24e('0x2c')],qs[_0xe24e('0x31')](_0x39f257['query'][_0xe24e('0x31')]));_0x93cdc['attributes']=_0x93cdc[_0xe24e('0x30')][_0xe24e('0x32')]?_0x93cdc[_0xe24e('0x30')]:_0x534dba['model'];if(_0x39f257['query']['includeAll']){_0x93cdc[_0xe24e('0x3d')]=[{'all':!![]}];}_0x93cdc=_['merge']({},_0x93cdc,_0x39f257[_0xe24e('0x3a')]);return db[_0xe24e('0x28')]['find'](_0x93cdc)[_0xe24e('0x21')](handleEntityNotFound(_0x29dddc,null))[_0xe24e('0x21')](respondWithResult(_0x29dddc,null))[_0xe24e('0x42')](handleError(_0x29dddc,null));};exports[_0xe24e('0x43')]=function(_0x3f3a27,_0x2e9a49){return db[_0xe24e('0x28')][_0xe24e('0x43')](_0x3f3a27[_0xe24e('0x44')],{})[_0xe24e('0x21')](respondWithResult(_0x2e9a49,0xc9))['catch'](handleError(_0x2e9a49,null));};exports['update']=function(_0x1e00b4,_0x5515c6){if(_0x1e00b4[_0xe24e('0x44')]['id']){delete _0x1e00b4[_0xe24e('0x44')]['id'];}return db[_0xe24e('0x28')][_0xe24e('0x45')]({'where':{'id':_0x1e00b4[_0xe24e('0x46')]['id']}})[_0xe24e('0x21')](handleEntityNotFound(_0x5515c6,null))[_0xe24e('0x21')](saveUpdates(_0x1e00b4[_0xe24e('0x44')],null))['then'](respondWithResult(_0x5515c6,null))['catch'](handleError(_0x5515c6,null));};exports['destroy']=function(_0x92d77f,_0x53c358){return db[_0xe24e('0x28')][_0xe24e('0x45')]({'where':{'id':_0x92d77f['params']['id']}})[_0xe24e('0x21')](handleEntityNotFound(_0x53c358,null))[_0xe24e('0x21')](removeEntity(_0x53c358,null))[_0xe24e('0x42')](handleError(_0x53c358,null));};exports[_0xe24e('0x47')]=function(_0xc7b689,_0x1aa8df){return db[_0xe24e('0x28')][_0xe24e('0x47')]()['then'](respondWithResult(_0x1aa8df,null))[_0xe24e('0x42')](handleError(_0x1aa8df,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0bce28a..d6e7e2e 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 _0x47e8=['api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger'];(function(_0x38a8f1,_0xd01a2){var _0x216011=function(_0x2e09e2){while(--_0x2e09e2){_0x38a8f1['push'](_0x38a8f1['shift']());}};_0x216011(++_0xd01a2);}(_0x47e8,0x99));var _0x847e=function(_0x1820f1,_0x1403e7){_0x1820f1=_0x1820f1-0x0;var _0x167aed=_0x47e8[_0x1820f1];return _0x167aed;};'use strict';var _=require(_0x847e('0x0'));var util=require(_0x847e('0x1'));var logger=require(_0x847e('0x2'))(_0x847e('0x3'));var moment=require('moment');var BPromise=require(_0x847e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x847e('0x5'));var rimraf=require(_0x847e('0x6'));var config=require(_0x847e('0x7'));var attributes=require(_0x847e('0x8'));module[_0x847e('0x9')]=function(_0x1fc772,_0x26947f){return _0x1fc772[_0x847e('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x847e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd40f=['exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xd40f,0xdc));var _0xfd40=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0xd40f[_0x231a42];return _0x3c2a56;};'use strict';var _=require('lodash');var util=require(_0xfd40('0x0'));var logger=require(_0xfd40('0x1'))(_0xfd40('0x2'));var moment=require(_0xfd40('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd40('0x4'));var fs=require('fs');var path=require(_0xfd40('0x5'));var rimraf=require(_0xfd40('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd40('0x7'));module[_0xfd40('0x8')]=function(_0x3f5800,_0x53a88){return _0x3f5800[_0xfd40('0x9')](_0xfd40('0xa'),attributes,{'tableName':_0xfd40('0xb'),'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 dc9901c..eaa4ae5 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 _0x693f=['code','message','info','SquareDetailsReport,\x20%s,\x20%s','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','error'];(function(_0x3a0e09,_0x378445){var _0x355de1=function(_0x4730d3){while(--_0x4730d3){_0x3a0e09['push'](_0x3a0e09['shift']());}};_0x355de1(++_0x378445);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33305c,_0x5b91c5,_0x22f362){return new BPromise(function(_0x594505,_0x38e78a){return client['request'](_0x33305c,_0x22f362)[_0xf693('0xc')](function(_0x17075d){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,'request\x20sent');logger[_0xf693('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5b91c5,_0xf693('0xe'),JSON[_0xf693('0xf')](_0x17075d));if(_0x17075d[_0xf693('0x10')]){if(_0x17075d[_0xf693('0x10')][_0xf693('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);return _0x38e78a(_0x17075d['error'][_0xf693('0x12')]);}logger[_0xf693('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d['error'][_0xf693('0x12')]);return _0x594505(_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);}else{logger[_0xf693('0x13')](_0xf693('0x14'),_0x5b91c5,'request\x20sent');_0x594505(_0x17075d[_0xf693('0x15')][_0xf693('0x12')]);}})[_0xf693('0x16')](function(_0x2a5e1b){logger[_0xf693('0x10')](_0xf693('0x14'),_0x5b91c5,_0x2a5e1b);_0x38e78a(_0x2a5e1b);});});}exports['CreateSquareDetailsReport']=function(_0x5e02e0){var _0x4a5964=this;return new Promise(function(_0x2474d4,_0xf4d20e){return db[_0xf693('0x17')][_0xf693('0x18')](_0x5e02e0[_0xf693('0x19')],{'raw':_0x5e02e0['options']?_0x5e02e0[_0xf693('0x1a')][_0xf693('0x1b')]===undefined?!![]:![]:!![]})[_0xf693('0xc')](function(_0x31b887){logger[_0xf693('0x13')](_0xf693('0x1c'),_0x5e02e0);logger[_0xf693('0xd')](_0xf693('0x1c'),_0x5e02e0,JSON['stringify'](_0x31b887));_0x2474d4(_0x31b887);})[_0xf693('0x16')](function(_0x1188c6){logger[_0xf693('0x10')](_0xf693('0x1c'),_0x1188c6[_0xf693('0x12')],_0x5e02e0);_0xf4d20e(_0x4a5964[_0xf693('0x10')](0x1f4,_0x1188c6[_0xf693('0x12')]));});});}; \ No newline at end of file +var _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x154750,_0x184b0b){var _0x4e61cd=function(_0x5eaa58){while(--_0x5eaa58){_0x154750['push'](_0x154750['shift']());}};_0x4e61cd(++_0x184b0b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x8f4c[_0x562ec5];return _0x279c8c;};'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?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3c829a3..699cab9 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 _0x8a32=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess'];(function(_0x37cc4c,_0x288c26){var _0x425695=function(_0x355c09){while(--_0x355c09){_0x37cc4c['push'](_0x37cc4c['shift']());}};_0x425695(++_0x288c26);}(_0x8a32,0x103));var _0x28a3=function(_0x47db3e,_0x5e11a9){_0x47db3e=_0x47db3e-0x0;var _0x1834a5=_0x8a32[_0x47db3e];return _0x1834a5;};'use strict';var express=require('express');var router=express[_0x28a3('0x0')]();var auth=require(_0x28a3('0x1'));var controller=require(_0x28a3('0x2'));router[_0x28a3('0x3')]('/',auth[_0x28a3('0x4')](),controller[_0x28a3('0x5')]);router[_0x28a3('0x3')]('/process/:pid/kill',auth[_0x28a3('0x4')](),controller[_0x28a3('0x6')]);module['exports']=router; \ No newline at end of file +var _0x9fab=['exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x23cedf,_0x5e84e9){var _0x5788d1=function(_0x43500d){while(--_0x43500d){_0x23cedf['push'](_0x23cedf['shift']());}};_0x5788d1(++_0x5e84e9);}(_0x9fab,0xe9));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xb9fa('0x0'));var router=express['Router']();var auth=require(_0xb9fa('0x1'));var controller=require(_0xb9fa('0x2'));router[_0xb9fa('0x3')]('/',auth[_0xb9fa('0x4')](),controller['index']);router['get'](_0xb9fa('0x5'),auth[_0xb9fa('0x4')](),controller[_0xb9fa('0x6')]);module[_0xb9fa('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 43cf86f..06826e1 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 _0x1695=['name','send','index','getAllData','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x418088,_0x185d3b){var _0x549c1c=function(_0x2f6569){while(--_0x2f6569){_0x418088['push'](_0x418088['shift']());}};_0x549c1c(++_0x185d3b);}(_0x1695,0x1b7));var _0x5169=function(_0x4445fd,_0x5b8d85){_0x4445fd=_0x4445fd-0x0;var _0xf47431=_0x1695[_0x4445fd];return _0xf47431;};'use strict';var info=require(_0x5169('0x0'));var exec=require(_0x5169('0x1'))[_0x5169('0x2')];var logger=require(_0x5169('0x3'))(_0x5169('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x5169('0x5'));function handleError(_0xbbaeab,_0x3ea330,_0x534be3){_0x3ea330=_0x3ea330||0x1f4;return function(_0x1751dc){logger[_0x5169('0x6')](_0x5169('0x7'),_0x534be3,_0x3ea330,util[_0x5169('0x8')](_0x1751dc,{'showHidden':![],'depth':null}));delete _0x1751dc[_0x5169('0x9')];_0xbbaeab['status'](_0x3ea330)[_0x5169('0xa')](_0x1751dc);};}exports[_0x5169('0xb')]=function(_0x2992c5,_0x226e05){return info[_0x5169('0xc')]()[_0x5169('0xd')](function(_0x103577){return _0x226e05[_0x5169('0xe')](0xc8)[_0x5169('0xf')](_0x103577);})['catch'](function(_0x35b50e){return _0x226e05[_0x5169('0xe')](0x1f4)[_0x5169('0xf')](_0x35b50e);});};exports[_0x5169('0x10')]=function(_0x1bc4a6,_0x1ba9d9){var _0x386e53=[_0x5169('0x11')];return new BPromise(function(_0x663737,_0x4a3a7a){return exec(util[_0x5169('0x12')](_0x5169('0x13'),_0x1bc4a6[_0x5169('0x14')][_0x5169('0x15')]),function(_0x5830c9,_0x514a35,_0x556bc0){if(_0x5830c9){return _0x4a3a7a(_0x5830c9);}return _0x663737(_0x514a35);});})['then'](function(_0x184c6a){var _0xf3096b=![];var _0x1b386c=_0x184c6a['split'](/\n/);for(var _0x250fa8=0x0,_0x43fbc2=_0x386e53[_0x5169('0x16')];_0x250fa8<_0x43fbc2,_0xf3096b===![];_0x250fa8+=0x1){if(_0x184c6a[_0x5169('0x17')](_0x386e53[_0x250fa8])>=0x0){_0xf3096b=!![];}}if(!_0xf3096b){throw new Error(util[_0x5169('0x12')](_0x5169('0x18'),_0x1bc4a6[_0x5169('0x14')][_0x5169('0x15')]));}process['kill'](_0x1bc4a6[_0x5169('0x14')][_0x5169('0x15')],_0x5169('0x19'));return _0x1ba9d9[_0x5169('0xe')](0xc8)[_0x5169('0xf')]({'message':util[_0x5169('0x12')](_0x5169('0x1a'),_0x1bc4a6['params'][_0x5169('0x15')])});})[_0x5169('0x1b')](handleError(_0x1ba9d9,null,'killProcess'));}; \ No newline at end of file +var _0x7f8f=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','then','json','components/import/cm','format','params','pid','length','indexOf'];(function(_0x1781d9,_0x479026){var _0x50c607=function(_0x1302e1){while(--_0x1302e1){_0x1781d9['push'](_0x1781d9['shift']());}};_0x50c607(++_0x479026);}(_0x7f8f,0x1e0));var _0xf7f8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f8f[_0x321bb2];return _0x9c12ed;};'use strict';var info=require(_0xf7f8('0x0'));var exec=require(_0xf7f8('0x1'))[_0xf7f8('0x2')];var logger=require('../../config/logger')('api');var util=require(_0xf7f8('0x3'));var BPromise=require(_0xf7f8('0x4'));var _=require(_0xf7f8('0x5'));function handleError(_0x1cc34a,_0x4eb757,_0x337a2d){_0x4eb757=_0x4eb757||0x1f4;return function(_0x5c57f1){logger[_0xf7f8('0x6')](_0xf7f8('0x7'),_0x337a2d,_0x4eb757,util['inspect'](_0x5c57f1,{'showHidden':![],'depth':null}));delete _0x5c57f1[_0xf7f8('0x8')];_0x1cc34a[_0xf7f8('0x9')](_0x4eb757)['send'](_0x5c57f1);};}exports[_0xf7f8('0xa')]=function(_0x23424a,_0x59f749){return info[_0xf7f8('0xb')]()[_0xf7f8('0xc')](function(_0x555c2c){return _0x59f749[_0xf7f8('0x9')](0xc8)[_0xf7f8('0xd')](_0x555c2c);})['catch'](function(_0x5746ac){return _0x59f749[_0xf7f8('0x9')](0x1f4)[_0xf7f8('0xd')](_0x5746ac);});};exports['killProcess']=function(_0x10be50,_0x5015da){var _0x155d9d=[_0xf7f8('0xe')];return new BPromise(function(_0x162979,_0x3906c2){return exec(util[_0xf7f8('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x10be50[_0xf7f8('0x10')][_0xf7f8('0x11')]),function(_0x4bb13a,_0x3ee1ab,_0xf634a5){if(_0x4bb13a){return _0x3906c2(_0x4bb13a);}return _0x162979(_0x3ee1ab);});})[_0xf7f8('0xc')](function(_0x1ab70b){var _0x49c0f3=![];var _0x308f2a=_0x1ab70b['split'](/\n/);for(var _0x4f8812=0x0,_0x1ca352=_0x155d9d[_0xf7f8('0x12')];_0x4f8812<_0x1ca352,_0x49c0f3===![];_0x4f8812+=0x1){if(_0x1ab70b[_0xf7f8('0x13')](_0x155d9d[_0x4f8812])>=0x0){_0x49c0f3=!![];}}if(!_0x49c0f3){throw new Error(util[_0xf7f8('0xf')](_0xf7f8('0x14'),_0x10be50[_0xf7f8('0x10')][_0xf7f8('0x11')]));}process[_0xf7f8('0x15')](_0x10be50[_0xf7f8('0x10')][_0xf7f8('0x11')],_0xf7f8('0x16'));return _0x5015da[_0xf7f8('0x9')](0xc8)[_0xf7f8('0xd')]({'message':util[_0xf7f8('0xf')](_0xf7f8('0x17'),_0x10be50[_0xf7f8('0x10')][_0xf7f8('0x11')])});})[_0xf7f8('0x18')](handleError(_0x5015da,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1a2b779..9307856 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 _0x1046=['put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x2602d9,_0x53b16b){var _0x364c70=function(_0x3462c6){while(--_0x3462c6){_0x2602d9['push'](_0x2602d9['shift']());}};_0x364c70(++_0x53b16b);}(_0x1046,0x134));var _0x6104=function(_0x2dd748,_0x2feded){_0x2dd748=_0x2dd748-0x0;var _0x161f38=_0x1046[_0x2dd748];return _0x161f38;};'use strict';var multer=require(_0x6104('0x0'));var util=require('util');var path=require(_0x6104('0x1'));var timeout=require(_0x6104('0x2'));var express=require(_0x6104('0x3'));var router=express[_0x6104('0x4')]();var fs_extra=require(_0x6104('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6104('0x6'));var config=require(_0x6104('0x7'));var controller=require(_0x6104('0x8'));router[_0x6104('0x9')]('/',auth['isAuthenticated'](),controller[_0x6104('0xa')]);router[_0x6104('0x9')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller['show']);router[_0x6104('0xd')]('/',auth['isAuthenticated'](),controller[_0x6104('0xe')]);router[_0x6104('0xf')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller[_0x6104('0x10')]);router[_0x6104('0x11')](_0x6104('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6104('0x12')]=router; \ No newline at end of file +var _0x1945=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','post','create','put','delete','destroy','exports'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x1945,0xfc));var _0x5194=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x1945[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x5194('0x0'));var util=require(_0x5194('0x1'));var path=require(_0x5194('0x2'));var timeout=require(_0x5194('0x3'));var express=require('express');var router=express[_0x5194('0x4')]();var fs_extra=require(_0x5194('0x5'));var auth=require(_0x5194('0x6'));var interaction=require(_0x5194('0x7'));var config=require(_0x5194('0x8'));var controller=require(_0x5194('0x9'));router[_0x5194('0xa')]('/',auth[_0x5194('0xb')](),controller['index']);router[_0x5194('0xa')]('/:id',auth[_0x5194('0xb')](),controller['show']);router[_0x5194('0xc')]('/',auth[_0x5194('0xb')](),controller[_0x5194('0xd')]);router[_0x5194('0xe')]('/:id',auth[_0x5194('0xb')](),controller['update']);router[_0x5194('0xf')]('/:id',auth[_0x5194('0xb')](),controller[_0x5194('0x10')]);module[_0x5194('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f0a8619..39e970a 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 _0xcaa3=['STRING','name','#0091EA','sequelize','exports'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0xcaa3,0xcb));var _0x3caa=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcaa3[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x3caa('0x0'));module[_0x3caa('0x1')]={'name':{'type':Sequelize[_0x3caa('0x2')],'unique':_0x3caa('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3caa('0x2')],'defaultValue':_0x3caa('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc94f=['#0091EA','sequelize','STRING','name'];(function(_0x3adeed,_0x27a8df){var _0x5b98e2=function(_0x36672f){while(--_0x36672f){_0x3adeed['push'](_0x3adeed['shift']());}};_0x5b98e2(++_0x27a8df);}(_0xc94f,0xcd));var _0xfc94=function(_0x310d83,_0x31d73c){_0x310d83=_0x310d83-0x0;var _0x544377=_0xc94f[_0x310d83];return _0x544377;};'use strict';var Sequelize=require(_0xfc94('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc94('0x1')],'unique':_0xfc94('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xfc94('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b902fbf..fb361f0 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 _0x1152=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','keys','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0x1152,0x182));var _0x2115=function(_0x1e70d1,_0x1bd4cf){_0x1e70d1=_0x1e70d1-0x0;var _0x151699=_0x1152[_0x1e70d1];return _0x151699;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){var _0x485092=_0x27c2f5['get']({'plain':!![]});var _0x201c94=_0x2115('0x21');return db[_0x2115('0x22')]['destroy']({'where':{'type':_0x201c94,'resourceId':_0x485092['id']}})[_0x2115('0x1f')](function(){return _0x27c2f5;});})[_0x2115('0x1f')](function(){_0x40d19f[_0x2115('0x14')](0xcc)[_0x2115('0x23')]();});}};}function handleEntityNotFound(_0x3ca0ef,_0x57acd4){return function(_0xc329ec){if(!_0xc329ec){_0x3ca0ef[_0x2115('0x24')](0x194);}return _0xc329ec;};}function handleError(_0x4f3e8d,_0x358bf5){_0x358bf5=_0x358bf5||0x1f4;return function(_0x33d81c){logger[_0x2115('0x25')](_0x33d81c[_0x2115('0x26')]);if(_0x33d81c['name']){delete _0x33d81c[_0x2115('0x27')];}_0x4f3e8d[_0x2115('0x14')](_0x358bf5)[_0x2115('0x28')](_0x33d81c);};}exports[_0x2115('0x29')]=function(_0x21e6b9,_0x27969d){var _0x5ae269={},_0x4a5eca={},_0x2c293d={'count':0x0,'rows':[]};var _0x354820=_[_0x2115('0x2a')](db[_0x2115('0x2b')][_0x2115('0x2c')],function(_0x5bcc07){return{'name':_0x5bcc07[_0x2115('0x2d')],'type':_0x5bcc07[_0x2115('0x2e')][_0x2115('0x2f')]};});_0x4a5eca['model']=_[_0x2115('0x2a')](_0x354820,'name');_0x4a5eca[_0x2115('0x30')]=_['keys'](_0x21e6b9[_0x2115('0x30')]);_0x4a5eca[_0x2115('0x31')]=_[_0x2115('0x32')](_0x4a5eca['model'],_0x4a5eca['query']);_0x5ae269[_0x2115('0x33')]=_[_0x2115('0x32')](_0x4a5eca['model'],qs[_0x2115('0x34')](_0x21e6b9[_0x2115('0x30')][_0x2115('0x34')]));_0x5ae269[_0x2115('0x33')]=_0x5ae269['attributes'][_0x2115('0x35')]?_0x5ae269[_0x2115('0x33')]:_0x4a5eca[_0x2115('0x36')];if(!_0x21e6b9[_0x2115('0x30')]['hasOwnProperty'](_0x2115('0x37'))){_0x5ae269[_0x2115('0x18')]=qs[_0x2115('0x18')](_0x21e6b9[_0x2115('0x30')][_0x2115('0x18')]);_0x5ae269[_0x2115('0x16')]=qs['offset'](_0x21e6b9[_0x2115('0x30')][_0x2115('0x16')]);}_0x5ae269[_0x2115('0x38')]=qs[_0x2115('0x39')](_0x21e6b9[_0x2115('0x30')][_0x2115('0x39')]);_0x5ae269['where']=qs[_0x2115('0x31')](_['pick'](_0x21e6b9['query'],_0x4a5eca[_0x2115('0x31')]),_0x354820);if(_0x21e6b9[_0x2115('0x30')][_0x2115('0x3a')]){_0x5ae269[_0x2115('0x3b')]=_[_0x2115('0x3c')](_0x5ae269[_0x2115('0x3b')],{'$or':_['map'](_0x354820,function(_0xe19201){if(_0xe19201[_0x2115('0x2e')]!==_0x2115('0x3d')){var _0x19c159={};_0x19c159[_0xe19201[_0x2115('0x27')]]={'$like':'%'+_0x21e6b9[_0x2115('0x30')][_0x2115('0x3a')]+'%'};return _0x19c159;}})});}_0x5ae269=_[_0x2115('0x3c')]({},_0x5ae269,_0x21e6b9[_0x2115('0x3e')]);var _0x5e30a5={'where':_0x5ae269['where']};return db['Tag'][_0x2115('0x19')](_0x5e30a5)['then'](function(_0xa652de){_0x2c293d['count']=_0xa652de;if(_0x21e6b9['query']['includeAll']){_0x5ae269[_0x2115('0x3f')]=[{'all':!![]}];}return db[_0x2115('0x2b')][_0x2115('0x40')](_0x5ae269);})[_0x2115('0x1f')](function(_0x16f022){_0x2c293d['rows']=_0x16f022;return _0x2c293d;})[_0x2115('0x1f')](respondWithFilteredResult(_0x27969d,_0x5ae269))['catch'](handleError(_0x27969d,null));};exports[_0x2115('0x41')]=function(_0x459028,_0x56bae6){var _0x23711d={'raw':!![],'where':{'id':_0x459028['params']['id']}},_0x309f46={};_0x309f46['model']=_[_0x2115('0x42')](db[_0x2115('0x2b')]['rawAttributes']);_0x309f46['query']=_[_0x2115('0x42')](_0x459028[_0x2115('0x30')]);_0x309f46['filters']=_['intersection'](_0x309f46[_0x2115('0x36')],_0x309f46[_0x2115('0x30')]);_0x23711d[_0x2115('0x33')]=_['intersection'](_0x309f46[_0x2115('0x36')],qs['fields'](_0x459028[_0x2115('0x30')][_0x2115('0x34')]));_0x23711d[_0x2115('0x33')]=_0x23711d[_0x2115('0x33')][_0x2115('0x35')]?_0x23711d['attributes']:_0x309f46[_0x2115('0x36')];if(_0x459028['query']['includeAll']){_0x23711d[_0x2115('0x3f')]=[{'all':!![]}];}_0x23711d=_[_0x2115('0x3c')]({},_0x23711d,_0x459028['options']);return db[_0x2115('0x2b')][_0x2115('0x43')](_0x23711d)[_0x2115('0x1f')](handleEntityNotFound(_0x56bae6,null))[_0x2115('0x1f')](respondWithResult(_0x56bae6,null))[_0x2115('0x44')](handleError(_0x56bae6,null));};exports[_0x2115('0x45')]=function(_0x41d1a4,_0x347f16){return db[_0x2115('0x2b')]['create'](_0x41d1a4[_0x2115('0x46')],{})[_0x2115('0x1f')](function(_0xdf9fa7){var _0x537ba7=_0x41d1a4[_0x2115('0x47')]['get']({'plain':!![]});if(!_0x537ba7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x537ba7['role']===_0x2115('0x47')){var _0x24d601=_0xdf9fa7['get']({'plain':!![]});var _0x4c0e49=_0x2115('0x21');return db[_0x2115('0x48')][_0x2115('0x43')]({'where':{'name':_0x4c0e49,'userProfileId':_0x537ba7[_0x2115('0x49')]},'raw':!![]})[_0x2115('0x1f')](function(_0x384b2b){if(_0x384b2b&&_0x384b2b[_0x2115('0x4a')]===0x0){return db[_0x2115('0x22')]['create']({'name':_0x24d601[_0x2115('0x27')],'resourceId':_0x24d601['id'],'type':_0x384b2b[_0x2115('0x27')],'sectionId':_0x384b2b['id']},{})['then'](function(){return _0xdf9fa7;});}else{return _0xdf9fa7;}})[_0x2115('0x44')](function(_0x6de4e7){logger[_0x2115('0x25')](_0x2115('0x4b'),_0x6de4e7);throw _0x6de4e7;});}return _0xdf9fa7;})[_0x2115('0x1f')](respondWithResult(_0x347f16,0xc9))[_0x2115('0x44')](handleError(_0x347f16,null));};exports['update']=function(_0x2a388a,_0x392132){if(_0x2a388a['body']['id']){delete _0x2a388a['body']['id'];}return db[_0x2115('0x2b')][_0x2115('0x43')]({'where':{'id':_0x2a388a[_0x2115('0x4c')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x392132,null))['then'](saveUpdates(_0x2a388a[_0x2115('0x46')],null))[_0x2115('0x1f')](respondWithResult(_0x392132,null))[_0x2115('0x44')](handleError(_0x392132,null));};exports[_0x2115('0x20')]=function(_0xedd07f,_0x1bd210){return db['Tag'][_0x2115('0x43')]({'where':{'id':_0xedd07f[_0x2115('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1bd210,null))[_0x2115('0x1f')](removeEntity(_0x1bd210,null))[_0x2115('0x44')](handleError(_0x1bd210,null));}; \ No newline at end of file +var _0x5712=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','user','get','role','userProfileId','autoAssociation','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x119ec0,_0x206327){var _0x56f82b=function(_0x3db649){while(--_0x3db649){_0x119ec0['push'](_0x119ec0['shift']());}};_0x56f82b(++_0x206327);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){var _0x22cdb8=_0x5d6778['get']({'plain':!![]});var _0x5d455d=_0x2571('0x27');return db[_0x2571('0x28')][_0x2571('0x26')]({'where':{'type':_0x5d455d,'resourceId':_0x22cdb8['id']}})[_0x2571('0x25')](function(){return _0x5d6778;});})[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6ccc,_0x1ceb21){return function(_0x426615){if(!_0x426615){_0x4f6ccc[_0x2571('0x1a')](0x194);}return _0x426615;};}function handleError(_0x2ce206,_0x26757a){_0x26757a=_0x26757a||0x1f4;return function(_0x165aa8){logger[_0x2571('0x29')](_0x165aa8[_0x2571('0x2a')]);if(_0x165aa8[_0x2571('0x2b')]){delete _0x165aa8[_0x2571('0x2b')];}_0x2ce206['status'](_0x26757a)[_0x2571('0x2c')](_0x165aa8);};}exports[_0x2571('0x2d')]=function(_0x26af3c,_0x441e7d){var _0x1bf5d1={},_0x2902cb={},_0x5bc2e7={'count':0x0,'rows':[]};var _0x4c4911=_[_0x2571('0x2e')](db[_0x2571('0x2f')][_0x2571('0x30')],function(_0x2b6416){return{'name':_0x2b6416['fieldName'],'type':_0x2b6416[_0x2571('0x31')][_0x2571('0x32')]};});_0x2902cb['model']=_['map'](_0x4c4911,_0x2571('0x2b'));_0x2902cb[_0x2571('0x33')]=_[_0x2571('0x34')](_0x26af3c['query']);_0x2902cb[_0x2571('0x35')]=_[_0x2571('0x36')](_0x2902cb['model'],_0x2902cb[_0x2571('0x33')]);_0x1bf5d1['attributes']=_[_0x2571('0x36')](_0x2902cb[_0x2571('0x37')],qs[_0x2571('0x38')](_0x26af3c['query']['fields']));_0x1bf5d1[_0x2571('0x39')]=_0x1bf5d1['attributes'][_0x2571('0x3a')]?_0x1bf5d1[_0x2571('0x39')]:_0x2902cb[_0x2571('0x37')];if(!_0x26af3c[_0x2571('0x33')]['hasOwnProperty'](_0x2571('0x3b'))){_0x1bf5d1[_0x2571('0x20')]=qs['limit'](_0x26af3c[_0x2571('0x33')][_0x2571('0x20')]);_0x1bf5d1['offset']=qs[_0x2571('0x3c')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3c')]);}_0x1bf5d1[_0x2571('0x3d')]=qs[_0x2571('0x3e')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3e')]);_0x1bf5d1[_0x2571('0x3f')]=qs[_0x2571('0x35')](_[_0x2571('0x40')](_0x26af3c[_0x2571('0x33')],_0x2902cb[_0x2571('0x35')]),_0x4c4911);if(_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]){_0x1bf5d1['where']=_[_0x2571('0x42')](_0x1bf5d1[_0x2571('0x3f')],{'$or':_[_0x2571('0x2e')](_0x4c4911,function(_0x440752){if(_0x440752[_0x2571('0x31')]!==_0x2571('0x43')){var _0x35deff={};_0x35deff[_0x440752['name']]={'$like':'%'+_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]+'%'};return _0x35deff;}})});}_0x1bf5d1=_[_0x2571('0x42')]({},_0x1bf5d1,_0x26af3c['options']);var _0x5fe079={'where':_0x1bf5d1[_0x2571('0x3f')]};return db[_0x2571('0x2f')]['count'](_0x5fe079)[_0x2571('0x25')](function(_0x1c6ccd){_0x5bc2e7[_0x2571('0x1f')]=_0x1c6ccd;if(_0x26af3c[_0x2571('0x33')][_0x2571('0x44')]){_0x1bf5d1[_0x2571('0x45')]=[{'all':!![]}];}return db[_0x2571('0x2f')][_0x2571('0x46')](_0x1bf5d1);})[_0x2571('0x25')](function(_0x5d2734){_0x5bc2e7[_0x2571('0x47')]=_0x5d2734;return _0x5bc2e7;})[_0x2571('0x25')](respondWithFilteredResult(_0x441e7d,_0x1bf5d1))[_0x2571('0x48')](handleError(_0x441e7d,null));};exports[_0x2571('0x49')]=function(_0x2411d9,_0x1e6f2c){var _0x391c01={'raw':!![],'where':{'id':_0x2411d9['params']['id']}},_0x2d024c={};_0x2d024c['model']=_['keys'](db['Tag']['rawAttributes']);_0x2d024c['query']=_[_0x2571('0x34')](_0x2411d9[_0x2571('0x33')]);_0x2d024c['filters']=_[_0x2571('0x36')](_0x2d024c[_0x2571('0x37')],_0x2d024c[_0x2571('0x33')]);_0x391c01[_0x2571('0x39')]=_[_0x2571('0x36')](_0x2d024c['model'],qs['fields'](_0x2411d9['query'][_0x2571('0x38')]));_0x391c01[_0x2571('0x39')]=_0x391c01[_0x2571('0x39')][_0x2571('0x3a')]?_0x391c01[_0x2571('0x39')]:_0x2d024c[_0x2571('0x37')];if(_0x2411d9[_0x2571('0x33')]['includeAll']){_0x391c01[_0x2571('0x45')]=[{'all':!![]}];}_0x391c01=_[_0x2571('0x42')]({},_0x391c01,_0x2411d9[_0x2571('0x4a')]);return db['Tag'][_0x2571('0x4b')](_0x391c01)[_0x2571('0x25')](handleEntityNotFound(_0x1e6f2c,null))[_0x2571('0x25')](respondWithResult(_0x1e6f2c,null))[_0x2571('0x48')](handleError(_0x1e6f2c,null));};exports['create']=function(_0x18291c,_0x245edb){return db[_0x2571('0x2f')][_0x2571('0x4c')](_0x18291c['body'],{})[_0x2571('0x25')](function(_0xef8f21){var _0x10d956=_0x18291c[_0x2571('0x4d')][_0x2571('0x4e')]({'plain':!![]});if(!_0x10d956)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10d956[_0x2571('0x4f')]===_0x2571('0x4d')){var _0x20302b=_0xef8f21[_0x2571('0x4e')]({'plain':!![]});var _0x6a55ff=_0x2571('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x6a55ff,'userProfileId':_0x10d956[_0x2571('0x50')]},'raw':!![]})['then'](function(_0x47ff18){if(_0x47ff18&&_0x47ff18[_0x2571('0x51')]===0x0){return db[_0x2571('0x28')][_0x2571('0x4c')]({'name':_0x20302b[_0x2571('0x2b')],'resourceId':_0x20302b['id'],'type':_0x47ff18[_0x2571('0x2b')],'sectionId':_0x47ff18['id']},{})[_0x2571('0x25')](function(){return _0xef8f21;});}else{return _0xef8f21;}})[_0x2571('0x48')](function(_0x3c890a){logger[_0x2571('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c890a);throw _0x3c890a;});}return _0xef8f21;})[_0x2571('0x25')](respondWithResult(_0x245edb,0xc9))[_0x2571('0x48')](handleError(_0x245edb,null));};exports[_0x2571('0x52')]=function(_0x495c45,_0x3823c9){if(_0x495c45['body']['id']){delete _0x495c45[_0x2571('0x53')]['id'];}return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x495c45['params']['id']}})['then'](handleEntityNotFound(_0x3823c9,null))['then'](saveUpdates(_0x495c45['body'],null))[_0x2571('0x25')](respondWithResult(_0x3823c9,null))[_0x2571('0x48')](handleError(_0x3823c9,null));};exports[_0x2571('0x26')]=function(_0x3ce2b9,_0x333b91){return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x3ce2b9[_0x2571('0x54')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x333b91,null))[_0x2571('0x25')](removeEntity(_0x333b91,null))[_0x2571('0x48')](handleError(_0x333b91,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index c475bb9..379e2d5 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 _0x0c96=['Tag','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./tag.attributes','define'];(function(_0x17ef35,_0x203cd8){var _0x2e1e26=function(_0x132ecd){while(--_0x132ecd){_0x17ef35['push'](_0x17ef35['shift']());}};_0x2e1e26(++_0x203cd8);}(_0x0c96,0x177));var _0x60c9=function(_0xb46497,_0x28058a){_0xb46497=_0xb46497-0x0;var _0x161801=_0x0c96[_0xb46497];return _0x161801;};'use strict';var _=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var logger=require(_0x60c9('0x2'))(_0x60c9('0x3'));var moment=require(_0x60c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c9('0x5'));var fs=require('fs');var path=require(_0x60c9('0x6'));var rimraf=require(_0x60c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x60c9('0x8'));module['exports']=function(_0x3c6667,_0x14d56e){return _0x3c6667[_0x60c9('0x9')](_0x60c9('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaaf=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2af341,_0x492d40){var _0x2ca333=function(_0x259a1d){while(--_0x259a1d){_0x2af341['push'](_0x2af341['shift']());}};_0x2ca333(++_0x492d40);}(_0xbaaf,0x1a8));var _0xfbaa=function(_0x1a6e89,_0x191f27){_0x1a6e89=_0x1a6e89-0x0;var _0x4b9d9c=_0xbaaf[_0x1a6e89];return _0x4b9d9c;};'use strict';var _=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var logger=require(_0xfbaa('0x2'))(_0xfbaa('0x3'));var moment=require(_0xfbaa('0x4'));var BPromise=require(_0xfbaa('0x5'));var rp=require(_0xfbaa('0x6'));var fs=require('fs');var path=require(_0xfbaa('0x7'));var rimraf=require(_0xfbaa('0x8'));var config=require(_0xfbaa('0x9'));var attributes=require('./tag.attributes');module[_0xfbaa('0xa')]=function(_0x1ed796,_0x10dd1c){return _0x1ed796[_0xfbaa('0xb')](_0xfbaa('0xc'),attributes,{'tableName':_0xfbaa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 47d9b5b..5dc60f4 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 _0x6c32=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x40dc7e,_0x322488){var _0x31f6d4=function(_0x2db5e2){while(--_0x2db5e2){_0x40dc7e['push'](_0x40dc7e['shift']());}};_0x31f6d4(++_0x322488);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var moment=require(_0x26c3('0x2'));var BPromise=require(_0x26c3('0x3'));var rs=require(_0x26c3('0x4'));var fs=require('fs');var Redis=require(_0x26c3('0x5'));var db=require(_0x26c3('0x6'))['db'];var utils=require(_0x26c3('0x7'));var logger=require(_0x26c3('0x8'))('rpc');var config=require(_0x26c3('0x9'));var jayson=require(_0x26c3('0xa'));var client=jayson[_0x26c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x187b81,_0x5b3a5f,_0x3dde22){return new BPromise(function(_0x3ff8e7,_0x1a4c5b){return client[_0x26c3('0xc')](_0x187b81,_0x3dde22)[_0x26c3('0xd')](function(_0xda2203){logger[_0x26c3('0xe')](_0x26c3('0xf'),_0x5b3a5f,_0x26c3('0x10'));logger[_0x26c3('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x5b3a5f,'request\x20sent',JSON['stringify'](_0xda2203));if(_0xda2203['error']){if(_0xda2203[_0x26c3('0x12')][_0x26c3('0x13')]===0x1f4){logger[_0x26c3('0x12')](_0x26c3('0xf'),_0x5b3a5f,_0xda2203['error']['message']);return _0x1a4c5b(_0xda2203[_0x26c3('0x12')][_0x26c3('0x14')]);}logger[_0x26c3('0x12')](_0x26c3('0xf'),_0x5b3a5f,_0xda2203[_0x26c3('0x12')]['message']);return _0x3ff8e7(_0xda2203['error'][_0x26c3('0x14')]);}else{logger[_0x26c3('0xe')]('Tag,\x20%s,\x20%s',_0x5b3a5f,'request\x20sent');_0x3ff8e7(_0xda2203[_0x26c3('0x15')]['message']);}})[_0x26c3('0x16')](function(_0x486486){logger['error'](_0x26c3('0xf'),_0x5b3a5f,_0x486486);_0x1a4c5b(_0x486486);});});} \ No newline at end of file +var _0x4fef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x5c2f94,_0xe9c5ec){var _0x52ded1=function(_0x108b75){while(--_0x108b75){_0x5c2f94['push'](_0x5c2f94['shift']());}};_0x52ded1(++_0xe9c5ec);}(_0x4fef,0x10f));var _0xf4fe=function(_0x5756af,_0x11a76a){_0x5756af=_0x5756af-0x0;var _0x507ced=_0x4fef[_0x5756af];return _0x507ced;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5e81aa0..6112de6 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b83b2d7..5793e13 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb7e7[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x3c4a4e,_0x2b45e1){var _0x3e5982=function(_0x33159f){while(--_0x33159f){_0x3c4a4e['push'](_0x3c4a4e['shift']());}};_0x3e5982(++_0x2b45e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x21d0d7,_0x4c55a3){_0x21d0d7=_0x21d0d7-0x0;var _0x5e725b=_0xb10b[_0x21d0d7];return _0x5e725b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 66e0f1f..87c03d7 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 _0x2021=['count','set','reject','save','update','then','error','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','ValidationError','Unknown\x20channel','keys','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','isValidChannel','removeQueues','remove','ids','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Voice','through','QueueId','TeamVoiceQueue','penalty','User','emit','Queue:save','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','voicePause','all','Whatsapp','removeAgents','getAgents','nolimit','rimraf','zip-dir','request-promise','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./team.socket','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x22cd51,_0x115d0a){var _0x523854=function(_0x2df46d){while(--_0x2df46d){_0x22cd51['push'](_0x22cd51['shift']());}};_0x523854(++_0x115d0a);}(_0x2021,0x76));var _0x1202=function(_0x10b75b,_0x15c82f){_0x10b75b=_0x10b75b-0x0;var _0x3a3d3d=_0x2021[_0x10b75b];return _0x3a3d3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1202('0x0'));var zipdir=require(_0x1202('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1202('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1202('0x3'));var util=require(_0x1202('0x4'));var path=require(_0x1202('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1202('0x6'));var fs=require('fs');var fs_extra=require(_0x1202('0x7'));var _=require('lodash');var squel=require(_0x1202('0x8'));var crypto=require('crypto');var jsforce=require(_0x1202('0x9'));var deskjs=require(_0x1202('0xa'));var toCsv=require(_0x1202('0xb'));var querystring=require(_0x1202('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1202('0xd'));var qs=require(_0x1202('0xe'));var as=require(_0x1202('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1202('0x10'))('api');var utils=require(_0x1202('0x11'));var config=require(_0x1202('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1202('0x13'))['db'];config[_0x1202('0x14')]=_[_0x1202('0x15')](config[_0x1202('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1202('0x14')]));require(_0x1202('0x16'))['register'](socket);function respondWithStatusCode(_0x360bb3,_0x2de284){_0x2de284=_0x2de284||0xcc;return function(_0x31ffae){if(_0x31ffae){return _0x360bb3[_0x1202('0x17')](_0x2de284);}return _0x360bb3[_0x1202('0x18')](_0x2de284)[_0x1202('0x19')]();};}function respondWithResult(_0x5730f6,_0x1174db){_0x1174db=_0x1174db||0xc8;return function(_0x568655){if(_0x568655){return _0x5730f6[_0x1202('0x18')](_0x1174db)[_0x1202('0x1a')](_0x568655);}};}function respondWithFilteredResult(_0x665f97,_0x579a7b){return function(_0x3016cd){if(_0x3016cd){var _0x48c71f=typeof _0x579a7b[_0x1202('0x1b')]===_0x1202('0x1c')&&typeof _0x579a7b[_0x1202('0x1d')]===_0x1202('0x1c');var _0x3baefb=_0x3016cd[_0x1202('0x1e')];var _0x4f5946=_0x48c71f?0x0:_0x579a7b[_0x1202('0x1b')];var _0x1f2ed2=_0x48c71f?_0x3016cd[_0x1202('0x1e')]:_0x579a7b[_0x1202('0x1b')]+_0x579a7b[_0x1202('0x1d')];var _0x12010d;if(_0x1f2ed2>=_0x3baefb){_0x1f2ed2=_0x3baefb;_0x12010d=0xc8;}else{_0x12010d=0xce;}_0x665f97[_0x1202('0x18')](_0x12010d);return _0x665f97[_0x1202('0x1f')]('Content-Range',_0x4f5946+'-'+_0x1f2ed2+'/'+_0x3baefb)[_0x1202('0x1a')](_0x3016cd);}return null;};}function patchUpdates(_0x3fa6f3){return function(_0x33ed5e){try{jsonpatch['apply'](_0x33ed5e,_0x3fa6f3,!![]);}catch(_0x24e107){return BPromise[_0x1202('0x20')](_0x24e107);}return _0x33ed5e[_0x1202('0x21')]();};}function saveUpdates(_0x593683,_0x3ff199){return function(_0x284e56){if(_0x284e56){return _0x284e56[_0x1202('0x22')](_0x593683)[_0x1202('0x23')](function(_0x3b3a9e){return _0x3b3a9e;});}return null;};}function handleEntityNotFound(_0x4ecf09,_0x4d7d12){return function(_0x1d44ea){if(!_0x1d44ea){_0x4ecf09[_0x1202('0x17')](0x194);}return _0x1d44ea;};}function handleError(_0x1977a1,_0x2876f3){_0x2876f3=_0x2876f3||0x1f4;return function(_0x52ad8d){logger[_0x1202('0x24')](_0x52ad8d[_0x1202('0x25')]);if(_0x52ad8d[_0x1202('0x26')]){delete _0x52ad8d[_0x1202('0x26')];}_0x1977a1['status'](_0x2876f3)[_0x1202('0x27')](_0x52ad8d);};}exports['index']=function(_0x1b1373,_0x468bef){var _0x26a6fc={},_0x35a959={},_0x36f95e={'count':0x0,'rows':[]};var _0xe3546d=_['map'](db[_0x1202('0x28')][_0x1202('0x29')],function(_0x50a772){return{'name':_0x50a772[_0x1202('0x2a')],'type':_0x50a772[_0x1202('0x2b')][_0x1202('0x2c')]};});_0x35a959[_0x1202('0x2d')]=_[_0x1202('0x2e')](_0xe3546d,_0x1202('0x26'));_0x35a959[_0x1202('0x2f')]=_['keys'](_0x1b1373[_0x1202('0x2f')]);_0x35a959['filters']=_[_0x1202('0x30')](_0x35a959[_0x1202('0x2d')],_0x35a959['query']);_0x26a6fc[_0x1202('0x31')]=_['intersection'](_0x35a959['model'],qs[_0x1202('0x32')](_0x1b1373[_0x1202('0x2f')]['fields']));_0x26a6fc[_0x1202('0x31')]=_0x26a6fc[_0x1202('0x31')]['length']?_0x26a6fc[_0x1202('0x31')]:_0x35a959['model'];if(!_0x1b1373[_0x1202('0x2f')][_0x1202('0x33')]('nolimit')){_0x26a6fc['limit']=qs[_0x1202('0x1d')](_0x1b1373[_0x1202('0x2f')][_0x1202('0x1d')]);_0x26a6fc[_0x1202('0x1b')]=qs['offset'](_0x1b1373['query']['offset']);}_0x26a6fc[_0x1202('0x34')]=qs[_0x1202('0x35')](_0x1b1373[_0x1202('0x2f')][_0x1202('0x35')]);_0x26a6fc['where']=qs[_0x1202('0x36')](_[_0x1202('0x37')](_0x1b1373[_0x1202('0x2f')],_0x35a959[_0x1202('0x36')]),_0xe3546d);if(_0x1b1373[_0x1202('0x2f')][_0x1202('0x38')]){_0x26a6fc[_0x1202('0x39')]=_[_0x1202('0x3a')](_0x26a6fc[_0x1202('0x39')],{'$or':_[_0x1202('0x2e')](_0xe3546d,function(_0x49b972){if(_0x49b972[_0x1202('0x2b')]!==_0x1202('0x3b')){var _0x379b27={};_0x379b27[_0x49b972[_0x1202('0x26')]]={'$like':'%'+_0x1b1373[_0x1202('0x2f')][_0x1202('0x38')]+'%'};return _0x379b27;}})});}_0x26a6fc=_[_0x1202('0x3a')]({},_0x26a6fc,_0x1b1373[_0x1202('0x3c')]);var _0x2a5e2d={'where':_0x26a6fc[_0x1202('0x39')]};return db[_0x1202('0x28')][_0x1202('0x1e')](_0x2a5e2d)[_0x1202('0x23')](function(_0x28f61d){_0x36f95e['count']=_0x28f61d;if(_0x1b1373[_0x1202('0x2f')][_0x1202('0x3d')]){_0x26a6fc[_0x1202('0x3e')]=[{'all':!![]}];}return db[_0x1202('0x28')]['findAll'](_0x26a6fc);})[_0x1202('0x23')](function(_0x3250ad){_0x36f95e['rows']=_0x3250ad;return _0x36f95e;})[_0x1202('0x23')](respondWithFilteredResult(_0x468bef,_0x26a6fc))[_0x1202('0x3f')](handleError(_0x468bef,null));};exports['show']=function(_0x50b0c2,_0x4bbb77){var _0x89ad7={'raw':![],'where':{'id':_0x50b0c2[_0x1202('0x40')]['id']}},_0x1d7eb5={};_0x1d7eb5[_0x1202('0x2d')]=_['keys'](db['Team'][_0x1202('0x29')]);_0x1d7eb5[_0x1202('0x2f')]=_['keys'](_0x50b0c2[_0x1202('0x2f')]);_0x1d7eb5[_0x1202('0x36')]=_[_0x1202('0x30')](_0x1d7eb5[_0x1202('0x2d')],_0x1d7eb5[_0x1202('0x2f')]);_0x89ad7['attributes']=_[_0x1202('0x30')](_0x1d7eb5[_0x1202('0x2d')],qs['fields'](_0x50b0c2[_0x1202('0x2f')][_0x1202('0x32')]));_0x89ad7[_0x1202('0x31')]=_0x89ad7[_0x1202('0x31')][_0x1202('0x41')]?_0x89ad7['attributes']:_0x1d7eb5[_0x1202('0x2d')];if(_0x50b0c2[_0x1202('0x2f')][_0x1202('0x3d')]){_0x89ad7[_0x1202('0x3e')]=[{'all':!![]}];}_0x89ad7=_[_0x1202('0x3a')]({},_0x89ad7,_0x50b0c2['options']);return db[_0x1202('0x28')][_0x1202('0x42')](_0x89ad7)[_0x1202('0x23')](handleEntityNotFound(_0x4bbb77,null))[_0x1202('0x23')](respondWithResult(_0x4bbb77,null))[_0x1202('0x3f')](handleError(_0x4bbb77,null));};exports[_0x1202('0x43')]=function(_0x4e2286,_0x53f62c){return db[_0x1202('0x28')]['create'](_0x4e2286[_0x1202('0x44')],{})[_0x1202('0x23')](function(_0x54878e){var _0x3bbbba=_0x4e2286[_0x1202('0x45')]['get']({'plain':!![]});if(!_0x3bbbba)throw new Error(_0x1202('0x46'));if(_0x3bbbba[_0x1202('0x47')]==='user'){var _0x49e506=_0x54878e[_0x1202('0x48')]({'plain':!![]});var _0x498963=_0x1202('0x49');return db[_0x1202('0x4a')]['find']({'where':{'name':_0x498963,'userProfileId':_0x3bbbba[_0x1202('0x4b')]},'raw':!![]})[_0x1202('0x23')](function(_0x2a3947){if(_0x2a3947&&_0x2a3947[_0x1202('0x4c')]===0x0){return db[_0x1202('0x4d')][_0x1202('0x43')]({'name':_0x49e506[_0x1202('0x26')],'resourceId':_0x49e506['id'],'type':_0x2a3947['name'],'sectionId':_0x2a3947['id']},{})[_0x1202('0x23')](function(){return _0x54878e;});}else{return _0x54878e;}})[_0x1202('0x3f')](function(_0x2a2ed0){logger[_0x1202('0x24')](_0x1202('0x4e'),_0x2a2ed0);throw _0x2a2ed0;});}return _0x54878e;})[_0x1202('0x23')](respondWithResult(_0x53f62c,0xc9))[_0x1202('0x3f')](handleError(_0x53f62c,null));};exports['update']=function(_0x2fe3ce,_0x57df7d){if(_0x2fe3ce['body']['id']){delete _0x2fe3ce['body']['id'];}return db[_0x1202('0x28')][_0x1202('0x42')]({'where':{'id':_0x2fe3ce['params']['id']}})[_0x1202('0x23')](handleEntityNotFound(_0x57df7d,null))['then'](saveUpdates(_0x2fe3ce[_0x1202('0x44')],null))['then'](respondWithResult(_0x57df7d,null))[_0x1202('0x3f')](handleError(_0x57df7d,null));};exports[_0x1202('0x4f')]=function(_0x2bbcd8,_0x1b90b8){var _0x1de0bf=_0x2bbcd8[_0x1202('0x40')]['id'];var _0x5ed411=[];return db[_0x1202('0x50')][_0x1202('0x51')](function(_0x8e1046){var _0x202117=_0x1202('0x52')+_0x1de0bf;return db[_0x1202('0x50')][_0x1202('0x2f')](_0x202117,{'type':db[_0x1202('0x53')]['QueryTypes'][_0x1202('0x54')],'raw':!![],'transaction':_0x8e1046})['then'](function(_0x771407){_0x5ed411=_[_0x1202('0x2e')](_0x771407,function(_0x112978){return Number(_0x112978[_0x1202('0x55')]);});})[_0x1202('0x23')](function(){var _0x108ca4=_0x1202('0x56')+_0x1de0bf;return db[_0x1202('0x50')][_0x1202('0x2f')](_0x108ca4,{'type':db[_0x1202('0x53')][_0x1202('0x57')][_0x1202('0x54')],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x56b611){var _0x12b857=_[_0x1202('0x2e')](_0x56b611,function(_0x1bf53c){return Number(_0x1bf53c[_0x1202('0x58')]);});return db[_0x1202('0x59')]['destroy']({'where':{'UserId':{'$in':_0x5ed411},'VoiceQueueId':{'$in':_0x12b857}},'transaction':_0x8e1046});})['then'](function(){var _0x154554='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1de0bf;return db['sequelize'][_0x1202('0x2f')](_0x154554,{'type':db[_0x1202('0x53')][_0x1202('0x57')][_0x1202('0x54')],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x1ae4ba){var _0x949927=_[_0x1202('0x2e')](_0x1ae4ba,function(_0x1d2f3b){return Number(_0x1d2f3b[_0x1202('0x5a')]);});return db[_0x1202('0x5b')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'MailQueueId':{'$in':_0x949927}},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){var _0x516eff=_0x1202('0x5c')+_0x1de0bf;return db[_0x1202('0x50')][_0x1202('0x2f')](_0x516eff,{'type':db[_0x1202('0x53')]['QueryTypes'][_0x1202('0x54')],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x1d7802){var _0x466782=_[_0x1202('0x2e')](_0x1d7802,function(_0xfdb258){return Number(_0xfdb258[_0x1202('0x5d')]);});return db['UserSmsQueue'][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'SmsQueueId':{'$in':_0x466782}},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){var _0x51bcc9=_0x1202('0x5e')+_0x1de0bf;return db[_0x1202('0x50')][_0x1202('0x2f')](_0x51bcc9,{'type':db[_0x1202('0x53')]['QueryTypes'][_0x1202('0x54')],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x59de3d){var _0x31c29f=_[_0x1202('0x2e')](_0x59de3d,function(_0x1b03d7){return Number(_0x1b03d7[_0x1202('0x5f')]);});return db[_0x1202('0x60')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'ChatQueueId':{'$in':_0x31c29f}},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){var _0x317df9='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1de0bf;return db[_0x1202('0x50')]['query'](_0x317df9,{'type':db[_0x1202('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x58cd5b){var _0x2b7f3a=_[_0x1202('0x2e')](_0x58cd5b,function(_0x1fb5ec){return Number(_0x1fb5ec['FaxQueueId']);});return db[_0x1202('0x61')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'FaxQueueId':{'$in':_0x2b7f3a}},'transaction':_0x8e1046});})['then'](function(){var _0x409532=_0x1202('0x62')+_0x1de0bf;return db[_0x1202('0x50')][_0x1202('0x2f')](_0x409532,{'type':db[_0x1202('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x505afd){var _0x274f46=_[_0x1202('0x2e')](_0x505afd,function(_0x4aefa9){return Number(_0x4aefa9[_0x1202('0x63')]);});return db[_0x1202('0x64')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'OpenchannelQueueId':{'$in':_0x274f46}},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){var _0x8b8b9a=_0x1202('0x65')+_0x1de0bf;return db['sequelize'][_0x1202('0x2f')](_0x8b8b9a,{'type':db[_0x1202('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x8e1046});})[_0x1202('0x23')](function(_0x37a4a6){var _0x3e58ed=_[_0x1202('0x2e')](_0x37a4a6,function(_0x4b3e83){return Number(_0x4b3e83[_0x1202('0x66')]);});return db[_0x1202('0x67')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'WhatsappQueueId':{'$in':_0x3e58ed}},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){return db[_0x1202('0x68')][_0x1202('0x42')]({'where':{'TeamId':_0x1de0bf}});})[_0x1202('0x23')](function(_0xb02995){if(_0xb02995===null){return;}return db[_0x1202('0x69')][_0x1202('0x4f')]({'where':{'UserId':{'$in':_0x5ed411},'VoicePrefixId':_0xb02995[_0x1202('0x6a')]},'transaction':_0x8e1046});})[_0x1202('0x23')](function(){return db[_0x1202('0x28')][_0x1202('0x4f')]({'where':{'id':_0x1de0bf},'cascade':!![],'transaction':_0x8e1046});})['then'](function(_0x8127ea){if(_0x8127ea===0x0){_0x1b90b8[_0x1202('0x17')](0x194);}else{return db[_0x1202('0x4d')]['destroy']({'where':{'type':_0x1202('0x49'),'resourceId':_0x1de0bf},'cascade':!![],'transaction':_0x8e1046})[_0x1202('0x23')](function(){_0x1b90b8[_0x1202('0x18')](0xcc)[_0x1202('0x19')]();});}})['catch'](function(_0x4a5fc3){_0x1b90b8[_0x1202('0x18')](0x1f4)[_0x1202('0x27')](_0x4a5fc3);});});};exports[_0x1202('0x6b')]=function(_0x4e9d7c,_0x95379,_0x8ae628){return db[_0x1202('0x28')]['findOne']({'where':{'id':_0x4e9d7c[_0x1202('0x40')]['id']}})[_0x1202('0x23')](handleEntityNotFound(_0x95379,null))['then'](function(_0x154abc){if(!_0x4e9d7c['query'][_0x1202('0x6c')]||!utils['isValidChannel'](_0x4e9d7c[_0x1202('0x2f')][_0x1202('0x6c')])){throw new db['Sequelize'][(_0x1202('0x6d'))](_0x1202('0x6e'));}var _0x5a1d57={};var _0x42763c={};_0x42763c['model']=_[_0x1202('0x6f')](db[_[_0x1202('0x70')](_0x4e9d7c[_0x1202('0x2f')][_0x1202('0x6c')][_0x1202('0x71')]())+_0x1202('0x72')][_0x1202('0x29')]);_0x42763c[_0x1202('0x2f')]=_['keys'](_0x4e9d7c[_0x1202('0x2f')]);_0x42763c[_0x1202('0x36')]=_[_0x1202('0x30')](_0x42763c[_0x1202('0x2d')],_0x42763c['query']);_0x5a1d57[_0x1202('0x31')]=_[_0x1202('0x30')](_0x42763c[_0x1202('0x2d')],qs[_0x1202('0x32')](_0x4e9d7c[_0x1202('0x2f')]['fields']));_0x5a1d57[_0x1202('0x31')]=_0x5a1d57['attributes']['length']?_0x5a1d57[_0x1202('0x31')]:_0x42763c[_0x1202('0x2d')];_0x5a1d57[_0x1202('0x1d')]=qs[_0x1202('0x1d')](_0x4e9d7c['query'][_0x1202('0x1d')]);_0x5a1d57[_0x1202('0x1b')]=qs['offset'](_0x4e9d7c[_0x1202('0x2f')][_0x1202('0x1b')]);_0x5a1d57['order']=qs['sort'](_0x4e9d7c['query']['sort']);_0x5a1d57[_0x1202('0x39')]=qs[_0x1202('0x36')](_['pick'](_0x4e9d7c[_0x1202('0x2f')],_0x42763c['filters']));_0x5a1d57=_[_0x1202('0x3a')]({},_0x5a1d57,_0x4e9d7c[_0x1202('0x3c')]);return _0x154abc[_0x1202('0x48')+_[_0x1202('0x70')](_0x4e9d7c[_0x1202('0x2f')]['channel'][_0x1202('0x71')]())+_0x1202('0x73')](_0x5a1d57);})['then'](respondWithResult(_0x95379,null))['catch'](handleError(_0x95379,null));};exports[_0x1202('0x74')]=function(_0x51e779,_0x2a46e9,_0x6d217f){return db[_0x1202('0x28')][_0x1202('0x75')]({'where':{'id':_0x51e779[_0x1202('0x40')]['id']}})[_0x1202('0x23')](function(_0x39a2a6){if(_0x39a2a6){if(!_0x51e779[_0x1202('0x44')]['channel']||!utils[_0x1202('0x76')](_0x51e779['body'][_0x1202('0x6c')])){throw new db['Sequelize'][(_0x1202('0x6d'))]('Unknown\x20channel');}return _0x39a2a6['add'+_['capitalize'](_0x51e779['body'][_0x1202('0x6c')][_0x1202('0x71')]())+_0x1202('0x73')](_0x51e779[_0x1202('0x44')]['ids']);}return null;})[_0x1202('0x23')](handleEntityNotFound(_0x2a46e9,null))[_0x1202('0x23')](respondWithStatusCode(_0x2a46e9,null))['catch'](handleError(_0x2a46e9,null));};exports[_0x1202('0x77')]=function(_0x295f5f,_0xde8d07,_0x25d8d0){return db[_0x1202('0x28')][_0x1202('0x75')]({'where':{'id':_0x295f5f[_0x1202('0x40')]['id']}})['then'](function(_0x509f4c){if(_0x509f4c){if(!_0x295f5f['query'][_0x1202('0x6c')]||!utils[_0x1202('0x76')](_0x295f5f[_0x1202('0x2f')]['channel'])){throw new db['Sequelize'][(_0x1202('0x6d'))](_0x1202('0x6e'));}return _0x509f4c[_0x1202('0x78')+_[_0x1202('0x70')](_0x295f5f[_0x1202('0x2f')][_0x1202('0x6c')][_0x1202('0x71')]())+'Queues'](_0x295f5f['query'][_0x1202('0x79')]);}return null;})[_0x1202('0x23')](handleEntityNotFound(_0xde8d07,null))[_0x1202('0x23')](respondWithStatusCode(_0xde8d07,null))[_0x1202('0x3f')](handleError(_0xde8d07,null));};exports[_0x1202('0x7a')]=function(_0x167ce4,_0x3bf473){var _0x3416c7=_[_0x1202('0x7b')](_0x167ce4[_0x1202('0x44')][_0x1202('0x79')])?_0x167ce4[_0x1202('0x44')][_0x1202('0x79')]:[_0x167ce4['body']['ids']];var _0x4473d2=_0x167ce4[_0x1202('0x40')]['id'];return db[_0x1202('0x28')][_0x1202('0x42')]({'where':{'id':_0x4473d2}})[_0x1202('0x23')](handleEntityNotFound(_0x3bf473,null))['then'](function(_0x40651c){if(_0x40651c){var _0x174993=['Voice',_0x1202('0x7c'),_0x1202('0x7d'),_0x1202('0x7e'),_0x1202('0x7f'),_0x1202('0x80'),'Whatsapp'];return db[_0x1202('0x50')][_0x1202('0x51')](function(_0x5791b3){var _0x3879e0=_[_0x1202('0x2e')](_0x174993,function(_0x17a932){var _0x4d3e65={'attributes':['id',_0x1202('0x26')]};if(_0x17a932===_0x1202('0x81')){_0x4d3e65[_0x1202('0x82')]={'attributes':['penalty']};}return _0x40651c['get'+_0x17a932+_0x1202('0x73')](_0x4d3e65)['then'](function(_0x141d06){var _0x5869fa=_['map'](_0x141d06,function(_0x208a73){var _0x2e836f=_[_0x1202('0x2e')](_0x3416c7,function(_0x225dcc){var _0xa08db5={'where':{'UserId':_0x225dcc,[_0x17a932+_0x1202('0x83')]:_0x208a73['id']},'transaction':_0x5791b3};if(_0x17a932==='Voice'){_0xa08db5[_0x1202('0x15')]={'penalty':_0x208a73[_0x1202('0x84')][_0x1202('0x85')]};}return db[_0x1202('0x86')+_0x17a932+'Queue']['findOrCreate'](_0xa08db5)[_0x1202('0x23')](function(){socket[_0x1202('0x87')](_0x1202('0x45')+_0x17a932+_0x1202('0x88'),{'UserId':_0x225dcc,[_0x17a932+_0x1202('0x83')]:_0x208a73['id']});if(_0x17a932!==_0x1202('0x81')){return;}return db[_0x1202('0x86')]['findAll']({'where':{'id':_0x3416c7,'online':0x1},'attributes':['id',_0x1202('0x26'),'online','voicePause',_0x1202('0x89')],'raw':!![]})['then'](function(_0x430eb6){var _0x9e1398=_['map'](_0x430eb6,function(_0x5a2551){return db[_0x1202('0x8a')][_0x1202('0x8b')]({'membername':_0x5a2551[_0x1202('0x26')],'UserId':_0x5a2551['id'],'queue_name':_0x208a73[_0x1202('0x26')],'VoiceQueueId':_0x208a73['id'],'interface':_[_0x1202('0x8c')](_0x5a2551[_0x1202('0x89')])?util['format'](_0x1202('0x8d'),_0x5a2551[_0x1202('0x26')]):_0x5a2551['interface'],'paused':_0x5a2551[_0x1202('0x8e')]||![],'penalty':_0x208a73[_0x1202('0x84')]['penalty']},{'transaction':_0x5791b3});});return Promise['all'](_0x9e1398);});});});return Promise[_0x1202('0x8f')](_0x2e836f);});return Promise[_0x1202('0x8f')](_0x5869fa);})['then'](function(){return db[_0x1202('0x68')][_0x1202('0x75')]({'where':{'teamId':_0x4473d2}})[_0x1202('0x23')](function(_0x1bb674){if(_0x1bb674){var _0x47698c=_[_0x1202('0x2e')](_0x3416c7,function(_0x308191){db[_0x1202('0x69')]['upsert']({'UserId':_0x308191,'VoicePrefixId':_0x1bb674[_0x1202('0x6a')]});});return Promise[_0x1202('0x8f')](_0x47698c);}});});});return Promise[_0x1202('0x8f')](_0x3879e0)['then'](function(){return _0x40651c[_0x1202('0x7a')](_0x3416c7,{'transaction':_0x5791b3})['spread'](function(_0x2c10a0){return _0x2c10a0;});});});}})[_0x1202('0x23')](respondWithResult(_0x3bf473,null))[_0x1202('0x3f')](handleError(_0x3bf473,null));};exports['removeAgents']=function(_0x435024,_0x4d2bf8){var _0x3d9d01=_[_0x1202('0x7b')](_0x435024[_0x1202('0x2f')][_0x1202('0x79')])?_0x435024[_0x1202('0x2f')][_0x1202('0x79')]:[_0x435024['query'][_0x1202('0x79')]];var _0x3af00a=_0x435024[_0x1202('0x40')]['id'];return db[_0x1202('0x28')][_0x1202('0x42')]({'where':{'id':_0x3af00a}})[_0x1202('0x23')](handleEntityNotFound(_0x4d2bf8,null))[_0x1202('0x23')](function(_0x4dc365){if(_0x4dc365){var _0x27c0d4=[_0x1202('0x81'),_0x1202('0x7c'),'Mail',_0x1202('0x7e'),_0x1202('0x7f'),_0x1202('0x80'),_0x1202('0x90')];return db[_0x1202('0x50')][_0x1202('0x51')](function(_0x398404){var _0x318196=_[_0x1202('0x2e')](_0x27c0d4,function(_0x20f80a){var _0x53949d={'attributes':['id','name']};return _0x4dc365['get'+_0x20f80a+'Queues'](_0x53949d)['then'](function(_0x15a7bd){var _0x327794=_[_0x1202('0x2e')](_0x15a7bd,function(_0x3c0d26){return _0x3c0d26[_0x1202('0x91')](_0x3d9d01,{'transaction':_0x398404})[_0x1202('0x23')](function(){var _0x2be188=_[_0x1202('0x2e')](_0x3d9d01,function(_0x22d67c){socket[_0x1202('0x87')](_0x1202('0x45')+_0x20f80a+'Queue:remove',{'UserId':Number(_0x22d67c),[_0x20f80a+_0x1202('0x83')]:_0x3c0d26['id']});if(_0x20f80a!==_0x1202('0x81')){return;}return db[_0x1202('0x8a')][_0x1202('0x4f')]({'where':{'VoiceQueueId':_0x3c0d26['id'],'UserId':_0x22d67c},'transaction':_0x398404});});return Promise[_0x1202('0x8f')](_0x2be188);});});return Promise[_0x1202('0x8f')](_0x327794);});});return Promise['all'](_0x318196)['then'](function(){return _0x4dc365[_0x1202('0x91')](_0x3d9d01,{'transaction':_0x398404});})[_0x1202('0x23')](function(){return db[_0x1202('0x68')]['findOne']({'where':{'teamId':_0x3af00a}})[_0x1202('0x23')](function(_0x45b528){if(_0x45b528){var _0x4c0eda=_[_0x1202('0x2e')](_0x3d9d01,function(_0x349adf){db[_0x1202('0x69')][_0x1202('0x4f')]({'where':{'UserId':_0x349adf,'VoicePrefixId':_0x45b528[_0x1202('0x6a')]}});});return Promise[_0x1202('0x8f')](_0x4c0eda);}});});});}})[_0x1202('0x23')](respondWithStatusCode(_0x4d2bf8,null))[_0x1202('0x3f')](handleError(_0x4d2bf8,null));};exports[_0x1202('0x92')]=function(_0x2f8ab8,_0x3743d7,_0xd62185){var _0x2ec0a4={};var _0x57855d={};var _0x41db2c;var _0x19c26b;return db['Team'][_0x1202('0x75')]({'where':{'id':_0x2f8ab8['params']['id']}})['then'](handleEntityNotFound(_0x3743d7,null))[_0x1202('0x23')](function(_0x2e3902){if(_0x2e3902){_0x41db2c=_0x2e3902;_0x57855d[_0x1202('0x2d')]=_[_0x1202('0x6f')](db[_0x1202('0x86')][_0x1202('0x29')]);_0x57855d[_0x1202('0x2f')]=_[_0x1202('0x6f')](_0x2f8ab8[_0x1202('0x2f')]);_0x57855d['filters']=_[_0x1202('0x30')](_0x57855d['model'],_0x57855d[_0x1202('0x2f')]);_0x2ec0a4[_0x1202('0x31')]=_[_0x1202('0x30')](_0x57855d[_0x1202('0x2d')],qs[_0x1202('0x32')](_0x2f8ab8['query'][_0x1202('0x32')]));_0x2ec0a4[_0x1202('0x31')]=_0x2ec0a4[_0x1202('0x31')]['length']?_0x2ec0a4[_0x1202('0x31')]:_0x57855d[_0x1202('0x2d')];_0x2ec0a4[_0x1202('0x34')]=qs['sort'](_0x2f8ab8['query']['sort']);_0x2ec0a4[_0x1202('0x39')]=qs['filters'](_[_0x1202('0x37')](_0x2f8ab8[_0x1202('0x2f')],_0x57855d['filters']));if(_0x2f8ab8['query'][_0x1202('0x38')]){_0x2ec0a4[_0x1202('0x39')]=_['merge'](_0x2ec0a4[_0x1202('0x39')],{'$or':_['map'](_0x2ec0a4[_0x1202('0x31')],function(_0x1796e6){var _0x110fa4={};_0x110fa4[_0x1796e6]={'$like':'%'+_0x2f8ab8[_0x1202('0x2f')][_0x1202('0x38')]+'%'};return _0x110fa4;})});}_0x2ec0a4=_[_0x1202('0x3a')]({},_0x2ec0a4,_0x2f8ab8['options']);return _0x41db2c[_0x1202('0x92')](_0x2ec0a4);}})[_0x1202('0x23')](function(_0x429069){if(_0x429069){_0x19c26b=_0x429069[_0x1202('0x41')];if(!_0x2f8ab8['query'][_0x1202('0x33')](_0x1202('0x93'))){_0x2ec0a4['limit']=qs[_0x1202('0x1d')](_0x2f8ab8[_0x1202('0x2f')]['limit']);_0x2ec0a4['offset']=qs[_0x1202('0x1b')](_0x2f8ab8[_0x1202('0x2f')]['offset']);}return _0x41db2c[_0x1202('0x92')](_0x2ec0a4);}})[_0x1202('0x23')](function(_0x199a0b){if(_0x199a0b){return _0x199a0b?{'count':_0x19c26b,'rows':_0x199a0b}:null;}})[_0x1202('0x23')](respondWithResult(_0x3743d7,null))[_0x1202('0x3f')](handleError(_0x3743d7,null));}; \ No newline at end of file +var _0xb068=['ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','through','QueueId','TeamVoiceQueue','penalty','Queue','findOrCreate','emit','Queue:save','User','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','removeAgents','isArray','Fax','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','then','name','send','index','map','Team','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queues','add','capitalize'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xb068,0x152));var _0x8b06=function(_0x34a09c,_0x3af48c){_0x34a09c=_0x34a09c-0x0;var _0x551668=_0xb068[_0x34a09c];return _0x551668;};'use strict';var emlformat=require(_0x8b06('0x0'));var rimraf=require(_0x8b06('0x1'));var zipdir=require(_0x8b06('0x2'));var jsonpatch=require(_0x8b06('0x3'));var rp=require(_0x8b06('0x4'));var moment=require(_0x8b06('0x5'));var BPromise=require(_0x8b06('0x6'));var Mustache=require(_0x8b06('0x7'));var util=require(_0x8b06('0x8'));var path=require(_0x8b06('0x9'));var sox=require(_0x8b06('0xa'));var csv=require(_0x8b06('0xb'));var ejs=require(_0x8b06('0xc'));var fs=require('fs');var fs_extra=require(_0x8b06('0xd'));var _=require(_0x8b06('0xe'));var squel=require(_0x8b06('0xf'));var crypto=require(_0x8b06('0x10'));var jsforce=require(_0x8b06('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b06('0x12'));var authService=require(_0x8b06('0x13'));var qs=require(_0x8b06('0x14'));var as=require(_0x8b06('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b06('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b06('0x17'))['db'];config[_0x8b06('0x18')]=_[_0x8b06('0x19')](config['redis'],{'host':_0x8b06('0x1a'),'port':0x18eb});var socket=require(_0x8b06('0x1b'))(new Redis(config[_0x8b06('0x18')]));require('./team.socket')[_0x8b06('0x1c')](socket);function respondWithStatusCode(_0x12e073,_0x2f05a3){_0x2f05a3=_0x2f05a3||0xcc;return function(_0x301850){if(_0x301850){return _0x12e073[_0x8b06('0x1d')](_0x2f05a3);}return _0x12e073['status'](_0x2f05a3)[_0x8b06('0x1e')]();};}function respondWithResult(_0x684b89,_0x817e3e){_0x817e3e=_0x817e3e||0xc8;return function(_0x43bca4){if(_0x43bca4){return _0x684b89[_0x8b06('0x1f')](_0x817e3e)['json'](_0x43bca4);}};}function respondWithFilteredResult(_0x12635a,_0xf4e630){return function(_0x13f91e){if(_0x13f91e){var _0x304385=typeof _0xf4e630[_0x8b06('0x20')]===_0x8b06('0x21')&&typeof _0xf4e630['limit']===_0x8b06('0x21');var _0x2054cf=_0x13f91e['count'];var _0x1ec349=_0x304385?0x0:_0xf4e630[_0x8b06('0x20')];var _0x5e4282=_0x304385?_0x13f91e[_0x8b06('0x22')]:_0xf4e630[_0x8b06('0x20')]+_0xf4e630[_0x8b06('0x23')];var _0x5d4e49;if(_0x5e4282>=_0x2054cf){_0x5e4282=_0x2054cf;_0x5d4e49=0xc8;}else{_0x5d4e49=0xce;}_0x12635a['status'](_0x5d4e49);return _0x12635a[_0x8b06('0x24')](_0x8b06('0x25'),_0x1ec349+'-'+_0x5e4282+'/'+_0x2054cf)[_0x8b06('0x26')](_0x13f91e);}return null;};}function patchUpdates(_0x1b5b04){return function(_0x3c3d0c){try{jsonpatch['apply'](_0x3c3d0c,_0x1b5b04,!![]);}catch(_0x2ecc7c){return BPromise['reject'](_0x2ecc7c);}return _0x3c3d0c[_0x8b06('0x27')]();};}function saveUpdates(_0xba6b43,_0x20e6bb){return function(_0x2228b8){if(_0x2228b8){return _0x2228b8['update'](_0xba6b43)[_0x8b06('0x28')](function(_0x1a85a0){return _0x1a85a0;});}return null;};}function handleEntityNotFound(_0x3e659d,_0x98023){return function(_0x4eee79){if(!_0x4eee79){_0x3e659d[_0x8b06('0x1d')](0x194);}return _0x4eee79;};}function handleError(_0x19f10d,_0x44a448){_0x44a448=_0x44a448||0x1f4;return function(_0x230344){logger['error'](_0x230344['stack']);if(_0x230344[_0x8b06('0x29')]){delete _0x230344[_0x8b06('0x29')];}_0x19f10d[_0x8b06('0x1f')](_0x44a448)[_0x8b06('0x2a')](_0x230344);};}exports[_0x8b06('0x2b')]=function(_0x234ea9,_0xd2bf60){var _0x26fbc1={},_0x49cb38={},_0x2a5526={'count':0x0,'rows':[]};var _0x40fbbe=_[_0x8b06('0x2c')](db[_0x8b06('0x2d')]['rawAttributes'],function(_0x1f7771){return{'name':_0x1f7771['fieldName'],'type':_0x1f7771[_0x8b06('0x2e')][_0x8b06('0x2f')]};});_0x49cb38['model']=_[_0x8b06('0x2c')](_0x40fbbe,_0x8b06('0x29'));_0x49cb38[_0x8b06('0x30')]=_['keys'](_0x234ea9[_0x8b06('0x30')]);_0x49cb38[_0x8b06('0x31')]=_[_0x8b06('0x32')](_0x49cb38[_0x8b06('0x33')],_0x49cb38[_0x8b06('0x30')]);_0x26fbc1[_0x8b06('0x34')]=_[_0x8b06('0x32')](_0x49cb38[_0x8b06('0x33')],qs['fields'](_0x234ea9[_0x8b06('0x30')][_0x8b06('0x35')]));_0x26fbc1[_0x8b06('0x34')]=_0x26fbc1['attributes']['length']?_0x26fbc1[_0x8b06('0x34')]:_0x49cb38[_0x8b06('0x33')];if(!_0x234ea9[_0x8b06('0x30')][_0x8b06('0x36')](_0x8b06('0x37'))){_0x26fbc1[_0x8b06('0x23')]=qs[_0x8b06('0x23')](_0x234ea9[_0x8b06('0x30')][_0x8b06('0x23')]);_0x26fbc1[_0x8b06('0x20')]=qs[_0x8b06('0x20')](_0x234ea9['query']['offset']);}_0x26fbc1[_0x8b06('0x38')]=qs[_0x8b06('0x39')](_0x234ea9[_0x8b06('0x30')][_0x8b06('0x39')]);_0x26fbc1[_0x8b06('0x3a')]=qs[_0x8b06('0x31')](_[_0x8b06('0x3b')](_0x234ea9[_0x8b06('0x30')],_0x49cb38[_0x8b06('0x31')]),_0x40fbbe);if(_0x234ea9['query'][_0x8b06('0x3c')]){_0x26fbc1[_0x8b06('0x3a')]=_['merge'](_0x26fbc1[_0x8b06('0x3a')],{'$or':_[_0x8b06('0x2c')](_0x40fbbe,function(_0x36b97b){if(_0x36b97b['type']!==_0x8b06('0x3d')){var _0x4ea574={};_0x4ea574[_0x36b97b[_0x8b06('0x29')]]={'$like':'%'+_0x234ea9[_0x8b06('0x30')][_0x8b06('0x3c')]+'%'};return _0x4ea574;}})});}_0x26fbc1=_[_0x8b06('0x3e')]({},_0x26fbc1,_0x234ea9[_0x8b06('0x3f')]);var _0x58a34d={'where':_0x26fbc1[_0x8b06('0x3a')]};return db[_0x8b06('0x2d')][_0x8b06('0x22')](_0x58a34d)['then'](function(_0x4a813f){_0x2a5526[_0x8b06('0x22')]=_0x4a813f;if(_0x234ea9[_0x8b06('0x30')][_0x8b06('0x40')]){_0x26fbc1['include']=[{'all':!![]}];}return db[_0x8b06('0x2d')][_0x8b06('0x41')](_0x26fbc1);})[_0x8b06('0x28')](function(_0x2c964c){_0x2a5526[_0x8b06('0x42')]=_0x2c964c;return _0x2a5526;})[_0x8b06('0x28')](respondWithFilteredResult(_0xd2bf60,_0x26fbc1))[_0x8b06('0x43')](handleError(_0xd2bf60,null));};exports[_0x8b06('0x44')]=function(_0x599eb1,_0x42e0d2){var _0x495062={'raw':![],'where':{'id':_0x599eb1[_0x8b06('0x45')]['id']}},_0x360b91={};_0x360b91[_0x8b06('0x33')]=_[_0x8b06('0x46')](db['Team'][_0x8b06('0x47')]);_0x360b91[_0x8b06('0x30')]=_[_0x8b06('0x46')](_0x599eb1['query']);_0x360b91[_0x8b06('0x31')]=_[_0x8b06('0x32')](_0x360b91['model'],_0x360b91[_0x8b06('0x30')]);_0x495062['attributes']=_[_0x8b06('0x32')](_0x360b91[_0x8b06('0x33')],qs[_0x8b06('0x35')](_0x599eb1[_0x8b06('0x30')][_0x8b06('0x35')]));_0x495062[_0x8b06('0x34')]=_0x495062['attributes'][_0x8b06('0x48')]?_0x495062[_0x8b06('0x34')]:_0x360b91[_0x8b06('0x33')];if(_0x599eb1[_0x8b06('0x30')][_0x8b06('0x40')]){_0x495062[_0x8b06('0x49')]=[{'all':!![]}];}_0x495062=_[_0x8b06('0x3e')]({},_0x495062,_0x599eb1[_0x8b06('0x3f')]);return db[_0x8b06('0x2d')][_0x8b06('0x4a')](_0x495062)[_0x8b06('0x28')](handleEntityNotFound(_0x42e0d2,null))[_0x8b06('0x28')](respondWithResult(_0x42e0d2,null))[_0x8b06('0x43')](handleError(_0x42e0d2,null));};exports['create']=function(_0x6b8426,_0x10e80c){return db[_0x8b06('0x2d')]['create'](_0x6b8426[_0x8b06('0x4b')],{})['then'](function(_0x4e9977){var _0x3e938a=_0x6b8426[_0x8b06('0x4c')][_0x8b06('0x4d')]({'plain':!![]});if(!_0x3e938a)throw new Error(_0x8b06('0x4e'));if(_0x3e938a['role']==='user'){var _0x3b1d23=_0x4e9977[_0x8b06('0x4d')]({'plain':!![]});var _0x4db66b=_0x8b06('0x4f');return db['UserProfileSection'][_0x8b06('0x4a')]({'where':{'name':_0x4db66b,'userProfileId':_0x3e938a['userProfileId']},'raw':!![]})[_0x8b06('0x28')](function(_0x25fc05){if(_0x25fc05&&_0x25fc05[_0x8b06('0x50')]===0x0){return db[_0x8b06('0x51')][_0x8b06('0x52')]({'name':_0x3b1d23[_0x8b06('0x29')],'resourceId':_0x3b1d23['id'],'type':_0x25fc05[_0x8b06('0x29')],'sectionId':_0x25fc05['id']},{})[_0x8b06('0x28')](function(){return _0x4e9977;});}else{return _0x4e9977;}})[_0x8b06('0x43')](function(_0x228c69){logger[_0x8b06('0x53')](_0x8b06('0x54'),_0x228c69);throw _0x228c69;});}return _0x4e9977;})[_0x8b06('0x28')](respondWithResult(_0x10e80c,0xc9))['catch'](handleError(_0x10e80c,null));};exports[_0x8b06('0x55')]=function(_0x292b76,_0x28b53f){if(_0x292b76[_0x8b06('0x4b')]['id']){delete _0x292b76[_0x8b06('0x4b')]['id'];}return db['Team'][_0x8b06('0x4a')]({'where':{'id':_0x292b76[_0x8b06('0x45')]['id']}})[_0x8b06('0x28')](handleEntityNotFound(_0x28b53f,null))[_0x8b06('0x28')](saveUpdates(_0x292b76['body'],null))['then'](respondWithResult(_0x28b53f,null))[_0x8b06('0x43')](handleError(_0x28b53f,null));};exports['destroy']=function(_0x3f8f58,_0x33444c){var _0x54e6bc=_0x3f8f58['params']['id'];var _0x3467f5=[];return db[_0x8b06('0x56')][_0x8b06('0x57')](function(_0x395dd9){var _0x4332e8=_0x8b06('0x58')+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x4332e8,{'type':db['Sequelize'][_0x8b06('0x59')][_0x8b06('0x5a')],'raw':!![],'transaction':_0x395dd9})['then'](function(_0x4c0d99){_0x3467f5=_['map'](_0x4c0d99,function(_0x4baa0d){return Number(_0x4baa0d['UserId']);});})[_0x8b06('0x28')](function(){var _0x21ae9a=_0x8b06('0x5b')+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x21ae9a,{'type':db[_0x8b06('0x5c')][_0x8b06('0x59')]['SELECT'],'raw':!![],'transaction':_0x395dd9});})[_0x8b06('0x28')](function(_0x101d94){var _0x5c686a=_[_0x8b06('0x2c')](_0x101d94,function(_0x6bd1f7){return Number(_0x6bd1f7[_0x8b06('0x5d')]);});return db[_0x8b06('0x5e')][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'VoiceQueueId':{'$in':_0x5c686a}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){var _0xe3faab='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e6bc;return db[_0x8b06('0x56')]['query'](_0xe3faab,{'type':db[_0x8b06('0x5c')][_0x8b06('0x59')][_0x8b06('0x5a')],'raw':!![],'transaction':_0x395dd9});})[_0x8b06('0x28')](function(_0x596423){var _0x50f650=_['map'](_0x596423,function(_0x5cf055){return Number(_0x5cf055[_0x8b06('0x60')]);});return db['UserMailQueue'][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'MailQueueId':{'$in':_0x50f650}},'transaction':_0x395dd9});})['then'](function(){var _0x32798e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x32798e,{'type':db['Sequelize'][_0x8b06('0x59')]['SELECT'],'raw':!![],'transaction':_0x395dd9});})[_0x8b06('0x28')](function(_0x1f4d3b){var _0x5fba87=_[_0x8b06('0x2c')](_0x1f4d3b,function(_0x115ec0){return Number(_0x115ec0['SmsQueueId']);});return db[_0x8b06('0x61')][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'SmsQueueId':{'$in':_0x5fba87}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){var _0x4b94e6=_0x8b06('0x62')+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x4b94e6,{'type':db['Sequelize']['QueryTypes'][_0x8b06('0x5a')],'raw':!![],'transaction':_0x395dd9});})['then'](function(_0x3efbbf){var _0x2512dc=_['map'](_0x3efbbf,function(_0x200c07){return Number(_0x200c07['ChatQueueId']);});return db[_0x8b06('0x63')][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'ChatQueueId':{'$in':_0x2512dc}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){var _0x503d84=_0x8b06('0x64')+_0x54e6bc;return db['sequelize'][_0x8b06('0x30')](_0x503d84,{'type':db[_0x8b06('0x5c')][_0x8b06('0x59')][_0x8b06('0x5a')],'raw':!![],'transaction':_0x395dd9});})['then'](function(_0x4ebe64){var _0x424fa6=_[_0x8b06('0x2c')](_0x4ebe64,function(_0x2717ce){return Number(_0x2717ce[_0x8b06('0x65')]);});return db['UserFaxQueue'][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'FaxQueueId':{'$in':_0x424fa6}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){var _0x86e458=_0x8b06('0x66')+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x86e458,{'type':db[_0x8b06('0x5c')][_0x8b06('0x59')]['SELECT'],'raw':!![],'transaction':_0x395dd9});})[_0x8b06('0x28')](function(_0x2fcda5){var _0x528725=_['map'](_0x2fcda5,function(_0x39d77f){return Number(_0x39d77f[_0x8b06('0x67')]);});return db['UserOpenchannelQueue'][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'OpenchannelQueueId':{'$in':_0x528725}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){var _0x36cab7=_0x8b06('0x68')+_0x54e6bc;return db[_0x8b06('0x56')][_0x8b06('0x30')](_0x36cab7,{'type':db[_0x8b06('0x5c')][_0x8b06('0x59')][_0x8b06('0x5a')],'raw':!![],'transaction':_0x395dd9});})['then'](function(_0xc1731f){var _0x4c3257=_['map'](_0xc1731f,function(_0x510a31){return Number(_0x510a31['WhatsappQueueId']);});return db[_0x8b06('0x69')][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'WhatsappQueueId':{'$in':_0x4c3257}},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){return db['TeamVoicePrefix'][_0x8b06('0x4a')]({'where':{'TeamId':_0x54e6bc}});})[_0x8b06('0x28')](function(_0x2a69dc){if(_0x2a69dc===null){return;}return db[_0x8b06('0x6a')][_0x8b06('0x5f')]({'where':{'UserId':{'$in':_0x3467f5},'VoicePrefixId':_0x2a69dc[_0x8b06('0x6b')]},'transaction':_0x395dd9});})[_0x8b06('0x28')](function(){return db[_0x8b06('0x2d')][_0x8b06('0x5f')]({'where':{'id':_0x54e6bc},'cascade':!![],'transaction':_0x395dd9});})[_0x8b06('0x28')](function(_0x585fae){if(_0x585fae===0x0){_0x33444c['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x8b06('0x5f')]({'where':{'type':_0x8b06('0x4f'),'resourceId':_0x54e6bc},'cascade':!![],'transaction':_0x395dd9})['then'](function(){_0x33444c[_0x8b06('0x1f')](0xcc)[_0x8b06('0x1e')]();});}})['catch'](function(_0xe0a755){_0x33444c['status'](0x1f4)[_0x8b06('0x2a')](_0xe0a755);});});};exports[_0x8b06('0x6c')]=function(_0x1c37cc,_0x220f12,_0xeaff13){return db['Team'][_0x8b06('0x6d')]({'where':{'id':_0x1c37cc[_0x8b06('0x45')]['id']}})[_0x8b06('0x28')](handleEntityNotFound(_0x220f12,null))[_0x8b06('0x28')](function(_0x1c65ac){if(!_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x6e')]||!utils[_0x8b06('0x6f')](_0x1c37cc['query']['channel'])){throw new db[(_0x8b06('0x5c'))][(_0x8b06('0x70'))](_0x8b06('0x71'));}var _0x5d54c1={};var _0x123db6={};_0x123db6[_0x8b06('0x33')]=_[_0x8b06('0x46')](db[_['capitalize'](_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x6e')][_0x8b06('0x72')]())+'Queue'][_0x8b06('0x47')]);_0x123db6[_0x8b06('0x30')]=_[_0x8b06('0x46')](_0x1c37cc[_0x8b06('0x30')]);_0x123db6['filters']=_[_0x8b06('0x32')](_0x123db6[_0x8b06('0x33')],_0x123db6[_0x8b06('0x30')]);_0x5d54c1[_0x8b06('0x34')]=_[_0x8b06('0x32')](_0x123db6['model'],qs['fields'](_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x35')]));_0x5d54c1[_0x8b06('0x34')]=_0x5d54c1['attributes'][_0x8b06('0x48')]?_0x5d54c1['attributes']:_0x123db6[_0x8b06('0x33')];_0x5d54c1[_0x8b06('0x23')]=qs[_0x8b06('0x23')](_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x23')]);_0x5d54c1[_0x8b06('0x20')]=qs[_0x8b06('0x20')](_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x20')]);_0x5d54c1[_0x8b06('0x38')]=qs[_0x8b06('0x39')](_0x1c37cc[_0x8b06('0x30')][_0x8b06('0x39')]);_0x5d54c1[_0x8b06('0x3a')]=qs[_0x8b06('0x31')](_['pick'](_0x1c37cc[_0x8b06('0x30')],_0x123db6['filters']));_0x5d54c1=_[_0x8b06('0x3e')]({},_0x5d54c1,_0x1c37cc[_0x8b06('0x3f')]);return _0x1c65ac['get'+_['capitalize'](_0x1c37cc[_0x8b06('0x30')]['channel']['toLowerCase']())+_0x8b06('0x73')](_0x5d54c1);})[_0x8b06('0x28')](respondWithResult(_0x220f12,null))['catch'](handleError(_0x220f12,null));};exports['addQueues']=function(_0x1908f7,_0x22e898,_0x303e58){return db['Team'][_0x8b06('0x6d')]({'where':{'id':_0x1908f7[_0x8b06('0x45')]['id']}})[_0x8b06('0x28')](function(_0x4946ca){if(_0x4946ca){if(!_0x1908f7[_0x8b06('0x4b')]['channel']||!utils[_0x8b06('0x6f')](_0x1908f7[_0x8b06('0x4b')][_0x8b06('0x6e')])){throw new db[(_0x8b06('0x5c'))][(_0x8b06('0x70'))](_0x8b06('0x71'));}return _0x4946ca[_0x8b06('0x74')+_[_0x8b06('0x75')](_0x1908f7[_0x8b06('0x4b')][_0x8b06('0x6e')][_0x8b06('0x72')]())+_0x8b06('0x73')](_0x1908f7['body'][_0x8b06('0x76')]);}return null;})['then'](handleEntityNotFound(_0x22e898,null))[_0x8b06('0x28')](respondWithStatusCode(_0x22e898,null))[_0x8b06('0x43')](handleError(_0x22e898,null));};exports[_0x8b06('0x77')]=function(_0x44f086,_0x26fc5a,_0x2b9529){return db['Team'][_0x8b06('0x6d')]({'where':{'id':_0x44f086['params']['id']}})[_0x8b06('0x28')](function(_0x183cc1){if(_0x183cc1){if(!_0x44f086['query'][_0x8b06('0x6e')]||!utils[_0x8b06('0x6f')](_0x44f086['query'][_0x8b06('0x6e')])){throw new db['Sequelize'][(_0x8b06('0x70'))]('Unknown\x20channel');}return _0x183cc1[_0x8b06('0x78')+_[_0x8b06('0x75')](_0x44f086['query'][_0x8b06('0x6e')][_0x8b06('0x72')]())+_0x8b06('0x73')](_0x44f086[_0x8b06('0x30')]['ids']);}return null;})[_0x8b06('0x28')](handleEntityNotFound(_0x26fc5a,null))[_0x8b06('0x28')](respondWithStatusCode(_0x26fc5a,null))[_0x8b06('0x43')](handleError(_0x26fc5a,null));};exports[_0x8b06('0x79')]=function(_0x2db42b,_0x3c3962){var _0x2a0589=_['isArray'](_0x2db42b[_0x8b06('0x4b')][_0x8b06('0x76')])?_0x2db42b[_0x8b06('0x4b')][_0x8b06('0x76')]:[_0x2db42b[_0x8b06('0x4b')][_0x8b06('0x76')]];var _0x38eb44=_0x2db42b[_0x8b06('0x45')]['id'];return db[_0x8b06('0x2d')]['find']({'where':{'id':_0x38eb44}})[_0x8b06('0x28')](handleEntityNotFound(_0x3c3962,null))[_0x8b06('0x28')](function(_0x689733){if(_0x689733){var _0xe1f489=[_0x8b06('0x7a'),_0x8b06('0x7b'),_0x8b06('0x7c'),_0x8b06('0x7d'),'Fax',_0x8b06('0x7e'),'Whatsapp'];return db[_0x8b06('0x56')]['transaction'](function(_0x371c05){var _0xbb3f0d=_[_0x8b06('0x2c')](_0xe1f489,function(_0x209caa){var _0xdafe9={'attributes':['id',_0x8b06('0x29')]};if(_0x209caa===_0x8b06('0x7a')){_0xdafe9[_0x8b06('0x7f')]={'attributes':['penalty']};}return _0x689733[_0x8b06('0x4d')+_0x209caa+_0x8b06('0x73')](_0xdafe9)[_0x8b06('0x28')](function(_0x24263a){var _0xa6aa6a=_[_0x8b06('0x2c')](_0x24263a,function(_0x505f2f){var _0x5f27d2=_[_0x8b06('0x2c')](_0x2a0589,function(_0x4f504c){var _0x2c1708={'where':{'UserId':_0x4f504c,[_0x209caa+_0x8b06('0x80')]:_0x505f2f['id']},'transaction':_0x371c05};if(_0x209caa===_0x8b06('0x7a')){_0x2c1708[_0x8b06('0x19')]={'penalty':_0x505f2f[_0x8b06('0x81')][_0x8b06('0x82')]};}return db['User'+_0x209caa+_0x8b06('0x83')][_0x8b06('0x84')](_0x2c1708)[_0x8b06('0x28')](function(){socket[_0x8b06('0x85')]('user'+_0x209caa+_0x8b06('0x86'),{'UserId':_0x4f504c,[_0x209caa+_0x8b06('0x80')]:_0x505f2f['id']});if(_0x209caa!==_0x8b06('0x7a')){return;}return db[_0x8b06('0x87')][_0x8b06('0x41')]({'where':{'id':_0x2a0589,'online':0x1},'attributes':['id',_0x8b06('0x29'),_0x8b06('0x88'),_0x8b06('0x89'),_0x8b06('0x8a')],'raw':!![]})[_0x8b06('0x28')](function(_0x52f7d0){var _0x2067af=_[_0x8b06('0x2c')](_0x52f7d0,function(_0x59dddd){return db['UserVoiceQueueRt'][_0x8b06('0x8b')]({'membername':_0x59dddd['name'],'UserId':_0x59dddd['id'],'queue_name':_0x505f2f[_0x8b06('0x29')],'VoiceQueueId':_0x505f2f['id'],'interface':_[_0x8b06('0x8c')](_0x59dddd['interface'])?util[_0x8b06('0x8d')](_0x8b06('0x8e'),_0x59dddd[_0x8b06('0x29')]):_0x59dddd[_0x8b06('0x8a')],'paused':_0x59dddd[_0x8b06('0x89')]||![],'penalty':_0x505f2f[_0x8b06('0x81')][_0x8b06('0x82')]},{'transaction':_0x371c05});});return Promise[_0x8b06('0x8f')](_0x2067af);});});});return Promise[_0x8b06('0x8f')](_0x5f27d2);});return Promise[_0x8b06('0x8f')](_0xa6aa6a);})[_0x8b06('0x28')](function(){return db[_0x8b06('0x90')][_0x8b06('0x6d')]({'where':{'teamId':_0x38eb44}})[_0x8b06('0x28')](function(_0x60eacf){if(_0x60eacf){var _0x55cfbd=_[_0x8b06('0x2c')](_0x2a0589,function(_0x2f3367){db[_0x8b06('0x6a')][_0x8b06('0x8b')]({'UserId':_0x2f3367,'VoicePrefixId':_0x60eacf[_0x8b06('0x6b')]});});return Promise[_0x8b06('0x8f')](_0x55cfbd);}});});});return Promise[_0x8b06('0x8f')](_0xbb3f0d)[_0x8b06('0x28')](function(){return _0x689733[_0x8b06('0x79')](_0x2a0589,{'transaction':_0x371c05})['spread'](function(_0x319e75){return _0x319e75;});});});}})['then'](respondWithResult(_0x3c3962,null))[_0x8b06('0x43')](handleError(_0x3c3962,null));};exports[_0x8b06('0x91')]=function(_0x539e9d,_0x580466){var _0x16e714=_[_0x8b06('0x92')](_0x539e9d[_0x8b06('0x30')][_0x8b06('0x76')])?_0x539e9d[_0x8b06('0x30')]['ids']:[_0x539e9d[_0x8b06('0x30')][_0x8b06('0x76')]];var _0x55d1b3=_0x539e9d[_0x8b06('0x45')]['id'];return db[_0x8b06('0x2d')][_0x8b06('0x4a')]({'where':{'id':_0x55d1b3}})['then'](handleEntityNotFound(_0x580466,null))[_0x8b06('0x28')](function(_0x1251f3){if(_0x1251f3){var _0xdb7097=[_0x8b06('0x7a'),_0x8b06('0x7b'),_0x8b06('0x7c'),_0x8b06('0x7d'),_0x8b06('0x93'),'Openchannel',_0x8b06('0x94')];return db['sequelize']['transaction'](function(_0x456ff8){var _0x43639f=_[_0x8b06('0x2c')](_0xdb7097,function(_0x4c57dd){var _0x567400={'attributes':['id',_0x8b06('0x29')]};return _0x1251f3['get'+_0x4c57dd+_0x8b06('0x73')](_0x567400)[_0x8b06('0x28')](function(_0x2bd9f8){var _0x54f0ee=_['map'](_0x2bd9f8,function(_0x227b29){return _0x227b29['removeAgents'](_0x16e714,{'transaction':_0x456ff8})[_0x8b06('0x28')](function(){var _0x466fe3=_[_0x8b06('0x2c')](_0x16e714,function(_0x444445){socket['emit'](_0x8b06('0x4c')+_0x4c57dd+_0x8b06('0x95'),{'UserId':Number(_0x444445),[_0x4c57dd+_0x8b06('0x80')]:_0x227b29['id']});if(_0x4c57dd!=='Voice'){return;}return db[_0x8b06('0x96')][_0x8b06('0x5f')]({'where':{'VoiceQueueId':_0x227b29['id'],'UserId':_0x444445},'transaction':_0x456ff8});});return Promise[_0x8b06('0x8f')](_0x466fe3);});});return Promise[_0x8b06('0x8f')](_0x54f0ee);});});return Promise[_0x8b06('0x8f')](_0x43639f)['then'](function(){return _0x1251f3[_0x8b06('0x91')](_0x16e714,{'transaction':_0x456ff8});})['then'](function(){return db[_0x8b06('0x90')][_0x8b06('0x6d')]({'where':{'teamId':_0x55d1b3}})['then'](function(_0x490166){if(_0x490166){var _0x1bef80=_[_0x8b06('0x2c')](_0x16e714,function(_0x396d65){db['UserVoicePrefix'][_0x8b06('0x5f')]({'where':{'UserId':_0x396d65,'VoicePrefixId':_0x490166[_0x8b06('0x6b')]}});});return Promise[_0x8b06('0x8f')](_0x1bef80);}});});});}})['then'](respondWithStatusCode(_0x580466,null))[_0x8b06('0x43')](handleError(_0x580466,null));};exports[_0x8b06('0x97')]=function(_0x125a48,_0x5a67f2,_0x19fb1f){var _0xb09da4={};var _0x35990f={};var _0x32746f;var _0x188898;return db['Team']['findOne']({'where':{'id':_0x125a48[_0x8b06('0x45')]['id']}})[_0x8b06('0x28')](handleEntityNotFound(_0x5a67f2,null))['then'](function(_0x329761){if(_0x329761){_0x32746f=_0x329761;_0x35990f[_0x8b06('0x33')]=_[_0x8b06('0x46')](db[_0x8b06('0x87')][_0x8b06('0x47')]);_0x35990f[_0x8b06('0x30')]=_[_0x8b06('0x46')](_0x125a48['query']);_0x35990f[_0x8b06('0x31')]=_['intersection'](_0x35990f['model'],_0x35990f[_0x8b06('0x30')]);_0xb09da4[_0x8b06('0x34')]=_[_0x8b06('0x32')](_0x35990f[_0x8b06('0x33')],qs[_0x8b06('0x35')](_0x125a48['query'][_0x8b06('0x35')]));_0xb09da4[_0x8b06('0x34')]=_0xb09da4[_0x8b06('0x34')]['length']?_0xb09da4[_0x8b06('0x34')]:_0x35990f[_0x8b06('0x33')];_0xb09da4[_0x8b06('0x38')]=qs[_0x8b06('0x39')](_0x125a48['query'][_0x8b06('0x39')]);_0xb09da4[_0x8b06('0x3a')]=qs[_0x8b06('0x31')](_[_0x8b06('0x3b')](_0x125a48[_0x8b06('0x30')],_0x35990f[_0x8b06('0x31')]));if(_0x125a48[_0x8b06('0x30')][_0x8b06('0x3c')]){_0xb09da4[_0x8b06('0x3a')]=_[_0x8b06('0x3e')](_0xb09da4['where'],{'$or':_['map'](_0xb09da4[_0x8b06('0x34')],function(_0x5f21fb){var _0x1aacb5={};_0x1aacb5[_0x5f21fb]={'$like':'%'+_0x125a48[_0x8b06('0x30')][_0x8b06('0x3c')]+'%'};return _0x1aacb5;})});}_0xb09da4=_['merge']({},_0xb09da4,_0x125a48['options']);return _0x32746f['getAgents'](_0xb09da4);}})['then'](function(_0x5c3e00){if(_0x5c3e00){_0x188898=_0x5c3e00[_0x8b06('0x48')];if(!_0x125a48[_0x8b06('0x30')][_0x8b06('0x36')](_0x8b06('0x37'))){_0xb09da4[_0x8b06('0x23')]=qs[_0x8b06('0x23')](_0x125a48[_0x8b06('0x30')][_0x8b06('0x23')]);_0xb09da4['offset']=qs[_0x8b06('0x20')](_0x125a48[_0x8b06('0x30')][_0x8b06('0x20')]);}return _0x32746f[_0x8b06('0x97')](_0xb09da4);}})[_0x8b06('0x28')](function(_0x30f94a){if(_0x30f94a){return _0x30f94a?{'count':_0x188898,'rows':_0x30f94a}:null;}})[_0x8b06('0x28')](respondWithResult(_0x5a67f2,null))[_0x8b06('0x43')](handleError(_0x5a67f2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9acc585..3127112 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 _0x5cc0=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','remove'];(function(_0x179cce,_0x239422){var _0x54ac6d=function(_0x21a7f0){while(--_0x21a7f0){_0x179cce['push'](_0x179cce['shift']());}};_0x54ac6d(++_0x239422);}(_0x5cc0,0xc2));var _0x05cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5cc0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x05cc('0x0'));var Team=require(_0x05cc('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x05cc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x05cc('0x3')};function emitEvent(_0x4c95f9){return function(_0x41efe1,_0x2e0784,_0x5d0db8){TeamEvents[_0x05cc('0x4')](_0x4c95f9+':'+_0x41efe1['id'],_0x41efe1);TeamEvents[_0x05cc('0x4')](_0x4c95f9,_0x41efe1);_0x5d0db8(null);};}for(var e in events){if(events[_0x05cc('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x9959=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2083ba,_0x135f8b){var _0x205dc3=function(_0x580ebd){while(--_0x580ebd){_0x2083ba['push'](_0x2083ba['shift']());}};_0x205dc3(++_0x135f8b);}(_0x9959,0x91));var _0x9995=function(_0x45b1a5,_0x1b9fef){_0x45b1a5=_0x45b1a5-0x0;var _0x1335e0=_0x9959[_0x45b1a5];return _0x1335e0;};'use strict';var EventEmitter=require(_0x9995('0x0'));var Team=require(_0x9995('0x1'))['db'][_0x9995('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x9995('0x3')](0x0);var events={'afterCreate':_0x9995('0x4'),'afterUpdate':_0x9995('0x5'),'afterDestroy':_0x9995('0x6')};function emitEvent(_0x46e5f9){return function(_0x262829,_0x242a6a,_0x3aa4c1){TeamEvents[_0x9995('0x7')](_0x46e5f9+':'+_0x262829['id'],_0x262829);TeamEvents[_0x9995('0x7')](_0x46e5f9,_0x262829);_0x3aa4c1(null);};}for(var e in events){if(events[_0x9995('0x8')](e)){var event=events[e];Team[_0x9995('0x9')](e,emitEvent(event));}}module[_0x9995('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0a23f77..5efb2ba 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 _0xad1f=['request-promise','./team.attributes','exports','define','Team','teams','util','../../config/logger','api','moment'];(function(_0x2006e8,_0x16e3f6){var _0x5135da=function(_0x4f4712){while(--_0x4f4712){_0x2006e8['push'](_0x2006e8['shift']());}};_0x5135da(++_0x16e3f6);}(_0xad1f,0x178));var _0xfad1=function(_0x4da83c,_0x28262b){_0x4da83c=_0x4da83c-0x0;var _0x4aa347=_0xad1f[_0x4da83c];return _0x4aa347;};'use strict';var _=require('lodash');var util=require(_0xfad1('0x0'));var logger=require(_0xfad1('0x1'))(_0xfad1('0x2'));var moment=require(_0xfad1('0x3'));var BPromise=require('bluebird');var rp=require(_0xfad1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfad1('0x5'));module[_0xfad1('0x6')]=function(_0x7cd2a7,_0x11c5fa){return _0x7cd2a7[_0xfad1('0x7')](_0xfad1('0x8'),attributes,{'tableName':_0xfad1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb260=['lodash','util','../../config/logger','api','moment','../../config/environment','./team.attributes','exports','define','Team','teams'];(function(_0x289c9f,_0x5b8e19){var _0x29d99a=function(_0x4effcf){while(--_0x4effcf){_0x289c9f['push'](_0x289c9f['shift']());}};_0x29d99a(++_0x5b8e19);}(_0xb260,0x1b8));var _0x0b26=function(_0x424200,_0x30607e){_0x424200=_0x424200-0x0;var _0xc25c73=_0xb260[_0x424200];return _0xc25c73;};'use strict';var _=require(_0x0b26('0x0'));var util=require(_0x0b26('0x1'));var logger=require(_0x0b26('0x2'))(_0x0b26('0x3'));var moment=require(_0x0b26('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b26('0x5'));var attributes=require(_0x0b26('0x6'));module[_0x0b26('0x7')]=function(_0x5d22fc,_0x356219){return _0x5d22fc[_0x0b26('0x8')](_0x0b26('0x9'),attributes,{'tableName':_0x0b26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ae6401c..bcfd35e 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 _0x0869=['debug','stringify','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./team.socket','register','request\x20sent'];(function(_0x1dd544,_0x4d9c96){var _0x223607=function(_0x5d34ed){while(--_0x5d34ed){_0x1dd544['push'](_0x1dd544['shift']());}};_0x223607(++_0x4d9c96);}(_0x0869,0xaf));var _0x9086=function(_0xfbe764,_0x416aa3){_0xfbe764=_0xfbe764-0x0;var _0x17bdb6=_0x0869[_0xfbe764];return _0x17bdb6;};'use strict';var _=require(_0x9086('0x0'));var util=require(_0x9086('0x1'));var moment=require(_0x9086('0x2'));var BPromise=require(_0x9086('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9086('0x4'));var db=require(_0x9086('0x5'))['db'];var utils=require(_0x9086('0x6'));var logger=require(_0x9086('0x7'))(_0x9086('0x8'));var config=require(_0x9086('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9086('0xa')][_0x9086('0xb')]({'port':0x232a});config[_0x9086('0xc')]=_['defaults'](config[_0x9086('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9086('0xd'))(new Redis(config[_0x9086('0xc')]));require(_0x9086('0xe'))[_0x9086('0xf')](socket);function respondWithRpcPromise(_0x107cc5,_0x1b1fda,_0x317cd3){return new BPromise(function(_0x43c230,_0x5a801e){return client['request'](_0x107cc5,_0x317cd3)['then'](function(_0x3179aa){logger['info']('Team,\x20%s,\x20%s',_0x1b1fda,_0x9086('0x10'));logger[_0x9086('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x1b1fda,_0x9086('0x10'),JSON[_0x9086('0x12')](_0x3179aa));if(_0x3179aa[_0x9086('0x13')]){if(_0x3179aa[_0x9086('0x13')]['code']===0x1f4){logger[_0x9086('0x13')]('Team,\x20%s,\x20%s',_0x1b1fda,_0x3179aa['error']['message']);return _0x5a801e(_0x3179aa[_0x9086('0x13')][_0x9086('0x14')]);}logger[_0x9086('0x13')]('Team,\x20%s,\x20%s',_0x1b1fda,_0x3179aa[_0x9086('0x13')][_0x9086('0x14')]);return _0x43c230(_0x3179aa['error']['message']);}else{logger['info'](_0x9086('0x15'),_0x1b1fda,_0x9086('0x10'));_0x43c230(_0x3179aa[_0x9086('0x16')][_0x9086('0x14')]);}})[_0x9086('0x17')](function(_0x29f450){logger['error'](_0x9086('0x15'),_0x1b1fda,_0x29f450);_0x5a801e(_0x29f450);});});} \ No newline at end of file +var _0xc74e=['socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x35faf2,_0x56a899){var _0x113601=function(_0x386004){while(--_0x386004){_0x35faf2['push'](_0x35faf2['shift']());}};_0x113601(++_0x56a899);}(_0xc74e,0x1cf));var _0xec74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc74e[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec74('0x0'));var BPromise=require('bluebird');var rs=require(_0xec74('0x1'));var fs=require('fs');var Redis=require(_0xec74('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec74('0x3'));var logger=require(_0xec74('0x4'))(_0xec74('0x5'));var config=require(_0xec74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec74('0x7')][_0xec74('0x8')]({'port':0x232a});config[_0xec74('0x9')]=_[_0xec74('0xa')](config[_0xec74('0x9')],{'host':_0xec74('0xb'),'port':0x18eb});var socket=require(_0xec74('0xc'))(new Redis(config['redis']));require(_0xec74('0xd'))[_0xec74('0xe')](socket);function respondWithRpcPromise(_0x2c9cbc,_0x5b5805,_0x336435){return new BPromise(function(_0x548d19,_0x1127f9){return client[_0xec74('0xf')](_0x2c9cbc,_0x336435)['then'](function(_0x2c478e){logger[_0xec74('0x10')](_0xec74('0x11'),_0x5b5805,_0xec74('0x12'));logger[_0xec74('0x13')](_0xec74('0x14'),_0x5b5805,_0xec74('0x12'),JSON[_0xec74('0x15')](_0x2c478e));if(_0x2c478e[_0xec74('0x16')]){if(_0x2c478e[_0xec74('0x16')]['code']===0x1f4){logger[_0xec74('0x16')](_0xec74('0x11'),_0x5b5805,_0x2c478e[_0xec74('0x16')][_0xec74('0x17')]);return _0x1127f9(_0x2c478e[_0xec74('0x16')][_0xec74('0x17')]);}logger['error'](_0xec74('0x11'),_0x5b5805,_0x2c478e[_0xec74('0x16')][_0xec74('0x17')]);return _0x548d19(_0x2c478e[_0xec74('0x16')][_0xec74('0x17')]);}else{logger[_0xec74('0x10')]('Team,\x20%s,\x20%s',_0x5b5805,_0xec74('0x12'));_0x548d19(_0x2c478e['result']['message']);}})[_0xec74('0x18')](function(_0x34d43d){logger[_0xec74('0x16')](_0xec74('0x11'),_0x5b5805,_0x34d43d);_0x1127f9(_0x34d43d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 19c8e02..2af3513 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 _0xf95a=['emit','removeListener','register','length','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf95a,0xd6));var _0xaf95=function(_0x4a97b0,_0x2af7d9){_0x4a97b0=_0x4a97b0-0x0;var _0x165e0b=_0xf95a[_0x4a97b0];return _0x165e0b;};'use strict';var TeamEvents=require('./team.events');var events=[_0xaf95('0x0'),'remove',_0xaf95('0x1')];function createListener(_0xbbbb8a,_0x55170c){return function(_0x458b42){_0x55170c[_0xaf95('0x2')](_0xbbbb8a,_0x458b42);};}function removeListener(_0x508dc3,_0x416374){return function(){TeamEvents[_0xaf95('0x3')](_0x508dc3,_0x416374);};}exports[_0xaf95('0x4')]=function(_0x247c79){for(var _0x159c4c=0x0,_0x2e9df2=events[_0xaf95('0x5')];_0x159c4c<_0x2e9df2;_0x159c4c++){var _0x3029ee=events[_0x159c4c];var _0x546824=createListener('team:'+_0x3029ee,_0x247c79);TeamEvents['on'](_0x3029ee,_0x546824);}}; \ No newline at end of file +var _0xb1db=['removeListener','team:','update','emit'];(function(_0x594ace,_0x2f1be4){var _0x694bef=function(_0x321189){while(--_0x321189){_0x594ace['push'](_0x594ace['shift']());}};_0x694bef(++_0x2f1be4);}(_0xb1db,0x1be));var _0xbb1d=function(_0x3da312,_0x391ccd){_0x3da312=_0x3da312-0x0;var _0x28fb08=_0xb1db[_0x3da312];return _0x28fb08;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove',_0xbb1d('0x0')];function createListener(_0x34985d,_0x162832){return function(_0x2470bd){_0x162832[_0xbb1d('0x1')](_0x34985d,_0x2470bd);};}function removeListener(_0x286e92,_0x2242c6){return function(){TeamEvents[_0xbb1d('0x2')](_0x286e92,_0x2242c6);};}exports['register']=function(_0x593669){for(var _0x5a0543=0x0,_0x217f31=events['length'];_0x5a0543<_0x217f31;_0x5a0543++){var _0x2e8562=events[_0x5a0543];var _0x5f1f0e=createListener(_0xbb1d('0x3')+_0x2e8562,_0x593669);TeamEvents['on'](_0x2e8562,_0x5f1f0e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index bfbe440..50e8a7b 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 _0xbd3b=['INTEGER','sequelize','exports'];(function(_0x5b2e3d,_0x2d7f7b){var _0x35a13c=function(_0x831acc){while(--_0x831acc){_0x5b2e3d['push'](_0x5b2e3d['shift']());}};_0x35a13c(++_0x2d7f7b);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0xbd3b[_0x16270b];return _0x2cd122;};'use strict';var Sequelize=require(_0xbbd3('0x0'));module[_0xbbd3('0x1')]={'TeamId':{'type':Sequelize[_0xbbd3('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xab02=['exports','INTEGER','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xab02,0xc5));var _0x2ab0=function(_0x1960b1,_0x2c0ed8){_0x1960b1=_0x1960b1-0x0;var _0x51347b=_0xab02[_0x1960b1];return _0x51347b;};'use strict';var Sequelize=require(_0x2ab0('0x0'));module[_0x2ab0('0x1')]={'TeamId':{'type':Sequelize[_0x2ab0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2ab0('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 28eb6ab..7b74bec 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 _0x4dc0=['./teamVoicePrefix.attributes','define','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3fcda7,_0x2af810){var _0x39af34=function(_0x2b0192){while(--_0x2b0192){_0x3fcda7['push'](_0x3fcda7['shift']());}};_0x39af34(++_0x2af810);}(_0x4dc0,0x13d));var _0x04dc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4dc0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04dc('0x0'))(_0x04dc('0x1'));var moment=require(_0x04dc('0x2'));var BPromise=require(_0x04dc('0x3'));var rp=require(_0x04dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04dc('0x5'));var config=require(_0x04dc('0x6'));var attributes=require(_0x04dc('0x7'));module['exports']=function(_0x224df5,_0x40b21a){return _0x224df5[_0x04dc('0x8')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x220b=['api','moment','request-promise','rimraf','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger'];(function(_0x4d2740,_0x209b23){var _0x3c3a27=function(_0x3146c0){while(--_0x3146c0){_0x4d2740['push'](_0x4d2740['shift']());}};_0x3c3a27(++_0x209b23);}(_0x220b,0x1a2));var _0xb220=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x220b[_0x55ef8b];return _0x359c84;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var logger=require(_0xb220('0x1'))(_0xb220('0x2'));var moment=require(_0xb220('0x3'));var BPromise=require('bluebird');var rp=require(_0xb220('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb220('0x5'));var config=require('../../config/environment');var attributes=require(_0xb220('0x6'));module[_0xb220('0x7')]=function(_0x1d2be4,_0x366a4d){return _0x1d2be4['define'](_0xb220('0x8'),attributes,{'tableName':_0xb220('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 45388c4..a9e644d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x152374,_0x3d4aa2){var _0xd84978=function(_0x572791){while(--_0x572791){_0x152374['push'](_0x152374['shift']());}};_0xd84978(++_0x3d4aa2);}(_0x70e0,0x17b));var _0x070e=function(_0x3675d6,_0x111372){_0x3675d6=_0x3675d6-0x0;var _0x1b6c84=_0x70e0[_0x3675d6];return _0x1b6c84;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e51d0,_0x4fc72b){var _0x14879c=function(_0x14f994){while(--_0x14f994){_0x5e51d0['push'](_0x5e51d0['shift']());}};_0x14879c(++_0x4fc72b);}(_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'));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 5a13fb9..9fc0798 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 _0x6b9d=['sequelize','exports','INTEGER'];(function(_0x35ced4,_0x397162){var _0x265f45=function(_0x2fa128){while(--_0x2fa128){_0x35ced4['push'](_0x35ced4['shift']());}};_0x265f45(++_0x397162);}(_0x6b9d,0xed));var _0xd6b9=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x6b9d[_0x3f4891];return _0x54f2d8;};'use strict';var Sequelize=require(_0xd6b9('0x0'));module[_0xd6b9('0x1')]={'penalty':{'type':Sequelize[_0xd6b9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x11a6=['sequelize'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x11a6,0x1c7));var _0x611a=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x11a6[_0x3f578f];return _0x32c754;};'use strict';var Sequelize=require(_0x611a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index cf00d12..0c40752 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 _0x44d4=['TeamVoiceQueue','lodash','moment','bluebird','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x4e2c5f,_0x8522d4){var _0xf65832=function(_0x373af8){while(--_0x373af8){_0x4e2c5f['push'](_0x4e2c5f['shift']());}};_0xf65832(++_0x8522d4);}(_0x44d4,0x161));var _0x444d=function(_0x463bde,_0x23282c){_0x463bde=_0x463bde-0x0;var _0x3c73c3=_0x44d4[_0x463bde];return _0x3c73c3;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x444d('0x1'));var BPromise=require(_0x444d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x444d('0x3'));var attributes=require(_0x444d('0x4'));module[_0x444d('0x5')]=function(_0x24f601,_0x45dfdb){return _0x24f601[_0x444d('0x6')](_0x444d('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb205=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues'];(function(_0x24ff39,_0x4a3356){var _0xa9fa10=function(_0x17b9ce){while(--_0x17b9ce){_0x24ff39['push'](_0x24ff39['shift']());}};_0xa9fa10(++_0x4a3356);}(_0xb205,0xf0));var _0x5b20=function(_0x5b0373,_0x16fd49){_0x5b0373=_0x5b0373-0x0;var _0x4e219d=_0xb205[_0x5b0373];return _0x4e219d;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x5'));var rimraf=require('rimraf');var config=require(_0x5b20('0x6'));var attributes=require(_0x5b20('0x7'));module['exports']=function(_0x3206cd,_0x29d926){return _0x3206cd[_0x5b20('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x5b20('0x9'),'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 c9e28c9..ebb2c3f 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 _0xbef6=['rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbef6,0x1b0));var _0x6bef=function(_0x34692f,_0x4ebd44){_0x34692f=_0x34692f-0x0;var _0x2b543b=_0xbef6[_0x34692f];return _0x2b543b;};'use strict';var _=require(_0x6bef('0x0'));var util=require(_0x6bef('0x1'));var moment=require('moment');var BPromise=require(_0x6bef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bef('0x4'))(_0x6bef('0x5'));var config=require('../../config/environment');var jayson=require(_0x6bef('0x6'));var client=jayson[_0x6bef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a59d,_0x7e58a9,_0x590b4c){return new BPromise(function(_0x4d47d0,_0x30639d){return client[_0x6bef('0x8')](_0x11a59d,_0x590b4c)[_0x6bef('0x9')](function(_0x19d992){logger[_0x6bef('0xa')](_0x6bef('0xb'),_0x7e58a9,_0x6bef('0xc'));logger[_0x6bef('0xd')](_0x6bef('0xe'),_0x7e58a9,_0x6bef('0xc'),JSON[_0x6bef('0xf')](_0x19d992));if(_0x19d992[_0x6bef('0x10')]){if(_0x19d992[_0x6bef('0x10')]['code']===0x1f4){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x30639d(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x4d47d0(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}else{logger[_0x6bef('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x7e58a9,_0x6bef('0xc'));_0x4d47d0(_0x19d992['result'][_0x6bef('0x11')]);}})[_0x6bef('0x12')](function(_0x35bd32){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x35bd32);_0x30639d(_0x35bd32);});});} \ No newline at end of file +var _0x8c4a=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x482ddd,_0x3e1bd2){var _0x5c4a0f=function(_0x5c54f2){while(--_0x5c54f2){_0x482ddd['push'](_0x482ddd['shift']());}};_0x5c4a0f(++_0x3e1bd2);}(_0x8c4a,0xb0));var _0xa8c4=function(_0x118801,_0x4e1118){_0x118801=_0x118801-0x0;var _0x28e8d9=_0x8c4a[_0x118801];return _0x28e8d9;};'use strict';var _=require(_0xa8c4('0x0'));var util=require(_0xa8c4('0x1'));var moment=require('moment');var BPromise=require(_0xa8c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8c4('0x3'));var db=require(_0xa8c4('0x4'))['db'];var utils=require(_0xa8c4('0x5'));var logger=require(_0xa8c4('0x6'))(_0xa8c4('0x7'));var config=require(_0xa8c4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa8c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x690746,_0x2d17a0,_0x1d007d){return new BPromise(function(_0x5623f4,_0x20d72f){return client['request'](_0x690746,_0x1d007d)[_0xa8c4('0xa')](function(_0x564984){logger['info'](_0xa8c4('0xb'),_0x2d17a0,'request\x20sent');logger[_0xa8c4('0xc')](_0xa8c4('0xd'),_0x2d17a0,_0xa8c4('0xe'),JSON[_0xa8c4('0xf')](_0x564984));if(_0x564984[_0xa8c4('0x10')]){if(_0x564984[_0xa8c4('0x10')]['code']===0x1f4){logger[_0xa8c4('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d17a0,_0x564984['error'][_0xa8c4('0x11')]);return _0x20d72f(_0x564984[_0xa8c4('0x10')][_0xa8c4('0x11')]);}logger[_0xa8c4('0x10')](_0xa8c4('0xb'),_0x2d17a0,_0x564984[_0xa8c4('0x10')][_0xa8c4('0x11')]);return _0x5623f4(_0x564984[_0xa8c4('0x10')][_0xa8c4('0x11')]);}else{logger[_0xa8c4('0x12')](_0xa8c4('0xb'),_0x2d17a0,_0xa8c4('0xe'));_0x5623f4(_0x564984[_0xa8c4('0x13')][_0xa8c4('0x11')]);}})[_0xa8c4('0x14')](function(_0x4efa9d){logger[_0xa8c4('0x10')](_0xa8c4('0xb'),_0x2d17a0,_0x4efa9d);_0x20d72f(_0x4efa9d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8cf8ab9..f285efa 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 _0x505d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','post','update','destroy','path','connect-timeout','express'];(function(_0x291354,_0x1ee76c){var _0x31da9c=function(_0x4fda3b){while(--_0x4fda3b){_0x291354['push'](_0x291354['shift']());}};_0x31da9c(++_0x1ee76c);}(_0x505d,0x93));var _0xd505=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x505d[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd505('0x0'));var timeout=require(_0xd505('0x1'));var express=require(_0xd505('0x2'));var router=express[_0xd505('0x3')]();var fs_extra=require(_0xd505('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var controller=require(_0xd505('0x7'));router[_0xd505('0x8')]('/',auth['isAuthenticated'](),controller[_0xd505('0x9')]);router['get'](_0xd505('0xa'),auth[_0xd505('0xb')](),controller['show']);router[_0xd505('0xc')]('/',auth[_0xd505('0xb')](),controller['create']);router['put'](_0xd505('0xa'),auth['isAuthenticated'](),controller[_0xd505('0xd')]);router['delete'](_0xd505('0xa'),auth['isAuthenticated'](),controller[_0xd505('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7669=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','destroy','multer','util','path','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7669,0xe5));var _0x9766=function(_0x357e2f,_0x4c1b0b){_0x357e2f=_0x357e2f-0x0;var _0x835443=_0x7669[_0x357e2f];return _0x835443;};'use strict';var multer=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var path=require(_0x9766('0x2'));var timeout=require('connect-timeout');var express=require(_0x9766('0x3'));var router=express[_0x9766('0x4')]();var fs_extra=require(_0x9766('0x5'));var auth=require(_0x9766('0x6'));var interaction=require(_0x9766('0x7'));var config=require(_0x9766('0x8'));var controller=require('./template.controller');router[_0x9766('0x9')]('/',auth[_0x9766('0xa')](),controller[_0x9766('0xb')]);router[_0x9766('0x9')]('/:id',auth[_0x9766('0xa')](),controller[_0x9766('0xc')]);router[_0x9766('0xd')]('/',auth[_0x9766('0xa')](),controller[_0x9766('0xe')]);router['put'](_0x9766('0xf'),auth['isAuthenticated'](),controller[_0x9766('0x10')]);router['delete'](_0x9766('0xf'),auth['isAuthenticated'](),controller[_0x9766('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0aa07db..3f6d9b4 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 _0x0d39=['exports','STRING','TEXT'];(function(_0x3d78b5,_0x4936ed){var _0x380d7b=function(_0x1b7bf8){while(--_0x1b7bf8){_0x3d78b5['push'](_0x3d78b5['shift']());}};_0x380d7b(++_0x4936ed);}(_0x0d39,0x17d));var _0x90d3=function(_0x1b76a6,_0x3cfd08){_0x1b76a6=_0x1b76a6-0x0;var _0x37198f=_0x0d39[_0x1b76a6];return _0x37198f;};'use strict';var Sequelize=require('sequelize');module[_0x90d3('0x0')]={'name':{'type':Sequelize[_0x90d3('0x1')]},'description':{'type':Sequelize[_0x90d3('0x1')]},'html':{'type':Sequelize[_0x90d3('0x2')]}}; \ No newline at end of file +var _0x6095=['exports','STRING','TEXT','sequelize'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6095,0x1c3));var _0x5609=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6095[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x5609('0x0'));module[_0x5609('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5609('0x2')]},'html':{'type':Sequelize[_0x5609('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2aa9b34..6312dcf 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 _0x8db9=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','get','Templates','UserProfileResource','then','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','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','update','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x8db9,0x9a));var _0x98db=function(_0x38dfda,_0x1527ae){_0x38dfda=_0x38dfda-0x0;var _0x3fd30f=_0x8db9[_0x38dfda];return _0x3fd30f;};'use strict';var emlformat=require(_0x98db('0x0'));var rimraf=require(_0x98db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98db('0x2'));var rp=require('request-promise');var moment=require(_0x98db('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x98db('0x4'));var util=require(_0x98db('0x5'));var path=require('path');var sox=require(_0x98db('0x6'));var csv=require('to-csv');var ejs=require(_0x98db('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98db('0x8'));var squel=require(_0x98db('0x9'));var crypto=require(_0x98db('0xa'));var jsforce=require(_0x98db('0xb'));var deskjs=require(_0x98db('0xc'));var toCsv=require(_0x98db('0xd'));var querystring=require(_0x98db('0xe'));var Papa=require(_0x98db('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x98db('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98db('0x11'));var logger=require('../../config/logger')(_0x98db('0x12'));var utils=require('../../config/utils');var config=require(_0x98db('0x13'));var licenseUtil=require(_0x98db('0x14'));var db=require(_0x98db('0x15'))['db'];function respondWithStatusCode(_0x40728a,_0x378ab8){_0x378ab8=_0x378ab8||0xcc;return function(_0xfa91ee){if(_0xfa91ee){return _0x40728a[_0x98db('0x16')](_0x378ab8);}return _0x40728a[_0x98db('0x17')](_0x378ab8)[_0x98db('0x18')]();};}function respondWithResult(_0x885151,_0x5eb23b){_0x5eb23b=_0x5eb23b||0xc8;return function(_0x3b94a2){if(_0x3b94a2){return _0x885151[_0x98db('0x17')](_0x5eb23b)[_0x98db('0x19')](_0x3b94a2);}};}function respondWithFilteredResult(_0x2acc30,_0x5b0666){return function(_0x100374){if(_0x100374){var _0x4b23e1=typeof _0x5b0666['offset']===_0x98db('0x1a')&&typeof _0x5b0666[_0x98db('0x1b')]===_0x98db('0x1a');var _0x5eef2b=_0x100374[_0x98db('0x1c')];var _0x212f5d=_0x4b23e1?0x0:_0x5b0666[_0x98db('0x1d')];var _0x1f8ea9=_0x4b23e1?_0x100374[_0x98db('0x1c')]:_0x5b0666[_0x98db('0x1d')]+_0x5b0666['limit'];var _0x1dca5c;if(_0x1f8ea9>=_0x5eef2b){_0x1f8ea9=_0x5eef2b;_0x1dca5c=0xc8;}else{_0x1dca5c=0xce;}_0x2acc30['status'](_0x1dca5c);return _0x2acc30[_0x98db('0x1e')](_0x98db('0x1f'),_0x212f5d+'-'+_0x1f8ea9+'/'+_0x5eef2b)[_0x98db('0x19')](_0x100374);}return null;};}function patchUpdates(_0x2211a5){return function(_0x5696d4){try{jsonpatch['apply'](_0x5696d4,_0x2211a5,!![]);}catch(_0x41ee34){return BPromise[_0x98db('0x20')](_0x41ee34);}return _0x5696d4[_0x98db('0x21')]();};}function saveUpdates(_0x1e51a7,_0x360e22){return function(_0xe94669){if(_0xe94669){return _0xe94669['update'](_0x1e51a7)['then'](function(_0x38ebdc){return _0x38ebdc;});}return null;};}function removeEntity(_0x9be729,_0x14d55e){return function(_0x38b359){if(_0x38b359){return _0x38b359[_0x98db('0x22')]()['then'](function(){var _0x4c4275=_0x38b359[_0x98db('0x23')]({'plain':!![]});var _0x5e4cd4=_0x98db('0x24');return db[_0x98db('0x25')][_0x98db('0x22')]({'where':{'type':_0x5e4cd4,'resourceId':_0x4c4275['id']}})[_0x98db('0x26')](function(){return _0x38b359;});})[_0x98db('0x26')](function(){_0x9be729[_0x98db('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c17e1,_0x401567){return function(_0xc9cb1){if(!_0xc9cb1){_0x5c17e1['sendStatus'](0x194);}return _0xc9cb1;};}function handleError(_0x431365,_0x147d3a){_0x147d3a=_0x147d3a||0x1f4;return function(_0x54c468){logger[_0x98db('0x27')](_0x54c468[_0x98db('0x28')]);if(_0x54c468[_0x98db('0x29')]){delete _0x54c468['name'];}_0x431365[_0x98db('0x17')](_0x147d3a)['send'](_0x54c468);};}exports[_0x98db('0x2a')]=function(_0xc47271,_0x28d655){var _0x46c68a={},_0x3d570d={},_0x36be50={'count':0x0,'rows':[]};var _0x3b414a=_[_0x98db('0x2b')](db[_0x98db('0x2c')][_0x98db('0x2d')],function(_0x39854e){return{'name':_0x39854e[_0x98db('0x2e')],'type':_0x39854e[_0x98db('0x2f')][_0x98db('0x30')]};});_0x3d570d[_0x98db('0x31')]=_[_0x98db('0x2b')](_0x3b414a,_0x98db('0x29'));_0x3d570d[_0x98db('0x32')]=_[_0x98db('0x33')](_0xc47271[_0x98db('0x32')]);_0x3d570d[_0x98db('0x34')]=_['intersection'](_0x3d570d[_0x98db('0x31')],_0x3d570d[_0x98db('0x32')]);_0x46c68a['attributes']=_[_0x98db('0x35')](_0x3d570d[_0x98db('0x31')],qs[_0x98db('0x36')](_0xc47271[_0x98db('0x32')][_0x98db('0x36')]));_0x46c68a['attributes']=_0x46c68a[_0x98db('0x37')][_0x98db('0x38')]?_0x46c68a['attributes']:_0x3d570d['model'];if(!_0xc47271[_0x98db('0x32')][_0x98db('0x39')](_0x98db('0x3a'))){_0x46c68a['limit']=qs['limit'](_0xc47271[_0x98db('0x32')][_0x98db('0x1b')]);_0x46c68a[_0x98db('0x1d')]=qs[_0x98db('0x1d')](_0xc47271[_0x98db('0x32')][_0x98db('0x1d')]);}_0x46c68a[_0x98db('0x3b')]=qs[_0x98db('0x3c')](_0xc47271['query']['sort']);_0x46c68a['where']=qs[_0x98db('0x34')](_[_0x98db('0x3d')](_0xc47271[_0x98db('0x32')],_0x3d570d[_0x98db('0x34')]),_0x3b414a);if(_0xc47271[_0x98db('0x32')]['filter']){_0x46c68a[_0x98db('0x3e')]=_['merge'](_0x46c68a[_0x98db('0x3e')],{'$or':_[_0x98db('0x2b')](_0x3b414a,function(_0x11b185){if(_0x11b185[_0x98db('0x2f')]!=='VIRTUAL'){var _0x13b517={};_0x13b517[_0x11b185[_0x98db('0x29')]]={'$like':'%'+_0xc47271['query']['filter']+'%'};return _0x13b517;}})});}_0x46c68a=_[_0x98db('0x3f')]({},_0x46c68a,_0xc47271[_0x98db('0x40')]);var _0x335de8={'where':_0x46c68a[_0x98db('0x3e')]};return db[_0x98db('0x2c')][_0x98db('0x1c')](_0x335de8)[_0x98db('0x26')](function(_0x28b59f){_0x36be50[_0x98db('0x1c')]=_0x28b59f;if(_0xc47271[_0x98db('0x32')][_0x98db('0x41')]){_0x46c68a[_0x98db('0x42')]=[{'all':!![]}];}return db[_0x98db('0x2c')]['findAll'](_0x46c68a);})[_0x98db('0x26')](function(_0x2ae9cf){_0x36be50[_0x98db('0x43')]=_0x2ae9cf;return _0x36be50;})[_0x98db('0x26')](respondWithFilteredResult(_0x28d655,_0x46c68a))[_0x98db('0x44')](handleError(_0x28d655,null));};exports['show']=function(_0xae9b87,_0x5efaa2){var _0x408ec6={'raw':!![],'where':{'id':_0xae9b87[_0x98db('0x45')]['id']}},_0x104b0a={};_0x104b0a[_0x98db('0x31')]=_['keys'](db[_0x98db('0x2c')][_0x98db('0x2d')]);_0x104b0a[_0x98db('0x32')]=_[_0x98db('0x33')](_0xae9b87[_0x98db('0x32')]);_0x104b0a[_0x98db('0x34')]=_[_0x98db('0x35')](_0x104b0a[_0x98db('0x31')],_0x104b0a['query']);_0x408ec6['attributes']=_[_0x98db('0x35')](_0x104b0a['model'],qs[_0x98db('0x36')](_0xae9b87[_0x98db('0x32')]['fields']));_0x408ec6[_0x98db('0x37')]=_0x408ec6[_0x98db('0x37')]['length']?_0x408ec6['attributes']:_0x104b0a[_0x98db('0x31')];if(_0xae9b87[_0x98db('0x32')][_0x98db('0x41')]){_0x408ec6[_0x98db('0x42')]=[{'all':!![]}];}_0x408ec6=_[_0x98db('0x3f')]({},_0x408ec6,_0xae9b87[_0x98db('0x40')]);return db[_0x98db('0x2c')][_0x98db('0x46')](_0x408ec6)['then'](handleEntityNotFound(_0x5efaa2,null))[_0x98db('0x26')](respondWithResult(_0x5efaa2,null))[_0x98db('0x44')](handleError(_0x5efaa2,null));};exports['create']=function(_0x5d2c00,_0x34bb90){return db[_0x98db('0x2c')][_0x98db('0x47')](_0x5d2c00[_0x98db('0x48')],{})[_0x98db('0x26')](function(_0x17520b){var _0xce02f1=_0x5d2c00[_0x98db('0x49')]['get']({'plain':!![]});if(!_0xce02f1)throw new Error(_0x98db('0x4a'));if(_0xce02f1[_0x98db('0x4b')]==='user'){var _0x551be9=_0x17520b[_0x98db('0x23')]({'plain':!![]});var _0x521b79=_0x98db('0x24');return db[_0x98db('0x4c')]['find']({'where':{'name':_0x521b79,'userProfileId':_0xce02f1[_0x98db('0x4d')]},'raw':!![]})[_0x98db('0x26')](function(_0x324506){if(_0x324506&&_0x324506[_0x98db('0x4e')]===0x0){return db[_0x98db('0x25')][_0x98db('0x47')]({'name':_0x551be9[_0x98db('0x29')],'resourceId':_0x551be9['id'],'type':_0x324506[_0x98db('0x29')],'sectionId':_0x324506['id']},{})['then'](function(){return _0x17520b;});}else{return _0x17520b;}})[_0x98db('0x44')](function(_0xbd812f){logger[_0x98db('0x27')](_0x98db('0x4f'),_0xbd812f);throw _0xbd812f;});}return _0x17520b;})[_0x98db('0x26')](respondWithResult(_0x34bb90,0xc9))[_0x98db('0x44')](handleError(_0x34bb90,null));};exports[_0x98db('0x50')]=function(_0x1a6034,_0x1fcd54){if(_0x1a6034[_0x98db('0x48')]['id']){delete _0x1a6034[_0x98db('0x48')]['id'];}return db['Template'][_0x98db('0x46')]({'where':{'id':_0x1a6034[_0x98db('0x45')]['id']}})[_0x98db('0x26')](handleEntityNotFound(_0x1fcd54,null))['then'](saveUpdates(_0x1a6034[_0x98db('0x48')],null))['then'](respondWithResult(_0x1fcd54,null))[_0x98db('0x44')](handleError(_0x1fcd54,null));};exports['destroy']=function(_0x2a4e91,_0x4df6d8){return db[_0x98db('0x2c')][_0x98db('0x46')]({'where':{'id':_0x2a4e91[_0x98db('0x45')]['id']}})['then'](handleEntityNotFound(_0x4df6d8,null))[_0x98db('0x26')](removeEntity(_0x4df6d8,null))[_0x98db('0x44')](handleError(_0x4df6d8,null));}; \ No newline at end of file +var _0x9208=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Templates','stack','name','send','Template','rawAttributes','fieldName','type'];(function(_0x459fb6,_0x55ca2c){var _0x4dc060=function(_0x1f27ab){while(--_0x1f27ab){_0x459fb6['push'](_0x459fb6['shift']());}};_0x4dc060(++_0x55ca2c);}(_0x9208,0x6c));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8920('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8920('0x1'));var moment=require(_0x8920('0x2'));var BPromise=require(_0x8920('0x3'));var Mustache=require(_0x8920('0x4'));var util=require('util');var path=require(_0x8920('0x5'));var sox=require(_0x8920('0x6'));var csv=require(_0x8920('0x7'));var ejs=require(_0x8920('0x8'));var fs=require('fs');var fs_extra=require(_0x8920('0x9'));var _=require(_0x8920('0xa'));var squel=require(_0x8920('0xb'));var crypto=require(_0x8920('0xc'));var jsforce=require(_0x8920('0xd'));var deskjs=require(_0x8920('0xe'));var toCsv=require(_0x8920('0x7'));var querystring=require(_0x8920('0xf'));var Papa=require(_0x8920('0x10'));var Redis=require(_0x8920('0x11'));var authService=require(_0x8920('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8920('0x13'));var logger=require('../../config/logger')(_0x8920('0x14'));var utils=require(_0x8920('0x15'));var config=require(_0x8920('0x16'));var licenseUtil=require(_0x8920('0x17'));var db=require(_0x8920('0x18'))['db'];function respondWithStatusCode(_0x979796,_0x425e24){_0x425e24=_0x425e24||0xcc;return function(_0x376431){if(_0x376431){return _0x979796[_0x8920('0x19')](_0x425e24);}return _0x979796[_0x8920('0x1a')](_0x425e24)[_0x8920('0x1b')]();};}function respondWithResult(_0x4ce178,_0x3758e3){_0x3758e3=_0x3758e3||0xc8;return function(_0x19a092){if(_0x19a092){return _0x4ce178[_0x8920('0x1a')](_0x3758e3)[_0x8920('0x1c')](_0x19a092);}};}function respondWithFilteredResult(_0x144696,_0x116b54){return function(_0x9b03bf){if(_0x9b03bf){var _0x12f56e=typeof _0x116b54[_0x8920('0x1d')]===_0x8920('0x1e')&&typeof _0x116b54[_0x8920('0x1f')]===_0x8920('0x1e');var _0x4d40ac=_0x9b03bf[_0x8920('0x20')];var _0x1b2cf1=_0x12f56e?0x0:_0x116b54['offset'];var _0x207213=_0x12f56e?_0x9b03bf['count']:_0x116b54['offset']+_0x116b54[_0x8920('0x1f')];var _0x28c5f3;if(_0x207213>=_0x4d40ac){_0x207213=_0x4d40ac;_0x28c5f3=0xc8;}else{_0x28c5f3=0xce;}_0x144696[_0x8920('0x1a')](_0x28c5f3);return _0x144696['set'](_0x8920('0x21'),_0x1b2cf1+'-'+_0x207213+'/'+_0x4d40ac)[_0x8920('0x1c')](_0x9b03bf);}return null;};}function patchUpdates(_0x5b0ba2){return function(_0x425304){try{jsonpatch[_0x8920('0x22')](_0x425304,_0x5b0ba2,!![]);}catch(_0x109000){return BPromise[_0x8920('0x23')](_0x109000);}return _0x425304['save']();};}function saveUpdates(_0x28c27d,_0x397e1d){return function(_0x316c54){if(_0x316c54){return _0x316c54[_0x8920('0x24')](_0x28c27d)[_0x8920('0x25')](function(_0x28d073){return _0x28d073;});}return null;};}function removeEntity(_0x123241,_0x31d053){return function(_0x3742d3){if(_0x3742d3){return _0x3742d3[_0x8920('0x26')]()[_0x8920('0x25')](function(){var _0x5ef00c=_0x3742d3[_0x8920('0x27')]({'plain':!![]});var _0x2d745c=_0x8920('0x28');return db['UserProfileResource'][_0x8920('0x26')]({'where':{'type':_0x2d745c,'resourceId':_0x5ef00c['id']}})['then'](function(){return _0x3742d3;});})['then'](function(){_0x123241['status'](0xcc)[_0x8920('0x1b')]();});}};}function handleEntityNotFound(_0x381226,_0x522e0b){return function(_0x5f1137){if(!_0x5f1137){_0x381226['sendStatus'](0x194);}return _0x5f1137;};}function handleError(_0x2e3f78,_0x4e9624){_0x4e9624=_0x4e9624||0x1f4;return function(_0x3fe5d){logger['error'](_0x3fe5d[_0x8920('0x29')]);if(_0x3fe5d['name']){delete _0x3fe5d[_0x8920('0x2a')];}_0x2e3f78[_0x8920('0x1a')](_0x4e9624)[_0x8920('0x2b')](_0x3fe5d);};}exports['index']=function(_0x146b9d,_0x119268){var _0x32d5d7={},_0x3cc522={},_0x47fa07={'count':0x0,'rows':[]};var _0x48df48=_['map'](db[_0x8920('0x2c')][_0x8920('0x2d')],function(_0x197078){return{'name':_0x197078[_0x8920('0x2e')],'type':_0x197078[_0x8920('0x2f')][_0x8920('0x30')]};});_0x3cc522[_0x8920('0x31')]=_['map'](_0x48df48,_0x8920('0x2a'));_0x3cc522[_0x8920('0x32')]=_[_0x8920('0x33')](_0x146b9d[_0x8920('0x32')]);_0x3cc522['filters']=_[_0x8920('0x34')](_0x3cc522[_0x8920('0x31')],_0x3cc522[_0x8920('0x32')]);_0x32d5d7[_0x8920('0x35')]=_['intersection'](_0x3cc522[_0x8920('0x31')],qs[_0x8920('0x36')](_0x146b9d[_0x8920('0x32')]['fields']));_0x32d5d7['attributes']=_0x32d5d7[_0x8920('0x35')][_0x8920('0x37')]?_0x32d5d7[_0x8920('0x35')]:_0x3cc522['model'];if(!_0x146b9d[_0x8920('0x32')][_0x8920('0x38')]('nolimit')){_0x32d5d7[_0x8920('0x1f')]=qs[_0x8920('0x1f')](_0x146b9d['query'][_0x8920('0x1f')]);_0x32d5d7[_0x8920('0x1d')]=qs[_0x8920('0x1d')](_0x146b9d['query'][_0x8920('0x1d')]);}_0x32d5d7['order']=qs[_0x8920('0x39')](_0x146b9d[_0x8920('0x32')][_0x8920('0x39')]);_0x32d5d7[_0x8920('0x3a')]=qs['filters'](_['pick'](_0x146b9d[_0x8920('0x32')],_0x3cc522[_0x8920('0x3b')]),_0x48df48);if(_0x146b9d[_0x8920('0x32')][_0x8920('0x3c')]){_0x32d5d7[_0x8920('0x3a')]=_[_0x8920('0x3d')](_0x32d5d7[_0x8920('0x3a')],{'$or':_[_0x8920('0x3e')](_0x48df48,function(_0x10d150){if(_0x10d150[_0x8920('0x2f')]!=='VIRTUAL'){var _0x5f284e={};_0x5f284e[_0x10d150[_0x8920('0x2a')]]={'$like':'%'+_0x146b9d[_0x8920('0x32')][_0x8920('0x3c')]+'%'};return _0x5f284e;}})});}_0x32d5d7=_[_0x8920('0x3d')]({},_0x32d5d7,_0x146b9d[_0x8920('0x3f')]);var _0x2255e5={'where':_0x32d5d7[_0x8920('0x3a')]};return db['Template'][_0x8920('0x20')](_0x2255e5)[_0x8920('0x25')](function(_0x3541be){_0x47fa07['count']=_0x3541be;if(_0x146b9d[_0x8920('0x32')][_0x8920('0x40')]){_0x32d5d7[_0x8920('0x41')]=[{'all':!![]}];}return db[_0x8920('0x2c')][_0x8920('0x42')](_0x32d5d7);})[_0x8920('0x25')](function(_0x406c23){_0x47fa07['rows']=_0x406c23;return _0x47fa07;})[_0x8920('0x25')](respondWithFilteredResult(_0x119268,_0x32d5d7))[_0x8920('0x43')](handleError(_0x119268,null));};exports[_0x8920('0x44')]=function(_0x219510,_0x1e4118){var _0x2ca967={'raw':!![],'where':{'id':_0x219510[_0x8920('0x45')]['id']}},_0x396d2f={};_0x396d2f[_0x8920('0x31')]=_[_0x8920('0x33')](db[_0x8920('0x2c')][_0x8920('0x2d')]);_0x396d2f[_0x8920('0x32')]=_[_0x8920('0x33')](_0x219510['query']);_0x396d2f[_0x8920('0x3b')]=_[_0x8920('0x34')](_0x396d2f['model'],_0x396d2f[_0x8920('0x32')]);_0x2ca967[_0x8920('0x35')]=_[_0x8920('0x34')](_0x396d2f[_0x8920('0x31')],qs[_0x8920('0x36')](_0x219510[_0x8920('0x32')]['fields']));_0x2ca967['attributes']=_0x2ca967[_0x8920('0x35')][_0x8920('0x37')]?_0x2ca967[_0x8920('0x35')]:_0x396d2f[_0x8920('0x31')];if(_0x219510['query'][_0x8920('0x40')]){_0x2ca967['include']=[{'all':!![]}];}_0x2ca967=_[_0x8920('0x3d')]({},_0x2ca967,_0x219510[_0x8920('0x3f')]);return db['Template'][_0x8920('0x46')](_0x2ca967)[_0x8920('0x25')](handleEntityNotFound(_0x1e4118,null))[_0x8920('0x25')](respondWithResult(_0x1e4118,null))[_0x8920('0x43')](handleError(_0x1e4118,null));};exports[_0x8920('0x47')]=function(_0x3e22b,_0x2c5bbc){return db[_0x8920('0x2c')]['create'](_0x3e22b[_0x8920('0x48')],{})[_0x8920('0x25')](function(_0x2b393e){var _0x69dd50=_0x3e22b[_0x8920('0x49')][_0x8920('0x27')]({'plain':!![]});if(!_0x69dd50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x69dd50['role']==='user'){var _0x2e634d=_0x2b393e[_0x8920('0x27')]({'plain':!![]});var _0xe3b815=_0x8920('0x28');return db[_0x8920('0x4a')]['find']({'where':{'name':_0xe3b815,'userProfileId':_0x69dd50[_0x8920('0x4b')]},'raw':!![]})[_0x8920('0x25')](function(_0x449919){if(_0x449919&&_0x449919['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2e634d[_0x8920('0x2a')],'resourceId':_0x2e634d['id'],'type':_0x449919['name'],'sectionId':_0x449919['id']},{})['then'](function(){return _0x2b393e;});}else{return _0x2b393e;}})['catch'](function(_0x4c3b40){logger[_0x8920('0x4c')](_0x8920('0x4d'),_0x4c3b40);throw _0x4c3b40;});}return _0x2b393e;})['then'](respondWithResult(_0x2c5bbc,0xc9))[_0x8920('0x43')](handleError(_0x2c5bbc,null));};exports[_0x8920('0x24')]=function(_0x20cb93,_0x3daefe){if(_0x20cb93[_0x8920('0x48')]['id']){delete _0x20cb93['body']['id'];}return db[_0x8920('0x2c')][_0x8920('0x46')]({'where':{'id':_0x20cb93[_0x8920('0x45')]['id']}})[_0x8920('0x25')](handleEntityNotFound(_0x3daefe,null))[_0x8920('0x25')](saveUpdates(_0x20cb93[_0x8920('0x48')],null))[_0x8920('0x25')](respondWithResult(_0x3daefe,null))[_0x8920('0x43')](handleError(_0x3daefe,null));};exports[_0x8920('0x26')]=function(_0x1ba238,_0x2f70cc){return db[_0x8920('0x2c')][_0x8920('0x46')]({'where':{'id':_0x1ba238[_0x8920('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f70cc,null))[_0x8920('0x25')](removeEntity(_0x2f70cc,null))[_0x8920('0x43')](handleError(_0x2f70cc,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8857795..4405526 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 _0xd145=['../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x36c5d3,_0x55101f){var _0x4fa988=function(_0x14ea0a){while(--_0x14ea0a){_0x36c5d3['push'](_0x36c5d3['shift']());}};_0x4fa988(++_0x55101f);}(_0xd145,0xfc));var _0x5d14=function(_0x2b3e6e,_0x507e1f){_0x2b3e6e=_0x2b3e6e-0x0;var _0x46b423=_0xd145[_0x2b3e6e];return _0x46b423;};'use strict';var _=require(_0x5d14('0x0'));var util=require(_0x5d14('0x1'));var logger=require(_0x5d14('0x2'))(_0x5d14('0x3'));var moment=require(_0x5d14('0x4'));var BPromise=require(_0x5d14('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d14('0x6'));var rimraf=require(_0x5d14('0x7'));var config=require(_0x5d14('0x8'));var attributes=require(_0x5d14('0x9'));module[_0x5d14('0xa')]=function(_0x1e502b,_0x535f0d){return _0x1e502b[_0x5d14('0xb')]('Template',attributes,{'tableName':_0x5d14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadce=['bluebird','request-promise','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','moment'];(function(_0x2c2f44,_0x5b56da){var _0x137c4c=function(_0x36cc77){while(--_0x36cc77){_0x2c2f44['push'](_0x2c2f44['shift']());}};_0x137c4c(++_0x5b56da);}(_0xadce,0x101));var _0xeadc=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xadce[_0x1bc0ae];return _0x501104;};'use strict';var _=require(_0xeadc('0x0'));var util=require(_0xeadc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeadc('0x2'));var BPromise=require(_0xeadc('0x3'));var rp=require(_0xeadc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeadc('0x5'));var attributes=require(_0xeadc('0x6'));module['exports']=function(_0x135613,_0x322d7f){return _0x135613[_0xeadc('0x7')](_0xeadc('0x8'),attributes,{'tableName':_0xeadc('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 f414b31..f00f5bf 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 _0x13c9=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x13c9,0x1dd));var _0x913c=function(_0x418894,_0x38f1c1){_0x418894=_0x418894-0x0;var _0x396392=_0x13c9[_0x418894];return _0x396392;};'use strict';var _=require(_0x913c('0x0'));var util=require(_0x913c('0x1'));var moment=require(_0x913c('0x2'));var BPromise=require(_0x913c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x913c('0x4'));var logger=require(_0x913c('0x5'))(_0x913c('0x6'));var config=require(_0x913c('0x7'));var jayson=require(_0x913c('0x8'));var client=jayson[_0x913c('0x9')][_0x913c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ed05d,_0x29cbd8,_0x174a25){return new BPromise(function(_0x14a944,_0x2c1228){return client[_0x913c('0xb')](_0x3ed05d,_0x174a25)[_0x913c('0xc')](function(_0x4d70c4){logger[_0x913c('0xd')](_0x913c('0xe'),_0x29cbd8,_0x913c('0xf'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x29cbd8,_0x913c('0xf'),JSON['stringify'](_0x4d70c4));if(_0x4d70c4[_0x913c('0x10')]){if(_0x4d70c4[_0x913c('0x10')][_0x913c('0x11')]===0x1f4){logger['error'](_0x913c('0xe'),_0x29cbd8,_0x4d70c4[_0x913c('0x10')][_0x913c('0x12')]);return _0x2c1228(_0x4d70c4[_0x913c('0x10')][_0x913c('0x12')]);}logger[_0x913c('0x10')](_0x913c('0xe'),_0x29cbd8,_0x4d70c4['error']['message']);return _0x14a944(_0x4d70c4['error'][_0x913c('0x12')]);}else{logger[_0x913c('0xd')](_0x913c('0xe'),_0x29cbd8,_0x913c('0xf'));_0x14a944(_0x4d70c4['result']['message']);}})[_0x913c('0x13')](function(_0x1349be){logger[_0x913c('0x10')](_0x913c('0xe'),_0x29cbd8,_0x1349be);_0x2c1228(_0x1349be);});});}exports[_0x913c('0x14')]=function(_0x3bf46b){var _0xd7b5ee=this;return new Promise(function(_0x3b61f9,_0x294a4f){return db[_0x913c('0x15')][_0x913c('0x16')]({'raw':_0x3bf46b[_0x913c('0x17')]?_0x3bf46b[_0x913c('0x17')][_0x913c('0x18')]===undefined?!![]:![]:!![],'where':_0x3bf46b[_0x913c('0x17')]?_0x3bf46b[_0x913c('0x17')][_0x913c('0x19')]||null:null,'attributes':_0x3bf46b[_0x913c('0x17')]?_0x3bf46b[_0x913c('0x17')][_0x913c('0x1a')]||null:null,'limit':_0x3bf46b[_0x913c('0x17')]?_0x3bf46b[_0x913c('0x17')]['limit']||null:null,'include':_0x3bf46b[_0x913c('0x17')]?_0x3bf46b[_0x913c('0x17')][_0x913c('0x1b')]?_[_0x913c('0x1c')](_0x3bf46b['options'][_0x913c('0x1b')],function(_0x453fd8){return{'model':db[_0x453fd8['model']],'as':_0x453fd8['as'],'attributes':_0x453fd8[_0x913c('0x1a')],'include':_0x453fd8[_0x913c('0x1b')]?_[_0x913c('0x1c')](_0x453fd8[_0x913c('0x1b')],function(_0x4c794c){return{'model':db[_0x4c794c['model']],'as':_0x4c794c['as'],'attributes':_0x4c794c['attributes'],'include':_0x4c794c[_0x913c('0x1b')]?_['map'](_0x4c794c['include'],function(_0xc2b275){return{'model':db[_0xc2b275[_0x913c('0x1d')]],'as':_0xc2b275['as'],'attributes':_0xc2b275[_0x913c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x913c('0xc')](function(_0x2308ad){logger[_0x913c('0xd')]('GetTemplate',_0x3bf46b);logger[_0x913c('0x1e')](_0x913c('0x14'),_0x3bf46b,JSON[_0x913c('0x1f')](_0x2308ad));_0x3b61f9(_0x2308ad);})[_0x913c('0x13')](function(_0x3ec8a8){logger[_0x913c('0x10')](_0x913c('0x14'),_0x3ec8a8[_0x913c('0x12')],_0x3bf46b);_0x294a4f(_0xd7b5ee[_0x913c('0x10')](0x1f4,_0x3ec8a8[_0x913c('0x12')]));});});}; \ No newline at end of file +var _0x34b0=['include','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','map','model','attributes'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x34b0,0x195));var _0x034b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x034b('0x0'));var moment=require(_0x034b('0x1'));var BPromise=require('bluebird');var rs=require(_0x034b('0x2'));var fs=require('fs');var Redis=require(_0x034b('0x3'));var db=require(_0x034b('0x4'))['db'];var utils=require(_0x034b('0x5'));var logger=require(_0x034b('0x6'))(_0x034b('0x7'));var config=require('../../config/environment');var jayson=require(_0x034b('0x8'));var client=jayson[_0x034b('0x9')][_0x034b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b789d,_0x310d77,_0xbf5d1b){return new BPromise(function(_0x43822d,_0x53a967){return client[_0x034b('0xb')](_0x2b789d,_0xbf5d1b)['then'](function(_0x564cd5){logger[_0x034b('0xc')](_0x034b('0xd'),_0x310d77,_0x034b('0xe'));logger[_0x034b('0xf')](_0x034b('0x10'),_0x310d77,_0x034b('0xe'),JSON[_0x034b('0x11')](_0x564cd5));if(_0x564cd5[_0x034b('0x12')]){if(_0x564cd5[_0x034b('0x12')]['code']===0x1f4){logger[_0x034b('0x12')](_0x034b('0xd'),_0x310d77,_0x564cd5[_0x034b('0x12')][_0x034b('0x13')]);return _0x53a967(_0x564cd5[_0x034b('0x12')]['message']);}logger[_0x034b('0x12')](_0x034b('0xd'),_0x310d77,_0x564cd5[_0x034b('0x12')][_0x034b('0x13')]);return _0x43822d(_0x564cd5['error'][_0x034b('0x13')]);}else{logger['info'](_0x034b('0xd'),_0x310d77,_0x034b('0xe'));_0x43822d(_0x564cd5[_0x034b('0x14')][_0x034b('0x13')]);}})[_0x034b('0x15')](function(_0x3615e3){logger[_0x034b('0x12')](_0x034b('0xd'),_0x310d77,_0x3615e3);_0x53a967(_0x3615e3);});});}exports[_0x034b('0x16')]=function(_0x5df547){var _0x351400=this;return new Promise(function(_0x56e5c1,_0x2e35d8){return db[_0x034b('0x17')][_0x034b('0x18')]({'raw':_0x5df547[_0x034b('0x19')]?_0x5df547[_0x034b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5df547[_0x034b('0x19')]?_0x5df547[_0x034b('0x19')]['where']||null:null,'attributes':_0x5df547[_0x034b('0x19')]?_0x5df547[_0x034b('0x19')]['attributes']||null:null,'limit':_0x5df547[_0x034b('0x19')]?_0x5df547[_0x034b('0x19')]['limit']||null:null,'include':_0x5df547[_0x034b('0x19')]?_0x5df547['options']['include']?_[_0x034b('0x1a')](_0x5df547[_0x034b('0x19')]['include'],function(_0x5343d8){return{'model':db[_0x5343d8[_0x034b('0x1b')]],'as':_0x5343d8['as'],'attributes':_0x5343d8[_0x034b('0x1c')],'include':_0x5343d8[_0x034b('0x1d')]?_[_0x034b('0x1a')](_0x5343d8[_0x034b('0x1d')],function(_0x3598dc){return{'model':db[_0x3598dc[_0x034b('0x1b')]],'as':_0x3598dc['as'],'attributes':_0x3598dc[_0x034b('0x1c')],'include':_0x3598dc[_0x034b('0x1d')]?_[_0x034b('0x1a')](_0x3598dc[_0x034b('0x1d')],function(_0x574bfc){return{'model':db[_0x574bfc['model']],'as':_0x574bfc['as'],'attributes':_0x574bfc[_0x034b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x034b('0x1e')](function(_0x4d0ff1){logger[_0x034b('0xc')](_0x034b('0x16'),_0x5df547);logger[_0x034b('0xf')](_0x034b('0x16'),_0x5df547,JSON[_0x034b('0x11')](_0x4d0ff1));_0x56e5c1(_0x4d0ff1);})['catch'](function(_0x86eacc){logger[_0x034b('0x12')](_0x034b('0x16'),_0x86eacc[_0x034b('0x13')],_0x5df547);_0x2e35d8(_0x351400[_0x034b('0x12')](0x1f4,_0x86eacc[_0x034b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0f221bc..8a26d4b 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 _0x27dd=['express','../../components/auth/service','./trigger.controller','get','index','/:id','isAuthenticated','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','update','multer','path','connect-timeout'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x27dd,0x177));var _0xd27d=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x27dd[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0xd27d('0x0'));var util=require('util');var path=require(_0xd27d('0x1'));var timeout=require(_0xd27d('0x2'));var express=require(_0xd27d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd27d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd27d('0x5'));router[_0xd27d('0x6')]('/',auth['isAuthenticated'](),controller[_0xd27d('0x7')]);router[_0xd27d('0x6')](_0xd27d('0x8'),auth[_0xd27d('0x9')](),controller['show']);router[_0xd27d('0x6')]('/:id/all_conditions',auth[_0xd27d('0x9')](),controller['getAllConditions']);router['get'](_0xd27d('0xa'),auth[_0xd27d('0x9')](),controller['getAnyConditions']);router['get'](_0xd27d('0xb'),auth[_0xd27d('0x9')](),controller[_0xd27d('0xc')]);router[_0xd27d('0xd')]('/',auth[_0xd27d('0x9')](),controller['create']);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xd27d('0xe')]);router['post'](_0xd27d('0xa'),auth[_0xd27d('0x9')](),controller[_0xd27d('0xf')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0xd27d('0x10')]('/:id',auth[_0xd27d('0x9')](),controller[_0xd27d('0x11')]);router['delete'](_0xd27d('0x8'),auth[_0xd27d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1394=['show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3f690a,_0x18e2b4){var _0x21b869=function(_0x1fcb83){while(--_0x1fcb83){_0x3f690a['push'](_0x3f690a['shift']());}};_0x21b869(++_0x18e2b4);}(_0x1394,0xb3));var _0x4139=function(_0x27c619,_0x44ea27){_0x27c619=_0x27c619-0x0;var _0x595e39=_0x1394[_0x27c619];return _0x595e39;};'use strict';var multer=require(_0x4139('0x0'));var util=require(_0x4139('0x1'));var path=require(_0x4139('0x2'));var timeout=require('connect-timeout');var express=require(_0x4139('0x3'));var router=express['Router']();var fs_extra=require(_0x4139('0x4'));var auth=require(_0x4139('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4139('0x6'));var controller=require('./trigger.controller');router[_0x4139('0x7')]('/',auth[_0x4139('0x8')](),controller[_0x4139('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4139('0xa')]);router[_0x4139('0x7')](_0x4139('0xb'),auth[_0x4139('0x8')](),controller[_0x4139('0xc')]);router[_0x4139('0x7')](_0x4139('0xd'),auth[_0x4139('0x8')](),controller['getAnyConditions']);router[_0x4139('0x7')](_0x4139('0xe'),auth[_0x4139('0x8')](),controller[_0x4139('0xf')]);router[_0x4139('0x10')]('/',auth[_0x4139('0x8')](),controller[_0x4139('0x11')]);router['post']('/:id/all_conditions',auth[_0x4139('0x8')](),controller[_0x4139('0x12')]);router[_0x4139('0x10')](_0x4139('0xd'),auth['isAuthenticated'](),controller[_0x4139('0x13')]);router[_0x4139('0x10')](_0x4139('0xe'),auth['isAuthenticated'](),controller[_0x4139('0x14')]);router[_0x4139('0x15')](_0x4139('0x16'),auth['isAuthenticated'](),controller[_0x4139('0x17')]);router[_0x4139('0x18')](_0x4139('0x16'),auth[_0x4139('0x8')](),controller[_0x4139('0x19')]);module[_0x4139('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a8f9451..4903c48 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 _0x3fe4=['sequelize','exports','STRING','BOOLEAN'];(function(_0x54c915,_0x29ce6b){var _0x3b293b=function(_0x1d2be7){while(--_0x1d2be7){_0x54c915['push'](_0x54c915['shift']());}};_0x3b293b(++_0x29ce6b);}(_0x3fe4,0x1b0));var _0x43fe=function(_0x3f0c7d,_0x57bbd4){_0x3f0c7d=_0x3f0c7d-0x0;var _0x45a295=_0x3fe4[_0x3f0c7d];return _0x45a295;};'use strict';var Sequelize=require(_0x43fe('0x0'));module[_0x43fe('0x1')]={'name':{'type':Sequelize[_0x43fe('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x43fe('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc858=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2d5cd2,_0x52b0b6){var _0x1a9906=function(_0x164321){while(--_0x164321){_0x2d5cd2['push'](_0x2d5cd2['shift']());}};_0x1a9906(++_0x52b0b6);}(_0xc858,0x6e));var _0x8c85=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0xc858[_0x1569fc];return _0x277783;};'use strict';var Sequelize=require(_0x8c85('0x0'));module[_0x8c85('0x1')]={'name':{'type':Sequelize[_0x8c85('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c85('0x2')]},'status':{'type':Sequelize[_0x8c85('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7e54591..3e15b7c 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 _0x842f=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAnyId','Condition','order','getAllConditions','getAnyConditions','findOne','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x4dcb47,_0x50ef92){var _0x352b40=function(_0x5bce21){while(--_0x5bce21){_0x4dcb47['push'](_0x4dcb47['shift']());}};_0x352b40(++_0x50ef92);}(_0x842f,0x10f));var _0xf842=function(_0x5caee2,_0x325a65){_0x5caee2=_0x5caee2-0x0;var _0x3f8747=_0x842f[_0x5caee2];return _0x3f8747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf842('0x0'));var zipdir=require(_0xf842('0x1'));var jsonpatch=require(_0xf842('0x2'));var rp=require('request-promise');var moment=require(_0xf842('0x3'));var BPromise=require(_0xf842('0x4'));var Mustache=require('mustache');var util=require(_0xf842('0x5'));var path=require(_0xf842('0x6'));var sox=require('sox');var csv=require(_0xf842('0x7'));var ejs=require(_0xf842('0x8'));var fs=require('fs');var fs_extra=require(_0xf842('0x9'));var _=require(_0xf842('0xa'));var squel=require(_0xf842('0xb'));var crypto=require(_0xf842('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf842('0xd'));var toCsv=require(_0xf842('0x7'));var querystring=require('querystring');var Papa=require(_0xf842('0xe'));var Redis=require(_0xf842('0xf'));var authService=require(_0xf842('0x10'));var qs=require(_0xf842('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf842('0x12'));var logger=require(_0xf842('0x13'))(_0xf842('0x14'));var utils=require(_0xf842('0x15'));var config=require(_0xf842('0x16'));var licenseUtil=require(_0xf842('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120e07,_0x11c158){_0x11c158=_0x11c158||0xcc;return function(_0x3fe336){if(_0x3fe336){return _0x120e07[_0xf842('0x18')](_0x11c158);}return _0x120e07[_0xf842('0x19')](_0x11c158)[_0xf842('0x1a')]();};}function respondWithResult(_0x856ce3,_0x292a89){_0x292a89=_0x292a89||0xc8;return function(_0x25da67){if(_0x25da67){return _0x856ce3[_0xf842('0x19')](_0x292a89)['json'](_0x25da67);}};}function respondWithFilteredResult(_0x20a6c3,_0x29c74a){return function(_0xc0eeb6){if(_0xc0eeb6){var _0x140cee=typeof _0x29c74a[_0xf842('0x1b')]===_0xf842('0x1c')&&typeof _0x29c74a[_0xf842('0x1d')]==='undefined';var _0x46fb80=_0xc0eeb6[_0xf842('0x1e')];var _0x5c0c50=_0x140cee?0x0:_0x29c74a[_0xf842('0x1b')];var _0x2e3219=_0x140cee?_0xc0eeb6[_0xf842('0x1e')]:_0x29c74a['offset']+_0x29c74a[_0xf842('0x1d')];var _0x2184df;if(_0x2e3219>=_0x46fb80){_0x2e3219=_0x46fb80;_0x2184df=0xc8;}else{_0x2184df=0xce;}_0x20a6c3[_0xf842('0x19')](_0x2184df);return _0x20a6c3['set']('Content-Range',_0x5c0c50+'-'+_0x2e3219+'/'+_0x46fb80)[_0xf842('0x1f')](_0xc0eeb6);}return null;};}function patchUpdates(_0x1f5395){return function(_0x557f50){try{jsonpatch[_0xf842('0x20')](_0x557f50,_0x1f5395,!![]);}catch(_0x438ddd){return BPromise[_0xf842('0x21')](_0x438ddd);}return _0x557f50[_0xf842('0x22')]();};}function saveUpdates(_0x52bb05,_0x1d99da){return function(_0x235bf4){if(_0x235bf4){return _0x235bf4[_0xf842('0x23')](_0x52bb05)[_0xf842('0x24')](function(_0x55eb63){return _0x55eb63;});}return null;};}function removeEntity(_0x1cf628,_0x730b17){return function(_0x146a0d){if(_0x146a0d){return _0x146a0d['destroy']()[_0xf842('0x24')](function(){var _0x37943f=_0x146a0d[_0xf842('0x25')]({'plain':!![]});var _0x230b8b=_0xf842('0x26');return db[_0xf842('0x27')][_0xf842('0x28')]({'where':{'type':_0x230b8b,'resourceId':_0x37943f['id']}})['then'](function(){return _0x146a0d;});})[_0xf842('0x24')](function(){_0x1cf628[_0xf842('0x19')](0xcc)[_0xf842('0x1a')]();});}};}function handleEntityNotFound(_0x161293,_0x507457){return function(_0x3f3263){if(!_0x3f3263){_0x161293[_0xf842('0x18')](0x194);}return _0x3f3263;};}function handleError(_0x16e00c,_0x25a236){_0x25a236=_0x25a236||0x1f4;return function(_0x5b2fd9){logger[_0xf842('0x29')](_0x5b2fd9[_0xf842('0x2a')]);if(_0x5b2fd9[_0xf842('0x2b')]){delete _0x5b2fd9['name'];}_0x16e00c[_0xf842('0x19')](_0x25a236)[_0xf842('0x2c')](_0x5b2fd9);};}exports[_0xf842('0x2d')]=function(_0x191e81,_0x830d1e){var _0x3b8256={},_0x1b3e42={},_0x42efab={'count':0x0,'rows':[]};var _0x22cc5f=_['map'](db[_0xf842('0x2e')][_0xf842('0x2f')],function(_0x4e1ad6){return{'name':_0x4e1ad6[_0xf842('0x30')],'type':_0x4e1ad6[_0xf842('0x31')]['key']};});_0x1b3e42['model']=_[_0xf842('0x32')](_0x22cc5f,_0xf842('0x2b'));_0x1b3e42[_0xf842('0x33')]=_[_0xf842('0x34')](_0x191e81[_0xf842('0x33')]);_0x1b3e42[_0xf842('0x35')]=_[_0xf842('0x36')](_0x1b3e42[_0xf842('0x37')],_0x1b3e42[_0xf842('0x33')]);_0x3b8256[_0xf842('0x38')]=_[_0xf842('0x36')](_0x1b3e42[_0xf842('0x37')],qs['fields'](_0x191e81['query'][_0xf842('0x39')]));_0x3b8256[_0xf842('0x38')]=_0x3b8256['attributes']['length']?_0x3b8256[_0xf842('0x38')]:_0x1b3e42[_0xf842('0x37')];if(!_0x191e81[_0xf842('0x33')][_0xf842('0x3a')](_0xf842('0x3b'))){_0x3b8256[_0xf842('0x1d')]=qs[_0xf842('0x1d')](_0x191e81[_0xf842('0x33')][_0xf842('0x1d')]);_0x3b8256[_0xf842('0x1b')]=qs['offset'](_0x191e81[_0xf842('0x33')][_0xf842('0x1b')]);}_0x3b8256['order']=qs['sort'](_0x191e81[_0xf842('0x33')][_0xf842('0x3c')]);_0x3b8256[_0xf842('0x3d')]=qs[_0xf842('0x35')](_[_0xf842('0x3e')](_0x191e81[_0xf842('0x33')],_0x1b3e42['filters']),_0x22cc5f);if(_0x191e81[_0xf842('0x33')]['filter']){_0x3b8256['where']=_[_0xf842('0x3f')](_0x3b8256['where'],{'$or':_[_0xf842('0x32')](_0x22cc5f,function(_0x2e496b){if(_0x2e496b['type']!=='VIRTUAL'){var _0x5a7b80={};_0x5a7b80[_0x2e496b[_0xf842('0x2b')]]={'$like':'%'+_0x191e81[_0xf842('0x33')][_0xf842('0x40')]+'%'};return _0x5a7b80;}})});}_0x3b8256=_['merge']({},_0x3b8256,_0x191e81[_0xf842('0x41')]);var _0x50e60f={'where':_0x3b8256[_0xf842('0x3d')]};return db[_0xf842('0x2e')][_0xf842('0x1e')](_0x50e60f)[_0xf842('0x24')](function(_0x3f4e27){_0x42efab[_0xf842('0x1e')]=_0x3f4e27;if(_0x191e81[_0xf842('0x33')][_0xf842('0x42')]){_0x3b8256[_0xf842('0x43')]=[{'all':!![]}];}return db[_0xf842('0x2e')][_0xf842('0x44')](_0x3b8256);})[_0xf842('0x24')](function(_0x3822d7){_0x42efab[_0xf842('0x45')]=_0x3822d7;return _0x42efab;})[_0xf842('0x24')](respondWithFilteredResult(_0x830d1e,_0x3b8256))[_0xf842('0x46')](handleError(_0x830d1e,null));};exports[_0xf842('0x47')]=function(_0xfa3f47,_0x3daa1d){var _0x46bf86={'raw':![],'where':{'id':_0xfa3f47[_0xf842('0x48')]['id']}},_0x169b89={};_0x169b89[_0xf842('0x37')]=_[_0xf842('0x34')](db[_0xf842('0x2e')][_0xf842('0x2f')]);_0x169b89[_0xf842('0x33')]=_['keys'](_0xfa3f47[_0xf842('0x33')]);_0x169b89[_0xf842('0x35')]=_[_0xf842('0x36')](_0x169b89[_0xf842('0x37')],_0x169b89[_0xf842('0x33')]);_0x46bf86[_0xf842('0x38')]=_[_0xf842('0x36')](_0x169b89[_0xf842('0x37')],qs[_0xf842('0x39')](_0xfa3f47[_0xf842('0x33')][_0xf842('0x39')]));_0x46bf86[_0xf842('0x38')]=_0x46bf86[_0xf842('0x38')][_0xf842('0x49')]?_0x46bf86[_0xf842('0x38')]:_0x169b89[_0xf842('0x37')];if(_0xfa3f47[_0xf842('0x33')][_0xf842('0x42')]){_0x46bf86[_0xf842('0x43')]=[{'all':!![]}];}_0x46bf86=_[_0xf842('0x3f')]({},_0x46bf86,_0xfa3f47['options']);return db['Trigger'][_0xf842('0x4a')](_0x46bf86)[_0xf842('0x24')](handleEntityNotFound(_0x3daa1d,null))[_0xf842('0x24')](respondWithResult(_0x3daa1d,null))[_0xf842('0x46')](handleError(_0x3daa1d,null));};exports[_0xf842('0x4b')]=function(_0x58193f,_0x4b17ba){return db[_0xf842('0x2e')]['create'](_0x58193f[_0xf842('0x4c')],{})['then'](function(_0x203678){var _0x1d23bb=_0x58193f[_0xf842('0x4d')][_0xf842('0x25')]({'plain':!![]});if(!_0x1d23bb)throw new Error(_0xf842('0x4e'));if(_0x1d23bb[_0xf842('0x4f')]===_0xf842('0x4d')){var _0x464c60=_0x203678[_0xf842('0x25')]({'plain':!![]});var _0x30fb8b=_0xf842('0x26');return db[_0xf842('0x50')][_0xf842('0x4a')]({'where':{'name':_0x30fb8b,'userProfileId':_0x1d23bb[_0xf842('0x51')]},'raw':!![]})[_0xf842('0x24')](function(_0x35ba8d){if(_0x35ba8d&&_0x35ba8d['autoAssociation']===0x0){return db[_0xf842('0x27')][_0xf842('0x4b')]({'name':_0x464c60[_0xf842('0x2b')],'resourceId':_0x464c60['id'],'type':_0x35ba8d[_0xf842('0x2b')],'sectionId':_0x35ba8d['id']},{})['then'](function(){return _0x203678;});}else{return _0x203678;}})[_0xf842('0x46')](function(_0x228ca2){logger['error'](_0xf842('0x52'),_0x228ca2);throw _0x228ca2;});}return _0x203678;})[_0xf842('0x24')](respondWithResult(_0x4b17ba,0xc9))[_0xf842('0x46')](handleError(_0x4b17ba,null));};exports['update']=function(_0x4dc5b0,_0x53cda3){if(_0x4dc5b0[_0xf842('0x4c')]['id']){delete _0x4dc5b0[_0xf842('0x4c')]['id'];}return db[_0xf842('0x2e')][_0xf842('0x4a')]({'where':{'id':_0x4dc5b0['params']['id']}})[_0xf842('0x24')](handleEntityNotFound(_0x53cda3,null))[_0xf842('0x24')](saveUpdates(_0x4dc5b0['body'],null))[_0xf842('0x24')](respondWithResult(_0x53cda3,null))['catch'](handleError(_0x53cda3,null));};exports[_0xf842('0x28')]=function(_0x403bc6,_0x3e40e9){return db[_0xf842('0x2e')]['find']({'where':{'id':_0x403bc6[_0xf842('0x48')]['id']}})[_0xf842('0x24')](handleEntityNotFound(_0x3e40e9,null))[_0xf842('0x24')](removeEntity(_0x3e40e9,null))[_0xf842('0x46')](handleError(_0x3e40e9,null));};exports['addAllCondition']=function(_0x3df4c9,_0xae32c0,_0x41bbd4){if(_0x3df4c9[_0xf842('0x4c')]['id']){delete _0x3df4c9['body']['id'];}return db[_0xf842('0x2e')][_0xf842('0x4a')]({'where':{'id':_0x3df4c9[_0xf842('0x48')]['id']}})['then'](handleEntityNotFound(_0xae32c0,null))[_0xf842('0x24')](function(_0x5ad019){if(_0x5ad019){_0x3df4c9[_0xf842('0x4c')]['TriggerAllId']=_0x5ad019['id'];return db['Condition'][_0xf842('0x4b')](_0x3df4c9[_0xf842('0x4c')]);}})[_0xf842('0x24')](respondWithResult(_0xae32c0,null))[_0xf842('0x46')](handleError(_0xae32c0,null));};exports['addAnyCondition']=function(_0x2d8c28,_0x37e93f,_0x406eca){if(_0x2d8c28[_0xf842('0x4c')]['id']){delete _0x2d8c28['body']['id'];}return db['Trigger'][_0xf842('0x4a')]({'where':{'id':_0x2d8c28['params']['id']}})['then'](handleEntityNotFound(_0x37e93f,null))['then'](function(_0x2f4393){if(_0x2f4393){_0x2d8c28[_0xf842('0x4c')][_0xf842('0x53')]=_0x2f4393['id'];return db['Condition']['create'](_0x2d8c28['body']);}})[_0xf842('0x24')](respondWithResult(_0x37e93f,null))[_0xf842('0x46')](handleError(_0x37e93f,null));};exports['getAllConditions']=function(_0x1443c5,_0xbcbb8,_0x54f1b8){var _0x3e5f6e={};var _0x2c77a6={};var _0x44afe4;var _0x55af21;return db[_0xf842('0x2e')]['findOne']({'where':{'id':_0x1443c5[_0xf842('0x48')]['id']}})[_0xf842('0x24')](handleEntityNotFound(_0xbcbb8,null))[_0xf842('0x24')](function(_0x15be50){if(_0x15be50){_0x44afe4=_0x15be50;_0x2c77a6[_0xf842('0x37')]=_[_0xf842('0x34')](db[_0xf842('0x54')][_0xf842('0x2f')]);_0x2c77a6[_0xf842('0x33')]=_[_0xf842('0x34')](_0x1443c5[_0xf842('0x33')]);_0x2c77a6['filters']=_['intersection'](_0x2c77a6[_0xf842('0x37')],_0x2c77a6['query']);_0x3e5f6e[_0xf842('0x38')]=_[_0xf842('0x36')](_0x2c77a6[_0xf842('0x37')],qs[_0xf842('0x39')](_0x1443c5[_0xf842('0x33')][_0xf842('0x39')]));_0x3e5f6e[_0xf842('0x38')]=_0x3e5f6e['attributes'][_0xf842('0x49')]?_0x3e5f6e[_0xf842('0x38')]:_0x2c77a6[_0xf842('0x37')];_0x3e5f6e[_0xf842('0x55')]=qs[_0xf842('0x3c')](_0x1443c5[_0xf842('0x33')]['sort']);_0x3e5f6e[_0xf842('0x3d')]=qs[_0xf842('0x35')](_['pick'](_0x1443c5[_0xf842('0x33')],_0x2c77a6['filters']));if(_0x1443c5['query'][_0xf842('0x40')]){_0x3e5f6e[_0xf842('0x3d')]=_[_0xf842('0x3f')](_0x3e5f6e[_0xf842('0x3d')],{'$or':_[_0xf842('0x32')](_0x3e5f6e[_0xf842('0x38')],function(_0xe3547e){var _0x4313a0={};_0x4313a0[_0xe3547e]={'$like':'%'+_0x1443c5['query']['filter']+'%'};return _0x4313a0;})});}_0x3e5f6e=_[_0xf842('0x3f')]({},_0x3e5f6e,_0x1443c5[_0xf842('0x41')]);return _0x44afe4['getAllConditions'](_0x3e5f6e);}})[_0xf842('0x24')](function(_0x1ebcb1){if(_0x1ebcb1){_0x55af21=_0x1ebcb1[_0xf842('0x49')];if(!_0x1443c5[_0xf842('0x33')][_0xf842('0x3a')](_0xf842('0x3b'))){_0x3e5f6e[_0xf842('0x1d')]=qs[_0xf842('0x1d')](_0x1443c5[_0xf842('0x33')]['limit']);_0x3e5f6e[_0xf842('0x1b')]=qs[_0xf842('0x1b')](_0x1443c5['query'][_0xf842('0x1b')]);}return _0x44afe4[_0xf842('0x56')](_0x3e5f6e);}})[_0xf842('0x24')](function(_0x55d6d9){if(_0x55d6d9){return _0x55d6d9?{'count':_0x55af21,'rows':_0x55d6d9}:null;}})[_0xf842('0x24')](respondWithResult(_0xbcbb8,null))[_0xf842('0x46')](handleError(_0xbcbb8,null));};exports[_0xf842('0x57')]=function(_0x296723,_0x43ff8a,_0x1a0bb9){var _0x597c50={};var _0x14bb3f={};var _0x4d5c1b;var _0x4512b6;return db['Trigger'][_0xf842('0x58')]({'where':{'id':_0x296723[_0xf842('0x48')]['id']}})['then'](handleEntityNotFound(_0x43ff8a,null))[_0xf842('0x24')](function(_0x3b8efc){if(_0x3b8efc){_0x4d5c1b=_0x3b8efc;_0x14bb3f[_0xf842('0x37')]=_[_0xf842('0x34')](db[_0xf842('0x54')][_0xf842('0x2f')]);_0x14bb3f[_0xf842('0x33')]=_['keys'](_0x296723[_0xf842('0x33')]);_0x14bb3f[_0xf842('0x35')]=_[_0xf842('0x36')](_0x14bb3f['model'],_0x14bb3f[_0xf842('0x33')]);_0x597c50[_0xf842('0x38')]=_[_0xf842('0x36')](_0x14bb3f[_0xf842('0x37')],qs[_0xf842('0x39')](_0x296723[_0xf842('0x33')]['fields']));_0x597c50[_0xf842('0x38')]=_0x597c50[_0xf842('0x38')][_0xf842('0x49')]?_0x597c50[_0xf842('0x38')]:_0x14bb3f[_0xf842('0x37')];_0x597c50[_0xf842('0x55')]=qs[_0xf842('0x3c')](_0x296723[_0xf842('0x33')][_0xf842('0x3c')]);_0x597c50['where']=qs['filters'](_[_0xf842('0x3e')](_0x296723[_0xf842('0x33')],_0x14bb3f[_0xf842('0x35')]));if(_0x296723[_0xf842('0x33')][_0xf842('0x40')]){_0x597c50['where']=_['merge'](_0x597c50['where'],{'$or':_[_0xf842('0x32')](_0x597c50[_0xf842('0x38')],function(_0x312527){var _0x478ef7={};_0x478ef7[_0x312527]={'$like':'%'+_0x296723['query'][_0xf842('0x40')]+'%'};return _0x478ef7;})});}_0x597c50=_['merge']({},_0x597c50,_0x296723[_0xf842('0x41')]);return _0x4d5c1b['getAnyConditions'](_0x597c50);}})[_0xf842('0x24')](function(_0x495752){if(_0x495752){_0x4512b6=_0x495752[_0xf842('0x49')];if(!_0x296723[_0xf842('0x33')]['hasOwnProperty'](_0xf842('0x3b'))){_0x597c50['limit']=qs[_0xf842('0x1d')](_0x296723[_0xf842('0x33')][_0xf842('0x1d')]);_0x597c50[_0xf842('0x1b')]=qs['offset'](_0x296723['query'][_0xf842('0x1b')]);}return _0x4d5c1b[_0xf842('0x57')](_0x597c50);}})[_0xf842('0x24')](function(_0x131c12){if(_0x131c12){return _0x131c12?{'count':_0x4512b6,'rows':_0x131c12}:null;}})[_0xf842('0x24')](respondWithResult(_0x43ff8a,null))[_0xf842('0x46')](handleError(_0x43ff8a,null));};exports[_0xf842('0x59')]=function(_0x1cca27,_0x32214a,_0x44cf9d){if(_0x1cca27[_0xf842('0x4c')]['id']){delete _0x1cca27[_0xf842('0x4c')]['id'];}return db[_0xf842('0x2e')][_0xf842('0x4a')]({'where':{'id':_0x1cca27[_0xf842('0x48')]['id']}})[_0xf842('0x24')](handleEntityNotFound(_0x32214a,null))[_0xf842('0x24')](function(_0x4faf9e){if(_0x4faf9e){_0x1cca27[_0xf842('0x4c')]['TriggerId']=_0x4faf9e['id'];return db['Action'][_0xf842('0x4b')](_0x1cca27[_0xf842('0x4c')]);}})[_0xf842('0x24')](respondWithResult(_0x32214a,null))[_0xf842('0x46')](handleError(_0x32214a,null));};exports['getActions']=function(_0x4aaf22,_0x165675,_0x333159){var _0x1bf39b={};var _0x276641={};var _0x365546;var _0x484474;return db[_0xf842('0x2e')][_0xf842('0x58')]({'where':{'id':_0x4aaf22[_0xf842('0x48')]['id']}})[_0xf842('0x24')](handleEntityNotFound(_0x165675,null))[_0xf842('0x24')](function(_0x4055f9){if(_0x4055f9){_0x365546=_0x4055f9;_0x276641[_0xf842('0x37')]=_['keys'](db[_0xf842('0x5a')][_0xf842('0x2f')]);_0x276641[_0xf842('0x33')]=_[_0xf842('0x34')](_0x4aaf22[_0xf842('0x33')]);_0x276641[_0xf842('0x35')]=_['intersection'](_0x276641[_0xf842('0x37')],_0x276641[_0xf842('0x33')]);_0x1bf39b['attributes']=_['intersection'](_0x276641['model'],qs[_0xf842('0x39')](_0x4aaf22[_0xf842('0x33')][_0xf842('0x39')]));_0x1bf39b['attributes']=_0x1bf39b[_0xf842('0x38')][_0xf842('0x49')]?_0x1bf39b[_0xf842('0x38')]:_0x276641[_0xf842('0x37')];_0x1bf39b['order']=qs['sort'](_0x4aaf22[_0xf842('0x33')][_0xf842('0x3c')]);_0x1bf39b[_0xf842('0x3d')]=qs['filters'](_[_0xf842('0x3e')](_0x4aaf22[_0xf842('0x33')],_0x276641['filters']));if(_0x4aaf22[_0xf842('0x33')]['filter']){_0x1bf39b[_0xf842('0x3d')]=_[_0xf842('0x3f')](_0x1bf39b[_0xf842('0x3d')],{'$or':_[_0xf842('0x32')](_0x1bf39b[_0xf842('0x38')],function(_0x4463db){var _0x278ab4={};_0x278ab4[_0x4463db]={'$like':'%'+_0x4aaf22['query']['filter']+'%'};return _0x278ab4;})});}_0x1bf39b=_[_0xf842('0x3f')]({},_0x1bf39b,_0x4aaf22[_0xf842('0x41')]);return _0x365546['getActions'](_0x1bf39b);}})['then'](function(_0x318508){if(_0x318508){_0x484474=_0x318508[_0xf842('0x49')];if(!_0x4aaf22[_0xf842('0x33')][_0xf842('0x3a')](_0xf842('0x3b'))){_0x1bf39b['limit']=qs[_0xf842('0x1d')](_0x4aaf22[_0xf842('0x33')][_0xf842('0x1d')]);_0x1bf39b['offset']=qs[_0xf842('0x1b')](_0x4aaf22[_0xf842('0x33')][_0xf842('0x1b')]);}return _0x365546[_0xf842('0x5b')](_0x1bf39b);}})[_0xf842('0x24')](function(_0x11bfa0){if(_0x11bfa0){return _0x11bfa0?{'count':_0x484474,'rows':_0x11bfa0}:null;}})[_0xf842('0x24')](respondWithResult(_0x165675,null))['catch'](handleError(_0x165675,null));}; \ No newline at end of file +var _0x15d4=['model','query','keys','filters','intersection','fields','attributes','order','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','length','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','sort','pick','nolimit','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x15d4,0x8c));var _0x415d=function(_0x16236f,_0xfaf791){_0x16236f=_0x16236f-0x0;var _0x359de4=_0x15d4[_0x16236f];return _0x359de4;};'use strict';var emlformat=require(_0x415d('0x0'));var rimraf=require(_0x415d('0x1'));var zipdir=require(_0x415d('0x2'));var jsonpatch=require(_0x415d('0x3'));var rp=require('request-promise');var moment=require(_0x415d('0x4'));var BPromise=require(_0x415d('0x5'));var Mustache=require(_0x415d('0x6'));var util=require(_0x415d('0x7'));var path=require(_0x415d('0x8'));var sox=require(_0x415d('0x9'));var csv=require(_0x415d('0xa'));var ejs=require(_0x415d('0xb'));var fs=require('fs');var fs_extra=require(_0x415d('0xc'));var _=require(_0x415d('0xd'));var squel=require(_0x415d('0xe'));var crypto=require(_0x415d('0xf'));var jsforce=require(_0x415d('0x10'));var deskjs=require(_0x415d('0x11'));var toCsv=require(_0x415d('0xa'));var querystring=require(_0x415d('0x12'));var Papa=require(_0x415d('0x13'));var Redis=require(_0x415d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x415d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x415d('0x16'));var logger=require('../../config/logger')(_0x415d('0x17'));var utils=require(_0x415d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x415d('0x19'));var db=require(_0x415d('0x1a'))['db'];function respondWithStatusCode(_0x346036,_0x453b2c){_0x453b2c=_0x453b2c||0xcc;return function(_0x3f1f58){if(_0x3f1f58){return _0x346036[_0x415d('0x1b')](_0x453b2c);}return _0x346036[_0x415d('0x1c')](_0x453b2c)[_0x415d('0x1d')]();};}function respondWithResult(_0x1b547e,_0x4ad6ab){_0x4ad6ab=_0x4ad6ab||0xc8;return function(_0x21b83f){if(_0x21b83f){return _0x1b547e[_0x415d('0x1c')](_0x4ad6ab)[_0x415d('0x1e')](_0x21b83f);}};}function respondWithFilteredResult(_0x230370,_0x122d55){return function(_0x74ce6a){if(_0x74ce6a){var _0x466f7d=typeof _0x122d55['offset']===_0x415d('0x1f')&&typeof _0x122d55[_0x415d('0x20')]===_0x415d('0x1f');var _0x10f4a2=_0x74ce6a['count'];var _0x8cfda1=_0x466f7d?0x0:_0x122d55[_0x415d('0x21')];var _0xb77dcb=_0x466f7d?_0x74ce6a[_0x415d('0x22')]:_0x122d55[_0x415d('0x21')]+_0x122d55['limit'];var _0x24fae4;if(_0xb77dcb>=_0x10f4a2){_0xb77dcb=_0x10f4a2;_0x24fae4=0xc8;}else{_0x24fae4=0xce;}_0x230370[_0x415d('0x1c')](_0x24fae4);return _0x230370[_0x415d('0x23')](_0x415d('0x24'),_0x8cfda1+'-'+_0xb77dcb+'/'+_0x10f4a2)[_0x415d('0x1e')](_0x74ce6a);}return null;};}function patchUpdates(_0x485de3){return function(_0x3fa472){try{jsonpatch[_0x415d('0x25')](_0x3fa472,_0x485de3,!![]);}catch(_0x198b17){return BPromise[_0x415d('0x26')](_0x198b17);}return _0x3fa472['save']();};}function saveUpdates(_0x56f4ce,_0x2ba90e){return function(_0x1ee350){if(_0x1ee350){return _0x1ee350[_0x415d('0x27')](_0x56f4ce)[_0x415d('0x28')](function(_0x1763fc){return _0x1763fc;});}return null;};}function removeEntity(_0x5f32ea,_0x47c1ba){return function(_0x42c690){if(_0x42c690){return _0x42c690[_0x415d('0x29')]()[_0x415d('0x28')](function(){var _0x161623=_0x42c690['get']({'plain':!![]});var _0x48c497=_0x415d('0x2a');return db[_0x415d('0x2b')]['destroy']({'where':{'type':_0x48c497,'resourceId':_0x161623['id']}})[_0x415d('0x28')](function(){return _0x42c690;});})[_0x415d('0x28')](function(){_0x5f32ea[_0x415d('0x1c')](0xcc)[_0x415d('0x1d')]();});}};}function handleEntityNotFound(_0x116bda,_0x2cf726){return function(_0x242f66){if(!_0x242f66){_0x116bda[_0x415d('0x1b')](0x194);}return _0x242f66;};}function handleError(_0x3aa00b,_0x5f275d){_0x5f275d=_0x5f275d||0x1f4;return function(_0x2f0eb8){logger[_0x415d('0x2c')](_0x2f0eb8[_0x415d('0x2d')]);if(_0x2f0eb8[_0x415d('0x2e')]){delete _0x2f0eb8['name'];}_0x3aa00b[_0x415d('0x1c')](_0x5f275d)['send'](_0x2f0eb8);};}exports[_0x415d('0x2f')]=function(_0x57acf7,_0xcc2e67){var _0xfabd4e={},_0x2a8451={},_0x44618b={'count':0x0,'rows':[]};var _0x376876=_[_0x415d('0x30')](db[_0x415d('0x31')][_0x415d('0x32')],function(_0xba0db){return{'name':_0xba0db[_0x415d('0x33')],'type':_0xba0db[_0x415d('0x34')][_0x415d('0x35')]};});_0x2a8451[_0x415d('0x36')]=_[_0x415d('0x30')](_0x376876,_0x415d('0x2e'));_0x2a8451[_0x415d('0x37')]=_[_0x415d('0x38')](_0x57acf7[_0x415d('0x37')]);_0x2a8451[_0x415d('0x39')]=_[_0x415d('0x3a')](_0x2a8451[_0x415d('0x36')],_0x2a8451['query']);_0xfabd4e['attributes']=_[_0x415d('0x3a')](_0x2a8451[_0x415d('0x36')],qs[_0x415d('0x3b')](_0x57acf7[_0x415d('0x37')][_0x415d('0x3b')]));_0xfabd4e[_0x415d('0x3c')]=_0xfabd4e[_0x415d('0x3c')]['length']?_0xfabd4e[_0x415d('0x3c')]:_0x2a8451[_0x415d('0x36')];if(!_0x57acf7[_0x415d('0x37')]['hasOwnProperty']('nolimit')){_0xfabd4e[_0x415d('0x20')]=qs[_0x415d('0x20')](_0x57acf7[_0x415d('0x37')][_0x415d('0x20')]);_0xfabd4e['offset']=qs[_0x415d('0x21')](_0x57acf7[_0x415d('0x37')][_0x415d('0x21')]);}_0xfabd4e[_0x415d('0x3d')]=qs['sort'](_0x57acf7[_0x415d('0x37')]['sort']);_0xfabd4e[_0x415d('0x3e')]=qs[_0x415d('0x39')](_['pick'](_0x57acf7[_0x415d('0x37')],_0x2a8451['filters']),_0x376876);if(_0x57acf7[_0x415d('0x37')][_0x415d('0x3f')]){_0xfabd4e[_0x415d('0x3e')]=_[_0x415d('0x40')](_0xfabd4e[_0x415d('0x3e')],{'$or':_[_0x415d('0x30')](_0x376876,function(_0x21f659){if(_0x21f659[_0x415d('0x34')]!==_0x415d('0x41')){var _0x3cd6e8={};_0x3cd6e8[_0x21f659[_0x415d('0x2e')]]={'$like':'%'+_0x57acf7[_0x415d('0x37')][_0x415d('0x3f')]+'%'};return _0x3cd6e8;}})});}_0xfabd4e=_[_0x415d('0x40')]({},_0xfabd4e,_0x57acf7['options']);var _0x3da6c0={'where':_0xfabd4e[_0x415d('0x3e')]};return db[_0x415d('0x31')][_0x415d('0x22')](_0x3da6c0)['then'](function(_0x53ca84){_0x44618b[_0x415d('0x22')]=_0x53ca84;if(_0x57acf7[_0x415d('0x37')][_0x415d('0x42')]){_0xfabd4e[_0x415d('0x43')]=[{'all':!![]}];}return db[_0x415d('0x31')]['findAll'](_0xfabd4e);})['then'](function(_0x5b2f53){_0x44618b[_0x415d('0x44')]=_0x5b2f53;return _0x44618b;})['then'](respondWithFilteredResult(_0xcc2e67,_0xfabd4e))['catch'](handleError(_0xcc2e67,null));};exports[_0x415d('0x45')]=function(_0x4650ed,_0x4affee){var _0x11a12b={'raw':![],'where':{'id':_0x4650ed[_0x415d('0x46')]['id']}},_0x4ea5f3={};_0x4ea5f3[_0x415d('0x36')]=_[_0x415d('0x38')](db['Trigger'][_0x415d('0x32')]);_0x4ea5f3['query']=_['keys'](_0x4650ed[_0x415d('0x37')]);_0x4ea5f3['filters']=_['intersection'](_0x4ea5f3[_0x415d('0x36')],_0x4ea5f3[_0x415d('0x37')]);_0x11a12b[_0x415d('0x3c')]=_['intersection'](_0x4ea5f3[_0x415d('0x36')],qs[_0x415d('0x3b')](_0x4650ed[_0x415d('0x37')]['fields']));_0x11a12b[_0x415d('0x3c')]=_0x11a12b[_0x415d('0x3c')][_0x415d('0x47')]?_0x11a12b['attributes']:_0x4ea5f3[_0x415d('0x36')];if(_0x4650ed[_0x415d('0x37')][_0x415d('0x42')]){_0x11a12b[_0x415d('0x43')]=[{'all':!![]}];}_0x11a12b=_['merge']({},_0x11a12b,_0x4650ed[_0x415d('0x48')]);return db[_0x415d('0x31')][_0x415d('0x49')](_0x11a12b)[_0x415d('0x28')](handleEntityNotFound(_0x4affee,null))[_0x415d('0x28')](respondWithResult(_0x4affee,null))[_0x415d('0x4a')](handleError(_0x4affee,null));};exports[_0x415d('0x4b')]=function(_0x41e257,_0x45d221){return db['Trigger'][_0x415d('0x4b')](_0x41e257[_0x415d('0x4c')],{})[_0x415d('0x28')](function(_0x460356){var _0x180839=_0x41e257['user'][_0x415d('0x4d')]({'plain':!![]});if(!_0x180839)throw new Error(_0x415d('0x4e'));if(_0x180839['role']==='user'){var _0x321206=_0x460356['get']({'plain':!![]});var _0x5e8d41=_0x415d('0x2a');return db[_0x415d('0x4f')]['find']({'where':{'name':_0x5e8d41,'userProfileId':_0x180839[_0x415d('0x50')]},'raw':!![]})[_0x415d('0x28')](function(_0x236a74){if(_0x236a74&&_0x236a74[_0x415d('0x51')]===0x0){return db[_0x415d('0x2b')]['create']({'name':_0x321206[_0x415d('0x2e')],'resourceId':_0x321206['id'],'type':_0x236a74[_0x415d('0x2e')],'sectionId':_0x236a74['id']},{})[_0x415d('0x28')](function(){return _0x460356;});}else{return _0x460356;}})[_0x415d('0x4a')](function(_0xbfefd9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbfefd9);throw _0xbfefd9;});}return _0x460356;})[_0x415d('0x28')](respondWithResult(_0x45d221,0xc9))[_0x415d('0x4a')](handleError(_0x45d221,null));};exports['update']=function(_0x141fca,_0x11d013){if(_0x141fca[_0x415d('0x4c')]['id']){delete _0x141fca[_0x415d('0x4c')]['id'];}return db[_0x415d('0x31')]['find']({'where':{'id':_0x141fca[_0x415d('0x46')]['id']}})[_0x415d('0x28')](handleEntityNotFound(_0x11d013,null))[_0x415d('0x28')](saveUpdates(_0x141fca[_0x415d('0x4c')],null))['then'](respondWithResult(_0x11d013,null))[_0x415d('0x4a')](handleError(_0x11d013,null));};exports[_0x415d('0x29')]=function(_0x23d78c,_0x4cd797){return db['Trigger'][_0x415d('0x49')]({'where':{'id':_0x23d78c[_0x415d('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cd797,null))[_0x415d('0x28')](removeEntity(_0x4cd797,null))[_0x415d('0x4a')](handleError(_0x4cd797,null));};exports[_0x415d('0x52')]=function(_0x48958c,_0x28fd5f,_0x5587e1){if(_0x48958c['body']['id']){delete _0x48958c[_0x415d('0x4c')]['id'];}return db[_0x415d('0x31')][_0x415d('0x49')]({'where':{'id':_0x48958c['params']['id']}})['then'](handleEntityNotFound(_0x28fd5f,null))['then'](function(_0x27e1f9){if(_0x27e1f9){_0x48958c['body'][_0x415d('0x53')]=_0x27e1f9['id'];return db[_0x415d('0x54')][_0x415d('0x4b')](_0x48958c[_0x415d('0x4c')]);}})[_0x415d('0x28')](respondWithResult(_0x28fd5f,null))[_0x415d('0x4a')](handleError(_0x28fd5f,null));};exports['addAnyCondition']=function(_0x565698,_0x33260c,_0x4b846d){if(_0x565698[_0x415d('0x4c')]['id']){delete _0x565698['body']['id'];}return db['Trigger'][_0x415d('0x49')]({'where':{'id':_0x565698[_0x415d('0x46')]['id']}})[_0x415d('0x28')](handleEntityNotFound(_0x33260c,null))[_0x415d('0x28')](function(_0x5e2275){if(_0x5e2275){_0x565698[_0x415d('0x4c')][_0x415d('0x55')]=_0x5e2275['id'];return db['Condition'][_0x415d('0x4b')](_0x565698[_0x415d('0x4c')]);}})[_0x415d('0x28')](respondWithResult(_0x33260c,null))['catch'](handleError(_0x33260c,null));};exports[_0x415d('0x56')]=function(_0x18f5ec,_0x43262d,_0x3f1544){var _0xb8d265={};var _0x3d4b24={};var _0x2adf5b;var _0x120211;return db[_0x415d('0x31')][_0x415d('0x57')]({'where':{'id':_0x18f5ec['params']['id']}})['then'](handleEntityNotFound(_0x43262d,null))[_0x415d('0x28')](function(_0x6593bb){if(_0x6593bb){_0x2adf5b=_0x6593bb;_0x3d4b24[_0x415d('0x36')]=_['keys'](db[_0x415d('0x54')][_0x415d('0x32')]);_0x3d4b24['query']=_[_0x415d('0x38')](_0x18f5ec[_0x415d('0x37')]);_0x3d4b24[_0x415d('0x39')]=_[_0x415d('0x3a')](_0x3d4b24['model'],_0x3d4b24[_0x415d('0x37')]);_0xb8d265[_0x415d('0x3c')]=_[_0x415d('0x3a')](_0x3d4b24[_0x415d('0x36')],qs[_0x415d('0x3b')](_0x18f5ec[_0x415d('0x37')][_0x415d('0x3b')]));_0xb8d265[_0x415d('0x3c')]=_0xb8d265[_0x415d('0x3c')][_0x415d('0x47')]?_0xb8d265[_0x415d('0x3c')]:_0x3d4b24[_0x415d('0x36')];_0xb8d265['order']=qs[_0x415d('0x58')](_0x18f5ec[_0x415d('0x37')][_0x415d('0x58')]);_0xb8d265[_0x415d('0x3e')]=qs['filters'](_[_0x415d('0x59')](_0x18f5ec[_0x415d('0x37')],_0x3d4b24['filters']));if(_0x18f5ec['query']['filter']){_0xb8d265['where']=_['merge'](_0xb8d265[_0x415d('0x3e')],{'$or':_[_0x415d('0x30')](_0xb8d265['attributes'],function(_0x303bf7){var _0x2f80cc={};_0x2f80cc[_0x303bf7]={'$like':'%'+_0x18f5ec['query'][_0x415d('0x3f')]+'%'};return _0x2f80cc;})});}_0xb8d265=_[_0x415d('0x40')]({},_0xb8d265,_0x18f5ec[_0x415d('0x48')]);return _0x2adf5b['getAllConditions'](_0xb8d265);}})[_0x415d('0x28')](function(_0x23c5bf){if(_0x23c5bf){_0x120211=_0x23c5bf['length'];if(!_0x18f5ec[_0x415d('0x37')]['hasOwnProperty'](_0x415d('0x5a'))){_0xb8d265[_0x415d('0x20')]=qs['limit'](_0x18f5ec['query']['limit']);_0xb8d265['offset']=qs[_0x415d('0x21')](_0x18f5ec[_0x415d('0x37')]['offset']);}return _0x2adf5b[_0x415d('0x56')](_0xb8d265);}})[_0x415d('0x28')](function(_0x115833){if(_0x115833){return _0x115833?{'count':_0x120211,'rows':_0x115833}:null;}})[_0x415d('0x28')](respondWithResult(_0x43262d,null))[_0x415d('0x4a')](handleError(_0x43262d,null));};exports[_0x415d('0x5b')]=function(_0x47e74d,_0x524bf4,_0x23c9a2){var _0x3019f1={};var _0x2d804b={};var _0x922d69;var _0x3068ec;return db[_0x415d('0x31')][_0x415d('0x57')]({'where':{'id':_0x47e74d[_0x415d('0x46')]['id']}})[_0x415d('0x28')](handleEntityNotFound(_0x524bf4,null))['then'](function(_0x48aa21){if(_0x48aa21){_0x922d69=_0x48aa21;_0x2d804b[_0x415d('0x36')]=_[_0x415d('0x38')](db[_0x415d('0x54')][_0x415d('0x32')]);_0x2d804b[_0x415d('0x37')]=_[_0x415d('0x38')](_0x47e74d[_0x415d('0x37')]);_0x2d804b[_0x415d('0x39')]=_[_0x415d('0x3a')](_0x2d804b[_0x415d('0x36')],_0x2d804b[_0x415d('0x37')]);_0x3019f1[_0x415d('0x3c')]=_[_0x415d('0x3a')](_0x2d804b[_0x415d('0x36')],qs['fields'](_0x47e74d[_0x415d('0x37')][_0x415d('0x3b')]));_0x3019f1[_0x415d('0x3c')]=_0x3019f1[_0x415d('0x3c')]['length']?_0x3019f1[_0x415d('0x3c')]:_0x2d804b[_0x415d('0x36')];_0x3019f1[_0x415d('0x3d')]=qs[_0x415d('0x58')](_0x47e74d['query'][_0x415d('0x58')]);_0x3019f1[_0x415d('0x3e')]=qs[_0x415d('0x39')](_[_0x415d('0x59')](_0x47e74d[_0x415d('0x37')],_0x2d804b[_0x415d('0x39')]));if(_0x47e74d[_0x415d('0x37')][_0x415d('0x3f')]){_0x3019f1[_0x415d('0x3e')]=_[_0x415d('0x40')](_0x3019f1['where'],{'$or':_[_0x415d('0x30')](_0x3019f1[_0x415d('0x3c')],function(_0x144249){var _0x2a806d={};_0x2a806d[_0x144249]={'$like':'%'+_0x47e74d[_0x415d('0x37')][_0x415d('0x3f')]+'%'};return _0x2a806d;})});}_0x3019f1=_['merge']({},_0x3019f1,_0x47e74d[_0x415d('0x48')]);return _0x922d69[_0x415d('0x5b')](_0x3019f1);}})[_0x415d('0x28')](function(_0x569a57){if(_0x569a57){_0x3068ec=_0x569a57['length'];if(!_0x47e74d[_0x415d('0x37')][_0x415d('0x5c')](_0x415d('0x5a'))){_0x3019f1['limit']=qs[_0x415d('0x20')](_0x47e74d[_0x415d('0x37')]['limit']);_0x3019f1['offset']=qs['offset'](_0x47e74d[_0x415d('0x37')][_0x415d('0x21')]);}return _0x922d69[_0x415d('0x5b')](_0x3019f1);}})['then'](function(_0x20b272){if(_0x20b272){return _0x20b272?{'count':_0x3068ec,'rows':_0x20b272}:null;}})[_0x415d('0x28')](respondWithResult(_0x524bf4,null))[_0x415d('0x4a')](handleError(_0x524bf4,null));};exports[_0x415d('0x5d')]=function(_0x4b0d7e,_0x52a8da,_0xc1b579){if(_0x4b0d7e['body']['id']){delete _0x4b0d7e[_0x415d('0x4c')]['id'];}return db[_0x415d('0x31')][_0x415d('0x49')]({'where':{'id':_0x4b0d7e['params']['id']}})[_0x415d('0x28')](handleEntityNotFound(_0x52a8da,null))[_0x415d('0x28')](function(_0xb1efbb){if(_0xb1efbb){_0x4b0d7e[_0x415d('0x4c')][_0x415d('0x5e')]=_0xb1efbb['id'];return db[_0x415d('0x5f')][_0x415d('0x4b')](_0x4b0d7e[_0x415d('0x4c')]);}})[_0x415d('0x28')](respondWithResult(_0x52a8da,null))[_0x415d('0x4a')](handleError(_0x52a8da,null));};exports[_0x415d('0x60')]=function(_0x743caf,_0x30632e,_0x3f612f){var _0x2f0325={};var _0x2a57c5={};var _0xebfad;var _0xf391fc;return db[_0x415d('0x31')]['findOne']({'where':{'id':_0x743caf['params']['id']}})[_0x415d('0x28')](handleEntityNotFound(_0x30632e,null))[_0x415d('0x28')](function(_0x2491f1){if(_0x2491f1){_0xebfad=_0x2491f1;_0x2a57c5[_0x415d('0x36')]=_['keys'](db[_0x415d('0x5f')]['rawAttributes']);_0x2a57c5[_0x415d('0x37')]=_[_0x415d('0x38')](_0x743caf[_0x415d('0x37')]);_0x2a57c5[_0x415d('0x39')]=_[_0x415d('0x3a')](_0x2a57c5['model'],_0x2a57c5[_0x415d('0x37')]);_0x2f0325[_0x415d('0x3c')]=_['intersection'](_0x2a57c5[_0x415d('0x36')],qs[_0x415d('0x3b')](_0x743caf[_0x415d('0x37')]['fields']));_0x2f0325[_0x415d('0x3c')]=_0x2f0325['attributes']['length']?_0x2f0325[_0x415d('0x3c')]:_0x2a57c5[_0x415d('0x36')];_0x2f0325[_0x415d('0x3d')]=qs[_0x415d('0x58')](_0x743caf['query'][_0x415d('0x58')]);_0x2f0325[_0x415d('0x3e')]=qs['filters'](_[_0x415d('0x59')](_0x743caf['query'],_0x2a57c5[_0x415d('0x39')]));if(_0x743caf['query']['filter']){_0x2f0325['where']=_['merge'](_0x2f0325[_0x415d('0x3e')],{'$or':_['map'](_0x2f0325[_0x415d('0x3c')],function(_0x3b34e0){var _0x1731a5={};_0x1731a5[_0x3b34e0]={'$like':'%'+_0x743caf[_0x415d('0x37')][_0x415d('0x3f')]+'%'};return _0x1731a5;})});}_0x2f0325=_[_0x415d('0x40')]({},_0x2f0325,_0x743caf['options']);return _0xebfad[_0x415d('0x60')](_0x2f0325);}})[_0x415d('0x28')](function(_0x2eaddc){if(_0x2eaddc){_0xf391fc=_0x2eaddc[_0x415d('0x47')];if(!_0x743caf['query'][_0x415d('0x5c')]('nolimit')){_0x2f0325['limit']=qs[_0x415d('0x20')](_0x743caf[_0x415d('0x37')][_0x415d('0x20')]);_0x2f0325[_0x415d('0x21')]=qs[_0x415d('0x21')](_0x743caf[_0x415d('0x37')][_0x415d('0x21')]);}return _0xebfad[_0x415d('0x60')](_0x2f0325);}})[_0x415d('0x28')](function(_0x52359b){if(_0x52359b){return _0x52359b?{'count':_0xf391fc,'rows':_0x52359b}:null;}})['then'](respondWithResult(_0x30632e,null))[_0x415d('0x4a')](handleError(_0x30632e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5d3ab7d..0d90065 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 _0xacfe=['tools_triggers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x221797,_0x22992b){var _0x1f7672=function(_0x39fca1){while(--_0x39fca1){_0x221797['push'](_0x221797['shift']());}};_0x1f7672(++_0x22992b);}(_0xacfe,0xfd));var _0xeacf=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xacfe[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('Trigger',attributes,{'tableName':_0xeacf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x956a=['request-promise','path','rimraf','exports','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x22136d,_0x4c9f22){var _0x49397d=function(_0x354b01){while(--_0x354b01){_0x22136d['push'](_0x22136d['shift']());}};_0x49397d(++_0x4c9f22);}(_0x956a,0xb6));var _0xa956=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x956a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa956('0x0'));var logger=require(_0xa956('0x1'))(_0xa956('0x2'));var moment=require(_0xa956('0x3'));var BPromise=require(_0xa956('0x4'));var rp=require(_0xa956('0x5'));var fs=require('fs');var path=require(_0xa956('0x6'));var rimraf=require(_0xa956('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xa956('0x8')]=function(_0x2b9675,_0x2ce2c8){return _0x2b9675['define'](_0xa956('0x9'),attributes,{'tableName':_0xa956('0xa'),'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 6b114a3..f8dd9c9 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 _0x5294=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','ShowTrigger','find','util','moment','bluebird','randomstring'];(function(_0x273f88,_0x5d4150){var _0x177ca1=function(_0xf46ec4){while(--_0xf46ec4){_0x273f88['push'](_0x273f88['shift']());}};_0x177ca1(++_0x5d4150);}(_0x5294,0xda));var _0x4529=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5294[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x4529('0x0'));var moment=require(_0x4529('0x1'));var BPromise=require(_0x4529('0x2'));var rs=require(_0x4529('0x3'));var fs=require('fs');var Redis=require(_0x4529('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4529('0x5'));var logger=require(_0x4529('0x6'))(_0x4529('0x7'));var config=require(_0x4529('0x8'));var jayson=require(_0x4529('0x9'));var client=jayson[_0x4529('0xa')][_0x4529('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xda0494,_0x426052,_0x11ea1c){return new BPromise(function(_0x51f2ff,_0x5d173f){return client[_0x4529('0xc')](_0xda0494,_0x11ea1c)[_0x4529('0xd')](function(_0x56e385){logger[_0x4529('0xe')](_0x4529('0xf'),_0x426052,_0x4529('0x10'));logger[_0x4529('0x11')](_0x4529('0x12'),_0x426052,_0x4529('0x10'),JSON[_0x4529('0x13')](_0x56e385));if(_0x56e385[_0x4529('0x14')]){if(_0x56e385[_0x4529('0x14')][_0x4529('0x15')]===0x1f4){logger[_0x4529('0x14')](_0x4529('0xf'),_0x426052,_0x56e385['error'][_0x4529('0x16')]);return _0x5d173f(_0x56e385[_0x4529('0x14')][_0x4529('0x16')]);}logger[_0x4529('0x14')](_0x4529('0xf'),_0x426052,_0x56e385[_0x4529('0x14')]['message']);return _0x51f2ff(_0x56e385['error'][_0x4529('0x16')]);}else{logger[_0x4529('0xe')](_0x4529('0xf'),_0x426052,_0x4529('0x10'));_0x51f2ff(_0x56e385[_0x4529('0x17')][_0x4529('0x16')]);}})[_0x4529('0x18')](function(_0x2adc46){logger['error'](_0x4529('0xf'),_0x426052,_0x2adc46);_0x5d173f(_0x2adc46);});});}exports[_0x4529('0x19')]=function(_0x44c39f){var _0x2ac276=this;return new Promise(function(_0x1ef91b,_0x519f5e){return db[_0x4529('0x1a')]['findAll']({'raw':_0x44c39f[_0x4529('0x1b')]?_0x44c39f[_0x4529('0x1b')][_0x4529('0x1c')]===undefined?!![]:![]:!![],'where':_0x44c39f[_0x4529('0x1b')]?_0x44c39f[_0x4529('0x1b')][_0x4529('0x1d')]||null:null,'attributes':_0x44c39f[_0x4529('0x1b')]?_0x44c39f[_0x4529('0x1b')][_0x4529('0x1e')]||null:null,'limit':_0x44c39f[_0x4529('0x1b')]?_0x44c39f[_0x4529('0x1b')][_0x4529('0x1f')]||null:null,'include':_0x44c39f[_0x4529('0x1b')]?_0x44c39f[_0x4529('0x1b')][_0x4529('0x20')]?_['map'](_0x44c39f['options'][_0x4529('0x20')],function(_0x576a6f){return{'model':db[_0x576a6f[_0x4529('0x21')]],'as':_0x576a6f['as'],'attributes':_0x576a6f['attributes'],'include':_0x576a6f[_0x4529('0x20')]?_[_0x4529('0x22')](_0x576a6f[_0x4529('0x20')],function(_0x42d2de){return{'model':db[_0x42d2de[_0x4529('0x21')]],'as':_0x42d2de['as'],'attributes':_0x42d2de[_0x4529('0x1e')],'include':_0x42d2de[_0x4529('0x20')]?_[_0x4529('0x22')](_0x42d2de[_0x4529('0x20')],function(_0x24b5c9){return{'model':db[_0x24b5c9[_0x4529('0x21')]],'as':_0x24b5c9['as'],'attributes':_0x24b5c9[_0x4529('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4529('0xd')](function(_0x6a854c){logger[_0x4529('0xe')]('GetTrigger',_0x44c39f);logger[_0x4529('0x11')](_0x4529('0x19'),_0x44c39f,JSON[_0x4529('0x13')](_0x6a854c));_0x1ef91b(_0x6a854c);})['catch'](function(_0x329e62){logger[_0x4529('0x14')]('GetTrigger',_0x329e62[_0x4529('0x16')],_0x44c39f);_0x519f5e(_0x2ac276[_0x4529('0x14')](0x1f4,_0x329e62[_0x4529('0x16')]));});});};exports[_0x4529('0x23')]=function(_0x3202ee){var _0x3a4793=this;return new Promise(function(_0xcb28ec,_0x22711c){return db['Trigger'][_0x4529('0x24')]({'raw':_0x3202ee[_0x4529('0x1b')]?_0x3202ee[_0x4529('0x1b')][_0x4529('0x1c')]===undefined?!![]:![]:!![],'where':_0x3202ee[_0x4529('0x1b')]?_0x3202ee[_0x4529('0x1b')][_0x4529('0x1d')]||null:null,'attributes':_0x3202ee[_0x4529('0x1b')]?_0x3202ee[_0x4529('0x1b')][_0x4529('0x1e')]||null:null,'include':_0x3202ee['options']?_0x3202ee['options'][_0x4529('0x20')]?_[_0x4529('0x22')](_0x3202ee[_0x4529('0x1b')]['include'],function(_0x43cf04){return{'model':db[_0x43cf04[_0x4529('0x21')]],'as':_0x43cf04['as'],'attributes':_0x43cf04[_0x4529('0x1e')],'include':_0x43cf04[_0x4529('0x20')]?_[_0x4529('0x22')](_0x43cf04[_0x4529('0x20')],function(_0x7a3095){return{'model':db[_0x7a3095[_0x4529('0x21')]],'as':_0x7a3095['as'],'attributes':_0x7a3095[_0x4529('0x1e')],'include':_0x7a3095[_0x4529('0x20')]?_[_0x4529('0x22')](_0x7a3095['include'],function(_0x123eec){return{'model':db[_0x123eec[_0x4529('0x21')]],'as':_0x123eec['as'],'attributes':_0x123eec[_0x4529('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4529('0xd')](function(_0x48530c){logger[_0x4529('0xe')]('ShowTrigger',_0x3202ee);logger['debug'](_0x4529('0x23'),_0x3202ee,JSON[_0x4529('0x13')](_0x48530c));_0xcb28ec(_0x48530c);})[_0x4529('0x18')](function(_0x453603){logger[_0x4529('0x14')](_0x4529('0x23'),_0x453603['message'],_0x3202ee);_0x22711c(_0x3a4793['error'](0x1f4,_0x453603[_0x4529('0x16')]));});});}; \ No newline at end of file +var _0xab67=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','lodash','util','moment','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xab67,0x1f4));var _0x7ab6=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0xab67[_0x214d54];return _0x44ca46;};'use strict';var _=require(_0x7ab6('0x0'));var util=require(_0x7ab6('0x1'));var moment=require(_0x7ab6('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ab6('0x3'));var fs=require('fs');var Redis=require(_0x7ab6('0x4'));var db=require(_0x7ab6('0x5'))['db'];var utils=require(_0x7ab6('0x6'));var logger=require(_0x7ab6('0x7'))(_0x7ab6('0x8'));var config=require(_0x7ab6('0x9'));var jayson=require(_0x7ab6('0xa'));var client=jayson[_0x7ab6('0xb')][_0x7ab6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x327de2,_0x4541c9,_0x4eab16){return new BPromise(function(_0x4eb032,_0x56137b){return client['request'](_0x327de2,_0x4eab16)[_0x7ab6('0xd')](function(_0x525da8){logger['info'](_0x7ab6('0xe'),_0x4541c9,'request\x20sent');logger[_0x7ab6('0xf')](_0x7ab6('0x10'),_0x4541c9,_0x7ab6('0x11'),JSON[_0x7ab6('0x12')](_0x525da8));if(_0x525da8[_0x7ab6('0x13')]){if(_0x525da8[_0x7ab6('0x13')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x4541c9,_0x525da8[_0x7ab6('0x13')][_0x7ab6('0x14')]);return _0x56137b(_0x525da8[_0x7ab6('0x13')][_0x7ab6('0x14')]);}logger[_0x7ab6('0x13')]('Trigger,\x20%s,\x20%s',_0x4541c9,_0x525da8[_0x7ab6('0x13')][_0x7ab6('0x14')]);return _0x4eb032(_0x525da8['error'][_0x7ab6('0x14')]);}else{logger[_0x7ab6('0x15')](_0x7ab6('0xe'),_0x4541c9,_0x7ab6('0x11'));_0x4eb032(_0x525da8[_0x7ab6('0x16')][_0x7ab6('0x14')]);}})[_0x7ab6('0x17')](function(_0x26328e){logger[_0x7ab6('0x13')](_0x7ab6('0xe'),_0x4541c9,_0x26328e);_0x56137b(_0x26328e);});});}exports['GetTrigger']=function(_0x4efb7f){var _0x199d3c=this;return new Promise(function(_0x244980,_0x29146e){return db[_0x7ab6('0x18')][_0x7ab6('0x19')]({'raw':_0x4efb7f[_0x7ab6('0x1a')]?_0x4efb7f[_0x7ab6('0x1a')][_0x7ab6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4efb7f[_0x7ab6('0x1a')]?_0x4efb7f[_0x7ab6('0x1a')][_0x7ab6('0x1c')]||null:null,'attributes':_0x4efb7f['options']?_0x4efb7f[_0x7ab6('0x1a')][_0x7ab6('0x1d')]||null:null,'limit':_0x4efb7f[_0x7ab6('0x1a')]?_0x4efb7f['options'][_0x7ab6('0x1e')]||null:null,'include':_0x4efb7f[_0x7ab6('0x1a')]?_0x4efb7f['options'][_0x7ab6('0x1f')]?_[_0x7ab6('0x20')](_0x4efb7f[_0x7ab6('0x1a')][_0x7ab6('0x1f')],function(_0x35f3b6){return{'model':db[_0x35f3b6['model']],'as':_0x35f3b6['as'],'attributes':_0x35f3b6[_0x7ab6('0x1d')],'include':_0x35f3b6[_0x7ab6('0x1f')]?_[_0x7ab6('0x20')](_0x35f3b6['include'],function(_0x5dc2c7){return{'model':db[_0x5dc2c7[_0x7ab6('0x21')]],'as':_0x5dc2c7['as'],'attributes':_0x5dc2c7['attributes'],'include':_0x5dc2c7[_0x7ab6('0x1f')]?_[_0x7ab6('0x20')](_0x5dc2c7[_0x7ab6('0x1f')],function(_0x2fc5a8){return{'model':db[_0x2fc5a8[_0x7ab6('0x21')]],'as':_0x2fc5a8['as'],'attributes':_0x2fc5a8[_0x7ab6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7ab6('0xd')](function(_0x41e682){logger[_0x7ab6('0x15')](_0x7ab6('0x22'),_0x4efb7f);logger[_0x7ab6('0xf')](_0x7ab6('0x22'),_0x4efb7f,JSON['stringify'](_0x41e682));_0x244980(_0x41e682);})['catch'](function(_0x518e2c){logger['error'](_0x7ab6('0x22'),_0x518e2c[_0x7ab6('0x14')],_0x4efb7f);_0x29146e(_0x199d3c['error'](0x1f4,_0x518e2c[_0x7ab6('0x14')]));});});};exports[_0x7ab6('0x23')]=function(_0x4a306f){var _0xcb467e=this;return new Promise(function(_0x262345,_0x2ce9d4){return db[_0x7ab6('0x18')]['find']({'raw':_0x4a306f[_0x7ab6('0x1a')]?_0x4a306f['options'][_0x7ab6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a306f['options']?_0x4a306f[_0x7ab6('0x1a')]['where']||null:null,'attributes':_0x4a306f[_0x7ab6('0x1a')]?_0x4a306f[_0x7ab6('0x1a')][_0x7ab6('0x1d')]||null:null,'include':_0x4a306f[_0x7ab6('0x1a')]?_0x4a306f[_0x7ab6('0x1a')][_0x7ab6('0x1f')]?_[_0x7ab6('0x20')](_0x4a306f[_0x7ab6('0x1a')][_0x7ab6('0x1f')],function(_0x22af90){return{'model':db[_0x22af90[_0x7ab6('0x21')]],'as':_0x22af90['as'],'attributes':_0x22af90['attributes'],'include':_0x22af90['include']?_[_0x7ab6('0x20')](_0x22af90[_0x7ab6('0x1f')],function(_0x41ad74){return{'model':db[_0x41ad74[_0x7ab6('0x21')]],'as':_0x41ad74['as'],'attributes':_0x41ad74[_0x7ab6('0x1d')],'include':_0x41ad74['include']?_['map'](_0x41ad74[_0x7ab6('0x1f')],function(_0x136464){return{'model':db[_0x136464[_0x7ab6('0x21')]],'as':_0x136464['as'],'attributes':_0x136464[_0x7ab6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7ab6('0xd')](function(_0x279f75){logger[_0x7ab6('0x15')](_0x7ab6('0x23'),_0x4a306f);logger[_0x7ab6('0xf')]('ShowTrigger',_0x4a306f,JSON[_0x7ab6('0x12')](_0x279f75));_0x262345(_0x279f75);})[_0x7ab6('0x17')](function(_0x5b7640){logger['error'](_0x7ab6('0x23'),_0x5b7640[_0x7ab6('0x14')],_0x4a306f);_0x2ce9d4(_0xcb467e[_0x7ab6('0x13')](0x1f4,_0x5b7640[_0x7ab6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8e347ab..fd64092 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 _0x1659=['post','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show'];(function(_0x370650,_0x5cbc15){var _0x3e008a=function(_0x2e263e){while(--_0x2e263e){_0x370650['push'](_0x370650['shift']());}};_0x3e008a(++_0x5cbc15);}(_0x1659,0x18f));var _0x9165=function(_0x407f2a,_0x2ecf2c){_0x407f2a=_0x407f2a-0x0;var _0x38a01b=_0x1659[_0x407f2a];return _0x38a01b;};'use strict';var multer=require(_0x9165('0x0'));var util=require(_0x9165('0x1'));var path=require(_0x9165('0x2'));var timeout=require(_0x9165('0x3'));var express=require(_0x9165('0x4'));var router=express['Router']();var fs_extra=require(_0x9165('0x5'));var auth=require(_0x9165('0x6'));var interaction=require(_0x9165('0x7'));var config=require(_0x9165('0x8'));var controller=require(_0x9165('0x9'));router['get']('/',auth[_0x9165('0xa')](),controller[_0x9165('0xb')]);router[_0x9165('0xc')](_0x9165('0xd'),auth[_0x9165('0xa')](),controller[_0x9165('0xe')]);router[_0x9165('0xf')]('/:id/clone',auth[_0x9165('0xa')](),controller[_0x9165('0x10')]);router[_0x9165('0xf')]('/',auth[_0x9165('0xa')](),controller[_0x9165('0x11')]);router[_0x9165('0x12')](_0x9165('0xd'),auth[_0x9165('0xa')](),controller[_0x9165('0x13')]);router[_0x9165('0x14')](_0x9165('0xd'),auth[_0x9165('0xa')](),controller[_0x9165('0x15')]);module[_0x9165('0x16')]=router; \ No newline at end of file +var _0xab97=['index','/:id','show','post','clone','isAuthenticated','create','put','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./trunk.controller','get'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xab97,0x190));var _0x7ab9=function(_0x5efde4,_0x131166){_0x5efde4=_0x5efde4-0x0;var _0x1e5abd=_0xab97[_0x5efde4];return _0x1e5abd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7ab9('0x0'));var timeout=require(_0x7ab9('0x1'));var express=require(_0x7ab9('0x2'));var router=express[_0x7ab9('0x3')]();var fs_extra=require(_0x7ab9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7ab9('0x5'));var config=require('../../config/environment');var controller=require(_0x7ab9('0x6'));router[_0x7ab9('0x7')]('/',auth['isAuthenticated'](),controller[_0x7ab9('0x8')]);router[_0x7ab9('0x7')](_0x7ab9('0x9'),auth['isAuthenticated'](),controller[_0x7ab9('0xa')]);router[_0x7ab9('0xb')]('/:id/clone',auth['isAuthenticated'](),controller[_0x7ab9('0xc')]);router[_0x7ab9('0xb')]('/',auth[_0x7ab9('0xd')](),controller[_0x7ab9('0xe')]);router[_0x7ab9('0xf')](_0x7ab9('0x9'),auth[_0x7ab9('0xd')](),controller['update']);router['delete'](_0x7ab9('0x9'),auth[_0x7ab9('0xd')](),controller[_0x7ab9('0x10')]);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 1965f62..27fc4a6 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 _0x66cb=['port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow'];(function(_0x4f469c,_0x20bc35){var _0x44740d=function(_0x183dc1){while(--_0x183dc1){_0x4f469c['push'](_0x4f469c['shift']());}};_0x44740d(++_0x20bc35);}(_0x66cb,0x1dc));var _0xb66c=function(_0x19ca40,_0x26047f){_0x19ca40=_0x19ca40-0x0;var _0x5df865=_0x66cb[_0x19ca40];return _0x5df865;};'use strict';var Sequelize=require(_0xb66c('0x0'));module[_0xb66c('0x1')]={'name':{'type':Sequelize[_0xb66c('0x2')],'allowNull':![],'unique':_0xb66c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xb66c('0x4'),_0xb66c('0x5'),'peer'),'allowNull':![],'defaultValue':_0xb66c('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb66c('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0xb66c('0x7'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xb66c('0x8'),_0xb66c('0x9'),_0xb66c('0xa'),_0xb66c('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xb66c('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xb66c('0x2')]},'md5secret':{'type':Sequelize[_0xb66c('0x2')]},'remotesecret':{'type':Sequelize[_0xb66c('0x2')]},'transport':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':_0xb66c('0xc'),'set':function(_0x344305){this[_0xb66c('0xd')](_0xb66c('0xe'),_0x344305?_0x344305[_0xb66c('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xb66c('0x10')](_0xb66c('0xe'))['split'](','):null;},'comment':_0xb66c('0x11')},'dtmfmode':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x13'),_0xb66c('0x14'),_0xb66c('0x15'),_0xb66c('0x16'),_0xb66c('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xb66c('0x18'),'no',_0xb66c('0x19'),_0xb66c('0x1a'),_0xb66c('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xb66c('0x1c'),'set':function(_0x28ca69){this['setDataValue'](_0xb66c('0x1d'),_0x28ca69?_0x28ca69[_0xb66c('0xf')](','):null);},'get':function(){return this[_0xb66c('0x10')]('nat')?this[_0xb66c('0x10')](_0xb66c('0x1d'))[_0xb66c('0x1e')](','):null;},'comment':_0xb66c('0x1f')},'callgroup':{'type':Sequelize[_0xb66c('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb66c('0x2')]},'pickupgroup':{'type':Sequelize[_0xb66c('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb66c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xb66c('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2ad727){this[_0xb66c('0xd')]('allow',_0x2ad727?_0x2ad727[_0xb66c('0xf')](';'):_0xb66c('0x20'));},'get':function(){return this[_0xb66c('0x10')](_0xb66c('0x21'))?this[_0xb66c('0x10')](_0xb66c('0x21'))[_0xb66c('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'insecure':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':_0xb66c('0x22'),'set':function(_0x385f20){this[_0xb66c('0xd')](_0xb66c('0x23'),_0x385f20?_0x385f20[_0xb66c('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xb66c('0x23'))?this[_0xb66c('0x10')](_0xb66c('0x23'))[_0xb66c('0x1e')](','):null;},'comment':_0xb66c('0x24')},'trustrpid':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb66c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xb66c('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xb66c('0x12')]('yes','no')},'accountcode':{'type':Sequelize[_0xb66c('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb66c('0x2')]},'callcounter':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no'),'defaultValue':_0xb66c('0x18')},'busylevel':{'type':Sequelize[_0xb66c('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xb66c('0x12')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xb66c('0x12')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xb66c('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xb66c('0x2')]},'template':{'type':Sequelize[_0xb66c('0x2')]},'videosupport':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no',_0xb66c('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb66c('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'mailbox':{'type':Sequelize[_0xb66c('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xb66c('0x27'),_0xb66c('0x28'),_0xb66c('0x29'))},'session_expires':{'type':Sequelize[_0xb66c('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xb66c('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x2a'),_0xb66c('0x2b')),'defaultValue':_0xb66c('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xb66c('0x2')]},'regexten':{'type':Sequelize[_0xb66c('0x2')]},'fromdomain':{'type':Sequelize[_0xb66c('0x2')]},'fromuser':{'type':Sequelize[_0xb66c('0x2')]},'port':{'type':Sequelize[_0xb66c('0x25')](0x5)},'qualify':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xb66c('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xb66c('0x2')]},'defaultuser':{'type':Sequelize[_0xb66c('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb66c('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb66c('0x2')]},'callbackextension':{'type':Sequelize[_0xb66c('0x2')]},'timert1':{'type':Sequelize[_0xb66c('0x25')](0xb)},'timerb':{'type':Sequelize[_0xb66c('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb66c('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xb66c('0x2')]},'contactacl':{'type':Sequelize[_0xb66c('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xb66c('0x12')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb66c('0x12')]('yes','no')},'force_avp':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'icesupport':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xb66c('0x18'),'no',_0xb66c('0x2c'),_0xb66c('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xb66c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xb66c('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xb66c('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xb66c('0x2e'),'passive',_0xb66c('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb66c('0x2')]},'usereqphone':{'type':Sequelize[_0xb66c('0x12')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb66c('0x2')]},'recordofffeature':{'type':Sequelize[_0xb66c('0x2')]},'call_limit':{'type':Sequelize[_0xb66c('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb66c('0x12')](_0xb66c('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xb66c('0x12')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xb66c('0x2')]},'description':{'type':Sequelize[_0xb66c('0x2')]},'host':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':_0xb66c('0x30')},'canreinvite':{'type':Sequelize[_0xb66c('0x12')]('yes','no','nonat',_0xb66c('0x1a'),_0xb66c('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb66c('0x2')]},'otherFields':{'type':Sequelize[_0xb66c('0x2')]},'active':{'type':Sequelize[_0xb66c('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xb66c('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6594=['always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','setDataValue','nat','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER'];(function(_0xb4ebea,_0x55e3ab){var _0x95e734=function(_0x6a6150){while(--_0x6a6150){_0xb4ebea['push'](_0xb4ebea['shift']());}};_0x95e734(++_0x55e3ab);}(_0x6594,0x17b));var _0x4659=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x6594[_0x53fe97];return _0x5c49a2;};'use strict';var Sequelize=require(_0x4659('0x0'));module[_0x4659('0x1')]={'name':{'type':Sequelize[_0x4659('0x2')],'allowNull':![],'unique':_0x4659('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x4659('0x5')},'context':{'type':Sequelize[_0x4659('0x2')],'allowNull':![],'defaultValue':_0x4659('0x6')},'callingpres':{'type':Sequelize[_0x4659('0x4')]('ALLOWED_NOT_SCREENED',_0x4659('0x7'),_0x4659('0x8'),_0x4659('0x9'),_0x4659('0xa'),_0x4659('0xb'),'PROHIB_FAILED_SCREEN',_0x4659('0xc'))},'deny':{'type':Sequelize[_0x4659('0x2')]},'permit':{'type':Sequelize[_0x4659('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x4659('0x2')]},'remotesecret':{'type':Sequelize[_0x4659('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x17b469){this['setDataValue'](_0x4659('0xd'),_0x17b469?_0x17b469[_0x4659('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4659('0xd'))?this[_0x4659('0xf')](_0x4659('0xd'))[_0x4659('0x10')](','):null;},'comment':_0x4659('0x11')},'dtmfmode':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x12'),_0x4659('0x13'),_0x4659('0x14'),_0x4659('0x15'),_0x4659('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no',_0x4659('0x18'),'update',_0x4659('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x4659('0x2')]},'nat':{'type':Sequelize[_0x4659('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xfc77bd){this[_0x4659('0x1a')](_0x4659('0x1b'),_0xfc77bd?_0xfc77bd['join'](','):null);},'get':function(){return this['getDataValue'](_0x4659('0x1b'))?this[_0x4659('0xf')](_0x4659('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4659('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4659('0x2')]},'pickupgroup':{'type':Sequelize[_0x4659('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4659('0x2')]},'language':{'type':Sequelize[_0x4659('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4659('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4659('0x2')],'defaultValue':_0x4659('0x1c')},'allow':{'type':Sequelize[_0x4659('0x2')],'allowNull':![],'defaultValue':_0x4659('0x1d'),'set':function(_0xa3c8cc){this[_0x4659('0x1a')]('allow',_0xa3c8cc?_0xa3c8cc[_0x4659('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4659('0xf')](_0x4659('0x1e'))?this[_0x4659('0xf')](_0x4659('0x1e'))[_0x4659('0x10')](';'):null;},'comment':_0x4659('0x1f')},'autoframing':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'insecure':{'type':Sequelize[_0x4659('0x2')],'defaultValue':_0x4659('0x20'),'set':function(_0xca7acb){this[_0x4659('0x1a')](_0x4659('0x21'),_0xca7acb?_0xca7acb[_0x4659('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4659('0x21'))?this[_0x4659('0xf')](_0x4659('0x21'))['split'](','):null;},'comment':_0x4659('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no',_0x4659('0x23'))},'promiscredir':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4659('0x24')](0xb)},'setvar':{'type':Sequelize[_0x4659('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x4659('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no'),'defaultValue':_0x4659('0x17')},'busylevel':{'type':Sequelize[_0x4659('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x4659('0x2')]},'template':{'type':Sequelize[_0x4659('0x2')]},'videosupport':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no',_0x4659('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4659('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no')},'mailbox':{'type':Sequelize[_0x4659('0x2')]},'session_timers':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x26'),_0x4659('0x27'),_0x4659('0x28'))},'session_expires':{'type':Sequelize[_0x4659('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x29'),_0x4659('0x2a')),'defaultValue':_0x4659('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x4659('0x2')]},'fromdomain':{'type':Sequelize[_0x4659('0x2')]},'fromuser':{'type':Sequelize[_0x4659('0x2')]},'port':{'type':Sequelize[_0x4659('0x24')](0x5)},'qualify':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no'),'defaultValue':_0x4659('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x4659('0x2')]},'defaultuser':{'type':Sequelize[_0x4659('0x2')]},'rtptimeout':{'type':Sequelize[_0x4659('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4659('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4659('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4659('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4659('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x4659('0x2')]},'contactdeny':{'type':Sequelize[_0x4659('0x2')]},'contactacl':{'type':Sequelize[_0x4659('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4659('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4659('0x2')]},'maxforwards':{'type':Sequelize[_0x4659('0x24')](0xb)},'encryption':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4659('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no',_0x4659('0x2b'),_0x4659('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x4659('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4659('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x4659('0x2')]},'dtlscipher':{'type':Sequelize[_0x4659('0x2')]},'dtlscafile':{'type':Sequelize[_0x4659('0x2')]},'dtlscapath':{'type':Sequelize[_0x4659('0x2')]},'dtlssetup':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x2d'),_0x4659('0x2e'),_0x4659('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4659('0x2')]},'usereqphone':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x4659('0x2')]},'call_limit':{'type':Sequelize[_0x4659('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4659('0x2')]},'mohinterpret':{'type':Sequelize[_0x4659('0x2')]},'mohsuggest':{'type':Sequelize[_0x4659('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4659('0x2')]},'host':{'type':Sequelize[_0x4659('0x2')],'defaultValue':_0x4659('0x30')},'canreinvite':{'type':Sequelize[_0x4659('0x4')](_0x4659('0x17'),'no','nonat',_0x4659('0x31'),_0x4659('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4659('0x2')]},'otherFields':{'type':Sequelize[_0x4659('0x2')]},'active':{'type':Sequelize[_0x4659('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4659('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index a92b4d4..39356d5 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 _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0xb0054f,_0x4f806d){var _0x4ebdff=function(_0x16b3cb){while(--_0x16b3cb){_0xb0054f['push'](_0xb0054f['shift']());}};_0x4ebdff(++_0x4f806d);}(_0xa41a,0x6b));var _0xaa41=function(_0x2938f5,_0x5a8384){_0x2938f5=_0x2938f5-0x0;var _0x8d093c=_0xa41a[_0x2938f5];return _0x8d093c;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file +var _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x84ab,0x12f));var _0xb84a=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x84ab[_0x1ba43c];return _0x2f60eb;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index cba0ee8..0929d54 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 _0x08d7=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x08d7,0x11e));var _0x708d=function(_0x741427,_0x21fe4c){_0x741427=_0x741427-0x0;var _0x5e0a59=_0x08d7[_0x741427];return _0x5e0a59;};'use strict';var _=require(_0x708d('0x0'));var util=require(_0x708d('0x1'));var logger=require(_0x708d('0x2'))('api');var moment=require(_0x708d('0x3'));var BPromise=require('bluebird');var rp=require(_0x708d('0x4'));var fs=require('fs');var path=require(_0x708d('0x5'));var rimraf=require('rimraf');var config=require(_0x708d('0x6'));var attributes=require(_0x708d('0x7'));module['exports']=function(_0x46c5ef,_0x1df767){return _0x46c5ef[_0x708d('0x8')](_0x708d('0x9'),attributes,{'tableName':_0x708d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c8c=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x3231b6,_0x1b492a){var _0x18b738=function(_0x25e9df){while(--_0x25e9df){_0x3231b6['push'](_0x3231b6['shift']());}};_0x18b738(++_0x1b492a);}(_0x0c8c,0x1b4));var _0xc0c8=function(_0x50c813,_0x45b260){_0x50c813=_0x50c813-0x0;var _0x1515ad=_0x0c8c[_0x50c813];return _0x1515ad;};'use strict';var _=require(_0xc0c8('0x0'));var util=require(_0xc0c8('0x1'));var logger=require(_0xc0c8('0x2'))(_0xc0c8('0x3'));var moment=require(_0xc0c8('0x4'));var BPromise=require(_0xc0c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0c8('0x6'));var rimraf=require(_0xc0c8('0x7'));var config=require(_0xc0c8('0x8'));var attributes=require(_0xc0c8('0x9'));module[_0xc0c8('0xa')]=function(_0x427ab5,_0x4efaa1){return _0x427ab5[_0xc0c8('0xb')](_0xc0c8('0xc'),attributes,{'tableName':_0xc0c8('0xd'),'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 d44e0a9..baa5172 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 _0x4ec7=['raw','where','attributes','include','map','model','ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options'];(function(_0x302a6f,_0x483a07){var _0x1ca2ea=function(_0x45e71e){while(--_0x45e71e){_0x302a6f['push'](_0x302a6f['shift']());}};_0x1ca2ea(++_0x483a07);}(_0x4ec7,0xb8));var _0x74ec=function(_0x351b79,_0xde37c9){_0x351b79=_0x351b79-0x0;var _0x13b9e4=_0x4ec7[_0x351b79];return _0x13b9e4;};'use strict';var _=require(_0x74ec('0x0'));var util=require(_0x74ec('0x1'));var moment=require(_0x74ec('0x2'));var BPromise=require(_0x74ec('0x3'));var rs=require(_0x74ec('0x4'));var fs=require('fs');var Redis=require(_0x74ec('0x5'));var db=require(_0x74ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x74ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74ec('0x8')][_0x74ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29ce2d,_0x4cf42e,_0x235d6e){return new BPromise(function(_0xf905a0,_0x29fdc2){return client[_0x74ec('0xa')](_0x29ce2d,_0x235d6e)[_0x74ec('0xb')](function(_0x33bf27){logger[_0x74ec('0xc')]('Trunk,\x20%s,\x20%s',_0x4cf42e,_0x74ec('0xd'));logger[_0x74ec('0xe')](_0x74ec('0xf'),_0x4cf42e,_0x74ec('0xd'),JSON[_0x74ec('0x10')](_0x33bf27));if(_0x33bf27['error']){if(_0x33bf27[_0x74ec('0x11')][_0x74ec('0x12')]===0x1f4){logger[_0x74ec('0x11')]('Trunk,\x20%s,\x20%s',_0x4cf42e,_0x33bf27['error'][_0x74ec('0x13')]);return _0x29fdc2(_0x33bf27['error']['message']);}logger[_0x74ec('0x11')]('Trunk,\x20%s,\x20%s',_0x4cf42e,_0x33bf27[_0x74ec('0x11')][_0x74ec('0x13')]);return _0xf905a0(_0x33bf27['error']['message']);}else{logger[_0x74ec('0xc')](_0x74ec('0x14'),_0x4cf42e,_0x74ec('0xd'));_0xf905a0(_0x33bf27[_0x74ec('0x15')][_0x74ec('0x13')]);}})[_0x74ec('0x16')](function(_0x6a3111){logger[_0x74ec('0x11')](_0x74ec('0x14'),_0x4cf42e,_0x6a3111);_0x29fdc2(_0x6a3111);});});}exports[_0x74ec('0x17')]=function(_0x46f1f9){var _0x2bcfbd=this;return new Promise(function(_0x4c1ad5,_0x231f25){return db['Trunk'][_0x74ec('0x18')]({'raw':_0x46f1f9[_0x74ec('0x19')]?_0x46f1f9[_0x74ec('0x19')][_0x74ec('0x1a')]===undefined?!![]:![]:!![],'where':_0x46f1f9[_0x74ec('0x19')]?_0x46f1f9[_0x74ec('0x19')][_0x74ec('0x1b')]||null:null,'attributes':_0x46f1f9[_0x74ec('0x19')]?_0x46f1f9[_0x74ec('0x19')][_0x74ec('0x1c')]||null:null,'limit':_0x46f1f9[_0x74ec('0x19')]?_0x46f1f9['options']['limit']||null:null,'include':_0x46f1f9[_0x74ec('0x19')]?_0x46f1f9['options'][_0x74ec('0x1d')]?_[_0x74ec('0x1e')](_0x46f1f9['options'][_0x74ec('0x1d')],function(_0xcd81e7){return{'model':db[_0xcd81e7[_0x74ec('0x1f')]],'as':_0xcd81e7['as'],'attributes':_0xcd81e7[_0x74ec('0x1c')],'include':_0xcd81e7[_0x74ec('0x1d')]?_[_0x74ec('0x1e')](_0xcd81e7[_0x74ec('0x1d')],function(_0x3f8acb){return{'model':db[_0x3f8acb[_0x74ec('0x1f')]],'as':_0x3f8acb['as'],'attributes':_0x3f8acb[_0x74ec('0x1c')],'include':_0x3f8acb['include']?_[_0x74ec('0x1e')](_0x3f8acb[_0x74ec('0x1d')],function(_0x39bc5b){return{'model':db[_0x39bc5b[_0x74ec('0x1f')]],'as':_0x39bc5b['as'],'attributes':_0x39bc5b[_0x74ec('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb81cab){logger[_0x74ec('0xc')](_0x74ec('0x17'),_0x46f1f9);logger['debug'](_0x74ec('0x17'),_0x46f1f9,JSON['stringify'](_0xb81cab));_0x4c1ad5(_0xb81cab);})[_0x74ec('0x16')](function(_0x1bfb98){logger[_0x74ec('0x11')]('GetTrunk',_0x1bfb98[_0x74ec('0x13')],_0x46f1f9);_0x231f25(_0x2bcfbd[_0x74ec('0x11')](0x1f4,_0x1bfb98[_0x74ec('0x13')]));});});};exports[_0x74ec('0x20')]=function(_0x4c4ed2){var _0x1c5831=this;return new Promise(function(_0x40bc7e,_0x11bd15){return db[_0x74ec('0x21')][_0x74ec('0x22')]({'raw':_0x4c4ed2[_0x74ec('0x19')]?_0x4c4ed2['options'][_0x74ec('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c4ed2[_0x74ec('0x19')]?_0x4c4ed2[_0x74ec('0x19')][_0x74ec('0x1b')]||null:null,'attributes':_0x4c4ed2[_0x74ec('0x19')]?_0x4c4ed2[_0x74ec('0x19')]['attributes']||null:null,'include':_0x4c4ed2['options']?_0x4c4ed2[_0x74ec('0x19')][_0x74ec('0x1d')]?_[_0x74ec('0x1e')](_0x4c4ed2[_0x74ec('0x19')][_0x74ec('0x1d')],function(_0xe8f29e){return{'model':db[_0xe8f29e[_0x74ec('0x1f')]],'as':_0xe8f29e['as'],'attributes':_0xe8f29e['attributes'],'include':_0xe8f29e[_0x74ec('0x1d')]?_['map'](_0xe8f29e[_0x74ec('0x1d')],function(_0x497316){return{'model':db[_0x497316[_0x74ec('0x1f')]],'as':_0x497316['as'],'attributes':_0x497316['attributes'],'include':_0x497316[_0x74ec('0x1d')]?_[_0x74ec('0x1e')](_0x497316[_0x74ec('0x1d')],function(_0x1b9c21){return{'model':db[_0x1b9c21['model']],'as':_0x1b9c21['as'],'attributes':_0x1b9c21[_0x74ec('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74ec('0xb')](function(_0x22a995){logger[_0x74ec('0xc')](_0x74ec('0x20'),_0x4c4ed2);logger[_0x74ec('0xe')]('ShowTrunk',_0x4c4ed2,JSON[_0x74ec('0x10')](_0x22a995));_0x40bc7e(_0x22a995);})[_0x74ec('0x16')](function(_0x533a74){logger[_0x74ec('0x11')](_0x74ec('0x20'),_0x533a74[_0x74ec('0x13')],_0x4c4ed2);_0x11bd15(_0x1c5831[_0x74ec('0x11')](0x1f4,_0x533a74['message']));});});}; \ No newline at end of file +var _0x9684=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','info','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','map','attributes','stringify','ShowTrunk','find','util','moment','bluebird','randomstring','ioredis'];(function(_0x19f56c,_0x485369){var _0x3ddd21=function(_0x143496){while(--_0x143496){_0x19f56c['push'](_0x19f56c['shift']());}};_0x3ddd21(++_0x485369);}(_0x9684,0xf0));var _0x4968=function(_0x336c2c,_0x19b2cc){_0x336c2c=_0x336c2c-0x0;var _0x304a77=_0x9684[_0x336c2c];return _0x304a77;};'use strict';var _=require('lodash');var util=require(_0x4968('0x0'));var moment=require(_0x4968('0x1'));var BPromise=require(_0x4968('0x2'));var rs=require(_0x4968('0x3'));var fs=require('fs');var Redis=require(_0x4968('0x4'));var db=require(_0x4968('0x5'))['db'];var utils=require(_0x4968('0x6'));var logger=require(_0x4968('0x7'))(_0x4968('0x8'));var config=require(_0x4968('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4968('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24660e,_0x4038ef,_0x3f85de){return new BPromise(function(_0x38d888,_0x432f23){return client['request'](_0x24660e,_0x3f85de)[_0x4968('0xb')](function(_0x32fc38){logger['info']('Trunk,\x20%s,\x20%s',_0x4038ef,_0x4968('0xc'));logger[_0x4968('0xd')](_0x4968('0xe'),_0x4038ef,_0x4968('0xc'),JSON['stringify'](_0x32fc38));if(_0x32fc38[_0x4968('0xf')]){if(_0x32fc38[_0x4968('0xf')][_0x4968('0x10')]===0x1f4){logger[_0x4968('0xf')](_0x4968('0x11'),_0x4038ef,_0x32fc38['error']['message']);return _0x432f23(_0x32fc38[_0x4968('0xf')][_0x4968('0x12')]);}logger['error'](_0x4968('0x11'),_0x4038ef,_0x32fc38[_0x4968('0xf')]['message']);return _0x38d888(_0x32fc38[_0x4968('0xf')][_0x4968('0x12')]);}else{logger[_0x4968('0x13')]('Trunk,\x20%s,\x20%s',_0x4038ef,'request\x20sent');_0x38d888(_0x32fc38['result'][_0x4968('0x12')]);}})[_0x4968('0x14')](function(_0x328a6f){logger[_0x4968('0xf')](_0x4968('0x11'),_0x4038ef,_0x328a6f);_0x432f23(_0x328a6f);});});}exports[_0x4968('0x15')]=function(_0x51afa9){var _0x5b12db=this;return new Promise(function(_0x435af1,_0x4b0cac){return db[_0x4968('0x16')][_0x4968('0x17')]({'raw':_0x51afa9[_0x4968('0x18')]?_0x51afa9[_0x4968('0x18')][_0x4968('0x19')]===undefined?!![]:![]:!![],'where':_0x51afa9[_0x4968('0x18')]?_0x51afa9[_0x4968('0x18')][_0x4968('0x1a')]||null:null,'attributes':_0x51afa9['options']?_0x51afa9['options']['attributes']||null:null,'limit':_0x51afa9[_0x4968('0x18')]?_0x51afa9[_0x4968('0x18')][_0x4968('0x1b')]||null:null,'include':_0x51afa9[_0x4968('0x18')]?_0x51afa9[_0x4968('0x18')][_0x4968('0x1c')]?_['map'](_0x51afa9['options']['include'],function(_0x47e4ff){return{'model':db[_0x47e4ff[_0x4968('0x1d')]],'as':_0x47e4ff['as'],'attributes':_0x47e4ff['attributes'],'include':_0x47e4ff['include']?_[_0x4968('0x1e')](_0x47e4ff[_0x4968('0x1c')],function(_0x20dcd8){return{'model':db[_0x20dcd8[_0x4968('0x1d')]],'as':_0x20dcd8['as'],'attributes':_0x20dcd8[_0x4968('0x1f')],'include':_0x20dcd8['include']?_['map'](_0x20dcd8['include'],function(_0x4cf23d){return{'model':db[_0x4cf23d[_0x4968('0x1d')]],'as':_0x4cf23d['as'],'attributes':_0x4cf23d[_0x4968('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4968('0xb')](function(_0x56059a){logger[_0x4968('0x13')](_0x4968('0x15'),_0x51afa9);logger[_0x4968('0xd')](_0x4968('0x15'),_0x51afa9,JSON[_0x4968('0x20')](_0x56059a));_0x435af1(_0x56059a);})['catch'](function(_0x566c73){logger['error'](_0x4968('0x15'),_0x566c73[_0x4968('0x12')],_0x51afa9);_0x4b0cac(_0x5b12db[_0x4968('0xf')](0x1f4,_0x566c73[_0x4968('0x12')]));});});};exports[_0x4968('0x21')]=function(_0x56490d){var _0x253497=this;return new Promise(function(_0x1d963a,_0x3479ae){return db[_0x4968('0x16')][_0x4968('0x22')]({'raw':_0x56490d[_0x4968('0x18')]?_0x56490d[_0x4968('0x18')][_0x4968('0x19')]===undefined?!![]:![]:!![],'where':_0x56490d[_0x4968('0x18')]?_0x56490d[_0x4968('0x18')][_0x4968('0x1a')]||null:null,'attributes':_0x56490d[_0x4968('0x18')]?_0x56490d[_0x4968('0x18')][_0x4968('0x1f')]||null:null,'include':_0x56490d[_0x4968('0x18')]?_0x56490d[_0x4968('0x18')][_0x4968('0x1c')]?_['map'](_0x56490d[_0x4968('0x18')][_0x4968('0x1c')],function(_0x2c96d2){return{'model':db[_0x2c96d2[_0x4968('0x1d')]],'as':_0x2c96d2['as'],'attributes':_0x2c96d2['attributes'],'include':_0x2c96d2[_0x4968('0x1c')]?_[_0x4968('0x1e')](_0x2c96d2[_0x4968('0x1c')],function(_0x56dd6c){return{'model':db[_0x56dd6c[_0x4968('0x1d')]],'as':_0x56dd6c['as'],'attributes':_0x56dd6c['attributes'],'include':_0x56dd6c['include']?_[_0x4968('0x1e')](_0x56dd6c[_0x4968('0x1c')],function(_0x1b4a8d){return{'model':db[_0x1b4a8d['model']],'as':_0x1b4a8d['as'],'attributes':_0x1b4a8d[_0x4968('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4968('0xb')](function(_0x49732b){logger[_0x4968('0x13')](_0x4968('0x21'),_0x56490d);logger['debug'](_0x4968('0x21'),_0x56490d,JSON[_0x4968('0x20')](_0x49732b));_0x1d963a(_0x49732b);})[_0x4968('0x14')](function(_0x9ca05a){logger[_0x4968('0xf')]('ShowTrunk',_0x9ca05a[_0x4968('0x12')],_0x56490d);_0x3479ae(_0x253497[_0x4968('0xf')](0x1f4,_0x9ca05a[_0x4968('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 4d0b3b0..9575c6d 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 _0x9c16=['express','../../components/auth/service','./user-setting.controller','put','update','exports'];(function(_0xe0c084,_0x1ba86a){var _0x467678=function(_0x4b4dc7){while(--_0x4b4dc7){_0xe0c084['push'](_0xe0c084['shift']());}};_0x467678(++_0x1ba86a);}(_0x9c16,0x90));var _0x69c1=function(_0x2b39b1,_0x5e8581){_0x2b39b1=_0x2b39b1-0x0;var _0x502583=_0x9c16[_0x2b39b1];return _0x502583;};'use strict';var express=require(_0x69c1('0x0'));var router=express['Router']();var auth=require(_0x69c1('0x1'));var controller=require(_0x69c1('0x2'));router[_0x69c1('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x69c1('0x4')]);module[_0x69c1('0x5')]=router; \ No newline at end of file +var _0x1229=['express','Router','./user-setting.controller','/:id','update','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1229,0x6c));var _0x9122=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1229[_0x46698a];return _0x356db0;};'use strict';var express=require(_0x9122('0x0'));var router=express[_0x9122('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9122('0x2'));router['put'](_0x9122('0x3'),auth['isAuthenticated'](),controller[_0x9122('0x4')]);module[_0x9122('0x5')]=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 2d44057..5ae9bf4 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 _0xf47d=['DATE','UserId','sequelize','warning','info','debug','exports','ENUM','BOOLEAN','TEXT'];(function(_0x322be4,_0x232b01){var _0x37257b=function(_0x3cd867){while(--_0x3cd867){_0x322be4['push'](_0x322be4['shift']());}};_0x37257b(++_0x232b01);}(_0xf47d,0x1d8));var _0xdf47=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xf47d[_0x251e8c];return _0x1e0c1d;};'use strict';var Sequelize=require(_0xdf47('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xdf47('0x1'),_0xdf47('0x2'),_0xdf47('0x3')];module[_0xdf47('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xdf47('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xdf47('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xdf47('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xdf47('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xdf47('0x9')}}; \ No newline at end of file +var _0xa5df=['debug','exports','ENUM','BOOLEAN','TEXT','INTEGER','sequelize','error','info'];(function(_0x5f463b,_0x1adab6){var _0x42912c=function(_0x37346f){while(--_0x37346f){_0x5f463b['push'](_0x5f463b['shift']());}};_0x42912c(++_0x1adab6);}(_0xa5df,0xf0));var _0xfa5d=function(_0x145e77,_0xdfd15c){_0x145e77=_0x145e77-0x0;var _0x4660de=_0xa5df[_0x145e77];return _0x4660de;};'use strict';var Sequelize=require(_0xfa5d('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfa5d('0x1'),'warning',_0xfa5d('0x2'),_0xfa5d('0x3')];module[_0xfa5d('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfa5d('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfa5d('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfa5d('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfa5d('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfa5d('0x8')],'unique':'UserId'}}; \ 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 5def0c0..36c3475 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 _0x04de=['redis','./user-setting.socket','register','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter'];(function(_0xfda3b2,_0x4c88ab){var _0x1f45fd=function(_0x579d1e){while(--_0x579d1e){_0xfda3b2['push'](_0xfda3b2['shift']());}};_0x1f45fd(++_0x4c88ab);}(_0x04de,0x107));var _0xe04d=function(_0x2ecef4,_0x503e05){_0x2ecef4=_0x2ecef4-0x0;var _0x51f2ff=_0x04de[_0x2ecef4];return _0x51f2ff;};'use strict';var _=require(_0xe04d('0x0'));var Redis=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var config=require(_0xe04d('0x4'));var db=require(_0xe04d('0x5'))['db'];var socket=require(_0xe04d('0x6'))(new Redis(config[_0xe04d('0x7')]));require(_0xe04d('0x8'))[_0xe04d('0x9')](socket);config[_0xe04d('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x531688,_0x55efb5){_0x55efb5=_0x55efb5||0xc8;return function(_0x210e93){if(_0x210e93){return _0x531688[_0xe04d('0xa')](_0x55efb5)[_0xe04d('0xb')](_0x210e93);}};}function saveUpdates(_0x154f40){return function(_0x2a1f43){if(_0x2a1f43){return _0x2a1f43[_0xe04d('0xc')](_0x154f40)[_0xe04d('0xd')](function(_0x562204){return _0x562204;});}return null;};}function handleEntityNotFound(_0x160d4f){return function(_0x21c91c){if(!_0x21c91c){_0x160d4f[_0xe04d('0xe')](0x194);}return _0x21c91c;};}function handleError(_0x30c46b,_0xad5c34){_0xad5c34=_0xad5c34||0x1f4;return function(_0x3e1837){logger[_0xe04d('0xf')](_0x3e1837[_0xe04d('0x10')]);if(_0x3e1837[_0xe04d('0x11')]){delete _0x3e1837['name'];}_0x30c46b[_0xe04d('0xa')](_0xad5c34)[_0xe04d('0x12')](_0x3e1837);};}exports[_0xe04d('0xc')]=function(_0x11203e,_0x2f7f51){if(_0x11203e[_0xe04d('0x13')][_0xe04d('0x14')]!==_0xe04d('0x15'))throw new Error(_0xe04d('0x16'));if(isNaN(Number(_0x11203e[_0xe04d('0x17')]['id'])))throw new Error(_0xe04d('0x18'));return db[_0xe04d('0x19')]['find']({'where':{'id':_0x11203e[_0xe04d('0x17')]['id']}})['then'](handleEntityNotFound(_0x2f7f51,null))[_0xe04d('0xd')](saveUpdates(_0x11203e['body'],null))[_0xe04d('0xd')](respondWithResult(_0x2f7f51,null))[_0xe04d('0x1a')](handleError(_0x2f7f51,null));}; \ No newline at end of file +var _0x2e35=['body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','defaults','then','stack','name','status','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x2a2d4c,_0x421c0b){var _0x281be4=function(_0x4d8ea9){while(--_0x4d8ea9){_0x2a2d4c['push'](_0x2a2d4c['shift']());}};_0x281be4(++_0x421c0b);}(_0x2e35,0x1d0));var _0x52e3=function(_0x1ecae,_0x541fd8){_0x1ecae=_0x1ecae-0x0;var _0x177cf7=_0x2e35[_0x1ecae];return _0x177cf7;};'use strict';var _=require(_0x52e3('0x0'));var Redis=require(_0x52e3('0x1'));var logger=require(_0x52e3('0x2'))('api');var config=require(_0x52e3('0x3'));var db=require(_0x52e3('0x4'))['db'];var socket=require(_0x52e3('0x5'))(new Redis(config[_0x52e3('0x6')]));require('./user-setting.socket')[_0x52e3('0x7')](socket);config[_0x52e3('0x6')]=_[_0x52e3('0x8')](config[_0x52e3('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x483b93,_0x507a6c){_0x507a6c=_0x507a6c||0xc8;return function(_0x21ae13){if(_0x21ae13){return _0x483b93['status'](_0x507a6c)['json'](_0x21ae13);}};}function saveUpdates(_0x1367de){return function(_0x2fcd20){if(_0x2fcd20){return _0x2fcd20['update'](_0x1367de)[_0x52e3('0x9')](function(_0x1153c4){return _0x1153c4;});}return null;};}function handleEntityNotFound(_0x542097){return function(_0x440fe5){if(!_0x440fe5){_0x542097['sendStatus'](0x194);}return _0x440fe5;};}function handleError(_0x343960,_0x10f70f){_0x10f70f=_0x10f70f||0x1f4;return function(_0x16492c){logger['error'](_0x16492c[_0x52e3('0xa')]);if(_0x16492c[_0x52e3('0xb')]){delete _0x16492c['name'];}_0x343960[_0x52e3('0xc')](_0x10f70f)['send'](_0x16492c);};}exports['update']=function(_0x58dcdd,_0x478ff9){if(_0x58dcdd['user'][_0x52e3('0xd')]!==_0x52e3('0xe'))throw new Error(_0x52e3('0xf'));if(isNaN(Number(_0x58dcdd[_0x52e3('0x10')]['id'])))throw new Error(_0x52e3('0x11'));return db[_0x52e3('0x12')][_0x52e3('0x13')]({'where':{'id':_0x58dcdd[_0x52e3('0x10')]['id']}})[_0x52e3('0x9')](handleEntityNotFound(_0x478ff9,null))[_0x52e3('0x9')](saveUpdates(_0x58dcdd[_0x52e3('0x14')],null))['then'](respondWithResult(_0x478ff9,null))[_0x52e3('0x15')](handleError(_0x478ff9,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 6134c5a..0904cd6 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 _0xcb49=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcb49,0xc2));var _0x9cb4=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0xcb49[_0x25280c];return _0x3a58c3;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x9cb4('0x0'))['db'][_0x9cb4('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9cb4('0x2')](0x0);var events={'afterCreate':_0x9cb4('0x3'),'afterUpdate':_0x9cb4('0x4'),'afterDestroy':_0x9cb4('0x5')};function emitEvent(_0x29de08){return function(_0x52bc97,_0x1d5c18,_0x1190e0){UserSettingEvents[_0x9cb4('0x6')](_0x29de08+':'+_0x52bc97['id'],_0x52bc97);UserSettingEvents[_0x9cb4('0x6')](_0x29de08,_0x52bc97);_0x1190e0(null);};}for(var e in events){if(events[_0x9cb4('0x7')](e)){var event=events[e];UserSetting[_0x9cb4('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xa784=['update','emit','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xa784,0xf3));var _0x4a78=function(_0x369a70,_0x501041){_0x369a70=_0x369a70-0x0;var _0x1f6d6c=_0xa784[_0x369a70];return _0x1f6d6c;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x4a78('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4a78('0x1')](0x0);var events={'afterCreate':_0x4a78('0x2'),'afterUpdate':_0x4a78('0x3'),'afterDestroy':'remove'};function emitEvent(_0x240336){return function(_0x573222,_0x28effb,_0x548484){UserSettingEvents[_0x4a78('0x4')](_0x240336+':'+_0x573222['id'],_0x573222);UserSettingEvents[_0x4a78('0x4')](_0x240336,_0x573222);_0x548484(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x4a78('0x5')]=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 a836917..475cb4d 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 _0x4227=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','user_settings'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0x4227,0x89));var _0x7422=function(_0x140cf3,_0x4b0b53){_0x140cf3=_0x140cf3-0x0;var _0xe18555=_0x4227[_0x140cf3];return _0xe18555;};'use strict';var attributes=require(_0x7422('0x0'));module['exports']=function(_0x4f6e48){return _0x4f6e48[_0x7422('0x1')]('UserSetting',attributes,{'tableName':_0x7422('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17e787){if(!_0x17e787[_0x7422('0x3')])_0x17e787['clientSideLoggingEnabledSince']=null;else if(_0x17e787[_0x7422('0x4')]===null)_0x17e787[_0x7422('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xfc75=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x1704c0,_0x1f6b71){var _0x1e8efd=function(_0x19bf78){while(--_0x19bf78){_0x1704c0['push'](_0x1704c0['shift']());}};_0x1e8efd(++_0x1f6b71);}(_0xfc75,0xe1));var _0x5fc7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc75[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x5fc7('0x0'));module[_0x5fc7('0x1')]=function(_0x3d2426){return _0x3d2426[_0x5fc7('0x2')](_0x5fc7('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55314c){if(!_0x55314c[_0x5fc7('0x4')])_0x55314c['clientSideLoggingEnabledSince']=null;else if(_0x55314c[_0x5fc7('0x5')]===null)_0x55314c[_0x5fc7('0x5')]=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 63b331f..8d35b93 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 _0xb66f=['user-setting:','./user-setting.events','save','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x2a9045,_0x529a1a){var _0x307ff7=function(_0x264a8f){while(--_0x264a8f){_0x2a9045['push'](_0x2a9045['shift']());}};_0x307ff7(++_0x529a1a);}(_0xb66f,0x196));var _0xfb66=function(_0x50bc61,_0x56b675){_0x50bc61=_0x50bc61-0x0;var _0x3b2801=_0xb66f[_0x50bc61];return _0x3b2801;};'use strict';var UserSettingEvents=require(_0xfb66('0x0'));var events=[_0xfb66('0x1'),'remove',_0xfb66('0x2')];function createListener(_0x41fd44,_0x204b3f){return function(_0x129659){_0x204b3f[_0xfb66('0x3')](_0x41fd44,_0x129659);if(_0x41fd44===_0xfb66('0x4')){_0x204b3f[_0xfb66('0x3')](_0xfb66('0x5')+_0x129659[_0xfb66('0x6')],_0x129659);}};}exports['register']=function(_0x1ef8bb){for(var _0x524161=0x0,_0x40233f=events[_0xfb66('0x7')];_0x524161<_0x40233f;_0x524161++){var _0x35cda9=events[_0x524161];var _0x4e6b38=createListener(_0xfb66('0x8')+_0x35cda9,_0x1ef8bb);UserSettingEvents['on'](_0x35cda9,_0x4e6b38);}}; \ No newline at end of file +var _0xaf3b=['update','emit','user-setting:update','user-setting:update:user-','length','user-setting:','./user-setting.events','save','remove'];(function(_0x355082,_0x2ef631){var _0x4517d6=function(_0x58455e){while(--_0x58455e){_0x355082['push'](_0x355082['shift']());}};_0x4517d6(++_0x2ef631);}(_0xaf3b,0x1bf));var _0xbaf3=function(_0x1a6fb1,_0x2b8f37){_0x1a6fb1=_0x1a6fb1-0x0;var _0x351db3=_0xaf3b[_0x1a6fb1];return _0x351db3;};'use strict';var UserSettingEvents=require(_0xbaf3('0x0'));var events=[_0xbaf3('0x1'),_0xbaf3('0x2'),_0xbaf3('0x3')];function createListener(_0x23c66b,_0x202873){return function(_0x536952){_0x202873[_0xbaf3('0x4')](_0x23c66b,_0x536952);if(_0x23c66b===_0xbaf3('0x5')){_0x202873[_0xbaf3('0x4')](_0xbaf3('0x6')+_0x536952['UserId'],_0x536952);}};}exports['register']=function(_0x418b48){for(var _0x363ee7=0x0,_0x5aa0ea=events[_0xbaf3('0x7')];_0x363ee7<_0x5aa0ea;_0x363ee7++){var _0x483a97=events[_0x363ee7];var _0x1fa829=createListener(_0xbaf3('0x8')+_0x483a97,_0x418b48);UserSettingEvents['on'](_0x483a97,_0x1fa829);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3ad16fb..e571f07 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 _0x7089=['getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7089,0xc5));var _0x9708=function(_0x5d7db9,_0x16a1c1){_0x5d7db9=_0x5d7db9-0x0;var _0x4f5c34=_0x7089[_0x5d7db9];return _0x4f5c34;};'use strict';var multer=require(_0x9708('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9708('0x1'));var router=express[_0x9708('0x2')]();var fs_extra=require(_0x9708('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9708('0x4'));var config=require(_0x9708('0x5'));var controller=require(_0x9708('0x6'));router[_0x9708('0x7')]('/',auth[_0x9708('0x8')](),controller[_0x9708('0x9')]);router[_0x9708('0x7')]('/describe',auth[_0x9708('0x8')](),controller[_0x9708('0xa')]);router[_0x9708('0x7')](_0x9708('0xb'),auth[_0x9708('0x8')](),controller[_0x9708('0xc')]);router[_0x9708('0x7')](_0x9708('0xd'),auth[_0x9708('0x8')](),controller['getPresence']);router[_0x9708('0x7')](_0x9708('0xe'),auth[_0x9708('0x8')](),controller[_0x9708('0xf')]);router[_0x9708('0x7')](_0x9708('0x10'),controller[_0x9708('0x11')]);router['get'](_0x9708('0x12'),auth['isAuthenticated'](),controller[_0x9708('0x13')]);router['get']('/:id/contacts',auth[_0x9708('0x8')](),controller[_0x9708('0x14')]);router['get'](_0x9708('0x15'),auth[_0x9708('0x8')](),controller[_0x9708('0x16')]);router[_0x9708('0x7')]('/:id/queues_rt',auth[_0x9708('0x8')](),controller[_0x9708('0x17')]);router[_0x9708('0x7')](_0x9708('0x18'),auth[_0x9708('0x8')](),controller[_0x9708('0x19')]);router[_0x9708('0x7')](_0x9708('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x9708('0x7')](_0x9708('0x1b'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x9708('0x7')](_0x9708('0x1c'),auth['isAuthenticated'](),controller[_0x9708('0x1d')]);router[_0x9708('0x7')](_0x9708('0x1e'),auth[_0x9708('0x8')](),controller[_0x9708('0x1f')]);router[_0x9708('0x7')](_0x9708('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router['get']('/:id/sms/interactions',auth[_0x9708('0x8')](),controller['getSmsInteractions']);router['get'](_0x9708('0x21'),auth[_0x9708('0x8')](),controller['getFaxInteractions']);router[_0x9708('0x7')](_0x9708('0x22'),auth[_0x9708('0x8')](),controller[_0x9708('0x23')]);router[_0x9708('0x7')]('/:id/teams',auth[_0x9708('0x8')](),controller[_0x9708('0x24')]);router[_0x9708('0x7')](_0x9708('0x25'),auth[_0x9708('0x8')](),controller[_0x9708('0x26')]);router[_0x9708('0x7')]('/:id/agents',auth[_0x9708('0x8')](),controller[_0x9708('0x27')]);router[_0x9708('0x7')](_0x9708('0x28'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x9708('0x7')]('/:id/fax_accounts',auth[_0x9708('0x8')](),controller[_0x9708('0x29')]);router['get'](_0x9708('0x2a'),auth['isAuthenticated'](),controller[_0x9708('0x2b')]);router['get'](_0x9708('0x2c'),auth[_0x9708('0x8')](),controller['getOpenchannelAccounts']);router[_0x9708('0x7')](_0x9708('0x2d'),auth[_0x9708('0x8')](),controller[_0x9708('0x2e')]);router[_0x9708('0x7')]('/:id/chat_websites',auth[_0x9708('0x8')](),controller[_0x9708('0x2f')]);router[_0x9708('0x7')](_0x9708('0x30'),auth[_0x9708('0x8')](),controller[_0x9708('0x31')]);router[_0x9708('0x7')]('/:id/square_projects',auth[_0x9708('0x8')](),controller['getSquareProjects']);router['get'](_0x9708('0x32'),auth['isAuthenticated'](),controller[_0x9708('0x33')]);router[_0x9708('0x7')]('/:id/api_key',auth[_0x9708('0x8')](),controller[_0x9708('0x34')]);router[_0x9708('0x35')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x9708('0x8')](),controller[_0x9708('0x36')]);router[_0x9708('0x35')]('/create_many',auth[_0x9708('0x8')](),controller['bulkCreate']);router[_0x9708('0x35')](_0x9708('0x15'),auth[_0x9708('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9708('0x37')]({'destination':function(_0x541057,_0x30564c,_0xbdb91d){_0xbdb91d(null,path[_0x9708('0x38')](config[_0x9708('0x39')],_0x9708('0x3a')));},'filename':function(_0x28c662,_0x486055,_0x9260dc){_0x9260dc(null,util[_0x9708('0x3b')](_0x9708('0x3c'),Date['now'](),_0x486055[_0x9708('0x3d')]));}})});router[_0x9708('0x35')](_0x9708('0x10'),upload[_0x9708('0x3e')](_0x9708('0x3f')),controller[_0x9708('0x40')]);router[_0x9708('0x35')]('/:id/login',auth['isAuthenticated'](),controller[_0x9708('0x41')]);router[_0x9708('0x35')](_0x9708('0x42'),auth[_0x9708('0x8')](),controller[_0x9708('0x43')]);router[_0x9708('0x35')](_0x9708('0x44'),auth[_0x9708('0x8')](),controller['pause']);router[_0x9708('0x35')](_0x9708('0x45'),auth[_0x9708('0x8')](),controller[_0x9708('0x46')]);router[_0x9708('0x35')](_0x9708('0x47'),auth[_0x9708('0x8')](),controller[_0x9708('0x48')]);router['post'](_0x9708('0x49'),auth[_0x9708('0x8')](),controller['addChatInteractions']);router[_0x9708('0x35')](_0x9708('0x4a'),auth['isAuthenticated'](),controller[_0x9708('0x4b')]);router[_0x9708('0x35')](_0x9708('0x4c'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x9708('0x35')]('/:id/sms_interactions',auth[_0x9708('0x8')](),controller[_0x9708('0x4d')]);router[_0x9708('0x35')](_0x9708('0x4e'),auth[_0x9708('0x8')](),controller['addOpenchannelInteractions']);router[_0x9708('0x35')](_0x9708('0x4f'),auth[_0x9708('0x8')](),controller[_0x9708('0x50')]);router[_0x9708('0x35')](_0x9708('0x51'),auth['isAuthenticated'](),controller[_0x9708('0x52')]);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x9708('0x53')]);router[_0x9708('0x35')](_0x9708('0x2c'),auth[_0x9708('0x8')](),controller['addOpenchannelAccounts']);router[_0x9708('0x35')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x9708('0x54')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x9708('0x55')]);router[_0x9708('0x35')](_0x9708('0x30'),auth['isAuthenticated'](),controller[_0x9708('0x56')]);router[_0x9708('0x35')]('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router['post']('/:id/api_key',auth['isAuthenticated'](),controller[_0x9708('0x57')]);router[_0x9708('0x58')](_0x9708('0xe'),auth[_0x9708('0x8')](),controller[_0x9708('0x59')]);router['put'](_0x9708('0x5a'),auth[_0x9708('0x8')](),controller[_0x9708('0x5b')]);router[_0x9708('0x5c')]('/:id/queues',auth[_0x9708('0x8')](),controller[_0x9708('0x5d')]);router[_0x9708('0x5c')](_0x9708('0x47'),auth[_0x9708('0x8')](),controller['removeTeams']);router['delete'](_0x9708('0xe'),auth[_0x9708('0x8')](),controller[_0x9708('0x5e')]);router[_0x9708('0x5c')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x9708('0x5f')]);router[_0x9708('0x5c')](_0x9708('0x4a'),auth[_0x9708('0x8')](),controller[_0x9708('0x60')]);router[_0x9708('0x5c')](_0x9708('0x4c'),auth['isAuthenticated'](),controller[_0x9708('0x61')]);router[_0x9708('0x5c')](_0x9708('0x62'),auth['isAuthenticated'](),controller[_0x9708('0x63')]);router[_0x9708('0x5c')](_0x9708('0x4e'),auth[_0x9708('0x8')](),controller['removeOpenchannelInteractions']);router[_0x9708('0x5c')](_0x9708('0x4f'),auth['isAuthenticated'](),controller[_0x9708('0x64')]);router[_0x9708('0x5c')](_0x9708('0x51'),auth[_0x9708('0x8')](),controller[_0x9708('0x65')]);router[_0x9708('0x5c')](_0x9708('0x2a'),auth[_0x9708('0x8')](),controller[_0x9708('0x66')]);router['delete'](_0x9708('0x2c'),auth[_0x9708('0x8')](),controller['removeOpenchannelAccounts']);router[_0x9708('0x5c')](_0x9708('0x2d'),auth[_0x9708('0x8')](),controller[_0x9708('0x67')]);router[_0x9708('0x5c')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x9708('0x68')]);router[_0x9708('0x5c')](_0x9708('0x30'),auth[_0x9708('0x8')](),controller[_0x9708('0x69')]);router[_0x9708('0x5c')](_0x9708('0x6a'),auth[_0x9708('0x8')](),controller[_0x9708('0x6b')]);router[_0x9708('0x5c')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x9708('0x6c')]);module[_0x9708('0x6d')]=router; \ No newline at end of file +var _0x576a=['getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','addQueues','diskStorage','join','root','format','now','single','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','describe','/whoami','whoami','isAuthenticated','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes'];(function(_0x1fa426,_0x585510){var _0x5ed63b=function(_0x5c34d3){while(--_0x5c34d3){_0x1fa426['push'](_0x1fa426['shift']());}};_0x5ed63b(++_0x585510);}(_0x576a,0x18d));var _0xa576=function(_0x49a070,_0x25b49e){_0x49a070=_0x49a070-0x0;var _0x5dd661=_0x576a[_0x49a070];return _0x5dd661;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa576('0x0'));var express=require('express');var router=express[_0xa576('0x1')]();var fs_extra=require(_0xa576('0x2'));var auth=require(_0xa576('0x3'));var interaction=require(_0xa576('0x4'));var config=require(_0xa576('0x5'));var controller=require(_0xa576('0x6'));router[_0xa576('0x7')]('/',auth['isAuthenticated'](),controller[_0xa576('0x8')]);router[_0xa576('0x7')](_0xa576('0x9'),auth['isAuthenticated'](),controller[_0xa576('0xa')]);router[_0xa576('0x7')](_0xa576('0xb'),auth['isAuthenticated'](),controller[_0xa576('0xc')]);router[_0xa576('0x7')]('/presence',auth[_0xa576('0xd')](),controller[_0xa576('0xe')]);router[_0xa576('0x7')](_0xa576('0xf'),auth[_0xa576('0xd')](),controller[_0xa576('0x10')]);router[_0xa576('0x7')](_0xa576('0x11'),controller[_0xa576('0x12')]);router[_0xa576('0x7')](_0xa576('0x13'),auth['isAuthenticated'](),controller[_0xa576('0x14')]);router['get'](_0xa576('0x15'),auth[_0xa576('0xd')](),controller[_0xa576('0x16')]);router[_0xa576('0x7')](_0xa576('0x17'),auth[_0xa576('0xd')](),controller[_0xa576('0x18')]);router['get'](_0xa576('0x19'),auth[_0xa576('0xd')](),controller[_0xa576('0x1a')]);router['get'](_0xa576('0x1b'),auth['isAuthenticated'](),controller[_0xa576('0x1c')]);router['get'](_0xa576('0x1d'),auth[_0xa576('0xd')](),controller[_0xa576('0x1e')]);router[_0xa576('0x7')](_0xa576('0x1f'),auth[_0xa576('0xd')](),controller['getScreenRecordings']);router[_0xa576('0x7')](_0xa576('0x20'),auth[_0xa576('0xd')](),controller[_0xa576('0x21')]);router[_0xa576('0x7')](_0xa576('0x22'),auth[_0xa576('0xd')](),controller['getOpenchannelInteractions']);router[_0xa576('0x7')]('/:id/mail/interactions',auth[_0xa576('0xd')](),controller[_0xa576('0x23')]);router[_0xa576('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xa576('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router['get']('/:id/whatsapp/interactions',auth[_0xa576('0xd')](),controller['getWhatsappInteractions']);router['get'](_0xa576('0x24'),auth['isAuthenticated'](),controller[_0xa576('0x25')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xa576('0x26')]);router[_0xa576('0x7')](_0xa576('0x27'),auth['isAuthenticated'](),controller[_0xa576('0x28')]);router[_0xa576('0x7')](_0xa576('0x29'),auth[_0xa576('0xd')](),controller[_0xa576('0x2a')]);router[_0xa576('0x7')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xa576('0x2b')]);router['get'](_0xa576('0x2c'),auth[_0xa576('0xd')](),controller[_0xa576('0x2d')]);router[_0xa576('0x7')](_0xa576('0x2e'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xa576('0x7')](_0xa576('0x2f'),auth['isAuthenticated'](),controller[_0xa576('0x30')]);router[_0xa576('0x7')](_0xa576('0x31'),auth[_0xa576('0xd')](),controller[_0xa576('0x32')]);router[_0xa576('0x7')]('/:id/whatsapp_accounts',auth[_0xa576('0xd')](),controller[_0xa576('0x33')]);router['get']('/:id/square_projects',auth[_0xa576('0xd')](),controller['getSquareProjects']);router[_0xa576('0x7')]('/:id/scheduled_calls',auth[_0xa576('0xd')](),controller[_0xa576('0x34')]);router[_0xa576('0x7')](_0xa576('0x35'),auth[_0xa576('0xd')](),controller[_0xa576('0x36')]);router[_0xa576('0x37')](_0xa576('0x15'),auth[_0xa576('0xd')](),controller['addContacts']);router['post']('/',auth[_0xa576('0xd')](),controller[_0xa576('0x38')]);router[_0xa576('0x37')]('/create_many',auth[_0xa576('0xd')](),controller[_0xa576('0x39')]);router[_0xa576('0x37')](_0xa576('0x17'),auth['isAuthenticated'](),controller[_0xa576('0x3a')]);var upload=multer({'storage':multer[_0xa576('0x3b')]({'destination':function(_0x46aa79,_0x38f312,_0x263cb5){_0x263cb5(null,path[_0xa576('0x3c')](config[_0xa576('0x3d')],'server/files/images/'));},'filename':function(_0x1e31c7,_0x5e9302,_0x453c6f){_0x453c6f(null,util[_0xa576('0x3e')]('%s-%s',Date[_0xa576('0x3f')](),_0x5e9302['originalname']));}})});router[_0xa576('0x37')](_0xa576('0x11'),upload[_0xa576('0x40')]('file'),controller['addAvatar']);router[_0xa576('0x37')](_0xa576('0x41'),auth['isAuthenticated'](),controller[_0xa576('0x42')]);router['post'](_0xa576('0x43'),auth[_0xa576('0xd')](),controller[_0xa576('0x44')]);router['post'](_0xa576('0x45'),auth['isAuthenticated'](),controller[_0xa576('0x46')]);router[_0xa576('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xa576('0x47')]);router[_0xa576('0x37')](_0xa576('0x24'),auth[_0xa576('0xd')](),controller['addTeams']);router[_0xa576('0x37')](_0xa576('0x48'),auth['isAuthenticated'](),controller[_0xa576('0x49')]);router[_0xa576('0x37')](_0xa576('0x4a'),auth[_0xa576('0xd')](),controller[_0xa576('0x4b')]);router[_0xa576('0x37')](_0xa576('0x4c'),auth[_0xa576('0xd')](),controller[_0xa576('0x4d')]);router['post'](_0xa576('0x4e'),auth['isAuthenticated'](),controller[_0xa576('0x4f')]);router['post'](_0xa576('0x50'),auth[_0xa576('0xd')](),controller[_0xa576('0x51')]);router['post']('/:id/whatsapp_interactions',auth[_0xa576('0xd')](),controller['addWhatsappInteractions']);router[_0xa576('0x37')]('/:id/fax_accounts',auth[_0xa576('0xd')](),controller[_0xa576('0x52')]);router['post']('/:id/mail_accounts',auth[_0xa576('0xd')](),controller['addMailAccounts']);router[_0xa576('0x37')](_0xa576('0x2e'),auth['isAuthenticated'](),controller[_0xa576('0x53')]);router[_0xa576('0x37')](_0xa576('0x2f'),auth[_0xa576('0xd')](),controller[_0xa576('0x54')]);router['post'](_0xa576('0x31'),auth[_0xa576('0xd')](),controller[_0xa576('0x55')]);router[_0xa576('0x37')](_0xa576('0x56'),auth['isAuthenticated'](),controller[_0xa576('0x57')]);router['post'](_0xa576('0x58'),auth[_0xa576('0xd')](),controller[_0xa576('0x59')]);router['post'](_0xa576('0x35'),auth[_0xa576('0xd')](),controller[_0xa576('0x5a')]);router[_0xa576('0x5b')](_0xa576('0xf'),auth[_0xa576('0xd')](),controller[_0xa576('0x5c')]);router[_0xa576('0x5b')]('/:id/password',auth['isAuthenticated'](),controller[_0xa576('0x5d')]);router['delete']('/:id/queues',auth[_0xa576('0xd')](),controller[_0xa576('0x5e')]);router[_0xa576('0x5f')]('/:id/teams',auth[_0xa576('0xd')](),controller[_0xa576('0x60')]);router[_0xa576('0x5f')](_0xa576('0xf'),auth['isAuthenticated'](),controller[_0xa576('0x61')]);router[_0xa576('0x5f')](_0xa576('0x48'),auth[_0xa576('0xd')](),controller[_0xa576('0x62')]);router[_0xa576('0x5f')]('/:id/mail_interactions',auth[_0xa576('0xd')](),controller[_0xa576('0x63')]);router[_0xa576('0x5f')]('/:id/fax_interactions',auth[_0xa576('0xd')](),controller['removeFaxInteractions']);router[_0xa576('0x5f')](_0xa576('0x4e'),auth[_0xa576('0xd')](),controller[_0xa576('0x64')]);router['delete']('/:id/openchannel_interactions',auth[_0xa576('0xd')](),controller[_0xa576('0x65')]);router['delete']('/:id/whatsapp_interactions',auth[_0xa576('0xd')](),controller[_0xa576('0x66')]);router[_0xa576('0x5f')](_0xa576('0x67'),auth[_0xa576('0xd')](),controller[_0xa576('0x68')]);router[_0xa576('0x5f')](_0xa576('0x2c'),auth[_0xa576('0xd')](),controller['removeMailAccounts']);router[_0xa576('0x5f')](_0xa576('0x2e'),auth[_0xa576('0xd')](),controller[_0xa576('0x69')]);router[_0xa576('0x5f')](_0xa576('0x2f'),auth['isAuthenticated'](),controller[_0xa576('0x6a')]);router[_0xa576('0x5f')](_0xa576('0x31'),auth[_0xa576('0xd')](),controller[_0xa576('0x6b')]);router[_0xa576('0x5f')](_0xa576('0x56'),auth[_0xa576('0xd')](),controller[_0xa576('0x6c')]);router['delete'](_0xa576('0x58'),auth[_0xa576('0xd')](),controller['removeSquareProjects']);router[_0xa576('0x5f')](_0xa576('0x35'),auth[_0xa576('0xd')](),controller['removeApiKey']);module[_0xa576('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a386020..f3c5f87 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 _0x5d70=['wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','local','internal','DATE','BOOLEAN','INTEGER','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','split','rfc2833','info','shortinfo','inband','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','update,nonat'];(function(_0x352df9,_0x346200){var _0x2bb47f=function(_0x3225d8){while(--_0x3225d8){_0x352df9['push'](_0x352df9['shift']());}};_0x2bb47f(++_0x346200);}(_0x5d70,0x178));var _0x05d7=function(_0x3d7da9,_0x40bb4a){_0x3d7da9=_0x3d7da9-0x0;var _0x2470eb=_0x5d70[_0x3d7da9];return _0x2470eb;};'use strict';var Sequelize=require(_0x05d7('0x0'));var moment=require(_0x05d7('0x1'));var util=require('util');var _=require(_0x05d7('0x2'));module[_0x05d7('0x3')]={'name':{'type':Sequelize[_0x05d7('0x4')],'allowNull':![],'unique':_0x05d7('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x6a1fea){this[_0x05d7('0x6')](_0x05d7('0x5'),_0x6a1fea);this[_0x05d7('0x6')](_0x05d7('0x7'),_0x6a1fea);},'comment':_0x05d7('0x8')},'fullname':{'type':Sequelize[_0x05d7('0x4')],'allowNull':![],'set':function(_0x3906bb){this[_0x05d7('0x6')](_0x05d7('0x9'),_0x3906bb);this[_0x05d7('0x6')](_0x05d7('0xa'),util[_0x05d7('0xb')](_0x05d7('0xc'),_0x3906bb,this[_0x05d7('0xd')]('internal')));}},'alias':{'type':Sequelize[_0x05d7('0x4')]},'email':{'type':Sequelize[_0x05d7('0x4')],'allowNull':![],'unique':_0x05d7('0xe'),'validate':{'isEmail':!![]},'set':function(_0x13b602){if(_0x13b602){this['setDataValue'](_0x05d7('0xe'),_0x13b602[_0x05d7('0xf')]());}}},'role':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x11'),_0x05d7('0x12'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x05d7('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x3abc73){this['setDataValue'](_0x05d7('0x14'),_0x3abc73);this[_0x05d7('0x6')]('accountcode',_0x3abc73);this[_0x05d7('0x6')]('callerid',util['format']('\x22%s\x22\x20<%s>',this['getDataValue'](_0x05d7('0x9')),_0x3abc73));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x05d7('0x4')]},'mobile':{'type':Sequelize[_0x05d7('0x4')]},'address':{'type':Sequelize[_0x05d7('0x4')]},'zipcode':{'type':Sequelize[_0x05d7('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x05d7('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x05d7('0x15')]},'voicePause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x05d7('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x05d7('0x15')]},'chatCapacity':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x05d7('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x05d7('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x05d7('0x18')},'ipaddr':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x05d7('0x12'),_0x05d7('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![],'defaultValue':_0x05d7('0x1a')},'callingpres':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x1b'),'ALLOWED_PASSED_SCREEN',_0x05d7('0x1c'),_0x05d7('0x1d'),_0x05d7('0x1e'),'PROHIB_PASSED_SCREEN',_0x05d7('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x05d7('0x20'),'set':function(_0x4ddb7f){this[_0x05d7('0x6')]('transport',_0x4ddb7f?_0x4ddb7f['join'](','):null);},'get':function(){return this[_0x05d7('0xd')](_0x05d7('0x21'))?this[_0x05d7('0xd')](_0x05d7('0x21'))[_0x05d7('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x23'),_0x05d7('0x24'),_0x05d7('0x25'),_0x05d7('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x05d7('0x23')},'directmedia':{'type':Sequelize[_0x05d7('0x10')]('yes','no',_0x05d7('0x27'),_0x05d7('0x28'),_0x05d7('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x05d7('0x2b'),'set':function(_0x5cd044){this[_0x05d7('0x6')](_0x05d7('0x2c'),_0x5cd044?_0x5cd044['join'](','):null);},'get':function(){return this[_0x05d7('0xd')](_0x05d7('0x2c'))?this[_0x05d7('0xd')](_0x05d7('0x2c'))[_0x05d7('0x22')](','):null;},'comment':_0x05d7('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x05d7('0x4')]},'pickupgroup':{'type':Sequelize[_0x05d7('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x05d7('0x4')]},'language':{'type':Sequelize[_0x05d7('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x05d7('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x05d7('0x2e')},'allow':{'type':Sequelize[_0x05d7('0x4')],'allowNull':![],'defaultValue':_0x05d7('0x2f'),'set':function(_0x2a928f){this[_0x05d7('0x6')](_0x05d7('0x30'),_0x2a928f?_0x2a928f['join'](';'):_0x05d7('0x2f'));},'get':function(){return this[_0x05d7('0xd')]('allow')?this['getDataValue'](_0x05d7('0x30'))['split'](';'):null;},'comment':_0x05d7('0x31')},'autoframing':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![],'set':function(_0x214ce2){this[_0x05d7('0x6')](_0x05d7('0x32'),_0x214ce2?_0x214ce2[_0x05d7('0x33')](','):null);},'get':function(){return this[_0x05d7('0xd')](_0x05d7('0x32'))?this['getDataValue'](_0x05d7('0x32'))[_0x05d7('0x22')](','):null;},'comment':_0x05d7('0x34')},'trustrpid':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![],'defaultValue':_0x05d7('0x35')},'amaflags':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x05d7('0x2a')},'busylevel':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x05d7('0x10')]('yes','no',_0x05d7('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x05d7('0x37'),_0x05d7('0x38'),_0x05d7('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'allowNull':!![],'defaultValue':_0x05d7('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x05d7('0x2a')},'keepalive':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x05d7('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no',_0x05d7('0x3b'),_0x05d7('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x05d7('0x10')]('active',_0x05d7('0x3d'),_0x05d7('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x05d7('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x05d7('0x2a'),'no',_0x05d7('0x27'),'update',_0x05d7('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x05d7('0x15')]},'passwordResetAt':{'type':Sequelize[_0x05d7('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0,'set':function(_0x1c1a13){this[_0x05d7('0x6')]('showWebBar',_0x1c1a13);var _0x19f137=this['get']({'plain':!![]});switch(_0x1c1a13){case 0x0:case 0x1:var _0x13156d=_0x19f137[_0x05d7('0x21')]?_['isArray'](_0x19f137[_0x05d7('0x21')])?_0x19f137[_0x05d7('0x21')][_0x05d7('0x33')]():_0x19f137['transport']:_0x05d7('0x20');if(_0x13156d===_0x05d7('0x40')){_0x13156d=_0x05d7('0x20');}this[_0x05d7('0x6')](_0x05d7('0x21'),_0x13156d);this[_0x05d7('0x6')]('encryption','no');this[_0x05d7('0x6')](_0x05d7('0x41'),null);this['setDataValue']('force_avp',null);this[_0x05d7('0x6')](_0x05d7('0x42'),null);this[_0x05d7('0x6')](_0x05d7('0x43'),null);this[_0x05d7('0x6')](_0x05d7('0x44'),null);this[_0x05d7('0x6')](_0x05d7('0x45'),null);this[_0x05d7('0x6')]('dtlscertfile',null);this[_0x05d7('0x6')](_0x05d7('0x46'),null);this[_0x05d7('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x05d7('0x6')](_0x05d7('0x21'),'wss');this['setDataValue']('encryption',_0x05d7('0x2a'));this['setDataValue']('avpf',_0x05d7('0x2a'));this[_0x05d7('0x6')](_0x05d7('0x47'),_0x05d7('0x2a'));this['setDataValue'](_0x05d7('0x42'),_0x05d7('0x2a'));this[_0x05d7('0x6')]('dtlsenable',_0x05d7('0x2a'));this['setDataValue'](_0x05d7('0x44'),'no');this['setDataValue'](_0x05d7('0x45'),_0x05d7('0x3e'));this[_0x05d7('0x6')](_0x05d7('0x48'),_0x19f137[_0x05d7('0x48')]||_0x05d7('0x49'));this[_0x05d7('0x6')](_0x05d7('0x46'),_0x19f137[_0x05d7('0x46')]||_0x05d7('0x4a'));this[_0x05d7('0x6')](_0x05d7('0x4b'),_0x05d7('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x05d7('0x4c')],'set':function(_0x2bd8ab){this['setDataValue'](_0x05d7('0x4d'),_0x2bd8ab?_0x2bd8ab[_0x05d7('0x33')](','):[]);},'get':function(){return this[_0x05d7('0xd')]('permissions')?_[_0x05d7('0x4e')](this['getDataValue'](_0x05d7('0x4d'))['split'](','),function(_0x346fa4){return parseInt(_0x346fa4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x05d7('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x05d7('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x05d7('0x10')](_0x05d7('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x05d7('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x05d7('0x4f')],'get':function(){return this['getDataValue'](_0x05d7('0x50'))?this[_0x05d7('0xd')](_0x05d7('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x05d7('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x05d7('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x501cd4){if(typeof _0x501cd4===_0x05d7('0x51')){var _0x46ae28=_0x501cd4==='1'?!![]:_0x501cd4==='0'?![]:_0x501cd4===_0x05d7('0x52')?!![]:_0x501cd4===_0x05d7('0x53')?![]:![];this[_0x05d7('0x6')](_0x05d7('0x54'),_0x46ae28);}else{this[_0x05d7('0x6')](_0x05d7('0x54'),_0x501cd4);}}},'blocked':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![],'set':function(_0x3e2a01){this[_0x05d7('0x6')](_0x05d7('0x55'),_0x3e2a01);if(_0x3e2a01===!![]){this[_0x05d7('0x6')](_0x05d7('0x56'),moment());this[_0x05d7('0x6')]('loginAttempts',0x0);}else{this[_0x05d7('0x6')](_0x05d7('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x05d7('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x05d7('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x05d7('0x17')](0x5)[_0x05d7('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x05d7('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a9e=['\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split','all','allow','join','ulaw;alaw;gsm','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','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','TEXT','get','isArray','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','wss','encryption','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','email','ENUM','admin','telephone','local','INTEGER','internal','accountcode'];(function(_0x53080e,_0x252127){var _0x1a0c14=function(_0x4f2236){while(--_0x4f2236){_0x53080e['push'](_0x53080e['shift']());}};_0x1a0c14(++_0x252127);}(_0x7a9e,0x162));var _0xe7a9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7a9e[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe7a9('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module[_0xe7a9('0x1')]={'name':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':![],'unique':_0xe7a9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x51271f){this[_0xe7a9('0x4')](_0xe7a9('0x3'),_0x51271f);this[_0xe7a9('0x4')](_0xe7a9('0x5'),_0x51271f);},'comment':_0xe7a9('0x6')},'fullname':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':![],'set':function(_0x3280af){this['setDataValue'](_0xe7a9('0x7'),_0x3280af);this[_0xe7a9('0x4')](_0xe7a9('0x8'),util[_0xe7a9('0x9')]('\x22%s\x22\x20<%s>',_0x3280af,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xe7a9('0x2')]},'email':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':![],'unique':_0xe7a9('0xa'),'validate':{'isEmail':!![]},'set':function(_0x5b553a){if(_0x5b553a){this[_0xe7a9('0x4')]('email',_0x5b553a['toLowerCase']());}}},'role':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0xc'),'user','agent',_0xe7a9('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe7a9('0x2')],'defaultValue':_0xe7a9('0xe')},'internal':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25d577){this[_0xe7a9('0x4')](_0xe7a9('0x10'),_0x25d577);this[_0xe7a9('0x4')](_0xe7a9('0x11'),_0x25d577);this[_0xe7a9('0x4')](_0xe7a9('0x8'),util[_0xe7a9('0x9')](_0xe7a9('0x12'),this[_0xe7a9('0x13')](_0xe7a9('0x7')),_0x25d577));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe7a9('0x2')]},'mobile':{'type':Sequelize[_0xe7a9('0x2')]},'address':{'type':Sequelize[_0xe7a9('0x2')]},'zipcode':{'type':Sequelize[_0xe7a9('0x2')]},'userpic':{'type':Sequelize[_0xe7a9('0x2')]},'city':{'type':Sequelize[_0xe7a9('0x2')]},'country':{'type':Sequelize[_0xe7a9('0x2')]},'online':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe7a9('0x15')},'lastPauseAt':{'type':Sequelize[_0xe7a9('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe7a9('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe7a9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![],'defaultValue':_0xe7a9('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xe7a9('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xe7a9('0x18'),_0xe7a9('0x19'),_0xe7a9('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x1b'),_0xe7a9('0x1c'),_0xe7a9('0x1d'),_0xe7a9('0x1e'),_0xe7a9('0x1f'),_0xe7a9('0x20'),'PROHIB_FAILED_SCREEN',_0xe7a9('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![],'defaultValue':_0xe7a9('0x22'),'set':function(_0x155d5d){this[_0xe7a9('0x4')]('transport',_0x155d5d?_0x155d5d['join'](','):null);},'get':function(){return this['getDataValue'](_0xe7a9('0x23'))?this[_0xe7a9('0x13')](_0xe7a9('0x23'))['split'](','):null;},'comment':_0xe7a9('0x24')},'dtmfmode':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x25'),_0xe7a9('0x26'),_0xe7a9('0x27'),_0xe7a9('0x28'),_0xe7a9('0x29')),'allowNull':!![],'defaultValue':_0xe7a9('0x25')},'directmedia':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no',_0xe7a9('0x2b'),_0xe7a9('0x2c'),_0xe7a9('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x355ce5){this[_0xe7a9('0x4')]('nat',_0x355ce5?_0x355ce5['join'](','):null);},'get':function(){return this[_0xe7a9('0x13')](_0xe7a9('0x2e'))?this[_0xe7a9('0x13')]('nat')[_0xe7a9('0x2f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe7a9('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe7a9('0x2')]},'pickupgroup':{'type':Sequelize[_0xe7a9('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe7a9('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe7a9('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe7a9('0x30')},'allow':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x814503){this[_0xe7a9('0x4')](_0xe7a9('0x31'),_0x814503?_0x814503[_0xe7a9('0x32')](';'):_0xe7a9('0x33'));},'get':function(){return this[_0xe7a9('0x13')](_0xe7a9('0x31'))?this[_0xe7a9('0x13')](_0xe7a9('0x31'))[_0xe7a9('0x2f')](';'):null;},'comment':_0xe7a9('0x34')},'autoframing':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![],'set':function(_0x2a5561){this[_0xe7a9('0x4')](_0xe7a9('0x35'),_0x2a5561?_0x2a5561['join'](','):null);},'get':function(){return this[_0xe7a9('0x13')](_0xe7a9('0x35'))?this[_0xe7a9('0x13')](_0xe7a9('0x35'))[_0xe7a9('0x2f')](','):null;},'comment':_0xe7a9('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no',_0xe7a9('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe7a9('0xb')]('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[_0xe7a9('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xe7a9('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no',_0xe7a9('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xe7a9('0x39'),_0xe7a9('0x3a'),_0xe7a9('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xe7a9('0x3c'),_0xe7a9('0x3d')),'allowNull':!![],'defaultValue':_0xe7a9('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xe7a9('0x2a')},'keepalive':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no',_0xe7a9('0x3e'),_0xe7a9('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x40'),_0xe7a9('0x41'),_0xe7a9('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe7a9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe7a9('0xb')](_0xe7a9('0x2a'),'no',_0xe7a9('0x2b'),_0xe7a9('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe7a9('0x2')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe7a9('0x43')]},'showWebBar':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0,'set':function(_0xe7af9c){this['setDataValue']('showWebBar',_0xe7af9c);var _0x50e1a4=this[_0xe7a9('0x44')]({'plain':!![]});switch(_0xe7af9c){case 0x0:case 0x1:var _0x572782=_0x50e1a4['transport']?_[_0xe7a9('0x45')](_0x50e1a4['transport'])?_0x50e1a4[_0xe7a9('0x23')][_0xe7a9('0x32')]():_0x50e1a4['transport']:'udp';if(_0x572782==='wss'){_0x572782=_0xe7a9('0x22');}this[_0xe7a9('0x4')]('transport',_0x572782);this[_0xe7a9('0x4')]('encryption','no');this[_0xe7a9('0x4')](_0xe7a9('0x46'),null);this[_0xe7a9('0x4')](_0xe7a9('0x47'),null);this[_0xe7a9('0x4')](_0xe7a9('0x48'),null);this[_0xe7a9('0x4')](_0xe7a9('0x49'),null);this['setDataValue'](_0xe7a9('0x4a'),null);this[_0xe7a9('0x4')]('dtlssetup',null);this[_0xe7a9('0x4')](_0xe7a9('0x4b'),null);this[_0xe7a9('0x4')]('dtlsprivatekey',null);this['setDataValue'](_0xe7a9('0x4c'),'no');break;case 0x2:this[_0xe7a9('0x4')](_0xe7a9('0x23'),_0xe7a9('0x4d'));this['setDataValue'](_0xe7a9('0x4e'),_0xe7a9('0x2a'));this[_0xe7a9('0x4')](_0xe7a9('0x46'),_0xe7a9('0x2a'));this[_0xe7a9('0x4')](_0xe7a9('0x47'),'yes');this[_0xe7a9('0x4')](_0xe7a9('0x48'),_0xe7a9('0x2a'));this[_0xe7a9('0x4')]('dtlsenable',_0xe7a9('0x2a'));this[_0xe7a9('0x4')](_0xe7a9('0x4a'),'no');this[_0xe7a9('0x4')]('dtlssetup',_0xe7a9('0x42'));this[_0xe7a9('0x4')](_0xe7a9('0x4b'),_0x50e1a4[_0xe7a9('0x4b')]||_0xe7a9('0x4f'));this[_0xe7a9('0x4')](_0xe7a9('0x50'),_0x50e1a4['dtlsprivatekey']||_0xe7a9('0x51'));this[_0xe7a9('0x4')](_0xe7a9('0x4c'),_0xe7a9('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xe7a9('0x43')],'set':function(_0x1057c6){this[_0xe7a9('0x4')](_0xe7a9('0x52'),_0x1057c6?_0x1057c6[_0xe7a9('0x32')](','):[]);},'get':function(){return this[_0xe7a9('0x13')](_0xe7a9('0x52'))?_[_0xe7a9('0x53')](this[_0xe7a9('0x13')](_0xe7a9('0x52'))[_0xe7a9('0x2f')](','),function(_0x1aeaf3){return parseInt(_0x1aeaf3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe7a9('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe7a9('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe7a9('0x54')],'get':function(){return this[_0xe7a9('0x13')](_0xe7a9('0x55'))?this[_0xe7a9('0x13')](_0xe7a9('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe7a9('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![],'set':function(_0x17e840){if(typeof _0x17e840===_0xe7a9('0x56')){var _0x233f53=_0x17e840==='1'?!![]:_0x17e840==='0'?![]:_0x17e840===_0xe7a9('0x57')?!![]:_0x17e840===_0xe7a9('0x58')?![]:![];this[_0xe7a9('0x4')](_0xe7a9('0x59'),_0x233f53);}else{this[_0xe7a9('0x4')](_0xe7a9('0x59'),_0x17e840);}}},'blocked':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![],'set':function(_0x1d71e0){this[_0xe7a9('0x4')](_0xe7a9('0x5a'),_0x1d71e0);if(_0x1d71e0===!![]){this[_0xe7a9('0x4')](_0xe7a9('0x5b'),moment());this[_0xe7a9('0x4')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xe7a9('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe7a9('0xf')](0x5)[_0xe7a9('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe7a9('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9e932e9..8fb00d6 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 _0xb6a7=['concat','getContacts','CmContact','fields','sort','where','pick','merge','hasOwnProperty','CmList','List','Tags','tag','nolimit','limit','getQueues','isValidChannel','order','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','UserId','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','format','LOCAL/%s@from-sip/n','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','lastPauseAt','manual','set','%s%s','getTeams','Team','addTeams','Voice','setDataValue','Chat','getMailQueues','Mail','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','removeTeams','getChatQueues','Sms','removeAgent','VoicePrefixId','getLists','getAgents','values','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lte','$ne','$not','$notBetween','$in','$iLike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','asc','desc','substring','uniqBy','orderBy','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','json','undefined','offset','count','Content-Range','update','destroy','get','role','admin','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','end','stack','name','send','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','includeAll','include','query','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','sms','dataValues','mail','openchannel','whatsapp','all','catch','params','model','differenceBy','keys','filters','intersection','options','chat','fax','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','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','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','101','103','113','110','104','105','107','108','109','111','114','115','checkUserLimits','settingsEnabled','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','userProfileId','isEmpty','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','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','updatePasswordsHistory','channel','online','loginInPause','voicePause','add','capitalize','toLowerCase','penalty','QueueId','Queue:save','voice','VoiceQueue','interface','each','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','Queues','emit','Queue:remove','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs'];(function(_0x546231,_0x3acef4){var _0x4ee4b0=function(_0x5eeb08){while(--_0x5eeb08){_0x546231['push'](_0x546231['shift']());}};_0x4ee4b0(++_0x3acef4);}(_0xb6a7,0xd4));var _0x7b6a=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xb6a7[_0x2b9b7f];return _0x4ed19a;};'use strict';var moment=require('moment');var BPromise=require(_0x7b6a('0x0'));var util=require(_0x7b6a('0x1'));var path=require(_0x7b6a('0x2'));var fs=require('fs');var _=require(_0x7b6a('0x3'));var squel=require(_0x7b6a('0x4'));var jayson=require('jayson/promise');var Redis=require(_0x7b6a('0x5'));var authService=require(_0x7b6a('0x6'));var qs=require(_0x7b6a('0x7'));var logger=require(_0x7b6a('0x8'))(_0x7b6a('0x9'));var utils=require('../../config/utils');var config=require(_0x7b6a('0xa'));var licenseUtil=require(_0x7b6a('0xb'));var db=require(_0x7b6a('0xc'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x7b6a('0xd')]));require(_0x7b6a('0xe'))[_0x7b6a('0xf')](socket);config['redis']=_[_0x7b6a('0x10')](config[_0x7b6a('0xd')],{'host':_0x7b6a('0x11'),'port':0x18eb});var client=jayson[_0x7b6a('0x12')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x177d1e,_0x193c3a,_0x2d4d3a,_0x16156d){return new BPromise(function(_0x4140b2,_0x366987){var _0xa72ded=_0x16156d||client;return _0xa72ded[_0x7b6a('0x13')](_0x177d1e,_0x2d4d3a)[_0x7b6a('0x14')](function(_0x53f689){logger[_0x7b6a('0x15')](_0x7b6a('0x16'),_0x193c3a,'request\x20sent');logger[_0x7b6a('0x17')](_0x7b6a('0x18'),_0x193c3a,_0x7b6a('0x19'),JSON[_0x7b6a('0x1a')](_0x53f689));if(_0x53f689[_0x7b6a('0x1b')]){if(_0x53f689[_0x7b6a('0x1b')]['code']===0x1f4){logger[_0x7b6a('0x1b')](_0x7b6a('0x16'),_0x193c3a,_0x53f689[_0x7b6a('0x1b')][_0x7b6a('0x1c')]);return _0x366987(_0x53f689[_0x7b6a('0x1b')]['message']);}logger['error']('User,\x20%s,\x20%s',_0x193c3a,_0x53f689[_0x7b6a('0x1b')][_0x7b6a('0x1c')]);return _0x4140b2(_0x53f689[_0x7b6a('0x1b')][_0x7b6a('0x1c')]);}else{logger[_0x7b6a('0x15')]('User,\x20%s,\x20%s',_0x193c3a,_0x7b6a('0x19'));_0x4140b2(_0x53f689['result']['message']);}})['catch'](function(_0x116d93){logger[_0x7b6a('0x1b')](_0x7b6a('0x16'),_0x193c3a,_0x116d93);_0x366987(_0x116d93);});});}function respondWithStatusCode(_0x45fde9,_0x18b4f3){_0x18b4f3=_0x18b4f3||0xcc;return function(_0x4e04b6){if(_0x4e04b6){return _0x45fde9[_0x7b6a('0x1d')](_0x18b4f3);}return _0x45fde9['status'](_0x18b4f3)['end']();};}function respondWithResult(_0x477ff3,_0x3c2279){_0x3c2279=_0x3c2279||0xc8;return function(_0xddd9ca){if(_0xddd9ca){return _0x477ff3[_0x7b6a('0x1e')](_0x3c2279)[_0x7b6a('0x1f')](_0xddd9ca);}};}function respondWithFilteredResult(_0x2fd358,_0xd55e5d){return function(_0x1a1abf){if(_0x1a1abf){var _0x1b4d70=typeof _0xd55e5d['offset']===_0x7b6a('0x20')&&typeof _0xd55e5d['limit']===_0x7b6a('0x20');var _0x5b30b5=_0x1a1abf['count'];var _0x21b270=_0x1b4d70?0x0:_0xd55e5d[_0x7b6a('0x21')];var _0x460c1d=_0x1b4d70?_0x1a1abf[_0x7b6a('0x22')]:_0xd55e5d[_0x7b6a('0x21')]+_0xd55e5d['limit'];var _0x56d99a;if(_0x460c1d>=_0x5b30b5){_0x460c1d=_0x5b30b5;_0x56d99a=0xc8;}else{_0x56d99a=0xce;}_0x2fd358['status'](_0x56d99a);return _0x2fd358['set'](_0x7b6a('0x23'),_0x21b270+'-'+_0x460c1d+'/'+_0x5b30b5)['json'](_0x1a1abf);}return null;};}function saveUpdates(_0x119430){return function(_0x41e3a1){if(_0x41e3a1){return _0x41e3a1[_0x7b6a('0x24')](_0x119430)[_0x7b6a('0x14')](function(_0x5bfc68){return _0x5bfc68;});}return null;};}function removeEntity(_0x1656ef){return function(_0x1b2908){if(_0x1b2908){return _0x1b2908[_0x7b6a('0x25')]()[_0x7b6a('0x14')](function(){var _0x43a796=_0x1b2908[_0x7b6a('0x26')]({'plain':!![]});if(_0x43a796[_0x7b6a('0x27')]===_0x7b6a('0x28'))return;var _0x3ea212=[{'name':'Users','value':_0x7b6a('0x29'),'ignore':!![]},{'name':_0x7b6a('0x2a'),'value':_0x7b6a('0x2b'),'ignore':![]},{'name':_0x7b6a('0x2c'),'value':_0x7b6a('0x2d'),'ignore':![]}];var _0x5c348f=_(_0x3ea212)[_0x7b6a('0x2e')](_0x7b6a('0x2f'))[_0x7b6a('0x30')]('value')[_0x7b6a('0x31')]();if(_[_0x7b6a('0x32')](_0x5c348f,_0x43a796[_0x7b6a('0x27')])){return;}var _0x58a75e=_[_0x7b6a('0x33')](_0x3ea212,['value',_0x43a796[_0x7b6a('0x27')]])['name'];return db[_0x7b6a('0x34')]['destroy']({'where':{'type':_0x58a75e,'resourceId':_0x43a796['id']}})[_0x7b6a('0x14')](function(){return _0x1b2908;});})[_0x7b6a('0x14')](function(){_0x1656ef[_0x7b6a('0x1e')](0xcc)[_0x7b6a('0x35')]();});}};}function handleEntityNotFound(_0x144481){return function(_0x39f92f){if(!_0x39f92f){_0x144481[_0x7b6a('0x1d')](0x194);}return _0x39f92f;};}function handleError(_0x32ca48,_0x4f6ef2){_0x4f6ef2=_0x4f6ef2||0x1f4;return function(_0xeeec41){logger[_0x7b6a('0x1b')](_0xeeec41[_0x7b6a('0x36')]);if(_0xeeec41['name']){delete _0xeeec41[_0x7b6a('0x37')];}_0x32ca48[_0x7b6a('0x1e')](_0x4f6ef2)[_0x7b6a('0x38')](_0xeeec41);};}exports[_0x7b6a('0x39')]=function(_0x2af847,_0x1b7a19){var _0x21e2f8={},_0x3ae38f={'count':0x0,'rows':[]};var _0x13eee8=_(db[_0x7b6a('0x3a')][_0x7b6a('0x3b')])[_0x7b6a('0x30')](function(_0xfadf42){return{'name':_0xfadf42[_0x7b6a('0x3c')],'type':_0xfadf42[_0x7b6a('0x3d')][_0x7b6a('0x3e')]};})[_0x7b6a('0x2e')](function(_0x3eb3da){return!_[_0x7b6a('0x32')]([_0x7b6a('0x3f'),_0x7b6a('0x40')],_0x3eb3da[_0x7b6a('0x37')]);})['value']();_0x21e2f8=qs[_0x7b6a('0x41')](_0x13eee8,_0x2af847);var _0x530c05={'where':_0x21e2f8['where']};return db[_0x7b6a('0x3a')][_0x7b6a('0x22')](_0x530c05)[_0x7b6a('0x14')](function(_0xfdd3b2){_0x3ae38f[_0x7b6a('0x22')]=_0xfdd3b2;if(_0x2af847['query'][_0x7b6a('0x42')]){_0x21e2f8[_0x7b6a('0x43')]=[{'all':!![]}];}if(_0x2af847[_0x7b6a('0x44')]['userSetting']===_0x7b6a('0x45')){_0x21e2f8[_0x7b6a('0x43')]=[{'model':db[_0x7b6a('0x46')],'as':_0x7b6a('0x47')}];}if(!_[_0x7b6a('0x32')](_0x21e2f8[_0x7b6a('0x48')],'id')){_0x21e2f8[_0x7b6a('0x48')][_0x7b6a('0x49')]('id');}return db['User'][_0x7b6a('0x4a')](_0x21e2f8);})[_0x7b6a('0x14')](function(_0x3e4511){_0x3ae38f[_0x7b6a('0x4b')]=_0x3e4511;if(_0x2af847['query'][_0x7b6a('0x4c')]===_0x7b6a('0x45')){var _0x3622c2=[];for(var _0x392f51=0x0;_0x392f51<_0x3ae38f[_0x7b6a('0x4b')][_0x7b6a('0x4d')];_0x392f51++){_0x3622c2[_0x7b6a('0x49')](get_open_tabs('chat',_0x3ae38f[_0x7b6a('0x4b')][_0x392f51]['dataValues']));_0x3622c2['push'](get_open_tabs(_0x7b6a('0x4e'),_0x3ae38f[_0x7b6a('0x4b')][_0x392f51][_0x7b6a('0x4f')]));_0x3622c2[_0x7b6a('0x49')](get_open_tabs('fax',_0x3ae38f[_0x7b6a('0x4b')][_0x392f51][_0x7b6a('0x4f')]));_0x3622c2['push'](get_open_tabs(_0x7b6a('0x50'),_0x3ae38f[_0x7b6a('0x4b')][_0x392f51][_0x7b6a('0x4f')]));_0x3622c2[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x51'),_0x3ae38f[_0x7b6a('0x4b')][_0x392f51][_0x7b6a('0x4f')]));_0x3622c2['push'](get_open_tabs(_0x7b6a('0x52'),_0x3ae38f[_0x7b6a('0x4b')][_0x392f51][_0x7b6a('0x4f')]));}return BPromise[_0x7b6a('0x53')](_0x3622c2)[_0x7b6a('0x14')](function(){return _0x3ae38f;});}else{return _0x3ae38f;}})['then'](respondWithFilteredResult(_0x1b7a19,_0x21e2f8))[_0x7b6a('0x54')](handleError(_0x1b7a19,null));};exports['show']=function(_0x149eb4,_0x744ab4){var _0x50874d={'raw':![],'where':{'id':_0x149eb4[_0x7b6a('0x55')]['id']}},_0x53c7a8={};_0x53c7a8[_0x7b6a('0x56')]=_[_0x7b6a('0x57')](_[_0x7b6a('0x58')](db[_0x7b6a('0x3a')][_0x7b6a('0x3b')]),[_0x7b6a('0x3f'),_0x7b6a('0x40')]);_0x53c7a8['query']=_[_0x7b6a('0x58')](_0x149eb4[_0x7b6a('0x44')]);_0x53c7a8[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x53c7a8[_0x7b6a('0x56')],_0x53c7a8[_0x7b6a('0x44')]);_0x50874d[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x53c7a8['model'],qs['fields'](_0x149eb4[_0x7b6a('0x44')]['fields']));_0x50874d[_0x7b6a('0x48')]=_0x50874d[_0x7b6a('0x48')]['length']?_0x50874d[_0x7b6a('0x48')]:_0x53c7a8[_0x7b6a('0x56')];if(_0x149eb4[_0x7b6a('0x44')][_0x7b6a('0x42')]){_0x50874d['include']=[{'all':!![]}];}if(_0x149eb4['query']['userSetting']==='true'){_0x50874d[_0x7b6a('0x43')]=[{'model':db[_0x7b6a('0x46')],'as':_0x7b6a('0x47')}];}_0x50874d=_['merge']({},_0x50874d,_0x149eb4[_0x7b6a('0x5b')]);if(!_[_0x7b6a('0x32')](_0x50874d[_0x7b6a('0x48')],'id')){_0x50874d['attributes'][_0x7b6a('0x49')]('id');}return db[_0x7b6a('0x3a')]['find'](_0x50874d)[_0x7b6a('0x14')](handleEntityNotFound(_0x744ab4,null))[_0x7b6a('0x14')](function(_0x1cf31d){var _0x57de3a=[];values=_0x1cf31d;if(_0x149eb4[_0x7b6a('0x44')]['openTabs']===_0x7b6a('0x45')){_0x57de3a['push'](get_open_tabs(_0x7b6a('0x5c'),_0x1cf31d[_0x7b6a('0x4f')]));_0x57de3a[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x4e'),_0x1cf31d[_0x7b6a('0x4f')]));_0x57de3a[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x51'),_0x1cf31d[_0x7b6a('0x4f')]));_0x57de3a[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x52'),_0x1cf31d['dataValues']));_0x57de3a[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x5d'),_0x1cf31d[_0x7b6a('0x4f')]));_0x57de3a['push'](get_open_tabs('mail',_0x1cf31d['dataValues']));return BPromise[_0x7b6a('0x53')](_0x57de3a);}else{return values;}})[_0x7b6a('0x14')](function(){return values;})[_0x7b6a('0x14')](respondWithResult(_0x744ab4,null))[_0x7b6a('0x54')](handleError(_0x744ab4,null));};exports['update']=function(_0x94616e,_0x44010f){if(_0x94616e['body']['id']){delete _0x94616e[_0x7b6a('0x5e')]['id'];}delete _0x94616e[_0x7b6a('0x5e')]['role'];return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x94616e['params']['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x44010f,null))['then'](saveUpdates(_0x94616e[_0x7b6a('0x5e')],null))[_0x7b6a('0x14')](respondWithResult(_0x44010f,null))[_0x7b6a('0x54')](handleError(_0x44010f,null));};exports[_0x7b6a('0x5f')]=function(_0x2fbd05,_0x9c52ad){return db[_0x7b6a('0x3a')][_0x7b6a('0x5f')]()['then'](respondWithResult(_0x9c52ad,null))[_0x7b6a('0x54')](handleError(_0x9c52ad,null));};exports[_0x7b6a('0x60')]=function(_0xa618f1,_0x1ec835){return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0xa618f1[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x1ec835,null))[_0x7b6a('0x14')](function(_0x5e4cf9){if(_0x5e4cf9){return _0x5e4cf9['addContacts'](_0xa618f1[_0x7b6a('0x5e')]['ids'],_[_0x7b6a('0x61')](_0xa618f1[_0x7b6a('0x5e')],[_0x7b6a('0x62'),'id'])||{});}})[_0x7b6a('0x14')](respondWithResult(_0x1ec835,null))[_0x7b6a('0x54')](handleError(_0x1ec835,null));};function validateUser(_0x8de304){return new BPromise(function(_0x417f35,_0x3a5272){if(_0x8de304[_0x7b6a('0x63')])return _0x417f35(_0x8de304);return db[_0x7b6a('0x64')][_0x7b6a('0x65')](0x1)[_0x7b6a('0x14')](function(_0x2bca1c){if(_0x2bca1c[_0x7b6a('0x66')])authService[_0x7b6a('0x67')](_0x8de304[_0x7b6a('0x3f')]);db[_0x7b6a('0x3a')]['max'](_0x7b6a('0x63'))[_0x7b6a('0x14')](function(_0x4fc28f){if(_[_0x7b6a('0x68')](_0x4fc28f)){_0x8de304['internal']=_0x2bca1c[_0x7b6a('0x69')]||0x1;return;}if(_['isNil'](_0x2bca1c[_0x7b6a('0x69')])||_0x2bca1c[_0x7b6a('0x69')]===_0x4fc28f){_0x8de304[_0x7b6a('0x63')]=_0x4fc28f+0x1;return;}if(_0x2bca1c[_0x7b6a('0x69')]>_0x4fc28f){_0x8de304[_0x7b6a('0x63')]=_0x2bca1c[_0x7b6a('0x69')];return;}return db['sequelize'][_0x7b6a('0x44')](_0x7b6a('0x6a'),{'type':db[_0x7b6a('0x6b')][_0x7b6a('0x6c')][_0x7b6a('0x6d')]})[_0x7b6a('0x14')](function(_0xa95122){if(_0xa95122&&_0xa95122[_0x7b6a('0x4d')]){for(var _0x218ad7=0x0,_0x3f31b4=_0xa95122[_0x7b6a('0x4d')];_0x218ad7<_0x3f31b4&&_[_0x7b6a('0x68')](_0x8de304[_0x7b6a('0x63')]);_0x218ad7++){if(_0x2bca1c[_0x7b6a('0x69')]<=_0xa95122[_0x218ad7][_0x7b6a('0x6e')]){_0x8de304[_0x7b6a('0x63')]=_0xa95122[_0x218ad7][_0x7b6a('0x6e')];}else if(_0x2bca1c[_0x7b6a('0x69')]>_0xa95122[_0x218ad7][_0x7b6a('0x6e')]&&_0x2bca1c[_0x7b6a('0x69')]<=_0xa95122[_0x218ad7]['to']){_0x8de304[_0x7b6a('0x63')]=_0x2bca1c['min_internal'];}}}if(_[_0x7b6a('0x68')](_0x8de304[_0x7b6a('0x63')])){_0x8de304[_0x7b6a('0x63')]=_0x4fc28f+0x1;}return _0x417f35(_0x8de304);});});})[_0x7b6a('0x54')](function(_0x91e272){_0x3a5272(_0x91e272);});});}function updateUser(_0x420a6b){return new BPromise(function(_0x2ff976,_0x5104c5){try{if(_0x420a6b[_0x7b6a('0x6f')]){_0x420a6b['mailbox']=_0x420a6b[_0x7b6a('0x63')];_0x420a6b[_0x7b6a('0x70')]={'mailbox':_0x420a6b[_0x7b6a('0x63')],'password':_0x420a6b['password'],'fullname':_0x420a6b[_0x7b6a('0x71')],'email':_0x420a6b[_0x7b6a('0x72')]};}if(_0x420a6b['role']==='agent'){if(!_0x420a6b[_0x7b6a('0x73')])_0x420a6b[_0x7b6a('0x73')]=[_0x7b6a('0x74'),'102',_0x7b6a('0x75'),_0x7b6a('0x76'),_0x7b6a('0x77'),_0x7b6a('0x78'),_0x7b6a('0x79'),'106',_0x7b6a('0x7a'),_0x7b6a('0x7b'),_0x7b6a('0x7c'),'100',_0x7b6a('0x7d'),_0x7b6a('0x7e'),_0x7b6a('0x7f')];}_0x2ff976(_0x420a6b);}catch(_0x46189e){_0x5104c5(_0x46189e);}});}exports['create']=function(_0x596fe5,_0x36a515){if(_0x596fe5[_0x7b6a('0x29')][_0x7b6a('0x27')]===_0x7b6a('0x2b'))throw new Error('Unauthorized');if(_0x596fe5[_0x7b6a('0x5e')]['role']===_0x7b6a('0x29')&&_0x596fe5[_0x7b6a('0x29')][_0x7b6a('0x27')]!==_0x7b6a('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x596fe5[_0x7b6a('0x5e')][_0x7b6a('0x27')]===_0x7b6a('0x28')&&_0x596fe5[_0x7b6a('0x29')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x7b6a('0x80')]([_0x596fe5[_0x7b6a('0x5e')]])[_0x7b6a('0x14')](function(){return validateUser(_0x596fe5[_0x7b6a('0x5e')]);})[_0x7b6a('0x14')](function(_0x2f1443){return updateUser(_0x2f1443)['then'](function(_0x12dafd){if(_0x12dafd['role']===_0x7b6a('0x28')){_0x12dafd[_0x7b6a('0x81')]=_0x596fe5[_0x7b6a('0x29')]['settingsEnabled'];delete _0x12dafd['userProfileId'];}return _0x12dafd;});})[_0x7b6a('0x14')](function(_0x1538cd){return db[_0x7b6a('0x3a')][_0x7b6a('0x82')](_0x1538cd,{'include':[{'model':db[_0x7b6a('0x70')],'as':'VoiceMail'}]});})[_0x7b6a('0x14')](function(_0x4d82df){if(_0x596fe5[_0x7b6a('0x5e')][_0x7b6a('0x27')]==='user')return _0x4d82df;if(_0x596fe5['user'][_0x7b6a('0x27')]!==_0x7b6a('0x29'))return _0x4d82df;return db[_0x7b6a('0x83')]['find']({'where':{'name':_0x4d82df[_0x7b6a('0x27')]===_0x7b6a('0x2b')?_0x7b6a('0x2a'):_0x7b6a('0x2c'),'userProfileId':_0x596fe5[_0x7b6a('0x29')]['userProfileId']},'raw':!![]})['then'](function(_0xafffed){if(!_0xafffed||_0xafffed[_0x7b6a('0x84')]!=0x0)return _0x4d82df;return db[_0x7b6a('0x34')][_0x7b6a('0x82')]({'name':_0x4d82df[_0x7b6a('0x37')],'resourceId':_0x4d82df['id'],'type':_0xafffed[_0x7b6a('0x37')],'sectionId':_0xafffed['id']},{})[_0x7b6a('0x14')](function(){return _0x4d82df;});})[_0x7b6a('0x54')](function(_0x3135a6){logger['error'](_0x7b6a('0x85'),_0x3135a6);throw _0x3135a6;});})[_0x7b6a('0x14')](respondWithResult(_0x36a515,0xc9))[_0x7b6a('0x54')](handleError(_0x36a515,null));};exports[_0x7b6a('0x86')]=function(_0x666abd,_0x5e9c56){var _0x10db50=_0x666abd[_0x7b6a('0x5e')];var _0x5ae98d=[];if(_0x666abd[_0x7b6a('0x29')]['role']===_0x7b6a('0x2b'))throw new Error('Unauthorized');if(_[_0x7b6a('0x87')](_0x10db50,[_0x7b6a('0x27'),_0x7b6a('0x29')])&&_0x666abd[_0x7b6a('0x29')][_0x7b6a('0x27')]!==_0x7b6a('0x28')){throw new Error(_0x7b6a('0x88'));}if(_[_0x7b6a('0x87')](_0x10db50,[_0x7b6a('0x27'),_0x7b6a('0x28')])&&_0x666abd['user'][_0x7b6a('0x27')]!=='admin'){throw new Error(_0x7b6a('0x89'));}return licenseUtil[_0x7b6a('0x80')](_0x10db50)[_0x7b6a('0x14')](function(){return validateUser(_0x10db50[0x0]);})[_0x7b6a('0x14')](function(){for(var _0x1fabc6=0x1;_0x1fabc6<_0x10db50[_0x7b6a('0x4d')];_0x1fabc6++){var _0x20c92f=_0x10db50[_0x1fabc6-0x1][_0x7b6a('0x63')];if(!_0x10db50[_0x1fabc6][_0x7b6a('0x63')])_0x10db50[_0x1fabc6][_0x7b6a('0x63')]=_0x20c92f+0x1;_0x5ae98d['push'](validateUser(_0x10db50[_0x1fabc6]));}return BPromise[_0x7b6a('0x53')](_0x5ae98d);})['then'](function(){_0x5ae98d=[];for(var _0x4c8dec=0x0;_0x4c8dec<_0x10db50['length'];_0x4c8dec++){_0x5ae98d[_0x7b6a('0x49')](updateUser(_0x10db50[_0x4c8dec]));}return BPromise[_0x7b6a('0x53')](_0x5ae98d);})['then'](function(){return BPromise['each'](_0x10db50,function(_0x113df1){return db[_0x7b6a('0x3a')][_0x7b6a('0x82')](_0x113df1,{'include':[{'model':db['VoiceMail'],'as':_0x7b6a('0x70')}]})[_0x7b6a('0x14')](function(_0x5bdfb2){_0x113df1['id']=_0x5bdfb2['id'];return _0x113df1;});});})['then'](function(_0x4a238a){if(_0x666abd[_0x7b6a('0x5e')][_0x7b6a('0x27')]==='user')return _0x4a238a;if(_0x666abd[_0x7b6a('0x29')][_0x7b6a('0x27')]!==_0x7b6a('0x29'))return _0x4a238a;var _0x24210e=_[_0x7b6a('0x87')](_0x4a238a,function(_0x330d2c){return _0x330d2c[_0x7b6a('0x27')]==='agent'||_0x330d2c[_0x7b6a('0x27')]===_0x7b6a('0x2d');});if(!_0x24210e)return _0x4a238a;return db[_0x7b6a('0x83')][_0x7b6a('0x4a')]({'where':{'name':{'$or':['Agents',_0x7b6a('0x2c')]},'userProfileId':_0x666abd[_0x7b6a('0x29')][_0x7b6a('0x8a')]},'raw':!![]})[_0x7b6a('0x14')](function(_0x34e582){if(_[_0x7b6a('0x8b')](_0x34e582)||!_[_0x7b6a('0x87')](_0x34e582,[_0x7b6a('0x84'),0x0]))return _0x4a238a;_0x5ae98d=[];var _0x42c016=_(_0x34e582)[_0x7b6a('0x30')](function(_0x338a49){if(_0x338a49[_0x7b6a('0x84')]===0x1)return;return _0x338a49[_0x7b6a('0x37')]===_0x7b6a('0x2a')?_0x7b6a('0x2b'):'telephone';})['compact']()['value']();for(var _0x3432d6=0x0;_0x3432d6<_0x4a238a['length'];_0x3432d6++){if(!_[_0x7b6a('0x32')](_0x42c016,_0x4a238a[_0x3432d6][_0x7b6a('0x27')]))return;var _0x327874=_0x4a238a[_0x3432d6]['role']===_0x7b6a('0x2b')?_0x7b6a('0x2a'):_0x7b6a('0x2c');_0x5ae98d[_0x7b6a('0x49')](db[_0x7b6a('0x34')]['create']({'name':_0x4a238a[_0x3432d6]['name'],'resourceId':_0x4a238a[_0x3432d6]['id'],'type':_0x327874,'sectionId':_['find'](_0x34e582,[_0x7b6a('0x37'),_0x327874])['id']},{}));}return BPromise['all'](_0x5ae98d);});})[_0x7b6a('0x14')](respondWithResult(_0x5e9c56,0xc9))[_0x7b6a('0x54')](handleError(_0x5e9c56,null));};exports[_0x7b6a('0x8c')]=function(_0x28274a,_0x2249b4){if(_0x28274a[_0x7b6a('0x5e')]['id']){delete _0x28274a[_0x7b6a('0x5e')]['id'];}return db['User'][_0x7b6a('0x33')]({'where':{'id':_0x28274a['params']['id']}})['then'](function(_0x32dba3){if(!_0x32dba3)return null;if(_0x32dba3['id']===_0x28274a[_0x7b6a('0x29')]['id']){if(!_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8d')]||!_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')]){throw new db[(_0x7b6a('0x8f'))][(_0x7b6a('0x90'))](_0x7b6a('0x91'));}if(!_0x32dba3[_0x7b6a('0x92')](_0x28274a[_0x7b6a('0x5e')]['oldPassword'])){throw new db[(_0x7b6a('0x8f'))]['ValidationError'](_0x7b6a('0x93'));}if(_0x28274a['body'][_0x7b6a('0x8d')]===_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')]){throw new db[(_0x7b6a('0x8f'))][(_0x7b6a('0x90'))](_0x7b6a('0x94'));}}else if(_0x28274a[_0x7b6a('0x29')]['role']===_0x7b6a('0x28')){if(!_0x28274a['body']['newPassword']){throw new db[(_0x7b6a('0x8f'))][(_0x7b6a('0x90'))](_0x7b6a('0x95'));}}else if(_0x28274a[_0x7b6a('0x29')][_0x7b6a('0x27')]==='user'){if(!_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')]){throw new db[(_0x7b6a('0x8f'))]['ValidationError'](_0x7b6a('0x95'));}if(_0x32dba3[_0x7b6a('0x27')]!=='agent'){throw new db[(_0x7b6a('0x8f'))]['ValidationError'](_0x7b6a('0x96'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x32dba3;})['then'](handleEntityNotFound(_0x2249b4,null))[_0x7b6a('0x14')](function(_0x382edc){return db['Setting'][_0x7b6a('0x97')]({'attributes':['id',_0x7b6a('0x66'),_0x7b6a('0x98'),_0x7b6a('0x99')]})[_0x7b6a('0x14')](function(_0x16d8c0){if(_0x16d8c0[_0x7b6a('0x66')])authService[_0x7b6a('0x67')](_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')]);if(!_0x16d8c0[_0x7b6a('0x98')]||!_0x382edc['previousPasswords'])return _0x382edc;authService[_0x7b6a('0x9a')](_0x28274a[_0x7b6a('0x5e')]['newPassword'],_0x382edc[_0x7b6a('0x9b')],_0x16d8c0[_0x7b6a('0x99')]);return _0x382edc;})[_0x7b6a('0x14')](saveUpdates({'password':_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')],'passwordResetAt':_0x28274a[_0x7b6a('0x29')]['id']==_0x28274a[_0x7b6a('0x55')]['id']?moment():null,'previousPasswords':authService[_0x7b6a('0x9c')](_0x28274a[_0x7b6a('0x5e')][_0x7b6a('0x8e')],_0x382edc[_0x7b6a('0x9b')])},null));})[_0x7b6a('0x14')](respondWithResult(_0x2249b4,null))[_0x7b6a('0x54')](handleError(_0x2249b4,null));};exports['addQueues']=function(_0x38e97b,_0x46e720){var _0x5d56f5=_0x38e97b[_0x7b6a('0x5e')][_0x7b6a('0x9d')];return db['User'][_0x7b6a('0x33')]({'where':{'id':_0x38e97b[_0x7b6a('0x55')]['id']},'attributes':['id',_0x7b6a('0x37'),_0x7b6a('0x27'),_0x7b6a('0x9e'),_0x7b6a('0x9f'),_0x7b6a('0xa0'),'interface']})[_0x7b6a('0x14')](handleEntityNotFound(_0x46e720,null))[_0x7b6a('0x14')](function(_0x2bf9ee){if(_0x2bf9ee){if(!utils['isValidChannel'](_0x5d56f5)){throw new db[(_0x7b6a('0x8f'))][(_0x7b6a('0x90'))]('Unknown\x20channel');}return _0x2bf9ee[_0x7b6a('0xa1')+_[_0x7b6a('0xa2')](_0x5d56f5[_0x7b6a('0xa3')]())+'Queues'](_0x38e97b['body']['ids'],{'penalty':_0x38e97b['body'][_0x7b6a('0xa4')]||0x0})['spread'](function(_0x2e436d){for(var _0x200722=0x0;_0x200722<_0x38e97b['body'][_0x7b6a('0x62')][_0x7b6a('0x4d')];_0x200722+=0x1){var _0x420bcb={'UserId':Number(_0x38e97b[_0x7b6a('0x55')]['id'])};_0x420bcb[_[_0x7b6a('0xa2')](_0x5d56f5[_0x7b6a('0xa3')]())+_0x7b6a('0xa5')]=Number(_0x38e97b['body']['ids'][_0x200722]);socket['emit'](_0x7b6a('0x29')+_['capitalize'](_0x5d56f5[_0x7b6a('0xa3')]())+_0x7b6a('0xa6'),_0x420bcb);}return _0x2e436d;})[_0x7b6a('0x14')](function(){if(_0x5d56f5===_0x7b6a('0xa7')){return db[_0x7b6a('0xa8')][_0x7b6a('0x4a')]({'where':{'id':_0x38e97b[_0x7b6a('0x5e')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x7b6a('0x14')](function(_0x2d4065){var _0x1956ed=_0x2bf9ee[_0x7b6a('0x26')]({'plain':!![]});var _0xfc8d31=[];if(_0x5d56f5===_0x7b6a('0xa7')&&_0x1956ed['role']===_0x7b6a('0x2b')&&_0x1956ed[_0x7b6a('0x9e')]){for(var _0x13fa47=0x0;_0x13fa47<_0x2d4065[_0x7b6a('0x4d')];_0x13fa47+=0x1){_0xfc8d31[_0x7b6a('0x49')]({'membername':_0x1956ed[_0x7b6a('0x37')],'UserId':_0x1956ed['id'],'queue_name':_0x2d4065[_0x13fa47][_0x7b6a('0x37')],'VoiceQueueId':_0x2d4065[_0x13fa47]['id'],'interface':_[_0x7b6a('0x68')](_0x1956ed[_0x7b6a('0xa9')])?util['format']('SIP/%s',_0x1956ed[_0x7b6a('0x37')]):_0x1956ed['interface'],'paused':_0x1956ed[_0x7b6a('0xa0')]||![],'penalty':_0x38e97b['body'][_0x7b6a('0xa4')]||0x0});}return BPromise[_0x7b6a('0xaa')](_0xfc8d31,function(_0x39f220){return db[_0x7b6a('0xab')][_0x7b6a('0xac')](_0x39f220);});}return _0x2bf9ee;});}})[_0x7b6a('0x14')](respondWithStatusCode(_0x46e720,null))[_0x7b6a('0x54')](handleError(_0x46e720,null));};exports[_0x7b6a('0xad')]=function(_0x135290,_0x3a484){var _0xc9c6db,_0x44541d;return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x135290[_0x7b6a('0x55')]['id']},'attributes':['id',_0x7b6a('0x37'),'role']})[_0x7b6a('0x14')](handleEntityNotFound(_0x3a484,null))[_0x7b6a('0x14')](function(_0x2b5482){if(_0x2b5482){_0xc9c6db=_0x2b5482;if(!_0x135290['query'][_0x7b6a('0x9d')]||!utils['isValidChannel'](_0x135290['query'][_0x7b6a('0x9d')])){throw new db[(_0x7b6a('0x8f'))]['ValidationError'](_0x7b6a('0xae'));}return _0x2b5482['remove'+_[_0x7b6a('0xa2')](_0x135290[_0x7b6a('0x44')]['channel'][_0x7b6a('0xa3')]())+_0x7b6a('0xaf')](_0x135290[_0x7b6a('0x44')][_0x7b6a('0x62')]);}})[_0x7b6a('0x14')](function(_0x2bd8a8){if(_['isArray'](_0x135290['query'][_0x7b6a('0x62')])){for(var _0x205115=0x0;_0x205115<_0x135290[_0x7b6a('0x44')][_0x7b6a('0x62')][_0x7b6a('0x4d')];_0x205115+=0x1){_0x44541d={'UserId':Number(_0x135290[_0x7b6a('0x55')]['id'])};_0x44541d[_[_0x7b6a('0xa2')](_0x135290[_0x7b6a('0x44')][_0x7b6a('0x9d')][_0x7b6a('0xa3')]())+_0x7b6a('0xa5')]=Number(_0x135290[_0x7b6a('0x44')][_0x7b6a('0x62')][_0x205115]);socket[_0x7b6a('0xb0')](_0x7b6a('0x29')+_[_0x7b6a('0xa2')](_0x135290['query'][_0x7b6a('0x9d')][_0x7b6a('0xa3')]())+'Queue:remove',_0x44541d);}}else{_0x44541d={'UserId':Number(_0x135290[_0x7b6a('0x55')]['id'])};_0x44541d[_['capitalize'](_0x135290['query'][_0x7b6a('0x9d')][_0x7b6a('0xa3')]())+_0x7b6a('0xa5')]=Number(_0x135290[_0x7b6a('0x44')][_0x7b6a('0x62')]);socket['emit'](_0x7b6a('0x29')+_[_0x7b6a('0xa2')](_0x135290['query'][_0x7b6a('0x9d')]['toLowerCase']())+_0x7b6a('0xb1'),_0x44541d);}return _0x2bd8a8;})[_0x7b6a('0x14')](function(){if(_0x135290[_0x7b6a('0x44')][_0x7b6a('0x9d')]===_0x7b6a('0xa7')){return db[_0x7b6a('0xab')][_0x7b6a('0x25')]({'where':{'UserId':_0x135290[_0x7b6a('0x55')]['id'],'VoiceQueueId':_0x135290[_0x7b6a('0x44')][_0x7b6a('0x62')]},'individualHooks':!![]})[_0x7b6a('0x14')](function(){return _0xc9c6db;});}return _0xc9c6db;})[_0x7b6a('0x14')](respondWithStatusCode(_0x3a484,null))['catch'](handleError(_0x3a484,null));};exports['addAvatar']=function(_0x14d9d7,_0x4742b9){_0x14d9d7[_0x7b6a('0x5e')][_0x7b6a('0xb2')]=_0x14d9d7['file']['filename'];return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x14d9d7[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x4742b9,null))[_0x7b6a('0x14')](saveUpdates(_0x14d9d7[_0x7b6a('0x5e')],null))[_0x7b6a('0x14')](respondWithResult(_0x4742b9,null))[_0x7b6a('0x54')](handleError(_0x4742b9,null));};exports[_0x7b6a('0xb3')]=function(_0x5f5cd2,_0x3e34bb){var _0x275706=path[_0x7b6a('0xb4')](config[_0x7b6a('0xb5')],_0x7b6a('0xb6'));return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x5f5cd2['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x7b6a('0x14')](handleEntityNotFound(_0x3e34bb,null))['then'](function(_0x4cbf79){if(_0x4cbf79){if(_['isNil'](_0x4cbf79[_0x7b6a('0xb2')])){return _0x3e34bb[_0x7b6a('0xb7')](_0x275706);}else{if(!fs[_0x7b6a('0xb8')](path[_0x7b6a('0xb4')](config['root'],_0x7b6a('0xb9'),_0x4cbf79[_0x7b6a('0xb2')]))){return _0x3e34bb[_0x7b6a('0xb7')](_0x275706);}return _0x3e34bb[_0x7b6a('0xb7')](path[_0x7b6a('0xb4')](config[_0x7b6a('0xb5')],_0x7b6a('0xb9'),_0x4cbf79[_0x7b6a('0xb2')]));}}})[_0x7b6a('0x54')](handleError(_0x3e34bb,null));};exports[_0x7b6a('0xba')]=function(_0x55a727,_0x31b5e1){return db[_0x7b6a('0x3a')]['find']({'where':{'id':_0x55a727[_0x7b6a('0x55')]['id']},'attributes':['id']})[_0x7b6a('0x14')](handleEntityNotFound(_0x31b5e1,null))['then'](function(_0x1f2b68){var _0x3deed5=[];values=_0x1f2b68[_0x7b6a('0x4f')];_0x3deed5['push'](get_open_tabs('chat',_0x1f2b68[_0x7b6a('0x4f')]));_0x3deed5[_0x7b6a('0x49')](get_open_tabs('sms',_0x1f2b68[_0x7b6a('0x4f')]));_0x3deed5[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x51'),_0x1f2b68['dataValues']));_0x3deed5['push'](get_open_tabs(_0x7b6a('0x52'),_0x1f2b68[_0x7b6a('0x4f')]));_0x3deed5[_0x7b6a('0x49')](get_open_tabs(_0x7b6a('0x5d'),_0x1f2b68[_0x7b6a('0x4f')]));_0x3deed5['push'](get_open_tabs(_0x7b6a('0x50'),_0x1f2b68[_0x7b6a('0x4f')]));return BPromise[_0x7b6a('0x53')](_0x3deed5);})['then'](function(_0x3c3a58){if(_0x3c3a58){var _0x5d7e00=_[_0x7b6a('0x30')](values['ChatOpenTabs'],function(_0x5ff647){return{'channel':'CHAT','id':_0x5ff647['id'],'createdAt':_0x5ff647['createdAt']};});var _0x2db0dd=_[_0x7b6a('0x30')](values[_0x7b6a('0xbb')],function(_0x1ee0c7){return{'channel':'FAX','id':_0x1ee0c7['id'],'createdAt':_0x1ee0c7[_0x7b6a('0xbc')]};});var _0x27c9cb=_[_0x7b6a('0x30')](values[_0x7b6a('0xbd')],function(_0x5c8976){return{'channel':_0x7b6a('0xbe'),'id':_0x5c8976['id'],'createdAt':_0x5c8976['createdAt']};});var _0x8dffe8=_[_0x7b6a('0x30')](values[_0x7b6a('0xbf')],function(_0x585d23){return{'channel':'MAIL','id':_0x585d23['id'],'createdAt':_0x585d23[_0x7b6a('0xbc')]};});var _0x324654=_[_0x7b6a('0x30')](values[_0x7b6a('0xc0')],function(_0x5adc7e){return{'channel':_0x7b6a('0xc1'),'id':_0x5adc7e['id'],'createdAt':_0x5adc7e[_0x7b6a('0xbc')]};});var _0x4a103a=_[_0x7b6a('0x30')](values[_0x7b6a('0xc2')],function(_0x2313f3){return{'channel':'WHATSAPP','id':_0x2313f3['id'],'createdAt':_0x2313f3[_0x7b6a('0xbc')]};});var _0x5d5a25=_[_0x7b6a('0xc3')](_0x5d7e00,_0x2db0dd,_0x27c9cb,_0x8dffe8,_0x324654,_0x4a103a);var _0x247dcb={'count':_0x5d5a25['length'],'rows':_0x5d5a25};return _0x247dcb;}else return null;})[_0x7b6a('0x14')](respondWithResult(_0x31b5e1,null))['catch'](handleError(_0x31b5e1,null));};exports[_0x7b6a('0xc4')]=function(_0x4db313,_0x32c82c){var _0x2bd5e1={};var _0x19f2e7={};var _0x4b3223;var _0xeb8ca7;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x4db313[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x32c82c,null))[_0x7b6a('0x14')](function(_0x2a5c0a){if(_0x2a5c0a){_0x4b3223=_0x2a5c0a;_0x19f2e7['model']=_[_0x7b6a('0x58')](db[_0x7b6a('0xc5')]['rawAttributes']);_0x19f2e7[_0x7b6a('0x44')]=_['keys'](_0x4db313[_0x7b6a('0x44')]);_0x19f2e7[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x19f2e7['model'],_0x19f2e7[_0x7b6a('0x44')]);_0x2bd5e1[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x19f2e7['model'],qs[_0x7b6a('0xc6')](_0x4db313[_0x7b6a('0x44')]['fields']));_0x2bd5e1[_0x7b6a('0x48')]=_0x2bd5e1[_0x7b6a('0x48')][_0x7b6a('0x4d')]?_0x2bd5e1[_0x7b6a('0x48')]:_0x19f2e7['model'];_0x2bd5e1['order']=qs['sort'](_0x4db313[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x2bd5e1[_0x7b6a('0xc8')]=qs['filters'](_[_0x7b6a('0xc9')](_0x4db313[_0x7b6a('0x44')],_0x19f2e7[_0x7b6a('0x59')]));if(_0x4db313['query'][_0x7b6a('0x2e')]){_0x2bd5e1[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x2bd5e1[_0x7b6a('0xc8')],{'$or':_['map'](_0x2bd5e1[_0x7b6a('0x48')],function(_0x2d8210){var _0x37eef9={};_0x37eef9[_0x2d8210]={'$like':'%'+_0x4db313[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0x37eef9;})});}_0x2bd5e1=_[_0x7b6a('0xca')]({},_0x2bd5e1,_0x4db313[_0x7b6a('0x5b')]);return _0x4b3223[_0x7b6a('0xc4')](_0x2bd5e1);}})[_0x7b6a('0x14')](function(_0x2e1687){if(_0x2e1687){_0xeb8ca7=_0x2e1687[_0x7b6a('0x4d')];if(_0x4db313['query'][_0x7b6a('0xcb')](_0x7b6a('0x42'))){_0x2bd5e1['include']=[{'model':db[_0x7b6a('0xcc')],'as':_0x7b6a('0xcd'),'required':![]},{'model':db['Tag'],'as':_0x7b6a('0xce'),'attributes':['id',_0x7b6a('0x37'),'color'],'where':_0x4db313[_0x7b6a('0x44')][_0x7b6a('0xcf')]?{'id':_0x4db313[_0x7b6a('0x44')][_0x7b6a('0xcf')]}:undefined,'required':_0x4db313['query'][_0x7b6a('0xcf')]?!![]:![]}];}if(!_0x4db313[_0x7b6a('0x44')][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x2bd5e1[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x4db313['query'][_0x7b6a('0xd1')]);_0x2bd5e1['offset']=qs[_0x7b6a('0x21')](_0x4db313['query'][_0x7b6a('0x21')]);}return _0x4b3223['getContacts'](_0x2bd5e1);}})['then'](function(_0x174606){if(_0x174606){return _0x174606?{'count':_0xeb8ca7,'rows':_0x174606}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x32c82c,null))['catch'](handleError(_0x32c82c,null));};exports[_0x7b6a('0xd2')]=function(_0x394536,_0x1160d2){var _0x1a131d;var _0x5353aa={};var _0x2ade52;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x394536[_0x7b6a('0x55')]['id']},'attributes':['id',_0x7b6a('0x37'),_0x7b6a('0x27')]})['then'](handleEntityNotFound(_0x1160d2,null))[_0x7b6a('0x14')](function(_0x56b469){if(!utils[_0x7b6a('0xd3')](_0x394536[_0x7b6a('0x44')][_0x7b6a('0x9d')])){throw new db[(_0x7b6a('0x8f'))]['ValidationError']('Unknown\x20channel');}_0x1a131d=_0x56b469;var _0x3d62b5={};_0x3d62b5[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_[_0x7b6a('0xa2')](_0x394536[_0x7b6a('0x44')]['channel'])+'Queue'][_0x7b6a('0x3b')]);_0x3d62b5[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x394536[_0x7b6a('0x44')]);_0x3d62b5[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x3d62b5[_0x7b6a('0x56')],_0x3d62b5[_0x7b6a('0x44')]);_0x5353aa[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x3d62b5[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x394536['query'][_0x7b6a('0xc6')]));_0x5353aa['attributes']=_0x5353aa[_0x7b6a('0x48')]['length']?_0x5353aa[_0x7b6a('0x48')]:_0x3d62b5[_0x7b6a('0x56')];_0x5353aa[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x394536[_0x7b6a('0x44')]['sort']);_0x5353aa[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x394536[_0x7b6a('0x44')],_0x3d62b5[_0x7b6a('0x59')]));if(_0x394536[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x5353aa[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x5353aa[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x5353aa[_0x7b6a('0x48')],function(_0x538fae){var _0xf8faaf={};_0xf8faaf[_0x538fae]={'$like':'%'+_0x394536['query'][_0x7b6a('0x2e')]+'%'};return _0xf8faaf;})});}_0x5353aa=_['merge']({},_0x5353aa,_0x394536[_0x7b6a('0x5b')]);switch(_0x1a131d[_0x7b6a('0x27')]){case'admin':return db[_['capitalize'](_0x394536['query']['channel'])+_0x7b6a('0xd5')][_0x7b6a('0x4a')](_0x5353aa);case'user':case _0x7b6a('0x2b'):return _0x1a131d[_0x7b6a('0x26')+_[_0x7b6a('0xa2')](_0x394536[_0x7b6a('0x44')]['channel'])+_0x7b6a('0xaf')](_0x5353aa);default:throw new db[(_0x7b6a('0x8f'))][(_0x7b6a('0x90'))](_0x7b6a('0xd6'));}})[_0x7b6a('0x14')](function(_0xea7d7e){_0x2ade52=_0xea7d7e[_0x7b6a('0x4d')];if(!_0x394536['query'][_0x7b6a('0xcb')]('nolimit')){_0x5353aa['limit']=qs[_0x7b6a('0xd1')](_0x394536[_0x7b6a('0x44')]['limit']);_0x5353aa[_0x7b6a('0x21')]=qs['offset'](_0x394536[_0x7b6a('0x44')][_0x7b6a('0x21')]);}switch(_0x1a131d[_0x7b6a('0x27')]){case _0x7b6a('0x28'):return db[_[_0x7b6a('0xa2')](_0x394536['query'][_0x7b6a('0x9d')])+_0x7b6a('0xd5')]['findAll'](_0x5353aa);case _0x7b6a('0x29'):case'agent':return _0x1a131d[_0x7b6a('0x26')+_['capitalize'](_0x394536[_0x7b6a('0x44')][_0x7b6a('0x9d')])+'Queues'](_0x5353aa);}})[_0x7b6a('0x14')](function(_0x1267a3){return{'count':_0x2ade52,'rows':_0x1267a3};})[_0x7b6a('0x14')](respondWithResult(_0x1160d2,null))[_0x7b6a('0x54')](handleError(_0x1160d2,null));};exports[_0x7b6a('0xd7')]=function(_0x3f5bce,_0x2dcc31){var _0x3a9174={};var _0xb98041={};var _0x556d5c;var _0x2c8350;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x3f5bce[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x2dcc31,null))[_0x7b6a('0x14')](function(_0x5b4cb1){if(_0x5b4cb1){_0x556d5c=_0x5b4cb1;_0xb98041[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xab')]['rawAttributes']);_0xb98041[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x3f5bce['query']);_0xb98041[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0xb98041[_0x7b6a('0x56')],_0xb98041[_0x7b6a('0x44')]);_0x3a9174[_0x7b6a('0x48')]=_['intersection'](_0xb98041[_0x7b6a('0x56')],qs['fields'](_0x3f5bce[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x3a9174[_0x7b6a('0x48')]=_0x3a9174['attributes'][_0x7b6a('0x4d')]?_0x3a9174[_0x7b6a('0x48')]:_0xb98041[_0x7b6a('0x56')];_0x3a9174[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x3f5bce[_0x7b6a('0x44')]['sort']);_0x3a9174['where']=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x3f5bce[_0x7b6a('0x44')],_0xb98041[_0x7b6a('0x59')]));if(_0x3f5bce[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x3a9174['where']=_[_0x7b6a('0xca')](_0x3a9174[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x3a9174['attributes'],function(_0x3f8d2a){var _0x55eeda={};_0x55eeda[_0x3f8d2a]={'$like':'%'+_0x3f5bce[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0x55eeda;})});}_0x3a9174=_[_0x7b6a('0xca')]({},_0x3a9174,_0x3f5bce['options']);return _0x556d5c['getVoiceQueuesRt'](_0x3a9174);}})[_0x7b6a('0x14')](function(_0x32350f){if(_0x32350f){_0x2c8350=_0x32350f[_0x7b6a('0x4d')];if(!_0x3f5bce[_0x7b6a('0x44')]['hasOwnProperty'](_0x7b6a('0xd0'))){_0x3a9174[_0x7b6a('0xd1')]=qs['limit'](_0x3f5bce[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x3a9174[_0x7b6a('0x21')]=qs['offset'](_0x3f5bce[_0x7b6a('0x44')][_0x7b6a('0x21')]);}return _0x556d5c['getVoiceQueuesRt'](_0x3a9174);}})['then'](function(_0x29ccb3){if(_0x29ccb3){return _0x29ccb3?{'count':_0x2c8350,'rows':_0x29ccb3}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x2dcc31,null))[_0x7b6a('0x54')](handleError(_0x2dcc31,null));};exports['getGroups']=function(_0x150bc5,_0x596188){var _0x5aa25b={};var _0x159c9d={};var _0x4381ae;var _0x4b09ba;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x150bc5['params']['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x596188,null))[_0x7b6a('0x14')](function(_0x36e02c){if(_0x36e02c){_0x4381ae=_0x36e02c;_0x159c9d[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xd8')][_0x7b6a('0x3b')]);_0x159c9d[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x150bc5[_0x7b6a('0x44')]);_0x159c9d['filters']=_[_0x7b6a('0x5a')](_0x159c9d[_0x7b6a('0x56')],_0x159c9d[_0x7b6a('0x44')]);_0x5aa25b[_0x7b6a('0x48')]=_['intersection'](_0x159c9d[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x150bc5[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x5aa25b['attributes']=_0x5aa25b['attributes'][_0x7b6a('0x4d')]?_0x5aa25b[_0x7b6a('0x48')]:_0x159c9d['model'];_0x5aa25b[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x150bc5[_0x7b6a('0x44')]['sort']);_0x5aa25b[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x150bc5[_0x7b6a('0x44')],_0x159c9d[_0x7b6a('0x59')]));if(_0x150bc5['query']['filter']){_0x5aa25b[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x5aa25b[_0x7b6a('0xc8')],{'$or':_['map'](_0x5aa25b[_0x7b6a('0x48')],function(_0x5b0a1f){var _0x40cb2a={};_0x40cb2a[_0x5b0a1f]={'$like':'%'+_0x150bc5['query'][_0x7b6a('0x2e')]+'%'};return _0x40cb2a;})});}_0x5aa25b=_[_0x7b6a('0xca')]({},_0x5aa25b,_0x150bc5[_0x7b6a('0x5b')]);return _0x4381ae[_0x7b6a('0xd9')](_0x5aa25b);}})[_0x7b6a('0x14')](function(_0x3e9cc5){if(_0x3e9cc5){_0x4b09ba=_0x3e9cc5[_0x7b6a('0x4d')];if(!_0x150bc5['query']['hasOwnProperty']('nolimit')){_0x5aa25b[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x150bc5[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x5aa25b[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x150bc5[_0x7b6a('0x44')][_0x7b6a('0x21')]);}return _0x4381ae[_0x7b6a('0xd9')](_0x5aa25b);}})[_0x7b6a('0x14')](function(_0x5491e2){if(_0x5491e2){return _0x5491e2?{'count':_0x4b09ba,'rows':_0x5491e2}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x596188,null))[_0x7b6a('0x54')](handleError(_0x596188,null));};exports[_0x7b6a('0xda')]=function(_0x3551f9,_0x460b37){var _0x1d9f81={'raw':!![],'where':{}};var _0x4ed766={};var _0xde2f32={'count':0x0,'rows':[]};return db[_0x7b6a('0x3a')]['findOne']({'where':{'id':_0x3551f9[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x460b37,null))['then'](function(_0x59b92a){if(_0x59b92a){_0x4ed766[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xdb')][_0x7b6a('0x3b')]);_0x4ed766['query']=_[_0x7b6a('0x58')](_0x3551f9[_0x7b6a('0x44')]);_0x4ed766[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x4ed766[_0x7b6a('0x56')],_0x4ed766['query']);_0x1d9f81[_0x7b6a('0x48')]=_['intersection'](_0x4ed766[_0x7b6a('0x56')],qs['fields'](_0x3551f9[_0x7b6a('0x44')]['fields']));_0x1d9f81['attributes']=_0x1d9f81[_0x7b6a('0x48')][_0x7b6a('0x4d')]?_0x1d9f81[_0x7b6a('0x48')]:_0x4ed766[_0x7b6a('0x56')];if(!_0x3551f9['query']['hasOwnProperty'](_0x7b6a('0xd0'))){_0x1d9f81[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x3551f9[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x1d9f81['offset']=qs[_0x7b6a('0x21')](_0x3551f9[_0x7b6a('0x44')][_0x7b6a('0x21')]);}_0x1d9f81[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x3551f9[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x1d9f81[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x3551f9[_0x7b6a('0x44')],_0x4ed766['filters']));_0x1d9f81[_0x7b6a('0xc8')]['UserId']=_0x59b92a['id'];if(_0x3551f9['query'][_0x7b6a('0x2e')]){_0x1d9f81[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x1d9f81['where'],{'$or':_[_0x7b6a('0x30')](_0x1d9f81[_0x7b6a('0x48')],function(_0x13a708){var _0x4f07cb={};_0x4f07cb[_0x13a708]={'$like':'%'+_0x3551f9['query']['filter']+'%'};return _0x4f07cb;})});}_0x1d9f81=_['merge']({},_0x1d9f81,_0x3551f9['options']);return db['VoiceRecording']['count']({'where':_0x1d9f81[_0x7b6a('0xc8')]})[_0x7b6a('0x14')](function(_0x20af53){_0xde2f32[_0x7b6a('0x22')]=_0x20af53;if(_0x3551f9[_0x7b6a('0x44')][_0x7b6a('0x42')]){_0x1d9f81[_0x7b6a('0x43')]=[{'all':!![]}];}return db[_0x7b6a('0xdb')]['findAll'](_0x1d9f81);})[_0x7b6a('0x14')](function(_0x40c7bb){_0xde2f32[_0x7b6a('0x4b')]=_0x40c7bb;return _0xde2f32;});}})[_0x7b6a('0x14')](respondWithFilteredResult(_0x460b37,_0x1d9f81))[_0x7b6a('0x54')](handleError(_0x460b37,null));};exports[_0x7b6a('0xdc')]=function(_0x10415c,_0x12f1ae){var _0x1c1505={'raw':!![],'where':{}};var _0xd5873f={};var _0x77c0c4={'count':0x0,'rows':[]};return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x10415c[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x12f1ae,null))[_0x7b6a('0x14')](function(_0x132dfc){if(_0x132dfc){_0xd5873f[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xdd')][_0x7b6a('0x3b')]);_0xd5873f[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x10415c['query']);_0xd5873f[_0x7b6a('0x59')]=_['intersection'](_0xd5873f[_0x7b6a('0x56')],_0xd5873f[_0x7b6a('0x44')]);_0x1c1505[_0x7b6a('0x48')]=_['intersection'](_0xd5873f['model'],qs[_0x7b6a('0xc6')](_0x10415c[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x1c1505[_0x7b6a('0x48')]=_0x1c1505[_0x7b6a('0x48')]['length']?_0x1c1505[_0x7b6a('0x48')]:_0xd5873f[_0x7b6a('0x56')];if(!_0x10415c[_0x7b6a('0x44')]['hasOwnProperty'](_0x7b6a('0xd0'))){_0x1c1505[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x10415c['query'][_0x7b6a('0xd1')]);_0x1c1505['offset']=qs['offset'](_0x10415c[_0x7b6a('0x44')]['offset']);}_0x1c1505[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x10415c[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x1c1505[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x10415c[_0x7b6a('0x44')],_0xd5873f[_0x7b6a('0x59')]));_0x1c1505[_0x7b6a('0xc8')]['UserId']=_0x132dfc['id'];if(_0x10415c['query'][_0x7b6a('0x2e')]){_0x1c1505[_0x7b6a('0xc8')]=_['merge'](_0x1c1505['where'],{'$or':_[_0x7b6a('0x30')](_0x1c1505['attributes'],function(_0x2e31a3){var _0x3b4271={};_0x3b4271[_0x2e31a3]={'$like':'%'+_0x10415c['query'][_0x7b6a('0x2e')]+'%'};return _0x3b4271;})});}_0x1c1505=_['merge']({},_0x1c1505,_0x10415c[_0x7b6a('0x5b')]);return db['ScreenRecording'][_0x7b6a('0x22')]({'where':_0x1c1505[_0x7b6a('0xc8')]})[_0x7b6a('0x14')](function(_0x1d7263){_0x77c0c4[_0x7b6a('0x22')]=_0x1d7263;if(_0x10415c['query'][_0x7b6a('0x42')]){_0x1c1505['include']=[{'all':!![]}];}return db[_0x7b6a('0xdd')]['findAll'](_0x1c1505);})[_0x7b6a('0x14')](function(_0x5d93f8){_0x77c0c4[_0x7b6a('0x4b')]=_0x5d93f8;return _0x77c0c4;});}})[_0x7b6a('0x14')](respondWithFilteredResult(_0x12f1ae,_0x1c1505))[_0x7b6a('0x54')](handleError(_0x12f1ae,null));};exports[_0x7b6a('0xde')]=function(_0x1ee572,_0x1f54ac){var _0x341f20={};var _0x46a1ad={};var _0xdc1dca;var _0x1542ce;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x1ee572[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x1f54ac,null))['then'](function(_0x289455){if(_0x289455){_0xdc1dca=_0x289455;_0x46a1ad[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xdf')]['rawAttributes']);_0x46a1ad[_0x7b6a('0x44')]=_['keys'](_0x1ee572[_0x7b6a('0x44')]);_0x46a1ad[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x46a1ad[_0x7b6a('0x56')],_0x46a1ad['query']);_0x341f20[_0x7b6a('0x48')]=_['intersection'](_0x46a1ad[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x1ee572[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x341f20[_0x7b6a('0x48')]=_0x341f20[_0x7b6a('0x48')]['length']?_0x341f20[_0x7b6a('0x48')]:_0x46a1ad[_0x7b6a('0x56')];_0x341f20[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x1ee572[_0x7b6a('0x44')]['sort']);_0x341f20[_0x7b6a('0xc8')]=qs['filters'](_[_0x7b6a('0xc9')](_0x1ee572[_0x7b6a('0x44')],_0x46a1ad['filters']));if(_0x1ee572[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x341f20['where']=_[_0x7b6a('0xca')](_0x341f20[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x341f20[_0x7b6a('0x48')],function(_0x4173b7){var _0x37cf4f={};_0x37cf4f[_0x4173b7]={'$like':'%'+_0x1ee572[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0x37cf4f;})});}_0x341f20=_[_0x7b6a('0xca')]({},_0x341f20,_0x1ee572[_0x7b6a('0x5b')]);return _0xdc1dca['getChatInteractions'](_0x341f20);}})['then'](function(_0x20fdfe){if(_0x20fdfe){_0x1542ce=_0x20fdfe[_0x7b6a('0x4d')];if(!_0x1ee572['query'][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x341f20['limit']=qs[_0x7b6a('0xd1')](_0x1ee572['query']['limit']);_0x341f20['offset']=qs[_0x7b6a('0x21')](_0x1ee572[_0x7b6a('0x44')]['offset']);}return _0xdc1dca[_0x7b6a('0xde')](_0x341f20);}})[_0x7b6a('0x14')](function(_0x13c54f){if(_0x13c54f){return _0x13c54f?{'count':_0x1542ce,'rows':_0x13c54f}:null;}})['then'](respondWithResult(_0x1f54ac,null))[_0x7b6a('0x54')](handleError(_0x1f54ac,null));};exports[_0x7b6a('0xe0')]=function(_0x951b08,_0x2c1a9f){var _0x308b3c={};var _0x569767={};var _0x31ef26;var _0x111eff;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x951b08[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x2c1a9f,null))[_0x7b6a('0x14')](function(_0x568bed){if(_0x568bed){_0x31ef26=_0x568bed;_0x569767[_0x7b6a('0x56')]=_['keys'](db[_0x7b6a('0xe1')][_0x7b6a('0x3b')]);_0x569767[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x951b08[_0x7b6a('0x44')]);_0x569767[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x569767['model'],_0x569767[_0x7b6a('0x44')]);_0x308b3c[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x569767['model'],qs[_0x7b6a('0xc6')](_0x951b08[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x308b3c[_0x7b6a('0x48')]=_0x308b3c['attributes'][_0x7b6a('0x4d')]?_0x308b3c[_0x7b6a('0x48')]:_0x569767[_0x7b6a('0x56')];_0x308b3c[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x951b08[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x308b3c['where']=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x951b08[_0x7b6a('0x44')],_0x569767[_0x7b6a('0x59')]));if(_0x951b08['query'][_0x7b6a('0x2e')]){_0x308b3c[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x308b3c[_0x7b6a('0xc8')],{'$or':_['map'](_0x308b3c[_0x7b6a('0x48')],function(_0x526e3d){var _0x2b59b2={};_0x2b59b2[_0x526e3d]={'$like':'%'+_0x951b08[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0x2b59b2;})});}_0x308b3c=_[_0x7b6a('0xca')]({},_0x308b3c,_0x951b08[_0x7b6a('0x5b')]);return _0x31ef26[_0x7b6a('0xe0')](_0x308b3c);}})['then'](function(_0x3ca759){if(_0x3ca759){_0x111eff=_0x3ca759[_0x7b6a('0x4d')];if(!_0x951b08['query'][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x308b3c[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x951b08[_0x7b6a('0x44')]['limit']);_0x308b3c[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x951b08[_0x7b6a('0x44')]['offset']);}return _0x31ef26[_0x7b6a('0xe0')](_0x308b3c);}})[_0x7b6a('0x14')](function(_0x435952){if(_0x435952){return _0x435952?{'count':_0x111eff,'rows':_0x435952}:null;}})['then'](respondWithResult(_0x2c1a9f,null))['catch'](handleError(_0x2c1a9f,null));};exports[_0x7b6a('0xe2')]=function(_0x341011,_0x1bbfbc){var _0x38b593={'raw':!![],'where':{}};var _0x5f2cfa={};var _0x4f462e={'count':0x0,'rows':[]};return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x341011['params']['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x1bbfbc,null))['then'](function(_0x56ac6b){if(_0x56ac6b){_0x5f2cfa[_0x7b6a('0x56')]=_['keys'](db[_0x7b6a('0xe3')][_0x7b6a('0x3b')]);_0x5f2cfa[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x341011['query']);_0x5f2cfa[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x5f2cfa[_0x7b6a('0x56')],_0x5f2cfa['query']);_0x38b593['attributes']=_[_0x7b6a('0x5a')](_0x5f2cfa['model'],qs['fields'](_0x341011[_0x7b6a('0x44')]['fields']));_0x38b593[_0x7b6a('0x48')]=_0x38b593['attributes']['length']?_0x38b593[_0x7b6a('0x48')]:_0x5f2cfa[_0x7b6a('0x56')];if(!_0x341011[_0x7b6a('0x44')][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x38b593[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x341011[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x38b593[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x341011[_0x7b6a('0x44')]['offset']);}_0x38b593[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x341011[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x38b593[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x341011[_0x7b6a('0x44')],_0x5f2cfa[_0x7b6a('0x59')]));_0x38b593[_0x7b6a('0xc8')][_0x7b6a('0xe4')]=_0x56ac6b['id'];if(_0x341011[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x38b593[_0x7b6a('0xc8')]=_['merge'](_0x38b593[_0x7b6a('0xc8')],{'$or':_['map'](_0x38b593[_0x7b6a('0x48')],function(_0x48dffe){var _0x4bc1ca={};_0x4bc1ca[_0x48dffe]={'$like':'%'+_0x341011['query']['filter']+'%'};return _0x4bc1ca;})});}_0x38b593=_['merge']({},_0x38b593,_0x341011[_0x7b6a('0x5b')]);return db['MailInteraction'][_0x7b6a('0x22')]({'where':_0x38b593[_0x7b6a('0xc8')]})[_0x7b6a('0x14')](function(_0x1da9e4){_0x4f462e['count']=_0x1da9e4;if(_0x341011[_0x7b6a('0x44')][_0x7b6a('0x42')]){_0x38b593['include']=[{'all':!![]}];}return db[_0x7b6a('0xe3')]['findAll'](_0x38b593);})[_0x7b6a('0x14')](function(_0x2819b5){_0x4f462e[_0x7b6a('0x4b')]=_0x2819b5;return _0x4f462e;});}})[_0x7b6a('0x14')](respondWithFilteredResult(_0x1bbfbc,_0x38b593))['catch'](handleError(_0x1bbfbc,null));};exports['getSmsInteractions']=function(_0x241695,_0x3ba6b9){var _0xe584c5={};var _0x3acee9={};var _0x3ac79e;var _0x215317;return db[_0x7b6a('0x3a')]['findOne']({'where':{'id':_0x241695[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x3ba6b9,null))[_0x7b6a('0x14')](function(_0xcac7b3){if(_0xcac7b3){_0x3ac79e=_0xcac7b3;_0x3acee9[_0x7b6a('0x56')]=_['keys'](db[_0x7b6a('0xe5')][_0x7b6a('0x3b')]);_0x3acee9[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x241695[_0x7b6a('0x44')]);_0x3acee9[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x3acee9[_0x7b6a('0x56')],_0x3acee9[_0x7b6a('0x44')]);_0xe584c5[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x3acee9[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x241695[_0x7b6a('0x44')]['fields']));_0xe584c5[_0x7b6a('0x48')]=_0xe584c5[_0x7b6a('0x48')]['length']?_0xe584c5[_0x7b6a('0x48')]:_0x3acee9[_0x7b6a('0x56')];_0xe584c5[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x241695[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0xe584c5['where']=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x241695['query'],_0x3acee9[_0x7b6a('0x59')]));if(_0x241695[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0xe584c5[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0xe584c5[_0x7b6a('0xc8')],{'$or':_['map'](_0xe584c5[_0x7b6a('0x48')],function(_0x12be5a){var _0x52fcb6={};_0x52fcb6[_0x12be5a]={'$like':'%'+_0x241695[_0x7b6a('0x44')]['filter']+'%'};return _0x52fcb6;})});}_0xe584c5=_[_0x7b6a('0xca')]({},_0xe584c5,_0x241695[_0x7b6a('0x5b')]);return _0x3ac79e[_0x7b6a('0xe6')](_0xe584c5);}})[_0x7b6a('0x14')](function(_0x49006f){if(_0x49006f){_0x215317=_0x49006f[_0x7b6a('0x4d')];if(!_0x241695[_0x7b6a('0x44')]['hasOwnProperty'](_0x7b6a('0xd0'))){_0xe584c5[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x241695['query'][_0x7b6a('0xd1')]);_0xe584c5[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x241695[_0x7b6a('0x44')][_0x7b6a('0x21')]);}return _0x3ac79e[_0x7b6a('0xe6')](_0xe584c5);}})['then'](function(_0x2f820b){if(_0x2f820b){return _0x2f820b?{'count':_0x215317,'rows':_0x2f820b}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x3ba6b9,null))['catch'](handleError(_0x3ba6b9,null));};exports[_0x7b6a('0xe7')]=function(_0x1f5bf4,_0x48373a){var _0x4f3820={};var _0x2bfbfe={};var _0x16bfb2;var _0x3a8e21;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x1f5bf4[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x48373a,null))[_0x7b6a('0x14')](function(_0xae11b){if(_0xae11b){_0x16bfb2=_0xae11b;_0x2bfbfe[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xe8')][_0x7b6a('0x3b')]);_0x2bfbfe[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x1f5bf4[_0x7b6a('0x44')]);_0x2bfbfe['filters']=_['intersection'](_0x2bfbfe[_0x7b6a('0x56')],_0x2bfbfe[_0x7b6a('0x44')]);_0x4f3820[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x2bfbfe['model'],qs[_0x7b6a('0xc6')](_0x1f5bf4[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x4f3820[_0x7b6a('0x48')]=_0x4f3820[_0x7b6a('0x48')][_0x7b6a('0x4d')]?_0x4f3820[_0x7b6a('0x48')]:_0x2bfbfe['model'];_0x4f3820[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x1f5bf4[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x4f3820[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x1f5bf4[_0x7b6a('0x44')],_0x2bfbfe['filters']));if(_0x1f5bf4[_0x7b6a('0x44')]['filter']){_0x4f3820[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x4f3820[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x4f3820['attributes'],function(_0x28efd1){var _0x231845={};_0x231845[_0x28efd1]={'$like':'%'+_0x1f5bf4[_0x7b6a('0x44')]['filter']+'%'};return _0x231845;})});}_0x4f3820=_['merge']({},_0x4f3820,_0x1f5bf4['options']);return _0x16bfb2['getFaxInteractions'](_0x4f3820);}})[_0x7b6a('0x14')](function(_0x25a287){if(_0x25a287){_0x3a8e21=_0x25a287[_0x7b6a('0x4d')];if(!_0x1f5bf4[_0x7b6a('0x44')][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x4f3820[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x1f5bf4[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x4f3820['offset']=qs[_0x7b6a('0x21')](_0x1f5bf4['query'][_0x7b6a('0x21')]);}return _0x16bfb2[_0x7b6a('0xe7')](_0x4f3820);}})[_0x7b6a('0x14')](function(_0x2ac1ab){if(_0x2ac1ab){return _0x2ac1ab?{'count':_0x3a8e21,'rows':_0x2ac1ab}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x48373a,null))[_0x7b6a('0x54')](handleError(_0x48373a,null));};exports[_0x7b6a('0xe9')]=function(_0x344323,_0x17eec8){var _0x4f59eb={};var _0x310a43={};var _0x44e02c;var _0x4e3e52;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x344323[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x17eec8,null))[_0x7b6a('0x14')](function(_0x18d33a){if(_0x18d33a){_0x44e02c=_0x18d33a;_0x310a43[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db[_0x7b6a('0xea')][_0x7b6a('0x3b')]);_0x310a43[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x344323[_0x7b6a('0x44')]);_0x310a43[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x310a43[_0x7b6a('0x56')],_0x310a43[_0x7b6a('0x44')]);_0x4f59eb[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x310a43[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x344323['query'][_0x7b6a('0xc6')]));_0x4f59eb[_0x7b6a('0x48')]=_0x4f59eb[_0x7b6a('0x48')][_0x7b6a('0x4d')]?_0x4f59eb[_0x7b6a('0x48')]:_0x310a43['model'];_0x4f59eb[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x344323['query'][_0x7b6a('0xc7')]);_0x4f59eb[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_['pick'](_0x344323[_0x7b6a('0x44')],_0x310a43[_0x7b6a('0x59')]));if(_0x344323[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x4f59eb['where']=_['merge'](_0x4f59eb[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x4f59eb[_0x7b6a('0x48')],function(_0x268f47){var _0xf90efb={};_0xf90efb[_0x268f47]={'$like':'%'+_0x344323[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0xf90efb;})});}_0x4f59eb=_[_0x7b6a('0xca')]({},_0x4f59eb,_0x344323[_0x7b6a('0x5b')]);return _0x44e02c[_0x7b6a('0xe9')](_0x4f59eb);}})[_0x7b6a('0x14')](function(_0x634dd4){if(_0x634dd4){_0x4e3e52=_0x634dd4[_0x7b6a('0x4d')];if(!_0x344323['query'][_0x7b6a('0xcb')]('nolimit')){_0x4f59eb[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x344323[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x4f59eb[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x344323[_0x7b6a('0x44')]['offset']);}return _0x44e02c[_0x7b6a('0xe9')](_0x4f59eb);}})['then'](function(_0x262c1e){if(_0x262c1e){return _0x262c1e?{'count':_0x4e3e52,'rows':_0x262c1e}:null;}})[_0x7b6a('0x14')](respondWithResult(_0x17eec8,null))[_0x7b6a('0x54')](handleError(_0x17eec8,null));};exports['login']=function(_0x1aa6bf,_0x5b3f8c,_0x365a04){var _0x3be475;var _0xfa52c3;var _0x2ca7d2;var _0x1e169d=!_[_0x7b6a('0x68')](_0x1aa6bf[_0x7b6a('0x55')]['id'])?_0x1aa6bf[_0x7b6a('0x55')]['id']:!_['isNil'](_0x1aa6bf['user']['id'])?_0x1aa6bf[_0x7b6a('0x29')]['id']:null;return db[_0x7b6a('0x3a')]['find']({'where':{'id':_0x1e169d,'role':{'$or':[_0x7b6a('0x28'),_0x7b6a('0x29'),'agent']}},'attributes':['id','name',_0x7b6a('0xeb'),_0x7b6a('0xec'),_0x7b6a('0x27'),'internal',_0x7b6a('0x9f')]})[_0x7b6a('0x14')](function(_0x308061){if(_0x308061){if(_0x308061[_0x7b6a('0x27')]===_0x7b6a('0x2b')){_0x3be475=_0x308061;if(_0x1aa6bf[_0x7b6a('0x5e')][_0x7b6a('0xa9')]){_0x2ca7d2=util[_0x7b6a('0xed')](_0x7b6a('0xee'),_0x3be475[_0x1aa6bf['body']['interface']]);}else if(_0x1aa6bf['body']['intrf']){_0x2ca7d2=util[_0x7b6a('0xed')](_0x7b6a('0xef'),_0x1aa6bf['body']['intrf']);}else{_0x2ca7d2=util['format'](_0x7b6a('0xef'),_0x3be475[_0x7b6a('0x37')]);}socket['to'](util[_0x7b6a('0xed')](_0x7b6a('0xf0'),_0x3be475['name']))[_0x7b6a('0xb0')](_0x7b6a('0xf1'),{'user':{'id':_0x3be475['id'],'name':_0x3be475[_0x7b6a('0x37')]},'ip':_0x1aa6bf[_0x7b6a('0xf2')][_0x7b6a('0xf3')]||_0x1aa6bf[_0x7b6a('0xf4')][_0x7b6a('0xf5')]||_0x1aa6bf[_0x7b6a('0xf6')]['remoteAddress']||_0x1aa6bf[_0x7b6a('0xf4')][_0x7b6a('0xf6')]['remoteAddress']});return db[_0x7b6a('0xab')][_0x7b6a('0x25')]({'where':{'membername':_0x3be475[_0x7b6a('0x37')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7b6a('0x90'))](_0x7b6a('0xf7'));}})[_0x7b6a('0x14')](function(){if(_0x3be475){return _0x3be475[_0x7b6a('0xf8')]({'raw':!![]});}})[_0x7b6a('0x14')](function(_0x15d429){if(_0x3be475){var _0x246406=[];if(_0x15d429){_0xfa52c3=_0x15d429;if(_0xfa52c3[_0x7b6a('0x4d')]){for(var _0x2c56f8=0x0;_0x2c56f8<_0xfa52c3[_0x7b6a('0x4d')];_0x2c56f8++){_0x246406['push']({'membername':_0x3be475[_0x7b6a('0x37')],'UserId':_0x3be475['id'],'queue_name':_0xfa52c3[_0x2c56f8][_0x7b6a('0x37')],'VoiceQueueId':_0xfa52c3[_0x2c56f8]['id'],'interface':_0x2ca7d2,'paused':_0x3be475['loginInPause']||![],'penalty':_0xfa52c3[_0x2c56f8]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x7b6a('0xaa')](_0x246406,function(_0x7cd013){return db[_0x7b6a('0xab')][_0x7b6a('0xac')](_0x7cd013);});}}}})[_0x7b6a('0x14')](function(){if(_0x3be475){return db[_0x7b6a('0xf9')][_0x7b6a('0x4a')]({'where':{'membername':_0x3be475['name'],'exitAt':null}});}})[_0x7b6a('0x14')](function(_0xe6db75){if(_0x3be475){var _0x1d346d=[];_0xe6db75[_0x7b6a('0xfa')](function(_0x5b9cb4){_0x1d346d[_0x7b6a('0x49')](_0x5b9cb4[_0x7b6a('0x24')]({'exitAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb'))}));});return BPromise[_0x7b6a('0x53')](_0x1d346d);}})[_0x7b6a('0x14')](function(){if(_0x3be475){var _0x55faa2=[];var _0x435529=[];var _0x479b15=utils[_0x7b6a('0xfc')]();var _0xdff0a7={'membername':_0x3be475[_0x7b6a('0x37')],'interface':_0x2ca7d2,'enterAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb')),'role':_0x3be475['role'],'internal':_0x3be475[_0x7b6a('0x63')]};_0x479b15[_0x7b6a('0xfa')](function(_0x4e5afe){_0x55faa2['push'](_[_0x7b6a('0xca')]({'channel':_0x4e5afe,'type':'LOGIN','data1':_0x1aa6bf['body'][_0x7b6a('0xfd')],'data2':_0x2ca7d2},_0xdff0a7));if(_0x3be475['loginInPause']){_0x435529[_0x7b6a('0x49')](_[_0x7b6a('0xca')]({'channel':_0x4e5afe,'type':_0x7b6a('0xfe'),'data1':'LOGININPAUSE'},_0xdff0a7));}});return db['MemberReport'][_0x7b6a('0x86')](_0x55faa2[_0x7b6a('0xc3')](_0x435529),{'individualHooks':!![]});}})[_0x7b6a('0x14')](function(){if(_0x3be475){return _0x3be475[_0x7b6a('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x7b6a('0xfb')),'voicePause':_0x3be475['loginInPause']||![],'mailPause':_0x3be475[_0x7b6a('0x9f')]||![],'chatPause':_0x3be475[_0x7b6a('0x9f')]||![],'faxPause':_0x3be475['loginInPause']||![],'smsPause':_0x3be475[_0x7b6a('0x9f')]||![],'openchannelPause':_0x3be475['loginInPause']||![],'whatsappPause':_0x3be475[_0x7b6a('0x9f')]||![],'pauseType':_0x3be475[_0x7b6a('0x9f')]?_0x7b6a('0xff'):null,'interface':_0x2ca7d2,'lastPauseAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb'))});}})[_0x7b6a('0x14')](function(_0x3a73cc){if(_0x1aa6bf['isMiddleware']){return _0x365a04();}else{return BPromise[_0x7b6a('0x100')](_0x3a73cc)[_0x7b6a('0x14')](respondWithResult(_0x5b3f8c,null));}})[_0x7b6a('0x54')](handleError(_0x5b3f8c,null));};exports[_0x7b6a('0x101')]=function(_0x33bb77,_0xfca9ad){var _0xdf483c;return db['User'][_0x7b6a('0x33')]({'where':{'id':_0x33bb77[_0x7b6a('0x55')]['id'],'role':'agent'},'attributes':['id',_0x7b6a('0x37'),_0x7b6a('0x27')]})[_0x7b6a('0x14')](handleEntityNotFound(_0xfca9ad,null))['then'](function(_0x16d3ee){if(_0x16d3ee){_0xdf483c=_0x16d3ee;return db['UserVoiceQueueRt'][_0x7b6a('0x25')]({'where':{'membername':_0xdf483c[_0x7b6a('0x37')]},'individualHooks':!![]});}})[_0x7b6a('0x14')](function(){return db[_0x7b6a('0xf9')]['findAll']({'where':{'membername':_0xdf483c['name'],'exitAt':null}});})['then'](function(_0x599ee5){var _0x30af4d=[];_0x599ee5['forEach'](function(_0x204684){_0x30af4d[_0x7b6a('0x49')](_0x204684['update']({'exitAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb'))}));});return BPromise[_0x7b6a('0x53')](_0x30af4d);})[_0x7b6a('0x14')](function(){return _0xdf483c[_0x7b6a('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7b6a('0x14')](respondWithResult(_0xfca9ad,null))[_0x7b6a('0x54')](handleError(_0xfca9ad,null));};exports[_0x7b6a('0x102')]=function(_0x4f8cf8,_0x43161c){var _0x15ebb9;return db[_0x7b6a('0xab')][_0x7b6a('0x24')]({'paused':0x1},{'where':{'UserId':_0x4f8cf8[_0x7b6a('0x55')]['id']},'individualHooks':!![]})[_0x7b6a('0x14')](function(){return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x4f8cf8[_0x7b6a('0x55')]['id'],'role':_0x7b6a('0x2b')},'attributes':['id',_0x7b6a('0x37'),_0x7b6a('0x27'),_0x7b6a('0x63'),_0x7b6a('0xa9')]});})[_0x7b6a('0x14')](handleEntityNotFound(_0x43161c,null))[_0x7b6a('0x14')](function(_0x2c0c53){if(_0x2c0c53){_0x15ebb9=_0x2c0c53;return respondWithRpcPromise(_0x7b6a('0x103'),_0x7b6a('0x102'),{'id':_0x15ebb9['id'],'name':_0x15ebb9['name'],'pause':!![]});}})[_0x7b6a('0x14')](function(){if(_0x15ebb9){return db['MemberReport']['findAll']({'where':{'membername':_0x15ebb9['name'],'type':_0x7b6a('0xfe'),'exitAt':null}});}})[_0x7b6a('0x14')](function(_0x1c3572){if(_0x1c3572[_0x7b6a('0x4d')]){var _0x282857=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x41c06f=0x0,_0x45f159=_0x1c3572['length'];_0x41c06f<_0x45f159;_0x41c06f++){_0x1c3572[_0x41c06f]['updateAttributes']({'exitAt':_0x282857});}}})[_0x7b6a('0x14')](function(){var _0x43405d=[];var _0x55dd10=utils[_0x7b6a('0xfc')]();_0x55dd10[_0x7b6a('0xfa')](function(_0x37f304){_0x43405d['push']({'channel':_0x37f304,'membername':_0x15ebb9[_0x7b6a('0x37')],'interface':_[_0x7b6a('0x68')](_0x15ebb9[_0x7b6a('0xa9')])?util['format']('SIP/%s',_0x15ebb9['name']):_0x15ebb9[_0x7b6a('0xa9')],'type':_0x7b6a('0xfe'),'enterAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb')),'data1':_0x4f8cf8[_0x7b6a('0x5e')][_0x7b6a('0x3d')]||_0x7b6a('0x104'),'role':_0x15ebb9[_0x7b6a('0x27')],'internal':_0x15ebb9[_0x7b6a('0x63')]});});return db[_0x7b6a('0xf9')][_0x7b6a('0x86')](_0x43405d,{'individualHooks':!![]});})[_0x7b6a('0x14')](function(){return _0x15ebb9[_0x7b6a('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4f8cf8['body']['type']||_0x7b6a('0x104'),'lastPauseAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb'))});})[_0x7b6a('0x14')](respondWithResult(_0x43161c,null))[_0x7b6a('0x54')](handleError(_0x43161c,null));};exports[_0x7b6a('0x105')]=function(_0x39649c,_0x44fc12){var _0x29b1de;return db[_0x7b6a('0x3a')][_0x7b6a('0x33')]({'where':{'id':_0x39649c['params']['id']},'attributes':['id',_0x7b6a('0x37'),_0x7b6a('0x27'),_0x7b6a('0xa0'),_0x7b6a('0x106'),_0x7b6a('0x107'),_0x7b6a('0x108'),_0x7b6a('0x109'),_0x7b6a('0x10a'),'whatsapppause','pauseType',_0x7b6a('0x10b')]})[_0x7b6a('0x14')](handleEntityNotFound(_0x44fc12,null))[_0x7b6a('0x14')](function(_0x74e163){if(_0x74e163){_0x29b1de=_0x74e163;if(_0x39649c[_0x7b6a('0x5e')][_0x7b6a('0x9d')]&&!utils[_0x7b6a('0xd3')](_0x39649c[_0x7b6a('0x5e')][_0x7b6a('0x9d')])){throw new db[(_0x7b6a('0x8f'))]['ValidationError'](_0x7b6a('0xae'));}switch(_0x39649c[_0x7b6a('0x5e')][_0x7b6a('0x9d')]){case _0x7b6a('0xa7'):return respondWithRpcPromise(_0x7b6a('0x103'),_0x7b6a('0x105'),{'id':_0x29b1de['id'],'name':_0x29b1de[_0x7b6a('0x37')],'pause':![]})[_0x7b6a('0x14')](function(){return db[_0x7b6a('0xab')][_0x7b6a('0x24')]({'paused':0x0},{'where':{'UserId':_0x29b1de['id']},'individualHooks':!![]});})[_0x7b6a('0x14')](function(){return db['MemberReport'][_0x7b6a('0x33')]({'where':{'channel':_0x39649c[_0x7b6a('0x5e')][_0x7b6a('0x9d')],'membername':_0x29b1de[_0x7b6a('0x37')],'type':_0x7b6a('0xfe'),'exitAt':null}});})[_0x7b6a('0x14')](function(_0x5c1e7){if(_0x5c1e7){return _0x5c1e7[_0x7b6a('0x24')]({'exitAt':moment()[_0x7b6a('0xed')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7b6a('0x10c')},{'individualHooks':!![]});}return null;})[_0x7b6a('0x14')](function(){return _0x29b1de['update']({'voicePause':![]});});case _0x7b6a('0x50'):case _0x7b6a('0x5c'):case'fax':case _0x7b6a('0x4e'):case _0x7b6a('0x52'):case _0x7b6a('0x51'):return db[_0x7b6a('0xf9')]['find']({'where':{'channel':_0x39649c[_0x7b6a('0x5e')]['channel'],'membername':_0x29b1de[_0x7b6a('0x37')],'type':'PAUSE','exitAt':null}})[_0x7b6a('0x14')](function(_0x354a42){if(_0x354a42){return _0x354a42['update']({'exitAt':moment()[_0x7b6a('0xed')](_0x7b6a('0xfb')),'data2':_0x7b6a('0x10c')},{'individualHooks':!![]});}return null;})[_0x7b6a('0x14')](function(){var _0x4acb83={};_[_0x7b6a('0x10d')](_0x4acb83,util[_0x7b6a('0xed')](_0x7b6a('0x10e'),_0x39649c[_0x7b6a('0x5e')][_0x7b6a('0x9d')],'Pause'),![]);return _0x29b1de['update'](_0x4acb83);});default:return respondWithRpcPromise('QueuePause',_0x7b6a('0x105'),{'id':_0x29b1de['id'],'name':_0x29b1de[_0x7b6a('0x37')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x7b6a('0x24')]({'paused':0x0},{'where':{'UserId':_0x29b1de['id']}});})[_0x7b6a('0x14')](function(){return db[_0x7b6a('0xf9')]['findAll']({'where':{'membername':_0x29b1de[_0x7b6a('0x37')],'type':_0x7b6a('0xfe'),'exitAt':null}});})[_0x7b6a('0x14')](function(_0x11997b){var _0x43b261=[];_0x11997b[_0x7b6a('0xfa')](function(_0x4e5d70){_0x43b261[_0x7b6a('0x49')](_0x4e5d70[_0x7b6a('0x24')]({'exitAt':moment()['format'](_0x7b6a('0xfb')),'data2':_0x7b6a('0x10c')}));});return BPromise[_0x7b6a('0x53')](_0x43b261);})[_0x7b6a('0x14')](function(){return _0x29b1de['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x7b6a('0x14')](respondWithResult(_0x44fc12,null))[_0x7b6a('0x54')](handleError(_0x44fc12,null));};exports[_0x7b6a('0x10f')]=function(_0x50b27b,_0x3f08c2){var _0x271b7f={};var _0x236860={};var _0x37c06e;var _0x564978;return db[_0x7b6a('0x3a')]['findOne']({'where':{'id':_0x50b27b[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x3f08c2,null))[_0x7b6a('0x14')](function(_0x5d1390){if(_0x5d1390){_0x37c06e=_0x5d1390;_0x236860[_0x7b6a('0x56')]=_['keys'](db[_0x7b6a('0x110')]['rawAttributes']);_0x236860['query']=_[_0x7b6a('0x58')](_0x50b27b['query']);_0x236860[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x236860[_0x7b6a('0x56')],_0x236860[_0x7b6a('0x44')]);_0x271b7f[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x236860[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x50b27b[_0x7b6a('0x44')]['fields']));_0x271b7f['attributes']=_0x271b7f['attributes']['length']?_0x271b7f[_0x7b6a('0x48')]:_0x236860[_0x7b6a('0x56')];_0x271b7f[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x50b27b[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x271b7f['where']=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x50b27b['query'],_0x236860['filters']));if(_0x50b27b[_0x7b6a('0x44')]['filter']){_0x271b7f[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x271b7f[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x271b7f[_0x7b6a('0x48')],function(_0x3fba46){var _0x1555bf={};_0x1555bf[_0x3fba46]={'$like':'%'+_0x50b27b['query']['filter']+'%'};return _0x1555bf;})});}_0x271b7f=_[_0x7b6a('0xca')]({},_0x271b7f,_0x50b27b['options']);return _0x37c06e[_0x7b6a('0x10f')](_0x271b7f);}})[_0x7b6a('0x14')](function(_0xb6a393){if(_0xb6a393){_0x564978=_0xb6a393[_0x7b6a('0x4d')];if(!_0x50b27b[_0x7b6a('0x44')][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x271b7f[_0x7b6a('0xd1')]=qs[_0x7b6a('0xd1')](_0x50b27b[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x271b7f[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x50b27b[_0x7b6a('0x44')][_0x7b6a('0x21')]);}return _0x37c06e['getTeams'](_0x271b7f);}})[_0x7b6a('0x14')](function(_0x2a6ed5){if(_0x2a6ed5){return _0x2a6ed5?{'count':_0x564978,'rows':_0x2a6ed5}:null;}})['then'](respondWithResult(_0x3f08c2,null))['catch'](handleError(_0x3f08c2,null));};exports['addTeams']=function(_0x2dc4ee,_0x4c862f){return db[_0x7b6a('0x3a')]['find']({'where':{'id':_0x2dc4ee[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x4c862f,null))[_0x7b6a('0x14')](function(_0x5a3570){if(_0x5a3570){var _0x2c6320=_0x5a3570['get']({'plain':!![]});return _0x5a3570[_0x7b6a('0x111')](_0x2dc4ee['body']['ids'],_['omit'](_0x2dc4ee[_0x7b6a('0x5e')],['ids','id'])||{})['then'](function(){for(var _0x4e0d7d=0x0;_0x4e0d7d<_0x2dc4ee[_0x7b6a('0x5e')][_0x7b6a('0x62')][_0x7b6a('0x4d')];_0x4e0d7d++){var _0x1540af=[];var _0x4cb1cd={};db['Team'][_0x7b6a('0x97')]({'where':{'id':_0x2dc4ee[_0x7b6a('0x5e')]['ids'][_0x4e0d7d]}})[_0x7b6a('0x14')](function(_0x287609){_0x4cb1cd=_0x287609[_0x7b6a('0x4f')];_0x1540af[_0x7b6a('0x49')](_0x287609[_0x7b6a('0xf8')]()[_0x7b6a('0x14')](function(_0xb431cd){for(var _0x518486=0x0;_0x518486<_0xb431cd[_0x7b6a('0x4d')];_0x518486++){_0xb431cd[_0x518486]['setDataValue']('channel',_0x7b6a('0x112'));}return _0xb431cd;}));_0x1540af['push'](_0x287609['getChatQueues']()[_0x7b6a('0x14')](function(_0x5e7a9e){for(var _0x4af890=0x0;_0x4af890<_0x5e7a9e[_0x7b6a('0x4d')];_0x4af890++){_0x5e7a9e[_0x4af890][_0x7b6a('0x113')]('channel',_0x7b6a('0x114'));}return _0x5e7a9e;}));_0x1540af['push'](_0x287609[_0x7b6a('0x115')]()[_0x7b6a('0x14')](function(_0x159979){for(var _0x466d0b=0x0;_0x466d0b<_0x159979[_0x7b6a('0x4d')];_0x466d0b++){_0x159979[_0x466d0b][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x116'));}return _0x159979;}));_0x1540af[_0x7b6a('0x49')](_0x287609['getSmsQueues']()[_0x7b6a('0x14')](function(_0x217b37){for(var _0x448cd2=0x0;_0x448cd2<_0x217b37['length'];_0x448cd2++){_0x217b37[_0x448cd2]['setDataValue'](_0x7b6a('0x9d'),'Sms');}return _0x217b37;}));_0x1540af['push'](_0x287609[_0x7b6a('0x117')]()[_0x7b6a('0x14')](function(_0x345094){for(var _0x18b0ca=0x0;_0x18b0ca<_0x345094[_0x7b6a('0x4d')];_0x18b0ca++){_0x345094[_0x18b0ca]['setDataValue'](_0x7b6a('0x9d'),'Whatsapp');}return _0x345094;}));_0x1540af['push'](_0x287609[_0x7b6a('0x118')]()[_0x7b6a('0x14')](function(_0x34ec07){for(var _0x1c9ecf=0x0;_0x1c9ecf<_0x34ec07['length'];_0x1c9ecf++){_0x34ec07[_0x1c9ecf][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x119'));}return _0x34ec07;}));_0x1540af[_0x7b6a('0x49')](_0x287609[_0x7b6a('0x11a')]()[_0x7b6a('0x14')](function(_0x1a74fc){for(var _0x36648b=0x0;_0x36648b<_0x1a74fc[_0x7b6a('0x4d')];_0x36648b++){_0x1a74fc[_0x36648b][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x11b'));}return _0x1a74fc;}));return BPromise['all'](_0x1540af);})['then'](function(_0x2f42ec){var _0x269fcc=_[_0x7b6a('0x11c')](_0x2f42ec);_0x1540af=[];return db[_0x7b6a('0x6b')][_0x7b6a('0x11d')](function(_0x70ee8b){for(var _0x5d7e9b=0x0;_0x5d7e9b<_0x269fcc[_0x7b6a('0x4d')];_0x5d7e9b++){_0x1540af[_0x7b6a('0x49')](_0x269fcc[_0x5d7e9b][_0x7b6a('0x11e')](_0x2c6320['id']),{'transaction':_0x70ee8b});}return BPromise[_0x7b6a('0x53')](_0x1540af)[_0x7b6a('0x14')](function(){if(_0x2c6320[_0x7b6a('0x9e')]){return BPromise['each'](_['filter'](_0x269fcc,function(_0x4241a2){return _0x4241a2['getDataValue'](_0x7b6a('0x9d'))===_0x7b6a('0x112');}),function(_0x274772){return db[_0x7b6a('0xab')][_0x7b6a('0xac')]({'membername':_0x2c6320[_0x7b6a('0x37')],'UserId':_0x2c6320['id'],'queue_name':_0x274772[_0x7b6a('0x37')],'VoiceQueueId':_0x274772['id'],'interface':_[_0x7b6a('0x68')](_0x2c6320[_0x7b6a('0xa9')])?util[_0x7b6a('0xed')]('SIP/%s',_0x2c6320['name']):_0x2c6320[_0x7b6a('0xa9')],'paused':_0x2c6320[_0x7b6a('0xa0')]||![],'penalty':_0x2c6320['penalty']},{'transaction':_0x70ee8b});});}else{return;}})[_0x7b6a('0x14')](function(){for(var _0x59682e=0x0;_0x59682e<_0x269fcc[_0x7b6a('0x4d')];_0x59682e++){var _0x3c3987=_0x269fcc[_0x59682e][_0x7b6a('0x11f')](_0x7b6a('0x9d'));var _0x4e1690=_0x3c3987+_0x7b6a('0xa5');socket[_0x7b6a('0xb0')]('user'+_0x3c3987+_0x7b6a('0xa6'),{'UserId':_0x2c6320['id'],['queueField']:_0x269fcc[_0x59682e]['id']});}});});})['then'](function(){db[_0x7b6a('0x120')][_0x7b6a('0x97')]({'where':{'teamId':_0x4cb1cd['id']}})[_0x7b6a('0x14')](function(_0x365002){if(_0x365002){db[_0x7b6a('0x121')][_0x7b6a('0x82')]({'UserId':_0x2dc4ee[_0x7b6a('0x55')]['id'],'VoicePrefixId':_0x365002['VoicePrefixId']});}});});}});}})[_0x7b6a('0x14')](respondWithStatusCode(_0x4c862f,null))[_0x7b6a('0x54')](handleError(_0x4c862f,null));};exports[_0x7b6a('0x122')]=function(_0x3fe93c,_0x29fdf1){return db['User'][_0x7b6a('0x97')]({'where':{'id':_0x3fe93c[_0x7b6a('0x55')]['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x29fdf1,null))[_0x7b6a('0x14')](function(_0x571ad4){if(_0x571ad4){var _0x100809=_0x571ad4[_0x7b6a('0x26')]({'plain':!![]});var _0x33254f=_0x3fe93c['query'][_0x7b6a('0x62')];return _0x571ad4['removeTeams'](_0x33254f)[_0x7b6a('0x14')](function(){for(var _0x373026=0x0;_0x373026<_0x33254f[_0x7b6a('0x4d')];_0x373026++){var _0x549030=[];var _0x123cb4={};db[_0x7b6a('0x110')][_0x7b6a('0x97')]({'where':{'id':_0x33254f[_0x373026]}})[_0x7b6a('0x14')](function(_0x528d46){_0x123cb4=_0x528d46[_0x7b6a('0x4f')];_0x549030['push'](_0x528d46['getVoiceQueues']()[_0x7b6a('0x14')](function(_0x4c676b){for(var _0x17e5c2=0x0;_0x17e5c2<_0x4c676b['length'];_0x17e5c2++){_0x4c676b[_0x17e5c2][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x112'));}return _0x4c676b;}));_0x549030[_0x7b6a('0x49')](_0x528d46[_0x7b6a('0x123')]()['then'](function(_0x478ff9){for(var _0x51b568=0x0;_0x51b568<_0x478ff9[_0x7b6a('0x4d')];_0x51b568++){_0x478ff9[_0x51b568][_0x7b6a('0x113')]('channel',_0x7b6a('0x114'));}return _0x478ff9;}));_0x549030[_0x7b6a('0x49')](_0x528d46[_0x7b6a('0x115')]()['then'](function(_0x1b23ff){for(var _0x487451=0x0;_0x487451<_0x1b23ff[_0x7b6a('0x4d')];_0x487451++){_0x1b23ff[_0x487451][_0x7b6a('0x113')]('channel','Mail');}return _0x1b23ff;}));_0x549030[_0x7b6a('0x49')](_0x528d46['getSmsQueues']()['then'](function(_0x25c949){for(var _0xc9fbde=0x0;_0xc9fbde<_0x25c949[_0x7b6a('0x4d')];_0xc9fbde++){_0x25c949[_0xc9fbde][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x124'));}return _0x25c949;}));_0x549030[_0x7b6a('0x49')](_0x528d46[_0x7b6a('0x117')]()[_0x7b6a('0x14')](function(_0x41163d){for(var _0x352781=0x0;_0x352781<_0x41163d['length'];_0x352781++){_0x41163d[_0x352781][_0x7b6a('0x113')](_0x7b6a('0x9d'),'Whatsapp');}return _0x41163d;}));_0x549030[_0x7b6a('0x49')](_0x528d46[_0x7b6a('0x118')]()[_0x7b6a('0x14')](function(_0x3b7a08){for(var _0x2ef0fa=0x0;_0x2ef0fa<_0x3b7a08['length'];_0x2ef0fa++){_0x3b7a08[_0x2ef0fa][_0x7b6a('0x113')]('channel',_0x7b6a('0x119'));}return _0x3b7a08;}));_0x549030[_0x7b6a('0x49')](_0x528d46[_0x7b6a('0x11a')]()[_0x7b6a('0x14')](function(_0x48bb2b){for(var _0x2e228c=0x0;_0x2e228c<_0x48bb2b[_0x7b6a('0x4d')];_0x2e228c++){_0x48bb2b[_0x2e228c][_0x7b6a('0x113')](_0x7b6a('0x9d'),_0x7b6a('0x11b'));}return _0x48bb2b;}));return BPromise[_0x7b6a('0x53')](_0x549030);})[_0x7b6a('0x14')](function(_0x5a0ab7){var _0x587559=_[_0x7b6a('0x11c')](_0x5a0ab7);_0x549030=[];return db[_0x7b6a('0x6b')][_0x7b6a('0x11d')](function(_0x46af9d){for(var _0x28adf0=0x0;_0x28adf0<_0x587559[_0x7b6a('0x4d')];_0x28adf0++){_0x549030[_0x7b6a('0x49')](_0x587559[_0x28adf0][_0x7b6a('0x125')](_0x100809['id']),{'transaction':_0x46af9d});}return BPromise['all'](_0x549030)[_0x7b6a('0x14')](function(){if(_0x100809[_0x7b6a('0x9e')]){return BPromise[_0x7b6a('0xaa')](_['filter'](_0x587559,function(_0x39c7de){return _0x39c7de[_0x7b6a('0x11f')](_0x7b6a('0x9d'))===_0x7b6a('0x112');}),function(_0x27a1d0){return db[_0x7b6a('0xab')]['destroy']({'where':{'VoiceQueueId':_0x27a1d0['id'],'UserId':_0x100809['id']},'transaction':_0x46af9d});});}else{return;}})[_0x7b6a('0x14')](function(){db['TeamVoicePrefix'][_0x7b6a('0x97')]({'where':{'teamId':_0x123cb4['id']}})[_0x7b6a('0x14')](function(_0x51fca9){if(_0x51fca9){return db[_0x7b6a('0x121')][_0x7b6a('0x25')]({'where':{'UserId':_0x100809['id'],'VoicePrefixId':_0x51fca9[_0x7b6a('0x4f')][_0x7b6a('0x126')]}});}});})[_0x7b6a('0x14')](function(){for(var _0x9707de=0x0;_0x9707de<_0x587559[_0x7b6a('0x4d')];_0x9707de++){var _0x5cb658=_0x587559[_0x9707de][_0x7b6a('0x11f')]('channel');var _0x4ab5ae=_0x5cb658+_0x7b6a('0xa5');socket[_0x7b6a('0xb0')](_0x7b6a('0x29')+_0x5cb658+_0x7b6a('0xb1'),{'UserId':_0x100809['id'],['queueField']:_0x587559[_0x9707de]['id']});}});});});}});}})[_0x7b6a('0x14')](respondWithStatusCode(_0x29fdf1,null))['catch'](handleError(_0x29fdf1,null));};exports[_0x7b6a('0x127')]=function(_0x5d9b10,_0xf67620){var _0x4bb1f8={};var _0x388a1e={};var _0x5502ff;var _0x3f2999;return db['User'][_0x7b6a('0x97')]({'where':{'id':_0x5d9b10['params']['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0xf67620,null))[_0x7b6a('0x14')](function(_0x1a7662){if(_0x1a7662){_0x5502ff=_0x1a7662;_0x388a1e[_0x7b6a('0x56')]=_[_0x7b6a('0x58')](db['CmList'][_0x7b6a('0x3b')]);_0x388a1e[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x5d9b10['query']);_0x388a1e[_0x7b6a('0x59')]=_[_0x7b6a('0x5a')](_0x388a1e[_0x7b6a('0x56')],_0x388a1e[_0x7b6a('0x44')]);_0x4bb1f8[_0x7b6a('0x48')]=_[_0x7b6a('0x5a')](_0x388a1e['model'],qs['fields'](_0x5d9b10[_0x7b6a('0x44')][_0x7b6a('0xc6')]));_0x4bb1f8[_0x7b6a('0x48')]=_0x4bb1f8['attributes'][_0x7b6a('0x4d')]?_0x4bb1f8[_0x7b6a('0x48')]:_0x388a1e[_0x7b6a('0x56')];_0x4bb1f8[_0x7b6a('0xd4')]=qs['sort'](_0x5d9b10[_0x7b6a('0x44')]['sort']);_0x4bb1f8[_0x7b6a('0xc8')]=qs[_0x7b6a('0x59')](_[_0x7b6a('0xc9')](_0x5d9b10[_0x7b6a('0x44')],_0x388a1e['filters']));if(_0x5d9b10[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x4bb1f8[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x4bb1f8[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x4bb1f8['attributes'],function(_0x71a005){var _0x17fe2a={};_0x17fe2a[_0x71a005]={'$like':'%'+_0x5d9b10[_0x7b6a('0x44')][_0x7b6a('0x2e')]+'%'};return _0x17fe2a;})});}_0x4bb1f8=_['merge']({},_0x4bb1f8,_0x5d9b10[_0x7b6a('0x5b')]);return _0x5502ff[_0x7b6a('0x127')](_0x4bb1f8);}})[_0x7b6a('0x14')](function(_0x2ee2b3){if(_0x2ee2b3){_0x3f2999=_0x2ee2b3['length'];if(!_0x5d9b10['query'][_0x7b6a('0xcb')](_0x7b6a('0xd0'))){_0x4bb1f8[_0x7b6a('0xd1')]=qs['limit'](_0x5d9b10[_0x7b6a('0x44')][_0x7b6a('0xd1')]);_0x4bb1f8[_0x7b6a('0x21')]=qs[_0x7b6a('0x21')](_0x5d9b10['query']['offset']);}return _0x5502ff[_0x7b6a('0x127')](_0x4bb1f8);}})[_0x7b6a('0x14')](function(_0x1fa797){if(_0x1fa797){return _0x1fa797?{'count':_0x3f2999,'rows':_0x1fa797}:null;}})['then'](respondWithResult(_0xf67620,null))[_0x7b6a('0x54')](handleError(_0xf67620,null));};exports[_0x7b6a('0x128')]=function(_0x11c534,_0x201d01){var _0x31a0e4={};var _0x3414ae={};var _0x4633c4;return db[_0x7b6a('0x3a')][_0x7b6a('0x97')]({'where':{'id':_0x11c534['params']['id']}})[_0x7b6a('0x14')](handleEntityNotFound(_0x201d01,null))['then'](function(_0x47ac1c){if(_0x47ac1c){_0x4633c4=_0x47ac1c;_0x3414ae[_0x7b6a('0x56')]=_['keys'](db['User'][_0x7b6a('0x3b')]);_0x3414ae[_0x7b6a('0x44')]=_[_0x7b6a('0x58')](_0x11c534[_0x7b6a('0x44')]);_0x3414ae[_0x7b6a('0x59')]=_['intersection'](_0x3414ae[_0x7b6a('0x56')],_0x3414ae[_0x7b6a('0x44')]);_0x31a0e4['attributes']=_[_0x7b6a('0x5a')](_0x3414ae[_0x7b6a('0x56')],qs[_0x7b6a('0xc6')](_0x11c534[_0x7b6a('0x44')]['fields']));_0x31a0e4[_0x7b6a('0x48')]=_0x31a0e4[_0x7b6a('0x48')][_0x7b6a('0x4d')]?_0x31a0e4[_0x7b6a('0x48')]:_0x3414ae['model'];_0x31a0e4[_0x7b6a('0xd4')]=qs[_0x7b6a('0xc7')](_0x11c534[_0x7b6a('0x44')][_0x7b6a('0xc7')]);_0x31a0e4[_0x7b6a('0xc8')]=qs['filters'](_[_0x7b6a('0xc9')](_0x11c534['query'],_0x3414ae[_0x7b6a('0x59')]));if(_0x11c534[_0x7b6a('0x44')][_0x7b6a('0x2e')]){_0x31a0e4[_0x7b6a('0xc8')]=_[_0x7b6a('0xca')](_0x31a0e4[_0x7b6a('0xc8')],{'$or':_[_0x7b6a('0x30')](_0x31a0e4[_0x7b6a('0x48')],function(_0x562cfb){var _0x196474={};_0x196474[_0x562cfb]={'$like':'%'+_0x11c534[_0x7b6a('0x44')]['filter']+'%'};return _0x196474;})});}_0x31a0e4[_0x7b6a('0x56')]=db[_0x7b6a('0x3a')];_0x31a0e4['as']=_0x7b6a('0x2a');_0x31a0e4=_[_0x7b6a('0xca')]({},_0x31a0e4,_0x11c534['options']);return _0x4633c4[_0x7b6a('0xf8')]({'include':[_0x31a0e4]});}})['then'](function(_0x4d238b){if(_0x4d238b){var _0x5e800f={},_0x157003=[];for(var _0x6a1099=0x0;_0x6a1099<_0x4d238b[_0x7b6a('0x4d')];_0x6a1099+=0x1){for(var _0x4d30de=0x0,_0xfda24c;_0x4d30de<_0x4d238b[_0x6a1099][_0x7b6a('0x2a')][_0x7b6a('0x4d')];_0x4d30de+=0x1){_0xfda24c=_0x4d238b[_0x6a1099]['Agents'][_0x4d30de][_0x7b6a('0x26')]({'plain':!![]});_0x5e800f[_0xfda24c['id']]=_0xfda24c;}}_0x5e800f=_[_0x7b6a('0x129')](_0x5e800f);for(var _0x4e46cc=qs['offset'](_0x11c534['query']['offset']);_0x4e46cc<_0x5e800f[_0x7b6a('0x4d')]&&_0x157003['length']=_0x1a8554){_0x4b9d04=_0x1a8554;_0x2e5ba4=0xc8;}else{_0x2e5ba4=0xce;}_0x37d910[_0x0306('0x20')](_0x2e5ba4);return _0x37d910[_0x0306('0x27')](_0x0306('0x28'),_0x1eaf3c+'-'+_0x4b9d04+'/'+_0x1a8554)['json'](_0x2c8df7);}return null;};}function saveUpdates(_0x1be0f1){return function(_0x46d247){if(_0x46d247){return _0x46d247[_0x0306('0x29')](_0x1be0f1)[_0x0306('0x2a')](function(_0x5aa6f7){return _0x5aa6f7;});}return null;};}function removeEntity(_0x155c61){return function(_0xe7146e){if(_0xe7146e){return _0xe7146e[_0x0306('0x2b')]()[_0x0306('0x2a')](function(){var _0x912ac5=_0xe7146e['get']({'plain':!![]});if(_0x912ac5[_0x0306('0x2c')]==='admin')return;var _0xebda3e=[{'name':_0x0306('0x2d'),'value':_0x0306('0x2e'),'ignore':!![]},{'name':_0x0306('0x2f'),'value':_0x0306('0x30'),'ignore':![]},{'name':_0x0306('0x31'),'value':_0x0306('0x32'),'ignore':![]}];var _0x19bfb6=_(_0xebda3e)[_0x0306('0x33')]('ignore')[_0x0306('0x34')](_0x0306('0x35'))[_0x0306('0x35')]();if(_['includes'](_0x19bfb6,_0x912ac5[_0x0306('0x2c')])){return;}var _0x5bac49=_[_0x0306('0x36')](_0xebda3e,['value',_0x912ac5[_0x0306('0x2c')]])[_0x0306('0x37')];return db[_0x0306('0x38')][_0x0306('0x2b')]({'where':{'type':_0x5bac49,'resourceId':_0x912ac5['id']}})['then'](function(){return _0xe7146e;});})['then'](function(){_0x155c61[_0x0306('0x20')](0xcc)[_0x0306('0x21')]();});}};}function handleEntityNotFound(_0x1eef17){return function(_0x57d692){if(!_0x57d692){_0x1eef17[_0x0306('0x39')](0x194);}return _0x57d692;};}function handleError(_0x479fd6,_0x303d3f){_0x303d3f=_0x303d3f||0x1f4;return function(_0x1ff98b){logger[_0x0306('0x1b')](_0x1ff98b['stack']);if(_0x1ff98b[_0x0306('0x37')]){delete _0x1ff98b['name'];}_0x479fd6[_0x0306('0x20')](_0x303d3f)[_0x0306('0x3a')](_0x1ff98b);};}exports['index']=function(_0x1dbfd8,_0x1dfb81){var _0x419c86={},_0xe666ba={'count':0x0,'rows':[]};var _0x4e4af1=_(db[_0x0306('0x3b')][_0x0306('0x3c')])['map'](function(_0x56b401){return{'name':_0x56b401[_0x0306('0x3d')],'type':_0x56b401[_0x0306('0x3e')][_0x0306('0x3f')]};})[_0x0306('0x33')](function(_0x148079){return!_[_0x0306('0x40')]([_0x0306('0x41'),_0x0306('0x42')],_0x148079['name']);})['value']();_0x419c86=qs[_0x0306('0x43')](_0x4e4af1,_0x1dbfd8);var _0x457699={'where':_0x419c86[_0x0306('0x44')]};return db['User'][_0x0306('0x26')](_0x457699)[_0x0306('0x2a')](function(_0x21c72b){_0xe666ba[_0x0306('0x26')]=_0x21c72b;if(_0x1dbfd8[_0x0306('0x45')]['includeAll']){_0x419c86[_0x0306('0x46')]=[{'all':!![]}];}if(_0x1dbfd8[_0x0306('0x45')][_0x0306('0x47')]==='true'){_0x419c86[_0x0306('0x46')]=[{'model':db[_0x0306('0x48')],'as':_0x0306('0x47')}];}if(!_[_0x0306('0x40')](_0x419c86['attributes'],'id')){_0x419c86[_0x0306('0x49')][_0x0306('0x4a')]('id');}return db[_0x0306('0x3b')][_0x0306('0x4b')](_0x419c86);})[_0x0306('0x2a')](function(_0x30c319){_0xe666ba[_0x0306('0x4c')]=_0x30c319;if(_0x1dbfd8['query'][_0x0306('0x4d')]==='true'){var _0x52faf1=[];for(var _0x392d33=0x0;_0x392d33<_0xe666ba[_0x0306('0x4c')][_0x0306('0x4e')];_0x392d33++){_0x52faf1['push'](get_open_tabs(_0x0306('0x4f'),_0xe666ba['rows'][_0x392d33]['dataValues']));_0x52faf1[_0x0306('0x4a')](get_open_tabs(_0x0306('0x50'),_0xe666ba[_0x0306('0x4c')][_0x392d33][_0x0306('0x51')]));_0x52faf1['push'](get_open_tabs('fax',_0xe666ba[_0x0306('0x4c')][_0x392d33][_0x0306('0x51')]));_0x52faf1[_0x0306('0x4a')](get_open_tabs(_0x0306('0x52'),_0xe666ba['rows'][_0x392d33][_0x0306('0x51')]));_0x52faf1[_0x0306('0x4a')](get_open_tabs(_0x0306('0x53'),_0xe666ba[_0x0306('0x4c')][_0x392d33]['dataValues']));_0x52faf1['push'](get_open_tabs(_0x0306('0x54'),_0xe666ba[_0x0306('0x4c')][_0x392d33]['dataValues']));}return BPromise['all'](_0x52faf1)[_0x0306('0x2a')](function(){return _0xe666ba;});}else{return _0xe666ba;}})[_0x0306('0x2a')](respondWithFilteredResult(_0x1dfb81,_0x419c86))[_0x0306('0x1f')](handleError(_0x1dfb81,null));};exports[_0x0306('0x55')]=function(_0x3adca6,_0xc38679){var _0x5c9a42={'raw':![],'where':{'id':_0x3adca6[_0x0306('0x56')]['id']}},_0x25fd3f={};_0x25fd3f[_0x0306('0x57')]=_[_0x0306('0x58')](_['keys'](db[_0x0306('0x3b')][_0x0306('0x3c')]),['password',_0x0306('0x42')]);_0x25fd3f['query']=_[_0x0306('0x59')](_0x3adca6[_0x0306('0x45')]);_0x25fd3f[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x25fd3f[_0x0306('0x57')],_0x25fd3f[_0x0306('0x45')]);_0x5c9a42[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x25fd3f[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x3adca6[_0x0306('0x45')]['fields']));_0x5c9a42['attributes']=_0x5c9a42[_0x0306('0x49')][_0x0306('0x4e')]?_0x5c9a42[_0x0306('0x49')]:_0x25fd3f[_0x0306('0x57')];if(_0x3adca6[_0x0306('0x45')]['includeAll']){_0x5c9a42[_0x0306('0x46')]=[{'all':!![]}];}if(_0x3adca6['query'][_0x0306('0x47')]===_0x0306('0x5d')){_0x5c9a42[_0x0306('0x46')]=[{'model':db[_0x0306('0x48')],'as':_0x0306('0x47')}];}_0x5c9a42=_[_0x0306('0x5e')]({},_0x5c9a42,_0x3adca6[_0x0306('0x5f')]);if(!_['includes'](_0x5c9a42[_0x0306('0x49')],'id')){_0x5c9a42[_0x0306('0x49')][_0x0306('0x4a')]('id');}return db[_0x0306('0x3b')]['find'](_0x5c9a42)[_0x0306('0x2a')](handleEntityNotFound(_0xc38679,null))['then'](function(_0x1a483e){var _0x294b82=[];values=_0x1a483e;if(_0x3adca6['query']['openTabs']===_0x0306('0x5d')){_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x4f'),_0x1a483e[_0x0306('0x51')]));_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x50'),_0x1a483e[_0x0306('0x51')]));_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x53'),_0x1a483e[_0x0306('0x51')]));_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x54'),_0x1a483e['dataValues']));_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x60'),_0x1a483e[_0x0306('0x51')]));_0x294b82[_0x0306('0x4a')](get_open_tabs(_0x0306('0x52'),_0x1a483e[_0x0306('0x51')]));return BPromise['all'](_0x294b82);}else{return values;}})[_0x0306('0x2a')](function(){return values;})[_0x0306('0x2a')](respondWithResult(_0xc38679,null))['catch'](handleError(_0xc38679,null));};exports[_0x0306('0x29')]=function(_0xb948bb,_0x22f983){if(_0xb948bb['body']['id']){delete _0xb948bb[_0x0306('0x61')]['id'];}delete _0xb948bb['body'][_0x0306('0x2c')];return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0xb948bb[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x22f983,null))[_0x0306('0x2a')](saveUpdates(_0xb948bb[_0x0306('0x61')],null))[_0x0306('0x2a')](respondWithResult(_0x22f983,null))['catch'](handleError(_0x22f983,null));};exports[_0x0306('0x62')]=function(_0xbdd295,_0x1ad318){return db[_0x0306('0x3b')]['describe']()[_0x0306('0x2a')](respondWithResult(_0x1ad318,null))[_0x0306('0x1f')](handleError(_0x1ad318,null));};exports[_0x0306('0x63')]=function(_0x1d031,_0x578ae9){return db['User'][_0x0306('0x36')]({'where':{'id':_0x1d031[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x578ae9,null))[_0x0306('0x2a')](function(_0x5f409f){if(_0x5f409f){return _0x5f409f['addContacts'](_0x1d031[_0x0306('0x61')][_0x0306('0x64')],_[_0x0306('0x65')](_0x1d031[_0x0306('0x61')],[_0x0306('0x64'),'id'])||{});}})[_0x0306('0x2a')](respondWithResult(_0x578ae9,null))[_0x0306('0x1f')](handleError(_0x578ae9,null));};function validateUser(_0x2ef046){return new BPromise(function(_0x36cf83,_0x2960e9){if(_0x2ef046[_0x0306('0x66')])return _0x36cf83(_0x2ef046);return db[_0x0306('0x67')]['findById'](0x1)['then'](function(_0x45a4e4){if(_0x45a4e4[_0x0306('0x68')])authService['validatePasswordPattern'](_0x2ef046[_0x0306('0x41')]);db['User'][_0x0306('0x69')]('internal')['then'](function(_0x496f65){if(_['isNil'](_0x496f65)){_0x2ef046[_0x0306('0x66')]=_0x45a4e4[_0x0306('0x6a')]||0x1;return;}if(_[_0x0306('0x6b')](_0x45a4e4[_0x0306('0x6a')])||_0x45a4e4[_0x0306('0x6a')]===_0x496f65){_0x2ef046[_0x0306('0x66')]=_0x496f65+0x1;return;}if(_0x45a4e4['min_internal']>_0x496f65){_0x2ef046[_0x0306('0x66')]=_0x45a4e4['min_internal'];return;}return db[_0x0306('0x6c')][_0x0306('0x45')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0306('0x6c')][_0x0306('0x6d')][_0x0306('0x6e')]})[_0x0306('0x2a')](function(_0x33946d){if(_0x33946d&&_0x33946d[_0x0306('0x4e')]){for(var _0x4661c0=0x0,_0xd6925a=_0x33946d[_0x0306('0x4e')];_0x4661c0<_0xd6925a&&_[_0x0306('0x6b')](_0x2ef046[_0x0306('0x66')]);_0x4661c0++){if(_0x45a4e4[_0x0306('0x6a')]<=_0x33946d[_0x4661c0][_0x0306('0x6f')]){_0x2ef046['internal']=_0x33946d[_0x4661c0]['from'];}else if(_0x45a4e4[_0x0306('0x6a')]>_0x33946d[_0x4661c0][_0x0306('0x6f')]&&_0x45a4e4[_0x0306('0x6a')]<=_0x33946d[_0x4661c0]['to']){_0x2ef046[_0x0306('0x66')]=_0x45a4e4[_0x0306('0x6a')];}}}if(_[_0x0306('0x6b')](_0x2ef046[_0x0306('0x66')])){_0x2ef046['internal']=_0x496f65+0x1;}return _0x36cf83(_0x2ef046);});});})[_0x0306('0x1f')](function(_0x39c469){_0x2960e9(_0x39c469);});});}function updateUser(_0x61036d){return new BPromise(function(_0x3d2763,_0x425c17){try{if(_0x61036d['voicemail']){_0x61036d[_0x0306('0x70')]=_0x61036d[_0x0306('0x66')];_0x61036d['VoiceMail']={'mailbox':_0x61036d[_0x0306('0x66')],'password':_0x61036d[_0x0306('0x41')],'fullname':_0x61036d[_0x0306('0x71')],'email':_0x61036d[_0x0306('0x72')]};}if(_0x61036d[_0x0306('0x2c')]===_0x0306('0x30')){if(!_0x61036d[_0x0306('0x73')])_0x61036d[_0x0306('0x73')]=[_0x0306('0x74'),_0x0306('0x75'),'103',_0x0306('0x76'),_0x0306('0x77'),_0x0306('0x78'),_0x0306('0x79'),_0x0306('0x7a'),_0x0306('0x7b'),_0x0306('0x7c'),'109','100','111',_0x0306('0x7d'),_0x0306('0x7e')];}_0x3d2763(_0x61036d);}catch(_0x4ad227){_0x425c17(_0x4ad227);}});}exports['create']=function(_0x3dbf92,_0x873c1){if(_0x3dbf92[_0x0306('0x2e')][_0x0306('0x2c')]===_0x0306('0x30'))throw new Error(_0x0306('0x7f'));if(_0x3dbf92[_0x0306('0x61')]['role']===_0x0306('0x2e')&&_0x3dbf92['user'][_0x0306('0x2c')]!==_0x0306('0x80')){throw new Error(_0x0306('0x81'));}if(_0x3dbf92[_0x0306('0x61')]['role']===_0x0306('0x80')&&_0x3dbf92[_0x0306('0x2e')][_0x0306('0x2c')]!==_0x0306('0x80')){throw new Error(_0x0306('0x82'));}return licenseUtil['checkUserLimits']([_0x3dbf92[_0x0306('0x61')]])[_0x0306('0x2a')](function(){return validateUser(_0x3dbf92['body']);})['then'](function(_0x3931b3){return updateUser(_0x3931b3)[_0x0306('0x2a')](function(_0x3e049e){if(_0x3e049e['role']===_0x0306('0x80')){_0x3e049e[_0x0306('0x83')]=_0x3dbf92[_0x0306('0x2e')][_0x0306('0x83')];delete _0x3e049e['userProfileId'];}return _0x3e049e;});})[_0x0306('0x2a')](function(_0x30dfaa){return db[_0x0306('0x3b')][_0x0306('0x84')](_0x30dfaa,{'include':[{'model':db['VoiceMail'],'as':_0x0306('0x85')}]});})[_0x0306('0x2a')](function(_0x3c47f1){if(_0x3dbf92[_0x0306('0x61')][_0x0306('0x2c')]==='user')return _0x3c47f1;if(_0x3dbf92[_0x0306('0x2e')][_0x0306('0x2c')]!=='user')return _0x3c47f1;return db[_0x0306('0x86')][_0x0306('0x36')]({'where':{'name':_0x3c47f1[_0x0306('0x2c')]===_0x0306('0x30')?'Agents':_0x0306('0x31'),'userProfileId':_0x3dbf92['user'][_0x0306('0x87')]},'raw':!![]})['then'](function(_0x2c7ef5){if(!_0x2c7ef5||_0x2c7ef5['autoAssociation']!=0x0)return _0x3c47f1;return db[_0x0306('0x38')][_0x0306('0x84')]({'name':_0x3c47f1[_0x0306('0x37')],'resourceId':_0x3c47f1['id'],'type':_0x2c7ef5[_0x0306('0x37')],'sectionId':_0x2c7ef5['id']},{})[_0x0306('0x2a')](function(){return _0x3c47f1;});})[_0x0306('0x1f')](function(_0x26f983){logger['error'](_0x0306('0x88'),_0x26f983);throw _0x26f983;});})[_0x0306('0x2a')](respondWithResult(_0x873c1,0xc9))[_0x0306('0x1f')](handleError(_0x873c1,null));};exports[_0x0306('0x89')]=function(_0x514609,_0x1a710f){var _0x19c150=_0x514609[_0x0306('0x61')];var _0x461500=[];if(_0x514609[_0x0306('0x2e')][_0x0306('0x2c')]==='agent')throw new Error(_0x0306('0x7f'));if(_[_0x0306('0x8a')](_0x19c150,[_0x0306('0x2c'),_0x0306('0x2e')])&&_0x514609['user'][_0x0306('0x2c')]!=='admin'){throw new Error(_0x0306('0x81'));}if(_[_0x0306('0x8a')](_0x19c150,[_0x0306('0x2c'),_0x0306('0x80')])&&_0x514609[_0x0306('0x2e')][_0x0306('0x2c')]!==_0x0306('0x80')){throw new Error(_0x0306('0x8b'));}return licenseUtil[_0x0306('0x8c')](_0x19c150)[_0x0306('0x2a')](function(){return validateUser(_0x19c150[0x0]);})[_0x0306('0x2a')](function(){for(var _0x589001=0x1;_0x589001<_0x19c150[_0x0306('0x4e')];_0x589001++){var _0x11becf=_0x19c150[_0x589001-0x1]['internal'];if(!_0x19c150[_0x589001][_0x0306('0x66')])_0x19c150[_0x589001][_0x0306('0x66')]=_0x11becf+0x1;_0x461500[_0x0306('0x4a')](validateUser(_0x19c150[_0x589001]));}return BPromise[_0x0306('0x8d')](_0x461500);})[_0x0306('0x2a')](function(){_0x461500=[];for(var _0x4c028b=0x0;_0x4c028b<_0x19c150['length'];_0x4c028b++){_0x461500[_0x0306('0x4a')](updateUser(_0x19c150[_0x4c028b]));}return BPromise[_0x0306('0x8d')](_0x461500);})['then'](function(){return BPromise['each'](_0x19c150,function(_0x3d59b3){return db[_0x0306('0x3b')][_0x0306('0x84')](_0x3d59b3,{'include':[{'model':db[_0x0306('0x85')],'as':'VoiceMail'}]})[_0x0306('0x2a')](function(_0x17a3d3){_0x3d59b3['id']=_0x17a3d3['id'];return _0x3d59b3;});});})[_0x0306('0x2a')](function(_0x55f59b){if(_0x514609[_0x0306('0x61')]['role']===_0x0306('0x2e'))return _0x55f59b;if(_0x514609['user'][_0x0306('0x2c')]!==_0x0306('0x2e'))return _0x55f59b;var _0x5939a=_[_0x0306('0x8a')](_0x55f59b,function(_0x30841a){return _0x30841a[_0x0306('0x2c')]===_0x0306('0x30')||_0x30841a[_0x0306('0x2c')]===_0x0306('0x32');});if(!_0x5939a)return _0x55f59b;return db['UserProfileSection'][_0x0306('0x4b')]({'where':{'name':{'$or':[_0x0306('0x2f'),_0x0306('0x31')]},'userProfileId':_0x514609['user']['userProfileId']},'raw':!![]})[_0x0306('0x2a')](function(_0x175dd5){if(_[_0x0306('0x8e')](_0x175dd5)||!_[_0x0306('0x8a')](_0x175dd5,[_0x0306('0x8f'),0x0]))return _0x55f59b;_0x461500=[];var _0x1bfd26=_(_0x175dd5)[_0x0306('0x34')](function(_0xab396a){if(_0xab396a[_0x0306('0x8f')]===0x1)return;return _0xab396a[_0x0306('0x37')]===_0x0306('0x2f')?'agent':'telephone';})[_0x0306('0x90')]()[_0x0306('0x35')]();for(var _0x2da2ef=0x0;_0x2da2ef<_0x55f59b['length'];_0x2da2ef++){if(!_[_0x0306('0x40')](_0x1bfd26,_0x55f59b[_0x2da2ef][_0x0306('0x2c')]))return;var _0x31d718=_0x55f59b[_0x2da2ef][_0x0306('0x2c')]===_0x0306('0x30')?_0x0306('0x2f'):_0x0306('0x31');_0x461500[_0x0306('0x4a')](db[_0x0306('0x38')]['create']({'name':_0x55f59b[_0x2da2ef]['name'],'resourceId':_0x55f59b[_0x2da2ef]['id'],'type':_0x31d718,'sectionId':_[_0x0306('0x36')](_0x175dd5,[_0x0306('0x37'),_0x31d718])['id']},{}));}return BPromise[_0x0306('0x8d')](_0x461500);});})[_0x0306('0x2a')](respondWithResult(_0x1a710f,0xc9))['catch'](handleError(_0x1a710f,null));};exports[_0x0306('0x91')]=function(_0x2607c1,_0xf1a2cc){if(_0x2607c1[_0x0306('0x61')]['id']){delete _0x2607c1[_0x0306('0x61')]['id'];}return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0x2607c1['params']['id']}})[_0x0306('0x2a')](function(_0x3a06d6){if(!_0x3a06d6)return null;if(_0x3a06d6['id']===_0x2607c1['user']['id']){if(!_0x2607c1['body'][_0x0306('0x92')]||!_0x2607c1[_0x0306('0x61')][_0x0306('0x93')]){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0x96'));}if(!_0x3a06d6[_0x0306('0x97')](_0x2607c1[_0x0306('0x61')][_0x0306('0x92')])){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0x98'));}if(_0x2607c1[_0x0306('0x61')][_0x0306('0x92')]===_0x2607c1[_0x0306('0x61')][_0x0306('0x93')]){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2607c1[_0x0306('0x2e')][_0x0306('0x2c')]===_0x0306('0x80')){if(!_0x2607c1[_0x0306('0x61')]['newPassword']){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0x99'));}}else if(_0x2607c1[_0x0306('0x2e')][_0x0306('0x2c')]===_0x0306('0x2e')){if(!_0x2607c1[_0x0306('0x61')]['newPassword']){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0x99'));}if(_0x3a06d6['role']!==_0x0306('0x30')){throw new db['Sequelize'][(_0x0306('0x95'))](_0x0306('0x7f'));}}else{throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0x7f'));}return _0x3a06d6;})[_0x0306('0x2a')](handleEntityNotFound(_0xf1a2cc,null))[_0x0306('0x2a')](function(_0x3eea0e){return db[_0x0306('0x67')][_0x0306('0x9a')]({'attributes':['id',_0x0306('0x68'),_0x0306('0x9b'),_0x0306('0x9c')]})[_0x0306('0x2a')](function(_0x1a052b){if(_0x1a052b[_0x0306('0x68')])authService[_0x0306('0x9d')](_0x2607c1[_0x0306('0x61')]['newPassword']);if(!_0x1a052b[_0x0306('0x9b')]||!_0x3eea0e[_0x0306('0x9e')])return _0x3eea0e;authService[_0x0306('0x9f')](_0x2607c1['body']['newPassword'],_0x3eea0e[_0x0306('0x9e')],_0x1a052b['passwordHistoryLimit']);return _0x3eea0e;})['then'](saveUpdates({'password':_0x2607c1[_0x0306('0x61')]['newPassword'],'passwordResetAt':_0x2607c1[_0x0306('0x2e')]['id']==_0x2607c1[_0x0306('0x56')]['id']?moment():null,'previousPasswords':authService[_0x0306('0xa0')](_0x2607c1[_0x0306('0x61')][_0x0306('0x93')],_0x3eea0e[_0x0306('0x9e')])},null));})[_0x0306('0x2a')](respondWithResult(_0xf1a2cc,null))[_0x0306('0x1f')](handleError(_0xf1a2cc,null));};exports[_0x0306('0xa1')]=function(_0x1b4222,_0x915830){var _0x107788=_0x1b4222['body']['channel'];return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0x1b4222[_0x0306('0x56')]['id']},'attributes':['id',_0x0306('0x37'),_0x0306('0x2c'),_0x0306('0xa2'),'loginInPause',_0x0306('0xa3'),_0x0306('0xa4')]})[_0x0306('0x2a')](handleEntityNotFound(_0x915830,null))[_0x0306('0x2a')](function(_0x31f7a0){if(_0x31f7a0){if(!utils[_0x0306('0xa5')](_0x107788)){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('Unknown\x20channel');}return _0x31f7a0['add'+_['capitalize'](_0x107788[_0x0306('0xa6')]())+_0x0306('0xa7')](_0x1b4222[_0x0306('0x61')][_0x0306('0x64')],{'penalty':_0x1b4222[_0x0306('0x61')][_0x0306('0xa8')]||0x0})[_0x0306('0xa9')](function(_0x1eeee6){for(var _0x5c205b=0x0;_0x5c205b<_0x1b4222['body'][_0x0306('0x64')][_0x0306('0x4e')];_0x5c205b+=0x1){var _0x5932d1={'UserId':Number(_0x1b4222[_0x0306('0x56')]['id'])};_0x5932d1[_[_0x0306('0xaa')](_0x107788[_0x0306('0xa6')]())+_0x0306('0xab')]=Number(_0x1b4222[_0x0306('0x61')][_0x0306('0x64')][_0x5c205b]);socket[_0x0306('0xac')]('user'+_['capitalize'](_0x107788[_0x0306('0xa6')]())+'Queue:save',_0x5932d1);}return _0x1eeee6;})[_0x0306('0x2a')](function(){if(_0x107788===_0x0306('0xad')){return db[_0x0306('0xae')][_0x0306('0x4b')]({'where':{'id':_0x1b4222[_0x0306('0x61')][_0x0306('0x64')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x0306('0x2a')](function(_0x244f8d){var _0xf3a00=_0x31f7a0[_0x0306('0xaf')]({'plain':!![]});var _0x101615=[];if(_0x107788===_0x0306('0xad')&&_0xf3a00['role']===_0x0306('0x30')&&_0xf3a00[_0x0306('0xa2')]){for(var _0x5a7f21=0x0;_0x5a7f21<_0x244f8d[_0x0306('0x4e')];_0x5a7f21+=0x1){_0x101615['push']({'membername':_0xf3a00[_0x0306('0x37')],'UserId':_0xf3a00['id'],'queue_name':_0x244f8d[_0x5a7f21][_0x0306('0x37')],'VoiceQueueId':_0x244f8d[_0x5a7f21]['id'],'interface':_[_0x0306('0x6b')](_0xf3a00[_0x0306('0xa4')])?util[_0x0306('0xb0')](_0x0306('0xb1'),_0xf3a00[_0x0306('0x37')]):_0xf3a00[_0x0306('0xa4')],'paused':_0xf3a00[_0x0306('0xa3')]||![],'penalty':_0x1b4222['body'][_0x0306('0xa8')]||0x0});}return BPromise[_0x0306('0xb2')](_0x101615,function(_0x188bf9){return db[_0x0306('0xb3')]['upsert'](_0x188bf9);});}return _0x31f7a0;});}})['then'](respondWithStatusCode(_0x915830,null))['catch'](handleError(_0x915830,null));};exports[_0x0306('0xb4')]=function(_0xdac37b,_0x4251d6){var _0x25380d,_0x2b32a3;return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0xdac37b[_0x0306('0x56')]['id']},'attributes':['id',_0x0306('0x37'),'role']})[_0x0306('0x2a')](handleEntityNotFound(_0x4251d6,null))[_0x0306('0x2a')](function(_0x54d59c){if(_0x54d59c){_0x25380d=_0x54d59c;if(!_0xdac37b[_0x0306('0x45')][_0x0306('0xb5')]||!utils[_0x0306('0xa5')](_0xdac37b[_0x0306('0x45')][_0x0306('0xb5')])){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('Unknown\x20channel');}return _0x54d59c['remove'+_[_0x0306('0xaa')](_0xdac37b['query'][_0x0306('0xb5')][_0x0306('0xa6')]())+_0x0306('0xa7')](_0xdac37b['query'][_0x0306('0x64')]);}})['then'](function(_0xef87d3){if(_[_0x0306('0xb6')](_0xdac37b['query']['ids'])){for(var _0xfc474b=0x0;_0xfc474b<_0xdac37b[_0x0306('0x45')][_0x0306('0x64')][_0x0306('0x4e')];_0xfc474b+=0x1){_0x2b32a3={'UserId':Number(_0xdac37b[_0x0306('0x56')]['id'])};_0x2b32a3[_[_0x0306('0xaa')](_0xdac37b[_0x0306('0x45')]['channel'][_0x0306('0xa6')]())+'QueueId']=Number(_0xdac37b[_0x0306('0x45')][_0x0306('0x64')][_0xfc474b]);socket[_0x0306('0xac')](_0x0306('0x2e')+_[_0x0306('0xaa')](_0xdac37b[_0x0306('0x45')][_0x0306('0xb5')]['toLowerCase']())+_0x0306('0xb7'),_0x2b32a3);}}else{_0x2b32a3={'UserId':Number(_0xdac37b[_0x0306('0x56')]['id'])};_0x2b32a3[_[_0x0306('0xaa')](_0xdac37b[_0x0306('0x45')][_0x0306('0xb5')][_0x0306('0xa6')]())+_0x0306('0xab')]=Number(_0xdac37b[_0x0306('0x45')][_0x0306('0x64')]);socket[_0x0306('0xac')]('user'+_[_0x0306('0xaa')](_0xdac37b['query']['channel']['toLowerCase']())+_0x0306('0xb7'),_0x2b32a3);}return _0xef87d3;})[_0x0306('0x2a')](function(){if(_0xdac37b[_0x0306('0x45')][_0x0306('0xb5')]==='voice'){return db[_0x0306('0xb3')][_0x0306('0x2b')]({'where':{'UserId':_0xdac37b[_0x0306('0x56')]['id'],'VoiceQueueId':_0xdac37b[_0x0306('0x45')][_0x0306('0x64')]},'individualHooks':!![]})[_0x0306('0x2a')](function(){return _0x25380d;});}return _0x25380d;})[_0x0306('0x2a')](respondWithStatusCode(_0x4251d6,null))['catch'](handleError(_0x4251d6,null));};exports[_0x0306('0xb8')]=function(_0x2d8851,_0x3ecb60){_0x2d8851['body'][_0x0306('0xb9')]=_0x2d8851[_0x0306('0xba')]['filename'];return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0x2d8851[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x3ecb60,null))['then'](saveUpdates(_0x2d8851[_0x0306('0x61')],null))[_0x0306('0x2a')](respondWithResult(_0x3ecb60,null))[_0x0306('0x1f')](handleError(_0x3ecb60,null));};exports[_0x0306('0xbb')]=function(_0x48fb19,_0x49933f){var _0x37bf42=path[_0x0306('0xbc')](config['root'],_0x0306('0xbd'));return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0x48fb19['params']['id']},'attributes':['id',_0x0306('0xb9')],'raw':!![]})[_0x0306('0x2a')](handleEntityNotFound(_0x49933f,null))[_0x0306('0x2a')](function(_0x54a217){if(_0x54a217){if(_[_0x0306('0x6b')](_0x54a217[_0x0306('0xb9')])){return _0x49933f['download'](_0x37bf42);}else{if(!fs[_0x0306('0xbe')](path['join'](config['root'],_0x0306('0xbf'),_0x54a217[_0x0306('0xb9')]))){return _0x49933f[_0x0306('0xc0')](_0x37bf42);}return _0x49933f[_0x0306('0xc0')](path[_0x0306('0xbc')](config['root'],_0x0306('0xbf'),_0x54a217[_0x0306('0xb9')]));}}})[_0x0306('0x1f')](handleError(_0x49933f,null));};exports[_0x0306('0xc1')]=function(_0x271e1f,_0x142e47){return db['User'][_0x0306('0x36')]({'where':{'id':_0x271e1f[_0x0306('0x56')]['id']},'attributes':['id']})[_0x0306('0x2a')](handleEntityNotFound(_0x142e47,null))['then'](function(_0x302faa){var _0x2d6199=[];values=_0x302faa[_0x0306('0x51')];_0x2d6199['push'](get_open_tabs(_0x0306('0x4f'),_0x302faa[_0x0306('0x51')]));_0x2d6199[_0x0306('0x4a')](get_open_tabs(_0x0306('0x50'),_0x302faa['dataValues']));_0x2d6199[_0x0306('0x4a')](get_open_tabs(_0x0306('0x53'),_0x302faa[_0x0306('0x51')]));_0x2d6199[_0x0306('0x4a')](get_open_tabs(_0x0306('0x54'),_0x302faa['dataValues']));_0x2d6199[_0x0306('0x4a')](get_open_tabs('fax',_0x302faa['dataValues']));_0x2d6199[_0x0306('0x4a')](get_open_tabs(_0x0306('0x52'),_0x302faa[_0x0306('0x51')]));return BPromise['all'](_0x2d6199);})[_0x0306('0x2a')](function(_0x38a566){if(_0x38a566){var _0xf44f29=_[_0x0306('0x34')](values[_0x0306('0xc2')],function(_0x56d968){return{'channel':_0x0306('0xc3'),'id':_0x56d968['id'],'createdAt':_0x56d968[_0x0306('0xc4')]};});var _0x469e2c=_['map'](values[_0x0306('0xc5')],function(_0x1d89fb){return{'channel':_0x0306('0xc6'),'id':_0x1d89fb['id'],'createdAt':_0x1d89fb[_0x0306('0xc4')]};});var _0x3edaf9=_['map'](values[_0x0306('0xc7')],function(_0x532b5b){return{'channel':_0x0306('0xc8'),'id':_0x532b5b['id'],'createdAt':_0x532b5b[_0x0306('0xc4')]};});var _0x54f593=_['map'](values[_0x0306('0xc9')],function(_0x77f5e2){return{'channel':_0x0306('0xca'),'id':_0x77f5e2['id'],'createdAt':_0x77f5e2[_0x0306('0xc4')]};});var _0x1d92a=_[_0x0306('0x34')](values[_0x0306('0xcb')],function(_0x1ad532){return{'channel':_0x0306('0xcc'),'id':_0x1ad532['id'],'createdAt':_0x1ad532[_0x0306('0xc4')]};});var _0x55f6e0=_[_0x0306('0x34')](values[_0x0306('0xcd')],function(_0x254886){return{'channel':_0x0306('0xce'),'id':_0x254886['id'],'createdAt':_0x254886[_0x0306('0xc4')]};});var _0xb83155=_['concat'](_0xf44f29,_0x469e2c,_0x3edaf9,_0x54f593,_0x1d92a,_0x55f6e0);var _0x57a7df={'count':_0xb83155[_0x0306('0x4e')],'rows':_0xb83155};return _0x57a7df;}else return null;})[_0x0306('0x2a')](respondWithResult(_0x142e47,null))[_0x0306('0x1f')](handleError(_0x142e47,null));};exports[_0x0306('0xcf')]=function(_0x6a4a35,_0x482a8d){var _0x46047d={};var _0x3c169b={};var _0x339fb4;var _0x6635c3;return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x6a4a35['params']['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x482a8d,null))[_0x0306('0x2a')](function(_0x443da2){if(_0x443da2){_0x339fb4=_0x443da2;_0x3c169b[_0x0306('0x57')]=_[_0x0306('0x59')](db['CmContact']['rawAttributes']);_0x3c169b[_0x0306('0x45')]=_[_0x0306('0x59')](_0x6a4a35[_0x0306('0x45')]);_0x3c169b[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x3c169b[_0x0306('0x57')],_0x3c169b['query']);_0x46047d[_0x0306('0x49')]=_['intersection'](_0x3c169b[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x6a4a35[_0x0306('0x45')][_0x0306('0x5c')]));_0x46047d[_0x0306('0x49')]=_0x46047d[_0x0306('0x49')][_0x0306('0x4e')]?_0x46047d[_0x0306('0x49')]:_0x3c169b[_0x0306('0x57')];_0x46047d[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x6a4a35[_0x0306('0x45')][_0x0306('0xd1')]);_0x46047d[_0x0306('0x44')]=qs['filters'](_[_0x0306('0xd2')](_0x6a4a35['query'],_0x3c169b['filters']));if(_0x6a4a35[_0x0306('0x45')][_0x0306('0x33')]){_0x46047d[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x46047d[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x46047d[_0x0306('0x49')],function(_0x30efc2){var _0x1a2e8b={};_0x1a2e8b[_0x30efc2]={'$like':'%'+_0x6a4a35['query'][_0x0306('0x33')]+'%'};return _0x1a2e8b;})});}_0x46047d=_[_0x0306('0x5e')]({},_0x46047d,_0x6a4a35[_0x0306('0x5f')]);return _0x339fb4[_0x0306('0xcf')](_0x46047d);}})['then'](function(_0x4f4a13){if(_0x4f4a13){_0x6635c3=_0x4f4a13['length'];if(_0x6a4a35[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xd4'))){_0x46047d[_0x0306('0x46')]=[{'model':db['CmList'],'as':_0x0306('0xd5'),'required':![]},{'model':db[_0x0306('0xd6')],'as':_0x0306('0xd7'),'attributes':['id',_0x0306('0x37'),_0x0306('0xd8')],'where':_0x6a4a35[_0x0306('0x45')][_0x0306('0xd9')]?{'id':_0x6a4a35[_0x0306('0x45')][_0x0306('0xd9')]}:undefined,'required':_0x6a4a35['query'][_0x0306('0xd9')]?!![]:![]}];}if(!_0x6a4a35[_0x0306('0x45')]['hasOwnProperty'](_0x0306('0xda'))){_0x46047d[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x6a4a35[_0x0306('0x45')][_0x0306('0x25')]);_0x46047d['offset']=qs['offset'](_0x6a4a35['query'][_0x0306('0x23')]);}return _0x339fb4[_0x0306('0xcf')](_0x46047d);}})[_0x0306('0x2a')](function(_0x2ee680){if(_0x2ee680){return _0x2ee680?{'count':_0x6635c3,'rows':_0x2ee680}:null;}})[_0x0306('0x2a')](respondWithResult(_0x482a8d,null))[_0x0306('0x1f')](handleError(_0x482a8d,null));};exports[_0x0306('0xdb')]=function(_0xbfc309,_0x155646){var _0x5e4de6;var _0x2c56cb={};var _0x385470;return db['User']['findOne']({'where':{'id':_0xbfc309[_0x0306('0x56')]['id']},'attributes':['id',_0x0306('0x37'),'role']})[_0x0306('0x2a')](handleEntityNotFound(_0x155646,null))[_0x0306('0x2a')](function(_0x252aa8){if(!utils[_0x0306('0xa5')](_0xbfc309[_0x0306('0x45')][_0x0306('0xb5')])){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('Unknown\x20channel');}_0x5e4de6=_0x252aa8;var _0x199c04={};_0x199c04[_0x0306('0x57')]=_['keys'](db[_[_0x0306('0xaa')](_0xbfc309[_0x0306('0x45')][_0x0306('0xb5')])+'Queue'][_0x0306('0x3c')]);_0x199c04[_0x0306('0x45')]=_[_0x0306('0x59')](_0xbfc309[_0x0306('0x45')]);_0x199c04[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x199c04[_0x0306('0x57')],_0x199c04[_0x0306('0x45')]);_0x2c56cb[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x199c04['model'],qs[_0x0306('0x5c')](_0xbfc309[_0x0306('0x45')][_0x0306('0x5c')]));_0x2c56cb[_0x0306('0x49')]=_0x2c56cb['attributes']['length']?_0x2c56cb[_0x0306('0x49')]:_0x199c04[_0x0306('0x57')];_0x2c56cb[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0xbfc309['query'][_0x0306('0xd1')]);_0x2c56cb[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0xbfc309[_0x0306('0x45')],_0x199c04[_0x0306('0x5a')]));if(_0xbfc309[_0x0306('0x45')][_0x0306('0x33')]){_0x2c56cb['where']=_[_0x0306('0x5e')](_0x2c56cb[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x2c56cb['attributes'],function(_0x2d1acf){var _0x43d2f5={};_0x43d2f5[_0x2d1acf]={'$like':'%'+_0xbfc309[_0x0306('0x45')][_0x0306('0x33')]+'%'};return _0x43d2f5;})});}_0x2c56cb=_[_0x0306('0x5e')]({},_0x2c56cb,_0xbfc309[_0x0306('0x5f')]);switch(_0x5e4de6[_0x0306('0x2c')]){case'admin':return db[_[_0x0306('0xaa')](_0xbfc309['query'][_0x0306('0xb5')])+_0x0306('0xdc')][_0x0306('0x4b')](_0x2c56cb);case _0x0306('0x2e'):case _0x0306('0x30'):return _0x5e4de6['get'+_[_0x0306('0xaa')](_0xbfc309['query'][_0x0306('0xb5')])+_0x0306('0xa7')](_0x2c56cb);default:throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('Unknown\x20role');}})[_0x0306('0x2a')](function(_0x3fb58a){_0x385470=_0x3fb58a[_0x0306('0x4e')];if(!_0xbfc309['query'][_0x0306('0xd3')](_0x0306('0xda'))){_0x2c56cb[_0x0306('0x25')]=qs[_0x0306('0x25')](_0xbfc309[_0x0306('0x45')][_0x0306('0x25')]);_0x2c56cb[_0x0306('0x23')]=qs[_0x0306('0x23')](_0xbfc309[_0x0306('0x45')][_0x0306('0x23')]);}switch(_0x5e4de6[_0x0306('0x2c')]){case _0x0306('0x80'):return db[_['capitalize'](_0xbfc309[_0x0306('0x45')][_0x0306('0xb5')])+_0x0306('0xdc')][_0x0306('0x4b')](_0x2c56cb);case _0x0306('0x2e'):case _0x0306('0x30'):return _0x5e4de6['get'+_[_0x0306('0xaa')](_0xbfc309[_0x0306('0x45')][_0x0306('0xb5')])+_0x0306('0xa7')](_0x2c56cb);}})[_0x0306('0x2a')](function(_0x534aef){return{'count':_0x385470,'rows':_0x534aef};})[_0x0306('0x2a')](respondWithResult(_0x155646,null))['catch'](handleError(_0x155646,null));};exports[_0x0306('0xdd')]=function(_0x1b5f98,_0x490aa9){var _0x361284={};var _0x2701b6={};var _0x793c7c;var _0x69bcec;return db[_0x0306('0x3b')]['findOne']({'where':{'id':_0x1b5f98[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x490aa9,null))[_0x0306('0x2a')](function(_0x5dbaab){if(_0x5dbaab){_0x793c7c=_0x5dbaab;_0x2701b6[_0x0306('0x57')]=_['keys'](db['UserVoiceQueueRt'][_0x0306('0x3c')]);_0x2701b6['query']=_[_0x0306('0x59')](_0x1b5f98[_0x0306('0x45')]);_0x2701b6[_0x0306('0x5a')]=_['intersection'](_0x2701b6[_0x0306('0x57')],_0x2701b6[_0x0306('0x45')]);_0x361284['attributes']=_[_0x0306('0x5b')](_0x2701b6[_0x0306('0x57')],qs['fields'](_0x1b5f98['query']['fields']));_0x361284[_0x0306('0x49')]=_0x361284[_0x0306('0x49')][_0x0306('0x4e')]?_0x361284['attributes']:_0x2701b6[_0x0306('0x57')];_0x361284[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x1b5f98[_0x0306('0x45')][_0x0306('0xd1')]);_0x361284['where']=qs[_0x0306('0x5a')](_['pick'](_0x1b5f98['query'],_0x2701b6[_0x0306('0x5a')]));if(_0x1b5f98[_0x0306('0x45')]['filter']){_0x361284[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x361284['where'],{'$or':_[_0x0306('0x34')](_0x361284[_0x0306('0x49')],function(_0x37bdf7){var _0x128e5e={};_0x128e5e[_0x37bdf7]={'$like':'%'+_0x1b5f98[_0x0306('0x45')]['filter']+'%'};return _0x128e5e;})});}_0x361284=_[_0x0306('0x5e')]({},_0x361284,_0x1b5f98[_0x0306('0x5f')]);return _0x793c7c[_0x0306('0xdd')](_0x361284);}})[_0x0306('0x2a')](function(_0x513008){if(_0x513008){_0x69bcec=_0x513008['length'];if(!_0x1b5f98[_0x0306('0x45')][_0x0306('0xd3')]('nolimit')){_0x361284[_0x0306('0x25')]=qs['limit'](_0x1b5f98[_0x0306('0x45')][_0x0306('0x25')]);_0x361284[_0x0306('0x23')]=qs['offset'](_0x1b5f98[_0x0306('0x45')][_0x0306('0x23')]);}return _0x793c7c[_0x0306('0xdd')](_0x361284);}})[_0x0306('0x2a')](function(_0x576fdd){if(_0x576fdd){return _0x576fdd?{'count':_0x69bcec,'rows':_0x576fdd}:null;}})[_0x0306('0x2a')](respondWithResult(_0x490aa9,null))[_0x0306('0x1f')](handleError(_0x490aa9,null));};exports['getGroups']=function(_0x498d4d,_0x1f9130){var _0x2bb683={};var _0x17815d={};var _0x457def;var _0x5e720a;return db[_0x0306('0x3b')]['findOne']({'where':{'id':_0x498d4d[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x1f9130,null))[_0x0306('0x2a')](function(_0x41bd06){if(_0x41bd06){_0x457def=_0x41bd06;_0x17815d[_0x0306('0x57')]=_['keys'](db[_0x0306('0xde')][_0x0306('0x3c')]);_0x17815d[_0x0306('0x45')]=_[_0x0306('0x59')](_0x498d4d[_0x0306('0x45')]);_0x17815d[_0x0306('0x5a')]=_['intersection'](_0x17815d[_0x0306('0x57')],_0x17815d['query']);_0x2bb683[_0x0306('0x49')]=_['intersection'](_0x17815d[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x498d4d[_0x0306('0x45')][_0x0306('0x5c')]));_0x2bb683[_0x0306('0x49')]=_0x2bb683[_0x0306('0x49')]['length']?_0x2bb683[_0x0306('0x49')]:_0x17815d[_0x0306('0x57')];_0x2bb683['order']=qs[_0x0306('0xd1')](_0x498d4d['query']['sort']);_0x2bb683[_0x0306('0x44')]=qs[_0x0306('0x5a')](_['pick'](_0x498d4d[_0x0306('0x45')],_0x17815d['filters']));if(_0x498d4d[_0x0306('0x45')][_0x0306('0x33')]){_0x2bb683['where']=_[_0x0306('0x5e')](_0x2bb683[_0x0306('0x44')],{'$or':_['map'](_0x2bb683[_0x0306('0x49')],function(_0x3bbb15){var _0x4982c0={};_0x4982c0[_0x3bbb15]={'$like':'%'+_0x498d4d['query'][_0x0306('0x33')]+'%'};return _0x4982c0;})});}_0x2bb683=_[_0x0306('0x5e')]({},_0x2bb683,_0x498d4d[_0x0306('0x5f')]);return _0x457def['getGroups'](_0x2bb683);}})[_0x0306('0x2a')](function(_0x5737c5){if(_0x5737c5){_0x5e720a=_0x5737c5['length'];if(!_0x498d4d['query'][_0x0306('0xd3')](_0x0306('0xda'))){_0x2bb683['limit']=qs['limit'](_0x498d4d[_0x0306('0x45')][_0x0306('0x25')]);_0x2bb683[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x498d4d[_0x0306('0x45')][_0x0306('0x23')]);}return _0x457def['getGroups'](_0x2bb683);}})[_0x0306('0x2a')](function(_0x4cc6ef){if(_0x4cc6ef){return _0x4cc6ef?{'count':_0x5e720a,'rows':_0x4cc6ef}:null;}})['then'](respondWithResult(_0x1f9130,null))[_0x0306('0x1f')](handleError(_0x1f9130,null));};exports[_0x0306('0xdf')]=function(_0x5a03cb,_0x3ccdca){var _0x162765={'raw':!![],'where':{}};var _0x206715={};var _0x682873={'count':0x0,'rows':[]};return db[_0x0306('0x3b')]['findOne']({'where':{'id':_0x5a03cb[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x3ccdca,null))[_0x0306('0x2a')](function(_0x43f497){if(_0x43f497){_0x206715[_0x0306('0x57')]=_['keys'](db[_0x0306('0xe0')][_0x0306('0x3c')]);_0x206715[_0x0306('0x45')]=_[_0x0306('0x59')](_0x5a03cb['query']);_0x206715[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x206715[_0x0306('0x57')],_0x206715[_0x0306('0x45')]);_0x162765['attributes']=_[_0x0306('0x5b')](_0x206715[_0x0306('0x57')],qs['fields'](_0x5a03cb[_0x0306('0x45')][_0x0306('0x5c')]));_0x162765[_0x0306('0x49')]=_0x162765[_0x0306('0x49')]['length']?_0x162765[_0x0306('0x49')]:_0x206715[_0x0306('0x57')];if(!_0x5a03cb[_0x0306('0x45')]['hasOwnProperty']('nolimit')){_0x162765[_0x0306('0x25')]=qs['limit'](_0x5a03cb['query']['limit']);_0x162765[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x5a03cb[_0x0306('0x45')][_0x0306('0x23')]);}_0x162765[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x5a03cb[_0x0306('0x45')][_0x0306('0xd1')]);_0x162765[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x5a03cb[_0x0306('0x45')],_0x206715['filters']));_0x162765[_0x0306('0x44')]['UserId']=_0x43f497['id'];if(_0x5a03cb[_0x0306('0x45')][_0x0306('0x33')]){_0x162765['where']=_[_0x0306('0x5e')](_0x162765[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x162765[_0x0306('0x49')],function(_0x536ba2){var _0x66d10a={};_0x66d10a[_0x536ba2]={'$like':'%'+_0x5a03cb[_0x0306('0x45')][_0x0306('0x33')]+'%'};return _0x66d10a;})});}_0x162765=_[_0x0306('0x5e')]({},_0x162765,_0x5a03cb[_0x0306('0x5f')]);return db['VoiceRecording']['count']({'where':_0x162765['where']})[_0x0306('0x2a')](function(_0x4a0c4f){_0x682873[_0x0306('0x26')]=_0x4a0c4f;if(_0x5a03cb[_0x0306('0x45')][_0x0306('0xd4')]){_0x162765[_0x0306('0x46')]=[{'all':!![]}];}return db[_0x0306('0xe0')][_0x0306('0x4b')](_0x162765);})[_0x0306('0x2a')](function(_0x28113e){_0x682873[_0x0306('0x4c')]=_0x28113e;return _0x682873;});}})[_0x0306('0x2a')](respondWithFilteredResult(_0x3ccdca,_0x162765))[_0x0306('0x1f')](handleError(_0x3ccdca,null));};exports[_0x0306('0xe1')]=function(_0x2651b4,_0x4b2075){var _0x46aaaa={'raw':!![],'where':{}};var _0x49166b={};var _0x3c113d={'count':0x0,'rows':[]};return db[_0x0306('0x3b')]['findOne']({'where':{'id':_0x2651b4[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x4b2075,null))[_0x0306('0x2a')](function(_0x39b815){if(_0x39b815){_0x49166b[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0xe2')][_0x0306('0x3c')]);_0x49166b['query']=_[_0x0306('0x59')](_0x2651b4['query']);_0x49166b[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x49166b['model'],_0x49166b[_0x0306('0x45')]);_0x46aaaa['attributes']=_[_0x0306('0x5b')](_0x49166b[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x2651b4[_0x0306('0x45')][_0x0306('0x5c')]));_0x46aaaa['attributes']=_0x46aaaa[_0x0306('0x49')]['length']?_0x46aaaa[_0x0306('0x49')]:_0x49166b[_0x0306('0x57')];if(!_0x2651b4['query'][_0x0306('0xd3')](_0x0306('0xda'))){_0x46aaaa[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x2651b4[_0x0306('0x45')][_0x0306('0x25')]);_0x46aaaa[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x2651b4[_0x0306('0x45')][_0x0306('0x23')]);}_0x46aaaa[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x2651b4['query'][_0x0306('0xd1')]);_0x46aaaa[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x2651b4[_0x0306('0x45')],_0x49166b['filters']));_0x46aaaa[_0x0306('0x44')][_0x0306('0xe3')]=_0x39b815['id'];if(_0x2651b4[_0x0306('0x45')]['filter']){_0x46aaaa[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x46aaaa[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x46aaaa['attributes'],function(_0x55ef29){var _0x399a76={};_0x399a76[_0x55ef29]={'$like':'%'+_0x2651b4[_0x0306('0x45')][_0x0306('0x33')]+'%'};return _0x399a76;})});}_0x46aaaa=_[_0x0306('0x5e')]({},_0x46aaaa,_0x2651b4[_0x0306('0x5f')]);return db[_0x0306('0xe2')][_0x0306('0x26')]({'where':_0x46aaaa[_0x0306('0x44')]})[_0x0306('0x2a')](function(_0x3ecebd){_0x3c113d[_0x0306('0x26')]=_0x3ecebd;if(_0x2651b4[_0x0306('0x45')][_0x0306('0xd4')]){_0x46aaaa[_0x0306('0x46')]=[{'all':!![]}];}return db[_0x0306('0xe2')][_0x0306('0x4b')](_0x46aaaa);})[_0x0306('0x2a')](function(_0x3a658c){_0x3c113d[_0x0306('0x4c')]=_0x3a658c;return _0x3c113d;});}})['then'](respondWithFilteredResult(_0x4b2075,_0x46aaaa))[_0x0306('0x1f')](handleError(_0x4b2075,null));};exports['getChatInteractions']=function(_0xa6254,_0x23c8c0){var _0x363f16={};var _0xddb274={};var _0xcfd74e;var _0x2bf9b3;return db['User'][_0x0306('0x9a')]({'where':{'id':_0xa6254[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x23c8c0,null))['then'](function(_0xb7ec41){if(_0xb7ec41){_0xcfd74e=_0xb7ec41;_0xddb274[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0xe4')]['rawAttributes']);_0xddb274['query']=_[_0x0306('0x59')](_0xa6254[_0x0306('0x45')]);_0xddb274[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0xddb274[_0x0306('0x57')],_0xddb274[_0x0306('0x45')]);_0x363f16[_0x0306('0x49')]=_[_0x0306('0x5b')](_0xddb274[_0x0306('0x57')],qs[_0x0306('0x5c')](_0xa6254['query'][_0x0306('0x5c')]));_0x363f16[_0x0306('0x49')]=_0x363f16[_0x0306('0x49')][_0x0306('0x4e')]?_0x363f16[_0x0306('0x49')]:_0xddb274[_0x0306('0x57')];_0x363f16[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0xa6254['query']['sort']);_0x363f16[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0xa6254['query'],_0xddb274[_0x0306('0x5a')]));if(_0xa6254[_0x0306('0x45')][_0x0306('0x33')]){_0x363f16['where']=_['merge'](_0x363f16[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x363f16[_0x0306('0x49')],function(_0x437a6f){var _0x3a6f33={};_0x3a6f33[_0x437a6f]={'$like':'%'+_0xa6254[_0x0306('0x45')][_0x0306('0x33')]+'%'};return _0x3a6f33;})});}_0x363f16=_['merge']({},_0x363f16,_0xa6254[_0x0306('0x5f')]);return _0xcfd74e[_0x0306('0xe5')](_0x363f16);}})[_0x0306('0x2a')](function(_0x522dd4){if(_0x522dd4){_0x2bf9b3=_0x522dd4['length'];if(!_0xa6254[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xda'))){_0x363f16['limit']=qs['limit'](_0xa6254['query'][_0x0306('0x25')]);_0x363f16['offset']=qs[_0x0306('0x23')](_0xa6254['query'][_0x0306('0x23')]);}return _0xcfd74e['getChatInteractions'](_0x363f16);}})[_0x0306('0x2a')](function(_0x5cd051){if(_0x5cd051){return _0x5cd051?{'count':_0x2bf9b3,'rows':_0x5cd051}:null;}})[_0x0306('0x2a')](respondWithResult(_0x23c8c0,null))['catch'](handleError(_0x23c8c0,null));};exports[_0x0306('0xe6')]=function(_0x47f2e1,_0xd4a75){var _0x4a2057={};var _0x36e6e5={};var _0x55ae81;var _0x15cde9;return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x47f2e1[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0xd4a75,null))[_0x0306('0x2a')](function(_0x43668e){if(_0x43668e){_0x55ae81=_0x43668e;_0x36e6e5[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0xe7')][_0x0306('0x3c')]);_0x36e6e5[_0x0306('0x45')]=_[_0x0306('0x59')](_0x47f2e1[_0x0306('0x45')]);_0x36e6e5['filters']=_[_0x0306('0x5b')](_0x36e6e5[_0x0306('0x57')],_0x36e6e5[_0x0306('0x45')]);_0x4a2057[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x36e6e5[_0x0306('0x57')],qs['fields'](_0x47f2e1[_0x0306('0x45')][_0x0306('0x5c')]));_0x4a2057[_0x0306('0x49')]=_0x4a2057[_0x0306('0x49')][_0x0306('0x4e')]?_0x4a2057[_0x0306('0x49')]:_0x36e6e5[_0x0306('0x57')];_0x4a2057['order']=qs[_0x0306('0xd1')](_0x47f2e1[_0x0306('0x45')][_0x0306('0xd1')]);_0x4a2057[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x47f2e1[_0x0306('0x45')],_0x36e6e5[_0x0306('0x5a')]));if(_0x47f2e1[_0x0306('0x45')]['filter']){_0x4a2057[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x4a2057[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x4a2057[_0x0306('0x49')],function(_0x19bc8c){var _0x165b88={};_0x165b88[_0x19bc8c]={'$like':'%'+_0x47f2e1[_0x0306('0x45')]['filter']+'%'};return _0x165b88;})});}_0x4a2057=_[_0x0306('0x5e')]({},_0x4a2057,_0x47f2e1[_0x0306('0x5f')]);return _0x55ae81[_0x0306('0xe6')](_0x4a2057);}})['then'](function(_0x215e1c){if(_0x215e1c){_0x15cde9=_0x215e1c['length'];if(!_0x47f2e1[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xda'))){_0x4a2057[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x47f2e1[_0x0306('0x45')][_0x0306('0x25')]);_0x4a2057['offset']=qs[_0x0306('0x23')](_0x47f2e1[_0x0306('0x45')]['offset']);}return _0x55ae81[_0x0306('0xe6')](_0x4a2057);}})[_0x0306('0x2a')](function(_0x249c52){if(_0x249c52){return _0x249c52?{'count':_0x15cde9,'rows':_0x249c52}:null;}})[_0x0306('0x2a')](respondWithResult(_0xd4a75,null))[_0x0306('0x1f')](handleError(_0xd4a75,null));};exports[_0x0306('0xe8')]=function(_0x256ecd,_0x4eb87e){var _0x41db3e={'raw':!![],'where':{}};var _0x31d551={};var _0x3b4bd5={'count':0x0,'rows':[]};return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x256ecd[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x4eb87e,null))[_0x0306('0x2a')](function(_0x1fab28){if(_0x1fab28){_0x31d551[_0x0306('0x57')]=_['keys'](db[_0x0306('0xe9')][_0x0306('0x3c')]);_0x31d551['query']=_['keys'](_0x256ecd[_0x0306('0x45')]);_0x31d551[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x31d551[_0x0306('0x57')],_0x31d551['query']);_0x41db3e[_0x0306('0x49')]=_['intersection'](_0x31d551['model'],qs['fields'](_0x256ecd[_0x0306('0x45')][_0x0306('0x5c')]));_0x41db3e[_0x0306('0x49')]=_0x41db3e[_0x0306('0x49')]['length']?_0x41db3e[_0x0306('0x49')]:_0x31d551[_0x0306('0x57')];if(!_0x256ecd[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xda'))){_0x41db3e[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x256ecd[_0x0306('0x45')][_0x0306('0x25')]);_0x41db3e[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x256ecd[_0x0306('0x45')][_0x0306('0x23')]);}_0x41db3e[_0x0306('0xd0')]=qs['sort'](_0x256ecd[_0x0306('0x45')][_0x0306('0xd1')]);_0x41db3e[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x256ecd[_0x0306('0x45')],_0x31d551[_0x0306('0x5a')]));_0x41db3e['where'][_0x0306('0xe3')]=_0x1fab28['id'];if(_0x256ecd['query'][_0x0306('0x33')]){_0x41db3e[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x41db3e['where'],{'$or':_[_0x0306('0x34')](_0x41db3e['attributes'],function(_0x54afec){var _0x383ccf={};_0x383ccf[_0x54afec]={'$like':'%'+_0x256ecd['query']['filter']+'%'};return _0x383ccf;})});}_0x41db3e=_['merge']({},_0x41db3e,_0x256ecd[_0x0306('0x5f')]);return db['MailInteraction'][_0x0306('0x26')]({'where':_0x41db3e[_0x0306('0x44')]})['then'](function(_0xd738e3){_0x3b4bd5[_0x0306('0x26')]=_0xd738e3;if(_0x256ecd['query'][_0x0306('0xd4')]){_0x41db3e[_0x0306('0x46')]=[{'all':!![]}];}return db[_0x0306('0xe9')]['findAll'](_0x41db3e);})[_0x0306('0x2a')](function(_0x5a4621){_0x3b4bd5['rows']=_0x5a4621;return _0x3b4bd5;});}})[_0x0306('0x2a')](respondWithFilteredResult(_0x4eb87e,_0x41db3e))[_0x0306('0x1f')](handleError(_0x4eb87e,null));};exports[_0x0306('0xea')]=function(_0x5554a5,_0x2f5d81){var _0x197425={};var _0x544f35={};var _0x579823;var _0x4515a2;return db['User'][_0x0306('0x9a')]({'where':{'id':_0x5554a5[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x2f5d81,null))['then'](function(_0x56a23d){if(_0x56a23d){_0x579823=_0x56a23d;_0x544f35['model']=_[_0x0306('0x59')](db[_0x0306('0xeb')][_0x0306('0x3c')]);_0x544f35[_0x0306('0x45')]=_[_0x0306('0x59')](_0x5554a5['query']);_0x544f35[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x544f35[_0x0306('0x57')],_0x544f35['query']);_0x197425['attributes']=_[_0x0306('0x5b')](_0x544f35[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x5554a5[_0x0306('0x45')][_0x0306('0x5c')]));_0x197425[_0x0306('0x49')]=_0x197425[_0x0306('0x49')][_0x0306('0x4e')]?_0x197425[_0x0306('0x49')]:_0x544f35['model'];_0x197425[_0x0306('0xd0')]=qs['sort'](_0x5554a5[_0x0306('0x45')][_0x0306('0xd1')]);_0x197425[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x5554a5[_0x0306('0x45')],_0x544f35[_0x0306('0x5a')]));if(_0x5554a5[_0x0306('0x45')]['filter']){_0x197425[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x197425[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x197425[_0x0306('0x49')],function(_0x5b4e57){var _0x2fc8d9={};_0x2fc8d9[_0x5b4e57]={'$like':'%'+_0x5554a5['query'][_0x0306('0x33')]+'%'};return _0x2fc8d9;})});}_0x197425=_['merge']({},_0x197425,_0x5554a5[_0x0306('0x5f')]);return _0x579823['getSmsInteractions'](_0x197425);}})[_0x0306('0x2a')](function(_0x209cfb){if(_0x209cfb){_0x4515a2=_0x209cfb[_0x0306('0x4e')];if(!_0x5554a5[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xda'))){_0x197425[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x5554a5['query'][_0x0306('0x25')]);_0x197425[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x5554a5[_0x0306('0x45')][_0x0306('0x23')]);}return _0x579823[_0x0306('0xea')](_0x197425);}})[_0x0306('0x2a')](function(_0x59fedb){if(_0x59fedb){return _0x59fedb?{'count':_0x4515a2,'rows':_0x59fedb}:null;}})[_0x0306('0x2a')](respondWithResult(_0x2f5d81,null))['catch'](handleError(_0x2f5d81,null));};exports['getFaxInteractions']=function(_0x14d361,_0x2c70c6){var _0x28c6a4={};var _0x105091={};var _0x4ec440;var _0x325848;return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x14d361[_0x0306('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c70c6,null))[_0x0306('0x2a')](function(_0x39a560){if(_0x39a560){_0x4ec440=_0x39a560;_0x105091[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0xec')]['rawAttributes']);_0x105091[_0x0306('0x45')]=_[_0x0306('0x59')](_0x14d361[_0x0306('0x45')]);_0x105091[_0x0306('0x5a')]=_['intersection'](_0x105091[_0x0306('0x57')],_0x105091[_0x0306('0x45')]);_0x28c6a4[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x105091['model'],qs['fields'](_0x14d361[_0x0306('0x45')][_0x0306('0x5c')]));_0x28c6a4[_0x0306('0x49')]=_0x28c6a4[_0x0306('0x49')][_0x0306('0x4e')]?_0x28c6a4['attributes']:_0x105091[_0x0306('0x57')];_0x28c6a4['order']=qs['sort'](_0x14d361[_0x0306('0x45')][_0x0306('0xd1')]);_0x28c6a4[_0x0306('0x44')]=qs[_0x0306('0x5a')](_['pick'](_0x14d361[_0x0306('0x45')],_0x105091[_0x0306('0x5a')]));if(_0x14d361['query'][_0x0306('0x33')]){_0x28c6a4['where']=_[_0x0306('0x5e')](_0x28c6a4[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x28c6a4[_0x0306('0x49')],function(_0x29f84a){var _0x134217={};_0x134217[_0x29f84a]={'$like':'%'+_0x14d361[_0x0306('0x45')][_0x0306('0x33')]+'%'};return _0x134217;})});}_0x28c6a4=_[_0x0306('0x5e')]({},_0x28c6a4,_0x14d361['options']);return _0x4ec440[_0x0306('0xed')](_0x28c6a4);}})[_0x0306('0x2a')](function(_0x528a1c){if(_0x528a1c){_0x325848=_0x528a1c[_0x0306('0x4e')];if(!_0x14d361[_0x0306('0x45')]['hasOwnProperty'](_0x0306('0xda'))){_0x28c6a4[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x14d361[_0x0306('0x45')][_0x0306('0x25')]);_0x28c6a4[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x14d361[_0x0306('0x45')]['offset']);}return _0x4ec440[_0x0306('0xed')](_0x28c6a4);}})[_0x0306('0x2a')](function(_0x219c72){if(_0x219c72){return _0x219c72?{'count':_0x325848,'rows':_0x219c72}:null;}})[_0x0306('0x2a')](respondWithResult(_0x2c70c6,null))[_0x0306('0x1f')](handleError(_0x2c70c6,null));};exports[_0x0306('0xee')]=function(_0x1c90fc,_0x17cc71){var _0x464ab5={};var _0x5473fb={};var _0x45e84a;var _0x1e4e18;return db['User'][_0x0306('0x9a')]({'where':{'id':_0x1c90fc[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x17cc71,null))['then'](function(_0x547cb3){if(_0x547cb3){_0x45e84a=_0x547cb3;_0x5473fb['model']=_[_0x0306('0x59')](db['WhatsappInteraction']['rawAttributes']);_0x5473fb[_0x0306('0x45')]=_['keys'](_0x1c90fc['query']);_0x5473fb[_0x0306('0x5a')]=_['intersection'](_0x5473fb['model'],_0x5473fb[_0x0306('0x45')]);_0x464ab5[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x5473fb[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x1c90fc['query'][_0x0306('0x5c')]));_0x464ab5[_0x0306('0x49')]=_0x464ab5[_0x0306('0x49')][_0x0306('0x4e')]?_0x464ab5[_0x0306('0x49')]:_0x5473fb[_0x0306('0x57')];_0x464ab5[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x1c90fc[_0x0306('0x45')][_0x0306('0xd1')]);_0x464ab5['where']=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x1c90fc[_0x0306('0x45')],_0x5473fb[_0x0306('0x5a')]));if(_0x1c90fc['query'][_0x0306('0x33')]){_0x464ab5[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x464ab5[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x464ab5[_0x0306('0x49')],function(_0x5bc2d1){var _0x1a3d78={};_0x1a3d78[_0x5bc2d1]={'$like':'%'+_0x1c90fc[_0x0306('0x45')]['filter']+'%'};return _0x1a3d78;})});}_0x464ab5=_['merge']({},_0x464ab5,_0x1c90fc[_0x0306('0x5f')]);return _0x45e84a[_0x0306('0xee')](_0x464ab5);}})[_0x0306('0x2a')](function(_0x2b0130){if(_0x2b0130){_0x1e4e18=_0x2b0130[_0x0306('0x4e')];if(!_0x1c90fc[_0x0306('0x45')]['hasOwnProperty'](_0x0306('0xda'))){_0x464ab5[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x1c90fc[_0x0306('0x45')][_0x0306('0x25')]);_0x464ab5['offset']=qs[_0x0306('0x23')](_0x1c90fc['query'][_0x0306('0x23')]);}return _0x45e84a[_0x0306('0xee')](_0x464ab5);}})[_0x0306('0x2a')](function(_0x3dbe9b){if(_0x3dbe9b){return _0x3dbe9b?{'count':_0x1e4e18,'rows':_0x3dbe9b}:null;}})['then'](respondWithResult(_0x17cc71,null))[_0x0306('0x1f')](handleError(_0x17cc71,null));};exports[_0x0306('0xef')]=function(_0x286627,_0x207379,_0xada3f9){var _0x2e810a;var _0x424058;var _0x24a444;var _0x3e51b8=!_[_0x0306('0x6b')](_0x286627[_0x0306('0x56')]['id'])?_0x286627[_0x0306('0x56')]['id']:!_['isNil'](_0x286627[_0x0306('0x2e')]['id'])?_0x286627['user']['id']:null;return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0x3e51b8,'role':{'$or':[_0x0306('0x80'),_0x0306('0x2e'),_0x0306('0x30')]}},'attributes':['id',_0x0306('0x37'),'phone',_0x0306('0xf0'),_0x0306('0x2c'),'internal',_0x0306('0xf1')]})[_0x0306('0x2a')](function(_0x50e5c1){if(_0x50e5c1){if(_0x50e5c1[_0x0306('0x2c')]===_0x0306('0x30')){_0x2e810a=_0x50e5c1;if(_0x286627[_0x0306('0x61')][_0x0306('0xa4')]){_0x24a444=util['format']('LOCAL/%s@from-sip/n',_0x2e810a[_0x286627[_0x0306('0x61')][_0x0306('0xa4')]]);}else if(_0x286627['body'][_0x0306('0xf2')]){_0x24a444=util[_0x0306('0xb0')](_0x0306('0xb1'),_0x286627['body'][_0x0306('0xf2')]);}else{_0x24a444=util['format'](_0x0306('0xb1'),_0x2e810a[_0x0306('0x37')]);}socket['to'](util[_0x0306('0xb0')](_0x0306('0xf3'),_0x2e810a[_0x0306('0x37')]))[_0x0306('0xac')]('user:forcelogout',{'user':{'id':_0x2e810a['id'],'name':_0x2e810a['name']},'ip':_0x286627['headers'][_0x0306('0xf4')]||_0x286627['connection'][_0x0306('0xf5')]||_0x286627[_0x0306('0xf6')][_0x0306('0xf5')]||_0x286627['connection']['socket']['remoteAddress']});return db[_0x0306('0xb3')]['destroy']({'where':{'membername':_0x2e810a['name']},'individualHooks':!![]});}}else{throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))](_0x0306('0xf7'));}})[_0x0306('0x2a')](function(){if(_0x2e810a){return _0x2e810a[_0x0306('0xf8')]({'raw':!![]});}})['then'](function(_0x42f113){if(_0x2e810a){var _0x48301c=[];if(_0x42f113){_0x424058=_0x42f113;if(_0x424058[_0x0306('0x4e')]){for(var _0x398a9a=0x0;_0x398a9a<_0x424058[_0x0306('0x4e')];_0x398a9a++){_0x48301c[_0x0306('0x4a')]({'membername':_0x2e810a[_0x0306('0x37')],'UserId':_0x2e810a['id'],'queue_name':_0x424058[_0x398a9a]['name'],'VoiceQueueId':_0x424058[_0x398a9a]['id'],'interface':_0x24a444,'paused':_0x2e810a[_0x0306('0xf1')]||![],'penalty':_0x424058[_0x398a9a][_0x0306('0xf9')]||0x0});}return BPromise[_0x0306('0xb2')](_0x48301c,function(_0x554dcf){return db[_0x0306('0xb3')][_0x0306('0xfa')](_0x554dcf);});}}}})['then'](function(){if(_0x2e810a){return db['MemberReport'][_0x0306('0x4b')]({'where':{'membername':_0x2e810a['name'],'exitAt':null}});}})['then'](function(_0x477758){if(_0x2e810a){var _0x38448=[];_0x477758['forEach'](function(_0x302ca4){_0x38448['push'](_0x302ca4[_0x0306('0x29')]({'exitAt':moment()[_0x0306('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0306('0x8d')](_0x38448);}})['then'](function(){if(_0x2e810a){var _0x5edd87=[];var _0x145741=[];var _0x2cabcc=utils[_0x0306('0xfb')]();var _0x4700f6={'membername':_0x2e810a[_0x0306('0x37')],'interface':_0x24a444,'enterAt':moment()['format'](_0x0306('0xfc')),'role':_0x2e810a[_0x0306('0x2c')],'internal':_0x2e810a[_0x0306('0x66')]};_0x2cabcc['forEach'](function(_0x541383){_0x5edd87[_0x0306('0x4a')](_[_0x0306('0x5e')]({'channel':_0x541383,'type':_0x0306('0xfd'),'data1':_0x286627[_0x0306('0x61')][_0x0306('0xfe')],'data2':_0x24a444},_0x4700f6));if(_0x2e810a['loginInPause']){_0x145741['push'](_[_0x0306('0x5e')]({'channel':_0x541383,'type':_0x0306('0xff'),'data1':_0x0306('0x100')},_0x4700f6));}});return db['MemberReport'][_0x0306('0x89')](_0x5edd87['concat'](_0x145741),{'individualHooks':!![]});}})[_0x0306('0x2a')](function(){if(_0x2e810a){return _0x2e810a[_0x0306('0x29')]({'online':!![],'lastLoginAt':moment()[_0x0306('0xb0')](_0x0306('0xfc')),'voicePause':_0x2e810a[_0x0306('0xf1')]||![],'mailPause':_0x2e810a[_0x0306('0xf1')]||![],'chatPause':_0x2e810a[_0x0306('0xf1')]||![],'faxPause':_0x2e810a[_0x0306('0xf1')]||![],'smsPause':_0x2e810a[_0x0306('0xf1')]||![],'openchannelPause':_0x2e810a['loginInPause']||![],'whatsappPause':_0x2e810a[_0x0306('0xf1')]||![],'pauseType':_0x2e810a[_0x0306('0xf1')]?'LOGININPAUSE':null,'interface':_0x24a444,'lastPauseAt':moment()[_0x0306('0xb0')](_0x0306('0xfc'))});}})[_0x0306('0x2a')](function(_0x3b6956){if(_0x286627[_0x0306('0x101')]){return _0xada3f9();}else{return BPromise[_0x0306('0x102')](_0x3b6956)[_0x0306('0x2a')](respondWithResult(_0x207379,null));}})['catch'](handleError(_0x207379,null));};exports[_0x0306('0x103')]=function(_0x33c7e4,_0x4cf85b){var _0x1acc35;return db['User'][_0x0306('0x36')]({'where':{'id':_0x33c7e4[_0x0306('0x56')]['id'],'role':_0x0306('0x30')},'attributes':['id',_0x0306('0x37'),_0x0306('0x2c')]})['then'](handleEntityNotFound(_0x4cf85b,null))[_0x0306('0x2a')](function(_0x3e9c3c){if(_0x3e9c3c){_0x1acc35=_0x3e9c3c;return db[_0x0306('0xb3')][_0x0306('0x2b')]({'where':{'membername':_0x1acc35[_0x0306('0x37')]},'individualHooks':!![]});}})[_0x0306('0x2a')](function(){return db[_0x0306('0x104')][_0x0306('0x4b')]({'where':{'membername':_0x1acc35[_0x0306('0x37')],'exitAt':null}});})['then'](function(_0x3da06c){var _0x24c521=[];_0x3da06c[_0x0306('0x105')](function(_0x4a2a67){_0x24c521['push'](_0x4a2a67[_0x0306('0x29')]({'exitAt':moment()[_0x0306('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x24c521);})[_0x0306('0x2a')](function(){return _0x1acc35['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0306('0x2a')](respondWithResult(_0x4cf85b,null))[_0x0306('0x1f')](handleError(_0x4cf85b,null));};exports['pause']=function(_0x23a922,_0x2cb227){var _0x4bc1ba;return db[_0x0306('0xb3')][_0x0306('0x29')]({'paused':0x1},{'where':{'UserId':_0x23a922['params']['id']},'individualHooks':!![]})[_0x0306('0x2a')](function(){return db['User'][_0x0306('0x36')]({'where':{'id':_0x23a922[_0x0306('0x56')]['id'],'role':_0x0306('0x30')},'attributes':['id',_0x0306('0x37'),_0x0306('0x2c'),'internal',_0x0306('0xa4')]});})['then'](handleEntityNotFound(_0x2cb227,null))['then'](function(_0x3baab3){if(_0x3baab3){_0x4bc1ba=_0x3baab3;return respondWithRpcPromise('QueuePause',_0x0306('0x106'),{'id':_0x4bc1ba['id'],'name':_0x4bc1ba[_0x0306('0x37')],'pause':!![]});}})['then'](function(){if(_0x4bc1ba){return db[_0x0306('0x104')][_0x0306('0x4b')]({'where':{'membername':_0x4bc1ba['name'],'type':_0x0306('0xff'),'exitAt':null}});}})[_0x0306('0x2a')](function(_0x5cea77){if(_0x5cea77['length']){var _0x36633a=moment()[_0x0306('0xb0')](_0x0306('0xfc'));for(var _0x2353c5=0x0,_0x475106=_0x5cea77[_0x0306('0x4e')];_0x2353c5<_0x475106;_0x2353c5++){_0x5cea77[_0x2353c5][_0x0306('0x107')]({'exitAt':_0x36633a});}}})['then'](function(){var _0x43e7dc=[];var _0x37d804=utils['getChannels']();_0x37d804[_0x0306('0x105')](function(_0x23eadc){_0x43e7dc['push']({'channel':_0x23eadc,'membername':_0x4bc1ba[_0x0306('0x37')],'interface':_['isNil'](_0x4bc1ba['interface'])?util['format'](_0x0306('0xb1'),_0x4bc1ba[_0x0306('0x37')]):_0x4bc1ba[_0x0306('0xa4')],'type':_0x0306('0xff'),'enterAt':moment()[_0x0306('0xb0')](_0x0306('0xfc')),'data1':_0x23a922[_0x0306('0x61')][_0x0306('0x3e')]||_0x0306('0x108'),'role':_0x4bc1ba['role'],'internal':_0x4bc1ba[_0x0306('0x66')]});});return db['MemberReport']['bulkCreate'](_0x43e7dc,{'individualHooks':!![]});})['then'](function(){return _0x4bc1ba[_0x0306('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x23a922[_0x0306('0x61')][_0x0306('0x3e')]||_0x0306('0x108'),'lastPauseAt':moment()[_0x0306('0xb0')](_0x0306('0xfc'))});})[_0x0306('0x2a')](respondWithResult(_0x2cb227,null))[_0x0306('0x1f')](handleError(_0x2cb227,null));};exports['unpause']=function(_0xc1afed,_0x12a85e){var _0x46d323;return db[_0x0306('0x3b')][_0x0306('0x36')]({'where':{'id':_0xc1afed[_0x0306('0x56')]['id']},'attributes':['id',_0x0306('0x37'),_0x0306('0x2c'),_0x0306('0xa3'),_0x0306('0x109'),'chatPause',_0x0306('0x10a'),'openchannelPause','smsPause',_0x0306('0x10b'),_0x0306('0x10c'),'lastPauseAt']})[_0x0306('0x2a')](handleEntityNotFound(_0x12a85e,null))[_0x0306('0x2a')](function(_0x332ea9){if(_0x332ea9){_0x46d323=_0x332ea9;if(_0xc1afed[_0x0306('0x61')][_0x0306('0xb5')]&&!utils[_0x0306('0xa5')](_0xc1afed[_0x0306('0x61')][_0x0306('0xb5')])){throw new db[(_0x0306('0x94'))][(_0x0306('0x95'))]('Unknown\x20channel');}switch(_0xc1afed[_0x0306('0x61')][_0x0306('0xb5')]){case _0x0306('0xad'):return respondWithRpcPromise(_0x0306('0x10d'),_0x0306('0x10e'),{'id':_0x46d323['id'],'name':_0x46d323[_0x0306('0x37')],'pause':![]})[_0x0306('0x2a')](function(){return db['UserVoiceQueueRt'][_0x0306('0x29')]({'paused':0x0},{'where':{'UserId':_0x46d323['id']},'individualHooks':!![]});})['then'](function(){return db[_0x0306('0x104')][_0x0306('0x36')]({'where':{'channel':_0xc1afed['body']['channel'],'membername':_0x46d323['name'],'type':'PAUSE','exitAt':null}});})[_0x0306('0x2a')](function(_0x5ba483){if(_0x5ba483){return _0x5ba483['update']({'exitAt':moment()[_0x0306('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0306('0x10f')},{'individualHooks':!![]});}return null;})[_0x0306('0x2a')](function(){return _0x46d323[_0x0306('0x29')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0x0306('0x50'):case _0x0306('0x54'):case _0x0306('0x53'):return db[_0x0306('0x104')][_0x0306('0x36')]({'where':{'channel':_0xc1afed[_0x0306('0x61')]['channel'],'membername':_0x46d323[_0x0306('0x37')],'type':'PAUSE','exitAt':null}})[_0x0306('0x2a')](function(_0x2c0094){if(_0x2c0094){return _0x2c0094[_0x0306('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0306('0x10f')},{'individualHooks':!![]});}return null;})[_0x0306('0x2a')](function(){var _0x89e860={};_[_0x0306('0x27')](_0x89e860,util[_0x0306('0xb0')](_0x0306('0x110'),_0xc1afed[_0x0306('0x61')][_0x0306('0xb5')],_0x0306('0x111')),![]);return _0x46d323[_0x0306('0x29')](_0x89e860);});default:return respondWithRpcPromise(_0x0306('0x10d'),_0x0306('0x10e'),{'id':_0x46d323['id'],'name':_0x46d323['name'],'pause':![]})[_0x0306('0x2a')](function(){return db[_0x0306('0xb3')][_0x0306('0x29')]({'paused':0x0},{'where':{'UserId':_0x46d323['id']}});})[_0x0306('0x2a')](function(){return db[_0x0306('0x104')][_0x0306('0x4b')]({'where':{'membername':_0x46d323[_0x0306('0x37')],'type':_0x0306('0xff'),'exitAt':null}});})[_0x0306('0x2a')](function(_0xe464e3){var _0x372889=[];_0xe464e3[_0x0306('0x105')](function(_0x5d460d){_0x372889['push'](_0x5d460d[_0x0306('0x29')]({'exitAt':moment()[_0x0306('0xb0')](_0x0306('0xfc')),'data2':_0x0306('0x10f')}));});return BPromise[_0x0306('0x8d')](_0x372889);})['then'](function(){return _0x46d323[_0x0306('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0306('0x2a')](respondWithResult(_0x12a85e,null))[_0x0306('0x1f')](handleError(_0x12a85e,null));};exports[_0x0306('0x112')]=function(_0x271c38,_0x3407f1){var _0x3b6642={};var _0x2a58aa={};var _0xd7404d;var _0x1b5070;return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x271c38['params']['id']}})['then'](handleEntityNotFound(_0x3407f1,null))['then'](function(_0x3f9ac3){if(_0x3f9ac3){_0xd7404d=_0x3f9ac3;_0x2a58aa['model']=_[_0x0306('0x59')](db[_0x0306('0x113')][_0x0306('0x3c')]);_0x2a58aa[_0x0306('0x45')]=_['keys'](_0x271c38['query']);_0x2a58aa[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x2a58aa['model'],_0x2a58aa[_0x0306('0x45')]);_0x3b6642['attributes']=_[_0x0306('0x5b')](_0x2a58aa[_0x0306('0x57')],qs['fields'](_0x271c38[_0x0306('0x45')]['fields']));_0x3b6642[_0x0306('0x49')]=_0x3b6642[_0x0306('0x49')][_0x0306('0x4e')]?_0x3b6642[_0x0306('0x49')]:_0x2a58aa['model'];_0x3b6642[_0x0306('0xd0')]=qs['sort'](_0x271c38[_0x0306('0x45')]['sort']);_0x3b6642[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x271c38['query'],_0x2a58aa[_0x0306('0x5a')]));if(_0x271c38[_0x0306('0x45')][_0x0306('0x33')]){_0x3b6642[_0x0306('0x44')]=_['merge'](_0x3b6642[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x3b6642[_0x0306('0x49')],function(_0x45cd87){var _0x4de001={};_0x4de001[_0x45cd87]={'$like':'%'+_0x271c38[_0x0306('0x45')]['filter']+'%'};return _0x4de001;})});}_0x3b6642=_[_0x0306('0x5e')]({},_0x3b6642,_0x271c38['options']);return _0xd7404d[_0x0306('0x112')](_0x3b6642);}})[_0x0306('0x2a')](function(_0x2cafdd){if(_0x2cafdd){_0x1b5070=_0x2cafdd[_0x0306('0x4e')];if(!_0x271c38[_0x0306('0x45')][_0x0306('0xd3')](_0x0306('0xda'))){_0x3b6642[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x271c38[_0x0306('0x45')]['limit']);_0x3b6642['offset']=qs[_0x0306('0x23')](_0x271c38[_0x0306('0x45')]['offset']);}return _0xd7404d[_0x0306('0x112')](_0x3b6642);}})[_0x0306('0x2a')](function(_0x2eb9f6){if(_0x2eb9f6){return _0x2eb9f6?{'count':_0x1b5070,'rows':_0x2eb9f6}:null;}})[_0x0306('0x2a')](respondWithResult(_0x3407f1,null))[_0x0306('0x1f')](handleError(_0x3407f1,null));};exports[_0x0306('0x114')]=function(_0x1e9fe6,_0x3fc492){return db['User'][_0x0306('0x36')]({'where':{'id':_0x1e9fe6[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x3fc492,null))[_0x0306('0x2a')](function(_0x2c9e81){if(_0x2c9e81){var _0x57129b=_0x2c9e81['get']({'plain':!![]});return _0x2c9e81[_0x0306('0x114')](_0x1e9fe6[_0x0306('0x61')][_0x0306('0x64')],_['omit'](_0x1e9fe6['body'],[_0x0306('0x64'),'id'])||{})[_0x0306('0x2a')](function(){for(var _0x20ca6c=0x0;_0x20ca6c<_0x1e9fe6[_0x0306('0x61')][_0x0306('0x64')][_0x0306('0x4e')];_0x20ca6c++){var _0x1649d2=[];var _0x1306a7={};db[_0x0306('0x113')][_0x0306('0x9a')]({'where':{'id':_0x1e9fe6['body'][_0x0306('0x64')][_0x20ca6c]}})['then'](function(_0xddf211){_0x1306a7=_0xddf211['dataValues'];_0x1649d2['push'](_0xddf211['getVoiceQueues']()[_0x0306('0x2a')](function(_0x3c18b4){for(var _0x5f24c0=0x0;_0x5f24c0<_0x3c18b4[_0x0306('0x4e')];_0x5f24c0++){_0x3c18b4[_0x5f24c0][_0x0306('0x115')](_0x0306('0xb5'),_0x0306('0x116'));}return _0x3c18b4;}));_0x1649d2[_0x0306('0x4a')](_0xddf211[_0x0306('0x117')]()['then'](function(_0xa6cc0){for(var _0x6bc546=0x0;_0x6bc546<_0xa6cc0[_0x0306('0x4e')];_0x6bc546++){_0xa6cc0[_0x6bc546][_0x0306('0x115')](_0x0306('0xb5'),'Chat');}return _0xa6cc0;}));_0x1649d2[_0x0306('0x4a')](_0xddf211['getMailQueues']()[_0x0306('0x2a')](function(_0x146206){for(var _0x345edd=0x0;_0x345edd<_0x146206['length'];_0x345edd++){_0x146206[_0x345edd]['setDataValue']('channel','Mail');}return _0x146206;}));_0x1649d2[_0x0306('0x4a')](_0xddf211[_0x0306('0x118')]()['then'](function(_0x11f2e8){for(var _0xd41e2c=0x0;_0xd41e2c<_0x11f2e8[_0x0306('0x4e')];_0xd41e2c++){_0x11f2e8[_0xd41e2c][_0x0306('0x115')]('channel',_0x0306('0x119'));}return _0x11f2e8;}));_0x1649d2[_0x0306('0x4a')](_0xddf211[_0x0306('0x11a')]()['then'](function(_0x3b7296){for(var _0x311c86=0x0;_0x311c86<_0x3b7296['length'];_0x311c86++){_0x3b7296[_0x311c86]['setDataValue']('channel',_0x0306('0x11b'));}return _0x3b7296;}));_0x1649d2[_0x0306('0x4a')](_0xddf211[_0x0306('0x11c')]()[_0x0306('0x2a')](function(_0x13e03a){for(var _0x1420a9=0x0;_0x1420a9<_0x13e03a[_0x0306('0x4e')];_0x1420a9++){_0x13e03a[_0x1420a9][_0x0306('0x115')]('channel','Fax');}return _0x13e03a;}));_0x1649d2[_0x0306('0x4a')](_0xddf211[_0x0306('0x11d')]()[_0x0306('0x2a')](function(_0xdd63b3){for(var _0x3eb472=0x0;_0x3eb472<_0xdd63b3[_0x0306('0x4e')];_0x3eb472++){_0xdd63b3[_0x3eb472][_0x0306('0x115')](_0x0306('0xb5'),_0x0306('0x11e'));}return _0xdd63b3;}));return BPromise[_0x0306('0x8d')](_0x1649d2);})[_0x0306('0x2a')](function(_0x45f562){var _0x51a60c=_[_0x0306('0x11f')](_0x45f562);_0x1649d2=[];return db[_0x0306('0x6c')]['transaction'](function(_0x581352){for(var _0x315a9a=0x0;_0x315a9a<_0x51a60c[_0x0306('0x4e')];_0x315a9a++){_0x1649d2[_0x0306('0x4a')](_0x51a60c[_0x315a9a][_0x0306('0x120')](_0x57129b['id']),{'transaction':_0x581352});}return BPromise[_0x0306('0x8d')](_0x1649d2)['then'](function(){if(_0x57129b[_0x0306('0xa2')]){return BPromise[_0x0306('0xb2')](_[_0x0306('0x33')](_0x51a60c,function(_0x4770d6){return _0x4770d6[_0x0306('0x121')](_0x0306('0xb5'))===_0x0306('0x116');}),function(_0x2b4ca3){return db[_0x0306('0xb3')][_0x0306('0xfa')]({'membername':_0x57129b[_0x0306('0x37')],'UserId':_0x57129b['id'],'queue_name':_0x2b4ca3[_0x0306('0x37')],'VoiceQueueId':_0x2b4ca3['id'],'interface':_['isNil'](_0x57129b[_0x0306('0xa4')])?util[_0x0306('0xb0')]('SIP/%s',_0x57129b[_0x0306('0x37')]):_0x57129b[_0x0306('0xa4')],'paused':_0x57129b[_0x0306('0xa3')]||![],'penalty':_0x57129b[_0x0306('0xa8')]},{'transaction':_0x581352});});}else{return;}})['then'](function(){for(var _0xad205=0x0;_0xad205<_0x51a60c[_0x0306('0x4e')];_0xad205++){var _0x161cb4=_0x51a60c[_0xad205][_0x0306('0x121')]('channel');var _0x2470be=_0x161cb4+'QueueId';socket[_0x0306('0xac')](_0x0306('0x2e')+_0x161cb4+'Queue:save',{'UserId':_0x57129b['id'],['queueField']:_0x51a60c[_0xad205]['id']});}});});})[_0x0306('0x2a')](function(){db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1306a7['id']}})[_0x0306('0x2a')](function(_0x4fbc9b){if(_0x4fbc9b){db[_0x0306('0x122')][_0x0306('0x84')]({'UserId':_0x1e9fe6[_0x0306('0x56')]['id'],'VoicePrefixId':_0x4fbc9b['VoicePrefixId']});}});});}});}})[_0x0306('0x2a')](respondWithStatusCode(_0x3fc492,null))[_0x0306('0x1f')](handleError(_0x3fc492,null));};exports[_0x0306('0x123')]=function(_0x2e4c8e,_0x440adb){return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x2e4c8e[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x440adb,null))['then'](function(_0x4e8d3d){if(_0x4e8d3d){var _0x46f54f=_0x4e8d3d[_0x0306('0xaf')]({'plain':!![]});var _0x36cd2a=_0x2e4c8e[_0x0306('0x45')]['ids'];return _0x4e8d3d[_0x0306('0x123')](_0x36cd2a)[_0x0306('0x2a')](function(){for(var _0x528e02=0x0;_0x528e02<_0x36cd2a[_0x0306('0x4e')];_0x528e02++){var _0x68f603=[];var _0x58c06e={};db[_0x0306('0x113')][_0x0306('0x9a')]({'where':{'id':_0x36cd2a[_0x528e02]}})[_0x0306('0x2a')](function(_0x5ebec1){_0x58c06e=_0x5ebec1[_0x0306('0x51')];_0x68f603['push'](_0x5ebec1[_0x0306('0xf8')]()['then'](function(_0x119583){for(var _0x57295b=0x0;_0x57295b<_0x119583[_0x0306('0x4e')];_0x57295b++){_0x119583[_0x57295b][_0x0306('0x115')]('channel',_0x0306('0x116'));}return _0x119583;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1[_0x0306('0x117')]()[_0x0306('0x2a')](function(_0x5c9e79){for(var _0xd74729=0x0;_0xd74729<_0x5c9e79[_0x0306('0x4e')];_0xd74729++){_0x5c9e79[_0xd74729][_0x0306('0x115')]('channel','Chat');}return _0x5c9e79;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1['getMailQueues']()[_0x0306('0x2a')](function(_0x36ffae){for(var _0xc377ff=0x0;_0xc377ff<_0x36ffae[_0x0306('0x4e')];_0xc377ff++){_0x36ffae[_0xc377ff][_0x0306('0x115')]('channel',_0x0306('0x124'));}return _0x36ffae;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1[_0x0306('0x118')]()[_0x0306('0x2a')](function(_0x23d82e){for(var _0x11628c=0x0;_0x11628c<_0x23d82e[_0x0306('0x4e')];_0x11628c++){_0x23d82e[_0x11628c][_0x0306('0x115')](_0x0306('0xb5'),_0x0306('0x119'));}return _0x23d82e;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1[_0x0306('0x11a')]()['then'](function(_0x5ef781){for(var _0x88fdb9=0x0;_0x88fdb9<_0x5ef781[_0x0306('0x4e')];_0x88fdb9++){_0x5ef781[_0x88fdb9][_0x0306('0x115')](_0x0306('0xb5'),_0x0306('0x11b'));}return _0x5ef781;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1[_0x0306('0x11c')]()['then'](function(_0x5de37c){for(var _0x8af651=0x0;_0x8af651<_0x5de37c[_0x0306('0x4e')];_0x8af651++){_0x5de37c[_0x8af651][_0x0306('0x115')]('channel',_0x0306('0x125'));}return _0x5de37c;}));_0x68f603[_0x0306('0x4a')](_0x5ebec1[_0x0306('0x11d')]()[_0x0306('0x2a')](function(_0x51b13b){for(var _0x4fc8c9=0x0;_0x4fc8c9<_0x51b13b[_0x0306('0x4e')];_0x4fc8c9++){_0x51b13b[_0x4fc8c9]['setDataValue'](_0x0306('0xb5'),_0x0306('0x11e'));}return _0x51b13b;}));return BPromise[_0x0306('0x8d')](_0x68f603);})[_0x0306('0x2a')](function(_0x34a94a){var _0x54108e=_[_0x0306('0x11f')](_0x34a94a);_0x68f603=[];return db[_0x0306('0x6c')]['transaction'](function(_0x21b529){for(var _0x53339b=0x0;_0x53339b<_0x54108e[_0x0306('0x4e')];_0x53339b++){_0x68f603[_0x0306('0x4a')](_0x54108e[_0x53339b][_0x0306('0x126')](_0x46f54f['id']),{'transaction':_0x21b529});}return BPromise[_0x0306('0x8d')](_0x68f603)[_0x0306('0x2a')](function(){if(_0x46f54f['online']){return BPromise[_0x0306('0xb2')](_[_0x0306('0x33')](_0x54108e,function(_0x2857de){return _0x2857de['getDataValue'](_0x0306('0xb5'))==='Voice';}),function(_0x2b7379){return db['UserVoiceQueueRt'][_0x0306('0x2b')]({'where':{'VoiceQueueId':_0x2b7379['id'],'UserId':_0x46f54f['id']},'transaction':_0x21b529});});}else{return;}})[_0x0306('0x2a')](function(){db[_0x0306('0x127')]['findOne']({'where':{'teamId':_0x58c06e['id']}})[_0x0306('0x2a')](function(_0xbef176){if(_0xbef176){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x46f54f['id'],'VoicePrefixId':_0xbef176[_0x0306('0x51')][_0x0306('0x128')]}});}});})[_0x0306('0x2a')](function(){for(var _0x37d54e=0x0;_0x37d54e<_0x54108e[_0x0306('0x4e')];_0x37d54e++){var _0x4d0fc0=_0x54108e[_0x37d54e][_0x0306('0x121')](_0x0306('0xb5'));var _0x1173c7=_0x4d0fc0+_0x0306('0xab');socket['emit'](_0x0306('0x2e')+_0x4d0fc0+_0x0306('0xb7'),{'UserId':_0x46f54f['id'],['queueField']:_0x54108e[_0x37d54e]['id']});}});});});}});}})[_0x0306('0x2a')](respondWithStatusCode(_0x440adb,null))[_0x0306('0x1f')](handleError(_0x440adb,null));};exports['getLists']=function(_0x5bf6ad,_0x445bb5){var _0x2abfa3={};var _0x4c6a8b={};var _0x290c78;var _0xb7497c;return db[_0x0306('0x3b')]['findOne']({'where':{'id':_0x5bf6ad[_0x0306('0x56')]['id']}})[_0x0306('0x2a')](handleEntityNotFound(_0x445bb5,null))['then'](function(_0x3f9966){if(_0x3f9966){_0x290c78=_0x3f9966;_0x4c6a8b[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0x129')]['rawAttributes']);_0x4c6a8b[_0x0306('0x45')]=_[_0x0306('0x59')](_0x5bf6ad[_0x0306('0x45')]);_0x4c6a8b[_0x0306('0x5a')]=_['intersection'](_0x4c6a8b[_0x0306('0x57')],_0x4c6a8b[_0x0306('0x45')]);_0x2abfa3[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x4c6a8b[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x5bf6ad['query'][_0x0306('0x5c')]));_0x2abfa3[_0x0306('0x49')]=_0x2abfa3[_0x0306('0x49')][_0x0306('0x4e')]?_0x2abfa3[_0x0306('0x49')]:_0x4c6a8b['model'];_0x2abfa3['order']=qs[_0x0306('0xd1')](_0x5bf6ad[_0x0306('0x45')][_0x0306('0xd1')]);_0x2abfa3['where']=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x5bf6ad[_0x0306('0x45')],_0x4c6a8b[_0x0306('0x5a')]));if(_0x5bf6ad[_0x0306('0x45')][_0x0306('0x33')]){_0x2abfa3['where']=_[_0x0306('0x5e')](_0x2abfa3[_0x0306('0x44')],{'$or':_[_0x0306('0x34')](_0x2abfa3[_0x0306('0x49')],function(_0x38ee6a){var _0x33ea76={};_0x33ea76[_0x38ee6a]={'$like':'%'+_0x5bf6ad['query'][_0x0306('0x33')]+'%'};return _0x33ea76;})});}_0x2abfa3=_[_0x0306('0x5e')]({},_0x2abfa3,_0x5bf6ad[_0x0306('0x5f')]);return _0x290c78['getLists'](_0x2abfa3);}})['then'](function(_0x546623){if(_0x546623){_0xb7497c=_0x546623[_0x0306('0x4e')];if(!_0x5bf6ad[_0x0306('0x45')]['hasOwnProperty']('nolimit')){_0x2abfa3[_0x0306('0x25')]=qs[_0x0306('0x25')](_0x5bf6ad['query'][_0x0306('0x25')]);_0x2abfa3[_0x0306('0x23')]=qs[_0x0306('0x23')](_0x5bf6ad[_0x0306('0x45')][_0x0306('0x23')]);}return _0x290c78[_0x0306('0x12a')](_0x2abfa3);}})[_0x0306('0x2a')](function(_0x5b5bd9){if(_0x5b5bd9){return _0x5b5bd9?{'count':_0xb7497c,'rows':_0x5b5bd9}:null;}})[_0x0306('0x2a')](respondWithResult(_0x445bb5,null))[_0x0306('0x1f')](handleError(_0x445bb5,null));};exports[_0x0306('0x12b')]=function(_0x33309c,_0x28ebcd){var _0x3c7a6e={};var _0x56cdb2={};var _0x388490;return db[_0x0306('0x3b')][_0x0306('0x9a')]({'where':{'id':_0x33309c['params']['id']}})['then'](handleEntityNotFound(_0x28ebcd,null))[_0x0306('0x2a')](function(_0xf83f09){if(_0xf83f09){_0x388490=_0xf83f09;_0x56cdb2[_0x0306('0x57')]=_[_0x0306('0x59')](db[_0x0306('0x3b')]['rawAttributes']);_0x56cdb2[_0x0306('0x45')]=_[_0x0306('0x59')](_0x33309c['query']);_0x56cdb2[_0x0306('0x5a')]=_[_0x0306('0x5b')](_0x56cdb2[_0x0306('0x57')],_0x56cdb2[_0x0306('0x45')]);_0x3c7a6e[_0x0306('0x49')]=_[_0x0306('0x5b')](_0x56cdb2[_0x0306('0x57')],qs[_0x0306('0x5c')](_0x33309c[_0x0306('0x45')][_0x0306('0x5c')]));_0x3c7a6e[_0x0306('0x49')]=_0x3c7a6e[_0x0306('0x49')][_0x0306('0x4e')]?_0x3c7a6e[_0x0306('0x49')]:_0x56cdb2[_0x0306('0x57')];_0x3c7a6e[_0x0306('0xd0')]=qs[_0x0306('0xd1')](_0x33309c[_0x0306('0x45')][_0x0306('0xd1')]);_0x3c7a6e[_0x0306('0x44')]=qs[_0x0306('0x5a')](_[_0x0306('0xd2')](_0x33309c[_0x0306('0x45')],_0x56cdb2[_0x0306('0x5a')]));if(_0x33309c['query'][_0x0306('0x33')]){_0x3c7a6e[_0x0306('0x44')]=_[_0x0306('0x5e')](_0x3c7a6e['where'],{'$or':_['map'](_0x3c7a6e[_0x0306('0x49')],function(_0x57da39){var _0x5a13e2={};_0x5a13e2[_0x57da39]={'$like':'%'+_0x33309c['query'][_0x0306('0x33')]+'%'};return _0x5a13e2;})});}_0x3c7a6e[_0x0306('0x57')]=db[_0x0306('0x3b')];_0x3c7a6e['as']=_0x0306('0x2f');_0x3c7a6e=_[_0x0306('0x5e')]({},_0x3c7a6e,_0x33309c['options']);return _0x388490[_0x0306('0xf8')]({'include':[_0x3c7a6e]});}})[_0x0306('0x2a')](function(_0xca0172){if(_0xca0172){var _0xdd9ae={},_0x488320=[];for(var _0x3169b3=0x0;_0x3169b3<_0xca0172['length'];_0x3169b3+=0x1){for(var _0x4e0b28=0x0,_0x21e9b2;_0x4e0b28<_0xca0172[_0x3169b3][_0x0306('0x2f')][_0x0306('0x4e')];_0x4e0b28+=0x1){_0x21e9b2=_0xca0172[_0x3169b3][_0x0306('0x2f')][_0x4e0b28][_0x0306('0xaf')]({'plain':!![]});_0xdd9ae[_0x21e9b2['id']]=_0x21e9b2;}}_0xdd9ae=_[_0x0306('0x12c')](_0xdd9ae);for(var _0x3fff75=qs[_0x0306('0x23')](_0x33309c[_0x0306('0x45')][_0x0306('0x23')]);_0x3fff75<_0xdd9ae[_0x0306('0x4e')]&&_0x488320[_0x0306('0x4e')]=_0x4b028e[_0xfd7a('0x52')]){throw new Error(_0xfd7a('0x53'));}})['then'](function(){if(_0x439368){return db[_0xfd7a('0x40')][_0xfd7a('0x54')]({'where':{'membername':_0x439368[_0xfd7a('0x29')]},'individualHooks':!![]});}})[_0xfd7a('0xf')](function(){if(_0x439368){return _0x439368['getVoiceQueues']({'raw':!![]});}})[_0xfd7a('0xf')](function(_0x35a9dc){if(_0x439368){if(_0x35a9dc){var _0x1b94fb=[];_0x436e34=_0x35a9dc;if(_0x436e34[_0xfd7a('0x30')]){for(var _0x411471=0x0;_0x411471<_0x436e34[_0xfd7a('0x30')];_0x411471++){_0x1b94fb[_0xfd7a('0x35')](db[_0xfd7a('0x40')][_0xfd7a('0x55')]({'membername':_0x439368[_0xfd7a('0x29')],'UserId':_0x439368['id'],'queue_name':_0x436e34[_0x411471][_0xfd7a('0x29')],'VoiceQueueId':_0x436e34[_0x411471]['id'],'interface':_0x570cf0,'paused':_0x439368['loginInPause']||![],'penalty':_0x436e34[_0x411471]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xfd7a('0x4a')](_0x1b94fb);}}}})['then'](function(){if(_0x439368){return db[_0xfd7a('0x2e')][_0xfd7a('0x1a')]({'where':{'membername':_0x439368[_0xfd7a('0x29')],'exitAt':null}});}})[_0xfd7a('0xf')](function(_0x34998c){if(_0x439368){if(_0x34998c&&_0x34998c[_0xfd7a('0x30')]){var _0x48f582=[];_0x34998c[_0xfd7a('0x49')](function(_0x27fefd){_0x48f582['push'](_0x27fefd['update']({'exitAt':moment()[_0xfd7a('0x31')](_0xfd7a('0x32'))}));});return BPromise[_0xfd7a('0x4a')](_0x48f582);}}})['then'](function(_0x57558d){if(_0x439368){var _0x2b5902=[];var _0x5cec17=[];var _0x199b42=utils[_0xfd7a('0x34')]();var _0x184fa5={'membername':_0x439368[_0xfd7a('0x29')],'interface':_0x570cf0,'enterAt':moment()['format'](_0xfd7a('0x32')),'role':_0x439368[_0xfd7a('0x2a')],'internal':_0x439368[_0xfd7a('0x2b')]};_0x199b42[_0xfd7a('0x49')](function(_0x160b2d){_0x2b5902[_0xfd7a('0x35')](_[_0xfd7a('0x56')]({'channel':_0x160b2d,'type':'LOGIN','data1':_0xfd7a('0x57'),'data2':_0x570cf0},_0x184fa5));if(_0x439368[_0xfd7a('0x4e')]){_0x5cec17[_0xfd7a('0x35')](_[_0xfd7a('0x56')]({'channel':_0x160b2d,'type':_0xfd7a('0x2f'),'data1':_0xfd7a('0x58')},_0x184fa5));}});return db[_0xfd7a('0x2e')]['bulkCreate'](_0x2b5902[_0xfd7a('0x59')](_0x5cec17),{'individualHooks':!![]});}})[_0xfd7a('0xf')](function(){if(_0x439368){return _0x439368[_0xfd7a('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xfd7a('0x31')](_0xfd7a('0x32')),'voicePause':_0x439368[_0xfd7a('0x4e')]||![],'mailPause':_0x439368[_0xfd7a('0x4e')]||![],'chatPause':_0x439368[_0xfd7a('0x4e')]||![],'faxPause':_0x439368[_0xfd7a('0x4e')]||![],'smsPause':_0x439368['loginInPause']||![],'openchannelPause':_0x439368[_0xfd7a('0x4e')]||![],'pauseType':_0x439368[_0xfd7a('0x4e')]?_0xfd7a('0x58'):null,'lastPauseAt':moment()[_0xfd7a('0x31')](_0xfd7a('0x32')),'interface':_0x570cf0});}})[_0xfd7a('0xf')](function(_0x252d15){_0x4dbc08(_0x252d15);})[_0xfd7a('0x24')](function(_0x56788a){_0x2ab0c8(_0x2c46de[_0xfd7a('0x15')](0x1f4,_0x56788a['message']));});});}; \ No newline at end of file +var _0x7841=['request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','attributes','include','model','map','ShowUser','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','SIP/%s','type','DEFAULT\x20PAUSE','body','MemberReport','bulkCreate','update','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','sms','openchannel','whatsapp','set','%s%s','Pause','forEach','all','destroy','LoginUser','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x7841,0x150));var _0x1784=function(_0x25e2a5,_0x2d7270){_0x25e2a5=_0x25e2a5-0x0;var _0x429243=_0x7841[_0x25e2a5];return _0x429243;};'use strict';var _=require(_0x1784('0x0'));var util=require('util');var moment=require(_0x1784('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1784('0x2'));var db=require(_0x1784('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1784('0x4'));var config=require(_0x1784('0x5'));var jayson=require(_0x1784('0x6'));var client=jayson[_0x1784('0x7')]['http']({'port':0x232a});config[_0x1784('0x8')]=_['defaults'](config['redis'],{'host':_0x1784('0x9'),'port':0x18eb});var socket=require(_0x1784('0xa'))(new Redis(config[_0x1784('0x8')]));require(_0x1784('0xb'))[_0x1784('0xc')](socket);function respondWithRpcPromise(_0x54079a,_0x494a35,_0x3752be){return new BPromise(function(_0x2870a8,_0x405c5a){return client['request'](_0x54079a,_0x3752be)[_0x1784('0xd')](function(_0x49aabd){logger[_0x1784('0xe')](_0x1784('0xf'),_0x494a35,_0x1784('0x10'));logger[_0x1784('0x11')](_0x1784('0x12'),_0x494a35,_0x1784('0x10'),JSON[_0x1784('0x13')](_0x49aabd));if(_0x49aabd[_0x1784('0x14')]){if(_0x49aabd[_0x1784('0x14')][_0x1784('0x15')]===0x1f4){logger[_0x1784('0x14')]('User,\x20%s,\x20%s',_0x494a35,_0x49aabd[_0x1784('0x14')]['message']);return _0x405c5a(_0x49aabd[_0x1784('0x14')][_0x1784('0x16')]);}logger[_0x1784('0x14')](_0x1784('0xf'),_0x494a35,_0x49aabd['error'][_0x1784('0x16')]);return _0x2870a8(_0x49aabd[_0x1784('0x14')][_0x1784('0x16')]);}else{logger['info'](_0x1784('0xf'),_0x494a35,_0x1784('0x10'));_0x2870a8(_0x49aabd[_0x1784('0x17')][_0x1784('0x16')]);}})[_0x1784('0x18')](function(_0x51603f){logger['error'](_0x1784('0xf'),_0x494a35,_0x51603f);_0x405c5a(_0x51603f);});});}exports[_0x1784('0x19')]=function(_0x374a24){var _0xbb312c=this;return new Promise(function(_0x4393d0,_0x125e83){return db[_0x1784('0x1a')][_0x1784('0x1b')]({'raw':_0x374a24[_0x1784('0x1c')]?_0x374a24[_0x1784('0x1c')][_0x1784('0x1d')]===undefined?!![]:![]:!![],'where':_0x374a24['options']?_0x374a24['options']['where']||null:null,'attributes':_0x374a24['options']?_0x374a24['options'][_0x1784('0x1e')]||null:null,'limit':_0x374a24[_0x1784('0x1c')]?_0x374a24[_0x1784('0x1c')]['limit']||null:null,'include':_0x374a24['options']?_0x374a24['options'][_0x1784('0x1f')]?_['map'](_0x374a24[_0x1784('0x1c')][_0x1784('0x1f')],function(_0xaaab0){return{'model':db[_0xaaab0[_0x1784('0x20')]],'as':_0xaaab0['as'],'attributes':_0xaaab0[_0x1784('0x1e')],'include':_0xaaab0[_0x1784('0x1f')]?_[_0x1784('0x21')](_0xaaab0[_0x1784('0x1f')],function(_0x2708c3){return{'model':db[_0x2708c3['model']],'as':_0x2708c3['as'],'attributes':_0x2708c3[_0x1784('0x1e')],'include':_0x2708c3[_0x1784('0x1f')]?_['map'](_0x2708c3['include'],function(_0x7fed12){return{'model':db[_0x7fed12[_0x1784('0x20')]],'as':_0x7fed12['as'],'attributes':_0x7fed12['attributes']};}):[]};}):[]};}):[]:[]})[_0x1784('0xd')](function(_0x24c2f1){logger[_0x1784('0xe')](_0x1784('0x19'),_0x374a24);logger[_0x1784('0x11')]('GetUser',_0x374a24,JSON[_0x1784('0x13')](_0x24c2f1));_0x4393d0(_0x24c2f1);})[_0x1784('0x18')](function(_0x28de97){logger[_0x1784('0x14')](_0x1784('0x19'),_0x28de97[_0x1784('0x16')],_0x374a24);_0x125e83(_0xbb312c['error'](0x1f4,_0x28de97[_0x1784('0x16')]));});});};exports[_0x1784('0x22')]=function(_0x3cf3fc){var _0x14c728=this;return new Promise(function(_0x1e7397,_0x3d0088){return db[_0x1784('0x1a')][_0x1784('0x23')]({'raw':_0x3cf3fc[_0x1784('0x1c')]?_0x3cf3fc['options'][_0x1784('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cf3fc[_0x1784('0x1c')]?_0x3cf3fc[_0x1784('0x1c')][_0x1784('0x24')]||null:null,'attributes':_0x3cf3fc[_0x1784('0x1c')]?_0x3cf3fc[_0x1784('0x1c')][_0x1784('0x1e')]||null:null,'include':_0x3cf3fc[_0x1784('0x1c')]?_0x3cf3fc[_0x1784('0x1c')][_0x1784('0x1f')]?_[_0x1784('0x21')](_0x3cf3fc[_0x1784('0x1c')]['include'],function(_0x31365a){return{'model':db[_0x31365a[_0x1784('0x20')]],'as':_0x31365a['as'],'attributes':_0x31365a[_0x1784('0x1e')],'include':_0x31365a[_0x1784('0x1f')]?_[_0x1784('0x21')](_0x31365a[_0x1784('0x1f')],function(_0x146111){return{'model':db[_0x146111[_0x1784('0x20')]],'as':_0x146111['as'],'attributes':_0x146111[_0x1784('0x1e')],'include':_0x146111[_0x1784('0x1f')]?_[_0x1784('0x21')](_0x146111['include'],function(_0x2ab85e){return{'model':db[_0x2ab85e[_0x1784('0x20')]],'as':_0x2ab85e['as'],'attributes':_0x2ab85e[_0x1784('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1784('0xd')](function(_0x254e06){logger[_0x1784('0xe')](_0x1784('0x22'),_0x3cf3fc);logger['debug'](_0x1784('0x22'),_0x3cf3fc,JSON['stringify'](_0x254e06));_0x1e7397(_0x254e06);})['catch'](function(_0x18f465){logger[_0x1784('0x14')]('ShowUser',_0x18f465[_0x1784('0x16')],_0x3cf3fc);_0x3d0088(_0x14c728[_0x1784('0x14')](0x1f4,_0x18f465[_0x1784('0x16')]));});});};exports[_0x1784('0x25')]=function(_0x2beaf9){var _0x1a04ed=this;return new Promise(function(_0x41d457,_0x3ab15b){var _0x58c47c;return db['User'][_0x1784('0x23')]({'where':_0x2beaf9['options']['where']||{},'attributes':['id',_0x1784('0x26'),_0x1784('0x27'),_0x1784('0x28'),_0x1784('0x29')]})[_0x1784('0xd')](function(_0x32ecd3){if(_0x32ecd3){_0x58c47c=_0x32ecd3;return db[_0x1784('0x2a')]['update']({'paused':0x1},{'where':{'UserId':_0x58c47c['id']},'individualHooks':!![]});}})[_0x1784('0xd')](function(){if(_0x58c47c){return db['MemberReport']['findAll']({'where':{'membername':_0x58c47c[_0x1784('0x26')],'type':_0x1784('0x2b'),'exitAt':null}});}})[_0x1784('0xd')](function(_0x510665){if(_0x58c47c){if(_0x510665&&_0x510665[_0x1784('0x2c')]){var _0x14db1e=moment()[_0x1784('0x2d')](_0x1784('0x2e'));for(var _0x5db4c6=0x0,_0x206fe4=_0x510665[_0x1784('0x2c')];_0x5db4c6<_0x206fe4;_0x5db4c6++){_0x510665[_0x5db4c6][_0x1784('0x2f')]({'exitAt':_0x14db1e});}}}})[_0x1784('0xd')](function(){if(_0x58c47c){var _0x1eb3d1=[];var _0x3de00e=utils[_0x1784('0x30')]();_0x3de00e['forEach'](function(_0x5a98a1){_0x1eb3d1[_0x1784('0x31')]({'channel':_0x5a98a1,'membername':_0x58c47c['name'],'interface':_['isNil'](_0x58c47c[_0x1784('0x29')])?util[_0x1784('0x2d')](_0x1784('0x32'),_0x58c47c['name']):_0x58c47c[_0x1784('0x29')],'type':_0x1784('0x2b'),'enterAt':moment()[_0x1784('0x2d')](_0x1784('0x2e')),'data1':_0x2beaf9['body'][_0x1784('0x33')]||_0x1784('0x34'),'role':_0x58c47c[_0x1784('0x27')],'internal':_0x58c47c[_0x1784('0x28')],'uniqueid':_0x2beaf9[_0x1784('0x35')]['uniqueid']||null});});return db[_0x1784('0x36')][_0x1784('0x37')](_0x1eb3d1,{'individualHooks':!![]});}})['then'](function(){if(_0x58c47c){return _0x58c47c[_0x1784('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2beaf9[_0x1784('0x35')]['type']||_0x1784('0x34'),'lastPauseAt':moment()[_0x1784('0x2d')](_0x1784('0x2e'))});}})[_0x1784('0xd')](function(_0x41f94a){_0x41d457(_0x41f94a);})[_0x1784('0x18')](function(_0x24fc37){_0x3ab15b(_0x1a04ed[_0x1784('0x14')](0x1f4,_0x24fc37[_0x1784('0x16')]));});});};exports['UnpauseUser']=function(_0x3aec2f){var _0x5f2fb7=this;return new Promise(function(_0x43e5df,_0x42857d){var _0x400131;return db['User'][_0x1784('0x39')]({'where':_0x3aec2f[_0x1784('0x1c')][_0x1784('0x24')]||{},'attributes':['id',_0x1784('0x26')]})[_0x1784('0xd')](function(_0x49b9eb){if(_0x49b9eb){_0x400131=_0x49b9eb;if(_0x3aec2f['body'][_0x1784('0x3a')]&&!utils[_0x1784('0x3b')](_0x3aec2f[_0x1784('0x35')][_0x1784('0x3a')])){throw new Error(_0x1784('0x3c'));}switch(_0x3aec2f['body'][_0x1784('0x3a')]){case _0x1784('0x3d'):return db[_0x1784('0x2a')][_0x1784('0x38')]({'paused':0x0},{'where':{'UserId':_0x400131['id']}})[_0x1784('0xd')](function(){return db[_0x1784('0x36')][_0x1784('0x23')]({'where':{'channel':_0x3aec2f['body'][_0x1784('0x3a')],'membername':_0x400131['name'],'type':_0x1784('0x2b'),'exitAt':null}});})[_0x1784('0xd')](function(_0x85b91e){if(_0x85b91e){return _0x85b91e[_0x1784('0x38')]({'exitAt':moment()['format'](_0x1784('0x2e')),'data2':_0x1784('0x3e')},{'individualHooks':!![]});}return null;})[_0x1784('0xd')](function(){return _0x400131['update']({'voicePause':![]});});case _0x1784('0x3f'):case _0x1784('0x40'):case'fax':case _0x1784('0x41'):case _0x1784('0x42'):case _0x1784('0x43'):return db[_0x1784('0x36')][_0x1784('0x23')]({'where':{'channel':_0x3aec2f[_0x1784('0x35')][_0x1784('0x3a')],'membername':_0x400131[_0x1784('0x26')],'type':_0x1784('0x2b'),'exitAt':null}})[_0x1784('0xd')](function(_0x5984d6){return _0x5984d6[_0x1784('0x38')]({'exitAt':moment()['format'](_0x1784('0x2e')),'data2':'system'},{'individualHooks':!![]});})[_0x1784('0xd')](function(){var _0x13516e={};_[_0x1784('0x44')](_0x13516e,util[_0x1784('0x2d')](_0x1784('0x45'),_0x3aec2f[_0x1784('0x35')][_0x1784('0x3a')],_0x1784('0x46')),![]);return _0x400131['update'](_0x13516e);});default:return db[_0x1784('0x2a')][_0x1784('0x38')]({'paused':0x0},{'where':{'UserId':_0x400131['id']}})[_0x1784('0xd')](function(){return db[_0x1784('0x36')][_0x1784('0x1b')]({'where':{'membername':_0x400131[_0x1784('0x26')],'type':'PAUSE','exitAt':null}});})[_0x1784('0xd')](function(_0x3122f1){var _0x1afdc4=[];_0x3122f1[_0x1784('0x47')](function(_0x47ef38){_0x1afdc4[_0x1784('0x31')](_0x47ef38[_0x1784('0x38')]({'exitAt':moment()[_0x1784('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x1784('0x3e')}));});return BPromise[_0x1784('0x48')](_0x1afdc4);})[_0x1784('0xd')](function(){return _0x400131[_0x1784('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x36b47c){_0x43e5df(_0x36b47c);})['catch'](function(_0x2ecd09){_0x42857d(_0x5f2fb7['error'](0x1f4,_0x2ecd09[_0x1784('0x16')]));});});};exports['LogoutUser']=function(_0x5d3314){var _0x3d63d4=this;return new Promise(function(_0x3e386f,_0x5f02fb){var _0xc2edba;return db['User'][_0x1784('0x39')]({'where':_0x5d3314[_0x1784('0x1c')][_0x1784('0x24')]||{},'attributes':['id','name']})['then'](function(_0x51f2e1){if(_0x51f2e1){_0xc2edba=_0x51f2e1;return db[_0x1784('0x2a')][_0x1784('0x49')]({'where':{'membername':_0xc2edba[_0x1784('0x26')]},'individualHooks':!![]});}})[_0x1784('0xd')](function(){if(_0xc2edba){return db[_0x1784('0x36')]['findAll']({'where':{'membername':_0xc2edba[_0x1784('0x26')],'exitAt':null}});}})[_0x1784('0xd')](function(_0xfcb3e5){if(_0xc2edba){if(_0xfcb3e5&&_0xfcb3e5[_0x1784('0x2c')]){var _0x1116b2=[];_0xfcb3e5[_0x1784('0x47')](function(_0x5e75d8){_0x1116b2[_0x1784('0x31')](_0x5e75d8[_0x1784('0x38')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1784('0x48')](_0x1116b2);}}})['then'](function(){if(_0xc2edba){return _0xc2edba[_0x1784('0x38')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1784('0xd')](function(_0x4c1855){_0x3e386f(_0x4c1855);})[_0x1784('0x18')](function(_0xb6e15b){_0x5f02fb(_0x3d63d4[_0x1784('0x14')](0x1f4,_0xb6e15b[_0x1784('0x16')]));});});};exports[_0x1784('0x4a')]=function(_0x30c0f1){var _0x12c032=this;return new Promise(function(_0x20ea74,_0xdfcbd5){var _0x59a96c;var _0x9e26ed;var _0x445f55;var _0x8b12b4;return db[_0x1784('0x1a')][_0x1784('0x39')]({'where':_0x30c0f1[_0x1784('0x1c')][_0x1784('0x24')]||{},'attributes':['id',_0x1784('0x26'),_0x1784('0x27'),_0x1784('0x4b'),'phone',_0x1784('0x28'),_0x1784('0x4c'),_0x1784('0x29')]})['then'](function(_0x18b869){if(_0x18b869){_0x59a96c=_0x18b869;_0x8b12b4=_0x30c0f1[_0x1784('0x35')][_0x1784('0x29')]?_0x30c0f1[_0x1784('0x35')][_0x1784('0x29')]:util[_0x1784('0x2d')]('SIP/%s',_0x59a96c[_0x1784('0x26')]);return db[_0x1784('0x1a')][_0x1784('0x4d')]({'where':{'role':_0x1784('0x4e'),'online':!![],'id':{'$ne':_0x59a96c['id']}}});}})[_0x1784('0xd')](function(_0x18b2b4){if(_0x18b2b4){_0x445f55=_0x18b2b4;return require('../../config/license/util')[_0x1784('0x4f')]();}})[_0x1784('0xd')](function(_0x4e8a45){if(_0x4e8a45&&_0x4e8a45['agents']&&_0x445f55>=_0x4e8a45[_0x1784('0x50')]){throw new Error(_0x1784('0x51'));}})['then'](function(){if(_0x59a96c){return db[_0x1784('0x2a')][_0x1784('0x49')]({'where':{'membername':_0x59a96c[_0x1784('0x26')]},'individualHooks':!![]});}})[_0x1784('0xd')](function(){if(_0x59a96c){return _0x59a96c['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x4d8dee){if(_0x59a96c){if(_0x4d8dee){var _0x30b60b=[];_0x9e26ed=_0x4d8dee;if(_0x9e26ed[_0x1784('0x2c')]){for(var _0x1ac3fd=0x0;_0x1ac3fd<_0x9e26ed[_0x1784('0x2c')];_0x1ac3fd++){_0x30b60b[_0x1784('0x31')](db['UserVoiceQueueRt'][_0x1784('0x52')]({'membername':_0x59a96c[_0x1784('0x26')],'UserId':_0x59a96c['id'],'queue_name':_0x9e26ed[_0x1ac3fd]['name'],'VoiceQueueId':_0x9e26ed[_0x1ac3fd]['id'],'interface':_0x8b12b4,'paused':_0x59a96c[_0x1784('0x4c')]||![],'penalty':_0x9e26ed[_0x1ac3fd][_0x1784('0x53')]||0x0}));}return BPromise[_0x1784('0x48')](_0x30b60b);}}}})['then'](function(){if(_0x59a96c){return db[_0x1784('0x36')][_0x1784('0x1b')]({'where':{'membername':_0x59a96c[_0x1784('0x26')],'exitAt':null}});}})['then'](function(_0x2adedd){if(_0x59a96c){if(_0x2adedd&&_0x2adedd[_0x1784('0x2c')]){var _0x234455=[];_0x2adedd[_0x1784('0x47')](function(_0x835a8f){_0x234455[_0x1784('0x31')](_0x835a8f[_0x1784('0x38')]({'exitAt':moment()['format'](_0x1784('0x2e'))}));});return BPromise[_0x1784('0x48')](_0x234455);}}})[_0x1784('0xd')](function(_0x2c4813){if(_0x59a96c){var _0x5cc1a6=[];var _0x9b6831=[];var _0x37feaf=utils[_0x1784('0x30')]();var _0x31aae9={'membername':_0x59a96c[_0x1784('0x26')],'interface':_0x8b12b4,'enterAt':moment()['format'](_0x1784('0x2e')),'role':_0x59a96c[_0x1784('0x27')],'internal':_0x59a96c[_0x1784('0x28')]};_0x37feaf[_0x1784('0x47')](function(_0x4139f7){_0x5cc1a6['push'](_[_0x1784('0x54')]({'channel':_0x4139f7,'type':_0x1784('0x55'),'data1':_0x1784('0x56'),'data2':_0x8b12b4},_0x31aae9));if(_0x59a96c['loginInPause']){_0x9b6831['push'](_[_0x1784('0x54')]({'channel':_0x4139f7,'type':_0x1784('0x2b'),'data1':_0x1784('0x57')},_0x31aae9));}});return db[_0x1784('0x36')][_0x1784('0x37')](_0x5cc1a6['concat'](_0x9b6831),{'individualHooks':!![]});}})[_0x1784('0xd')](function(){if(_0x59a96c){return _0x59a96c[_0x1784('0x38')]({'online':!![],'lastLoginAt':moment()[_0x1784('0x2d')](_0x1784('0x2e')),'voicePause':_0x59a96c[_0x1784('0x4c')]||![],'mailPause':_0x59a96c[_0x1784('0x4c')]||![],'chatPause':_0x59a96c['loginInPause']||![],'faxPause':_0x59a96c['loginInPause']||![],'smsPause':_0x59a96c[_0x1784('0x4c')]||![],'openchannelPause':_0x59a96c['loginInPause']||![],'pauseType':_0x59a96c[_0x1784('0x4c')]?_0x1784('0x57'):null,'lastPauseAt':moment()[_0x1784('0x2d')](_0x1784('0x2e')),'interface':_0x8b12b4});}})[_0x1784('0xd')](function(_0x50e123){_0x20ea74(_0x50e123);})[_0x1784('0x18')](function(_0x9b4001){_0xdfcbd5(_0x12c032[_0x1784('0x14')](0x1f4,_0x9b4001[_0x1784('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 307209e..b6a19d0 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 _0xd562=['user:','./user.events','save','update','emit','removeListener','length'];(function(_0xfcb0f1,_0x3f2d57){var _0x4ed14e=function(_0x29cc13){while(--_0x29cc13){_0xfcb0f1['push'](_0xfcb0f1['shift']());}};_0x4ed14e(++_0x3f2d57);}(_0xd562,0x1ac));var _0x2d56=function(_0x3fdc2d,_0x44dc47){_0x3fdc2d=_0x3fdc2d-0x0;var _0x2f6916=_0xd562[_0x3fdc2d];return _0x2f6916;};'use strict';var UserEvents=require(_0x2d56('0x0'));var events=[_0x2d56('0x1'),'remove',_0x2d56('0x2')];function createListener(_0x5193f1,_0x34bfa3){return function(_0x26b49e){_0x34bfa3[_0x2d56('0x3')](_0x5193f1,_0x26b49e);};}function removeListener(_0x5a8327,_0x2d5a4b){return function(){UserEvents[_0x2d56('0x4')](_0x5a8327,_0x2d5a4b);};}exports['register']=function(_0x559157){for(var _0xb5c646=0x0,_0x2365ec=events[_0x2d56('0x5')];_0xb5c646<_0x2365ec;_0xb5c646++){var _0x5f14fd=events[_0xb5c646];var _0x243983=createListener(_0x2d56('0x6')+_0x5f14fd,_0x559157);UserEvents['on'](_0x5f14fd,_0x243983);}}; \ No newline at end of file +var _0xd7f9=['update','removeListener','register','length','./user.events'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0xd7f9,0x126));var _0x9d7f=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xd7f9[_0x5756f8];return _0x3bb749;};'use strict';var UserEvents=require(_0x9d7f('0x0'));var events=['save','remove',_0x9d7f('0x1')];function createListener(_0x589714,_0x214afb){return function(_0x26f5b6){_0x214afb['emit'](_0x589714,_0x26f5b6);};}function removeListener(_0x40ca99,_0x253625){return function(){UserEvents[_0x9d7f('0x2')](_0x40ca99,_0x253625);};}exports[_0x9d7f('0x3')]=function(_0x43ee2a){for(var _0x15eb60=0x0,_0x289b34=events[_0x9d7f('0x4')];_0x15eb60<_0x289b34;_0x15eb60++){var _0xc7855=events[_0x15eb60];var _0x2ccf05=createListener('user:'+_0xc7855,_0x43ee2a);UserEvents['on'](_0xc7855,_0x2ccf05);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b419943..84c07dc 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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(_0x1bac40,_0x40e428){var _0x3a1a70=function(_0x5459c0){while(--_0x5459c0){_0x1bac40['push'](_0x1bac40['shift']());}};_0x3a1a70(++_0x40e428);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 66f6592..3bf3073 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 _0x486e=['INTEGER','sequelize','exports'];(function(_0x877dbb,_0x4d00d5){var _0xc224a9=function(_0x29fb7f){while(--_0x29fb7f){_0x877dbb['push'](_0x877dbb['shift']());}};_0xc224a9(++_0x4d00d5);}(_0x486e,0xcd));var _0xe486=function(_0x2c3c18,_0x576f9b){_0x2c3c18=_0x2c3c18-0x0;var _0x2c0c42=_0x486e[_0x2c3c18];return _0x2c0c42;};'use strict';var Sequelize=require(_0xe486('0x0'));module[_0xe486('0x1')]={'penalty':{'type':Sequelize[_0xe486('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0845=['sequelize'];(function(_0xf0ab39,_0x546c7d){var _0x597c68=function(_0x4629a1){while(--_0x4629a1){_0xf0ab39['push'](_0xf0ab39['shift']());}};_0x597c68(++_0x546c7d);}(_0x0845,0x125));var _0x5084=function(_0x2f5072,_0x11d0cd){_0x2f5072=_0x2f5072-0x0;var _0x28d2c8=_0x0845[_0x2f5072];return _0x28d2c8;};'use strict';var Sequelize=require(_0x5084('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e933914..e6f2741 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 _0x973c=['user_has_chat_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue'];(function(_0x521b02,_0x45513f){var _0x26bacd=function(_0x4ce940){while(--_0x4ce940){_0x521b02['push'](_0x521b02['shift']());}};_0x26bacd(++_0x45513f);}(_0x973c,0x177));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc973('0x0'));var util=require('util');var logger=require(_0xc973('0x1'))('api');var moment=require(_0xc973('0x2'));var BPromise=require('bluebird');var rp=require(_0xc973('0x3'));var fs=require('fs');var path=require(_0xc973('0x4'));var rimraf=require(_0xc973('0x5'));var config=require(_0xc973('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xc973('0x7')]=function(_0x50d0e8,_0x512a5d){return _0x50d0e8[_0xc973('0x8')](_0xc973('0x9'),attributes,{'tableName':_0xc973('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb7=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2cebd0,_0x35feda){var _0x19a770=function(_0x397c16){while(--_0x397c16){_0x2cebd0['push'](_0x2cebd0['shift']());}};_0x19a770(++_0x35feda);}(_0x1cb7,0xb1));var _0x71cb=function(_0x3f2da9,_0x2b422d){_0x3f2da9=_0x3f2da9-0x0;var _0x25c139=_0x1cb7[_0x3f2da9];return _0x25c139;};'use strict';var _=require(_0x71cb('0x0'));var util=require('util');var logger=require(_0x71cb('0x1'))(_0x71cb('0x2'));var moment=require(_0x71cb('0x3'));var BPromise=require(_0x71cb('0x4'));var rp=require(_0x71cb('0x5'));var fs=require('fs');var path=require(_0x71cb('0x6'));var rimraf=require(_0x71cb('0x7'));var config=require(_0x71cb('0x8'));var attributes=require(_0x71cb('0x9'));module[_0x71cb('0xa')]=function(_0x40db58,_0x5433ab){return _0x40db58[_0x71cb('0xb')](_0x71cb('0xc'),attributes,{'tableName':_0x71cb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 1bcdc91..eac4659 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 _0xd7b8=['rpc','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x10e1ec,_0x32f4fa){var _0x19009d=function(_0x231c98){while(--_0x231c98){_0x10e1ec['push'](_0x10e1ec['shift']());}};_0x19009d(++_0x32f4fa);}(_0xd7b8,0xd5));var _0x8d7b=function(_0x4cb4e4,_0xf22f36){_0x4cb4e4=_0x4cb4e4-0x0;var _0xbe63b2=_0xd7b8[_0x4cb4e4];return _0xbe63b2;};'use strict';var _=require(_0x8d7b('0x0'));var util=require('util');var moment=require(_0x8d7b('0x1'));var BPromise=require(_0x8d7b('0x2'));var rs=require(_0x8d7b('0x3'));var fs=require('fs');var Redis=require(_0x8d7b('0x4'));var db=require(_0x8d7b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d7b('0x6'))(_0x8d7b('0x7'));var config=require(_0x8d7b('0x8'));var jayson=require(_0x8d7b('0x9'));var client=jayson[_0x8d7b('0xa')][_0x8d7b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd4f3,_0x551074,_0x516798){return new BPromise(function(_0x59f312,_0x5c4359){return client['request'](_0x2dd4f3,_0x516798)['then'](function(_0x5e8ac4){logger[_0x8d7b('0xc')](_0x8d7b('0xd'),_0x551074,_0x8d7b('0xe'));logger[_0x8d7b('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x551074,'request\x20sent',JSON[_0x8d7b('0x10')](_0x5e8ac4));if(_0x5e8ac4[_0x8d7b('0x11')]){if(_0x5e8ac4[_0x8d7b('0x11')][_0x8d7b('0x12')]===0x1f4){logger[_0x8d7b('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x551074,_0x5e8ac4[_0x8d7b('0x11')][_0x8d7b('0x13')]);return _0x5c4359(_0x5e8ac4['error']['message']);}logger[_0x8d7b('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x551074,_0x5e8ac4[_0x8d7b('0x11')][_0x8d7b('0x13')]);return _0x59f312(_0x5e8ac4['error']['message']);}else{logger['info'](_0x8d7b('0xd'),_0x551074,_0x8d7b('0xe'));_0x59f312(_0x5e8ac4[_0x8d7b('0x14')][_0x8d7b('0x13')]);}})[_0x8d7b('0x15')](function(_0x2080b7){logger['error'](_0x8d7b('0xd'),_0x551074,_0x2080b7);_0x5c4359(_0x2080b7);});});} \ No newline at end of file +var _0x317a=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2c74e5,_0x2f9a66){var _0x3ea53c=function(_0x5bf845){while(--_0x5bf845){_0x2c74e5['push'](_0x2c74e5['shift']());}};_0x3ea53c(++_0x2f9a66);}(_0x317a,0x12a));var _0xa317=function(_0x3818a1,_0x31bc14){_0x3818a1=_0x3818a1-0x0;var _0x465793=_0x317a[_0x3818a1];return _0x465793;};'use strict';var _=require('lodash');var util=require(_0xa317('0x0'));var moment=require(_0xa317('0x1'));var BPromise=require(_0xa317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa317('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa317('0x4'))('rpc');var config=require(_0xa317('0x5'));var jayson=require(_0xa317('0x6'));var client=jayson[_0xa317('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249869,_0x1978df,_0x583433){return new BPromise(function(_0x3a867e,_0x4bc390){return client[_0xa317('0x8')](_0x249869,_0x583433)[_0xa317('0x9')](function(_0x2ae5f0){logger[_0xa317('0xa')](_0xa317('0xb'),_0x1978df,_0xa317('0xc'));logger[_0xa317('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1978df,'request\x20sent',JSON['stringify'](_0x2ae5f0));if(_0x2ae5f0[_0xa317('0xe')]){if(_0x2ae5f0['error'][_0xa317('0xf')]===0x1f4){logger[_0xa317('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1978df,_0x2ae5f0[_0xa317('0xe')][_0xa317('0x10')]);return _0x4bc390(_0x2ae5f0['error']['message']);}logger[_0xa317('0xe')](_0xa317('0xb'),_0x1978df,_0x2ae5f0[_0xa317('0xe')][_0xa317('0x10')]);return _0x3a867e(_0x2ae5f0[_0xa317('0xe')][_0xa317('0x10')]);}else{logger[_0xa317('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x1978df,'request\x20sent');_0x3a867e(_0x2ae5f0['result']['message']);}})[_0xa317('0x11')](function(_0x39f51f){logger[_0xa317('0xe')](_0xa317('0xb'),_0x1978df,_0x39f51f);_0x4bc390(_0x39f51f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1bf9443..edc8afe 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e7be2,_0xf2451){var _0x715f75=function(_0x587b02){while(--_0x587b02){_0x3e7be2['push'](_0x3e7be2['shift']());}};_0x715f75(++_0xf2451);}(_0x70e0,0x17b));var _0x070e=function(_0x1d2be9,_0x65f791){_0x1d2be9=_0x1d2be9-0x0;var _0x35d9fe=_0x70e0[_0x1d2be9];return _0x35d9fe;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e8df5,_0x2f8452){var _0x5ea8eb=function(_0x4843f2){while(--_0x4843f2){_0x3e8df5['push'](_0x3e8df5['shift']());}};_0x5ea8eb(++_0x2f8452);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xcb91[_0x4996d5];return _0x4793f9;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 302dc88..e1d6746 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 _0x1b2e=['sequelize','INTEGER'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x1b2e,0x18c));var _0xe1b2=function(_0x5d02f4,_0x1f0924){_0x5d02f4=_0x5d02f4-0x0;var _0x3a97f4=_0x1b2e[_0x5d02f4];return _0x3a97f4;};'use strict';var Sequelize=require(_0xe1b2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe1b2('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe1b2('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf4e=['exports','INTEGER','STRING','sequelize'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xaf4e,0x137));var _0xeaf4=function(_0x293e60,_0x4f287c){_0x293e60=_0x293e60-0x0;var _0x2600f7=_0xaf4e[_0x293e60];return _0x2600f7;};'use strict';var Sequelize=require(_0xeaf4('0x0'));module[_0xeaf4('0x1')]={'penalty':{'type':Sequelize[_0xeaf4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xeaf4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5d2de40..8e3ca1d 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 _0x4ef9=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1fddfd,_0x153a74){var _0x595b32=function(_0x2512d4){while(--_0x2512d4){_0x1fddfd['push'](_0x1fddfd['shift']());}};_0x595b32(++_0x153a74);}(_0x4ef9,0x17f));var _0x94ef=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x4ef9[_0x512f81];return _0xa15099;};'use strict';var _=require(_0x94ef('0x0'));var util=require(_0x94ef('0x1'));var logger=require(_0x94ef('0x2'))(_0x94ef('0x3'));var moment=require(_0x94ef('0x4'));var BPromise=require(_0x94ef('0x5'));var rp=require(_0x94ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94ef('0x7'));var config=require(_0x94ef('0x8'));var attributes=require(_0x94ef('0x9'));module[_0x94ef('0xa')]=function(_0x18c67e,_0x23828d){return _0x18c67e[_0x94ef('0xb')](_0x94ef('0xc'),attributes,{'tableName':_0x94ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4179=['../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','api','moment','request-promise','rimraf'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4179,0xe1));var _0x9417=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x4179[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x9417('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9417('0x1'));var moment=require(_0x9417('0x2'));var BPromise=require('bluebird');var rp=require(_0x9417('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9417('0x4'));var config=require(_0x9417('0x5'));var attributes=require(_0x9417('0x6'));module['exports']=function(_0x1518ae,_0x4f2605){return _0x1518ae[_0x9417('0x7')](_0x9417('0x8'),attributes,{'tableName':_0x9417('0x9'),'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 f7601f1..461acd5 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 _0x1f4a=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x50d471,_0x2d9086){var _0x214900=function(_0x413fa1){while(--_0x413fa1){_0x50d471['push'](_0x50d471['shift']());}};_0x214900(++_0x2d9086);}(_0x1f4a,0xbb));var _0xa1f4=function(_0x172f62,_0x21a49c){_0x172f62=_0x172f62-0x0;var _0x472373=_0x1f4a[_0x172f62];return _0x472373;};'use strict';var _=require(_0xa1f4('0x0'));var util=require(_0xa1f4('0x1'));var moment=require(_0xa1f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1f4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1f4('0x5'))(_0xa1f4('0x6'));var config=require(_0xa1f4('0x7'));var jayson=require(_0xa1f4('0x8'));var client=jayson[_0xa1f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19aeac,_0x1feb3d,_0x50fb82){return new BPromise(function(_0x105447,_0x170df7){return client[_0xa1f4('0xa')](_0x19aeac,_0x50fb82)['then'](function(_0x484653){logger[_0xa1f4('0xb')](_0xa1f4('0xc'),_0x1feb3d,_0xa1f4('0xd'));logger[_0xa1f4('0xe')](_0xa1f4('0xf'),_0x1feb3d,_0xa1f4('0xd'),JSON[_0xa1f4('0x10')](_0x484653));if(_0x484653[_0xa1f4('0x11')]){if(_0x484653['error'][_0xa1f4('0x12')]===0x1f4){logger[_0xa1f4('0x11')](_0xa1f4('0xc'),_0x1feb3d,_0x484653[_0xa1f4('0x11')]['message']);return _0x170df7(_0x484653[_0xa1f4('0x11')][_0xa1f4('0x13')]);}logger[_0xa1f4('0x11')](_0xa1f4('0xc'),_0x1feb3d,_0x484653[_0xa1f4('0x11')][_0xa1f4('0x13')]);return _0x105447(_0x484653[_0xa1f4('0x11')][_0xa1f4('0x13')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x1feb3d,_0xa1f4('0xd'));_0x105447(_0x484653['result']['message']);}})['catch'](function(_0x5bd123){logger[_0xa1f4('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x1feb3d,_0x5bd123);_0x170df7(_0x5bd123);});});} \ No newline at end of file +var _0x93e8=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x93e8,0x14b));var _0x893e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x93e8[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x893e('0x0'));var util=require('util');var moment=require(_0x893e('0x1'));var BPromise=require(_0x893e('0x2'));var rs=require(_0x893e('0x3'));var fs=require('fs');var Redis=require(_0x893e('0x4'));var db=require(_0x893e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x893e('0x6'))(_0x893e('0x7'));var config=require(_0x893e('0x8'));var jayson=require(_0x893e('0x9'));var client=jayson[_0x893e('0xa')][_0x893e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf8be90,_0x5bdc5b,_0x24365b){return new BPromise(function(_0x546bc0,_0x133535){return client[_0x893e('0xc')](_0xf8be90,_0x24365b)[_0x893e('0xd')](function(_0x47597f){logger[_0x893e('0xe')](_0x893e('0xf'),_0x5bdc5b,_0x893e('0x10'));logger[_0x893e('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5bdc5b,_0x893e('0x10'),JSON['stringify'](_0x47597f));if(_0x47597f[_0x893e('0x12')]){if(_0x47597f['error'][_0x893e('0x13')]===0x1f4){logger[_0x893e('0x12')](_0x893e('0xf'),_0x5bdc5b,_0x47597f[_0x893e('0x12')][_0x893e('0x14')]);return _0x133535(_0x47597f[_0x893e('0x12')]['message']);}logger[_0x893e('0x12')](_0x893e('0xf'),_0x5bdc5b,_0x47597f[_0x893e('0x12')]['message']);return _0x546bc0(_0x47597f[_0x893e('0x12')][_0x893e('0x14')]);}else{logger['info'](_0x893e('0xf'),_0x5bdc5b,_0x893e('0x10'));_0x546bc0(_0x47597f[_0x893e('0x15')][_0x893e('0x14')]);}})[_0x893e('0x16')](function(_0x4d9456){logger[_0x893e('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x5bdc5b,_0x4d9456);_0x133535(_0x4d9456);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1398f42..7897f6f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24b66b,_0x149f2a){var _0x1eac23=function(_0x3722d6){while(--_0x3722d6){_0x24b66b['push'](_0x24b66b['shift']());}};_0x1eac23(++_0x149f2a);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2b45e1,_0x278cc1){var _0x442a3e=function(_0x27713f){while(--_0x27713f){_0x2b45e1['push'](_0x2b45e1['shift']());}};_0x442a3e(++_0x278cc1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xcb91[_0x193e28];return _0x20ef59;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7e5d12d..97d0e79 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 _0x9917=['sequelize','INTEGER'];(function(_0x3b274b,_0x2df4de){var _0x526ebe=function(_0x203f75){while(--_0x203f75){_0x3b274b['push'](_0x3b274b['shift']());}};_0x526ebe(++_0x2df4de);}(_0x9917,0xe6));var _0x7991=function(_0x316d4f,_0x5926db){_0x316d4f=_0x316d4f-0x0;var _0x24501c=_0x9917[_0x316d4f];return _0x24501c;};'use strict';var Sequelize=require(_0x7991('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7991('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa67a=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa67a,0x114));var _0xaa67=function(_0x59b761,_0x141390){_0x59b761=_0x59b761-0x0;var _0x55d8dd=_0xa67a[_0x59b761];return _0x55d8dd;};'use strict';var Sequelize=require(_0xaa67('0x0'));module[_0xaa67('0x1')]={'penalty':{'type':Sequelize[_0xaa67('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 2799a71..bb494ef 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 _0x7367=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0x3ff80b,_0x1acd10){var _0x5a6465=function(_0x4d7ac7){while(--_0x4d7ac7){_0x3ff80b['push'](_0x3ff80b['shift']());}};_0x5a6465(++_0x1acd10);}(_0x7367,0x166));var _0x7736=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7367[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7736('0x0'));var util=require(_0x7736('0x1'));var logger=require(_0x7736('0x2'))(_0x7736('0x3'));var moment=require('moment');var BPromise=require(_0x7736('0x4'));var rp=require(_0x7736('0x5'));var fs=require('fs');var path=require(_0x7736('0x6'));var rimraf=require(_0x7736('0x7'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x7736('0x8')]=function(_0x19340d,_0x599b05){return _0x19340d[_0x7736('0x9')](_0x7736('0xa'),attributes,{'tableName':_0x7736('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b8=['user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x5228d1,_0x196b1f){var _0x246048=function(_0x4ca1d4){while(--_0x4ca1d4){_0x5228d1['push'](_0x5228d1['shift']());}};_0x246048(++_0x196b1f);}(_0x59b8,0x114));var _0x859b=function(_0x23229c,_0x12085c){_0x23229c=_0x23229c-0x0;var _0x52b83d=_0x59b8[_0x23229c];return _0x52b83d;};'use strict';var _=require(_0x859b('0x0'));var util=require(_0x859b('0x1'));var logger=require('../../config/logger')(_0x859b('0x2'));var moment=require(_0x859b('0x3'));var BPromise=require(_0x859b('0x4'));var rp=require(_0x859b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x859b('0x6'));var config=require(_0x859b('0x7'));var attributes=require(_0x859b('0x8'));module['exports']=function(_0x38de64,_0x3bc199){return _0x38de64[_0x859b('0x9')]('UserMailQueue',attributes,{'tableName':_0x859b('0xa'),'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 69dc747..07f70db 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x32b2f6,_0x43641e){_0x32b2f6=_0x32b2f6-0x0;var _0x3c2ec9=_0x1cb9[_0x32b2f6];return _0x3c2ec9;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x295304,_0x239e32){var _0x126d70=function(_0x3f8a7c){while(--_0x3f8a7c){_0x295304['push'](_0x295304['shift']());}};_0x126d70(++_0x239e32);}(_0x55ca,0x126));var _0xa55c=function(_0x569b53,_0x3279f6){_0x569b53=_0x569b53-0x0;var _0x467e46=_0x55ca[_0x569b53];return _0x467e46;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4cbc371..eb85303 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 _0x6fec=['../../components/interaction/service','post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x6fec,0x122));var _0xc6fe=function(_0xd6a461,_0x6704ef){_0xd6a461=_0xd6a461-0x0;var _0x30d716=_0x6fec[_0xd6a461];return _0x30d716;};'use strict';var multer=require(_0xc6fe('0x0'));var util=require(_0xc6fe('0x1'));var path=require(_0xc6fe('0x2'));var timeout=require(_0xc6fe('0x3'));var express=require(_0xc6fe('0x4'));var router=express[_0xc6fe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc6fe('0x6'));var interaction=require(_0xc6fe('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0xc6fe('0x8')]('/',auth[_0xc6fe('0x9')](),controller[_0xc6fe('0xa')]);module['exports']=router; \ No newline at end of file +var _0x20a6=['../../config/environment','post','isAuthenticated','exports','connect-timeout','../../components/auth/service'];(function(_0x4489b6,_0x47c466){var _0x13a4bb=function(_0x25092f){while(--_0x25092f){_0x4489b6['push'](_0x4489b6['shift']());}};_0x13a4bb(++_0x47c466);}(_0x20a6,0x1de));var _0x620a=function(_0x1cfc09,_0x1fa839){_0x1cfc09=_0x1cfc09-0x0;var _0x20b858=_0x20a6[_0x1cfc09];return _0x20b858;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x620a('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x620a('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x620a('0x2'));var controller=require('./userNotification.controller');router[_0x620a('0x3')]('/',auth[_0x620a('0x4')](),controller['sendUserNotification']);module[_0x620a('0x5')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f23ee75..4dafecf 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 _0x004d=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5c8ab9,_0x32f9d7){var _0x2fbbac=function(_0x452868){while(--_0x452868){_0x5c8ab9['push'](_0x5c8ab9['shift']());}};_0x2fbbac(++_0x32f9d7);}(_0x004d,0x184));var _0xd004=function(_0x3d30f8,_0x26be8c){_0x3d30f8=_0x3d30f8-0x0;var _0x227daf=_0x004d[_0x3d30f8];return _0x227daf;};'use strict';var Sequelize=require(_0xd004('0x0'));module[_0xd004('0x1')]={'body':{'type':Sequelize[_0xd004('0x2')]},'senderName':{'type':Sequelize[_0xd004('0x3')]},'recipientsId':{'type':Sequelize[_0xd004('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd004('0x3')]},'beep':{'type':Sequelize[_0xd004('0x4')]}}; \ No newline at end of file +var _0x50c5=['exports','STRING','TEXT','BOOLEAN','sequelize'];(function(_0x174c00,_0x433e81){var _0x458483=function(_0x11d713){while(--_0x11d713){_0x174c00['push'](_0x174c00['shift']());}};_0x458483(++_0x433e81);}(_0x50c5,0x13a));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x550c('0x0'));module[_0x550c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x550c('0x2')]},'recipientsId':{'type':Sequelize[_0x550c('0x3')]},'recipientsDescription':{'type':Sequelize[_0x550c('0x2')]},'beep':{'type':Sequelize[_0x550c('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5afa153..561836c 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 _0x9f96=['api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','body','text','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','Sequelize','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','queue','replace','Queue','push','flatten','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f96,0x1e4));var _0x69f9=function(_0x4f400a,_0x33ea58){_0x4f400a=_0x4f400a-0x0;var _0x329a4f=_0x9f96[_0x4f400a];return _0x329a4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f9('0x0'));var zipdir=require(_0x69f9('0x1'));var jsonpatch=require(_0x69f9('0x2'));var rp=require(_0x69f9('0x3'));var moment=require(_0x69f9('0x4'));var BPromise=require(_0x69f9('0x5'));var Mustache=require(_0x69f9('0x6'));var util=require('util');var path=require(_0x69f9('0x7'));var sox=require(_0x69f9('0x8'));var csv=require(_0x69f9('0x9'));var ejs=require(_0x69f9('0xa'));var fs=require('fs');var fs_extra=require(_0x69f9('0xb'));var _=require(_0x69f9('0xc'));var squel=require(_0x69f9('0xd'));var crypto=require(_0x69f9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x69f9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x69f9('0x10'));var Papa=require('papaparse');var Redis=require(_0x69f9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x69f9('0x12'));var hardwareService=require(_0x69f9('0x13'));var logger=require(_0x69f9('0x14'))(_0x69f9('0x15'));var utils=require(_0x69f9('0x16'));var config=require(_0x69f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x69f9('0x18'))['db'];config['redis']=_[_0x69f9('0x19')](config[_0x69f9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69f9('0x1a')]));require(_0x69f9('0x1b'))[_0x69f9('0x1c')](socket);function respondWithStatusCode(_0x53ea1c,_0x2f22df){_0x2f22df=_0x2f22df||0xcc;return function(_0x2135a9){if(_0x2135a9){return _0x53ea1c[_0x69f9('0x1d')](_0x2f22df);}return _0x53ea1c['status'](_0x2f22df)[_0x69f9('0x1e')]();};}function respondWithResult(_0x2e4efc,_0x2e1029){_0x2e1029=_0x2e1029||0xc8;return function(_0x62b84e){if(_0x62b84e){return _0x2e4efc[_0x69f9('0x1f')](_0x2e1029)[_0x69f9('0x20')](_0x62b84e);}};}function respondWithFilteredResult(_0x317879,_0x1f4d13){return function(_0xb54459){if(_0xb54459){var _0x350fe2=typeof _0x1f4d13[_0x69f9('0x21')]===_0x69f9('0x22')&&typeof _0x1f4d13[_0x69f9('0x23')]===_0x69f9('0x22');var _0xd2bab4=_0xb54459[_0x69f9('0x24')];var _0x27c1ef=_0x350fe2?0x0:_0x1f4d13[_0x69f9('0x21')];var _0x4618e4=_0x350fe2?_0xb54459[_0x69f9('0x24')]:_0x1f4d13[_0x69f9('0x21')]+_0x1f4d13[_0x69f9('0x23')];var _0x113361;if(_0x4618e4>=_0xd2bab4){_0x4618e4=_0xd2bab4;_0x113361=0xc8;}else{_0x113361=0xce;}_0x317879[_0x69f9('0x1f')](_0x113361);return _0x317879[_0x69f9('0x25')](_0x69f9('0x26'),_0x27c1ef+'-'+_0x4618e4+'/'+_0xd2bab4)[_0x69f9('0x20')](_0xb54459);}return null;};}function patchUpdates(_0x197613){return function(_0x40e85a){try{jsonpatch[_0x69f9('0x27')](_0x40e85a,_0x197613,!![]);}catch(_0x2193c0){return BPromise[_0x69f9('0x28')](_0x2193c0);}return _0x40e85a['save']();};}function saveUpdates(_0x41ea5b,_0x1046d3){return function(_0x48bd97){if(_0x48bd97){return _0x48bd97[_0x69f9('0x29')](_0x41ea5b)[_0x69f9('0x2a')](function(_0x541a9a){return _0x541a9a;});}return null;};}function removeEntity(_0x21c24a,_0x124534){return function(_0x3ffb56){if(_0x3ffb56){return _0x3ffb56[_0x69f9('0x2b')]()[_0x69f9('0x2a')](function(){_0x21c24a['status'](0xcc)[_0x69f9('0x1e')]();});}};}function handleEntityNotFound(_0x36d606,_0x4a6c31){return function(_0x426d41){if(!_0x426d41){_0x36d606[_0x69f9('0x1d')](0x194);}return _0x426d41;};}function handleError(_0x26296e,_0x49f425){_0x49f425=_0x49f425||0x1f4;return function(_0x57d4a8){logger['error'](_0x57d4a8[_0x69f9('0x2c')]);if(_0x57d4a8['name']){delete _0x57d4a8[_0x69f9('0x2d')];}_0x26296e[_0x69f9('0x1f')](_0x49f425)[_0x69f9('0x2e')](_0x57d4a8);};}exports['sendUserNotification']=function(_0x18c449,_0x11f0fd,_0x29671f){if(!_0x18c449[_0x69f9('0x2f')]['hasOwnProperty'](_0x69f9('0x30'))&&!_0x18c449[_0x69f9('0x2f')][_0x69f9('0x31')]('TemplateId')){throw new db['Sequelize'][(_0x69f9('0x32'))](_0x69f9('0x33'));}else{if(_0x18c449['body']['hasOwnProperty'](_0x69f9('0x34'))&&!_0x18c449[_0x69f9('0x2f')][_0x69f9('0x31')]('view')){throw new db['Sequelize'][(_0x69f9('0x32'))](_0x69f9('0x35'));}if(!_0x18c449['body']['hasOwnProperty']('recipients')){throw new db[(_0x69f9('0x36'))][(_0x69f9('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3d7cdc=JSON[_0x69f9('0x37')](_0x18c449[_0x69f9('0x2f')]['recipients']);}catch(_0x3d1397){logger[_0x69f9('0x38')](_0x3d1397);throw new db[(_0x69f9('0x36'))]['ValidationError'](_0x69f9('0x39'));}var _0xeed562=[_0x69f9('0x3a'),'faxqueue',_0x69f9('0x3b'),'openchannelqueue',_0x69f9('0x3c'),_0x69f9('0x3d'),_0x69f9('0x3e'),_0x69f9('0x3f'),_0x69f9('0x40')];if(_[_0x69f9('0x41')](_0x3d7cdc,function(_0x26c7a4){return!_[_0x69f9('0x42')](_0xeed562,_0x26c7a4[_0x69f9('0x43')][_0x69f9('0x44')]());})){throw new db[(_0x69f9('0x36'))]['ValidationError'](_0x69f9('0x45'));}}}var _0x3db239={};_0x3db239[_0x69f9('0x46')]=_0x18c449[_0x69f9('0x2f')][_0x69f9('0x31')](_0x69f9('0x46'))?_0x18c449[_0x69f9('0x2f')][_0x69f9('0x46')]:_0x18c449['user'][_0x69f9('0x47')];_0x3db239['recipientsDescription']=_[_0x69f9('0x48')](_0x18c449[_0x69f9('0x2f')][_0x69f9('0x49')])?null:_0x18c449[_0x69f9('0x2f')][_0x69f9('0x49')];_0x3db239['beep']=_0x18c449[_0x69f9('0x2f')]['beep']||![];_0x3db239[_0x69f9('0x4a')]=_0x18c449[_0x69f9('0x40')]['id'];return getContent(_0x18c449[_0x69f9('0x2f')])[_0x69f9('0x2a')](function(_0x322687){_0x3db239['body']=_0x322687;return getRecipients(_0x3d7cdc);})[_0x69f9('0x2a')](function(_0x5956f6){_0x3db239[_0x69f9('0x4b')]=_[_0x69f9('0x4c')](_0x5956f6)[_0x69f9('0x4d')](',');return db['sequelize'][_0x69f9('0x4e')](function(_0x55830c){return db[_0x69f9('0x4f')][_0x69f9('0x50')](_0x3db239,{'raw':!![],'transaction':_0x55830c})[_0x69f9('0x2a')](function(_0x47d643){var _0x244139={'sender':_0x3db239[_0x69f9('0x46')],'description':_0x3db239['recipientsDescription'],'content':_0x3db239[_0x69f9('0x2f')],'beep':_0x3db239[_0x69f9('0x51')]};_0x5956f6[_0x69f9('0x52')](function(_0x444baa){_0x244139[_0x69f9('0x53')]=_0x444baa;socket[_0x69f9('0x54')](_0x69f9('0x55'),_0x244139);});return _0x47d643;});});})[_0x69f9('0x2a')](respondWithResult(_0x11f0fd,0xc9))['catch'](handleError(_0x11f0fd,null));};function getContent(_0x48045c){return new BPromise(function(_0x2d3a01,_0x836b08){if(_0x48045c[_0x69f9('0x30')]){_0x2d3a01(_0x48045c[_0x69f9('0x30')]);return;}return db[_0x69f9('0x56')][_0x69f9('0x57')]({'attributes':[_0x69f9('0x58')],'where':{'id':_0x48045c[_0x69f9('0x34')]},'raw':!![]})[_0x69f9('0x2a')](function(_0x42c159){if(!_0x42c159)throw new db[(_0x69f9('0x36'))][(_0x69f9('0x32'))](_0x69f9('0x59'));var _0x5c87e7=Mustache[_0x69f9('0x5a')](_0x42c159['html'],_0x48045c['view']);_0x2d3a01(_0x5c87e7);})[_0x69f9('0x5b')](function(_0x7511b1){_0x836b08(_0x7511b1);});});}function getRecipients(_0x10edf6){return new BPromise(function(_0x240f69,_0x3a624c){var _0x4ce99a=[];var _0x273fc3=[];_0x10edf6[_0x69f9('0x52')](function(_0x1c1312){var _0x3c3b6d=_[_0x69f9('0x5c')](_0x1c1312[_0x69f9('0x43')][_0x69f9('0x44')]());if(_0x3c3b6d===_0x69f9('0x5d')){_0x4ce99a=_[_0x69f9('0x5e')](_0x4ce99a,_0x1c1312[_0x69f9('0x5f')]);}else{if(_[_0x69f9('0x42')](_0x3c3b6d,_0x69f9('0x60')))_0x3c3b6d=_0x3c3b6d[_0x69f9('0x61')](_0x69f9('0x60'),_0x69f9('0x62'));_0x1c1312[_0x69f9('0x5f')][_0x69f9('0x52')](function(_0x2adf24){_0x273fc3[_0x69f9('0x63')](getAgents(_0x3c3b6d,_0x2adf24));});}});return BPromise['all'](_0x273fc3)[_0x69f9('0x2a')](function(_0x5e1f93){_0x4ce99a=_[_0x69f9('0x5e')](_0x4ce99a,_[_0x69f9('0x64')](_0x5e1f93));_0x240f69(_0x4ce99a);})['catch'](function(_0x5e1e19){_0x3a624c(_0x5e1e19);});});}function getAgents(_0x29c5ab,_0x152094){return new BPromise(function(_0x121f5c,_0x3536d0){return db[_0x29c5ab]['findOne']({'where':{'id':_0x152094}})[_0x69f9('0x2a')](function(_0x3cb1c0){return _0x3cb1c0['getAgents']({'attributes':['id'],'raw':!![]})[_0x69f9('0x2a')](function(_0x3ae288){var _0x2eef79=_['map'](_0x3ae288,'id');_0x121f5c(_0x2eef79);});})['catch'](function(_0x73b7e1){_0x3536d0(_0x73b7e1);});});} \ No newline at end of file +var _0xe425=['mustache','util','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','includes','queue','replace','Queue','push','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x56b51f,_0xf20620){var _0x1cb1e4=function(_0x5b247c){while(--_0x5b247c){_0x56b51f['push'](_0x56b51f['shift']());}};_0x1cb1e4(++_0xf20620);}(_0xe425,0x123));var _0x5e42=function(_0x53a9cb,_0x1d7a73){_0x53a9cb=_0x53a9cb-0x0;var _0x4fc163=_0xe425[_0x53a9cb];return _0x4fc163;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e42('0x0'));var zipdir=require(_0x5e42('0x1'));var jsonpatch=require(_0x5e42('0x2'));var rp=require(_0x5e42('0x3'));var moment=require(_0x5e42('0x4'));var BPromise=require(_0x5e42('0x5'));var Mustache=require(_0x5e42('0x6'));var util=require(_0x5e42('0x7'));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(_0x5e42('0x8'));var _=require(_0x5e42('0x9'));var squel=require('squel');var crypto=require(_0x5e42('0xa'));var jsforce=require(_0x5e42('0xb'));var deskjs=require(_0x5e42('0xc'));var toCsv=require(_0x5e42('0xd'));var querystring=require(_0x5e42('0xe'));var Papa=require(_0x5e42('0xf'));var Redis=require(_0x5e42('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e42('0x11'));var hardwareService=require(_0x5e42('0x12'));var logger=require('../../config/logger')(_0x5e42('0x13'));var utils=require(_0x5e42('0x14'));var config=require(_0x5e42('0x15'));var licenseUtil=require(_0x5e42('0x16'));var db=require(_0x5e42('0x17'))['db'];config[_0x5e42('0x18')]=_['defaults'](config[_0x5e42('0x18')],{'host':_0x5e42('0x19'),'port':0x18eb});var socket=require(_0x5e42('0x1a'))(new Redis(config[_0x5e42('0x18')]));require(_0x5e42('0x1b'))[_0x5e42('0x1c')](socket);function respondWithStatusCode(_0x314088,_0x1cb96e){_0x1cb96e=_0x1cb96e||0xcc;return function(_0x31bb2d){if(_0x31bb2d){return _0x314088['sendStatus'](_0x1cb96e);}return _0x314088['status'](_0x1cb96e)[_0x5e42('0x1d')]();};}function respondWithResult(_0x48b9e3,_0x19a6df){_0x19a6df=_0x19a6df||0xc8;return function(_0x3a9e74){if(_0x3a9e74){return _0x48b9e3[_0x5e42('0x1e')](_0x19a6df)[_0x5e42('0x1f')](_0x3a9e74);}};}function respondWithFilteredResult(_0x33e534,_0x2d4e2){return function(_0x1a1e39){if(_0x1a1e39){var _0x34009c=typeof _0x2d4e2[_0x5e42('0x20')]===_0x5e42('0x21')&&typeof _0x2d4e2[_0x5e42('0x22')]===_0x5e42('0x21');var _0x122ad0=_0x1a1e39[_0x5e42('0x23')];var _0x779d0f=_0x34009c?0x0:_0x2d4e2[_0x5e42('0x20')];var _0x344465=_0x34009c?_0x1a1e39[_0x5e42('0x23')]:_0x2d4e2[_0x5e42('0x20')]+_0x2d4e2[_0x5e42('0x22')];var _0x4ef3f5;if(_0x344465>=_0x122ad0){_0x344465=_0x122ad0;_0x4ef3f5=0xc8;}else{_0x4ef3f5=0xce;}_0x33e534[_0x5e42('0x1e')](_0x4ef3f5);return _0x33e534[_0x5e42('0x24')](_0x5e42('0x25'),_0x779d0f+'-'+_0x344465+'/'+_0x122ad0)['json'](_0x1a1e39);}return null;};}function patchUpdates(_0x816fef){return function(_0x498d28){try{jsonpatch[_0x5e42('0x26')](_0x498d28,_0x816fef,!![]);}catch(_0x36df39){return BPromise[_0x5e42('0x27')](_0x36df39);}return _0x498d28['save']();};}function saveUpdates(_0x5bdfc0,_0x24a79c){return function(_0x50cbfc){if(_0x50cbfc){return _0x50cbfc[_0x5e42('0x28')](_0x5bdfc0)[_0x5e42('0x29')](function(_0x135f90){return _0x135f90;});}return null;};}function removeEntity(_0x19352e,_0x4d18e3){return function(_0x17dfd3){if(_0x17dfd3){return _0x17dfd3[_0x5e42('0x2a')]()[_0x5e42('0x29')](function(){_0x19352e['status'](0xcc)[_0x5e42('0x1d')]();});}};}function handleEntityNotFound(_0x385c0a,_0xed8a8f){return function(_0x17847c){if(!_0x17847c){_0x385c0a['sendStatus'](0x194);}return _0x17847c;};}function handleError(_0xf94e18,_0x4e203c){_0x4e203c=_0x4e203c||0x1f4;return function(_0x38b856){logger[_0x5e42('0x2b')](_0x38b856['stack']);if(_0x38b856[_0x5e42('0x2c')]){delete _0x38b856[_0x5e42('0x2c')];}_0xf94e18[_0x5e42('0x1e')](_0x4e203c)['send'](_0x38b856);};}exports[_0x5e42('0x2d')]=function(_0x5788a8,_0x3ec81c,_0x44c1b1){if(!_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x2f')](_0x5e42('0x30'))&&!_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x2f')]('TemplateId')){throw new db[(_0x5e42('0x31'))][(_0x5e42('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5788a8[_0x5e42('0x2e')]['hasOwnProperty'](_0x5e42('0x33'))&&!_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x2f')](_0x5e42('0x34'))){throw new db[(_0x5e42('0x31'))][(_0x5e42('0x32'))](_0x5e42('0x35'));}if(!_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x2f')](_0x5e42('0x36'))){throw new db[(_0x5e42('0x31'))][(_0x5e42('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2ca1dd=JSON['parse'](_0x5788a8[_0x5e42('0x2e')]['recipients']);}catch(_0x1e0c3f){logger['error'](_0x1e0c3f);throw new db[(_0x5e42('0x31'))][(_0x5e42('0x32'))](_0x5e42('0x37'));}var _0xec5131=[_0x5e42('0x38'),_0x5e42('0x39'),_0x5e42('0x3a'),_0x5e42('0x3b'),_0x5e42('0x3c'),'voicequeue',_0x5e42('0x3d'),_0x5e42('0x3e'),_0x5e42('0x3f')];if(_[_0x5e42('0x40')](_0x2ca1dd,function(_0x28770f){return!_['includes'](_0xec5131,_0x28770f[_0x5e42('0x41')][_0x5e42('0x42')]());})){throw new db[(_0x5e42('0x31'))][(_0x5e42('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5bc705={};_0x5bc705[_0x5e42('0x43')]=_0x5788a8['body'][_0x5e42('0x2f')](_0x5e42('0x43'))?_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x43')]:_0x5788a8[_0x5e42('0x3f')]['fullname'];_0x5bc705[_0x5e42('0x44')]=_[_0x5e42('0x45')](_0x5788a8[_0x5e42('0x2e')]['recipientsDescription'])?null:_0x5788a8['body'][_0x5e42('0x44')];_0x5bc705[_0x5e42('0x46')]=_0x5788a8[_0x5e42('0x2e')][_0x5e42('0x46')]||![];_0x5bc705[_0x5e42('0x47')]=_0x5788a8['user']['id'];return getContent(_0x5788a8[_0x5e42('0x2e')])['then'](function(_0x3f33ce){_0x5bc705['body']=_0x3f33ce;return getRecipients(_0x2ca1dd);})[_0x5e42('0x29')](function(_0x43b245){_0x5bc705[_0x5e42('0x48')]=_[_0x5e42('0x49')](_0x43b245)[_0x5e42('0x4a')](',');return db[_0x5e42('0x4b')][_0x5e42('0x4c')](function(_0xcd5a47){return db[_0x5e42('0x4d')]['create'](_0x5bc705,{'raw':!![],'transaction':_0xcd5a47})['then'](function(_0x372bee){var _0x15e4f9={'sender':_0x5bc705[_0x5e42('0x43')],'description':_0x5bc705[_0x5e42('0x44')],'content':_0x5bc705[_0x5e42('0x2e')],'beep':_0x5bc705[_0x5e42('0x46')]};_0x43b245[_0x5e42('0x4e')](function(_0xef9542){_0x15e4f9[_0x5e42('0x4f')]=_0xef9542;socket[_0x5e42('0x50')](_0x5e42('0x51'),_0x15e4f9);});return _0x372bee;});});})['then'](respondWithResult(_0x3ec81c,0xc9))['catch'](handleError(_0x3ec81c,null));};function getContent(_0x5c25b3){return new BPromise(function(_0x509489,_0x4b6f98){if(_0x5c25b3[_0x5e42('0x30')]){_0x509489(_0x5c25b3[_0x5e42('0x30')]);return;}return db[_0x5e42('0x52')][_0x5e42('0x53')]({'attributes':[_0x5e42('0x54')],'where':{'id':_0x5c25b3[_0x5e42('0x33')]},'raw':!![]})[_0x5e42('0x29')](function(_0x425434){if(!_0x425434)throw new db[(_0x5e42('0x31'))]['ValidationError'](_0x5e42('0x55'));var _0x138dcd=Mustache[_0x5e42('0x56')](_0x425434[_0x5e42('0x54')],_0x5c25b3[_0x5e42('0x34')]);_0x509489(_0x138dcd);})[_0x5e42('0x57')](function(_0x5eb626){_0x4b6f98(_0x5eb626);});});}function getRecipients(_0x3e6114){return new BPromise(function(_0x272a95,_0x3c4400){var _0x2b39e0=[];var _0x45ef58=[];_0x3e6114[_0x5e42('0x4e')](function(_0xe0b3cc){var _0x33146b=_[_0x5e42('0x58')](_0xe0b3cc[_0x5e42('0x41')]['toLowerCase']());if(_0x33146b===_0x5e42('0x59')){_0x2b39e0=_[_0x5e42('0x5a')](_0x2b39e0,_0xe0b3cc[_0x5e42('0x5b')]);}else{if(_[_0x5e42('0x5c')](_0x33146b,_0x5e42('0x5d')))_0x33146b=_0x33146b[_0x5e42('0x5e')](_0x5e42('0x5d'),_0x5e42('0x5f'));_0xe0b3cc['ids'][_0x5e42('0x4e')](function(_0x450173){_0x45ef58[_0x5e42('0x60')](getAgents(_0x33146b,_0x450173));});}});return BPromise['all'](_0x45ef58)[_0x5e42('0x29')](function(_0x251959){_0x2b39e0=_[_0x5e42('0x5a')](_0x2b39e0,_['flatten'](_0x251959));_0x272a95(_0x2b39e0);})[_0x5e42('0x57')](function(_0x5866a1){_0x3c4400(_0x5866a1);});});}function getAgents(_0x486f54,_0x515e4b){return new BPromise(function(_0x178acb,_0x1d7343){return db[_0x486f54]['findOne']({'where':{'id':_0x515e4b}})[_0x5e42('0x29')](function(_0x2507fe){return _0x2507fe[_0x5e42('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x570da2){var _0x25cab1=_[_0x5e42('0x62')](_0x570da2,'id');_0x178acb(_0x25cab1);});})[_0x5e42('0x57')](function(_0xad3c0f){_0x1d7343(_0xad3c0f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7b913e1..98ed683 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 _0x7404=['events','../../mysqldb','UserNotification','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7404,0xab));var _0x4740=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7404[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x4740('0x0'));var UserNotification=require(_0x4740('0x1'))['db'][_0x4740('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4740('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4740('0x4')};function emitEvent(_0x2ba468){return function(_0x2d2ad8,_0x506491,_0x4a5c81){UserNotificationEvents[_0x4740('0x5')](_0x2ba468+':'+_0x2d2ad8['id'],_0x2d2ad8);UserNotificationEvents['emit'](_0x2ba468,_0x2d2ad8);_0x4a5c81(null);};}for(var e in events){if(events[_0x4740('0x6')](e)){var event=events[e];UserNotification[_0x4740('0x7')](e,emitEvent(event));}}module[_0x4740('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x2751=['remove','emit','UserNotification','setMaxListeners','update'];(function(_0x30f68d,_0x12cb44){var _0x4ac6bf=function(_0x15da9c){while(--_0x15da9c){_0x30f68d['push'](_0x30f68d['shift']());}};_0x4ac6bf(++_0x12cb44);}(_0x2751,0xb6));var _0x1275=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2751[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x1275('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1275('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1275('0x2'),'afterDestroy':_0x1275('0x3')};function emitEvent(_0x17d747){return function(_0x32b5f1,_0x20227e,_0xbe37d2){UserNotificationEvents[_0x1275('0x4')](_0x17d747+':'+_0x32b5f1['id'],_0x32b5f1);UserNotificationEvents[_0x1275('0x4')](_0x17d747,_0x32b5f1);_0xbe37d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 50c47a1..810ece7 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 _0x0b3a=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x3e438f,_0x4439e7){var _0x35f7ff=function(_0x5c643a){while(--_0x5c643a){_0x3e438f['push'](_0x3e438f['shift']());}};_0x35f7ff(++_0x4439e7);}(_0x0b3a,0x114));var _0xa0b3=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x0b3a[_0x178668];return _0x26107d;};'use strict';var _=require(_0xa0b3('0x0'));var util=require('util');var logger=require(_0xa0b3('0x1'))(_0xa0b3('0x2'));var moment=require(_0xa0b3('0x3'));var BPromise=require(_0xa0b3('0x4'));var rp=require(_0xa0b3('0x5'));var fs=require('fs');var path=require(_0xa0b3('0x6'));var rimraf=require(_0xa0b3('0x7'));var config=require(_0xa0b3('0x8'));var attributes=require(_0xa0b3('0x9'));module[_0xa0b3('0xa')]=function(_0x4ba3fc,_0x138883){return _0x4ba3fc[_0xa0b3('0xb')]('UserNotification',attributes,{'tableName':_0xa0b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0b3('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4fa1=['userNotifications','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./userNotification.attributes','define','UserNotification'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x4fa1,0xb1));var _0x14fa=function(_0x1febca,_0x52926d){_0x1febca=_0x1febca-0x0;var _0x10d120=_0x4fa1[_0x1febca];return _0x10d120;};'use strict';var _=require(_0x14fa('0x0'));var util=require(_0x14fa('0x1'));var logger=require(_0x14fa('0x2'))(_0x14fa('0x3'));var moment=require('moment');var BPromise=require(_0x14fa('0x4'));var rp=require(_0x14fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14fa('0x6'));var config=require('../../config/environment');var attributes=require(_0x14fa('0x7'));module['exports']=function(_0x3b1ce4,_0x36608a){return _0x3b1ce4[_0x14fa('0x8')](_0x14fa('0x9'),attributes,{'tableName':_0x14fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 483d07a..a9a2417 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 _0x7902=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment'];(function(_0x2cc891,_0x4808ce){var _0x31b65a=function(_0x5c4452){while(--_0x5c4452){_0x2cc891['push'](_0x2cc891['shift']());}};_0x31b65a(++_0x4808ce);}(_0x7902,0x1ae));var _0x2790=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x7902[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x2790('0x0'));var util=require('util');var moment=require(_0x2790('0x1'));var BPromise=require('bluebird');var rs=require(_0x2790('0x2'));var fs=require('fs');var Redis=require(_0x2790('0x3'));var db=require(_0x2790('0x4'))['db'];var utils=require(_0x2790('0x5'));var logger=require(_0x2790('0x6'))(_0x2790('0x7'));var config=require(_0x2790('0x8'));var jayson=require(_0x2790('0x9'));var client=jayson[_0x2790('0xa')]['http']({'port':0x232a});config[_0x2790('0xb')]=_[_0x2790('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2790('0xd'))(new Redis(config['redis']));require(_0x2790('0xe'))[_0x2790('0xf')](socket);function respondWithRpcPromise(_0x58b399,_0x111f5b,_0x5120fc){return new BPromise(function(_0x325f0b,_0x5b9d85){return client[_0x2790('0x10')](_0x58b399,_0x5120fc)[_0x2790('0x11')](function(_0x1e5415){logger['info'](_0x2790('0x12'),_0x111f5b,_0x2790('0x13'));logger['debug'](_0x2790('0x14'),_0x111f5b,'request\x20sent',JSON[_0x2790('0x15')](_0x1e5415));if(_0x1e5415[_0x2790('0x16')]){if(_0x1e5415[_0x2790('0x16')]['code']===0x1f4){logger[_0x2790('0x16')](_0x2790('0x12'),_0x111f5b,_0x1e5415[_0x2790('0x16')]['message']);return _0x5b9d85(_0x1e5415[_0x2790('0x16')][_0x2790('0x17')]);}logger[_0x2790('0x16')]('UserNotification,\x20%s,\x20%s',_0x111f5b,_0x1e5415[_0x2790('0x16')]['message']);return _0x325f0b(_0x1e5415[_0x2790('0x16')][_0x2790('0x17')]);}else{logger[_0x2790('0x18')]('UserNotification,\x20%s,\x20%s',_0x111f5b,_0x2790('0x13'));_0x325f0b(_0x1e5415[_0x2790('0x19')][_0x2790('0x17')]);}})[_0x2790('0x1a')](function(_0x1461ae){logger['error']('UserNotification,\x20%s,\x20%s',_0x111f5b,_0x1461ae);_0x5b9d85(_0x1461ae);});});} \ No newline at end of file +var _0x6804=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1ccdf4,_0x3fb494){var _0x448045=function(_0x4b722f){while(--_0x4b722f){_0x1ccdf4['push'](_0x1ccdf4['shift']());}};_0x448045(++_0x3fb494);}(_0x6804,0x192));var _0x4680=function(_0x34256d,_0x21ed7e){_0x34256d=_0x34256d-0x0;var _0x4a85c8=_0x6804[_0x34256d];return _0x4a85c8;};'use strict';var _=require(_0x4680('0x0'));var util=require(_0x4680('0x1'));var moment=require('moment');var BPromise=require(_0x4680('0x2'));var rs=require(_0x4680('0x3'));var fs=require('fs');var Redis=require(_0x4680('0x4'));var db=require(_0x4680('0x5'))['db'];var utils=require(_0x4680('0x6'));var logger=require(_0x4680('0x7'))(_0x4680('0x8'));var config=require(_0x4680('0x9'));var jayson=require(_0x4680('0xa'));var client=jayson[_0x4680('0xb')][_0x4680('0xc')]({'port':0x232a});config[_0x4680('0xd')]=_[_0x4680('0xe')](config[_0x4680('0xd')],{'host':_0x4680('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4680('0xd')]));require(_0x4680('0x10'))[_0x4680('0x11')](socket);function respondWithRpcPromise(_0x4fc1d8,_0x5750d0,_0x253989){return new BPromise(function(_0x361df1,_0x45387d){return client[_0x4680('0x12')](_0x4fc1d8,_0x253989)[_0x4680('0x13')](function(_0x5397e1){logger[_0x4680('0x14')](_0x4680('0x15'),_0x5750d0,_0x4680('0x16'));logger[_0x4680('0x17')](_0x4680('0x18'),_0x5750d0,_0x4680('0x16'),JSON[_0x4680('0x19')](_0x5397e1));if(_0x5397e1[_0x4680('0x1a')]){if(_0x5397e1[_0x4680('0x1a')][_0x4680('0x1b')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x5750d0,_0x5397e1[_0x4680('0x1a')][_0x4680('0x1c')]);return _0x45387d(_0x5397e1['error'][_0x4680('0x1c')]);}logger[_0x4680('0x1a')]('UserNotification,\x20%s,\x20%s',_0x5750d0,_0x5397e1[_0x4680('0x1a')][_0x4680('0x1c')]);return _0x361df1(_0x5397e1['error'][_0x4680('0x1c')]);}else{logger[_0x4680('0x14')]('UserNotification,\x20%s,\x20%s',_0x5750d0,'request\x20sent');_0x361df1(_0x5397e1[_0x4680('0x1d')][_0x4680('0x1c')]);}})[_0x4680('0x1e')](function(_0x47810e){logger[_0x4680('0x1a')](_0x4680('0x15'),_0x5750d0,_0x47810e);_0x45387d(_0x47810e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 4f69789..59c1c8c 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 _0xa76e=['register','length','userNotification:','./userNotification.events','remove','update','emit','removeListener'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa76e,0x83));var _0xea76=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa76e[_0x4b055c];return _0x4b62bb;};'use strict';var UserNotificationEvents=require(_0xea76('0x0'));var events=['save',_0xea76('0x1'),_0xea76('0x2')];function createListener(_0x89ab3c,_0x8ae763){return function(_0x17b41d){_0x8ae763[_0xea76('0x3')](_0x89ab3c,_0x17b41d);};}function removeListener(_0x2b3fca,_0xcea919){return function(){UserNotificationEvents[_0xea76('0x4')](_0x2b3fca,_0xcea919);};}exports[_0xea76('0x5')]=function(_0x4d7cec){for(var _0x286299=0x0,_0x505a42=events[_0xea76('0x6')];_0x286299<_0x505a42;_0x286299++){var _0x218477=events[_0x286299];var _0xb873a5=createListener(_0xea76('0x7')+_0x218477,_0x4d7cec);UserNotificationEvents['on'](_0x218477,_0xb873a5);}}; \ No newline at end of file +var _0x0978=['removeListener','register','userNotification:','./userNotification.events','save','remove','update'];(function(_0x2ae78f,_0x599052){var _0x28674c=function(_0x42d5b4){while(--_0x42d5b4){_0x2ae78f['push'](_0x2ae78f['shift']());}};_0x28674c(++_0x599052);}(_0x0978,0x1a7));var _0x8097=function(_0x420acf,_0x5adfdf){_0x420acf=_0x420acf-0x0;var _0x6e3f56=_0x0978[_0x420acf];return _0x6e3f56;};'use strict';var UserNotificationEvents=require(_0x8097('0x0'));var events=[_0x8097('0x1'),_0x8097('0x2'),_0x8097('0x3')];function createListener(_0x20d1b7,_0x1c2c56){return function(_0x10fe1b){_0x1c2c56['emit'](_0x20d1b7,_0x10fe1b);};}function removeListener(_0xdeb247,_0x31f69f){return function(){UserNotificationEvents[_0x8097('0x4')](_0xdeb247,_0x31f69f);};}exports[_0x8097('0x5')]=function(_0x24a610){for(var _0x1fd69f=0x0,_0x553596=events['length'];_0x1fd69f<_0x553596;_0x1fd69f++){var _0xdf6779=events[_0x1fd69f];var _0x357b88=createListener(_0x8097('0x6')+_0xdf6779,_0x24a610);UserNotificationEvents['on'](_0xdf6779,_0x357b88);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fcff8d4..4608981 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ec119,_0x5e20f7){var _0x1f45a9=function(_0x247f80){while(--_0x247f80){_0x4ec119['push'](_0x4ec119['shift']());}};_0x1f45a9(++_0x5e20f7);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1c4f4a,_0x1b254c){var _0x1e6a1b=function(_0x169c0b){while(--_0x169c0b){_0x1c4f4a['push'](_0x1c4f4a['shift']());}};_0x1e6a1b(++_0x1b254c);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d5312be..d74b8ba 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 _0x63eb=['sequelize','exports','INTEGER'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x63eb,0x195));var _0xb63e=function(_0x47bb33,_0x210576){_0x47bb33=_0x47bb33-0x0;var _0x5e37df=_0x63eb[_0x47bb33];return _0x5e37df;};'use strict';var Sequelize=require(_0xb63e('0x0'));module[_0xb63e('0x1')]={'penalty':{'type':Sequelize[_0xb63e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe86b=['INTEGER','sequelize','exports'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xe86b,0x1c9));var _0xbe86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe86b[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xbe86('0x0'));module[_0xbe86('0x1')]={'penalty':{'type':Sequelize[_0xbe86('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f3adea8..eac53bf 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 _0x32db=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2af6ef,_0x3af560){var _0x2429b1=function(_0x4deca7){while(--_0x4deca7){_0x2af6ef['push'](_0x2af6ef['shift']());}};_0x2429b1(++_0x3af560);}(_0x32db,0xe3));var _0xb32d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32db[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb32d('0x0'));var util=require('util');var logger=require(_0xb32d('0x1'))(_0xb32d('0x2'));var moment=require(_0xb32d('0x3'));var BPromise=require(_0xb32d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb32d('0x5'));var rimraf=require(_0xb32d('0x6'));var config=require(_0xb32d('0x7'));var attributes=require(_0xb32d('0x8'));module[_0xb32d('0x9')]=function(_0x3046f4,_0x11b546){return _0x3046f4[_0xb32d('0xa')](_0xb32d('0xb'),attributes,{'tableName':_0xb32d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ce=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x32ce,0x81));var _0xe32c=function(_0x542941,_0x2143e2){_0x542941=_0x542941-0x0;var _0xfdf71c=_0x32ce[_0x542941];return _0xfdf71c;};'use strict';var _=require(_0xe32c('0x0'));var util=require(_0xe32c('0x1'));var logger=require(_0xe32c('0x2'))(_0xe32c('0x3'));var moment=require('moment');var BPromise=require(_0xe32c('0x4'));var rp=require(_0xe32c('0x5'));var fs=require('fs');var path=require(_0xe32c('0x6'));var rimraf=require(_0xe32c('0x7'));var config=require('../../config/environment');var attributes=require(_0xe32c('0x8'));module[_0xe32c('0x9')]=function(_0x541dfc,_0x123562){return _0x541dfc[_0xe32c('0xa')](_0xe32c('0xb'),attributes,{'tableName':_0xe32c('0xc'),'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 caa208f..e5e503f 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 _0x8744=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x52ca81,_0x70c883){var _0x4ca8fb=function(_0x440889){while(--_0x440889){_0x52ca81['push'](_0x52ca81['shift']());}};_0x4ca8fb(++_0x70c883);}(_0x8744,0x10b));var _0x4874=function(_0x4066c7,_0x4bf181){_0x4066c7=_0x4066c7-0x0;var _0x11b4f9=_0x8744[_0x4066c7];return _0x11b4f9;};'use strict';var _=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var moment=require('moment');var BPromise=require(_0x4874('0x2'));var rs=require(_0x4874('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4874('0x4'))['db'];var utils=require(_0x4874('0x5'));var logger=require(_0x4874('0x6'))(_0x4874('0x7'));var config=require(_0x4874('0x8'));var jayson=require(_0x4874('0x9'));var client=jayson['client'][_0x4874('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54690a,_0x1fd0b1,_0x3a1b51){return new BPromise(function(_0x1f14b0,_0x7b1e32){return client['request'](_0x54690a,_0x3a1b51)[_0x4874('0xb')](function(_0x403e6){logger['info'](_0x4874('0xc'),_0x1fd0b1,'request\x20sent');logger[_0x4874('0xd')](_0x4874('0xe'),_0x1fd0b1,_0x4874('0xf'),JSON[_0x4874('0x10')](_0x403e6));if(_0x403e6['error']){if(_0x403e6[_0x4874('0x11')]['code']===0x1f4){logger[_0x4874('0x11')](_0x4874('0xc'),_0x1fd0b1,_0x403e6[_0x4874('0x11')]['message']);return _0x7b1e32(_0x403e6[_0x4874('0x11')][_0x4874('0x12')]);}logger[_0x4874('0x11')](_0x4874('0xc'),_0x1fd0b1,_0x403e6[_0x4874('0x11')][_0x4874('0x12')]);return _0x1f14b0(_0x403e6[_0x4874('0x11')][_0x4874('0x12')]);}else{logger[_0x4874('0x13')](_0x4874('0xc'),_0x1fd0b1,_0x4874('0xf'));_0x1f14b0(_0x403e6[_0x4874('0x14')][_0x4874('0x12')]);}})[_0x4874('0x15')](function(_0x3a8244){logger['error'](_0x4874('0xc'),_0x1fd0b1,_0x3a8244);_0x7b1e32(_0x3a8244);});});} \ No newline at end of file +var _0x3ccd=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x27536b,_0x4ba663){var _0x4f9506=function(_0x3031bc){while(--_0x3031bc){_0x27536b['push'](_0x27536b['shift']());}};_0x4f9506(++_0x4ba663);}(_0x3ccd,0x1cc));var _0xd3cc=function(_0x502f2d,_0x2b02c9){_0x502f2d=_0x502f2d-0x0;var _0x49dc26=_0x3ccd[_0x502f2d];return _0x49dc26;};'use strict';var _=require(_0xd3cc('0x0'));var util=require(_0xd3cc('0x1'));var moment=require(_0xd3cc('0x2'));var BPromise=require(_0xd3cc('0x3'));var rs=require(_0xd3cc('0x4'));var fs=require('fs');var Redis=require(_0xd3cc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd3cc('0x6'))(_0xd3cc('0x7'));var config=require(_0xd3cc('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5997cf,_0x35d642,_0x22b454){return new BPromise(function(_0x4ebe8d,_0x520670){return client[_0xd3cc('0x9')](_0x5997cf,_0x22b454)[_0xd3cc('0xa')](function(_0x585818){logger[_0xd3cc('0xb')](_0xd3cc('0xc'),_0x35d642,'request\x20sent');logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x35d642,_0xd3cc('0xd'),JSON[_0xd3cc('0xe')](_0x585818));if(_0x585818[_0xd3cc('0xf')]){if(_0x585818[_0xd3cc('0xf')][_0xd3cc('0x10')]===0x1f4){logger[_0xd3cc('0xf')](_0xd3cc('0xc'),_0x35d642,_0x585818['error'][_0xd3cc('0x11')]);return _0x520670(_0x585818[_0xd3cc('0xf')][_0xd3cc('0x11')]);}logger[_0xd3cc('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x35d642,_0x585818[_0xd3cc('0xf')]['message']);return _0x4ebe8d(_0x585818[_0xd3cc('0xf')][_0xd3cc('0x11')]);}else{logger[_0xd3cc('0xb')](_0xd3cc('0xc'),_0x35d642,_0xd3cc('0xd'));_0x4ebe8d(_0x585818[_0xd3cc('0x12')][_0xd3cc('0x11')]);}})[_0xd3cc('0x13')](function(_0xf01bbc){logger[_0xd3cc('0xf')](_0xd3cc('0xc'),_0x35d642,_0xf01bbc);_0x520670(_0xf01bbc);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7bdb110..8f16561 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 _0x783f=['index','/describe','describe','/:id','show','getSections','post','/:id/clone','clone','/:id/sections','addSections','/:id/resources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated'];(function(_0x414826,_0xd9f46a){var _0xa0c969=function(_0x1ec688){while(--_0x1ec688){_0x414826['push'](_0x414826['shift']());}};_0xa0c969(++_0xd9f46a);}(_0x783f,0x16e));var _0xf783=function(_0x317104,_0x4c0b6a){_0x317104=_0x317104-0x0;var _0x15d0ed=_0x783f[_0x317104];return _0x15d0ed;};'use strict';var multer=require('multer');var util=require(_0xf783('0x0'));var path=require(_0xf783('0x1'));var timeout=require(_0xf783('0x2'));var express=require(_0xf783('0x3'));var router=express[_0xf783('0x4')]();var fs_extra=require(_0xf783('0x5'));var auth=require(_0xf783('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf783('0x7'));var controller=require(_0xf783('0x8'));router[_0xf783('0x9')]('/',auth[_0xf783('0xa')](),controller[_0xf783('0xb')]);router['get'](_0xf783('0xc'),auth['isAuthenticated'](),controller[_0xf783('0xd')]);router['get'](_0xf783('0xe'),auth[_0xf783('0xa')](),controller[_0xf783('0xf')]);router[_0xf783('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0xf783('0x10')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0xf783('0xa')](),controller['create']);router[_0xf783('0x11')](_0xf783('0x12'),auth[_0xf783('0xa')](),controller[_0xf783('0x13')]);router[_0xf783('0x11')](_0xf783('0x14'),auth[_0xf783('0xa')](),controller[_0xf783('0x15')]);router[_0xf783('0x11')](_0xf783('0x16'),auth['isAuthenticated'](),controller['addResources']);router[_0xf783('0x17')]('/:id',auth[_0xf783('0xa')](),controller[_0xf783('0x18')]);router[_0xf783('0x19')](_0xf783('0xe'),auth[_0xf783('0xa')](),controller['destroy']);router[_0xf783('0x19')]('/:id/sections',auth[_0xf783('0xa')](),controller[_0xf783('0x1a')]);router[_0xf783('0x19')]('/:id/resources',auth['isAuthenticated'](),controller[_0xf783('0x1b')]);module[_0xf783('0x1c')]=router; \ No newline at end of file +var _0xfc7f=['fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','show','getSections','/:id/resources','getResources','post','/:id/clone','/:id/sections','addSections','addResources','/:id','update','delete','removeSections','removeResources','exports','util','express'];(function(_0x539fa4,_0x1ff26b){var _0x448794=function(_0xea52fa){while(--_0xea52fa){_0x539fa4['push'](_0x539fa4['shift']());}};_0x448794(++_0x1ff26b);}(_0xfc7f,0xf8));var _0xffc7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc7f[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xffc7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xffc7('0x1'));var router=express['Router']();var fs_extra=require(_0xffc7('0x2'));var auth=require(_0xffc7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xffc7('0x4'));var controller=require(_0xffc7('0x5'));router[_0xffc7('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xffc7('0x6')](_0xffc7('0x7'),auth[_0xffc7('0x8')](),controller[_0xffc7('0x9')]);router[_0xffc7('0x6')]('/:id',auth[_0xffc7('0x8')](),controller[_0xffc7('0xa')]);router[_0xffc7('0x6')]('/:id/sections',auth[_0xffc7('0x8')](),controller[_0xffc7('0xb')]);router[_0xffc7('0x6')](_0xffc7('0xc'),auth['isAuthenticated'](),controller[_0xffc7('0xd')]);router[_0xffc7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xffc7('0xf'),auth[_0xffc7('0x8')](),controller['clone']);router[_0xffc7('0xe')](_0xffc7('0x10'),auth['isAuthenticated'](),controller[_0xffc7('0x11')]);router[_0xffc7('0xe')]('/:id/resources',auth['isAuthenticated'](),controller[_0xffc7('0x12')]);router['put'](_0xffc7('0x13'),auth[_0xffc7('0x8')](),controller[_0xffc7('0x14')]);router[_0xffc7('0x15')](_0xffc7('0x13'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0xffc7('0x16')]);router[_0xffc7('0x15')](_0xffc7('0xc'),auth[_0xffc7('0x8')](),controller[_0xffc7('0x17')]);module[_0xffc7('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9409a77..4c02cf2 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 _0xd21a=['STRING','name','setDataValue','crudPermissions','getDataValue','BOOLEAN','exports'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0xd21a,0x1e2));var _0xad21=function(_0x5ab11e,_0x5928cf){_0x5ab11e=_0x5ab11e-0x0;var _0xccc333=_0xd21a[_0x5ab11e];return _0xccc333;};'use strict';var Sequelize=require('sequelize');module[_0xad21('0x0')]={'name':{'type':Sequelize[_0xad21('0x1')],'allowNull':![],'unique':_0xad21('0x2')},'crudPermissions':{'type':Sequelize[_0xad21('0x1')],'set':function(_0x2c2d00){this[_0xad21('0x3')](_0xad21('0x4'),_0x2c2d00?_0x2c2d00['join'](''):[]);},'get':function(){return this[_0xad21('0x5')]('crudPermissions')?this[_0xad21('0x5')](_0xad21('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xad21('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xad21('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xad21('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9be0=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x43d55b,_0x114d79){var _0x5e55c3=function(_0x1544b9){while(--_0x1544b9){_0x43d55b['push'](_0x43d55b['shift']());}};_0x5e55c3(++_0x114d79);}(_0x9be0,0x16d));var _0x09be=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9be0[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x09be('0x0'));module[_0x09be('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x09be('0x2')],'set':function(_0x4f9b00){this[_0x09be('0x3')](_0x09be('0x4'),_0x4f9b00?_0x4f9b00[_0x09be('0x5')](''):[]);},'get':function(){return this[_0x09be('0x6')]('crudPermissions')?this[_0x09be('0x6')](_0x09be('0x4'))[_0x09be('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x09be('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x09be('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x09be('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x09be('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x09be('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x09be('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 76a713e..dcb21f2 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 _0xee2c=['subsections','findOne','forEach','push','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','UserProfile','includeAll','findAll','catch','show','params','include','options','find','create','body','clone','get','omit','createdAt','crudPermissions','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','Resources','removeSections','ids','getSections','includes','isEmpty','enabled'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xee2c,0x1c7));var _0xcee2=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xee2c[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0xcee2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcee2('0x1'));var jsonpatch=require(_0xcee2('0x2'));var rp=require(_0xcee2('0x3'));var moment=require(_0xcee2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcee2('0x5'));var path=require(_0xcee2('0x6'));var sox=require('sox');var csv=require(_0xcee2('0x7'));var ejs=require(_0xcee2('0x8'));var fs=require('fs');var fs_extra=require(_0xcee2('0x9'));var _=require(_0xcee2('0xa'));var squel=require(_0xcee2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcee2('0xc'));var toCsv=require(_0xcee2('0x7'));var querystring=require(_0xcee2('0xd'));var Papa=require(_0xcee2('0xe'));var Redis=require(_0xcee2('0xf'));var authService=require(_0xcee2('0x10'));var qs=require(_0xcee2('0x11'));var as=require(_0xcee2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcee2('0x13'))(_0xcee2('0x14'));var utils=require(_0xcee2('0x15'));var config=require(_0xcee2('0x16'));var licenseUtil=require(_0xcee2('0x17'));var db=require('../../mysqldb')['db'];config[_0xcee2('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcee2('0x19'))(new Redis(config[_0xcee2('0x18')]));require(_0xcee2('0x1a'))[_0xcee2('0x1b')](socket);function respondWithStatusCode(_0x54a718,_0x1cf4bb){_0x1cf4bb=_0x1cf4bb||0xcc;return function(_0x818e13){if(_0x818e13){return _0x54a718[_0xcee2('0x1c')](_0x1cf4bb);}return _0x54a718[_0xcee2('0x1d')](_0x1cf4bb)[_0xcee2('0x1e')]();};}function respondWithResult(_0x21a182,_0x25bdcf){_0x25bdcf=_0x25bdcf||0xc8;return function(_0x106c5e){if(_0x106c5e){return _0x21a182[_0xcee2('0x1d')](_0x25bdcf)['json'](_0x106c5e);}};}function respondWithFilteredResult(_0x170586,_0x548e47){return function(_0x221d75){if(_0x221d75){var _0xeae302=typeof _0x548e47[_0xcee2('0x1f')]===_0xcee2('0x20')&&typeof _0x548e47['limit']===_0xcee2('0x20');var _0x317659=_0x221d75[_0xcee2('0x21')];var _0x36af7f=_0xeae302?0x0:_0x548e47[_0xcee2('0x1f')];var _0x223f98=_0xeae302?_0x221d75[_0xcee2('0x21')]:_0x548e47[_0xcee2('0x1f')]+_0x548e47[_0xcee2('0x22')];var _0x148023;if(_0x223f98>=_0x317659){_0x223f98=_0x317659;_0x148023=0xc8;}else{_0x148023=0xce;}_0x170586[_0xcee2('0x1d')](_0x148023);return _0x170586['set'](_0xcee2('0x23'),_0x36af7f+'-'+_0x223f98+'/'+_0x317659)[_0xcee2('0x24')](_0x221d75);}return null;};}function patchUpdates(_0x4fdb88){return function(_0x526ab1){try{jsonpatch[_0xcee2('0x25')](_0x526ab1,_0x4fdb88,!![]);}catch(_0x4fa083){return BPromise[_0xcee2('0x26')](_0x4fa083);}return _0x526ab1[_0xcee2('0x27')]();};}function saveUpdates(_0x2edef5,_0x53bd9f){return function(_0x49b1a8){if(_0x49b1a8){return _0x49b1a8[_0xcee2('0x28')](_0x2edef5)[_0xcee2('0x29')](function(_0x22789d){return _0x22789d;});}return null;};}function removeEntity(_0x5905f6,_0x2f18ec){return function(_0x538c04){if(_0x538c04){return _0x538c04[_0xcee2('0x2a')]()[_0xcee2('0x29')](function(){_0x5905f6[_0xcee2('0x1d')](0xcc)[_0xcee2('0x1e')]();});}};}function handleEntityNotFound(_0x84d7c,_0x31618c){return function(_0xbc2b2e){if(!_0xbc2b2e){_0x84d7c[_0xcee2('0x1c')](0x194);}return _0xbc2b2e;};}function handleError(_0x262954,_0x104e18){_0x104e18=_0x104e18||0x1f4;return function(_0x3705a0){logger['error'](_0x3705a0[_0xcee2('0x2b')]);if(_0x3705a0[_0xcee2('0x2c')]){delete _0x3705a0[_0xcee2('0x2c')];}_0x262954['status'](_0x104e18)[_0xcee2('0x2d')](_0x3705a0);};}exports[_0xcee2('0x2e')]=function(_0x559816,_0x1e0dfc){var _0x25ead9={},_0x56e23b={},_0x5ee5a5={'count':0x0,'rows':[]};var _0x1efa5b=_['map'](db['UserProfile'][_0xcee2('0x2f')],function(_0x14ccc3){return{'name':_0x14ccc3['fieldName'],'type':_0x14ccc3[_0xcee2('0x30')][_0xcee2('0x31')]};});_0x56e23b[_0xcee2('0x32')]=_[_0xcee2('0x33')](_0x1efa5b,_0xcee2('0x2c'));_0x56e23b[_0xcee2('0x34')]=_[_0xcee2('0x35')](_0x559816[_0xcee2('0x34')]);_0x56e23b[_0xcee2('0x36')]=_[_0xcee2('0x37')](_0x56e23b[_0xcee2('0x32')],_0x56e23b[_0xcee2('0x34')]);_0x25ead9['attributes']=_[_0xcee2('0x37')](_0x56e23b[_0xcee2('0x32')],qs['fields'](_0x559816[_0xcee2('0x34')][_0xcee2('0x38')]));_0x25ead9['attributes']=_0x25ead9[_0xcee2('0x39')][_0xcee2('0x3a')]?_0x25ead9[_0xcee2('0x39')]:_0x56e23b['model'];if(!_0x559816[_0xcee2('0x34')][_0xcee2('0x3b')](_0xcee2('0x3c'))){_0x25ead9[_0xcee2('0x22')]=qs[_0xcee2('0x22')](_0x559816[_0xcee2('0x34')]['limit']);_0x25ead9[_0xcee2('0x1f')]=qs[_0xcee2('0x1f')](_0x559816[_0xcee2('0x34')]['offset']);}_0x25ead9[_0xcee2('0x3d')]=qs['sort'](_0x559816['query'][_0xcee2('0x3e')]);_0x25ead9[_0xcee2('0x3f')]=qs[_0xcee2('0x36')](_[_0xcee2('0x40')](_0x559816[_0xcee2('0x34')],_0x56e23b[_0xcee2('0x36')]),_0x1efa5b);if(_0x559816['query']['filter']){_0x25ead9['where']=_[_0xcee2('0x41')](_0x25ead9['where'],{'$or':_[_0xcee2('0x33')](_0x1efa5b,function(_0x157220){if(_0x157220['type']!==_0xcee2('0x42')){var _0x595caa={};_0x595caa[_0x157220['name']]={'$like':'%'+_0x559816[_0xcee2('0x34')][_0xcee2('0x43')]+'%'};return _0x595caa;}})});}_0x25ead9=_['merge']({},_0x25ead9,_0x559816['options']);var _0x208139={'where':_0x25ead9[_0xcee2('0x3f')]};return db[_0xcee2('0x44')][_0xcee2('0x21')](_0x208139)[_0xcee2('0x29')](function(_0x28bb5b){_0x5ee5a5[_0xcee2('0x21')]=_0x28bb5b;if(_0x559816[_0xcee2('0x34')][_0xcee2('0x45')]){_0x25ead9['include']=[{'all':!![]}];}return db[_0xcee2('0x44')][_0xcee2('0x46')](_0x25ead9);})[_0xcee2('0x29')](function(_0x3f1546){_0x5ee5a5['rows']=_0x3f1546;return _0x5ee5a5;})[_0xcee2('0x29')](respondWithFilteredResult(_0x1e0dfc,_0x25ead9))[_0xcee2('0x47')](handleError(_0x1e0dfc,null));};exports[_0xcee2('0x48')]=function(_0x27bb11,_0x8746a6){var _0x16b4c2={'raw':![],'where':{'id':_0x27bb11[_0xcee2('0x49')]['id']}},_0x337bba={};_0x337bba[_0xcee2('0x32')]=_['keys'](db[_0xcee2('0x44')][_0xcee2('0x2f')]);_0x337bba[_0xcee2('0x34')]=_['keys'](_0x27bb11[_0xcee2('0x34')]);_0x337bba[_0xcee2('0x36')]=_[_0xcee2('0x37')](_0x337bba[_0xcee2('0x32')],_0x337bba[_0xcee2('0x34')]);_0x16b4c2[_0xcee2('0x39')]=_[_0xcee2('0x37')](_0x337bba[_0xcee2('0x32')],qs[_0xcee2('0x38')](_0x27bb11[_0xcee2('0x34')][_0xcee2('0x38')]));_0x16b4c2[_0xcee2('0x39')]=_0x16b4c2[_0xcee2('0x39')][_0xcee2('0x3a')]?_0x16b4c2['attributes']:_0x337bba[_0xcee2('0x32')];if(_0x27bb11['query']['includeAll']){_0x16b4c2[_0xcee2('0x4a')]=[{'all':!![]}];}_0x16b4c2=_[_0xcee2('0x41')]({},_0x16b4c2,_0x27bb11[_0xcee2('0x4b')]);return db[_0xcee2('0x44')][_0xcee2('0x4c')](_0x16b4c2)['then'](handleEntityNotFound(_0x8746a6,null))[_0xcee2('0x29')](respondWithResult(_0x8746a6,null))['catch'](handleError(_0x8746a6,null));};exports[_0xcee2('0x4d')]=function(_0x209877,_0x465e9a){return db[_0xcee2('0x44')][_0xcee2('0x4d')](_0x209877[_0xcee2('0x4e')],{})[_0xcee2('0x29')](respondWithResult(_0x465e9a,0xc9))['catch'](handleError(_0x465e9a,null));};exports[_0xcee2('0x4f')]=function(_0x19002c,_0xb533cc){var _0x8a8f4f={'where':{'id':_0x19002c[_0xcee2('0x49')]['id']}},_0x2f4414={};_0x2f4414[_0xcee2('0x32')]=_[_0xcee2('0x35')](db[_0xcee2('0x44')]['rawAttributes']);_0x8a8f4f['attributes']=_[_0xcee2('0x37')](_0x2f4414[_0xcee2('0x32')],qs['fields'](_0x19002c[_0xcee2('0x34')][_0xcee2('0x38')]));_0x8a8f4f[_0xcee2('0x39')]=_0x8a8f4f[_0xcee2('0x39')][_0xcee2('0x3a')]?_0x8a8f4f[_0xcee2('0x39')]:_0x2f4414[_0xcee2('0x32')];if(_0x19002c['query']['includeAll']){_0x8a8f4f['include']=[{'all':!![]}];}_0x8a8f4f=_[_0xcee2('0x41')]({},_0x8a8f4f,_0x19002c[_0xcee2('0x4b')]);return db[_0xcee2('0x44')]['find'](_0x8a8f4f)[_0xcee2('0x29')](handleEntityNotFound(_0xb533cc,null))[_0xcee2('0x29')](function(_0x2f24d2){if(_0x2f24d2){var _0x5d701b=_0x2f24d2[_0xcee2('0x50')]({'plain':!![]});_0x5d701b=qs[_0xcee2('0x51')](_0x5d701b,['id',_0xcee2('0x52'),'updatedAt',_0xcee2('0x53')]);_0x19002c[_0xcee2('0x4e')]=_[_0xcee2('0x51')](_0x19002c[_0xcee2('0x4e')],['id','createdAt','updatedAt']);return db['sequelize'][_0xcee2('0x54')](function(_0x34ee10){return db[_0xcee2('0x44')][_0xcee2('0x4d')](_[_0xcee2('0x41')](_0x5d701b,_0x19002c[_0xcee2('0x4e')]),{'include':_0x19002c[_0xcee2('0x34')][_0xcee2('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x34ee10})[_0xcee2('0x29')](function(_0x30d3cd){var _0x3f4a06=_0x30d3cd['get']({'plain':!![]});return db[_0xcee2('0x55')][_0xcee2('0x46')]({'where':{'userProfileId':_0x19002c[_0xcee2('0x49')]['id']},'raw':!![]})[_0xcee2('0x29')](function(_0x289744){if(_0x289744){return BPromise[_0xcee2('0x56')](_0x289744,function(_0x325f62){return new BPromise(function(_0x1a7425,_0x5aca9b){if(_0x325f62[_0xcee2('0x57')]===null||_0x325f62[_0xcee2('0x57')]===0x1)_0x1a7425(null);return db[_0xcee2('0x58')][_0xcee2('0x46')]({'where':{'sectionId':_0x325f62['id']},'raw':!![]})[_0xcee2('0x29')](function(_0x297e70){var _0x14bb89=_[_0xcee2('0x33')](_0x297e70,function(_0x2b0815){return qs[_0xcee2('0x51')](_0x2b0815,['id','createdAt','updatedAt',_0xcee2('0x59')]);});_0x1a7425(_0x14bb89);})[_0xcee2('0x47')](function(_0xde163f){_0x5aca9b(_0xde163f);});})['then'](function(_0x5089e1){var _0x566d94=qs[_0xcee2('0x51')](_0x325f62,['id','createdAt','updatedAt']);_0x566d94[_0xcee2('0x5a')]=_0x3f4a06['id'];if(_0x5089e1)_0x566d94['Resources']=_0x5089e1;return _0x566d94;})[_0xcee2('0x29')](function(_0x9943ff){return db['UserProfileSection'][_0xcee2('0x4d')](_0x9943ff,{'include':[{'model':db[_0xcee2('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x34ee10});});})['then'](function(){return _0x3f4a06;});}});});});}})[_0xcee2('0x29')](respondWithResult(_0xb533cc,0xc9))[_0xcee2('0x47')](handleError(_0xb533cc,null));};exports[_0xcee2('0x28')]=function(_0x1b07b5,_0x2a4aed){if(_0x1b07b5['body']['id']){delete _0x1b07b5[_0xcee2('0x4e')]['id'];}return db[_0xcee2('0x44')][_0xcee2('0x4c')]({'where':{'id':_0x1b07b5[_0xcee2('0x49')]['id']}})[_0xcee2('0x29')](handleEntityNotFound(_0x2a4aed,null))[_0xcee2('0x29')](saveUpdates(_0x1b07b5[_0xcee2('0x4e')],null))[_0xcee2('0x29')](respondWithResult(_0x2a4aed,null))[_0xcee2('0x47')](handleError(_0x2a4aed,null));};exports[_0xcee2('0x2a')]=function(_0x210709,_0x216020){return db['UserProfile'][_0xcee2('0x4c')]({'where':{'id':_0x210709[_0xcee2('0x49')]['id']}})[_0xcee2('0x29')](handleEntityNotFound(_0x216020,null))['then'](removeEntity(_0x216020,null))['catch'](handleError(_0x216020,null));};exports[_0xcee2('0x5b')]=function(_0x33767d,_0x25930b){return db[_0xcee2('0x44')]['describe']()['then'](respondWithResult(_0x25930b,null))[_0xcee2('0x47')](handleError(_0x25930b,null));};exports[_0xcee2('0x5c')]=function(_0x81f30a,_0x3bdd96){var _0xe75e6e=_0x81f30a['body'];return db['UserProfile'][_0xcee2('0x4c')]({'where':{'id':_0x81f30a[_0xcee2('0x49')]['id']}})[_0xcee2('0x29')](handleEntityNotFound(_0x3bdd96,null))[_0xcee2('0x29')](function(_0x3ba2d0){if(_0x3ba2d0){return db['sequelize'][_0xcee2('0x54')](function(_0x546ad3){return db[_0xcee2('0x55')][_0xcee2('0x2a')]({'where':{'userProfileId':_0x81f30a[_0xcee2('0x49')]['id'],'sectionId':_[_0xcee2('0x33')](_0xe75e6e,function(_0x59d2fe){return _0x59d2fe[_0xcee2('0x59')];})},'transaction':_0x546ad3})['then'](function(){var _0x56cc94=_[_0xcee2('0x33')](_0xe75e6e,function(_0x3d7b5d){_0x3d7b5d[_0xcee2('0x5a')]=_0x81f30a[_0xcee2('0x49')]['id'];return _0x3d7b5d;});var _0x570f10=[];return BPromise[_0xcee2('0x56')](_0x56cc94,function(_0x51599d){return db['UserProfileSection'][_0xcee2('0x4d')](_0x51599d,{'include':[{'model':db[_0xcee2('0x58')],'as':_0xcee2('0x5d')}],'raw':!![],'transaction':_0x546ad3})['then'](function(_0x17cd07){_0x570f10['push'](_0x17cd07[_0xcee2('0x50')]({'plain':!![]}));});})['then'](function(){return _0x570f10;});});});}})[_0xcee2('0x29')](function(_0x527fb7){return _0x527fb7;})[_0xcee2('0x29')](respondWithResult(_0x3bdd96,null))[_0xcee2('0x47')](handleError(_0x3bdd96,null));};exports[_0xcee2('0x5e')]=function(_0x44cd5e,_0x17f5fe){var _0x43bf19;return db[_0xcee2('0x44')][_0xcee2('0x4c')]({'where':{'id':_0x44cd5e[_0xcee2('0x49')]['id']},'attributes':['id',_0xcee2('0x2c')]})[_0xcee2('0x29')](handleEntityNotFound(_0x17f5fe,null))[_0xcee2('0x29')](function(_0x2c6447){if(_0x2c6447){_0x43bf19=_0x2c6447;return db[_0xcee2('0x55')][_0xcee2('0x2a')]({'where':{'userProfileId':_0x44cd5e[_0xcee2('0x49')]['id'],'sectionId':_0x44cd5e[_0xcee2('0x34')][_0xcee2('0x5f')]}});}})[_0xcee2('0x29')](function(){return _0x43bf19;})['then'](respondWithStatusCode(_0x17f5fe,null))[_0xcee2('0x47')](handleError(_0x17f5fe,null));};exports[_0xcee2('0x60')]=function(_0x586b40,_0x1f9f50){var _0x40557b=[];var _0x2a9012=[];return db[_0xcee2('0x55')][_0xcee2('0x46')]({'where':{'userProfileId':_0x586b40[_0xcee2('0x49')]['id']},'raw':!![]})[_0xcee2('0x29')](function(_0x2a919d){_0x40557b=_[_0xcee2('0x43')](_0x2a919d,function(_0x27de44){return _0x27de44['enabled']===0x1||_[_0xcee2('0x61')]([0x3eb,0x709],_0x27de44['sectionId']);});if(!_[_0xcee2('0x62')](_0x40557b)){return _[_0xcee2('0x33')](_0x40557b,function(_0x132436){return _0x132436[_0xcee2('0x59')];});}else{return;}})['then'](function(_0x4f3f5e){if(_0x4f3f5e)_0x2a9012=_0x4f3f5e;if(_[_0xcee2('0x61')](_0x2a9012,0x64)){var _0x536d04=_[_0xcee2('0x4c')](_0x40557b,{'sectionId':0x64});return hasDefaultDashboard(_0x536d04)[_0xcee2('0x29')](function(_0x2d955f){return _[_0xcee2('0x33')](_0x40557b,function(_0x270322){if(_0x270322['sectionId']===0x64){_0x270322['subsections']=_0x2d955f;}return _0x270322;});});}else{return;}})[_0xcee2('0x29')](function(_0x28b004){if(_0x28b004)_0x40557b=_0x28b004;if(_['includes'](_0x2a9012,0x3eb)){var _0x56f9e9=_[_0xcee2('0x4c')](_0x40557b,{'sectionId':0x3eb});return getCustomDashboards(_0x56f9e9)[_0xcee2('0x29')](function(_0x452a2e){return _['map'](_0x40557b,function(_0x58b8b7){if(_0x56f9e9[_0xcee2('0x63')]){if(_0x58b8b7['sectionId']===0x3eb){_0x58b8b7['subsections']=_0x452a2e;}}else{if(_0x58b8b7[_0xcee2('0x59')]===0x64){_0x58b8b7[_0xcee2('0x64')]=_0x452a2e;}}return _0x58b8b7;});});}else{return;}})[_0xcee2('0x29')](function(_0x3b1962){if(_0x3b1962)_0x40557b=_0x3b1962;if(_[_0xcee2('0x61')](_0x2a9012,0x709)){var _0x450951=_[_0xcee2('0x4c')](_0x40557b,{'sectionId':0x709});return getPlugins(_0x450951)[_0xcee2('0x29')](function(_0x3476c5){if(_0x450951[_0xcee2('0x63')]){return _[_0xcee2('0x33')](_0x40557b,function(_0x27f8d7){if(_0x27f8d7[_0xcee2('0x59')]===0x709){_0x27f8d7[_0xcee2('0x64')]=_0x3476c5;}return _0x27f8d7;});}else{var _0x4a4a47={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3476c5};var _0x176697=_[_0xcee2('0x33')](_0x40557b);_0x176697['push'](_0x4a4a47);return _0x176697;}});}else{return;}})[_0xcee2('0x29')](function(_0x203572){if(_0x203572)_0x40557b=_0x203572;return _[_0xcee2('0x43')](_0x40557b,['enabled',0x1]);})['then'](respondWithResult(_0x1f9f50,null))['catch'](handleError(_0x1f9f50,null));};function hasDefaultDashboard(_0x3cd3e4){var _0x2afc1e=[0x65];return new BPromise(function(_0x2d1a5e,_0x10fd3a){try{if(_0x3cd3e4['autoAssociation']){_0x2d1a5e(_0x2afc1e);}else{return db['UserProfileResource'][_0xcee2('0x65')]({'where':{'sectionId':_0x3cd3e4['id']},'raw':!![]})[_0xcee2('0x29')](function(_0x42cd1d){_0x42cd1d?_0x2d1a5e(_0x2afc1e):_0x2d1a5e();});}}catch(_0x255f8a){_0x10fd3a(_0x255f8a);}});}function getCustomDashboards(_0x10c8c4){var _0x56900e=[];return new BPromise(function(_0x12ba93,_0xf3f119){try{if(_0x10c8c4[_0xcee2('0x57')]){return db['Dashboard'][_0xcee2('0x46')]({'raw':!![]})[_0xcee2('0x29')](function(_0x51f8ff){_0x51f8ff[_0xcee2('0x66')](function(_0x4a15c1){_0x56900e[_0xcee2('0x67')](_0x4a15c1['id']+0x1869f);});_0x12ba93(_0x56900e);});}else{return db[_0xcee2('0x58')][_0xcee2('0x46')]({'where':{'sectionId':_0x10c8c4['id']},'raw':!![]})[_0xcee2('0x29')](function(_0xa68060){_0xa68060['forEach'](function(_0x51c204){_0x56900e[_0xcee2('0x67')](_0x51c204[_0xcee2('0x68')]+0x1869f);});_0x12ba93(_0x56900e);});}}catch(_0x544cb8){_0xf3f119(_0x544cb8);}});}function getPlugins(_0x3e3957){var _0x10e5d5=[];return new BPromise(function(_0x1ecbbf,_0x352100){try{if(_0x3e3957[_0xcee2('0x57')]){return db['Plugin'][_0xcee2('0x46')]({'raw':!![]})[_0xcee2('0x29')](function(_0x3163d7){_0x3163d7[_0xcee2('0x66')](function(_0x53742a){_0x10e5d5[_0xcee2('0x67')](_0x53742a['id']+0x15b38);});_0x1ecbbf(_0x10e5d5);});}else{return db[_0xcee2('0x58')][_0xcee2('0x46')]({'where':{'sectionId':_0x3e3957['id']},'raw':!![]})[_0xcee2('0x29')](function(_0xdc2285){_0xdc2285[_0xcee2('0x66')](function(_0xad1457){_0x10e5d5[_0xcee2('0x67')](_0xad1457[_0xcee2('0x68')]+0x15b38);});_0x1ecbbf(_0x10e5d5);});}}catch(_0x1588c5){_0x352100(_0x1588c5);}});}exports[_0xcee2('0x69')]=function(_0x21211a,_0x3ec08b){return db[_0xcee2('0x44')][_0xcee2('0x4c')]({'where':{'id':_0x21211a['params']['id']}})[_0xcee2('0x29')](handleEntityNotFound(_0x3ec08b,null))[_0xcee2('0x29')](function(_0x27d3a9){if(_0x27d3a9){return db['sequelize'][_0xcee2('0x54')](function(_0x75e016){return db['UserProfileSection'][_0xcee2('0x46')]({'where':{'userProfileId':_0x21211a['params']['id']},'attributes':['id'],'raw':!![]})[_0xcee2('0x29')](function(_0x178edd){if(_0x178edd){return db[_0xcee2('0x55')][_0xcee2('0x2a')]({'where':{'userProfileId':_0x21211a[_0xcee2('0x49')]['id'],'id':_[_0xcee2('0x33')](_0x178edd,function(_0x14825c){return _0x14825c['id'];})},'transaction':_0x75e016});}})[_0xcee2('0x29')](function(_0x1db3c3){var _0x467911=_[_0xcee2('0x33')](_0x21211a[_0xcee2('0x4e')],function(_0x25d1f2){_0x25d1f2[_0xcee2('0x5a')]=_0x21211a['params']['id'];return _0x25d1f2;});return db[_0xcee2('0x55')][_0xcee2('0x6a')](_0x467911,{'raw':!![],'transaction':_0x75e016});})['then'](function(_0x210d45){var _0x37d4eb=_[_0xcee2('0x43')](_[_0xcee2('0x33')](_0x210d45,function(_0x3c79e1){return _0x3c79e1[_0xcee2('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x37d4eb){return db[_0xcee2('0x55')][_0xcee2('0x46')]({'where':{'userProfileId':_0x21211a[_0xcee2('0x49')]['id'],'sectionId':_[_0xcee2('0x33')](_0x37d4eb,function(_0x693ba5){return _0x693ba5[_0xcee2('0x59')];})},'attributes':['id',_0xcee2('0x59')],'raw':!![]})['then'](function(_0x2f988a){var _0x497fc7=_['map'](_0x21211a[_0xcee2('0x4e')],function(_0x56d14f){_0x56d14f[_0xcee2('0x5a')]=_0x21211a[_0xcee2('0x49')]['id'];return _0x56d14f;});return db[_0xcee2('0x58')][_0xcee2('0x6a')](_0x497fc7,{'raw':!![],'transaction':_0x75e016});});}})[_0xcee2('0x47')](handleError(_0x3ec08b,null));});}})[_0xcee2('0x29')](function(_0x32997a){var _0x107510=_['map'](_0x32997a,function(_0x681548){return _0x681548[_0xcee2('0x50')]({'plain':!![]});});})[_0xcee2('0x29')](respondWithResult(_0x3ec08b,null))[_0xcee2('0x47')](handleError(_0x3ec08b,null));};exports[_0xcee2('0x6b')]=function(_0xfa818b,_0x4d1d7f,_0x1013cf){return db[_0xcee2('0x44')][_0xcee2('0x4c')]({'where':{'id':_0xfa818b['params']['id']}})[_0xcee2('0x29')](handleEntityNotFound(_0x4d1d7f,null))['then'](function(_0x189502){if(_0x189502){return _0x189502[_0xcee2('0x6b')](_0xfa818b['query'][_0xcee2('0x5f')]);}})['then'](respondWithStatusCode(_0x4d1d7f,null))['catch'](handleError(_0x4d1d7f,null));};exports['getResources']=function(_0x4e461b,_0x241fcf){var _0x54660c={};if(!_0x4e461b[_0xcee2('0x34')][_0xcee2('0x6c')])throw new Error(_0xcee2('0x6d'));if(!_0x4e461b[_0xcee2('0x34')][_0xcee2('0x3b')](_0xcee2('0x3c'))){_0x54660c[_0xcee2('0x22')]=qs[_0xcee2('0x22')](_0x4e461b['query'][_0xcee2('0x22')]);_0x54660c['offset']=qs['offset'](_0x4e461b[_0xcee2('0x34')][_0xcee2('0x1f')]);}return db['UserProfile'][_0xcee2('0x4c')]({'where':{'id':_0x4e461b[_0xcee2('0x49')]['id']}})[_0xcee2('0x29')](function(_0x4fdbd8){if(!_0x4fdbd8)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4e461b['params']['id']);return db[_0xcee2('0x44')][_0xcee2('0x6e')](_0x4e461b);})['then'](respondWithFilteredResult(_0x241fcf,_0x54660c))[_0xcee2('0x47')](handleError(_0x241fcf,null));}; \ No newline at end of file +var _0x6db4=['findAll','rows','catch','show','params','find','create','body','clone','omit','updatedAt','createdAt','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','then','destroy','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include'];(function(_0x1b844a,_0x2c3126){var _0x55883=function(_0xb3928b){while(--_0xb3928b){_0x1b844a['push'](_0x1b844a['shift']());}};_0x55883(++_0x2c3126);}(_0x6db4,0x111));var _0x46db=function(_0x53de2f,_0xfd4891){_0x53de2f=_0x53de2f-0x0;var _0x15a2fb=_0x6db4[_0x53de2f];return _0x15a2fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46db('0x0'));var zipdir=require(_0x46db('0x1'));var jsonpatch=require(_0x46db('0x2'));var rp=require(_0x46db('0x3'));var moment=require(_0x46db('0x4'));var BPromise=require(_0x46db('0x5'));var Mustache=require('mustache');var util=require(_0x46db('0x6'));var path=require(_0x46db('0x7'));var sox=require(_0x46db('0x8'));var csv=require(_0x46db('0x9'));var ejs=require(_0x46db('0xa'));var fs=require('fs');var fs_extra=require(_0x46db('0xb'));var _=require(_0x46db('0xc'));var squel=require('squel');var crypto=require(_0x46db('0xd'));var jsforce=require(_0x46db('0xe'));var deskjs=require(_0x46db('0xf'));var toCsv=require(_0x46db('0x9'));var querystring=require(_0x46db('0x10'));var Papa=require(_0x46db('0x11'));var Redis=require(_0x46db('0x12'));var authService=require(_0x46db('0x13'));var qs=require(_0x46db('0x14'));var as=require(_0x46db('0x15'));var hardwareService=require(_0x46db('0x16'));var logger=require(_0x46db('0x17'))('api');var utils=require(_0x46db('0x18'));var config=require(_0x46db('0x19'));var licenseUtil=require(_0x46db('0x1a'));var db=require(_0x46db('0x1b'))['db'];config[_0x46db('0x1c')]=_[_0x46db('0x1d')](config[_0x46db('0x1c')],{'host':_0x46db('0x1e'),'port':0x18eb});var socket=require(_0x46db('0x1f'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x417caf,_0xed8db9){_0xed8db9=_0xed8db9||0xcc;return function(_0x5c982c){if(_0x5c982c){return _0x417caf[_0x46db('0x20')](_0xed8db9);}return _0x417caf['status'](_0xed8db9)[_0x46db('0x21')]();};}function respondWithResult(_0x5dccf9,_0x12976b){_0x12976b=_0x12976b||0xc8;return function(_0x41a0bc){if(_0x41a0bc){return _0x5dccf9['status'](_0x12976b)[_0x46db('0x22')](_0x41a0bc);}};}function respondWithFilteredResult(_0x1e6b13,_0x422c86){return function(_0x32c5ef){if(_0x32c5ef){var _0x1e24e6=typeof _0x422c86[_0x46db('0x23')]===_0x46db('0x24')&&typeof _0x422c86[_0x46db('0x25')]==='undefined';var _0x27cfcf=_0x32c5ef[_0x46db('0x26')];var _0x1e0beb=_0x1e24e6?0x0:_0x422c86['offset'];var _0x521b93=_0x1e24e6?_0x32c5ef['count']:_0x422c86['offset']+_0x422c86[_0x46db('0x25')];var _0x270f8d;if(_0x521b93>=_0x27cfcf){_0x521b93=_0x27cfcf;_0x270f8d=0xc8;}else{_0x270f8d=0xce;}_0x1e6b13[_0x46db('0x27')](_0x270f8d);return _0x1e6b13['set']('Content-Range',_0x1e0beb+'-'+_0x521b93+'/'+_0x27cfcf)[_0x46db('0x22')](_0x32c5ef);}return null;};}function patchUpdates(_0x3601e4){return function(_0x1156c4){try{jsonpatch[_0x46db('0x28')](_0x1156c4,_0x3601e4,!![]);}catch(_0x443651){return BPromise[_0x46db('0x29')](_0x443651);}return _0x1156c4[_0x46db('0x2a')]();};}function saveUpdates(_0x3a50dd,_0x4708df){return function(_0x7bcdf5){if(_0x7bcdf5){return _0x7bcdf5['update'](_0x3a50dd)[_0x46db('0x2b')](function(_0x149e66){return _0x149e66;});}return null;};}function removeEntity(_0x1e7acc,_0x408b9f){return function(_0x448aff){if(_0x448aff){return _0x448aff[_0x46db('0x2c')]()['then'](function(){_0x1e7acc[_0x46db('0x27')](0xcc)[_0x46db('0x21')]();});}};}function handleEntityNotFound(_0x1a3855,_0x4e9bf5){return function(_0x131d75){if(!_0x131d75){_0x1a3855[_0x46db('0x20')](0x194);}return _0x131d75;};}function handleError(_0x346b0c,_0xb9f5e3){_0xb9f5e3=_0xb9f5e3||0x1f4;return function(_0x367195){logger[_0x46db('0x2d')](_0x367195[_0x46db('0x2e')]);if(_0x367195[_0x46db('0x2f')]){delete _0x367195[_0x46db('0x2f')];}_0x346b0c[_0x46db('0x27')](_0xb9f5e3)['send'](_0x367195);};}exports[_0x46db('0x30')]=function(_0x1d5f86,_0x531ef2){var _0xd92990={},_0xd836d4={},_0x2fd094={'count':0x0,'rows':[]};var _0x401cea=_[_0x46db('0x31')](db[_0x46db('0x32')][_0x46db('0x33')],function(_0x45604c){return{'name':_0x45604c[_0x46db('0x34')],'type':_0x45604c[_0x46db('0x35')][_0x46db('0x36')]};});_0xd836d4[_0x46db('0x37')]=_['map'](_0x401cea,'name');_0xd836d4[_0x46db('0x38')]=_[_0x46db('0x39')](_0x1d5f86[_0x46db('0x38')]);_0xd836d4['filters']=_[_0x46db('0x3a')](_0xd836d4[_0x46db('0x37')],_0xd836d4['query']);_0xd92990[_0x46db('0x3b')]=_[_0x46db('0x3a')](_0xd836d4[_0x46db('0x37')],qs[_0x46db('0x3c')](_0x1d5f86[_0x46db('0x38')]['fields']));_0xd92990['attributes']=_0xd92990[_0x46db('0x3b')][_0x46db('0x3d')]?_0xd92990[_0x46db('0x3b')]:_0xd836d4[_0x46db('0x37')];if(!_0x1d5f86[_0x46db('0x38')]['hasOwnProperty'](_0x46db('0x3e'))){_0xd92990[_0x46db('0x25')]=qs[_0x46db('0x25')](_0x1d5f86['query']['limit']);_0xd92990[_0x46db('0x23')]=qs[_0x46db('0x23')](_0x1d5f86[_0x46db('0x38')][_0x46db('0x23')]);}_0xd92990[_0x46db('0x3f')]=qs[_0x46db('0x40')](_0x1d5f86['query']['sort']);_0xd92990[_0x46db('0x41')]=qs[_0x46db('0x42')](_['pick'](_0x1d5f86[_0x46db('0x38')],_0xd836d4['filters']),_0x401cea);if(_0x1d5f86[_0x46db('0x38')]['filter']){_0xd92990[_0x46db('0x41')]=_[_0x46db('0x43')](_0xd92990[_0x46db('0x41')],{'$or':_[_0x46db('0x31')](_0x401cea,function(_0x4a6894){if(_0x4a6894['type']!=='VIRTUAL'){var _0x208ff5={};_0x208ff5[_0x4a6894[_0x46db('0x2f')]]={'$like':'%'+_0x1d5f86[_0x46db('0x38')][_0x46db('0x44')]+'%'};return _0x208ff5;}})});}_0xd92990=_['merge']({},_0xd92990,_0x1d5f86[_0x46db('0x45')]);var _0x265050={'where':_0xd92990[_0x46db('0x41')]};return db[_0x46db('0x32')][_0x46db('0x26')](_0x265050)[_0x46db('0x2b')](function(_0x3f31e1){_0x2fd094[_0x46db('0x26')]=_0x3f31e1;if(_0x1d5f86[_0x46db('0x38')][_0x46db('0x46')]){_0xd92990[_0x46db('0x47')]=[{'all':!![]}];}return db[_0x46db('0x32')][_0x46db('0x48')](_0xd92990);})[_0x46db('0x2b')](function(_0x1e9cde){_0x2fd094[_0x46db('0x49')]=_0x1e9cde;return _0x2fd094;})['then'](respondWithFilteredResult(_0x531ef2,_0xd92990))[_0x46db('0x4a')](handleError(_0x531ef2,null));};exports[_0x46db('0x4b')]=function(_0x1042b0,_0x3d479f){var _0x28141d={'raw':![],'where':{'id':_0x1042b0[_0x46db('0x4c')]['id']}},_0x53d253={};_0x53d253[_0x46db('0x37')]=_[_0x46db('0x39')](db[_0x46db('0x32')][_0x46db('0x33')]);_0x53d253[_0x46db('0x38')]=_[_0x46db('0x39')](_0x1042b0[_0x46db('0x38')]);_0x53d253['filters']=_['intersection'](_0x53d253[_0x46db('0x37')],_0x53d253[_0x46db('0x38')]);_0x28141d[_0x46db('0x3b')]=_[_0x46db('0x3a')](_0x53d253['model'],qs[_0x46db('0x3c')](_0x1042b0[_0x46db('0x38')][_0x46db('0x3c')]));_0x28141d[_0x46db('0x3b')]=_0x28141d[_0x46db('0x3b')][_0x46db('0x3d')]?_0x28141d[_0x46db('0x3b')]:_0x53d253[_0x46db('0x37')];if(_0x1042b0[_0x46db('0x38')][_0x46db('0x46')]){_0x28141d['include']=[{'all':!![]}];}_0x28141d=_[_0x46db('0x43')]({},_0x28141d,_0x1042b0['options']);return db[_0x46db('0x32')][_0x46db('0x4d')](_0x28141d)[_0x46db('0x2b')](handleEntityNotFound(_0x3d479f,null))[_0x46db('0x2b')](respondWithResult(_0x3d479f,null))[_0x46db('0x4a')](handleError(_0x3d479f,null));};exports['create']=function(_0xa4dd63,_0xd469f){return db['UserProfile'][_0x46db('0x4e')](_0xa4dd63[_0x46db('0x4f')],{})['then'](respondWithResult(_0xd469f,0xc9))[_0x46db('0x4a')](handleError(_0xd469f,null));};exports[_0x46db('0x50')]=function(_0x4c4892,_0x55ba77){var _0x573e48={'where':{'id':_0x4c4892[_0x46db('0x4c')]['id']}},_0x5a1469={};_0x5a1469['model']=_[_0x46db('0x39')](db[_0x46db('0x32')][_0x46db('0x33')]);_0x573e48['attributes']=_[_0x46db('0x3a')](_0x5a1469[_0x46db('0x37')],qs[_0x46db('0x3c')](_0x4c4892[_0x46db('0x38')]['fields']));_0x573e48[_0x46db('0x3b')]=_0x573e48[_0x46db('0x3b')]['length']?_0x573e48['attributes']:_0x5a1469['model'];if(_0x4c4892[_0x46db('0x38')]['includeAll']){_0x573e48[_0x46db('0x47')]=[{'all':!![]}];}_0x573e48=_[_0x46db('0x43')]({},_0x573e48,_0x4c4892[_0x46db('0x45')]);return db['UserProfile'][_0x46db('0x4d')](_0x573e48)[_0x46db('0x2b')](handleEntityNotFound(_0x55ba77,null))[_0x46db('0x2b')](function(_0x2d75bf){if(_0x2d75bf){var _0x178de5=_0x2d75bf['get']({'plain':!![]});_0x178de5=qs[_0x46db('0x51')](_0x178de5,['id','createdAt',_0x46db('0x52'),'crudPermissions']);_0x4c4892[_0x46db('0x4f')]=_[_0x46db('0x51')](_0x4c4892[_0x46db('0x4f')],['id',_0x46db('0x53'),'updatedAt']);return db[_0x46db('0x54')][_0x46db('0x55')](function(_0x31df60){return db['UserProfile']['create'](_[_0x46db('0x43')](_0x178de5,_0x4c4892[_0x46db('0x4f')]),{'include':_0x4c4892['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x31df60})[_0x46db('0x2b')](function(_0x982ccf){var _0x2614a0=_0x982ccf[_0x46db('0x56')]({'plain':!![]});return db['UserProfileSection'][_0x46db('0x48')]({'where':{'userProfileId':_0x4c4892[_0x46db('0x4c')]['id']},'raw':!![]})[_0x46db('0x2b')](function(_0x55fc21){if(_0x55fc21){return BPromise[_0x46db('0x57')](_0x55fc21,function(_0x4d1e1a){return new BPromise(function(_0x5082c0,_0x25289a){if(_0x4d1e1a[_0x46db('0x58')]===null||_0x4d1e1a[_0x46db('0x58')]===0x1)_0x5082c0(null);return db[_0x46db('0x59')][_0x46db('0x48')]({'where':{'sectionId':_0x4d1e1a['id']},'raw':!![]})[_0x46db('0x2b')](function(_0x3ceaed){var _0x92438c=_[_0x46db('0x31')](_0x3ceaed,function(_0x5c5826){return qs['omit'](_0x5c5826,['id','createdAt','updatedAt',_0x46db('0x5a')]);});_0x5082c0(_0x92438c);})[_0x46db('0x4a')](function(_0x37fd3e){_0x25289a(_0x37fd3e);});})[_0x46db('0x2b')](function(_0x4acc5a){var _0xa8d88a=qs[_0x46db('0x51')](_0x4d1e1a,['id','createdAt',_0x46db('0x52')]);_0xa8d88a[_0x46db('0x5b')]=_0x2614a0['id'];if(_0x4acc5a)_0xa8d88a[_0x46db('0x5c')]=_0x4acc5a;return _0xa8d88a;})[_0x46db('0x2b')](function(_0x9bc317){return db['UserProfileSection']['create'](_0x9bc317,{'include':[{'model':db[_0x46db('0x59')],'as':_0x46db('0x5c')}],'raw':!![],'transaction':_0x31df60});});})[_0x46db('0x2b')](function(){return _0x2614a0;});}});});});}})[_0x46db('0x2b')](respondWithResult(_0x55ba77,0xc9))[_0x46db('0x4a')](handleError(_0x55ba77,null));};exports['update']=function(_0x36b38e,_0x162e50){if(_0x36b38e[_0x46db('0x4f')]['id']){delete _0x36b38e[_0x46db('0x4f')]['id'];}return db['UserProfile'][_0x46db('0x4d')]({'where':{'id':_0x36b38e[_0x46db('0x4c')]['id']}})[_0x46db('0x2b')](handleEntityNotFound(_0x162e50,null))[_0x46db('0x2b')](saveUpdates(_0x36b38e[_0x46db('0x4f')],null))['then'](respondWithResult(_0x162e50,null))[_0x46db('0x4a')](handleError(_0x162e50,null));};exports[_0x46db('0x2c')]=function(_0x447b85,_0x20f914){return db[_0x46db('0x32')][_0x46db('0x4d')]({'where':{'id':_0x447b85[_0x46db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20f914,null))[_0x46db('0x2b')](removeEntity(_0x20f914,null))[_0x46db('0x4a')](handleError(_0x20f914,null));};exports[_0x46db('0x5d')]=function(_0x3ffa8d,_0x5afd09){return db['UserProfile']['describe']()['then'](respondWithResult(_0x5afd09,null))[_0x46db('0x4a')](handleError(_0x5afd09,null));};exports[_0x46db('0x5e')]=function(_0x2bba34,_0x25a69c){var _0x3d7fad=_0x2bba34[_0x46db('0x4f')];return db['UserProfile'][_0x46db('0x4d')]({'where':{'id':_0x2bba34[_0x46db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25a69c,null))[_0x46db('0x2b')](function(_0x4b1089){if(_0x4b1089){return db[_0x46db('0x54')]['transaction'](function(_0x337d9a){return db[_0x46db('0x5f')][_0x46db('0x2c')]({'where':{'userProfileId':_0x2bba34[_0x46db('0x4c')]['id'],'sectionId':_['map'](_0x3d7fad,function(_0x2ae3a4){return _0x2ae3a4[_0x46db('0x5a')];})},'transaction':_0x337d9a})['then'](function(){var _0x2758b9=_['map'](_0x3d7fad,function(_0xe35119){_0xe35119['userProfileId']=_0x2bba34[_0x46db('0x4c')]['id'];return _0xe35119;});var _0xaed8a5=[];return BPromise[_0x46db('0x57')](_0x2758b9,function(_0x3b9a16){return db[_0x46db('0x5f')][_0x46db('0x4e')](_0x3b9a16,{'include':[{'model':db[_0x46db('0x59')],'as':_0x46db('0x5c')}],'raw':!![],'transaction':_0x337d9a})[_0x46db('0x2b')](function(_0x1d539a){_0xaed8a5[_0x46db('0x60')](_0x1d539a[_0x46db('0x56')]({'plain':!![]}));});})['then'](function(){return _0xaed8a5;});});});}})[_0x46db('0x2b')](function(_0x480f62){return _0x480f62;})[_0x46db('0x2b')](respondWithResult(_0x25a69c,null))['catch'](handleError(_0x25a69c,null));};exports[_0x46db('0x61')]=function(_0x40b6f0,_0x94c211){var _0xef9f7b;return db[_0x46db('0x32')][_0x46db('0x4d')]({'where':{'id':_0x40b6f0[_0x46db('0x4c')]['id']},'attributes':['id',_0x46db('0x2f')]})[_0x46db('0x2b')](handleEntityNotFound(_0x94c211,null))[_0x46db('0x2b')](function(_0x270bdb){if(_0x270bdb){_0xef9f7b=_0x270bdb;return db[_0x46db('0x5f')][_0x46db('0x2c')]({'where':{'userProfileId':_0x40b6f0[_0x46db('0x4c')]['id'],'sectionId':_0x40b6f0[_0x46db('0x38')]['ids']}});}})['then'](function(){return _0xef9f7b;})[_0x46db('0x2b')](respondWithStatusCode(_0x94c211,null))[_0x46db('0x4a')](handleError(_0x94c211,null));};exports['getSections']=function(_0x415f7e,_0x4b3cfa){var _0x30c54a=[];var _0x31572c=[];return db[_0x46db('0x5f')]['findAll']({'where':{'userProfileId':_0x415f7e['params']['id']},'raw':!![]})[_0x46db('0x2b')](function(_0xb9a7df){_0x30c54a=_[_0x46db('0x44')](_0xb9a7df,function(_0x1903be){return _0x1903be[_0x46db('0x62')]===0x1||_[_0x46db('0x63')]([0x3eb,0x709],_0x1903be[_0x46db('0x5a')]);});if(!_[_0x46db('0x64')](_0x30c54a)){return _[_0x46db('0x31')](_0x30c54a,function(_0x249744){return _0x249744[_0x46db('0x5a')];});}else{return;}})['then'](function(_0xbe99ac){if(_0xbe99ac)_0x31572c=_0xbe99ac;if(_['includes'](_0x31572c,0x64)){var _0x34ac25=_[_0x46db('0x4d')](_0x30c54a,{'sectionId':0x64});return hasDefaultDashboard(_0x34ac25)[_0x46db('0x2b')](function(_0x46a4fa){return _[_0x46db('0x31')](_0x30c54a,function(_0x4c976a){if(_0x4c976a[_0x46db('0x5a')]===0x64){_0x4c976a[_0x46db('0x65')]=_0x46a4fa;}return _0x4c976a;});});}else{return;}})[_0x46db('0x2b')](function(_0x223539){if(_0x223539)_0x30c54a=_0x223539;if(_[_0x46db('0x63')](_0x31572c,0x3eb)){var _0x97f613=_[_0x46db('0x4d')](_0x30c54a,{'sectionId':0x3eb});return getCustomDashboards(_0x97f613)[_0x46db('0x2b')](function(_0x5ef702){return _[_0x46db('0x31')](_0x30c54a,function(_0x1c3bfd){if(_0x97f613[_0x46db('0x62')]){if(_0x1c3bfd[_0x46db('0x5a')]===0x3eb){_0x1c3bfd[_0x46db('0x65')]=_0x5ef702;}}else{if(_0x1c3bfd['sectionId']===0x64){_0x1c3bfd[_0x46db('0x65')]=_0x5ef702;}}return _0x1c3bfd;});});}else{return;}})[_0x46db('0x2b')](function(_0x3835b8){if(_0x3835b8)_0x30c54a=_0x3835b8;if(_[_0x46db('0x63')](_0x31572c,0x709)){var _0x407ddf=_['find'](_0x30c54a,{'sectionId':0x709});return getPlugins(_0x407ddf)['then'](function(_0x3e8ad6){if(_0x407ddf[_0x46db('0x62')]){return _[_0x46db('0x31')](_0x30c54a,function(_0x5ca70e){if(_0x5ca70e[_0x46db('0x5a')]===0x709){_0x5ca70e[_0x46db('0x65')]=_0x3e8ad6;}return _0x5ca70e;});}else{var _0x4b3e85={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3e8ad6};var _0xdeb43f=_['map'](_0x30c54a);_0xdeb43f[_0x46db('0x60')](_0x4b3e85);return _0xdeb43f;}});}else{return;}})[_0x46db('0x2b')](function(_0x39d6d7){if(_0x39d6d7)_0x30c54a=_0x39d6d7;return _[_0x46db('0x44')](_0x30c54a,['enabled',0x1]);})[_0x46db('0x2b')](respondWithResult(_0x4b3cfa,null))[_0x46db('0x4a')](handleError(_0x4b3cfa,null));};function hasDefaultDashboard(_0x4ab88a){var _0x19e94b=[0x65];return new BPromise(function(_0x1c3b2e,_0x273bf4){try{if(_0x4ab88a['autoAssociation']){_0x1c3b2e(_0x19e94b);}else{return db[_0x46db('0x59')][_0x46db('0x66')]({'where':{'sectionId':_0x4ab88a['id']},'raw':!![]})[_0x46db('0x2b')](function(_0x25ca0a){_0x25ca0a?_0x1c3b2e(_0x19e94b):_0x1c3b2e();});}}catch(_0x1eb672){_0x273bf4(_0x1eb672);}});}function getCustomDashboards(_0x222e99){var _0x560968=[];return new BPromise(function(_0x1a1ad9,_0x2f734d){try{if(_0x222e99[_0x46db('0x58')]){return db[_0x46db('0x67')][_0x46db('0x48')]({'raw':!![]})[_0x46db('0x2b')](function(_0x33ad58){_0x33ad58['forEach'](function(_0x3a242a){_0x560968[_0x46db('0x60')](_0x3a242a['id']+0x1869f);});_0x1a1ad9(_0x560968);});}else{return db[_0x46db('0x59')][_0x46db('0x48')]({'where':{'sectionId':_0x222e99['id']},'raw':!![]})['then'](function(_0x226d31){_0x226d31['forEach'](function(_0x544b6a){_0x560968[_0x46db('0x60')](_0x544b6a[_0x46db('0x68')]+0x1869f);});_0x1a1ad9(_0x560968);});}}catch(_0x46ae11){_0x2f734d(_0x46ae11);}});}function getPlugins(_0x54012f){var _0x5dcce9=[];return new BPromise(function(_0x53a51b,_0x1be762){try{if(_0x54012f[_0x46db('0x58')]){return db[_0x46db('0x69')][_0x46db('0x48')]({'raw':!![]})[_0x46db('0x2b')](function(_0xedae84){_0xedae84[_0x46db('0x6a')](function(_0x30a9ac){_0x5dcce9[_0x46db('0x60')](_0x30a9ac['id']+0x15b38);});_0x53a51b(_0x5dcce9);});}else{return db[_0x46db('0x59')]['findAll']({'where':{'sectionId':_0x54012f['id']},'raw':!![]})[_0x46db('0x2b')](function(_0x28c171){_0x28c171[_0x46db('0x6a')](function(_0x5ea0e7){_0x5dcce9[_0x46db('0x60')](_0x5ea0e7[_0x46db('0x68')]+0x15b38);});_0x53a51b(_0x5dcce9);});}}catch(_0x39bcb6){_0x1be762(_0x39bcb6);}});}exports[_0x46db('0x6b')]=function(_0x48c577,_0x2b3675){return db[_0x46db('0x32')][_0x46db('0x4d')]({'where':{'id':_0x48c577['params']['id']}})['then'](handleEntityNotFound(_0x2b3675,null))[_0x46db('0x2b')](function(_0x193e4a){if(_0x193e4a){return db[_0x46db('0x54')][_0x46db('0x55')](function(_0x302272){return db[_0x46db('0x5f')][_0x46db('0x48')]({'where':{'userProfileId':_0x48c577[_0x46db('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x46db('0x2b')](function(_0x3dc85c){if(_0x3dc85c){return db[_0x46db('0x5f')][_0x46db('0x2c')]({'where':{'userProfileId':_0x48c577[_0x46db('0x4c')]['id'],'id':_['map'](_0x3dc85c,function(_0x239350){return _0x239350['id'];})},'transaction':_0x302272});}})[_0x46db('0x2b')](function(_0x1cb5ae){var _0x3819f0=_['map'](_0x48c577[_0x46db('0x4f')],function(_0x1bf5ee){_0x1bf5ee[_0x46db('0x5b')]=_0x48c577[_0x46db('0x4c')]['id'];return _0x1bf5ee;});return db[_0x46db('0x5f')][_0x46db('0x6c')](_0x3819f0,{'raw':!![],'transaction':_0x302272});})['then'](function(_0x101a37){var _0x4ff40d=_[_0x46db('0x44')](_['map'](_0x101a37,function(_0x4650b6){return _0x4650b6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4ff40d){return db[_0x46db('0x5f')][_0x46db('0x48')]({'where':{'userProfileId':_0x48c577[_0x46db('0x4c')]['id'],'sectionId':_[_0x46db('0x31')](_0x4ff40d,function(_0x2a8a6f){return _0x2a8a6f[_0x46db('0x5a')];})},'attributes':['id',_0x46db('0x5a')],'raw':!![]})[_0x46db('0x2b')](function(_0x456cb3){var _0x24da5c=_[_0x46db('0x31')](_0x48c577[_0x46db('0x4f')],function(_0x1933b9){_0x1933b9[_0x46db('0x5b')]=_0x48c577[_0x46db('0x4c')]['id'];return _0x1933b9;});return db[_0x46db('0x59')][_0x46db('0x6c')](_0x24da5c,{'raw':!![],'transaction':_0x302272});});}})[_0x46db('0x4a')](handleError(_0x2b3675,null));});}})[_0x46db('0x2b')](function(_0x2626b8){var _0x3c39b0=_[_0x46db('0x31')](_0x2626b8,function(_0x12c196){return _0x12c196[_0x46db('0x56')]({'plain':!![]});});})[_0x46db('0x2b')](respondWithResult(_0x2b3675,null))['catch'](handleError(_0x2b3675,null));};exports[_0x46db('0x6d')]=function(_0x15a414,_0x256a1a,_0x4368b4){return db['UserProfile'][_0x46db('0x4d')]({'where':{'id':_0x15a414[_0x46db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x256a1a,null))['then'](function(_0x504f71){if(_0x504f71){return _0x504f71[_0x46db('0x6d')](_0x15a414[_0x46db('0x38')][_0x46db('0x6e')]);}})['then'](respondWithStatusCode(_0x256a1a,null))[_0x46db('0x4a')](handleError(_0x256a1a,null));};exports[_0x46db('0x6f')]=function(_0x1c22b9,_0x85a066){var _0x6d428b={};if(!_0x1c22b9[_0x46db('0x38')][_0x46db('0x70')])throw new Error(_0x46db('0x71'));if(!_0x1c22b9[_0x46db('0x38')][_0x46db('0x72')](_0x46db('0x3e'))){_0x6d428b['limit']=qs[_0x46db('0x25')](_0x1c22b9['query']['limit']);_0x6d428b[_0x46db('0x23')]=qs[_0x46db('0x23')](_0x1c22b9['query'][_0x46db('0x23')]);}return db[_0x46db('0x32')][_0x46db('0x4d')]({'where':{'id':_0x1c22b9[_0x46db('0x4c')]['id']}})[_0x46db('0x2b')](function(_0x446128){if(!_0x446128)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1c22b9[_0x46db('0x4c')]['id']);return db[_0x46db('0x32')][_0x46db('0x6f')](_0x1c22b9);})[_0x46db('0x2b')](respondWithFilteredResult(_0x85a066,_0x6d428b))[_0x46db('0x4a')](handleError(_0x85a066,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e375e9c..172ca81 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 _0xd117=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xd117,0x182));var _0x7d11=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0xd117[_0x29f730];return _0x189806;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var UserProfile=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){UserProfileEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);UserProfileEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];UserProfile[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x2542=['exports','events','../../mysqldb','UserProfile','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x36a2b6,_0x26970d){var _0x3f8caa=function(_0x4e4e7a){while(--_0x4e4e7a){_0x36a2b6['push'](_0x36a2b6['shift']());}};_0x3f8caa(++_0x26970d);}(_0x2542,0x169));var _0x2254=function(_0xd29317,_0x1ed669){_0xd29317=_0xd29317-0x0;var _0x4d09cc=_0x2542[_0xd29317];return _0x4d09cc;};'use strict';var EventEmitter=require(_0x2254('0x0'));var UserProfile=require(_0x2254('0x1'))['db'][_0x2254('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2254('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2254('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4059d1){return function(_0x3b3dcb,_0x27f5c9,_0x456612){UserProfileEvents[_0x2254('0x5')](_0x4059d1+':'+_0x3b3dcb['id'],_0x3b3dcb);UserProfileEvents['emit'](_0x4059d1,_0x3b3dcb);_0x456612(null);};}for(var e in events){if(events[_0x2254('0x6')](e)){var event=events[e];UserProfile[_0x2254('0x7')](e,emitEvent(event));}}module[_0x2254('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index adc0956..63bcd2b 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 _0x24c8=['sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','filters','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','CustomReports','rows','count','Tags','color','tag','openTabs','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','map','model','associatedResources','name','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','Users','user','Agents','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule'];(function(_0x3d5dd5,_0x161a29){var _0x43c52e=function(_0x5c55f2){while(--_0x5c55f2){_0x3d5dd5['push'](_0x3d5dd5['shift']());}};_0x43c52e(++_0x161a29);}(_0x24c8,0x10c));var _0x824c=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x24c8[_0x37a9d7];return _0x1343d3;};'use strict';var _=require(_0x824c('0x0'));var attributes=require(_0x824c('0x1'));var qs=require(_0x824c('0x2'));var squel=require('squel');module[_0x824c('0x3')]=function(_0x21831f){var _0xb7370f=_0x21831f[_0x824c('0x4')];function _0x1ad878(_0xfc25ff,_0x673d84){return new Promise(function(_0x14ee5f,_0x5b8639){if(!_0x673d84)return _0x14ee5f(null);var _0x4b6f08=_0x673d84[_0x824c('0x5')]?{[_0x673d84[_0x824c('0x5')][_0x824c('0x6')]]:_0x673d84['filter'][_0x824c('0x7')]}:undefined;return _0xb7370f[_0xfc25ff][_0x824c('0x8')]({'where':_0x4b6f08,'raw':!![]})[_0x824c('0x9')](function(_0x314df4){_0x673d84['associatedResources']=_[_0x824c('0xa')](_0x314df4,'id');_0x14ee5f(_0x673d84);})['catch'](function(_0x50982b){_0x5b8639(_0x50982b);});});}function _0xe5841e(_0x48a026,_0xd693da){return new Promise(function(_0x24438e,_0xa6dc24){var _0x58f668=_0x48a026[_0x824c('0x5')]?{[_0x48a026[_0x824c('0x5')][_0x824c('0x6')]]:_0x48a026[_0x824c('0x5')][_0x824c('0x7')]}:undefined;return _0xb7370f[_0x48a026[_0x824c('0xb')]][_0x824c('0x8')]({'where':_0x58f668,'raw':!![]})[_0x824c('0x9')](function(_0x38046d){_0xd693da[_0x824c('0xc')]=_[_0x824c('0xa')](_0x38046d,function(_0x4421ea){return _0x4421ea[_0x824c('0xd')];});_0x24438e(_0xd693da);})['catch'](function(_0xe07d05){_0xa6dc24(_0xe07d05);});});}function _0x137db5(_0x4d0345,_0x5a6f84,_0x2ddc11){if(!_0x5a6f84)return Promise[_0x824c('0xe')](null);return new Promise(function(_0x1eebc9,_0x48a00c){return _0xb7370f[_0x824c('0xf')][_0x824c('0x8')]({'where':{'sectionId':_0x5a6f84['id']},'raw':!![]})[_0x824c('0x9')](function(_0x23f7b2){if(_0x4d0345['field']&&_0x4d0345[_0x824c('0x6')]!=='id'){_0x5a6f84[_0x824c('0xc')]=_[_0x824c('0xa')](_0x23f7b2,function(_0x2c3e72){return _0x2c3e72[_0x4d0345['field']];});}else{if(_0x2ddc11==='AnalyticExtractedReport'){_0x5a6f84[_0x824c('0xc')]=_[_0x824c('0xa')](_0x23f7b2,function(_0x174e87){return{'id':_0x174e87[_0x824c('0x10')],'type':_0x174e87[_0x824c('0x11')]};});}else{_0x5a6f84[_0x824c('0xc')]=_[_0x824c('0xa')](_0x23f7b2,function(_0x1a0b6c){return _0x1a0b6c[_0x824c('0x10')];});}}_0x1eebc9(_0x5a6f84);})['catch'](function(_0x5826b2){_0x48a00c(_0x5826b2);});});}function _0x31eca0(_0x32cefc,_0x38495f){var _0x172fd6={'parentSections':[]};switch(_0x32cefc[_0x824c('0x12')]()){case _0x824c('0x13'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x15');break;case _0x824c('0x16'):_0x172fd6[_0x824c('0x14')]='SquareOdbc';break;case'squarerecordings':_0x172fd6[_0x824c('0x14')]=_0x824c('0x17');_0x172fd6[_0x824c('0x18')]=[{'name':_0x824c('0x19'),'field':_0x824c('0xd'),'foreignKey':_0x824c('0x1a')}];break;case _0x824c('0x1b'):_0x172fd6['childModel']='JscriptyProject';break;case _0x824c('0x1c'):_0x172fd6['childModel']=_0x824c('0x1d');_0x172fd6[_0x824c('0x18')]=[{'name':_0x824c('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x824c('0x1f'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x20');break;case _0x824c('0x21'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x22');break;case'globalcustomfields':_0x172fd6[_0x824c('0x14')]=_0x824c('0x23');break;case _0x824c('0x24'):_0x172fd6[_0x824c('0x14')]='ChatQueue';break;case _0x824c('0x25'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x26');break;case _0x824c('0x27'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x28');break;case _0x824c('0x29'):_0x172fd6['childModel']='FaxAccount';break;case _0x824c('0x2a'):case _0x824c('0x2b'):case _0x824c('0x2c'):_0x172fd6['childModel']=_0x824c('0x2d');break;case'contexts':_0x172fd6['childModel']='VoiceContext';break;case'voicemails':_0x172fd6[_0x824c('0x14')]=_0x824c('0x2e');break;case _0x824c('0x2f'):_0x172fd6['childModel']=_0x824c('0x30');_0x172fd6[_0x824c('0x18')]=[{'name':'Agents','field':_0x824c('0xd'),'foreignKey':_0x824c('0x31'),'model':_0x824c('0x32'),'filter':{'field':_0x824c('0x33'),'value':[_0x824c('0x34')]}},{'name':'Telephones','field':_0x824c('0xd'),'foreignKey':'membername','model':_0x824c('0x32'),'filter':{'field':_0x824c('0x33'),'value':[_0x824c('0x35')]}},{'name':'VoiceQueues','field':_0x824c('0xd'),'foreignKey':_0x824c('0x36'),'model':_0x824c('0x37'),'filter':{'field':_0x824c('0x11'),'value':[_0x824c('0x38')]}},{'name':_0x824c('0x39'),'field':_0x824c('0xd'),'foreignKey':'queue','model':_0x824c('0x37'),'filter':{'field':'type','value':[_0x824c('0x3a')]}}];break;case _0x824c('0x3b'):_0x172fd6['childModel']='VoiceMusicOnHold';break;case _0x824c('0x3c'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x3d');break;case _0x824c('0x3e'):_0x172fd6['childModel']=_0x824c('0x3f');break;case _0x824c('0x40'):_0x172fd6['childModel']=_0x824c('0x41');break;case _0x824c('0x42'):_0x172fd6['childModel']='MailQueue';break;case'mailaccounts':_0x172fd6[_0x824c('0x14')]=_0x824c('0x43');break;case _0x824c('0x44'):_0x172fd6['childModel']=_0x824c('0x45');break;case _0x824c('0x46'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x47');break;case'openchannelaccounts':_0x172fd6[_0x824c('0x14')]=_0x824c('0x48');break;case'smsqueues':_0x172fd6[_0x824c('0x14')]=_0x824c('0x49');break;case'smsaccounts':_0x172fd6[_0x824c('0x14')]=_0x824c('0x4a');break;case _0x824c('0x4b'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x4c');break;case'whatsappaccounts':_0x172fd6['childModel']='WhatsappAccount';break;case _0x824c('0x4d'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x4e');break;case _0x824c('0x4f'):case _0x824c('0x50'):_0x172fd6[_0x824c('0x14')]='VoiceQueue';if(_0x38495f){_0x172fd6['parentSections']=[{'name':_0x824c('0x51')},{'name':_0x824c('0x39')}];}break;case _0x824c('0x52'):case'agents':case'telephones':_0x172fd6['childModel']='User';if(_0x38495f){_0x172fd6['parentSections']=[{'name':_0x824c('0x53'),'filter':{'field':_0x824c('0x33'),'value':['admin',_0x824c('0x54')]},'ignore':!![]},{'name':_0x824c('0x55')},{'name':_0x824c('0x56')}];}break;case _0x824c('0x57'):_0x172fd6[_0x824c('0x14')]='ZendeskAccount';break;case _0x824c('0x58'):_0x172fd6['childModel']=_0x824c('0x59');break;case _0x824c('0x5a'):_0x172fd6['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x172fd6[_0x824c('0x14')]='SugarcrmAccount';break;case _0x824c('0x5b'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x5c');break;case'zohoaccounts':_0x172fd6[_0x824c('0x14')]=_0x824c('0x5d');break;case _0x824c('0x5e'):_0x172fd6['childModel']=_0x824c('0x32');break;case _0x824c('0x5f'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x60');break;case'dispositions':_0x172fd6[_0x824c('0x14')]=_0x824c('0x61');break;case'customdashboards':_0x172fd6[_0x824c('0x14')]=_0x824c('0x62');break;case _0x824c('0x63'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x64');break;case _0x824c('0x65'):_0x172fd6[_0x824c('0x14')]='Pause';break;case _0x824c('0x66'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x67');break;case _0x824c('0x68'):_0x172fd6[_0x824c('0x14')]='Sound';break;case _0x824c('0x69'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x6a');break;case _0x824c('0x6b'):_0x172fd6['childModel']=_0x824c('0x6c');break;case _0x824c('0x6d'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x6e');break;case _0x824c('0x6f'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x70');break;case _0x824c('0x71'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x72');break;case _0x824c('0x73'):_0x172fd6[_0x824c('0x14')]='Plugin';break;case _0x824c('0x74'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x75');_0x172fd6[_0x824c('0x18')]=[{'name':_0x824c('0x76'),'field':'id','foreignKey':_0x824c('0x77')}];break;case _0x824c('0x78'):_0x172fd6[_0x824c('0x14')]=_0x824c('0x79');break;}return _0x172fd6;}function _0x2e8bb0(_0x7000a8,_0x572092){var _0xcf5ab3=_0x7000a8[_0x824c('0x7a')](0x0)[_0x824c('0x7b')]()+_0x7000a8['slice'](0x1);var _0x15667e={'type':_0xb7370f[_0x824c('0x7c')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x508044,_0x3e79b2){var _0x5122f6=squel[_0x824c('0x7d')]()['field'](_0x824c('0x7e')+_0xcf5ab3+_0x824c('0x7f'),'id')[_0x824c('0x6')]('ui.createdAt')['from'](_0x824c('0x80')+_0x7000a8+_0x824c('0x81'),'ui')[_0x824c('0x82')](_0x824c('0x83'),_0x572092['id']);return _0xb7370f[_0x824c('0x84')]['query'](_0x5122f6[_0x824c('0x85')](),_0x15667e)[_0x824c('0x9')](function(_0x1290e8){_0x572092[_0xcf5ab3+_0x824c('0x86')]=_0x1290e8;_0x508044(_0x1290e8);})['catch'](function(_0x2eb51e){_0x3e79b2(_0x2eb51e);});});}return _0x21831f[_0x824c('0x87')](_0x824c('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28ad85){var _0x3bd421={'raw':_0x28ad85['query'][_0x824c('0x89')],'where':{}};var _0x309049={};var _0x29bf84={'count':0x0,'rows':[]};var _0x19c9e0=_0x28ad85[_0x824c('0x8a')][_0x824c('0x8b')];var _0x483463=_0x28ad85[_0x824c('0x8a')][_0x824c('0x8c')]||![];var _0x529b38=_0x31eca0(_0x19c9e0,_0x483463);if(!_0x529b38[_0x824c('0x14')])throw new Error(_0x824c('0x8d')+_0x19c9e0+'\x27');var _0x566849=[{'name':_0x19c9e0}];if(!_[_0x824c('0x8e')](_0x529b38[_0x824c('0x18')]))_0x566849=_0x529b38[_0x824c('0x18')];var _0x59ab19=[];for(var _0xe02c0c=0x0;_0xe02c0c<_0x566849[_0x824c('0x8f')];_0xe02c0c++){_0x59ab19[_0x824c('0x90')](_0xb7370f[_0x824c('0x91')][_0x824c('0x92')]({'where':{'userProfileId':_0x28ad85['params']['id'],'name':_0x566849[_0xe02c0c][_0x824c('0xd')]},'raw':!![]}));}return Promise[_0x824c('0x93')](_0x59ab19)[_0x824c('0x9')](function(_0x42fb70){var _0x27af83=_[_0x824c('0x5')](_0x42fb70,function(_0x3458b8){return _0x3458b8?_0x3458b8:undefined;});var _0x209c02=_['filter'](_0x566849,[_0x824c('0x94'),!![]]);var _0x519206=_[_0x824c('0x8e')](_0x27af83)&&_[_0x824c('0x8e')](_0x209c02)?null:_[_0x824c('0x95')](_0x209c02,_0x27af83);if(!_0x519206)return null;var _0x2c9f46=[];for(var _0x3c117f=0x0;_0x3c117f<_0x519206['length'];_0x3c117f++){var _0x193d1c=_[_0x824c('0x92')](_0x566849,function(_0x57e7cd){return _0x519206[_0x3c117f]?_0x57e7cd[_0x824c('0xd')]===_0x519206[_0x3c117f][_0x824c('0xd')]:null;});if(_0x193d1c){if(_0x519206[_0x3c117f]['ignore']){_0x2c9f46[_0x824c('0x90')](_0x1ad878(_0x529b38[_0x824c('0x14')],_0x519206[_0x3c117f]));}else{if(!_0x519206[_0x3c117f][_0x824c('0x96')]){_0x2c9f46['push'](_0x137db5(_0x193d1c,_0x519206[_0x3c117f],_0x529b38[_0x824c('0x14')]));}else{if(_0x193d1c[_0x824c('0xb')]){_0x2c9f46[_0x824c('0x90')](_0xe5841e(_0x193d1c,_0x519206[_0x3c117f]));}}}}}return Promise[_0x824c('0x93')](_0x2c9f46);})['then'](function(_0x4d1a5a){var _0x2dbe56=_0x4d1a5a;var _0x31bfb8=null;if(_0x2dbe56){_0x31bfb8=_0x2dbe56[_0x824c('0x8f')]===0x1?_0x2dbe56[0x0]:null;}if(!_0x31bfb8&&!_0x2dbe56)return _0x29bf84;var _0x58b114=_0xb7370f[_0x529b38[_0x824c('0x14')]][_0x824c('0x97')];_0x309049['model']=_['keys'](_0x58b114);_0x309049[_0x824c('0x8a')]=_['keys'](_0x28ad85[_0x824c('0x8a')]);_0x309049[_0x824c('0x98')]=_['intersection'](_0x309049[_0x824c('0xb')],_0x309049[_0x824c('0x8a')]);_0x3bd421['attributes']=_['intersection'](_0x309049['model'],qs[_0x824c('0x99')](_0x28ad85[_0x824c('0x8a')][_0x824c('0x99')]));_0x3bd421[_0x824c('0x9a')]=_0x3bd421[_0x824c('0x9a')]['length']?_0x3bd421[_0x824c('0x9a')]:_0x309049[_0x824c('0xb')];if(!_0x28ad85[_0x824c('0x8a')][_0x824c('0x9b')](_0x824c('0x9c'))){_0x3bd421[_0x824c('0x9d')]=qs[_0x824c('0x9d')](_0x28ad85[_0x824c('0x8a')][_0x824c('0x9d')]);_0x3bd421[_0x824c('0x9e')]=qs[_0x824c('0x9e')](_0x28ad85[_0x824c('0x8a')]['offset']);}_0x3bd421[_0x824c('0x9f')]=qs[_0x824c('0xa0')](_0x28ad85[_0x824c('0x8a')][_0x824c('0xa0')]);_0x3bd421[_0x824c('0x82')]=qs[_0x824c('0x98')](_[_0x824c('0xa1')](_0x28ad85[_0x824c('0x8a')],_0x309049[_0x824c('0x98')]));if(_0x28ad85['query']['filter']){_0x3bd421[_0x824c('0x82')]=_['merge'](_0x3bd421[_0x824c('0x82')],{'$or':_[_0x824c('0xa')](_0x58b114,function(_0x5d5f04){if(_0x5d5f04[_0x824c('0x11')][_0x824c('0xa2')]!==_0x824c('0xa3')){var _0x5217a4={};_0x5217a4[_0x5d5f04[_0x824c('0x6')]]={'$like':'%'+_0x28ad85[_0x824c('0x8a')][_0x824c('0x5')]+'%'};return _0x5217a4;}})});}var _0x6953b8=[];var _0x2dd76c=null;var _0x3cc31f={};if(_0x31bfb8){_0x2dd76c=_[_0x824c('0x92')](_0x566849,[_0x824c('0xd'),_0x31bfb8[_0x824c('0xd')]]);if(_0x2dd76c[_0x824c('0x6')]){_0x3cc31f={};if(_0x529b38[_0x824c('0x14')]===_0x824c('0x75')){_0x3cc31f[_0x2dd76c[_0x824c('0xa4')]]=_[_0x824c('0xa')](_0x31bfb8[_0x824c('0xc')],'id');}else{_0x3cc31f[_0x2dd76c[_0x824c('0xa4')]]=_0x31bfb8['associatedResources'];}_0x6953b8['push'](_0x3cc31f);}else{_0x3bd421[_0x824c('0x82')]['id']=_0x31bfb8[_0x824c('0xc')];}}else{for(var _0x3878f8=0x0;_0x3878f8<_0x2dbe56[_0x824c('0x8f')];_0x3878f8++){_0x2dd76c=_[_0x824c('0x92')](_0x566849,[_0x824c('0xd'),_0x2dbe56[_0x3878f8][_0x824c('0xd')]]);if(_0x2dd76c['field']){_0x3cc31f={};_0x3cc31f[_0x2dd76c['foreignKey']]=_0x2dbe56[_0x3878f8][_0x824c('0xc')];_0x6953b8[_0x824c('0x90')](_0x3cc31f);}else{if(!_0x3bd421[_0x824c('0x82')]['id'])_0x3bd421[_0x824c('0x82')]['id']=[];_0x2dbe56[_0x3878f8][_0x824c('0xc')][_0x824c('0xa5')](function(_0x1a4e64){_0x3bd421['where']['id'][_0x824c('0x90')](_0x1a4e64);});}}}if(!_[_0x824c('0x8e')](_0x6953b8)){_0x3bd421['where']=_[_0x824c('0xa6')](_0x3bd421['where'],{'$and':{'$or':_0x6953b8}});}_0x3bd421=_['merge']({},_0x3bd421,_0x28ad85[_0x824c('0xa7')]);if(_0x31bfb8&&!_0x31bfb8[_0x824c('0x96')]&&_0x529b38[_0x824c('0x14')]===_0x824c('0x75')){if(_0x28ad85['query'][_0x824c('0xa8')]){_0x3bd421[_0x824c('0xa9')]=[{'all':!![]}];}return _0xb7370f[_0x529b38['childModel']][_0x824c('0x8')](_0x3bd421)[_0x824c('0x9')](function(_0x400b91){var _0x40ad90=[];_0x400b91[_0x824c('0xa5')](function(_0x5aab87){var _0x333709;switch(_0x5aab87[_0x824c('0xaa')]){case _0x824c('0xab'):_0x333709=_[_0x824c('0x92')](_0x31bfb8[_0x824c('0xc')],function(_0x3899db){return _0x3899db['id']===_0x5aab87[_0x824c('0x77')]&&_0x3899db[_0x824c('0x11')]===_0x824c('0xac');});break;case'custom':_0x333709=_['find'](_0x31bfb8[_0x824c('0xc')],function(_0x197787){return _0x197787['id']===_0x5aab87[_0x824c('0x77')]&&_0x197787[_0x824c('0x11')]===_0x824c('0xad');});break;}if(_0x333709)_0x40ad90[_0x824c('0x90')](_0x5aab87);});_0x29bf84['count']=_0x40ad90[_0x824c('0x8f')];_0x29bf84[_0x824c('0xae')]=_0x40ad90;return _0x29bf84;});}else{return _0xb7370f[_0x529b38[_0x824c('0x14')]][_0x824c('0xaf')]({'where':_0x3bd421['where']})[_0x824c('0x9')](function(_0x5031c5){_0x29bf84['count']=_0x5031c5;if(_0x28ad85[_0x824c('0x8a')][_0x824c('0xa8')]){if(_0x529b38[_0x824c('0x14')]===_0x824c('0x1d')){_0x3bd421[_0x824c('0xa9')]=[{'model':_0xb7370f['Tag'],'as':_0x824c('0xb0'),'attributes':['id','name',_0x824c('0xb1')],'required':_0x28ad85[_0x824c('0x8a')][_0x824c('0xb2')]?!![]:![]},{'model':_0xb7370f[_0x824c('0x6a')],'as':'ThroughTags','attributes':['id',_0x824c('0xd'),_0x824c('0xb1')],'through':_0x28ad85[_0x824c('0x8a')][_0x824c('0xb2')]?{'attributes':[],'where':{'TagId':_0x28ad85[_0x824c('0x8a')]['tag']||undefined}}:{},'required':_0x28ad85['query'][_0x824c('0xb2')]?!![]:![]}];}else{_0x3bd421[_0x824c('0xa9')]=[{'all':!![]}];}}return _0xb7370f[_0x529b38[_0x824c('0x14')]][_0x824c('0x8')](_0x3bd421);})['then'](function(_0x14e8eb){_0x29bf84['rows']=_0x14e8eb;if(_0x19c9e0===_0x824c('0x55')&&_0x28ad85[_0x824c('0x8a')][_0x824c('0xb3')]==='true'){var _0x55164b=[];for(var _0x9670f1=0x0;_0x9670f1<_0x29bf84['rows'][_0x824c('0x8f')];_0x9670f1++){_0x55164b[_0x824c('0x90')](_0x2e8bb0(_0x824c('0xb4'),_0x29bf84[_0x824c('0xae')][_0x9670f1][_0x824c('0xb5')]));_0x55164b['push'](_0x2e8bb0(_0x824c('0xb6'),_0x29bf84['rows'][_0x9670f1][_0x824c('0xb5')]));_0x55164b[_0x824c('0x90')](_0x2e8bb0(_0x824c('0xb7'),_0x29bf84['rows'][_0x9670f1][_0x824c('0xb5')]));_0x55164b[_0x824c('0x90')](_0x2e8bb0(_0x824c('0xb8'),_0x29bf84['rows'][_0x9670f1][_0x824c('0xb5')]));_0x55164b[_0x824c('0x90')](_0x2e8bb0(_0x824c('0xb9'),_0x29bf84[_0x824c('0xae')][_0x9670f1][_0x824c('0xb5')]));_0x55164b[_0x824c('0x90')](_0x2e8bb0('whatsapp',_0x29bf84[_0x824c('0xae')][_0x9670f1]['dataValues']));}return Promise[_0x824c('0x93')](_0x55164b)[_0x824c('0x9')](function(){return _0x29bf84;});}return _0x29bf84;});}});}}});}; \ No newline at end of file +var _0x5149=['telephones','role','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','trunks','Trunk','variables','Variable','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','mergeResources','isEmpty','length','UserProfileSection','find','ignore','autoAssociation','push','all','rawAttributes','filters','intersection','fields','attributes','limit','offset','pick','merge','key','VIRTUAL','foreignKey','forEach','reportType','DefaultReports','custom','CustomReports','count','rows','includeAll','include','Tags','color','tag','ThroughTags','true','chat','sms','dataValues','mail','openchannel','lodash','../../components/parsers/qs','exports','filter','field','then','catch','value','model','map','resolve','UserProfileResource','findAll','associatedResources','type','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','name','projectName','projects','childModel','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','voicequeues','users'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x5149,0x116));var _0x9514=function(_0x2fc128,_0x5e7969){_0x2fc128=_0x2fc128-0x0;var _0x5be39e=_0x5149[_0x2fc128];return _0x5be39e;};'use strict';var _=require(_0x9514('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x9514('0x1'));var squel=require('squel');module[_0x9514('0x2')]=function(_0x3a4c59){var _0x289d9b=_0x3a4c59['models'];function _0x58ddf5(_0x20c1f9,_0x11b02b){return new Promise(function(_0x1c5cd3,_0x3f28e5){if(!_0x11b02b)return _0x1c5cd3(null);var _0x365c37=_0x11b02b[_0x9514('0x3')]?{[_0x11b02b[_0x9514('0x3')][_0x9514('0x4')]]:_0x11b02b[_0x9514('0x3')]['value']}:undefined;return _0x289d9b[_0x20c1f9]['findAll']({'where':_0x365c37,'raw':!![]})[_0x9514('0x5')](function(_0x2da03d){_0x11b02b['associatedResources']=_['map'](_0x2da03d,'id');_0x1c5cd3(_0x11b02b);})[_0x9514('0x6')](function(_0x18ecbc){_0x3f28e5(_0x18ecbc);});});}function _0x404a04(_0x52abe1,_0x2fe2b1){return new Promise(function(_0xdc6a78,_0x1200cd){var _0x2b3972=_0x52abe1['filter']?{[_0x52abe1[_0x9514('0x3')]['field']]:_0x52abe1['filter'][_0x9514('0x7')]}:undefined;return _0x289d9b[_0x52abe1[_0x9514('0x8')]]['findAll']({'where':_0x2b3972,'raw':!![]})['then'](function(_0x2bab1f){_0x2fe2b1['associatedResources']=_[_0x9514('0x9')](_0x2bab1f,function(_0x44b0d0){return _0x44b0d0['name'];});_0xdc6a78(_0x2fe2b1);})[_0x9514('0x6')](function(_0x1a3fc3){_0x1200cd(_0x1a3fc3);});});}function _0x1991cf(_0x11a890,_0x5bc72b,_0x5335eb){if(!_0x5bc72b)return Promise[_0x9514('0xa')](null);return new Promise(function(_0x52ab87,_0xd28384){return _0x289d9b[_0x9514('0xb')][_0x9514('0xc')]({'where':{'sectionId':_0x5bc72b['id']},'raw':!![]})[_0x9514('0x5')](function(_0x2f65dd){if(_0x11a890[_0x9514('0x4')]&&_0x11a890['field']!=='id'){_0x5bc72b[_0x9514('0xd')]=_[_0x9514('0x9')](_0x2f65dd,function(_0x298b33){return _0x298b33[_0x11a890[_0x9514('0x4')]];});}else{if(_0x5335eb==='AnalyticExtractedReport'){_0x5bc72b[_0x9514('0xd')]=_[_0x9514('0x9')](_0x2f65dd,function(_0x4ecd0b){return{'id':_0x4ecd0b['resourceId'],'type':_0x4ecd0b[_0x9514('0xe')]};});}else{_0x5bc72b['associatedResources']=_[_0x9514('0x9')](_0x2f65dd,function(_0x1ca47c){return _0x1ca47c[_0x9514('0xf')];});}}_0x52ab87(_0x5bc72b);})[_0x9514('0x6')](function(_0x41577b){_0xd28384(_0x41577b);});});}function _0xd3d76(_0x181000,_0x31d05f){var _0x411738={'parentSections':[]};switch(_0x181000[_0x9514('0x10')]()){case _0x9514('0x11'):_0x411738['childModel']=_0x9514('0x12');break;case _0x9514('0x13'):_0x411738['childModel']=_0x9514('0x14');break;case _0x9514('0x15'):_0x411738['childModel']=_0x9514('0x16');_0x411738[_0x9514('0x17')]=[{'name':'SquareProjects','field':_0x9514('0x18'),'foreignKey':_0x9514('0x19')}];break;case _0x9514('0x1a'):_0x411738[_0x9514('0x1b')]=_0x9514('0x1c');break;case _0x9514('0x1d'):_0x411738['childModel']=_0x9514('0x1e');_0x411738[_0x9514('0x17')]=[{'name':_0x9514('0x1f'),'field':'id','foreignKey':_0x9514('0x20')}];break;case _0x9514('0x21'):_0x411738[_0x9514('0x1b')]=_0x9514('0x22');break;case _0x9514('0x23'):_0x411738[_0x9514('0x1b')]=_0x9514('0x24');break;case _0x9514('0x25'):_0x411738[_0x9514('0x1b')]=_0x9514('0x26');break;case _0x9514('0x27'):_0x411738[_0x9514('0x1b')]=_0x9514('0x28');break;case'chatwebsites':_0x411738[_0x9514('0x1b')]=_0x9514('0x29');break;case _0x9514('0x2a'):_0x411738['childModel']=_0x9514('0x2b');break;case _0x9514('0x2c'):_0x411738[_0x9514('0x1b')]=_0x9514('0x2d');break;case'inboundroutes':case'internalroutes':case _0x9514('0x2e'):_0x411738[_0x9514('0x1b')]=_0x9514('0x2f');break;case _0x9514('0x30'):_0x411738['childModel']=_0x9514('0x31');break;case _0x9514('0x32'):_0x411738['childModel']=_0x9514('0x33');break;case _0x9514('0x34'):_0x411738[_0x9514('0x1b')]='VoiceRecording';_0x411738[_0x9514('0x17')]=[{'name':_0x9514('0x35'),'field':_0x9514('0x18'),'foreignKey':'membername','model':_0x9514('0x36'),'filter':{'field':'role','value':['agent']}},{'name':_0x9514('0x37'),'field':_0x9514('0x18'),'foreignKey':'membername','model':_0x9514('0x36'),'filter':{'field':'role','value':[_0x9514('0x38')]}},{'name':_0x9514('0x39'),'field':_0x9514('0x18'),'foreignKey':_0x9514('0x3a'),'model':_0x9514('0x3b'),'filter':{'field':'type','value':[_0x9514('0x3c')]}},{'name':_0x9514('0x3d'),'field':'name','foreignKey':_0x9514('0x3a'),'model':_0x9514('0x3b'),'filter':{'field':_0x9514('0xe'),'value':[_0x9514('0x3e')]}}];break;case _0x9514('0x3f'):_0x411738['childModel']='VoiceMusicOnHold';break;case _0x9514('0x40'):_0x411738[_0x9514('0x1b')]='VoiceChanSpy';break;case'voiceprefixes':_0x411738['childModel']=_0x9514('0x41');break;case _0x9514('0x42'):_0x411738['childModel']=_0x9514('0x43');break;case _0x9514('0x44'):_0x411738[_0x9514('0x1b')]=_0x9514('0x45');break;case _0x9514('0x46'):_0x411738[_0x9514('0x1b')]=_0x9514('0x47');break;case _0x9514('0x48'):_0x411738[_0x9514('0x1b')]=_0x9514('0x49');break;case _0x9514('0x4a'):_0x411738[_0x9514('0x1b')]=_0x9514('0x4b');break;case _0x9514('0x4c'):_0x411738[_0x9514('0x1b')]=_0x9514('0x4d');break;case _0x9514('0x4e'):_0x411738[_0x9514('0x1b')]=_0x9514('0x4f');break;case _0x9514('0x50'):_0x411738['childModel']=_0x9514('0x51');break;case _0x9514('0x52'):_0x411738[_0x9514('0x1b')]='WhatsappQueue';break;case _0x9514('0x53'):_0x411738[_0x9514('0x1b')]=_0x9514('0x54');break;case _0x9514('0x55'):_0x411738[_0x9514('0x1b')]='Team';break;case _0x9514('0x56'):case'queuecampaigns':_0x411738[_0x9514('0x1b')]=_0x9514('0x3b');if(_0x31d05f){_0x411738[_0x9514('0x17')]=[{'name':'VoiceQueues'},{'name':_0x9514('0x3d')}];}break;case _0x9514('0x57'):case'agents':case _0x9514('0x58'):_0x411738[_0x9514('0x1b')]=_0x9514('0x36');if(_0x31d05f){_0x411738['parentSections']=[{'name':'Users','filter':{'field':_0x9514('0x59'),'value':[_0x9514('0x5a'),'user']},'ignore':!![]},{'name':_0x9514('0x35')},{'name':_0x9514('0x37')}];}break;case _0x9514('0x5b'):_0x411738[_0x9514('0x1b')]=_0x9514('0x5c');break;case'salesforceaccounts':_0x411738['childModel']=_0x9514('0x5d');break;case _0x9514('0x5e'):_0x411738[_0x9514('0x1b')]=_0x9514('0x5f');break;case _0x9514('0x60'):_0x411738[_0x9514('0x1b')]=_0x9514('0x61');break;case _0x9514('0x62'):_0x411738['childModel']=_0x9514('0x63');break;case'zohoaccounts':_0x411738[_0x9514('0x1b')]=_0x9514('0x64');break;case _0x9514('0x65'):_0x411738['childModel']=_0x9514('0x36');break;case'cannedanswers':_0x411738[_0x9514('0x1b')]=_0x9514('0x66');break;case'dispositions':_0x411738[_0x9514('0x1b')]=_0x9514('0x67');break;case _0x9514('0x68'):_0x411738[_0x9514('0x1b')]=_0x9514('0x69');break;case'intervals':_0x411738[_0x9514('0x1b')]='Interval';break;case _0x9514('0x6a'):_0x411738[_0x9514('0x1b')]=_0x9514('0x6b');break;case _0x9514('0x6c'):_0x411738[_0x9514('0x1b')]=_0x9514('0x6d');break;case'sounds':_0x411738[_0x9514('0x1b')]=_0x9514('0x6e');break;case _0x9514('0x6f'):_0x411738['childModel']=_0x9514('0x70');break;case _0x9514('0x71'):_0x411738['childModel']=_0x9514('0x72');break;case'triggers':_0x411738[_0x9514('0x1b')]='Trigger';break;case _0x9514('0x73'):_0x411738[_0x9514('0x1b')]=_0x9514('0x74');break;case _0x9514('0x75'):_0x411738[_0x9514('0x1b')]=_0x9514('0x76');break;case'plugins':_0x411738['childModel']='Plugin';break;case _0x9514('0x77'):_0x411738[_0x9514('0x1b')]=_0x9514('0x78');_0x411738[_0x9514('0x17')]=[{'name':_0x9514('0x79'),'field':'id','foreignKey':_0x9514('0x7a')}];break;case'metrics':_0x411738['childModel']=_0x9514('0x7b');break;}return _0x411738;}function _0x595617(_0x14052c,_0x36914c){var _0x2a3885=_0x14052c[_0x9514('0x7c')](0x0)['toUpperCase']()+_0x14052c[_0x9514('0x7d')](0x1);var _0x2a968c={'type':_0x289d9b[_0x9514('0x7e')][_0x9514('0x7f')][_0x9514('0x80')],'raw':!![]};return new Promise(function(_0x402f9b,_0x25871b){var _0x10142f=squel[_0x9514('0x81')]()['field'](_0x9514('0x82')+_0x2a3885+_0x9514('0x83'),'id')[_0x9514('0x4')](_0x9514('0x84'))['from'](_0x9514('0x85')+_0x14052c+_0x9514('0x86'),'ui')[_0x9514('0x87')](_0x9514('0x88'),_0x36914c['id']);return _0x289d9b[_0x9514('0x89')][_0x9514('0x8a')](_0x10142f[_0x9514('0x8b')](),_0x2a968c)[_0x9514('0x5')](function(_0x4373c1){_0x36914c[_0x2a3885+_0x9514('0x8c')]=_0x4373c1;_0x402f9b(_0x4373c1);})[_0x9514('0x6')](function(_0x13b696){_0x25871b(_0x13b696);});});}return _0x3a4c59[_0x9514('0x8d')](_0x9514('0x8e'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x467dfd){var _0x150b54={'raw':_0x467dfd['query']['raw'],'where':{}};var _0x3c111f={};var _0x10ac89={'count':0x0,'rows':[]};var _0x2ba1ea=_0x467dfd[_0x9514('0x8a')]['section'];var _0xe937ed=_0x467dfd[_0x9514('0x8a')][_0x9514('0x8f')]||![];var _0x5d6c16=_0xd3d76(_0x2ba1ea,_0xe937ed);if(!_0x5d6c16[_0x9514('0x1b')])throw new Error('Invalid\x20section\x20\x27'+_0x2ba1ea+'\x27');var _0x182cbb=[{'name':_0x2ba1ea}];if(!_[_0x9514('0x90')](_0x5d6c16[_0x9514('0x17')]))_0x182cbb=_0x5d6c16[_0x9514('0x17')];var _0x3464b8=[];for(var _0xe2b38b=0x0;_0xe2b38b<_0x182cbb[_0x9514('0x91')];_0xe2b38b++){_0x3464b8['push'](_0x289d9b[_0x9514('0x92')][_0x9514('0x93')]({'where':{'userProfileId':_0x467dfd['params']['id'],'name':_0x182cbb[_0xe2b38b]['name']},'raw':!![]}));}return Promise['all'](_0x3464b8)[_0x9514('0x5')](function(_0x5868ad){var _0x1f4050=_[_0x9514('0x3')](_0x5868ad,function(_0x4e6204){return _0x4e6204?_0x4e6204:undefined;});var _0x3b87f3=_[_0x9514('0x3')](_0x182cbb,[_0x9514('0x94'),!![]]);var _0x1becfe=_[_0x9514('0x90')](_0x1f4050)&&_[_0x9514('0x90')](_0x3b87f3)?null:_['union'](_0x3b87f3,_0x1f4050);if(!_0x1becfe)return null;var _0x2f7cde=[];for(var _0x2b35d2=0x0;_0x2b35d2<_0x1becfe[_0x9514('0x91')];_0x2b35d2++){var _0x468db1=_[_0x9514('0x93')](_0x182cbb,function(_0x385010){return _0x1becfe[_0x2b35d2]?_0x385010[_0x9514('0x18')]===_0x1becfe[_0x2b35d2][_0x9514('0x18')]:null;});if(_0x468db1){if(_0x1becfe[_0x2b35d2][_0x9514('0x94')]){_0x2f7cde['push'](_0x58ddf5(_0x5d6c16[_0x9514('0x1b')],_0x1becfe[_0x2b35d2]));}else{if(!_0x1becfe[_0x2b35d2][_0x9514('0x95')]){_0x2f7cde[_0x9514('0x96')](_0x1991cf(_0x468db1,_0x1becfe[_0x2b35d2],_0x5d6c16[_0x9514('0x1b')]));}else{if(_0x468db1['model']){_0x2f7cde[_0x9514('0x96')](_0x404a04(_0x468db1,_0x1becfe[_0x2b35d2]));}}}}}return Promise[_0x9514('0x97')](_0x2f7cde);})[_0x9514('0x5')](function(_0x441512){var _0xe466c4=_0x441512;var _0x1406a6=null;if(_0xe466c4){_0x1406a6=_0xe466c4[_0x9514('0x91')]===0x1?_0xe466c4[0x0]:null;}if(!_0x1406a6&&!_0xe466c4)return _0x10ac89;var _0x3d0a2d=_0x289d9b[_0x5d6c16[_0x9514('0x1b')]][_0x9514('0x98')];_0x3c111f[_0x9514('0x8')]=_['keys'](_0x3d0a2d);_0x3c111f[_0x9514('0x8a')]=_['keys'](_0x467dfd[_0x9514('0x8a')]);_0x3c111f[_0x9514('0x99')]=_[_0x9514('0x9a')](_0x3c111f['model'],_0x3c111f['query']);_0x150b54['attributes']=_['intersection'](_0x3c111f[_0x9514('0x8')],qs[_0x9514('0x9b')](_0x467dfd[_0x9514('0x8a')][_0x9514('0x9b')]));_0x150b54[_0x9514('0x9c')]=_0x150b54[_0x9514('0x9c')]['length']?_0x150b54[_0x9514('0x9c')]:_0x3c111f[_0x9514('0x8')];if(!_0x467dfd[_0x9514('0x8a')]['hasOwnProperty']('nolimit')){_0x150b54[_0x9514('0x9d')]=qs['limit'](_0x467dfd[_0x9514('0x8a')][_0x9514('0x9d')]);_0x150b54[_0x9514('0x9e')]=qs[_0x9514('0x9e')](_0x467dfd[_0x9514('0x8a')][_0x9514('0x9e')]);}_0x150b54['order']=qs['sort'](_0x467dfd[_0x9514('0x8a')]['sort']);_0x150b54[_0x9514('0x87')]=qs['filters'](_[_0x9514('0x9f')](_0x467dfd[_0x9514('0x8a')],_0x3c111f[_0x9514('0x99')]));if(_0x467dfd[_0x9514('0x8a')][_0x9514('0x3')]){_0x150b54[_0x9514('0x87')]=_[_0x9514('0xa0')](_0x150b54[_0x9514('0x87')],{'$or':_[_0x9514('0x9')](_0x3d0a2d,function(_0x1390b3){if(_0x1390b3[_0x9514('0xe')][_0x9514('0xa1')]!==_0x9514('0xa2')){var _0x101bef={};_0x101bef[_0x1390b3['field']]={'$like':'%'+_0x467dfd[_0x9514('0x8a')]['filter']+'%'};return _0x101bef;}})});}var _0x28d022=[];var _0x56f6e5=null;var _0x23979e={};if(_0x1406a6){_0x56f6e5=_['find'](_0x182cbb,[_0x9514('0x18'),_0x1406a6['name']]);if(_0x56f6e5[_0x9514('0x4')]){_0x23979e={};if(_0x5d6c16[_0x9514('0x1b')]===_0x9514('0x78')){_0x23979e[_0x56f6e5[_0x9514('0xa3')]]=_[_0x9514('0x9')](_0x1406a6[_0x9514('0xd')],'id');}else{_0x23979e[_0x56f6e5[_0x9514('0xa3')]]=_0x1406a6[_0x9514('0xd')];}_0x28d022[_0x9514('0x96')](_0x23979e);}else{_0x150b54[_0x9514('0x87')]['id']=_0x1406a6[_0x9514('0xd')];}}else{for(var _0x433773=0x0;_0x433773<_0xe466c4[_0x9514('0x91')];_0x433773++){_0x56f6e5=_['find'](_0x182cbb,['name',_0xe466c4[_0x433773][_0x9514('0x18')]]);if(_0x56f6e5['field']){_0x23979e={};_0x23979e[_0x56f6e5[_0x9514('0xa3')]]=_0xe466c4[_0x433773][_0x9514('0xd')];_0x28d022['push'](_0x23979e);}else{if(!_0x150b54[_0x9514('0x87')]['id'])_0x150b54[_0x9514('0x87')]['id']=[];_0xe466c4[_0x433773][_0x9514('0xd')][_0x9514('0xa4')](function(_0x1ccb82){_0x150b54[_0x9514('0x87')]['id'][_0x9514('0x96')](_0x1ccb82);});}}}if(!_['isEmpty'](_0x28d022)){_0x150b54[_0x9514('0x87')]=_[_0x9514('0xa0')](_0x150b54[_0x9514('0x87')],{'$and':{'$or':_0x28d022}});}_0x150b54=_[_0x9514('0xa0')]({},_0x150b54,_0x467dfd['options']);if(_0x1406a6&&!_0x1406a6[_0x9514('0x95')]&&_0x5d6c16[_0x9514('0x1b')]===_0x9514('0x78')){if(_0x467dfd[_0x9514('0x8a')]['includeAll']){_0x150b54['include']=[{'all':!![]}];}return _0x289d9b[_0x5d6c16[_0x9514('0x1b')]]['findAll'](_0x150b54)[_0x9514('0x5')](function(_0x3e7509){var _0x200353=[];_0x3e7509[_0x9514('0xa4')](function(_0x21524f){var _0x159c10;switch(_0x21524f[_0x9514('0xa5')]){case'default':_0x159c10=_[_0x9514('0x93')](_0x1406a6[_0x9514('0xd')],function(_0x297c0e){return _0x297c0e['id']===_0x21524f['reportId']&&_0x297c0e['type']===_0x9514('0xa6');});break;case _0x9514('0xa7'):_0x159c10=_['find'](_0x1406a6['associatedResources'],function(_0x1923a8){return _0x1923a8['id']===_0x21524f[_0x9514('0x7a')]&&_0x1923a8[_0x9514('0xe')]===_0x9514('0xa8');});break;}if(_0x159c10)_0x200353['push'](_0x21524f);});_0x10ac89[_0x9514('0xa9')]=_0x200353['length'];_0x10ac89[_0x9514('0xaa')]=_0x200353;return _0x10ac89;});}else{return _0x289d9b[_0x5d6c16[_0x9514('0x1b')]][_0x9514('0xa9')]({'where':_0x150b54['where']})[_0x9514('0x5')](function(_0x4763a6){_0x10ac89[_0x9514('0xa9')]=_0x4763a6;if(_0x467dfd[_0x9514('0x8a')][_0x9514('0xab')]){if(_0x5d6c16[_0x9514('0x1b')]===_0x9514('0x1e')){_0x150b54[_0x9514('0xac')]=[{'model':_0x289d9b[_0x9514('0x70')],'as':_0x9514('0xad'),'attributes':['id','name',_0x9514('0xae')],'required':_0x467dfd[_0x9514('0x8a')][_0x9514('0xaf')]?!![]:![]},{'model':_0x289d9b[_0x9514('0x70')],'as':_0x9514('0xb0'),'attributes':['id',_0x9514('0x18'),_0x9514('0xae')],'through':_0x467dfd[_0x9514('0x8a')]['tag']?{'attributes':[],'where':{'TagId':_0x467dfd[_0x9514('0x8a')][_0x9514('0xaf')]||undefined}}:{},'required':_0x467dfd['query'][_0x9514('0xaf')]?!![]:![]}];}else{_0x150b54[_0x9514('0xac')]=[{'all':!![]}];}}return _0x289d9b[_0x5d6c16['childModel']][_0x9514('0xc')](_0x150b54);})[_0x9514('0x5')](function(_0x119159){_0x10ac89[_0x9514('0xaa')]=_0x119159;if(_0x2ba1ea==='Agents'&&_0x467dfd[_0x9514('0x8a')]['openTabs']===_0x9514('0xb1')){var _0x425929=[];for(var _0x495dec=0x0;_0x495dec<_0x10ac89['rows'][_0x9514('0x91')];_0x495dec++){_0x425929[_0x9514('0x96')](_0x595617(_0x9514('0xb2'),_0x10ac89['rows'][_0x495dec]['dataValues']));_0x425929['push'](_0x595617(_0x9514('0xb3'),_0x10ac89[_0x9514('0xaa')][_0x495dec][_0x9514('0xb4')]));_0x425929[_0x9514('0x96')](_0x595617('fax',_0x10ac89[_0x9514('0xaa')][_0x495dec][_0x9514('0xb4')]));_0x425929[_0x9514('0x96')](_0x595617(_0x9514('0xb5'),_0x10ac89['rows'][_0x495dec]['dataValues']));_0x425929[_0x9514('0x96')](_0x595617(_0x9514('0xb6'),_0x10ac89[_0x9514('0xaa')][_0x495dec][_0x9514('0xb4')]));_0x425929[_0x9514('0x96')](_0x595617('whatsapp',_0x10ac89[_0x9514('0xaa')][_0x495dec][_0x9514('0xb4')]));}return Promise[_0x9514('0x97')](_0x425929)[_0x9514('0x5')](function(){return _0x10ac89;});}return _0x10ac89;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3717a38..cf446c1 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 _0x82c4=['then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x1332c4,_0x454efc){var _0x4b9678=function(_0x3b9649){while(--_0x3b9649){_0x1332c4['push'](_0x1332c4['shift']());}};_0x4b9678(++_0x454efc);}(_0x82c4,0x1ca));var _0x482c=function(_0x2d305b,_0x459d7c){_0x2d305b=_0x2d305b-0x0;var _0x52be39=_0x82c4[_0x2d305b];return _0x52be39;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});config[_0x482c('0xa')]=_[_0x482c('0xb')](config[_0x482c('0xa')],{'host':_0x482c('0xc'),'port':0x18eb});var socket=require(_0x482c('0xd'))(new Redis(config['redis']));require(_0x482c('0xe'))[_0x482c('0xf')](socket);function respondWithRpcPromise(_0x3859ad,_0xc59d41,_0x3c6c56){return new BPromise(function(_0x17e233,_0x51967f){return client[_0x482c('0x10')](_0x3859ad,_0x3c6c56)[_0x482c('0x11')](function(_0x1ed3ff){logger['info'](_0x482c('0x12'),_0xc59d41,_0x482c('0x13'));logger[_0x482c('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xc59d41,'request\x20sent',JSON[_0x482c('0x15')](_0x1ed3ff));if(_0x1ed3ff[_0x482c('0x16')]){if(_0x1ed3ff['error']['code']===0x1f4){logger[_0x482c('0x16')](_0x482c('0x12'),_0xc59d41,_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);return _0x51967f(_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);}logger[_0x482c('0x16')](_0x482c('0x12'),_0xc59d41,_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);return _0x17e233(_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);}else{logger['info'](_0x482c('0x12'),_0xc59d41,'request\x20sent');_0x17e233(_0x1ed3ff[_0x482c('0x18')][_0x482c('0x17')]);}})['catch'](function(_0x4bd270){logger[_0x482c('0x16')]('UserProfile,\x20%s,\x20%s',_0xc59d41,_0x4bd270);_0x51967f(_0x4bd270);});});} \ No newline at end of file +var _0x27a0=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http'];(function(_0x41262b,_0x261404){var _0x1c6d9d=function(_0x221ebc){while(--_0x221ebc){_0x41262b['push'](_0x41262b['shift']());}};_0x1c6d9d(++_0x261404);}(_0x27a0,0xbf));var _0x027a=function(_0x3d7bf9,_0xf5499f){_0x3d7bf9=_0x3d7bf9-0x0;var _0x5a9872=_0x27a0[_0x3d7bf9];return _0x5a9872;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});config[_0x027a('0x9')]=_[_0x027a('0xa')](config['redis'],{'host':_0x027a('0xb'),'port':0x18eb});var socket=require(_0x027a('0xc'))(new Redis(config[_0x027a('0x9')]));require('./userProfile.socket')[_0x027a('0xd')](socket);function respondWithRpcPromise(_0x42ccac,_0x2d13a2,_0x534902){return new BPromise(function(_0x6d5b04,_0xe5df59){return client[_0x027a('0xe')](_0x42ccac,_0x534902)[_0x027a('0xf')](function(_0x172eb4){logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));logger[_0x027a('0x13')](_0x027a('0x14'),_0x2d13a2,_0x027a('0x12'),JSON['stringify'](_0x172eb4));if(_0x172eb4[_0x027a('0x15')]){if(_0x172eb4[_0x027a('0x15')][_0x027a('0x16')]===0x1f4){logger[_0x027a('0x15')](_0x027a('0x11'),_0x2d13a2,_0x172eb4['error']['message']);return _0xe5df59(_0x172eb4[_0x027a('0x15')]['message']);}logger[_0x027a('0x15')]('UserProfile,\x20%s,\x20%s',_0x2d13a2,_0x172eb4[_0x027a('0x15')]['message']);return _0x6d5b04(_0x172eb4['error']['message']);}else{logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));_0x6d5b04(_0x172eb4[_0x027a('0x17')]['message']);}})[_0x027a('0x18')](function(_0x2fccf6){logger['error']('UserProfile,\x20%s,\x20%s',_0x2d13a2,_0x2fccf6);_0xe5df59(_0x2fccf6);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 15c5f0a..96143a8 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 _0x4f32=['save','userProfile:','./userProfile.events'];(function(_0x346c99,_0x28829b){var _0x593189=function(_0x2f20c4){while(--_0x2f20c4){_0x346c99['push'](_0x346c99['shift']());}};_0x593189(++_0x28829b);}(_0x4f32,0x116));var _0x24f3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4f32[_0x2dafbe];return _0x58a45a;};'use strict';var UserProfileEvents=require(_0x24f3('0x0'));var events=[_0x24f3('0x1'),'remove','update'];function createListener(_0x458229,_0x5dbc1c){return function(_0x17ba3e){_0x5dbc1c['emit'](_0x458229,_0x17ba3e);};}function removeListener(_0x5d81bd,_0x393f47){return function(){UserProfileEvents['removeListener'](_0x5d81bd,_0x393f47);};}exports['register']=function(_0x3de688){for(var _0x345d46=0x0,_0x5e6ebd=events['length'];_0x345d46<_0x5e6ebd;_0x345d46++){var _0x3d84c2=events[_0x345d46];var _0x540715=createListener(_0x24f3('0x2')+_0x3d84c2,_0x3de688);UserProfileEvents['on'](_0x3d84c2,_0x540715);}}; \ No newline at end of file +var _0xd10a=['remove','update','emit','removeListener','length','./userProfile.events','save'];(function(_0x2d5eac,_0x40c425){var _0x57d926=function(_0x5cf8e1){while(--_0x5cf8e1){_0x2d5eac['push'](_0x2d5eac['shift']());}};_0x57d926(++_0x40c425);}(_0xd10a,0x1e8));var _0xad10=function(_0x3c07c8,_0x553ecd){_0x3c07c8=_0x3c07c8-0x0;var _0x1ef9b1=_0xd10a[_0x3c07c8];return _0x1ef9b1;};'use strict';var UserProfileEvents=require(_0xad10('0x0'));var events=[_0xad10('0x1'),_0xad10('0x2'),_0xad10('0x3')];function createListener(_0x7e53e2,_0x147dc7){return function(_0x4650c7){_0x147dc7[_0xad10('0x4')](_0x7e53e2,_0x4650c7);};}function removeListener(_0x19c6bc,_0x358a69){return function(){UserProfileEvents[_0xad10('0x5')](_0x19c6bc,_0x358a69);};}exports['register']=function(_0x1086fe){for(var _0x1a52f3=0x0,_0x10576f=events[_0xad10('0x6')];_0x1a52f3<_0x10576f;_0x1a52f3++){var _0x30a3dc=events[_0x1a52f3];var _0xa31b5e=createListener('userProfile:'+_0x30a3dc,_0x1086fe);UserProfileEvents['on'](_0x30a3dc,_0xa31b5e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 18d7fa6..99c4267 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 _0xfbac=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfileResource.controller','index','/describe','describe','get','isAuthenticated','show','post','create','put','/:id','update','delete','util'];(function(_0x1a84aa,_0x2366e7){var _0x1bf452=function(_0x536dc6){while(--_0x536dc6){_0x1a84aa['push'](_0x1a84aa['shift']());}};_0x1bf452(++_0x2366e7);}(_0xfbac,0x167));var _0xcfba=function(_0x1e3508,_0x4f2c9b){_0x1e3508=_0x1e3508-0x0;var _0x5cb3c7=_0xfbac[_0x1e3508];return _0x5cb3c7;};'use strict';var multer=require('multer');var util=require(_0xcfba('0x0'));var path=require(_0xcfba('0x1'));var timeout=require(_0xcfba('0x2'));var express=require(_0xcfba('0x3'));var router=express[_0xcfba('0x4')]();var fs_extra=require(_0xcfba('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcfba('0x6'));var controller=require(_0xcfba('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfba('0x8')]);router['get'](_0xcfba('0x9'),auth['isAuthenticated'](),controller[_0xcfba('0xa')]);router[_0xcfba('0xb')]('/:id',auth[_0xcfba('0xc')](),controller[_0xcfba('0xd')]);router[_0xcfba('0xe')]('/',auth[_0xcfba('0xc')](),controller[_0xcfba('0xf')]);router[_0xcfba('0x10')](_0xcfba('0x11'),auth[_0xcfba('0xc')](),controller[_0xcfba('0x12')]);router[_0xcfba('0x13')](_0xcfba('0x11'),auth[_0xcfba('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc2c3=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x23a477,_0x36bd86){var _0x1a6fb2=function(_0x4e9f26){while(--_0x4e9f26){_0x23a477['push'](_0x23a477['shift']());}};_0x1a6fb2(++_0x36bd86);}(_0xc2c3,0x16b));var _0x3c2c=function(_0x1d1505,_0x4e16e1){_0x1d1505=_0x1d1505-0x0;var _0x5a04f3=_0xc2c3[_0x1d1505];return _0x5a04f3;};'use strict';var multer=require(_0x3c2c('0x0'));var util=require('util');var path=require(_0x3c2c('0x1'));var timeout=require(_0x3c2c('0x2'));var express=require(_0x3c2c('0x3'));var router=express[_0x3c2c('0x4')]();var fs_extra=require(_0x3c2c('0x5'));var auth=require(_0x3c2c('0x6'));var interaction=require(_0x3c2c('0x7'));var config=require(_0x3c2c('0x8'));var controller=require('./userProfileResource.controller');router[_0x3c2c('0x9')]('/',auth[_0x3c2c('0xa')](),controller[_0x3c2c('0xb')]);router[_0x3c2c('0x9')](_0x3c2c('0xc'),auth[_0x3c2c('0xa')](),controller['describe']);router['get'](_0x3c2c('0xd'),auth[_0x3c2c('0xa')](),controller[_0x3c2c('0xe')]);router[_0x3c2c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3c2c('0x10')](_0x3c2c('0xd'),auth[_0x3c2c('0xa')](),controller[_0x3c2c('0x11')]);router[_0x3c2c('0x12')]('/:id',auth[_0x3c2c('0xa')](),controller[_0x3c2c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index fc701b0..9278203 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 _0x1471=['INTEGER','sequelize','STRING'];(function(_0x46bf80,_0x28e76a){var _0x558a67=function(_0x4eb35d){while(--_0x4eb35d){_0x46bf80['push'](_0x46bf80['shift']());}};_0x558a67(++_0x28e76a);}(_0x1471,0x18d));var _0x1147=function(_0x34eafe,_0x404e92){_0x34eafe=_0x34eafe-0x0;var _0x3b3bb5=_0x1471[_0x34eafe];return _0x3b3bb5;};'use strict';var Sequelize=require(_0x1147('0x0'));module['exports']={'name':{'type':Sequelize[_0x1147('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1147('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0d13=['INTEGER','STRING'];(function(_0x220dad,_0x42b465){var _0x53c9ff=function(_0x56af33){while(--_0x56af33){_0x220dad['push'](_0x220dad['shift']());}};_0x53c9ff(++_0x42b465);}(_0x0d13,0xf9));var _0x30d1=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x0d13[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x30d1('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x30d1('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index dbe5f9f..9f69ebe 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 _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../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','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1623,0xab));var _0x3162=function(_0x43d577,_0x84761f){_0x43d577=_0x43d577-0x0;var _0xdb14e7=_0x1623[_0x43d577];return _0xdb14e7;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file +var _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x4add18,_0x30cb5f){var _0x43edc6=function(_0x50cdf9){while(--_0x50cdf9){_0x4add18['push'](_0x4add18['shift']());}};_0x43edc6(++_0x30cb5f);}(_0x33af,0xec));var _0xf33a=function(_0x140931,_0x2ffeba){_0x140931=_0x140931-0x0;var _0x4718ab=_0x33af[_0x140931];return _0x4718ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['UserProfileResource'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['UserProfileResource'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index bc47dc1..4750e5a 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 _0xae50=['exports','define','compositeIndex','resourceId','lodash','util','api','moment','bluebird','path'];(function(_0x265860,_0x307636){var _0x1915af=function(_0x5871da){while(--_0x5871da){_0x265860['push'](_0x265860['shift']());}};_0x1915af(++_0x307636);}(_0xae50,0xe0));var _0x0ae5=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xae50[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0x0ae5('0x0'));var util=require(_0x0ae5('0x1'));var logger=require('../../config/logger')(_0x0ae5('0x2'));var moment=require(_0x0ae5('0x3'));var BPromise=require(_0x0ae5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ae5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x0ae5('0x6')]=function(_0x25b737,_0xb9cc07){return _0x25b737[_0x0ae5('0x7')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x0ae5('0x8'),'fields':[_0x0ae5('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x51d0=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x1953a9,_0x556ffc){var _0x5c9c61=function(_0x30b48c){while(--_0x30b48c){_0x1953a9['push'](_0x1953a9['shift']());}};_0x5c9c61(++_0x556ffc);}(_0x51d0,0x1d7));var _0x051d=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x51d0[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0x051d('0x0'));var util=require('util');var logger=require(_0x051d('0x1'))(_0x051d('0x2'));var moment=require(_0x051d('0x3'));var BPromise=require(_0x051d('0x4'));var rp=require(_0x051d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x051d('0x6'));var config=require(_0x051d('0x7'));var attributes=require(_0x051d('0x8'));module[_0x051d('0x9')]=function(_0x2e265b,_0x34c413){return _0x2e265b[_0x051d('0xa')](_0x051d('0xb'),attributes,{'tableName':_0x051d('0xc'),'paranoid':![],'indexes':[{'name':_0x051d('0xd'),'fields':[_0x051d('0xe'),_0x051d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 40853d9..e6a5cb0 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 _0x330c=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2f4830,_0x3be74b){var _0x224115=function(_0x6ce92){while(--_0x6ce92){_0x2f4830['push'](_0x2f4830['shift']());}};_0x224115(++_0x3be74b);}(_0x330c,0x14e));var _0xc330=function(_0x5c8f85,_0x7957cc){_0x5c8f85=_0x5c8f85-0x0;var _0x319d90=_0x330c[_0x5c8f85];return _0x319d90;};'use strict';var _=require('lodash');var util=require(_0xc330('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc330('0x1'));var fs=require('fs');var Redis=require(_0xc330('0x2'));var db=require(_0xc330('0x3'))['db'];var utils=require(_0xc330('0x4'));var logger=require(_0xc330('0x5'))('rpc');var config=require(_0xc330('0x6'));var jayson=require(_0xc330('0x7'));var client=jayson[_0xc330('0x8')][_0xc330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360d53,_0x1d9ffa,_0x560fdb){return new BPromise(function(_0x404a8d,_0x3e19ef){return client[_0xc330('0xa')](_0x360d53,_0x560fdb)[_0xc330('0xb')](function(_0x2a3d7b){logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,_0xc330('0xe'));logger[_0xc330('0xf')](_0xc330('0x10'),_0x1d9ffa,_0xc330('0xe'),JSON[_0xc330('0x11')](_0x2a3d7b));if(_0x2a3d7b[_0xc330('0x12')]){if(_0x2a3d7b['error'][_0xc330('0x13')]===0x1f4){logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);return _0x3e19ef(_0x2a3d7b[_0xc330('0x12')]['message']);}logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b['error'][_0xc330('0x14')]);return _0x404a8d(_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);}else{logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,'request\x20sent');_0x404a8d(_0x2a3d7b[_0xc330('0x15')][_0xc330('0x14')]);}})[_0xc330('0x16')](function(_0x5f5ab7){logger[_0xc330('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1d9ffa,_0x5f5ab7);_0x3e19ef(_0x5f5ab7);});});} \ No newline at end of file +var _0x8266=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5265f9,_0x12efe3){var _0x24a468=function(_0x12bff){while(--_0x12bff){_0x5265f9['push'](_0x5265f9['shift']());}};_0x24a468(++_0x12efe3);}(_0x8266,0x18e));var _0x6826=function(_0xa06493,_0x42a829){_0xa06493=_0xa06493-0x0;var _0x4c8b06=_0x8266[_0xa06493];return _0x4c8b06;};'use strict';var _=require(_0x6826('0x0'));var util=require(_0x6826('0x1'));var moment=require(_0x6826('0x2'));var BPromise=require(_0x6826('0x3'));var rs=require(_0x6826('0x4'));var fs=require('fs');var Redis=require(_0x6826('0x5'));var db=require(_0x6826('0x6'))['db'];var utils=require(_0x6826('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6826('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6826('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d39dc,_0x45f8fe,_0x268aa9){return new BPromise(function(_0x52f465,_0x4da917){return client[_0x6826('0xa')](_0x1d39dc,_0x268aa9)[_0x6826('0xb')](function(_0x3a51f9){logger[_0x6826('0xc')](_0x6826('0xd'),_0x45f8fe,'request\x20sent');logger[_0x6826('0xe')](_0x6826('0xf'),_0x45f8fe,_0x6826('0x10'),JSON[_0x6826('0x11')](_0x3a51f9));if(_0x3a51f9[_0x6826('0x12')]){if(_0x3a51f9[_0x6826('0x12')][_0x6826('0x13')]===0x1f4){logger[_0x6826('0x12')](_0x6826('0xd'),_0x45f8fe,_0x3a51f9[_0x6826('0x12')][_0x6826('0x14')]);return _0x4da917(_0x3a51f9[_0x6826('0x12')]['message']);}logger[_0x6826('0x12')](_0x6826('0xd'),_0x45f8fe,_0x3a51f9[_0x6826('0x12')]['message']);return _0x52f465(_0x3a51f9[_0x6826('0x12')][_0x6826('0x14')]);}else{logger[_0x6826('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x45f8fe,_0x6826('0x10'));_0x52f465(_0x3a51f9[_0x6826('0x15')][_0x6826('0x14')]);}})['catch'](function(_0x223616){logger[_0x6826('0x12')](_0x6826('0xd'),_0x45f8fe,_0x223616);_0x4da917(_0x223616);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9f01131..7cfa91c 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 _0x6d0e=['get','index','/describe','describe','/:id','isAuthenticated','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb8d9bc,_0x1cea27){var _0x2fbc8e=function(_0x15b2c4){while(--_0x15b2c4){_0xb8d9bc['push'](_0xb8d9bc['shift']());}};_0x2fbc8e(++_0x1cea27);}(_0x6d0e,0x127));var _0xe6d0=function(_0x548991,_0x12889a){_0x548991=_0x548991-0x0;var _0x274119=_0x6d0e[_0x548991];return _0x274119;};'use strict';var multer=require(_0xe6d0('0x0'));var util=require(_0xe6d0('0x1'));var path=require(_0xe6d0('0x2'));var timeout=require(_0xe6d0('0x3'));var express=require(_0xe6d0('0x4'));var router=express[_0xe6d0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe6d0('0x6'));var interaction=require(_0xe6d0('0x7'));var config=require(_0xe6d0('0x8'));var controller=require('./userProfileSection.controller');router[_0xe6d0('0x9')]('/',auth['isAuthenticated'](),controller[_0xe6d0('0xa')]);router[_0xe6d0('0x9')](_0xe6d0('0xb'),auth['isAuthenticated'](),controller[_0xe6d0('0xc')]);router['get'](_0xe6d0('0xd'),auth[_0xe6d0('0xe')](),controller['show']);router[_0xe6d0('0xf')]('/',auth[_0xe6d0('0xe')](),controller['create']);router[_0xe6d0('0x10')](_0xe6d0('0xd'),auth[_0xe6d0('0xe')](),controller[_0xe6d0('0x11')]);router['delete'](_0xe6d0('0xd'),auth[_0xe6d0('0xe')](),controller[_0xe6d0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc7a2=['/:id','show','post','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x2f5137,_0x329fb6){var _0x582f81=function(_0x2f0225){while(--_0x2f0225){_0x2f5137['push'](_0x2f5137['shift']());}};_0x582f81(++_0x329fb6);}(_0xc7a2,0x15b));var _0x2c7a=function(_0x5bc8d1,_0x5800fe){_0x5bc8d1=_0x5bc8d1-0x0;var _0x5db7d0=_0xc7a2[_0x5bc8d1];return _0x5db7d0;};'use strict';var multer=require(_0x2c7a('0x0'));var util=require('util');var path=require(_0x2c7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x2c7a('0x2'));var router=express[_0x2c7a('0x3')]();var fs_extra=require(_0x2c7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2c7a('0x5'));var config=require(_0x2c7a('0x6'));var controller=require(_0x2c7a('0x7'));router['get']('/',auth[_0x2c7a('0x8')](),controller[_0x2c7a('0x9')]);router[_0x2c7a('0xa')](_0x2c7a('0xb'),auth[_0x2c7a('0x8')](),controller[_0x2c7a('0xc')]);router[_0x2c7a('0xa')](_0x2c7a('0xd'),auth[_0x2c7a('0x8')](),controller[_0x2c7a('0xe')]);router[_0x2c7a('0xf')]('/',auth[_0x2c7a('0x8')](),controller[_0x2c7a('0x10')]);router['put'](_0x2c7a('0xd'),auth[_0x2c7a('0x8')](),controller[_0x2c7a('0x11')]);router[_0x2c7a('0x12')]('/:id',auth[_0x2c7a('0x8')](),controller['destroy']);module[_0x2c7a('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6da3809..9e7eb1d 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 _0x97c1=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x57580f,_0x241af8){var _0x418eaa=function(_0x2c3085){while(--_0x2c3085){_0x57580f['push'](_0x57580f['shift']());}};_0x418eaa(++_0x241af8);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x197c('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x197c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x197c('0x2')],'set':function(_0x26833e){this[_0x197c('0x4')](_0x197c('0x5'),_0x26833e?_0x26833e['join'](''):[]);},'get':function(){return this['getDataValue'](_0x197c('0x5'))?this[_0x197c('0x6')](_0x197c('0x5'))[_0x197c('0x7')](''):[];}}}; \ No newline at end of file +var _0x056b=['getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x5c9ebf,_0x462c1c){var _0x3f539e=function(_0xd00a3c){while(--_0xd00a3c){_0x5c9ebf['push'](_0x5c9ebf['shift']());}};_0x3f539e(++_0x462c1c);}(_0x056b,0xb6));var _0xb056=function(_0x1dc697,_0x443268){_0x1dc697=_0x1dc697-0x0;var _0xc24af4=_0x056b[_0x1dc697];return _0xc24af4;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb056('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb056('0x1')],'set':function(_0x4157e0){this[_0xb056('0x4')](_0xb056('0x5'),_0x4157e0?_0x4157e0[_0xb056('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xb056('0x5'))?this[_0xb056('0x7')](_0xb056('0x5'))[_0xb056('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e0c3d60..2e1f8f6 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 _0x36d9=['send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','then','destroy','end','error','stack','name'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x36d9,0x15c));var _0x936d=function(_0x2ed279,_0x208b52){_0x2ed279=_0x2ed279-0x0;var _0x14c267=_0x36d9[_0x2ed279];return _0x14c267;};'use strict';var emlformat=require(_0x936d('0x0'));var rimraf=require(_0x936d('0x1'));var zipdir=require(_0x936d('0x2'));var jsonpatch=require(_0x936d('0x3'));var rp=require(_0x936d('0x4'));var moment=require(_0x936d('0x5'));var BPromise=require(_0x936d('0x6'));var Mustache=require(_0x936d('0x7'));var util=require(_0x936d('0x8'));var path=require('path');var sox=require(_0x936d('0x9'));var csv=require(_0x936d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x936d('0xb'));var squel=require(_0x936d('0xc'));var crypto=require(_0x936d('0xd'));var jsforce=require(_0x936d('0xe'));var deskjs=require(_0x936d('0xf'));var toCsv=require(_0x936d('0xa'));var querystring=require(_0x936d('0x10'));var Papa=require('papaparse');var Redis=require(_0x936d('0x11'));var authService=require(_0x936d('0x12'));var qs=require(_0x936d('0x13'));var as=require(_0x936d('0x14'));var hardwareService=require(_0x936d('0x15'));var logger=require('../../config/logger')(_0x936d('0x16'));var utils=require(_0x936d('0x17'));var config=require(_0x936d('0x18'));var licenseUtil=require(_0x936d('0x19'));var db=require(_0x936d('0x1a'))['db'];function respondWithStatusCode(_0x444414,_0x6fea2f){_0x6fea2f=_0x6fea2f||0xcc;return function(_0x2d178d){if(_0x2d178d){return _0x444414[_0x936d('0x1b')](_0x6fea2f);}return _0x444414[_0x936d('0x1c')](_0x6fea2f)['end']();};}function respondWithResult(_0xbad7ff,_0x393a9c){_0x393a9c=_0x393a9c||0xc8;return function(_0x308b8d){if(_0x308b8d){return _0xbad7ff[_0x936d('0x1c')](_0x393a9c)['json'](_0x308b8d);}};}function respondWithFilteredResult(_0x1d382b,_0x2c954d){return function(_0x1c7ea7){if(_0x1c7ea7){var _0x51bf4f=typeof _0x2c954d[_0x936d('0x1d')]==='undefined'&&typeof _0x2c954d[_0x936d('0x1e')]===_0x936d('0x1f');var _0xa22523=_0x1c7ea7[_0x936d('0x20')];var _0x5888ad=_0x51bf4f?0x0:_0x2c954d[_0x936d('0x1d')];var _0x513987=_0x51bf4f?_0x1c7ea7[_0x936d('0x20')]:_0x2c954d[_0x936d('0x1d')]+_0x2c954d[_0x936d('0x1e')];var _0x56fdc0;if(_0x513987>=_0xa22523){_0x513987=_0xa22523;_0x56fdc0=0xc8;}else{_0x56fdc0=0xce;}_0x1d382b[_0x936d('0x1c')](_0x56fdc0);return _0x1d382b[_0x936d('0x21')](_0x936d('0x22'),_0x5888ad+'-'+_0x513987+'/'+_0xa22523)[_0x936d('0x23')](_0x1c7ea7);}return null;};}function patchUpdates(_0x2abd6b){return function(_0xf6645e){try{jsonpatch['apply'](_0xf6645e,_0x2abd6b,!![]);}catch(_0x3b8f95){return BPromise['reject'](_0x3b8f95);}return _0xf6645e['save']();};}function saveUpdates(_0x5551e4,_0x2f3ba5){return function(_0x3e60e9){if(_0x3e60e9){return _0x3e60e9['update'](_0x5551e4)[_0x936d('0x24')](function(_0xb810e9){return _0xb810e9;});}return null;};}function removeEntity(_0x28676b,_0x58fd27){return function(_0x4e9eea){if(_0x4e9eea){return _0x4e9eea[_0x936d('0x25')]()['then'](function(){_0x28676b[_0x936d('0x1c')](0xcc)[_0x936d('0x26')]();});}};}function handleEntityNotFound(_0x599c57,_0x5a1b51){return function(_0x1a86ce){if(!_0x1a86ce){_0x599c57[_0x936d('0x1b')](0x194);}return _0x1a86ce;};}function handleError(_0x20034c,_0x52390e){_0x52390e=_0x52390e||0x1f4;return function(_0x324fe9){logger[_0x936d('0x27')](_0x324fe9[_0x936d('0x28')]);if(_0x324fe9[_0x936d('0x29')]){delete _0x324fe9['name'];}_0x20034c[_0x936d('0x1c')](_0x52390e)[_0x936d('0x2a')](_0x324fe9);};}exports[_0x936d('0x2b')]=function(_0xe2ca32,_0x5ced64){var _0x27d734={},_0x3c6fc5={},_0x3f8f68={'count':0x0,'rows':[]};var _0x58540=_[_0x936d('0x2c')](db[_0x936d('0x2d')][_0x936d('0x2e')],function(_0x5cac0e){return{'name':_0x5cac0e[_0x936d('0x2f')],'type':_0x5cac0e['type'][_0x936d('0x30')]};});_0x3c6fc5[_0x936d('0x31')]=_['map'](_0x58540,'name');_0x3c6fc5['query']=_[_0x936d('0x32')](_0xe2ca32[_0x936d('0x33')]);_0x3c6fc5[_0x936d('0x34')]=_['intersection'](_0x3c6fc5[_0x936d('0x31')],_0x3c6fc5[_0x936d('0x33')]);_0x27d734[_0x936d('0x35')]=_[_0x936d('0x36')](_0x3c6fc5[_0x936d('0x31')],qs[_0x936d('0x37')](_0xe2ca32['query']['fields']));_0x27d734['attributes']=_0x27d734['attributes']['length']?_0x27d734[_0x936d('0x35')]:_0x3c6fc5['model'];if(!_0xe2ca32[_0x936d('0x33')][_0x936d('0x38')]('nolimit')){_0x27d734['limit']=qs[_0x936d('0x1e')](_0xe2ca32[_0x936d('0x33')][_0x936d('0x1e')]);_0x27d734[_0x936d('0x1d')]=qs[_0x936d('0x1d')](_0xe2ca32[_0x936d('0x33')]['offset']);}_0x27d734[_0x936d('0x39')]=qs[_0x936d('0x3a')](_0xe2ca32[_0x936d('0x33')]['sort']);_0x27d734[_0x936d('0x3b')]=qs[_0x936d('0x34')](_[_0x936d('0x3c')](_0xe2ca32['query'],_0x3c6fc5[_0x936d('0x34')]),_0x58540);if(_0xe2ca32[_0x936d('0x33')][_0x936d('0x3d')]){_0x27d734[_0x936d('0x3b')]=_[_0x936d('0x3e')](_0x27d734['where'],{'$or':_[_0x936d('0x2c')](_0x58540,function(_0x9fd3d6){if(_0x9fd3d6[_0x936d('0x3f')]!=='VIRTUAL'){var _0x1b6690={};_0x1b6690[_0x9fd3d6['name']]={'$like':'%'+_0xe2ca32[_0x936d('0x33')]['filter']+'%'};return _0x1b6690;}})});}_0x27d734=_[_0x936d('0x3e')]({},_0x27d734,_0xe2ca32[_0x936d('0x40')]);var _0x56cbf9={'where':_0x27d734['where']};return db[_0x936d('0x2d')][_0x936d('0x20')](_0x56cbf9)[_0x936d('0x24')](function(_0x47f24b){_0x3f8f68[_0x936d('0x20')]=_0x47f24b;if(_0xe2ca32[_0x936d('0x33')]['includeAll']){_0x27d734['include']=[{'all':!![]}];}return db[_0x936d('0x2d')][_0x936d('0x41')](_0x27d734);})[_0x936d('0x24')](function(_0x4b68b0){_0x3f8f68[_0x936d('0x42')]=_0x4b68b0;return _0x3f8f68;})[_0x936d('0x24')](respondWithFilteredResult(_0x5ced64,_0x27d734))[_0x936d('0x43')](handleError(_0x5ced64,null));};exports[_0x936d('0x44')]=function(_0x1ad2c7,_0x20e749){var _0x268796={'raw':![],'where':{'id':_0x1ad2c7[_0x936d('0x45')]['id']}},_0x235f66={};_0x235f66['model']=_[_0x936d('0x32')](db[_0x936d('0x2d')][_0x936d('0x2e')]);_0x235f66[_0x936d('0x33')]=_[_0x936d('0x32')](_0x1ad2c7['query']);_0x235f66['filters']=_[_0x936d('0x36')](_0x235f66[_0x936d('0x31')],_0x235f66['query']);_0x268796['attributes']=_[_0x936d('0x36')](_0x235f66['model'],qs[_0x936d('0x37')](_0x1ad2c7[_0x936d('0x33')][_0x936d('0x37')]));_0x268796[_0x936d('0x35')]=_0x268796['attributes'][_0x936d('0x46')]?_0x268796[_0x936d('0x35')]:_0x235f66[_0x936d('0x31')];if(_0x1ad2c7['query'][_0x936d('0x47')]){_0x268796[_0x936d('0x48')]=[{'all':!![]}];}_0x268796=_['merge']({},_0x268796,_0x1ad2c7['options']);return db[_0x936d('0x2d')][_0x936d('0x49')](_0x268796)[_0x936d('0x24')](handleEntityNotFound(_0x20e749,null))[_0x936d('0x24')](respondWithResult(_0x20e749,null))[_0x936d('0x43')](handleError(_0x20e749,null));};exports[_0x936d('0x4a')]=function(_0x51f3d9,_0x13be5a){return db['UserProfileSection'][_0x936d('0x4a')](_0x51f3d9[_0x936d('0x4b')],{})[_0x936d('0x24')](respondWithResult(_0x13be5a,0xc9))[_0x936d('0x43')](handleError(_0x13be5a,null));};exports[_0x936d('0x4c')]=function(_0x2d6a16,_0x52c089){if(_0x2d6a16[_0x936d('0x4b')]['id']){delete _0x2d6a16['body']['id'];}return db[_0x936d('0x2d')][_0x936d('0x49')]({'where':{'id':_0x2d6a16[_0x936d('0x45')]['id']}})[_0x936d('0x24')](handleEntityNotFound(_0x52c089,null))[_0x936d('0x24')](saveUpdates(_0x2d6a16[_0x936d('0x4b')],null))[_0x936d('0x24')](respondWithResult(_0x52c089,null))[_0x936d('0x43')](handleError(_0x52c089,null));};exports[_0x936d('0x25')]=function(_0x1880ba,_0x1c1053){return db[_0x936d('0x2d')]['find']({'where':{'id':_0x1880ba['params']['id']}})[_0x936d('0x24')](handleEntityNotFound(_0x1c1053,null))[_0x936d('0x24')](removeEntity(_0x1c1053,null))[_0x936d('0x43')](handleError(_0x1c1053,null));};exports[_0x936d('0x4d')]=function(_0x513004,_0x5b256a){return db['UserProfileSection']['describe']()[_0x936d('0x24')](respondWithResult(_0x5b256a,null))[_0x936d('0x43')](handleError(_0x5b256a,null));}; \ No newline at end of file +var _0x35cb=['catch','show','rawAttributes','fields','create','body','find','params','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','fieldName','key','map','keys','filters','intersection','query','attributes','model','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','UserProfileSection','includeAll','findAll','rows'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x35cb,0x9f));var _0xb35c=function(_0x1c115f,_0xed0775){_0x1c115f=_0x1c115f-0x0;var _0x1fa5d6=_0x35cb[_0x1c115f];return _0x1fa5d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb35c('0x0'));var zipdir=require(_0xb35c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb35c('0x2'));var moment=require('moment');var BPromise=require(_0xb35c('0x3'));var Mustache=require(_0xb35c('0x4'));var util=require(_0xb35c('0x5'));var path=require(_0xb35c('0x6'));var sox=require(_0xb35c('0x7'));var csv=require(_0xb35c('0x8'));var ejs=require(_0xb35c('0x9'));var fs=require('fs');var fs_extra=require(_0xb35c('0xa'));var _=require('lodash');var squel=require(_0xb35c('0xb'));var crypto=require(_0xb35c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb35c('0xd'));var toCsv=require(_0xb35c('0x8'));var querystring=require(_0xb35c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb35c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb35c('0x10'));var as=require(_0xb35c('0x11'));var hardwareService=require(_0xb35c('0x12'));var logger=require(_0xb35c('0x13'))('api');var utils=require(_0xb35c('0x14'));var config=require(_0xb35c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb35c('0x16'))['db'];function respondWithStatusCode(_0x4815f1,_0x2e9d9b){_0x2e9d9b=_0x2e9d9b||0xcc;return function(_0x10ef6d){if(_0x10ef6d){return _0x4815f1[_0xb35c('0x17')](_0x2e9d9b);}return _0x4815f1[_0xb35c('0x18')](_0x2e9d9b)[_0xb35c('0x19')]();};}function respondWithResult(_0x1755b3,_0x30a739){_0x30a739=_0x30a739||0xc8;return function(_0x479518){if(_0x479518){return _0x1755b3[_0xb35c('0x18')](_0x30a739)[_0xb35c('0x1a')](_0x479518);}};}function respondWithFilteredResult(_0x5525ac,_0x4bafae){return function(_0x183a61){if(_0x183a61){var _0x4a4cad=typeof _0x4bafae[_0xb35c('0x1b')]===_0xb35c('0x1c')&&typeof _0x4bafae[_0xb35c('0x1d')]===_0xb35c('0x1c');var _0x3d96f4=_0x183a61['count'];var _0x13bee8=_0x4a4cad?0x0:_0x4bafae[_0xb35c('0x1b')];var _0x429955=_0x4a4cad?_0x183a61[_0xb35c('0x1e')]:_0x4bafae[_0xb35c('0x1b')]+_0x4bafae['limit'];var _0x54331d;if(_0x429955>=_0x3d96f4){_0x429955=_0x3d96f4;_0x54331d=0xc8;}else{_0x54331d=0xce;}_0x5525ac[_0xb35c('0x18')](_0x54331d);return _0x5525ac[_0xb35c('0x1f')](_0xb35c('0x20'),_0x13bee8+'-'+_0x429955+'/'+_0x3d96f4)[_0xb35c('0x1a')](_0x183a61);}return null;};}function patchUpdates(_0x3cfaaf){return function(_0xe27c2d){try{jsonpatch[_0xb35c('0x21')](_0xe27c2d,_0x3cfaaf,!![]);}catch(_0x5b4ac7){return BPromise[_0xb35c('0x22')](_0x5b4ac7);}return _0xe27c2d[_0xb35c('0x23')]();};}function saveUpdates(_0x45dd1e,_0xafc592){return function(_0x59aa95){if(_0x59aa95){return _0x59aa95[_0xb35c('0x24')](_0x45dd1e)[_0xb35c('0x25')](function(_0x37f8a5){return _0x37f8a5;});}return null;};}function removeEntity(_0x2cb891,_0x3fc520){return function(_0x598f37){if(_0x598f37){return _0x598f37[_0xb35c('0x26')]()[_0xb35c('0x25')](function(){_0x2cb891['status'](0xcc)[_0xb35c('0x19')]();});}};}function handleEntityNotFound(_0xb96cf6,_0x9338a8){return function(_0x2e37f1){if(!_0x2e37f1){_0xb96cf6[_0xb35c('0x17')](0x194);}return _0x2e37f1;};}function handleError(_0x208914,_0x2c1f74){_0x2c1f74=_0x2c1f74||0x1f4;return function(_0x6e5a72){logger['error'](_0x6e5a72[_0xb35c('0x27')]);if(_0x6e5a72['name']){delete _0x6e5a72[_0xb35c('0x28')];}_0x208914[_0xb35c('0x18')](_0x2c1f74)['send'](_0x6e5a72);};}exports[_0xb35c('0x29')]=function(_0x5abda1,_0x15d828){var _0x3449a7={},_0x147fd8={},_0x42358f={'count':0x0,'rows':[]};var _0x53f4af=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x5bd93c){return{'name':_0x5bd93c[_0xb35c('0x2a')],'type':_0x5bd93c['type'][_0xb35c('0x2b')]};});_0x147fd8['model']=_[_0xb35c('0x2c')](_0x53f4af,_0xb35c('0x28'));_0x147fd8['query']=_[_0xb35c('0x2d')](_0x5abda1['query']);_0x147fd8[_0xb35c('0x2e')]=_[_0xb35c('0x2f')](_0x147fd8['model'],_0x147fd8[_0xb35c('0x30')]);_0x3449a7[_0xb35c('0x31')]=_[_0xb35c('0x2f')](_0x147fd8[_0xb35c('0x32')],qs['fields'](_0x5abda1[_0xb35c('0x30')]['fields']));_0x3449a7[_0xb35c('0x31')]=_0x3449a7[_0xb35c('0x31')][_0xb35c('0x33')]?_0x3449a7[_0xb35c('0x31')]:_0x147fd8[_0xb35c('0x32')];if(!_0x5abda1[_0xb35c('0x30')][_0xb35c('0x34')](_0xb35c('0x35'))){_0x3449a7[_0xb35c('0x1d')]=qs[_0xb35c('0x1d')](_0x5abda1[_0xb35c('0x30')][_0xb35c('0x1d')]);_0x3449a7[_0xb35c('0x1b')]=qs[_0xb35c('0x1b')](_0x5abda1[_0xb35c('0x30')][_0xb35c('0x1b')]);}_0x3449a7[_0xb35c('0x36')]=qs[_0xb35c('0x37')](_0x5abda1[_0xb35c('0x30')][_0xb35c('0x37')]);_0x3449a7['where']=qs[_0xb35c('0x2e')](_[_0xb35c('0x38')](_0x5abda1['query'],_0x147fd8[_0xb35c('0x2e')]),_0x53f4af);if(_0x5abda1['query'][_0xb35c('0x39')]){_0x3449a7[_0xb35c('0x3a')]=_[_0xb35c('0x3b')](_0x3449a7[_0xb35c('0x3a')],{'$or':_[_0xb35c('0x2c')](_0x53f4af,function(_0x129bc1){if(_0x129bc1['type']!==_0xb35c('0x3c')){var _0x3c79db={};_0x3c79db[_0x129bc1[_0xb35c('0x28')]]={'$like':'%'+_0x5abda1[_0xb35c('0x30')][_0xb35c('0x39')]+'%'};return _0x3c79db;}})});}_0x3449a7=_['merge']({},_0x3449a7,_0x5abda1[_0xb35c('0x3d')]);var _0x3d490d={'where':_0x3449a7[_0xb35c('0x3a')]};return db[_0xb35c('0x3e')][_0xb35c('0x1e')](_0x3d490d)['then'](function(_0x5b2cc1){_0x42358f[_0xb35c('0x1e')]=_0x5b2cc1;if(_0x5abda1[_0xb35c('0x30')][_0xb35c('0x3f')]){_0x3449a7['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xb35c('0x40')](_0x3449a7);})[_0xb35c('0x25')](function(_0x3e437d){_0x42358f[_0xb35c('0x41')]=_0x3e437d;return _0x42358f;})[_0xb35c('0x25')](respondWithFilteredResult(_0x15d828,_0x3449a7))[_0xb35c('0x42')](handleError(_0x15d828,null));};exports[_0xb35c('0x43')]=function(_0x57cd8d,_0x21f72e){var _0x4077e1={'raw':![],'where':{'id':_0x57cd8d['params']['id']}},_0x10f7eb={};_0x10f7eb[_0xb35c('0x32')]=_[_0xb35c('0x2d')](db[_0xb35c('0x3e')][_0xb35c('0x44')]);_0x10f7eb[_0xb35c('0x30')]=_[_0xb35c('0x2d')](_0x57cd8d[_0xb35c('0x30')]);_0x10f7eb['filters']=_[_0xb35c('0x2f')](_0x10f7eb[_0xb35c('0x32')],_0x10f7eb[_0xb35c('0x30')]);_0x4077e1[_0xb35c('0x31')]=_[_0xb35c('0x2f')](_0x10f7eb[_0xb35c('0x32')],qs[_0xb35c('0x45')](_0x57cd8d[_0xb35c('0x30')][_0xb35c('0x45')]));_0x4077e1[_0xb35c('0x31')]=_0x4077e1[_0xb35c('0x31')][_0xb35c('0x33')]?_0x4077e1[_0xb35c('0x31')]:_0x10f7eb[_0xb35c('0x32')];if(_0x57cd8d[_0xb35c('0x30')][_0xb35c('0x3f')]){_0x4077e1['include']=[{'all':!![]}];}_0x4077e1=_['merge']({},_0x4077e1,_0x57cd8d[_0xb35c('0x3d')]);return db[_0xb35c('0x3e')]['find'](_0x4077e1)[_0xb35c('0x25')](handleEntityNotFound(_0x21f72e,null))[_0xb35c('0x25')](respondWithResult(_0x21f72e,null))['catch'](handleError(_0x21f72e,null));};exports[_0xb35c('0x46')]=function(_0x1468f8,_0x44a83e){return db[_0xb35c('0x3e')]['create'](_0x1468f8[_0xb35c('0x47')],{})[_0xb35c('0x25')](respondWithResult(_0x44a83e,0xc9))[_0xb35c('0x42')](handleError(_0x44a83e,null));};exports[_0xb35c('0x24')]=function(_0x521c5f,_0x52501c){if(_0x521c5f[_0xb35c('0x47')]['id']){delete _0x521c5f['body']['id'];}return db[_0xb35c('0x3e')][_0xb35c('0x48')]({'where':{'id':_0x521c5f['params']['id']}})['then'](handleEntityNotFound(_0x52501c,null))[_0xb35c('0x25')](saveUpdates(_0x521c5f[_0xb35c('0x47')],null))[_0xb35c('0x25')](respondWithResult(_0x52501c,null))[_0xb35c('0x42')](handleError(_0x52501c,null));};exports[_0xb35c('0x26')]=function(_0x2f2a31,_0x18e985){return db['UserProfileSection'][_0xb35c('0x48')]({'where':{'id':_0x2f2a31[_0xb35c('0x49')]['id']}})[_0xb35c('0x25')](handleEntityNotFound(_0x18e985,null))['then'](removeEntity(_0x18e985,null))[_0xb35c('0x42')](handleError(_0x18e985,null));};exports[_0xb35c('0x4a')]=function(_0x260e8b,_0x3ca231){return db['UserProfileSection'][_0xb35c('0x4a')]()[_0xb35c('0x25')](respondWithResult(_0x3ca231,null))[_0xb35c('0x42')](handleError(_0x3ca231,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1507663..64a4e5d 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 _0x397c=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0x397c,0x142));var _0xc397=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x397c[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xc397('0x0'));var util=require(_0xc397('0x1'));var logger=require('../../config/logger')(_0xc397('0x2'));var moment=require(_0xc397('0x3'));var BPromise=require(_0xc397('0x4'));var rp=require(_0xc397('0x5'));var fs=require('fs');var path=require(_0xc397('0x6'));var rimraf=require('rimraf');var config=require(_0xc397('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x4749d4,_0x53fbe6){return _0x4749d4[_0xc397('0x8')](_0xc397('0x9'),attributes,{'tableName':_0xc397('0xa'),'paranoid':![],'indexes':[{'name':_0xc397('0xb'),'fields':[_0xc397('0xc'),_0xc397('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7863=['path','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','sectionId','lodash','util','api','moment','request-promise'];(function(_0x4864f1,_0x5eeb5f){var _0x585f9c=function(_0x2bc10b){while(--_0x2bc10b){_0x4864f1['push'](_0x4864f1['shift']());}};_0x585f9c(++_0x5eeb5f);}(_0x7863,0x133));var _0x3786=function(_0x50b66d,_0x11c61c){_0x50b66d=_0x50b66d-0x0;var _0x41aa8e=_0x7863[_0x50b66d];return _0x41aa8e;};'use strict';var _=require(_0x3786('0x0'));var util=require(_0x3786('0x1'));var logger=require('../../config/logger')(_0x3786('0x2'));var moment=require(_0x3786('0x3'));var BPromise=require('bluebird');var rp=require(_0x3786('0x4'));var fs=require('fs');var path=require(_0x3786('0x5'));var rimraf=require(_0x3786('0x6'));var config=require(_0x3786('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x3786('0x8')]=function(_0xfaee1c,_0x1a05ca){return _0xfaee1c[_0x3786('0x9')](_0x3786('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x3786('0xb'),'fields':[_0x3786('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6806f5e..4a842b4 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 _0xba25=['http','request','then','debug','request\x20sent','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x30ba85,_0x503490){var _0x58b533=function(_0x131acf){while(--_0x131acf){_0x30ba85['push'](_0x30ba85['shift']());}};_0x58b533(++_0x503490);}(_0xba25,0x194));var _0x5ba2=function(_0x1a10d4,_0x3161d9){_0x1a10d4=_0x1a10d4-0x0;var _0x5d0cec=_0xba25[_0x1a10d4];return _0x5d0cec;};'use strict';var _=require('lodash');var util=require(_0x5ba2('0x0'));var moment=require(_0x5ba2('0x1'));var BPromise=require(_0x5ba2('0x2'));var rs=require(_0x5ba2('0x3'));var fs=require('fs');var Redis=require(_0x5ba2('0x4'));var db=require(_0x5ba2('0x5'))['db'];var utils=require(_0x5ba2('0x6'));var logger=require(_0x5ba2('0x7'))(_0x5ba2('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ba2('0x9'));var client=jayson['client'][_0x5ba2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31b71a,_0x5f5b39,_0x33d903){return new BPromise(function(_0x430b82,_0x387bdd){return client[_0x5ba2('0xb')](_0x31b71a,_0x33d903)[_0x5ba2('0xc')](function(_0x2b119e){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x5f5b39,'request\x20sent');logger[_0x5ba2('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5f5b39,_0x5ba2('0xe'),JSON[_0x5ba2('0xf')](_0x2b119e));if(_0x2b119e[_0x5ba2('0x10')]){if(_0x2b119e[_0x5ba2('0x10')][_0x5ba2('0x11')]===0x1f4){logger[_0x5ba2('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x5f5b39,_0x2b119e['error']['message']);return _0x387bdd(_0x2b119e[_0x5ba2('0x10')][_0x5ba2('0x12')]);}logger[_0x5ba2('0x10')](_0x5ba2('0x13'),_0x5f5b39,_0x2b119e[_0x5ba2('0x10')]['message']);return _0x430b82(_0x2b119e[_0x5ba2('0x10')][_0x5ba2('0x12')]);}else{logger[_0x5ba2('0x14')](_0x5ba2('0x13'),_0x5f5b39,_0x5ba2('0xe'));_0x430b82(_0x2b119e[_0x5ba2('0x15')][_0x5ba2('0x12')]);}})[_0x5ba2('0x16')](function(_0x26cb8c){logger['error'](_0x5ba2('0x13'),_0x5f5b39,_0x26cb8c);_0x387bdd(_0x26cb8c);});});} \ No newline at end of file +var _0x635e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c4fc4,_0x365da0){var _0x2b035f=function(_0xbc2e16){while(--_0xbc2e16){_0x4c4fc4['push'](_0x4c4fc4['shift']());}};_0x2b035f(++_0x365da0);}(_0x635e,0xf6));var _0xe635=function(_0x11df50,_0x201584){_0x11df50=_0x11df50-0x0;var _0x2dfa19=_0x635e[_0x11df50];return _0x2dfa19;};'use strict';var _=require(_0xe635('0x0'));var util=require(_0xe635('0x1'));var moment=require(_0xe635('0x2'));var BPromise=require(_0xe635('0x3'));var rs=require(_0xe635('0x4'));var fs=require('fs');var Redis=require(_0xe635('0x5'));var db=require(_0xe635('0x6'))['db'];var utils=require(_0xe635('0x7'));var logger=require(_0xe635('0x8'))('rpc');var config=require(_0xe635('0x9'));var jayson=require(_0xe635('0xa'));var client=jayson['client'][_0xe635('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xccc079,_0x3e8b5e,_0x309067){return new BPromise(function(_0x2331ef,_0xa62b0f){return client[_0xe635('0xc')](_0xccc079,_0x309067)[_0xe635('0xd')](function(_0x528345){logger[_0xe635('0xe')](_0xe635('0xf'),_0x3e8b5e,_0xe635('0x10'));logger[_0xe635('0x11')](_0xe635('0x12'),_0x3e8b5e,_0xe635('0x10'),JSON[_0xe635('0x13')](_0x528345));if(_0x528345[_0xe635('0x14')]){if(_0x528345[_0xe635('0x14')][_0xe635('0x15')]===0x1f4){logger[_0xe635('0x14')](_0xe635('0xf'),_0x3e8b5e,_0x528345['error'][_0xe635('0x16')]);return _0xa62b0f(_0x528345[_0xe635('0x14')]['message']);}logger['error'](_0xe635('0xf'),_0x3e8b5e,_0x528345[_0xe635('0x14')]['message']);return _0x2331ef(_0x528345[_0xe635('0x14')]['message']);}else{logger[_0xe635('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x3e8b5e,_0xe635('0x10'));_0x2331ef(_0x528345['result'][_0xe635('0x16')]);}})['catch'](function(_0x39ceac){logger[_0xe635('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x3e8b5e,_0x39ceac);_0xa62b0f(_0x39ceac);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2296457..c369ca3 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x414658,_0x32591f){var _0x3f33b8=function(_0x1ce3f3){while(--_0x1ce3f3){_0x414658['push'](_0x414658['shift']());}};_0x3f33b8(++_0x32591f);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3951a3,_0xe4463a){var _0x3320a6=function(_0x4f405b){while(--_0x4f405b){_0x3951a3['push'](_0x3951a3['shift']());}};_0x3320a6(++_0xe4463a);}(_0xe706,0xa3));var _0x6e70=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xe706[_0x400b43];return _0x3c330f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index bc18de8..2a6655e 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 _0x9e8e=['sequelize','exports','INTEGER'];(function(_0x4d493d,_0x34ffa0){var _0x3db7aa=function(_0x356d05){while(--_0x356d05){_0x4d493d['push'](_0x4d493d['shift']());}};_0x3db7aa(++_0x34ffa0);}(_0x9e8e,0x1cb));var _0xe9e8=function(_0x2a8a94,_0x3c5685){_0x2a8a94=_0x2a8a94-0x0;var _0xb59389=_0x9e8e[_0x2a8a94];return _0xb59389;};'use strict';var Sequelize=require(_0xe9e8('0x0'));module[_0xe9e8('0x1')]={'penalty':{'type':Sequelize[_0xe9e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5827=['exports','INTEGER','sequelize'];(function(_0xcb1250,_0x116cfb){var _0x26bf46=function(_0x70121){while(--_0x70121){_0xcb1250['push'](_0xcb1250['shift']());}};_0x26bf46(++_0x116cfb);}(_0x5827,0xb0));var _0x7582=function(_0x7d4770,_0x136e15){_0x7d4770=_0x7d4770-0x0;var _0x14b80b=_0x5827[_0x7d4770];return _0x14b80b;};'use strict';var Sequelize=require(_0x7582('0x0'));module[_0x7582('0x1')]={'penalty':{'type':Sequelize[_0x7582('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8041743..9ddc464 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 _0x292c=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0x292c,0x66));var _0xc292=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x292c[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc292('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xc292('0x7')]=function(_0x1c45ed,_0x2c01eb){return _0x1c45ed[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fe7=['path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api','bluebird','request-promise'];(function(_0x581bad,_0x118f0c){var _0x5c33eb=function(_0x4cf6de){while(--_0x4cf6de){_0x581bad['push'](_0x581bad['shift']());}};_0x5c33eb(++_0x118f0c);}(_0x9fe7,0x1df));var _0x79fe=function(_0x55ba81,_0x5c216c){_0x55ba81=_0x55ba81-0x0;var _0x9e9ae6=_0x9fe7[_0x55ba81];return _0x9e9ae6;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var logger=require('../../config/logger')(_0x79fe('0x2'));var moment=require('moment');var BPromise=require(_0x79fe('0x3'));var rp=require(_0x79fe('0x4'));var fs=require('fs');var path=require(_0x79fe('0x5'));var rimraf=require('rimraf');var config=require(_0x79fe('0x6'));var attributes=require(_0x79fe('0x7'));module[_0x79fe('0x8')]=function(_0x4af9f6,_0x3cec9c){return _0x4af9f6[_0x79fe('0x9')](_0x79fe('0xa'),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 d6a7b9f..e1c2a08 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 _0x04f7=['jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5604ca,_0x10235a){var _0x3c4ec0=function(_0x82cbc3){while(--_0x82cbc3){_0x5604ca['push'](_0x5604ca['shift']());}};_0x3c4ec0(++_0x10235a);}(_0x04f7,0x187));var _0x704f=function(_0x222455,_0x4bb55e){_0x222455=_0x222455-0x0;var _0x42a23b=_0x04f7[_0x222455];return _0x42a23b;};'use strict';var _=require(_0x704f('0x0'));var util=require(_0x704f('0x1'));var moment=require(_0x704f('0x2'));var BPromise=require(_0x704f('0x3'));var rs=require(_0x704f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x704f('0x5'));var logger=require(_0x704f('0x6'))('rpc');var config=require(_0x704f('0x7'));var jayson=require(_0x704f('0x8'));var client=jayson[_0x704f('0x9')][_0x704f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10e03b,_0x2b9fcd,_0x5568de){return new BPromise(function(_0x4452cd,_0x603e92){return client[_0x704f('0xb')](_0x10e03b,_0x5568de)[_0x704f('0xc')](function(_0x54e45b){logger['info'](_0x704f('0xd'),_0x2b9fcd,'request\x20sent');logger[_0x704f('0xe')](_0x704f('0xf'),_0x2b9fcd,_0x704f('0x10'),JSON[_0x704f('0x11')](_0x54e45b));if(_0x54e45b['error']){if(_0x54e45b[_0x704f('0x12')]['code']===0x1f4){logger[_0x704f('0x12')](_0x704f('0xd'),_0x2b9fcd,_0x54e45b[_0x704f('0x12')][_0x704f('0x13')]);return _0x603e92(_0x54e45b[_0x704f('0x12')][_0x704f('0x13')]);}logger[_0x704f('0x12')](_0x704f('0xd'),_0x2b9fcd,_0x54e45b[_0x704f('0x12')][_0x704f('0x13')]);return _0x4452cd(_0x54e45b[_0x704f('0x12')][_0x704f('0x13')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2b9fcd,_0x704f('0x10'));_0x4452cd(_0x54e45b['result'][_0x704f('0x13')]);}})[_0x704f('0x14')](function(_0x2dff12){logger[_0x704f('0x12')](_0x704f('0xd'),_0x2b9fcd,_0x2dff12);_0x603e92(_0x2dff12);});});} \ No newline at end of file +var _0x4758=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s'];(function(_0x1e2ca3,_0x1e9cbd){var _0x1af0ac=function(_0x34e5c4){while(--_0x34e5c4){_0x1e2ca3['push'](_0x1e2ca3['shift']());}};_0x1af0ac(++_0x1e9cbd);}(_0x4758,0x76));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var moment=require('moment');var BPromise=require(_0x8475('0x2'));var rs=require(_0x8475('0x3'));var fs=require('fs');var Redis=require(_0x8475('0x4'));var db=require(_0x8475('0x5'))['db'];var utils=require(_0x8475('0x6'));var logger=require(_0x8475('0x7'))(_0x8475('0x8'));var config=require(_0x8475('0x9'));var jayson=require(_0x8475('0xa'));var client=jayson['client'][_0x8475('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b0bd2,_0x213993,_0x5ed26a){return new BPromise(function(_0x259e82,_0x28e9e9){return client[_0x8475('0xc')](_0x1b0bd2,_0x5ed26a)['then'](function(_0xd341b9){logger[_0x8475('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x213993,_0x8475('0xe'));logger[_0x8475('0xf')](_0x8475('0x10'),_0x213993,_0x8475('0xe'),JSON['stringify'](_0xd341b9));if(_0xd341b9[_0x8475('0x11')]){if(_0xd341b9[_0x8475('0x11')][_0x8475('0x12')]===0x1f4){logger[_0x8475('0x11')](_0x8475('0x13'),_0x213993,_0xd341b9[_0x8475('0x11')][_0x8475('0x14')]);return _0x28e9e9(_0xd341b9[_0x8475('0x11')]['message']);}logger[_0x8475('0x11')](_0x8475('0x13'),_0x213993,_0xd341b9[_0x8475('0x11')][_0x8475('0x14')]);return _0x259e82(_0xd341b9[_0x8475('0x11')][_0x8475('0x14')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x213993,_0x8475('0xe'));_0x259e82(_0xd341b9[_0x8475('0x15')][_0x8475('0x14')]);}})[_0x8475('0x16')](function(_0x2a5abc){logger[_0x8475('0x11')](_0x8475('0x13'),_0x213993,_0x2a5abc);_0x28e9e9(_0x2a5abc);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index a845266..13e5900 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 _0x46ce=['INTEGER','sequelize','exports'];(function(_0x14b266,_0x1ba587){var _0x523e2a=function(_0x5c4980){while(--_0x5c4980){_0x14b266['push'](_0x14b266['shift']());}};_0x523e2a(++_0x1ba587);}(_0x46ce,0x85));var _0xe46c=function(_0x46f2c3,_0x421546){_0x46f2c3=_0x46f2c3-0x0;var _0x39d0e1=_0x46ce[_0x46f2c3];return _0x39d0e1;};'use strict';var Sequelize=require(_0xe46c('0x0'));module[_0xe46c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xe46c('0x2')]}}; \ No newline at end of file +var _0x8d77=['INTEGER','sequelize','exports'];(function(_0x3f816e,_0x7f0cae){var _0x1f42c8=function(_0x6bee6e){while(--_0x6bee6e){_0x3f816e['push'](_0x3f816e['shift']());}};_0x1f42c8(++_0x7f0cae);}(_0x8d77,0x67));var _0x78d7=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8d77[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x78d7('0x0'));module[_0x78d7('0x1')]={'UserId':{'type':Sequelize[_0x78d7('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 4c0c4cc..80e70b4 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(_0x5b6991,_0x35a2bb){var _0x101504=function(_0x292e11){while(--_0x292e11){_0x5b6991['push'](_0x5b6991['shift']());}};_0x101504(++_0x35a2bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2b85c9,_0x51bc8c){var _0x2ff161=function(_0x269f8e){while(--_0x269f8e){_0x2b85c9['push'](_0x2b85c9['shift']());}};_0x2ff161(++_0x51bc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 1e5b23c..cebd788 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe336e0,_0x18f796){var _0x19d2c6=function(_0x3778e1){while(--_0x3778e1){_0xe336e0['push'](_0xe336e0['shift']());}};_0x19d2c6(++_0x18f796);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51f309,_0x416ab1){var _0x529ea0=function(_0x945dd5){while(--_0x945dd5){_0x51f309['push'](_0x51f309['shift']());}};_0x529ea0(++_0x416ab1);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9006424..49ab626 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x02ac=['INTEGER','sequelize'];(function(_0x122520,_0x18cb31){var _0xbefbdf=function(_0x2c5353){while(--_0x2c5353){_0x122520['push'](_0x122520['shift']());}};_0xbefbdf(++_0x18cb31);}(_0x02ac,0x1ed));var _0xc02a=function(_0x11dbbc,_0x4e6166){_0x11dbbc=_0x11dbbc-0x0;var _0x270bdd=_0x02ac[_0x11dbbc];return _0x270bdd;};'use strict';var Sequelize=require(_0xc02a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc02a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 40855d5..d1e94a8 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 _0xbc88=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util'];(function(_0x27edf3,_0x43b5e3){var _0xe20afa=function(_0x1dfd1f){while(--_0x1dfd1f){_0x27edf3['push'](_0x27edf3['shift']());}};_0xe20afa(++_0x43b5e3);}(_0xbc88,0x1ba));var _0x8bc8=function(_0x57a512,_0x239b65){_0x57a512=_0x57a512-0x0;var _0x4fa1a5=_0xbc88[_0x57a512];return _0x4fa1a5;};'use strict';var _=require(_0x8bc8('0x0'));var util=require(_0x8bc8('0x1'));var logger=require(_0x8bc8('0x2'))(_0x8bc8('0x3'));var moment=require('moment');var BPromise=require(_0x8bc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bc8('0x5'));var rimraf=require(_0x8bc8('0x6'));var config=require(_0x8bc8('0x7'));var attributes=require(_0x8bc8('0x8'));module[_0x8bc8('0x9')]=function(_0x2ca21c,_0x517dd0){return _0x2ca21c[_0x8bc8('0xa')](_0x8bc8('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1c0=['define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x2ce064,_0x4c3625){var _0x5792d1=function(_0x14a5e9){while(--_0x14a5e9){_0x2ce064['push'](_0x2ce064['shift']());}};_0x5792d1(++_0x4c3625);}(_0xf1c0,0x1f1));var _0x0f1c=function(_0x48c655,_0x134bcd){_0x48c655=_0x48c655-0x0;var _0x410e74=_0xf1c0[_0x48c655];return _0x410e74;};'use strict';var _=require(_0x0f1c('0x0'));var util=require('util');var logger=require(_0x0f1c('0x1'))(_0x0f1c('0x2'));var moment=require(_0x0f1c('0x3'));var BPromise=require(_0x0f1c('0x4'));var rp=require(_0x0f1c('0x5'));var fs=require('fs');var path=require(_0x0f1c('0x6'));var rimraf=require(_0x0f1c('0x7'));var config=require(_0x0f1c('0x8'));var attributes=require(_0x0f1c('0x9'));module['exports']=function(_0x2f5274,_0x2e1a2f){return _0x2f5274[_0x0f1c('0xa')](_0x0f1c('0xb'),attributes,{'tableName':_0x0f1c('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 7f38cb4..835b4b0 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 _0x8203=['../../config/environment','http','request','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5f584a,_0x47f064){var _0x3788d9=function(_0x29c10b){while(--_0x29c10b){_0x5f584a['push'](_0x5f584a['shift']());}};_0x3788d9(++_0x47f064);}(_0x8203,0x7b));var _0x3820=function(_0x45aa57,_0x1ba682){_0x45aa57=_0x45aa57-0x0;var _0xf4429a=_0x8203[_0x45aa57];return _0xf4429a;};'use strict';var _=require(_0x3820('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3820('0x1'));var db=require(_0x3820('0x2'))['db'];var utils=require(_0x3820('0x3'));var logger=require(_0x3820('0x4'))('rpc');var config=require(_0x3820('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3820('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1bf0d7,_0x53e15b,_0x3bd465){return new BPromise(function(_0x44d299,_0x282b02){return client[_0x3820('0x7')](_0x1bf0d7,_0x3bd465)['then'](function(_0x196b6a){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x53e15b,'request\x20sent');logger['debug'](_0x3820('0x8'),_0x53e15b,_0x3820('0x9'),JSON[_0x3820('0xa')](_0x196b6a));if(_0x196b6a[_0x3820('0xb')]){if(_0x196b6a[_0x3820('0xb')][_0x3820('0xc')]===0x1f4){logger['error'](_0x3820('0xd'),_0x53e15b,_0x196b6a[_0x3820('0xb')][_0x3820('0xe')]);return _0x282b02(_0x196b6a[_0x3820('0xb')]['message']);}logger['error'](_0x3820('0xd'),_0x53e15b,_0x196b6a[_0x3820('0xb')][_0x3820('0xe')]);return _0x44d299(_0x196b6a[_0x3820('0xb')][_0x3820('0xe')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x53e15b,_0x3820('0x9'));_0x44d299(_0x196b6a[_0x3820('0xf')]['message']);}})['catch'](function(_0x419b51){logger[_0x3820('0xb')](_0x3820('0xd'),_0x53e15b,_0x419b51);_0x282b02(_0x419b51);});});} \ No newline at end of file +var _0x728e=['stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2f2f4c,_0x3d6b9d){var _0x6e62e8=function(_0x152fad){while(--_0x152fad){_0x2f2f4c['push'](_0x2f2f4c['shift']());}};_0x6e62e8(++_0x3d6b9d);}(_0x728e,0x185));var _0xe728=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x728e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe728('0x0'));var util=require(_0xe728('0x1'));var moment=require(_0xe728('0x2'));var BPromise=require(_0xe728('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe728('0x4'));var db=require(_0xe728('0x5'))['db'];var utils=require(_0xe728('0x6'));var logger=require('../../config/logger')(_0xe728('0x7'));var config=require(_0xe728('0x8'));var jayson=require(_0xe728('0x9'));var client=jayson[_0xe728('0xa')][_0xe728('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f729c,_0x5962b2,_0x15cee5){return new BPromise(function(_0x35433e,_0x1014fa){return client[_0xe728('0xc')](_0x4f729c,_0x15cee5)[_0xe728('0xd')](function(_0x4625ac){logger[_0xe728('0xe')](_0xe728('0xf'),_0x5962b2,'request\x20sent');logger[_0xe728('0x10')](_0xe728('0x11'),_0x5962b2,_0xe728('0x12'),JSON[_0xe728('0x13')](_0x4625ac));if(_0x4625ac[_0xe728('0x14')]){if(_0x4625ac[_0xe728('0x14')][_0xe728('0x15')]===0x1f4){logger[_0xe728('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x5962b2,_0x4625ac[_0xe728('0x14')]['message']);return _0x1014fa(_0x4625ac[_0xe728('0x14')][_0xe728('0x16')]);}logger[_0xe728('0x14')](_0xe728('0xf'),_0x5962b2,_0x4625ac[_0xe728('0x14')][_0xe728('0x16')]);return _0x35433e(_0x4625ac[_0xe728('0x14')]['message']);}else{logger['info'](_0xe728('0xf'),_0x5962b2,'request\x20sent');_0x35433e(_0x4625ac[_0xe728('0x17')][_0xe728('0x16')]);}})['catch'](function(_0x19da4c){logger[_0xe728('0x14')](_0xe728('0xf'),_0x5962b2,_0x19da4c);_0x1014fa(_0x19da4c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index da45ddc..e5d4467 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a2d6e,_0x3d3a47){var _0x30ff59=function(_0x2b5e6a){while(--_0x2b5e6a){_0x5a2d6e['push'](_0x5a2d6e['shift']());}};_0x30ff59(++_0x3d3a47);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3511dd5..3e04712 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 _0xd38a=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1c1d5f,_0x219dcd){var _0x572286=function(_0x1b521c){while(--_0x1b521c){_0x1c1d5f['push'](_0x1c1d5f['shift']());}};_0x572286(++_0x219dcd);}(_0xd38a,0x1aa));var _0xad38=function(_0x3e14,_0x172ba7){_0x3e14=_0x3e14-0x0;var _0x3078e3=_0xd38a[_0x3e14];return _0x3078e3;};'use strict';var Sequelize=require('sequelize');module[_0xad38('0x0')]={'uniqueid':{'type':Sequelize[_0xad38('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xad38('0x2')},'membername':{'type':Sequelize[_0xad38('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xad38('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xad38('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xad38('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad38('0x4'),'comment':_0xad38('0x2')},'penalty':{'type':Sequelize[_0xad38('0x1')](0xb),'defaultValue':0x0,'comment':_0xad38('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xad38('0x2')}}; \ No newline at end of file +var _0xad7a=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x32fea3,_0x2a88ff){var _0x4f5ddf=function(_0x2b974e){while(--_0x2b974e){_0x32fea3['push'](_0x32fea3['shift']());}};_0x4f5ddf(++_0x2a88ff);}(_0xad7a,0x196));var _0xaad7=function(_0x2e3bc0,_0x2343aa){_0x2e3bc0=_0x2e3bc0-0x0;var _0x464e49=_0xad7a[_0x2e3bc0];return _0x464e49;};'use strict';var Sequelize=require(_0xaad7('0x0'));module[_0xaad7('0x1')]={'uniqueid':{'type':Sequelize[_0xaad7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xaad7('0x3')},'membername':{'type':Sequelize[_0xaad7('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaad7('0x5'),'comment':_0xaad7('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xaad7('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xaad7('0x3')},'penalty':{'type':Sequelize[_0xaad7('0x2')](0xb),'defaultValue':0x0,'comment':_0xaad7('0x3')},'paused':{'type':Sequelize[_0xaad7('0x2')](0xb),'defaultValue':0x0,'comment':_0xaad7('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9b4ef63..60495de 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 _0xd6be=['../../mysqldb','UserVoiceQueueRt','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd6be,0xbc));var _0xed6b=function(_0x55ee37,_0x465e53){_0x55ee37=_0x55ee37-0x0;var _0x5869a8=_0xd6be[_0x55ee37];return _0x5869a8;};'use strict';var EventEmitter=require(_0xed6b('0x0'));var UserVoiceQueueRt=require(_0xed6b('0x1'))['db'][_0xed6b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed6b('0x3'),'afterUpdate':'update','afterDestroy':_0xed6b('0x4')};function emitEvent(_0x56f7e1){return function(_0x4179ff,_0x3f50db,_0x84f638){UserVoiceQueueRtEvents[_0xed6b('0x5')](_0x56f7e1+':'+_0x4179ff['id'],_0x4179ff);UserVoiceQueueRtEvents[_0xed6b('0x5')](_0x56f7e1,_0x4179ff);_0x84f638(null);};}for(var e in events){if(events[_0xed6b('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xed6b('0x7')](e,emitEvent(event));}}module[_0xed6b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd825=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xd825,0x19a));var _0x5d82=function(_0x2b7747,_0x52d4bf){_0x2b7747=_0x2b7747-0x0;var _0x5ee9fe=_0xd825[_0x2b7747];return _0x5ee9fe;};'use strict';var EventEmitter=require(_0x5d82('0x0'));var UserVoiceQueueRt=require(_0x5d82('0x1'))['db'][_0x5d82('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5d82('0x3')](0x0);var events={'afterCreate':_0x5d82('0x4'),'afterUpdate':_0x5d82('0x5'),'afterDestroy':'remove'};function emitEvent(_0x59454a){return function(_0x39c013,_0x432133,_0x7d08f8){UserVoiceQueueRtEvents['emit'](_0x59454a+':'+_0x39c013['id'],_0x39c013);UserVoiceQueueRtEvents[_0x5d82('0x6')](_0x59454a,_0x39c013);_0x7d08f8(null);};}for(var e in events){if(events[_0x5d82('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x5d82('0x8')](e,emitEvent(event));}}module[_0x5d82('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 062d95f..e2d321f 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 _0xf3ed=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','moment','bluebird','request-promise'];(function(_0x44db50,_0x5ecc02){var _0x2647ff=function(_0x2e454b){while(--_0x2e454b){_0x44db50['push'](_0x44db50['shift']());}};_0x2647ff(++_0x5ecc02);}(_0xf3ed,0xec));var _0xdf3e=function(_0x5295a4,_0x10b19c){_0x5295a4=_0x5295a4-0x0;var _0x31bf38=_0xf3ed[_0x5295a4];return _0x31bf38;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf3e('0x0'))('api');var moment=require(_0xdf3e('0x1'));var BPromise=require(_0xdf3e('0x2'));var rp=require(_0xdf3e('0x3'));var fs=require('fs');var path=require(_0xdf3e('0x4'));var rimraf=require(_0xdf3e('0x5'));var config=require(_0xdf3e('0x6'));var attributes=require(_0xdf3e('0x7'));module[_0xdf3e('0x8')]=function(_0x1cae9c,_0x1a9e01){return _0x1cae9c[_0xdf3e('0x9')](_0xdf3e('0xa'),attributes,{'tableName':_0xdf3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6488=['../../config/logger','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x31203d,_0x28551c){var _0x3f5cf4=function(_0x3d0f50){while(--_0x3d0f50){_0x31203d['push'](_0x31203d['shift']());}};_0x3f5cf4(++_0x28551c);}(_0x6488,0x82));var _0x8648=function(_0x152499,_0x4eefc4){_0x152499=_0x152499-0x0;var _0x2804f2=_0x6488[_0x152499];return _0x2804f2;};'use strict';var _=require(_0x8648('0x0'));var util=require(_0x8648('0x1'));var logger=require(_0x8648('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8648('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8648('0x4'));var config=require(_0x8648('0x5'));var attributes=require(_0x8648('0x6'));module[_0x8648('0x7')]=function(_0x30991e,_0x1f0e11){return _0x30991e[_0x8648('0x8')](_0x8648('0x9'),attributes,{'tableName':_0x8648('0xa'),'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 fc4abab..fd01cba 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 _0x88ee=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','findAll','options','where'];(function(_0x2db080,_0x5a86e3){var _0x1c5c3f=function(_0x55e704){while(--_0x55e704){_0x2db080['push'](_0x2db080['shift']());}};_0x1c5c3f(++_0x5a86e3);}(_0x88ee,0x153));var _0xe88e=function(_0x5030f8,_0x61f57b){_0x5030f8=_0x5030f8-0x0;var _0x513ddb=_0x88ee[_0x5030f8];return _0x513ddb;};'use strict';var _=require(_0xe88e('0x0'));var util=require(_0xe88e('0x1'));var moment=require(_0xe88e('0x2'));var BPromise=require('bluebird');var rs=require(_0xe88e('0x3'));var fs=require('fs');var Redis=require(_0xe88e('0x4'));var db=require(_0xe88e('0x5'))['db'];var utils=require(_0xe88e('0x6'));var logger=require(_0xe88e('0x7'))(_0xe88e('0x8'));var config=require(_0xe88e('0x9'));var jayson=require(_0xe88e('0xa'));var client=jayson[_0xe88e('0xb')][_0xe88e('0xc')]({'port':0x232a});config[_0xe88e('0xd')]=_[_0xe88e('0xe')](config[_0xe88e('0xd')],{'host':_0xe88e('0xf'),'port':0x18eb});var socket=require(_0xe88e('0x10'))(new Redis(config[_0xe88e('0xd')]));require(_0xe88e('0x11'))[_0xe88e('0x12')](socket);function respondWithRpcPromise(_0x334995,_0x1415b1,_0x46c2c6){return new BPromise(function(_0x825188,_0x191b8e){return client[_0xe88e('0x13')](_0x334995,_0x46c2c6)[_0xe88e('0x14')](function(_0x22e63b){logger[_0xe88e('0x15')](_0xe88e('0x16'),_0x1415b1,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1415b1,_0xe88e('0x17'),JSON[_0xe88e('0x18')](_0x22e63b));if(_0x22e63b[_0xe88e('0x19')]){if(_0x22e63b['error']['code']===0x1f4){logger['error'](_0xe88e('0x16'),_0x1415b1,_0x22e63b[_0xe88e('0x19')][_0xe88e('0x1a')]);return _0x191b8e(_0x22e63b['error'][_0xe88e('0x1a')]);}logger[_0xe88e('0x19')](_0xe88e('0x16'),_0x1415b1,_0x22e63b[_0xe88e('0x19')][_0xe88e('0x1a')]);return _0x825188(_0x22e63b[_0xe88e('0x19')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1415b1,_0xe88e('0x17'));_0x825188(_0x22e63b['result'][_0xe88e('0x1a')]);}})[_0xe88e('0x1b')](function(_0x1e4a23){logger[_0xe88e('0x19')](_0xe88e('0x16'),_0x1415b1,_0x1e4a23);_0x191b8e(_0x1e4a23);});});}exports['GetVoiceQueueRtPauses']=function(_0x2f2c8a){var _0x5f0af8=this;return new Promise(function(_0x2947ac,_0x65a7bd){return db['UserVoiceQueueRt'][_0xe88e('0x1c')]({'raw':_0x2f2c8a['options']?_0x2f2c8a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f2c8a[_0xe88e('0x1d')]?_0x2f2c8a[_0xe88e('0x1d')][_0xe88e('0x1e')]||null:null,'attributes':[[db[_0xe88e('0x1f')]['fn'](_0xe88e('0x20'),db[_0xe88e('0x1f')]['fn']('IF',db[_0xe88e('0x1f')][_0xe88e('0x21')](_0xe88e('0x22')))),_0xe88e('0x23')]]})[_0xe88e('0x14')](function(_0x37aeba){logger['info'](_0xe88e('0x24'),_0x2f2c8a);logger['debug'](_0xe88e('0x24'),_0x2f2c8a,JSON[_0xe88e('0x18')](_0x37aeba));_0x2947ac(_0x37aeba);})[_0xe88e('0x1b')](function(_0x53d771){logger[_0xe88e('0x19')](_0xe88e('0x24'),_0x53d771[_0xe88e('0x1a')],_0x2f2c8a);_0x65a7bd(_0x5f0af8[_0xe88e('0x19')](0x1f4,_0x53d771[_0xe88e('0x1a')]));});});}; \ No newline at end of file +var _0x9b33=['socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x9b33,0x152));var _0x39b3=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9b33[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x39b3('0x0'));var util=require(_0x39b3('0x1'));var moment=require('moment');var BPromise=require(_0x39b3('0x2'));var rs=require(_0x39b3('0x3'));var fs=require('fs');var Redis=require(_0x39b3('0x4'));var db=require(_0x39b3('0x5'))['db'];var utils=require(_0x39b3('0x6'));var logger=require(_0x39b3('0x7'))('rpc');var config=require(_0x39b3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x39b3('0x9')]({'port':0x232a});config[_0x39b3('0xa')]=_['defaults'](config[_0x39b3('0xa')],{'host':_0x39b3('0xb'),'port':0x18eb});var socket=require(_0x39b3('0xc'))(new Redis(config[_0x39b3('0xa')]));require('./userVoiceQueueRt.socket')[_0x39b3('0xd')](socket);function respondWithRpcPromise(_0x3942ef,_0x50a9b4,_0x8449a0){return new BPromise(function(_0x19dfa6,_0x56dd0d){return client[_0x39b3('0xe')](_0x3942ef,_0x8449a0)[_0x39b3('0xf')](function(_0x2210c2){logger[_0x39b3('0x10')](_0x39b3('0x11'),_0x50a9b4,'request\x20sent');logger[_0x39b3('0x12')](_0x39b3('0x13'),_0x50a9b4,'request\x20sent',JSON[_0x39b3('0x14')](_0x2210c2));if(_0x2210c2[_0x39b3('0x15')]){if(_0x2210c2[_0x39b3('0x15')][_0x39b3('0x16')]===0x1f4){logger[_0x39b3('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x50a9b4,_0x2210c2[_0x39b3('0x15')][_0x39b3('0x17')]);return _0x56dd0d(_0x2210c2[_0x39b3('0x15')][_0x39b3('0x17')]);}logger[_0x39b3('0x15')](_0x39b3('0x11'),_0x50a9b4,_0x2210c2['error'][_0x39b3('0x17')]);return _0x19dfa6(_0x2210c2['error'][_0x39b3('0x17')]);}else{logger[_0x39b3('0x10')](_0x39b3('0x11'),_0x50a9b4,_0x39b3('0x18'));_0x19dfa6(_0x2210c2[_0x39b3('0x19')][_0x39b3('0x17')]);}})['catch'](function(_0x19fb46){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x50a9b4,_0x19fb46);_0x56dd0d(_0x19fb46);});});}exports[_0x39b3('0x1a')]=function(_0x442592){var _0x1dffd0=this;return new Promise(function(_0x36ac7,_0x34ae37){return db[_0x39b3('0x1b')]['findAll']({'raw':_0x442592[_0x39b3('0x1c')]?_0x442592[_0x39b3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x442592[_0x39b3('0x1c')]?_0x442592[_0x39b3('0x1c')][_0x39b3('0x1d')]||null:null,'attributes':[[db[_0x39b3('0x1e')]['fn'](_0x39b3('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x39b3('0x20')](_0x39b3('0x21')))),'outboundQueuePauses']]})['then'](function(_0x126a80){logger[_0x39b3('0x10')]('GetVoiceQueueRtPauses',_0x442592);logger['debug']('GetVoiceQueueRtPauses',_0x442592,JSON[_0x39b3('0x14')](_0x126a80));_0x36ac7(_0x126a80);})[_0x39b3('0x22')](function(_0x16b45c){logger[_0x39b3('0x15')](_0x39b3('0x1a'),_0x16b45c[_0x39b3('0x17')],_0x442592);_0x34ae37(_0x1dffd0['error'](0x1f4,_0x16b45c[_0x39b3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 50ed2f3..fd4907c 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 _0xcbd3=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register'];(function(_0x50068c,_0x38a87a){var _0x11826a=function(_0x3bb53e){while(--_0x3bb53e){_0x50068c['push'](_0x50068c['shift']());}};_0x11826a(++_0x38a87a);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0xdad071,_0x59b000){_0xdad071=_0xdad071-0x0;var _0x5c1225=_0xcbd3[_0xdad071];return _0x5c1225;};'use strict';var UserVoiceQueueRtEvents=require(_0x3cbd('0x0'));var events=[_0x3cbd('0x1'),_0x3cbd('0x2'),_0x3cbd('0x3')];function createListener(_0x3dc6fa,_0x2f631d){return function(_0x1092bc){_0x2f631d[_0x3cbd('0x4')](_0x3dc6fa,_0x1092bc);};}function removeListener(_0x2f4854,_0x32a914){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2f4854,_0x32a914);};}exports[_0x3cbd('0x5')]=function(_0x2f2631){for(var _0x525b74=0x0,_0x372e19=events['length'];_0x525b74<_0x372e19;_0x525b74++){var _0x25420f=events[_0x525b74];var _0x4c1a53=createListener(_0x3cbd('0x6')+_0x25420f,_0x2f2631);UserVoiceQueueRtEvents['on'](_0x25420f,_0x4c1a53);}}; \ No newline at end of file +var _0x1766=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update','emit','removeListener'];(function(_0x1dd890,_0xad4f0b){var _0x4718c4=function(_0x1f2bff){while(--_0x1f2bff){_0x1dd890['push'](_0x1dd890['shift']());}};_0x4718c4(++_0xad4f0b);}(_0x1766,0x17d));var _0x6176=function(_0x57c8b4,_0x567dfb){_0x57c8b4=_0x57c8b4-0x0;var _0x2ef232=_0x1766[_0x57c8b4];return _0x2ef232;};'use strict';var UserVoiceQueueRtEvents=require(_0x6176('0x0'));var events=['save','remove',_0x6176('0x1')];function createListener(_0x1606f0,_0x27be56){return function(_0x3db6d5){_0x27be56[_0x6176('0x2')](_0x1606f0,_0x3db6d5);};}function removeListener(_0x224569,_0x51476d){return function(){UserVoiceQueueRtEvents[_0x6176('0x3')](_0x224569,_0x51476d);};}exports[_0x6176('0x4')]=function(_0x5c8f3c){for(var _0xc12c66=0x0,_0x222f99=events[_0x6176('0x5')];_0xc12c66<_0x222f99;_0xc12c66++){var _0x3878a4=events[_0xc12c66];var _0x481693=createListener(_0x6176('0x6')+_0x3878a4,_0x5c8f3c);UserVoiceQueueRtEvents['on'](_0x3878a4,_0x481693);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0ff4488..4a31bfa 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(_0x19777b,_0x2375c6){var _0x70a038=function(_0x599fab){while(--_0x599fab){_0x19777b['push'](_0x19777b['shift']());}};_0x70a038(++_0x2375c6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xcb91[_0x4c4042];return _0xbd10dc;};'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(_0x198fd7,_0x1aa9b1){var _0x574ead=function(_0x311fc3){while(--_0x311fc3){_0x198fd7['push'](_0x198fd7['shift']());}};_0x574ead(++_0x1aa9b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 c75bfad..7bd3853 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 _0x2e8f=['sequelize','exports','INTEGER'];(function(_0x5ac527,_0x269eef){var _0x1cbab0=function(_0x52a7e2){while(--_0x52a7e2){_0x5ac527['push'](_0x5ac527['shift']());}};_0x1cbab0(++_0x269eef);}(_0x2e8f,0x159));var _0xf2e8=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x2e8f[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xf2e8('0x0'));module[_0xf2e8('0x1')]={'penalty':{'type':Sequelize[_0xf2e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79fc=['sequelize','exports','INTEGER'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x79fc,0x1ad));var _0xc79f=function(_0x52074a,_0x286c9e){_0x52074a=_0x52074a-0x0;var _0x2f49ae=_0x79fc[_0x52074a];return _0x2f49ae;};'use strict';var Sequelize=require(_0xc79f('0x0'));module[_0xc79f('0x1')]={'penalty':{'type':Sequelize[_0xc79f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d234b4f..2eea6c7 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 _0xe927=['./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x100cd0,_0x154d5f){var _0x54a721=function(_0x4959d3){while(--_0x4959d3){_0x100cd0['push'](_0x100cd0['shift']());}};_0x54a721(++_0x154d5f);}(_0xe927,0x72));var _0x7e92=function(_0xb603f1,_0x31555a){_0xb603f1=_0xb603f1-0x0;var _0x5a77aa=_0xe927[_0xb603f1];return _0x5a77aa;};'use strict';var _=require('lodash');var util=require(_0x7e92('0x0'));var logger=require(_0x7e92('0x1'))(_0x7e92('0x2'));var moment=require('moment');var BPromise=require(_0x7e92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e92('0x4'));var rimraf=require(_0x7e92('0x5'));var config=require('../../config/environment');var attributes=require(_0x7e92('0x6'));module['exports']=function(_0x3eb241,_0x2723ad){return _0x3eb241[_0x7e92('0x7')](_0x7e92('0x8'),attributes,{'tableName':_0x7e92('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x301d=['exports','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x3fbdfa,_0x4e6388){var _0x113d2f=function(_0x5d86b3){while(--_0x5d86b3){_0x3fbdfa['push'](_0x3fbdfa['shift']());}};_0x113d2f(++_0x4e6388);}(_0x301d,0x1d0));var _0xd301=function(_0x52875f,_0x1d6ce3){_0x52875f=_0x52875f-0x0;var _0x3f30d8=_0x301d[_0x52875f];return _0x3f30d8;};'use strict';var _=require(_0xd301('0x0'));var util=require('util');var logger=require(_0xd301('0x1'))(_0xd301('0x2'));var moment=require(_0xd301('0x3'));var BPromise=require(_0xd301('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd301('0x5'));var rimraf=require(_0xd301('0x6'));var config=require(_0xd301('0x7'));var attributes=require(_0xd301('0x8'));module[_0xd301('0x9')]=function(_0x34cab7,_0x113a86){return _0x34cab7['define']('UserWhatsappQueue',attributes,{'tableName':_0xd301('0xa'),'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 8ae83ec..c8b54d1 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 _0x2b99=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b99,0x1bc));var _0x92b9=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x2b99[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var moment=require(_0x92b9('0x2'));var BPromise=require(_0x92b9('0x3'));var rs=require(_0x92b9('0x4'));var fs=require('fs');var Redis=require(_0x92b9('0x5'));var db=require(_0x92b9('0x6'))['db'];var utils=require(_0x92b9('0x7'));var logger=require(_0x92b9('0x8'))(_0x92b9('0x9'));var config=require('../../config/environment');var jayson=require(_0x92b9('0xa'));var client=jayson[_0x92b9('0xb')][_0x92b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x371afb,_0x22a8ee,_0x12e23c){return new BPromise(function(_0xa9ae91,_0x37b253){return client[_0x92b9('0xd')](_0x371afb,_0x12e23c)[_0x92b9('0xe')](function(_0x4e4d7b){logger[_0x92b9('0xf')](_0x92b9('0x10'),_0x22a8ee,_0x92b9('0x11'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x22a8ee,_0x92b9('0x11'),JSON['stringify'](_0x4e4d7b));if(_0x4e4d7b[_0x92b9('0x12')]){if(_0x4e4d7b[_0x92b9('0x12')][_0x92b9('0x13')]===0x1f4){logger['error'](_0x92b9('0x10'),_0x22a8ee,_0x4e4d7b['error'][_0x92b9('0x14')]);return _0x37b253(_0x4e4d7b[_0x92b9('0x12')]['message']);}logger[_0x92b9('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x22a8ee,_0x4e4d7b[_0x92b9('0x12')]['message']);return _0xa9ae91(_0x4e4d7b[_0x92b9('0x12')][_0x92b9('0x14')]);}else{logger[_0x92b9('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x22a8ee,_0x92b9('0x11'));_0xa9ae91(_0x4e4d7b[_0x92b9('0x15')][_0x92b9('0x14')]);}})[_0x92b9('0x16')](function(_0x472990){logger[_0x92b9('0x12')](_0x92b9('0x10'),_0x22a8ee,_0x472990);_0x37b253(_0x472990);});});} \ No newline at end of file +var _0xe735=['info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5ca815,_0x5ad45c){var _0x553400=function(_0x4ffcd6){while(--_0x4ffcd6){_0x5ca815['push'](_0x5ca815['shift']());}};_0x553400(++_0x5ad45c);}(_0xe735,0xfd));var _0x5e73=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xe735[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require(_0x5e73('0x0'));var moment=require('moment');var BPromise=require(_0x5e73('0x1'));var rs=require(_0x5e73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e73('0x3'))['db'];var utils=require(_0x5e73('0x4'));var logger=require(_0x5e73('0x5'))(_0x5e73('0x6'));var config=require(_0x5e73('0x7'));var jayson=require(_0x5e73('0x8'));var client=jayson['client'][_0x5e73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x400c77,_0x5bbac6,_0xfcd043){return new BPromise(function(_0x210e64,_0x23b4be){return client[_0x5e73('0xa')](_0x400c77,_0xfcd043)['then'](function(_0x2e010b){logger[_0x5e73('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5bbac6,_0x5e73('0xc'));logger[_0x5e73('0xd')](_0x5e73('0xe'),_0x5bbac6,'request\x20sent',JSON[_0x5e73('0xf')](_0x2e010b));if(_0x2e010b[_0x5e73('0x10')]){if(_0x2e010b[_0x5e73('0x10')][_0x5e73('0x11')]===0x1f4){logger[_0x5e73('0x10')](_0x5e73('0x12'),_0x5bbac6,_0x2e010b[_0x5e73('0x10')][_0x5e73('0x13')]);return _0x23b4be(_0x2e010b[_0x5e73('0x10')][_0x5e73('0x13')]);}logger[_0x5e73('0x10')](_0x5e73('0x12'),_0x5bbac6,_0x2e010b['error']['message']);return _0x210e64(_0x2e010b[_0x5e73('0x10')][_0x5e73('0x13')]);}else{logger[_0x5e73('0xb')](_0x5e73('0x12'),_0x5bbac6,_0x5e73('0xc'));_0x210e64(_0x2e010b[_0x5e73('0x14')][_0x5e73('0x13')]);}})[_0x5e73('0x15')](function(_0x4fb686){logger[_0x5e73('0x10')](_0x5e73('0x12'),_0x5bbac6,_0x4fb686);_0x23b4be(_0x4fb686);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5a607dc..767f6d8 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 _0xea89=['/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index'];(function(_0x1394b8,_0xf53e70){var _0x4ff78=function(_0x32f336){while(--_0x32f336){_0x1394b8['push'](_0x1394b8['shift']());}};_0x4ff78(++_0xf53e70);}(_0xea89,0x1e2));var _0x9ea8=function(_0xa417ff,_0x2ab57c){_0xa417ff=_0xa417ff-0x0;var _0x2c0a82=_0xea89[_0xa417ff];return _0x2c0a82;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ea8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ea8('0x6'));var config=require('../../config/environment');var controller=require(_0x9ea8('0x7'));router[_0x9ea8('0x8')]('/',auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xa')]);router[_0x9ea8('0x8')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['show']);router[_0x9ea8('0xc')]('/',auth[_0x9ea8('0x9')](),controller['create']);router[_0x9ea8('0xd')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['update']);router[_0x9ea8('0xe')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xf')]);module[_0x9ea8('0x10')]=router; \ No newline at end of file +var _0x4849=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x5344db,_0x13ec93){var _0x31a235=function(_0x1db948){while(--_0x1db948){_0x5344db['push'](_0x5344db['shift']());}};_0x31a235(++_0x13ec93);}(_0x4849,0x86));var _0x9484=function(_0x9a6f61,_0x5c80d9){_0x9a6f61=_0x9a6f61-0x0;var _0x12d4e5=_0x4849[_0x9a6f61];return _0x12d4e5;};'use strict';var multer=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var path=require('path');var timeout=require(_0x9484('0x2'));var express=require(_0x9484('0x3'));var router=express[_0x9484('0x4')]();var fs_extra=require(_0x9484('0x5'));var auth=require(_0x9484('0x6'));var interaction=require(_0x9484('0x7'));var config=require(_0x9484('0x8'));var controller=require('./variable.controller');router[_0x9484('0x9')]('/',auth[_0x9484('0xa')](),controller['index']);router[_0x9484('0x9')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0xc')]);router[_0x9484('0xd')]('/',auth['isAuthenticated'](),controller[_0x9484('0xe')]);router[_0x9484('0xf')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller['update']);router[_0x9484('0x10')](_0x9484('0xb'),auth[_0x9484('0xa')](),controller[_0x9484('0x11')]);module[_0x9484('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 1594937..397f340 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 _0xa969=['sequelize','exports','STRING','name'];(function(_0x310eb7,_0xbbbe0d){var _0xc672=function(_0x16cee2){while(--_0x16cee2){_0x310eb7['push'](_0x310eb7['shift']());}};_0xc672(++_0xbbbe0d);}(_0xa969,0x114));var _0x9a96=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xa969[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0x9a96('0x0'));module[_0x9a96('0x1')]={'name':{'type':Sequelize[_0x9a96('0x2')],'unique':_0x9a96('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9a96('0x2')]}}; \ No newline at end of file +var _0xf1b6=['name','STRING','exports'];(function(_0x5bb619,_0x5b2a82){var _0x182206=function(_0x1791b2){while(--_0x1791b2){_0x5bb619['push'](_0x5bb619['shift']());}};_0x182206(++_0x5b2a82);}(_0xf1b6,0xd1));var _0x6f1b=function(_0x37e5e0,_0x44bf06){_0x37e5e0=_0x37e5e0-0x0;var _0x47b935=_0xf1b6[_0x37e5e0];return _0x47b935;};'use strict';var Sequelize=require('sequelize');module[_0x6f1b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6f1b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6f1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b8e09fe..3fa1698 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 _0x5c57=['Variable','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','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','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','Variables','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include'];(function(_0x55d290,_0x255d89){var _0x301d34=function(_0x414bfa){while(--_0x414bfa){_0x55d290['push'](_0x55d290['shift']());}};_0x301d34(++_0x255d89);}(_0x5c57,0x155));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x75c5('0x0'));var rimraf=require(_0x75c5('0x1'));var zipdir=require(_0x75c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75c5('0x3'));var moment=require(_0x75c5('0x4'));var BPromise=require(_0x75c5('0x5'));var Mustache=require(_0x75c5('0x6'));var util=require('util');var path=require(_0x75c5('0x7'));var sox=require('sox');var csv=require(_0x75c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75c5('0x9'));var _=require(_0x75c5('0xa'));var squel=require(_0x75c5('0xb'));var crypto=require('crypto');var jsforce=require(_0x75c5('0xc'));var deskjs=require(_0x75c5('0xd'));var toCsv=require(_0x75c5('0x8'));var querystring=require(_0x75c5('0xe'));var Papa=require(_0x75c5('0xf'));var Redis=require(_0x75c5('0x10'));var authService=require(_0x75c5('0x11'));var qs=require(_0x75c5('0x12'));var as=require(_0x75c5('0x13'));var hardwareService=require(_0x75c5('0x14'));var logger=require(_0x75c5('0x15'))(_0x75c5('0x16'));var utils=require(_0x75c5('0x17'));var config=require(_0x75c5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x75c5('0x19'))['db'];function respondWithStatusCode(_0x5780d9,_0x5bac14){_0x5bac14=_0x5bac14||0xcc;return function(_0x556222){if(_0x556222){return _0x5780d9['sendStatus'](_0x5bac14);}return _0x5780d9[_0x75c5('0x1a')](_0x5bac14)['end']();};}function respondWithResult(_0x1e6139,_0x2dd55c){_0x2dd55c=_0x2dd55c||0xc8;return function(_0x20c99){if(_0x20c99){return _0x1e6139[_0x75c5('0x1a')](_0x2dd55c)[_0x75c5('0x1b')](_0x20c99);}};}function respondWithFilteredResult(_0x587490,_0x315fb9){return function(_0x2a2439){if(_0x2a2439){var _0x255a1d=typeof _0x315fb9[_0x75c5('0x1c')]===_0x75c5('0x1d')&&typeof _0x315fb9[_0x75c5('0x1e')]===_0x75c5('0x1d');var _0x56e0fe=_0x2a2439[_0x75c5('0x1f')];var _0x5212b8=_0x255a1d?0x0:_0x315fb9[_0x75c5('0x1c')];var _0x5351fa=_0x255a1d?_0x2a2439[_0x75c5('0x1f')]:_0x315fb9[_0x75c5('0x1c')]+_0x315fb9[_0x75c5('0x1e')];var _0x532305;if(_0x5351fa>=_0x56e0fe){_0x5351fa=_0x56e0fe;_0x532305=0xc8;}else{_0x532305=0xce;}_0x587490[_0x75c5('0x1a')](_0x532305);return _0x587490['set'](_0x75c5('0x20'),_0x5212b8+'-'+_0x5351fa+'/'+_0x56e0fe)[_0x75c5('0x1b')](_0x2a2439);}return null;};}function patchUpdates(_0x5e92fd){return function(_0x410c78){try{jsonpatch[_0x75c5('0x21')](_0x410c78,_0x5e92fd,!![]);}catch(_0x4fb2e7){return BPromise['reject'](_0x4fb2e7);}return _0x410c78[_0x75c5('0x22')]();};}function saveUpdates(_0x1b54b8,_0x4aace1){return function(_0x10e59d){if(_0x10e59d){return _0x10e59d[_0x75c5('0x23')](_0x1b54b8)[_0x75c5('0x24')](function(_0x4874c3){return _0x4874c3;});}return null;};}function removeEntity(_0x593fab,_0x3500ca){return function(_0x53e642){if(_0x53e642){return _0x53e642['destroy']()[_0x75c5('0x24')](function(){var _0x5c4cc5=_0x53e642[_0x75c5('0x25')]({'plain':!![]});var _0x480edf=_0x75c5('0x26');return db['UserProfileResource'][_0x75c5('0x27')]({'where':{'type':_0x480edf,'resourceId':_0x5c4cc5['id']}})[_0x75c5('0x24')](function(){return _0x53e642;});})[_0x75c5('0x24')](function(){_0x593fab[_0x75c5('0x1a')](0xcc)[_0x75c5('0x28')]();});}};}function handleEntityNotFound(_0x40cdc1,_0x51016d){return function(_0x2b18ba){if(!_0x2b18ba){_0x40cdc1[_0x75c5('0x29')](0x194);}return _0x2b18ba;};}function handleError(_0x2aaeb1,_0x5263c1){_0x5263c1=_0x5263c1||0x1f4;return function(_0x2dabf8){logger[_0x75c5('0x2a')](_0x2dabf8[_0x75c5('0x2b')]);if(_0x2dabf8[_0x75c5('0x2c')]){delete _0x2dabf8['name'];}_0x2aaeb1[_0x75c5('0x1a')](_0x5263c1)[_0x75c5('0x2d')](_0x2dabf8);};}exports['index']=function(_0x1215d4,_0x5130f0){var _0x251ce4={},_0xcb84fe={},_0x552c47={'count':0x0,'rows':[]};var _0x10ec1f=_[_0x75c5('0x2e')](db['Variable'][_0x75c5('0x2f')],function(_0x379bf4){return{'name':_0x379bf4[_0x75c5('0x30')],'type':_0x379bf4['type'][_0x75c5('0x31')]};});_0xcb84fe[_0x75c5('0x32')]=_[_0x75c5('0x2e')](_0x10ec1f,'name');_0xcb84fe['query']=_[_0x75c5('0x33')](_0x1215d4['query']);_0xcb84fe[_0x75c5('0x34')]=_[_0x75c5('0x35')](_0xcb84fe[_0x75c5('0x32')],_0xcb84fe[_0x75c5('0x36')]);_0x251ce4[_0x75c5('0x37')]=_[_0x75c5('0x35')](_0xcb84fe[_0x75c5('0x32')],qs[_0x75c5('0x38')](_0x1215d4[_0x75c5('0x36')][_0x75c5('0x38')]));_0x251ce4[_0x75c5('0x37')]=_0x251ce4[_0x75c5('0x37')]['length']?_0x251ce4[_0x75c5('0x37')]:_0xcb84fe[_0x75c5('0x32')];if(!_0x1215d4[_0x75c5('0x36')][_0x75c5('0x39')](_0x75c5('0x3a'))){_0x251ce4['limit']=qs['limit'](_0x1215d4['query'][_0x75c5('0x1e')]);_0x251ce4[_0x75c5('0x1c')]=qs[_0x75c5('0x1c')](_0x1215d4[_0x75c5('0x36')]['offset']);}_0x251ce4[_0x75c5('0x3b')]=qs['sort'](_0x1215d4[_0x75c5('0x36')]['sort']);_0x251ce4[_0x75c5('0x3c')]=qs[_0x75c5('0x34')](_[_0x75c5('0x3d')](_0x1215d4[_0x75c5('0x36')],_0xcb84fe['filters']),_0x10ec1f);if(_0x1215d4[_0x75c5('0x36')]['filter']){_0x251ce4[_0x75c5('0x3c')]=_[_0x75c5('0x3e')](_0x251ce4['where'],{'$or':_['map'](_0x10ec1f,function(_0x9098de){if(_0x9098de[_0x75c5('0x3f')]!==_0x75c5('0x40')){var _0x20cace={};_0x20cace[_0x9098de[_0x75c5('0x2c')]]={'$like':'%'+_0x1215d4[_0x75c5('0x36')][_0x75c5('0x41')]+'%'};return _0x20cace;}})});}_0x251ce4=_[_0x75c5('0x3e')]({},_0x251ce4,_0x1215d4[_0x75c5('0x42')]);var _0x508cb4={'where':_0x251ce4['where']};return db['Variable']['count'](_0x508cb4)[_0x75c5('0x24')](function(_0x4d2c03){_0x552c47[_0x75c5('0x1f')]=_0x4d2c03;if(_0x1215d4['query'][_0x75c5('0x43')]){_0x251ce4[_0x75c5('0x44')]=[{'all':!![]}];}return db[_0x75c5('0x45')]['findAll'](_0x251ce4);})[_0x75c5('0x24')](function(_0x55b4c2){_0x552c47['rows']=_0x55b4c2;return _0x552c47;})[_0x75c5('0x24')](respondWithFilteredResult(_0x5130f0,_0x251ce4))['catch'](handleError(_0x5130f0,null));};exports[_0x75c5('0x46')]=function(_0x9590ac,_0x459913){var _0x471e12={'raw':!![],'where':{'id':_0x9590ac[_0x75c5('0x47')]['id']}},_0xedf721={};_0xedf721[_0x75c5('0x32')]=_[_0x75c5('0x33')](db[_0x75c5('0x45')][_0x75c5('0x2f')]);_0xedf721[_0x75c5('0x36')]=_['keys'](_0x9590ac[_0x75c5('0x36')]);_0xedf721[_0x75c5('0x34')]=_[_0x75c5('0x35')](_0xedf721[_0x75c5('0x32')],_0xedf721[_0x75c5('0x36')]);_0x471e12[_0x75c5('0x37')]=_['intersection'](_0xedf721['model'],qs['fields'](_0x9590ac[_0x75c5('0x36')][_0x75c5('0x38')]));_0x471e12[_0x75c5('0x37')]=_0x471e12['attributes'][_0x75c5('0x48')]?_0x471e12[_0x75c5('0x37')]:_0xedf721[_0x75c5('0x32')];if(_0x9590ac['query'][_0x75c5('0x43')]){_0x471e12[_0x75c5('0x44')]=[{'all':!![]}];}_0x471e12=_[_0x75c5('0x3e')]({},_0x471e12,_0x9590ac[_0x75c5('0x42')]);return db[_0x75c5('0x45')][_0x75c5('0x49')](_0x471e12)[_0x75c5('0x24')](handleEntityNotFound(_0x459913,null))[_0x75c5('0x24')](respondWithResult(_0x459913,null))['catch'](handleError(_0x459913,null));};exports[_0x75c5('0x4a')]=function(_0x53a143,_0x3e4e7e){return db[_0x75c5('0x45')][_0x75c5('0x4a')](_0x53a143[_0x75c5('0x4b')],{})[_0x75c5('0x24')](function(_0xf4e556){var _0x2d3fe7=_0x53a143['user']['get']({'plain':!![]});if(!_0x2d3fe7)throw new Error(_0x75c5('0x4c'));if(_0x2d3fe7[_0x75c5('0x4d')]==='user'){var _0x9c9701=_0xf4e556[_0x75c5('0x25')]({'plain':!![]});var _0x367627=_0x75c5('0x26');return db[_0x75c5('0x4e')][_0x75c5('0x49')]({'where':{'name':_0x367627,'userProfileId':_0x2d3fe7['userProfileId']},'raw':!![]})[_0x75c5('0x24')](function(_0x26e036){if(_0x26e036&&_0x26e036[_0x75c5('0x4f')]===0x0){return db[_0x75c5('0x50')]['create']({'name':_0x9c9701[_0x75c5('0x2c')],'resourceId':_0x9c9701['id'],'type':_0x26e036[_0x75c5('0x2c')],'sectionId':_0x26e036['id']},{})['then'](function(){return _0xf4e556;});}else{return _0xf4e556;}})[_0x75c5('0x51')](function(_0x557f14){logger[_0x75c5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557f14);throw _0x557f14;});}return _0xf4e556;})['then'](respondWithResult(_0x3e4e7e,0xc9))[_0x75c5('0x51')](handleError(_0x3e4e7e,null));};exports[_0x75c5('0x23')]=function(_0x96e5f6,_0x40ebf6){if(_0x96e5f6[_0x75c5('0x4b')]['id']){delete _0x96e5f6[_0x75c5('0x4b')]['id'];}return db[_0x75c5('0x45')][_0x75c5('0x49')]({'where':{'id':_0x96e5f6[_0x75c5('0x47')]['id']}})[_0x75c5('0x24')](handleEntityNotFound(_0x40ebf6,null))[_0x75c5('0x24')](saveUpdates(_0x96e5f6[_0x75c5('0x4b')],null))['then'](respondWithResult(_0x40ebf6,null))[_0x75c5('0x51')](handleError(_0x40ebf6,null));};exports[_0x75c5('0x27')]=function(_0x495eef,_0x2ba5c9){return db['Variable'][_0x75c5('0x49')]({'where':{'id':_0x495eef[_0x75c5('0x47')]['id']}})[_0x75c5('0x24')](handleEntityNotFound(_0x2ba5c9,null))[_0x75c5('0x24')](removeEntity(_0x2ba5c9,null))['catch'](handleError(_0x2ba5c9,null));}; \ No newline at end of file +var _0x0241=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','map','Variable','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user'];(function(_0x15104e,_0x599a41){var _0x497e6f=function(_0x476eaa){while(--_0x476eaa){_0x15104e['push'](_0x15104e['shift']());}};_0x497e6f(++_0x599a41);}(_0x0241,0x102));var _0x1024=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0241[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1024('0x0'));var zipdir=require(_0x1024('0x1'));var jsonpatch=require(_0x1024('0x2'));var rp=require('request-promise');var moment=require(_0x1024('0x3'));var BPromise=require(_0x1024('0x4'));var Mustache=require(_0x1024('0x5'));var util=require(_0x1024('0x6'));var path=require(_0x1024('0x7'));var sox=require('sox');var csv=require(_0x1024('0x8'));var ejs=require(_0x1024('0x9'));var fs=require('fs');var fs_extra=require(_0x1024('0xa'));var _=require(_0x1024('0xb'));var squel=require('squel');var crypto=require(_0x1024('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1024('0xd'));var Redis=require(_0x1024('0xe'));var authService=require(_0x1024('0xf'));var qs=require(_0x1024('0x10'));var as=require(_0x1024('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1024('0x12'))(_0x1024('0x13'));var utils=require(_0x1024('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1024('0x15'))['db'];function respondWithStatusCode(_0x13f63b,_0x154440){_0x154440=_0x154440||0xcc;return function(_0x38b939){if(_0x38b939){return _0x13f63b[_0x1024('0x16')](_0x154440);}return _0x13f63b[_0x1024('0x17')](_0x154440)[_0x1024('0x18')]();};}function respondWithResult(_0x68855,_0x4db2c3){_0x4db2c3=_0x4db2c3||0xc8;return function(_0x26fc4f){if(_0x26fc4f){return _0x68855['status'](_0x4db2c3)[_0x1024('0x19')](_0x26fc4f);}};}function respondWithFilteredResult(_0x33f8e1,_0x5b99a1){return function(_0x176a25){if(_0x176a25){var _0x1b3c6b=typeof _0x5b99a1[_0x1024('0x1a')]===_0x1024('0x1b')&&typeof _0x5b99a1[_0x1024('0x1c')]===_0x1024('0x1b');var _0x5ae692=_0x176a25[_0x1024('0x1d')];var _0x41cf4b=_0x1b3c6b?0x0:_0x5b99a1[_0x1024('0x1a')];var _0x3a4d98=_0x1b3c6b?_0x176a25[_0x1024('0x1d')]:_0x5b99a1[_0x1024('0x1a')]+_0x5b99a1[_0x1024('0x1c')];var _0x407e42;if(_0x3a4d98>=_0x5ae692){_0x3a4d98=_0x5ae692;_0x407e42=0xc8;}else{_0x407e42=0xce;}_0x33f8e1[_0x1024('0x17')](_0x407e42);return _0x33f8e1[_0x1024('0x1e')](_0x1024('0x1f'),_0x41cf4b+'-'+_0x3a4d98+'/'+_0x5ae692)[_0x1024('0x19')](_0x176a25);}return null;};}function patchUpdates(_0x4fb592){return function(_0x59c69e){try{jsonpatch[_0x1024('0x20')](_0x59c69e,_0x4fb592,!![]);}catch(_0x9b7d9b){return BPromise[_0x1024('0x21')](_0x9b7d9b);}return _0x59c69e[_0x1024('0x22')]();};}function saveUpdates(_0x327e64,_0x5c6817){return function(_0x1c42a6){if(_0x1c42a6){return _0x1c42a6[_0x1024('0x23')](_0x327e64)[_0x1024('0x24')](function(_0x37fd20){return _0x37fd20;});}return null;};}function removeEntity(_0x2ed954,_0x31a370){return function(_0x3bc069){if(_0x3bc069){return _0x3bc069[_0x1024('0x25')]()[_0x1024('0x24')](function(){var _0x189f76=_0x3bc069[_0x1024('0x26')]({'plain':!![]});var _0x53c5a6=_0x1024('0x27');return db[_0x1024('0x28')]['destroy']({'where':{'type':_0x53c5a6,'resourceId':_0x189f76['id']}})[_0x1024('0x24')](function(){return _0x3bc069;});})['then'](function(){_0x2ed954[_0x1024('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a713a,_0x486c65){return function(_0x36c20f){if(!_0x36c20f){_0x1a713a['sendStatus'](0x194);}return _0x36c20f;};}function handleError(_0x3a73cd,_0x5bc963){_0x5bc963=_0x5bc963||0x1f4;return function(_0x163f6e){logger[_0x1024('0x29')](_0x163f6e[_0x1024('0x2a')]);if(_0x163f6e[_0x1024('0x2b')]){delete _0x163f6e['name'];}_0x3a73cd[_0x1024('0x17')](_0x5bc963)['send'](_0x163f6e);};}exports['index']=function(_0x328c57,_0x1d23fd){var _0x41f8b9={},_0x34033c={},_0x5bf90e={'count':0x0,'rows':[]};var _0x24ac42=_[_0x1024('0x2c')](db[_0x1024('0x2d')][_0x1024('0x2e')],function(_0x3adfa4){return{'name':_0x3adfa4[_0x1024('0x2f')],'type':_0x3adfa4[_0x1024('0x30')][_0x1024('0x31')]};});_0x34033c[_0x1024('0x32')]=_[_0x1024('0x2c')](_0x24ac42,_0x1024('0x2b'));_0x34033c['query']=_['keys'](_0x328c57['query']);_0x34033c[_0x1024('0x33')]=_[_0x1024('0x34')](_0x34033c[_0x1024('0x32')],_0x34033c[_0x1024('0x35')]);_0x41f8b9[_0x1024('0x36')]=_[_0x1024('0x34')](_0x34033c[_0x1024('0x32')],qs[_0x1024('0x37')](_0x328c57[_0x1024('0x35')][_0x1024('0x37')]));_0x41f8b9[_0x1024('0x36')]=_0x41f8b9[_0x1024('0x36')][_0x1024('0x38')]?_0x41f8b9[_0x1024('0x36')]:_0x34033c[_0x1024('0x32')];if(!_0x328c57[_0x1024('0x35')][_0x1024('0x39')](_0x1024('0x3a'))){_0x41f8b9[_0x1024('0x1c')]=qs[_0x1024('0x1c')](_0x328c57[_0x1024('0x35')][_0x1024('0x1c')]);_0x41f8b9['offset']=qs['offset'](_0x328c57[_0x1024('0x35')][_0x1024('0x1a')]);}_0x41f8b9['order']=qs[_0x1024('0x3b')](_0x328c57[_0x1024('0x35')][_0x1024('0x3b')]);_0x41f8b9[_0x1024('0x3c')]=qs[_0x1024('0x33')](_[_0x1024('0x3d')](_0x328c57[_0x1024('0x35')],_0x34033c[_0x1024('0x33')]),_0x24ac42);if(_0x328c57[_0x1024('0x35')][_0x1024('0x3e')]){_0x41f8b9[_0x1024('0x3c')]=_[_0x1024('0x3f')](_0x41f8b9[_0x1024('0x3c')],{'$or':_[_0x1024('0x2c')](_0x24ac42,function(_0x1cb936){if(_0x1cb936[_0x1024('0x30')]!==_0x1024('0x40')){var _0xa1616d={};_0xa1616d[_0x1cb936[_0x1024('0x2b')]]={'$like':'%'+_0x328c57[_0x1024('0x35')]['filter']+'%'};return _0xa1616d;}})});}_0x41f8b9=_[_0x1024('0x3f')]({},_0x41f8b9,_0x328c57[_0x1024('0x41')]);var _0x42eeb5={'where':_0x41f8b9[_0x1024('0x3c')]};return db['Variable']['count'](_0x42eeb5)[_0x1024('0x24')](function(_0x39d74a){_0x5bf90e[_0x1024('0x1d')]=_0x39d74a;if(_0x328c57[_0x1024('0x35')][_0x1024('0x42')]){_0x41f8b9[_0x1024('0x43')]=[{'all':!![]}];}return db[_0x1024('0x2d')][_0x1024('0x44')](_0x41f8b9);})[_0x1024('0x24')](function(_0x4ada74){_0x5bf90e[_0x1024('0x45')]=_0x4ada74;return _0x5bf90e;})[_0x1024('0x24')](respondWithFilteredResult(_0x1d23fd,_0x41f8b9))[_0x1024('0x46')](handleError(_0x1d23fd,null));};exports[_0x1024('0x47')]=function(_0x3aace8,_0x4586d3){var _0x283226={'raw':!![],'where':{'id':_0x3aace8[_0x1024('0x48')]['id']}},_0x38a81e={};_0x38a81e[_0x1024('0x32')]=_[_0x1024('0x49')](db[_0x1024('0x2d')][_0x1024('0x2e')]);_0x38a81e[_0x1024('0x35')]=_[_0x1024('0x49')](_0x3aace8[_0x1024('0x35')]);_0x38a81e[_0x1024('0x33')]=_['intersection'](_0x38a81e['model'],_0x38a81e[_0x1024('0x35')]);_0x283226['attributes']=_[_0x1024('0x34')](_0x38a81e[_0x1024('0x32')],qs[_0x1024('0x37')](_0x3aace8['query'][_0x1024('0x37')]));_0x283226[_0x1024('0x36')]=_0x283226[_0x1024('0x36')][_0x1024('0x38')]?_0x283226[_0x1024('0x36')]:_0x38a81e[_0x1024('0x32')];if(_0x3aace8['query'][_0x1024('0x42')]){_0x283226['include']=[{'all':!![]}];}_0x283226=_[_0x1024('0x3f')]({},_0x283226,_0x3aace8['options']);return db[_0x1024('0x2d')][_0x1024('0x4a')](_0x283226)[_0x1024('0x24')](handleEntityNotFound(_0x4586d3,null))[_0x1024('0x24')](respondWithResult(_0x4586d3,null))[_0x1024('0x46')](handleError(_0x4586d3,null));};exports[_0x1024('0x4b')]=function(_0x4de0e9,_0x35b85b){return db['Variable']['create'](_0x4de0e9[_0x1024('0x4c')],{})[_0x1024('0x24')](function(_0x2bf0c5){var _0x270926=_0x4de0e9[_0x1024('0x4d')][_0x1024('0x26')]({'plain':!![]});if(!_0x270926)throw new Error(_0x1024('0x4e'));if(_0x270926[_0x1024('0x4f')]===_0x1024('0x4d')){var _0x43cacf=_0x2bf0c5['get']({'plain':!![]});var _0x270705=_0x1024('0x27');return db[_0x1024('0x50')][_0x1024('0x4a')]({'where':{'name':_0x270705,'userProfileId':_0x270926[_0x1024('0x51')]},'raw':!![]})[_0x1024('0x24')](function(_0x14b3da){if(_0x14b3da&&_0x14b3da[_0x1024('0x52')]===0x0){return db[_0x1024('0x28')][_0x1024('0x4b')]({'name':_0x43cacf[_0x1024('0x2b')],'resourceId':_0x43cacf['id'],'type':_0x14b3da[_0x1024('0x2b')],'sectionId':_0x14b3da['id']},{})['then'](function(){return _0x2bf0c5;});}else{return _0x2bf0c5;}})[_0x1024('0x46')](function(_0x4989e6){logger['error'](_0x1024('0x53'),_0x4989e6);throw _0x4989e6;});}return _0x2bf0c5;})[_0x1024('0x24')](respondWithResult(_0x35b85b,0xc9))[_0x1024('0x46')](handleError(_0x35b85b,null));};exports[_0x1024('0x23')]=function(_0x563f07,_0x1abc83){if(_0x563f07[_0x1024('0x4c')]['id']){delete _0x563f07[_0x1024('0x4c')]['id'];}return db[_0x1024('0x2d')][_0x1024('0x4a')]({'where':{'id':_0x563f07[_0x1024('0x48')]['id']}})[_0x1024('0x24')](handleEntityNotFound(_0x1abc83,null))[_0x1024('0x24')](saveUpdates(_0x563f07['body'],null))[_0x1024('0x24')](respondWithResult(_0x1abc83,null))[_0x1024('0x46')](handleError(_0x1abc83,null));};exports[_0x1024('0x25')]=function(_0x1964ab,_0x1b3109){return db['Variable'][_0x1024('0x4a')]({'where':{'id':_0x1964ab['params']['id']}})[_0x1024('0x24')](handleEntityNotFound(_0x1b3109,null))[_0x1024('0x24')](removeEntity(_0x1b3109,null))[_0x1024('0x46')](handleError(_0x1b3109,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d8ae73e..0528dff 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 _0x5790=['./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2d9a0f,_0x238a38){var _0x2236e8=function(_0x5a91b6){while(--_0x5a91b6){_0x2d9a0f['push'](_0x2d9a0f['shift']());}};_0x2236e8(++_0x238a38);}(_0x5790,0x139));var _0x0579=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5790[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0579('0x0'));var util=require(_0x0579('0x1'));var logger=require(_0x0579('0x2'))(_0x0579('0x3'));var moment=require(_0x0579('0x4'));var BPromise=require(_0x0579('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0579('0x6'));var rimraf=require(_0x0579('0x7'));var config=require(_0x0579('0x8'));var attributes=require(_0x0579('0x9'));module[_0x0579('0xa')]=function(_0x3101f3,_0x3dbcca){return _0x3101f3[_0x0579('0xb')](_0x0579('0xc'),attributes,{'tableName':_0x0579('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x533f=['path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4a4e77,_0x186df1){var _0x146e8a=function(_0x13d829){while(--_0x13d829){_0x4a4e77['push'](_0x4a4e77['shift']());}};_0x146e8a(++_0x186df1);}(_0x533f,0x159));var _0xf533=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x533f[_0xef4cf0];return _0x497ad2;};'use strict';var _=require(_0xf533('0x0'));var util=require(_0xf533('0x1'));var logger=require(_0xf533('0x2'))(_0xf533('0x3'));var moment=require('moment');var BPromise=require(_0xf533('0x4'));var rp=require(_0xf533('0x5'));var fs=require('fs');var path=require(_0xf533('0x6'));var rimraf=require(_0xf533('0x7'));var config=require(_0xf533('0x8'));var attributes=require('./variable.attributes');module[_0xf533('0x9')]=function(_0x2515d8,_0x544002){return _0x2515d8[_0xf533('0xa')](_0xf533('0xb'),attributes,{'tableName':_0xf533('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c3f30ad..f00a81d 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x78d6ae,_0x6b7196){var _0x2c8de5=function(_0x437bc9){while(--_0x437bc9){_0x78d6ae['push'](_0x78d6ae['shift']());}};_0x2c8de5(++_0x6b7196);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2872b0,_0x4b0855){_0x2872b0=_0x2872b0-0x0;var _0x58b379=_0x7fbe[_0x2872b0];return _0x58b379;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x3318fe,_0x3f5d89){var _0x574ad=function(_0x2e843e){while(--_0x2e843e){_0x3318fe['push'](_0x3318fe['shift']());}};_0x574ad(++_0x3f5d89);}(_0x55ca,0x126));var _0xa55c=function(_0x32905d,_0x2ed18c){_0x32905d=_0x32905d-0x0;var _0x2c3f12=_0x55ca[_0x32905d];return _0x2c3f12;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8e1ef33..cce4586 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 _0x7826=['index','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7826,0x1d7));var _0x6782=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x7826[_0x81dcac];return _0xc7803b;};'use strict';var express=require(_0x6782('0x0'));var router=express[_0x6782('0x1')]();var auth=require(_0x6782('0x2'));var controller=require(_0x6782('0x3'));router[_0x6782('0x4')]('/',controller[_0x6782('0x5')]);router[_0x6782('0x4')]('/fetch',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6782('0x6')]);router[_0x6782('0x4')](_0x6782('0x7'),auth[_0x6782('0x8')](),auth[_0x6782('0x9')](),controller[_0x6782('0xa')]);router[_0x6782('0x4')](_0x6782('0xb'),auth[_0x6782('0x8')](),auth['canUpdate'](),controller['pull']);router[_0x6782('0x4')](_0x6782('0xc'),auth[_0x6782('0x8')](),controller[_0x6782('0xd')]);router[_0x6782('0x4')](_0x6782('0xe'),controller[_0x6782('0xf')]);module[_0x6782('0x10')]=router; \ No newline at end of file +var _0x9b96=['/fetch','canUpdate','fetch','isAuthenticated','reset','/pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b96,0x96));var _0x69b9=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x9b96[_0x2b5eae];return _0x5f3ac9;};'use strict';var express=require(_0x69b9('0x0'));var router=express[_0x69b9('0x1')]();var auth=require(_0x69b9('0x2'));var controller=require('./version.controller');router[_0x69b9('0x3')]('/',controller['index']);router['get'](_0x69b9('0x4'),auth['isAuthenticated'](),auth[_0x69b9('0x5')](),controller[_0x69b9('0x6')]);router['get']('/reset',auth[_0x69b9('0x7')](),auth[_0x69b9('0x5')](),controller[_0x69b9('0x8')]);router['get'](_0x69b9('0x9'),auth[_0x69b9('0x7')](),auth[_0x69b9('0x5')](),controller['pull']);router[_0x69b9('0x3')](_0x69b9('0xa'),auth[_0x69b9('0x7')](),controller[_0x69b9('0xb')]);router['get'](_0x69b9('0xc'),controller['migrations']);module[_0x69b9('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 17dd39d..5329e08 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 _0xfca5=['replace','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','exports','query','fetch','tags','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','root','server','migrations','length'];(function(_0x3e400d,_0x569ed1){var _0x17e63f=function(_0x46aae5){while(--_0x46aae5){_0x3e400d['push'](_0x3e400d['shift']());}};_0x17e63f(++_0x569ed1);}(_0xfca5,0x1bb));var _0x5fca=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xfca5[_0x52b24f];return _0x46ea6b;};'use strict';var Umzug=require(_0x5fca('0x0'));var path=require(_0x5fca('0x1'));var fs=require('fs');var _=require(_0x5fca('0x2'));var pkginfo=require('pkginfo')(module,_0x5fca('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x5fca('0x4')];var db=require(_0x5fca('0x5'))['db'];var config=require(_0x5fca('0x6'));var pm2=require(_0x5fca('0x7'));var logger=require(_0x5fca('0x8'))(_0x5fca('0x9'));var git=require('simple-git')(config['root']);exports['index']=function(_0xf6d3eb,_0x53c4d0){var _0x378e3f={'current':module[_0x5fca('0xa')][_0x5fca('0x3')],'phonebar':0x2};if(_0xf6d3eb[_0x5fca('0xb')]&&_0xf6d3eb[_0x5fca('0xb')]['latest']){return git[_0x5fca('0xc')]()[_0x5fca('0xd')](function(_0x3b2b85,_0x5344dd){_0x378e3f['latest']=(_0x3b2b85?module[_0x5fca('0xa')][_0x5fca('0x3')]:_0x5344dd['latest'])||_0x5fca('0xe');return _0x53c4d0[_0x5fca('0xf')](0xc8)['json'](_0x378e3f);});}else{return _0x53c4d0[_0x5fca('0xf')](0xc8)[_0x5fca('0x10')](_0x378e3f);}};exports[_0x5fca('0xc')]=function(_0x6b717,_0x2b3cbd){return git[_0x5fca('0xc')](['origin','master'],function(_0x3adb21){if(_0x3adb21){logger[_0x5fca('0x11')](_0x3adb21);return _0x2b3cbd[_0x5fca('0xf')](0x1f4)[_0x5fca('0x10')](_0x3adb21);}logger[_0x5fca('0x12')](_0x5fca('0x13'));return _0x2b3cbd[_0x5fca('0xf')](0xc8)[_0x5fca('0x10')]({'output':_0x5fca('0x14')});});};exports[_0x5fca('0x15')]=function(_0x8821f1,_0x5836d3){return git[_0x5fca('0x15')]([_0x5fca('0x16'),'FETCH_HEAD'],function(_0x4ad2ca){if(_0x4ad2ca){logger[_0x5fca('0x11')](_0x4ad2ca);return _0x5836d3[_0x5fca('0xf')](0x1f4)[_0x5fca('0x10')](_0x4ad2ca);}logger[_0x5fca('0x12')](_0x5fca('0x17'));return _0x5836d3[_0x5fca('0xf')](0xc8)['json']({'output':_0x5fca('0x18')});});};exports[_0x5fca('0x19')]=function(_0x283d56,_0x3f48a4){exec('npm\x20install\x20--production',function(_0x21aed6,_0x4da298,_0x386985){logger[_0x5fca('0x12')](_0x4da298);logger[_0x5fca('0x12')](_0x386985);if(_0x21aed6){logger[_0x5fca('0x11')](_0x21aed6);return _0x3f48a4[_0x5fca('0xf')](0x1f4)[_0x5fca('0x10')](_0x21aed6);}return _0x3f48a4[_0x5fca('0xf')](0xc8)[_0x5fca('0x10')]({'output':_0x4da298});});};exports[_0x5fca('0x1a')]=function(_0x33bc8b,_0x104ad9){return pm2[_0x5fca('0x1a')](_0x5fca('0x1b'))[_0x5fca('0x1c')](function(_0x4d8410){logger[_0x5fca('0x12')](_0x5fca('0x1d'),_0x4d8410);return _0x104ad9[_0x5fca('0xf')](0xc8)['json']({'output':_0x5fca('0x1e')});})[_0x5fca('0x1f')](function(_0x4359b1){logger[_0x5fca('0x11')](_0x4359b1);return _0x104ad9[_0x5fca('0xf')](0x1f4)[_0x5fca('0x10')](_0x4359b1);});};exports['migrations']=function(_0x59ab02,_0xe37800){var _0x19c35b=fs['readdirSync'](path[_0x5fca('0x20')](config[_0x5fca('0x21')],_0x5fca('0x22'),_0x5fca('0x23')));var _0x397d47=[];for(var _0x11accd=0x0;_0x11accd<_0x19c35b[_0x5fca('0x24')];_0x11accd++){var _0x817536=_0x19c35b[_0x11accd][_0x5fca('0x25')]('.js','');if(compareVersions(module[_0x5fca('0xa')][_0x5fca('0x3')],_0x817536)===-0x1){_0x397d47['push'](_0x817536);}}if(_0x397d47[_0x5fca('0x24')]){var _0x5093c9=_0x397d47[_0x5fca('0x26')](compareVersions);var _0x3e0f83=new Umzug({'storage':_0x5fca('0x27'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x5fca('0x3')},'migrations':{'params':[db['sequelize'][_0x5fca('0x28')](),db[_0x5fca('0x27')][_0x5fca('0x29')],function(){throw new Error(_0x5fca('0x2a'));}],'path':path[_0x5fca('0x20')](config[_0x5fca('0x21')],_0x5fca('0x22'),_0x5fca('0x23')),'pattern':/\.js$/}});_0x3e0f83['up']({'migrations':_[_0x5fca('0x2b')](_0x5093c9,function(_0x295e02){return _0x295e02+'.js';})})[_0x5fca('0x1c')](function(){return _0xe37800[_0x5fca('0xf')](0xc8)[_0x5fca('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x5fca('0xa')][_0x5fca('0x3')]+_0x5fca('0x2c')+_[_0x5fca('0x2d')](_0x5093c9),'migrations':_[_0x5fca('0x20')](_0x5093c9)});})['catch'](function(_0x465840){if(_0x465840 instanceof db[_0x5fca('0x27')][_0x5fca('0x2e')]){return _0xe37800['status'](0xc8)[_0x5fca('0x10')]({'output':_0x5fca('0x2f')});}else{return _0xe37800[_0x5fca('0xf')](0x1f4)[_0x5fca('0x10')](_0x465840);}});}else{return _0xe37800[_0x5fca('0xf')](0xc8)[_0x5fca('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x2048=['info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','replace','.js','push','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../config/pm2','update','root','index','version','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error'];(function(_0x573b1f,_0x1d9832){var _0x46d54a=function(_0x3dcf47){while(--_0x3dcf47){_0x573b1f['push'](_0x573b1f['shift']());}};_0x46d54a(++_0x1d9832);}(_0x2048,0x82));var _0x8204=function(_0x28da10,_0x29470c){_0x28da10=_0x28da10-0x0;var _0x298372=_0x2048[_0x28da10];return _0x298372;};'use strict';var Umzug=require(_0x8204('0x0'));var path=require(_0x8204('0x1'));var fs=require('fs');var _=require(_0x8204('0x2'));var pkginfo=require(_0x8204('0x3'))(module,'version');var compareVersions=require(_0x8204('0x4'));var exec=require(_0x8204('0x5'))[_0x8204('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x8204('0x7'));var logger=require('../../config/logger')(_0x8204('0x8'));var git=require('simple-git')(config[_0x8204('0x9')]);exports[_0x8204('0xa')]=function(_0x1e8c59,_0x3167d5){var _0x3a79be={'current':module['exports'][_0x8204('0xb')],'phonebar':0x2};if(_0x1e8c59[_0x8204('0xc')]&&_0x1e8c59['query'][_0x8204('0xd')]){return git['fetch']()[_0x8204('0xe')](function(_0x56ea13,_0x200991){_0x3a79be[_0x8204('0xd')]=(_0x56ea13?module[_0x8204('0xf')][_0x8204('0xb')]:_0x200991[_0x8204('0xd')])||_0x8204('0x10');return _0x3167d5[_0x8204('0x11')](0xc8)[_0x8204('0x12')](_0x3a79be);});}else{return _0x3167d5[_0x8204('0x11')](0xc8)[_0x8204('0x12')](_0x3a79be);}};exports[_0x8204('0x13')]=function(_0x556509,_0x32fd6b){return git['fetch']([_0x8204('0x14'),_0x8204('0x15')],function(_0x52f203){if(_0x52f203){logger[_0x8204('0x16')](_0x52f203);return _0x32fd6b[_0x8204('0x11')](0x1f4)[_0x8204('0x12')](_0x52f203);}logger[_0x8204('0x17')](_0x8204('0x18'));return _0x32fd6b[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x8204('0x19')]=function(_0x4c8935,_0x24bfde){return git[_0x8204('0x19')]([_0x8204('0x1a'),_0x8204('0x1b')],function(_0x19d4ed){if(_0x19d4ed){logger[_0x8204('0x16')](_0x19d4ed);return _0x24bfde[_0x8204('0x11')](0x1f4)[_0x8204('0x12')](_0x19d4ed);}logger[_0x8204('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x24bfde[_0x8204('0x11')](0xc8)['json']({'output':_0x8204('0x1c')});});};exports['pull']=function(_0x341978,_0xa86e26){exec(_0x8204('0x1d'),function(_0x349bcc,_0x568b43,_0x2d0b56){logger[_0x8204('0x17')](_0x568b43);logger[_0x8204('0x17')](_0x2d0b56);if(_0x349bcc){logger[_0x8204('0x16')](_0x349bcc);return _0xa86e26[_0x8204('0x11')](0x1f4)[_0x8204('0x12')](_0x349bcc);}return _0xa86e26[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':_0x568b43});});};exports[_0x8204('0x1e')]=function(_0xeb3422,_0x584603){return pm2[_0x8204('0x1e')](_0x8204('0x1f'))[_0x8204('0x20')](function(_0x448c14){logger[_0x8204('0x17')]('pm2\x20restart\x20motion\x20%s',_0x448c14);return _0x584603[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':_0x8204('0x21')});})[_0x8204('0x22')](function(_0x582fb8){logger[_0x8204('0x16')](_0x582fb8);return _0x584603[_0x8204('0x11')](0x1f4)['json'](_0x582fb8);});};exports[_0x8204('0x23')]=function(_0x262acd,_0x405909){var _0x1e91b8=fs['readdirSync'](path[_0x8204('0x24')](config['root'],_0x8204('0x25'),'migrations'));var _0x357eec=[];for(var _0x3cde19=0x0;_0x3cde19<_0x1e91b8[_0x8204('0x26')];_0x3cde19++){var _0x43f067=_0x1e91b8[_0x3cde19][_0x8204('0x27')](_0x8204('0x28'),'');if(compareVersions(module['exports'][_0x8204('0xb')],_0x43f067)===-0x1){_0x357eec[_0x8204('0x29')](_0x43f067);}}if(_0x357eec[_0x8204('0x26')]){var _0x2f670d=_0x357eec[_0x8204('0x2a')](compareVersions);var _0x1be46d=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x8204('0x2b')],'modelName':_0x8204('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x8204('0x2c')]['getQueryInterface'](),db['sequelize'][_0x8204('0x2d')],function(){throw new Error(_0x8204('0x2e'));}],'path':path['join'](config[_0x8204('0x9')],_0x8204('0x25'),'migrations'),'pattern':/\.js$/}});_0x1be46d['up']({'migrations':_[_0x8204('0x2f')](_0x2f670d,function(_0x28a490){return _0x28a490+_0x8204('0x28');})})[_0x8204('0x20')](function(){return _0x405909[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x8204('0xf')]['version']+'\x20to\x20'+_[_0x8204('0x30')](_0x2f670d),'migrations':_['join'](_0x2f670d)});})[_0x8204('0x22')](function(_0x4052a5){if(_0x4052a5 instanceof db[_0x8204('0x2c')][_0x8204('0x31')]){return _0x405909[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':_0x8204('0x32')});}else{return _0x405909[_0x8204('0x11')](0x1f4)['json'](_0x4052a5);}});}else{return _0x405909[_0x8204('0x11')](0xc8)[_0x8204('0x12')]({'output':_0x8204('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 164d63c..f5cf583 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 _0xd674=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xf3b0c3,_0x384d23){var _0x447fa8=function(_0x26277c){while(--_0x26277c){_0xf3b0c3['push'](_0xf3b0c3['shift']());}};_0x447fa8(++_0x384d23);}(_0xd674,0x1b2));var _0x4d67=function(_0x4eeb1d,_0xa01958){_0x4eeb1d=_0x4eeb1d-0x0;var _0x1a5375=_0xd674[_0x4eeb1d];return _0x1a5375;};'use strict';var multer=require(_0x4d67('0x0'));var util=require(_0x4d67('0x1'));var path=require('path');var timeout=require(_0x4d67('0x2'));var express=require(_0x4d67('0x3'));var router=express[_0x4d67('0x4')]();var fs_extra=require(_0x4d67('0x5'));var auth=require(_0x4d67('0x6'));var interaction=require(_0x4d67('0x7'));var config=require('../../config/environment');var controller=require(_0x4d67('0x8'));router[_0x4d67('0x9')]('/',auth[_0x4d67('0xa')](),controller[_0x4d67('0xb')]);router['get'](_0x4d67('0xc'),auth[_0x4d67('0xa')](),controller[_0x4d67('0xd')]);router[_0x4d67('0x9')](_0x4d67('0xe'),auth[_0x4d67('0xa')](),controller[_0x4d67('0xf')]);router[_0x4d67('0x10')]('/',auth['isAuthenticated'](),controller[_0x4d67('0x11')]);router[_0x4d67('0x12')](_0x4d67('0xe'),auth[_0x4d67('0xa')](),controller[_0x4d67('0x13')]);router[_0x4d67('0x14')](_0x4d67('0xe'),auth[_0x4d67('0xa')](),controller[_0x4d67('0x15')]);module[_0x4d67('0x16')]=router; \ No newline at end of file +var _0xbf8e=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x529d5d,_0x3e6a12){var _0x5c1cc5=function(_0x41f6c4){while(--_0x41f6c4){_0x529d5d['push'](_0x529d5d['shift']());}};_0x5c1cc5(++_0x3e6a12);}(_0xbf8e,0x100));var _0xebf8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbf8e[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xebf8('0x0'));var util=require(_0xebf8('0x1'));var path=require(_0xebf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xebf8('0x3'));var router=express[_0xebf8('0x4')]();var fs_extra=require(_0xebf8('0x5'));var auth=require(_0xebf8('0x6'));var interaction=require(_0xebf8('0x7'));var config=require(_0xebf8('0x8'));var controller=require(_0xebf8('0x9'));router[_0xebf8('0xa')]('/',auth[_0xebf8('0xb')](),controller[_0xebf8('0xc')]);router['get'](_0xebf8('0xd'),auth[_0xebf8('0xb')](),controller['describe']);router[_0xebf8('0xa')](_0xebf8('0xe'),auth[_0xebf8('0xb')](),controller[_0xebf8('0xf')]);router[_0xebf8('0x10')]('/',auth[_0xebf8('0xb')](),controller['create']);router[_0xebf8('0x11')]('/:id',auth[_0xebf8('0xb')](),controller[_0xebf8('0x12')]);router[_0xebf8('0x13')](_0xebf8('0xe'),auth[_0xebf8('0xb')](),controller[_0xebf8('0x14')]);module[_0xebf8('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 ce44d97..d9cb8c2 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 _0x0bb4=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5a7309,_0x54f90a){var _0x1d71e5=function(_0x4657c8){while(--_0x4657c8){_0x5a7309['push'](_0x5a7309['shift']());}};_0x1d71e5(++_0x54f90a);}(_0x0bb4,0x77));var _0x40bb=function(_0x3ef94c,_0x584dd6){_0x3ef94c=_0x3ef94c-0x0;var _0x110810=_0x0bb4[_0x3ef94c];return _0x110810;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x40bb('0x2')]},'calleridnum':{'type':Sequelize[_0x40bb('0x2')]},'calleridname':{'type':Sequelize[_0x40bb('0x2')]},'queue':{'type':Sequelize[_0x40bb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x40bb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x40bb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x40bb('0x3')]},'agentdumpAt':{'type':Sequelize[_0x40bb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x40bb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x40bb('0x5')]},'reason':{'type':Sequelize[_0x40bb('0x2')]},'lastevent':{'type':Sequelize[_0x40bb('0x2')]},'channel':{'type':Sequelize[_0x40bb('0x2')]},'channelstate':{'type':Sequelize[_0x40bb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'language':{'type':Sequelize[_0x40bb('0x2')]},'accountcode':{'type':Sequelize[_0x40bb('0x2')]},'context':{'type':Sequelize[_0x40bb('0x2')]},'exten':{'type':Sequelize[_0x40bb('0x2')]},'priority':{'type':Sequelize[_0x40bb('0x2')]},'destchannel':{'type':Sequelize[_0x40bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x40bb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridnum':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'destlanguage':{'type':Sequelize[_0x40bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x40bb('0x2')]},'destcontext':{'type':Sequelize[_0x40bb('0x2')]},'destexten':{'type':Sequelize[_0x40bb('0x2')]},'destpriority':{'type':Sequelize[_0x40bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x40bb('0x2')],'comment':_0x40bb('0x6')},'transferexten':{'type':Sequelize[_0x40bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x66fa=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0xa408f6,_0x7b4ad9){var _0x2d9056=function(_0x4c51df){while(--_0x4c51df){_0xa408f6['push'](_0xa408f6['shift']());}};_0x2d9056(++_0x7b4ad9);}(_0x66fa,0x117));var _0xa66f=function(_0x56ab07,_0x2d986e){_0x56ab07=_0x56ab07-0x0;var _0x510c8b=_0x66fa[_0x56ab07];return _0x510c8b;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa66f('0x2')]},'calleridnum':{'type':Sequelize[_0xa66f('0x2')]},'calleridname':{'type':Sequelize[_0xa66f('0x2')]},'queue':{'type':Sequelize[_0xa66f('0x2')]},'interface':{'type':Sequelize[_0xa66f('0x2')]},'membername':{'type':Sequelize[_0xa66f('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa66f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xa66f('0x3')]},'agentdumpAt':{'type':Sequelize[_0xa66f('0x3')]},'holdtime':{'type':Sequelize[_0xa66f('0x4')]},'agentcomplete':{'type':Sequelize[_0xa66f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa66f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa66f('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa66f('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa66f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa66f('0x2')]},'connectedlinename':{'type':Sequelize[_0xa66f('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa66f('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa66f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa66f('0x2')]},'destchannelstate':{'type':Sequelize[_0xa66f('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa66f('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa66f('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa66f('0x2')]},'destexten':{'type':Sequelize[_0xa66f('0x2')]},'destpriority':{'type':Sequelize[_0xa66f('0x2')]},'destuniqueid':{'type':Sequelize[_0xa66f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa66f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa66f('0x2')],'comment':_0xa66f('0x6')},'transferexten':{'type':Sequelize[_0xa66f('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa66f('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 2009d23..c6addf5 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 ead9810..9b0adc2 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 _0x5785=['moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5785,0x119));var _0x5578=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x5785[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var logger=require(_0x5578('0x2'))(_0x5578('0x3'));var moment=require(_0x5578('0x4'));var BPromise=require('bluebird');var rp=require(_0x5578('0x5'));var fs=require('fs');var path=require(_0x5578('0x6'));var rimraf=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var attributes=require(_0x5578('0x9'));module[_0x5578('0xa')]=function(_0x35a1f4,_0x1a9d73){return _0x35a1f4[_0x5578('0xb')](_0x5578('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5578('0xd'),_0x5578('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14f5=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','util','api','moment','bluebird','path','rimraf'];(function(_0x49665a,_0x45c590){var _0x353fa3=function(_0x1f9b8f){while(--_0x1f9b8f){_0x49665a['push'](_0x49665a['shift']());}};_0x353fa3(++_0x45c590);}(_0x14f5,0xae));var _0x514f=function(_0x3b5045,_0xb0bea7){_0x3b5045=_0x3b5045-0x0;var _0x3fa262=_0x14f5[_0x3b5045];return _0x3fa262;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var logger=require('../../config/logger')(_0x514f('0x1'));var moment=require(_0x514f('0x2'));var BPromise=require(_0x514f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x514f('0x4'));var rimraf=require(_0x514f('0x5'));var config=require('../../config/environment');var attributes=require(_0x514f('0x6'));module[_0x514f('0x7')]=function(_0xc2ca56,_0x434452){return _0xc2ca56[_0x514f('0x8')](_0x514f('0x9'),attributes,{'tableName':_0x514f('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x514f('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 bb5c75c..cb33961 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 _0x6eb6=['jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','UpdateVoiceAgentReport','VoiceAgentReport','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x6eb6,0x8a));var _0x66eb=function(_0x1dec27,_0x7a70b8){_0x1dec27=_0x1dec27-0x0;var _0x3cffca=_0x6eb6[_0x1dec27];return _0x3cffca;};'use strict';var _=require(_0x66eb('0x0'));var util=require(_0x66eb('0x1'));var moment=require(_0x66eb('0x2'));var BPromise=require(_0x66eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66eb('0x4'));var db=require(_0x66eb('0x5'))['db'];var utils=require(_0x66eb('0x6'));var logger=require(_0x66eb('0x7'))(_0x66eb('0x8'));var config=require(_0x66eb('0x9'));var jayson=require(_0x66eb('0xa'));var client=jayson[_0x66eb('0xb')][_0x66eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec6b6,_0x35c1a3,_0x48f946){return new BPromise(function(_0x453829,_0x9eea1c){return client[_0x66eb('0xd')](_0x2ec6b6,_0x48f946)[_0x66eb('0xe')](function(_0x44d4e5){logger[_0x66eb('0xf')](_0x66eb('0x10'),_0x35c1a3,_0x66eb('0x11'));logger[_0x66eb('0x12')](_0x66eb('0x13'),_0x35c1a3,_0x66eb('0x11'),JSON[_0x66eb('0x14')](_0x44d4e5));if(_0x44d4e5['error']){if(_0x44d4e5[_0x66eb('0x15')][_0x66eb('0x16')]===0x1f4){logger[_0x66eb('0x15')](_0x66eb('0x10'),_0x35c1a3,_0x44d4e5[_0x66eb('0x15')]['message']);return _0x9eea1c(_0x44d4e5[_0x66eb('0x15')]['message']);}logger[_0x66eb('0x15')](_0x66eb('0x10'),_0x35c1a3,_0x44d4e5[_0x66eb('0x15')][_0x66eb('0x17')]);return _0x453829(_0x44d4e5['error']['message']);}else{logger[_0x66eb('0xf')](_0x66eb('0x10'),_0x35c1a3,_0x66eb('0x11'));_0x453829(_0x44d4e5[_0x66eb('0x18')][_0x66eb('0x17')]);}})[_0x66eb('0x19')](function(_0x4f4a98){logger[_0x66eb('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x35c1a3,_0x4f4a98);_0x9eea1c(_0x4f4a98);});});}exports[_0x66eb('0x1a')]=function(_0x4951df){var _0x78d6be=this;return new Promise(function(_0x11f84f,_0x283b89){return db['VoiceAgentReport'][_0x66eb('0x1b')](_0x4951df[_0x66eb('0x1c')],{'raw':_0x4951df['options']?_0x4951df['options']['raw']===undefined?!![]:![]:!![]})[_0x66eb('0xe')](function(_0x6f0581){logger[_0x66eb('0xf')](_0x66eb('0x1a'),_0x4951df);logger[_0x66eb('0x12')](_0x66eb('0x1a'),_0x4951df,JSON['stringify'](_0x6f0581));_0x11f84f(_0x6f0581);})[_0x66eb('0x19')](function(_0xa08eb7){logger[_0x66eb('0x15')]('CreateVoiceAgentReport',_0xa08eb7['message'],_0x4951df);_0x283b89(_0x78d6be[_0x66eb('0x15')](0x1f4,_0xa08eb7[_0x66eb('0x17')]));});});};exports[_0x66eb('0x1d')]=function(_0x184fda){var _0x34c5a8=this;return new Promise(function(_0x236913,_0x391c2b){return db[_0x66eb('0x1e')][_0x66eb('0x1f')](_0x184fda[_0x66eb('0x1c')],{'raw':_0x184fda[_0x66eb('0x20')]?_0x184fda[_0x66eb('0x20')][_0x66eb('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x184fda[_0x66eb('0x20')]?_0x184fda[_0x66eb('0x20')][_0x66eb('0x22')]||null:null,'attributes':_0x184fda['options']?_0x184fda[_0x66eb('0x20')][_0x66eb('0x23')]||null:null,'limit':_0x184fda[_0x66eb('0x20')]?_0x184fda['options'][_0x66eb('0x24')]||null:null})[_0x66eb('0xe')](function(_0x14b84e){logger[_0x66eb('0xf')]('UpdateVoiceAgentReport',_0x184fda);logger[_0x66eb('0x12')]('UpdateVoiceAgentReport',_0x184fda,JSON['stringify'](_0x14b84e));_0x236913(_0x14b84e);})['catch'](function(_0x95b321){logger[_0x66eb('0x15')]('UpdateVoiceAgentReport',_0x95b321[_0x66eb('0x17')],_0x184fda);_0x391c2b(_0x34c5a8[_0x66eb('0x15')](0x1f4,_0x95b321[_0x66eb('0x17')]));});});}; \ No newline at end of file +var _0x4597=['limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','where','attributes'];(function(_0x355439,_0x35a910){var _0x2c2225=function(_0x18a1bd){while(--_0x18a1bd){_0x355439['push'](_0x355439['shift']());}};_0x2c2225(++_0x35a910);}(_0x4597,0x194));var _0x7459=function(_0xf5e2d0,_0x578e64){_0xf5e2d0=_0xf5e2d0-0x0;var _0x40fe36=_0x4597[_0xf5e2d0];return _0x40fe36;};'use strict';var _=require('lodash');var util=require(_0x7459('0x0'));var moment=require(_0x7459('0x1'));var BPromise=require(_0x7459('0x2'));var rs=require(_0x7459('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7459('0x4'))['db'];var utils=require(_0x7459('0x5'));var logger=require(_0x7459('0x6'))(_0x7459('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7459('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f8d8e,_0x5ed84f,_0x1d9232){return new BPromise(function(_0x938a99,_0x45306d){return client['request'](_0x4f8d8e,_0x1d9232)[_0x7459('0x9')](function(_0x1f0f04){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x5ed84f,_0x7459('0xa'));logger[_0x7459('0xb')](_0x7459('0xc'),_0x5ed84f,_0x7459('0xa'),JSON['stringify'](_0x1f0f04));if(_0x1f0f04['error']){if(_0x1f0f04[_0x7459('0xd')][_0x7459('0xe')]===0x1f4){logger['error'](_0x7459('0xf'),_0x5ed84f,_0x1f0f04[_0x7459('0xd')][_0x7459('0x10')]);return _0x45306d(_0x1f0f04['error'][_0x7459('0x10')]);}logger[_0x7459('0xd')](_0x7459('0xf'),_0x5ed84f,_0x1f0f04[_0x7459('0xd')][_0x7459('0x10')]);return _0x938a99(_0x1f0f04[_0x7459('0xd')]['message']);}else{logger[_0x7459('0x11')](_0x7459('0xf'),_0x5ed84f,'request\x20sent');_0x938a99(_0x1f0f04[_0x7459('0x12')][_0x7459('0x10')]);}})[_0x7459('0x13')](function(_0x184b29){logger[_0x7459('0xd')](_0x7459('0xf'),_0x5ed84f,_0x184b29);_0x45306d(_0x184b29);});});}exports[_0x7459('0x14')]=function(_0x53ebc1){var _0x591e9e=this;return new Promise(function(_0xd9760e,_0x403274){return db[_0x7459('0x15')][_0x7459('0x16')](_0x53ebc1[_0x7459('0x17')],{'raw':_0x53ebc1[_0x7459('0x18')]?_0x53ebc1[_0x7459('0x18')][_0x7459('0x19')]===undefined?!![]:![]:!![]})[_0x7459('0x9')](function(_0x427112){logger[_0x7459('0x11')](_0x7459('0x14'),_0x53ebc1);logger[_0x7459('0xb')](_0x7459('0x14'),_0x53ebc1,JSON[_0x7459('0x1a')](_0x427112));_0xd9760e(_0x427112);})[_0x7459('0x13')](function(_0x87a1b7){logger[_0x7459('0xd')]('CreateVoiceAgentReport',_0x87a1b7[_0x7459('0x10')],_0x53ebc1);_0x403274(_0x591e9e[_0x7459('0xd')](0x1f4,_0x87a1b7['message']));});});};exports[_0x7459('0x1b')]=function(_0x3ae7bf){var _0xa8d8bf=this;return new Promise(function(_0x34fba0,_0x51b2bc){return db['VoiceAgentReport']['update'](_0x3ae7bf[_0x7459('0x17')],{'raw':_0x3ae7bf['options']?_0x3ae7bf[_0x7459('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ae7bf[_0x7459('0x18')]?_0x3ae7bf[_0x7459('0x18')][_0x7459('0x1c')]||null:null,'attributes':_0x3ae7bf[_0x7459('0x18')]?_0x3ae7bf[_0x7459('0x18')][_0x7459('0x1d')]||null:null,'limit':_0x3ae7bf[_0x7459('0x18')]?_0x3ae7bf[_0x7459('0x18')][_0x7459('0x1e')]||null:null})[_0x7459('0x9')](function(_0x53219c){logger[_0x7459('0x11')]('UpdateVoiceAgentReport',_0x3ae7bf);logger[_0x7459('0xb')](_0x7459('0x1b'),_0x3ae7bf,JSON[_0x7459('0x1a')](_0x53219c));_0x34fba0(_0x53219c);})[_0x7459('0x13')](function(_0x9b2dca){logger[_0x7459('0xd')]('UpdateVoiceAgentReport',_0x9b2dca[_0x7459('0x10')],_0x3ae7bf);_0x51b2bc(_0xa8d8bf['error'](0x1f4,_0x9b2dca[_0x7459('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ba97118..9f10aed 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 _0xa41a=['/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe'];(function(_0x2df568,_0x593b5c){var _0x3083c0=function(_0x3d51c1){while(--_0x3d51c1){_0x2df568['push'](_0x2df568['shift']());}};_0x3083c0(++_0x593b5c);}(_0xa41a,0x6b));var _0xaa41=function(_0x28306d,_0x90e5cb){_0x28306d=_0x28306d-0x0;var _0x2c8e39=_0xa41a[_0x28306d];return _0x2c8e39;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')]('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['update']);router[_0xaa41('0x12')](_0xaa41('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa41('0x13')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0xf006,0x146));var _0x6f00=function(_0x4edd08,_0x5ec9d0){_0x4edd08=_0x4edd08-0x0;var _0x4a11e7=_0xf006[_0x4edd08];return _0x4a11e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 343b8c4..36519b3 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 _0x7ace=['STRING','ENUM','inbound','internal','outbound','DATE','INTEGER','sequelize','exports'];(function(_0x232829,_0x2223d9){var _0x1995ca=function(_0x2d0eaa){while(--_0x2d0eaa){_0x232829['push'](_0x232829['shift']());}};_0x1995ca(++_0x2223d9);}(_0x7ace,0xd6));var _0xe7ac=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7ace[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xe7ac('0x0'));module[_0xe7ac('0x1')]={'uniqueid':{'type':Sequelize[_0xe7ac('0x2')]},'type':{'type':Sequelize[_0xe7ac('0x3')](_0xe7ac('0x4'),_0xe7ac('0x5'),_0xe7ac('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xe7ac('0x2')]},'accountcode':{'type':Sequelize[_0xe7ac('0x2')]},'source':{'type':Sequelize[_0xe7ac('0x2')]},'destination':{'type':Sequelize[_0xe7ac('0x2')]},'destinationcontext':{'type':Sequelize[_0xe7ac('0x2')]},'callerid':{'type':Sequelize[_0xe7ac('0x2')]},'channel':{'type':Sequelize[_0xe7ac('0x2')]},'destinationchannel':{'type':Sequelize[_0xe7ac('0x2')]},'lastapplication':{'type':Sequelize[_0xe7ac('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe7ac('0x7')]},'systemanswertime':{'type':Sequelize[_0xe7ac('0x7')]},'answertime':{'type':Sequelize[_0xe7ac('0x7')]},'endtime':{'type':Sequelize[_0xe7ac('0x7')]},'duration':{'type':Sequelize[_0xe7ac('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe7ac('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xe7ac('0x2')]},'userfield':{'type':Sequelize[_0xe7ac('0x2')]},'userDisposition':{'type':Sequelize[_0xe7ac('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe7ac('0x2')]},'note':{'type':Sequelize[_0xe7ac('0x2')]},'prefix':{'type':Sequelize[_0xe7ac('0x2')]},'routeid':{'type':Sequelize[_0xe7ac('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48a2=['exports','inbound','inbound-fax','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x48a2,0xe0));var _0x248a=function(_0x57ee02,_0x58b0c4){_0x57ee02=_0x57ee02-0x0;var _0x2fc9b0=_0x48a2[_0x57ee02];return _0x2fc9b0;};'use strict';var Sequelize=require(_0x248a('0x0'));module[_0x248a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x248a('0x2'),'internal','outbound',_0x248a('0x3'),_0x248a('0x4'),_0x248a('0x5'))},'tag':{'type':Sequelize[_0x248a('0x6')]},'accountcode':{'type':Sequelize[_0x248a('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x248a('0x6')]},'destinationcontext':{'type':Sequelize[_0x248a('0x6')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x248a('0x6')]},'destinationchannel':{'type':Sequelize[_0x248a('0x6')]},'lastapplication':{'type':Sequelize[_0x248a('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x248a('0x7')]},'systemanswertime':{'type':Sequelize[_0x248a('0x7')]},'answertime':{'type':Sequelize[_0x248a('0x7')]},'endtime':{'type':Sequelize[_0x248a('0x7')]},'duration':{'type':Sequelize[_0x248a('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x248a('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x248a('0x6')]},'userfield':{'type':Sequelize[_0x248a('0x6')]},'userDisposition':{'type':Sequelize[_0x248a('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x248a('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x248a('0x6')]},'note':{'type':Sequelize[_0x248a('0x6')]},'prefix':{'type':Sequelize[_0x248a('0x6')]},'routeid':{'type':Sequelize[_0x248a('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 453256e..ddf0c6c 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x43debf,_0x52dd5a){var _0x44832b=function(_0x386c36){while(--_0x386c36){_0x43debf['push'](_0x43debf['shift']());}};_0x44832b(++_0x52dd5a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x44caf4,_0x238750){_0x44caf4=_0x44caf4-0x0;var _0x117cad=_0x0b0e[_0x44caf4];return _0x117cad;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9970196..eea5895 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 _0x996b=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash'];(function(_0x4cd874,_0x573fe5){var _0x501388=function(_0x5dd62b){while(--_0x5dd62b){_0x4cd874['push'](_0x4cd874['shift']());}};_0x501388(++_0x573fe5);}(_0x996b,0x9b));var _0xb996=function(_0x47a72c,_0xa44e5){_0x47a72c=_0x47a72c-0x0;var _0x1347f6=_0x996b[_0x47a72c];return _0x1347f6;};'use strict';var _=require(_0xb996('0x0'));var util=require(_0xb996('0x1'));var logger=require(_0xb996('0x2'))(_0xb996('0x3'));var moment=require(_0xb996('0x4'));var BPromise=require(_0xb996('0x5'));var rp=require(_0xb996('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb996('0x7'));var attributes=require(_0xb996('0x8'));module[_0xb996('0x9')]=function(_0x26fc01,_0x4552da){return _0x26fc01[_0xb996('0xa')](_0xb996('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xb996('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd577=['exports','define','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0xd577,0x1ef));var _0x7d57=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xd577[_0x22f85a];return _0xaa717;};'use strict';var _=require(_0x7d57('0x0'));var util=require(_0x7d57('0x1'));var logger=require(_0x7d57('0x2'))(_0x7d57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d57('0x4'));var fs=require('fs');var path=require(_0x7d57('0x5'));var rimraf=require(_0x7d57('0x6'));var config=require(_0x7d57('0x7'));var attributes=require(_0x7d57('0x8'));module[_0x7d57('0x9')]=function(_0x515191,_0x3b99ee){return _0x515191[_0x7d57('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x7d57('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5161f31..f55ebfa 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 _0x4fa2=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','catch','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4eae8c,_0x5cee60){var _0x5a2973=function(_0x25c19e){while(--_0x25c19e){_0x4eae8c['push'](_0x4eae8c['shift']());}};_0x5a2973(++_0x5cee60);}(_0x4fa2,0xac));var _0x24fa=function(_0x564dff,_0x32bdc5){_0x564dff=_0x564dff-0x0;var _0x283988=_0x4fa2[_0x564dff];return _0x283988;};'use strict';var _=require(_0x24fa('0x0'));var util=require(_0x24fa('0x1'));var moment=require(_0x24fa('0x2'));var BPromise=require(_0x24fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x24fa('0x4'));var logger=require('../../config/logger')(_0x24fa('0x5'));var config=require(_0x24fa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x24fa('0x7')][_0x24fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ae7b8,_0x10461e,_0x1460ba){return new BPromise(function(_0x340d34,_0x32c29e){return client[_0x24fa('0x9')](_0x4ae7b8,_0x1460ba)[_0x24fa('0xa')](function(_0x4b63d2){logger['info'](_0x24fa('0xb'),_0x10461e,_0x24fa('0xc'));logger[_0x24fa('0xd')](_0x24fa('0xe'),_0x10461e,'request\x20sent',JSON[_0x24fa('0xf')](_0x4b63d2));if(_0x4b63d2[_0x24fa('0x10')]){if(_0x4b63d2[_0x24fa('0x10')][_0x24fa('0x11')]===0x1f4){logger[_0x24fa('0x10')](_0x24fa('0xb'),_0x10461e,_0x4b63d2[_0x24fa('0x10')][_0x24fa('0x12')]);return _0x32c29e(_0x4b63d2[_0x24fa('0x10')][_0x24fa('0x12')]);}logger[_0x24fa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x10461e,_0x4b63d2[_0x24fa('0x10')][_0x24fa('0x12')]);return _0x340d34(_0x4b63d2[_0x24fa('0x10')][_0x24fa('0x12')]);}else{logger[_0x24fa('0x13')](_0x24fa('0xb'),_0x10461e,_0x24fa('0xc'));_0x340d34(_0x4b63d2[_0x24fa('0x14')][_0x24fa('0x12')]);}})['catch'](function(_0x5913d3){logger[_0x24fa('0x10')](_0x24fa('0xb'),_0x10461e,_0x5913d3);_0x32c29e(_0x5913d3);});});}exports['GetVoiceCallReport']=function(_0x20e18d){var _0x5d1cd8=this;return new Promise(function(_0x1bf206,_0x4d2354){return db[_0x24fa('0x15')][_0x24fa('0x16')]({'raw':_0x20e18d[_0x24fa('0x17')]?_0x20e18d['options'][_0x24fa('0x18')]===undefined?!![]:![]:!![],'where':_0x20e18d['options']?_0x20e18d['options'][_0x24fa('0x19')]||null:null,'attributes':_0x20e18d['options']?_0x20e18d[_0x24fa('0x17')][_0x24fa('0x1a')]||null:null,'limit':_0x20e18d[_0x24fa('0x17')]?_0x20e18d[_0x24fa('0x17')][_0x24fa('0x1b')]||null:null,'include':_0x20e18d[_0x24fa('0x17')]?_0x20e18d[_0x24fa('0x17')][_0x24fa('0x1c')]?_[_0x24fa('0x1d')](_0x20e18d[_0x24fa('0x17')][_0x24fa('0x1c')],function(_0x2b1cfe){return{'model':db[_0x2b1cfe['model']],'as':_0x2b1cfe['as'],'attributes':_0x2b1cfe['attributes'],'include':_0x2b1cfe['include']?_['map'](_0x2b1cfe[_0x24fa('0x1c')],function(_0x43daca){return{'model':db[_0x43daca[_0x24fa('0x1e')]],'as':_0x43daca['as'],'attributes':_0x43daca['attributes'],'include':_0x43daca['include']?_[_0x24fa('0x1d')](_0x43daca[_0x24fa('0x1c')],function(_0x1df64c){return{'model':db[_0x1df64c['model']],'as':_0x1df64c['as'],'attributes':_0x1df64c[_0x24fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x24fa('0xa')](function(_0x43552f){logger[_0x24fa('0x13')](_0x24fa('0x1f'),_0x20e18d);logger[_0x24fa('0xd')]('GetVoiceCallReport',_0x20e18d,JSON[_0x24fa('0xf')](_0x43552f));_0x1bf206(_0x43552f);})['catch'](function(_0x44bf0b){logger[_0x24fa('0x10')](_0x24fa('0x1f'),_0x44bf0b[_0x24fa('0x12')],_0x20e18d);_0x4d2354(_0x5d1cd8['error'](0x1f4,_0x44bf0b[_0x24fa('0x12')]));});});};exports[_0x24fa('0x20')]=function(_0x1c677c){var _0x53c075=this;return new Promise(function(_0x23e986,_0x452b66){return db[_0x24fa('0x15')][_0x24fa('0x21')](_0x1c677c['body'],{'raw':_0x1c677c['options']?_0x1c677c['options'][_0x24fa('0x18')]===undefined?!![]:![]:!![]})[_0x24fa('0xa')](function(_0x228926){logger[_0x24fa('0x13')](_0x24fa('0x20'),_0x1c677c);logger[_0x24fa('0xd')](_0x24fa('0x20'),_0x1c677c,JSON[_0x24fa('0xf')](_0x228926));_0x23e986(_0x228926);})[_0x24fa('0x22')](function(_0x2e6849){logger[_0x24fa('0x10')]('CreateVoiceCallReport',_0x2e6849['message'],_0x1c677c);_0x452b66(_0x53c075[_0x24fa('0x10')](0x1f4,_0x2e6849[_0x24fa('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x5e5d66){var _0x4adffd=this;return new Promise(function(_0x5a79eb,_0x2e1252){return db['VoiceCallReport']['update'](_0x5e5d66[_0x24fa('0x23')],{'raw':_0x5e5d66[_0x24fa('0x17')]?_0x5e5d66['options'][_0x24fa('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e5d66[_0x24fa('0x17')]?_0x5e5d66[_0x24fa('0x17')][_0x24fa('0x19')]||null:null,'attributes':_0x5e5d66[_0x24fa('0x17')]?_0x5e5d66[_0x24fa('0x17')][_0x24fa('0x1a')]||null:null,'limit':_0x5e5d66[_0x24fa('0x17')]?_0x5e5d66[_0x24fa('0x17')][_0x24fa('0x1b')]||null:null})[_0x24fa('0xa')](function(_0x197f56){logger['info'](_0x24fa('0x24'),_0x5e5d66);logger[_0x24fa('0xd')]('UpdateVoiceCallReport',_0x5e5d66,JSON['stringify'](_0x197f56));_0x5a79eb(_0x197f56);})['catch'](function(_0x4e1bcb){logger[_0x24fa('0x10')](_0x24fa('0x24'),_0x4e1bcb[_0x24fa('0x12')],_0x5e5d66);_0x2e1252(_0x4adffd[_0x24fa('0x10')](0x1f4,_0x4e1bcb['message']));});});}; \ No newline at end of file +var _0x354d=['error','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','limit','include','model','attributes','map','debug','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','code'];(function(_0x424ae4,_0x981d2f){var _0x5e666c=function(_0x22415b){while(--_0x22415b){_0x424ae4['push'](_0x424ae4['shift']());}};_0x5e666c(++_0x981d2f);}(_0x354d,0x81));var _0xd354=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x354d[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xd354('0x0'));var moment=require(_0xd354('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd354('0x2'));var db=require(_0xd354('0x3'))['db'];var utils=require(_0xd354('0x4'));var logger=require(_0xd354('0x5'))(_0xd354('0x6'));var config=require(_0xd354('0x7'));var jayson=require(_0xd354('0x8'));var client=jayson[_0xd354('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2090,_0x59556a,_0x36937c){return new BPromise(function(_0x401f45,_0x50a447){return client['request'](_0x5b2090,_0x36937c)[_0xd354('0xa')](function(_0x5759d1){logger[_0xd354('0xb')](_0xd354('0xc'),_0x59556a,_0xd354('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x59556a,'request\x20sent',JSON['stringify'](_0x5759d1));if(_0x5759d1['error']){if(_0x5759d1['error'][_0xd354('0xe')]===0x1f4){logger[_0xd354('0xf')](_0xd354('0xc'),_0x59556a,_0x5759d1['error']['message']);return _0x50a447(_0x5759d1['error']['message']);}logger['error'](_0xd354('0xc'),_0x59556a,_0x5759d1[_0xd354('0xf')][_0xd354('0x10')]);return _0x401f45(_0x5759d1[_0xd354('0xf')][_0xd354('0x10')]);}else{logger[_0xd354('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x59556a,'request\x20sent');_0x401f45(_0x5759d1['result']['message']);}})[_0xd354('0x11')](function(_0xb529d6){logger[_0xd354('0xf')](_0xd354('0xc'),_0x59556a,_0xb529d6);_0x50a447(_0xb529d6);});});}exports[_0xd354('0x12')]=function(_0x695675){var _0x30db6b=this;return new Promise(function(_0x2e8aa8,_0x1a94f7){return db[_0xd354('0x13')][_0xd354('0x14')]({'raw':_0x695675['options']?_0x695675['options'][_0xd354('0x15')]===undefined?!![]:![]:!![],'where':_0x695675[_0xd354('0x16')]?_0x695675[_0xd354('0x16')]['where']||null:null,'attributes':_0x695675['options']?_0x695675['options']['attributes']||null:null,'limit':_0x695675[_0xd354('0x16')]?_0x695675[_0xd354('0x16')][_0xd354('0x17')]||null:null,'include':_0x695675['options']?_0x695675['options'][_0xd354('0x18')]?_['map'](_0x695675[_0xd354('0x16')]['include'],function(_0x4777d9){return{'model':db[_0x4777d9[_0xd354('0x19')]],'as':_0x4777d9['as'],'attributes':_0x4777d9[_0xd354('0x1a')],'include':_0x4777d9[_0xd354('0x18')]?_[_0xd354('0x1b')](_0x4777d9[_0xd354('0x18')],function(_0x3ab422){return{'model':db[_0x3ab422[_0xd354('0x19')]],'as':_0x3ab422['as'],'attributes':_0x3ab422[_0xd354('0x1a')],'include':_0x3ab422['include']?_[_0xd354('0x1b')](_0x3ab422[_0xd354('0x18')],function(_0x5a07ad){return{'model':db[_0x5a07ad[_0xd354('0x19')]],'as':_0x5a07ad['as'],'attributes':_0x5a07ad['attributes']};}):[]};}):[]};}):[]:[]})[_0xd354('0xa')](function(_0x55f61f){logger[_0xd354('0xb')](_0xd354('0x12'),_0x695675);logger[_0xd354('0x1c')](_0xd354('0x12'),_0x695675,JSON[_0xd354('0x1d')](_0x55f61f));_0x2e8aa8(_0x55f61f);})[_0xd354('0x11')](function(_0x4309eb){logger['error'](_0xd354('0x12'),_0x4309eb['message'],_0x695675);_0x1a94f7(_0x30db6b[_0xd354('0xf')](0x1f4,_0x4309eb[_0xd354('0x10')]));});});};exports[_0xd354('0x1e')]=function(_0xc8076b){var _0xd5bc6f=this;return new Promise(function(_0x24abff,_0x37b5e9){return db[_0xd354('0x13')][_0xd354('0x1f')](_0xc8076b[_0xd354('0x20')],{'raw':_0xc8076b['options']?_0xc8076b[_0xd354('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd354('0xa')](function(_0x1437f0){logger[_0xd354('0xb')](_0xd354('0x1e'),_0xc8076b);logger['debug'](_0xd354('0x1e'),_0xc8076b,JSON['stringify'](_0x1437f0));_0x24abff(_0x1437f0);})['catch'](function(_0x1c482c){logger[_0xd354('0xf')](_0xd354('0x1e'),_0x1c482c[_0xd354('0x10')],_0xc8076b);_0x37b5e9(_0xd5bc6f[_0xd354('0xf')](0x1f4,_0x1c482c[_0xd354('0x10')]));});});};exports[_0xd354('0x21')]=function(_0x4ebc78){var _0x2eef86=this;return new Promise(function(_0x10592f,_0x340960){return db[_0xd354('0x13')][_0xd354('0x22')](_0x4ebc78[_0xd354('0x20')],{'raw':_0x4ebc78['options']?_0x4ebc78[_0xd354('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebc78[_0xd354('0x16')]?_0x4ebc78[_0xd354('0x16')][_0xd354('0x23')]||null:null,'attributes':_0x4ebc78[_0xd354('0x16')]?_0x4ebc78[_0xd354('0x16')][_0xd354('0x1a')]||null:null,'limit':_0x4ebc78[_0xd354('0x16')]?_0x4ebc78[_0xd354('0x16')][_0xd354('0x17')]||null:null})[_0xd354('0xa')](function(_0x5b6479){logger[_0xd354('0xb')]('UpdateVoiceCallReport',_0x4ebc78);logger['debug'](_0xd354('0x21'),_0x4ebc78,JSON[_0xd354('0x1d')](_0x5b6479));_0x10592f(_0x5b6479);})[_0xd354('0x11')](function(_0x141fa4){logger[_0xd354('0xf')](_0xd354('0x21'),_0x141fa4[_0xd354('0x10')],_0x4ebc78);_0x340960(_0x2eef86[_0xd354('0xf')](0x1f4,_0x141fa4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6e22171..00a7993 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 _0xf291=['show','post','create','update','destroy','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x59429b,_0x1af82a){var _0x3e8f60=function(_0x2d54e3){while(--_0x2d54e3){_0x59429b['push'](_0x59429b['shift']());}};_0x3e8f60(++_0x1af82a);}(_0xf291,0x195));var _0x1f29=function(_0x58993c,_0x974662){_0x58993c=_0x58993c-0x0;var _0x50b69a=_0xf291[_0x58993c];return _0x50b69a;};'use strict';var multer=require('multer');var util=require(_0x1f29('0x0'));var path=require(_0x1f29('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f29('0x2'));var router=express['Router']();var fs_extra=require(_0x1f29('0x3'));var auth=require(_0x1f29('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f29('0x5'));var controller=require(_0x1f29('0x6'));router[_0x1f29('0x7')]('/',auth[_0x1f29('0x8')](),controller[_0x1f29('0x9')]);router[_0x1f29('0x7')](_0x1f29('0xa'),auth[_0x1f29('0x8')](),controller[_0x1f29('0xb')]);router[_0x1f29('0xc')]('/',auth['isAuthenticated'](),controller[_0x1f29('0xd')]);router['put'](_0x1f29('0xa'),auth['isAuthenticated'](),controller[_0x1f29('0xe')]);router['delete'](_0x1f29('0xa'),auth[_0x1f29('0x8')](),controller[_0x1f29('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8565=['/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get'];(function(_0x302b4e,_0x24ce84){var _0x1c0a09=function(_0x144803){while(--_0x144803){_0x302b4e['push'](_0x302b4e['shift']());}};_0x1c0a09(++_0x24ce84);}(_0x8565,0x1d5));var _0x5856=function(_0x43d6c3,_0x10a3a7){_0x43d6c3=_0x43d6c3-0x0;var _0x1681f5=_0x8565[_0x43d6c3];return _0x1681f5;};'use strict';var multer=require(_0x5856('0x0'));var util=require(_0x5856('0x1'));var path=require(_0x5856('0x2'));var timeout=require(_0x5856('0x3'));var express=require(_0x5856('0x4'));var router=express[_0x5856('0x5')]();var fs_extra=require(_0x5856('0x6'));var auth=require(_0x5856('0x7'));var interaction=require(_0x5856('0x8'));var config=require(_0x5856('0x9'));var controller=require(_0x5856('0xa'));router['get']('/',auth[_0x5856('0xb')](),controller[_0x5856('0xc')]);router[_0x5856('0xd')](_0x5856('0xe'),auth[_0x5856('0xb')](),controller['show']);router[_0x5856('0xf')]('/',auth[_0x5856('0xb')](),controller[_0x5856('0x10')]);router[_0x5856('0x11')](_0x5856('0xe'),auth[_0x5856('0xb')](),controller[_0x5856('0x12')]);router[_0x5856('0x13')](_0x5856('0xe'),auth[_0x5856('0xb')](),controller[_0x5856('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 98f9f4c..8a48658 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 _0x48b1=['BOOLEAN','STRING','name','setDataValue','options','join','split'];(function(_0xb62d3,_0x5a007a){var _0x1c5d67=function(_0x5cc911){while(--_0x5cc911){_0xb62d3['push'](_0xb62d3['shift']());}};_0x1c5d67(++_0x5a007a);}(_0x48b1,0x120));var _0x148b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x148b('0x0')],'unique':_0x148b('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x148b('0x0')],'set':function(_0x3cf67c){this[_0x148b('0x2')](_0x148b('0x3'),_0x3cf67c?_0x3cf67c[_0x148b('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x148b('0x3'))?this['getDataValue'](_0x148b('0x3'))[_0x148b('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x148b('0x0')]},'record':{'type':Sequelize[_0x148b('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x148b('0x0')]},'description':{'type':Sequelize[_0x148b('0x0')]}}; \ No newline at end of file +var _0x4867=['sequelize','exports','STRING','setDataValue','getDataValue','options','split','BOOLEAN'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_0x4867,0x160));var _0x7486=function(_0x59d546,_0x107f05){_0x59d546=_0x59d546-0x0;var _0x41fbdb=_0x4867[_0x59d546];return _0x41fbdb;};'use strict';var Sequelize=require(_0x7486('0x0'));module[_0x7486('0x1')]={'name':{'type':Sequelize[_0x7486('0x2')]},'prefix':{'type':Sequelize[_0x7486('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1047ae){this[_0x7486('0x3')]('options',_0x1047ae?_0x1047ae['join'](''):[]);},'get':function(){return this[_0x7486('0x4')](_0x7486('0x5'))?this[_0x7486('0x4')](_0x7486('0x5'))[_0x7486('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7486('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7486('0x2')]},'record':{'type':Sequelize[_0x7486('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7486('0x2')]},'description':{'type':Sequelize[_0x7486('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 52ea901..9ebf9fc 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 _0x195e=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','end','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x195e,0xfb));var _0xe195=function(_0x95621f,_0x5840ca){_0x95621f=_0x95621f-0x0;var _0x30ea65=_0x195e[_0x95621f];return _0x30ea65;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require(_0xe195('0x4'));var moment=require(_0xe195('0x5'));var BPromise=require(_0xe195('0x6'));var Mustache=require(_0xe195('0x7'));var util=require(_0xe195('0x8'));var path=require(_0xe195('0x9'));var sox=require(_0xe195('0xa'));var csv=require(_0xe195('0xb'));var ejs=require(_0xe195('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0xd'));var squel=require(_0xe195('0xe'));var crypto=require(_0xe195('0xf'));var jsforce=require(_0xe195('0x10'));var deskjs=require(_0xe195('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x16'))(_0xe195('0x17'));var utils=require(_0xe195('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe195('0x19'));var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0x5ae615,_0x3da7d9){_0x3da7d9=_0x3da7d9||0xcc;return function(_0x12fa0f){if(_0x12fa0f){return _0x5ae615[_0xe195('0x1b')](_0x3da7d9);}return _0x5ae615[_0xe195('0x1c')](_0x3da7d9)['end']();};}function respondWithResult(_0x52217d,_0x2e82d1){_0x2e82d1=_0x2e82d1||0xc8;return function(_0x555a6a){if(_0x555a6a){return _0x52217d['status'](_0x2e82d1)[_0xe195('0x1d')](_0x555a6a);}};}function respondWithFilteredResult(_0x5c444f,_0x232c57){return function(_0x542ac7){if(_0x542ac7){var _0x534879=typeof _0x232c57[_0xe195('0x1e')]===_0xe195('0x1f')&&typeof _0x232c57[_0xe195('0x20')]===_0xe195('0x1f');var _0x3a042f=_0x542ac7[_0xe195('0x21')];var _0x4784b1=_0x534879?0x0:_0x232c57[_0xe195('0x1e')];var _0x9c8ba5=_0x534879?_0x542ac7[_0xe195('0x21')]:_0x232c57['offset']+_0x232c57[_0xe195('0x20')];var _0x317d8b;if(_0x9c8ba5>=_0x3a042f){_0x9c8ba5=_0x3a042f;_0x317d8b=0xc8;}else{_0x317d8b=0xce;}_0x5c444f[_0xe195('0x1c')](_0x317d8b);return _0x5c444f[_0xe195('0x22')](_0xe195('0x23'),_0x4784b1+'-'+_0x9c8ba5+'/'+_0x3a042f)[_0xe195('0x1d')](_0x542ac7);}return null;};}function patchUpdates(_0x496722){return function(_0x1c5ac8){try{jsonpatch[_0xe195('0x24')](_0x1c5ac8,_0x496722,!![]);}catch(_0x334b4a){return BPromise[_0xe195('0x25')](_0x334b4a);}return _0x1c5ac8['save']();};}function saveUpdates(_0x4dab1a,_0x4e5f13){return function(_0x57ee33){if(_0x57ee33){return _0x57ee33[_0xe195('0x26')](_0x4dab1a)[_0xe195('0x27')](function(_0x2cb019){return _0x2cb019;});}return null;};}function removeEntity(_0x199148,_0x46b15b){return function(_0x40c6a2){if(_0x40c6a2){return _0x40c6a2[_0xe195('0x28')]()[_0xe195('0x27')](function(){var _0x3d7857=_0x40c6a2[_0xe195('0x29')]({'plain':!![]});var _0x55be2d=_0xe195('0x2a');return db['UserProfileResource'][_0xe195('0x28')]({'where':{'type':_0x55be2d,'resourceId':_0x3d7857['id']}})[_0xe195('0x27')](function(){return _0x40c6a2;});})[_0xe195('0x27')](function(){_0x199148[_0xe195('0x1c')](0xcc)[_0xe195('0x2b')]();});}};}function handleEntityNotFound(_0x38be17,_0x3d0e75){return function(_0x401808){if(!_0x401808){_0x38be17[_0xe195('0x1b')](0x194);}return _0x401808;};}function handleError(_0x1f1ca7,_0x4dd9f3){_0x4dd9f3=_0x4dd9f3||0x1f4;return function(_0x33a08d){logger[_0xe195('0x2c')](_0x33a08d[_0xe195('0x2d')]);if(_0x33a08d[_0xe195('0x2e')]){delete _0x33a08d[_0xe195('0x2e')];}_0x1f1ca7['status'](_0x4dd9f3)['send'](_0x33a08d);};}exports[_0xe195('0x2f')]=function(_0x2022e8,_0x46b6f2){var _0x3aaf2e={},_0x2b69a3={},_0x46aa26={'count':0x0,'rows':[]};var _0x5e83da=_[_0xe195('0x30')](db[_0xe195('0x31')][_0xe195('0x32')],function(_0x59b3bf){return{'name':_0x59b3bf[_0xe195('0x33')],'type':_0x59b3bf['type'][_0xe195('0x34')]};});_0x2b69a3[_0xe195('0x35')]=_['map'](_0x5e83da,_0xe195('0x2e'));_0x2b69a3[_0xe195('0x36')]=_[_0xe195('0x37')](_0x2022e8['query']);_0x2b69a3[_0xe195('0x38')]=_[_0xe195('0x39')](_0x2b69a3[_0xe195('0x35')],_0x2b69a3[_0xe195('0x36')]);_0x3aaf2e[_0xe195('0x3a')]=_[_0xe195('0x39')](_0x2b69a3['model'],qs[_0xe195('0x3b')](_0x2022e8[_0xe195('0x36')][_0xe195('0x3b')]));_0x3aaf2e[_0xe195('0x3a')]=_0x3aaf2e[_0xe195('0x3a')][_0xe195('0x3c')]?_0x3aaf2e[_0xe195('0x3a')]:_0x2b69a3['model'];if(!_0x2022e8[_0xe195('0x36')][_0xe195('0x3d')]('nolimit')){_0x3aaf2e[_0xe195('0x20')]=qs[_0xe195('0x20')](_0x2022e8['query'][_0xe195('0x20')]);_0x3aaf2e['offset']=qs[_0xe195('0x1e')](_0x2022e8[_0xe195('0x36')][_0xe195('0x1e')]);}_0x3aaf2e[_0xe195('0x3e')]=qs[_0xe195('0x3f')](_0x2022e8[_0xe195('0x36')]['sort']);_0x3aaf2e[_0xe195('0x40')]=qs[_0xe195('0x38')](_[_0xe195('0x41')](_0x2022e8['query'],_0x2b69a3[_0xe195('0x38')]),_0x5e83da);if(_0x2022e8[_0xe195('0x36')]['filter']){_0x3aaf2e[_0xe195('0x40')]=_[_0xe195('0x42')](_0x3aaf2e['where'],{'$or':_[_0xe195('0x30')](_0x5e83da,function(_0x9053b8){if(_0x9053b8[_0xe195('0x43')]!=='VIRTUAL'){var _0x2b6bad={};_0x2b6bad[_0x9053b8[_0xe195('0x2e')]]={'$like':'%'+_0x2022e8[_0xe195('0x36')][_0xe195('0x44')]+'%'};return _0x2b6bad;}})});}_0x3aaf2e=_[_0xe195('0x42')]({},_0x3aaf2e,_0x2022e8[_0xe195('0x45')]);var _0x435f60={'where':_0x3aaf2e[_0xe195('0x40')]};return db[_0xe195('0x31')][_0xe195('0x21')](_0x435f60)[_0xe195('0x27')](function(_0xff05fc){_0x46aa26['count']=_0xff05fc;if(_0x2022e8[_0xe195('0x36')][_0xe195('0x46')]){_0x3aaf2e[_0xe195('0x47')]=[{'all':!![]}];}return db[_0xe195('0x31')][_0xe195('0x48')](_0x3aaf2e);})['then'](function(_0x5d1059){_0x46aa26['rows']=_0x5d1059;return _0x46aa26;})['then'](respondWithFilteredResult(_0x46b6f2,_0x3aaf2e))[_0xe195('0x49')](handleError(_0x46b6f2,null));};exports['show']=function(_0x3e6d48,_0x53d60a){var _0x535f6f={'raw':![],'where':{'id':_0x3e6d48[_0xe195('0x4a')]['id']}},_0x2d2cd4={};_0x2d2cd4[_0xe195('0x35')]=_[_0xe195('0x37')](db[_0xe195('0x31')][_0xe195('0x32')]);_0x2d2cd4[_0xe195('0x36')]=_[_0xe195('0x37')](_0x3e6d48['query']);_0x2d2cd4['filters']=_[_0xe195('0x39')](_0x2d2cd4[_0xe195('0x35')],_0x2d2cd4['query']);_0x535f6f[_0xe195('0x3a')]=_[_0xe195('0x39')](_0x2d2cd4[_0xe195('0x35')],qs[_0xe195('0x3b')](_0x3e6d48[_0xe195('0x36')][_0xe195('0x3b')]));_0x535f6f[_0xe195('0x3a')]=_0x535f6f[_0xe195('0x3a')][_0xe195('0x3c')]?_0x535f6f[_0xe195('0x3a')]:_0x2d2cd4[_0xe195('0x35')];if(_0x3e6d48[_0xe195('0x36')]['includeAll']){_0x535f6f[_0xe195('0x47')]=[{'all':!![]}];}_0x535f6f=_[_0xe195('0x42')]({},_0x535f6f,_0x3e6d48[_0xe195('0x45')]);return db[_0xe195('0x31')][_0xe195('0x4b')](_0x535f6f)[_0xe195('0x27')](handleEntityNotFound(_0x53d60a,null))[_0xe195('0x27')](respondWithResult(_0x53d60a,null))[_0xe195('0x49')](handleError(_0x53d60a,null));};exports[_0xe195('0x4c')]=function(_0x19e744,_0x2b3d9b){return db['VoiceChanSpy'][_0xe195('0x4c')](_0x19e744['body'],{})[_0xe195('0x27')](function(_0x43d578){var _0x16ecb3=_0x19e744['user']['get']({'plain':!![]});if(!_0x16ecb3)throw new Error(_0xe195('0x4d'));if(_0x16ecb3[_0xe195('0x4e')]===_0xe195('0x4f')){var _0x11aec8=_0x43d578[_0xe195('0x29')]({'plain':!![]});var _0x22411e=_0xe195('0x2a');return db[_0xe195('0x50')][_0xe195('0x4b')]({'where':{'name':_0x22411e,'userProfileId':_0x16ecb3[_0xe195('0x51')]},'raw':!![]})[_0xe195('0x27')](function(_0x46848e){if(_0x46848e&&_0x46848e[_0xe195('0x52')]===0x0){return db[_0xe195('0x53')][_0xe195('0x4c')]({'name':_0x11aec8[_0xe195('0x2e')],'resourceId':_0x11aec8['id'],'type':_0x46848e[_0xe195('0x2e')],'sectionId':_0x46848e['id']},{})[_0xe195('0x27')](function(){return _0x43d578;});}else{return _0x43d578;}})[_0xe195('0x49')](function(_0x53be82){logger[_0xe195('0x2c')](_0xe195('0x54'),_0x53be82);throw _0x53be82;});}return _0x43d578;})[_0xe195('0x27')](respondWithResult(_0x2b3d9b,0xc9))[_0xe195('0x49')](handleError(_0x2b3d9b,null));};exports[_0xe195('0x26')]=function(_0x36dc3e,_0x57ad8c){if(_0x36dc3e['body']['id']){delete _0x36dc3e[_0xe195('0x55')]['id'];}return db[_0xe195('0x31')][_0xe195('0x4b')]({'where':{'id':_0x36dc3e['params']['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x57ad8c,null))[_0xe195('0x27')](saveUpdates(_0x36dc3e['body'],null))[_0xe195('0x27')](respondWithResult(_0x57ad8c,null))[_0xe195('0x49')](handleError(_0x57ad8c,null));};exports['destroy']=function(_0x276756,_0x5a97ee){return db[_0xe195('0x31')][_0xe195('0x4b')]({'where':{'id':_0x276756[_0xe195('0x4a')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x5a97ee,null))[_0xe195('0x27')](removeEntity(_0x5a97ee,null))[_0xe195('0x49')](handleError(_0x5a97ee,null));}; \ No newline at end of file +var _0x1094=['autoAssociation','UserProfileResource','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection'];(function(_0xd24366,_0x38e6bf){var _0x2d3ee3=function(_0x22fb6b){while(--_0x22fb6b){_0xd24366['push'](_0xd24366['shift']());}};_0x2d3ee3(++_0x38e6bf);}(_0x1094,0x143));var _0x4109=function(_0x33b259,_0x2036be){_0x33b259=_0x33b259-0x0;var _0xf95548=_0x1094[_0x33b259];return _0xf95548;};'use strict';var emlformat=require(_0x4109('0x0'));var rimraf=require(_0x4109('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4109('0x2'));var rp=require('request-promise');var moment=require(_0x4109('0x3'));var BPromise=require(_0x4109('0x4'));var Mustache=require(_0x4109('0x5'));var util=require(_0x4109('0x6'));var path=require(_0x4109('0x7'));var sox=require('sox');var csv=require(_0x4109('0x8'));var ejs=require(_0x4109('0x9'));var fs=require('fs');var fs_extra=require(_0x4109('0xa'));var _=require(_0x4109('0xb'));var squel=require(_0x4109('0xc'));var crypto=require(_0x4109('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4109('0xe'));var toCsv=require(_0x4109('0x8'));var querystring=require(_0x4109('0xf'));var Papa=require(_0x4109('0x10'));var Redis=require(_0x4109('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4109('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4109('0x13'))(_0x4109('0x14'));var utils=require(_0x4109('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4109('0x16'));var db=require(_0x4109('0x17'))['db'];function respondWithStatusCode(_0xfa09ea,_0x41e682){_0x41e682=_0x41e682||0xcc;return function(_0x2c2c9d){if(_0x2c2c9d){return _0xfa09ea['sendStatus'](_0x41e682);}return _0xfa09ea[_0x4109('0x18')](_0x41e682)[_0x4109('0x19')]();};}function respondWithResult(_0x3c8a84,_0x3c893a){_0x3c893a=_0x3c893a||0xc8;return function(_0x4a13fc){if(_0x4a13fc){return _0x3c8a84['status'](_0x3c893a)[_0x4109('0x1a')](_0x4a13fc);}};}function respondWithFilteredResult(_0x397937,_0x2e8e63){return function(_0x37b444){if(_0x37b444){var _0x1d81d8=typeof _0x2e8e63[_0x4109('0x1b')]===_0x4109('0x1c')&&typeof _0x2e8e63[_0x4109('0x1d')]==='undefined';var _0x4c4cf3=_0x37b444[_0x4109('0x1e')];var _0x328f1c=_0x1d81d8?0x0:_0x2e8e63[_0x4109('0x1b')];var _0x2e3fd6=_0x1d81d8?_0x37b444[_0x4109('0x1e')]:_0x2e8e63[_0x4109('0x1b')]+_0x2e8e63[_0x4109('0x1d')];var _0x6e8d56;if(_0x2e3fd6>=_0x4c4cf3){_0x2e3fd6=_0x4c4cf3;_0x6e8d56=0xc8;}else{_0x6e8d56=0xce;}_0x397937[_0x4109('0x18')](_0x6e8d56);return _0x397937['set'](_0x4109('0x1f'),_0x328f1c+'-'+_0x2e3fd6+'/'+_0x4c4cf3)[_0x4109('0x1a')](_0x37b444);}return null;};}function patchUpdates(_0x5cde5d){return function(_0x295f97){try{jsonpatch[_0x4109('0x20')](_0x295f97,_0x5cde5d,!![]);}catch(_0x4ba222){return BPromise['reject'](_0x4ba222);}return _0x295f97[_0x4109('0x21')]();};}function saveUpdates(_0x4e8723,_0x369de0){return function(_0x45d848){if(_0x45d848){return _0x45d848[_0x4109('0x22')](_0x4e8723)[_0x4109('0x23')](function(_0x5ddef4){return _0x5ddef4;});}return null;};}function removeEntity(_0x406d35,_0x438f4f){return function(_0x339cec){if(_0x339cec){return _0x339cec['destroy']()[_0x4109('0x23')](function(){var _0x3141c7=_0x339cec[_0x4109('0x24')]({'plain':!![]});var _0x57768e='ChanSpies';return db['UserProfileResource'][_0x4109('0x25')]({'where':{'type':_0x57768e,'resourceId':_0x3141c7['id']}})[_0x4109('0x23')](function(){return _0x339cec;});})[_0x4109('0x23')](function(){_0x406d35[_0x4109('0x18')](0xcc)[_0x4109('0x19')]();});}};}function handleEntityNotFound(_0x5bbf62,_0x2910cd){return function(_0x357ce6){if(!_0x357ce6){_0x5bbf62['sendStatus'](0x194);}return _0x357ce6;};}function handleError(_0x12b73b,_0x52cb0c){_0x52cb0c=_0x52cb0c||0x1f4;return function(_0x1d3eaa){logger[_0x4109('0x26')](_0x1d3eaa[_0x4109('0x27')]);if(_0x1d3eaa[_0x4109('0x28')]){delete _0x1d3eaa[_0x4109('0x28')];}_0x12b73b['status'](_0x52cb0c)[_0x4109('0x29')](_0x1d3eaa);};}exports['index']=function(_0x1f48fa,_0x2a26bb){var _0xf662af={},_0x319b67={},_0x358a20={'count':0x0,'rows':[]};var _0x12b958=_[_0x4109('0x2a')](db[_0x4109('0x2b')][_0x4109('0x2c')],function(_0x282727){return{'name':_0x282727[_0x4109('0x2d')],'type':_0x282727[_0x4109('0x2e')][_0x4109('0x2f')]};});_0x319b67[_0x4109('0x30')]=_[_0x4109('0x2a')](_0x12b958,_0x4109('0x28'));_0x319b67['query']=_[_0x4109('0x31')](_0x1f48fa[_0x4109('0x32')]);_0x319b67[_0x4109('0x33')]=_[_0x4109('0x34')](_0x319b67[_0x4109('0x30')],_0x319b67[_0x4109('0x32')]);_0xf662af['attributes']=_['intersection'](_0x319b67[_0x4109('0x30')],qs[_0x4109('0x35')](_0x1f48fa[_0x4109('0x32')][_0x4109('0x35')]));_0xf662af['attributes']=_0xf662af[_0x4109('0x36')][_0x4109('0x37')]?_0xf662af[_0x4109('0x36')]:_0x319b67[_0x4109('0x30')];if(!_0x1f48fa[_0x4109('0x32')][_0x4109('0x38')]('nolimit')){_0xf662af[_0x4109('0x1d')]=qs['limit'](_0x1f48fa[_0x4109('0x32')][_0x4109('0x1d')]);_0xf662af['offset']=qs[_0x4109('0x1b')](_0x1f48fa[_0x4109('0x32')]['offset']);}_0xf662af['order']=qs[_0x4109('0x39')](_0x1f48fa['query'][_0x4109('0x39')]);_0xf662af['where']=qs[_0x4109('0x33')](_[_0x4109('0x3a')](_0x1f48fa[_0x4109('0x32')],_0x319b67[_0x4109('0x33')]),_0x12b958);if(_0x1f48fa['query']['filter']){_0xf662af['where']=_[_0x4109('0x3b')](_0xf662af[_0x4109('0x3c')],{'$or':_[_0x4109('0x2a')](_0x12b958,function(_0x3062e5){if(_0x3062e5[_0x4109('0x2e')]!==_0x4109('0x3d')){var _0x269c7a={};_0x269c7a[_0x3062e5[_0x4109('0x28')]]={'$like':'%'+_0x1f48fa[_0x4109('0x32')][_0x4109('0x3e')]+'%'};return _0x269c7a;}})});}_0xf662af=_[_0x4109('0x3b')]({},_0xf662af,_0x1f48fa[_0x4109('0x3f')]);var _0xbd914e={'where':_0xf662af[_0x4109('0x3c')]};return db[_0x4109('0x2b')][_0x4109('0x1e')](_0xbd914e)[_0x4109('0x23')](function(_0x114685){_0x358a20[_0x4109('0x1e')]=_0x114685;if(_0x1f48fa['query'][_0x4109('0x40')]){_0xf662af[_0x4109('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0xf662af);})['then'](function(_0x17e854){_0x358a20[_0x4109('0x42')]=_0x17e854;return _0x358a20;})[_0x4109('0x23')](respondWithFilteredResult(_0x2a26bb,_0xf662af))[_0x4109('0x43')](handleError(_0x2a26bb,null));};exports[_0x4109('0x44')]=function(_0x3db53e,_0x88be51){var _0x590c8a={'raw':![],'where':{'id':_0x3db53e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x4109('0x30')]=_['keys'](db[_0x4109('0x2b')]['rawAttributes']);_0x56b0e5[_0x4109('0x32')]=_[_0x4109('0x31')](_0x3db53e[_0x4109('0x32')]);_0x56b0e5[_0x4109('0x33')]=_[_0x4109('0x34')](_0x56b0e5[_0x4109('0x30')],_0x56b0e5[_0x4109('0x32')]);_0x590c8a['attributes']=_[_0x4109('0x34')](_0x56b0e5[_0x4109('0x30')],qs[_0x4109('0x35')](_0x3db53e[_0x4109('0x32')][_0x4109('0x35')]));_0x590c8a['attributes']=_0x590c8a['attributes'][_0x4109('0x37')]?_0x590c8a['attributes']:_0x56b0e5['model'];if(_0x3db53e[_0x4109('0x32')][_0x4109('0x40')]){_0x590c8a[_0x4109('0x41')]=[{'all':!![]}];}_0x590c8a=_[_0x4109('0x3b')]({},_0x590c8a,_0x3db53e['options']);return db['VoiceChanSpy'][_0x4109('0x45')](_0x590c8a)['then'](handleEntityNotFound(_0x88be51,null))[_0x4109('0x23')](respondWithResult(_0x88be51,null))['catch'](handleError(_0x88be51,null));};exports[_0x4109('0x46')]=function(_0x2ec0b3,_0x3cb3b2){return db[_0x4109('0x2b')][_0x4109('0x46')](_0x2ec0b3[_0x4109('0x47')],{})['then'](function(_0x1abb3b){var _0x4138db=_0x2ec0b3['user']['get']({'plain':!![]});if(!_0x4138db)throw new Error(_0x4109('0x48'));if(_0x4138db[_0x4109('0x49')]===_0x4109('0x4a')){var _0x55772d=_0x1abb3b['get']({'plain':!![]});var _0x57e01e=_0x4109('0x4b');return db[_0x4109('0x4c')][_0x4109('0x45')]({'where':{'name':_0x57e01e,'userProfileId':_0x4138db['userProfileId']},'raw':!![]})[_0x4109('0x23')](function(_0x53753f){if(_0x53753f&&_0x53753f[_0x4109('0x4d')]===0x0){return db[_0x4109('0x4e')]['create']({'name':_0x55772d[_0x4109('0x28')],'resourceId':_0x55772d['id'],'type':_0x53753f[_0x4109('0x28')],'sectionId':_0x53753f['id']},{})['then'](function(){return _0x1abb3b;});}else{return _0x1abb3b;}})[_0x4109('0x43')](function(_0x3b6dbd){logger[_0x4109('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b6dbd);throw _0x3b6dbd;});}return _0x1abb3b;})['then'](respondWithResult(_0x3cb3b2,0xc9))['catch'](handleError(_0x3cb3b2,null));};exports[_0x4109('0x22')]=function(_0x45b5a2,_0x1748f8){if(_0x45b5a2[_0x4109('0x47')]['id']){delete _0x45b5a2[_0x4109('0x47')]['id'];}return db[_0x4109('0x2b')][_0x4109('0x45')]({'where':{'id':_0x45b5a2['params']['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x1748f8,null))[_0x4109('0x23')](saveUpdates(_0x45b5a2['body'],null))[_0x4109('0x23')](respondWithResult(_0x1748f8,null))[_0x4109('0x43')](handleError(_0x1748f8,null));};exports[_0x4109('0x25')]=function(_0x43954d,_0x911e03){return db[_0x4109('0x2b')][_0x4109('0x45')]({'where':{'id':_0x43954d[_0x4109('0x4f')]['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x911e03,null))[_0x4109('0x23')](removeEntity(_0x911e03,null))[_0x4109('0x43')](handleError(_0x911e03,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8b95018..67f75c5 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 _0xa812=['then','catch','exports','models','define','voice_chanspy','bulkCreate','destroy','VoiceExtension','lodash','util','./voiceChanSpy.attributes','context','from-sip','%s%s','system','merge','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User'];(function(_0x31e719,_0x397785){var _0x4ae4e8=function(_0xa35dcf){while(--_0xa35dcf){_0x31e719['push'](_0x31e719['shift']());}};_0x4ae4e8(++_0x397785);}(_0xa812,0x78));var _0x2a81=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xa812[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x2a81('0x0'));var util=require(_0x2a81('0x1'));var BPromise=require('bluebird');var attributes=require(_0x2a81('0x2'));var getUserApplications=function(_0x125ad9,_0xcf6640,_0x7a50f6){var _0x300d07=0x1;var _0x4809bf=[];var _0x4b99d0={'context':_0xcf6640[_0x2a81('0x3')]||_0x2a81('0x4'),'exten':util['format'](_0x2a81('0x5'),_0x125ad9['prefix'],_0x7a50f6),'type':_0x2a81('0x6'),'isApp':![],'ChanSpyId':_0x125ad9['id'],'UserId':_0xcf6640['id']};_0x4809bf['push'](_[_0x2a81('0x7')]({'app':'Set','appdata':util[_0x2a81('0x8')]('CDR(type)=%s',_0x2a81('0x9')),'priority':_0x300d07++},_0x4b99d0));if(_0x125ad9[_0x2a81('0xa')]){_0x4809bf['push'](_[_0x2a81('0x7')]({'app':_0x2a81('0xb'),'appdata':util[_0x2a81('0x8')](_0x2a81('0xc'),_0x125ad9[_0x2a81('0xd')]),'priority':_0x300d07++},_0x4b99d0));}if(_0x125ad9[_0x2a81('0xe')]){_0x4809bf[_0x2a81('0xf')](_['merge']({'app':_0x2a81('0x10'),'appdata':_0x125ad9[_0x2a81('0x11')],'priority':_0x300d07++},_0x4b99d0));}_0x4809bf[_0x2a81('0xf')](_['merge']({'app':_0x2a81('0x12'),'appdata':util[_0x2a81('0x8')](_0x2a81('0x13'),_0xcf6640[_0x2a81('0x14')],_0x125ad9[_0x2a81('0x15')]?_0x125ad9[_0x2a81('0x15')][_0x2a81('0x16')](''):''),'priority':_0x300d07++},_0x4b99d0));if(_0x125ad9['record']){_0x4809bf['push'](_['merge']({'app':_0x2a81('0x17'),'priority':_0x300d07++},_0x4b99d0));}return _0x4809bf;};var getChanSpyApplications=function(_0x2d1e77,_0x1cf0a6){var _0x49de27=[];for(var _0xd4c775=0x0,_0x29d6e3=0x1;_0xd4c775<_0x1cf0a6[_0x2a81('0x18')];_0xd4c775++,_0x29d6e3=0x1){_0x49de27=_0x49de27[_0x2a81('0x19')](getUserApplications(_0x2d1e77,_0x1cf0a6[_0xd4c775],_0x1cf0a6[_0xd4c775]['internal']));if(_0x1cf0a6[_0xd4c775][_0x2a81('0x1a')]!=_0x1cf0a6[_0xd4c775][_0x2a81('0x14')]){_0x49de27=_0x49de27[_0x2a81('0x19')](getUserApplications(_0x2d1e77,_0x1cf0a6[_0xd4c775],_0x1cf0a6[_0xd4c775][_0x2a81('0x14')]));}}return _0x49de27;};var getChanSpyPromise=function(_0x12d7c9,_0x2b02a9){return new BPromise(function(_0x2ee44c,_0x3a8134){return _0x12d7c9[_0x2a81('0x1b')]['findAll']({'attributes':['id',_0x2a81('0x14'),_0x2a81('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2a81('0x1c')](function(_0x4e7e55){if(_0x4e7e55){return _0x2ee44c(getChanSpyApplications(_0x2b02a9,_0x4e7e55));}return _0x2ee44c([]);})[_0x2a81('0x1d')](function(_0x3197c7){_0x3a8134(_0x3197c7);});});};module[_0x2a81('0x1e')]=function(_0x1fd828,_0x560b39){var _0x119a3a=_0x1fd828[_0x2a81('0x1f')];return _0x1fd828[_0x2a81('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x2a81('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b273c,_0x181e63,_0x13ffbb){return getChanSpyPromise(_0x119a3a,_0x4b273c)['then'](function(_0xee11e0){if(_0xee11e0&&_0xee11e0[_0x2a81('0x18')]){return _0x119a3a['VoiceExtension'][_0x2a81('0x22')](_0xee11e0);}})['then'](function(){_0x13ffbb();})[_0x2a81('0x1d')](function(_0x3b3918){_0x13ffbb(_0x3b3918);});},'afterUpdate':function(_0x5afc00,_0x24bc8d,_0x58f51e){return _0x119a3a['VoiceExtension'][_0x2a81('0x23')]({'where':{'ChanSpyId':_0x5afc00['id']}})['then'](function(){return getChanSpyPromise(_0x119a3a,_0x5afc00);})['then'](function(_0x2c5833){if(_0x2c5833&&_0x2c5833['length']){return _0x119a3a[_0x2a81('0x24')][_0x2a81('0x22')](_0x2c5833);}})[_0x2a81('0x1c')](function(){_0x58f51e();})[_0x2a81('0x1d')](function(_0x182501){_0x58f51e(_0x182501);});},'afterDestroy':function(_0x46c637,_0xc84eff,_0x1557ca){return _0x119a3a[_0x2a81('0x24')][_0x2a81('0x23')]({'where':{'ChanSpyId':_0x46c637['id']}})[_0x2a81('0x1c')](function(){_0x1557ca();})[_0x2a81('0x1d')](function(_0x1921f5){_0x1557ca(_0x1921f5);});}}});}; \ No newline at end of file +var _0x6400=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','format','%s%s','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','length','concat','internal','findAll','then','catch','models','define'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x6400,0x10d));var _0x0640=function(_0x5cbbeb,_0x142ebc){_0x5cbbeb=_0x5cbbeb-0x0;var _0x4cf278=_0x6400[_0x5cbbeb];return _0x4cf278;};'use strict';var _=require(_0x0640('0x0'));var util=require(_0x0640('0x1'));var BPromise=require('bluebird');var attributes=require(_0x0640('0x2'));var getUserApplications=function(_0x7b660f,_0x2bb465,_0xa09221){var _0x4ce5c3=0x1;var _0x2676ff=[];var _0x29ad1d={'context':_0x2bb465[_0x0640('0x3')]||'from-sip','exten':util[_0x0640('0x4')](_0x0640('0x5'),_0x7b660f['prefix'],_0xa09221),'type':_0x0640('0x6'),'isApp':![],'ChanSpyId':_0x7b660f['id'],'UserId':_0x2bb465['id']};_0x2676ff[_0x0640('0x7')](_[_0x0640('0x8')]({'app':'Set','appdata':util[_0x0640('0x4')](_0x0640('0x9'),_0x0640('0xa')),'priority':_0x4ce5c3++},_0x29ad1d));if(_0x7b660f[_0x0640('0xb')]){_0x2676ff[_0x0640('0x7')](_[_0x0640('0x8')]({'app':_0x0640('0xc'),'appdata':util['format'](_0x0640('0xd'),_0x7b660f['recordingFormat']),'priority':_0x4ce5c3++},_0x29ad1d));}if(_0x7b660f[_0x0640('0xe')]){_0x2676ff[_0x0640('0x7')](_[_0x0640('0x8')]({'app':_0x0640('0xf'),'appdata':_0x7b660f['password'],'priority':_0x4ce5c3++},_0x29ad1d));}_0x2676ff['push'](_['merge']({'app':_0x0640('0x10'),'appdata':util[_0x0640('0x4')](_0x0640('0x11'),_0x2bb465[_0x0640('0x12')],_0x7b660f[_0x0640('0x13')]?_0x7b660f[_0x0640('0x13')]['join'](''):''),'priority':_0x4ce5c3++},_0x29ad1d));if(_0x7b660f['record']){_0x2676ff[_0x0640('0x7')](_[_0x0640('0x8')]({'app':'StopMixMonitor','priority':_0x4ce5c3++},_0x29ad1d));}return _0x2676ff;};var getChanSpyApplications=function(_0x28b302,_0x20c444){var _0x136397=[];for(var _0x4db8d9=0x0,_0xd6b3d4=0x1;_0x4db8d9<_0x20c444[_0x0640('0x14')];_0x4db8d9++,_0xd6b3d4=0x1){_0x136397=_0x136397[_0x0640('0x15')](getUserApplications(_0x28b302,_0x20c444[_0x4db8d9],_0x20c444[_0x4db8d9][_0x0640('0x16')]));if(_0x20c444[_0x4db8d9]['internal']!=_0x20c444[_0x4db8d9][_0x0640('0x12')]){_0x136397=_0x136397[_0x0640('0x15')](getUserApplications(_0x28b302,_0x20c444[_0x4db8d9],_0x20c444[_0x4db8d9][_0x0640('0x12')]));}}return _0x136397;};var getChanSpyPromise=function(_0x3887e1,_0xab5f8a){return new BPromise(function(_0x16dd45,_0x4b5862){return _0x3887e1['User'][_0x0640('0x17')]({'attributes':['id',_0x0640('0x12'),_0x0640('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0640('0x18')](function(_0x2e9d6e){if(_0x2e9d6e){return _0x16dd45(getChanSpyApplications(_0xab5f8a,_0x2e9d6e));}return _0x16dd45([]);})[_0x0640('0x19')](function(_0xe28118){_0x4b5862(_0xe28118);});});};module['exports']=function(_0x521d17,_0x2a3d26){var _0x156629=_0x521d17[_0x0640('0x1a')];return _0x521d17[_0x0640('0x1b')](_0x0640('0x1c'),attributes,{'tableName':_0x0640('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56f9ca,_0x4bfbeb,_0x23dd3d){return getChanSpyPromise(_0x156629,_0x56f9ca)['then'](function(_0x1abc35){if(_0x1abc35&&_0x1abc35[_0x0640('0x14')]){return _0x156629[_0x0640('0x1e')][_0x0640('0x1f')](_0x1abc35);}})['then'](function(){_0x23dd3d();})[_0x0640('0x19')](function(_0x4c56db){_0x23dd3d(_0x4c56db);});},'afterUpdate':function(_0x2e6346,_0x112f23,_0x4893b7){return _0x156629[_0x0640('0x1e')][_0x0640('0x20')]({'where':{'ChanSpyId':_0x2e6346['id']}})[_0x0640('0x18')](function(){return getChanSpyPromise(_0x156629,_0x2e6346);})[_0x0640('0x18')](function(_0x14519a){if(_0x14519a&&_0x14519a[_0x0640('0x14')]){return _0x156629['VoiceExtension'][_0x0640('0x1f')](_0x14519a);}})[_0x0640('0x18')](function(){_0x4893b7();})[_0x0640('0x19')](function(_0x1e2f26){_0x4893b7(_0x1e2f26);});},'afterDestroy':function(_0x248bda,_0x151377,_0x23a1d1){return _0x156629[_0x0640('0x1e')][_0x0640('0x20')]({'where':{'ChanSpyId':_0x248bda['id']}})[_0x0640('0x18')](function(){_0x23a1d1();})[_0x0640('0x19')](function(_0x5206ec){_0x23a1d1(_0x5206ec);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 928d2ac..b85b826 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 _0xe812=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment'];(function(_0x541a3a,_0xcd79af){var _0x35dbf4=function(_0x33d86b){while(--_0x33d86b){_0x541a3a['push'](_0x541a3a['shift']());}};_0x35dbf4(++_0xcd79af);}(_0xe812,0x1f2));var _0x2e81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe812[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var moment=require(_0x2e81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e81('0x2'));var db=require(_0x2e81('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e81('0x4'))(_0x2e81('0x5'));var config=require('../../config/environment');var jayson=require(_0x2e81('0x6'));var client=jayson[_0x2e81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36604d,_0x32b221,_0x27f9c6){return new BPromise(function(_0x5559ca,_0x142cab){return client[_0x2e81('0x8')](_0x36604d,_0x27f9c6)[_0x2e81('0x9')](function(_0x11a56b){logger['info'](_0x2e81('0xa'),_0x32b221,_0x2e81('0xb'));logger[_0x2e81('0xc')](_0x2e81('0xd'),_0x32b221,_0x2e81('0xb'),JSON[_0x2e81('0xe')](_0x11a56b));if(_0x11a56b[_0x2e81('0xf')]){if(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x10')]===0x1f4){logger[_0x2e81('0xf')](_0x2e81('0xa'),_0x32b221,_0x11a56b['error'][_0x2e81('0x11')]);return _0x142cab(_0x11a56b[_0x2e81('0xf')]['message']);}logger[_0x2e81('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x32b221,_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);return _0x5559ca(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);}else{logger[_0x2e81('0x12')](_0x2e81('0xa'),_0x32b221,'request\x20sent');_0x5559ca(_0x11a56b[_0x2e81('0x13')][_0x2e81('0x11')]);}})['catch'](function(_0x330131){logger['error'](_0x2e81('0xa'),_0x32b221,_0x330131);_0x142cab(_0x330131);});});} \ No newline at end of file +var _0x9567=['info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x9567,0xdc));var _0x7956=function(_0x56e193,_0x208c4f){_0x56e193=_0x56e193-0x0;var _0x507e98=_0x9567[_0x56e193];return _0x507e98;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 9d272bd..f81037a 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 _0x2eaa=['../../config/environment','./voiceContext.controller','isAuthenticated','index','get','create','put','/:id','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48639f,_0x393081){var _0x1915e6=function(_0x26a1b0){while(--_0x26a1b0){_0x48639f['push'](_0x48639f['shift']());}};_0x1915e6(++_0x393081);}(_0x2eaa,0x180));var _0xa2ea=function(_0x49b026,_0x2fc9df){_0x49b026=_0x49b026-0x0;var _0x25596f=_0x2eaa[_0x49b026];return _0x25596f;};'use strict';var multer=require('multer');var util=require(_0xa2ea('0x0'));var path=require(_0xa2ea('0x1'));var timeout=require(_0xa2ea('0x2'));var express=require('express');var router=express[_0xa2ea('0x3')]();var fs_extra=require(_0xa2ea('0x4'));var auth=require(_0xa2ea('0x5'));var interaction=require(_0xa2ea('0x6'));var config=require(_0xa2ea('0x7'));var controller=require(_0xa2ea('0x8'));router['get']('/',auth[_0xa2ea('0x9')](),controller[_0xa2ea('0xa')]);router[_0xa2ea('0xb')]('/:id',auth[_0xa2ea('0x9')](),controller['show']);router['post']('/',auth[_0xa2ea('0x9')](),controller[_0xa2ea('0xc')]);router[_0xa2ea('0xd')](_0xa2ea('0xe'),auth['isAuthenticated'](),controller[_0xa2ea('0xf')]);router[_0xa2ea('0x10')](_0xa2ea('0xe'),auth[_0xa2ea('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x82f5=['get','isAuthenticated','index','/:id','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52e77f,_0x368694){var _0x3aad87=function(_0x2a4f2e){while(--_0x2a4f2e){_0x52e77f['push'](_0x52e77f['shift']());}};_0x3aad87(++_0x368694);}(_0x82f5,0x129));var _0x582f=function(_0x5cd0cf,_0x33b7e2){_0x5cd0cf=_0x5cd0cf-0x0;var _0x4b7c66=_0x82f5[_0x5cd0cf];return _0x4b7c66;};'use strict';var multer=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var path=require(_0x582f('0x2'));var timeout=require(_0x582f('0x3'));var express=require(_0x582f('0x4'));var router=express[_0x582f('0x5')]();var fs_extra=require(_0x582f('0x6'));var auth=require(_0x582f('0x7'));var interaction=require(_0x582f('0x8'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x582f('0x9')]('/',auth[_0x582f('0xa')](),controller[_0x582f('0xb')]);router[_0x582f('0x9')](_0x582f('0xc'),auth[_0x582f('0xa')](),controller['show']);router['post']('/',auth[_0x582f('0xa')](),controller[_0x582f('0xd')]);router[_0x582f('0xe')]('/:id',auth[_0x582f('0xa')](),controller['update']);router[_0x582f('0xf')](_0x582f('0xc'),auth['isAuthenticated'](),controller[_0x582f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index cb0a13e..191091c 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 _0x2856=['sequelize','exports','name','BOOLEAN'];(function(_0x338b26,_0x45d064){var _0x21d9da=function(_0x10c8bb){while(--_0x10c8bb){_0x338b26['push'](_0x338b26['shift']());}};_0x21d9da(++_0x45d064);}(_0x2856,0x194));var _0x6285=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x2856[_0x18d631];return _0x50d708;};'use strict';var Sequelize=require(_0x6285('0x0'));module[_0x6285('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6285('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6285('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1fe=['exports','STRING','BOOLEAN','sequelize'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0xc1fe,0x1c3));var _0xec1f=function(_0xa7626c,_0x522132){_0xa7626c=_0xa7626c-0x0;var _0x24d24e=_0xc1fe[_0xa7626c];return _0x24d24e;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'name':{'type':Sequelize[_0xec1f('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xec1f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xec1f('0x3')],'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 99ef0ee..159368d 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 _0xca47=['client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','destroy','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','keys','includeAll','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','writeFileSync','params','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','jayson/promise'];(function(_0x2c3cfb,_0x411a75){var _0x4495b6=function(_0x5ae84f){while(--_0x5ae84f){_0x2c3cfb['push'](_0x2c3cfb['shift']());}};_0x4495b6(++_0x411a75);}(_0xca47,0xb1));var _0x7ca4=function(_0x21c857,_0x1f9812){_0x21c857=_0x21c857-0x0;var _0x2e6516=_0xca47[_0x21c857];return _0x2e6516;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ca4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ca4('0x1'));var rp=require(_0x7ca4('0x2'));var moment=require(_0x7ca4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7ca4('0x4'));var path=require(_0x7ca4('0x5'));var sox=require(_0x7ca4('0x6'));var csv=require('to-csv');var ejs=require(_0x7ca4('0x7'));var fs=require('fs');var fs_extra=require(_0x7ca4('0x8'));var _=require('lodash');var squel=require(_0x7ca4('0x9'));var crypto=require(_0x7ca4('0xa'));var jsforce=require(_0x7ca4('0xb'));var deskjs=require(_0x7ca4('0xc'));var toCsv=require(_0x7ca4('0xd'));var querystring=require(_0x7ca4('0xe'));var Papa=require('papaparse');var Redis=require(_0x7ca4('0xf'));var authService=require(_0x7ca4('0x10'));var qs=require(_0x7ca4('0x11'));var as=require(_0x7ca4('0x12'));var hardwareService=require(_0x7ca4('0x13'));var logger=require('../../config/logger')(_0x7ca4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ca4('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7ca4('0x16'));var client=jayson[_0x7ca4('0x17')][_0x7ca4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x10cbb9,_0x21130e,_0x559233,_0x2a037d){return new BPromise(function(_0x56d7fd,_0x2f96e2){var _0x11842e=_0x2a037d||client;return _0x11842e[_0x7ca4('0x19')](_0x10cbb9,_0x559233)[_0x7ca4('0x1a')](function(_0x400df5){logger['info'](_0x7ca4('0x1b'),_0x21130e,'request\x20sent');logger[_0x7ca4('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x21130e,_0x7ca4('0x1d'),JSON[_0x7ca4('0x1e')](_0x400df5));if(_0x400df5[_0x7ca4('0x1f')]){if(_0x400df5[_0x7ca4('0x1f')][_0x7ca4('0x20')]===0x1f4){logger[_0x7ca4('0x1f')](_0x7ca4('0x1b'),_0x21130e,_0x400df5[_0x7ca4('0x1f')]['message']);return _0x2f96e2(_0x400df5[_0x7ca4('0x1f')][_0x7ca4('0x21')]);}logger['error'](_0x7ca4('0x1b'),_0x21130e,_0x400df5['error'][_0x7ca4('0x21')]);return _0x56d7fd(_0x400df5[_0x7ca4('0x1f')][_0x7ca4('0x21')]);}else{logger[_0x7ca4('0x22')](_0x7ca4('0x1b'),_0x21130e,_0x7ca4('0x1d'));_0x56d7fd(_0x400df5[_0x7ca4('0x23')]['message']);}})[_0x7ca4('0x24')](function(_0x523de5){logger[_0x7ca4('0x1f')](_0x7ca4('0x1b'),_0x21130e,_0x523de5);_0x2f96e2(_0x523de5);});});}function respondWithStatusCode(_0xad0738,_0x3ba9ce){_0x3ba9ce=_0x3ba9ce||0xcc;return function(_0x1f8894){if(_0x1f8894){return _0xad0738[_0x7ca4('0x25')](_0x3ba9ce);}return _0xad0738[_0x7ca4('0x26')](_0x3ba9ce)[_0x7ca4('0x27')]();};}function respondWithResult(_0x11bc3e,_0x483a17){_0x483a17=_0x483a17||0xc8;return function(_0x2f4a02){if(_0x2f4a02){return _0x11bc3e[_0x7ca4('0x26')](_0x483a17)[_0x7ca4('0x28')](_0x2f4a02);}};}function respondWithFilteredResult(_0x19442a,_0x3371fe){return function(_0x121b84){if(_0x121b84){var _0x40ee4b=typeof _0x3371fe[_0x7ca4('0x29')]===_0x7ca4('0x2a')&&typeof _0x3371fe['limit']===_0x7ca4('0x2a');var _0x5241af=_0x121b84['count'];var _0x427e50=_0x40ee4b?0x0:_0x3371fe[_0x7ca4('0x29')];var _0x49d29e=_0x40ee4b?_0x121b84[_0x7ca4('0x2b')]:_0x3371fe['offset']+_0x3371fe[_0x7ca4('0x2c')];var _0xcd7314;if(_0x49d29e>=_0x5241af){_0x49d29e=_0x5241af;_0xcd7314=0xc8;}else{_0xcd7314=0xce;}_0x19442a[_0x7ca4('0x26')](_0xcd7314);return _0x19442a['set'](_0x7ca4('0x2d'),_0x427e50+'-'+_0x49d29e+'/'+_0x5241af)[_0x7ca4('0x28')](_0x121b84);}return null;};}function patchUpdates(_0x4a3543){return function(_0x584e23){try{jsonpatch['apply'](_0x584e23,_0x4a3543,!![]);}catch(_0x393faf){return BPromise[_0x7ca4('0x2e')](_0x393faf);}return _0x584e23['save']();};}function saveUpdates(_0x57154d,_0x2bb4ea){return function(_0x15968e){if(_0x15968e){return _0x15968e['update'](_0x57154d)['then'](function(_0xa6bdac){return _0xa6bdac;});}return null;};}function removeEntity(_0x14b356,_0x11c108){return function(_0x169e35){if(_0x169e35){return _0x169e35[_0x7ca4('0x2f')]()[_0x7ca4('0x1a')](function(){var _0x43d765=_0x169e35['get']({'plain':!![]});var _0x60467c=_0x7ca4('0x30');return db[_0x7ca4('0x31')][_0x7ca4('0x2f')]({'where':{'type':_0x60467c,'resourceId':_0x43d765['id']}})['then'](function(){return _0x169e35;});})[_0x7ca4('0x1a')](function(){_0x14b356['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a7c5,_0x3b454b){return function(_0x59d0db){if(!_0x59d0db){_0x47a7c5[_0x7ca4('0x25')](0x194);}return _0x59d0db;};}function handleError(_0x2ca761,_0x5217c7){_0x5217c7=_0x5217c7||0x1f4;return function(_0x3900f5){logger[_0x7ca4('0x1f')](_0x3900f5[_0x7ca4('0x32')]);if(_0x3900f5[_0x7ca4('0x33')]){delete _0x3900f5[_0x7ca4('0x33')];}_0x2ca761[_0x7ca4('0x26')](_0x5217c7)['send'](_0x3900f5);};}exports[_0x7ca4('0x34')]=function(_0x213cb7,_0x14b8f1){var _0x356831={},_0x3d97d={},_0x655e39={'count':0x0,'rows':[]};var _0x4bd49e=_[_0x7ca4('0x35')](db[_0x7ca4('0x36')][_0x7ca4('0x37')],function(_0x125ec9){return{'name':_0x125ec9['fieldName'],'type':_0x125ec9[_0x7ca4('0x38')]['key']};});_0x3d97d[_0x7ca4('0x39')]=_[_0x7ca4('0x35')](_0x4bd49e,_0x7ca4('0x33'));_0x3d97d[_0x7ca4('0x3a')]=_['keys'](_0x213cb7[_0x7ca4('0x3a')]);_0x3d97d['filters']=_['intersection'](_0x3d97d[_0x7ca4('0x39')],_0x3d97d['query']);_0x356831[_0x7ca4('0x3b')]=_[_0x7ca4('0x3c')](_0x3d97d['model'],qs[_0x7ca4('0x3d')](_0x213cb7[_0x7ca4('0x3a')]['fields']));_0x356831[_0x7ca4('0x3b')]=_0x356831[_0x7ca4('0x3b')][_0x7ca4('0x3e')]?_0x356831[_0x7ca4('0x3b')]:_0x3d97d[_0x7ca4('0x39')];if(!_0x213cb7[_0x7ca4('0x3a')]['hasOwnProperty'](_0x7ca4('0x3f'))){_0x356831[_0x7ca4('0x2c')]=qs[_0x7ca4('0x2c')](_0x213cb7[_0x7ca4('0x3a')][_0x7ca4('0x2c')]);_0x356831['offset']=qs['offset'](_0x213cb7[_0x7ca4('0x3a')][_0x7ca4('0x29')]);}_0x356831[_0x7ca4('0x40')]=qs[_0x7ca4('0x41')](_0x213cb7['query'][_0x7ca4('0x41')]);_0x356831[_0x7ca4('0x42')]=qs[_0x7ca4('0x43')](_[_0x7ca4('0x44')](_0x213cb7['query'],_0x3d97d[_0x7ca4('0x43')]),_0x4bd49e);if(_0x213cb7['query']['filter']){_0x356831[_0x7ca4('0x42')]=_[_0x7ca4('0x45')](_0x356831[_0x7ca4('0x42')],{'$or':_[_0x7ca4('0x35')](_0x4bd49e,function(_0x47cf84){if(_0x47cf84[_0x7ca4('0x38')]!==_0x7ca4('0x46')){var _0x3e333a={};_0x3e333a[_0x47cf84[_0x7ca4('0x33')]]={'$like':'%'+_0x213cb7['query']['filter']+'%'};return _0x3e333a;}})});}_0x356831=_['merge']({},_0x356831,_0x213cb7[_0x7ca4('0x47')]);var _0x2b0539={'where':_0x356831[_0x7ca4('0x42')]};return db[_0x7ca4('0x36')][_0x7ca4('0x2b')](_0x2b0539)['then'](function(_0x54058f){_0x655e39[_0x7ca4('0x2b')]=_0x54058f;if(_0x213cb7[_0x7ca4('0x3a')]['includeAll']){_0x356831[_0x7ca4('0x48')]=[{'all':!![]}];}return db[_0x7ca4('0x36')][_0x7ca4('0x49')](_0x356831);})['then'](function(_0x287147){_0x655e39[_0x7ca4('0x4a')]=_0x287147;return _0x655e39;})[_0x7ca4('0x1a')](respondWithFilteredResult(_0x14b8f1,_0x356831))['catch'](handleError(_0x14b8f1,null));};exports['show']=function(_0x2de161,_0x11cb37){var _0x5c47c9={'raw':![],'where':{'id':_0x2de161['params']['id']}},_0x2573b5={};_0x2573b5[_0x7ca4('0x39')]=_[_0x7ca4('0x4b')](db[_0x7ca4('0x36')]['rawAttributes']);_0x2573b5['query']=_['keys'](_0x2de161['query']);_0x2573b5['filters']=_[_0x7ca4('0x3c')](_0x2573b5['model'],_0x2573b5[_0x7ca4('0x3a')]);_0x5c47c9[_0x7ca4('0x3b')]=_[_0x7ca4('0x3c')](_0x2573b5[_0x7ca4('0x39')],qs[_0x7ca4('0x3d')](_0x2de161[_0x7ca4('0x3a')]['fields']));_0x5c47c9[_0x7ca4('0x3b')]=_0x5c47c9[_0x7ca4('0x3b')][_0x7ca4('0x3e')]?_0x5c47c9['attributes']:_0x2573b5[_0x7ca4('0x39')];if(_0x2de161[_0x7ca4('0x3a')][_0x7ca4('0x4c')]){_0x5c47c9[_0x7ca4('0x48')]=[{'all':!![]}];}_0x5c47c9=_[_0x7ca4('0x45')]({},_0x5c47c9,_0x2de161[_0x7ca4('0x47')]);return db[_0x7ca4('0x36')][_0x7ca4('0x4d')](_0x5c47c9)['then'](handleEntityNotFound(_0x11cb37,null))[_0x7ca4('0x1a')](respondWithResult(_0x11cb37,null))[_0x7ca4('0x24')](handleError(_0x11cb37,null));};exports[_0x7ca4('0x4e')]=function(_0x23bf58,_0x39c9aa,_0x4c0dc9){var _0x2c3560;return db['VoiceContext']['create'](_0x23bf58[_0x7ca4('0x4f')],{'raw':!![]})[_0x7ca4('0x1a')](function(_0xaf0f72){_0x2c3560=_0xaf0f72;return db['VoiceContext'][_0x7ca4('0x49')]({'raw':!![]});})[_0x7ca4('0x1a')](function(_0x4a41cd){var _0xaf6c3a=fs[_0x7ca4('0x50')](path[_0x7ca4('0x51')](config['root'],_0x7ca4('0x52')),_0x7ca4('0x53'));var _0x533b55=ejs[_0x7ca4('0x54')](_0xaf6c3a,{'contexts':_0x4a41cd||[]});fs['writeFileSync'](_0x7ca4('0x55'),_0x533b55);})['then'](function(){return respondWithRpcPromise(_0x7ca4('0x56'),_0x7ca4('0x4e'),{'module':_0x7ca4('0x57')});})[_0x7ca4('0x1a')](function(){var _0x569ff1=_0x23bf58[_0x7ca4('0x58')][_0x7ca4('0x59')]({'plain':!![]});if(!_0x569ff1)throw new Error(_0x7ca4('0x5a'));if(_0x569ff1[_0x7ca4('0x5b')]==='user'){var _0x55c142=_0x2c3560[_0x7ca4('0x59')]({'plain':!![]});return db[_0x7ca4('0x5c')]['find']({'where':{'name':'Contexts','userProfileId':_0x569ff1[_0x7ca4('0x5d')]},'raw':!![]})[_0x7ca4('0x1a')](function(_0x56dac4){if(_0x56dac4&&_0x56dac4[_0x7ca4('0x5e')]===0x0){return db['UserProfileResource'][_0x7ca4('0x4e')]({'name':_0x55c142[_0x7ca4('0x33')],'resourceId':_0x55c142['id'],'type':_0x56dac4[_0x7ca4('0x33')],'sectionId':_0x56dac4['id']},{})[_0x7ca4('0x1a')](function(){return _0x2c3560;});}else{return _0x2c3560;}})['catch'](function(_0x2ad813){logger[_0x7ca4('0x1f')](_0x7ca4('0x5f'),_0x2ad813);throw _0x2ad813;});}return _0x2c3560;})[_0x7ca4('0x1a')](respondWithResult(_0x39c9aa,0xc9))['catch'](handleError(_0x39c9aa,null));};exports[_0x7ca4('0x60')]=function(_0x358111,_0x525e5c,_0x13e63a){var _0x31ca97;return db[_0x7ca4('0x36')][_0x7ca4('0x4d')]({'where':{'id':_0x358111['params']['id']}})['then'](handleEntityNotFound(_0x525e5c,null))[_0x7ca4('0x1a')](saveUpdates(_0x358111[_0x7ca4('0x4f')],null))[_0x7ca4('0x1a')](function(_0x249015){if(_0x249015){_0x31ca97=_0x249015;return db[_0x7ca4('0x36')][_0x7ca4('0x49')]({'raw':!![]});}})['then'](function(_0x524fed){var _0xe495ac=fs[_0x7ca4('0x50')](path[_0x7ca4('0x51')](config[_0x7ca4('0x61')],_0x7ca4('0x52')),_0x7ca4('0x53'));var _0x4df46f=ejs['render'](_0xe495ac,{'contexts':_0x524fed||[]});fs[_0x7ca4('0x62')](_0x7ca4('0x55'),_0x4df46f);})['then'](function(){return respondWithRpcPromise('Reload',_0x7ca4('0x60'),{'module':_0x7ca4('0x57')});})['then'](function(){return _0x31ca97;})[_0x7ca4('0x1a')](respondWithResult(_0x525e5c,null))['catch'](handleError(_0x525e5c,null));};exports[_0x7ca4('0x2f')]=function(_0x4a4046,_0x59ee1b,_0xb843a9){var _0x4dbc05;return db['VoiceContext'][_0x7ca4('0x4d')]({'where':{'id':_0x4a4046[_0x7ca4('0x63')]['id']}})[_0x7ca4('0x1a')](handleEntityNotFound(_0x59ee1b,null))[_0x7ca4('0x1a')](removeEntity(_0x59ee1b,null))['then'](function(){return db[_0x7ca4('0x36')][_0x7ca4('0x49')]({'raw':!![]});})['then'](function(_0x523b5c){var _0x359f0c=fs[_0x7ca4('0x50')](path[_0x7ca4('0x51')](config[_0x7ca4('0x61')],_0x7ca4('0x52')),_0x7ca4('0x53'));var _0x582e1f=ejs[_0x7ca4('0x54')](_0x359f0c,{'contexts':_0x523b5c});fs['writeFileSync'](_0x7ca4('0x55'),_0x582e1f);return respondWithRpcPromise(_0x7ca4('0x56'),_0x7ca4('0x2f'),{'module':'chan_sip.so'});})[_0x7ca4('0x24')](handleError(_0x59ee1b,null));}; \ No newline at end of file +var _0xb734=['order','sort','where','pick','filter','merge','options','VoiceContext','include','findAll','rows','params','includeAll','create','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','body','readFileSync','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','count','limit','json','apply','reject','update','get','Contexts','UserProfileResource','destroy','stack','name','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x47e03c,_0x2ba0df){var _0x3fbcb4=function(_0x2e2730){while(--_0x2e2730){_0x47e03c['push'](_0x47e03c['shift']());}};_0x3fbcb4(++_0x2ba0df);}(_0xb734,0xe3));var _0x4b73=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb734[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x4b73('0x0'));var rimraf=require(_0x4b73('0x1'));var zipdir=require(_0x4b73('0x2'));var jsonpatch=require(_0x4b73('0x3'));var rp=require(_0x4b73('0x4'));var moment=require(_0x4b73('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4b73('0x6'));var sox=require(_0x4b73('0x7'));var csv=require(_0x4b73('0x8'));var ejs=require(_0x4b73('0x9'));var fs=require('fs');var fs_extra=require(_0x4b73('0xa'));var _=require(_0x4b73('0xb'));var squel=require(_0x4b73('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b73('0xd'));var deskjs=require(_0x4b73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4b73('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b73('0x10'));var authService=require(_0x4b73('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4b73('0x12'));var hardwareService=require(_0x4b73('0x13'));var logger=require(_0x4b73('0x14'))(_0x4b73('0x15'));var utils=require(_0x4b73('0x16'));var config=require(_0x4b73('0x17'));var licenseUtil=require(_0x4b73('0x18'));var db=require(_0x4b73('0x19'))['db'];var jayson=require(_0x4b73('0x1a'));var client=jayson[_0x4b73('0x1b')][_0x4b73('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb200c2,_0x4ea967,_0x111c6e,_0x39084d){return new BPromise(function(_0x555a2b,_0x3f3231){var _0x1b0851=_0x39084d||client;return _0x1b0851['request'](_0xb200c2,_0x111c6e)[_0x4b73('0x1d')](function(_0x5a728a){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4ea967,_0x4b73('0x1e'));logger[_0x4b73('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4ea967,'request\x20sent',JSON[_0x4b73('0x20')](_0x5a728a));if(_0x5a728a[_0x4b73('0x21')]){if(_0x5a728a['error'][_0x4b73('0x22')]===0x1f4){logger[_0x4b73('0x21')](_0x4b73('0x23'),_0x4ea967,_0x5a728a[_0x4b73('0x21')][_0x4b73('0x24')]);return _0x3f3231(_0x5a728a['error']['message']);}logger[_0x4b73('0x21')](_0x4b73('0x23'),_0x4ea967,_0x5a728a[_0x4b73('0x21')][_0x4b73('0x24')]);return _0x555a2b(_0x5a728a['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x4ea967,_0x4b73('0x1e'));_0x555a2b(_0x5a728a['result'][_0x4b73('0x24')]);}})[_0x4b73('0x25')](function(_0x5705f7){logger['error'](_0x4b73('0x23'),_0x4ea967,_0x5705f7);_0x3f3231(_0x5705f7);});});}function respondWithStatusCode(_0x5844db,_0x5e44d5){_0x5e44d5=_0x5e44d5||0xcc;return function(_0x5f08d5){if(_0x5f08d5){return _0x5844db[_0x4b73('0x26')](_0x5e44d5);}return _0x5844db['status'](_0x5e44d5)[_0x4b73('0x27')]();};}function respondWithResult(_0x166d92,_0x39eb4e){_0x39eb4e=_0x39eb4e||0xc8;return function(_0x358e4f){if(_0x358e4f){return _0x166d92[_0x4b73('0x28')](_0x39eb4e)['json'](_0x358e4f);}};}function respondWithFilteredResult(_0x789615,_0x44c6bb){return function(_0xe4546c){if(_0xe4546c){var _0x5832cd=typeof _0x44c6bb[_0x4b73('0x29')]==='undefined'&&typeof _0x44c6bb['limit']===_0x4b73('0x2a');var _0x45ec66=_0xe4546c[_0x4b73('0x2b')];var _0x5bd53d=_0x5832cd?0x0:_0x44c6bb['offset'];var _0x2fcc76=_0x5832cd?_0xe4546c[_0x4b73('0x2b')]:_0x44c6bb['offset']+_0x44c6bb[_0x4b73('0x2c')];var _0xa34789;if(_0x2fcc76>=_0x45ec66){_0x2fcc76=_0x45ec66;_0xa34789=0xc8;}else{_0xa34789=0xce;}_0x789615[_0x4b73('0x28')](_0xa34789);return _0x789615['set']('Content-Range',_0x5bd53d+'-'+_0x2fcc76+'/'+_0x45ec66)[_0x4b73('0x2d')](_0xe4546c);}return null;};}function patchUpdates(_0x447ec7){return function(_0x381eb5){try{jsonpatch[_0x4b73('0x2e')](_0x381eb5,_0x447ec7,!![]);}catch(_0x5a1d8d){return BPromise[_0x4b73('0x2f')](_0x5a1d8d);}return _0x381eb5['save']();};}function saveUpdates(_0x2bdfc5,_0x49fd56){return function(_0x23bd35){if(_0x23bd35){return _0x23bd35[_0x4b73('0x30')](_0x2bdfc5)[_0x4b73('0x1d')](function(_0x5ee1c8){return _0x5ee1c8;});}return null;};}function removeEntity(_0xfc9d4,_0x5642de){return function(_0x537bba){if(_0x537bba){return _0x537bba['destroy']()[_0x4b73('0x1d')](function(){var _0x1ec21a=_0x537bba[_0x4b73('0x31')]({'plain':!![]});var _0x3bf7dd=_0x4b73('0x32');return db[_0x4b73('0x33')][_0x4b73('0x34')]({'where':{'type':_0x3bf7dd,'resourceId':_0x1ec21a['id']}})[_0x4b73('0x1d')](function(){return _0x537bba;});})['then'](function(){_0xfc9d4[_0x4b73('0x28')](0xcc)[_0x4b73('0x27')]();});}};}function handleEntityNotFound(_0x343a9a,_0x52ffc7){return function(_0x20ea6e){if(!_0x20ea6e){_0x343a9a[_0x4b73('0x26')](0x194);}return _0x20ea6e;};}function handleError(_0x3b44a0,_0x34e3e3){_0x34e3e3=_0x34e3e3||0x1f4;return function(_0xd07277){logger[_0x4b73('0x21')](_0xd07277[_0x4b73('0x35')]);if(_0xd07277[_0x4b73('0x36')]){delete _0xd07277['name'];}_0x3b44a0['status'](_0x34e3e3)['send'](_0xd07277);};}exports['index']=function(_0x707e4f,_0x5e543f){var _0x570461={},_0xace993={},_0x136397={'count':0x0,'rows':[]};var _0x42ac6b=_[_0x4b73('0x37')](db['VoiceContext']['rawAttributes'],function(_0x193b73){return{'name':_0x193b73[_0x4b73('0x38')],'type':_0x193b73[_0x4b73('0x39')][_0x4b73('0x3a')]};});_0xace993[_0x4b73('0x3b')]=_[_0x4b73('0x37')](_0x42ac6b,_0x4b73('0x36'));_0xace993[_0x4b73('0x3c')]=_[_0x4b73('0x3d')](_0x707e4f['query']);_0xace993[_0x4b73('0x3e')]=_['intersection'](_0xace993[_0x4b73('0x3b')],_0xace993[_0x4b73('0x3c')]);_0x570461[_0x4b73('0x3f')]=_['intersection'](_0xace993[_0x4b73('0x3b')],qs[_0x4b73('0x40')](_0x707e4f[_0x4b73('0x3c')][_0x4b73('0x40')]));_0x570461['attributes']=_0x570461[_0x4b73('0x3f')][_0x4b73('0x41')]?_0x570461[_0x4b73('0x3f')]:_0xace993['model'];if(!_0x707e4f[_0x4b73('0x3c')][_0x4b73('0x42')]('nolimit')){_0x570461[_0x4b73('0x2c')]=qs['limit'](_0x707e4f[_0x4b73('0x3c')][_0x4b73('0x2c')]);_0x570461[_0x4b73('0x29')]=qs[_0x4b73('0x29')](_0x707e4f['query'][_0x4b73('0x29')]);}_0x570461[_0x4b73('0x43')]=qs[_0x4b73('0x44')](_0x707e4f['query']['sort']);_0x570461[_0x4b73('0x45')]=qs[_0x4b73('0x3e')](_[_0x4b73('0x46')](_0x707e4f[_0x4b73('0x3c')],_0xace993[_0x4b73('0x3e')]),_0x42ac6b);if(_0x707e4f[_0x4b73('0x3c')][_0x4b73('0x47')]){_0x570461['where']=_['merge'](_0x570461[_0x4b73('0x45')],{'$or':_[_0x4b73('0x37')](_0x42ac6b,function(_0x451d1f){if(_0x451d1f[_0x4b73('0x39')]!=='VIRTUAL'){var _0x1c6b1d={};_0x1c6b1d[_0x451d1f['name']]={'$like':'%'+_0x707e4f[_0x4b73('0x3c')][_0x4b73('0x47')]+'%'};return _0x1c6b1d;}})});}_0x570461=_[_0x4b73('0x48')]({},_0x570461,_0x707e4f[_0x4b73('0x49')]);var _0x3a9860={'where':_0x570461[_0x4b73('0x45')]};return db[_0x4b73('0x4a')]['count'](_0x3a9860)[_0x4b73('0x1d')](function(_0x37b24c){_0x136397[_0x4b73('0x2b')]=_0x37b24c;if(_0x707e4f[_0x4b73('0x3c')]['includeAll']){_0x570461[_0x4b73('0x4b')]=[{'all':!![]}];}return db[_0x4b73('0x4a')][_0x4b73('0x4c')](_0x570461);})[_0x4b73('0x1d')](function(_0xbfe348){_0x136397[_0x4b73('0x4d')]=_0xbfe348;return _0x136397;})[_0x4b73('0x1d')](respondWithFilteredResult(_0x5e543f,_0x570461))[_0x4b73('0x25')](handleError(_0x5e543f,null));};exports['show']=function(_0x31a700,_0x150bf9){var _0x258be9={'raw':![],'where':{'id':_0x31a700[_0x4b73('0x4e')]['id']}},_0x4e4702={};_0x4e4702[_0x4b73('0x3b')]=_['keys'](db[_0x4b73('0x4a')]['rawAttributes']);_0x4e4702['query']=_['keys'](_0x31a700[_0x4b73('0x3c')]);_0x4e4702['filters']=_['intersection'](_0x4e4702['model'],_0x4e4702[_0x4b73('0x3c')]);_0x258be9[_0x4b73('0x3f')]=_['intersection'](_0x4e4702['model'],qs[_0x4b73('0x40')](_0x31a700[_0x4b73('0x3c')]['fields']));_0x258be9[_0x4b73('0x3f')]=_0x258be9[_0x4b73('0x3f')][_0x4b73('0x41')]?_0x258be9['attributes']:_0x4e4702[_0x4b73('0x3b')];if(_0x31a700[_0x4b73('0x3c')][_0x4b73('0x4f')]){_0x258be9[_0x4b73('0x4b')]=[{'all':!![]}];}_0x258be9=_[_0x4b73('0x48')]({},_0x258be9,_0x31a700[_0x4b73('0x49')]);return db['VoiceContext']['find'](_0x258be9)[_0x4b73('0x1d')](handleEntityNotFound(_0x150bf9,null))['then'](respondWithResult(_0x150bf9,null))[_0x4b73('0x25')](handleError(_0x150bf9,null));};exports[_0x4b73('0x50')]=function(_0xbe111d,_0x540e54,_0x47c94a){var _0x5e4636;return db[_0x4b73('0x4a')][_0x4b73('0x50')](_0xbe111d['body'],{'raw':!![]})[_0x4b73('0x1d')](function(_0x7a8ea){_0x5e4636=_0x7a8ea;return db[_0x4b73('0x4a')]['findAll']({'raw':!![]});})[_0x4b73('0x1d')](function(_0xced04){var _0x46f01b=fs['readFileSync'](path['join'](config[_0x4b73('0x51')],_0x4b73('0x52')),_0x4b73('0x53'));var _0x353615=ejs[_0x4b73('0x54')](_0x46f01b,{'contexts':_0xced04||[]});fs[_0x4b73('0x55')](_0x4b73('0x56'),_0x353615);})['then'](function(){return respondWithRpcPromise(_0x4b73('0x57'),_0x4b73('0x50'),{'module':_0x4b73('0x58')});})[_0x4b73('0x1d')](function(){var _0x1cd212=_0xbe111d[_0x4b73('0x59')][_0x4b73('0x31')]({'plain':!![]});if(!_0x1cd212)throw new Error(_0x4b73('0x5a'));if(_0x1cd212['role']===_0x4b73('0x59')){var _0x2117c6=_0x5e4636['get']({'plain':!![]});return db[_0x4b73('0x5b')]['find']({'where':{'name':_0x4b73('0x32'),'userProfileId':_0x1cd212['userProfileId']},'raw':!![]})['then'](function(_0x54867f){if(_0x54867f&&_0x54867f[_0x4b73('0x5c')]===0x0){return db[_0x4b73('0x33')][_0x4b73('0x50')]({'name':_0x2117c6[_0x4b73('0x36')],'resourceId':_0x2117c6['id'],'type':_0x54867f['name'],'sectionId':_0x54867f['id']},{})[_0x4b73('0x1d')](function(){return _0x5e4636;});}else{return _0x5e4636;}})[_0x4b73('0x25')](function(_0x342251){logger[_0x4b73('0x21')](_0x4b73('0x5d'),_0x342251);throw _0x342251;});}return _0x5e4636;})[_0x4b73('0x1d')](respondWithResult(_0x540e54,0xc9))[_0x4b73('0x25')](handleError(_0x540e54,null));};exports[_0x4b73('0x30')]=function(_0x358d13,_0x4b611f,_0x148123){var _0x22c102;return db[_0x4b73('0x4a')][_0x4b73('0x5e')]({'where':{'id':_0x358d13['params']['id']}})[_0x4b73('0x1d')](handleEntityNotFound(_0x4b611f,null))[_0x4b73('0x1d')](saveUpdates(_0x358d13[_0x4b73('0x5f')],null))[_0x4b73('0x1d')](function(_0x3be98e){if(_0x3be98e){_0x22c102=_0x3be98e;return db['VoiceContext'][_0x4b73('0x4c')]({'raw':!![]});}})['then'](function(_0x5e9888){var _0x52c641=fs[_0x4b73('0x60')](path[_0x4b73('0x61')](config[_0x4b73('0x51')],_0x4b73('0x52')),_0x4b73('0x53'));var _0x4d272c=ejs['render'](_0x52c641,{'contexts':_0x5e9888||[]});fs['writeFileSync'](_0x4b73('0x56'),_0x4d272c);})[_0x4b73('0x1d')](function(){return respondWithRpcPromise(_0x4b73('0x57'),_0x4b73('0x30'),{'module':_0x4b73('0x58')});})['then'](function(){return _0x22c102;})[_0x4b73('0x1d')](respondWithResult(_0x4b611f,null))['catch'](handleError(_0x4b611f,null));};exports[_0x4b73('0x34')]=function(_0x2a0033,_0x25c8f3,_0x286547){var _0x35419e;return db[_0x4b73('0x4a')][_0x4b73('0x5e')]({'where':{'id':_0x2a0033[_0x4b73('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25c8f3,null))['then'](removeEntity(_0x25c8f3,null))[_0x4b73('0x1d')](function(){return db[_0x4b73('0x4a')][_0x4b73('0x4c')]({'raw':!![]});})[_0x4b73('0x1d')](function(_0x467414){var _0x2c9df6=fs['readFileSync'](path[_0x4b73('0x61')](config[_0x4b73('0x51')],_0x4b73('0x52')),_0x4b73('0x53'));var _0x54a411=ejs[_0x4b73('0x54')](_0x2c9df6,{'contexts':_0x467414});fs['writeFileSync'](_0x4b73('0x56'),_0x54a411);return respondWithRpcPromise('Reload',_0x4b73('0x34'),{'module':_0x4b73('0x58')});})[_0x4b73('0x25')](handleError(_0x25c8f3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7de02d1..8c27f47 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 _0x8a34=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','path'];(function(_0x389ee4,_0x4f3f4a){var _0x513fd4=function(_0x160022){while(--_0x160022){_0x389ee4['push'](_0x389ee4['shift']());}};_0x513fd4(++_0x4f3f4a);}(_0x8a34,0x127));var _0x48a3=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x8a34[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0x48a3('0x0'));var util=require(_0x48a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x48a3('0x2'));var BPromise=require(_0x48a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48a3('0x4'));var rimraf=require(_0x48a3('0x5'));var config=require(_0x48a3('0x6'));var attributes=require(_0x48a3('0x7'));module[_0x48a3('0x8')]=function(_0x237884,_0x5e51a7){return _0x237884[_0x48a3('0x9')](_0x48a3('0xa'),attributes,{'tableName':_0x48a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb7a=['path','rimraf','../../config/environment','exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x287396,_0x2af577){var _0x42193a=function(_0x589d4a){while(--_0x589d4a){_0x287396['push'](_0x287396['shift']());}};_0x42193a(++_0x2af577);}(_0xdb7a,0xae));var _0xadb7=function(_0x3b84d5,_0xd86e10){_0x3b84d5=_0x3b84d5-0x0;var _0x50a084=_0xdb7a[_0x3b84d5];return _0x50a084;};'use strict';var _=require(_0xadb7('0x0'));var util=require(_0xadb7('0x1'));var logger=require(_0xadb7('0x2'))(_0xadb7('0x3'));var moment=require('moment');var BPromise=require(_0xadb7('0x4'));var rp=require(_0xadb7('0x5'));var fs=require('fs');var path=require(_0xadb7('0x6'));var rimraf=require(_0xadb7('0x7'));var config=require(_0xadb7('0x8'));var attributes=require('./voiceContext.attributes');module[_0xadb7('0x9')]=function(_0x57fc27,_0x481258){return _0x57fc27[_0xadb7('0xa')](_0xadb7('0xb'),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 62b74fa..ed91318 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 _0x3eae=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eae,0x126));var _0xe3ea=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x3eae[_0x3d38ae];return _0x3757ee;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3ea('0x4'));var db=require(_0xe3ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ea('0x6'))(_0xe3ea('0x7'));var config=require(_0xe3ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3ea('0x9')][_0xe3ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216558,_0x14394e,_0x106123){return new BPromise(function(_0x2cc86f,_0x58ee6b){return client[_0xe3ea('0xb')](_0x216558,_0x106123)[_0xe3ea('0xc')](function(_0x58f4c2){logger[_0xe3ea('0xd')](_0xe3ea('0xe'),_0x14394e,_0xe3ea('0xf'));logger[_0xe3ea('0x10')](_0xe3ea('0x11'),_0x14394e,'request\x20sent',JSON[_0xe3ea('0x12')](_0x58f4c2));if(_0x58f4c2[_0xe3ea('0x13')]){if(_0x58f4c2[_0xe3ea('0x13')]['code']===0x1f4){logger[_0xe3ea('0x13')](_0xe3ea('0xe'),_0x14394e,_0x58f4c2[_0xe3ea('0x13')][_0xe3ea('0x14')]);return _0x58ee6b(_0x58f4c2[_0xe3ea('0x13')][_0xe3ea('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x14394e,_0x58f4c2[_0xe3ea('0x13')][_0xe3ea('0x14')]);return _0x2cc86f(_0x58f4c2[_0xe3ea('0x13')][_0xe3ea('0x14')]);}else{logger[_0xe3ea('0xd')]('VoiceContext,\x20%s,\x20%s',_0x14394e,'request\x20sent');_0x2cc86f(_0x58f4c2[_0xe3ea('0x15')][_0xe3ea('0x14')]);}})['catch'](function(_0x1d2f47){logger[_0xe3ea('0x13')]('VoiceContext,\x20%s,\x20%s',_0x14394e,_0x1d2f47);_0x58ee6b(_0x1d2f47);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x263f,0x182));var _0xf263=function(_0x44944f,_0x4fd215){_0x44944f=_0x44944f-0x0;var _0x55dc83=_0x263f[_0x44944f];return _0x55dc83;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a65900c..80d0e29 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 _0x3ef0=['index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2a5421,_0x1b2d0e){var _0x442ef4=function(_0x27118c){while(--_0x27118c){_0x2a5421['push'](_0x2a5421['shift']());}};_0x442ef4(++_0x1b2d0e);}(_0x3ef0,0x19a));var _0x03ef=function(_0x15c57f,_0x4d031f){_0x15c57f=_0x15c57f-0x0;var _0x2a4f13=_0x3ef0[_0x15c57f];return _0x2a4f13;};'use strict';var multer=require(_0x03ef('0x0'));var util=require('util');var path=require(_0x03ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x03ef('0x2'));var router=express['Router']();var fs_extra=require(_0x03ef('0x3'));var auth=require(_0x03ef('0x4'));var interaction=require(_0x03ef('0x5'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x03ef('0x6')]('/',auth[_0x03ef('0x7')](),controller[_0x03ef('0x8')]);router['get'](_0x03ef('0x9'),auth[_0x03ef('0x7')](),controller[_0x03ef('0xa')]);router[_0x03ef('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x03ef('0xb')]);router[_0x03ef('0xc')]('/',auth[_0x03ef('0x7')](),controller['create']);router[_0x03ef('0xd')](_0x03ef('0xe'),auth['isAuthenticated'](),controller[_0x03ef('0xf')]);router[_0x03ef('0x10')](_0x03ef('0xe'),auth['isAuthenticated'](),controller[_0x03ef('0x11')]);module[_0x03ef('0x12')]=router; \ No newline at end of file +var _0x0fd5=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0x0fd5,0x1e6));var _0x50fd=function(_0x2c6729,_0x54ed3e){_0x2c6729=_0x2c6729-0x0;var _0xa6199d=_0x0fd5[_0x2c6729];return _0xa6199d;};'use strict';var multer=require(_0x50fd('0x0'));var util=require(_0x50fd('0x1'));var path=require(_0x50fd('0x2'));var timeout=require(_0x50fd('0x3'));var express=require(_0x50fd('0x4'));var router=express[_0x50fd('0x5')]();var fs_extra=require(_0x50fd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x50fd('0x7'));var config=require(_0x50fd('0x8'));var controller=require(_0x50fd('0x9'));router[_0x50fd('0xa')]('/',auth[_0x50fd('0xb')](),controller[_0x50fd('0xc')]);router[_0x50fd('0xa')]('/describe',auth[_0x50fd('0xb')](),controller[_0x50fd('0xd')]);router[_0x50fd('0xa')](_0x50fd('0xe'),auth[_0x50fd('0xb')](),controller[_0x50fd('0xf')]);router[_0x50fd('0x10')]('/',auth[_0x50fd('0xb')](),controller['create']);router['put'](_0x50fd('0xe'),auth[_0x50fd('0xb')](),controller[_0x50fd('0x11')]);router[_0x50fd('0x12')](_0x50fd('0xe'),auth[_0x50fd('0xb')](),controller[_0x50fd('0x13')]);module[_0x50fd('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 1116612..8ce2d5b 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0xaa23d9,_0x40f2a8){var _0x47f1c5=function(_0x4e6852){while(--_0x4e6852){_0xaa23d9['push'](_0xaa23d9['shift']());}};_0x47f1c5(++_0x40f2a8);}(_0x98a8,0x12c));var _0x898a=function(_0x2e328b,_0xaee134){_0x2e328b=_0x2e328b-0x0;var _0x362d69=_0x98a8[_0x2e328b];return _0x362d69;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x52d543,_0x4982e1){var _0x572ca0=function(_0x4af633){while(--_0x4af633){_0x52d543['push'](_0x52d543['shift']());}};_0x572ca0(++_0x4982e1);}(_0x81bd,0x7c));var _0xd81b=function(_0x3a1b35,_0x43f746){_0x3a1b35=_0x3a1b35-0x0;var _0x27fd53=_0x81bd[_0x3a1b35];return _0x27fd53;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 80d4aac..ff35785 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 _0x24d7=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','name','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0x24d7,0x7e));var _0x724d=function(_0x123cea,_0x5250a5){_0x123cea=_0x123cea-0x0;var _0x3baa90=_0x24d7[_0x123cea];return _0x3baa90;};'use strict';var emlformat=require(_0x724d('0x0'));var rimraf=require(_0x724d('0x1'));var zipdir=require(_0x724d('0x2'));var jsonpatch=require(_0x724d('0x3'));var rp=require(_0x724d('0x4'));var moment=require(_0x724d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x724d('0x6'));var util=require(_0x724d('0x7'));var path=require(_0x724d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x724d('0x9'));var _=require(_0x724d('0xa'));var squel=require(_0x724d('0xb'));var crypto=require(_0x724d('0xc'));var jsforce=require(_0x724d('0xd'));var deskjs=require(_0x724d('0xe'));var toCsv=require(_0x724d('0xf'));var querystring=require(_0x724d('0x10'));var Papa=require(_0x724d('0x11'));var Redis=require('ioredis');var authService=require(_0x724d('0x12'));var qs=require(_0x724d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x724d('0x14'));var config=require(_0x724d('0x15'));var licenseUtil=require(_0x724d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e7d1,_0x15c372){_0x15c372=_0x15c372||0xcc;return function(_0x928c43){if(_0x928c43){return _0x16e7d1[_0x724d('0x17')](_0x15c372);}return _0x16e7d1[_0x724d('0x18')](_0x15c372)[_0x724d('0x19')]();};}function respondWithResult(_0x1cb25d,_0x39c7ef){_0x39c7ef=_0x39c7ef||0xc8;return function(_0x514634){if(_0x514634){return _0x1cb25d[_0x724d('0x18')](_0x39c7ef)[_0x724d('0x1a')](_0x514634);}};}function respondWithFilteredResult(_0x3b8d09,_0x53ac6d){return function(_0x55c1aa){if(_0x55c1aa){var _0x1fc3f9=typeof _0x53ac6d[_0x724d('0x1b')]===_0x724d('0x1c')&&typeof _0x53ac6d['limit']===_0x724d('0x1c');var _0x55b8bd=_0x55c1aa[_0x724d('0x1d')];var _0x371f0d=_0x1fc3f9?0x0:_0x53ac6d[_0x724d('0x1b')];var _0x4a0b87=_0x1fc3f9?_0x55c1aa['count']:_0x53ac6d[_0x724d('0x1b')]+_0x53ac6d[_0x724d('0x1e')];var _0x54fb33;if(_0x4a0b87>=_0x55b8bd){_0x4a0b87=_0x55b8bd;_0x54fb33=0xc8;}else{_0x54fb33=0xce;}_0x3b8d09[_0x724d('0x18')](_0x54fb33);return _0x3b8d09['set'](_0x724d('0x1f'),_0x371f0d+'-'+_0x4a0b87+'/'+_0x55b8bd)[_0x724d('0x1a')](_0x55c1aa);}return null;};}function patchUpdates(_0x5176a3){return function(_0x2d12d6){try{jsonpatch[_0x724d('0x20')](_0x2d12d6,_0x5176a3,!![]);}catch(_0x2a3f5d){return BPromise[_0x724d('0x21')](_0x2a3f5d);}return _0x2d12d6[_0x724d('0x22')]();};}function saveUpdates(_0x4f4583,_0x5987f6){return function(_0x47485c){if(_0x47485c){return _0x47485c[_0x724d('0x23')](_0x4f4583)[_0x724d('0x24')](function(_0x2e2172){return _0x2e2172;});}return null;};}function removeEntity(_0x57002f,_0x54896a){return function(_0x474ace){if(_0x474ace){return _0x474ace[_0x724d('0x25')]()[_0x724d('0x24')](function(){_0x57002f[_0x724d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358cad,_0x1cddc8){return function(_0x4e1e63){if(!_0x4e1e63){_0x358cad[_0x724d('0x17')](0x194);}return _0x4e1e63;};}function handleError(_0xc277a5,_0x3feed3){_0x3feed3=_0x3feed3||0x1f4;return function(_0x133acd){logger[_0x724d('0x26')](_0x133acd[_0x724d('0x27')]);if(_0x133acd['name']){delete _0x133acd['name'];}_0xc277a5['status'](_0x3feed3)[_0x724d('0x28')](_0x133acd);};}exports[_0x724d('0x29')]=function(_0x11de2c,_0x4be45e){var _0x5fcb5a={},_0x4a7696={},_0x4487b3={'count':0x0,'rows':[]};var _0x361606=_[_0x724d('0x2a')](db[_0x724d('0x2b')]['rawAttributes'],function(_0x20777b){return{'name':_0x20777b[_0x724d('0x2c')],'type':_0x20777b[_0x724d('0x2d')]['key']};});_0x4a7696['model']=_['map'](_0x361606,'name');_0x4a7696[_0x724d('0x2e')]=_[_0x724d('0x2f')](_0x11de2c['query']);_0x4a7696[_0x724d('0x30')]=_[_0x724d('0x31')](_0x4a7696['model'],_0x4a7696[_0x724d('0x2e')]);_0x5fcb5a[_0x724d('0x32')]=_[_0x724d('0x31')](_0x4a7696[_0x724d('0x33')],qs[_0x724d('0x34')](_0x11de2c[_0x724d('0x2e')]['fields']));_0x5fcb5a[_0x724d('0x32')]=_0x5fcb5a[_0x724d('0x32')][_0x724d('0x35')]?_0x5fcb5a[_0x724d('0x32')]:_0x4a7696[_0x724d('0x33')];if(!_0x11de2c[_0x724d('0x2e')][_0x724d('0x36')]('nolimit')){_0x5fcb5a[_0x724d('0x1e')]=qs[_0x724d('0x1e')](_0x11de2c[_0x724d('0x2e')][_0x724d('0x1e')]);_0x5fcb5a['offset']=qs[_0x724d('0x1b')](_0x11de2c[_0x724d('0x2e')][_0x724d('0x1b')]);}_0x5fcb5a[_0x724d('0x37')]=qs[_0x724d('0x38')](_0x11de2c['query'][_0x724d('0x38')]);_0x5fcb5a['where']=qs[_0x724d('0x30')](_['pick'](_0x11de2c['query'],_0x4a7696[_0x724d('0x30')]),_0x361606);if(_0x11de2c[_0x724d('0x2e')][_0x724d('0x39')]){_0x5fcb5a[_0x724d('0x3a')]=_['merge'](_0x5fcb5a[_0x724d('0x3a')],{'$or':_[_0x724d('0x2a')](_0x361606,function(_0x333113){if(_0x333113[_0x724d('0x2d')]!==_0x724d('0x3b')){var _0x5f1af3={};_0x5f1af3[_0x333113[_0x724d('0x3c')]]={'$like':'%'+_0x11de2c[_0x724d('0x2e')][_0x724d('0x39')]+'%'};return _0x5f1af3;}})});}_0x5fcb5a=_[_0x724d('0x3d')]({},_0x5fcb5a,_0x11de2c['options']);var _0x12eb2c={'where':_0x5fcb5a['where']};return db[_0x724d('0x2b')][_0x724d('0x1d')](_0x12eb2c)['then'](function(_0x49bc82){_0x4487b3['count']=_0x49bc82;if(_0x11de2c[_0x724d('0x2e')][_0x724d('0x3e')]){_0x5fcb5a['include']=[{'all':!![]}];}return db[_0x724d('0x2b')][_0x724d('0x3f')](_0x5fcb5a);})[_0x724d('0x24')](function(_0x6d61fb){_0x4487b3[_0x724d('0x40')]=_0x6d61fb;return _0x4487b3;})['then'](respondWithFilteredResult(_0x4be45e,_0x5fcb5a))[_0x724d('0x41')](handleError(_0x4be45e,null));};exports[_0x724d('0x42')]=function(_0x50b57b,_0x28690f){var _0x4f54af={'raw':!![],'where':{'id':_0x50b57b[_0x724d('0x43')]['id']}},_0x28b7f1={};_0x28b7f1[_0x724d('0x33')]=_[_0x724d('0x2f')](db[_0x724d('0x2b')][_0x724d('0x44')]);_0x28b7f1[_0x724d('0x2e')]=_['keys'](_0x50b57b['query']);_0x28b7f1[_0x724d('0x30')]=_[_0x724d('0x31')](_0x28b7f1[_0x724d('0x33')],_0x28b7f1[_0x724d('0x2e')]);_0x4f54af[_0x724d('0x32')]=_['intersection'](_0x28b7f1[_0x724d('0x33')],qs[_0x724d('0x34')](_0x50b57b[_0x724d('0x2e')][_0x724d('0x34')]));_0x4f54af[_0x724d('0x32')]=_0x4f54af[_0x724d('0x32')]['length']?_0x4f54af[_0x724d('0x32')]:_0x28b7f1['model'];if(_0x50b57b[_0x724d('0x2e')][_0x724d('0x3e')]){_0x4f54af[_0x724d('0x45')]=[{'all':!![]}];}_0x4f54af=_[_0x724d('0x3d')]({},_0x4f54af,_0x50b57b[_0x724d('0x46')]);return db[_0x724d('0x2b')]['find'](_0x4f54af)[_0x724d('0x24')](handleEntityNotFound(_0x28690f,null))[_0x724d('0x24')](respondWithResult(_0x28690f,null))['catch'](handleError(_0x28690f,null));};exports[_0x724d('0x47')]=function(_0x5dbd7d,_0x134b87){return db[_0x724d('0x2b')][_0x724d('0x47')](_0x5dbd7d[_0x724d('0x48')],{})[_0x724d('0x24')](respondWithResult(_0x134b87,0xc9))[_0x724d('0x41')](handleError(_0x134b87,null));};exports['update']=function(_0x5875eb,_0x21f21c){if(_0x5875eb[_0x724d('0x48')]['id']){delete _0x5875eb[_0x724d('0x48')]['id'];}return db[_0x724d('0x2b')][_0x724d('0x49')]({'where':{'id':_0x5875eb[_0x724d('0x43')]['id']}})['then'](handleEntityNotFound(_0x21f21c,null))['then'](saveUpdates(_0x5875eb['body'],null))[_0x724d('0x24')](respondWithResult(_0x21f21c,null))[_0x724d('0x41')](handleError(_0x21f21c,null));};exports['destroy']=function(_0x1dd111,_0x6c0f2b){return db[_0x724d('0x2b')][_0x724d('0x49')]({'where':{'id':_0x1dd111[_0x724d('0x43')]['id']}})['then'](handleEntityNotFound(_0x6c0f2b,null))[_0x724d('0x24')](removeEntity(_0x6c0f2b,null))[_0x724d('0x41')](handleError(_0x6c0f2b,null));};exports[_0x724d('0x4a')]=function(_0x2d8b42,_0x2f113d){return db[_0x724d('0x2b')][_0x724d('0x4a')]()[_0x724d('0x24')](respondWithResult(_0x2f113d,null))['catch'](handleError(_0x2f113d,null));}; \ No newline at end of file +var _0x1214=['findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x1214,0x9f));var _0x4121=function(_0x201490,_0x235e70){_0x201490=_0x201490-0x0;var _0x1479df=_0x1214[_0x201490];return _0x1479df;};'use strict';var emlformat=require(_0x4121('0x0'));var rimraf=require(_0x4121('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4121('0x2'));var rp=require(_0x4121('0x3'));var moment=require('moment');var BPromise=require(_0x4121('0x4'));var Mustache=require(_0x4121('0x5'));var util=require(_0x4121('0x6'));var path=require(_0x4121('0x7'));var sox=require('sox');var csv=require(_0x4121('0x8'));var ejs=require(_0x4121('0x9'));var fs=require('fs');var fs_extra=require(_0x4121('0xa'));var _=require(_0x4121('0xb'));var squel=require(_0x4121('0xc'));var crypto=require(_0x4121('0xd'));var jsforce=require(_0x4121('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4121('0x8'));var querystring=require(_0x4121('0xf'));var Papa=require(_0x4121('0x10'));var Redis=require(_0x4121('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4121('0x12'));var as=require(_0x4121('0x13'));var hardwareService=require(_0x4121('0x14'));var logger=require('../../config/logger')(_0x4121('0x15'));var utils=require(_0x4121('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4121('0x17'));var db=require(_0x4121('0x18'))['db'];function respondWithStatusCode(_0x23d295,_0x36806e){_0x36806e=_0x36806e||0xcc;return function(_0x62d113){if(_0x62d113){return _0x23d295[_0x4121('0x19')](_0x36806e);}return _0x23d295[_0x4121('0x1a')](_0x36806e)[_0x4121('0x1b')]();};}function respondWithResult(_0x5a0070,_0x578417){_0x578417=_0x578417||0xc8;return function(_0x5bb651){if(_0x5bb651){return _0x5a0070['status'](_0x578417)[_0x4121('0x1c')](_0x5bb651);}};}function respondWithFilteredResult(_0x2dcf5e,_0x1f2ff8){return function(_0x1440af){if(_0x1440af){var _0x561e91=typeof _0x1f2ff8[_0x4121('0x1d')]===_0x4121('0x1e')&&typeof _0x1f2ff8[_0x4121('0x1f')]===_0x4121('0x1e');var _0x59b80f=_0x1440af[_0x4121('0x20')];var _0x5decb3=_0x561e91?0x0:_0x1f2ff8['offset'];var _0x69702d=_0x561e91?_0x1440af[_0x4121('0x20')]:_0x1f2ff8[_0x4121('0x1d')]+_0x1f2ff8[_0x4121('0x1f')];var _0x528b9b;if(_0x69702d>=_0x59b80f){_0x69702d=_0x59b80f;_0x528b9b=0xc8;}else{_0x528b9b=0xce;}_0x2dcf5e['status'](_0x528b9b);return _0x2dcf5e[_0x4121('0x21')](_0x4121('0x22'),_0x5decb3+'-'+_0x69702d+'/'+_0x59b80f)['json'](_0x1440af);}return null;};}function patchUpdates(_0x138f9d){return function(_0x4846ed){try{jsonpatch['apply'](_0x4846ed,_0x138f9d,!![]);}catch(_0x628057){return BPromise['reject'](_0x628057);}return _0x4846ed[_0x4121('0x23')]();};}function saveUpdates(_0x2586b3,_0x3d9ca3){return function(_0x4b297e){if(_0x4b297e){return _0x4b297e['update'](_0x2586b3)[_0x4121('0x24')](function(_0x5c5016){return _0x5c5016;});}return null;};}function removeEntity(_0x4e8fe8,_0x16e1cb){return function(_0x472761){if(_0x472761){return _0x472761['destroy']()[_0x4121('0x24')](function(){_0x4e8fe8[_0x4121('0x1a')](0xcc)[_0x4121('0x1b')]();});}};}function handleEntityNotFound(_0x5c7395,_0x444351){return function(_0x3e4427){if(!_0x3e4427){_0x5c7395['sendStatus'](0x194);}return _0x3e4427;};}function handleError(_0x54ef79,_0x5e9900){_0x5e9900=_0x5e9900||0x1f4;return function(_0xa92c9c){logger['error'](_0xa92c9c[_0x4121('0x25')]);if(_0xa92c9c[_0x4121('0x26')]){delete _0xa92c9c[_0x4121('0x26')];}_0x54ef79[_0x4121('0x1a')](_0x5e9900)[_0x4121('0x27')](_0xa92c9c);};}exports[_0x4121('0x28')]=function(_0x287920,_0x20101f){var _0x26c2f1={},_0x1c3a4f={},_0x3b340a={'count':0x0,'rows':[]};var _0x4f77e5=_[_0x4121('0x29')](db[_0x4121('0x2a')][_0x4121('0x2b')],function(_0x5b0fa6){return{'name':_0x5b0fa6['fieldName'],'type':_0x5b0fa6['type'][_0x4121('0x2c')]};});_0x1c3a4f[_0x4121('0x2d')]=_[_0x4121('0x29')](_0x4f77e5,_0x4121('0x26'));_0x1c3a4f[_0x4121('0x2e')]=_[_0x4121('0x2f')](_0x287920[_0x4121('0x2e')]);_0x1c3a4f['filters']=_[_0x4121('0x30')](_0x1c3a4f[_0x4121('0x2d')],_0x1c3a4f[_0x4121('0x2e')]);_0x26c2f1[_0x4121('0x31')]=_[_0x4121('0x30')](_0x1c3a4f[_0x4121('0x2d')],qs[_0x4121('0x32')](_0x287920[_0x4121('0x2e')][_0x4121('0x32')]));_0x26c2f1[_0x4121('0x31')]=_0x26c2f1[_0x4121('0x31')][_0x4121('0x33')]?_0x26c2f1['attributes']:_0x1c3a4f[_0x4121('0x2d')];if(!_0x287920[_0x4121('0x2e')][_0x4121('0x34')]('nolimit')){_0x26c2f1[_0x4121('0x1f')]=qs['limit'](_0x287920[_0x4121('0x2e')][_0x4121('0x1f')]);_0x26c2f1[_0x4121('0x1d')]=qs[_0x4121('0x1d')](_0x287920['query']['offset']);}_0x26c2f1['order']=qs[_0x4121('0x35')](_0x287920['query'][_0x4121('0x35')]);_0x26c2f1[_0x4121('0x36')]=qs[_0x4121('0x37')](_[_0x4121('0x38')](_0x287920[_0x4121('0x2e')],_0x1c3a4f[_0x4121('0x37')]),_0x4f77e5);if(_0x287920[_0x4121('0x2e')][_0x4121('0x39')]){_0x26c2f1[_0x4121('0x36')]=_[_0x4121('0x3a')](_0x26c2f1[_0x4121('0x36')],{'$or':_[_0x4121('0x29')](_0x4f77e5,function(_0x26c1d5){if(_0x26c1d5[_0x4121('0x3b')]!==_0x4121('0x3c')){var _0x2c21b8={};_0x2c21b8[_0x26c1d5[_0x4121('0x26')]]={'$like':'%'+_0x287920[_0x4121('0x2e')]['filter']+'%'};return _0x2c21b8;}})});}_0x26c2f1=_[_0x4121('0x3a')]({},_0x26c2f1,_0x287920[_0x4121('0x3d')]);var _0x18a664={'where':_0x26c2f1[_0x4121('0x36')]};return db[_0x4121('0x2a')][_0x4121('0x20')](_0x18a664)[_0x4121('0x24')](function(_0x5aec3b){_0x3b340a[_0x4121('0x20')]=_0x5aec3b;if(_0x287920[_0x4121('0x2e')][_0x4121('0x3e')]){_0x26c2f1['include']=[{'all':!![]}];}return db[_0x4121('0x2a')][_0x4121('0x3f')](_0x26c2f1);})['then'](function(_0x4d496b){_0x3b340a[_0x4121('0x40')]=_0x4d496b;return _0x3b340a;})['then'](respondWithFilteredResult(_0x20101f,_0x26c2f1))[_0x4121('0x41')](handleError(_0x20101f,null));};exports[_0x4121('0x42')]=function(_0xdd98a4,_0x49eaa7){var _0x5a9d16={'raw':!![],'where':{'id':_0xdd98a4[_0x4121('0x43')]['id']}},_0xd58323={};_0xd58323[_0x4121('0x2d')]=_[_0x4121('0x2f')](db['VoiceDialReport']['rawAttributes']);_0xd58323['query']=_[_0x4121('0x2f')](_0xdd98a4[_0x4121('0x2e')]);_0xd58323[_0x4121('0x37')]=_['intersection'](_0xd58323[_0x4121('0x2d')],_0xd58323[_0x4121('0x2e')]);_0x5a9d16[_0x4121('0x31')]=_['intersection'](_0xd58323[_0x4121('0x2d')],qs[_0x4121('0x32')](_0xdd98a4[_0x4121('0x2e')]['fields']));_0x5a9d16[_0x4121('0x31')]=_0x5a9d16[_0x4121('0x31')][_0x4121('0x33')]?_0x5a9d16[_0x4121('0x31')]:_0xd58323[_0x4121('0x2d')];if(_0xdd98a4[_0x4121('0x2e')]['includeAll']){_0x5a9d16['include']=[{'all':!![]}];}_0x5a9d16=_[_0x4121('0x3a')]({},_0x5a9d16,_0xdd98a4[_0x4121('0x3d')]);return db['VoiceDialReport'][_0x4121('0x44')](_0x5a9d16)[_0x4121('0x24')](handleEntityNotFound(_0x49eaa7,null))[_0x4121('0x24')](respondWithResult(_0x49eaa7,null))[_0x4121('0x41')](handleError(_0x49eaa7,null));};exports['create']=function(_0x178dd2,_0x2294f5){return db[_0x4121('0x2a')][_0x4121('0x45')](_0x178dd2[_0x4121('0x46')],{})['then'](respondWithResult(_0x2294f5,0xc9))[_0x4121('0x41')](handleError(_0x2294f5,null));};exports[_0x4121('0x47')]=function(_0x278bb7,_0x101cd3){if(_0x278bb7['body']['id']){delete _0x278bb7[_0x4121('0x46')]['id'];}return db[_0x4121('0x2a')]['find']({'where':{'id':_0x278bb7[_0x4121('0x43')]['id']}})[_0x4121('0x24')](handleEntityNotFound(_0x101cd3,null))[_0x4121('0x24')](saveUpdates(_0x278bb7[_0x4121('0x46')],null))['then'](respondWithResult(_0x101cd3,null))[_0x4121('0x41')](handleError(_0x101cd3,null));};exports[_0x4121('0x48')]=function(_0x46076d,_0x325504){return db[_0x4121('0x2a')][_0x4121('0x44')]({'where':{'id':_0x46076d['params']['id']}})['then'](handleEntityNotFound(_0x325504,null))[_0x4121('0x24')](removeEntity(_0x325504,null))[_0x4121('0x41')](handleError(_0x325504,null));};exports[_0x4121('0x49')]=function(_0x4529a0,_0x372295){return db[_0x4121('0x2a')][_0x4121('0x49')]()['then'](respondWithResult(_0x372295,null))[_0x4121('0x41')](handleError(_0x372295,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 97908a6..ae2dbda 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 _0x4250=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x440f08,_0x464356){var _0x57d4a4=function(_0x429db0){while(--_0x429db0){_0x440f08['push'](_0x440f08['shift']());}};_0x57d4a4(++_0x464356);}(_0x4250,0x146));var _0x0425=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x4250[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var logger=require(_0x0425('0x2'))(_0x0425('0x3'));var moment=require('moment');var BPromise=require(_0x0425('0x4'));var rp=require(_0x0425('0x5'));var fs=require('fs');var path=require(_0x0425('0x6'));var rimraf=require('rimraf');var config=require(_0x0425('0x7'));var attributes=require(_0x0425('0x8'));module[_0x0425('0x9')]=function(_0x1e9547,_0x307761){return _0x1e9547[_0x0425('0xa')](_0x0425('0xb'),attributes,{'tableName':_0x0425('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0425('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b14=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','bluebird','request-promise','path','rimraf'];(function(_0x3dd0fb,_0x1a42a0){var _0x25017f=function(_0x28ec30){while(--_0x28ec30){_0x3dd0fb['push'](_0x3dd0fb['shift']());}};_0x25017f(++_0x1a42a0);}(_0x7b14,0x91));var _0x47b1=function(_0x2f0cb9,_0x2599eb){_0x2f0cb9=_0x2f0cb9-0x0;var _0x420f37=_0x7b14[_0x2f0cb9];return _0x420f37;};'use strict';var _=require(_0x47b1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x47b1('0x1'));var rp=require(_0x47b1('0x2'));var fs=require('fs');var path=require(_0x47b1('0x3'));var rimraf=require(_0x47b1('0x4'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x47b1('0x5')]=function(_0x317a11,_0x465170){return _0x317a11[_0x47b1('0x6')](_0x47b1('0x7'),attributes,{'tableName':_0x47b1('0x8'),'paranoid':![],'indexes':[{'fields':[_0x47b1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e6ed3f1..51e65d5 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 _0x2ba5=['error','code','message','result','CreateVoiceDialReport','create','options','debug','catch','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54e4ec,_0x183144){var _0x44ef91=function(_0x34fe75){while(--_0x34fe75){_0x54e4ec['push'](_0x54e4ec['shift']());}};_0x44ef91(++_0x183144);}(_0x2ba5,0x128));var _0x52ba=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x2ba5[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x52ba('0x0'));var util=require(_0x52ba('0x1'));var moment=require(_0x52ba('0x2'));var BPromise=require(_0x52ba('0x3'));var rs=require(_0x52ba('0x4'));var fs=require('fs');var Redis=require(_0x52ba('0x5'));var db=require(_0x52ba('0x6'))['db'];var utils=require(_0x52ba('0x7'));var logger=require(_0x52ba('0x8'))('rpc');var config=require(_0x52ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x52ba('0xa')][_0x52ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42a6f0,_0x2cfaae,_0x1d869e){return new BPromise(function(_0x4055b5,_0x30fdad){return client[_0x52ba('0xc')](_0x42a6f0,_0x1d869e)[_0x52ba('0xd')](function(_0x4c41af){logger[_0x52ba('0xe')](_0x52ba('0xf'),_0x2cfaae,_0x52ba('0x10'));logger['debug'](_0x52ba('0x11'),_0x2cfaae,_0x52ba('0x10'),JSON[_0x52ba('0x12')](_0x4c41af));if(_0x4c41af[_0x52ba('0x13')]){if(_0x4c41af['error'][_0x52ba('0x14')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x2cfaae,_0x4c41af['error'][_0x52ba('0x15')]);return _0x30fdad(_0x4c41af[_0x52ba('0x13')][_0x52ba('0x15')]);}logger[_0x52ba('0x13')](_0x52ba('0xf'),_0x2cfaae,_0x4c41af[_0x52ba('0x13')]['message']);return _0x4055b5(_0x4c41af[_0x52ba('0x13')][_0x52ba('0x15')]);}else{logger['info'](_0x52ba('0xf'),_0x2cfaae,_0x52ba('0x10'));_0x4055b5(_0x4c41af[_0x52ba('0x16')]['message']);}})['catch'](function(_0x382e70){logger[_0x52ba('0x13')](_0x52ba('0xf'),_0x2cfaae,_0x382e70);_0x30fdad(_0x382e70);});});}exports[_0x52ba('0x17')]=function(_0x2b79f6){var _0x12c20c=this;return new Promise(function(_0xfd53db,_0x26df9c){return db['VoiceDialReport'][_0x52ba('0x18')](_0x2b79f6['body'],{'raw':_0x2b79f6[_0x52ba('0x19')]?_0x2b79f6[_0x52ba('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x52ba('0xd')](function(_0x3420a4){logger['info']('CreateVoiceDialReport',_0x2b79f6);logger[_0x52ba('0x1a')]('CreateVoiceDialReport',_0x2b79f6,JSON[_0x52ba('0x12')](_0x3420a4));_0xfd53db(_0x3420a4);})[_0x52ba('0x1b')](function(_0x4af824){logger[_0x52ba('0x13')](_0x52ba('0x17'),_0x4af824[_0x52ba('0x15')],_0x2b79f6);_0x26df9c(_0x12c20c[_0x52ba('0x13')](0x1f4,_0x4af824[_0x52ba('0x15')]));});});};exports[_0x52ba('0x1c')]=function(_0x2c8fba){var _0x25b6fb=this;return new Promise(function(_0x1040bd,_0x205305){return db['VoiceDialReport'][_0x52ba('0x1d')](_0x2c8fba[_0x52ba('0x1e')],{'raw':_0x2c8fba[_0x52ba('0x19')]?_0x2c8fba[_0x52ba('0x19')][_0x52ba('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8fba[_0x52ba('0x19')]?_0x2c8fba[_0x52ba('0x19')][_0x52ba('0x20')]||null:null,'attributes':_0x2c8fba[_0x52ba('0x19')]?_0x2c8fba[_0x52ba('0x19')][_0x52ba('0x21')]||null:null,'limit':_0x2c8fba[_0x52ba('0x19')]?_0x2c8fba[_0x52ba('0x19')][_0x52ba('0x22')]||null:null})[_0x52ba('0xd')](function(_0x29e7fb){logger[_0x52ba('0xe')](_0x52ba('0x1c'),_0x2c8fba);logger[_0x52ba('0x1a')](_0x52ba('0x1c'),_0x2c8fba,JSON[_0x52ba('0x12')](_0x29e7fb));_0x1040bd(_0x29e7fb);})[_0x52ba('0x1b')](function(_0x3e5350){logger[_0x52ba('0x13')](_0x52ba('0x1c'),_0x3e5350['message'],_0x2c8fba);_0x205305(_0x25b6fb[_0x52ba('0x13')](0x1f4,_0x3e5350[_0x52ba('0x15')]));});});}; \ No newline at end of file +var _0x2875=['error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','stringify','UpdateVoiceDialReport','update','where','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x513483,_0x105ccd){var _0x384a1e=function(_0x47bb41){while(--_0x47bb41){_0x513483['push'](_0x513483['shift']());}};_0x384a1e(++_0x105ccd);}(_0x2875,0x19d));var _0x5287=function(_0x4ef066,_0x4143a0){_0x4ef066=_0x4ef066-0x0;var _0x12ba64=_0x2875[_0x4ef066];return _0x12ba64;};'use strict';var _=require('lodash');var util=require(_0x5287('0x0'));var moment=require(_0x5287('0x1'));var BPromise=require(_0x5287('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5287('0x3'));var db=require(_0x5287('0x4'))['db'];var utils=require(_0x5287('0x5'));var logger=require(_0x5287('0x6'))('rpc');var config=require(_0x5287('0x7'));var jayson=require(_0x5287('0x8'));var client=jayson[_0x5287('0x9')][_0x5287('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26e76c,_0x426b47,_0x56d67b){return new BPromise(function(_0x514f2a,_0x2de863){return client[_0x5287('0xb')](_0x26e76c,_0x56d67b)['then'](function(_0xb62160){logger[_0x5287('0xc')](_0x5287('0xd'),_0x426b47,_0x5287('0xe'));logger[_0x5287('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x426b47,_0x5287('0xe'),JSON['stringify'](_0xb62160));if(_0xb62160['error']){if(_0xb62160[_0x5287('0x10')][_0x5287('0x11')]===0x1f4){logger[_0x5287('0x10')](_0x5287('0xd'),_0x426b47,_0xb62160['error'][_0x5287('0x12')]);return _0x2de863(_0xb62160[_0x5287('0x10')][_0x5287('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x426b47,_0xb62160[_0x5287('0x10')][_0x5287('0x12')]);return _0x514f2a(_0xb62160[_0x5287('0x10')][_0x5287('0x12')]);}else{logger['info'](_0x5287('0xd'),_0x426b47,_0x5287('0xe'));_0x514f2a(_0xb62160[_0x5287('0x13')][_0x5287('0x12')]);}})[_0x5287('0x14')](function(_0x56da4f){logger[_0x5287('0x10')](_0x5287('0xd'),_0x426b47,_0x56da4f);_0x2de863(_0x56da4f);});});}exports[_0x5287('0x15')]=function(_0x5f25f8){var _0x365674=this;return new Promise(function(_0x2f0577,_0x22d2e7){return db[_0x5287('0x16')][_0x5287('0x17')](_0x5f25f8[_0x5287('0x18')],{'raw':_0x5f25f8[_0x5287('0x19')]?_0x5f25f8[_0x5287('0x19')][_0x5287('0x1a')]===undefined?!![]:![]:!![]})[_0x5287('0x1b')](function(_0x18687b){logger['info']('CreateVoiceDialReport',_0x5f25f8);logger[_0x5287('0xf')](_0x5287('0x15'),_0x5f25f8,JSON[_0x5287('0x1c')](_0x18687b));_0x2f0577(_0x18687b);})[_0x5287('0x14')](function(_0x2f41a9){logger['error'](_0x5287('0x15'),_0x2f41a9[_0x5287('0x12')],_0x5f25f8);_0x22d2e7(_0x365674['error'](0x1f4,_0x2f41a9[_0x5287('0x12')]));});});};exports[_0x5287('0x1d')]=function(_0x2d1b8a){var _0x17384f=this;return new Promise(function(_0x228524,_0x4a955b){return db[_0x5287('0x16')][_0x5287('0x1e')](_0x2d1b8a[_0x5287('0x18')],{'raw':_0x2d1b8a[_0x5287('0x19')]?_0x2d1b8a[_0x5287('0x19')][_0x5287('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1b8a['options']?_0x2d1b8a[_0x5287('0x19')][_0x5287('0x1f')]||null:null,'attributes':_0x2d1b8a[_0x5287('0x19')]?_0x2d1b8a['options'][_0x5287('0x20')]||null:null,'limit':_0x2d1b8a[_0x5287('0x19')]?_0x2d1b8a[_0x5287('0x19')]['limit']||null:null})[_0x5287('0x1b')](function(_0x543a0e){logger[_0x5287('0xc')](_0x5287('0x1d'),_0x2d1b8a);logger[_0x5287('0xf')]('UpdateVoiceDialReport',_0x2d1b8a,JSON[_0x5287('0x1c')](_0x543a0e));_0x228524(_0x543a0e);})[_0x5287('0x14')](function(_0x3e95a3){logger['error']('UpdateVoiceDialReport',_0x3e95a3['message'],_0x2d1b8a);_0x4a955b(_0x17384f[_0x5287('0x10')](0x1f4,_0x3e95a3[_0x5287('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5e6f572..5257365 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 _0xd423=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','express','../../components/auth/service'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xd423,0x178));var _0x3d42=function(_0x2426d7,_0x515f06){_0x2426d7=_0x2426d7-0x0;var _0x236709=_0xd423[_0x2426d7];return _0x236709;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3d42('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d42('0x1'));var interaction=require(_0x3d42('0x2'));var config=require(_0x3d42('0x3'));var controller=require(_0x3d42('0x4'));router[_0x3d42('0x5')]('/',auth[_0x3d42('0x6')](),controller[_0x3d42('0x7')]);router[_0x3d42('0x5')](_0x3d42('0x8'),auth[_0x3d42('0x6')](),controller['show']);router[_0x3d42('0x9')]('/',auth[_0x3d42('0x6')](),controller[_0x3d42('0xa')]);router[_0x3d42('0x9')](_0x3d42('0xb'),auth['isAuthenticated'](),controller[_0x3d42('0xc')]);router[_0x3d42('0xd')](_0x3d42('0x8'),auth[_0x3d42('0x6')](),controller[_0x3d42('0xe')]);router[_0x3d42('0xf')](_0x3d42('0x8'),auth[_0x3d42('0x6')](),controller[_0x3d42('0x10')]);module[_0x3d42('0x11')]=router; \ No newline at end of file +var _0x4bbd=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','create','post','put','/:id'];(function(_0x49a613,_0x27ad0b){var _0x4ed260=function(_0x3b3e2b){while(--_0x3b3e2b){_0x49a613['push'](_0x49a613['shift']());}};_0x4ed260(++_0x27ad0b);}(_0x4bbd,0x17f));var _0xd4bb=function(_0x4d66bb,_0x292457){_0x4d66bb=_0x4d66bb-0x0;var _0x11d82e=_0x4bbd[_0x4d66bb];return _0x11d82e;};'use strict';var multer=require(_0xd4bb('0x0'));var util=require('util');var path=require(_0xd4bb('0x1'));var timeout=require(_0xd4bb('0x2'));var express=require(_0xd4bb('0x3'));var router=express[_0xd4bb('0x4')]();var fs_extra=require(_0xd4bb('0x5'));var auth=require(_0xd4bb('0x6'));var interaction=require(_0xd4bb('0x7'));var config=require('../../config/environment');var controller=require(_0xd4bb('0x8'));router[_0xd4bb('0x9')]('/',auth[_0xd4bb('0xa')](),controller[_0xd4bb('0xb')]);router[_0xd4bb('0x9')]('/:id',auth[_0xd4bb('0xa')](),controller['show']);router['post']('/',auth[_0xd4bb('0xa')](),controller[_0xd4bb('0xc')]);router[_0xd4bb('0xd')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xd4bb('0xe')](_0xd4bb('0xf'),auth['isAuthenticated'](),controller[_0xd4bb('0x10')]);router[_0xd4bb('0x11')](_0xd4bb('0xf'),auth[_0xd4bb('0xa')](),controller['destroy']);module[_0xd4bb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4e1cde1..7c165f7 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 _0x664d=['VIRTUAL','exports','compositeIndex','STRING','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER'];(function(_0x41b6f5,_0x1ad42f){var _0x5d6142=function(_0xb46850){while(--_0xb46850){_0x41b6f5['push'](_0x41b6f5['shift']());}};_0x5d6142(++_0x1ad42f);}(_0x664d,0x169));var _0xd664=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x664d[_0x3b76f7];return _0x43984e;};'use strict';var Sequelize=require('sequelize');module[_0xd664('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd664('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd664('0x2')],'allowNull':![],'unique':_0xd664('0x1')},'priority':{'type':Sequelize[_0xd664('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd664('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd664('0x2')],'allowNull':![],'defaultValue':_0xd664('0x3')},'appdata':{'type':Sequelize[_0xd664('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd664('0x4')](_0xd664('0x5'),'outbound',_0xd664('0x6'),_0xd664('0x7'),_0xd664('0x8'),_0xd664('0x9'),_0xd664('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xd664('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd664('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xd664('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd664('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd664('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd664('0xd')]},'recordingFormat':{'type':Sequelize[_0xd664('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xd664('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd664('0xe')],'get':function(_0x51873f){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xd664('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x522e=['inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING','compositeIndex'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x522e,0x1da));var _0xe522=function(_0x4264c1,_0x11ae38){_0x4264c1=_0x4264c1-0x0;var _0x1e137d=_0x522e[_0x4264c1];return _0x1e137d;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xe522('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe522('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xe522('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe522('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xe522('0x2'),_0xe522('0x3'),_0xe522('0x4'),_0xe522('0x5'),_0xe522('0x6'),'system',_0xe522('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0xe522('0x0')]},'interval':{'type':Sequelize[_0xe522('0x0')],'allowNull':![],'defaultValue':_0xe522('0x8')},'IntervalId':{'type':Sequelize[_0xe522('0x9')]},'isApp':{'type':Sequelize[_0xe522('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe522('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe522('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xe522('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe522('0x9')]},'recordingFormat':{'type':Sequelize[_0xe522('0x0')],'defaultValue':_0xe522('0xb')},'answer':{'type':Sequelize[_0xe522('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe522('0xc')],'get':function(_0x26c8d5){return this[_0xe522('0xd')]('exten');}},'alias':{'type':Sequelize[_0xe522('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 19a5e7a..96da5ba 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 _0x6557=['find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','keys','intersection','params','create','body','startsWith','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','update','context','recordingFormat','cutdigits','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','error','finally','sendStatus','lodash','api','../../config/environment','../../mysqldb','redis','localhost','register','end','status','offset','limit','undefined','count','set','json','destroy','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6557,0x8e));var _0x7655=function(_0x53b971,_0x2dc6e5){_0x53b971=_0x53b971-0x0;var _0x1cc7db=_0x6557[_0x53b971];return _0x1cc7db;};'use strict';var _=require(_0x7655('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7655('0x1'));var config=require(_0x7655('0x2'));var db=require(_0x7655('0x3'))['db'];config[_0x7655('0x4')]=_['defaults'](config[_0x7655('0x4')],{'host':_0x7655('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7655('0x4')]));require('./voiceExtension.socket')[_0x7655('0x6')](socket);function respondWithStatusCode(_0x276974,_0x8f4c37){_0x8f4c37=_0x8f4c37||0xcc;return function(_0x2a58ad){if(_0x2a58ad){return _0x276974['sendStatus'](_0x8f4c37);}return _0x276974['status'](_0x8f4c37)[_0x7655('0x7')]();};}function respondWithResult(_0x42325b,_0x2d90ad){_0x2d90ad=_0x2d90ad||0xc8;return function(_0x46e142){if(_0x46e142){return _0x42325b[_0x7655('0x8')](_0x2d90ad)['json'](_0x46e142);}};}function respondWithFilteredResult(_0x38b084,_0x50285b){return function(_0x43d1b9){if(_0x43d1b9){var _0x3440bf=typeof _0x50285b[_0x7655('0x9')]==='undefined'&&typeof _0x50285b[_0x7655('0xa')]===_0x7655('0xb');var _0x4cee54=_0x43d1b9['count'];var _0x1a62e3=_0x3440bf?0x0:_0x50285b['offset'];var _0x83861a=_0x3440bf?_0x43d1b9[_0x7655('0xc')]:_0x50285b[_0x7655('0x9')]+_0x50285b[_0x7655('0xa')];var _0x59efdd;if(_0x83861a>=_0x4cee54){_0x83861a=_0x4cee54;_0x59efdd=0xc8;}else{_0x59efdd=0xce;}_0x38b084[_0x7655('0x8')](_0x59efdd);return _0x38b084[_0x7655('0xd')]('Content-Range',_0x1a62e3+'-'+_0x83861a+'/'+_0x4cee54)[_0x7655('0xe')](_0x43d1b9);}return null;};}function removeEntity(_0x56c7d0){return function(_0x1ef59a){if(_0x1ef59a){return _0x1ef59a[_0x7655('0xf')]()[_0x7655('0x10')](function(){var _0x4c1a17=_0x1ef59a['get']({'plain':!![]});var _0x4b1349=[{'name':_0x7655('0x11'),'value':'inbound','ignore':![]},{'name':_0x7655('0x12'),'value':_0x7655('0x13'),'ignore':![]},{'name':_0x7655('0x14'),'value':_0x7655('0x15'),'ignore':![]}];var _0x243472=_(_0x4b1349)[_0x7655('0x16')](_0x7655('0x17'))[_0x7655('0x18')](_0x7655('0x19'))[_0x7655('0x19')]();if(_[_0x7655('0x1a')](_0x243472,_0x4c1a17[_0x7655('0x1b')])){return;}var _0x109ee9=_[_0x7655('0x1c')](_0x4b1349,[_0x7655('0x19'),_0x4c1a17[_0x7655('0x1b')]])[_0x7655('0x1d')];return db[_0x7655('0x1e')][_0x7655('0xf')]({'where':{'type':_0x109ee9,'resourceId':_0x4c1a17['id']}})[_0x7655('0x10')](function(){return _0x1ef59a;});})[_0x7655('0x10')](function(){_0x56c7d0[_0x7655('0x8')](0xcc)[_0x7655('0x7')]();});}};}function handleEntityNotFound(_0x34f00c){return function(_0x44fc77){if(!_0x44fc77){_0x34f00c['sendStatus'](0x194);}return _0x44fc77;};}function handleError(_0x2be7c4,_0x1a17a4){_0x1a17a4=_0x1a17a4||0x1f4;return function(_0x1c3c0e){logger['error'](_0x1c3c0e[_0x7655('0x1f')]);if(_0x1c3c0e[_0x7655('0x1d')]){delete _0x1c3c0e['name'];}_0x2be7c4[_0x7655('0x8')](_0x1a17a4)[_0x7655('0x20')](_0x1c3c0e);};}exports[_0x7655('0x21')]=function(_0x56e051,_0x45b0c6){var _0x2c6598={},_0x3bcc20={},_0x4233e0={'count':0x0,'rows':[]};var _0x30c4e8=_['map'](db[_0x7655('0x22')][_0x7655('0x23')],function(_0x1dac51){return{'name':_0x1dac51[_0x7655('0x24')],'type':_0x1dac51[_0x7655('0x1b')][_0x7655('0x25')]};});_0x3bcc20['model']=_['map'](_0x30c4e8,'name');_0x3bcc20['query']=_['keys'](_0x56e051[_0x7655('0x26')]);_0x3bcc20[_0x7655('0x27')]=_['intersection'](_0x3bcc20['model'],_0x3bcc20[_0x7655('0x26')]);_0x2c6598[_0x7655('0x28')]=_['intersection'](_0x3bcc20[_0x7655('0x29')],qs[_0x7655('0x2a')](_0x56e051['query'][_0x7655('0x2a')]));_0x2c6598['attributes']=_0x2c6598['attributes'][_0x7655('0x2b')]?_0x2c6598[_0x7655('0x28')]:_0x3bcc20[_0x7655('0x29')];if(!_0x56e051[_0x7655('0x26')][_0x7655('0x2c')](_0x7655('0x2d'))){_0x2c6598[_0x7655('0xa')]=qs[_0x7655('0xa')](_0x56e051[_0x7655('0x26')][_0x7655('0xa')]);_0x2c6598[_0x7655('0x9')]=qs['offset'](_0x56e051[_0x7655('0x26')][_0x7655('0x9')]);}_0x2c6598['order']=qs[_0x7655('0x2e')](_0x56e051[_0x7655('0x26')][_0x7655('0x2e')]);_0x2c6598[_0x7655('0x2f')]=qs[_0x7655('0x27')](_[_0x7655('0x30')](_0x56e051[_0x7655('0x26')],_0x3bcc20[_0x7655('0x27')]),_0x30c4e8);if(_0x56e051[_0x7655('0x26')][_0x7655('0x16')]){_0x2c6598[_0x7655('0x2f')]=_[_0x7655('0x31')](_0x2c6598['where'],{'$or':_[_0x7655('0x18')](_0x30c4e8,function(_0x2bf765){if(_0x2bf765[_0x7655('0x1b')]!==_0x7655('0x32')){var _0x309ccc={};_0x309ccc[_0x2bf765[_0x7655('0x1d')]]={'$like':'%'+_0x56e051[_0x7655('0x26')]['filter']+'%'};return _0x309ccc;}})});}_0x2c6598=_[_0x7655('0x31')]({},_0x2c6598,_0x56e051[_0x7655('0x33')]);var _0x5d74c1={'where':_0x2c6598[_0x7655('0x2f')]};return db['VoiceExtension'][_0x7655('0xc')](_0x5d74c1)[_0x7655('0x10')](function(_0x49b95c){_0x4233e0[_0x7655('0xc')]=_0x49b95c;if(_0x56e051[_0x7655('0x26')][_0x7655('0x34')]){_0x2c6598[_0x7655('0x35')]=[{'all':!![]}];}return db[_0x7655('0x22')]['findAll'](_0x2c6598);})[_0x7655('0x10')](function(_0x439905){_0x4233e0['rows']=_0x439905;return _0x4233e0;})[_0x7655('0x10')](respondWithFilteredResult(_0x45b0c6,_0x2c6598))[_0x7655('0x36')](handleError(_0x45b0c6,null));};exports[_0x7655('0x37')]=function(_0x2e13a0,_0xe6d9a6){var _0x4b6166={'raw':![],'where':{'id':_0x2e13a0['params']['id']}},_0xdd743d={};_0xdd743d[_0x7655('0x29')]=_[_0x7655('0x38')](db['VoiceExtension']['rawAttributes']);_0xdd743d['query']=_[_0x7655('0x38')](_0x2e13a0[_0x7655('0x26')]);_0xdd743d[_0x7655('0x27')]=_[_0x7655('0x39')](_0xdd743d['model'],_0xdd743d[_0x7655('0x26')]);_0x4b6166[_0x7655('0x28')]=_['intersection'](_0xdd743d[_0x7655('0x29')],qs['fields'](_0x2e13a0[_0x7655('0x26')][_0x7655('0x2a')]));_0x4b6166[_0x7655('0x28')]=_0x4b6166[_0x7655('0x28')][_0x7655('0x2b')]?_0x4b6166['attributes']:_0xdd743d['model'];if(_0x2e13a0[_0x7655('0x26')][_0x7655('0x34')]){_0x4b6166[_0x7655('0x35')]=[{'all':!![]}];}_0x4b6166=_[_0x7655('0x31')]({},_0x4b6166,_0x2e13a0[_0x7655('0x33')]);return db['VoiceExtension'][_0x7655('0x1c')](_0x4b6166)[_0x7655('0x10')](handleEntityNotFound(_0xe6d9a6,null))[_0x7655('0x10')](respondWithResult(_0xe6d9a6,null))[_0x7655('0x36')](handleError(_0xe6d9a6,null));};exports[_0x7655('0xf')]=function(_0x534b3d,_0x1991c0){return db['VoiceExtension'][_0x7655('0x1c')]({'where':{'id':_0x534b3d[_0x7655('0x3a')]['id']}})[_0x7655('0x10')](handleEntityNotFound(_0x1991c0,null))['then'](removeEntity(_0x1991c0,null))['catch'](handleError(_0x1991c0,null));};exports[_0x7655('0x3b')]=function(_0x1bef25,_0x2ae665){if(_0x1bef25[_0x7655('0x3c')][_0x7655('0x1b')]===_0x7655('0x13')&&!_[_0x7655('0x3d')](_0x1bef25['body'][_0x7655('0x3e')],'_')){_0x1bef25[_0x7655('0x3c')][_0x7655('0x3e')]='_'['concat'](_0x1bef25[_0x7655('0x3c')][_0x7655('0x3e')]);}return db[_0x7655('0x22')]['create'](_0x1bef25[_0x7655('0x3c')],{'raw':![]})[_0x7655('0x10')](function(_0x246dc0){var _0x17679a=_0x1bef25[_0x7655('0x3f')][_0x7655('0x40')]({'plain':!![]});if(!_0x17679a)throw new Error(_0x7655('0x41'));if(_0x17679a[_0x7655('0x42')]==='user'){var _0x12e9db=_0x246dc0[_0x7655('0x40')]({'plain':!![]});var _0x455953=[{'name':_0x7655('0x11'),'value':_0x7655('0x43')},{'name':_0x7655('0x12'),'value':_0x7655('0x13')},{'name':_0x7655('0x14'),'value':'internal'}];var _0x4bf786=_[_0x7655('0x1c')](_0x455953,['value',_0x12e9db[_0x7655('0x1b')]])['name'];return db['UserProfileSection'][_0x7655('0x1c')]({'where':{'name':_0x4bf786,'userProfileId':_0x17679a[_0x7655('0x44')]},'raw':!![]})[_0x7655('0x10')](function(_0x471bf5){if(_0x471bf5&&_0x471bf5[_0x7655('0x45')]===0x0){return db['UserProfileResource']['create']({'name':_0x12e9db['name'],'resourceId':_0x12e9db['id'],'type':_0x471bf5[_0x7655('0x1d')],'sectionId':_0x471bf5['id']},{})[_0x7655('0x10')](function(){return _0x246dc0;});}else{return _0x246dc0;}})['catch'](function(_0x34fa8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34fa8c);throw _0x34fa8c;});}return _0x246dc0;})[_0x7655('0x10')](respondWithResult(_0x2ae665,0xc9))['catch'](handleError(_0x2ae665,null));};exports['update']=function(_0x16c511,_0x235899){if(_0x16c511[_0x7655('0x3c')]['id']){delete _0x16c511[_0x7655('0x3c')]['id'];}return db[_0x7655('0x22')][_0x7655('0x1c')]({'where':{'id':_0x16c511[_0x7655('0x3a')]['id']}})[_0x7655('0x10')](handleEntityNotFound(_0x235899,null))[_0x7655('0x10')](function(_0xbbf9b){if(_0xbbf9b){return db['VoiceExtension'][_0x7655('0x46')](_[_0x7655('0x30')](_0x16c511[_0x7655('0x3c')],[_0x7655('0x3e'),_0x7655('0x47'),'description',_0x7655('0x48'),_0x7655('0x49'),'mandatoryDisposition','alias']),{'where':{'context':_0xbbf9b[_0x7655('0x47')],'exten':_0xbbf9b[_0x7655('0x3e')]},'individualHooks':!![]})[_0x7655('0x10')](function(_0x5bb723){return _0x5bb723;});}return null;})[_0x7655('0x10')](respondWithStatusCode(_0x235899,null))[_0x7655('0x36')](handleError(_0x235899,null));};exports['addApplications']=function(_0x29a93c,_0x1a7647){var _0x429d0d=_0x29a93c['params']['id'];var _0x3f952c=_0x29a93c[_0x7655('0x3c')];var _0x4ca70a=0xc8;var _0x2fbebe=null;return db[_0x7655('0x4a')]['transaction']({'isolationLevel':db[_0x7655('0x4a')][_0x7655('0x4b')]['ISOLATION_LEVELS'][_0x7655('0x4c')]},function(_0x4907cb){return db[_0x7655('0x22')][_0x7655('0x4d')]({'where':{'id':_0x429d0d},'transaction':_0x4907cb})[_0x7655('0x10')](function(_0x9454ea){if(_0x9454ea){return db['VoiceExtension'][_0x7655('0xf')]({'where':{'VoiceExtensionId':_0x429d0d},'transaction':_0x4907cb})[_0x7655('0x10')](function(){var _0x10bfcf=_[_0x7655('0x18')](_0x3f952c,function(_0x5aa507){_0x5aa507[_0x7655('0x4e')]=_0x429d0d;_0x5aa507['isApp']=!![];return _0x5aa507;});return _0x9454ea[_0x7655('0x4f')](_0x10bfcf);})[_0x7655('0x10')](function(_0x4bc0b5){return db[_0x7655('0x22')][_0x7655('0x50')](_0x4bc0b5,{'transaction':_0x4907cb});});}else{_0x4ca70a=0x194;_0x2fbebe=[];}});})[_0x7655('0x10')](function(){if(_0x4ca70a!==0x194){return db[_0x7655('0x22')][_0x7655('0x51')]({'where':{'isApp':!![],'VoiceExtensionId':_0x429d0d},'order':'cast(priority\x20as\x20unsigned)'})[_0x7655('0x10')](function(_0x36b904){_0x2fbebe=_0x36b904;});}})['catch'](function(_0x14d1cc){_0x4ca70a=0x1f4;logger[_0x7655('0x52')](_0x14d1cc[_0x7655('0x1f')]);if(_0x14d1cc[_0x7655('0x1d')]){delete _0x14d1cc[_0x7655('0x1d')];}_0x2fbebe=_0x14d1cc;})[_0x7655('0x53')](function(){if(_0x2fbebe===null){_0x1a7647[_0x7655('0x54')](_0x4ca70a);}else{if(_0x4ca70a===0x1f4){_0x1a7647['status'](_0x4ca70a)[_0x7655('0x20')](_0x2fbebe);}else{_0x1a7647[_0x7655('0x8')](_0x4ca70a)[_0x7655('0xe')](_0x2fbebe);}}});}; \ No newline at end of file +var _0x102f=['offset','undefined','count','limit','Content-Range','destroy','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','name','UserProfileResource','then','end','error','stack','send','VoiceExtension','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','json'];(function(_0x75b449,_0x337eb2){var _0xe8f5d2=function(_0x5500e3){while(--_0x5500e3){_0x75b449['push'](_0x75b449['shift']());}};_0xe8f5d2(++_0x337eb2);}(_0x102f,0x10d));var _0xf102=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x102f[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0xf102('0x0'));var Redis=require(_0xf102('0x1'));var qs=require(_0xf102('0x2'));var logger=require(_0xf102('0x3'))(_0xf102('0x4'));var config=require(_0xf102('0x5'));var db=require('../../mysqldb')['db'];config[_0xf102('0x6')]=_[_0xf102('0x7')](config[_0xf102('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf102('0x8'))(new Redis(config['redis']));require(_0xf102('0x9'))['register'](socket);function respondWithStatusCode(_0xac36,_0x1f406f){_0x1f406f=_0x1f406f||0xcc;return function(_0x2110ef){if(_0x2110ef){return _0xac36[_0xf102('0xa')](_0x1f406f);}return _0xac36['status'](_0x1f406f)['end']();};}function respondWithResult(_0x31e503,_0xb56d78){_0xb56d78=_0xb56d78||0xc8;return function(_0x5600d7){if(_0x5600d7){return _0x31e503[_0xf102('0xb')](_0xb56d78)[_0xf102('0xc')](_0x5600d7);}};}function respondWithFilteredResult(_0x2f40a6,_0x4d7f4c){return function(_0xae9ec8){if(_0xae9ec8){var _0x8a9b4f=typeof _0x4d7f4c[_0xf102('0xd')]===_0xf102('0xe')&&typeof _0x4d7f4c['limit']==='undefined';var _0xf2c4ee=_0xae9ec8[_0xf102('0xf')];var _0x564e42=_0x8a9b4f?0x0:_0x4d7f4c[_0xf102('0xd')];var _0xcb1589=_0x8a9b4f?_0xae9ec8[_0xf102('0xf')]:_0x4d7f4c['offset']+_0x4d7f4c[_0xf102('0x10')];var _0xcffd2;if(_0xcb1589>=_0xf2c4ee){_0xcb1589=_0xf2c4ee;_0xcffd2=0xc8;}else{_0xcffd2=0xce;}_0x2f40a6[_0xf102('0xb')](_0xcffd2);return _0x2f40a6['set'](_0xf102('0x11'),_0x564e42+'-'+_0xcb1589+'/'+_0xf2c4ee)['json'](_0xae9ec8);}return null;};}function removeEntity(_0x19225c){return function(_0x252fbd){if(_0x252fbd){return _0x252fbd[_0xf102('0x12')]()['then'](function(){var _0x4a3237=_0x252fbd['get']({'plain':!![]});var _0x5766c1=[{'name':'InboundRoutes','value':_0xf102('0x13'),'ignore':![]},{'name':_0xf102('0x14'),'value':_0xf102('0x15'),'ignore':![]},{'name':_0xf102('0x16'),'value':_0xf102('0x17'),'ignore':![]}];var _0x1f01e7=_(_0x5766c1)[_0xf102('0x18')](_0xf102('0x19'))['map'](_0xf102('0x1a'))[_0xf102('0x1a')]();if(_[_0xf102('0x1b')](_0x1f01e7,_0x4a3237[_0xf102('0x1c')])){return;}var _0x3fa4c5=_['find'](_0x5766c1,['value',_0x4a3237[_0xf102('0x1c')]])[_0xf102('0x1d')];return db[_0xf102('0x1e')][_0xf102('0x12')]({'where':{'type':_0x3fa4c5,'resourceId':_0x4a3237['id']}})[_0xf102('0x1f')](function(){return _0x252fbd;});})[_0xf102('0x1f')](function(){_0x19225c['status'](0xcc)[_0xf102('0x20')]();});}};}function handleEntityNotFound(_0x39a072){return function(_0x2c7d82){if(!_0x2c7d82){_0x39a072['sendStatus'](0x194);}return _0x2c7d82;};}function handleError(_0xaf10c4,_0x529dcb){_0x529dcb=_0x529dcb||0x1f4;return function(_0x2b71de){logger[_0xf102('0x21')](_0x2b71de[_0xf102('0x22')]);if(_0x2b71de[_0xf102('0x1d')]){delete _0x2b71de[_0xf102('0x1d')];}_0xaf10c4[_0xf102('0xb')](_0x529dcb)[_0xf102('0x23')](_0x2b71de);};}exports['index']=function(_0x396172,_0xb170e5){var _0x538ff9={},_0x5055ba={},_0x4b24e5={'count':0x0,'rows':[]};var _0x615034=_['map'](db[_0xf102('0x24')][_0xf102('0x25')],function(_0x341279){return{'name':_0x341279['fieldName'],'type':_0x341279[_0xf102('0x1c')][_0xf102('0x26')]};});_0x5055ba[_0xf102('0x27')]=_[_0xf102('0x28')](_0x615034,_0xf102('0x1d'));_0x5055ba[_0xf102('0x29')]=_[_0xf102('0x2a')](_0x396172[_0xf102('0x29')]);_0x5055ba['filters']=_[_0xf102('0x2b')](_0x5055ba['model'],_0x5055ba[_0xf102('0x29')]);_0x538ff9[_0xf102('0x2c')]=_[_0xf102('0x2b')](_0x5055ba[_0xf102('0x27')],qs[_0xf102('0x2d')](_0x396172[_0xf102('0x29')][_0xf102('0x2d')]));_0x538ff9[_0xf102('0x2c')]=_0x538ff9['attributes'][_0xf102('0x2e')]?_0x538ff9[_0xf102('0x2c')]:_0x5055ba['model'];if(!_0x396172[_0xf102('0x29')][_0xf102('0x2f')](_0xf102('0x30'))){_0x538ff9[_0xf102('0x10')]=qs[_0xf102('0x10')](_0x396172[_0xf102('0x29')][_0xf102('0x10')]);_0x538ff9[_0xf102('0xd')]=qs[_0xf102('0xd')](_0x396172[_0xf102('0x29')][_0xf102('0xd')]);}_0x538ff9['order']=qs[_0xf102('0x31')](_0x396172[_0xf102('0x29')][_0xf102('0x31')]);_0x538ff9[_0xf102('0x32')]=qs[_0xf102('0x33')](_['pick'](_0x396172[_0xf102('0x29')],_0x5055ba[_0xf102('0x33')]),_0x615034);if(_0x396172[_0xf102('0x29')][_0xf102('0x18')]){_0x538ff9['where']=_[_0xf102('0x34')](_0x538ff9[_0xf102('0x32')],{'$or':_['map'](_0x615034,function(_0x1c3ba1){if(_0x1c3ba1['type']!=='VIRTUAL'){var _0x35e756={};_0x35e756[_0x1c3ba1[_0xf102('0x1d')]]={'$like':'%'+_0x396172[_0xf102('0x29')][_0xf102('0x18')]+'%'};return _0x35e756;}})});}_0x538ff9=_[_0xf102('0x34')]({},_0x538ff9,_0x396172['options']);var _0x568f96={'where':_0x538ff9['where']};return db[_0xf102('0x24')][_0xf102('0xf')](_0x568f96)['then'](function(_0xe5665a){_0x4b24e5[_0xf102('0xf')]=_0xe5665a;if(_0x396172[_0xf102('0x29')][_0xf102('0x35')]){_0x538ff9[_0xf102('0x36')]=[{'all':!![]}];}return db[_0xf102('0x24')][_0xf102('0x37')](_0x538ff9);})['then'](function(_0x1d7f38){_0x4b24e5['rows']=_0x1d7f38;return _0x4b24e5;})[_0xf102('0x1f')](respondWithFilteredResult(_0xb170e5,_0x538ff9))[_0xf102('0x38')](handleError(_0xb170e5,null));};exports[_0xf102('0x39')]=function(_0x49a2e7,_0x2b99bd){var _0xa2ad3f={'raw':![],'where':{'id':_0x49a2e7[_0xf102('0x3a')]['id']}},_0x27fe95={};_0x27fe95[_0xf102('0x27')]=_['keys'](db[_0xf102('0x24')][_0xf102('0x25')]);_0x27fe95[_0xf102('0x29')]=_['keys'](_0x49a2e7[_0xf102('0x29')]);_0x27fe95[_0xf102('0x33')]=_[_0xf102('0x2b')](_0x27fe95[_0xf102('0x27')],_0x27fe95['query']);_0xa2ad3f[_0xf102('0x2c')]=_[_0xf102('0x2b')](_0x27fe95[_0xf102('0x27')],qs[_0xf102('0x2d')](_0x49a2e7['query'][_0xf102('0x2d')]));_0xa2ad3f[_0xf102('0x2c')]=_0xa2ad3f[_0xf102('0x2c')][_0xf102('0x2e')]?_0xa2ad3f['attributes']:_0x27fe95[_0xf102('0x27')];if(_0x49a2e7[_0xf102('0x29')]['includeAll']){_0xa2ad3f['include']=[{'all':!![]}];}_0xa2ad3f=_[_0xf102('0x34')]({},_0xa2ad3f,_0x49a2e7[_0xf102('0x3b')]);return db[_0xf102('0x24')][_0xf102('0x3c')](_0xa2ad3f)[_0xf102('0x1f')](handleEntityNotFound(_0x2b99bd,null))[_0xf102('0x1f')](respondWithResult(_0x2b99bd,null))['catch'](handleError(_0x2b99bd,null));};exports[_0xf102('0x12')]=function(_0x4bc62c,_0x309e46){return db[_0xf102('0x24')][_0xf102('0x3c')]({'where':{'id':_0x4bc62c[_0xf102('0x3a')]['id']}})['then'](handleEntityNotFound(_0x309e46,null))[_0xf102('0x1f')](removeEntity(_0x309e46,null))['catch'](handleError(_0x309e46,null));};exports[_0xf102('0x3d')]=function(_0x389534,_0x4fa27e){if(_0x389534[_0xf102('0x3e')][_0xf102('0x1c')]===_0xf102('0x15')&&!_[_0xf102('0x3f')](_0x389534['body'][_0xf102('0x40')],'_')){_0x389534[_0xf102('0x3e')]['exten']='_'[_0xf102('0x41')](_0x389534[_0xf102('0x3e')][_0xf102('0x40')]);}return db['VoiceExtension'][_0xf102('0x3d')](_0x389534[_0xf102('0x3e')],{'raw':![]})['then'](function(_0x200e8b){var _0x13ce62=_0x389534['user'][_0xf102('0x42')]({'plain':!![]});if(!_0x13ce62)throw new Error(_0xf102('0x43'));if(_0x13ce62[_0xf102('0x44')]==='user'){var _0x12aa6e=_0x200e8b[_0xf102('0x42')]({'plain':!![]});var _0x1470fa=[{'name':'InboundRoutes','value':_0xf102('0x13')},{'name':'OutboundRoutes','value':_0xf102('0x15')},{'name':_0xf102('0x16'),'value':_0xf102('0x17')}];var _0x45e5b3=_[_0xf102('0x3c')](_0x1470fa,[_0xf102('0x1a'),_0x12aa6e[_0xf102('0x1c')]])['name'];return db[_0xf102('0x45')][_0xf102('0x3c')]({'where':{'name':_0x45e5b3,'userProfileId':_0x13ce62[_0xf102('0x46')]},'raw':!![]})[_0xf102('0x1f')](function(_0x9e34cc){if(_0x9e34cc&&_0x9e34cc[_0xf102('0x47')]===0x0){return db[_0xf102('0x1e')][_0xf102('0x3d')]({'name':_0x12aa6e[_0xf102('0x1d')],'resourceId':_0x12aa6e['id'],'type':_0x9e34cc[_0xf102('0x1d')],'sectionId':_0x9e34cc['id']},{})['then'](function(){return _0x200e8b;});}else{return _0x200e8b;}})[_0xf102('0x38')](function(_0x4fdc53){logger['error'](_0xf102('0x48'),_0x4fdc53);throw _0x4fdc53;});}return _0x200e8b;})[_0xf102('0x1f')](respondWithResult(_0x4fa27e,0xc9))[_0xf102('0x38')](handleError(_0x4fa27e,null));};exports[_0xf102('0x49')]=function(_0x13f99c,_0x59986b){if(_0x13f99c['body']['id']){delete _0x13f99c[_0xf102('0x3e')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x13f99c['params']['id']}})['then'](handleEntityNotFound(_0x59986b,null))[_0xf102('0x1f')](function(_0x47f036){if(_0x47f036){return db[_0xf102('0x24')][_0xf102('0x49')](_[_0xf102('0x4a')](_0x13f99c[_0xf102('0x3e')],[_0xf102('0x40'),'context',_0xf102('0x4b'),_0xf102('0x4c'),_0xf102('0x4d'),_0xf102('0x4e'),_0xf102('0x4f')]),{'where':{'context':_0x47f036[_0xf102('0x50')],'exten':_0x47f036['exten']},'individualHooks':!![]})[_0xf102('0x1f')](function(_0xf0fd6e){return _0xf0fd6e;});}return null;})[_0xf102('0x1f')](respondWithStatusCode(_0x59986b,null))[_0xf102('0x38')](handleError(_0x59986b,null));};exports[_0xf102('0x51')]=function(_0x20cf10,_0x4c6779){var _0x36fed8=_0x20cf10['params']['id'];var _0x229aab=_0x20cf10[_0xf102('0x3e')];var _0x4402f8=0xc8;var _0x21475b=null;return db['sequelize'][_0xf102('0x52')]({'isolationLevel':db[_0xf102('0x53')][_0xf102('0x54')][_0xf102('0x55')][_0xf102('0x56')]},function(_0x55faab){return db['VoiceExtension'][_0xf102('0x57')]({'where':{'id':_0x36fed8},'transaction':_0x55faab})[_0xf102('0x1f')](function(_0xe493a4){if(_0xe493a4){return db[_0xf102('0x24')][_0xf102('0x12')]({'where':{'VoiceExtensionId':_0x36fed8},'transaction':_0x55faab})[_0xf102('0x1f')](function(){var _0x1648f0=_[_0xf102('0x28')](_0x229aab,function(_0x4bd0c5){_0x4bd0c5[_0xf102('0x58')]=_0x36fed8;_0x4bd0c5[_0xf102('0x59')]=!![];return _0x4bd0c5;});return _0xe493a4['createRouting'](_0x1648f0);})[_0xf102('0x1f')](function(_0x4bc9c9){return db[_0xf102('0x24')][_0xf102('0x5a')](_0x4bc9c9,{'transaction':_0x55faab});});}else{_0x4402f8=0x194;_0x21475b=[];}});})[_0xf102('0x1f')](function(){if(_0x4402f8!==0x194){return db[_0xf102('0x24')][_0xf102('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x36fed8},'order':_0xf102('0x5c')})[_0xf102('0x1f')](function(_0x2a5e06){_0x21475b=_0x2a5e06;});}})[_0xf102('0x38')](function(_0x57c028){_0x4402f8=0x1f4;logger[_0xf102('0x21')](_0x57c028['stack']);if(_0x57c028[_0xf102('0x1d')]){delete _0x57c028[_0xf102('0x1d')];}_0x21475b=_0x57c028;})[_0xf102('0x5d')](function(){if(_0x21475b===null){_0x4c6779[_0xf102('0xa')](_0x4402f8);}else{if(_0x4402f8===0x1f4){_0x4c6779['status'](_0x4402f8)[_0xf102('0x23')](_0x21475b);}else{_0x4c6779[_0xf102('0xb')](_0x4402f8)['json'](_0x21475b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 48a6742..d57d6da 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 _0xbfad=['hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xcd0079,_0x3d1dbe){var _0x1e84c3=function(_0x41e44d){while(--_0x41e44d){_0xcd0079['push'](_0xcd0079['shift']());}};_0x1e84c3(++_0x3d1dbe);}(_0xbfad,0xd4));var _0xdbfa=function(_0x25c11d,_0xbf7375){_0x25c11d=_0x25c11d-0x0;var _0x2cddb8=_0xbfad[_0x25c11d];return _0x2cddb8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xdbfa('0x0'))['db'][_0xdbfa('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdbfa('0x2')](0x0);var events={'afterCreate':_0xdbfa('0x3'),'afterUpdate':_0xdbfa('0x4'),'afterDestroy':_0xdbfa('0x5')};function emitEvent(_0x54cec7){return function(_0x3ef879,_0x7544da,_0xd206b3){VoiceExtensionEvents['emit'](_0x54cec7+':'+_0x3ef879['id'],_0x3ef879);VoiceExtensionEvents[_0xdbfa('0x6')](_0x54cec7,_0x3ef879);_0xd206b3(null);};}for(var e in events){if(events[_0xdbfa('0x7')](e)){var event=events[e];VoiceExtension[_0xdbfa('0x8')](e,emitEvent(event));}}module[_0xdbfa('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6646=['update','emit','hook','exports','VoiceExtension','setMaxListeners','save'];(function(_0x488532,_0x3fa64d){var _0x1c932c=function(_0x131e34){while(--_0x131e34){_0x488532['push'](_0x488532['shift']());}};_0x1c932c(++_0x3fa64d);}(_0x6646,0x100));var _0x6664=function(_0x2b4c49,_0x5a3e8a){_0x2b4c49=_0x2b4c49-0x0;var _0x18b246=_0x6646[_0x2b4c49];return _0x18b246;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x6664('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6664('0x1')](0x0);var events={'afterCreate':_0x6664('0x2'),'afterUpdate':_0x6664('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7460){return function(_0x22aea5,_0x4242df,_0x28e26f){VoiceExtensionEvents[_0x6664('0x4')](_0x4c7460+':'+_0x22aea5['id'],_0x22aea5);VoiceExtensionEvents['emit'](_0x4c7460,_0x22aea5);_0x28e26f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6664('0x5')](e,emitEvent(event));}}module[_0x6664('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f5a58fd..bb8f102 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 _0xac95=['lodash','./voiceExtension.attributes','exports','type','CDR(type)=','context','alias','Set','NoOp','CDR(routeAlias)=','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','${EXTEN}','join','none','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','interval','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup'];(function(_0x48671c,_0x2b44a3){var _0x32d5e5=function(_0x3a21ac){while(--_0x3a21ac){_0x48671c['push'](_0x48671c['shift']());}};_0x32d5e5(++_0x2b44a3);}(_0xac95,0xa8));var _0x5ac9=function(_0x5c534f,_0x23a4a8){_0x5c534f=_0x5c534f-0x0;var _0xe414e1=_0xac95[_0x5c534f];return _0xe414e1;};'use strict';var _=require(_0x5ac9('0x0'));var attributes=require(_0x5ac9('0x1'));module[_0x5ac9('0x2')]=function(_0x471ff6){var _0x4c14a3=_0x471ff6['models'];function _0x4562f2(_0x1ebdea){var _0x550511=0x2;var _0xafa08d=[{'type':_0x1ebdea[_0x5ac9('0x3')],'app':'Set','appdata':_0x5ac9('0x4')+_0x1ebdea[_0x5ac9('0x3')],'context':_0x1ebdea[_0x5ac9('0x5')],'exten':_0x1ebdea['exten'],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']},{'type':_0x1ebdea['type'],'app':_0x1ebdea[_0x5ac9('0x6')]?_0x5ac9('0x7'):_0x5ac9('0x8'),'appdata':_0x1ebdea[_0x5ac9('0x6')]?_0x5ac9('0x9')+_0x1ebdea[_0x5ac9('0x6')]:'No\x20alias\x20set','context':_0x1ebdea[_0x5ac9('0x5')],'exten':_0x1ebdea[_0x5ac9('0xa')],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']}];if(_0x1ebdea['type']===_0x5ac9('0xb')){_0xafa08d['push']({'type':_0x5ac9('0xb'),'app':'Set','appdata':_0x5ac9('0xc')+_0x1ebdea['id'],'context':_0x1ebdea[_0x5ac9('0x5')],'exten':_0x1ebdea[_0x5ac9('0xa')],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']});}_0xafa08d[_0x5ac9('0xd')]({'type':_0x1ebdea['type'],'app':'Set','appdata':_0x5ac9('0xe'),'context':_0x1ebdea['context'],'exten':_0x1ebdea[_0x5ac9('0xa')],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']},{'type':_0x1ebdea[_0x5ac9('0x3')],'app':'Set','appdata':_0x5ac9('0xf'),'context':_0x1ebdea[_0x5ac9('0x5')],'exten':_0x1ebdea[_0x5ac9('0xa')],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']},{'type':_0x1ebdea[_0x5ac9('0x3')],'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x10'),'context':_0x1ebdea[_0x5ac9('0x5')],'exten':_0x1ebdea[_0x5ac9('0xa')],'priority':_0x550511++,'VoiceExtensionId':_0x1ebdea['id']});return _0xafa08d;}function _0x460fd7(_0x53163b){var _0x53a8db=0x2;var _0x352874=[{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x12'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x53163b[_0x5ac9('0x6')]?_0x5ac9('0x7'):_0x5ac9('0x8'),'appdata':_0x53163b[_0x5ac9('0x6')]?_0x5ac9('0x9')+_0x53163b[_0x5ac9('0x6')]:'No\x20alias\x20set','context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x13')+(_0x53163b['cutdigits']?_0x5ac9('0x14')+_0x53163b[_0x5ac9('0x15')]+'}':'${EXTEN}'),'context':_0x53163b['context'],'exten':_0x53163b['exten'],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':'CDR(routeid)='+_0x53163b['id'],'context':_0x53163b['context'],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':'outbound','app':'ExecIf','appdata':_0x5ac9('0x16')+(_0x53a8db+0x2)+'):Goto('+(_0x53a8db+0x1)+')','context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':_0x53163b[_0x5ac9('0x15')]?_0x5ac9('0x17')+_0x53163b[_0x5ac9('0x15')]+'}':_0x5ac9('0x18'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b['exten'],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0xe'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':'outbound','app':'Set','appdata':_0x5ac9('0xf'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b['exten'],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':'Set','appdata':_0x5ac9('0x10'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':'outbound','app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x19')+_0x53163b['id'],'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']}];if(_0x53163b[_0x5ac9('0x1a')](_0x5ac9('0x1b'))&&_0x53163b['recordingFormat']!=='none'){_0x352874[_0x5ac9('0xd')]({'type':'outbound','app':'Set','appdata':_0x5ac9('0x1c'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b[_0x5ac9('0xa')],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']},{'type':_0x5ac9('0x11'),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x1d')+_0x53163b[_0x5ac9('0x1b')]||_0x5ac9('0x1e'),'context':_0x53163b[_0x5ac9('0x5')],'exten':_0x53163b['exten'],'priority':_0x53a8db++,'VoiceExtensionId':_0x53163b['id']});}return _0x352874;}function _0x317823(_0x3c14f9,_0x535f20){var _0x598093=[{'name':_0x5ac9('0x1f'),'param':0x0},{'name':_0x5ac9('0x20'),'param':0x1},{'name':_0x5ac9('0x21'),'param':0x2},{'name':_0x5ac9('0x22'),'param':0x3}];var _0x5be935={};var _0x848f6d=_0x535f20['split'](',');var _0x3c540f=[];for(var _0x4600d8=0x0;_0x4600d8<_0x598093[_0x5ac9('0x23')];_0x4600d8++){switch(_0x598093[_0x4600d8][_0x5ac9('0x24')]){case _0x5ac9('0x1f'):_0x5be935[_0x5ac9('0x1f')]=_0x848f6d[_0x598093[_0x4600d8][_0x5ac9('0x25')]][_0x5ac9('0x26')]('/')[0x1];_0x5be935[_0x5ac9('0x27')]=_0x848f6d[_0x598093[_0x4600d8][_0x5ac9('0x25')]][_0x5ac9('0x26')]('/')[0x2];_0x5be935[_0x5ac9('0x28')]=_0x5be935['phone']?_0x5be935['phone'][_0x5ac9('0x26')]('$')[0x0]:undefined;_0x5be935[_0x5ac9('0x27')]=_0x3c14f9[_0x5ac9('0x15')]?(_0x5be935[_0x5ac9('0x28')]||'')+_0x5ac9('0x14')+_0x3c14f9[_0x5ac9('0x15')]+'}':(_0x5be935['prefix']||'')+_0x5ac9('0x29');_0x3c540f[_0x598093[_0x4600d8][_0x5ac9('0x25')]]=['SIP',_0x5be935['trunk'],_0x5be935['phone']][_0x5ac9('0x2a')]('/');break;case _0x5ac9('0x21'):_0x5be935[_0x5ac9('0x21')]=_0x848f6d[_0x598093[_0x4600d8][_0x5ac9('0x25')]];if(_0x3c14f9['recordingFormat']!==_0x5ac9('0x2b')){if(_0x5be935['options']['indexOf'](_0x5ac9('0x2c'))<0x0){_0x5be935[_0x5ac9('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x5be935[_0x5ac9('0x21')]=_0x5be935[_0x5ac9('0x21')]['replace'](_0x5ac9('0x2c'),'');}_0x3c540f[_0x598093[_0x4600d8][_0x5ac9('0x25')]]=_0x5be935[_0x5ac9('0x21')];break;default:_0x3c540f[_0x598093[_0x4600d8][_0x5ac9('0x25')]]=_0x848f6d[_0x598093[_0x4600d8][_0x5ac9('0x25')]];}}return _0x3c540f[_0x5ac9('0x2a')](',');}function _0x16b81d(_0x31975b,_0x2aac63,_0x2a3564){return new Promise(function(_0x26ccaa,_0x4cb50f){var _0x54e330=[];if(_[_0x5ac9('0x2d')](_0x2aac63))return _0x26ccaa(_0x54e330);_0x4c14a3[_0x5ac9('0x2e')][_0x5ac9('0x2f')]({'attributes':['id','interval',_0x5ac9('0x30')],'raw':!![]})[_0x5ac9('0x31')](function(_0x3b6aad){for(var _0x5adbed=0x0,_0x21f75a=0x0;_0x5adbed<_0x2aac63[_0x5ac9('0x23')];_0x5adbed++,_0x21f75a=0x0){var _0x3bf4ba=_0x2aac63[_0x5adbed];var _0x34b3c2=[];var _0x7e6a4f=[];delete _0x3bf4ba['id'];if(_0x3bf4ba[_0x5ac9('0x32')]!=='*,*,*,*'){_0x3bf4ba['intervals']=[_0x3bf4ba[_0x5ac9('0x32')]];}else{_0x3bf4ba['intervals']=_0x3bf4ba[_0x5ac9('0x30')]?_['map'](_[_0x5ac9('0x33')](_0x3b6aad,{'IntervalId':_0x3bf4ba[_0x5ac9('0x30')]}),_0x5ac9('0x32')):[];}_0x3bf4ba[_0x5ac9('0x5')]=_0x31975b[_0x5ac9('0x5')];_0x3bf4ba[_0x5ac9('0xa')]=_0x31975b[_0x5ac9('0xa')];if(_0x3bf4ba[_0x5ac9('0x3')])_0x3bf4ba[_0x5ac9('0x3')]=_0x3bf4ba[_0x5ac9('0x3')][_0x5ac9('0x34')]();if(_0x31975b['type']===_0x5ac9('0x11')){if(_0x3bf4ba[_0x5ac9('0x1a')]('tag')&&_0x3bf4ba['tag']&&_0x3bf4ba[_0x5ac9('0x35')]!=='--'){_0x34b3c2[_0x5ac9('0xd')]({'type':_0x3bf4ba[_0x5ac9('0x3')]['toLowerCase'](),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x36')+_0x3bf4ba[_0x5ac9('0x35')],'context':_0x31975b[_0x5ac9('0x5')],'exten':_0x31975b[_0x5ac9('0xa')],'priority':_0x3bf4ba[_0x5ac9('0x37')]['length']+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});}_0x34b3c2['push']({'type':_0x3bf4ba[_0x5ac9('0x3')][_0x5ac9('0x34')](),'app':'ExecIf','appdata':_0x5ac9('0x38')+(_0x3bf4ba[_0x5ac9('0x39')]?_0x5ac9('0x3a')+_0x3bf4ba[_0x5ac9('0x39')]+')':_0x5ac9('0x3b')),'context':_0x31975b['context'],'exten':_0x31975b[_0x5ac9('0xa')],'priority':_0x3bf4ba[_0x5ac9('0x37')][_0x5ac9('0x23')]+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});}else{if(_0x3bf4ba['hasOwnProperty'](_0x5ac9('0x3c'))){if([_0x5ac9('0x3d'),_0x5ac9('0x3e')][_0x5ac9('0x3f')](_0x3bf4ba[_0x5ac9('0x40')]['toLowerCase']())&&_0x3bf4ba['appType']!==_0x5ac9('0x41')){if(_0x3bf4ba['answer']){_0x34b3c2[_0x5ac9('0xd')]({'type':_0x3bf4ba['type'][_0x5ac9('0x34')](),'app':'ExecIf','appdata':_0x5ac9('0x42'),'context':_0x31975b[_0x5ac9('0x5')],'exten':_0x31975b['exten'],'priority':_0x3bf4ba['intervals'][_0x5ac9('0x23')]+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});_0x34b3c2[_0x5ac9('0xd')]({'type':_0x3bf4ba[_0x5ac9('0x3')][_0x5ac9('0x34')](),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x43'),'context':_0x31975b[_0x5ac9('0x5')],'exten':_0x31975b[_0x5ac9('0xa')],'priority':_0x3bf4ba['intervals'][_0x5ac9('0x23')]+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});}else{_0x34b3c2['push']({'type':_0x3bf4ba[_0x5ac9('0x3')][_0x5ac9('0x34')](),'app':'ExecIf','appdata':_0x5ac9('0x44'),'context':_0x31975b['context'],'exten':_0x31975b[_0x5ac9('0xa')],'priority':_0x3bf4ba[_0x5ac9('0x37')][_0x5ac9('0x23')]+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});_0x34b3c2[_0x5ac9('0xd')]({'type':_0x3bf4ba[_0x5ac9('0x3')]['toLowerCase'](),'app':_0x5ac9('0x7'),'appdata':_0x5ac9('0x45'),'context':_0x31975b[_0x5ac9('0x5')],'exten':_0x31975b['exten'],'priority':_0x3bf4ba[_0x5ac9('0x37')][_0x5ac9('0x23')]+_0x2a3564+_0x21f75a++,'VoiceExtensionId':_0x31975b['id']});}}}}for(var _0x3c45c8=0x0;_0x3c45c8<_0x3bf4ba['intervals'][_0x5ac9('0x23')];_0x3c45c8++){var _0x577f83=_0x2a3564+_0x3bf4ba[_0x5ac9('0x37')][_0x5ac9('0x23')];var _0x567fb1=_0x3c45c8===_0x3bf4ba['intervals'][_0x5ac9('0x23')]-0x1?_0x2a3564+_0x34b3c2[_0x5ac9('0x23')]+_0x7e6a4f[_0x5ac9('0x23')]+0x2:_0x2a3564+_0x3c45c8+0x1;_0x34b3c2[_0x5ac9('0x46')](_0x3c45c8,0x0,{'type':_0x31975b[_0x5ac9('0x3')],'app':_0x5ac9('0x47'),'appdata':_0x3bf4ba[_0x5ac9('0x37')][_0x3c45c8]+'?'+_0x31975b[_0x5ac9('0x5')]+',${EXTEN},'+_0x577f83+':'+_0x31975b[_0x5ac9('0x5')]+_0x5ac9('0x48')+_0x567fb1,'exten':_0x31975b['exten'],'context':_0x31975b['context'],'priority':_0x2a3564+_0x3c45c8,'VoiceExtensionId':_0x31975b['id']});}if(_0x3bf4ba[_0x5ac9('0x49')]===_0x5ac9('0x4a'))_0x3bf4ba['appdata']=_0x317823(_0x31975b,_0x3bf4ba[_0x5ac9('0x4b')]);_0x3bf4ba[_0x5ac9('0x4c')]=_0x34b3c2[_0x5ac9('0x23')]?_[_0x5ac9('0x4d')](_0x34b3c2)[_0x5ac9('0x4c')]+0x1:_0x2a3564;_0x54e330=_[_0x5ac9('0x4e')](_0x54e330,_0x34b3c2,[_0x3bf4ba],_0x7e6a4f);_0x2a3564=_[_0x5ac9('0x4d')](_0x54e330)[_0x5ac9('0x4c')]+0x1;}return _0x26ccaa(_0x54e330);})[_0x5ac9('0x4f')](function(_0xbf938e){_0x4cb50f(_0xbf938e);});});}return _0x471ff6[_0x5ac9('0x50')](_0x5ac9('0x51'),attributes,{'tableName':_0x5ac9('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xc966db){var _0x3b5233=this['get']({'plain':!![]});var _0x1c18d9=_0x3b5233['type']===_0x5ac9('0x11')?_0x460fd7(_0x3b5233):_0x4562f2(_0x3b5233);return _0x16b81d(_0x3b5233,_0xc966db,_[_0x5ac9('0x4d')](_0x1c18d9)[_0x5ac9('0x4c')]+0x1)['then'](function(_0x59354e){var _0x7eb14b=_[_0x5ac9('0x4e')](_0x1c18d9,_0x59354e);_0x7eb14b[_0x5ac9('0xd')]({'type':_0x3b5233['type'],'app':_0x5ac9('0x53'),'exten':_0x3b5233[_0x5ac9('0xa')],'context':_0x3b5233['context'],'priority':_['last'](_0x7eb14b)[_0x5ac9('0x4c')]+0x1,'VoiceExtensionId':_0x3b5233['id']});return _0x7eb14b;});}}});}; \ No newline at end of file +var _0xcb66=['playback','includes','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','get','then','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','outbound','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue'];(function(_0x483bfa,_0x5421ff){var _0x486e43=function(_0x2b71a5){while(--_0x2b71a5){_0x483bfa['push'](_0x483bfa['shift']());}};_0x486e43(++_0x5421ff);}(_0xcb66,0x19f));var _0x6cb6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xcb66[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var attributes=require(_0x6cb6('0x0'));module[_0x6cb6('0x1')]=function(_0x1066ea){var _0x3f607b=_0x1066ea[_0x6cb6('0x2')];function _0x56618a(_0xe996ed){var _0x2d7dbb=0x2;var _0x24660c=[{'type':_0xe996ed[_0x6cb6('0x3')],'app':_0x6cb6('0x4'),'appdata':'CDR(type)='+_0xe996ed['type'],'context':_0xe996ed[_0x6cb6('0x5')],'exten':_0xe996ed[_0x6cb6('0x6')],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']},{'type':_0xe996ed[_0x6cb6('0x3')],'app':_0xe996ed[_0x6cb6('0x7')]?_0x6cb6('0x4'):_0x6cb6('0x8'),'appdata':_0xe996ed[_0x6cb6('0x7')]?_0x6cb6('0x9')+_0xe996ed[_0x6cb6('0x7')]:_0x6cb6('0xa'),'context':_0xe996ed[_0x6cb6('0x5')],'exten':_0xe996ed[_0x6cb6('0x6')],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']}];if(_0xe996ed[_0x6cb6('0x3')]==='inbound'){_0x24660c['push']({'type':'inbound','app':'Set','appdata':_0x6cb6('0xb')+_0xe996ed['id'],'context':_0xe996ed[_0x6cb6('0x5')],'exten':_0xe996ed[_0x6cb6('0x6')],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']});}_0x24660c[_0x6cb6('0xc')]({'type':_0xe996ed['type'],'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0xd'),'context':_0xe996ed['context'],'exten':_0xe996ed[_0x6cb6('0x6')],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']},{'type':_0xe996ed[_0x6cb6('0x3')],'app':'Set','appdata':_0x6cb6('0xe'),'context':_0xe996ed[_0x6cb6('0x5')],'exten':_0xe996ed['exten'],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']},{'type':_0xe996ed['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xe996ed[_0x6cb6('0x5')],'exten':_0xe996ed[_0x6cb6('0x6')],'priority':_0x2d7dbb++,'VoiceExtensionId':_0xe996ed['id']});return _0x24660c;}function _0x9c901a(_0x43a9c4){var _0x432e48=0x2;var _0x40d445=[{'type':'outbound','app':_0x6cb6('0x4'),'appdata':_0x6cb6('0xf'),'context':_0x43a9c4['context'],'exten':_0x43a9c4['exten'],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':'outbound','app':_0x43a9c4['alias']?'Set':'NoOp','appdata':_0x43a9c4[_0x6cb6('0x7')]?_0x6cb6('0x9')+_0x43a9c4[_0x6cb6('0x7')]:_0x6cb6('0xa'),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4['exten'],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':'outbound','app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x10')+(_0x43a9c4[_0x6cb6('0x11')]?_0x6cb6('0x12')+_0x43a9c4['cutdigits']+'}':_0x6cb6('0x13')),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4['exten'],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':'outbound','app':_0x6cb6('0x4'),'appdata':'CDR(routeid)='+_0x43a9c4['id'],'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':_0x6cb6('0x14'),'app':_0x6cb6('0x15'),'appdata':_0x6cb6('0x16')+(_0x432e48+0x2)+_0x6cb6('0x17')+(_0x432e48+0x1)+')','context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':_0x6cb6('0x14'),'app':_0x6cb6('0x4'),'appdata':_0x43a9c4['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x43a9c4['cutdigits']+'}':_0x6cb6('0x18'),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':_0x6cb6('0x14'),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0xd'),'context':_0x43a9c4['context'],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':'outbound','app':_0x6cb6('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':_0x6cb6('0x14'),'app':'Set','appdata':_0x6cb6('0x19'),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':'outbound','app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x1a')+_0x43a9c4['id'],'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4['exten'],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']}];if(_0x43a9c4[_0x6cb6('0x1b')](_0x6cb6('0x1c'))&&_0x43a9c4['recordingFormat']!==_0x6cb6('0x1d')){_0x40d445[_0x6cb6('0xc')]({'type':_0x6cb6('0x14'),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x1e'),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']},{'type':_0x6cb6('0x14'),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x1f')+_0x43a9c4['recordingFormat']||_0x6cb6('0x20'),'context':_0x43a9c4[_0x6cb6('0x5')],'exten':_0x43a9c4[_0x6cb6('0x6')],'priority':_0x432e48++,'VoiceExtensionId':_0x43a9c4['id']});}return _0x40d445;}function _0x2f7c65(_0x586cf9,_0x558494){var _0x59dd76=[{'name':_0x6cb6('0x21'),'param':0x0},{'name':_0x6cb6('0x22'),'param':0x1},{'name':_0x6cb6('0x23'),'param':0x2},{'name':_0x6cb6('0x24'),'param':0x3}];var _0x1dfca9={};var _0xa9f21b=_0x558494[_0x6cb6('0x25')](',');var _0x950248=[];for(var _0x4bbecb=0x0;_0x4bbecb<_0x59dd76[_0x6cb6('0x26')];_0x4bbecb++){switch(_0x59dd76[_0x4bbecb]['name']){case _0x6cb6('0x21'):_0x1dfca9[_0x6cb6('0x21')]=_0xa9f21b[_0x59dd76[_0x4bbecb][_0x6cb6('0x27')]][_0x6cb6('0x25')]('/')[0x1];_0x1dfca9[_0x6cb6('0x28')]=_0xa9f21b[_0x59dd76[_0x4bbecb][_0x6cb6('0x27')]][_0x6cb6('0x25')]('/')[0x2];_0x1dfca9['prefix']=_0x1dfca9[_0x6cb6('0x28')]?_0x1dfca9['phone'][_0x6cb6('0x25')]('$')[0x0]:undefined;_0x1dfca9[_0x6cb6('0x28')]=_0x586cf9[_0x6cb6('0x11')]?(_0x1dfca9['prefix']||'')+'${EXTEN:'+_0x586cf9[_0x6cb6('0x11')]+'}':(_0x1dfca9['prefix']||'')+_0x6cb6('0x13');_0x950248[_0x59dd76[_0x4bbecb][_0x6cb6('0x27')]]=[_0x6cb6('0x29'),_0x1dfca9[_0x6cb6('0x21')],_0x1dfca9[_0x6cb6('0x28')]][_0x6cb6('0x2a')]('/');break;case _0x6cb6('0x23'):_0x1dfca9['options']=_0xa9f21b[_0x59dd76[_0x4bbecb][_0x6cb6('0x27')]];if(_0x586cf9[_0x6cb6('0x1c')]!=='none'){if(_0x1dfca9[_0x6cb6('0x23')][_0x6cb6('0x2b')](_0x6cb6('0x2c'))<0x0){_0x1dfca9[_0x6cb6('0x23')]+=_0x6cb6('0x2c');}}else{_0x1dfca9[_0x6cb6('0x23')]=_0x1dfca9['options']['replace'](_0x6cb6('0x2c'),'');}_0x950248[_0x59dd76[_0x4bbecb]['param']]=_0x1dfca9['options'];break;default:_0x950248[_0x59dd76[_0x4bbecb][_0x6cb6('0x27')]]=_0xa9f21b[_0x59dd76[_0x4bbecb]['param']];}}return _0x950248[_0x6cb6('0x2a')](',');}function _0x7bd70d(_0x49a749,_0x5904df,_0x2978af){return new Promise(function(_0x5e628f,_0x2aa2a9){var _0x392a73=[];if(_['isEmpty'](_0x5904df))return _0x5e628f(_0x392a73);_0x3f607b[_0x6cb6('0x2d')][_0x6cb6('0x2e')]({'attributes':['id','interval',_0x6cb6('0x2f')],'raw':!![]})['then'](function(_0x111046){for(var _0x12adad=0x0,_0x5b9d1d=0x0;_0x12adad<_0x5904df[_0x6cb6('0x26')];_0x12adad++,_0x5b9d1d=0x0){var _0x2fc403=_0x5904df[_0x12adad];var _0x591438=[];var _0x5e1492=[];delete _0x2fc403['id'];if(_0x2fc403[_0x6cb6('0x30')]!==_0x6cb6('0x31')){_0x2fc403[_0x6cb6('0x32')]=[_0x2fc403['interval']];}else{_0x2fc403[_0x6cb6('0x32')]=_0x2fc403[_0x6cb6('0x2f')]?_['map'](_[_0x6cb6('0x33')](_0x111046,{'IntervalId':_0x2fc403[_0x6cb6('0x2f')]}),_0x6cb6('0x30')):[];}_0x2fc403['context']=_0x49a749[_0x6cb6('0x5')];_0x2fc403[_0x6cb6('0x6')]=_0x49a749[_0x6cb6('0x6')];if(_0x2fc403[_0x6cb6('0x3')])_0x2fc403[_0x6cb6('0x3')]=_0x2fc403[_0x6cb6('0x3')]['toLowerCase']();if(_0x49a749[_0x6cb6('0x3')]==='outbound'){if(_0x2fc403['hasOwnProperty'](_0x6cb6('0x34'))&&_0x2fc403[_0x6cb6('0x34')]&&_0x2fc403['tag']!=='--'){_0x591438[_0x6cb6('0xc')]({'type':_0x2fc403['type'][_0x6cb6('0x35')](),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x36')+_0x2fc403['tag'],'context':_0x49a749[_0x6cb6('0x5')],'exten':_0x49a749[_0x6cb6('0x6')],'priority':_0x2fc403[_0x6cb6('0x32')]['length']+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});}_0x591438[_0x6cb6('0xc')]({'type':_0x2fc403['type'][_0x6cb6('0x35')](),'app':_0x6cb6('0x15'),'appdata':_0x6cb6('0x37')+(_0x2fc403['callerID']?'Set(CALLERID(all)='+_0x2fc403[_0x6cb6('0x38')]+')':_0x6cb6('0x39')),'context':_0x49a749[_0x6cb6('0x5')],'exten':_0x49a749['exten'],'priority':_0x2fc403[_0x6cb6('0x32')][_0x6cb6('0x26')]+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});}else{if(_0x2fc403[_0x6cb6('0x1b')]('answer')){if([_0x6cb6('0x3a'),_0x6cb6('0x3b')][_0x6cb6('0x3c')](_0x2fc403['app'][_0x6cb6('0x35')]())&&_0x2fc403[_0x6cb6('0x3d')]!==_0x6cb6('0x3e')){if(_0x2fc403[_0x6cb6('0x3f')]){_0x591438[_0x6cb6('0xc')]({'type':_0x2fc403[_0x6cb6('0x3')][_0x6cb6('0x35')](),'app':_0x6cb6('0x15'),'appdata':_0x6cb6('0x40'),'context':_0x49a749[_0x6cb6('0x5')],'exten':_0x49a749[_0x6cb6('0x6')],'priority':_0x2fc403[_0x6cb6('0x32')]['length']+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});_0x591438[_0x6cb6('0xc')]({'type':_0x2fc403[_0x6cb6('0x3')]['toLowerCase'](),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x41'),'context':_0x49a749['context'],'exten':_0x49a749[_0x6cb6('0x6')],'priority':_0x2fc403[_0x6cb6('0x32')][_0x6cb6('0x26')]+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});}else{_0x591438['push']({'type':_0x2fc403[_0x6cb6('0x3')][_0x6cb6('0x35')](),'app':_0x6cb6('0x15'),'appdata':_0x6cb6('0x42'),'context':_0x49a749[_0x6cb6('0x5')],'exten':_0x49a749[_0x6cb6('0x6')],'priority':_0x2fc403[_0x6cb6('0x32')][_0x6cb6('0x26')]+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});_0x591438[_0x6cb6('0xc')]({'type':_0x2fc403[_0x6cb6('0x3')]['toLowerCase'](),'app':_0x6cb6('0x4'),'appdata':_0x6cb6('0x43'),'context':_0x49a749['context'],'exten':_0x49a749[_0x6cb6('0x6')],'priority':_0x2fc403['intervals']['length']+_0x2978af+_0x5b9d1d++,'VoiceExtensionId':_0x49a749['id']});}}}}for(var _0x3844a9=0x0;_0x3844a9<_0x2fc403[_0x6cb6('0x32')][_0x6cb6('0x26')];_0x3844a9++){var _0x34ccd7=_0x2978af+_0x2fc403[_0x6cb6('0x32')]['length'];var _0x217165=_0x3844a9===_0x2fc403[_0x6cb6('0x32')]['length']-0x1?_0x2978af+_0x591438[_0x6cb6('0x26')]+_0x5e1492[_0x6cb6('0x26')]+0x2:_0x2978af+_0x3844a9+0x1;_0x591438[_0x6cb6('0x44')](_0x3844a9,0x0,{'type':_0x49a749['type'],'app':_0x6cb6('0x45'),'appdata':_0x2fc403[_0x6cb6('0x32')][_0x3844a9]+'?'+_0x49a749[_0x6cb6('0x5')]+_0x6cb6('0x46')+_0x34ccd7+':'+_0x49a749[_0x6cb6('0x5')]+',${EXTEN},'+_0x217165,'exten':_0x49a749[_0x6cb6('0x6')],'context':_0x49a749['context'],'priority':_0x2978af+_0x3844a9,'VoiceExtensionId':_0x49a749['id']});}if(_0x2fc403[_0x6cb6('0x3d')]==='outboundDial')_0x2fc403[_0x6cb6('0x47')]=_0x2f7c65(_0x49a749,_0x2fc403[_0x6cb6('0x47')]);_0x2fc403[_0x6cb6('0x48')]=_0x591438[_0x6cb6('0x26')]?_[_0x6cb6('0x49')](_0x591438)['priority']+0x1:_0x2978af;_0x392a73=_[_0x6cb6('0x4a')](_0x392a73,_0x591438,[_0x2fc403],_0x5e1492);_0x2978af=_[_0x6cb6('0x49')](_0x392a73)[_0x6cb6('0x48')]+0x1;}return _0x5e628f(_0x392a73);})[_0x6cb6('0x4b')](function(_0x4bb60e){_0x2aa2a9(_0x4bb60e);});});}return _0x1066ea[_0x6cb6('0x4c')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x6f01c2){var _0x1aec61=this[_0x6cb6('0x4d')]({'plain':!![]});var _0x5280aa=_0x1aec61[_0x6cb6('0x3')]===_0x6cb6('0x14')?_0x9c901a(_0x1aec61):_0x56618a(_0x1aec61);return _0x7bd70d(_0x1aec61,_0x6f01c2,_[_0x6cb6('0x49')](_0x5280aa)['priority']+0x1)[_0x6cb6('0x4e')](function(_0x2fdfd2){var _0xbed0fe=_[_0x6cb6('0x4a')](_0x5280aa,_0x2fdfd2);_0xbed0fe['push']({'type':_0x1aec61[_0x6cb6('0x3')],'app':'Hangup','exten':_0x1aec61[_0x6cb6('0x6')],'context':_0x1aec61[_0x6cb6('0x5')],'priority':_[_0x6cb6('0x49')](_0xbed0fe)['priority']+0x1,'VoiceExtensionId':_0x1aec61['id']});return _0xbed0fe;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2c69a3b..14051d6 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 _0x3cd8=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension','options','raw','where','include','model','attributes','map','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x2d8bb6,_0x950991){var _0xf7aad3=function(_0x53ea1d){while(--_0x53ea1d){_0x2d8bb6['push'](_0x2d8bb6['shift']());}};_0xf7aad3(++_0x950991);}(_0x3cd8,0x150));var _0x83cd=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x3cd8[_0x1b4002];return _0x1716f3;};'use strict';var _=require(_0x83cd('0x0'));var util=require(_0x83cd('0x1'));var moment=require(_0x83cd('0x2'));var BPromise=require(_0x83cd('0x3'));var rs=require(_0x83cd('0x4'));var fs=require('fs');var Redis=require(_0x83cd('0x5'));var db=require(_0x83cd('0x6'))['db'];var utils=require(_0x83cd('0x7'));var logger=require('../../config/logger')(_0x83cd('0x8'));var config=require(_0x83cd('0x9'));var jayson=require(_0x83cd('0xa'));var client=jayson[_0x83cd('0xb')][_0x83cd('0xc')]({'port':0x232a});config[_0x83cd('0xd')]=_[_0x83cd('0xe')](config[_0x83cd('0xd')],{'host':_0x83cd('0xf'),'port':0x18eb});var socket=require(_0x83cd('0x10'))(new Redis(config[_0x83cd('0xd')]));require(_0x83cd('0x11'))[_0x83cd('0x12')](socket);function respondWithRpcPromise(_0x2d4adb,_0x39b755,_0xf8f9dd){return new BPromise(function(_0x1f05f1,_0x26b989){return client[_0x83cd('0x13')](_0x2d4adb,_0xf8f9dd)[_0x83cd('0x14')](function(_0x49626a){logger[_0x83cd('0x15')](_0x83cd('0x16'),_0x39b755,_0x83cd('0x17'));logger[_0x83cd('0x18')](_0x83cd('0x19'),_0x39b755,_0x83cd('0x17'),JSON[_0x83cd('0x1a')](_0x49626a));if(_0x49626a[_0x83cd('0x1b')]){if(_0x49626a['error'][_0x83cd('0x1c')]===0x1f4){logger[_0x83cd('0x1b')](_0x83cd('0x16'),_0x39b755,_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);return _0x26b989(_0x49626a[_0x83cd('0x1b')]['message']);}logger['error'](_0x83cd('0x16'),_0x39b755,_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);return _0x1f05f1(_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);}else{logger[_0x83cd('0x15')](_0x83cd('0x16'),_0x39b755,_0x83cd('0x17'));_0x1f05f1(_0x49626a['result'][_0x83cd('0x1d')]);}})['catch'](function(_0x3fe83a){logger[_0x83cd('0x1b')](_0x83cd('0x16'),_0x39b755,_0x3fe83a);_0x26b989(_0x3fe83a);});});}exports['GetVoiceExtension']=function(_0x4c84d3){var _0x2819d6=this;return new Promise(function(_0x50e044,_0x2748ba){return db[_0x83cd('0x1e')]['findAll']({'raw':_0x4c84d3[_0x83cd('0x1f')]?_0x4c84d3[_0x83cd('0x1f')][_0x83cd('0x20')]===undefined?!![]:![]:!![],'where':_0x4c84d3[_0x83cd('0x1f')]?_0x4c84d3[_0x83cd('0x1f')][_0x83cd('0x21')]||null:null,'attributes':_0x4c84d3[_0x83cd('0x1f')]?_0x4c84d3[_0x83cd('0x1f')]['attributes']||null:null,'limit':_0x4c84d3['options']?_0x4c84d3[_0x83cd('0x1f')]['limit']||null:null,'include':_0x4c84d3[_0x83cd('0x1f')]?_0x4c84d3[_0x83cd('0x1f')][_0x83cd('0x22')]?_['map'](_0x4c84d3[_0x83cd('0x1f')][_0x83cd('0x22')],function(_0x3558fa){return{'model':db[_0x3558fa[_0x83cd('0x23')]],'as':_0x3558fa['as'],'attributes':_0x3558fa[_0x83cd('0x24')],'include':_0x3558fa[_0x83cd('0x22')]?_[_0x83cd('0x25')](_0x3558fa[_0x83cd('0x22')],function(_0x5a9899){return{'model':db[_0x5a9899[_0x83cd('0x23')]],'as':_0x5a9899['as'],'attributes':_0x5a9899[_0x83cd('0x24')],'include':_0x5a9899[_0x83cd('0x22')]?_[_0x83cd('0x25')](_0x5a9899[_0x83cd('0x22')],function(_0x9dbb16){return{'model':db[_0x9dbb16[_0x83cd('0x23')]],'as':_0x9dbb16['as'],'attributes':_0x9dbb16[_0x83cd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x83cd('0x14')](function(_0x1edfd3){logger[_0x83cd('0x15')]('GetVoiceExtension',_0x4c84d3);logger[_0x83cd('0x18')](_0x83cd('0x26'),_0x4c84d3,JSON['stringify'](_0x1edfd3));_0x50e044(_0x1edfd3);})[_0x83cd('0x27')](function(_0xbedd59){logger['error']('GetVoiceExtension',_0xbedd59['message'],_0x4c84d3);_0x2748ba(_0x2819d6[_0x83cd('0x1b')](0x1f4,_0xbedd59[_0x83cd('0x1d')]));});});}; \ No newline at end of file +var _0x2706=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','request\x20sent','debug','error','code','message','info','VoiceExtension,\x20%s,\x20%s','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','stringify','catch','util','moment','bluebird'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x2706,0x107));var _0x6270=function(_0x3d0975,_0x198b9f){_0x3d0975=_0x3d0975-0x0;var _0x33b959=_0x2706[_0x3d0975];return _0x33b959;};'use strict';var _=require('lodash');var util=require(_0x6270('0x0'));var moment=require(_0x6270('0x1'));var BPromise=require(_0x6270('0x2'));var rs=require(_0x6270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6270('0x4'))['db'];var utils=require(_0x6270('0x5'));var logger=require(_0x6270('0x6'))(_0x6270('0x7'));var config=require(_0x6270('0x8'));var jayson=require(_0x6270('0x9'));var client=jayson[_0x6270('0xa')][_0x6270('0xb')]({'port':0x232a});config['redis']=_[_0x6270('0xc')](config[_0x6270('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6270('0xe'))(new Redis(config[_0x6270('0xd')]));require(_0x6270('0xf'))[_0x6270('0x10')](socket);function respondWithRpcPromise(_0x11f3a8,_0x2764de,_0x5d2e8e){return new BPromise(function(_0x97ee0d,_0x37ebc9){return client[_0x6270('0x11')](_0x11f3a8,_0x5d2e8e)[_0x6270('0x12')](function(_0x25537b){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2764de,_0x6270('0x13'));logger[_0x6270('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2764de,'request\x20sent',JSON['stringify'](_0x25537b));if(_0x25537b[_0x6270('0x15')]){if(_0x25537b['error'][_0x6270('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2764de,_0x25537b['error'][_0x6270('0x17')]);return _0x37ebc9(_0x25537b[_0x6270('0x15')][_0x6270('0x17')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2764de,_0x25537b[_0x6270('0x15')]['message']);return _0x97ee0d(_0x25537b[_0x6270('0x15')][_0x6270('0x17')]);}else{logger[_0x6270('0x18')](_0x6270('0x19'),_0x2764de,_0x6270('0x13'));_0x97ee0d(_0x25537b['result'][_0x6270('0x17')]);}})['catch'](function(_0x273478){logger[_0x6270('0x15')](_0x6270('0x19'),_0x2764de,_0x273478);_0x37ebc9(_0x273478);});});}exports[_0x6270('0x1a')]=function(_0x184d69){var _0x1991d1=this;return new Promise(function(_0x1cb956,_0x3c1c02){return db[_0x6270('0x1b')][_0x6270('0x1c')]({'raw':_0x184d69[_0x6270('0x1d')]?_0x184d69[_0x6270('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x184d69[_0x6270('0x1d')]?_0x184d69[_0x6270('0x1d')][_0x6270('0x1e')]||null:null,'attributes':_0x184d69[_0x6270('0x1d')]?_0x184d69[_0x6270('0x1d')][_0x6270('0x1f')]||null:null,'limit':_0x184d69[_0x6270('0x1d')]?_0x184d69['options'][_0x6270('0x20')]||null:null,'include':_0x184d69[_0x6270('0x1d')]?_0x184d69[_0x6270('0x1d')]['include']?_[_0x6270('0x21')](_0x184d69[_0x6270('0x1d')][_0x6270('0x22')],function(_0x42267c){return{'model':db[_0x42267c[_0x6270('0x23')]],'as':_0x42267c['as'],'attributes':_0x42267c[_0x6270('0x1f')],'include':_0x42267c['include']?_[_0x6270('0x21')](_0x42267c[_0x6270('0x22')],function(_0x247a4d){return{'model':db[_0x247a4d[_0x6270('0x23')]],'as':_0x247a4d['as'],'attributes':_0x247a4d[_0x6270('0x1f')],'include':_0x247a4d['include']?_['map'](_0x247a4d[_0x6270('0x22')],function(_0x4dfc58){return{'model':db[_0x4dfc58[_0x6270('0x23')]],'as':_0x4dfc58['as'],'attributes':_0x4dfc58[_0x6270('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f4ee0){logger[_0x6270('0x18')]('GetVoiceExtension',_0x184d69);logger[_0x6270('0x14')](_0x6270('0x1a'),_0x184d69,JSON[_0x6270('0x24')](_0x4f4ee0));_0x1cb956(_0x4f4ee0);})[_0x6270('0x25')](function(_0x2a0164){logger['error'](_0x6270('0x1a'),_0x2a0164[_0x6270('0x17')],_0x184d69);_0x3c1c02(_0x1991d1[_0x6270('0x15')](0x1f4,_0x2a0164[_0x6270('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 47b8f2d..14da952 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x43988b,_0x5a8d7b){_0x43988b=_0x43988b-0x0;var _0x56035b=_0x1cb9[_0x43988b];return _0x56035b;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x3334d3,_0x231fa5){var _0x3991e9=function(_0x4f465b){while(--_0x4f465b){_0x3334d3['push'](_0x3334d3['shift']());}};_0x3991e9(++_0x231fa5);}(_0x5fab,0x177));var _0xb5fa=function(_0x192099,_0x38a593){_0x192099=_0x192099-0x0;var _0x3d6ccc=_0x5fab[_0x192099];return _0x3d6ccc;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index cc86308..f5425d3 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 _0xd046=['get','show','getMessages','isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMail.controller','index'];(function(_0x575991,_0x1b2f1c){var _0x2596e6=function(_0xe736b2){while(--_0xe736b2){_0x575991['push'](_0x575991['shift']());}};_0x2596e6(++_0x1b2f1c);}(_0xd046,0x129));var _0x6d04=function(_0x10676d,_0x380f38){_0x10676d=_0x10676d-0x0;var _0x57b077=_0xd046[_0x10676d];return _0x57b077;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['post']('/',auth[_0x6d04('0xa')](),controller['create']);router['put']('/:id',auth[_0x6d04('0xa')](),controller[_0x6d04('0xb')]);router[_0x6d04('0xc')](_0x6d04('0xd'),auth['isAuthenticated'](),controller[_0x6d04('0xe')]);module[_0x6d04('0xf')]=router; \ No newline at end of file +var _0x5d58=['getMessages','post','update','delete','/:id','destroy','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/messages'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0x5d58,0x187));var _0x85d5=function(_0x276c66,_0x214f8e){_0x276c66=_0x276c66-0x0;var _0x5f60a=_0x5d58[_0x276c66];return _0x5f60a;};'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('./voiceMail.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/:id',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')]('/',auth[_0x85d5('0x5')](),controller['create']);router['put']('/:id',auth[_0x85d5('0x5')](),controller[_0x85d5('0xb')]);router[_0x85d5('0xc')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xe')]);module[_0x85d5('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0a07f65..d4be9b4 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 _0x24de=['email','trim','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x4ecfe4,_0x3ce278){var _0x2dcd9b=function(_0x4c4939){while(--_0x4c4939){_0x4ecfe4['push'](_0x4ecfe4['shift']());}};_0x2dcd9b(++_0x3ce278);}(_0x24de,0xcc));var _0xe24d=function(_0x2dfe0a,_0x45fb43){_0x2dfe0a=_0x2dfe0a-0x0;var _0x54ac57=_0x24de[_0x2dfe0a];return _0x54ac57;};'use strict';var Sequelize=require(_0xe24d('0x0'));module[_0xe24d('0x1')]={'customer_id':{'type':Sequelize[_0xe24d('0x2')]},'context':{'type':Sequelize[_0xe24d('0x2')],'defaultValue':_0xe24d('0x3'),'unique':_0xe24d('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xe24d('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x340b3a){this[_0xe24d('0x5')](_0xe24d('0x6'),typeof _0x340b3a==='string'&&_0x340b3a[_0xe24d('0x7')]()?_0x340b3a[_0xe24d('0x7')]():null);}},'pager':{'type':Sequelize[_0xe24d('0x2')]},'tz':{'type':Sequelize[_0xe24d('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xe24d('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xe24d('0x2')]},'review':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xe24d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe24d('0x8')](_0xe24d('0x9'),'no'),'defaultValue':_0xe24d('0x9'),'allowNull':![]},'stamp':{'type':_0xe24d('0xa')},'emailsubject':{'type':Sequelize[_0xe24d('0x2')]},'emailbody':{'type':Sequelize[_0xe24d('0x2')]},'maxsecs':{'type':Sequelize[_0xe24d('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe24d('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe24d('0xc')](_0xe24d('0xd'))+'\x20-\x20'+this[_0xe24d('0xc')](_0xe24d('0xe'));}}}; \ No newline at end of file +var _0x2d77=['string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x55569a,_0x4c78b5){var _0x2f6046=function(_0x2a4a8c){while(--_0x2a4a8c){_0x55569a['push'](_0x55569a['shift']());}};_0x2f6046(++_0x4c78b5);}(_0x2d77,0x119));var _0x72d7=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x2d77[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x72d7('0x0'));module[_0x72d7('0x1')]={'customer_id':{'type':Sequelize[_0x72d7('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x72d7('0x3'),'unique':_0x72d7('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x72d7('0x4')},'password':{'type':Sequelize[_0x72d7('0x2')]},'fullname':{'type':Sequelize[_0x72d7('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x50512a){this[_0x72d7('0x5')](_0x72d7('0x6'),typeof _0x50512a===_0x72d7('0x7')&&_0x50512a[_0x72d7('0x8')]()?_0x50512a[_0x72d7('0x8')]():null);}},'pager':{'type':Sequelize[_0x72d7('0x2')]},'tz':{'type':Sequelize[_0x72d7('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x72d7('0x9'),'no'),'defaultValue':_0x72d7('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':_0x72d7('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x72d7('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x72d7('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x72d7('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x72d7('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x72d7('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x72d7('0x9'),'no'),'defaultValue':_0x72d7('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x72d7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x72d7('0xa')](_0x72d7('0x9'),'no'),'defaultValue':_0x72d7('0x9'),'allowNull':![]},'stamp':{'type':_0x72d7('0xc')},'emailsubject':{'type':Sequelize[_0x72d7('0x2')]},'emailbody':{'type':Sequelize[_0x72d7('0x2')]},'maxsecs':{'type':Sequelize[_0x72d7('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x72d7('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x72d7('0xe')],'get':function(){return this[_0x72d7('0xf')](_0x72d7('0x10'))+'\x20-\x20'+this[_0x72d7('0xf')](_0x72d7('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 51f5c05..753a4d2 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 _0x282b=['json','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','VoiceMail','includeAll','include','findAll','catch','show','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x282b,0xec));var _0xb282=function(_0xdc4da5,_0x1ad452){_0xdc4da5=_0xdc4da5-0x0;var _0x958a17=_0x282b[_0xdc4da5];return _0x958a17;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){var _0x5e828e=_0x360f15[_0xb282('0x25')]({'plain':!![]});var _0x114f77=_0xb282('0x26');return db[_0xb282('0x27')][_0xb282('0x24')]({'where':{'type':_0x114f77,'resourceId':_0x5e828e['id']}})[_0xb282('0x23')](function(){return _0x360f15;});})['then'](function(){_0x56645f[_0xb282('0x18')](0xcc)[_0xb282('0x28')]();});}};}function handleEntityNotFound(_0x50bd73,_0x22d895){return function(_0x38a1f8){if(!_0x38a1f8){_0x50bd73[_0xb282('0x17')](0x194);}return _0x38a1f8;};}function handleError(_0x280940,_0x59644e){_0x59644e=_0x59644e||0x1f4;return function(_0x1520b1){logger[_0xb282('0x29')](_0x1520b1[_0xb282('0x2a')]);if(_0x1520b1[_0xb282('0x2b')]){delete _0x1520b1[_0xb282('0x2b')];}_0x280940[_0xb282('0x18')](_0x59644e)[_0xb282('0x2c')](_0x1520b1);};}exports['index']=function(_0x1b15b5,_0x1e2861){var _0x3eb294={},_0xd8780b={},_0x42ef75={'count':0x0,'rows':[]};var _0x5f3ddf=_[_0xb282('0x2d')](db['VoiceMail'][_0xb282('0x2e')],function(_0x1bf721){return{'name':_0x1bf721[_0xb282('0x2f')],'type':_0x1bf721['type'][_0xb282('0x30')]};});_0xd8780b['model']=_[_0xb282('0x2d')](_0x5f3ddf,_0xb282('0x2b'));_0xd8780b[_0xb282('0x31')]=_[_0xb282('0x32')](_0x1b15b5[_0xb282('0x31')]);_0xd8780b[_0xb282('0x33')]=_['intersection'](_0xd8780b[_0xb282('0x34')],_0xd8780b[_0xb282('0x31')]);_0x3eb294['attributes']=_['intersection'](_0xd8780b[_0xb282('0x34')],qs[_0xb282('0x35')](_0x1b15b5[_0xb282('0x31')]['fields']));_0x3eb294['attributes']=_0x3eb294['attributes'][_0xb282('0x36')]?_0x3eb294[_0xb282('0x37')]:_0xd8780b[_0xb282('0x34')];if(!_0x1b15b5[_0xb282('0x31')][_0xb282('0x38')](_0xb282('0x39'))){_0x3eb294[_0xb282('0x1b')]=qs['limit'](_0x1b15b5[_0xb282('0x31')]['limit']);_0x3eb294[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1b15b5[_0xb282('0x31')]['offset']);}_0x3eb294[_0xb282('0x3a')]=qs['sort'](_0x1b15b5[_0xb282('0x31')][_0xb282('0x3b')]);_0x3eb294[_0xb282('0x3c')]=qs[_0xb282('0x33')](_['pick'](_0x1b15b5['query'],_0xd8780b[_0xb282('0x33')]),_0x5f3ddf);if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]){_0x3eb294[_0xb282('0x3c')]=_['merge'](_0x3eb294[_0xb282('0x3c')],{'$or':_['map'](_0x5f3ddf,function(_0x475895){if(_0x475895[_0xb282('0x3e')]!=='VIRTUAL'){var _0x41f2c4={};_0x41f2c4[_0x475895[_0xb282('0x2b')]]={'$like':'%'+_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]+'%'};return _0x41f2c4;}})});}_0x3eb294=_[_0xb282('0x3f')]({},_0x3eb294,_0x1b15b5[_0xb282('0x40')]);var _0x43e87e={'where':_0x3eb294[_0xb282('0x3c')]};return db[_0xb282('0x41')][_0xb282('0x1c')](_0x43e87e)[_0xb282('0x23')](function(_0x91fe43){_0x42ef75[_0xb282('0x1c')]=_0x91fe43;if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x42')]){_0x3eb294[_0xb282('0x43')]=[{'all':!![]}];}return db[_0xb282('0x41')][_0xb282('0x44')](_0x3eb294);})['then'](function(_0x310ad1){_0x42ef75['rows']=_0x310ad1;return _0x42ef75;})[_0xb282('0x23')](respondWithFilteredResult(_0x1e2861,_0x3eb294))[_0xb282('0x45')](handleError(_0x1e2861,null));};exports[_0xb282('0x46')]=function(_0x2f2ce8,_0x197472){var _0x3ddf56={'raw':!![],'where':{'id':_0x2f2ce8['params']['id']}},_0x5a6c0d={};_0x5a6c0d[_0xb282('0x34')]=_['keys'](db[_0xb282('0x41')][_0xb282('0x2e')]);_0x5a6c0d['query']=_[_0xb282('0x32')](_0x2f2ce8[_0xb282('0x31')]);_0x5a6c0d[_0xb282('0x33')]=_['intersection'](_0x5a6c0d['model'],_0x5a6c0d[_0xb282('0x31')]);_0x3ddf56['attributes']=_[_0xb282('0x47')](_0x5a6c0d[_0xb282('0x34')],qs[_0xb282('0x35')](_0x2f2ce8[_0xb282('0x31')][_0xb282('0x35')]));_0x3ddf56[_0xb282('0x37')]=_0x3ddf56['attributes'][_0xb282('0x36')]?_0x3ddf56[_0xb282('0x37')]:_0x5a6c0d[_0xb282('0x34')];if(_0x2f2ce8['query'][_0xb282('0x42')]){_0x3ddf56['include']=[{'all':!![]}];}_0x3ddf56=_[_0xb282('0x3f')]({},_0x3ddf56,_0x2f2ce8['options']);return db[_0xb282('0x41')]['find'](_0x3ddf56)['then'](handleEntityNotFound(_0x197472,null))['then'](respondWithResult(_0x197472,null))[_0xb282('0x45')](handleError(_0x197472,null));};exports[_0xb282('0x48')]=function(_0x42d99f,_0x7a5aa4){return db['VoiceMail']['create'](_0x42d99f['body'],{})[_0xb282('0x23')](function(_0x255ad5){var _0x3bed8d=_0x42d99f[_0xb282('0x49')]['get']({'plain':!![]});if(!_0x3bed8d)throw new Error(_0xb282('0x4a'));if(_0x3bed8d[_0xb282('0x4b')]==='user'){var _0x33bded=_0x255ad5[_0xb282('0x25')]({'plain':!![]});var _0x16f66b=_0xb282('0x26');return db[_0xb282('0x4c')]['find']({'where':{'name':_0x16f66b,'userProfileId':_0x3bed8d[_0xb282('0x4d')]},'raw':!![]})[_0xb282('0x23')](function(_0x465209){if(_0x465209&&_0x465209[_0xb282('0x4e')]===0x0){return db[_0xb282('0x27')][_0xb282('0x48')]({'name':_0x33bded['name'],'resourceId':_0x33bded['id'],'type':_0x465209[_0xb282('0x2b')],'sectionId':_0x465209['id']},{})['then'](function(){return _0x255ad5;});}else{return _0x255ad5;}})[_0xb282('0x45')](function(_0x1e6ade){logger['error'](_0xb282('0x4f'),_0x1e6ade);throw _0x1e6ade;});}return _0x255ad5;})[_0xb282('0x23')](respondWithResult(_0x7a5aa4,0xc9))[_0xb282('0x45')](handleError(_0x7a5aa4,null));};exports['update']=function(_0x51cbb0,_0x1028b9){if(_0x51cbb0[_0xb282('0x50')]['id']){delete _0x51cbb0[_0xb282('0x50')]['id'];}return db['VoiceMail'][_0xb282('0x51')]({'where':{'id':_0x51cbb0['params']['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x1028b9,null))[_0xb282('0x23')](saveUpdates(_0x51cbb0['body'],null))[_0xb282('0x23')](respondWithResult(_0x1028b9,null))['catch'](handleError(_0x1028b9,null));};exports[_0xb282('0x24')]=function(_0x34b31a,_0x2e6eaa){return db[_0xb282('0x41')][_0xb282('0x51')]({'where':{'id':_0x34b31a[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e6eaa,null))[_0xb282('0x23')](removeEntity(_0x2e6eaa,null))['catch'](handleError(_0x2e6eaa,null));};exports[_0xb282('0x53')]=function(_0x34baf2,_0x53d50a,_0x597793){return db[_0xb282('0x41')][_0xb282('0x54')]({'where':{'id':_0x34baf2[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d50a,null))['then'](function(_0x40ae87){var _0x2dbbc4;var _0x3716b0={},_0x5d6a78={};_0x5d6a78[_0xb282('0x34')]=_['keys'](db[_0xb282('0x55')][_0xb282('0x2e')]);_0x5d6a78[_0xb282('0x31')]=_[_0xb282('0x32')](_0x34baf2[_0xb282('0x31')]);_0x5d6a78[_0xb282('0x33')]=_[_0xb282('0x47')](_0x5d6a78['model'],_0x5d6a78[_0xb282('0x31')]);_0x3716b0[_0xb282('0x37')]=_[_0xb282('0x47')](_0x5d6a78['model'],qs['fields'](_0x34baf2[_0xb282('0x31')][_0xb282('0x35')]));_0x3716b0[_0xb282('0x37')]=_0x3716b0['attributes']['length']?_0x3716b0[_0xb282('0x37')]:_0x5d6a78[_0xb282('0x34')];if(!_0x34baf2['query'][_0xb282('0x38')](_0xb282('0x39'))){_0x3716b0[_0xb282('0x1b')]=qs['limit'](_0x34baf2[_0xb282('0x31')][_0xb282('0x1b')]);_0x3716b0['offset']=qs[_0xb282('0x19')](_0x34baf2[_0xb282('0x31')][_0xb282('0x19')]);}_0x3716b0[_0xb282('0x3a')]=qs['sort'](_0x34baf2['query'][_0xb282('0x3b')]);_0x3716b0[_0xb282('0x3c')]=qs['filters'](_[_0xb282('0x56')](_0x34baf2[_0xb282('0x31')],_0x5d6a78[_0xb282('0x33')]));if(_0x34baf2[_0xb282('0x31')][_0xb282('0x3d')]){_0x3716b0[_0xb282('0x3c')]=_[_0xb282('0x3f')](_0x3716b0[_0xb282('0x3c')],{'$or':_['map'](_0x3716b0[_0xb282('0x37')],function(_0xb22721){var _0x18f33d={};_0x18f33d[_0xb22721]={'$like':'%'+_0x34baf2['query'][_0xb282('0x3d')]+'%'};return _0x18f33d;})});}_0x3716b0[_0xb282('0x3c')]=_['merge'](_0x3716b0['where'],{'mailboxuser':_0x40ae87[_0xb282('0x57')]});_0x3716b0=_[_0xb282('0x3f')]({},_0x3716b0,_0x34baf2[_0xb282('0x40')]);return db[_0xb282('0x55')][_0xb282('0x58')](_0x3716b0)[_0xb282('0x23')](respondWithFilteredResult(_0x53d50a,_0x3716b0));})[_0xb282('0x45')](handleError(_0x53d50a,null));}; \ No newline at end of file +var _0xee5b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','order','where','pick','merge','VIRTUAL','filter','options','VoiceMail','includeAll','include','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','nolimit','sort','findAndCountAll','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xee5b,0x1f4));var _0xbee5=function(_0x24c1ac,_0x3fb009){_0x24c1ac=_0x24c1ac-0x0;var _0xd8d885=_0xee5b[_0x24c1ac];return _0xd8d885;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){var _0x5b43b3=_0x3cfa8d['get']({'plain':!![]});var _0x519473='Voicemails';return db[_0xbee5('0x25')][_0xbee5('0x24')]({'where':{'type':_0x519473,'resourceId':_0x5b43b3['id']}})[_0xbee5('0x23')](function(){return _0x3cfa8d;});})[_0xbee5('0x23')](function(){_0xb665df[_0xbee5('0x17')](0xcc)[_0xbee5('0x18')]();});}};}function handleEntityNotFound(_0x3c8643,_0x4e9a79){return function(_0x36b50f){if(!_0x36b50f){_0x3c8643[_0xbee5('0x26')](0x194);}return _0x36b50f;};}function handleError(_0x179d14,_0x39da95){_0x39da95=_0x39da95||0x1f4;return function(_0x1a8bcc){logger['error'](_0x1a8bcc[_0xbee5('0x27')]);if(_0x1a8bcc[_0xbee5('0x28')]){delete _0x1a8bcc[_0xbee5('0x28')];}_0x179d14[_0xbee5('0x17')](_0x39da95)[_0xbee5('0x29')](_0x1a8bcc);};}exports[_0xbee5('0x2a')]=function(_0x34b7df,_0x36e8bb){var _0x2ccb91={},_0x59c2e4={},_0x22df5f={'count':0x0,'rows':[]};var _0x5b10a6=_[_0xbee5('0x2b')](db['VoiceMail'][_0xbee5('0x2c')],function(_0x52dad9){return{'name':_0x52dad9[_0xbee5('0x2d')],'type':_0x52dad9['type'][_0xbee5('0x2e')]};});_0x59c2e4[_0xbee5('0x2f')]=_[_0xbee5('0x2b')](_0x5b10a6,_0xbee5('0x28'));_0x59c2e4['query']=_[_0xbee5('0x30')](_0x34b7df[_0xbee5('0x31')]);_0x59c2e4[_0xbee5('0x32')]=_[_0xbee5('0x33')](_0x59c2e4['model'],_0x59c2e4[_0xbee5('0x31')]);_0x2ccb91[_0xbee5('0x34')]=_[_0xbee5('0x33')](_0x59c2e4[_0xbee5('0x2f')],qs['fields'](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x35')]));_0x2ccb91[_0xbee5('0x34')]=_0x2ccb91[_0xbee5('0x34')]['length']?_0x2ccb91[_0xbee5('0x34')]:_0x59c2e4['model'];if(!_0x34b7df[_0xbee5('0x31')]['hasOwnProperty']('nolimit')){_0x2ccb91['limit']=qs[_0xbee5('0x1a')](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x1a')]);_0x2ccb91[_0xbee5('0x19')]=qs[_0xbee5('0x19')](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x19')]);}_0x2ccb91[_0xbee5('0x36')]=qs['sort'](_0x34b7df[_0xbee5('0x31')]['sort']);_0x2ccb91[_0xbee5('0x37')]=qs[_0xbee5('0x32')](_[_0xbee5('0x38')](_0x34b7df[_0xbee5('0x31')],_0x59c2e4['filters']),_0x5b10a6);if(_0x34b7df[_0xbee5('0x31')]['filter']){_0x2ccb91['where']=_[_0xbee5('0x39')](_0x2ccb91[_0xbee5('0x37')],{'$or':_[_0xbee5('0x2b')](_0x5b10a6,function(_0x1974f2){if(_0x1974f2['type']!==_0xbee5('0x3a')){var _0x2819e2={};_0x2819e2[_0x1974f2[_0xbee5('0x28')]]={'$like':'%'+_0x34b7df[_0xbee5('0x31')][_0xbee5('0x3b')]+'%'};return _0x2819e2;}})});}_0x2ccb91=_[_0xbee5('0x39')]({},_0x2ccb91,_0x34b7df[_0xbee5('0x3c')]);var _0x297294={'where':_0x2ccb91[_0xbee5('0x37')]};return db[_0xbee5('0x3d')]['count'](_0x297294)[_0xbee5('0x23')](function(_0x371015){_0x22df5f['count']=_0x371015;if(_0x34b7df[_0xbee5('0x31')][_0xbee5('0x3e')]){_0x2ccb91[_0xbee5('0x3f')]=[{'all':!![]}];}return db[_0xbee5('0x3d')]['findAll'](_0x2ccb91);})['then'](function(_0x4b4641){_0x22df5f[_0xbee5('0x40')]=_0x4b4641;return _0x22df5f;})[_0xbee5('0x23')](respondWithFilteredResult(_0x36e8bb,_0x2ccb91))[_0xbee5('0x41')](handleError(_0x36e8bb,null));};exports[_0xbee5('0x42')]=function(_0x4012fd,_0x3f5441){var _0x41cea0={'raw':!![],'where':{'id':_0x4012fd[_0xbee5('0x43')]['id']}},_0x2c4464={};_0x2c4464['model']=_['keys'](db[_0xbee5('0x3d')]['rawAttributes']);_0x2c4464[_0xbee5('0x31')]=_[_0xbee5('0x30')](_0x4012fd['query']);_0x2c4464[_0xbee5('0x32')]=_[_0xbee5('0x33')](_0x2c4464['model'],_0x2c4464['query']);_0x41cea0[_0xbee5('0x34')]=_[_0xbee5('0x33')](_0x2c4464['model'],qs[_0xbee5('0x35')](_0x4012fd[_0xbee5('0x31')]['fields']));_0x41cea0[_0xbee5('0x34')]=_0x41cea0[_0xbee5('0x34')][_0xbee5('0x44')]?_0x41cea0[_0xbee5('0x34')]:_0x2c4464[_0xbee5('0x2f')];if(_0x4012fd[_0xbee5('0x31')][_0xbee5('0x3e')]){_0x41cea0['include']=[{'all':!![]}];}_0x41cea0=_[_0xbee5('0x39')]({},_0x41cea0,_0x4012fd[_0xbee5('0x3c')]);return db[_0xbee5('0x3d')][_0xbee5('0x45')](_0x41cea0)['then'](handleEntityNotFound(_0x3f5441,null))[_0xbee5('0x23')](respondWithResult(_0x3f5441,null))[_0xbee5('0x41')](handleError(_0x3f5441,null));};exports[_0xbee5('0x46')]=function(_0x4aa21a,_0x44d4b1){return db[_0xbee5('0x3d')]['create'](_0x4aa21a['body'],{})['then'](function(_0x3a27bb){var _0x501167=_0x4aa21a[_0xbee5('0x47')][_0xbee5('0x48')]({'plain':!![]});if(!_0x501167)throw new Error(_0xbee5('0x49'));if(_0x501167[_0xbee5('0x4a')]===_0xbee5('0x47')){var _0x296fc8=_0x3a27bb['get']({'plain':!![]});var _0x24274d=_0xbee5('0x4b');return db[_0xbee5('0x4c')][_0xbee5('0x45')]({'where':{'name':_0x24274d,'userProfileId':_0x501167['userProfileId']},'raw':!![]})[_0xbee5('0x23')](function(_0x594dcf){if(_0x594dcf&&_0x594dcf[_0xbee5('0x4d')]===0x0){return db[_0xbee5('0x25')][_0xbee5('0x46')]({'name':_0x296fc8[_0xbee5('0x28')],'resourceId':_0x296fc8['id'],'type':_0x594dcf[_0xbee5('0x28')],'sectionId':_0x594dcf['id']},{})[_0xbee5('0x23')](function(){return _0x3a27bb;});}else{return _0x3a27bb;}})[_0xbee5('0x41')](function(_0x35f1d1){logger[_0xbee5('0x4e')](_0xbee5('0x4f'),_0x35f1d1);throw _0x35f1d1;});}return _0x3a27bb;})[_0xbee5('0x23')](respondWithResult(_0x44d4b1,0xc9))[_0xbee5('0x41')](handleError(_0x44d4b1,null));};exports[_0xbee5('0x22')]=function(_0x359738,_0x37cf74){if(_0x359738['body']['id']){delete _0x359738[_0xbee5('0x50')]['id'];}return db[_0xbee5('0x3d')][_0xbee5('0x45')]({'where':{'id':_0x359738['params']['id']}})[_0xbee5('0x23')](handleEntityNotFound(_0x37cf74,null))[_0xbee5('0x23')](saveUpdates(_0x359738[_0xbee5('0x50')],null))['then'](respondWithResult(_0x37cf74,null))[_0xbee5('0x41')](handleError(_0x37cf74,null));};exports['destroy']=function(_0x131c45,_0x4ee645){return db[_0xbee5('0x3d')][_0xbee5('0x45')]({'where':{'id':_0x131c45[_0xbee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee645,null))['then'](removeEntity(_0x4ee645,null))['catch'](handleError(_0x4ee645,null));};exports[_0xbee5('0x51')]=function(_0x684cd4,_0xbc3da7,_0x5b1a05){return db[_0xbee5('0x3d')]['findOne']({'where':{'id':_0x684cd4[_0xbee5('0x43')]['id']}})[_0xbee5('0x23')](handleEntityNotFound(_0xbc3da7,null))[_0xbee5('0x23')](function(_0x5cc68d){var _0x154d44;var _0x2c0958={},_0x1c6f52={};_0x1c6f52[_0xbee5('0x2f')]=_[_0xbee5('0x30')](db[_0xbee5('0x52')][_0xbee5('0x2c')]);_0x1c6f52[_0xbee5('0x31')]=_[_0xbee5('0x30')](_0x684cd4[_0xbee5('0x31')]);_0x1c6f52[_0xbee5('0x32')]=_[_0xbee5('0x33')](_0x1c6f52[_0xbee5('0x2f')],_0x1c6f52[_0xbee5('0x31')]);_0x2c0958[_0xbee5('0x34')]=_[_0xbee5('0x33')](_0x1c6f52[_0xbee5('0x2f')],qs['fields'](_0x684cd4[_0xbee5('0x31')]['fields']));_0x2c0958['attributes']=_0x2c0958[_0xbee5('0x34')][_0xbee5('0x44')]?_0x2c0958['attributes']:_0x1c6f52['model'];if(!_0x684cd4[_0xbee5('0x31')]['hasOwnProperty'](_0xbee5('0x53'))){_0x2c0958[_0xbee5('0x1a')]=qs['limit'](_0x684cd4[_0xbee5('0x31')][_0xbee5('0x1a')]);_0x2c0958[_0xbee5('0x19')]=qs[_0xbee5('0x19')](_0x684cd4['query'][_0xbee5('0x19')]);}_0x2c0958['order']=qs[_0xbee5('0x54')](_0x684cd4[_0xbee5('0x31')]['sort']);_0x2c0958[_0xbee5('0x37')]=qs[_0xbee5('0x32')](_['pick'](_0x684cd4[_0xbee5('0x31')],_0x1c6f52[_0xbee5('0x32')]));if(_0x684cd4['query'][_0xbee5('0x3b')]){_0x2c0958['where']=_[_0xbee5('0x39')](_0x2c0958['where'],{'$or':_[_0xbee5('0x2b')](_0x2c0958['attributes'],function(_0x541414){var _0x3120f5={};_0x3120f5[_0x541414]={'$like':'%'+_0x684cd4[_0xbee5('0x31')][_0xbee5('0x3b')]+'%'};return _0x3120f5;})});}_0x2c0958[_0xbee5('0x37')]=_[_0xbee5('0x39')](_0x2c0958[_0xbee5('0x37')],{'mailboxuser':_0x5cc68d['mailbox']});_0x2c0958=_[_0xbee5('0x39')]({},_0x2c0958,_0x684cd4[_0xbee5('0x3c')]);return db[_0xbee5('0x52')][_0xbee5('0x55')](_0x2c0958)[_0xbee5('0x23')](respondWithFilteredResult(_0xbc3da7,_0x2c0958));})[_0xbee5('0x41')](handleError(_0xbc3da7,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c993930..5a619d5 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 _0xcfd2=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5a6017,_0x2c8444){var _0x309160=function(_0x140adf){while(--_0x140adf){_0x5a6017['push'](_0x5a6017['shift']());}};_0x309160(++_0x2c8444);}(_0xcfd2,0x80));var _0x2cfd=function(_0x1fad15,_0x30066f){_0x1fad15=_0x1fad15-0x0;var _0x352933=_0xcfd2[_0x1fad15];return _0x352933;};'use strict';var _=require(_0x2cfd('0x0'));var util=require(_0x2cfd('0x1'));var logger=require(_0x2cfd('0x2'))(_0x2cfd('0x3'));var moment=require(_0x2cfd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfd('0x5'));var rimraf=require(_0x2cfd('0x6'));var config=require(_0x2cfd('0x7'));var attributes=require(_0x2cfd('0x8'));module[_0x2cfd('0x9')]=function(_0x1191e8,_0x5c6332){return _0x1191e8[_0x2cfd('0xa')](_0x2cfd('0xb'),attributes,{'tableName':_0x2cfd('0xc'),'paranoid':![],'indexes':[{'name':_0x2cfd('0xd'),'fields':[_0x2cfd('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x33cf=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2bf969,_0x45cf9a){var _0xf14c99=function(_0x3e54c6){while(--_0x3e54c6){_0x2bf969['push'](_0x2bf969['shift']());}};_0xf14c99(++_0x45cf9a);}(_0x33cf,0x1ef));var _0xf33c=function(_0x119a47,_0x4babbb){_0x119a47=_0x119a47-0x0;var _0x591418=_0x33cf[_0x119a47];return _0x591418;};'use strict';var _=require('lodash');var util=require(_0xf33c('0x0'));var logger=require(_0xf33c('0x1'))(_0xf33c('0x2'));var moment=require(_0xf33c('0x3'));var BPromise=require(_0xf33c('0x4'));var rp=require(_0xf33c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf33c('0x6'));var config=require(_0xf33c('0x7'));var attributes=require('./voiceMail.attributes');module[_0xf33c('0x8')]=function(_0x19bb9d,_0x4089ff){return _0x19bb9d[_0xf33c('0x9')](_0xf33c('0xa'),attributes,{'tableName':_0xf33c('0xb'),'paranoid':![],'indexes':[{'name':_0xf33c('0xc'),'fields':[_0xf33c('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 7df2e3c..4c4d44c 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 _0x4263=['VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x31c5fd,_0x33131f){var _0x3799ab=function(_0x1538bf){while(--_0x1538bf){_0x31c5fd['push'](_0x31c5fd['shift']());}};_0x3799ab(++_0x33131f);}(_0x4263,0x151));var _0x3426=function(_0x18ce89,_0x487468){_0x18ce89=_0x18ce89-0x0;var _0x25372f=_0x4263[_0x18ce89];return _0x25372f;};'use strict';var _=require(_0x3426('0x0'));var util=require(_0x3426('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3426('0x2'));var db=require(_0x3426('0x3'))['db'];var utils=require(_0x3426('0x4'));var logger=require(_0x3426('0x5'))(_0x3426('0x6'));var config=require(_0x3426('0x7'));var jayson=require(_0x3426('0x8'));var client=jayson[_0x3426('0x9')][_0x3426('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1420f2,_0x3e0194,_0x7dafb7){return new BPromise(function(_0x33443d,_0x1c0d2e){return client[_0x3426('0xb')](_0x1420f2,_0x7dafb7)[_0x3426('0xc')](function(_0x4d41dc){logger[_0x3426('0xd')](_0x3426('0xe'),_0x3e0194,'request\x20sent');logger['debug'](_0x3426('0xf'),_0x3e0194,_0x3426('0x10'),JSON['stringify'](_0x4d41dc));if(_0x4d41dc[_0x3426('0x11')]){if(_0x4d41dc[_0x3426('0x11')][_0x3426('0x12')]===0x1f4){logger[_0x3426('0x11')](_0x3426('0xe'),_0x3e0194,_0x4d41dc[_0x3426('0x11')][_0x3426('0x13')]);return _0x1c0d2e(_0x4d41dc[_0x3426('0x11')][_0x3426('0x13')]);}logger['error'](_0x3426('0xe'),_0x3e0194,_0x4d41dc['error']['message']);return _0x33443d(_0x4d41dc[_0x3426('0x11')][_0x3426('0x13')]);}else{logger['info'](_0x3426('0xe'),_0x3e0194,'request\x20sent');_0x33443d(_0x4d41dc[_0x3426('0x14')][_0x3426('0x13')]);}})[_0x3426('0x15')](function(_0x523e7d){logger[_0x3426('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3e0194,_0x523e7d);_0x1c0d2e(_0x523e7d);});});} \ No newline at end of file +var _0xce50=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','ioredis'];(function(_0x168ded,_0x446b37){var _0x7c48c5=function(_0x1a7481){while(--_0x1a7481){_0x168ded['push'](_0x168ded['shift']());}};_0x7c48c5(++_0x446b37);}(_0xce50,0x1b5));var _0x0ce5=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xce50[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x0ce5('0x0'));var util=require(_0x0ce5('0x1'));var moment=require('moment');var BPromise=require(_0x0ce5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ce5('0x3'));var db=require(_0x0ce5('0x4'))['db'];var utils=require(_0x0ce5('0x5'));var logger=require(_0x0ce5('0x6'))('rpc');var config=require(_0x0ce5('0x7'));var jayson=require(_0x0ce5('0x8'));var client=jayson['client'][_0x0ce5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f405c,_0x4e752a,_0x395aa3){return new BPromise(function(_0x315bd1,_0x755556){return client[_0x0ce5('0xa')](_0x5f405c,_0x395aa3)[_0x0ce5('0xb')](function(_0x55b4d6){logger[_0x0ce5('0xc')](_0x0ce5('0xd'),_0x4e752a,_0x0ce5('0xe'));logger[_0x0ce5('0xf')](_0x0ce5('0x10'),_0x4e752a,_0x0ce5('0xe'),JSON[_0x0ce5('0x11')](_0x55b4d6));if(_0x55b4d6['error']){if(_0x55b4d6['error']['code']===0x1f4){logger['error'](_0x0ce5('0xd'),_0x4e752a,_0x55b4d6[_0x0ce5('0x12')][_0x0ce5('0x13')]);return _0x755556(_0x55b4d6[_0x0ce5('0x12')]['message']);}logger[_0x0ce5('0x12')](_0x0ce5('0xd'),_0x4e752a,_0x55b4d6[_0x0ce5('0x12')][_0x0ce5('0x13')]);return _0x315bd1(_0x55b4d6[_0x0ce5('0x12')]['message']);}else{logger['info'](_0x0ce5('0xd'),_0x4e752a,_0x0ce5('0xe'));_0x315bd1(_0x55b4d6['result'][_0x0ce5('0x13')]);}})[_0x0ce5('0x14')](function(_0x522236){logger['error'](_0x0ce5('0xd'),_0x4e752a,_0x522236);_0x755556(_0x522236);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9ddc043..d24bf9b 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 _0x1593=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete'];(function(_0x1fc85f,_0x2a3fbe){var _0x2214dd=function(_0x5189cb){while(--_0x5189cb){_0x1fc85f['push'](_0x1fc85f['shift']());}};_0x2214dd(++_0x2a3fbe);}(_0x1593,0x192));var _0x3159=function(_0x51472d,_0x592b0b){_0x51472d=_0x51472d-0x0;var _0x5f00f1=_0x1593[_0x51472d];return _0x5f00f1;};'use strict';var multer=require(_0x3159('0x0'));var util=require(_0x3159('0x1'));var path=require(_0x3159('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3159('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3159('0x4'));var interaction=require(_0x3159('0x5'));var config=require('../../config/environment');var controller=require(_0x3159('0x6'));router[_0x3159('0x7')]('/',auth[_0x3159('0x8')](),controller[_0x3159('0x9')]);router[_0x3159('0x7')](_0x3159('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3159('0x7')](_0x3159('0xb'),auth[_0x3159('0x8')](),controller[_0x3159('0xc')]);router[_0x3159('0xd')]('/',auth[_0x3159('0x8')](),controller[_0x3159('0xe')]);router[_0x3159('0xf')](_0x3159('0xa'),auth[_0x3159('0x8')](),controller[_0x3159('0x10')]);router[_0x3159('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3159('0x12')]);module[_0x3159('0x13')]=router; \ No newline at end of file +var _0x8b98=['/:id','show','/:id/download','download','post','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x356801,_0xf50d95){var _0x479011=function(_0x28feaa){while(--_0x28feaa){_0x356801['push'](_0x356801['shift']());}};_0x479011(++_0xf50d95);}(_0x8b98,0x15c));var _0x88b9=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x8b98[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x88b9('0x0'));var util=require('util');var path=require(_0x88b9('0x1'));var timeout=require('connect-timeout');var express=require(_0x88b9('0x2'));var router=express[_0x88b9('0x3')]();var fs_extra=require(_0x88b9('0x4'));var auth=require(_0x88b9('0x5'));var interaction=require(_0x88b9('0x6'));var config=require(_0x88b9('0x7'));var controller=require(_0x88b9('0x8'));router[_0x88b9('0x9')]('/',auth[_0x88b9('0xa')](),controller[_0x88b9('0xb')]);router[_0x88b9('0x9')](_0x88b9('0xc'),auth[_0x88b9('0xa')](),controller[_0x88b9('0xd')]);router[_0x88b9('0x9')](_0x88b9('0xe'),auth[_0x88b9('0xa')](),controller[_0x88b9('0xf')]);router[_0x88b9('0x10')]('/',auth[_0x88b9('0xa')](),controller['create']);router['put'](_0x88b9('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x88b9('0xc'),auth[_0x88b9('0xa')](),controller['destroy']);module[_0x88b9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index cf5d858..9001648 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 _0xb555=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x12417a,_0x5a9090){var _0x53bca9=function(_0x120feb){while(--_0x120feb){_0x12417a['push'](_0x12417a['shift']());}};_0x53bca9(++_0x5a9090);}(_0xb555,0x174));var _0x5b55=function(_0x4199c5,_0x22c276){_0x4199c5=_0x4199c5-0x0;var _0x589025=_0xb555[_0x4199c5];return _0x589025;};'use strict';var Sequelize=require(_0x5b55('0x0'));module[_0x5b55('0x1')]={'name':{'type':Sequelize[_0x5b55('0x2')],'get':function(_0x212092){return this[_0x5b55('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x5b55('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x5b55('0x6')](_0x5b55('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5b55('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x5b55('0x8')](_0x5b55('0x9'))}}; \ No newline at end of file +var _0x4578=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING'];(function(_0x34986b,_0x56fb4a){var _0x28a0d1=function(_0x2c1e2a){while(--_0x2c1e2a){_0x34986b['push'](_0x34986b['shift']());}};_0x28a0d1(++_0x56fb4a);}(_0x4578,0x100));var _0x8457=function(_0x36eec6,_0x281738){_0x36eec6=_0x36eec6-0x0;var _0x59b716=_0x4578[_0x36eec6];return _0x59b716;};'use strict';var Sequelize=require(_0x8457('0x0'));module[_0x8457('0x1')]={'name':{'type':Sequelize[_0x8457('0x2')],'get':function(_0x107479){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8457('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x8457('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8457('0x4')],'defaultValue':''},'stamp':{'type':_0x8457('0x6'),'defaultValue':Sequelize[_0x8457('0x7')](_0x8457('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b26c76c..76d2daf 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 _0xf66d=['filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','update','destroy','download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','end','limit','undefined','count','set','Content-Range','json','reject','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where'];(function(_0xf70000,_0x40bfdc){var _0x5f4402=function(_0x1021c0){while(--_0x1021c0){_0xf70000['push'](_0xf70000['shift']());}};_0x5f4402(++_0x40bfdc);}(_0xf66d,0xc7));var _0xdf66=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf66d[_0x387777];return _0x3f84c0;};'use strict';var emlformat=require(_0xdf66('0x0'));var rimraf=require(_0xdf66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf66('0x2'));var rp=require(_0xdf66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf66('0x4'));var util=require('util');var path=require(_0xdf66('0x5'));var sox=require(_0xdf66('0x6'));var csv=require(_0xdf66('0x7'));var ejs=require(_0xdf66('0x8'));var fs=require('fs');var fs_extra=require(_0xdf66('0x9'));var _=require(_0xdf66('0xa'));var squel=require(_0xdf66('0xb'));var crypto=require(_0xdf66('0xc'));var jsforce=require(_0xdf66('0xd'));var deskjs=require(_0xdf66('0xe'));var toCsv=require(_0xdf66('0x7'));var querystring=require(_0xdf66('0xf'));var Papa=require(_0xdf66('0x10'));var Redis=require(_0xdf66('0x11'));var authService=require(_0xdf66('0x12'));var qs=require(_0xdf66('0x13'));var as=require(_0xdf66('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf66('0x15'));var utils=require(_0xdf66('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdf66('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c4a96,_0x3182e3){_0x3182e3=_0x3182e3||0xcc;return function(_0x18f8d0){if(_0x18f8d0){return _0x3c4a96['sendStatus'](_0x3182e3);}return _0x3c4a96[_0xdf66('0x18')](_0x3182e3)[_0xdf66('0x19')]();};}function respondWithResult(_0x304f44,_0x17975f){_0x17975f=_0x17975f||0xc8;return function(_0x10134d){if(_0x10134d){return _0x304f44[_0xdf66('0x18')](_0x17975f)['json'](_0x10134d);}};}function respondWithFilteredResult(_0x29bec8,_0x212957){return function(_0x324cd2){if(_0x324cd2){var _0x3f71bf=typeof _0x212957['offset']==='undefined'&&typeof _0x212957[_0xdf66('0x1a')]===_0xdf66('0x1b');var _0x53126c=_0x324cd2[_0xdf66('0x1c')];var _0x2e8e83=_0x3f71bf?0x0:_0x212957['offset'];var _0xd41b0d=_0x3f71bf?_0x324cd2[_0xdf66('0x1c')]:_0x212957['offset']+_0x212957['limit'];var _0xc7fc3f;if(_0xd41b0d>=_0x53126c){_0xd41b0d=_0x53126c;_0xc7fc3f=0xc8;}else{_0xc7fc3f=0xce;}_0x29bec8[_0xdf66('0x18')](_0xc7fc3f);return _0x29bec8[_0xdf66('0x1d')](_0xdf66('0x1e'),_0x2e8e83+'-'+_0xd41b0d+'/'+_0x53126c)[_0xdf66('0x1f')](_0x324cd2);}return null;};}function patchUpdates(_0x486d13){return function(_0x4b4a6a){try{jsonpatch['apply'](_0x4b4a6a,_0x486d13,!![]);}catch(_0x49fc78){return BPromise[_0xdf66('0x20')](_0x49fc78);}return _0x4b4a6a['save']();};}function saveUpdates(_0x19c2fe,_0x4fe782){return function(_0x2b3fa5){if(_0x2b3fa5){return _0x2b3fa5['update'](_0x19c2fe)[_0xdf66('0x21')](function(_0x565f56){return _0x565f56;});}return null;};}function removeEntity(_0x4dc8f8,_0x474cf7){return function(_0x5d2ed4){if(_0x5d2ed4){return _0x5d2ed4['destroy']()[_0xdf66('0x21')](function(){_0x4dc8f8[_0xdf66('0x18')](0xcc)[_0xdf66('0x19')]();});}};}function handleEntityNotFound(_0x1da253,_0x91954f){return function(_0x45b848){if(!_0x45b848){_0x1da253[_0xdf66('0x22')](0x194);}return _0x45b848;};}function handleError(_0x1e512c,_0x62922b){_0x62922b=_0x62922b||0x1f4;return function(_0x4a58c1){logger[_0xdf66('0x23')](_0x4a58c1[_0xdf66('0x24')]);if(_0x4a58c1['name']){delete _0x4a58c1[_0xdf66('0x25')];}_0x1e512c['status'](_0x62922b)[_0xdf66('0x26')](_0x4a58c1);};}exports[_0xdf66('0x27')]=function(_0x45bdd2,_0x5cb417){var _0x46d3fa={},_0x9d0cbd={},_0x34448e={'count':0x0,'rows':[]};var _0x13ac88=_['map'](db[_0xdf66('0x28')]['rawAttributes'],function(_0x184d94){return{'name':_0x184d94['fieldName'],'type':_0x184d94[_0xdf66('0x29')][_0xdf66('0x2a')]};});_0x9d0cbd[_0xdf66('0x2b')]=_['differenceBy'](_['map'](_0x13ac88,_0xdf66('0x25')),[_0xdf66('0x25')]);_0x9d0cbd[_0xdf66('0x2c')]=_[_0xdf66('0x2d')](_0x45bdd2[_0xdf66('0x2c')]);_0x9d0cbd['filters']=_['intersection'](_0x9d0cbd[_0xdf66('0x2b')],_0x9d0cbd[_0xdf66('0x2c')]);_0x46d3fa['attributes']=_[_0xdf66('0x2e')](_0x9d0cbd[_0xdf66('0x2b')],qs[_0xdf66('0x2f')](_0x45bdd2['query'][_0xdf66('0x2f')]));_0x46d3fa[_0xdf66('0x30')]=_0x46d3fa[_0xdf66('0x30')][_0xdf66('0x31')]?_0x46d3fa[_0xdf66('0x30')]:_0x9d0cbd['model'];if(!_0x45bdd2[_0xdf66('0x2c')][_0xdf66('0x32')](_0xdf66('0x33'))){_0x46d3fa[_0xdf66('0x1a')]=qs['limit'](_0x45bdd2[_0xdf66('0x2c')][_0xdf66('0x1a')]);_0x46d3fa['offset']=qs[_0xdf66('0x34')](_0x45bdd2[_0xdf66('0x2c')]['offset']);}_0x46d3fa[_0xdf66('0x35')]=qs[_0xdf66('0x36')](_0x45bdd2[_0xdf66('0x2c')][_0xdf66('0x36')]);_0x46d3fa[_0xdf66('0x37')]=qs[_0xdf66('0x38')](_[_0xdf66('0x39')](_0x45bdd2['query'],_0x9d0cbd[_0xdf66('0x38')]),_0x13ac88);if(_0x45bdd2['query'][_0xdf66('0x3a')]){_0x46d3fa[_0xdf66('0x37')]=_['merge'](_0x46d3fa['where'],{'$or':_[_0xdf66('0x3b')](_0x13ac88,function(_0x3f27a9){if(_0x3f27a9['type']!==_0xdf66('0x3c')){var _0x4f5ac0={};_0x4f5ac0[_0x3f27a9['name']]={'$like':'%'+_0x45bdd2[_0xdf66('0x2c')][_0xdf66('0x3a')]+'%'};return _0x4f5ac0;}})});}_0x46d3fa=_[_0xdf66('0x3d')]({},_0x46d3fa,_0x45bdd2[_0xdf66('0x3e')]);var _0x202423={'where':_0x46d3fa['where']};return db[_0xdf66('0x28')][_0xdf66('0x1c')](_0x202423)[_0xdf66('0x21')](function(_0x459dc7){_0x34448e['count']=_0x459dc7;if(_0x45bdd2[_0xdf66('0x2c')][_0xdf66('0x3f')]){_0x46d3fa['include']=[{'all':!![]}];}return db[_0xdf66('0x28')][_0xdf66('0x40')](_0x46d3fa);})[_0xdf66('0x21')](function(_0x403f46){_0x34448e['rows']=_0x403f46;return _0x34448e;})['then'](respondWithFilteredResult(_0x5cb417,_0x46d3fa))[_0xdf66('0x41')](handleError(_0x5cb417,null));};exports[_0xdf66('0x42')]=function(_0x50b5a9,_0xfba38e){var _0x4c91c6={'raw':!![],'where':{'id':_0x50b5a9[_0xdf66('0x43')]['id']}},_0x2be76b={};_0x2be76b[_0xdf66('0x2b')]=_[_0xdf66('0x2d')](db[_0xdf66('0x28')][_0xdf66('0x44')]);_0x2be76b[_0xdf66('0x2c')]=_[_0xdf66('0x2d')](_0x50b5a9['query']);_0x2be76b[_0xdf66('0x38')]=_[_0xdf66('0x2e')](_0x2be76b[_0xdf66('0x2b')],_0x2be76b[_0xdf66('0x2c')]);_0x4c91c6['attributes']=_[_0xdf66('0x2e')](_0x2be76b['model'],qs[_0xdf66('0x2f')](_0x50b5a9[_0xdf66('0x2c')]['fields']));_0x4c91c6[_0xdf66('0x30')]=_0x4c91c6[_0xdf66('0x30')]['length']?_0x4c91c6[_0xdf66('0x30')]:_0x2be76b['model'];if(_0x50b5a9[_0xdf66('0x2c')][_0xdf66('0x3f')]){_0x4c91c6[_0xdf66('0x45')]=[{'all':!![]}];}_0x4c91c6=_[_0xdf66('0x3d')]({},_0x4c91c6,_0x50b5a9[_0xdf66('0x3e')]);return db[_0xdf66('0x28')][_0xdf66('0x46')](_0x4c91c6)[_0xdf66('0x21')](handleEntityNotFound(_0xfba38e,null))[_0xdf66('0x21')](respondWithResult(_0xfba38e,null))['catch'](handleError(_0xfba38e,null));};exports['create']=function(_0x3114c2,_0x4b7797){return db['VoiceMailMessage'][_0xdf66('0x47')](_0x3114c2[_0xdf66('0x48')],{})[_0xdf66('0x21')](respondWithResult(_0x4b7797,0xc9))['catch'](handleError(_0x4b7797,null));};exports[_0xdf66('0x49')]=function(_0x5ab7dc,_0x2d0e09){if(_0x5ab7dc[_0xdf66('0x48')]['id']){delete _0x5ab7dc[_0xdf66('0x48')]['id'];}return db[_0xdf66('0x28')]['find']({'where':{'id':_0x5ab7dc['params']['id']}})[_0xdf66('0x21')](handleEntityNotFound(_0x2d0e09,null))[_0xdf66('0x21')](saveUpdates(_0x5ab7dc['body'],null))[_0xdf66('0x21')](respondWithResult(_0x2d0e09,null))[_0xdf66('0x41')](handleError(_0x2d0e09,null));};exports[_0xdf66('0x4a')]=function(_0x4e5a8b,_0x897261){return db[_0xdf66('0x28')]['find']({'where':{'id':_0x4e5a8b[_0xdf66('0x43')]['id']}})[_0xdf66('0x21')](handleEntityNotFound(_0x897261,null))['then'](removeEntity(_0x897261,null))[_0xdf66('0x41')](handleError(_0x897261,null));};exports[_0xdf66('0x4b')]=function(_0x2d2963,_0x2ada6d,_0x4bac5d){return db[_0xdf66('0x28')][_0xdf66('0x46')]({'where':{'id':_0x2d2963[_0xdf66('0x43')]['id']},'attributes':['id','recording','msg_id']})[_0xdf66('0x21')](handleEntityNotFound(_0x2ada6d,null))[_0xdf66('0x21')](function(_0x26f7de){if(_0x26f7de){if(!_0x26f7de[_0xdf66('0x4c')]){throw new db[(_0xdf66('0x4d'))][(_0xdf66('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0x1e5080={'Content-Type':_0xdf66('0x4f'),'Content-Disposition':_0xdf66('0x50')};if(_0x26f7de[_0xdf66('0x51')]){_0x1e5080[_0xdf66('0x52')]=_0xdf66('0x53')+_0x26f7de[_0xdf66('0x51')]+_0xdf66('0x54');}_0x2ada6d[_0xdf66('0x1d')](_0x1e5080);return _0x2ada6d[_0xdf66('0x26')](new Buffer(_0x26f7de['recording']));}})[_0xdf66('0x41')](handleError(_0x2ada6d,null));}; \ No newline at end of file +var _0x113a=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','filters','attributes','fields'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x113a,0xc6));var _0xa113=function(_0x4f0ab0,_0x354ce3){_0x4f0ab0=_0x4f0ab0-0x0;var _0x215a3b=_0x113a[_0x4f0ab0];return _0x215a3b;};'use strict';var emlformat=require(_0xa113('0x0'));var rimraf=require(_0xa113('0x1'));var zipdir=require(_0xa113('0x2'));var jsonpatch=require(_0xa113('0x3'));var rp=require(_0xa113('0x4'));var moment=require(_0xa113('0x5'));var BPromise=require(_0xa113('0x6'));var Mustache=require(_0xa113('0x7'));var util=require(_0xa113('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa113('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa113('0xa'));var _=require(_0xa113('0xb'));var squel=require(_0xa113('0xc'));var crypto=require('crypto');var jsforce=require(_0xa113('0xd'));var deskjs=require(_0xa113('0xe'));var toCsv=require(_0xa113('0x9'));var querystring=require('querystring');var Papa=require(_0xa113('0xf'));var Redis=require(_0xa113('0x10'));var authService=require(_0xa113('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa113('0x12'));var hardwareService=require(_0xa113('0x13'));var logger=require('../../config/logger')(_0xa113('0x14'));var utils=require(_0xa113('0x15'));var config=require(_0xa113('0x16'));var licenseUtil=require(_0xa113('0x17'));var db=require(_0xa113('0x18'))['db'];function respondWithStatusCode(_0x20a960,_0x1065cb){_0x1065cb=_0x1065cb||0xcc;return function(_0x1055e1){if(_0x1055e1){return _0x20a960[_0xa113('0x19')](_0x1065cb);}return _0x20a960[_0xa113('0x1a')](_0x1065cb)[_0xa113('0x1b')]();};}function respondWithResult(_0x2bc5b5,_0x154016){_0x154016=_0x154016||0xc8;return function(_0x200291){if(_0x200291){return _0x2bc5b5[_0xa113('0x1a')](_0x154016)[_0xa113('0x1c')](_0x200291);}};}function respondWithFilteredResult(_0x2d22d2,_0x2838d6){return function(_0x43c04a){if(_0x43c04a){var _0x1a68e6=typeof _0x2838d6[_0xa113('0x1d')]===_0xa113('0x1e')&&typeof _0x2838d6[_0xa113('0x1f')]===_0xa113('0x1e');var _0x4b89c7=_0x43c04a[_0xa113('0x20')];var _0x3842fd=_0x1a68e6?0x0:_0x2838d6[_0xa113('0x1d')];var _0x1c0529=_0x1a68e6?_0x43c04a[_0xa113('0x20')]:_0x2838d6[_0xa113('0x1d')]+_0x2838d6[_0xa113('0x1f')];var _0x41747e;if(_0x1c0529>=_0x4b89c7){_0x1c0529=_0x4b89c7;_0x41747e=0xc8;}else{_0x41747e=0xce;}_0x2d22d2[_0xa113('0x1a')](_0x41747e);return _0x2d22d2['set'](_0xa113('0x21'),_0x3842fd+'-'+_0x1c0529+'/'+_0x4b89c7)[_0xa113('0x1c')](_0x43c04a);}return null;};}function patchUpdates(_0x13eec2){return function(_0x502b39){try{jsonpatch['apply'](_0x502b39,_0x13eec2,!![]);}catch(_0x303916){return BPromise[_0xa113('0x22')](_0x303916);}return _0x502b39['save']();};}function saveUpdates(_0x28fb22,_0x24b1d5){return function(_0x4ed22c){if(_0x4ed22c){return _0x4ed22c[_0xa113('0x23')](_0x28fb22)[_0xa113('0x24')](function(_0x41eabd){return _0x41eabd;});}return null;};}function removeEntity(_0xbcecbc,_0x426df4){return function(_0x48264f){if(_0x48264f){return _0x48264f[_0xa113('0x25')]()[_0xa113('0x24')](function(){_0xbcecbc['status'](0xcc)[_0xa113('0x1b')]();});}};}function handleEntityNotFound(_0x27f188,_0x42c6be){return function(_0x2bedfb){if(!_0x2bedfb){_0x27f188[_0xa113('0x19')](0x194);}return _0x2bedfb;};}function handleError(_0x1b1ad8,_0x5e27bd){_0x5e27bd=_0x5e27bd||0x1f4;return function(_0x306926){logger[_0xa113('0x26')](_0x306926[_0xa113('0x27')]);if(_0x306926['name']){delete _0x306926['name'];}_0x1b1ad8[_0xa113('0x1a')](_0x5e27bd)['send'](_0x306926);};}exports['index']=function(_0x5de34e,_0x500a1e){var _0x3799a2={},_0x153d32={},_0x2d0f40={'count':0x0,'rows':[]};var _0x42a147=_[_0xa113('0x28')](db[_0xa113('0x29')][_0xa113('0x2a')],function(_0x5f351a){return{'name':_0x5f351a[_0xa113('0x2b')],'type':_0x5f351a[_0xa113('0x2c')][_0xa113('0x2d')]};});_0x153d32[_0xa113('0x2e')]=_[_0xa113('0x2f')](_[_0xa113('0x28')](_0x42a147,_0xa113('0x30')),[_0xa113('0x30')]);_0x153d32[_0xa113('0x31')]=_[_0xa113('0x32')](_0x5de34e[_0xa113('0x31')]);_0x153d32[_0xa113('0x33')]=_['intersection'](_0x153d32[_0xa113('0x2e')],_0x153d32['query']);_0x3799a2[_0xa113('0x34')]=_['intersection'](_0x153d32[_0xa113('0x2e')],qs[_0xa113('0x35')](_0x5de34e[_0xa113('0x31')][_0xa113('0x35')]));_0x3799a2[_0xa113('0x34')]=_0x3799a2[_0xa113('0x34')][_0xa113('0x36')]?_0x3799a2[_0xa113('0x34')]:_0x153d32[_0xa113('0x2e')];if(!_0x5de34e['query']['hasOwnProperty'](_0xa113('0x37'))){_0x3799a2['limit']=qs[_0xa113('0x1f')](_0x5de34e[_0xa113('0x31')][_0xa113('0x1f')]);_0x3799a2[_0xa113('0x1d')]=qs[_0xa113('0x1d')](_0x5de34e['query']['offset']);}_0x3799a2[_0xa113('0x38')]=qs[_0xa113('0x39')](_0x5de34e[_0xa113('0x31')]['sort']);_0x3799a2[_0xa113('0x3a')]=qs[_0xa113('0x33')](_[_0xa113('0x3b')](_0x5de34e['query'],_0x153d32[_0xa113('0x33')]),_0x42a147);if(_0x5de34e[_0xa113('0x31')][_0xa113('0x3c')]){_0x3799a2['where']=_[_0xa113('0x3d')](_0x3799a2['where'],{'$or':_[_0xa113('0x28')](_0x42a147,function(_0x43e92e){if(_0x43e92e[_0xa113('0x2c')]!==_0xa113('0x3e')){var _0xa146c3={};_0xa146c3[_0x43e92e[_0xa113('0x30')]]={'$like':'%'+_0x5de34e['query'][_0xa113('0x3c')]+'%'};return _0xa146c3;}})});}_0x3799a2=_['merge']({},_0x3799a2,_0x5de34e[_0xa113('0x3f')]);var _0x215387={'where':_0x3799a2[_0xa113('0x3a')]};return db[_0xa113('0x29')][_0xa113('0x20')](_0x215387)['then'](function(_0x136631){_0x2d0f40[_0xa113('0x20')]=_0x136631;if(_0x5de34e[_0xa113('0x31')][_0xa113('0x40')]){_0x3799a2[_0xa113('0x41')]=[{'all':!![]}];}return db[_0xa113('0x29')][_0xa113('0x42')](_0x3799a2);})[_0xa113('0x24')](function(_0xdca38a){_0x2d0f40[_0xa113('0x43')]=_0xdca38a;return _0x2d0f40;})[_0xa113('0x24')](respondWithFilteredResult(_0x500a1e,_0x3799a2))[_0xa113('0x44')](handleError(_0x500a1e,null));};exports['show']=function(_0x180cb5,_0x28677e){var _0x38065={'raw':!![],'where':{'id':_0x180cb5[_0xa113('0x45')]['id']}},_0x188cb0={};_0x188cb0[_0xa113('0x2e')]=_[_0xa113('0x32')](db[_0xa113('0x29')][_0xa113('0x2a')]);_0x188cb0['query']=_[_0xa113('0x32')](_0x180cb5[_0xa113('0x31')]);_0x188cb0[_0xa113('0x33')]=_[_0xa113('0x46')](_0x188cb0['model'],_0x188cb0[_0xa113('0x31')]);_0x38065[_0xa113('0x34')]=_[_0xa113('0x46')](_0x188cb0[_0xa113('0x2e')],qs[_0xa113('0x35')](_0x180cb5[_0xa113('0x31')][_0xa113('0x35')]));_0x38065['attributes']=_0x38065[_0xa113('0x34')][_0xa113('0x36')]?_0x38065[_0xa113('0x34')]:_0x188cb0[_0xa113('0x2e')];if(_0x180cb5['query']['includeAll']){_0x38065[_0xa113('0x41')]=[{'all':!![]}];}_0x38065=_[_0xa113('0x3d')]({},_0x38065,_0x180cb5[_0xa113('0x3f')]);return db[_0xa113('0x29')][_0xa113('0x47')](_0x38065)[_0xa113('0x24')](handleEntityNotFound(_0x28677e,null))[_0xa113('0x24')](respondWithResult(_0x28677e,null))[_0xa113('0x44')](handleError(_0x28677e,null));};exports[_0xa113('0x48')]=function(_0x5c7690,_0x76a2f3){return db[_0xa113('0x29')]['create'](_0x5c7690[_0xa113('0x49')],{})[_0xa113('0x24')](respondWithResult(_0x76a2f3,0xc9))['catch'](handleError(_0x76a2f3,null));};exports[_0xa113('0x23')]=function(_0x1bf9e1,_0x12eb4a){if(_0x1bf9e1[_0xa113('0x49')]['id']){delete _0x1bf9e1[_0xa113('0x49')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x1bf9e1[_0xa113('0x45')]['id']}})[_0xa113('0x24')](handleEntityNotFound(_0x12eb4a,null))['then'](saveUpdates(_0x1bf9e1[_0xa113('0x49')],null))['then'](respondWithResult(_0x12eb4a,null))[_0xa113('0x44')](handleError(_0x12eb4a,null));};exports[_0xa113('0x25')]=function(_0x9fa299,_0x3b70e1){return db[_0xa113('0x29')][_0xa113('0x47')]({'where':{'id':_0x9fa299[_0xa113('0x45')]['id']}})[_0xa113('0x24')](handleEntityNotFound(_0x3b70e1,null))[_0xa113('0x24')](removeEntity(_0x3b70e1,null))[_0xa113('0x44')](handleError(_0x3b70e1,null));};exports[_0xa113('0x4a')]=function(_0x5b4f80,_0x2239e6,_0x45c7ef){return db['VoiceMailMessage']['find']({'where':{'id':_0x5b4f80[_0xa113('0x45')]['id']},'attributes':['id',_0xa113('0x4b'),_0xa113('0x4c')]})[_0xa113('0x24')](handleEntityNotFound(_0x2239e6,null))['then'](function(_0x529f97){if(_0x529f97){if(!_0x529f97[_0xa113('0x4b')]){throw new db[(_0xa113('0x4d'))]['ValidationError'](_0xa113('0x4e'));}var _0x4e3268={'Content-Type':'audio/wav','Content-Disposition':_0xa113('0x4f')};if(_0x529f97['msg_id']){_0x4e3268[_0xa113('0x50')]=_0xa113('0x51')+_0x529f97[_0xa113('0x4c')]+'.wav\x22';}_0x2239e6[_0xa113('0x52')](_0x4e3268);return _0x2239e6[_0xa113('0x53')](new Buffer(_0x529f97[_0xa113('0x4b')]));}})[_0xa113('0x44')](handleError(_0x2239e6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b6ec02c..7279236 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 _0x5fe8=['path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ba36d,_0x5a7d92){var _0x53e49d=function(_0x2c200b){while(--_0x2c200b){_0x2ba36d['push'](_0x2ba36d['shift']());}};_0x53e49d(++_0x5a7d92);}(_0x5fe8,0x1e8));var _0x85fe=function(_0x152051,_0x51b9e5){_0x152051=_0x152051-0x0;var _0x1ce591=_0x5fe8[_0x152051];return _0x1ce591;};'use strict';var _=require('lodash');var util=require(_0x85fe('0x0'));var logger=require(_0x85fe('0x1'))(_0x85fe('0x2'));var moment=require(_0x85fe('0x3'));var BPromise=require(_0x85fe('0x4'));var rp=require(_0x85fe('0x5'));var fs=require('fs');var path=require(_0x85fe('0x6'));var rimraf=require(_0x85fe('0x7'));var config=require(_0x85fe('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x85fe('0x9')]=function(_0x49377d,_0x5a66d8){return _0x49377d[_0x85fe('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x85fe('0xb'),'paranoid':![],'indexes':[{'name':_0x85fe('0xc'),'fields':[_0x85fe('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7c93=['dir','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','VoiceMailMessage'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x7c93,0x1cd));var _0x37c9=function(_0x45b067,_0x391b37){_0x45b067=_0x45b067-0x0;var _0x5629cb=_0x7c93[_0x45b067];return _0x5629cb;};'use strict';var _=require(_0x37c9('0x0'));var util=require('util');var logger=require(_0x37c9('0x1'))(_0x37c9('0x2'));var moment=require(_0x37c9('0x3'));var BPromise=require(_0x37c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x37c9('0x5'));var config=require(_0x37c9('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x2d78a3,_0x3e8b2c){return _0x2d78a3[_0x37c9('0x7')](_0x37c9('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x37c9('0x9'),'fields':[_0x37c9('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7f274b0..8c108a1 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 _0xd1bf=['randomstring','../../config/logger','../../config/environment','jayson/promise','http','request','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','util','bluebird'];(function(_0x220017,_0x318b1f){var _0x46ec19=function(_0x6e978a){while(--_0x6e978a){_0x220017['push'](_0x220017['shift']());}};_0x46ec19(++_0x318b1f);}(_0xd1bf,0x10e));var _0xfd1b=function(_0x454b9d,_0x46bc7b){_0x454b9d=_0x454b9d-0x0;var _0x5775ab=_0xd1bf[_0x454b9d];return _0x5775ab;};'use strict';var _=require('lodash');var util=require(_0xfd1b('0x0'));var moment=require('moment');var BPromise=require(_0xfd1b('0x1'));var rs=require(_0xfd1b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd1b('0x3'))('rpc');var config=require(_0xfd1b('0x4'));var jayson=require(_0xfd1b('0x5'));var client=jayson['client'][_0xfd1b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x29068b,_0x1467a7,_0x3c7e53){return new BPromise(function(_0xc01df9,_0x319215){return client[_0xfd1b('0x7')](_0x29068b,_0x3c7e53)['then'](function(_0x170a44){logger['info'](_0xfd1b('0x8'),_0x1467a7,'request\x20sent');logger[_0xfd1b('0x9')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1467a7,_0xfd1b('0xa'),JSON['stringify'](_0x170a44));if(_0x170a44['error']){if(_0x170a44[_0xfd1b('0xb')][_0xfd1b('0xc')]===0x1f4){logger['error'](_0xfd1b('0x8'),_0x1467a7,_0x170a44[_0xfd1b('0xb')][_0xfd1b('0xd')]);return _0x319215(_0x170a44[_0xfd1b('0xb')][_0xfd1b('0xd')]);}logger['error'](_0xfd1b('0x8'),_0x1467a7,_0x170a44[_0xfd1b('0xb')]['message']);return _0xc01df9(_0x170a44[_0xfd1b('0xb')]['message']);}else{logger[_0xfd1b('0xe')](_0xfd1b('0x8'),_0x1467a7,_0xfd1b('0xa'));_0xc01df9(_0x170a44[_0xfd1b('0xf')]['message']);}})[_0xfd1b('0x10')](function(_0x1f3365){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1467a7,_0x1f3365);_0x319215(_0x1f3365);});});} \ No newline at end of file +var _0x0029=['jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5d67b0,_0x2e1f60){var _0x44f3e2=function(_0x4b11c1){while(--_0x4b11c1){_0x5d67b0['push'](_0x5d67b0['shift']());}};_0x44f3e2(++_0x2e1f60);}(_0x0029,0xe6));var _0x9002=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0029[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x9002('0x0'));var util=require(_0x9002('0x1'));var moment=require(_0x9002('0x2'));var BPromise=require(_0x9002('0x3'));var rs=require(_0x9002('0x4'));var fs=require('fs');var Redis=require(_0x9002('0x5'));var db=require(_0x9002('0x6'))['db'];var utils=require(_0x9002('0x7'));var logger=require(_0x9002('0x8'))('rpc');var config=require(_0x9002('0x9'));var jayson=require(_0x9002('0xa'));var client=jayson[_0x9002('0xb')][_0x9002('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb2ba6f,_0xb1b31f,_0x1be56f){return new BPromise(function(_0x3ff2b5,_0xea4a88){return client[_0x9002('0xd')](_0xb2ba6f,_0x1be56f)[_0x9002('0xe')](function(_0x3b9e24){logger[_0x9002('0xf')](_0x9002('0x10'),_0xb1b31f,_0x9002('0x11'));logger[_0x9002('0x12')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xb1b31f,_0x9002('0x11'),JSON['stringify'](_0x3b9e24));if(_0x3b9e24['error']){if(_0x3b9e24['error'][_0x9002('0x13')]===0x1f4){logger['error'](_0x9002('0x10'),_0xb1b31f,_0x3b9e24[_0x9002('0x14')][_0x9002('0x15')]);return _0xea4a88(_0x3b9e24['error'][_0x9002('0x15')]);}logger[_0x9002('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0xb1b31f,_0x3b9e24[_0x9002('0x14')][_0x9002('0x15')]);return _0x3ff2b5(_0x3b9e24[_0x9002('0x14')]['message']);}else{logger[_0x9002('0xf')](_0x9002('0x10'),_0xb1b31f,_0x9002('0x11'));_0x3ff2b5(_0x3b9e24[_0x9002('0x16')][_0x9002('0x15')]);}})[_0x9002('0x17')](function(_0x17d17b){logger[_0x9002('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0xb1b31f,_0x17d17b);_0xea4a88(_0x17d17b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4168609..ed97fee 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 _0x0beb=['create','/:id/sounds','addSound','update','delete','destroy','removeSound','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','getSounds','post'];(function(_0x8bd852,_0x28aa2d){var _0x543f85=function(_0x3bf533){while(--_0x3bf533){_0x8bd852['push'](_0x8bd852['shift']());}};_0x543f85(++_0x28aa2d);}(_0x0beb,0xee));var _0xb0be=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0beb[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xb0be('0x0'));var util=require(_0xb0be('0x1'));var path=require(_0xb0be('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0be('0x3')]();var fs_extra=require(_0xb0be('0x4'));var auth=require(_0xb0be('0x5'));var interaction=require(_0xb0be('0x6'));var config=require(_0xb0be('0x7'));var controller=require(_0xb0be('0x8'));router['get']('/',auth[_0xb0be('0x9')](),controller['index']);router[_0xb0be('0xa')](_0xb0be('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb0be('0xa')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xb0be('0xc')]);router[_0xb0be('0xd')]('/',auth[_0xb0be('0x9')](),controller[_0xb0be('0xe')]);router['post'](_0xb0be('0xf'),auth[_0xb0be('0x9')](),controller[_0xb0be('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb0be('0x11')]);router[_0xb0be('0x12')](_0xb0be('0xb'),auth[_0xb0be('0x9')](),controller[_0xb0be('0x13')]);router[_0xb0be('0x12')]('/:id/sounds/:id2',auth[_0xb0be('0x9')](),controller[_0xb0be('0x14')]);module['exports']=router; \ No newline at end of file +var _0xea97=['getSounds','create','post','put','update','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea97,0x190));var _0x7ea9=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xea97[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x7ea9('0x0'));var util=require('util');var path=require(_0x7ea9('0x1'));var timeout=require(_0x7ea9('0x2'));var express=require(_0x7ea9('0x3'));var router=express[_0x7ea9('0x4')]();var fs_extra=require(_0x7ea9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ea9('0x6'));var config=require(_0x7ea9('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x7ea9('0x8')]('/',auth[_0x7ea9('0x9')](),controller[_0x7ea9('0xa')]);router[_0x7ea9('0x8')](_0x7ea9('0xb'),auth['isAuthenticated'](),controller[_0x7ea9('0xc')]);router[_0x7ea9('0x8')](_0x7ea9('0xd'),auth[_0x7ea9('0x9')](),controller[_0x7ea9('0xe')]);router['post']('/',auth[_0x7ea9('0x9')](),controller[_0x7ea9('0xf')]);router[_0x7ea9('0x10')]('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router[_0x7ea9('0x11')](_0x7ea9('0xb'),auth['isAuthenticated'](),controller[_0x7ea9('0x12')]);router['delete'](_0x7ea9('0xb'),auth[_0x7ea9('0x9')](),controller[_0x7ea9('0x13')]);router['delete'](_0x7ea9('0x14'),auth[_0x7ea9('0x9')](),controller[_0x7ea9('0x15')]);module[_0x7ea9('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 22c04b8..c4b00b8 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 _0x6027=['sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x15dfe8,_0x2ce9e7){var _0x11336e=function(_0x23e991){while(--_0x23e991){_0x15dfe8['push'](_0x15dfe8['shift']());}};_0x11336e(++_0x2ce9e7);}(_0x6027,0x145));var _0x7602=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0x6027[_0x5ca52d];return _0x89e54e;};'use strict';var Sequelize=require(_0x7602('0x0'));module[_0x7602('0x1')]={'name':{'type':Sequelize[_0x7602('0x2')],'allowNull':![],'unique':_0x7602('0x3')},'mode':{'type':Sequelize[_0x7602('0x4')](_0x7602('0x5'),_0x7602('0x6'),'mp3nb',_0x7602('0x7'),_0x7602('0x8'),_0x7602('0x9')),'allowNull':!![],'defaultValue':_0x7602('0x6')},'directory':{'type':Sequelize[_0x7602('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x7602('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7602('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7602('0x2')],'allowNull':!![],'defaultValue':_0x7602('0xa')},'format':{'type':Sequelize[_0x7602('0x2')],'allowNull':!![]},'stamp':{'type':_0x7602('0xb')},'defaultEntry':{'type':Sequelize[_0x7602('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3af0=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','BOOLEAN'];(function(_0x445f3a,_0x203ae1){var _0x4b8359=function(_0x3f1bf7){while(--_0x3f1bf7){_0x445f3a['push'](_0x445f3a['shift']());}};_0x4b8359(++_0x203ae1);}(_0x3af0,0x82));var _0x03af=function(_0x38051a,_0x2cbe2b){_0x38051a=_0x38051a-0x0;var _0x3c167f=_0x3af0[_0x38051a];return _0x3c167f;};'use strict';var Sequelize=require('sequelize');module[_0x03af('0x0')]={'name':{'type':Sequelize[_0x03af('0x1')],'allowNull':![],'unique':_0x03af('0x2')},'mode':{'type':Sequelize[_0x03af('0x3')](_0x03af('0x4'),_0x03af('0x5'),_0x03af('0x6'),_0x03af('0x7'),_0x03af('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x03af('0x5')},'directory':{'type':Sequelize[_0x03af('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x03af('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x03af('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x03af('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x03af('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 ae15d8d..a7e448c 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 _0x5e4d=['sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','options','find','catch','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','ValidationError','removeSound','id2','unlinkSync','getSounds','pick','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e4d,0xce));var _0xd5e4=function(_0x3f3461,_0x26e131){_0x3f3461=_0x3f3461-0x0;var _0x311487=_0x5e4d[_0x3f3461];return _0x311487;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd5e4('0x0'));var rp=require(_0xd5e4('0x1'));var moment=require(_0xd5e4('0x2'));var BPromise=require(_0xd5e4('0x3'));var Mustache=require(_0xd5e4('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd5e4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5e4('0x6'));var squel=require('squel');var crypto=require(_0xd5e4('0x7'));var jsforce=require(_0xd5e4('0x8'));var deskjs=require(_0xd5e4('0x9'));var toCsv=require('to-csv');var querystring=require(_0xd5e4('0xa'));var Papa=require(_0xd5e4('0xb'));var Redis=require('ioredis');var authService=require(_0xd5e4('0xc'));var qs=require(_0xd5e4('0xd'));var as=require(_0xd5e4('0xe'));var hardwareService=require(_0xd5e4('0xf'));var logger=require(_0xd5e4('0x10'))('api');var utils=require(_0xd5e4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd5e4('0x12'));var db=require(_0xd5e4('0x13'))['db'];function respondWithStatusCode(_0x1e8d5c,_0x3182cc){_0x3182cc=_0x3182cc||0xcc;return function(_0x31c45b){if(_0x31c45b){return _0x1e8d5c[_0xd5e4('0x14')](_0x3182cc);}return _0x1e8d5c[_0xd5e4('0x15')](_0x3182cc)[_0xd5e4('0x16')]();};}function respondWithResult(_0xb1d8a9,_0x245240){_0x245240=_0x245240||0xc8;return function(_0x1ec147){if(_0x1ec147){return _0xb1d8a9['status'](_0x245240)[_0xd5e4('0x17')](_0x1ec147);}};}function respondWithFilteredResult(_0x39dd31,_0x5ec9e3){return function(_0x2416a9){if(_0x2416a9){var _0x17e112=typeof _0x5ec9e3['offset']===_0xd5e4('0x18')&&typeof _0x5ec9e3['limit']==='undefined';var _0x3586f8=_0x2416a9['count'];var _0x10e8fe=_0x17e112?0x0:_0x5ec9e3[_0xd5e4('0x19')];var _0x58616f=_0x17e112?_0x2416a9[_0xd5e4('0x1a')]:_0x5ec9e3[_0xd5e4('0x19')]+_0x5ec9e3[_0xd5e4('0x1b')];var _0x4eb38f;if(_0x58616f>=_0x3586f8){_0x58616f=_0x3586f8;_0x4eb38f=0xc8;}else{_0x4eb38f=0xce;}_0x39dd31[_0xd5e4('0x15')](_0x4eb38f);return _0x39dd31[_0xd5e4('0x1c')](_0xd5e4('0x1d'),_0x10e8fe+'-'+_0x58616f+'/'+_0x3586f8)['json'](_0x2416a9);}return null;};}function patchUpdates(_0x44df29){return function(_0x3e2a91){try{jsonpatch[_0xd5e4('0x1e')](_0x3e2a91,_0x44df29,!![]);}catch(_0x4e4f24){return BPromise[_0xd5e4('0x1f')](_0x4e4f24);}return _0x3e2a91[_0xd5e4('0x20')]();};}function saveUpdates(_0x4c275f,_0x3b09f7){return function(_0x1075e8){if(_0x1075e8){return _0x1075e8[_0xd5e4('0x21')](_0x4c275f)[_0xd5e4('0x22')](function(_0x94049a){return _0x94049a;});}return null;};}function removeEntity(_0x55d4f4,_0x2541d6){return function(_0x781c6a){if(_0x781c6a){return _0x781c6a[_0xd5e4('0x23')]()[_0xd5e4('0x22')](function(){var _0xf18c2d=_0x781c6a[_0xd5e4('0x24')]({'plain':!![]});var _0x51e74f='MusicOnHolds';return db[_0xd5e4('0x25')][_0xd5e4('0x23')]({'where':{'type':_0x51e74f,'resourceId':_0xf18c2d['id']}})['then'](function(){return _0x781c6a;});})['then'](function(){_0x55d4f4[_0xd5e4('0x15')](0xcc)[_0xd5e4('0x16')]();});}};}function handleEntityNotFound(_0x16ae0d,_0x201888){return function(_0x5a762b){if(!_0x5a762b){_0x16ae0d[_0xd5e4('0x14')](0x194);}return _0x5a762b;};}function handleError(_0x438c1c,_0x5c2f3a){_0x5c2f3a=_0x5c2f3a||0x1f4;return function(_0x2ddb98){logger['error'](_0x2ddb98['stack']);if(_0x2ddb98['name']){delete _0x2ddb98['name'];}_0x438c1c[_0xd5e4('0x15')](_0x5c2f3a)[_0xd5e4('0x26')](_0x2ddb98);};}exports[_0xd5e4('0x27')]=function(_0x35736b,_0xf2167d){var _0x5ea9b9={},_0x3e41f6={},_0x45f6e6={'count':0x0,'rows':[]};var _0x5f54f2=_['map'](db[_0xd5e4('0x28')][_0xd5e4('0x29')],function(_0xd5aba5){return{'name':_0xd5aba5[_0xd5e4('0x2a')],'type':_0xd5aba5[_0xd5e4('0x2b')][_0xd5e4('0x2c')]};});_0x3e41f6[_0xd5e4('0x2d')]=_[_0xd5e4('0x2e')](_0x5f54f2,_0xd5e4('0x2f'));_0x3e41f6[_0xd5e4('0x30')]=_[_0xd5e4('0x31')](_0x35736b[_0xd5e4('0x30')]);_0x3e41f6[_0xd5e4('0x32')]=_[_0xd5e4('0x33')](_0x3e41f6[_0xd5e4('0x2d')],_0x3e41f6[_0xd5e4('0x30')]);_0x5ea9b9[_0xd5e4('0x34')]=_['intersection'](_0x3e41f6['model'],qs[_0xd5e4('0x35')](_0x35736b[_0xd5e4('0x30')]['fields']));_0x5ea9b9['attributes']=_0x5ea9b9[_0xd5e4('0x34')][_0xd5e4('0x36')]?_0x5ea9b9[_0xd5e4('0x34')]:_0x3e41f6[_0xd5e4('0x2d')];if(!_0x35736b[_0xd5e4('0x30')][_0xd5e4('0x37')](_0xd5e4('0x38'))){_0x5ea9b9['limit']=qs[_0xd5e4('0x1b')](_0x35736b['query'][_0xd5e4('0x1b')]);_0x5ea9b9['offset']=qs[_0xd5e4('0x19')](_0x35736b[_0xd5e4('0x30')][_0xd5e4('0x19')]);}_0x5ea9b9[_0xd5e4('0x39')]=qs['sort'](_0x35736b[_0xd5e4('0x30')][_0xd5e4('0x3a')]);delete _0x35736b['query'][_0xd5e4('0x3a')];_0x5ea9b9['where']=qs[_0xd5e4('0x32')](_['pick'](_0x35736b[_0xd5e4('0x30')],_0x3e41f6[_0xd5e4('0x32')]),_0x5f54f2);if(_0x35736b[_0xd5e4('0x30')][_0xd5e4('0x3b')]){_0x5ea9b9[_0xd5e4('0x3c')]=_[_0xd5e4('0x3d')](_0x5ea9b9['where'],{'$or':_['map'](_0x5f54f2,function(_0x1c49dc){if(_0x1c49dc[_0xd5e4('0x2b')]!==_0xd5e4('0x3e')){var _0x37c095={};_0x37c095[_0x1c49dc[_0xd5e4('0x2f')]]={'$like':'%'+_0x35736b[_0xd5e4('0x30')]['filter']+'%'};return _0x37c095;}})});}_0x5ea9b9=_[_0xd5e4('0x3d')]({},_0x5ea9b9,_0x35736b['options']);var _0x33a2eb={'where':_0x5ea9b9[_0xd5e4('0x3c')]};return db[_0xd5e4('0x28')]['count'](_0x33a2eb)[_0xd5e4('0x22')](function(_0x2d165d){_0x45f6e6['count']=_0x2d165d;if(_0x35736b[_0xd5e4('0x30')]['includeAll']){_0x5ea9b9[_0xd5e4('0x3f')]=[{'all':!![]}];}return db[_0xd5e4('0x28')][_0xd5e4('0x40')](_0x5ea9b9);})[_0xd5e4('0x22')](function(_0x394b27){_0x45f6e6[_0xd5e4('0x41')]=_0x394b27;return _0x45f6e6;})[_0xd5e4('0x22')](respondWithFilteredResult(_0xf2167d,_0x5ea9b9))['catch'](handleError(_0xf2167d,null));};exports[_0xd5e4('0x42')]=function(_0x9f69a9,_0x398722){var _0x1224a3={'raw':![],'where':{'id':_0x9f69a9[_0xd5e4('0x43')]['id']}},_0x5f090e={};_0x5f090e['model']=_[_0xd5e4('0x31')](db[_0xd5e4('0x28')][_0xd5e4('0x29')]);_0x5f090e[_0xd5e4('0x30')]=_[_0xd5e4('0x31')](_0x9f69a9['query']);_0x5f090e[_0xd5e4('0x32')]=_[_0xd5e4('0x33')](_0x5f090e[_0xd5e4('0x2d')],_0x5f090e[_0xd5e4('0x30')]);_0x1224a3[_0xd5e4('0x34')]=_[_0xd5e4('0x33')](_0x5f090e[_0xd5e4('0x2d')],qs[_0xd5e4('0x35')](_0x9f69a9[_0xd5e4('0x30')]['fields']));_0x1224a3[_0xd5e4('0x34')]=_0x1224a3[_0xd5e4('0x34')][_0xd5e4('0x36')]?_0x1224a3[_0xd5e4('0x34')]:_0x5f090e[_0xd5e4('0x2d')];if(_0x9f69a9[_0xd5e4('0x30')]['includeAll']){_0x1224a3[_0xd5e4('0x3f')]=[{'all':!![]}];}_0x1224a3=_['merge']({},_0x1224a3,_0x9f69a9[_0xd5e4('0x44')]);return db[_0xd5e4('0x28')][_0xd5e4('0x45')](_0x1224a3)['then'](handleEntityNotFound(_0x398722,null))[_0xd5e4('0x22')](respondWithResult(_0x398722,null))[_0xd5e4('0x46')](handleError(_0x398722,null));};exports[_0xd5e4('0x21')]=function(_0x5b4a8f,_0xb0ba){if(_0x5b4a8f[_0xd5e4('0x47')]['id']){delete _0x5b4a8f[_0xd5e4('0x47')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5b4a8f[_0xd5e4('0x43')]['id']}})['then'](handleEntityNotFound(_0xb0ba,null))[_0xd5e4('0x22')](saveUpdates(_0x5b4a8f[_0xd5e4('0x47')],null))['then'](respondWithResult(_0xb0ba,null))['catch'](handleError(_0xb0ba,null));};exports[_0xd5e4('0x48')]=function(_0x5da058,_0x4b7494,_0x41f5b6){return db[_0xd5e4('0x49')][_0xd5e4('0x4a')](function(_0x120855){if(_0x5da058[_0xd5e4('0x47')]['mode']===_0xd5e4('0x4b')){_0x5da058[_0xd5e4('0x47')][_0xd5e4('0x4c')]=path[_0xd5e4('0x4d')](config[_0xd5e4('0x4e')],_0xd5e4('0x4f'),_0x5da058[_0xd5e4('0x47')][_0xd5e4('0x2f')]);}return db[_0xd5e4('0x28')][_0xd5e4('0x48')](_0x5da058[_0xd5e4('0x47')],{'transaction':_0x120855})[_0xd5e4('0x22')](function(_0x5e937a){if(_0x5da058[_0xd5e4('0x47')][_0xd5e4('0x50')]==='files'){fs[_0xd5e4('0x51')](_0x5e937a[_0xd5e4('0x4c')],parseInt(_0xd5e4('0x52'),0x8));}var _0xa32192=_0x5da058['user'][_0xd5e4('0x24')]({'plain':!![]});if(!_0xa32192)throw new Error(_0xd5e4('0x53'));if(_0xa32192['role']===_0xd5e4('0x54')){var _0x8efb6d=_0x5e937a[_0xd5e4('0x24')]({'plain':!![]});return db[_0xd5e4('0x55')][_0xd5e4('0x45')]({'where':{'name':_0xd5e4('0x56'),'userProfileId':_0xa32192[_0xd5e4('0x57')]},'raw':!![]})[_0xd5e4('0x22')](function(_0x541f23){if(_0x541f23&&_0x541f23[_0xd5e4('0x58')]===0x0){return db['UserProfileResource'][_0xd5e4('0x48')]({'name':_0x8efb6d['name'],'resourceId':_0x8efb6d['id'],'type':_0x541f23[_0xd5e4('0x2f')],'sectionId':_0x541f23['id']},{})[_0xd5e4('0x22')](function(){return _0x5e937a;});}else{return _0x5e937a;}})[_0xd5e4('0x46')](function(_0x532562){logger[_0xd5e4('0x59')](_0xd5e4('0x5a'),_0x532562);});}return _0x5e937a;});})[_0xd5e4('0x22')](respondWithResult(_0x4b7494,0xc9))['catch'](handleError(_0x4b7494,null));};exports[_0xd5e4('0x23')]=function(_0x564781,_0x3becbe,_0x18c40f){var _0x9f4915;return db[_0xd5e4('0x28')][_0xd5e4('0x45')]({'where':{'id':_0x564781[_0xd5e4('0x43')]['id']}})[_0xd5e4('0x22')](function(_0x3d066b){if(_0x3d066b){return db[_0xd5e4('0x49')][_0xd5e4('0x4a')](function(_0x3e1cf2){return _0x3d066b[_0xd5e4('0x23')]({'transaction':_0x3e1cf2,'raw':!![]})['then'](function(_0x4b74b5){if(_0x4b74b5['directory']){fs[_0xd5e4('0x5b')](_0x4b74b5[_0xd5e4('0x4c')])[_0xd5e4('0x5c')](function(_0xc8affd){fs['unlinkSync'](path[_0xd5e4('0x4d')](_0x4b74b5[_0xd5e4('0x4c')],_0xc8affd));});fs[_0xd5e4('0x5d')](_0x4b74b5['directory']);}return _0x4b74b5;});})['catch'](function(_0x3440be){throw new db[(_0xd5e4('0x5e'))]['ValidationError'](_0x3440be[_0xd5e4('0x5f')]);});}})[_0xd5e4('0x22')](handleEntityNotFound(_0x3becbe,null))[_0xd5e4('0x22')](removeEntity(_0x3becbe,null))[_0xd5e4('0x46')](handleError(_0x3becbe,null));};exports[_0xd5e4('0x60')]=function(_0x24d91d,_0x1016d3,_0x4f78df){return db[_0xd5e4('0x49')]['transaction'](function(_0x3edb14){var _0x23d0c6;return db[_0xd5e4('0x28')][_0xd5e4('0x45')]({'where':{'id':_0x24d91d[_0xd5e4('0x43')]['id']}})[_0xd5e4('0x22')](function(_0x3ff937){if(_0x3ff937){_0x23d0c6=_0x3ff937;return _0x3ff937['addSound'](_0x24d91d[_0xd5e4('0x47')]['id'],{'transaction':_0x3edb14});}})['then'](function(_0x542f85){if(_0x542f85){return db[_0xd5e4('0x61')][_0xd5e4('0x62')]({'where':{'id':_0x24d91d[_0xd5e4('0x47')]['id']},'attributes':['id',_0xd5e4('0x2f'),'save_name',_0xd5e4('0x63'),_0xd5e4('0x64')],'raw':!![]});}})['then'](function(_0x27ffdf){if(_0x27ffdf){var _0x311f05=path[_0xd5e4('0x4d')](config['root'],_0xd5e4('0x65'),util[_0xd5e4('0x66')]('%s.%s',path[_0xd5e4('0x67')](_0x27ffdf[_0xd5e4('0x68')],path[_0xd5e4('0x69')](_0x27ffdf[_0xd5e4('0x68')])),_0x27ffdf[_0xd5e4('0x63')]));var _0x5e2f9a=path['join'](config[_0xd5e4('0x4e')],_0xd5e4('0x4f'),_0x23d0c6[_0xd5e4('0x2f')],util[_0xd5e4('0x66')](_0xd5e4('0x6a'),_0x27ffdf[_0xd5e4('0x2f')],_0x27ffdf[_0xd5e4('0x63')]));fs['symlinkSync'](_0x311f05,_0x5e2f9a);return _0x27ffdf;}})['catch'](function(_0x4858d5){throw new db[(_0xd5e4('0x5e'))][(_0xd5e4('0x6b'))](_0x4858d5[_0xd5e4('0x5f')]);});})['then'](handleEntityNotFound(_0x1016d3,null))['then'](respondWithResult(_0x1016d3,0xc9))['catch'](handleError(_0x1016d3,null));};exports[_0xd5e4('0x6c')]=function(_0x17d788,_0x191201,_0x3d9035){return db[_0xd5e4('0x49')][_0xd5e4('0x4a')](function(_0x3e983b){var _0x3de3cf;return db[_0xd5e4('0x28')]['findOne']({'where':{'id':_0x17d788['params']['id']}})[_0xd5e4('0x22')](handleEntityNotFound(_0x191201,null))[_0xd5e4('0x22')](function(_0x2646f0){if(_0x2646f0){_0x3de3cf=_0x2646f0;return _0x2646f0[_0xd5e4('0x6c')](_0x17d788[_0xd5e4('0x43')][_0xd5e4('0x6d')]);}})[_0xd5e4('0x22')](function(_0x1936b3){if(_0x1936b3){return db['Sound'][_0xd5e4('0x62')]({'where':{'id':_0x17d788[_0xd5e4('0x43')][_0xd5e4('0x6d')]},'attributes':['id',_0xd5e4('0x2f'),_0xd5e4('0x68'),_0xd5e4('0x63'),_0xd5e4('0x64')],'raw':!![]});}})[_0xd5e4('0x22')](function(_0x452e99){if(_0x452e99){fs[_0xd5e4('0x6e')](path[_0xd5e4('0x4d')](_0x3de3cf[_0xd5e4('0x4c')],util['format'](_0xd5e4('0x6a'),_0x452e99[_0xd5e4('0x2f')],_0x452e99[_0xd5e4('0x63')])));return _0x452e99;}})['catch'](function(_0x5b33cb){throw new db[(_0xd5e4('0x5e'))][(_0xd5e4('0x6b'))](_0x5b33cb['message']);});})[_0xd5e4('0x22')](handleEntityNotFound(_0x191201,null))[_0xd5e4('0x22')](respondWithStatusCode(_0x191201,0xcc))[_0xd5e4('0x46')](handleError(_0x191201,null));};exports[_0xd5e4('0x6f')]=function(_0x43da6b,_0x42dd93,_0x5682ac){var _0x40b8ab={};var _0xa2f354={};var _0x4281ca;var _0xc89ab8;return db[_0xd5e4('0x28')][_0xd5e4('0x62')]({'where':{'id':_0x43da6b['params']['id']}})[_0xd5e4('0x22')](handleEntityNotFound(_0x42dd93,null))[_0xd5e4('0x22')](function(_0x2d0822){if(_0x2d0822){_0x4281ca=_0x2d0822;_0xa2f354[_0xd5e4('0x2d')]=_[_0xd5e4('0x31')](db['Sound'][_0xd5e4('0x29')]);_0xa2f354[_0xd5e4('0x30')]=_[_0xd5e4('0x31')](_0x43da6b[_0xd5e4('0x30')]);_0xa2f354[_0xd5e4('0x32')]=_[_0xd5e4('0x33')](_0xa2f354[_0xd5e4('0x2d')],_0xa2f354[_0xd5e4('0x30')]);_0x40b8ab[_0xd5e4('0x34')]=_[_0xd5e4('0x33')](_0xa2f354[_0xd5e4('0x2d')],qs[_0xd5e4('0x35')](_0x43da6b['query'][_0xd5e4('0x35')]));_0x40b8ab[_0xd5e4('0x34')]=_0x40b8ab[_0xd5e4('0x34')][_0xd5e4('0x36')]?_0x40b8ab[_0xd5e4('0x34')]:_0xa2f354[_0xd5e4('0x2d')];_0x40b8ab[_0xd5e4('0x39')]=qs[_0xd5e4('0x3a')](_0x43da6b[_0xd5e4('0x30')][_0xd5e4('0x3a')]);_0x40b8ab['where']=qs[_0xd5e4('0x32')](_[_0xd5e4('0x70')](_0x43da6b['query'],_0xa2f354['filters']));if(_0x43da6b[_0xd5e4('0x30')][_0xd5e4('0x3b')]){_0x40b8ab[_0xd5e4('0x3c')]=_[_0xd5e4('0x3d')](_0x40b8ab[_0xd5e4('0x3c')],{'$or':_[_0xd5e4('0x2e')](_0x40b8ab['attributes'],function(_0xff2096){var _0x4cb7c2={};_0x4cb7c2[_0xff2096]={'$like':'%'+_0x43da6b[_0xd5e4('0x30')][_0xd5e4('0x3b')]+'%'};return _0x4cb7c2;})});}_0x40b8ab=_[_0xd5e4('0x3d')]({},_0x40b8ab,_0x43da6b[_0xd5e4('0x44')]);return _0x4281ca[_0xd5e4('0x6f')](_0x40b8ab);}})[_0xd5e4('0x22')](function(_0x119a2d){if(_0x119a2d){_0xc89ab8=_0x119a2d[_0xd5e4('0x36')];if(!_0x43da6b[_0xd5e4('0x30')][_0xd5e4('0x37')](_0xd5e4('0x38'))){_0x40b8ab[_0xd5e4('0x1b')]=qs['limit'](_0x43da6b['query'][_0xd5e4('0x1b')]);_0x40b8ab['offset']=qs[_0xd5e4('0x19')](_0x43da6b[_0xd5e4('0x30')][_0xd5e4('0x19')]);}return _0x4281ca['getSounds'](_0x40b8ab);}})[_0xd5e4('0x22')](function(_0x3e46a6){if(_0x3e46a6){return _0x3e46a6?{'count':_0xc89ab8,'rows':_0x3e46a6}:null;}})['then'](respondWithResult(_0x42dd93,null))[_0xd5e4('0x46')](handleError(_0x42dd93,null));}; \ No newline at end of file +var _0x1a4d=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','options','find','catch','body','create','sequelize','files','join','root','server/files/moh','mode','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','directory','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','length','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query'];(function(_0xcb1059,_0x2050e7){var _0x5c9dbb=function(_0x187953){while(--_0x187953){_0xcb1059['push'](_0xcb1059['shift']());}};_0x5c9dbb(++_0x2050e7);}(_0x1a4d,0x19c));var _0xd1a4=function(_0x19a335,_0x559126){_0x19a335=_0x19a335-0x0;var _0x4a5a79=_0x1a4d[_0x19a335];return _0x4a5a79;};'use strict';var emlformat=require(_0xd1a4('0x0'));var rimraf=require(_0xd1a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd1a4('0x2'));var moment=require('moment');var BPromise=require(_0xd1a4('0x3'));var Mustache=require(_0xd1a4('0x4'));var util=require(_0xd1a4('0x5'));var path=require(_0xd1a4('0x6'));var sox=require(_0xd1a4('0x7'));var csv=require(_0xd1a4('0x8'));var ejs=require(_0xd1a4('0x9'));var fs=require('fs');var fs_extra=require(_0xd1a4('0xa'));var _=require(_0xd1a4('0xb'));var squel=require(_0xd1a4('0xc'));var crypto=require(_0xd1a4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd1a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd1a4('0xf'));var Papa=require(_0xd1a4('0x10'));var Redis=require(_0xd1a4('0x11'));var authService=require(_0xd1a4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd1a4('0x13'));var hardwareService=require(_0xd1a4('0x14'));var logger=require(_0xd1a4('0x15'))(_0xd1a4('0x16'));var utils=require(_0xd1a4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd1a4('0x18'));var db=require(_0xd1a4('0x19'))['db'];function respondWithStatusCode(_0x2d001c,_0x1d5bfb){_0x1d5bfb=_0x1d5bfb||0xcc;return function(_0x456f07){if(_0x456f07){return _0x2d001c[_0xd1a4('0x1a')](_0x1d5bfb);}return _0x2d001c[_0xd1a4('0x1b')](_0x1d5bfb)['end']();};}function respondWithResult(_0x447e2b,_0x3b20f6){_0x3b20f6=_0x3b20f6||0xc8;return function(_0x134d42){if(_0x134d42){return _0x447e2b[_0xd1a4('0x1b')](_0x3b20f6)[_0xd1a4('0x1c')](_0x134d42);}};}function respondWithFilteredResult(_0x5cdb97,_0x398f24){return function(_0x46ed99){if(_0x46ed99){var _0x231215=typeof _0x398f24[_0xd1a4('0x1d')]===_0xd1a4('0x1e')&&typeof _0x398f24['limit']===_0xd1a4('0x1e');var _0x3f6f3f=_0x46ed99[_0xd1a4('0x1f')];var _0x5cd9fa=_0x231215?0x0:_0x398f24['offset'];var _0x4e0c0c=_0x231215?_0x46ed99[_0xd1a4('0x1f')]:_0x398f24[_0xd1a4('0x1d')]+_0x398f24[_0xd1a4('0x20')];var _0xe7e7f3;if(_0x4e0c0c>=_0x3f6f3f){_0x4e0c0c=_0x3f6f3f;_0xe7e7f3=0xc8;}else{_0xe7e7f3=0xce;}_0x5cdb97[_0xd1a4('0x1b')](_0xe7e7f3);return _0x5cdb97[_0xd1a4('0x21')](_0xd1a4('0x22'),_0x5cd9fa+'-'+_0x4e0c0c+'/'+_0x3f6f3f)[_0xd1a4('0x1c')](_0x46ed99);}return null;};}function patchUpdates(_0x416404){return function(_0x134be1){try{jsonpatch[_0xd1a4('0x23')](_0x134be1,_0x416404,!![]);}catch(_0x476e17){return BPromise[_0xd1a4('0x24')](_0x476e17);}return _0x134be1[_0xd1a4('0x25')]();};}function saveUpdates(_0x56776b,_0x467d05){return function(_0x591e41){if(_0x591e41){return _0x591e41[_0xd1a4('0x26')](_0x56776b)[_0xd1a4('0x27')](function(_0x2784fe){return _0x2784fe;});}return null;};}function removeEntity(_0x4eb8dc,_0x2d0353){return function(_0x30ec30){if(_0x30ec30){return _0x30ec30['destroy']()[_0xd1a4('0x27')](function(){var _0x1f5ced=_0x30ec30['get']({'plain':!![]});var _0x2b1ee4=_0xd1a4('0x28');return db[_0xd1a4('0x29')][_0xd1a4('0x2a')]({'where':{'type':_0x2b1ee4,'resourceId':_0x1f5ced['id']}})[_0xd1a4('0x27')](function(){return _0x30ec30;});})[_0xd1a4('0x27')](function(){_0x4eb8dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42559d,_0x5c07f0){return function(_0x53f9e6){if(!_0x53f9e6){_0x42559d[_0xd1a4('0x1a')](0x194);}return _0x53f9e6;};}function handleError(_0x403086,_0x32c3c8){_0x32c3c8=_0x32c3c8||0x1f4;return function(_0xe868c2){logger[_0xd1a4('0x2b')](_0xe868c2[_0xd1a4('0x2c')]);if(_0xe868c2['name']){delete _0xe868c2[_0xd1a4('0x2d')];}_0x403086['status'](_0x32c3c8)[_0xd1a4('0x2e')](_0xe868c2);};}exports[_0xd1a4('0x2f')]=function(_0x2bf015,_0x80c630){var _0x414dd8={},_0x1333be={},_0x3b790e={'count':0x0,'rows':[]};var _0x128a2f=_[_0xd1a4('0x30')](db[_0xd1a4('0x31')][_0xd1a4('0x32')],function(_0x476e53){return{'name':_0x476e53[_0xd1a4('0x33')],'type':_0x476e53[_0xd1a4('0x34')][_0xd1a4('0x35')]};});_0x1333be[_0xd1a4('0x36')]=_[_0xd1a4('0x30')](_0x128a2f,_0xd1a4('0x2d'));_0x1333be[_0xd1a4('0x37')]=_[_0xd1a4('0x38')](_0x2bf015[_0xd1a4('0x37')]);_0x1333be[_0xd1a4('0x39')]=_[_0xd1a4('0x3a')](_0x1333be['model'],_0x1333be[_0xd1a4('0x37')]);_0x414dd8[_0xd1a4('0x3b')]=_[_0xd1a4('0x3a')](_0x1333be[_0xd1a4('0x36')],qs[_0xd1a4('0x3c')](_0x2bf015[_0xd1a4('0x37')]['fields']));_0x414dd8[_0xd1a4('0x3b')]=_0x414dd8[_0xd1a4('0x3b')]['length']?_0x414dd8[_0xd1a4('0x3b')]:_0x1333be[_0xd1a4('0x36')];if(!_0x2bf015[_0xd1a4('0x37')][_0xd1a4('0x3d')](_0xd1a4('0x3e'))){_0x414dd8['limit']=qs['limit'](_0x2bf015[_0xd1a4('0x37')]['limit']);_0x414dd8['offset']=qs[_0xd1a4('0x1d')](_0x2bf015['query'][_0xd1a4('0x1d')]);}_0x414dd8[_0xd1a4('0x3f')]=qs['sort'](_0x2bf015[_0xd1a4('0x37')][_0xd1a4('0x40')]);delete _0x2bf015[_0xd1a4('0x37')][_0xd1a4('0x40')];_0x414dd8[_0xd1a4('0x41')]=qs[_0xd1a4('0x39')](_[_0xd1a4('0x42')](_0x2bf015[_0xd1a4('0x37')],_0x1333be[_0xd1a4('0x39')]),_0x128a2f);if(_0x2bf015[_0xd1a4('0x37')][_0xd1a4('0x43')]){_0x414dd8[_0xd1a4('0x41')]=_[_0xd1a4('0x44')](_0x414dd8['where'],{'$or':_[_0xd1a4('0x30')](_0x128a2f,function(_0x4d7473){if(_0x4d7473[_0xd1a4('0x34')]!==_0xd1a4('0x45')){var _0x2dd160={};_0x2dd160[_0x4d7473[_0xd1a4('0x2d')]]={'$like':'%'+_0x2bf015[_0xd1a4('0x37')][_0xd1a4('0x43')]+'%'};return _0x2dd160;}})});}_0x414dd8=_[_0xd1a4('0x44')]({},_0x414dd8,_0x2bf015['options']);var _0x4efadf={'where':_0x414dd8['where']};return db['VoiceMusicOnHold'][_0xd1a4('0x1f')](_0x4efadf)[_0xd1a4('0x27')](function(_0xcb55d7){_0x3b790e[_0xd1a4('0x1f')]=_0xcb55d7;if(_0x2bf015[_0xd1a4('0x37')]['includeAll']){_0x414dd8[_0xd1a4('0x46')]=[{'all':!![]}];}return db[_0xd1a4('0x31')][_0xd1a4('0x47')](_0x414dd8);})[_0xd1a4('0x27')](function(_0x1aa430){_0x3b790e[_0xd1a4('0x48')]=_0x1aa430;return _0x3b790e;})[_0xd1a4('0x27')](respondWithFilteredResult(_0x80c630,_0x414dd8))['catch'](handleError(_0x80c630,null));};exports['show']=function(_0x5add32,_0x3241eb){var _0x3b2907={'raw':![],'where':{'id':_0x5add32[_0xd1a4('0x49')]['id']}},_0x2a1db4={};_0x2a1db4[_0xd1a4('0x36')]=_[_0xd1a4('0x38')](db[_0xd1a4('0x31')][_0xd1a4('0x32')]);_0x2a1db4[_0xd1a4('0x37')]=_[_0xd1a4('0x38')](_0x5add32[_0xd1a4('0x37')]);_0x2a1db4[_0xd1a4('0x39')]=_[_0xd1a4('0x3a')](_0x2a1db4[_0xd1a4('0x36')],_0x2a1db4['query']);_0x3b2907[_0xd1a4('0x3b')]=_[_0xd1a4('0x3a')](_0x2a1db4[_0xd1a4('0x36')],qs[_0xd1a4('0x3c')](_0x5add32['query'][_0xd1a4('0x3c')]));_0x3b2907[_0xd1a4('0x3b')]=_0x3b2907['attributes']['length']?_0x3b2907[_0xd1a4('0x3b')]:_0x2a1db4[_0xd1a4('0x36')];if(_0x5add32[_0xd1a4('0x37')]['includeAll']){_0x3b2907['include']=[{'all':!![]}];}_0x3b2907=_[_0xd1a4('0x44')]({},_0x3b2907,_0x5add32[_0xd1a4('0x4a')]);return db[_0xd1a4('0x31')][_0xd1a4('0x4b')](_0x3b2907)['then'](handleEntityNotFound(_0x3241eb,null))[_0xd1a4('0x27')](respondWithResult(_0x3241eb,null))[_0xd1a4('0x4c')](handleError(_0x3241eb,null));};exports[_0xd1a4('0x26')]=function(_0x13d2f0,_0x5e4536){if(_0x13d2f0[_0xd1a4('0x4d')]['id']){delete _0x13d2f0[_0xd1a4('0x4d')]['id'];}return db[_0xd1a4('0x31')]['find']({'where':{'id':_0x13d2f0[_0xd1a4('0x49')]['id']}})[_0xd1a4('0x27')](handleEntityNotFound(_0x5e4536,null))['then'](saveUpdates(_0x13d2f0[_0xd1a4('0x4d')],null))[_0xd1a4('0x27')](respondWithResult(_0x5e4536,null))['catch'](handleError(_0x5e4536,null));};exports[_0xd1a4('0x4e')]=function(_0xd5ca29,_0x337f0e,_0x3313fd){return db[_0xd1a4('0x4f')]['transaction'](function(_0x2d5b11){if(_0xd5ca29[_0xd1a4('0x4d')]['mode']===_0xd1a4('0x50')){_0xd5ca29[_0xd1a4('0x4d')]['directory']=path[_0xd1a4('0x51')](config[_0xd1a4('0x52')],_0xd1a4('0x53'),_0xd5ca29['body']['name']);}return db[_0xd1a4('0x31')][_0xd1a4('0x4e')](_0xd5ca29[_0xd1a4('0x4d')],{'transaction':_0x2d5b11})[_0xd1a4('0x27')](function(_0xd203a1){if(_0xd5ca29[_0xd1a4('0x4d')][_0xd1a4('0x54')]===_0xd1a4('0x50')){fs['mkdirSync'](_0xd203a1['directory'],parseInt(_0xd1a4('0x55'),0x8));}var _0x80c6c6=_0xd5ca29[_0xd1a4('0x56')]['get']({'plain':!![]});if(!_0x80c6c6)throw new Error(_0xd1a4('0x57'));if(_0x80c6c6[_0xd1a4('0x58')]===_0xd1a4('0x56')){var _0x39b9c5=_0xd203a1[_0xd1a4('0x59')]({'plain':!![]});return db['UserProfileSection'][_0xd1a4('0x4b')]({'where':{'name':_0xd1a4('0x28'),'userProfileId':_0x80c6c6[_0xd1a4('0x5a')]},'raw':!![]})[_0xd1a4('0x27')](function(_0x451546){if(_0x451546&&_0x451546[_0xd1a4('0x5b')]===0x0){return db[_0xd1a4('0x29')][_0xd1a4('0x4e')]({'name':_0x39b9c5[_0xd1a4('0x2d')],'resourceId':_0x39b9c5['id'],'type':_0x451546[_0xd1a4('0x2d')],'sectionId':_0x451546['id']},{})[_0xd1a4('0x27')](function(){return _0xd203a1;});}else{return _0xd203a1;}})[_0xd1a4('0x4c')](function(_0x65fcf){logger[_0xd1a4('0x2b')](_0xd1a4('0x5c'),_0x65fcf);});}return _0xd203a1;});})[_0xd1a4('0x27')](respondWithResult(_0x337f0e,0xc9))['catch'](handleError(_0x337f0e,null));};exports[_0xd1a4('0x2a')]=function(_0x3a560e,_0x5f375f,_0x3a8bae){var _0x50adc2;return db[_0xd1a4('0x31')]['find']({'where':{'id':_0x3a560e['params']['id']}})['then'](function(_0x3610b8){if(_0x3610b8){return db[_0xd1a4('0x4f')][_0xd1a4('0x5d')](function(_0x4da901){return _0x3610b8[_0xd1a4('0x2a')]({'transaction':_0x4da901,'raw':!![]})[_0xd1a4('0x27')](function(_0x4c20b9){if(_0x4c20b9[_0xd1a4('0x5e')]){fs[_0xd1a4('0x5f')](_0x4c20b9[_0xd1a4('0x5e')])['forEach'](function(_0x17e563){fs[_0xd1a4('0x60')](path['join'](_0x4c20b9[_0xd1a4('0x5e')],_0x17e563));});fs[_0xd1a4('0x61')](_0x4c20b9['directory']);}return _0x4c20b9;});})[_0xd1a4('0x4c')](function(_0x482d93){throw new db[(_0xd1a4('0x62'))][(_0xd1a4('0x63'))](_0x482d93[_0xd1a4('0x64')]);});}})[_0xd1a4('0x27')](handleEntityNotFound(_0x5f375f,null))[_0xd1a4('0x27')](removeEntity(_0x5f375f,null))['catch'](handleError(_0x5f375f,null));};exports[_0xd1a4('0x65')]=function(_0x5e45f9,_0x208582,_0x5513cb){return db[_0xd1a4('0x4f')][_0xd1a4('0x5d')](function(_0x5b14c3){var _0x40f66c;return db[_0xd1a4('0x31')][_0xd1a4('0x4b')]({'where':{'id':_0x5e45f9[_0xd1a4('0x49')]['id']}})[_0xd1a4('0x27')](function(_0x4348e3){if(_0x4348e3){_0x40f66c=_0x4348e3;return _0x4348e3[_0xd1a4('0x65')](_0x5e45f9['body']['id'],{'transaction':_0x5b14c3});}})[_0xd1a4('0x27')](function(_0x6c7ffd){if(_0x6c7ffd){return db[_0xd1a4('0x66')][_0xd1a4('0x67')]({'where':{'id':_0x5e45f9[_0xd1a4('0x4d')]['id']},'attributes':['id',_0xd1a4('0x2d'),_0xd1a4('0x68'),_0xd1a4('0x69'),_0xd1a4('0x6a')],'raw':!![]});}})[_0xd1a4('0x27')](function(_0x4dcff6){if(_0x4dcff6){var _0x49fed1=path[_0xd1a4('0x51')](config['root'],_0xd1a4('0x6b'),util[_0xd1a4('0x6c')](_0xd1a4('0x6d'),path[_0xd1a4('0x6e')](_0x4dcff6['save_name'],path[_0xd1a4('0x6f')](_0x4dcff6[_0xd1a4('0x68')])),_0x4dcff6[_0xd1a4('0x69')]));var _0x338236=path[_0xd1a4('0x51')](config['root'],_0xd1a4('0x53'),_0x40f66c[_0xd1a4('0x2d')],util[_0xd1a4('0x6c')](_0xd1a4('0x6d'),_0x4dcff6['name'],_0x4dcff6[_0xd1a4('0x69')]));fs[_0xd1a4('0x70')](_0x49fed1,_0x338236);return _0x4dcff6;}})[_0xd1a4('0x4c')](function(_0x50268e){throw new db[(_0xd1a4('0x62'))][(_0xd1a4('0x63'))](_0x50268e['message']);});})['then'](handleEntityNotFound(_0x208582,null))[_0xd1a4('0x27')](respondWithResult(_0x208582,0xc9))[_0xd1a4('0x4c')](handleError(_0x208582,null));};exports[_0xd1a4('0x71')]=function(_0x291ed0,_0x36b0e1,_0x3356eb){return db[_0xd1a4('0x4f')][_0xd1a4('0x5d')](function(_0x5975ed){var _0x5cb00d;return db[_0xd1a4('0x31')][_0xd1a4('0x67')]({'where':{'id':_0x291ed0[_0xd1a4('0x49')]['id']}})['then'](handleEntityNotFound(_0x36b0e1,null))['then'](function(_0x44e911){if(_0x44e911){_0x5cb00d=_0x44e911;return _0x44e911[_0xd1a4('0x71')](_0x291ed0[_0xd1a4('0x49')][_0xd1a4('0x72')]);}})[_0xd1a4('0x27')](function(_0x53800d){if(_0x53800d){return db[_0xd1a4('0x66')][_0xd1a4('0x67')]({'where':{'id':_0x291ed0[_0xd1a4('0x49')][_0xd1a4('0x72')]},'attributes':['id',_0xd1a4('0x2d'),_0xd1a4('0x68'),_0xd1a4('0x69'),_0xd1a4('0x6a')],'raw':!![]});}})['then'](function(_0x373ea3){if(_0x373ea3){fs['unlinkSync'](path['join'](_0x5cb00d[_0xd1a4('0x5e')],util['format']('%s.%s',_0x373ea3[_0xd1a4('0x2d')],_0x373ea3[_0xd1a4('0x69')])));return _0x373ea3;}})[_0xd1a4('0x4c')](function(_0xf2ab4){throw new db['Sequelize']['ValidationError'](_0xf2ab4[_0xd1a4('0x64')]);});})['then'](handleEntityNotFound(_0x36b0e1,null))[_0xd1a4('0x27')](respondWithStatusCode(_0x36b0e1,0xcc))['catch'](handleError(_0x36b0e1,null));};exports[_0xd1a4('0x73')]=function(_0x58dded,_0x3fb46d,_0x1bc01d){var _0x56d877={};var _0x25e7c9={};var _0x5ef2c9;var _0x51891f;return db[_0xd1a4('0x31')]['findOne']({'where':{'id':_0x58dded[_0xd1a4('0x49')]['id']}})[_0xd1a4('0x27')](handleEntityNotFound(_0x3fb46d,null))['then'](function(_0x5e54f5){if(_0x5e54f5){_0x5ef2c9=_0x5e54f5;_0x25e7c9[_0xd1a4('0x36')]=_[_0xd1a4('0x38')](db[_0xd1a4('0x66')][_0xd1a4('0x32')]);_0x25e7c9['query']=_[_0xd1a4('0x38')](_0x58dded[_0xd1a4('0x37')]);_0x25e7c9['filters']=_[_0xd1a4('0x3a')](_0x25e7c9[_0xd1a4('0x36')],_0x25e7c9[_0xd1a4('0x37')]);_0x56d877['attributes']=_[_0xd1a4('0x3a')](_0x25e7c9['model'],qs[_0xd1a4('0x3c')](_0x58dded[_0xd1a4('0x37')][_0xd1a4('0x3c')]));_0x56d877[_0xd1a4('0x3b')]=_0x56d877['attributes']['length']?_0x56d877[_0xd1a4('0x3b')]:_0x25e7c9[_0xd1a4('0x36')];_0x56d877[_0xd1a4('0x3f')]=qs[_0xd1a4('0x40')](_0x58dded[_0xd1a4('0x37')]['sort']);_0x56d877[_0xd1a4('0x41')]=qs['filters'](_[_0xd1a4('0x42')](_0x58dded[_0xd1a4('0x37')],_0x25e7c9[_0xd1a4('0x39')]));if(_0x58dded[_0xd1a4('0x37')]['filter']){_0x56d877['where']=_['merge'](_0x56d877[_0xd1a4('0x41')],{'$or':_[_0xd1a4('0x30')](_0x56d877[_0xd1a4('0x3b')],function(_0x5324b7){var _0x1e0610={};_0x1e0610[_0x5324b7]={'$like':'%'+_0x58dded['query'][_0xd1a4('0x43')]+'%'};return _0x1e0610;})});}_0x56d877=_[_0xd1a4('0x44')]({},_0x56d877,_0x58dded[_0xd1a4('0x4a')]);return _0x5ef2c9[_0xd1a4('0x73')](_0x56d877);}})[_0xd1a4('0x27')](function(_0x2c5430){if(_0x2c5430){_0x51891f=_0x2c5430[_0xd1a4('0x74')];if(!_0x58dded['query'][_0xd1a4('0x3d')](_0xd1a4('0x3e'))){_0x56d877[_0xd1a4('0x20')]=qs[_0xd1a4('0x20')](_0x58dded[_0xd1a4('0x37')][_0xd1a4('0x20')]);_0x56d877[_0xd1a4('0x1d')]=qs['offset'](_0x58dded[_0xd1a4('0x37')][_0xd1a4('0x1d')]);}return _0x5ef2c9[_0xd1a4('0x73')](_0x56d877);}})[_0xd1a4('0x27')](function(_0x58a40e){if(_0x58a40e){return _0x58a40e?{'count':_0x51891f,'rows':_0x58a40e}:null;}})[_0xd1a4('0x27')](respondWithResult(_0x3fb46d,null))[_0xd1a4('0x4c')](handleError(_0x3fb46d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 26c9992..092b95e 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 _0x8a7f=['../../config/logger','api','moment','bluebird','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash'];(function(_0x195f1f,_0x4f1cc7){var _0x1c8d87=function(_0x52ce46){while(--_0x52ce46){_0x195f1f['push'](_0x195f1f['shift']());}};_0x1c8d87(++_0x4f1cc7);}(_0x8a7f,0x1b8));var _0xf8a7=function(_0x4b23a5,_0x56be5e){_0x4b23a5=_0x4b23a5-0x0;var _0x4dd678=_0x8a7f[_0x4b23a5];return _0x4dd678;};'use strict';var _=require(_0xf8a7('0x0'));var util=require('util');var logger=require(_0xf8a7('0x1'))(_0xf8a7('0x2'));var moment=require(_0xf8a7('0x3'));var BPromise=require(_0xf8a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8a7('0x5'));var attributes=require(_0xf8a7('0x6'));module['exports']=function(_0x1fb21e,_0x2b1ec0){return _0x1fb21e[_0xf8a7('0x7')](_0xf8a7('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4232=['VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x4232,0x116));var _0x2423=function(_0x2792d6,_0x2f264e){_0x2792d6=_0x2792d6-0x0;var _0x4b5158=_0x4232[_0x2792d6];return _0x4b5158;};'use strict';var _=require(_0x2423('0x0'));var util=require('util');var logger=require(_0x2423('0x1'))('api');var moment=require(_0x2423('0x2'));var BPromise=require(_0x2423('0x3'));var rp=require(_0x2423('0x4'));var fs=require('fs');var path=require(_0x2423('0x5'));var rimraf=require(_0x2423('0x6'));var config=require(_0x2423('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x2423('0x8')]=function(_0x912c1,_0x18d579){return _0x912c1[_0x2423('0x9')](_0x2423('0xa'),attributes,{'tableName':_0x2423('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index d3b4530..aef019b 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2b38b7,_0x416d31){var _0x55b409=function(_0x5708fe){while(--_0x5708fe){_0x2b38b7['push'](_0x2b38b7['shift']());}};_0x55b409(++_0x416d31);}(_0x70e0,0x17b));var _0x070e=function(_0x749f56,_0x3afb06){_0x749f56=_0x749f56-0x0;var _0x5ccfb1=_0x70e0[_0x749f56];return _0x5ccfb1;};'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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1b5e23,_0x3e2448){var _0x25f6df=function(_0x22f9f0){while(--_0x22f9f0){_0x1b5e23['push'](_0x1b5e23['shift']());}};_0x25f6df(++_0x3e2448);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f6d36a5..8c43146 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 _0xea31=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','put','update','delete'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xea31,0x6b));var _0x1ea3=function(_0x322cce,_0x10be19){_0x322cce=_0x322cce-0x0;var _0x85b7a2=_0xea31[_0x322cce];return _0x85b7a2;};'use strict';var multer=require(_0x1ea3('0x0'));var util=require('util');var path=require(_0x1ea3('0x1'));var timeout=require(_0x1ea3('0x2'));var express=require(_0x1ea3('0x3'));var router=express[_0x1ea3('0x4')]();var fs_extra=require(_0x1ea3('0x5'));var auth=require(_0x1ea3('0x6'));var interaction=require(_0x1ea3('0x7'));var config=require('../../config/environment');var controller=require(_0x1ea3('0x8'));router[_0x1ea3('0x9')]('/',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xb')]);router[_0x1ea3('0x9')]('/describe',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xc')]);router[_0x1ea3('0x9')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xe')]);router['get'](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x10')]);router[_0x1ea3('0x9')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x12')]);router['post']('/',auth[_0x1ea3('0xa')](),controller['create']);router[_0x1ea3('0x13')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller['addAgents']);router[_0x1ea3('0x13')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller['addTeams']);router[_0x1ea3('0x14')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x15')]);router[_0x1ea3('0x16')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller['destroy']);router[_0x1ea3('0x16')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x17')]);router[_0x1ea3('0x16')]('/:id/teams',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x18')]);module[_0x1ea3('0x19')]=router; \ No newline at end of file +var _0xf3be=['put','/:id','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','Router','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents'];(function(_0x40664e,_0xc7a885){var _0x172673=function(_0x415c5f){while(--_0x415c5f){_0x40664e['push'](_0x40664e['shift']());}};_0x172673(++_0xc7a885);}(_0xf3be,0x1e1));var _0xef3b=function(_0x5f2b47,_0x4e53c1){_0x5f2b47=_0x5f2b47-0x0;var _0x113ba6=_0xf3be[_0x5f2b47];return _0x113ba6;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require(_0xef3b('0x2'));var timeout=require(_0xef3b('0x3'));var express=require('express');var router=express[_0xef3b('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(_0xef3b('0x5'));router[_0xef3b('0x6')]('/',auth['isAuthenticated'](),controller[_0xef3b('0x7')]);router[_0xef3b('0x6')](_0xef3b('0x8'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xef3b('0xb')]);router['get'](_0xef3b('0xc'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router['get'](_0xef3b('0xe'),auth['isAuthenticated'](),controller[_0xef3b('0xf')]);router[_0xef3b('0x10')]('/',auth[_0xef3b('0x9')](),controller[_0xef3b('0x11')]);router[_0xef3b('0x10')](_0xef3b('0xc'),auth[_0xef3b('0x9')](),controller[_0xef3b('0x12')]);router[_0xef3b('0x10')](_0xef3b('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0xef3b('0x13')](_0xef3b('0x14'),auth[_0xef3b('0x9')](),controller[_0xef3b('0x15')]);router[_0xef3b('0x16')]('/:id',auth[_0xef3b('0x9')](),controller[_0xef3b('0x17')]);router[_0xef3b('0x16')](_0xef3b('0xc'),auth[_0xef3b('0x9')](),controller['removeAgents']);router[_0xef3b('0x16')](_0xef3b('0xe'),auth['isAuthenticated'](),controller[_0xef3b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 161ed84..e21bbf3 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 _0xb7d4=['VIRTUAL','system-','STRING','INTEGER','exports','name'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xb7d4,0xb8));var _0x4b7d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb7d4[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x4b7d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b7d('0x1')},'prefix':{'type':Sequelize[_0x4b7d('0x2')],'get':function(_0xceb770){return _0x4b7d('0x3')+this['getDataValue'](_0x4b7d('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x4b7d('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x4b7d('0x5')]}}; \ No newline at end of file +var _0x84cb=['sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x23334a,_0x10b51){var _0x2a6de3=function(_0x530452){while(--_0x530452){_0x23334a['push'](_0x23334a['shift']());}};_0x2a6de3(++_0x10b51);}(_0x84cb,0x1d4));var _0xb84c=function(_0x528050,_0x47894f){_0x528050=_0x528050-0x0;var _0x170eeb=_0x84cb[_0x528050];return _0x170eeb;};'use strict';var Sequelize=require(_0xb84c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb84c('0x1')],'allowNull':![],'unique':_0xb84c('0x2')},'prefix':{'type':Sequelize[_0xb84c('0x3')],'get':function(_0x3cd2a2){return _0xb84c('0x4')+this[_0xb84c('0x5')](_0xb84c('0x2'))+'-';}},'description':{'type':Sequelize[_0xb84c('0x1')]},'callerIdAll':{'type':Sequelize[_0xb84c('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index fadd245..d3ea7d2 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 _0x9582=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoicePrefix','include','rows','catch','show','params','keys','includeAll','find','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','getTeams','Team','addTeams','findAll','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4da06c,_0xf5d333){var _0x18daaa=function(_0x5a20bc){while(--_0x5a20bc){_0x4da06c['push'](_0x4da06c['shift']());}};_0x18daaa(++_0xf5d333);}(_0x9582,0x95));var _0x2958=function(_0x20dd46,_0x5b0295){_0x20dd46=_0x20dd46-0x0;var _0x361233=_0x9582[_0x20dd46];return _0x361233;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];config[_0x2958('0x19')]=_[_0x2958('0x1a')](config[_0x2958('0x19')],{'host':_0x2958('0x1b'),'port':0x18eb});var socket=require(_0x2958('0x1c'))(new Redis(config[_0x2958('0x19')]));require('./voicePrefix.socket')[_0x2958('0x1d')](socket);function respondWithStatusCode(_0x2e12d4,_0x4f2a1b){_0x4f2a1b=_0x4f2a1b||0xcc;return function(_0x4c762e){if(_0x4c762e){return _0x2e12d4[_0x2958('0x1e')](_0x4f2a1b);}return _0x2e12d4[_0x2958('0x1f')](_0x4f2a1b)['end']();};}function respondWithResult(_0x3bef50,_0x544563){_0x544563=_0x544563||0xc8;return function(_0x5c3ac3){if(_0x5c3ac3){return _0x3bef50[_0x2958('0x1f')](_0x544563)[_0x2958('0x20')](_0x5c3ac3);}};}function respondWithFilteredResult(_0x55e261,_0x54ef76){return function(_0x28a92c){if(_0x28a92c){var _0x160949=typeof _0x54ef76[_0x2958('0x21')]===_0x2958('0x22')&&typeof _0x54ef76[_0x2958('0x23')]==='undefined';var _0x19a614=_0x28a92c[_0x2958('0x24')];var _0x1a12fa=_0x160949?0x0:_0x54ef76['offset'];var _0x1e77eb=_0x160949?_0x28a92c['count']:_0x54ef76[_0x2958('0x21')]+_0x54ef76['limit'];var _0x5eaf36;if(_0x1e77eb>=_0x19a614){_0x1e77eb=_0x19a614;_0x5eaf36=0xc8;}else{_0x5eaf36=0xce;}_0x55e261[_0x2958('0x1f')](_0x5eaf36);return _0x55e261[_0x2958('0x25')](_0x2958('0x26'),_0x1a12fa+'-'+_0x1e77eb+'/'+_0x19a614)[_0x2958('0x20')](_0x28a92c);}return null;};}function patchUpdates(_0x2202f8){return function(_0x412e42){try{jsonpatch[_0x2958('0x27')](_0x412e42,_0x2202f8,!![]);}catch(_0x2b9818){return BPromise[_0x2958('0x28')](_0x2b9818);}return _0x412e42[_0x2958('0x29')]();};}function saveUpdates(_0xaf5547,_0xd58ae1){return function(_0x119242){if(_0x119242){return _0x119242[_0x2958('0x2a')](_0xaf5547)[_0x2958('0x2b')](function(_0x4f811a){return _0x4f811a;});}return null;};}function removeEntity(_0x574df5,_0x3c1155){return function(_0x33c5b0){if(_0x33c5b0){return _0x33c5b0[_0x2958('0x2c')]()[_0x2958('0x2b')](function(){var _0x52bd32=_0x33c5b0[_0x2958('0x2d')]({'plain':!![]});var _0x57ae96=_0x2958('0x2e');return db[_0x2958('0x2f')][_0x2958('0x2c')]({'where':{'type':_0x57ae96,'resourceId':_0x52bd32['id']}})[_0x2958('0x2b')](function(){return _0x33c5b0;});})[_0x2958('0x2b')](function(){_0x574df5[_0x2958('0x1f')](0xcc)[_0x2958('0x30')]();});}};}function handleEntityNotFound(_0x5d1dfc,_0x21b919){return function(_0x5053d0){if(!_0x5053d0){_0x5d1dfc['sendStatus'](0x194);}return _0x5053d0;};}function handleError(_0x28ee09,_0x15bab3){_0x15bab3=_0x15bab3||0x1f4;return function(_0x973486){logger[_0x2958('0x31')](_0x973486[_0x2958('0x32')]);if(_0x973486[_0x2958('0x33')]){delete _0x973486[_0x2958('0x33')];}_0x28ee09[_0x2958('0x1f')](_0x15bab3)['send'](_0x973486);};}exports[_0x2958('0x34')]=function(_0x32e366,_0x5f34d4){var _0x430484={},_0x5ed343={},_0x380e1d={'count':0x0,'rows':[]};var _0x56d9fd=_[_0x2958('0x35')](db['VoicePrefix'][_0x2958('0x36')],function(_0x2e2a0b){return{'name':_0x2e2a0b[_0x2958('0x37')],'type':_0x2e2a0b[_0x2958('0x38')][_0x2958('0x39')]};});_0x5ed343[_0x2958('0x3a')]=_[_0x2958('0x35')](_0x56d9fd,_0x2958('0x33'));_0x5ed343[_0x2958('0x3b')]=_['keys'](_0x32e366[_0x2958('0x3b')]);_0x5ed343['filters']=_[_0x2958('0x3c')](_0x5ed343['model'],_0x5ed343[_0x2958('0x3b')]);_0x430484[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x5ed343[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0x32e366[_0x2958('0x3b')][_0x2958('0x3e')]));_0x430484[_0x2958('0x3d')]=_0x430484[_0x2958('0x3d')][_0x2958('0x3f')]?_0x430484[_0x2958('0x3d')]:_0x5ed343[_0x2958('0x3a')];if(!_0x32e366[_0x2958('0x3b')]['hasOwnProperty'](_0x2958('0x40'))){_0x430484[_0x2958('0x23')]=qs[_0x2958('0x23')](_0x32e366[_0x2958('0x3b')]['limit']);_0x430484[_0x2958('0x21')]=qs[_0x2958('0x21')](_0x32e366[_0x2958('0x3b')][_0x2958('0x21')]);}_0x430484[_0x2958('0x41')]=qs[_0x2958('0x42')](_0x32e366[_0x2958('0x3b')][_0x2958('0x42')]);_0x430484[_0x2958('0x43')]=qs[_0x2958('0x44')](_[_0x2958('0x45')](_0x32e366[_0x2958('0x3b')],_0x5ed343[_0x2958('0x44')]),_0x56d9fd);if(_0x32e366['query'][_0x2958('0x46')]){_0x430484[_0x2958('0x43')]=_['merge'](_0x430484['where'],{'$or':_[_0x2958('0x35')](_0x56d9fd,function(_0x265055){if(_0x265055[_0x2958('0x38')]!==_0x2958('0x47')){var _0x3ec87a={};_0x3ec87a[_0x265055[_0x2958('0x33')]]={'$like':'%'+_0x32e366[_0x2958('0x3b')][_0x2958('0x46')]+'%'};return _0x3ec87a;}})});}_0x430484=_[_0x2958('0x48')]({},_0x430484,_0x32e366[_0x2958('0x49')]);var _0x16aae8={'where':_0x430484[_0x2958('0x43')]};return db[_0x2958('0x4a')]['count'](_0x16aae8)[_0x2958('0x2b')](function(_0x112256){_0x380e1d[_0x2958('0x24')]=_0x112256;if(_0x32e366[_0x2958('0x3b')]['includeAll']){_0x430484[_0x2958('0x4b')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x430484);})[_0x2958('0x2b')](function(_0x35993f){_0x380e1d[_0x2958('0x4c')]=_0x35993f;return _0x380e1d;})[_0x2958('0x2b')](respondWithFilteredResult(_0x5f34d4,_0x430484))[_0x2958('0x4d')](handleError(_0x5f34d4,null));};exports[_0x2958('0x4e')]=function(_0x52d40e,_0x17e8d6){var _0x4fb27a={'raw':![],'where':{'id':_0x52d40e[_0x2958('0x4f')]['id']}},_0x488f49={};_0x488f49['model']=_[_0x2958('0x50')](db[_0x2958('0x4a')][_0x2958('0x36')]);_0x488f49[_0x2958('0x3b')]=_[_0x2958('0x50')](_0x52d40e[_0x2958('0x3b')]);_0x488f49[_0x2958('0x44')]=_[_0x2958('0x3c')](_0x488f49['model'],_0x488f49[_0x2958('0x3b')]);_0x4fb27a[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x488f49[_0x2958('0x3a')],qs['fields'](_0x52d40e[_0x2958('0x3b')][_0x2958('0x3e')]));_0x4fb27a['attributes']=_0x4fb27a[_0x2958('0x3d')][_0x2958('0x3f')]?_0x4fb27a[_0x2958('0x3d')]:_0x488f49[_0x2958('0x3a')];if(_0x52d40e[_0x2958('0x3b')][_0x2958('0x51')]){_0x4fb27a['include']=[{'all':!![]}];}_0x4fb27a=_[_0x2958('0x48')]({},_0x4fb27a,_0x52d40e[_0x2958('0x49')]);return db[_0x2958('0x4a')][_0x2958('0x52')](_0x4fb27a)[_0x2958('0x2b')](handleEntityNotFound(_0x17e8d6,null))[_0x2958('0x2b')](respondWithResult(_0x17e8d6,null))[_0x2958('0x4d')](handleError(_0x17e8d6,null));};exports[_0x2958('0x2c')]=function(_0x2e0fc7,_0x329652){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x2e0fc7[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x329652,null))[_0x2958('0x2b')](removeEntity(_0x329652,null))[_0x2958('0x4d')](handleError(_0x329652,null));};exports[_0x2958('0x53')]=function(_0x4889b6,_0xa1073b){return db['VoicePrefix'][_0x2958('0x53')]()[_0x2958('0x2b')](respondWithResult(_0xa1073b,null))[_0x2958('0x4d')](handleError(_0xa1073b,null));};exports['create']=function(_0x497a30,_0x39cc25){var _0x394c29;return db[_0x2958('0x54')]['transaction'](function(_0x524562){return db[_0x2958('0x4a')][_0x2958('0x55')](_0x497a30[_0x2958('0x56')],{'transaction':_0x524562})[_0x2958('0x2b')](function(_0x4347c0){_0x394c29=_0x4347c0[_0x2958('0x2d')]({'plain':!![]});return db[_0x2958('0x57')][_0x2958('0x52')]({'where':{'id':_0x394c29[_0x2958('0x58')]},'raw':!![]})['then'](function(_0x30c739){return createVoicePrefixExtensions(_0x394c29,_0x30c739,_0x524562);});});})[_0x2958('0x2b')](function(){var _0x5671d1=_0x497a30[_0x2958('0x59')][_0x2958('0x2d')]({'plain':!![]});if(!_0x5671d1)throw new Error(_0x2958('0x5a'));if(_0x5671d1[_0x2958('0x5b')]===_0x2958('0x59')){var _0x16d927=_0x394c29;return db['UserProfileSection'][_0x2958('0x52')]({'where':{'name':_0x2958('0x2e'),'userProfileId':_0x5671d1[_0x2958('0x5c')]},'raw':!![]})['then'](function(_0x595738){if(_0x595738&&_0x595738[_0x2958('0x5d')]===0x0){return db['UserProfileResource'][_0x2958('0x55')]({'name':_0x16d927['name'],'resourceId':_0x16d927['id'],'type':_0x595738[_0x2958('0x33')],'sectionId':_0x595738['id']},{})[_0x2958('0x2b')](function(){return _0x394c29;});}else{return _0x394c29;}})[_0x2958('0x4d')](function(_0x474f6b){logger[_0x2958('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474f6b);throw _0x474f6b;});}return _0x394c29;})['then'](respondWithResult(_0x39cc25,null))[_0x2958('0x4d')](handleError(_0x39cc25,null));};function Extension(_0x3e11eb,_0xfa171d,_0x51bf4c,_0x55676f){this[_0x2958('0x5e')]=_0x2958('0x5f');this[_0x2958('0x60')]=_0x3e11eb;this[_0x2958('0x61')]=_0x51bf4c;this[_0x2958('0x38')]=_0x2958('0x62');this[_0x2958('0x63')]=_0x2958('0x64');this[_0x2958('0x65')]=_0xfa171d;this[_0x2958('0x66')]=_0x55676f;}function createVoicePrefixExtensions(_0x2de03a,_0x2bef16,_0x3cc345){return new BPromise(function(_0x49d190,_0x3a4ad9){var _0x8c7203=new Extension(formatPrefixName(_0x2de03a[_0x2958('0x67')]),0x1,_0x2958('0x68'),_0x2958('0x69'));_0x8c7203[_0x2958('0x6a')]=_0x2de03a['id'];return db[_0x2958('0x57')][_0x2958('0x55')](_0x8c7203,{'transaction':_0x3cc345})[_0x2958('0x2b')](function(_0x4dd3de){var _0x2269e1=_0x4dd3de['get']({'plain':!![]});var _0x196901=_[_0x2958('0x35')](addVoicePrefixExtensions(_0x2de03a,_0x2bef16),function(_0x31a596){_0x31a596['VoiceExtensionId']=_0x2269e1['id'];_0x31a596['VoicePrefixId']=_0x2de03a['id'];return _0x31a596;});return db['VoiceExtension'][_0x2958('0x6b')](_0x196901,{'transaction':_0x3cc345})[_0x2958('0x2b')](function(_0x4c1516){if(!_0x4c1516){return _0x3a4ad9(_0x2958('0x6c'));}else{return _0x49d190(_0x4c1516);}})[_0x2958('0x4d')](function(_0xb2fe28){return _0x3a4ad9(_0xb2fe28);});});;});};function addVoicePrefixExtensions(_0x32a216,_0x13f850){var _0x538298=[];var _0x55da00=formatPrefixName(_0x32a216[_0x2958('0x67')]);_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x2,_0x2958('0x6e'),_0x2958('0x6f')+_0x32a216['name']));if(_0x32a216[_0x2958('0x70')]){_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x3,_0x2958('0x6e'),_0x2958('0x71')+_0x32a216['callerIdAll']));}else{_0x538298['push'](new Extension(_0x55da00,0x3,'NoOp','No\x20callerid\x20available'));}_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x4,_0x2958('0x72'),_0x13f850['context']+','+_0x2958('0x73')+(0x8+_0x32a216[_0x2958('0x33')][_0x2958('0x3f')])+'}'+','+0x1));return _0x538298;}function formatPrefixName(_0x234d7f){var _0x1eefb5='_';for(var _0x41ab26=0x0;_0x41ab26<_0x234d7f['length'];_0x41ab26++){if(_0x234d7f[_0x2958('0x74')](_0x41ab26)=='-'){_0x1eefb5+=_0x234d7f[_0x2958('0x74')](_0x41ab26);}else{_0x1eefb5+='['+_0x234d7f[_0x2958('0x74')](_0x41ab26)+']';}}_0x1eefb5+='.';return _0x1eefb5;}exports['update']=function(_0xd61e21,_0x566123,_0x546721){var _0x584429=_0xd61e21['body'];_0x584429[_0x2958('0x67')]='system-'+_0x584429[_0x2958('0x33')]+'-';return db[_0x2958('0x54')][_0x2958('0x75')](function(_0x41ead9){return db[_0x2958('0x4a')][_0x2958('0x2a')](_0x584429,{'where':{'id':_0x584429['id']},'transaction':_0x41ead9})['then'](function(){return db[_0x2958('0x57')][_0x2958('0x2c')]({'where':{'VoicePrefixId':_0x584429['id']},'transaction':_0x41ead9})[_0x2958('0x2b')](function(){return db[_0x2958('0x57')][_0x2958('0x52')]({'where':{'id':_0x584429[_0x2958('0x58')]},'raw':!![]})[_0x2958('0x2b')](function(_0x3674b3){return createVoicePrefixExtensions(_0x584429,_0x3674b3,_0x41ead9);});});});})[_0x2958('0x2b')](function(){return db[_0x2958('0x4a')][_0x2958('0x76')](_0x584429['id']);})[_0x2958('0x2b')](respondWithResult(_0x566123,null))[_0x2958('0x4d')](handleError(_0x566123,null));};exports[_0x2958('0x77')]=function(_0x1a2cf2,_0x2136fe,_0x19b819){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x1a2cf2[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x2136fe,null))['then'](function(_0x831f42){if(_0x831f42){return _0x831f42[_0x2958('0x77')](_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')],_[_0x2958('0x79')](_0x1a2cf2['body'],[_0x2958('0x78'),'id'])||{})[_0x2958('0x7a')](function(_0x214b51){for(var _0x1a9f51=0x0;_0x1a9f51<_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')][_0x2958('0x3f')];_0x1a9f51+=0x1){socket[_0x2958('0x7b')](_0x2958('0x7c'),{'UserId':Number(_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')][_0x1a9f51]),'VoicePrefixId':Number(_0x1a2cf2[_0x2958('0x4f')]['id'])});}return _0x214b51;});}})[_0x2958('0x2b')](respondWithResult(_0x2136fe,null))[_0x2958('0x4d')](handleError(_0x2136fe,null));};exports[_0x2958('0x7d')]=function(_0x33e4b5,_0x3c7a19,_0x80a4db){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x33e4b5[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x3c7a19,null))[_0x2958('0x2b')](function(_0x2a3c34){if(_0x2a3c34){return _0x2a3c34['removeAgents'](_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')])[_0x2958('0x2b')](function(){if(_[_0x2958('0x7e')](_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')])){for(var _0x1d0bfd=0x0;_0x1d0bfd<_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')][_0x2958('0x3f')];_0x1d0bfd+=0x1){socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':Number(_0x33e4b5['query'][_0x2958('0x78')][_0x1d0bfd]),'VoicePrefixId':Number(_0x33e4b5[_0x2958('0x4f')]['id'])});}}else{socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':Number(_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')]),'VoicePrefixId':Number(_0x33e4b5['params']['id'])});}});}})[_0x2958('0x2b')](respondWithStatusCode(_0x3c7a19,null))[_0x2958('0x4d')](handleError(_0x3c7a19,null));};exports[_0x2958('0x80')]=function(_0xe483b9,_0x2b7e0e,_0x558b10){var _0x158c43={};var _0x5be9e={};var _0x2f3f81;var _0x171717;return db[_0x2958('0x4a')][_0x2958('0x81')]({'where':{'id':_0xe483b9[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x2b7e0e,null))[_0x2958('0x2b')](function(_0x4739b0){if(_0x4739b0){_0x2f3f81=_0x4739b0;_0x5be9e[_0x2958('0x3a')]=_['keys'](db[_0x2958('0x82')][_0x2958('0x36')]);_0x5be9e['query']=_['keys'](_0xe483b9[_0x2958('0x3b')]);_0x5be9e[_0x2958('0x44')]=_['intersection'](_0x5be9e[_0x2958('0x3a')],_0x5be9e[_0x2958('0x3b')]);_0x158c43[_0x2958('0x3d')]=_['intersection'](_0x5be9e[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0xe483b9[_0x2958('0x3b')][_0x2958('0x3e')]));_0x158c43[_0x2958('0x3d')]=_0x158c43[_0x2958('0x3d')]['length']?_0x158c43[_0x2958('0x3d')]:_0x5be9e[_0x2958('0x3a')];_0x158c43[_0x2958('0x41')]=qs[_0x2958('0x42')](_0xe483b9['query']['sort']);_0x158c43['where']=qs[_0x2958('0x44')](_['pick'](_0xe483b9[_0x2958('0x3b')],_0x5be9e['filters']));if(_0xe483b9['query'][_0x2958('0x46')]){_0x158c43[_0x2958('0x43')]=_['merge'](_0x158c43[_0x2958('0x43')],{'$or':_[_0x2958('0x35')](_0x158c43[_0x2958('0x3d')],function(_0x2aa634){var _0x37b94a={};_0x37b94a[_0x2aa634]={'$like':'%'+_0xe483b9['query'][_0x2958('0x46')]+'%'};return _0x37b94a;})});}_0x158c43=_[_0x2958('0x48')]({},_0x158c43,_0xe483b9[_0x2958('0x49')]);return _0x2f3f81[_0x2958('0x80')](_0x158c43);}})[_0x2958('0x2b')](function(_0x17b2bf){if(_0x17b2bf){_0x171717=_0x17b2bf[_0x2958('0x3f')];if(!_0xe483b9[_0x2958('0x3b')][_0x2958('0x83')]('nolimit')){_0x158c43[_0x2958('0x23')]=qs[_0x2958('0x23')](_0xe483b9[_0x2958('0x3b')]['limit']);_0x158c43[_0x2958('0x21')]=qs[_0x2958('0x21')](_0xe483b9[_0x2958('0x3b')][_0x2958('0x21')]);}return _0x2f3f81[_0x2958('0x80')](_0x158c43);}})[_0x2958('0x2b')](function(_0xb41929){if(_0xb41929){return _0xb41929?{'count':_0x171717,'rows':_0xb41929}:null;}})[_0x2958('0x2b')](respondWithResult(_0x2b7e0e,null))[_0x2958('0x4d')](handleError(_0x2b7e0e,null));};exports[_0x2958('0x84')]=function(_0x57db70,_0x3077ef,_0x5d9ad0){var _0x57ae87={};var _0x2f279a={};var _0x445e57;var _0x561ecc;return db['VoicePrefix']['findOne']({'where':{'id':_0x57db70[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x3077ef,null))['then'](function(_0x3876cb){if(_0x3876cb){_0x445e57=_0x3876cb;_0x2f279a[_0x2958('0x3a')]=_[_0x2958('0x50')](db[_0x2958('0x85')][_0x2958('0x36')]);_0x2f279a[_0x2958('0x3b')]=_[_0x2958('0x50')](_0x57db70['query']);_0x2f279a[_0x2958('0x44')]=_[_0x2958('0x3c')](_0x2f279a[_0x2958('0x3a')],_0x2f279a[_0x2958('0x3b')]);_0x57ae87[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x2f279a[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0x57db70[_0x2958('0x3b')][_0x2958('0x3e')]));_0x57ae87['attributes']=_0x57ae87['attributes'][_0x2958('0x3f')]?_0x57ae87['attributes']:_0x2f279a[_0x2958('0x3a')];_0x57ae87[_0x2958('0x41')]=qs[_0x2958('0x42')](_0x57db70[_0x2958('0x3b')][_0x2958('0x42')]);_0x57ae87[_0x2958('0x43')]=qs[_0x2958('0x44')](_['pick'](_0x57db70[_0x2958('0x3b')],_0x2f279a[_0x2958('0x44')]));if(_0x57db70[_0x2958('0x3b')][_0x2958('0x46')]){_0x57ae87[_0x2958('0x43')]=_['merge'](_0x57ae87[_0x2958('0x43')],{'$or':_[_0x2958('0x35')](_0x57ae87[_0x2958('0x3d')],function(_0x533243){var _0x12ffd1={};_0x12ffd1[_0x533243]={'$like':'%'+_0x57db70[_0x2958('0x3b')][_0x2958('0x46')]+'%'};return _0x12ffd1;})});}_0x57ae87=_[_0x2958('0x48')]({},_0x57ae87,_0x57db70[_0x2958('0x49')]);return _0x445e57[_0x2958('0x84')](_0x57ae87);}})['then'](function(_0x5f4622){if(_0x5f4622){_0x561ecc=_0x5f4622[_0x2958('0x3f')];if(!_0x57db70[_0x2958('0x3b')][_0x2958('0x83')]('nolimit')){_0x57ae87[_0x2958('0x23')]=qs['limit'](_0x57db70[_0x2958('0x3b')][_0x2958('0x23')]);_0x57ae87[_0x2958('0x21')]=qs['offset'](_0x57db70[_0x2958('0x3b')][_0x2958('0x21')]);}return _0x445e57[_0x2958('0x84')](_0x57ae87);}})[_0x2958('0x2b')](function(_0x49bd35){if(_0x49bd35){return _0x49bd35?{'count':_0x561ecc,'rows':_0x49bd35}:null;}})['then'](respondWithResult(_0x3077ef,null))[_0x2958('0x4d')](handleError(_0x3077ef,null));};exports[_0x2958('0x86')]=function(_0x118318,_0x39d235,_0x3eeedf){var _0x498e07=_0x118318[_0x2958('0x56')][_0x2958('0x78')];var _0x1437a7;return db[_0x2958('0x85')][_0x2958('0x87')]({'where':{'id':_0x498e07},'attributes':['id'],'include':[{'model':db[_0x2958('0x82')],'as':_0x2958('0x88'),'attributes':['id',_0x2958('0x33'),'online','voicePause','interface'],'raw':!![]}]})[_0x2958('0x2b')](function(_0x45fcc5){if(_0x45fcc5){_0x1437a7=_0x45fcc5;var _0x3d4314=_['flatMap'](_0x45fcc5,function(_0x413447){var _0x42c8b0=_0x413447[_0x2958('0x2d')]({'plain':!![]});return _0x42c8b0['Agents'];});return db['VoicePrefix']['find']({'where':{'id':_0x118318[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](function(_0x36c52a){return db[_0x2958('0x54')][_0x2958('0x75')](function(_0x43b9ec){return _0x36c52a['addTeams'](_0x498e07,{'transaction':_0x43b9ec})[_0x2958('0x2b')](function(){return BPromise[_0x2958('0x89')](_0x1437a7,function(_0x9b8367){return db[_0x2958('0x8a')][_0x2958('0x8b')]({'TeamId':_0x9b8367['id'],'VoicePrefixId':_0x118318[_0x2958('0x4f')]['id']},{'transaction':_0x43b9ec});});})['then'](function(){return BPromise['each'](_0x3d4314,function(_0x38a789){return db[_0x2958('0x8c')][_0x2958('0x8d')]({'where':{'UserId':_0x38a789['id'],'VoicePrefixId':_0x118318[_0x2958('0x4f')]['id']},'transaction':_0x43b9ec});});})[_0x2958('0x2b')](function(){_0x3d4314[_0x2958('0x8e')](function(_0x1ec753){socket[_0x2958('0x7b')]('userVoicePrefix:save',{'UserId':_0x1ec753['id'],'VoicePrefixId':_0x36c52a['id']});});});});});}})[_0x2958('0x2b')](respondWithStatusCode(_0x39d235,null))[_0x2958('0x4d')](handleError(_0x39d235,null));};exports[_0x2958('0x8f')]=function(_0x6f44ca,_0x1ddda5,_0x2f5a39){return db[_0x2958('0x85')][_0x2958('0x87')]({'where':{'id':_0x6f44ca['query'][_0x2958('0x78')]},'attributes':['id'],'include':[{'model':db[_0x2958('0x82')],'as':_0x2958('0x88'),'attributes':['id'],'raw':!![]}]})[_0x2958('0x2b')](handleEntityNotFound(_0x1ddda5,null))[_0x2958('0x2b')](function(_0x1c926e){var _0x245a12=_['map'](_0x1c926e,'id');var _0x270846=[];var _0x1d0d0d=[];var _0xc3b770=squel[_0x2958('0x90')]();_0xc3b770[_0x2958('0x91')]('tq.TeamId')['from']('team_has_voice_prefixes','tq')[_0x2958('0x92')]('user_has_teams','ut',_0x2958('0x93'))[_0x2958('0x43')](_0x2958('0x94'),_0x6f44ca['params']['id']);for(var _0x56c6a3=0x0;_0x56c6a3<_0x1c926e[_0x2958('0x3f')];_0x56c6a3+=0x1){let _0x1fd536=_0x1c926e[_0x56c6a3];for(var _0x3fbe11=0x0;_0x3fbe11<_0x1fd536[_0x2958('0x88')][_0x2958('0x3f')];_0x3fbe11+=0x1){let _0x21c020=_0x1fd536[_0x2958('0x88')][_0x3fbe11];var _0x89b78c=_0xc3b770[_0x2958('0x95')]();_0x89b78c[_0x2958('0x43')](_0x2958('0x96'),_0x21c020['id']);_0x1d0d0d[_0x2958('0x6d')](db[_0x2958('0x54')][_0x2958('0x3b')](_0x89b78c[_0x2958('0x97')](),{'type':db[_0x2958('0x54')][_0x2958('0x98')][_0x2958('0x99')]})[_0x2958('0x2b')](function(_0x729aaf){if(_0x729aaf[_0x2958('0x3f')]===0x1){return _0x21c020['id'];}else{var _0x362837=_['every'](_[_0x2958('0x35')](_0x729aaf,_0x2958('0x9a')),function(_0x33af4f){return _[_0x2958('0x9b')](_0x245a12,_0x33af4f);});if(_0x362837){return _0x21c020['id'];}}}));}}return BPromise['all'](_0x1d0d0d)[_0x2958('0x2b')](function(_0x119ff3){_0x270846=_(_0x270846)['union'](_0x119ff3)['compact']()['value']();return db[_0x2958('0x4a')]['find']({'where':{'id':_0x6f44ca[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](function(_0x26c52f){return db['sequelize'][_0x2958('0x75')](function(_0x2355a0){return _0x26c52f[_0x2958('0x8f')](_0x6f44ca[_0x2958('0x3b')][_0x2958('0x78')],{'transaction':_0x2355a0})[_0x2958('0x2b')](function(){if(!_[_0x2958('0x9c')](_0x270846)){return _0x26c52f[_0x2958('0x7d')](_0x270846,{'transaction':_0x2355a0});}})['then'](function(){_0x270846['forEach'](function(_0x1c5d40){socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':_0x1c5d40,'VoicePrefixId':_0x26c52f['id']});});});});});});})[_0x2958('0x2b')](respondWithStatusCode(_0x1ddda5,null))[_0x2958('0x4d')](handleError(_0x1ddda5,null));}; \ No newline at end of file +var _0x93e9=['VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','length','charAt','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','options','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','catch','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','appdata','prefix','NoOp'];(function(_0x41ae89,_0x1abd01){var _0x4ff9a8=function(_0x59daec){while(--_0x59daec){_0x41ae89['push'](_0x41ae89['shift']());}};_0x4ff9a8(++_0x1abd01);}(_0x93e9,0xcc));var _0x993e=function(_0x1ff35e,_0x4f49a8){_0x1ff35e=_0x1ff35e-0x0;var _0x74c1cf=_0x93e9[_0x1ff35e];return _0x74c1cf;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){var _0x52b727=_0x4fe471[_0x993e('0x2d')]({'plain':!![]});var _0x4f5cc1=_0x993e('0x2e');return db[_0x993e('0x2f')][_0x993e('0x2c')]({'where':{'type':_0x4f5cc1,'resourceId':_0x52b727['id']}})[_0x993e('0x2b')](function(){return _0x4fe471;});})['then'](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x466d63,_0x4a4f00){return function(_0x223af0){if(!_0x223af0){_0x466d63[_0x993e('0x1e')](0x194);}return _0x223af0;};}function handleError(_0x248354,_0x4c5ee3){_0x4c5ee3=_0x4c5ee3||0x1f4;return function(_0x2495b7){logger[_0x993e('0x30')](_0x2495b7[_0x993e('0x31')]);if(_0x2495b7[_0x993e('0x32')]){delete _0x2495b7[_0x993e('0x32')];}_0x248354['status'](_0x4c5ee3)[_0x993e('0x33')](_0x2495b7);};}exports['index']=function(_0x782298,_0x5ba163){var _0x1da357={},_0x567ed4={},_0x3b9c3c={'count':0x0,'rows':[]};var _0x2ce5d5=_[_0x993e('0x34')](db[_0x993e('0x35')][_0x993e('0x36')],function(_0x360e2d){return{'name':_0x360e2d['fieldName'],'type':_0x360e2d[_0x993e('0x37')]['key']};});_0x567ed4['model']=_[_0x993e('0x34')](_0x2ce5d5,'name');_0x567ed4[_0x993e('0x38')]=_[_0x993e('0x39')](_0x782298[_0x993e('0x38')]);_0x567ed4[_0x993e('0x3a')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],_0x567ed4[_0x993e('0x38')]);_0x1da357[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x782298[_0x993e('0x38')][_0x993e('0x3e')]));_0x1da357[_0x993e('0x3d')]=_0x1da357[_0x993e('0x3d')]['length']?_0x1da357[_0x993e('0x3d')]:_0x567ed4[_0x993e('0x3c')];if(!_0x782298[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1da357[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x782298[_0x993e('0x38')][_0x993e('0x24')]);_0x1da357['offset']=qs[_0x993e('0x22')](_0x782298['query'][_0x993e('0x22')]);}_0x1da357[_0x993e('0x41')]=qs[_0x993e('0x42')](_0x782298[_0x993e('0x38')][_0x993e('0x42')]);_0x1da357[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x782298['query'],_0x567ed4[_0x993e('0x3a')]),_0x2ce5d5);if(_0x782298['query'][_0x993e('0x45')]){_0x1da357['where']=_[_0x993e('0x46')](_0x1da357[_0x993e('0x43')],{'$or':_[_0x993e('0x34')](_0x2ce5d5,function(_0x1f1327){if(_0x1f1327[_0x993e('0x37')]!==_0x993e('0x47')){var _0xb728cf={};_0xb728cf[_0x1f1327[_0x993e('0x32')]]={'$like':'%'+_0x782298['query'][_0x993e('0x45')]+'%'};return _0xb728cf;}})});}_0x1da357=_['merge']({},_0x1da357,_0x782298['options']);var _0x1a2712={'where':_0x1da357[_0x993e('0x43')]};return db[_0x993e('0x35')]['count'](_0x1a2712)[_0x993e('0x2b')](function(_0x40719d){_0x3b9c3c[_0x993e('0x25')]=_0x40719d;if(_0x782298['query']['includeAll']){_0x1da357['include']=[{'all':!![]}];}return db[_0x993e('0x35')][_0x993e('0x48')](_0x1da357);})[_0x993e('0x2b')](function(_0x539c9d){_0x3b9c3c[_0x993e('0x49')]=_0x539c9d;return _0x3b9c3c;})[_0x993e('0x2b')](respondWithFilteredResult(_0x5ba163,_0x1da357))['catch'](handleError(_0x5ba163,null));};exports[_0x993e('0x4a')]=function(_0x5f7563,_0x5074a6){var _0x258795={'raw':![],'where':{'id':_0x5f7563[_0x993e('0x4b')]['id']}},_0x576ea={};_0x576ea['model']=_['keys'](db['VoicePrefix'][_0x993e('0x36')]);_0x576ea[_0x993e('0x38')]=_[_0x993e('0x39')](_0x5f7563[_0x993e('0x38')]);_0x576ea['filters']=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],_0x576ea[_0x993e('0x38')]);_0x258795[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],qs['fields'](_0x5f7563['query'][_0x993e('0x3e')]));_0x258795[_0x993e('0x3d')]=_0x258795['attributes']['length']?_0x258795[_0x993e('0x3d')]:_0x576ea[_0x993e('0x3c')];if(_0x5f7563[_0x993e('0x38')][_0x993e('0x4c')]){_0x258795[_0x993e('0x4d')]=[{'all':!![]}];}_0x258795=_[_0x993e('0x46')]({},_0x258795,_0x5f7563['options']);return db[_0x993e('0x35')]['find'](_0x258795)[_0x993e('0x2b')](handleEntityNotFound(_0x5074a6,null))[_0x993e('0x2b')](respondWithResult(_0x5074a6,null))[_0x993e('0x4e')](handleError(_0x5074a6,null));};exports[_0x993e('0x2c')]=function(_0x2cba37,_0x276b99){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x2cba37['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](removeEntity(_0x276b99,null))[_0x993e('0x4e')](handleError(_0x276b99,null));};exports['describe']=function(_0x355912,_0x53c1e9){return db[_0x993e('0x35')][_0x993e('0x50')]()['then'](respondWithResult(_0x53c1e9,null))[_0x993e('0x4e')](handleError(_0x53c1e9,null));};exports[_0x993e('0x51')]=function(_0x579c43,_0x3809ef){var _0x207e27;return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x2e368e){return db['VoicePrefix']['create'](_0x579c43['body'],{'transaction':_0x2e368e})[_0x993e('0x2b')](function(_0x29f8a5){_0x207e27=_0x29f8a5[_0x993e('0x2d')]({'plain':!![]});return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x207e27[_0x993e('0x55')]},'raw':!![]})['then'](function(_0x3a897d){return createVoicePrefixExtensions(_0x207e27,_0x3a897d,_0x2e368e);});});})[_0x993e('0x2b')](function(){var _0x15c8ed=_0x579c43['user'][_0x993e('0x2d')]({'plain':!![]});if(!_0x15c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8ed['role']===_0x993e('0x56')){var _0x37d7b1=_0x207e27;return db['UserProfileSection'][_0x993e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x15c8ed[_0x993e('0x57')]},'raw':!![]})[_0x993e('0x2b')](function(_0x4a0dbd){if(_0x4a0dbd&&_0x4a0dbd['autoAssociation']===0x0){return db[_0x993e('0x2f')][_0x993e('0x51')]({'name':_0x37d7b1[_0x993e('0x32')],'resourceId':_0x37d7b1['id'],'type':_0x4a0dbd[_0x993e('0x32')],'sectionId':_0x4a0dbd['id']},{})[_0x993e('0x2b')](function(){return _0x207e27;});}else{return _0x207e27;}})[_0x993e('0x4e')](function(_0x4f9225){logger[_0x993e('0x30')](_0x993e('0x58'),_0x4f9225);throw _0x4f9225;});}return _0x207e27;})['then'](respondWithResult(_0x3809ef,null))[_0x993e('0x4e')](handleError(_0x3809ef,null));};function Extension(_0x473e00,_0x1b2113,_0x5ebaec,_0x426341){this[_0x993e('0x59')]=_0x993e('0x5a');this['exten']=_0x473e00;this[_0x993e('0x5b')]=_0x5ebaec;this[_0x993e('0x37')]=_0x993e('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x1b2113;this[_0x993e('0x5d')]=_0x426341;}function createVoicePrefixExtensions(_0x98d16c,_0x3a3d29,_0x411484){return new BPromise(function(_0xc62106,_0x55a347){var _0x18367f=new Extension(formatPrefixName(_0x98d16c[_0x993e('0x5e')]),0x1,_0x993e('0x5f'),'Voice\x20Prefix');_0x18367f[_0x993e('0x60')]=_0x98d16c['id'];return db[_0x993e('0x54')][_0x993e('0x51')](_0x18367f,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x5e4ab1){var _0x54417b=_0x5e4ab1[_0x993e('0x2d')]({'plain':!![]});var _0x51cec9=_['map'](addVoicePrefixExtensions(_0x98d16c,_0x3a3d29),function(_0x17c7f7){_0x17c7f7[_0x993e('0x55')]=_0x54417b['id'];_0x17c7f7[_0x993e('0x60')]=_0x98d16c['id'];return _0x17c7f7;});return db[_0x993e('0x54')][_0x993e('0x61')](_0x51cec9,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x211204){if(!_0x211204){return _0x55a347(_0x993e('0x62'));}else{return _0xc62106(_0x211204);}})[_0x993e('0x4e')](function(_0x113395){return _0x55a347(_0x113395);});});;});};function addVoicePrefixExtensions(_0x300a93,_0x44def2){var _0x2ddc16=[];var _0x609430=formatPrefixName(_0x300a93[_0x993e('0x5e')]);_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x2,'Set',_0x993e('0x64')+_0x300a93[_0x993e('0x32')]));if(_0x300a93['callerIdAll']){_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'Set',_0x993e('0x65')+_0x300a93[_0x993e('0x66')]));}else{_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'NoOp',_0x993e('0x67')));}_0x2ddc16['push'](new Extension(_0x609430,0x4,'goto',_0x44def2[_0x993e('0x59')]+','+_0x993e('0x68')+(0x8+_0x300a93[_0x993e('0x32')][_0x993e('0x69')])+'}'+','+0x1));return _0x2ddc16;}function formatPrefixName(_0x2a243a){var _0x5194de='_';for(var _0x120d51=0x0;_0x120d51<_0x2a243a[_0x993e('0x69')];_0x120d51++){if(_0x2a243a[_0x993e('0x6a')](_0x120d51)=='-'){_0x5194de+=_0x2a243a['charAt'](_0x120d51);}else{_0x5194de+='['+_0x2a243a[_0x993e('0x6a')](_0x120d51)+']';}}_0x5194de+='.';return _0x5194de;}exports['update']=function(_0x1ab10e,_0x6ef96,_0x42288d){var _0x5afba1=_0x1ab10e[_0x993e('0x6b')];_0x5afba1[_0x993e('0x5e')]=_0x993e('0x6c')+_0x5afba1[_0x993e('0x32')]+'-';return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x108cad){return db[_0x993e('0x35')][_0x993e('0x2a')](_0x5afba1,{'where':{'id':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db['VoiceExtension'][_0x993e('0x2c')]({'where':{'VoicePrefixId':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x5afba1[_0x993e('0x55')]},'raw':!![]})[_0x993e('0x2b')](function(_0x282c53){return createVoicePrefixExtensions(_0x5afba1,_0x282c53,_0x108cad);});});});})[_0x993e('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5afba1['id']);})[_0x993e('0x2b')](respondWithResult(_0x6ef96,null))['catch'](handleError(_0x6ef96,null));};exports[_0x993e('0x6d')]=function(_0x444da6,_0x2ce913,_0x49788e){return db[_0x993e('0x35')]['find']({'where':{'id':_0x444da6[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x2ce913,null))[_0x993e('0x2b')](function(_0x40768a){if(_0x40768a){return _0x40768a[_0x993e('0x6d')](_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')],_[_0x993e('0x6f')](_0x444da6['body'],['ids','id'])||{})[_0x993e('0x70')](function(_0x5a70ff){for(var _0x2fb182=0x0;_0x2fb182<_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x993e('0x69')];_0x2fb182+=0x1){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':Number(_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x2fb182]),'VoicePrefixId':Number(_0x444da6[_0x993e('0x4b')]['id'])});}return _0x5a70ff;});}})[_0x993e('0x2b')](respondWithResult(_0x2ce913,null))['catch'](handleError(_0x2ce913,null));};exports[_0x993e('0x73')]=function(_0x14347f,_0x4a0002,_0x4742d9){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x14347f[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x4a0002,null))[_0x993e('0x2b')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6[_0x993e('0x73')](_0x14347f[_0x993e('0x38')]['ids'])[_0x993e('0x2b')](function(){if(_[_0x993e('0x74')](_0x14347f[_0x993e('0x38')][_0x993e('0x6e')])){for(var _0x53ce16=0x0;_0x53ce16<_0x14347f['query'][_0x993e('0x6e')]['length'];_0x53ce16+=0x1){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')][_0x53ce16]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}}else{socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a0002,null))[_0x993e('0x4e')](handleError(_0x4a0002,null));};exports[_0x993e('0x76')]=function(_0x3abd3a,_0x278c2a,_0x3f6347){var _0x1a3967={};var _0x1079e7={};var _0x5c634a;var _0x47c3b6;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x3abd3a[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x278c2a,null))[_0x993e('0x2b')](function(_0x53b0c8){if(_0x53b0c8){_0x5c634a=_0x53b0c8;_0x1079e7['model']=_['keys'](db[_0x993e('0x78')][_0x993e('0x36')]);_0x1079e7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x3abd3a[_0x993e('0x38')]);_0x1079e7['filters']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],_0x1079e7[_0x993e('0x38')]);_0x1a3967['attributes']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x3e')]));_0x1a3967[_0x993e('0x3d')]=_0x1a3967['attributes'][_0x993e('0x69')]?_0x1a3967['attributes']:_0x1079e7['model'];_0x1a3967['order']=qs['sort'](_0x3abd3a[_0x993e('0x38')][_0x993e('0x42')]);_0x1a3967[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x3abd3a[_0x993e('0x38')],_0x1079e7[_0x993e('0x3a')]));if(_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]){_0x1a3967['where']=_[_0x993e('0x46')](_0x1a3967['where'],{'$or':_[_0x993e('0x34')](_0x1a3967[_0x993e('0x3d')],function(_0x3e7793){var _0x65c6f0={};_0x65c6f0[_0x3e7793]={'$like':'%'+_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x65c6f0;})});}_0x1a3967=_[_0x993e('0x46')]({},_0x1a3967,_0x3abd3a['options']);return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})[_0x993e('0x2b')](function(_0x285c93){if(_0x285c93){_0x47c3b6=_0x285c93['length'];if(!_0x3abd3a[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1a3967['limit']=qs[_0x993e('0x24')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x24')]);_0x1a3967[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x22')]);}return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})['then'](function(_0x412d21){if(_0x412d21){return _0x412d21?{'count':_0x47c3b6,'rows':_0x412d21}:null;}})['then'](respondWithResult(_0x278c2a,null))[_0x993e('0x4e')](handleError(_0x278c2a,null));};exports[_0x993e('0x79')]=function(_0x4d6d94,_0x505f28,_0x4e2ccf){var _0x4506cb={};var _0x31e947={};var _0x7800d4;var _0x4e1fcf;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x4d6d94[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x505f28,null))['then'](function(_0xc35545){if(_0xc35545){_0x7800d4=_0xc35545;_0x31e947['model']=_[_0x993e('0x39')](db['Team']['rawAttributes']);_0x31e947[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4d6d94[_0x993e('0x38')]);_0x31e947[_0x993e('0x3a')]=_['intersection'](_0x31e947['model'],_0x31e947['query']);_0x4506cb[_0x993e('0x3d')]=_['intersection'](_0x31e947[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x3e')]));_0x4506cb[_0x993e('0x3d')]=_0x4506cb['attributes'][_0x993e('0x69')]?_0x4506cb[_0x993e('0x3d')]:_0x31e947['model'];_0x4506cb[_0x993e('0x41')]=qs['sort'](_0x4d6d94[_0x993e('0x38')][_0x993e('0x42')]);_0x4506cb[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x4d6d94[_0x993e('0x38')],_0x31e947[_0x993e('0x3a')]));if(_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]){_0x4506cb['where']=_[_0x993e('0x46')](_0x4506cb['where'],{'$or':_[_0x993e('0x34')](_0x4506cb[_0x993e('0x3d')],function(_0x50dd66){var _0x48acd5={};_0x48acd5[_0x50dd66]={'$like':'%'+_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x48acd5;})});}_0x4506cb=_['merge']({},_0x4506cb,_0x4d6d94[_0x993e('0x7a')]);return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0xc56e5a){if(_0xc56e5a){_0x4e1fcf=_0xc56e5a['length'];if(!_0x4d6d94[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x4506cb[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x4d6d94['query'][_0x993e('0x24')]);_0x4506cb[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x22')]);}return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0x5d2b00){if(_0x5d2b00){return _0x5d2b00?{'count':_0x4e1fcf,'rows':_0x5d2b00}:null;}})[_0x993e('0x2b')](respondWithResult(_0x505f28,null))['catch'](handleError(_0x505f28,null));};exports[_0x993e('0x7b')]=function(_0x8dc65,_0x4a5755,_0x43b5c5){var _0x4d53d1=_0x8dc65['body'][_0x993e('0x6e')];var _0x371be2;return db['Team'][_0x993e('0x48')]({'where':{'id':_0x4d53d1},'attributes':['id'],'include':[{'model':db[_0x993e('0x78')],'as':_0x993e('0x7c'),'attributes':['id',_0x993e('0x32'),'online',_0x993e('0x7d'),'interface'],'raw':!![]}]})[_0x993e('0x2b')](function(_0x5c9960){if(_0x5c9960){_0x371be2=_0x5c9960;var _0x4286a0=_[_0x993e('0x7e')](_0x5c9960,function(_0x2540e4){var _0x56a23a=_0x2540e4['get']({'plain':!![]});return _0x56a23a[_0x993e('0x7c')];});return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x8dc65[_0x993e('0x4b')]['id']}})['then'](function(_0x37409f){return db['sequelize'][_0x993e('0x53')](function(_0xa16043){return _0x37409f[_0x993e('0x7b')](_0x4d53d1,{'transaction':_0xa16043})['then'](function(){return BPromise[_0x993e('0x7f')](_0x371be2,function(_0x30f7a3){return db[_0x993e('0x80')][_0x993e('0x81')]({'TeamId':_0x30f7a3['id'],'VoicePrefixId':_0x8dc65[_0x993e('0x4b')]['id']},{'transaction':_0xa16043});});})[_0x993e('0x2b')](function(){return BPromise[_0x993e('0x7f')](_0x4286a0,function(_0x3e61d2){return db[_0x993e('0x82')]['findOrCreate']({'where':{'UserId':_0x3e61d2['id'],'VoicePrefixId':_0x8dc65['params']['id']},'transaction':_0xa16043});});})['then'](function(){_0x4286a0[_0x993e('0x83')](function(_0x47c230){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':_0x47c230['id'],'VoicePrefixId':_0x37409f['id']});});});});});}})[_0x993e('0x2b')](respondWithStatusCode(_0x4a5755,null))[_0x993e('0x4e')](handleError(_0x4a5755,null));};exports['removeTeams']=function(_0x548dfb,_0x123dcd,_0x4e7340){return db[_0x993e('0x84')][_0x993e('0x48')]({'where':{'id':_0x548dfb[_0x993e('0x38')][_0x993e('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x993e('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123dcd,null))['then'](function(_0x242374){var _0x1a3779=_[_0x993e('0x34')](_0x242374,'id');var _0x366809=[];var _0x11ba3a=[];var _0x1b2ca0=squel[_0x993e('0x85')]();_0x1b2ca0[_0x993e('0x86')](_0x993e('0x87'))[_0x993e('0x88')](_0x993e('0x89'),'tq')[_0x993e('0x8a')]('user_has_teams','ut',_0x993e('0x8b'))[_0x993e('0x43')](_0x993e('0x8c'),_0x548dfb[_0x993e('0x4b')]['id']);for(var _0x23ecf0=0x0;_0x23ecf0<_0x242374[_0x993e('0x69')];_0x23ecf0+=0x1){let _0x2fcfaa=_0x242374[_0x23ecf0];for(var _0x5303c9=0x0;_0x5303c9<_0x2fcfaa[_0x993e('0x7c')]['length'];_0x5303c9+=0x1){let _0x5d5dc8=_0x2fcfaa[_0x993e('0x7c')][_0x5303c9];var _0x102393=_0x1b2ca0[_0x993e('0x8d')]();_0x102393['where'](_0x993e('0x8e'),_0x5d5dc8['id']);_0x11ba3a[_0x993e('0x63')](db[_0x993e('0x52')][_0x993e('0x38')](_0x102393[_0x993e('0x8f')](),{'type':db[_0x993e('0x52')][_0x993e('0x90')]['SELECT']})[_0x993e('0x2b')](function(_0x6ee3c0){if(_0x6ee3c0['length']===0x1){return _0x5d5dc8['id'];}else{var _0x58fee1=_[_0x993e('0x91')](_[_0x993e('0x34')](_0x6ee3c0,_0x993e('0x92')),function(_0x2f0669){return _[_0x993e('0x93')](_0x1a3779,_0x2f0669);});if(_0x58fee1){return _0x5d5dc8['id'];}}}));}}return BPromise['all'](_0x11ba3a)[_0x993e('0x2b')](function(_0x3725b5){_0x366809=_(_0x366809)['union'](_0x3725b5)[_0x993e('0x94')]()['value']();return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x548dfb['params']['id']}})[_0x993e('0x2b')](function(_0x5ee2e0){return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x289772){return _0x5ee2e0['removeTeams'](_0x548dfb['query'][_0x993e('0x6e')],{'transaction':_0x289772})[_0x993e('0x2b')](function(){if(!_[_0x993e('0x95')](_0x366809)){return _0x5ee2e0[_0x993e('0x73')](_0x366809,{'transaction':_0x289772});}})[_0x993e('0x2b')](function(){_0x366809[_0x993e('0x83')](function(_0x366f8f){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':_0x366f8f,'VoicePrefixId':_0x5ee2e0['id']});});});});});});})['then'](respondWithStatusCode(_0x123dcd,null))[_0x993e('0x4e')](handleError(_0x123dcd,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e1c3be6..9938dfc 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 _0xd4dd=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0xa95335,_0x4624d6){var _0x40c0e4=function(_0xfb6d27){while(--_0xfb6d27){_0xa95335['push'](_0xa95335['shift']());}};_0x40c0e4(++_0x4624d6);}(_0xd4dd,0x1b9));var _0xdd4d=function(_0x12eb9d,_0x5ef700){_0x12eb9d=_0x12eb9d-0x0;var _0xa03912=_0xd4dd[_0x12eb9d];return _0xa03912;};'use strict';var EventEmitter=require(_0xdd4d('0x0'));var VoicePrefix=require(_0xdd4d('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdd4d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdd4d('0x3')};function emitEvent(_0x3cf296){return function(_0xabbe29,_0x42f68d,_0x453d42){VoicePrefixEvents[_0xdd4d('0x4')](_0x3cf296+':'+_0xabbe29['id'],_0xabbe29);VoicePrefixEvents[_0xdd4d('0x4')](_0x3cf296,_0xabbe29);_0x453d42(null);};}for(var e in events){if(events[_0xdd4d('0x5')](e)){var event=events[e];VoicePrefix[_0xdd4d('0x6')](e,emitEvent(event));}}module[_0xdd4d('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xab2b=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0xae6826,_0x117d66){var _0x2303db=function(_0x322f75){while(--_0x322f75){_0xae6826['push'](_0xae6826['shift']());}};_0x2303db(++_0x117d66);}(_0xab2b,0x1c9));var _0xbab2=function(_0x3c49b1,_0x1aa374){_0x3c49b1=_0x3c49b1-0x0;var _0x1eacd1=_0xab2b[_0x3c49b1];return _0x1eacd1;};'use strict';var EventEmitter=require(_0xbab2('0x0'));var VoicePrefix=require(_0xbab2('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbab2('0x2'),'afterDestroy':_0xbab2('0x3')};function emitEvent(_0x190856){return function(_0x3ea372,_0x36b641,_0x496de2){VoicePrefixEvents[_0xbab2('0x4')](_0x190856+':'+_0x3ea372['id'],_0x3ea372);VoicePrefixEvents[_0xbab2('0x4')](_0x190856,_0x3ea372);_0x496de2(null);};}for(var e in events){if(events[_0xbab2('0x5')](e)){var event=events[e];VoicePrefix[_0xbab2('0x6')](e,emitEvent(event));}}module[_0xbab2('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 78e29ba..1831dfe 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 _0x9926=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','lodash'];(function(_0x1d017b,_0x1258f6){var _0x4f4246=function(_0x42c97c){while(--_0x42c97c){_0x1d017b['push'](_0x1d017b['shift']());}};_0x4f4246(++_0x1258f6);}(_0x9926,0xe6));var _0x6992=function(_0x4fb867,_0x348fed){_0x4fb867=_0x4fb867-0x0;var _0x93bdc=_0x9926[_0x4fb867];return _0x93bdc;};'use strict';var _=require(_0x6992('0x0'));var util=require(_0x6992('0x1'));var logger=require('../../config/logger')(_0x6992('0x2'));var moment=require(_0x6992('0x3'));var BPromise=require('bluebird');var rp=require(_0x6992('0x4'));var fs=require('fs');var path=require(_0x6992('0x5'));var rimraf=require(_0x6992('0x6'));var config=require(_0x6992('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x6992('0x8')]=function(_0x484643,_0x1af416){return _0x484643[_0x6992('0x9')](_0x6992('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e7c=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes','lodash'];(function(_0x179bbf,_0x1e3a01){var _0x1297dc=function(_0x5ed61b){while(--_0x5ed61b){_0x179bbf['push'](_0x179bbf['shift']());}};_0x1297dc(++_0x1e3a01);}(_0x4e7c,0x12b));var _0xc4e7=function(_0x117cb0,_0x432f1c){_0x117cb0=_0x117cb0-0x0;var _0xadd6b1=_0x4e7c[_0x117cb0];return _0xadd6b1;};'use strict';var _=require(_0xc4e7('0x0'));var util=require(_0xc4e7('0x1'));var logger=require(_0xc4e7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4e7('0x3'));var fs=require('fs');var path=require(_0xc4e7('0x4'));var rimraf=require(_0xc4e7('0x5'));var config=require(_0xc4e7('0x6'));var attributes=require(_0xc4e7('0x7'));module[_0xc4e7('0x8')]=function(_0x27cebc,_0x4577d1){return _0x27cebc['define']('VoicePrefix',attributes,{'tableName':_0xc4e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 8905bb5..ebf16d4 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 _0xc7bd=['redis','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x11c91f,_0x52862f){var _0x223e12=function(_0x40f0fe){while(--_0x40f0fe){_0x11c91f['push'](_0x11c91f['shift']());}};_0x223e12(++_0x52862f);}(_0xc7bd,0x86));var _0xdc7b=function(_0x516c23,_0x6ebaef){_0x516c23=_0x516c23-0x0;var _0x4d466d=_0xc7bd[_0x516c23];return _0x4d466d;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var moment=require(_0xdc7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc7b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));var config=require(_0xdc7b('0x6'));var jayson=require(_0xdc7b('0x7'));var client=jayson[_0xdc7b('0x8')][_0xdc7b('0x9')]({'port':0x232a});config[_0xdc7b('0xa')]=_['defaults'](config[_0xdc7b('0xa')],{'host':_0xdc7b('0xb'),'port':0x18eb});var socket=require(_0xdc7b('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xdc7b('0xd')](socket);function respondWithRpcPromise(_0x316a19,_0x167e40,_0x295800){return new BPromise(function(_0xec8041,_0x44d499){return client['request'](_0x316a19,_0x295800)[_0xdc7b('0xe')](function(_0x359a53){logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));logger[_0xdc7b('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x167e40,_0xdc7b('0x11'),JSON[_0xdc7b('0x13')](_0x359a53));if(_0x359a53['error']){if(_0x359a53[_0xdc7b('0x14')]['code']===0x1f4){logger[_0xdc7b('0x14')](_0xdc7b('0x10'),_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0x44d499(_0x359a53['error'][_0xdc7b('0x15')]);}logger[_0xdc7b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0xec8041(_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);}else{logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));_0xec8041(_0x359a53[_0xdc7b('0x16')]['message']);}})[_0xdc7b('0x17')](function(_0x54a99b){logger[_0xdc7b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x167e40,_0x54a99b);_0x44d499(_0x54a99b);});});} \ No newline at end of file +var _0x8daf=['request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2965cc,_0xf7d9b0){var _0x2b3208=function(_0x3fa37f){while(--_0x3fa37f){_0x2965cc['push'](_0x2965cc['shift']());}};_0x2b3208(++_0xf7d9b0);}(_0x8daf,0x15c));var _0xf8da=function(_0x1711f8,_0x208f40){_0x1711f8=_0x1711f8-0x0;var _0x38ca74=_0x8daf[_0x1711f8];return _0x38ca74;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8da('0x0'));var fs=require('fs');var Redis=require(_0xf8da('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8da('0x2'));var logger=require(_0xf8da('0x3'))(_0xf8da('0x4'));var config=require(_0xf8da('0x5'));var jayson=require(_0xf8da('0x6'));var client=jayson[_0xf8da('0x7')][_0xf8da('0x8')]({'port':0x232a});config[_0xf8da('0x9')]=_[_0xf8da('0xa')](config['redis'],{'host':_0xf8da('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8da('0x9')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x2f16ba,_0x44dabc,_0xbd4f48){return new BPromise(function(_0x408b04,_0x4463eb){return client[_0xf8da('0xc')](_0x2f16ba,_0xbd4f48)[_0xf8da('0xd')](function(_0x31193e){logger['info'](_0xf8da('0xe'),_0x44dabc,_0xf8da('0xf'));logger[_0xf8da('0x10')](_0xf8da('0x11'),_0x44dabc,'request\x20sent',JSON[_0xf8da('0x12')](_0x31193e));if(_0x31193e['error']){if(_0x31193e[_0xf8da('0x13')][_0xf8da('0x14')]===0x1f4){logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x31193e[_0xf8da('0x13')]['message']);return _0x4463eb(_0x31193e[_0xf8da('0x13')][_0xf8da('0x15')]);}logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x31193e[_0xf8da('0x13')][_0xf8da('0x15')]);return _0x408b04(_0x31193e[_0xf8da('0x13')]['message']);}else{logger[_0xf8da('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x44dabc,'request\x20sent');_0x408b04(_0x31193e[_0xf8da('0x17')][_0xf8da('0x15')]);}})['catch'](function(_0x3e427){logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x3e427);_0x4463eb(_0x3e427);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index fec4940..a887574 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 _0xbf82=['remove','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x2b75c0,_0x2255ce){_0x2b75c0=_0x2b75c0-0x0;var _0x26b27e=_0xbf82[_0x2b75c0];return _0x26b27e;};'use strict';var VoicePrefixEvents=require(_0x2bf8('0x0'));var events=['save',_0x2bf8('0x1'),'update'];function createListener(_0x3d3645,_0x4289fc){return function(_0x436197){_0x4289fc['emit'](_0x3d3645,_0x436197);};}function removeListener(_0x5e2adc,_0x3e581e){return function(){VoicePrefixEvents[_0x2bf8('0x2')](_0x5e2adc,_0x3e581e);};}exports[_0x2bf8('0x3')]=function(_0x20dc19){for(var _0x19d402=0x0,_0x5a3818=events['length'];_0x19d402<_0x5a3818;_0x19d402++){var _0x1c57e9=events[_0x19d402];var _0x5c1944=createListener(_0x2bf8('0x4')+_0x1c57e9,_0x20dc19);VoicePrefixEvents['on'](_0x1c57e9,_0x5c1944);}}; \ No newline at end of file +var _0x2e35=['removeListener','register','./voicePrefix.events','save','remove','emit'];(function(_0xc554c6,_0x2cd7ff){var _0x3de674=function(_0x5cd748){while(--_0x5cd748){_0xc554c6['push'](_0xc554c6['shift']());}};_0x3de674(++_0x2cd7ff);}(_0x2e35,0x1d0));var _0x52e3=function(_0x1b49cd,_0x4260bb){_0x1b49cd=_0x1b49cd-0x0;var _0x55558e=_0x2e35[_0x1b49cd];return _0x55558e;};'use strict';var VoicePrefixEvents=require(_0x52e3('0x0'));var events=[_0x52e3('0x1'),_0x52e3('0x2'),'update'];function createListener(_0x145ad0,_0xcbe6c5){return function(_0x16d807){_0xcbe6c5[_0x52e3('0x3')](_0x145ad0,_0x16d807);};}function removeListener(_0x4ccab4,_0x158226){return function(){VoicePrefixEvents[_0x52e3('0x4')](_0x4ccab4,_0x158226);};}exports[_0x52e3('0x5')]=function(_0x20d1bc){for(var _0x5f117a=0x0,_0x483b93=events['length'];_0x5f117a<_0x483b93;_0x5f117a++){var _0x21ae13=events[_0x5f117a];var _0x4d77a0=createListener('voicePrefix:'+_0x21ae13,_0x20d1bc);VoicePrefixEvents['on'](_0x21ae13,_0x4d77a0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ce7dcb6..bda7a08 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(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xb10b,0x12a));var _0xbb10=function(_0x17b47d,_0x3136fb){_0x17b47d=_0x17b47d-0x0;var _0x3c643e=_0xb10b[_0x17b47d];return _0x3c643e;};'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(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0xb10b,0x12a));var _0xbb10=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0xb10b[_0x8ec6b4];return _0x52c0d0;};'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 d6fe678..a3b8d72 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 _0xb3c1=['getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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,*,*,*','always','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\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','setDataValue','strategy'];(function(_0x117fef,_0x1929e7){var _0x2d3c45=function(_0x590b29){while(--_0x590b29){_0x117fef['push'](_0x117fef['shift']());}};_0x2d3c45(++_0x1929e7);}(_0xb3c1,0xef));var _0x1b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1b3c('0x0'));module[_0x1b3c('0x1')]={'name':{'type':Sequelize[_0x1b3c('0x2')],'allowNull':![],'unique':_0x1b3c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x5'),_0x1b3c('0x6')),'allowNull':![],'defaultValue':_0x1b3c('0x5')},'musiconhold':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':_0x1b3c('0x7')},'announce':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1b3c('0x4')]('rr',_0x1b3c('0x8'),_0x1b3c('0x9'),'fewestcalls',_0x1b3c('0xa'),_0x1b3c('0xb'),_0x1b3c('0xc'),_0x1b3c('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0x1b3c('0x8'),'set':function(_0x37031e){this[_0x1b3c('0xe')](_0x1b3c('0xf'),_0x37031e?_0x37031e:_0x1b3c('0xb'));},'get':function(){var _0x105f9c=this[_0x1b3c('0x10')](_0x1b3c('0x11'));var _0x5032da=this['getDataValue'](_0x1b3c('0x12'));var _0x10c4c9=this[_0x1b3c('0x10')]('strategy');if(_0x105f9c==='inbound'){return _0x10c4c9;}if(_0x5032da===_0x1b3c('0x13')&&_0x10c4c9===_0x1b3c('0xb')||_0x5032da===_0x1b3c('0x13')&&_0x10c4c9==='roundrobin'){return _0x10c4c9;}if(_0x5032da===_0x1b3c('0x14')||_0x5032da===_0x1b3c('0x15')||_0x5032da===_0x1b3c('0x16')){return _0x10c4c9;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1b3c('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1b3c('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1b3c('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1b3c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1b3c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x1b3c('0x18'),'no'),'defaultValue':_0x1b3c('0x18')},'announce_holdtime':{'type':Sequelize[_0x1b3c('0x4')]('yes','no',_0x1b3c('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x1b3c('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1b3c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1b3c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1b3c('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x1b3c('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1b3c('0x1a')],'set':function(_0xaad806){this[_0x1b3c('0xe')](_0x1b3c('0x1b'),_0xaad806?_0xaad806[_0x1b3c('0x1c')](','):[]);},'get':function(){return this[_0x1b3c('0x10')](_0x1b3c('0x1b'))?this[_0x1b3c('0x10')]('periodic_announce')[_0x1b3c('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':'yes','set':function(_0x49bd81){this[_0x1b3c('0xe')]('joinempty',_0x49bd81?_0x49bd81[_0x1b3c('0x1c')](','):undefined);},'get':function(){return this[_0x1b3c('0x10')](_0x1b3c('0x1e'))?this[_0x1b3c('0x10')](_0x1b3c('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':'no','set':function(_0x590c99){this[_0x1b3c('0xe')](_0x1b3c('0x1f'),_0x590c99?_0x590c99[_0x1b3c('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x1b3c('0x1f'))?this[_0x1b3c('0x10')](_0x1b3c('0x1f'))[_0x1b3c('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1b3c('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x312ef1){this[_0x1b3c('0xe')]('acw',_0x312ef1);if(_0x312ef1){if(this[_0x1b3c('0x10')]('wrapuptime')<0x2){this[_0x1b3c('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1b3c('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1b3c('0x20')],'defaultValue':0x0,'comment':_0x1b3c('0x21')},'dialMethod':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x22'),_0x1b3c('0x14'),_0x1b3c('0x16'),_0x1b3c('0x15'),_0x1b3c('0x13')),'defaultValue':_0x1b3c('0x14'),'comment':_0x1b3c('0x23')},'dialLimitChannel':{'type':Sequelize[_0x1b3c('0x17')](0x4)[_0x1b3c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b3c('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1b3c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b3c('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x1b3c('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1b3c('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x28'),_0x1b3c('0x29')),'defaultValue':'dropRate','comment':_0x1b3c('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1b3c('0x2b')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1b3c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x1b3c('0x17')](0x3)[_0x1b3c('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1b3c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1b3c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1b3c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1b3c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':_0x1b3c('0x2f'),'comment':_0x1b3c('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x1b3c('0x17')](0x3)[_0x1b3c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1b3c('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)[_0x1b3c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1b3c('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1b3c('0x39')},'dialTimezone':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':_0x1b3c('0x3a')},'dialPrefix':{'type':Sequelize[_0x1b3c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1b3c('0x4')](_0x1b3c('0x3b'),'never',_0x1b3c('0x3c')),'defaultValue':_0x1b3c('0x3b')},'dialAMDActive':{'type':Sequelize[_0x1b3c('0x20')],'defaultValue':0x0,'comment':_0x1b3c('0x3d')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1b3c('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1b3c('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x1b3c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1b3c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b3c('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b3c('0x17')](0x9)[_0x1b3c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b3c('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b3c('0x17')](0x9)[_0x1b3c('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1b3c('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b3c('0x17')](0x9)[_0x1b3c('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1b3c('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b3c('0x17')](0x9)[_0x1b3c('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1b3c('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b3c('0x17')](0x9)[_0x1b3c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b3c('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1b3c('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x1b3c('0x20')],'defaultValue':0x0,'comment':_0x1b3c('0x46')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b3c('0x4')]('DESC','ASC'),'defaultValue':_0x1b3c('0x47')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1b3c('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1b3c('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1b3c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b3c('0x48')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1b3c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b3c('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)[_0x1b3c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x4b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1b3c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1b3c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1b3c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b3c('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b3c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b3c('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b3c('0x17')],'allowNull':!![],'comment':_0x1b3c('0x52')},'mandatoryDisposition':{'type':Sequelize[_0x1b3c('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34b292){if(!_0x34b292)this['setDataValue'](_0x1b3c('0x53'),null);this['setDataValue'](_0x1b3c('0x54'),_0x34b292);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1b3c('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1b3c('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xee9d=['rrordered','strategy','rrmemory','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','ENUM','yes','all','once','periodic_announce','join','split','joinempty','setDataValue','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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','#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','ringall','leastrecent','fewestcalls','random','wrandom'];(function(_0xe32406,_0x45e983){var _0x187a0b=function(_0x455593){while(--_0x455593){_0xe32406['push'](_0xe32406['shift']());}};_0x187a0b(++_0x45e983);}(_0xee9d,0x12d));var _0xdee9=function(_0x11ab65,_0x485611){_0x11ab65=_0x11ab65-0x0;var _0x5aaf93=_0xee9d[_0x11ab65];return _0x5aaf93;};'use strict';var Sequelize=require(_0xdee9('0x0'));module[_0xdee9('0x1')]={'name':{'type':Sequelize[_0xdee9('0x2')],'allowNull':![],'unique':_0xdee9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xdee9('0x4'),_0xdee9('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xdee9('0x6'),_0xdee9('0x7'),_0xdee9('0x8'),_0xdee9('0x9'),'rrmemory','linear',_0xdee9('0xa'),_0xdee9('0xb')),'allowNull':![],'defaultValue':_0xdee9('0x6'),'set':function(_0xa685e8){this['setDataValue'](_0xdee9('0xc'),_0xa685e8?_0xa685e8:_0xdee9('0xd'));},'get':function(){var _0x20de16=this[_0xdee9('0xe')]('type');var _0x4a7f1f=this['getDataValue'](_0xdee9('0xf'));var _0x1a822=this['getDataValue']('strategy');if(_0x20de16===_0xdee9('0x4')){return _0x1a822;}if(_0x4a7f1f===_0xdee9('0x10')&&_0x1a822===_0xdee9('0xd')||_0x4a7f1f==='booked'&&_0x1a822===_0xdee9('0x11')){return _0x1a822;}if(_0x4a7f1f===_0xdee9('0x12')||_0x4a7f1f===_0xdee9('0x13')||_0x4a7f1f===_0xdee9('0x14')){return _0x1a822;}return null;}},'servicelevel':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdee9('0x15')](0xb)},'timeout':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdee9('0x2')]},'weight':{'type':Sequelize[_0xdee9('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':_0xdee9('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xdee9('0x17'),'no',_0xdee9('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xdee9('0x16')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdee9('0x16')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdee9('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdee9('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdee9('0x16')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xdee9('0x16')]('yes','no'),'defaultValue':_0xdee9('0x17')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xdee9('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xdee9('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdee9('0x16')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdee9('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdee9('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdee9('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xdee9('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xdee9('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x393545){this['setDataValue'](_0xdee9('0x1a'),_0x393545?_0x393545[_0xdee9('0x1b')](','):[]);},'get':function(){return this[_0xdee9('0xe')](_0xdee9('0x1a'))?this['getDataValue']('periodic_announce')[_0xdee9('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':_0xdee9('0x17'),'set':function(_0x583c49){this['setDataValue'](_0xdee9('0x1d'),_0x583c49?_0x583c49['join'](','):undefined);},'get':function(){return this[_0xdee9('0xe')](_0xdee9('0x1d'))?this[_0xdee9('0xe')](_0xdee9('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x40d441){this[_0xdee9('0x1e')](_0xdee9('0x1f'),_0x40d441?_0x40d441[_0xdee9('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xdee9('0x1f'))?this[_0xdee9('0xe')](_0xdee9('0x1f'))[_0xdee9('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xdee9('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdee9('0x2')]},'description':{'type':Sequelize[_0xdee9('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x59589d){this['setDataValue']('acw',_0x59589d);if(_0x59589d){if(this[_0xdee9('0xe')]('wrapuptime')<0x2){this[_0xdee9('0x1e')](_0xdee9('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdee9('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdee9('0x21')],'defaultValue':0x0,'comment':_0xdee9('0x22')},'dialMethod':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x23'),'progressive',_0xdee9('0x14'),_0xdee9('0x13'),_0xdee9('0x10')),'defaultValue':_0xdee9('0x12'),'comment':_0xdee9('0x24')},'dialLimitChannel':{'type':Sequelize[_0xdee9('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdee9('0x25')},'dialLimitQueue':{'type':Sequelize[_0xdee9('0x15')](0x4)[_0xdee9('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xdee9('0x27')](0x2)[_0xdee9('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdee9('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xdee9('0x16')]('agentBusyFactor',_0xdee9('0x29')),'defaultValue':'dropRate','comment':_0xdee9('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdee9('0x27')](0x2)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdee9('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdee9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdee9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xdee9('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x2e')},'dialQueueProject':{'type':Sequelize[_0xdee9('0x2')],'comment':_0xdee9('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdee9('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdee9('0x35')},'dialTimezone':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':_0xdee9('0x36')},'dialPrefix':{'type':Sequelize[_0xdee9('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdee9('0x16')](_0xdee9('0x37'),'never','onlyIfOpen'),'defaultValue':_0xdee9('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xdee9('0x15')](0x9)[_0xdee9('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdee9('0x15')](0x9)[_0xdee9('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdee9('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdee9('0x15')](0x9)[_0xdee9('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdee9('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0xdee9('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdee9('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdee9('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdee9('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdee9('0x15')](0x9)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdee9('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdee9('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xdee9('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xdee9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdee9('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdee9('0x3f'),'ASC'),'defaultValue':_0xdee9('0x3f')},'dialQueueProject2':{'type':Sequelize[_0xdee9('0x2')],'comment':_0xdee9('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdee9('0x40')},'dialCutDigit':{'type':Sequelize[_0xdee9('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdee9('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x43')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdee9('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x47')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdee9('0x15')](0x5)[_0xdee9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdee9('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdee9('0x15')],'allowNull':!![],'comment':_0xdee9('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xdee9('0x21')],'defaultValue':![],'comment':_0xdee9('0x4b'),'set':function(_0x33d10d){if(!_0x33d10d)this['setDataValue'](_0xdee9('0x4c'),null);this[_0xdee9('0x1e')](_0xdee9('0x4d'),_0x33d10d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdee9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdee9('0x15')](0x3)[_0xdee9('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xdee9('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5d679ca..5833b52 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 _0x6ad4=['rimraf','fast-json-patch','request-promise','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','redis','defaults','localhost','./voiceQueue.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','autoAssociation','getHoppers','keys','CmHopper','pick','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','flatMap','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','penalty','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','all','union','compact','isEmpty','UserVoiceQueueRt','forEach','userVoiceQueue:remove','addAgents','spread','online','interface','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','NOW()','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists'];(function(_0x2f3757,_0x156a1c){var _0x583d19=function(_0x2517b9){while(--_0x2517b9){_0x2f3757['push'](_0x2f3757['shift']());}};_0x583d19(++_0x156a1c);}(_0x6ad4,0xb8));var _0x46ad=function(_0x47307e,_0x4bfd20){_0x47307e=_0x47307e-0x0;var _0x2640fd=_0x6ad4[_0x47307e];return _0x2640fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46ad('0x1'));var rp=require(_0x46ad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x46ad('0x3'));var csv=require(_0x46ad('0x4'));var ejs=require(_0x46ad('0x5'));var fs=require('fs');var fs_extra=require(_0x46ad('0x6'));var _=require(_0x46ad('0x7'));var squel=require(_0x46ad('0x8'));var crypto=require('crypto');var jsforce=require(_0x46ad('0x9'));var deskjs=require(_0x46ad('0xa'));var toCsv=require(_0x46ad('0x4'));var querystring=require(_0x46ad('0xb'));var Papa=require(_0x46ad('0xc'));var Redis=require(_0x46ad('0xd'));var authService=require(_0x46ad('0xe'));var qs=require(_0x46ad('0xf'));var as=require(_0x46ad('0x10'));var hardwareService=require(_0x46ad('0x11'));var logger=require(_0x46ad('0x12'))(_0x46ad('0x13'));var utils=require(_0x46ad('0x14'));var config=require(_0x46ad('0x15'));var licenseUtil=require(_0x46ad('0x16'));var db=require(_0x46ad('0x17'))['db'];config[_0x46ad('0x18')]=_[_0x46ad('0x19')](config['redis'],{'host':_0x46ad('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46ad('0x18')]));require(_0x46ad('0x1b'))[_0x46ad('0x1c')](socket);function respondWithStatusCode(_0x9deef6,_0x4e47bb){_0x4e47bb=_0x4e47bb||0xcc;return function(_0x143b4e){if(_0x143b4e){return _0x9deef6['sendStatus'](_0x4e47bb);}return _0x9deef6[_0x46ad('0x1d')](_0x4e47bb)['end']();};}function respondWithResult(_0x111d25,_0xd3cc5a){_0xd3cc5a=_0xd3cc5a||0xc8;return function(_0x81fda1){if(_0x81fda1){return _0x111d25[_0x46ad('0x1d')](_0xd3cc5a)[_0x46ad('0x1e')](_0x81fda1);}};}function respondWithFilteredResult(_0x363d27,_0x516b71){return function(_0x12d39f){if(_0x12d39f){var _0x5831c7=typeof _0x516b71[_0x46ad('0x1f')]===_0x46ad('0x20')&&typeof _0x516b71[_0x46ad('0x21')]===_0x46ad('0x20');var _0x17fd1e=_0x12d39f[_0x46ad('0x22')];var _0x4d0ee0=_0x5831c7?0x0:_0x516b71[_0x46ad('0x1f')];var _0x21c1fe=_0x5831c7?_0x12d39f[_0x46ad('0x22')]:_0x516b71[_0x46ad('0x1f')]+_0x516b71[_0x46ad('0x21')];var _0x3640b2;if(_0x21c1fe>=_0x17fd1e){_0x21c1fe=_0x17fd1e;_0x3640b2=0xc8;}else{_0x3640b2=0xce;}_0x363d27[_0x46ad('0x1d')](_0x3640b2);return _0x363d27['set'](_0x46ad('0x23'),_0x4d0ee0+'-'+_0x21c1fe+'/'+_0x17fd1e)['json'](_0x12d39f);}return null;};}function patchUpdates(_0x9b6076){return function(_0x47776f){try{jsonpatch[_0x46ad('0x24')](_0x47776f,_0x9b6076,!![]);}catch(_0x251273){return BPromise[_0x46ad('0x25')](_0x251273);}return _0x47776f[_0x46ad('0x26')]();};}function saveUpdates(_0xf7f370,_0x5060b5){return function(_0xd8a0cb){if(_0xd8a0cb){return _0xd8a0cb[_0x46ad('0x27')](_0xf7f370)[_0x46ad('0x28')](function(_0x159c8b){return _0x159c8b;});}return null;};}function removeEntity(_0x4ecfb7,_0x4e1c49){return function(_0x8627e1){if(_0x8627e1){return _0x8627e1[_0x46ad('0x29')]()[_0x46ad('0x28')](function(){var _0xe61e5c=_0x8627e1[_0x46ad('0x2a')]({'plain':!![]});var _0x2f44f3=[{'name':_0x46ad('0x2b'),'value':_0x46ad('0x2c'),'ignore':![]},{'name':_0x46ad('0x2d'),'value':_0x46ad('0x2e'),'ignore':![]}];var _0x1e24ae=_(_0x2f44f3)[_0x46ad('0x2f')]('ignore')[_0x46ad('0x30')]('value')[_0x46ad('0x31')]();if(_[_0x46ad('0x32')](_0x1e24ae,_0xe61e5c[_0x46ad('0x33')])){return;}var _0x4d0d9e=_[_0x46ad('0x34')](_0x2f44f3,[_0x46ad('0x31'),_0xe61e5c[_0x46ad('0x33')]])[_0x46ad('0x35')];return db[_0x46ad('0x36')][_0x46ad('0x29')]({'where':{'type':_0x4d0d9e,'resourceId':_0xe61e5c['id']}})['then'](function(){return _0x8627e1;});})['then'](function(){_0x4ecfb7[_0x46ad('0x1d')](0xcc)[_0x46ad('0x37')]();});}};}function handleEntityNotFound(_0x5946fa,_0x505b21){return function(_0x384cfd){if(!_0x384cfd){_0x5946fa[_0x46ad('0x38')](0x194);}return _0x384cfd;};}function handleError(_0x5009e,_0x3621c8){_0x3621c8=_0x3621c8||0x1f4;return function(_0x4af8b4){logger[_0x46ad('0x39')](_0x4af8b4[_0x46ad('0x3a')]);if(_0x4af8b4[_0x46ad('0x35')]){delete _0x4af8b4[_0x46ad('0x35')];}_0x5009e[_0x46ad('0x1d')](_0x3621c8)[_0x46ad('0x3b')](_0x4af8b4);};}exports[_0x46ad('0x3c')]=function(_0x43d37b,_0x149761){var _0x28f164={},_0x84cf15={},_0x354130={'count':0x0,'rows':[]};var _0x1edbaa=_[_0x46ad('0x30')](db[_0x46ad('0x3d')][_0x46ad('0x3e')],function(_0x5926c5){return{'name':_0x5926c5['fieldName'],'type':_0x5926c5[_0x46ad('0x33')]['key']};});_0x84cf15[_0x46ad('0x3f')]=_[_0x46ad('0x30')](_0x1edbaa,_0x46ad('0x35'));_0x84cf15[_0x46ad('0x40')]=_['keys'](_0x43d37b[_0x46ad('0x40')]);_0x84cf15[_0x46ad('0x41')]=_[_0x46ad('0x42')](_0x84cf15['model'],_0x84cf15[_0x46ad('0x40')]);_0x28f164[_0x46ad('0x43')]=_['intersection'](_0x84cf15[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x43d37b[_0x46ad('0x40')][_0x46ad('0x44')]));_0x28f164['attributes']=_0x28f164[_0x46ad('0x43')][_0x46ad('0x45')]?_0x28f164[_0x46ad('0x43')]:_0x84cf15[_0x46ad('0x3f')];if(!_0x43d37b['query'][_0x46ad('0x46')](_0x46ad('0x47'))){_0x28f164[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x43d37b[_0x46ad('0x40')][_0x46ad('0x21')]);_0x28f164['offset']=qs[_0x46ad('0x1f')](_0x43d37b[_0x46ad('0x40')][_0x46ad('0x1f')]);}_0x28f164[_0x46ad('0x48')]=qs['sort'](_0x43d37b[_0x46ad('0x40')][_0x46ad('0x49')]);_0x28f164[_0x46ad('0x4a')]=qs[_0x46ad('0x41')](_['pick'](_0x43d37b[_0x46ad('0x40')],_0x84cf15['filters']),_0x1edbaa);if(_0x43d37b[_0x46ad('0x40')]['filter']){_0x28f164[_0x46ad('0x4a')]=_[_0x46ad('0x4b')](_0x28f164[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x1edbaa,function(_0x8b9754){if(_0x8b9754[_0x46ad('0x33')]!==_0x46ad('0x4c')){var _0x217374={};_0x217374[_0x8b9754[_0x46ad('0x35')]]={'$like':'%'+_0x43d37b['query'][_0x46ad('0x2f')]+'%'};return _0x217374;}})});}_0x28f164=_[_0x46ad('0x4b')]({},_0x28f164,_0x43d37b[_0x46ad('0x4d')]);var _0x5195ce={'where':_0x28f164[_0x46ad('0x4a')]};return db[_0x46ad('0x3d')][_0x46ad('0x22')](_0x5195ce)[_0x46ad('0x28')](function(_0x4c3648){_0x354130[_0x46ad('0x22')]=_0x4c3648;if(_0x43d37b[_0x46ad('0x40')][_0x46ad('0x4e')]){_0x28f164[_0x46ad('0x4f')]=[{'all':!![]}];}return db[_0x46ad('0x3d')][_0x46ad('0x50')](_0x28f164);})[_0x46ad('0x28')](function(_0x1a8db4){_0x354130[_0x46ad('0x51')]=_0x1a8db4;return _0x354130;})[_0x46ad('0x28')](respondWithFilteredResult(_0x149761,_0x28f164))[_0x46ad('0x52')](handleError(_0x149761,null));};exports[_0x46ad('0x53')]=function(_0x147916,_0x2ab9ea){var _0x14ce5e={'raw':![],'where':{'id':_0x147916[_0x46ad('0x54')]['id']}},_0x42be17={};_0x42be17[_0x46ad('0x3f')]=_['keys'](db[_0x46ad('0x3d')][_0x46ad('0x3e')]);_0x42be17[_0x46ad('0x40')]=_['keys'](_0x147916[_0x46ad('0x40')]);_0x42be17[_0x46ad('0x41')]=_[_0x46ad('0x42')](_0x42be17[_0x46ad('0x3f')],_0x42be17['query']);_0x14ce5e[_0x46ad('0x43')]=_['intersection'](_0x42be17['model'],qs[_0x46ad('0x44')](_0x147916[_0x46ad('0x40')]['fields']));_0x14ce5e['attributes']=_0x14ce5e['attributes'][_0x46ad('0x45')]?_0x14ce5e[_0x46ad('0x43')]:_0x42be17[_0x46ad('0x3f')];if(_0x147916[_0x46ad('0x40')][_0x46ad('0x4e')]){_0x14ce5e[_0x46ad('0x4f')]=[{'all':!![]}];}_0x14ce5e=_['merge']({},_0x14ce5e,_0x147916[_0x46ad('0x4d')]);return db[_0x46ad('0x3d')]['find'](_0x14ce5e)[_0x46ad('0x28')](handleEntityNotFound(_0x2ab9ea,null))[_0x46ad('0x28')](respondWithResult(_0x2ab9ea,null))[_0x46ad('0x52')](handleError(_0x2ab9ea,null));};exports[_0x46ad('0x55')]=function(_0xf55a4,_0x1b0d30){return db[_0x46ad('0x3d')]['create'](_0xf55a4[_0x46ad('0x56')],{})[_0x46ad('0x28')](function(_0x648e2e){var _0x11fa6d=_0xf55a4[_0x46ad('0x57')][_0x46ad('0x2a')]({'plain':!![]});if(!_0x11fa6d)throw new Error(_0x46ad('0x58'));if(_0x11fa6d['role']===_0x46ad('0x57')){var _0x58e9cd=_0x648e2e[_0x46ad('0x2a')]({'plain':!![]});var _0x1197a9=[{'name':'VoiceQueues','value':_0x46ad('0x2c')},{'name':_0x46ad('0x2d'),'value':_0x46ad('0x2e')}];var _0x14061d=_['find'](_0x1197a9,['value',_0x58e9cd[_0x46ad('0x33')]])[_0x46ad('0x35')];return db['UserProfileSection'][_0x46ad('0x34')]({'where':{'name':_0x14061d,'userProfileId':_0x11fa6d['userProfileId']},'raw':!![]})[_0x46ad('0x28')](function(_0x2121c6){if(_0x2121c6&&_0x2121c6['autoAssociation']===0x0){return db['UserProfileResource'][_0x46ad('0x55')]({'name':_0x58e9cd[_0x46ad('0x35')],'resourceId':_0x58e9cd['id'],'type':_0x2121c6[_0x46ad('0x35')],'sectionId':_0x2121c6['id']},{})[_0x46ad('0x28')](function(){return _0x648e2e;});}else{return _0x648e2e;}})['catch'](function(_0x4323bf){logger[_0x46ad('0x39')](_0x46ad('0x59'),_0x4323bf);throw _0x4323bf;});}return _0x648e2e;})[_0x46ad('0x28')](respondWithResult(_0x1b0d30,0xc9))['catch'](handleError(_0x1b0d30,null));};exports[_0x46ad('0x5a')]=function(_0x359785,_0x23301d){var _0x50c31f={'where':{'id':_0x359785[_0x46ad('0x54')]['id']}},_0xb96a97={};_0xb96a97['model']=_['keys'](db[_0x46ad('0x3d')][_0x46ad('0x3e')]);_0x50c31f[_0x46ad('0x43')]=_[_0x46ad('0x42')](_0xb96a97['model'],qs[_0x46ad('0x44')](_0x359785[_0x46ad('0x40')][_0x46ad('0x44')]));_0x50c31f[_0x46ad('0x43')]=_0x50c31f[_0x46ad('0x43')][_0x46ad('0x45')]?_0x50c31f[_0x46ad('0x43')]:_0xb96a97[_0x46ad('0x3f')];if(_0x359785['query'][_0x46ad('0x4e')]){_0x50c31f['include']=[{'all':!![]}];}_0x50c31f=_[_0x46ad('0x4b')]({},_0x50c31f,_0x359785[_0x46ad('0x4d')]);return db[_0x46ad('0x3d')][_0x46ad('0x34')](_0x50c31f)[_0x46ad('0x28')](handleEntityNotFound(_0x23301d,null))['then'](function(_0x4d47d5){if(_0x4d47d5){var _0x5ad801=_0x4d47d5[_0x46ad('0x2a')]({'plain':!![]});_0x5ad801=qs[_0x46ad('0x5b')](_0x5ad801,['id',_0x46ad('0x5c'),_0x46ad('0x5d')]);_0x359785[_0x46ad('0x56')]=_[_0x46ad('0x5b')](_0x359785[_0x46ad('0x56')],['id',_0x46ad('0x5c'),_0x46ad('0x5d')]);return db['VoiceQueue'][_0x46ad('0x55')](_[_0x46ad('0x4b')](_0x5ad801,_0x359785[_0x46ad('0x56')]),{'include':_0x359785[_0x46ad('0x40')][_0x46ad('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x1c77f6){var _0x5dfcdd=_0x359785[_0x46ad('0x57')][_0x46ad('0x2a')]({'plain':!![]});if(!_0x5dfcdd)throw new Error(_0x46ad('0x58'));if(_0x5dfcdd['role']==='user'){var _0x46a61d=_0x1c77f6[_0x46ad('0x2a')]({'plain':!![]});var _0x37d400=[{'name':_0x46ad('0x2b'),'value':'inbound'},{'name':_0x46ad('0x2d'),'value':_0x46ad('0x2e')}];var _0x85dd08=_['find'](_0x37d400,[_0x46ad('0x31'),_0x46a61d[_0x46ad('0x33')]])['name'];return db[_0x46ad('0x5e')][_0x46ad('0x34')]({'where':{'name':_0x85dd08,'userProfileId':_0x5dfcdd[_0x46ad('0x5f')]},'raw':!![]})[_0x46ad('0x28')](function(_0x219bdc){if(_0x219bdc&&_0x219bdc[_0x46ad('0x60')]===0x0){return db[_0x46ad('0x36')][_0x46ad('0x55')]({'name':_0x46a61d[_0x46ad('0x35')],'resourceId':_0x46a61d['id'],'type':_0x219bdc[_0x46ad('0x35')],'sectionId':_0x219bdc['id']},{})['then'](function(){return _0x1c77f6;});}else{return _0x1c77f6;}})[_0x46ad('0x52')](function(_0x84ccf1){logger['error'](_0x46ad('0x59'),_0x84ccf1);throw _0x84ccf1;});}return _0x1c77f6;});}})[_0x46ad('0x28')](respondWithResult(_0x23301d,0xc9))[_0x46ad('0x52')](handleError(_0x23301d,null));};exports[_0x46ad('0x27')]=function(_0x47cd1e,_0x1ac56a){if(_0x47cd1e['body']['id']){delete _0x47cd1e[_0x46ad('0x56')]['id'];}return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x47cd1e[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x1ac56a,null))[_0x46ad('0x28')](saveUpdates(_0x47cd1e[_0x46ad('0x56')],null))[_0x46ad('0x28')](respondWithResult(_0x1ac56a,null))[_0x46ad('0x52')](handleError(_0x1ac56a,null));};exports['destroy']=function(_0x53f9f4,_0x43b1c4){return db[_0x46ad('0x3d')]['find']({'where':{'id':_0x53f9f4[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x43b1c4,null))[_0x46ad('0x28')](removeEntity(_0x43b1c4,null))[_0x46ad('0x52')](handleError(_0x43b1c4,null));};exports[_0x46ad('0x61')]=function(_0x225827,_0x56b9a0,_0x48bb75){var _0x1fb5da={'raw':![],'where':{}};var _0x3b5fbe={};var _0x2e3138={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x225827[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x56b9a0,null))[_0x46ad('0x28')](function(_0x462cbe){if(_0x462cbe){_0x3b5fbe['model']=_[_0x46ad('0x62')](db[_0x46ad('0x63')][_0x46ad('0x3e')]);_0x3b5fbe[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x225827['query']);_0x3b5fbe[_0x46ad('0x41')]=_[_0x46ad('0x42')](_0x3b5fbe[_0x46ad('0x3f')],_0x3b5fbe['query']);_0x1fb5da['attributes']=_[_0x46ad('0x42')](_0x3b5fbe[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x225827[_0x46ad('0x40')][_0x46ad('0x44')]));_0x1fb5da[_0x46ad('0x43')]=_0x1fb5da[_0x46ad('0x43')]['length']?_0x1fb5da[_0x46ad('0x43')]:_0x3b5fbe['model'];if(!_0x225827[_0x46ad('0x40')][_0x46ad('0x46')]('nolimit')){_0x1fb5da[_0x46ad('0x21')]=qs['limit'](_0x225827[_0x46ad('0x40')]['limit']);_0x1fb5da['offset']=qs[_0x46ad('0x1f')](_0x225827['query'][_0x46ad('0x1f')]);}_0x1fb5da['order']=qs[_0x46ad('0x49')](_0x225827[_0x46ad('0x40')]['sort']);_0x1fb5da['where']=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0x225827[_0x46ad('0x40')],_0x3b5fbe[_0x46ad('0x41')]));_0x1fb5da['where']['VoiceQueueId']=_0x462cbe['id'];if(_0x225827[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x1fb5da['where']=_[_0x46ad('0x4b')](_0x1fb5da[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x1fb5da[_0x46ad('0x43')],function(_0x18088f){var _0x76aa4d={};_0x76aa4d[_0x18088f]={'$like':'%'+_0x225827[_0x46ad('0x40')]['filter']+'%'};return _0x76aa4d;})});}_0x1fb5da=_[_0x46ad('0x4b')]({},_0x1fb5da,_0x225827[_0x46ad('0x4d')]);return db['CmHopper'][_0x46ad('0x22')]({'where':_0x1fb5da[_0x46ad('0x4a')]})[_0x46ad('0x28')](function(_0x278da3){_0x2e3138[_0x46ad('0x22')]=_0x278da3;if(_0x225827[_0x46ad('0x40')][_0x46ad('0x4e')]){_0x1fb5da[_0x46ad('0x4f')]=[{'all':!![]}];}return db[_0x46ad('0x63')][_0x46ad('0x50')](_0x1fb5da);})[_0x46ad('0x28')](function(_0x4b41c1){_0x2e3138[_0x46ad('0x51')]=_0x4b41c1;return _0x2e3138;});}})['then'](respondWithFilteredResult(_0x56b9a0,_0x1fb5da))[_0x46ad('0x52')](handleError(_0x56b9a0,null));};exports[_0x46ad('0x65')]=function(_0x4ded51,_0x129858,_0x2edf9c){var _0x45bc7b={'raw':!![],'where':{}};var _0xeb9dbf={};var _0x435216={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x46ad('0x66')]({'where':{'id':_0x4ded51[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x129858,null))[_0x46ad('0x28')](function(_0xa2b9e0){if(_0xa2b9e0){_0xeb9dbf[_0x46ad('0x3f')]=_['keys'](db[_0x46ad('0x67')][_0x46ad('0x3e')]);_0xeb9dbf[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x4ded51['query']);_0xeb9dbf[_0x46ad('0x41')]=_['intersection'](_0xeb9dbf[_0x46ad('0x3f')],_0xeb9dbf[_0x46ad('0x40')]);_0x45bc7b['attributes']=_[_0x46ad('0x42')](_0xeb9dbf[_0x46ad('0x3f')],qs['fields'](_0x4ded51[_0x46ad('0x40')][_0x46ad('0x44')]));_0x45bc7b[_0x46ad('0x43')]=_0x45bc7b[_0x46ad('0x43')][_0x46ad('0x45')]?_0x45bc7b['attributes']:_0xeb9dbf[_0x46ad('0x3f')];if(!_0x4ded51[_0x46ad('0x40')]['hasOwnProperty']('nolimit')){_0x45bc7b[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x4ded51[_0x46ad('0x40')][_0x46ad('0x21')]);_0x45bc7b[_0x46ad('0x1f')]=qs[_0x46ad('0x1f')](_0x4ded51[_0x46ad('0x40')][_0x46ad('0x1f')]);}_0x45bc7b[_0x46ad('0x48')]=qs[_0x46ad('0x49')](_0x4ded51[_0x46ad('0x40')][_0x46ad('0x49')]);_0x45bc7b['where']=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0x4ded51[_0x46ad('0x40')],_0xeb9dbf['filters']));_0x45bc7b[_0x46ad('0x4a')][_0x46ad('0x68')]=_0xa2b9e0['id'];if(_0x4ded51[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x45bc7b[_0x46ad('0x4a')]=_[_0x46ad('0x4b')](_0x45bc7b['where'],{'$or':_[_0x46ad('0x30')](_0x45bc7b[_0x46ad('0x43')],function(_0x430806){var _0x5c28a3={};_0x5c28a3[_0x430806]={'$like':'%'+_0x4ded51[_0x46ad('0x40')][_0x46ad('0x2f')]+'%'};return _0x5c28a3;})});}_0x45bc7b=_['merge']({},_0x45bc7b,_0x4ded51[_0x46ad('0x4d')]);return db[_0x46ad('0x67')][_0x46ad('0x22')]({'where':_0x45bc7b[_0x46ad('0x4a')]})[_0x46ad('0x28')](function(_0x2d30fe){_0x435216[_0x46ad('0x22')]=_0x2d30fe;if(_0x4ded51['query'][_0x46ad('0x4e')]){_0x45bc7b[_0x46ad('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x46ad('0x50')](_0x45bc7b);})[_0x46ad('0x28')](function(_0x3495a9){_0x435216[_0x46ad('0x51')]=_0x3495a9;return _0x435216;});}})[_0x46ad('0x28')](respondWithFilteredResult(_0x129858,_0x45bc7b))['catch'](handleError(_0x129858,null));};exports['getHopperFinals']=function(_0x341b9d,_0x16ab00,_0xf057a5){var _0x596a71={'raw':!![],'where':{}};var _0x1257c9={};var _0x19cc49={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x341b9d[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x16ab00,null))['then'](function(_0x1a82aa){if(_0x1a82aa){_0x1257c9['model']=_[_0x46ad('0x62')](db[_0x46ad('0x69')][_0x46ad('0x3e')]);_0x1257c9[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x341b9d[_0x46ad('0x40')]);_0x1257c9[_0x46ad('0x41')]=_['intersection'](_0x1257c9['model'],_0x1257c9[_0x46ad('0x40')]);_0x596a71[_0x46ad('0x43')]=_['intersection'](_0x1257c9[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x341b9d[_0x46ad('0x40')]['fields']));_0x596a71['attributes']=_0x596a71[_0x46ad('0x43')][_0x46ad('0x45')]?_0x596a71[_0x46ad('0x43')]:_0x1257c9['model'];if(!_0x341b9d['query'][_0x46ad('0x46')](_0x46ad('0x47'))){_0x596a71[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x341b9d[_0x46ad('0x40')]['limit']);_0x596a71[_0x46ad('0x1f')]=qs[_0x46ad('0x1f')](_0x341b9d[_0x46ad('0x40')][_0x46ad('0x1f')]);}_0x596a71['order']=qs[_0x46ad('0x49')](_0x341b9d[_0x46ad('0x40')][_0x46ad('0x49')]);_0x596a71['where']=qs['filters'](_[_0x46ad('0x64')](_0x341b9d[_0x46ad('0x40')],_0x1257c9['filters']));_0x596a71[_0x46ad('0x4a')]['VoiceQueueId']=_0x1a82aa['id'];if(_0x341b9d[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x596a71['where']=_[_0x46ad('0x4b')](_0x596a71[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x596a71[_0x46ad('0x43')],function(_0x461591){var _0x41ea24={};_0x41ea24[_0x461591]={'$like':'%'+_0x341b9d[_0x46ad('0x40')][_0x46ad('0x2f')]+'%'};return _0x41ea24;})});}_0x596a71=_['merge']({},_0x596a71,_0x341b9d['options']);return db[_0x46ad('0x69')][_0x46ad('0x22')]({'where':_0x596a71[_0x46ad('0x4a')]})[_0x46ad('0x28')](function(_0x4c71d6){_0x19cc49['count']=_0x4c71d6;if(_0x341b9d['query'][_0x46ad('0x4e')]){_0x596a71[_0x46ad('0x4f')]=[{'all':!![]}];}return db[_0x46ad('0x69')][_0x46ad('0x50')](_0x596a71);})[_0x46ad('0x28')](function(_0xfe7b05){_0x19cc49[_0x46ad('0x51')]=_0xfe7b05;return _0x19cc49;});}})['then'](respondWithFilteredResult(_0x16ab00,_0x596a71))[_0x46ad('0x52')](handleError(_0x16ab00,null));};exports[_0x46ad('0x6a')]=function(_0x4a7c84,_0x522134,_0x4eae98){var _0x1f7c10={'raw':!![],'where':{}};var _0x3666a0={};var _0x4197bf={'count':0x0,'rows':[]};return db[_0x46ad('0x3d')]['findOne']({'where':{'id':_0x4a7c84[_0x46ad('0x54')]['id']}})['then'](handleEntityNotFound(_0x522134,null))[_0x46ad('0x28')](function(_0x4e030c){if(_0x4e030c){_0x3666a0['model']=_[_0x46ad('0x62')](db['CmHopperBlack'][_0x46ad('0x3e')]);_0x3666a0[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x4a7c84[_0x46ad('0x40')]);_0x3666a0[_0x46ad('0x41')]=_['intersection'](_0x3666a0[_0x46ad('0x3f')],_0x3666a0[_0x46ad('0x40')]);_0x1f7c10[_0x46ad('0x43')]=_[_0x46ad('0x42')](_0x3666a0['model'],qs[_0x46ad('0x44')](_0x4a7c84[_0x46ad('0x40')]['fields']));_0x1f7c10['attributes']=_0x1f7c10['attributes'][_0x46ad('0x45')]?_0x1f7c10[_0x46ad('0x43')]:_0x3666a0[_0x46ad('0x3f')];if(!_0x4a7c84[_0x46ad('0x40')][_0x46ad('0x46')](_0x46ad('0x47'))){_0x1f7c10[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x4a7c84['query'][_0x46ad('0x21')]);_0x1f7c10[_0x46ad('0x1f')]=qs['offset'](_0x4a7c84['query']['offset']);}_0x1f7c10[_0x46ad('0x48')]=qs['sort'](_0x4a7c84[_0x46ad('0x40')]['sort']);_0x1f7c10['where']=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0x4a7c84['query'],_0x3666a0['filters']));_0x1f7c10[_0x46ad('0x4a')][_0x46ad('0x68')]=_0x4e030c['id'];if(_0x4a7c84['query']['filter']){_0x1f7c10[_0x46ad('0x4a')]=_[_0x46ad('0x4b')](_0x1f7c10[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x1f7c10[_0x46ad('0x43')],function(_0x639c60){var _0x3b9482={};_0x3b9482[_0x639c60]={'$like':'%'+_0x4a7c84[_0x46ad('0x40')][_0x46ad('0x2f')]+'%'};return _0x3b9482;})});}_0x1f7c10=_[_0x46ad('0x4b')]({},_0x1f7c10,_0x4a7c84[_0x46ad('0x4d')]);return db['CmHopperBlack']['count']({'where':_0x1f7c10['where']})[_0x46ad('0x28')](function(_0x3badb7){_0x4197bf[_0x46ad('0x22')]=_0x3badb7;if(_0x4a7c84[_0x46ad('0x40')][_0x46ad('0x4e')]){_0x1f7c10['include']=[{'all':!![]}];}return db[_0x46ad('0x6b')][_0x46ad('0x50')](_0x1f7c10);})['then'](function(_0x2e5573){_0x4197bf[_0x46ad('0x51')]=_0x2e5573;return _0x4197bf;});}})['then'](respondWithFilteredResult(_0x522134,_0x1f7c10))['catch'](handleError(_0x522134,null));};exports[_0x46ad('0x6c')]=function(_0x22ef02,_0x4ffe17,_0x4b8f22){var _0x106e4c={};var _0x2b8f4d={};var _0x2eabad;var _0x2c40ba;return db[_0x46ad('0x3d')]['findOne']({'where':{'id':_0x22ef02['params']['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x4ffe17,null))[_0x46ad('0x28')](function(_0x45178b){if(_0x45178b){_0x2eabad=_0x45178b;_0x2b8f4d[_0x46ad('0x3f')]=_['keys'](db['Team'][_0x46ad('0x3e')]);_0x2b8f4d['query']=_[_0x46ad('0x62')](_0x22ef02[_0x46ad('0x40')]);_0x2b8f4d[_0x46ad('0x41')]=_['intersection'](_0x2b8f4d['model'],_0x2b8f4d['query']);_0x106e4c[_0x46ad('0x43')]=_[_0x46ad('0x42')](_0x2b8f4d[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x22ef02[_0x46ad('0x40')]['fields']));_0x106e4c[_0x46ad('0x43')]=_0x106e4c[_0x46ad('0x43')][_0x46ad('0x45')]?_0x106e4c['attributes']:_0x2b8f4d[_0x46ad('0x3f')];_0x106e4c[_0x46ad('0x48')]=qs[_0x46ad('0x49')](_0x22ef02[_0x46ad('0x40')][_0x46ad('0x49')]);_0x106e4c[_0x46ad('0x4a')]=qs[_0x46ad('0x41')](_['pick'](_0x22ef02['query'],_0x2b8f4d[_0x46ad('0x41')]));if(_0x22ef02[_0x46ad('0x40')]['filter']){_0x106e4c[_0x46ad('0x4a')]=_[_0x46ad('0x4b')](_0x106e4c['where'],{'$or':_[_0x46ad('0x30')](_0x106e4c[_0x46ad('0x43')],function(_0x459dd0){var _0x359325={};_0x359325[_0x459dd0]={'$like':'%'+_0x22ef02['query'][_0x46ad('0x2f')]+'%'};return _0x359325;})});}_0x106e4c=_[_0x46ad('0x4b')]({},_0x106e4c,_0x22ef02[_0x46ad('0x4d')]);return _0x2eabad['getTeams'](_0x106e4c);}})[_0x46ad('0x28')](function(_0x1eed63){if(_0x1eed63){_0x2c40ba=_0x1eed63[_0x46ad('0x45')];if(!_0x22ef02[_0x46ad('0x40')][_0x46ad('0x46')](_0x46ad('0x47'))){_0x106e4c[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x22ef02[_0x46ad('0x40')]['limit']);_0x106e4c[_0x46ad('0x1f')]=qs['offset'](_0x22ef02['query'][_0x46ad('0x1f')]);}return _0x2eabad[_0x46ad('0x6c')](_0x106e4c);}})['then'](function(_0xd63497){if(_0xd63497){return _0xd63497?{'count':_0x2c40ba,'rows':_0xd63497}:null;}})['then'](respondWithResult(_0x4ffe17,null))[_0x46ad('0x52')](handleError(_0x4ffe17,null));};exports[_0x46ad('0x6d')]=function(_0x995bd0,_0x944129,_0x424814){var _0x19e47f=_0x995bd0[_0x46ad('0x56')][_0x46ad('0x6e')];var _0x42bb42=_['map'](_0x19e47f,'id');return db[_0x46ad('0x6f')][_0x46ad('0x50')]({'where':{'id':_0x42bb42},'attributes':['id'],'include':[{'model':db[_0x46ad('0x70')],'as':'Agents','attributes':['id',_0x46ad('0x35'),'online','voicePause','interface'],'raw':!![]}]})[_0x46ad('0x28')](function(_0x326f56){if(_0x326f56){var _0x1dcddb=_[_0x46ad('0x71')](_0x326f56,function(_0x3900b1){var _0x34c42b=_0x3900b1[_0x46ad('0x2a')]({'plain':!![]});_0x34c42b['Agents']['forEach'](function(_0x2997a1){_0x2997a1['penalty']=_[_0x46ad('0x34')](_0x19e47f,{'id':_0x34c42b['id']})['penalty'];});return _0x34c42b[_0x46ad('0x72')];});return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x995bd0[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](function(_0x4f9753){return db[_0x46ad('0x73')][_0x46ad('0x74')](function(_0x376ebf){return _0x4f9753['addTeams'](_0x42bb42,{'transaction':_0x376ebf})[_0x46ad('0x28')](function(){return BPromise[_0x46ad('0x75')](_0x19e47f,function(_0x3beefb){return db[_0x46ad('0x76')][_0x46ad('0x77')]({'TeamId':_0x3beefb['id'],'VoiceQueueId':_0x995bd0[_0x46ad('0x54')]['id'],'penalty':_0x3beefb['penalty']},{'transaction':_0x376ebf});});})[_0x46ad('0x28')](function(){return BPromise['each'](_0x1dcddb,function(_0x563c9e){return db[_0x46ad('0x78')][_0x46ad('0x79')]({'where':{'UserId':_0x563c9e['id'],'VoiceQueueId':_0x995bd0[_0x46ad('0x54')]['id']},'defaults':{'penalty':_0x563c9e[_0x46ad('0x7a')]},'transaction':_0x376ebf});});})[_0x46ad('0x28')](function(){return BPromise[_0x46ad('0x75')](_['filter'](_0x1dcddb,{'online':!![]}),function(_0x2388eb){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2388eb[_0x46ad('0x35')],'UserId':_0x2388eb['id'],'queue_name':_0x4f9753[_0x46ad('0x35')],'VoiceQueueId':_0x4f9753['id'],'interface':_[_0x46ad('0x7b')](_0x2388eb['interface'])?util[_0x46ad('0x7c')](_0x46ad('0x7d'),_0x2388eb[_0x46ad('0x35')]):_0x2388eb['interface'],'paused':_0x2388eb[_0x46ad('0x7e')]||![],'penalty':_0x2388eb[_0x46ad('0x7a')]},{'transaction':_0x376ebf});});})[_0x46ad('0x28')](function(){_0x1dcddb['forEach'](function(_0x131988){socket[_0x46ad('0x7f')](_0x46ad('0x80'),{'UserId':_0x131988['id'],'VoiceQueueId':_0x4f9753['id']});});});});});}})[_0x46ad('0x28')](respondWithStatusCode(_0x944129,null))[_0x46ad('0x52')](handleError(_0x944129,null));};exports[_0x46ad('0x81')]=function(_0xc546f,_0x49652c,_0xf8cb0f){return db[_0x46ad('0x6f')][_0x46ad('0x50')]({'where':{'id':_0xc546f['query'][_0x46ad('0x82')]},'attributes':['id'],'include':[{'model':db[_0x46ad('0x70')],'as':_0x46ad('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49652c,null))[_0x46ad('0x28')](function(_0x41b261){var _0x41a184=_[_0x46ad('0x30')](_0x41b261,'id');var _0x1684d1=[];var _0x33c7a5=[];var _0x1e9e83=squel[_0x46ad('0x83')]();_0x1e9e83[_0x46ad('0x84')]('tq.TeamId')[_0x46ad('0x85')](_0x46ad('0x86'),'tq')[_0x46ad('0x87')](_0x46ad('0x88'),'ut',_0x46ad('0x89'))['where'](_0x46ad('0x8a'),_0xc546f[_0x46ad('0x54')]['id']);for(var _0x42cfe4=0x0;_0x42cfe4<_0x41b261[_0x46ad('0x45')];_0x42cfe4+=0x1){let _0x2ba878=_0x41b261[_0x42cfe4];for(var _0x15b4fd=0x0;_0x15b4fd<_0x2ba878[_0x46ad('0x72')][_0x46ad('0x45')];_0x15b4fd+=0x1){let _0x1dd239=_0x2ba878[_0x46ad('0x72')][_0x15b4fd];var _0x59560b=_0x1e9e83[_0x46ad('0x5a')]();_0x59560b[_0x46ad('0x4a')](_0x46ad('0x8b'),_0x1dd239['id']);_0x33c7a5[_0x46ad('0x8c')](db['sequelize']['query'](_0x59560b[_0x46ad('0x8d')](),{'type':db[_0x46ad('0x73')]['QueryTypes'][_0x46ad('0x8e')]})['then'](function(_0x50bc66){if(_0x50bc66[_0x46ad('0x45')]===0x1){return _0x1dd239['id'];}else{var _0x251dc2=_[_0x46ad('0x8f')](_[_0x46ad('0x30')](_0x50bc66,'TeamId'),function(_0x48dfea){return _[_0x46ad('0x32')](_0x41a184,_0x48dfea);});if(_0x251dc2){return _0x1dd239['id'];}}}));}}return BPromise[_0x46ad('0x90')](_0x33c7a5)[_0x46ad('0x28')](function(_0x4e1882){_0x1684d1=_(_0x1684d1)[_0x46ad('0x91')](_0x4e1882)[_0x46ad('0x92')]()['value']();return db[_0x46ad('0x3d')]['find']({'where':{'id':_0xc546f[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](function(_0x2d2324){return db['sequelize'][_0x46ad('0x74')](function(_0x3d24de){return _0x2d2324['removeTeams'](_0xc546f['query']['ids'],{'transaction':_0x3d24de})[_0x46ad('0x28')](function(){if(!_[_0x46ad('0x93')](_0x1684d1)){return _0x2d2324['removeAgents'](_0x1684d1,{'transaction':_0x3d24de})[_0x46ad('0x28')](function(){return db[_0x46ad('0x94')][_0x46ad('0x29')]({'where':{'VoiceQueueId':_0xc546f['params']['id'],'UserId':_0x1684d1},'transaction':_0x3d24de});});}})[_0x46ad('0x28')](function(){_0x1684d1[_0x46ad('0x95')](function(_0x55e2b5){socket[_0x46ad('0x7f')](_0x46ad('0x96'),{'UserId':_0x55e2b5,'VoiceQueueId':_0x2d2324['id']});});});});});});})[_0x46ad('0x28')](respondWithStatusCode(_0x49652c,null))[_0x46ad('0x52')](handleError(_0x49652c,null));};exports[_0x46ad('0x97')]=function(_0x3de112,_0x502856,_0x3d901f){var _0x112ec1,_0x45fca4;return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x3de112['params']['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x502856,null))[_0x46ad('0x28')](function(_0x22f226){if(_0x22f226){_0x45fca4=_0x22f226;return _0x22f226['addAgents'](_0x3de112[_0x46ad('0x56')][_0x46ad('0x82')],_[_0x46ad('0x5b')](_0x3de112['body'],['ids','id'])||{})[_0x46ad('0x98')](function(_0x1f8f52){for(var _0x31467e=0x0;_0x31467e<_0x3de112[_0x46ad('0x56')]['ids'][_0x46ad('0x45')];_0x31467e+=0x1){socket[_0x46ad('0x7f')](_0x46ad('0x80'),{'UserId':Number(_0x3de112[_0x46ad('0x56')][_0x46ad('0x82')][_0x31467e]),'VoiceQueueId':Number(_0x3de112[_0x46ad('0x54')]['id'])});}return _0x1f8f52;});}})[_0x46ad('0x28')](function(_0x347168){_0x112ec1=_0x347168||[];if(_0x45fca4){return db[_0x46ad('0x70')][_0x46ad('0x50')]({'where':{'id':_0x3de112[_0x46ad('0x56')]['ids']},'attributes':['id','name',_0x46ad('0x99'),'voicePause',_0x46ad('0x9a')],'raw':!![]});}})[_0x46ad('0x28')](function(_0x2ed2c7){if(!_[_0x46ad('0x93')](_0x2ed2c7)){var _0x54d405=[];for(var _0x472fef=0x0;_0x472fef<_0x2ed2c7['length'];_0x472fef++){if(_0x2ed2c7[_0x472fef]['online']){_0x54d405[_0x46ad('0x8c')](db[_0x46ad('0x94')]['upsert']({'membername':_0x2ed2c7[_0x472fef][_0x46ad('0x35')],'UserId':_0x2ed2c7[_0x472fef]['id'],'queue_name':_0x45fca4[_0x46ad('0x35')],'VoiceQueueId':_0x45fca4['id'],'interface':_[_0x46ad('0x7b')](_0x2ed2c7[_0x472fef][_0x46ad('0x9a')])?util[_0x46ad('0x7c')](_0x46ad('0x7d'),_0x2ed2c7[_0x472fef][_0x46ad('0x35')]):_0x2ed2c7[_0x472fef]['interface'],'paused':_0x2ed2c7[_0x472fef][_0x46ad('0x7e')]||![],'penalty':_0x3de112[_0x46ad('0x56')][_0x46ad('0x7a')]||0x0}));}}return BPromise[_0x46ad('0x90')](_0x54d405);}})[_0x46ad('0x28')](function(){return _0x112ec1;})[_0x46ad('0x28')](respondWithResult(_0x502856,null))[_0x46ad('0x52')](handleError(_0x502856,null));};exports[_0x46ad('0x9b')]=function(_0x4360c0,_0x4ea2fe,_0x4c5b74){return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x4360c0[_0x46ad('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ea2fe,null))['then'](function(_0x224658){if(_0x224658){return _0x224658[_0x46ad('0x9b')](_0x4360c0[_0x46ad('0x40')][_0x46ad('0x82')])[_0x46ad('0x28')](function(){if(_['isArray'](_0x4360c0[_0x46ad('0x40')][_0x46ad('0x82')])){for(var _0x355946=0x0;_0x355946<_0x4360c0[_0x46ad('0x40')][_0x46ad('0x82')]['length'];_0x355946+=0x1){socket[_0x46ad('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x4360c0[_0x46ad('0x40')][_0x46ad('0x82')][_0x355946]),'VoiceQueueId':Number(_0x4360c0['params']['id'])});}}else{socket[_0x46ad('0x7f')](_0x46ad('0x96'),{'UserId':Number(_0x4360c0['query']['ids']),'VoiceQueueId':Number(_0x4360c0[_0x46ad('0x54')]['id'])});}});}})[_0x46ad('0x28')](function(_0xee0112){return db[_0x46ad('0x94')][_0x46ad('0x29')]({'where':{'VoiceQueueId':_0x4360c0[_0x46ad('0x54')]['id'],'UserId':_0x4360c0[_0x46ad('0x40')]['ids']}})['then'](function(){return _0xee0112;});})[_0x46ad('0x28')](respondWithStatusCode(_0x4ea2fe,null))[_0x46ad('0x52')](handleError(_0x4ea2fe,null));};exports[_0x46ad('0x9c')]=function(_0x2486db,_0x2d440d,_0xe56e60){var _0x51442b={};var _0x160fdb={};var _0x18f18e;var _0x58f292;return db['VoiceQueue'][_0x46ad('0x66')]({'where':{'id':_0x2486db[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x2d440d,null))[_0x46ad('0x28')](function(_0x48dcfa){if(_0x48dcfa){_0x18f18e=_0x48dcfa;_0x160fdb['model']=_['keys'](db['User'][_0x46ad('0x3e')]);_0x160fdb[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x2486db[_0x46ad('0x40')]);_0x160fdb[_0x46ad('0x41')]=_[_0x46ad('0x42')](_0x160fdb[_0x46ad('0x3f')],_0x160fdb[_0x46ad('0x40')]);_0x51442b[_0x46ad('0x43')]=_[_0x46ad('0x42')](_0x160fdb[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x2486db[_0x46ad('0x40')][_0x46ad('0x44')]));_0x51442b['attributes']=_0x51442b[_0x46ad('0x43')][_0x46ad('0x45')]?_0x51442b[_0x46ad('0x43')]:_0x160fdb[_0x46ad('0x3f')];_0x51442b[_0x46ad('0x48')]=qs[_0x46ad('0x49')](_0x2486db['query']['sort']);_0x51442b[_0x46ad('0x4a')]=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0x2486db[_0x46ad('0x40')],_0x160fdb[_0x46ad('0x41')]));if(_0x2486db[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x51442b[_0x46ad('0x4a')]=_['merge'](_0x51442b[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x51442b[_0x46ad('0x43')],function(_0x22fab3){var _0x5b707d={};_0x5b707d[_0x22fab3]={'$like':'%'+_0x2486db['query']['filter']+'%'};return _0x5b707d;})});}_0x51442b=_[_0x46ad('0x4b')]({},_0x51442b,_0x2486db[_0x46ad('0x4d')]);return _0x18f18e[_0x46ad('0x9c')](_0x51442b);}})['then'](function(_0x22b752){if(_0x22b752){_0x58f292=_0x22b752[_0x46ad('0x45')];if(!_0x2486db['query'][_0x46ad('0x46')]('nolimit')){_0x51442b[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x2486db[_0x46ad('0x40')][_0x46ad('0x21')]);_0x51442b[_0x46ad('0x1f')]=qs[_0x46ad('0x1f')](_0x2486db[_0x46ad('0x40')][_0x46ad('0x1f')]);}return _0x18f18e[_0x46ad('0x9c')](_0x51442b);}})[_0x46ad('0x28')](function(_0x436cec){if(_0x436cec){return _0x436cec?{'count':_0x58f292,'rows':_0x436cec}:null;}})[_0x46ad('0x28')](respondWithResult(_0x2d440d,null))[_0x46ad('0x52')](handleError(_0x2d440d,null));};exports[_0x46ad('0x9d')]=function(_0x15ad56,_0x21e99e,_0x25c29d){var _0x421687={};var _0x4ca434={};var _0x239cf7;var _0x4cf79f;return db[_0x46ad('0x3d')][_0x46ad('0x66')]({'where':{'id':_0x15ad56[_0x46ad('0x54')]['id']}})['then'](handleEntityNotFound(_0x21e99e,null))['then'](function(_0x15f8f8){if(_0x15f8f8){_0x239cf7=_0x15f8f8;_0x4ca434[_0x46ad('0x3f')]=_[_0x46ad('0x62')](db[_0x46ad('0x94')]['rawAttributes']);_0x4ca434[_0x46ad('0x40')]=_[_0x46ad('0x62')](_0x15ad56[_0x46ad('0x40')]);_0x4ca434['filters']=_['intersection'](_0x4ca434['model'],_0x4ca434['query']);_0x421687['attributes']=_['intersection'](_0x4ca434[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x15ad56[_0x46ad('0x40')][_0x46ad('0x44')]));_0x421687[_0x46ad('0x43')]=_0x421687[_0x46ad('0x43')]['length']?_0x421687[_0x46ad('0x43')]:_0x4ca434[_0x46ad('0x3f')];_0x421687['order']=qs[_0x46ad('0x49')](_0x15ad56[_0x46ad('0x40')][_0x46ad('0x49')]);_0x421687['where']=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0x15ad56[_0x46ad('0x40')],_0x4ca434[_0x46ad('0x41')]));if(_0x15ad56[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x421687['where']=_[_0x46ad('0x4b')](_0x421687[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x421687[_0x46ad('0x43')],function(_0x4b7e27){var _0xd95fc2={};_0xd95fc2[_0x4b7e27]={'$like':'%'+_0x15ad56[_0x46ad('0x40')]['filter']+'%'};return _0xd95fc2;})});}_0x421687=_['merge']({},_0x421687,_0x15ad56[_0x46ad('0x4d')]);return _0x239cf7[_0x46ad('0x9d')](_0x421687);}})[_0x46ad('0x28')](function(_0x4b55d7){if(_0x4b55d7){_0x4cf79f=_0x4b55d7[_0x46ad('0x45')];if(!_0x15ad56[_0x46ad('0x40')][_0x46ad('0x46')](_0x46ad('0x47'))){_0x421687[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x15ad56['query'][_0x46ad('0x21')]);_0x421687['offset']=qs[_0x46ad('0x1f')](_0x15ad56[_0x46ad('0x40')][_0x46ad('0x1f')]);}return _0x239cf7[_0x46ad('0x9d')](_0x421687);}})[_0x46ad('0x28')](function(_0x375d06){return _0x375d06?{'count':_0x4cf79f,'rows':_0x375d06}:null;})[_0x46ad('0x28')](respondWithResult(_0x21e99e,null))[_0x46ad('0x52')](handleError(_0x21e99e,null));};exports[_0x46ad('0x9e')]=function(_0x3e2fcc,_0x4111ca,_0x17b653){var _0x3271d8={};var _0x3687c9={};var _0x57c960;var _0x4045c7;return db[_0x46ad('0x3d')]['findOne']({'where':{'id':_0x3e2fcc['params']['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x4111ca,null))[_0x46ad('0x28')](function(_0x1f8cd2){if(_0x1f8cd2){_0x57c960=_0x1f8cd2;_0x3687c9[_0x46ad('0x3f')]=_['keys'](db[_0x46ad('0x9f')][_0x46ad('0x3e')]);_0x3687c9[_0x46ad('0x40')]=_['keys'](_0x3e2fcc[_0x46ad('0x40')]);_0x3687c9[_0x46ad('0x41')]=_['intersection'](_0x3687c9['model'],_0x3687c9['query']);_0x3271d8['attributes']=_['intersection'](_0x3687c9[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0x3e2fcc['query'][_0x46ad('0x44')]));_0x3271d8[_0x46ad('0x43')]=_0x3271d8[_0x46ad('0x43')][_0x46ad('0x45')]?_0x3271d8['attributes']:_0x3687c9[_0x46ad('0x3f')];_0x3271d8[_0x46ad('0x48')]=qs['sort'](_0x3e2fcc[_0x46ad('0x40')][_0x46ad('0x49')]);_0x3271d8[_0x46ad('0x4a')]=qs['filters'](_[_0x46ad('0x64')](_0x3e2fcc[_0x46ad('0x40')],_0x3687c9['filters']));if(_0x3e2fcc['query'][_0x46ad('0x2f')]){_0x3271d8['where']=_[_0x46ad('0x4b')](_0x3271d8[_0x46ad('0x4a')],{'$or':_['map'](_0x3271d8['attributes'],function(_0x12ef19){var _0x428666={};_0x428666[_0x12ef19]={'$like':'%'+_0x3e2fcc['query'][_0x46ad('0x2f')]+'%'};return _0x428666;})});}_0x3271d8=_[_0x46ad('0x4b')]({},_0x3271d8,_0x3e2fcc[_0x46ad('0x4d')]);return _0x57c960[_0x46ad('0x9e')](_0x3271d8);}})['then'](function(_0x10f7e1){if(_0x10f7e1){_0x4045c7=_0x10f7e1[_0x46ad('0x45')];if(!_0x3e2fcc[_0x46ad('0x40')][_0x46ad('0x46')](_0x46ad('0x47'))){_0x3271d8[_0x46ad('0x21')]=qs[_0x46ad('0x21')](_0x3e2fcc[_0x46ad('0x40')]['limit']);_0x3271d8[_0x46ad('0x1f')]=qs[_0x46ad('0x1f')](_0x3e2fcc[_0x46ad('0x40')][_0x46ad('0x1f')]);}return _0x57c960[_0x46ad('0x9e')](_0x3271d8);}})[_0x46ad('0x28')](function(_0x464ef3){if(_0x464ef3){return _0x464ef3?{'count':_0x4045c7,'rows':_0x464ef3}:null;}})[_0x46ad('0x28')](respondWithResult(_0x4111ca,null))[_0x46ad('0x52')](handleError(_0x4111ca,null));};exports[_0x46ad('0xa0')]=function(_0x3cad92,_0x3d8901,_0x3bf751){var _0x39ce44,_0x225ef9;return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x3cad92[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x3d8901,null))[_0x46ad('0x28')](function(_0x122563){if(_0x122563){_0x225ef9=_0x122563;return _0x122563['addLists'](_0x3cad92['body'][_0x46ad('0x82')],_[_0x46ad('0x5b')](_0x3cad92[_0x46ad('0x56')],[_0x46ad('0x82'),'id'])||{});}return null;})['spread'](function(_0x511e27){var _0x253fbd;_0x39ce44=_0x511e27||[];var _0x1c0476=[];if(_0x511e27){for(var _0x36075f=0x0;_0x36075f<_0x511e27[_0x46ad('0x45')];_0x36075f+=0x1){var _0x5553c5=_0x511e27[_0x36075f]['get']({'plain':!![]});_0x225ef9[_0x46ad('0xa1')]=_0x3cad92[_0x46ad('0x56')][_0x46ad('0xa1')]?_0x3cad92[_0x46ad('0x56')]['dialCheckDuplicateType']:_0x225ef9[_0x46ad('0xa1')];switch(_0x225ef9['dialCheckDuplicateType']){case _0x46ad('0xa2'):_0x253fbd=squel[_0x46ad('0xa3')]()[_0x46ad('0xa4')](_0x46ad('0xa5'))[_0x46ad('0xa6')](['phone',_0x46ad('0xa7'),'ContactId',_0x46ad('0xa8'),_0x46ad('0x68'),_0x46ad('0x5c'),_0x46ad('0x5d')],squel['select']()['field'](_0x46ad('0xa9'),_0x46ad('0xa9'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0xa7'))[_0x46ad('0x84')]('id',_0x46ad('0xab'))[_0x46ad('0x84')](_0x5553c5[_0x46ad('0xac')][_0x46ad('0x8d')](),_0x46ad('0xa8'))['field'](_0x3cad92[_0x46ad('0x54')]['id']['toString'](),_0x46ad('0x68'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0x5c'))['field']('NOW()',_0x46ad('0x5d'))[_0x46ad('0x85')](_0x46ad('0xad'))[_0x46ad('0x4a')](_0x46ad('0xae'))[_0x46ad('0x4a')]('ListId\x20=\x20?',_0x5553c5[_0x46ad('0xac')][_0x46ad('0x8d')]())[_0x46ad('0x4a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x46ad('0xaf'),squel[_0x46ad('0x83')]()[_0x46ad('0x84')](_0x46ad('0xb0'))[_0x46ad('0x85')]('cm_hopper_final')[_0x46ad('0x4a')]('VoiceQueueId\x20=\x20?',_0x3cad92['params']['id'][_0x46ad('0x8d')]()))[_0x46ad('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x46ad('0x84')](_0x46ad('0xb1'))[_0x46ad('0x85')]('cm_hopper')[_0x46ad('0x4a')](_0x46ad('0x8a'),_0x3cad92[_0x46ad('0x54')]['id']['toString']())))[_0x46ad('0x8d')]();break;case'onlyIfOpen':_0x253fbd=squel[_0x46ad('0xa3')]()[_0x46ad('0xa4')](_0x46ad('0xa5'))[_0x46ad('0xa6')]([_0x46ad('0xa9'),'scheduledAt',_0x46ad('0xab'),_0x46ad('0xa8'),_0x46ad('0x68'),_0x46ad('0x5c'),_0x46ad('0x5d')],squel['select']()['field']('phone',_0x46ad('0xa9'))[_0x46ad('0x84')]('NOW()',_0x46ad('0xa7'))[_0x46ad('0x84')]('id',_0x46ad('0xab'))[_0x46ad('0x84')](_0x5553c5[_0x46ad('0xac')]['toString'](),_0x46ad('0xa8'))['field'](_0x3cad92[_0x46ad('0x54')]['id'][_0x46ad('0x8d')](),_0x46ad('0x68'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0x5c'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0x5d'))[_0x46ad('0x85')](_0x46ad('0xad'))[_0x46ad('0x4a')](_0x46ad('0xae'))['where']('ListId\x20=\x20?',_0x5553c5[_0x46ad('0xac')][_0x46ad('0x8d')]())[_0x46ad('0x4a')](_0x46ad('0xb2'))[_0x46ad('0x4a')](_0x46ad('0xaf'),squel[_0x46ad('0x83')]()[_0x46ad('0x84')](_0x46ad('0xb1'))[_0x46ad('0x85')](_0x46ad('0xa5'))['where'](_0x46ad('0x8a'),_0x3cad92['params']['id'][_0x46ad('0x8d')]())))[_0x46ad('0x8d')]();break;default:_0x253fbd=squel[_0x46ad('0xa3')]()['into'](_0x46ad('0xa5'))['fromQuery']([_0x46ad('0xa9'),_0x46ad('0xa7'),'ContactId','ListId','VoiceQueueId',_0x46ad('0x5c'),_0x46ad('0x5d')],squel[_0x46ad('0x83')]()[_0x46ad('0x84')]('phone','phone')[_0x46ad('0x84')]('NOW()','scheduledAt')[_0x46ad('0x84')]('id','ContactId')[_0x46ad('0x84')](_0x5553c5[_0x46ad('0xac')][_0x46ad('0x8d')](),_0x46ad('0xa8'))[_0x46ad('0x84')](_0x3cad92[_0x46ad('0x54')]['id'][_0x46ad('0x8d')](),_0x46ad('0x68'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0x5c'))[_0x46ad('0x84')](_0x46ad('0xaa'),_0x46ad('0x5d'))['from']('cm_contacts')['where'](_0x46ad('0xae'))[_0x46ad('0x4a')](_0x46ad('0xb3'),_0x5553c5[_0x46ad('0xac')]['toString']())[_0x46ad('0x4a')]('phone\x20IS\x20NOT\x20NULL'))[_0x46ad('0x8d')]();}_0x1c0476[_0x46ad('0x8c')](db['sequelize'][_0x46ad('0x40')](_0x253fbd));}return BPromise[_0x46ad('0x90')](_0x1c0476);}})['then'](function(){return _0x39ce44;})['then'](respondWithResult(_0x3d8901,null))[_0x46ad('0x52')](handleError(_0x3d8901,null));};exports[_0x46ad('0xb4')]=function(_0x5121f9,_0x1e1551,_0x9479a5){return db[_0x46ad('0x3d')]['find']({'where':{'id':_0x5121f9['params']['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x1e1551,null))['then'](function(_0x3c34aa){if(_0x3c34aa){return _0x3c34aa[_0x46ad('0xb4')](_0x5121f9[_0x46ad('0x40')]['ids']);}})['then'](function(_0x545a87){if(_0x545a87){return db[_0x46ad('0x63')][_0x46ad('0x29')]({'where':{'ListId':_0x5121f9[_0x46ad('0x40')][_0x46ad('0x82')],'VoiceQueueId':_0x5121f9[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](function(){return _0x545a87;});}})['then'](respondWithStatusCode(_0x1e1551,null))['catch'](handleError(_0x1e1551,null));};exports[_0x46ad('0xb5')]=function(_0xd7d238,_0x3a3d8e,_0x1b24c0){var _0x47ea8c={};var _0xcad77a={};var _0x3f7642;var _0xc28eeb;return db['VoiceQueue'][_0x46ad('0x66')]({'where':{'id':_0xd7d238[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x3a3d8e,null))[_0x46ad('0x28')](function(_0x29381f){if(_0x29381f){_0x3f7642=_0x29381f;_0xcad77a['model']=_['keys'](db[_0x46ad('0x9f')][_0x46ad('0x3e')]);_0xcad77a[_0x46ad('0x40')]=_['keys'](_0xd7d238[_0x46ad('0x40')]);_0xcad77a[_0x46ad('0x41')]=_[_0x46ad('0x42')](_0xcad77a[_0x46ad('0x3f')],_0xcad77a[_0x46ad('0x40')]);_0x47ea8c[_0x46ad('0x43')]=_[_0x46ad('0x42')](_0xcad77a[_0x46ad('0x3f')],qs[_0x46ad('0x44')](_0xd7d238[_0x46ad('0x40')][_0x46ad('0x44')]));_0x47ea8c[_0x46ad('0x43')]=_0x47ea8c[_0x46ad('0x43')]['length']?_0x47ea8c['attributes']:_0xcad77a[_0x46ad('0x3f')];_0x47ea8c[_0x46ad('0x48')]=qs[_0x46ad('0x49')](_0xd7d238[_0x46ad('0x40')]['sort']);_0x47ea8c['where']=qs[_0x46ad('0x41')](_[_0x46ad('0x64')](_0xd7d238[_0x46ad('0x40')],_0xcad77a['filters']));if(_0xd7d238[_0x46ad('0x40')][_0x46ad('0x2f')]){_0x47ea8c[_0x46ad('0x4a')]=_[_0x46ad('0x4b')](_0x47ea8c[_0x46ad('0x4a')],{'$or':_[_0x46ad('0x30')](_0x47ea8c['attributes'],function(_0x323bd7){var _0x44254a={};_0x44254a[_0x323bd7]={'$like':'%'+_0xd7d238[_0x46ad('0x40')][_0x46ad('0x2f')]+'%'};return _0x44254a;})});}_0x47ea8c=_['merge']({},_0x47ea8c,_0xd7d238[_0x46ad('0x4d')]);return _0x3f7642['getBlackLists'](_0x47ea8c);}})[_0x46ad('0x28')](function(_0x51ab15){if(_0x51ab15){_0xc28eeb=_0x51ab15[_0x46ad('0x45')];if(!_0xd7d238[_0x46ad('0x40')][_0x46ad('0x46')]('nolimit')){_0x47ea8c[_0x46ad('0x21')]=qs['limit'](_0xd7d238[_0x46ad('0x40')][_0x46ad('0x21')]);_0x47ea8c[_0x46ad('0x1f')]=qs[_0x46ad('0x1f')](_0xd7d238[_0x46ad('0x40')][_0x46ad('0x1f')]);}return _0x3f7642[_0x46ad('0xb5')](_0x47ea8c);}})[_0x46ad('0x28')](function(_0x4abc79){if(_0x4abc79){return _0x4abc79?{'count':_0xc28eeb,'rows':_0x4abc79}:null;}})[_0x46ad('0x28')](respondWithResult(_0x3a3d8e,null))['catch'](handleError(_0x3a3d8e,null));};exports[_0x46ad('0xb6')]=function(_0x25c306,_0x345a7c,_0xeb5823){var _0x5e788c,_0x4aa0ac;return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x25c306[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x345a7c,null))['then'](function(_0x4c86b0){if(_0x4c86b0){_0x4aa0ac=_0x4c86b0;return _0x4c86b0[_0x46ad('0xb6')](_0x25c306['body']['ids'],_[_0x46ad('0x5b')](_0x25c306[_0x46ad('0x56')],[_0x46ad('0x82'),'id'])||{});}return null;})[_0x46ad('0x98')](function(_0x5a8f19){var _0x101d1a;_0x5e788c=_0x5a8f19||[];var _0x221f43=[];if(_0x5a8f19){for(var _0x3a715e=0x0;_0x3a715e<_0x5a8f19['length'];_0x3a715e+=0x1){var _0x186856=_0x5a8f19[_0x3a715e]['get']({'plain':!![]});_0x101d1a=squel[_0x46ad('0xa3')]()[_0x46ad('0xa4')]('cm_hopper_black')[_0x46ad('0xa6')](['phone',_0x46ad('0xab'),_0x46ad('0xa8'),_0x46ad('0x68'),'createdAt',_0x46ad('0x5d')],squel[_0x46ad('0x83')]()[_0x46ad('0x84')](_0x46ad('0xa9'),'phone')['field']('id','ContactId')[_0x46ad('0x84')](_0x186856[_0x46ad('0xac')]['toString'](),_0x46ad('0xa8'))[_0x46ad('0x84')](_0x25c306[_0x46ad('0x54')]['id'][_0x46ad('0x8d')](),'VoiceQueueId')['field'](_0x46ad('0xaa'),_0x46ad('0x5c'))[_0x46ad('0x84')]('NOW()',_0x46ad('0x5d'))[_0x46ad('0x85')](_0x46ad('0xad'))[_0x46ad('0x4a')]('deletedAt\x20IS\x20NULL')[_0x46ad('0x4a')](_0x46ad('0xb3'),_0x186856[_0x46ad('0xac')][_0x46ad('0x8d')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x221f43[_0x46ad('0x8c')](db[_0x46ad('0x73')]['query'](_0x101d1a));}return BPromise[_0x46ad('0x90')](_0x221f43);}})[_0x46ad('0x28')](function(){return _0x5e788c;})['then'](respondWithResult(_0x345a7c,null))[_0x46ad('0x52')](handleError(_0x345a7c,null));};exports[_0x46ad('0xb7')]=function(_0x582f62,_0x1c9720,_0x55968f){return db[_0x46ad('0x3d')][_0x46ad('0x34')]({'where':{'id':_0x582f62[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](handleEntityNotFound(_0x1c9720,null))[_0x46ad('0x28')](function(_0x4c1f0d){if(_0x4c1f0d){return _0x4c1f0d[_0x46ad('0xb7')](_0x582f62[_0x46ad('0x40')][_0x46ad('0x82')]);}})[_0x46ad('0x28')](function(_0x402292){if(_0x402292){return db[_0x46ad('0x6b')][_0x46ad('0x29')]({'where':{'ListId':_0x582f62[_0x46ad('0x40')][_0x46ad('0x82')],'VoiceQueueId':_0x582f62[_0x46ad('0x54')]['id']}})[_0x46ad('0x28')](function(){return _0x402292;});}})['then'](respondWithStatusCode(_0x1c9720,null))[_0x46ad('0x52')](handleError(_0x1c9720,null));}; \ No newline at end of file +var _0x81ca=['type','find','name','UserProfileResource','end','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','merge','VoiceQueue','includeAll','findAll','rows','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','pick','CmHopperFinal','hasOwnProperty','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','interface','flatMap','forEach','sequelize','transaction','each','TeamVoiceQueue','penalty','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','removeTeams','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','insert','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','get','QueueCampaigns','outbound','filter','value','includes'];(function(_0x515c74,_0x104883){var _0x5e8886=function(_0x3595ab){while(--_0x3595ab){_0x515c74['push'](_0x515c74['shift']());}};_0x5e8886(++_0x104883);}(_0x81ca,0x144));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa81c('0x0'));var rimraf=require(_0xa81c('0x1'));var zipdir=require(_0xa81c('0x2'));var jsonpatch=require(_0xa81c('0x3'));var rp=require(_0xa81c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa81c('0x5'));var util=require(_0xa81c('0x6'));var path=require('path');var sox=require(_0xa81c('0x7'));var csv=require(_0xa81c('0x8'));var ejs=require(_0xa81c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa81c('0xa'));var squel=require('squel');var crypto=require(_0xa81c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa81c('0xc'));var toCsv=require(_0xa81c('0x8'));var querystring=require(_0xa81c('0xd'));var Papa=require(_0xa81c('0xe'));var Redis=require(_0xa81c('0xf'));var authService=require(_0xa81c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa81c('0x11'));var logger=require('../../config/logger')(_0xa81c('0x12'));var utils=require(_0xa81c('0x13'));var config=require(_0xa81c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa81c('0x15'))['db'];config[_0xa81c('0x16')]=_[_0xa81c('0x17')](config[_0xa81c('0x16')],{'host':_0xa81c('0x18'),'port':0x18eb});var socket=require(_0xa81c('0x19'))(new Redis(config[_0xa81c('0x16')]));require(_0xa81c('0x1a'))[_0xa81c('0x1b')](socket);function respondWithStatusCode(_0xb80f8f,_0x1f8245){_0x1f8245=_0x1f8245||0xcc;return function(_0x585963){if(_0x585963){return _0xb80f8f['sendStatus'](_0x1f8245);}return _0xb80f8f[_0xa81c('0x1c')](_0x1f8245)['end']();};}function respondWithResult(_0x109af5,_0x380c74){_0x380c74=_0x380c74||0xc8;return function(_0x524473){if(_0x524473){return _0x109af5[_0xa81c('0x1c')](_0x380c74)['json'](_0x524473);}};}function respondWithFilteredResult(_0x59cfcd,_0x6df87d){return function(_0x4ab123){if(_0x4ab123){var _0x3c4bbe=typeof _0x6df87d['offset']===_0xa81c('0x1d')&&typeof _0x6df87d[_0xa81c('0x1e')]==='undefined';var _0x44aadd=_0x4ab123[_0xa81c('0x1f')];var _0x38d823=_0x3c4bbe?0x0:_0x6df87d[_0xa81c('0x20')];var _0x2c5511=_0x3c4bbe?_0x4ab123[_0xa81c('0x1f')]:_0x6df87d['offset']+_0x6df87d['limit'];var _0xa24369;if(_0x2c5511>=_0x44aadd){_0x2c5511=_0x44aadd;_0xa24369=0xc8;}else{_0xa24369=0xce;}_0x59cfcd[_0xa81c('0x1c')](_0xa24369);return _0x59cfcd['set'](_0xa81c('0x21'),_0x38d823+'-'+_0x2c5511+'/'+_0x44aadd)[_0xa81c('0x22')](_0x4ab123);}return null;};}function patchUpdates(_0x48acab){return function(_0x235668){try{jsonpatch[_0xa81c('0x23')](_0x235668,_0x48acab,!![]);}catch(_0x4adf62){return BPromise[_0xa81c('0x24')](_0x4adf62);}return _0x235668['save']();};}function saveUpdates(_0x113932,_0x57cedb){return function(_0x435a25){if(_0x435a25){return _0x435a25[_0xa81c('0x25')](_0x113932)[_0xa81c('0x26')](function(_0xf3985e){return _0xf3985e;});}return null;};}function removeEntity(_0x39e628,_0x406256){return function(_0x22dd3c){if(_0x22dd3c){return _0x22dd3c[_0xa81c('0x27')]()[_0xa81c('0x26')](function(){var _0x361be7=_0x22dd3c[_0xa81c('0x28')]({'plain':!![]});var _0xcdc30a=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0xa81c('0x29'),'value':_0xa81c('0x2a'),'ignore':![]}];var _0x6d7a84=_(_0xcdc30a)[_0xa81c('0x2b')]('ignore')['map'](_0xa81c('0x2c'))[_0xa81c('0x2c')]();if(_[_0xa81c('0x2d')](_0x6d7a84,_0x361be7[_0xa81c('0x2e')])){return;}var _0x4e8d88=_[_0xa81c('0x2f')](_0xcdc30a,['value',_0x361be7[_0xa81c('0x2e')]])[_0xa81c('0x30')];return db[_0xa81c('0x31')][_0xa81c('0x27')]({'where':{'type':_0x4e8d88,'resourceId':_0x361be7['id']}})['then'](function(){return _0x22dd3c;});})[_0xa81c('0x26')](function(){_0x39e628[_0xa81c('0x1c')](0xcc)[_0xa81c('0x32')]();});}};}function handleEntityNotFound(_0x25071a,_0x5cbdec){return function(_0x60359a){if(!_0x60359a){_0x25071a[_0xa81c('0x33')](0x194);}return _0x60359a;};}function handleError(_0x269183,_0x5a70e9){_0x5a70e9=_0x5a70e9||0x1f4;return function(_0x98d80a){logger[_0xa81c('0x34')](_0x98d80a[_0xa81c('0x35')]);if(_0x98d80a[_0xa81c('0x30')]){delete _0x98d80a[_0xa81c('0x30')];}_0x269183[_0xa81c('0x1c')](_0x5a70e9)[_0xa81c('0x36')](_0x98d80a);};}exports[_0xa81c('0x37')]=function(_0x132bca,_0x5d88e6){var _0x22eed4={},_0x48a82b={},_0x46ef52={'count':0x0,'rows':[]};var _0x58e340=_[_0xa81c('0x38')](db['VoiceQueue'][_0xa81c('0x39')],function(_0x1a0fed){return{'name':_0x1a0fed[_0xa81c('0x3a')],'type':_0x1a0fed['type'][_0xa81c('0x3b')]};});_0x48a82b[_0xa81c('0x3c')]=_[_0xa81c('0x38')](_0x58e340,'name');_0x48a82b['query']=_[_0xa81c('0x3d')](_0x132bca[_0xa81c('0x3e')]);_0x48a82b[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x48a82b[_0xa81c('0x3c')],_0x48a82b[_0xa81c('0x3e')]);_0x22eed4[_0xa81c('0x41')]=_['intersection'](_0x48a82b['model'],qs[_0xa81c('0x42')](_0x132bca[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x22eed4[_0xa81c('0x41')]=_0x22eed4[_0xa81c('0x41')][_0xa81c('0x43')]?_0x22eed4[_0xa81c('0x41')]:_0x48a82b['model'];if(!_0x132bca[_0xa81c('0x3e')]['hasOwnProperty'](_0xa81c('0x44'))){_0x22eed4[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x132bca[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0x22eed4['offset']=qs[_0xa81c('0x20')](_0x132bca['query'][_0xa81c('0x20')]);}_0x22eed4[_0xa81c('0x45')]=qs['sort'](_0x132bca['query'][_0xa81c('0x46')]);_0x22eed4[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_['pick'](_0x132bca[_0xa81c('0x3e')],_0x48a82b[_0xa81c('0x3f')]),_0x58e340);if(_0x132bca[_0xa81c('0x3e')][_0xa81c('0x2b')]){_0x22eed4['where']=_['merge'](_0x22eed4['where'],{'$or':_[_0xa81c('0x38')](_0x58e340,function(_0x1f550d){if(_0x1f550d['type']!==_0xa81c('0x48')){var _0x22d036={};_0x22d036[_0x1f550d[_0xa81c('0x30')]]={'$like':'%'+_0x132bca['query'][_0xa81c('0x2b')]+'%'};return _0x22d036;}})});}_0x22eed4=_[_0xa81c('0x49')]({},_0x22eed4,_0x132bca['options']);var _0x256d13={'where':_0x22eed4[_0xa81c('0x47')]};return db[_0xa81c('0x4a')][_0xa81c('0x1f')](_0x256d13)[_0xa81c('0x26')](function(_0x3413f6){_0x46ef52[_0xa81c('0x1f')]=_0x3413f6;if(_0x132bca[_0xa81c('0x3e')][_0xa81c('0x4b')]){_0x22eed4['include']=[{'all':!![]}];}return db[_0xa81c('0x4a')][_0xa81c('0x4c')](_0x22eed4);})['then'](function(_0x29c684){_0x46ef52[_0xa81c('0x4d')]=_0x29c684;return _0x46ef52;})[_0xa81c('0x26')](respondWithFilteredResult(_0x5d88e6,_0x22eed4))[_0xa81c('0x4e')](handleError(_0x5d88e6,null));};exports[_0xa81c('0x4f')]=function(_0x4fcf32,_0x20f177){var _0x47a0c8={'raw':![],'where':{'id':_0x4fcf32[_0xa81c('0x50')]['id']}},_0x16b641={};_0x16b641[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x4a')]['rawAttributes']);_0x16b641['query']=_[_0xa81c('0x3d')](_0x4fcf32['query']);_0x16b641['filters']=_[_0xa81c('0x40')](_0x16b641[_0xa81c('0x3c')],_0x16b641[_0xa81c('0x3e')]);_0x47a0c8[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x16b641[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x4fcf32['query'][_0xa81c('0x42')]));_0x47a0c8[_0xa81c('0x41')]=_0x47a0c8['attributes'][_0xa81c('0x43')]?_0x47a0c8[_0xa81c('0x41')]:_0x16b641[_0xa81c('0x3c')];if(_0x4fcf32[_0xa81c('0x3e')][_0xa81c('0x4b')]){_0x47a0c8[_0xa81c('0x51')]=[{'all':!![]}];}_0x47a0c8=_[_0xa81c('0x49')]({},_0x47a0c8,_0x4fcf32[_0xa81c('0x52')]);return db[_0xa81c('0x4a')][_0xa81c('0x2f')](_0x47a0c8)['then'](handleEntityNotFound(_0x20f177,null))['then'](respondWithResult(_0x20f177,null))['catch'](handleError(_0x20f177,null));};exports[_0xa81c('0x53')]=function(_0x44da45,_0x4a3f2c){return db['VoiceQueue'][_0xa81c('0x53')](_0x44da45[_0xa81c('0x54')],{})[_0xa81c('0x26')](function(_0x54236d){var _0x1fa8ce=_0x44da45[_0xa81c('0x55')]['get']({'plain':!![]});if(!_0x1fa8ce)throw new Error(_0xa81c('0x56'));if(_0x1fa8ce[_0xa81c('0x57')]===_0xa81c('0x55')){var _0x2febcf=_0x54236d[_0xa81c('0x28')]({'plain':!![]});var _0x49e4eb=[{'name':'VoiceQueues','value':_0xa81c('0x58')},{'name':_0xa81c('0x29'),'value':'outbound'}];var _0x4b0999=_[_0xa81c('0x2f')](_0x49e4eb,['value',_0x2febcf[_0xa81c('0x2e')]])[_0xa81c('0x30')];return db['UserProfileSection'][_0xa81c('0x2f')]({'where':{'name':_0x4b0999,'userProfileId':_0x1fa8ce[_0xa81c('0x59')]},'raw':!![]})[_0xa81c('0x26')](function(_0x2a88a5){if(_0x2a88a5&&_0x2a88a5[_0xa81c('0x5a')]===0x0){return db[_0xa81c('0x31')]['create']({'name':_0x2febcf[_0xa81c('0x30')],'resourceId':_0x2febcf['id'],'type':_0x2a88a5[_0xa81c('0x30')],'sectionId':_0x2a88a5['id']},{})[_0xa81c('0x26')](function(){return _0x54236d;});}else{return _0x54236d;}})['catch'](function(_0x5121ca){logger['error'](_0xa81c('0x5b'),_0x5121ca);throw _0x5121ca;});}return _0x54236d;})['then'](respondWithResult(_0x4a3f2c,0xc9))['catch'](handleError(_0x4a3f2c,null));};exports[_0xa81c('0x5c')]=function(_0x36dc86,_0x52a9d2){var _0x1f0d59={'where':{'id':_0x36dc86[_0xa81c('0x50')]['id']}},_0x3b0652={};_0x3b0652[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x4a')]['rawAttributes']);_0x1f0d59['attributes']=_[_0xa81c('0x40')](_0x3b0652[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x36dc86[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x1f0d59['attributes']=_0x1f0d59[_0xa81c('0x41')]['length']?_0x1f0d59[_0xa81c('0x41')]:_0x3b0652[_0xa81c('0x3c')];if(_0x36dc86['query']['includeAll']){_0x1f0d59[_0xa81c('0x51')]=[{'all':!![]}];}_0x1f0d59=_[_0xa81c('0x49')]({},_0x1f0d59,_0x36dc86['options']);return db[_0xa81c('0x4a')][_0xa81c('0x2f')](_0x1f0d59)[_0xa81c('0x26')](handleEntityNotFound(_0x52a9d2,null))['then'](function(_0x4ef2b8){if(_0x4ef2b8){var _0x4bdb15=_0x4ef2b8[_0xa81c('0x28')]({'plain':!![]});_0x4bdb15=qs[_0xa81c('0x5d')](_0x4bdb15,['id',_0xa81c('0x5e'),_0xa81c('0x5f')]);_0x36dc86['body']=_[_0xa81c('0x5d')](_0x36dc86['body'],['id',_0xa81c('0x5e'),_0xa81c('0x5f')]);return db[_0xa81c('0x4a')][_0xa81c('0x53')](_['merge'](_0x4bdb15,_0x36dc86['body']),{'include':_0x36dc86[_0xa81c('0x3e')][_0xa81c('0x4b')]?[{'all':!![]}]:undefined})[_0xa81c('0x26')](function(_0x44a918){var _0x3e3f33=_0x36dc86[_0xa81c('0x55')][_0xa81c('0x28')]({'plain':!![]});if(!_0x3e3f33)throw new Error(_0xa81c('0x56'));if(_0x3e3f33[_0xa81c('0x57')]==='user'){var _0x36a6bd=_0x44a918[_0xa81c('0x28')]({'plain':!![]});var _0x1ebfd5=[{'name':'VoiceQueues','value':_0xa81c('0x58')},{'name':_0xa81c('0x29'),'value':_0xa81c('0x2a')}];var _0x1829dc=_[_0xa81c('0x2f')](_0x1ebfd5,[_0xa81c('0x2c'),_0x36a6bd['type']])[_0xa81c('0x30')];return db['UserProfileSection'][_0xa81c('0x2f')]({'where':{'name':_0x1829dc,'userProfileId':_0x3e3f33['userProfileId']},'raw':!![]})[_0xa81c('0x26')](function(_0x14f015){if(_0x14f015&&_0x14f015[_0xa81c('0x5a')]===0x0){return db[_0xa81c('0x31')][_0xa81c('0x53')]({'name':_0x36a6bd[_0xa81c('0x30')],'resourceId':_0x36a6bd['id'],'type':_0x14f015[_0xa81c('0x30')],'sectionId':_0x14f015['id']},{})[_0xa81c('0x26')](function(){return _0x44a918;});}else{return _0x44a918;}})[_0xa81c('0x4e')](function(_0x289149){logger[_0xa81c('0x34')](_0xa81c('0x5b'),_0x289149);throw _0x289149;});}return _0x44a918;});}})[_0xa81c('0x26')](respondWithResult(_0x52a9d2,0xc9))[_0xa81c('0x4e')](handleError(_0x52a9d2,null));};exports[_0xa81c('0x25')]=function(_0x2d0f8c,_0x5abb95){if(_0x2d0f8c[_0xa81c('0x54')]['id']){delete _0x2d0f8c[_0xa81c('0x54')]['id'];}return db['VoiceQueue'][_0xa81c('0x2f')]({'where':{'id':_0x2d0f8c[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x5abb95,null))[_0xa81c('0x26')](saveUpdates(_0x2d0f8c[_0xa81c('0x54')],null))[_0xa81c('0x26')](respondWithResult(_0x5abb95,null))[_0xa81c('0x4e')](handleError(_0x5abb95,null));};exports['destroy']=function(_0x153df1,_0x31c25a){return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x153df1[_0xa81c('0x50')]['id']}})['then'](handleEntityNotFound(_0x31c25a,null))[_0xa81c('0x26')](removeEntity(_0x31c25a,null))[_0xa81c('0x4e')](handleError(_0x31c25a,null));};exports['getHoppers']=function(_0x235c8e,_0x45ff14,_0x50d694){var _0xf0423c={'raw':![],'where':{}};var _0x53763c={};var _0x291175={'count':0x0,'rows':[]};return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x235c8e[_0xa81c('0x50')]['id']}})['then'](handleEntityNotFound(_0x45ff14,null))['then'](function(_0x2af503){if(_0x2af503){_0x53763c[_0xa81c('0x3c')]=_['keys'](db['CmHopper'][_0xa81c('0x39')]);_0x53763c[_0xa81c('0x3e')]=_['keys'](_0x235c8e['query']);_0x53763c[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x53763c[_0xa81c('0x3c')],_0x53763c[_0xa81c('0x3e')]);_0xf0423c[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x53763c['model'],qs[_0xa81c('0x42')](_0x235c8e[_0xa81c('0x3e')][_0xa81c('0x42')]));_0xf0423c['attributes']=_0xf0423c[_0xa81c('0x41')][_0xa81c('0x43')]?_0xf0423c['attributes']:_0x53763c[_0xa81c('0x3c')];if(!_0x235c8e[_0xa81c('0x3e')]['hasOwnProperty'](_0xa81c('0x44'))){_0xf0423c[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x235c8e[_0xa81c('0x3e')]['limit']);_0xf0423c[_0xa81c('0x20')]=qs['offset'](_0x235c8e[_0xa81c('0x3e')][_0xa81c('0x20')]);}_0xf0423c[_0xa81c('0x45')]=qs[_0xa81c('0x46')](_0x235c8e[_0xa81c('0x3e')][_0xa81c('0x46')]);_0xf0423c[_0xa81c('0x47')]=qs['filters'](_['pick'](_0x235c8e[_0xa81c('0x3e')],_0x53763c[_0xa81c('0x3f')]));_0xf0423c[_0xa81c('0x47')][_0xa81c('0x61')]=_0x2af503['id'];if(_0x235c8e[_0xa81c('0x3e')]['filter']){_0xf0423c[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0xf0423c[_0xa81c('0x47')],{'$or':_['map'](_0xf0423c['attributes'],function(_0x31f721){var _0x52699a={};_0x52699a[_0x31f721]={'$like':'%'+_0x235c8e['query'][_0xa81c('0x2b')]+'%'};return _0x52699a;})});}_0xf0423c=_[_0xa81c('0x49')]({},_0xf0423c,_0x235c8e['options']);return db[_0xa81c('0x62')][_0xa81c('0x1f')]({'where':_0xf0423c[_0xa81c('0x47')]})['then'](function(_0x1212cc){_0x291175[_0xa81c('0x1f')]=_0x1212cc;if(_0x235c8e[_0xa81c('0x3e')]['includeAll']){_0xf0423c[_0xa81c('0x51')]=[{'all':!![]}];}return db[_0xa81c('0x62')][_0xa81c('0x4c')](_0xf0423c);})[_0xa81c('0x26')](function(_0x211546){_0x291175[_0xa81c('0x4d')]=_0x211546;return _0x291175;});}})[_0xa81c('0x26')](respondWithFilteredResult(_0x45ff14,_0xf0423c))[_0xa81c('0x4e')](handleError(_0x45ff14,null));};exports[_0xa81c('0x63')]=function(_0x373ed6,_0xa7b7a5,_0x116fb2){var _0x361d6a={'raw':!![],'where':{}};var _0x2ad0cf={};var _0x407622={'count':0x0,'rows':[]};return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x373ed6['params']['id']}})['then'](handleEntityNotFound(_0xa7b7a5,null))[_0xa81c('0x26')](function(_0x5b395b){if(_0x5b395b){_0x2ad0cf['model']=_['keys'](db[_0xa81c('0x64')][_0xa81c('0x39')]);_0x2ad0cf[_0xa81c('0x3e')]=_[_0xa81c('0x3d')](_0x373ed6[_0xa81c('0x3e')]);_0x2ad0cf['filters']=_['intersection'](_0x2ad0cf['model'],_0x2ad0cf[_0xa81c('0x3e')]);_0x361d6a[_0xa81c('0x41')]=_['intersection'](_0x2ad0cf[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x373ed6[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x361d6a['attributes']=_0x361d6a['attributes'][_0xa81c('0x43')]?_0x361d6a['attributes']:_0x2ad0cf['model'];if(!_0x373ed6[_0xa81c('0x3e')]['hasOwnProperty'](_0xa81c('0x44'))){_0x361d6a[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x373ed6[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0x361d6a[_0xa81c('0x20')]=qs[_0xa81c('0x20')](_0x373ed6[_0xa81c('0x3e')][_0xa81c('0x20')]);}_0x361d6a['order']=qs[_0xa81c('0x46')](_0x373ed6['query'][_0xa81c('0x46')]);_0x361d6a[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0x373ed6['query'],_0x2ad0cf['filters']));_0x361d6a[_0xa81c('0x47')][_0xa81c('0x61')]=_0x5b395b['id'];if(_0x373ed6['query']['filter']){_0x361d6a[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0x361d6a['where'],{'$or':_[_0xa81c('0x38')](_0x361d6a['attributes'],function(_0x37b67e){var _0x1f3f73={};_0x1f3f73[_0x37b67e]={'$like':'%'+_0x373ed6[_0xa81c('0x3e')][_0xa81c('0x2b')]+'%'};return _0x1f3f73;})});}_0x361d6a=_[_0xa81c('0x49')]({},_0x361d6a,_0x373ed6[_0xa81c('0x52')]);return db[_0xa81c('0x64')][_0xa81c('0x1f')]({'where':_0x361d6a[_0xa81c('0x47')]})[_0xa81c('0x26')](function(_0x4508a8){_0x407622[_0xa81c('0x1f')]=_0x4508a8;if(_0x373ed6[_0xa81c('0x3e')][_0xa81c('0x4b')]){_0x361d6a[_0xa81c('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa81c('0x4c')](_0x361d6a);})[_0xa81c('0x26')](function(_0x39385f){_0x407622['rows']=_0x39385f;return _0x407622;});}})[_0xa81c('0x26')](respondWithFilteredResult(_0xa7b7a5,_0x361d6a))[_0xa81c('0x4e')](handleError(_0xa7b7a5,null));};exports['getHopperFinals']=function(_0x517074,_0x2813ae,_0x1e42ab){var _0x50ac12={'raw':!![],'where':{}};var _0x41f147={};var _0xf6f224={'count':0x0,'rows':[]};return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x517074[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x2813ae,null))[_0xa81c('0x26')](function(_0x1ab515){if(_0x1ab515){_0x41f147[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x66')][_0xa81c('0x39')]);_0x41f147[_0xa81c('0x3e')]=_[_0xa81c('0x3d')](_0x517074[_0xa81c('0x3e')]);_0x41f147[_0xa81c('0x3f')]=_['intersection'](_0x41f147[_0xa81c('0x3c')],_0x41f147['query']);_0x50ac12[_0xa81c('0x41')]=_['intersection'](_0x41f147[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x517074[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x50ac12[_0xa81c('0x41')]=_0x50ac12['attributes']['length']?_0x50ac12[_0xa81c('0x41')]:_0x41f147['model'];if(!_0x517074['query'][_0xa81c('0x67')]('nolimit')){_0x50ac12[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x517074[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0x50ac12['offset']=qs[_0xa81c('0x20')](_0x517074[_0xa81c('0x3e')][_0xa81c('0x20')]);}_0x50ac12[_0xa81c('0x45')]=qs['sort'](_0x517074[_0xa81c('0x3e')][_0xa81c('0x46')]);_0x50ac12[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_['pick'](_0x517074[_0xa81c('0x3e')],_0x41f147[_0xa81c('0x3f')]));_0x50ac12[_0xa81c('0x47')][_0xa81c('0x61')]=_0x1ab515['id'];if(_0x517074['query']['filter']){_0x50ac12[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0x50ac12[_0xa81c('0x47')],{'$or':_[_0xa81c('0x38')](_0x50ac12[_0xa81c('0x41')],function(_0x31b26a){var _0x400c04={};_0x400c04[_0x31b26a]={'$like':'%'+_0x517074['query'][_0xa81c('0x2b')]+'%'};return _0x400c04;})});}_0x50ac12=_[_0xa81c('0x49')]({},_0x50ac12,_0x517074[_0xa81c('0x52')]);return db[_0xa81c('0x66')]['count']({'where':_0x50ac12[_0xa81c('0x47')]})[_0xa81c('0x26')](function(_0x5aab18){_0xf6f224[_0xa81c('0x1f')]=_0x5aab18;if(_0x517074['query'][_0xa81c('0x4b')]){_0x50ac12[_0xa81c('0x51')]=[{'all':!![]}];}return db[_0xa81c('0x66')][_0xa81c('0x4c')](_0x50ac12);})[_0xa81c('0x26')](function(_0x30693a){_0xf6f224['rows']=_0x30693a;return _0xf6f224;});}})[_0xa81c('0x26')](respondWithFilteredResult(_0x2813ae,_0x50ac12))[_0xa81c('0x4e')](handleError(_0x2813ae,null));};exports[_0xa81c('0x68')]=function(_0x18ce6a,_0x5234c5,_0x55200d){var _0x4e9ffd={'raw':!![],'where':{}};var _0x157aca={};var _0x1f3cf8={'count':0x0,'rows':[]};return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x18ce6a[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x5234c5,null))[_0xa81c('0x26')](function(_0x5f5721){if(_0x5f5721){_0x157aca[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db['CmHopperBlack'][_0xa81c('0x39')]);_0x157aca[_0xa81c('0x3e')]=_[_0xa81c('0x3d')](_0x18ce6a['query']);_0x157aca[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x157aca[_0xa81c('0x3c')],_0x157aca[_0xa81c('0x3e')]);_0x4e9ffd[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x157aca[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x18ce6a[_0xa81c('0x3e')]['fields']));_0x4e9ffd['attributes']=_0x4e9ffd[_0xa81c('0x41')][_0xa81c('0x43')]?_0x4e9ffd['attributes']:_0x157aca[_0xa81c('0x3c')];if(!_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x67')]('nolimit')){_0x4e9ffd[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0x4e9ffd['offset']=qs[_0xa81c('0x20')](_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x20')]);}_0x4e9ffd[_0xa81c('0x45')]=qs[_0xa81c('0x46')](_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x46')]);_0x4e9ffd[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0x18ce6a['query'],_0x157aca[_0xa81c('0x3f')]));_0x4e9ffd[_0xa81c('0x47')][_0xa81c('0x61')]=_0x5f5721['id'];if(_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x2b')]){_0x4e9ffd[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0x4e9ffd[_0xa81c('0x47')],{'$or':_[_0xa81c('0x38')](_0x4e9ffd[_0xa81c('0x41')],function(_0x46e8f2){var _0x3f22b0={};_0x3f22b0[_0x46e8f2]={'$like':'%'+_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x2b')]+'%'};return _0x3f22b0;})});}_0x4e9ffd=_['merge']({},_0x4e9ffd,_0x18ce6a[_0xa81c('0x52')]);return db[_0xa81c('0x69')][_0xa81c('0x1f')]({'where':_0x4e9ffd['where']})['then'](function(_0x30fd9c){_0x1f3cf8['count']=_0x30fd9c;if(_0x18ce6a[_0xa81c('0x3e')][_0xa81c('0x4b')]){_0x4e9ffd[_0xa81c('0x51')]=[{'all':!![]}];}return db[_0xa81c('0x69')][_0xa81c('0x4c')](_0x4e9ffd);})[_0xa81c('0x26')](function(_0x560f97){_0x1f3cf8[_0xa81c('0x4d')]=_0x560f97;return _0x1f3cf8;});}})['then'](respondWithFilteredResult(_0x5234c5,_0x4e9ffd))[_0xa81c('0x4e')](handleError(_0x5234c5,null));};exports['getTeams']=function(_0xab2ef2,_0x5953e2,_0x16278f){var _0xb76107={};var _0x1278ff={};var _0x2c9864;var _0x1e2d66;return db[_0xa81c('0x4a')]['findOne']({'where':{'id':_0xab2ef2[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x5953e2,null))[_0xa81c('0x26')](function(_0x378044){if(_0x378044){_0x2c9864=_0x378044;_0x1278ff[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x6a')][_0xa81c('0x39')]);_0x1278ff['query']=_['keys'](_0xab2ef2['query']);_0x1278ff[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x1278ff[_0xa81c('0x3c')],_0x1278ff[_0xa81c('0x3e')]);_0xb76107[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x1278ff[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0xab2ef2[_0xa81c('0x3e')][_0xa81c('0x42')]));_0xb76107['attributes']=_0xb76107[_0xa81c('0x41')]['length']?_0xb76107['attributes']:_0x1278ff[_0xa81c('0x3c')];_0xb76107[_0xa81c('0x45')]=qs[_0xa81c('0x46')](_0xab2ef2[_0xa81c('0x3e')]['sort']);_0xb76107[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0xab2ef2['query'],_0x1278ff['filters']));if(_0xab2ef2['query']['filter']){_0xb76107[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0xb76107['where'],{'$or':_[_0xa81c('0x38')](_0xb76107[_0xa81c('0x41')],function(_0x5a916c){var _0x574a1c={};_0x574a1c[_0x5a916c]={'$like':'%'+_0xab2ef2['query']['filter']+'%'};return _0x574a1c;})});}_0xb76107=_['merge']({},_0xb76107,_0xab2ef2[_0xa81c('0x52')]);return _0x2c9864['getTeams'](_0xb76107);}})[_0xa81c('0x26')](function(_0x53ed1b){if(_0x53ed1b){_0x1e2d66=_0x53ed1b[_0xa81c('0x43')];if(!_0xab2ef2[_0xa81c('0x3e')]['hasOwnProperty'](_0xa81c('0x44'))){_0xb76107['limit']=qs['limit'](_0xab2ef2[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0xb76107[_0xa81c('0x20')]=qs['offset'](_0xab2ef2[_0xa81c('0x3e')][_0xa81c('0x20')]);}return _0x2c9864[_0xa81c('0x6b')](_0xb76107);}})[_0xa81c('0x26')](function(_0xa31994){if(_0xa31994){return _0xa31994?{'count':_0x1e2d66,'rows':_0xa31994}:null;}})[_0xa81c('0x26')](respondWithResult(_0x5953e2,null))[_0xa81c('0x4e')](handleError(_0x5953e2,null));};exports[_0xa81c('0x6c')]=function(_0x4fcae9,_0x2645ed,_0x54ac72){var _0x18d4bf=_0x4fcae9[_0xa81c('0x54')][_0xa81c('0x6d')];var _0xab264d=_[_0xa81c('0x38')](_0x18d4bf,'id');return db[_0xa81c('0x6a')][_0xa81c('0x4c')]({'where':{'id':_0xab264d},'attributes':['id'],'include':[{'model':db[_0xa81c('0x6e')],'as':_0xa81c('0x6f'),'attributes':['id','name',_0xa81c('0x70'),'voicePause',_0xa81c('0x71')],'raw':!![]}]})[_0xa81c('0x26')](function(_0x1576e7){if(_0x1576e7){var _0x377b9d=_[_0xa81c('0x72')](_0x1576e7,function(_0x130c3d){var _0x4d0dc5=_0x130c3d[_0xa81c('0x28')]({'plain':!![]});_0x4d0dc5[_0xa81c('0x6f')][_0xa81c('0x73')](function(_0x2a150a){_0x2a150a['penalty']=_[_0xa81c('0x2f')](_0x18d4bf,{'id':_0x4d0dc5['id']})['penalty'];});return _0x4d0dc5['Agents'];});return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x4fcae9[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](function(_0x3e8f35){return db[_0xa81c('0x74')][_0xa81c('0x75')](function(_0x5650b5){return _0x3e8f35[_0xa81c('0x6c')](_0xab264d,{'transaction':_0x5650b5})[_0xa81c('0x26')](function(){return BPromise[_0xa81c('0x76')](_0x18d4bf,function(_0x1cf6d9){return db[_0xa81c('0x77')]['upsert']({'TeamId':_0x1cf6d9['id'],'VoiceQueueId':_0x4fcae9[_0xa81c('0x50')]['id'],'penalty':_0x1cf6d9[_0xa81c('0x78')]},{'transaction':_0x5650b5});});})[_0xa81c('0x26')](function(){return BPromise[_0xa81c('0x76')](_0x377b9d,function(_0x3c453e){return db[_0xa81c('0x79')][_0xa81c('0x7a')]({'where':{'UserId':_0x3c453e['id'],'VoiceQueueId':_0x4fcae9['params']['id']},'defaults':{'penalty':_0x3c453e[_0xa81c('0x78')]},'transaction':_0x5650b5});});})[_0xa81c('0x26')](function(){return BPromise['each'](_[_0xa81c('0x2b')](_0x377b9d,{'online':!![]}),function(_0x4e6f7a){return db['UserVoiceQueueRt'][_0xa81c('0x7b')]({'membername':_0x4e6f7a[_0xa81c('0x30')],'UserId':_0x4e6f7a['id'],'queue_name':_0x3e8f35[_0xa81c('0x30')],'VoiceQueueId':_0x3e8f35['id'],'interface':_[_0xa81c('0x7c')](_0x4e6f7a['interface'])?util[_0xa81c('0x7d')](_0xa81c('0x7e'),_0x4e6f7a[_0xa81c('0x30')]):_0x4e6f7a[_0xa81c('0x71')],'paused':_0x4e6f7a['voicePause']||![],'penalty':_0x4e6f7a[_0xa81c('0x78')]},{'transaction':_0x5650b5});});})['then'](function(){_0x377b9d['forEach'](function(_0x1b2d7e){socket[_0xa81c('0x7f')](_0xa81c('0x80'),{'UserId':_0x1b2d7e['id'],'VoiceQueueId':_0x3e8f35['id']});});});});});}})['then'](respondWithStatusCode(_0x2645ed,null))[_0xa81c('0x4e')](handleError(_0x2645ed,null));};exports['removeTeams']=function(_0x1ab492,_0x5dfa84,_0x2029d8){return db[_0xa81c('0x6a')][_0xa81c('0x4c')]({'where':{'id':_0x1ab492['query'][_0xa81c('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa81c('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa81c('0x26')](handleEntityNotFound(_0x5dfa84,null))[_0xa81c('0x26')](function(_0x2d402f){var _0x2f418c=_[_0xa81c('0x38')](_0x2d402f,'id');var _0x52999c=[];var _0x9c3177=[];var _0xade3f2=squel[_0xa81c('0x82')]();_0xade3f2[_0xa81c('0x83')](_0xa81c('0x84'))[_0xa81c('0x85')](_0xa81c('0x86'),'tq')[_0xa81c('0x87')](_0xa81c('0x88'),'ut',_0xa81c('0x89'))[_0xa81c('0x47')](_0xa81c('0x8a'),_0x1ab492[_0xa81c('0x50')]['id']);for(var _0x38ebc2=0x0;_0x38ebc2<_0x2d402f[_0xa81c('0x43')];_0x38ebc2+=0x1){let _0x6afdbe=_0x2d402f[_0x38ebc2];for(var _0x413900=0x0;_0x413900<_0x6afdbe[_0xa81c('0x6f')][_0xa81c('0x43')];_0x413900+=0x1){let _0x32d57c=_0x6afdbe['Agents'][_0x413900];var _0x3811c9=_0xade3f2[_0xa81c('0x5c')]();_0x3811c9[_0xa81c('0x47')](_0xa81c('0x8b'),_0x32d57c['id']);_0x9c3177['push'](db[_0xa81c('0x74')][_0xa81c('0x3e')](_0x3811c9['toString'](),{'type':db[_0xa81c('0x74')][_0xa81c('0x8c')]['SELECT']})[_0xa81c('0x26')](function(_0x10b3e1){if(_0x10b3e1['length']===0x1){return _0x32d57c['id'];}else{var _0x120023=_[_0xa81c('0x8d')](_[_0xa81c('0x38')](_0x10b3e1,_0xa81c('0x8e')),function(_0x2f09a9){return _[_0xa81c('0x2d')](_0x2f418c,_0x2f09a9);});if(_0x120023){return _0x32d57c['id'];}}}));}}return BPromise[_0xa81c('0x8f')](_0x9c3177)[_0xa81c('0x26')](function(_0x3af974){_0x52999c=_(_0x52999c)[_0xa81c('0x90')](_0x3af974)['compact']()[_0xa81c('0x2c')]();return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x1ab492[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](function(_0x5fb200){return db['sequelize']['transaction'](function(_0x4f78b6){return _0x5fb200[_0xa81c('0x91')](_0x1ab492[_0xa81c('0x3e')][_0xa81c('0x81')],{'transaction':_0x4f78b6})[_0xa81c('0x26')](function(){if(!_[_0xa81c('0x92')](_0x52999c)){return _0x5fb200[_0xa81c('0x93')](_0x52999c,{'transaction':_0x4f78b6})['then'](function(){return db[_0xa81c('0x94')][_0xa81c('0x27')]({'where':{'VoiceQueueId':_0x1ab492[_0xa81c('0x50')]['id'],'UserId':_0x52999c},'transaction':_0x4f78b6});});}})[_0xa81c('0x26')](function(){_0x52999c[_0xa81c('0x73')](function(_0x41d548){socket['emit'](_0xa81c('0x95'),{'UserId':_0x41d548,'VoiceQueueId':_0x5fb200['id']});});});});});});})[_0xa81c('0x26')](respondWithStatusCode(_0x5dfa84,null))[_0xa81c('0x4e')](handleError(_0x5dfa84,null));};exports[_0xa81c('0x96')]=function(_0x5ffdfd,_0x182230,_0x28fb73){var _0x31c2a3,_0x151ef6;return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x5ffdfd[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x182230,null))[_0xa81c('0x26')](function(_0x36cdd8){if(_0x36cdd8){_0x151ef6=_0x36cdd8;return _0x36cdd8[_0xa81c('0x96')](_0x5ffdfd[_0xa81c('0x54')][_0xa81c('0x81')],_['omit'](_0x5ffdfd[_0xa81c('0x54')],[_0xa81c('0x81'),'id'])||{})[_0xa81c('0x97')](function(_0x5715d8){for(var _0x554f34=0x0;_0x554f34<_0x5ffdfd['body'][_0xa81c('0x81')][_0xa81c('0x43')];_0x554f34+=0x1){socket[_0xa81c('0x7f')](_0xa81c('0x80'),{'UserId':Number(_0x5ffdfd['body'][_0xa81c('0x81')][_0x554f34]),'VoiceQueueId':Number(_0x5ffdfd['params']['id'])});}return _0x5715d8;});}})[_0xa81c('0x26')](function(_0x5e299e){_0x31c2a3=_0x5e299e||[];if(_0x151ef6){return db[_0xa81c('0x6e')][_0xa81c('0x4c')]({'where':{'id':_0x5ffdfd[_0xa81c('0x54')][_0xa81c('0x81')]},'attributes':['id','name','online',_0xa81c('0x98'),_0xa81c('0x71')],'raw':!![]});}})[_0xa81c('0x26')](function(_0x3d4f15){if(!_['isEmpty'](_0x3d4f15)){var _0x568d7f=[];for(var _0x522e01=0x0;_0x522e01<_0x3d4f15[_0xa81c('0x43')];_0x522e01++){if(_0x3d4f15[_0x522e01][_0xa81c('0x70')]){_0x568d7f['push'](db[_0xa81c('0x94')][_0xa81c('0x7b')]({'membername':_0x3d4f15[_0x522e01][_0xa81c('0x30')],'UserId':_0x3d4f15[_0x522e01]['id'],'queue_name':_0x151ef6[_0xa81c('0x30')],'VoiceQueueId':_0x151ef6['id'],'interface':_['isNil'](_0x3d4f15[_0x522e01]['interface'])?util[_0xa81c('0x7d')](_0xa81c('0x7e'),_0x3d4f15[_0x522e01][_0xa81c('0x30')]):_0x3d4f15[_0x522e01][_0xa81c('0x71')],'paused':_0x3d4f15[_0x522e01][_0xa81c('0x98')]||![],'penalty':_0x5ffdfd[_0xa81c('0x54')]['penalty']||0x0}));}}return BPromise[_0xa81c('0x8f')](_0x568d7f);}})['then'](function(){return _0x31c2a3;})[_0xa81c('0x26')](respondWithResult(_0x182230,null))[_0xa81c('0x4e')](handleError(_0x182230,null));};exports[_0xa81c('0x93')]=function(_0x4288f0,_0x2306f7,_0x374990){return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x4288f0[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x2306f7,null))[_0xa81c('0x26')](function(_0x2a06bf){if(_0x2a06bf){return _0x2a06bf[_0xa81c('0x93')](_0x4288f0['query'][_0xa81c('0x81')])[_0xa81c('0x26')](function(){if(_[_0xa81c('0x99')](_0x4288f0[_0xa81c('0x3e')][_0xa81c('0x81')])){for(var _0x557be2=0x0;_0x557be2<_0x4288f0[_0xa81c('0x3e')]['ids'][_0xa81c('0x43')];_0x557be2+=0x1){socket[_0xa81c('0x7f')](_0xa81c('0x95'),{'UserId':Number(_0x4288f0[_0xa81c('0x3e')][_0xa81c('0x81')][_0x557be2]),'VoiceQueueId':Number(_0x4288f0[_0xa81c('0x50')]['id'])});}}else{socket['emit'](_0xa81c('0x95'),{'UserId':Number(_0x4288f0['query'][_0xa81c('0x81')]),'VoiceQueueId':Number(_0x4288f0[_0xa81c('0x50')]['id'])});}});}})[_0xa81c('0x26')](function(_0x52a5eb){return db[_0xa81c('0x94')][_0xa81c('0x27')]({'where':{'VoiceQueueId':_0x4288f0[_0xa81c('0x50')]['id'],'UserId':_0x4288f0[_0xa81c('0x3e')][_0xa81c('0x81')]}})['then'](function(){return _0x52a5eb;});})[_0xa81c('0x26')](respondWithStatusCode(_0x2306f7,null))[_0xa81c('0x4e')](handleError(_0x2306f7,null));};exports[_0xa81c('0x9a')]=function(_0x495324,_0x54176f,_0x5daa9a){var _0x2af75e={};var _0x4e1117={};var _0x538317;var _0x2121d5;return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x495324[_0xa81c('0x50')]['id']}})['then'](handleEntityNotFound(_0x54176f,null))[_0xa81c('0x26')](function(_0x2b59f6){if(_0x2b59f6){_0x538317=_0x2b59f6;_0x4e1117[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x6e')][_0xa81c('0x39')]);_0x4e1117[_0xa81c('0x3e')]=_['keys'](_0x495324[_0xa81c('0x3e')]);_0x4e1117[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x4e1117[_0xa81c('0x3c')],_0x4e1117[_0xa81c('0x3e')]);_0x2af75e[_0xa81c('0x41')]=_['intersection'](_0x4e1117[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x495324[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x2af75e[_0xa81c('0x41')]=_0x2af75e[_0xa81c('0x41')][_0xa81c('0x43')]?_0x2af75e[_0xa81c('0x41')]:_0x4e1117[_0xa81c('0x3c')];_0x2af75e['order']=qs[_0xa81c('0x46')](_0x495324[_0xa81c('0x3e')][_0xa81c('0x46')]);_0x2af75e[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0x495324[_0xa81c('0x3e')],_0x4e1117[_0xa81c('0x3f')]));if(_0x495324[_0xa81c('0x3e')][_0xa81c('0x2b')]){_0x2af75e[_0xa81c('0x47')]=_['merge'](_0x2af75e[_0xa81c('0x47')],{'$or':_[_0xa81c('0x38')](_0x2af75e[_0xa81c('0x41')],function(_0xaf00dc){var _0x2c00bc={};_0x2c00bc[_0xaf00dc]={'$like':'%'+_0x495324['query'][_0xa81c('0x2b')]+'%'};return _0x2c00bc;})});}_0x2af75e=_[_0xa81c('0x49')]({},_0x2af75e,_0x495324[_0xa81c('0x52')]);return _0x538317[_0xa81c('0x9a')](_0x2af75e);}})[_0xa81c('0x26')](function(_0x57c7cb){if(_0x57c7cb){_0x2121d5=_0x57c7cb[_0xa81c('0x43')];if(!_0x495324[_0xa81c('0x3e')][_0xa81c('0x67')](_0xa81c('0x44'))){_0x2af75e['limit']=qs[_0xa81c('0x1e')](_0x495324['query'][_0xa81c('0x1e')]);_0x2af75e[_0xa81c('0x20')]=qs[_0xa81c('0x20')](_0x495324[_0xa81c('0x3e')][_0xa81c('0x20')]);}return _0x538317[_0xa81c('0x9a')](_0x2af75e);}})['then'](function(_0x2e6b63){if(_0x2e6b63){return _0x2e6b63?{'count':_0x2121d5,'rows':_0x2e6b63}:null;}})[_0xa81c('0x26')](respondWithResult(_0x54176f,null))[_0xa81c('0x4e')](handleError(_0x54176f,null));};exports[_0xa81c('0x9b')]=function(_0xaec361,_0x741226,_0x2c32fc){var _0x1e6c6e={};var _0x114e2a={};var _0x1ff091;var _0xfb008b;return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0xaec361[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x741226,null))[_0xa81c('0x26')](function(_0x2ae782){if(_0x2ae782){_0x1ff091=_0x2ae782;_0x114e2a[_0xa81c('0x3c')]=_['keys'](db[_0xa81c('0x94')][_0xa81c('0x39')]);_0x114e2a[_0xa81c('0x3e')]=_[_0xa81c('0x3d')](_0xaec361[_0xa81c('0x3e')]);_0x114e2a[_0xa81c('0x3f')]=_[_0xa81c('0x40')](_0x114e2a[_0xa81c('0x3c')],_0x114e2a[_0xa81c('0x3e')]);_0x1e6c6e[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x114e2a[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0xaec361[_0xa81c('0x3e')][_0xa81c('0x42')]));_0x1e6c6e[_0xa81c('0x41')]=_0x1e6c6e[_0xa81c('0x41')][_0xa81c('0x43')]?_0x1e6c6e[_0xa81c('0x41')]:_0x114e2a['model'];_0x1e6c6e[_0xa81c('0x45')]=qs[_0xa81c('0x46')](_0xaec361[_0xa81c('0x3e')]['sort']);_0x1e6c6e[_0xa81c('0x47')]=qs['filters'](_['pick'](_0xaec361[_0xa81c('0x3e')],_0x114e2a[_0xa81c('0x3f')]));if(_0xaec361[_0xa81c('0x3e')][_0xa81c('0x2b')]){_0x1e6c6e[_0xa81c('0x47')]=_[_0xa81c('0x49')](_0x1e6c6e['where'],{'$or':_['map'](_0x1e6c6e[_0xa81c('0x41')],function(_0x37789a){var _0x5d7320={};_0x5d7320[_0x37789a]={'$like':'%'+_0xaec361[_0xa81c('0x3e')][_0xa81c('0x2b')]+'%'};return _0x5d7320;})});}_0x1e6c6e=_[_0xa81c('0x49')]({},_0x1e6c6e,_0xaec361[_0xa81c('0x52')]);return _0x1ff091[_0xa81c('0x9b')](_0x1e6c6e);}})['then'](function(_0x21de3d){if(_0x21de3d){_0xfb008b=_0x21de3d[_0xa81c('0x43')];if(!_0xaec361[_0xa81c('0x3e')][_0xa81c('0x67')]('nolimit')){_0x1e6c6e['limit']=qs['limit'](_0xaec361['query'][_0xa81c('0x1e')]);_0x1e6c6e[_0xa81c('0x20')]=qs[_0xa81c('0x20')](_0xaec361[_0xa81c('0x3e')]['offset']);}return _0x1ff091[_0xa81c('0x9b')](_0x1e6c6e);}})[_0xa81c('0x26')](function(_0x1bdf6a){return _0x1bdf6a?{'count':_0xfb008b,'rows':_0x1bdf6a}:null;})[_0xa81c('0x26')](respondWithResult(_0x741226,null))[_0xa81c('0x4e')](handleError(_0x741226,null));};exports[_0xa81c('0x9c')]=function(_0x44a7aa,_0x40b5dd,_0x4d38ba){var _0x3ba18d={};var _0x37fa40={};var _0x57b4c0;var _0x241cf2;return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x44a7aa[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x40b5dd,null))['then'](function(_0x305367){if(_0x305367){_0x57b4c0=_0x305367;_0x37fa40['model']=_['keys'](db[_0xa81c('0x9d')][_0xa81c('0x39')]);_0x37fa40['query']=_[_0xa81c('0x3d')](_0x44a7aa[_0xa81c('0x3e')]);_0x37fa40['filters']=_['intersection'](_0x37fa40[_0xa81c('0x3c')],_0x37fa40['query']);_0x3ba18d[_0xa81c('0x41')]=_[_0xa81c('0x40')](_0x37fa40[_0xa81c('0x3c')],qs[_0xa81c('0x42')](_0x44a7aa[_0xa81c('0x3e')]['fields']));_0x3ba18d[_0xa81c('0x41')]=_0x3ba18d['attributes']['length']?_0x3ba18d[_0xa81c('0x41')]:_0x37fa40[_0xa81c('0x3c')];_0x3ba18d['order']=qs[_0xa81c('0x46')](_0x44a7aa[_0xa81c('0x3e')]['sort']);_0x3ba18d['where']=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0x44a7aa[_0xa81c('0x3e')],_0x37fa40[_0xa81c('0x3f')]));if(_0x44a7aa[_0xa81c('0x3e')][_0xa81c('0x2b')]){_0x3ba18d['where']=_[_0xa81c('0x49')](_0x3ba18d['where'],{'$or':_[_0xa81c('0x38')](_0x3ba18d['attributes'],function(_0x84fd9b){var _0x21a14b={};_0x21a14b[_0x84fd9b]={'$like':'%'+_0x44a7aa[_0xa81c('0x3e')][_0xa81c('0x2b')]+'%'};return _0x21a14b;})});}_0x3ba18d=_['merge']({},_0x3ba18d,_0x44a7aa['options']);return _0x57b4c0[_0xa81c('0x9c')](_0x3ba18d);}})[_0xa81c('0x26')](function(_0xc3dd87){if(_0xc3dd87){_0x241cf2=_0xc3dd87[_0xa81c('0x43')];if(!_0x44a7aa[_0xa81c('0x3e')][_0xa81c('0x67')](_0xa81c('0x44'))){_0x3ba18d[_0xa81c('0x1e')]=qs[_0xa81c('0x1e')](_0x44a7aa['query'][_0xa81c('0x1e')]);_0x3ba18d[_0xa81c('0x20')]=qs['offset'](_0x44a7aa[_0xa81c('0x3e')][_0xa81c('0x20')]);}return _0x57b4c0[_0xa81c('0x9c')](_0x3ba18d);}})[_0xa81c('0x26')](function(_0x6d587a){if(_0x6d587a){return _0x6d587a?{'count':_0x241cf2,'rows':_0x6d587a}:null;}})['then'](respondWithResult(_0x40b5dd,null))[_0xa81c('0x4e')](handleError(_0x40b5dd,null));};exports[_0xa81c('0x9e')]=function(_0x4e9084,_0x42b6cf,_0x42c47c){var _0x5d5ffa,_0x23c11c;return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x4e9084[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x42b6cf,null))[_0xa81c('0x26')](function(_0x1214ad){if(_0x1214ad){_0x23c11c=_0x1214ad;return _0x1214ad['addLists'](_0x4e9084[_0xa81c('0x54')][_0xa81c('0x81')],_['omit'](_0x4e9084['body'],['ids','id'])||{});}return null;})[_0xa81c('0x97')](function(_0x1335fa){var _0x2a462c;_0x5d5ffa=_0x1335fa||[];var _0x4617bf=[];if(_0x1335fa){for(var _0x33b3d7=0x0;_0x33b3d7<_0x1335fa[_0xa81c('0x43')];_0x33b3d7+=0x1){var _0xa5997a=_0x1335fa[_0x33b3d7][_0xa81c('0x28')]({'plain':!![]});_0x23c11c[_0xa81c('0x9f')]=_0x4e9084['body'][_0xa81c('0x9f')]?_0x4e9084['body'][_0xa81c('0x9f')]:_0x23c11c['dialCheckDuplicateType'];switch(_0x23c11c[_0xa81c('0x9f')]){case _0xa81c('0xa0'):_0x2a462c=squel['insert']()[_0xa81c('0xa1')](_0xa81c('0xa2'))['fromQuery']([_0xa81c('0xa3'),_0xa81c('0xa4'),_0xa81c('0xa5'),_0xa81c('0xa6'),'VoiceQueueId','createdAt',_0xa81c('0x5f')],squel[_0xa81c('0x82')]()[_0xa81c('0x83')]('phone',_0xa81c('0xa3'))[_0xa81c('0x83')]('NOW()',_0xa81c('0xa4'))[_0xa81c('0x83')]('id',_0xa81c('0xa5'))[_0xa81c('0x83')](_0xa5997a[_0xa81c('0xa7')][_0xa81c('0xa8')](),_0xa81c('0xa6'))[_0xa81c('0x83')](_0x4e9084[_0xa81c('0x50')]['id']['toString'](),'VoiceQueueId')[_0xa81c('0x83')](_0xa81c('0xa9'),'createdAt')[_0xa81c('0x83')]('NOW()',_0xa81c('0x5f'))[_0xa81c('0x85')](_0xa81c('0xaa'))[_0xa81c('0x47')](_0xa81c('0xab'))[_0xa81c('0x47')](_0xa81c('0xac'),_0xa5997a[_0xa81c('0xa7')]['toString']())[_0xa81c('0x47')](_0xa81c('0xad'))[_0xa81c('0x47')](_0xa81c('0xae'),squel[_0xa81c('0x82')]()[_0xa81c('0x83')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xa81c('0xaf'))[_0xa81c('0x47')](_0xa81c('0x8a'),_0x4e9084[_0xa81c('0x50')]['id'][_0xa81c('0xa8')]()))[_0xa81c('0x47')](_0xa81c('0xae'),squel[_0xa81c('0x82')]()[_0xa81c('0x83')]('COALESCE(phone,\x27\x27)')[_0xa81c('0x85')](_0xa81c('0xa2'))['where']('VoiceQueueId\x20=\x20?',_0x4e9084[_0xa81c('0x50')]['id'][_0xa81c('0xa8')]())))[_0xa81c('0xa8')]();break;case _0xa81c('0xb0'):_0x2a462c=squel[_0xa81c('0xb1')]()['into']('cm_hopper')['fromQuery']([_0xa81c('0xa3'),_0xa81c('0xa4'),_0xa81c('0xa5'),_0xa81c('0xa6'),'VoiceQueueId','createdAt',_0xa81c('0x5f')],squel[_0xa81c('0x82')]()[_0xa81c('0x83')](_0xa81c('0xa3'),'phone')['field'](_0xa81c('0xa9'),'scheduledAt')['field']('id',_0xa81c('0xa5'))[_0xa81c('0x83')](_0xa5997a[_0xa81c('0xa7')][_0xa81c('0xa8')](),_0xa81c('0xa6'))[_0xa81c('0x83')](_0x4e9084['params']['id'][_0xa81c('0xa8')](),_0xa81c('0x61'))[_0xa81c('0x83')]('NOW()',_0xa81c('0x5e'))[_0xa81c('0x83')](_0xa81c('0xa9'),_0xa81c('0x5f'))[_0xa81c('0x85')]('cm_contacts')[_0xa81c('0x47')](_0xa81c('0xab'))[_0xa81c('0x47')](_0xa81c('0xac'),_0xa5997a[_0xa81c('0xa7')]['toString']())[_0xa81c('0x47')](_0xa81c('0xad'))['where'](_0xa81c('0xae'),squel[_0xa81c('0x82')]()[_0xa81c('0x83')]('COALESCE(phone,\x27\x27)')[_0xa81c('0x85')](_0xa81c('0xa2'))[_0xa81c('0x47')](_0xa81c('0x8a'),_0x4e9084[_0xa81c('0x50')]['id'][_0xa81c('0xa8')]())))[_0xa81c('0xa8')]();break;default:_0x2a462c=squel[_0xa81c('0xb1')]()[_0xa81c('0xa1')](_0xa81c('0xa2'))[_0xa81c('0xb2')]([_0xa81c('0xa3'),_0xa81c('0xa4'),'ContactId',_0xa81c('0xa6'),_0xa81c('0x61'),'createdAt',_0xa81c('0x5f')],squel[_0xa81c('0x82')]()['field']('phone',_0xa81c('0xa3'))[_0xa81c('0x83')](_0xa81c('0xa9'),'scheduledAt')[_0xa81c('0x83')]('id','ContactId')['field'](_0xa5997a[_0xa81c('0xa7')][_0xa81c('0xa8')](),_0xa81c('0xa6'))[_0xa81c('0x83')](_0x4e9084['params']['id'][_0xa81c('0xa8')](),_0xa81c('0x61'))[_0xa81c('0x83')]('NOW()',_0xa81c('0x5e'))[_0xa81c('0x83')]('NOW()',_0xa81c('0x5f'))['from'](_0xa81c('0xaa'))[_0xa81c('0x47')](_0xa81c('0xab'))['where'](_0xa81c('0xac'),_0xa5997a[_0xa81c('0xa7')][_0xa81c('0xa8')]())['where'](_0xa81c('0xad')))[_0xa81c('0xa8')]();}_0x4617bf['push'](db[_0xa81c('0x74')]['query'](_0x2a462c));}return BPromise[_0xa81c('0x8f')](_0x4617bf);}})[_0xa81c('0x26')](function(){return _0x5d5ffa;})[_0xa81c('0x26')](respondWithResult(_0x42b6cf,null))['catch'](handleError(_0x42b6cf,null));};exports[_0xa81c('0xb3')]=function(_0x4973b9,_0x582247,_0x276e47){return db['VoiceQueue'][_0xa81c('0x2f')]({'where':{'id':_0x4973b9[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x582247,null))[_0xa81c('0x26')](function(_0x4987e1){if(_0x4987e1){return _0x4987e1['removeLists'](_0x4973b9[_0xa81c('0x3e')]['ids']);}})[_0xa81c('0x26')](function(_0x154e60){if(_0x154e60){return db[_0xa81c('0x62')][_0xa81c('0x27')]({'where':{'ListId':_0x4973b9['query']['ids'],'VoiceQueueId':_0x4973b9[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](function(){return _0x154e60;});}})['then'](respondWithStatusCode(_0x582247,null))[_0xa81c('0x4e')](handleError(_0x582247,null));};exports[_0xa81c('0xb4')]=function(_0x2e165a,_0x57bdb6,_0x1c38e7){var _0xdae11f={};var _0x143bbf={};var _0x502fd1;var _0x3b31fb;return db[_0xa81c('0x4a')][_0xa81c('0x60')]({'where':{'id':_0x2e165a[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x57bdb6,null))['then'](function(_0x1c3b2a){if(_0x1c3b2a){_0x502fd1=_0x1c3b2a;_0x143bbf[_0xa81c('0x3c')]=_[_0xa81c('0x3d')](db[_0xa81c('0x9d')][_0xa81c('0x39')]);_0x143bbf[_0xa81c('0x3e')]=_[_0xa81c('0x3d')](_0x2e165a[_0xa81c('0x3e')]);_0x143bbf['filters']=_[_0xa81c('0x40')](_0x143bbf[_0xa81c('0x3c')],_0x143bbf[_0xa81c('0x3e')]);_0xdae11f[_0xa81c('0x41')]=_['intersection'](_0x143bbf['model'],qs[_0xa81c('0x42')](_0x2e165a['query'][_0xa81c('0x42')]));_0xdae11f['attributes']=_0xdae11f[_0xa81c('0x41')][_0xa81c('0x43')]?_0xdae11f[_0xa81c('0x41')]:_0x143bbf[_0xa81c('0x3c')];_0xdae11f[_0xa81c('0x45')]=qs[_0xa81c('0x46')](_0x2e165a[_0xa81c('0x3e')]['sort']);_0xdae11f[_0xa81c('0x47')]=qs[_0xa81c('0x3f')](_[_0xa81c('0x65')](_0x2e165a[_0xa81c('0x3e')],_0x143bbf[_0xa81c('0x3f')]));if(_0x2e165a[_0xa81c('0x3e')]['filter']){_0xdae11f[_0xa81c('0x47')]=_['merge'](_0xdae11f['where'],{'$or':_[_0xa81c('0x38')](_0xdae11f[_0xa81c('0x41')],function(_0x27a31b){var _0x4b382c={};_0x4b382c[_0x27a31b]={'$like':'%'+_0x2e165a[_0xa81c('0x3e')][_0xa81c('0x2b')]+'%'};return _0x4b382c;})});}_0xdae11f=_[_0xa81c('0x49')]({},_0xdae11f,_0x2e165a['options']);return _0x502fd1[_0xa81c('0xb4')](_0xdae11f);}})[_0xa81c('0x26')](function(_0x274e85){if(_0x274e85){_0x3b31fb=_0x274e85[_0xa81c('0x43')];if(!_0x2e165a[_0xa81c('0x3e')][_0xa81c('0x67')](_0xa81c('0x44'))){_0xdae11f['limit']=qs[_0xa81c('0x1e')](_0x2e165a[_0xa81c('0x3e')][_0xa81c('0x1e')]);_0xdae11f[_0xa81c('0x20')]=qs[_0xa81c('0x20')](_0x2e165a['query'][_0xa81c('0x20')]);}return _0x502fd1[_0xa81c('0xb4')](_0xdae11f);}})[_0xa81c('0x26')](function(_0x322d9b){if(_0x322d9b){return _0x322d9b?{'count':_0x3b31fb,'rows':_0x322d9b}:null;}})[_0xa81c('0x26')](respondWithResult(_0x57bdb6,null))[_0xa81c('0x4e')](handleError(_0x57bdb6,null));};exports[_0xa81c('0xb5')]=function(_0x4d4fec,_0x5bd479,_0x42bc59){var _0x19e110,_0x2fe6fb;return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x4d4fec[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x5bd479,null))[_0xa81c('0x26')](function(_0x2bdf05){if(_0x2bdf05){_0x2fe6fb=_0x2bdf05;return _0x2bdf05['addBlackLists'](_0x4d4fec['body'][_0xa81c('0x81')],_[_0xa81c('0x5d')](_0x4d4fec[_0xa81c('0x54')],[_0xa81c('0x81'),'id'])||{});}return null;})[_0xa81c('0x97')](function(_0x385ace){var _0x4cdec7;_0x19e110=_0x385ace||[];var _0x54f354=[];if(_0x385ace){for(var _0x279cda=0x0;_0x279cda<_0x385ace[_0xa81c('0x43')];_0x279cda+=0x1){var _0x207590=_0x385ace[_0x279cda][_0xa81c('0x28')]({'plain':!![]});_0x4cdec7=squel[_0xa81c('0xb1')]()[_0xa81c('0xa1')](_0xa81c('0xb6'))[_0xa81c('0xb2')]([_0xa81c('0xa3'),_0xa81c('0xa5'),_0xa81c('0xa6'),_0xa81c('0x61'),_0xa81c('0x5e'),_0xa81c('0x5f')],squel['select']()[_0xa81c('0x83')](_0xa81c('0xa3'),_0xa81c('0xa3'))['field']('id','ContactId')['field'](_0x207590[_0xa81c('0xa7')]['toString'](),_0xa81c('0xa6'))['field'](_0x4d4fec[_0xa81c('0x50')]['id'][_0xa81c('0xa8')](),_0xa81c('0x61'))['field'](_0xa81c('0xa9'),_0xa81c('0x5e'))[_0xa81c('0x83')](_0xa81c('0xa9'),'updatedAt')['from'](_0xa81c('0xaa'))[_0xa81c('0x47')](_0xa81c('0xab'))[_0xa81c('0x47')](_0xa81c('0xac'),_0x207590[_0xa81c('0xa7')][_0xa81c('0xa8')]())[_0xa81c('0x47')](_0xa81c('0xad')))['toString']();_0x54f354[_0xa81c('0xb7')](db[_0xa81c('0x74')][_0xa81c('0x3e')](_0x4cdec7));}return BPromise[_0xa81c('0x8f')](_0x54f354);}})[_0xa81c('0x26')](function(){return _0x19e110;})['then'](respondWithResult(_0x5bd479,null))['catch'](handleError(_0x5bd479,null));};exports['removeBlackLists']=function(_0x2ce946,_0x243226,_0x51dc60){return db[_0xa81c('0x4a')][_0xa81c('0x2f')]({'where':{'id':_0x2ce946[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](handleEntityNotFound(_0x243226,null))[_0xa81c('0x26')](function(_0x4d5fc3){if(_0x4d5fc3){return _0x4d5fc3[_0xa81c('0xb8')](_0x2ce946[_0xa81c('0x3e')][_0xa81c('0x81')]);}})[_0xa81c('0x26')](function(_0x4fc65f){if(_0x4fc65f){return db['CmHopperBlack'][_0xa81c('0x27')]({'where':{'ListId':_0x2ce946['query']['ids'],'VoiceQueueId':_0x2ce946[_0xa81c('0x50')]['id']}})[_0xa81c('0x26')](function(){return _0x4fc65f;});}})['then'](respondWithStatusCode(_0x243226,null))['catch'](handleError(_0x243226,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 80fbd91..6d691c2 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 _0xed56=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xed56,0x1da));var _0x6ed5=function(_0x453c28,_0x47935f){_0x453c28=_0x453c28-0x0;var _0x1fc710=_0xed56[_0x453c28];return _0x1fc710;};'use strict';var EventEmitter=require(_0x6ed5('0x0'));var VoiceQueue=require(_0x6ed5('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6ed5('0x2')](0x0);var events={'afterCreate':_0x6ed5('0x3'),'afterUpdate':_0x6ed5('0x4'),'afterDestroy':_0x6ed5('0x5')};function emitEvent(_0x2618bb){return function(_0x17d189,_0x5b51ec,_0x5c5975){VoiceQueueEvents[_0x6ed5('0x6')](_0x2618bb+':'+_0x17d189['id'],_0x17d189);VoiceQueueEvents[_0x6ed5('0x6')](_0x2618bb,_0x17d189);_0x5c5975(null);};}for(var e in events){if(events[_0x6ed5('0x7')](e)){var event=events[e];VoiceQueue[_0x6ed5('0x8')](e,emitEvent(event));}}module[_0x6ed5('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x13d1=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x435819,_0x5e35db){var _0x1bf766=function(_0x3ed522){while(--_0x3ed522){_0x435819['push'](_0x435819['shift']());}};_0x1bf766(++_0x5e35db);}(_0x13d1,0xa4));var _0x113d=function(_0xdc8da5,_0x49e809){_0xdc8da5=_0xdc8da5-0x0;var _0x27d466=_0x13d1[_0xdc8da5];return _0x27d466;};'use strict';var EventEmitter=require(_0x113d('0x0'));var VoiceQueue=require(_0x113d('0x1'))['db'][_0x113d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x113d('0x3')](0x0);var events={'afterCreate':_0x113d('0x4'),'afterUpdate':_0x113d('0x5'),'afterDestroy':_0x113d('0x6')};function emitEvent(_0x1a97bf){return function(_0x5b2d55,_0x57c404,_0x3db59f){VoiceQueueEvents[_0x113d('0x7')](_0x1a97bf+':'+_0x5b2d55['id'],_0x5b2d55);VoiceQueueEvents[_0x113d('0x7')](_0x1a97bf,_0x5b2d55);_0x3db59f(null);};}for(var e in events){if(events[_0x113d('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x113d('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 04bc14d..3bf53a3 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x4d0c01,_0x21185c){var _0xcbae04=function(_0x18597b){while(--_0x18597b){_0x4d0c01['push'](_0x4d0c01['shift']());}};_0xcbae04(++_0x21185c);}(_0x34e8,0x12c));var _0x834e=function(_0x3d910,_0x1fd046){_0x3d910=_0x3d910-0x0;var _0x23ae57=_0x34e8[_0x3d910];return _0x23ae57;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x3ffd40,_0x4c65b8){var _0x14309d=function(_0x48886e){while(--_0x48886e){_0x3ffd40['push'](_0x3ffd40['shift']());}};_0x14309d(++_0x4c65b8);}(_0x70e0,0x17b));var _0x070e=function(_0xc57b80,_0x157054){_0xc57b80=_0xc57b80-0x0;var _0x53f86a=_0x70e0[_0xc57b80];return _0x53f86a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 f7d847b..135935e 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 _0x5cc0=['request\x20sent','debug','error','code','message','catch','GetVoiceQueue','findAll','options','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','find','raw','where','stringify','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x2a1c66,_0x57fdf2){var _0x39e6eb=function(_0x10c30a){while(--_0x10c30a){_0x2a1c66['push'](_0x2a1c66['shift']());}};_0x39e6eb(++_0x57fdf2);}(_0x5cc0,0xf2));var _0x05cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5cc0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x05cc('0x0'));var moment=require(_0x05cc('0x1'));var BPromise=require(_0x05cc('0x2'));var rs=require(_0x05cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x05cc('0x4'))(_0x05cc('0x5'));var config=require('../../config/environment');var jayson=require(_0x05cc('0x6'));var client=jayson[_0x05cc('0x7')][_0x05cc('0x8')]({'port':0x232a});config['redis']=_[_0x05cc('0x9')](config[_0x05cc('0xa')],{'host':_0x05cc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05cc('0xa')]));require(_0x05cc('0xc'))['register'](socket);function respondWithRpcPromise(_0x47e25c,_0x40568d,_0x2f0ae0){return new BPromise(function(_0x124e6e,_0x96b0b6){return client[_0x05cc('0xd')](_0x47e25c,_0x2f0ae0)[_0x05cc('0xe')](function(_0x15ff84){logger[_0x05cc('0xf')](_0x05cc('0x10'),_0x40568d,_0x05cc('0x11'));logger[_0x05cc('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x40568d,_0x05cc('0x11'),JSON['stringify'](_0x15ff84));if(_0x15ff84[_0x05cc('0x13')]){if(_0x15ff84['error'][_0x05cc('0x14')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x40568d,_0x15ff84[_0x05cc('0x13')][_0x05cc('0x15')]);return _0x96b0b6(_0x15ff84[_0x05cc('0x13')][_0x05cc('0x15')]);}logger[_0x05cc('0x13')](_0x05cc('0x10'),_0x40568d,_0x15ff84[_0x05cc('0x13')]['message']);return _0x124e6e(_0x15ff84['error'][_0x05cc('0x15')]);}else{logger[_0x05cc('0xf')](_0x05cc('0x10'),_0x40568d,_0x05cc('0x11'));_0x124e6e(_0x15ff84['result']['message']);}})[_0x05cc('0x16')](function(_0x3fe89d){logger[_0x05cc('0x13')](_0x05cc('0x10'),_0x40568d,_0x3fe89d);_0x96b0b6(_0x3fe89d);});});}exports[_0x05cc('0x17')]=function(_0x31cbc3){var _0x2aeb04=this;return new Promise(function(_0x1f2f03,_0x5942e3){return db['VoiceQueue'][_0x05cc('0x18')]({'raw':_0x31cbc3[_0x05cc('0x19')]?_0x31cbc3[_0x05cc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x31cbc3[_0x05cc('0x19')]?_0x31cbc3[_0x05cc('0x19')]['where']||null:null,'attributes':_0x31cbc3[_0x05cc('0x19')]?_0x31cbc3[_0x05cc('0x19')][_0x05cc('0x1a')]||null:null,'limit':_0x31cbc3['options']?_0x31cbc3[_0x05cc('0x19')][_0x05cc('0x1b')]||null:null,'include':_0x31cbc3['options']?_0x31cbc3[_0x05cc('0x19')][_0x05cc('0x1c')]?_[_0x05cc('0x1d')](_0x31cbc3[_0x05cc('0x19')]['include'],function(_0x81ef41){return{'model':db[_0x81ef41[_0x05cc('0x1e')]],'as':_0x81ef41['as'],'attributes':_0x81ef41[_0x05cc('0x1a')],'include':_0x81ef41[_0x05cc('0x1c')]?_['map'](_0x81ef41[_0x05cc('0x1c')],function(_0x485e2f){return{'model':db[_0x485e2f[_0x05cc('0x1e')]],'as':_0x485e2f['as'],'attributes':_0x485e2f[_0x05cc('0x1a')],'include':_0x485e2f[_0x05cc('0x1c')]?_['map'](_0x485e2f[_0x05cc('0x1c')],function(_0x4b00ac){return{'model':db[_0x4b00ac[_0x05cc('0x1e')]],'as':_0x4b00ac['as'],'attributes':_0x4b00ac[_0x05cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x05cc('0xe')](function(_0x58deb4){logger[_0x05cc('0xf')](_0x05cc('0x17'),_0x31cbc3);logger['debug'](_0x05cc('0x17'),_0x31cbc3,JSON['stringify'](_0x58deb4));_0x1f2f03(_0x58deb4);})[_0x05cc('0x16')](function(_0x1d4f01){logger[_0x05cc('0x13')](_0x05cc('0x17'),_0x1d4f01['message'],_0x31cbc3);_0x5942e3(_0x2aeb04[_0x05cc('0x13')](0x1f4,_0x1d4f01[_0x05cc('0x15')]));});});};exports[_0x05cc('0x1f')]=function(_0x3ec4e1){var _0x2339ec=this;return new Promise(function(_0x37270d,_0x213676){return db[_0x05cc('0x20')][_0x05cc('0x21')]({'raw':_0x3ec4e1[_0x05cc('0x19')]?_0x3ec4e1[_0x05cc('0x19')][_0x05cc('0x22')]===undefined?!![]:![]:!![],'where':_0x3ec4e1[_0x05cc('0x19')]?_0x3ec4e1[_0x05cc('0x19')][_0x05cc('0x23')]||null:null,'attributes':_0x3ec4e1[_0x05cc('0x19')]?_0x3ec4e1['options'][_0x05cc('0x1a')]||null:null,'include':_0x3ec4e1[_0x05cc('0x19')]?_0x3ec4e1[_0x05cc('0x19')][_0x05cc('0x1c')]?_[_0x05cc('0x1d')](_0x3ec4e1[_0x05cc('0x19')]['include'],function(_0x2b2490){return{'model':db[_0x2b2490[_0x05cc('0x1e')]],'as':_0x2b2490['as'],'attributes':_0x2b2490[_0x05cc('0x1a')],'include':_0x2b2490[_0x05cc('0x1c')]?_[_0x05cc('0x1d')](_0x2b2490[_0x05cc('0x1c')],function(_0xfe9858){return{'model':db[_0xfe9858['model']],'as':_0xfe9858['as'],'attributes':_0xfe9858[_0x05cc('0x1a')],'include':_0xfe9858[_0x05cc('0x1c')]?_[_0x05cc('0x1d')](_0xfe9858['include'],function(_0x5acc60){return{'model':db[_0x5acc60[_0x05cc('0x1e')]],'as':_0x5acc60['as'],'attributes':_0x5acc60[_0x05cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x05cc('0xe')](function(_0x41d6d1){logger[_0x05cc('0xf')](_0x05cc('0x1f'),_0x3ec4e1);logger['debug'](_0x05cc('0x1f'),_0x3ec4e1,JSON[_0x05cc('0x24')](_0x41d6d1));_0x37270d(_0x41d6d1);})[_0x05cc('0x16')](function(_0x36c924){logger[_0x05cc('0x13')](_0x05cc('0x1f'),_0x36c924[_0x05cc('0x15')],_0x3ec4e1);_0x213676(_0x2339ec[_0x05cc('0x13')](0x1f4,_0x36c924[_0x05cc('0x15')]));});});}; \ No newline at end of file +var _0x52fb=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','findAll','options','raw','attributes','limit','map','model','include','ShowVoiceQueue','VoiceQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfd8c4c,_0x563eed){var _0x58762=function(_0x1c41c4){while(--_0x1c41c4){_0xfd8c4c['push'](_0xfd8c4c['shift']());}};_0x58762(++_0x563eed);}(_0x52fb,0x6b));var _0xb52f=function(_0x341220,_0x56d7fc){_0x341220=_0x341220-0x0;var _0x1d6b64=_0x52fb[_0x341220];return _0x1d6b64;};'use strict';var _=require(_0xb52f('0x0'));var util=require('util');var moment=require(_0xb52f('0x1'));var BPromise=require(_0xb52f('0x2'));var rs=require(_0xb52f('0x3'));var fs=require('fs');var Redis=require(_0xb52f('0x4'));var db=require(_0xb52f('0x5'))['db'];var utils=require(_0xb52f('0x6'));var logger=require(_0xb52f('0x7'))('rpc');var config=require(_0xb52f('0x8'));var jayson=require(_0xb52f('0x9'));var client=jayson[_0xb52f('0xa')][_0xb52f('0xb')]({'port':0x232a});config['redis']=_[_0xb52f('0xc')](config[_0xb52f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb52f('0xe'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x37e5f5,_0x53dfb5,_0x1833ad){return new BPromise(function(_0x2d819f,_0x440481){return client['request'](_0x37e5f5,_0x1833ad)[_0xb52f('0xf')](function(_0x568e1d){logger[_0xb52f('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x53dfb5,_0xb52f('0x11'));logger[_0xb52f('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x53dfb5,_0xb52f('0x11'),JSON[_0xb52f('0x13')](_0x568e1d));if(_0x568e1d[_0xb52f('0x14')]){if(_0x568e1d[_0xb52f('0x14')][_0xb52f('0x15')]===0x1f4){logger[_0xb52f('0x14')](_0xb52f('0x16'),_0x53dfb5,_0x568e1d['error'][_0xb52f('0x17')]);return _0x440481(_0x568e1d[_0xb52f('0x14')]['message']);}logger[_0xb52f('0x14')](_0xb52f('0x16'),_0x53dfb5,_0x568e1d[_0xb52f('0x14')][_0xb52f('0x17')]);return _0x2d819f(_0x568e1d[_0xb52f('0x14')][_0xb52f('0x17')]);}else{logger[_0xb52f('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x53dfb5,'request\x20sent');_0x2d819f(_0x568e1d[_0xb52f('0x18')][_0xb52f('0x17')]);}})['catch'](function(_0x2ead6b){logger['error'](_0xb52f('0x16'),_0x53dfb5,_0x2ead6b);_0x440481(_0x2ead6b);});});}exports[_0xb52f('0x19')]=function(_0x1e3efa){var _0x5979c1=this;return new Promise(function(_0x14ad9c,_0x3b19e9){return db['VoiceQueue'][_0xb52f('0x1a')]({'raw':_0x1e3efa[_0xb52f('0x1b')]?_0x1e3efa[_0xb52f('0x1b')][_0xb52f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e3efa['options']?_0x1e3efa[_0xb52f('0x1b')]['where']||null:null,'attributes':_0x1e3efa[_0xb52f('0x1b')]?_0x1e3efa[_0xb52f('0x1b')][_0xb52f('0x1d')]||null:null,'limit':_0x1e3efa[_0xb52f('0x1b')]?_0x1e3efa[_0xb52f('0x1b')][_0xb52f('0x1e')]||null:null,'include':_0x1e3efa['options']?_0x1e3efa[_0xb52f('0x1b')]['include']?_[_0xb52f('0x1f')](_0x1e3efa[_0xb52f('0x1b')]['include'],function(_0x2a558b){return{'model':db[_0x2a558b[_0xb52f('0x20')]],'as':_0x2a558b['as'],'attributes':_0x2a558b['attributes'],'include':_0x2a558b[_0xb52f('0x21')]?_['map'](_0x2a558b['include'],function(_0x20679f){return{'model':db[_0x20679f[_0xb52f('0x20')]],'as':_0x20679f['as'],'attributes':_0x20679f['attributes'],'include':_0x20679f[_0xb52f('0x21')]?_[_0xb52f('0x1f')](_0x20679f['include'],function(_0x486a39){return{'model':db[_0x486a39[_0xb52f('0x20')]],'as':_0x486a39['as'],'attributes':_0x486a39[_0xb52f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb52f('0xf')](function(_0x1ce11f){logger[_0xb52f('0x10')](_0xb52f('0x19'),_0x1e3efa);logger['debug']('GetVoiceQueue',_0x1e3efa,JSON[_0xb52f('0x13')](_0x1ce11f));_0x14ad9c(_0x1ce11f);})['catch'](function(_0x150c21){logger[_0xb52f('0x14')]('GetVoiceQueue',_0x150c21[_0xb52f('0x17')],_0x1e3efa);_0x3b19e9(_0x5979c1[_0xb52f('0x14')](0x1f4,_0x150c21['message']));});});};exports[_0xb52f('0x22')]=function(_0x97e61c){var _0x48a98a=this;return new Promise(function(_0xe3c71e,_0x10a8a7){return db[_0xb52f('0x23')][_0xb52f('0x24')]({'raw':_0x97e61c['options']?_0x97e61c['options'][_0xb52f('0x1c')]===undefined?!![]:![]:!![],'where':_0x97e61c['options']?_0x97e61c[_0xb52f('0x1b')][_0xb52f('0x25')]||null:null,'attributes':_0x97e61c[_0xb52f('0x1b')]?_0x97e61c[_0xb52f('0x1b')][_0xb52f('0x1d')]||null:null,'include':_0x97e61c[_0xb52f('0x1b')]?_0x97e61c[_0xb52f('0x1b')][_0xb52f('0x21')]?_[_0xb52f('0x1f')](_0x97e61c[_0xb52f('0x1b')][_0xb52f('0x21')],function(_0x2e165d){return{'model':db[_0x2e165d['model']],'as':_0x2e165d['as'],'attributes':_0x2e165d[_0xb52f('0x1d')],'include':_0x2e165d['include']?_[_0xb52f('0x1f')](_0x2e165d[_0xb52f('0x21')],function(_0x50f000){return{'model':db[_0x50f000[_0xb52f('0x20')]],'as':_0x50f000['as'],'attributes':_0x50f000[_0xb52f('0x1d')],'include':_0x50f000['include']?_[_0xb52f('0x1f')](_0x50f000[_0xb52f('0x21')],function(_0x2b9730){return{'model':db[_0x2b9730[_0xb52f('0x20')]],'as':_0x2b9730['as'],'attributes':_0x2b9730['attributes']};}):[]};}):[]};}):[]:[]})[_0xb52f('0xf')](function(_0x27bb65){logger[_0xb52f('0x10')]('ShowVoiceQueue',_0x97e61c);logger[_0xb52f('0x12')](_0xb52f('0x22'),_0x97e61c,JSON[_0xb52f('0x13')](_0x27bb65));_0xe3c71e(_0x27bb65);})['catch'](function(_0x4ae86f){logger[_0xb52f('0x14')](_0xb52f('0x22'),_0x4ae86f[_0xb52f('0x17')],_0x97e61c);_0x10a8a7(_0x48a98a[_0xb52f('0x14')](0x1f4,_0x4ae86f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2a926f7..d8fcefe 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 _0x6326=['length','save','remove','update','emit','removeListener','register'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x6326,0x17b));var _0x6632=function(_0x3b30b0,_0x3af2bf){_0x3b30b0=_0x3b30b0-0x0;var _0x36b8e5=_0x6326[_0x3b30b0];return _0x36b8e5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x6632('0x0'),_0x6632('0x1'),_0x6632('0x2')];function createListener(_0x4f85e0,_0xc749da){return function(_0x564800){_0xc749da[_0x6632('0x3')](_0x4f85e0,_0x564800);};}function removeListener(_0x586155,_0x7e02e3){return function(){VoiceQueueEvents[_0x6632('0x4')](_0x586155,_0x7e02e3);};}exports[_0x6632('0x5')]=function(_0x2d3a98){for(var _0x23c600=0x0,_0x35a4be=events[_0x6632('0x6')];_0x23c600<_0x35a4be;_0x23c600++){var _0x2a0563=events[_0x23c600];var _0x4fe0ba=createListener('voiceQueue:'+_0x2a0563,_0x2d3a98);VoiceQueueEvents['on'](_0x2a0563,_0x4fe0ba);}}; \ No newline at end of file +var _0x01c8=['save','remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x455bcf,_0x1392ec){var _0x55f9c9=function(_0x57f7d5){while(--_0x57f7d5){_0x455bcf['push'](_0x455bcf['shift']());}};_0x55f9c9(++_0x1392ec);}(_0x01c8,0x137));var _0x801c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x01c8[_0x2b4411];return _0x8e41ef;};'use strict';var VoiceQueueEvents=require(_0x801c('0x0'));var events=[_0x801c('0x1'),_0x801c('0x2'),'update'];function createListener(_0x5c043e,_0x92635f){return function(_0x2e791c){_0x92635f[_0x801c('0x3')](_0x5c043e,_0x2e791c);};}function removeListener(_0x3a9c19,_0x30a83b){return function(){VoiceQueueEvents[_0x801c('0x4')](_0x3a9c19,_0x30a83b);};}exports[_0x801c('0x5')]=function(_0x5cf0a5){for(var _0x5ba3ed=0x0,_0x30b070=events[_0x801c('0x6')];_0x5ba3ed<_0x30b070;_0x5ba3ed++){var _0x18a1ae=events[_0x5ba3ed];var _0x5968ff=createListener(_0x801c('0x7')+_0x18a1ae,_0x5cf0a5);VoiceQueueEvents['on'](_0x18a1ae,_0x5968ff);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7a8ed8f..1993896 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 _0xe6a9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0xe6a9,0x69));var _0x9e6a=function(_0x449b61,_0x56dc7c){_0x449b61=_0x449b61-0x0;var _0xfb9922=_0xe6a9[_0x449b61];return _0xfb9922;};'use strict';var multer=require(_0x9e6a('0x0'));var util=require(_0x9e6a('0x1'));var path=require(_0x9e6a('0x2'));var timeout=require(_0x9e6a('0x3'));var express=require(_0x9e6a('0x4'));var router=express[_0x9e6a('0x5')]();var fs_extra=require(_0x9e6a('0x6'));var auth=require(_0x9e6a('0x7'));var interaction=require(_0x9e6a('0x8'));var config=require(_0x9e6a('0x9'));var controller=require(_0x9e6a('0xa'));router[_0x9e6a('0xb')]('/',auth[_0x9e6a('0xc')](),controller[_0x9e6a('0xd')]);router[_0x9e6a('0xb')]('/describe',auth[_0x9e6a('0xc')](),controller['describe']);router[_0x9e6a('0xb')]('/index',auth[_0x9e6a('0xc')](),controller[_0x9e6a('0xe')]);router['get'](_0x9e6a('0xf'),auth[_0x9e6a('0xc')](),controller[_0x9e6a('0x10')]);router[_0x9e6a('0x11')]('/',auth[_0x9e6a('0xc')](),controller[_0x9e6a('0x12')]);router['put'](_0x9e6a('0xf'),auth['isAuthenticated'](),controller[_0x9e6a('0x13')]);router[_0x9e6a('0x14')](_0x9e6a('0xf'),auth[_0x9e6a('0xc')](),controller[_0x9e6a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf117=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf117,0x122));var _0x7f11=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf117[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x7f11('0x0'));var path=require(_0x7f11('0x1'));var timeout=require(_0x7f11('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f11('0x3'));var auth=require(_0x7f11('0x4'));var interaction=require(_0x7f11('0x5'));var config=require(_0x7f11('0x6'));var controller=require(_0x7f11('0x7'));router[_0x7f11('0x8')]('/',auth[_0x7f11('0x9')](),controller[_0x7f11('0xa')]);router[_0x7f11('0x8')](_0x7f11('0xb'),auth[_0x7f11('0x9')](),controller[_0x7f11('0xc')]);router['get']('/index',auth[_0x7f11('0x9')](),controller[_0x7f11('0xd')]);router[_0x7f11('0x8')](_0x7f11('0xe'),auth[_0x7f11('0x9')](),controller[_0x7f11('0xf')]);router[_0x7f11('0x10')]('/',auth[_0x7f11('0x9')](),controller['create']);router[_0x7f11('0x11')](_0x7f11('0xe'),auth[_0x7f11('0x9')](),controller[_0x7f11('0x12')]);router[_0x7f11('0x13')](_0x7f11('0xe'),auth[_0x7f11('0x9')](),controller[_0x7f11('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 a61eaa7..79b670c 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 _0x3024=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x8c8678,_0x5199a4){var _0xc5ae90=function(_0x531f61){while(--_0x531f61){_0x8c8678['push'](_0x8c8678['shift']());}};_0xc5ae90(++_0x5199a4);}(_0x3024,0xb3));var _0x4302=function(_0x203014,_0x34ef5d){_0x203014=_0x203014-0x0;var _0x6f9e30=_0x3024[_0x203014];return _0x6f9e30;};'use strict';var Sequelize=require(_0x4302('0x0'));var moment=require(_0x4302('0x1'));module[_0x4302('0x2')]={'type':{'type':Sequelize[_0x4302('0x3')]},'uniqueid':{'type':Sequelize[_0x4302('0x3')]},'calleridnum':{'type':Sequelize[_0x4302('0x3')]},'calleridname':{'type':Sequelize[_0x4302('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4302('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4302('0x4')],'set':function(_0x45754f){var _0x5dd6e1=moment(_0x45754f);var _0x1b850e=moment(this[_0x4302('0x5')](_0x4302('0x6')))[_0x4302('0x7')](_0x4302('0x8'));var _0x16eeaf=_0x5dd6e1[_0x4302('0x9')](_0x1b850e,_0x4302('0xa'));this[_0x4302('0xb')](_0x4302('0xc'),_0x45754f);this['setDataValue'](_0x4302('0xd'),_0x16eeaf||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x4302('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4302('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4302('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4302('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4302('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4302('0x3')],'comment':_0x4302('0x10')},'originalposition':{'type':Sequelize[_0x4302('0xe')]},'channel':{'type':Sequelize[_0x4302('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4302('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4302('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4302('0xe')]},'mohtime':{'type':Sequelize[_0x4302('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4302('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4302('0x3')]},'transfer':{'type':Sequelize[_0x4302('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x4302('0x11')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4302('0x3')]},'disposition':{'type':Sequelize[_0x4302('0x3')]},'secondDisposition':{'type':Sequelize[_0x4302('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4302('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4302('0xe')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb86e=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x3e7b8b,_0x5e61e3){var _0x5d9024=function(_0x2372a1){while(--_0x2372a1){_0x3e7b8b['push'](_0x3e7b8b['shift']());}};_0x5d9024(++_0x5e61e3);}(_0xb86e,0x1c1));var _0xeb86=function(_0x316fae,_0x31caf1){_0x316fae=_0x316fae-0x0;var _0x13b2f3=_0xb86e[_0x316fae];return _0x13b2f3;};'use strict';var Sequelize=require(_0xeb86('0x0'));var moment=require(_0xeb86('0x1'));module[_0xeb86('0x2')]={'type':{'type':Sequelize[_0xeb86('0x3')]},'uniqueid':{'type':Sequelize[_0xeb86('0x3')]},'calleridnum':{'type':Sequelize[_0xeb86('0x3')]},'calleridname':{'type':Sequelize[_0xeb86('0x3')]},'queue':{'type':Sequelize[_0xeb86('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xeb86('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xeb86('0x4')],'set':function(_0x3d36a4){var _0x810473=moment(_0x3d36a4);var _0x4a9e25=moment(this['getDataValue'](_0xeb86('0x5')))['format'](_0xeb86('0x6'));var _0x31e826=_0x810473[_0xeb86('0x7')](_0x4a9e25,_0xeb86('0x8'));this[_0xeb86('0x9')](_0xeb86('0xa'),_0x3d36a4);this['setDataValue'](_0xeb86('0xb'),_0x31e826||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xeb86('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xeb86('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xeb86('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xeb86('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xeb86('0x3')],'comment':_0xeb86('0xd')},'originalposition':{'type':Sequelize[_0xeb86('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xeb86('0x3')]},'connectedlinename':{'type':Sequelize[_0xeb86('0x3')]},'accountcode':{'type':Sequelize[_0xeb86('0x3')]},'context':{'type':Sequelize[_0xeb86('0x3')]},'exten':{'type':Sequelize[_0xeb86('0x3')]},'priority':{'type':Sequelize[_0xeb86('0x3')]},'holdtime':{'type':Sequelize[_0xeb86('0xe')]},'mohtime':{'type':Sequelize[_0xeb86('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb86('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xeb86('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb86('0x3')],'comment':_0xeb86('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeb86('0x3')]},'disposition':{'type':Sequelize[_0xeb86('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb86('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xeb86('0xe')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 14154ec..de5d8d5 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 _0x4b4a=['rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','nolimit','options','fast-json-patch','bluebird','mustache','util','sox','to-csv','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/license/util','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','VoiceQueueReport','includeAll','include','findAll'];(function(_0x3f4263,_0xb27633){var _0x2881d4=function(_0x3f41d4){while(--_0x3f41d4){_0x3f4263['push'](_0x3f4263['shift']());}};_0x2881d4(++_0xb27633);}(_0x4b4a,0xa9));var _0xa4b4=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0x4b4a[_0x42d0ed];return _0x3f63f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa4b4('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa4b4('0x1'));var Mustache=require(_0xa4b4('0x2'));var util=require(_0xa4b4('0x3'));var path=require('path');var sox=require(_0xa4b4('0x4'));var csv=require(_0xa4b4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4b4('0x6'));var squel=require('squel');var crypto=require(_0xa4b4('0x7'));var jsforce=require(_0xa4b4('0x8'));var deskjs=require(_0xa4b4('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa4b4('0xa'));var Papa=require('papaparse');var Redis=require(_0xa4b4('0xb'));var authService=require(_0xa4b4('0xc'));var qs=require(_0xa4b4('0xd'));var as=require(_0xa4b4('0xe'));var hardwareService=require(_0xa4b4('0xf'));var logger=require(_0xa4b4('0x10'))(_0xa4b4('0x11'));var utils=require(_0xa4b4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa4b4('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa4b4('0x14')](config[_0xa4b4('0x15')],{'host':_0xa4b4('0x16'),'port':0x18eb});var socket=require(_0xa4b4('0x17'))(new Redis(config[_0xa4b4('0x15')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x220c14,_0x48a802){_0x48a802=_0x48a802||0xcc;return function(_0x103916){if(_0x103916){return _0x220c14[_0xa4b4('0x18')](_0x48a802);}return _0x220c14[_0xa4b4('0x19')](_0x48a802)[_0xa4b4('0x1a')]();};}function respondWithResult(_0x440f1d,_0x465d43){_0x465d43=_0x465d43||0xc8;return function(_0x11784f){if(_0x11784f){return _0x440f1d['status'](_0x465d43)[_0xa4b4('0x1b')](_0x11784f);}};}function respondWithFilteredResult(_0x3d479f,_0x17d77b){return function(_0x189be6){if(_0x189be6){var _0x4c6af2=typeof _0x17d77b[_0xa4b4('0x1c')]===_0xa4b4('0x1d')&&typeof _0x17d77b[_0xa4b4('0x1e')]==='undefined';var _0x4e6f1f=_0x189be6[_0xa4b4('0x1f')];var _0x3c8418=_0x4c6af2?0x0:_0x17d77b[_0xa4b4('0x1c')];var _0x5ddbe1=_0x4c6af2?_0x189be6[_0xa4b4('0x1f')]:_0x17d77b['offset']+_0x17d77b[_0xa4b4('0x1e')];var _0x3f1255;if(_0x5ddbe1>=_0x4e6f1f){_0x5ddbe1=_0x4e6f1f;_0x3f1255=0xc8;}else{_0x3f1255=0xce;}_0x3d479f[_0xa4b4('0x19')](_0x3f1255);return _0x3d479f[_0xa4b4('0x20')](_0xa4b4('0x21'),_0x3c8418+'-'+_0x5ddbe1+'/'+_0x4e6f1f)[_0xa4b4('0x1b')](_0x189be6);}return null;};}function patchUpdates(_0x2380fd){return function(_0x3c721b){try{jsonpatch[_0xa4b4('0x22')](_0x3c721b,_0x2380fd,!![]);}catch(_0x189d9a){return BPromise['reject'](_0x189d9a);}return _0x3c721b[_0xa4b4('0x23')]();};}function saveUpdates(_0x195223,_0x238da1){return function(_0x103605){if(_0x103605){return _0x103605[_0xa4b4('0x24')](_0x195223)[_0xa4b4('0x25')](function(_0x104365){return _0x104365;});}return null;};}function removeEntity(_0x1186ec,_0x24896d){return function(_0x1d4082){if(_0x1d4082){return _0x1d4082[_0xa4b4('0x26')]()[_0xa4b4('0x25')](function(){_0x1186ec[_0xa4b4('0x19')](0xcc)[_0xa4b4('0x1a')]();});}};}function handleEntityNotFound(_0x5f4376,_0x556610){return function(_0x4bc1d4){if(!_0x4bc1d4){_0x5f4376[_0xa4b4('0x18')](0x194);}return _0x4bc1d4;};}function handleError(_0x531c97,_0x2d6288){_0x2d6288=_0x2d6288||0x1f4;return function(_0x4bf0f8){logger['error'](_0x4bf0f8[_0xa4b4('0x27')]);if(_0x4bf0f8[_0xa4b4('0x28')]){delete _0x4bf0f8[_0xa4b4('0x28')];}_0x531c97[_0xa4b4('0x19')](_0x2d6288)[_0xa4b4('0x29')](_0x4bf0f8);};}exports[_0xa4b4('0x2a')]=function(_0x233561,_0x3dfdea){var _0xbd1699={},_0x482787={},_0x508485={'count':0x0,'rows':[]};var _0x4174b9=_[_0xa4b4('0x2b')](db['VoiceQueueReport'][_0xa4b4('0x2c')],function(_0x3599d0){return{'name':_0x3599d0[_0xa4b4('0x2d')],'type':_0x3599d0[_0xa4b4('0x2e')][_0xa4b4('0x2f')]};});_0x482787['model']=_['map'](_0x4174b9,_0xa4b4('0x28'));_0x482787['query']=_[_0xa4b4('0x30')](_0x233561[_0xa4b4('0x31')]);_0x482787[_0xa4b4('0x32')]=_[_0xa4b4('0x33')](_0x482787[_0xa4b4('0x34')],_0x482787[_0xa4b4('0x31')]);_0xbd1699[_0xa4b4('0x35')]=_[_0xa4b4('0x33')](_0x482787['model'],qs[_0xa4b4('0x36')](_0x233561['query'][_0xa4b4('0x36')]));_0xbd1699[_0xa4b4('0x35')]=_0xbd1699[_0xa4b4('0x35')][_0xa4b4('0x37')]?_0xbd1699[_0xa4b4('0x35')]:_0x482787[_0xa4b4('0x34')];if(!_0x233561['query'][_0xa4b4('0x38')]('nolimit')){_0xbd1699[_0xa4b4('0x1e')]=qs[_0xa4b4('0x1e')](_0x233561['query']['limit']);_0xbd1699[_0xa4b4('0x1c')]=qs['offset'](_0x233561['query'][_0xa4b4('0x1c')]);}_0xbd1699[_0xa4b4('0x39')]=qs[_0xa4b4('0x3a')](_0x233561[_0xa4b4('0x31')][_0xa4b4('0x3a')]);_0xbd1699[_0xa4b4('0x3b')]=qs[_0xa4b4('0x32')](_[_0xa4b4('0x3c')](_0x233561[_0xa4b4('0x31')],_0x482787['filters']),_0x4174b9);if(_0x233561['query'][_0xa4b4('0x3d')]){_0xbd1699['where']=_[_0xa4b4('0x3e')](_0xbd1699[_0xa4b4('0x3b')],{'$or':_[_0xa4b4('0x2b')](_0x4174b9,function(_0x2cea32){if(_0x2cea32['type']!==_0xa4b4('0x3f')){var _0x394aee={};_0x394aee[_0x2cea32['name']]={'$like':'%'+_0x233561[_0xa4b4('0x31')][_0xa4b4('0x3d')]+'%'};return _0x394aee;}})});}_0xbd1699=_[_0xa4b4('0x3e')]({},_0xbd1699,_0x233561['options']);var _0x415b40={'where':_0xbd1699[_0xa4b4('0x3b')]};return db[_0xa4b4('0x40')][_0xa4b4('0x1f')](_0x415b40)['then'](function(_0x572903){_0x508485[_0xa4b4('0x1f')]=_0x572903;if(_0x233561[_0xa4b4('0x31')][_0xa4b4('0x41')]){_0xbd1699[_0xa4b4('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa4b4('0x43')](_0xbd1699);})[_0xa4b4('0x25')](function(_0x141adc){_0x508485[_0xa4b4('0x44')]=_0x141adc;return _0x508485;})[_0xa4b4('0x25')](respondWithFilteredResult(_0x3dfdea,_0xbd1699))[_0xa4b4('0x45')](handleError(_0x3dfdea,null));};exports[_0xa4b4('0x46')]=function(_0x1fa793,_0x7078e5){var _0x60fb21={'raw':![],'where':{'id':_0x1fa793[_0xa4b4('0x47')]['id']}},_0x10fba2={};_0x10fba2[_0xa4b4('0x34')]=_['keys'](db[_0xa4b4('0x40')][_0xa4b4('0x2c')]);_0x10fba2[_0xa4b4('0x31')]=_[_0xa4b4('0x30')](_0x1fa793['query']);_0x10fba2[_0xa4b4('0x32')]=_[_0xa4b4('0x33')](_0x10fba2[_0xa4b4('0x34')],_0x10fba2[_0xa4b4('0x31')]);_0x60fb21[_0xa4b4('0x35')]=_[_0xa4b4('0x33')](_0x10fba2[_0xa4b4('0x34')],qs['fields'](_0x1fa793[_0xa4b4('0x31')][_0xa4b4('0x36')]));_0x60fb21['attributes']=_0x60fb21[_0xa4b4('0x35')]['length']?_0x60fb21[_0xa4b4('0x35')]:_0x10fba2[_0xa4b4('0x34')];if(_0x1fa793['query']['includeAll']){_0x60fb21['include']=[{'all':!![]}];}_0x60fb21=_[_0xa4b4('0x3e')]({},_0x60fb21,_0x1fa793['options']);return db[_0xa4b4('0x40')][_0xa4b4('0x48')](_0x60fb21)['then'](handleEntityNotFound(_0x7078e5,null))['then'](respondWithResult(_0x7078e5,null))[_0xa4b4('0x45')](handleError(_0x7078e5,null));};exports[_0xa4b4('0x49')]=function(_0x549b01,_0x453a07){return db['VoiceQueueReport'][_0xa4b4('0x49')](_0x549b01[_0xa4b4('0x4a')],{})['then'](respondWithResult(_0x453a07,0xc9))[_0xa4b4('0x45')](handleError(_0x453a07,null));};exports['update']=function(_0x32db51,_0x4ebe3d){if(_0x32db51[_0xa4b4('0x4a')]['id']){delete _0x32db51[_0xa4b4('0x4a')]['id'];}return db[_0xa4b4('0x40')][_0xa4b4('0x48')]({'where':{'id':_0x32db51[_0xa4b4('0x47')]['id']}})[_0xa4b4('0x25')](handleEntityNotFound(_0x4ebe3d,null))[_0xa4b4('0x25')](saveUpdates(_0x32db51['body'],null))[_0xa4b4('0x25')](respondWithResult(_0x4ebe3d,null))[_0xa4b4('0x45')](handleError(_0x4ebe3d,null));};exports['destroy']=function(_0x62920,_0x232b2b){return db[_0xa4b4('0x40')][_0xa4b4('0x48')]({'where':{'id':_0x62920[_0xa4b4('0x47')]['id']}})[_0xa4b4('0x25')](handleEntityNotFound(_0x232b2b,null))[_0xa4b4('0x25')](removeEntity(_0x232b2b,null))[_0xa4b4('0x45')](handleError(_0x232b2b,null));};exports[_0xa4b4('0x4b')]=function(_0xc7037,_0x4496a0){return db[_0xa4b4('0x40')][_0xa4b4('0x4b')]()[_0xa4b4('0x25')](respondWithResult(_0x4496a0,null))[_0xa4b4('0x45')](handleError(_0x4496a0,null));};exports[_0xa4b4('0x4c')]=function(_0x110b30,_0x4b2ec5){var _0x5d0e95={},_0x34232b={},_0x17c58c={'count':0x0,'rows':[]};_0x34232b['model']=_[_0xa4b4('0x30')](db[_0xa4b4('0x40')][_0xa4b4('0x2c')]);_0x34232b[_0xa4b4('0x31')]=_[_0xa4b4('0x30')](_0x110b30[_0xa4b4('0x31')]);_0x34232b[_0xa4b4('0x32')]=_[_0xa4b4('0x33')](_0x34232b[_0xa4b4('0x34')],_0x34232b[_0xa4b4('0x31')]);_0x5d0e95[_0xa4b4('0x35')]=_[_0xa4b4('0x33')](_0x34232b[_0xa4b4('0x34')],qs[_0xa4b4('0x36')](_0x110b30['query']['fields']));_0x5d0e95[_0xa4b4('0x35')]=_0x5d0e95['attributes'][_0xa4b4('0x37')]?_0x5d0e95[_0xa4b4('0x35')]:_0x34232b['model'];if(!_0x110b30['query'][_0xa4b4('0x38')](_0xa4b4('0x4d'))){_0x5d0e95[_0xa4b4('0x1e')]=qs[_0xa4b4('0x1e')](_0x110b30[_0xa4b4('0x31')][_0xa4b4('0x1e')]);_0x5d0e95[_0xa4b4('0x1c')]=qs['offset'](_0x110b30['query'][_0xa4b4('0x1c')]);}_0x5d0e95[_0xa4b4('0x39')]=qs['sort'](_0x110b30[_0xa4b4('0x31')][_0xa4b4('0x3a')]);_0x5d0e95[_0xa4b4('0x3b')]=qs[_0xa4b4('0x32')](_[_0xa4b4('0x3c')](_0x110b30['query'],_0x34232b[_0xa4b4('0x32')]));if(_0x110b30['query'][_0xa4b4('0x3d')]){_0x5d0e95[_0xa4b4('0x3b')]=_[_0xa4b4('0x3e')](_0x5d0e95[_0xa4b4('0x3b')],{'$or':_[_0xa4b4('0x2b')](_0x5d0e95['attributes'],function(_0x464dff){var _0x2c510b={};_0x2c510b[_0x464dff]={'$like':'%'+_0x110b30[_0xa4b4('0x31')]['filter']+'%'};return _0x2c510b;})});}_0x5d0e95=_[_0xa4b4('0x3e')]({},_0x5d0e95,_0x110b30[_0xa4b4('0x4e')]);var _0xa01d5c={'where':_0x5d0e95['where']};return db[_0xa4b4('0x40')]['count'](_0xa01d5c)[_0xa4b4('0x25')](function(_0x1ffda3){_0x17c58c[_0xa4b4('0x1f')]=_0x1ffda3;if(_0x110b30[_0xa4b4('0x31')][_0xa4b4('0x41')]){_0x5d0e95[_0xa4b4('0x42')]=[{'all':!![]}];}return db[_0xa4b4('0x40')]['findAll'](_0x5d0e95);})[_0xa4b4('0x25')](function(_0x586787){_0x17c58c[_0xa4b4('0x44')]=_0x586787;return _0x17c58c;})[_0xa4b4('0x25')](respondWithFilteredResult(_0x4b2ec5,_0x5d0e95,'getVoiceQueuesReport'))[_0xa4b4('0x45')](handleError(_0x4b2ec5,null,_0xa4b4('0x4c')));}; \ No newline at end of file +var _0x791c=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','update','then','end','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','model','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','include','rows','show','params','rawAttributes','keys','attributes','includeAll','options','find','create','body','catch','destroy','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3df977,_0x39dcc2){var _0x54868b=function(_0x3f0163){while(--_0x3f0163){_0x3df977['push'](_0x3df977['shift']());}};_0x54868b(++_0x39dcc2);}(_0x791c,0x1a5));var _0xc791=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x791c[_0x59b439];return _0x521ea3;};'use strict';var emlformat=require(_0xc791('0x0'));var rimraf=require(_0xc791('0x1'));var zipdir=require(_0xc791('0x2'));var jsonpatch=require(_0xc791('0x3'));var rp=require(_0xc791('0x4'));var moment=require(_0xc791('0x5'));var BPromise=require(_0xc791('0x6'));var Mustache=require(_0xc791('0x7'));var util=require(_0xc791('0x8'));var path=require(_0xc791('0x9'));var sox=require(_0xc791('0xa'));var csv=require('to-csv');var ejs=require(_0xc791('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc791('0xc'));var squel=require(_0xc791('0xd'));var crypto=require(_0xc791('0xe'));var jsforce=require(_0xc791('0xf'));var deskjs=require(_0xc791('0x10'));var toCsv=require(_0xc791('0x11'));var querystring=require('querystring');var Papa=require(_0xc791('0x12'));var Redis=require('ioredis');var authService=require(_0xc791('0x13'));var qs=require(_0xc791('0x14'));var as=require(_0xc791('0x15'));var hardwareService=require(_0xc791('0x16'));var logger=require(_0xc791('0x17'))('api');var utils=require(_0xc791('0x18'));var config=require(_0xc791('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc791('0x1a')]=_[_0xc791('0x1b')](config[_0xc791('0x1a')],{'host':_0xc791('0x1c'),'port':0x18eb});var socket=require(_0xc791('0x1d'))(new Redis(config[_0xc791('0x1a')]));require(_0xc791('0x1e'))[_0xc791('0x1f')](socket);function respondWithStatusCode(_0x2001a8,_0x57f402){_0x57f402=_0x57f402||0xcc;return function(_0x5c0c37){if(_0x5c0c37){return _0x2001a8[_0xc791('0x20')](_0x57f402);}return _0x2001a8[_0xc791('0x21')](_0x57f402)['end']();};}function respondWithResult(_0x5a170d,_0x5a66d0){_0x5a66d0=_0x5a66d0||0xc8;return function(_0x6aa254){if(_0x6aa254){return _0x5a170d[_0xc791('0x21')](_0x5a66d0)['json'](_0x6aa254);}};}function respondWithFilteredResult(_0x35b20b,_0x176c65){return function(_0x29b452){if(_0x29b452){var _0x507925=typeof _0x176c65[_0xc791('0x22')]==='undefined'&&typeof _0x176c65['limit']===_0xc791('0x23');var _0x1715f2=_0x29b452[_0xc791('0x24')];var _0x401b0c=_0x507925?0x0:_0x176c65[_0xc791('0x22')];var _0x459a01=_0x507925?_0x29b452[_0xc791('0x24')]:_0x176c65['offset']+_0x176c65[_0xc791('0x25')];var _0x3199c2;if(_0x459a01>=_0x1715f2){_0x459a01=_0x1715f2;_0x3199c2=0xc8;}else{_0x3199c2=0xce;}_0x35b20b[_0xc791('0x21')](_0x3199c2);return _0x35b20b[_0xc791('0x26')](_0xc791('0x27'),_0x401b0c+'-'+_0x459a01+'/'+_0x1715f2)['json'](_0x29b452);}return null;};}function patchUpdates(_0x439592){return function(_0x2de7e4){try{jsonpatch[_0xc791('0x28')](_0x2de7e4,_0x439592,!![]);}catch(_0xeceb91){return BPromise['reject'](_0xeceb91);}return _0x2de7e4['save']();};}function saveUpdates(_0x28514c,_0x2aa8b8){return function(_0x177157){if(_0x177157){return _0x177157[_0xc791('0x29')](_0x28514c)['then'](function(_0x1e6344){return _0x1e6344;});}return null;};}function removeEntity(_0x47fb69,_0x2e5f07){return function(_0x44268c){if(_0x44268c){return _0x44268c['destroy']()[_0xc791('0x2a')](function(){_0x47fb69[_0xc791('0x21')](0xcc)[_0xc791('0x2b')]();});}};}function handleEntityNotFound(_0x1ab971,_0x400d82){return function(_0x3300b9){if(!_0x3300b9){_0x1ab971[_0xc791('0x20')](0x194);}return _0x3300b9;};}function handleError(_0x323979,_0x14cbf8){_0x14cbf8=_0x14cbf8||0x1f4;return function(_0x47f07e){logger['error'](_0x47f07e[_0xc791('0x2c')]);if(_0x47f07e[_0xc791('0x2d')]){delete _0x47f07e['name'];}_0x323979['status'](_0x14cbf8)[_0xc791('0x2e')](_0x47f07e);};}exports[_0xc791('0x2f')]=function(_0x3d9caf,_0x47eebd){var _0x3aeb7f={},_0x1edde3={},_0x249a21={'count':0x0,'rows':[]};var _0x1f5fd6=_[_0xc791('0x30')](db[_0xc791('0x31')]['rawAttributes'],function(_0xfc1348){return{'name':_0xfc1348[_0xc791('0x32')],'type':_0xfc1348[_0xc791('0x33')][_0xc791('0x34')]};});_0x1edde3[_0xc791('0x35')]=_[_0xc791('0x30')](_0x1f5fd6,_0xc791('0x2d'));_0x1edde3[_0xc791('0x36')]=_['keys'](_0x3d9caf[_0xc791('0x36')]);_0x1edde3['filters']=_[_0xc791('0x37')](_0x1edde3[_0xc791('0x35')],_0x1edde3[_0xc791('0x36')]);_0x3aeb7f['attributes']=_['intersection'](_0x1edde3[_0xc791('0x35')],qs[_0xc791('0x38')](_0x3d9caf[_0xc791('0x36')][_0xc791('0x38')]));_0x3aeb7f['attributes']=_0x3aeb7f['attributes'][_0xc791('0x39')]?_0x3aeb7f['attributes']:_0x1edde3[_0xc791('0x35')];if(!_0x3d9caf[_0xc791('0x36')][_0xc791('0x3a')](_0xc791('0x3b'))){_0x3aeb7f[_0xc791('0x25')]=qs[_0xc791('0x25')](_0x3d9caf[_0xc791('0x36')][_0xc791('0x25')]);_0x3aeb7f['offset']=qs[_0xc791('0x22')](_0x3d9caf[_0xc791('0x36')][_0xc791('0x22')]);}_0x3aeb7f[_0xc791('0x3c')]=qs['sort'](_0x3d9caf[_0xc791('0x36')][_0xc791('0x3d')]);_0x3aeb7f[_0xc791('0x3e')]=qs[_0xc791('0x3f')](_[_0xc791('0x40')](_0x3d9caf[_0xc791('0x36')],_0x1edde3['filters']),_0x1f5fd6);if(_0x3d9caf['query']['filter']){_0x3aeb7f[_0xc791('0x3e')]=_['merge'](_0x3aeb7f[_0xc791('0x3e')],{'$or':_[_0xc791('0x30')](_0x1f5fd6,function(_0x33391d){if(_0x33391d[_0xc791('0x33')]!==_0xc791('0x41')){var _0x385e62={};_0x385e62[_0x33391d[_0xc791('0x2d')]]={'$like':'%'+_0x3d9caf[_0xc791('0x36')][_0xc791('0x42')]+'%'};return _0x385e62;}})});}_0x3aeb7f=_[_0xc791('0x43')]({},_0x3aeb7f,_0x3d9caf['options']);var _0x4a3b8e={'where':_0x3aeb7f[_0xc791('0x3e')]};return db[_0xc791('0x31')]['count'](_0x4a3b8e)['then'](function(_0xca023c){_0x249a21[_0xc791('0x24')]=_0xca023c;if(_0x3d9caf['query']['includeAll']){_0x3aeb7f[_0xc791('0x44')]=[{'all':!![]}];}return db[_0xc791('0x31')]['findAll'](_0x3aeb7f);})[_0xc791('0x2a')](function(_0x5add30){_0x249a21[_0xc791('0x45')]=_0x5add30;return _0x249a21;})[_0xc791('0x2a')](respondWithFilteredResult(_0x47eebd,_0x3aeb7f))['catch'](handleError(_0x47eebd,null));};exports[_0xc791('0x46')]=function(_0x405eae,_0x48cd98){var _0x234bfd={'raw':![],'where':{'id':_0x405eae[_0xc791('0x47')]['id']}},_0x57301c={};_0x57301c[_0xc791('0x35')]=_['keys'](db[_0xc791('0x31')][_0xc791('0x48')]);_0x57301c[_0xc791('0x36')]=_[_0xc791('0x49')](_0x405eae['query']);_0x57301c['filters']=_[_0xc791('0x37')](_0x57301c[_0xc791('0x35')],_0x57301c[_0xc791('0x36')]);_0x234bfd[_0xc791('0x4a')]=_[_0xc791('0x37')](_0x57301c['model'],qs[_0xc791('0x38')](_0x405eae['query']['fields']));_0x234bfd[_0xc791('0x4a')]=_0x234bfd[_0xc791('0x4a')]['length']?_0x234bfd['attributes']:_0x57301c[_0xc791('0x35')];if(_0x405eae[_0xc791('0x36')][_0xc791('0x4b')]){_0x234bfd[_0xc791('0x44')]=[{'all':!![]}];}_0x234bfd=_[_0xc791('0x43')]({},_0x234bfd,_0x405eae[_0xc791('0x4c')]);return db[_0xc791('0x31')][_0xc791('0x4d')](_0x234bfd)[_0xc791('0x2a')](handleEntityNotFound(_0x48cd98,null))['then'](respondWithResult(_0x48cd98,null))['catch'](handleError(_0x48cd98,null));};exports[_0xc791('0x4e')]=function(_0xe150dd,_0x5b4c4f){return db[_0xc791('0x31')][_0xc791('0x4e')](_0xe150dd[_0xc791('0x4f')],{})[_0xc791('0x2a')](respondWithResult(_0x5b4c4f,0xc9))[_0xc791('0x50')](handleError(_0x5b4c4f,null));};exports[_0xc791('0x29')]=function(_0x596f96,_0x4734cc){if(_0x596f96[_0xc791('0x4f')]['id']){delete _0x596f96['body']['id'];}return db[_0xc791('0x31')][_0xc791('0x4d')]({'where':{'id':_0x596f96[_0xc791('0x47')]['id']}})['then'](handleEntityNotFound(_0x4734cc,null))[_0xc791('0x2a')](saveUpdates(_0x596f96[_0xc791('0x4f')],null))[_0xc791('0x2a')](respondWithResult(_0x4734cc,null))[_0xc791('0x50')](handleError(_0x4734cc,null));};exports[_0xc791('0x51')]=function(_0x4ef205,_0x595c1e){return db['VoiceQueueReport'][_0xc791('0x4d')]({'where':{'id':_0x4ef205[_0xc791('0x47')]['id']}})[_0xc791('0x2a')](handleEntityNotFound(_0x595c1e,null))[_0xc791('0x2a')](removeEntity(_0x595c1e,null))[_0xc791('0x50')](handleError(_0x595c1e,null));};exports[_0xc791('0x52')]=function(_0x5477ae,_0x46a032){return db[_0xc791('0x31')][_0xc791('0x52')]()[_0xc791('0x2a')](respondWithResult(_0x46a032,null))[_0xc791('0x50')](handleError(_0x46a032,null));};exports[_0xc791('0x53')]=function(_0x4c8142,_0x8724b2){var _0x3e72d7={},_0x21239e={},_0x342478={'count':0x0,'rows':[]};_0x21239e[_0xc791('0x35')]=_[_0xc791('0x49')](db[_0xc791('0x31')]['rawAttributes']);_0x21239e['query']=_[_0xc791('0x49')](_0x4c8142['query']);_0x21239e['filters']=_[_0xc791('0x37')](_0x21239e[_0xc791('0x35')],_0x21239e[_0xc791('0x36')]);_0x3e72d7['attributes']=_[_0xc791('0x37')](_0x21239e['model'],qs[_0xc791('0x38')](_0x4c8142[_0xc791('0x36')][_0xc791('0x38')]));_0x3e72d7['attributes']=_0x3e72d7[_0xc791('0x4a')][_0xc791('0x39')]?_0x3e72d7['attributes']:_0x21239e['model'];if(!_0x4c8142[_0xc791('0x36')][_0xc791('0x3a')](_0xc791('0x3b'))){_0x3e72d7['limit']=qs[_0xc791('0x25')](_0x4c8142[_0xc791('0x36')][_0xc791('0x25')]);_0x3e72d7['offset']=qs[_0xc791('0x22')](_0x4c8142['query'][_0xc791('0x22')]);}_0x3e72d7[_0xc791('0x3c')]=qs['sort'](_0x4c8142[_0xc791('0x36')][_0xc791('0x3d')]);_0x3e72d7[_0xc791('0x3e')]=qs[_0xc791('0x3f')](_['pick'](_0x4c8142[_0xc791('0x36')],_0x21239e[_0xc791('0x3f')]));if(_0x4c8142[_0xc791('0x36')]['filter']){_0x3e72d7[_0xc791('0x3e')]=_['merge'](_0x3e72d7['where'],{'$or':_['map'](_0x3e72d7[_0xc791('0x4a')],function(_0x2f113b){var _0xf08c62={};_0xf08c62[_0x2f113b]={'$like':'%'+_0x4c8142[_0xc791('0x36')]['filter']+'%'};return _0xf08c62;})});}_0x3e72d7=_[_0xc791('0x43')]({},_0x3e72d7,_0x4c8142[_0xc791('0x4c')]);var _0x1f1c08={'where':_0x3e72d7['where']};return db[_0xc791('0x31')]['count'](_0x1f1c08)[_0xc791('0x2a')](function(_0x12a45d){_0x342478[_0xc791('0x24')]=_0x12a45d;if(_0x4c8142[_0xc791('0x36')][_0xc791('0x4b')]){_0x3e72d7[_0xc791('0x44')]=[{'all':!![]}];}return db[_0xc791('0x31')][_0xc791('0x54')](_0x3e72d7);})['then'](function(_0x7dc2b){_0x342478[_0xc791('0x45')]=_0x7dc2b;return _0x342478;})[_0xc791('0x2a')](respondWithFilteredResult(_0x8724b2,_0x3e72d7,'getVoiceQueuesReport'))[_0xc791('0x50')](handleError(_0x8724b2,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 41da65c..616407f 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 _0xbf35=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x59f585,_0x369153){var _0xfd320b=function(_0x427703){while(--_0x427703){_0x59f585['push'](_0x59f585['shift']());}};_0xfd320b(++_0x369153);}(_0xbf35,0x1ad));var _0x5bf3=function(_0xfa629a,_0x104c68){_0xfa629a=_0xfa629a-0x0;var _0x53ee08=_0xbf35[_0xfa629a];return _0x53ee08;};'use strict';var EventEmitter=require(_0x5bf3('0x0'));var VoiceQueueReport=require(_0x5bf3('0x1'))['db'][_0x5bf3('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5bf3('0x3')](0x0);var events={'afterCreate':_0x5bf3('0x4'),'afterUpdate':_0x5bf3('0x5'),'afterDestroy':_0x5bf3('0x6')};function emitEvent(_0x2b2d51){return function(_0xdd0839,_0x337822,_0xdfcae7){VoiceQueueReportEvents[_0x5bf3('0x7')](_0x2b2d51+':'+_0xdd0839['id'],_0xdd0839);VoiceQueueReportEvents[_0x5bf3('0x7')](_0x2b2d51,_0xdd0839);_0xdfcae7(null);};}for(var e in events){if(events[_0x5bf3('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x5bf3('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc305=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xc305,0x7b));var _0x5c30=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xc305[_0x4063a4];return _0x17908d;};'use strict';var EventEmitter=require(_0x5c30('0x0'));var VoiceQueueReport=require(_0x5c30('0x1'))['db'][_0x5c30('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5c30('0x3')](0x0);var events={'afterCreate':_0x5c30('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d4bfc){return function(_0x417c68,_0x2c79b3,_0x35ea6e){VoiceQueueReportEvents[_0x5c30('0x5')](_0x3d4bfc+':'+_0x417c68['id'],_0x417c68);VoiceQueueReportEvents[_0x5c30('0x5')](_0x3d4bfc,_0x417c68);_0x35ea6e(null);};}for(var e in events){if(events[_0x5c30('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x5c30('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d67066d..a9ff653 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 _0x613d=['report_queue','calleridnum','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','VoiceQueueReport'];(function(_0x5733ee,_0x455514){var _0x38b96e=function(_0x591407){while(--_0x591407){_0x5733ee['push'](_0x5733ee['shift']());}};_0x38b96e(++_0x455514);}(_0x613d,0x1c5));var _0xd613=function(_0x3d46cf,_0x1d39e9){_0x3d46cf=_0x3d46cf-0x0;var _0x1e048e=_0x613d[_0x3d46cf];return _0x1e048e;};'use strict';var _=require(_0xd613('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd613('0x1'));var moment=require(_0xd613('0x2'));var BPromise=require(_0xd613('0x3'));var rp=require(_0xd613('0x4'));var fs=require('fs');var path=require(_0xd613('0x5'));var rimraf=require(_0xd613('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xd613('0x7')]=function(_0x2ad800,_0x5af017){return _0x2ad800['define'](_0xd613('0x8'),attributes,{'tableName':_0xd613('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xd613('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac3f=['calleridnum','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x4f35d2,_0x2e06eb){var _0x327257=function(_0x312044){while(--_0x312044){_0x4f35d2['push'](_0x4f35d2['shift']());}};_0x327257(++_0x2e06eb);}(_0xac3f,0x153));var _0xfac3=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0xac3f[_0x7f3667];return _0x2c4c24;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfac3('0x0'))(_0xfac3('0x1'));var moment=require(_0xfac3('0x2'));var BPromise=require('bluebird');var rp=require(_0xfac3('0x3'));var fs=require('fs');var path=require(_0xfac3('0x4'));var rimraf=require(_0xfac3('0x5'));var config=require(_0xfac3('0x6'));var attributes=require(_0xfac3('0x7'));module[_0xfac3('0x8')]=function(_0x301fda,_0x295faf){return _0x301fda[_0xfac3('0x9')](_0xfac3('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xfac3('0xb')]},{'fields':[_0xfac3('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 b391ec4..0d0a3af 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 _0x3084=['error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','model','include','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2d55b4,_0x10bcd9){var _0x3b42d8=function(_0x1bbc1f){while(--_0x1bbc1f){_0x2d55b4['push'](_0x2d55b4['shift']());}};_0x3b42d8(++_0x10bcd9);}(_0x3084,0x6d));var _0x4308=function(_0x25fc0e,_0x1884aa){_0x25fc0e=_0x25fc0e-0x0;var _0x4ab150=_0x3084[_0x25fc0e];return _0x4ab150;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4308('0x0'));var BPromise=require(_0x4308('0x1'));var rs=require(_0x4308('0x2'));var fs=require('fs');var Redis=require(_0x4308('0x3'));var db=require(_0x4308('0x4'))['db'];var utils=require(_0x4308('0x5'));var logger=require(_0x4308('0x6'))(_0x4308('0x7'));var config=require('../../config/environment');var jayson=require(_0x4308('0x8'));var client=jayson['client'][_0x4308('0x9')]({'port':0x232a});config[_0x4308('0xa')]=_[_0x4308('0xb')](config[_0x4308('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4308('0xc'))(new Redis(config[_0x4308('0xa')]));require(_0x4308('0xd'))[_0x4308('0xe')](socket);function respondWithRpcPromise(_0x5acbd6,_0x475068,_0x364c28){return new BPromise(function(_0x51bdcf,_0x55e055){return client[_0x4308('0xf')](_0x5acbd6,_0x364c28)[_0x4308('0x10')](function(_0xd954e0){logger['info'](_0x4308('0x11'),_0x475068,_0x4308('0x12'));logger[_0x4308('0x13')](_0x4308('0x14'),_0x475068,_0x4308('0x12'),JSON[_0x4308('0x15')](_0xd954e0));if(_0xd954e0['error']){if(_0xd954e0['error'][_0x4308('0x16')]===0x1f4){logger['error'](_0x4308('0x11'),_0x475068,_0xd954e0[_0x4308('0x17')]['message']);return _0x55e055(_0xd954e0[_0x4308('0x17')][_0x4308('0x18')]);}logger['error'](_0x4308('0x11'),_0x475068,_0xd954e0[_0x4308('0x17')][_0x4308('0x18')]);return _0x51bdcf(_0xd954e0['error'][_0x4308('0x18')]);}else{logger[_0x4308('0x19')](_0x4308('0x11'),_0x475068,_0x4308('0x12'));_0x51bdcf(_0xd954e0[_0x4308('0x1a')][_0x4308('0x18')]);}})[_0x4308('0x1b')](function(_0x2e9918){logger[_0x4308('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x475068,_0x2e9918);_0x55e055(_0x2e9918);});});}exports[_0x4308('0x1c')]=function(_0x55afbc){var _0x9b98f7=this;return new Promise(function(_0x387349,_0x430246){return db[_0x4308('0x1d')][_0x4308('0x1e')]({'raw':_0x55afbc[_0x4308('0x1f')]?_0x55afbc[_0x4308('0x1f')][_0x4308('0x20')]===undefined?!![]:![]:!![],'where':_0x55afbc[_0x4308('0x1f')]?_0x55afbc['options'][_0x4308('0x21')]||null:null,'attributes':_0x55afbc[_0x4308('0x1f')]?_0x55afbc[_0x4308('0x1f')][_0x4308('0x22')]||null:null,'limit':_0x55afbc[_0x4308('0x1f')]?_0x55afbc[_0x4308('0x1f')][_0x4308('0x23')]||null:null,'include':_0x55afbc[_0x4308('0x1f')]?_0x55afbc[_0x4308('0x1f')]['include']?_[_0x4308('0x24')](_0x55afbc[_0x4308('0x1f')]['include'],function(_0x46c71e){return{'model':db[_0x46c71e[_0x4308('0x25')]],'as':_0x46c71e['as'],'attributes':_0x46c71e[_0x4308('0x22')],'include':_0x46c71e['include']?_[_0x4308('0x24')](_0x46c71e[_0x4308('0x26')],function(_0x4d6a8d){return{'model':db[_0x4d6a8d[_0x4308('0x25')]],'as':_0x4d6a8d['as'],'attributes':_0x4d6a8d[_0x4308('0x22')],'include':_0x4d6a8d['include']?_[_0x4308('0x24')](_0x4d6a8d[_0x4308('0x26')],function(_0x1fb936){return{'model':db[_0x1fb936['model']],'as':_0x1fb936['as'],'attributes':_0x1fb936[_0x4308('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4308('0x10')](function(_0x3b81b9){logger[_0x4308('0x19')]('GetVoiceQueueReport',_0x55afbc);logger['debug']('GetVoiceQueueReport',_0x55afbc,JSON['stringify'](_0x3b81b9));_0x387349(_0x3b81b9);})['catch'](function(_0x4f8d23){logger['error'](_0x4308('0x1c'),_0x4f8d23[_0x4308('0x18')],_0x55afbc);_0x430246(_0x9b98f7[_0x4308('0x17')](0x1f4,_0x4f8d23['message']));});});};exports[_0x4308('0x27')]=function(_0x3fa154){var _0x40ac09=this;return new Promise(function(_0x469d1b,_0xd74bc4){return db[_0x4308('0x1d')][_0x4308('0x28')](_0x3fa154['body'],{'raw':_0x3fa154[_0x4308('0x1f')]?_0x3fa154[_0x4308('0x1f')][_0x4308('0x20')]===undefined?!![]:![]:!![]})[_0x4308('0x10')](function(_0x5be6bc){logger[_0x4308('0x19')](_0x4308('0x27'),_0x3fa154);logger[_0x4308('0x13')](_0x4308('0x27'),_0x3fa154,JSON[_0x4308('0x15')](_0x5be6bc));_0x469d1b(_0x5be6bc);})[_0x4308('0x1b')](function(_0x460f57){logger[_0x4308('0x17')](_0x4308('0x27'),_0x460f57['message'],_0x3fa154);_0xd74bc4(_0x40ac09[_0x4308('0x17')](0x1f4,_0x460f57[_0x4308('0x18')]));});});};exports[_0x4308('0x29')]=function(_0x386527){var _0x53e9cc=this;return new Promise(function(_0x4c65da,_0xc4feb8){return db[_0x4308('0x1d')][_0x4308('0x2a')](_0x386527[_0x4308('0x2b')],{'raw':_0x386527['options']?_0x386527[_0x4308('0x1f')][_0x4308('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386527[_0x4308('0x1f')]?_0x386527[_0x4308('0x1f')][_0x4308('0x21')]||null:null,'attributes':_0x386527[_0x4308('0x1f')]?_0x386527[_0x4308('0x1f')][_0x4308('0x22')]||null:null,'limit':_0x386527['options']?_0x386527[_0x4308('0x1f')][_0x4308('0x23')]||null:null})[_0x4308('0x10')](function(_0x34c878){logger[_0x4308('0x19')](_0x4308('0x29'),_0x386527);logger[_0x4308('0x13')](_0x4308('0x29'),_0x386527,JSON[_0x4308('0x15')](_0x34c878));_0x4c65da(_0x34c878);})[_0x4308('0x1b')](function(_0x27eda0){logger[_0x4308('0x17')](_0x4308('0x29'),_0x27eda0[_0x4308('0x18')],_0x386527);_0xc4feb8(_0x53e9cc[_0x4308('0x17')](0x1f4,_0x27eda0[_0x4308('0x18')]));});});}; \ No newline at end of file +var _0xecf7=['request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','include','map','model','attributes','then','create','body','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x39a9f2,_0x4a1441){var _0x5a9cc2=function(_0x372a32){while(--_0x372a32){_0x39a9f2['push'](_0x39a9f2['shift']());}};_0x5a9cc2(++_0x4a1441);}(_0xecf7,0x157));var _0x7ecf=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xecf7[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7ecf('0x0'));var util=require(_0x7ecf('0x1'));var moment=require(_0x7ecf('0x2'));var BPromise=require(_0x7ecf('0x3'));var rs=require(_0x7ecf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ecf('0x5'))['db'];var utils=require(_0x7ecf('0x6'));var logger=require(_0x7ecf('0x7'))(_0x7ecf('0x8'));var config=require(_0x7ecf('0x9'));var jayson=require(_0x7ecf('0xa'));var client=jayson[_0x7ecf('0xb')][_0x7ecf('0xc')]({'port':0x232a});config[_0x7ecf('0xd')]=_['defaults'](config['redis'],{'host':_0x7ecf('0xe'),'port':0x18eb});var socket=require(_0x7ecf('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x7ecf('0x10')](socket);function respondWithRpcPromise(_0x2170c3,_0x2ef333,_0x5bdb5d){return new BPromise(function(_0x570a2c,_0x3d26f2){return client[_0x7ecf('0x11')](_0x2170c3,_0x5bdb5d)['then'](function(_0xac720a){logger[_0x7ecf('0x12')](_0x7ecf('0x13'),_0x2ef333,_0x7ecf('0x14'));logger[_0x7ecf('0x15')](_0x7ecf('0x16'),_0x2ef333,'request\x20sent',JSON[_0x7ecf('0x17')](_0xac720a));if(_0xac720a[_0x7ecf('0x18')]){if(_0xac720a[_0x7ecf('0x18')]['code']===0x1f4){logger[_0x7ecf('0x18')](_0x7ecf('0x13'),_0x2ef333,_0xac720a[_0x7ecf('0x18')][_0x7ecf('0x19')]);return _0x3d26f2(_0xac720a['error'][_0x7ecf('0x19')]);}logger[_0x7ecf('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x2ef333,_0xac720a[_0x7ecf('0x18')]['message']);return _0x570a2c(_0xac720a[_0x7ecf('0x18')][_0x7ecf('0x19')]);}else{logger[_0x7ecf('0x12')](_0x7ecf('0x13'),_0x2ef333,_0x7ecf('0x14'));_0x570a2c(_0xac720a[_0x7ecf('0x1a')][_0x7ecf('0x19')]);}})[_0x7ecf('0x1b')](function(_0x10dfb7){logger[_0x7ecf('0x18')](_0x7ecf('0x13'),_0x2ef333,_0x10dfb7);_0x3d26f2(_0x10dfb7);});});}exports[_0x7ecf('0x1c')]=function(_0xf9d3d1){var _0x3bff03=this;return new Promise(function(_0x49d4db,_0x401cbf){return db[_0x7ecf('0x1d')][_0x7ecf('0x1e')]({'raw':_0xf9d3d1[_0x7ecf('0x1f')]?_0xf9d3d1['options']['raw']===undefined?!![]:![]:!![],'where':_0xf9d3d1['options']?_0xf9d3d1[_0x7ecf('0x1f')]['where']||null:null,'attributes':_0xf9d3d1['options']?_0xf9d3d1['options']['attributes']||null:null,'limit':_0xf9d3d1[_0x7ecf('0x1f')]?_0xf9d3d1[_0x7ecf('0x1f')]['limit']||null:null,'include':_0xf9d3d1[_0x7ecf('0x1f')]?_0xf9d3d1[_0x7ecf('0x1f')][_0x7ecf('0x20')]?_[_0x7ecf('0x21')](_0xf9d3d1[_0x7ecf('0x1f')][_0x7ecf('0x20')],function(_0x1c2e4d){return{'model':db[_0x1c2e4d[_0x7ecf('0x22')]],'as':_0x1c2e4d['as'],'attributes':_0x1c2e4d['attributes'],'include':_0x1c2e4d['include']?_[_0x7ecf('0x21')](_0x1c2e4d['include'],function(_0x3fb93a){return{'model':db[_0x3fb93a[_0x7ecf('0x22')]],'as':_0x3fb93a['as'],'attributes':_0x3fb93a[_0x7ecf('0x23')],'include':_0x3fb93a[_0x7ecf('0x20')]?_['map'](_0x3fb93a[_0x7ecf('0x20')],function(_0xf56cdb){return{'model':db[_0xf56cdb[_0x7ecf('0x22')]],'as':_0xf56cdb['as'],'attributes':_0xf56cdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ecf('0x24')](function(_0x2eca3d){logger[_0x7ecf('0x12')](_0x7ecf('0x1c'),_0xf9d3d1);logger[_0x7ecf('0x15')](_0x7ecf('0x1c'),_0xf9d3d1,JSON[_0x7ecf('0x17')](_0x2eca3d));_0x49d4db(_0x2eca3d);})[_0x7ecf('0x1b')](function(_0x49d868){logger['error'](_0x7ecf('0x1c'),_0x49d868[_0x7ecf('0x19')],_0xf9d3d1);_0x401cbf(_0x3bff03[_0x7ecf('0x18')](0x1f4,_0x49d868['message']));});});};exports['CreateVoiceQueueReport']=function(_0xa67b44){var _0x2fc077=this;return new Promise(function(_0x3c1147,_0x5b7f2a){return db['VoiceQueueReport'][_0x7ecf('0x25')](_0xa67b44[_0x7ecf('0x26')],{'raw':_0xa67b44[_0x7ecf('0x1f')]?_0xa67b44['options'][_0x7ecf('0x27')]===undefined?!![]:![]:!![]})[_0x7ecf('0x24')](function(_0x533778){logger[_0x7ecf('0x12')](_0x7ecf('0x28'),_0xa67b44);logger[_0x7ecf('0x15')](_0x7ecf('0x28'),_0xa67b44,JSON[_0x7ecf('0x17')](_0x533778));_0x3c1147(_0x533778);})[_0x7ecf('0x1b')](function(_0xb43bdb){logger[_0x7ecf('0x18')](_0x7ecf('0x28'),_0xb43bdb[_0x7ecf('0x19')],_0xa67b44);_0x5b7f2a(_0x2fc077[_0x7ecf('0x18')](0x1f4,_0xb43bdb[_0x7ecf('0x19')]));});});};exports[_0x7ecf('0x29')]=function(_0x3043e6){var _0x17253f=this;return new Promise(function(_0x199d74,_0x260255){return db['VoiceQueueReport'][_0x7ecf('0x2a')](_0x3043e6[_0x7ecf('0x26')],{'raw':_0x3043e6[_0x7ecf('0x1f')]?_0x3043e6[_0x7ecf('0x1f')][_0x7ecf('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3043e6['options']?_0x3043e6[_0x7ecf('0x1f')][_0x7ecf('0x2b')]||null:null,'attributes':_0x3043e6[_0x7ecf('0x1f')]?_0x3043e6['options']['attributes']||null:null,'limit':_0x3043e6['options']?_0x3043e6[_0x7ecf('0x1f')][_0x7ecf('0x2c')]||null:null})[_0x7ecf('0x24')](function(_0x2aa257){logger['info'](_0x7ecf('0x29'),_0x3043e6);logger[_0x7ecf('0x15')]('UpdateVoiceQueueReport',_0x3043e6,JSON['stringify'](_0x2aa257));_0x199d74(_0x2aa257);})[_0x7ecf('0x1b')](function(_0x295549){logger[_0x7ecf('0x18')]('UpdateVoiceQueueReport',_0x295549[_0x7ecf('0x19')],_0x3043e6);_0x260255(_0x17253f['error'](0x1f4,_0x295549[_0x7ecf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f211be2..057d48c 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 _0xdfe7=['length','voiceQueueReport:','save','remove','emit','removeListener'];(function(_0x44b73e,_0x232885){var _0x33634c=function(_0x4ae6c5){while(--_0x4ae6c5){_0x44b73e['push'](_0x44b73e['shift']());}};_0x33634c(++_0x232885);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x486428,_0x4f4e75){_0x486428=_0x486428-0x0;var _0x314f04=_0xdfe7[_0x486428];return _0x314f04;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x7dfe('0x0'),_0x7dfe('0x1'),'update'];function createListener(_0x162e75,_0x36c721){return function(_0x388848){_0x36c721[_0x7dfe('0x2')](_0x162e75,_0x388848);};}function removeListener(_0x527490,_0x2c07d2){return function(){VoiceQueueReportEvents[_0x7dfe('0x3')](_0x527490,_0x2c07d2);};}exports['register']=function(_0x262561){for(var _0x3d8220=0x0,_0x23d0c1=events[_0x7dfe('0x4')];_0x3d8220<_0x23d0c1;_0x3d8220++){var _0x56d67e=events[_0x3d8220];var _0x3fc0a0=createListener(_0x7dfe('0x5')+_0x56d67e,_0x262561);VoiceQueueReportEvents['on'](_0x56d67e,_0x3fc0a0);}}; \ No newline at end of file +var _0x4c72=['remove','update','register','length','./voiceQueueReport.events'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x4c72,0x1e4));var _0x24c7=function(_0x5af10f,_0x3a5a50){_0x5af10f=_0x5af10f-0x0;var _0x1ec988=_0x4c72[_0x5af10f];return _0x1ec988;};'use strict';var VoiceQueueReportEvents=require(_0x24c7('0x0'));var events=['save',_0x24c7('0x1'),_0x24c7('0x2')];function createListener(_0x4f4907,_0x5a21cf){return function(_0x490372){_0x5a21cf['emit'](_0x4f4907,_0x490372);};}function removeListener(_0x3d56cf,_0x442509){return function(){VoiceQueueReportEvents['removeListener'](_0x3d56cf,_0x442509);};}exports[_0x24c7('0x3')]=function(_0x55d9dd){for(var _0x519348=0x0,_0xe0149f=events[_0x24c7('0x4')];_0x519348<_0xe0149f;_0x519348++){var _0x46e082=events[_0x519348];var _0xdb079d=createListener('voiceQueueReport:'+_0x46e082,_0x55d9dd);VoiceQueueReportEvents['on'](_0x46e082,_0xdb079d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1ad04b0..43d1209 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 _0x66c6=['multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','update','destroy','exports'];(function(_0xf32c15,_0x41d8b5){var _0x22a161=function(_0x4a6486){while(--_0x4a6486){_0xf32c15['push'](_0xf32c15['shift']());}};_0x22a161(++_0x41d8b5);}(_0x66c6,0x165));var _0x666c=function(_0x44fd28,_0x56e834){_0x44fd28=_0x44fd28-0x0;var _0x36c9c1=_0x66c6[_0x44fd28];return _0x36c9c1;};'use strict';var multer=require(_0x666c('0x0'));var util=require(_0x666c('0x1'));var path=require('path');var timeout=require(_0x666c('0x2'));var express=require('express');var router=express[_0x666c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x666c('0x4'));var config=require(_0x666c('0x5'));var controller=require(_0x666c('0x6'));router[_0x666c('0x7')]('/',auth['isAuthenticated'](),controller[_0x666c('0x8')]);router[_0x666c('0x7')](_0x666c('0x9'),auth[_0x666c('0xa')](),controller[_0x666c('0xb')]);router[_0x666c('0xc')]('/',auth['isAuthenticated'](),controller[_0x666c('0xd')]);router['put'](_0x666c('0x9'),auth['isAuthenticated'](),controller[_0x666c('0xe')]);router['delete'](_0x666c('0x9'),auth['isAuthenticated'](),controller[_0x666c('0xf')]);module[_0x666c('0x10')]=router; \ No newline at end of file +var _0x2794=['delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x33757c,_0x5df618){var _0x297ae3=function(_0x25492a){while(--_0x25492a){_0x33757c['push'](_0x33757c['shift']());}};_0x297ae3(++_0x5df618);}(_0x2794,0x111));var _0x4279=function(_0x3b4c9f,_0x97985e){_0x3b4c9f=_0x3b4c9f-0x0;var _0xf003bb=_0x2794[_0x3b4c9f];return _0xf003bb;};'use strict';var multer=require('multer');var util=require(_0x4279('0x0'));var path=require('path');var timeout=require(_0x4279('0x1'));var express=require(_0x4279('0x2'));var router=express['Router']();var fs_extra=require(_0x4279('0x3'));var auth=require(_0x4279('0x4'));var interaction=require(_0x4279('0x5'));var config=require(_0x4279('0x6'));var controller=require(_0x4279('0x7'));router[_0x4279('0x8')]('/',auth[_0x4279('0x9')](),controller[_0x4279('0xa')]);router[_0x4279('0x8')](_0x4279('0xb'),auth[_0x4279('0x9')](),controller['show']);router[_0x4279('0xc')]('/',auth[_0x4279('0x9')](),controller[_0x4279('0xd')]);router[_0x4279('0xe')](_0x4279('0xb'),auth[_0x4279('0x9')](),controller[_0x4279('0xf')]);router[_0x4279('0x10')](_0x4279('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e481faf..5b967cc 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 _0x4471=['DATE','sequelize','exports','STRING'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x4471,0x179));var _0x1447=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4471[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x1447('0x0'));var moment=require('moment');module[_0x1447('0x1')]={'time':{'type':Sequelize[_0x1447('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1447('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1447('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x63a8=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x63a8,0x1ea));var _0x863a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a8[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x863a('0x0'));var moment=require('moment');module[_0x863a('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x863a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x863a('0x3')],'allowNull':![],'defaultValue':moment()[_0x863a('0x4')](_0x863a('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2782d6f..e86ad57 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 _0x0017=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','then','includeAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x58e3b1,_0x4b5f94){var _0x40c7f7=function(_0x4d8e8b){while(--_0x4d8e8b){_0x58e3b1['push'](_0x58e3b1['shift']());}};_0x40c7f7(++_0x4b5f94);}(_0x0017,0x1a2));var _0x7001=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0x0017[_0x1f5143];return _0x383a38;};'use strict';var emlformat=require(_0x7001('0x0'));var rimraf=require(_0x7001('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7001('0x2'));var rp=require('request-promise');var moment=require(_0x7001('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7001('0x4'));var sox=require(_0x7001('0x5'));var csv=require(_0x7001('0x6'));var ejs=require(_0x7001('0x7'));var fs=require('fs');var fs_extra=require(_0x7001('0x8'));var _=require(_0x7001('0x9'));var squel=require(_0x7001('0xa'));var crypto=require('crypto');var jsforce=require(_0x7001('0xb'));var deskjs=require(_0x7001('0xc'));var toCsv=require(_0x7001('0x6'));var querystring=require('querystring');var Papa=require(_0x7001('0xd'));var Redis=require(_0x7001('0xe'));var authService=require(_0x7001('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7001('0x10'));var hardwareService=require(_0x7001('0x11'));var logger=require(_0x7001('0x12'))(_0x7001('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7001('0x14'));var db=require(_0x7001('0x15'))['db'];function respondWithStatusCode(_0x28e614,_0x14a468){_0x14a468=_0x14a468||0xcc;return function(_0x26ffed){if(_0x26ffed){return _0x28e614[_0x7001('0x16')](_0x14a468);}return _0x28e614[_0x7001('0x17')](_0x14a468)[_0x7001('0x18')]();};}function respondWithResult(_0x5cf4c1,_0x41c1ef){_0x41c1ef=_0x41c1ef||0xc8;return function(_0x252286){if(_0x252286){return _0x5cf4c1[_0x7001('0x17')](_0x41c1ef)[_0x7001('0x19')](_0x252286);}};}function respondWithFilteredResult(_0x37fc4d,_0x5338c0){return function(_0x5ddb6e){if(_0x5ddb6e){var _0x4476a7=typeof _0x5338c0[_0x7001('0x1a')]===_0x7001('0x1b')&&typeof _0x5338c0[_0x7001('0x1c')]===_0x7001('0x1b');var _0x34c04b=_0x5ddb6e['count'];var _0x3ae687=_0x4476a7?0x0:_0x5338c0[_0x7001('0x1a')];var _0x58cbea=_0x4476a7?_0x5ddb6e['count']:_0x5338c0[_0x7001('0x1a')]+_0x5338c0[_0x7001('0x1c')];var _0x1169ed;if(_0x58cbea>=_0x34c04b){_0x58cbea=_0x34c04b;_0x1169ed=0xc8;}else{_0x1169ed=0xce;}_0x37fc4d[_0x7001('0x17')](_0x1169ed);return _0x37fc4d[_0x7001('0x1d')](_0x7001('0x1e'),_0x3ae687+'-'+_0x58cbea+'/'+_0x34c04b)['json'](_0x5ddb6e);}return null;};}function patchUpdates(_0x5708a5){return function(_0x5d04fb){try{jsonpatch[_0x7001('0x1f')](_0x5d04fb,_0x5708a5,!![]);}catch(_0x5bcffc){return BPromise[_0x7001('0x20')](_0x5bcffc);}return _0x5d04fb['save']();};}function saveUpdates(_0x7c40dc,_0x3ecce7){return function(_0x4391ab){if(_0x4391ab){return _0x4391ab[_0x7001('0x21')](_0x7c40dc)['then'](function(_0x49c64b){return _0x49c64b;});}return null;};}function removeEntity(_0x29c5e6,_0x4944a5){return function(_0x105c7b){if(_0x105c7b){return _0x105c7b[_0x7001('0x22')]()['then'](function(){_0x29c5e6[_0x7001('0x17')](0xcc)[_0x7001('0x18')]();});}};}function handleEntityNotFound(_0x102a06,_0x24846a){return function(_0x4dd07e){if(!_0x4dd07e){_0x102a06['sendStatus'](0x194);}return _0x4dd07e;};}function handleError(_0x13230c,_0x47889b){_0x47889b=_0x47889b||0x1f4;return function(_0x119e4f){logger[_0x7001('0x23')](_0x119e4f['stack']);if(_0x119e4f[_0x7001('0x24')]){delete _0x119e4f['name'];}_0x13230c[_0x7001('0x17')](_0x47889b)[_0x7001('0x25')](_0x119e4f);};}exports[_0x7001('0x26')]=function(_0x16d256,_0x3abcdd){var _0x3216da={},_0xcc46f2={},_0x388725={'count':0x0,'rows':[]};var _0x580e7b=_[_0x7001('0x27')](db[_0x7001('0x28')][_0x7001('0x29')],function(_0x12b4e4){return{'name':_0x12b4e4[_0x7001('0x2a')],'type':_0x12b4e4[_0x7001('0x2b')][_0x7001('0x2c')]};});_0xcc46f2[_0x7001('0x2d')]=_[_0x7001('0x27')](_0x580e7b,'name');_0xcc46f2[_0x7001('0x2e')]=_['keys'](_0x16d256[_0x7001('0x2e')]);_0xcc46f2[_0x7001('0x2f')]=_[_0x7001('0x30')](_0xcc46f2[_0x7001('0x2d')],_0xcc46f2[_0x7001('0x2e')]);_0x3216da[_0x7001('0x31')]=_[_0x7001('0x30')](_0xcc46f2[_0x7001('0x2d')],qs[_0x7001('0x32')](_0x16d256['query'][_0x7001('0x32')]));_0x3216da[_0x7001('0x31')]=_0x3216da[_0x7001('0x31')][_0x7001('0x33')]?_0x3216da['attributes']:_0xcc46f2[_0x7001('0x2d')];if(!_0x16d256['query'][_0x7001('0x34')](_0x7001('0x35'))){_0x3216da[_0x7001('0x1c')]=qs[_0x7001('0x1c')](_0x16d256['query']['limit']);_0x3216da['offset']=qs[_0x7001('0x1a')](_0x16d256[_0x7001('0x2e')]['offset']);}_0x3216da['order']=qs[_0x7001('0x36')](_0x16d256[_0x7001('0x2e')][_0x7001('0x36')]);_0x3216da[_0x7001('0x37')]=qs[_0x7001('0x2f')](_[_0x7001('0x38')](_0x16d256[_0x7001('0x2e')],_0xcc46f2[_0x7001('0x2f')]),_0x580e7b);if(_0x16d256[_0x7001('0x2e')]['filter']){_0x3216da[_0x7001('0x37')]=_[_0x7001('0x39')](_0x3216da['where'],{'$or':_[_0x7001('0x27')](_0x580e7b,function(_0x18c322){if(_0x18c322['type']!==_0x7001('0x3a')){var _0x52bb66={};_0x52bb66[_0x18c322['name']]={'$like':'%'+_0x16d256[_0x7001('0x2e')][_0x7001('0x3b')]+'%'};return _0x52bb66;}})});}_0x3216da=_['merge']({},_0x3216da,_0x16d256[_0x7001('0x3c')]);var _0x33fbd9={'where':_0x3216da[_0x7001('0x37')]};return db[_0x7001('0x28')][_0x7001('0x3d')](_0x33fbd9)[_0x7001('0x3e')](function(_0x4220e8){_0x388725[_0x7001('0x3d')]=_0x4220e8;if(_0x16d256[_0x7001('0x2e')][_0x7001('0x3f')]){_0x3216da['include']=[{'all':!![]}];}return db[_0x7001('0x28')]['findAll'](_0x3216da);})['then'](function(_0x333603){_0x388725[_0x7001('0x40')]=_0x333603;return _0x388725;})[_0x7001('0x3e')](respondWithFilteredResult(_0x3abcdd,_0x3216da))[_0x7001('0x41')](handleError(_0x3abcdd,null));};exports[_0x7001('0x42')]=function(_0x2800e8,_0x4f2b23){var _0x3a673d={'raw':!![],'where':{'id':_0x2800e8[_0x7001('0x43')]['id']}},_0x382687={};_0x382687[_0x7001('0x2d')]=_[_0x7001('0x44')](db[_0x7001('0x28')][_0x7001('0x29')]);_0x382687[_0x7001('0x2e')]=_[_0x7001('0x44')](_0x2800e8[_0x7001('0x2e')]);_0x382687[_0x7001('0x2f')]=_[_0x7001('0x30')](_0x382687[_0x7001('0x2d')],_0x382687[_0x7001('0x2e')]);_0x3a673d[_0x7001('0x31')]=_[_0x7001('0x30')](_0x382687[_0x7001('0x2d')],qs['fields'](_0x2800e8[_0x7001('0x2e')][_0x7001('0x32')]));_0x3a673d['attributes']=_0x3a673d[_0x7001('0x31')]['length']?_0x3a673d[_0x7001('0x31')]:_0x382687[_0x7001('0x2d')];if(_0x2800e8['query'][_0x7001('0x3f')]){_0x3a673d[_0x7001('0x45')]=[{'all':!![]}];}_0x3a673d=_[_0x7001('0x39')]({},_0x3a673d,_0x2800e8[_0x7001('0x3c')]);return db[_0x7001('0x28')][_0x7001('0x46')](_0x3a673d)[_0x7001('0x3e')](handleEntityNotFound(_0x4f2b23,null))[_0x7001('0x3e')](respondWithResult(_0x4f2b23,null))[_0x7001('0x41')](handleError(_0x4f2b23,null));};exports[_0x7001('0x47')]=function(_0x2445e6,_0x66774d){return db[_0x7001('0x28')]['create'](_0x2445e6[_0x7001('0x48')],{})['then'](respondWithResult(_0x66774d,0xc9))[_0x7001('0x41')](handleError(_0x66774d,null));};exports['update']=function(_0x2a6bcd,_0x2b631e){if(_0x2a6bcd[_0x7001('0x48')]['id']){delete _0x2a6bcd[_0x7001('0x48')]['id'];}return db[_0x7001('0x28')][_0x7001('0x46')]({'where':{'id':_0x2a6bcd[_0x7001('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b631e,null))['then'](saveUpdates(_0x2a6bcd[_0x7001('0x48')],null))[_0x7001('0x3e')](respondWithResult(_0x2b631e,null))[_0x7001('0x41')](handleError(_0x2b631e,null));};exports[_0x7001('0x22')]=function(_0x4088f8,_0x5eac23){return db[_0x7001('0x28')]['find']({'where':{'id':_0x4088f8['params']['id']}})[_0x7001('0x3e')](handleEntityNotFound(_0x5eac23,null))[_0x7001('0x3e')](removeEntity(_0x5eac23,null))['catch'](handleError(_0x5eac23,null));}; \ No newline at end of file +var _0x946d=['api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x946d,0x1f2));var _0xd946=function(_0x2a0b73,_0x3ad988){_0x2a0b73=_0x2a0b73-0x0;var _0x513d36=_0x946d[_0x2a0b73];return _0x513d36;};'use strict';var emlformat=require(_0xd946('0x0'));var rimraf=require(_0xd946('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd946('0x2'));var rp=require(_0xd946('0x3'));var moment=require(_0xd946('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd946('0x5'));var sox=require(_0xd946('0x6'));var csv=require(_0xd946('0x7'));var ejs=require(_0xd946('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd946('0x9'));var squel=require('squel');var crypto=require(_0xd946('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd946('0xb'));var toCsv=require(_0xd946('0x7'));var querystring=require(_0xd946('0xc'));var Papa=require(_0xd946('0xd'));var Redis=require(_0xd946('0xe'));var authService=require(_0xd946('0xf'));var qs=require(_0xd946('0x10'));var as=require(_0xd946('0x11'));var hardwareService=require(_0xd946('0x12'));var logger=require(_0xd946('0x13'))(_0xd946('0x14'));var utils=require(_0xd946('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd946('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ee4f7,_0x2a71a2){_0x2a71a2=_0x2a71a2||0xcc;return function(_0x25961e){if(_0x25961e){return _0x2ee4f7[_0xd946('0x17')](_0x2a71a2);}return _0x2ee4f7['status'](_0x2a71a2)['end']();};}function respondWithResult(_0x5b5c77,_0x59a2cf){_0x59a2cf=_0x59a2cf||0xc8;return function(_0x1a5a96){if(_0x1a5a96){return _0x5b5c77[_0xd946('0x18')](_0x59a2cf)[_0xd946('0x19')](_0x1a5a96);}};}function respondWithFilteredResult(_0x283afe,_0x17c863){return function(_0x11ff9b){if(_0x11ff9b){var _0x459f85=typeof _0x17c863['offset']===_0xd946('0x1a')&&typeof _0x17c863[_0xd946('0x1b')]===_0xd946('0x1a');var _0x215d40=_0x11ff9b['count'];var _0x23bb27=_0x459f85?0x0:_0x17c863['offset'];var _0x4ba31a=_0x459f85?_0x11ff9b[_0xd946('0x1c')]:_0x17c863[_0xd946('0x1d')]+_0x17c863[_0xd946('0x1b')];var _0x1439f0;if(_0x4ba31a>=_0x215d40){_0x4ba31a=_0x215d40;_0x1439f0=0xc8;}else{_0x1439f0=0xce;}_0x283afe[_0xd946('0x18')](_0x1439f0);return _0x283afe[_0xd946('0x1e')](_0xd946('0x1f'),_0x23bb27+'-'+_0x4ba31a+'/'+_0x215d40)[_0xd946('0x19')](_0x11ff9b);}return null;};}function patchUpdates(_0x365339){return function(_0x304ff8){try{jsonpatch[_0xd946('0x20')](_0x304ff8,_0x365339,!![]);}catch(_0x4c4a40){return BPromise[_0xd946('0x21')](_0x4c4a40);}return _0x304ff8[_0xd946('0x22')]();};}function saveUpdates(_0x2afe87,_0x3e9d27){return function(_0x55f3e3){if(_0x55f3e3){return _0x55f3e3[_0xd946('0x23')](_0x2afe87)[_0xd946('0x24')](function(_0x5c1e66){return _0x5c1e66;});}return null;};}function removeEntity(_0x211a56,_0x2d1dcb){return function(_0x5a4082){if(_0x5a4082){return _0x5a4082[_0xd946('0x25')]()['then'](function(){_0x211a56['status'](0xcc)[_0xd946('0x26')]();});}};}function handleEntityNotFound(_0x16e735,_0x428f71){return function(_0x32977e){if(!_0x32977e){_0x16e735[_0xd946('0x17')](0x194);}return _0x32977e;};}function handleError(_0x383451,_0xa2472d){_0xa2472d=_0xa2472d||0x1f4;return function(_0x20fe40){logger[_0xd946('0x27')](_0x20fe40[_0xd946('0x28')]);if(_0x20fe40[_0xd946('0x29')]){delete _0x20fe40[_0xd946('0x29')];}_0x383451[_0xd946('0x18')](_0xa2472d)[_0xd946('0x2a')](_0x20fe40);};}exports[_0xd946('0x2b')]=function(_0x530389,_0x5611e0){var _0x4789a2={},_0x58cf4f={},_0x27fbde={'count':0x0,'rows':[]};var _0x2f2143=_[_0xd946('0x2c')](db[_0xd946('0x2d')][_0xd946('0x2e')],function(_0x119615){return{'name':_0x119615['fieldName'],'type':_0x119615['type'][_0xd946('0x2f')]};});_0x58cf4f[_0xd946('0x30')]=_['map'](_0x2f2143,_0xd946('0x29'));_0x58cf4f[_0xd946('0x31')]=_[_0xd946('0x32')](_0x530389[_0xd946('0x31')]);_0x58cf4f[_0xd946('0x33')]=_['intersection'](_0x58cf4f[_0xd946('0x30')],_0x58cf4f[_0xd946('0x31')]);_0x4789a2[_0xd946('0x34')]=_[_0xd946('0x35')](_0x58cf4f[_0xd946('0x30')],qs['fields'](_0x530389[_0xd946('0x31')][_0xd946('0x36')]));_0x4789a2[_0xd946('0x34')]=_0x4789a2[_0xd946('0x34')][_0xd946('0x37')]?_0x4789a2[_0xd946('0x34')]:_0x58cf4f[_0xd946('0x30')];if(!_0x530389['query'][_0xd946('0x38')](_0xd946('0x39'))){_0x4789a2[_0xd946('0x1b')]=qs[_0xd946('0x1b')](_0x530389[_0xd946('0x31')]['limit']);_0x4789a2['offset']=qs[_0xd946('0x1d')](_0x530389[_0xd946('0x31')][_0xd946('0x1d')]);}_0x4789a2[_0xd946('0x3a')]=qs['sort'](_0x530389[_0xd946('0x31')]['sort']);_0x4789a2[_0xd946('0x3b')]=qs[_0xd946('0x33')](_[_0xd946('0x3c')](_0x530389[_0xd946('0x31')],_0x58cf4f[_0xd946('0x33')]),_0x2f2143);if(_0x530389[_0xd946('0x31')][_0xd946('0x3d')]){_0x4789a2['where']=_['merge'](_0x4789a2[_0xd946('0x3b')],{'$or':_['map'](_0x2f2143,function(_0x4062ff){if(_0x4062ff[_0xd946('0x3e')]!==_0xd946('0x3f')){var _0x7e4daa={};_0x7e4daa[_0x4062ff[_0xd946('0x29')]]={'$like':'%'+_0x530389[_0xd946('0x31')][_0xd946('0x3d')]+'%'};return _0x7e4daa;}})});}_0x4789a2=_[_0xd946('0x40')]({},_0x4789a2,_0x530389[_0xd946('0x41')]);var _0x1f4844={'where':_0x4789a2[_0xd946('0x3b')]};return db[_0xd946('0x2d')]['count'](_0x1f4844)[_0xd946('0x24')](function(_0x47501f){_0x27fbde[_0xd946('0x1c')]=_0x47501f;if(_0x530389['query'][_0xd946('0x42')]){_0x4789a2[_0xd946('0x43')]=[{'all':!![]}];}return db[_0xd946('0x2d')]['findAll'](_0x4789a2);})[_0xd946('0x24')](function(_0xc1369c){_0x27fbde['rows']=_0xc1369c;return _0x27fbde;})[_0xd946('0x24')](respondWithFilteredResult(_0x5611e0,_0x4789a2))[_0xd946('0x44')](handleError(_0x5611e0,null));};exports[_0xd946('0x45')]=function(_0x1decc0,_0xb8a9aa){var _0x190fb7={'raw':!![],'where':{'id':_0x1decc0[_0xd946('0x46')]['id']}},_0x566d8c={};_0x566d8c[_0xd946('0x30')]=_[_0xd946('0x32')](db['VoiceQueuesLog'][_0xd946('0x2e')]);_0x566d8c['query']=_[_0xd946('0x32')](_0x1decc0['query']);_0x566d8c[_0xd946('0x33')]=_['intersection'](_0x566d8c[_0xd946('0x30')],_0x566d8c[_0xd946('0x31')]);_0x190fb7[_0xd946('0x34')]=_[_0xd946('0x35')](_0x566d8c[_0xd946('0x30')],qs[_0xd946('0x36')](_0x1decc0[_0xd946('0x31')][_0xd946('0x36')]));_0x190fb7[_0xd946('0x34')]=_0x190fb7[_0xd946('0x34')][_0xd946('0x37')]?_0x190fb7[_0xd946('0x34')]:_0x566d8c[_0xd946('0x30')];if(_0x1decc0[_0xd946('0x31')][_0xd946('0x42')]){_0x190fb7['include']=[{'all':!![]}];}_0x190fb7=_[_0xd946('0x40')]({},_0x190fb7,_0x1decc0['options']);return db[_0xd946('0x2d')][_0xd946('0x47')](_0x190fb7)['then'](handleEntityNotFound(_0xb8a9aa,null))[_0xd946('0x24')](respondWithResult(_0xb8a9aa,null))[_0xd946('0x44')](handleError(_0xb8a9aa,null));};exports[_0xd946('0x48')]=function(_0x19bb1d,_0x27ef9b){return db[_0xd946('0x2d')]['create'](_0x19bb1d[_0xd946('0x49')],{})[_0xd946('0x24')](respondWithResult(_0x27ef9b,0xc9))[_0xd946('0x44')](handleError(_0x27ef9b,null));};exports[_0xd946('0x23')]=function(_0x2372b7,_0x51fde4){if(_0x2372b7[_0xd946('0x49')]['id']){delete _0x2372b7['body']['id'];}return db[_0xd946('0x2d')][_0xd946('0x47')]({'where':{'id':_0x2372b7['params']['id']}})[_0xd946('0x24')](handleEntityNotFound(_0x51fde4,null))[_0xd946('0x24')](saveUpdates(_0x2372b7[_0xd946('0x49')],null))['then'](respondWithResult(_0x51fde4,null))['catch'](handleError(_0x51fde4,null));};exports[_0xd946('0x25')]=function(_0x3f4416,_0xbdb06a){return db[_0xd946('0x2d')][_0xd946('0x47')]({'where':{'id':_0x3f4416[_0xd946('0x46')]['id']}})[_0xd946('0x24')](handleEntityNotFound(_0xbdb06a,null))[_0xd946('0x24')](removeEntity(_0xbdb06a,null))['catch'](handleError(_0xbdb06a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 02f31bc..5de3cc6 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 _0xaffa=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x1f3743,_0x23f85b){var _0x2325c5=function(_0x44cd49){while(--_0x44cd49){_0x1f3743['push'](_0x1f3743['shift']());}};_0x2325c5(++_0x23f85b);}(_0xaffa,0x11d));var _0xaaff=function(_0x7049cb,_0x2dddfe){_0x7049cb=_0x7049cb-0x0;var _0x442e2e=_0xaffa[_0x7049cb];return _0x442e2e;};'use strict';var _=require(_0xaaff('0x0'));var util=require(_0xaaff('0x1'));var logger=require(_0xaaff('0x2'))(_0xaaff('0x3'));var moment=require(_0xaaff('0x4'));var BPromise=require(_0xaaff('0x5'));var rp=require(_0xaaff('0x6'));var fs=require('fs');var path=require(_0xaaff('0x7'));var rimraf=require(_0xaaff('0x8'));var config=require(_0xaaff('0x9'));var attributes=require(_0xaaff('0xa'));module[_0xaaff('0xb')]=function(_0x3e8936,_0xe2f5dc){return _0x3e8936[_0xaaff('0xc')](_0xaaff('0xd'),attributes,{'tableName':_0xaaff('0xe'),'paranoid':![],'indexes':[{'name':_0xaaff('0xf'),'fields':[_0xaaff('0x10'),_0xaaff('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5294=['voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog'];(function(_0x2a2bc3,_0x36b55f){var _0x38522f=function(_0x10959e){while(--_0x10959e){_0x2a2bc3['push'](_0x2a2bc3['shift']());}};_0x38522f(++_0x36b55f);}(_0x5294,0x1e4));var _0x4529=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x5294[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x4529('0x0'));var logger=require(_0x4529('0x1'))(_0x4529('0x2'));var moment=require(_0x4529('0x3'));var BPromise=require(_0x4529('0x4'));var rp=require(_0x4529('0x5'));var fs=require('fs');var path=require(_0x4529('0x6'));var rimraf=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x4529('0x9')]=function(_0x5e712f,_0x527492){return _0x5e712f[_0x4529('0xa')](_0x4529('0xb'),attributes,{'tableName':_0x4529('0xc'),'paranoid':![],'indexes':[{'name':_0x4529('0xd'),'fields':[_0x4529('0xe'),_0x4529('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8df495c..2935f00 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 _0x8e99=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3c15ad,_0x5b2a11){var _0x2c89ef=function(_0x262c79){while(--_0x262c79){_0x3c15ad['push'](_0x3c15ad['shift']());}};_0x2c89ef(++_0x5b2a11);}(_0x8e99,0x167));var _0x98e9=function(_0x49cbdc,_0x39dbca){_0x49cbdc=_0x49cbdc-0x0;var _0x245606=_0x8e99[_0x49cbdc];return _0x245606;};'use strict';var _=require(_0x98e9('0x0'));var util=require(_0x98e9('0x1'));var moment=require(_0x98e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x98e9('0x3'));var fs=require('fs');var Redis=require(_0x98e9('0x4'));var db=require(_0x98e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98e9('0x6'))(_0x98e9('0x7'));var config=require(_0x98e9('0x8'));var jayson=require(_0x98e9('0x9'));var client=jayson[_0x98e9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9cc92,_0x5b470f,_0x36e8a5){return new BPromise(function(_0x3ae944,_0x4da16d){return client[_0x98e9('0xb')](_0xa9cc92,_0x36e8a5)[_0x98e9('0xc')](function(_0x17ad1c){logger[_0x98e9('0xd')](_0x98e9('0xe'),_0x5b470f,_0x98e9('0xf'));logger[_0x98e9('0x10')](_0x98e9('0x11'),_0x5b470f,'request\x20sent',JSON[_0x98e9('0x12')](_0x17ad1c));if(_0x17ad1c['error']){if(_0x17ad1c[_0x98e9('0x13')][_0x98e9('0x14')]===0x1f4){logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x17ad1c['error']['message']);return _0x4da16d(_0x17ad1c[_0x98e9('0x13')][_0x98e9('0x15')]);}logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x17ad1c[_0x98e9('0x13')]['message']);return _0x3ae944(_0x17ad1c['error'][_0x98e9('0x15')]);}else{logger['info'](_0x98e9('0xe'),_0x5b470f,'request\x20sent');_0x3ae944(_0x17ad1c[_0x98e9('0x16')][_0x98e9('0x15')]);}})[_0x98e9('0x17')](function(_0x5a5f2b){logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x5a5f2b);_0x4da16d(_0x5a5f2b);});});} \ No newline at end of file +var _0x16e3=['info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x16e3,0x168));var _0x316e=function(_0x436a6f,_0x3720b3){_0x436a6f=_0x436a6f-0x0;var _0x1b523d=_0x16e3[_0x436a6f];return _0x1b523d;};'use strict';var _=require(_0x316e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x316e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x316e('0x2'));var db=require(_0x316e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x316e('0x4'))('rpc');var config=require(_0x316e('0x5'));var jayson=require(_0x316e('0x6'));var client=jayson['client'][_0x316e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d7a5e,_0xb85517,_0x4ca4fc){return new BPromise(function(_0x250138,_0x5ac590){return client[_0x316e('0x8')](_0x5d7a5e,_0x4ca4fc)['then'](function(_0x538cba){logger['info'](_0x316e('0x9'),_0xb85517,_0x316e('0xa'));logger['debug'](_0x316e('0xb'),_0xb85517,_0x316e('0xa'),JSON['stringify'](_0x538cba));if(_0x538cba[_0x316e('0xc')]){if(_0x538cba['error']['code']===0x1f4){logger[_0x316e('0xc')](_0x316e('0x9'),_0xb85517,_0x538cba[_0x316e('0xc')][_0x316e('0xd')]);return _0x5ac590(_0x538cba['error'][_0x316e('0xd')]);}logger['error'](_0x316e('0x9'),_0xb85517,_0x538cba[_0x316e('0xc')][_0x316e('0xd')]);return _0x250138(_0x538cba['error'][_0x316e('0xd')]);}else{logger[_0x316e('0xe')](_0x316e('0x9'),_0xb85517,'request\x20sent');_0x250138(_0x538cba[_0x316e('0xf')][_0x316e('0xd')]);}})[_0x316e('0x10')](function(_0x127ca0){logger[_0x316e('0xc')](_0x316e('0x9'),_0xb85517,_0x127ca0);_0x5ac590(_0x127ca0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 79ad35a..78a6bd5 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 _0xaf86=['get','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','/:id','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xaf86,0xa1));var _0x6af8=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xaf86[_0x46efd7];return _0x5637e4;};'use strict';var multer=require(_0x6af8('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(_0x6af8('0x1'));var auth=require(_0x6af8('0x2'));var interaction=require(_0x6af8('0x3'));var config=require('../../config/environment');var controller=require(_0x6af8('0x4'));router['get']('/',auth[_0x6af8('0x5')](),controller[_0x6af8('0x6')]);router[_0x6af8('0x7')](_0x6af8('0x8'),auth[_0x6af8('0x5')](),controller[_0x6af8('0x9')]);router[_0x6af8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6af8('0xa')]);router[_0x6af8('0x7')](_0x6af8('0xb'),auth['isAuthenticated'](),controller[_0x6af8('0xc')]);router[_0x6af8('0x7')](_0x6af8('0xd'),controller[_0x6af8('0xe')]);router[_0x6af8('0x7')](_0x6af8('0xf'),auth[_0x6af8('0x5')](),controller[_0x6af8('0x10')]);router['post']('/',auth[_0x6af8('0x5')](),controller[_0x6af8('0x11')]);router[_0x6af8('0x12')](_0x6af8('0xf'),auth['isAuthenticated'](),controller[_0x6af8('0x13')]);router[_0x6af8('0x14')](_0x6af8('0x15'),auth[_0x6af8('0x5')](),controller['update']);router['delete'](_0x6af8('0x15'),auth[_0x6af8('0x5')](),controller[_0x6af8('0x16')]);module[_0x6af8('0x17')]=router; \ No newline at end of file +var _0x126b=['put','/:id','update','delete','exports','connect-timeout','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe'];(function(_0x5a4155,_0x4b2b70){var _0x4b1587=function(_0x4ac7ca){while(--_0x4ac7ca){_0x5a4155['push'](_0x5a4155['shift']());}};_0x4b1587(++_0x4b2b70);}(_0x126b,0x116));var _0xb126=function(_0x1c2faf,_0x14d02d){_0x1c2faf=_0x1c2faf-0x0;var _0x3bf713=_0x126b[_0x1c2faf];return _0x3bf713;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb126('0x0'));var express=require('express');var router=express[_0xb126('0x1')]();var fs_extra=require(_0xb126('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb126('0x3'));var controller=require(_0xb126('0x4'));router[_0xb126('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb126('0x5')](_0xb126('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xb126('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb126('0x5')]('/:id/download',auth[_0xb126('0x7')](),controller[_0xb126('0x8')]);router['get'](_0xb126('0x9'),controller[_0xb126('0xa')]);router[_0xb126('0x5')](_0xb126('0xb'),auth['isAuthenticated'](),controller[_0xb126('0xc')]);router['post']('/',auth[_0xb126('0x7')](),controller[_0xb126('0xd')]);router[_0xb126('0xe')](_0xb126('0xb'),auth[_0xb126('0x7')](),controller[_0xb126('0xf')]);router[_0xb126('0x10')](_0xb126('0x11'),auth[_0xb126('0x7')](),controller[_0xb126('0x12')]);router[_0xb126('0x13')](_0xb126('0x11'),auth[_0xb126('0x7')](),controller['destroy']);module[_0xb126('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index edbab77..631619c 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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 5cee58b..e87d1ae 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 _0x0115=['include','options','create','body','find','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','filename','extname','unlink','downloads','MD5','col','$and','push','secrets','recording','VoiceRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','destroy','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','language','Transcribe\x20not\x20configured','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','end','json','offset','undefined','limit','count','status','Content-Range','apply','update','then','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','map','format','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','catch','show','intersection'];(function(_0x304e0e,_0x2654a3){var _0x4449c8=function(_0x5a9242){while(--_0x5a9242){_0x304e0e['push'](_0x304e0e['shift']());}};_0x4449c8(++_0x2654a3);}(_0x0115,0xd8));var _0x5011=function(_0x256f03,_0x28b07e){_0x256f03=_0x256f03-0x0;var _0x4f4dfd=_0x0115[_0x256f03];return _0x4f4dfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5011('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5011('0x1'));var rp=require(_0x5011('0x2'));var moment=require('moment');var BPromise=require(_0x5011('0x3'));var Mustache=require('mustache');var util=require(_0x5011('0x4'));var path=require(_0x5011('0x5'));var sox=require('sox');var csv=require(_0x5011('0x6'));var ejs=require(_0x5011('0x7'));var fs=require('fs');var fs_extra=require(_0x5011('0x8'));var _=require(_0x5011('0x9'));var squel=require(_0x5011('0xa'));var crypto=require(_0x5011('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5011('0xc'));var toCsv=require(_0x5011('0x6'));var querystring=require(_0x5011('0xd'));var Papa=require(_0x5011('0xe'));var AWS=require(_0x5011('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x5011('0x10'));var authService=require(_0x5011('0x11'));var qs=require(_0x5011('0x12'));var as=require(_0x5011('0x13'));var hardwareService=require(_0x5011('0x14'));var logger=require('../../config/logger')(_0x5011('0x15'));var utils=require(_0x5011('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5011('0x17'));var db=require(_0x5011('0x18'))['db'];function respondWithStatusCode(_0x16482c,_0x2fcb13){_0x2fcb13=_0x2fcb13||0xcc;return function(_0x545abc){if(_0x545abc){return _0x16482c[_0x5011('0x19')](_0x2fcb13);}return _0x16482c['status'](_0x2fcb13)[_0x5011('0x1a')]();};}function respondWithResult(_0x7130cf,_0x56b57f){_0x56b57f=_0x56b57f||0xc8;return function(_0x2a13a7){if(_0x2a13a7){return _0x7130cf['status'](_0x56b57f)[_0x5011('0x1b')](_0x2a13a7);}};}function respondWithFilteredResult(_0x37ea42,_0x241e92){return function(_0x124aea){if(_0x124aea){var _0x5df1be=typeof _0x241e92[_0x5011('0x1c')]===_0x5011('0x1d')&&typeof _0x241e92[_0x5011('0x1e')]===_0x5011('0x1d');var _0x4ca8ca=_0x124aea[_0x5011('0x1f')];var _0x307b05=_0x5df1be?0x0:_0x241e92[_0x5011('0x1c')];var _0xc61762=_0x5df1be?_0x124aea['count']:_0x241e92[_0x5011('0x1c')]+_0x241e92[_0x5011('0x1e')];var _0x42115d;if(_0xc61762>=_0x4ca8ca){_0xc61762=_0x4ca8ca;_0x42115d=0xc8;}else{_0x42115d=0xce;}_0x37ea42[_0x5011('0x20')](_0x42115d);return _0x37ea42['set'](_0x5011('0x21'),_0x307b05+'-'+_0xc61762+'/'+_0x4ca8ca)[_0x5011('0x1b')](_0x124aea);}return null;};}function patchUpdates(_0x1f359e){return function(_0x1a578a){try{jsonpatch[_0x5011('0x22')](_0x1a578a,_0x1f359e,!![]);}catch(_0x58b913){return BPromise['reject'](_0x58b913);}return _0x1a578a['save']();};}function saveUpdates(_0xce3b79,_0xe0019){return function(_0x10d955){if(_0x10d955){return _0x10d955[_0x5011('0x23')](_0xce3b79)['then'](function(_0x2a34c8){return _0x2a34c8;});}return null;};}function removeEntity(_0x458146,_0x377bc9){return function(_0x13c344){if(_0x13c344){return _0x13c344['destroy']()[_0x5011('0x24')](function(){_0x458146['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7b0a,_0x1b3105){return function(_0x36ddf5){if(!_0x36ddf5){_0x4b7b0a[_0x5011('0x19')](0x194);}return _0x36ddf5;};}function handleError(_0xf09427,_0x2e7d3a){_0x2e7d3a=_0x2e7d3a||0x1f4;return function(_0x3cd7b0){logger[_0x5011('0x25')](_0x3cd7b0[_0x5011('0x26')]);if(_0x3cd7b0[_0x5011('0x27')]){delete _0x3cd7b0[_0x5011('0x27')];}_0xf09427[_0x5011('0x20')](_0x2e7d3a)[_0x5011('0x28')](_0x3cd7b0);};}exports[_0x5011('0x29')]=function(_0x1cd218,_0x2b930c){var _0x20e931={},_0x3c34f6={},_0x5a4cdf={'count':0x0,'rows':[]};var _0x586ef3=_['map'](db[_0x5011('0x2a')][_0x5011('0x2b')],function(_0x5c6883){return{'name':_0x5c6883[_0x5011('0x2c')],'type':_0x5c6883[_0x5011('0x2d')][_0x5011('0x2e')]};});_0x3c34f6['model']=_['differenceBy'](_[_0x5011('0x2f')](_0x586ef3,'name'),[_0x5011('0x30')]);_0x3c34f6[_0x5011('0x31')]=_[_0x5011('0x32')](_0x1cd218['query']);_0x3c34f6[_0x5011('0x33')]=_['intersection'](_0x3c34f6['model'],_0x3c34f6[_0x5011('0x31')]);_0x20e931['attributes']=_['intersection'](_0x3c34f6[_0x5011('0x34')],qs[_0x5011('0x35')](_0x1cd218[_0x5011('0x31')]['fields']));_0x20e931[_0x5011('0x36')]=_0x20e931[_0x5011('0x36')][_0x5011('0x37')]?_0x20e931[_0x5011('0x36')]:_0x3c34f6[_0x5011('0x34')];if(!_0x1cd218[_0x5011('0x31')][_0x5011('0x38')](_0x5011('0x39'))){_0x20e931[_0x5011('0x1e')]=qs['limit'](_0x1cd218[_0x5011('0x31')]['limit']);_0x20e931[_0x5011('0x1c')]=qs[_0x5011('0x1c')](_0x1cd218[_0x5011('0x31')][_0x5011('0x1c')]);}_0x20e931[_0x5011('0x3a')]=qs[_0x5011('0x3b')](_0x1cd218['query'][_0x5011('0x3b')]);_0x20e931[_0x5011('0x3c')]=qs[_0x5011('0x33')](_[_0x5011('0x3d')](_0x1cd218[_0x5011('0x31')],_0x3c34f6[_0x5011('0x33')]),_0x586ef3);if(_0x1cd218[_0x5011('0x31')]['filter']){_0x20e931[_0x5011('0x3c')]=_['merge'](_0x20e931[_0x5011('0x3c')],{'$or':_[_0x5011('0x2f')](_0x586ef3,function(_0x51065a){if(_0x51065a['type']!==_0x5011('0x3e')){var _0x24958d={};_0x24958d[_0x51065a[_0x5011('0x27')]]={'$like':'%'+_0x1cd218['query'][_0x5011('0x3f')]+'%'};return _0x24958d;}})});}_0x20e931=_[_0x5011('0x40')]({},_0x20e931,_0x1cd218['options']);var _0x213373={'where':_0x20e931['where']};return db['VoiceRecording']['count'](_0x213373)[_0x5011('0x24')](function(_0x319743){_0x5a4cdf[_0x5011('0x1f')]=_0x319743;if(_0x1cd218[_0x5011('0x31')][_0x5011('0x41')]){_0x20e931['include']=[{'all':!![]}];}return db[_0x5011('0x2a')][_0x5011('0x42')](_0x20e931);})[_0x5011('0x24')](function(_0x38e4ca){_0x5a4cdf['rows']=_0x38e4ca;return _0x5a4cdf;})[_0x5011('0x24')](respondWithFilteredResult(_0x2b930c,_0x20e931))[_0x5011('0x43')](handleError(_0x2b930c,null));};exports[_0x5011('0x44')]=function(_0x1775b2,_0x4ec11d){var _0xd3b72d={'raw':![],'where':{'id':_0x1775b2['params']['id']}},_0x10a05f={};_0x10a05f[_0x5011('0x34')]=_[_0x5011('0x32')](db[_0x5011('0x2a')][_0x5011('0x2b')]);_0x10a05f[_0x5011('0x31')]=_[_0x5011('0x32')](_0x1775b2[_0x5011('0x31')]);_0x10a05f[_0x5011('0x33')]=_[_0x5011('0x45')](_0x10a05f['model'],_0x10a05f[_0x5011('0x31')]);_0xd3b72d[_0x5011('0x36')]=_[_0x5011('0x45')](_0x10a05f[_0x5011('0x34')],qs['fields'](_0x1775b2['query'][_0x5011('0x35')]));_0xd3b72d[_0x5011('0x36')]=_0xd3b72d[_0x5011('0x36')][_0x5011('0x37')]?_0xd3b72d[_0x5011('0x36')]:_0x10a05f[_0x5011('0x34')];if(_0x1775b2['query']['includeAll']){_0xd3b72d[_0x5011('0x46')]=[{'all':!![]}];}_0xd3b72d=_[_0x5011('0x40')]({},_0xd3b72d,_0x1775b2[_0x5011('0x47')]);return db[_0x5011('0x2a')]['find'](_0xd3b72d)[_0x5011('0x24')](handleEntityNotFound(_0x4ec11d,null))['then'](respondWithResult(_0x4ec11d,null))['catch'](handleError(_0x4ec11d,null));};exports[_0x5011('0x48')]=function(_0x14cb15,_0x4ddce6){return db['VoiceRecording'][_0x5011('0x48')](_0x14cb15[_0x5011('0x49')],{})[_0x5011('0x24')](respondWithResult(_0x4ddce6,0xc9))['catch'](handleError(_0x4ddce6,null));};exports[_0x5011('0x23')]=function(_0x214333,_0xbd8b3f){if(_0x214333[_0x5011('0x49')]['id']){delete _0x214333[_0x5011('0x49')]['id'];}return db[_0x5011('0x2a')][_0x5011('0x4a')]({'where':{'id':_0x214333[_0x5011('0x4b')]['id']}})[_0x5011('0x24')](handleEntityNotFound(_0xbd8b3f,null))[_0x5011('0x24')](saveUpdates(_0x214333[_0x5011('0x49')],null))[_0x5011('0x24')](respondWithResult(_0xbd8b3f,null))[_0x5011('0x43')](handleError(_0xbd8b3f,null));};exports['describe']=function(_0x522a81,_0x14763b){return db['VoiceRecording'][_0x5011('0x4c')]()[_0x5011('0x24')](respondWithResult(_0x14763b,null))[_0x5011('0x43')](handleError(_0x14763b,null));};exports[_0x5011('0x4d')]=function(_0x39469b,_0x10387b,_0xd6b6dc){var _0x144b9c=require(_0x5011('0x4e'));var _0x78113d=![];var _0x2fefa9={};if(_0x39469b['query'][_0x5011('0x2d')]&&_0x39469b[_0x5011('0x31')][_0x5011('0x2d')]==='uniqueid'){_0x2fefa9[_0x5011('0x4f')]=_0x39469b[_0x5011('0x4b')]['id'];}else{_0x2fefa9['id']=_0x39469b['params']['id'];}return db[_0x5011('0x2a')]['find']({'where':_0x2fefa9,'attributes':['id',_0x5011('0x50')],'raw':!![]})[_0x5011('0x24')](handleEntityNotFound(_0x10387b,null))['then'](function(_0x24a892){if(_0x24a892){var _0xebb794=_0x24a892[_0x5011('0x50')];var _0x598e19=util[_0x5011('0x30')](_0x5011('0x51'),_0xebb794);if(fs[_0x5011('0x52')](_0x598e19)){_0x78113d=!![];return _0x144b9c[_0x5011('0x53')](_0x598e19,_0xebb794,config['secrets']['recording'])[_0x5011('0x24')](function(){return _0x24a892;});}return _0x24a892;}})['then'](function(_0x7f4d1e){if(_0x7f4d1e){var _0x2db339=_0x7f4d1e[_0x5011('0x50')];if(!fs[_0x5011('0x52')](_0x2db339)){throw new db[(_0x5011('0x54'))][(_0x5011('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x7f4d1e[_0x5011('0x56')]){return _0x10387b[_0x5011('0x4d')](_0x2db339,_0x7f4d1e['filename']+path[_0x5011('0x57')](_0x2db339),function(){if(_0x78113d){fs[_0x5011('0x58')](_0x2db339);}});}else{return _0x10387b[_0x5011('0x4d')](_0x2db339,function(_0xfb10e7){if(_0x78113d){fs[_0x5011('0x58')](_0x2db339);}});}}})[_0x5011('0x43')](function(_0x56bbd1){if(_0x56bbd1['message']==='VoiceRecording\x20not\x20found'){_0x10387b[_0x5011('0x20')](0x194)['send']('Not\x20found');}else{return handleError(_0x10387b,null);}});};exports[_0x5011('0x59')]=function(_0x5af92f,_0x72141d,_0x1aef27){var _0x2498cc=require(_0x5011('0x4e'));var _0x3dfb93=![];var _0x1d642e={'$and':[db['sequelize'][_0x5011('0x3c')](db['sequelize']['fn'](_0x5011('0x5a'),db['sequelize'][_0x5011('0x5b')](_0x5011('0x4f'))),_0x5af92f[_0x5011('0x31')]['token'])]};if(_0x5af92f['query'][_0x5011('0x2d')]&&_0x5af92f[_0x5011('0x31')][_0x5011('0x2d')]===_0x5011('0x4f')){_0x1d642e[_0x5011('0x5c')][_0x5011('0x5d')]({'uniqueid':_0x5af92f[_0x5011('0x4b')]['id']});}else{_0x1d642e['$and'][_0x5011('0x5d')]({'id':_0x5af92f[_0x5011('0x4b')]['id']});}return db['VoiceRecording'][_0x5011('0x4a')]({'where':_0x1d642e,'attributes':['id',_0x5011('0x50')],'raw':!![]})[_0x5011('0x24')](handleEntityNotFound(_0x72141d,null))[_0x5011('0x24')](function(_0x16302f){if(_0x16302f){var _0x22cd79=util[_0x5011('0x30')]('%s.cypher',_0x16302f['value']);if(fs[_0x5011('0x52')](_0x22cd79)){_0x3dfb93=!![];return _0x2498cc['decryptFile'](_0x22cd79,_0x16302f[_0x5011('0x50')],config[_0x5011('0x5e')][_0x5011('0x5f')])['then'](function(){return _0x16302f;});}return _0x16302f;}})['then'](function(_0x78a557){if(_0x78a557){if(!fs[_0x5011('0x52')](_0x78a557[_0x5011('0x50')])){throw new db[(_0x5011('0x54'))]['ValidationError'](_0x5011('0x60'));}if(_0x78a557[_0x5011('0x56')]){return _0x72141d[_0x5011('0x4d')](_0x78a557[_0x5011('0x50')],_0x78a557[_0x5011('0x56')]+path[_0x5011('0x57')](_0x78a557[_0x5011('0x50')]),function(){if(_0x3dfb93){fs['unlink'](_0x78a557[_0x5011('0x50')]);}});}else{return _0x72141d[_0x5011('0x4d')](_0x78a557[_0x5011('0x50')],function(_0x593082){if(_0x3dfb93){fs['unlink'](_0x78a557[_0x5011('0x50')]);}});}}})[_0x5011('0x43')](handleError(_0x72141d,null));};exports['destroy']=function(_0x47457f,_0x507558){return db[_0x5011('0x2a')][_0x5011('0x4a')]({'where':{'id':_0x47457f[_0x5011('0x4b')]['id']}})[_0x5011('0x24')](function(_0x4dc173){if(_[_0x5011('0x61')](_0x4dc173)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4dc173;})[_0x5011('0x24')](function(_0x20a049){var _0x37d346=_0x20a049[_0x5011('0x50')];logger[_0x5011('0x62')](_0x5011('0x63'),_0x37d346);if(!_[_0x5011('0x61')](_0x20a049['value'])&&fs[_0x5011('0x52')](_0x37d346)){logger[_0x5011('0x62')]('File:\x20\x22'+_0x37d346+_0x5011('0x64'));fs['unlinkSync'](_0x37d346);}_0x37d346=_0x37d346+_0x5011('0x65');if(!_[_0x5011('0x61')](_0x20a049['value'])&&fs[_0x5011('0x52')](_0x37d346)){logger[_0x5011('0x62')](_0x5011('0x66')+_0x37d346+_0x5011('0x64'));fs[_0x5011('0x67')](_0x37d346);}return _0x20a049;})[_0x5011('0x24')](function(_0x175fa2){if(!_0x175fa2)throw new InternalError();return _0x175fa2[_0x5011('0x68')]();})[_0x5011('0x24')](function(){_0x507558[_0x5011('0x20')](0xcc)['end']();})[_0x5011('0x43')](handleError(_0x507558,null));};function getBucketslist(_0x11d86e,_0x518075,_0x5a230f){return new Promise(function(_0xf92202,_0x505e7d){var _0x19b169=new AWS['S3']({'accessKeyId':_0x518075,'secretAccessKey':_0x11d86e,'region':_0x5a230f});_0x19b169[_0x5011('0x69')]({},function(_0x4f482f,_0x4b3d48){if(_0x4f482f){return _0x505e7d(_0x4f482f);}else{return _0xf92202(_0x4b3d48);}});});}function createBucket(_0x1e20f9,_0x231b89,_0x2b1f27,_0x4561f8){return new Promise(function(_0x2dfa37,_0x3e4c3f){var _0x3842e9=new AWS['S3']({'accessKeyId':_0x231b89,'secretAccessKey':_0x1e20f9,'region':_0x2b1f27});_0x3842e9[_0x5011('0x6a')]({'Bucket':_0x4561f8},function(_0x5e5ecf,_0x14dddb){if(_0x5e5ecf){return _0x3e4c3f(_0x5e5ecf);}else{return _0x2dfa37(_0x14dddb);}});});}function uploadFile(_0x2fddb3,_0x3065f2,_0x1e838a,_0x436b54,_0x49b045,_0x3125c0){return new Promise(function(_0x579eff,_0x1bff48){var _0x16a0f7=new AWS['S3']({'accessKeyId':_0x3065f2,'secretAccessKey':_0x2fddb3,'region':_0x1e838a});_0x16a0f7[_0x5011('0x6b')]({'Bucket':_0x436b54,'Key':_0x49b045,'Body':_0x3125c0},function(_0x323870,_0x313ff7){if(_0x323870){return _0x1bff48(_0x323870);}else{return _0x579eff(_0x313ff7);}});});}function startTranscribe(_0x12b712,_0x54eb8c,_0x540a5c,_0x43896c,_0xd65f8b,_0xa4a041){return new Promise(function(_0xba775c,_0x4f39f5){var _0x324940=new AWS[(_0x5011('0x6c'))]({'accessKeyId':_0x54eb8c,'secretAccessKey':_0x12b712,'region':_0x540a5c});_0x324940[_0x5011('0x6d')]({'TranscriptionJobName':_0x43896c,'LanguageCode':_0xd65f8b,'Media':{'MediaFileUri':_0xa4a041}},function(_0x2d7e99,_0x5f0a99){if(_0x2d7e99){return _0x4f39f5(_0x2d7e99);}else{return _0xba775c(_0x5f0a99);}});});}function transcribe(_0x3aa10a,_0x357d96,_0x1c7e43,_0x32eed6,_0x3490c7,_0xf47f97,_0x25823){return new Promise(function(_0x3bfaa9,_0x45440c){var _0x2bf0b9={};logger[_0x5011('0x62')](util[_0x5011('0x30')](_0x5011('0x6e'),_0x3aa10a,_0x3490c7));return uploadFile(_0x357d96,_0x1c7e43,_0x32eed6,_0x3490c7,path['basename'](_0xf47f97),fs[_0x5011('0x6f')](_0xf47f97))[_0x5011('0x24')](function(_0xde9ead){logger[_0x5011('0x62')](util[_0x5011('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3aa10a,_0x3490c7,_0xde9ead[_0x5011('0x70')]));_0x2bf0b9[_0x5011('0x71')]=_0xde9ead['Bucket'];_0x2bf0b9['location']=_0xde9ead[_0x5011('0x70')];logger[_0x5011('0x62')](util[_0x5011('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3aa10a));return startTranscribe(_0x357d96,_0x1c7e43,_0x32eed6,uuidv4(),_0x25823,_0xde9ead['Location']);})[_0x5011('0x24')](function(_0x5c0651){logger[_0x5011('0x62')](util[_0x5011('0x30')](_0x5011('0x72'),_0x3aa10a,_0x5c0651[_0x5011('0x73')][_0x5011('0x74')]));_0x2bf0b9['transcribeName']=_0x5c0651[_0x5011('0x73')][_0x5011('0x74')];_0x2bf0b9[_0x5011('0x75')]=_0x5c0651[_0x5011('0x73')][_0x5011('0x76')];return _0x3bfaa9(_0x2bf0b9);})['catch'](function(_0x5f2e73){return _0x45440c(_0x5f2e73);});});}exports[_0x5011('0x77')]=function(_0xb860e6,_0x2b2ec7,_0x4eaa51){var _0x15de74;var _0x4b1ca8;var _0x56a75f;var _0x5a5712=require(_0x5011('0x4e'));return db[_0x5011('0x2a')][_0x5011('0x78')]({'where':{'id':_0xb860e6[_0x5011('0x4b')]['id']}})[_0x5011('0x24')](function(_0x355bb2){if(_0x355bb2){var _0x161244=util['format']('%s.cypher',_0x355bb2[_0x5011('0x50')]);if(fs[_0x5011('0x52')](_0x161244)){cypher=!![];return _0x5a5712['decryptFile'](_0x161244,_0x355bb2[_0x5011('0x50')],config[_0x5011('0x5e')][_0x5011('0x5f')])[_0x5011('0x24')](function(){return _0x355bb2;});}return _0x355bb2;}})[_0x5011('0x24')](function(_0x3f1586){if(!_0x3f1586){throw new db[(_0x5011('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x4b1ca8=_0x3f1586;return db[_0x5011('0x79')][_0x5011('0x78')]({'where':{'id':0x1}});})[_0x5011('0x24')](handleEntityNotFound(_0x2b2ec7,null))[_0x5011('0x24')](function(_0x19347a){if(_0x19347a){_0x15de74=_0x19347a;if(!_0x15de74['transcribe']||!_0x15de74['transcribeAccountId']||!_0x15de74['transcribeRegion']||!_0x15de74[_0x5011('0x7a')]||!_0x15de74[_0x5011('0x71')]){throw new db[(_0x5011('0x54'))][(_0x5011('0x55'))](_0x5011('0x7b'));}if(_0xb860e6[_0x5011('0x49')]['runSentiment']&&(!_0x15de74['sentiment']||!_0x15de74[_0x5011('0x7c')]||!_0x15de74['sentimentRegion']||!_0x15de74[_0x5011('0x7a')]||!_0x15de74['bucket'])){throw new db['Sequelize'][(_0x5011('0x55'))](_0x5011('0x7d'));}return db['CloudProvider']['findOne']({'where':{'id':_0x15de74[_0x5011('0x7e')]}});}})['then'](function(_0x2f35c6){if(!_0x2f35c6){throw new db['Sequelize'][(_0x5011('0x55'))](_0x5011('0x7f'));}if(!_0x2f35c6[_0x5011('0x80')]||!_0x2f35c6[_0x5011('0x81')]){throw new db[(_0x5011('0x54'))][(_0x5011('0x55'))](_0x5011('0x82'));}_0x56a75f=_0x2f35c6;return getBucketslist(_0x56a75f['data1'],_0x56a75f[_0x5011('0x81')],_0x15de74[_0x5011('0x83')]);})['then'](function(_0x348208){if(_0x348208&&_0x348208[_0x5011('0x84')]){var _0x284ad9=_[_0x5011('0x4a')](_0x348208[_0x5011('0x84')],function(_0x3aed55){return _0x3aed55[_0x5011('0x85')]===_0x15de74[_0x5011('0x71')];});if(!_0x284ad9){logger[_0x5011('0x62')](util[_0x5011('0x30')](_0x5011('0x86'),_0xb860e6['params']['id'],_0x15de74[_0x5011('0x71')]));return createBucket(_0x56a75f['data1'],_0x56a75f[_0x5011('0x81')],_0x15de74[_0x5011('0x83')],_0x15de74[_0x5011('0x71')]);}logger['info'](util[_0x5011('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xb860e6['params']['id'],_0x15de74['bucket']));return;}})[_0x5011('0x24')](function(_0x2624a5){if(_0x4b1ca8['transcribeStatus']===_0x5011('0x87')){return transcribe(_0xb860e6['params']['id'],_0x56a75f['data1'],_0x56a75f[_0x5011('0x81')],_0x15de74['transcribeRegion'],_0x15de74['bucket'],_0x4b1ca8[_0x5011('0x50')],_0x15de74['language']);}else{logger['info'](util[_0x5011('0x30')](_0x5011('0x88'),_0xb860e6[_0x5011('0x4b')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x5011('0x24')](function(_0x3f654d){if(_0x3f654d){_0x3f654d[_0x5011('0x89')]=_0xb860e6[_0x5011('0x49')][_0x5011('0x8a')];return _0x4b1ca8[_0x5011('0x8b')](_0x3f654d);}})[_0x5011('0x24')](respondWithResult(_0x2b2ec7,null))[_0x5011('0x43')](handleError(_0x2b2ec7,null));};function writeFile(_0x4568e0,_0x3dffbe){return new Promise(function(_0x5ef5d4,_0x4da527){fs[_0x5011('0x8c')](_0x3dffbe,_0x4568e0,function(_0x558bc1,_0x34a63d){if(_0x558bc1){return _0x4da527(_0x558bc1);}else{return _0x5ef5d4(_0x34a63d);}});});}exports['downloadTranscribe']=function(_0x5baf39,_0x384bfc,_0x3afe2a){return db[_0x5011('0x2a')][_0x5011('0x78')]({'where':{'id':_0x5baf39['params']['id']}})[_0x5011('0x24')](handleEntityNotFound(_0x384bfc))[_0x5011('0x24')](function(_0x4d0988){if(_0x4d0988&&_0x4d0988['fileText']){var _0x33b809=_0x4d0988[_0x5011('0x8d')];var _0x5a8a36=config['root']+_0x5011('0x8e')+_0x4d0988['id']+'.txt';if(fs[_0x5011('0x52')](_0x5a8a36)){return _0x5a8a36;}return writeFile(_0x33b809,_0x5a8a36)[_0x5011('0x24')](function(){return _0x5a8a36;});}else{throw new db[(_0x5011('0x54'))][(_0x5011('0x55'))]('Transcript\x20not\x20available');}})[_0x5011('0x24')](function(_0x4cca63){return _0x384bfc[_0x5011('0x4d')](_0x4cca63);})[_0x5011('0x43')](handleError(_0x384bfc));}; \ No newline at end of file +var _0xfa26=['options','count','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','$and','push','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map'];(function(_0x220b18,_0x32fdd7){var _0x504702=function(_0x5f5c39){while(--_0x5f5c39){_0x220b18['push'](_0x220b18['shift']());}};_0x504702(++_0x32fdd7);}(_0xfa26,0x187));var _0x6fa2=function(_0x51da18,_0x31f88b){_0x51da18=_0x51da18-0x0;var _0x214318=_0xfa26[_0x51da18];return _0x214318;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fa2('0x0'));var zipdir=require(_0x6fa2('0x1'));var jsonpatch=require(_0x6fa2('0x2'));var rp=require('request-promise');var moment=require(_0x6fa2('0x3'));var BPromise=require(_0x6fa2('0x4'));var Mustache=require(_0x6fa2('0x5'));var util=require(_0x6fa2('0x6'));var path=require(_0x6fa2('0x7'));var sox=require(_0x6fa2('0x8'));var csv=require(_0x6fa2('0x9'));var ejs=require(_0x6fa2('0xa'));var fs=require('fs');var fs_extra=require(_0x6fa2('0xb'));var _=require('lodash');var squel=require(_0x6fa2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fa2('0xd'));var toCsv=require(_0x6fa2('0x9'));var querystring=require(_0x6fa2('0xe'));var Papa=require(_0x6fa2('0xf'));var AWS=require(_0x6fa2('0x10'));var uuidv4=require(_0x6fa2('0x11'));var Redis=require(_0x6fa2('0x12'));var authService=require(_0x6fa2('0x13'));var qs=require(_0x6fa2('0x14'));var as=require(_0x6fa2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fa2('0x16'))(_0x6fa2('0x17'));var utils=require(_0x6fa2('0x18'));var config=require(_0x6fa2('0x19'));var licenseUtil=require(_0x6fa2('0x1a'));var db=require(_0x6fa2('0x1b'))['db'];function respondWithStatusCode(_0xf0538c,_0x4b5e99){_0x4b5e99=_0x4b5e99||0xcc;return function(_0x435845){if(_0x435845){return _0xf0538c[_0x6fa2('0x1c')](_0x4b5e99);}return _0xf0538c[_0x6fa2('0x1d')](_0x4b5e99)['end']();};}function respondWithResult(_0xa34159,_0x3b6d50){_0x3b6d50=_0x3b6d50||0xc8;return function(_0x389ae1){if(_0x389ae1){return _0xa34159[_0x6fa2('0x1d')](_0x3b6d50)[_0x6fa2('0x1e')](_0x389ae1);}};}function respondWithFilteredResult(_0x5f4a65,_0x5bff0a){return function(_0x4cb96b){if(_0x4cb96b){var _0x1e05ba=typeof _0x5bff0a[_0x6fa2('0x1f')]===_0x6fa2('0x20')&&typeof _0x5bff0a['limit']===_0x6fa2('0x20');var _0x3ef3e4=_0x4cb96b['count'];var _0xc0f49a=_0x1e05ba?0x0:_0x5bff0a[_0x6fa2('0x1f')];var _0x1efe52=_0x1e05ba?_0x4cb96b['count']:_0x5bff0a[_0x6fa2('0x1f')]+_0x5bff0a[_0x6fa2('0x21')];var _0x437a2f;if(_0x1efe52>=_0x3ef3e4){_0x1efe52=_0x3ef3e4;_0x437a2f=0xc8;}else{_0x437a2f=0xce;}_0x5f4a65[_0x6fa2('0x1d')](_0x437a2f);return _0x5f4a65['set'](_0x6fa2('0x22'),_0xc0f49a+'-'+_0x1efe52+'/'+_0x3ef3e4)[_0x6fa2('0x1e')](_0x4cb96b);}return null;};}function patchUpdates(_0x540808){return function(_0x2330f4){try{jsonpatch[_0x6fa2('0x23')](_0x2330f4,_0x540808,!![]);}catch(_0x5dc066){return BPromise[_0x6fa2('0x24')](_0x5dc066);}return _0x2330f4['save']();};}function saveUpdates(_0x362a65,_0x499d28){return function(_0x1bcd23){if(_0x1bcd23){return _0x1bcd23[_0x6fa2('0x25')](_0x362a65)['then'](function(_0x43f719){return _0x43f719;});}return null;};}function removeEntity(_0x75bc42,_0x5abe42){return function(_0x52b633){if(_0x52b633){return _0x52b633[_0x6fa2('0x26')]()[_0x6fa2('0x27')](function(){_0x75bc42[_0x6fa2('0x1d')](0xcc)[_0x6fa2('0x28')]();});}};}function handleEntityNotFound(_0x2ae3e3,_0x2522c6){return function(_0x4c7f31){if(!_0x4c7f31){_0x2ae3e3[_0x6fa2('0x1c')](0x194);}return _0x4c7f31;};}function handleError(_0x125769,_0x54411d){_0x54411d=_0x54411d||0x1f4;return function(_0x1538bc){logger[_0x6fa2('0x29')](_0x1538bc[_0x6fa2('0x2a')]);if(_0x1538bc[_0x6fa2('0x2b')]){delete _0x1538bc['name'];}_0x125769[_0x6fa2('0x1d')](_0x54411d)[_0x6fa2('0x2c')](_0x1538bc);};}exports['index']=function(_0x37205e,_0x54d582){var _0x5c3afc={},_0x5bc1f7={},_0x4a13d7={'count':0x0,'rows':[]};var _0x450f4f=_['map'](db[_0x6fa2('0x2d')][_0x6fa2('0x2e')],function(_0x3111a7){return{'name':_0x3111a7[_0x6fa2('0x2f')],'type':_0x3111a7[_0x6fa2('0x30')][_0x6fa2('0x31')]};});_0x5bc1f7[_0x6fa2('0x32')]=_[_0x6fa2('0x33')](_['map'](_0x450f4f,_0x6fa2('0x2b')),[_0x6fa2('0x34')]);_0x5bc1f7['query']=_['keys'](_0x37205e['query']);_0x5bc1f7[_0x6fa2('0x35')]=_[_0x6fa2('0x36')](_0x5bc1f7[_0x6fa2('0x32')],_0x5bc1f7[_0x6fa2('0x37')]);_0x5c3afc[_0x6fa2('0x38')]=_[_0x6fa2('0x36')](_0x5bc1f7['model'],qs[_0x6fa2('0x39')](_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x39')]));_0x5c3afc[_0x6fa2('0x38')]=_0x5c3afc['attributes'][_0x6fa2('0x3a')]?_0x5c3afc[_0x6fa2('0x38')]:_0x5bc1f7[_0x6fa2('0x32')];if(!_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x3b')](_0x6fa2('0x3c'))){_0x5c3afc[_0x6fa2('0x21')]=qs[_0x6fa2('0x21')](_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x21')]);_0x5c3afc[_0x6fa2('0x1f')]=qs['offset'](_0x37205e['query'][_0x6fa2('0x1f')]);}_0x5c3afc[_0x6fa2('0x3d')]=qs[_0x6fa2('0x3e')](_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x3e')]);_0x5c3afc['where']=qs[_0x6fa2('0x35')](_[_0x6fa2('0x3f')](_0x37205e[_0x6fa2('0x37')],_0x5bc1f7[_0x6fa2('0x35')]),_0x450f4f);if(_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x40')]){_0x5c3afc[_0x6fa2('0x41')]=_[_0x6fa2('0x42')](_0x5c3afc[_0x6fa2('0x41')],{'$or':_[_0x6fa2('0x43')](_0x450f4f,function(_0x506b3c){if(_0x506b3c['type']!=='VIRTUAL'){var _0x2e85b7={};_0x2e85b7[_0x506b3c[_0x6fa2('0x2b')]]={'$like':'%'+_0x37205e[_0x6fa2('0x37')][_0x6fa2('0x40')]+'%'};return _0x2e85b7;}})});}_0x5c3afc=_['merge']({},_0x5c3afc,_0x37205e[_0x6fa2('0x44')]);var _0x17e8af={'where':_0x5c3afc[_0x6fa2('0x41')]};return db[_0x6fa2('0x2d')][_0x6fa2('0x45')](_0x17e8af)[_0x6fa2('0x27')](function(_0x59d3a0){_0x4a13d7[_0x6fa2('0x45')]=_0x59d3a0;if(_0x37205e['query']['includeAll']){_0x5c3afc[_0x6fa2('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6fa2('0x47')](_0x5c3afc);})[_0x6fa2('0x27')](function(_0x17d27a){_0x4a13d7[_0x6fa2('0x48')]=_0x17d27a;return _0x4a13d7;})['then'](respondWithFilteredResult(_0x54d582,_0x5c3afc))[_0x6fa2('0x49')](handleError(_0x54d582,null));};exports[_0x6fa2('0x4a')]=function(_0x41675f,_0x161d9c){var _0x52d21e={'raw':![],'where':{'id':_0x41675f[_0x6fa2('0x4b')]['id']}},_0x36003f={};_0x36003f[_0x6fa2('0x32')]=_['keys'](db[_0x6fa2('0x2d')]['rawAttributes']);_0x36003f['query']=_[_0x6fa2('0x4c')](_0x41675f[_0x6fa2('0x37')]);_0x36003f['filters']=_['intersection'](_0x36003f[_0x6fa2('0x32')],_0x36003f[_0x6fa2('0x37')]);_0x52d21e[_0x6fa2('0x38')]=_[_0x6fa2('0x36')](_0x36003f[_0x6fa2('0x32')],qs[_0x6fa2('0x39')](_0x41675f[_0x6fa2('0x37')][_0x6fa2('0x39')]));_0x52d21e[_0x6fa2('0x38')]=_0x52d21e[_0x6fa2('0x38')]['length']?_0x52d21e['attributes']:_0x36003f[_0x6fa2('0x32')];if(_0x41675f['query'][_0x6fa2('0x4d')]){_0x52d21e[_0x6fa2('0x46')]=[{'all':!![]}];}_0x52d21e=_[_0x6fa2('0x42')]({},_0x52d21e,_0x41675f[_0x6fa2('0x44')]);return db[_0x6fa2('0x2d')]['find'](_0x52d21e)[_0x6fa2('0x27')](handleEntityNotFound(_0x161d9c,null))[_0x6fa2('0x27')](respondWithResult(_0x161d9c,null))[_0x6fa2('0x49')](handleError(_0x161d9c,null));};exports[_0x6fa2('0x4e')]=function(_0x143140,_0xd4bfd1){return db['VoiceRecording'][_0x6fa2('0x4e')](_0x143140['body'],{})['then'](respondWithResult(_0xd4bfd1,0xc9))['catch'](handleError(_0xd4bfd1,null));};exports[_0x6fa2('0x25')]=function(_0x555466,_0x3b6717){if(_0x555466[_0x6fa2('0x4f')]['id']){delete _0x555466[_0x6fa2('0x4f')]['id'];}return db[_0x6fa2('0x2d')][_0x6fa2('0x50')]({'where':{'id':_0x555466[_0x6fa2('0x4b')]['id']}})[_0x6fa2('0x27')](handleEntityNotFound(_0x3b6717,null))[_0x6fa2('0x27')](saveUpdates(_0x555466[_0x6fa2('0x4f')],null))['then'](respondWithResult(_0x3b6717,null))[_0x6fa2('0x49')](handleError(_0x3b6717,null));};exports[_0x6fa2('0x51')]=function(_0x45cd74,_0xdd5d76){return db[_0x6fa2('0x2d')][_0x6fa2('0x51')]()['then'](respondWithResult(_0xdd5d76,null))[_0x6fa2('0x49')](handleError(_0xdd5d76,null));};exports[_0x6fa2('0x52')]=function(_0x161f45,_0x1e1a95,_0x205318){var _0x331cd0=require(_0x6fa2('0x53'));var _0x58699e=![];var _0x1b44aa={};if(_0x161f45[_0x6fa2('0x37')]['type']&&_0x161f45['query']['type']==='uniqueid'){_0x1b44aa[_0x6fa2('0x54')]=_0x161f45[_0x6fa2('0x4b')]['id'];}else{_0x1b44aa['id']=_0x161f45[_0x6fa2('0x4b')]['id'];}return db[_0x6fa2('0x2d')][_0x6fa2('0x50')]({'where':_0x1b44aa,'attributes':['id',_0x6fa2('0x55')],'raw':!![]})[_0x6fa2('0x27')](handleEntityNotFound(_0x1e1a95,null))['then'](function(_0x552c20){if(_0x552c20){var _0x355c5e=_0x552c20[_0x6fa2('0x55')];var _0x5955fc=util[_0x6fa2('0x34')](_0x6fa2('0x56'),_0x355c5e);if(fs[_0x6fa2('0x57')](_0x5955fc)){_0x58699e=!![];return _0x331cd0[_0x6fa2('0x58')](_0x5955fc,_0x355c5e,config[_0x6fa2('0x59')][_0x6fa2('0x5a')])[_0x6fa2('0x27')](function(){return _0x552c20;});}return _0x552c20;}})[_0x6fa2('0x27')](function(_0x38cab2){if(_0x38cab2){var _0x205a92=_0x38cab2['value'];if(!fs[_0x6fa2('0x57')](_0x205a92)){throw new db[(_0x6fa2('0x5b'))][(_0x6fa2('0x5c'))](_0x6fa2('0x5d'));}if(_0x38cab2[_0x6fa2('0x5e')]){return _0x1e1a95['download'](_0x205a92,_0x38cab2[_0x6fa2('0x5e')]+path[_0x6fa2('0x5f')](_0x205a92),function(){if(_0x58699e){fs[_0x6fa2('0x60')](_0x205a92);}});}else{return _0x1e1a95['download'](_0x205a92,function(_0x1adf1a){if(_0x58699e){fs[_0x6fa2('0x60')](_0x205a92);}});}}})[_0x6fa2('0x49')](function(_0x45881a){if(_0x45881a[_0x6fa2('0x61')]===_0x6fa2('0x5d')){_0x1e1a95['status'](0x194)[_0x6fa2('0x2c')]('Not\x20found');}else{return handleError(_0x1e1a95,null);}});};exports[_0x6fa2('0x62')]=function(_0x41d821,_0x24ab3b,_0xc47748){var _0x5e33b3=require(_0x6fa2('0x53'));var _0x515506=![];var _0x330ae5={'$and':[db[_0x6fa2('0x63')]['where'](db[_0x6fa2('0x63')]['fn'](_0x6fa2('0x64'),db['sequelize'][_0x6fa2('0x65')]('uniqueid')),_0x41d821[_0x6fa2('0x37')]['token'])]};if(_0x41d821[_0x6fa2('0x37')][_0x6fa2('0x30')]&&_0x41d821['query'][_0x6fa2('0x30')]===_0x6fa2('0x54')){_0x330ae5[_0x6fa2('0x66')]['push']({'uniqueid':_0x41d821['params']['id']});}else{_0x330ae5[_0x6fa2('0x66')][_0x6fa2('0x67')]({'id':_0x41d821[_0x6fa2('0x4b')]['id']});}return db[_0x6fa2('0x2d')][_0x6fa2('0x50')]({'where':_0x330ae5,'attributes':['id',_0x6fa2('0x55')],'raw':!![]})[_0x6fa2('0x27')](handleEntityNotFound(_0x24ab3b,null))[_0x6fa2('0x27')](function(_0x28daf4){if(_0x28daf4){var _0x31a4c9=util[_0x6fa2('0x34')](_0x6fa2('0x56'),_0x28daf4[_0x6fa2('0x55')]);if(fs[_0x6fa2('0x57')](_0x31a4c9)){_0x515506=!![];return _0x5e33b3[_0x6fa2('0x58')](_0x31a4c9,_0x28daf4['value'],config[_0x6fa2('0x59')][_0x6fa2('0x5a')])[_0x6fa2('0x27')](function(){return _0x28daf4;});}return _0x28daf4;}})['then'](function(_0x1e1656){if(_0x1e1656){if(!fs[_0x6fa2('0x57')](_0x1e1656[_0x6fa2('0x55')])){throw new db['Sequelize'][(_0x6fa2('0x5c'))](_0x6fa2('0x5d'));}if(_0x1e1656[_0x6fa2('0x5e')]){return _0x24ab3b[_0x6fa2('0x52')](_0x1e1656[_0x6fa2('0x55')],_0x1e1656[_0x6fa2('0x5e')]+path[_0x6fa2('0x5f')](_0x1e1656[_0x6fa2('0x55')]),function(){if(_0x515506){fs[_0x6fa2('0x60')](_0x1e1656['value']);}});}else{return _0x24ab3b[_0x6fa2('0x52')](_0x1e1656['value'],function(_0x4e2a69){if(_0x515506){fs[_0x6fa2('0x60')](_0x1e1656[_0x6fa2('0x55')]);}});}}})['catch'](handleError(_0x24ab3b,null));};exports[_0x6fa2('0x26')]=function(_0x5bd3b1,_0xacfa4a){return db[_0x6fa2('0x2d')]['find']({'where':{'id':_0x5bd3b1[_0x6fa2('0x4b')]['id']}})['then'](function(_0x54b64b){if(_[_0x6fa2('0x68')](_0x54b64b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x54b64b;})[_0x6fa2('0x27')](function(_0x4533e5){var _0x389c3a=_0x4533e5[_0x6fa2('0x55')];logger['info'](_0x6fa2('0x69'),_0x389c3a);if(!_[_0x6fa2('0x68')](_0x4533e5['value'])&&fs[_0x6fa2('0x57')](_0x389c3a)){logger[_0x6fa2('0x6a')](_0x6fa2('0x6b')+_0x389c3a+_0x6fa2('0x6c'));fs[_0x6fa2('0x6d')](_0x389c3a);}_0x389c3a=_0x389c3a+'.cypher';if(!_[_0x6fa2('0x68')](_0x4533e5[_0x6fa2('0x55')])&&fs[_0x6fa2('0x57')](_0x389c3a)){logger[_0x6fa2('0x6a')]('File:\x20\x22'+_0x389c3a+_0x6fa2('0x6c'));fs[_0x6fa2('0x6d')](_0x389c3a);}return _0x4533e5;})[_0x6fa2('0x27')](function(_0x14269d){if(!_0x14269d)throw new InternalError();return _0x14269d[_0x6fa2('0x26')]();})[_0x6fa2('0x27')](function(){_0xacfa4a['status'](0xcc)['end']();})[_0x6fa2('0x49')](handleError(_0xacfa4a,null));};function getBucketslist(_0x14c2c4,_0x4e1368,_0x408595){return new Promise(function(_0x995101,_0x4b2435){var _0x3db092=new AWS['S3']({'accessKeyId':_0x4e1368,'secretAccessKey':_0x14c2c4,'region':_0x408595});_0x3db092['listBuckets']({},function(_0x5d67d7,_0x5e1ecb){if(_0x5d67d7){return _0x4b2435(_0x5d67d7);}else{return _0x995101(_0x5e1ecb);}});});}function createBucket(_0x4d553c,_0x11b48c,_0x4fc9ce,_0x75bd49){return new Promise(function(_0x146c70,_0x6c435e){var _0x504c33=new AWS['S3']({'accessKeyId':_0x11b48c,'secretAccessKey':_0x4d553c,'region':_0x4fc9ce});_0x504c33[_0x6fa2('0x6e')]({'Bucket':_0x75bd49},function(_0x1a8f64,_0x25d842){if(_0x1a8f64){return _0x6c435e(_0x1a8f64);}else{return _0x146c70(_0x25d842);}});});}function uploadFile(_0x2c8478,_0x98fdd4,_0x359d2b,_0x4c38b4,_0x451fa8,_0xd9d8b2){return new Promise(function(_0x2ba09b,_0x146636){var _0x2d220=new AWS['S3']({'accessKeyId':_0x98fdd4,'secretAccessKey':_0x2c8478,'region':_0x359d2b});_0x2d220[_0x6fa2('0x6f')]({'Bucket':_0x4c38b4,'Key':_0x451fa8,'Body':_0xd9d8b2},function(_0x216100,_0x5f50d8){if(_0x216100){return _0x146636(_0x216100);}else{return _0x2ba09b(_0x5f50d8);}});});}function startTranscribe(_0x2be21a,_0x5ddf98,_0x2763d4,_0x2926f7,_0x294c87,_0x4ffa47){return new Promise(function(_0x283ed5,_0x5596e6){var _0x6ebbc3=new AWS[(_0x6fa2('0x70'))]({'accessKeyId':_0x5ddf98,'secretAccessKey':_0x2be21a,'region':_0x2763d4});_0x6ebbc3[_0x6fa2('0x71')]({'TranscriptionJobName':_0x2926f7,'LanguageCode':_0x294c87,'Media':{'MediaFileUri':_0x4ffa47}},function(_0x273c47,_0x4c7856){if(_0x273c47){return _0x5596e6(_0x273c47);}else{return _0x283ed5(_0x4c7856);}});});}function transcribe(_0x4d0b5e,_0x258ea7,_0xdbf208,_0x5ceff3,_0x1e84cf,_0x328522,_0x1a09a9){return new Promise(function(_0x22097d,_0x26ef39){var _0x454abf={};logger[_0x6fa2('0x6a')](util['format'](_0x6fa2('0x72'),_0x4d0b5e,_0x1e84cf));return uploadFile(_0x258ea7,_0xdbf208,_0x5ceff3,_0x1e84cf,path[_0x6fa2('0x73')](_0x328522),fs[_0x6fa2('0x74')](_0x328522))['then'](function(_0x1e23f5){logger['info'](util[_0x6fa2('0x34')](_0x6fa2('0x75'),_0x4d0b5e,_0x1e84cf,_0x1e23f5[_0x6fa2('0x76')]));_0x454abf[_0x6fa2('0x77')]=_0x1e23f5['Bucket'];_0x454abf[_0x6fa2('0x78')]=_0x1e23f5['Location'];logger[_0x6fa2('0x6a')](util[_0x6fa2('0x34')](_0x6fa2('0x79'),_0x4d0b5e));return startTranscribe(_0x258ea7,_0xdbf208,_0x5ceff3,uuidv4(),_0x1a09a9,_0x1e23f5[_0x6fa2('0x76')]);})[_0x6fa2('0x27')](function(_0x1307aa){logger[_0x6fa2('0x6a')](util[_0x6fa2('0x34')](_0x6fa2('0x7a'),_0x4d0b5e,_0x1307aa[_0x6fa2('0x7b')]['TranscriptionJobName']));_0x454abf['transcribeName']=_0x1307aa[_0x6fa2('0x7b')][_0x6fa2('0x7c')];_0x454abf[_0x6fa2('0x7d')]=_0x1307aa[_0x6fa2('0x7b')][_0x6fa2('0x7e')];return _0x22097d(_0x454abf);})['catch'](function(_0x4e2bdb){return _0x26ef39(_0x4e2bdb);});});}exports['runTranscribe']=function(_0x270272,_0x3cdfcf,_0xc965f){var _0x3e0adf;var _0x40ff5e;var _0xebf14a;var _0x4d2976=require('../../components/encryptor');return db[_0x6fa2('0x2d')][_0x6fa2('0x7f')]({'where':{'id':_0x270272[_0x6fa2('0x4b')]['id']}})[_0x6fa2('0x27')](function(_0x419a6e){if(_0x419a6e){var _0x4712e3=util[_0x6fa2('0x34')](_0x6fa2('0x56'),_0x419a6e['value']);if(fs['existsSync'](_0x4712e3)){cypher=!![];return _0x4d2976['decryptFile'](_0x4712e3,_0x419a6e[_0x6fa2('0x55')],config[_0x6fa2('0x59')][_0x6fa2('0x5a')])[_0x6fa2('0x27')](function(){return _0x419a6e;});}return _0x419a6e;}})[_0x6fa2('0x27')](function(_0x21451f){if(!_0x21451f){throw new db[(_0x6fa2('0x5b'))]['ValidationError'](_0x6fa2('0x80'));}_0x40ff5e=_0x21451f;return db[_0x6fa2('0x81')]['findOne']({'where':{'id':0x1}});})[_0x6fa2('0x27')](handleEntityNotFound(_0x3cdfcf,null))['then'](function(_0x759d47){if(_0x759d47){_0x3e0adf=_0x759d47;if(!_0x3e0adf['transcribe']||!_0x3e0adf['transcribeAccountId']||!_0x3e0adf[_0x6fa2('0x82')]||!_0x3e0adf[_0x6fa2('0x83')]||!_0x3e0adf[_0x6fa2('0x77')]){throw new db[(_0x6fa2('0x5b'))][(_0x6fa2('0x5c'))](_0x6fa2('0x84'));}if(_0x270272[_0x6fa2('0x4f')][_0x6fa2('0x85')]&&(!_0x3e0adf[_0x6fa2('0x86')]||!_0x3e0adf[_0x6fa2('0x87')]||!_0x3e0adf['sentimentRegion']||!_0x3e0adf['language']||!_0x3e0adf[_0x6fa2('0x77')])){throw new db[(_0x6fa2('0x5b'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6fa2('0x88')]['findOne']({'where':{'id':_0x3e0adf[_0x6fa2('0x89')]}});}})[_0x6fa2('0x27')](function(_0xffc311){if(!_0xffc311){throw new db[(_0x6fa2('0x5b'))]['ValidationError'](_0x6fa2('0x8a'));}if(!_0xffc311[_0x6fa2('0x8b')]||!_0xffc311[_0x6fa2('0x8c')]){throw new db[(_0x6fa2('0x5b'))]['ValidationError'](_0x6fa2('0x8d'));}_0xebf14a=_0xffc311;return getBucketslist(_0xebf14a[_0x6fa2('0x8b')],_0xebf14a[_0x6fa2('0x8c')],_0x3e0adf['transcribeRegion']);})[_0x6fa2('0x27')](function(_0x4fdfd9){if(_0x4fdfd9&&_0x4fdfd9[_0x6fa2('0x8e')]){var _0x210a3b=_[_0x6fa2('0x50')](_0x4fdfd9[_0x6fa2('0x8e')],function(_0x44b56f){return _0x44b56f['Name']===_0x3e0adf['bucket'];});if(!_0x210a3b){logger[_0x6fa2('0x6a')](util[_0x6fa2('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x270272[_0x6fa2('0x4b')]['id'],_0x3e0adf[_0x6fa2('0x77')]));return createBucket(_0xebf14a[_0x6fa2('0x8b')],_0xebf14a[_0x6fa2('0x8c')],_0x3e0adf[_0x6fa2('0x82')],_0x3e0adf[_0x6fa2('0x77')]);}logger['info'](util['format'](_0x6fa2('0x8f'),_0x270272[_0x6fa2('0x4b')]['id'],_0x3e0adf[_0x6fa2('0x77')]));return;}})[_0x6fa2('0x27')](function(_0x945951){if(_0x40ff5e['transcribeStatus']===_0x6fa2('0x90')){return transcribe(_0x270272[_0x6fa2('0x4b')]['id'],_0xebf14a['data1'],_0xebf14a[_0x6fa2('0x8c')],_0x3e0adf[_0x6fa2('0x82')],_0x3e0adf[_0x6fa2('0x77')],_0x40ff5e['value'],_0x3e0adf[_0x6fa2('0x83')]);}else{logger[_0x6fa2('0x6a')](util['format'](_0x6fa2('0x91'),_0x270272['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x6fa2('0x27')](function(_0xf17cd0){if(_0xf17cd0){_0xf17cd0[_0x6fa2('0x92')]=_0x270272['body']['runSentiment'];return _0x40ff5e[_0x6fa2('0x93')](_0xf17cd0);}})[_0x6fa2('0x27')](respondWithResult(_0x3cdfcf,null))['catch'](handleError(_0x3cdfcf,null));};function writeFile(_0x3e7110,_0x2018d5){return new Promise(function(_0x18c9d8,_0xd34cb3){fs[_0x6fa2('0x94')](_0x2018d5,_0x3e7110,function(_0x1340da,_0x496764){if(_0x1340da){return _0xd34cb3(_0x1340da);}else{return _0x18c9d8(_0x496764);}});});}exports['downloadTranscribe']=function(_0x586213,_0x375bc1,_0x3198e5){return db[_0x6fa2('0x2d')][_0x6fa2('0x7f')]({'where':{'id':_0x586213['params']['id']}})[_0x6fa2('0x27')](handleEntityNotFound(_0x375bc1))[_0x6fa2('0x27')](function(_0x41d911){if(_0x41d911&&_0x41d911['fileText']){var _0x46d35d=_0x41d911[_0x6fa2('0x95')];var _0x1a8b72=config[_0x6fa2('0x96')]+_0x6fa2('0x97')+_0x41d911['id']+_0x6fa2('0x98');if(fs[_0x6fa2('0x57')](_0x1a8b72)){return _0x1a8b72;}return writeFile(_0x46d35d,_0x1a8b72)[_0x6fa2('0x27')](function(){return _0x1a8b72;});}else{throw new db[(_0x6fa2('0x5b'))][(_0x6fa2('0x5c'))]('Transcript\x20not\x20available');}})[_0x6fa2('0x27')](function(_0xf9dd28){return _0x375bc1[_0x6fa2('0x52')](_0xf9dd28);})[_0x6fa2('0x49')](handleError(_0x375bc1));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e0393f3..94e120b 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 _0x7cc1=['voice_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','VoiceRecording'];(function(_0x35410b,_0x554e37){var _0x56d8c4=function(_0x276c92){while(--_0x276c92){_0x35410b['push'](_0x35410b['shift']());}};_0x56d8c4(++_0x554e37);}(_0x7cc1,0x199));var _0x17cc=function(_0x344ab6,_0x4fd193){_0x344ab6=_0x344ab6-0x0;var _0x3e7cc1=_0x7cc1[_0x344ab6];return _0x3e7cc1;};'use strict';var _=require(_0x17cc('0x0'));var util=require(_0x17cc('0x1'));var logger=require(_0x17cc('0x2'))(_0x17cc('0x3'));var moment=require('moment');var BPromise=require(_0x17cc('0x4'));var rp=require(_0x17cc('0x5'));var fs=require('fs');var path=require(_0x17cc('0x6'));var rimraf=require(_0x17cc('0x7'));var config=require(_0x17cc('0x8'));var attributes=require(_0x17cc('0x9'));module['exports']=function(_0x13998e,_0x18cad7){return _0x13998e['define'](_0x17cc('0xa'),attributes,{'tableName':_0x17cc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b75=['voice_recordings','uniqueid','util','api','moment','bluebird','path','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x806c31,_0x4df99a){var _0x4f5a2b=function(_0x668b70){while(--_0x668b70){_0x806c31['push'](_0x806c31['shift']());}};_0x4f5a2b(++_0x4df99a);}(_0x6b75,0xe6));var _0x56b7=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x6b75[_0x37e845];return _0x59e55b;};'use strict';var _=require('lodash');var util=require(_0x56b7('0x0'));var logger=require('../../config/logger')(_0x56b7('0x1'));var moment=require(_0x56b7('0x2'));var BPromise=require(_0x56b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56b7('0x4'));var rimraf=require('rimraf');var config=require(_0x56b7('0x5'));var attributes=require(_0x56b7('0x6'));module[_0x56b7('0x7')]=function(_0x496da3,_0x16d1e8){return _0x496da3[_0x56b7('0x8')](_0x56b7('0x9'),attributes,{'tableName':_0x56b7('0xa'),'paranoid':![],'indexes':[{'name':_0x56b7('0xb'),'fields':[_0x56b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index fd59637..4746cd9 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 _0x47c5=['secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','UpdateVoiceRecording','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher'];(function(_0x35bd17,_0x29612a){var _0x1b3ac2=function(_0x2382cc){while(--_0x2382cc){_0x35bd17['push'](_0x35bd17['shift']());}};_0x1b3ac2(++_0x29612a);}(_0x47c5,0x165));var _0x547c=function(_0xad4203,_0x5c5fc5){_0xad4203=_0xad4203-0x0;var _0x455ee1=_0x47c5[_0xad4203];return _0x455ee1;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['UpdateVoiceRecording']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fa9e['options']?_0x23fa9e['options'][_0x547c('0x1d')]||null:null,'attributes':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1e')]||null:null,'limit':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1f')]||null:null})[_0x547c('0xc')](function(_0x436e67){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x436e67));_0xeb059e(_0x436e67);})[_0x547c('0x17')](function(_0x2663bc){logger[_0x547c('0x13')](_0x547c('0x20'),_0x2663bc['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2663bc['message']));});});};exports['CreateVoiceRecording']=function(_0x4855fd){var _0x478f04=this;return new Promise(function(_0x2c725d,_0x4c5256){var _0x93985c=require('../../components/encryptor');var _0x3ea493;return db['Setting'][_0x547c('0x21')]({'attributes':['id',_0x547c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x547c('0xc')](function(_0x30a96c){_0x3ea493=_0x30a96c;return db[_0x547c('0x18')]['create'](_0x4855fd['body']);})[_0x547c('0xc')](function(_0x54de6f){if(_0x3ea493[_0x547c('0x22')]&&fs[_0x547c('0x23')](_0x54de6f[_0x547c('0x24')])){var _0x1695be=util[_0x547c('0x25')](_0x547c('0x26'),_0x54de6f[_0x547c('0x24')]);return _0x93985c['encryptFile'](_0x54de6f['value'],_0x1695be,config[_0x547c('0x27')][_0x547c('0x28')])[_0x547c('0xc')](function(){fs[_0x547c('0x29')](_0x54de6f[_0x547c('0x24')]);logger[_0x547c('0xd')](_0x547c('0x2a'));return _0x54de6f;});}return _0x54de6f;})[_0x547c('0xc')](function(_0x378bac){logger[_0x547c('0xd')](_0x547c('0x2b'),_0x4855fd);logger[_0x547c('0x10')](_0x547c('0x2b'),_0x4855fd,JSON[_0x547c('0x12')](_0x378bac));_0x2c725d(_0x378bac);})['catch'](function(_0x3afc28){logger['error']('CreateVoiceRecording',_0x3afc28['message'],_0x4855fd);_0x4c5256(_0x478f04[_0x547c('0x13')](0x1f4,_0x3afc28[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0xb016=['options','raw','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','recording','unlink','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb016,0x159));var _0x6b01=function(_0x55776e,_0xe22568){_0x55776e=_0x55776e-0x0;var _0x1f6299=_0xb016[_0x55776e];return _0x1f6299;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')](_0x9c6571[_0x6b01('0x17')],{'raw':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')]['where']||null:null,'attributes':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1b')]||null:null})[_0x6b01('0xa')](function(_0x542fab){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1c')]('UpdateVoiceRecording',_0x9c6571,JSON[_0x6b01('0xe')](_0x542fab));_0x18f336(_0x542fab);})[_0x6b01('0x13')](function(_0x304393){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x304393[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x304393[_0x6b01('0x11')]));});});};exports[_0x6b01('0x1d')]=function(_0x152dda){var _0x3c0607=this;return new Promise(function(_0xa846d8,_0x154dfc){var _0x55ca4b=require(_0x6b01('0x1e'));var _0x220efb;return db[_0x6b01('0x1f')][_0x6b01('0x20')]({'attributes':['id',_0x6b01('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54f030){_0x220efb=_0x54f030;return db[_0x6b01('0x15')][_0x6b01('0x22')](_0x152dda[_0x6b01('0x17')]);})[_0x6b01('0xa')](function(_0x2a894e){if(_0x220efb[_0x6b01('0x21')]&&fs['existsSync'](_0x2a894e[_0x6b01('0x23')])){var _0x5482a8=util[_0x6b01('0x24')]('%s.cypher',_0x2a894e[_0x6b01('0x23')]);return _0x55ca4b[_0x6b01('0x25')](_0x2a894e[_0x6b01('0x23')],_0x5482a8,config[_0x6b01('0x26')][_0x6b01('0x27')])['then'](function(){fs[_0x6b01('0x28')](_0x2a894e[_0x6b01('0x23')]);logger[_0x6b01('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2a894e;});}return _0x2a894e;})['then'](function(_0x3578ef){logger['info'](_0x6b01('0x1d'),_0x152dda);logger[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x152dda,JSON['stringify'](_0x3578ef));_0xa846d8(_0x3578ef);})[_0x6b01('0x13')](function(_0x42d5f7){logger[_0x6b01('0xf')]('CreateVoiceRecording',_0x42d5f7[_0x6b01('0x11')],_0x152dda);_0x154dfc(_0x3c0607[_0x6b01('0xf')](0x1f4,_0x42d5f7[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index acc0c40..c3e91c4 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 _0x3c1d=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x3c1d,0x110));var _0xd3c1=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3c1d[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0xd3c1('0x0'));var path=require(_0xd3c1('0x1'));var timeout=require(_0xd3c1('0x2'));var express=require(_0xd3c1('0x3'));var router=express[_0xd3c1('0x4')]();var fs_extra=require(_0xd3c1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3c1('0x6'));var config=require(_0xd3c1('0x7'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xd3c1('0x8')](),controller['index']);router[_0xd3c1('0x9')]('/describe',auth[_0xd3c1('0x8')](),controller['describe']);router[_0xd3c1('0x9')](_0xd3c1('0xa'),auth[_0xd3c1('0x8')](),controller[_0xd3c1('0xb')]);router[_0xd3c1('0xc')]('/',auth[_0xd3c1('0x8')](),controller[_0xd3c1('0xd')]);router[_0xd3c1('0xe')]('/:id',auth[_0xd3c1('0x8')](),controller[_0xd3c1('0xf')]);router[_0xd3c1('0x10')]('/:id',auth[_0xd3c1('0x8')](),controller[_0xd3c1('0x11')]);module[_0xd3c1('0x12')]=router; \ No newline at end of file +var _0xd66b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','exports'];(function(_0x54b766,_0x313856){var _0x1ddc75=function(_0x7ea434){while(--_0x7ea434){_0x54b766['push'](_0x54b766['shift']());}};_0x1ddc75(++_0x313856);}(_0xd66b,0x10e));var _0xbd66=function(_0x291b11,_0x56b5da){_0x291b11=_0x291b11-0x0;var _0x51a30b=_0xd66b[_0x291b11];return _0x51a30b;};'use strict';var multer=require(_0xbd66('0x0'));var util=require(_0xbd66('0x1'));var path=require(_0xbd66('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd66('0x3'));var router=express[_0xbd66('0x4')]();var fs_extra=require(_0xbd66('0x5'));var auth=require(_0xbd66('0x6'));var interaction=require(_0xbd66('0x7'));var config=require('../../config/environment');var controller=require(_0xbd66('0x8'));router[_0xbd66('0x9')]('/',auth[_0xbd66('0xa')](),controller['index']);router[_0xbd66('0x9')](_0xbd66('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbd66('0xc'),auth[_0xbd66('0xa')](),controller[_0xbd66('0xd')]);router[_0xbd66('0xe')]('/',auth[_0xbd66('0xa')](),controller[_0xbd66('0xf')]);router[_0xbd66('0x10')](_0xbd66('0xc'),auth[_0xbd66('0xa')](),controller['update']);router['delete'](_0xbd66('0xc'),auth[_0xbd66('0xa')](),controller['destroy']);module[_0xbd66('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d6d9a78..77fd874 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 _0x123c=['ENUM','attended','STRING','Yes','sequelize','exports'];(function(_0x1cd5eb,_0xd67472){var _0x82916d=function(_0x571127){while(--_0x571127){_0x1cd5eb['push'](_0x1cd5eb['shift']());}};_0x82916d(++_0xd67472);}(_0x123c,0x1b4));var _0xc123=function(_0x27a610,_0x3402a2){_0x27a610=_0x27a610-0x0;var _0x544753=_0x123c[_0x27a610];return _0x544753;};'use strict';var Sequelize=require(_0xc123('0x0'));var moment=require('moment');module[_0xc123('0x1')]={'type':{'type':Sequelize[_0xc123('0x2')]('blind',_0xc123('0x3'))},'result':{'type':Sequelize[_0xc123('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xc123('0x4')]},'transferercalleridname':{'type':Sequelize[_0xc123('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc123('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xc123('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xc123('0x4')]},'transferercontext':{'type':Sequelize[_0xc123('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xc123('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xc123('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xc123('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xc123('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xc123('0x4')]},'transfereeexten':{'type':Sequelize[_0xc123('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xc123('0x4')]},'isexternal':{'type':Sequelize[_0xc123('0x2')](_0xc123('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x406c=['Yes','sequelize','moment','exports','blind','STRING'];(function(_0x127031,_0x57772b){var _0x4a36b9=function(_0x41e6df){while(--_0x41e6df){_0x127031['push'](_0x127031['shift']());}};_0x4a36b9(++_0x57772b);}(_0x406c,0x1e1));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc406('0x0'));var moment=require(_0xc406('0x1'));module[_0xc406('0x2')]={'type':{'type':Sequelize['ENUM'](_0xc406('0x3'),'attended')},'result':{'type':Sequelize[_0xc406('0x4')]},'transfererchannel':{'type':Sequelize[_0xc406('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xc406('0x4')]},'transferercalleridname':{'type':Sequelize[_0xc406('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xc406('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xc406('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xc406('0x4')]},'transfereechannel':{'type':Sequelize[_0xc406('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xc406('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc406('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc406('0x4')]},'transfereecontext':{'type':Sequelize[_0xc406('0x4')]},'transfereeexten':{'type':Sequelize[_0xc406('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xc406('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xc406('0x5'),'No')},'context':{'type':Sequelize[_0xc406('0x4')]},'extension':{'type':Sequelize[_0xc406('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f21bec9..4a45b28 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 _0x29ab=['hasOwnProperty','order','where','pick','filters','filter','merge','type','VIRTUAL','options','include','catch','show','includeAll','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','error','stack','send','index','VoiceTransferReport','fieldName','key','model','map','name','query','keys','intersection','attributes','fields'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x29ab,0xaa));var _0xb29a=function(_0x4cff7b,_0x27a994){_0x4cff7b=_0x4cff7b-0x0;var _0x9df5fd=_0x29ab[_0x4cff7b];return _0x9df5fd;};'use strict';var emlformat=require(_0xb29a('0x0'));var rimraf=require(_0xb29a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb29a('0x2'));var rp=require(_0xb29a('0x3'));var moment=require(_0xb29a('0x4'));var BPromise=require(_0xb29a('0x5'));var Mustache=require('mustache');var util=require(_0xb29a('0x6'));var path=require('path');var sox=require(_0xb29a('0x7'));var csv=require(_0xb29a('0x8'));var ejs=require(_0xb29a('0x9'));var fs=require('fs');var fs_extra=require(_0xb29a('0xa'));var _=require(_0xb29a('0xb'));var squel=require(_0xb29a('0xc'));var crypto=require('crypto');var jsforce=require(_0xb29a('0xd'));var deskjs=require(_0xb29a('0xe'));var toCsv=require(_0xb29a('0x8'));var querystring=require(_0xb29a('0xf'));var Papa=require(_0xb29a('0x10'));var Redis=require(_0xb29a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb29a('0x12'));var hardwareService=require(_0xb29a('0x13'));var logger=require(_0xb29a('0x14'))(_0xb29a('0x15'));var utils=require(_0xb29a('0x16'));var config=require(_0xb29a('0x17'));var licenseUtil=require(_0xb29a('0x18'));var db=require(_0xb29a('0x19'))['db'];function respondWithStatusCode(_0x1bd1b5,_0x391219){_0x391219=_0x391219||0xcc;return function(_0x2a2374){if(_0x2a2374){return _0x1bd1b5[_0xb29a('0x1a')](_0x391219);}return _0x1bd1b5['status'](_0x391219)[_0xb29a('0x1b')]();};}function respondWithResult(_0x27391b,_0x3fc8db){_0x3fc8db=_0x3fc8db||0xc8;return function(_0x308b95){if(_0x308b95){return _0x27391b['status'](_0x3fc8db)[_0xb29a('0x1c')](_0x308b95);}};}function respondWithFilteredResult(_0x2804a7,_0x490251){return function(_0x59d48a){if(_0x59d48a){var _0x360c19=typeof _0x490251[_0xb29a('0x1d')]===_0xb29a('0x1e')&&typeof _0x490251[_0xb29a('0x1f')]==='undefined';var _0x260186=_0x59d48a[_0xb29a('0x20')];var _0x9ec5e8=_0x360c19?0x0:_0x490251['offset'];var _0x3aa426=_0x360c19?_0x59d48a[_0xb29a('0x20')]:_0x490251[_0xb29a('0x1d')]+_0x490251[_0xb29a('0x1f')];var _0x51c15f;if(_0x3aa426>=_0x260186){_0x3aa426=_0x260186;_0x51c15f=0xc8;}else{_0x51c15f=0xce;}_0x2804a7[_0xb29a('0x21')](_0x51c15f);return _0x2804a7[_0xb29a('0x22')](_0xb29a('0x23'),_0x9ec5e8+'-'+_0x3aa426+'/'+_0x260186)['json'](_0x59d48a);}return null;};}function patchUpdates(_0x1b59c4){return function(_0x4bca1a){try{jsonpatch[_0xb29a('0x24')](_0x4bca1a,_0x1b59c4,!![]);}catch(_0xdfbedf){return BPromise[_0xb29a('0x25')](_0xdfbedf);}return _0x4bca1a['save']();};}function saveUpdates(_0xeb17c1,_0x17baa4){return function(_0x4eff8c){if(_0x4eff8c){return _0x4eff8c['update'](_0xeb17c1)[_0xb29a('0x26')](function(_0xbba78c){return _0xbba78c;});}return null;};}function removeEntity(_0x24ecdd,_0x4e2f36){return function(_0x3a8ffd){if(_0x3a8ffd){return _0x3a8ffd[_0xb29a('0x27')]()['then'](function(){_0x24ecdd['status'](0xcc)[_0xb29a('0x1b')]();});}};}function handleEntityNotFound(_0x58c774,_0x2b3f7f){return function(_0x5b94c7){if(!_0x5b94c7){_0x58c774[_0xb29a('0x1a')](0x194);}return _0x5b94c7;};}function handleError(_0x591d33,_0xae8a9f){_0xae8a9f=_0xae8a9f||0x1f4;return function(_0x25d034){logger[_0xb29a('0x28')](_0x25d034[_0xb29a('0x29')]);if(_0x25d034['name']){delete _0x25d034['name'];}_0x591d33[_0xb29a('0x21')](_0xae8a9f)[_0xb29a('0x2a')](_0x25d034);};}exports[_0xb29a('0x2b')]=function(_0x32abbc,_0x20bb09){var _0x19f44f={},_0x391b00={},_0x2c1766={'count':0x0,'rows':[]};var _0x5c403a=_['map'](db[_0xb29a('0x2c')]['rawAttributes'],function(_0x3ce181){return{'name':_0x3ce181[_0xb29a('0x2d')],'type':_0x3ce181['type'][_0xb29a('0x2e')]};});_0x391b00[_0xb29a('0x2f')]=_[_0xb29a('0x30')](_0x5c403a,_0xb29a('0x31'));_0x391b00[_0xb29a('0x32')]=_[_0xb29a('0x33')](_0x32abbc['query']);_0x391b00['filters']=_[_0xb29a('0x34')](_0x391b00[_0xb29a('0x2f')],_0x391b00[_0xb29a('0x32')]);_0x19f44f[_0xb29a('0x35')]=_[_0xb29a('0x34')](_0x391b00['model'],qs[_0xb29a('0x36')](_0x32abbc[_0xb29a('0x32')][_0xb29a('0x36')]));_0x19f44f['attributes']=_0x19f44f[_0xb29a('0x35')]['length']?_0x19f44f[_0xb29a('0x35')]:_0x391b00[_0xb29a('0x2f')];if(!_0x32abbc[_0xb29a('0x32')][_0xb29a('0x37')]('nolimit')){_0x19f44f['limit']=qs[_0xb29a('0x1f')](_0x32abbc['query']['limit']);_0x19f44f[_0xb29a('0x1d')]=qs['offset'](_0x32abbc[_0xb29a('0x32')][_0xb29a('0x1d')]);}_0x19f44f[_0xb29a('0x38')]=qs['sort'](_0x32abbc[_0xb29a('0x32')]['sort']);_0x19f44f[_0xb29a('0x39')]=qs['filters'](_[_0xb29a('0x3a')](_0x32abbc[_0xb29a('0x32')],_0x391b00[_0xb29a('0x3b')]),_0x5c403a);if(_0x32abbc[_0xb29a('0x32')][_0xb29a('0x3c')]){_0x19f44f[_0xb29a('0x39')]=_[_0xb29a('0x3d')](_0x19f44f[_0xb29a('0x39')],{'$or':_['map'](_0x5c403a,function(_0x4ed13e){if(_0x4ed13e[_0xb29a('0x3e')]!==_0xb29a('0x3f')){var _0x31d01d={};_0x31d01d[_0x4ed13e[_0xb29a('0x31')]]={'$like':'%'+_0x32abbc[_0xb29a('0x32')]['filter']+'%'};return _0x31d01d;}})});}_0x19f44f=_[_0xb29a('0x3d')]({},_0x19f44f,_0x32abbc[_0xb29a('0x40')]);var _0x53b4ac={'where':_0x19f44f[_0xb29a('0x39')]};return db['VoiceTransferReport'][_0xb29a('0x20')](_0x53b4ac)['then'](function(_0x2c749c){_0x2c1766[_0xb29a('0x20')]=_0x2c749c;if(_0x32abbc[_0xb29a('0x32')]['includeAll']){_0x19f44f[_0xb29a('0x41')]=[{'all':!![]}];}return db[_0xb29a('0x2c')]['findAll'](_0x19f44f);})['then'](function(_0x44cd58){_0x2c1766['rows']=_0x44cd58;return _0x2c1766;})['then'](respondWithFilteredResult(_0x20bb09,_0x19f44f))[_0xb29a('0x42')](handleError(_0x20bb09,null));};exports[_0xb29a('0x43')]=function(_0x45f867,_0x41b429){var _0x2c76e5={'raw':!![],'where':{'id':_0x45f867['params']['id']}},_0x528f6={};_0x528f6['model']=_[_0xb29a('0x33')](db['VoiceTransferReport']['rawAttributes']);_0x528f6[_0xb29a('0x32')]=_['keys'](_0x45f867[_0xb29a('0x32')]);_0x528f6[_0xb29a('0x3b')]=_[_0xb29a('0x34')](_0x528f6[_0xb29a('0x2f')],_0x528f6['query']);_0x2c76e5['attributes']=_[_0xb29a('0x34')](_0x528f6[_0xb29a('0x2f')],qs[_0xb29a('0x36')](_0x45f867[_0xb29a('0x32')][_0xb29a('0x36')]));_0x2c76e5[_0xb29a('0x35')]=_0x2c76e5[_0xb29a('0x35')]['length']?_0x2c76e5['attributes']:_0x528f6[_0xb29a('0x2f')];if(_0x45f867[_0xb29a('0x32')][_0xb29a('0x44')]){_0x2c76e5['include']=[{'all':!![]}];}_0x2c76e5=_[_0xb29a('0x3d')]({},_0x2c76e5,_0x45f867['options']);return db[_0xb29a('0x2c')][_0xb29a('0x45')](_0x2c76e5)['then'](handleEntityNotFound(_0x41b429,null))[_0xb29a('0x26')](respondWithResult(_0x41b429,null))[_0xb29a('0x42')](handleError(_0x41b429,null));};exports['create']=function(_0x2f842a,_0x44d4db){return db[_0xb29a('0x2c')][_0xb29a('0x46')](_0x2f842a[_0xb29a('0x47')],{})[_0xb29a('0x26')](respondWithResult(_0x44d4db,0xc9))['catch'](handleError(_0x44d4db,null));};exports[_0xb29a('0x48')]=function(_0x302625,_0x34434b){if(_0x302625[_0xb29a('0x47')]['id']){delete _0x302625[_0xb29a('0x47')]['id'];}return db[_0xb29a('0x2c')][_0xb29a('0x45')]({'where':{'id':_0x302625[_0xb29a('0x49')]['id']}})[_0xb29a('0x26')](handleEntityNotFound(_0x34434b,null))[_0xb29a('0x26')](saveUpdates(_0x302625[_0xb29a('0x47')],null))[_0xb29a('0x26')](respondWithResult(_0x34434b,null))[_0xb29a('0x42')](handleError(_0x34434b,null));};exports['destroy']=function(_0x3b3ef5,_0x3b0a34){return db[_0xb29a('0x2c')][_0xb29a('0x45')]({'where':{'id':_0x3b3ef5[_0xb29a('0x49')]['id']}})[_0xb29a('0x26')](handleEntityNotFound(_0x3b0a34,null))[_0xb29a('0x26')](removeEntity(_0x3b0a34,null))[_0xb29a('0x42')](handleError(_0x3b0a34,null));};exports[_0xb29a('0x4a')]=function(_0x1c5473,_0x4b98ab){return db[_0xb29a('0x2c')][_0xb29a('0x4a')]()['then'](respondWithResult(_0x4b98ab,null))[_0xb29a('0x42')](handleError(_0x4b98ab,null));}; \ No newline at end of file +var _0x2c10=['offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','intersection','find','create','body','update','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x2c10,0x120));var _0x02c1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2c10[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02c1('0x0'));var jsonpatch=require(_0x02c1('0x1'));var rp=require(_0x02c1('0x2'));var moment=require(_0x02c1('0x3'));var BPromise=require(_0x02c1('0x4'));var Mustache=require(_0x02c1('0x5'));var util=require(_0x02c1('0x6'));var path=require(_0x02c1('0x7'));var sox=require(_0x02c1('0x8'));var csv=require(_0x02c1('0x9'));var ejs=require(_0x02c1('0xa'));var fs=require('fs');var fs_extra=require(_0x02c1('0xb'));var _=require(_0x02c1('0xc'));var squel=require(_0x02c1('0xd'));var crypto=require(_0x02c1('0xe'));var jsforce=require(_0x02c1('0xf'));var deskjs=require(_0x02c1('0x10'));var toCsv=require(_0x02c1('0x9'));var querystring=require(_0x02c1('0x11'));var Papa=require(_0x02c1('0x12'));var Redis=require(_0x02c1('0x13'));var authService=require(_0x02c1('0x14'));var qs=require(_0x02c1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02c1('0x16'));var logger=require(_0x02c1('0x17'))('api');var utils=require(_0x02c1('0x18'));var config=require(_0x02c1('0x19'));var licenseUtil=require(_0x02c1('0x1a'));var db=require(_0x02c1('0x1b'))['db'];function respondWithStatusCode(_0x20e356,_0x21e50a){_0x21e50a=_0x21e50a||0xcc;return function(_0x5d2966){if(_0x5d2966){return _0x20e356[_0x02c1('0x1c')](_0x21e50a);}return _0x20e356[_0x02c1('0x1d')](_0x21e50a)[_0x02c1('0x1e')]();};}function respondWithResult(_0x4a7847,_0x5b3118){_0x5b3118=_0x5b3118||0xc8;return function(_0x3677e2){if(_0x3677e2){return _0x4a7847[_0x02c1('0x1d')](_0x5b3118)[_0x02c1('0x1f')](_0x3677e2);}};}function respondWithFilteredResult(_0x272b99,_0x5bfc14){return function(_0x58ec08){if(_0x58ec08){var _0x16d486=typeof _0x5bfc14[_0x02c1('0x20')]==='undefined'&&typeof _0x5bfc14[_0x02c1('0x21')]===_0x02c1('0x22');var _0x261e06=_0x58ec08[_0x02c1('0x23')];var _0x9fd8a4=_0x16d486?0x0:_0x5bfc14[_0x02c1('0x20')];var _0x4aa9d8=_0x16d486?_0x58ec08[_0x02c1('0x23')]:_0x5bfc14[_0x02c1('0x20')]+_0x5bfc14[_0x02c1('0x21')];var _0x571974;if(_0x4aa9d8>=_0x261e06){_0x4aa9d8=_0x261e06;_0x571974=0xc8;}else{_0x571974=0xce;}_0x272b99[_0x02c1('0x1d')](_0x571974);return _0x272b99[_0x02c1('0x24')](_0x02c1('0x25'),_0x9fd8a4+'-'+_0x4aa9d8+'/'+_0x261e06)[_0x02c1('0x1f')](_0x58ec08);}return null;};}function patchUpdates(_0x3a4a18){return function(_0x4f3acd){try{jsonpatch['apply'](_0x4f3acd,_0x3a4a18,!![]);}catch(_0x157160){return BPromise[_0x02c1('0x26')](_0x157160);}return _0x4f3acd[_0x02c1('0x27')]();};}function saveUpdates(_0x3921ca,_0x327504){return function(_0x4cd82e){if(_0x4cd82e){return _0x4cd82e['update'](_0x3921ca)[_0x02c1('0x28')](function(_0x274a3d){return _0x274a3d;});}return null;};}function removeEntity(_0x3508b3,_0xf91713){return function(_0x980c3e){if(_0x980c3e){return _0x980c3e[_0x02c1('0x29')]()[_0x02c1('0x28')](function(){_0x3508b3[_0x02c1('0x1d')](0xcc)[_0x02c1('0x1e')]();});}};}function handleEntityNotFound(_0x330d10,_0x1146bf){return function(_0x164c25){if(!_0x164c25){_0x330d10[_0x02c1('0x1c')](0x194);}return _0x164c25;};}function handleError(_0x54817a,_0x292444){_0x292444=_0x292444||0x1f4;return function(_0x584482){logger[_0x02c1('0x2a')](_0x584482['stack']);if(_0x584482[_0x02c1('0x2b')]){delete _0x584482[_0x02c1('0x2b')];}_0x54817a['status'](_0x292444)[_0x02c1('0x2c')](_0x584482);};}exports[_0x02c1('0x2d')]=function(_0x2d47a0,_0x2b00a8){var _0x312794={},_0x918efe={},_0x1d20dd={'count':0x0,'rows':[]};var _0x414f44=_[_0x02c1('0x2e')](db[_0x02c1('0x2f')][_0x02c1('0x30')],function(_0x5b72f1){return{'name':_0x5b72f1[_0x02c1('0x31')],'type':_0x5b72f1[_0x02c1('0x32')][_0x02c1('0x33')]};});_0x918efe['model']=_[_0x02c1('0x2e')](_0x414f44,_0x02c1('0x2b'));_0x918efe[_0x02c1('0x34')]=_[_0x02c1('0x35')](_0x2d47a0[_0x02c1('0x34')]);_0x918efe['filters']=_['intersection'](_0x918efe['model'],_0x918efe[_0x02c1('0x34')]);_0x312794['attributes']=_['intersection'](_0x918efe[_0x02c1('0x36')],qs[_0x02c1('0x37')](_0x2d47a0[_0x02c1('0x34')][_0x02c1('0x37')]));_0x312794[_0x02c1('0x38')]=_0x312794[_0x02c1('0x38')][_0x02c1('0x39')]?_0x312794['attributes']:_0x918efe['model'];if(!_0x2d47a0[_0x02c1('0x34')][_0x02c1('0x3a')]('nolimit')){_0x312794['limit']=qs['limit'](_0x2d47a0['query'][_0x02c1('0x21')]);_0x312794['offset']=qs[_0x02c1('0x20')](_0x2d47a0[_0x02c1('0x34')]['offset']);}_0x312794[_0x02c1('0x3b')]=qs[_0x02c1('0x3c')](_0x2d47a0[_0x02c1('0x34')][_0x02c1('0x3c')]);_0x312794[_0x02c1('0x3d')]=qs[_0x02c1('0x3e')](_[_0x02c1('0x3f')](_0x2d47a0[_0x02c1('0x34')],_0x918efe[_0x02c1('0x3e')]),_0x414f44);if(_0x2d47a0[_0x02c1('0x34')][_0x02c1('0x40')]){_0x312794[_0x02c1('0x3d')]=_[_0x02c1('0x41')](_0x312794[_0x02c1('0x3d')],{'$or':_[_0x02c1('0x2e')](_0x414f44,function(_0x55aa8a){if(_0x55aa8a[_0x02c1('0x32')]!==_0x02c1('0x42')){var _0x4ed5fe={};_0x4ed5fe[_0x55aa8a[_0x02c1('0x2b')]]={'$like':'%'+_0x2d47a0['query'][_0x02c1('0x40')]+'%'};return _0x4ed5fe;}})});}_0x312794=_[_0x02c1('0x41')]({},_0x312794,_0x2d47a0[_0x02c1('0x43')]);var _0x38ac59={'where':_0x312794['where']};return db[_0x02c1('0x2f')][_0x02c1('0x23')](_0x38ac59)[_0x02c1('0x28')](function(_0x4ea2db){_0x1d20dd[_0x02c1('0x23')]=_0x4ea2db;if(_0x2d47a0[_0x02c1('0x34')][_0x02c1('0x44')]){_0x312794[_0x02c1('0x45')]=[{'all':!![]}];}return db[_0x02c1('0x2f')][_0x02c1('0x46')](_0x312794);})[_0x02c1('0x28')](function(_0x28a206){_0x1d20dd['rows']=_0x28a206;return _0x1d20dd;})[_0x02c1('0x28')](respondWithFilteredResult(_0x2b00a8,_0x312794))[_0x02c1('0x47')](handleError(_0x2b00a8,null));};exports[_0x02c1('0x48')]=function(_0x5a3300,_0x2a6640){var _0x47810e={'raw':!![],'where':{'id':_0x5a3300['params']['id']}},_0x57c16e={};_0x57c16e[_0x02c1('0x36')]=_[_0x02c1('0x35')](db[_0x02c1('0x2f')][_0x02c1('0x30')]);_0x57c16e[_0x02c1('0x34')]=_['keys'](_0x5a3300[_0x02c1('0x34')]);_0x57c16e['filters']=_[_0x02c1('0x49')](_0x57c16e[_0x02c1('0x36')],_0x57c16e[_0x02c1('0x34')]);_0x47810e['attributes']=_[_0x02c1('0x49')](_0x57c16e[_0x02c1('0x36')],qs['fields'](_0x5a3300[_0x02c1('0x34')]['fields']));_0x47810e[_0x02c1('0x38')]=_0x47810e[_0x02c1('0x38')][_0x02c1('0x39')]?_0x47810e['attributes']:_0x57c16e[_0x02c1('0x36')];if(_0x5a3300['query'][_0x02c1('0x44')]){_0x47810e[_0x02c1('0x45')]=[{'all':!![]}];}_0x47810e=_['merge']({},_0x47810e,_0x5a3300[_0x02c1('0x43')]);return db[_0x02c1('0x2f')][_0x02c1('0x4a')](_0x47810e)[_0x02c1('0x28')](handleEntityNotFound(_0x2a6640,null))[_0x02c1('0x28')](respondWithResult(_0x2a6640,null))[_0x02c1('0x47')](handleError(_0x2a6640,null));};exports[_0x02c1('0x4b')]=function(_0x1d0fc8,_0x179134){return db[_0x02c1('0x2f')][_0x02c1('0x4b')](_0x1d0fc8[_0x02c1('0x4c')],{})[_0x02c1('0x28')](respondWithResult(_0x179134,0xc9))[_0x02c1('0x47')](handleError(_0x179134,null));};exports[_0x02c1('0x4d')]=function(_0x518b3a,_0x21319a){if(_0x518b3a[_0x02c1('0x4c')]['id']){delete _0x518b3a[_0x02c1('0x4c')]['id'];}return db[_0x02c1('0x2f')][_0x02c1('0x4a')]({'where':{'id':_0x518b3a[_0x02c1('0x4e')]['id']}})[_0x02c1('0x28')](handleEntityNotFound(_0x21319a,null))['then'](saveUpdates(_0x518b3a[_0x02c1('0x4c')],null))['then'](respondWithResult(_0x21319a,null))['catch'](handleError(_0x21319a,null));};exports[_0x02c1('0x29')]=function(_0xbd95f5,_0x106e4c){return db[_0x02c1('0x2f')][_0x02c1('0x4a')]({'where':{'id':_0xbd95f5['params']['id']}})['then'](handleEntityNotFound(_0x106e4c,null))['then'](removeEntity(_0x106e4c,null))['catch'](handleError(_0x106e4c,null));};exports[_0x02c1('0x4f')]=function(_0x5f27fe,_0x5d750b){return db[_0x02c1('0x2f')][_0x02c1('0x4f')]()[_0x02c1('0x28')](respondWithResult(_0x5d750b,null))[_0x02c1('0x47')](handleError(_0x5d750b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 29b8cb2..c50f86b 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 _0x1945=['moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x50c08e,_0x135a5f){var _0x353144=function(_0x5d778f){while(--_0x5d778f){_0x50c08e['push'](_0x50c08e['shift']());}};_0x353144(++_0x135a5f);}(_0x1945,0x141));var _0x5194=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1945[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x5194('0x0'));var util=require(_0x5194('0x1'));var logger=require(_0x5194('0x2'))(_0x5194('0x3'));var moment=require(_0x5194('0x4'));var BPromise=require('bluebird');var rp=require(_0x5194('0x5'));var fs=require('fs');var path=require(_0x5194('0x6'));var rimraf=require(_0x5194('0x7'));var config=require('../../config/environment');var attributes=require(_0x5194('0x8'));module[_0x5194('0x9')]=function(_0x150f16,_0x769bb4){return _0x150f16[_0x5194('0xa')](_0x5194('0xb'),attributes,{'tableName':_0x5194('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c37=['define','VoiceTransferReport','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1c37,0xac));var _0x71c3=function(_0x58687d,_0x182ed1){_0x58687d=_0x58687d-0x0;var _0x18c83f=_0x1c37[_0x58687d];return _0x18c83f;};'use strict';var _=require('lodash');var util=require(_0x71c3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x71c3('0x1'));var BPromise=require(_0x71c3('0x2'));var rp=require(_0x71c3('0x3'));var fs=require('fs');var path=require(_0x71c3('0x4'));var rimraf=require(_0x71c3('0x5'));var config=require(_0x71c3('0x6'));var attributes=require(_0x71c3('0x7'));module['exports']=function(_0x29b1b8,_0x5bcd0b){return _0x29b1b8[_0x71c3('0x8')](_0x71c3('0x9'),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 0b50a44..78776e6 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 _0x177c=['request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x177c,0x1c0));var _0xc177=function(_0x11495b,_0x52ff34){_0x11495b=_0x11495b-0x0;var _0x468d3b=_0x177c[_0x11495b];return _0x468d3b;};'use strict';var _=require(_0xc177('0x0'));var util=require(_0xc177('0x1'));var moment=require(_0xc177('0x2'));var BPromise=require(_0xc177('0x3'));var rs=require(_0xc177('0x4'));var fs=require('fs');var Redis=require(_0xc177('0x5'));var db=require(_0xc177('0x6'))['db'];var utils=require(_0xc177('0x7'));var logger=require(_0xc177('0x8'))(_0xc177('0x9'));var config=require(_0xc177('0xa'));var jayson=require(_0xc177('0xb'));var client=jayson[_0xc177('0xc')][_0xc177('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x713f76,_0x6c7d94,_0x210748){return new BPromise(function(_0x55925b,_0x3573b4){return client[_0xc177('0xe')](_0x713f76,_0x210748)[_0xc177('0xf')](function(_0x577bfa){logger[_0xc177('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x6c7d94,'request\x20sent');logger[_0xc177('0x11')](_0xc177('0x12'),_0x6c7d94,_0xc177('0x13'),JSON[_0xc177('0x14')](_0x577bfa));if(_0x577bfa[_0xc177('0x15')]){if(_0x577bfa[_0xc177('0x15')][_0xc177('0x16')]===0x1f4){logger[_0xc177('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x6c7d94,_0x577bfa['error']['message']);return _0x3573b4(_0x577bfa['error'][_0xc177('0x17')]);}logger[_0xc177('0x15')](_0xc177('0x18'),_0x6c7d94,_0x577bfa['error']['message']);return _0x55925b(_0x577bfa[_0xc177('0x15')][_0xc177('0x17')]);}else{logger[_0xc177('0x10')](_0xc177('0x18'),_0x6c7d94,_0xc177('0x13'));_0x55925b(_0x577bfa[_0xc177('0x19')]['message']);}})['catch'](function(_0x1283ca){logger['error'](_0xc177('0x18'),_0x6c7d94,_0x1283ca);_0x3573b4(_0x1283ca);});});}exports[_0xc177('0x1a')]=function(_0x38b24){var _0x5a016e=this;return new Promise(function(_0x53fd99,_0x5e0498){return db[_0xc177('0x1b')][_0xc177('0x1c')](_0x38b24[_0xc177('0x1d')],{'raw':_0x38b24[_0xc177('0x1e')]?_0x38b24[_0xc177('0x1e')][_0xc177('0x1f')]===undefined?!![]:![]:!![]})[_0xc177('0xf')](function(_0x3e71ec){logger['info']('CreateVoiceTransferReport',_0x38b24);logger[_0xc177('0x11')](_0xc177('0x1a'),_0x38b24,JSON['stringify'](_0x3e71ec));_0x53fd99(_0x3e71ec);})[_0xc177('0x20')](function(_0x5d5bf8){logger[_0xc177('0x15')](_0xc177('0x1a'),_0x5d5bf8[_0xc177('0x17')],_0x38b24);_0x5e0498(_0x5a016e[_0xc177('0x15')](0x1f4,_0x5d5bf8[_0xc177('0x17')]));});});}; \ No newline at end of file +var _0x38fe=['catch','CreateVoiceTransferReport','create','body','options','lodash','util','randomstring','ioredis','rpc','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3ac8c1,_0x49f831){var _0x2e8ebe=function(_0x463dea){while(--_0x463dea){_0x3ac8c1['push'](_0x3ac8c1['shift']());}};_0x2e8ebe(++_0x49f831);}(_0x38fe,0xdd));var _0xe38f=function(_0x1d9419,_0x19f255){_0x1d9419=_0x1d9419-0x0;var _0x3e2de1=_0x38fe[_0x1d9419];return _0x3e2de1;};'use strict';var _=require(_0xe38f('0x0'));var util=require(_0xe38f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe38f('0x2'));var fs=require('fs');var Redis=require(_0xe38f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe38f('0x4'));var config=require('../../config/environment');var jayson=require(_0xe38f('0x5'));var client=jayson['client'][_0xe38f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x121cc7,_0xd12530,_0x30969a){return new BPromise(function(_0x717119,_0x1c72aa){return client[_0xe38f('0x7')](_0x121cc7,_0x30969a)[_0xe38f('0x8')](function(_0x558862){logger[_0xe38f('0x9')](_0xe38f('0xa'),_0xd12530,'request\x20sent');logger[_0xe38f('0xb')](_0xe38f('0xc'),_0xd12530,_0xe38f('0xd'),JSON[_0xe38f('0xe')](_0x558862));if(_0x558862[_0xe38f('0xf')]){if(_0x558862[_0xe38f('0xf')][_0xe38f('0x10')]===0x1f4){logger[_0xe38f('0xf')](_0xe38f('0xa'),_0xd12530,_0x558862[_0xe38f('0xf')][_0xe38f('0x11')]);return _0x1c72aa(_0x558862['error'][_0xe38f('0x11')]);}logger[_0xe38f('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xd12530,_0x558862[_0xe38f('0xf')]['message']);return _0x717119(_0x558862['error'][_0xe38f('0x11')]);}else{logger[_0xe38f('0x9')](_0xe38f('0xa'),_0xd12530,_0xe38f('0xd'));_0x717119(_0x558862[_0xe38f('0x12')]['message']);}})[_0xe38f('0x13')](function(_0x275649){logger[_0xe38f('0xf')](_0xe38f('0xa'),_0xd12530,_0x275649);_0x1c72aa(_0x275649);});});}exports[_0xe38f('0x14')]=function(_0x247974){var _0x3d5d54=this;return new Promise(function(_0x51c016,_0x440929){return db['VoiceTransferReport'][_0xe38f('0x15')](_0x247974[_0xe38f('0x16')],{'raw':_0x247974[_0xe38f('0x17')]?_0x247974['options']['raw']===undefined?!![]:![]:!![]})[_0xe38f('0x8')](function(_0x5680e1){logger[_0xe38f('0x9')](_0xe38f('0x14'),_0x247974);logger[_0xe38f('0xb')](_0xe38f('0x14'),_0x247974,JSON['stringify'](_0x5680e1));_0x51c016(_0x5680e1);})['catch'](function(_0x3dfe97){logger[_0xe38f('0xf')](_0xe38f('0x14'),_0x3dfe97[_0xe38f('0x11')],_0x247974);_0x440929(_0x3d5d54[_0xe38f('0xf')](0x1f4,_0x3dfe97[_0xe38f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 814903f..36e7b19 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x284304,_0xbbe040){var _0x2fcef1=function(_0x3e0da7){while(--_0x3e0da7){_0x284304['push'](_0x284304['shift']());}};_0x2fcef1(++_0xbbe040);}(_0x9f62,0x154));var _0x29f6=function(_0x167e93,_0x58360b){_0x167e93=_0x167e93-0x0;var _0x41d91b=_0x9f62[_0x167e93];return _0x41d91b;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x34e8,0x12c));var _0x834e=function(_0x48cba5,_0x4162b7){_0x48cba5=_0x48cba5-0x0;var _0x4aebf2=_0x34e8[_0x48cba5];return _0x4aebf2;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b0ee893..2782b2d 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 _0x1152=['code','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','userId','sessionId','answer\x20fired:','webbar:answer','hold\x20fired:','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','ioredis','redis','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','then'];(function(_0x363123,_0xc162aa){var _0x220234=function(_0x4f9520){while(--_0x4f9520){_0x363123['push'](_0x363123['shift']());}};_0x220234(++_0xc162aa);}(_0x1152,0x182));var _0x2115=function(_0x20be28,_0x24b925){_0x20be28=_0x20be28-0x0;var _0x8ab067=_0x1152[_0x20be28];return _0x8ab067;};'use strict';var path=require(_0x2115('0x0'));var fs=require('fs');var _=require(_0x2115('0x1'));var db=require(_0x2115('0x2'))['db'];var config=require(_0x2115('0x3'));var util=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var jayson=require(_0x2115('0x6'));var amiClient=jayson[_0x2115('0x7')]['http']({'port':0x232a});var logger=require(_0x2115('0x8'))('webbarapi');var Redis=require(_0x2115('0x9'));config[_0x2115('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x2115('0xb'));var originateValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],_0x2115('0xd')]},'callNumber':{'type':'string','required':[!![],_0x2115('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],_0x2115('0xd')]},'sessionId':{'type':_0x2115('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2115('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],_0x2115('0xd')]},'sessionId':{'type':_0x2115('0xf'),'required':[!![],_0x2115('0x10')]},'transferNumber':{'type':_0x2115('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2115('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],_0x2115('0xd')]},'sessionId':{'type':_0x2115('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],_0x2115('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2115('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xdf3e24,_0x21b589,_0xc97f87){logger[_0x2115('0x11')](_0xdf3e24,_0x21b589,JSON[_0x2115('0x12')](_0xc97f87));io['to'](_0xdf3e24)[_0x2115('0x13')](_0x21b589,_0xc97f87);}function handleError(_0x398015){return function(_0x77e2c6){console['log'](_0x2115('0x14'),_0x77e2c6,_0x77e2c6 instanceof RangeError);logger[_0x2115('0x15')](_0x77e2c6[_0x2115('0x16')]);if(_0x77e2c6 instanceof RangeError){if(_0x77e2c6['name']){delete _0x77e2c6[_0x2115('0x17')];}_0x398015[_0x2115('0x18')](0x194)[_0x2115('0x19')](_0x77e2c6);}else{if(_0x77e2c6[_0x2115('0x17')]){delete _0x77e2c6[_0x2115('0x17')];}_0x398015[_0x2115('0x18')](0x1f4)[_0x2115('0x19')](_0x77e2c6);}};}function checkError(){return function(_0x40070e){if(!_0x40070e){throw new RangeError(_0x2115('0x1a'));}return _0x40070e;};}function respondWithRpcPromise(_0x22ebb6,_0x1ddb2a){return new BPromise(function(_0x8b7304,_0x8e37c){var _0x13fde1=amiClient;return _0x13fde1['request'](_0x22ebb6,_0x1ddb2a)[_0x2115('0x1b')](function(_0x340c42){if(_0x340c42[_0x2115('0x15')]){if(_0x340c42[_0x2115('0x15')][_0x2115('0x1c')]===0x1f4){return _0x8e37c(_0x340c42[_0x2115('0x15')]['message']);}return _0x8b7304(_0x340c42['error']['message']);}else{_0x8b7304(_0x340c42[_0x2115('0x1d')]);}})[_0x2115('0x1e')](function(_0x1a2ec3){_0x8e37c(_0x1a2ec3);});});}function getAgent(_0x559ed3){return db[_0x2115('0x1f')][_0x2115('0x20')]({'where':{'id':_0x559ed3,'role':_0x2115('0x21')}})[_0x2115('0x1b')](checkError());}function getAgentCheckSession(_0x3ca0ef,_0x57acd4){return new BPromise(function(_0xc329ec,_0x2d1c09){var _0x4f3e8d=respondWithRpcPromise(_0x2115('0x22'));var _0x33d81c=getAgent(_0x3ca0ef);Promise[_0x2115('0x23')]([_0x4f3e8d,_0x33d81c])[_0x2115('0x1b')](function(_0x59ca70){var _0x19c595=_0x59ca70[0x0];var _0x15229e=_0x59ca70[0x1];var _0x12d148=_[_0x2115('0x24')](_0x19c595[_0x2115('0x25')],function(_0x27969d){return _0x27969d['UserId']==_0x15229e['id']&&_0x27969d['sessionId']==_0x57acd4;});if(_0x12d148[_0x2115('0x26')]==0x1){_0xc329ec(_0x15229e);}else{_0x2d1c09(new RangeError(_0x2115('0x27')+_0x57acd4+_0x2115('0x28')));}});});}exports[_0x2115('0x29')]=function(_0x32bc0c,_0x5bcc07){logger[_0x2115('0x11')](_0x2115('0x2a'),_0x32bc0c[_0x2115('0x2b')]);var _0x48a888=originateValidation[_0x2115('0xb')](_0x32bc0c['body']);if(_0x48a888[_0x2115('0x26')]>0x0){return _0x5bcc07['status'](0x190)[_0x2115('0x2c')](_0x48a888);}var _0x417bf4=_0x32bc0c[_0x2115('0x2b')]['userId'];var _0x56d41e=_0x32bc0c[_0x2115('0x2b')][_0x2115('0x2d')];var _0x4b36bb=_0x32bc0c[_0x2115('0x2b')][_0x2115('0x2e')];var _0x27f9e5=_0x32bc0c[_0x2115('0x2b')]['callbackUrl'];return getAgent(_0x417bf4)[_0x2115('0x1b')](function(_0x41c9dc){logger[_0x2115('0x11')](_0x2115('0x2f'),_0x41c9dc['name']);emit(util[_0x2115('0x30')](_0x2115('0x31'),_0x41c9dc[_0x2115('0x17')]),_0x2115('0x32'),{'callNumber':_0x56d41e,'callerId':_0x4b36bb,'callbackUrl':_0x27f9e5});return _0x5bcc07[_0x2115('0x18')](0xc8)[_0x2115('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0x2115('0x1e')](handleError(_0x5bcc07));};exports[_0x2115('0x33')]=function(_0xbe1268,_0xaf411a){logger[_0x2115('0x11')](_0x2115('0x34'),_0xbe1268['body']);var _0x130fee=hangupValidation['validate'](_0xbe1268['body']);if(_0x130fee[_0x2115('0x26')]>0x0){return _0xaf411a[_0x2115('0x18')](0x190)[_0x2115('0x2c')](_0x130fee);}var _0x14adc8=_0xbe1268[_0x2115('0x2b')][_0x2115('0x35')];var _0x4e9994=_0xbe1268[_0x2115('0x2b')][_0x2115('0x36')];return getAgent(_0x14adc8)[_0x2115('0x1b')](function(_0x19c159){logger[_0x2115('0x11')](_0x2115('0x2f'),_0x19c159[_0x2115('0x17')]);emit(util[_0x2115('0x30')](_0x2115('0x31'),_0x19c159[_0x2115('0x17')]),'webbar:hangup',{'sessionId':_0x4e9994});return _0xaf411a['status'](0xc8)[_0x2115('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0x2115('0x1e')](handleError(_0xaf411a));};exports['answer']=function(_0x54ec64,_0x55be95){logger[_0x2115('0x11')](_0x2115('0x37'),_0x54ec64[_0x2115('0x2b')]);var _0x96847d=answerValidation[_0x2115('0xb')](_0x54ec64['body']);if(_0x96847d[_0x2115('0x26')]>0x0){return _0x55be95['status'](0x190)[_0x2115('0x2c')](_0x96847d);}var _0x459028=_0x54ec64['body'][_0x2115('0x35')];var _0x309f46=_0x54ec64['body']['sessionId'];return getAgent(_0x459028)[_0x2115('0x1b')](function(_0x13bfc3){logger['info']('entityFound:',_0x13bfc3[_0x2115('0x17')]);emit(util[_0x2115('0x30')]('user:%s',_0x13bfc3['name']),_0x2115('0x38'),{'sessionId':_0x309f46});return _0x55be95[_0x2115('0x18')](0xc8)[_0x2115('0x2c')]({'error':![],'message':'answer\x20executed!'});})[_0x2115('0x1e')](handleError(_0x55be95));};exports['hold']=function(_0xd003d0,_0xc61152){logger[_0x2115('0x11')](_0x2115('0x39'),_0xd003d0[_0x2115('0x2b')]);var _0x4cf226=holdValidation[_0x2115('0xb')](_0xd003d0['body']);if(_0x4cf226['length']>0x0){return _0xc61152[_0x2115('0x18')](0x190)[_0x2115('0x2c')](_0x4cf226);}var _0x583575=_0xd003d0[_0x2115('0x2b')][_0x2115('0x35')];var _0x2a11a6=_0xd003d0[_0x2115('0x2b')][_0x2115('0x36')];return getAgent(_0x583575)[_0x2115('0x1b')](function(_0x41d1a4){logger[_0x2115('0x11')](_0x2115('0x2f'),_0x41d1a4['name']);emit(util[_0x2115('0x30')](_0x2115('0x31'),_0x41d1a4[_0x2115('0x17')]),'webbar:hold',{'sessionId':_0x2a11a6});return _0xc61152[_0x2115('0x18')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0xc61152));};exports[_0x2115('0x3a')]=function(_0x24d601,_0x4820c7){logger['info'](_0x2115('0x3b'),_0x24d601[_0x2115('0x2b')]);var _0x401f8f=unholdValidation[_0x2115('0xb')](_0x24d601[_0x2115('0x2b')]);if(_0x401f8f[_0x2115('0x26')]>0x0){return _0x4820c7[_0x2115('0x18')](0x190)[_0x2115('0x2c')](_0x401f8f);}var _0x5876d3=_0x24d601[_0x2115('0x2b')][_0x2115('0x35')];var _0x51b575=_0x24d601[_0x2115('0x2b')][_0x2115('0x36')];return getAgent(_0x5876d3)[_0x2115('0x1b')](function(_0x33bcfc){logger[_0x2115('0x11')](_0x2115('0x2f'),_0x33bcfc['name']);emit(util[_0x2115('0x30')](_0x2115('0x31'),_0x33bcfc['name']),'webbar:unhold',{'sessionId':_0x51b575});return _0x4820c7[_0x2115('0x18')](0xc8)[_0x2115('0x2c')]({'error':![],'message':_0x2115('0x3c')});})[_0x2115('0x1e')](handleError(_0x4820c7));};exports['calls']=function(_0x221b1e,_0x107d44){logger[_0x2115('0x11')](_0x2115('0x3d'),_0x107d44[_0x2115('0x2b')]);var _0x1bd210=callsValidation['validate'](_0x221b1e[_0x2115('0x2b')]);if(_0x1bd210[_0x2115('0x26')]>0x0){return _0x107d44['status'](0x190)[_0x2115('0x2c')](_0x1bd210);}var _0x34f5f0=_0x221b1e[_0x2115('0x2b')]['userId'];var _0x44c44e=respondWithRpcPromise('VoiceChannels');var _0xf39890=getAgent(_0x34f5f0);return Promise[_0x2115('0x23')]([_0x44c44e,_0xf39890])[_0x2115('0x1b')](function(_0x616f71){var _0x178d45=_0x616f71[0x0];var _0x31a52a=_0x616f71[0x1];var _0x4c8216=_[_0x2115('0x24')](_0x178d45[_0x2115('0x25')],function(_0x586c15){return _0x586c15[_0x2115('0x3e')]==_0x31a52a['id'];});return _0x107d44[_0x2115('0x18')](0xc8)[_0x2115('0x2c')]({'count':_0x4c8216['length'],'rows':_0x4c8216});})['catch'](handleError(_0x107d44));};exports['conference']=function(_0x3d7106,_0x48194b){logger[_0x2115('0x11')](_0x2115('0x3f'),_0x3d7106[_0x2115('0x2b')]);var _0x545616=conferenceValidation[_0x2115('0xb')](_0x3d7106['body']);if(_0x545616[_0x2115('0x26')]>0x0){return _0x48194b[_0x2115('0x18')](0x190)['json'](_0x545616);}var _0x47d7d2=_0x3d7106[_0x2115('0x2b')][_0x2115('0x35')];return getAgent(_0x47d7d2)['then'](function(_0x2a11e8){logger['info'](_0x2115('0x2f'),_0x2a11e8[_0x2115('0x17')]);emit(util['format'](_0x2115('0x31'),_0x2a11e8[_0x2115('0x17')]),_0x2115('0x40'));return _0x48194b[_0x2115('0x18')](0xc8)[_0x2115('0x2c')]({'error':![],'message':_0x2115('0x41')});})[_0x2115('0x1e')](handleError(_0x48194b));};exports[_0x2115('0x42')]=function(_0x2d2105,_0x1be769){logger[_0x2115('0x11')](_0x2115('0x43'),_0x2d2105[_0x2115('0x2b')]);var _0x84d526=transferValidation[_0x2115('0xb')](_0x2d2105[_0x2115('0x2b')]);if(_0x84d526[_0x2115('0x26')]>0x0){return _0x1be769[_0x2115('0x18')](0x190)['json'](_0x84d526);}var _0x27dbae=_0x2d2105[_0x2115('0x2b')][_0x2115('0x35')];var _0x1e3cc9=_0x2d2105[_0x2115('0x2b')][_0x2115('0x36')];var _0x2b21c8=_0x2d2105['body'][_0x2115('0x44')];return getAgent(_0x27dbae)[_0x2115('0x1b')](function(_0x126c08){logger['info'](_0x2115('0x2f'),_0x126c08[_0x2115('0x17')]);emit(util[_0x2115('0x30')](_0x2115('0x31'),_0x126c08[_0x2115('0x17')]),'webbar:transfer',{'sessionId':_0x1e3cc9,'transferNumber':_0x2b21c8});return _0x1be769[_0x2115('0x18')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x2115('0x1e')](handleError(_0x1be769));}; \ No newline at end of file +var _0xaf93=['callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','userId\x20is\x20required','string','number','sessionId\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','then','error','message','result','catch','User','findOne','VoiceChannels','filter','rows','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','callerId'];(function(_0x7327cf,_0xab1dc9){var _0x44aa77=function(_0x5d8fb3){while(--_0x5d8fb3){_0x7327cf['push'](_0x7327cf['shift']());}};_0x44aa77(++_0xab1dc9);}(_0xaf93,0x151));var _0x3af9=function(_0x53ac5b,_0x9cef1e){_0x53ac5b=_0x53ac5b-0x0;var _0x5738ca=_0xaf93[_0x53ac5b];return _0x5738ca;};'use strict';var path=require(_0x3af9('0x0'));var fs=require('fs');var _=require(_0x3af9('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3af9('0x4')][_0x3af9('0x5')]({'port':0x232a});var logger=require(_0x3af9('0x6'))(_0x3af9('0x7'));var Redis=require(_0x3af9('0x8'));config[_0x3af9('0x9')]=_[_0x3af9('0xa')](config['redis'],{'host':_0x3af9('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3af9('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3af9('0xc')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x3af9('0xd')},'callbackUrl':{'type':_0x3af9('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],_0x3af9('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],_0x3af9('0xc')]},'sessionId':{'type':_0x3af9('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],_0x3af9('0xc')]},'sessionId':{'type':_0x3af9('0xd'),'required':[!![],_0x3af9('0xf')]},'transferNumber':{'type':_0x3af9('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3af9('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],_0x3af9('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],_0x3af9('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3af9('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x278e80,_0x9c7d69,_0xa92aa4){logger[_0x3af9('0x10')](_0x278e80,_0x9c7d69,JSON['stringify'](_0xa92aa4));io['to'](_0x278e80)[_0x3af9('0x11')](_0x9c7d69,_0xa92aa4);}function handleError(_0xcf2214){return function(_0x298135){console[_0x3af9('0x12')](_0x3af9('0x13'),_0x298135,_0x298135 instanceof RangeError);logger['error'](_0x298135[_0x3af9('0x14')]);if(_0x298135 instanceof RangeError){if(_0x298135[_0x3af9('0x15')]){delete _0x298135[_0x3af9('0x15')];}_0xcf2214[_0x3af9('0x16')](0x194)[_0x3af9('0x17')](_0x298135);}else{if(_0x298135['name']){delete _0x298135[_0x3af9('0x15')];}_0xcf2214[_0x3af9('0x16')](0x1f4)[_0x3af9('0x17')](_0x298135);}};}function checkError(){return function(_0x1e0f4f){if(!_0x1e0f4f){throw new RangeError(_0x3af9('0x18'));}return _0x1e0f4f;};}function respondWithRpcPromise(_0x7d877e,_0x5e65b3){return new BPromise(function(_0x4a88ea,_0x505e25){var _0x5e24e3=amiClient;return _0x5e24e3['request'](_0x7d877e,_0x5e65b3)[_0x3af9('0x19')](function(_0x5c1c8f){if(_0x5c1c8f[_0x3af9('0x1a')]){if(_0x5c1c8f[_0x3af9('0x1a')]['code']===0x1f4){return _0x505e25(_0x5c1c8f['error']['message']);}return _0x4a88ea(_0x5c1c8f[_0x3af9('0x1a')][_0x3af9('0x1b')]);}else{_0x4a88ea(_0x5c1c8f[_0x3af9('0x1c')]);}})[_0x3af9('0x1d')](function(_0x240a16){_0x505e25(_0x240a16);});});}function getAgent(_0x149ee6){return db[_0x3af9('0x1e')][_0x3af9('0x1f')]({'where':{'id':_0x149ee6,'role':'agent'}})[_0x3af9('0x19')](checkError());}function getAgentCheckSession(_0x574b71,_0x485754){return new BPromise(function(_0x177650,_0xe1502){var _0x19643f=respondWithRpcPromise(_0x3af9('0x20'));var _0x374382=getAgent(_0x574b71);Promise['all']([_0x19643f,_0x374382])[_0x3af9('0x19')](function(_0x386297){var _0x165620=_0x386297[0x0];var _0x512b90=_0x386297[0x1];var _0x4f5024=_[_0x3af9('0x21')](_0x165620[_0x3af9('0x22')],function(_0x8867c6){return _0x8867c6['UserId']==_0x512b90['id']&&_0x8867c6[_0x3af9('0x23')]==_0x485754;});if(_0x4f5024[_0x3af9('0x24')]==0x1){_0x177650(_0x512b90);}else{_0xe1502(new RangeError(_0x3af9('0x25')+_0x485754+'\x20not\x20found!'));}});});}exports[_0x3af9('0x26')]=function(_0x38b120,_0x407572){logger['info'](_0x3af9('0x27'),_0x38b120[_0x3af9('0x28')]);var _0x1d7460=originateValidation['validate'](_0x38b120[_0x3af9('0x28')]);if(_0x1d7460[_0x3af9('0x24')]>0x0){return _0x407572['status'](0x190)[_0x3af9('0x29')](_0x1d7460);}var _0x588d5b=_0x38b120[_0x3af9('0x28')]['userId'];var _0x510940=_0x38b120[_0x3af9('0x28')]['callNumber'];var _0x30c9f0=_0x38b120[_0x3af9('0x28')][_0x3af9('0x2a')];var _0x4dfdb3=_0x38b120['body'][_0x3af9('0x2b')];return getAgent(_0x588d5b)[_0x3af9('0x19')](function(_0x4df48b){logger['info'](_0x3af9('0x2c'),_0x4df48b['name']);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x4df48b['name']),'webbar:originate',{'callNumber':_0x510940,'callerId':_0x30c9f0,'callbackUrl':_0x4dfdb3});return _0x407572[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x2f')});})[_0x3af9('0x1d')](handleError(_0x407572));};exports[_0x3af9('0x30')]=function(_0x547615,_0x569425){logger[_0x3af9('0x10')](_0x3af9('0x31'),_0x547615[_0x3af9('0x28')]);var _0x241f26=hangupValidation['validate'](_0x547615['body']);if(_0x241f26[_0x3af9('0x24')]>0x0){return _0x569425[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x241f26);}var _0x591ebc=_0x547615[_0x3af9('0x28')][_0x3af9('0x32')];var _0x6b9a0c=_0x547615['body'][_0x3af9('0x23')];return getAgent(_0x591ebc)['then'](function(_0x1f3ac9){logger[_0x3af9('0x10')](_0x3af9('0x2c'),_0x1f3ac9[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x1f3ac9[_0x3af9('0x15')]),_0x3af9('0x33'),{'sessionId':_0x6b9a0c});return _0x569425[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x34')});})['catch'](handleError(_0x569425));};exports[_0x3af9('0x35')]=function(_0x34dc9a,_0x40c1de){logger[_0x3af9('0x10')](_0x3af9('0x36'),_0x34dc9a[_0x3af9('0x28')]);var _0x3722a8=answerValidation[_0x3af9('0x37')](_0x34dc9a[_0x3af9('0x28')]);if(_0x3722a8[_0x3af9('0x24')]>0x0){return _0x40c1de[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x3722a8);}var _0x549274=_0x34dc9a['body'][_0x3af9('0x32')];var _0x1daea4=_0x34dc9a[_0x3af9('0x28')][_0x3af9('0x23')];return getAgent(_0x549274)[_0x3af9('0x19')](function(_0x14b930){logger[_0x3af9('0x10')](_0x3af9('0x2c'),_0x14b930[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x14b930[_0x3af9('0x15')]),_0x3af9('0x38'),{'sessionId':_0x1daea4});return _0x40c1de['status'](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x39')});})[_0x3af9('0x1d')](handleError(_0x40c1de));};exports[_0x3af9('0x3a')]=function(_0x4e2803,_0x4d3b13){logger[_0x3af9('0x10')]('hold\x20fired:',_0x4e2803[_0x3af9('0x28')]);var _0x426082=holdValidation[_0x3af9('0x37')](_0x4e2803[_0x3af9('0x28')]);if(_0x426082['length']>0x0){return _0x4d3b13[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x426082);}var _0x37cdcc=_0x4e2803['body']['userId'];var _0x3cd467=_0x4e2803['body']['sessionId'];return getAgent(_0x37cdcc)['then'](function(_0x19bd47){logger[_0x3af9('0x10')](_0x3af9('0x2c'),_0x19bd47[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x19bd47[_0x3af9('0x15')]),'webbar:hold',{'sessionId':_0x3cd467});return _0x4d3b13[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x3b')});})[_0x3af9('0x1d')](handleError(_0x4d3b13));};exports[_0x3af9('0x3c')]=function(_0x1104d4,_0x5019ff){logger[_0x3af9('0x10')](_0x3af9('0x3d'),_0x1104d4[_0x3af9('0x28')]);var _0x431c8d=unholdValidation['validate'](_0x1104d4[_0x3af9('0x28')]);if(_0x431c8d[_0x3af9('0x24')]>0x0){return _0x5019ff[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x431c8d);}var _0x505a75=_0x1104d4[_0x3af9('0x28')][_0x3af9('0x32')];var _0x17713a=_0x1104d4[_0x3af9('0x28')]['sessionId'];return getAgent(_0x505a75)['then'](function(_0x39f188){logger[_0x3af9('0x10')](_0x3af9('0x2c'),_0x39f188[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x39f188[_0x3af9('0x15')]),_0x3af9('0x3e'),{'sessionId':_0x17713a});return _0x5019ff[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x3f')});})['catch'](handleError(_0x5019ff));};exports[_0x3af9('0x40')]=function(_0x3cde20,_0x4c505e){logger['info'](_0x3af9('0x41'),_0x4c505e['body']);var _0x27f717=callsValidation[_0x3af9('0x37')](_0x3cde20['body']);if(_0x27f717['length']>0x0){return _0x4c505e[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x27f717);}var _0x1c7625=_0x3cde20[_0x3af9('0x28')]['userId'];var _0x3ed77e=respondWithRpcPromise('VoiceChannels');var _0x180a32=getAgent(_0x1c7625);return Promise[_0x3af9('0x42')]([_0x3ed77e,_0x180a32])[_0x3af9('0x19')](function(_0x58b2ff){var _0x476650=_0x58b2ff[0x0];var _0x1d6c31=_0x58b2ff[0x1];var _0x9c28e9=_[_0x3af9('0x21')](_0x476650['rows'],function(_0x1fb137){return _0x1fb137[_0x3af9('0x43')]==_0x1d6c31['id'];});return _0x4c505e[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'count':_0x9c28e9[_0x3af9('0x24')],'rows':_0x9c28e9});})[_0x3af9('0x1d')](handleError(_0x4c505e));};exports[_0x3af9('0x44')]=function(_0x58ad44,_0x1e3ca5){logger[_0x3af9('0x10')](_0x3af9('0x45'),_0x58ad44[_0x3af9('0x28')]);var _0x260f65=conferenceValidation['validate'](_0x58ad44[_0x3af9('0x28')]);if(_0x260f65[_0x3af9('0x24')]>0x0){return _0x1e3ca5[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x260f65);}var _0x15d16a=_0x58ad44[_0x3af9('0x28')][_0x3af9('0x32')];return getAgent(_0x15d16a)[_0x3af9('0x19')](function(_0x40051e){logger[_0x3af9('0x10')]('entityFound:',_0x40051e[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0x40051e[_0x3af9('0x15')]),'webbar:conference');return _0x1e3ca5[_0x3af9('0x16')](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x46')});})[_0x3af9('0x1d')](handleError(_0x1e3ca5));};exports[_0x3af9('0x47')]=function(_0x3157ab,_0x438950){logger['info'](_0x3af9('0x48'),_0x3157ab['body']);var _0x30d746=transferValidation[_0x3af9('0x37')](_0x3157ab[_0x3af9('0x28')]);if(_0x30d746[_0x3af9('0x24')]>0x0){return _0x438950[_0x3af9('0x16')](0x190)[_0x3af9('0x29')](_0x30d746);}var _0x50c934=_0x3157ab[_0x3af9('0x28')]['userId'];var _0xc5900=_0x3157ab[_0x3af9('0x28')][_0x3af9('0x23')];var _0x3e88eb=_0x3157ab['body'][_0x3af9('0x49')];return getAgent(_0x50c934)[_0x3af9('0x19')](function(_0xbfd997){logger[_0x3af9('0x10')](_0x3af9('0x2c'),_0xbfd997[_0x3af9('0x15')]);emit(util[_0x3af9('0x2d')](_0x3af9('0x2e'),_0xbfd997[_0x3af9('0x15')]),_0x3af9('0x4a'),{'sessionId':_0xc5900,'transferNumber':_0x3e88eb});return _0x438950['status'](0xc8)[_0x3af9('0x29')]({'error':![],'message':_0x3af9('0x4b')});})[_0x3af9('0x1d')](handleError(_0x438950));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f7a95f9..135e5d6 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 _0x9582=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addApplications','/:id/notify','/:id/send','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9582,0x95));var _0x2958=function(_0x150492,_0x577d10){_0x150492=_0x150492-0x0;var _0x213187=_0x9582[_0x150492];return _0x213187;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['describe']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['get'](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0xa')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);router['get'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x15')]);router[_0x2958('0xa')](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x17')]);router[_0x2958('0x18')]('/',auth['isAuthenticated'](),controller[_0x2958('0x19')]);router[_0x2958('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2958('0x1a')]);router[_0x2958('0x18')]('/:id/canned_answers',auth[_0x2958('0xb')](),controller['addAnswer']);router['post'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller['addAgents']);router['post'](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x1b')]);router[_0x2958('0x18')](_0x2958('0x1c'),controller['notify']);router[_0x2958('0x18')](_0x2958('0x1d'),auth[_0x2958('0xb')](),controller['send']);router[_0x2958('0x1e')]('/:id',auth[_0x2958('0xb')](),controller['update']);router['delete'](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x1f')]);router[_0x2958('0x20')](_0x2958('0x10'),auth[_0x2958('0xb')](),controller[_0x2958('0x21')]);router[_0x2958('0x20')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x22')]);router[_0x2958('0x20')](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8e3f=['addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create'];(function(_0xab4097,_0x335b33){var _0x2c7a21=function(_0x1f76ef){while(--_0x1f76ef){_0xab4097['push'](_0xab4097['shift']());}};_0x2c7a21(++_0x335b33);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var fs_extra=require(_0xf8e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var controller=require('./whatsappAccount.controller');router[_0xf8e3('0x8')]('/',auth[_0xf8e3('0x9')](),controller[_0xf8e3('0xa')]);router[_0xf8e3('0x8')]('/describe',auth[_0xf8e3('0x9')](),controller[_0xf8e3('0xb')]);router[_0xf8e3('0x8')](_0xf8e3('0xc'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0xd')]);router[_0xf8e3('0x8')](_0xf8e3('0xe'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0xf')]);router[_0xf8e3('0x8')](_0xf8e3('0x10'),auth['isAuthenticated'](),controller[_0xf8e3('0x11')]);router[_0xf8e3('0x8')](_0xf8e3('0x12'),auth['isAuthenticated'](),controller[_0xf8e3('0x13')]);router[_0xf8e3('0x8')](_0xf8e3('0x14'),auth[_0xf8e3('0x9')](),controller['getApplications']);router[_0xf8e3('0x15')]('/',auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x16')]);router['post'](_0xf8e3('0xe'),auth['isAuthenticated'](),controller[_0xf8e3('0x17')]);router[_0xf8e3('0x15')](_0xf8e3('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xf8e3('0x15')](_0xf8e3('0x12'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x18')]);router[_0xf8e3('0x15')](_0xf8e3('0x14'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x19')]);router[_0xf8e3('0x15')](_0xf8e3('0x1a'),controller['notify']);router[_0xf8e3('0x15')](_0xf8e3('0x1b'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x1c')]);router[_0xf8e3('0x1d')](_0xf8e3('0xc'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x1e')]);router['delete'](_0xf8e3('0xc'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x1f')]);router[_0xf8e3('0x20')]('/:id/dispositions',auth[_0xf8e3('0x9')](),controller['removeDispositions']);router[_0xf8e3('0x20')](_0xf8e3('0x10'),auth[_0xf8e3('0x9')](),controller[_0xf8e3('0x21')]);router[_0xf8e3('0x20')](_0xf8e3('0x12'),auth['isAuthenticated'](),controller[_0xf8e3('0x22')]);module[_0xf8e3('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 80870f3..8efe5d1 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 _0x8599=['sinch','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8599,0xea));var _0x9859=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8599[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9859('0x0'));module[_0x9859('0x1')]={'name':{'type':Sequelize[_0x9859('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9859('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9859('0x4')](_0x9859('0x5'),_0x9859('0x6'))},'accountSid':{'type':Sequelize[_0x9859('0x2')]},'baseUrl':{'type':Sequelize[_0x9859('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9859('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9859('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9859('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9859('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9859('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9859('0x8')],'comment':_0x9859('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9859('0xb'),'set':function(_0x5731da){if(!_0x5731da){this[_0x9859('0xc')](_0x9859('0xd'),null);}this['setDataValue'](_0x9859('0xe'),_0x5731da);}},'description':{'type':Sequelize[_0x9859('0x2')]}}; \ No newline at end of file +var _0xd924=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x236304,_0x3cbc48){var _0x56566f=function(_0x14e065){while(--_0x14e065){_0x236304['push'](_0x236304['shift']());}};_0x56566f(++_0x3cbc48);}(_0xd924,0x8d));var _0x4d92=function(_0x420f39,_0x67e5fd){_0x420f39=_0x420f39-0x0;var _0xa4296a=_0xd924[_0x420f39];return _0xa4296a;};'use strict';var Sequelize=require(_0x4d92('0x0'));var rs=require(_0x4d92('0x1'));module[_0x4d92('0x2')]={'name':{'type':Sequelize[_0x4d92('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4d92('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4d92('0x3')],'defaultValue':function(){return rs[_0x4d92('0x4')]();}},'phone':{'type':Sequelize[_0x4d92('0x3')]},'type':{'type':Sequelize[_0x4d92('0x5')](_0x4d92('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x4d92('0x3')]},'baseUrl':{'type':Sequelize[_0x4d92('0x3')]},'authToken':{'type':Sequelize[_0x4d92('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4d92('0x7')],'defaultValue':function(){return _0x4d92('0x8');}},'notificationSound':{'type':Sequelize[_0x4d92('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4d92('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4d92('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4d92('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d92('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4d92('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4d92('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4d92('0xb'),'set':function(_0x405fea){if(!_0x405fea){this[_0x4d92('0xc')](_0x4d92('0xd'),null);}this[_0x4d92('0xc')](_0x4d92('0xe'),_0x405fea);}},'description':{'type':Sequelize[_0x4d92('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 79c9d51..67cbc94 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 _0xb76b=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','update','then','destroy','WhatsappAccounts','UserProfileResource','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','Pause','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','findOne','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','Contacts','DESC','list','omit','WhatsappInteraction','created','applications','unmanaged','*,*,*,*','interaction','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x191511,_0x4a5344){var _0x41a521=function(_0x5f0ef9){while(--_0x5f0ef9){_0x191511['push'](_0x191511['shift']());}};_0x41a521(++_0x4a5344);}(_0xb76b,0xbe));var _0xbb76=function(_0x14aeae,_0x119228){_0x14aeae=_0x14aeae-0x0;var _0x3fc266=_0xb76b[_0x14aeae];return _0x3fc266;};'use strict';var emlformat=require(_0xbb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb76('0x1'));var jsonpatch=require(_0xbb76('0x2'));var rp=require(_0xbb76('0x3'));var moment=require(_0xbb76('0x4'));var BPromise=require(_0xbb76('0x5'));var Mustache=require(_0xbb76('0x6'));var util=require(_0xbb76('0x7'));var path=require(_0xbb76('0x8'));var sox=require('sox');var csv=require(_0xbb76('0x9'));var ejs=require(_0xbb76('0xa'));var fs=require('fs');var fs_extra=require(_0xbb76('0xb'));var _=require(_0xbb76('0xc'));var squel=require(_0xbb76('0xd'));var crypto=require(_0xbb76('0xe'));var jsforce=require(_0xbb76('0xf'));var deskjs=require(_0xbb76('0x10'));var toCsv=require(_0xbb76('0x9'));var querystring=require(_0xbb76('0x11'));var Papa=require('papaparse');var Redis=require(_0xbb76('0x12'));var authService=require(_0xbb76('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbb76('0x14'));var hardwareService=require(_0xbb76('0x15'));var logger=require(_0xbb76('0x16'))(_0xbb76('0x17'));var utils=require(_0xbb76('0x18'));var config=require(_0xbb76('0x19'));var licenseUtil=require(_0xbb76('0x1a'));var db=require(_0xbb76('0x1b'))['db'];config[_0xbb76('0x1c')]=_[_0xbb76('0x1d')](config[_0xbb76('0x1c')],{'host':_0xbb76('0x1e'),'port':0x18eb});var socket=require(_0xbb76('0x1f'))(new Redis(config['redis']));require(_0xbb76('0x20'))[_0xbb76('0x21')](socket);var jayson=require(_0xbb76('0x22'));var client=jayson[_0xbb76('0x23')][_0xbb76('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x149693,_0x5bfedc,_0x51d4ba,_0x599af8){return new BPromise(function(_0x5a5349,_0x9be105){var _0x3bc08c=_0x599af8||client;return _0x3bc08c[_0xbb76('0x25')](_0x149693,_0x51d4ba)['then'](function(_0x542c5c){logger[_0xbb76('0x26')](_0xbb76('0x27'),_0x5bfedc,'request\x20sent');logger[_0xbb76('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5bfedc,_0xbb76('0x29'),JSON[_0xbb76('0x2a')](_0x542c5c));if(_0x542c5c[_0xbb76('0x2b')]){if(_0x542c5c['error'][_0xbb76('0x2c')]===0x1f4){logger[_0xbb76('0x2b')](_0xbb76('0x27'),_0x5bfedc,_0x542c5c[_0xbb76('0x2b')][_0xbb76('0x2d')]);return _0x9be105(_0x542c5c[_0xbb76('0x2b')][_0xbb76('0x2d')]);}logger[_0xbb76('0x2b')](_0xbb76('0x27'),_0x5bfedc,_0x542c5c['error'][_0xbb76('0x2d')]);return _0x5a5349(_0x542c5c[_0xbb76('0x2b')][_0xbb76('0x2d')]);}else{logger[_0xbb76('0x26')](_0xbb76('0x27'),_0x5bfedc,_0xbb76('0x29'));_0x5a5349(_0x542c5c[_0xbb76('0x2e')][_0xbb76('0x2d')]);}})['catch'](function(_0x5b24f5){logger['error'](_0xbb76('0x27'),_0x5bfedc,_0x5b24f5);_0x9be105(_0x5b24f5);});});}function respondWithStatusCode(_0x5e15fa,_0x47083d){_0x47083d=_0x47083d||0xcc;return function(_0x46672c){if(_0x46672c){return _0x5e15fa[_0xbb76('0x2f')](_0x47083d);}return _0x5e15fa['status'](_0x47083d)[_0xbb76('0x30')]();};}function respondWithResult(_0x45e4d5,_0x359fff){_0x359fff=_0x359fff||0xc8;return function(_0x1c3891){if(_0x1c3891){return _0x45e4d5[_0xbb76('0x31')](_0x359fff)[_0xbb76('0x32')](_0x1c3891);}};}function respondWithFilteredResult(_0x1352fc,_0x19920f){return function(_0xaec884){if(_0xaec884){var _0x5c2430=typeof _0x19920f[_0xbb76('0x33')]==='undefined'&&typeof _0x19920f[_0xbb76('0x34')]===_0xbb76('0x35');var _0x356538=_0xaec884[_0xbb76('0x36')];var _0x33bdba=_0x5c2430?0x0:_0x19920f[_0xbb76('0x33')];var _0x4bb8e8=_0x5c2430?_0xaec884[_0xbb76('0x36')]:_0x19920f[_0xbb76('0x33')]+_0x19920f[_0xbb76('0x34')];var _0x2cdef8;if(_0x4bb8e8>=_0x356538){_0x4bb8e8=_0x356538;_0x2cdef8=0xc8;}else{_0x2cdef8=0xce;}_0x1352fc[_0xbb76('0x31')](_0x2cdef8);return _0x1352fc['set']('Content-Range',_0x33bdba+'-'+_0x4bb8e8+'/'+_0x356538)[_0xbb76('0x32')](_0xaec884);}return null;};}function patchUpdates(_0x320b3e){return function(_0x10db12){try{jsonpatch[_0xbb76('0x37')](_0x10db12,_0x320b3e,!![]);}catch(_0x571a8a){return BPromise[_0xbb76('0x38')](_0x571a8a);}return _0x10db12['save']();};}function saveUpdates(_0x699c72,_0x44adc5){return function(_0x47e569){if(_0x47e569){return _0x47e569[_0xbb76('0x39')](_0x699c72)[_0xbb76('0x3a')](function(_0x5d6376){return _0x5d6376;});}return null;};}function removeEntity(_0x4182bf,_0x275e2){return function(_0x14e0e4){if(_0x14e0e4){return _0x14e0e4[_0xbb76('0x3b')]()['then'](function(){var _0x5be3bb=_0x14e0e4['get']({'plain':!![]});var _0x306f74=_0xbb76('0x3c');return db[_0xbb76('0x3d')][_0xbb76('0x3b')]({'where':{'type':_0x306f74,'resourceId':_0x5be3bb['id']}})[_0xbb76('0x3a')](function(){return _0x14e0e4;});})['then'](function(){_0x4182bf[_0xbb76('0x31')](0xcc)[_0xbb76('0x30')]();});}};}function handleEntityNotFound(_0x523da7,_0x259436){return function(_0x38877e){if(!_0x38877e){_0x523da7['sendStatus'](0x194);}return _0x38877e;};}function handleError(_0x2af3a4,_0x5d0723){_0x5d0723=_0x5d0723||0x1f4;return function(_0x3983b9){logger[_0xbb76('0x2b')](_0x3983b9['stack']);if(_0x3983b9['name']){delete _0x3983b9[_0xbb76('0x3e')];}_0x2af3a4['status'](_0x5d0723)['send'](_0x3983b9);};}exports['index']=function(_0x15945d,_0x392870){var _0x6b7f5c={'include':[{'model':db['Pause'],'as':_0xbb76('0x3f')}]},_0x2057c5={},_0x2fe2a2={'count':0x0,'rows':[]};var _0x222116=_[_0xbb76('0x40')](db[_0xbb76('0x41')][_0xbb76('0x42')],function(_0x103899){return{'name':_0x103899[_0xbb76('0x43')],'type':_0x103899[_0xbb76('0x44')]['key']};});_0x2057c5['model']=_[_0xbb76('0x40')](_0x222116,'name');_0x2057c5[_0xbb76('0x45')]=_[_0xbb76('0x46')](_0x15945d[_0xbb76('0x45')]);_0x2057c5[_0xbb76('0x47')]=_[_0xbb76('0x48')](_0x2057c5[_0xbb76('0x49')],_0x2057c5[_0xbb76('0x45')]);_0x6b7f5c['attributes']=_['intersection'](_0x2057c5[_0xbb76('0x49')],qs[_0xbb76('0x4a')](_0x15945d[_0xbb76('0x45')][_0xbb76('0x4a')]));_0x6b7f5c[_0xbb76('0x4b')]=_0x6b7f5c[_0xbb76('0x4b')][_0xbb76('0x4c')]?_0x6b7f5c[_0xbb76('0x4b')]:_0x2057c5[_0xbb76('0x49')];if(!_0x15945d[_0xbb76('0x45')][_0xbb76('0x4d')](_0xbb76('0x4e'))){_0x6b7f5c[_0xbb76('0x34')]=qs[_0xbb76('0x34')](_0x15945d[_0xbb76('0x45')]['limit']);_0x6b7f5c['offset']=qs[_0xbb76('0x33')](_0x15945d[_0xbb76('0x45')][_0xbb76('0x33')]);}_0x6b7f5c['order']=qs['sort'](_0x15945d['query'][_0xbb76('0x4f')]);_0x6b7f5c[_0xbb76('0x50')]=qs[_0xbb76('0x47')](_['pick'](_0x15945d[_0xbb76('0x45')],_0x2057c5['filters']),_0x222116);if(_0x15945d[_0xbb76('0x45')]['filter']){_0x6b7f5c[_0xbb76('0x50')]=_[_0xbb76('0x51')](_0x6b7f5c[_0xbb76('0x50')],{'$or':_['map'](_0x222116,function(_0x3e7387){if(_0x3e7387[_0xbb76('0x44')]!==_0xbb76('0x52')){var _0x2201cd={};_0x2201cd[_0x3e7387[_0xbb76('0x3e')]]={'$like':'%'+_0x15945d['query'][_0xbb76('0x53')]+'%'};return _0x2201cd;}})});}_0x6b7f5c=_[_0xbb76('0x51')]({},_0x6b7f5c,_0x15945d['options']);var _0xb7b98={'where':_0x6b7f5c[_0xbb76('0x50')]};return db[_0xbb76('0x41')][_0xbb76('0x36')](_0xb7b98)[_0xbb76('0x3a')](function(_0x3a266c){_0x2fe2a2[_0xbb76('0x36')]=_0x3a266c;if(_0x15945d[_0xbb76('0x45')][_0xbb76('0x54')]){_0x6b7f5c[_0xbb76('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xbb76('0x56')](_0x6b7f5c);})[_0xbb76('0x3a')](function(_0x179b30){_0x2fe2a2[_0xbb76('0x57')]=_0x179b30;return _0x2fe2a2;})[_0xbb76('0x3a')](respondWithFilteredResult(_0x392870,_0x6b7f5c))[_0xbb76('0x58')](handleError(_0x392870,null));};exports[_0xbb76('0x59')]=function(_0x465aac,_0x147d41){var _0x2ec6fb={'raw':![],'where':{'id':_0x465aac['params']['id']},'include':[{'model':db[_0xbb76('0x5a')],'as':'mandatoryDispositionPause'}]},_0x304056={};_0x304056['model']=_[_0xbb76('0x46')](db[_0xbb76('0x41')][_0xbb76('0x42')]);_0x304056[_0xbb76('0x45')]=_['keys'](_0x465aac[_0xbb76('0x45')]);_0x304056[_0xbb76('0x47')]=_['intersection'](_0x304056[_0xbb76('0x49')],_0x304056['query']);_0x2ec6fb['attributes']=_['intersection'](_0x304056[_0xbb76('0x49')],qs[_0xbb76('0x4a')](_0x465aac[_0xbb76('0x45')][_0xbb76('0x4a')]));_0x2ec6fb[_0xbb76('0x4b')]=_0x2ec6fb[_0xbb76('0x4b')][_0xbb76('0x4c')]?_0x2ec6fb['attributes']:_0x304056[_0xbb76('0x49')];if(_0x465aac['query'][_0xbb76('0x54')]){_0x2ec6fb[_0xbb76('0x55')]=[{'all':!![]}];}_0x2ec6fb=_[_0xbb76('0x51')]({},_0x2ec6fb,_0x465aac[_0xbb76('0x5b')]);return db[_0xbb76('0x41')]['find'](_0x2ec6fb)['then'](handleEntityNotFound(_0x147d41,null))[_0xbb76('0x3a')](respondWithResult(_0x147d41,null))[_0xbb76('0x58')](handleError(_0x147d41,null));};exports['create']=function(_0x21983c,_0x3699ce){return db['WhatsappAccount'][_0xbb76('0x5c')](_0x21983c[_0xbb76('0x5d')],{})[_0xbb76('0x3a')](function(_0x573f6f){var _0x246759=_0x21983c[_0xbb76('0x5e')]['get']({'plain':!![]});if(!_0x246759)throw new Error(_0xbb76('0x5f'));if(_0x246759[_0xbb76('0x60')]===_0xbb76('0x5e')){var _0x375439=_0x573f6f[_0xbb76('0x61')]({'plain':!![]});var _0x266ae5=_0xbb76('0x3c');return db[_0xbb76('0x62')][_0xbb76('0x63')]({'where':{'name':_0x266ae5,'userProfileId':_0x246759[_0xbb76('0x64')]},'raw':!![]})[_0xbb76('0x3a')](function(_0x349935){if(_0x349935&&_0x349935[_0xbb76('0x65')]===0x0){return db[_0xbb76('0x3d')][_0xbb76('0x5c')]({'name':_0x375439[_0xbb76('0x3e')],'resourceId':_0x375439['id'],'type':_0x349935[_0xbb76('0x3e')],'sectionId':_0x349935['id']},{})[_0xbb76('0x3a')](function(){return _0x573f6f;});}else{return _0x573f6f;}})[_0xbb76('0x58')](function(_0xb57d86){logger[_0xbb76('0x2b')](_0xbb76('0x66'),_0xb57d86);throw _0xb57d86;});}return _0x573f6f;})[_0xbb76('0x3a')](respondWithResult(_0x3699ce,0xc9))[_0xbb76('0x58')](handleError(_0x3699ce,null));};exports[_0xbb76('0x39')]=function(_0x2d9271,_0x2b5091){if(_0x2d9271['body']['id']){delete _0x2d9271[_0xbb76('0x5d')]['id'];}return db[_0xbb76('0x41')][_0xbb76('0x63')]({'where':{'id':_0x2d9271[_0xbb76('0x67')]['id']},'include':[{'model':db[_0xbb76('0x5a')],'as':_0xbb76('0x3f')}]})[_0xbb76('0x3a')](handleEntityNotFound(_0x2b5091,null))[_0xbb76('0x3a')](saveUpdates(_0x2d9271['body'],null))['then'](respondWithResult(_0x2b5091,null))[_0xbb76('0x58')](handleError(_0x2b5091,null));};exports[_0xbb76('0x3b')]=function(_0x2b7b96,_0x50d2e4){return db[_0xbb76('0x41')]['find']({'where':{'id':_0x2b7b96[_0xbb76('0x67')]['id']}})[_0xbb76('0x3a')](handleEntityNotFound(_0x50d2e4,null))[_0xbb76('0x3a')](removeEntity(_0x50d2e4,null))['catch'](handleError(_0x50d2e4,null));};exports['describe']=function(_0x9399dc,_0x5c4e1a){return db[_0xbb76('0x41')][_0xbb76('0x68')]()[_0xbb76('0x3a')](respondWithResult(_0x5c4e1a,null))[_0xbb76('0x58')](handleError(_0x5c4e1a,null));};exports['addDisposition']=function(_0x337aa7,_0x286157,_0x313448){if(_0x337aa7['body']['id']){delete _0x337aa7['body']['id'];}return db[_0xbb76('0x41')]['find']({'where':{'id':_0x337aa7[_0xbb76('0x67')]['id']}})[_0xbb76('0x3a')](handleEntityNotFound(_0x286157,null))[_0xbb76('0x3a')](function(_0x54f807){if(_0x54f807){_0x337aa7[_0xbb76('0x5d')][_0xbb76('0x69')]=_0x54f807['id'];return db['Disposition']['create'](_0x337aa7[_0xbb76('0x5d')]);}})[_0xbb76('0x3a')](respondWithResult(_0x286157,null))[_0xbb76('0x58')](handleError(_0x286157,null));};exports['getDispositions']=function(_0x464505,_0x574209,_0x1e8b20){var _0x58ea47={'raw':![],'where':{}};var _0x4ab820={};var _0x3f4943={'count':0x0,'rows':[]};return db[_0xbb76('0x41')][_0xbb76('0x6a')]({'where':{'id':_0x464505[_0xbb76('0x67')]['id']}})['then'](handleEntityNotFound(_0x574209,null))['then'](function(_0x3b5c79){if(_0x3b5c79){_0x4ab820[_0xbb76('0x49')]=_[_0xbb76('0x46')](db[_0xbb76('0x6b')][_0xbb76('0x42')]);_0x4ab820[_0xbb76('0x45')]=_[_0xbb76('0x46')](_0x464505[_0xbb76('0x45')]);_0x4ab820[_0xbb76('0x47')]=_[_0xbb76('0x48')](_0x4ab820[_0xbb76('0x49')],_0x4ab820[_0xbb76('0x45')]);_0x58ea47[_0xbb76('0x4b')]=_[_0xbb76('0x48')](_0x4ab820[_0xbb76('0x49')],qs['fields'](_0x464505[_0xbb76('0x45')]['fields']));_0x58ea47['attributes']=_0x58ea47[_0xbb76('0x4b')][_0xbb76('0x4c')]?_0x58ea47[_0xbb76('0x4b')]:_0x4ab820[_0xbb76('0x49')];if(!_0x464505[_0xbb76('0x45')][_0xbb76('0x4d')](_0xbb76('0x4e'))){_0x58ea47['limit']=qs[_0xbb76('0x34')](_0x464505[_0xbb76('0x45')][_0xbb76('0x34')]);_0x58ea47[_0xbb76('0x33')]=qs[_0xbb76('0x33')](_0x464505['query'][_0xbb76('0x33')]);}_0x58ea47['order']=qs[_0xbb76('0x4f')](_0x464505['query']['sort']);_0x58ea47[_0xbb76('0x50')]=qs[_0xbb76('0x47')](_[_0xbb76('0x6c')](_0x464505[_0xbb76('0x45')],_0x4ab820[_0xbb76('0x47')]));_0x58ea47['where']['WhatsappAccountId']=_0x3b5c79['id'];if(_0x464505[_0xbb76('0x45')]['filter']){_0x58ea47[_0xbb76('0x50')]=_[_0xbb76('0x51')](_0x58ea47['where'],{'$or':_[_0xbb76('0x40')](_0x58ea47['attributes'],function(_0x4811e0){var _0x3dfe9d={};_0x3dfe9d[_0x4811e0]={'$like':'%'+_0x464505[_0xbb76('0x45')][_0xbb76('0x53')]+'%'};return _0x3dfe9d;})});}_0x58ea47=_[_0xbb76('0x51')]({},_0x58ea47,_0x464505[_0xbb76('0x5b')]);return db[_0xbb76('0x6b')][_0xbb76('0x36')]({'where':_0x58ea47[_0xbb76('0x50')]})['then'](function(_0x3d859e){_0x3f4943[_0xbb76('0x36')]=_0x3d859e;if(_0x464505[_0xbb76('0x45')][_0xbb76('0x54')]){_0x58ea47[_0xbb76('0x55')]=[{'all':!![]}];}return db[_0xbb76('0x6b')][_0xbb76('0x56')](_0x58ea47);})[_0xbb76('0x3a')](function(_0x30d512){_0x3f4943[_0xbb76('0x57')]=_0x30d512;return _0x3f4943;});}})[_0xbb76('0x3a')](respondWithFilteredResult(_0x574209,_0x58ea47))[_0xbb76('0x58')](handleError(_0x574209,null));};exports[_0xbb76('0x6d')]=function(_0x400be5,_0xda35e1,_0x44ba3f){return db['WhatsappAccount'][_0xbb76('0x63')]({'where':{'id':_0x400be5[_0xbb76('0x67')]['id']}})['then'](handleEntityNotFound(_0xda35e1,null))[_0xbb76('0x3a')](function(_0x3c5c53){if(_0x3c5c53){return _0x3c5c53[_0xbb76('0x6d')](_0x400be5['query'][_0xbb76('0x6e')]);}})[_0xbb76('0x3a')](respondWithStatusCode(_0xda35e1,null))[_0xbb76('0x58')](handleError(_0xda35e1,null));};exports[_0xbb76('0x6f')]=function(_0x1608ab,_0x28aaba,_0x2f0e38){if(_0x1608ab[_0xbb76('0x5d')]['id']){delete _0x1608ab['body']['id'];}return db[_0xbb76('0x41')][_0xbb76('0x63')]({'where':{'id':_0x1608ab[_0xbb76('0x67')]['id']}})['then'](handleEntityNotFound(_0x28aaba,null))['then'](function(_0x47cdcc){if(_0x47cdcc){_0x1608ab[_0xbb76('0x5d')][_0xbb76('0x69')]=_0x47cdcc['id'];return db[_0xbb76('0x70')][_0xbb76('0x5c')](_0x1608ab[_0xbb76('0x5d')]);}})['then'](respondWithResult(_0x28aaba,null))[_0xbb76('0x58')](handleError(_0x28aaba,null));};exports[_0xbb76('0x71')]=function(_0x1a0fca,_0x4430ad,_0xf21029){var _0xe2b692={'raw':![],'where':{}};var _0xe0c069={};var _0x3540ec={'count':0x0,'rows':[]};return db[_0xbb76('0x41')][_0xbb76('0x6a')]({'where':{'id':_0x1a0fca['params']['id']}})[_0xbb76('0x3a')](handleEntityNotFound(_0x4430ad,null))['then'](function(_0x21dd7d){if(_0x21dd7d){_0xe0c069[_0xbb76('0x49')]=_[_0xbb76('0x46')](db[_0xbb76('0x70')][_0xbb76('0x42')]);_0xe0c069[_0xbb76('0x45')]=_[_0xbb76('0x46')](_0x1a0fca[_0xbb76('0x45')]);_0xe0c069[_0xbb76('0x47')]=_[_0xbb76('0x48')](_0xe0c069[_0xbb76('0x49')],_0xe0c069['query']);_0xe2b692[_0xbb76('0x4b')]=_[_0xbb76('0x48')](_0xe0c069[_0xbb76('0x49')],qs[_0xbb76('0x4a')](_0x1a0fca['query'][_0xbb76('0x4a')]));_0xe2b692[_0xbb76('0x4b')]=_0xe2b692[_0xbb76('0x4b')][_0xbb76('0x4c')]?_0xe2b692[_0xbb76('0x4b')]:_0xe0c069[_0xbb76('0x49')];if(!_0x1a0fca['query'][_0xbb76('0x4d')](_0xbb76('0x4e'))){_0xe2b692[_0xbb76('0x34')]=qs[_0xbb76('0x34')](_0x1a0fca[_0xbb76('0x45')]['limit']);_0xe2b692['offset']=qs[_0xbb76('0x33')](_0x1a0fca[_0xbb76('0x45')][_0xbb76('0x33')]);}_0xe2b692[_0xbb76('0x72')]=qs[_0xbb76('0x4f')](_0x1a0fca[_0xbb76('0x45')]['sort']);_0xe2b692[_0xbb76('0x50')]=qs[_0xbb76('0x47')](_[_0xbb76('0x6c')](_0x1a0fca[_0xbb76('0x45')],_0xe0c069[_0xbb76('0x47')]));_0xe2b692[_0xbb76('0x50')][_0xbb76('0x69')]=_0x21dd7d['id'];if(_0x1a0fca[_0xbb76('0x45')][_0xbb76('0x53')]){_0xe2b692[_0xbb76('0x50')]=_['merge'](_0xe2b692[_0xbb76('0x50')],{'$or':_[_0xbb76('0x40')](_0xe2b692['attributes'],function(_0x48883d){var _0x1f18b3={};_0x1f18b3[_0x48883d]={'$like':'%'+_0x1a0fca['query'][_0xbb76('0x53')]+'%'};return _0x1f18b3;})});}_0xe2b692=_[_0xbb76('0x51')]({},_0xe2b692,_0x1a0fca[_0xbb76('0x5b')]);return db[_0xbb76('0x70')][_0xbb76('0x36')]({'where':_0xe2b692[_0xbb76('0x50')]})['then'](function(_0x26ef6a){_0x3540ec[_0xbb76('0x36')]=_0x26ef6a;if(_0x1a0fca[_0xbb76('0x45')]['includeAll']){_0xe2b692[_0xbb76('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbb76('0x56')](_0xe2b692);})[_0xbb76('0x3a')](function(_0x190351){_0x3540ec['rows']=_0x190351;return _0x3540ec;});}})[_0xbb76('0x3a')](respondWithFilteredResult(_0x4430ad,_0xe2b692))[_0xbb76('0x58')](handleError(_0x4430ad,null));};exports[_0xbb76('0x73')]=function(_0x496aab,_0x3c4c7f,_0x3dd1b8){return db[_0xbb76('0x41')][_0xbb76('0x63')]({'where':{'id':_0x496aab[_0xbb76('0x67')]['id']}})['then'](handleEntityNotFound(_0x3c4c7f,null))[_0xbb76('0x3a')](function(_0x587401){if(_0x587401){return _0x587401[_0xbb76('0x73')](_0x496aab[_0xbb76('0x45')][_0xbb76('0x6e')]);}})['then'](respondWithStatusCode(_0x3c4c7f,null))[_0xbb76('0x58')](handleError(_0x3c4c7f,null));};exports[_0xbb76('0x74')]=function(_0x4e9b74,_0x146001,_0x5daa3a){return db[_0xbb76('0x41')]['find']({'where':{'id':_0x4e9b74[_0xbb76('0x67')]['id']}})[_0xbb76('0x3a')](handleEntityNotFound(_0x146001,null))['then'](function(_0x4bd9b1){if(_0x4bd9b1){return _0x4bd9b1[_0xbb76('0x74')](_0x4e9b74[_0xbb76('0x5d')][_0xbb76('0x6e')],_['omit'](_0x4e9b74[_0xbb76('0x5d')],[_0xbb76('0x6e'),'id'])||{})[_0xbb76('0x75')](function(_0x514ded){for(var _0x53a519=0x0;_0x53a519<_0x4e9b74[_0xbb76('0x5d')][_0xbb76('0x6e')][_0xbb76('0x4c')];_0x53a519+=0x1){socket['emit'](_0xbb76('0x76'),{'UserId':Number(_0x4e9b74['body'][_0xbb76('0x6e')][_0x53a519]),'WhatsappAccountId':Number(_0x4e9b74[_0xbb76('0x67')]['id'])});}return _0x514ded;});}})['then'](respondWithResult(_0x146001,null))['catch'](handleError(_0x146001,null));};exports[_0xbb76('0x77')]=function(_0x1d1ffb,_0x2ef639,_0x534c2b){return db[_0xbb76('0x41')][_0xbb76('0x63')]({'where':{'id':_0x1d1ffb['params']['id']}})['then'](handleEntityNotFound(_0x2ef639,null))[_0xbb76('0x3a')](function(_0xed3fb5){if(_0xed3fb5){return _0xed3fb5['removeAgents'](_0x1d1ffb[_0xbb76('0x45')][_0xbb76('0x6e')])['then'](function(){if(_['isArray'](_0x1d1ffb[_0xbb76('0x45')][_0xbb76('0x6e')])){for(var _0x5c6247=0x0;_0x5c6247<_0x1d1ffb['query'][_0xbb76('0x6e')][_0xbb76('0x4c')];_0x5c6247+=0x1){socket[_0xbb76('0x78')](_0xbb76('0x79'),{'UserId':Number(_0x1d1ffb['query'][_0xbb76('0x6e')][_0x5c6247]),'WhatsappAccountId':Number(_0x1d1ffb[_0xbb76('0x67')]['id'])});}}else{socket[_0xbb76('0x78')](_0xbb76('0x79'),{'UserId':Number(_0x1d1ffb[_0xbb76('0x45')]['ids']),'WhatsappAccountId':Number(_0x1d1ffb[_0xbb76('0x67')]['id'])});}});}})[_0xbb76('0x3a')](respondWithStatusCode(_0x2ef639,null))[_0xbb76('0x58')](handleError(_0x2ef639,null));};exports[_0xbb76('0x7a')]=function(_0x2cc94b,_0x5bac1a,_0x4217b9){var _0x37241e={};var _0x4c3ae4={};var _0x2f0d2c;var _0x760b65;return db[_0xbb76('0x41')][_0xbb76('0x6a')]({'where':{'id':_0x2cc94b[_0xbb76('0x67')]['id']}})['then'](handleEntityNotFound(_0x5bac1a,null))[_0xbb76('0x3a')](function(_0x5c0f5e){if(_0x5c0f5e){_0x2f0d2c=_0x5c0f5e;_0x4c3ae4[_0xbb76('0x49')]=_[_0xbb76('0x46')](db[_0xbb76('0x7b')]['rawAttributes']);_0x4c3ae4[_0xbb76('0x45')]=_[_0xbb76('0x46')](_0x2cc94b[_0xbb76('0x45')]);_0x4c3ae4[_0xbb76('0x47')]=_[_0xbb76('0x48')](_0x4c3ae4[_0xbb76('0x49')],_0x4c3ae4[_0xbb76('0x45')]);_0x37241e[_0xbb76('0x4b')]=_['intersection'](_0x4c3ae4[_0xbb76('0x49')],qs[_0xbb76('0x4a')](_0x2cc94b[_0xbb76('0x45')][_0xbb76('0x4a')]));_0x37241e[_0xbb76('0x4b')]=_0x37241e[_0xbb76('0x4b')][_0xbb76('0x4c')]?_0x37241e['attributes']:_0x4c3ae4['model'];_0x37241e['order']=qs[_0xbb76('0x4f')](_0x2cc94b[_0xbb76('0x45')][_0xbb76('0x4f')]);_0x37241e[_0xbb76('0x50')]=qs[_0xbb76('0x47')](_[_0xbb76('0x6c')](_0x2cc94b['query'],_0x4c3ae4[_0xbb76('0x47')]));if(_0x2cc94b[_0xbb76('0x45')]['filter']){_0x37241e['where']=_[_0xbb76('0x51')](_0x37241e[_0xbb76('0x50')],{'$or':_[_0xbb76('0x40')](_0x37241e[_0xbb76('0x4b')],function(_0x4d1946){var _0x1ff6b0={};_0x1ff6b0[_0x4d1946]={'$like':'%'+_0x2cc94b[_0xbb76('0x45')][_0xbb76('0x53')]+'%'};return _0x1ff6b0;})});}_0x37241e=_['merge']({},_0x37241e,_0x2cc94b['options']);return _0x2f0d2c[_0xbb76('0x7a')](_0x37241e);}})[_0xbb76('0x3a')](function(_0x265477){if(_0x265477){_0x760b65=_0x265477['length'];if(!_0x2cc94b[_0xbb76('0x45')]['hasOwnProperty'](_0xbb76('0x4e'))){_0x37241e[_0xbb76('0x34')]=qs[_0xbb76('0x34')](_0x2cc94b['query']['limit']);_0x37241e['offset']=qs[_0xbb76('0x33')](_0x2cc94b[_0xbb76('0x45')][_0xbb76('0x33')]);}return _0x2f0d2c[_0xbb76('0x7a')](_0x37241e);}})[_0xbb76('0x3a')](function(_0x3915f3){if(_0x3915f3){return _0x3915f3?{'count':_0x760b65,'rows':_0x3915f3}:null;}})[_0xbb76('0x3a')](respondWithResult(_0x5bac1a,null))['catch'](handleError(_0x5bac1a,null));};exports[_0xbb76('0x7c')]=function(_0x43f304,_0x12491d){var _0x34d20d=_0x43f304['params']['id'];var _0x2ebfaa=_0x43f304['body'];var _0x14fa9b=0xc8;var _0x374e0e=null;return db[_0xbb76('0x7d')][_0xbb76('0x7e')]({'isolationLevel':db['sequelize'][_0xbb76('0x7f')][_0xbb76('0x80')][_0xbb76('0x81')]},function(_0x597626){return db[_0xbb76('0x41')][_0xbb76('0x6a')]({'where':{'id':_0x34d20d},'transaction':_0x597626})['then'](function(_0x5f28d7){if(_0x5f28d7){return db[_0xbb76('0x82')][_0xbb76('0x3b')]({'where':{'WhatsappAccountId':_0x34d20d},'transaction':_0x597626})[_0xbb76('0x3a')](function(){var _0x5bb45a=_['map'](_0x2ebfaa,function(_0x18bc38){_0x18bc38['WhatsappAccountId']=_0x34d20d;return _0x18bc38;});return db[_0xbb76('0x82')][_0xbb76('0x83')](_0x5bb45a,{'transaction':_0x597626});});}else{_0x14fa9b=0x194;_0x374e0e=[];}});})[_0xbb76('0x3a')](function(){if(_0x14fa9b!==0x194){return db[_0xbb76('0x82')][_0xbb76('0x84')]({'where':{'WhatsappAccountId':_0x34d20d},'order':_0xbb76('0x85')})['then'](function(_0x3b7b75){_0x374e0e=_0x3b7b75;});}})[_0xbb76('0x58')](function(_0x1b886d){_0x14fa9b=0x1f4;logger[_0xbb76('0x2b')](_0x1b886d['stack']);if(_0x1b886d[_0xbb76('0x3e')]){delete _0x1b886d[_0xbb76('0x3e')];}_0x374e0e=_0x1b886d;})[_0xbb76('0x86')](function(){if(_0x374e0e===null){_0x12491d[_0xbb76('0x2f')](_0x14fa9b);}else{if(_0x14fa9b===0x1f4){_0x12491d[_0xbb76('0x31')](_0x14fa9b)[_0xbb76('0x87')](_0x374e0e);}else{_0x12491d[_0xbb76('0x31')](_0x14fa9b)[_0xbb76('0x32')](_0x374e0e);}}});};exports['getApplications']=function(_0xa20009,_0x4c2f7f,_0x146736){var _0x38429a={};var _0x2af228={};var _0x41bd40;var _0x2bb5b8;return db['WhatsappAccount'][_0xbb76('0x6a')]({'where':{'id':_0xa20009[_0xbb76('0x67')]['id']}})[_0xbb76('0x3a')](handleEntityNotFound(_0x4c2f7f,null))[_0xbb76('0x3a')](function(_0x40af1a){if(_0x40af1a){_0x41bd40=_0x40af1a;_0x2af228[_0xbb76('0x49')]=_['keys'](db[_0xbb76('0x82')]['rawAttributes']);_0x2af228[_0xbb76('0x45')]=_['keys'](_0xa20009[_0xbb76('0x45')]);_0x2af228[_0xbb76('0x47')]=_[_0xbb76('0x48')](_0x2af228[_0xbb76('0x49')],_0x2af228['query']);_0x38429a[_0xbb76('0x4b')]=_[_0xbb76('0x48')](_0x2af228[_0xbb76('0x49')],qs[_0xbb76('0x4a')](_0xa20009[_0xbb76('0x45')]['fields']));_0x38429a[_0xbb76('0x4b')]=_0x38429a['attributes'][_0xbb76('0x4c')]?_0x38429a['attributes']:_0x2af228[_0xbb76('0x49')];_0x38429a[_0xbb76('0x72')]=qs['sort'](_0xa20009[_0xbb76('0x45')][_0xbb76('0x4f')]);_0x38429a['where']=qs[_0xbb76('0x47')](_['pick'](_0xa20009[_0xbb76('0x45')],_0x2af228['filters']));if(_0xa20009[_0xbb76('0x45')][_0xbb76('0x53')]){_0x38429a[_0xbb76('0x50')]=_[_0xbb76('0x51')](_0x38429a[_0xbb76('0x50')],{'$or':_[_0xbb76('0x40')](_0x38429a['attributes'],function(_0x5cab61){var _0x2f3c92={};_0x2f3c92[_0x5cab61]={'$like':'%'+_0xa20009[_0xbb76('0x45')]['filter']+'%'};return _0x2f3c92;})});}_0x38429a=_[_0xbb76('0x51')]({},_0x38429a,_0xa20009[_0xbb76('0x5b')]);return _0x41bd40[_0xbb76('0x88')](_0x38429a);}})['then'](function(_0x231073){if(_0x231073){_0x2bb5b8=_0x231073[_0xbb76('0x4c')];if(!_0xa20009['query'][_0xbb76('0x4d')]('nolimit')){_0x38429a[_0xbb76('0x34')]=qs[_0xbb76('0x34')](_0xa20009[_0xbb76('0x45')][_0xbb76('0x34')]);_0x38429a['offset']=qs['offset'](_0xa20009[_0xbb76('0x45')][_0xbb76('0x33')]);}return _0x41bd40['getApplications'](_0x38429a);}})['then'](function(_0x3503e7){if(_0x3503e7){return _0x3503e7?{'count':_0x2bb5b8,'rows':_0x3503e7}:null;}})[_0xbb76('0x3a')](respondWithResult(_0x4c2f7f,null))[_0xbb76('0x58')](handleError(_0x4c2f7f,null));};exports[_0xbb76('0x89')]=function(_0x35e86a,_0x1053c0,_0x227eeb){var _0x568c63={'channel':'whatsapp'};var _0x587354=[];var _0x493e7c=[];var _0x57672d={};return db[_0xbb76('0x41')][_0xbb76('0x63')]({'where':{'id':_0x35e86a[_0xbb76('0x67')]['id']},'include':[{'model':db[_0xbb76('0x82')],'as':_0xbb76('0x8a')}]})[_0xbb76('0x3a')](handleEntityNotFound(_0x1053c0,null))['then'](function(_0x16eb26){_0x568c63[_0xbb76('0x8b')]=_0x16eb26;if(_0x568c63[_0xbb76('0x8b')]&&_0x568c63[_0xbb76('0x8b')]['type']===_0xbb76('0x8c')&&_0x35e86a[_0xbb76('0x5d')][_0xbb76('0x8d')]){if(_0x35e86a[_0xbb76('0x5d')][_0xbb76('0x8d')][_0xbb76('0x4c')]===0x0)return;if(_0x35e86a[_0xbb76('0x5d')][_0xbb76('0x8d')][0x0][_0xbb76('0x8e')]!==_0xbb76('0x8f'))return;return db[_0xbb76('0x90')][_0xbb76('0x39')]({'read':!![],'readAt':_0x35e86a['body'][_0xbb76('0x8d')][0x0][_0xbb76('0x91')]},{'where':{'messageId':_0x35e86a[_0xbb76('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x107e0e){return _0x1053c0[_0xbb76('0x31')](0xc8)[_0xbb76('0x32')](_0x107e0e);});}_0x568c63['applications']=_[_0xbb76('0x92')](_0x16eb26[_0xbb76('0x8a')],[_0xbb76('0x85')],[_0xbb76('0x93')]);if(_0x568c63[_0xbb76('0x8b')][_0xbb76('0x8a')]){delete _0x568c63[_0xbb76('0x8b')][_0xbb76('0x8a')];}return db[_0xbb76('0x94')][_0xbb76('0x68')]()['then'](function(_0x409a4e){if(!_0x409a4e){throw new db[(_0xbb76('0x95'))][(_0xbb76('0x96'))](_0xbb76('0x97'));}_0x587354=_[_0xbb76('0x98')](_[_0xbb76('0x46')](_0x409a4e),[_0xbb76('0x99'),_0xbb76('0x9a')]);_0x493e7c=_[_0xbb76('0x98')](_['keys'](_0x409a4e),[_0xbb76('0x99'),_0xbb76('0x9a'),_0xbb76('0x9b'),'ListId']);_0x568c63[_0xbb76('0x5d')]={'mapKey':_0xbb76('0x9c')};if(_0x568c63[_0xbb76('0x8b')]&&_0x568c63[_0xbb76('0x8b')][_0xbb76('0x44')]===_0xbb76('0x9d')){_0x568c63[_0xbb76('0x5d')][_0xbb76('0x9e')]=_0x35e86a['body'][_0xbb76('0x9f')]['replace'](_0xbb76('0xa0'),'');_0x568c63[_0xbb76('0x5d')][_0xbb76('0x5d')]=_0x35e86a[_0xbb76('0x5d')][_0xbb76('0xa1')];_0x568c63[_0xbb76('0x5d')][_0xbb76('0xa2')]=_0x35e86a['body'][_0xbb76('0xa3')];}if(_0x568c63[_0xbb76('0x8b')]&&_0x568c63[_0xbb76('0x8b')][_0xbb76('0x44')]===_0xbb76('0x8c')){_0x568c63[_0xbb76('0x5d')][_0xbb76('0x9e')]=_0x35e86a[_0xbb76('0x5d')][_0xbb76('0xa4')][0x0]['from'];_0x568c63[_0xbb76('0x5d')]['body']=_0x35e86a[_0xbb76('0x5d')][_0xbb76('0xa4')][0x0][_0xbb76('0x2d')][_0xbb76('0x5d')];_0x568c63['body'][_0xbb76('0xa2')]=_0x35e86a[_0xbb76('0x5d')][_0xbb76('0xa4')][0x0]['message_id'];}if(_0x568c63[_0xbb76('0x5d')]['id']){delete _0x568c63[_0xbb76('0x5d')]['id'];}if(_[_0xbb76('0xa5')](_0x568c63[_0xbb76('0x5d')][_0xbb76('0x9e')])){throw new db[(_0xbb76('0x95'))][(_0xbb76('0x96'))](_0xbb76('0xa6'));}if(_[_0xbb76('0xa5')](_0x568c63[_0xbb76('0x5d')]['body'])||_0x568c63[_0xbb76('0x5d')][_0xbb76('0x5d')]===''){throw new db['Sequelize'][(_0xbb76('0x96'))](_0xbb76('0xa7'));}if(_[_0xbb76('0xa5')](_0x568c63[_0xbb76('0x5d')][_0xbb76('0xa8')])){throw new db[(_0xbb76('0x95'))][(_0xbb76('0x96'))](_0xbb76('0xa9')+_0x493e7c);}if(!_[_0xbb76('0xaa')](_0x493e7c,_0x568c63[_0xbb76('0x5d')][_0xbb76('0xa8')])){throw new db[(_0xbb76('0x95'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x493e7c);}_0x57672d[_0x568c63[_0xbb76('0x5d')][_0xbb76('0xa8')]]=_0x568c63['body']['from'];return db[_0xbb76('0xab')][_0xbb76('0x63')]({'where':{'id':_0x568c63['account'][_0xbb76('0xac')]},'include':[{'model':db[_0xbb76('0x94')],'as':_0xbb76('0xad'),'where':_0x57672d,'limit':0x1,'order':[[_0xbb76('0x9a'),_0xbb76('0xae')]]}]});})[_0xbb76('0x3a')](handleEntityNotFound(_0x1053c0,null))[_0xbb76('0x3a')](function(_0x2c2b09){if(_0x2c2b09){_0x568c63[_0xbb76('0xaf')]=_[_0xbb76('0xb0')](_0x2c2b09,[_0xbb76('0xad')]);if(_0x2c2b09[_0xbb76('0xad')][_0xbb76('0x4c')]){return _0x2c2b09[_0xbb76('0xad')][0x0];}var _0x2761e8=_[_0xbb76('0x1d')](_0x568c63[_0xbb76('0x5d')],{'firstName':_0x568c63['body']['from'],'ListId':_0x2c2b09['id']});_0x2761e8[_0x568c63[_0xbb76('0x5d')][_0xbb76('0xa8')]]=_0x568c63['body']['from'];return db[_0xbb76('0x94')]['create'](_0x2761e8,{'fields':_0x587354,'raw':!![]});}})[_0xbb76('0x3a')](handleEntityNotFound(_0x1053c0,null))['then'](function(_0x349096){if(_0x349096){_0x568c63['contact']=_0x349096;var _0x2a20c4={'ContactId':_0x349096['id'],'phone':_0x568c63[_0xbb76('0x5d')]['from'],'WhatsappAccountId':_0x35e86a[_0xbb76('0x67')]['id']};var _0x1d9eaa={'ContactId':_0x349096['id'],'WhatsappAccountId':_0x35e86a['params']['id'],'closed':![]};return db[_0xbb76('0xb1')][_0xbb76('0x63')]({'where':_0x1d9eaa})[_0xbb76('0x3a')](function(_0x85727f){if(_0x85727f){return[_0x85727f,![]];}return db[_0xbb76('0xb1')][_0xbb76('0x5c')](_0x2a20c4)[_0xbb76('0x3a')](function(_0x1c386e){return[_0x1c386e,!![]];});});}})[_0xbb76('0x75')](function(_0x144777,_0x3e2cdf){_0x568c63['interaction']=_0x144777[_0xbb76('0x61')]({'plain':!![]});_0x568c63['interaction'][_0xbb76('0xb2')]=![];if(_0x3e2cdf){if(_0x568c63[_0xbb76('0x8b')]['autoclose']){_0x568c63[_0xbb76('0xb3')]['push']({'id':0x0,'priority':_0x568c63[_0xbb76('0xb3')]['length']+0x1,'app':'close','appdata':_0xbb76('0xb4'),'interval':_0xbb76('0xb5')});}_0x568c63[_0xbb76('0xb6')][_0xbb76('0xb2')]=!![];}return db[_0xbb76('0x90')][_0xbb76('0x5c')]({'phone':_0x568c63[_0xbb76('0x5d')][_0xbb76('0x9e')],'messageId':_0x568c63[_0xbb76('0x5d')]['messageId'],'body':_0x568c63['body'][_0xbb76('0x5d')],'WhatsappAccountId':_0x35e86a['params']['id'],'WhatsappInteractionId':_0x144777['id'],'direction':'in','ContactId':_0x144777[_0xbb76('0xb7')],'AttachmentId':_0x568c63[_0xbb76('0x5d')][_0xbb76('0xb8')]});})[_0xbb76('0x3a')](function(_0x186e5d){_0x568c63['message']=_0x186e5d;if(_0x568c63[_0xbb76('0xb6')][_0xbb76('0xb9')]){return db['User'][_0xbb76('0x63')]({'attributes':['id','name'],'where':{'id':_0x568c63[_0xbb76('0xb6')][_0xbb76('0xb9')]}})['then'](function(_0xcd90ce){if(_0xcd90ce){_0x568c63['applications'][_0xbb76('0xba')]({'id':0x0,'priority':0x0,'app':_0xbb76('0xbb'),'appdata':_0xcd90ce[_0xbb76('0x3e')]+','+(_0x568c63['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbb76('0xb5')});}return respondWithRpcPromise(_0xbb76('0xbc'),_0xbb76('0xbd'),_0x568c63);});}return respondWithRpcPromise(_0xbb76('0xbc'),'startRouting',_0x568c63);})['then'](function(_0x4a09b3){if(_0x4a09b3){var _0x5b148a=0xc8;var _0x3557ce='receiveMessage';logger[_0xbb76('0x26')](_0xbb76('0xbe'),_0x3557ce,_0x5b148a,_0xbb76('0xbf'));logger[_0xbb76('0x28')](_0xbb76('0xc0'),_0x3557ce,_0x5b148a,'entity\x20found',JSON[_0xbb76('0x2a')](_0x4a09b3));if(_0x568c63['account']['type']===_0xbb76('0x9d')){return _0x1053c0[_0xbb76('0x31')](_0x5b148a)[_0xbb76('0xc1')](_0xbb76('0xc2'),'text/xml')[_0xbb76('0x87')](_0xbb76('0xc3'));}else{return _0x1053c0[_0xbb76('0x31')](_0x5b148a)[_0xbb76('0x32')](_0x4a09b3);}}});})['catch'](handleError(_0x1053c0,null));};exports[_0xbb76('0x87')]=function(_0x345320,_0x120c65,_0xb7fd85){var _0x283ed8,_0x741d49,_0x3924f6;if(_[_0xbb76('0xa5')](_0x345320[_0xbb76('0x5d')][_0xbb76('0x5d')])||_0x345320['body'][_0xbb76('0x5d')]===''){throw new db[(_0xbb76('0x95'))][(_0xbb76('0x96'))](_0xbb76('0xa7'));}if(_[_0xbb76('0xa5')](_0x345320['body']['to'])){throw new db[(_0xbb76('0x95'))][(_0xbb76('0x96'))]('to\x20is\x20mandatory');}_0x283ed8=_0x345320[_0xbb76('0x5d')]['to'];return db['WhatsappAccount'][_0xbb76('0x63')]({'where':{'id':_0x345320[_0xbb76('0x67')]['id']},'include':[{'model':db[_0xbb76('0xab')],'as':_0xbb76('0xc4'),'include':[{'model':db['CmContact'],'as':_0xbb76('0xad'),'where':{'mobile':_0x283ed8},'limit':0x1,'order':[[_0xbb76('0x9a'),'DESC']]}]}]})[_0xbb76('0x3a')](handleEntityNotFound(_0x120c65,null))[_0xbb76('0x3a')](function(_0x4162cf){if(_0x4162cf&&_0x4162cf[_0xbb76('0xc4')]){_0x741d49=_0x4162cf['get']({'plain':!![]});if(_0x741d49[_0xbb76('0xc4')]&&_0x741d49[_0xbb76('0xc4')][_0xbb76('0xad')]['length']){return _0x741d49[_0xbb76('0xc4')][_0xbb76('0xad')][0x0];}return db[_0xbb76('0x94')][_0xbb76('0x5c')](_[_0xbb76('0x1d')](_0x345320['body'],{'firstName':_0x283ed8,'mobile':_0x283ed8,'phone':_0x283ed8,'ListId':_0x741d49['ListId']}));}})['then'](handleEntityNotFound(_0x120c65,null))[_0xbb76('0x3a')](function(_0x331866){if(_0x331866){_0x3924f6=_0x331866;return db['WhatsappInteraction'][_0xbb76('0x63')]({'where':{'ContactId':_0x3924f6['id'],'closed':![],'WhatsappAccountId':_0x741d49['id']}})[_0xbb76('0x3a')](function(_0x452090){if(_0x452090){return[_0x452090,![]];}return db['WhatsappInteraction'][_0xbb76('0x5c')]({'UserId':_0x345320[_0xbb76('0x5e')]['id'],'ContactId':_0x3924f6['id'],'WhatsappAccountId':_0x741d49['id'],'phone':_0x283ed8,'firstMsgDirection':_0xbb76('0xc5'),'Messages':[_['merge'](_0x345320[_0xbb76('0x5d')],{'read':![],'body':_0x345320[_0xbb76('0x5d')][_0xbb76('0x5d')],'phone':_0x283ed8,'WhatsappAccountId':_0x741d49['id'],'UserId':_0x345320['user']['id'],'ContactId':_0x3924f6['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xbb76('0xc6')}]})[_0xbb76('0x3a')](function(_0x5b079b){return[_0x5b079b,!![]];});});}})[_0xbb76('0x75')](function(_0x5dfa56,_0x21dc9e){if(_0x21dc9e){return _0x5dfa56;}return db[_0xbb76('0x90')][_0xbb76('0x5c')](_[_0xbb76('0x51')](_0x345320[_0xbb76('0x5d')],{'read':![],'body':_0x345320['body'][_0xbb76('0x5d')],'phone':_0x283ed8,'WhatsappAccountId':_0x741d49['id'],'WhatsappInteractionId':_0x5dfa56['id'],'UserId':_0x345320[_0xbb76('0x5e')]['id'],'ContactId':_0x3924f6['id']}))[_0xbb76('0x3a')](function(_0x10a6d7){_0x5dfa56[_0xbb76('0xc7')][_0xbb76('0xc6')]=[];_0x5dfa56[_0xbb76('0xc7')][_0xbb76('0xc6')]['push'](_0x10a6d7[_0xbb76('0xc7')]);return _0x5dfa56;});})['then'](respondWithResult(_0x120c65,null))[_0xbb76('0x58')](handleError(_0x120c65,null));}; \ No newline at end of file +var _0xb3de=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','undefined','limit','count','offset','set','json','apply','reject','update','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','Disposition','WhatsappAccountId','filter','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','userWhatsappAccount:remove','getAgents','transaction','sequelize','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','notifications','message_id','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x41d276,_0xc7cbbf){var _0xb4e969=function(_0x4247b8){while(--_0x4247b8){_0x41d276['push'](_0x41d276['shift']());}};_0xb4e969(++_0xc7cbbf);}(_0xb3de,0x169));var _0xeb3d=function(_0x18d85c,_0x239c4e){_0x18d85c=_0x18d85c-0x0;var _0x45aae0=_0xb3de[_0x18d85c];return _0x45aae0;};'use strict';var emlformat=require(_0xeb3d('0x0'));var rimraf=require(_0xeb3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb3d('0x2'));var rp=require(_0xeb3d('0x3'));var moment=require(_0xeb3d('0x4'));var BPromise=require(_0xeb3d('0x5'));var Mustache=require(_0xeb3d('0x6'));var util=require(_0xeb3d('0x7'));var path=require('path');var sox=require(_0xeb3d('0x8'));var csv=require('to-csv');var ejs=require(_0xeb3d('0x9'));var fs=require('fs');var fs_extra=require(_0xeb3d('0xa'));var _=require(_0xeb3d('0xb'));var squel=require(_0xeb3d('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb3d('0xd'));var deskjs=require(_0xeb3d('0xe'));var toCsv=require(_0xeb3d('0xf'));var querystring=require(_0xeb3d('0x10'));var Papa=require('papaparse');var Redis=require(_0xeb3d('0x11'));var authService=require(_0xeb3d('0x12'));var qs=require(_0xeb3d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb3d('0x14'))(_0xeb3d('0x15'));var utils=require('../../config/utils');var config=require(_0xeb3d('0x16'));var licenseUtil=require(_0xeb3d('0x17'));var db=require(_0xeb3d('0x18'))['db'];config[_0xeb3d('0x19')]=_[_0xeb3d('0x1a')](config[_0xeb3d('0x19')],{'host':_0xeb3d('0x1b'),'port':0x18eb});var socket=require(_0xeb3d('0x1c'))(new Redis(config['redis']));require(_0xeb3d('0x1d'))[_0xeb3d('0x1e')](socket);var jayson=require(_0xeb3d('0x1f'));var client=jayson[_0xeb3d('0x20')][_0xeb3d('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3a1b0d,_0x470dde,_0x2cb9d5,_0x1c0026){return new BPromise(function(_0x2c3df3,_0xc9341c){var _0x2bed0c=_0x1c0026||client;return _0x2bed0c[_0xeb3d('0x22')](_0x3a1b0d,_0x2cb9d5)[_0xeb3d('0x23')](function(_0x4f7398){logger[_0xeb3d('0x24')](_0xeb3d('0x25'),_0x470dde,_0xeb3d('0x26'));logger[_0xeb3d('0x27')](_0xeb3d('0x28'),_0x470dde,_0xeb3d('0x26'),JSON['stringify'](_0x4f7398));if(_0x4f7398[_0xeb3d('0x29')]){if(_0x4f7398[_0xeb3d('0x29')][_0xeb3d('0x2a')]===0x1f4){logger[_0xeb3d('0x29')](_0xeb3d('0x25'),_0x470dde,_0x4f7398[_0xeb3d('0x29')][_0xeb3d('0x2b')]);return _0xc9341c(_0x4f7398[_0xeb3d('0x29')]['message']);}logger[_0xeb3d('0x29')](_0xeb3d('0x25'),_0x470dde,_0x4f7398['error'][_0xeb3d('0x2b')]);return _0x2c3df3(_0x4f7398['error']['message']);}else{logger[_0xeb3d('0x24')](_0xeb3d('0x25'),_0x470dde,_0xeb3d('0x26'));_0x2c3df3(_0x4f7398['result'][_0xeb3d('0x2b')]);}})['catch'](function(_0x330538){logger[_0xeb3d('0x29')](_0xeb3d('0x25'),_0x470dde,_0x330538);_0xc9341c(_0x330538);});});}function respondWithStatusCode(_0x469f5d,_0x41dfca){_0x41dfca=_0x41dfca||0xcc;return function(_0x48e684){if(_0x48e684){return _0x469f5d['sendStatus'](_0x41dfca);}return _0x469f5d[_0xeb3d('0x2c')](_0x41dfca)[_0xeb3d('0x2d')]();};}function respondWithResult(_0x1ec0a1,_0xb47d15){_0xb47d15=_0xb47d15||0xc8;return function(_0x4439de){if(_0x4439de){return _0x1ec0a1[_0xeb3d('0x2c')](_0xb47d15)['json'](_0x4439de);}};}function respondWithFilteredResult(_0xdc3f34,_0x24ecbc){return function(_0x333c67){if(_0x333c67){var _0x32b6c5=typeof _0x24ecbc['offset']===_0xeb3d('0x2e')&&typeof _0x24ecbc[_0xeb3d('0x2f')]===_0xeb3d('0x2e');var _0x386646=_0x333c67[_0xeb3d('0x30')];var _0x40e57b=_0x32b6c5?0x0:_0x24ecbc['offset'];var _0x5d9f9b=_0x32b6c5?_0x333c67[_0xeb3d('0x30')]:_0x24ecbc[_0xeb3d('0x31')]+_0x24ecbc[_0xeb3d('0x2f')];var _0x5cf927;if(_0x5d9f9b>=_0x386646){_0x5d9f9b=_0x386646;_0x5cf927=0xc8;}else{_0x5cf927=0xce;}_0xdc3f34[_0xeb3d('0x2c')](_0x5cf927);return _0xdc3f34[_0xeb3d('0x32')]('Content-Range',_0x40e57b+'-'+_0x5d9f9b+'/'+_0x386646)[_0xeb3d('0x33')](_0x333c67);}return null;};}function patchUpdates(_0x2d1d9b){return function(_0x1a40d7){try{jsonpatch[_0xeb3d('0x34')](_0x1a40d7,_0x2d1d9b,!![]);}catch(_0x4e2057){return BPromise[_0xeb3d('0x35')](_0x4e2057);}return _0x1a40d7['save']();};}function saveUpdates(_0x31b862,_0x438ae3){return function(_0x10b082){if(_0x10b082){return _0x10b082[_0xeb3d('0x36')](_0x31b862)['then'](function(_0x1f0d65){return _0x1f0d65;});}return null;};}function removeEntity(_0x36ca45,_0x29401e){return function(_0x5cbd7b){if(_0x5cbd7b){return _0x5cbd7b['destroy']()[_0xeb3d('0x23')](function(){var _0x2a5ad9=_0x5cbd7b['get']({'plain':!![]});var _0x5f9785=_0xeb3d('0x37');return db[_0xeb3d('0x38')][_0xeb3d('0x39')]({'where':{'type':_0x5f9785,'resourceId':_0x2a5ad9['id']}})[_0xeb3d('0x23')](function(){return _0x5cbd7b;});})['then'](function(){_0x36ca45[_0xeb3d('0x2c')](0xcc)[_0xeb3d('0x2d')]();});}};}function handleEntityNotFound(_0x180fc9,_0x48216b){return function(_0x3c9542){if(!_0x3c9542){_0x180fc9[_0xeb3d('0x3a')](0x194);}return _0x3c9542;};}function handleError(_0x291c8f,_0x26fc6d){_0x26fc6d=_0x26fc6d||0x1f4;return function(_0x11b288){logger[_0xeb3d('0x29')](_0x11b288[_0xeb3d('0x3b')]);if(_0x11b288[_0xeb3d('0x3c')]){delete _0x11b288[_0xeb3d('0x3c')];}_0x291c8f[_0xeb3d('0x2c')](_0x26fc6d)['send'](_0x11b288);};}exports[_0xeb3d('0x3d')]=function(_0x584902,_0x107432){var _0x383c1b={'include':[{'model':db[_0xeb3d('0x3e')],'as':_0xeb3d('0x3f')}]},_0x5bab14={},_0x4813b7={'count':0x0,'rows':[]};var _0xa62cf0=_['map'](db[_0xeb3d('0x40')]['rawAttributes'],function(_0x12b13a){return{'name':_0x12b13a[_0xeb3d('0x41')],'type':_0x12b13a[_0xeb3d('0x42')][_0xeb3d('0x43')]};});_0x5bab14[_0xeb3d('0x44')]=_[_0xeb3d('0x45')](_0xa62cf0,'name');_0x5bab14[_0xeb3d('0x46')]=_[_0xeb3d('0x47')](_0x584902[_0xeb3d('0x46')]);_0x5bab14[_0xeb3d('0x48')]=_[_0xeb3d('0x49')](_0x5bab14[_0xeb3d('0x44')],_0x5bab14[_0xeb3d('0x46')]);_0x383c1b[_0xeb3d('0x4a')]=_[_0xeb3d('0x49')](_0x5bab14[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x584902[_0xeb3d('0x46')][_0xeb3d('0x4b')]));_0x383c1b[_0xeb3d('0x4a')]=_0x383c1b[_0xeb3d('0x4a')]['length']?_0x383c1b[_0xeb3d('0x4a')]:_0x5bab14[_0xeb3d('0x44')];if(!_0x584902[_0xeb3d('0x46')][_0xeb3d('0x4c')](_0xeb3d('0x4d'))){_0x383c1b[_0xeb3d('0x2f')]=qs['limit'](_0x584902[_0xeb3d('0x46')][_0xeb3d('0x2f')]);_0x383c1b[_0xeb3d('0x31')]=qs[_0xeb3d('0x31')](_0x584902[_0xeb3d('0x46')][_0xeb3d('0x31')]);}_0x383c1b[_0xeb3d('0x4e')]=qs[_0xeb3d('0x4f')](_0x584902['query']['sort']);_0x383c1b[_0xeb3d('0x50')]=qs[_0xeb3d('0x48')](_[_0xeb3d('0x51')](_0x584902[_0xeb3d('0x46')],_0x5bab14[_0xeb3d('0x48')]),_0xa62cf0);if(_0x584902['query']['filter']){_0x383c1b[_0xeb3d('0x50')]=_[_0xeb3d('0x52')](_0x383c1b[_0xeb3d('0x50')],{'$or':_['map'](_0xa62cf0,function(_0x273e47){if(_0x273e47['type']!==_0xeb3d('0x53')){var _0x36001c={};_0x36001c[_0x273e47[_0xeb3d('0x3c')]]={'$like':'%'+_0x584902[_0xeb3d('0x46')]['filter']+'%'};return _0x36001c;}})});}_0x383c1b=_[_0xeb3d('0x52')]({},_0x383c1b,_0x584902['options']);var _0x25198d={'where':_0x383c1b[_0xeb3d('0x50')]};return db[_0xeb3d('0x40')][_0xeb3d('0x30')](_0x25198d)[_0xeb3d('0x23')](function(_0x49bba8){_0x4813b7[_0xeb3d('0x30')]=_0x49bba8;if(_0x584902[_0xeb3d('0x46')][_0xeb3d('0x54')]){_0x383c1b['include']=[{'all':!![]}];}return db[_0xeb3d('0x40')][_0xeb3d('0x55')](_0x383c1b);})[_0xeb3d('0x23')](function(_0x2eab51){_0x4813b7[_0xeb3d('0x56')]=_0x2eab51;return _0x4813b7;})[_0xeb3d('0x23')](respondWithFilteredResult(_0x107432,_0x383c1b))[_0xeb3d('0x57')](handleError(_0x107432,null));};exports[_0xeb3d('0x58')]=function(_0x362165,_0x349d15){var _0x54a3c0={'raw':![],'where':{'id':_0x362165[_0xeb3d('0x59')]['id']},'include':[{'model':db[_0xeb3d('0x3e')],'as':_0xeb3d('0x3f')}]},_0x295157={};_0x295157[_0xeb3d('0x44')]=_[_0xeb3d('0x47')](db[_0xeb3d('0x40')][_0xeb3d('0x5a')]);_0x295157['query']=_[_0xeb3d('0x47')](_0x362165[_0xeb3d('0x46')]);_0x295157[_0xeb3d('0x48')]=_[_0xeb3d('0x49')](_0x295157[_0xeb3d('0x44')],_0x295157['query']);_0x54a3c0[_0xeb3d('0x4a')]=_['intersection'](_0x295157[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x362165[_0xeb3d('0x46')]['fields']));_0x54a3c0['attributes']=_0x54a3c0['attributes'][_0xeb3d('0x5b')]?_0x54a3c0[_0xeb3d('0x4a')]:_0x295157[_0xeb3d('0x44')];if(_0x362165[_0xeb3d('0x46')][_0xeb3d('0x54')]){_0x54a3c0[_0xeb3d('0x5c')]=[{'all':!![]}];}_0x54a3c0=_[_0xeb3d('0x52')]({},_0x54a3c0,_0x362165[_0xeb3d('0x5d')]);return db[_0xeb3d('0x40')]['find'](_0x54a3c0)[_0xeb3d('0x23')](handleEntityNotFound(_0x349d15,null))[_0xeb3d('0x23')](respondWithResult(_0x349d15,null))[_0xeb3d('0x57')](handleError(_0x349d15,null));};exports['create']=function(_0x4628fc,_0x509097){return db['WhatsappAccount'][_0xeb3d('0x5e')](_0x4628fc[_0xeb3d('0x5f')],{})['then'](function(_0x4358a8){var _0x8c4349=_0x4628fc[_0xeb3d('0x60')][_0xeb3d('0x61')]({'plain':!![]});if(!_0x8c4349)throw new Error(_0xeb3d('0x62'));if(_0x8c4349['role']===_0xeb3d('0x60')){var _0x4a3a94=_0x4358a8[_0xeb3d('0x61')]({'plain':!![]});var _0x223d3b=_0xeb3d('0x37');return db['UserProfileSection'][_0xeb3d('0x63')]({'where':{'name':_0x223d3b,'userProfileId':_0x8c4349[_0xeb3d('0x64')]},'raw':!![]})['then'](function(_0x500e21){if(_0x500e21&&_0x500e21['autoAssociation']===0x0){return db[_0xeb3d('0x38')]['create']({'name':_0x4a3a94[_0xeb3d('0x3c')],'resourceId':_0x4a3a94['id'],'type':_0x500e21[_0xeb3d('0x3c')],'sectionId':_0x500e21['id']},{})[_0xeb3d('0x23')](function(){return _0x4358a8;});}else{return _0x4358a8;}})['catch'](function(_0x48404d){logger[_0xeb3d('0x29')](_0xeb3d('0x65'),_0x48404d);throw _0x48404d;});}return _0x4358a8;})[_0xeb3d('0x23')](respondWithResult(_0x509097,0xc9))[_0xeb3d('0x57')](handleError(_0x509097,null));};exports[_0xeb3d('0x36')]=function(_0x56870f,_0x28e6da){if(_0x56870f[_0xeb3d('0x5f')]['id']){delete _0x56870f['body']['id'];}return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x56870f['params']['id']},'include':[{'model':db['Pause'],'as':_0xeb3d('0x3f')}]})['then'](handleEntityNotFound(_0x28e6da,null))[_0xeb3d('0x23')](saveUpdates(_0x56870f['body'],null))[_0xeb3d('0x23')](respondWithResult(_0x28e6da,null))[_0xeb3d('0x57')](handleError(_0x28e6da,null));};exports[_0xeb3d('0x39')]=function(_0x3fdee3,_0x48a1b3){return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x3fdee3['params']['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x48a1b3,null))[_0xeb3d('0x23')](removeEntity(_0x48a1b3,null))['catch'](handleError(_0x48a1b3,null));};exports[_0xeb3d('0x66')]=function(_0x81a160,_0x488252){return db[_0xeb3d('0x40')][_0xeb3d('0x66')]()['then'](respondWithResult(_0x488252,null))[_0xeb3d('0x57')](handleError(_0x488252,null));};exports['addDisposition']=function(_0x354e7e,_0x58ab40,_0x1bc2f7){if(_0x354e7e[_0xeb3d('0x5f')]['id']){delete _0x354e7e[_0xeb3d('0x5f')]['id'];}return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x354e7e[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x58ab40,null))['then'](function(_0x30b8c6){if(_0x30b8c6){_0x354e7e['body']['WhatsappAccountId']=_0x30b8c6['id'];return db['Disposition']['create'](_0x354e7e['body']);}})['then'](respondWithResult(_0x58ab40,null))[_0xeb3d('0x57')](handleError(_0x58ab40,null));};exports['getDispositions']=function(_0x10a91a,_0x37beb9,_0x467ff7){var _0x49db77={'raw':![],'where':{}};var _0x4cf62a={};var _0x47910b={'count':0x0,'rows':[]};return db[_0xeb3d('0x40')][_0xeb3d('0x67')]({'where':{'id':_0x10a91a[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x37beb9,null))[_0xeb3d('0x23')](function(_0x1f9ba4){if(_0x1f9ba4){_0x4cf62a[_0xeb3d('0x44')]=_[_0xeb3d('0x47')](db[_0xeb3d('0x68')][_0xeb3d('0x5a')]);_0x4cf62a[_0xeb3d('0x46')]=_[_0xeb3d('0x47')](_0x10a91a[_0xeb3d('0x46')]);_0x4cf62a[_0xeb3d('0x48')]=_['intersection'](_0x4cf62a[_0xeb3d('0x44')],_0x4cf62a[_0xeb3d('0x46')]);_0x49db77['attributes']=_[_0xeb3d('0x49')](_0x4cf62a[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x10a91a[_0xeb3d('0x46')]['fields']));_0x49db77[_0xeb3d('0x4a')]=_0x49db77['attributes']['length']?_0x49db77[_0xeb3d('0x4a')]:_0x4cf62a[_0xeb3d('0x44')];if(!_0x10a91a['query'][_0xeb3d('0x4c')](_0xeb3d('0x4d'))){_0x49db77[_0xeb3d('0x2f')]=qs['limit'](_0x10a91a[_0xeb3d('0x46')]['limit']);_0x49db77[_0xeb3d('0x31')]=qs[_0xeb3d('0x31')](_0x10a91a[_0xeb3d('0x46')]['offset']);}_0x49db77[_0xeb3d('0x4e')]=qs[_0xeb3d('0x4f')](_0x10a91a['query'][_0xeb3d('0x4f')]);_0x49db77['where']=qs[_0xeb3d('0x48')](_[_0xeb3d('0x51')](_0x10a91a[_0xeb3d('0x46')],_0x4cf62a[_0xeb3d('0x48')]));_0x49db77[_0xeb3d('0x50')][_0xeb3d('0x69')]=_0x1f9ba4['id'];if(_0x10a91a[_0xeb3d('0x46')][_0xeb3d('0x6a')]){_0x49db77[_0xeb3d('0x50')]=_[_0xeb3d('0x52')](_0x49db77[_0xeb3d('0x50')],{'$or':_[_0xeb3d('0x45')](_0x49db77[_0xeb3d('0x4a')],function(_0x5e6915){var _0xed5625={};_0xed5625[_0x5e6915]={'$like':'%'+_0x10a91a[_0xeb3d('0x46')][_0xeb3d('0x6a')]+'%'};return _0xed5625;})});}_0x49db77=_[_0xeb3d('0x52')]({},_0x49db77,_0x10a91a['options']);return db[_0xeb3d('0x68')][_0xeb3d('0x30')]({'where':_0x49db77[_0xeb3d('0x50')]})[_0xeb3d('0x23')](function(_0x1c8f08){_0x47910b[_0xeb3d('0x30')]=_0x1c8f08;if(_0x10a91a[_0xeb3d('0x46')][_0xeb3d('0x54')]){_0x49db77[_0xeb3d('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0xeb3d('0x55')](_0x49db77);})['then'](function(_0x48cea2){_0x47910b[_0xeb3d('0x56')]=_0x48cea2;return _0x47910b;});}})['then'](respondWithFilteredResult(_0x37beb9,_0x49db77))[_0xeb3d('0x57')](handleError(_0x37beb9,null));};exports[_0xeb3d('0x6b')]=function(_0x542f6c,_0x15bb0c,_0x14f693){return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x542f6c['params']['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x15bb0c,null))['then'](function(_0x36ab91){if(_0x36ab91){return _0x36ab91[_0xeb3d('0x6b')](_0x542f6c['query'][_0xeb3d('0x6c')]);}})[_0xeb3d('0x23')](respondWithStatusCode(_0x15bb0c,null))['catch'](handleError(_0x15bb0c,null));};exports[_0xeb3d('0x6d')]=function(_0x187394,_0x183815,_0xcc3021){if(_0x187394[_0xeb3d('0x5f')]['id']){delete _0x187394[_0xeb3d('0x5f')]['id'];}return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x187394[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x183815,null))[_0xeb3d('0x23')](function(_0x4b0ea5){if(_0x4b0ea5){_0x187394['body'][_0xeb3d('0x69')]=_0x4b0ea5['id'];return db['CannedAnswer'][_0xeb3d('0x5e')](_0x187394[_0xeb3d('0x5f')]);}})[_0xeb3d('0x23')](respondWithResult(_0x183815,null))[_0xeb3d('0x57')](handleError(_0x183815,null));};exports['getAnswers']=function(_0x822857,_0x45a027,_0x51e54a){var _0x3170d5={'raw':![],'where':{}};var _0x578265={};var _0x214711={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xeb3d('0x67')]({'where':{'id':_0x822857[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x45a027,null))['then'](function(_0x3ee162){if(_0x3ee162){_0x578265[_0xeb3d('0x44')]=_[_0xeb3d('0x47')](db[_0xeb3d('0x6e')]['rawAttributes']);_0x578265[_0xeb3d('0x46')]=_[_0xeb3d('0x47')](_0x822857[_0xeb3d('0x46')]);_0x578265['filters']=_['intersection'](_0x578265['model'],_0x578265[_0xeb3d('0x46')]);_0x3170d5[_0xeb3d('0x4a')]=_[_0xeb3d('0x49')](_0x578265[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x822857['query'][_0xeb3d('0x4b')]));_0x3170d5[_0xeb3d('0x4a')]=_0x3170d5[_0xeb3d('0x4a')][_0xeb3d('0x5b')]?_0x3170d5[_0xeb3d('0x4a')]:_0x578265[_0xeb3d('0x44')];if(!_0x822857[_0xeb3d('0x46')]['hasOwnProperty']('nolimit')){_0x3170d5[_0xeb3d('0x2f')]=qs[_0xeb3d('0x2f')](_0x822857['query']['limit']);_0x3170d5[_0xeb3d('0x31')]=qs[_0xeb3d('0x31')](_0x822857['query'][_0xeb3d('0x31')]);}_0x3170d5[_0xeb3d('0x4e')]=qs[_0xeb3d('0x4f')](_0x822857['query'][_0xeb3d('0x4f')]);_0x3170d5[_0xeb3d('0x50')]=qs[_0xeb3d('0x48')](_[_0xeb3d('0x51')](_0x822857[_0xeb3d('0x46')],_0x578265[_0xeb3d('0x48')]));_0x3170d5['where'][_0xeb3d('0x69')]=_0x3ee162['id'];if(_0x822857[_0xeb3d('0x46')][_0xeb3d('0x6a')]){_0x3170d5[_0xeb3d('0x50')]=_[_0xeb3d('0x52')](_0x3170d5[_0xeb3d('0x50')],{'$or':_[_0xeb3d('0x45')](_0x3170d5[_0xeb3d('0x4a')],function(_0x51e224){var _0x5e3f24={};_0x5e3f24[_0x51e224]={'$like':'%'+_0x822857['query'][_0xeb3d('0x6a')]+'%'};return _0x5e3f24;})});}_0x3170d5=_['merge']({},_0x3170d5,_0x822857['options']);return db[_0xeb3d('0x6e')][_0xeb3d('0x30')]({'where':_0x3170d5[_0xeb3d('0x50')]})[_0xeb3d('0x23')](function(_0x3d6578){_0x214711['count']=_0x3d6578;if(_0x822857[_0xeb3d('0x46')][_0xeb3d('0x54')]){_0x3170d5[_0xeb3d('0x5c')]=[{'all':!![]}];}return db[_0xeb3d('0x6e')][_0xeb3d('0x55')](_0x3170d5);})[_0xeb3d('0x23')](function(_0x31abc7){_0x214711['rows']=_0x31abc7;return _0x214711;});}})[_0xeb3d('0x23')](respondWithFilteredResult(_0x45a027,_0x3170d5))[_0xeb3d('0x57')](handleError(_0x45a027,null));};exports[_0xeb3d('0x6f')]=function(_0x4989fd,_0x226c1c,_0x54510e){return db[_0xeb3d('0x40')]['find']({'where':{'id':_0x4989fd[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x226c1c,null))[_0xeb3d('0x23')](function(_0x2e166d){if(_0x2e166d){return _0x2e166d[_0xeb3d('0x6f')](_0x4989fd['query'][_0xeb3d('0x6c')]);}})[_0xeb3d('0x23')](respondWithStatusCode(_0x226c1c,null))[_0xeb3d('0x57')](handleError(_0x226c1c,null));};exports[_0xeb3d('0x70')]=function(_0x3af147,_0x2688a6,_0xf4b56d){return db['WhatsappAccount'][_0xeb3d('0x63')]({'where':{'id':_0x3af147[_0xeb3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x2688a6,null))[_0xeb3d('0x23')](function(_0x1c040f){if(_0x1c040f){return _0x1c040f[_0xeb3d('0x70')](_0x3af147[_0xeb3d('0x5f')][_0xeb3d('0x6c')],_[_0xeb3d('0x71')](_0x3af147[_0xeb3d('0x5f')],[_0xeb3d('0x6c'),'id'])||{})[_0xeb3d('0x72')](function(_0x4bce37){for(var _0x31b959=0x0;_0x31b959<_0x3af147[_0xeb3d('0x5f')]['ids'][_0xeb3d('0x5b')];_0x31b959+=0x1){socket[_0xeb3d('0x73')](_0xeb3d('0x74'),{'UserId':Number(_0x3af147[_0xeb3d('0x5f')][_0xeb3d('0x6c')][_0x31b959]),'WhatsappAccountId':Number(_0x3af147[_0xeb3d('0x59')]['id'])});}return _0x4bce37;});}})['then'](respondWithResult(_0x2688a6,null))[_0xeb3d('0x57')](handleError(_0x2688a6,null));};exports['removeAgents']=function(_0x4747aa,_0x331750,_0x44d7a0){return db[_0xeb3d('0x40')]['find']({'where':{'id':_0x4747aa[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x331750,null))[_0xeb3d('0x23')](function(_0x180b92){if(_0x180b92){return _0x180b92['removeAgents'](_0x4747aa[_0xeb3d('0x46')][_0xeb3d('0x6c')])[_0xeb3d('0x23')](function(){if(_['isArray'](_0x4747aa[_0xeb3d('0x46')][_0xeb3d('0x6c')])){for(var _0x261d8e=0x0;_0x261d8e<_0x4747aa[_0xeb3d('0x46')]['ids'][_0xeb3d('0x5b')];_0x261d8e+=0x1){socket[_0xeb3d('0x73')](_0xeb3d('0x75'),{'UserId':Number(_0x4747aa[_0xeb3d('0x46')][_0xeb3d('0x6c')][_0x261d8e]),'WhatsappAccountId':Number(_0x4747aa[_0xeb3d('0x59')]['id'])});}}else{socket[_0xeb3d('0x73')](_0xeb3d('0x75'),{'UserId':Number(_0x4747aa[_0xeb3d('0x46')][_0xeb3d('0x6c')]),'WhatsappAccountId':Number(_0x4747aa[_0xeb3d('0x59')]['id'])});}});}})[_0xeb3d('0x23')](respondWithStatusCode(_0x331750,null))[_0xeb3d('0x57')](handleError(_0x331750,null));};exports['getAgents']=function(_0x2cf8e9,_0x58b8f9,_0x3615c8){var _0x292e64={};var _0x24e9c8={};var _0xfe1ff3;var _0x58d9f4;return db[_0xeb3d('0x40')][_0xeb3d('0x67')]({'where':{'id':_0x2cf8e9[_0xeb3d('0x59')]['id']}})[_0xeb3d('0x23')](handleEntityNotFound(_0x58b8f9,null))[_0xeb3d('0x23')](function(_0xf47f41){if(_0xf47f41){_0xfe1ff3=_0xf47f41;_0x24e9c8[_0xeb3d('0x44')]=_[_0xeb3d('0x47')](db['User'][_0xeb3d('0x5a')]);_0x24e9c8[_0xeb3d('0x46')]=_[_0xeb3d('0x47')](_0x2cf8e9[_0xeb3d('0x46')]);_0x24e9c8['filters']=_[_0xeb3d('0x49')](_0x24e9c8[_0xeb3d('0x44')],_0x24e9c8['query']);_0x292e64['attributes']=_[_0xeb3d('0x49')](_0x24e9c8[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x2cf8e9['query'][_0xeb3d('0x4b')]));_0x292e64[_0xeb3d('0x4a')]=_0x292e64['attributes'][_0xeb3d('0x5b')]?_0x292e64[_0xeb3d('0x4a')]:_0x24e9c8[_0xeb3d('0x44')];_0x292e64[_0xeb3d('0x4e')]=qs[_0xeb3d('0x4f')](_0x2cf8e9[_0xeb3d('0x46')][_0xeb3d('0x4f')]);_0x292e64[_0xeb3d('0x50')]=qs[_0xeb3d('0x48')](_[_0xeb3d('0x51')](_0x2cf8e9['query'],_0x24e9c8[_0xeb3d('0x48')]));if(_0x2cf8e9[_0xeb3d('0x46')]['filter']){_0x292e64['where']=_[_0xeb3d('0x52')](_0x292e64[_0xeb3d('0x50')],{'$or':_[_0xeb3d('0x45')](_0x292e64[_0xeb3d('0x4a')],function(_0x4e4f4c){var _0x3f8902={};_0x3f8902[_0x4e4f4c]={'$like':'%'+_0x2cf8e9[_0xeb3d('0x46')][_0xeb3d('0x6a')]+'%'};return _0x3f8902;})});}_0x292e64=_[_0xeb3d('0x52')]({},_0x292e64,_0x2cf8e9[_0xeb3d('0x5d')]);return _0xfe1ff3['getAgents'](_0x292e64);}})[_0xeb3d('0x23')](function(_0x290563){if(_0x290563){_0x58d9f4=_0x290563[_0xeb3d('0x5b')];if(!_0x2cf8e9[_0xeb3d('0x46')][_0xeb3d('0x4c')]('nolimit')){_0x292e64[_0xeb3d('0x2f')]=qs[_0xeb3d('0x2f')](_0x2cf8e9['query']['limit']);_0x292e64[_0xeb3d('0x31')]=qs['offset'](_0x2cf8e9[_0xeb3d('0x46')][_0xeb3d('0x31')]);}return _0xfe1ff3[_0xeb3d('0x76')](_0x292e64);}})[_0xeb3d('0x23')](function(_0x1d7f90){if(_0x1d7f90){return _0x1d7f90?{'count':_0x58d9f4,'rows':_0x1d7f90}:null;}})['then'](respondWithResult(_0x58b8f9,null))[_0xeb3d('0x57')](handleError(_0x58b8f9,null));};exports['addApplications']=function(_0x4d766e,_0x5e3347){var _0x15d512=_0x4d766e[_0xeb3d('0x59')]['id'];var _0x1175d4=_0x4d766e[_0xeb3d('0x5f')];var _0x2f9b3a=0xc8;var _0x3ec04e=null;return db['sequelize'][_0xeb3d('0x77')]({'isolationLevel':db[_0xeb3d('0x78')]['Transaction']['ISOLATION_LEVELS'][_0xeb3d('0x79')]},function(_0x393448){return db[_0xeb3d('0x40')]['findOne']({'where':{'id':_0x15d512},'transaction':_0x393448})['then'](function(_0x5799c5){if(_0x5799c5){return db[_0xeb3d('0x7a')][_0xeb3d('0x39')]({'where':{'WhatsappAccountId':_0x15d512},'transaction':_0x393448})['then'](function(){var _0x2cecb8=_[_0xeb3d('0x45')](_0x1175d4,function(_0x4c2320){_0x4c2320['WhatsappAccountId']=_0x15d512;return _0x4c2320;});return db[_0xeb3d('0x7a')][_0xeb3d('0x7b')](_0x2cecb8,{'transaction':_0x393448});});}else{_0x2f9b3a=0x194;_0x3ec04e=[];}});})[_0xeb3d('0x23')](function(){if(_0x2f9b3a!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x15d512},'order':_0xeb3d('0x7c')})['then'](function(_0x38aa9b){_0x3ec04e=_0x38aa9b;});}})[_0xeb3d('0x57')](function(_0x273764){_0x2f9b3a=0x1f4;logger[_0xeb3d('0x29')](_0x273764['stack']);if(_0x273764['name']){delete _0x273764['name'];}_0x3ec04e=_0x273764;})[_0xeb3d('0x7d')](function(){if(_0x3ec04e===null){_0x5e3347[_0xeb3d('0x3a')](_0x2f9b3a);}else{if(_0x2f9b3a===0x1f4){_0x5e3347[_0xeb3d('0x2c')](_0x2f9b3a)[_0xeb3d('0x7e')](_0x3ec04e);}else{_0x5e3347[_0xeb3d('0x2c')](_0x2f9b3a)['json'](_0x3ec04e);}}});};exports[_0xeb3d('0x7f')]=function(_0x3bf3a3,_0x59e3dc,_0x1ffbfa){var _0x20d972={};var _0x30946b={};var _0x314136;var _0x334bdf;return db['WhatsappAccount'][_0xeb3d('0x67')]({'where':{'id':_0x3bf3a3[_0xeb3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x59e3dc,null))[_0xeb3d('0x23')](function(_0x57f798){if(_0x57f798){_0x314136=_0x57f798;_0x30946b[_0xeb3d('0x44')]=_[_0xeb3d('0x47')](db[_0xeb3d('0x7a')][_0xeb3d('0x5a')]);_0x30946b[_0xeb3d('0x46')]=_[_0xeb3d('0x47')](_0x3bf3a3['query']);_0x30946b[_0xeb3d('0x48')]=_[_0xeb3d('0x49')](_0x30946b[_0xeb3d('0x44')],_0x30946b[_0xeb3d('0x46')]);_0x20d972[_0xeb3d('0x4a')]=_[_0xeb3d('0x49')](_0x30946b[_0xeb3d('0x44')],qs[_0xeb3d('0x4b')](_0x3bf3a3[_0xeb3d('0x46')]['fields']));_0x20d972['attributes']=_0x20d972['attributes'][_0xeb3d('0x5b')]?_0x20d972[_0xeb3d('0x4a')]:_0x30946b[_0xeb3d('0x44')];_0x20d972['order']=qs[_0xeb3d('0x4f')](_0x3bf3a3[_0xeb3d('0x46')][_0xeb3d('0x4f')]);_0x20d972[_0xeb3d('0x50')]=qs[_0xeb3d('0x48')](_[_0xeb3d('0x51')](_0x3bf3a3[_0xeb3d('0x46')],_0x30946b[_0xeb3d('0x48')]));if(_0x3bf3a3[_0xeb3d('0x46')]['filter']){_0x20d972[_0xeb3d('0x50')]=_[_0xeb3d('0x52')](_0x20d972[_0xeb3d('0x50')],{'$or':_[_0xeb3d('0x45')](_0x20d972[_0xeb3d('0x4a')],function(_0x487afd){var _0x20ebbb={};_0x20ebbb[_0x487afd]={'$like':'%'+_0x3bf3a3['query'][_0xeb3d('0x6a')]+'%'};return _0x20ebbb;})});}_0x20d972=_['merge']({},_0x20d972,_0x3bf3a3[_0xeb3d('0x5d')]);return _0x314136['getApplications'](_0x20d972);}})[_0xeb3d('0x23')](function(_0x4b6460){if(_0x4b6460){_0x334bdf=_0x4b6460[_0xeb3d('0x5b')];if(!_0x3bf3a3[_0xeb3d('0x46')][_0xeb3d('0x4c')](_0xeb3d('0x4d'))){_0x20d972['limit']=qs[_0xeb3d('0x2f')](_0x3bf3a3[_0xeb3d('0x46')][_0xeb3d('0x2f')]);_0x20d972[_0xeb3d('0x31')]=qs[_0xeb3d('0x31')](_0x3bf3a3[_0xeb3d('0x46')][_0xeb3d('0x31')]);}return _0x314136['getApplications'](_0x20d972);}})[_0xeb3d('0x23')](function(_0x1edb59){if(_0x1edb59){return _0x1edb59?{'count':_0x334bdf,'rows':_0x1edb59}:null;}})[_0xeb3d('0x23')](respondWithResult(_0x59e3dc,null))[_0xeb3d('0x57')](handleError(_0x59e3dc,null));};exports[_0xeb3d('0x80')]=function(_0xd61e51,_0x4c7ce4,_0x3142b9){var _0x3454f2={'channel':'whatsapp'};var _0x2d390c=[];var _0x17818f=[];var _0x27385e={};return db[_0xeb3d('0x40')]['find']({'where':{'id':_0xd61e51['params']['id']},'include':[{'model':db[_0xeb3d('0x7a')],'as':'Applications'}]})[_0xeb3d('0x23')](handleEntityNotFound(_0x4c7ce4,null))[_0xeb3d('0x23')](function(_0x1af083){_0x3454f2[_0xeb3d('0x81')]=_0x1af083;if(_0x3454f2[_0xeb3d('0x81')]&&_0x3454f2[_0xeb3d('0x81')]['type']===_0xeb3d('0x82')&&_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x83')]){if(_0xd61e51['body'][_0xeb3d('0x83')][_0xeb3d('0x5b')]===0x0)return;if(_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x83')][0x0][_0xeb3d('0x84')]!==_0xeb3d('0x85'))return;return db[_0xeb3d('0x86')][_0xeb3d('0x36')]({'read':!![],'readAt':_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x83')][0x0][_0xeb3d('0x87')]},{'where':{'messageId':_0xd61e51[_0xeb3d('0x5f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xeb3d('0x23')](function(_0x40e1ec){return _0x4c7ce4[_0xeb3d('0x2c')](0xc8)['json'](_0x40e1ec);});}_0x3454f2[_0xeb3d('0x88')]=_[_0xeb3d('0x89')](_0x1af083['Applications'],['priority'],[_0xeb3d('0x8a')]);if(_0x3454f2['account'][_0xeb3d('0x8b')]){delete _0x3454f2[_0xeb3d('0x81')][_0xeb3d('0x8b')];}return db[_0xeb3d('0x8c')][_0xeb3d('0x66')]()[_0xeb3d('0x23')](function(_0x207ece){if(!_0x207ece){throw new db[(_0xeb3d('0x8d'))][(_0xeb3d('0x8e'))]('no\x20available\x20attributes');}_0x2d390c=_[_0xeb3d('0x8f')](_[_0xeb3d('0x47')](_0x207ece),[_0xeb3d('0x90'),'updatedAt']);_0x17818f=_['difference'](_[_0xeb3d('0x47')](_0x207ece),[_0xeb3d('0x90'),_0xeb3d('0x91'),_0xeb3d('0x92'),_0xeb3d('0x93')]);_0x3454f2['body']={'mapKey':_0xeb3d('0x94')};if(_0x3454f2[_0xeb3d('0x81')]&&_0x3454f2[_0xeb3d('0x81')]['type']===_0xeb3d('0x95')){_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x96')]=_0xd61e51[_0xeb3d('0x5f')]['From'][_0xeb3d('0x97')](_0xeb3d('0x98'),'');_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x5f')]=_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x99')];_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x9a')]=_0xd61e51[_0xeb3d('0x5f')]['MessageSid'];}if(_0x3454f2[_0xeb3d('0x81')]&&_0x3454f2['account'][_0xeb3d('0x42')]===_0xeb3d('0x82')){_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x96')]=_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x9b')][0x0]['from'];_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x5f')]=_0xd61e51['body'][_0xeb3d('0x9b')][0x0][_0xeb3d('0x2b')][_0xeb3d('0x5f')];_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x9a')]=_0xd61e51[_0xeb3d('0x5f')][_0xeb3d('0x9b')][0x0][_0xeb3d('0x9c')];}if(_0x3454f2[_0xeb3d('0x5f')]['id']){delete _0x3454f2['body']['id'];}if(_['isNil'](_0x3454f2['body']['from'])){throw new db[(_0xeb3d('0x8d'))][(_0xeb3d('0x8e'))](_0xeb3d('0x9d'));}if(_[_0xeb3d('0x9e')](_0x3454f2['body'][_0xeb3d('0x5f')])||_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x5f')]===''){throw new db[(_0xeb3d('0x8d'))][(_0xeb3d('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb3d('0x9e')](_0x3454f2['body'][_0xeb3d('0x9f')])){throw new db[(_0xeb3d('0x8d'))][(_0xeb3d('0x8e'))](_0xeb3d('0xa0')+_0x17818f);}if(!_['includes'](_0x17818f,_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x9f')])){throw new db[(_0xeb3d('0x8d'))]['ValidationError'](_0xeb3d('0xa1')+_0x17818f);}_0x27385e[_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x9f')]]=_0x3454f2[_0xeb3d('0x5f')]['from'];return db[_0xeb3d('0xa2')][_0xeb3d('0x63')]({'where':{'id':_0x3454f2['account']['ListId']},'include':[{'model':db[_0xeb3d('0x8c')],'as':_0xeb3d('0xa3'),'where':_0x27385e,'limit':0x1,'order':[[_0xeb3d('0x91'),_0xeb3d('0xa4')]]}]});})[_0xeb3d('0x23')](handleEntityNotFound(_0x4c7ce4,null))[_0xeb3d('0x23')](function(_0x2f6fb8){if(_0x2f6fb8){_0x3454f2[_0xeb3d('0xa5')]=_[_0xeb3d('0x71')](_0x2f6fb8,[_0xeb3d('0xa3')]);if(_0x2f6fb8['Contacts']['length']){return _0x2f6fb8[_0xeb3d('0xa3')][0x0];}var _0x5605dc=_['defaults'](_0x3454f2[_0xeb3d('0x5f')],{'firstName':_0x3454f2[_0xeb3d('0x5f')]['from'],'ListId':_0x2f6fb8['id']});_0x5605dc[_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x9f')]]=_0x3454f2[_0xeb3d('0x5f')]['from'];return db[_0xeb3d('0x8c')]['create'](_0x5605dc,{'fields':_0x2d390c,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c7ce4,null))[_0xeb3d('0x23')](function(_0xfac7cd){if(_0xfac7cd){_0x3454f2[_0xeb3d('0xa6')]=_0xfac7cd;var _0x28ac4d={'ContactId':_0xfac7cd['id'],'phone':_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x96')],'WhatsappAccountId':_0xd61e51[_0xeb3d('0x59')]['id']};var _0x5a946a={'ContactId':_0xfac7cd['id'],'WhatsappAccountId':_0xd61e51[_0xeb3d('0x59')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xeb3d('0x63')]({'where':_0x5a946a})[_0xeb3d('0x23')](function(_0x1bee21){if(_0x1bee21){return[_0x1bee21,![]];}return db[_0xeb3d('0xa7')]['create'](_0x28ac4d)['then'](function(_0x53e75f){return[_0x53e75f,!![]];});});}})[_0xeb3d('0x72')](function(_0x55a3c1,_0xec2144){_0x3454f2[_0xeb3d('0xa8')]=_0x55a3c1[_0xeb3d('0x61')]({'plain':!![]});_0x3454f2[_0xeb3d('0xa8')][_0xeb3d('0xa9')]=![];if(_0xec2144){if(_0x3454f2['account'][_0xeb3d('0xaa')]){_0x3454f2[_0xeb3d('0x88')][_0xeb3d('0xab')]({'id':0x0,'priority':_0x3454f2['applications'][_0xeb3d('0x5b')]+0x1,'app':_0xeb3d('0xac'),'appdata':_0xeb3d('0xad'),'interval':_0xeb3d('0xae')});}_0x3454f2[_0xeb3d('0xa8')]['created']=!![];}return db[_0xeb3d('0x86')][_0xeb3d('0x5e')]({'phone':_0x3454f2['body'][_0xeb3d('0x96')],'messageId':_0x3454f2[_0xeb3d('0x5f')]['messageId'],'body':_0x3454f2[_0xeb3d('0x5f')][_0xeb3d('0x5f')],'WhatsappAccountId':_0xd61e51['params']['id'],'WhatsappInteractionId':_0x55a3c1['id'],'direction':'in','ContactId':_0x55a3c1[_0xeb3d('0xaf')],'AttachmentId':_0x3454f2[_0xeb3d('0x5f')]['AttachmentId']});})[_0xeb3d('0x23')](function(_0x58f87b){_0x3454f2[_0xeb3d('0x2b')]=_0x58f87b;if(_0x3454f2[_0xeb3d('0xa8')][_0xeb3d('0xb0')]){return db['User'][_0xeb3d('0x63')]({'attributes':['id',_0xeb3d('0x3c')],'where':{'id':_0x3454f2[_0xeb3d('0xa8')][_0xeb3d('0xb0')]}})[_0xeb3d('0x23')](function(_0x44ff42){if(_0x44ff42){_0x3454f2[_0xeb3d('0x88')][_0xeb3d('0xb1')]({'id':0x0,'priority':0x0,'app':_0xeb3d('0xb2'),'appdata':_0x44ff42[_0xeb3d('0x3c')]+','+(_0x3454f2[_0xeb3d('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xeb3d('0xae')});}return respondWithRpcPromise(_0xeb3d('0xb3'),_0xeb3d('0xb4'),_0x3454f2);});}return respondWithRpcPromise('Start',_0xeb3d('0xb4'),_0x3454f2);})[_0xeb3d('0x23')](function(_0x5a52f0){if(_0x5a52f0){var _0xfefd14=0xc8;var _0x14c109=_0xeb3d('0xb5');logger[_0xeb3d('0x24')](_0xeb3d('0x28'),_0x14c109,_0xfefd14,_0xeb3d('0xb6'));logger['debug'](_0xeb3d('0xb7'),_0x14c109,_0xfefd14,_0xeb3d('0xb6'),JSON[_0xeb3d('0xb8')](_0x5a52f0));if(_0x3454f2[_0xeb3d('0x81')][_0xeb3d('0x42')]===_0xeb3d('0x95')){return _0x4c7ce4[_0xeb3d('0x2c')](_0xfefd14)[_0xeb3d('0x32')](_0xeb3d('0xb9'),_0xeb3d('0xba'))[_0xeb3d('0x7e')]('\x0a');}else{return _0x4c7ce4['status'](_0xfefd14)[_0xeb3d('0x33')](_0x5a52f0);}}});})[_0xeb3d('0x57')](handleError(_0x4c7ce4,null));};exports[_0xeb3d('0x7e')]=function(_0x1b6e6e,_0x5d11d4,_0x38a2aa){var _0x388584,_0x42ab59,_0x4ae350;if(_[_0xeb3d('0x9e')](_0x1b6e6e['body'][_0xeb3d('0x5f')])||_0x1b6e6e[_0xeb3d('0x5f')]['body']===''){throw new db[(_0xeb3d('0x8d'))][(_0xeb3d('0x8e'))](_0xeb3d('0xbb'));}if(_['isNil'](_0x1b6e6e['body']['to'])){throw new db['Sequelize'][(_0xeb3d('0x8e'))](_0xeb3d('0xbc'));}_0x388584=_0x1b6e6e[_0xeb3d('0x5f')]['to'];return db[_0xeb3d('0x40')][_0xeb3d('0x63')]({'where':{'id':_0x1b6e6e[_0xeb3d('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xeb3d('0x8c')],'as':_0xeb3d('0xa3'),'where':{'mobile':_0x388584},'limit':0x1,'order':[[_0xeb3d('0x91'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5d11d4,null))[_0xeb3d('0x23')](function(_0x1291eb){if(_0x1291eb&&_0x1291eb['List']){_0x42ab59=_0x1291eb[_0xeb3d('0x61')]({'plain':!![]});if(_0x42ab59[_0xeb3d('0xbd')]&&_0x42ab59[_0xeb3d('0xbd')][_0xeb3d('0xa3')]['length']){return _0x42ab59[_0xeb3d('0xbd')][_0xeb3d('0xa3')][0x0];}return db['CmContact']['create'](_[_0xeb3d('0x1a')](_0x1b6e6e[_0xeb3d('0x5f')],{'firstName':_0x388584,'mobile':_0x388584,'phone':_0x388584,'ListId':_0x42ab59[_0xeb3d('0x93')]}));}})[_0xeb3d('0x23')](handleEntityNotFound(_0x5d11d4,null))[_0xeb3d('0x23')](function(_0x195680){if(_0x195680){_0x4ae350=_0x195680;return db[_0xeb3d('0xa7')][_0xeb3d('0x63')]({'where':{'ContactId':_0x4ae350['id'],'closed':![],'WhatsappAccountId':_0x42ab59['id']}})['then'](function(_0x46e46e){if(_0x46e46e){return[_0x46e46e,![]];}return db[_0xeb3d('0xa7')][_0xeb3d('0x5e')]({'UserId':_0x1b6e6e[_0xeb3d('0x60')]['id'],'ContactId':_0x4ae350['id'],'WhatsappAccountId':_0x42ab59['id'],'phone':_0x388584,'firstMsgDirection':'out','Messages':[_[_0xeb3d('0x52')](_0x1b6e6e[_0xeb3d('0x5f')],{'read':![],'body':_0x1b6e6e[_0xeb3d('0x5f')][_0xeb3d('0x5f')],'phone':_0x388584,'WhatsappAccountId':_0x42ab59['id'],'UserId':_0x1b6e6e[_0xeb3d('0x60')]['id'],'ContactId':_0x4ae350['id']})]},{'include':[{'model':db[_0xeb3d('0x86')],'as':_0xeb3d('0xbe')}]})[_0xeb3d('0x23')](function(_0x50ce2e){return[_0x50ce2e,!![]];});});}})['spread'](function(_0x2d7f26,_0x388feb){if(_0x388feb){return _0x2d7f26;}return db[_0xeb3d('0x86')][_0xeb3d('0x5e')](_[_0xeb3d('0x52')](_0x1b6e6e[_0xeb3d('0x5f')],{'read':![],'body':_0x1b6e6e['body']['body'],'phone':_0x388584,'WhatsappAccountId':_0x42ab59['id'],'WhatsappInteractionId':_0x2d7f26['id'],'UserId':_0x1b6e6e[_0xeb3d('0x60')]['id'],'ContactId':_0x4ae350['id']}))[_0xeb3d('0x23')](function(_0x283bbe){_0x2d7f26[_0xeb3d('0xbf')]['Messages']=[];_0x2d7f26[_0xeb3d('0xbf')]['Messages']['push'](_0x283bbe[_0xeb3d('0xbf')]);return _0x2d7f26;});})[_0xeb3d('0x23')](respondWithResult(_0x5d11d4,null))[_0xeb3d('0x57')](handleError(_0x5d11d4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4d90f5e..0469c17 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 _0xb150=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb150,0x195));var _0x0b15=function(_0x446b5b,_0x3b40cc){_0x446b5b=_0x446b5b-0x0;var _0xd988d8=_0xb150[_0x446b5b];return _0xd988d8;};'use strict';var EventEmitter=require(_0x0b15('0x0'));var WhatsappAccount=require(_0x0b15('0x1'))['db'][_0x0b15('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0b15('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b15('0x4'),'afterDestroy':_0x0b15('0x5')};function emitEvent(_0x7cde7b){return function(_0x40c5dc,_0x382781,_0x7c01f){WhatsappAccountEvents[_0x0b15('0x6')](_0x7cde7b+':'+_0x40c5dc['id'],_0x40c5dc);WhatsappAccountEvents[_0x0b15('0x6')](_0x7cde7b,_0x40c5dc);_0x7c01f(null);};}for(var e in events){if(events[_0x0b15('0x7')](e)){var event=events[e];WhatsappAccount[_0x0b15('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x51f8=['remove','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x1e6b81,_0x1eb3ec){var _0x457c87=function(_0x46f35e){while(--_0x46f35e){_0x1e6b81['push'](_0x1e6b81['shift']());}};_0x457c87(++_0x1eb3ec);}(_0x51f8,0x1b5));var _0x851f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x51f8[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x851f('0x0'));var WhatsappAccount=require(_0x851f('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x851f('0x2'),'afterUpdate':_0x851f('0x3'),'afterDestroy':_0x851f('0x4')};function emitEvent(_0x30c66a){return function(_0x419ea7,_0x469b66,_0x2f2101){WhatsappAccountEvents['emit'](_0x30c66a+':'+_0x419ea7['id'],_0x419ea7);WhatsappAccountEvents['emit'](_0x30c66a,_0x419ea7);_0x2f2101(null);};}for(var e in events){if(events[_0x851f('0x5')](e)){var event=events[e];WhatsappAccount[_0x851f('0x6')](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 d7fbf2d..fde12e2 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 _0xf474=['request-promise','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','../../config/logger','bluebird'];(function(_0x79164,_0x344e6){var _0xfda909=function(_0x162e37){while(--_0x162e37){_0x79164['push'](_0x79164['shift']());}};_0xfda909(++_0x344e6);}(_0xf474,0xb1));var _0x4f47=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf474[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x4f47('0x0'));var util=require('util');var logger=require(_0x4f47('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4f47('0x2'));var rp=require(_0x4f47('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f47('0x4'));var attributes=require(_0x4f47('0x5'));module[_0x4f47('0x6')]=function(_0x33f2e8,_0x1012a9){return _0x33f2e8[_0x4f47('0x7')](_0x4f47('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6308=['WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x4a2fa6,_0x89d91){var _0x58419c=function(_0x4fae21){while(--_0x4fae21){_0x4a2fa6['push'](_0x4a2fa6['shift']());}};_0x58419c(++_0x89d91);}(_0x6308,0x12d));var _0x8630=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x6308[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x8630('0x0'));var util=require(_0x8630('0x1'));var logger=require('../../config/logger')(_0x8630('0x2'));var moment=require(_0x8630('0x3'));var BPromise=require(_0x8630('0x4'));var rp=require(_0x8630('0x5'));var fs=require('fs');var path=require(_0x8630('0x6'));var rimraf=require(_0x8630('0x7'));var config=require(_0x8630('0x8'));var attributes=require(_0x8630('0x9'));module[_0x8630('0xa')]=function(_0xb91564,_0x3ffa9e){return _0xb91564['define'](_0x8630('0xb'),attributes,{'tableName':_0x8630('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2c4a87b..25ddb19 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 _0x2fed=['localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults'];(function(_0x519999,_0x14ef9a){var _0x8a0b1d=function(_0x382e0d){while(--_0x382e0d){_0x519999['push'](_0x519999['shift']());}};_0x8a0b1d(++_0x14ef9a);}(_0x2fed,0x11b));var _0xd2fe=function(_0x51b678,_0x54288f){_0x51b678=_0x51b678-0x0;var _0x4a6b9e=_0x2fed[_0x51b678];return _0x4a6b9e;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2fe('0x3'));var fs=require('fs');var Redis=require(_0xd2fe('0x4'));var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require(_0xd2fe('0x7'))(_0xd2fe('0x8'));var config=require(_0xd2fe('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd2fe('0xa')]({'port':0x232a});config[_0xd2fe('0xb')]=_[_0xd2fe('0xc')](config[_0xd2fe('0xb')],{'host':_0xd2fe('0xd'),'port':0x18eb});var socket=require(_0xd2fe('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xd2fe('0xf')](socket);function respondWithRpcPromise(_0x342018,_0x1a55f7,_0x465c9b){return new BPromise(function(_0xcb4ff8,_0x31d3e9){return client[_0xd2fe('0x10')](_0x342018,_0x465c9b)['then'](function(_0x38c41e){logger[_0xd2fe('0x11')](_0xd2fe('0x12'),_0x1a55f7,_0xd2fe('0x13'));logger['debug'](_0xd2fe('0x14'),_0x1a55f7,_0xd2fe('0x13'),JSON[_0xd2fe('0x15')](_0x38c41e));if(_0x38c41e[_0xd2fe('0x16')]){if(_0x38c41e['error'][_0xd2fe('0x17')]===0x1f4){logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);return _0x31d3e9(_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);}logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x38c41e[_0xd2fe('0x16')][_0xd2fe('0x18')]);return _0xcb4ff8(_0x38c41e['error'][_0xd2fe('0x18')]);}else{logger[_0xd2fe('0x11')](_0xd2fe('0x12'),_0x1a55f7,'request\x20sent');_0xcb4ff8(_0x38c41e[_0xd2fe('0x19')][_0xd2fe('0x18')]);}})[_0xd2fe('0x1a')](function(_0x742479){logger[_0xd2fe('0x16')](_0xd2fe('0x12'),_0x1a55f7,_0x742479);_0x31d3e9(_0x742479);});});}exports[_0xd2fe('0x1b')]=function(_0x59e67b){var _0x2a1478=this;return new Promise(function(_0x2659b8,_0x34c26b){return db['WhatsappAccount'][_0xd2fe('0x1c')]({'raw':_0x59e67b['options']?_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x1e')]===undefined?!![]:![]:!![],'where':_0x59e67b[_0xd2fe('0x1d')]?_0x59e67b[_0xd2fe('0x1d')]['where']||null:null,'attributes':_0x59e67b['options']?_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x1f')]||null:null,'include':_0x59e67b[_0xd2fe('0x1d')]?_0x59e67b['options']['include']?_[_0xd2fe('0x20')](_0x59e67b[_0xd2fe('0x1d')][_0xd2fe('0x21')],function(_0xf3f54b){return{'model':db[_0xf3f54b[_0xd2fe('0x22')]],'as':_0xf3f54b['as'],'attributes':_0xf3f54b[_0xd2fe('0x1f')],'include':_0xf3f54b[_0xd2fe('0x21')]?_[_0xd2fe('0x20')](_0xf3f54b['include'],function(_0x472781){return{'model':db[_0x472781[_0xd2fe('0x22')]],'as':_0x472781['as'],'attributes':_0x472781[_0xd2fe('0x1f')],'include':_0x472781[_0xd2fe('0x21')]?_['map'](_0x472781['include'],function(_0x17bc94){return{'model':db[_0x17bc94['model']],'as':_0x17bc94['as'],'attributes':_0x17bc94[_0xd2fe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd2fe('0x23')](function(_0x33450a){logger[_0xd2fe('0x11')](_0xd2fe('0x1b'),_0x59e67b);logger[_0xd2fe('0x24')](_0xd2fe('0x1b'),_0x59e67b,JSON[_0xd2fe('0x15')](_0x33450a));_0x2659b8(_0x33450a);})[_0xd2fe('0x1a')](function(_0x593100){logger[_0xd2fe('0x16')](_0xd2fe('0x1b'),_0x593100[_0xd2fe('0x18')],_0x59e67b);_0x34c26b(_0x2a1478[_0xd2fe('0x16')](0x1f4,_0x593100[_0xd2fe('0x18')]));});});}; \ No newline at end of file +var _0x0249=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then'];(function(_0x47b381,_0x4c2ff6){var _0x34d96e=function(_0x37f7b4){while(--_0x37f7b4){_0x47b381['push'](_0x47b381['shift']());}};_0x34d96e(++_0x4c2ff6);}(_0x0249,0x86));var _0x9024=function(_0x5a5c5b,_0x32485c){_0x5a5c5b=_0x5a5c5b-0x0;var _0x47a702=_0x0249[_0x5a5c5b];return _0x47a702;};'use strict';var _=require(_0x9024('0x0'));var util=require(_0x9024('0x1'));var moment=require(_0x9024('0x2'));var BPromise=require('bluebird');var rs=require(_0x9024('0x3'));var fs=require('fs');var Redis=require(_0x9024('0x4'));var db=require(_0x9024('0x5'))['db'];var utils=require(_0x9024('0x6'));var logger=require('../../config/logger')(_0x9024('0x7'));var config=require(_0x9024('0x8'));var jayson=require(_0x9024('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9024('0xa')]=_[_0x9024('0xb')](config[_0x9024('0xa')],{'host':_0x9024('0xc'),'port':0x18eb});var socket=require(_0x9024('0xd'))(new Redis(config[_0x9024('0xa')]));require(_0x9024('0xe'))[_0x9024('0xf')](socket);function respondWithRpcPromise(_0x15fb6e,_0x557f92,_0xb0c691){return new BPromise(function(_0x55d459,_0x46b6c4){return client[_0x9024('0x10')](_0x15fb6e,_0xb0c691)[_0x9024('0x11')](function(_0x1ad7b3){logger['info'](_0x9024('0x12'),_0x557f92,_0x9024('0x13'));logger[_0x9024('0x14')](_0x9024('0x15'),_0x557f92,_0x9024('0x13'),JSON[_0x9024('0x16')](_0x1ad7b3));if(_0x1ad7b3['error']){if(_0x1ad7b3[_0x9024('0x17')][_0x9024('0x18')]===0x1f4){logger[_0x9024('0x17')](_0x9024('0x12'),_0x557f92,_0x1ad7b3[_0x9024('0x17')]['message']);return _0x46b6c4(_0x1ad7b3[_0x9024('0x17')][_0x9024('0x19')]);}logger['error'](_0x9024('0x12'),_0x557f92,_0x1ad7b3[_0x9024('0x17')]['message']);return _0x55d459(_0x1ad7b3['error'][_0x9024('0x19')]);}else{logger[_0x9024('0x1a')](_0x9024('0x12'),_0x557f92,_0x9024('0x13'));_0x55d459(_0x1ad7b3[_0x9024('0x1b')][_0x9024('0x19')]);}})[_0x9024('0x1c')](function(_0x53f3f2){logger[_0x9024('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x557f92,_0x53f3f2);_0x46b6c4(_0x53f3f2);});});}exports[_0x9024('0x1d')]=function(_0x45e849){var _0x3636d0=this;return new Promise(function(_0x160371,_0x40f6ac){return db[_0x9024('0x1e')][_0x9024('0x1f')]({'raw':_0x45e849['options']?_0x45e849[_0x9024('0x20')][_0x9024('0x21')]===undefined?!![]:![]:!![],'where':_0x45e849[_0x9024('0x20')]?_0x45e849[_0x9024('0x20')]['where']||null:null,'attributes':_0x45e849[_0x9024('0x20')]?_0x45e849[_0x9024('0x20')]['attributes']||null:null,'include':_0x45e849[_0x9024('0x20')]?_0x45e849[_0x9024('0x20')][_0x9024('0x22')]?_[_0x9024('0x23')](_0x45e849[_0x9024('0x20')]['include'],function(_0x24a195){return{'model':db[_0x24a195[_0x9024('0x24')]],'as':_0x24a195['as'],'attributes':_0x24a195[_0x9024('0x25')],'include':_0x24a195['include']?_[_0x9024('0x23')](_0x24a195[_0x9024('0x22')],function(_0x210138){return{'model':db[_0x210138[_0x9024('0x24')]],'as':_0x210138['as'],'attributes':_0x210138['attributes'],'include':_0x210138[_0x9024('0x22')]?_[_0x9024('0x23')](_0x210138[_0x9024('0x22')],function(_0x2eea31){return{'model':db[_0x2eea31[_0x9024('0x24')]],'as':_0x2eea31['as'],'attributes':_0x2eea31['attributes']};}):[]};}):[]};}):[]:[]})[_0x9024('0x11')](function(_0x33ec11){logger[_0x9024('0x1a')](_0x9024('0x1d'),_0x45e849);logger[_0x9024('0x14')](_0x9024('0x1d'),_0x45e849,JSON[_0x9024('0x16')](_0x33ec11));_0x160371(_0x33ec11);})[_0x9024('0x1c')](function(_0x4f4526){logger[_0x9024('0x17')](_0x9024('0x1d'),_0x4f4526[_0x9024('0x19')],_0x45e849);_0x40f6ac(_0x3636d0[_0x9024('0x17')](0x1f4,_0x4f4526[_0x9024('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f8dd1ff..efd6a5f 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 _0xa290=['update','removeListener','register','length','whatsappAccount:','save','remove'];(function(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0xa290,0x139));var _0x0a29=function(_0x5b05bc,_0x2ad09d){_0x5b05bc=_0x5b05bc-0x0;var _0x153881=_0xa290[_0x5b05bc];return _0x153881;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x0a29('0x0'),_0x0a29('0x1'),_0x0a29('0x2')];function createListener(_0x35042c,_0x3e9e74){return function(_0x46a461){_0x3e9e74['emit'](_0x35042c,_0x46a461);};}function removeListener(_0x11ed4d,_0x11d41a){return function(){WhatsappAccountEvents[_0x0a29('0x3')](_0x11ed4d,_0x11d41a);};}exports[_0x0a29('0x4')]=function(_0x1d183a){for(var _0x2762e2=0x0,_0x10ba54=events[_0x0a29('0x5')];_0x2762e2<_0x10ba54;_0x2762e2++){var _0x5cdb2b=events[_0x2762e2];var _0x1271f4=createListener(_0x0a29('0x6')+_0x5cdb2b,_0x1d183a);WhatsappAccountEvents['on'](_0x5cdb2b,_0x1271f4);}}; \ No newline at end of file +var _0x5a35=['remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x17f526,_0xaf4874){var _0x39809d=function(_0x5cf2bd){while(--_0x5cf2bd){_0x17f526['push'](_0x17f526['shift']());}};_0x39809d(++_0xaf4874);}(_0x5a35,0x1c7));var _0x55a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a35[_0x2641f9];return _0x585741;};'use strict';var WhatsappAccountEvents=require(_0x55a3('0x0'));var events=['save',_0x55a3('0x1'),_0x55a3('0x2')];function createListener(_0x57805f,_0x131656){return function(_0x2077f3){_0x131656[_0x55a3('0x3')](_0x57805f,_0x2077f3);};}function removeListener(_0x489e53,_0x28437f){return function(){WhatsappAccountEvents[_0x55a3('0x4')](_0x489e53,_0x28437f);};}exports[_0x55a3('0x5')]=function(_0x30fcc7){for(var _0x360b45=0x0,_0x313167=events[_0x55a3('0x6')];_0x360b45<_0x313167;_0x360b45++){var _0x44955d=events[_0x360b45];var _0x5d4cdc=createListener(_0x55a3('0x7')+_0x44955d,_0x30fcc7);WhatsappAccountEvents['on'](_0x44955d,_0x5d4cdc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4a50576..099ed76 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 _0xa4e6=['create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post'];(function(_0x33acd5,_0x33fd24){var _0x3850dc=function(_0x1d74a8){while(--_0x1d74a8){_0x33acd5['push'](_0x33acd5['shift']());}};_0x3850dc(++_0x33fd24);}(_0xa4e6,0xe1));var _0x6a4e=function(_0xbfd132,_0x47c55e){_0xbfd132=_0xbfd132-0x0;var _0x272166=_0xa4e6[_0xbfd132];return _0x272166;};'use strict';var multer=require('multer');var util=require(_0x6a4e('0x0'));var path=require(_0x6a4e('0x1'));var timeout=require(_0x6a4e('0x2'));var express=require(_0x6a4e('0x3'));var router=express[_0x6a4e('0x4')]();var fs_extra=require(_0x6a4e('0x5'));var auth=require(_0x6a4e('0x6'));var interaction=require(_0x6a4e('0x7'));var config=require(_0x6a4e('0x8'));var controller=require(_0x6a4e('0x9'));router[_0x6a4e('0xa')]('/',auth[_0x6a4e('0xb')](),controller[_0x6a4e('0xc')]);router[_0x6a4e('0xa')](_0x6a4e('0xd'),auth[_0x6a4e('0xb')](),controller['show']);router[_0x6a4e('0xe')]('/',auth['isAuthenticated'](),controller[_0x6a4e('0xf')]);router[_0x6a4e('0x10')](_0x6a4e('0xd'),auth[_0x6a4e('0xb')](),controller[_0x6a4e('0x11')]);router[_0x6a4e('0x12')]('/:id',auth[_0x6a4e('0xb')](),controller['destroy']);module[_0x6a4e('0x13')]=router; \ No newline at end of file +var _0xa513=['create','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4de7ca,_0x980eb7){var _0x4425dd=function(_0x59122f){while(--_0x59122f){_0x4de7ca['push'](_0x4de7ca['shift']());}};_0x4425dd(++_0x980eb7);}(_0xa513,0xb7));var _0x3a51=function(_0x497c5e,_0x235f6e){_0x497c5e=_0x497c5e-0x0;var _0x4b4e87=_0xa513[_0x497c5e];return _0x4b4e87;};'use strict';var multer=require(_0x3a51('0x0'));var util=require(_0x3a51('0x1'));var path=require('path');var timeout=require(_0x3a51('0x2'));var express=require(_0x3a51('0x3'));var router=express['Router']();var fs_extra=require(_0x3a51('0x4'));var auth=require(_0x3a51('0x5'));var interaction=require(_0x3a51('0x6'));var config=require(_0x3a51('0x7'));var controller=require(_0x3a51('0x8'));router[_0x3a51('0x9')]('/',auth[_0x3a51('0xa')](),controller[_0x3a51('0xb')]);router[_0x3a51('0x9')](_0x3a51('0xc'),auth['isAuthenticated'](),controller[_0x3a51('0xd')]);router[_0x3a51('0xe')]('/',auth[_0x3a51('0xa')](),controller[_0x3a51('0xf')]);router['put'](_0x3a51('0xc'),auth['isAuthenticated'](),controller[_0x3a51('0x10')]);router[_0x3a51('0x11')](_0x3a51('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 e379ab3..ed639dd 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 _0x1a16=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0x1a16,0xe2));var _0x61a1=function(_0x3ee336,_0x251cfc){_0x3ee336=_0x3ee336-0x0;var _0x204647=_0x1a16[_0x3ee336];return _0x204647;};'use strict';var Sequelize=require(_0x61a1('0x0'));module[_0x61a1('0x1')]={'priority':{'type':Sequelize[_0x61a1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61a1('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61a1('0x4')]()},'description':{'type':Sequelize[_0x61a1('0x3')]},'interval':{'type':Sequelize[_0x61a1('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0aff=['exports','STRING','TEXT','*,*,*,*'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x0aff,0x1d0));var _0xf0af=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x0aff[_0x4c2f17];return _0x20919e;};'use strict';var Sequelize=require('sequelize');module[_0xf0af('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf0af('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf0af('0x2')]()},'description':{'type':Sequelize[_0xf0af('0x1')]},'interval':{'type':Sequelize[_0xf0af('0x1')],'defaultValue':_0xf0af('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4de5879..5229598 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 _0x6691=['filter','merge','options','WhatsappApplication','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x5c0c1a,_0x24ae6f){var _0x7d67f1=function(_0x5c7774){while(--_0x5c7774){_0x5c0c1a['push'](_0x5c0c1a['shift']());}};_0x7d67f1(++_0x24ae6f);}(_0x6691,0x12d));var _0x1669=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6691[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x1669('0x0'));var rimraf=require(_0x1669('0x1'));var zipdir=require(_0x1669('0x2'));var jsonpatch=require(_0x1669('0x3'));var rp=require(_0x1669('0x4'));var moment=require(_0x1669('0x5'));var BPromise=require(_0x1669('0x6'));var Mustache=require(_0x1669('0x7'));var util=require(_0x1669('0x8'));var path=require(_0x1669('0x9'));var sox=require('sox');var csv=require(_0x1669('0xa'));var ejs=require(_0x1669('0xb'));var fs=require('fs');var fs_extra=require(_0x1669('0xc'));var _=require(_0x1669('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1669('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1669('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1669('0x10'));var as=require(_0x1669('0x11'));var hardwareService=require(_0x1669('0x12'));var logger=require(_0x1669('0x13'))(_0x1669('0x14'));var utils=require(_0x1669('0x15'));var config=require(_0x1669('0x16'));var licenseUtil=require(_0x1669('0x17'));var db=require(_0x1669('0x18'))['db'];function respondWithStatusCode(_0x46352e,_0x3709f0){_0x3709f0=_0x3709f0||0xcc;return function(_0x2031eb){if(_0x2031eb){return _0x46352e[_0x1669('0x19')](_0x3709f0);}return _0x46352e[_0x1669('0x1a')](_0x3709f0)[_0x1669('0x1b')]();};}function respondWithResult(_0x355ac3,_0x102193){_0x102193=_0x102193||0xc8;return function(_0x2904b6){if(_0x2904b6){return _0x355ac3[_0x1669('0x1a')](_0x102193)[_0x1669('0x1c')](_0x2904b6);}};}function respondWithFilteredResult(_0x14eb3e,_0x31b2be){return function(_0x1f9ea6){if(_0x1f9ea6){var _0x4d2f66=typeof _0x31b2be[_0x1669('0x1d')]===_0x1669('0x1e')&&typeof _0x31b2be[_0x1669('0x1f')]===_0x1669('0x1e');var _0x285d86=_0x1f9ea6['count'];var _0x56e3d9=_0x4d2f66?0x0:_0x31b2be[_0x1669('0x1d')];var _0x31600f=_0x4d2f66?_0x1f9ea6[_0x1669('0x20')]:_0x31b2be[_0x1669('0x1d')]+_0x31b2be[_0x1669('0x1f')];var _0x64edff;if(_0x31600f>=_0x285d86){_0x31600f=_0x285d86;_0x64edff=0xc8;}else{_0x64edff=0xce;}_0x14eb3e[_0x1669('0x1a')](_0x64edff);return _0x14eb3e['set'](_0x1669('0x21'),_0x56e3d9+'-'+_0x31600f+'/'+_0x285d86)[_0x1669('0x1c')](_0x1f9ea6);}return null;};}function patchUpdates(_0x51297e){return function(_0x3dc48a){try{jsonpatch[_0x1669('0x22')](_0x3dc48a,_0x51297e,!![]);}catch(_0x4e1b1b){return BPromise[_0x1669('0x23')](_0x4e1b1b);}return _0x3dc48a[_0x1669('0x24')]();};}function saveUpdates(_0x2e95c3,_0x17c227){return function(_0x311f56){if(_0x311f56){return _0x311f56['update'](_0x2e95c3)[_0x1669('0x25')](function(_0x457973){return _0x457973;});}return null;};}function removeEntity(_0x344eaf,_0x5796f2){return function(_0x176b4b){if(_0x176b4b){return _0x176b4b['destroy']()['then'](function(){_0x344eaf[_0x1669('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304b25,_0x3ce429){return function(_0x1ab80f){if(!_0x1ab80f){_0x304b25[_0x1669('0x19')](0x194);}return _0x1ab80f;};}function handleError(_0x50abe4,_0x660cc7){_0x660cc7=_0x660cc7||0x1f4;return function(_0x5283da){logger['error'](_0x5283da[_0x1669('0x26')]);if(_0x5283da['name']){delete _0x5283da[_0x1669('0x27')];}_0x50abe4[_0x1669('0x1a')](_0x660cc7)['send'](_0x5283da);};}exports[_0x1669('0x28')]=function(_0x590053,_0x29aff9){var _0x1512e2={},_0x31f4f0={},_0x3fe045={'count':0x0,'rows':[]};var _0x577a0a=_['map'](db['WhatsappApplication'][_0x1669('0x29')],function(_0x6429dc){return{'name':_0x6429dc[_0x1669('0x2a')],'type':_0x6429dc[_0x1669('0x2b')][_0x1669('0x2c')]};});_0x31f4f0['model']=_[_0x1669('0x2d')](_0x577a0a,_0x1669('0x27'));_0x31f4f0[_0x1669('0x2e')]=_[_0x1669('0x2f')](_0x590053[_0x1669('0x2e')]);_0x31f4f0[_0x1669('0x30')]=_[_0x1669('0x31')](_0x31f4f0[_0x1669('0x32')],_0x31f4f0['query']);_0x1512e2[_0x1669('0x33')]=_['intersection'](_0x31f4f0[_0x1669('0x32')],qs['fields'](_0x590053['query'][_0x1669('0x34')]));_0x1512e2[_0x1669('0x33')]=_0x1512e2[_0x1669('0x33')][_0x1669('0x35')]?_0x1512e2[_0x1669('0x33')]:_0x31f4f0[_0x1669('0x32')];if(!_0x590053[_0x1669('0x2e')][_0x1669('0x36')](_0x1669('0x37'))){_0x1512e2['limit']=qs[_0x1669('0x1f')](_0x590053[_0x1669('0x2e')][_0x1669('0x1f')]);_0x1512e2[_0x1669('0x1d')]=qs[_0x1669('0x1d')](_0x590053[_0x1669('0x2e')][_0x1669('0x1d')]);}_0x1512e2['order']=qs[_0x1669('0x38')](_0x590053[_0x1669('0x2e')][_0x1669('0x38')]);_0x1512e2[_0x1669('0x39')]=qs[_0x1669('0x30')](_[_0x1669('0x3a')](_0x590053['query'],_0x31f4f0['filters']),_0x577a0a);if(_0x590053['query'][_0x1669('0x3b')]){_0x1512e2[_0x1669('0x39')]=_[_0x1669('0x3c')](_0x1512e2[_0x1669('0x39')],{'$or':_[_0x1669('0x2d')](_0x577a0a,function(_0x2c35db){if(_0x2c35db[_0x1669('0x2b')]!=='VIRTUAL'){var _0x9ad261={};_0x9ad261[_0x2c35db[_0x1669('0x27')]]={'$like':'%'+_0x590053['query']['filter']+'%'};return _0x9ad261;}})});}_0x1512e2=_[_0x1669('0x3c')]({},_0x1512e2,_0x590053[_0x1669('0x3d')]);var _0x379d82={'where':_0x1512e2[_0x1669('0x39')]};return db[_0x1669('0x3e')]['count'](_0x379d82)[_0x1669('0x25')](function(_0x5ba428){_0x3fe045['count']=_0x5ba428;if(_0x590053[_0x1669('0x2e')]['includeAll']){_0x1512e2[_0x1669('0x3f')]=[{'all':!![]}];}return db[_0x1669('0x3e')][_0x1669('0x40')](_0x1512e2);})[_0x1669('0x25')](function(_0x5e21eb){_0x3fe045[_0x1669('0x41')]=_0x5e21eb;return _0x3fe045;})[_0x1669('0x25')](respondWithFilteredResult(_0x29aff9,_0x1512e2))[_0x1669('0x42')](handleError(_0x29aff9,null));};exports['show']=function(_0x2c1e3b,_0x297c30){var _0x3c4434={'raw':!![],'where':{'id':_0x2c1e3b[_0x1669('0x43')]['id']}},_0x23a1c5={};_0x23a1c5[_0x1669('0x32')]=_[_0x1669('0x2f')](db['WhatsappApplication'][_0x1669('0x29')]);_0x23a1c5['query']=_[_0x1669('0x2f')](_0x2c1e3b['query']);_0x23a1c5[_0x1669('0x30')]=_[_0x1669('0x31')](_0x23a1c5[_0x1669('0x32')],_0x23a1c5[_0x1669('0x2e')]);_0x3c4434[_0x1669('0x33')]=_[_0x1669('0x31')](_0x23a1c5['model'],qs[_0x1669('0x34')](_0x2c1e3b[_0x1669('0x2e')][_0x1669('0x34')]));_0x3c4434['attributes']=_0x3c4434['attributes']['length']?_0x3c4434['attributes']:_0x23a1c5[_0x1669('0x32')];if(_0x2c1e3b[_0x1669('0x2e')][_0x1669('0x44')]){_0x3c4434['include']=[{'all':!![]}];}_0x3c4434=_['merge']({},_0x3c4434,_0x2c1e3b[_0x1669('0x3d')]);return db['WhatsappApplication'][_0x1669('0x45')](_0x3c4434)[_0x1669('0x25')](handleEntityNotFound(_0x297c30,null))[_0x1669('0x25')](respondWithResult(_0x297c30,null))[_0x1669('0x42')](handleError(_0x297c30,null));};exports[_0x1669('0x46')]=function(_0x2ad0eb,_0x410299){return db['WhatsappApplication'][_0x1669('0x46')](_0x2ad0eb['body'],{})[_0x1669('0x25')](respondWithResult(_0x410299,0xc9))['catch'](handleError(_0x410299,null));};exports['update']=function(_0x2778e3,_0x36ab74){if(_0x2778e3[_0x1669('0x47')]['id']){delete _0x2778e3[_0x1669('0x47')]['id'];}return db[_0x1669('0x3e')][_0x1669('0x45')]({'where':{'id':_0x2778e3['params']['id']}})[_0x1669('0x25')](handleEntityNotFound(_0x36ab74,null))[_0x1669('0x25')](saveUpdates(_0x2778e3['body'],null))[_0x1669('0x25')](respondWithResult(_0x36ab74,null))[_0x1669('0x42')](handleError(_0x36ab74,null));};exports['destroy']=function(_0x53d184,_0x3d3a24){return db[_0x1669('0x3e')][_0x1669('0x45')]({'where':{'id':_0x53d184[_0x1669('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d3a24,null))[_0x1669('0x25')](removeEntity(_0x3d3a24,null))[_0x1669('0x42')](handleError(_0x3d3a24,null));}; \ No newline at end of file +var _0xde9f=['limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','fields','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','../../config/license/util','sendStatus','status','json','offset'];(function(_0x174265,_0x529fa6){var _0x3eac63=function(_0x5e62c2){while(--_0x5e62c2){_0x174265['push'](_0x174265['shift']());}};_0x3eac63(++_0x529fa6);}(_0xde9f,0x118));var _0xfde9=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xde9f[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0xfde9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfde9('0x1'));var rp=require(_0xfde9('0x2'));var moment=require('moment');var BPromise=require(_0xfde9('0x3'));var Mustache=require(_0xfde9('0x4'));var util=require('util');var path=require(_0xfde9('0x5'));var sox=require(_0xfde9('0x6'));var csv=require(_0xfde9('0x7'));var ejs=require(_0xfde9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfde9('0x9'));var crypto=require(_0xfde9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfde9('0xb'));var toCsv=require(_0xfde9('0x7'));var querystring=require(_0xfde9('0xc'));var Papa=require(_0xfde9('0xd'));var Redis=require(_0xfde9('0xe'));var authService=require(_0xfde9('0xf'));var qs=require(_0xfde9('0x10'));var as=require(_0xfde9('0x11'));var hardwareService=require(_0xfde9('0x12'));var logger=require(_0xfde9('0x13'))(_0xfde9('0x14'));var utils=require(_0xfde9('0x15'));var config=require(_0xfde9('0x16'));var licenseUtil=require(_0xfde9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5742c7,_0x345a64){_0x345a64=_0x345a64||0xcc;return function(_0x3add66){if(_0x3add66){return _0x5742c7[_0xfde9('0x18')](_0x345a64);}return _0x5742c7[_0xfde9('0x19')](_0x345a64)['end']();};}function respondWithResult(_0x5af78d,_0x36e754){_0x36e754=_0x36e754||0xc8;return function(_0x3f8d50){if(_0x3f8d50){return _0x5af78d[_0xfde9('0x19')](_0x36e754)[_0xfde9('0x1a')](_0x3f8d50);}};}function respondWithFilteredResult(_0x29fa8a,_0x489841){return function(_0x454068){if(_0x454068){var _0x310b90=typeof _0x489841[_0xfde9('0x1b')]==='undefined'&&typeof _0x489841[_0xfde9('0x1c')]===_0xfde9('0x1d');var _0x1a42ef=_0x454068['count'];var _0x4c9f24=_0x310b90?0x0:_0x489841['offset'];var _0x544f19=_0x310b90?_0x454068[_0xfde9('0x1e')]:_0x489841[_0xfde9('0x1b')]+_0x489841['limit'];var _0x50a21a;if(_0x544f19>=_0x1a42ef){_0x544f19=_0x1a42ef;_0x50a21a=0xc8;}else{_0x50a21a=0xce;}_0x29fa8a[_0xfde9('0x19')](_0x50a21a);return _0x29fa8a[_0xfde9('0x1f')](_0xfde9('0x20'),_0x4c9f24+'-'+_0x544f19+'/'+_0x1a42ef)[_0xfde9('0x1a')](_0x454068);}return null;};}function patchUpdates(_0x162b07){return function(_0x12543d){try{jsonpatch[_0xfde9('0x21')](_0x12543d,_0x162b07,!![]);}catch(_0x2ef059){return BPromise[_0xfde9('0x22')](_0x2ef059);}return _0x12543d[_0xfde9('0x23')]();};}function saveUpdates(_0x10cb3f,_0x28d189){return function(_0x54c1b8){if(_0x54c1b8){return _0x54c1b8[_0xfde9('0x24')](_0x10cb3f)['then'](function(_0x33e016){return _0x33e016;});}return null;};}function removeEntity(_0x159141,_0x20bdb3){return function(_0x5d0a74){if(_0x5d0a74){return _0x5d0a74[_0xfde9('0x25')]()[_0xfde9('0x26')](function(){_0x159141['status'](0xcc)[_0xfde9('0x27')]();});}};}function handleEntityNotFound(_0x1c4864,_0x2188a5){return function(_0x242dae){if(!_0x242dae){_0x1c4864[_0xfde9('0x18')](0x194);}return _0x242dae;};}function handleError(_0x37ad02,_0x1f2e12){_0x1f2e12=_0x1f2e12||0x1f4;return function(_0xce2d91){logger[_0xfde9('0x28')](_0xce2d91[_0xfde9('0x29')]);if(_0xce2d91[_0xfde9('0x2a')]){delete _0xce2d91[_0xfde9('0x2a')];}_0x37ad02[_0xfde9('0x19')](_0x1f2e12)[_0xfde9('0x2b')](_0xce2d91);};}exports[_0xfde9('0x2c')]=function(_0x1514f8,_0x4b7956){var _0x5cbf71={},_0x26aaf4={},_0x421472={'count':0x0,'rows':[]};var _0x578d67=_[_0xfde9('0x2d')](db[_0xfde9('0x2e')][_0xfde9('0x2f')],function(_0x1bf2a2){return{'name':_0x1bf2a2[_0xfde9('0x30')],'type':_0x1bf2a2['type'][_0xfde9('0x31')]};});_0x26aaf4[_0xfde9('0x32')]=_['map'](_0x578d67,_0xfde9('0x2a'));_0x26aaf4[_0xfde9('0x33')]=_[_0xfde9('0x34')](_0x1514f8[_0xfde9('0x33')]);_0x26aaf4[_0xfde9('0x35')]=_['intersection'](_0x26aaf4[_0xfde9('0x32')],_0x26aaf4['query']);_0x5cbf71[_0xfde9('0x36')]=_['intersection'](_0x26aaf4[_0xfde9('0x32')],qs['fields'](_0x1514f8[_0xfde9('0x33')]['fields']));_0x5cbf71[_0xfde9('0x36')]=_0x5cbf71[_0xfde9('0x36')][_0xfde9('0x37')]?_0x5cbf71[_0xfde9('0x36')]:_0x26aaf4[_0xfde9('0x32')];if(!_0x1514f8[_0xfde9('0x33')][_0xfde9('0x38')](_0xfde9('0x39'))){_0x5cbf71[_0xfde9('0x1c')]=qs[_0xfde9('0x1c')](_0x1514f8[_0xfde9('0x33')]['limit']);_0x5cbf71[_0xfde9('0x1b')]=qs[_0xfde9('0x1b')](_0x1514f8[_0xfde9('0x33')][_0xfde9('0x1b')]);}_0x5cbf71['order']=qs[_0xfde9('0x3a')](_0x1514f8[_0xfde9('0x33')][_0xfde9('0x3a')]);_0x5cbf71[_0xfde9('0x3b')]=qs[_0xfde9('0x35')](_[_0xfde9('0x3c')](_0x1514f8['query'],_0x26aaf4[_0xfde9('0x35')]),_0x578d67);if(_0x1514f8['query'][_0xfde9('0x3d')]){_0x5cbf71[_0xfde9('0x3b')]=_[_0xfde9('0x3e')](_0x5cbf71['where'],{'$or':_[_0xfde9('0x2d')](_0x578d67,function(_0x350977){if(_0x350977[_0xfde9('0x3f')]!==_0xfde9('0x40')){var _0x22e2dc={};_0x22e2dc[_0x350977[_0xfde9('0x2a')]]={'$like':'%'+_0x1514f8[_0xfde9('0x33')][_0xfde9('0x3d')]+'%'};return _0x22e2dc;}})});}_0x5cbf71=_['merge']({},_0x5cbf71,_0x1514f8[_0xfde9('0x41')]);var _0x3496aa={'where':_0x5cbf71[_0xfde9('0x3b')]};return db[_0xfde9('0x2e')][_0xfde9('0x1e')](_0x3496aa)['then'](function(_0x3a7c8d){_0x421472[_0xfde9('0x1e')]=_0x3a7c8d;if(_0x1514f8['query'][_0xfde9('0x42')]){_0x5cbf71[_0xfde9('0x43')]=[{'all':!![]}];}return db[_0xfde9('0x2e')]['findAll'](_0x5cbf71);})['then'](function(_0x5c4e5a){_0x421472[_0xfde9('0x44')]=_0x5c4e5a;return _0x421472;})[_0xfde9('0x26')](respondWithFilteredResult(_0x4b7956,_0x5cbf71))[_0xfde9('0x45')](handleError(_0x4b7956,null));};exports[_0xfde9('0x46')]=function(_0x127641,_0x15d9a7){var _0x3f02cc={'raw':!![],'where':{'id':_0x127641[_0xfde9('0x47')]['id']}},_0x307f31={};_0x307f31[_0xfde9('0x32')]=_[_0xfde9('0x34')](db[_0xfde9('0x2e')]['rawAttributes']);_0x307f31['query']=_['keys'](_0x127641['query']);_0x307f31[_0xfde9('0x35')]=_[_0xfde9('0x48')](_0x307f31[_0xfde9('0x32')],_0x307f31[_0xfde9('0x33')]);_0x3f02cc[_0xfde9('0x36')]=_[_0xfde9('0x48')](_0x307f31[_0xfde9('0x32')],qs[_0xfde9('0x49')](_0x127641[_0xfde9('0x33')][_0xfde9('0x49')]));_0x3f02cc[_0xfde9('0x36')]=_0x3f02cc[_0xfde9('0x36')][_0xfde9('0x37')]?_0x3f02cc[_0xfde9('0x36')]:_0x307f31[_0xfde9('0x32')];if(_0x127641[_0xfde9('0x33')][_0xfde9('0x42')]){_0x3f02cc[_0xfde9('0x43')]=[{'all':!![]}];}_0x3f02cc=_[_0xfde9('0x3e')]({},_0x3f02cc,_0x127641['options']);return db[_0xfde9('0x2e')][_0xfde9('0x4a')](_0x3f02cc)[_0xfde9('0x26')](handleEntityNotFound(_0x15d9a7,null))[_0xfde9('0x26')](respondWithResult(_0x15d9a7,null))[_0xfde9('0x45')](handleError(_0x15d9a7,null));};exports[_0xfde9('0x4b')]=function(_0x4874af,_0x3da297){return db['WhatsappApplication'][_0xfde9('0x4b')](_0x4874af['body'],{})[_0xfde9('0x26')](respondWithResult(_0x3da297,0xc9))[_0xfde9('0x45')](handleError(_0x3da297,null));};exports[_0xfde9('0x24')]=function(_0x3ae986,_0x1a7bef){if(_0x3ae986['body']['id']){delete _0x3ae986[_0xfde9('0x4c')]['id'];}return db[_0xfde9('0x2e')][_0xfde9('0x4a')]({'where':{'id':_0x3ae986[_0xfde9('0x47')]['id']}})[_0xfde9('0x26')](handleEntityNotFound(_0x1a7bef,null))[_0xfde9('0x26')](saveUpdates(_0x3ae986[_0xfde9('0x4c')],null))[_0xfde9('0x26')](respondWithResult(_0x1a7bef,null))[_0xfde9('0x45')](handleError(_0x1a7bef,null));};exports[_0xfde9('0x25')]=function(_0x3be67a,_0x5275fc){return db[_0xfde9('0x2e')][_0xfde9('0x4a')]({'where':{'id':_0x3be67a[_0xfde9('0x47')]['id']}})[_0xfde9('0x26')](handleEntityNotFound(_0x5275fc,null))[_0xfde9('0x26')](removeEntity(_0x5275fc,null))[_0xfde9('0x45')](handleError(_0x5275fc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d28f86f..6eae882 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 _0x2029=['../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x151dc7,_0x1295d8){var _0x4d8be9=function(_0x37554f){while(--_0x37554f){_0x151dc7['push'](_0x151dc7['shift']());}};_0x4d8be9(++_0x1295d8);}(_0x2029,0x171));var _0x9202=function(_0x30b497,_0x2f5eca){_0x30b497=_0x30b497-0x0;var _0x2192b6=_0x2029[_0x30b497];return _0x2192b6;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var logger=require('../../config/logger')(_0x9202('0x2'));var moment=require(_0x9202('0x3'));var BPromise=require(_0x9202('0x4'));var rp=require(_0x9202('0x5'));var fs=require('fs');var path=require(_0x9202('0x6'));var rimraf=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var attributes=require(_0x9202('0x9'));module[_0x9202('0xa')]=function(_0x299c13,_0x2f33bb){return _0x299c13[_0x9202('0xb')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9202('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc1c4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x5cc813,_0x388e0f){_0x5cc813=_0x5cc813-0x0;var _0x36c2a3=_0xc1c4[_0x5cc813];return _0x36c2a3;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var logger=require(_0x4c1c('0x2'))(_0x4c1c('0x3'));var moment=require(_0x4c1c('0x4'));var BPromise=require(_0x4c1c('0x5'));var rp=require(_0x4c1c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c1c('0x7'));var config=require(_0x4c1c('0x8'));var attributes=require(_0x4c1c('0x9'));module[_0x4c1c('0xa')]=function(_0x5ad905,_0xaa5184){return _0x5ad905['define']('WhatsappApplication',attributes,{'tableName':_0x4c1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c1c('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index af2e826..f5bbee3 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 _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4c9e03,_0x3f67d2){var _0x3add6c=function(_0x1cd754){while(--_0x1cd754){_0x4c9e03['push'](_0x4c9e03['shift']());}};_0x3add6c(++_0x3f67d2);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5a985e,_0x6f93cd){_0x5a985e=_0x5a985e-0x0;var _0x4e749d=_0x9bde[_0x5a985e];return _0x4e749d;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x4d8c20,_0x55be0b){var _0x38b467=function(_0x142d84){while(--_0x142d84){_0x4d8c20['push'](_0x4d8c20['shift']());}};_0x38b467(++_0x55be0b);}(_0x9f62,0x154));var _0x29f6=function(_0x3e8b4c,_0x76e4ce){_0x3e8b4c=_0x3e8b4c-0x0;var _0x4b7412=_0x9f62[_0x3e8b4c];return _0x4b7412;};'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});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index bfb2ebd..2f717fc 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 _0x83d0=['addTags','put','whatsappinteraction:update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','download','create','post','/:id/tags','tracked'];(function(_0x5da6c1,_0x4a90f6){var _0xea904c=function(_0x64d5cb){while(--_0x64d5cb){_0x5da6c1['push'](_0x5da6c1['shift']());}};_0xea904c(++_0x4a90f6);}(_0x83d0,0xb7));var _0x083d=function(_0x4447a4,_0x473388){_0x4447a4=_0x4447a4-0x0;var _0x4548cc=_0x83d0[_0x4447a4];return _0x4548cc;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x083d('0x7'));router[_0x083d('0x8')]('/',auth[_0x083d('0x9')](),controller[_0x083d('0xa')]);router[_0x083d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x083d('0xb')]);router[_0x083d('0x8')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xd')]);router[_0x083d('0x8')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['getMessages']);router[_0x083d('0x8')]('/:id/download',auth[_0x083d('0x9')](),controller[_0x083d('0xf')]);router['post']('/',auth[_0x083d('0x9')](),controller[_0x083d('0x10')]);router[_0x083d('0x11')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['addMessage']);router[_0x083d('0x11')](_0x083d('0x12'),auth['isAuthenticated'](),interaction[_0x083d('0x13')]('whatsapp','whatsappinteraction:addtags'),controller[_0x083d('0x14')]);router[_0x083d('0x15')](_0x083d('0xc'),auth[_0x083d('0x9')](),interaction[_0x083d('0x13')]('whatsapp',_0x083d('0x16')),controller['update']);router[_0x083d('0x17')](_0x083d('0xc'),auth[_0x083d('0x9')](),interaction[_0x083d('0x13')](_0x083d('0x18'),_0x083d('0x19')),controller[_0x083d('0x1a')]);router[_0x083d('0x17')](_0x083d('0x12'),auth[_0x083d('0x9')](),controller[_0x083d('0x1b')]);module[_0x083d('0x1c')]=router; \ No newline at end of file +var _0xb4c7=['post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','create'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2e99bc,_0x1a106d){_0x2e99bc=_0x2e99bc-0x0;var _0x34cc39=_0xb4c7[_0x2e99bc];return _0x34cc39;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0xc')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0xc')](_0x7b4c('0x12'),auth[_0x7b4c('0xa')](),controller['download']);router['post']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x14')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x14')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x18')),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')](_0x7b4c('0x1b'),_0x7b4c('0x1c')),controller['update']);router[_0x7b4c('0x1d')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x1e')),controller[_0x7b4c('0x1f')]);router[_0x7b4c('0x1d')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x20')]);module[_0x7b4c('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 88bfcd7..3827d91 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 _0xcf71=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x8f006d,_0x15e41c){var _0x15c899=function(_0x20e9c7){while(--_0x20e9c7){_0x8f006d['push'](_0x8f006d['shift']());}};_0x15c899(++_0x15e41c);}(_0xcf71,0xba));var _0x1cf7=function(_0x9117ad,_0x386be4){_0x9117ad=_0x9117ad-0x0;var _0x540f0c=_0xcf71[_0x9117ad];return _0x540f0c;};'use strict';var Sequelize=require(_0x1cf7('0x0'));var moment=require(_0x1cf7('0x1'));module[_0x1cf7('0x2')]={'closed':{'type':Sequelize[_0x1cf7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1cf7('0x4')]},'secondDisposition':{'type':Sequelize[_0x1cf7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1cf7('0x4')]},'note':{'type':Sequelize[_0x1cf7('0x4')]},'phone':{'type':Sequelize[_0x1cf7('0x4')]},'read1stAt':{'type':Sequelize[_0x1cf7('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x1cf7('0x6')]('in',_0x1cf7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cf7('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x1cf7('0x6')]('in',_0x1cf7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1cf7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1cb9=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0xacf334,_0x2473ff){var _0x384953=function(_0x268d68){while(--_0x268d68){_0xacf334['push'](_0xacf334['shift']());}};_0x384953(++_0x2473ff);}(_0x1cb9,0x14e));var _0x91cb=function(_0xeef4a1,_0x27ee43){_0xeef4a1=_0xeef4a1-0x0;var _0x4b96e7=_0x1cb9[_0xeef4a1];return _0x4b96e7;};'use strict';var Sequelize=require(_0x91cb('0x0'));var moment=require('moment');module[_0x91cb('0x1')]={'closed':{'type':Sequelize[_0x91cb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91cb('0x3')]},'disposition':{'type':Sequelize[_0x91cb('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x91cb('0x4')]},'note':{'type':Sequelize[_0x91cb('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x91cb('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x91cb('0x5')]('in',_0x91cb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x91cb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x91cb('0x5')]('in',_0x91cb('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a8dfd49..3d35a78 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 _0xab00=['Users','map','fullname','TagIds','Tags','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','$substring','split','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','text','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','include','options','create','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','unix','join','files','root','server','attachments','transcript-%d-%s.zip','lastName','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','disposition','Messages','basename','createReadStream','pipe','createWriteStream','out','System','firstName','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','sendStatus','error','name','send'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xab00,0x1b9));var _0x0ab0=function(_0x283c59,_0x19252b){_0x283c59=_0x283c59-0x0;var _0x300eaf=_0xab00[_0x283c59];return _0x300eaf;};'use strict';var emlformat=require(_0x0ab0('0x0'));var rimraf=require(_0x0ab0('0x1'));var zipdir=require(_0x0ab0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab0('0x3'));var moment=require(_0x0ab0('0x4'));var BPromise=require(_0x0ab0('0x5'));var Mustache=require('mustache');var util=require(_0x0ab0('0x6'));var path=require('path');var sox=require(_0x0ab0('0x7'));var csv=require(_0x0ab0('0x8'));var ejs=require(_0x0ab0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ab0('0xa'));var _=require(_0x0ab0('0xb'));var squel=require(_0x0ab0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0ab0('0xd'));var deskjs=require(_0x0ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ab0('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ab0('0x10'));var authService=require(_0x0ab0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ab0('0x12'))('api');var utils=require(_0x0ab0('0x13'));var config=require(_0x0ab0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ab0('0x15'))['db'];config[_0x0ab0('0x16')]=_[_0x0ab0('0x17')](config[_0x0ab0('0x16')],{'host':_0x0ab0('0x18'),'port':0x18eb});var socket=require(_0x0ab0('0x19'))(new Redis(config[_0x0ab0('0x16')]));require(_0x0ab0('0x1a'))[_0x0ab0('0x1b')](socket);function respondWithStatusCode(_0x459477,_0x28f26d){_0x28f26d=_0x28f26d||0xcc;return function(_0x3c39b6){if(_0x3c39b6){return _0x459477['sendStatus'](_0x28f26d);}return _0x459477['status'](_0x28f26d)['end']();};}function respondWithResult(_0x197b59,_0x32fe14){_0x32fe14=_0x32fe14||0xc8;return function(_0x2f594b){if(_0x2f594b){return _0x197b59['status'](_0x32fe14)[_0x0ab0('0x1c')](_0x2f594b);}};}function respondWithFilteredResult(_0x4a453f,_0x5b3bef){return function(_0x5710bf){if(_0x5710bf){var _0x171341=typeof _0x5b3bef[_0x0ab0('0x1d')]===_0x0ab0('0x1e')&&typeof _0x5b3bef[_0x0ab0('0x1f')]===_0x0ab0('0x1e');var _0x407548=_0x5710bf[_0x0ab0('0x20')];var _0x5545c2=_0x171341?0x0:_0x5b3bef['offset'];var _0x2cda33=_0x171341?_0x5710bf[_0x0ab0('0x20')]:_0x5b3bef[_0x0ab0('0x1d')]+_0x5b3bef['limit'];var _0x19b33e;if(_0x2cda33>=_0x407548){_0x2cda33=_0x407548;_0x19b33e=0xc8;}else{_0x19b33e=0xce;}_0x4a453f['status'](_0x19b33e);return _0x4a453f[_0x0ab0('0x21')](_0x0ab0('0x22'),_0x5545c2+'-'+_0x2cda33+'/'+_0x407548)[_0x0ab0('0x1c')](_0x5710bf);}return null;};}function patchUpdates(_0x35ee0d){return function(_0x293631){try{jsonpatch[_0x0ab0('0x23')](_0x293631,_0x35ee0d,!![]);}catch(_0x1bec79){return BPromise['reject'](_0x1bec79);}return _0x293631[_0x0ab0('0x24')]();};}function saveUpdates(_0xe7f0a5,_0x2635a2){return function(_0x5e3ebb){if(_0x5e3ebb){return _0x5e3ebb[_0x0ab0('0x25')](_0xe7f0a5)[_0x0ab0('0x26')](function(_0x3e9afd){return _0x3e9afd;});}return null;};}function removeEntity(_0x5add07,_0x1f5d10){return function(_0x34c9e6){if(_0x34c9e6){return _0x34c9e6[_0x0ab0('0x27')]()[_0x0ab0('0x26')](function(){_0x5add07[_0x0ab0('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d425c,_0x4d330f){return function(_0xdadb81){if(!_0xdadb81){_0x2d425c[_0x0ab0('0x29')](0x194);}return _0xdadb81;};}function handleError(_0x259e97,_0x29e200){_0x29e200=_0x29e200||0x1f4;return function(_0x5ae993){logger[_0x0ab0('0x2a')](_0x5ae993['stack']);if(_0x5ae993[_0x0ab0('0x2b')]){delete _0x5ae993[_0x0ab0('0x2b')];}_0x259e97[_0x0ab0('0x28')](_0x29e200)[_0x0ab0('0x2c')](_0x5ae993);};}function getInteractionUsers(_0x657f32,_0xa9cb4f){return new BPromise(function(_0x3306c6,_0x43aef0){try{if(_0xa9cb4f[_0x657f32['id']]){_0x657f32[_0x0ab0('0x2d')]=_[_0x0ab0('0x2e')](_0xa9cb4f[_0x657f32['id']],function(_0x23e475){return{'id':_0x23e475['id'],'fullname':_0x23e475[_0x0ab0('0x2f')]};});}}catch(_0x572d08){_0x43aef0(_0x572d08);}_0x3306c6(_0x657f32);});}function getInteractionTags(_0xae605a,_0x110676){return new BPromise(function(_0x989e82,_0x30cc46){try{if(_0xae605a[_0x0ab0('0x30')]){_0xae605a[_0x0ab0('0x31')]=[];_0xae605a['TagIds']['split'](',')[_0x0ab0('0x32')](function(_0x319a52){_0xae605a[_0x0ab0('0x31')][_0x0ab0('0x33')](_0x110676[_0x319a52]);});}delete _0xae605a[_0x0ab0('0x30')];}catch(_0x3ce4d0){_0x30cc46(_0x3ce4d0);}_0x989e82(_0xae605a);});}function updateWhatsappInteraction(_0x1f504c,_0x528468,_0x465b60){return new BPromise(function(_0x2ad0d4,_0x2183ee){return getInteractionUsers(_0x1f504c,_0x465b60)[_0x0ab0('0x26')](function(_0x55fb40){return getInteractionTags(_0x55fb40,_0x528468);})[_0x0ab0('0x26')](function(_0x54072b){return getStateInteraction(_0x54072b);})[_0x0ab0('0x26')](function(_0x596534){_0x2ad0d4(_0x596534);})['catch'](function(_0x4df147){_0x2183ee(_0x4df147);});});}function getStateInteraction(_0x4ca64a){return new BPromise(function(_0x2d6648){_0x4ca64a[_0x0ab0('0x34')]=0x0;_0x4ca64a[_0x0ab0('0x35')]=0x0;_0x4ca64a[_0x0ab0('0x36')]=0x0;_0x4ca64a[_0x0ab0('0x37')]=0x0;_0x4ca64a[_0x0ab0('0x38')]=0x0;if(!_0x4ca64a[_0x0ab0('0x39')]&&!_0x4ca64a['UserId']){_0x4ca64a['waiting']+=0x1;}if(!_0x4ca64a['closed']&&_0x4ca64a[_0x0ab0('0x3a')]){_0x4ca64a[_0x0ab0('0x35')]+=0x1;if(_0x4ca64a[_0x0ab0('0x34')]){_0x4ca64a['waiting']-=0x1;}}if(_0x4ca64a['closed']&&_0x4ca64a[_0x0ab0('0x3a')]){_0x4ca64a[_0x0ab0('0x36')]+=0x1;if(_0x4ca64a[_0x0ab0('0x35')]){_0x4ca64a[_0x0ab0('0x35')]-=0x1;}}if(_0x4ca64a[_0x0ab0('0x39')]&&!_0x4ca64a[_0x0ab0('0x3a')]){_0x4ca64a['unmanaged']+=0x1;if(_0x4ca64a[_0x0ab0('0x34')]){_0x4ca64a['waiting']-=0x1;}}_0x4ca64a['total']+=0x1;_0x2d6648(_0x4ca64a);});}exports[_0x0ab0('0x3b')]=function(_0x5384ab,_0x10dc3e){var _0x10746f={},_0x5be95a={},_0x55d2fa={'count':0x0,'rows':[]};var _0x4b0862=_[_0x0ab0('0x2e')](db[_0x0ab0('0x3c')][_0x0ab0('0x3d')],function(_0x5a0314){return{'name':_0x5a0314[_0x0ab0('0x3e')],'type':_0x5a0314[_0x0ab0('0x3f')][_0x0ab0('0x40')]};});_0x5be95a['model']=_[_0x0ab0('0x2e')](_0x4b0862,_0x0ab0('0x2b'));_0x5be95a[_0x0ab0('0x41')]=_[_0x0ab0('0x42')](_0x5384ab[_0x0ab0('0x41')]);_0x5be95a['filters']=_['intersection'](_0x5be95a[_0x0ab0('0x43')],_0x5be95a[_0x0ab0('0x41')]);_0x10746f[_0x0ab0('0x44')]=_[_0x0ab0('0x45')](_0x5be95a[_0x0ab0('0x43')],qs[_0x0ab0('0x46')](_0x5384ab['query'][_0x0ab0('0x46')]));_0x10746f[_0x0ab0('0x44')]=_0x10746f[_0x0ab0('0x44')][_0x0ab0('0x47')]?_0x10746f['attributes']:_0x5be95a['model'];if(!_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x48')](_0x0ab0('0x49'))){_0x10746f[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x1f')]);_0x10746f['offset']=qs['offset'](_0x5384ab['query'][_0x0ab0('0x1d')]);}_0x10746f[_0x0ab0('0x4a')]=qs[_0x0ab0('0x4b')](_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x4b')]);_0x10746f[_0x0ab0('0x4c')]=qs[_0x0ab0('0x4d')](_['pick'](_0x5384ab[_0x0ab0('0x41')],_0x5be95a[_0x0ab0('0x4d')]),_0x4b0862);var _0x39519e=[];var _0x30d400=squel[_0x0ab0('0x4e')]()[_0x0ab0('0x4f')]('id')[_0x0ab0('0x4f')](_0x0ab0('0x2b'))['field']('color')[_0x0ab0('0x50')](_0x0ab0('0x51'));var _0x151c93=squel[_0x0ab0('0x4e')]()[_0x0ab0('0x4f')](_0x0ab0('0x52'))['field'](_0x0ab0('0x53'))[_0x0ab0('0x4f')](_0x0ab0('0x54'))[_0x0ab0('0x50')](_0x0ab0('0x55'),'ui')[_0x0ab0('0x56')](_0x0ab0('0x57'),'u',_0x0ab0('0x58'));var _0x19ba0a=squel[_0x0ab0('0x4e')]()[_0x0ab0('0x50')](_0x0ab0('0x59'),'i')[_0x0ab0('0x56')](_0x0ab0('0x5a'),'c',_0x0ab0('0x5b'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x0ab0('0x56')](_0x0ab0('0x5c'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join']('whatsapp_messages','me',_0x0ab0('0x5d'))[_0x0ab0('0x56')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x0ab0('0x51'),'t',_0x0ab0('0x5e'));var _0xb96cf8=squel[_0x0ab0('0x5f')]();var _0x3e507d=[];var _0xf68b1b=squel[_0x0ab0('0x5f')]();var _0x3377d1;if(_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x60')]){_0x3377d1=as[_0x0ab0('0x61')](_0x5384ab[_0x0ab0('0x41')]['search']);var _0x598202=_0x3377d1[_0x0ab0('0x62')];for(var _0x1e5553=0x0;_0x1e5553<_0x3377d1[_0x0ab0('0x63')][_0x0ab0('0x47')];_0x1e5553++){var _0x5ced70=_0x3377d1[_0x0ab0('0x63')][_0x1e5553];var _0x15dedf='i';var _0x53e70d=_['find'](_0x4b0862,[_0x0ab0('0x2b'),_0x5ced70[_0x0ab0('0x4f')]]);if(!_0x53e70d){switch(_0x5ced70[_0x0ab0('0x4f')]){case _0x0ab0('0x64'):if(_0x5ced70['value']==0x1){_0x19ba0a[_0x0ab0('0x65')]('`'+_0x5ced70['field']+'`\x20=\x200');}else{_0x19ba0a[_0x0ab0('0x65')]('`'+_0x5ced70['field']+_0x0ab0('0x66'));}break;case _0x0ab0('0x67'):if(_0x5ced70['operator']===_0x0ab0('0x68')){if(_0x5ced70['value'][_0x0ab0('0x69')]('\x20')['length']>0x1){_0xb96cf8[_0x598202]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0ab0('0x6a')](_0x5ced70[_0x0ab0('0x6b')]),null);}else{var _0x5d8498='%'+_0x5ced70[_0x0ab0('0x6b')]+'%';_0xb96cf8[_0x598202](_0x0ab0('0x6c'),_0x5d8498,_0x5d8498,_0x5d8498);}}else{_0x53e70d=_[_0x0ab0('0x6d')](_0x4b0862,[_0x0ab0('0x2b'),_0x0ab0('0x6e')]);_0x5ced70[_0x0ab0('0x4f')]=_0x0ab0('0x6e');_0x2b4eb2=as[_0x0ab0('0x6f')](_0x15dedf,_0x53e70d[_0x0ab0('0x3f')],_0x5ced70);_0xb96cf8[_0x598202](_0x2b4eb2['text'],_0x2b4eb2['value'][_0x0ab0('0x70')],_0x2b4eb2['value'][_0x0ab0('0x71')]);}break;case'Tag':var _0x1fd4e2=_0x5ced70[_0x0ab0('0x6b')][_0x0ab0('0x69')](',')['map'](function(_0x31b456){return Number(_0x31b456);});_0x1fd4e2[_0x0ab0('0x32')](function(_0x3f404d){_0xf68b1b['or'](_0x0ab0('0x72'),'%,'+_0x3f404d+',%');});_0x3e507d=_[_0x0ab0('0x73')](_0x3e507d,_0x1fd4e2);break;case _0x0ab0('0x74'):if(_0x5ced70[_0x0ab0('0x75')]===_0x0ab0('0x68')){_0xb96cf8[_0x598202]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ced70[_0x0ab0('0x6b')]+'%',null);}else{_0x53e70d=_[_0x0ab0('0x6d')](_0x4b0862,[_0x0ab0('0x2b'),'UserId']);_0x5ced70[_0x0ab0('0x4f')]=_0x0ab0('0x3a');_0x2b4eb2=as['buildExpression'](_0x15dedf,_0x53e70d[_0x0ab0('0x3f')],_0x5ced70);_0xb96cf8[_0x598202](_0x2b4eb2[_0x0ab0('0x76')],_0x2b4eb2[_0x0ab0('0x6b')][_0x0ab0('0x70')],_0x2b4eb2[_0x0ab0('0x6b')][_0x0ab0('0x71')]);}break;case _0x0ab0('0x77'):_0x2b4eb2=as['buildExpression']('me',null,_0x5ced70);_0xb96cf8[_0x598202](_0x2b4eb2['text'],_0x2b4eb2[_0x0ab0('0x6b')][_0x0ab0('0x70')],_0x2b4eb2[_0x0ab0('0x6b')][_0x0ab0('0x71')]);break;}}else{var _0x2b4eb2=as[_0x0ab0('0x6f')](_0x15dedf,_0x53e70d[_0x0ab0('0x3f')],_0x5ced70);_0xb96cf8[_0x598202](_0x2b4eb2['text'],_0x2b4eb2[_0x0ab0('0x6b')][_0x0ab0('0x70')],_0x2b4eb2['value'][_0x0ab0('0x71')]);}}}else{var _0x593215=_(_0x5384ab['query'])[_0x0ab0('0x42')]()[_0x0ab0('0x2e')](function(_0x10da49){return _[_0x0ab0('0x78')](_0x4b0862,[_0x0ab0('0x2b'),_0x10da49])?_0x10da49:undefined;})[_0x0ab0('0x79')]()['value']();if(!_[_0x0ab0('0x7a')](_0x593215)){_0x593215['forEach'](function(_0x4b62dc){if(_0x4b62dc==='WhatsappAccountId'){_0x19ba0a[_0x0ab0('0x4c')](_0x0ab0('0x7b'),[][_0x0ab0('0x7c')](_0x5384ab[_0x0ab0('0x41')][_0x4b62dc]));}else if(_0x4b62dc===_0x0ab0('0x7d')){var _0x21d6e5=JSON[_0x0ab0('0x7e')](_0x5384ab[_0x0ab0('0x41')][_0x4b62dc])[_0x0ab0('0x7f')];var _0x350323=JSON[_0x0ab0('0x7e')](_0x5384ab[_0x0ab0('0x41')][_0x4b62dc])[_0x0ab0('0x80')];_0x19ba0a[_0x0ab0('0x4c')](_0x0ab0('0x81'),_0x21d6e5,_0x350323);}else{if(_0x5384ab[_0x0ab0('0x41')][_0x4b62dc]===_0x0ab0('0x82')){_0x19ba0a[_0x0ab0('0x4c')]('i.'+_0x4b62dc+_0x0ab0('0x83'));}else{_0x19ba0a['where']('i.'+_0x4b62dc+'\x20=\x20?',_0x5384ab[_0x0ab0('0x41')][_0x4b62dc]);}}});}if(_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x84')]){if(_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x84')]==0x1){_0x19ba0a[_0x0ab0('0x65')](_0x0ab0('0x85'));}else{_0x19ba0a[_0x0ab0('0x65')](_0x0ab0('0x86'));}}if(_0x5384ab['query'][_0x0ab0('0x87')]){_0x3e507d=_[_0x0ab0('0x88')](_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x87')])?_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x87')]:new Array(_0x5384ab['query'][_0x0ab0('0x87')]);_0x3e507d[_0x0ab0('0x32')](function(_0x4632c3){_0xf68b1b['or'](_0x0ab0('0x72'),'%,'+_0x4632c3+',%');});}if(_0x5384ab[_0x0ab0('0x41')]['filter']){var _0x6a68fb=_0x5384ab['query'][_0x0ab0('0x89')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x6a68fb)){_0xb96cf8['or'](_0x0ab0('0x8a'),_0x6a68fb+'%')['or'](_0x0ab0('0x8b'),_0x6a68fb+'%');}else{_0xb96cf8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x6a68fb))['or'](_0x0ab0('0x8c'),_0x6a68fb+'%');}}}_0x19ba0a['where'](_0xb96cf8);_0x19ba0a[_0x0ab0('0x8d')](_0x0ab0('0x8e'));var _0x5b893e={'type':db[_0x0ab0('0x8f')][_0x0ab0('0x90')][_0x0ab0('0x91')],'raw':!![]};var _0x3e6a72=_0x19ba0a[_0x0ab0('0x92')]();_0x3e6a72[_0x0ab0('0x4f')]('i.id');_0x3e6a72[_0x0ab0('0x4f')](_0x0ab0('0x93'),_0x0ab0('0x64'));if(_0x10746f['order']){_0x10746f[_0x0ab0('0x4a')][_0x0ab0('0x32')](function(_0x174717){var _0x575489=_0x174717[0x0]==='contactName'?_0x174717[0x0]:'i.'+_0x174717[0x0];_0x19ba0a[_0x0ab0('0x4a')](_0x575489,_0x174717[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0ab0('0x7a')](_0x3e507d)){_0x19ba0a[_0x0ab0('0x65')](_0xf68b1b);_0x3e6a72[_0x0ab0('0x4c')](_0x0ab0('0x94'),_0x3e507d);}BPromise[_0x0ab0('0x95')]()[_0x0ab0('0x26')](function(){if(!_0x3377d1){if(_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x96')])return;_0x3e6a72[_0x0ab0('0x4c')](_0x0ab0('0x97'));_0x19ba0a[_0x0ab0('0x4c')](_0x0ab0('0x97'));return;}if(_0x5384ab[_0x0ab0('0x98')][_0x0ab0('0x99')]!==_0x0ab0('0x9a'))return;return _0x5384ab[_0x0ab0('0x98')][_0x0ab0('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x126d25){if(_[_0x0ab0('0x7a')](_0x126d25)){_0x3e6a72[_0x0ab0('0x4c')]('i.WhatsappAccountId\x20IS\x20NULL');_0x19ba0a[_0x0ab0('0x4c')](_0x0ab0('0x9c'));}else{_0x3e6a72[_0x0ab0('0x4c')](_0x0ab0('0x7b'),_[_0x0ab0('0x2e')](_0x126d25,'id'));_0x19ba0a['where'](_0x0ab0('0x7b'),_[_0x0ab0('0x2e')](_0x126d25,'id'));}});})['then'](function(){if(_0x5384ab[_0x0ab0('0x98')][_0x0ab0('0x99')]===_0x0ab0('0x9a')&&!_0x3377d1&&!_0x5384ab['query']['WhatsappAccountId'])return[];return db[_0x0ab0('0x9d')][_0x0ab0('0x41')](_0x3e6a72['toString'](),_0x5b893e);})[_0x0ab0('0x26')](function(_0xf4a795){_0x55d2fa[_0x0ab0('0x20')]=_0xf4a795[_0x0ab0('0x47')];if(_0x55d2fa[_0x0ab0('0x20')]===0x0)return[];return db[_0x0ab0('0x9d')][_0x0ab0('0x41')](_0x30d400[_0x0ab0('0x9e')](),_0x5b893e)['then'](function(_0x169831){_0x39519e=_[_0x0ab0('0x9f')](_0x169831,'id');_0x5b893e=_[_0x0ab0('0xa0')](_0x5b893e,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5384ab[_0x0ab0('0x41')][_0x0ab0('0x46')]){_0x10746f[_0x0ab0('0x44')][_0x0ab0('0x32')](function(_0x1ae4c7){_0x19ba0a['field']('i.'+_0x1ae4c7);});}else{_0x19ba0a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0ab0('0x64'));_0x19ba0a[_0x0ab0('0x4f')]('a.key',_0x0ab0('0xa1'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xa2'),_0x0ab0('0xa3'));_0x19ba0a['field'](_0x0ab0('0xa4'),_0x0ab0('0xa5'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xa6'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xa7'),_0x0ab0('0xa8'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xa9'),_0x0ab0('0xaa'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xab'),_0x0ab0('0xac'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xad'),_0x0ab0('0xae'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xaf'),'Contact.mobile');_0x19ba0a[_0x0ab0('0x4f')]('c.fax','Contact.fax');_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xb0'),'Owner.fullname');_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xb1'),_0x0ab0('0xb2'));_0x19ba0a[_0x0ab0('0x4f')](_0x0ab0('0xb3'),_0x0ab0('0x30'));}if(_0x10746f['limit'])_0x19ba0a[_0x0ab0('0x1f')](_0x10746f['limit']);if(_0x10746f['offset'])_0x19ba0a['offset'](_0x10746f[_0x0ab0('0x1d')]);return db[_0x0ab0('0x9d')][_0x0ab0('0x41')](_0x19ba0a[_0x0ab0('0x9e')](),_0x5b893e);})[_0x0ab0('0x26')](function(_0x2909f9){if(_0x2909f9[_0x0ab0('0x47')]>0x0)_0x151c93['where'](_0x0ab0('0xb4'),_[_0x0ab0('0x2e')](_0x2909f9,'id'));return db[_0x0ab0('0x9d')][_0x0ab0('0x41')](_0x151c93['toString'](),_0x5b893e)[_0x0ab0('0x26')](function(_0x450f61){var _0x59f4ab=_[_0x0ab0('0xb5')](_0x450f61,_0x0ab0('0xb6'));var _0x26699a=[];_0x2909f9['forEach'](function(_0x22b14e){_0x26699a['push'](updateWhatsappInteraction(_0x22b14e,_0x39519e,_0x59f4ab));});return BPromise[_0x0ab0('0xb7')](_0x26699a);});});})[_0x0ab0('0x26')](function(_0x1cd6a4){_0x55d2fa[_0x0ab0('0xb8')]=_0x1cd6a4;return _0x55d2fa;})['then'](respondWithFilteredResult(_0x10dc3e,_0x10746f))[_0x0ab0('0xb9')](handleError(_0x10dc3e,null));};exports[_0x0ab0('0xba')]=function(_0x217a83,_0x5bfe3f){var _0xd38e84={'raw':![],'where':{'id':_0x217a83[_0x0ab0('0xbb')]['id']}},_0x44a60b={};_0x44a60b[_0x0ab0('0x43')]=_[_0x0ab0('0x42')](db[_0x0ab0('0x3c')]['rawAttributes']);_0x44a60b[_0x0ab0('0x41')]=_['keys'](_0x217a83[_0x0ab0('0x41')]);_0x44a60b[_0x0ab0('0x4d')]=_[_0x0ab0('0x45')](_0x44a60b[_0x0ab0('0x43')],_0x44a60b[_0x0ab0('0x41')]);_0xd38e84[_0x0ab0('0x44')]=_[_0x0ab0('0x45')](_0x44a60b['model'],qs[_0x0ab0('0x46')](_0x217a83[_0x0ab0('0x41')][_0x0ab0('0x46')]));_0xd38e84[_0x0ab0('0x44')]=_0xd38e84['attributes'][_0x0ab0('0x47')]?_0xd38e84['attributes']:_0x44a60b['model'];if(_0x217a83[_0x0ab0('0x41')]['includeAll']){_0xd38e84[_0x0ab0('0xbc')]=[{'all':!![]}];}_0xd38e84=_[_0x0ab0('0xa0')]({},_0xd38e84,_0x217a83[_0x0ab0('0xbd')]);return db[_0x0ab0('0x3c')][_0x0ab0('0x6d')](_0xd38e84)[_0x0ab0('0x26')](handleEntityNotFound(_0x5bfe3f,null))[_0x0ab0('0x26')](respondWithResult(_0x5bfe3f,null))[_0x0ab0('0xb9')](handleError(_0x5bfe3f,null));};exports[_0x0ab0('0xbe')]=function(_0x4da8c0,_0x4824d4){return db[_0x0ab0('0x3c')]['create'](_0x4da8c0['body'],{})[_0x0ab0('0x26')](respondWithResult(_0x4824d4,0xc9))[_0x0ab0('0xb9')](handleError(_0x4824d4,null));};exports['update']=function(_0x24a5ff,_0x2b4930){if(_0x24a5ff[_0x0ab0('0x77')]['id']){delete _0x24a5ff[_0x0ab0('0x77')]['id'];}return db[_0x0ab0('0x3c')]['find']({'where':{'id':_0x24a5ff[_0x0ab0('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2b4930,null))[_0x0ab0('0x26')](saveUpdates(_0x24a5ff['body'],null))['then'](respondWithResult(_0x2b4930,null))[_0x0ab0('0xb9')](handleError(_0x2b4930,null));};exports['destroy']=function(_0x2e0861,_0x45b251){return db[_0x0ab0('0x3c')][_0x0ab0('0x6d')]({'where':{'id':_0x2e0861['params']['id']}})[_0x0ab0('0x26')](handleEntityNotFound(_0x45b251,null))[_0x0ab0('0x26')](removeEntity(_0x45b251,null))['catch'](handleError(_0x45b251,null));};exports[_0x0ab0('0xbf')]=function(_0x36720b,_0x3f6bff){return db[_0x0ab0('0x3c')]['describe']()[_0x0ab0('0x26')](respondWithResult(_0x3f6bff,null))['catch'](handleError(_0x3f6bff,null));};exports['addMessage']=function(_0x1c357a,_0x53afb6,_0x8ab65f){return db[_0x0ab0('0xc0')][_0x0ab0('0x6d')]({'where':{'id':_0x1c357a['params']['id']}})[_0x0ab0('0x26')](handleEntityNotFound(_0x53afb6,null))['then'](function(_0x569069){if(_0x569069){return _0x569069[_0x0ab0('0xc1')](_0x1c357a[_0x0ab0('0x77')][_0x0ab0('0xc2')],_[_0x0ab0('0xc3')](_0x1c357a['body'],[_0x0ab0('0xc2'),'id'])||{});}})[_0x0ab0('0x26')](respondWithResult(_0x53afb6,null))['catch'](handleError(_0x53afb6,null));};exports[_0x0ab0('0xc4')]=function(_0x13bae3,_0x3fa70,_0x32fa22){var _0x4c3271={'raw':![],'where':{}};var _0x554170={};var _0x270ea7={'count':0x0,'rows':[]};return db[_0x0ab0('0x3c')][_0x0ab0('0xc5')]({'where':{'id':_0x13bae3[_0x0ab0('0xbb')]['id']}})[_0x0ab0('0x26')](handleEntityNotFound(_0x3fa70,null))[_0x0ab0('0x26')](function(_0x1fb5b2){if(_0x1fb5b2){_0x554170[_0x0ab0('0x43')]=_['keys'](db[_0x0ab0('0xc0')][_0x0ab0('0x3d')]);_0x554170['query']=_[_0x0ab0('0x42')](_0x13bae3['query']);_0x554170['filters']=_[_0x0ab0('0x45')](_0x554170['model'],_0x554170[_0x0ab0('0x41')]);_0x4c3271[_0x0ab0('0x44')]=_[_0x0ab0('0x45')](_0x554170[_0x0ab0('0x43')],qs[_0x0ab0('0x46')](_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x46')]));_0x4c3271[_0x0ab0('0x44')]=_0x4c3271[_0x0ab0('0x44')][_0x0ab0('0x47')]?_0x4c3271[_0x0ab0('0x44')]:_0x554170[_0x0ab0('0x43')];if(!_0x13bae3['query'][_0x0ab0('0x48')](_0x0ab0('0x49'))){_0x4c3271['limit']=qs['limit'](_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x1f')]);_0x4c3271[_0x0ab0('0x1d')]=qs['offset'](_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x1d')]);}_0x4c3271['order']=qs[_0x0ab0('0x4b')](_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x4b')]);_0x4c3271[_0x0ab0('0x4c')]=qs['filters'](_[_0x0ab0('0xc6')](_0x13bae3[_0x0ab0('0x41')],_0x554170[_0x0ab0('0x4d')]));_0x4c3271[_0x0ab0('0x4c')][_0x0ab0('0xb6')]=_0x1fb5b2['id'];if(_0x13bae3['query'][_0x0ab0('0x89')]){_0x4c3271['where']=_[_0x0ab0('0xa0')](_0x4c3271[_0x0ab0('0x4c')],{'$or':_[_0x0ab0('0x2e')](_0x4c3271[_0x0ab0('0x44')],function(_0x27337f){var _0x4acbab={};_0x4acbab[_0x27337f]={'$like':'%'+_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x89')]+'%'};return _0x4acbab;})});}if(_0x13bae3['query']['$gte']){var _0x795e58=_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0x7f')][_0x0ab0('0x69')](',');var _0x4b7e2b={};_0x4b7e2b[_0x795e58[0x0]]={'$gte':moment(_0x795e58[0x1])[_0x0ab0('0xc7')](_0x0ab0('0xc8'))};_0x4c3271[_0x0ab0('0x4c')]=_[_0x0ab0('0xa0')](_0x4c3271[_0x0ab0('0x4c')],_0x4b7e2b);}_0x4c3271=_[_0x0ab0('0xa0')]({},_0x4c3271,_0x13bae3[_0x0ab0('0xbd')]);return db[_0x0ab0('0xc0')]['count']({'where':_0x4c3271[_0x0ab0('0x4c')]})[_0x0ab0('0x26')](function(_0x34539d){_0x270ea7[_0x0ab0('0x20')]=_0x34539d;if(_0x13bae3[_0x0ab0('0x41')][_0x0ab0('0xc9')]){_0x4c3271[_0x0ab0('0xbc')]=[{'all':!![]}];}return db[_0x0ab0('0xc0')][_0x0ab0('0xca')](_0x4c3271);})[_0x0ab0('0x26')](function(_0x362392){_0x270ea7['rows']=_0x362392;return _0x270ea7;});}})[_0x0ab0('0x26')](respondWithFilteredResult(_0x3fa70,_0x4c3271))[_0x0ab0('0xb9')](handleError(_0x3fa70,null));};exports[_0x0ab0('0xcb')]=function(_0x1339ad,_0x321711,_0x4f5969){return db[_0x0ab0('0x3c')]['find']({'where':{'id':_0x1339ad[_0x0ab0('0xbb')]['id']}})['then'](handleEntityNotFound(_0x321711,null))[_0x0ab0('0x26')](function(_0x5ed1b6){if(_0x5ed1b6){return _0x5ed1b6[_0x0ab0('0xcc')](_0x1339ad[_0x0ab0('0x77')]['ids'],_[_0x0ab0('0xc3')](_0x1339ad['body'],['ids','id'])||{})['spread'](function(){return db[_0x0ab0('0xcd')][_0x0ab0('0xca')]({'attributes':['id',_0x0ab0('0x2b'),'color'],'where':{'id':_0x1339ad[_0x0ab0('0x77')][_0x0ab0('0xc2')]}});})[_0x0ab0('0x26')](function(_0x505d94){socket[_0x0ab0('0xce')](_0x0ab0('0xcf'),{'id':Number(_0x1339ad[_0x0ab0('0xbb')]['id']),'tags':_0x505d94||[]});return{'id':Number(_0x1339ad[_0x0ab0('0xbb')]['id']),'tags':_0x505d94||[]};});}})[_0x0ab0('0x26')](respondWithResult(_0x321711,null))[_0x0ab0('0xb9')](handleError(_0x321711,null));};exports[_0x0ab0('0xd0')]=function(_0x1497d2,_0x2a0f31,_0x4ee674){return db[_0x0ab0('0x3c')][_0x0ab0('0x6d')]({'where':{'id':_0x1497d2[_0x0ab0('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2a0f31,null))['then'](function(_0x5670f0){if(_0x5670f0){return _0x5670f0[_0x0ab0('0xd0')](_0x1497d2[_0x0ab0('0x41')][_0x0ab0('0xc2')]);}})[_0x0ab0('0x26')](respondWithStatusCode(_0x2a0f31,null))[_0x0ab0('0xb9')](handleError(_0x2a0f31,null));};exports['download']=function(_0x537758,_0x315196){var _0x121630=moment()[_0x0ab0('0xd1')]()[_0x0ab0('0x9e')]();var _0x47a05d=path[_0x0ab0('0xd2')](config['root'],'server',_0x0ab0('0xd3'),'tmp');var _0x25ace2=path[_0x0ab0('0xd2')](config[_0x0ab0('0xd4')],_0x0ab0('0xd5'),'files',_0x0ab0('0xd6'));var _0x226cd1=path['join'](_0x47a05d,_0x121630);var _0x42bafb=util[_0x0ab0('0xc7')](_0x0ab0('0xd7'),_0x537758[_0x0ab0('0xbb')]['id'],_0x121630);var _0x5c7936=path[_0x0ab0('0xd2')](_0x47a05d,_0x42bafb);var _0x26983e=[];_0x26983e[_0x0ab0('0x33')]({'model':db[_0x0ab0('0x74')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x26983e[_0x0ab0('0x33')]({'model':db['CmContact'],'as':_0x0ab0('0x67'),'attributes':['id','firstName',_0x0ab0('0xd8')],'raw':!![]});if(_0x537758[_0x0ab0('0x41')][_0x0ab0('0xd6')]){_0x26983e[_0x0ab0('0x33')]({'model':db[_0x0ab0('0xd9')],'as':'Attachment','raw':!![]});}var _0x1d6cd4=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0x0ab0('0x7d'),_0x0ab0('0xda'),_0x0ab0('0xdb'),'read'],'include':_0x26983e}];_0x1d6cd4['push']({'model':db[_0x0ab0('0xdc')],'as':_0x0ab0('0xdd'),'attributes':['id','name']});_0x1d6cd4[_0x0ab0('0x33')]({'model':db[_0x0ab0('0x74')],'as':_0x0ab0('0xde'),'attributes':['id',_0x0ab0('0x2f')]});return db[_0x0ab0('0x3c')][_0x0ab0('0x6d')]({'where':{'id':_0x537758['params']['id']},'include':_0x1d6cd4})['then'](handleEntityNotFound(_0x315196,null))['then'](function(_0x3cbab6){if(_0x3cbab6){var _0x1115e1=_0x3cbab6['get']({'plain':!![]});fs[_0x0ab0('0xdf')](_0x226cd1);var _0x3aa92d={'channel':_0x0ab0('0xe0'),'account':_0x1115e1[_0x0ab0('0xdd')][_0x0ab0('0x2b')],'agent':_0x1115e1['Owner']?_0x1115e1[_0x0ab0('0xde')]['fullname']:_0x0ab0('0xe1'),'createdAt':moment(_0x1115e1['createdAt'])[_0x0ab0('0xc7')](_0x0ab0('0xc8'))[_0x0ab0('0x9e')](),'closedAt':_0x1115e1[_0x0ab0('0x39')]?moment(_0x1115e1['closedAt'])[_0x0ab0('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0ab0('0x9e')]():'','disposition':_0x1115e1[_0x0ab0('0xe2')],'messages':_(_0x1115e1[_0x0ab0('0xe3')])[_0x0ab0('0x89')]({'secret':![]})['map'](function(_0x499a6f){if(_0x499a6f['Attachment']){var _0x4945ee=path[_0x0ab0('0xd2')](_0x25ace2,_0x499a6f[_0x0ab0('0xd9')][_0x0ab0('0xe4')]);if(fs['existsSync'](_0x4945ee)){fs[_0x0ab0('0xe5')](_0x4945ee)[_0x0ab0('0xe6')](fs[_0x0ab0('0xe7')](path[_0x0ab0('0xd2')](_0x226cd1,_0x499a6f[_0x0ab0('0xd9')]['basename'])));}}return{'date':moment(_0x499a6f[_0x0ab0('0x7d')])[_0x0ab0('0xc7')](_0x0ab0('0xc8'))[_0x0ab0('0x9e')](),'sender':_0x499a6f['direction']===_0x0ab0('0xe8')?_0x499a6f['User']?_0x499a6f['User'][_0x0ab0('0x2f')]:_0x0ab0('0xe9'):_0x499a6f['Contact'][_0x0ab0('0xea')]+(_0x499a6f[_0x0ab0('0x67')][_0x0ab0('0xd8')]?'\x20'+_0x499a6f['Contact'][_0x0ab0('0xd8')]:''),'body':_0x499a6f[_0x0ab0('0xd9')]?_0x499a6f['Attachment']['basename']:_0x499a6f[_0x0ab0('0x77')],'direction':_0x499a6f[_0x0ab0('0xda')]===_0x0ab0('0xe8')?'A':'C','secret':_0x499a6f[_0x0ab0('0xdb')],'read':_0x499a6f['read'],'attachment':_0x499a6f['Attachment']};})['value']()};return ejs[_0x0ab0('0xeb')](path['join'](config[_0x0ab0('0xd4')],_0x0ab0('0xd5'),'views',_0x0ab0('0xec')),{'interaction':_0x3aa92d})[_0x0ab0('0x26')](function(_0x3d0c34){var _0x2f6679=path[_0x0ab0('0xd2')](_0x226cd1,_0x0ab0('0xed')+_0x1115e1['id']+'-'+_0x121630+'.pdf');var _0x577fc9={'path':_0x2f6679,'channel':_0x0ab0('0xe0'),'interactionId':_0x1115e1['id']};return pdf[_0x0ab0('0xee')](_0x3d0c34,_0x577fc9);})[_0x0ab0('0x26')](function(){return new BPromise(function(_0x4168cd,_0x1f3e79){zipdir(_0x226cd1,{'saveTo':_0x5c7936},function(_0x2b9437,_0x38b771){if(_0x2b9437)return _0x1f3e79(_0x2b9437);return _0x4168cd(_0x38b771);});})['then'](function(){return new BPromise(function(_0x2b14af,_0x4c8b6a){rimraf(_0x226cd1,function(_0x4b1af8){if(_0x4b1af8)_0x4c8b6a(_0x4b1af8);return _0x2b14af();});});})[_0x0ab0('0x26')](function(){return _0x315196[_0x0ab0('0xef')](_0x5c7936,_0x42bafb,function(_0x2e96b3){if(_0x2e96b3){console[_0x0ab0('0xf0')](_0x0ab0('0xf1'),_0x2e96b3);}else{fs[_0x0ab0('0xf2')](_0x5c7936);}});});});}else{return _0x315196[_0x0ab0('0x29')](0xc8);}})[_0x0ab0('0xb9')](handleError(_0x315196,null));}; \ No newline at end of file +var _0x3e22=['model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','length','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','type','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','WhatsappInteractionId','params','includeAll','include','options','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','join','files','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','disposition','existsSync','createReadStream','createWriteStream','basename','out','System','renderFile','views','transcript-','log','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','UserId','closed','unmanaged','index','WhatsappInteraction','rawAttributes','key'];(function(_0x8052d3,_0x3cc3bc){var _0xf01dc8=function(_0x6419bf){while(--_0x6419bf){_0x8052d3['push'](_0x8052d3['shift']());}};_0xf01dc8(++_0x3cc3bc);}(_0x3e22,0xa8));var _0x23e2=function(_0x3414ab,_0x5beee8){_0x3414ab=_0x3414ab-0x0;var _0x3fa9fb=_0x3e22[_0x3414ab];return _0x3fa9fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23e2('0x1'));var rp=require(_0x23e2('0x2'));var moment=require(_0x23e2('0x3'));var BPromise=require(_0x23e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23e2('0x5'));var sox=require(_0x23e2('0x6'));var csv=require('to-csv');var ejs=require(_0x23e2('0x7'));var fs=require('fs');var fs_extra=require(_0x23e2('0x8'));var _=require(_0x23e2('0x9'));var squel=require(_0x23e2('0xa'));var crypto=require(_0x23e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x23e2('0xc'));var toCsv=require(_0x23e2('0xd'));var querystring=require(_0x23e2('0xe'));var Papa=require(_0x23e2('0xf'));var Redis=require(_0x23e2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23e2('0x11'));var as=require(_0x23e2('0x12'));var pdf=require(_0x23e2('0x13'));var hardwareService=require(_0x23e2('0x14'));var logger=require(_0x23e2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x23e2('0x16'));var licenseUtil=require(_0x23e2('0x17'));var db=require(_0x23e2('0x18'))['db'];config[_0x23e2('0x19')]=_[_0x23e2('0x1a')](config[_0x23e2('0x19')],{'host':_0x23e2('0x1b'),'port':0x18eb});var socket=require(_0x23e2('0x1c'))(new Redis(config[_0x23e2('0x19')]));require(_0x23e2('0x1d'))[_0x23e2('0x1e')](socket);function respondWithStatusCode(_0x32f030,_0x13ca26){_0x13ca26=_0x13ca26||0xcc;return function(_0xde63db){if(_0xde63db){return _0x32f030['sendStatus'](_0x13ca26);}return _0x32f030[_0x23e2('0x1f')](_0x13ca26)[_0x23e2('0x20')]();};}function respondWithResult(_0x258d5a,_0x92f299){_0x92f299=_0x92f299||0xc8;return function(_0x276c2d){if(_0x276c2d){return _0x258d5a[_0x23e2('0x1f')](_0x92f299)[_0x23e2('0x21')](_0x276c2d);}};}function respondWithFilteredResult(_0xd15c0d,_0x3903c5){return function(_0x8f8756){if(_0x8f8756){var _0x251e52=typeof _0x3903c5[_0x23e2('0x22')]==='undefined'&&typeof _0x3903c5[_0x23e2('0x23')]===_0x23e2('0x24');var _0x51180c=_0x8f8756[_0x23e2('0x25')];var _0x5eeaab=_0x251e52?0x0:_0x3903c5[_0x23e2('0x22')];var _0x46272c=_0x251e52?_0x8f8756[_0x23e2('0x25')]:_0x3903c5[_0x23e2('0x22')]+_0x3903c5[_0x23e2('0x23')];var _0x3dcfd7;if(_0x46272c>=_0x51180c){_0x46272c=_0x51180c;_0x3dcfd7=0xc8;}else{_0x3dcfd7=0xce;}_0xd15c0d['status'](_0x3dcfd7);return _0xd15c0d[_0x23e2('0x26')](_0x23e2('0x27'),_0x5eeaab+'-'+_0x46272c+'/'+_0x51180c)[_0x23e2('0x21')](_0x8f8756);}return null;};}function patchUpdates(_0x5a099c){return function(_0x5a7539){try{jsonpatch[_0x23e2('0x28')](_0x5a7539,_0x5a099c,!![]);}catch(_0x1e8f76){return BPromise[_0x23e2('0x29')](_0x1e8f76);}return _0x5a7539['save']();};}function saveUpdates(_0x2495b9,_0x4169de){return function(_0x529f84){if(_0x529f84){return _0x529f84['update'](_0x2495b9)[_0x23e2('0x2a')](function(_0x1bb30f){return _0x1bb30f;});}return null;};}function removeEntity(_0x4813c6,_0x2a974a){return function(_0x5f29a7){if(_0x5f29a7){return _0x5f29a7[_0x23e2('0x2b')]()[_0x23e2('0x2a')](function(){_0x4813c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3d9f,_0x977c0){return function(_0x96a7e4){if(!_0x96a7e4){_0x3b3d9f[_0x23e2('0x2c')](0x194);}return _0x96a7e4;};}function handleError(_0x1d36c9,_0x564b0a){_0x564b0a=_0x564b0a||0x1f4;return function(_0x2734c5){logger[_0x23e2('0x2d')](_0x2734c5[_0x23e2('0x2e')]);if(_0x2734c5[_0x23e2('0x2f')]){delete _0x2734c5['name'];}_0x1d36c9[_0x23e2('0x1f')](_0x564b0a)[_0x23e2('0x30')](_0x2734c5);};}function getInteractionUsers(_0x46523d,_0x3004b3){return new BPromise(function(_0x1a5117,_0x26c968){try{if(_0x3004b3[_0x46523d['id']]){_0x46523d['Users']=_[_0x23e2('0x31')](_0x3004b3[_0x46523d['id']],function(_0x397458){return{'id':_0x397458['id'],'fullname':_0x397458['fullname']};});}}catch(_0x488245){_0x26c968(_0x488245);}_0x1a5117(_0x46523d);});}function getInteractionTags(_0x41455b,_0x2e88d4){return new BPromise(function(_0x96378a,_0x244959){try{if(_0x41455b[_0x23e2('0x32')]){_0x41455b[_0x23e2('0x33')]=[];_0x41455b[_0x23e2('0x32')][_0x23e2('0x34')](',')[_0x23e2('0x35')](function(_0x3f31c2){_0x41455b[_0x23e2('0x33')][_0x23e2('0x36')](_0x2e88d4[_0x3f31c2]);});}delete _0x41455b['TagIds'];}catch(_0x32fca7){_0x244959(_0x32fca7);}_0x96378a(_0x41455b);});}function updateWhatsappInteraction(_0x2ef960,_0x520d1f,_0xeffd2a){return new BPromise(function(_0x38f3cc,_0x1920db){return getInteractionUsers(_0x2ef960,_0xeffd2a)[_0x23e2('0x2a')](function(_0x74e394){return getInteractionTags(_0x74e394,_0x520d1f);})[_0x23e2('0x2a')](function(_0x1bc4c5){return getStateInteraction(_0x1bc4c5);})[_0x23e2('0x2a')](function(_0x1c0ec2){_0x38f3cc(_0x1c0ec2);})[_0x23e2('0x37')](function(_0x4063cd){_0x1920db(_0x4063cd);});});}function getStateInteraction(_0xd651c2){return new BPromise(function(_0x3393f9){_0xd651c2[_0x23e2('0x38')]=0x0;_0xd651c2[_0x23e2('0x39')]=0x0;_0xd651c2[_0x23e2('0x3a')]=0x0;_0xd651c2['unmanaged']=0x0;_0xd651c2[_0x23e2('0x3b')]=0x0;if(!_0xd651c2['closed']&&!_0xd651c2[_0x23e2('0x3c')]){_0xd651c2['waiting']+=0x1;}if(!_0xd651c2[_0x23e2('0x3d')]&&_0xd651c2[_0x23e2('0x3c')]){_0xd651c2['talking']+=0x1;if(_0xd651c2[_0x23e2('0x38')]){_0xd651c2[_0x23e2('0x38')]-=0x1;}}if(_0xd651c2[_0x23e2('0x3d')]&&_0xd651c2[_0x23e2('0x3c')]){_0xd651c2['answered']+=0x1;if(_0xd651c2[_0x23e2('0x39')]){_0xd651c2[_0x23e2('0x39')]-=0x1;}}if(_0xd651c2[_0x23e2('0x3d')]&&!_0xd651c2['UserId']){_0xd651c2[_0x23e2('0x3e')]+=0x1;if(_0xd651c2[_0x23e2('0x38')]){_0xd651c2['waiting']-=0x1;}}_0xd651c2['total']+=0x1;_0x3393f9(_0xd651c2);});}exports[_0x23e2('0x3f')]=function(_0x5033c1,_0x42196f){var _0x2c300e={},_0x43cccb={},_0x23b45d={'count':0x0,'rows':[]};var _0x3dc038=_['map'](db[_0x23e2('0x40')][_0x23e2('0x41')],function(_0x10fb48){return{'name':_0x10fb48['fieldName'],'type':_0x10fb48['type'][_0x23e2('0x42')]};});_0x43cccb[_0x23e2('0x43')]=_[_0x23e2('0x31')](_0x3dc038,_0x23e2('0x2f'));_0x43cccb[_0x23e2('0x44')]=_['keys'](_0x5033c1[_0x23e2('0x44')]);_0x43cccb[_0x23e2('0x45')]=_[_0x23e2('0x46')](_0x43cccb[_0x23e2('0x43')],_0x43cccb[_0x23e2('0x44')]);_0x2c300e[_0x23e2('0x47')]=_[_0x23e2('0x46')](_0x43cccb[_0x23e2('0x43')],qs[_0x23e2('0x48')](_0x5033c1[_0x23e2('0x44')]['fields']));_0x2c300e[_0x23e2('0x47')]=_0x2c300e['attributes']['length']?_0x2c300e[_0x23e2('0x47')]:_0x43cccb['model'];if(!_0x5033c1[_0x23e2('0x44')][_0x23e2('0x49')]('nolimit')){_0x2c300e['limit']=qs[_0x23e2('0x23')](_0x5033c1[_0x23e2('0x44')][_0x23e2('0x23')]);_0x2c300e['offset']=qs[_0x23e2('0x22')](_0x5033c1['query'][_0x23e2('0x22')]);}_0x2c300e[_0x23e2('0x4a')]=qs[_0x23e2('0x4b')](_0x5033c1[_0x23e2('0x44')][_0x23e2('0x4b')]);_0x2c300e[_0x23e2('0x4c')]=qs[_0x23e2('0x45')](_[_0x23e2('0x4d')](_0x5033c1['query'],_0x43cccb[_0x23e2('0x45')]),_0x3dc038);var _0x173bd6=[];var _0x409f49=squel[_0x23e2('0x4e')]()[_0x23e2('0x4f')]('id')[_0x23e2('0x4f')]('name')[_0x23e2('0x4f')](_0x23e2('0x50'))[_0x23e2('0x51')]('tools_tags');var _0x4439b0=squel[_0x23e2('0x4e')]()[_0x23e2('0x4f')](_0x23e2('0x52'))[_0x23e2('0x4f')](_0x23e2('0x53'))[_0x23e2('0x4f')](_0x23e2('0x54'))[_0x23e2('0x51')](_0x23e2('0x55'),'ui')[_0x23e2('0x56')](_0x23e2('0x57'),'u',_0x23e2('0x58'));var _0x3a2a0f=squel[_0x23e2('0x4e')]()[_0x23e2('0x51')](_0x23e2('0x59'),'i')['left_join'](_0x23e2('0x5a'),'c',_0x23e2('0x5b'))[_0x23e2('0x56')](_0x23e2('0x57'),'o',_0x23e2('0x5c'))[_0x23e2('0x56')](_0x23e2('0x5d'),'a',_0x23e2('0x5e'))[_0x23e2('0x56')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x23e2('0x56')]('whatsapp_interaction_has_tags','it',_0x23e2('0x5f'))[_0x23e2('0x56')](_0x23e2('0x60'),'t','t.id\x20=\x20it.TagId');var _0x452a0b=squel[_0x23e2('0x61')]();var _0x2212d5=[];var _0x1d3e84=squel[_0x23e2('0x61')]();var _0x1877f6;if(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x62')]){_0x1877f6=as[_0x23e2('0x63')](_0x5033c1['query']['search']);var _0x240f4c=_0x1877f6[_0x23e2('0x64')];for(var _0x288df7=0x0;_0x288df7<_0x1877f6['conditions'][_0x23e2('0x65')];_0x288df7++){var _0x53509d=_0x1877f6['conditions'][_0x288df7];var _0x322885='i';var _0xd2a6c7=_[_0x23e2('0x66')](_0x3dc038,[_0x23e2('0x2f'),_0x53509d[_0x23e2('0x4f')]]);if(!_0xd2a6c7){switch(_0x53509d[_0x23e2('0x4f')]){case _0x23e2('0x67'):if(_0x53509d[_0x23e2('0x68')]==0x1){_0x3a2a0f['having']('`'+_0x53509d[_0x23e2('0x4f')]+_0x23e2('0x69'));}else{_0x3a2a0f['having']('`'+_0x53509d[_0x23e2('0x4f')]+_0x23e2('0x6a'));}break;case _0x23e2('0x6b'):if(_0x53509d[_0x23e2('0x6c')]===_0x23e2('0x6d')){if(_0x53509d[_0x23e2('0x68')][_0x23e2('0x34')]('\x20')[_0x23e2('0x65')]>0x1){_0x452a0b[_0x240f4c](_0x23e2('0x6e'),qs[_0x23e2('0x6f')](_0x53509d['value']),null);}else{var _0xf98b29='%'+_0x53509d[_0x23e2('0x68')]+'%';_0x452a0b[_0x240f4c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xf98b29,_0xf98b29,_0xf98b29);}}else{_0xd2a6c7=_[_0x23e2('0x66')](_0x3dc038,[_0x23e2('0x2f'),_0x23e2('0x70')]);_0x53509d[_0x23e2('0x4f')]=_0x23e2('0x70');_0x117b7c=as[_0x23e2('0x71')](_0x322885,_0xd2a6c7['type'],_0x53509d);_0x452a0b[_0x240f4c](_0x117b7c[_0x23e2('0x72')],_0x117b7c[_0x23e2('0x68')][_0x23e2('0x73')],_0x117b7c[_0x23e2('0x68')][_0x23e2('0x20')]);}break;case _0x23e2('0x74'):var _0x54c319=_0x53509d[_0x23e2('0x68')]['split'](',')['map'](function(_0x47a3af){return Number(_0x47a3af);});_0x54c319[_0x23e2('0x35')](function(_0x144187){_0x1d3e84['or'](_0x23e2('0x75'),'%,'+_0x144187+',%');});_0x2212d5=_['union'](_0x2212d5,_0x54c319);break;case'User':if(_0x53509d[_0x23e2('0x6c')]==='$substring'){_0x452a0b[_0x240f4c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x53509d[_0x23e2('0x68')]+'%',null);}else{_0xd2a6c7=_['find'](_0x3dc038,[_0x23e2('0x2f'),_0x23e2('0x3c')]);_0x53509d['field']='UserId';_0x117b7c=as['buildExpression'](_0x322885,_0xd2a6c7[_0x23e2('0x76')],_0x53509d);_0x452a0b[_0x240f4c](_0x117b7c['text'],_0x117b7c[_0x23e2('0x68')][_0x23e2('0x73')],_0x117b7c[_0x23e2('0x68')]['end']);}break;case'body':_0x117b7c=as[_0x23e2('0x71')]('me',null,_0x53509d);_0x452a0b[_0x240f4c](_0x117b7c[_0x23e2('0x72')],_0x117b7c['value'][_0x23e2('0x73')],_0x117b7c[_0x23e2('0x68')][_0x23e2('0x20')]);break;}}else{var _0x117b7c=as[_0x23e2('0x71')](_0x322885,_0xd2a6c7[_0x23e2('0x76')],_0x53509d);_0x452a0b[_0x240f4c](_0x117b7c['text'],_0x117b7c['value'][_0x23e2('0x73')],_0x117b7c['value'][_0x23e2('0x20')]);}}}else{var _0x19942e=_(_0x5033c1['query'])[_0x23e2('0x77')]()['map'](function(_0xf6af3d){return _['some'](_0x3dc038,[_0x23e2('0x2f'),_0xf6af3d])?_0xf6af3d:undefined;})[_0x23e2('0x78')]()[_0x23e2('0x68')]();if(!_[_0x23e2('0x79')](_0x19942e)){_0x19942e[_0x23e2('0x35')](function(_0x31934d){if(_0x31934d===_0x23e2('0x7a')){_0x3a2a0f[_0x23e2('0x4c')](_0x23e2('0x7b'),[]['concat'](_0x5033c1[_0x23e2('0x44')][_0x31934d]));}else if(_0x31934d===_0x23e2('0x7c')){var _0x34c201=JSON['parse'](_0x5033c1[_0x23e2('0x44')][_0x31934d])[_0x23e2('0x7d')];var _0x2288a3=JSON[_0x23e2('0x7e')](_0x5033c1[_0x23e2('0x44')][_0x31934d])[_0x23e2('0x7f')];_0x3a2a0f[_0x23e2('0x4c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x34c201,_0x2288a3);}else{if(_0x5033c1[_0x23e2('0x44')][_0x31934d]===_0x23e2('0x80')){_0x3a2a0f['where']('i.'+_0x31934d+_0x23e2('0x81'));}else{_0x3a2a0f[_0x23e2('0x4c')]('i.'+_0x31934d+_0x23e2('0x82'),_0x5033c1[_0x23e2('0x44')][_0x31934d]);}}});}if(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x83')]){if(_0x5033c1[_0x23e2('0x44')]['read']==0x1){_0x3a2a0f[_0x23e2('0x84')](_0x23e2('0x85'));}else{_0x3a2a0f[_0x23e2('0x84')](_0x23e2('0x86'));}}if(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x87')]){_0x2212d5=_[_0x23e2('0x88')](_0x5033c1[_0x23e2('0x44')][_0x23e2('0x87')])?_0x5033c1[_0x23e2('0x44')][_0x23e2('0x87')]:new Array(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x87')]);_0x2212d5[_0x23e2('0x35')](function(_0x32f610){_0x1d3e84['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x32f610+',%');});}if(_0x5033c1['query'][_0x23e2('0x89')]){var _0x59d548=_0x5033c1[_0x23e2('0x44')][_0x23e2('0x89')][_0x23e2('0x8a')]('\x5c','\x5c\x5c')[_0x23e2('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x59d548)){_0x452a0b['or'](_0x23e2('0x8b'),_0x59d548+'%')['or'](_0x23e2('0x8c'),_0x59d548+'%');}else{_0x452a0b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x23e2('0x6f')](_0x59d548))['or'](_0x23e2('0x8d'),_0x59d548+'%');}}}_0x3a2a0f[_0x23e2('0x4c')](_0x452a0b);_0x3a2a0f[_0x23e2('0x8e')]('i.id');var _0x5587c7={'type':db[_0x23e2('0x8f')][_0x23e2('0x90')][_0x23e2('0x91')],'raw':!![]};var _0x32119f=_0x3a2a0f[_0x23e2('0x92')]();_0x32119f[_0x23e2('0x4f')](_0x23e2('0x93'));_0x32119f[_0x23e2('0x4f')](_0x23e2('0x94'),_0x23e2('0x67'));if(_0x2c300e[_0x23e2('0x4a')]){_0x2c300e[_0x23e2('0x4a')][_0x23e2('0x35')](function(_0x169999){var _0x26f210=_0x169999[0x0]==='contactName'?_0x169999[0x0]:'i.'+_0x169999[0x0];_0x3a2a0f['order'](_0x26f210,_0x169999[0x1]===_0x23e2('0x95')?![]:!![]);});}if(!_[_0x23e2('0x79')](_0x2212d5)){_0x3a2a0f[_0x23e2('0x84')](_0x1d3e84);_0x32119f['where']('t.id\x20IN\x20?',_0x2212d5);}BPromise[_0x23e2('0x96')]()[_0x23e2('0x2a')](function(){if(!_0x1877f6){if(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x7a')])return;_0x32119f['where'](_0x23e2('0x97'));_0x3a2a0f[_0x23e2('0x4c')](_0x23e2('0x97'));return;}if(_0x5033c1[_0x23e2('0x98')][_0x23e2('0x99')]!==_0x23e2('0x9a'))return;return _0x5033c1[_0x23e2('0x98')][_0x23e2('0x9b')]({'attributes':['id'],'raw':!![]})[_0x23e2('0x2a')](function(_0x420a17){if(_['isEmpty'](_0x420a17)){_0x32119f['where'](_0x23e2('0x9c'));_0x3a2a0f[_0x23e2('0x4c')](_0x23e2('0x9c'));}else{_0x32119f[_0x23e2('0x4c')](_0x23e2('0x7b'),_[_0x23e2('0x31')](_0x420a17,'id'));_0x3a2a0f[_0x23e2('0x4c')](_0x23e2('0x7b'),_[_0x23e2('0x31')](_0x420a17,'id'));}});})[_0x23e2('0x2a')](function(){if(_0x5033c1['user'][_0x23e2('0x99')]===_0x23e2('0x9a')&&!_0x1877f6&&!_0x5033c1[_0x23e2('0x44')][_0x23e2('0x7a')])return[];return db[_0x23e2('0x9d')]['query'](_0x32119f[_0x23e2('0x9e')](),_0x5587c7);})['then'](function(_0x5dbcf4){_0x23b45d[_0x23e2('0x25')]=_0x5dbcf4[_0x23e2('0x65')];if(_0x23b45d['count']===0x0)return[];return db['sequelize']['query'](_0x409f49[_0x23e2('0x9e')](),_0x5587c7)[_0x23e2('0x2a')](function(_0x3c6253){_0x173bd6=_['keyBy'](_0x3c6253,'id');_0x5587c7=_[_0x23e2('0x9f')](_0x5587c7,{'model':db[_0x23e2('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5033c1[_0x23e2('0x44')][_0x23e2('0x48')]){_0x2c300e[_0x23e2('0x47')][_0x23e2('0x35')](function(_0x4bde44){_0x3a2a0f['field']('i.'+_0x4bde44);});}else{_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0x94'),'unreadMessages');_0x3a2a0f[_0x23e2('0x4f')]('a.key',_0x23e2('0xa0'));_0x3a2a0f['field'](_0x23e2('0xa1'),_0x23e2('0xa2'));_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0xa3'),'contactName');_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0xa4'));_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0xa5'),'Contact.firstName');_0x3a2a0f['field']('c.lastName',_0x23e2('0xa6'));_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0xa7'),_0x23e2('0xa8'));_0x3a2a0f[_0x23e2('0x4f')]('c.phone',_0x23e2('0xa9'));_0x3a2a0f[_0x23e2('0x4f')]('c.mobile',_0x23e2('0xaa'));_0x3a2a0f[_0x23e2('0x4f')](_0x23e2('0xab'),_0x23e2('0xac'));_0x3a2a0f['field'](_0x23e2('0xad'),_0x23e2('0xae'));_0x3a2a0f[_0x23e2('0x4f')]('o.internal',_0x23e2('0xaf'));_0x3a2a0f[_0x23e2('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x23e2('0x32'));}if(_0x2c300e['limit'])_0x3a2a0f[_0x23e2('0x23')](_0x2c300e[_0x23e2('0x23')]);if(_0x2c300e[_0x23e2('0x22')])_0x3a2a0f['offset'](_0x2c300e[_0x23e2('0x22')]);return db[_0x23e2('0x9d')][_0x23e2('0x44')](_0x3a2a0f[_0x23e2('0x9e')](),_0x5587c7);})[_0x23e2('0x2a')](function(_0x10f45d){if(_0x10f45d['length']>0x0)_0x4439b0[_0x23e2('0x4c')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x23e2('0x31')](_0x10f45d,'id'));return db[_0x23e2('0x9d')][_0x23e2('0x44')](_0x4439b0[_0x23e2('0x9e')](),_0x5587c7)[_0x23e2('0x2a')](function(_0x450540){var _0xcfad8b=_['groupBy'](_0x450540,_0x23e2('0xb0'));var _0x53c2ea=[];_0x10f45d['forEach'](function(_0x4a4ec2){_0x53c2ea[_0x23e2('0x36')](updateWhatsappInteraction(_0x4a4ec2,_0x173bd6,_0xcfad8b));});return BPromise['all'](_0x53c2ea);});});})['then'](function(_0x12c999){_0x23b45d['rows']=_0x12c999;return _0x23b45d;})[_0x23e2('0x2a')](respondWithFilteredResult(_0x42196f,_0x2c300e))[_0x23e2('0x37')](handleError(_0x42196f,null));};exports['show']=function(_0x26b9c5,_0x27205d){var _0x4279c5={'raw':![],'where':{'id':_0x26b9c5[_0x23e2('0xb1')]['id']}},_0x5342ef={};_0x5342ef[_0x23e2('0x43')]=_['keys'](db[_0x23e2('0x40')]['rawAttributes']);_0x5342ef['query']=_['keys'](_0x26b9c5[_0x23e2('0x44')]);_0x5342ef['filters']=_['intersection'](_0x5342ef[_0x23e2('0x43')],_0x5342ef['query']);_0x4279c5[_0x23e2('0x47')]=_['intersection'](_0x5342ef[_0x23e2('0x43')],qs['fields'](_0x26b9c5['query'][_0x23e2('0x48')]));_0x4279c5[_0x23e2('0x47')]=_0x4279c5[_0x23e2('0x47')]['length']?_0x4279c5[_0x23e2('0x47')]:_0x5342ef[_0x23e2('0x43')];if(_0x26b9c5['query'][_0x23e2('0xb2')]){_0x4279c5[_0x23e2('0xb3')]=[{'all':!![]}];}_0x4279c5=_[_0x23e2('0x9f')]({},_0x4279c5,_0x26b9c5[_0x23e2('0xb4')]);return db[_0x23e2('0x40')]['find'](_0x4279c5)[_0x23e2('0x2a')](handleEntityNotFound(_0x27205d,null))[_0x23e2('0x2a')](respondWithResult(_0x27205d,null))['catch'](handleError(_0x27205d,null));};exports['create']=function(_0x2edc1a,_0x325af5){return db[_0x23e2('0x40')][_0x23e2('0xb5')](_0x2edc1a[_0x23e2('0xb6')],{})[_0x23e2('0x2a')](respondWithResult(_0x325af5,0xc9))['catch'](handleError(_0x325af5,null));};exports[_0x23e2('0xb7')]=function(_0xcb8e35,_0x1d6e62){if(_0xcb8e35[_0x23e2('0xb6')]['id']){delete _0xcb8e35['body']['id'];}return db['WhatsappInteraction'][_0x23e2('0x66')]({'where':{'id':_0xcb8e35[_0x23e2('0xb1')]['id']}})[_0x23e2('0x2a')](handleEntityNotFound(_0x1d6e62,null))[_0x23e2('0x2a')](saveUpdates(_0xcb8e35['body'],null))[_0x23e2('0x2a')](respondWithResult(_0x1d6e62,null))['catch'](handleError(_0x1d6e62,null));};exports[_0x23e2('0x2b')]=function(_0x3c4e09,_0x17ff7b){return db['WhatsappInteraction']['find']({'where':{'id':_0x3c4e09[_0x23e2('0xb1')]['id']}})[_0x23e2('0x2a')](handleEntityNotFound(_0x17ff7b,null))[_0x23e2('0x2a')](removeEntity(_0x17ff7b,null))[_0x23e2('0x37')](handleError(_0x17ff7b,null));};exports['describe']=function(_0x3269cb,_0x54d1f6){return db[_0x23e2('0x40')][_0x23e2('0xb8')]()[_0x23e2('0x2a')](respondWithResult(_0x54d1f6,null))['catch'](handleError(_0x54d1f6,null));};exports[_0x23e2('0xb9')]=function(_0x5acbc0,_0x3b6c39,_0x4b049e){return db[_0x23e2('0xba')][_0x23e2('0x66')]({'where':{'id':_0x5acbc0['params']['id']}})[_0x23e2('0x2a')](handleEntityNotFound(_0x3b6c39,null))[_0x23e2('0x2a')](function(_0xb9eff3){if(_0xb9eff3){return _0xb9eff3['addMessage'](_0x5acbc0[_0x23e2('0xb6')][_0x23e2('0xbb')],_[_0x23e2('0xbc')](_0x5acbc0[_0x23e2('0xb6')],[_0x23e2('0xbb'),'id'])||{});}})[_0x23e2('0x2a')](respondWithResult(_0x3b6c39,null))['catch'](handleError(_0x3b6c39,null));};exports[_0x23e2('0xbd')]=function(_0x54b05d,_0x3856db,_0x25e91f){var _0x31a1ac={'raw':![],'where':{}};var _0x62be85={};var _0x258675={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x54b05d[_0x23e2('0xb1')]['id']}})[_0x23e2('0x2a')](handleEntityNotFound(_0x3856db,null))[_0x23e2('0x2a')](function(_0x41997d){if(_0x41997d){_0x62be85[_0x23e2('0x43')]=_[_0x23e2('0x77')](db[_0x23e2('0xba')][_0x23e2('0x41')]);_0x62be85[_0x23e2('0x44')]=_[_0x23e2('0x77')](_0x54b05d['query']);_0x62be85[_0x23e2('0x45')]=_[_0x23e2('0x46')](_0x62be85[_0x23e2('0x43')],_0x62be85[_0x23e2('0x44')]);_0x31a1ac['attributes']=_[_0x23e2('0x46')](_0x62be85[_0x23e2('0x43')],qs['fields'](_0x54b05d[_0x23e2('0x44')][_0x23e2('0x48')]));_0x31a1ac[_0x23e2('0x47')]=_0x31a1ac[_0x23e2('0x47')][_0x23e2('0x65')]?_0x31a1ac['attributes']:_0x62be85[_0x23e2('0x43')];if(!_0x54b05d[_0x23e2('0x44')][_0x23e2('0x49')](_0x23e2('0xbe'))){_0x31a1ac[_0x23e2('0x23')]=qs['limit'](_0x54b05d[_0x23e2('0x44')][_0x23e2('0x23')]);_0x31a1ac[_0x23e2('0x22')]=qs[_0x23e2('0x22')](_0x54b05d['query']['offset']);}_0x31a1ac[_0x23e2('0x4a')]=qs['sort'](_0x54b05d[_0x23e2('0x44')][_0x23e2('0x4b')]);_0x31a1ac[_0x23e2('0x4c')]=qs['filters'](_[_0x23e2('0x4d')](_0x54b05d[_0x23e2('0x44')],_0x62be85[_0x23e2('0x45')]));_0x31a1ac['where'][_0x23e2('0xb0')]=_0x41997d['id'];if(_0x54b05d[_0x23e2('0x44')][_0x23e2('0x89')]){_0x31a1ac[_0x23e2('0x4c')]=_[_0x23e2('0x9f')](_0x31a1ac[_0x23e2('0x4c')],{'$or':_[_0x23e2('0x31')](_0x31a1ac['attributes'],function(_0xdf034){var _0x471ef2={};_0x471ef2[_0xdf034]={'$like':'%'+_0x54b05d[_0x23e2('0x44')][_0x23e2('0x89')]+'%'};return _0x471ef2;})});}if(_0x54b05d[_0x23e2('0x44')][_0x23e2('0x7d')]){var _0x58e8a0=_0x54b05d[_0x23e2('0x44')][_0x23e2('0x7d')][_0x23e2('0x34')](',');var _0x383473={};_0x383473[_0x58e8a0[0x0]]={'$gte':moment(_0x58e8a0[0x1])[_0x23e2('0xbf')](_0x23e2('0xc0'))};_0x31a1ac[_0x23e2('0x4c')]=_[_0x23e2('0x9f')](_0x31a1ac[_0x23e2('0x4c')],_0x383473);}_0x31a1ac=_[_0x23e2('0x9f')]({},_0x31a1ac,_0x54b05d['options']);return db[_0x23e2('0xba')][_0x23e2('0x25')]({'where':_0x31a1ac['where']})[_0x23e2('0x2a')](function(_0xbadc49){_0x258675[_0x23e2('0x25')]=_0xbadc49;if(_0x54b05d[_0x23e2('0x44')][_0x23e2('0xb2')]){_0x31a1ac['include']=[{'all':!![]}];}return db[_0x23e2('0xba')]['findAll'](_0x31a1ac);})[_0x23e2('0x2a')](function(_0x2e506b){_0x258675[_0x23e2('0xc1')]=_0x2e506b;return _0x258675;});}})['then'](respondWithFilteredResult(_0x3856db,_0x31a1ac))[_0x23e2('0x37')](handleError(_0x3856db,null));};exports['addTags']=function(_0x4eda69,_0x578253,_0x4f18df){return db[_0x23e2('0x40')]['find']({'where':{'id':_0x4eda69[_0x23e2('0xb1')]['id']}})[_0x23e2('0x2a')](handleEntityNotFound(_0x578253,null))[_0x23e2('0x2a')](function(_0x5a5edf){if(_0x5a5edf){return _0x5a5edf[_0x23e2('0xc2')](_0x4eda69[_0x23e2('0xb6')][_0x23e2('0xbb')],_[_0x23e2('0xbc')](_0x4eda69['body'],['ids','id'])||{})[_0x23e2('0xc3')](function(){return db[_0x23e2('0x74')][_0x23e2('0xc4')]({'attributes':['id',_0x23e2('0x2f'),_0x23e2('0x50')],'where':{'id':_0x4eda69[_0x23e2('0xb6')]['ids']}});})['then'](function(_0x38f311){socket[_0x23e2('0xc5')](_0x23e2('0xc6'),{'id':Number(_0x4eda69[_0x23e2('0xb1')]['id']),'tags':_0x38f311||[]});return{'id':Number(_0x4eda69[_0x23e2('0xb1')]['id']),'tags':_0x38f311||[]};});}})[_0x23e2('0x2a')](respondWithResult(_0x578253,null))['catch'](handleError(_0x578253,null));};exports['removeTags']=function(_0x13626e,_0x1a9a58,_0x2169c8){return db[_0x23e2('0x40')][_0x23e2('0x66')]({'where':{'id':_0x13626e[_0x23e2('0xb1')]['id']}})['then'](handleEntityNotFound(_0x1a9a58,null))[_0x23e2('0x2a')](function(_0x4d4475){if(_0x4d4475){return _0x4d4475[_0x23e2('0xc7')](_0x13626e[_0x23e2('0x44')]['ids']);}})[_0x23e2('0x2a')](respondWithStatusCode(_0x1a9a58,null))[_0x23e2('0x37')](handleError(_0x1a9a58,null));};exports[_0x23e2('0xc8')]=function(_0x3b09bb,_0x248a09){var _0x45a4dc=moment()[_0x23e2('0xc9')]()[_0x23e2('0x9e')]();var _0x5c183e=path['join'](config[_0x23e2('0xca')],_0x23e2('0xcb'),'files','tmp');var _0x530036=path[_0x23e2('0xcc')](config[_0x23e2('0xca')],_0x23e2('0xcb'),_0x23e2('0xcd'),_0x23e2('0xce'));var _0x5b1ab3=path[_0x23e2('0xcc')](_0x5c183e,_0x45a4dc);var _0x382be5=util[_0x23e2('0xbf')](_0x23e2('0xcf'),_0x3b09bb[_0x23e2('0xb1')]['id'],_0x45a4dc);var _0x40a68d=path['join'](_0x5c183e,_0x382be5);var _0x5b5ad7=[];_0x5b5ad7[_0x23e2('0x36')]({'model':db[_0x23e2('0xd0')],'as':'User','attributes':['id',_0x23e2('0xd1')],'raw':!![]});_0x5b5ad7[_0x23e2('0x36')]({'model':db[_0x23e2('0xd2')],'as':'Contact','attributes':['id',_0x23e2('0xd3'),_0x23e2('0xd4')],'raw':!![]});if(_0x3b09bb['query']['attachments']){_0x5b5ad7[_0x23e2('0x36')]({'model':db[_0x23e2('0xd5')],'as':_0x23e2('0xd5'),'raw':!![]});}var _0x5831bd=[{'model':db['WhatsappMessage'],'as':_0x23e2('0xd6'),'attributes':['id',_0x23e2('0xb6'),_0x23e2('0x7c'),_0x23e2('0xd7'),_0x23e2('0xd8'),_0x23e2('0x83')],'include':_0x5b5ad7}];_0x5831bd[_0x23e2('0x36')]({'model':db[_0x23e2('0xd9')],'as':_0x23e2('0xda'),'attributes':['id',_0x23e2('0x2f')]});_0x5831bd[_0x23e2('0x36')]({'model':db[_0x23e2('0xd0')],'as':_0x23e2('0xdb'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x3b09bb[_0x23e2('0xb1')]['id']},'include':_0x5831bd})[_0x23e2('0x2a')](handleEntityNotFound(_0x248a09,null))[_0x23e2('0x2a')](function(_0xa9f984){if(_0xa9f984){var _0xdfe5c8=_0xa9f984['get']({'plain':!![]});fs[_0x23e2('0xdc')](_0x5b1ab3);var _0x1ca150={'channel':_0x23e2('0xdd'),'account':_0xdfe5c8[_0x23e2('0xda')][_0x23e2('0x2f')],'agent':_0xdfe5c8[_0x23e2('0xdb')]?_0xdfe5c8['Owner'][_0x23e2('0xd1')]:_0x23e2('0xde'),'createdAt':moment(_0xdfe5c8[_0x23e2('0x7c')])[_0x23e2('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x23e2('0x9e')](),'closedAt':_0xdfe5c8['closed']?moment(_0xdfe5c8['closedAt'])['format'](_0x23e2('0xc0'))[_0x23e2('0x9e')]():'','disposition':_0xdfe5c8[_0x23e2('0xdf')],'messages':_(_0xdfe5c8[_0x23e2('0xd6')])[_0x23e2('0x89')]({'secret':![]})[_0x23e2('0x31')](function(_0x5e572c){if(_0x5e572c['Attachment']){var _0x2d3ec0=path[_0x23e2('0xcc')](_0x530036,_0x5e572c[_0x23e2('0xd5')]['basename']);if(fs[_0x23e2('0xe0')](_0x2d3ec0)){fs[_0x23e2('0xe1')](_0x2d3ec0)['pipe'](fs[_0x23e2('0xe2')](path[_0x23e2('0xcc')](_0x5b1ab3,_0x5e572c[_0x23e2('0xd5')][_0x23e2('0xe3')])));}}return{'date':moment(_0x5e572c[_0x23e2('0x7c')])['format'](_0x23e2('0xc0'))[_0x23e2('0x9e')](),'sender':_0x5e572c[_0x23e2('0xd7')]===_0x23e2('0xe4')?_0x5e572c['User']?_0x5e572c[_0x23e2('0xd0')][_0x23e2('0xd1')]:_0x23e2('0xe5'):_0x5e572c[_0x23e2('0x6b')][_0x23e2('0xd3')]+(_0x5e572c[_0x23e2('0x6b')]['lastName']?'\x20'+_0x5e572c[_0x23e2('0x6b')][_0x23e2('0xd4')]:''),'body':_0x5e572c[_0x23e2('0xd5')]?_0x5e572c[_0x23e2('0xd5')][_0x23e2('0xe3')]:_0x5e572c[_0x23e2('0xb6')],'direction':_0x5e572c['direction']===_0x23e2('0xe4')?'A':'C','secret':_0x5e572c[_0x23e2('0xd8')],'read':_0x5e572c[_0x23e2('0x83')],'attachment':_0x5e572c[_0x23e2('0xd5')]};})[_0x23e2('0x68')]()};return ejs[_0x23e2('0xe6')](path[_0x23e2('0xcc')](config['root'],_0x23e2('0xcb'),_0x23e2('0xe7'),'downloadInteraction.ejs'),{'interaction':_0x1ca150})[_0x23e2('0x2a')](function(_0x52b654){var _0x1e56cc=path[_0x23e2('0xcc')](_0x5b1ab3,_0x23e2('0xe8')+_0xdfe5c8['id']+'-'+_0x45a4dc+'.pdf');var _0x25adc7={'path':_0x1e56cc,'channel':_0x23e2('0xdd'),'interactionId':_0xdfe5c8['id']};return pdf['createPdfFromHTML'](_0x52b654,_0x25adc7);})[_0x23e2('0x2a')](function(){return new BPromise(function(_0x4aefd1,_0x2feab7){zipdir(_0x5b1ab3,{'saveTo':_0x40a68d},function(_0x16d560,_0x14d43d){if(_0x16d560)return _0x2feab7(_0x16d560);return _0x4aefd1(_0x14d43d);});})[_0x23e2('0x2a')](function(){return new BPromise(function(_0x181a1d,_0x5710b2){rimraf(_0x5b1ab3,function(_0x341636){if(_0x341636)_0x5710b2(_0x341636);return _0x181a1d();});});})['then'](function(){return _0x248a09[_0x23e2('0xc8')](_0x40a68d,_0x382be5,function(_0x16e069){if(_0x16e069){console[_0x23e2('0xe9')]('err',_0x16e069);}else{fs[_0x23e2('0xea')](_0x40a68d);}});});});}else{return _0x248a09['sendStatus'](0xc8);}})['catch'](handleError(_0x248a09,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d0d2f23..0a01a4c 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 _0xc4e6=['setMaxListeners','save','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x2f741f,_0x1010a1){var _0x430080=function(_0x591c1b){while(--_0x591c1b){_0x2f741f['push'](_0x2f741f['shift']());}};_0x430080(++_0x1010a1);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xc4e6[_0x279368];return _0x40b6d0;};'use strict';var EventEmitter=require(_0x6c4e('0x0'));var WhatsappInteraction=require(_0x6c4e('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x6c4e('0x1'))['db'][_0x6c4e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6c4e('0x3')](0x0);var events={'afterCreate':_0x6c4e('0x4'),'afterUpdate':'update','afterDestroy':_0x6c4e('0x5')};function emitEvent(_0x358bfb){return function(_0x297887,_0x5d8d70,_0x266061){_0x297887['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3355f9){_0x297887[_0x6c4e('0x6')](_0x6c4e('0x7'),_0x3355f9[_0x6c4e('0x8')](function(_0x3929d8){return{'id':_0x3929d8['id']};}));return WhatsappMessage[_0x6c4e('0x9')]({'where':{'WhatsappInteractionId':_0x297887['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c4e('0xa')](function(_0x2231a7){_0x297887[_0x6c4e('0x6')](_0x6c4e('0xb'),_0x2231a7[_0x6c4e('0xc')]);WhatsappInteractionEvents[_0x6c4e('0xd')](_0x358bfb+':'+_0x297887['id'],_0x297887);WhatsappInteractionEvents['emit'](_0x358bfb,_0x297887);_0x266061(null);})['catch'](_0x266061(null));};}for(var e in events){if(events[_0x6c4e('0xe')](e)){var event=events[e];WhatsappInteraction[_0x6c4e('0xf')](e,emitEvent(event));}}module[_0x6c4e('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x77f1=['exports','../../mysqldb','WhatsappInteraction','update','remove','getUsers','then','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x310e92,_0x4727b8){var _0x3c71dc=function(_0x354ad9){while(--_0x354ad9){_0x310e92['push'](_0x310e92['shift']());}};_0x3c71dc(++_0x4727b8);}(_0x77f1,0x1dd));var _0x177f=function(_0x14f683,_0x230219){_0x14f683=_0x14f683-0x0;var _0x504de8=_0x77f1[_0x14f683];return _0x504de8;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x177f('0x0'))['db'][_0x177f('0x1')];var WhatsappMessage=require(_0x177f('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x177f('0x2'),'afterDestroy':_0x177f('0x3')};function emitEvent(_0x57dc73){return function(_0x68cb6a,_0x22c85f,_0x31c4de){_0x68cb6a[_0x177f('0x4')]({'attributes':['id'],'raw':!![]})[_0x177f('0x5')](function(_0x58525a){_0x68cb6a[_0x177f('0x6')](_0x177f('0x7'),_0x58525a['map'](function(_0xba9371){return{'id':_0xba9371['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x68cb6a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x177f('0x5')](function(_0x4e1bab){_0x68cb6a[_0x177f('0x6')](_0x177f('0x8'),_0x4e1bab['length']);WhatsappInteractionEvents[_0x177f('0x9')](_0x57dc73+':'+_0x68cb6a['id'],_0x68cb6a);WhatsappInteractionEvents[_0x177f('0x9')](_0x57dc73,_0x68cb6a);_0x31c4de(null);})[_0x177f('0xa')](_0x31c4de(null));};}for(var e in events){if(events[_0x177f('0xb')](e)){var event=events[e];WhatsappInteraction[_0x177f('0xc')](e,emitEvent(event));}}module[_0x177f('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index af6cde9..579c676 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 _0xd8fe=['path','rimraf','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise'];(function(_0x1e440c,_0x3b2ca5){var _0x3cfab5=function(_0x905734){while(--_0x905734){_0x1e440c['push'](_0x1e440c['shift']());}};_0x3cfab5(++_0x3b2ca5);}(_0xd8fe,0xfa));var _0xed8f=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xd8fe[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xed8f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xed8f('0x1'));var moment=require(_0xed8f('0x2'));var BPromise=require(_0xed8f('0x3'));var rp=require(_0xed8f('0x4'));var fs=require('fs');var path=require(_0xed8f('0x5'));var rimraf=require(_0xed8f('0x6'));var config=require('../../config/environment');var attributes=require(_0xed8f('0x7'));module['exports']=function(_0x151332,_0x29aa00){return _0x151332['define'](_0xed8f('0x8'),attributes,{'tableName':_0xed8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c6429,_0x345d91,_0x505f04){if(_0x2c6429[_0xed8f('0xa')](_0xed8f('0xb'))){_0x2c6429[_0xed8f('0xc')]=moment()[_0xed8f('0xd')](_0xed8f('0xe'));}_0x505f04(null,_0x2c6429);}}});}; \ No newline at end of file +var _0x3172=['WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x45e926,_0x2f9a49){var _0x313cfd=function(_0x23125f){while(--_0x23125f){_0x45e926['push'](_0x45e926['shift']());}};_0x313cfd(++_0x2f9a49);}(_0x3172,0x1da));var _0x2317=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x3172[_0x1d1d09];return _0x8827e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2317('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2317('0x1'));var rimraf=require(_0x2317('0x2'));var config=require(_0x2317('0x3'));var attributes=require(_0x2317('0x4'));module[_0x2317('0x5')]=function(_0x38cd8e,_0x41d09c){return _0x38cd8e[_0x2317('0x6')](_0x2317('0x7'),attributes,{'tableName':_0x2317('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1923cf,_0x506579,_0x4d081e){if(_0x1923cf['changed'](_0x2317('0x9'))){_0x1923cf[_0x2317('0xa')]=moment()[_0x2317('0xb')](_0x2317('0xc'));}_0x4d081e(null,_0x1923cf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 94ae19f..92727a5 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 _0xcedd=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','WhatsappInteraction','update','options','raw','where','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','body','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug'];(function(_0x38fd39,_0x43e8c3){var _0x1f694d=function(_0x45d45c){while(--_0x45d45c){_0x38fd39['push'](_0x38fd39['shift']());}};_0x1f694d(++_0x43e8c3);}(_0xcedd,0x68));var _0xdced=function(_0x194b4c,_0x7c9ca2){_0x194b4c=_0x194b4c-0x0;var _0x1fdd22=_0xcedd[_0x194b4c];return _0x1fdd22;};'use strict';var _=require(_0xdced('0x0'));var util=require(_0xdced('0x1'));var moment=require(_0xdced('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdced('0x3'));var db=require(_0xdced('0x4'))['db'];var utils=require(_0xdced('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdced('0x6'));var jayson=require(_0xdced('0x7'));var client=jayson[_0xdced('0x8')][_0xdced('0x9')]({'port':0x232a});config[_0xdced('0xa')]=_[_0xdced('0xb')](config['redis'],{'host':_0xdced('0xc'),'port':0x18eb});var socket=require(_0xdced('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x518b0e,_0xb1e9bc,_0x54d973){return new BPromise(function(_0x341897,_0x4f549e){return client[_0xdced('0xe')](_0x518b0e,_0x54d973)[_0xdced('0xf')](function(_0x310de1){logger[_0xdced('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0xb1e9bc,_0xdced('0x11'));logger[_0xdced('0x12')](_0xdced('0x13'),_0xb1e9bc,_0xdced('0x11'),JSON[_0xdced('0x14')](_0x310de1));if(_0x310de1[_0xdced('0x15')]){if(_0x310de1[_0xdced('0x15')][_0xdced('0x16')]===0x1f4){logger[_0xdced('0x15')](_0xdced('0x17'),_0xb1e9bc,_0x310de1[_0xdced('0x15')][_0xdced('0x18')]);return _0x4f549e(_0x310de1[_0xdced('0x15')][_0xdced('0x18')]);}logger[_0xdced('0x15')](_0xdced('0x17'),_0xb1e9bc,_0x310de1[_0xdced('0x15')]['message']);return _0x341897(_0x310de1[_0xdced('0x15')][_0xdced('0x18')]);}else{logger[_0xdced('0x10')](_0xdced('0x17'),_0xb1e9bc,_0xdced('0x11'));_0x341897(_0x310de1[_0xdced('0x19')][_0xdced('0x18')]);}})[_0xdced('0x1a')](function(_0xad3817){logger[_0xdced('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xb1e9bc,_0xad3817);_0x4f549e(_0xad3817);});});}exports['UpdateWhatsappInteraction']=function(_0x3ce4e3){var _0x522e90=this;return new Promise(function(_0x1b81fd,_0x2c2216){return db[_0xdced('0x1b')][_0xdced('0x1c')](_0x3ce4e3['body'],{'raw':_0x3ce4e3[_0xdced('0x1d')]?_0x3ce4e3[_0xdced('0x1d')][_0xdced('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce4e3[_0xdced('0x1d')]?_0x3ce4e3[_0xdced('0x1d')][_0xdced('0x1f')]||null:null,'attributes':_0x3ce4e3[_0xdced('0x1d')]?_0x3ce4e3['options']['attributes']||null:null,'limit':_0x3ce4e3['options']?_0x3ce4e3['options'][_0xdced('0x20')]||null:null})[_0xdced('0xf')](function(_0x46af23){logger[_0xdced('0x10')](_0xdced('0x21'),_0x3ce4e3);logger['debug'](_0xdced('0x21'),_0x3ce4e3,JSON['stringify'](_0x46af23));_0x1b81fd(_0x46af23);})['catch'](function(_0x271731){logger[_0xdced('0x15')](_0xdced('0x21'),_0x271731['message'],_0x3ce4e3);_0x2c2216(_0x522e90[_0xdced('0x15')](0x1f4,_0x271731['message']));});});};exports[_0xdced('0x22')]=function(_0x3672d5){return new Promise(function(_0x3b2749,_0x2fe25a){return db[_0xdced('0x1b')][_0xdced('0x23')]({'where':_0x3672d5[_0xdced('0x1d')]?_0x3672d5[_0xdced('0x1d')][_0xdced('0x1f')]||null:null})[_0xdced('0xf')](function(_0x4dd7a3){if(_0x4dd7a3){return _0x4dd7a3[_0xdced('0x24')](_0x3672d5['body'][_0xdced('0x25')],_['omit'](_0x3672d5[_0xdced('0x26')],[_0xdced('0x25'),'id'])||{});}})[_0xdced('0x27')](function(_0x1dce66){logger[_0xdced('0x10')]('AddTags',_0x3672d5);logger[_0xdced('0x12')](_0xdced('0x28'),_0x3672d5,JSON[_0xdced('0x14')](_0x1dce66));_0x3b2749(_0x1dce66);})[_0xdced('0x1a')](function(_0x498686){logger['error'](_0xdced('0x28'),_0x498686[_0xdced('0x18')],_0x3672d5);_0x2fe25a(_this[_0xdced('0x15')](0x1f4,_0x498686['message']));});});}; \ No newline at end of file +var _0xf75e=['redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf75e,0xf5));var _0xef75=function(_0x1b04b5,_0xaf5c56){_0x1b04b5=_0x1b04b5-0x0;var _0x75528d=_0xf75e[_0x1b04b5];return _0x75528d;};'use strict';var _=require(_0xef75('0x0'));var util=require(_0xef75('0x1'));var moment=require(_0xef75('0x2'));var BPromise=require(_0xef75('0x3'));var rs=require(_0xef75('0x4'));var fs=require('fs');var Redis=require(_0xef75('0x5'));var db=require(_0xef75('0x6'))['db'];var utils=require(_0xef75('0x7'));var logger=require(_0xef75('0x8'))('rpc');var config=require(_0xef75('0x9'));var jayson=require(_0xef75('0xa'));var client=jayson['client'][_0xef75('0xb')]({'port':0x232a});config['redis']=_[_0xef75('0xc')](config[_0xef75('0xd')],{'host':_0xef75('0xe'),'port':0x18eb});var socket=require(_0xef75('0xf'))(new Redis(config['redis']));require(_0xef75('0x10'))[_0xef75('0x11')](socket);function respondWithRpcPromise(_0x2a47cd,_0x4546d7,_0x1bf4e2){return new BPromise(function(_0x555ec0,_0x5b17a7){return client[_0xef75('0x12')](_0x2a47cd,_0x1bf4e2)[_0xef75('0x13')](function(_0x298b85){logger[_0xef75('0x14')](_0xef75('0x15'),_0x4546d7,_0xef75('0x16'));logger[_0xef75('0x17')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4546d7,_0xef75('0x16'),JSON[_0xef75('0x18')](_0x298b85));if(_0x298b85['error']){if(_0x298b85[_0xef75('0x19')][_0xef75('0x1a')]===0x1f4){logger[_0xef75('0x19')](_0xef75('0x15'),_0x4546d7,_0x298b85[_0xef75('0x19')][_0xef75('0x1b')]);return _0x5b17a7(_0x298b85[_0xef75('0x19')][_0xef75('0x1b')]);}logger[_0xef75('0x19')](_0xef75('0x15'),_0x4546d7,_0x298b85['error'][_0xef75('0x1b')]);return _0x555ec0(_0x298b85['error'][_0xef75('0x1b')]);}else{logger[_0xef75('0x14')](_0xef75('0x15'),_0x4546d7,_0xef75('0x16'));_0x555ec0(_0x298b85['result'][_0xef75('0x1b')]);}})[_0xef75('0x1c')](function(_0x10d0a6){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x4546d7,_0x10d0a6);_0x5b17a7(_0x10d0a6);});});}exports[_0xef75('0x1d')]=function(_0x1ef750){var _0xa5dadf=this;return new Promise(function(_0x4da0c8,_0x120368){return db[_0xef75('0x1e')][_0xef75('0x1f')](_0x1ef750[_0xef75('0x20')],{'raw':_0x1ef750[_0xef75('0x21')]?_0x1ef750[_0xef75('0x21')][_0xef75('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ef750[_0xef75('0x21')]?_0x1ef750[_0xef75('0x21')][_0xef75('0x23')]||null:null,'attributes':_0x1ef750['options']?_0x1ef750['options'][_0xef75('0x24')]||null:null,'limit':_0x1ef750[_0xef75('0x21')]?_0x1ef750[_0xef75('0x21')][_0xef75('0x25')]||null:null})[_0xef75('0x13')](function(_0x544868){logger[_0xef75('0x14')](_0xef75('0x1d'),_0x1ef750);logger[_0xef75('0x17')](_0xef75('0x1d'),_0x1ef750,JSON[_0xef75('0x18')](_0x544868));_0x4da0c8(_0x544868);})['catch'](function(_0x2192ee){logger[_0xef75('0x19')](_0xef75('0x1d'),_0x2192ee[_0xef75('0x1b')],_0x1ef750);_0x120368(_0xa5dadf['error'](0x1f4,_0x2192ee[_0xef75('0x1b')]));});});};exports[_0xef75('0x26')]=function(_0x9ff3a4){return new Promise(function(_0x4fa7aa,_0x37021b){return db[_0xef75('0x1e')][_0xef75('0x27')]({'where':_0x9ff3a4[_0xef75('0x21')]?_0x9ff3a4['options'][_0xef75('0x23')]||null:null})[_0xef75('0x13')](function(_0x2eb55a){if(_0x2eb55a){return _0x2eb55a['addTags'](_0x9ff3a4[_0xef75('0x20')][_0xef75('0x28')],_['omit'](_0x9ff3a4[_0xef75('0x20')],[_0xef75('0x28'),'id'])||{});}})[_0xef75('0x29')](function(_0x387b89){logger[_0xef75('0x14')](_0xef75('0x2a'),_0x9ff3a4);logger[_0xef75('0x17')](_0xef75('0x2a'),_0x9ff3a4,JSON[_0xef75('0x18')](_0x387b89));_0x4fa7aa(_0x387b89);})['catch'](function(_0x11858b){logger[_0xef75('0x19')](_0xef75('0x2a'),_0x11858b[_0xef75('0x1b')],_0x9ff3a4);_0x37021b(_this[_0xef75('0x19')](0x1f4,_0x11858b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 40a9991..e0ff5a4 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 _0x8fb5=['./whatsappInteraction.events','save','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x5e9d4c,_0xf936fa){var _0x4fa9d9=function(_0x5a253b){while(--_0x5a253b){_0x5e9d4c['push'](_0x5e9d4c['shift']());}};_0x4fa9d9(++_0xf936fa);}(_0x8fb5,0x1b2));var _0x58fb=function(_0x37ec07,_0x4d7bf5){_0x37ec07=_0x37ec07-0x0;var _0xbe29e2=_0x8fb5[_0x37ec07];return _0xbe29e2;};'use strict';var WhatsappInteractionEvents=require(_0x58fb('0x0'));var events=[_0x58fb('0x1'),'remove','update'];function createListener(_0x450540,_0x22e1ac){return function(_0x46f5e5){_0x22e1ac[_0x58fb('0x2')](_0x450540,_0x46f5e5);};}function removeListener(_0x407f79,_0x2d5712){return function(){WhatsappInteractionEvents[_0x58fb('0x3')](_0x407f79,_0x2d5712);};}exports[_0x58fb('0x4')]=function(_0x46518d){for(var _0x4131c7=0x0,_0x6293fa=events[_0x58fb('0x5')];_0x4131c7<_0x6293fa;_0x4131c7++){var _0x3d2c61=events[_0x4131c7];var _0x4c41e0=createListener(_0x58fb('0x6')+_0x3d2c61,_0x46518d);WhatsappInteractionEvents['on'](_0x3d2c61,_0x4c41e0);}}; \ No newline at end of file +var _0xb527=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb527,0xb3));var _0x7b52=function(_0x35506e,_0x2c273d){_0x35506e=_0x35506e-0x0;var _0x5c1c3f=_0xb527[_0x35506e];return _0x5c1c3f;};'use strict';var WhatsappInteractionEvents=require(_0x7b52('0x0'));var events=[_0x7b52('0x1'),_0x7b52('0x2'),'update'];function createListener(_0x3b7bb1,_0x356512){return function(_0x2fc9de){_0x356512[_0x7b52('0x3')](_0x3b7bb1,_0x2fc9de);};}function removeListener(_0x5a6e29,_0x2b8613){return function(){WhatsappInteractionEvents[_0x7b52('0x4')](_0x5a6e29,_0x2b8613);};}exports[_0x7b52('0x5')]=function(_0x180952){for(var _0x5e2bae=0x0,_0x19866e=events[_0x7b52('0x6')];_0x5e2bae<_0x19866e;_0x5e2bae++){var _0x16c14c=events[_0x5e2bae];var _0x4cc1ce=createListener(_0x7b52('0x7')+_0x16c14c,_0x180952);WhatsappInteractionEvents['on'](_0x16c14c,_0x4cc1ce);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5f975f0..2e0275b 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 _0x7aee=['accept','/:id/reject','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept'];(function(_0x2903ec,_0x4adec2){var _0x50251f=function(_0x261a81){while(--_0x261a81){_0x2903ec['push'](_0x2903ec['shift']());}};_0x50251f(++_0x4adec2);}(_0x7aee,0x1be));var _0xe7ae=function(_0x16781c,_0x165e9b){_0x16781c=_0x16781c-0x0;var _0x2b4aee=_0x7aee[_0x16781c];return _0x2b4aee;};'use strict';var multer=require(_0xe7ae('0x0'));var util=require(_0xe7ae('0x1'));var path=require('path');var timeout=require(_0xe7ae('0x2'));var express=require(_0xe7ae('0x3'));var router=express[_0xe7ae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe7ae('0x6'));var controller=require(_0xe7ae('0x7'));router[_0xe7ae('0x8')]('/',auth[_0xe7ae('0x9')](),controller[_0xe7ae('0xa')]);router['get'](_0xe7ae('0xb'),auth[_0xe7ae('0x9')](),controller[_0xe7ae('0xc')]);router[_0xe7ae('0x8')](_0xe7ae('0xd'),auth[_0xe7ae('0x9')](),controller[_0xe7ae('0xe')]);router[_0xe7ae('0xf')]('/',auth[_0xe7ae('0x9')](),interaction['tracked'](_0xe7ae('0x10'),_0xe7ae('0x11')),controller['create']);router[_0xe7ae('0xf')](_0xe7ae('0x12'),controller[_0xe7ae('0x13')]);router[_0xe7ae('0x14')](_0xe7ae('0xd'),auth['isAuthenticated'](),controller['update']);router['put'](_0xe7ae('0x15'),auth['isAuthenticated'](),controller[_0xe7ae('0x16')]);router[_0xe7ae('0x14')](_0xe7ae('0x17'),auth[_0xe7ae('0x9')](),controller['reject']);router['delete'](_0xe7ae('0xd'),auth['isAuthenticated'](),controller[_0xe7ae('0x18')]);module[_0xe7ae('0x19')]=router; \ No newline at end of file +var _0x63e9=['status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','create'];(function(_0x2d2ccc,_0x30f2fe){var _0x54dc55=function(_0x378643){while(--_0x378643){_0x2d2ccc['push'](_0x2d2ccc['shift']());}};_0x54dc55(++_0x30f2fe);}(_0x63e9,0xe9));var _0x963e=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x63e9[_0x3c487b];return _0x1d65f6;};'use strict';var multer=require(_0x963e('0x0'));var util=require(_0x963e('0x1'));var path=require(_0x963e('0x2'));var timeout=require('connect-timeout');var express=require(_0x963e('0x3'));var router=express['Router']();var fs_extra=require(_0x963e('0x4'));var auth=require(_0x963e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x963e('0x6'));var controller=require(_0x963e('0x7'));router[_0x963e('0x8')]('/',auth[_0x963e('0x9')](),controller[_0x963e('0xa')]);router[_0x963e('0x8')](_0x963e('0xb'),auth[_0x963e('0x9')](),controller[_0x963e('0xc')]);router[_0x963e('0x8')](_0x963e('0xd'),auth[_0x963e('0x9')](),controller[_0x963e('0xe')]);router[_0x963e('0xf')]('/',auth[_0x963e('0x9')](),interaction[_0x963e('0x10')](_0x963e('0x11'),'whatsappmessage:create'),controller[_0x963e('0x12')]);router[_0x963e('0xf')]('/:id/status',controller[_0x963e('0x13')]);router['put'](_0x963e('0xd'),auth[_0x963e('0x9')](),controller['update']);router[_0x963e('0x14')](_0x963e('0x15'),auth[_0x963e('0x9')](),controller[_0x963e('0x16')]);router[_0x963e('0x14')](_0x963e('0x17'),auth[_0x963e('0x9')](),controller[_0x963e('0x18')]);router[_0x963e('0x19')]('/:id',auth[_0x963e('0x9')](),controller[_0x963e('0x1a')]);module[_0x963e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6a28f1f..5661115 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 _0xd67b=['medium','BOOLEAN','ENUM','out','STRING','TEXT','exports'];(function(_0x33422b,_0x2bddbb){var _0x519969=function(_0x2ebe27){while(--_0x2ebe27){_0x33422b['push'](_0x33422b['shift']());}};_0x519969(++_0x2bddbb);}(_0xd67b,0x133));var _0xbd67=function(_0x2f0834,_0xa7c135){_0x2f0834=_0x2f0834-0x0;var _0x57178f=_0xd67b[_0x2f0834];return _0x57178f;};'use strict';var Sequelize=require('sequelize');module[_0xbd67('0x0')]={'body':{'type':Sequelize['TEXT'](_0xbd67('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xbd67('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd67('0x3')]('in','out'),'defaultValue':_0xbd67('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbd67('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbd67('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbd67('0x5')]},'providerResponse':{'type':Sequelize[_0xbd67('0x6')]}}; \ No newline at end of file +var _0x6fc3=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x1f734d,_0x5b3c37){var _0x186847=function(_0x38f7db){while(--_0x38f7db){_0x1f734d['push'](_0x1f734d['shift']());}};_0x186847(++_0x5b3c37);}(_0x6fc3,0x117));var _0x36fc=function(_0x43297e,_0x2ad1e1){_0x43297e=_0x43297e-0x0;var _0xc82671=_0x6fc3[_0x43297e];return _0xc82671;};'use strict';var Sequelize=require(_0x36fc('0x0'));module[_0x36fc('0x1')]={'body':{'type':Sequelize[_0x36fc('0x2')](_0x36fc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x36fc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x36fc('0x5')]('in',_0x36fc('0x6')),'defaultValue':_0x36fc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x36fc('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x36fc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x36fc('0x7')]},'providerResponse':{'type':Sequelize[_0x36fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index be089ed..95a1f47 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 _0xffef=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','find','create','body','destroy','../../config/logger','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','read','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','to-csv'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xffef,0x18e));var _0xfffe=function(_0x5ada4a,_0x5d9420){_0x5ada4a=_0x5ada4a-0x0;var _0x1ceb86=_0xffef[_0x5ada4a];return _0x1ceb86;};'use strict';var emlformat=require(_0xfffe('0x0'));var rimraf=require(_0xfffe('0x1'));var zipdir=require(_0xfffe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfffe('0x3'));var moment=require(_0xfffe('0x4'));var BPromise=require(_0xfffe('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfffe('0x6'));var ejs=require(_0xfffe('0x7'));var fs=require('fs');var fs_extra=require(_0xfffe('0x8'));var _=require(_0xfffe('0x9'));var squel=require(_0xfffe('0xa'));var crypto=require(_0xfffe('0xb'));var jsforce=require(_0xfffe('0xc'));var deskjs=require(_0xfffe('0xd'));var toCsv=require(_0xfffe('0x6'));var querystring=require('querystring');var Papa=require(_0xfffe('0xe'));var Redis=require('ioredis');var authService=require(_0xfffe('0xf'));var qs=require(_0xfffe('0x10'));var as=require(_0xfffe('0x11'));var hardwareService=require(_0xfffe('0x12'));var logger=require('../../config/logger')(_0xfffe('0x13'));var utils=require(_0xfffe('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfffe('0x15'));var db=require('../../mysqldb')['db'];config[_0xfffe('0x16')]=_[_0xfffe('0x17')](config[_0xfffe('0x16')],{'host':_0xfffe('0x18'),'port':0x18eb});var socket=require(_0xfffe('0x19'))(new Redis(config[_0xfffe('0x16')]));require(_0xfffe('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfffe('0x1b')]({'port':0x232c});var client9002=jayson[_0xfffe('0x1c')][_0xfffe('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2774a8,_0x36fbf7,_0x4dcc42,_0x50b513){return new BPromise(function(_0x3cb2f9,_0x13e0b7){var _0x675621=_0x50b513||client;return _0x675621[_0xfffe('0x1d')](_0x2774a8,_0x4dcc42)[_0xfffe('0x1e')](function(_0x2df269){logger[_0xfffe('0x1f')](_0xfffe('0x20'),_0x36fbf7,'request\x20sent');logger[_0xfffe('0x21')](_0xfffe('0x22'),_0x36fbf7,_0xfffe('0x23'),JSON[_0xfffe('0x24')](_0x2df269));if(_0x2df269['error']){if(_0x2df269['error'][_0xfffe('0x25')]===0x1f4){logger[_0xfffe('0x26')](_0xfffe('0x20'),_0x36fbf7,_0x2df269[_0xfffe('0x26')][_0xfffe('0x27')]);return _0x13e0b7(_0x2df269[_0xfffe('0x26')]['message']);}logger[_0xfffe('0x26')](_0xfffe('0x20'),_0x36fbf7,_0x2df269[_0xfffe('0x26')][_0xfffe('0x27')]);return _0x3cb2f9(_0x2df269[_0xfffe('0x26')][_0xfffe('0x27')]);}else{logger[_0xfffe('0x1f')](_0xfffe('0x20'),_0x36fbf7,_0xfffe('0x23'));_0x3cb2f9(_0x2df269[_0xfffe('0x28')]['message']);}})[_0xfffe('0x29')](function(_0xa4c9ab){logger[_0xfffe('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x36fbf7,_0xa4c9ab);_0x13e0b7(_0xa4c9ab);});});}function respondWithStatusCode(_0x493030,_0x46f3da){_0x46f3da=_0x46f3da||0xcc;return function(_0x4d5e85){if(_0x4d5e85){return _0x493030[_0xfffe('0x2a')](_0x46f3da);}return _0x493030[_0xfffe('0x2b')](_0x46f3da)[_0xfffe('0x2c')]();};}function respondWithResult(_0x2ec158,_0x350d9c){_0x350d9c=_0x350d9c||0xc8;return function(_0x5a3ea9){if(_0x5a3ea9){return _0x2ec158[_0xfffe('0x2b')](_0x350d9c)[_0xfffe('0x2d')](_0x5a3ea9);}};}function respondWithFilteredResult(_0x42477b,_0x4e335c){return function(_0x53af9f){if(_0x53af9f){var _0x1cea6e=typeof _0x4e335c[_0xfffe('0x2e')]==='undefined'&&typeof _0x4e335c['limit']===_0xfffe('0x2f');var _0x3432fb=_0x53af9f[_0xfffe('0x30')];var _0x551597=_0x1cea6e?0x0:_0x4e335c[_0xfffe('0x2e')];var _0x58bf43=_0x1cea6e?_0x53af9f[_0xfffe('0x30')]:_0x4e335c[_0xfffe('0x2e')]+_0x4e335c['limit'];var _0x4bfcfe;if(_0x58bf43>=_0x3432fb){_0x58bf43=_0x3432fb;_0x4bfcfe=0xc8;}else{_0x4bfcfe=0xce;}_0x42477b['status'](_0x4bfcfe);return _0x42477b[_0xfffe('0x31')](_0xfffe('0x32'),_0x551597+'-'+_0x58bf43+'/'+_0x3432fb)['json'](_0x53af9f);}return null;};}function patchUpdates(_0x21b6a2){return function(_0x29db2f){try{jsonpatch[_0xfffe('0x33')](_0x29db2f,_0x21b6a2,!![]);}catch(_0x32b6c4){return BPromise[_0xfffe('0x34')](_0x32b6c4);}return _0x29db2f[_0xfffe('0x35')]();};}function saveUpdates(_0x411daf,_0x36977b){return function(_0x1ce961){if(_0x1ce961){return _0x1ce961[_0xfffe('0x36')](_0x411daf)[_0xfffe('0x1e')](function(_0x267848){return _0x267848;});}return null;};}function removeEntity(_0x289e55,_0x83749d){return function(_0x387c22){if(_0x387c22){return _0x387c22['destroy']()[_0xfffe('0x1e')](function(){_0x289e55[_0xfffe('0x2b')](0xcc)[_0xfffe('0x2c')]();});}};}function handleEntityNotFound(_0x56d760,_0x423804){return function(_0x2b1e84){if(!_0x2b1e84){_0x56d760['sendStatus'](0x194);}return _0x2b1e84;};}function handleError(_0x1ca083,_0x1ca7fb){_0x1ca7fb=_0x1ca7fb||0x1f4;return function(_0x3cf3d7){logger[_0xfffe('0x26')](_0x3cf3d7[_0xfffe('0x37')]);if(_0x3cf3d7[_0xfffe('0x38')]){delete _0x3cf3d7[_0xfffe('0x38')];}_0x1ca083[_0xfffe('0x2b')](_0x1ca7fb)[_0xfffe('0x39')](_0x3cf3d7);};}exports['index']=function(_0x16e3db,_0x4d5ee2){var _0x2ada1c={},_0x36ffbd={},_0x45fb69={'count':0x0,'rows':[]};var _0x38b562=_[_0xfffe('0x3a')](db[_0xfffe('0x3b')][_0xfffe('0x3c')],function(_0x50e923){return{'name':_0x50e923[_0xfffe('0x3d')],'type':_0x50e923['type'][_0xfffe('0x3e')]};});_0x36ffbd[_0xfffe('0x3f')]=_[_0xfffe('0x3a')](_0x38b562,_0xfffe('0x38'));_0x36ffbd[_0xfffe('0x40')]=_[_0xfffe('0x41')](_0x16e3db['query']);_0x36ffbd[_0xfffe('0x42')]=_[_0xfffe('0x43')](_0x36ffbd[_0xfffe('0x3f')],_0x36ffbd[_0xfffe('0x40')]);_0x2ada1c[_0xfffe('0x44')]=_[_0xfffe('0x43')](_0x36ffbd[_0xfffe('0x3f')],qs[_0xfffe('0x45')](_0x16e3db[_0xfffe('0x40')][_0xfffe('0x45')]));_0x2ada1c[_0xfffe('0x44')]=_0x2ada1c['attributes'][_0xfffe('0x46')]?_0x2ada1c[_0xfffe('0x44')]:_0x36ffbd[_0xfffe('0x3f')];if(!_0x16e3db[_0xfffe('0x40')]['hasOwnProperty'](_0xfffe('0x47'))){_0x2ada1c[_0xfffe('0x48')]=qs[_0xfffe('0x48')](_0x16e3db[_0xfffe('0x40')][_0xfffe('0x48')]);_0x2ada1c[_0xfffe('0x2e')]=qs[_0xfffe('0x2e')](_0x16e3db[_0xfffe('0x40')]['offset']);}_0x2ada1c['order']=qs[_0xfffe('0x49')](_0x16e3db[_0xfffe('0x40')][_0xfffe('0x49')]);_0x2ada1c[_0xfffe('0x4a')]=qs[_0xfffe('0x42')](_[_0xfffe('0x4b')](_0x16e3db['query'],_0x36ffbd[_0xfffe('0x42')]),_0x38b562);if(_0x16e3db[_0xfffe('0x40')]['filter']){_0x2ada1c[_0xfffe('0x4a')]=_['merge'](_0x2ada1c[_0xfffe('0x4a')],{'$or':_['map'](_0x38b562,function(_0xe940c8){if(_0xe940c8[_0xfffe('0x4c')]!==_0xfffe('0x4d')){var _0x12da3c={};_0x12da3c[_0xe940c8['name']]={'$like':'%'+_0x16e3db[_0xfffe('0x40')][_0xfffe('0x4e')]+'%'};return _0x12da3c;}})});}_0x2ada1c=_[_0xfffe('0x4f')]({},_0x2ada1c,_0x16e3db[_0xfffe('0x50')]);var _0x18e68e={'where':_0x2ada1c[_0xfffe('0x4a')]};return db[_0xfffe('0x3b')][_0xfffe('0x30')](_0x18e68e)[_0xfffe('0x1e')](function(_0x560670){_0x45fb69[_0xfffe('0x30')]=_0x560670;if(_0x16e3db[_0xfffe('0x40')][_0xfffe('0x51')]){_0x2ada1c[_0xfffe('0x52')]=[{'all':!![]}];}return db[_0xfffe('0x3b')]['findAll'](_0x2ada1c);})[_0xfffe('0x1e')](function(_0x3454e4){_0x45fb69[_0xfffe('0x53')]=_0x3454e4;return _0x45fb69;})['then'](respondWithFilteredResult(_0x4d5ee2,_0x2ada1c))[_0xfffe('0x29')](handleError(_0x4d5ee2,null));};exports[_0xfffe('0x54')]=function(_0x3880dc,_0x13caee){var _0x38e1c8={'raw':!![],'where':{'id':_0x3880dc[_0xfffe('0x55')]['id']}},_0x12d82c={};_0x12d82c['model']=_[_0xfffe('0x41')](db[_0xfffe('0x3b')][_0xfffe('0x3c')]);_0x12d82c[_0xfffe('0x40')]=_[_0xfffe('0x41')](_0x3880dc[_0xfffe('0x40')]);_0x12d82c['filters']=_[_0xfffe('0x43')](_0x12d82c[_0xfffe('0x3f')],_0x12d82c[_0xfffe('0x40')]);_0x38e1c8[_0xfffe('0x44')]=_[_0xfffe('0x43')](_0x12d82c['model'],qs[_0xfffe('0x45')](_0x3880dc[_0xfffe('0x40')][_0xfffe('0x45')]));_0x38e1c8[_0xfffe('0x44')]=_0x38e1c8['attributes']['length']?_0x38e1c8['attributes']:_0x12d82c[_0xfffe('0x3f')];if(_0x3880dc[_0xfffe('0x40')][_0xfffe('0x51')]){_0x38e1c8[_0xfffe('0x52')]=[{'all':!![]}];}_0x38e1c8=_['merge']({},_0x38e1c8,_0x3880dc[_0xfffe('0x50')]);return db[_0xfffe('0x3b')][_0xfffe('0x56')](_0x38e1c8)[_0xfffe('0x1e')](handleEntityNotFound(_0x13caee,null))[_0xfffe('0x1e')](respondWithResult(_0x13caee,null))['catch'](handleError(_0x13caee,null));};exports[_0xfffe('0x57')]=function(_0x5d0be1,_0x4a3a1a){return db[_0xfffe('0x3b')][_0xfffe('0x57')](_0x5d0be1[_0xfffe('0x58')],{})[_0xfffe('0x1e')](respondWithResult(_0x4a3a1a,0xc9))['catch'](handleError(_0x4a3a1a,null));};exports[_0xfffe('0x36')]=function(_0x29af92,_0xbec4d9){if(_0x29af92[_0xfffe('0x58')]['id']){delete _0x29af92['body']['id'];}return db['WhatsappMessage'][_0xfffe('0x56')]({'where':{'id':_0x29af92[_0xfffe('0x55')]['id']}})[_0xfffe('0x1e')](handleEntityNotFound(_0xbec4d9,null))['then'](saveUpdates(_0x29af92[_0xfffe('0x58')],null))['then'](respondWithResult(_0xbec4d9,null))[_0xfffe('0x29')](handleError(_0xbec4d9,null));};exports[_0xfffe('0x59')]=function(_0xa1a7c4,_0x52fbf4){return db[_0xfffe('0x3b')][_0xfffe('0x56')]({'where':{'id':_0xa1a7c4[_0xfffe('0x55')]['id']}})[_0xfffe('0x1e')](handleEntityNotFound(_0x52fbf4,null))[_0xfffe('0x1e')](removeEntity(_0x52fbf4,null))['catch'](handleError(_0x52fbf4,null));};exports['describe']=function(_0x174c0d,_0xd186ed){return db[_0xfffe('0x3b')]['describe']()[_0xfffe('0x1e')](respondWithResult(_0xd186ed,null))[_0xfffe('0x29')](handleError(_0xd186ed,null));};var interaction_log=require(_0xfffe('0x5a'))(_0xfffe('0x5b'));exports['accept']=function(_0x2a6716,_0x1e0094,_0x29c283){var _0x1519d6={'agent':{},'channel':_0xfffe('0x5c')};if(_0x2a6716[_0xfffe('0x58')]['id']){delete _0x2a6716[_0xfffe('0x58')]['id'];}_0x2a6716[_0xfffe('0x58')]['read']=!![];_0x2a6716[_0xfffe('0x58')][_0xfffe('0x5d')]=moment()[_0xfffe('0x5e')](_0xfffe('0x5f'));_0x2a6716[_0xfffe('0x58')][_0xfffe('0x60')]=_0x2a6716[_0xfffe('0x58')]['UserId']||_0x2a6716[_0xfffe('0x61')]['id'];_0x1519d6[_0xfffe('0x62')]['id']=_0x2a6716[_0xfffe('0x58')][_0xfffe('0x60')];return db[_0xfffe('0x3b')][_0xfffe('0x56')]({'where':{'id':_0x2a6716[_0xfffe('0x55')]['id'],'UserId':null}})[_0xfffe('0x1e')](handleEntityNotFound(_0x1e0094,null))[_0xfffe('0x1e')](saveUpdates(_0x2a6716['body'],null))[_0xfffe('0x1e')](function(_0x200197){if(_0x200197){_0x1519d6[_0xfffe('0x27')]=_0x200197[_0xfffe('0x63')]({'plain':!![]});return db[_0xfffe('0x64')]['find']({'where':{'id':_0x200197[_0xfffe('0x65')]}});}return null;})[_0xfffe('0x1e')](handleEntityNotFound(_0x1e0094,null))[_0xfffe('0x1e')](function(_0x34319d){if(_0x34319d){return _0x34319d['update']({'UserId':_0x2a6716[_0xfffe('0x58')][_0xfffe('0x60')],'read1stAt':_['isNil'](_0x34319d[_0xfffe('0x66')])?moment()[_0xfffe('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1cb779){if(_0x1cb779){_0x1519d6[_0xfffe('0x67')]=_0x1cb779['get']({'plain':!![]});interaction_log[_0xfffe('0x1f')](_0xfffe('0x68'),_0x2a6716[_0xfffe('0x61')]['id'],_0x2a6716[_0xfffe('0x61')][_0xfffe('0x38')],_0x2a6716[_0xfffe('0x61')][_0xfffe('0x69')],_0x1519d6[_0xfffe('0x67')]['id'],_0x2a6716[_0xfffe('0x58')]?JSON[_0xfffe('0x24')](_0x2a6716[_0xfffe('0x58')]):_0xfffe('0x6a'));return respondWithRpcPromise(_0xfffe('0x6b'),_0xfffe('0x6c'),_0x1519d6);}return null;})[_0xfffe('0x1e')](function(_0x1e26b8){var _0xfe689a=_0xfffe('0x6d')+_0x1e26b8['message'][_0xfffe('0x6e')];return db['sequelize'][_0xfffe('0x40')](_0xfe689a,{'type':db[_0xfffe('0x6f')][_0xfffe('0x70')][_0xfffe('0x71')],'raw':!![]})[_0xfffe('0x1e')](function(_0x25f57f){return _0x25f57f;});})['then'](function(_0x1fb712){if(_0x1fb712){_0x1519d6[_0xfffe('0x27')][_0xfffe('0x72')]=_0x1fb712[0x0];if(!_0x2a6716['body'][_0xfffe('0x60')])return;return db[_0xfffe('0x73')][_0xfffe('0x56')]({'where':{'id':_0x2a6716['body']['UserId'],'role':_0xfffe('0x62')},'attributes':['id','name','fullname',_0xfffe('0x74'),_0xfffe('0x75')],'raw':!![]});}return null;})['then'](function(_0x58228b){if(!_0x58228b)return null;_0x1519d6[_0xfffe('0x27')][_0xfffe('0x62')]=_0x58228b;return _0x1519d6;})[_0xfffe('0x1e')](function(_0x57e4fe){if(_0x57e4fe){if(_0x2a6716['body']['manual']){_0x1519d6['message']['interface']=util['format'](_0xfffe('0x76'),_0x2a6716[_0xfffe('0x61')][_0xfffe('0x38')]);_0x1519d6['message'][_0xfffe('0x77')]=_0x1519d6['channel'];_0x1519d6['message'][_0xfffe('0x78')]=_0x1519d6[_0xfffe('0x77')];_0x1519d6[_0xfffe('0x27')]['event']=_0xfffe('0x79');return respondWithRpcPromise('EventManager',_0xfffe('0x7a'),{'event':_0xfffe('0x7b'),'message':_0x1519d6[_0xfffe('0x27')]},client9002)['then'](function(){return _0x1519d6;});}return _0x1519d6;}return null;})[_0xfffe('0x1e')](respondWithResult(_0x1e0094,null))[_0xfffe('0x29')](handleError(_0x1e0094,null));};var interaction_log=require(_0xfffe('0x5a'))(_0xfffe('0x5b'));exports[_0xfffe('0x34')]=function(_0x10f72f,_0x59bb82,_0x46643e){var _0x1dc955={'agent':{},'channel':_0xfffe('0x5c')};if(_0x10f72f[_0xfffe('0x58')]['id']){delete _0x10f72f[_0xfffe('0x58')]['id'];}_0x10f72f[_0xfffe('0x58')][_0xfffe('0x60')]=_0x10f72f['body'][_0xfffe('0x60')]||_0x10f72f['user']['id'];_0x1dc955[_0xfffe('0x62')]['id']=_0x10f72f[_0xfffe('0x58')]['UserId'];return db[_0xfffe('0x3b')][_0xfffe('0x56')]({'where':{'id':_0x10f72f[_0xfffe('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59bb82,null))[_0xfffe('0x1e')](function(_0x409952){if(_0x409952){_0x1dc955[_0xfffe('0x27')]=_0x409952['get']({'plain':!![]});return db[_0xfffe('0x64')][_0xfffe('0x56')]({'where':{'id':_0x409952[_0xfffe('0x65')]}});}return null;})[_0xfffe('0x1e')](handleEntityNotFound(_0x59bb82,null))[_0xfffe('0x1e')](function(_0x5af0d1){if(_0x5af0d1){_0x1dc955['interaction']=_0x5af0d1[_0xfffe('0x63')]({'plain':!![]});interaction_log[_0xfffe('0x1f')](_0xfffe('0x7c'),_0x10f72f[_0xfffe('0x61')]['id'],_0x10f72f[_0xfffe('0x61')]['name'],_0x10f72f[_0xfffe('0x61')][_0xfffe('0x69')],_0x1dc955['interaction']['id'],_0x10f72f['body']?JSON[_0xfffe('0x24')](_0x10f72f[_0xfffe('0x58')]):'null');return respondWithRpcPromise(_0xfffe('0x7d'),_0xfffe('0x7e'),_0x1dc955);}return null;})[_0xfffe('0x1e')](function(_0x521a41){var _0x3580ef=_0xfffe('0x6d')+_0x521a41[_0xfffe('0x27')][_0xfffe('0x6e')];return db['sequelize'][_0xfffe('0x40')](_0x3580ef,{'type':db['Sequelize'][_0xfffe('0x70')][_0xfffe('0x71')],'raw':!![]})[_0xfffe('0x1e')](function(_0x30d717){return _0x30d717;});})['then'](function(_0x18fb3e){if(_0x18fb3e){_0x1dc955[_0xfffe('0x27')][_0xfffe('0x72')]=_0x18fb3e[0x0];if(!_0x10f72f[_0xfffe('0x58')]['UserId'])return;return db[_0xfffe('0x73')][_0xfffe('0x56')]({'where':{'id':_0x10f72f['body'][_0xfffe('0x60')],'role':'agent'},'attributes':['id',_0xfffe('0x38'),_0xfffe('0x7f'),_0xfffe('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x17c272){if(!_0x17c272)return null;_0x1dc955['message'][_0xfffe('0x62')]=_0x17c272;return _0x1dc955;})[_0xfffe('0x1e')](function(_0x144a47){if(_0x144a47){_0x144a47[_0xfffe('0x27')]['interface']=util[_0xfffe('0x5e')](_0xfffe('0x76'),_0x10f72f[_0xfffe('0x61')][_0xfffe('0x38')]);_0x144a47[_0xfffe('0x27')]['channel']=_0x1dc955[_0xfffe('0x77')];_0x144a47[_0xfffe('0x27')][_0xfffe('0x78')]=_0x1dc955[_0xfffe('0x77')];_0x144a47['message']['event']=_0xfffe('0x34');respondWithRpcPromise(_0xfffe('0x7a'),_0xfffe('0x7a'),{'event':'rejectmessage','message':_0x144a47['message']},client9002);return _0x1dc955;}return null;})[_0xfffe('0x1e')](respondWithResult(_0x59bb82,null))[_0xfffe('0x29')](handleError(_0x59bb82,null));};exports[_0xfffe('0x2b')]=function(_0x4f68eb,_0x332145,_0xcb3e){if(_0x4f68eb['body']['id']){delete _0x4f68eb[_0xfffe('0x58')]['id'];}var _0x16f7d9;return db[_0xfffe('0x3b')][_0xfffe('0x56')]({'where':{'id':_0x4f68eb[_0xfffe('0x55')]['id']}})[_0xfffe('0x1e')](handleEntityNotFound(_0x332145,null))['then'](function(_0x55c2af){if(_0x55c2af){_0x16f7d9=_0x55c2af;return db[_0xfffe('0x80')]['find']({'where':{'id':_0x55c2af['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x332145,null))[_0xfffe('0x1e')](function(_0x30f9c4){if(_0x30f9c4){logger[_0xfffe('0x21')](_0xfffe('0x81'),'status',_0xfffe('0x82'),_0x30f9c4[_0xfffe('0x4c')],util['inspect'](_0x4f68eb['body'],{'showHidden':![],'depth':null}));switch(_0x30f9c4[_0xfffe('0x4c')]){case _0xfffe('0x83'):if(_0x4f68eb[_0xfffe('0x58')][_0xfffe('0x84')]&&_0x4f68eb[_0xfffe('0x58')][_0xfffe('0x84')]===_0x16f7d9['messageId']&&_0x4f68eb[_0xfffe('0x58')][_0xfffe('0x85')]&&_0x4f68eb[_0xfffe('0x58')][_0xfffe('0x85')]===_0xfffe('0x86')){return _0x16f7d9[_0xfffe('0x36')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xfffe('0x2b'),'twilio',util['inspect'](_0x4f68eb[_0xfffe('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x16f7d9;}})[_0xfffe('0x1e')](respondWithResult(_0x332145,null))[_0xfffe('0x29')](handleError(_0x332145,null));}; \ No newline at end of file +var _0x9852=['fields','length','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','intersection','options','catch','body','find','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','sequelize','Sequelize','contact','interface','SIP/%s','params','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','inspect','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','count','apply','save','update','destroy','stack','name','send','map','WhatsappMessage','type','key','model','query','keys','attributes'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x9852,0xcb));var _0x2985=function(_0x3d0fa1,_0xd57cd6){_0x3d0fa1=_0x3d0fa1-0x0;var _0x4660bc=_0x9852[_0x3d0fa1];return _0x4660bc;};'use strict';var emlformat=require(_0x2985('0x0'));var rimraf=require(_0x2985('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2985('0x2'));var moment=require(_0x2985('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2985('0x4'));var util=require(_0x2985('0x5'));var path=require(_0x2985('0x6'));var sox=require(_0x2985('0x7'));var csv=require(_0x2985('0x8'));var ejs=require(_0x2985('0x9'));var fs=require('fs');var fs_extra=require(_0x2985('0xa'));var _=require(_0x2985('0xb'));var squel=require('squel');var crypto=require(_0x2985('0xc'));var jsforce=require(_0x2985('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2985('0x8'));var querystring=require(_0x2985('0xe'));var Papa=require(_0x2985('0xf'));var Redis=require(_0x2985('0x10'));var authService=require(_0x2985('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2985('0x12'));var logger=require(_0x2985('0x13'))('api');var utils=require(_0x2985('0x14'));var config=require(_0x2985('0x15'));var licenseUtil=require(_0x2985('0x16'));var db=require(_0x2985('0x17'))['db'];config[_0x2985('0x18')]=_[_0x2985('0x19')](config['redis'],{'host':_0x2985('0x1a'),'port':0x18eb});var socket=require(_0x2985('0x1b'))(new Redis(config[_0x2985('0x18')]));require(_0x2985('0x1c'))[_0x2985('0x1d')](socket);var jayson=require(_0x2985('0x1e'));var client=jayson[_0x2985('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x2985('0x1f')][_0x2985('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5405ea,_0x1e9b43,_0x238a28,_0xdfc8b2){return new BPromise(function(_0x226882,_0x4d645a){var _0x80f7ee=_0xdfc8b2||client;return _0x80f7ee['request'](_0x5405ea,_0x238a28)[_0x2985('0x21')](function(_0x47492f){logger[_0x2985('0x22')](_0x2985('0x23'),_0x1e9b43,_0x2985('0x24'));logger['debug'](_0x2985('0x25'),_0x1e9b43,_0x2985('0x24'),JSON[_0x2985('0x26')](_0x47492f));if(_0x47492f[_0x2985('0x27')]){if(_0x47492f[_0x2985('0x27')][_0x2985('0x28')]===0x1f4){logger[_0x2985('0x27')](_0x2985('0x23'),_0x1e9b43,_0x47492f[_0x2985('0x27')]['message']);return _0x4d645a(_0x47492f['error'][_0x2985('0x29')]);}logger[_0x2985('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1e9b43,_0x47492f[_0x2985('0x27')][_0x2985('0x29')]);return _0x226882(_0x47492f[_0x2985('0x27')][_0x2985('0x29')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1e9b43,_0x2985('0x24'));_0x226882(_0x47492f[_0x2985('0x2a')][_0x2985('0x29')]);}})['catch'](function(_0x1d34df){logger[_0x2985('0x27')](_0x2985('0x23'),_0x1e9b43,_0x1d34df);_0x4d645a(_0x1d34df);});});}function respondWithStatusCode(_0x441190,_0x255255){_0x255255=_0x255255||0xcc;return function(_0x507dfa){if(_0x507dfa){return _0x441190[_0x2985('0x2b')](_0x255255);}return _0x441190[_0x2985('0x2c')](_0x255255)[_0x2985('0x2d')]();};}function respondWithResult(_0x54b9a5,_0x1cf518){_0x1cf518=_0x1cf518||0xc8;return function(_0x48fb43){if(_0x48fb43){return _0x54b9a5[_0x2985('0x2c')](_0x1cf518)[_0x2985('0x2e')](_0x48fb43);}};}function respondWithFilteredResult(_0x485ad7,_0x32a0c5){return function(_0x3bac1d){if(_0x3bac1d){var _0xa78b39=typeof _0x32a0c5[_0x2985('0x2f')]==='undefined'&&typeof _0x32a0c5[_0x2985('0x30')]==='undefined';var _0x152305=_0x3bac1d[_0x2985('0x31')];var _0x312c57=_0xa78b39?0x0:_0x32a0c5[_0x2985('0x2f')];var _0x1fa03a=_0xa78b39?_0x3bac1d[_0x2985('0x31')]:_0x32a0c5[_0x2985('0x2f')]+_0x32a0c5[_0x2985('0x30')];var _0x5bad09;if(_0x1fa03a>=_0x152305){_0x1fa03a=_0x152305;_0x5bad09=0xc8;}else{_0x5bad09=0xce;}_0x485ad7[_0x2985('0x2c')](_0x5bad09);return _0x485ad7['set']('Content-Range',_0x312c57+'-'+_0x1fa03a+'/'+_0x152305)['json'](_0x3bac1d);}return null;};}function patchUpdates(_0x526e98){return function(_0x14b520){try{jsonpatch[_0x2985('0x32')](_0x14b520,_0x526e98,!![]);}catch(_0x344715){return BPromise['reject'](_0x344715);}return _0x14b520[_0x2985('0x33')]();};}function saveUpdates(_0x4efc39,_0x52a77e){return function(_0x507956){if(_0x507956){return _0x507956[_0x2985('0x34')](_0x4efc39)[_0x2985('0x21')](function(_0x355bdc){return _0x355bdc;});}return null;};}function removeEntity(_0x2fc058,_0x134a4b){return function(_0x34445f){if(_0x34445f){return _0x34445f[_0x2985('0x35')]()[_0x2985('0x21')](function(){_0x2fc058[_0x2985('0x2c')](0xcc)[_0x2985('0x2d')]();});}};}function handleEntityNotFound(_0x264ea5,_0x414cb1){return function(_0x1c30e5){if(!_0x1c30e5){_0x264ea5[_0x2985('0x2b')](0x194);}return _0x1c30e5;};}function handleError(_0x524745,_0x3cdc0e){_0x3cdc0e=_0x3cdc0e||0x1f4;return function(_0x49e75e){logger[_0x2985('0x27')](_0x49e75e[_0x2985('0x36')]);if(_0x49e75e[_0x2985('0x37')]){delete _0x49e75e[_0x2985('0x37')];}_0x524745[_0x2985('0x2c')](_0x3cdc0e)[_0x2985('0x38')](_0x49e75e);};}exports['index']=function(_0x2261a1,_0xab995c){var _0x55c486={},_0x456e90={},_0x42839b={'count':0x0,'rows':[]};var _0x2c919e=_[_0x2985('0x39')](db[_0x2985('0x3a')]['rawAttributes'],function(_0x5a588d){return{'name':_0x5a588d['fieldName'],'type':_0x5a588d[_0x2985('0x3b')][_0x2985('0x3c')]};});_0x456e90[_0x2985('0x3d')]=_[_0x2985('0x39')](_0x2c919e,_0x2985('0x37'));_0x456e90[_0x2985('0x3e')]=_[_0x2985('0x3f')](_0x2261a1['query']);_0x456e90['filters']=_['intersection'](_0x456e90[_0x2985('0x3d')],_0x456e90[_0x2985('0x3e')]);_0x55c486[_0x2985('0x40')]=_['intersection'](_0x456e90[_0x2985('0x3d')],qs['fields'](_0x2261a1[_0x2985('0x3e')][_0x2985('0x41')]));_0x55c486[_0x2985('0x40')]=_0x55c486[_0x2985('0x40')][_0x2985('0x42')]?_0x55c486[_0x2985('0x40')]:_0x456e90[_0x2985('0x3d')];if(!_0x2261a1[_0x2985('0x3e')]['hasOwnProperty']('nolimit')){_0x55c486[_0x2985('0x30')]=qs['limit'](_0x2261a1['query'][_0x2985('0x30')]);_0x55c486[_0x2985('0x2f')]=qs[_0x2985('0x2f')](_0x2261a1[_0x2985('0x3e')][_0x2985('0x2f')]);}_0x55c486['order']=qs[_0x2985('0x43')](_0x2261a1[_0x2985('0x3e')][_0x2985('0x43')]);_0x55c486['where']=qs[_0x2985('0x44')](_[_0x2985('0x45')](_0x2261a1[_0x2985('0x3e')],_0x456e90['filters']),_0x2c919e);if(_0x2261a1['query'][_0x2985('0x46')]){_0x55c486[_0x2985('0x47')]=_[_0x2985('0x48')](_0x55c486[_0x2985('0x47')],{'$or':_[_0x2985('0x39')](_0x2c919e,function(_0x4ce77e){if(_0x4ce77e[_0x2985('0x3b')]!==_0x2985('0x49')){var _0x29f7c2={};_0x29f7c2[_0x4ce77e['name']]={'$like':'%'+_0x2261a1[_0x2985('0x3e')][_0x2985('0x46')]+'%'};return _0x29f7c2;}})});}_0x55c486=_[_0x2985('0x48')]({},_0x55c486,_0x2261a1['options']);var _0x18bc0b={'where':_0x55c486[_0x2985('0x47')]};return db[_0x2985('0x3a')][_0x2985('0x31')](_0x18bc0b)[_0x2985('0x21')](function(_0x5d50f4){_0x42839b[_0x2985('0x31')]=_0x5d50f4;if(_0x2261a1[_0x2985('0x3e')][_0x2985('0x4a')]){_0x55c486[_0x2985('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x2985('0x4c')](_0x55c486);})[_0x2985('0x21')](function(_0x4ba3a4){_0x42839b[_0x2985('0x4d')]=_0x4ba3a4;return _0x42839b;})['then'](respondWithFilteredResult(_0xab995c,_0x55c486))['catch'](handleError(_0xab995c,null));};exports[_0x2985('0x4e')]=function(_0x49aec4,_0x235b8b){var _0x38f0be={'raw':!![],'where':{'id':_0x49aec4['params']['id']}},_0x146793={};_0x146793[_0x2985('0x3d')]=_['keys'](db['WhatsappMessage'][_0x2985('0x4f')]);_0x146793['query']=_[_0x2985('0x3f')](_0x49aec4[_0x2985('0x3e')]);_0x146793['filters']=_['intersection'](_0x146793['model'],_0x146793[_0x2985('0x3e')]);_0x38f0be['attributes']=_[_0x2985('0x50')](_0x146793[_0x2985('0x3d')],qs['fields'](_0x49aec4[_0x2985('0x3e')][_0x2985('0x41')]));_0x38f0be[_0x2985('0x40')]=_0x38f0be[_0x2985('0x40')]['length']?_0x38f0be[_0x2985('0x40')]:_0x146793[_0x2985('0x3d')];if(_0x49aec4[_0x2985('0x3e')]['includeAll']){_0x38f0be['include']=[{'all':!![]}];}_0x38f0be=_[_0x2985('0x48')]({},_0x38f0be,_0x49aec4[_0x2985('0x51')]);return db['WhatsappMessage']['find'](_0x38f0be)['then'](handleEntityNotFound(_0x235b8b,null))[_0x2985('0x21')](respondWithResult(_0x235b8b,null))[_0x2985('0x52')](handleError(_0x235b8b,null));};exports['create']=function(_0x427830,_0x50638c){return db[_0x2985('0x3a')]['create'](_0x427830[_0x2985('0x53')],{})['then'](respondWithResult(_0x50638c,0xc9))[_0x2985('0x52')](handleError(_0x50638c,null));};exports[_0x2985('0x34')]=function(_0x57b47d,_0x37d335){if(_0x57b47d[_0x2985('0x53')]['id']){delete _0x57b47d['body']['id'];}return db['WhatsappMessage'][_0x2985('0x54')]({'where':{'id':_0x57b47d['params']['id']}})[_0x2985('0x21')](handleEntityNotFound(_0x37d335,null))[_0x2985('0x21')](saveUpdates(_0x57b47d['body'],null))[_0x2985('0x21')](respondWithResult(_0x37d335,null))['catch'](handleError(_0x37d335,null));};exports['destroy']=function(_0x3cae79,_0x10eab7){return db[_0x2985('0x3a')][_0x2985('0x54')]({'where':{'id':_0x3cae79['params']['id']}})[_0x2985('0x21')](handleEntityNotFound(_0x10eab7,null))[_0x2985('0x21')](removeEntity(_0x10eab7,null))[_0x2985('0x52')](handleError(_0x10eab7,null));};exports['describe']=function(_0x2f93de,_0x52cdbc){return db[_0x2985('0x3a')]['describe']()['then'](respondWithResult(_0x52cdbc,null))[_0x2985('0x52')](handleError(_0x52cdbc,null));};var interaction_log=require('../../config/logger')(_0x2985('0x55'));exports[_0x2985('0x56')]=function(_0x68143a,_0x1917bd,_0x15926c){var _0x18eadb={'agent':{},'channel':'whatsapp'};if(_0x68143a[_0x2985('0x53')]['id']){delete _0x68143a['body']['id'];}_0x68143a[_0x2985('0x53')][_0x2985('0x57')]=!![];_0x68143a[_0x2985('0x53')][_0x2985('0x58')]=moment()['format'](_0x2985('0x59'));_0x68143a['body'][_0x2985('0x5a')]=_0x68143a[_0x2985('0x53')][_0x2985('0x5a')]||_0x68143a[_0x2985('0x5b')]['id'];_0x18eadb[_0x2985('0x5c')]['id']=_0x68143a[_0x2985('0x53')][_0x2985('0x5a')];return db[_0x2985('0x3a')][_0x2985('0x54')]({'where':{'id':_0x68143a['params']['id'],'UserId':null}})[_0x2985('0x21')](handleEntityNotFound(_0x1917bd,null))[_0x2985('0x21')](saveUpdates(_0x68143a[_0x2985('0x53')],null))[_0x2985('0x21')](function(_0x742187){if(_0x742187){_0x18eadb['message']=_0x742187[_0x2985('0x5d')]({'plain':!![]});return db[_0x2985('0x5e')][_0x2985('0x54')]({'where':{'id':_0x742187[_0x2985('0x5f')]}});}return null;})[_0x2985('0x21')](handleEntityNotFound(_0x1917bd,null))[_0x2985('0x21')](function(_0x5862ef){if(_0x5862ef){return _0x5862ef[_0x2985('0x34')]({'UserId':_0x68143a[_0x2985('0x53')][_0x2985('0x5a')],'read1stAt':_['isNil'](_0x5862ef[_0x2985('0x60')])?moment()[_0x2985('0x61')](_0x2985('0x59')):undefined});}return null;})[_0x2985('0x21')](function(_0x278ece){if(_0x278ece){_0x18eadb['interaction']=_0x278ece[_0x2985('0x5d')]({'plain':!![]});interaction_log[_0x2985('0x22')](_0x2985('0x62'),_0x68143a[_0x2985('0x5b')]['id'],_0x68143a[_0x2985('0x5b')]['name'],_0x68143a[_0x2985('0x5b')][_0x2985('0x63')],_0x18eadb[_0x2985('0x64')]['id'],_0x68143a[_0x2985('0x53')]?JSON[_0x2985('0x26')](_0x68143a[_0x2985('0x53')]):_0x2985('0x65'));return respondWithRpcPromise('AcceptMessage',_0x2985('0x66'),_0x18eadb);}return null;})[_0x2985('0x21')](function(_0x3d18e8){var _0x3a6c67=_0x2985('0x67')+_0x3d18e8['message'][_0x2985('0x68')];return db['sequelize'][_0x2985('0x3e')](_0x3a6c67,{'type':db['Sequelize'][_0x2985('0x69')][_0x2985('0x6a')],'raw':!![]})[_0x2985('0x21')](function(_0x5b3979){return _0x5b3979;});})[_0x2985('0x21')](function(_0x1cd444){if(_0x1cd444){_0x18eadb['message']['contact']=_0x1cd444[0x0];if(!_0x68143a[_0x2985('0x53')][_0x2985('0x5a')])return;return db[_0x2985('0x6b')][_0x2985('0x54')]({'where':{'id':_0x68143a[_0x2985('0x53')][_0x2985('0x5a')],'role':_0x2985('0x5c')},'attributes':['id',_0x2985('0x37'),_0x2985('0x6c'),_0x2985('0x6d'),_0x2985('0x6e')],'raw':!![]});}return null;})[_0x2985('0x21')](function(_0x58efc7){if(!_0x58efc7)return null;_0x18eadb[_0x2985('0x29')][_0x2985('0x5c')]=_0x58efc7;return _0x18eadb;})[_0x2985('0x21')](function(_0x907eec){if(_0x907eec){if(_0x68143a['body'][_0x2985('0x6f')]){_0x18eadb[_0x2985('0x29')]['interface']=util['format']('SIP/%s',_0x68143a[_0x2985('0x5b')][_0x2985('0x37')]);_0x18eadb[_0x2985('0x29')][_0x2985('0x70')]=_0x18eadb[_0x2985('0x70')];_0x18eadb[_0x2985('0x29')][_0x2985('0x71')]=_0x18eadb[_0x2985('0x70')];_0x18eadb[_0x2985('0x29')][_0x2985('0x72')]=_0x2985('0x56');return respondWithRpcPromise(_0x2985('0x73'),'EventManager',{'event':_0x2985('0x74'),'message':_0x18eadb['message']},client9002)[_0x2985('0x21')](function(){return _0x18eadb;});}return _0x18eadb;}return null;})[_0x2985('0x21')](respondWithResult(_0x1917bd,null))[_0x2985('0x52')](handleError(_0x1917bd,null));};var interaction_log=require(_0x2985('0x13'))(_0x2985('0x55'));exports[_0x2985('0x75')]=function(_0x2ea732,_0x978dfa,_0x344bd5){var _0x5e3877={'agent':{},'channel':'whatsapp'};if(_0x2ea732['body']['id']){delete _0x2ea732[_0x2985('0x53')]['id'];}_0x2ea732[_0x2985('0x53')][_0x2985('0x5a')]=_0x2ea732[_0x2985('0x53')][_0x2985('0x5a')]||_0x2ea732['user']['id'];_0x5e3877[_0x2985('0x5c')]['id']=_0x2ea732['body'][_0x2985('0x5a')];return db[_0x2985('0x3a')][_0x2985('0x54')]({'where':{'id':_0x2ea732['params']['id'],'UserId':null}})[_0x2985('0x21')](handleEntityNotFound(_0x978dfa,null))[_0x2985('0x21')](function(_0x515aec){if(_0x515aec){_0x5e3877[_0x2985('0x29')]=_0x515aec[_0x2985('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0x2985('0x54')]({'where':{'id':_0x515aec[_0x2985('0x5f')]}});}return null;})[_0x2985('0x21')](handleEntityNotFound(_0x978dfa,null))[_0x2985('0x21')](function(_0x1b379a){if(_0x1b379a){_0x5e3877[_0x2985('0x64')]=_0x1b379a[_0x2985('0x5d')]({'plain':!![]});interaction_log[_0x2985('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ea732[_0x2985('0x5b')]['id'],_0x2ea732[_0x2985('0x5b')][_0x2985('0x37')],_0x2ea732[_0x2985('0x5b')][_0x2985('0x63')],_0x5e3877[_0x2985('0x64')]['id'],_0x2ea732[_0x2985('0x53')]?JSON[_0x2985('0x26')](_0x2ea732[_0x2985('0x53')]):_0x2985('0x65'));return respondWithRpcPromise(_0x2985('0x76'),_0x2985('0x77'),_0x5e3877);}return null;})['then'](function(_0x5dcf68){var _0xe73daf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dcf68[_0x2985('0x29')][_0x2985('0x68')];return db[_0x2985('0x78')][_0x2985('0x3e')](_0xe73daf,{'type':db[_0x2985('0x79')][_0x2985('0x69')]['SELECT'],'raw':!![]})[_0x2985('0x21')](function(_0x4f5676){return _0x4f5676;});})[_0x2985('0x21')](function(_0x2732aa){if(_0x2732aa){_0x5e3877[_0x2985('0x29')][_0x2985('0x7a')]=_0x2732aa[0x0];if(!_0x2ea732[_0x2985('0x53')]['UserId'])return;return db[_0x2985('0x6b')][_0x2985('0x54')]({'where':{'id':_0x2ea732[_0x2985('0x53')]['UserId'],'role':_0x2985('0x5c')},'attributes':['id',_0x2985('0x37'),'fullname',_0x2985('0x6d'),_0x2985('0x6e')],'raw':!![]});}return null;})[_0x2985('0x21')](function(_0x1314cf){if(!_0x1314cf)return null;_0x5e3877[_0x2985('0x29')][_0x2985('0x5c')]=_0x1314cf;return _0x5e3877;})[_0x2985('0x21')](function(_0x35e349){if(_0x35e349){_0x35e349[_0x2985('0x29')][_0x2985('0x7b')]=util[_0x2985('0x61')](_0x2985('0x7c'),_0x2ea732[_0x2985('0x5b')]['name']);_0x35e349[_0x2985('0x29')][_0x2985('0x70')]=_0x5e3877[_0x2985('0x70')];_0x35e349[_0x2985('0x29')][_0x2985('0x71')]=_0x5e3877[_0x2985('0x70')];_0x35e349[_0x2985('0x29')][_0x2985('0x72')]=_0x2985('0x75');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x35e349['message']},client9002);return _0x5e3877;}return null;})['then'](respondWithResult(_0x978dfa,null))['catch'](handleError(_0x978dfa,null));};exports[_0x2985('0x2c')]=function(_0x114e51,_0x438b40,_0x23fec1){if(_0x114e51['body']['id']){delete _0x114e51[_0x2985('0x53')]['id'];}var _0xec9391;return db[_0x2985('0x3a')][_0x2985('0x54')]({'where':{'id':_0x114e51[_0x2985('0x7d')]['id']}})[_0x2985('0x21')](handleEntityNotFound(_0x438b40,null))[_0x2985('0x21')](function(_0x13800f){if(_0x13800f){_0xec9391=_0x13800f;return db[_0x2985('0x7e')]['find']({'where':{'id':_0x13800f[_0x2985('0x7f')]}});}})[_0x2985('0x21')](handleEntityNotFound(_0x438b40,null))[_0x2985('0x21')](function(_0x538889){if(_0x538889){logger['debug'](_0x2985('0x80'),'status','received\x20delivery\x20report\x20from',_0x538889[_0x2985('0x3b')],util['inspect'](_0x114e51[_0x2985('0x53')],{'showHidden':![],'depth':null}));switch(_0x538889[_0x2985('0x3b')]){case _0x2985('0x81'):if(_0x114e51[_0x2985('0x53')][_0x2985('0x82')]&&_0x114e51['body'][_0x2985('0x82')]===_0xec9391[_0x2985('0x83')]&&_0x114e51[_0x2985('0x53')][_0x2985('0x84')]&&_0x114e51[_0x2985('0x53')]['MessageStatus']==='read'){return _0xec9391[_0x2985('0x34')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x2985('0x85')](_0x114e51['body'],{'showHidden':![],'depth':null}));}break;}return _0xec9391;}})[_0x2985('0x21')](respondWithResult(_0x438b40,null))[_0x2985('0x52')](handleError(_0x438b40,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 70cf3bf..9af94da 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 _0xd547=['hook','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xa1e2fd,_0x1c9305){var _0x218880=function(_0x405167){while(--_0x405167){_0xa1e2fd['push'](_0xa1e2fd['shift']());}};_0x218880(++_0x1c9305);}(_0xd547,0x1c1));var _0x7d54=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0xd547[_0x526046];return _0x5b92a2;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7d54('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){WhatsappMessageEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);WhatsappMessageEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];WhatsappMessage[_0x7d54('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9b87=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e2eaf,_0x553b77){var _0x5ea4fa=function(_0x4e63b7){while(--_0x4e63b7){_0x2e2eaf['push'](_0x2e2eaf['shift']());}};_0x5ea4fa(++_0x553b77);}(_0x9b87,0x8e));var _0x79b8=function(_0x1254ad,_0xbc87b1){_0x1254ad=_0x1254ad-0x0;var _0x403683=_0x9b87[_0x1254ad];return _0x403683;};'use strict';var EventEmitter=require(_0x79b8('0x0'));var WhatsappMessage=require(_0x79b8('0x1'))['db'][_0x79b8('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x79b8('0x3')](0x0);var events={'afterCreate':_0x79b8('0x4'),'afterUpdate':_0x79b8('0x5'),'afterDestroy':_0x79b8('0x6')};function emitEvent(_0xb4e3e7){return function(_0xbc1e74,_0xa65bbc,_0x1f9679){WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7+':'+_0xbc1e74['id'],_0xbc1e74);WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7,_0xbc1e74);_0x1f9679(null);};}for(var e in events){if(events[_0x79b8('0x8')](e)){var event=events[e];WhatsappMessage[_0x79b8('0x9')](e,emitEvent(event));}}module[_0x79b8('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 df341cc..ae1729a 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 _0xdc82=['authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','update','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','findOne','WhatsappInteractionId','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid'];(function(_0x3fb560,_0x1e301f){var _0x4999b3=function(_0x4ad22e){while(--_0x4ad22e){_0x3fb560['push'](_0x3fb560['shift']());}};_0x4999b3(++_0x1e301f);}(_0xdc82,0x104));var _0x2dc8=function(_0x551433,_0x1d982a){_0x551433=_0x551433-0x0;var _0x2f2d5b=_0xdc82[_0x551433];return _0x2f2d5b;};'use strict';var _=require(_0x2dc8('0x0'));var util=require(_0x2dc8('0x1'));var logger=require(_0x2dc8('0x2'))('api');var moment=require(_0x2dc8('0x3'));var BPromise=require(_0x2dc8('0x4'));var rp=require(_0x2dc8('0x5'));var fetch=require(_0x2dc8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dc8('0x7'));var attributes=require(_0x2dc8('0x8'));module[_0x2dc8('0x9')]=function(_0x39cc09,_0x41076b){return _0x39cc09[_0x2dc8('0xa')]('WhatsappMessage',attributes,{'tableName':_0x2dc8('0xb'),'paranoid':![],'indexes':[{'name':_0x2dc8('0xc'),'fields':[_0x2dc8('0xc')]},{'name':_0x2dc8('0xd'),'fields':[_0x2dc8('0xe')],'type':_0x2dc8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cbaef,_0x3d2f01,_0x3b92a9){var _0x554b6b=_0x39cc09[_0x2dc8('0x10')];var _0x193561=_0x3cbaef[_0x2dc8('0x11')]({'plain':!![]});if(_0x193561['direction'][_0x2dc8('0x12')]()==='in'||_0x193561[_0x2dc8('0x13')]['toLowerCase']()===_0x2dc8('0x14')&&!_0x193561['secret']&&!_[_0x2dc8('0x15')](_0x193561['UserId'])){_0x554b6b['WhatsappInteraction'][_0x2dc8('0x16')]({'where':{'id':_0x193561[_0x2dc8('0x17')]}})['then'](function(_0x5ae05a){if(_0x5ae05a){_0x5ae05a['update']({'lastMsgAt':_0x193561['createdAt'],'lastMsgDirection':_0x193561[_0x2dc8('0x13')]['toLowerCase']()});}})['catch'](function(_0x5c6941){console['error'](_0x5c6941);});}if(_0x193561[_0x2dc8('0x13')]===_0x2dc8('0x14')&&!_0x193561['secret']){var _0x6f3a78;_0x554b6b[_0x2dc8('0x18')][_0x2dc8('0x19')]({'where':{'id':_0x193561[_0x2dc8('0x1a')]},'raw':!![]})['then'](function(_0x292f6a){_0x6f3a78=_0x292f6a;if(_0x6f3a78&&_0x6f3a78[_0x2dc8('0x1b')]){switch(_0x6f3a78['type']){case _0x2dc8('0x1c'):var _0x24ee8a=require(_0x2dc8('0x1c'));if(_0x6f3a78[_0x2dc8('0x1d')]&&_0x6f3a78[_0x2dc8('0x1e')]&&_0x6f3a78[_0x2dc8('0x1f')]){var _0x4fdec4=new _0x24ee8a(_0x6f3a78[_0x2dc8('0x1d')],_0x6f3a78[_0x2dc8('0x1e')]);_0x4fdec4[_0x2dc8('0x20')][_0x2dc8('0x21')]({'body':_0x193561[_0x2dc8('0xe')],'to':'whatsapp:'+_0x193561[_0x2dc8('0x1f')],'from':_0x2dc8('0x22')+_0x6f3a78[_0x2dc8('0x1f')],'statusCallback':_0x6f3a78['remote']+_0x2dc8('0x23')+_0x193561['id']+_0x2dc8('0x24')+_0x6f3a78[_0x2dc8('0x25')]})[_0x2dc8('0x26')](function(_0x495606){if(_0x495606['sid']){return _0x3cbaef[_0x2dc8('0x27')]({'messageId':_0x495606[_0x2dc8('0x28')]});}})['catch'](function(_0x101d7c){logger[_0x2dc8('0x29')](_0x2dc8('0x2a'),'afterCreate',_0x2dc8('0x1c'),util[_0x2dc8('0x2b')](_0x101d7c,{'showHidden':![],'depth':null}));});}else{logger[_0x2dc8('0x29')](_0x2dc8('0x2a'),_0x2dc8('0x2c'),_0x2dc8('0x1c'),_0x2dc8('0x2d'));}break;case _0x2dc8('0x2e'):var _0x486c92=_0x6f3a78[_0x2dc8('0x1d')];var _0x1a6c73=_0x6f3a78[_0x2dc8('0x1e')];var _0xcf0da5=_0x6f3a78[_0x2dc8('0x2f')]+_0x2dc8('0x30')+_0x486c92+_0x2dc8('0x31');var _0x2f2b99={'to':[_0x193561[_0x2dc8('0x1f')]],'message':{'type':'text','text':_0x193561[_0x2dc8('0xe')]}};var _0x3e7c39={'method':_0x2dc8('0x32'),'uri':_0xcf0da5,'headers':{'Authorization':_0x2dc8('0x33')+_0x1a6c73,'Content-Type':_0x2dc8('0x34')},'body':_0x2f2b99,'json':!![]};rp(_0x3e7c39)['then'](function(_0x16ad07){if(_0x16ad07[_0x2dc8('0x35')][0x0][_0x2dc8('0x36')]){return _0x3cbaef[_0x2dc8('0x27')]({'messageId':_0x16ad07[_0x2dc8('0x35')][0x0][_0x2dc8('0x36')]});}})[_0x2dc8('0x37')](function(_0xe95190){logger[_0x2dc8('0x38')]('WhatsappMessage,\x20%s',_0xe95190);});break;}}})[_0x2dc8('0x39')](function(){_0x3b92a9();});}else{_0x3b92a9();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x880c=['body','phone','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','text','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','find','WhatsappAccountId','then','type','twilio','authToken','accountSid','messages','create'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x880c,0x1bb));var _0xc880=function(_0x3f5677,_0x2f9db7){_0x3f5677=_0x3f5677-0x0;var _0x3cb65b=_0x880c[_0x3f5677];return _0x3cb65b;};'use strict';var _=require(_0xc880('0x0'));var util=require('util');var logger=require(_0xc880('0x1'))('api');var moment=require(_0xc880('0x2'));var BPromise=require(_0xc880('0x3'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0xc880('0x4'));var config=require(_0xc880('0x5'));var attributes=require(_0xc880('0x6'));module[_0xc880('0x7')]=function(_0x5a93e4,_0x1a1672){return _0x5a93e4[_0xc880('0x8')]('WhatsappMessage',attributes,{'tableName':_0xc880('0x9'),'paranoid':![],'indexes':[{'name':_0xc880('0xa'),'fields':[_0xc880('0xa')]},{'name':_0xc880('0xb'),'fields':['body'],'type':_0xc880('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b14db,_0x3ee5cf,_0x9467e5){var _0x24dabf=_0x5a93e4[_0xc880('0xd')];var _0x18d4e5=_0x4b14db['get']({'plain':!![]});if(_0x18d4e5[_0xc880('0xe')][_0xc880('0xf')]()==='in'||_0x18d4e5[_0xc880('0xe')][_0xc880('0xf')]()===_0xc880('0x10')&&!_0x18d4e5[_0xc880('0x11')]&&!_['isNil'](_0x18d4e5['UserId'])){_0x24dabf[_0xc880('0x12')][_0xc880('0x13')]({'where':{'id':_0x18d4e5[_0xc880('0x14')]}})['then'](function(_0x24f227){if(_0x24f227){_0x24f227[_0xc880('0x15')]({'lastMsgAt':_0x18d4e5[_0xc880('0x16')],'lastMsgDirection':_0x18d4e5[_0xc880('0xe')][_0xc880('0xf')]()});}})[_0xc880('0x17')](function(_0x36c802){console[_0xc880('0x18')](_0x36c802);});}if(_0x18d4e5[_0xc880('0xe')]===_0xc880('0x10')&&!_0x18d4e5[_0xc880('0x11')]){var _0x30cbea;_0x24dabf['WhatsappAccount'][_0xc880('0x19')]({'where':{'id':_0x18d4e5[_0xc880('0x1a')]},'raw':!![]})[_0xc880('0x1b')](function(_0x5c56df){_0x30cbea=_0x5c56df;if(_0x30cbea&&_0x30cbea['type']){switch(_0x30cbea[_0xc880('0x1c')]){case'twilio':var _0x26c508=require(_0xc880('0x1d'));if(_0x30cbea['accountSid']&&_0x30cbea[_0xc880('0x1e')]&&_0x30cbea['phone']){var _0x379cdd=new _0x26c508(_0x30cbea[_0xc880('0x1f')],_0x30cbea[_0xc880('0x1e')]);_0x379cdd[_0xc880('0x20')][_0xc880('0x21')]({'body':_0x18d4e5[_0xc880('0x22')],'to':'whatsapp:'+_0x18d4e5[_0xc880('0x23')],'from':'whatsapp:'+_0x30cbea['phone'],'statusCallback':_0x30cbea['remote']+_0xc880('0x24')+_0x18d4e5['id']+_0xc880('0x25')+_0x30cbea['token']})[_0xc880('0x1b')](function(_0x26d518){if(_0x26d518[_0xc880('0x26')]){return _0x4b14db[_0xc880('0x15')]({'messageId':_0x26d518['sid']});}})[_0xc880('0x17')](function(_0x26db24){logger['error'](_0xc880('0x27'),'afterCreate',_0xc880('0x1d'),util[_0xc880('0x28')](_0x26db24,{'showHidden':![],'depth':null}));});}else{logger[_0xc880('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc880('0x29'),_0xc880('0x1d'),_0xc880('0x2a'));}break;case'sinch':var _0x2a117a=_0x30cbea[_0xc880('0x1f')];var _0x3072d8=_0x30cbea['authToken'];var _0xa5f95e=_0x30cbea[_0xc880('0x2b')]+'/whatsapp/v1/'+_0x2a117a+_0xc880('0x2c');var _0x471f0c={'to':[_0x18d4e5['phone']],'message':{'type':_0xc880('0x2d'),'text':_0x18d4e5[_0xc880('0x22')]}};var _0xaa7b87={'method':'POST','uri':_0xa5f95e,'headers':{'Authorization':_0xc880('0x2e')+_0x3072d8,'Content-Type':_0xc880('0x2f')},'body':_0x471f0c,'json':!![]};rp(_0xaa7b87)[_0xc880('0x1b')](function(_0x3aa225){if(_0x3aa225[_0xc880('0x30')][0x0]['message_id']){return _0x4b14db[_0xc880('0x15')]({'messageId':_0x3aa225[_0xc880('0x30')][0x0]['message_id']});}})['catch'](function(_0x40d7f6){logger[_0xc880('0x31')](_0xc880('0x32'),_0x40d7f6);});break;}}})[_0xc880('0x33')](function(){_0x9467e5();});}else{_0x9467e5();}}},'charset':'utf8mb4','collate':_0xc880('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c411e0a..f238d81 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 _0xd52b=['jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','request','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3fb43c,_0x572888){var _0x129d4b=function(_0x18faf2){while(--_0x18faf2){_0x3fb43c['push'](_0x3fb43c['shift']());}};_0x129d4b(++_0x572888);}(_0xd52b,0x157));var _0xbd52=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd52b[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xbd52('0x0'));var util=require(_0xbd52('0x1'));var moment=require(_0xbd52('0x2'));var BPromise=require(_0xbd52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd52('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbd52('0x5'));var client=jayson[_0xbd52('0x6')][_0xbd52('0x7')]({'port':0x232a});config[_0xbd52('0x8')]=_[_0xbd52('0x9')](config[_0xbd52('0x8')],{'host':_0xbd52('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd52('0x8')]));require(_0xbd52('0xb'))['register'](socket);function respondWithRpcPromise(_0x4120fd,_0x164570,_0x171d5b){return new BPromise(function(_0x4f3aca,_0x4b9f13){return client[_0xbd52('0xc')](_0x4120fd,_0x171d5b)['then'](function(_0x35050b){logger['info'](_0xbd52('0xd'),_0x164570,'request\x20sent');logger[_0xbd52('0xe')](_0xbd52('0xf'),_0x164570,'request\x20sent',JSON[_0xbd52('0x10')](_0x35050b));if(_0x35050b[_0xbd52('0x11')]){if(_0x35050b['error'][_0xbd52('0x12')]===0x1f4){logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x164570,_0x35050b[_0xbd52('0x11')]['message']);return _0x4b9f13(_0x35050b[_0xbd52('0x11')][_0xbd52('0x13')]);}logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x164570,_0x35050b[_0xbd52('0x11')][_0xbd52('0x13')]);return _0x4f3aca(_0x35050b[_0xbd52('0x11')][_0xbd52('0x13')]);}else{logger[_0xbd52('0x14')](_0xbd52('0xd'),_0x164570,_0xbd52('0x15'));_0x4f3aca(_0x35050b[_0xbd52('0x16')]['message']);}})[_0xbd52('0x17')](function(_0x2f72fb){logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x164570,_0x2f72fb);_0x4b9f13(_0x2f72fb);});});}exports[_0xbd52('0x18')]=function(_0x11c3f2){var _0x21b33b=this;return new Promise(function(_0x422e97,_0x38ca0c){return db[_0xbd52('0x19')]['create'](_0x11c3f2[_0xbd52('0x1a')],{'raw':_0x11c3f2[_0xbd52('0x1b')]?_0x11c3f2['options'][_0xbd52('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4dea0b){logger['info'](_0xbd52('0x18'),_0x11c3f2);logger[_0xbd52('0xe')](_0xbd52('0x18'),_0x11c3f2,JSON[_0xbd52('0x10')](_0x4dea0b));_0x422e97(_0x4dea0b);})[_0xbd52('0x17')](function(_0x1b6ff9){logger['error'](_0xbd52('0x18'),_0x1b6ff9[_0xbd52('0x13')],_0x11c3f2);_0x38ca0c(_0x21b33b[_0xbd52('0x11')](0x1f4,_0x1b6ff9[_0xbd52('0x13')]));});});}; \ No newline at end of file +var _0xcd26=['client','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','raw','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb28260,_0x48df4b){var _0xe29669=function(_0x29d0c1){while(--_0x29d0c1){_0xb28260['push'](_0xb28260['shift']());}};_0xe29669(++_0x48df4b);}(_0xcd26,0x1a3));var _0x6cd2=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0xcd26[_0x224dda];return _0x2987ac;};'use strict';var _=require(_0x6cd2('0x0'));var util=require(_0x6cd2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6cd2('0x2'));var fs=require('fs');var Redis=require(_0x6cd2('0x3'));var db=require(_0x6cd2('0x4'))['db'];var utils=require(_0x6cd2('0x5'));var logger=require(_0x6cd2('0x6'))(_0x6cd2('0x7'));var config=require(_0x6cd2('0x8'));var jayson=require(_0x6cd2('0x9'));var client=jayson[_0x6cd2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6cd2('0xb')](config[_0x6cd2('0xc')],{'host':_0x6cd2('0xd'),'port':0x18eb});var socket=require(_0x6cd2('0xe'))(new Redis(config['redis']));require(_0x6cd2('0xf'))['register'](socket);function respondWithRpcPromise(_0xfe9f9a,_0x2e7cf3,_0x282c76){return new BPromise(function(_0x246404,_0x1ce9cc){return client[_0x6cd2('0x10')](_0xfe9f9a,_0x282c76)[_0x6cd2('0x11')](function(_0x3e8bba){logger[_0x6cd2('0x12')](_0x6cd2('0x13'),_0x2e7cf3,_0x6cd2('0x14'));logger[_0x6cd2('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2e7cf3,'request\x20sent',JSON['stringify'](_0x3e8bba));if(_0x3e8bba[_0x6cd2('0x16')]){if(_0x3e8bba['error'][_0x6cd2('0x17')]===0x1f4){logger[_0x6cd2('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2e7cf3,_0x3e8bba[_0x6cd2('0x16')][_0x6cd2('0x18')]);return _0x1ce9cc(_0x3e8bba['error'][_0x6cd2('0x18')]);}logger['error'](_0x6cd2('0x13'),_0x2e7cf3,_0x3e8bba[_0x6cd2('0x16')]['message']);return _0x246404(_0x3e8bba[_0x6cd2('0x16')][_0x6cd2('0x18')]);}else{logger[_0x6cd2('0x12')](_0x6cd2('0x13'),_0x2e7cf3,'request\x20sent');_0x246404(_0x3e8bba[_0x6cd2('0x19')][_0x6cd2('0x18')]);}})[_0x6cd2('0x1a')](function(_0x27b5cd){logger[_0x6cd2('0x16')](_0x6cd2('0x13'),_0x2e7cf3,_0x27b5cd);_0x1ce9cc(_0x27b5cd);});});}exports[_0x6cd2('0x1b')]=function(_0x36bdda){var _0x4bb512=this;return new Promise(function(_0x41922f,_0x84efae){return db[_0x6cd2('0x1c')][_0x6cd2('0x1d')](_0x36bdda[_0x6cd2('0x1e')],{'raw':_0x36bdda['options']?_0x36bdda['options'][_0x6cd2('0x1f')]===undefined?!![]:![]:!![]})[_0x6cd2('0x11')](function(_0x9bd978){logger[_0x6cd2('0x12')](_0x6cd2('0x1b'),_0x36bdda);logger[_0x6cd2('0x15')](_0x6cd2('0x1b'),_0x36bdda,JSON[_0x6cd2('0x20')](_0x9bd978));_0x41922f(_0x9bd978);})['catch'](function(_0x46b99e){logger[_0x6cd2('0x16')](_0x6cd2('0x1b'),_0x46b99e['message'],_0x36bdda);_0x84efae(_0x4bb512['error'](0x1f4,_0x46b99e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 32384ad..470ea90 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 _0xc56e=['emit','removeListener','register','./whatsappMessage.events','save','remove','update'];(function(_0xe65068,_0x23ba2a){var _0x1e3c6f=function(_0x2e0ca9){while(--_0x2e0ca9){_0xe65068['push'](_0xe65068['shift']());}};_0x1e3c6f(++_0x23ba2a);}(_0xc56e,0x1ae));var _0xec56=function(_0x572e50,_0x5065b3){_0x572e50=_0x572e50-0x0;var _0x14ed2b=_0xc56e[_0x572e50];return _0x14ed2b;};'use strict';var WhatsappMessageEvents=require(_0xec56('0x0'));var events=[_0xec56('0x1'),_0xec56('0x2'),_0xec56('0x3')];function createListener(_0x3c4330,_0x2ddb64){return function(_0x3159d8){_0x2ddb64[_0xec56('0x4')](_0x3c4330,_0x3159d8);};}function removeListener(_0x54f9fb,_0x10c204){return function(){WhatsappMessageEvents[_0xec56('0x5')](_0x54f9fb,_0x10c204);};}exports[_0xec56('0x6')]=function(_0x3a5cfa){for(var _0x45e981=0x0,_0x2a1ef6=events['length'];_0x45e981<_0x2a1ef6;_0x45e981++){var _0x2a42e9=events[_0x45e981];var _0x2efbcd=createListener('whatsappMessage:'+_0x2a42e9,_0x3a5cfa);WhatsappMessageEvents['on'](_0x2a42e9,_0x2efbcd);}}; \ No newline at end of file +var _0xb4a8=['update','emit','removeListener','length','whatsappMessage:','save','remove'];(function(_0xa98fe4,_0x4bf163){var _0x3083ff=function(_0x259b22){while(--_0x259b22){_0xa98fe4['push'](_0xa98fe4['shift']());}};_0x3083ff(++_0x4bf163);}(_0xb4a8,0xec));var _0x8b4a=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0xb4a8[_0x4fa438];return _0x4e3958;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x8b4a('0x0'),_0x8b4a('0x1'),_0x8b4a('0x2')];function createListener(_0x4f792a,_0x57dd3){return function(_0x27fe61){_0x57dd3[_0x8b4a('0x3')](_0x4f792a,_0x27fe61);};}function removeListener(_0x2b910a,_0x1466de){return function(){WhatsappMessageEvents[_0x8b4a('0x4')](_0x2b910a,_0x1466de);};}exports['register']=function(_0x425f2f){for(var _0xa41a23=0x0,_0x30ab9a=events[_0x8b4a('0x5')];_0xa41a23<_0x30ab9a;_0xa41a23++){var _0x44ad78=events[_0xa41a23];var _0xaa423=createListener(_0x8b4a('0x6')+_0x44ad78,_0x425f2f);WhatsappMessageEvents['on'](_0x44ad78,_0xaa423);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e1b768d..fc0c241 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 _0x1d11=['addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x499c0d,_0x3a36b7){var _0x19dfb4=function(_0x55463f){while(--_0x55463f){_0x499c0d['push'](_0x499c0d['shift']());}};_0x19dfb4(++_0x3a36b7);}(_0x1d11,0xb6));var _0x11d1=function(_0x141993,_0x5cd8c2){_0x141993=_0x141993-0x0;var _0x55203a=_0x1d11[_0x141993];return _0x55203a;};'use strict';var multer=require(_0x11d1('0x0'));var util=require(_0x11d1('0x1'));var path=require(_0x11d1('0x2'));var timeout=require(_0x11d1('0x3'));var express=require(_0x11d1('0x4'));var router=express[_0x11d1('0x5')]();var fs_extra=require(_0x11d1('0x6'));var auth=require(_0x11d1('0x7'));var interaction=require(_0x11d1('0x8'));var config=require(_0x11d1('0x9'));var controller=require(_0x11d1('0xa'));router['get']('/',auth[_0x11d1('0xb')](),controller['index']);router[_0x11d1('0xc')](_0x11d1('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x11d1('0xc')](_0x11d1('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x11d1('0xc')](_0x11d1('0xf'),auth[_0x11d1('0xb')](),controller['getMembers']);router['get'](_0x11d1('0x10'),auth[_0x11d1('0xb')](),controller['getTeams']);router['get'](_0x11d1('0x11'),auth[_0x11d1('0xb')](),controller[_0x11d1('0x12')]);router[_0x11d1('0x13')]('/',auth['isAuthenticated'](),controller[_0x11d1('0x14')]);router[_0x11d1('0x13')](_0x11d1('0x10'),auth['isAuthenticated'](),controller[_0x11d1('0x15')]);router[_0x11d1('0x13')](_0x11d1('0x11'),auth[_0x11d1('0xb')](),controller[_0x11d1('0x16')]);router['put'](_0x11d1('0xe'),auth['isAuthenticated'](),controller[_0x11d1('0x17')]);router[_0x11d1('0x18')](_0x11d1('0xe'),auth[_0x11d1('0xb')](),controller[_0x11d1('0x19')]);router[_0x11d1('0x18')]('/:id/teams',auth[_0x11d1('0xb')](),controller[_0x11d1('0x1a')]);router[_0x11d1('0x18')](_0x11d1('0x11'),auth[_0x11d1('0xb')](),controller[_0x11d1('0x1b')]);module[_0x11d1('0x1c')]=router; \ No newline at end of file +var _0xf64e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','removeTeams','multer','util'];(function(_0x48d3ad,_0x290e43){var _0xa60d6e=function(_0x424a3e){while(--_0x424a3e){_0x48d3ad['push'](_0x48d3ad['shift']());}};_0xa60d6e(++_0x290e43);}(_0xf64e,0xa6));var _0xef64=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf64e[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xef64('0x0'));var util=require(_0xef64('0x1'));var path=require(_0xef64('0x2'));var timeout=require(_0xef64('0x3'));var express=require(_0xef64('0x4'));var router=express[_0xef64('0x5')]();var fs_extra=require(_0xef64('0x6'));var auth=require(_0xef64('0x7'));var interaction=require(_0xef64('0x8'));var config=require(_0xef64('0x9'));var controller=require(_0xef64('0xa'));router[_0xef64('0xb')]('/',auth[_0xef64('0xc')](),controller[_0xef64('0xd')]);router['get'](_0xef64('0xe'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xef64('0xf'),auth[_0xef64('0xc')](),controller[_0xef64('0x10')]);router[_0xef64('0xb')](_0xef64('0x11'),auth['isAuthenticated'](),controller[_0xef64('0x12')]);router[_0xef64('0xb')](_0xef64('0x13'),auth[_0xef64('0xc')](),controller[_0xef64('0x14')]);router['get'](_0xef64('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0xef64('0x16')]('/',auth[_0xef64('0xc')](),controller[_0xef64('0x17')]);router[_0xef64('0x16')](_0xef64('0x13'),auth[_0xef64('0xc')](),controller['addTeams']);router[_0xef64('0x16')](_0xef64('0x15'),auth[_0xef64('0xc')](),controller[_0xef64('0x18')]);router[_0xef64('0x19')](_0xef64('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xef64('0x1a')](_0xef64('0xf'),auth[_0xef64('0xc')](),controller['destroy']);router[_0xef64('0x1a')](_0xef64('0x13'),auth[_0xef64('0xc')](),controller[_0xef64('0x1b')]);router[_0xef64('0x1a')](_0xef64('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1c16e1a..9a65cd2 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 _0xe3ee=['name','rrmemory','STRING'];(function(_0x5c9317,_0x1d1dbf){var _0x406cc4=function(_0x2e93b0){while(--_0x2e93b0){_0x5c9317['push'](_0x5c9317['shift']());}};_0x406cc4(++_0x1d1dbf);}(_0xe3ee,0x116));var _0xee3e=function(_0x5f1e39,_0x87510e){_0x5f1e39=_0x5f1e39-0x0;var _0x404e5d=_0xe3ee[_0x5f1e39];return _0x404e5d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee3e('0x0')],'unique':_0xee3e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xee3e('0x2'),'beepall','roundrobin')},'description':{'type':Sequelize[_0xee3e('0x0')]}}; \ No newline at end of file +var _0x8369=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x205c8a,_0x2c685b){var _0x336fd6=function(_0x17672a){while(--_0x17672a){_0x205c8a['push'](_0x205c8a['shift']());}};_0x336fd6(++_0x2c685b);}(_0x8369,0x10b));var _0x9836=function(_0x5ecefd,_0x349b7d){_0x5ecefd=_0x5ecefd-0x0;var _0x54c0ed=_0x8369[_0x5ecefd];return _0x54c0ed;};'use strict';var Sequelize=require(_0x9836('0x0'));module[_0x9836('0x1')]={'name':{'type':Sequelize[_0x9836('0x2')],'unique':_0x9836('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9836('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9836('0x5')](_0x9836('0x6'),'beepall',_0x9836('0x7'))},'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 b605ff0..6aec43b 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 _0x0639=['options','includeAll','WhatsappQueue','findAll','rows','catch','show','intersection','length','create','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','fields','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','interface','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','get','WhatsappQueues','destroy','error','stack','name','index','map','rawAttributes','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0xbbd02f,_0x1df836){var _0x51caf6=function(_0x21e09a){while(--_0x21e09a){_0xbbd02f['push'](_0xbbd02f['shift']());}};_0x51caf6(++_0x1df836);}(_0x0639,0x162));var _0x9063=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x0639[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0x9063('0x0'));var rimraf=require(_0x9063('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9063('0x2'));var rp=require(_0x9063('0x3'));var moment=require(_0x9063('0x4'));var BPromise=require(_0x9063('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9063('0x6'));var sox=require(_0x9063('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9063('0x8'));var _=require(_0x9063('0x9'));var squel=require(_0x9063('0xa'));var crypto=require(_0x9063('0xb'));var jsforce=require(_0x9063('0xc'));var deskjs=require(_0x9063('0xd'));var toCsv=require(_0x9063('0xe'));var querystring=require(_0x9063('0xf'));var Papa=require('papaparse');var Redis=require(_0x9063('0x10'));var authService=require(_0x9063('0x11'));var qs=require(_0x9063('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9063('0x13'));var logger=require(_0x9063('0x14'))(_0x9063('0x15'));var utils=require(_0x9063('0x16'));var config=require(_0x9063('0x17'));var licenseUtil=require(_0x9063('0x18'));var db=require('../../mysqldb')['db'];config[_0x9063('0x19')]=_[_0x9063('0x1a')](config[_0x9063('0x19')],{'host':_0x9063('0x1b'),'port':0x18eb});var socket=require(_0x9063('0x1c'))(new Redis(config[_0x9063('0x19')]));require(_0x9063('0x1d'))[_0x9063('0x1e')](socket);function respondWithStatusCode(_0x241b57,_0x1a2327){_0x1a2327=_0x1a2327||0xcc;return function(_0x268226){if(_0x268226){return _0x241b57[_0x9063('0x1f')](_0x1a2327);}return _0x241b57[_0x9063('0x20')](_0x1a2327)[_0x9063('0x21')]();};}function respondWithResult(_0x2e89e0,_0x20ffd2){_0x20ffd2=_0x20ffd2||0xc8;return function(_0x43fb8e){if(_0x43fb8e){return _0x2e89e0[_0x9063('0x20')](_0x20ffd2)[_0x9063('0x22')](_0x43fb8e);}};}function respondWithFilteredResult(_0x1416a6,_0x2abf2f){return function(_0x308760){if(_0x308760){var _0x35ce05=typeof _0x2abf2f['offset']===_0x9063('0x23')&&typeof _0x2abf2f[_0x9063('0x24')]===_0x9063('0x23');var _0x3d8de8=_0x308760['count'];var _0x3d31ef=_0x35ce05?0x0:_0x2abf2f[_0x9063('0x25')];var _0x1ea221=_0x35ce05?_0x308760[_0x9063('0x26')]:_0x2abf2f[_0x9063('0x25')]+_0x2abf2f[_0x9063('0x24')];var _0x5a0de6;if(_0x1ea221>=_0x3d8de8){_0x1ea221=_0x3d8de8;_0x5a0de6=0xc8;}else{_0x5a0de6=0xce;}_0x1416a6[_0x9063('0x20')](_0x5a0de6);return _0x1416a6[_0x9063('0x27')]('Content-Range',_0x3d31ef+'-'+_0x1ea221+'/'+_0x3d8de8)[_0x9063('0x22')](_0x308760);}return null;};}function patchUpdates(_0x4c4fad){return function(_0x401e40){try{jsonpatch[_0x9063('0x28')](_0x401e40,_0x4c4fad,!![]);}catch(_0x2580ed){return BPromise[_0x9063('0x29')](_0x2580ed);}return _0x401e40[_0x9063('0x2a')]();};}function saveUpdates(_0x1f64ac,_0x2de22b){return function(_0x2da432){if(_0x2da432){return _0x2da432[_0x9063('0x2b')](_0x1f64ac)[_0x9063('0x2c')](function(_0xcef758){return _0xcef758;});}return null;};}function removeEntity(_0x4dfdae,_0x2d33c7){return function(_0x2afb69){if(_0x2afb69){return _0x2afb69['destroy']()[_0x9063('0x2c')](function(){var _0x23a594=_0x2afb69[_0x9063('0x2d')]({'plain':!![]});var _0x2f091f=_0x9063('0x2e');return db['UserProfileResource'][_0x9063('0x2f')]({'where':{'type':_0x2f091f,'resourceId':_0x23a594['id']}})[_0x9063('0x2c')](function(){return _0x2afb69;});})[_0x9063('0x2c')](function(){_0x4dfdae[_0x9063('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f304a,_0x32f945){return function(_0x269905){if(!_0x269905){_0x1f304a['sendStatus'](0x194);}return _0x269905;};}function handleError(_0x552700,_0x2efc7b){_0x2efc7b=_0x2efc7b||0x1f4;return function(_0x18442a){logger[_0x9063('0x30')](_0x18442a[_0x9063('0x31')]);if(_0x18442a[_0x9063('0x32')]){delete _0x18442a['name'];}_0x552700['status'](_0x2efc7b)['send'](_0x18442a);};}exports[_0x9063('0x33')]=function(_0x530fe7,_0xcf1e8a){var _0x2e985b={},_0x4157ae={},_0x18258e={'count':0x0,'rows':[]};var _0x17b607=_[_0x9063('0x34')](db['WhatsappQueue'][_0x9063('0x35')],function(_0x2f9b97){return{'name':_0x2f9b97['fieldName'],'type':_0x2f9b97['type']['key']};});_0x4157ae['model']=_[_0x9063('0x34')](_0x17b607,_0x9063('0x32'));_0x4157ae[_0x9063('0x36')]=_[_0x9063('0x37')](_0x530fe7[_0x9063('0x36')]);_0x4157ae[_0x9063('0x38')]=_['intersection'](_0x4157ae[_0x9063('0x39')],_0x4157ae[_0x9063('0x36')]);_0x2e985b[_0x9063('0x3a')]=_['intersection'](_0x4157ae['model'],qs['fields'](_0x530fe7[_0x9063('0x36')]['fields']));_0x2e985b['attributes']=_0x2e985b[_0x9063('0x3a')]['length']?_0x2e985b['attributes']:_0x4157ae[_0x9063('0x39')];if(!_0x530fe7[_0x9063('0x36')][_0x9063('0x3b')](_0x9063('0x3c'))){_0x2e985b[_0x9063('0x24')]=qs[_0x9063('0x24')](_0x530fe7[_0x9063('0x36')][_0x9063('0x24')]);_0x2e985b[_0x9063('0x25')]=qs[_0x9063('0x25')](_0x530fe7[_0x9063('0x36')]['offset']);}_0x2e985b[_0x9063('0x3d')]=qs[_0x9063('0x3e')](_0x530fe7[_0x9063('0x36')]['sort']);_0x2e985b[_0x9063('0x3f')]=qs[_0x9063('0x38')](_[_0x9063('0x40')](_0x530fe7[_0x9063('0x36')],_0x4157ae[_0x9063('0x38')]),_0x17b607);if(_0x530fe7[_0x9063('0x36')][_0x9063('0x41')]){_0x2e985b[_0x9063('0x3f')]=_[_0x9063('0x42')](_0x2e985b[_0x9063('0x3f')],{'$or':_['map'](_0x17b607,function(_0x5a1062){if(_0x5a1062[_0x9063('0x43')]!==_0x9063('0x44')){var _0x130689={};_0x130689[_0x5a1062[_0x9063('0x32')]]={'$like':'%'+_0x530fe7[_0x9063('0x36')][_0x9063('0x41')]+'%'};return _0x130689;}})});}_0x2e985b=_[_0x9063('0x42')]({},_0x2e985b,_0x530fe7[_0x9063('0x45')]);var _0x5bb1e1={'where':_0x2e985b[_0x9063('0x3f')]};return db['WhatsappQueue'][_0x9063('0x26')](_0x5bb1e1)[_0x9063('0x2c')](function(_0x43b02e){_0x18258e[_0x9063('0x26')]=_0x43b02e;if(_0x530fe7[_0x9063('0x36')][_0x9063('0x46')]){_0x2e985b['include']=[{'all':!![]}];}return db[_0x9063('0x47')][_0x9063('0x48')](_0x2e985b);})[_0x9063('0x2c')](function(_0x207c7d){_0x18258e[_0x9063('0x49')]=_0x207c7d;return _0x18258e;})[_0x9063('0x2c')](respondWithFilteredResult(_0xcf1e8a,_0x2e985b))[_0x9063('0x4a')](handleError(_0xcf1e8a,null));};exports[_0x9063('0x4b')]=function(_0x24334d,_0x3966da){var _0x452aee={'raw':!![],'where':{'id':_0x24334d['params']['id']}},_0x30da80={};_0x30da80[_0x9063('0x39')]=_[_0x9063('0x37')](db[_0x9063('0x47')][_0x9063('0x35')]);_0x30da80[_0x9063('0x36')]=_[_0x9063('0x37')](_0x24334d[_0x9063('0x36')]);_0x30da80['filters']=_[_0x9063('0x4c')](_0x30da80[_0x9063('0x39')],_0x30da80[_0x9063('0x36')]);_0x452aee[_0x9063('0x3a')]=_[_0x9063('0x4c')](_0x30da80[_0x9063('0x39')],qs['fields'](_0x24334d['query']['fields']));_0x452aee[_0x9063('0x3a')]=_0x452aee[_0x9063('0x3a')][_0x9063('0x4d')]?_0x452aee[_0x9063('0x3a')]:_0x30da80[_0x9063('0x39')];if(_0x24334d[_0x9063('0x36')][_0x9063('0x46')]){_0x452aee['include']=[{'all':!![]}];}_0x452aee=_[_0x9063('0x42')]({},_0x452aee,_0x24334d[_0x9063('0x45')]);return db['WhatsappQueue']['find'](_0x452aee)[_0x9063('0x2c')](handleEntityNotFound(_0x3966da,null))['then'](respondWithResult(_0x3966da,null))[_0x9063('0x4a')](handleError(_0x3966da,null));};exports[_0x9063('0x4e')]=function(_0x13f732,_0x24ce1f){return db['WhatsappQueue']['create'](_0x13f732['body'],{})[_0x9063('0x2c')](function(_0x368a6e){var _0x1f3009=_0x13f732[_0x9063('0x4f')][_0x9063('0x2d')]({'plain':!![]});if(!_0x1f3009)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f3009['role']===_0x9063('0x4f')){var _0x22bc82=_0x368a6e[_0x9063('0x2d')]({'plain':!![]});var _0x20ebbe='WhatsappQueues';return db['UserProfileSection'][_0x9063('0x50')]({'where':{'name':_0x20ebbe,'userProfileId':_0x1f3009[_0x9063('0x51')]},'raw':!![]})[_0x9063('0x2c')](function(_0x4b573d){if(_0x4b573d&&_0x4b573d[_0x9063('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x22bc82[_0x9063('0x32')],'resourceId':_0x22bc82['id'],'type':_0x4b573d[_0x9063('0x32')],'sectionId':_0x4b573d['id']},{})[_0x9063('0x2c')](function(){return _0x368a6e;});}else{return _0x368a6e;}})[_0x9063('0x4a')](function(_0x2f8f43){logger[_0x9063('0x30')](_0x9063('0x53'),_0x2f8f43);throw _0x2f8f43;});}return _0x368a6e;})['then'](respondWithResult(_0x24ce1f,0xc9))[_0x9063('0x4a')](handleError(_0x24ce1f,null));};exports['update']=function(_0x36de45,_0x591010){if(_0x36de45[_0x9063('0x54')]['id']){delete _0x36de45['body']['id'];}return db[_0x9063('0x47')][_0x9063('0x50')]({'where':{'id':_0x36de45[_0x9063('0x55')]['id']}})[_0x9063('0x2c')](handleEntityNotFound(_0x591010,null))[_0x9063('0x2c')](saveUpdates(_0x36de45['body'],null))[_0x9063('0x2c')](respondWithResult(_0x591010,null))[_0x9063('0x4a')](handleError(_0x591010,null));};exports[_0x9063('0x2f')]=function(_0x1e8ff2,_0x237e52){return db['WhatsappQueue']['find']({'where':{'id':_0x1e8ff2[_0x9063('0x55')]['id']}})['then'](handleEntityNotFound(_0x237e52,null))['then'](removeEntity(_0x237e52,null))['catch'](handleError(_0x237e52,null));};exports[_0x9063('0x56')]=function(_0x46fb9f,_0x33c6c4){return db['WhatsappQueue'][_0x9063('0x56')]()[_0x9063('0x2c')](respondWithResult(_0x33c6c4,null))[_0x9063('0x4a')](handleError(_0x33c6c4,null));};exports[_0x9063('0x57')]=function(_0x46b02f,_0x1f2be7,_0x22e1c6){var _0x4fab6a={'raw':!![],'where':{}},_0x47bb27={},_0xc706e3;return db[_0x9063('0x47')][_0x9063('0x58')]({'where':{'id':_0x46b02f[_0x9063('0x55')]['id']}})[_0x9063('0x2c')](handleEntityNotFound(_0x1f2be7,null))[_0x9063('0x2c')](function(_0x5d5239){if(_0x5d5239){_0xc706e3=_0x5d5239[_0x9063('0x2d')]({'plain':!![]});_0x47bb27[_0x9063('0x39')]=_[_0x9063('0x37')](db[_0x9063('0x59')]['rawAttributes']);_0x47bb27[_0x9063('0x36')]=_[_0x9063('0x37')](_0x46b02f[_0x9063('0x36')]);_0x47bb27[_0x9063('0x38')]=_[_0x9063('0x4c')](_0x47bb27[_0x9063('0x39')],_0x47bb27[_0x9063('0x36')]);_0x4fab6a['attributes']=_[_0x9063('0x4c')](_0x47bb27[_0x9063('0x39')],qs[_0x9063('0x5a')](_0x46b02f[_0x9063('0x36')][_0x9063('0x5a')]));_0x4fab6a[_0x9063('0x3a')]=_0x4fab6a[_0x9063('0x3a')][_0x9063('0x4d')]?_0x4fab6a['attributes']:_0x47bb27[_0x9063('0x39')];if(!_0x46b02f[_0x9063('0x36')][_0x9063('0x3b')](_0x9063('0x3c'))){_0x4fab6a[_0x9063('0x24')]=qs['limit'](_0x46b02f[_0x9063('0x36')][_0x9063('0x24')]);_0x4fab6a[_0x9063('0x25')]=qs[_0x9063('0x25')](_0x46b02f['query'][_0x9063('0x25')]);}_0x4fab6a[_0x9063('0x3d')]=qs[_0x9063('0x3e')](_0x46b02f[_0x9063('0x36')]['sort']);_0x4fab6a[_0x9063('0x3f')]=qs['filters'](_['pick'](_0x46b02f['query'],_0x47bb27[_0x9063('0x38')]));_0x4fab6a[_0x9063('0x3f')][_0x9063('0x5b')]=_0x5d5239['id'];if(_0x46b02f[_0x9063('0x36')][_0x9063('0x41')]){_0x4fab6a['where']=_[_0x9063('0x42')](_0x4fab6a[_0x9063('0x3f')],{'$or':_['map'](_0x4fab6a[_0x9063('0x3a')],function(_0x17e3bd){var _0x26bca8={};_0x26bca8[_0x17e3bd]={'$like':'%'+_0x46b02f[_0x9063('0x36')][_0x9063('0x41')]+'%'};return _0x26bca8;})});}_0x4fab6a=_[_0x9063('0x42')]({},_0x4fab6a,_0x46b02f[_0x9063('0x45')]);return db[_0x9063('0x59')][_0x9063('0x48')](_0x4fab6a);}})['then'](function(_0x411695){if(_0x411695){return db['User'][_0x9063('0x5c')]({'where':{'id':_[_0x9063('0x34')](_0x411695,_0x9063('0x5d')),'role':_0x9063('0x5e')},'attributes':['id','name',_0x9063('0x5f'),'updatedAt','createdAt']});}})[_0x9063('0x2c')](function(_0xb14dad){if(_0xb14dad){return{'count':_0xb14dad[_0x9063('0x26')],'rows':_[_0x9063('0x34')](_0xb14dad[_0x9063('0x49')],function(_0x2dc122){return{'membername':_0x2dc122[_0x9063('0x32')],'UserId':_0x2dc122['id'],'queue_name':_0xc706e3['name'],'WhatsappQueueId':_0xc706e3['id'],'interface':util[_0x9063('0x60')](_0x9063('0x61'),_0x9063('0x62'),_0x2dc122['name']),'penalty':0x0,'paused':_0x2dc122[_0x9063('0x5f')],'createdAt':_0x2dc122[_0x9063('0x63')],'updatedAt':_0x2dc122[_0x9063('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9063('0x2c')](respondWithFilteredResult(_0x1f2be7,_0x4fab6a))[_0x9063('0x4a')](handleError(_0x1f2be7,null));};exports['getTeams']=function(_0x2e87b2,_0x2475ef,_0x53126d){var _0x5bba9b={};var _0x4ca6c9={};var _0xfdfd1;var _0x14d8d7;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2e87b2[_0x9063('0x55')]['id']}})[_0x9063('0x2c')](handleEntityNotFound(_0x2475ef,null))[_0x9063('0x2c')](function(_0x337a47){if(_0x337a47){_0xfdfd1=_0x337a47;_0x4ca6c9[_0x9063('0x39')]=_['keys'](db[_0x9063('0x65')][_0x9063('0x35')]);_0x4ca6c9[_0x9063('0x36')]=_[_0x9063('0x37')](_0x2e87b2[_0x9063('0x36')]);_0x4ca6c9[_0x9063('0x38')]=_[_0x9063('0x4c')](_0x4ca6c9[_0x9063('0x39')],_0x4ca6c9['query']);_0x5bba9b[_0x9063('0x3a')]=_[_0x9063('0x4c')](_0x4ca6c9[_0x9063('0x39')],qs[_0x9063('0x5a')](_0x2e87b2[_0x9063('0x36')][_0x9063('0x5a')]));_0x5bba9b['attributes']=_0x5bba9b[_0x9063('0x3a')]['length']?_0x5bba9b['attributes']:_0x4ca6c9[_0x9063('0x39')];_0x5bba9b[_0x9063('0x3d')]=qs[_0x9063('0x3e')](_0x2e87b2[_0x9063('0x36')][_0x9063('0x3e')]);_0x5bba9b['where']=qs[_0x9063('0x38')](_[_0x9063('0x40')](_0x2e87b2[_0x9063('0x36')],_0x4ca6c9['filters']));if(_0x2e87b2[_0x9063('0x36')][_0x9063('0x41')]){_0x5bba9b[_0x9063('0x3f')]=_[_0x9063('0x42')](_0x5bba9b[_0x9063('0x3f')],{'$or':_[_0x9063('0x34')](_0x5bba9b[_0x9063('0x3a')],function(_0x16a708){var _0x2cdce5={};_0x2cdce5[_0x16a708]={'$like':'%'+_0x2e87b2['query']['filter']+'%'};return _0x2cdce5;})});}_0x5bba9b=_[_0x9063('0x42')]({},_0x5bba9b,_0x2e87b2[_0x9063('0x45')]);return _0xfdfd1['getTeams'](_0x5bba9b);}})['then'](function(_0x5e4402){if(_0x5e4402){_0x14d8d7=_0x5e4402['length'];if(!_0x2e87b2[_0x9063('0x36')]['hasOwnProperty'](_0x9063('0x3c'))){_0x5bba9b[_0x9063('0x24')]=qs[_0x9063('0x24')](_0x2e87b2['query'][_0x9063('0x24')]);_0x5bba9b[_0x9063('0x25')]=qs[_0x9063('0x25')](_0x2e87b2[_0x9063('0x36')]['offset']);}return _0xfdfd1[_0x9063('0x66')](_0x5bba9b);}})['then'](function(_0x201688){if(_0x201688){return _0x201688?{'count':_0x14d8d7,'rows':_0x201688}:null;}})[_0x9063('0x2c')](respondWithResult(_0x2475ef,null))[_0x9063('0x4a')](handleError(_0x2475ef,null));};exports[_0x9063('0x67')]=function(_0x12c5ba,_0x196c97,_0x3dc4f1){var _0x92b909=_0x12c5ba[_0x9063('0x54')][_0x9063('0x68')];return db['Team'][_0x9063('0x48')]({'where':{'id':_0x92b909},'attributes':['id'],'include':[{'model':db[_0x9063('0x69')],'as':_0x9063('0x6a'),'attributes':['id',_0x9063('0x32'),_0x9063('0x6b'),'voicePause',_0x9063('0x6c')],'raw':!![]}]})[_0x9063('0x2c')](function(_0x3d6058){if(_0x3d6058){var _0x2856fb=_['flatMap'](_0x3d6058,function(_0x4f3883){var _0x4fc76d=_0x4f3883[_0x9063('0x2d')]({'plain':!![]});return _0x4fc76d[_0x9063('0x6a')];});return db['WhatsappQueue'][_0x9063('0x50')]({'where':{'id':_0x12c5ba['params']['id']}})[_0x9063('0x2c')](function(_0xb9eb93){return db['sequelize'][_0x9063('0x6d')](function(_0x3593a0){return _0xb9eb93[_0x9063('0x67')](_0x92b909,{'transaction':_0x3593a0})[_0x9063('0x2c')](function(){return BPromise[_0x9063('0x6e')](_0x2856fb,function(_0x5ebbea){return db['UserWhatsappQueue'][_0x9063('0x6f')]({'where':{'UserId':_0x5ebbea['id'],'WhatsappQueueId':_0x12c5ba['params']['id']},'transaction':_0x3593a0});});})[_0x9063('0x2c')](function(){_0x2856fb[_0x9063('0x70')](function(_0x3bb531){socket['emit'](_0x9063('0x71'),{'UserId':_0x3bb531['id'],'WhatsappQueueId':_0xb9eb93['id']});});});});});}})[_0x9063('0x2c')](respondWithStatusCode(_0x196c97,null))[_0x9063('0x4a')](handleError(_0x196c97,null));};exports[_0x9063('0x72')]=function(_0x1dd8c6,_0x3c9295,_0x53ccbc){return db['Team'][_0x9063('0x48')]({'where':{'id':_0x1dd8c6['query'][_0x9063('0x68')]},'attributes':['id'],'include':[{'model':db[_0x9063('0x69')],'as':_0x9063('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x9063('0x2c')](handleEntityNotFound(_0x3c9295,null))[_0x9063('0x2c')](function(_0x20021d){var _0x3932cf=_[_0x9063('0x34')](_0x20021d,'id');var _0x5276e5=[];var _0x32d2e2=[];var _0x207617=squel[_0x9063('0x73')]();_0x207617[_0x9063('0x74')](_0x9063('0x75'))['from'](_0x9063('0x76'),'tq')[_0x9063('0x77')](_0x9063('0x78'),'ut',_0x9063('0x79'))[_0x9063('0x3f')](_0x9063('0x7a'),_0x1dd8c6[_0x9063('0x55')]['id']);for(var _0x17f47e=0x0;_0x17f47e<_0x20021d['length'];_0x17f47e+=0x1){let _0x39c0ff=_0x20021d[_0x17f47e];for(var _0x262968=0x0;_0x262968<_0x39c0ff[_0x9063('0x6a')][_0x9063('0x4d')];_0x262968+=0x1){let _0x53c024=_0x39c0ff[_0x9063('0x6a')][_0x262968];var _0x3e274e=_0x207617['clone']();_0x3e274e[_0x9063('0x3f')](_0x9063('0x7b'),_0x53c024['id']);_0x32d2e2['push'](db[_0x9063('0x7c')][_0x9063('0x36')](_0x3e274e['toString'](),{'type':db[_0x9063('0x7c')][_0x9063('0x7d')]['SELECT']})[_0x9063('0x2c')](function(_0x5d6935){if(_0x5d6935[_0x9063('0x4d')]===0x1){return _0x53c024['id'];}else{var _0x12c648=_[_0x9063('0x7e')](_[_0x9063('0x34')](_0x5d6935,_0x9063('0x7f')),function(_0x5ee134){return _[_0x9063('0x80')](_0x3932cf,_0x5ee134);});if(_0x12c648){return _0x53c024['id'];}}}));}}return BPromise[_0x9063('0x81')](_0x32d2e2)[_0x9063('0x2c')](function(_0x3bd5ac){_0x5276e5=_(_0x5276e5)[_0x9063('0x82')](_0x3bd5ac)['compact']()[_0x9063('0x83')]();return db['WhatsappQueue'][_0x9063('0x50')]({'where':{'id':_0x1dd8c6[_0x9063('0x55')]['id']}})[_0x9063('0x2c')](function(_0x289c36){return db['sequelize'][_0x9063('0x6d')](function(_0x155d7c){return _0x289c36[_0x9063('0x72')](_0x1dd8c6[_0x9063('0x36')][_0x9063('0x68')],{'transaction':_0x155d7c})[_0x9063('0x2c')](function(){if(!_[_0x9063('0x84')](_0x5276e5)){return _0x289c36[_0x9063('0x85')](_0x5276e5,{'transaction':_0x155d7c});}})['then'](function(){_0x5276e5[_0x9063('0x70')](function(_0x4cab02){socket['emit'](_0x9063('0x86'),{'UserId':_0x4cab02,'WhatsappQueueId':_0x289c36['id']});});});});});});})['then'](respondWithStatusCode(_0x3c9295,null))[_0x9063('0x4a')](handleError(_0x3c9295,null));};exports[_0x9063('0x87')]=function(_0x194a0d,_0x339da3,_0x582790){return db[_0x9063('0x47')]['find']({'where':{'id':_0x194a0d['params']['id']}})['then'](handleEntityNotFound(_0x339da3,null))[_0x9063('0x2c')](function(_0x3faa3a){if(_0x3faa3a){return _0x3faa3a[_0x9063('0x87')](_0x194a0d[_0x9063('0x54')][_0x9063('0x68')],_[_0x9063('0x88')](_0x194a0d['body'],[_0x9063('0x68'),'id'])||{})[_0x9063('0x89')](function(_0x3c388e){for(var _0x164c0f=0x0;_0x164c0f<_0x194a0d['body'][_0x9063('0x68')][_0x9063('0x4d')];_0x164c0f+=0x1){socket[_0x9063('0x8a')](_0x9063('0x71'),{'UserId':Number(_0x194a0d[_0x9063('0x54')][_0x9063('0x68')][_0x164c0f]),'WhatsappQueueId':Number(_0x194a0d[_0x9063('0x55')]['id'])});}return _0x3c388e;});}})[_0x9063('0x2c')](respondWithResult(_0x339da3,null))[_0x9063('0x4a')](handleError(_0x339da3,null));};exports['removeAgents']=function(_0x5d77fc,_0x4a2875,_0x57ee99){return db[_0x9063('0x47')][_0x9063('0x50')]({'where':{'id':_0x5d77fc['params']['id']}})[_0x9063('0x2c')](handleEntityNotFound(_0x4a2875,null))[_0x9063('0x2c')](function(_0x528175){if(_0x528175){return _0x528175['removeAgents'](_0x5d77fc[_0x9063('0x36')][_0x9063('0x68')])[_0x9063('0x2c')](function(){if(_[_0x9063('0x8b')](_0x5d77fc[_0x9063('0x36')]['ids'])){for(var _0x520328=0x0;_0x520328<_0x5d77fc[_0x9063('0x36')]['ids'][_0x9063('0x4d')];_0x520328+=0x1){socket[_0x9063('0x8a')](_0x9063('0x86'),{'UserId':Number(_0x5d77fc[_0x9063('0x36')]['ids'][_0x520328]),'WhatsappQueueId':Number(_0x5d77fc['params']['id'])});}}else{socket['emit'](_0x9063('0x86'),{'UserId':Number(_0x5d77fc['query'][_0x9063('0x68')]),'WhatsappQueueId':Number(_0x5d77fc[_0x9063('0x55')]['id'])});}});}})[_0x9063('0x2c')](respondWithStatusCode(_0x4a2875,null))['catch'](handleError(_0x4a2875,null));};exports[_0x9063('0x8c')]=function(_0xd883d7,_0x1ace80,_0x1633f5){var _0x54b230={};var _0x149893={};var _0x26c3c4;var _0x88bd9e;return db['WhatsappQueue']['findOne']({'where':{'id':_0xd883d7[_0x9063('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ace80,null))[_0x9063('0x2c')](function(_0xcd18dd){if(_0xcd18dd){_0x26c3c4=_0xcd18dd;_0x149893['model']=_[_0x9063('0x37')](db[_0x9063('0x69')][_0x9063('0x35')]);_0x149893['query']=_[_0x9063('0x37')](_0xd883d7[_0x9063('0x36')]);_0x149893['filters']=_[_0x9063('0x4c')](_0x149893[_0x9063('0x39')],_0x149893[_0x9063('0x36')]);_0x54b230[_0x9063('0x3a')]=_[_0x9063('0x4c')](_0x149893[_0x9063('0x39')],qs[_0x9063('0x5a')](_0xd883d7[_0x9063('0x36')]['fields']));_0x54b230[_0x9063('0x3a')]=_0x54b230[_0x9063('0x3a')][_0x9063('0x4d')]?_0x54b230['attributes']:_0x149893[_0x9063('0x39')];_0x54b230[_0x9063('0x3d')]=qs['sort'](_0xd883d7[_0x9063('0x36')]['sort']);_0x54b230[_0x9063('0x3f')]=qs[_0x9063('0x38')](_['pick'](_0xd883d7[_0x9063('0x36')],_0x149893[_0x9063('0x38')]));if(_0xd883d7['query'][_0x9063('0x41')]){_0x54b230[_0x9063('0x3f')]=_[_0x9063('0x42')](_0x54b230['where'],{'$or':_[_0x9063('0x34')](_0x54b230[_0x9063('0x3a')],function(_0x56cb4c){var _0x102dc0={};_0x102dc0[_0x56cb4c]={'$like':'%'+_0xd883d7[_0x9063('0x36')][_0x9063('0x41')]+'%'};return _0x102dc0;})});}_0x54b230=_[_0x9063('0x42')]({},_0x54b230,_0xd883d7[_0x9063('0x45')]);return _0x26c3c4['getAgents'](_0x54b230);}})[_0x9063('0x2c')](function(_0x5aedf6){if(_0x5aedf6){_0x88bd9e=_0x5aedf6['length'];if(!_0xd883d7[_0x9063('0x36')]['hasOwnProperty']('nolimit')){_0x54b230[_0x9063('0x24')]=qs['limit'](_0xd883d7[_0x9063('0x36')][_0x9063('0x24')]);_0x54b230[_0x9063('0x25')]=qs['offset'](_0xd883d7[_0x9063('0x36')]['offset']);}return _0x26c3c4[_0x9063('0x8c')](_0x54b230);}})[_0x9063('0x2c')](function(_0x46efd6){if(_0x46efd6){return _0x46efd6?{'count':_0x88bd9e,'rows':_0x46efd6}:null;}})[_0x9063('0x2c')](respondWithResult(_0x1ace80,null))[_0x9063('0x4a')](handleError(_0x1ace80,null));}; \ No newline at end of file +var _0x20c2=['redis','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','index','WhatsappQueue','rawAttributes','type','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','filters','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','update','describe','getMembers','pick','WhatsappQueueId','UserWhatsappQueue','findAll','UserId','agent','whatsappPause','updatedAt','rows','format','SIP','getTeams','findOne','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb'];(function(_0x550109,_0x1b62f6){var _0x3ade44=function(_0x50bff2){while(--_0x50bff2){_0x550109['push'](_0x550109['shift']());}};_0x3ade44(++_0x1b62f6);}(_0x20c2,0xf9));var _0x220c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20c2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x220c('0x0'));var rimraf=require(_0x220c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x220c('0x2'));var rp=require('request-promise');var moment=require(_0x220c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x220c('0x4'));var util=require(_0x220c('0x5'));var path=require(_0x220c('0x6'));var sox=require(_0x220c('0x7'));var csv=require(_0x220c('0x8'));var ejs=require(_0x220c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x220c('0xa'));var jsforce=require(_0x220c('0xb'));var deskjs=require(_0x220c('0xc'));var toCsv=require(_0x220c('0x8'));var querystring=require(_0x220c('0xd'));var Papa=require(_0x220c('0xe'));var Redis=require('ioredis');var authService=require(_0x220c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x220c('0x10'));var hardwareService=require(_0x220c('0x11'));var logger=require('../../config/logger')(_0x220c('0x12'));var utils=require('../../config/utils');var config=require(_0x220c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x220c('0x14'))['db'];config[_0x220c('0x15')]=_[_0x220c('0x16')](config[_0x220c('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x220c('0x17'))(new Redis(config['redis']));require(_0x220c('0x18'))['register'](socket);function respondWithStatusCode(_0xf12d7b,_0x334f0f){_0x334f0f=_0x334f0f||0xcc;return function(_0x2febeb){if(_0x2febeb){return _0xf12d7b[_0x220c('0x19')](_0x334f0f);}return _0xf12d7b[_0x220c('0x1a')](_0x334f0f)[_0x220c('0x1b')]();};}function respondWithResult(_0x2c33f8,_0x50e32b){_0x50e32b=_0x50e32b||0xc8;return function(_0x126d38){if(_0x126d38){return _0x2c33f8[_0x220c('0x1a')](_0x50e32b)[_0x220c('0x1c')](_0x126d38);}};}function respondWithFilteredResult(_0x5b560d,_0x4aa86d){return function(_0x24edcc){if(_0x24edcc){var _0x3d1295=typeof _0x4aa86d[_0x220c('0x1d')]===_0x220c('0x1e')&&typeof _0x4aa86d[_0x220c('0x1f')]===_0x220c('0x1e');var _0x3af39f=_0x24edcc[_0x220c('0x20')];var _0x21540d=_0x3d1295?0x0:_0x4aa86d[_0x220c('0x1d')];var _0x4721d4=_0x3d1295?_0x24edcc[_0x220c('0x20')]:_0x4aa86d['offset']+_0x4aa86d['limit'];var _0x310db9;if(_0x4721d4>=_0x3af39f){_0x4721d4=_0x3af39f;_0x310db9=0xc8;}else{_0x310db9=0xce;}_0x5b560d['status'](_0x310db9);return _0x5b560d[_0x220c('0x21')](_0x220c('0x22'),_0x21540d+'-'+_0x4721d4+'/'+_0x3af39f)['json'](_0x24edcc);}return null;};}function patchUpdates(_0x81ee1f){return function(_0x21c038){try{jsonpatch[_0x220c('0x23')](_0x21c038,_0x81ee1f,!![]);}catch(_0x315f39){return BPromise[_0x220c('0x24')](_0x315f39);}return _0x21c038[_0x220c('0x25')]();};}function saveUpdates(_0x1c3b2a,_0xeed31a){return function(_0x1e11dd){if(_0x1e11dd){return _0x1e11dd['update'](_0x1c3b2a)[_0x220c('0x26')](function(_0x5ad0e0){return _0x5ad0e0;});}return null;};}function removeEntity(_0x50c7d9,_0x549ca2){return function(_0x227d53){if(_0x227d53){return _0x227d53[_0x220c('0x27')]()['then'](function(){var _0x90c7ee=_0x227d53[_0x220c('0x28')]({'plain':!![]});var _0x579834='WhatsappQueues';return db['UserProfileResource'][_0x220c('0x27')]({'where':{'type':_0x579834,'resourceId':_0x90c7ee['id']}})['then'](function(){return _0x227d53;});})[_0x220c('0x26')](function(){_0x50c7d9[_0x220c('0x1a')](0xcc)[_0x220c('0x1b')]();});}};}function handleEntityNotFound(_0x399368,_0x4344b4){return function(_0x4ccc98){if(!_0x4ccc98){_0x399368[_0x220c('0x19')](0x194);}return _0x4ccc98;};}function handleError(_0x39a7dc,_0x4b0e5a){_0x4b0e5a=_0x4b0e5a||0x1f4;return function(_0x547aa1){logger['error'](_0x547aa1[_0x220c('0x29')]);if(_0x547aa1['name']){delete _0x547aa1[_0x220c('0x2a')];}_0x39a7dc[_0x220c('0x1a')](_0x4b0e5a)[_0x220c('0x2b')](_0x547aa1);};}exports[_0x220c('0x2c')]=function(_0x118fd0,_0x5c7351){var _0x4a8ae3={},_0xce6936={},_0x1df523={'count':0x0,'rows':[]};var _0x593565=_['map'](db[_0x220c('0x2d')][_0x220c('0x2e')],function(_0x514fb0){return{'name':_0x514fb0['fieldName'],'type':_0x514fb0[_0x220c('0x2f')]['key']};});_0xce6936['model']=_[_0x220c('0x30')](_0x593565,_0x220c('0x2a'));_0xce6936[_0x220c('0x31')]=_[_0x220c('0x32')](_0x118fd0[_0x220c('0x31')]);_0xce6936['filters']=_[_0x220c('0x33')](_0xce6936[_0x220c('0x34')],_0xce6936[_0x220c('0x31')]);_0x4a8ae3[_0x220c('0x35')]=_[_0x220c('0x33')](_0xce6936[_0x220c('0x34')],qs[_0x220c('0x36')](_0x118fd0['query'][_0x220c('0x36')]));_0x4a8ae3[_0x220c('0x35')]=_0x4a8ae3[_0x220c('0x35')]['length']?_0x4a8ae3[_0x220c('0x35')]:_0xce6936[_0x220c('0x34')];if(!_0x118fd0['query'][_0x220c('0x37')](_0x220c('0x38'))){_0x4a8ae3['limit']=qs[_0x220c('0x1f')](_0x118fd0['query'][_0x220c('0x1f')]);_0x4a8ae3[_0x220c('0x1d')]=qs[_0x220c('0x1d')](_0x118fd0[_0x220c('0x31')]['offset']);}_0x4a8ae3[_0x220c('0x39')]=qs[_0x220c('0x3a')](_0x118fd0['query'][_0x220c('0x3a')]);_0x4a8ae3['where']=qs['filters'](_['pick'](_0x118fd0[_0x220c('0x31')],_0xce6936['filters']),_0x593565);if(_0x118fd0[_0x220c('0x31')][_0x220c('0x3b')]){_0x4a8ae3['where']=_[_0x220c('0x3c')](_0x4a8ae3[_0x220c('0x3d')],{'$or':_[_0x220c('0x30')](_0x593565,function(_0x559522){if(_0x559522[_0x220c('0x2f')]!==_0x220c('0x3e')){var _0x3fb5a4={};_0x3fb5a4[_0x559522[_0x220c('0x2a')]]={'$like':'%'+_0x118fd0[_0x220c('0x31')][_0x220c('0x3b')]+'%'};return _0x3fb5a4;}})});}_0x4a8ae3=_[_0x220c('0x3c')]({},_0x4a8ae3,_0x118fd0[_0x220c('0x3f')]);var _0x3eeac7={'where':_0x4a8ae3[_0x220c('0x3d')]};return db[_0x220c('0x2d')][_0x220c('0x20')](_0x3eeac7)[_0x220c('0x26')](function(_0x38371d){_0x1df523['count']=_0x38371d;if(_0x118fd0[_0x220c('0x31')][_0x220c('0x40')]){_0x4a8ae3[_0x220c('0x41')]=[{'all':!![]}];}return db[_0x220c('0x2d')]['findAll'](_0x4a8ae3);})[_0x220c('0x26')](function(_0x57fa3f){_0x1df523['rows']=_0x57fa3f;return _0x1df523;})[_0x220c('0x26')](respondWithFilteredResult(_0x5c7351,_0x4a8ae3))[_0x220c('0x42')](handleError(_0x5c7351,null));};exports['show']=function(_0x3535da,_0x2acf64){var _0x412a50={'raw':!![],'where':{'id':_0x3535da[_0x220c('0x43')]['id']}},_0x3bf3eb={};_0x3bf3eb['model']=_['keys'](db[_0x220c('0x2d')][_0x220c('0x2e')]);_0x3bf3eb[_0x220c('0x31')]=_['keys'](_0x3535da[_0x220c('0x31')]);_0x3bf3eb[_0x220c('0x44')]=_[_0x220c('0x33')](_0x3bf3eb[_0x220c('0x34')],_0x3bf3eb[_0x220c('0x31')]);_0x412a50[_0x220c('0x35')]=_[_0x220c('0x33')](_0x3bf3eb['model'],qs['fields'](_0x3535da['query'][_0x220c('0x36')]));_0x412a50[_0x220c('0x35')]=_0x412a50[_0x220c('0x35')][_0x220c('0x45')]?_0x412a50[_0x220c('0x35')]:_0x3bf3eb['model'];if(_0x3535da[_0x220c('0x31')][_0x220c('0x40')]){_0x412a50['include']=[{'all':!![]}];}_0x412a50=_[_0x220c('0x3c')]({},_0x412a50,_0x3535da['options']);return db['WhatsappQueue'][_0x220c('0x46')](_0x412a50)[_0x220c('0x26')](handleEntityNotFound(_0x2acf64,null))[_0x220c('0x26')](respondWithResult(_0x2acf64,null))[_0x220c('0x42')](handleError(_0x2acf64,null));};exports[_0x220c('0x47')]=function(_0x14df92,_0x1d04e3){return db[_0x220c('0x2d')][_0x220c('0x47')](_0x14df92[_0x220c('0x48')],{})[_0x220c('0x26')](function(_0x5b3dfd){var _0x506c3a=_0x14df92[_0x220c('0x49')][_0x220c('0x28')]({'plain':!![]});if(!_0x506c3a)throw new Error(_0x220c('0x4a'));if(_0x506c3a[_0x220c('0x4b')]==='user'){var _0x42ea1e=_0x5b3dfd[_0x220c('0x28')]({'plain':!![]});var _0x172054=_0x220c('0x4c');return db[_0x220c('0x4d')][_0x220c('0x46')]({'where':{'name':_0x172054,'userProfileId':_0x506c3a[_0x220c('0x4e')]},'raw':!![]})[_0x220c('0x26')](function(_0x4a87d7){if(_0x4a87d7&&_0x4a87d7[_0x220c('0x4f')]===0x0){return db['UserProfileResource'][_0x220c('0x47')]({'name':_0x42ea1e[_0x220c('0x2a')],'resourceId':_0x42ea1e['id'],'type':_0x4a87d7[_0x220c('0x2a')],'sectionId':_0x4a87d7['id']},{})['then'](function(){return _0x5b3dfd;});}else{return _0x5b3dfd;}})['catch'](function(_0x4989d3){logger[_0x220c('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4989d3);throw _0x4989d3;});}return _0x5b3dfd;})[_0x220c('0x26')](respondWithResult(_0x1d04e3,0xc9))[_0x220c('0x42')](handleError(_0x1d04e3,null));};exports[_0x220c('0x51')]=function(_0x481477,_0x3acc17){if(_0x481477[_0x220c('0x48')]['id']){delete _0x481477[_0x220c('0x48')]['id'];}return db[_0x220c('0x2d')]['find']({'where':{'id':_0x481477[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x3acc17,null))[_0x220c('0x26')](saveUpdates(_0x481477['body'],null))['then'](respondWithResult(_0x3acc17,null))[_0x220c('0x42')](handleError(_0x3acc17,null));};exports['destroy']=function(_0x467459,_0x7c3be2){return db[_0x220c('0x2d')][_0x220c('0x46')]({'where':{'id':_0x467459[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x7c3be2,null))[_0x220c('0x26')](removeEntity(_0x7c3be2,null))[_0x220c('0x42')](handleError(_0x7c3be2,null));};exports[_0x220c('0x52')]=function(_0x81f83b,_0x1c737d){return db[_0x220c('0x2d')]['describe']()[_0x220c('0x26')](respondWithResult(_0x1c737d,null))[_0x220c('0x42')](handleError(_0x1c737d,null));};exports[_0x220c('0x53')]=function(_0x23dee0,_0x41f5fe,_0xa26f65){var _0x36ca64={'raw':!![],'where':{}},_0x56c4b3={},_0x4a968d;return db[_0x220c('0x2d')]['findOne']({'where':{'id':_0x23dee0[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x41f5fe,null))[_0x220c('0x26')](function(_0x5998f0){if(_0x5998f0){_0x4a968d=_0x5998f0[_0x220c('0x28')]({'plain':!![]});_0x56c4b3[_0x220c('0x34')]=_[_0x220c('0x32')](db['UserWhatsappQueue'][_0x220c('0x2e')]);_0x56c4b3[_0x220c('0x31')]=_['keys'](_0x23dee0[_0x220c('0x31')]);_0x56c4b3[_0x220c('0x44')]=_[_0x220c('0x33')](_0x56c4b3[_0x220c('0x34')],_0x56c4b3['query']);_0x36ca64[_0x220c('0x35')]=_[_0x220c('0x33')](_0x56c4b3[_0x220c('0x34')],qs[_0x220c('0x36')](_0x23dee0[_0x220c('0x31')]['fields']));_0x36ca64['attributes']=_0x36ca64['attributes'][_0x220c('0x45')]?_0x36ca64[_0x220c('0x35')]:_0x56c4b3['model'];if(!_0x23dee0[_0x220c('0x31')][_0x220c('0x37')](_0x220c('0x38'))){_0x36ca64[_0x220c('0x1f')]=qs[_0x220c('0x1f')](_0x23dee0[_0x220c('0x31')]['limit']);_0x36ca64[_0x220c('0x1d')]=qs[_0x220c('0x1d')](_0x23dee0[_0x220c('0x31')][_0x220c('0x1d')]);}_0x36ca64['order']=qs[_0x220c('0x3a')](_0x23dee0[_0x220c('0x31')]['sort']);_0x36ca64['where']=qs[_0x220c('0x44')](_[_0x220c('0x54')](_0x23dee0['query'],_0x56c4b3[_0x220c('0x44')]));_0x36ca64['where'][_0x220c('0x55')]=_0x5998f0['id'];if(_0x23dee0[_0x220c('0x31')][_0x220c('0x3b')]){_0x36ca64[_0x220c('0x3d')]=_[_0x220c('0x3c')](_0x36ca64[_0x220c('0x3d')],{'$or':_[_0x220c('0x30')](_0x36ca64[_0x220c('0x35')],function(_0x4244f5){var _0x2a8994={};_0x2a8994[_0x4244f5]={'$like':'%'+_0x23dee0['query'][_0x220c('0x3b')]+'%'};return _0x2a8994;})});}_0x36ca64=_[_0x220c('0x3c')]({},_0x36ca64,_0x23dee0[_0x220c('0x3f')]);return db[_0x220c('0x56')][_0x220c('0x57')](_0x36ca64);}})['then'](function(_0x47851e){if(_0x47851e){return db['User']['findAndCountAll']({'where':{'id':_[_0x220c('0x30')](_0x47851e,_0x220c('0x58')),'role':_0x220c('0x59')},'attributes':['id','name',_0x220c('0x5a'),_0x220c('0x5b'),'createdAt']});}})['then'](function(_0x3021a6){if(_0x3021a6){return{'count':_0x3021a6[_0x220c('0x20')],'rows':_['map'](_0x3021a6[_0x220c('0x5c')],function(_0x4d2553){return{'membername':_0x4d2553[_0x220c('0x2a')],'UserId':_0x4d2553['id'],'queue_name':_0x4a968d[_0x220c('0x2a')],'WhatsappQueueId':_0x4a968d['id'],'interface':util[_0x220c('0x5d')]('%s/%s',_0x220c('0x5e'),_0x4d2553['name']),'penalty':0x0,'paused':_0x4d2553['whatsappPause'],'createdAt':_0x4d2553['createdAt'],'updatedAt':_0x4d2553['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x220c('0x26')](respondWithFilteredResult(_0x41f5fe,_0x36ca64))[_0x220c('0x42')](handleError(_0x41f5fe,null));};exports[_0x220c('0x5f')]=function(_0x53422f,_0x45d114,_0x3a733b){var _0x1a0003={};var _0x268f4f={};var _0x1dd7a4;var _0x5abbf5;return db[_0x220c('0x2d')][_0x220c('0x60')]({'where':{'id':_0x53422f[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x45d114,null))[_0x220c('0x26')](function(_0x57c8b0){if(_0x57c8b0){_0x1dd7a4=_0x57c8b0;_0x268f4f['model']=_[_0x220c('0x32')](db['Team'][_0x220c('0x2e')]);_0x268f4f[_0x220c('0x31')]=_[_0x220c('0x32')](_0x53422f[_0x220c('0x31')]);_0x268f4f['filters']=_['intersection'](_0x268f4f['model'],_0x268f4f[_0x220c('0x31')]);_0x1a0003[_0x220c('0x35')]=_[_0x220c('0x33')](_0x268f4f[_0x220c('0x34')],qs[_0x220c('0x36')](_0x53422f['query']['fields']));_0x1a0003[_0x220c('0x35')]=_0x1a0003['attributes'][_0x220c('0x45')]?_0x1a0003[_0x220c('0x35')]:_0x268f4f[_0x220c('0x34')];_0x1a0003['order']=qs[_0x220c('0x3a')](_0x53422f['query'][_0x220c('0x3a')]);_0x1a0003[_0x220c('0x3d')]=qs[_0x220c('0x44')](_[_0x220c('0x54')](_0x53422f[_0x220c('0x31')],_0x268f4f[_0x220c('0x44')]));if(_0x53422f[_0x220c('0x31')]['filter']){_0x1a0003[_0x220c('0x3d')]=_[_0x220c('0x3c')](_0x1a0003[_0x220c('0x3d')],{'$or':_[_0x220c('0x30')](_0x1a0003[_0x220c('0x35')],function(_0x10ae48){var _0x186f79={};_0x186f79[_0x10ae48]={'$like':'%'+_0x53422f[_0x220c('0x31')]['filter']+'%'};return _0x186f79;})});}_0x1a0003=_[_0x220c('0x3c')]({},_0x1a0003,_0x53422f['options']);return _0x1dd7a4[_0x220c('0x5f')](_0x1a0003);}})['then'](function(_0x865f60){if(_0x865f60){_0x5abbf5=_0x865f60[_0x220c('0x45')];if(!_0x53422f[_0x220c('0x31')][_0x220c('0x37')](_0x220c('0x38'))){_0x1a0003[_0x220c('0x1f')]=qs['limit'](_0x53422f['query']['limit']);_0x1a0003['offset']=qs['offset'](_0x53422f[_0x220c('0x31')]['offset']);}return _0x1dd7a4[_0x220c('0x5f')](_0x1a0003);}})[_0x220c('0x26')](function(_0x3ad5ba){if(_0x3ad5ba){return _0x3ad5ba?{'count':_0x5abbf5,'rows':_0x3ad5ba}:null;}})[_0x220c('0x26')](respondWithResult(_0x45d114,null))[_0x220c('0x42')](handleError(_0x45d114,null));};exports[_0x220c('0x61')]=function(_0x158ca3,_0xf69c9,_0xc44e20){var _0x311d2d=_0x158ca3['body'][_0x220c('0x62')];return db[_0x220c('0x63')][_0x220c('0x57')]({'where':{'id':_0x311d2d},'attributes':['id'],'include':[{'model':db[_0x220c('0x64')],'as':_0x220c('0x65'),'attributes':['id',_0x220c('0x2a'),_0x220c('0x66'),_0x220c('0x67'),_0x220c('0x68')],'raw':!![]}]})['then'](function(_0x187576){if(_0x187576){var _0x2fa724=_[_0x220c('0x69')](_0x187576,function(_0x59b581){var _0x77eb54=_0x59b581[_0x220c('0x28')]({'plain':!![]});return _0x77eb54[_0x220c('0x65')];});return db[_0x220c('0x2d')][_0x220c('0x46')]({'where':{'id':_0x158ca3['params']['id']}})['then'](function(_0x552396){return db[_0x220c('0x6a')][_0x220c('0x6b')](function(_0x4b9550){return _0x552396[_0x220c('0x61')](_0x311d2d,{'transaction':_0x4b9550})[_0x220c('0x26')](function(){return BPromise[_0x220c('0x6c')](_0x2fa724,function(_0x58b196){return db[_0x220c('0x56')]['findOrCreate']({'where':{'UserId':_0x58b196['id'],'WhatsappQueueId':_0x158ca3[_0x220c('0x43')]['id']},'transaction':_0x4b9550});});})[_0x220c('0x26')](function(){_0x2fa724[_0x220c('0x6d')](function(_0x3391b7){socket[_0x220c('0x6e')]('userWhatsappQueue:save',{'UserId':_0x3391b7['id'],'WhatsappQueueId':_0x552396['id']});});});});});}})[_0x220c('0x26')](respondWithStatusCode(_0xf69c9,null))[_0x220c('0x42')](handleError(_0xf69c9,null));};exports[_0x220c('0x6f')]=function(_0x353af8,_0x1dc5a9,_0x5b8601){return db[_0x220c('0x63')]['findAll']({'where':{'id':_0x353af8['query'][_0x220c('0x62')]},'attributes':['id'],'include':[{'model':db[_0x220c('0x64')],'as':_0x220c('0x65'),'attributes':['id'],'raw':!![]}]})[_0x220c('0x26')](handleEntityNotFound(_0x1dc5a9,null))[_0x220c('0x26')](function(_0x433587){var _0xd97242=_[_0x220c('0x30')](_0x433587,'id');var _0x18a289=[];var _0x4d7722=[];var _0x5918d7=squel[_0x220c('0x70')]();_0x5918d7['field'](_0x220c('0x71'))[_0x220c('0x72')]('team_has_whatsapp_queues','tq')[_0x220c('0x73')]('user_has_teams','ut',_0x220c('0x74'))['where'](_0x220c('0x75'),_0x353af8[_0x220c('0x43')]['id']);for(var _0x17a779=0x0;_0x17a779<_0x433587[_0x220c('0x45')];_0x17a779+=0x1){let _0x193ab8=_0x433587[_0x17a779];for(var _0x18cb75=0x0;_0x18cb75<_0x193ab8[_0x220c('0x65')][_0x220c('0x45')];_0x18cb75+=0x1){let _0x4a4d44=_0x193ab8[_0x220c('0x65')][_0x18cb75];var _0x1470eb=_0x5918d7[_0x220c('0x76')]();_0x1470eb[_0x220c('0x3d')](_0x220c('0x77'),_0x4a4d44['id']);_0x4d7722[_0x220c('0x78')](db[_0x220c('0x6a')][_0x220c('0x31')](_0x1470eb['toString'](),{'type':db['sequelize'][_0x220c('0x79')][_0x220c('0x7a')]})['then'](function(_0x573788){if(_0x573788[_0x220c('0x45')]===0x1){return _0x4a4d44['id'];}else{var _0x16ee82=_[_0x220c('0x7b')](_[_0x220c('0x30')](_0x573788,_0x220c('0x7c')),function(_0x6b66dd){return _[_0x220c('0x7d')](_0xd97242,_0x6b66dd);});if(_0x16ee82){return _0x4a4d44['id'];}}}));}}return BPromise[_0x220c('0x7e')](_0x4d7722)[_0x220c('0x26')](function(_0x3f0873){_0x18a289=_(_0x18a289)[_0x220c('0x7f')](_0x3f0873)['compact']()['value']();return db[_0x220c('0x2d')][_0x220c('0x46')]({'where':{'id':_0x353af8[_0x220c('0x43')]['id']}})[_0x220c('0x26')](function(_0x556527){return db[_0x220c('0x6a')][_0x220c('0x6b')](function(_0x4b4733){return _0x556527[_0x220c('0x6f')](_0x353af8[_0x220c('0x31')][_0x220c('0x62')],{'transaction':_0x4b4733})[_0x220c('0x26')](function(){if(!_[_0x220c('0x80')](_0x18a289)){return _0x556527[_0x220c('0x81')](_0x18a289,{'transaction':_0x4b4733});}})[_0x220c('0x26')](function(){_0x18a289[_0x220c('0x6d')](function(_0x1356a7){socket[_0x220c('0x6e')](_0x220c('0x82'),{'UserId':_0x1356a7,'WhatsappQueueId':_0x556527['id']});});});});});});})[_0x220c('0x26')](respondWithStatusCode(_0x1dc5a9,null))[_0x220c('0x42')](handleError(_0x1dc5a9,null));};exports[_0x220c('0x83')]=function(_0x512e3e,_0x3d7e6b,_0x35fb8d){return db[_0x220c('0x2d')][_0x220c('0x46')]({'where':{'id':_0x512e3e[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x3d7e6b,null))[_0x220c('0x26')](function(_0x49054e){if(_0x49054e){return _0x49054e[_0x220c('0x83')](_0x512e3e[_0x220c('0x48')][_0x220c('0x62')],_['omit'](_0x512e3e[_0x220c('0x48')],[_0x220c('0x62'),'id'])||{})[_0x220c('0x84')](function(_0x487db4){for(var _0x387d7c=0x0;_0x387d7c<_0x512e3e[_0x220c('0x48')][_0x220c('0x62')][_0x220c('0x45')];_0x387d7c+=0x1){socket[_0x220c('0x6e')]('userWhatsappQueue:save',{'UserId':Number(_0x512e3e[_0x220c('0x48')][_0x220c('0x62')][_0x387d7c]),'WhatsappQueueId':Number(_0x512e3e[_0x220c('0x43')]['id'])});}return _0x487db4;});}})['then'](respondWithResult(_0x3d7e6b,null))[_0x220c('0x42')](handleError(_0x3d7e6b,null));};exports[_0x220c('0x81')]=function(_0x439934,_0x16eee6,_0x3e0ed5){return db[_0x220c('0x2d')]['find']({'where':{'id':_0x439934[_0x220c('0x43')]['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x16eee6,null))[_0x220c('0x26')](function(_0x5ed9a5){if(_0x5ed9a5){return _0x5ed9a5[_0x220c('0x81')](_0x439934[_0x220c('0x31')][_0x220c('0x62')])[_0x220c('0x26')](function(){if(_[_0x220c('0x85')](_0x439934[_0x220c('0x31')]['ids'])){for(var _0x216e76=0x0;_0x216e76<_0x439934[_0x220c('0x31')][_0x220c('0x62')][_0x220c('0x45')];_0x216e76+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x439934[_0x220c('0x31')][_0x220c('0x62')][_0x216e76]),'WhatsappQueueId':Number(_0x439934[_0x220c('0x43')]['id'])});}}else{socket[_0x220c('0x6e')](_0x220c('0x82'),{'UserId':Number(_0x439934[_0x220c('0x31')][_0x220c('0x62')]),'WhatsappQueueId':Number(_0x439934[_0x220c('0x43')]['id'])});}});}})[_0x220c('0x26')](respondWithStatusCode(_0x16eee6,null))['catch'](handleError(_0x16eee6,null));};exports[_0x220c('0x86')]=function(_0x58a9e8,_0x176bac,_0x58e705){var _0x11878e={};var _0x3ba4e5={};var _0xa13d96;var _0x349570;return db['WhatsappQueue'][_0x220c('0x60')]({'where':{'id':_0x58a9e8['params']['id']}})[_0x220c('0x26')](handleEntityNotFound(_0x176bac,null))['then'](function(_0x47d2b3){if(_0x47d2b3){_0xa13d96=_0x47d2b3;_0x3ba4e5[_0x220c('0x34')]=_[_0x220c('0x32')](db[_0x220c('0x64')][_0x220c('0x2e')]);_0x3ba4e5[_0x220c('0x31')]=_[_0x220c('0x32')](_0x58a9e8[_0x220c('0x31')]);_0x3ba4e5[_0x220c('0x44')]=_[_0x220c('0x33')](_0x3ba4e5[_0x220c('0x34')],_0x3ba4e5[_0x220c('0x31')]);_0x11878e['attributes']=_[_0x220c('0x33')](_0x3ba4e5[_0x220c('0x34')],qs['fields'](_0x58a9e8['query']['fields']));_0x11878e[_0x220c('0x35')]=_0x11878e[_0x220c('0x35')][_0x220c('0x45')]?_0x11878e[_0x220c('0x35')]:_0x3ba4e5['model'];_0x11878e['order']=qs[_0x220c('0x3a')](_0x58a9e8['query']['sort']);_0x11878e[_0x220c('0x3d')]=qs['filters'](_['pick'](_0x58a9e8[_0x220c('0x31')],_0x3ba4e5[_0x220c('0x44')]));if(_0x58a9e8[_0x220c('0x31')]['filter']){_0x11878e[_0x220c('0x3d')]=_[_0x220c('0x3c')](_0x11878e[_0x220c('0x3d')],{'$or':_[_0x220c('0x30')](_0x11878e[_0x220c('0x35')],function(_0x595f1b){var _0x2bb028={};_0x2bb028[_0x595f1b]={'$like':'%'+_0x58a9e8[_0x220c('0x31')][_0x220c('0x3b')]+'%'};return _0x2bb028;})});}_0x11878e=_['merge']({},_0x11878e,_0x58a9e8[_0x220c('0x3f')]);return _0xa13d96[_0x220c('0x86')](_0x11878e);}})['then'](function(_0x5839b4){if(_0x5839b4){_0x349570=_0x5839b4[_0x220c('0x45')];if(!_0x58a9e8[_0x220c('0x31')]['hasOwnProperty'](_0x220c('0x38'))){_0x11878e[_0x220c('0x1f')]=qs[_0x220c('0x1f')](_0x58a9e8[_0x220c('0x31')][_0x220c('0x1f')]);_0x11878e[_0x220c('0x1d')]=qs[_0x220c('0x1d')](_0x58a9e8[_0x220c('0x31')][_0x220c('0x1d')]);}return _0xa13d96[_0x220c('0x86')](_0x11878e);}})[_0x220c('0x26')](function(_0x38397a){if(_0x38397a){return _0x38397a?{'count':_0x349570,'rows':_0x38397a}:null;}})[_0x220c('0x26')](respondWithResult(_0x176bac,null))['catch'](handleError(_0x176bac,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 51c3990..4daa1fa 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 _0xbc33=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x496222,_0x148114){var _0x5bd66f=function(_0xaae1a7){while(--_0xaae1a7){_0x496222['push'](_0x496222['shift']());}};_0x5bd66f(++_0x148114);}(_0xbc33,0xd2));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3bc3('0x0'));var WhatsappQueue=require(_0x3bc3('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bc3('0x2'),'afterUpdate':_0x3bc3('0x3'),'afterDestroy':_0x3bc3('0x4')};function emitEvent(_0x473e74){return function(_0x272f6f,_0x5f1563,_0x23f5ca){WhatsappQueueEvents[_0x3bc3('0x5')](_0x473e74+':'+_0x272f6f['id'],_0x272f6f);WhatsappQueueEvents[_0x3bc3('0x5')](_0x473e74,_0x272f6f);_0x23f5ca(null);};}for(var e in events){if(events[_0x3bc3('0x6')](e)){var event=events[e];WhatsappQueue[_0x3bc3('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xaf07=['hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save','update','emit'];(function(_0x1693cf,_0x2ccbcc){var _0x56b509=function(_0x412646){while(--_0x412646){_0x1693cf['push'](_0x1693cf['shift']());}};_0x56b509(++_0x2ccbcc);}(_0xaf07,0x1c5));var _0x7af0=function(_0x2817f3,_0x93783a){_0x2817f3=_0x2817f3-0x0;var _0x3cb244=_0xaf07[_0x2817f3];return _0x3cb244;};'use strict';var EventEmitter=require(_0x7af0('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x7af0('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7af0('0x2')](0x0);var events={'afterCreate':_0x7af0('0x3'),'afterUpdate':_0x7af0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3eef59){return function(_0x274b38,_0x38e8be,_0x9d0a24){WhatsappQueueEvents['emit'](_0x3eef59+':'+_0x274b38['id'],_0x274b38);WhatsappQueueEvents[_0x7af0('0x5')](_0x3eef59,_0x274b38);_0x9d0a24(null);};}for(var e in events){if(events[_0x7af0('0x6')](e)){var event=events[e];WhatsappQueue[_0x7af0('0x7')](e,emitEvent(event));}}module[_0x7af0('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ab1832e..841616b 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 _0x54c6=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x54c6,0x1ce));var _0x654c=function(_0x4eda88,_0x3cf42f){_0x4eda88=_0x4eda88-0x0;var _0xa891d3=_0x54c6[_0x4eda88];return _0xa891d3;};'use strict';var _=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var logger=require(_0x654c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x654c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x654c('0x4'));var rimraf=require(_0x654c('0x5'));var config=require(_0x654c('0x6'));var attributes=require(_0x654c('0x7'));module['exports']=function(_0x37d1f1,_0x57b145){return _0x37d1f1[_0x654c('0x8')](_0x654c('0x9'),attributes,{'tableName':_0x654c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d65=['moment','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6d65,0x134));var _0x56d6=function(_0x338801,_0x1ff4af){_0x338801=_0x338801-0x0;var _0x4a47dc=_0x6d65[_0x338801];return _0x4a47dc;};'use strict';var _=require(_0x56d6('0x0'));var util=require(_0x56d6('0x1'));var logger=require(_0x56d6('0x2'))(_0x56d6('0x3'));var moment=require(_0x56d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x56d6('0x5'));var fs=require('fs');var path=require(_0x56d6('0x6'));var rimraf=require(_0x56d6('0x7'));var config=require('../../config/environment');var attributes=require(_0x56d6('0x8'));module[_0x56d6('0x9')]=function(_0x3dd5e6,_0x376325){return _0x3dd5e6[_0x56d6('0xa')]('WhatsappQueue',attributes,{'tableName':_0x56d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index eb5665a..ae84235 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 _0xd291=['then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','find','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x5080dd,_0x2be00c){var _0x134bcf=function(_0x41f9ac){while(--_0x41f9ac){_0x5080dd['push'](_0x5080dd['shift']());}};_0x134bcf(++_0x2be00c);}(_0xd291,0x14f));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var moment=require(_0x1d29('0x2'));var BPromise=require(_0x1d29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d29('0x4'))['db'];var utils=require(_0x1d29('0x5'));var logger=require('../../config/logger')(_0x1d29('0x6'));var config=require(_0x1d29('0x7'));var jayson=require(_0x1d29('0x8'));var client=jayson['client'][_0x1d29('0x9')]({'port':0x232a});config[_0x1d29('0xa')]=_[_0x1d29('0xb')](config[_0x1d29('0xa')],{'host':_0x1d29('0xc'),'port':0x18eb});var socket=require(_0x1d29('0xd'))(new Redis(config[_0x1d29('0xa')]));require('./whatsappQueue.socket')[_0x1d29('0xe')](socket);function respondWithRpcPromise(_0x479fc1,_0x1ea2af,_0x5277b1){return new BPromise(function(_0x48fd37,_0x2b16be){return client[_0x1d29('0xf')](_0x479fc1,_0x5277b1)[_0x1d29('0x10')](function(_0x522218){logger[_0x1d29('0x11')](_0x1d29('0x12'),_0x1ea2af,_0x1d29('0x13'));logger[_0x1d29('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1ea2af,'request\x20sent',JSON['stringify'](_0x522218));if(_0x522218['error']){if(_0x522218['error'][_0x1d29('0x15')]===0x1f4){logger[_0x1d29('0x16')](_0x1d29('0x12'),_0x1ea2af,_0x522218['error'][_0x1d29('0x17')]);return _0x2b16be(_0x522218['error'][_0x1d29('0x17')]);}logger[_0x1d29('0x16')](_0x1d29('0x12'),_0x1ea2af,_0x522218[_0x1d29('0x16')][_0x1d29('0x17')]);return _0x48fd37(_0x522218[_0x1d29('0x16')][_0x1d29('0x17')]);}else{logger[_0x1d29('0x11')](_0x1d29('0x12'),_0x1ea2af,'request\x20sent');_0x48fd37(_0x522218[_0x1d29('0x18')][_0x1d29('0x17')]);}})[_0x1d29('0x19')](function(_0x1bb944){logger[_0x1d29('0x16')](_0x1d29('0x12'),_0x1ea2af,_0x1bb944);_0x2b16be(_0x1bb944);});});}exports['GetWhatsappQueue']=function(_0x19ca2d){var _0x222d09=this;return new Promise(function(_0x399e97,_0x9475a2){return db['WhatsappQueue'][_0x1d29('0x1a')]({'raw':_0x19ca2d[_0x1d29('0x1b')]?_0x19ca2d[_0x1d29('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19ca2d[_0x1d29('0x1b')]?_0x19ca2d[_0x1d29('0x1b')][_0x1d29('0x1c')]||null:null,'attributes':_0x19ca2d[_0x1d29('0x1b')]?_0x19ca2d[_0x1d29('0x1b')][_0x1d29('0x1d')]||null:null,'limit':_0x19ca2d[_0x1d29('0x1b')]?_0x19ca2d['options'][_0x1d29('0x1e')]||null:null,'include':_0x19ca2d[_0x1d29('0x1b')]?_0x19ca2d[_0x1d29('0x1b')][_0x1d29('0x1f')]?_[_0x1d29('0x20')](_0x19ca2d['options']['include'],function(_0x520714){return{'model':db[_0x520714[_0x1d29('0x21')]],'as':_0x520714['as'],'attributes':_0x520714['attributes'],'include':_0x520714[_0x1d29('0x1f')]?_['map'](_0x520714[_0x1d29('0x1f')],function(_0x40130e){return{'model':db[_0x40130e[_0x1d29('0x21')]],'as':_0x40130e['as'],'attributes':_0x40130e[_0x1d29('0x1d')],'include':_0x40130e[_0x1d29('0x1f')]?_[_0x1d29('0x20')](_0x40130e[_0x1d29('0x1f')],function(_0x4276bd){return{'model':db[_0x4276bd[_0x1d29('0x21')]],'as':_0x4276bd['as'],'attributes':_0x4276bd[_0x1d29('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d29('0x10')](function(_0x132d0b){logger['info'](_0x1d29('0x22'),_0x19ca2d);logger[_0x1d29('0x14')]('GetWhatsappQueue',_0x19ca2d,JSON['stringify'](_0x132d0b));_0x399e97(_0x132d0b);})[_0x1d29('0x19')](function(_0x1f732e){logger[_0x1d29('0x16')](_0x1d29('0x22'),_0x1f732e[_0x1d29('0x17')],_0x19ca2d);_0x9475a2(_0x222d09['error'](0x1f4,_0x1f732e[_0x1d29('0x17')]));});});};exports[_0x1d29('0x23')]=function(_0x245c67){var _0x521722=this;return new Promise(function(_0x5d6507,_0x9d6e94){return db[_0x1d29('0x24')][_0x1d29('0x25')]({'raw':_0x245c67['options']?_0x245c67[_0x1d29('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x245c67['options']?_0x245c67[_0x1d29('0x1b')][_0x1d29('0x1c')]||null:null,'attributes':_0x245c67[_0x1d29('0x1b')]?_0x245c67['options'][_0x1d29('0x1d')]||null:null,'include':_0x245c67[_0x1d29('0x1b')]?_0x245c67[_0x1d29('0x1b')][_0x1d29('0x1f')]?_[_0x1d29('0x20')](_0x245c67[_0x1d29('0x1b')][_0x1d29('0x1f')],function(_0x5d79c7){return{'model':db[_0x5d79c7['model']],'as':_0x5d79c7['as'],'attributes':_0x5d79c7[_0x1d29('0x1d')],'include':_0x5d79c7['include']?_['map'](_0x5d79c7[_0x1d29('0x1f')],function(_0x548ade){return{'model':db[_0x548ade['model']],'as':_0x548ade['as'],'attributes':_0x548ade[_0x1d29('0x1d')],'include':_0x548ade[_0x1d29('0x1f')]?_['map'](_0x548ade[_0x1d29('0x1f')],function(_0x27256c){return{'model':db[_0x27256c[_0x1d29('0x21')]],'as':_0x27256c['as'],'attributes':_0x27256c[_0x1d29('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d29('0x10')](function(_0x1712bf){logger['info']('ShowWhatsappQueue',_0x245c67);logger[_0x1d29('0x14')](_0x1d29('0x23'),_0x245c67,JSON[_0x1d29('0x26')](_0x1712bf));_0x5d6507(_0x1712bf);})[_0x1d29('0x19')](function(_0x5de461){logger[_0x1d29('0x16')](_0x1d29('0x23'),_0x5de461[_0x1d29('0x17')],_0x245c67);_0x9d6e94(_0x521722[_0x1d29('0x16')](0x1f4,_0x5de461['message']));});});}; \ No newline at end of file +var _0xa9c8=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','debug','lodash','util'];(function(_0x1ad689,_0x118b49){var _0x3f99f8=function(_0x3b1b0d){while(--_0x3b1b0d){_0x1ad689['push'](_0x1ad689['shift']());}};_0x3f99f8(++_0x118b49);}(_0xa9c8,0x1a0));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a9c('0x0'));var util=require(_0x8a9c('0x1'));var moment=require('moment');var BPromise=require(_0x8a9c('0x2'));var rs=require(_0x8a9c('0x3'));var fs=require('fs');var Redis=require(_0x8a9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a9c('0x5'));var logger=require(_0x8a9c('0x6'))(_0x8a9c('0x7'));var config=require(_0x8a9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8a9c('0x9')]['http']({'port':0x232a});config[_0x8a9c('0xa')]=_[_0x8a9c('0xb')](config[_0x8a9c('0xa')],{'host':_0x8a9c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8a9c('0xd'))['register'](socket);function respondWithRpcPromise(_0x215c01,_0x479758,_0x39dd66){return new BPromise(function(_0x59b916,_0x4a8753){return client[_0x8a9c('0xe')](_0x215c01,_0x39dd66)[_0x8a9c('0xf')](function(_0x4fb47b){logger[_0x8a9c('0x10')](_0x8a9c('0x11'),_0x479758,_0x8a9c('0x12'));logger['debug'](_0x8a9c('0x13'),_0x479758,_0x8a9c('0x12'),JSON[_0x8a9c('0x14')](_0x4fb47b));if(_0x4fb47b[_0x8a9c('0x15')]){if(_0x4fb47b[_0x8a9c('0x15')][_0x8a9c('0x16')]===0x1f4){logger[_0x8a9c('0x15')](_0x8a9c('0x11'),_0x479758,_0x4fb47b[_0x8a9c('0x15')]['message']);return _0x4a8753(_0x4fb47b['error'][_0x8a9c('0x17')]);}logger[_0x8a9c('0x15')](_0x8a9c('0x11'),_0x479758,_0x4fb47b[_0x8a9c('0x15')][_0x8a9c('0x17')]);return _0x59b916(_0x4fb47b['error']['message']);}else{logger['info'](_0x8a9c('0x11'),_0x479758,_0x8a9c('0x12'));_0x59b916(_0x4fb47b['result'][_0x8a9c('0x17')]);}})[_0x8a9c('0x18')](function(_0x480032){logger[_0x8a9c('0x15')](_0x8a9c('0x11'),_0x479758,_0x480032);_0x4a8753(_0x480032);});});}exports[_0x8a9c('0x19')]=function(_0x60c938){var _0x3bcb45=this;return new Promise(function(_0x4d1c5a,_0x54c78d){return db[_0x8a9c('0x1a')][_0x8a9c('0x1b')]({'raw':_0x60c938[_0x8a9c('0x1c')]?_0x60c938[_0x8a9c('0x1c')][_0x8a9c('0x1d')]===undefined?!![]:![]:!![],'where':_0x60c938[_0x8a9c('0x1c')]?_0x60c938[_0x8a9c('0x1c')][_0x8a9c('0x1e')]||null:null,'attributes':_0x60c938['options']?_0x60c938[_0x8a9c('0x1c')][_0x8a9c('0x1f')]||null:null,'limit':_0x60c938[_0x8a9c('0x1c')]?_0x60c938['options'][_0x8a9c('0x20')]||null:null,'include':_0x60c938[_0x8a9c('0x1c')]?_0x60c938[_0x8a9c('0x1c')][_0x8a9c('0x21')]?_[_0x8a9c('0x22')](_0x60c938[_0x8a9c('0x1c')][_0x8a9c('0x21')],function(_0x7f0a3a){return{'model':db[_0x7f0a3a[_0x8a9c('0x23')]],'as':_0x7f0a3a['as'],'attributes':_0x7f0a3a[_0x8a9c('0x1f')],'include':_0x7f0a3a['include']?_[_0x8a9c('0x22')](_0x7f0a3a[_0x8a9c('0x21')],function(_0x460390){return{'model':db[_0x460390[_0x8a9c('0x23')]],'as':_0x460390['as'],'attributes':_0x460390[_0x8a9c('0x1f')],'include':_0x460390[_0x8a9c('0x21')]?_['map'](_0x460390[_0x8a9c('0x21')],function(_0xb4d485){return{'model':db[_0xb4d485[_0x8a9c('0x23')]],'as':_0xb4d485['as'],'attributes':_0xb4d485[_0x8a9c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8a9c('0xf')](function(_0x5ad4bf){logger[_0x8a9c('0x10')](_0x8a9c('0x19'),_0x60c938);logger['debug']('GetWhatsappQueue',_0x60c938,JSON[_0x8a9c('0x14')](_0x5ad4bf));_0x4d1c5a(_0x5ad4bf);})[_0x8a9c('0x18')](function(_0x4a9c2b){logger[_0x8a9c('0x15')](_0x8a9c('0x19'),_0x4a9c2b[_0x8a9c('0x17')],_0x60c938);_0x54c78d(_0x3bcb45['error'](0x1f4,_0x4a9c2b[_0x8a9c('0x17')]));});});};exports[_0x8a9c('0x24')]=function(_0x4f79e8){var _0x1be882=this;return new Promise(function(_0x4e463e,_0x5df715){return db[_0x8a9c('0x1a')]['find']({'raw':_0x4f79e8['options']?_0x4f79e8[_0x8a9c('0x1c')][_0x8a9c('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f79e8[_0x8a9c('0x1c')]?_0x4f79e8[_0x8a9c('0x1c')][_0x8a9c('0x1e')]||null:null,'attributes':_0x4f79e8[_0x8a9c('0x1c')]?_0x4f79e8[_0x8a9c('0x1c')][_0x8a9c('0x1f')]||null:null,'include':_0x4f79e8[_0x8a9c('0x1c')]?_0x4f79e8[_0x8a9c('0x1c')][_0x8a9c('0x21')]?_[_0x8a9c('0x22')](_0x4f79e8[_0x8a9c('0x1c')][_0x8a9c('0x21')],function(_0x2a98c7){return{'model':db[_0x2a98c7['model']],'as':_0x2a98c7['as'],'attributes':_0x2a98c7[_0x8a9c('0x1f')],'include':_0x2a98c7[_0x8a9c('0x21')]?_[_0x8a9c('0x22')](_0x2a98c7['include'],function(_0x44f492){return{'model':db[_0x44f492['model']],'as':_0x44f492['as'],'attributes':_0x44f492[_0x8a9c('0x1f')],'include':_0x44f492[_0x8a9c('0x21')]?_[_0x8a9c('0x22')](_0x44f492[_0x8a9c('0x21')],function(_0x1bbe60){return{'model':db[_0x1bbe60[_0x8a9c('0x23')]],'as':_0x1bbe60['as'],'attributes':_0x1bbe60[_0x8a9c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8a9c('0xf')](function(_0x31d8f8){logger[_0x8a9c('0x10')]('ShowWhatsappQueue',_0x4f79e8);logger[_0x8a9c('0x25')](_0x8a9c('0x24'),_0x4f79e8,JSON[_0x8a9c('0x14')](_0x31d8f8));_0x4e463e(_0x31d8f8);})['catch'](function(_0x345c8f){logger['error']('ShowWhatsappQueue',_0x345c8f[_0x8a9c('0x17')],_0x4f79e8);_0x5df715(_0x1be882[_0x8a9c('0x15')](0x1f4,_0x345c8f[_0x8a9c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 439e84f..67a5cde 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 _0xfbb5=['remove','emit','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfbb5,0xc9));var _0x5fbb=function(_0x2cd425,_0x4bb812){_0x2cd425=_0x2cd425-0x0;var _0x4ff711=_0xfbb5[_0x2cd425];return _0x4ff711;};'use strict';var WhatsappQueueEvents=require(_0x5fbb('0x0'));var events=[_0x5fbb('0x1'),_0x5fbb('0x2'),'update'];function createListener(_0xd3075d,_0x67a8b5){return function(_0x12ea6a){_0x67a8b5[_0x5fbb('0x3')](_0xd3075d,_0x12ea6a);};}function removeListener(_0x5182e8,_0x262e4d){return function(){WhatsappQueueEvents['removeListener'](_0x5182e8,_0x262e4d);};}exports[_0x5fbb('0x4')]=function(_0x4d4860){for(var _0x1ea6ae=0x0,_0x180544=events[_0x5fbb('0x5')];_0x1ea6ae<_0x180544;_0x1ea6ae++){var _0x5c2aa1=events[_0x1ea6ae];var _0x24507e=createListener(_0x5fbb('0x6')+_0x5c2aa1,_0x4d4860);WhatsappQueueEvents['on'](_0x5c2aa1,_0x24507e);}}; \ No newline at end of file +var _0xc3c4=['length','whatsappQueue:','remove','update','emit','removeListener'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc3c4,0xa4));var _0x4c3c=function(_0x26d106,_0x16260c){_0x26d106=_0x26d106-0x0;var _0x140f62=_0xc3c4[_0x26d106];return _0x140f62;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x4c3c('0x0'),_0x4c3c('0x1')];function createListener(_0x445e2b,_0x31d869){return function(_0x14c3d8){_0x31d869[_0x4c3c('0x2')](_0x445e2b,_0x14c3d8);};}function removeListener(_0x45dc1a,_0x40d022){return function(){WhatsappQueueEvents[_0x4c3c('0x3')](_0x45dc1a,_0x40d022);};}exports['register']=function(_0xdd967d){for(var _0x431315=0x0,_0x29604f=events[_0x4c3c('0x4')];_0x431315<_0x29604f;_0x431315++){var _0x4b23d2=events[_0x431315];var _0x40d385=createListener(_0x4c3c('0x5')+_0x4b23d2,_0xdd967d);WhatsappQueueEvents['on'](_0x4b23d2,_0x40d385);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d633b6c..a07c4fc 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 _0x9bd5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9bd5,0x6a));var _0x59bd=function(_0x31adfe,_0x35e451){_0x31adfe=_0x31adfe-0x0;var _0x186c87=_0x9bd5[_0x31adfe];return _0x186c87;};'use strict';var multer=require('multer');var util=require(_0x59bd('0x0'));var path=require(_0x59bd('0x1'));var timeout=require('connect-timeout');var express=require(_0x59bd('0x2'));var router=express[_0x59bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59bd('0x4'));var interaction=require(_0x59bd('0x5'));var config=require(_0x59bd('0x6'));var controller=require(_0x59bd('0x7'));router[_0x59bd('0x8')]('/',auth[_0x59bd('0x9')](),controller['index']);router[_0x59bd('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x59bd('0xa')]);router[_0x59bd('0x8')](_0x59bd('0xb'),auth[_0x59bd('0x9')](),controller['show']);router['post']('/',auth[_0x59bd('0x9')](),controller[_0x59bd('0xc')]);router[_0x59bd('0xd')](_0x59bd('0xb'),auth['isAuthenticated'](),controller[_0x59bd('0xe')]);router[_0x59bd('0xf')](_0x59bd('0xb'),auth[_0x59bd('0x9')](),controller[_0x59bd('0x10')]);module[_0x59bd('0x11')]=router; \ No newline at end of file +var _0x3b06=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x2b1e66,_0x2c3e5d){var _0x65ae2=function(_0x2a3a74){while(--_0x2a3a74){_0x2b1e66['push'](_0x2b1e66['shift']());}};_0x65ae2(++_0x2c3e5d);}(_0x3b06,0x1f0));var _0x63b0=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x3b06[_0x5c6299];return _0x23b564;};'use strict';var multer=require(_0x63b0('0x0'));var util=require(_0x63b0('0x1'));var path=require(_0x63b0('0x2'));var timeout=require(_0x63b0('0x3'));var express=require('express');var router=express[_0x63b0('0x4')]();var fs_extra=require(_0x63b0('0x5'));var auth=require(_0x63b0('0x6'));var interaction=require(_0x63b0('0x7'));var config=require(_0x63b0('0x8'));var controller=require(_0x63b0('0x9'));router[_0x63b0('0xa')]('/',auth[_0x63b0('0xb')](),controller[_0x63b0('0xc')]);router[_0x63b0('0xa')](_0x63b0('0xd'),auth[_0x63b0('0xb')](),controller[_0x63b0('0xe')]);router[_0x63b0('0xa')](_0x63b0('0xf'),auth[_0x63b0('0xb')](),controller[_0x63b0('0x10')]);router[_0x63b0('0x11')]('/',auth[_0x63b0('0xb')](),controller[_0x63b0('0x12')]);router[_0x63b0('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x63b0('0xb')](),controller[_0x63b0('0x14')]);module[_0x63b0('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 641f598..d051b92 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x363937,_0x2a5cc1){var _0x5be24d=function(_0xdbe6c2){while(--_0xdbe6c2){_0x363937['push'](_0x363937['shift']());}};_0x5be24d(++_0x2a5cc1);}(_0x7a54,0x106));var _0x47a5=function(_0x4178bc,_0x61a48f){_0x4178bc=_0x4178bc-0x0;var _0x52590f=_0x7a54[_0x4178bc];return _0x52590f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2c85fb,_0x548183){var _0x48ecb2=function(_0x3626cb){while(--_0x3626cb){_0x2c85fb['push'](_0x2c85fb['shift']());}};_0x48ecb2(++_0x548183);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'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 98017fc..8cd2738 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 _0x757a=['include','findAll','rows','show','params','WhatsappQueueReport','find','create','body','catch','destroy','describe','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','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','end','sendStatus','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x52fec6,_0x58e1bb){var _0x59391d=function(_0x4786d3){while(--_0x4786d3){_0x52fec6['push'](_0x52fec6['shift']());}};_0x59391d(++_0x58e1bb);}(_0x757a,0xde));var _0xa757=function(_0x22435c,_0x16a408){_0x22435c=_0x22435c-0x0;var _0x1f2987=_0x757a[_0x22435c];return _0x1f2987;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){_0x2ca10d['status'](0xcc)[_0xa757('0x1f')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x20')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x21')](_0xcd98bd[_0xa757('0x22')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x23')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}exports['index']=function(_0x4f8de2,_0xfdf69d){var _0x596ae2={},_0x2208f9={},_0x3bc24c={'count':0x0,'rows':[]};var _0x55c5f8=_[_0xa757('0x24')](db['WhatsappQueueReport'][_0xa757('0x25')],function(_0xa6d0f6){return{'name':_0xa6d0f6['fieldName'],'type':_0xa6d0f6[_0xa757('0x26')]['key']};});_0x2208f9[_0xa757('0x27')]=_[_0xa757('0x24')](_0x55c5f8,_0xa757('0x23'));_0x2208f9[_0xa757('0x28')]=_[_0xa757('0x29')](_0x4f8de2[_0xa757('0x28')]);_0x2208f9[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],_0x2208f9[_0xa757('0x28')]);_0x596ae2[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],qs[_0xa757('0x2d')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x2d')]));_0x596ae2[_0xa757('0x2c')]=_0x596ae2[_0xa757('0x2c')][_0xa757('0x2e')]?_0x596ae2[_0xa757('0x2c')]:_0x2208f9[_0xa757('0x27')];if(!_0x4f8de2[_0xa757('0x28')][_0xa757('0x2f')](_0xa757('0x30'))){_0x596ae2['limit']=qs[_0xa757('0x1a')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x1a')]);_0x596ae2[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4f8de2['query'][_0xa757('0x17')]);}_0x596ae2[_0xa757('0x31')]=qs[_0xa757('0x32')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x32')]);_0x596ae2[_0xa757('0x33')]=qs['filters'](_[_0xa757('0x34')](_0x4f8de2[_0xa757('0x28')],_0x2208f9[_0xa757('0x2a')]),_0x55c5f8);if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]){_0x596ae2[_0xa757('0x33')]=_[_0xa757('0x36')](_0x596ae2[_0xa757('0x33')],{'$or':_[_0xa757('0x24')](_0x55c5f8,function(_0x4f9d98){if(_0x4f9d98[_0xa757('0x26')]!==_0xa757('0x37')){var _0x9f73c6={};_0x9f73c6[_0x4f9d98[_0xa757('0x23')]]={'$like':'%'+_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]+'%'};return _0x9f73c6;}})});}_0x596ae2=_['merge']({},_0x596ae2,_0x4f8de2[_0xa757('0x38')]);var _0x6d77ed={'where':_0x596ae2['where']};return db['WhatsappQueueReport'][_0xa757('0x19')](_0x6d77ed)[_0xa757('0x1e')](function(_0x5b11fe){_0x3bc24c['count']=_0x5b11fe;if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x39')]){_0x596ae2[_0xa757('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa757('0x3b')](_0x596ae2);})[_0xa757('0x1e')](function(_0x26802c){_0x3bc24c[_0xa757('0x3c')]=_0x26802c;return _0x3bc24c;})[_0xa757('0x1e')](respondWithFilteredResult(_0xfdf69d,_0x596ae2))['catch'](handleError(_0xfdf69d,null));};exports[_0xa757('0x3d')]=function(_0x52c728,_0x564d40){var _0x43329c={'raw':!![],'where':{'id':_0x52c728[_0xa757('0x3e')]['id']}},_0x57298b={};_0x57298b[_0xa757('0x27')]=_[_0xa757('0x29')](db['WhatsappQueueReport']['rawAttributes']);_0x57298b[_0xa757('0x28')]=_[_0xa757('0x29')](_0x52c728[_0xa757('0x28')]);_0x57298b[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x57298b[_0xa757('0x27')],_0x57298b['query']);_0x43329c[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x57298b['model'],qs[_0xa757('0x2d')](_0x52c728['query'][_0xa757('0x2d')]));_0x43329c[_0xa757('0x2c')]=_0x43329c['attributes'][_0xa757('0x2e')]?_0x43329c[_0xa757('0x2c')]:_0x57298b['model'];if(_0x52c728[_0xa757('0x28')][_0xa757('0x39')]){_0x43329c[_0xa757('0x3a')]=[{'all':!![]}];}_0x43329c=_[_0xa757('0x36')]({},_0x43329c,_0x52c728['options']);return db[_0xa757('0x3f')][_0xa757('0x40')](_0x43329c)[_0xa757('0x1e')](handleEntityNotFound(_0x564d40,null))[_0xa757('0x1e')](respondWithResult(_0x564d40,null))['catch'](handleError(_0x564d40,null));};exports[_0xa757('0x41')]=function(_0x5b6017,_0x50c131){return db[_0xa757('0x3f')][_0xa757('0x41')](_0x5b6017[_0xa757('0x42')],{})['then'](respondWithResult(_0x50c131,0xc9))[_0xa757('0x43')](handleError(_0x50c131,null));};exports['update']=function(_0x2ed63f,_0x151cc3){if(_0x2ed63f[_0xa757('0x42')]['id']){delete _0x2ed63f[_0xa757('0x42')]['id'];}return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x2ed63f[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x151cc3,null))['then'](saveUpdates(_0x2ed63f[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0x151cc3,null))[_0xa757('0x43')](handleError(_0x151cc3,null));};exports[_0xa757('0x44')]=function(_0x319988,_0x1f10cf){return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x319988[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x1f10cf,null))[_0xa757('0x1e')](removeEntity(_0x1f10cf,null))[_0xa757('0x43')](handleError(_0x1f10cf,null));};exports[_0xa757('0x45')]=function(_0x354ad5,_0x388573){return db[_0xa757('0x3f')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x388573,null))['catch'](handleError(_0x388573,null));}; \ No newline at end of file +var _0x34b7=['WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','show','params','includeAll','include','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x34b7,0x196));var _0x734b=function(_0x4a1ec0,_0x26287b){_0x4a1ec0=_0x4a1ec0-0x0;var _0x49ab91=_0x34b7[_0x4a1ec0];return _0x49ab91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x26')]();});}};}function handleEntityNotFound(_0x3abbe6,_0x44ffa9){return function(_0x148abe){if(!_0x148abe){_0x3abbe6[_0x734b('0x18')](0x194);}return _0x148abe;};}function handleError(_0x566d55,_0x49732b){_0x49732b=_0x49732b||0x1f4;return function(_0x13cc5a){logger[_0x734b('0x27')](_0x13cc5a['stack']);if(_0x13cc5a[_0x734b('0x28')]){delete _0x13cc5a[_0x734b('0x28')];}_0x566d55[_0x734b('0x19')](_0x49732b)[_0x734b('0x29')](_0x13cc5a);};}exports[_0x734b('0x2a')]=function(_0x1b8295,_0x3ba39c){var _0x5c6c5d={},_0x1f3652={},_0x436efe={'count':0x0,'rows':[]};var _0x42e9ae=_[_0x734b('0x2b')](db[_0x734b('0x2c')][_0x734b('0x2d')],function(_0x1fed72){return{'name':_0x1fed72[_0x734b('0x2e')],'type':_0x1fed72[_0x734b('0x2f')][_0x734b('0x30')]};});_0x1f3652['model']=_[_0x734b('0x2b')](_0x42e9ae,_0x734b('0x28'));_0x1f3652['query']=_[_0x734b('0x31')](_0x1b8295[_0x734b('0x32')]);_0x1f3652[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],_0x1f3652[_0x734b('0x32')]);_0x5c6c5d[_0x734b('0x36')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],qs[_0x734b('0x37')](_0x1b8295[_0x734b('0x32')][_0x734b('0x37')]));_0x5c6c5d[_0x734b('0x36')]=_0x5c6c5d[_0x734b('0x36')][_0x734b('0x38')]?_0x5c6c5d['attributes']:_0x1f3652[_0x734b('0x35')];if(!_0x1b8295['query'][_0x734b('0x39')](_0x734b('0x3a'))){_0x5c6c5d[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x1b8295[_0x734b('0x32')][_0x734b('0x1e')]);_0x5c6c5d['offset']=qs['offset'](_0x1b8295[_0x734b('0x32')]['offset']);}_0x5c6c5d[_0x734b('0x3b')]=qs['sort'](_0x1b8295[_0x734b('0x32')]['sort']);_0x5c6c5d[_0x734b('0x3c')]=qs['filters'](_[_0x734b('0x3d')](_0x1b8295[_0x734b('0x32')],_0x1f3652[_0x734b('0x33')]),_0x42e9ae);if(_0x1b8295[_0x734b('0x32')][_0x734b('0x3e')]){_0x5c6c5d[_0x734b('0x3c')]=_[_0x734b('0x3f')](_0x5c6c5d['where'],{'$or':_[_0x734b('0x2b')](_0x42e9ae,function(_0x317d32){if(_0x317d32['type']!==_0x734b('0x40')){var _0x309b31={};_0x309b31[_0x317d32[_0x734b('0x28')]]={'$like':'%'+_0x1b8295[_0x734b('0x32')]['filter']+'%'};return _0x309b31;}})});}_0x5c6c5d=_[_0x734b('0x3f')]({},_0x5c6c5d,_0x1b8295[_0x734b('0x41')]);var _0x4efb1f={'where':_0x5c6c5d[_0x734b('0x3c')]};return db[_0x734b('0x2c')]['count'](_0x4efb1f)[_0x734b('0x24')](function(_0x2d8f31){_0x436efe[_0x734b('0x1d')]=_0x2d8f31;if(_0x1b8295[_0x734b('0x32')]['includeAll']){_0x5c6c5d['include']=[{'all':!![]}];}return db[_0x734b('0x2c')]['findAll'](_0x5c6c5d);})['then'](function(_0x121a00){_0x436efe['rows']=_0x121a00;return _0x436efe;})[_0x734b('0x24')](respondWithFilteredResult(_0x3ba39c,_0x5c6c5d))['catch'](handleError(_0x3ba39c,null));};exports[_0x734b('0x42')]=function(_0x337106,_0xe4fe38){var _0x4c3fdc={'raw':!![],'where':{'id':_0x337106[_0x734b('0x43')]['id']}},_0x5cf3a0={};_0x5cf3a0['model']=_['keys'](db[_0x734b('0x2c')][_0x734b('0x2d')]);_0x5cf3a0['query']=_[_0x734b('0x31')](_0x337106['query']);_0x5cf3a0[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],_0x5cf3a0['query']);_0x4c3fdc[_0x734b('0x36')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],qs[_0x734b('0x37')](_0x337106['query']['fields']));_0x4c3fdc['attributes']=_0x4c3fdc[_0x734b('0x36')]['length']?_0x4c3fdc['attributes']:_0x5cf3a0[_0x734b('0x35')];if(_0x337106['query'][_0x734b('0x44')]){_0x4c3fdc[_0x734b('0x45')]=[{'all':!![]}];}_0x4c3fdc=_[_0x734b('0x3f')]({},_0x4c3fdc,_0x337106[_0x734b('0x41')]);return db['WhatsappQueueReport'][_0x734b('0x46')](_0x4c3fdc)['then'](handleEntityNotFound(_0xe4fe38,null))[_0x734b('0x24')](respondWithResult(_0xe4fe38,null))[_0x734b('0x47')](handleError(_0xe4fe38,null));};exports[_0x734b('0x48')]=function(_0x5cdacb,_0x370326){return db['WhatsappQueueReport'][_0x734b('0x48')](_0x5cdacb[_0x734b('0x49')],{})['then'](respondWithResult(_0x370326,0xc9))[_0x734b('0x47')](handleError(_0x370326,null));};exports[_0x734b('0x4a')]=function(_0x145ced,_0x38125a){if(_0x145ced[_0x734b('0x49')]['id']){delete _0x145ced['body']['id'];}return db[_0x734b('0x2c')]['find']({'where':{'id':_0x145ced[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x38125a,null))[_0x734b('0x24')](saveUpdates(_0x145ced[_0x734b('0x49')],null))[_0x734b('0x24')](respondWithResult(_0x38125a,null))[_0x734b('0x47')](handleError(_0x38125a,null));};exports[_0x734b('0x25')]=function(_0x4b70f2,_0x4c0378){return db['WhatsappQueueReport'][_0x734b('0x46')]({'where':{'id':_0x4b70f2[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c0378,null))[_0x734b('0x24')](removeEntity(_0x4c0378,null))[_0x734b('0x47')](handleError(_0x4c0378,null));};exports['describe']=function(_0x167173,_0x3a9749){return db[_0x734b('0x2c')]['describe']()[_0x734b('0x24')](respondWithResult(_0x3a9749,null))[_0x734b('0x47')](handleError(_0x3a9749,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1d0b4af..0c3a660 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 _0x39b6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39b6,0x88));var _0x639b=function(_0x5f1722,_0x241691){_0x5f1722=_0x5f1722-0x0;var _0x1f4ce3=_0x39b6[_0x5f1722];return _0x1f4ce3;};'use strict';var _=require(_0x639b('0x0'));var util=require(_0x639b('0x1'));var logger=require(_0x639b('0x2'))(_0x639b('0x3'));var moment=require('moment');var BPromise=require(_0x639b('0x4'));var rp=require(_0x639b('0x5'));var fs=require('fs');var path=require(_0x639b('0x6'));var rimraf=require(_0x639b('0x7'));var config=require(_0x639b('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x639b('0x9')]=function(_0x198e74,_0x38947b){return _0x198e74[_0x639b('0xa')](_0x639b('0xb'),attributes,{'tableName':_0x639b('0xc'),'paranoid':![],'indexes':[{'name':_0x639b('0xd'),'fields':[_0x639b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68ef=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ef,0x161));var _0xf68e=function(_0x206b96,_0x5b5bb4){_0x206b96=_0x206b96-0x0;var _0x3d0454=_0x68ef[_0x206b96];return _0x3d0454;};'use strict';var _=require(_0xf68e('0x0'));var util=require(_0xf68e('0x1'));var logger=require('../../config/logger')(_0xf68e('0x2'));var moment=require(_0xf68e('0x3'));var BPromise=require(_0xf68e('0x4'));var rp=require(_0xf68e('0x5'));var fs=require('fs');var path=require(_0xf68e('0x6'));var rimraf=require(_0xf68e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf68e('0x8'));module[_0xf68e('0x9')]=function(_0x2999b6,_0x3f5dee){return _0x2999b6[_0xf68e('0xa')](_0xf68e('0xb'),attributes,{'tableName':_0xf68e('0xc'),'paranoid':![],'indexes':[{'name':_0xf68e('0xd'),'fields':[_0xf68e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c5fc216..22bc587 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 _0x6a3a=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x50f509,_0x16ebe8){var _0x532391=function(_0x248795){while(--_0x248795){_0x50f509['push'](_0x50f509['shift']());}};_0x532391(++_0x16ebe8);}(_0x6a3a,0x1ad));var _0xa6a3=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x6a3a[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xa6a3('0x0'));var util=require(_0xa6a3('0x1'));var moment=require(_0xa6a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6a3('0x3'));var fs=require('fs');var Redis=require(_0xa6a3('0x4'));var db=require(_0xa6a3('0x5'))['db'];var utils=require(_0xa6a3('0x6'));var logger=require(_0xa6a3('0x7'))(_0xa6a3('0x8'));var config=require(_0xa6a3('0x9'));var jayson=require(_0xa6a3('0xa'));var client=jayson[_0xa6a3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5379,_0x14d42a,_0x3b1da0){return new BPromise(function(_0x5474a3,_0x48e2e6){return client['request'](_0x4e5379,_0x3b1da0)['then'](function(_0x4c1bba){logger[_0xa6a3('0xc')](_0xa6a3('0xd'),_0x14d42a,_0xa6a3('0xe'));logger[_0xa6a3('0xf')](_0xa6a3('0x10'),_0x14d42a,_0xa6a3('0xe'),JSON[_0xa6a3('0x11')](_0x4c1bba));if(_0x4c1bba[_0xa6a3('0x12')]){if(_0x4c1bba[_0xa6a3('0x12')][_0xa6a3('0x13')]===0x1f4){logger[_0xa6a3('0x12')](_0xa6a3('0xd'),_0x14d42a,_0x4c1bba[_0xa6a3('0x12')]['message']);return _0x48e2e6(_0x4c1bba[_0xa6a3('0x12')][_0xa6a3('0x14')]);}logger[_0xa6a3('0x12')](_0xa6a3('0xd'),_0x14d42a,_0x4c1bba[_0xa6a3('0x12')][_0xa6a3('0x14')]);return _0x5474a3(_0x4c1bba[_0xa6a3('0x12')][_0xa6a3('0x14')]);}else{logger[_0xa6a3('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x14d42a,_0xa6a3('0xe'));_0x5474a3(_0x4c1bba[_0xa6a3('0x15')][_0xa6a3('0x14')]);}})[_0xa6a3('0x16')](function(_0x91d8cb){logger[_0xa6a3('0x12')](_0xa6a3('0xd'),_0x14d42a,_0x91d8cb);_0x48e2e6(_0x91d8cb);});});}exports[_0xa6a3('0x17')]=function(_0x1b0d0f){var _0x1669ea=this;return new Promise(function(_0x30e99b,_0x18c72a){return db[_0xa6a3('0x18')][_0xa6a3('0x19')](_0x1b0d0f[_0xa6a3('0x1a')],{'raw':_0x1b0d0f[_0xa6a3('0x1b')]?_0x1b0d0f[_0xa6a3('0x1b')][_0xa6a3('0x1c')]===undefined?!![]:![]:!![]})[_0xa6a3('0x1d')](function(_0x5e9a63){logger['info'](_0xa6a3('0x17'),_0x1b0d0f);logger[_0xa6a3('0xf')](_0xa6a3('0x17'),_0x1b0d0f,JSON[_0xa6a3('0x11')](_0x5e9a63));_0x30e99b(_0x5e9a63);})[_0xa6a3('0x16')](function(_0x471a6a){logger['error'](_0xa6a3('0x17'),_0x471a6a[_0xa6a3('0x14')],_0x1b0d0f);_0x18c72a(_0x1669ea['error'](0x1f4,_0x471a6a[_0xa6a3('0x14')]));});});};exports[_0xa6a3('0x1e')]=function(_0x2454c8){var _0x21c08d=this;return new Promise(function(_0x1ae637,_0x1e66c3){return db[_0xa6a3('0x18')][_0xa6a3('0x1f')](_0x2454c8[_0xa6a3('0x1a')],{'raw':_0x2454c8[_0xa6a3('0x1b')]?_0x2454c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2454c8[_0xa6a3('0x1b')]?_0x2454c8['options'][_0xa6a3('0x20')]||null:null,'attributes':_0x2454c8[_0xa6a3('0x1b')]?_0x2454c8[_0xa6a3('0x1b')]['attributes']||null:null,'limit':_0x2454c8[_0xa6a3('0x1b')]?_0x2454c8[_0xa6a3('0x1b')][_0xa6a3('0x21')]||null:null})['then'](function(_0x5c7d2f){logger[_0xa6a3('0xc')](_0xa6a3('0x1e'),_0x2454c8);logger[_0xa6a3('0xf')](_0xa6a3('0x1e'),_0x2454c8,JSON['stringify'](_0x5c7d2f));_0x1ae637(_0x5c7d2f);})['catch'](function(_0x4ec463){logger['error'](_0xa6a3('0x1e'),_0x4ec463['message'],_0x2454c8);_0x1e66c3(_0x21c08d[_0xa6a3('0x12')](0x1f4,_0x4ec463['message']));});});}; \ No newline at end of file +var _0x28c8=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','stringify','UpdateWhatsappQueueReport','update','attributes','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result'];(function(_0x4dfef9,_0x28d975){var _0x217a26=function(_0x3a3b3b){while(--_0x3a3b3b){_0x4dfef9['push'](_0x4dfef9['shift']());}};_0x217a26(++_0x28d975);}(_0x28c8,0x1cc));var _0x828c=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x28c8[_0x1b4002];return _0x1716f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x828c('0x0'));var BPromise=require(_0x828c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x828c('0x2'));var db=require(_0x828c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x828c('0x4'))(_0x828c('0x5'));var config=require(_0x828c('0x6'));var jayson=require(_0x828c('0x7'));var client=jayson['client'][_0x828c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8ec404,_0x363c54,_0x28a2a2){return new BPromise(function(_0x498f2e,_0x2e766f){return client[_0x828c('0x9')](_0x8ec404,_0x28a2a2)[_0x828c('0xa')](function(_0x148d2b){logger[_0x828c('0xb')](_0x828c('0xc'),_0x363c54,'request\x20sent');logger[_0x828c('0xd')](_0x828c('0xe'),_0x363c54,_0x828c('0xf'),JSON['stringify'](_0x148d2b));if(_0x148d2b['error']){if(_0x148d2b['error'][_0x828c('0x10')]===0x1f4){logger[_0x828c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x363c54,_0x148d2b[_0x828c('0x11')][_0x828c('0x12')]);return _0x2e766f(_0x148d2b[_0x828c('0x11')][_0x828c('0x12')]);}logger[_0x828c('0x11')](_0x828c('0xc'),_0x363c54,_0x148d2b['error'][_0x828c('0x12')]);return _0x498f2e(_0x148d2b['error'][_0x828c('0x12')]);}else{logger[_0x828c('0xb')](_0x828c('0xc'),_0x363c54,_0x828c('0xf'));_0x498f2e(_0x148d2b[_0x828c('0x13')][_0x828c('0x12')]);}})[_0x828c('0x14')](function(_0x1ec1e3){logger[_0x828c('0x11')](_0x828c('0xc'),_0x363c54,_0x1ec1e3);_0x2e766f(_0x1ec1e3);});});}exports[_0x828c('0x15')]=function(_0x40af7d){var _0x302f06=this;return new Promise(function(_0x467535,_0x409cc4){return db[_0x828c('0x16')][_0x828c('0x17')](_0x40af7d[_0x828c('0x18')],{'raw':_0x40af7d['options']?_0x40af7d[_0x828c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x828c('0xa')](function(_0x464a12){logger['info']('CreateWhatsappQueueReport',_0x40af7d);logger[_0x828c('0xd')](_0x828c('0x15'),_0x40af7d,JSON[_0x828c('0x1a')](_0x464a12));_0x467535(_0x464a12);})[_0x828c('0x14')](function(_0x33bd39){logger[_0x828c('0x11')](_0x828c('0x15'),_0x33bd39[_0x828c('0x12')],_0x40af7d);_0x409cc4(_0x302f06['error'](0x1f4,_0x33bd39['message']));});});};exports[_0x828c('0x1b')]=function(_0x1e0ba4){var _0x12fcee=this;return new Promise(function(_0x1b1c85,_0x44754e){return db[_0x828c('0x16')][_0x828c('0x1c')](_0x1e0ba4[_0x828c('0x18')],{'raw':_0x1e0ba4[_0x828c('0x19')]?_0x1e0ba4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0ba4[_0x828c('0x19')]?_0x1e0ba4[_0x828c('0x19')]['where']||null:null,'attributes':_0x1e0ba4[_0x828c('0x19')]?_0x1e0ba4['options'][_0x828c('0x1d')]||null:null,'limit':_0x1e0ba4[_0x828c('0x19')]?_0x1e0ba4['options']['limit']||null:null})[_0x828c('0xa')](function(_0x23c208){logger[_0x828c('0xb')](_0x828c('0x1b'),_0x1e0ba4);logger['debug'](_0x828c('0x1b'),_0x1e0ba4,JSON[_0x828c('0x1a')](_0x23c208));_0x1b1c85(_0x23c208);})['catch'](function(_0x431037){logger[_0x828c('0x11')](_0x828c('0x1b'),_0x431037['message'],_0x1e0ba4);_0x44754e(_0x12fcee['error'](0x1f4,_0x431037[_0x828c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d10c45d..d2d6f92 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 _0x433e=['isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x3f91ea,_0x34e600){var _0x3d281f=function(_0x4872d4){while(--_0x4872d4){_0x3f91ea['push'](_0x3f91ea['shift']());}};_0x3d281f(++_0x34e600);}(_0x433e,0x9a));var _0xe433=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x433e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe433('0x0'));var util=require('util');var path=require(_0xe433('0x1'));var timeout=require(_0xe433('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe433('0x3'));var controller=require(_0xe433('0x4'));router[_0xe433('0x5')]('/',auth[_0xe433('0x6')](),controller[_0xe433('0x7')]);router[_0xe433('0x5')](_0xe433('0x8'),auth[_0xe433('0x6')](),controller['describe']);router[_0xe433('0x5')](_0xe433('0x9'),auth[_0xe433('0x6')](),controller['show']);router[_0xe433('0xa')]('/',auth[_0xe433('0x6')](),controller[_0xe433('0xb')]);router[_0xe433('0xc')]('/:id',auth[_0xe433('0x6')](),controller[_0xe433('0xd')]);router['delete'](_0xe433('0x9'),auth[_0xe433('0x6')](),controller[_0xe433('0xe')]);module[_0xe433('0xf')]=router; \ No newline at end of file +var _0x1928=['index','/describe','describe','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0x1928,0x197));var _0x8192=function(_0x106e2d,_0x2dbcca){_0x106e2d=_0x106e2d-0x0;var _0x2b6075=_0x1928[_0x106e2d];return _0x2b6075;};'use strict';var multer=require('multer');var util=require(_0x8192('0x0'));var path=require(_0x8192('0x1'));var timeout=require(_0x8192('0x2'));var express=require(_0x8192('0x3'));var router=express[_0x8192('0x4')]();var fs_extra=require(_0x8192('0x5'));var auth=require(_0x8192('0x6'));var interaction=require(_0x8192('0x7'));var config=require(_0x8192('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x8192('0x9')]('/',auth[_0x8192('0xa')](),controller[_0x8192('0xb')]);router[_0x8192('0x9')](_0x8192('0xc'),auth['isAuthenticated'](),controller[_0x8192('0xd')]);router[_0x8192('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8192('0xe')]);router[_0x8192('0xf')]('/',auth['isAuthenticated'](),controller[_0x8192('0x10')]);router[_0x8192('0x11')](_0x8192('0x12'),auth[_0x8192('0xa')](),controller[_0x8192('0x13')]);router[_0x8192('0x14')](_0x8192('0x12'),auth[_0x8192('0xa')](),controller['destroy']);module[_0x8192('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ea87ea5..424c649 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 _0x84a0=['sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x18aa51,_0x5b7853){var _0x241ba8=function(_0x4e3fdd){while(--_0x4e3fdd){_0x18aa51['push'](_0x18aa51['shift']());}};_0x241ba8(++_0x5b7853);}(_0x84a0,0x66));var _0x084a=function(_0x14a54f,_0x252c00){_0x14a54f=_0x14a54f-0x0;var _0x244535=_0x84a0[_0x14a54f];return _0x244535;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'uniqueid':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x084a('0x3')]('account',_0x084a('0x4'),_0x084a('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6f59=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x239eb4,_0x549d0a){var _0x35f067=function(_0x483dd8){while(--_0x483dd8){_0x239eb4['push'](_0x239eb4['shift']());}};_0x35f067(++_0x549d0a);}(_0x6f59,0x1be));var _0x96f5=function(_0x51907,_0x1054d1){_0x51907=_0x51907-0x0;var _0x3329a5=_0x6f59[_0x51907];return _0x3329a5;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'uniqueid':{'type':Sequelize[_0x96f5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x96f5('0x3')](_0x96f5('0x4'),_0x96f5('0x5'),_0x96f5('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x96f5('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3816b71..ba8d7b1 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 _0x3906=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3b356a,_0x4d0d8c){var _0x1b8a92=function(_0x3d7d90){while(--_0x3d7d90){_0x3b356a['push'](_0x3b356a['shift']());}};_0x1b8a92(++_0x4d0d8c);}(_0x3906,0xd6));var _0x6390=function(_0x3be5c0,_0x52f522){_0x3be5c0=_0x3be5c0-0x0;var _0x45b6=_0x3906[_0x3be5c0];return _0x45b6;};'use strict';var emlformat=require(_0x6390('0x0'));var rimraf=require(_0x6390('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6390('0x2'));var rp=require('request-promise');var moment=require(_0x6390('0x3'));var BPromise=require(_0x6390('0x4'));var Mustache=require('mustache');var util=require(_0x6390('0x5'));var path=require(_0x6390('0x6'));var sox=require(_0x6390('0x7'));var csv=require(_0x6390('0x8'));var ejs=require(_0x6390('0x9'));var fs=require('fs');var fs_extra=require(_0x6390('0xa'));var _=require(_0x6390('0xb'));var squel=require(_0x6390('0xc'));var crypto=require(_0x6390('0xd'));var jsforce=require(_0x6390('0xe'));var deskjs=require(_0x6390('0xf'));var toCsv=require(_0x6390('0x8'));var querystring=require('querystring');var Papa=require(_0x6390('0x10'));var Redis=require('ioredis');var authService=require(_0x6390('0x11'));var qs=require(_0x6390('0x12'));var as=require(_0x6390('0x13'));var hardwareService=require(_0x6390('0x14'));var logger=require(_0x6390('0x15'))(_0x6390('0x16'));var utils=require('../../config/utils');var config=require(_0x6390('0x17'));var licenseUtil=require(_0x6390('0x18'));var db=require(_0x6390('0x19'))['db'];function respondWithStatusCode(_0x269082,_0x27e951){_0x27e951=_0x27e951||0xcc;return function(_0x13edb2){if(_0x13edb2){return _0x269082[_0x6390('0x1a')](_0x27e951);}return _0x269082[_0x6390('0x1b')](_0x27e951)[_0x6390('0x1c')]();};}function respondWithResult(_0x4b509b,_0x3cffa2){_0x3cffa2=_0x3cffa2||0xc8;return function(_0x6bdb26){if(_0x6bdb26){return _0x4b509b[_0x6390('0x1b')](_0x3cffa2)[_0x6390('0x1d')](_0x6bdb26);}};}function respondWithFilteredResult(_0x370ca9,_0xe1af17){return function(_0x6f76f6){if(_0x6f76f6){var _0x3d4a91=typeof _0xe1af17[_0x6390('0x1e')]===_0x6390('0x1f')&&typeof _0xe1af17['limit']==='undefined';var _0x2a75a9=_0x6f76f6[_0x6390('0x20')];var _0x25e5ef=_0x3d4a91?0x0:_0xe1af17[_0x6390('0x1e')];var _0x29fd60=_0x3d4a91?_0x6f76f6['count']:_0xe1af17[_0x6390('0x1e')]+_0xe1af17[_0x6390('0x21')];var _0x176589;if(_0x29fd60>=_0x2a75a9){_0x29fd60=_0x2a75a9;_0x176589=0xc8;}else{_0x176589=0xce;}_0x370ca9[_0x6390('0x1b')](_0x176589);return _0x370ca9[_0x6390('0x22')](_0x6390('0x23'),_0x25e5ef+'-'+_0x29fd60+'/'+_0x2a75a9)[_0x6390('0x1d')](_0x6f76f6);}return null;};}function patchUpdates(_0x31de0a){return function(_0x1fbfd5){try{jsonpatch[_0x6390('0x24')](_0x1fbfd5,_0x31de0a,!![]);}catch(_0x5c0b71){return BPromise['reject'](_0x5c0b71);}return _0x1fbfd5['save']();};}function saveUpdates(_0x249003,_0x56f5ca){return function(_0x248575){if(_0x248575){return _0x248575[_0x6390('0x25')](_0x249003)[_0x6390('0x26')](function(_0x4fb676){return _0x4fb676;});}return null;};}function removeEntity(_0x57bf8d,_0x4a29c6){return function(_0x5529d0){if(_0x5529d0){return _0x5529d0['destroy']()[_0x6390('0x26')](function(){_0x57bf8d[_0x6390('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe73b,_0x39f5f1){return function(_0x34391c){if(!_0x34391c){_0x4fe73b['sendStatus'](0x194);}return _0x34391c;};}function handleError(_0x204b26,_0x4ae72b){_0x4ae72b=_0x4ae72b||0x1f4;return function(_0x55e6b2){logger[_0x6390('0x27')](_0x55e6b2[_0x6390('0x28')]);if(_0x55e6b2[_0x6390('0x29')]){delete _0x55e6b2[_0x6390('0x29')];}_0x204b26['status'](_0x4ae72b)['send'](_0x55e6b2);};}exports[_0x6390('0x2a')]=function(_0x25779b,_0x11df33){var _0x47572f={},_0x5f154a={},_0x27a174={'count':0x0,'rows':[]};var _0x3cc7cb=_[_0x6390('0x2b')](db[_0x6390('0x2c')][_0x6390('0x2d')],function(_0x496d3a){return{'name':_0x496d3a['fieldName'],'type':_0x496d3a[_0x6390('0x2e')][_0x6390('0x2f')]};});_0x5f154a['model']=_[_0x6390('0x2b')](_0x3cc7cb,_0x6390('0x29'));_0x5f154a[_0x6390('0x30')]=_['keys'](_0x25779b[_0x6390('0x30')]);_0x5f154a['filters']=_[_0x6390('0x31')](_0x5f154a[_0x6390('0x32')],_0x5f154a['query']);_0x47572f[_0x6390('0x33')]=_[_0x6390('0x31')](_0x5f154a[_0x6390('0x32')],qs[_0x6390('0x34')](_0x25779b[_0x6390('0x30')][_0x6390('0x34')]));_0x47572f['attributes']=_0x47572f[_0x6390('0x33')][_0x6390('0x35')]?_0x47572f['attributes']:_0x5f154a[_0x6390('0x32')];if(!_0x25779b[_0x6390('0x30')][_0x6390('0x36')]('nolimit')){_0x47572f[_0x6390('0x21')]=qs[_0x6390('0x21')](_0x25779b[_0x6390('0x30')][_0x6390('0x21')]);_0x47572f['offset']=qs[_0x6390('0x1e')](_0x25779b[_0x6390('0x30')]['offset']);}_0x47572f['order']=qs[_0x6390('0x37')](_0x25779b['query']['sort']);_0x47572f[_0x6390('0x38')]=qs[_0x6390('0x39')](_[_0x6390('0x3a')](_0x25779b[_0x6390('0x30')],_0x5f154a[_0x6390('0x39')]),_0x3cc7cb);if(_0x25779b['query'][_0x6390('0x3b')]){_0x47572f[_0x6390('0x38')]=_[_0x6390('0x3c')](_0x47572f['where'],{'$or':_['map'](_0x3cc7cb,function(_0x487af9){if(_0x487af9[_0x6390('0x2e')]!==_0x6390('0x3d')){var _0x31adb8={};_0x31adb8[_0x487af9['name']]={'$like':'%'+_0x25779b[_0x6390('0x30')][_0x6390('0x3b')]+'%'};return _0x31adb8;}})});}_0x47572f=_['merge']({},_0x47572f,_0x25779b[_0x6390('0x3e')]);var _0x2093cd={'where':_0x47572f[_0x6390('0x38')]};return db[_0x6390('0x2c')][_0x6390('0x20')](_0x2093cd)[_0x6390('0x26')](function(_0x3a60fe){_0x27a174['count']=_0x3a60fe;if(_0x25779b[_0x6390('0x30')]['includeAll']){_0x47572f[_0x6390('0x3f')]=[{'all':!![]}];}return db[_0x6390('0x2c')][_0x6390('0x40')](_0x47572f);})['then'](function(_0x4fc453){_0x27a174[_0x6390('0x41')]=_0x4fc453;return _0x27a174;})[_0x6390('0x26')](respondWithFilteredResult(_0x11df33,_0x47572f))[_0x6390('0x42')](handleError(_0x11df33,null));};exports[_0x6390('0x43')]=function(_0xd640f8,_0xd91634){var _0x7532fd={'raw':!![],'where':{'id':_0xd640f8['params']['id']}},_0x349caf={};_0x349caf[_0x6390('0x32')]=_[_0x6390('0x44')](db['WhatsappTransferReport'][_0x6390('0x2d')]);_0x349caf[_0x6390('0x30')]=_['keys'](_0xd640f8[_0x6390('0x30')]);_0x349caf[_0x6390('0x39')]=_['intersection'](_0x349caf[_0x6390('0x32')],_0x349caf[_0x6390('0x30')]);_0x7532fd['attributes']=_[_0x6390('0x31')](_0x349caf[_0x6390('0x32')],qs[_0x6390('0x34')](_0xd640f8[_0x6390('0x30')][_0x6390('0x34')]));_0x7532fd[_0x6390('0x33')]=_0x7532fd[_0x6390('0x33')][_0x6390('0x35')]?_0x7532fd[_0x6390('0x33')]:_0x349caf[_0x6390('0x32')];if(_0xd640f8[_0x6390('0x30')][_0x6390('0x45')]){_0x7532fd[_0x6390('0x3f')]=[{'all':!![]}];}_0x7532fd=_[_0x6390('0x3c')]({},_0x7532fd,_0xd640f8[_0x6390('0x3e')]);return db[_0x6390('0x2c')][_0x6390('0x46')](_0x7532fd)[_0x6390('0x26')](handleEntityNotFound(_0xd91634,null))[_0x6390('0x26')](respondWithResult(_0xd91634,null))['catch'](handleError(_0xd91634,null));};exports[_0x6390('0x47')]=function(_0x480847,_0x8ec464){return db[_0x6390('0x2c')][_0x6390('0x47')](_0x480847[_0x6390('0x48')],{})[_0x6390('0x26')](respondWithResult(_0x8ec464,0xc9))[_0x6390('0x42')](handleError(_0x8ec464,null));};exports['update']=function(_0x48a53c,_0x5a59e0){if(_0x48a53c['body']['id']){delete _0x48a53c[_0x6390('0x48')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x48a53c[_0x6390('0x49')]['id']}})[_0x6390('0x26')](handleEntityNotFound(_0x5a59e0,null))[_0x6390('0x26')](saveUpdates(_0x48a53c[_0x6390('0x48')],null))[_0x6390('0x26')](respondWithResult(_0x5a59e0,null))['catch'](handleError(_0x5a59e0,null));};exports[_0x6390('0x4a')]=function(_0x48544a,_0x4c6529){return db[_0x6390('0x2c')]['find']({'where':{'id':_0x48544a[_0x6390('0x49')]['id']}})[_0x6390('0x26')](handleEntityNotFound(_0x4c6529,null))[_0x6390('0x26')](removeEntity(_0x4c6529,null))[_0x6390('0x42')](handleError(_0x4c6529,null));};exports[_0x6390('0x4b')]=function(_0x50ce7c,_0x5425eb){return db[_0x6390('0x2c')][_0x6390('0x4b')]()[_0x6390('0x26')](respondWithResult(_0x5425eb,null))['catch'](handleError(_0x5425eb,null));}; \ No newline at end of file +var _0x80e2=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','WhatsappTransferReport','filters','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x5002b3,_0x130699){var _0x538a84=function(_0x8f710f){while(--_0x8f710f){_0x5002b3['push'](_0x5002b3['shift']());}};_0x538a84(++_0x130699);}(_0x80e2,0xfd));var _0x280e=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x80e2[_0x2fdf82];return _0x2382f5;};'use strict';var emlformat=require(_0x280e('0x0'));var rimraf=require(_0x280e('0x1'));var zipdir=require(_0x280e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x280e('0x3'));var moment=require(_0x280e('0x4'));var BPromise=require(_0x280e('0x5'));var Mustache=require(_0x280e('0x6'));var util=require(_0x280e('0x7'));var path=require('path');var sox=require(_0x280e('0x8'));var csv=require(_0x280e('0x9'));var ejs=require(_0x280e('0xa'));var fs=require('fs');var fs_extra=require(_0x280e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x280e('0xc'));var jsforce=require(_0x280e('0xd'));var deskjs=require(_0x280e('0xe'));var toCsv=require(_0x280e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x280e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x280e('0x10'));var hardwareService=require(_0x280e('0x11'));var logger=require(_0x280e('0x12'))(_0x280e('0x13'));var utils=require(_0x280e('0x14'));var config=require(_0x280e('0x15'));var licenseUtil=require(_0x280e('0x16'));var db=require(_0x280e('0x17'))['db'];function respondWithStatusCode(_0xca4511,_0x255e16){_0x255e16=_0x255e16||0xcc;return function(_0x58c400){if(_0x58c400){return _0xca4511[_0x280e('0x18')](_0x255e16);}return _0xca4511[_0x280e('0x19')](_0x255e16)[_0x280e('0x1a')]();};}function respondWithResult(_0x3df552,_0x382e5b){_0x382e5b=_0x382e5b||0xc8;return function(_0xb80af1){if(_0xb80af1){return _0x3df552[_0x280e('0x19')](_0x382e5b)[_0x280e('0x1b')](_0xb80af1);}};}function respondWithFilteredResult(_0x37ea54,_0x58d983){return function(_0x5ecc94){if(_0x5ecc94){var _0x5e5f54=typeof _0x58d983['offset']===_0x280e('0x1c')&&typeof _0x58d983['limit']===_0x280e('0x1c');var _0x589a18=_0x5ecc94[_0x280e('0x1d')];var _0x507718=_0x5e5f54?0x0:_0x58d983['offset'];var _0x58c036=_0x5e5f54?_0x5ecc94[_0x280e('0x1d')]:_0x58d983['offset']+_0x58d983[_0x280e('0x1e')];var _0x2f759b;if(_0x58c036>=_0x589a18){_0x58c036=_0x589a18;_0x2f759b=0xc8;}else{_0x2f759b=0xce;}_0x37ea54['status'](_0x2f759b);return _0x37ea54['set'](_0x280e('0x1f'),_0x507718+'-'+_0x58c036+'/'+_0x589a18)[_0x280e('0x1b')](_0x5ecc94);}return null;};}function patchUpdates(_0x786b60){return function(_0x20dd3d){try{jsonpatch[_0x280e('0x20')](_0x20dd3d,_0x786b60,!![]);}catch(_0x4399d6){return BPromise[_0x280e('0x21')](_0x4399d6);}return _0x20dd3d[_0x280e('0x22')]();};}function saveUpdates(_0x4c7695,_0x5bd5fb){return function(_0x294c08){if(_0x294c08){return _0x294c08[_0x280e('0x23')](_0x4c7695)[_0x280e('0x24')](function(_0x2eefa4){return _0x2eefa4;});}return null;};}function removeEntity(_0x1f637b,_0x2507ca){return function(_0x3d32d2){if(_0x3d32d2){return _0x3d32d2[_0x280e('0x25')]()['then'](function(){_0x1f637b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a5e5,_0xd42743){return function(_0x42b103){if(!_0x42b103){_0x38a5e5[_0x280e('0x18')](0x194);}return _0x42b103;};}function handleError(_0x43eb2e,_0x13c07a){_0x13c07a=_0x13c07a||0x1f4;return function(_0x4ad625){logger[_0x280e('0x26')](_0x4ad625[_0x280e('0x27')]);if(_0x4ad625[_0x280e('0x28')]){delete _0x4ad625['name'];}_0x43eb2e[_0x280e('0x19')](_0x13c07a)[_0x280e('0x29')](_0x4ad625);};}exports[_0x280e('0x2a')]=function(_0x3ee0da,_0x6a207c){var _0xd285b2={},_0x109475={},_0x166b3e={'count':0x0,'rows':[]};var _0x38c815=_[_0x280e('0x2b')](db['WhatsappTransferReport'][_0x280e('0x2c')],function(_0x542f1b){return{'name':_0x542f1b[_0x280e('0x2d')],'type':_0x542f1b[_0x280e('0x2e')][_0x280e('0x2f')]};});_0x109475[_0x280e('0x30')]=_[_0x280e('0x2b')](_0x38c815,_0x280e('0x28'));_0x109475[_0x280e('0x31')]=_[_0x280e('0x32')](_0x3ee0da['query']);_0x109475['filters']=_['intersection'](_0x109475[_0x280e('0x30')],_0x109475[_0x280e('0x31')]);_0xd285b2[_0x280e('0x33')]=_[_0x280e('0x34')](_0x109475[_0x280e('0x30')],qs[_0x280e('0x35')](_0x3ee0da[_0x280e('0x31')]['fields']));_0xd285b2[_0x280e('0x33')]=_0xd285b2[_0x280e('0x33')][_0x280e('0x36')]?_0xd285b2[_0x280e('0x33')]:_0x109475[_0x280e('0x30')];if(!_0x3ee0da['query'][_0x280e('0x37')](_0x280e('0x38'))){_0xd285b2['limit']=qs['limit'](_0x3ee0da[_0x280e('0x31')][_0x280e('0x1e')]);_0xd285b2['offset']=qs[_0x280e('0x39')](_0x3ee0da['query']['offset']);}_0xd285b2[_0x280e('0x3a')]=qs[_0x280e('0x3b')](_0x3ee0da['query']['sort']);_0xd285b2[_0x280e('0x3c')]=qs['filters'](_['pick'](_0x3ee0da[_0x280e('0x31')],_0x109475['filters']),_0x38c815);if(_0x3ee0da[_0x280e('0x31')][_0x280e('0x3d')]){_0xd285b2['where']=_[_0x280e('0x3e')](_0xd285b2[_0x280e('0x3c')],{'$or':_[_0x280e('0x2b')](_0x38c815,function(_0x40a1fe){if(_0x40a1fe[_0x280e('0x2e')]!==_0x280e('0x3f')){var _0xec2618={};_0xec2618[_0x40a1fe[_0x280e('0x28')]]={'$like':'%'+_0x3ee0da[_0x280e('0x31')]['filter']+'%'};return _0xec2618;}})});}_0xd285b2=_[_0x280e('0x3e')]({},_0xd285b2,_0x3ee0da[_0x280e('0x40')]);var _0x375ee1={'where':_0xd285b2[_0x280e('0x3c')]};return db['WhatsappTransferReport'][_0x280e('0x1d')](_0x375ee1)[_0x280e('0x24')](function(_0x2d0ec4){_0x166b3e[_0x280e('0x1d')]=_0x2d0ec4;if(_0x3ee0da[_0x280e('0x31')][_0x280e('0x41')]){_0xd285b2[_0x280e('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0xd285b2);})[_0x280e('0x24')](function(_0x33a798){_0x166b3e['rows']=_0x33a798;return _0x166b3e;})['then'](respondWithFilteredResult(_0x6a207c,_0xd285b2))[_0x280e('0x43')](handleError(_0x6a207c,null));};exports[_0x280e('0x44')]=function(_0x4bb853,_0x1dd8a3){var _0x496d3a={'raw':!![],'where':{'id':_0x4bb853['params']['id']}},_0x5b07d4={};_0x5b07d4[_0x280e('0x30')]=_[_0x280e('0x32')](db[_0x280e('0x45')][_0x280e('0x2c')]);_0x5b07d4['query']=_['keys'](_0x4bb853[_0x280e('0x31')]);_0x5b07d4[_0x280e('0x46')]=_['intersection'](_0x5b07d4['model'],_0x5b07d4['query']);_0x496d3a[_0x280e('0x33')]=_[_0x280e('0x34')](_0x5b07d4[_0x280e('0x30')],qs[_0x280e('0x35')](_0x4bb853['query'][_0x280e('0x35')]));_0x496d3a[_0x280e('0x33')]=_0x496d3a['attributes'][_0x280e('0x36')]?_0x496d3a[_0x280e('0x33')]:_0x5b07d4[_0x280e('0x30')];if(_0x4bb853[_0x280e('0x31')][_0x280e('0x41')]){_0x496d3a[_0x280e('0x42')]=[{'all':!![]}];}_0x496d3a=_[_0x280e('0x3e')]({},_0x496d3a,_0x4bb853[_0x280e('0x40')]);return db[_0x280e('0x45')][_0x280e('0x47')](_0x496d3a)[_0x280e('0x24')](handleEntityNotFound(_0x1dd8a3,null))['then'](respondWithResult(_0x1dd8a3,null))['catch'](handleError(_0x1dd8a3,null));};exports[_0x280e('0x48')]=function(_0x40cf83,_0x13dd8e){return db['WhatsappTransferReport']['create'](_0x40cf83[_0x280e('0x49')],{})[_0x280e('0x24')](respondWithResult(_0x13dd8e,0xc9))[_0x280e('0x43')](handleError(_0x13dd8e,null));};exports[_0x280e('0x23')]=function(_0x3e7e18,_0x2debdd){if(_0x3e7e18['body']['id']){delete _0x3e7e18[_0x280e('0x49')]['id'];}return db[_0x280e('0x45')][_0x280e('0x47')]({'where':{'id':_0x3e7e18['params']['id']}})[_0x280e('0x24')](handleEntityNotFound(_0x2debdd,null))[_0x280e('0x24')](saveUpdates(_0x3e7e18[_0x280e('0x49')],null))[_0x280e('0x24')](respondWithResult(_0x2debdd,null))[_0x280e('0x43')](handleError(_0x2debdd,null));};exports[_0x280e('0x25')]=function(_0x388d73,_0x1d6c82){return db['WhatsappTransferReport'][_0x280e('0x47')]({'where':{'id':_0x388d73['params']['id']}})['then'](handleEntityNotFound(_0x1d6c82,null))['then'](removeEntity(_0x1d6c82,null))['catch'](handleError(_0x1d6c82,null));};exports['describe']=function(_0x1b512b,_0x1f19c8){return db['WhatsappTransferReport'][_0x280e('0x4a')]()[_0x280e('0x24')](respondWithResult(_0x1f19c8,null))[_0x280e('0x43')](handleError(_0x1f19c8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 70eae7a..7b1b927 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 _0x50f9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','../../config/logger','api'];(function(_0x149ac5,_0x2a6483){var _0x11d6e1=function(_0xb94953){while(--_0xb94953){_0x149ac5['push'](_0x149ac5['shift']());}};_0x11d6e1(++_0x2a6483);}(_0x50f9,0xb4));var _0x950f=function(_0x4892c4,_0x2fa919){_0x4892c4=_0x4892c4-0x0;var _0x4031d2=_0x50f9[_0x4892c4];return _0x4031d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x950f('0x0'))(_0x950f('0x1'));var moment=require(_0x950f('0x2'));var BPromise=require(_0x950f('0x3'));var rp=require(_0x950f('0x4'));var fs=require('fs');var path=require(_0x950f('0x5'));var rimraf=require(_0x950f('0x6'));var config=require(_0x950f('0x7'));var attributes=require(_0x950f('0x8'));module[_0x950f('0x9')]=function(_0x59173b,_0x4e3eb6){return _0x59173b[_0x950f('0xa')](_0x950f('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x950f('0xc'),'fields':[_0x950f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf514=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0xf514,0x1b6));var _0x4f51=function(_0x2ff21b,_0x383b47){_0x2ff21b=_0x2ff21b-0x0;var _0x5d7702=_0xf514[_0x2ff21b];return _0x5d7702;};'use strict';var _=require('lodash');var util=require(_0x4f51('0x0'));var logger=require(_0x4f51('0x1'))(_0x4f51('0x2'));var moment=require(_0x4f51('0x3'));var BPromise=require(_0x4f51('0x4'));var rp=require(_0x4f51('0x5'));var fs=require('fs');var path=require(_0x4f51('0x6'));var rimraf=require(_0x4f51('0x7'));var config=require(_0x4f51('0x8'));var attributes=require(_0x4f51('0x9'));module[_0x4f51('0xa')]=function(_0xe17009,_0x36cc91){return _0xe17009['define'](_0x4f51('0xb'),attributes,{'tableName':_0x4f51('0xc'),'paranoid':![],'indexes':[{'name':_0x4f51('0xd'),'fields':[_0x4f51('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 993456f..59cc532 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 _0x6284=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1860c4,_0x1d1371){var _0x534338=function(_0x5a9eda){while(--_0x5a9eda){_0x1860c4['push'](_0x1860c4['shift']());}};_0x534338(++_0x1d1371);}(_0x6284,0x9f));var _0x4628=function(_0x99e59a,_0x265a53){_0x99e59a=_0x99e59a-0x0;var _0x16767a=_0x6284[_0x99e59a];return _0x16767a;};'use strict';var _=require(_0x4628('0x0'));var util=require('util');var moment=require(_0x4628('0x1'));var BPromise=require(_0x4628('0x2'));var rs=require(_0x4628('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4628('0x4'))['db'];var utils=require(_0x4628('0x5'));var logger=require(_0x4628('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4628('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ac04f,_0x4672b6,_0x295339){return new BPromise(function(_0x3f1ae0,_0x51e1d1){return client[_0x4628('0x8')](_0x5ac04f,_0x295339)[_0x4628('0x9')](function(_0x42a352){logger['info'](_0x4628('0xa'),_0x4672b6,_0x4628('0xb'));logger[_0x4628('0xc')](_0x4628('0xd'),_0x4672b6,_0x4628('0xb'),JSON[_0x4628('0xe')](_0x42a352));if(_0x42a352[_0x4628('0xf')]){if(_0x42a352['error'][_0x4628('0x10')]===0x1f4){logger[_0x4628('0xf')](_0x4628('0xa'),_0x4672b6,_0x42a352[_0x4628('0xf')][_0x4628('0x11')]);return _0x51e1d1(_0x42a352[_0x4628('0xf')]['message']);}logger[_0x4628('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4672b6,_0x42a352[_0x4628('0xf')][_0x4628('0x11')]);return _0x3f1ae0(_0x42a352[_0x4628('0xf')][_0x4628('0x11')]);}else{logger['info'](_0x4628('0xa'),_0x4672b6,_0x4628('0xb'));_0x3f1ae0(_0x42a352['result']['message']);}})[_0x4628('0x12')](function(_0x52840f){logger['error'](_0x4628('0xa'),_0x4672b6,_0x52840f);_0x51e1d1(_0x52840f);});});} \ No newline at end of file +var _0x44b5=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x148da0,_0x2adee8){var _0x5236b=function(_0x353cfc){while(--_0x353cfc){_0x148da0['push'](_0x148da0['shift']());}};_0x5236b(++_0x2adee8);}(_0x44b5,0xc8));var _0x544b=function(_0x573a21,_0x1f8b1f){_0x573a21=_0x573a21-0x0;var _0x5d4f3d=_0x44b5[_0x573a21];return _0x5d4f3d;};'use strict';var _=require(_0x544b('0x0'));var util=require('util');var moment=require(_0x544b('0x1'));var BPromise=require(_0x544b('0x2'));var rs=require(_0x544b('0x3'));var fs=require('fs');var Redis=require(_0x544b('0x4'));var db=require(_0x544b('0x5'))['db'];var utils=require(_0x544b('0x6'));var logger=require(_0x544b('0x7'))(_0x544b('0x8'));var config=require(_0x544b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x544b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe75ca1,_0x225529,_0x1bd1fa){return new BPromise(function(_0x348f7f,_0x38d08c){return client[_0x544b('0xb')](_0xe75ca1,_0x1bd1fa)['then'](function(_0x161964){logger[_0x544b('0xc')](_0x544b('0xd'),_0x225529,_0x544b('0xe'));logger[_0x544b('0xf')](_0x544b('0x10'),_0x225529,_0x544b('0xe'),JSON[_0x544b('0x11')](_0x161964));if(_0x161964[_0x544b('0x12')]){if(_0x161964[_0x544b('0x12')]['code']===0x1f4){logger['error'](_0x544b('0xd'),_0x225529,_0x161964[_0x544b('0x12')][_0x544b('0x13')]);return _0x38d08c(_0x161964[_0x544b('0x12')]['message']);}logger['error'](_0x544b('0xd'),_0x225529,_0x161964[_0x544b('0x12')][_0x544b('0x13')]);return _0x348f7f(_0x161964['error'][_0x544b('0x13')]);}else{logger['info'](_0x544b('0xd'),_0x225529,_0x544b('0xe'));_0x348f7f(_0x161964[_0x544b('0x14')][_0x544b('0x13')]);}})[_0x544b('0x15')](function(_0x48e1db){logger[_0x544b('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x225529,_0x48e1db);_0x38d08c(_0x48e1db);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2619b52..51129bf 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3613=['lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','default','then','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','online','log','App\x20Ready!','exit'];(function(_0x4adee7,_0x220adc){var _0x410750=function(_0x5ca777){while(--_0x5ca777){_0x4adee7['push'](_0x4adee7['shift']());}};_0x410750(++_0x220adc);}(_0x3613,0x198));var _0x3361=function(_0x7fd251,_0x582353){_0x7fd251=_0x7fd251-0x0;var _0x52eba5=_0x3613[_0x7fd251];return _0x52eba5;};'use strict';var _=require(_0x3361('0x0'));var db=require(_0x3361('0x1'))['db'];var seedDb=require(_0x3361('0x2'));var checkLicense=require(_0x3361('0x3'));var rpc=require(_0x3361('0x4'));var config=require(_0x3361('0x5'));var logger=require(_0x3361('0x6'))('app');var pm2=require(_0x3361('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x3361('0x8'));var chat=require(_0x3361('0x9'));var whatsapp=require(_0x3361('0xa'));var transcribe=require(_0x3361('0xb'));var provider=require(_0x3361('0xc'));function main(){return db['sequelize'][_0x3361('0xd')]()['then'](function(){if(config[_0x3361('0xe')]){return seedDb[_0x3361('0xf')]();}})[_0x3361('0x10')](function(){return checkLicense[_0x3361('0xf')]();})[_0x3361('0x10')](function(){return rpc['listen']();})['then'](function(_0x4abfd6){logger['info'](_0x4abfd6);return chat['start']();})[_0x3361('0x10')](function(){return whatsapp[_0x3361('0x11')]();})[_0x3361('0x10')](function(){return schedule[_0x3361('0x11')]();})[_0x3361('0x10')](function(){return transcribe['start']();})[_0x3361('0x10')](function(){return provider[_0x3361('0x11')]();})[_0x3361('0x10')](function(_0x5d7580){logger[_0x3361('0x12')](_0x5d7580);return pm2[_0x3361('0x11')](pm2Config);})[_0x3361('0x10')](function(_0x648525){var _0x525c22=_0x648525[_0x3361('0x13')](function(_0x53f08c){return typeof _0x53f08c[_0x3361('0x14')]===_0x3361('0x15')&&_0x53f08c[_0x3361('0x14')]>=0x0;});if(_0x525c22[_0x3361('0x16')]>0x0){throw new Error(_0x525c22[_0x3361('0x16')]+_0x3361('0x17')+_[_0x3361('0x18')](_0x525c22,function(_0x2bd93f){return'\x22'+_0x2bd93f[_0x3361('0x19')][_0x3361('0x1a')]+'\x22';}));}logger[_0x3361('0x12')](_0x3361('0x1b'),_[_0x3361('0x18')](_[_0x3361('0x13')](_0x648525,{'status':'online'}),'name')[_0x3361('0x1c')]());logger[_0x3361('0x12')](_0x3361('0x1d'),_[_0x3361('0x18')](_['filter'](_0x648525,function(_0x220f9e){return _0x220f9e['status']!==_0x3361('0x1e');}),_0x3361('0x1a'))[_0x3361('0x1c')]()||'None');console[_0x3361('0x1f')](_0x3361('0x20'));})['catch'](function(_0x4db586){console[_0x3361('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4db586);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4db586);process[_0x3361('0x21')](0x1);});}main(); \ No newline at end of file +var _0xbc1c=['App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','log'];(function(_0x2e0e3c,_0x533d49){var _0x4fe05a=function(_0x2ff59f){while(--_0x2ff59f){_0x2e0e3c['push'](_0x2e0e3c['shift']());}};_0x4fe05a(++_0x533d49);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0xbc1c[_0x145b3c];return _0x1b6e36;};'use strict';var _=require('lodash');var db=require(_0xcbc1('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xcbc1('0x1'));var rpc=require('./rpc');var config=require(_0xcbc1('0x2'));var logger=require(_0xcbc1('0x3'))(_0xcbc1('0x4'));var pm2=require(_0xcbc1('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xcbc1('0x6'));var chat=require(_0xcbc1('0x7'));var whatsapp=require(_0xcbc1('0x8'));var transcribe=require(_0xcbc1('0x9'));var provider=require(_0xcbc1('0xa'));function main(){return db[_0xcbc1('0xb')]['sync']()[_0xcbc1('0xc')](function(){if(config[_0xcbc1('0xd')]){return seedDb[_0xcbc1('0xe')]();}})[_0xcbc1('0xc')](function(){return checkLicense[_0xcbc1('0xe')]();})[_0xcbc1('0xc')](function(){return rpc['listen']();})[_0xcbc1('0xc')](function(_0x4addfb){logger[_0xcbc1('0xf')](_0x4addfb);return chat[_0xcbc1('0x10')]();})['then'](function(){return whatsapp[_0xcbc1('0x10')]();})['then'](function(){return schedule['start']();})[_0xcbc1('0xc')](function(){return transcribe[_0xcbc1('0x10')]();})['then'](function(){return provider[_0xcbc1('0x10')]();})[_0xcbc1('0xc')](function(_0x56b168){logger['info'](_0x56b168);return pm2[_0xcbc1('0x10')](pm2Config);})['then'](function(_0x33aa46){var _0x3a4b8d=_0x33aa46[_0xcbc1('0x11')](function(_0x2dcafc){return typeof _0x2dcafc[_0xcbc1('0x12')]==='number'&&_0x2dcafc['exitCode']>=0x0;});if(_0x3a4b8d['length']>0x0){throw new Error(_0x3a4b8d[_0xcbc1('0x13')]+_0xcbc1('0x14')+_[_0xcbc1('0x15')](_0x3a4b8d,function(_0x316217){return'\x22'+_0x316217['pm2_env'][_0xcbc1('0x16')]+'\x22';}));}logger[_0xcbc1('0xf')](_0xcbc1('0x17'),_[_0xcbc1('0x15')](_[_0xcbc1('0x11')](_0x33aa46,{'status':_0xcbc1('0x18')}),'name')[_0xcbc1('0x19')]());logger[_0xcbc1('0xf')](_0xcbc1('0x1a'),_['map'](_[_0xcbc1('0x11')](_0x33aa46,function(_0x3b9837){return _0x3b9837[_0xcbc1('0x1b')]!==_0xcbc1('0x18');}),_0xcbc1('0x16'))[_0xcbc1('0x19')]()||'None');console[_0xcbc1('0x1c')](_0xcbc1('0x1d'));})[_0xcbc1('0x1e')](function(_0x1c26e6){console['log'](_0xcbc1('0x1f'),_0x1c26e6);logger[_0xcbc1('0x20')](_0xcbc1('0x21'),_0x1c26e6);process[_0xcbc1('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 43cfe7a..7154e0f 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 _0xa33b=['phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','disposition','then','closed','unmanaged','json','Forbidden.','catch','headers','authorization','User','find','name','authenticate','Wrong\x20credentials.','startsWith','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','secrets','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','session','role','fullname','email','permissions','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias'];(function(_0x6457de,_0x4390ff){var _0x302ce1=function(_0x10f031){while(--_0x10f031){_0x6457de['push'](_0x6457de['shift']());}};_0x302ce1(++_0x4390ff);}(_0xa33b,0xf5));var _0xba33=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa33b[_0x3ab51d];return _0x29a04e;};'use strict';var db=require(_0xba33('0x0'))['db'];var config=require(_0xba33('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xba33('0x2'));var encryptor=require(_0xba33('0x3'));var _=require(_0xba33('0x4'));var jwt=require(_0xba33('0x5'));var expressJwt=require(_0xba33('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xba33('0x7'));var crypto=require(_0xba33('0x8'));var BPromise=require(_0xba33('0x9'));var util=require(_0xba33('0xa'));var moment=require(_0xba33('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xba33('0xc')]});var userAttributes=['id',_0xba33('0xd'),_0xba33('0xe'),'name','internal',_0xba33('0xf'),'userpic',_0xba33('0x10'),'md5secret',_0xba33('0x11'),_0xba33('0x12'),_0xba33('0x13'),'faxPause',_0xba33('0x14'),_0xba33('0x15'),_0xba33('0x16'),_0xba33('0x17'),_0xba33('0x18'),_0xba33('0x19'),'crudPermissions',_0xba33('0x1a'),_0xba33('0x1b'),_0xba33('0x1c'),_0xba33('0x1d'),_0xba33('0x1e'),_0xba33('0x1f'),_0xba33('0x20'),'phoneBarEnableDtmfTone',_0xba33('0x21'),_0xba33('0x22'),_0xba33('0x23'),_0xba33('0x24'),_0xba33('0x25'),_0xba33('0x26'),_0xba33('0x27'),_0xba33('0x28'),_0xba33('0x29'),_0xba33('0x2a'),_0xba33('0x2b'),_0xba33('0x2c'),_0xba33('0x2d'),_0xba33('0x2e'),'ignorePauseForPreviewCalls',_0xba33('0x2f')];exports[_0xba33('0x30')]=function(){return this[_0xba33('0x31')](!![])[_0xba33('0x32')](function(_0x574166,_0x494060,_0x720f4f){if(_0x574166[_0xba33('0x33')]){_0x720f4f();}else{return db[_0xba33('0x34')]['findOne']({'where':{'id':_0x574166[_0xba33('0x35')]['id']},'attributes':['id','closed',_0xba33('0x36')],'raw':!![]})[_0xba33('0x37')](function(_0x3506e5){if(_0x3506e5&&_0x3506e5[_0xba33('0x38')]){return _0x494060['status'](_0x3506e5[_0xba33('0x36')]===_0xba33('0x39')?0x195:0x193)[_0xba33('0x3a')]({'message':_0x3506e5[_0xba33('0x36')]===_0xba33('0x39')?'Unmanaged.':_0xba33('0x3b')});}else{_0x720f4f();}})[_0xba33('0x3c')](function(_0x843cbf){_0x720f4f(_0x843cbf);});}});};exports['isAuthenticated']=function isAuthenticated(_0x45c4f9){return compose()[_0xba33('0x32')](function(_0x3fa481,_0x589ca1,_0xaae1c9){var _0x5f2f1d;if(_0x3fa481[_0xba33('0x3d')][_0xba33('0x3e')]){if(_['startsWith'](_0x3fa481[_0xba33('0x3d')]['authorization'],'Basic')){var _0x26cd74=basicAuth(_0x3fa481);db[_0xba33('0x3f')][_0xba33('0x40')]({'where':{'name':_0x26cd74[_0xba33('0x41')]}})['then'](function(_0x453c3d){if(!_0x453c3d||!_0x453c3d[_0xba33('0x42')](_0x26cd74['pass'])){return _0x589ca1['status'](0x191)['json']({'message':_0xba33('0x43')});}_0x3fa481[_0xba33('0x33')]={'id':_0x453c3d['id']};_0xaae1c9();})[_0xba33('0x3c')](function(_0x32b7bf){_0xaae1c9(_0x32b7bf);});}else if(_[_0xba33('0x44')](_0x3fa481[_0xba33('0x3d')][_0xba33('0x3e')],_0xba33('0x45'))){validateJwt(_0x3fa481,_0x589ca1,_0xaae1c9);}else{if(_0x45c4f9){_0xaae1c9();}else{return _0x589ca1[_0xba33('0x46')](0x193)['json']({'message':_0xba33('0x47')});}}}else if(_0x3fa481[_0xba33('0x48')][_0xba33('0x49')]){try{var _0x324d9f={'audience':hardwareConf[_0xba33('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x3fa481[_0xba33('0x48')][_0xba33('0x49')],_0x324d9f)[_0xba33('0x37')](function(_0x54ddaa){return db[_0xba33('0x3f')][_0xba33('0x40')]({'where':{'id':_0x54ddaa[_0xba33('0x4b')]}})[_0xba33('0x37')](function(_0x2ced96){_0x5f2f1d=_0x2ced96;return db[_0xba33('0x4c')][_0xba33('0x4d')]({'where':{'id':0x1},'attributes':[_0xba33('0x4e'),_0xba33('0x4f')],'raw':!![]});})[_0xba33('0x37')](function(_0x576c5c){if(!_0x5f2f1d||!_[_0xba33('0x50')](_0x5f2f1d[_0xba33('0x51')],_0x54ddaa[_0xba33('0x52')])){return _0x589ca1['status'](0x191)['json']({'message':_0xba33('0x53')});}if(_0x5f2f1d[_0xba33('0x54')]){return _0x589ca1[_0xba33('0x46')](0x191)[_0xba33('0x3a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5f2f1d[_0xba33('0x55')]){if(_0x576c5c[_0xba33('0x4f')]>0x0){if(moment(_0x5f2f1d[_0xba33('0x56')])[_0xba33('0x57')](_0x576c5c['blockDuration'],_0xba33('0x58'))>moment()){return _0x589ca1[_0xba33('0x46')](0x191)[_0xba33('0x3a')]({'message':_0xba33('0x59')});}}else{return _0x589ca1[_0xba33('0x46')](0x191)[_0xba33('0x3a')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3fa481[_0xba33('0x33')]={'id':_0x5f2f1d['id']};_0xaae1c9();});})['catch'](function(){return _0x589ca1[_0xba33('0x46')](0x191)[_0xba33('0x3a')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x393a2d){_0xaae1c9(_0x393a2d);}}else if(_0x45c4f9){_0xaae1c9();}else{return _0x589ca1['status'](0x193)[_0xba33('0x3a')]({'message':_0xba33('0x47')});}})[_0xba33('0x32')](function(_0x230741,_0x507cc3,_0x11e1af){if(_0x230741['user']){db['User'][_0xba33('0x40')]({'where':{'id':_0x230741[_0xba33('0x33')]['id']},'attributes':userAttributes})[_0xba33('0x37')](function(_0xa7ca93){if(!_0xa7ca93){return _0x507cc3[_0xba33('0x46')](0x194)[_0xba33('0x3a')]({'message':_0xba33('0x5a')});}_0x230741[_0xba33('0x33')]=_0xa7ca93;_0x11e1af();})[_0xba33('0x3c')](function(_0x16029a){_0x11e1af(_0x16029a);});}else if(_0x45c4f9){_0x11e1af();}else{return _0x507cc3[_0xba33('0x46')](0x194)['json']({'message':_0xba33('0x5b')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xba33('0x32')](function(_0x4336f7,_0x2b628d,_0x1cd967){return licenseUtil[_0xba33('0x5c')]()[_0xba33('0x37')](function(_0x5892e6){if(_0x5892e6[_0xba33('0x5d')]){_0x1cd967();}else{return _0x2b628d[_0xba33('0x46')](0x193)[_0xba33('0x3a')]({'message':_0xba33('0x5e')});}})['catch'](function(_0x88ec92){_0x1cd967(_0x88ec92);});});};exports[_0xba33('0x5f')]=function isWebrtcLicence(){return compose()[_0xba33('0x32')](function(_0x58abbf,_0x4e25aa,_0x57b984){return licenseUtil[_0xba33('0x5c')]()[_0xba33('0x37')](function(_0x4da354){if(_0x4da354['webrtc']){_0x57b984();}else{return _0x4e25aa['status'](0x193)[_0xba33('0x3a')]({'message':_0xba33('0x5e')});}})['catch'](function(_0x2df696){_0x57b984(_0x2df696);});});};exports[_0xba33('0x60')]=function(_0x367b1f,_0x1e7c88,_0x2c8a47){_0x367b1f[_0xba33('0x60')]=!![];return _0x2c8a47();};exports[_0xba33('0x61')]=function signToken(_0x376efe){return signJwt(_0x376efe);};exports[_0xba33('0x62')]=function(_0x417b41,_0x5c3ffa){if(!_0x417b41['user']){return _0x5c3ffa[_0xba33('0x46')](0x194)[_0xba33('0x3a')]({'message':_0xba33('0x63')});}var _0x49c6d8={'payload':{'id':_0x417b41[_0xba33('0x33')]['id'],'role':_0x417b41[_0xba33('0x33')][_0xba33('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x49c6d8)[_0xba33('0x37')](function(_0xd48799){_0x5c3ffa[_0xba33('0x64')](_0xba33('0x65'),_0xd48799);_0x5c3ffa[_0xba33('0x66')](_0xba33('0x67'));})['catch'](function(_0xdf719a){return _0x5c3ffa[_0xba33('0x46')](0x1f4)[_0xba33('0x68')](_0xdf719a);});};exports['retrieveApiKey']=function(_0x477070){if(_[_0xba33('0x69')](_0x477070[_0xba33('0x51')])||_['isNil'](_0x477070[_0xba33('0x6a')])){return null;}else{return createJwt(_0x477070);}};exports[_0xba33('0x6b')]=function(_0x3d65e0){_0x3d65e0['apiKeyNonce']=generateNonce();_0x3d65e0[_0xba33('0x6a')]=generateIssuedAt();return createJwt(_0x3d65e0);};exports[_0xba33('0x6c')]=function(_0x3504ec,_0x6745bd){var _0x42b645=_0x3504ec[_0xba33('0x48')]['apikey'];if(_0x42b645){var _0x42d3bd={'nonce':_0x6745bd['apiKeyNonce'],'iat':_0x6745bd[_0xba33('0x6a')],'audience':hardwareConf[_0xba33('0x4a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x42b645,_0x42d3bd)[_0xba33('0x37')](function(){return generateApiKey(_0x6745bd);});}else{throw{'message':_0xba33('0x6d')};}};exports[_0xba33('0x6e')]=function(_0x4e9385){var _0x5ce476=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ce476['test'](_0x4e9385))throw new db[(_0xba33('0x6f'))][(_0xba33('0x70'))](_0xba33('0x71'));return;};exports[_0xba33('0x72')]=function(_0x11cbf1,_0x441350,_0xe13a87){var _0x2d22b7=encryptor['decryptString'](_0x441350)[_0xba33('0x73')](',');for(var _0x591b1d=0x0;_0x591b1d<_0xe13a87;_0x591b1d++){if(!_0x2d22b7[_0x591b1d])break;if(_0x11cbf1[_0xba33('0x74')]()===_0x2d22b7[_0x591b1d][_0xba33('0x74')]()){var _0x2e30dd=util[_0xba33('0x75')](_0xba33('0x76'),_0xe13a87);if(_0xe13a87===0x1){_0x2e30dd=_0xba33('0x77');}throw new db[(_0xba33('0x6f'))][(_0xba33('0x70'))](_0x2e30dd);}}return;};exports[_0xba33('0x78')]=function(_0x2d7690,_0x2dc781){var _0x1bb2d8=_0x2dc781?encryptor[_0xba33('0x79')](_0x2dc781)['split'](','):[];if(_0x1bb2d8[_0xba33('0x7a')]===0x5){_0x1bb2d8['splice'](-0x1,0x1);}_0x1bb2d8[_0xba33('0x7b')](_0x2d7690);return encryptor[_0xba33('0x7c')](_0x1bb2d8[_0xba33('0x7d')](','));};function signJwt(_0x5cb7ee){var _0x517b12=BPromise[_0xba33('0x7e')](jwt['sign'],{'context':jwt});var _0x35fa08=_0x5cb7ee['secret']||config[_0xba33('0x7f')][_0xba33('0xc')];return new BPromise(function(_0x29d27d,_0x2b29b8){_0x517b12(_0x5cb7ee[_0xba33('0x80')],_0x35fa08,_0x5cb7ee[_0xba33('0x81')])[_0xba33('0x37')](function(_0x2c4fb7){_0x29d27d(_0x2c4fb7);})['catch'](function(_0x5f3ee4){_0x2b29b8(_0x5f3ee4);});});}function verifyJwt(_0x450494,_0x164286,_0xecc25c){var _0x1c7d22=BPromise['promisify'](jwt[_0xba33('0x82')],{'context':jwt});var _0x552aa4=_0xecc25c||config[_0xba33('0x7f')][_0xba33('0xc')];return new BPromise(function(_0x2f92a5,_0x186701){_0x1c7d22(_0x450494,_0x552aa4,_0x164286)['then'](function(_0xbb0b65){_0x2f92a5(_0xbb0b65);})[_0xba33('0x3c')](function(_0xedf4c5){_0x186701(_0xedf4c5);});});}function generateNonce(){return crypto[_0xba33('0x83')](0x10)['toString'](_0xba33('0x84'));}function generateIssuedAt(){return Math[_0xba33('0x85')](Date[_0xba33('0x86')]()/0x3e8)[_0xba33('0x87')]();}function createJwt(_0x3df397){var _0x2be42c={'payload':{'iat':_0x3df397[_0xba33('0x6a')],'nonce':_0x3df397[_0xba33('0x51')]},'options':{'algorithm':_0xba33('0x88'),'subject':_0x3df397['id'][_0xba33('0x87')](),'issuer':hardwareConf[_0xba33('0x4a')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2be42c)[_0xba33('0x37')](function(_0x231795){return{'iat':_0x3df397['apiKeyIat'],'nonce':_0x3df397[_0xba33('0x51')],'token':_0x231795};});} \ No newline at end of file +var _0x4ee7=['crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','status','disposition','unmanaged','json','Unmanaged.','catch','use','headers','authorization','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','user','startsWith','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20object\x20not\x20found.','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','unshift','encryptString','join','promisify','sign','session','payload','options','verify','randomBytes','toString','hex','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','secrets','userpic','permissions','md5secret','mailPause','faxPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt'];(function(_0x1bb6a4,_0x2e4cc8){var _0x46b94c=function(_0xf40bd7){while(--_0xf40bd7){_0x1bb6a4['push'](_0x1bb6a4['shift']());}};_0x46b94c(++_0x2e4cc8);}(_0x4ee7,0x169));var _0x74ee=function(_0x374679,_0x185787){_0x374679=_0x374679-0x0;var _0x5d6f7f=_0x4ee7[_0x374679];return _0x5d6f7f;};'use strict';var db=require(_0x74ee('0x0'))['db'];var config=require(_0x74ee('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x74ee('0x2'));var encryptor=require(_0x74ee('0x3'));var _=require(_0x74ee('0x4'));var jwt=require(_0x74ee('0x5'));var expressJwt=require(_0x74ee('0x6'));var compose=require(_0x74ee('0x7'));var basicAuth=require(_0x74ee('0x8'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x74ee('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x74ee('0xa')]['session']});var userAttributes=['id','role','fullname','name','internal','email',_0x74ee('0xb'),_0x74ee('0xc'),_0x74ee('0xd'),'voicePause','chatPause',_0x74ee('0xe'),_0x74ee('0xf'),'smsPause',_0x74ee('0x10'),'pauseType',_0x74ee('0x11'),_0x74ee('0x12'),_0x74ee('0x13'),_0x74ee('0x14'),_0x74ee('0x15'),_0x74ee('0x16'),_0x74ee('0x17'),'phoneBarAutoAnswer',_0x74ee('0x18'),_0x74ee('0x19'),_0x74ee('0x1a'),_0x74ee('0x1b'),_0x74ee('0x1c'),_0x74ee('0x1d'),_0x74ee('0x1e'),_0x74ee('0x1f'),_0x74ee('0x20'),'hotdesk',_0x74ee('0x21'),_0x74ee('0x22'),_0x74ee('0x23'),_0x74ee('0x24'),_0x74ee('0x25'),_0x74ee('0x26'),_0x74ee('0x27'),_0x74ee('0x28'),_0x74ee('0x29'),_0x74ee('0x2a')];exports[_0x74ee('0x2b')]=function(){return this[_0x74ee('0x2c')](!![])['use'](function(_0x194720,_0x4fa3c2,_0x450ac1){if(_0x194720['user']){_0x450ac1();}else{return db[_0x74ee('0x2d')][_0x74ee('0x2e')]({'where':{'id':_0x194720[_0x74ee('0x2f')]['id']},'attributes':['id',_0x74ee('0x30'),'disposition'],'raw':!![]})['then'](function(_0x9692b2){if(_0x9692b2&&_0x9692b2[_0x74ee('0x30')]){return _0x4fa3c2[_0x74ee('0x31')](_0x9692b2[_0x74ee('0x32')]===_0x74ee('0x33')?0x195:0x193)[_0x74ee('0x34')]({'message':_0x9692b2[_0x74ee('0x32')]===_0x74ee('0x33')?_0x74ee('0x35'):'Forbidden.'});}else{_0x450ac1();}})[_0x74ee('0x36')](function(_0x1d6989){_0x450ac1(_0x1d6989);});}});};exports[_0x74ee('0x2c')]=function isAuthenticated(_0xa42ecc){return compose()[_0x74ee('0x37')](function(_0x4bfc2b,_0x2ab84d,_0x53a4a5){var _0x1e846c;if(_0x4bfc2b[_0x74ee('0x38')]['authorization']){if(_['startsWith'](_0x4bfc2b['headers'][_0x74ee('0x39')],_0x74ee('0x3a'))){var _0x12bb29=basicAuth(_0x4bfc2b);db[_0x74ee('0x3b')][_0x74ee('0x3c')]({'where':{'name':_0x12bb29['name']}})[_0x74ee('0x3d')](function(_0x3be2ae){if(!_0x3be2ae||!_0x3be2ae[_0x74ee('0x3e')](_0x12bb29[_0x74ee('0x3f')])){return _0x2ab84d[_0x74ee('0x31')](0x191)['json']({'message':_0x74ee('0x40')});}_0x4bfc2b[_0x74ee('0x41')]={'id':_0x3be2ae['id']};_0x53a4a5();})[_0x74ee('0x36')](function(_0x8819d2){_0x53a4a5(_0x8819d2);});}else if(_[_0x74ee('0x42')](_0x4bfc2b[_0x74ee('0x38')][_0x74ee('0x39')],_0x74ee('0x43'))){validateJwt(_0x4bfc2b,_0x2ab84d,_0x53a4a5);}else{if(_0xa42ecc){_0x53a4a5();}else{return _0x2ab84d['status'](0x193)[_0x74ee('0x34')]({'message':_0x74ee('0x44')});}}}else if(_0x4bfc2b['query']['apikey']){try{var _0x1087b1={'audience':hardwareConf[_0x74ee('0x45')](),'issuer':hardwareConf[_0x74ee('0x45')]()};verifyJwt(_0x4bfc2b[_0x74ee('0x46')][_0x74ee('0x47')],_0x1087b1)[_0x74ee('0x3d')](function(_0x5400c6){return db[_0x74ee('0x3b')]['find']({'where':{'id':_0x5400c6[_0x74ee('0x48')]}})[_0x74ee('0x3d')](function(_0x53eeb9){_0x1e846c=_0x53eeb9;return db['Setting'][_0x74ee('0x2e')]({'where':{'id':0x1},'attributes':[_0x74ee('0x49'),_0x74ee('0x4a')],'raw':!![]});})[_0x74ee('0x3d')](function(_0xa41fe8){if(!_0x1e846c||!_[_0x74ee('0x4b')](_0x1e846c[_0x74ee('0x4c')],_0x5400c6['nonce'])){return _0x2ab84d[_0x74ee('0x31')](0x191)['json']({'message':_0x74ee('0x4d')});}if(_0x1e846c[_0x74ee('0x4e')]){return _0x2ab84d[_0x74ee('0x31')](0x191)[_0x74ee('0x34')]({'message':_0x74ee('0x4f')});}if(_0x1e846c['blocked']){if(_0xa41fe8['blockDuration']>0x0){if(moment(_0x1e846c[_0x74ee('0x50')])[_0x74ee('0x51')](_0xa41fe8[_0x74ee('0x4a')],_0x74ee('0x52'))>moment()){return _0x2ab84d['status'](0x191)[_0x74ee('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2ab84d[_0x74ee('0x31')](0x191)[_0x74ee('0x34')]({'message':_0x74ee('0x4f')});}}_0x4bfc2b[_0x74ee('0x41')]={'id':_0x1e846c['id']};_0x53a4a5();});})[_0x74ee('0x36')](function(){return _0x2ab84d[_0x74ee('0x31')](0x191)[_0x74ee('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5ded32){_0x53a4a5(_0x5ded32);}}else if(_0xa42ecc){_0x53a4a5();}else{return _0x2ab84d[_0x74ee('0x31')](0x193)[_0x74ee('0x34')]({'message':'Unknown\x20authorization\x20format'});}})[_0x74ee('0x37')](function(_0x173464,_0xe5b3b9,_0x142683){if(_0x173464[_0x74ee('0x41')]){db['User'][_0x74ee('0x3c')]({'where':{'id':_0x173464[_0x74ee('0x41')]['id']},'attributes':userAttributes})[_0x74ee('0x3d')](function(_0x4cfc5c){if(!_0x4cfc5c){return _0xe5b3b9[_0x74ee('0x31')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x173464['user']=_0x4cfc5c;_0x142683();})[_0x74ee('0x36')](function(_0x2123a9){_0x142683(_0x2123a9);});}else if(_0xa42ecc){_0x142683();}else{return _0xe5b3b9[_0x74ee('0x31')](0x194)[_0x74ee('0x34')]({'message':_0x74ee('0x53')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x2e059b,_0xf98428,_0x923ca7){return licenseUtil['getLicense']()[_0x74ee('0x3d')](function(_0x311552){if(_0x311552[_0x74ee('0x54')]){_0x923ca7();}else{return _0xf98428['status'](0x193)[_0x74ee('0x34')]({'message':_0x74ee('0x55')});}})['catch'](function(_0x32f0d4){_0x923ca7(_0x32f0d4);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x74ee('0x37')](function(_0x77ec1b,_0x19d9e9,_0x48ab7e){return licenseUtil['getLicense']()[_0x74ee('0x3d')](function(_0x3a151d){if(_0x3a151d[_0x74ee('0x56')]){_0x48ab7e();}else{return _0x19d9e9[_0x74ee('0x31')](0x193)['json']({'message':_0x74ee('0x55')});}})[_0x74ee('0x36')](function(_0x836575){_0x48ab7e(_0x836575);});});};exports[_0x74ee('0x57')]=function(_0x90e0ac,_0x38ba69,_0xea5521){_0x90e0ac['isMiddleware']=!![];return _0xea5521();};exports[_0x74ee('0x58')]=function signToken(_0x4f7a47){return signJwt(_0x4f7a47);};exports['setTokenCookie']=function(_0x326dae,_0x487a09){if(!_0x326dae['user']){return _0x487a09[_0x74ee('0x31')](0x194)[_0x74ee('0x34')]({'message':_0x74ee('0x59')});}var _0x56278d={'payload':{'id':_0x326dae[_0x74ee('0x41')]['id'],'role':_0x326dae['user'][_0x74ee('0x5a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x56278d)['then'](function(_0x4768d9){_0x487a09[_0x74ee('0x5b')](_0x74ee('0x5c'),_0x4768d9);_0x487a09[_0x74ee('0x5d')]('/dashboards/general');})[_0x74ee('0x36')](function(_0x20e491){return _0x487a09[_0x74ee('0x31')](0x1f4)[_0x74ee('0x5e')](_0x20e491);});};exports[_0x74ee('0x5f')]=function(_0x2b8a37){if(_[_0x74ee('0x60')](_0x2b8a37['apiKeyNonce'])||_[_0x74ee('0x60')](_0x2b8a37['apiKeyIat'])){return null;}else{return createJwt(_0x2b8a37);}};exports[_0x74ee('0x61')]=function(_0x30c646){_0x30c646[_0x74ee('0x4c')]=generateNonce();_0x30c646[_0x74ee('0x62')]=generateIssuedAt();return createJwt(_0x30c646);};exports[_0x74ee('0x63')]=function(_0x524419,_0x2a6bde){var _0x5d52d7=_0x524419['query'][_0x74ee('0x47')];if(_0x5d52d7){var _0x3373b1={'nonce':_0x2a6bde[_0x74ee('0x4c')],'iat':_0x2a6bde[_0x74ee('0x62')],'audience':hardwareConf[_0x74ee('0x45')](),'issuer':hardwareConf[_0x74ee('0x45')]()};return verifyJwt(_0x5d52d7,_0x3373b1)[_0x74ee('0x3d')](function(){return generateApiKey(_0x2a6bde);});}else{throw{'message':_0x74ee('0x64')};}};exports[_0x74ee('0x65')]=function(_0x3300e0){var _0x18495c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x18495c[_0x74ee('0x66')](_0x3300e0))throw new db[(_0x74ee('0x67'))][(_0x74ee('0x68'))](_0x74ee('0x69'));return;};exports[_0x74ee('0x6a')]=function(_0x266e74,_0x33d956,_0x1dd0e9){var _0x5ae307=encryptor['decryptString'](_0x33d956)[_0x74ee('0x6b')](',');for(var _0x23d02a=0x0;_0x23d02a<_0x1dd0e9;_0x23d02a++){if(!_0x5ae307[_0x23d02a])break;if(_0x266e74[_0x74ee('0x6c')]()===_0x5ae307[_0x23d02a]['toLowerCase']()){var _0x7f6f29=util[_0x74ee('0x6d')](_0x74ee('0x6e'),_0x1dd0e9);if(_0x1dd0e9===0x1){_0x7f6f29=_0x74ee('0x6f');}throw new db['Sequelize'][(_0x74ee('0x68'))](_0x7f6f29);}}return;};exports[_0x74ee('0x70')]=function(_0x41ba96,_0x32164d){var _0x41d204=_0x32164d?encryptor[_0x74ee('0x71')](_0x32164d)['split'](','):[];if(_0x41d204['length']===0x5){_0x41d204['splice'](-0x1,0x1);}_0x41d204[_0x74ee('0x72')](_0x41ba96);return encryptor[_0x74ee('0x73')](_0x41d204[_0x74ee('0x74')](','));};function signJwt(_0x357570){var _0x20dc1f=BPromise[_0x74ee('0x75')](jwt[_0x74ee('0x76')],{'context':jwt});var _0x11e7a7=_0x357570['secret']||config[_0x74ee('0xa')][_0x74ee('0x77')];return new BPromise(function(_0xc482dc,_0x18a187){_0x20dc1f(_0x357570[_0x74ee('0x78')],_0x11e7a7,_0x357570[_0x74ee('0x79')])[_0x74ee('0x3d')](function(_0x38a4f3){_0xc482dc(_0x38a4f3);})['catch'](function(_0x40c0e1){_0x18a187(_0x40c0e1);});});}function verifyJwt(_0x5a8e27,_0x2fe90e,_0x1268b5){var _0xa3cf24=BPromise[_0x74ee('0x75')](jwt[_0x74ee('0x7a')],{'context':jwt});var _0x56dddd=_0x1268b5||config[_0x74ee('0xa')][_0x74ee('0x77')];return new BPromise(function(_0x2748d2,_0x1abdd9){_0xa3cf24(_0x5a8e27,_0x56dddd,_0x2fe90e)[_0x74ee('0x3d')](function(_0x2bd966){_0x2748d2(_0x2bd966);})[_0x74ee('0x36')](function(_0x4aa601){_0x1abdd9(_0x4aa601);});});}function generateNonce(){return crypto[_0x74ee('0x7b')](0x10)[_0x74ee('0x7c')](_0x74ee('0x7d'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x74ee('0x7c')]();}function createJwt(_0x315053){var _0x1a467e={'payload':{'iat':_0x315053[_0x74ee('0x62')],'nonce':_0x315053[_0x74ee('0x4c')]},'options':{'algorithm':_0x74ee('0x7e'),'subject':_0x315053['id'][_0x74ee('0x7c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1a467e)['then'](function(_0xaaf52f){return{'iat':_0x315053[_0x74ee('0x62')],'nonce':_0x315053[_0x74ee('0x4c')],'token':_0xaaf52f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5db2e3f..112c85f 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 _0x652d=['createReadStream','createDecipher','unlink','encryptString','secret','utf8','decryptString','base64','bluebird','lodash','../../config/environment','app','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile'];(function(_0x4c4748,_0x2aa40e){var _0x1e761d=function(_0x237938){while(--_0x237938){_0x4c4748['push'](_0x4c4748['shift']());}};_0x1e761d(++_0x2aa40e);}(_0x652d,0xef));var _0xd652=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x652d[_0x465028];return _0xb783d4;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xd652('0x0'));var _=require(_0xd652('0x1'));var config=require(_0xd652('0x2'));var logger=require('../../config/logger')(_0xd652('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xd652('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xd652('0x5')};if(config[_0xd652('0x6')]&&config[_0xd652('0x6')][_0xd652('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xd652('0x7')]=config['encrypt'][_0xd652('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd652('0x8')](',\x20');logger['error'](config[_0xd652('0x6')][_0xd652('0x7')],_0xd652('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x47b2fe){return AES_SUPPORTED_RX[_0xd652('0xa')](_0x47b2fe);}function getSupportedCiphers(){return crypto[_0xd652('0xb')]()[_0xd652('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x54bed6){return getSupportedCiphers()[_0xd652('0xd')](_0x54bed6)>-0x1;}function combineOptions(_0x24c483){var _0x1fdc70={};for(var _0x30d612 in fileOptions){if(fileOptions[_0xd652('0xe')](_0x30d612)){_0x1fdc70[_0x30d612]=fileOptions[_0x30d612];}}if(_0x24c483){for(var _0x57f9ef in _0x24c483){if(_0x24c483[_0xd652('0xe')](_0x57f9ef)){_0x1fdc70[_0x57f9ef]=_0x24c483[_0x57f9ef];}}}return _0x1fdc70;}exports['encryptFile']=function(_0x2bd406,_0x150c48,_0x4b5e7e,_0x2a5b08){return new BPromise(function(_0x5f162e,_0x364f52){_0x2a5b08=combineOptions(_0x2a5b08);var _0xea7c13=new Buffer(_0x4b5e7e);var _0x21bacf=fs['createReadStream'](_0x2bd406);var _0x32358b=fs[_0xd652('0xf')](_0x150c48);var _0x35cdb2=crypto[_0xd652('0x10')](_0x2a5b08[_0xd652('0x7')],_0xea7c13);_0x21bacf['on'](_0xd652('0x11'),function(_0x232c27){var _0x14241d=new Buffer(_0x35cdb2[_0xd652('0x12')](_0x232c27),_0xd652('0x13'));_0x32358b[_0xd652('0x14')](_0x14241d);});_0x21bacf['on'](_0xd652('0x15'),function(){try{var _0x252ec3=new Buffer(_0x35cdb2[_0xd652('0x16')](_0xd652('0x13')),_0xd652('0x13'));_0x32358b[_0xd652('0x14')](_0x252ec3);_0x32358b[_0xd652('0x15')]();_0x32358b['on'](_0xd652('0x17'),function(){return _0x5f162e(_0x150c48);});}catch(_0x5d7c80){fs['unlink'](_0x150c48);return _0x364f52(_0x5d7c80);}});});};exports[_0xd652('0x18')]=function(_0xdb821,_0x117189,_0x496eb4,_0x1b2858){return new BPromise(function(_0x34f5e5,_0x24e491){_0x1b2858=combineOptions(_0x1b2858);var _0x491d28=new Buffer(_0x496eb4);var _0x5ca09c=fs[_0xd652('0x19')](_0xdb821);var _0x381bc8=fs[_0xd652('0xf')](_0x117189);var _0x29982e=crypto[_0xd652('0x1a')](_0x1b2858['algorithm'],_0x491d28);_0x5ca09c['on'](_0xd652('0x11'),function(_0x133296){var _0x1a13bb=new Buffer(_0x29982e[_0xd652('0x12')](_0x133296),_0xd652('0x13'));_0x381bc8[_0xd652('0x14')](_0x1a13bb);});_0x5ca09c['on']('end',function(){try{var _0x4893d0=new Buffer(_0x29982e['final'](_0xd652('0x13')),'binary');_0x381bc8[_0xd652('0x14')](_0x4893d0);_0x381bc8['end']();_0x381bc8['on'](_0xd652('0x17'),function(){return _0x34f5e5(_0x117189);});}catch(_0x522ce0){fs[_0xd652('0x1b')](_0x117189);return _0x24e491(_0x522ce0);}});});};exports[_0xd652('0x1c')]=function(_0x106810,_0x3561fc,_0x313a4d){var _0x3c3094=_0x313a4d||stringOptions['algorithm'];var _0x184448=_0x3561fc||stringOptions[_0xd652('0x1d')];var _0x462011=crypto['createCipher'](_0x3c3094,_0x184448);var _0xb92a3a=_0x462011['update'](_0x106810,_0xd652('0x1e'),'base64');_0xb92a3a+=_0x462011[_0xd652('0x16')]('base64');return _0xb92a3a;};exports[_0xd652('0x1f')]=function(_0x3bba07,_0x2316d9,_0x5d82f4){var _0xea994f=_0x5d82f4||stringOptions[_0xd652('0x7')];var _0x42166c=_0x2316d9||stringOptions[_0xd652('0x1d')];var _0x547041=crypto['createDecipher'](_0xea994f,_0x42166c);var _0x38fbb2=_0x547041[_0xd652('0x12')](_0x3bba07,_0xd652('0x20'),'utf8');_0x38fbb2+=_0x547041['final'](_0xd652('0x1e'));return _0x38fbb2;}; \ No newline at end of file +var _0x5dcc=['hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','decryptFile','createDecipher','close','unlink','encryptString','secret','utf8','base64','final','decryptString','crypto','bluebird','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf'];(function(_0x20179a,_0xf2e330){var _0x354ba6=function(_0x29df63){while(--_0x29df63){_0x20179a['push'](_0x20179a['shift']());}};_0x354ba6(++_0xf2e330);}(_0x5dcc,0x134));var _0xc5dc=function(_0x2cba56,_0x58fbe7){_0x2cba56=_0x2cba56-0x0;var _0x424812=_0x5dcc[_0x2cba56];return _0x424812;};'use strict';var crypto=require(_0xc5dc('0x0'));var fs=require('fs');var BPromise=require(_0xc5dc('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xc5dc('0x2'))(_0xc5dc('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc5dc('0x4')][_0xc5dc('0x5')],'algorithm':_0xc5dc('0x6')};const fileOptions={'algorithm':_0xc5dc('0x7')};if(config[_0xc5dc('0x8')]&&config[_0xc5dc('0x8')][_0xc5dc('0x9')]){var isSupported=isAlgorithmSupported(config[_0xc5dc('0x8')][_0xc5dc('0x9')]);if(isSupported){fileOptions[_0xc5dc('0x9')]=config[_0xc5dc('0x8')][_0xc5dc('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc5dc('0xa')](',\x20');logger[_0xc5dc('0xb')](config[_0xc5dc('0x8')][_0xc5dc('0x9')],_0xc5dc('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2f8f93){return AES_SUPPORTED_RX['test'](_0x2f8f93);}function getSupportedCiphers(){return crypto[_0xc5dc('0xd')]()[_0xc5dc('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x174b5c){return getSupportedCiphers()[_0xc5dc('0xf')](_0x174b5c)>-0x1;}function combineOptions(_0x4fcc52){var _0x2fc71b={};for(var _0x9b108c in fileOptions){if(fileOptions[_0xc5dc('0x10')](_0x9b108c)){_0x2fc71b[_0x9b108c]=fileOptions[_0x9b108c];}}if(_0x4fcc52){for(var _0x157d61 in _0x4fcc52){if(_0x4fcc52['hasOwnProperty'](_0x157d61)){_0x2fc71b[_0x157d61]=_0x4fcc52[_0x157d61];}}}return _0x2fc71b;}exports[_0xc5dc('0x11')]=function(_0x9122ad,_0x1ad26e,_0x18e894,_0x2c1ea2){return new BPromise(function(_0x561db8,_0x3f437a){_0x2c1ea2=combineOptions(_0x2c1ea2);var _0x55d5d8=new Buffer(_0x18e894);var _0x199067=fs[_0xc5dc('0x12')](_0x9122ad);var _0x55cc82=fs[_0xc5dc('0x13')](_0x1ad26e);var _0x20ce82=crypto[_0xc5dc('0x14')](_0x2c1ea2[_0xc5dc('0x9')],_0x55d5d8);_0x199067['on'](_0xc5dc('0x15'),function(_0x45e44e){var _0x468828=new Buffer(_0x20ce82[_0xc5dc('0x16')](_0x45e44e),_0xc5dc('0x17'));_0x55cc82[_0xc5dc('0x18')](_0x468828);});_0x199067['on']('end',function(){try{var _0x153d76=new Buffer(_0x20ce82['final'](_0xc5dc('0x17')),_0xc5dc('0x17'));_0x55cc82['write'](_0x153d76);_0x55cc82[_0xc5dc('0x19')]();_0x55cc82['on']('close',function(){return _0x561db8(_0x1ad26e);});}catch(_0x5e15a6){fs['unlink'](_0x1ad26e);return _0x3f437a(_0x5e15a6);}});});};exports[_0xc5dc('0x1a')]=function(_0x7aa68,_0x43f4df,_0x7a71a6,_0x19e431){return new BPromise(function(_0x3ea828,_0x3c3716){_0x19e431=combineOptions(_0x19e431);var _0xa89852=new Buffer(_0x7a71a6);var _0x2863fe=fs[_0xc5dc('0x12')](_0x7aa68);var _0x4a50c1=fs[_0xc5dc('0x13')](_0x43f4df);var _0x2592c7=crypto[_0xc5dc('0x1b')](_0x19e431[_0xc5dc('0x9')],_0xa89852);_0x2863fe['on']('data',function(_0x231782){var _0x347117=new Buffer(_0x2592c7[_0xc5dc('0x16')](_0x231782),_0xc5dc('0x17'));_0x4a50c1[_0xc5dc('0x18')](_0x347117);});_0x2863fe['on'](_0xc5dc('0x19'),function(){try{var _0x15028c=new Buffer(_0x2592c7['final'](_0xc5dc('0x17')),_0xc5dc('0x17'));_0x4a50c1[_0xc5dc('0x18')](_0x15028c);_0x4a50c1[_0xc5dc('0x19')]();_0x4a50c1['on'](_0xc5dc('0x1c'),function(){return _0x3ea828(_0x43f4df);});}catch(_0x4d83a2){fs[_0xc5dc('0x1d')](_0x43f4df);return _0x3c3716(_0x4d83a2);}});});};exports[_0xc5dc('0x1e')]=function(_0x10bd20,_0x1a049f,_0x3945f8){var _0x3dbe8b=_0x3945f8||stringOptions[_0xc5dc('0x9')];var _0x236193=_0x1a049f||stringOptions[_0xc5dc('0x1f')];var _0x26ef57=crypto[_0xc5dc('0x14')](_0x3dbe8b,_0x236193);var _0x50e116=_0x26ef57['update'](_0x10bd20,_0xc5dc('0x20'),_0xc5dc('0x21'));_0x50e116+=_0x26ef57[_0xc5dc('0x22')]('base64');return _0x50e116;};exports[_0xc5dc('0x23')]=function(_0x574d9e,_0x7141bb,_0x47a878){var _0x2a045d=_0x47a878||stringOptions[_0xc5dc('0x9')];var _0x196586=_0x7141bb||stringOptions[_0xc5dc('0x1f')];var _0x160341=crypto[_0xc5dc('0x1b')](_0x2a045d,_0x196586);var _0x23182f=_0x160341['update'](_0x574d9e,_0xc5dc('0x21'),_0xc5dc('0x20'));_0x23182f+=_0x160341[_0xc5dc('0x22')]('utf8');return _0x23182f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 10e054e..c6c6e48 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 _0x090a=['split','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT'];(function(_0x156e53,_0x1905ba){var _0x143b87=function(_0x3dec9c){while(--_0x3dec9c){_0x156e53['push'](_0x156e53['shift']());}};_0x143b87(++_0x1905ba);}(_0x090a,0x79));var _0xa090=function(_0xc5d10,_0x2847ec){_0xc5d10=_0xc5d10-0x0;var _0x104d98=_0x090a[_0xc5d10];return _0x104d98;};'use strict';var util=require(_0xa090('0x0'));var path=require(_0xa090('0x1'));var _=require(_0xa090('0x2'));var csv=require(_0xa090('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa090('0x4'));var rimraf=require(_0xa090('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa090('0x6'))['dbH'];var logger=require(_0xa090('0x7'))(_0xa090('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa090('0x9')][0x2]);var QUERY=process[_0xa090('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d8eec,_0xe9ea31){var _0x11359d={'status':_0x3d8eec};var _0x10db78={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe9ea31){_0x11359d[_0xa090('0xa')]=_0xe9ea31;}return db[_0xa090('0xb')][_0xa090('0xc')](_0x11359d,_0x10db78);}function main(){var _0x4822a2=0x1388;var _0x2ded94;logger['info'](util[_0xa090('0xd')](_0xa090('0xe'),EXTRACTED_REPORT_ID,_0xa090('0xf')));return db[_0xa090('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})['then'](function(_0x11f7cf){if(_0x11f7cf){_0x2ded94=_0x11f7cf;_0x4822a2=_0x2ded94[_0xa090('0x11')]||0x1388;}})[_0xa090('0x12')](function(){return dbH[_0xa090('0x13')]['query'](util[_0xa090('0xd')](_0xa090('0x14'),QUERY),{'type':dbH[_0xa090('0x13')][_0xa090('0x15')][_0xa090('0x16')]});})[_0xa090('0x12')](function(_0x31c088){if(!_0x31c088[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2257ab=[];var _0x2f7b84=0x0;if(_0x2ded94[_0xa090('0x17')]){if(_0x31c088&&_0x31c088[_0xa090('0x18')]){var _0x3d6f8b=_[_0xa090('0x19')](_0x31c088[0x0][_0xa090('0x1a')]/_0x4822a2);var _0x5403dc=Number[_0xa090('0x1b')](_0x31c088[0x0][_0xa090('0x1a')]/_0x4822a2)?_0x31c088[0x0]['num']%_0x4822a2:0x0;_0x3d6f8b[_0xa090('0x1c')](function(_0x400bbf){if(_0x400bbf>0x0){_0x2f7b84+=_0x4822a2;}_0x2257ab[_0xa090('0x1d')](dbH['sequelize'][_0xa090('0x1e')](util[_0xa090('0xd')](_0xa090('0x1f'),QUERY,_0x4822a2,_0x2f7b84),{'type':dbH[_0xa090('0x13')]['QueryTypes'][_0xa090('0x16')]}));});if(_0x5403dc>0x0){_0x2f7b84+=_0x4822a2;_0x2257ab[_0xa090('0x1d')](dbH['sequelize'][_0xa090('0x1e')](util[_0xa090('0xd')](_0xa090('0x1f'),QUERY,_0x5403dc,_0x2f7b84),{'type':dbH[_0xa090('0x13')]['QueryTypes'][_0xa090('0x16')]}));}}}else{_0x2257ab[_0xa090('0x1d')](dbH['sequelize'][_0xa090('0x1e')](QUERY,{'type':dbH['sequelize'][_0xa090('0x15')][_0xa090('0x16')]}));}var _0x39eb82=path[_0xa090('0x20')](PATH);var _0x1e5fb1=path['basename'](PATH,'.csv');var _0x10bf18=_0x2ded94[_0xa090('0x17')]&&_0x2257ab[_0xa090('0x18')]>0x1;var _0x44f2aa=[];if(!fs[_0xa090('0x21')](path[_0xa090('0x22')](_0x39eb82,_0x1e5fb1))&&_0x10bf18){fs['mkdirSync'](path[_0xa090('0x22')](_0x39eb82,_0x1e5fb1));}return BPromise['each'](_0x2257ab,function(_0x3b5a89){_0x44f2aa[_0xa090('0x1d')](_0x3b5a89);})[_0xa090('0x12')](function(){for(var _0x528cc1=0x0;_0x528cc1<_0x44f2aa['length'];_0x528cc1+=0x1){var _0x46aaa2;var _0x422a60=_0x44f2aa[_0x528cc1];if(_0x10bf18){_0x46aaa2=path[_0xa090('0x22')](_0x39eb82,_0x1e5fb1,util[_0xa090('0xd')](_0xa090('0x23'),_0x1e5fb1,_0x528cc1,_0xa090('0x24')));}else{_0x46aaa2=path['join'](_0x39eb82,util['format']('%s.%s',_0x1e5fb1,_0xa090('0x24')));}fs[_0xa090('0x25')](_0x46aaa2,csv(_0x422a60));}})['then'](function(){if(_0x10bf18){return new Promise(function(_0x3f2a7a){zipdir(path['join'](_0x39eb82,_0x1e5fb1),{'saveTo':path[_0xa090('0x22')](_0x39eb82,util[_0xa090('0xd')](_0xa090('0x26'),_0x1e5fb1,_0xa090('0x27')))},function(_0x3c5027,_0x38de76){rimraf(path[_0xa090('0x22')](_0x39eb82,_0x1e5fb1),function(){});_0x3f2a7a(_0xa090('0x28'));});});}})[_0xa090('0x12')](function(){logger[_0xa090('0x29')](util['format'](_0xa090('0x2a'),EXTRACTED_REPORT_ID,_0xa090('0xf')));return analyticExtractedReport(_0xa090('0x2b'),_0x10bf18?util[_0xa090('0xd')](_0xa090('0x26'),_0x1e5fb1,_0x10bf18?_0xa090('0x27'):'csv'):null);});})['catch'](function(_0x378dea){logger[_0xa090('0x29')](util[_0xa090('0xd')](_0xa090('0x2c'),EXTRACTED_REPORT_ID,_0xa090('0xf')),util[_0xa090('0x2d')](_0x378dea,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa090('0x2e'));})['finally'](function(){process[_0xa090('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4b41=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','num','Empty','length','range','isInteger','forEach','push','query','QueryTypes','SELECT','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x4e301b,_0x1d9815){var _0x597804=function(_0x376d17){while(--_0x376d17){_0x4e301b['push'](_0x4e301b['shift']());}};_0x597804(++_0x1d9815);}(_0x4b41,0xfd));var _0x14b4=function(_0x14ce14,_0x3d9dd1){_0x14ce14=_0x14ce14-0x0;var _0x20471d=_0x4b41[_0x14ce14];return _0x20471d;};'use strict';var util=require(_0x14b4('0x0'));var path=require(_0x14b4('0x1'));var _=require(_0x14b4('0x2'));var csv=require(_0x14b4('0x3'));var fs=require('fs');var BPromise=require(_0x14b4('0x4'));var zipdir=require(_0x14b4('0x5'));var rimraf=require('rimraf');var db=require(_0x14b4('0x6'))['db'];var dbH=require(_0x14b4('0x6'))['dbH'];var logger=require(_0x14b4('0x7'))(_0x14b4('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x14b4('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2223af,_0x4326eb){var _0x181cd5={'status':_0x2223af};var _0x57b7c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4326eb){_0x181cd5[_0x14b4('0xa')]=_0x4326eb;}return db[_0x14b4('0xb')][_0x14b4('0xc')](_0x181cd5,_0x57b7c0);}function main(){var _0xf2d298=0x1388;var _0x2184fa;logger['info'](util[_0x14b4('0xd')](_0x14b4('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x14b4('0xf')][_0x14b4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x14b4('0x11'),_0x14b4('0x12')]})[_0x14b4('0x13')](function(_0x2e594c){if(_0x2e594c){_0x2184fa=_0x2e594c;_0xf2d298=_0x2184fa['splitSizeCsv']||0x1388;}})[_0x14b4('0x13')](function(){return dbH['sequelize']['query'](util[_0x14b4('0xd')](_0x14b4('0x14'),QUERY),{'type':dbH[_0x14b4('0x15')]['QueryTypes']['SELECT']});})['then'](function(_0x5379e3){if(!_0x5379e3[0x0][_0x14b4('0x16')]){return analyticExtractedReport(_0x14b4('0x17'));}var _0x10aa95=[];var _0x44efef=0x0;if(_0x2184fa['split']){if(_0x5379e3&&_0x5379e3[_0x14b4('0x18')]){var _0x160b52=_[_0x14b4('0x19')](_0x5379e3[0x0][_0x14b4('0x16')]/_0xf2d298);var _0x19742a=Number[_0x14b4('0x1a')](_0x5379e3[0x0][_0x14b4('0x16')]/_0xf2d298)?_0x5379e3[0x0]['num']%_0xf2d298:0x0;_0x160b52[_0x14b4('0x1b')](function(_0x1da044){if(_0x1da044>0x0){_0x44efef+=_0xf2d298;}_0x10aa95[_0x14b4('0x1c')](dbH[_0x14b4('0x15')][_0x14b4('0x1d')](util[_0x14b4('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf2d298,_0x44efef),{'type':dbH[_0x14b4('0x15')][_0x14b4('0x1e')][_0x14b4('0x1f')]}));});if(_0x19742a>0x0){_0x44efef+=_0xf2d298;_0x10aa95[_0x14b4('0x1c')](dbH[_0x14b4('0x15')]['query'](util[_0x14b4('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x19742a,_0x44efef),{'type':dbH[_0x14b4('0x15')]['QueryTypes'][_0x14b4('0x1f')]}));}}}else{_0x10aa95[_0x14b4('0x1c')](dbH['sequelize'][_0x14b4('0x1d')](QUERY,{'type':dbH[_0x14b4('0x15')][_0x14b4('0x1e')]['SELECT']}));}var _0x3aa412=path['dirname'](PATH);var _0x179c7a=path[_0x14b4('0x20')](PATH,'.csv');var _0x415391=_0x2184fa[_0x14b4('0x11')]&&_0x10aa95['length']>0x1;var _0x3a429c=[];if(!fs[_0x14b4('0x21')](path[_0x14b4('0x22')](_0x3aa412,_0x179c7a))&&_0x415391){fs['mkdirSync'](path[_0x14b4('0x22')](_0x3aa412,_0x179c7a));}return BPromise[_0x14b4('0x23')](_0x10aa95,function(_0x551a88){_0x3a429c['push'](_0x551a88);})[_0x14b4('0x13')](function(){for(var _0x5b9466=0x0;_0x5b9466<_0x3a429c[_0x14b4('0x18')];_0x5b9466+=0x1){var _0x7d8869;var _0x4d8874=_0x3a429c[_0x5b9466];if(_0x415391){_0x7d8869=path[_0x14b4('0x22')](_0x3aa412,_0x179c7a,util[_0x14b4('0xd')](_0x14b4('0x24'),_0x179c7a,_0x5b9466,_0x14b4('0x25')));}else{_0x7d8869=path['join'](_0x3aa412,util[_0x14b4('0xd')](_0x14b4('0x26'),_0x179c7a,_0x14b4('0x25')));}fs[_0x14b4('0x27')](_0x7d8869,csv(_0x4d8874));}})['then'](function(){if(_0x415391){return new Promise(function(_0x3ebda2){zipdir(path[_0x14b4('0x22')](_0x3aa412,_0x179c7a),{'saveTo':path[_0x14b4('0x22')](_0x3aa412,util[_0x14b4('0xd')](_0x14b4('0x26'),_0x179c7a,_0x14b4('0x28')))},function(_0x22bd36,_0x1e89c3){rimraf(path['join'](_0x3aa412,_0x179c7a),function(){});_0x3ebda2('zip\x20finished');});});}})[_0x14b4('0x13')](function(){logger['info'](util[_0x14b4('0xd')](_0x14b4('0x29'),EXTRACTED_REPORT_ID,_0x14b4('0x2a')));return analyticExtractedReport(_0x14b4('0x2b'),_0x415391?util[_0x14b4('0xd')](_0x14b4('0x26'),_0x179c7a,_0x415391?'zip':_0x14b4('0x25')):null);});})[_0x14b4('0x2c')](function(_0x3a3cbf){logger[_0x14b4('0x2d')](util[_0x14b4('0xd')](_0x14b4('0x2e'),EXTRACTED_REPORT_ID,_0x14b4('0x2a')),util[_0x14b4('0x2f')](_0x3a3cbf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x14b4('0x30'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 83ab8ab..84d750c 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 _0x3ba3=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','jsdom','window','bluebird','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','map','tableHeader','toString','fill','length','auto','body','push','concat','chunk','keys','forEach','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','Empty','Setting','splitSizePdf','split','range','isInteger','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','query','SELECT','QueryTypes','.pdf','join','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip'];(function(_0x41fbbb,_0x1fb472){var _0x4e5ba0=function(_0x5e2cc3){while(--_0x5e2cc3){_0x41fbbb['push'](_0x41fbbb['shift']());}};_0x4e5ba0(++_0x1fb472);}(_0x3ba3,0x1c6));var _0x33ba=function(_0x5bda8c,_0x275ef0){_0x5bda8c=_0x5bda8c-0x0;var _0x2b80f0=_0x3ba3[_0x5bda8c];return _0x2b80f0;};'use strict';var _=require(_0x33ba('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x33ba('0x1'));var moment=require(_0x33ba('0x2'));var htmlToPdfmake=require(_0x33ba('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x33ba('0x4'))['JSDOM'];var window=new JSDOM('')[_0x33ba('0x5')];var BPromise=require(_0x33ba('0x6'));var db=require(_0x33ba('0x7'))['db'];var dbH=require(_0x33ba('0x7'))['dbH'];var logger=require(_0x33ba('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x33ba('0x9')][0x2]);var QUERY=process[_0x33ba('0x9')][0x3];var PATH=process[_0x33ba('0x9')][0x4];var NAME=process[_0x33ba('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x492ad9,_0x2b3143){var _0x20f85d={'status':_0x492ad9};var _0x43599c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b3143){_0x20f85d[_0x33ba('0xa')]=_0x2b3143;}return db[_0x33ba('0xb')]['update'](_0x20f85d,_0x43599c);}function getHeaders(_0x477f79){return _[_0x33ba('0xc')](_0x477f79,function(_0x3266f2){return{'text':_0x3266f2,'style':_0x33ba('0xd')};});}function getRows(_0xbe480c,_0x1c2934){return _[_0x33ba('0xc')](_0x1c2934,function(_0x504cc0){return _(_0x504cc0)['pick'](_0xbe480c)[_0x33ba('0xc')](function(_0x49ced9){return _0x49ced9?_[_0x33ba('0xe')](_0x49ced9):'';})['value']();});}function createTable(_0x20d295,_0x4c6d7e){var _0x322db5={'widths':_[_0x33ba('0xf')](Array(_0x20d295[_0x33ba('0x10')]),0x91),'heights':function(_0x19335f){return _0x19335f===0x0?_0x33ba('0x11'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x44211f=getHeaders(_0x20d295);_0x322db5[_0x33ba('0x12')][_0x33ba('0x13')](_0x44211f);var _0x1b8e16=getRows(_0x20d295,_0x4c6d7e);_0x322db5[_0x33ba('0x12')]=_0x322db5['body'][_0x33ba('0x14')](_0x1b8e16);return _0x322db5;}function createTables(_0x424c13){var _0x4f446d=[];var _0x380dc8=_[_0x33ba('0x15')](Object[_0x33ba('0x16')](_0x424c13[0x0]),0x5);_0x380dc8[_0x33ba('0x17')](function(_0x1ed749){_0x4f446d[_0x33ba('0x13')](createTable(_0x1ed749,_0x424c13));});return _0x4f446d;}function getPDFDocDefinition(_0x39efeb){var _0x4ad16b=util[_0x33ba('0x18')](_0x33ba('0x19'),NAME,EXTRACTED_REPORT[_0x33ba('0x1a')],moment(EXTRACTED_REPORT[_0x33ba('0x1b')])[_0x33ba('0x18')](FORMAT),moment(EXTRACTED_REPORT[_0x33ba('0x1c')])[_0x33ba('0x18')](FORMAT));var _0x3e05d7=[];for(var _0x3489f4=0x0;_0x3489f4<_0x39efeb['length'];_0x3489f4++){var _0x57504e=[];if(_0x3489f4===0x0){_0x57504e[_0x33ba('0x13')]({'text':_0x4ad16b,'style':_0x33ba('0x1d')});}var _0x268ebc={'table':_0x39efeb[_0x3489f4]};if(_0x3489f4>0x0){_0x268ebc[_0x33ba('0x1e')]=_0x33ba('0x1f');_0x268ebc[_0x33ba('0x20')]=[0x0,0x46,0x0,0x0];}_0x57504e['push'](_0x268ebc);_0x3e05d7[_0x33ba('0x13')](_0x57504e);}return{'pageSize':'A4','pageOrientation':_0x33ba('0x21'),'content':_0x3e05d7,'footer':function(_0x28874a,_0x56c7e7){return{'text':_0x28874a[_0x33ba('0xe')]()+_0x33ba('0x22')+_0x56c7e7,'style':_0x33ba('0x23')};},'defaultStyle':{'font':_0x33ba('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x33ba('0x25')},'footer':{'alignment':_0x33ba('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1d7046){var _0x30a15d=0x1388;var _0x19a93e;if(!_0x1d7046[0x0]['num']){return analyticExtractedReport(_0x33ba('0x27'));}return db[_0x33ba('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x33ba('0x29')]})['then'](function(_0x28635f){if(_0x28635f){_0x19a93e=_0x28635f;_0x30a15d=_0x19a93e['splitSizePdf']||0x3e8;}})['then'](function(){var _0x3e40c1=[];var _0xa2b332=0x0;if(_0x19a93e[_0x33ba('0x2a')]){if(_0x1d7046&&_0x1d7046['length']){var _0x3ad87d=_[_0x33ba('0x2b')](_0x1d7046[0x0]['num']/_0x30a15d);var _0x207880=Number[_0x33ba('0x2c')](_0x1d7046[0x0][_0x33ba('0x2d')]/_0x30a15d)?_0x1d7046[0x0][_0x33ba('0x2d')]%_0x30a15d:0x0;_0x3ad87d[_0x33ba('0x17')](function(_0x5e28c7){if(_0x5e28c7>0x0){_0xa2b332+=_0x30a15d;}_0x3e40c1[_0x33ba('0x13')](dbH[_0x33ba('0x2e')]['query'](util['format'](_0x33ba('0x2f'),QUERY,_0x30a15d,_0xa2b332),{'type':dbH[_0x33ba('0x2e')]['QueryTypes']['SELECT']}));});if(_0x207880>0x0){_0xa2b332+=_0x30a15d;_0x3e40c1['push'](dbH[_0x33ba('0x2e')][_0x33ba('0x30')](util[_0x33ba('0x18')](_0x33ba('0x2f'),QUERY,_0x207880,_0xa2b332),{'type':dbH[_0x33ba('0x2e')]['QueryTypes'][_0x33ba('0x31')]}));}}}else{_0x3e40c1[_0x33ba('0x13')](dbH[_0x33ba('0x2e')][_0x33ba('0x30')](QUERY,{'type':dbH[_0x33ba('0x2e')][_0x33ba('0x32')]['SELECT']}));}var _0x5f4ec6=path['dirname'](PATH);var _0x41102e=path['basename'](PATH,_0x33ba('0x33'));var _0x41ea2c=_0x19a93e[_0x33ba('0x2a')]&&_0x3e40c1[_0x33ba('0x10')]>0x1;var _0x303e97=[];if(!fs['existsSync'](path[_0x33ba('0x34')](_0x5f4ec6,_0x41102e))&&_0x41ea2c){fs['mkdirSync'](path[_0x33ba('0x34')](_0x5f4ec6,_0x41102e));}return BPromise[_0x33ba('0x35')](_0x3e40c1,function(_0x367dec){_0x303e97['push'](_0x367dec);})[_0x33ba('0x36')](function(){var _0x520faa=[];for(var _0x5c6f17=0x0;_0x5c6f17<_0x303e97[_0x33ba('0x10')];_0x5c6f17+=0x1){var _0x49d76c=_0x303e97[_0x5c6f17];var _0x20f3ff=createTables(_[_0x33ba('0x37')](_0x49d76c));var _0x42b17c;var _0x2af2bf=getPDFDocDefinition(_0x20f3ff);var _0x5a2a44=getPDFPrinter();var _0x507a51=_0x5a2a44[_0x33ba('0x38')](_0x2af2bf);if(_0x41ea2c){_0x42b17c=path[_0x33ba('0x34')](_0x5f4ec6,_0x41102e,util['format'](_0x33ba('0x39'),_0x41102e,_0x5c6f17,_0x33ba('0x3a')));}else{_0x42b17c=path[_0x33ba('0x34')](_0x5f4ec6,util[_0x33ba('0x18')](_0x33ba('0x3b'),_0x41102e,'pdf'));}_0x520faa['push'](writePDFDocument(_0x507a51,_0x42b17c));}return Promise[_0x33ba('0x3c')](_0x520faa);})['then'](function(){if(_0x41ea2c){return new Promise(function(_0x2111e5){zipdir(path['join'](_0x5f4ec6,_0x41102e),{'saveTo':path['join'](_0x5f4ec6,util['format'](_0x33ba('0x3b'),_0x41102e,_0x33ba('0x3d')))},function(){rimraf(path[_0x33ba('0x34')](_0x5f4ec6,_0x41102e),function(){});_0x2111e5('zip\x20finished');});});}})[_0x33ba('0x36')](function(){if(!_0x41ea2c)return;rimraf(path[_0x33ba('0x34')](_0x5f4ec6,_0x41102e),function(){});})['then'](function(){logger['info'](util[_0x33ba('0x18')](_0x33ba('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x33ba('0x3f'),_0x41ea2c?util[_0x33ba('0x18')]('%s.%s',_0x41102e,_0x41ea2c?_0x33ba('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x33ba('0x40')](util[_0x33ba('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x33ba('0x41')));return db['AnalyticExtractedReport'][_0x33ba('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x33ba('0x36')](function(_0xbf4b2e){EXTRACTED_REPORT=_0xbf4b2e;return dbH['sequelize'][_0x33ba('0x30')](util[_0x33ba('0x18')](_0x33ba('0x43'),QUERY),{'type':dbH[_0x33ba('0x2e')][_0x33ba('0x32')][_0x33ba('0x31')]});})[_0x33ba('0x36')](extractReport)[_0x33ba('0x44')](function(_0x1ee270){logger[_0x33ba('0x40')](util[_0x33ba('0x18')](_0x33ba('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0x33ba('0x46')](_0x1ee270,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x33ba('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4a0c4c=new PdfPrinter({'Arial':{'normal':__dirname+_0x33ba('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x33ba('0x49'),'bolditalics':__dirname+_0x33ba('0x4a')}});return _0x4a0c4c;}function getPDFDocDefinitionFromHTML(_0x44141d,_0x3e44ba){var _0x5d7efc=util[_0x33ba('0x18')](_0x33ba('0x4b'),_0x3e44ba[_0x33ba('0x4c')],_0x3e44ba[_0x33ba('0x4d')]);var _0x47c7b1=moment()[_0x33ba('0x18')](_0x33ba('0x4e'))[_0x33ba('0xe')]();var _0x292559=htmlToPdfmake(_0x44141d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x292559],'defaultStyle':{'font':_0x33ba('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x33ba('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x33ba('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x33ba('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x3cb9c7,_0x3ab61d){return[{'text':util[_0x33ba('0x18')](_0x33ba('0x50'),_0x5d7efc,_0x3cb9c7,_0x3ab61d,_0x47c7b1),'style':_0x33ba('0x23')}];}};}function writePDFDocument(_0x16d86d,_0x35bccd){return new Promise(function(_0x57b6e3,_0x196c87){var _0x588819=_0x16d86d[_0x33ba('0x51')](fs[_0x33ba('0x52')](_0x35bccd));_0x588819['on'](_0x33ba('0x53'),function(){_0x57b6e3('finish');});_0x588819['on']('error',function(_0x3f7d35){_0x196c87(_0x3f7d35);});_0x16d86d[_0x33ba('0x54')]();});}exports[_0x33ba('0x55')]=function(_0xc86fdc,_0x2cb571){var _0x2ac1e8=getPDFPrinter();var _0x170faf=getPDFDocDefinitionFromHTML(_0xc86fdc,_0x2cb571);var _0x5459dd=_0x2ac1e8[_0x33ba('0x38')](_0x170faf);return writePDFDocument(_0x5459dd,_0x2cb571[_0x33ba('0x1')])[_0x33ba('0x44')](function(_0x26b982){throw _0x26b982;});}; \ No newline at end of file +var _0x31b2=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','tableHeader','map','pick','toString','value','fill','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','Arial','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','SELECT','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.pdf','existsSync','mkdirSync','each','flatten','createPdfKitDocument','join','pdf','%s.%s','all','zip','zip\x20finished','info'];(function(_0x2cf7ad,_0x13f929){var _0x2ca730=function(_0xd581a){while(--_0xd581a){_0x2cf7ad['push'](_0x2cf7ad['shift']());}};_0x2ca730(++_0x13f929);}(_0x31b2,0x1cb));var _0x231b=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x31b2[_0x13ed69];return _0x50c72e;};'use strict';var _=require(_0x231b('0x0'));var fs=require('fs');var util=require(_0x231b('0x1'));var path=require(_0x231b('0x2'));var moment=require(_0x231b('0x3'));var htmlToPdfmake=require(_0x231b('0x4'));var PdfPrinter=require(_0x231b('0x5'));var zipdir=require(_0x231b('0x6'));var rimraf=require(_0x231b('0x7'));var JSDOM=require(_0x231b('0x8'))['JSDOM'];var window=new JSDOM('')[_0x231b('0x9')];var BPromise=require(_0x231b('0xa'));var db=require(_0x231b('0xb'))['db'];var dbH=require(_0x231b('0xb'))[_0x231b('0xc')];var logger=require(_0x231b('0xd'))(_0x231b('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x231b('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x231b('0xf')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x231b('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x52de5f,_0x43b175){var _0x5695c8={'status':_0x52de5f};var _0x1a6048={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43b175){_0x5695c8['savename']=_0x43b175;}return db[_0x231b('0x11')]['update'](_0x5695c8,_0x1a6048);}function getHeaders(_0x5ede36){return _['map'](_0x5ede36,function(_0x2344d2){return{'text':_0x2344d2,'style':_0x231b('0x12')};});}function getRows(_0x723813,_0x48d330){return _[_0x231b('0x13')](_0x48d330,function(_0x234c58){return _(_0x234c58)[_0x231b('0x14')](_0x723813)[_0x231b('0x13')](function(_0x46434b){return _0x46434b?_[_0x231b('0x15')](_0x46434b):'';})[_0x231b('0x16')]();});}function createTable(_0xb51bd9,_0x28ae63){var _0xa58ed9={'widths':_[_0x231b('0x17')](Array(_0xb51bd9[_0x231b('0x18')]),0x91),'heights':function(_0x5cc8af){return _0x5cc8af===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x13d7d6=getHeaders(_0xb51bd9);_0xa58ed9[_0x231b('0x19')][_0x231b('0x1a')](_0x13d7d6);var _0x4231f7=getRows(_0xb51bd9,_0x28ae63);_0xa58ed9[_0x231b('0x19')]=_0xa58ed9['body'][_0x231b('0x1b')](_0x4231f7);return _0xa58ed9;}function createTables(_0x2ae181){var _0xeb5ca7=[];var _0x47ad4e=_[_0x231b('0x1c')](Object[_0x231b('0x1d')](_0x2ae181[0x0]),0x5);_0x47ad4e[_0x231b('0x1e')](function(_0x1fd48c){_0xeb5ca7[_0x231b('0x1a')](createTable(_0x1fd48c,_0x2ae181));});return _0xeb5ca7;}function getPDFDocDefinition(_0x35bf91){var _0x5363d1=util[_0x231b('0x1f')](_0x231b('0x20'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x231b('0x21')])[_0x231b('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x231b('0x22')])[_0x231b('0x1f')](FORMAT));var _0x5801d0=[];for(var _0xec11e0=0x0;_0xec11e0<_0x35bf91[_0x231b('0x18')];_0xec11e0++){var _0x3534dd=[];if(_0xec11e0===0x0){_0x3534dd[_0x231b('0x1a')]({'text':_0x5363d1,'style':_0x231b('0x23')});}var _0x4149d0={'table':_0x35bf91[_0xec11e0]};if(_0xec11e0>0x0){_0x4149d0[_0x231b('0x24')]='before';_0x4149d0[_0x231b('0x25')]=[0x0,0x46,0x0,0x0];}_0x3534dd[_0x231b('0x1a')](_0x4149d0);_0x5801d0[_0x231b('0x1a')](_0x3534dd);}return{'pageSize':'A4','pageOrientation':_0x231b('0x26'),'content':_0x5801d0,'footer':function(_0x32f5b9,_0x1df6a1){return{'text':_0x32f5b9[_0x231b('0x15')]()+_0x231b('0x27')+_0x1df6a1,'style':'footer'};},'defaultStyle':{'font':_0x231b('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x231b('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1575f3){var _0x5a5235=0x1388;var _0x16de3b;if(!_0x1575f3[0x0][_0x231b('0x2a')]){return analyticExtractedReport(_0x231b('0x2b'));}return db['Setting'][_0x231b('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x231b('0x2d'),_0x231b('0x2e')]})[_0x231b('0x2f')](function(_0x23a831){if(_0x23a831){_0x16de3b=_0x23a831;_0x5a5235=_0x16de3b[_0x231b('0x2e')]||0x3e8;}})[_0x231b('0x2f')](function(){var _0x179626=[];var _0x43fd16=0x0;if(_0x16de3b['split']){if(_0x1575f3&&_0x1575f3[_0x231b('0x18')]){var _0x2d5788=_[_0x231b('0x30')](_0x1575f3[0x0][_0x231b('0x2a')]/_0x5a5235);var _0x3c1c46=Number[_0x231b('0x31')](_0x1575f3[0x0][_0x231b('0x2a')]/_0x5a5235)?_0x1575f3[0x0][_0x231b('0x2a')]%_0x5a5235:0x0;_0x2d5788['forEach'](function(_0x391570){if(_0x391570>0x0){_0x43fd16+=_0x5a5235;}_0x179626[_0x231b('0x1a')](dbH['sequelize'][_0x231b('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a5235,_0x43fd16),{'type':dbH['sequelize']['QueryTypes'][_0x231b('0x33')]}));});if(_0x3c1c46>0x0){_0x43fd16+=_0x5a5235;_0x179626[_0x231b('0x1a')](dbH[_0x231b('0x34')][_0x231b('0x32')](util['format'](_0x231b('0x35'),QUERY,_0x3c1c46,_0x43fd16),{'type':dbH['sequelize'][_0x231b('0x36')][_0x231b('0x33')]}));}}}else{_0x179626[_0x231b('0x1a')](dbH[_0x231b('0x34')]['query'](QUERY,{'type':dbH[_0x231b('0x34')][_0x231b('0x36')][_0x231b('0x33')]}));}var _0x1248c2=path[_0x231b('0x37')](PATH);var _0x542c53=path['basename'](PATH,_0x231b('0x38'));var _0xc2d8fd=_0x16de3b[_0x231b('0x2d')]&&_0x179626[_0x231b('0x18')]>0x1;var _0x1c6b0e=[];if(!fs[_0x231b('0x39')](path['join'](_0x1248c2,_0x542c53))&&_0xc2d8fd){fs[_0x231b('0x3a')](path['join'](_0x1248c2,_0x542c53));}return BPromise[_0x231b('0x3b')](_0x179626,function(_0x58c052){_0x1c6b0e[_0x231b('0x1a')](_0x58c052);})[_0x231b('0x2f')](function(){var _0x53fcaf=[];for(var _0x5d5f4c=0x0;_0x5d5f4c<_0x1c6b0e['length'];_0x5d5f4c+=0x1){var _0x373bb4=_0x1c6b0e[_0x5d5f4c];var _0x214d9c=createTables(_[_0x231b('0x3c')](_0x373bb4));var _0x3dabe8;var _0x316305=getPDFDocDefinition(_0x214d9c);var _0x302469=getPDFPrinter();var _0x15899b=_0x302469[_0x231b('0x3d')](_0x316305);if(_0xc2d8fd){_0x3dabe8=path[_0x231b('0x3e')](_0x1248c2,_0x542c53,util[_0x231b('0x1f')]('%s%d.%s',_0x542c53,_0x5d5f4c,_0x231b('0x3f')));}else{_0x3dabe8=path[_0x231b('0x3e')](_0x1248c2,util[_0x231b('0x1f')](_0x231b('0x40'),_0x542c53,_0x231b('0x3f')));}_0x53fcaf[_0x231b('0x1a')](writePDFDocument(_0x15899b,_0x3dabe8));}return Promise[_0x231b('0x41')](_0x53fcaf);})[_0x231b('0x2f')](function(){if(_0xc2d8fd){return new Promise(function(_0x5d2ef5){zipdir(path[_0x231b('0x3e')](_0x1248c2,_0x542c53),{'saveTo':path[_0x231b('0x3e')](_0x1248c2,util['format'](_0x231b('0x40'),_0x542c53,_0x231b('0x42')))},function(){rimraf(path['join'](_0x1248c2,_0x542c53),function(){});_0x5d2ef5(_0x231b('0x43'));});});}})[_0x231b('0x2f')](function(){if(!_0xc2d8fd)return;rimraf(path[_0x231b('0x3e')](_0x1248c2,_0x542c53),function(){});})[_0x231b('0x2f')](function(){logger[_0x231b('0x44')](util['format'](_0x231b('0x45'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0xc2d8fd?util[_0x231b('0x1f')](_0x231b('0x40'),_0x542c53,_0xc2d8fd?_0x231b('0x42'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x231b('0x44')](util[_0x231b('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x231b('0x46')));return db[_0x231b('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x231b('0x2f')](function(_0x3da963){EXTRACTED_REPORT=_0x3da963;return dbH[_0x231b('0x34')][_0x231b('0x32')](util[_0x231b('0x1f')](_0x231b('0x47'),QUERY),{'type':dbH['sequelize'][_0x231b('0x36')][_0x231b('0x33')]});})[_0x231b('0x2f')](extractReport)[_0x231b('0x48')](function(_0x5a631b){logger[_0x231b('0x44')](util[_0x231b('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x231b('0x46')),util[_0x231b('0x49')](_0x5a631b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x231b('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x31bf9b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x231b('0x4b'),'bolditalics':__dirname+_0x231b('0x4c')}});return _0x31bf9b;}function getPDFDocDefinitionFromHTML(_0x20ab3a,_0x410be0){var _0x245134=util[_0x231b('0x1f')](_0x231b('0x4d'),_0x410be0[_0x231b('0x4e')],_0x410be0[_0x231b('0x4f')]);var _0x19ea6d=moment()[_0x231b('0x1f')](_0x231b('0x50'))[_0x231b('0x15')]();var _0x4e7942=htmlToPdfmake(_0x20ab3a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4e7942],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x231b('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x231b('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x231b('0x52'),'style':_0x231b('0x23')}];},'footer':function(_0x11ebb6,_0x225b05){return[{'text':util[_0x231b('0x1f')](_0x231b('0x53'),_0x245134,_0x11ebb6,_0x225b05,_0x19ea6d),'style':_0x231b('0x54')}];}};}function writePDFDocument(_0x4fddd4,_0x397b54){return new Promise(function(_0x2c7abc,_0x48d92e){var _0x20148b=_0x4fddd4['pipe'](fs[_0x231b('0x55')](_0x397b54));_0x20148b['on'](_0x231b('0x56'),function(){_0x2c7abc(_0x231b('0x56'));});_0x20148b['on']('error',function(_0x3c4987){_0x48d92e(_0x3c4987);});_0x4fddd4['end']();});}exports[_0x231b('0x57')]=function(_0x48e16e,_0x1f0faa){var _0x36dc43=getPDFPrinter();var _0xccd3ee=getPDFDocDefinitionFromHTML(_0x48e16e,_0x1f0faa);var _0x441d9c=_0x36dc43[_0x231b('0x3d')](_0xccd3ee);return writePDFDocument(_0x441d9c,_0x1f0faa[_0x231b('0x2')])[_0x231b('0x48')](function(_0x22d798){throw _0x22d798;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d2d0fac..d7dc0db 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 _0x658b=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','format'];(function(_0x53c368,_0x4ea2f3){var _0x109bda=function(_0x29fb58){while(--_0x29fb58){_0x53c368['push'](_0x53c368['shift']());}};_0x109bda(++_0x4ea2f3);}(_0x658b,0x11f));var _0xb658=function(_0x209108,_0x45ffa0){_0x209108=_0x209108-0x0;var _0x4bbfc8=_0x658b[_0x209108];return _0x4bbfc8;};'use strict';var util=require(_0xb658('0x0'));var path=require(_0xb658('0x1'));var _=require(_0xb658('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xb658('0x3'));var rimraf=require(_0xb658('0x4'));var db=require(_0xb658('0x5'))['db'];var dbH=require(_0xb658('0x5'))[_0xb658('0x6')];var logger=require('../../config/logger')(_0xb658('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb658('0x8')][0x3];var PATH=process[_0xb658('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c9b81,_0x963306){var _0x1749f1={'status':_0x1c9b81};var _0x4edfce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x963306){_0x1749f1[_0xb658('0x9')]=_0x963306;}return db[_0xb658('0xa')][_0xb658('0xb')](_0x1749f1,_0x4edfce);}function main(){var _0x2116d6=0x1388;var _0x1a728f;logger['info'](util[_0xb658('0xc')](_0xb658('0xd'),EXTRACTED_REPORT_ID,_0xb658('0xe')));return db[_0xb658('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb658('0x10'),_0xb658('0x11')]})['then'](function(_0xef22dd){if(_0xef22dd){_0x1a728f=_0xef22dd;_0x2116d6=_0x1a728f[_0xb658('0x11')]||0x1388;}})[_0xb658('0x12')](function(){return dbH[_0xb658('0x13')][_0xb658('0x14')](util[_0xb658('0xc')](_0xb658('0x15'),QUERY),{'type':dbH[_0xb658('0x13')][_0xb658('0x16')][_0xb658('0x17')]});})[_0xb658('0x12')](function(_0x54a98c){if(!_0x54a98c[0x0][_0xb658('0x18')]){return analyticExtractedReport('Empty');}var _0x200b37=[];var _0x36914d=0x0;if(_0x1a728f[_0xb658('0x10')]){if(_0x54a98c&&_0x54a98c[_0xb658('0x19')]){var _0x230fc7=_[_0xb658('0x1a')](_0x54a98c[0x0][_0xb658('0x18')]/_0x2116d6);var _0x2b392a=Number[_0xb658('0x1b')](_0x54a98c[0x0][_0xb658('0x18')]/_0x2116d6)?_0x54a98c[0x0]['num']%_0x2116d6:0x0;_0x230fc7[_0xb658('0x1c')](function(_0x6e00ca){if(_0x6e00ca>0x0){_0x36914d+=_0x2116d6;}_0x200b37[_0xb658('0x1d')](dbH[_0xb658('0x13')]['query'](util[_0xb658('0xc')](_0xb658('0x1e'),QUERY,_0x2116d6,_0x36914d),{'type':dbH[_0xb658('0x13')][_0xb658('0x16')][_0xb658('0x17')]}));});if(_0x2b392a>0x0){_0x36914d+=_0x2116d6;_0x200b37[_0xb658('0x1d')](dbH[_0xb658('0x13')][_0xb658('0x14')](util['format'](_0xb658('0x1e'),QUERY,_0x2b392a,_0x36914d),{'type':dbH[_0xb658('0x13')][_0xb658('0x16')]['SELECT']}));}}}else{_0x200b37[_0xb658('0x1d')](dbH[_0xb658('0x13')][_0xb658('0x14')](QUERY,{'type':dbH[_0xb658('0x13')][_0xb658('0x16')][_0xb658('0x17')]}));}var _0x3d2bc6=path[_0xb658('0x1f')](PATH);var _0x5ef234=path['basename'](PATH,_0xb658('0x20'));var _0x39dc3f=_0x1a728f[_0xb658('0x10')]&&_0x200b37['length']>0x1;var _0x149646=[];if(!fs[_0xb658('0x21')](path[_0xb658('0x22')](_0x3d2bc6,_0x5ef234))&&_0x39dc3f){fs[_0xb658('0x23')](path[_0xb658('0x22')](_0x3d2bc6,_0x5ef234));}return BPromise['each'](_0x200b37,function(_0x1de541){_0x149646[_0xb658('0x1d')](_0x1de541);})[_0xb658('0x12')](function(){for(var _0x1b51a2=0x0;_0x1b51a2<_0x149646[_0xb658('0x19')];_0x1b51a2+=0x1){var _0x1fad46;var _0x49aa37=_0x149646[_0x1b51a2];if(_0x39dc3f){_0x1fad46=path[_0xb658('0x22')](_0x3d2bc6,_0x5ef234,util[_0xb658('0xc')](_0xb658('0x24'),_0x5ef234,_0x1b51a2,_0xb658('0x25')));}else{_0x1fad46=path[_0xb658('0x22')](_0x3d2bc6,util[_0xb658('0xc')](_0xb658('0x26'),_0x5ef234,'xlsx'));}fs['writeFileSync'](_0x1fad46,json2xls(_0x49aa37),_0xb658('0x27'));}})['then'](function(){if(_0x39dc3f){return new Promise(function(_0x123ddc){zipdir(path[_0xb658('0x22')](_0x3d2bc6,_0x5ef234),{'saveTo':path[_0xb658('0x22')](_0x3d2bc6,util[_0xb658('0xc')](_0xb658('0x26'),_0x5ef234,_0xb658('0x28')))},function(_0x3b73f7,_0x2c4879){rimraf(path[_0xb658('0x22')](_0x3d2bc6,_0x5ef234),function(){});_0x123ddc(_0xb658('0x29'));});});}})['then'](function(){logger[_0xb658('0x2a')](util[_0xb658('0xc')](_0xb658('0x2b'),EXTRACTED_REPORT_ID,_0xb658('0xe')));return analyticExtractedReport(_0xb658('0x2c'),_0x39dc3f?util[_0xb658('0xc')](_0xb658('0x26'),_0x5ef234,_0x39dc3f?_0xb658('0x28'):_0xb658('0x25')):null);});})[_0xb658('0x2d')](function(_0x482b7a){logger[_0xb658('0x2a')](util[_0xb658('0xc')](_0xb658('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x482b7a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb658('0x2f'));})[_0xb658('0x30')](function(){process[_0xb658('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x52ed=['find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x2bae92,_0x45b608){var _0x5adc50=function(_0xe0edb8){while(--_0xe0edb8){_0x2bae92['push'](_0x2bae92['shift']());}};_0x5adc50(++_0x45b608);}(_0x52ed,0x132));var _0xd52e=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x52ed[_0x19d24c];return _0x2fae8d;};'use strict';var util=require(_0xd52e('0x0'));var path=require(_0xd52e('0x1'));var _=require(_0xd52e('0x2'));var fs=require('fs');var json2xls=require(_0xd52e('0x3'));var BPromise=require(_0xd52e('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd52e('0x5'));var db=require(_0xd52e('0x6'))['db'];var dbH=require(_0xd52e('0x6'))[_0xd52e('0x7')];var logger=require(_0xd52e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd52e('0x9')][0x2]);var QUERY=process[_0xd52e('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5207fd,_0x321f8d){var _0x5ae178={'status':_0x5207fd};var _0x4d124c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x321f8d){_0x5ae178[_0xd52e('0xa')]=_0x321f8d;}return db[_0xd52e('0xb')][_0xd52e('0xc')](_0x5ae178,_0x4d124c);}function main(){var _0x1d00a9=0x1388;var _0x3d857a;logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0xf'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return db[_0xd52e('0x11')][_0xd52e('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd52e('0x13'),_0xd52e('0x14')]})[_0xd52e('0x15')](function(_0x43a5ba){if(_0x43a5ba){_0x3d857a=_0x43a5ba;_0x1d00a9=_0x3d857a['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x18'),QUERY),{'type':dbH[_0xd52e('0x16')]['QueryTypes']['SELECT']});})[_0xd52e('0x15')](function(_0x466516){if(!_0x466516[0x0][_0xd52e('0x19')]){return analyticExtractedReport(_0xd52e('0x1a'));}var _0x33230a=[];var _0x58dab2=0x0;if(_0x3d857a[_0xd52e('0x13')]){if(_0x466516&&_0x466516[_0xd52e('0x1b')]){var _0x7eeb4f=_[_0xd52e('0x1c')](_0x466516[0x0][_0xd52e('0x19')]/_0x1d00a9);var _0xdab253=Number[_0xd52e('0x1d')](_0x466516[0x0]['num']/_0x1d00a9)?_0x466516[0x0]['num']%_0x1d00a9:0x0;_0x7eeb4f['forEach'](function(_0x163b1b){if(_0x163b1b>0x0){_0x58dab2+=_0x1d00a9;}_0x33230a[_0xd52e('0x1e')](dbH['sequelize'][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0x1d00a9,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));});if(_0xdab253>0x0){_0x58dab2+=_0x1d00a9;_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0xdab253,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));}}}else{_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](QUERY,{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')]['SELECT']}));}var _0x3c3599=path[_0xd52e('0x22')](PATH);var _0x3a4142=path[_0xd52e('0x23')](PATH,'.xlsx');var _0x140fa0=_0x3d857a[_0xd52e('0x13')]&&_0x33230a['length']>0x1;var _0x5dd8b0=[];if(!fs[_0xd52e('0x24')](path[_0xd52e('0x25')](_0x3c3599,_0x3a4142))&&_0x140fa0){fs[_0xd52e('0x26')](path['join'](_0x3c3599,_0x3a4142));}return BPromise[_0xd52e('0x27')](_0x33230a,function(_0x4b27bc){_0x5dd8b0[_0xd52e('0x1e')](_0x4b27bc);})[_0xd52e('0x15')](function(){for(var _0x505614=0x0;_0x505614<_0x5dd8b0[_0xd52e('0x1b')];_0x505614+=0x1){var _0x2329e4;var _0x5a8ab0=_0x5dd8b0[_0x505614];if(_0x140fa0){_0x2329e4=path['join'](_0x3c3599,_0x3a4142,util[_0xd52e('0xe')](_0xd52e('0x28'),_0x3a4142,_0x505614,'xlsx'));}else{_0x2329e4=path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2a')));}fs[_0xd52e('0x2b')](_0x2329e4,json2xls(_0x5a8ab0),_0xd52e('0x2c'));}})[_0xd52e('0x15')](function(){if(_0x140fa0){return new Promise(function(_0x3b0f46){zipdir(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),{'saveTo':path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2d')))},function(_0xaf7210,_0x515dc7){rimraf(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),function(){});_0x3b0f46(_0xd52e('0x2e'));});});}})['then'](function(){logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0x2f'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return analyticExtractedReport(_0xd52e('0x30'),_0x140fa0?util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0x140fa0?_0xd52e('0x2d'):_0xd52e('0x2a')):null);});})[_0xd52e('0x31')](function(_0x2181ba){logger[_0xd52e('0xd')](util[_0xd52e('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xd52e('0x32')](_0x2181ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd52e('0x33'));})[_0xd52e('0x34')](function(){process[_0xd52e('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6c1309d..8780f02 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 _0x670a=['recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','sortBy','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','extension','extensions','push','type','Set','format','CDR(type)=%s','context','priority','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid='];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x670a,0xe6));var _0xa670=function(_0x3a673f,_0x13ef77){_0x3a673f=_0x3a673f-0x0;var _0x123c74=_0x670a[_0x3a673f];return _0x123c74;};'use strict';var _=require(_0xa670('0x0'));var util=require(_0xa670('0x1'));function rewrite(_0x49dab4,_0x38f657){var _0x438bc5=this;return _0x49dab4[_0xa670('0x2')][_0xa670('0x3')][_0xa670('0x4')]({'raw':!![]})[_0xa670('0x5')](function(_0x5680d6){_0x438bc5['intervals']=_0x5680d6;return _0x49dab4[_0xa670('0x2')][_0xa670('0x6')][_0xa670('0x4')]({'where':{'IntervalId':_0x38f657[_0xa670('0x7')]},'raw':!![]});})[_0xa670('0x5')](function(_0x2d7f12){return _0x49dab4['models'][_0xa670('0x6')][_0xa670('0x4')]({'where':{'exten':{'$in':_[_0xa670('0x8')](_[_0xa670('0x9')](_0x2d7f12,_0xa670('0xa')))}},'order':[{'raw':_0xa670('0xb')}],'raw':!![]});})['then'](function(_0x39060e){var _0x34a445=_[_0xa670('0xc')](_0x39060e,{'priority':'1'});var _0x21b2cd=_[_0xa670('0xc')](_0x39060e,{'isApp':0x1});var _0x38727e=_['groupBy'](_0x21b2cd,'exten');var _0x56ab9b=[_0xa670('0xd'),'playback'];var _0x451fd5=[];var _0x18f7a6=[];for(var _0x345df8 in _0x38727e){if(_0x38727e[_0xa670('0xe')](_0x345df8)){_0x438bc5['priority']=0x2;_0x438bc5['extensions']=[];_0x438bc5[_0xa670('0xf')]=_['find'](_0x34a445,{'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')]});_0x438bc5[_0xa670('0x10')][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':util[_0xa670('0x14')](_0xa670('0x15'),_0x38727e[_0x345df8][0x0]['type']),'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0]['VoiceExtensionId']});if(_0x38727e[_0x345df8][0x0][_0xa670('0x12')]==='inbound'){_0x438bc5[_0xa670('0x10')]['push']({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x18')+_0x38727e[_0x345df8][0x0][_0xa670('0x19')],'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5['priority']++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});}else if(_0x38727e[_0x345df8][0x0][_0xa670('0x12')]===_0xa670('0x1a')){if(_0x438bc5[_0xa670('0xf')]){_0x438bc5['extensions']['push']({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':'Set','appdata':'CDR(destination)='+(_0x438bc5['extension'][_0xa670('0x1b')]?_0xa670('0x1c')+_0x438bc5[_0xa670('0xf')][_0xa670('0x1b')]+'}':_0xa670('0x1d')),'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0]['VoiceExtensionId']});}_0x438bc5['extensions'][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0]['type'],'app':_0xa670('0x13'),'appdata':_0xa670('0x18')+_0x38727e[_0x345df8][0x0][_0xa670('0x19')],'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});var _0x30913a=_0x438bc5[_0xa670('0x17')]++;_0x438bc5['extensions'][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0]['type'],'app':_0xa670('0x1e'),'appdata':_0xa670('0x1f')+(_0x30913a+0x2)+'):Goto('+(_0x30913a+0x1)+')','context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0]['exten'],'priority':_0x30913a,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});if(_0x438bc5[_0xa670('0xf')]){_0x438bc5[_0xa670('0x10')][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0x438bc5[_0xa670('0xf')][_0xa670('0x1b')]?_0xa670('0x20')+_0x438bc5['extension'][_0xa670('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});}_0x438bc5['extensions'][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x21')+_0x38727e[_0x345df8][0x0]['VoiceExtensionId'],'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0]['exten'],'priority':_0x438bc5['priority']++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});if(_0x438bc5['extension']&&_0x438bc5[_0xa670('0xf')]['hasOwnProperty'](_0xa670('0x22'))&&_0x438bc5['extension']['recordingFormat']!==_0xa670('0x23')){_0x438bc5[_0xa670('0x10')]['push']({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});_0x438bc5[_0xa670('0x10')]['push']({'type':_0x38727e[_0x345df8][0x0]['type'],'app':_0xa670('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x438bc5[_0xa670('0xf')][_0xa670('0x22')]||_0xa670('0x24'),'context':_0x38727e[_0x345df8][0x0]['context'],'exten':_0x38727e[_0x345df8][0x0]['exten'],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});}}_0x438bc5[_0xa670('0x10')][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x25'),'context':_0x38727e[_0x345df8][0x0]['context'],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});_0x438bc5[_0xa670('0x10')][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x26'),'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});_0x438bc5[_0xa670('0x10')]['push']({'type':_0x38727e[_0x345df8][0x0]['type'],'app':_0xa670('0x13'),'appdata':_0xa670('0x27'),'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'priority':_0x438bc5[_0xa670('0x17')]++,'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});for(var _0x2bd48e=0x0,_0x32db00=0x0;_0x2bd48e<_0x38727e[_0x345df8][_0xa670('0x28')];_0x2bd48e+=0x1,_0x32db00=0x0){var _0x3f843c=_0x38727e[_0x345df8][_0x2bd48e];if(_0x3f843c['type']){_0x3f843c[_0xa670('0x12')]=_0x3f843c['type']['toLowerCase']();}var _0x57715b=[];var _0x2e66c7=[];delete _0x3f843c['id'];delete _0x3f843c[_0xa670('0x29')];delete _0x3f843c['updatedAt'];var _0xcbf274=_0x3f843c[_0xa670('0x2a')]!==_0xa670('0x2b')?[_0x3f843c[_0xa670('0x2a')]]:_0x3f843c[_0xa670('0x7')]?_[_0xa670('0x9')](_[_0xa670('0xc')](_0x438bc5[_0xa670('0x2c')],{'IntervalId':_0x3f843c[_0xa670('0x7')]}),_0xa670('0x2a')):[];if(_0x3f843c[_0xa670('0xe')](_0xa670('0x2d'))){if(_0x3f843c[_0xa670('0x2d')]&&_0x3f843c[_0xa670('0x2d')]!=='--'){_0x57715b[_0xa670('0x11')]({'type':_0x3f843c[_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x2e')+_0x3f843c[_0xa670('0x2d')],'context':_0x3f843c['context'],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5['priority']+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});}}if(_0x3f843c[_0xa670('0x12')]===_0xa670('0x1a')&&_0x3f843c['hasOwnProperty']('callerID')){if(_0x3f843c[_0xa670('0x2f')]){_0x57715b[_0xa670('0x11')]({'type':_0x3f843c[_0xa670('0x12')],'app':_0xa670('0x1e'),'appdata':_0xa670('0x30')+_0x3f843c[_0xa670('0x2f')]+')','context':_0x3f843c[_0xa670('0x16')],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});}else{_0x57715b['push']({'type':_0x3f843c['type'],'app':_0xa670('0x1e'),'appdata':_0xa670('0x31'),'context':_0x3f843c[_0xa670('0x16')],'exten':_0x3f843c['exten'],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});}}if(_0x3f843c['hasOwnProperty'](_0xa670('0x32'))){if(_0x56ab9b[_0xa670('0x33')](_0x3f843c[_0xa670('0x34')][_0xa670('0x35')]())>=0x0&&_0x3f843c[_0xa670('0x36')]!==_0xa670('0x37')){if(_0x3f843c[_0xa670('0x32')]){_0x57715b['push']({'type':_0x3f843c[_0xa670('0x12')],'app':_0xa670('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3f843c[_0xa670('0x16')],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});_0x57715b['push']({'type':_0x3f843c[_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3f843c[_0xa670('0x16')],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});}else{_0x57715b[_0xa670('0x11')]({'type':_0x3f843c[_0xa670('0x12')],'app':'ExecIf','appdata':_0xa670('0x38'),'context':_0x3f843c['context'],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274[_0xa670('0x28')]+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});_0x57715b['push']({'type':_0x3f843c[_0xa670('0x12')],'app':_0xa670('0x13'),'appdata':_0xa670('0x39'),'context':_0x3f843c[_0xa670('0x16')],'exten':_0x3f843c[_0xa670('0xa')],'priority':_0xcbf274['length']+_0x438bc5[_0xa670('0x17')]+_0x32db00++,'VoiceExtensionId':_0x3f843c[_0xa670('0x19')]});}}}for(var _0x87a984=0x0;_0x87a984<_0xcbf274[_0xa670('0x28')];_0x87a984+=0x1){var _0x1cbae2=_0x438bc5[_0xa670('0x17')]+_0xcbf274[_0xa670('0x28')];var _0x584133=_0x87a984===_0xcbf274[_0xa670('0x28')]-0x1?_0x438bc5[_0xa670('0x17')]+_0x57715b[_0xa670('0x28')]+_0x2e66c7['length']+0x2:_0x438bc5[_0xa670('0x17')]+_0x87a984+0x1;_0x57715b[_0xa670('0x3a')](_0x87a984,0x0,{'type':_0x3f843c['type'],'app':'GotoIfTime','appdata':_0xcbf274[_0x87a984]+'?'+_0x3f843c['context']+_0xa670('0x3b')+_0x1cbae2+':'+_0x3f843c[_0xa670('0x16')]+_0xa670('0x3b')+_0x584133,'exten':_0x3f843c[_0xa670('0xa')],'context':_0x3f843c[_0xa670('0x16')],'priority':_0x438bc5[_0xa670('0x17')]+_0x87a984,'VoiceExtensionId':_0x38727e[_0x345df8][0x0]['VoiceExtensionId']});}_0x3f843c['priority']=_0x57715b[_0xa670('0x28')]?_[_0xa670('0x3c')](_0x57715b)[_0xa670('0x17')]+0x1:_0x438bc5['priority'];_0x438bc5[_0xa670('0x17')]=(_0x2e66c7[_0xa670('0x28')]?_[_0xa670('0x3c')](_0x2e66c7)[_0xa670('0x17')]:_0x3f843c[_0xa670('0x17')])+0x1;_0x438bc5[_0xa670('0x10')]=_[_0xa670('0x3d')](_0x438bc5[_0xa670('0x10')],_0x57715b,[_0x3f843c],_0x2e66c7);}_0x438bc5['extensions'][_0xa670('0x11')]({'type':_0x38727e[_0x345df8][0x0][_0xa670('0x12')],'app':_0xa670('0x3e'),'exten':_0x38727e[_0x345df8][0x0][_0xa670('0xa')],'context':_0x38727e[_0x345df8][0x0][_0xa670('0x16')],'priority':_0x438bc5[_0xa670('0x17')],'VoiceExtensionId':_0x38727e[_0x345df8][0x0][_0xa670('0x19')]});_0x451fd5[_0xa670('0x11')](_0x38727e[_0x345df8][0x0][_0xa670('0x19')]);_0x18f7a6=_[_0xa670('0x3d')](_0x18f7a6,_0x438bc5['extensions']);}}return _0x49dab4[_0xa670('0x3f')](function(_0x305175){return _0x49dab4[_0xa670('0x2')][_0xa670('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x451fd5}},'transaction':_0x305175})[_0xa670('0x5')](function(_0x2f8a4c){return _0x49dab4[_0xa670('0x2')][_0xa670('0x6')]['bulkCreate'](_[_0xa670('0x40')](_0x18f7a6,'priority'),{'transaction':_0x305175});});});})['catch'](function(_0x49f8da){console['error'](_0x49f8da);});}exports[_0xa670('0x41')]=rewrite; \ No newline at end of file +var _0x4eb4=['CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','destroy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','type','format','CDR(type)=%s','inbound','push','CDR(routeid)=','context','VoiceExtensionId','outbound','extension','Set','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x3d351e,_0x5c8df4){var _0x19fd24=function(_0x1ece73){while(--_0x1ece73){_0x3d351e['push'](_0x3d351e['shift']());}};_0x19fd24(++_0x5c8df4);}(_0x4eb4,0x145));var _0x44eb=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x4eb4[_0x333767];return _0x51661b;};'use strict';var _=require(_0x44eb('0x0'));var util=require(_0x44eb('0x1'));function rewrite(_0x2c7469,_0x5255b5){var _0x3032eb=this;return _0x2c7469[_0x44eb('0x2')][_0x44eb('0x3')][_0x44eb('0x4')]({'raw':!![]})[_0x44eb('0x5')](function(_0x34c2d5){_0x3032eb[_0x44eb('0x6')]=_0x34c2d5;return _0x2c7469[_0x44eb('0x2')]['VoiceExtension'][_0x44eb('0x4')]({'where':{'IntervalId':_0x5255b5[_0x44eb('0x7')]},'raw':!![]});})[_0x44eb('0x5')](function(_0x29bca5){return _0x2c7469['models']['VoiceExtension'][_0x44eb('0x4')]({'where':{'exten':{'$in':_[_0x44eb('0x8')](_['map'](_0x29bca5,_0x44eb('0x9')))}},'order':[{'raw':_0x44eb('0xa')}],'raw':!![]});})[_0x44eb('0x5')](function(_0x223d42){var _0x3f16ad=_[_0x44eb('0xb')](_0x223d42,{'priority':'1'});var _0x2ec722=_['filter'](_0x223d42,{'isApp':0x1});var _0x29a915=_[_0x44eb('0xc')](_0x2ec722,_0x44eb('0x9'));var _0x3df56a=[_0x44eb('0xd'),_0x44eb('0xe')];var _0x324bd0=[];var _0x451376=[];for(var _0x42fd97 in _0x29a915){if(_0x29a915[_0x44eb('0xf')](_0x42fd97)){_0x3032eb[_0x44eb('0x10')]=0x2;_0x3032eb[_0x44eb('0x11')]=[];_0x3032eb['extension']=_['find'](_0x3f16ad,{'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')]});_0x3032eb[_0x44eb('0x11')]['push']({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':'Set','appdata':util[_0x44eb('0x13')](_0x44eb('0x14'),_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')]),'context':_0x29a915[_0x42fd97][0x0]['context'],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0]['VoiceExtensionId']});if(_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')]===_0x44eb('0x15')){_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0]['type'],'app':'Set','appdata':_0x44eb('0x17')+_0x29a915[_0x42fd97][0x0]['VoiceExtensionId'],'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});}else if(_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')]===_0x44eb('0x1a')){if(_0x3032eb[_0x44eb('0x1b')]){_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':_0x44eb('0x1c'),'appdata':'CDR(destination)='+(_0x3032eb[_0x44eb('0x1b')][_0x44eb('0x1d')]?_0x44eb('0x1e')+_0x3032eb[_0x44eb('0x1b')][_0x44eb('0x1d')]+'}':'${EXTEN}'),'context':_0x29a915[_0x42fd97][0x0]['context'],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});}_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0]['type'],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x17')+_0x29a915[_0x42fd97][0x0]['VoiceExtensionId'],'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0]['exten'],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});var _0x4cb193=_0x3032eb[_0x44eb('0x10')]++;_0x3032eb[_0x44eb('0x11')]['push']({'type':_0x29a915[_0x42fd97][0x0]['type'],'app':_0x44eb('0x1f'),'appdata':_0x44eb('0x20')+(_0x4cb193+0x2)+_0x44eb('0x21')+(_0x4cb193+0x1)+')','context':_0x29a915[_0x42fd97][0x0]['context'],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x4cb193,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});if(_0x3032eb[_0x44eb('0x1b')]){_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':_0x44eb('0x1c'),'appdata':_0x3032eb[_0x44eb('0x1b')][_0x44eb('0x1d')]?_0x44eb('0x22')+_0x3032eb['extension'][_0x44eb('0x1d')]+'}':_0x44eb('0x23'),'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});}_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x24')+_0x29a915[_0x42fd97][0x0]['VoiceExtensionId'],'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});if(_0x3032eb['extension']&&_0x3032eb[_0x44eb('0x1b')][_0x44eb('0xf')](_0x44eb('0x25'))&&_0x3032eb['extension'][_0x44eb('0x25')]!==_0x44eb('0x26')){_0x3032eb['extensions']['push']({'type':_0x29a915[_0x42fd97][0x0]['type'],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x27'),'context':_0x29a915[_0x42fd97][0x0]['context'],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb['priority']++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});_0x3032eb['extensions'][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3032eb['extension'][_0x44eb('0x25')]||'wav','context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});}}_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x28'),'context':_0x29a915[_0x42fd97][0x0]['context'],'exten':_0x29a915[_0x42fd97][0x0]['exten'],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0]['VoiceExtensionId']});_0x3032eb['extensions']['push']({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':'Set','appdata':_0x44eb('0x29'),'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'priority':_0x3032eb[_0x44eb('0x10')]++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});_0x3032eb[_0x44eb('0x11')]['push']({'type':_0x29a915[_0x42fd97][0x0][_0x44eb('0x12')],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x2a'),'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'exten':_0x29a915[_0x42fd97][0x0]['exten'],'priority':_0x3032eb['priority']++,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0]['VoiceExtensionId']});for(var _0x316195=0x0,_0x53d9ba=0x0;_0x316195<_0x29a915[_0x42fd97][_0x44eb('0x2b')];_0x316195+=0x1,_0x53d9ba=0x0){var _0x49855b=_0x29a915[_0x42fd97][_0x316195];if(_0x49855b['type']){_0x49855b['type']=_0x49855b[_0x44eb('0x12')]['toLowerCase']();}var _0x39e184=[];var _0x3859e7=[];delete _0x49855b['id'];delete _0x49855b[_0x44eb('0x2c')];delete _0x49855b[_0x44eb('0x2d')];var _0x54513b=_0x49855b[_0x44eb('0x2e')]!==_0x44eb('0x2f')?[_0x49855b[_0x44eb('0x2e')]]:_0x49855b['IntervalId']?_['map'](_['filter'](_0x3032eb[_0x44eb('0x6')],{'IntervalId':_0x49855b['IntervalId']}),_0x44eb('0x2e')):[];if(_0x49855b[_0x44eb('0xf')](_0x44eb('0x30'))){if(_0x49855b['tag']&&_0x49855b[_0x44eb('0x30')]!=='--'){_0x39e184['push']({'type':_0x49855b['type'],'app':'Set','appdata':'CDR(tag)='+_0x49855b[_0x44eb('0x30')],'context':_0x49855b[_0x44eb('0x18')],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b[_0x44eb('0x2b')]+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});}}if(_0x49855b['type']==='outbound'&&_0x49855b['hasOwnProperty'](_0x44eb('0x31'))){if(_0x49855b[_0x44eb('0x31')]){_0x39e184[_0x44eb('0x16')]({'type':_0x49855b['type'],'app':_0x44eb('0x1f'),'appdata':_0x44eb('0x32')+_0x49855b['callerID']+')','context':_0x49855b[_0x44eb('0x18')],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b[_0x44eb('0x2b')]+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});}else{_0x39e184['push']({'type':_0x49855b['type'],'app':_0x44eb('0x1f'),'appdata':_0x44eb('0x33'),'context':_0x49855b['context'],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b['length']+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});}}if(_0x49855b[_0x44eb('0xf')](_0x44eb('0x34'))){if(_0x3df56a[_0x44eb('0x35')](_0x49855b[_0x44eb('0x36')][_0x44eb('0x37')]())>=0x0&&_0x49855b[_0x44eb('0x38')]!==_0x44eb('0x39')){if(_0x49855b[_0x44eb('0x34')]){_0x39e184['push']({'type':_0x49855b[_0x44eb('0x12')],'app':_0x44eb('0x1f'),'appdata':_0x44eb('0x3a'),'context':_0x49855b['context'],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b[_0x44eb('0x2b')]+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});_0x39e184[_0x44eb('0x16')]({'type':_0x49855b['type'],'app':'Set','appdata':_0x44eb('0x3b'),'context':_0x49855b[_0x44eb('0x18')],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b['length']+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b['VoiceExtensionId']});}else{_0x39e184[_0x44eb('0x16')]({'type':_0x49855b['type'],'app':_0x44eb('0x1f'),'appdata':_0x44eb('0x3c'),'context':_0x49855b[_0x44eb('0x18')],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b['length']+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});_0x39e184[_0x44eb('0x16')]({'type':_0x49855b['type'],'app':_0x44eb('0x1c'),'appdata':_0x44eb('0x3d'),'context':_0x49855b['context'],'exten':_0x49855b[_0x44eb('0x9')],'priority':_0x54513b[_0x44eb('0x2b')]+_0x3032eb[_0x44eb('0x10')]+_0x53d9ba++,'VoiceExtensionId':_0x49855b[_0x44eb('0x19')]});}}}for(var _0x53c720=0x0;_0x53c720<_0x54513b[_0x44eb('0x2b')];_0x53c720+=0x1){var _0x1a88f3=_0x3032eb[_0x44eb('0x10')]+_0x54513b[_0x44eb('0x2b')];var _0x563071=_0x53c720===_0x54513b['length']-0x1?_0x3032eb[_0x44eb('0x10')]+_0x39e184['length']+_0x3859e7[_0x44eb('0x2b')]+0x2:_0x3032eb[_0x44eb('0x10')]+_0x53c720+0x1;_0x39e184['splice'](_0x53c720,0x0,{'type':_0x49855b['type'],'app':_0x44eb('0x3e'),'appdata':_0x54513b[_0x53c720]+'?'+_0x49855b['context']+',${EXTEN},'+_0x1a88f3+':'+_0x49855b[_0x44eb('0x18')]+_0x44eb('0x3f')+_0x563071,'exten':_0x49855b[_0x44eb('0x9')],'context':_0x49855b[_0x44eb('0x18')],'priority':_0x3032eb['priority']+_0x53c720,'VoiceExtensionId':_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]});}_0x49855b['priority']=_0x39e184[_0x44eb('0x2b')]?_[_0x44eb('0x40')](_0x39e184)[_0x44eb('0x10')]+0x1:_0x3032eb['priority'];_0x3032eb[_0x44eb('0x10')]=(_0x3859e7[_0x44eb('0x2b')]?_[_0x44eb('0x40')](_0x3859e7)[_0x44eb('0x10')]:_0x49855b[_0x44eb('0x10')])+0x1;_0x3032eb[_0x44eb('0x11')]=_[_0x44eb('0x41')](_0x3032eb[_0x44eb('0x11')],_0x39e184,[_0x49855b],_0x3859e7);}_0x3032eb[_0x44eb('0x11')][_0x44eb('0x16')]({'type':_0x29a915[_0x42fd97][0x0]['type'],'app':_0x44eb('0x42'),'exten':_0x29a915[_0x42fd97][0x0][_0x44eb('0x9')],'context':_0x29a915[_0x42fd97][0x0][_0x44eb('0x18')],'priority':_0x3032eb[_0x44eb('0x10')],'VoiceExtensionId':_0x29a915[_0x42fd97][0x0]['VoiceExtensionId']});_0x324bd0[_0x44eb('0x16')](_0x29a915[_0x42fd97][0x0][_0x44eb('0x19')]);_0x451376=_[_0x44eb('0x41')](_0x451376,_0x3032eb[_0x44eb('0x11')]);}}return _0x2c7469[_0x44eb('0x43')](function(_0x3f3f4f){return _0x2c7469['models'][_0x44eb('0x44')][_0x44eb('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x324bd0}},'transaction':_0x3f3f4f})[_0x44eb('0x5')](function(_0x37a6e4){return _0x2c7469[_0x44eb('0x2')][_0x44eb('0x44')]['bulkCreate'](_['sortBy'](_0x451376,_0x44eb('0x10')),{'transaction':_0x3f3f4f});});});})['catch'](function(_0x362827){console[_0x44eb('0x46')](_0x362827);});}exports[_0x44eb('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c8a53e7..17ed385 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 _0xf31e=['split','Missing\x20ListId\x20parameter!','contact','index','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','ListId','from','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','VoiceQueueId','onlyIfOpen','findAll','BlackLists','query','all','Campaign','CampaignId','generalCheckHopper','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xf31e,0xce));var _0xef31=function(_0x233f84,_0x25f7a3){_0x233f84=_0x233f84-0x0;var _0x2bd5ed=_0xf31e[_0x233f84];return _0x2bd5ed;};'use strict';var BPromise=require(_0xef31('0x0'));var util=require('util');var _=require(_0xef31('0x1'));var fs=require('fs');var squel=require(_0xef31('0x2'));var Papa=require('papaparse');var Redis=require(_0xef31('0x3'));var db=require(_0xef31('0x4'))['db'];var config=require(_0xef31('0x5'));var logger=require(_0xef31('0x6'))('api');config[_0xef31('0x7')]=_[_0xef31('0x8')](config[_0xef31('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xef31('0x9'))(new Redis(config[_0xef31('0x7')]));require(_0xef31('0xa'))[_0xef31('0xb')](socket);try{if(!process[_0xef31('0xc')][0x2]||process[_0xef31('0xc')][0x2]===_0xef31('0xd')||process[_0xef31('0xc')][0x2]==='null'){throw new Error(_0xef31('0xe'));}var FILEPATH=process[_0xef31('0xc')][0x2];if(!process[_0xef31('0xc')][0x3]||process[_0xef31('0xc')][0x3]==='undefined'||process[_0xef31('0xc')][0x3]==='null'||!process[_0xef31('0xc')][0x4]||process[_0xef31('0xc')][0x4]===_0xef31('0xd')||process[_0xef31('0xc')][0x4]===_0xef31('0xf')){throw new Error(_0xef31('0x10'));}var FIELDS=_[_0xef31('0x11')](process[_0xef31('0xc')][0x3][_0xef31('0x12')](','),process[_0xef31('0xc')][0x4][_0xef31('0x12')](','));if(!process[_0xef31('0xc')][0x5]||process[_0xef31('0xc')][0x5]===_0xef31('0xd')||process[_0xef31('0xc')][0x5]==='null'){throw new Error(_0xef31('0x13'));}var LISTID=process[_0xef31('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xef31('0xc')][0x6]!=='undefined'&&process[_0xef31('0xc')][0x6]!==_0xef31('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xef31('0xc')][0x7]&&process[_0xef31('0xc')][0x7]!=='undefined'&&process[_0xef31('0xc')][0x7]!==_0xef31('0xf')?process[_0xef31('0xc')][0x7]:null;if(!process[_0xef31('0xc')][0x8]||process['argv'][0x8]==='undefined'||process[_0xef31('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xef31('0xc')][0x8];}catch(_0x10e7b3){logger['error'](_0x10e7b3);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(_0x322875,_0x428bfd,_0x3fa1a9,_0x1dfe9f){var _0x294f95={'message':_0x428bfd};_0x294f95[_0x322875]=!![];if(_0x3fa1a9){_0x294f95[_0xef31('0x14')]=_0x3fa1a9;}if(_0x1dfe9f){_0x294f95[_0xef31('0x15')]=_0x1dfe9f;}return _0x294f95;}function isEmail(_0x3f3fbd){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'](_0x3f3fbd);}function checkRow(_0x289fb8,_0x29d3ea,_0x1ce53d){return new BPromise(function(_0x2a7aac,_0x44b735){if(_[_0xef31('0x16')](_0x289fb8)){return _0x44b735(handleCheckRowError(_0xef31('0x17'),_0xef31('0x18'),null,_0x1ce53d));}if(_0x289fb8['errors']&&_0x289fb8[_0xef31('0x19')][_0xef31('0x1a')]){var _0xe5f4d7=_[_0xef31('0x1b')](_0x289fb8[_0xef31('0x19')],_0xef31('0x1c'))['join'](';');return _0x44b735(handleCheckRowError('error',_0xe5f4d7,null,_0x1ce53d));}var _0x50b19b={};for(var _0x1808ef in FIELDS){if(FIELDS[_0xef31('0x1d')](_0x1808ef)&&FIELDS[_0x1808ef]){_0x50b19b[_0x1808ef]=_0x289fb8[_0xef31('0x1e')][0x0][FIELDS[_0x1808ef]]||_0x289fb8['data'][0x0]['\ufeff'+FIELDS[_0x1808ef]];}}if(!_0x50b19b[_0xef31('0x1f')]){return _0x44b735(handleCheckRowError(_0xef31('0x17'),_0xef31('0x20'),null,_0x1ce53d));}if(!_0x50b19b[_0xef31('0x21')]){return _0x44b735(handleCheckRowError(_0xef31('0x17'),_0xef31('0x22'),null,_0x1ce53d));}if(_0x50b19b[_0xef31('0x23')]){var _0x2f4266=moment(_0x50b19b[_0xef31('0x23')],'YYYY-MM-DD');if(!_0x2f4266[_0xef31('0x24')]()){return _0x44b735(handleCheckRowError('error',_0xef31('0x25'),null,_0x1ce53d));}}if(_0x50b19b[_0xef31('0x26')]){if(!isEmail(_0x50b19b['email'])){return _0x44b735(handleCheckRowError(_0xef31('0x17'),_0xef31('0x27'),null,_0x1ce53d));}}_0x50b19b['ListId']=LISTID;_0x50b19b[_0xef31('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x29d3ea){var _0x3700a0={};for(var _0x541429=0x0,_0x81236e=DUPLICATES[_0xef31('0x1a')];_0x541429<_0x81236e;_0x541429+=0x1){_0x3700a0[DUPLICATES[_0x541429]]=_0x50b19b[DUPLICATES[_0x541429]];}var _0x4fd571=_[_0xef31('0x29')](_0x29d3ea,_0x3700a0);if(_0x4fd571){return _0x44b735(handleCheckRowError(_0xef31('0x2a'),_0xef31('0x2b'),_0x4fd571,_0x1ce53d));}}return db[_0xef31('0x2c')]['create'](_0x50b19b,{'raw':!![],'hooks':![],'fields':_[_0xef31('0x2d')](_0x50b19b)})[_0xef31('0x2e')](function(_0x4c8451){if(DUPLICATES&&DUPLICATES['length']&&_0x29d3ea){_0x29d3ea['push'](_['pick'](_0x50b19b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4c8451['id'];return _0x2a7aac();})[_0xef31('0x2f')](function(_0x17da61){return _0x44b735(handleCheckRowError(_0xef31('0x17'),_0xef31('0x30')+(_0x17da61['message']||JSON[_0xef31('0x31')](_0x17da61)),null,_0x1ce53d));});});}function checkHopper(){function _0x384c38(){return function(_0x5b7a88){logger[_0xef31('0x17')](_0xef31('0x32'),_0xef31('0x33'),util[_0xef31('0x34')](_0x5b7a88,{'showHidden':![],'depth':null}));};}var _0x186c64=function(_0x3bf934,_0x108810){var _0x4f0ab6=squel[_0xef31('0x35')]()['into'](_0xef31('0x36'))[_0xef31('0x37')](['phone',_0xef31('0x38'),_0xef31('0x39'),'ListId',_0x108810,_0xef31('0x3a'),_0xef31('0x3b')],squel[_0xef31('0x3c')]()[_0xef31('0x3d')](_0xef31('0x21'),_0xef31('0x21'))[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x38'))[_0xef31('0x3d')]('id','ContactId')[_0xef31('0x3d')](LISTID[_0xef31('0x3f')](),_0xef31('0x40'))[_0xef31('0x3d')](_0x3bf934['id'][_0xef31('0x3f')](),_0x108810)[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x3a'))[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x3b'))[_0xef31('0x41')]('cm_contacts')[_0xef31('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0xef31('0x43'),LISTID[_0xef31('0x3f')]())['where'](_0xef31('0x44'))[_0xef31('0x42')](_0xef31('0x45'),squel[_0xef31('0x3c')]()[_0xef31('0x3d')](_0xef31('0x21'))[_0xef31('0x41')](_0xef31('0x36'))['where'](_0x108810+'\x20=\x20?',_0x3bf934['id'][_0xef31('0x3f')]())))['toString']();return _0x4f0ab6;};var _0x41caea=function(_0x1f4f8d,_0x449c8c){var _0xc02aef=squel[_0xef31('0x35')]()[_0xef31('0x46')](_0xef31('0x36'))[_0xef31('0x37')]([_0xef31('0x21'),_0xef31('0x38'),_0xef31('0x39'),_0xef31('0x40'),_0x449c8c,_0xef31('0x3a'),_0xef31('0x3b')],squel['select']()[_0xef31('0x3d')](_0xef31('0x21'),'phone')[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x38'))[_0xef31('0x3d')]('id',_0xef31('0x39'))[_0xef31('0x3d')](LISTID[_0xef31('0x3f')](),_0xef31('0x40'))[_0xef31('0x3d')](_0x1f4f8d['id'][_0xef31('0x3f')](),_0x449c8c)[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x3a'))[_0xef31('0x3d')](_0xef31('0x3e'),'updatedAt')[_0xef31('0x41')](_0xef31('0x47'))[_0xef31('0x42')]('deletedAt\x20IS\x20NULL')[_0xef31('0x42')](_0xef31('0x43'),LISTID[_0xef31('0x3f')]())['where'](_0xef31('0x48'),squel[_0xef31('0x49')](hopperContacts))['where'](_0xef31('0x44'))[_0xef31('0x42')](_0xef31('0x45'),squel[_0xef31('0x3c')]()[_0xef31('0x3d')](_0xef31('0x4a'))[_0xef31('0x41')](_0xef31('0x4b'))['where'](_0x449c8c+_0xef31('0x4c'),_0x1f4f8d['id'][_0xef31('0x3f')]()))['where'](_0xef31('0x45'),squel[_0xef31('0x3c')]()['field'](_0xef31('0x21'))[_0xef31('0x41')](_0xef31('0x36'))[_0xef31('0x42')](_0x449c8c+_0xef31('0x4c'),_0x1f4f8d['id'][_0xef31('0x3f')]())))[_0xef31('0x3f')]();return _0xc02aef;};function _0xe68a6c(_0x1c75ff,_0x4f3eaa){var _0x586377=squel['insert']()['into'](_0xef31('0x36'))[_0xef31('0x37')]([_0xef31('0x21'),'scheduledAt',_0xef31('0x39'),'ListId',_0x4f3eaa,_0xef31('0x3a'),_0xef31('0x3b')],squel[_0xef31('0x3c')]()['field'](_0xef31('0x21'),_0xef31('0x21'))[_0xef31('0x3d')](_0xef31('0x3e'),_0xef31('0x38'))[_0xef31('0x3d')]('id',_0xef31('0x39'))[_0xef31('0x3d')](LISTID[_0xef31('0x3f')](),'ListId')[_0xef31('0x3d')](_0x1c75ff['id'][_0xef31('0x3f')](),_0x4f3eaa)[_0xef31('0x3d')]('NOW()',_0xef31('0x3a'))['field'](_0xef31('0x3e'),_0xef31('0x3b'))[_0xef31('0x41')](_0xef31('0x47'))['where'](_0xef31('0x4d'))[_0xef31('0x42')](_0xef31('0x43'),LISTID[_0xef31('0x3f')]())[_0xef31('0x42')]('id\x20IN\x20?',squel[_0xef31('0x49')](hopperContacts))['where'](_0xef31('0x44')))[_0xef31('0x3f')]();return _0x586377;}function _0x2a2c1d(_0x3b5d7f,_0x5e0c7c){var _0x61a539=squel['insert']()[_0xef31('0x46')](_0xef31('0x4e'))[_0xef31('0x37')]([_0xef31('0x21'),_0xef31('0x39'),_0xef31('0x40'),_0x5e0c7c,'createdAt',_0xef31('0x3b')],squel[_0xef31('0x3c')]()['field'](_0xef31('0x21'),_0xef31('0x21'))[_0xef31('0x3d')]('id',_0xef31('0x39'))['field'](LISTID[_0xef31('0x3f')](),_0xef31('0x40'))[_0xef31('0x3d')](_0x3b5d7f['id'][_0xef31('0x3f')](),_0x5e0c7c)[_0xef31('0x3d')](_0xef31('0x3e'),'createdAt')['field'](_0xef31('0x3e'),_0xef31('0x3b'))[_0xef31('0x41')](_0xef31('0x47'))[_0xef31('0x42')](_0xef31('0x4d'))[_0xef31('0x42')](_0xef31('0x43'),LISTID[_0xef31('0x3f')]())[_0xef31('0x42')](_0xef31('0x48'),squel['str'](hopperContacts))[_0xef31('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xef31('0x3f')]();return _0x61a539;}return db[_0xef31('0x4f')]['findAll']({'where':{'type':_0xef31('0x50')},'attributes':['id',_0xef31('0x51')],'include':[{'model':db[_0xef31('0x52')],'as':_0xef31('0x53'),'where':{'id':LISTID}}]})[_0xef31('0x2e')](function(_0x1dd353){var _0x4ab1cc=[];if(_0x1dd353){var _0x7cafdd;for(var _0x243489=0x0,_0x5ef053;_0x243489<_0x1dd353['length'];_0x243489+=0x1){_0x5ef053=_0x1dd353[_0x243489][_0xef31('0x54')]({'plain':!![]});switch(_0x5ef053['dialCheckDuplicateType']){case _0xef31('0x55'):_0x4ab1cc[_0xef31('0x56')](db[_0xef31('0x57')]['query'](_0x41caea(_0x5ef053,_0xef31('0x58')))[_0xef31('0x2e')](function(){})[_0xef31('0x2f')](_0x384c38()));break;case _0xef31('0x59'):_0x4ab1cc['push'](db[_0xef31('0x57')]['query'](_0x186c64(_0x5ef053,_0xef31('0x58')))[_0xef31('0x2e')](function(){})[_0xef31('0x2f')](_0x384c38()));break;default:_0x4ab1cc[_0xef31('0x56')](db['sequelize']['query'](_0xe68a6c(_0x5ef053,'VoiceQueueId'))['then'](function(){})[_0xef31('0x2f')](_0x384c38()));}}}return _0x4ab1cc;})['all']()[_0xef31('0x2e')](function(){return db['VoiceQueue'][_0xef31('0x5a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xef31('0x52')],'as':_0xef31('0x5b'),'where':{'id':LISTID}}]})[_0xef31('0x2e')](function(_0x237c87){var _0x226053=[];if(_0x237c87){var _0x2ca42a;for(var _0x439774=0x0,_0x4c67d9;_0x439774<_0x237c87[_0xef31('0x1a')];_0x439774+=0x1){_0x4c67d9=_0x237c87[_0x439774][_0xef31('0x54')]({'plain':!![]});_0x226053[_0xef31('0x56')](db[_0xef31('0x57')][_0xef31('0x5c')](_0x2a2c1d(_0x4c67d9,_0xef31('0x58')))[_0xef31('0x2e')](function(){})[_0xef31('0x2f')](_0x384c38()));}}return _0x226053;})[_0xef31('0x5d')]();})[_0xef31('0x2e')](function(){return db[_0xef31('0x5e')][_0xef31('0x5a')]({'attributes':['id',_0xef31('0x51')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xef31('0x2e')](function(_0x104bd8){var _0x8e5425=[];if(_0x104bd8){for(var _0x20cc7c=0x0,_0x55992f;_0x20cc7c<_0x104bd8[_0xef31('0x1a')];_0x20cc7c+=0x1){_0x55992f=_0x104bd8[_0x20cc7c][_0xef31('0x54')]({'plain':!![]});switch(_0x55992f[_0xef31('0x51')]){case _0xef31('0x55'):_0x8e5425[_0xef31('0x56')](db[_0xef31('0x57')][_0xef31('0x5c')](_0x41caea(_0x55992f,_0xef31('0x5f')))[_0xef31('0x2e')](function(){})['catch'](_0x384c38()));break;case _0xef31('0x59'):_0x8e5425['push'](db[_0xef31('0x57')][_0xef31('0x5c')](_0x186c64(_0x55992f,_0xef31('0x5f')))[_0xef31('0x2e')](function(){})[_0xef31('0x2f')](_0x384c38()));break;default:_0x8e5425['push'](db[_0xef31('0x57')][_0xef31('0x5c')](_0xe68a6c(_0x55992f,_0xef31('0x5f')))['then'](function(){})[_0xef31('0x2f')](_0x384c38()));}}}return _0x8e5425;})[_0xef31('0x5d')]();})[_0xef31('0x2e')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xef31('0x52')],'as':_0xef31('0x5b'),'where':{'id':LISTID}}]})[_0xef31('0x2e')](function(_0x4db3b4){var _0x34075b=[];if(_0x4db3b4){for(var _0x389a6d=0x0,_0x31d9d0;_0x389a6d<_0x4db3b4['length'];_0x389a6d+=0x1){_0x31d9d0=_0x4db3b4[_0x389a6d]['get']({'plain':!![]});_0x34075b[_0xef31('0x56')](db[_0xef31('0x57')]['query'](_0x2a2c1d(_0x31d9d0,'CampaignId'))['then'](function(){})[_0xef31('0x2f')](_0x384c38()));}}return _0x34075b;})['all']();})[_0xef31('0x2f')](function(_0x1c4e7c){logger['error']('cmContact,\x20%s,\x20%s',_0xef31('0x60'),_0x1c4e7c[_0xef31('0x1c')]);});}var processPromises=function(_0x4113a2){return BPromise[_0xef31('0x5d')](promises)[_0xef31('0x2e')](function(_0x3c929d){})[_0xef31('0x2f')](function(_0x59495f){logger['error']('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x59495f));})[_0xef31('0x61')](function(){socket[_0xef31('0x62')](_0xef31('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4113a2){return _0x4113a2[_0xef31('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xef31('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xef31('0x2e')](function(){socket[_0xef31('0x62')](_0xef31('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xef31('0x65')](FILEPATH);}catch(_0x52b09){logger[_0xef31('0x17')](_0xef31('0x66'),JSON[_0xef31('0x31')](_0x52b09));}finally{process[_0xef31('0x67')](0x0);}});};process['on'](_0xef31('0x68'),function(){logger[_0xef31('0x69')](_0xef31('0x6a'));endCsv();});function main(){return BPromise[_0xef31('0x6b')]()[_0xef31('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xef31('0x12')](',');return db[_0xef31('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x38ccb8){var _0x3d8bb7=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xef31('0x6c')](_0x3d8bb7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x513801,_0x4481c5){total+=0x1;var _0x210af4=total;promises[_0xef31('0x56')](checkRow(_0x513801,_0x38ccb8,_0x210af4)[_0xef31('0x2e')](function(){success+=0x1;})[_0xef31('0x2f')](function(_0x92c3ff){if(_0x92c3ff[_0xef31('0x17')]){errors+=0x1;delete _0x92c3ff['error'];}else if(_0x92c3ff['duplicate']){duplicates+=0x1;delete _0x92c3ff[_0xef31('0x2a')];}rows[_0xef31('0x56')](_0x92c3ff);}));if(total%0xc8===0x0){_0x4481c5[_0xef31('0x6d')]();return processPromises(_0x4481c5);}},'complete':function(){return processPromises()[_0xef31('0x2e')](function(){logger[_0xef31('0x69')](_0xef31('0x6e'));endCsv();});},'error':function(_0x4b74e2,_0x365270){logger[_0xef31('0x69')](_0xef31('0x6f'),JSON['stringify'](_0x4b74e2));endCsv();}});})['catch'](function(_0x42fbf5){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xef31('0x31')](_0x42fbf5));});}main(); \ No newline at end of file +var _0x9095=['firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','create','then','push','pick','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','ListId','createdAt','from','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','str','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','findAll','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x9095,0x12d));var _0x5909=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x9095[_0x4fdcc0];return _0xc0ce94;};'use strict';var BPromise=require(_0x5909('0x0'));var util=require(_0x5909('0x1'));var _=require(_0x5909('0x2'));var fs=require('fs');var squel=require(_0x5909('0x3'));var Papa=require(_0x5909('0x4'));var Redis=require('ioredis');var db=require(_0x5909('0x5'))['db'];var config=require(_0x5909('0x6'));var logger=require(_0x5909('0x7'))(_0x5909('0x8'));config[_0x5909('0x9')]=_[_0x5909('0xa')](config['redis'],{'host':_0x5909('0xb'),'port':0x18eb});var socket=require(_0x5909('0xc'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x5909('0xd')](socket);try{if(!process[_0x5909('0xe')][0x2]||process[_0x5909('0xe')][0x2]===_0x5909('0xf')||process[_0x5909('0xe')][0x2]===_0x5909('0x10')){throw new Error(_0x5909('0x11'));}var FILEPATH=process[_0x5909('0xe')][0x2];if(!process[_0x5909('0xe')][0x3]||process['argv'][0x3]===_0x5909('0xf')||process[_0x5909('0xe')][0x3]===_0x5909('0x10')||!process[_0x5909('0xe')][0x4]||process[_0x5909('0xe')][0x4]===_0x5909('0xf')||process[_0x5909('0xe')][0x4]==='null'){throw new Error(_0x5909('0x12'));}var FIELDS=_[_0x5909('0x13')](process[_0x5909('0xe')][0x3][_0x5909('0x14')](','),process[_0x5909('0xe')][0x4][_0x5909('0x14')](','));if(!process['argv'][0x5]||process[_0x5909('0xe')][0x5]===_0x5909('0xf')||process['argv'][0x5]===_0x5909('0x10')){throw new Error(_0x5909('0x15'));}var LISTID=process[_0x5909('0xe')][0x5];var COMPANYID=process[_0x5909('0xe')][0x6]&&process[_0x5909('0xe')][0x6]!==_0x5909('0xf')&&process[_0x5909('0xe')][0x6]!=='null'?process[_0x5909('0xe')][0x6]:null;var DUPLICATES=process[_0x5909('0xe')][0x7]&&process[_0x5909('0xe')][0x7]!==_0x5909('0xf')&&process[_0x5909('0xe')][0x7]!=='null'?process[_0x5909('0xe')][0x7]:null;if(!process[_0x5909('0xe')][0x8]||process['argv'][0x8]===_0x5909('0xf')||process[_0x5909('0xe')][0x8]===_0x5909('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x44eca2){logger[_0x5909('0x16')](_0x44eca2);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(_0x40e7a1,_0x58df3a,_0x24ce68,_0x35c13a){var _0x1df2f6={'message':_0x58df3a};_0x1df2f6[_0x40e7a1]=!![];if(_0x24ce68){_0x1df2f6[_0x5909('0x17')]=_0x24ce68;}if(_0x35c13a){_0x1df2f6[_0x5909('0x18')]=_0x35c13a;}return _0x1df2f6;}function isEmail(_0xfb132d){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))*$/[_0x5909('0x19')](_0xfb132d);}function checkRow(_0x12f027,_0x13f3d7,_0x369143){return new BPromise(function(_0x375f84,_0x108184){if(_[_0x5909('0x1a')](_0x12f027)){return _0x108184(handleCheckRowError(_0x5909('0x16'),_0x5909('0x1b'),null,_0x369143));}if(_0x12f027[_0x5909('0x1c')]&&_0x12f027[_0x5909('0x1c')][_0x5909('0x1d')]){var _0x2bb6a1=_[_0x5909('0x1e')](_0x12f027[_0x5909('0x1c')],_0x5909('0x1f'))['join'](';');return _0x108184(handleCheckRowError(_0x5909('0x16'),_0x2bb6a1,null,_0x369143));}var _0x124f3c={};for(var _0xa0de62 in FIELDS){if(FIELDS[_0x5909('0x20')](_0xa0de62)&&FIELDS[_0xa0de62]){_0x124f3c[_0xa0de62]=_0x12f027[_0x5909('0x21')][0x0][FIELDS[_0xa0de62]]||_0x12f027[_0x5909('0x21')][0x0]['\ufeff'+FIELDS[_0xa0de62]];}}if(!_0x124f3c[_0x5909('0x22')]){return _0x108184(handleCheckRowError('error',_0x5909('0x23'),null,_0x369143));}if(!_0x124f3c[_0x5909('0x24')]){return _0x108184(handleCheckRowError(_0x5909('0x16'),_0x5909('0x25'),null,_0x369143));}if(_0x124f3c[_0x5909('0x26')]){var _0x15bc78=moment(_0x124f3c[_0x5909('0x26')],_0x5909('0x27'));if(!_0x15bc78[_0x5909('0x28')]()){return _0x108184(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x369143));}}if(_0x124f3c['email']){if(!isEmail(_0x124f3c['email'])){return _0x108184(handleCheckRowError(_0x5909('0x16'),_0x5909('0x29'),null,_0x369143));}}_0x124f3c['ListId']=LISTID;_0x124f3c[_0x5909('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5909('0x1d')]&&_0x13f3d7){var _0x10d255={};for(var _0x427e2c=0x0,_0x384c60=DUPLICATES['length'];_0x427e2c<_0x384c60;_0x427e2c+=0x1){_0x10d255[DUPLICATES[_0x427e2c]]=_0x124f3c[DUPLICATES[_0x427e2c]];}var _0x550174=_[_0x5909('0x2b')](_0x13f3d7,_0x10d255);if(_0x550174){return _0x108184(handleCheckRowError(_0x5909('0x2c'),'Duplicate\x20Contact',_0x550174,_0x369143));}}return db['CmContact'][_0x5909('0x2d')](_0x124f3c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x124f3c)})[_0x5909('0x2e')](function(_0x286687){if(DUPLICATES&&DUPLICATES['length']&&_0x13f3d7){_0x13f3d7[_0x5909('0x2f')](_[_0x5909('0x30')](_0x124f3c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x286687['id'];return _0x375f84();})['catch'](function(_0x10c8db){return _0x108184(handleCheckRowError(_0x5909('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x10c8db['message']||JSON[_0x5909('0x31')](_0x10c8db)),null,_0x369143));});});}function checkHopper(){function _0x1136f5(){return function(_0x2a5772){logger[_0x5909('0x16')](_0x5909('0x32'),_0x5909('0x33'),util[_0x5909('0x34')](_0x2a5772,{'showHidden':![],'depth':null}));};}var _0x1a2de4=function(_0x5e03af,_0x5f351a){var _0x3aac92=squel['insert']()['into'](_0x5909('0x35'))[_0x5909('0x36')]([_0x5909('0x24'),_0x5909('0x37'),_0x5909('0x38'),'ListId',_0x5f351a,'createdAt',_0x5909('0x39')],squel[_0x5909('0x3a')]()[_0x5909('0x3b')](_0x5909('0x24'),_0x5909('0x24'))['field'](_0x5909('0x3c'),'scheduledAt')[_0x5909('0x3b')]('id',_0x5909('0x38'))['field'](LISTID[_0x5909('0x3d')](),_0x5909('0x3e'))[_0x5909('0x3b')](_0x5e03af['id'][_0x5909('0x3d')](),_0x5f351a)[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x3f'))[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x39'))[_0x5909('0x40')](_0x5909('0x41'))[_0x5909('0x42')]('deletedAt\x20IS\x20NULL')[_0x5909('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x5909('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x5909('0x42')](_0x5909('0x43'),squel[_0x5909('0x3a')]()['field'](_0x5909('0x24'))[_0x5909('0x40')](_0x5909('0x35'))[_0x5909('0x42')](_0x5f351a+_0x5909('0x44'),_0x5e03af['id'][_0x5909('0x3d')]())))[_0x5909('0x3d')]();return _0x3aac92;};var _0x5a2803=function(_0x43bb4c,_0x1b67c1){var _0x26294c=squel[_0x5909('0x45')]()[_0x5909('0x46')]('cm_hopper')[_0x5909('0x36')]([_0x5909('0x24'),_0x5909('0x37'),_0x5909('0x38'),'ListId',_0x1b67c1,_0x5909('0x3f'),_0x5909('0x39')],squel[_0x5909('0x3a')]()[_0x5909('0x3b')](_0x5909('0x24'),'phone')['field']('NOW()',_0x5909('0x37'))[_0x5909('0x3b')]('id',_0x5909('0x38'))[_0x5909('0x3b')](LISTID[_0x5909('0x3d')](),_0x5909('0x3e'))[_0x5909('0x3b')](_0x43bb4c['id'][_0x5909('0x3d')](),_0x1b67c1)[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x3f'))[_0x5909('0x3b')](_0x5909('0x3c'),'updatedAt')[_0x5909('0x40')]('cm_contacts')[_0x5909('0x42')](_0x5909('0x47'))['where']('ListId\x20=\x20?',LISTID[_0x5909('0x3d')]())['where'](_0x5909('0x48'),squel['str'](hopperContacts))[_0x5909('0x42')](_0x5909('0x49'))[_0x5909('0x42')](_0x5909('0x43'),squel[_0x5909('0x3a')]()[_0x5909('0x3b')]('calleridnum')[_0x5909('0x40')](_0x5909('0x4a'))[_0x5909('0x42')](_0x1b67c1+'\x20=\x20?',_0x43bb4c['id'][_0x5909('0x3d')]()))[_0x5909('0x42')](_0x5909('0x43'),squel[_0x5909('0x3a')]()['field'](_0x5909('0x24'))[_0x5909('0x40')](_0x5909('0x35'))[_0x5909('0x42')](_0x1b67c1+_0x5909('0x44'),_0x43bb4c['id'][_0x5909('0x3d')]())))['toString']();return _0x26294c;};function _0x2adc35(_0x468454,_0x1fdac1){var _0x3f0e8f=squel[_0x5909('0x45')]()[_0x5909('0x46')](_0x5909('0x35'))[_0x5909('0x36')]([_0x5909('0x24'),_0x5909('0x37'),_0x5909('0x38'),_0x5909('0x3e'),_0x1fdac1,_0x5909('0x3f'),_0x5909('0x39')],squel[_0x5909('0x3a')]()[_0x5909('0x3b')]('phone',_0x5909('0x24'))[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x37'))[_0x5909('0x3b')]('id',_0x5909('0x38'))['field'](LISTID[_0x5909('0x3d')](),'ListId')['field'](_0x468454['id']['toString'](),_0x1fdac1)[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x3f'))['field'](_0x5909('0x3c'),'updatedAt')['from']('cm_contacts')[_0x5909('0x42')]('deletedAt\x20IS\x20NULL')[_0x5909('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x5909('0x42')](_0x5909('0x48'),squel[_0x5909('0x4b')](hopperContacts))[_0x5909('0x42')](_0x5909('0x49')))[_0x5909('0x3d')]();return _0x3f0e8f;}function _0x1bc20c(_0x3febbe,_0x13692c){var _0x1a3818=squel['insert']()['into']('cm_hopper_black')[_0x5909('0x36')]([_0x5909('0x24'),_0x5909('0x38'),_0x5909('0x3e'),_0x13692c,_0x5909('0x3f'),_0x5909('0x39')],squel[_0x5909('0x3a')]()[_0x5909('0x3b')]('phone',_0x5909('0x24'))[_0x5909('0x3b')]('id','ContactId')[_0x5909('0x3b')](LISTID['toString'](),_0x5909('0x3e'))[_0x5909('0x3b')](_0x3febbe['id'][_0x5909('0x3d')](),_0x13692c)[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x3f'))[_0x5909('0x3b')](_0x5909('0x3c'),_0x5909('0x39'))[_0x5909('0x40')]('cm_contacts')[_0x5909('0x42')]('deletedAt\x20IS\x20NULL')[_0x5909('0x42')]('ListId\x20=\x20?',LISTID[_0x5909('0x3d')]())[_0x5909('0x42')](_0x5909('0x48'),squel[_0x5909('0x4b')](hopperContacts))['where'](_0x5909('0x49')))[_0x5909('0x3d')]();return _0x1a3818;}return db[_0x5909('0x4c')]['findAll']({'where':{'type':_0x5909('0x4d')},'attributes':['id',_0x5909('0x4e')],'include':[{'model':db[_0x5909('0x4f')],'as':_0x5909('0x50'),'where':{'id':LISTID}}]})[_0x5909('0x2e')](function(_0x17bb75){var _0x366a04=[];if(_0x17bb75){var _0x3fceb7;for(var _0x1e2bea=0x0,_0x2567c1;_0x1e2bea<_0x17bb75[_0x5909('0x1d')];_0x1e2bea+=0x1){_0x2567c1=_0x17bb75[_0x1e2bea][_0x5909('0x51')]({'plain':!![]});switch(_0x2567c1[_0x5909('0x4e')]){case _0x5909('0x52'):_0x366a04[_0x5909('0x2f')](db[_0x5909('0x53')]['query'](_0x5a2803(_0x2567c1,_0x5909('0x54')))[_0x5909('0x2e')](function(){})[_0x5909('0x55')](_0x1136f5()));break;case _0x5909('0x56'):_0x366a04['push'](db[_0x5909('0x53')][_0x5909('0x57')](_0x1a2de4(_0x2567c1,'VoiceQueueId'))[_0x5909('0x2e')](function(){})[_0x5909('0x55')](_0x1136f5()));break;default:_0x366a04[_0x5909('0x2f')](db[_0x5909('0x53')][_0x5909('0x57')](_0x2adc35(_0x2567c1,'VoiceQueueId'))['then'](function(){})[_0x5909('0x55')](_0x1136f5()));}}}return _0x366a04;})[_0x5909('0x58')]()[_0x5909('0x2e')](function(){return db[_0x5909('0x4c')][_0x5909('0x59')]({'where':{'type':_0x5909('0x4d')},'attributes':['id'],'include':[{'model':db[_0x5909('0x4f')],'as':_0x5909('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x5b148f){var _0x976408=[];if(_0x5b148f){var _0x2d2e92;for(var _0x5c5750=0x0,_0x143379;_0x5c5750<_0x5b148f[_0x5909('0x1d')];_0x5c5750+=0x1){_0x143379=_0x5b148f[_0x5c5750]['get']({'plain':!![]});_0x976408[_0x5909('0x2f')](db[_0x5909('0x53')]['query'](_0x1bc20c(_0x143379,'VoiceQueueId'))[_0x5909('0x2e')](function(){})['catch'](_0x1136f5()));}}return _0x976408;})['all']();})['then'](function(){return db[_0x5909('0x5b')][_0x5909('0x59')]({'attributes':['id',_0x5909('0x4e')],'include':[{'model':db[_0x5909('0x4f')],'as':_0x5909('0x50'),'where':{'id':LISTID}}]})[_0x5909('0x2e')](function(_0x4ee8c6){var _0x3db4c8=[];if(_0x4ee8c6){for(var _0x1a9681=0x0,_0x5969be;_0x1a9681<_0x4ee8c6[_0x5909('0x1d')];_0x1a9681+=0x1){_0x5969be=_0x4ee8c6[_0x1a9681][_0x5909('0x51')]({'plain':!![]});switch(_0x5969be[_0x5909('0x4e')]){case _0x5909('0x52'):_0x3db4c8['push'](db[_0x5909('0x53')]['query'](_0x5a2803(_0x5969be,_0x5909('0x5c')))['then'](function(){})['catch'](_0x1136f5()));break;case _0x5909('0x56'):_0x3db4c8[_0x5909('0x2f')](db[_0x5909('0x53')]['query'](_0x1a2de4(_0x5969be,_0x5909('0x5c')))[_0x5909('0x2e')](function(){})[_0x5909('0x55')](_0x1136f5()));break;default:_0x3db4c8['push'](db[_0x5909('0x53')][_0x5909('0x57')](_0x2adc35(_0x5969be,_0x5909('0x5c')))[_0x5909('0x2e')](function(){})[_0x5909('0x55')](_0x1136f5()));}}}return _0x3db4c8;})[_0x5909('0x58')]();})['then'](function(){return db['Campaign'][_0x5909('0x59')]({'attributes':['id'],'include':[{'model':db[_0x5909('0x4f')],'as':_0x5909('0x5a'),'where':{'id':LISTID}}]})[_0x5909('0x2e')](function(_0x2c8aea){var _0x36bb2c=[];if(_0x2c8aea){for(var _0x2eb618=0x0,_0x124a19;_0x2eb618<_0x2c8aea[_0x5909('0x1d')];_0x2eb618+=0x1){_0x124a19=_0x2c8aea[_0x2eb618][_0x5909('0x51')]({'plain':!![]});_0x36bb2c[_0x5909('0x2f')](db[_0x5909('0x53')][_0x5909('0x57')](_0x1bc20c(_0x124a19,_0x5909('0x5c')))['then'](function(){})['catch'](_0x1136f5()));}}return _0x36bb2c;})['all']();})[_0x5909('0x55')](function(_0xc41bc8){logger['error'](_0x5909('0x5d'),_0x5909('0x5e'),_0xc41bc8['message']);});}var processPromises=function(_0xd11718){return BPromise['all'](promises)[_0x5909('0x2e')](function(_0x3aef67){})['catch'](function(_0x41d641){logger[_0x5909('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x5909('0x31')](_0x41d641));})[_0x5909('0x5f')](function(){socket[_0x5909('0x60')](_0x5909('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xd11718){return _0xd11718['resume']();}});};var endCsv=function(){return BPromise[_0x5909('0x62')]()[_0x5909('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x5909('0x2e')](function(){socket[_0x5909('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5909('0x63')](FILEPATH);}catch(_0x2c4c2a){logger[_0x5909('0x16')](_0x5909('0x64'),JSON[_0x5909('0x31')](_0x2c4c2a));}finally{process[_0x5909('0x65')](0x0);}});};process['on'](_0x5909('0x66'),function(){logger['info'](_0x5909('0x67'));endCsv();});function main(){return BPromise[_0x5909('0x62')]()[_0x5909('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x5909('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5909('0x2e')](function(_0x3fb2cf){var _0x5bd2d2=fs[_0x5909('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5909('0x6a')](_0x5bd2d2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42b08c,_0x1958fd){total+=0x1;var _0x50e773=total;promises[_0x5909('0x2f')](checkRow(_0x42b08c,_0x3fb2cf,_0x50e773)['then'](function(){success+=0x1;})[_0x5909('0x55')](function(_0x3d4715){if(_0x3d4715[_0x5909('0x16')]){errors+=0x1;delete _0x3d4715[_0x5909('0x16')];}else if(_0x3d4715[_0x5909('0x2c')]){duplicates+=0x1;delete _0x3d4715[_0x5909('0x2c')];}rows[_0x5909('0x2f')](_0x3d4715);}));if(total%0xc8===0x0){_0x1958fd[_0x5909('0x6b')]();return processPromises(_0x1958fd);}},'complete':function(){return processPromises()[_0x5909('0x2e')](function(){logger[_0x5909('0x6c')](_0x5909('0x6d'));endCsv();});},'error':function(_0x584d0f,_0x219b9f){logger['info'](_0x5909('0x6e'),JSON[_0x5909('0x31')](_0x584d0f));endCsv();}});})['catch'](function(_0x164e00){logger[_0x5909('0x16')](_0x5909('0x6f'),JSON[_0x5909('0x31')](_0x164e00));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f31e0ec..c3ac08a 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 _0xea18=['cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','into','cm_hopper_black','ContactId','ListId','.CmListId','phone','ListId\x20=\x20?','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','updatedAt','priority','cm_contacts','cm_contacts.createdAt\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','Received\x20SIGINT','message','exit','info','sequelize','query','spread','push','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','all','timezones','dialTimezone','isNil','set','offset','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','errors','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','SystemRow','rows','emit','contact:import:','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','arguments\x20\x20\x20','root','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','createdAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0xea18,0x76));var _0x8ea1=function(_0x11c124,_0x457570){_0x11c124=_0x11c124-0x0;var _0xca9cfa=_0xea18[_0x11c124];return _0xca9cfa;};'use strict';var fs=require('fs');var path=require(_0x8ea1('0x0'));var _=require(_0x8ea1('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x8ea1('0x2'));var moment=require(_0x8ea1('0x3'));var squel=require('squel');var Redis=require(_0x8ea1('0x4'));var db=require(_0x8ea1('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x8ea1('0x6'));var logger=require(_0x8ea1('0x7'))(_0x8ea1('0x8'));config[_0x8ea1('0x9')]=_[_0x8ea1('0xa')](config[_0x8ea1('0x9')],{'host':_0x8ea1('0xb'),'port':0x18eb});var socket=require(_0x8ea1('0xc'))(new Redis(config[_0x8ea1('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8ea1('0xd')](_0x8ea1('0xe'));function isEmail(_0x5324f1){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'](_0x5324f1);}function selectNotIn(_0x2d2d1b,_0x178e64,_0x1bc668,_0xa41db0,_0x1627b2){return squel[_0x8ea1('0xf')]()[_0x8ea1('0x10')]('phone')[_0x8ea1('0x11')](_0xa41db0)[_0x8ea1('0x12')](_0x178e64,null,_0x178e64+'.id\x20=\x20'+_0xa41db0+'.'+_0x1bc668)['where'](_0xa41db0+'.'+_0x1bc668+_0x8ea1('0x13')+_0x2d2d1b+'.'+_0x1bc668)['where'](_0x178e64+'.dialCheckDuplicateType\x20IN\x20('+_0x1627b2[_0x8ea1('0x12')]()+')');}function insertCmHopper(_0xca3998,_0x53b21c,_0x5b5903,_0x4d71e5,_0xd74270){var _0x3ec05=[_0x8ea1('0x14'),_0x8ea1('0x15'),_0x8ea1('0x16'),_0x8ea1('0x17'),_0x53b21c+'.'+_0x4d71e5,_0x8ea1('0x18'),_0x8ea1('0x19'),_0x8ea1('0x1a'),_0x8ea1('0x1b'),'\x22'+_0xd74270+'\x22'];return squel[_0x8ea1('0x1c')]()['into']('cm_hopper')[_0x8ea1('0x1d')](['phone','scheduledat','ContactId','ListId',_0x4d71e5,_0x8ea1('0x1e'),'updatedAt','priority',_0x8ea1('0x1f'),_0x8ea1('0x20')],squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')](_0x3ec05)[_0x8ea1('0x11')](_0x53b21c)['join']('cm_contacts',null,_0x8ea1('0x22')+_0x53b21c+'.CmListId')[_0x8ea1('0x12')](_0x5b5903,null,_0x5b5903+_0x8ea1('0x23')+_0x53b21c+'.'+_0x4d71e5)[_0x8ea1('0x24')](_0x53b21c+_0x8ea1('0x25'),_0xca3998)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8ea1('0x24')](_0x8ea1('0x26'),selectNotIn(_0x53b21c,_0x5b5903,_0x4d71e5,_0x8ea1('0x27'),['\x22always\x22',_0x8ea1('0x28')]))[_0x8ea1('0x24')](_0x8ea1('0x26'),selectNotIn(_0x53b21c,_0x5b5903,_0x4d71e5,'cm_hopper',[_0x8ea1('0x29')])))['toString']();}function insertCmHopperBlack(_0x3684a9,_0x3bc3c4,_0x413e3c,_0x537199){var _0x1247f6=[_0x8ea1('0x14'),_0x8ea1('0x16'),_0x8ea1('0x17'),_0x3bc3c4+'.'+_0x537199,_0x8ea1('0x18'),_0x8ea1('0x19')];return squel['insert']()[_0x8ea1('0x2a')](_0x8ea1('0x2b'))[_0x8ea1('0x1d')](['phone',_0x8ea1('0x2c'),_0x8ea1('0x2d'),_0x537199,_0x8ea1('0x1e'),'updatedAt'],squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')](_0x1247f6)[_0x8ea1('0x11')](_0x3bc3c4)[_0x8ea1('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3bc3c4+_0x8ea1('0x2e'))[_0x8ea1('0x12')](_0x413e3c,null,_0x413e3c+'.id\x20=\x20'+_0x3bc3c4+'.'+_0x537199)[_0x8ea1('0x24')](_0x3bc3c4+_0x8ea1('0x25'),_0x3684a9)[_0x8ea1('0x24')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8ea1('0x24')](_0x8ea1('0x26'),squel[_0x8ea1('0xf')]()['field'](_0x8ea1('0x2f'))[_0x8ea1('0x11')](_0x8ea1('0x2b'))[_0x8ea1('0x24')](_0x8ea1('0x30'),_0x3684a9)[_0x8ea1('0x24')](_0x537199+_0x8ea1('0x31'),_0x3bc3c4+'.'+_0x537199)))[_0x8ea1('0x32')]();}function insertTzCmHopper(_0x3209bf,_0x2e9341,_0x4e2935,_0x325cac,_0x356b5d,_0x3621c8){var _0x5af981=['cm_contacts.phone',_0x8ea1('0x33')+_0x3621c8+_0x8ea1('0x34'),_0x8ea1('0x16'),'cm_contacts.ListId',_0x2e9341+'.'+_0x325cac,_0x8ea1('0x18'),_0x8ea1('0x19'),_0x8ea1('0x1a'),_0x8ea1('0x1b'),'\x22'+_0x356b5d+'\x22'];var _0x506f34=squel[_0x8ea1('0x1c')]()[_0x8ea1('0x2a')](_0x8ea1('0x27'))[_0x8ea1('0x1d')]([_0x8ea1('0x2f'),'scheduledat',_0x8ea1('0x2c'),_0x8ea1('0x2d'),_0x325cac,_0x8ea1('0x1e'),_0x8ea1('0x35'),_0x8ea1('0x36'),_0x8ea1('0x1f'),_0x8ea1('0x20')],squel[_0x8ea1('0xf')]()['fields'](_0x5af981)[_0x8ea1('0x11')](_0x2e9341)[_0x8ea1('0x12')](_0x8ea1('0x37'),null,_0x8ea1('0x22')+_0x2e9341+_0x8ea1('0x2e'))[_0x8ea1('0x12')](_0x4e2935,null,_0x4e2935+_0x8ea1('0x23')+_0x2e9341+'.'+_0x325cac)[_0x8ea1('0x12')](_0x3621c8,null,_0x3621c8+_0x8ea1('0x23')+_0x2e9341+'.'+_0x325cac)[_0x8ea1('0x24')](_0x2e9341+'.CmListId\x20=\x20?',_0x3209bf)[_0x8ea1('0x24')](_0x8ea1('0x38'),NOW)[_0x8ea1('0x24')](_0x8ea1('0x26'),selectNotIn(_0x2e9341,_0x4e2935,_0x325cac,_0x8ea1('0x27'),['\x22always\x22',_0x8ea1('0x28')]))[_0x8ea1('0x24')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e9341,_0x4e2935,_0x325cac,_0x8ea1('0x27'),[_0x8ea1('0x29')])))[_0x8ea1('0x32')]();return _0x506f34;}function insertTzCmHopperBlack(_0xd6f7d3,_0x559b4d,_0x201617,_0x278221){var _0x5a0097=[_0x8ea1('0x14'),_0x8ea1('0x16'),_0x8ea1('0x17'),_0x559b4d+'.'+_0x278221,_0x8ea1('0x18'),_0x8ea1('0x19')];return squel[_0x8ea1('0x1c')]()[_0x8ea1('0x2a')]('cm_hopper_black')[_0x8ea1('0x1d')](['phone',_0x8ea1('0x2c'),'ListId',_0x278221,_0x8ea1('0x1e'),_0x8ea1('0x35')],squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')](_0x5a0097)['from'](_0x559b4d)['join'](_0x8ea1('0x37'),null,_0x8ea1('0x22')+_0x559b4d+_0x8ea1('0x2e'))[_0x8ea1('0x12')](_0x201617,null,_0x201617+_0x8ea1('0x23')+_0x559b4d+'.'+_0x278221)[_0x8ea1('0x24')](_0x559b4d+'.CmListId\x20=\x20?',_0xd6f7d3)[_0x8ea1('0x24')](_0x8ea1('0x38'),NOW)[_0x8ea1('0x24')](_0x8ea1('0x26'),squel['select']()[_0x8ea1('0x10')](_0x8ea1('0x2f'))[_0x8ea1('0x11')]('cm_hopper_black')['where'](_0x8ea1('0x30'),_0xd6f7d3)[_0x8ea1('0x24')](_0x278221+_0x8ea1('0x31'),_0x559b4d+'.'+_0x278221)))['toString']();}function insertCmContact(_0x5aee2f,_0x284579,_0x1a2004,_0x146457){var _0x403809=_[_0x8ea1('0x39')](_[_0x8ea1('0x3a')](_0x146457),[_0x8ea1('0x2d'),_0x8ea1('0x3b'),'createdAt',_0x8ea1('0x35')]);return squel['insert']()[_0x8ea1('0x2a')](_0x8ea1('0x37'))[_0x8ea1('0x1d')](_0x403809,squel['select']()[_0x8ea1('0x21')](_0x403809)[_0x8ea1('0x11')](_0x284579)[_0x8ea1('0x24')]('('+_0x1a2004[_0x8ea1('0x12')](',')+_0x8ea1('0x3c'),squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')](_0x1a2004)[_0x8ea1('0x11')](_0x8ea1('0x37'))['where'](_0x8ea1('0x30'),_0x5aee2f)[_0x8ea1('0x24')](_0x8ea1('0x3d')))['where'](_0x8ea1('0x3e'),squel['select']()[_0x8ea1('0x10')]('MIN(id)',_0x8ea1('0x3f'))[_0x8ea1('0x11')](_0x284579)['group'](_0x1a2004[_0x8ea1('0x12')](','))))[_0x8ea1('0x32')]();}function handleStop(){logger['info'](_0x8ea1('0x40'));stopped=!![];}function handleUncaughtException(_0x392799){logger['error'](_0x392799[_0x8ea1('0x41')]);process[_0x8ea1('0x42')](0x1);}function handleError(_0xb83b9f,_0xa673d){stats['errors']['push']({'name':_0xa673d['code'],'message':_0xa673d[_0x8ea1('0x41')],'row':_0xb83b9f});}function handleQuery(_0x458999){logger[_0x8ea1('0x43')](_0x458999);return db[_0x8ea1('0x44')][_0x8ea1('0x45')](_0x458999)[_0x8ea1('0x46')](function(_0x2e0e0c){results[_0x8ea1('0x47')](_0x2e0e0c);})[_0x8ea1('0x48')](function(_0x37feed){logger[_0x8ea1('0x49')](_0x37feed['message']);});}function updateTzCampaigns(_0x5285cd){return new Promise(function(_0x218fdb,_0x520ebd){var _0x290365=squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')]([_0x8ea1('0x4a'),_0x8ea1('0x4b')])[_0x8ea1('0x11')](_0x8ea1('0x4c'))[_0x8ea1('0x12')](_0x8ea1('0x4d'),null,_0x8ea1('0x4e'))[_0x8ea1('0x24')](_0x8ea1('0x4f')+_0x5285cd);db[_0x8ea1('0x44')][_0x8ea1('0x45')](_0x290365['toString']())['spread'](function(_0x48d2a1){var _0x36ea8c=[];for(var _0x5949c4=0x0;_0x5949c4<_0x48d2a1[_0x8ea1('0x50')];_0x5949c4++){_0x36ea8c[_0x8ea1('0x47')](getTimezoneData(_0x48d2a1[_0x5949c4],tmp_campaigns));}BPromise['all'](_0x36ea8c)[_0x8ea1('0x51')](function(){_0x218fdb({'val':0x1});});})[_0x8ea1('0x48')](function(_0x533f40){logger['error'](_0x533f40['message']);_0x218fdb({'val':0x0});});});}function updateTzVoiceQueues(_0x2e6c54){return new Promise(function(_0x3f13fc,_0x3f57cc){var _0x5ebc70=squel[_0x8ea1('0xf')]()[_0x8ea1('0x21')]([_0x8ea1('0x52'),_0x8ea1('0x53')])[_0x8ea1('0x11')](_0x8ea1('0x54'))[_0x8ea1('0x12')](_0x8ea1('0x55'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x8ea1('0x24')]('voice_queues_has_cm_lists.CmListId='+_0x2e6c54);db[_0x8ea1('0x44')][_0x8ea1('0x45')](_0x5ebc70[_0x8ea1('0x32')]())[_0x8ea1('0x46')](function(_0x11c33f){var _0x54596f=[];for(var _0x56a844=0x0;_0x56a844<_0x11c33f['length'];_0x56a844++){_0x54596f[_0x8ea1('0x47')](getTimezoneData(_0x11c33f[_0x56a844],tmp_voice_queues));}BPromise[_0x8ea1('0x56')](_0x54596f)[_0x8ea1('0x51')](function(){_0x3f13fc({'val':0x1});});})[_0x8ea1('0x48')](function(_0x6f7158){logger[_0x8ea1('0x49')](_0x6f7158[_0x8ea1('0x41')]);_0x3f13fc({'val':0x0});});});}function getTimezoneData(_0x5c3a4f,_0x2b6e12){return new Promise(function(_0x3eac5a,_0x504b8a){var _0x3909de=shared[_0x8ea1('0x57')];var _0x14cab1=_0x3909de[_0x5c3a4f[_0x8ea1('0x58')]];if(_[_0x8ea1('0x59')](_0x14cab1)){_0x3eac5a({'ret':0x1});}else{var _0x17bfe6=_0x14cab1['utcOffset'];var _0x4417e4=squel[_0x8ea1('0x1c')]()[_0x8ea1('0x2a')](_0x2b6e12)[_0x8ea1('0x5a')]('id',_0x5c3a4f['id'])[_0x8ea1('0x5a')](_0x8ea1('0x5b'),_0x17bfe6)['set'](_0x8ea1('0x58'),_0x5c3a4f[_0x8ea1('0x58')])[_0x8ea1('0x32')]();return db[_0x8ea1('0x44')][_0x8ea1('0x45')](_0x4417e4)[_0x8ea1('0x46')](function(_0x853571){_0x3eac5a({'ret':0x1});})[_0x8ea1('0x48')](function(_0x13c8e5){logger[_0x8ea1('0x49')](_0x13c8e5[_0x8ea1('0x41')]);_0x504b8a({'ret':0x1});});}});}function handleTZQuery(_0x3be5c8){logger['info'](_0x3be5c8);return db[_0x8ea1('0x44')][_0x8ea1('0x45')](_0x3be5c8)['spread'](function(_0x2ca0af){})['catch'](function(_0x76ff2f){logger[_0x8ea1('0x49')](_0x76ff2f[_0x8ea1('0x41')]);});}function main(_0x52a310,_0x109caa,_0x169157,_0x4f6551){logger[_0x8ea1('0x43')](_0x8ea1('0x5c'),_0x52a310,JSON[_0x8ea1('0x5d')](_0x109caa));process[_0x8ea1('0x5e')](_0x8ea1('0x5f'));var _0x2aa950=_0x109caa[_0x8ea1('0x60')];var _0x46c54d=_0x109caa[_0x8ea1('0x61')];var _0x22c109=path[_0x8ea1('0x12')](config['root'],_0x8ea1('0x62'),_0x46c54d+_0x8ea1('0x63'));hasTZ=_[_0x8ea1('0x3a')](_0x2aa950)[_0x8ea1('0x64')](_0x8ea1('0x58'));var _0x12c56d=_[_0x8ea1('0x3a')](_0x2aa950)[_0x8ea1('0x12')]();logger[_0x8ea1('0x43')](_0x8ea1('0x65'),_0x12c56d);if(hasTZ)_0x12c56d+=_0x8ea1('0x66');fs[_0x8ea1('0x67')](_0x22c109,_0x12c56d+'\x0a');Papa[_0x8ea1('0x68')](fs[_0x8ea1('0x69')](_0x52a310),{'header':!![],'skipEmptyLines':!![],'step':function(_0x21763e,_0x18561a){try{for(var _0x5a8c70=0x0,_0x4d444d=[];_0x5a8c70<_0x21763e[_0x8ea1('0x6a')][_0x8ea1('0x50')];_0x5a8c70++){stats['rows']+=0x1;if(_0x21763e[_0x8ea1('0x6b')][_0x5a8c70]){handleError(_0x21763e[_0x8ea1('0x6a')][_0x5a8c70],_0x21763e['errors'][_0x5a8c70]);}else{var _0x14c21e=[];for(var _0x176e5e in _0x2aa950){if(_0x2aa950['hasOwnProperty'](_0x176e5e)){if(_0x21763e['data'][_0x5a8c70][_0x2aa950[_0x176e5e]]){var _0x2f5c10=_['trim'](_0x21763e[_0x8ea1('0x6a')][_0x5a8c70][_0x2aa950[_0x176e5e]]['replace'](/"/g,'\x27'));switch(_0x176e5e){case _0x8ea1('0x6c'):var _0x585964=moment(_0x2f5c10,_0x8ea1('0xe'),!![]);if(_0x585964[_0x8ea1('0x6d')]()){_0x4d444d['push']('\x22'+_0x2f5c10+'\x22');}else{_0x14c21e['push'](_0x8ea1('0x6e'));}break;case _0x8ea1('0x36'):var _0x4f944a=parseInt(_0x2f5c10);_0x2f5c10=_[_0x8ea1('0x6f')](_0x4f944a)||_0x4f944a<0x0||_0x4f944a>0x4?_0x4f6551?0x3:0x2:_0x4f944a;_0x4d444d[_0x8ea1('0x47')]('\x22'+_0x2f5c10+'\x22');break;case'UserId':var _0x1286af=parseInt(_0x2f5c10);if(_['isNumber'](_0x1286af)&&_['includes'](_0x169157,_0x1286af)){_0x4d444d['push']('\x22'+_0x1286af+'\x22');}else{_0x14c21e[_0x8ea1('0x47')](_0x8ea1('0x70'));}break;case _0x8ea1('0x71'):if(isEmail(_0x2f5c10)){_0x4d444d[_0x8ea1('0x47')]('\x22'+_0x2f5c10+'\x22');}else{_0x14c21e[_0x8ea1('0x47')]('email\x20wrong\x20format');}break;case _0x8ea1('0x72'):var _0x3e6cf0=moment(_0x2f5c10,_0x8ea1('0x73'),!![]);if(_0x3e6cf0[_0x8ea1('0x6d')]()){_0x4d444d[_0x8ea1('0x47')]('\x22'+_0x2f5c10+'\x22');}else{_0x14c21e[_0x8ea1('0x47')](_0x8ea1('0x74'));}break;case _0x8ea1('0x58'):var _0x421497=shared[_0x8ea1('0x57')];var _0x58f034=_0x421497[_0x2f5c10];if(!_[_0x8ea1('0x59')](_0x58f034)){var _0x5c5fa3=_0x58f034[_0x8ea1('0x75')];_0x4d444d['push']('\x22'+_0x2f5c10+'\x22');_0x4d444d[_0x8ea1('0x47')]('\x22'+_0x5c5fa3+'\x22');}break;default:_0x4d444d['push']('\x22'+_0x2f5c10+'\x22');}}else{switch(_0x176e5e){case _0x8ea1('0x76'):case'phone':_0x14c21e[_0x8ea1('0x47')](_0x176e5e+_0x8ea1('0x77'));break;default:_0x4d444d[_0x8ea1('0x47')]('\x22\x22');}}}}if(_0x14c21e['length']){handleError(_0x21763e['data'][_0x5a8c70],{'code':_0x8ea1('0x78'),'message':_0x14c21e[_0x8ea1('0x12')]()});}else{fs['appendFileSync'](_0x22c109,_0x4d444d[_0x8ea1('0x12')]()+'\x0a');}_0x4d444d=[];}if(!(stats[_0x8ea1('0x79')]%0xc8)){socket[_0x8ea1('0x7a')](_0x8ea1('0x7b')+_0x46c54d,stats);stats[_0x8ea1('0x6b')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x18561a[_0x8ea1('0x7c')]();}}catch(_0x364120){handleError(_0x21763e['data'][_0x5a8c70],{'code':'SystemError','message':_0x364120[_0x8ea1('0x41')]});logger['error'](_0x8ea1('0x7d'),_0x364120[_0x8ea1('0x41')]);}},'complete':function(){try{var _0x2f5ae3=[];var _0x3a83d9=[];var _0x1ccdb3=_0x8ea1('0x37');if(_0x109caa['duplicates']&&_0x109caa[_0x8ea1('0x7e')][_0x8ea1('0x50')]){_0x1ccdb3=_0x8ea1('0x7f')+_0x46c54d;_0x2f5ae3[_0x8ea1('0x47')](_0x8ea1('0x80')+_0x1ccdb3+_0x8ea1('0x81'));}tmp_campaigns=_0x8ea1('0x82')+_0x46c54d;tmp_voice_queues=_0x8ea1('0x83')+_0x46c54d;_0x3a83d9[_0x8ea1('0x47')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x8ea1('0x84'));_0x3a83d9[_0x8ea1('0x47')](_0x8ea1('0x80')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8ea1('0x85')](_0x3a83d9,handleTZQuery)[_0x8ea1('0x51')](function(_0xc81d63){updateTzCampaigns(_0x109caa['ListId'])[_0x8ea1('0x51')](function(_0x2b7d6b){updateTzVoiceQueues(_0x109caa[_0x8ea1('0x2d')])[_0x8ea1('0x51')](function(_0x3f1016){var _0x1a690d=util[_0x8ea1('0xd')](_0x8ea1('0x86'),_0x22c109,_0x1ccdb3,_0x12c56d,_0x109caa[_0x8ea1('0x2d')],_0x109caa[_0x8ea1('0x3b')]||null,NOW,NOW);if(_['isNil'](_0x2aa950[_0x8ea1('0x6c')])){_0x1a690d+=_0x8ea1('0x87');}_0x2f5ae3['push'](_0x1a690d);if(_0x109caa[_0x8ea1('0x7e')]&&_0x109caa[_0x8ea1('0x7e')][_0x8ea1('0x50')]){_0x2f5ae3['push'](insertCmContact(_0x109caa['ListId'],_0x1ccdb3,_0x109caa[_0x8ea1('0x7e')],_0x2aa950));_0x2f5ae3['push'](_0x8ea1('0x88')+_0x1ccdb3+';');}if(hasTZ){_0x2f5ae3['push'](insertTzCmHopper(_0x109caa['ListId'],'voice_queues_has_cm_lists',_0x8ea1('0x54'),_0x8ea1('0x89'),_0x4f6551,tmp_voice_queues));_0x2f5ae3[_0x8ea1('0x47')](insertTzCmHopperBlack(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x8a'),_0x8ea1('0x54'),_0x8ea1('0x89')));_0x2f5ae3[_0x8ea1('0x47')](insertTzCmHopper(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x4d'),_0x8ea1('0x4c'),_0x8ea1('0x8b'),_0x4f6551,tmp_campaigns));_0x2f5ae3[_0x8ea1('0x47')](insertTzCmHopperBlack(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x8c'),_0x8ea1('0x4c'),'CampaignId'));}else{_0x2f5ae3['push'](insertCmHopper(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x55'),_0x8ea1('0x54'),_0x8ea1('0x89'),_0x4f6551));_0x2f5ae3['push'](insertCmHopperBlack(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x8a'),_0x8ea1('0x54'),_0x8ea1('0x89')));_0x2f5ae3[_0x8ea1('0x47')](insertCmHopper(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x4d'),_0x8ea1('0x4c'),'CampaignId',_0x4f6551));_0x2f5ae3[_0x8ea1('0x47')](insertCmHopperBlack(_0x109caa[_0x8ea1('0x2d')],_0x8ea1('0x8c'),_0x8ea1('0x4c'),'CampaignId'));}_0x2f5ae3['push']('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x2f5ae3['push'](_0x8ea1('0x88')+tmp_voice_queues+';');BPromise[_0x8ea1('0x85')](_0x2f5ae3,handleQuery)[_0x8ea1('0x51')](function(_0x2d1aa6){stats[_0x8ea1('0x8d')]=!![];stats[_0x8ea1('0x8e')]=_0x109caa[_0x8ea1('0x7e')]&&_0x109caa[_0x8ea1('0x7e')][_0x8ea1('0x50')]?results[0x2][_0x8ea1('0x8e')]:results[0x0][_0x8ea1('0x8e')];socket['emit'](_0x8ea1('0x7b')+_0x46c54d,stats);fs[_0x8ea1('0x8f')](_0x52a310);fs[_0x8ea1('0x8f')](_0x22c109);process[_0x8ea1('0x42')](0x0);})[_0x8ea1('0x48')](function(_0x1c4dff){logger[_0x8ea1('0x49')](_0x1c4dff[_0x8ea1('0x41')]);process[_0x8ea1('0x42')](0x1);});});});});}catch(_0x5ae7da){logger[_0x8ea1('0x49')]('complete',_0x5ae7da[_0x8ea1('0x41')]);process[_0x8ea1('0x42')](0x1);}},'error':function(_0x28a7fd,_0x3578ba,_0x1030a9,_0x4ba47e){throw new Error(_0x4ba47e);}});}function validate(){if(process['argv']&&process['argv'][_0x8ea1('0x50')]<0x4){throw new Error(_0x8ea1('0x90'));}var _0x485e77=path[_0x8ea1('0x12')](config[_0x8ea1('0x91')],_0x8ea1('0x62'),process[_0x8ea1('0x92')][0x2]);if(!fs[_0x8ea1('0x93')](_0x485e77)){throw new Error(_0x8ea1('0x94'));}var _0x2a57d7={};try{_0x2a57d7=JSON[_0x8ea1('0x68')](process['argv'][0x3]);if(!_0x2a57d7['binding']){throw new Error(_0x8ea1('0x95'));}if(!_0x2a57d7['binding'][_0x8ea1('0x2f')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2a57d7['binding']['firstName']){throw new Error(_0x8ea1('0x96'));}var _0x587c06=0x0;if(_0x2a57d7[_0x8ea1('0x60')][_0x8ea1('0x1f')]){_0x587c06=0x1;}if(!_0x2a57d7[_0x8ea1('0x2d')]){throw new Error(_0x8ea1('0x97'));}}catch(_0x1ce0d5){throw new Error(_0x8ea1('0x98'));}var _0x8b9231=[];try{_0x8b9231=_[_0x8ea1('0x99')](JSON['parse'](process[_0x8ea1('0x92')][0x4]),'id');}catch(_0x139c6e){logger[_0x8ea1('0x43')](_0x8ea1('0x9a'));}main(_0x485e77,_0x2a57d7,_0x8b9231,_0x587c06);}validate();process['on'](_0x8ea1('0x9b'),handleStop);process['on'](_0x8ea1('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x0083=['binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert','cm_hopper_black','.CmListId','field','ListId\x20=\x20?','scheduledat','priority','\x22onlyIfOpen\x22','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','push','message','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','length','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','all','timezones','dialTimezone','isNil','utcOffset','set','offset','sequelize','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','exit','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','parse'];(function(_0xa96e94,_0x33e78f){var _0x1a90b5=function(_0x468270){while(--_0x468270){_0xa96e94['push'](_0xa96e94['shift']());}};_0x1a90b5(++_0x33e78f);}(_0x0083,0x1cf));var _0x3008=function(_0x3086d0,_0x5ad3a0){_0x3086d0=_0x3086d0-0x0;var _0xb4cde=_0x0083[_0x3086d0];return _0xb4cde;};'use strict';var fs=require('fs');var path=require(_0x3008('0x0'));var _=require(_0x3008('0x1'));var Papa=require(_0x3008('0x2'));var util=require(_0x3008('0x3'));var BPromise=require(_0x3008('0x4'));var moment=require(_0x3008('0x5'));var squel=require(_0x3008('0x6'));var Redis=require(_0x3008('0x7'));var db=require(_0x3008('0x8'))['db'];var config=require(_0x3008('0x9'));var shared=require(_0x3008('0xa'));var logger=require(_0x3008('0xb'))('import');config[_0x3008('0xc')]=_[_0x3008('0xd')](config[_0x3008('0xc')],{'host':_0x3008('0xe'),'port':0x18eb});var socket=require(_0x3008('0xf'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x3008('0x10')](_0x3008('0x11'));function isEmail(_0x1c548d){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'](_0x1c548d);}function selectNotIn(_0x1dc7ab,_0x48a861,_0x4b0a06,_0x2ecae9,_0x4e56b2){return squel['select']()['field'](_0x3008('0x12'))[_0x3008('0x13')](_0x2ecae9)[_0x3008('0x14')](_0x48a861,null,_0x48a861+_0x3008('0x15')+_0x2ecae9+'.'+_0x4b0a06)[_0x3008('0x16')](_0x2ecae9+'.'+_0x4b0a06+_0x3008('0x17')+_0x1dc7ab+'.'+_0x4b0a06)[_0x3008('0x16')](_0x48a861+_0x3008('0x18')+_0x4e56b2[_0x3008('0x14')]()+')');}function insertCmHopper(_0x3c61f6,_0x3a77ce,_0x2878ee,_0x5e3fdf,_0x175dd8){var _0x1030a9=[_0x3008('0x19'),_0x3008('0x1a'),_0x3008('0x1b'),_0x3008('0x1c'),_0x3a77ce+'.'+_0x5e3fdf,_0x3008('0x1d'),_0x3008('0x1e'),_0x3008('0x1f'),_0x3008('0x20'),'\x22'+_0x175dd8+'\x22'];return squel['insert']()[_0x3008('0x21')](_0x3008('0x22'))[_0x3008('0x23')]([_0x3008('0x12'),'scheduledat',_0x3008('0x24'),_0x3008('0x25'),_0x5e3fdf,_0x3008('0x26'),_0x3008('0x27'),'priority',_0x3008('0x28'),_0x3008('0x29')],squel[_0x3008('0x2a')]()[_0x3008('0x2b')](_0x1030a9)[_0x3008('0x13')](_0x3a77ce)['join'](_0x3008('0x2c'),null,_0x3008('0x2d')+_0x3a77ce+'.CmListId')[_0x3008('0x14')](_0x2878ee,null,_0x2878ee+_0x3008('0x15')+_0x3a77ce+'.'+_0x5e3fdf)[_0x3008('0x16')](_0x3a77ce+_0x3008('0x2e'),_0x3c61f6)[_0x3008('0x16')](_0x3008('0x2f'),NOW)['where'](_0x3008('0x30'),selectNotIn(_0x3a77ce,_0x2878ee,_0x5e3fdf,_0x3008('0x22'),[_0x3008('0x31'),'\x22onlyIfOpen\x22']))['where'](_0x3008('0x30'),selectNotIn(_0x3a77ce,_0x2878ee,_0x5e3fdf,_0x3008('0x22'),['\x22always\x22'])))[_0x3008('0x32')]();}function insertCmHopperBlack(_0x1a3e1d,_0x2c665b,_0x5d3def,_0x3be8b9){var _0x4f8589=[_0x3008('0x19'),'cm_contacts.id',_0x3008('0x1c'),_0x2c665b+'.'+_0x3be8b9,_0x3008('0x1d'),'cm_contacts.updatedAt'];return squel[_0x3008('0x33')]()[_0x3008('0x21')](_0x3008('0x34'))[_0x3008('0x23')]([_0x3008('0x12'),_0x3008('0x24'),'ListId',_0x3be8b9,_0x3008('0x26'),_0x3008('0x27')],squel['select']()[_0x3008('0x2b')](_0x4f8589)['from'](_0x2c665b)[_0x3008('0x14')]('cm_contacts',null,_0x3008('0x2d')+_0x2c665b+_0x3008('0x35'))[_0x3008('0x14')](_0x5d3def,null,_0x5d3def+_0x3008('0x15')+_0x2c665b+'.'+_0x3be8b9)[_0x3008('0x16')](_0x2c665b+_0x3008('0x2e'),_0x1a3e1d)[_0x3008('0x16')](_0x3008('0x2f'),NOW)[_0x3008('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3008('0x2a')]()[_0x3008('0x36')](_0x3008('0x12'))[_0x3008('0x13')](_0x3008('0x34'))['where'](_0x3008('0x37'),_0x1a3e1d)[_0x3008('0x16')](_0x3be8b9+'\x20=\x20?',_0x2c665b+'.'+_0x3be8b9)))['toString']();}function insertTzCmHopper(_0x18a377,_0x470069,_0x4e7290,_0x569fa7,_0x3d2818,_0x1f053a){var _0x2ad149=[_0x3008('0x19'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x1f053a+'.offset-cm_contacts.utcOffset\x20minute)',_0x3008('0x1b'),_0x3008('0x1c'),_0x470069+'.'+_0x569fa7,'cm_contacts.createdAt',_0x3008('0x1e'),'cm_contacts.priority',_0x3008('0x20'),'\x22'+_0x3d2818+'\x22'];var _0x544c99=squel['insert']()[_0x3008('0x21')]('cm_hopper')['fromQuery'](['phone',_0x3008('0x38'),_0x3008('0x24'),_0x3008('0x25'),_0x569fa7,_0x3008('0x26'),_0x3008('0x27'),_0x3008('0x39'),_0x3008('0x28'),_0x3008('0x29')],squel[_0x3008('0x2a')]()[_0x3008('0x2b')](_0x2ad149)['from'](_0x470069)['join'](_0x3008('0x2c'),null,_0x3008('0x2d')+_0x470069+'.CmListId')[_0x3008('0x14')](_0x4e7290,null,_0x4e7290+_0x3008('0x15')+_0x470069+'.'+_0x569fa7)[_0x3008('0x14')](_0x1f053a,null,_0x1f053a+_0x3008('0x15')+_0x470069+'.'+_0x569fa7)[_0x3008('0x16')](_0x470069+_0x3008('0x2e'),_0x18a377)[_0x3008('0x16')](_0x3008('0x2f'),NOW)[_0x3008('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x470069,_0x4e7290,_0x569fa7,'cm_hopper',['\x22always\x22',_0x3008('0x3a')]))[_0x3008('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x470069,_0x4e7290,_0x569fa7,_0x3008('0x22'),[_0x3008('0x31')])))[_0x3008('0x32')]();return _0x544c99;}function insertTzCmHopperBlack(_0x44ecb7,_0x56c71d,_0xf48250,_0x4b097e){var _0x1401c0=[_0x3008('0x19'),_0x3008('0x1b'),'cm_contacts.ListId',_0x56c71d+'.'+_0x4b097e,_0x3008('0x1d'),'cm_contacts.updatedAt'];return squel[_0x3008('0x33')]()[_0x3008('0x21')]('cm_hopper_black')[_0x3008('0x23')]([_0x3008('0x12'),_0x3008('0x24'),_0x3008('0x25'),_0x4b097e,'createdAt',_0x3008('0x27')],squel[_0x3008('0x2a')]()[_0x3008('0x2b')](_0x1401c0)[_0x3008('0x13')](_0x56c71d)[_0x3008('0x14')](_0x3008('0x2c'),null,'cm_contacts.ListId\x20=\x20'+_0x56c71d+_0x3008('0x35'))['join'](_0xf48250,null,_0xf48250+'.id\x20=\x20'+_0x56c71d+'.'+_0x4b097e)[_0x3008('0x16')](_0x56c71d+_0x3008('0x2e'),_0x44ecb7)['where'](_0x3008('0x2f'),NOW)[_0x3008('0x16')](_0x3008('0x30'),squel[_0x3008('0x2a')]()[_0x3008('0x36')]('phone')['from'](_0x3008('0x34'))[_0x3008('0x16')](_0x3008('0x37'),_0x44ecb7)['where'](_0x4b097e+_0x3008('0x3b'),_0x56c71d+'.'+_0x4b097e)))[_0x3008('0x32')]();}function insertCmContact(_0x93e8fc,_0x4cec84,_0x37d3a0,_0xc7c3f9){var _0x46f5eb=_['concat'](_[_0x3008('0x3c')](_0xc7c3f9),[_0x3008('0x25'),'CompanyId','createdAt','updatedAt']);return squel[_0x3008('0x33')]()[_0x3008('0x21')]('cm_contacts')[_0x3008('0x23')](_0x46f5eb,squel[_0x3008('0x2a')]()['fields'](_0x46f5eb)[_0x3008('0x13')](_0x4cec84)[_0x3008('0x16')]('('+_0x37d3a0[_0x3008('0x14')](',')+_0x3008('0x3d'),squel[_0x3008('0x2a')]()[_0x3008('0x2b')](_0x37d3a0)[_0x3008('0x13')](_0x3008('0x2c'))['where'](_0x3008('0x37'),_0x93e8fc)[_0x3008('0x16')](_0x3008('0x3e')))[_0x3008('0x16')]('id\x20IN\x20?',squel[_0x3008('0x2a')]()[_0x3008('0x36')](_0x3008('0x3f'),_0x3008('0x40'))[_0x3008('0x13')](_0x4cec84)[_0x3008('0x41')](_0x37d3a0['join'](','))))[_0x3008('0x32')]();}function handleStop(){logger[_0x3008('0x42')](_0x3008('0x43'));stopped=!![];}function handleUncaughtException(_0xd151b){logger[_0x3008('0x44')](_0xd151b['message']);process['exit'](0x1);}function handleError(_0x4d6fdd,_0x53a4ac){stats[_0x3008('0x45')][_0x3008('0x46')]({'name':_0x53a4ac['code'],'message':_0x53a4ac[_0x3008('0x47')],'row':_0x4d6fdd});}function handleQuery(_0x1a7865){logger['info'](_0x1a7865);return db['sequelize']['query'](_0x1a7865)[_0x3008('0x48')](function(_0x2efda2){results[_0x3008('0x46')](_0x2efda2);})[_0x3008('0x49')](function(_0x9cba2){logger[_0x3008('0x44')](_0x9cba2[_0x3008('0x47')]);});}function updateTzCampaigns(_0x23189c){return new Promise(function(_0x1c2bc1,_0x1fafe3){var _0x34be52=squel[_0x3008('0x2a')]()[_0x3008('0x2b')](['campaigns.id',_0x3008('0x4a')])[_0x3008('0x13')](_0x3008('0x4b'))[_0x3008('0x14')](_0x3008('0x4c'),null,_0x3008('0x4d'))['where'](_0x3008('0x4e')+_0x23189c);db['sequelize'][_0x3008('0x4f')](_0x34be52['toString']())[_0x3008('0x48')](function(_0x355851){var _0x34493a=[];for(var _0x317849=0x0;_0x317849<_0x355851[_0x3008('0x50')];_0x317849++){_0x34493a['push'](getTimezoneData(_0x355851[_0x317849],tmp_campaigns));}BPromise['all'](_0x34493a)['then'](function(){_0x1c2bc1({'val':0x1});});})[_0x3008('0x49')](function(_0x5bd3d4){logger[_0x3008('0x44')](_0x5bd3d4[_0x3008('0x47')]);_0x1c2bc1({'val':0x0});});});}function updateTzVoiceQueues(_0x5580bd){return new Promise(function(_0x5efd19,_0x3c6a75){var _0x4a3e2d=squel[_0x3008('0x2a')]()[_0x3008('0x2b')]([_0x3008('0x51'),_0x3008('0x52')])['from']('voice_queues')[_0x3008('0x14')](_0x3008('0x53'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x3008('0x16')](_0x3008('0x54')+_0x5580bd);db['sequelize'][_0x3008('0x4f')](_0x4a3e2d[_0x3008('0x32')]())[_0x3008('0x48')](function(_0x47e8de){var _0x90f261=[];for(var _0x454d80=0x0;_0x454d80<_0x47e8de[_0x3008('0x50')];_0x454d80++){_0x90f261[_0x3008('0x46')](getTimezoneData(_0x47e8de[_0x454d80],tmp_voice_queues));}BPromise[_0x3008('0x55')](_0x90f261)['then'](function(){_0x5efd19({'val':0x1});});})[_0x3008('0x49')](function(_0x487fc5){logger[_0x3008('0x44')](_0x487fc5[_0x3008('0x47')]);_0x5efd19({'val':0x0});});});}function getTimezoneData(_0x917d7c,_0x26a322){return new Promise(function(_0x374bd6,_0x5d100f){var _0x27e34a=shared[_0x3008('0x56')];var _0xc65fad=_0x27e34a[_0x917d7c[_0x3008('0x57')]];if(_[_0x3008('0x58')](_0xc65fad)){_0x374bd6({'ret':0x1});}else{var _0x453824=_0xc65fad[_0x3008('0x59')];var _0x55b786=squel[_0x3008('0x33')]()[_0x3008('0x21')](_0x26a322)['set']('id',_0x917d7c['id'])[_0x3008('0x5a')](_0x3008('0x5b'),_0x453824)['set']('dialTimezone',_0x917d7c[_0x3008('0x57')])[_0x3008('0x32')]();return db[_0x3008('0x5c')][_0x3008('0x4f')](_0x55b786)[_0x3008('0x48')](function(_0x467331){_0x374bd6({'ret':0x1});})[_0x3008('0x49')](function(_0x1e63e7){logger[_0x3008('0x44')](_0x1e63e7['message']);_0x5d100f({'ret':0x1});});}});}function handleTZQuery(_0x564380){logger[_0x3008('0x42')](_0x564380);return db[_0x3008('0x5c')]['query'](_0x564380)[_0x3008('0x48')](function(_0x3b8fdb){})['catch'](function(_0x2f4c51){logger['error'](_0x2f4c51[_0x3008('0x47')]);});}function main(_0x41eeca,_0x431344,_0x598e31,_0x152b42){logger['info']('main',_0x41eeca,JSON[_0x3008('0x5d')](_0x431344));process['send'](_0x3008('0x5e'));var _0x572ac9=_0x431344[_0x3008('0x5f')];var _0x181ff9=_0x431344[_0x3008('0x60')];var _0x4690be=path[_0x3008('0x14')](config[_0x3008('0x61')],_0x3008('0x62'),_0x181ff9+_0x3008('0x63'));hasTZ=_[_0x3008('0x3c')](_0x572ac9)[_0x3008('0x64')](_0x3008('0x57'));var _0x232dbf=_[_0x3008('0x3c')](_0x572ac9)[_0x3008('0x14')]();logger[_0x3008('0x42')](_0x3008('0x65'),_0x232dbf);if(hasTZ)_0x232dbf+=',utcOffset';fs['writeFileSync'](_0x4690be,_0x232dbf+'\x0a');Papa['parse'](fs[_0x3008('0x66')](_0x41eeca),{'header':!![],'skipEmptyLines':!![],'step':function(_0x574d81,_0x4df47d){try{for(var _0x597a3c=0x0,_0xdc1fce=[];_0x597a3c<_0x574d81[_0x3008('0x67')][_0x3008('0x50')];_0x597a3c++){stats[_0x3008('0x68')]+=0x1;if(_0x574d81['errors'][_0x597a3c]){handleError(_0x574d81[_0x3008('0x67')][_0x597a3c],_0x574d81['errors'][_0x597a3c]);}else{var _0x3d95be=[];for(var _0x1be69b in _0x572ac9){if(_0x572ac9[_0x3008('0x69')](_0x1be69b)){if(_0x574d81['data'][_0x597a3c][_0x572ac9[_0x1be69b]]){var _0x58c999=_[_0x3008('0x6a')](_0x574d81['data'][_0x597a3c][_0x572ac9[_0x1be69b]]['replace'](/"/g,'\x27'));switch(_0x1be69b){case _0x3008('0x38'):var _0x41b67b=moment(_0x58c999,_0x3008('0x11'),!![]);if(_0x41b67b[_0x3008('0x6b')]()){_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');}else{_0x3d95be[_0x3008('0x46')](_0x3008('0x6c'));}break;case _0x3008('0x39'):var _0x10b575=parseInt(_0x58c999);_0x58c999=_['isNaN'](_0x10b575)||_0x10b575<0x0||_0x10b575>0x4?_0x152b42?0x3:0x2:_0x10b575;_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');break;case'UserId':var _0x5ba0cf=parseInt(_0x58c999);if(_[_0x3008('0x6d')](_0x5ba0cf)&&_[_0x3008('0x64')](_0x598e31,_0x5ba0cf)){_0xdc1fce['push']('\x22'+_0x5ba0cf+'\x22');}else{_0x3d95be[_0x3008('0x46')](_0x3008('0x6e'));}break;case _0x3008('0x6f'):if(isEmail(_0x58c999)){_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');}else{_0x3d95be[_0x3008('0x46')](_0x3008('0x70'));}break;case _0x3008('0x71'):var _0xe8efff=moment(_0x58c999,'YYYY-MM-DD',!![]);if(_0xe8efff['isValid']()){_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');}else{_0x3d95be[_0x3008('0x46')](_0x3008('0x72'));}break;case _0x3008('0x57'):var _0x27068c=shared['timezones'];var _0x48daed=_0x27068c[_0x58c999];if(!_[_0x3008('0x58')](_0x48daed)){var _0x55e0e8=_0x48daed['utcOffset'];_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');_0xdc1fce[_0x3008('0x46')]('\x22'+_0x55e0e8+'\x22');}break;default:_0xdc1fce[_0x3008('0x46')]('\x22'+_0x58c999+'\x22');}}else{switch(_0x1be69b){case _0x3008('0x73'):case _0x3008('0x12'):_0x3d95be[_0x3008('0x46')](_0x1be69b+'\x20not\x20specified');break;default:_0xdc1fce[_0x3008('0x46')]('\x22\x22');}}}}if(_0x3d95be[_0x3008('0x50')]){handleError(_0x574d81['data'][_0x597a3c],{'code':_0x3008('0x74'),'message':_0x3d95be['join']()});}else{fs['appendFileSync'](_0x4690be,_0xdc1fce[_0x3008('0x14')]()+'\x0a');}_0xdc1fce=[];}if(!(stats[_0x3008('0x68')]%0xc8)){socket[_0x3008('0x75')](_0x3008('0x76')+_0x181ff9,stats);stats['errors']=[];}}if(stopped){logger[_0x3008('0x42')](_0x3008('0x77'));_0x4df47d[_0x3008('0x78')]();}}catch(_0x27426a){handleError(_0x574d81[_0x3008('0x67')][_0x597a3c],{'code':'SystemError','message':_0x27426a[_0x3008('0x47')]});logger[_0x3008('0x44')](_0x3008('0x79'),_0x27426a[_0x3008('0x47')]);}},'complete':function(){try{var _0x1aac28=[];var _0x2e0e03=[];var _0x41f0db=_0x3008('0x2c');if(_0x431344[_0x3008('0x7a')]&&_0x431344[_0x3008('0x7a')][_0x3008('0x50')]){_0x41f0db=_0x3008('0x7b')+_0x181ff9;_0x1aac28['push'](_0x3008('0x7c')+_0x41f0db+_0x3008('0x7d'));}tmp_campaigns=_0x3008('0x7e')+_0x181ff9;tmp_voice_queues=_0x3008('0x7f')+_0x181ff9;_0x2e0e03[_0x3008('0x46')](_0x3008('0x7c')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2e0e03[_0x3008('0x46')](_0x3008('0x7c')+tmp_voice_queues+_0x3008('0x80'));BPromise[_0x3008('0x81')](_0x2e0e03,handleTZQuery)[_0x3008('0x82')](function(_0x59a053){updateTzCampaigns(_0x431344[_0x3008('0x25')])[_0x3008('0x82')](function(_0x428588){updateTzVoiceQueues(_0x431344[_0x3008('0x25')])[_0x3008('0x82')](function(_0x59d167){var _0x30b5b4=util[_0x3008('0x10')](_0x3008('0x83'),_0x4690be,_0x41f0db,_0x232dbf,_0x431344[_0x3008('0x25')],_0x431344[_0x3008('0x84')]||null,NOW,NOW);if(_['isNil'](_0x572ac9[_0x3008('0x38')])){_0x30b5b4+=_0x3008('0x85');}_0x1aac28[_0x3008('0x46')](_0x30b5b4);if(_0x431344[_0x3008('0x7a')]&&_0x431344[_0x3008('0x7a')]['length']){_0x1aac28[_0x3008('0x46')](insertCmContact(_0x431344[_0x3008('0x25')],_0x41f0db,_0x431344[_0x3008('0x7a')],_0x572ac9));_0x1aac28[_0x3008('0x46')](_0x3008('0x86')+_0x41f0db+';');}if(hasTZ){_0x1aac28['push'](insertTzCmHopper(_0x431344[_0x3008('0x25')],_0x3008('0x53'),_0x3008('0x87'),_0x3008('0x88'),_0x152b42,tmp_voice_queues));_0x1aac28[_0x3008('0x46')](insertTzCmHopperBlack(_0x431344[_0x3008('0x25')],_0x3008('0x89'),'voice_queues',_0x3008('0x88')));_0x1aac28['push'](insertTzCmHopper(_0x431344[_0x3008('0x25')],'campaigns_has_cm_lists','campaigns',_0x3008('0x8a'),_0x152b42,tmp_campaigns));_0x1aac28[_0x3008('0x46')](insertTzCmHopperBlack(_0x431344[_0x3008('0x25')],_0x3008('0x8b'),_0x3008('0x4b'),'CampaignId'));}else{_0x1aac28[_0x3008('0x46')](insertCmHopper(_0x431344['ListId'],_0x3008('0x53'),'voice_queues',_0x3008('0x88'),_0x152b42));_0x1aac28['push'](insertCmHopperBlack(_0x431344[_0x3008('0x25')],_0x3008('0x89'),_0x3008('0x87'),_0x3008('0x88')));_0x1aac28[_0x3008('0x46')](insertCmHopper(_0x431344[_0x3008('0x25')],_0x3008('0x4c'),'campaigns',_0x3008('0x8a'),_0x152b42));_0x1aac28[_0x3008('0x46')](insertCmHopperBlack(_0x431344['ListId'],_0x3008('0x8b'),_0x3008('0x4b'),_0x3008('0x8a')));}_0x1aac28['push'](_0x3008('0x86')+tmp_campaigns+';');_0x1aac28[_0x3008('0x46')](_0x3008('0x86')+tmp_voice_queues+';');BPromise[_0x3008('0x81')](_0x1aac28,handleQuery)[_0x3008('0x82')](function(_0x42bd94){stats['finish']=!![];stats[_0x3008('0x8c')]=_0x431344[_0x3008('0x7a')]&&_0x431344[_0x3008('0x7a')]['length']?results[0x2][_0x3008('0x8c')]:results[0x0][_0x3008('0x8c')];socket[_0x3008('0x75')](_0x3008('0x76')+_0x181ff9,stats);fs[_0x3008('0x8d')](_0x41eeca);fs[_0x3008('0x8d')](_0x4690be);process[_0x3008('0x8e')](0x0);})[_0x3008('0x49')](function(_0x29b968){logger[_0x3008('0x44')](_0x29b968[_0x3008('0x47')]);process[_0x3008('0x8e')](0x1);});});});});}catch(_0x503f35){logger[_0x3008('0x44')](_0x3008('0x8f'),_0x503f35[_0x3008('0x47')]);process[_0x3008('0x8e')](0x1);}},'error':function(_0x31b924,_0x164c28,_0xd3e723,_0x2321a3){throw new Error(_0x2321a3);}});}function validate(){if(process['argv']&&process['argv'][_0x3008('0x50')]<0x4){throw new Error(_0x3008('0x90'));}var _0x52c20b=path[_0x3008('0x14')](config[_0x3008('0x61')],_0x3008('0x62'),process[_0x3008('0x91')][0x2]);if(!fs[_0x3008('0x92')](_0x52c20b)){throw new Error(_0x3008('0x93'));}var _0x3e69e8={};try{_0x3e69e8=JSON[_0x3008('0x94')](process[_0x3008('0x91')][0x3]);if(!_0x3e69e8[_0x3008('0x5f')]){throw new Error(_0x3008('0x95'));}if(!_0x3e69e8[_0x3008('0x5f')][_0x3008('0x12')]){throw new Error(_0x3008('0x96'));}if(!_0x3e69e8['binding'][_0x3008('0x73')]){throw new Error('firstName\x20is\x20mandatory');}var _0x419ef7=0x0;if(_0x3e69e8[_0x3008('0x5f')]['UserId']){_0x419ef7=0x1;}if(!_0x3e69e8[_0x3008('0x25')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x28d744){throw new Error(_0x3008('0x97'));}var _0x2cb6c7=[];try{_0x2cb6c7=_['map'](JSON[_0x3008('0x94')](process['argv'][0x4]),'id');}catch(_0xb8f730){logger[_0x3008('0x42')]('No\x20agent\x20available');}main(_0x52c20b,_0x3e69e8,_0x2cb6c7,_0x419ef7);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3008('0x98'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5ee4322..0a9548b 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdccb=['Call\x20To','destexten','Queue','uniqueid','Date','***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname'];(function(_0x4e9d91,_0x24786e){var _0x4c36e0=function(_0x403b66){while(--_0x403b66){_0x4e9d91['push'](_0x4e9d91['shift']());}};_0x4c36e0(++_0x24786e);}(_0xdccb,0x73));var _0xbdcc=function(_0x35a260,_0x2ddf05){_0x35a260=_0x35a260-0x0;var _0xabb77b=_0xdccb[_0x35a260];return _0xabb77b;};'use strict';exports[_0xbdcc('0x0')]=function(_0xe9423e,_0x318d06){var _0x72d3a=[{'type':_0xbdcc('0x1'),'content':_0xbdcc('0x2'),'variableName':null}];switch(_0xe9423e[_0xbdcc('0x3')]()){case _0xbdcc('0x4'):switch(_0x318d06['toLowerCase']()){case _0xbdcc('0x5'):_0x72d3a[_0xbdcc('0x6')]({'type':_0xbdcc('0x7'),'content':'','variableName':_0xbdcc('0x8')});_0x72d3a[_0xbdcc('0x6')]({'type':_0xbdcc('0x7'),'content':'','variableName':'calleridnum'});break;case _0xbdcc('0x9'):_0x72d3a[_0xbdcc('0x6')]({'type':'string','content':_0xbdcc('0xa'),'variableName':null});_0x72d3a[_0xbdcc('0x6')]({'type':_0xbdcc('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x72d3a;};exports[_0xbdcc('0xb')]=function(_0x1ef6c1,_0x23df68){var _0x386ec2=[];switch(_0x1ef6c1['toLowerCase']()){case _0xbdcc('0x4'):switch(_0x23df68['toLowerCase']()){case _0xbdcc('0x5'):_0x386ec2=[{'type':'string','content':_0xbdcc('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0xe'),'keyType':'variable','variableName':_0xbdcc('0xf')},{'type':_0xbdcc('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x10')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x11'),'keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x12')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x13'),'keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x8')},{'type':_0xbdcc('0xd'),'content':'','key':'UniqueId','keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x14')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x15'),'keyType':_0xbdcc('0x7'),'variableName':'agentcalledAt'},{'type':_0xbdcc('0x1'),'content':_0xbdcc('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x17')},{'type':_0xbdcc('0xd'),'content':'','key':'Agent\x20Number','keyType':_0xbdcc('0x7'),'variableName':'destcalleridnum'},{'type':_0xbdcc('0x1'),'content':_0xbdcc('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbdcc('0x19'),'keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x1a')},{'type':'keyValue','content':'','key':_0xbdcc('0x1b'),'keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x1c')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x1d'),'keyType':_0xbdcc('0x7'),'variableName':_0xbdcc('0x1e')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0xbdcc('0x1f')}];break;case _0xbdcc('0x9'):_0x386ec2=[{'type':_0xbdcc('0x1'),'content':_0xbdcc('0xc'),'variableName':null},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x20'),'keyType':'variable','keyContent':'','variableName':_0xbdcc('0x21')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x22'),'keyType':'variable','keyContent':'','variableName':_0xbdcc('0x23')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x24'),'keyType':_0xbdcc('0x7'),'keyContent':'','variableName':_0xbdcc('0x14')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x15'),'keyType':_0xbdcc('0x7'),'keyContent':'','variableName':_0xbdcc('0x25')},{'type':_0xbdcc('0x1'),'content':_0xbdcc('0x18')},{'type':'keyValue','content':'','key':_0xbdcc('0x26'),'keyType':'variable','keyContent':'','variableName':_0xbdcc('0x27')},{'type':'keyValue','content':'','key':_0xbdcc('0x28'),'keyType':'variable','keyContent':'','variableName':_0xbdcc('0x29')},{'type':_0xbdcc('0xd'),'content':'','key':'Duration','keyType':_0xbdcc('0x7'),'keyContent':'','variableName':_0xbdcc('0x2a')},{'type':_0xbdcc('0xd'),'content':'','key':_0xbdcc('0x2b'),'keyType':_0xbdcc('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x386ec2;}; \ No newline at end of file +var _0xfe9b=['string','[xCALLY\x20Ticket]','toLowerCase','voice','variable','queue','calleridnum','outbound','push','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','answertime','endtime','duration','billableseconds','getSubjects'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe9b,0x125));var _0xbfe9=function(_0x1ff98d,_0x4fbe4e){_0x1ff98d=_0x1ff98d-0x0;var _0x141980=_0xfe9b[_0x1ff98d];return _0x141980;};'use strict';exports[_0xbfe9('0x0')]=function(_0x1da9d7,_0x982de8){var _0x28840b=[{'type':_0xbfe9('0x1'),'content':_0xbfe9('0x2'),'variableName':null}];switch(_0x1da9d7[_0xbfe9('0x3')]()){case _0xbfe9('0x4'):switch(_0x982de8[_0xbfe9('0x3')]()){case'inbound':_0x28840b['push']({'type':_0xbfe9('0x5'),'content':'','variableName':_0xbfe9('0x6')});_0x28840b['push']({'type':_0xbfe9('0x5'),'content':'','variableName':_0xbfe9('0x7')});break;case _0xbfe9('0x8'):_0x28840b[_0xbfe9('0x9')]({'type':_0xbfe9('0x1'),'content':'Outbound\x20Call','variableName':null});_0x28840b[_0xbfe9('0x9')]({'type':_0xbfe9('0x5'),'content':'','variableName':_0xbfe9('0xa')});break;}}return _0x28840b;};exports[_0xbfe9('0xb')]=function(_0x12e58b,_0x5eb173){var _0x36e852=[];switch(_0x12e58b[_0xbfe9('0x3')]()){case'voice':switch(_0x5eb173['toLowerCase']()){case _0xbfe9('0xc'):_0x36e852=[{'type':_0xbfe9('0x1'),'content':_0xbfe9('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0xf'),'keyType':'variable','variableName':_0xbfe9('0x7')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x10'),'keyType':_0xbfe9('0x5'),'variableName':'calleridname'},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x11'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x12')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x13'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x6')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x14'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x15')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x16'),'keyType':'variable','variableName':_0xbfe9('0x17')},{'type':_0xbfe9('0x1'),'content':_0xbfe9('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbfe9('0x19'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x1a')},{'type':'keyValue','content':'','key':_0xbfe9('0x1b'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0xa')},{'type':'string','content':_0xbfe9('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x1d'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x17')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x1e'),'keyType':'variable','variableName':_0xbfe9('0x1f')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x20'),'keyType':_0xbfe9('0x5'),'variableName':'agentcompleteAt'},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x21'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x22')},{'type':'keyValue','content':'','key':_0xbfe9('0x23'),'keyType':_0xbfe9('0x5'),'variableName':_0xbfe9('0x24')}];break;case _0xbfe9('0x8'):_0x36e852=[{'type':_0xbfe9('0x1'),'content':_0xbfe9('0xd'),'variableName':null},{'type':_0xbfe9('0xe'),'content':'','key':'Called\x20Number','keyType':_0xbfe9('0x5'),'keyContent':'','variableName':_0xbfe9('0xa')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x25'),'keyType':_0xbfe9('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x14'),'keyType':'variable','keyContent':'','variableName':_0xbfe9('0x15')},{'type':_0xbfe9('0xe'),'content':'','key':_0xbfe9('0x16'),'keyType':_0xbfe9('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0xbfe9('0x1'),'content':_0xbfe9('0x1c')},{'type':_0xbfe9('0xe'),'content':'','key':'Answer\x20Time','keyType':_0xbfe9('0x5'),'keyContent':'','variableName':_0xbfe9('0x26')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xbfe9('0x27')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xbfe9('0x5'),'keyContent':'','variableName':_0xbfe9('0x28')},{'type':_0xbfe9('0xe'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0xbfe9('0x29')}];break;}}return _0x36e852;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index fc19005..23cd54e 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdee=['user','clone','body','omit','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','error'];(function(_0x18b793,_0x113e94){var _0x152986=function(_0x1ce2d8){while(--_0x1ce2d8){_0x18b793['push'](_0x18b793['shift']());}};_0x152986(++_0x113e94);}(_0xfdee,0xf6));var _0xefde=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0xfdee[_0x160248];return _0x4e589d;};'use strict';var _=require(_0xefde('0x0'));var db=require(_0xefde('0x1'))['db'];var loggers={'openchannel':require(_0xefde('0x2'))(_0xefde('0x3')),'mail':require(_0xefde('0x2'))(_0xefde('0x4')),'fax':require(_0xefde('0x2'))(_0xefde('0x5')),'sms':require(_0xefde('0x2'))(_0xefde('0x6')),'chat':require(_0xefde('0x2'))(_0xefde('0x7')),'whatsapp':require(_0xefde('0x2'))(_0xefde('0x8'))};function getInteractionId(_0x539b2f,_0x5c5ce7,_0x2617c0){if(_0x539b2f&&_0x539b2f[_[_0xefde('0x9')](_0x2617c0)+_0xefde('0xa')]){return _0x539b2f[_[_0xefde('0x9')](_0x2617c0)+_0xefde('0xa')];}else if(_0x539b2f&&_0x539b2f['id']){return _0x539b2f['id'];}else if(_0x5c5ce7&&_0x5c5ce7['id']){return _0x5c5ce7['id'];}else{return _0xefde('0xb');}}function log(_0x5b052f,_0x5f5cf8,_0x1a7b0b,_0x528e56,_0x10e4e4,_0x3e3139){loggers[_0x10e4e4[_0xefde('0xc')]()][_0x5b052f](_0xefde('0xd'),_0x3e3139[_0xefde('0xe')](),_0x5f5cf8?_0x5f5cf8['id']:null,_0x5f5cf8?_0x5f5cf8['name']:null,_0x5f5cf8?_0x5f5cf8[_0xefde('0xf')]:null,getInteractionId(_0x1a7b0b,_0x528e56,_0x10e4e4),_0x1a7b0b?JSON[_0xefde('0x10')](_0x1a7b0b):_0xefde('0x11'));}function updateUser(_0x4bf7ad,_0x79997f,_0x20a42e,_0x4b2fda,_0x2c3679){db[_[_0xefde('0x9')](_0x4b2fda)+_0xefde('0x12')][_0xefde('0x13')]({'where':{'id':getInteractionId(_0x79997f,_0x20a42e,_0x4b2fda)}})[_0xefde('0x14')](function(_0x45c85e){if(_0x45c85e){return _0x45c85e[_0xefde('0x15')]({'UserId':_0x4bf7ad?_0x4bf7ad['id']:null});}})[_0xefde('0x14')](function(_0x52c5ba){if(_0x52c5ba){log(_0xefde('0x16'),_0x4bf7ad,_0x79997f,_0x20a42e,_0x4b2fda,_0x2c3679);}})['catch'](function(){log(_0xefde('0x17'),_0x4bf7ad,_0x79997f,_0x20a42e,_0x4b2fda,_0x2c3679);});}exports['tracked']=function(_0x41130b,_0x30ce57){return function(_0x43e96e,_0x1da8c7,_0x188a67){var _0x341478=_0x43e96e[_0xefde('0x18')];var _0x5362d7={};var _0x3fef9b=_0x43e96e['query'];if(_0x5362d7){_0x5362d7=_[_0xefde('0x19')](_0x43e96e[_0xefde('0x1a')]);_0x5362d7=_[_0xefde('0x1b')](_0x5362d7,[_0xefde('0x1a'),'html','phone',_0xefde('0x1c'),_0xefde('0x1d')]);}updateUser(_0x341478,_0x5362d7,_0x3fef9b,_0x41130b,_0x30ce57);_0x188a67(null);};}; \ No newline at end of file +var _0xe8ef=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','toLowerCase','role','stringify','null','Interaction','then','update','info','catch','tracked','query','body','omit','html','fax','mobile','lodash','../../mysqldb'];(function(_0x2a453b,_0x54de96){var _0x124772=function(_0x537298){while(--_0x537298){_0x2a453b['push'](_0x2a453b['shift']());}};_0x124772(++_0x54de96);}(_0xe8ef,0xd6));var _0xfe8e=function(_0x403ffc,_0x538e09){_0x403ffc=_0x403ffc-0x0;var _0x3f2219=_0xe8ef[_0x403ffc];return _0x3f2219;};'use strict';var _=require(_0xfe8e('0x0'));var db=require(_0xfe8e('0x1'))['db'];var loggers={'openchannel':require(_0xfe8e('0x2'))(_0xfe8e('0x3')),'mail':require(_0xfe8e('0x2'))(_0xfe8e('0x4')),'fax':require('../../config/logger')(_0xfe8e('0x5')),'sms':require(_0xfe8e('0x2'))(_0xfe8e('0x6')),'chat':require('../../config/logger')(_0xfe8e('0x7')),'whatsapp':require(_0xfe8e('0x2'))(_0xfe8e('0x8'))};function getInteractionId(_0x5a72ba,_0x2a529f,_0x1e6e63){if(_0x5a72ba&&_0x5a72ba[_['upperFirst'](_0x1e6e63)+_0xfe8e('0x9')]){return _0x5a72ba[_[_0xfe8e('0xa')](_0x1e6e63)+_0xfe8e('0x9')];}else if(_0x5a72ba&&_0x5a72ba['id']){return _0x5a72ba['id'];}else if(_0x2a529f&&_0x2a529f['id']){return _0x2a529f['id'];}else{return'unknown';}}function log(_0x1fb43f,_0x2bbe0a,_0x1a3c87,_0x5190ca,_0x2721f7,_0x3abb13){loggers[_0x2721f7[_0xfe8e('0xb')]()][_0x1fb43f]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3abb13['toUpperCase'](),_0x2bbe0a?_0x2bbe0a['id']:null,_0x2bbe0a?_0x2bbe0a['name']:null,_0x2bbe0a?_0x2bbe0a[_0xfe8e('0xc')]:null,getInteractionId(_0x1a3c87,_0x5190ca,_0x2721f7),_0x1a3c87?JSON[_0xfe8e('0xd')](_0x1a3c87):_0xfe8e('0xe'));}function updateUser(_0x523cec,_0x464bd3,_0x2c2fed,_0x6d17a0,_0x122844){db[_['upperFirst'](_0x6d17a0)+_0xfe8e('0xf')]['findOne']({'where':{'id':getInteractionId(_0x464bd3,_0x2c2fed,_0x6d17a0)}})[_0xfe8e('0x10')](function(_0x2df240){if(_0x2df240){return _0x2df240[_0xfe8e('0x11')]({'UserId':_0x523cec?_0x523cec['id']:null});}})['then'](function(_0x33412f){if(_0x33412f){log(_0xfe8e('0x12'),_0x523cec,_0x464bd3,_0x2c2fed,_0x6d17a0,_0x122844);}})[_0xfe8e('0x13')](function(){log('error',_0x523cec,_0x464bd3,_0x2c2fed,_0x6d17a0,_0x122844);});}exports[_0xfe8e('0x14')]=function(_0x49b8e0,_0x4acac4){return function(_0x2dbdf1,_0x549f0a,_0x991561){var _0x130eb6=_0x2dbdf1['user'];var _0x2a2831={};var _0x279de0=_0x2dbdf1[_0xfe8e('0x15')];if(_0x2a2831){_0x2a2831=_['clone'](_0x2dbdf1[_0xfe8e('0x16')]);_0x2a2831=_[_0xfe8e('0x17')](_0x2a2831,['body',_0xfe8e('0x18'),'phone',_0xfe8e('0x19'),_0xfe8e('0x1a')]);}updateUser(_0x130eb6,_0x2a2831,_0x279de0,_0x49b8e0,_0x4acac4);_0x991561(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 6414e03..5688695 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 _0x67d9=['crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit'];(function(_0x31de18,_0x1bf7cb){var _0x1a15c2=function(_0xdf3939){while(--_0xdf3939){_0x31de18['push'](_0x31de18['shift']());}};_0x1a15c2(++_0x1bf7cb);}(_0x67d9,0x16c));var _0x967d=function(_0x466900,_0x3aba67){_0x466900=_0x466900-0x0;var _0xba8555=_0x67d9[_0x466900];return _0xba8555;};'use strict';var crypto=require(_0x967d('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x967d('0x1'))['db'];var config=require(_0x967d('0x2'));function getValueFromLicense(_0x42964b,_0x683907){if(_0x42964b&&_0x683907){if(_0x683907[_0x967d('0x3')]&&_0x683907[_0x967d('0x4')]){var _0x27e272=_0x683907[_0x967d('0x3')];var _0x1c2681=_0x683907[_0x967d('0x4')];var _0x106c1a=_0x27e272['split']('-')[0x4];var _0x1222ee=_0x27e272[_0x967d('0x5')]('-')[0x0];var _0xc6d27c=crypto[_0x967d('0x6')](_0x967d('0x7'),util[_0x967d('0x8')]('%s:%s:%s',_0x106c1a,_0x27e272,_0x1222ee));var _0x115833=_0xc6d27c[_0x967d('0x9')](_0x1c2681,_0x967d('0xa'),_0x967d('0xb'));_0x115833+=_0xc6d27c['final'](_0x967d('0xb'));var _0x39f061=JSON[_0x967d('0xc')](_0x115833);return _0x39f061[_0x967d('0xd')](_0x42964b)?_0x39f061[_0x42964b]:null;}}return null;}function isLimit(_0x223c98,_0x203d44,_0x2b2706,_0x83ffe){var _0x2d4105=_0x203d44;return compose()[_0x967d('0xe')](function(_0x290d67,_0x3df0d7,_0x233282){return db['License'][_0x967d('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x967d('0x10')](function(_0x6e39d1){var _0x5c45dc=getValueFromLicense(_0x223c98,_0x6e39d1);return _0x5c45dc?_0x5c45dc:_0x2d4105;})[_0x967d('0x10')](function(_0x2c6ab3){_0x2d4105=_0x2c6ab3;return _0x2b2706[_0x967d('0x11')](_0x83ffe);})[_0x967d('0x10')](function(_0x28daaf){if(_0x28daaf>=_0x2d4105){return _0x3df0d7[_0x967d('0x12')](0x193)[_0x967d('0x13')]({'message':util['format'](_0x967d('0x14'),_0x223c98)});}_0x233282();})[_0x967d('0x15')](function(_0x28b2ff){_0x233282(_0x28b2ff);});});}function isUserLimit(){return isLimit(_0x967d('0x16'),0x1,db[_0x967d('0x17')],{'where':{'$or':[{'role':_0x967d('0x18')},{'role':'user'}]}});}exports[_0x967d('0x19')]=isUserLimit; \ No newline at end of file +var _0x3a39=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util'];(function(_0x50a6d2,_0x41545d){var _0x52d520=function(_0x3de2ac){while(--_0x3de2ac){_0x50a6d2['push'](_0x50a6d2['shift']());}};_0x52d520(++_0x41545d);}(_0x3a39,0x9a));var _0x93a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3a39[_0x53ccf2];return _0x5a2964;};'use strict';var crypto=require('crypto');var util=require(_0x93a3('0x0'));var compose=require(_0x93a3('0x1'));var db=require(_0x93a3('0x2'))['db'];var config=require(_0x93a3('0x3'));function getValueFromLicense(_0x121248,_0x2e26cd){if(_0x121248&&_0x2e26cd){if(_0x2e26cd[_0x93a3('0x4')]&&_0x2e26cd[_0x93a3('0x5')]){var _0x1f15e9=_0x2e26cd[_0x93a3('0x4')];var _0x1b6711=_0x2e26cd[_0x93a3('0x5')];var _0x19df9a=_0x1f15e9[_0x93a3('0x6')]('-')[0x4];var _0x1a3249=_0x1f15e9['split']('-')[0x0];var _0x441c8b=crypto[_0x93a3('0x7')](_0x93a3('0x8'),util[_0x93a3('0x9')](_0x93a3('0xa'),_0x19df9a,_0x1f15e9,_0x1a3249));var _0x31d7c6=_0x441c8b[_0x93a3('0xb')](_0x1b6711,_0x93a3('0xc'),_0x93a3('0xd'));_0x31d7c6+=_0x441c8b[_0x93a3('0xe')]('utf8');var _0x1ecec8=JSON[_0x93a3('0xf')](_0x31d7c6);return _0x1ecec8[_0x93a3('0x10')](_0x121248)?_0x1ecec8[_0x121248]:null;}}return null;}function isLimit(_0x35a8fe,_0x247272,_0x47e169,_0x57c147){var _0x5a9043=_0x247272;return compose()[_0x93a3('0x11')](function(_0x4fe2f4,_0x5354a5,_0xc4df29){return db[_0x93a3('0x12')][_0x93a3('0x13')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x412200){var _0x11ef85=getValueFromLicense(_0x35a8fe,_0x412200);return _0x11ef85?_0x11ef85:_0x5a9043;})[_0x93a3('0x14')](function(_0x25be7d){_0x5a9043=_0x25be7d;return _0x47e169[_0x93a3('0x15')](_0x57c147);})[_0x93a3('0x14')](function(_0x1eed69){if(_0x1eed69>=_0x5a9043){return _0x5354a5[_0x93a3('0x16')](0x193)[_0x93a3('0x17')]({'message':util[_0x93a3('0x9')](_0x93a3('0x18'),_0x35a8fe)});}_0xc4df29();})[_0x93a3('0x19')](function(_0x549ba8){_0xc4df29(_0x549ba8);});});}function isUserLimit(){return isLimit(_0x93a3('0x1a'),0x1,db[_0x93a3('0x1b')],{'where':{'$or':[{'role':_0x93a3('0x1c')},{'role':_0x93a3('0x1d')}]}});}exports[_0x93a3('0x1e')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9eef89d..1ff8e14 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 _0xefed=['push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions'];(function(_0x544b32,_0x19ea4a){var _0x4b7867=function(_0x6ab868){while(--_0x6ab868){_0x544b32['push'](_0x544b32['shift']());}};_0x4b7867(++_0x19ea4a);}(_0xefed,0x126));var _0xdefe=function(_0x2a94cf,_0x2b970d){_0x2a94cf=_0x2a94cf-0x0;var _0x22147f=_0xefed[_0x2a94cf];return _0x22147f;};'use strict';var _=require(_0xdefe('0x0'));var moment=require(_0xdefe('0x1'));exports[_0xdefe('0x2')]=function(_0x12b203){var _0x309486={'conditions':[]};_0x309486[_0xdefe('0x3')]=_[_0xdefe('0x4')](_0x12b203,_0xdefe('0x5'))?'or':_0xdefe('0x6');var _0x3dcdbc=_0x12b203['replace'](_0xdefe('0x7'),'')['replace']('[$or]','')[_0xdefe('0x8')]('||');for(var _0x522ab1=0x0;_0x522ab1<_0x3dcdbc[_0xdefe('0x9')];_0x522ab1++){var _0x3f31bd=_0x3dcdbc[_0x522ab1]['split'](':=');var _0x3e7408=_0x3f31bd[0x0];var _0x26d01e=_0x3f31bd[_0xdefe('0xa')](0x1);_0x26d01e[_0xdefe('0xb')](function(_0x2be32c){var _0x9455d3=_0x2be32c[_0xdefe('0x8')]('[')[_0xdefe('0xc')]();var _0x1432a1=_0x2be32c[_0xdefe('0xd')](/\[(.*?)\]/g);_0x1432a1[_0xdefe('0xb')](function(_0x3d2ad4){var _0x11d5a0=_0x3d2ad4[_0xdefe('0x8')]('[')[_0xdefe('0xe')](function(_0x363ca3){return _0x363ca3[_0xdefe('0xf')](']')>-0x1;})[_0xdefe('0x10')](function(_0x50dadd){return _0x50dadd[_0xdefe('0x8')](']')[0x0];})[0x0];_0x309486[_0xdefe('0x11')][_0xdefe('0x12')]({'field':_0x3e7408,'operator':_0x9455d3,'value':_0x11d5a0});});});}return _0x309486;};exports[_0xdefe('0x13')]=function(_0x387b4a,_0x17a67a,_0x1685c8){var _0x4e6c73={};if(_0x17a67a===_0xdefe('0x14')){if(_0x1685c8[_0xdefe('0x15')]===_0xdefe('0x16')){_0x1685c8['operator']='$between';_0x1685c8[_0xdefe('0x17')]+=','+_0x1685c8['value'];}else if(_[_0xdefe('0x18')]([_0xdefe('0x19'),_0xdefe('0x1a')],_0x1685c8[_0xdefe('0x15')])){_0x1685c8[_0xdefe('0x17')]=moment(_0x1685c8[_0xdefe('0x17')])[_0xdefe('0x1b')](0x1,'days')[_0xdefe('0x1c')](_0xdefe('0x1d'));}}if(_0x1685c8['castTo']){_0x17a67a=_0x1685c8[_0xdefe('0x1e')];_0x4e6c73[_0xdefe('0x1f')]='CAST('+_0x387b4a+'.'+_0x1685c8['field']+_0xdefe('0x20')+_0x1685c8[_0xdefe('0x1e')]+')\x20'+parseOperator(_0x1685c8[_0xdefe('0x15')]);}else{_0x4e6c73[_0xdefe('0x1f')]=_0x387b4a+'.'+_0x1685c8['field']+'\x20'+parseOperator(_0x1685c8['operator']);}if(_[_0xdefe('0x18')]([_0xdefe('0x21'),_0xdefe('0x22')],_0x1685c8[_0xdefe('0x15')]))_0x4e6c73[_0xdefe('0x1f')]='('+_0x4e6c73[_0xdefe('0x1f')]+_0xdefe('0x23')+_0x387b4a+'.'+_0x1685c8['field']+'\x20IS\x20NULL)';_0x4e6c73[_0xdefe('0x17')]=parseValue(_0x17a67a,_0x1685c8['operator'],_0x1685c8[_0xdefe('0x17')]);return _0x4e6c73;};function parseOperator(_0x48c61d){var _0x2b1c2b;switch(_0x48c61d){case _0xdefe('0x24'):_0x2b1c2b='IN\x20?';break;case _0xdefe('0x22'):_0x2b1c2b=_0xdefe('0x25');break;case _0xdefe('0x16'):_0x2b1c2b=_0xdefe('0x26');break;case _0xdefe('0x21'):_0x2b1c2b='<>\x20?';break;case'$substring':case _0xdefe('0x27'):case _0xdefe('0x28'):_0x2b1c2b=_0xdefe('0x29');break;case _0xdefe('0x2a'):_0x2b1c2b=_0xdefe('0x2b');break;case _0xdefe('0x19'):_0x2b1c2b=_0xdefe('0x2c');break;case _0xdefe('0x1a'):_0x2b1c2b=_0xdefe('0x2d');break;case _0xdefe('0x2e'):_0x2b1c2b=_0xdefe('0x2f');break;case'$between':_0x2b1c2b=_0xdefe('0x30');break;}return _0x2b1c2b;}function parseValue(_0x37926b,_0x5e97c7,_0x281b41){var _0xeb7ff9={'start':undefined,'end':undefined};switch(_0x5e97c7){case _0xdefe('0x24'):case _0xdefe('0x22'):_0xeb7ff9[_0xdefe('0x31')]=_0x281b41[_0xdefe('0x8')](',');break;case'$substring':_0xeb7ff9[_0xdefe('0x31')]='%'+_0x281b41+'%';break;case'$startsWith':_0xeb7ff9[_0xdefe('0x31')]=_0x281b41+'%';break;case _0xdefe('0x28'):_0xeb7ff9['start']='%'+_0x281b41;break;case'$between':var _0x2329d7=_0x281b41['split'](',');var _0x281b41=_0x2329d7[_0xdefe('0xc')]();var _0x19245d=_0x2329d7['pop']();if(_0x37926b===_0xdefe('0x14')){_0x281b41=moment(_0x281b41)[_0xdefe('0x32')](0x0,!![])[_0xdefe('0x1c')]();_0x19245d=moment(_0x19245d)[_0xdefe('0x32')](0x0,!![])[_0xdefe('0x1b')](0x17,'hours')['add'](0x3b,'minutes')[_0xdefe('0x1b')](0x3b,_0xdefe('0x33'))[_0xdefe('0x1c')]();}_0xeb7ff9={'start':_0x281b41,'end':_0x19245d};break;default:_0xeb7ff9['start']=_0x281b41;break;}return _0xeb7ff9;} \ No newline at end of file +var _0xf9f2=['LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','format','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','length','split','slice','forEach','shift','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith'];(function(_0x2b8af8,_0x2e1296){var _0x5c4e07=function(_0x3c9c5c){while(--_0x3c9c5c){_0x2b8af8['push'](_0x2b8af8['shift']());}};_0x5c4e07(++_0x2e1296);}(_0xf9f2,0x14b));var _0x2f9f=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0xf9f2[_0x14cb58];return _0x5f097e;};'use strict';var _=require(_0x2f9f('0x0'));var moment=require(_0x2f9f('0x1'));exports['parseSearch']=function(_0x58a008){var _0x173c0b={'conditions':[]};_0x173c0b[_0x2f9f('0x2')]=_[_0x2f9f('0x3')](_0x58a008,_0x2f9f('0x4'))?'or':_0x2f9f('0x5');var _0x519854=_0x58a008['replace']('[$and]','')[_0x2f9f('0x6')]('[$or]','')['split']('||');for(var _0x530b87=0x0;_0x530b87<_0x519854[_0x2f9f('0x7')];_0x530b87++){var _0x2af5bf=_0x519854[_0x530b87][_0x2f9f('0x8')](':=');var _0x272172=_0x2af5bf[0x0];var _0x345d68=_0x2af5bf[_0x2f9f('0x9')](0x1);_0x345d68[_0x2f9f('0xa')](function(_0x5f51c3){var _0x2af59b=_0x5f51c3[_0x2f9f('0x8')]('[')[_0x2f9f('0xb')]();var _0x479d77=_0x5f51c3['match'](/\[(.*?)\]/g);_0x479d77['forEach'](function(_0x202b5b){var _0xe07336=_0x202b5b[_0x2f9f('0x8')]('[')['filter'](function(_0x37a7b8){return _0x37a7b8[_0x2f9f('0xc')](']')>-0x1;})[_0x2f9f('0xd')](function(_0xd3310c){return _0xd3310c[_0x2f9f('0x8')](']')[0x0];})[0x0];_0x173c0b['conditions'][_0x2f9f('0xe')]({'field':_0x272172,'operator':_0x2af59b,'value':_0xe07336});});});}return _0x173c0b;};exports[_0x2f9f('0xf')]=function(_0xbab5cd,_0xaf449d,_0x5e7a3d){var _0x86cf1a={};if(_0xaf449d===_0x2f9f('0x10')){if(_0x5e7a3d[_0x2f9f('0x11')]===_0x2f9f('0x12')){_0x5e7a3d[_0x2f9f('0x11')]=_0x2f9f('0x13');_0x5e7a3d[_0x2f9f('0x14')]+=','+_0x5e7a3d[_0x2f9f('0x14')];}else if(_['includes']([_0x2f9f('0x15'),'$lte'],_0x5e7a3d['operator'])){_0x5e7a3d['value']=moment(_0x5e7a3d[_0x2f9f('0x14')])[_0x2f9f('0x16')](0x1,_0x2f9f('0x17'))['format'](_0x2f9f('0x18'));}}if(_0x5e7a3d[_0x2f9f('0x19')]){_0xaf449d=_0x5e7a3d[_0x2f9f('0x19')];_0x86cf1a[_0x2f9f('0x1a')]=_0x2f9f('0x1b')+_0xbab5cd+'.'+_0x5e7a3d[_0x2f9f('0x1c')]+_0x2f9f('0x1d')+_0x5e7a3d[_0x2f9f('0x19')]+')\x20'+parseOperator(_0x5e7a3d[_0x2f9f('0x11')]);}else{_0x86cf1a['text']=_0xbab5cd+'.'+_0x5e7a3d[_0x2f9f('0x1c')]+'\x20'+parseOperator(_0x5e7a3d[_0x2f9f('0x11')]);}if(_[_0x2f9f('0x1e')]([_0x2f9f('0x1f'),'$notIn'],_0x5e7a3d[_0x2f9f('0x11')]))_0x86cf1a['text']='('+_0x86cf1a[_0x2f9f('0x1a')]+'\x20OR\x20'+_0xbab5cd+'.'+_0x5e7a3d[_0x2f9f('0x1c')]+_0x2f9f('0x20');_0x86cf1a[_0x2f9f('0x14')]=parseValue(_0xaf449d,_0x5e7a3d[_0x2f9f('0x11')],_0x5e7a3d[_0x2f9f('0x14')]);return _0x86cf1a;};function parseOperator(_0x1d9874){var _0x55c381;switch(_0x1d9874){case _0x2f9f('0x21'):_0x55c381=_0x2f9f('0x22');break;case'$notIn':_0x55c381='NOT\x20IN\x20?';break;case'$eq':_0x55c381=_0x2f9f('0x23');break;case _0x2f9f('0x1f'):_0x55c381=_0x2f9f('0x24');break;case _0x2f9f('0x25'):case _0x2f9f('0x26'):case _0x2f9f('0x27'):_0x55c381=_0x2f9f('0x28');break;case _0x2f9f('0x29'):_0x55c381=_0x2f9f('0x2a');break;case _0x2f9f('0x15'):_0x55c381=_0x2f9f('0x2b');break;case'$lte':_0x55c381=_0x2f9f('0x2c');break;case'$gte':_0x55c381='>=\x20?';break;case'$between':_0x55c381=_0x2f9f('0x2d');break;}return _0x55c381;}function parseValue(_0x3efc3e,_0x37c61f,_0x58bf83){var _0x552a9e={'start':undefined,'end':undefined};switch(_0x37c61f){case _0x2f9f('0x21'):case'$notIn':_0x552a9e['start']=_0x58bf83['split'](',');break;case'$substring':_0x552a9e['start']='%'+_0x58bf83+'%';break;case'$startsWith':_0x552a9e[_0x2f9f('0x2e')]=_0x58bf83+'%';break;case'$endsWith':_0x552a9e[_0x2f9f('0x2e')]='%'+_0x58bf83;break;case _0x2f9f('0x13'):var _0x188d43=_0x58bf83['split'](',');var _0x58bf83=_0x188d43[_0x2f9f('0xb')]();var _0x3e40ff=_0x188d43[_0x2f9f('0x2f')]();if(_0x3efc3e===_0x2f9f('0x10')){_0x58bf83=moment(_0x58bf83)['utcOffset'](0x0,!![])[_0x2f9f('0x30')]();_0x3e40ff=moment(_0x3e40ff)[_0x2f9f('0x31')](0x0,!![])['add'](0x17,_0x2f9f('0x32'))[_0x2f9f('0x16')](0x3b,_0x2f9f('0x33'))[_0x2f9f('0x16')](0x3b,_0x2f9f('0x34'))[_0x2f9f('0x30')]();}_0x552a9e={'start':_0x58bf83,'end':_0x3e40ff};break;default:_0x552a9e[_0x2f9f('0x2e')]=_0x58bf83;break;}return _0x552a9e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 39f092e..c8c733f 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 _0x44e8=['sort','map','indexOf','col','priority','unsigned','substr','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','fields','nolimit','filter','object','columns','value','where','lower','merge','options','lodash','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x44e8,0xd7));var _0x844e=function(_0x568867,_0x2c68e9){_0x568867=_0x568867-0x0;var _0x13c80e=_0x44e8[_0x568867];return _0x13c80e;};'use strict';var _=require(_0x844e('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5be7){var _0x21307e=['ne'];try{var _0x2afcef=JSON[_0x844e('0x1')](_0x1b5be7);var _0x49ce1b=Object[_0x844e('0x2')](_0x2afcef)[0x0];return _0x21307e[_0x844e('0x3')](_0x49ce1b);}catch(_0x2c8b9e){return![];}}function getOperatorValue(_0x446f47){var _0x5c8f67=JSON[_0x844e('0x1')](_0x446f47);var _0x238796=Object[_0x844e('0x2')](_0x5c8f67)[0x0];var _0x11cbd6=_0x5c8f67[_0x238796];return{['$'+_0x238796]:_0x11cbd6};}exports['fields']=function(_0x31ab50){var _0x7dff16=null;if(_0x31ab50){_0x7dff16=_0x31ab50[_0x844e('0x4')](',');}return _0x7dff16;};exports[_0x844e('0x5')]=function(_0x32c6c7,_0x1f9921){var _0x536601={};if(!_[_0x844e('0x6')](_0x32c6c7)){_[_0x844e('0x7')](_0x32c6c7,function(_0x183c7e,_0x285a64){try{if(_0x1f9921){var _0x14909f=_[_0x844e('0x8')](_0x1f9921,{'name':_0x285a64})||{};if(hasSequelizeOperator(_0x183c7e)){_0x536601[_0x285a64]=getOperatorValue(_0x183c7e);}else if(_0x14909f[_0x844e('0x9')]==='DATE'&&_[_0x844e('0xa')](_0x183c7e)){var _0x23df3f=JSON['parse'](_0x183c7e);var _0x3a09d0={'$gte':moment(moment(_0x23df3f[_0x844e('0xb')])['format'](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xe')](),'$lte':moment(moment(_0x23df3f['$lte'])[_0x844e('0xe')](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xf')](0x1,'s')[_0x844e('0xe')]()};_0x536601[_0x285a64]=_0x3a09d0;}else if(_0x14909f[_0x844e('0x10')]===_0x844e('0x11')){_0x536601[_0x285a64]=_0x183c7e;}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}catch(_0x3c307f){_0x536601[_0x285a64]=_0x183c7e['split'](',');}});}return _0x536601;};exports[_0x844e('0x13')]=function(_0x55bcd6){_0x55bcd6=parseInt(_0x55bcd6,0xa);if(!_0x55bcd6||_0x55bcd6<0x0){_0x55bcd6=LIMIT_VALUE;}return _0x55bcd6;};exports[_0x844e('0x14')]=function(_0x10739f){_0x10739f=parseInt(_0x10739f,0xa);if(!_0x10739f||_0x10739f<0x0){_0x10739f=0x0;}return _0x10739f;};exports[_0x844e('0x15')]=function(_0x410325){var _0x3ea7da,_0x2b58c7=null;if(_0x410325){_0x3ea7da=_0x410325[_0x844e('0x4')](',');_0x2b58c7=_[_0x844e('0x16')](_0x3ea7da,function(_0x4ffb86){if(_0x4ffb86[_0x844e('0x17')]('-')===0x0){return[_0x4ffb86==='priority'?sequelize['cast'](sequelize[_0x844e('0x18')](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86[_0x844e('0x1b')](0x1),'DESC'];}else{return[_0x4ffb86===_0x844e('0x19')?sequelize[_0x844e('0x1c')](sequelize['col'](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86,_0x844e('0x1d')];}});}return _0x2b58c7;};exports[_0x844e('0x1e')]=function(_0x35236b,_0x3a65fc){if(_['isEmpty'](_0x35236b)){return _0x35236b;}if(_[_0x844e('0x12')](_0x35236b)){for(var _0xadf0d8=0x0;_0xadf0d8<_0x35236b[_0x844e('0x1f')];_0xadf0d8+=0x1){_0x35236b[_0xadf0d8]=this[_0x844e('0x1e')](_0x35236b[_0xadf0d8],_0x3a65fc);}return _0x35236b;}if(!_[_0x844e('0x20')](_0x35236b)){return _0x35236b;}if(_['isString'](_0x3a65fc)){_0x3a65fc=[_0x3a65fc];}if(!_[_0x844e('0x12')](_0x3a65fc)){return _0x35236b;}for(var _0x5080c1=0x0;_0x5080c1<_0x3a65fc['length'];_0x5080c1+=0x1){_[_0x844e('0x21')](_0x35236b,_0x3a65fc[_0x5080c1]);}for(var _0x130d87 in _0x35236b){if(_0x35236b[_0x844e('0x22')](_0x130d87)){_0x35236b[_0x130d87]=this['omit'](_0x35236b[_0x130d87],_0x3a65fc);}}return _0x35236b;};exports[_0x844e('0x23')]=function(_0x2d4acd){return _0x2d4acd[_0x844e('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x844e('0x25')]=function(_0x81d4de){return _0x81d4de[_0x844e('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x844e('0x26')]=function(_0x454b68){var _0x799cde=[];_0x454b68[_0x844e('0x4')](/[ ,]+/)[_0x844e('0x27')](function(_0x618bf6){_0x618bf6=_0x618bf6[_0x844e('0x28')](/([^:]")"+/g,'$1');_0x618bf6='+'+_0x618bf6+'*';var _0x550240=/[ `!@#$%^&*()_\-?~]/;if(_0x618bf6[_0x844e('0x24')](_0x550240))_0x618bf6='\x22'+_0x618bf6+'\x22';_0x799cde[_0x844e('0x29')](_0x618bf6);});return _0x799cde[_0x844e('0x2a')]('\x20');};exports[_0x844e('0x2b')]=function(_0x43ae36,_0x31754e,_0x27e5b3){var _0x55c488={},_0x26d6f2={};if(_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')]){_0x31754e['query']['id']=_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')];delete _0x31754e['query'][_0x844e('0x2d')];}_0x55c488[_0x844e('0x2e')]=_['map'](_0x43ae36,_0x844e('0x10'));_0x55c488[_0x844e('0x2c')]=_[_0x844e('0x2')](_0x31754e[_0x844e('0x2c')]);_0x55c488[_0x844e('0x5')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],_0x55c488['query']);_0x26d6f2[_0x844e('0x30')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],this[_0x844e('0x31')](_0x31754e[_0x844e('0x2c')][_0x844e('0x31')]));_0x26d6f2[_0x844e('0x30')]=_0x26d6f2[_0x844e('0x30')][_0x844e('0x1f')]?_0x26d6f2[_0x844e('0x30')]:_0x55c488[_0x844e('0x2e')];if(!_0x31754e['query']['hasOwnProperty'](_0x844e('0x32'))){_0x26d6f2[_0x844e('0x13')]=this[_0x844e('0x13')](_0x31754e[_0x844e('0x2c')][_0x844e('0x13')]);_0x26d6f2[_0x844e('0x14')]=this[_0x844e('0x14')](_0x31754e[_0x844e('0x2c')][_0x844e('0x14')]);}_0x26d6f2['order']=this[_0x844e('0x15')](_0x31754e['query'][_0x844e('0x15')]);_0x26d6f2['where']=this[_0x844e('0x5')](_['pick'](_0x31754e[_0x844e('0x2c')],_0x55c488[_0x844e('0x5')]),_0x43ae36);if(_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]){var _0x2eb412=_0x43ae36;var _0x3b4c9e=_0x31754e[_0x844e('0x2c')][_0x844e('0x33')];if(typeof _0x3b4c9e===_0x844e('0x34')){_0x2eb412=_[_0x844e('0x33')](_0x43ae36,function(_0x3bdf19){return _['includes'](_0x3b4c9e[_0x844e('0x35')],_0x3bdf19[_0x844e('0x10')]);});_0x3b4c9e=_0x3b4c9e[_0x844e('0x36')];}_0x26d6f2['where']=_['merge'](_0x26d6f2[_0x844e('0x37')],{'$or':_[_0x844e('0x16')](_0x2eb412,function(_0x1a7817){if(_0x1a7817['type']!=='VIRTUAL'){if(_0x27e5b3){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x844e('0x18')](_0x1a7817[_0x844e('0x10')])),{'$like':sequelize['fn'](_0x844e('0x38'),'%'+_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]+'%')});}else{var _0x4c756b={};_0x4c756b[_0x1a7817[_0x844e('0x10')]]={'$like':'%'+_0x31754e['query']['filter']+'%'};return _0x4c756b;}}})});}_0x26d6f2=_[_0x844e('0x39')]({},_0x26d6f2,_0x31754e[_0x844e('0x3a')]);return _0x26d6f2;}; \ No newline at end of file +var _0xd6d6=['merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','getOptions','$id','query','model','name','filters','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','value'];(function(_0xb92ed6,_0x3c5d53){var _0x4ff6ae=function(_0x5dab92){while(--_0x5dab92){_0xb92ed6['push'](_0xb92ed6['shift']());}};_0x4ff6ae(++_0x3c5d53);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x50e3e1,_0x3de497){_0x50e3e1=_0x50e3e1-0x0;var _0x29563a=_0xd6d6[_0x50e3e1];return _0x29563a;};'use strict';var _=require(_0x6d6d('0x0'));var sequelize=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33226e){var _0x536523=['ne'];try{var _0x2e1aed=JSON[_0x6d6d('0x3')](_0x33226e);var _0x1b8610=Object[_0x6d6d('0x4')](_0x2e1aed)[0x0];return _0x536523[_0x6d6d('0x5')](_0x1b8610);}catch(_0x16e259){return![];}}function getOperatorValue(_0x35a813){var _0x5702dc=JSON[_0x6d6d('0x3')](_0x35a813);var _0x1bf731=Object[_0x6d6d('0x4')](_0x5702dc)[0x0];var _0x18f824=_0x5702dc[_0x1bf731];return{['$'+_0x1bf731]:_0x18f824};}exports[_0x6d6d('0x6')]=function(_0x408f88){var _0x3e69a4=null;if(_0x408f88){_0x3e69a4=_0x408f88['split'](',');}return _0x3e69a4;};exports['filters']=function(_0x404c88,_0x1fa46d){var _0x23b18a={};if(!_[_0x6d6d('0x7')](_0x404c88)){_[_0x6d6d('0x8')](_0x404c88,function(_0x576c88,_0x1f2b86){try{if(_0x1fa46d){var _0x158f82=_['find'](_0x1fa46d,{'name':_0x1f2b86})||{};if(hasSequelizeOperator(_0x576c88)){_0x23b18a[_0x1f2b86]=getOperatorValue(_0x576c88);}else if(_0x158f82['type']===_0x6d6d('0x9')&&_[_0x6d6d('0xa')](_0x576c88)){var _0xe61c36=JSON[_0x6d6d('0x3')](_0x576c88);var _0x2b74ed={'$gte':moment(moment(_0xe61c36[_0x6d6d('0xb')])[_0x6d6d('0xc')](_0x6d6d('0xd')))['utc']()[_0x6d6d('0xc')](),'$lte':moment(moment(_0xe61c36[_0x6d6d('0xe')])[_0x6d6d('0xc')](_0x6d6d('0xd')))[_0x6d6d('0xf')]()['subtract'](0x1,'s')[_0x6d6d('0xc')]()};_0x23b18a[_0x1f2b86]=_0x2b74ed;}else if(_0x158f82['name']===_0x6d6d('0x10')){_0x23b18a[_0x1f2b86]=_0x576c88;}else{_0x23b18a[_0x1f2b86]=_[_0x6d6d('0x11')](_0x576c88)?_0x576c88:JSON[_0x6d6d('0x3')](_0x576c88);}}else{_0x23b18a[_0x1f2b86]=_['isArray'](_0x576c88)?_0x576c88:JSON['parse'](_0x576c88);}}catch(_0x9e1e18){_0x23b18a[_0x1f2b86]=_0x576c88[_0x6d6d('0x12')](',');}});}return _0x23b18a;};exports[_0x6d6d('0x13')]=function(_0x2c5314){_0x2c5314=parseInt(_0x2c5314,0xa);if(!_0x2c5314||_0x2c5314<0x0){_0x2c5314=LIMIT_VALUE;}return _0x2c5314;};exports['offset']=function(_0x554392){_0x554392=parseInt(_0x554392,0xa);if(!_0x554392||_0x554392<0x0){_0x554392=0x0;}return _0x554392;};exports[_0x6d6d('0x14')]=function(_0x5a5855){var _0x26f631,_0xb8590d=null;if(_0x5a5855){_0x26f631=_0x5a5855[_0x6d6d('0x12')](',');_0xb8590d=_[_0x6d6d('0x15')](_0x26f631,function(_0x40d35b){if(_0x40d35b[_0x6d6d('0x16')]('-')===0x0){return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),_0x6d6d('0x1a')):_0x40d35b[_0x6d6d('0x1b')](0x1),_0x6d6d('0x1c')];}else{return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),'unsigned'):_0x40d35b,_0x6d6d('0x1d')];}});}return _0xb8590d;};exports[_0x6d6d('0x1e')]=function(_0x99f7d6,_0x97ec9e){if(_[_0x6d6d('0x7')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x11')](_0x99f7d6)){for(var _0x554f8e=0x0;_0x554f8e<_0x99f7d6[_0x6d6d('0x1f')];_0x554f8e+=0x1){_0x99f7d6[_0x554f8e]=this[_0x6d6d('0x1e')](_0x99f7d6[_0x554f8e],_0x97ec9e);}return _0x99f7d6;}if(!_[_0x6d6d('0x20')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x21')](_0x97ec9e)){_0x97ec9e=[_0x97ec9e];}if(!_[_0x6d6d('0x11')](_0x97ec9e)){return _0x99f7d6;}for(var _0x408f98=0x0;_0x408f98<_0x97ec9e[_0x6d6d('0x1f')];_0x408f98+=0x1){_['unset'](_0x99f7d6,_0x97ec9e[_0x408f98]);}for(var _0x298408 in _0x99f7d6){if(_0x99f7d6[_0x6d6d('0x22')](_0x298408)){_0x99f7d6[_0x298408]=this['omit'](_0x99f7d6[_0x298408],_0x97ec9e);}}return _0x99f7d6;};exports['isNumeric']=function(_0x3edcce){return _0x3edcce[_0x6d6d('0x23')](RegExp(_0x6d6d('0x24')))?!![]:![];};exports['isEmail']=function(_0xde3272){return _0xde3272[_0x6d6d('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x6d6d('0x25')]=function(_0x1c8340){var _0x64d1f7=[];_0x1c8340[_0x6d6d('0x12')](/[ ,]+/)[_0x6d6d('0x26')](function(_0x359cfd){_0x359cfd=_0x359cfd[_0x6d6d('0x27')](/([^:]")"+/g,'$1');_0x359cfd='+'+_0x359cfd+'*';var _0x34050a=/[ `!@#$%^&*()_\-?~]/;if(_0x359cfd['match'](_0x34050a))_0x359cfd='\x22'+_0x359cfd+'\x22';_0x64d1f7[_0x6d6d('0x28')](_0x359cfd);});return _0x64d1f7['join']('\x20');};exports[_0x6d6d('0x29')]=function(_0x1ea9b2,_0xf527da,_0x2814ed){var _0x5c6248={},_0x182441={};if(_0xf527da['query'][_0x6d6d('0x2a')]){_0xf527da[_0x6d6d('0x2b')]['id']=_0xf527da['query'][_0x6d6d('0x2a')];delete _0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x2a')];}_0x5c6248[_0x6d6d('0x2c')]=_[_0x6d6d('0x15')](_0x1ea9b2,_0x6d6d('0x2d'));_0x5c6248[_0x6d6d('0x2b')]=_[_0x6d6d('0x4')](_0xf527da[_0x6d6d('0x2b')]);_0x5c6248[_0x6d6d('0x2e')]=_[_0x6d6d('0x2f')](_0x5c6248[_0x6d6d('0x2c')],_0x5c6248[_0x6d6d('0x2b')]);_0x182441[_0x6d6d('0x30')]=_['intersection'](_0x5c6248[_0x6d6d('0x2c')],this[_0x6d6d('0x6')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x6')]));_0x182441['attributes']=_0x182441['attributes'][_0x6d6d('0x1f')]?_0x182441[_0x6d6d('0x30')]:_0x5c6248[_0x6d6d('0x2c')];if(!_0xf527da['query'][_0x6d6d('0x22')](_0x6d6d('0x31'))){_0x182441[_0x6d6d('0x13')]=this[_0x6d6d('0x13')](_0xf527da['query']['limit']);_0x182441['offset']=this[_0x6d6d('0x32')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x32')]);}_0x182441[_0x6d6d('0x33')]=this['sort'](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x14')]);_0x182441[_0x6d6d('0x34')]=this[_0x6d6d('0x2e')](_[_0x6d6d('0x35')](_0xf527da[_0x6d6d('0x2b')],_0x5c6248['filters']),_0x1ea9b2);if(_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]){var _0x42aff0=_0x1ea9b2;var _0x1f4160=_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')];if(typeof _0x1f4160===_0x6d6d('0x37')){_0x42aff0=_['filter'](_0x1ea9b2,function(_0x2d5cdd){return _[_0x6d6d('0x5')](_0x1f4160[_0x6d6d('0x38')],_0x2d5cdd[_0x6d6d('0x2d')]);});_0x1f4160=_0x1f4160[_0x6d6d('0x39')];}_0x182441['where']=_[_0x6d6d('0x3a')](_0x182441[_0x6d6d('0x34')],{'$or':_['map'](_0x42aff0,function(_0x452de2){if(_0x452de2['type']!==_0x6d6d('0x3b')){if(_0x2814ed){return sequelize[_0x6d6d('0x34')](sequelize['fn']('lower',sequelize[_0x6d6d('0x19')](_0x452de2[_0x6d6d('0x2d')])),{'$like':sequelize['fn'](_0x6d6d('0x3c'),'%'+_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]+'%')});}else{var _0x513506={};_0x513506[_0x452de2['name']]={'$like':'%'+_0xf527da[_0x6d6d('0x2b')]['filter']+'%'};return _0x513506;}}})});}_0x182441=_['merge']({},_0x182441,_0xf527da[_0x6d6d('0x3d')]);return _0x182441;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 134ab99..4703655 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1fc82b,_0x5150a6){var _0x4c6679=function(_0x1d97dd){while(--_0x1d97dd){_0x1fc82b['push'](_0x1fc82b['shift']());}};_0x4c6679(++_0x5150a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3042d5,_0x349534){var _0x1acfef=function(_0x5a920f){while(--_0x5a920f){_0x3042d5['push'](_0x3042d5['shift']());}};_0x1acfef(++_0x349534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1d61a5b..cf33864 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 _0x7443=['bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','model','join','createHash','md5','update','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','digest','hex','substring','lodash','crypto'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x7443,0x1a2));var _0x3744=function(_0x28658e,_0xa95dc2){_0x28658e=_0x28658e-0x0;var _0x282373=_0x7443[_0x28658e];return _0x282373;};'use strict';var _=require(_0x3744('0x0'));var os=require('os');var crypto=require(_0x3744('0x1'));var machine=require(_0x3744('0x2'));var exec=require('child_process')[_0x3744('0x3')];var config=require(_0x3744('0x4'));function getInterfaces(){var _0x3e7260=[];var _0x518bbc=os[_0x3744('0x5')]();var _0x350505=_['orderBy'](_[_0x3744('0x6')](_0x518bbc));for(var _0x4020fd=0x0;_0x4020fd<_0x350505[_0x3744('0x7')];_0x4020fd++){var _0x304eb4=_0x518bbc[_0x350505[_0x4020fd]][_0x3744('0x8')](function(_0x12ca59){return _0x12ca59[_0x3744('0x9')]===_0x3744('0xa')&&_0x12ca59['internal']===![];});_0x3e7260=_0x3e7260[_0x3744('0xb')](_0x304eb4);}return _0x3e7260;}function getFirstInterface(){var _0x1cba8f=_[_0x3744('0xc')](getInterfaces());return{'macAddress':_0x1cba8f&&_0x1cba8f[_0x3744('0xd')]?_0x1cba8f['mac']:_0x3744('0xe'),'ipAddress':_0x1cba8f&&_0x1cba8f['address']?_0x1cba8f[_0x3744('0xf')]:_0x3744('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4696d7=_[_0x3744('0x11')](os[_0x3744('0x12')]()['map'](function(_0x5687f7){return _0x5687f7[_0x3744('0x13')];}))[_0x3744('0x14')](':');return crypto[_0x3744('0x15')](_0x3744('0x16'))[_0x3744('0x17')](_0x4696d7)['digest']('hex');}exports['getUuid']=function(){var _0x2e632b=os[_0x3744('0x18')]();var _0x494622=/[0-9a-f-]{36}/;if(config[_0x3744('0x19')]&&_0x494622[_0x3744('0x1a')](config[_0x3744('0x19')])){return config[_0x3744('0x19')];}else if(_0x2e632b===_0x3744('0x1b')){return exec(_0x3744('0x1c'),{'encoding':_0x3744('0x1d')})[_0x3744('0x1e')]('\x0d\x0a','');}else{var _0x7575c3=getFirstInterface();var _0x37ab85=getCPUhash();var _0x3bef88=_0x37ab85+'|'+os[_0x3744('0x1f')]()+'|'+_0x7575c3['macAddress']+'|'+_0x7575c3['ipAddress'];var _0x551403=crypto[_0x3744('0x15')]('md5')[_0x3744('0x17')](_0x3bef88)[_0x3744('0x20')](_0x3744('0x21'));return _0x551403[_0x3744('0x22')](0x0,0x8)+'-'+_0x551403['substring'](0x8,0xc)+'-'+_0x551403[_0x3744('0x22')](0xc,0x10)+'-'+_0x551403[_0x3744('0x22')](0x10,0x14)+'-'+_0x551403[_0x3744('0x22')](0x14);}}; \ No newline at end of file +var _0x1f5c=['127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','update','digest','substring','lodash','crypto','execSync','../environment','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x442402,_0x3b611e){var _0x510a27=function(_0x2f64c9){while(--_0x2f64c9){_0x442402['push'](_0x442402['shift']());}};_0x510a27(++_0x3b611e);}(_0x1f5c,0x1b8));var _0xc1f5=function(_0x5653dd,_0x1c10c1){_0x5653dd=_0x5653dd-0x0;var _0x48ba72=_0x1f5c[_0x5653dd];return _0x48ba72;};'use strict';var _=require(_0xc1f5('0x0'));var os=require('os');var crypto=require(_0xc1f5('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xc1f5('0x2')];var config=require(_0xc1f5('0x3'));function getInterfaces(){var _0x2293f7=[];var _0x362e17=os['networkInterfaces']();var _0x263463=_[_0xc1f5('0x4')](_[_0xc1f5('0x5')](_0x362e17));for(var _0x718c22=0x0;_0x718c22<_0x263463['length'];_0x718c22++){var _0x2d4e84=_0x362e17[_0x263463[_0x718c22]][_0xc1f5('0x6')](function(_0x23adff){return _0x23adff[_0xc1f5('0x7')]===_0xc1f5('0x8')&&_0x23adff[_0xc1f5('0x9')]===![];});_0x2293f7=_0x2293f7[_0xc1f5('0xa')](_0x2d4e84);}return _0x2293f7;}function getFirstInterface(){var _0x32ae51=_[_0xc1f5('0xb')](getInterfaces());return{'macAddress':_0x32ae51&&_0x32ae51[_0xc1f5('0xc')]?_0x32ae51[_0xc1f5('0xc')]:_0xc1f5('0xd'),'ipAddress':_0x32ae51&&_0x32ae51[_0xc1f5('0xe')]?_0x32ae51['address']:_0xc1f5('0xf')};}exports[_0xc1f5('0x10')]=getFirstInterface;function getCPUhash(){var _0x5c8be2=_[_0xc1f5('0x4')](os[_0xc1f5('0x11')]()[_0xc1f5('0x12')](function(_0x2519e1){return _0x2519e1[_0xc1f5('0x13')];}))['join'](':');return crypto[_0xc1f5('0x14')](_0xc1f5('0x15'))['update'](_0x5c8be2)['digest'](_0xc1f5('0x16'));}exports[_0xc1f5('0x17')]=function(){var _0x20d975=os[_0xc1f5('0x18')]();var _0x5a237d=/[0-9a-f-]{36}/;if(config[_0xc1f5('0x19')]&&_0x5a237d[_0xc1f5('0x1a')](config[_0xc1f5('0x19')])){return config[_0xc1f5('0x19')];}else if(_0x20d975==='win32'){return exec(_0xc1f5('0x1b'),{'encoding':'utf8'})[_0xc1f5('0x1c')]('\x0d\x0a','');}else{var _0x268d33=getFirstInterface();var _0xef23e=getCPUhash();var _0x1385bd=_0xef23e+'|'+os[_0xc1f5('0x1d')]()+'|'+_0x268d33[_0xc1f5('0x1e')]+'|'+_0x268d33[_0xc1f5('0x1f')];var _0x136ba8=crypto[_0xc1f5('0x14')]('md5')[_0xc1f5('0x20')](_0x1385bd)[_0xc1f5('0x21')](_0xc1f5('0x16'));return _0x136ba8[_0xc1f5('0x22')](0x0,0x8)+'-'+_0x136ba8[_0xc1f5('0x22')](0x8,0xc)+'-'+_0x136ba8[_0xc1f5('0x22')](0xc,0x10)+'-'+_0x136ba8[_0xc1f5('0x22')](0x10,0x14)+'-'+_0x136ba8['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9b3064f..8408e41 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 _0xbcea=['request-promise','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','decryptString','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util'];(function(_0x28c2ee,_0x3f644d){var _0x3ec29e=function(_0x565135){while(--_0x565135){_0x28c2ee['push'](_0x28c2ee['shift']());}};_0x3ec29e(++_0x3f644d);}(_0xbcea,0xd7));var _0xabce=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xbcea[_0x513545];return _0x18b7c5;};'use strict';var util=require(_0xabce('0x0'));var moment=require('moment');var rp=require(_0xabce('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xabce('0x2'))(module,'version');var db=require(_0xabce('0x3'))['db'];var encryptor=require(_0xabce('0x4'));var hardware=require(_0xabce('0x5'));var logger=require(_0xabce('0x6'))(_0xabce('0x7'));var HOST=_0xabce('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2daf3f){return new BPromise(function(_0x45ce8e,_0x1aff2b){var _0x2f77f3=util[_0xabce('0x9')](_0xabce('0xa'),HOST,_0x2daf3f,module[_0xabce('0xb')]['version']);if(oldToken){_0x2f77f3=util[_0xabce('0x9')](_0xabce('0xc'),HOST,_0x2daf3f,module[_0xabce('0xb')]['version'],oldToken);}var _0x383b34={'uri':_0x2f77f3,'method':_0xabce('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x383b34)[_0xabce('0xe')](function(_0x19d218){_0x45ce8e(_0x19d218);})[_0xabce('0xf')](function(_0x29867e){_0x1aff2b(_0x29867e);});});}function manageLicense(_0x34d0e1,_0x314f74){var _0x36057b=_0x314f74['get']({'plain':!![]});if(!isOldTokenSent&&_0x36057b[_0xabce('0x10')]!==_0x34d0e1&&!_0x36057b[_0xabce('0x11')]){oldToken=_0x36057b[_0xabce('0x10')];}httpRequest(_0x34d0e1)[_0xabce('0xe')](function(_0x282df4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x282df4[_0xabce('0x12')]){isOldTokenSent=![];if(!_0x36057b[_0xabce('0x7')]&&_0x36057b[_0xabce('0x7')]!=_0x282df4[_0xabce('0x7')]||_0x36057b[_0xabce('0x7')]&&_0x36057b[_0xabce('0x11')]){logger[_0xabce('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x36057b[_0xabce('0x7')]&&!_0x36057b[_0xabce('0x11')]&&_0x36057b[_0xabce('0x7')]!=_0x282df4[_0xabce('0x7')]){logger[_0xabce('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x36057b['license']&&!_0x36057b['data2']&&_0x36057b['license']==_0x282df4[_0xabce('0x7')]){return _0x314f74;}return _0x314f74['update']({'data1':_0x34d0e1,'data2':null,'license':_0x282df4[_0xabce('0x7')]});}else{if(_0x282df4[_0xabce('0x7')]||_0x36057b[_0xabce('0x7')]){if(!_0x36057b[_0xabce('0x11')]){if(_0x36057b['data1']==_0x34d0e1){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xabce('0x14'));}else{GRAY_PERIOD_REASON=_0xabce('0x15');logger['info'](_0xabce('0x16'),_0x36057b[_0xabce('0x10')],_0x34d0e1);}logger[_0xabce('0x13')](_0xabce('0x17'),GRAY_PERIOD_REASON[_0xabce('0x18')](),moment()['format'](_0xabce('0x19')));return _0x314f74[_0xabce('0x1a')]({'data2':encryptor[_0xabce('0x1b')](moment()[_0xabce('0x9')](_0xabce('0x19')))});}else{if(moment()['diff'](encryptor[_0xabce('0x1c')](_0x36057b[_0xabce('0x11')]),'days')>DAYS){logger[_0xabce('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0xabce('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x314f74['update']({'data1':_0x34d0e1,'data2':null,'license':null});}}}else{if(_0x36057b['data1']!=_0x34d0e1){logger[_0xabce('0x13')](_0xabce('0x16'),_0x36057b['data1'],_0x34d0e1);return _0x314f74['update']({'data1':_0x34d0e1,'data2':null,'license':null});}}}return _0x314f74;})[_0xabce('0xe')](function(_0x1c16cd){_0x314f74=_0x1c16cd;})[_0xabce('0xf')](function(_0x515743){logger['error'](_0x515743['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xabce('0x1d')](),_0x314f74);},TIME);});}function defaultLicense(){var _0x485302=hardware['getUuid']();if(_0x485302){return db[_0xabce('0x1e')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x485302}})[_0xabce('0x1f')](function(_0xa4f81c,_0x5c3791){logger[_0xabce('0x13')](_0xabce('0x20'),_0x485302);manageLicense(_0x485302,_0xa4f81c);})[_0xabce('0xf')](function(_0x36d51f){logger[_0xabce('0x21')](_0x36d51f[_0xabce('0x22')]);});}}exports[_0xabce('0x23')]=defaultLicense; \ No newline at end of file +var _0x7bf3=['request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','error','message','getUuid','License','findOrCreate','spread','default','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bf3,0x76));var _0x37bf=function(_0x93913c,_0x3121be){_0x93913c=_0x93913c-0x0;var _0x12d64c=_0x7bf3[_0x93913c];return _0x12d64c;};'use strict';var util=require(_0x37bf('0x0'));var moment=require(_0x37bf('0x1'));var rp=require(_0x37bf('0x2'));var BPromise=require(_0x37bf('0x3'));var pkginfo=require(_0x37bf('0x4'))(module,_0x37bf('0x5'));var db=require(_0x37bf('0x6'))['db'];var encryptor=require(_0x37bf('0x7'));var hardware=require(_0x37bf('0x8'));var logger=require(_0x37bf('0x9'))(_0x37bf('0xa'));var HOST=_0x37bf('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1cfef3){return new BPromise(function(_0x336170,_0x5980fb){var _0x1e67b7=util[_0x37bf('0xc')](_0x37bf('0xd'),HOST,_0x1cfef3,module[_0x37bf('0xe')][_0x37bf('0x5')]);if(oldToken){_0x1e67b7=util[_0x37bf('0xc')](_0x37bf('0xf'),HOST,_0x1cfef3,module[_0x37bf('0xe')][_0x37bf('0x5')],oldToken);}var _0x7b9297={'uri':_0x1e67b7,'method':_0x37bf('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x7b9297)[_0x37bf('0x11')](function(_0x1ab339){_0x336170(_0x1ab339);})[_0x37bf('0x12')](function(_0x3a0c37){_0x5980fb(_0x3a0c37);});});}function manageLicense(_0x1dd8b1,_0x431760){var _0x15bd65=_0x431760[_0x37bf('0x13')]({'plain':!![]});if(!isOldTokenSent&&_0x15bd65[_0x37bf('0x14')]!==_0x1dd8b1&&!_0x15bd65[_0x37bf('0x15')]){oldToken=_0x15bd65['data1'];}httpRequest(_0x1dd8b1)[_0x37bf('0x11')](function(_0x37c11e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37c11e[_0x37bf('0x16')]){isOldTokenSent=![];if(!_0x15bd65[_0x37bf('0xa')]&&_0x15bd65['license']!=_0x37c11e[_0x37bf('0xa')]||_0x15bd65[_0x37bf('0xa')]&&_0x15bd65[_0x37bf('0x15')]){logger[_0x37bf('0x17')](_0x37bf('0x18'));}if(_0x15bd65[_0x37bf('0xa')]&&!_0x15bd65[_0x37bf('0x15')]&&_0x15bd65['license']!=_0x37c11e[_0x37bf('0xa')]){logger[_0x37bf('0x17')](_0x37bf('0x19'));}if(_0x15bd65['license']&&!_0x15bd65[_0x37bf('0x15')]&&_0x15bd65[_0x37bf('0xa')]==_0x37c11e['license']){return _0x431760;}return _0x431760[_0x37bf('0x1a')]({'data1':_0x1dd8b1,'data2':null,'license':_0x37c11e[_0x37bf('0xa')]});}else{if(_0x37c11e[_0x37bf('0xa')]||_0x15bd65[_0x37bf('0xa')]){if(!_0x15bd65[_0x37bf('0x15')]){if(_0x15bd65[_0x37bf('0x14')]==_0x1dd8b1){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x37bf('0x1b');logger[_0x37bf('0x17')](_0x37bf('0x1c'),_0x15bd65[_0x37bf('0x14')],_0x1dd8b1);}logger[_0x37bf('0x17')](_0x37bf('0x1d'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x37bf('0x1e')));return _0x431760['update']({'data2':encryptor[_0x37bf('0x1f')](moment()[_0x37bf('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x37bf('0x20')](_0x15bd65[_0x37bf('0x15')]),'days')>DAYS){logger[_0x37bf('0x17')]('DEMO\x20START\x20AT\x20%s',moment()[_0x37bf('0xc')](_0x37bf('0x1e')));isOldTokenSent=![];return _0x431760[_0x37bf('0x1a')]({'data1':_0x1dd8b1,'data2':null,'license':null});}}}else{if(_0x15bd65[_0x37bf('0x14')]!=_0x1dd8b1){logger['info'](_0x37bf('0x1c'),_0x15bd65[_0x37bf('0x14')],_0x1dd8b1);return _0x431760[_0x37bf('0x1a')]({'data1':_0x1dd8b1,'data2':null,'license':null});}}}return _0x431760;})['then'](function(_0x279629){_0x431760=_0x279629;})['catch'](function(_0x42e669){logger[_0x37bf('0x21')](_0x42e669[_0x37bf('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x37bf('0x23')](),_0x431760);},TIME);});}function defaultLicense(){var _0x568429=hardware[_0x37bf('0x23')]();if(_0x568429){return db[_0x37bf('0x24')][_0x37bf('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x568429}})[_0x37bf('0x26')](function(_0x13a36c,_0x3f7884){logger[_0x37bf('0x17')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x568429);manageLicense(_0x568429,_0x13a36c);})['catch'](function(_0x5880f3){logger[_0x37bf('0x21')](_0x5880f3[_0x37bf('0x22')]);});}}exports[_0x37bf('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a5ba903..bc8988e 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 _0x48cb=['users','telephones','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','uuid','data1','license','isEmpty','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone'];(function(_0x3d51de,_0x17253c){var _0x14128a=function(_0x1279ea){while(--_0x1279ea){_0x3d51de['push'](_0x3d51de['shift']());}};_0x14128a(++_0x17253c);}(_0x48cb,0x66));var _0xb48c=function(_0x44657e,_0x5e5bac){_0x44657e=_0x44657e-0x0;var _0x46855c=_0x48cb[_0x44657e];return _0x46855c;};'use strict';var util=require('util');var _=require(_0xb48c('0x0'));var moment=require(_0xb48c('0x1'));var BPromise=require(_0xb48c('0x2'));var hardware=require(_0xb48c('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xb48c('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb48c('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb48c('0x6'),'machineUuid':hardware[_0xb48c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x169d8){return new BPromise(function(_0x2e48ca,_0x3e4ee8){return db[_0xb48c('0x8')][_0xb48c('0x9')](_[_0xb48c('0xa')](_0x169d8,{'raw':!![],'where':{'id':0x1}}))[_0xb48c('0xb')](function(_0x567391){return checkLicense(_0x567391,null);})[_0xb48c('0xb')](function(_0x5c58e5){_0x2e48ca(_0x5c58e5);return;})['catch'](function(_0x5cbb6f){_0x3e4ee8(_0x5cbb6f);});});}function checkLicense(_0x2972fb,_0x494b4b){if(!_0x2972fb){demoLicense[_0xb48c('0xc')]=_0x2972fb[_0xb48c('0xd')];return demoLicense;}try{var _0x25d0dc=_0x494b4b||_0x2972fb[_0xb48c('0xe')];if(_[_0xb48c('0xf')](_0x25d0dc)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4e9444=_0x2972fb[_0xb48c('0xd')];var _0x446549=_0x2972fb['data2'];var _0x1123aa=_0x4e9444['split']('-')[0x4];var _0xc0a0dc=_0x4e9444['split']('-')[0x0];var _0x380364=encryptor[_0xb48c('0x10')](_0x25d0dc,util[_0xb48c('0x11')](_0xb48c('0x12'),_0x1123aa,_0x4e9444,_0xc0a0dc));var _0x4f24cf=JSON[_0xb48c('0x13')](_0x380364);_0x4f24cf[_0xb48c('0x14')]=![];_0x4f24cf[_0xb48c('0xc')]=_0x4e9444;_0x4f24cf[_0xb48c('0x15')]=hardware[_0xb48c('0x7')]();if(_0x446549){var _0x4c0a9a=encryptor['decryptString'](_0x446549);_0x4f24cf[_0xb48c('0x16')]=_0x4c0a9a;_0x4f24cf[_0xb48c('0x17')]=moment(_0x4c0a9a)['add'](0x7,_0xb48c('0x18'))[_0xb48c('0x11')]();_0x4f24cf[_0xb48c('0x19')]=_0x4f24cf[_0xb48c('0xc')]!=_0x4f24cf[_0xb48c('0x15')]?_0xb48c('0x1a'):_0xb48c('0x1b');}return _0x4f24cf;}catch(_0x3122b2){breakingLicense[_0xb48c('0xc')]=_0x2972fb[_0xb48c('0xd')];breakingLicense[_0xb48c('0x1c')]=_0x3122b2[_0xb48c('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x57a0ae,_0xfdd05a){getLicense()[_0xb48c('0xb')](function(_0x58aa51){return db[_0xb48c('0x1d')][_0xb48c('0x1e')]({'attributes':[_0xb48c('0x1f'),[db[_0xb48c('0x20')]['fn'](_0xb48c('0x21'),db[_0xb48c('0x20')][_0xb48c('0x22')]('role')),_0xb48c('0x23')]],'group':_0xb48c('0x1f'),'where':{'role':{'$or':[_0xb48c('0x24'),_0xb48c('0x25'),_0xb48c('0x26')]}},'raw':!![]})['then'](function(_0x49c88c){var _0x10a043={'user':_0x58aa51[_0xb48c('0x27')]||0x0,'telephone':_0x58aa51[_0xb48c('0x28')]||0x0};_0x49c88c['forEach'](function(_0x1091c4){var _0x259b0b=_0x1091c4['role']===_0xb48c('0x24')?_0xb48c('0x25'):_0x1091c4['role'];_0x10a043[_0x259b0b]-=_0x1091c4[_0xb48c('0x23')];if(_0x10a043[_0x259b0b]<0x0)_0x10a043[_0x259b0b]=0x0;});_0x57a0ae(_0x10a043);return;});})[_0xb48c('0x29')](function(_0x4f3268){_0xfdd05a(_0x4f3268);});});}function checkUserLimits(_0x32d0d1){return new BPromise(function(_0x134213,_0x18a2af){getLimits()[_0xb48c('0xb')](function(_0x109dc4){var _0x17411=_[_0xb48c('0x2a')](_[_0xb48c('0x2b')](_0x32d0d1,_0xb48c('0x1f')),[_0xb48c('0x24'),_0xb48c('0x25'),_0xb48c('0x26')]);var _0x12dad6=(_0x17411[_0xb48c('0x24')]||0x0)+(_0x17411['user']||0x0);var _0x5cb003=_0x17411[_0xb48c('0x26')]||0x0;if(_0x12dad6>_0x109dc4[_0xb48c('0x25')])return _0x18a2af(_0xb48c('0x2c'));if(_0x5cb003>_0x109dc4[_0xb48c('0x26')])return _0x18a2af(_0xb48c('0x2d'));return _0x134213();})[_0xb48c('0x29')](function(_0x10fecc){_0x18a2af(_0x10fecc);});});}module[_0xb48c('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa348=['getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','catch','data1','isEmpty','data2','split','decryptString','%s:%s:%s','parse','uuid','machineUuid','gray','deadline','add','days','format','changed','message','then','findAll','role','COUNT','col','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license'];(function(_0x199824,_0x52f7a9){var _0x35fcbe=function(_0x3ae0fb){while(--_0x3ae0fb){_0x199824['push'](_0x199824['shift']());}};_0x35fcbe(++_0x52f7a9);}(_0xa348,0xa9));var _0x8a34=function(_0x32bb3c,_0x28aa49){_0x32bb3c=_0x32bb3c-0x0;var _0xd3ab8=_0xa348[_0x32bb3c];return _0xd3ab8;};'use strict';var util=require('util');var _=require(_0x8a34('0x0'));var moment=require(_0x8a34('0x1'));var BPromise=require(_0x8a34('0x2'));var hardware=require(_0x8a34('0x3'));var encryptor=require(_0x8a34('0x4'));var db=require(_0x8a34('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8a34('0x6'),'machineUuid':hardware[_0x8a34('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8a34('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8a34('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2b6889){return new BPromise(function(_0x37c12a,_0x224de6){return db[_0x8a34('0xa')]['find'](_[_0x8a34('0xb')](_0x2b6889,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x631a02){return checkLicense(_0x631a02,null);})['then'](function(_0x3c9e56){_0x37c12a(_0x3c9e56);return;})[_0x8a34('0xc')](function(_0x4420fa){_0x224de6(_0x4420fa);});});}function checkLicense(_0xb32215,_0x1dc5f5){if(!_0xb32215){demoLicense['uuid']=_0xb32215[_0x8a34('0xd')];return demoLicense;}try{var _0x4949fe=_0x1dc5f5||_0xb32215['license'];if(_[_0x8a34('0xe')](_0x4949fe)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2eb6a4=_0xb32215[_0x8a34('0xd')];var _0x418ea0=_0xb32215[_0x8a34('0xf')];var _0x217a6e=_0x2eb6a4['split']('-')[0x4];var _0x136582=_0x2eb6a4[_0x8a34('0x10')]('-')[0x0];var _0x4b38b9=encryptor[_0x8a34('0x11')](_0x4949fe,util['format'](_0x8a34('0x12'),_0x217a6e,_0x2eb6a4,_0x136582));var _0x192ce2=JSON[_0x8a34('0x13')](_0x4b38b9);_0x192ce2['demo']=![];_0x192ce2[_0x8a34('0x14')]=_0x2eb6a4;_0x192ce2[_0x8a34('0x15')]=hardware['getUuid']();if(_0x418ea0){var _0x3f47c0=encryptor[_0x8a34('0x11')](_0x418ea0);_0x192ce2[_0x8a34('0x16')]=_0x3f47c0;_0x192ce2[_0x8a34('0x17')]=moment(_0x3f47c0)[_0x8a34('0x18')](0x7,_0x8a34('0x19'))[_0x8a34('0x1a')]();_0x192ce2['grayReason']=_0x192ce2[_0x8a34('0x14')]!=_0x192ce2[_0x8a34('0x15')]?_0x8a34('0x1b'):'disabled';}return _0x192ce2;}catch(_0x27cc78){breakingLicense[_0x8a34('0x14')]=_0xb32215[_0x8a34('0xd')];breakingLicense[_0x8a34('0x1c')]=_0x27cc78[_0x8a34('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2fe493,_0x56ad9e){getLicense()[_0x8a34('0x1d')](function(_0xb564ab){return db['User'][_0x8a34('0x1e')]({'attributes':[_0x8a34('0x1f'),[db['sequelize']['fn'](_0x8a34('0x20'),db['sequelize'][_0x8a34('0x21')](_0x8a34('0x1f'))),_0x8a34('0x22')]],'group':_0x8a34('0x1f'),'where':{'role':{'$or':[_0x8a34('0x23'),_0x8a34('0x24'),_0x8a34('0x25')]}},'raw':!![]})[_0x8a34('0x1d')](function(_0x2166ef){var _0x1992a3={'user':_0xb564ab['users']||0x0,'telephone':_0xb564ab[_0x8a34('0x26')]||0x0};_0x2166ef['forEach'](function(_0x4eedc6){var _0x242447=_0x4eedc6[_0x8a34('0x1f')]===_0x8a34('0x23')?'user':_0x4eedc6['role'];_0x1992a3[_0x242447]-=_0x4eedc6[_0x8a34('0x22')];if(_0x1992a3[_0x242447]<0x0)_0x1992a3[_0x242447]=0x0;});_0x2fe493(_0x1992a3);return;});})[_0x8a34('0xc')](function(_0x315d82){_0x56ad9e(_0x315d82);});});}function checkUserLimits(_0x250e67){return new BPromise(function(_0x4ed957,_0x122c74){getLimits()['then'](function(_0x28605e){var _0x21af2c=_[_0x8a34('0x27')](_[_0x8a34('0x28')](_0x250e67,_0x8a34('0x1f')),['admin',_0x8a34('0x24'),_0x8a34('0x25')]);var _0x35e4cb=(_0x21af2c[_0x8a34('0x23')]||0x0)+(_0x21af2c[_0x8a34('0x24')]||0x0);var _0x97bcab=_0x21af2c[_0x8a34('0x25')]||0x0;if(_0x35e4cb>_0x28605e[_0x8a34('0x24')])return _0x122c74(_0x8a34('0x29'));if(_0x97bcab>_0x28605e[_0x8a34('0x25')])return _0x122c74(_0x8a34('0x2a'));return _0x4ed957();})[_0x8a34('0xc')](function(_0x3ceb7d){_0x122c74(_0x3ceb7d);});});}module[_0x8a34('0x2b')]={'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 311ecef..d0d3065 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 _0x8603=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x5c57ed,_0x28570a){var _0x3c1eb7=function(_0x413553){while(--_0x413553){_0x5c57ed['push'](_0x5c57ed['shift']());}};_0x3c1eb7(++_0x28570a);}(_0x8603,0x190));var _0x3860=function(_0x28a386,_0xcde008){_0x28a386=_0x28a386-0x0;var _0x402c0a=_0x8603[_0x28a386];return _0x402c0a;};'use strict';module['exports']={'DOMAIN':_0x3860('0x0'),'SESSION_SECRET':_0x3860('0x1'),'GOOGLE_ID':_0x3860('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xed3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xed3c,0x1a6));var _0xced3=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0xed3c[_0x3ae4bf];return _0x27f7dd;};'use strict';module[_0xced3('0x0')]={'DOMAIN':_0xced3('0x1'),'SESSION_SECRET':_0xced3('0x2'),'GOOGLE_ID':_0xced3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 072b654..d0a4c06 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5a7=['exports','../utils/loggers','fileLogger'];(function(_0x49b021,_0x25a126){var _0xff3ebe=function(_0x550902){while(--_0x550902){_0x49b021['push'](_0x49b021['shift']());}};_0xff3ebe(++_0x25a126);}(_0xf5a7,0xee));var _0x7f5a=function(_0x41f193,_0x1244c3){_0x41f193=_0x41f193-0x0;var _0x2ead61=_0xf5a7[_0x41f193];return _0x2ead61;};'use strict';var fileLogger=require(_0x7f5a('0x0'))[_0x7f5a('0x1')];module[_0x7f5a('0x2')]=fileLogger; \ No newline at end of file +var _0xd812=['fileLogger','exports','../utils/loggers'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0xd812,0xfe));var _0x2d81=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xd812[_0x5b27da];return _0x3254f4;};'use strict';var fileLogger=require(_0x2d81('0x0'))[_0x2d81('0x1')];module[_0x2d81('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 044aee2..14449fa 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 _0x9966=['path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x9e06e9,_0x1f005c){var _0x18eac6=function(_0xcae64e){while(--_0xcae64e){_0x9e06e9['push'](_0x9e06e9['shift']());}};_0x18eac6(++_0x1f005c);}(_0x9966,0x16c));var _0x6996=function(_0x1bcc2f,_0x395982){_0x1bcc2f=_0x1bcc2f-0x0;var _0xa063a9=_0x9966[_0x1bcc2f];return _0xa063a9;};'use strict';var path=require(_0x6996('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6996('0x1')](__dirname,_0x6996('0x2'))},{'name':_0x6996('0x3'),'script':path[_0x6996('0x1')](__dirname,_0x6996('0x4'))},{'name':_0x6996('0x5'),'script':path[_0x6996('0x1')](__dirname,_0x6996('0x6'))},{'name':_0x6996('0x7'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x6996('0x8'),'script':path[_0x6996('0x1')](__dirname,_0x6996('0x9'))},{'name':_0x6996('0xa'),'script':path[_0x6996('0x1')](__dirname,_0x6996('0xb'))}]};module[_0x6996('0xc')]=config; \ No newline at end of file +var _0x6027=['xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','agi','routing','../../services/routing/index.js'];(function(_0x55fee6,_0xb8e377){var _0x50d892=function(_0x31056a){while(--_0x31056a){_0x55fee6['push'](_0x55fee6['shift']());}};_0x50d892(++_0xb8e377);}(_0x6027,0xf3));var _0x7602=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0x6027[_0x53b199];return _0x1ba42d;};'use strict';var path=require(_0x7602('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x7602('0x1')](__dirname,_0x7602('0x2'))},{'name':_0x7602('0x3'),'script':path[_0x7602('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x7602('0x4'),'script':path[_0x7602('0x1')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x7602('0x5'),'script':path['join'](__dirname,_0x7602('0x6'))},{'name':_0x7602('0x7'),'script':path[_0x7602('0x1')](__dirname,_0x7602('0x8'))}]};module[_0x7602('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2ac5ffa..2affdc2 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 _0x752b=['dump','saved','pm2','./config','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x4f9c55,_0x116fc1){var _0x3f243a=function(_0x3b60e8){while(--_0x3b60e8){_0x4f9c55['push'](_0x4f9c55['shift']());}};_0x3f243a(++_0x116fc1);}(_0x752b,0x1c9));var _0xb752=function(_0x43684f,_0xb594b4){_0x43684f=_0x43684f-0x0;var _0x38068e=_0x752b[_0x43684f];return _0x38068e;};'use strict';var pm2=require(_0xb752('0x0'));var BPromise=require('bluebird');var config=require(_0xb752('0x1'));function connect(){return new BPromise(function(_0x47995b,_0x24e5c2){return pm2['connect'](function(_0x1f797f){if(_0x1f797f){return _0x24e5c2(_0x1f797f);}return _0x47995b(_0xb752('0x2'));});});};exports[_0xb752('0x3')]=function(_0x3f9df4){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x581416,_0x3e975e){return pm2[_0xb752('0x3')](_0x3f9df4,function(_0x1c21b6,_0x22d2c4){if(_0x1c21b6){return _0x3e975e(_0x1c21b6);}pm2[_0xb752('0x5')]();return _0x581416(_0x22d2c4);});});});};exports['stop']=function(_0x510399){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x37fa2c,_0x3fa553){return pm2[_0xb752('0x6')](_0x510399,function(_0x56028b,_0x34e755){if(_0x56028b){return _0x3fa553(_0x56028b);}pm2[_0xb752('0x5')]();return _0x37fa2c(_0x34e755);});});});};exports[_0xb752('0x7')]=function(_0x4db90a){return connect()['then'](function(){return new BPromise(function(_0x3aa317,_0x19c060){return pm2['restart'](_0x4db90a,function(_0x2d1ac9,_0x9a872d){if(_0x2d1ac9){return _0x19c060(_0x2d1ac9);}pm2[_0xb752('0x5')]();return _0x3aa317(_0x9a872d);});});});};exports[_0xb752('0x8')]=function(){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x5f346e,_0x5b2e69){return pm2['list'](function(_0x2613a6,_0x72fd24){if(_0x2613a6){return _0x5b2e69(_0x2613a6);}pm2[_0xb752('0x5')]();return _0x5f346e(_0x72fd24);});});});};exports['describe']=function(_0x43ea98){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x142963,_0x556938){return pm2[_0xb752('0x9')](_0x43ea98,function(_0x2a14ff,_0x4db2bb){if(_0x2a14ff){return _0x556938(_0x2a14ff);}pm2['disconnect']();return _0x142963(_0x4db2bb);});});});};exports[_0xb752('0xa')]=function(_0x53ac58){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x459bfb,_0x460cc9){return pm2[_0xb752('0xa')](_0x53ac58,function(_0x1d7304,_0x4b5c1f){if(_0x1d7304){return _0x460cc9(_0x1d7304);}pm2[_0xb752('0x5')]();return _0x459bfb(_0x4b5c1f);});});});};exports['dump']=function(){return connect()[_0xb752('0x4')](function(){return new BPromise(function(_0x37f154,_0x4ed403){return pm2[_0xb752('0xb')](function(_0x27c7f0){if(_0x27c7f0){return _0x4ed403(_0x27c7f0);}return _0x37f154(_0xb752('0xc'));});});});}; \ No newline at end of file +var _0x76af=['start','then','stop','restart','disconnect','list','describe','delete','dump','saved','pm2','bluebird','connect','connected'];(function(_0x5ee211,_0x3f31a3){var _0x46fc90=function(_0x44f6d8){while(--_0x44f6d8){_0x5ee211['push'](_0x5ee211['shift']());}};_0x46fc90(++_0x3f31a3);}(_0x76af,0x7a));var _0xf76a=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x76af[_0x329437];return _0x3789d9;};'use strict';var pm2=require(_0xf76a('0x0'));var BPromise=require(_0xf76a('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2163da,_0x4d4498){return pm2[_0xf76a('0x2')](function(_0x219238){if(_0x219238){return _0x4d4498(_0x219238);}return _0x2163da(_0xf76a('0x3'));});});};exports[_0xf76a('0x4')]=function(_0x3f3123){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x2f9d65,_0x3f6d30){return pm2[_0xf76a('0x4')](_0x3f3123,function(_0x1eee7b,_0x42fd18){if(_0x1eee7b){return _0x3f6d30(_0x1eee7b);}pm2['disconnect']();return _0x2f9d65(_0x42fd18);});});});};exports['stop']=function(_0x1cbef1){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x322cd3,_0x586398){return pm2[_0xf76a('0x6')](_0x1cbef1,function(_0x11006c,_0x5467a0){if(_0x11006c){return _0x586398(_0x11006c);}pm2['disconnect']();return _0x322cd3(_0x5467a0);});});});};exports[_0xf76a('0x7')]=function(_0x6c4b77){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x326171,_0x5efbe4){return pm2[_0xf76a('0x7')](_0x6c4b77,function(_0x1c87f7,_0x468389){if(_0x1c87f7){return _0x5efbe4(_0x1c87f7);}pm2[_0xf76a('0x8')]();return _0x326171(_0x468389);});});});};exports[_0xf76a('0x9')]=function(){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x2d332f,_0x37acb2){return pm2[_0xf76a('0x9')](function(_0x4e9a49,_0x21a022){if(_0x4e9a49){return _0x37acb2(_0x4e9a49);}pm2[_0xf76a('0x8')]();return _0x2d332f(_0x21a022);});});});};exports['describe']=function(_0x18a3f0){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x385d68,_0x1f40eb){return pm2[_0xf76a('0xa')](_0x18a3f0,function(_0x59723e,_0x4f134a){if(_0x59723e){return _0x1f40eb(_0x59723e);}pm2[_0xf76a('0x8')]();return _0x385d68(_0x4f134a);});});});};exports[_0xf76a('0xb')]=function(_0x834034){return connect()[_0xf76a('0x5')](function(){return new BPromise(function(_0x334538,_0x1a0822){return pm2[_0xf76a('0xb')](_0x834034,function(_0x5141b0,_0x2fafe7){if(_0x5141b0){return _0x1a0822(_0x5141b0);}pm2[_0xf76a('0x8')]();return _0x334538(_0x2fafe7);});});});};exports[_0xf76a('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x6aab3c,_0x24189b){return pm2[_0xf76a('0xc')](function(_0x5e7e4c){if(_0x5e7e4c){return _0x24189b(_0x5e7e4c);}return _0x6aab3c(_0xf76a('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 80d0ef8..05af8f9 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 _0xc003=['socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc003,0x14a));var _0x3c00=function(_0x27f961,_0x3e9c18){_0x27f961=_0x27f961-0x0;var _0xc248b1=_0xc003[_0x27f961];return _0xc248b1;};'use strict';var _=require(_0x3c00('0x0'));var moment=require('moment');var Redis=require(_0x3c00('0x1'));var util=require(_0x3c00('0x2'));var config=require(_0x3c00('0x3'));var db=require(_0x3c00('0x4'))['db'];var logger=require(_0x3c00('0x5'))(_0x3c00('0x6'));config[_0x3c00('0x7')]=_[_0x3c00('0x8')](config[_0x3c00('0x7')],{'host':_0x3c00('0x9'),'port':0x18eb});var io=require(_0x3c00('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x1513d0=0x0;var _0x3f1405=[];return db[_0x3c00('0xb')][_0x3c00('0xc')]({'raw':!![],'attributes':['id',_0x3c00('0xd')],'where':{'id':0x1}})[_0x3c00('0xe')](function(_0x3164f9){_0x1513d0=_0x3164f9['chatTimeout'];if(_0x1513d0){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x3c00('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3c00('0x10')](_0x3164f9['chatTimeout'],_0x3c00('0x11'))}}});}else{return[];}})[_0x3c00('0xe')](function(_0x4c79f2){if(_0x4c79f2&&_0x4c79f2['length']){_0x3f1405=_[_0x3c00('0x12')](_0x4c79f2||[],'id');logger[_0x3c00('0x13')](_0x3c00('0x14'),_0x3f1405[_0x3c00('0x15')]());return db[_0x3c00('0x16')][_0x3c00('0x17')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x3c00('0x18')](_0x3c00('0x19'))},{'where':{'id':_0x3f1405}});}})[_0x3c00('0xe')](function(){if(_0x3f1405&&_0x3f1405[_0x3c00('0x1a')]){logger[_0x3c00('0x13')](_0x3c00('0x1b'),_0x3f1405[_0x3c00('0x15')]());for(var _0x1b6591=0x0;_0x1b6591<_0x3f1405[_0x3c00('0x1a')];_0x1b6591++){io['emit'](_0x3c00('0x1c'),{'id':_0x3f1405[_0x1b6591],'closed':!![]});}}})[_0x3c00('0x1d')](function(_0x10ed14){logger[_0x3c00('0x1e')](_0x3c00('0x1f'),_0x10ed14?util[_0x3c00('0x20')](_0x10ed14,{'showHidden':![],'depth':null}):'');});}exports[_0x3c00('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2172=['YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','ioredis','util','../../config/environment','../../mysqldb','redis','socket.io-emitter','chatTimeout','ChatInteraction','findAll','subtract','minutes','then','length','map','info','update','system','timeout','format'];(function(_0x1d6e1c,_0x27c119){var _0x2e0806=function(_0x44cd78){while(--_0x44cd78){_0x1d6e1c['push'](_0x1d6e1c['shift']());}};_0x2e0806(++_0x27c119);}(_0x2172,0x167));var _0x2217=function(_0x278504,_0x300f10){_0x278504=_0x278504-0x0;var _0x530d3e=_0x2172[_0x278504];return _0x530d3e;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2217('0x0'));var util=require(_0x2217('0x1'));var config=require(_0x2217('0x2'));var db=require(_0x2217('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x2217('0x4')]=_['defaults'](config[_0x2217('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2217('0x5'))(new Redis(config[_0x2217('0x4')]));function closeInteractions(){var _0x1fc290=0x0;var _0x9219fc=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x2217('0x6')],'where':{'id':0x1}})['then'](function(_0x4f8758){_0x1fc290=_0x4f8758[_0x2217('0x6')];if(_0x1fc290){return db[_0x2217('0x7')][_0x2217('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2217('0x9')](_0x4f8758[_0x2217('0x6')],_0x2217('0xa'))}}});}else{return[];}})[_0x2217('0xb')](function(_0x78583a){if(_0x78583a&&_0x78583a[_0x2217('0xc')]){_0x9219fc=_[_0x2217('0xd')](_0x78583a||[],'id');logger[_0x2217('0xe')]('[CHAT]\x20Interactions\x20to\x20close:',_0x9219fc['join']());return db[_0x2217('0x7')][_0x2217('0xf')]({'closeReason':_0x2217('0x10'),'disposition':_0x2217('0x11'),'closed':!![],'closedAt':moment()[_0x2217('0x12')](_0x2217('0x13'))},{'where':{'id':_0x9219fc}});}})[_0x2217('0xb')](function(){if(_0x9219fc&&_0x9219fc[_0x2217('0xc')]){logger[_0x2217('0xe')](_0x2217('0x14'),_0x9219fc[_0x2217('0x15')]());for(var _0x2d0a9c=0x0;_0x2d0a9c<_0x9219fc[_0x2217('0xc')];_0x2d0a9c++){io[_0x2217('0x16')](_0x2217('0x17'),{'id':_0x9219fc[_0x2d0a9c],'closed':!![]});}}})[_0x2217('0x18')](function(_0x2fe581){logger[_0x2217('0x19')](_0x2217('0x1a'),_0x2fe581?util['inspect'](_0x2fe581,{'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 47b518f..adfa9c1 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 _0x7d4d=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x256cc1,_0x568424){var _0x330d0a=function(_0x4c8cc1){while(--_0x4c8cc1){_0x256cc1['push'](_0x256cc1['shift']());}};_0x330d0a(++_0x568424);}(_0x7d4d,0x1c5));var _0xd7d4=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x7d4d[_0x5df61d];return _0x24cc4c;};'use strict';function start(){var _0x41b23e=require(_0xd7d4('0x0'));return _0x41b23e[_0xd7d4('0x1')]();}module[_0xd7d4('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x9caa=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x9caa,0x12a));var _0xa9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9caa[_0x20a584];return _0x4b41a8;};'use strict';function start(){var _0x1af76a=require(_0xa9ca('0x0'));return _0x1af76a[_0xa9ca('0x1')]();}module[_0xa9ca('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 f5d9e83..17305f9 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 _0xa9b1=['http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','extname','zip','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','email\x20sent','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','add','start','add\x20cron','exists','deleteJob','stop\x20cron','active','endAt','update','run','util','lodash','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9b1,0xf5));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x1a9b('0x0'));var path=require('path');var _=require(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var CronJobManager=require(_0x1a9b('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x1a9b('0x4'));var logger=require('../logger')(_0x1a9b('0x5'));var db=require(_0x1a9b('0x6'))['db'];var analyticCustomReportController=require(_0x1a9b('0x7'));var analyticDefaultReportController=require(_0x1a9b('0x8'));var client=jayson[_0x1a9b('0x9')][_0x1a9b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x12a891,_0x1476e3){return function(){logger[_0x1a9b('0xb')](_0x1a9b('0xc'),_0x12a891[_0x1a9b('0xd')]);var _0x565c94=!![];var _0x1d7051=_0x12a891[_0x1a9b('0xe')][_0x1a9b('0xf')]();var _0x319c91={'account':_0x1d7051,'message':{'from':util[_0x1a9b('0x10')]('\x22%s\x22\x20<%s>',_0x12a891[_0x1a9b('0xe')][_0x1a9b('0x11')],_0x12a891[_0x1a9b('0xe')][_0x1a9b('0xd')]||_0x12a891[_0x1a9b('0xe')]['Smtp'][_0x1a9b('0x12')]),'to':_0x12a891['email'],'cc':_0x12a891['cc'],'bcc':_0x12a891[_0x1a9b('0x13')],'subject':util[_0x1a9b('0x10')](_0x1a9b('0x14'),_0x1476e3[_0x1a9b('0x11')],_0x12a891[_0x1a9b('0x15')],_0x12a891['subtractUnit'])}};var _0xbd95b9=path[_0x1a9b('0x16')](__dirname,_0x1a9b('0x17'));var _0x5b475a=_0x1476e3[_0x1a9b('0x18')];var _0x206a72=util[_0x1a9b('0x10')]('%s.%s',path['basename'](_0x1476e3['savename'],path[_0x1a9b('0x19')](_0x1476e3[_0x1a9b('0x18')])),_0x1a9b('0x1a'));var _0x27dae0=path[_0x1a9b('0x16')](_0xbd95b9,_0x5b475a);var _0x538c61=path[_0x1a9b('0x16')](_0xbd95b9,_0x206a72);if(fs['existsSync'](_0x27dae0)){_0x1476e3['status']=_0x1a9b('0x1b');_0x319c91['message'][_0x1a9b('0x1c')]=[{'filename':_0x5b475a,'path':_0x27dae0}];_0x319c91[_0x1a9b('0x1d')][_0x1a9b('0x1e')]=util[_0x1a9b('0x10')](_0x1a9b('0x1f'),JSON[_0x1a9b('0x20')](_0x1476e3,null,0x2));}else if(fs['existsSync'](_0x538c61)){_0x1476e3[_0x1a9b('0x21')]=_0x1a9b('0x1b');_0x319c91[_0x1a9b('0x1d')][_0x1a9b('0x1c')]=[{'filename':_0x206a72,'path':_0x538c61}];}else{_0x319c91[_0x1a9b('0x1d')][_0x1a9b('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x12a891['sendIfEmpty']){_0x565c94=![];logger['info'](_0x1a9b('0x22'));}}if(_0x565c94){return client['request']('SendMail',_0x319c91)[_0x1a9b('0x23')](function(_0x352a0b){if(_0x352a0b[_0x1a9b('0x24')]){return logger[_0x1a9b('0x24')](_0x1a9b('0x25'),JSON[_0x1a9b('0x20')](_0x352a0b));}return logger[_0x1a9b('0xb')](_0x1a9b('0x26'));})['catch'](function(_0x42afcb){return logger[_0x1a9b('0x24')](_0x1a9b('0x25'),JSON[_0x1a9b('0x20')](_0x42afcb));});}};}function handleError(){return function(_0x458cb9){return logger['error'](JSON[_0x1a9b('0x20')](_0x458cb9));};}function handleResult(_0x14206f){return function(_0x174d3e){logger[_0x1a9b('0xb')](_0x1a9b('0x27'),JSON[_0x1a9b('0x20')](_0x174d3e));if(_0x14206f['MailAccount']&&_0x14206f['MailAccount'][_0x1a9b('0x28')]&&!_['isNil'](_0x14206f[_0x1a9b('0xd')])){setTimeout(handleSendEmail(_0x14206f,_0x174d3e),0x3c*0x3e8);}};}function handleJob(_0x8114ac){return function(){try{if(_[_0x1a9b('0x29')](_0x8114ac[_0x1a9b('0x15')])){return logger[_0x1a9b('0xb')](_0x1a9b('0x2a'));}if(_['isNil'](_0x8114ac[_0x1a9b('0x2b')])){return logger[_0x1a9b('0xb')](_0x1a9b('0x2c'));}var _0x1d446c={'startDate':moment()['subtract'](_0x8114ac[_0x1a9b('0x15')],_0x8114ac[_0x1a9b('0x2b')])[_0x1a9b('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x1a9b('0x2d'),'output':_0x8114ac[_0x1a9b('0x2e')],'name':_0x8114ac[_0x1a9b('0x11')]};if(!_[_0x1a9b('0x29')](_0x8114ac[_0x1a9b('0x2f')])){logger[_0x1a9b('0xb')](_0x1a9b('0x30'),_0x8114ac[_0x1a9b('0x2f')]);return analyticDefaultReportController[_0x1a9b('0x31')]({'id':_0x8114ac[_0x1a9b('0x2f')]},_0x1d446c)[_0x1a9b('0x23')](handleResult(_0x8114ac))[_0x1a9b('0x32')](handleError());}if(!_['isNil'](_0x8114ac[_0x1a9b('0x33')])){logger[_0x1a9b('0xb')](_0x1a9b('0x34'),_0x8114ac[_0x1a9b('0x33')]);return analyticCustomReportController[_0x1a9b('0x31')]({'id':_0x8114ac[_0x1a9b('0x33')]},_0x1d446c)[_0x1a9b('0x23')](handleResult(_0x8114ac))[_0x1a9b('0x32')](handleError());}}catch(_0x205ad8){logger[_0x1a9b('0x24')](JSON['stringify'](_0x205ad8));}return logger[_0x1a9b('0xb')](_0x1a9b('0x35'));};}function getJobs(_0x4f833e){var _0x2f6b4e={};if(_0x4f833e){_0x2f6b4e['id']=_0x4f833e;}return db[_0x1a9b('0x36')][_0x1a9b('0x37')]({'where':_0x2f6b4e,'include':[{'model':db[_0x1a9b('0xe')],'attributes':['id',_0x1a9b('0x11'),_0x1a9b('0xd')],'include':[{'model':db[_0x1a9b('0x38')],'as':_0x1a9b('0x28'),'include':[{'model':db[_0x1a9b('0x39')],'as':_0x1a9b('0x39')}]}]}]})[_0x1a9b('0x23')](function(_0x19e070){var _0x53180c=_[_0x1a9b('0x3a')](manager[_0x1a9b('0x3b')]);var _0x2cca0a=_[_0x1a9b('0x3c')](_0x19e070,function(_0x3c894c){return _0x3c894c['id'][_0x1a9b('0x3d')]();});var _0x4ce5b6=_[_0x1a9b('0x3e')](_0x19e070,function(_0x1d70ba){return _0x1d70ba['id'][_0x1a9b('0x3d')]();});var _0x546d46=_0x4f833e?_0x2cca0a:_[_0x1a9b('0x3f')](_0x2cca0a,_0x53180c);var _0x247ccb=_[_0x1a9b('0x40')](_0x2cca0a,_0x53180c);var _0x49d700=_['difference'](_0x53180c,_0x2cca0a);var _0x4b4cc2;var _0x5ca5b7;for(_0x4b4cc2=0x0;_0x4b4cc2<_0x49d700[_0x1a9b('0x41')]&&!_0x4f833e;_0x4b4cc2+=0x1){_0x5ca5b7=_0x49d700[_0x4b4cc2][_0x1a9b('0x3d')]();if(manager['exists'](_0x5ca5b7)){manager[_0x1a9b('0x42')](_0x5ca5b7);manager['deleteJob'](_0x5ca5b7);logger['info'](_0x1a9b('0x43'),_0x5ca5b7);}}logger['info'](_0x1a9b('0x44'),JSON[_0x1a9b('0x20')](_0x546d46));for(_0x4b4cc2=0x0;_0x4b4cc2<_0x546d46[_0x1a9b('0x41')];_0x4b4cc2+=0x1){_0x5ca5b7=_0x546d46[_0x4b4cc2]['toString']();logger[_0x1a9b('0xb')](_0x1a9b('0x45'),_0x5ca5b7);if(_0x4f833e){logger['info'](_0x1a9b('0x46'),_0x4f833e);logger[_0x1a9b('0xb')](JSON[_0x1a9b('0x20')](_0x4ce5b6[_0x5ca5b7]));BPromise[_0x1a9b('0x47')]()[_0x1a9b('0x23')](handleJob(_0x4ce5b6[_0x5ca5b7]));logger[_0x1a9b('0xb')](_0x1a9b('0x48'),_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x11')],_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')]);}else if(_0x4ce5b6[_0x5ca5b7]['cron']&&_0x4ce5b6[_0x5ca5b7]['active']&&moment()['isBetween'](_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x4a')],_0x4ce5b6[_0x5ca5b7]['endAt'])){manager[_0x1a9b('0x4b')](_0x5ca5b7,_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')],handleJob(_0x4ce5b6[_0x5ca5b7]));manager[_0x1a9b('0x4c')](_0x5ca5b7);logger[_0x1a9b('0xb')](_0x1a9b('0x4d'),_0x4ce5b6[_0x5ca5b7]['name'],_0x4ce5b6[_0x5ca5b7]['cron']);}else if(manager[_0x1a9b('0x4e')](_0x5ca5b7)){manager['stop'](_0x5ca5b7);manager[_0x1a9b('0x4f')](_0x5ca5b7);logger['info'](_0x1a9b('0x50'),_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x11')],_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')]);}}for(_0x4b4cc2=0x0,_0x5ca5b7;_0x4b4cc2<_0x247ccb['length']&&!_0x4f833e;_0x4b4cc2+=0x1){_0x5ca5b7=_0x247ccb[_0x4b4cc2][_0x1a9b('0x3d')]();if(manager[_0x1a9b('0x4e')](_0x5ca5b7)){if(_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')]&&_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x51')]&&moment()['isBetween'](_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x4a')],_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x52')])){manager[_0x1a9b('0x53')](_0x5ca5b7,_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')],handleJob(_0x4ce5b6[_0x5ca5b7]));logger['info']('update\x20cron',_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x11')],_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')]);}else{manager[_0x1a9b('0x42')](_0x5ca5b7);manager[_0x1a9b('0x4f')](_0x5ca5b7);logger['info'](_0x1a9b('0x50'),_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x11')],_0x4ce5b6[_0x5ca5b7][_0x1a9b('0x49')]);}}}})[_0x1a9b('0x32')](function(_0x547722){logger[_0x1a9b('0x24')](JSON['stringify'](_0x547722));});}exports[_0x1a9b('0x54')]=function(_0x5ad78e){return getJobs(_0x5ad78e);};exports[_0x1a9b('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb60e=['exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','exists','stop','delete\x20cron','length','index','my\x20id','cron','isBetween','endAt','start','add\x20cron','stop\x20cron','active','startAt','update\x20cron','deleteJob','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','basename','savename','zip','existsSync','status','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','SendMail','then','error','stringify','info','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xb60e,0x10f));var _0xeb60=function(_0x1ca4cc,_0x402c23){_0x1ca4cc=_0x1ca4cc-0x0;var _0x108010=_0xb60e[_0x1ca4cc];return _0x108010;};'use strict';var fs=require('fs');var util=require(_0xeb60('0x0'));var path=require(_0xeb60('0x1'));var _=require(_0xeb60('0x2'));var moment=require(_0xeb60('0x3'));var CronJobManager=require(_0xeb60('0x4'));var jayson=require(_0xeb60('0x5'));var BPromise=require('bluebird');var logger=require(_0xeb60('0x6'))(_0xeb60('0x7'));var db=require(_0xeb60('0x8'))['db'];var analyticCustomReportController=require(_0xeb60('0x9'));var analyticDefaultReportController=require(_0xeb60('0xa'));var client=jayson[_0xeb60('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x30b72e,_0x1e37d9){return function(){logger['info'](_0xeb60('0xc'),_0x30b72e[_0xeb60('0xd')]);var _0x5bb97b=!![];var _0x29397c=_0x30b72e[_0xeb60('0xe')]['getSmtpOptions']();var _0x2796ca={'account':_0x29397c,'message':{'from':util[_0xeb60('0xf')]('\x22%s\x22\x20<%s>',_0x30b72e[_0xeb60('0xe')]['name'],_0x30b72e[_0xeb60('0xe')][_0xeb60('0xd')]||_0x30b72e[_0xeb60('0xe')][_0xeb60('0x10')]['user']),'to':_0x30b72e['email'],'cc':_0x30b72e['cc'],'bcc':_0x30b72e[_0xeb60('0x11')],'subject':util[_0xeb60('0xf')](_0xeb60('0x12'),_0x1e37d9['name'],_0x30b72e[_0xeb60('0x13')],_0x30b72e[_0xeb60('0x14')])}};var _0x5be25c=path[_0xeb60('0x15')](__dirname,'../../files/reports');var _0x1d4063=_0x1e37d9['savename'];var _0x2669ad=util['format'](_0xeb60('0x16'),path[_0xeb60('0x17')](_0x1e37d9[_0xeb60('0x18')],path['extname'](_0x1e37d9[_0xeb60('0x18')])),_0xeb60('0x19'));var _0x537158=path[_0xeb60('0x15')](_0x5be25c,_0x1d4063);var _0x152e62=path[_0xeb60('0x15')](_0x5be25c,_0x2669ad);if(fs[_0xeb60('0x1a')](_0x537158)){_0x1e37d9[_0xeb60('0x1b')]=_0xeb60('0x1c');_0x2796ca['message'][_0xeb60('0x1d')]=[{'filename':_0x1d4063,'path':_0x537158}];_0x2796ca['message'][_0xeb60('0x1e')]=util[_0xeb60('0xf')](_0xeb60('0x1f'),JSON['stringify'](_0x1e37d9,null,0x2));}else if(fs[_0xeb60('0x1a')](_0x152e62)){_0x1e37d9['status']=_0xeb60('0x1c');_0x2796ca[_0xeb60('0x20')][_0xeb60('0x1d')]=[{'filename':_0x2669ad,'path':_0x152e62}];}else{_0x2796ca[_0xeb60('0x20')][_0xeb60('0x1e')]=_0xeb60('0x21');if(!_0x30b72e['sendIfEmpty']){_0x5bb97b=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5bb97b){return client['request'](_0xeb60('0x22'),_0x2796ca)[_0xeb60('0x23')](function(_0x3286ef){if(_0x3286ef[_0xeb60('0x24')]){return logger[_0xeb60('0x24')]('error\x20mail',JSON[_0xeb60('0x25')](_0x3286ef));}return logger[_0xeb60('0x26')]('email\x20sent');})[_0xeb60('0x27')](function(_0x43195b){return logger[_0xeb60('0x24')]('error\x20mail',JSON[_0xeb60('0x25')](_0x43195b));});}};}function handleError(){return function(_0x4d5481){return logger[_0xeb60('0x24')](JSON[_0xeb60('0x25')](_0x4d5481));};}function handleResult(_0x5654a5){return function(_0x1feefa){logger['info']('data',JSON[_0xeb60('0x25')](_0x1feefa));if(_0x5654a5[_0xeb60('0xe')]&&_0x5654a5['MailAccount'][_0xeb60('0x10')]&&!_[_0xeb60('0x28')](_0x5654a5['email'])){setTimeout(handleSendEmail(_0x5654a5,_0x1feefa),0x3c*0x3e8);}};}function handleJob(_0x22b081){return function(){try{if(_[_0xeb60('0x28')](_0x22b081[_0xeb60('0x13')])){return logger[_0xeb60('0x26')](_0xeb60('0x29'));}if(_[_0xeb60('0x28')](_0x22b081[_0xeb60('0x14')])){return logger[_0xeb60('0x26')](_0xeb60('0x2a'));}var _0x4b7c7c={'startDate':moment()[_0xeb60('0x2b')](_0x22b081[_0xeb60('0x13')],_0x22b081[_0xeb60('0x14')])[_0xeb60('0xf')](_0xeb60('0x2c')),'endDate':moment()[_0xeb60('0xf')](_0xeb60('0x2c')),'type':_0xeb60('0x2d'),'output':_0x22b081[_0xeb60('0x2e')],'name':_0x22b081[_0xeb60('0x2f')]};if(!_['isNil'](_0x22b081[_0xeb60('0x30')])){logger[_0xeb60('0x26')](_0xeb60('0x31'),_0x22b081[_0xeb60('0x30')]);return analyticDefaultReportController[_0xeb60('0x32')]({'id':_0x22b081[_0xeb60('0x30')]},_0x4b7c7c)['then'](handleResult(_0x22b081))[_0xeb60('0x27')](handleError());}if(!_['isNil'](_0x22b081[_0xeb60('0x33')])){logger[_0xeb60('0x26')](_0xeb60('0x34'),_0x22b081[_0xeb60('0x33')]);return analyticCustomReportController[_0xeb60('0x32')]({'id':_0x22b081['CustomReportId']},_0x4b7c7c)['then'](handleResult(_0x22b081))[_0xeb60('0x27')](handleError());}}catch(_0x1f4f7a){logger[_0xeb60('0x24')](JSON[_0xeb60('0x25')](_0x1f4f7a));}return logger[_0xeb60('0x26')]('no\x20report\x20id');};}function getJobs(_0x41f3b1){var _0x10cce9={};if(_0x41f3b1){_0x10cce9['id']=_0x41f3b1;}return db[_0xeb60('0x35')][_0xeb60('0x36')]({'where':_0x10cce9,'include':[{'model':db['MailAccount'],'attributes':['id',_0xeb60('0x2f'),_0xeb60('0xd')],'include':[{'model':db[_0xeb60('0x37')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xeb60('0x38')}]}]}]})[_0xeb60('0x23')](function(_0x3e55b7){var _0x887169=_[_0xeb60('0x39')](manager[_0xeb60('0x3a')]);var _0x4c0412=_[_0xeb60('0x3b')](_0x3e55b7,function(_0x352443){return _0x352443['id']['toString']();});var _0x417898=_[_0xeb60('0x3c')](_0x3e55b7,function(_0xce8a57){return _0xce8a57['id'][_0xeb60('0x3d')]();});var _0x177669=_0x41f3b1?_0x4c0412:_[_0xeb60('0x3e')](_0x4c0412,_0x887169);var _0x3f632b=_['intersection'](_0x4c0412,_0x887169);var _0x25f315=_[_0xeb60('0x3e')](_0x887169,_0x4c0412);var _0x196bb3;var _0x4a2ef0;for(_0x196bb3=0x0;_0x196bb3<_0x25f315['length']&&!_0x41f3b1;_0x196bb3+=0x1){_0x4a2ef0=_0x25f315[_0x196bb3][_0xeb60('0x3d')]();if(manager[_0xeb60('0x3f')](_0x4a2ef0)){manager[_0xeb60('0x40')](_0x4a2ef0);manager['deleteJob'](_0x4a2ef0);logger['info'](_0xeb60('0x41'),_0x4a2ef0);}}logger[_0xeb60('0x26')]('toRun',JSON[_0xeb60('0x25')](_0x177669));for(_0x196bb3=0x0;_0x196bb3<_0x177669[_0xeb60('0x42')];_0x196bb3+=0x1){_0x4a2ef0=_0x177669[_0x196bb3][_0xeb60('0x3d')]();logger[_0xeb60('0x26')](_0xeb60('0x43'),_0x4a2ef0);if(_0x41f3b1){logger['info'](_0xeb60('0x44'),_0x41f3b1);logger['info'](JSON['stringify'](_0x417898[_0x4a2ef0]));BPromise['resolve']()['then'](handleJob(_0x417898[_0x4a2ef0]));logger[_0xeb60('0x26')]('run\x20job',_0x417898[_0x4a2ef0]['name'],_0x417898[_0x4a2ef0][_0xeb60('0x45')]);}else if(_0x417898[_0x4a2ef0][_0xeb60('0x45')]&&_0x417898[_0x4a2ef0]['active']&&moment()[_0xeb60('0x46')](_0x417898[_0x4a2ef0]['startAt'],_0x417898[_0x4a2ef0][_0xeb60('0x47')])){manager['add'](_0x4a2ef0,_0x417898[_0x4a2ef0][_0xeb60('0x45')],handleJob(_0x417898[_0x4a2ef0]));manager[_0xeb60('0x48')](_0x4a2ef0);logger[_0xeb60('0x26')](_0xeb60('0x49'),_0x417898[_0x4a2ef0][_0xeb60('0x2f')],_0x417898[_0x4a2ef0][_0xeb60('0x45')]);}else if(manager[_0xeb60('0x3f')](_0x4a2ef0)){manager[_0xeb60('0x40')](_0x4a2ef0);manager['deleteJob'](_0x4a2ef0);logger['info'](_0xeb60('0x4a'),_0x417898[_0x4a2ef0]['name'],_0x417898[_0x4a2ef0][_0xeb60('0x45')]);}}for(_0x196bb3=0x0,_0x4a2ef0;_0x196bb3<_0x3f632b[_0xeb60('0x42')]&&!_0x41f3b1;_0x196bb3+=0x1){_0x4a2ef0=_0x3f632b[_0x196bb3][_0xeb60('0x3d')]();if(manager[_0xeb60('0x3f')](_0x4a2ef0)){if(_0x417898[_0x4a2ef0]['cron']&&_0x417898[_0x4a2ef0][_0xeb60('0x4b')]&&moment()['isBetween'](_0x417898[_0x4a2ef0][_0xeb60('0x4c')],_0x417898[_0x4a2ef0][_0xeb60('0x47')])){manager['update'](_0x4a2ef0,_0x417898[_0x4a2ef0][_0xeb60('0x45')],handleJob(_0x417898[_0x4a2ef0]));logger[_0xeb60('0x26')](_0xeb60('0x4d'),_0x417898[_0x4a2ef0]['name'],_0x417898[_0x4a2ef0][_0xeb60('0x45')]);}else{manager[_0xeb60('0x40')](_0x4a2ef0);manager[_0xeb60('0x4e')](_0x4a2ef0);logger[_0xeb60('0x26')](_0xeb60('0x4a'),_0x417898[_0x4a2ef0][_0xeb60('0x2f')],_0x417898[_0x4a2ef0][_0xeb60('0x45')]);}}}})[_0xeb60('0x27')](function(_0x3e4983){logger[_0xeb60('0x24')](JSON['stringify'](_0x3e4983));});}exports[_0xeb60('0x4f')]=function(_0x4bc6d0){return getJobs(_0x4bc6d0);};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 27cd32d..d783d37 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 _0x5706=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','inspect','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[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','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','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured'];(function(_0x12fbba,_0x17c539){var _0x457631=function(_0x103a9a){while(--_0x103a9a){_0x12fbba['push'](_0x12fbba['shift']());}};_0x457631(++_0x17c539);}(_0x5706,0xb0));var _0x6570=function(_0x107b80,_0x213516){_0x107b80=_0x107b80-0x0;var _0x4282b9=_0x5706[_0x107b80];return _0x4282b9;};var _=require(_0x6570('0x0'));var AWS=require(_0x6570('0x1'));var rp=require(_0x6570('0x2'));var util=require('util');var BPromise=require(_0x6570('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6570('0x4'))(_0x6570('0x5'));function getTranscriptionJob(_0x95a926,_0x26e23c,_0x41adac,_0x14d076){return new Promise(function(_0x3ae2f1,_0x3eb22a){var _0x140ee2=new AWS[(_0x6570('0x6'))]({'accessKeyId':_0x26e23c,'secretAccessKey':_0x95a926,'region':_0x41adac});_0x140ee2['getTranscriptionJob']({'TranscriptionJobName':_0x14d076},function(_0x594eef,_0x2310ad){if(_0x594eef){return _0x3eb22a(_0x594eef);}else{return _0x3ae2f1(_0x2310ad);}});});}function sentiment(_0x39ed59,_0x28e7a4,_0x312455,_0x2dde4e,_0x3cb988){return new Promise(function(_0x4aaf60,_0x4b4581){var _0x5b71be=new AWS[(_0x6570('0x7'))]({'accessKeyId':_0x28e7a4,'secretAccessKey':_0x39ed59,'region':_0x312455});_0x5b71be[_0x6570('0x8')]({'Text':_0x2dde4e,'LanguageCode':_0x3cb988[_0x6570('0x9')](0x0,0x2)},function(_0x3c768f,_0x435809){if(_0x3c768f){return _0x4b4581(_0x3c768f);}else{return _0x4aaf60(_0x435809);}});});}function checkTranscribeJob(_0x2d0d0f,_0xc903eb,_0x3098d5){var _0x90499d;return new BPromise(function(_0x4a6fb8,_0xdc293b){logger[_0x6570('0xa')](util[_0x6570('0xb')](_0x6570('0xc'),_0x2d0d0f['id'],_0x2d0d0f[_0x6570('0xd')]));return getTranscriptionJob(_0x3098d5[_0x6570('0xe')],_0x3098d5[_0x6570('0xf')],_0xc903eb[_0x6570('0x10')],_0x2d0d0f[_0x6570('0xd')])[_0x6570('0x11')](function(_0x1861c4){logger[_0x6570('0xa')](util['format'](_0x6570('0x12'),_0x2d0d0f['id'],_0x2d0d0f['transcribeName'],_0x1861c4[_0x6570('0x13')][_0x6570('0x14')]));if(!_0x2d0d0f[_0x6570('0x15')]){switch(_0x1861c4[_0x6570('0x13')][_0x6570('0x14')]){case _0x6570('0x16'):var _0x26af5b={'transcribeStatus':_0x1861c4[_0x6570('0x13')][_0x6570('0x14')],'fileUri':_0x1861c4['TranscriptionJob'][_0x6570('0x17')][_0x6570('0x18')]};logger[_0x6570('0xa')](util[_0x6570('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x2d0d0f['id']));return rp({'uri':_0x1861c4[_0x6570('0x13')][_0x6570('0x17')][_0x6570('0x18')],'json':!![]})[_0x6570('0x11')](function(_0x59c604){logger['info'](util['format'](_0x6570('0x19'),_0x2d0d0f['id']));if(_0x59c604&&_0x59c604['results']&&_0x59c604[_0x6570('0x1a')][_0x6570('0x1b')]&&_0x59c604[_0x6570('0x1a')]['transcripts']['length']){_0x26af5b[_0x6570('0x15')]='';for(var _0x5778e1=0x0;_0x5778e1<_0x59c604[_0x6570('0x1a')]['transcripts'][_0x6570('0x1c')];_0x5778e1++){_0x26af5b[_0x6570('0x15')]+=_0x59c604['results']['transcripts'][_0x5778e1][_0x6570('0x1d')]+'';}}return _0x2d0d0f[_0x6570('0x1e')](_0x26af5b);})['then'](function(){logger[_0x6570('0xa')](util[_0x6570('0xb')](_0x6570('0x1f'),_0x2d0d0f['id']));if(!_0x2d0d0f[_0x6570('0x20')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))](_0x6570('0x23'));}if(!_0xc903eb[_0x6570('0x24')]||!_0xc903eb[_0x6570('0x25')]||!_0xc903eb['sentimentRegion']||!_0xc903eb[_0x6570('0x26')]||!_0xc903eb[_0x6570('0x27')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))](_0x6570('0x28'));}if(!_0x26af5b[_0x6570('0x15')]){throw new Error(_0x6570('0x29'));}if(_0xc903eb['sentimentAccountId']===_0x3098d5['id']){return _0x3098d5;}else{return db[_0x6570('0x2a')][_0x6570('0x2b')]({'where':{'id':_settings[_0x6570('0x25')]}});}})['then'](function(_0x4ffc70){if(!_0x4ffc70){throw new db['Sequelize'][(_0x6570('0x22'))](_0x6570('0x2c'));}if(!_0x4ffc70[_0x6570('0xe')]||!_0x4ffc70[_0x6570('0xf')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))](_0x6570('0x2d'));}_0x90499d=_0x4ffc70;logger[_0x6570('0xa')](util[_0x6570('0xb')](_0x6570('0x2e'),_0x2d0d0f['id']));return sentiment(_0x90499d[_0x6570('0xe')],_0x90499d[_0x6570('0xf')],_0xc903eb['sentimentRegion'],_0x26af5b[_0x6570('0x15')],_0xc903eb[_0x6570('0x26')]);})[_0x6570('0x11')](function(_0x14fdb0){logger[_0x6570('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2d0d0f['id']));return _0x2d0d0f[_0x6570('0x1e')]({'sentiment':_0x14fdb0['Sentiment'],'sPositive':_0x14fdb0['SentimentScore'][_0x6570('0x2f')],'sNegative':_0x14fdb0[_0x6570('0x30')][_0x6570('0x31')],'sMixed':_0x14fdb0[_0x6570('0x30')][_0x6570('0x32')],'sNeutral':_0x14fdb0[_0x6570('0x30')][_0x6570('0x33')]});})[_0x6570('0x11')](function(){logger[_0x6570('0xa')](util[_0x6570('0xb')](_0x6570('0x1f'),_0x2d0d0f['id']));_0x4a6fb8();});case _0x6570('0x34'):return _0x2d0d0f[_0x6570('0x1e')]({'transcribeStatus':_0x6570('0x34'),'failureReason':_0x1861c4[_0x6570('0x13')][_0x6570('0x35')]})[_0x6570('0x11')](function(){logger['info'](util['format'](_0x6570('0x1f'),_0x2d0d0f['id']));_0x4a6fb8();});default:logger['info'](util[_0x6570('0xb')](_0x6570('0x36'),_0x2d0d0f['id']));break;}}else{return BPromise[_0x6570('0x37')]()[_0x6570('0x11')](function(){if(!_0x2d0d0f[_0x6570('0x20')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xc903eb[_0x6570('0x24')]||!_0xc903eb[_0x6570('0x25')]||!_0xc903eb['sentimentRegion']||!_0xc903eb[_0x6570('0x26')]||!_0xc903eb[_0x6570('0x27')]){throw new db['Sequelize'][(_0x6570('0x22'))](_0x6570('0x28'));}if(!_0x2d0d0f['fileText']){throw new Error(_0x6570('0x29'));}if(_0xc903eb[_0x6570('0x25')]===_0x3098d5['id']){return _0x3098d5;}else{return db['CloudProvider'][_0x6570('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6570('0x11')](function(_0x1936f5){if(!_0x1936f5){throw new db['Sequelize']['ValidationError'](_0x6570('0x2c'));}if(!_0x1936f5[_0x6570('0xe')]||!_0x1936f5[_0x6570('0xf')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))](_0x6570('0x2d'));}_0x90499d=_0x1936f5;logger['info'](util[_0x6570('0xb')](_0x6570('0x2e'),_0x2d0d0f['id']));return sentiment(_0x90499d[_0x6570('0xe')],_0x90499d[_0x6570('0xf')],_0xc903eb['sentimentRegion'],_0x2d0d0f[_0x6570('0x15')],_0xc903eb[_0x6570('0x26')]);})['then'](function(_0x3597a8){logger[_0x6570('0xa')](util['format'](_0x6570('0x38'),_0x2d0d0f['id']));return _0x2d0d0f['update']({'sentiment':_0x3597a8[_0x6570('0x39')],'sPositive':_0x3597a8[_0x6570('0x30')][_0x6570('0x2f')],'sNegative':_0x3597a8[_0x6570('0x30')][_0x6570('0x31')],'sMixed':_0x3597a8['SentimentScore']['Mixed'],'sNeutral':_0x3597a8[_0x6570('0x30')]['Neutral'],'transcribeStatus':_0x6570('0x16')});})[_0x6570('0x11')](function(){logger['info'](util[_0x6570('0xb')](_0x6570('0x1f'),_0x2d0d0f['id']));_0x4a6fb8();});}})['catch'](function(_0x333ac9){if(_0x333ac9){if(!_0x333ac9[_0x6570('0x3a')]||_0x333ac9[_0x6570('0x3a')]!==_0x6570('0x3b')){logger[_0x6570('0x3c')](util[_0x6570('0xb')](_0x6570('0x3d'),_0x2d0d0f['id']),util['inspect'](_0x333ac9,{'showHidden':![],'depth':null}));}}_0x4a6fb8();});});}function checkTranscribe(){var _0x30ec4e;var _0x26b247;var _0x50cb76;return db['VoiceRecording'][_0x6570('0x3e')]({'where':{'transcribeStatus':_0x6570('0x3f')}})[_0x6570('0x11')](function(_0x5c8c68){if(!_0x5c8c68||!_0x5c8c68['length']){throw new db[(_0x6570('0x21'))]['ValidationError'](_0x6570('0x40'));}_0x30ec4e=_0x5c8c68;return db[_0x6570('0x41')][_0x6570('0x2b')]({'where':{'id':0x1}});})[_0x6570('0x11')](function(_0x444f6d){if(!_0x444f6d){throw new db['Sequelize'][(_0x6570('0x22'))]('Settings\x20not\x20available');}_0x26b247=_0x444f6d;if(!_0x26b247[_0x6570('0x5')]||!_0x26b247[_0x6570('0x42')]||!_0x26b247[_0x6570('0x10')]||!_0x26b247['language']||!_0x26b247[_0x6570('0x27')]){throw new db['Sequelize'][(_0x6570('0x22'))](_0x6570('0x43'));}return db[_0x6570('0x2a')][_0x6570('0x2b')]({'where':{'id':_0x26b247[_0x6570('0x42')]}});})[_0x6570('0x11')](function(_0x3b58db){if(!_0x3b58db){throw new db['Sequelize'][(_0x6570('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3b58db[_0x6570('0xe')]||!_0x3b58db[_0x6570('0xf')]){throw new db[(_0x6570('0x21'))][(_0x6570('0x22'))](_0x6570('0x2d'));}_0x50cb76=_0x3b58db;var _0x4c91e8=[];_0x30ec4e[_0x6570('0x44')](function(_0x4c33f0){_0x4c91e8[_0x6570('0x45')](checkTranscribeJob(_0x4c33f0,_0x26b247,_0x50cb76));});return BPromise[_0x6570('0x46')](_0x4c91e8);})[_0x6570('0x47')](function(_0x10e8ce){if(_0x10e8ce){if(!_0x10e8ce[_0x6570('0x3a')]||_0x10e8ce['name']!==_0x6570('0x3b')){logger[_0x6570('0x3c')](util[_0x6570('0x48')](_0x10e8ce,{'showHidden':![],'depth':null}));}}});}exports[_0x6570('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2d93=['Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Transcript\x20not\x20available','Mixed','catch','name','SequelizeValidationError','error','inspect','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','update','then','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne'];(function(_0x47330e,_0x36c364){var _0x2d82f4=function(_0x43c311){while(--_0x43c311){_0x47330e['push'](_0x47330e['shift']());}};_0x2d82f4(++_0x36c364);}(_0x2d93,0xf3));var _0x32d9=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x2d93[_0x3c6dce];return _0x1450e9;};var _=require(_0x32d9('0x0'));var AWS=require(_0x32d9('0x1'));var rp=require(_0x32d9('0x2'));var util=require(_0x32d9('0x3'));var BPromise=require(_0x32d9('0x4'));var db=require(_0x32d9('0x5'))['db'];var logger=require(_0x32d9('0x6'))(_0x32d9('0x7'));function getTranscriptionJob(_0x395372,_0x80afe8,_0x423f4d,_0x21a3d7){return new Promise(function(_0x9b4979,_0x3529db){var _0x4d2424=new AWS[(_0x32d9('0x8'))]({'accessKeyId':_0x80afe8,'secretAccessKey':_0x395372,'region':_0x423f4d});_0x4d2424[_0x32d9('0x9')]({'TranscriptionJobName':_0x21a3d7},function(_0x42cec8,_0x43dd2c){if(_0x42cec8){return _0x3529db(_0x42cec8);}else{return _0x9b4979(_0x43dd2c);}});});}function sentiment(_0x2b5cc7,_0x521d15,_0x21df58,_0x46603b,_0x1d5f25){return new Promise(function(_0x3bb144,_0x2babbf){var _0x312988=new AWS[(_0x32d9('0xa'))]({'accessKeyId':_0x521d15,'secretAccessKey':_0x2b5cc7,'region':_0x21df58});_0x312988[_0x32d9('0xb')]({'Text':_0x46603b,'LanguageCode':_0x1d5f25[_0x32d9('0xc')](0x0,0x2)},function(_0x5efb8f,_0x1befe0){if(_0x5efb8f){return _0x2babbf(_0x5efb8f);}else{return _0x3bb144(_0x1befe0);}});});}function checkTranscribeJob(_0x5b7bab,_0x5afced,_0x16e983){var _0x3ae057;return new BPromise(function(_0x1eb32f,_0x2323f2){logger[_0x32d9('0xd')](util[_0x32d9('0xe')](_0x32d9('0xf'),_0x5b7bab['id'],_0x5b7bab[_0x32d9('0x10')]));return getTranscriptionJob(_0x16e983[_0x32d9('0x11')],_0x16e983[_0x32d9('0x12')],_0x5afced[_0x32d9('0x13')],_0x5b7bab[_0x32d9('0x10')])['then'](function(_0x251b58){logger[_0x32d9('0xd')](util['format'](_0x32d9('0x14'),_0x5b7bab['id'],_0x5b7bab[_0x32d9('0x10')],_0x251b58[_0x32d9('0x15')][_0x32d9('0x16')]));if(!_0x5b7bab[_0x32d9('0x17')]){switch(_0x251b58[_0x32d9('0x15')][_0x32d9('0x16')]){case _0x32d9('0x18'):var _0x1b006a={'transcribeStatus':_0x251b58[_0x32d9('0x15')]['TranscriptionJobStatus'],'fileUri':_0x251b58['TranscriptionJob'][_0x32d9('0x19')][_0x32d9('0x1a')]};logger['info'](util[_0x32d9('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0x5b7bab['id']));return rp({'uri':_0x251b58[_0x32d9('0x15')][_0x32d9('0x19')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x3e2ef3){logger[_0x32d9('0xd')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5b7bab['id']));if(_0x3e2ef3&&_0x3e2ef3[_0x32d9('0x1b')]&&_0x3e2ef3[_0x32d9('0x1b')][_0x32d9('0x1c')]&&_0x3e2ef3[_0x32d9('0x1b')][_0x32d9('0x1c')]['length']){_0x1b006a[_0x32d9('0x17')]='';for(var _0x1c51a8=0x0;_0x1c51a8<_0x3e2ef3[_0x32d9('0x1b')][_0x32d9('0x1c')]['length'];_0x1c51a8++){_0x1b006a[_0x32d9('0x17')]+=_0x3e2ef3[_0x32d9('0x1b')][_0x32d9('0x1c')][_0x1c51a8]['transcript']+'';}}return _0x5b7bab[_0x32d9('0x1d')](_0x1b006a);})[_0x32d9('0x1e')](function(){logger[_0x32d9('0xd')](util[_0x32d9('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7bab['id']));if(!_0x5b7bab[_0x32d9('0x1f')]){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))](_0x32d9('0x22'));}if(!_0x5afced['sentiment']||!_0x5afced['sentimentAccountId']||!_0x5afced['sentimentRegion']||!_0x5afced[_0x32d9('0x23')]||!_0x5afced[_0x32d9('0x24')]){throw new db[(_0x32d9('0x20'))]['ValidationError'](_0x32d9('0x25'));}if(!_0x1b006a[_0x32d9('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x5afced[_0x32d9('0x26')]===_0x16e983['id']){return _0x16e983;}else{return db[_0x32d9('0x27')][_0x32d9('0x28')]({'where':{'id':_settings[_0x32d9('0x26')]}});}})[_0x32d9('0x1e')](function(_0x4fa4e1){if(!_0x4fa4e1){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))](_0x32d9('0x29'));}if(!_0x4fa4e1[_0x32d9('0x11')]||!_0x4fa4e1['data2']){throw new db[(_0x32d9('0x20'))]['ValidationError'](_0x32d9('0x2a'));}_0x3ae057=_0x4fa4e1;logger[_0x32d9('0xd')](util[_0x32d9('0xe')](_0x32d9('0x2b'),_0x5b7bab['id']));return sentiment(_0x3ae057[_0x32d9('0x11')],_0x3ae057[_0x32d9('0x12')],_0x5afced[_0x32d9('0x2c')],_0x1b006a[_0x32d9('0x17')],_0x5afced[_0x32d9('0x23')]);})['then'](function(_0x3302d0){logger[_0x32d9('0xd')](util[_0x32d9('0xe')](_0x32d9('0x2d'),_0x5b7bab['id']));return _0x5b7bab[_0x32d9('0x1d')]({'sentiment':_0x3302d0[_0x32d9('0x2e')],'sPositive':_0x3302d0[_0x32d9('0x2f')][_0x32d9('0x30')],'sNegative':_0x3302d0[_0x32d9('0x2f')][_0x32d9('0x31')],'sMixed':_0x3302d0['SentimentScore']['Mixed'],'sNeutral':_0x3302d0[_0x32d9('0x2f')][_0x32d9('0x32')]});})[_0x32d9('0x1e')](function(){logger[_0x32d9('0xd')](util[_0x32d9('0xe')](_0x32d9('0x33'),_0x5b7bab['id']));_0x1eb32f();});case _0x32d9('0x34'):return _0x5b7bab[_0x32d9('0x1d')]({'transcribeStatus':_0x32d9('0x34'),'failureReason':_0x251b58[_0x32d9('0x15')]['FailureReason']})[_0x32d9('0x1e')](function(){logger['info'](util['format'](_0x32d9('0x33'),_0x5b7bab['id']));_0x1eb32f();});default:logger[_0x32d9('0xd')](util['format'](_0x32d9('0x35'),_0x5b7bab['id']));break;}}else{return BPromise['resolve']()[_0x32d9('0x1e')](function(){if(!_0x5b7bab[_0x32d9('0x1f')]){throw new db[(_0x32d9('0x20'))]['ValidationError'](_0x32d9('0x22'));}if(!_0x5afced[_0x32d9('0x36')]||!_0x5afced[_0x32d9('0x26')]||!_0x5afced[_0x32d9('0x2c')]||!_0x5afced[_0x32d9('0x23')]||!_0x5afced[_0x32d9('0x24')]){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5b7bab['fileText']){throw new Error(_0x32d9('0x37'));}if(_0x5afced[_0x32d9('0x26')]===_0x16e983['id']){return _0x16e983;}else{return db['CloudProvider'][_0x32d9('0x28')]({'where':{'id':_settings[_0x32d9('0x26')]}});}})[_0x32d9('0x1e')](function(_0x261c27){if(!_0x261c27){throw new db['Sequelize']['ValidationError'](_0x32d9('0x29'));}if(!_0x261c27[_0x32d9('0x11')]||!_0x261c27[_0x32d9('0x12')]){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))](_0x32d9('0x2a'));}_0x3ae057=_0x261c27;logger[_0x32d9('0xd')](util[_0x32d9('0xe')](_0x32d9('0x2b'),_0x5b7bab['id']));return sentiment(_0x3ae057[_0x32d9('0x11')],_0x3ae057['data2'],_0x5afced[_0x32d9('0x2c')],_0x5b7bab['fileText'],_0x5afced[_0x32d9('0x23')]);})[_0x32d9('0x1e')](function(_0x209a05){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5b7bab['id']));return _0x5b7bab[_0x32d9('0x1d')]({'sentiment':_0x209a05[_0x32d9('0x2e')],'sPositive':_0x209a05['SentimentScore'][_0x32d9('0x30')],'sNegative':_0x209a05['SentimentScore'][_0x32d9('0x31')],'sMixed':_0x209a05['SentimentScore'][_0x32d9('0x38')],'sNeutral':_0x209a05[_0x32d9('0x2f')][_0x32d9('0x32')],'transcribeStatus':_0x32d9('0x18')});})[_0x32d9('0x1e')](function(){logger['info'](util[_0x32d9('0xe')](_0x32d9('0x33'),_0x5b7bab['id']));_0x1eb32f();});}})[_0x32d9('0x39')](function(_0x5d48e4){if(_0x5d48e4){if(!_0x5d48e4[_0x32d9('0x3a')]||_0x5d48e4[_0x32d9('0x3a')]!==_0x32d9('0x3b')){logger[_0x32d9('0x3c')](util[_0x32d9('0xe')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5b7bab['id']),util[_0x32d9('0x3d')](_0x5d48e4,{'showHidden':![],'depth':null}));}}_0x1eb32f();});});}function checkTranscribe(){var _0x137976;var _0x21ccf9;var _0x433d90;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x32d9('0x3e')}})[_0x32d9('0x1e')](function(_0x387e6c){if(!_0x387e6c||!_0x387e6c[_0x32d9('0x3f')]){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))](_0x32d9('0x40'));}_0x137976=_0x387e6c;return db[_0x32d9('0x41')]['findOne']({'where':{'id':0x1}});})[_0x32d9('0x1e')](function(_0x1d7425){if(!_0x1d7425){throw new db[(_0x32d9('0x20'))]['ValidationError']('Settings\x20not\x20available');}_0x21ccf9=_0x1d7425;if(!_0x21ccf9[_0x32d9('0x7')]||!_0x21ccf9[_0x32d9('0x42')]||!_0x21ccf9[_0x32d9('0x13')]||!_0x21ccf9[_0x32d9('0x23')]||!_0x21ccf9[_0x32d9('0x24')]){throw new db[(_0x32d9('0x20'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x32d9('0x27')][_0x32d9('0x28')]({'where':{'id':_0x21ccf9['transcribeAccountId']}});})[_0x32d9('0x1e')](function(_0x284127){if(!_0x284127){throw new db['Sequelize'][(_0x32d9('0x21'))](_0x32d9('0x29'));}if(!_0x284127[_0x32d9('0x11')]||!_0x284127[_0x32d9('0x12')]){throw new db[(_0x32d9('0x20'))][(_0x32d9('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x433d90=_0x284127;var _0x25d06b=[];_0x137976[_0x32d9('0x43')](function(_0x3754d6){_0x25d06b[_0x32d9('0x44')](checkTranscribeJob(_0x3754d6,_0x21ccf9,_0x433d90));});return BPromise[_0x32d9('0x45')](_0x25d06b);})['catch'](function(_0x1cc96b){if(_0x1cc96b){if(!_0x1cc96b[_0x32d9('0x3a')]||_0x1cc96b[_0x32d9('0x3a')]!==_0x32d9('0x3b')){logger[_0x32d9('0x3c')](util[_0x32d9('0x3d')](_0x1cc96b,{'showHidden':![],'depth':null}));}}});}exports[_0x32d9('0x46')]=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 0896982..aa79eed 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 _0x5a02=['WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','length','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost'];(function(_0x689fb4,_0x30844d){var _0x5a6d16=function(_0x998791){while(--_0x998791){_0x689fb4['push'](_0x689fb4['shift']());}};_0x5a6d16(++_0x30844d);}(_0x5a02,0x152));var _0x25a0=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x5a02[_0x28b0a4];return _0x105ce6;};'use strict';var _=require('lodash');var moment=require(_0x25a0('0x0'));var Redis=require(_0x25a0('0x1'));var util=require(_0x25a0('0x2'));var config=require(_0x25a0('0x3'));var db=require(_0x25a0('0x4'))['db'];var logger=require(_0x25a0('0x5'))(_0x25a0('0x6'));config[_0x25a0('0x7')]=_[_0x25a0('0x8')](config[_0x25a0('0x7')],{'host':_0x25a0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x24e5cf=[];return db[_0x25a0('0xa')][_0x25a0('0xb')]({'raw':!![],'attributes':['id',_0x25a0('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x25a0('0xd')](0x18,_0x25a0('0xe'))}}})[_0x25a0('0xf')](function(_0x205c90){if(_0x205c90&&_0x205c90['length']){_0x24e5cf=_[_0x25a0('0x10')](_0x205c90||[],'id');logger[_0x25a0('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x24e5cf[_0x25a0('0x12')]());return db[_0x25a0('0xa')][_0x25a0('0x13')]({'closeReason':'system','disposition':_0x25a0('0x14'),'closed':!![],'closedAt':moment()['format'](_0x25a0('0x15'))},{'where':{'id':_0x24e5cf}});}})['then'](function(){if(_0x24e5cf&&_0x24e5cf[_0x25a0('0x16')]){logger[_0x25a0('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x24e5cf[_0x25a0('0x12')]());for(var _0x156f76=0x0;_0x156f76<_0x24e5cf[_0x25a0('0x16')];_0x156f76++){io['emit'](_0x25a0('0x17'),{'id':_0x24e5cf[_0x156f76],'closed':!![]});}}})[_0x25a0('0x18')](function(_0x2c5e99){logger[_0x25a0('0x19')](_0x25a0('0x1a'),_0x2c5e99?util[_0x25a0('0x1b')](_0x2c5e99,{'showHidden':![],'depth':null}):'');});}exports[_0x25a0('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x94ff=['socket.io-emitter','subtract','hours','then','length','map','info','WhatsappInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','defaults','redis','localhost'];(function(_0x398070,_0x18bebc){var _0x14fc28=function(_0x550ba0){while(--_0x550ba0){_0x398070['push'](_0x398070['shift']());}};_0x14fc28(++_0x18bebc);}(_0x94ff,0x83));var _0xf94f=function(_0x59d8a9,_0x25be7d){_0x59d8a9=_0x59d8a9-0x0;var _0x9934b8=_0x94ff[_0x59d8a9];return _0x9934b8;};'use strict';var _=require(_0xf94f('0x0'));var moment=require(_0xf94f('0x1'));var Redis=require(_0xf94f('0x2'));var util=require(_0xf94f('0x3'));var config=require(_0xf94f('0x4'));var db=require(_0xf94f('0x5'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xf94f('0x6')](config[_0xf94f('0x7')],{'host':_0xf94f('0x8'),'port':0x18eb});var io=require(_0xf94f('0x9'))(new Redis(config[_0xf94f('0x7')]));function closeInteractions(){var _0x4091c3=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf94f('0xa')](0x18,_0xf94f('0xb'))}}})[_0xf94f('0xc')](function(_0x2a07ab){if(_0x2a07ab&&_0x2a07ab[_0xf94f('0xd')]){_0x4091c3=_[_0xf94f('0xe')](_0x2a07ab||[],'id');logger[_0xf94f('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4091c3['join']());return db[_0xf94f('0x10')]['update']({'closeReason':'system','disposition':_0xf94f('0x11'),'closed':!![],'closedAt':moment()[_0xf94f('0x12')](_0xf94f('0x13'))},{'where':{'id':_0x4091c3}});}})[_0xf94f('0xc')](function(){if(_0x4091c3&&_0x4091c3[_0xf94f('0xd')]){logger[_0xf94f('0xf')](_0xf94f('0x14'),_0x4091c3[_0xf94f('0x15')]());for(var _0x11254a=0x0;_0x11254a<_0x4091c3['length'];_0x11254a++){io['emit'](_0xf94f('0x16'),{'id':_0x4091c3[_0x11254a],'closed':!![]});}}})[_0xf94f('0x17')](function(_0x25cdc6){logger[_0xf94f('0x18')](_0xf94f('0x19'),_0x25cdc6?util[_0xf94f('0x1a')](_0x25cdc6,{'showHidden':![],'depth':null}):'');});}exports[_0xf94f('0x1b')]=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 bb85f60..88cf1fa 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadbe=['destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0x3aa544,_0x80ad0a){var _0x2a52d3=function(_0x37db1f){while(--_0x37db1f){_0x3aa544['push'](_0x3aa544['shift']());}};_0x2a52d3(++_0x80ad0a);}(_0xadbe,0xd5));var _0xeadb=function(_0x938aba,_0x4ec9a9){_0x938aba=_0x938aba-0x0;var _0x1d61b6=_0xadbe[_0x938aba];return _0x1d61b6;};'use strict';var util=require(_0xeadb('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xeadb('0x1')]({'id':i,'firstName':_0xeadb('0x2')+i,'lastName':_0xeadb('0x3')+i,'phone':0xf879fb460+i,'email':_0xeadb('0x4')+i+_0xeadb('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xeadb('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xeadb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xeadb('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xeadb('0x2')+i,'lastName':_0xeadb('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xeadb('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xeadb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xeadb('0x6')](),'updatedAt':Date[_0xeadb('0x6')]()});}db[_0xeadb('0x7')][_0xeadb('0x8')]({'where':{}})[_0xeadb('0x9')](function(){return db[_0xeadb('0x7')][_0xeadb('0xa')](contacts);})['then'](function(){console[_0xeadb('0xb')](_0xeadb('0xc'),_0xeadb('0xd'));return db[_0xeadb('0xe')]['destroy']({'where':{}});})[_0xeadb('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0xeadb('0xb')](_0xeadb('0xc'),_0xeadb('0xf'));return db[_0xeadb('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0xeadb('0xb')](_0xeadb('0xc'),_0xeadb('0x10'));return db[_0xeadb('0xe')][_0xeadb('0xa')](hopper2);})[_0xeadb('0x9')](function(){console['log'](_0xeadb('0xc'),'hopper2');})['catch'](function(_0x35bd76){console[_0xeadb('0xb')](_0x35bd76);}); \ No newline at end of file +var _0x09ca=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','CmContact','hopper2','catch'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x09ca,0x1b5));var _0xa09c=function(_0x166aff,_0x554d46){_0x166aff=_0x166aff-0x0;var _0x2948cc=_0x09ca[_0x166aff];return _0x2948cc;};'use strict';var util=require(_0xa09c('0x0'));var db=require(_0xa09c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa09c('0x2')]({'id':i,'firstName':_0xa09c('0x3')+i,'lastName':_0xa09c('0x4')+i,'phone':0xf879fb460+i,'email':_0xa09c('0x5')+i+_0xa09c('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa09c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa09c('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa09c('0x7')](),'updatedAt':Date[_0xa09c('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa09c('0x2')]({'id':i,'firstName':_0xa09c('0x3')+i,'lastName':_0xa09c('0x4')+i,'phone':0xf879fb460+i,'email':_0xa09c('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa09c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa09c('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa09c('0x7')](),'updatedAt':Date[_0xa09c('0x7')]()});}db['CmContact'][_0xa09c('0x8')]({'where':{}})[_0xa09c('0x9')](function(){return db['CmContact'][_0xa09c('0xa')](contacts);})[_0xa09c('0x9')](function(){console['log'](_0xa09c('0xb'),_0xa09c('0xc'));return db[_0xa09c('0xd')]['destroy']({'where':{}});})['then'](function(){return db[_0xa09c('0xd')][_0xa09c('0xa')](hopper);})['then'](function(){console[_0xa09c('0xe')]('finished\x20populating',_0xa09c('0xf'));return db[_0xa09c('0x10')]['bulkCreate'](contacts2);})[_0xa09c('0x9')](function(){console['log'](_0xa09c('0xb'),'contacts2');return db[_0xa09c('0xd')][_0xa09c('0xa')](hopper2);})[_0xa09c('0x9')](function(){console['log']('finished\x20populating',_0xa09c('0x11'));})[_0xa09c('0x12')](function(_0x1abf10){console[_0xa09c('0xe')](_0x1abf10);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 88d93db..64bf1ef 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77af=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','format','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x14f946,_0x4fa7c6){var _0x344c47=function(_0x3b288b){while(--_0x3b288b){_0x14f946['push'](_0x14f946['shift']());}};_0x344c47(++_0x4fa7c6);}(_0x77af,0x140));var _0xf77a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x77af[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xf77a('0x0'));var db=require(_0xf77a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf77a('0x2')]({'name':util['format']('%s%s','agent',i),'fullname':util['format'](_0xf77a('0x3'),_0xf77a('0x4'),i),'email':util['format'](_0xf77a('0x5'),_0xf77a('0x4'),i),'role':'agent','password':_0xf77a('0x6'),'internal':0xfa0+i,'type':_0xf77a('0x7'),'transport':[_0xf77a('0x8'),'ws',_0xf77a('0x9')],'disallow':[_0xf77a('0xa')],'allow':[_0xf77a('0xb')],'defaultuser':util[_0xf77a('0xc')](_0xf77a('0x3'),'agent',i),'encryption':_0xf77a('0xd'),'avpf':_0xf77a('0xd'),'force_avp':_0xf77a('0xd'),'icesupport':_0xf77a('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xf77a('0xe'),'dtlsprivatekey':_0xf77a('0xf'),'dtlssetup':_0xf77a('0x10'),'callerid':util[_0xf77a('0xc')](_0xf77a('0x11'),util['format'](_0xf77a('0x3'),_0xf77a('0x4'),i),0xfa0+i)});}db[_0xf77a('0x12')][_0xf77a('0x13')](users)[_0xf77a('0x14')](function(){console[_0xf77a('0x15')](_0xf77a('0x16'));})[_0xf77a('0x17')](function(_0x34040c){console[_0xf77a('0x15')](_0x34040c);}); \ No newline at end of file +var _0xb3d6=['%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format'];(function(_0x2cce0c,_0x4cd182){var _0x83cc43=function(_0x756a6c){while(--_0x756a6c){_0x2cce0c['push'](_0x2cce0c['shift']());}};_0x83cc43(++_0x4cd182);}(_0xb3d6,0x162));var _0x6b3d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb3d6[_0x432682];return _0x463d05;};'use strict';var util=require(_0x6b3d('0x0'));var db=require(_0x6b3d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x6b3d('0x2')](_0x6b3d('0x3'),_0x6b3d('0x4'),i),'fullname':util['format'](_0x6b3d('0x3'),_0x6b3d('0x4'),i),'email':util[_0x6b3d('0x2')]('%s%s@xcally.com',_0x6b3d('0x4'),i),'role':_0x6b3d('0x4'),'password':_0x6b3d('0x5'),'internal':0xfa0+i,'type':_0x6b3d('0x6'),'transport':[_0x6b3d('0x7'),'ws',_0x6b3d('0x8')],'disallow':[_0x6b3d('0x9')],'allow':[_0x6b3d('0xa')],'defaultuser':util[_0x6b3d('0x2')](_0x6b3d('0x3'),_0x6b3d('0x4'),i),'encryption':_0x6b3d('0xb'),'avpf':_0x6b3d('0xb'),'force_avp':_0x6b3d('0xb'),'icesupport':_0x6b3d('0xb'),'dtlsenable':_0x6b3d('0xb'),'dtlsverify':'no','dtlscertfile':_0x6b3d('0xc'),'dtlsprivatekey':_0x6b3d('0xd'),'dtlssetup':_0x6b3d('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x6b3d('0x2')](_0x6b3d('0x3'),_0x6b3d('0x4'),i),0xfa0+i)});}db[_0x6b3d('0xf')][_0x6b3d('0x10')](users)[_0x6b3d('0x11')](function(){console[_0x6b3d('0x12')](_0x6b3d('0x13'));})[_0x6b3d('0x14')](function(_0x2c54ee){console[_0x6b3d('0x12')](_0x2c54ee);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 11d8858..97486a5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x186d=['ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','ChatQueues','SmsQueues','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','log','address','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','findAll','IvrCampaigns','UserProfileResource','resourceId','map','User','where','telephone','Campaign','format','%s:queue:%s','length','user:%s','query','userProfileId','handshake','ChatInteraction'];(function(_0x46114d,_0x5e3007){var _0x4f9f4d=function(_0xcc2f11){while(--_0xcc2f11){_0x46114d['push'](_0x46114d['shift']());}};_0x4f9f4d(++_0x5e3007);}(_0x186d,0x1ca));var _0xd186=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x186d[_0x1428d9];return _0x438019;};'use strict';var _=require('lodash');var util=require(_0xd186('0x0'));var BPromise=require(_0xd186('0x1'));var db=require(_0xd186('0x2'))['db'];var config=require(_0xd186('0x3'));var queryQueues={'attributes':['id',_0xd186('0x4')],'include':[{'as':_0xd186('0x5'),'model':db['User'],'attributes':['id',_0xd186('0x4'),_0xd186('0x6')],'raw':!![],'where':{'role':_0xd186('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xd186('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xd186('0x4')],'where':{'role':_0xd186('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd186('0x8')],'where':{'type':_0xd186('0x9')}};function getAssociatedResources(_0xc486db,_0x4994e5,_0x1ef64a){return db[_0xd186('0xa')][_0xd186('0xb')]({'where':{'name':_0xc486db,'userProfileId':_0x4994e5},'raw':!![]})[_0xd186('0xc')](function(_0x39ad45){if(_0x39ad45){if(_0x39ad45[_0xd186('0xd')]){switch(_0xc486db){case'VoiceQueues':case'ChatQueues':case _0xd186('0xe'):case'SmsQueues':case _0xd186('0xf'):case _0xd186('0x10'):case _0xd186('0x11'):return db[_0x1ef64a]['findAll'](queryQueues);case _0xd186('0x12'):return db[_0x1ef64a]['findAll'](queryTelephones);case _0xd186('0x13'):return db[_0x1ef64a][_0xd186('0x14')](queryTrunks);case _0xd186('0x15'):return db[_0x1ef64a][_0xd186('0x14')](queryCampaigns);}}else{return db[_0xd186('0x16')][_0xd186('0x14')]({'attributes':[_0xd186('0x17')],'where':{'sectionId':_0x39ad45['id']},'raw':!![]})[_0xd186('0xc')](function(_0xc23af7){if(_0xc23af7){var _0xfb67a0={'where':{'id':_[_0xd186('0x18')](_0xc23af7,'resourceId')},'raw':!![]};switch(_0x1ef64a){case _0xd186('0x19'):_0xfb67a0[_0xd186('0x1a')][_0xd186('0x6')]=_0xd186('0x1b');break;case _0xd186('0x1c'):_0xfb67a0[_0xd186('0x1a')][_0xd186('0x8')]='ivr';break;}return db[_0x1ef64a][_0xd186('0x14')](_0xfb67a0);}else{return[];}});}}else{return[];}})[_0xd186('0xc')](function(_0x5471ff){return _0x5471ff;});}function joinOrLeaveQueues(_0xcded5d,_0x2276f1,_0x4f6f63,_0x5f460e){_0xcded5d[_0x2276f1](util[_0xd186('0x1d')](_0xd186('0x1e'),_0x4f6f63,_0x5f460e[_0xd186('0x4')]));if(_0x5f460e[_0xd186('0x5')]){for(var _0x363693=0x0;_0x363693<_0x5f460e['Agents'][_0xd186('0x1f')];_0x363693+=0x1){_0xcded5d[_0x2276f1](util[_0xd186('0x1d')](_0xd186('0x20'),_0x5f460e['Agents'][_0x363693]['name']));}}}function joinOrLeave(_0x114004,_0x1b5aae,_0x223bc7){var _0x5a5ff0;if(_0x114004['handshake'][_0xd186('0x21')]['id']){db[_0xd186('0x19')]['find']({'attributes':['id','name',_0xd186('0x6'),_0xd186('0x22')],'where':{'id':_0x114004[_0xd186('0x23')][_0xd186('0x21')]['id']},'include':[{'model':db[_0xd186('0x24')],'as':_0xd186('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd186('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd186('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd186('0x28')],'as':_0xd186('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd186('0x2a')],'as':_0xd186('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xd186('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xd186('0xc')](function(_0x27b95a){if(_0x27b95a){_0x5a5ff0=_0x27b95a;_0x114004[_0x1b5aae](util[_0xd186('0x1d')](_0xd186('0x20'),_0x27b95a[_0xd186('0x4')]));var _0x22202d=[];switch(_0x27b95a[_0xd186('0x6')]){case _0xd186('0x2d'):_0x114004[_0x1b5aae](_0xd186('0x2e'));_0x114004[_0x1b5aae](_0xd186('0x2f'));if(queryQueues[_0xd186('0x30')](_0xd186('0x31'))){delete queryQueues[_0xd186('0x31')];}_0x22202d[_0xd186('0x32')](db[_0xd186('0x33')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x34')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x35')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x36')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x37')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x38')][_0xd186('0x14')](queryQueues));_0x22202d['push'](db[_0xd186('0x39')][_0xd186('0x14')](queryQueues));_0x22202d[_0xd186('0x32')](db[_0xd186('0x19')][_0xd186('0x14')](queryTelephones));_0x22202d[_0xd186('0x32')](db[_0xd186('0x3a')][_0xd186('0x14')](queryTrunks));_0x22202d['push'](db[_0xd186('0x1c')][_0xd186('0x14')](queryCampaigns));_0x22202d[_0xd186('0x32')](db[_0xd186('0x19')][_0xd186('0x14')](queryAgents));break;case _0xd186('0x3b'):_0x114004[_0x1b5aae](_0xd186('0x2e'));_0x114004[_0x1b5aae](_0xd186('0x2f'));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0x3c'),_0x27b95a[_0xd186('0x22')],_0xd186('0x33')));_0x22202d['push'](getAssociatedResources(_0xd186('0x3d'),_0x27b95a[_0xd186('0x22')],'ChatQueue'));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0xe'),_0x27b95a[_0xd186('0x22')],_0xd186('0x35')));_0x22202d['push'](getAssociatedResources(_0xd186('0x3e'),_0x27b95a['userProfileId'],_0xd186('0x36')));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0xf'),_0x27b95a['userProfileId'],'MailQueue'));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0x10'),_0x27b95a['userProfileId'],'OpenchannelQueue'));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0x11'),_0x27b95a['userProfileId'],_0xd186('0x39')));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0x12'),_0x27b95a[_0xd186('0x22')],'User'));_0x22202d[_0xd186('0x32')](getAssociatedResources('Trunks',_0x27b95a[_0xd186('0x22')],'Trunk'));_0x22202d[_0xd186('0x32')](getAssociatedResources(_0xd186('0x15'),_0x27b95a[_0xd186('0x22')],'Campaign'));_0x22202d[_0xd186('0x32')](db[_0xd186('0x19')]['findAll'](queryAgents));break;case _0xd186('0x7'):_0x114004[_0x1b5aae](_0xd186('0x2e'));_0x114004[_0x1b5aae]('voice:outbound');_0x22202d['push'](_0x27b95a[_0xd186('0x3f')]({'attributes':['id','name']}));_0x22202d[_0xd186('0x32')](_0x27b95a['getChatQueues']({'attributes':['id','name']}));_0x22202d[_0xd186('0x32')](_0x27b95a[_0xd186('0x40')]({'attributes':['id','name']}));_0x22202d[_0xd186('0x32')](_0x27b95a[_0xd186('0x41')]({'attributes':['id','name']}));_0x22202d['push'](_0x27b95a[_0xd186('0x42')]({'attributes':['id',_0xd186('0x4')]}));_0x22202d[_0xd186('0x32')](_0x27b95a[_0xd186('0x43')]({'attributes':['id',_0xd186('0x4')]}));_0x22202d[_0xd186('0x32')](_0x27b95a[_0xd186('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0xd186('0x45')](_0x22202d);}})['then'](function(_0x414029){if(_0x414029&&_0x414029[_0xd186('0x1f')]){for(var _0x3cb411=0x0;_0x3cb411<_0x414029[_0xd186('0x1f')];_0x3cb411+=0x1){for(var _0x3b1b9b=0x0;_0x3b1b9b<_0x414029[_0x3cb411][_0xd186('0x1f')];_0x3b1b9b+=0x1){switch(_0x3cb411){case 0x0:joinOrLeaveQueues(_0x114004,_0x1b5aae,'voice',_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x1:joinOrLeaveQueues(_0x114004,_0x1b5aae,_0xd186('0x46'),_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x2:joinOrLeaveQueues(_0x114004,_0x1b5aae,_0xd186('0x47'),_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x3:joinOrLeaveQueues(_0x114004,_0x1b5aae,_0xd186('0x48'),_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x4:joinOrLeaveQueues(_0x114004,_0x1b5aae,_0xd186('0x49'),_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x5:joinOrLeaveQueues(_0x114004,_0x1b5aae,_0xd186('0x4a'),_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x6:joinOrLeaveQueues(_0x114004,_0x1b5aae,'whatsapp',_0x414029[_0x3cb411][_0x3b1b9b]);break;case 0x7:if(_0x5a5ff0['role']!==_0xd186('0x7'))_0x114004[_0x1b5aae](util[_0xd186('0x1d')]('telephone:%s',_0x414029[_0x3cb411][_0x3b1b9b][_0xd186('0x4')]));break;case 0x8:if(_0x5a5ff0[_0xd186('0x6')]!=='agent')_0x114004[_0x1b5aae](util[_0xd186('0x1d')]('trunk:%s',_0x414029[_0x3cb411][_0x3b1b9b][_0xd186('0x4')]));break;case 0x9:if(_0x5a5ff0['role']!==_0xd186('0x7'))_0x114004[_0x1b5aae](util[_0xd186('0x1d')](_0xd186('0x4b'),_0x414029[_0x3cb411][_0x3b1b9b][_0xd186('0x8')],_0x414029[_0x3cb411][_0x3b1b9b]['name']));break;case 0xa:_0x114004[_0x1b5aae](util[_0xd186('0x1d')](_0xd186('0x20'),_0x414029[_0x3cb411][_0x3b1b9b][_0xd186('0x4')]));break;}}}}})['then'](function(){if(_0x1b5aae==='leave'){var _0x2a8c50=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x25')],'id');return _0x5a5ff0[_0xd186('0x4c')](_0x2a8c50)['then'](function(){for(var _0x186e51=0x0;_0x186e51<_0x2a8c50[_0xd186('0x1f')];_0x186e51+=0x1){_0x223bc7[_0xd186('0x4d')](_0xd186('0x4e'),{'ChatInteractionId':Number(_0x2a8c50[_0x186e51]),'UserId':Number(_0x5a5ff0['id'])});}});}})['then'](function(){if(_0x1b5aae===_0xd186('0x4f')){var _0x227a4a=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x50')],'id');return _0x5a5ff0['removeMailInteractions'](_0x227a4a)[_0xd186('0xc')](function(){for(var _0x20489c=0x0;_0x20489c<_0x227a4a['length'];_0x20489c+=0x1){_0x223bc7[_0xd186('0x4d')](_0xd186('0x51'),{'MailInteractionId':Number(_0x227a4a[_0x20489c]),'UserId':Number(_0x5a5ff0['id'])});}});}})[_0xd186('0xc')](function(){if(_0x1b5aae===_0xd186('0x4f')){var _0x51a68f=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x27')],'id');return _0x5a5ff0[_0xd186('0x52')](_0x51a68f)[_0xd186('0xc')](function(){for(var _0x4917d5=0x0;_0x4917d5<_0x51a68f[_0xd186('0x1f')];_0x4917d5+=0x1){_0x223bc7[_0xd186('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x51a68f[_0x4917d5]),'UserId':Number(_0x5a5ff0['id'])});}});}})[_0xd186('0xc')](function(){if(_0x1b5aae===_0xd186('0x4f')){var _0x559d8d=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x29')],'id');return _0x5a5ff0['removeSmsInteractions'](_0x559d8d)[_0xd186('0xc')](function(){for(var _0x1fa433=0x0;_0x1fa433<_0x559d8d[_0xd186('0x1f')];_0x1fa433+=0x1){_0x223bc7[_0xd186('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x559d8d[_0x1fa433]),'UserId':Number(_0x5a5ff0['id'])});}});}})[_0xd186('0xc')](function(){if(_0x1b5aae===_0xd186('0x4f')){var _0x3fa3ef=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x2b')],'id');return _0x5a5ff0[_0xd186('0x53')](_0x3fa3ef)[_0xd186('0xc')](function(){for(var _0x2b7d0e=0x0;_0x2b7d0e<_0x3fa3ef['length'];_0x2b7d0e+=0x1){_0x223bc7[_0xd186('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3fa3ef[_0x2b7d0e]),'UserId':Number(_0x5a5ff0['id'])});}});}})[_0xd186('0xc')](function(){if(_0x1b5aae===_0xd186('0x4f')){var _0x3b24b0=_[_0xd186('0x18')](_0x5a5ff0[_0xd186('0x2c')],'id');return _0x5a5ff0[_0xd186('0x54')](_0x3b24b0)[_0xd186('0xc')](function(){for(var _0x5ee77a=0x0;_0x5ee77a<_0x3b24b0[_0xd186('0x1f')];_0x5ee77a+=0x1){_0x223bc7['emit'](_0xd186('0x55'),{'WhatsappInteractionId':Number(_0x3b24b0[_0x5ee77a]),'UserId':Number(_0x5a5ff0['id'])});}});}})[_0xd186('0x56')](function(_0x172e51){_0x114004['log'](_0x172e51);});}}function onDisconnect(_0x48419,_0x1fc0a7){joinOrLeave(_0x48419,'leave',_0x1fc0a7);}function onConnect(_0xf77182){joinOrLeave(_0xf77182,_0xd186('0x57'));}exports[_0xd186('0x58')]=function(_0xb27c67){_0xb27c67['on'](_0xd186('0x59'),function(_0x45629c){_0x45629c[_0xd186('0x5a')](0x0);_0x45629c['address']=_0x45629c[_0xd186('0x5b')][_0xd186('0x59')][_0xd186('0x5c')]+':'+_0x45629c[_0xd186('0x5b')]['connection'][_0xd186('0x5d')];_0x45629c[_0xd186('0x5e')]=new Date();_0x45629c[_0xd186('0x5f')]=function(_0x43948b){console[_0xd186('0x5f')]('SocketIO\x20'+_0x45629c['nsp'][_0xd186('0x4')]+'['+_0x45629c[_0xd186('0x60')]+']',_0x43948b);};_0x45629c['on'](_0xd186('0x61'),function(){onDisconnect(_0x45629c,_0xb27c67);_0x45629c[_0xd186('0x5f')]('DISCONNECTED');});onConnect(_0x45629c);_0x45629c[_0xd186('0x5f')](_0xd186('0x62'));});}; \ No newline at end of file +var _0x8952=['findAll','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','Agents','length','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','Trunk','user','VoiceQueues','FaxQueue','MailQueues','MailQueue','Trunks','agent','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','setMaxListeners','address','connection','remoteAddress','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','telephone','type','ivr','UserProfileSection','then','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x8952,0x17e));var _0x2895=function(_0x39989c,_0x3d87cc){_0x39989c=_0x39989c-0x0;var _0xfc41f5=_0x8952[_0x39989c];return _0xfc41f5;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var BPromise=require(_0x2895('0x1'));var db=require(_0x2895('0x2'))['db'];var config=require(_0x2895('0x3'));var queryQueues={'attributes':['id',_0x2895('0x4')],'include':[{'as':'Agents','model':db[_0x2895('0x5')],'attributes':['id',_0x2895('0x4'),_0x2895('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2895('0x4')],'where':{'role':_0x2895('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2895('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2895('0x4'),_0x2895('0x8')],'where':{'type':_0x2895('0x9')}};function getAssociatedResources(_0x294446,_0x384cc6,_0x4952fa){return db[_0x2895('0xa')]['findOne']({'where':{'name':_0x294446,'userProfileId':_0x384cc6},'raw':!![]})[_0x2895('0xb')](function(_0x5af454){if(_0x5af454){if(_0x5af454['autoAssociation']){switch(_0x294446){case'VoiceQueues':case _0x2895('0xc'):case _0x2895('0xd'):case _0x2895('0xe'):case'MailQueues':case _0x2895('0xf'):case _0x2895('0x10'):return db[_0x4952fa]['findAll'](queryQueues);case _0x2895('0x11'):return db[_0x4952fa][_0x2895('0x12')](queryTelephones);case'Trunks':return db[_0x4952fa]['findAll'](queryTrunks);case _0x2895('0x13'):return db[_0x4952fa][_0x2895('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x2895('0x12')]({'attributes':[_0x2895('0x14')],'where':{'sectionId':_0x5af454['id']},'raw':!![]})[_0x2895('0xb')](function(_0x1ae013){if(_0x1ae013){var _0x1d3659={'where':{'id':_[_0x2895('0x15')](_0x1ae013,_0x2895('0x14'))},'raw':!![]};switch(_0x4952fa){case _0x2895('0x5'):_0x1d3659[_0x2895('0x16')][_0x2895('0x6')]=_0x2895('0x7');break;case _0x2895('0x17'):_0x1d3659[_0x2895('0x16')][_0x2895('0x8')]=_0x2895('0x9');break;}return db[_0x4952fa][_0x2895('0x12')](_0x1d3659);}else{return[];}});}}else{return[];}})[_0x2895('0xb')](function(_0x1e8d47){return _0x1e8d47;});}function joinOrLeaveQueues(_0x5a8eab,_0x4b3ba0,_0x493851,_0x442cfa){_0x5a8eab[_0x4b3ba0](util[_0x2895('0x18')](_0x2895('0x19'),_0x493851,_0x442cfa['name']));if(_0x442cfa[_0x2895('0x1a')]){for(var _0x190b79=0x0;_0x190b79<_0x442cfa[_0x2895('0x1a')][_0x2895('0x1b')];_0x190b79+=0x1){_0x5a8eab[_0x4b3ba0](util[_0x2895('0x18')]('user:%s',_0x442cfa[_0x2895('0x1a')][_0x190b79][_0x2895('0x4')]));}}}function joinOrLeave(_0x5671fa,_0x142e58,_0x384357){var _0x6f8ad4;if(_0x5671fa['handshake']['query']['id']){db[_0x2895('0x5')][_0x2895('0x1c')]({'attributes':['id',_0x2895('0x4'),'role',_0x2895('0x1d')],'where':{'id':_0x5671fa[_0x2895('0x1e')]['query']['id']},'include':[{'model':db[_0x2895('0x1f')],'as':_0x2895('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x2895('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2895('0x22')],'as':_0x2895('0x23'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2895('0x24'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2895('0x25')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x2895('0xb')](function(_0x381538){if(_0x381538){_0x6f8ad4=_0x381538;_0x5671fa[_0x142e58](util['format']('user:%s',_0x381538[_0x2895('0x4')]));var _0x30dc2f=[];switch(_0x381538[_0x2895('0x6')]){case _0x2895('0x26'):_0x5671fa[_0x142e58](_0x2895('0x27'));_0x5671fa[_0x142e58](_0x2895('0x28'));if(queryQueues[_0x2895('0x29')]('include')){delete queryQueues[_0x2895('0x2a')];}_0x30dc2f[_0x2895('0x2b')](db[_0x2895('0x2c')]['findAll'](queryQueues));_0x30dc2f[_0x2895('0x2b')](db[_0x2895('0x2d')][_0x2895('0x12')](queryQueues));_0x30dc2f[_0x2895('0x2b')](db['FaxQueue'][_0x2895('0x12')](queryQueues));_0x30dc2f[_0x2895('0x2b')](db[_0x2895('0x2e')][_0x2895('0x12')](queryQueues));_0x30dc2f[_0x2895('0x2b')](db['MailQueue']['findAll'](queryQueues));_0x30dc2f[_0x2895('0x2b')](db[_0x2895('0x2f')]['findAll'](queryQueues));_0x30dc2f[_0x2895('0x2b')](db['WhatsappQueue'][_0x2895('0x12')](queryQueues));_0x30dc2f[_0x2895('0x2b')](db['User'][_0x2895('0x12')](queryTelephones));_0x30dc2f['push'](db[_0x2895('0x30')]['findAll'](queryTrunks));_0x30dc2f['push'](db[_0x2895('0x17')][_0x2895('0x12')](queryCampaigns));_0x30dc2f[_0x2895('0x2b')](db['User'][_0x2895('0x12')](queryAgents));break;case _0x2895('0x31'):_0x5671fa[_0x142e58](_0x2895('0x27'));_0x5671fa[_0x142e58](_0x2895('0x28'));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x32'),_0x381538[_0x2895('0x1d')],_0x2895('0x2c')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0xc'),_0x381538['userProfileId'],_0x2895('0x2d')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0xd'),_0x381538[_0x2895('0x1d')],_0x2895('0x33')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0xe'),_0x381538['userProfileId'],'SmsQueue'));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x34'),_0x381538[_0x2895('0x1d')],_0x2895('0x35')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0xf'),_0x381538['userProfileId'],'OpenchannelQueue'));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x10'),_0x381538['userProfileId'],'WhatsappQueue'));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x11'),_0x381538[_0x2895('0x1d')],_0x2895('0x5')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x36'),_0x381538['userProfileId'],_0x2895('0x30')));_0x30dc2f[_0x2895('0x2b')](getAssociatedResources(_0x2895('0x13'),_0x381538[_0x2895('0x1d')],'Campaign'));_0x30dc2f[_0x2895('0x2b')](db[_0x2895('0x5')][_0x2895('0x12')](queryAgents));break;case _0x2895('0x37'):_0x5671fa[_0x142e58]('voice:inbound');_0x5671fa[_0x142e58]('voice:outbound');_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x38')]({'attributes':['id',_0x2895('0x4')]}));_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x39')]({'attributes':['id','name']}));_0x30dc2f['push'](_0x381538[_0x2895('0x3a')]({'attributes':['id',_0x2895('0x4')]}));_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x3b')]({'attributes':['id',_0x2895('0x4')]}));_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x3c')]({'attributes':['id','name']}));_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x3d')]({'attributes':['id',_0x2895('0x4')]}));_0x30dc2f[_0x2895('0x2b')](_0x381538[_0x2895('0x3e')]({'attributes':['id',_0x2895('0x4')]}));break;}return BPromise[_0x2895('0x3f')](_0x30dc2f);}})[_0x2895('0xb')](function(_0x549059){if(_0x549059&&_0x549059[_0x2895('0x1b')]){for(var _0x13ca9c=0x0;_0x13ca9c<_0x549059[_0x2895('0x1b')];_0x13ca9c+=0x1){for(var _0x4cdabd=0x0;_0x4cdabd<_0x549059[_0x13ca9c][_0x2895('0x1b')];_0x4cdabd+=0x1){switch(_0x13ca9c){case 0x0:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x40'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x1:joinOrLeaveQueues(_0x5671fa,_0x142e58,'chat',_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x2:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x41'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x3:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x42'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x4:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x43'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x5:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x44'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x6:joinOrLeaveQueues(_0x5671fa,_0x142e58,_0x2895('0x45'),_0x549059[_0x13ca9c][_0x4cdabd]);break;case 0x7:if(_0x6f8ad4[_0x2895('0x6')]!==_0x2895('0x37'))_0x5671fa[_0x142e58](util['format'](_0x2895('0x46'),_0x549059[_0x13ca9c][_0x4cdabd][_0x2895('0x4')]));break;case 0x8:if(_0x6f8ad4['role']!=='agent')_0x5671fa[_0x142e58](util['format'](_0x2895('0x47'),_0x549059[_0x13ca9c][_0x4cdabd][_0x2895('0x4')]));break;case 0x9:if(_0x6f8ad4[_0x2895('0x6')]!==_0x2895('0x37'))_0x5671fa[_0x142e58](util[_0x2895('0x18')](_0x2895('0x48'),_0x549059[_0x13ca9c][_0x4cdabd][_0x2895('0x8')],_0x549059[_0x13ca9c][_0x4cdabd][_0x2895('0x4')]));break;case 0xa:_0x5671fa[_0x142e58](util[_0x2895('0x18')](_0x2895('0x49'),_0x549059[_0x13ca9c][_0x4cdabd][_0x2895('0x4')]));break;}}}}})[_0x2895('0xb')](function(){if(_0x142e58===_0x2895('0x4a')){var _0x1481f5=_[_0x2895('0x15')](_0x6f8ad4[_0x2895('0x20')],'id');return _0x6f8ad4[_0x2895('0x4b')](_0x1481f5)[_0x2895('0xb')](function(){for(var _0xbcf98=0x0;_0xbcf98<_0x1481f5[_0x2895('0x1b')];_0xbcf98+=0x1){_0x384357[_0x2895('0x4c')](_0x2895('0x4d'),{'ChatInteractionId':Number(_0x1481f5[_0xbcf98]),'UserId':Number(_0x6f8ad4['id'])});}});}})[_0x2895('0xb')](function(){if(_0x142e58===_0x2895('0x4a')){var _0x1128a1=_[_0x2895('0x15')](_0x6f8ad4[_0x2895('0x4e')],'id');return _0x6f8ad4[_0x2895('0x4f')](_0x1128a1)[_0x2895('0xb')](function(){for(var _0x4128f1=0x0;_0x4128f1<_0x1128a1[_0x2895('0x1b')];_0x4128f1+=0x1){_0x384357['emit'](_0x2895('0x50'),{'MailInteractionId':Number(_0x1128a1[_0x4128f1]),'UserId':Number(_0x6f8ad4['id'])});}});}})[_0x2895('0xb')](function(){if(_0x142e58===_0x2895('0x4a')){var _0x2a34f1=_[_0x2895('0x15')](_0x6f8ad4[_0x2895('0x23')],'id');return _0x6f8ad4['removeFaxInteractions'](_0x2a34f1)[_0x2895('0xb')](function(){for(var _0x5579b3=0x0;_0x5579b3<_0x2a34f1[_0x2895('0x1b')];_0x5579b3+=0x1){_0x384357[_0x2895('0x4c')](_0x2895('0x51'),{'FaxInteractionId':Number(_0x2a34f1[_0x5579b3]),'UserId':Number(_0x6f8ad4['id'])});}});}})[_0x2895('0xb')](function(){if(_0x142e58===_0x2895('0x4a')){var _0x56a2c0=_['map'](_0x6f8ad4[_0x2895('0x24')],'id');return _0x6f8ad4[_0x2895('0x52')](_0x56a2c0)[_0x2895('0xb')](function(){for(var _0x5c76aa=0x0;_0x5c76aa<_0x56a2c0[_0x2895('0x1b')];_0x5c76aa+=0x1){_0x384357['emit'](_0x2895('0x53'),{'SmsInteractionId':Number(_0x56a2c0[_0x5c76aa]),'UserId':Number(_0x6f8ad4['id'])});}});}})['then'](function(){if(_0x142e58==='leave'){var _0x49c4fd=_['map'](_0x6f8ad4[_0x2895('0x54')],'id');return _0x6f8ad4[_0x2895('0x55')](_0x49c4fd)[_0x2895('0xb')](function(){for(var _0x4336c=0x0;_0x4336c<_0x49c4fd[_0x2895('0x1b')];_0x4336c+=0x1){_0x384357[_0x2895('0x4c')](_0x2895('0x56'),{'OpenchannelInteractionId':Number(_0x49c4fd[_0x4336c]),'UserId':Number(_0x6f8ad4['id'])});}});}})['then'](function(){if(_0x142e58===_0x2895('0x4a')){var _0x1e777d=_['map'](_0x6f8ad4[_0x2895('0x57')],'id');return _0x6f8ad4['removeWhatsappInteractions'](_0x1e777d)['then'](function(){for(var _0x2a9194=0x0;_0x2a9194<_0x1e777d[_0x2895('0x1b')];_0x2a9194+=0x1){_0x384357['emit'](_0x2895('0x58'),{'WhatsappInteractionId':Number(_0x1e777d[_0x2a9194]),'UserId':Number(_0x6f8ad4['id'])});}});}})[_0x2895('0x59')](function(_0x35d979){_0x5671fa[_0x2895('0x5a')](_0x35d979);});}}function onDisconnect(_0x52616a,_0x2d3f5b){joinOrLeave(_0x52616a,'leave',_0x2d3f5b);}function onConnect(_0x409e2b){joinOrLeave(_0x409e2b,'join');}exports['default']=function(_0x1af031){_0x1af031['on']('connection',function(_0x3d86dd){_0x3d86dd[_0x2895('0x5b')](0x0);_0x3d86dd[_0x2895('0x5c')]=_0x3d86dd['request'][_0x2895('0x5d')][_0x2895('0x5e')]+':'+_0x3d86dd['request']['connection'][_0x2895('0x5f')];_0x3d86dd[_0x2895('0x60')]=new Date();_0x3d86dd['log']=function(_0x31505c){console['log']('SocketIO\x20'+_0x3d86dd[_0x2895('0x61')][_0x2895('0x4')]+'['+_0x3d86dd[_0x2895('0x5c')]+']',_0x31505c);};_0x3d86dd['on']('disconnect',function(){onDisconnect(_0x3d86dd,_0x1af031);_0x3d86dd[_0x2895('0x5a')](_0x2895('0x62'));});onConnect(_0x3d86dd);_0x3d86dd[_0x2895('0x5a')](_0x2895('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 430e2dd..6627d6c 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 _0x7823=['jayson/promise','../logger','triggers','http','Chat','afterCreate','newinteraction','ChatInteraction','newmessage','Sms','SmsInteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','motionChannel','event','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','SELECT','UserId','undefined','interface','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','get','opened','QueryTypes','changed','substatus','closed','sequelize','contact','AfterUpdate','User','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x7823,0x127));var _0x3782=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7823[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var db=require(_0x3782('0x0'))['db'];var jayson=require(_0x3782('0x1'));var logger=require(_0x3782('0x2'))(_0x3782('0x3'));var client=jayson['client'][_0x3782('0x4')]({'port':0x232a});var triggers=[{'channel':_0x3782('0x5'),'model':'ChatInteraction','event':_0x3782('0x6'),'condition':_0x3782('0x7'),'callback':afterCreate},{'channel':_0x3782('0x5'),'model':_0x3782('0x8'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3782('0x5'),'model':'ChatMessage','event':_0x3782('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0x3782('0x6'),'condition':_0x3782('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x3782('0xa'),'model':'SmsInteraction','event':_0x3782('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x3782('0xb'),'event':_0x3782('0xc'),'condition':_0x3782('0xd'),'callback':afterUpdate},{'channel':_0x3782('0xa'),'model':_0x3782('0xe'),'event':_0x3782('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3782('0xf'),'model':_0x3782('0x10'),'event':_0x3782('0x6'),'condition':_0x3782('0x7'),'callback':afterCreate},{'channel':_0x3782('0xf'),'model':_0x3782('0x10'),'event':'afterUpdate','condition':_0x3782('0xd'),'callback':afterUpdate},{'channel':_0x3782('0xf'),'model':_0x3782('0x11'),'event':'afterCreate','condition':_0x3782('0x9'),'callback':afterCreateMessage},{'channel':_0x3782('0x12'),'model':_0x3782('0x13'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x3782('0x12'),'model':_0x3782('0x13'),'event':_0x3782('0xc'),'condition':_0x3782('0xd'),'callback':afterUpdate},{'channel':_0x3782('0x12'),'model':_0x3782('0x14'),'event':_0x3782('0x6'),'condition':_0x3782('0x9'),'callback':afterCreateMessage},{'channel':_0x3782('0x15'),'model':'MailInteraction','event':_0x3782('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x3782('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3782('0x15'),'model':_0x3782('0x17'),'event':'afterCreate','condition':_0x3782('0x9'),'callback':afterCreateMessage},{'channel':_0x3782('0x18'),'model':_0x3782('0x19'),'event':_0x3782('0x6'),'condition':_0x3782('0x7'),'callback':afterCreate},{'channel':_0x3782('0x18'),'model':_0x3782('0x19'),'event':_0x3782('0xc'),'condition':_0x3782('0xd'),'callback':afterUpdate},{'channel':_0x3782('0x18'),'model':_0x3782('0x1a'),'event':_0x3782('0x6'),'condition':_0x3782('0x9'),'callback':afterCreateMessage}];function request(_0x63091e){return client[_0x3782('0x1b')](_0x3782('0x1c'),_0x63091e)[_0x3782('0x1d')](function(_0x3597f0){logger[_0x3782('0x1e')](_0x3782('0x1f'),_0x3782('0x1c'),_0x3597f0);if(_0x3597f0[_0x3782('0x20')]){if(_0x3597f0[_0x3782('0x20')][_0x3782('0x21')]===0x1f4){logger[_0x3782('0x20')](_0x3782('0x1f'),_0x3782('0x1c'),_0x3597f0[_0x3782('0x20')]);}}})[_0x3782('0x22')](function(_0x484f4b){logger[_0x3782('0x20')](_0x3782('0x1f'),_0x3782('0x1c'),_0x484f4b);});}function afterCreateMessage(_0x26d83b){return function(_0x1ebc61){_0x1ebc61=_0x1ebc61['get']({'plain':!![]});_0x1ebc61['channel']=_0x26d83b;_0x1ebc61[_0x3782('0x23')]=_0x26d83b;_0x1ebc61[_0x3782('0x24')]=_0x1ebc61['direction'];Promise[_0x3782('0x25')]()[_0x3782('0x1d')](function(){if(typeof _0x1ebc61['ContactId']==='undefined')return null;var _0x1d3cee=_0x3782('0x26')+_0x1ebc61[_0x3782('0x27')];return db['sequelize'][_0x3782('0x28')](_0x1d3cee,{'type':db[_0x3782('0x29')]['QueryTypes'][_0x3782('0x2a')],'raw':!![]});})['then'](function(_0x31c4cd){if(_0x31c4cd){_0x1ebc61['contact']=_0x31c4cd[0x0];}if(typeof _0x1ebc61[_0x3782('0x2b')]===_0x3782('0x2c'))return;return getAgent(_0x1ebc61['UserId']);})['then'](function(_0x4a5783){if(_0x4a5783){_0x1ebc61[_0x3782('0x2d')]=util[_0x3782('0x2e')](_0x3782('0x2f'),_0x4a5783[_0x3782('0x30')]);_0x1ebc61[_0x3782('0x31')]=_0x4a5783;_0x1ebc61[_0x3782('0x32')]=_0x26d83b;return request({'event':_0x3782('0x33'),'message':_0x1ebc61});}else{return request({'event':_0x3782('0x34'),'message':_0x1ebc61});}})['catch'](function(_0x575988){logger[_0x3782('0x20')](_0x3782('0x1f'),_0x3782('0x35'),_0x575988);});};}function afterCreateOfflineMessage(_0x3c61f1){return function(_0x33c4e6){_0x33c4e6=_0x33c4e6['get']({'plain':!![]});_0x33c4e6[_0x3782('0x32')]=_0x3c61f1;_0x33c4e6[_0x3782('0x23')]=_0x3c61f1;_0x33c4e6[_0x3782('0x24')]='offlineMessage';return request({'event':_0x33c4e6[_0x3782('0x24')],'message':_0x33c4e6});};}function afterCreate(_0x42c28b,_0x3b5988){return function(_0x521cfd){_0x521cfd=_0x521cfd[_0x3782('0x36')]({'plain':!![]});_0x521cfd[_0x3782('0x32')]=_0x42c28b;_0x521cfd['motionChannel']=_0x42c28b;_0x521cfd[_0x3782('0x24')]=_0x3782('0x37');Promise[_0x3782('0x25')]()['then'](function(){var _0x19415f=_0x3782('0x26')+_0x521cfd['ContactId'];return db['sequelize']['query'](_0x19415f,{'type':db[_0x3782('0x29')][_0x3782('0x38')][_0x3782('0x2a')],'raw':!![]});})['then'](function(_0x576189){if(_0x576189){_0x521cfd['contact']=_0x576189[0x0];}if(typeof _0x521cfd['UserId']===_0x3782('0x2c'))return;return getAgent(_0x521cfd[_0x3782('0x2b')]);})[_0x3782('0x1d')](function(_0x35ed7e){if(_0x35ed7e){_0x521cfd[_0x3782('0x2d')]=util[_0x3782('0x2e')](_0x3782('0x2f'),_0x35ed7e[_0x3782('0x30')]);_0x521cfd[_0x3782('0x31')]=_0x35ed7e;}return request({'event':_0x3b5988,'message':_0x521cfd});})[_0x3782('0x22')](function(_0xcdbb01){logger[_0x3782('0x20')]('Trigger,\x20%s','AfterCreate',_0xcdbb01);});};}function afterUpdate(_0x4d335a){return function(_0x1ad6bd){var _0x3c7e5b=_0x1ad6bd[_0x3782('0x39')]('closed')&&_0x1ad6bd['closed'];var _0x475623=_0x1ad6bd[_0x3782('0x39')]('substatus');if(_0x3c7e5b||_0x475623){var _0x367548=_0x3c7e5b?_0x3782('0xd'):_0x3782('0x3a');var _0x2407e0=_0x1ad6bd[_0x3782('0x36')]({'plain':!![]});_0x2407e0[_0x3782('0x32')]=_0x4d335a;_0x2407e0['motionChannel']=_0x4d335a;_0x2407e0[_0x3782('0x24')]=_0x3c7e5b?_0x3782('0x3b'):'substatus';var _0x84cf2d=_0x3782('0x26')+_0x2407e0[_0x3782('0x27')];return db[_0x3782('0x3c')]['query'](_0x84cf2d,{'type':db['Sequelize'][_0x3782('0x38')][_0x3782('0x2a')],'raw':!![]})[_0x3782('0x1d')](function(_0x9377c9){if(_0x9377c9){_0x2407e0[_0x3782('0x3d')]=_0x9377c9[0x0];}if(typeof _0x2407e0['UserId']==='undefined')return;return getAgent(_0x2407e0['UserId']);})[_0x3782('0x1d')](function(_0x428f96){if(_0x428f96){_0x2407e0[_0x3782('0x2d')]=util['format'](_0x3782('0x2f'),_0x428f96['name']);_0x2407e0[_0x3782('0x31')]=_0x428f96;}return request({'event':_0x367548,'message':_0x2407e0});})[_0x3782('0x22')](function(_0x584141){logger[_0x3782('0x20')](_0x3782('0x1f'),_0x3782('0x3e'),_0x584141);});}};}function getAgent(_0x560006){return db[_0x3782('0x3f')]['find']({'where':{'id':_0x560006},'attributes':['id','name','fullname',_0x3782('0x40'),_0x3782('0x41')],'raw':!![]})[_0x3782('0x1d')](function(_0x66790d){return _0x66790d;});}exports[_0x3782('0x42')]=function(){for(var _0x3f8ad0=0x0;_0x3f8ad0=_0x4d1a42[_0x5593('0x14')]){throw Error(_0x5593('0x15'));}_0xf733c6(_0x5b2b37);})['catch'](function(_0x384982){_0x56b9d7(_0x384982);});});}; \ No newline at end of file +var _0x2a85=['catch','lodash','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','role','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x323c1b,_0x58fb4c){var _0x1b179d=function(_0x5117ba){while(--_0x5117ba){_0x323c1b['push'](_0x323c1b['shift']());}};_0x1b179d(++_0x58fb4c);}(_0x2a85,0x14b));var _0x52a8=function(_0x1a1e89,_0x1e92b1){_0x1a1e89=_0x1a1e89-0x0;var _0x2b62d7=_0x2a85[_0x1a1e89];return _0x2b62d7;};'use strict';var _=require(_0x52a8('0x0'));var BPromise=require('bluebird');var db=require(_0x52a8('0x1'))['db'];var util=require('./license/util');var channels=[_0x52a8('0x2'),_0x52a8('0x3'),_0x52a8('0x4'),_0x52a8('0x5'),_0x52a8('0x6'),_0x52a8('0x7'),_0x52a8('0x8')];exports['getChannels']=function(){return channels;};exports[_0x52a8('0x9')]=function(_0x297a07){_0x297a07=_0x297a07[_0x52a8('0xa')]();return _[_0x52a8('0xb')](channels,_0x297a07);};exports['clearBlockUser']=function(_0x574488,_0xa4ed07,_0x2d5439,_0x4b728e){var _0x45f082={'loginAttempts':_0xa4ed07,'blocked':_0x2d5439};if(!_[_0x52a8('0xc')](_0x4b728e)){_0x45f082[_0x52a8('0xd')]=_0x4b728e;}return _0x574488[_0x52a8('0xe')](_0x45f082);};exports['getLicense']=function(_0x266b22){return new BPromise(function(_0x72c8ba,_0x18a722){var _0xc9f2b5=0x0;if(_0x266b22[_0x52a8('0xf')]!=='agent'){_0x72c8ba(_0x266b22);}db[_0x52a8('0x10')][_0x52a8('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x266b22['id']}}})['then'](function(_0x10790a){_0xc9f2b5=_0x10790a;return util['getLicense']();})[_0x52a8('0x12')](function(_0x116ebb){if(_0x116ebb&&_0x116ebb[_0x52a8('0x13')]&&_0xc9f2b5>=_0x116ebb[_0x52a8('0x13')]){throw Error(_0x52a8('0x14'));}_0x72c8ba(_0x266b22);})[_0x52a8('0x15')](function(_0x5527ac){_0x18a722(_0x5527ac);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 50ac964..f871926 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd6f=['status','render','json','exports','404'];(function(_0x3b2377,_0x1be5c4){var _0x4defd8=function(_0x1d21f0){while(--_0x1d21f0){_0x3b2377['push'](_0x3b2377['shift']());}};_0x4defd8(++_0x1be5c4);}(_0xfd6f,0x19d));var _0xffd6=function(_0x196a74,_0x5aaa3a){_0x196a74=_0x196a74-0x0;var _0xcf919b=_0xfd6f[_0x196a74];return _0xcf919b;};'use strict';module[_0xffd6('0x0')][0x194]=function pageNotFound(_0x2b6ffc,_0x29b163){var _0x45ddb9=_0xffd6('0x1');var _0x595470=0x194;var _0xb84411={'status':_0x595470};_0x29b163[_0xffd6('0x2')](_0xb84411[_0xffd6('0x2')]);_0x29b163[_0xffd6('0x3')](_0x45ddb9,{},function(_0x54e670,_0x39e11e){if(_0x54e670){return _0x29b163[_0xffd6('0x2')](_0xb84411[_0xffd6('0x2')])[_0xffd6('0x4')](_0xb84411);}_0x29b163['send'](_0x39e11e);});}; \ No newline at end of file +var _0x5ba7=['render','json','exports','404','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ba7,0x1b5));var _0x75ba=function(_0x4f8950,_0x2455a8){_0x4f8950=_0x4f8950-0x0;var _0x1b4bdf=_0x5ba7[_0x4f8950];return _0x1b4bdf;};'use strict';module[_0x75ba('0x0')][0x194]=function pageNotFound(_0x44e66c,_0x113d08){var _0x15779e=_0x75ba('0x1');var _0x112c41=0x194;var _0x4648e7={'status':_0x112c41};_0x113d08[_0x75ba('0x2')](_0x4648e7[_0x75ba('0x2')]);_0x113d08[_0x75ba('0x3')](_0x15779e,{},function(_0x67c4a0,_0x2d6003){if(_0x67c4a0){return _0x113d08[_0x75ba('0x2')](_0x4648e7[_0x75ba('0x2')])[_0x75ba('0x4')](_0x4648e7);}_0x113d08['send'](_0x2d6003);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8dcec5f..acc8327 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32c4=['MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','VoiceMail','cascade','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','Groups','Contacts','cm_user_has_contacts','Lists','belongsToMany','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','cm_user_has_lists','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','HopperBlacks','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','CloudProvider','CloudProviderId','restrict','MailAccountId','Smtp','Dispositions','CannedAnswer','Answers','List','ListId','Template','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','Items','FaxAccountId','Interactions','FaxApplication','Exntensions','TagId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','chat_group_has_users','CompanyId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','Automation','All','Any','OneAny','AutomationAnyId','Actions','ParentId','MailApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','VoiceMusicOnHold','Mohs','moh_has_sounds','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','DeskConfiguration','Field','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','SmsQueues','team_has_whatsapp_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','name','utf8','xC@LL1234','mysql','utf8mb4','utf8_general_ci','database','password','options','sequelizeHistory','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x32c4,0x1c4));var _0x432c=function(_0x3ad62c,_0x465700){_0x3ad62c=_0x3ad62c-0x0;var _0x18e4f3=_0x32c4[_0x3ad62c];return _0x18e4f3;};'use strict';var config=require(_0x432c('0x0'));var Sequelize=require('sequelize');var _=require(_0x432c('0x1'));var jstz=require('jstz');var timezone=jstz[_0x432c('0x2')]();config[_0x432c('0x3')]=_[_0x432c('0x4')](config[_0x432c('0x3')],{'database':_0x432c('0x5'),'username':_0x432c('0x6'),'password':'xC@LL1234','options':{'host':_0x432c('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x432c('0x8')](),'define':{'charset':_0x432c('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x432c('0x5'),'username':_0x432c('0x6'),'password':_0x432c('0xa'),'options':{'host':_0x432c('0x7'),'port':0xcea,'dialect':_0x432c('0xb'),'dialectOptions':{'charset':_0x432c('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x432c('0x9'),'collate':_0x432c('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x432c('0xe')],config['sequelize']['username'],config['sequelize'][_0x432c('0xf')],config['sequelize'][_0x432c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x432c('0x11')][_0x432c('0xe')],config[_0x432c('0x11')][_0x432c('0x12')],config[_0x432c('0x11')][_0x432c('0xf')],config[_0x432c('0x11')][_0x432c('0x10')])};db['User']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x14'));db[_0x432c('0x15')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x16'));db[_0x432c('0x17')]=db[_0x432c('0x3')]['import']('../api/voiceContext/voiceContext.model');db[_0x432c('0x18')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize']['import'](_0x432c('0x19'));db['VoiceQueue']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x1a'));db['VoiceRecording']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x1b'));db['ScreenRecording']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x1c'));db['VoiceMail']=db['sequelize'][_0x432c('0x13')](_0x432c('0x1d'));db[_0x432c('0x1e')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x1f'));db[_0x432c('0x20')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x21'));db[_0x432c('0x22')]=db[_0x432c('0x3')]['import'](_0x432c('0x23'));db['VoiceAgentReport']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x24'));db['VoiceQueueReport']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x25'));db[_0x432c('0x26')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x27'));db[_0x432c('0x28')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x29'));db[_0x432c('0x2a')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x2b'));db[_0x432c('0x2c')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x432c('0x2d')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x2e'));db['UserChatQueue']=db[_0x432c('0x3')]['import'](_0x432c('0x2f'));db[_0x432c('0x30')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x31'));db['UserFaxQueue']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x32'));db[_0x432c('0x33')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x34'));db[_0x432c('0x35')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x36'));db[_0x432c('0x37')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x38'));db[_0x432c('0x39')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x3a'));db[_0x432c('0x3b')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x3c'));db[_0x432c('0x3d')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x3e'));db[_0x432c('0x3f')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x40'));db['MailSubstatus']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x432c('0x41')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x432c('0x42')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x43'));db['MailApplication']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x44'));db[_0x432c('0x45')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x46'));db[_0x432c('0x47')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x48'));db[_0x432c('0x49')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x4a'));db[_0x432c('0x4b')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x4c'));db['FaxApplication']=db['sequelize']['import'](_0x432c('0x4d'));db[_0x432c('0x4e')]=db['sequelize'][_0x432c('0x13')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x432c('0x3')]['import'](_0x432c('0x4f'));db[_0x432c('0x50')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x432c('0x13')](_0x432c('0x51'));db[_0x432c('0x52')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x53'));db[_0x432c('0x54')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x55'));db[_0x432c('0x56')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x57'));db[_0x432c('0x58')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/smsMessage/smsMessage.model');db[_0x432c('0x59')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x5a'));db[_0x432c('0x5b')]=db[_0x432c('0x3')]['import'](_0x432c('0x5c'));db['OpenchannelApplication']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x432c('0x5d')]=db['sequelize']['import'](_0x432c('0x5e'));db['OpenchannelMessage']=db['sequelize'][_0x432c('0x13')](_0x432c('0x5f'));db[_0x432c('0x60')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x61'));db[_0x432c('0x62')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x63'));db[_0x432c('0x64')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x65'));db[_0x432c('0x66')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/chatApplication/chatApplication.model');db[_0x432c('0x67')]=db[_0x432c('0x3')]['import'](_0x432c('0x68'));db[_0x432c('0x69')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x6a'));db[_0x432c('0x6b')]=db[_0x432c('0x3')]['import'](_0x432c('0x6c'));db[_0x432c('0x6d')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x6e'));db[_0x432c('0x6f')]=db[_0x432c('0x3')]['import'](_0x432c('0x70'));db[_0x432c('0x71')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x432c('0x72')]=db['sequelize'][_0x432c('0x13')]('../api/cmCompany/cmCompany.model');db[_0x432c('0x73')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x74'));db[_0x432c('0x75')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/cmHopper/cmHopper.model');db[_0x432c('0x76')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x77'));db['CmHopperFinal']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x78'));db[_0x432c('0x79')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x7a'));db[_0x432c('0x7b')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x7c'));db[_0x432c('0x7d')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x7e'));db[_0x432c('0x7f')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x80'));db['Automation']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db['sequelize']['import'](_0x432c('0x81'));db[_0x432c('0x82')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x83'));db[_0x432c('0x84')]=db[_0x432c('0x3')]['import'](_0x432c('0x85'));db[_0x432c('0x86')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x87'));db[_0x432c('0x88')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x89'));db[_0x432c('0x8a')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x8b'));db[_0x432c('0x8c')]=db[_0x432c('0x3')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x432c('0x8d')]=db['sequelize']['import'](_0x432c('0x8e'));db[_0x432c('0x8f')]=db[_0x432c('0x3')]['import'](_0x432c('0x90'));db['Tag']=db[_0x432c('0x3')]['import']('../api/tag/tag.model');db['Template']=db['sequelize'][_0x432c('0x13')]('../api/template/template.model');db['Trigger']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x91'));db[_0x432c('0x92')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/variable/variable.model');db[_0x432c('0x93')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x94'));db[_0x432c('0x95')]=db[_0x432c('0x3')]['import'](_0x432c('0x96'));db['AnalyticCustomReport']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x432c('0x97')]=db['sequelize']['import'](_0x432c('0x98'));db['AnalyticExtractedReport']=db[_0x432c('0x3')]['import'](_0x432c('0x99'));db[_0x432c('0x9a')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x9b'));db['AnalyticFieldReport']=db[_0x432c('0x3')]['import'](_0x432c('0x9c'));db[_0x432c('0x9d')]=db['sequelize'][_0x432c('0x13')](_0x432c('0x9e'));db[_0x432c('0x9f')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xa0'));db[_0x432c('0xa1')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x432c('0xa2')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xa3'));db[_0x432c('0xa4')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xa5'));db['SugarcrmConfiguration']=db[_0x432c('0x3')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x432c('0xa6')]=db['sequelize'][_0x432c('0x13')](_0x432c('0xa7'));db[_0x432c('0xa8')]=db['sequelize'][_0x432c('0x13')](_0x432c('0xa9'));db['DeskConfiguration']=db['sequelize'][_0x432c('0x13')](_0x432c('0xaa'));db[_0x432c('0xab')]=db['sequelize'][_0x432c('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db['sequelize'][_0x432c('0x13')](_0x432c('0xac'));db[_0x432c('0xad')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xae'));db[_0x432c('0xaf')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb0'));db[_0x432c('0xb1')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb2'));db[_0x432c('0xb3')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb4'));db['ZendeskField']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb5'));db['FreshdeskAccount']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb6'));db[_0x432c('0xb7')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xb8'));db['FreshdeskField']=db['sequelize'][_0x432c('0x13')](_0x432c('0xb9'));db[_0x432c('0xba')]=db[_0x432c('0x3')]['import'](_0x432c('0xbb'));db[_0x432c('0xbc')]=db['sequelize'][_0x432c('0x13')](_0x432c('0xbd'));db[_0x432c('0xbe')]=db[_0x432c('0x3')]['import'](_0x432c('0xbf'));db[_0x432c('0xc0')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xc1'));db[_0x432c('0xc2')]=db[_0x432c('0x3')]['import'](_0x432c('0xc3'));db[_0x432c('0xc4')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xc5'));db[_0x432c('0xc6')]=db[_0x432c('0x3')]['import'](_0x432c('0xc7'));db[_0x432c('0xc8')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xc9'));db[_0x432c('0xca')]=db[_0x432c('0x3')]['import'](_0x432c('0xcb'));db[_0x432c('0xcc')]=db[_0x432c('0x3')]['import'](_0x432c('0xcd'));db['FreshsalesConfiguration']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xce'));db['FreshsalesField']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xcf'));db[_0x432c('0x93')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x94'));db[_0x432c('0xd0')]=db['sequelize']['import']('../api/network/network.model');db[_0x432c('0xd1')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x432c('0xd2')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xd3'));db[_0x432c('0xd4')]=db['sequelize'][_0x432c('0x13')](_0x432c('0xd5'));db['JscriptyQuestionReport']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xd6'));db['SmsQueueReport']=db[_0x432c('0x3')]['import'](_0x432c('0xd7'));db[_0x432c('0xd8')]=db['sequelize'][_0x432c('0x13')]('../api/squareReport/squareReport.model');db[_0x432c('0xd9')]=db['sequelize'][_0x432c('0x13')](_0x432c('0xda'));db[_0x432c('0xdb')]=db[_0x432c('0x3')]['import'](_0x432c('0xdc'));db['Setting']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xdd'));db[_0x432c('0xde')]=db[_0x432c('0x3')]['import'](_0x432c('0xdf'));db['SquareProject']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/squareProject/squareProject.model');db[_0x432c('0xe0')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xe1'));db['SquareMessage']=db[_0x432c('0x3')]['import'](_0x432c('0xe2'));db[_0x432c('0xe3')]=db[_0x432c('0x3')]['import'](_0x432c('0xe4'));db[_0x432c('0xe5')]=db[_0x432c('0x3')]['import'](_0x432c('0xe6'));db['Campaign']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xe7'));db[_0x432c('0xe8')]=db['sequelize'][_0x432c('0x13')]('../api/migration/migration.model');db[_0x432c('0xe9')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x432c('0xea')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xeb'));db[_0x432c('0xec')]=db[_0x432c('0x3')]['import'](_0x432c('0xed'));db[_0x432c('0xee')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xef'));db['FaxTransferReport']=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x432c('0xf0')]=db['sequelize'][_0x432c('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x432c('0xf1')]=db['sequelize'][_0x432c('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x432c('0xf2')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xf3'));db['VoicePrefix']=db[_0x432c('0x3')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x432c('0xf4')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xf5'));db[_0x432c('0xf6')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xf7'));db['UserProfileResource']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xf8'));db[_0x432c('0xf9')]=db['sequelize'][_0x432c('0x13')]('../api/userNotification/userNotification.model');db[_0x432c('0xfa')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0x432c('0xfb')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xfc'));db[_0x432c('0xfd')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0xfe'));db[_0x432c('0xff')]=db[_0x432c('0x3')][_0x432c('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x432c('0x3')][_0x432c('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x432c('0x100')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x101'));db['CloudProvider']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x102'));db['TeamVoiceQueue']=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x103'));db[_0x432c('0x104')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x105'));db[_0x432c('0x106')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x107'));db[_0x432c('0x108')]=db[_0x432c('0x3')][_0x432c('0x13')](_0x432c('0x109'));db[_0x432c('0x10a')]['hasOne'](db['VoiceMail'],{'as':_0x432c('0x10b'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x10e')](db[_0x432c('0x108')],{'as':_0x432c('0x10f'),'onDelete':_0x432c('0x10c'),'foreignKey':'UserId'});db[_0x432c('0x10a')][_0x432c('0x110')](db['VoiceRecording'],{'as':_0x432c('0x111'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x2c')],{'as':_0x432c('0x112'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x18')],{'as':_0x432c('0x113'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x10a')]['hasMany'](db[_0x432c('0x114')],{'as':_0x432c('0x115'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x79')],{'as':'HopperHistory','foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x5d')],{'as':_0x432c('0x116'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0x67')],{'as':_0x432c('0x117'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db['SmsInteraction'],{'as':_0x432c('0x118'),'foreignKey':_0x432c('0x10d')});db['User'][_0x432c('0x110')](db['FaxInteraction'],{'as':_0x432c('0x119'),'foreignKey':'UserId'});db[_0x432c('0x10a')][_0x432c('0x110')](db['MailInteraction'],{'as':_0x432c('0x11a'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db[_0x432c('0xfd')],{'as':_0x432c('0x11b'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x10a')][_0x432c('0x110')](db['UserNotification'],{'as':_0x432c('0x11c'),'foreignKey':_0x432c('0x11d')});db[_0x432c('0x10a')][_0x432c('0x11e')](db[_0x432c('0xf4')],{'as':_0x432c('0xf4'),'foreignKey':'userProfileId'});db[_0x432c('0x10a')]['belongsToMany'](db[_0x432c('0x6f')],{'as':_0x432c('0x11f'),'through':'chat_group_has_users'});db[_0x432c('0x10a')]['belongsToMany'](db[_0x432c('0x73')],{'as':_0x432c('0x120'),'through':_0x432c('0x121')});db[_0x432c('0x10a')]['belongsToMany'](db[_0x432c('0xf2')],{'as':_0x432c('0x122'),'through':'cm_user_has_lists'});db['User'][_0x432c('0x123')](db[_0x432c('0xe3')],{'through':_0x432c('0x124')});db[_0x432c('0x10a')]['belongsToMany'](db['MailInteraction'],{'as':_0x432c('0x11a'),'through':_0x432c('0x125')});db[_0x432c('0x10a')][_0x432c('0x123')](db['ChatInteraction'],{'as':_0x432c('0x117'),'through':_0x432c('0x126')});db[_0x432c('0x10a')][_0x432c('0x123')](db['FaxInteraction'],{'as':_0x432c('0x119'),'through':_0x432c('0x127')});db['User'][_0x432c('0x123')](db[_0x432c('0x56')],{'as':_0x432c('0x118'),'through':_0x432c('0x128')});db[_0x432c('0x10a')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x432c('0x116'),'through':_0x432c('0x129')});db['User'][_0x432c('0x123')](db[_0x432c('0xfd')],{'as':_0x432c('0x11b'),'through':'user_has_whatsapp_interactions'});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x12a')],{'as':_0x432c('0x12b'),'through':_0x432c('0x2d'),'required':![]});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x12c')],{'as':_0x432c('0x12d'),'through':_0x432c('0x106'),'required':![]});db['User'][_0x432c('0x123')](db[_0x432c('0x3f')],{'as':_0x432c('0x12e'),'through':_0x432c('0x30'),'required':![]});db['User'][_0x432c('0x123')](db[_0x432c('0x6d')],{'as':_0x432c('0x12f'),'through':_0x432c('0x130'),'required':![],'hooks':!![]});db['User'][_0x432c('0x123')](db[_0x432c('0x50')],{'as':_0x432c('0x131'),'through':_0x432c('0x132'),'required':![]});db[_0x432c('0x10a')]['belongsToMany'](db['SmsQueue'],{'as':'SmsQueues','through':_0x432c('0x33'),'required':![]});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x60')],{'as':_0x432c('0x133'),'through':_0x432c('0x35'),'required':![]});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x100')],{'as':'WhatsappQueues','through':_0x432c('0x37'),'required':![]});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0xf2')],{'through':_0x432c('0x134')});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x62')],{'as':_0x432c('0x135'),'through':'user_has_chat_websites'});db['User'][_0x432c('0x123')](db[_0x432c('0x4b')],{'as':_0x432c('0x136'),'through':_0x432c('0x137')});db[_0x432c('0x10a')][_0x432c('0x123')](db['MailAccount'],{'as':'MailAccounts','through':_0x432c('0x138')});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x5b')],{'as':_0x432c('0x139'),'through':'user_has_openchannel_accounts'});db[_0x432c('0x10a')][_0x432c('0x123')](db[_0x432c('0x52')],{'as':_0x432c('0x13a'),'through':_0x432c('0x13b')});db[_0x432c('0x10a')][_0x432c('0x123')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x432c('0x13c')});db['User'][_0x432c('0x123')](db[_0x432c('0x13d')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x432c('0x15')][_0x432c('0x110')](db[_0x432c('0x18')],{'as':_0x432c('0x13e'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x13f')});db[_0x432c('0x17')][_0x432c('0x110')](db[_0x432c('0x18')],{'onDelete':_0x432c('0x10c')});db['VoiceExtension'][_0x432c('0x110')](db[_0x432c('0x18')],{'as':_0x432c('0x140'),'onDelete':'cascade'});db['VoiceMusicOnHold']['belongsToMany'](db[_0x432c('0x8f')],{'as':_0x432c('0x141'),'through':'moh_has_sounds'});db[_0x432c('0x12a')][_0x432c('0x110')](db['UserVoiceQueueRt'],{'as':_0x432c('0x142'),'foreignKey':'VoiceQueueId'});db[_0x432c('0x12a')][_0x432c('0x110')](db['CmHopper'],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x432c('0x12a')][_0x432c('0x110')](db[_0x432c('0x114')],{'as':_0x432c('0x115'),'foreignKey':_0x432c('0x143')});db['VoiceQueue'][_0x432c('0x110')](db[_0x432c('0x79')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x432c('0x12a')][_0x432c('0x110')](db[_0x432c('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x432c('0x143')});db['VoiceQueue'][_0x432c('0x110')](db[_0x432c('0x76')],{'as':_0x432c('0x144'),'foreignKey':'VoiceQueueId'});db[_0x432c('0x12a')][_0x432c('0x110')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x432c('0x143')});db[_0x432c('0x12a')][_0x432c('0x11e')](db[_0x432c('0x28')],{'as':_0x432c('0x28'),'foreignKey':_0x432c('0x145')});db[_0x432c('0x12a')][_0x432c('0x11e')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x432c('0x12a')][_0x432c('0x11e')](db[_0x432c('0x86')],{'as':_0x432c('0x86'),'foreignKey':_0x432c('0x146')});db[_0x432c('0x12a')][_0x432c('0x11e')](db['Pause'],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0x12a')][_0x432c('0x123')](db['CmList'],{'as':_0x432c('0x122'),'through':_0x432c('0x149')});db[_0x432c('0x12a')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x2d')});db[_0x432c('0x12a')][_0x432c('0x123')](db[_0x432c('0xe3')],{'as':'Teams','through':_0x432c('0x14b')});db[_0x432c('0x12a')][_0x432c('0x123')](db['CmList'],{'as':_0x432c('0x14c'),'through':_0x432c('0x14d')});db['VoiceRecording'][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':'User','foreignKey':_0x432c('0x10d')});db['ScreenRecording'][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x10a'),'foreignKey':_0x432c('0x10d')});db['VoiceMail']['hasMany'](db[_0x432c('0x1e')],{'as':_0x432c('0x14e'),'onDelete':_0x432c('0x10c'),'foreignKey':'mailboxuser','sourceKey':_0x432c('0x14f')});db[_0x432c('0x1e')]['belongsTo'](db[_0x432c('0x10b')],{'foreignKey':_0x432c('0x150'),'targetKey':'mailbox'});db[_0x432c('0x20')][_0x432c('0x110')](db[_0x432c('0x151')],{'as':_0x432c('0x152'),'foreignKey':_0x432c('0x153'),'constraints':![]});db[_0x432c('0x20')][_0x432c('0x110')](db[_0x432c('0x154')],{'as':_0x432c('0x155'),'foreignKey':_0x432c('0x153'),'constraints':![]});db['VoiceCallReport'][_0x432c('0x11e')](db['User'],{'as':_0x432c('0x10a'),'foreignKey':'UserId'});db[_0x432c('0x20')][_0x432c('0x11e')](db['CmContact'],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db['MailServerIn'][_0x432c('0x11e')](db[_0x432c('0x3d')],{'as':_0x432c('0x3d'),'foreignKey':'MailAccountId'});db[_0x432c('0x39')][_0x432c('0x11e')](db['CloudProvider'],{'as':_0x432c('0x158'),'foreignKey':_0x432c('0x159'),'onDelete':_0x432c('0x15a')});db[_0x432c('0x3b')][_0x432c('0x11e')](db[_0x432c('0x3d')],{'as':_0x432c('0x3d'),'foreignKey':_0x432c('0x15b')});db[_0x432c('0x3b')][_0x432c('0x11e')](db['CloudProvider'],{'as':_0x432c('0x158'),'foreignKey':_0x432c('0x159'),'onDelete':'restrict'});db[_0x432c('0x3d')]['hasOne'](db[_0x432c('0x39')],{'as':'Imap','onDelete':_0x432c('0x10c')});db['MailAccount'][_0x432c('0x10e')](db[_0x432c('0x3b')],{'as':_0x432c('0x15c'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x3d')][_0x432c('0x110')](db['Disposition'],{'as':_0x432c('0x15d'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x432c('0x3d')][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':_0x432c('0x15f'),'foreignKey':_0x432c('0x15b')});db[_0x432c('0x3d')][_0x432c('0x110')](db[_0x432c('0x42')],{'as':_0x432c('0x14e'),'foreignKey':_0x432c('0x15b')});db[_0x432c('0x3d')][_0x432c('0x110')](db[_0x432c('0x41')],{'as':'Interactions'});db[_0x432c('0x3d')][_0x432c('0x110')](db['MailApplication'],{'as':'Applications'});db[_0x432c('0x3d')]['belongsTo'](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db['MailAccount'][_0x432c('0x11e')](db[_0x432c('0x162')],{'as':_0x432c('0x162'),'foreignKey':_0x432c('0x163')});db[_0x432c('0x3d')]['belongsTo'](db[_0x432c('0x88')],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db['MailAccount'][_0x432c('0x123')](db['User'],{'as':_0x432c('0x14a'),'through':'user_has_mail_accounts'});db[_0x432c('0x3f')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x30')});db[_0x432c('0x3f')][_0x432c('0x123')](db['Team'],{'through':_0x432c('0x164'),'as':_0x432c('0x165')});db[_0x432c('0x41')]['hasMany'](db[_0x432c('0x42')],{'as':'Messages','onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x166')});db[_0x432c('0x41')]['belongsTo'](db[_0x432c('0x3d')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x15b')});db[_0x432c('0x41')]['belongsTo'](db[_0x432c('0x73')],{'as':'Contact','foreignKey':_0x432c('0x157')});db[_0x432c('0x41')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x168'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x41')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x16a'),'as':_0x432c('0x16b')});db[_0x432c('0x41')][_0x432c('0x123')](db['Tag'],{'through':_0x432c('0x16a'),'as':'ThroughTags'});db['MailInteraction'][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x16c'),'through':_0x432c('0x125'),'foreignKey':_0x432c('0x166')});db['MailMessage'][_0x432c('0x110')](db['Attachment'],{'as':_0x432c('0x16d'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x42')]['belongsTo'](db[_0x432c('0x10a')],{'as':_0x432c('0x10a')});db[_0x432c('0x42')][_0x432c('0x11e')](db[_0x432c('0x73')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x156')});db[_0x432c('0x42')][_0x432c('0x11e')](db['MailInteraction'],{'as':_0x432c('0x16e'),'foreignKey':_0x432c('0x166')});db[_0x432c('0x42')][_0x432c('0x11e')](db[_0x432c('0x3d')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x15b')});db[_0x432c('0x42')]['belongsTo'](db['ChatWebsite'],{'as':_0x432c('0x62'),'foreignKey':_0x432c('0x16f')});db[_0x432c('0x42')][_0x432c('0x11e')](db['ChatOfflineMessage'],{'as':_0x432c('0x6b'),'foreignKey':_0x432c('0x170')});db[_0x432c('0x171')][_0x432c('0x11e')](db['User'],{'onDelete':'restrict'});db[_0x432c('0x171')]['belongsTo'](db['MailQueue'],{'onDelete':_0x432c('0x15a')});db[_0x432c('0x171')][_0x432c('0x11e')](db[_0x432c('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0x432c('0x11e')](db[_0x432c('0x86')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x146')});db[_0x432c('0x171')][_0x432c('0x11e')](db[_0x432c('0x169')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport'][_0x432c('0x11e')](db[_0x432c('0x3d')],{});db[_0x432c('0x45')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':'List','foreignKey':_0x432c('0x161')});db[_0x432c('0x45')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x45')][_0x432c('0x11e')](db[_0x432c('0x41')],{});db['MailQueueReport'][_0x432c('0x11e')](db[_0x432c('0x42')],{});db[_0x432c('0x45')][_0x432c('0x11e')](db[_0x432c('0x10a')],{});db[_0x432c('0x45')][_0x432c('0x11e')](db['MailQueue'],{});db[_0x432c('0x47')][_0x432c('0x110')](db[_0x432c('0x49')],{'as':_0x432c('0x172'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x4b')][_0x432c('0x110')](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x173'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x4b')][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':_0x432c('0x15f'),'foreignKey':_0x432c('0x173')});db[_0x432c('0x4b')][_0x432c('0x110')](db[_0x432c('0x4e')],{'as':_0x432c('0x174')});db[_0x432c('0x4b')][_0x432c('0x110')](db[_0x432c('0x175')],{'as':'Applications'});db[_0x432c('0x4b')]['hasMany'](db[_0x432c('0x18')],{'as':_0x432c('0x176'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x4b')][_0x432c('0x110')](db['FaxMessage'],{'as':_0x432c('0x14e')});db[_0x432c('0x4b')][_0x432c('0x11e')](db[_0x432c('0x28')],{'as':_0x432c('0x28')});db[_0x432c('0x4b')]['belongsTo'](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db[_0x432c('0x4b')][_0x432c('0x11e')](db[_0x432c('0x88')],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0x4b')]['belongsToMany'](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x137')});db['FaxApplication']['belongsTo'](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x15a')});db['FaxApplication']['belongsTo'](db[_0x432c('0x50')],{'onDelete':_0x432c('0x15a')});db['FaxApplication'][_0x432c('0x11e')](db[_0x432c('0x4b')],{'onDelete':_0x432c('0x15a')});db[_0x432c('0x175')][_0x432c('0x11e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x432c('0x177')});db['FaxInteraction'][_0x432c('0x110')](db[_0x432c('0x178')],{'as':_0x432c('0x14e'),'onDelete':'cascade','foreignKey':_0x432c('0x179')});db[_0x432c('0x4e')][_0x432c('0x11e')](db['FaxAccount'],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x173')});db[_0x432c('0x4e')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x4e')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x168'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x4e')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x17a'),'as':_0x432c('0x16b')});db[_0x432c('0x4e')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x17a'),'as':_0x432c('0x17b')});db[_0x432c('0x4e')][_0x432c('0x123')](db['User'],{'as':_0x432c('0x16c'),'through':'user_has_fax_interactions','foreignKey':_0x432c('0x179')});db[_0x432c('0x178')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x10a')});db['FaxMessage'][_0x432c('0x11e')](db[_0x432c('0x4e')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x432c('0x73')],{'onDelete':'cascade','as':_0x432c('0x156')});db['FaxMessage']['belongsTo'](db[_0x432c('0xe9')],{'as':_0x432c('0xe9'),'foreignKey':_0x432c('0x17c')});db[_0x432c('0x178')][_0x432c('0x11e')](db[_0x432c('0x4b')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x173')});db[_0x432c('0x50')]['belongsToMany'](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x132')});db[_0x432c('0x50')][_0x432c('0x123')](db[_0x432c('0xe3')],{'through':_0x432c('0x17d'),'as':_0x432c('0x165')});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0x4b')],{});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x432c('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0x432c('0x157')});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0x4e')],{});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0x178')],{});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0x10a')],{});db[_0x432c('0x17e')][_0x432c('0x11e')](db[_0x432c('0x50')],{});db[_0x432c('0x52')][_0x432c('0x110')](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x17f'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x52')][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':_0x432c('0x15f'),'foreignKey':_0x432c('0x17f')});db['SmsAccount']['hasMany'](db[_0x432c('0x58')],{'as':_0x432c('0x14e'),'foreignKey':_0x432c('0x17f')});db[_0x432c('0x52')]['hasMany'](db[_0x432c('0x56')],{'as':'Interactions'});db[_0x432c('0x52')][_0x432c('0x110')](db[_0x432c('0x54')],{'as':_0x432c('0x140')});db[_0x432c('0x52')][_0x432c('0x11e')](db['CmList'],{'as':_0x432c('0x160'),'foreignKey':'ListId'});db[_0x432c('0x52')]['belongsTo'](db[_0x432c('0x88')],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0x52')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x13b')});db[_0x432c('0x54')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x15a')});db[_0x432c('0x54')][_0x432c('0x11e')](db['SmsQueue'],{'onDelete':_0x432c('0x15a')});db[_0x432c('0x54')][_0x432c('0x11e')](db[_0x432c('0x52')],{'onDelete':_0x432c('0x15a')});db['SmsApplication'][_0x432c('0x11e')](db[_0x432c('0x86')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x146')});db['SmsApplication'][_0x432c('0x11e')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x432c('0x110')](db[_0x432c('0x58')],{'as':_0x432c('0x14e'),'onDelete':_0x432c('0x10c'),'foreignKey':'SmsInteractionId'});db[_0x432c('0x56')][_0x432c('0x11e')](db[_0x432c('0x52')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x17f')});db[_0x432c('0x56')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x56')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x168'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x56')]['belongsToMany'](db[_0x432c('0x169')],{'through':_0x432c('0x180'),'as':_0x432c('0x16b')});db[_0x432c('0x56')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x180'),'as':_0x432c('0x17b')});db[_0x432c('0x56')][_0x432c('0x123')](db['User'],{'as':_0x432c('0x16c'),'through':_0x432c('0x128'),'foreignKey':_0x432c('0x181')});db[_0x432c('0x58')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x10a')});db[_0x432c('0x58')][_0x432c('0x11e')](db['CmContact'],{'onDelete':'cascade','as':_0x432c('0x156')});db[_0x432c('0x58')][_0x432c('0x11e')](db[_0x432c('0x56')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x16e'),'foreignKey':_0x432c('0x181')});db[_0x432c('0x58')][_0x432c('0x11e')](db[_0x432c('0x52')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x17f')});db['SmsQueue'][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x33'),'foreignKey':_0x432c('0x182')});db[_0x432c('0x59')][_0x432c('0x123')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x432c('0x5b')][_0x432c('0x110')](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x183'),'onDelete':_0x432c('0x10c')});db['OpenchannelAccount'][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':'Answers','foreignKey':_0x432c('0x183')});db['OpenchannelAccount'][_0x432c('0x110')](db[_0x432c('0x5d')],{'as':_0x432c('0x174'),'foreignKey':_0x432c('0x183')});db['OpenchannelAccount'][_0x432c('0x110')](db[_0x432c('0x184')],{'as':_0x432c('0x14e'),'foreignKey':_0x432c('0x183')});db[_0x432c('0x5b')][_0x432c('0x110')](db['OpenchannelApplication'],{'as':_0x432c('0x140'),'foreignKey':_0x432c('0x183')});db[_0x432c('0x5b')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0x432c('0x11e')](db[_0x432c('0x88')],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0x5b')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x185')});db[_0x432c('0x186')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x15a')});db[_0x432c('0x186')][_0x432c('0x11e')](db[_0x432c('0x60')],{'onDelete':_0x432c('0x15a'),'foreignKey':'OpenchannelQueueId'});db[_0x432c('0x186')][_0x432c('0x11e')](db['OpenchannelAccount'],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x183')});db[_0x432c('0x186')]['belongsTo'](db[_0x432c('0x86')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x146')});db[_0x432c('0x186')][_0x432c('0x11e')](db[_0x432c('0x169')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x177')});db[_0x432c('0x5d')]['hasMany'](db[_0x432c('0x184')],{'as':_0x432c('0x14e'),'onDelete':'cascade','foreignKey':_0x432c('0x187')});db['OpenchannelInteraction'][_0x432c('0x11e')](db[_0x432c('0x5b')],{'as':_0x432c('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0x432c('0x5d')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0x432c('0x5d')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x168'),'foreignKey':_0x432c('0x10d')});db['OpenchannelInteraction'][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x188'),'as':'Tags'});db['OpenchannelInteraction'][_0x432c('0x123')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x432c('0x17b')});db[_0x432c('0x5d')]['belongsToMany'](db['User'],{'as':_0x432c('0x16c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x432c('0x184')][_0x432c('0x11e')](db['User'],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x10a')});db[_0x432c('0x184')][_0x432c('0x11e')](db[_0x432c('0x73')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x156')});db[_0x432c('0x184')]['belongsTo'](db[_0x432c('0x5d')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x16e'),'foreignKey':_0x432c('0x187')});db[_0x432c('0x184')][_0x432c('0x11e')](db[_0x432c('0xe9')],{'as':_0x432c('0xe9'),'foreignKey':_0x432c('0x17c')});db[_0x432c('0x184')]['belongsTo'](db[_0x432c('0x5b')],{'as':_0x432c('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0x432c('0x60')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x35'),'foreignKey':'OpenchannelQueueId'});db[_0x432c('0x60')][_0x432c('0x123')](db[_0x432c('0xe3')],{'through':_0x432c('0x189'),'as':_0x432c('0x165')});db['ChatWebsite']['hasMany'](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x16f'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x62')][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':_0x432c('0x15f'),'foreignKey':_0x432c('0x16f')});db[_0x432c('0x62')][_0x432c('0x110')](db[_0x432c('0x71')],{'as':_0x432c('0x18a')});db[_0x432c('0x62')][_0x432c('0x110')](db['ChatInteraction'],{'as':_0x432c('0x174')});db[_0x432c('0x62')][_0x432c('0x110')](db[_0x432c('0x66')],{'as':_0x432c('0x140')});db[_0x432c('0x62')][_0x432c('0x110')](db[_0x432c('0x69')],{'as':_0x432c('0x14e')});db[_0x432c('0x62')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db[_0x432c('0x62')][_0x432c('0x11e')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x432c('0x62')]['belongsTo'](db[_0x432c('0x3d')],{'as':_0x432c('0x3d'),'foreignKey':'MailAccountId'});db[_0x432c('0x62')][_0x432c('0x11e')](db[_0x432c('0x88')],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0x62')][_0x432c('0x123')](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db[_0x432c('0x64')][_0x432c('0x11e')](db[_0x432c('0x5b')],{});db[_0x432c('0x64')]['belongsTo'](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db[_0x432c('0x64')][_0x432c('0x11e')](db['CmContact'],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db['OpenchannelQueueReport'][_0x432c('0x11e')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x432c('0x11e')](db[_0x432c('0x184')],{});db[_0x432c('0x64')][_0x432c('0x11e')](db['User'],{});db[_0x432c('0x64')][_0x432c('0x11e')](db['OpenchannelQueue'],{});db[_0x432c('0x66')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x18b'),'foreignKey':_0x432c('0x10d'),'onDelete':_0x432c('0x15a')});db[_0x432c('0x66')][_0x432c('0x11e')](db[_0x432c('0x6d')],{'as':'Queue','foreignKey':_0x432c('0x18c'),'onDelete':_0x432c('0x15a')});db['ChatApplication']['belongsTo'](db[_0x432c('0x62')],{'as':_0x432c('0x18d'),'foreignKey':_0x432c('0x16f'),'onDelete':_0x432c('0x15a')});db[_0x432c('0x66')][_0x432c('0x11e')](db[_0x432c('0x169')],{'onDelete':'restrict','foreignKey':_0x432c('0x177')});db[_0x432c('0x67')]['hasMany'](db[_0x432c('0x69')],{'as':_0x432c('0x14e'),'onDelete':_0x432c('0x10c'),'foreignKey':'ChatInteractionId'});db[_0x432c('0x67')][_0x432c('0x11e')](db[_0x432c('0x62')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x16f')});db[_0x432c('0x67')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':'Contact','foreignKey':_0x432c('0x157')});db[_0x432c('0x67')][_0x432c('0x11e')](db['User'],{'as':_0x432c('0x168'),'foreignKey':_0x432c('0x10d')});db[_0x432c('0x67')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x18e'),'as':_0x432c('0x16b')});db[_0x432c('0x67')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x18e'),'as':'ThroughTags'});db['ChatInteraction'][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x16c'),'through':_0x432c('0x126'),'foreignKey':'ChatInteractionId'});db[_0x432c('0x69')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x10a')});db['ChatMessage'][_0x432c('0x11e')](db[_0x432c('0x73')],{'onDelete':'cascade','as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db['ChatMessage'][_0x432c('0x11e')](db[_0x432c('0x67')],{'onDelete':_0x432c('0x10c'),'as':'Interaction','foreignKey':_0x432c('0x18f')});db[_0x432c('0x69')][_0x432c('0x11e')](db[_0x432c('0xe9')],{'as':_0x432c('0xe9'),'foreignKey':'AttachmentId'});db[_0x432c('0x69')][_0x432c('0x11e')](db[_0x432c('0x62')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x16f')});db['ChatOfflineMessage']['hasMany'](db[_0x432c('0xe9')],{'as':_0x432c('0x16d'),'foreignKey':_0x432c('0x170'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x6b')][_0x432c('0x11e')](db[_0x432c('0x73')],{'onDelete':_0x432c('0x10c'),'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x6b')][_0x432c('0x11e')](db[_0x432c('0x62')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x16f')});db['ChatQueue'][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x130'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x432c('0xe3')],{'through':_0x432c('0x190'),'as':'Teams'});db[_0x432c('0x6f')][_0x432c('0x110')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x432c('0x10c')});db[_0x432c('0x6f')]['belongsToMany'](db[_0x432c('0x10a')],{'as':_0x432c('0x142'),'through':_0x432c('0x191')});db[_0x432c('0x71')][_0x432c('0x11e')](db[_0x432c('0x62')],{'as':_0x432c('0x18d'),'foreignKey':_0x432c('0x16f')});db[_0x432c('0x72')][_0x432c('0x110')](db[_0x432c('0x73')],{'as':_0x432c('0x120'),'foreignKey':_0x432c('0x192')});db['CmContact']['hasMany'](db[_0x432c('0x75')],{'as':_0x432c('0x193'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x73')]['hasMany'](db[_0x432c('0x114')],{'as':_0x432c('0x115'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x73')]['hasMany'](db['CmHopperHistory'],{'as':_0x432c('0x194'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x73')][_0x432c('0x110')](db[_0x432c('0x7b')],{'as':_0x432c('0x7b'),'foreignKey':_0x432c('0x157')});db['CmContact'][_0x432c('0x110')](db[_0x432c('0x195')],{'as':_0x432c('0x196'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x73')][_0x432c('0x110')](db[_0x432c('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x432c('0x15a')});db['CmContact'][_0x432c('0x110')](db[_0x432c('0x67')],{'as':'ChatInteractions','foreignKey':_0x432c('0x157'),'onDelete':_0x432c('0x15a')});db['CmContact'][_0x432c('0x110')](db[_0x432c('0x56')],{'as':'SmsInteractions','foreignKey':_0x432c('0x157'),'onDelete':_0x432c('0x15a')});db['CmContact']['hasMany'](db[_0x432c('0x4e')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x432c('0x73')][_0x432c('0x110')](db['MailInteraction'],{'as':_0x432c('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x432c('0x73')][_0x432c('0x11e')](db[_0x432c('0x72')],{'as':_0x432c('0x197'),'foreignKey':_0x432c('0x192')});db[_0x432c('0x73')][_0x432c('0x11e')](db['CmList'],{'as':'List','foreignKey':_0x432c('0x161'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x73')]['belongsToMany'](db[_0x432c('0x10a')],{'as':_0x432c('0x16c'),'through':_0x432c('0x121')});db[_0x432c('0x73')][_0x432c('0x123')](db[_0x432c('0x169')],{'as':_0x432c('0x16b'),'through':_0x432c('0x198')});db[_0x432c('0x73')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x198'),'as':_0x432c('0x17b')});db[_0x432c('0x75')][_0x432c('0x11e')](db['CmContact'],{'as':_0x432c('0x156'),'foreignKey':'ContactId','onDelete':_0x432c('0x10c')});db[_0x432c('0x75')][_0x432c('0x11e')](db['CmList'],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161'),'onDelete':'cascade'});db[_0x432c('0x75')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':'Agent','foreignKey':_0x432c('0x10d')});db[_0x432c('0x75')]['belongsTo'](db[_0x432c('0x12a')],{'as':'Queue','foreignKey':_0x432c('0x143'),'onDelete':'cascade'});db[_0x432c('0x75')]['belongsTo'](db[_0x432c('0x199')],{'as':_0x432c('0x199'),'foreignKey':_0x432c('0x19a'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x75')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':'Owner','foreignKey':_0x432c('0x19b')});db['CmHopperBlack']['belongsTo'](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x76')][_0x432c('0x11e')](db['CmList'],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161'),'onDelete':_0x432c('0x10c')});db['CmHopperBlack'][_0x432c('0x11e')](db[_0x432c('0x12a')],{'as':'Queue','foreignKey':_0x432c('0x143'),'onDelete':'cascade'});db[_0x432c('0x76')][_0x432c('0x11e')](db[_0x432c('0x199')],{'as':_0x432c('0x199'),'foreignKey':_0x432c('0x19a'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x19c')][_0x432c('0x110')](db[_0x432c('0x84')],{'as':{'plural':_0x432c('0x19d'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x19c')][_0x432c('0x110')](db[_0x432c('0x84')],{'as':{'plural':_0x432c('0x19e'),'singular':_0x432c('0x19f')},'foreignKey':_0x432c('0x1a0'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db['Automation'][_0x432c('0x110')](db[_0x432c('0x7f')],{'as':_0x432c('0x1a1'),'foreignKey':'AutomationId','onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x82')]['hasMany'](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x1a2'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x86')][_0x432c('0x110')](db[_0x432c('0x86')],{'as':'Intervals','foreignKey':_0x432c('0x146'),'onDelete':_0x432c('0x10c'),'hooks':!![],'required':![]});db['Interval'][_0x432c('0x110')](db[_0x432c('0x18')],{'as':'Extensions','foreignKey':_0x432c('0x146'),'onDelete':_0x432c('0x15a')});db[_0x432c('0x86')][_0x432c('0x110')](db['MailApplication'],{'as':_0x432c('0x1a3'),'foreignKey':_0x432c('0x146')});db[_0x432c('0x86')][_0x432c('0x110')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x432c('0x146')});db[_0x432c('0x86')][_0x432c('0x110')](db[_0x432c('0x175')],{'as':_0x432c('0x1a4'),'foreignKey':_0x432c('0x146')});db['Interval'][_0x432c('0x110')](db[_0x432c('0x54')],{'as':_0x432c('0x1a5'),'foreignKey':'IntervalId'});db[_0x432c('0x8d')][_0x432c('0x11e')](db[_0x432c('0x3d')],{});db[_0x432c('0x8d')][_0x432c('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':_0x432c('0x1a6')});db[_0x432c('0x8d')][_0x432c('0x11e')](db[_0x432c('0x1a7')],{'foreignKey':_0x432c('0x1a8')});db[_0x432c('0x8f')][_0x432c('0x123')](db[_0x432c('0x1a9')],{'as':_0x432c('0x1aa'),'through':_0x432c('0x1ab'),'onDelete':_0x432c('0x15a')});db[_0x432c('0x169')]['belongsToMany'](db[_0x432c('0x73')],{'through':_0x432c('0x198')});db[_0x432c('0x169')]['belongsToMany'](db[_0x432c('0x67')],{'through':_0x432c('0x18e')});db['Tag'][_0x432c('0x123')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x432c('0x56')],{'through':_0x432c('0x180')});db[_0x432c('0x169')][_0x432c('0x123')](db[_0x432c('0x4e')],{'through':_0x432c('0x17a')});db['Tag'][_0x432c('0x123')](db[_0x432c('0x5d')],{'through':_0x432c('0x188')});db[_0x432c('0x169')][_0x432c('0x123')](db[_0x432c('0xfd')],{'through':'whatsapp_interaction_has_tags'});db[_0x432c('0x1ac')][_0x432c('0x110')](db[_0x432c('0x84')],{'as':{'plural':_0x432c('0x1ad'),'singular':'AllCondition'},'foreignKey':_0x432c('0x1ae'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x1ac')][_0x432c('0x110')](db['Condition'],{'as':{'plural':_0x432c('0x1af'),'singular':_0x432c('0x1b0')},'foreignKey':_0x432c('0x1b1'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x1ac')]['hasMany'](db[_0x432c('0x7f')],{'as':_0x432c('0x1a1'),'foreignKey':_0x432c('0x1b2'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x1a7')][_0x432c('0x110')](db[_0x432c('0x1b3')],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1a8'),'hooks':!![]});db['AnalyticDefaultReport'][_0x432c('0x110')](db[_0x432c('0x1b3')],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':'DefaultReportId'});db[_0x432c('0x9a')][_0x432c('0x110')](db['AnalyticFieldReport'],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b5')});db['AnalyticFieldReport'][_0x432c('0x11e')](db[_0x432c('0x9a')],{'foreignKey':_0x432c('0x1b5')});db[_0x432c('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x432c('0x1b6'),'onDelete':'cascade','foreignKey':_0x432c('0x1b7')});db[_0x432c('0xa1')][_0x432c('0x110')](db[_0x432c('0xa2')],{'as':_0x432c('0x1b8'),'onDelete':'cascade','foreignKey':_0x432c('0x1b9')});db[_0x432c('0xa1')]['hasMany'](db[_0x432c('0xa2')],{'as':_0x432c('0x1ba'),'onDelete':'cascade','foreignKey':_0x432c('0x1bb')});db[_0x432c('0xa1')]['hasMany'](db['SalesforceField'],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bc')});db[_0x432c('0xa1')]['belongsTo'](db[_0x432c('0x9f')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xa2')][_0x432c('0x110')](db[_0x432c('0xa2')],{'as':_0x432c('0x1bd'),'foreignKey':_0x432c('0x1b9')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db['SalesforceField'][_0x432c('0x110')](db['SalesforceField'],{'as':'Field','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xa2')]['belongsTo'](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db[_0x432c('0xa4')]['hasMany'](db[_0x432c('0x1c0')],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0x1c0')][_0x432c('0x110')](db[_0x432c('0xa6')],{'as':_0x432c('0x1b8'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b9')});db['SugarcrmConfiguration'][_0x432c('0x110')](db[_0x432c('0xa6')],{'as':_0x432c('0x1ba'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0x1c0')][_0x432c('0x110')](db[_0x432c('0xa6')],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bc')});db['SugarcrmConfiguration'][_0x432c('0x11e')](db[_0x432c('0xa4')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xa6')][_0x432c('0x110')](db[_0x432c('0xa6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x432c('0xa6')][_0x432c('0x110')](db[_0x432c('0xa6')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xa6')][_0x432c('0x110')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xa6')]['belongsTo'](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db[_0x432c('0xa8')][_0x432c('0x110')](db[_0x432c('0x1c1')],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0x1c1')][_0x432c('0x110')](db[_0x432c('0xab')],{'as':_0x432c('0x1b8'),'onDelete':'cascade','foreignKey':_0x432c('0x1b9')});db['DeskConfiguration'][_0x432c('0x110')](db[_0x432c('0xab')],{'as':_0x432c('0x1ba'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bb')});db['DeskConfiguration'][_0x432c('0x110')](db[_0x432c('0xab')],{'as':'Fields','onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bc')});db[_0x432c('0x1c1')][_0x432c('0x11e')](db[_0x432c('0xa8')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0x1c1')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':'int_desk_configuration_has_tags'});db[_0x432c('0xab')][_0x432c('0x110')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x432c('0xab')][_0x432c('0x110')](db[_0x432c('0xab')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xab')][_0x432c('0x110')](db[_0x432c('0xab')],{'as':_0x432c('0x1c2'),'foreignKey':_0x432c('0x1bc')});db[_0x432c('0xab')]['belongsTo'](db[_0x432c('0x92')],{'as':'Variable','foreignKey':_0x432c('0x1bf')});db['ZohoAccount'][_0x432c('0x110')](db['ZohoConfiguration'],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db['ZohoConfiguration'][_0x432c('0x110')](db['ZohoField'],{'as':_0x432c('0x1b8'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x432c('0x110')](db[_0x432c('0xaf')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x432c('0x1bb')});db[_0x432c('0xad')]['hasMany'](db[_0x432c('0xaf')],{'as':_0x432c('0x1b4'),'onDelete':'cascade','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xad')]['belongsTo'](db[_0x432c('0x1c3')],{'as':'Account','foreignKey':_0x432c('0x1b7')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x432c('0x1bd'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0xaf')][_0x432c('0x110')](db[_0x432c('0xaf')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db['ZohoField'][_0x432c('0x110')](db['ZohoField'],{'as':'Field','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xaf')][_0x432c('0x11e')](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db[_0x432c('0xb1')][_0x432c('0x110')](db['ZendeskConfiguration'],{'as':_0x432c('0x1b6'),'onDelete':'cascade','foreignKey':_0x432c('0x1b7')});db[_0x432c('0xb3')][_0x432c('0x110')](db[_0x432c('0x1c4')],{'as':_0x432c('0x1b8'),'foreignKey':_0x432c('0x1b9')});db['ZendeskConfiguration'][_0x432c('0x110')](db[_0x432c('0x1c4')],{'as':_0x432c('0x1ba'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xb3')]['hasMany'](db['ZendeskField'],{'as':_0x432c('0x1b4'),'foreignKey':'FieldId'});db[_0x432c('0xb3')]['belongsTo'](db['ZendeskAccount'],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xb3')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x1c5')});db[_0x432c('0x1c4')][_0x432c('0x110')](db['ZendeskField'],{'as':_0x432c('0x1bd'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0x1c4')][_0x432c('0x110')](db[_0x432c('0x1c4')],{'as':_0x432c('0x1be'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x432c('0x110')](db['ZendeskField'],{'as':_0x432c('0x1c2'),'foreignKey':_0x432c('0x1bc')});db['ZendeskField'][_0x432c('0x11e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['FreshdeskAccount'][_0x432c('0x110')](db[_0x432c('0xb7')],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':'AccountId'});db[_0x432c('0xb7')]['hasMany'](db[_0x432c('0x1c6')],{'as':_0x432c('0x1b8'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0xb7')]['hasMany'](db['FreshdeskField'],{'as':_0x432c('0x1ba'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x432c('0xb7')][_0x432c('0x110')](db[_0x432c('0x1c6')],{'as':'Fields','onDelete':_0x432c('0x10c'),'foreignKey':'FieldId'});db[_0x432c('0xb7')]['belongsTo'](db[_0x432c('0x1c7')],{'as':_0x432c('0x167'),'foreignKey':'AccountId'});db[_0x432c('0xb7')][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x1c8')});db[_0x432c('0x1c6')]['hasMany'](db[_0x432c('0x1c6')],{'as':_0x432c('0x1bd'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0x1c6')]['hasMany'](db[_0x432c('0x1c6')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db['FreshdeskField'][_0x432c('0x110')](db[_0x432c('0x1c6')],{'as':_0x432c('0x1c2'),'foreignKey':_0x432c('0x1bc')});db[_0x432c('0x1c6')][_0x432c('0x11e')](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db[_0x432c('0xba')][_0x432c('0x110')](db[_0x432c('0xbc')],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xbc')]['hasMany'](db['VtigerField'],{'as':_0x432c('0x1b8'),'foreignKey':'SubjectId'});db[_0x432c('0xbc')][_0x432c('0x110')](db[_0x432c('0xbe')],{'as':_0x432c('0x1ba'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xbc')][_0x432c('0x110')](db['VtigerField'],{'as':'Fields','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xbc')][_0x432c('0x11e')](db['VtigerAccount'],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db['VtigerField'][_0x432c('0x110')](db[_0x432c('0xbe')],{'as':_0x432c('0x1bd'),'foreignKey':'SubjectId'});db[_0x432c('0xbe')][_0x432c('0x110')](db['VtigerField'],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db['VtigerField']['hasMany'](db[_0x432c('0xbe')],{'as':'Field','foreignKey':_0x432c('0x1bc')});db[_0x432c('0xbe')][_0x432c('0x11e')](db['Variable'],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db['ServicenowAccount'][_0x432c('0x110')](db[_0x432c('0xc2')],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xc2')][_0x432c('0x110')](db[_0x432c('0xc4')],{'as':_0x432c('0x1b8'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0xc2')]['hasMany'](db[_0x432c('0xc4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x432c('0xc2')][_0x432c('0x110')](db[_0x432c('0xc4')],{'as':_0x432c('0x1b4'),'foreignKey':_0x432c('0x1bc')});db[_0x432c('0xc2')][_0x432c('0x11e')](db['ServicenowAccount'],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xc4')][_0x432c('0x110')](db[_0x432c('0xc4')],{'as':_0x432c('0x1bd'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x432c('0xc4')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xc4')]['hasMany'](db[_0x432c('0xc4')],{'as':_0x432c('0x1c2'),'foreignKey':_0x432c('0x1bc')});db['ServicenowField'][_0x432c('0x11e')](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':'VariableId'});db[_0x432c('0xc6')][_0x432c('0x110')](db[_0x432c('0xc8')],{'as':'Configurations','onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b7')});db[_0x432c('0xc6')][_0x432c('0x11e')](db[_0x432c('0x158')],{'as':_0x432c('0x158'),'foreignKey':'CloudProviderId'});db[_0x432c('0xc8')][_0x432c('0x110')](db['Dynamics365Field'],{'as':_0x432c('0x1b8'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0xc8')]['hasMany'](db[_0x432c('0xca')],{'as':_0x432c('0x1ba'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xc8')][_0x432c('0x110')](db[_0x432c('0xca')],{'as':_0x432c('0x1b4'),'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1bc')});db['Dynamics365Configuration'][_0x432c('0x11e')](db[_0x432c('0xc6')],{'as':_0x432c('0x167'),'foreignKey':'AccountId'});db[_0x432c('0xca')][_0x432c('0x110')](db[_0x432c('0xca')],{'as':_0x432c('0x1bd'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0xca')][_0x432c('0x110')](db[_0x432c('0xca')],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0xca')]['hasMany'](db[_0x432c('0xca')],{'as':_0x432c('0x1c2'),'foreignKey':_0x432c('0x1bc')});db['Dynamics365Field']['belongsTo'](db[_0x432c('0x92')],{'as':_0x432c('0x92'),'foreignKey':_0x432c('0x1bf')});db['FreshsalesAccount']['hasMany'](db['FreshsalesConfiguration'],{'as':_0x432c('0x1b6'),'onDelete':_0x432c('0x10c'),'foreignKey':'AccountId'});db[_0x432c('0x1c9')]['hasMany'](db[_0x432c('0x1ca')],{'as':_0x432c('0x1b8'),'foreignKey':_0x432c('0x1b9')});db[_0x432c('0x1c9')]['hasMany'](db[_0x432c('0x1ca')],{'as':_0x432c('0x1ba'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0x1c9')]['hasMany'](db[_0x432c('0x1ca')],{'as':'Fields','foreignKey':_0x432c('0x1bc')});db[_0x432c('0x1c9')][_0x432c('0x11e')](db[_0x432c('0xcc')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1b7')});db['FreshsalesField']['hasMany'](db[_0x432c('0x1ca')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x432c('0x1ca')][_0x432c('0x110')](db['FreshsalesField'],{'as':_0x432c('0x1be'),'foreignKey':_0x432c('0x1bb')});db[_0x432c('0x1ca')][_0x432c('0x110')](db['FreshsalesField'],{'as':_0x432c('0x1c2'),'foreignKey':'FieldId'});db[_0x432c('0x1ca')]['belongsTo'](db[_0x432c('0x92')],{'as':'Variable','foreignKey':'VariableId'});db[_0x432c('0xd1')][_0x432c('0x11e')](db[_0x432c('0x62')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db['ChatQueueReport'][_0x432c('0x11e')](db['CmContact'],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db['ChatQueueReport']['belongsTo'](db[_0x432c('0x67')],{});db[_0x432c('0xd1')][_0x432c('0x11e')](db[_0x432c('0x69')],{});db[_0x432c('0xd1')][_0x432c('0x11e')](db[_0x432c('0x10a')],{});db[_0x432c('0xd1')][_0x432c('0x11e')](db[_0x432c('0x6d')],{});db[_0x432c('0xd2')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x10c'),'foreignKey':'FromId'});db[_0x432c('0xd2')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x10c'),'foreignKey':_0x432c('0x1cb')});db[_0x432c('0x195')][_0x432c('0x110')](db[_0x432c('0x1cc')],{'foreignKey':_0x432c('0x1cd'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x195')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x432c('0x1cd'),'onDelete':_0x432c('0x10c')});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db[_0x432c('0x1ce')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db[_0x432c('0x1ce')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db[_0x432c('0x1ce')]['belongsTo'](db['SmsInteraction'],{});db[_0x432c('0x1ce')][_0x432c('0x11e')](db[_0x432c('0x58')],{});db[_0x432c('0x1ce')][_0x432c('0x11e')](db[_0x432c('0x10a')],{});db[_0x432c('0x1ce')][_0x432c('0x11e')](db[_0x432c('0x59')],{});db[_0x432c('0xdb')]['hasMany'](db[_0x432c('0x195')],{'foreignKey':'ProjectId'});db[_0x432c('0xdb')]['hasMany'](db[_0x432c('0x1cc')],{'foreignKey':_0x432c('0x1cf')});db[_0x432c('0xdb')][_0x432c('0x110')](db[_0x432c('0xd4')],{'foreignKey':_0x432c('0x1cf')});db[_0x432c('0x13d')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x16c'),'through':'user_has_square_projects'});db[_0x432c('0xe3')][_0x432c('0x123')](db['User'],{'as':_0x432c('0x14a'),'through':'user_has_teams'});db['Team'][_0x432c('0x123')](db[_0x432c('0x12a')],{'through':_0x432c('0x14b'),'as':_0x432c('0x12b')});db[_0x432c('0xe3')][_0x432c('0x123')](db[_0x432c('0x3f')],{'through':'team_has_mail_queues','as':_0x432c('0x12e')});db[_0x432c('0xe3')][_0x432c('0x123')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x432c('0xe3')]['belongsToMany'](db['FaxQueue'],{'through':_0x432c('0x17d'),'as':'FaxQueues'});db[_0x432c('0xe3')][_0x432c('0x123')](db[_0x432c('0x59')],{'through':'team_has_sms_queues','as':_0x432c('0x1d0')});db[_0x432c('0xe3')][_0x432c('0x123')](db['OpenchannelQueue'],{'through':_0x432c('0x189'),'as':'OpenchannelQueues'});db[_0x432c('0xe3')][_0x432c('0x123')](db[_0x432c('0x100')],{'through':_0x432c('0x1d1'),'as':'WhatsappQueues'});db['Team'][_0x432c('0x123')](db[_0x432c('0x12c')],{'through':_0x432c('0x104'),'as':_0x432c('0x12d')});db['Campaign']['hasMany'](db[_0x432c('0x75')],{'as':_0x432c('0x193'),'foreignKey':_0x432c('0x19a')});db[_0x432c('0x199')][_0x432c('0x110')](db[_0x432c('0x114')],{'as':_0x432c('0x115'),'foreignKey':_0x432c('0x19a')});db['Campaign'][_0x432c('0x110')](db['CmHopperHistory'],{'as':_0x432c('0x194'),'foreignKey':_0x432c('0x19a')});db[_0x432c('0x199')][_0x432c('0x110')](db[_0x432c('0x76')],{'as':_0x432c('0x144'),'foreignKey':_0x432c('0x19a')});db[_0x432c('0x199')][_0x432c('0x11e')](db[_0x432c('0x28')],{'as':_0x432c('0x28'),'foreignKey':_0x432c('0x145')});db[_0x432c('0x199')][_0x432c('0x11e')](db[_0x432c('0x28')],{'as':_0x432c('0x1d2'),'foreignKey':_0x432c('0x1d3')});db['Campaign']['belongsTo'](db[_0x432c('0x86')],{'as':_0x432c('0x86'),'foreignKey':_0x432c('0x146')});db[_0x432c('0x199')][_0x432c('0x11e')](db['SquareProject'],{'as':_0x432c('0x13d'),'foreignKey':_0x432c('0x1d4')});db['Campaign'][_0x432c('0x123')](db[_0x432c('0xf2')],{'as':'Lists','through':_0x432c('0x1d5')});db[_0x432c('0x199')][_0x432c('0x123')](db['CmList'],{'as':_0x432c('0x14c'),'through':_0x432c('0x1d6')});db[_0x432c('0xe9')][_0x432c('0x11e')](db['ChatOfflineMessage'],{'as':_0x432c('0x6b'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x432c('0x11e')](db[_0x432c('0x42')],{});db[_0x432c('0xec')][_0x432c('0x11e')](db['MailInteraction'],{});db['MailTransferReport'][_0x432c('0x11e')](db[_0x432c('0x3d')],{'foreignKey':_0x432c('0x1d7'),'as':_0x432c('0x1d8')});db[_0x432c('0xec')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1d9'),'as':_0x432c('0x1da')});db[_0x432c('0xec')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1db'),'as':_0x432c('0x1dc')});db[_0x432c('0xec')][_0x432c('0x11e')](db[_0x432c('0x3f')],{'foreignKey':_0x432c('0x1dd'),'as':_0x432c('0x1de')});db[_0x432c('0xec')][_0x432c('0x11e')](db[_0x432c('0x3d')],{'foreignKey':_0x432c('0x1df'),'as':'ToAccount'});db[_0x432c('0xee')][_0x432c('0x11e')](db[_0x432c('0x69')],{});db[_0x432c('0xee')][_0x432c('0x11e')](db['ChatInteraction'],{});db[_0x432c('0xee')]['belongsTo'](db[_0x432c('0x62')],{'foreignKey':_0x432c('0x1e0'),'as':_0x432c('0x1d8')});db[_0x432c('0xee')]['belongsTo'](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1d9'),'as':_0x432c('0x1da')});db['ChatTransferReport'][_0x432c('0x11e')](db['User'],{'foreignKey':_0x432c('0x1db'),'as':_0x432c('0x1dc')});db[_0x432c('0xee')][_0x432c('0x11e')](db[_0x432c('0x6d')],{'foreignKey':'ToChatQueueId','as':_0x432c('0x1de')});db['ChatTransferReport'][_0x432c('0x11e')](db[_0x432c('0x62')],{'foreignKey':_0x432c('0x1e1'),'as':_0x432c('0x1e2')});db[_0x432c('0x1e3')][_0x432c('0x11e')](db[_0x432c('0x178')],{});db['FaxTransferReport'][_0x432c('0x11e')](db[_0x432c('0x4e')],{});db[_0x432c('0x1e3')][_0x432c('0x11e')](db['FaxAccount'],{'foreignKey':_0x432c('0x1e4'),'as':_0x432c('0x1d8')});db[_0x432c('0x1e3')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'foreignKey':'FromUserId','as':_0x432c('0x1da')});db[_0x432c('0x1e3')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1db'),'as':'ToAgent'});db[_0x432c('0x1e3')][_0x432c('0x11e')](db[_0x432c('0x50')],{'foreignKey':_0x432c('0x1e5'),'as':_0x432c('0x1de')});db[_0x432c('0x1e3')][_0x432c('0x11e')](db[_0x432c('0x4b')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x432c('0xf0')][_0x432c('0x11e')](db[_0x432c('0x184')],{});db[_0x432c('0xf0')]['belongsTo'](db[_0x432c('0x5d')],{});db[_0x432c('0xf0')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x432c('0x1e6'),'as':_0x432c('0x1d8')});db[_0x432c('0xf0')][_0x432c('0x11e')](db['User'],{'foreignKey':_0x432c('0x1d9'),'as':_0x432c('0x1da')});db[_0x432c('0xf0')][_0x432c('0x11e')](db['User'],{'foreignKey':_0x432c('0x1db'),'as':'ToAgent'});db[_0x432c('0xf0')][_0x432c('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x432c('0x1e7'),'as':_0x432c('0x1de')});db[_0x432c('0xf0')]['belongsTo'](db[_0x432c('0x5b')],{'foreignKey':_0x432c('0x1e8'),'as':_0x432c('0x1e2')});db[_0x432c('0xf1')]['belongsTo'](db['SmsMessage'],{});db[_0x432c('0xf1')][_0x432c('0x11e')](db[_0x432c('0x56')],{});db[_0x432c('0xf1')][_0x432c('0x11e')](db[_0x432c('0x52')],{'foreignKey':_0x432c('0x1e9'),'as':_0x432c('0x1d8')});db[_0x432c('0xf1')][_0x432c('0x11e')](db['User'],{'foreignKey':_0x432c('0x1d9'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1db'),'as':'ToAgent'});db[_0x432c('0xf1')][_0x432c('0x11e')](db[_0x432c('0x59')],{'foreignKey':_0x432c('0x1ea'),'as':_0x432c('0x1de')});db[_0x432c('0xf1')][_0x432c('0x11e')](db[_0x432c('0x52')],{'foreignKey':_0x432c('0x1eb'),'as':_0x432c('0x1e2')});db['CmList']['hasMany'](db[_0x432c('0x82')],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x161'),'onDelete':_0x432c('0x10c')});db['CmList']['hasMany'](db[_0x432c('0x7d')],{'as':_0x432c('0x1ec'),'foreignKey':_0x432c('0x161')});db['CmList']['hasMany'](db[_0x432c('0x73')],{'as':'Contacts','onDelete':_0x432c('0x10c'),'foreignKey':'ListId'});db[_0x432c('0xf2')][_0x432c('0x110')](db[_0x432c('0x114')],{'as':_0x432c('0x115'),'foreignKey':'ListId'});db[_0x432c('0xf2')][_0x432c('0x110')](db[_0x432c('0x79')],{'as':_0x432c('0x1ed'),'foreignKey':_0x432c('0x161')});db[_0x432c('0xf2')][_0x432c('0x110')](db['ReportAgentPreview'],{'as':_0x432c('0x7b'),'foreignKey':_0x432c('0x161')});db[_0x432c('0xf2')]['belongsToMany'](db[_0x432c('0x12a')],{'as':_0x432c('0x1ee'),'through':_0x432c('0x149')});db[_0x432c('0xf2')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x432c('0x134')});db[_0x432c('0x12c')][_0x432c('0x110')](db[_0x432c('0x18')],{'as':_0x432c('0x113'),'onDelete':_0x432c('0x10c')});db[_0x432c('0x12c')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':'Agents','through':_0x432c('0x106')});db['VoicePrefix'][_0x432c('0x123')](db['Team'],{'through':_0x432c('0x104'),'as':_0x432c('0x165')});db[_0x432c('0xf4')][_0x432c('0x110')](db[_0x432c('0x10a')],{'as':_0x432c('0x16c'),'foreignKey':_0x432c('0x1ef')});db[_0x432c('0xf4')][_0x432c('0x110')](db[_0x432c('0xf6')],{'as':_0x432c('0x1f0'),'foreignKey':_0x432c('0x1ef'),'onDelete':'cascade'});db[_0x432c('0xf6')][_0x432c('0x110')](db[_0x432c('0x1f1')],{'as':'Resources','foreignKey':_0x432c('0x1f2'),'onDelete':'cascade'});db[_0x432c('0xfa')][_0x432c('0x110')](db['Disposition'],{'as':_0x432c('0x15d'),'foreignKey':_0x432c('0x1f3'),'onDelete':_0x432c('0x10c')});db[_0x432c('0xfa')][_0x432c('0x110')](db[_0x432c('0x15e')],{'as':_0x432c('0x15f'),'foreignKey':_0x432c('0x1f3')});db[_0x432c('0xfa')][_0x432c('0x110')](db['WhatsappMessage'],{'as':_0x432c('0x14e'),'foreignKey':_0x432c('0x1f3')});db[_0x432c('0xfa')][_0x432c('0x110')](db[_0x432c('0xfd')],{'as':_0x432c('0x174')});db[_0x432c('0xfa')][_0x432c('0x110')](db[_0x432c('0xfb')],{'as':'Applications'});db[_0x432c('0xfa')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db['WhatsappAccount'][_0x432c('0x11e')](db['Pause'],{'as':_0x432c('0x147'),'foreignKey':_0x432c('0x148')});db[_0x432c('0xfa')][_0x432c('0x123')](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x13c')});db[_0x432c('0xfb')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'onDelete':_0x432c('0x15a')});db['WhatsappApplication'][_0x432c('0x11e')](db[_0x432c('0x100')],{'onDelete':'restrict'});db[_0x432c('0xfb')][_0x432c('0x11e')](db['WhatsappAccount'],{'onDelete':_0x432c('0x15a')});db[_0x432c('0xfb')][_0x432c('0x11e')](db[_0x432c('0x86')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x146')});db['WhatsappApplication']['belongsTo'](db[_0x432c('0x169')],{'onDelete':_0x432c('0x15a'),'foreignKey':_0x432c('0x177')});db['WhatsappInteraction'][_0x432c('0x110')](db[_0x432c('0x1f4')],{'as':_0x432c('0x14e'),'onDelete':_0x432c('0x10c'),'foreignKey':'WhatsappInteractionId'});db[_0x432c('0xfd')][_0x432c('0x11e')](db[_0x432c('0xfa')],{'as':'Account','foreignKey':_0x432c('0x1f3')});db[_0x432c('0xfd')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':'Contact','foreignKey':_0x432c('0x157')});db[_0x432c('0xfd')][_0x432c('0x11e')](db[_0x432c('0x10a')],{'as':_0x432c('0x168'),'foreignKey':'UserId'});db[_0x432c('0xfd')][_0x432c('0x123')](db['Tag'],{'through':_0x432c('0x1f5'),'as':_0x432c('0x16b')});db['WhatsappInteraction'][_0x432c('0x123')](db[_0x432c('0x169')],{'through':_0x432c('0x1f5'),'as':_0x432c('0x17b')});db[_0x432c('0xfd')][_0x432c('0x123')](db['User'],{'as':_0x432c('0x16c'),'through':'user_has_whatsapp_interactions','foreignKey':_0x432c('0x1f6')});db[_0x432c('0x1f4')]['belongsTo'](db['User'],{'as':_0x432c('0x10a')});db[_0x432c('0x1f4')]['belongsTo'](db[_0x432c('0x73')],{'onDelete':'cascade','as':_0x432c('0x156')});db[_0x432c('0x1f4')][_0x432c('0x11e')](db[_0x432c('0xfd')],{'onDelete':_0x432c('0x10c'),'as':'Interaction','foreignKey':_0x432c('0x1f6')});db[_0x432c('0x1f4')][_0x432c('0x11e')](db[_0x432c('0xfa')],{'as':_0x432c('0x167'),'foreignKey':_0x432c('0x1f3')});db[_0x432c('0xff')][_0x432c('0x11e')](db[_0x432c('0xfa')],{});db[_0x432c('0xff')][_0x432c('0x11e')](db[_0x432c('0xf2')],{'as':_0x432c('0x160'),'foreignKey':_0x432c('0x161')});db[_0x432c('0xff')][_0x432c('0x11e')](db[_0x432c('0x73')],{'as':_0x432c('0x156'),'foreignKey':_0x432c('0x157')});db['WhatsappQueueReport'][_0x432c('0x11e')](db['WhatsappInteraction'],{});db[_0x432c('0xff')][_0x432c('0x11e')](db[_0x432c('0x100')],{});db['WhatsappQueueReport'][_0x432c('0x11e')](db[_0x432c('0x1f4')],{});db[_0x432c('0xff')][_0x432c('0x11e')](db[_0x432c('0x10a')],{});db[_0x432c('0x1f7')][_0x432c('0x11e')](db[_0x432c('0x1f4')],{});db['WhatsappTransferReport'][_0x432c('0x11e')](db[_0x432c('0xfd')],{});db[_0x432c('0x1f7')][_0x432c('0x11e')](db[_0x432c('0xfa')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x432c('0x1f7')][_0x432c('0x11e')](db['WhatsappAccount'],{'foreignKey':_0x432c('0x1f8'),'as':_0x432c('0x1e2')});db['WhatsappTransferReport'][_0x432c('0x11e')](db[_0x432c('0x100')],{'foreignKey':_0x432c('0x1f9'),'as':_0x432c('0x1de')});db['WhatsappTransferReport'][_0x432c('0x11e')](db[_0x432c('0x10a')],{'foreignKey':_0x432c('0x1d9'),'as':_0x432c('0x1da')});db[_0x432c('0x1f7')][_0x432c('0x11e')](db['User'],{'foreignKey':_0x432c('0x1db'),'as':_0x432c('0x1dc')});db[_0x432c('0x100')]['belongsToMany'](db[_0x432c('0x10a')],{'as':_0x432c('0x14a'),'through':_0x432c('0x37'),'foreignKey':_0x432c('0x1fa')});db[_0x432c('0x100')][_0x432c('0x123')](db[_0x432c('0xe3')],{'through':'team_has_whatsapp_queues','as':_0x432c('0x165')});db['UserSetting']['belongsTo'](db[_0x432c('0x10a')],{'as':_0x432c('0x1fb'),'foreignKey':_0x432c('0x10d'),'onDelete':_0x432c('0x10c'),'hooks':!![]});db[_0x432c('0x158')]['hasOne'](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x432c('0x15a')});db[_0x432c('0x158')][_0x432c('0x10e')](db[_0x432c('0x39')],{'as':_0x432c('0x1fc'),'onDelete':_0x432c('0x15a')});db['CloudProvider'][_0x432c('0x10e')](db[_0x432c('0x3b')],{'as':'Smtp','onDelete':_0x432c('0x15a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xeefd=['UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','UserId','userSetting','cascade','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','ChatWebsites','MailAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','CmHopperFinal','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','Interval','mandatoryDispositionPauseId','Lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Smtp','CannedAnswer','Answers','MailMessage','Messages','List','TemplateId','mandatoryDispositionPause','user_has_mail_accounts','MailQueue','team_has_mail_queues','MailInteractionId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','ListId','Items','Disposition','Dispositions','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','user_has_fax_interactions','FaxQueueReport','SmsAccountId','SmsQueue','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','AttachmentId','OpenchannelQueueId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Extensions','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','Mohs','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','VtigerConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_fax_queues','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','Hoppers','HopperBlacks','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToUserId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','password','options','username','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/cannedAnswer/cannedAnswer.model','Condition','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix'];(function(_0x263204,_0x19286b){var _0xed3987=function(_0x282bf1){while(--_0x282bf1){_0x263204['push'](_0x263204['shift']());}};_0xed3987(++_0x19286b);}(_0xeefd,0x109));var _0xdeef=function(_0x5a3994,_0x4c2500){_0x5a3994=_0x5a3994-0x0;var _0xe9e6e2=_0xeefd[_0x5a3994];return _0xe9e6e2;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xdeef('0x0'));var _=require(_0xdeef('0x1'));var jstz=require(_0xdeef('0x2'));var timezone=jstz[_0xdeef('0x3')]();config['sequelize']=_[_0xdeef('0x4')](config['sequelize'],{'database':_0xdeef('0x5'),'username':_0xdeef('0x6'),'password':_0xdeef('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xdeef('0x8'),'dialectOptions':{'charset':_0xdeef('0x9')},'logging':![],'timezone':timezone[_0xdeef('0xa')](),'define':{'charset':_0xdeef('0xb'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0xdeef('0x4')](config[_0xdeef('0xc')],{'database':_0xdeef('0x5'),'username':'xcall','password':_0xdeef('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xdeef('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdeef('0xb'),'collate':_0xdeef('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdeef('0x0')][_0xdeef('0xe')],config[_0xdeef('0x0')]['username'],config[_0xdeef('0x0')][_0xdeef('0xf')],config['sequelize'][_0xdeef('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdeef('0xc')][_0xdeef('0xe')],config[_0xdeef('0xc')][_0xdeef('0x11')],config[_0xdeef('0xc')][_0xdeef('0xf')],config[_0xdeef('0xc')]['options'])};db['User']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/user/user.model');db[_0xdeef('0x13')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x14'));db[_0xdeef('0x15')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x16'));db[_0xdeef('0x17')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x18'));db[_0xdeef('0x19')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xdeef('0x1a')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x1b'));db[_0xdeef('0x1c')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x1d'));db[_0xdeef('0x1e')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x1f'));db[_0xdeef('0x20')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x21'));db[_0xdeef('0x22')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x23'));db['VoiceCallReport']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x24'));db[_0xdeef('0x25')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x26'));db[_0xdeef('0x27')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x28'));db[_0xdeef('0x29')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x2a'));db[_0xdeef('0x2b')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x2c'));db[_0xdeef('0x2d')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/trunk/trunk.model');db[_0xdeef('0x2e')]=db['sequelize']['import'](_0xdeef('0x2f'));db[_0xdeef('0x30')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xdeef('0x31')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x32'));db[_0xdeef('0x33')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x34'));db['UserMailQueue']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x35'));db[_0xdeef('0x36')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x37'));db['UserSmsQueue']=db[_0xdeef('0x0')]['import'](_0xdeef('0x38'));db[_0xdeef('0x39')]=db[_0xdeef('0x0')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xdeef('0x3a')]=db['sequelize'][_0xdeef('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xdeef('0x3b')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x3c'));db[_0xdeef('0x3d')]=db[_0xdeef('0x0')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xdeef('0x0')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/mailQueue/mailQueue.model');db[_0xdeef('0x3e')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x3f'));db[_0xdeef('0x40')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x41'));db['MailMessage']=db[_0xdeef('0x0')]['import'](_0xdeef('0x42'));db[_0xdeef('0x43')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x44'));db['MailQueueReport']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x45'));db[_0xdeef('0x46')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x47'));db[_0xdeef('0x48')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x49'));db[_0xdeef('0x4a')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/faxAccount/faxAccount.model');db[_0xdeef('0x4b')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x4c'));db['FaxInteraction']=db[_0xdeef('0x0')]['import'](_0xdeef('0x4d'));db['FaxMessage']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x4e'));db[_0xdeef('0x4f')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x50'));db['FaxQueueReport']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x51'));db[_0xdeef('0x52')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/smsAccount/smsAccount.model');db[_0xdeef('0x53')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x54'));db[_0xdeef('0x55')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x56'));db[_0xdeef('0x57')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x58'));db['SmsQueue']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x59'));db['OpenchannelAccount']=db['sequelize'][_0xdeef('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xdeef('0x5a')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x5b'));db[_0xdeef('0x5c')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x5d'));db['OpenchannelMessage']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x5e'));db[_0xdeef('0x5f')]=db['sequelize'][_0xdeef('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0xdeef('0x60')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x61'));db[_0xdeef('0x62')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x63'));db[_0xdeef('0x64')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x65'));db[_0xdeef('0x66')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x67'));db[_0xdeef('0x68')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x69'));db['ChatOfflineMessage']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x6a'));db[_0xdeef('0x6b')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x6c'));db[_0xdeef('0x6d')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x6e'));db[_0xdeef('0x6f')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x70'));db[_0xdeef('0x71')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x72'));db[_0xdeef('0x73')]=db['sequelize'][_0xdeef('0x12')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x74'));db[_0xdeef('0x75')]=db['sequelize']['import'](_0xdeef('0x76'));db['CmHopperFinal']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xdeef('0x77')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x78'));db[_0xdeef('0x79')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x7a'));db['CmCustomField']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0xdeef('0x7b')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x7c'));db[_0xdeef('0x7d')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x7e'));db['Disposition']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/disposition/disposition.model');db[_0xdeef('0x7f')]=db['sequelize']['import']('../api/condition/condition.model');db['Interval']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x80'));db[_0xdeef('0x81')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x82'));db['Cdr']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x83'));db['VoiceQueuesLog']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x84'));db[_0xdeef('0x85')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/schedule/schedule.model');db[_0xdeef('0x86')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x87'));db[_0xdeef('0x88')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/tag/tag.model');db[_0xdeef('0x89')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x8a'));db[_0xdeef('0x8b')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x8c'));db[_0xdeef('0x8d')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x8e'));db[_0xdeef('0x8f')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x90'));db['IntegrationReport']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x91'));db[_0xdeef('0x92')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x93'));db['AnalyticDefaultReport']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x94'));db[_0xdeef('0x95')]=db[_0xdeef('0x0')]['import'](_0xdeef('0x96'));db[_0xdeef('0x97')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x98'));db[_0xdeef('0x99')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x9a'));db[_0xdeef('0x9b')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xdeef('0x9c')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x9d'));db[_0xdeef('0x9e')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x9f'));db[_0xdeef('0xa0')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xa1'));db[_0xdeef('0xa2')]=db['sequelize'][_0xdeef('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xdeef('0xa3')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xa4'));db[_0xdeef('0xa5')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xa6'));db[_0xdeef('0xa7')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xa8'));db['DeskConfiguration']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xa9'));db['DeskField']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xaa'));db[_0xdeef('0xab')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xac'));db[_0xdeef('0xad')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xae'));db['ZohoField']=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db[_0xdeef('0xaf')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xb0'));db[_0xdeef('0xb1')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xdeef('0xb2')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xb3'));db[_0xdeef('0xb4')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xb5'));db[_0xdeef('0xb6')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xb7'));db['VtigerConfiguration']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xb8'));db['VtigerField']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xb9'));db[_0xdeef('0xba')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xdeef('0xbb')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xbc'));db[_0xdeef('0xbd')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xbe'));db[_0xdeef('0xbf')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xc0'));db[_0xdeef('0xc1')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xc2'));db[_0xdeef('0xc3')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xc4'));db[_0xdeef('0xc5')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xc6'));db[_0xdeef('0xc7')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xc8'));db[_0xdeef('0xc9')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x90'));db[_0xdeef('0xca')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xcb'));db['ChatQueueReport']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0xdeef('0xcc')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xcd'));db[_0xdeef('0xce')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xcf'));db['JscriptyQuestionReport']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xd0'));db['JscriptySessionReport']=db[_0xdeef('0x0')]['import'](_0xdeef('0xd1'));db[_0xdeef('0xd2')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xd3'));db['SquareReport']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xd4'));db['SquareDetailsReport']=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0xdeef('0xd5')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xd6'));db['Setting']=db[_0xdeef('0x0')]['import']('../api/setting/setting.model');db[_0xdeef('0xd7')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xd8'));db['SquareProject']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xd9'));db[_0xdeef('0xda')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xdb'));db[_0xdeef('0xdc')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xdd'));db[_0xdeef('0xde')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xdf'));db[_0xdeef('0xe0')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xe1'));db[_0xdeef('0xe2')]=db[_0xdeef('0x0')]['import'](_0xdeef('0xe3'));db['Migration']=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xe4'));db[_0xdeef('0xe5')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xe6'));db[_0xdeef('0xe7')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xe8'));db['MailTransferReport']=db['sequelize'][_0xdeef('0x12')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xe9'));db[_0xdeef('0xea')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xeb'));db[_0xdeef('0xec')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xed'));db[_0xdeef('0xee')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xef'));db[_0xdeef('0xf0')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xf1'));db[_0xdeef('0xf2')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0xdeef('0xf3')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/userProfile/userProfile.model');db[_0xdeef('0xf4')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xf5'));db[_0xdeef('0xf6')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0xf7'));db[_0xdeef('0xf8')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/userNotification/userNotification.model');db[_0xdeef('0xf9')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xdeef('0xfa')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0xfb'));db['WhatsappInteraction']=db[_0xdeef('0x0')]['import'](_0xdeef('0xfc'));db[_0xdeef('0xfd')]=db[_0xdeef('0x0')][_0xdeef('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0xdeef('0xfe')]=db[_0xdeef('0x0')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xdeef('0xff')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x100'));db[_0xdeef('0x101')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x102'));db[_0xdeef('0x103')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x104'));db[_0xdeef('0x105')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x106'));db[_0xdeef('0x107')]=db[_0xdeef('0x0')][_0xdeef('0x12')](_0xdeef('0x108'));db[_0xdeef('0x109')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x10a'));db[_0xdeef('0x10b')]=db['sequelize'][_0xdeef('0x12')](_0xdeef('0x10c'));db[_0xdeef('0x10d')][_0xdeef('0x10e')](db[_0xdeef('0x20')],{'as':_0xdeef('0x20'),'onDelete':'cascade','foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x10e')](db[_0xdeef('0x10b')],{'as':_0xdeef('0x110'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x1c')],{'as':'Recordings','foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x30')],{'as':_0xdeef('0x113'),'foreignKey':'UserId'});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x17')],{'as':'Extensions','onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x10d')][_0xdeef('0x112')](db['CmHopperFinal'],{'as':_0xdeef('0x114'),'foreignKey':_0xdeef('0x10f')});db['User'][_0xdeef('0x112')](db['CmHopperHistory'],{'as':_0xdeef('0x115'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xdeef('0x10f')});db['User'][_0xdeef('0x112')](db[_0xdeef('0x5c')],{'as':_0xdeef('0x116'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')]['hasMany'](db[_0xdeef('0x66')],{'as':_0xdeef('0x117'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')]['hasMany'](db[_0xdeef('0x55')],{'as':_0xdeef('0x118'),'foreignKey':'UserId'});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x119')],{'as':'FaxInteractions','foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x40')],{'as':_0xdeef('0x11a'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')][_0xdeef('0x112')](db[_0xdeef('0x11b')],{'as':_0xdeef('0x11c'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x10d')]['hasMany'](db['UserNotification'],{'as':_0xdeef('0x11d'),'foreignKey':_0xdeef('0x11e')});db[_0xdeef('0x10d')][_0xdeef('0x11f')](db[_0xdeef('0xf3')],{'as':'UserProfile','foreignKey':_0xdeef('0x120')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x6d')],{'as':_0xdeef('0x122'),'through':_0xdeef('0x123')});db['User'][_0xdeef('0x121')](db[_0xdeef('0x73')],{'as':_0xdeef('0x124'),'through':_0xdeef('0x125')});db[_0xdeef('0x10d')]['belongsToMany'](db[_0xdeef('0xf0')],{'as':'Lists','through':_0xdeef('0x126')});db[_0xdeef('0x10d')]['belongsToMany'](db['Team'],{'through':_0xdeef('0x127')});db['User'][_0xdeef('0x121')](db[_0xdeef('0x40')],{'as':_0xdeef('0x11a'),'through':_0xdeef('0x128')});db['User'][_0xdeef('0x121')](db[_0xdeef('0x66')],{'as':_0xdeef('0x117'),'through':_0xdeef('0x129')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x119')],{'as':_0xdeef('0x12a'),'through':'user_has_fax_interactions'});db['User'][_0xdeef('0x121')](db[_0xdeef('0x55')],{'as':_0xdeef('0x118'),'through':_0xdeef('0x12b')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['OpenchannelInteraction'],{'as':_0xdeef('0x116'),'through':_0xdeef('0x12c')});db[_0xdeef('0x10d')]['belongsToMany'](db[_0xdeef('0x11b')],{'as':_0xdeef('0x11c'),'through':'user_has_whatsapp_interactions'});db[_0xdeef('0x10d')]['belongsToMany'](db[_0xdeef('0x1a')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['VoicePrefix'],{'as':_0xdeef('0x12d'),'through':_0xdeef('0x109'),'required':![]});db['User'][_0xdeef('0x121')](db['MailQueue'],{'as':_0xdeef('0x12e'),'through':_0xdeef('0x12f'),'required':![]});db['User'][_0xdeef('0x121')](db[_0xdeef('0x6b')],{'as':_0xdeef('0x130'),'through':_0xdeef('0x33'),'required':![],'hooks':!![]});db['User'][_0xdeef('0x121')](db[_0xdeef('0x4f')],{'as':_0xdeef('0x131'),'through':_0xdeef('0x36'),'required':![]});db['User'][_0xdeef('0x121')](db['SmsQueue'],{'as':_0xdeef('0x132'),'through':_0xdeef('0x133'),'required':![]});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xdeef('0x10d')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xdeef('0x134'),'through':_0xdeef('0x3a'),'required':![]});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['CmList'],{'through':_0xdeef('0x126')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['ChatWebsite'],{'as':_0xdeef('0x135'),'through':'user_has_chat_websites'});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x4a')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x136')],{'as':_0xdeef('0x137'),'through':'user_has_mail_accounts'});db[_0xdeef('0x10d')][_0xdeef('0x121')](db['OpenchannelAccount'],{'as':_0xdeef('0x138'),'through':_0xdeef('0x139')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x52')],{'as':'SmsAccounts','through':_0xdeef('0x13a')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0xf9')],{'as':'WhatsappAccounts','through':_0xdeef('0x13b')});db[_0xdeef('0x10d')][_0xdeef('0x121')](db[_0xdeef('0x13c')],{'as':'SquareProjects','through':_0xdeef('0x13d')});db['VoiceChanSpy'][_0xdeef('0x112')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xdeef('0x13e')});db[_0xdeef('0x15')][_0xdeef('0x112')](db['VoiceExtension'],{'onDelete':_0xdeef('0x111')});db[_0xdeef('0x17')]['hasMany'](db[_0xdeef('0x17')],{'as':_0xdeef('0x13f'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x19')][_0xdeef('0x121')](db[_0xdeef('0x86')],{'as':_0xdeef('0x140'),'through':_0xdeef('0x141')});db[_0xdeef('0x1a')][_0xdeef('0x112')](db[_0xdeef('0x30')],{'as':_0xdeef('0x142'),'foreignKey':_0xdeef('0x143')});db[_0xdeef('0x1a')][_0xdeef('0x112')](db[_0xdeef('0x144')],{'as':'Hoppers','foreignKey':_0xdeef('0x143')});db[_0xdeef('0x1a')][_0xdeef('0x112')](db[_0xdeef('0x145')],{'as':'HopperFinals','foreignKey':_0xdeef('0x143')});db[_0xdeef('0x1a')]['hasMany'](db[_0xdeef('0x77')],{'as':_0xdeef('0x146'),'foreignKey':_0xdeef('0x143')});db['VoiceQueue']['hasMany'](db[_0xdeef('0x79')],{'as':_0xdeef('0x79'),'foreignKey':_0xdeef('0x143')});db[_0xdeef('0x1a')][_0xdeef('0x112')](db[_0xdeef('0x75')],{'as':'HopperBlacks','foreignKey':_0xdeef('0x143')});db[_0xdeef('0x1a')][_0xdeef('0x112')](db[_0xdeef('0x147')],{'as':_0xdeef('0x148'),'foreignKey':_0xdeef('0x143')});db['VoiceQueue'][_0xdeef('0x11f')](db[_0xdeef('0x2d')],{'as':_0xdeef('0x2d'),'foreignKey':_0xdeef('0x149')});db[_0xdeef('0x1a')][_0xdeef('0x11f')](db[_0xdeef('0x2d')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xdeef('0x1a')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'as':_0xdeef('0x14a'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xdeef('0x11f')](db[_0xdeef('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xdeef('0x14b')});db[_0xdeef('0x1a')][_0xdeef('0x121')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x14c'),'through':'voice_queues_has_cm_lists'});db[_0xdeef('0x1a')]['belongsToMany'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x31')});db['VoiceQueue']['belongsToMany'](db[_0xdeef('0xde')],{'as':_0xdeef('0x14e'),'through':_0xdeef('0x105')});db[_0xdeef('0x1a')][_0xdeef('0x121')](db['CmList'],{'as':_0xdeef('0x14f'),'through':_0xdeef('0x150')});db[_0xdeef('0x1c')]['belongsTo'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x10d'),'foreignKey':_0xdeef('0x10f')});db['ScreenRecording'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x10d'),'foreignKey':'UserId'});db[_0xdeef('0x20')][_0xdeef('0x112')](db[_0xdeef('0x22')],{'as':'Messages','onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x151'),'sourceKey':_0xdeef('0x152')});db[_0xdeef('0x22')]['belongsTo'](db[_0xdeef('0x20')],{'foreignKey':_0xdeef('0x151'),'targetKey':_0xdeef('0x152')});db['VoiceCallReport'][_0xdeef('0x112')](db[_0xdeef('0x29')],{'as':_0xdeef('0x153'),'foreignKey':_0xdeef('0x154'),'constraints':![]});db[_0xdeef('0x155')]['hasMany'](db[_0xdeef('0x27')],{'as':_0xdeef('0x156'),'foreignKey':_0xdeef('0x154'),'constraints':![]});db[_0xdeef('0x155')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x10d'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x155')][_0xdeef('0x11f')](db['CmContact'],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db['MailServerIn']['belongsTo'](db['MailAccount'],{'as':_0xdeef('0x136'),'foreignKey':'MailAccountId'});db['MailServerIn'][_0xdeef('0x11f')](db[_0xdeef('0x103')],{'as':_0xdeef('0x103'),'foreignKey':_0xdeef('0x159'),'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x3d')][_0xdeef('0x11f')](db['MailAccount'],{'as':_0xdeef('0x136'),'foreignKey':_0xdeef('0x15b')});db[_0xdeef('0x3d')][_0xdeef('0x11f')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0xdeef('0x15a')});db[_0xdeef('0x136')][_0xdeef('0x10e')](db[_0xdeef('0x3b')],{'as':_0xdeef('0x15c'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x136')][_0xdeef('0x10e')](db[_0xdeef('0x3d')],{'as':_0xdeef('0x15d'),'onDelete':'cascade'});db[_0xdeef('0x136')][_0xdeef('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xdeef('0x15b'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x136')][_0xdeef('0x112')](db[_0xdeef('0x15e')],{'as':_0xdeef('0x15f'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0xdeef('0x160')],{'as':_0xdeef('0x161'),'foreignKey':_0xdeef('0x15b')});db[_0xdeef('0x136')][_0xdeef('0x112')](db['MailInteraction'],{'as':'Interactions'});db[_0xdeef('0x136')][_0xdeef('0x112')](db[_0xdeef('0x43')],{'as':_0xdeef('0x13f')});db[_0xdeef('0x136')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':'ListId'});db[_0xdeef('0x136')][_0xdeef('0x11f')](db['Template'],{'as':_0xdeef('0x89'),'foreignKey':_0xdeef('0x163')});db[_0xdeef('0x136')][_0xdeef('0x11f')](db[_0xdeef('0x81')],{'as':_0xdeef('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':'Agents','through':_0xdeef('0x165')});db[_0xdeef('0x166')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':'Agents','through':_0xdeef('0x12f')});db[_0xdeef('0x166')][_0xdeef('0x121')](db[_0xdeef('0xde')],{'through':_0xdeef('0x167'),'as':'Teams'});db[_0xdeef('0x40')]['hasMany'](db[_0xdeef('0x160')],{'as':'Messages','onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x168')});db['MailInteraction']['belongsTo'](db[_0xdeef('0x136')],{'as':'Account','foreignKey':_0xdeef('0x15b')});db[_0xdeef('0x40')]['belongsTo'](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x40')][_0xdeef('0x11f')](db['User'],{'as':_0xdeef('0x169'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x40')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':'mail_interaction_has_tags','as':_0xdeef('0x16a')});db[_0xdeef('0x40')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x16b'),'as':_0xdeef('0x16c')});db[_0xdeef('0x40')][_0xdeef('0x121')](db['User'],{'as':'Users','through':_0xdeef('0x128'),'foreignKey':_0xdeef('0x168')});db[_0xdeef('0x160')][_0xdeef('0x112')](db[_0xdeef('0xe5')],{'as':_0xdeef('0x16d'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x160')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':'User'});db[_0xdeef('0x160')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'onDelete':'cascade','as':_0xdeef('0x157')});db[_0xdeef('0x160')][_0xdeef('0x11f')](db['MailInteraction'],{'as':_0xdeef('0x16e'),'foreignKey':_0xdeef('0x168')});db['MailMessage'][_0xdeef('0x11f')](db[_0xdeef('0x136')],{'as':'Account','foreignKey':_0xdeef('0x15b')});db['MailMessage']['belongsTo'](db[_0xdeef('0x60')],{'as':_0xdeef('0x60'),'foreignKey':_0xdeef('0x16f')});db['MailMessage'][_0xdeef('0x11f')](db[_0xdeef('0x170')],{'as':'ChatOfflineMessage','foreignKey':_0xdeef('0x171')});db[_0xdeef('0x43')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':'restrict'});db[_0xdeef('0x43')]['belongsTo'](db[_0xdeef('0x166')],{'onDelete':'restrict'});db[_0xdeef('0x43')][_0xdeef('0x11f')](db[_0xdeef('0x136')],{'onDelete':'restrict'});db[_0xdeef('0x43')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x172')});db[_0xdeef('0x43')]['belongsTo'](db[_0xdeef('0x88')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x173')});db['MailQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x136')],{});db[_0xdeef('0x174')]['belongsTo'](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0x174')][_0xdeef('0x11f')](db['CmContact'],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x174')][_0xdeef('0x11f')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0xdeef('0x174')]['belongsTo'](db[_0xdeef('0x10d')],{});db[_0xdeef('0x174')][_0xdeef('0x11f')](db['MailQueue'],{});db[_0xdeef('0x46')]['hasMany'](db['DashboardItem'],{'as':_0xdeef('0x176'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x4a')][_0xdeef('0x112')](db[_0xdeef('0x177')],{'as':_0xdeef('0x178'),'foreignKey':_0xdeef('0x179'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x4a')][_0xdeef('0x112')](db['CannedAnswer'],{'as':_0xdeef('0x15f'),'foreignKey':_0xdeef('0x179')});db[_0xdeef('0x4a')][_0xdeef('0x112')](db[_0xdeef('0x119')],{'as':_0xdeef('0x17a')});db[_0xdeef('0x4a')][_0xdeef('0x112')](db[_0xdeef('0x4b')],{'as':_0xdeef('0x13f')});db[_0xdeef('0x4a')][_0xdeef('0x112')](db['VoiceExtension'],{'as':_0xdeef('0x17b'),'onDelete':_0xdeef('0x111')});db['FaxAccount'][_0xdeef('0x112')](db['FaxMessage'],{'as':_0xdeef('0x161')});db[_0xdeef('0x4a')][_0xdeef('0x11f')](db[_0xdeef('0x2d')],{'as':_0xdeef('0x2d')});db[_0xdeef('0x4a')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0x4a')][_0xdeef('0x11f')](db['Pause'],{'as':_0xdeef('0x164'),'foreignKey':_0xdeef('0x14b')});db[_0xdeef('0x4a')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':'user_has_fax_accounts'});db[_0xdeef('0x4b')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':'restrict'});db[_0xdeef('0x4b')]['belongsTo'](db[_0xdeef('0x4f')],{'onDelete':'restrict'});db[_0xdeef('0x4b')][_0xdeef('0x11f')](db[_0xdeef('0x4a')],{'onDelete':'restrict'});db['FaxApplication'][_0xdeef('0x11f')](db[_0xdeef('0x88')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x173')});db[_0xdeef('0x119')][_0xdeef('0x112')](db[_0xdeef('0x17c')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xdeef('0x17d')});db[_0xdeef('0x119')][_0xdeef('0x11f')](db[_0xdeef('0x4a')],{'as':_0xdeef('0x17e'),'foreignKey':'FaxAccountId'});db[_0xdeef('0x119')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db['FaxInteraction'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':'Owner','foreignKey':_0xdeef('0x10f')});db['FaxInteraction']['belongsToMany'](db[_0xdeef('0x88')],{'through':_0xdeef('0x17f'),'as':'Tags'});db[_0xdeef('0x119')]['belongsToMany'](db[_0xdeef('0x88')],{'through':'fax_interaction_has_tags','as':_0xdeef('0x16c')});db[_0xdeef('0x119')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':'Users','through':_0xdeef('0x180'),'foreignKey':'FaxInteractionId'});db[_0xdeef('0x17c')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x10d')});db[_0xdeef('0x17c')][_0xdeef('0x11f')](db[_0xdeef('0x119')],{'as':_0xdeef('0x16e'),'foreignKey':_0xdeef('0x17d')});db[_0xdeef('0x17c')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'onDelete':'cascade','as':_0xdeef('0x157')});db[_0xdeef('0x17c')][_0xdeef('0x11f')](db[_0xdeef('0xe5')],{'as':_0xdeef('0xe5'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0xdeef('0x11f')](db[_0xdeef('0x4a')],{'as':'Account','foreignKey':_0xdeef('0x179')});db[_0xdeef('0x4f')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x36')});db[_0xdeef('0x4f')][_0xdeef('0x121')](db[_0xdeef('0xde')],{'through':'team_has_fax_queues','as':_0xdeef('0x14e')});db[_0xdeef('0x181')][_0xdeef('0x11f')](db[_0xdeef('0x4a')],{});db[_0xdeef('0x181')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0x181')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':'ContactId'});db[_0xdeef('0x181')][_0xdeef('0x11f')](db[_0xdeef('0x119')],{});db['FaxQueueReport'][_0xdeef('0x11f')](db['FaxMessage'],{});db[_0xdeef('0x181')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{});db['FaxQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x4f')],{});db[_0xdeef('0x52')][_0xdeef('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xdeef('0x111')});db[_0xdeef('0x52')][_0xdeef('0x112')](db[_0xdeef('0x15e')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xdeef('0x112')](db[_0xdeef('0x57')],{'as':_0xdeef('0x161'),'foreignKey':_0xdeef('0x182')});db[_0xdeef('0x52')][_0xdeef('0x112')](db[_0xdeef('0x55')],{'as':_0xdeef('0x17a')});db[_0xdeef('0x52')][_0xdeef('0x112')](db[_0xdeef('0x53')],{'as':_0xdeef('0x13f')});db['SmsAccount'][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':'List','foreignKey':_0xdeef('0x175')});db[_0xdeef('0x52')]['belongsTo'](db[_0xdeef('0x81')],{'as':_0xdeef('0x164'),'foreignKey':_0xdeef('0x14b')});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x13a')});db['SmsApplication'][_0xdeef('0x11f')](db['User'],{'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x53')][_0xdeef('0x11f')](db[_0xdeef('0x183')],{'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x53')]['belongsTo'](db[_0xdeef('0x52')],{'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x53')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x172')});db[_0xdeef('0x53')][_0xdeef('0x11f')](db[_0xdeef('0x88')],{'onDelete':'restrict','foreignKey':_0xdeef('0x173')});db['SmsInteraction']['hasMany'](db[_0xdeef('0x57')],{'as':_0xdeef('0x161'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x184')});db[_0xdeef('0x55')][_0xdeef('0x11f')](db[_0xdeef('0x52')],{'as':'Account','foreignKey':_0xdeef('0x182')});db[_0xdeef('0x55')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db['SmsInteraction']['belongsTo'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x169'),'foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x55')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x185'),'as':_0xdeef('0x16a')});db[_0xdeef('0x55')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x185'),'as':_0xdeef('0x16c')});db[_0xdeef('0x55')]['belongsToMany'](db[_0xdeef('0x10d')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xdeef('0x184')});db[_0xdeef('0x57')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x10d')});db[_0xdeef('0x57')]['belongsTo'](db['CmContact'],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x157')});db[_0xdeef('0x57')][_0xdeef('0x11f')](db['SmsInteraction'],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x16e'),'foreignKey':_0xdeef('0x184')});db[_0xdeef('0x57')][_0xdeef('0x11f')](db['SmsAccount'],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x182')});db[_0xdeef('0x183')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x133'),'foreignKey':'SmsQueueId'});db[_0xdeef('0x183')][_0xdeef('0x121')](db[_0xdeef('0xde')],{'through':_0xdeef('0x186'),'as':_0xdeef('0x14e')});db[_0xdeef('0x187')][_0xdeef('0x112')](db[_0xdeef('0x177')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xdeef('0x111')});db[_0xdeef('0x187')][_0xdeef('0x112')](db[_0xdeef('0x15e')],{'as':'Answers','foreignKey':_0xdeef('0x188')});db[_0xdeef('0x187')]['hasMany'](db[_0xdeef('0x5c')],{'as':_0xdeef('0x17a'),'foreignKey':'OpenchannelAccountId'});db[_0xdeef('0x187')][_0xdeef('0x112')](db[_0xdeef('0x189')],{'as':_0xdeef('0x161'),'foreignKey':_0xdeef('0x188')});db['OpenchannelAccount'][_0xdeef('0x112')](db[_0xdeef('0x5a')],{'as':_0xdeef('0x13f'),'foreignKey':_0xdeef('0x188')});db[_0xdeef('0x187')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount']['belongsTo'](db[_0xdeef('0x81')],{'as':_0xdeef('0x164'),'foreignKey':_0xdeef('0x14b')});db['OpenchannelAccount'][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x139')});db[_0xdeef('0x5a')]['belongsTo'](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x5a')][_0xdeef('0x11f')](db[_0xdeef('0x5f')],{'onDelete':_0xdeef('0x15a'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication']['belongsTo'](db[_0xdeef('0x187')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xdeef('0x5a')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x172')});db['OpenchannelApplication'][_0xdeef('0x11f')](db[_0xdeef('0x88')],{'onDelete':'restrict','foreignKey':_0xdeef('0x173')});db[_0xdeef('0x5c')][_0xdeef('0x112')](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xdeef('0x18a')});db[_0xdeef('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x188')});db[_0xdeef('0x5c')]['belongsTo'](db[_0xdeef('0x73')],{'as':'Contact','foreignKey':_0xdeef('0x158')});db['OpenchannelInteraction'][_0xdeef('0x11f')](db['User'],{'as':'Owner','foreignKey':_0xdeef('0x10f')});db[_0xdeef('0x5c')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x18b'),'as':_0xdeef('0x16a')});db[_0xdeef('0x5c')][_0xdeef('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xdeef('0x16c')});db[_0xdeef('0x5c')][_0xdeef('0x121')](db['User'],{'as':_0xdeef('0x18c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0xdeef('0x189')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x10d')});db[_0xdeef('0x189')][_0xdeef('0x11f')](db['CmContact'],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x157')});db[_0xdeef('0x189')][_0xdeef('0x11f')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xdeef('0x18a')});db[_0xdeef('0x189')][_0xdeef('0x11f')](db['Attachment'],{'as':_0xdeef('0xe5'),'foreignKey':_0xdeef('0x18d')});db[_0xdeef('0x189')][_0xdeef('0x11f')](db[_0xdeef('0x187')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x188')});db['OpenchannelQueue'][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':'Agents','through':_0xdeef('0x39'),'foreignKey':_0xdeef('0x18e')});db[_0xdeef('0x5f')][_0xdeef('0x121')](db[_0xdeef('0xde')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xdeef('0x60')][_0xdeef('0x112')](db[_0xdeef('0x177')],{'as':_0xdeef('0x178'),'foreignKey':'ChatWebsiteId','onDelete':_0xdeef('0x111')});db[_0xdeef('0x60')][_0xdeef('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xdeef('0x60')]['hasMany'](db[_0xdeef('0x6f')],{'as':_0xdeef('0x18f')});db[_0xdeef('0x60')][_0xdeef('0x112')](db[_0xdeef('0x66')],{'as':_0xdeef('0x17a')});db[_0xdeef('0x60')][_0xdeef('0x112')](db[_0xdeef('0x64')],{'as':'Applications'});db[_0xdeef('0x60')]['hasMany'](db[_0xdeef('0x68')],{'as':_0xdeef('0x161')});db[_0xdeef('0x60')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0x60')]['belongsTo'](db['Interval'],{'as':_0xdeef('0x14a'),'foreignKey':_0xdeef('0x172')});db['ChatWebsite'][_0xdeef('0x11f')](db[_0xdeef('0x136')],{'as':_0xdeef('0x136'),'foreignKey':_0xdeef('0x15b')});db['ChatWebsite']['belongsTo'](db[_0xdeef('0x81')],{'as':_0xdeef('0x164'),'foreignKey':_0xdeef('0x14b')});db[_0xdeef('0x60')]['belongsToMany'](db['User'],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x190')});db[_0xdeef('0x62')]['belongsTo'](db[_0xdeef('0x187')],{});db['OpenchannelQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x62')][_0xdeef('0x11f')](db[_0xdeef('0x5c')],{});db[_0xdeef('0x62')][_0xdeef('0x11f')](db[_0xdeef('0x189')],{});db[_0xdeef('0x62')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{});db['OpenchannelQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x5f')],{});db[_0xdeef('0x64')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x191'),'foreignKey':_0xdeef('0x10f'),'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x64')][_0xdeef('0x11f')](db['ChatQueue'],{'as':_0xdeef('0x192'),'foreignKey':_0xdeef('0x193'),'onDelete':'restrict'});db[_0xdeef('0x64')][_0xdeef('0x11f')](db[_0xdeef('0x60')],{'as':_0xdeef('0x194'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xdeef('0x64')][_0xdeef('0x11f')](db[_0xdeef('0x88')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x173')});db['ChatInteraction'][_0xdeef('0x112')](db[_0xdeef('0x68')],{'as':_0xdeef('0x161'),'onDelete':_0xdeef('0x111'),'foreignKey':'ChatInteractionId'});db[_0xdeef('0x66')]['belongsTo'](db[_0xdeef('0x60')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x16f')});db[_0xdeef('0x66')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x66')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':'Owner','foreignKey':'UserId'});db[_0xdeef('0x66')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x195'),'as':_0xdeef('0x16a')});db[_0xdeef('0x66')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x195'),'as':_0xdeef('0x16c')});db['ChatInteraction']['belongsToMany'](db[_0xdeef('0x10d')],{'as':'Users','through':_0xdeef('0x129'),'foreignKey':_0xdeef('0x196')});db[_0xdeef('0x68')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x111'),'as':'User'});db[_0xdeef('0x68')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'onDelete':'cascade','as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db['ChatMessage'][_0xdeef('0x11f')](db[_0xdeef('0x66')],{'onDelete':_0xdeef('0x111'),'as':_0xdeef('0x16e'),'foreignKey':_0xdeef('0x196')});db[_0xdeef('0x68')][_0xdeef('0x11f')](db['Attachment'],{'as':_0xdeef('0xe5'),'foreignKey':_0xdeef('0x18d')});db['ChatMessage']['belongsTo'](db[_0xdeef('0x60')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x16f')});db[_0xdeef('0x170')]['hasMany'](db[_0xdeef('0xe5')],{'as':'Attachments','foreignKey':_0xdeef('0x171'),'onDelete':_0xdeef('0x111'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0xdeef('0x73')],{'onDelete':_0xdeef('0x111'),'as':'Contact','foreignKey':_0xdeef('0x158')});db[_0xdeef('0x170')][_0xdeef('0x11f')](db['ChatWebsite'],{'as':_0xdeef('0x17e'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':'UserChatQueue','hooks':!![]});db[_0xdeef('0x6b')]['belongsToMany'](db[_0xdeef('0xde')],{'through':_0xdeef('0x197'),'as':_0xdeef('0x14e')});db['ChatGroup'][_0xdeef('0x112')](db['ChatInternalMessage'],{'as':_0xdeef('0x161'),'foreignKey':_0xdeef('0x198'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x6d')]['belongsToMany'](db['User'],{'as':_0xdeef('0x142'),'through':_0xdeef('0x123')});db[_0xdeef('0x6f')][_0xdeef('0x11f')](db[_0xdeef('0x60')],{'as':'Website','foreignKey':_0xdeef('0x16f')});db[_0xdeef('0x71')][_0xdeef('0x112')](db[_0xdeef('0x73')],{'as':_0xdeef('0x124'),'foreignKey':_0xdeef('0x199')});db[_0xdeef('0x73')][_0xdeef('0x112')](db[_0xdeef('0x144')],{'as':'Hoppers','foreignKey':_0xdeef('0x158')});db[_0xdeef('0x73')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xdeef('0x77')],{'as':_0xdeef('0x146'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x73')][_0xdeef('0x112')](db['ReportAgentPreview'],{'as':_0xdeef('0x79'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x73')][_0xdeef('0x112')](db['JscriptySessionReport'],{'as':_0xdeef('0x148'),'foreignKey':'ContactId'});db[_0xdeef('0x73')][_0xdeef('0x112')](db[_0xdeef('0x5c')],{'as':_0xdeef('0x116'),'foreignKey':_0xdeef('0x158'),'onDelete':_0xdeef('0x15a')});db['CmContact'][_0xdeef('0x112')](db[_0xdeef('0x66')],{'as':'ChatInteractions','foreignKey':_0xdeef('0x158'),'onDelete':_0xdeef('0x15a')});db['CmContact']['hasMany'](db[_0xdeef('0x55')],{'as':_0xdeef('0x118'),'foreignKey':'ContactId','onDelete':_0xdeef('0x15a')});db['CmContact'][_0xdeef('0x112')](db[_0xdeef('0x119')],{'as':_0xdeef('0x12a'),'foreignKey':_0xdeef('0x158'),'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x73')][_0xdeef('0x112')](db[_0xdeef('0x40')],{'as':_0xdeef('0x11a'),'foreignKey':'ContactId','onDelete':_0xdeef('0x15a')});db[_0xdeef('0x73')][_0xdeef('0x11f')](db[_0xdeef('0x71')],{'as':_0xdeef('0x19a'),'foreignKey':_0xdeef('0x199')});db[_0xdeef('0x73')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x73')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x18c'),'through':'cm_user_has_contacts'});db[_0xdeef('0x73')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'as':'Tags','through':'cm_contact_has_tags'});db['CmContact'][_0xdeef('0x121')](db['Tag'],{'through':_0xdeef('0x19b'),'as':_0xdeef('0x16c')});db[_0xdeef('0x144')]['belongsTo'](db[_0xdeef('0x73')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xdeef('0x111')});db[_0xdeef('0x144')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':'List','foreignKey':_0xdeef('0x175'),'onDelete':_0xdeef('0x111')});db['CmHopper'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x191'),'foreignKey':'UserId'});db[_0xdeef('0x144')][_0xdeef('0x11f')](db['VoiceQueue'],{'as':_0xdeef('0x192'),'foreignKey':_0xdeef('0x143'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x144')][_0xdeef('0x11f')](db['Campaign'],{'as':_0xdeef('0xe2'),'foreignKey':_0xdeef('0x19c'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x144')]['belongsTo'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x169'),'foreignKey':_0xdeef('0x19d')});db['CmHopperBlack'][_0xdeef('0x11f')](db['CmContact'],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158'),'onDelete':'cascade'});db[_0xdeef('0x75')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175'),'onDelete':_0xdeef('0x111')});db['CmHopperBlack']['belongsTo'](db[_0xdeef('0x1a')],{'as':'Queue','foreignKey':_0xdeef('0x143'),'onDelete':_0xdeef('0x111')});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':_0xdeef('0xe2'),'foreignKey':'CampaignId','onDelete':_0xdeef('0x111')});db['Automation'][_0xdeef('0x112')](db['Condition'],{'as':{'plural':_0xdeef('0x19e'),'singular':_0xdeef('0x19f')},'foreignKey':'AutomationAllId','onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x7d')]['hasMany'](db[_0xdeef('0x7f')],{'as':{'plural':_0xdeef('0x1a0'),'singular':_0xdeef('0x1a1')},'foreignKey':_0xdeef('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xdeef('0x112')](db['Action'],{'as':_0xdeef('0x1a3'),'foreignKey':_0xdeef('0x1a4'),'onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x177')][_0xdeef('0x112')](db[_0xdeef('0x177')],{'as':'Dispositions','foreignKey':_0xdeef('0x1a5'),'onDelete':_0xdeef('0x111')});db['Interval'][_0xdeef('0x112')](db['Interval'],{'as':'Intervals','foreignKey':_0xdeef('0x172'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xdeef('0x112')](db[_0xdeef('0x17')],{'as':_0xdeef('0x1a6'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xdeef('0x14a')]['hasMany'](db[_0xdeef('0x43')],{'as':_0xdeef('0x1a7'),'foreignKey':_0xdeef('0x172')});db[_0xdeef('0x14a')]['hasMany'](db['ChatApplication'],{'as':_0xdeef('0x1a8'),'foreignKey':'IntervalId'});db[_0xdeef('0x14a')][_0xdeef('0x112')](db[_0xdeef('0x4b')],{'as':_0xdeef('0x1a9'),'foreignKey':_0xdeef('0x172')});db[_0xdeef('0x14a')]['hasMany'](db[_0xdeef('0x53')],{'as':'SmsApplications','foreignKey':_0xdeef('0x172')});db[_0xdeef('0x85')][_0xdeef('0x11f')](db['MailAccount'],{});db[_0xdeef('0x85')]['belongsTo'](db[_0xdeef('0x1aa')],{'foreignKey':_0xdeef('0x1ab')});db[_0xdeef('0x85')][_0xdeef('0x11f')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0xdeef('0x86')][_0xdeef('0x121')](db['VoiceMusicOnHold'],{'as':_0xdeef('0x1ac'),'through':_0xdeef('0x141'),'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x88')][_0xdeef('0x121')](db[_0xdeef('0x73')],{'through':_0xdeef('0x19b')});db['Tag'][_0xdeef('0x121')](db[_0xdeef('0x66')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xdeef('0x121')](db['MailInteraction'],{'through':_0xdeef('0x16b')});db[_0xdeef('0x88')][_0xdeef('0x121')](db[_0xdeef('0x55')],{'through':_0xdeef('0x185')});db[_0xdeef('0x88')][_0xdeef('0x121')](db[_0xdeef('0x119')],{'through':_0xdeef('0x17f')});db[_0xdeef('0x88')][_0xdeef('0x121')](db[_0xdeef('0x5c')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xdeef('0x121')](db[_0xdeef('0x11b')],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0xdeef('0x112')](db[_0xdeef('0x7f')],{'as':{'plural':'AllConditions','singular':_0xdeef('0x1ad')},'foreignKey':_0xdeef('0x1ae'),'onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x8b')][_0xdeef('0x112')](db[_0xdeef('0x7f')],{'as':{'plural':_0xdeef('0x1af'),'singular':_0xdeef('0x1b0')},'foreignKey':_0xdeef('0x1b1'),'onDelete':_0xdeef('0x111'),'hooks':!![]});db['Trigger'][_0xdeef('0x112')](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x92')][_0xdeef('0x112')](db[_0xdeef('0x99')],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xdeef('0x1aa')][_0xdeef('0x112')](db[_0xdeef('0x99')],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1ab')});db[_0xdeef('0x97')][_0xdeef('0x112')](db[_0xdeef('0x99')],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b3')});db[_0xdeef('0x99')][_0xdeef('0x11f')](db[_0xdeef('0x97')],{'foreignKey':_0xdeef('0x1b3')});db['SalesforceAccount']['hasMany'](db[_0xdeef('0x9e')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0x9e')][_0xdeef('0x112')](db[_0xdeef('0xa0')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0x9e')]['hasMany'](db[_0xdeef('0xa0')],{'as':_0xdeef('0x1b8'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b9')});db['SalesforceConfiguration'][_0xdeef('0x112')](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x9e')][_0xdeef('0x11f')](db[_0xdeef('0x9c')],{'as':'Account','foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xa0')]['hasMany'](db[_0xdeef('0xa0')],{'as':_0xdeef('0x1bb'),'foreignKey':'SubjectId'});db[_0xdeef('0xa0')][_0xdeef('0x112')](db[_0xdeef('0xa0')],{'as':_0xdeef('0x1bc'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xa0')]['hasMany'](db[_0xdeef('0xa0')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db['SalesforceField'][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xa2')][_0xdeef('0x112')](db[_0xdeef('0xa3')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xa3')][_0xdeef('0x112')](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':'SubjectId'});db[_0xdeef('0xa3')]['hasMany'](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1b8'),'onDelete':_0xdeef('0x111'),'foreignKey':'DescriptionId'});db[_0xdeef('0xa3')][_0xdeef('0x112')](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1b2'),'onDelete':'cascade','foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xa3')][_0xdeef('0x11f')](db['SugarcrmAccount'],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xa5')][_0xdeef('0x112')](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xa5')][_0xdeef('0x112')](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1bc'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xa5')][_0xdeef('0x112')](db[_0xdeef('0xa5')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xa5')][_0xdeef('0x11f')](db['Variable'],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xa7')][_0xdeef('0x112')](db[_0xdeef('0x1bf')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db['DeskConfiguration'][_0xdeef('0x112')](db[_0xdeef('0x1c0')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0x1bf')][_0xdeef('0x112')](db[_0xdeef('0x1c0')],{'as':_0xdeef('0x1b8'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0x1bf')][_0xdeef('0x112')](db[_0xdeef('0x1c0')],{'as':'Fields','onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x1bf')][_0xdeef('0x11f')](db[_0xdeef('0xa7')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0x1bf')]['belongsToMany'](db[_0xdeef('0x88')],{'through':_0xdeef('0x1c1')});db[_0xdeef('0x1c0')]['hasMany'](db[_0xdeef('0x1c0')],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0x1c0')][_0xdeef('0x112')](db[_0xdeef('0x1c0')],{'as':_0xdeef('0x1bc'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0x1c0')]['hasMany'](db[_0xdeef('0x1c0')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x1c0')][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xab')][_0xdeef('0x112')](db[_0xdeef('0xad')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':'AccountId'});db[_0xdeef('0xad')][_0xdeef('0x112')](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':'SubjectId'});db[_0xdeef('0xad')]['hasMany'](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdeef('0xad')][_0xdeef('0x112')](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xad')][_0xdeef('0x11f')](db[_0xdeef('0xab')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db['ZohoField'][_0xdeef('0x112')](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0x1c2')]['hasMany'](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1bc'),'foreignKey':'DescriptionId'});db[_0xdeef('0x1c2')][_0xdeef('0x112')](db[_0xdeef('0x1c2')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x1c2')][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount'][_0xdeef('0x112')](db['ZendeskConfiguration'],{'as':_0xdeef('0x1b4'),'onDelete':'cascade','foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xb1')][_0xdeef('0x112')](db[_0xdeef('0xb2')],{'as':'Subjects','foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xb1')]['hasMany'](db['ZendeskField'],{'as':_0xdeef('0x1b8'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xb1')]['hasMany'](db[_0xdeef('0xb2')],{'as':_0xdeef('0x1b2'),'foreignKey':_0xdeef('0x1ba')});db['ZendeskConfiguration'][_0xdeef('0x11f')](db[_0xdeef('0xaf')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xb1')][_0xdeef('0x121')](db['Tag'],{'through':_0xdeef('0x1c3')});db[_0xdeef('0xb2')][_0xdeef('0x112')](db['ZendeskField'],{'as':_0xdeef('0x1bb'),'foreignKey':'SubjectId'});db[_0xdeef('0xb2')]['hasMany'](db[_0xdeef('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdeef('0xb2')][_0xdeef('0x112')](db[_0xdeef('0xb2')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xb2')][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0x1c4')]['hasMany'](db[_0xdeef('0x1c5')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0x1c5')][_0xdeef('0x112')](db[_0xdeef('0xb4')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':'SubjectId'});db[_0xdeef('0x1c5')][_0xdeef('0x112')](db[_0xdeef('0xb4')],{'as':_0xdeef('0x1b8'),'onDelete':_0xdeef('0x111'),'foreignKey':'DescriptionId'});db[_0xdeef('0x1c5')]['hasMany'](db[_0xdeef('0xb4')],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':'FieldId'});db[_0xdeef('0x1c5')][_0xdeef('0x11f')](db[_0xdeef('0x1c4')],{'as':'Account','foreignKey':'AccountId'});db[_0xdeef('0x1c5')][_0xdeef('0x121')](db[_0xdeef('0x88')],{'through':_0xdeef('0x1c6')});db['FreshdeskField'][_0xdeef('0x112')](db[_0xdeef('0xb4')],{'as':'Subject','foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xb4')]['hasMany'](db[_0xdeef('0xb4')],{'as':'Description','foreignKey':_0xdeef('0x1b9')});db['FreshdeskField'][_0xdeef('0x112')](db[_0xdeef('0xb4')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xb4')]['belongsTo'](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xb6')][_0xdeef('0x112')](db['VtigerConfiguration'],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db['VtigerConfiguration']['hasMany'](db[_0xdeef('0x1c7')],{'as':_0xdeef('0x1b6'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0x1c8')][_0xdeef('0x112')](db[_0xdeef('0x1c7')],{'as':'Descriptions','foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0x1c8')][_0xdeef('0x112')](db[_0xdeef('0x1c7')],{'as':_0xdeef('0x1b2'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x1c8')]['belongsTo'](db[_0xdeef('0xb6')],{'as':'Account','foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0x1c7')][_0xdeef('0x112')](db[_0xdeef('0x1c7')],{'as':_0xdeef('0x1bb'),'foreignKey':'SubjectId'});db[_0xdeef('0x1c7')][_0xdeef('0x112')](db[_0xdeef('0x1c7')],{'as':'Description','foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0x1c7')][_0xdeef('0x112')](db['VtigerField'],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0x1c7')][_0xdeef('0x11f')](db['Variable'],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xba')][_0xdeef('0x112')](db[_0xdeef('0xbb')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xbb')][_0xdeef('0x112')](db['ServicenowField'],{'as':_0xdeef('0x1b6'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xbb')]['hasMany'](db[_0xdeef('0xbd')],{'as':_0xdeef('0x1b8'),'foreignKey':_0xdeef('0x1b9')});db['ServicenowConfiguration']['hasMany'](db[_0xdeef('0xbd')],{'as':_0xdeef('0x1b2'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xbb')][_0xdeef('0x11f')](db[_0xdeef('0xba')],{'as':'Account','foreignKey':_0xdeef('0x1b5')});db['ServicenowField'][_0xdeef('0x112')](db[_0xdeef('0xbd')],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db['ServicenowField'][_0xdeef('0x112')](db[_0xdeef('0xbd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdeef('0xbd')][_0xdeef('0x112')](db['ServicenowField'],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db['ServicenowField'][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xbf')][_0xdeef('0x112')](db[_0xdeef('0xc1')],{'as':_0xdeef('0x1b4'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b5')});db[_0xdeef('0xbf')][_0xdeef('0x11f')](db[_0xdeef('0x103')],{'as':_0xdeef('0x103'),'foreignKey':_0xdeef('0x159')});db[_0xdeef('0xc1')][_0xdeef('0x112')](db[_0xdeef('0xc3')],{'as':_0xdeef('0x1b6'),'onDelete':_0xdeef('0x111'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xdeef('0x112')](db[_0xdeef('0xc3')],{'as':'Descriptions','onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xc1')][_0xdeef('0x112')](db['Dynamics365Field'],{'as':_0xdeef('0x1b2'),'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xc1')][_0xdeef('0x11f')](db['Dynamics365Account'],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db['Dynamics365Field'][_0xdeef('0x112')](db['Dynamics365Field'],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xc3')]['hasMany'](db[_0xdeef('0xc3')],{'as':'Description','foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xc3')][_0xdeef('0x112')](db[_0xdeef('0xc3')],{'as':_0xdeef('0x1bd'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xc3')][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0xc5')]['hasMany'](db[_0xdeef('0xc7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xdeef('0x1b5')});db['FreshsalesConfiguration'][_0xdeef('0x112')](db['FreshsalesField'],{'as':_0xdeef('0x1b6'),'foreignKey':_0xdeef('0x1b7')});db[_0xdeef('0xc7')][_0xdeef('0x112')](db[_0xdeef('0xc9')],{'as':_0xdeef('0x1b8'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xc7')][_0xdeef('0x112')](db[_0xdeef('0xc9')],{'as':_0xdeef('0x1b2'),'foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xc7')][_0xdeef('0x11f')](db[_0xdeef('0xc5')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1b5')});db['FreshsalesField'][_0xdeef('0x112')](db[_0xdeef('0xc9')],{'as':_0xdeef('0x1bb'),'foreignKey':_0xdeef('0x1b7')});db['FreshsalesField'][_0xdeef('0x112')](db[_0xdeef('0xc9')],{'as':_0xdeef('0x1bc'),'foreignKey':_0xdeef('0x1b9')});db[_0xdeef('0xc9')]['hasMany'](db[_0xdeef('0xc9')],{'as':'Field','foreignKey':_0xdeef('0x1ba')});db[_0xdeef('0xc9')][_0xdeef('0x11f')](db[_0xdeef('0x8d')],{'as':_0xdeef('0x8d'),'foreignKey':_0xdeef('0x1be')});db[_0xdeef('0x1c9')]['belongsTo'](db['ChatWebsite'],{});db[_0xdeef('0x1c9')][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x162'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0x1c9')][_0xdeef('0x11f')](db[_0xdeef('0x66')],{});db[_0xdeef('0x1c9')][_0xdeef('0x11f')](db['ChatMessage'],{});db['ChatQueueReport'][_0xdeef('0x11f')](db['User'],{});db[_0xdeef('0x1c9')][_0xdeef('0x11f')](db[_0xdeef('0x6b')],{});db[_0xdeef('0xcc')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1ca')});db[_0xdeef('0xcc')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1cb')});db['JscriptySessionReport'][_0xdeef('0x112')](db['JscriptyQuestionReport'],{'foreignKey':_0xdeef('0x1cc'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0x147')][_0xdeef('0x112')](db[_0xdeef('0xce')],{'foreignKey':_0xdeef('0x1cc'),'onDelete':'cascade'});db[_0xdeef('0xd2')][_0xdeef('0x11f')](db[_0xdeef('0x52')],{});db['SmsQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0xdeef('0xd2')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db[_0xdeef('0xd2')][_0xdeef('0x11f')](db[_0xdeef('0x55')],{});db[_0xdeef('0xd2')][_0xdeef('0x11f')](db[_0xdeef('0x57')],{});db[_0xdeef('0xd2')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{});db[_0xdeef('0xd2')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0xdeef('0x112')](db[_0xdeef('0x147')],{'foreignKey':_0xdeef('0x1cd')});db[_0xdeef('0xd5')][_0xdeef('0x112')](db['JscriptyQuestionReport'],{'foreignKey':_0xdeef('0x1cd')});db[_0xdeef('0xd5')][_0xdeef('0x112')](db[_0xdeef('0xce')],{'foreignKey':_0xdeef('0x1cd')});db[_0xdeef('0x13c')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x18c'),'through':'user_has_square_projects'});db[_0xdeef('0xde')]['belongsToMany'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x127')});db['Team'][_0xdeef('0x121')](db['VoiceQueue'],{'through':_0xdeef('0x105'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db[_0xdeef('0x166')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team']['belongsToMany'](db[_0xdeef('0x6b')],{'through':_0xdeef('0x197'),'as':_0xdeef('0x130')});db[_0xdeef('0xde')][_0xdeef('0x121')](db[_0xdeef('0x4f')],{'through':_0xdeef('0x1ce'),'as':_0xdeef('0x131')});db['Team']['belongsToMany'](db[_0xdeef('0x183')],{'through':_0xdeef('0x186'),'as':_0xdeef('0x132')});db[_0xdeef('0xde')][_0xdeef('0x121')](db[_0xdeef('0x5f')],{'through':_0xdeef('0x1cf'),'as':_0xdeef('0x1d0')});db[_0xdeef('0xde')][_0xdeef('0x121')](db[_0xdeef('0x101')],{'through':_0xdeef('0x1d1'),'as':_0xdeef('0x134')});db['Team'][_0xdeef('0x121')](db[_0xdeef('0xf2')],{'through':_0xdeef('0x107'),'as':'VoicePrefixes'});db[_0xdeef('0xe2')][_0xdeef('0x112')](db[_0xdeef('0x144')],{'as':_0xdeef('0x1d2'),'foreignKey':_0xdeef('0x19c')});db[_0xdeef('0xe2')]['hasMany'](db[_0xdeef('0x145')],{'as':_0xdeef('0x114'),'foreignKey':_0xdeef('0x19c')});db[_0xdeef('0xe2')][_0xdeef('0x112')](db[_0xdeef('0x77')],{'as':'HopperHistories','foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0xdeef('0x1d3'),'foreignKey':_0xdeef('0x19c')});db[_0xdeef('0xe2')][_0xdeef('0x11f')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xdeef('0xe2')][_0xdeef('0x11f')](db[_0xdeef('0x2d')],{'as':_0xdeef('0x1d4'),'foreignKey':_0xdeef('0x1d5')});db[_0xdeef('0xe2')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'as':'Interval','foreignKey':_0xdeef('0x172')});db[_0xdeef('0xe2')][_0xdeef('0x11f')](db['SquareProject'],{'as':_0xdeef('0x13c'),'foreignKey':_0xdeef('0x1d6')});db['Campaign'][_0xdeef('0x121')](db[_0xdeef('0xf0')],{'as':'Lists','through':_0xdeef('0x1d7')});db[_0xdeef('0xe2')][_0xdeef('0x121')](db[_0xdeef('0xf0')],{'as':_0xdeef('0x14f'),'through':_0xdeef('0x1d8')});db[_0xdeef('0xe5')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0xdeef('0x170'),'foreignKey':_0xdeef('0x171')});db[_0xdeef('0x1d9')]['belongsTo'](db[_0xdeef('0x160')],{});db[_0xdeef('0x1d9')][_0xdeef('0x11f')](db[_0xdeef('0x40')],{});db[_0xdeef('0x1d9')][_0xdeef('0x11f')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xdeef('0x1da')});db[_0xdeef('0x1d9')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':'FromUserId','as':_0xdeef('0x1db')});db[_0xdeef('0x1d9')]['belongsTo'](db[_0xdeef('0x10d')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdeef('0x1d9')][_0xdeef('0x11f')](db[_0xdeef('0x166')],{'foreignKey':_0xdeef('0x1dc'),'as':'ToQueue'});db[_0xdeef('0x1d9')][_0xdeef('0x11f')](db[_0xdeef('0x136')],{'foreignKey':_0xdeef('0x1dd'),'as':_0xdeef('0x1de')});db[_0xdeef('0x1df')][_0xdeef('0x11f')](db[_0xdeef('0x68')],{});db[_0xdeef('0x1df')]['belongsTo'](db[_0xdeef('0x66')],{});db[_0xdeef('0x1df')][_0xdeef('0x11f')](db[_0xdeef('0x60')],{'foreignKey':_0xdeef('0x1e0'),'as':_0xdeef('0x1da')});db[_0xdeef('0x1df')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e1'),'as':_0xdeef('0x1db')});db[_0xdeef('0x1df')]['belongsTo'](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e2'),'as':_0xdeef('0x1e3')});db[_0xdeef('0x1df')][_0xdeef('0x11f')](db[_0xdeef('0x6b')],{'foreignKey':_0xdeef('0x1e4'),'as':_0xdeef('0x1e5')});db['ChatTransferReport'][_0xdeef('0x11f')](db[_0xdeef('0x60')],{'foreignKey':_0xdeef('0x1e6'),'as':'ToAccount'});db['FaxTransferReport'][_0xdeef('0x11f')](db['FaxMessage'],{});db[_0xdeef('0xea')][_0xdeef('0x11f')](db[_0xdeef('0x119')],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0xdeef('0x1e7'),'as':_0xdeef('0x1da')});db[_0xdeef('0xea')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e1'),'as':_0xdeef('0x1db')});db[_0xdeef('0xea')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e2'),'as':_0xdeef('0x1e3')});db[_0xdeef('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xdeef('0x1e8'),'as':'ToQueue'});db[_0xdeef('0xea')][_0xdeef('0x11f')](db[_0xdeef('0x4a')],{'foreignKey':_0xdeef('0x1e9'),'as':_0xdeef('0x1de')});db['OpenchannelTransferReport'][_0xdeef('0x11f')](db[_0xdeef('0x189')],{});db[_0xdeef('0xec')][_0xdeef('0x11f')](db['OpenchannelInteraction'],{});db[_0xdeef('0xec')][_0xdeef('0x11f')](db[_0xdeef('0x187')],{'foreignKey':_0xdeef('0x1ea'),'as':_0xdeef('0x1da')});db[_0xdeef('0xec')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e1'),'as':_0xdeef('0x1db')});db[_0xdeef('0xec')][_0xdeef('0x11f')](db['User'],{'foreignKey':_0xdeef('0x1e2'),'as':_0xdeef('0x1e3')});db[_0xdeef('0xec')][_0xdeef('0x11f')](db[_0xdeef('0x5f')],{'foreignKey':_0xdeef('0x1eb'),'as':'ToQueue'});db[_0xdeef('0xec')][_0xdeef('0x11f')](db['OpenchannelAccount'],{'foreignKey':_0xdeef('0x1ec'),'as':_0xdeef('0x1de')});db[_0xdeef('0xee')][_0xdeef('0x11f')](db['SmsMessage'],{});db[_0xdeef('0xee')]['belongsTo'](db[_0xdeef('0x55')],{});db['SmsTransferReport'][_0xdeef('0x11f')](db['SmsAccount'],{'foreignKey':_0xdeef('0x1ed'),'as':_0xdeef('0x1da')});db['SmsTransferReport'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':'FromUserId','as':_0xdeef('0x1db')});db[_0xdeef('0xee')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e2'),'as':_0xdeef('0x1e3')});db['SmsTransferReport']['belongsTo'](db[_0xdeef('0x183')],{'foreignKey':_0xdeef('0x1ee'),'as':'ToQueue'});db[_0xdeef('0xee')][_0xdeef('0x11f')](db[_0xdeef('0x52')],{'foreignKey':_0xdeef('0x1ef'),'as':_0xdeef('0x1de')});db[_0xdeef('0xf0')][_0xdeef('0x112')](db['Disposition'],{'as':_0xdeef('0x178'),'foreignKey':_0xdeef('0x175'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0xf0')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xdeef('0xf0')]['hasMany'](db[_0xdeef('0x73')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xdeef('0x175')});db[_0xdeef('0xf0')][_0xdeef('0x112')](db[_0xdeef('0x145')],{'as':_0xdeef('0x114'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0xf0')][_0xdeef('0x112')](db['CmHopperHistory'],{'as':_0xdeef('0x115'),'foreignKey':_0xdeef('0x175')});db['CmList'][_0xdeef('0x112')](db[_0xdeef('0x79')],{'as':_0xdeef('0x79'),'foreignKey':_0xdeef('0x175')});db['CmList'][_0xdeef('0x121')](db[_0xdeef('0x1a')],{'as':_0xdeef('0x1f0'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0xdeef('0x112')](db[_0xdeef('0x17')],{'as':_0xdeef('0x1a6'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0xf2')][_0xdeef('0x121')](db['User'],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x109')});db['VoicePrefix'][_0xdeef('0x121')](db[_0xdeef('0xde')],{'through':_0xdeef('0x107'),'as':_0xdeef('0x14e')});db[_0xdeef('0xf3')][_0xdeef('0x112')](db['User'],{'as':_0xdeef('0x18c'),'foreignKey':_0xdeef('0x120')});db['UserProfile']['hasMany'](db[_0xdeef('0xf4')],{'as':_0xdeef('0x1f1'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xdeef('0xf4')]['hasMany'](db['UserProfileResource'],{'as':_0xdeef('0x1f2'),'foreignKey':'sectionId','onDelete':_0xdeef('0x111')});db[_0xdeef('0xf9')]['hasMany'](db[_0xdeef('0x177')],{'as':_0xdeef('0x178'),'foreignKey':_0xdeef('0x1f3'),'onDelete':_0xdeef('0x111')});db[_0xdeef('0xf9')][_0xdeef('0x112')](db[_0xdeef('0x15e')],{'as':_0xdeef('0x15f'),'foreignKey':_0xdeef('0x1f3')});db[_0xdeef('0xf9')][_0xdeef('0x112')](db[_0xdeef('0xfd')],{'as':_0xdeef('0x161'),'foreignKey':_0xdeef('0x1f3')});db[_0xdeef('0xf9')]['hasMany'](db[_0xdeef('0x11b')],{'as':_0xdeef('0x17a')});db['WhatsappAccount'][_0xdeef('0x112')](db[_0xdeef('0xfa')],{'as':'Applications'});db[_0xdeef('0xf9')][_0xdeef('0x11f')](db['CmList'],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0xf9')][_0xdeef('0x11f')](db['Pause'],{'as':_0xdeef('0x164'),'foreignKey':_0xdeef('0x14b')});db[_0xdeef('0xf9')][_0xdeef('0x121')](db['User'],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x13b')});db[_0xdeef('0xfa')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'onDelete':_0xdeef('0x15a')});db[_0xdeef('0xfa')][_0xdeef('0x11f')](db[_0xdeef('0x101')],{'onDelete':'restrict'});db[_0xdeef('0xfa')][_0xdeef('0x11f')](db[_0xdeef('0xf9')],{'onDelete':'restrict'});db[_0xdeef('0xfa')][_0xdeef('0x11f')](db[_0xdeef('0x14a')],{'onDelete':_0xdeef('0x15a'),'foreignKey':_0xdeef('0x172')});db[_0xdeef('0xfa')][_0xdeef('0x11f')](db[_0xdeef('0x88')],{'onDelete':_0xdeef('0x15a'),'foreignKey':'TagId'});db[_0xdeef('0x11b')][_0xdeef('0x112')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xdeef('0x111'),'foreignKey':_0xdeef('0x1f4')});db[_0xdeef('0x11b')][_0xdeef('0x11f')](db['WhatsappAccount'],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1f3')});db[_0xdeef('0x11b')][_0xdeef('0x11f')](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':'ContactId'});db[_0xdeef('0x11b')][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x169'),'foreignKey':'UserId'});db[_0xdeef('0x11b')][_0xdeef('0x121')](db['Tag'],{'through':_0xdeef('0x1f5'),'as':'Tags'});db[_0xdeef('0x11b')][_0xdeef('0x121')](db['Tag'],{'through':_0xdeef('0x1f5'),'as':_0xdeef('0x16c')});db[_0xdeef('0x11b')]['belongsToMany'](db['User'],{'as':_0xdeef('0x18c'),'through':_0xdeef('0x1f6'),'foreignKey':_0xdeef('0x1f4')});db[_0xdeef('0xfd')]['belongsTo'](db[_0xdeef('0x10d')],{'as':_0xdeef('0x10d')});db[_0xdeef('0xfd')][_0xdeef('0x11f')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xdeef('0xfd')][_0xdeef('0x11f')](db[_0xdeef('0x11b')],{'onDelete':'cascade','as':_0xdeef('0x16e'),'foreignKey':_0xdeef('0x1f4')});db['WhatsappMessage'][_0xdeef('0x11f')](db[_0xdeef('0xf9')],{'as':_0xdeef('0x17e'),'foreignKey':_0xdeef('0x1f3')});db[_0xdeef('0xfe')][_0xdeef('0x11f')](db[_0xdeef('0xf9')],{});db[_0xdeef('0xfe')][_0xdeef('0x11f')](db['CmList'],{'as':_0xdeef('0x162'),'foreignKey':_0xdeef('0x175')});db[_0xdeef('0xfe')]['belongsTo'](db[_0xdeef('0x73')],{'as':_0xdeef('0x157'),'foreignKey':_0xdeef('0x158')});db['WhatsappQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x11b')],{});db[_0xdeef('0xfe')][_0xdeef('0x11f')](db[_0xdeef('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xdeef('0xfd')],{});db['WhatsappQueueReport'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{});db[_0xdeef('0xff')][_0xdeef('0x11f')](db[_0xdeef('0xfd')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xdeef('0x11b')],{});db[_0xdeef('0xff')][_0xdeef('0x11f')](db[_0xdeef('0xf9')],{'foreignKey':_0xdeef('0x1f7'),'as':_0xdeef('0x1da')});db['WhatsappTransferReport']['belongsTo'](db[_0xdeef('0xf9')],{'foreignKey':_0xdeef('0x1f8'),'as':'ToAccount'});db[_0xdeef('0xff')][_0xdeef('0x11f')](db[_0xdeef('0x101')],{'foreignKey':_0xdeef('0x1f9'),'as':_0xdeef('0x1e5')});db['WhatsappTransferReport']['belongsTo'](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e1'),'as':_0xdeef('0x1db')});db['WhatsappTransferReport']['belongsTo'](db[_0xdeef('0x10d')],{'foreignKey':_0xdeef('0x1e2'),'as':_0xdeef('0x1e3')});db[_0xdeef('0x101')][_0xdeef('0x121')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x14d'),'through':_0xdeef('0x3a'),'foreignKey':_0xdeef('0x1fa')});db[_0xdeef('0x101')][_0xdeef('0x121')](db['Team'],{'through':_0xdeef('0x1d1'),'as':_0xdeef('0x14e')});db['UserSetting'][_0xdeef('0x11f')](db[_0xdeef('0x10d')],{'as':_0xdeef('0x1fb'),'foreignKey':'UserId','onDelete':_0xdeef('0x111'),'hooks':!![]});db[_0xdeef('0x103')]['hasOne'](db[_0xdeef('0xbf')],{'as':_0xdeef('0xbf'),'onDelete':_0xdeef('0x15a')});db[_0xdeef('0x103')][_0xdeef('0x10e')](db[_0xdeef('0x3b')],{'as':'Imap','onDelete':_0xdeef('0x15a')});db['CloudProvider'][_0xdeef('0x10e')](db[_0xdeef('0x3d')],{'as':_0xdeef('0x15d'),'onDelete':_0xdeef('0x15a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 315a74c..3c83324 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/sms/accounts','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts'];(function(_0x5632f4,_0x54dbbd){var _0x2c00ca=function(_0x4bd881){while(--_0x4bd881){_0x5632f4['push'](_0x5632f4['shift']());}};_0x2c00ca(++_0x54dbbd);}(_0xa41a,0x6b));var _0xaa41=function(_0xabedf8,_0xa81ed7){_0xabedf8=_0xabedf8-0x0;var _0x341a48=_0xa41a[_0xabedf8];return _0x341a48;};'use strict';var path=require(_0xaa41('0x0'));var express=require(_0xaa41('0x1'));var errors=require('./errors');var config=require(_0xaa41('0x2'));var setupLoggers=require(_0xaa41('0x3'))[_0xaa41('0x4')];var clientSideLogs=require(_0xaa41('0x5'));exports[_0xaa41('0x6')]=function(_0x3168be){return setupLoggers(_0x3168be)[_0xaa41('0x7')](function(){_0x3168be[_0xaa41('0x8')]('/api/users',require(_0xaa41('0x9')));_0x3168be[_0xaa41('0x8')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa'),require('./api/voiceContext'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xb'),require(_0xaa41('0xc')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xd'),require(_0xaa41('0xe')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xf'),require(_0xaa41('0x10')));_0x3168be['use'](_0xaa41('0x11'),require(_0xaa41('0x12')));_0x3168be['use']('/api/screen/recordings',require(_0xaa41('0x13')));_0x3168be['use'](_0xaa41('0x14'),require(_0xaa41('0x15')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x16'),require(_0xaa41('0x17')));_0x3168be['use'](_0xaa41('0x18'),require(_0xaa41('0x19')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x1a'),require(_0xaa41('0x1b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x1c'),require('./api/voiceAgentReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x1d'),require(_0xaa41('0x1e')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x1f'),require(_0xaa41('0x20')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x21'),require(_0xaa41('0x22')));_0x3168be['use']('/api/voice/transfers/reports',require(_0xaa41('0x23')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x24'),require('./api/mailServerOut'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x25'),require('./api/mailAccount'));_0x3168be['use'](_0xaa41('0x26'),require('./api/mailQueue'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x27'),require(_0xaa41('0x28')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x29'),require('./api/mailInteraction'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x2a'),require(_0xaa41('0x2b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x2c'),require(_0xaa41('0x2d')));_0x3168be['use']('/api/mail/reports/queue',require(_0xaa41('0x2e')));_0x3168be['use']('/api/dashboards',require(_0xaa41('0x2f')));_0x3168be['use']('/api/dashboards/items',require(_0xaa41('0x30')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x31'),require(_0xaa41('0x32')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x33'),require('./api/faxApplication'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x34'),require(_0xaa41('0x35')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x36'),require(_0xaa41('0x37')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x38'),require('./api/faxQueue'));_0x3168be[_0xaa41('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x39'),require('./api/smsAccount'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x3a'),require('./api/smsApplication'));_0x3168be['use']('/api/sms/interactions',require(_0xaa41('0x3b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x3c'),require(_0xaa41('0x3d')));_0x3168be['use'](_0xaa41('0x3e'),require(_0xaa41('0x3f')));_0x3168be[_0xaa41('0x8')]('/api/openchannel/accounts',require(_0xaa41('0x40')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x41'),require('./api/openchannelApplication'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x42'),require('./api/openchannelInteraction'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x43'),require(_0xaa41('0x44')));_0x3168be['use'](_0xaa41('0x45'),require('./api/openchannelQueue'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x46'),require(_0xaa41('0x47')));_0x3168be['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x48'),require(_0xaa41('0x49')));_0x3168be[_0xaa41('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x4a'),require(_0xaa41('0x4b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x4c'),require(_0xaa41('0x4d')));_0x3168be[_0xaa41('0x8')]('/api/chat/queues',require(_0xaa41('0x4e')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x4f'),require(_0xaa41('0x50')));_0x3168be['use']('/api/chat/proactive_actions',require(_0xaa41('0x51')));_0x3168be[_0xaa41('0x8')]('/api/cm/companies',require(_0xaa41('0x52')));_0x3168be['use'](_0xaa41('0x53'),require(_0xaa41('0x54')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x55'),require(_0xaa41('0x56')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x57'),require(_0xaa41('0x58')));_0x3168be['use'](_0xaa41('0x59'),require(_0xaa41('0x5a')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x5b'),require(_0xaa41('0x5c')));_0x3168be[_0xaa41('0x8')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x3168be[_0xaa41('0x8')]('/api/actions',require(_0xaa41('0x5d')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x5e'),require(_0xaa41('0x5f')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x60'),require(_0xaa41('0x61')));_0x3168be['use'](_0xaa41('0x62'),require('./api/disposition'));_0x3168be['use'](_0xaa41('0x63'),require('./api/condition'));_0x3168be['use']('/api/intervals',require(_0xaa41('0x64')));_0x3168be['use'](_0xaa41('0x65'),require(_0xaa41('0x66')));_0x3168be['use']('/api/cdr',require(_0xaa41('0x67')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x68'),require(_0xaa41('0x69')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x6a'),require(_0xaa41('0x6b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x6c'),require('./api/sound'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x6d'),require(_0xaa41('0x6e')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x6f'),require(_0xaa41('0x70')));_0x3168be['use'](_0xaa41('0x71'),require(_0xaa41('0x72')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x73'),require('./api/variable'));_0x3168be[_0xaa41('0x8')]('/api/integrations',require('./api/integration'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x74'),require(_0xaa41('0x75')));_0x3168be['use'](_0xaa41('0x76'),require(_0xaa41('0x77')));_0x3168be[_0xaa41('0x8')]('/api/analytics/default_reports',require(_0xaa41('0x78')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x79'),require(_0xaa41('0x7a')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x7b'),require(_0xaa41('0x7c')));_0x3168be[_0xaa41('0x8')]('/api/analytics/field_reports',require(_0xaa41('0x7d')));_0x3168be['use']('/api/analytics/tree_reports',require(_0xaa41('0x7e')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x7f'),require(_0xaa41('0x80')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x81'),require(_0xaa41('0x82')));_0x3168be[_0xaa41('0x8')]('/api/integrations/salesforce/fields',require(_0xaa41('0x83')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x84'),require('./api/intSugarcrmAccount'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x85'),require('./api/intSugarcrmConfiguration'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x86'),require(_0xaa41('0x87')));_0x3168be['use'](_0xaa41('0x88'),require(_0xaa41('0x89')));_0x3168be['use']('/api/integrations/desk/configurations',require(_0xaa41('0x8a')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x8b'),require('./api/intDeskField'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x8c'),require(_0xaa41('0x8d')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x8e'),require('./api/intZohoConfiguration'));_0x3168be[_0xaa41('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3168be[_0xaa41('0x8')]('/api/integrations/zendesk/accounts',require(_0xaa41('0x8f')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x90'),require('./api/intZendeskConfiguration'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x91'),require(_0xaa41('0x92')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x93'),require(_0xaa41('0x94')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x95'),require(_0xaa41('0x96')));_0x3168be['use'](_0xaa41('0x97'),require(_0xaa41('0x98')));_0x3168be[_0xaa41('0x8')]('/api/integrations/vtiger/accounts',require(_0xaa41('0x99')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x9a'),require(_0xaa41('0x9b')));_0x3168be[_0xaa41('0x8')](_0xaa41('0x9c'),require(_0xaa41('0x9d')));_0x3168be['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x3168be['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x3168be[_0xaa41('0x8')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3168be[_0xaa41('0x8')](_0xaa41('0x9e'),require(_0xaa41('0x9f')));_0x3168be[_0xaa41('0x8')]('/api/integrations/dynamics365/configurations',require(_0xaa41('0xa0')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa1'),require(_0xaa41('0xa2')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa3'),require(_0xaa41('0xa4')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa5'),require('./api/intFreshsalesConfiguration'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa6'),require('./api/intFreshsalesField'));_0x3168be['use']('/api/networks',require(_0xaa41('0xa7')));_0x3168be['use'](_0xaa41('0xa8'),require('./api/chatQueueReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xa9'),require('./api/chatInternalMessage'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xaa'),require(_0xaa41('0xab')));_0x3168be[_0xaa41('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xac'),require('./api/jscriptySessionReport'));_0x3168be['use'](_0xaa41('0xad'),require(_0xaa41('0xae')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xaf'),require(_0xaa41('0xb0')));_0x3168be['use'](_0xaa41('0xb1'),require('./api/squareReportDetail'));_0x3168be['use']('/api/jscripty/projects',require(_0xaa41('0xb2')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xb3'),require('./api/setting'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xb4'),require(_0xaa41('0xb5')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xb6'),require(_0xaa41('0xb7')));_0x3168be[_0xaa41('0x8')]('/api/square/recordings',require(_0xaa41('0xb8')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xb9'),require(_0xaa41('0xba')));_0x3168be['use'](_0xaa41('0xbb'),require('./api/team'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xbc'),require(_0xaa41('0xbd')));_0x3168be[_0xaa41('0x8')]('/api/campaigns',require(_0xaa41('0xbe')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xbf'),require(_0xaa41('0xc0')));_0x3168be['use'](_0xaa41('0xc1'),require('./api/attachment'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xc2'),require('./api/plugin'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xc3'),require(_0xaa41('0xc4')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xc5'),require(_0xaa41('0xc6')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xc7'),require(_0xaa41('0xc8')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xc9'),require('./api/openchannelTransferReport'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xca'),require(_0xaa41('0xcb')));_0x3168be['use']('/api/cm/lists',require(_0xaa41('0xcc')));_0x3168be[_0xaa41('0x8')]('/api/voice/prefixes',require(_0xaa41('0xcd')));_0x3168be[_0xaa41('0x8')]('/api/userProfiles',require(_0xaa41('0xce')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xcf'),require(_0xaa41('0xd0')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xd1'),require(_0xaa41('0xd2')));_0x3168be[_0xaa41('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x3168be[_0xaa41('0x8')]('/api/whatsapp/accounts',require(_0xaa41('0xd3')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xd4'),require('./api/whatsappApplication'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xd5'),require(_0xaa41('0xd6')));_0x3168be['use'](_0xaa41('0xd7'),require(_0xaa41('0xd8')));_0x3168be['use'](_0xaa41('0xd9'),require('./api/whatsappQueueReport'));_0x3168be['use'](_0xaa41('0xda'),require(_0xaa41('0xdb')));_0x3168be['use']('/api/whatsapp/queues',require(_0xaa41('0xdc')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xdd'),require(_0xaa41('0xde')));_0x3168be['use'](_0xaa41('0xdf'),require(_0xaa41('0xe0')));_0x3168be[_0xaa41('0x8')]('/api/user-settings',require(_0xaa41('0xe1')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xe2'),require('./api/authLocal'));_0x3168be[_0xaa41('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xe3'),require('./api/authActiveDirectory'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xe4'),require(_0xaa41('0xe5')));_0x3168be['use'](_0xaa41('0xe6'),require(_0xaa41('0xe7')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xe8'),require(_0xaa41('0xe9')));_0x3168be['use'](_0xaa41('0xea'),require('./api/system'));_0x3168be[_0xaa41('0x8')](_0xaa41('0xeb'),require(_0xaa41('0xec')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xed'),require(_0xaa41('0xee')));_0x3168be[_0xaa41('0x8')](_0xaa41('0xef'),clientSideLogs);_0x3168be[_0xaa41('0x8')](_0xaa41('0xf0'),express[_0xaa41('0xf1')](path['join'](config[_0xaa41('0xf2')],_0xaa41('0xf0'))));_0x3168be['use'](_0xaa41('0xf3'),express['static'](path[_0xaa41('0xf4')](config[_0xaa41('0xf2')],_0xaa41('0xf3'))));_0x3168be[_0xaa41('0x8')](_0xaa41('0xf5'),express[_0xaa41('0xf1')](path[_0xaa41('0xf4')](config['root'],_0xaa41('0xf5'))));_0x3168be[_0xaa41('0x8')](_0xaa41('0xf6'),express[_0xaa41('0xf1')](path['join'](config[_0xaa41('0xf2')],'snippet',_0xaa41('0xf7'))));_0x3168be[_0xaa41('0x8')](_0xaa41('0xf8'),express[_0xaa41('0xf1')](path[_0xaa41('0xf4')](config['root'],_0xaa41('0xf9'))));_0x3168be[_0xaa41('0xfa')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xaa41('0xfb')](errors[0x194]);_0x3168be[_0xaa41('0xfa')]('/*')[_0xaa41('0xfb')](function(_0x20184e,_0x298533){_0x298533[_0xaa41('0xfc')](path[_0xaa41('0xfd')](_0x3168be[_0xaa41('0xfb')]('appPath')+_0xaa41('0xfe')));});return _0x3168be;});}; \ No newline at end of file +var _0x6f47=['/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/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/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./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/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','express','./errors','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction'];(function(_0x52f19f,_0x52164b){var _0x528dd8=function(_0x4e8028){while(--_0x4e8028){_0x52f19f['push'](_0x52f19f['shift']());}};_0x528dd8(++_0x52164b);}(_0x6f47,0xc7));var _0x76f4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x6f47[_0x186376];return _0x2dbdd9;};'use strict';var path=require('path');var express=require(_0x76f4('0x0'));var errors=require(_0x76f4('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x76f4('0x2'))['setupLoggers'];var clientSideLogs=require(_0x76f4('0x3'));exports['default']=function(_0xe214ad){return setupLoggers(_0xe214ad)[_0x76f4('0x4')](function(){_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6'),require('./api/user'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7'),require(_0x76f4('0x8')));_0xe214ad['use'](_0x76f4('0x9'),require(_0x76f4('0xa')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb'),require(_0x76f4('0xc')));_0xe214ad['use']('/api/voice/mohs',require(_0x76f4('0xd')));_0xe214ad[_0x76f4('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe'),require(_0x76f4('0xf')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x10'),require(_0x76f4('0x11')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x12'),require(_0x76f4('0x13')));_0xe214ad['use'](_0x76f4('0x14'),require(_0x76f4('0x15')));_0xe214ad['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x16'),require(_0x76f4('0x17')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x18'),require(_0x76f4('0x19')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1a'),require(_0x76f4('0x1b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1c'),require(_0x76f4('0x1d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1e'),require(_0x76f4('0x1f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x20'),require(_0x76f4('0x21')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x22'),require(_0x76f4('0x23')));_0xe214ad[_0x76f4('0x5')]('/api/mail/accounts',require(_0x76f4('0x24')));_0xe214ad['use'](_0x76f4('0x25'),require(_0x76f4('0x26')));_0xe214ad[_0x76f4('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0xe214ad['use'](_0x76f4('0x27'),require(_0x76f4('0x28')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x29'),require(_0x76f4('0x2a')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2b'),require('./api/mailApplication'));_0xe214ad['use'](_0x76f4('0x2c'),require('./api/mailQueueReport'));_0xe214ad[_0x76f4('0x5')]('/api/dashboards',require('./api/dashboard'));_0xe214ad['use'](_0x76f4('0x2d'),require(_0x76f4('0x2e')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2f'),require(_0x76f4('0x30')));_0xe214ad[_0x76f4('0x5')]('/api/fax/applications',require(_0x76f4('0x31')));_0xe214ad['use']('/api/fax/interactions',require('./api/faxInteraction'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x32'),require(_0x76f4('0x33')));_0xe214ad[_0x76f4('0x5')]('/api/fax/queues',require(_0x76f4('0x34')));_0xe214ad['use'](_0x76f4('0x35'),require(_0x76f4('0x36')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x37'),require(_0x76f4('0x38')));_0xe214ad['use']('/api/sms/applications',require(_0x76f4('0x39')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3a'),require(_0x76f4('0x3b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3c'),require(_0x76f4('0x3d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3e'),require(_0x76f4('0x3f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x40'),require('./api/openchannelAccount'));_0xe214ad['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x41'),require(_0x76f4('0x42')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x43'),require('./api/openchannelMessage'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x44'),require(_0x76f4('0x45')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x46'),require(_0x76f4('0x47')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x48'),require(_0x76f4('0x49')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4a'),require(_0x76f4('0x4b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4c'),require(_0x76f4('0x4d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4e'),require(_0x76f4('0x4f')));_0xe214ad['use'](_0x76f4('0x50'),require(_0x76f4('0x51')));_0xe214ad[_0x76f4('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xe214ad[_0x76f4('0x5')]('/api/chat/groups',require(_0x76f4('0x52')));_0xe214ad['use'](_0x76f4('0x53'),require(_0x76f4('0x54')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x55'),require(_0x76f4('0x56')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x57'),require(_0x76f4('0x58')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x59'),require('./api/cmHopper'));_0xe214ad['use'](_0x76f4('0x5a'),require(_0x76f4('0x5b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5c'),require(_0x76f4('0x5d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5e'),require(_0x76f4('0x5f')));_0xe214ad[_0x76f4('0x5')]('/api/cm/custom_fields',require(_0x76f4('0x60')));_0xe214ad[_0x76f4('0x5')]('/api/actions',require('./api/action'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x61'),require(_0x76f4('0x62')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x63'),require('./api/cannedAnswer'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x64'),require(_0x76f4('0x65')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x66'),require(_0x76f4('0x67')));_0xe214ad['use'](_0x76f4('0x68'),require(_0x76f4('0x69')));_0xe214ad[_0x76f4('0x5')]('/api/pauses',require('./api/pause'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6a'),require(_0x76f4('0x6b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6c'),require('./api/voiceQueuesLog'));_0xe214ad['use'](_0x76f4('0x6d'),require('./api/schedule'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6e'),require('./api/sound'));_0xe214ad['use'](_0x76f4('0x6f'),require(_0x76f4('0x70')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x71'),require('./api/template'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x72'),require(_0x76f4('0x73')));_0xe214ad['use'](_0x76f4('0x74'),require(_0x76f4('0x75')));_0xe214ad['use']('/api/integrations',require(_0x76f4('0x76')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x77'),require(_0x76f4('0x78')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/custom_reports',require(_0x76f4('0x79')));_0xe214ad['use'](_0x76f4('0x7a'),require(_0x76f4('0x7b')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/extracted_reports',require(_0x76f4('0x7c')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/metrics',require(_0x76f4('0x7d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7e'),require(_0x76f4('0x7f')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/tree_reports',require(_0x76f4('0x80')));_0xe214ad['use'](_0x76f4('0x81'),require(_0x76f4('0x82')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/salesforce/configurations',require(_0x76f4('0x83')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x84'),require(_0x76f4('0x85')));_0xe214ad['use'](_0x76f4('0x86'),require(_0x76f4('0x87')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x88'),require('./api/intSugarcrmConfiguration'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/sugarcrm/fields',require(_0x76f4('0x89')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8a'),require(_0x76f4('0x8b')));_0xe214ad['use'](_0x76f4('0x8c'),require(_0x76f4('0x8d')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8e'),require('./api/intZohoConfiguration'));_0xe214ad['use'](_0x76f4('0x8f'),require(_0x76f4('0x90')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x91'),require(_0x76f4('0x92')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x93'),require(_0x76f4('0x94')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xe214ad['use'](_0x76f4('0x95'),require(_0x76f4('0x96')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x97'),require('./api/intFreshdeskConfiguration'));_0xe214ad['use'](_0x76f4('0x98'),require('./api/intFreshdeskField'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/vtiger/accounts',require(_0x76f4('0x99')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9a'),require(_0x76f4('0x9b')));_0xe214ad['use'](_0x76f4('0x9c'),require(_0x76f4('0x9d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9e'),require(_0x76f4('0x9f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa0'),require('./api/intServicenowConfiguration'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa1'),require(_0x76f4('0xa2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa3'),require(_0x76f4('0xa4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa5'),require('./api/intDynamics365Configuration'));_0xe214ad['use'](_0x76f4('0xa6'),require(_0x76f4('0xa7')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/freshsales/accounts',require(_0x76f4('0xa8')));_0xe214ad['use'](_0x76f4('0xa9'),require(_0x76f4('0xaa')));_0xe214ad['use'](_0x76f4('0xab'),require(_0x76f4('0xac')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xad'),require(_0x76f4('0xae')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xaf'),require(_0x76f4('0xb0')));_0xe214ad[_0x76f4('0x5')]('/api/chat/internal/messages',require(_0x76f4('0xb1')));_0xe214ad['use'](_0x76f4('0xb2'),require(_0x76f4('0xb3')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb4'),require(_0x76f4('0xb5')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb6'),require(_0x76f4('0xb7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb8'),require('./api/smsQueueReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb9'),require('./api/squareReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xba'),require(_0x76f4('0xbb')));_0xe214ad['use'](_0x76f4('0xbc'),require(_0x76f4('0xbd')));_0xe214ad[_0x76f4('0x5')]('/api/settings',require(_0x76f4('0xbe')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xbf'),require(_0x76f4('0xc0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc1'),require(_0x76f4('0xc2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc3'),require('./api/squareRecording'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc4'),require(_0x76f4('0xc5')));_0xe214ad[_0x76f4('0x5')]('/api/teams',require(_0x76f4('0xc6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc7'),require('./api/license'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc8'),require(_0x76f4('0xc9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xca'),require('./api/migration'));_0xe214ad[_0x76f4('0x5')]('/api/attachments',require(_0x76f4('0xcb')));_0xe214ad[_0x76f4('0x5')]('/api/plugins',require('./api/plugin'));_0xe214ad['use'](_0x76f4('0xcc'),require(_0x76f4('0xcd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xce'),require(_0x76f4('0xcf')));_0xe214ad[_0x76f4('0x5')]('/api/fax/reports/transfer',require(_0x76f4('0xd0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd1'),require(_0x76f4('0xd2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd3'),require(_0x76f4('0xd4')));_0xe214ad[_0x76f4('0x5')]('/api/cm/lists',require(_0x76f4('0xd5')));_0xe214ad['use'](_0x76f4('0xd6'),require(_0x76f4('0xd7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd8'),require(_0x76f4('0xd9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xda'),require(_0x76f4('0xdb')));_0xe214ad['use'](_0x76f4('0xdc'),require('./api/userProfileResource'));_0xe214ad['use']('/api/userNotifications',require(_0x76f4('0xdd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xde'),require(_0x76f4('0xdf')));_0xe214ad['use'](_0x76f4('0xe0'),require(_0x76f4('0xe1')));_0xe214ad[_0x76f4('0x5')]('/api/whatsapp/interactions',require(_0x76f4('0xe2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe3'),require(_0x76f4('0xe4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe5'),require(_0x76f4('0xe6')));_0xe214ad['use'](_0x76f4('0xe7'),require(_0x76f4('0xe8')));_0xe214ad['use'](_0x76f4('0xe9'),require(_0x76f4('0xea')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xeb'),require(_0x76f4('0xec')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xed'),require(_0x76f4('0xee')));_0xe214ad[_0x76f4('0x5')]('/api/user-settings',require(_0x76f4('0xef')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf0'),require(_0x76f4('0xf1')));_0xe214ad['use'](_0x76f4('0xf2'),require('./api/authGoogle'));_0xe214ad[_0x76f4('0x5')]('/api/auth/activedirectory',require(_0x76f4('0xf3')));_0xe214ad[_0x76f4('0x5')]('/api/jira',require('./api/jira'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf4'),require(_0x76f4('0xf5')));_0xe214ad['use']('/api/version',require(_0x76f4('0xf6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf7'),require(_0x76f4('0xf8')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf9'),require(_0x76f4('0xfa')));_0xe214ad[_0x76f4('0x5')]('/api/webbar',require('./api/webbar'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xfb'),clientSideLogs);_0xe214ad[_0x76f4('0x5')]('/apidoc',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0xff'))));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x100'),express[_0x76f4('0xfc')](path['join'](config[_0x76f4('0xfe')],_0x76f4('0x100'))));_0xe214ad[_0x76f4('0x5')]('/demo',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0x101'))));_0xe214ad['use'](_0x76f4('0x102'),express['static'](path[_0x76f4('0xfd')](config['root'],_0x76f4('0x103'),_0x76f4('0x104'))));_0xe214ad[_0x76f4('0x5')]('/plugins',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],'/server/files/plugins')));_0xe214ad[_0x76f4('0x105')](_0x76f4('0x106'))['get'](errors[0x194]);_0xe214ad['route']('/*')[_0x76f4('0x107')](function(_0x39afa3,_0x515cfe){_0x515cfe['sendFile'](path[_0x76f4('0x108')](_0xe214ad[_0x76f4('0x107')]('appPath')+_0x76f4('0x109')));});return _0xe214ad;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 57b5782..13f56c4 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2652=['../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x28eb88,_0x659a98){var _0x5e00bd=function(_0x2a0b9f){while(--_0x2a0b9f){_0x28eb88['push'](_0x28eb88['shift']());}};_0x5e00bd(++_0x659a98);}(_0x2652,0x146));var _0x2265=function(_0xba68c1,_0x17c56d){_0xba68c1=_0xba68c1-0x0;var _0x274832=_0x2652[_0xba68c1];return _0x274832;};'use strict';var jayson=require(_0x2265('0x0'));var _=require(_0x2265('0x1'));var config=require(_0x2265('0x2'));exports[_0x2265('0x3')]=function(){return new Promise(function(_0x5dbd40,_0x45d726){var _0x3db8a3={};_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x4')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/voiceExtension/voiceExtension.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x6')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x7')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x8')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x9')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0xa')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0xb')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0xc')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/trunk/trunk.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0xd')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0xe')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0xf')));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/mailAccount/mailAccount.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x10')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x11')));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/mailMessage/mailMessage.rpc'));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/mailApplication/mailApplication.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x12')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x13')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x14')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x15')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x16')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x17')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x18')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x19')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x1a')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x1b')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x1c')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x1d')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x1e')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x1f')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x20')));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/chatMessage/chatMessage.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x21')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x22')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x23')));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x24')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x25')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x26')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x27')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x28')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x29')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x2a')));_0x3db8a3=_['merge'](_0x3db8a3,require('../api/trigger/trigger.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x2b')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x2c')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x2d')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x2e')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x2f')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x30')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x31')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x32')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x33')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x34')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x35')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x36')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x37')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/squareReport/squareReport.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x38')));_0x3db8a3=_['merge'](_0x3db8a3,require(_0x2265('0x39')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3a')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3b')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3c')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/squareMessage/squareMessage.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/campaign/campaign.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3d')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3e')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x3f')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x40')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x41')));_0x3db8a3=_[_0x2265('0x5')](_0x3db8a3,require(_0x2265('0x42')));var _0x3eb9c8=jayson['server'](_0x3db8a3)[_0x2265('0x43')]();var _0x3dbfeb=config[_0x2265('0x44')][_0x2265('0x45')]||config[_0x2265('0x45')]+0x1;var _0x3947c7=config[_0x2265('0x44')]['ip']||_0x2265('0x46');_0x3eb9c8['on']('error',function(_0x32483){return _0x45d726(_0x32483);});_0x3eb9c8['listen'](_0x3dbfeb,_0x3947c7,function(){console[_0x2265('0x47')](_0x2265('0x48'),_0x3947c7,_0x3dbfeb);require(_0x2265('0x49'))['default']();return _0x5dbd40(_0x2265('0x4a')+_0x3947c7+':'+_0x3dbfeb);});});}; \ No newline at end of file +var _0x46b6=['RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default'];(function(_0x392fca,_0x542e80){var _0xf7883c=function(_0x2667cc){while(--_0x2667cc){_0x392fca['push'](_0x392fca['shift']());}};_0xf7883c(++_0x542e80);}(_0x46b6,0x19f));var _0x646b=function(_0x5976af,_0x2e69e8){_0x5976af=_0x5976af-0x0;var _0x48aab6=_0x46b6[_0x5976af];return _0x48aab6;};'use strict';var jayson=require('jayson/promise');var _=require(_0x646b('0x0'));var config=require('../config/environment');exports[_0x646b('0x1')]=function(){return new Promise(function(_0x3cc6bd,_0x24544f){var _0x110d3e={};_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x3')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x4')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x5')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x6')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x7')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x8')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x9')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0xa')));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0xb')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0xc')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0xd')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0xe')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/mailQueue/mailQueue.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0xf')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x10')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x11')));_0x110d3e=_['merge'](_0x110d3e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x12')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x13')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x14')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x15')));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x16')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x17')));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x18')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x19')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x1a')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x1b')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x1c')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x1d')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x1e')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x1f')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x20')));_0x110d3e=_['merge'](_0x110d3e,require('../api/chatQueue/chatQueue.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x21')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/cmHopper/cmHopper.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x22')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x23')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x24')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x25')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x26')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/pause/pause.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x27')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x28')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/trigger/trigger.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x29')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x2a')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x2b')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x2c')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x2d')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x2e')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x2f')));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x30')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x31')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x32')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/squareReport/squareReport.rpc'));_0x110d3e=_['merge'](_0x110d3e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x33')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x34')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x35')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/squareRecording/squareRecording.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x36')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/campaign/campaign.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/attachment/attachment.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require('../api/plugin/plugin.rpc'));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x37')));_0x110d3e=_['merge'](_0x110d3e,require(_0x646b('0x38')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x39')));_0x110d3e=_[_0x646b('0x2')](_0x110d3e,require(_0x646b('0x3a')));_0x110d3e=_['merge'](_0x110d3e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x507b43=jayson[_0x646b('0x3b')](_0x110d3e)[_0x646b('0x3c')]();var _0x1f02d9=config[_0x646b('0x3d')][_0x646b('0x3e')]||config[_0x646b('0x3e')]+0x1;var _0x79c301=config[_0x646b('0x3d')]['ip']||_0x646b('0x3f');_0x507b43['on'](_0x646b('0x40'),function(_0x3dfc93){return _0x24544f(_0x3dfc93);});_0x507b43[_0x646b('0x1')](_0x1f02d9,_0x79c301,function(){console[_0x646b('0x41')](_0x646b('0x42'),_0x79c301,_0x1f02d9);require('../config/triggers')[_0x646b('0x43')]();return _0x3cc6bd(_0x646b('0x44')+_0x79c301+':'+_0x1f02d9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e88dbec..667eb44 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 _0x5893=['sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','wav','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s'];(function(_0x5dce8e,_0x3210b3){var _0x129894=function(_0x1e3b10){while(--_0x1e3b10){_0x5dce8e['push'](_0x5dce8e['shift']());}};_0x129894(++_0x3210b3);}(_0x5893,0xf3));var _0x3589=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5893[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var _=require(_0x3589('0x0'));var EventEmitter=require(_0x3589('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x3589('0x2'));function AGIChannel(_0x3682ac){var _0x2a5c4d=this,_0x71591f=new AGIReply(),_0xd261a2=![],_0x3aec17={};EventEmitter['call'](_0x2a5c4d);_0x3682ac[_0x3589('0x3')](_0x3589('0x4'));_0x3682ac[_0x3589('0x5')](0x8*0x3c*0x3c*0x3e8);_0x71591f[_0x3589('0x3')](_0x3589('0x4'));_0x71591f['on'](_0x3589('0x6'),function(_0x2ee74c){for(var _0x4351b6 in _0x2ee74c){_0x2a5c4d[_0x4351b6]=_0x2ee74c[_0x4351b6];}_0x2a5c4d[_0x3589('0x7')](_0x3589('0x8'));});_0x71591f['on'](_0x3589('0x9'),function(_0x2e6caf){if(_0x2e6caf[_0x3589('0xa')]()==_0x3589('0xb')){_0x2a5c4d[_0x3589('0x7')]('hangup');return;}if(_0x2e6caf[_0x3589('0xc')](0x0,0xb)==_0x3589('0xd')){_0xd261a2=!![];}if(_0xd261a2){_0x3aec17['rx']+=_0x2e6caf+'\x0a';if(_0x2e6caf[_0x3589('0xe')](_0x3589('0xf'))!=-0x1){_0xd261a2=![];}}else{_0x3aec17['rx']=_0x2e6caf;}if(_0xd261a2){return;}if(typeof _0x3aec17['cb']==_0x3589('0x10')){var _0x4f979b=_0x3aec17['rx']['substring'](0x0,0x3),_0xcfa37=null,_0x1e5622=null;_0x4f979b=parseInt(_0x4f979b);if(isNaN(_0x4f979b)){_0x3aec17['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3589('0x11')});return;}if(_0x4f979b!=0xc8){_0x3aec17['cb'](null,{'code':_0x4f979b,'result':-0x1,'extra':'KO'});return;}_0xcfa37=_0x3aec17['rx']['substring'](0x4)['replace'](_0x3589('0x12'),'');if(_0xcfa37['indexOf']('\x20')!=-0x1){_0xcfa37=_0xcfa37[_0x3589('0x13')](0x0,_0xcfa37['indexOf']('\x20'));}if(_['startsWith'](_0xcfa37,'-1')){_0xcfa37=parseInt(_0xcfa37);}_0x1e5622=_0x3aec17['rx'][_0x3589('0x14')]('\x20');if(_0x1e5622[_0x3589('0x15')]==0x3){_0x1e5622=_0x1e5622[0x2][_0x3589('0xc')](0x1,_0x1e5622[0x2]['length']-0x1);}else if(_0x1e5622[_0x3589('0x15')]>0x3){var _0x6b4447=/\((.+)\)/;var _0x5db74f=_0x3aec17['rx'][_0x3589('0x16')](_0x6b4447);if(_0x5db74f){_0x1e5622=_0x5db74f[0x1];}else{_0x1e5622=null;}}else{_0x1e5622=null;}_0x3aec17['cb'](null,{'code':_0x4f979b,'result':_0xcfa37,'extra':_0x1e5622});}});_0x3682ac['on']('error',function(_0x4b6426){_0x2a5c4d[_0x3589('0x7')](_0x3589('0x17'),new AGIError(_0x3589('0x18'),_0x4b6426[_0x3589('0x19')]));});_0x3682ac['on']('close',function(){_0x2a5c4d[_0x3589('0x7')](_0x3589('0x1a'),new AGIError(_0x3589('0x1b')));});_0x3682ac['on']('timeout',function(){_0x2a5c4d[_0x3589('0x7')](_0x3589('0x1c'),new AGIError(_0x3589('0x1d')));_0x3682ac[_0x3589('0x1e')]();});_0x3682ac['pipe'](_0x71591f);this[_0x3589('0x1f')]=function(_0x526b34,_0x2d8009){var _0x526b34=_0x526b34||'',_0x2d8009=typeof _0x2d8009==_0x3589('0x10')?_0x2d8009:new Function();_0x3aec17={'tx':_0x526b34,'rx':'','cb':_0x2d8009};_0x3682ac[_0x3589('0x20')](_0x526b34+'\x0a');},this[_0x3589('0x1a')]=function(){_0x3682ac['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3589('0x21')][_0x3589('0x22')]=function(_0x1b6755){return this[_0x3589('0x1f')][_0x3589('0x23')](this,_0x1b6755);};AGIChannel[_0x3589('0x21')]['answer']=function(){return this[_0x3589('0x22')](_0x3589('0x24'));};AGIChannel['prototype'][_0x3589('0x25')]=function(_0x38b22a,_0x70a8fc,_0x5b9198){_0x38b22a=_0x38b22a===undefined?_0x3589('0x26'):_0x38b22a;_0x70a8fc=_0x70a8fc===undefined?'5':_0x70a8fc;_0x5b9198=_0x5b9198===undefined?'1':_0x5b9198;return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x28'),_0x38b22a,_0x70a8fc*0x3e8,_0x5b9198));};AGIChannel[_0x3589('0x21')][_0x3589('0x29')]=function(_0x4ba09f){_0x4ba09f=_0x4ba09f||_0x3589('0x2a');return this[_0x3589('0x22')](util['format']('VERBOSE\x20\x22%s\x22',_0x4ba09f));};AGIChannel[_0x3589('0x21')][_0x3589('0x2b')]=function(_0x31c775,_0x2c140c){if(_[_0x3589('0x2c')](_0x2c140c)){return this[_0x3589('0x22')](util[_0x3589('0x27')]('EXEC\x20%s\x20%s',_0x31c775,_0x2c140c['join'](',')));}return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x2d'),_0x31c775,_0x2c140c));};AGIChannel['prototype'][_0x3589('0x2e')]=function(_0xf5bb09){return this[_0x3589('0x22')](util['format'](_0x3589('0x2f'),_0xf5bb09));};AGIChannel[_0x3589('0x21')][_0x3589('0x30')]=function(_0x4dcf34){return this[_0x3589('0x22')](util['format']('SET\x20EXTENSION\x20%s',_0x4dcf34));};AGIChannel[_0x3589('0x21')][_0x3589('0x31')]=function(_0x2a659e){return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x32'),_0x2a659e));};AGIChannel['prototype']['hangup']=function(){return this[_0x3589('0x22')](_0x3589('0x33'));};AGIChannel['prototype']['setVariable']=function(_0x131aab,_0x1c78ee){var _0x1c42be=_[_0x3589('0x34')](_0x1c78ee)||_[_0x3589('0x35')](_0x1c78ee)?_0x1c78ee[_0x3589('0x36')]():_0x1c78ee;return this['sendRequest'](util['format'](_0x3589('0x37'),_0x131aab,_0x1c42be?_0x1c42be['toString']()[_0x3589('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3589('0x39')]=function(_0x54ecc7,_0x394a0e){return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x3a'),_0x54ecc7,_0x394a0e));};AGIChannel[_0x3589('0x21')][_0x3589('0x3b')]=function(_0x154df9,_0x8015a0){return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x3c'),_0x154df9,_0x8015a0));};AGIChannel[_0x3589('0x21')][_0x3589('0x3d')]=function(_0xcf1c3c,_0x18f84c){return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x3e'),_0xcf1c3c,_0x18f84c));};AGIChannel[_0x3589('0x21')][_0x3589('0x3f')]=function(_0x4b5afd,_0x57d069,_0x406a2e){_0x57d069=_0x57d069||this[_0x3589('0x40')];_0x406a2e=_0x406a2e||0x1;this[_0x3589('0x2e')](_0x4b5afd);this['setExtension'](_0x57d069);this[_0x3589('0x31')](_0x406a2e);return this[_0x3589('0x29')](util[_0x3589('0x27')](_0x3589('0x41'),_0x4b5afd,_0x57d069,_0x406a2e));};AGIChannel['prototype']['getVariable']=function(_0x1b4029){return this[_0x3589('0x22')](util[_0x3589('0x27')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1b4029));};AGIChannel[_0x3589('0x21')]['recordFile']=function(_0x1ae710,_0x493577,_0x42a411,_0x507ac1,_0x44fc30,_0x9fe2a9){_0x493577=_0x493577||_0x3589('0x42');_0x42a411=_0x42a411||'';_0x507ac1=_0x507ac1===undefined?-0x1:_0x507ac1==='-1'?-0x1:_0x507ac1*0x3e8;_0x44fc30=_0x44fc30===undefined?'':'s='+_0x44fc30;_0x9fe2a9=_0x9fe2a9?'BEEP':'';return this[_0x3589('0x22')](util['format'](_0x3589('0x43'),_0x1ae710,_0x493577,_0x42a411,_0x507ac1,_0x9fe2a9,_0x44fc30));};AGIChannel['prototype'][_0x3589('0x44')]=function(_0x1f6ab8,_0x2afe4d){_0x2afe4d=_0x2afe4d||'';return this[_0x3589('0x22')](util[_0x3589('0x27')](_0x3589('0x45'),_0x1f6ab8,_0x2afe4d));};AGIChannel[_0x3589('0x21')][_0x3589('0x46')]=function(_0x2084b1){return this[_0x3589('0x2b')](_0x3589('0x47'),_0x2084b1);};AGIChannel['prototype']['wait']=function(_0x3e8d4b){return this[_0x3589('0x2b')](_0x3589('0x48'),_0x3e8d4b);};AGIChannel[_0x3589('0x21')][_0x3589('0x17')]=function(_0x2685bf,_0xdb73d1){this[_0x3589('0x29')](util[_0x3589('0x27')](_0x3589('0x49'),_0x2685bf['id'],_0x2685bf[_0x3589('0x4a')],_0xdb73d1));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3589('0x4b')]=AGIChannel; \ No newline at end of file +var _0x8786=['util','events','EventEmitter','call','setEncoding','utf8','setTimeout','ready','line','emit','hangup','search','function','substring','no\x20code','replace','result=','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','answer','ANSWER','beep','format','noop','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','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','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','exports'];(function(_0x1a324f,_0x4e069f){var _0x1ffad5=function(_0x4cbc2b){while(--_0x4cbc2b){_0x1a324f['push'](_0x1a324f['shift']());}};_0x1ffad5(++_0x4e069f);}(_0x8786,0x138));var _0x6878=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8786[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x6878('0x0'));var _=require('lodash');var EventEmitter=require(_0x6878('0x1'))[_0x6878('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0xbd9155){var _0x463b3a=this,_0x5a1caa=new AGIReply(),_0x2820bf=![],_0x3a3903={};EventEmitter[_0x6878('0x3')](_0x463b3a);_0xbd9155[_0x6878('0x4')](_0x6878('0x5'));_0xbd9155[_0x6878('0x6')](0x8*0x3c*0x3c*0x3e8);_0x5a1caa[_0x6878('0x4')](_0x6878('0x5'));_0x5a1caa['on']('headers',function(_0x4b707d){for(var _0x4ddc1c in _0x4b707d){_0x463b3a[_0x4ddc1c]=_0x4b707d[_0x4ddc1c];}_0x463b3a['emit'](_0x6878('0x7'));});_0x5a1caa['on'](_0x6878('0x8'),function(_0x11e66b){if(_0x11e66b['toLowerCase']()=='hangup'){_0x463b3a[_0x6878('0x9')](_0x6878('0xa'));return;}if(_0x11e66b['substring'](0x0,0xb)=='520-Invalid'){_0x2820bf=!![];}if(_0x2820bf){_0x3a3903['rx']+=_0x11e66b+'\x0a';if(_0x11e66b[_0x6878('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0x2820bf=![];}}else{_0x3a3903['rx']=_0x11e66b;}if(_0x2820bf){return;}if(typeof _0x3a3903['cb']==_0x6878('0xc')){var _0x502913=_0x3a3903['rx'][_0x6878('0xd')](0x0,0x3),_0x367c7b=null,_0x4901c5=null;_0x502913=parseInt(_0x502913);if(isNaN(_0x502913)){_0x3a3903['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6878('0xe')});return;}if(_0x502913!=0xc8){_0x3a3903['cb'](null,{'code':_0x502913,'result':-0x1,'extra':'KO'});return;}_0x367c7b=_0x3a3903['rx']['substring'](0x4)[_0x6878('0xf')](_0x6878('0x10'),'');if(_0x367c7b['indexOf']('\x20')!=-0x1){_0x367c7b=_0x367c7b[_0x6878('0x11')](0x0,_0x367c7b[_0x6878('0x12')]('\x20'));}if(_[_0x6878('0x13')](_0x367c7b,'-1')){_0x367c7b=parseInt(_0x367c7b);}_0x4901c5=_0x3a3903['rx']['split']('\x20');if(_0x4901c5[_0x6878('0x14')]==0x3){_0x4901c5=_0x4901c5[0x2][_0x6878('0xd')](0x1,_0x4901c5[0x2][_0x6878('0x14')]-0x1);}else if(_0x4901c5['length']>0x3){var _0x11efbf=/\((.+)\)/;var _0x8036e2=_0x3a3903['rx'][_0x6878('0x15')](_0x11efbf);if(_0x8036e2){_0x4901c5=_0x8036e2[0x1];}else{_0x4901c5=null;}}else{_0x4901c5=null;}_0x3a3903['cb'](null,{'code':_0x502913,'result':_0x367c7b,'extra':_0x4901c5});}});_0xbd9155['on'](_0x6878('0x16'),function(_0x284b21){_0x463b3a[_0x6878('0x9')](_0x6878('0x16'),new AGIError(_0x6878('0x17'),_0x284b21['code']));});_0xbd9155['on'](_0x6878('0x18'),function(){_0x463b3a[_0x6878('0x9')](_0x6878('0x18'),new AGIError(_0x6878('0x19')));});_0xbd9155['on']('timeout',function(){_0x463b3a[_0x6878('0x9')](_0x6878('0x1a'),new AGIError(_0x6878('0x1b')));_0xbd9155[_0x6878('0x1c')]();});_0xbd9155[_0x6878('0x1d')](_0x5a1caa);this['command']=function(_0x298ff0,_0x1e93e5){var _0x298ff0=_0x298ff0||'',_0x1e93e5=typeof _0x1e93e5=='function'?_0x1e93e5:new Function();_0x3a3903={'tx':_0x298ff0,'rx':'','cb':_0x1e93e5};_0xbd9155[_0x6878('0x1e')](_0x298ff0+'\x0a');},this[_0x6878('0x18')]=function(){_0xbd9155[_0x6878('0x1c')]();};}util[_0x6878('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x6878('0x20')][_0x6878('0x21')]=function(_0x496825){return this[_0x6878('0x22')][_0x6878('0x23')](this,_0x496825);};AGIChannel[_0x6878('0x20')][_0x6878('0x24')]=function(){return this[_0x6878('0x21')](_0x6878('0x25'));};AGIChannel[_0x6878('0x20')]['getData']=function(_0x1b8b48,_0x304c1f,_0x225c3a){_0x1b8b48=_0x1b8b48===undefined?_0x6878('0x26'):_0x1b8b48;_0x304c1f=_0x304c1f===undefined?'5':_0x304c1f;_0x225c3a=_0x225c3a===undefined?'1':_0x225c3a;return this[_0x6878('0x21')](util[_0x6878('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1b8b48,_0x304c1f*0x3e8,_0x225c3a));};AGIChannel[_0x6878('0x20')][_0x6878('0x28')]=function(_0x563657){_0x563657=_0x563657||'NO\x20MESSAGE';return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x29'),_0x563657));};AGIChannel[_0x6878('0x20')][_0x6878('0x2a')]=function(_0x10f41c,_0x3a3cfe){if(_[_0x6878('0x2b')](_0x3a3cfe)){return this['sendRequest'](util['format'](_0x6878('0x2c'),_0x10f41c,_0x3a3cfe[_0x6878('0x2d')](',')));}return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x2c'),_0x10f41c,_0x3a3cfe));};AGIChannel[_0x6878('0x20')][_0x6878('0x2e')]=function(_0x154441){return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x2f'),_0x154441));};AGIChannel[_0x6878('0x20')][_0x6878('0x30')]=function(_0x4ff291){return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x31'),_0x4ff291));};AGIChannel[_0x6878('0x20')][_0x6878('0x32')]=function(_0x5282a1){return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x33'),_0x5282a1));};AGIChannel['prototype'][_0x6878('0xa')]=function(){return this[_0x6878('0x21')](_0x6878('0x34'));};AGIChannel[_0x6878('0x20')]['setVariable']=function(_0x171471,_0x1a409e){var _0x627226=_[_0x6878('0x35')](_0x1a409e)||_[_0x6878('0x36')](_0x1a409e)?_0x1a409e['toString']():_0x1a409e;return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x37'),_0x171471,_0x627226?_0x627226[_0x6878('0x38')]()[_0x6878('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6878('0x20')][_0x6878('0x39')]=function(_0x421be6,_0x4c5dc2){return this['sendRequest'](util[_0x6878('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x421be6,_0x4c5dc2));};AGIChannel[_0x6878('0x20')]['sayDigits']=function(_0x315289,_0x48e901){return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x3a'),_0x315289,_0x48e901));};AGIChannel[_0x6878('0x20')][_0x6878('0x3b')]=function(_0x4b0948,_0x4b0824){return this['sendRequest'](util[_0x6878('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x4b0948,_0x4b0824));};AGIChannel['prototype'][_0x6878('0x3c')]=function(_0x235855,_0x1b7560,_0x5069b8){_0x1b7560=_0x1b7560||this[_0x6878('0x3d')];_0x5069b8=_0x5069b8||0x1;this[_0x6878('0x2e')](_0x235855);this['setExtension'](_0x1b7560);this['setPriority'](_0x5069b8);return this[_0x6878('0x28')](util['format'](_0x6878('0x3e'),_0x235855,_0x1b7560,_0x5069b8));};AGIChannel[_0x6878('0x20')][_0x6878('0x3f')]=function(_0x1681fb){return this['sendRequest'](util[_0x6878('0x27')](_0x6878('0x40'),_0x1681fb));};AGIChannel[_0x6878('0x20')][_0x6878('0x41')]=function(_0x48e001,_0x1471bb,_0x1cfec7,_0x2e95a5,_0x4411c8,_0x54a6cf){_0x1471bb=_0x1471bb||_0x6878('0x42');_0x1cfec7=_0x1cfec7||'';_0x2e95a5=_0x2e95a5===undefined?-0x1:_0x2e95a5==='-1'?-0x1:_0x2e95a5*0x3e8;_0x4411c8=_0x4411c8===undefined?'':'s='+_0x4411c8;_0x54a6cf=_0x54a6cf?_0x6878('0x43'):'';return this[_0x6878('0x21')](util['format'](_0x6878('0x44'),_0x48e001,_0x1471bb,_0x1cfec7,_0x2e95a5,_0x54a6cf,_0x4411c8));};AGIChannel[_0x6878('0x20')][_0x6878('0x45')]=function(_0x59f9f8,_0x185d20){_0x185d20=_0x185d20||'';return this[_0x6878('0x21')](util[_0x6878('0x27')](_0x6878('0x46'),_0x59f9f8,_0x185d20));};AGIChannel[_0x6878('0x20')][_0x6878('0x47')]=function(_0x2a16e4){return this['exec'](_0x6878('0x48'),_0x2a16e4);};AGIChannel[_0x6878('0x20')][_0x6878('0x49')]=function(_0x4b1a55){return this[_0x6878('0x2a')](_0x6878('0x4a'),_0x4b1a55);};AGIChannel[_0x6878('0x20')][_0x6878('0x16')]=function(_0x3b816e,_0x31aaef){this['noop'](util[_0x6878('0x27')](_0x6878('0x4b'),_0x3b816e['id'],_0x3b816e[_0x6878('0x4c')],_0x31aaef));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6878('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 547925f..4181eb1 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 _0x0348=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','util','Undefined\x20error.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x4c6e25,_0x212e36){var _0x59ee50=function(_0x4ca147){while(--_0x4ca147){_0x4c6e25['push'](_0x4c6e25['shift']());}};_0x59ee50(++_0x212e36);}(_0x0348,0xc8));var _0x8034=function(_0x5c7158,_0x40146f){_0x5c7158=_0x5c7158-0x0;var _0x526bc4=_0x0348[_0x5c7158];return _0x526bc4;};'use strict';var util=require(_0x8034('0x0'));var error={'E_AGI_UNDEFINED':_0x8034('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x8034('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8034('0x3'),'E_AGI_SOCKET_CLOSE':_0x8034('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x8034('0x5'),'E_AGI_COMMAND_EMPTY':_0x8034('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8034('0x7'),'E_AGI_IVR_ENTRY':_0x8034('0x8')};function AGIError(_0x515044){var _0x515044=_0x515044||null,_0x4642b5=_0x4642b5||[],_0x261f84=0x1,_0x22b22a='';if(!error[_0x515044]){_0x515044=_0x8034('0x9');}_0x4642b5[_0x8034('0xa')](error[_0x515044]);while(arguments[_0x261f84]){_0x4642b5[_0x8034('0xa')](arguments[_0x261f84]);_0x261f84++;}_0x22b22a=util[_0x8034('0xb')]['apply'](util,_0x4642b5);this[_0x8034('0xc')]=_0x22b22a;this['name']=_0x515044;}module['exports']=AGIError; \ No newline at end of file +var _0xa5a2=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x45eec5,_0x3466cd){var _0x2f827c=function(_0x34d678){while(--_0x34d678){_0x45eec5['push'](_0x45eec5['shift']());}};_0x2f827c(++_0x3466cd);}(_0xa5a2,0x1e7));var _0x2a5a=function(_0x417936,_0x32971e){_0x417936=_0x417936-0x0;var _0x57c496=_0xa5a2[_0x417936];return _0x57c496;};'use strict';var util=require(_0x2a5a('0x0'));var error={'E_AGI_UNDEFINED':_0x2a5a('0x1'),'E_AGI_ARGUMENT_PORT':_0x2a5a('0x2'),'E_AGI_SERVER_ERROR':_0x2a5a('0x3'),'E_AGI_SERVER_CLOSE':_0x2a5a('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2a5a('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2a5a('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x2a5a('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2a5a('0x8')};function AGIError(_0x5ff734){var _0x5ff734=_0x5ff734||null,_0x10d721=_0x10d721||[],_0x1ce622=0x1,_0x387a6b='';if(!error[_0x5ff734]){_0x5ff734=_0x2a5a('0x9');}_0x10d721[_0x2a5a('0xa')](error[_0x5ff734]);while(arguments[_0x1ce622]){_0x10d721[_0x2a5a('0xa')](arguments[_0x1ce622]);_0x1ce622++;}_0x387a6b=util['format']['apply'](util,_0x10d721);this[_0x2a5a('0xb')]=_0x387a6b;this[_0x2a5a('0xc')]=_0x5ff734;}module[_0x2a5a('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ff76ed8..1467241 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 _0xf3a1=['length','no\x20edge/s\x20available','condition','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','prototype','vertices','edges','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xf3a1,0x138));var _0x1f3a=function(_0xf18ec7,_0x25218a){_0xf18ec7=_0xf18ec7-0x0;var _0x4b8060=_0xf3a1[_0xf18ec7];return _0x4b8060;};'use strict';var _=require(_0x1f3a('0x0'));var logger=require(_0x1f3a('0x1'))(_0x1f3a('0x2'));var verticesWithRetry=[_0x1f3a('0x3'),_0x1f3a('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x1f3a('0x5')]['addVertex']=function(_0x4acf4d){this[_0x1f3a('0x6')][_0x4acf4d['id']]=_0x4acf4d;this[_0x1f3a('0x7')][_0x4acf4d['id']]=[];};Graph[_0x1f3a('0x5')][_0x1f3a('0x8')]=function(_0x557be8,_0x527ec3,_0x1c06fd){this[_0x1f3a('0x7')][_0x557be8][_0x1f3a('0x9')]({'target':_0x527ec3,'condition':_0x1c06fd});this[_0x1f3a('0xa')]+=0x1;};Graph['prototype'][_0x1f3a('0xb')]=function(){return _[_0x1f3a('0xb')](this['vertices']);};Graph['prototype'][_0x1f3a('0xc')]=function(){return this[_0x1f3a('0xa')];};Graph[_0x1f3a('0x5')][_0x1f3a('0xd')]=function(_0x36ca52){return this[_0x1f3a('0x6')][_0x36ca52];};Graph[_0x1f3a('0x5')][_0x1f3a('0xe')]=function(_0x17141a,_0x29b0a7){if(!this[_0x1f3a('0x6')][_0x17141a]){return logger['info'](_0x1f3a('0xf'));}var _0x1df328=_0x29b0a7(this[_0x1f3a('0x6')][_0x17141a]);if(!_0x1df328){return logger[_0x1f3a('0x10')](_0x1f3a('0x11'));}if(this[_0x1f3a('0x7')][_0x17141a][_0x1f3a('0x12')]===0x0){return logger[_0x1f3a('0x10')](_0x1f3a('0x13'));}for(var _0x46c909=0x0,_0x24c53e=[],_0x165312=![];_0x46c909\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','find','handleNotFound','production','handleUnpublished','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','defaults','nextTick','error','stack','findIndex','deleted'];(function(_0x31ddba,_0x28ec26){var _0x3f014c=function(_0x24aa10){while(--_0x24aa10){_0x31ddba['push'](_0x31ddba['shift']());}};_0x3f014c(++_0x28ec26);}(_0xb041,0x99));var _0x1b04=function(_0x1d9dfa,_0x422bcc){_0x1d9dfa=_0x1d9dfa-0x0;var _0x16df23=_0xb041[_0x1d9dfa];return _0x16df23;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x1b04('0x0'));var config=require(_0x1b04('0x1'));var logger=require(_0x1b04('0x2'))(_0x1b04('0x3'));var utilLicense=require(_0x1b04('0x4'));var rpc=require('./rpc');var Project=require(_0x1b04('0x5'));var projects=[];config[_0x1b04('0x3')]=_[_0x1b04('0x6')](config[_0x1b04('0x3')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x212f96){process[_0x1b04('0x7')](function(){syncho(function(){try{setChannelVariables(_0x212f96);agiHandler(_0x212f96);}catch(_0x1b152a){logger[_0x1b04('0x8')](_0x1b152a[_0x1b04('0x9')]);}});});}function projectUpdateHandler(_0x34b965){try{var _0x54026f=JSON['parse'](_0x34b965);var _0x2a2e3c=_[_0x1b04('0xa')](projects,['id',_0x54026f['id']]);if(_0x2a2e3c>-0x1){if(_0x54026f[_0x1b04('0xb')]===!![]){projects[_0x1b04('0xc')](_0x2a2e3c,0x1);}else{projects[_0x2a2e3c]=_0x54026f;}}else{projects[_0x1b04('0xd')](_0x54026f);}}catch(_0x32edd3){logger['error'](_0x32edd3['stack']);}}function listeningHandler(){console[_0x1b04('0xe')](_0x1b04('0xf'),config[_0x1b04('0x3')][_0x1b04('0x10')]);logger[_0x1b04('0x11')](util['format'](_0x1b04('0x12'),config['agi']['ip'],config[_0x1b04('0x3')][_0x1b04('0x10')]));}function errorHandler(_0xb3de12){if(_0xb3de12&&_0xb3de12[_0x1b04('0x13')]&&_0xb3de12[_0x1b04('0x14')]){logger['error'](util[_0x1b04('0x15')](_0x1b04('0x16'),_0xb3de12[_0x1b04('0x13')],_0xb3de12[_0x1b04('0x14')]));}else{logger['error'](util[_0x1b04('0x15')](_0x1b04('0x17'),_0xb3de12[_0x1b04('0x9')]));}}function closeHandler(){logger[_0x1b04('0x11')](util[_0x1b04('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1b04('0x18')],this[_0x1b04('0x19')],this[_0x1b04('0x1a')],this[_0x1b04('0x1b')],this[_0x1b04('0x1c')]));try{createSquareReport(this);}catch(_0x5d68c8){logger[_0x1b04('0x8')](_0x5d68c8[_0x1b04('0x9')]);}}function timeoutHandler(){logger[_0x1b04('0x11')](util[_0x1b04('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1b04('0x18')],this[_0x1b04('0x19')],this[_0x1b04('0x1a')],this[_0x1b04('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x1b04('0x15')](_0x1b04('0x1d'),this[_0x1b04('0x18')],this['calleridname'],this['callerid'],this[_0x1b04('0x1b')],this[_0x1b04('0x1c')]));this[_0x1b04('0x1e')]=!![];}function createSquareReport(_0x28b730,_0x4b8349){rpc['createSquareReport'](_0x28b730)[_0x1b04('0x1f')](function(_0x503868){if(_0x4b8349){_0x4b8349(null,_0x503868);}})[_0x1b04('0x20')](function(_0x1dda28){if(_0x4b8349){_0x4b8349(null,_0x1dda28);}});}function setChannelVariables(_0x5ac16f){for(var _0x1755ae in _0x5ac16f){if(_0x5ac16f[_0x1b04('0x21')](_0x1755ae)){if(_0x1755ae[_0x1b04('0x22')](_0x1b04('0x23'))===0x0){_0x5ac16f[_0x1755ae[_0x1b04('0x24')](0x4)]=_0x5ac16f[_0x1755ae];delete _0x5ac16f[_0x1755ae];}}}}function agiHandler(_0x284bac){logger[_0x1b04('0x25')](_0x1b04('0x26'),JSON[_0x1b04('0x27')](_0x284bac,null,0x2));logger[_0x1b04('0x11')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x284bac[_0x1b04('0x18')],_0x284bac['calleridname'],_0x284bac[_0x1b04('0x1a')],_0x284bac['dnid'],_0x284bac['uniqueid']));_0x284bac['on'](_0x1b04('0x8'),errorHandler);_0x284bac['on'](_0x1b04('0x28'),closeHandler);_0x284bac['on'](_0x1b04('0x29'),timeoutHandler);_0x284bac[_0x1b04('0x1e')]=![];_0x284bac['on']('hangup',hangupHandler);var _0x581621=_[_0x1b04('0x2a')](projects,[_0x1b04('0x13'),_0x284bac[_0x1b04('0x18')]]);if(!_0x581621)return Project[_0x1b04('0x2b')](_0x284bac);if(!_0x581621[_0x1b04('0x2c')])return Project[_0x1b04('0x2d')](_0x284bac);return Project['initialize'](_0x581621,_0x284bac);}function main(){var _0x11d95f;return utilLicense[_0x1b04('0x2e')]()['then'](function(_0x2010b3){if(!_0x2010b3)return;if(_0x2010b3['voice']){if(_0x2010b3[_0x1b04('0x2f')]&&_0x2010b3[_0x1b04('0x2f')]>0x0){logger['info'](util[_0x1b04('0x15')](_0x1b04('0x30'),_0x2010b3[_0x1b04('0x2f')]));_0x11d95f=_0x2010b3[_0x1b04('0x2f')];}else{logger[_0x1b04('0x11')](_0x1b04('0x31'));}}else{logger[_0x1b04('0x11')](_0x1b04('0x32'));_0x11d95f=-0x1;}})[_0x1b04('0x1f')](function(){return Project[_0x1b04('0x33')]();})[_0x1b04('0x1f')](function(_0x3c716b){projects=_0x3c716b;return;})['catch'](function(_0x56d46a){logger[_0x1b04('0x8')]('[LICENSE]',_0x56d46a[_0x1b04('0x9')]);})[_0x1b04('0x34')](function(){var _0x4d196c=require(_0x1b04('0x35'))(config['agi'][_0x1b04('0x10')],config[_0x1b04('0x3')]['ip'],_0x11d95f);_0x4d196c['on']('error',errorHandler);_0x4d196c['on'](_0x1b04('0x36'),listeningHandler);_0x4d196c['on']('connection',connectionHandler);_0x4d196c['on']('close',closeHandler);_0x4d196c['on']('projectUpdate',projectUpdateHandler);});}main(); \ No newline at end of file +var _0x5f9b=['connection','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','info','name','message','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','value','then','catch','indexOf','agi_','substring','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','sync','production','debug','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening'];(function(_0x198a2f,_0x514411){var _0x288f89=function(_0x359542){while(--_0x359542){_0x198a2f['push'](_0x198a2f['shift']());}};_0x288f89(++_0x514411);}(_0x5f9b,0x1b4));var _0xb5f9=function(_0xdc5664,_0x4eef5a){_0xdc5664=_0xdc5664-0x0;var _0xd65a92=_0x5f9b[_0xdc5664];return _0xd65a92;};'use strict';var parser=require('xml2json');var _=require(_0xb5f9('0x0'));var syncho=require(_0xb5f9('0x1'));var util=require(_0xb5f9('0x2'));var moment=require(_0xb5f9('0x3'));var config=require(_0xb5f9('0x4'));var logger=require('../../config/logger')(_0xb5f9('0x5'));var utilLicense=require(_0xb5f9('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xb5f9('0x7'));var Graph=require(_0xb5f9('0x8'));var Vertices=require(_0xb5f9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xb5f9('0x5')]=_[_0xb5f9('0xa')](config[_0xb5f9('0x5')],{'ip':_0xb5f9('0xb'),'port':0x11dd});function connectionHandler(_0x883eca){process[_0xb5f9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x883eca);agiHandler(_0x883eca);}catch(_0x38b487){logger[_0xb5f9('0xd')](_0x38b487[_0xb5f9('0xe')]);}});});}function listeningHandler(){console[_0xb5f9('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb5f9('0x5')]['port']);logger[_0xb5f9('0x10')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xb5f9('0x5')]['ip'],config[_0xb5f9('0x5')]['port']));}function errorHandler(_0x3b05c3){if(_0x3b05c3&&_0x3b05c3[_0xb5f9('0x11')]&&_0x3b05c3[_0xb5f9('0x12')]){logger[_0xb5f9('0xd')](util[_0xb5f9('0x13')]('[%s]\x20%s',_0x3b05c3['name'],_0x3b05c3[_0xb5f9('0x12')]));}else{logger[_0xb5f9('0xd')](util[_0xb5f9('0x13')](_0xb5f9('0x14'),_0x3b05c3[_0xb5f9('0xe')]));}}function closeHandler(){logger['info'](util[_0xb5f9('0x13')](_0xb5f9('0x15'),this[_0xb5f9('0x16')],this[_0xb5f9('0x17')],this[_0xb5f9('0x18')],this[_0xb5f9('0x19')],this[_0xb5f9('0x1a')]));try{createSquareReport(this);}catch(_0x559898){logger[_0xb5f9('0xd')](_0x559898[_0xb5f9('0xe')]);}}function timeoutHandler(){logger[_0xb5f9('0x10')](util[_0xb5f9('0x13')](_0xb5f9('0x1b'),this['arg_1'],this[_0xb5f9('0x17')],this[_0xb5f9('0x18')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xb5f9('0x10')](util[_0xb5f9('0x13')](_0xb5f9('0x1c'),this[_0xb5f9('0x16')],this['calleridname'],this[_0xb5f9('0x18')],this[_0xb5f9('0x19')],this[_0xb5f9('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x84e285){return parser[_0xb5f9('0x1d')](_0x84e285,{'object':!![]})[_0xb5f9('0x1e')][_0xb5f9('0x1f')];}function addVertex(_0x1af710,_0x4721c9,_0x26621b){_0x4721c9[_0xb5f9('0x20')]=_0x26621b;if(_0x4721c9[_0xb5f9('0x21')](_0xb5f9('0x22'))){_0x4721c9['maxRetry']=parseInt(_0x4721c9[_0xb5f9('0x22')],0xa);}_0x1af710[_0xb5f9('0x23')](_[_0xb5f9('0x24')](_0x4721c9,_0xb5f9('0x25')));}function initGraph(_0x2d965d,_0x312b43){var _0x1845f0=new Graph();for(var _0x4be9a6 in _0x2d965d){if(_0x2d965d['hasOwnProperty'](_0x4be9a6)){if(_[_0xb5f9('0x26')](_0x2d965d[_0x4be9a6])){for(var _0xf4e4fd=0x0;_0xf4e4fd<_0x2d965d[_0x4be9a6][_0xb5f9('0x27')];_0xf4e4fd+=0x1){addVertex(_0x1845f0,_0x2d965d[_0x4be9a6][_0xf4e4fd],_0x4be9a6);}}else{addVertex(_0x1845f0,_0x2d965d[_0x4be9a6],_0x4be9a6);}}}for(var _0x41ebad=0x0;_0x41ebad<_0x312b43['length'];_0x41ebad+=0x1){if(_0x312b43[_0x41ebad][_0xb5f9('0x28')]&&_0x312b43[_0x41ebad]['target']){_0x1845f0[_0xb5f9('0x29')](_0x312b43[_0x41ebad][_0xb5f9('0x28')],_0x312b43[_0x41ebad]['target'],_0x312b43[_0x41ebad][_0xb5f9('0x2a')]);}}return _0x1845f0;}function getSquareProject(_0x470f48,_0x4baa1a){rpc['getSquareProject'](_0x470f48)[_0xb5f9('0x2b')](function(_0x3b7e0b){_0x4baa1a(null,_0x3b7e0b);})[_0xb5f9('0x2c')](function(_0x9160e){_0x4baa1a(null,_0x9160e);});}function createSquareReport(_0x20a12b,_0x40a777){rpc['createSquareReport'](_0x20a12b)[_0xb5f9('0x2b')](function(_0x2ce8f0){if(_0x40a777){_0x40a777(null,_0x2ce8f0);}})[_0xb5f9('0x2c')](function(_0x15c74a){if(_0x40a777){_0x40a777(null,_0x15c74a);}});}function setChannelVariables(_0x4b02dd){for(var _0x1d4af6 in _0x4b02dd){if(_0x4b02dd[_0xb5f9('0x21')](_0x1d4af6)){if(_0x1d4af6[_0xb5f9('0x2d')](_0xb5f9('0x2e'))===0x0){_0x4b02dd[_0x1d4af6[_0xb5f9('0x2f')](0x4)]=_0x4b02dd[_0x1d4af6];delete _0x4b02dd[_0x1d4af6];}}}}function getLogFromObject(_0x5884aa){return util['inspect'](_0x5884aa,{'showHidden':![],'depth':null});}function agiHandler(_0xa01115){var _0x1304e8,_0x9eadf0,_0x2bedb6,_0x1af417,_0x293f59;logger['debug']('variables',JSON[_0xb5f9('0x30')](_0xa01115,null,0x2));logger[_0xb5f9('0x10')](util[_0xb5f9('0x13')](_0xb5f9('0x31'),_0xa01115[_0xb5f9('0x16')],_0xa01115[_0xb5f9('0x17')],_0xa01115['callerid'],_0xa01115[_0xb5f9('0x19')],_0xa01115[_0xb5f9('0x1a')]));_0xa01115['on']('error',errorHandler);_0xa01115['on']('close',closeHandler);_0xa01115['on'](_0xb5f9('0x32'),timeoutHandler);_0xa01115[_0xb5f9('0x33')]=![];_0xa01115['on']('hangup',hangupHandler);var _0x343273=getSquareProject[_0xb5f9('0x34')](null,_0xa01115[_0xb5f9('0x16')]);if(_0x343273){if(_0x343273[_0xb5f9('0x35')]){_0x1304e8=getRoot(_0x343273[_0xb5f9('0x35')]);if(_0x1304e8&&_0x1304e8['start']){logger[_0xb5f9('0x36')]('root',JSON[_0xb5f9('0x30')](_0x1304e8,null,0x2));_0xa01115[_0xb5f9('0x37')]=moment()[_0xb5f9('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x9eadf0=initGraph(_[_0xb5f9('0x24')](_0x1304e8,_0xb5f9('0x25')),_0x1304e8[_0xb5f9('0x25')]);_0x2bedb6=new Vertices(_0xa01115,rpc,mailRpc);logger['info'](util[_0xb5f9('0x13')](_0xb5f9('0x38'),_0xa01115['arg_1'],_0xa01115[_0xb5f9('0x17')],_0xa01115['callerid'],_0xa01115[_0xb5f9('0x19')],_0xa01115[_0xb5f9('0x1a')]));_0x9eadf0['traverseBFS'](_0x1304e8[_0xb5f9('0x39')]['id'],function(_0xd7be38){try{_0xd7be38=_0x2bedb6[_0xb5f9('0x3a')](_0xd7be38);logger['debug']('vertex',JSON[_0xb5f9('0x30')](_0xd7be38,null,0x2));if(_0xd7be38[_0xb5f9('0x20')]===_0xb5f9('0x3b')){logger['info'](_0xb5f9('0x3c'));_0xa01115[_0xb5f9('0x3d')]=_0xd7be38[_0xb5f9('0x3d')]||_0xa01115[_0xb5f9('0x3d')];_0xa01115[_0xb5f9('0x3e')]=_0xd7be38[_0xb5f9('0x3e')];_0xa01115[_0xb5f9('0x3f')]=_0xd7be38[_0xb5f9('0x3f')]?_0xd7be38[_0xb5f9('0x3f')]-0x1:0x1;return null;}else if(_0xd7be38&&_0x2bedb6[_0xd7be38[_0xb5f9('0x20')]]){_0x293f59=_0x2bedb6[_0xd7be38['agicommand']](_0xd7be38);logger[_0xb5f9('0x10')]('response',JSON['stringify'](_0x293f59,null,0x2));if(_0x293f59&&_0x293f59[_0xb5f9('0x40')]===AGI_CODE_SUCCESS&&_0x293f59[_0xb5f9('0x41')]!==AGI_RESULT_ERROR&&!_0xa01115[_0xb5f9('0x33')]){logger[_0xb5f9('0x36')]('response',getLogFromObject(_0x293f59));return _[_0xb5f9('0x42')](_0x293f59['result'])?null:_0x293f59[_0xb5f9('0x41')][_0xb5f9('0x43')]();}else{logger['error'](_0xb5f9('0x44'),getLogFromObject(_0x293f59));return null;}}else{logger['error'](_0xb5f9('0x45'));return null;}}catch(_0x264ec7){logger[_0xb5f9('0xd')](_0x264ec7[_0xb5f9('0xe')]);return null;}});if(_0x1304e8['finally']){logger[_0xb5f9('0x10')](util[_0xb5f9('0x13')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xa01115['arg_1'],_0xa01115[_0xb5f9('0x17')],_0xa01115['callerid'],_0xa01115[_0xb5f9('0x19')],_0xa01115['uniqueid']));_0x9eadf0['traverseBFS'](_0x1304e8['finally']['id'],function(_0x198c3e){try{_0x198c3e=_0x2bedb6[_0xb5f9('0x3a')](_0x198c3e);logger[_0xb5f9('0x36')](_0xb5f9('0x46'),JSON['stringify'](_0x198c3e,null,0x2));if(_0x198c3e&&_0x2bedb6[_0x198c3e[_0xb5f9('0x20')]]){_0x293f59=_0x2bedb6[_0x198c3e[_0xb5f9('0x20')]](_0x198c3e);if(_0x293f59){logger[_0xb5f9('0x36')]('response',getLogFromObject(_0x293f59));return _[_0xb5f9('0x42')](_0x293f59[_0xb5f9('0x41')])?null:_0x293f59['result'][_0xb5f9('0x43')]();}else{logger[_0xb5f9('0xd')](_0xb5f9('0x44'),getLogFromObject(_0x293f59));return null;}}else{logger['error'](_0xb5f9('0x45'));return null;}}catch(_0x381f52){logger['error'](_0x381f52[_0xb5f9('0xe')]);return null;}});}logger[_0xb5f9('0x10')](util[_0xb5f9('0x13')](_0xb5f9('0x47'),_0xa01115['arg_1'],_0xa01115[_0xb5f9('0x17')],_0xa01115['callerid'],_0xa01115[_0xb5f9('0x19')],_0xa01115['uniqueid']));logger['info'](util[_0xb5f9('0x13')](_0xb5f9('0x48'),_0xa01115[_0xb5f9('0x3d')],_0xa01115[_0xb5f9('0x3e')],parseInt(_0xa01115['priority'],0xa)+0x1));_0xa01115[_0xb5f9('0x49')](_0xa01115[_0xb5f9('0x3d')],_0xa01115[_0xb5f9('0x3e')],parseInt(_0xa01115[_0xb5f9('0x3f')],0xa)+0x1);_0xa01115[_0xb5f9('0x4a')]();}}else{logger[_0xb5f9('0xd')](util[_0xb5f9('0x13')](_0xb5f9('0x4b'),_0xa01115[_0xb5f9('0x16')]));_0xa01115['continueAt'](_0xa01115['context'],_0xa01115[_0xb5f9('0x3e')],parseInt(_0xa01115[_0xb5f9('0x3f')],0xa)+0x1);_0xa01115[_0xb5f9('0x4a')]();}}else{logger[_0xb5f9('0xd')](util[_0xb5f9('0x13')](_0xb5f9('0x4c'),_0xa01115['arg_1']));_0xa01115['continueAt'](_0xa01115['context'],_0xa01115[_0xb5f9('0x3e')],parseInt(_0xa01115['priority'],0xa)+0x1);_0xa01115[_0xb5f9('0x4a')]();}}function main(){var _0x198308;return utilLicense[_0xb5f9('0x4d')]()[_0xb5f9('0x2b')](function(_0x33686e){if(_0x33686e){if(_0x33686e[_0xb5f9('0x4e')]){if(_0x33686e[_0xb5f9('0x4f')]&&_0x33686e['callysquare']>0x0){logger[_0xb5f9('0x10')](util['format'](_0xb5f9('0x50'),_0x33686e[_0xb5f9('0x4f')]));_0x198308=_0x33686e['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xb5f9('0x10')](_0xb5f9('0x51'));_0x198308=-0x1;}}})[_0xb5f9('0x2c')](function(_0x5a3447){logger['error'](_0xb5f9('0x52'),_0x5a3447[_0xb5f9('0xe')]);})[_0xb5f9('0x53')](function(){var _0x4c11fa=require(_0xb5f9('0x54'))(config[_0xb5f9('0x5')]['port'],config[_0xb5f9('0x5')]['ip'],_0x198308);_0x4c11fa['on']('error',errorHandler);_0x4c11fa['on'](_0xb5f9('0x55'),listeningHandler);_0x4c11fa['on'](_0xb5f9('0x56'),connectionHandler);_0x4c11fa['on'](_0xb5f9('0x4a'),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 cd63419..263fc6d 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 _0x6bcf=['request','then','error','result','catch','SendMail','bluebird','jayson/promise','client'];(function(_0x544df6,_0x3c8733){var _0x4d324b=function(_0x450aab){while(--_0x450aab){_0x544df6['push'](_0x544df6['shift']());}};_0x4d324b(++_0x3c8733);}(_0x6bcf,0x10b));var _0xf6bc=function(_0x46ccb9,_0x4c0ab7){_0x46ccb9=_0x46ccb9-0x0;var _0x2ece2b=_0x6bcf[_0x46ccb9];return _0x2ece2b;};'use strict';var BPromise=require(_0xf6bc('0x0'));var jayson=require(_0xf6bc('0x1'));var client=jayson[_0xf6bc('0x2')]['http']({'port':0x232b});function request(_0x4fa16e,_0x33e776){return new BPromise(function(_0x10c6f7,_0x2206ef){return client[_0xf6bc('0x3')](_0x4fa16e,_0x33e776)[_0xf6bc('0x4')](function(_0x52b149){if(_0x52b149[_0xf6bc('0x5')]){return _0x2206ef(_0x52b149[_0xf6bc('0x5')]['message']);}else{return _0x10c6f7(_0x52b149[_0xf6bc('0x6')]);}})[_0xf6bc('0x7')](function(_0x46623e){return _0x2206ef(_0x46623e);});});}exports['sendMailMessage']=function(_0x36710e,_0x559bea){return request(_0xf6bc('0x8'),{'account':_0x36710e,'message':_0x559bea});}; \ No newline at end of file +var _0x267f=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error'];(function(_0x1d56eb,_0x4504a9){var _0x42b377=function(_0x287806){while(--_0x287806){_0x1d56eb['push'](_0x1d56eb['shift']());}};_0x42b377(++_0x4504a9);}(_0x267f,0xb8));var _0xf267=function(_0x3954bf,_0xbed461){_0x3954bf=_0x3954bf-0x0;var _0x3d467d=_0x267f[_0x3954bf];return _0x3d467d;};'use strict';var BPromise=require(_0xf267('0x0'));var jayson=require(_0xf267('0x1'));var client=jayson[_0xf267('0x2')][_0xf267('0x3')]({'port':0x232b});function request(_0x7eccf3,_0x38c2bb){return new BPromise(function(_0x460065,_0x4d0b83){return client[_0xf267('0x4')](_0x7eccf3,_0x38c2bb)['then'](function(_0x8bd53d){if(_0x8bd53d['error']){return _0x4d0b83(_0x8bd53d[_0xf267('0x5')]['message']);}else{return _0x460065(_0x8bd53d[_0xf267('0x6')]);}})[_0xf267('0x7')](function(_0x6a2703){return _0x4d0b83(_0x6a2703);});});}exports[_0xf267('0x8')]=function(_0x3306e4,_0x450e38){return request(_0xf267('0x9'),{'account':_0x3306e4,'message':_0x450e38});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js deleted file mode 100644 index b043dae..0000000 --- a/server/services/agi/project.js +++ /dev/null @@ -1,18 +0,0 @@ -// ************************************************************************* -// * * -// * xCALLY Motion - The Omnichannel Contact Center * -// * Copyright (c) Xenialab s.r.l. All Rights Reserved * -// * * -// ************************************************************************* -// * * -// * Email: info@xcally.com * -// * Website: https://www.xcally.com * -// * * -// ************************************************************************* -// * * -// * The SOFTWARE PRODUCT is protected by copyright laws and international * -// * copyright treaties, as well as other intellectual property laws and * -// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * -// * * -// ************************************************************************* -var _0x695b=['callerid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','production','debug','root','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','calleridname','dnid','uniqueid','traverseBFS','start','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x160996,_0x3041ce){var _0x3965e2=function(_0x43008b){while(--_0x43008b){_0x160996['push'](_0x160996['shift']());}};_0x3965e2(++_0x3041ce);}(_0x695b,0x104));var _0xb695=function(_0x5c9288,_0x37480c){_0x5c9288=_0x5c9288-0x0;var _0x1ffa82=_0x695b[_0x5c9288];return _0x1ffa82;};'use strict';var _=require(_0xb695('0x0'));var moment=require('moment');var parser=require(_0xb695('0x1'));var util=require('util');var logger=require(_0xb695('0x2'))(_0xb695('0x3'));var rpc=require(_0xb695('0x4'));var mailRpc=require(_0xb695('0x5'));var Graph=require(_0xb695('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb695('0x7')]()[_0xb695('0x8')](function(_0x323cae){logger[_0xb695('0x9')](_0xb695('0xa'),_0x323cae[_0xb695('0xb')]);return[];});}function addVertex(_0x135583,_0x3dbc79,_0x4fb75a){_0x3dbc79[_0xb695('0xc')]=_0x4fb75a;if(_0x3dbc79[_0xb695('0xd')]('retry')){_0x3dbc79[_0xb695('0xe')]=parseInt(_0x3dbc79[_0xb695('0xf')],0xa);}_0x135583[_0xb695('0x10')](_['omit'](_0x3dbc79,'mxCell'));}function initGraph(_0x23cbb0,_0x5eb26b){var _0x57ab7e=new Graph();for(var _0x1a0934 in _0x23cbb0){if(_0x23cbb0[_0xb695('0xd')](_0x1a0934)){if(_[_0xb695('0x11')](_0x23cbb0[_0x1a0934])){for(var _0x4ab2d4=0x0;_0x4ab2d4<_0x23cbb0[_0x1a0934]['length'];_0x4ab2d4+=0x1){addVertex(_0x57ab7e,_0x23cbb0[_0x1a0934][_0x4ab2d4],_0x1a0934);}}else{addVertex(_0x57ab7e,_0x23cbb0[_0x1a0934],_0x1a0934);}}}for(var _0x12fea2=0x0;_0x12fea2<_0x5eb26b[_0xb695('0x12')];_0x12fea2+=0x1){if(_0x5eb26b[_0x12fea2]['source']&&_0x5eb26b[_0x12fea2][_0xb695('0x13')]){_0x57ab7e[_0xb695('0x14')](_0x5eb26b[_0x12fea2][_0xb695('0x15')],_0x5eb26b[_0x12fea2][_0xb695('0x13')],_0x5eb26b[_0x12fea2][_0xb695('0x16')]);}}return _0x57ab7e;}function getRoot(_0x1eaaeb){return parser[_0xb695('0x17')](_0x1eaaeb,{'object':!![]})[_0xb695('0x18')]['root'];}function inspect(_0x4f414a){return util['inspect'](_0x4f414a,{'showHidden':![],'depth':null});}function initialize(_0x157792,_0x1d4a2e){var _0x4dc617=getRoot(_0x157792[_0xb695('0x19')]);if(!_0x4dc617||!_0x4dc617['start'])return;var _0x34552e,_0x4ef00f,_0x59d2cc;logger[_0xb695('0x1a')](_0xb695('0x1b'),JSON['stringify'](_0x4dc617,null,0x2));_0x1d4a2e['joinAt']=moment()[_0xb695('0x1c')](_0xb695('0x1d'));_0x34552e=initGraph(_[_0xb695('0x1e')](_0x4dc617,'mxCell'),_0x4dc617[_0xb695('0x1f')]);_0x4ef00f=new Vertices(_0x1d4a2e,rpc,mailRpc);logger[_0xb695('0x20')](util[_0xb695('0x1c')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d4a2e['arg_1'],_0x1d4a2e[_0xb695('0x21')],_0x1d4a2e['callerid'],_0x1d4a2e[_0xb695('0x22')],_0x1d4a2e[_0xb695('0x23')]));_0x34552e[_0xb695('0x24')](_0x4dc617[_0xb695('0x25')]['id'],function(_0xb97f89){try{_0xb97f89=_0x4ef00f[_0xb695('0x26')](_0xb97f89);logger[_0xb695('0x1a')](_0xb695('0x27'),JSON[_0xb695('0x28')](_0xb97f89,null,0x2));if(_0xb97f89[_0xb695('0xc')]===_0xb695('0x29')){logger['info'](_0xb695('0x2a'));_0x1d4a2e[_0xb695('0x2b')]=_0xb97f89[_0xb695('0x2b')]||_0x1d4a2e[_0xb695('0x2b')];_0x1d4a2e[_0xb695('0x2c')]=_0xb97f89[_0xb695('0x2c')];_0x1d4a2e[_0xb695('0x2d')]=_0xb97f89[_0xb695('0x2d')]?_0xb97f89[_0xb695('0x2d')]-0x1:0x1;return null;}else if(_0xb97f89&&_0x4ef00f[_0xb97f89[_0xb695('0xc')]]){_0x59d2cc=_0x4ef00f[_0xb97f89[_0xb695('0xc')]](_0xb97f89);logger[_0xb695('0x20')](_0xb695('0x2e'),JSON[_0xb695('0x28')](_0x59d2cc,null,0x2));if(_0x59d2cc&&_0x59d2cc[_0xb695('0x2f')]===AGI_CODE_SUCCESS&&_0x59d2cc['result']!==AGI_RESULT_ERROR&&!_0x1d4a2e[_0xb695('0x30')]){logger['debug'](_0xb695('0x2e'),inspect(_0x59d2cc));return _[_0xb695('0x31')](_0x59d2cc[_0xb695('0x32')])?null:_0x59d2cc['result'][_0xb695('0x33')]();}else{logger['error'](_0xb695('0x2e'),inspect(_0x59d2cc));return null;}}else{logger[_0xb695('0x9')](_0xb695('0x34'));return null;}}catch(_0x2987c9){logger[_0xb695('0x9')](_0x2987c9['stack']);return null;}});if(_0x4dc617[_0xb695('0x35')]){logger['info'](util[_0xb695('0x1c')](_0xb695('0x36'),_0x1d4a2e['arg_1'],_0x1d4a2e[_0xb695('0x21')],_0x1d4a2e[_0xb695('0x37')],_0x1d4a2e[_0xb695('0x22')],_0x1d4a2e[_0xb695('0x23')]));_0x34552e[_0xb695('0x24')](_0x4dc617[_0xb695('0x35')]['id'],function(_0x4efcd4){try{_0x4efcd4=_0x4ef00f[_0xb695('0x26')](_0x4efcd4);logger[_0xb695('0x1a')](_0xb695('0x27'),JSON['stringify'](_0x4efcd4,null,0x2));if(_0x4efcd4&&_0x4ef00f[_0x4efcd4['agicommand']]){_0x59d2cc=_0x4ef00f[_0x4efcd4['agicommand']](_0x4efcd4);if(_0x59d2cc){logger['debug'](_0xb695('0x2e'),inspect(_0x59d2cc));return _['isUndefined'](_0x59d2cc[_0xb695('0x32')])?null:_0x59d2cc[_0xb695('0x32')][_0xb695('0x33')]();}else{logger[_0xb695('0x9')](_0xb695('0x2e'),inspect(_0x59d2cc));return null;}}else{logger['error'](_0xb695('0x34'));return null;}}catch(_0x2856de){logger['error'](_0x2856de[_0xb695('0xb')]);return null;}});}logger[_0xb695('0x20')](util[_0xb695('0x1c')](_0xb695('0x38'),_0x1d4a2e[_0xb695('0x39')],_0x1d4a2e[_0xb695('0x21')],_0x1d4a2e[_0xb695('0x37')],_0x1d4a2e['dnid'],_0x1d4a2e[_0xb695('0x23')]));logger['info'](util[_0xb695('0x1c')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1d4a2e['context'],_0x1d4a2e['extension'],parseInt(_0x1d4a2e[_0xb695('0x2d')],0xa)+0x1));_0x1d4a2e[_0xb695('0x3a')](_0x1d4a2e[_0xb695('0x2b')],_0x1d4a2e[_0xb695('0x2c')],parseInt(_0x1d4a2e['priority'],0xa)+0x1);_0x1d4a2e[_0xb695('0x3b')]();}function handleNotFound(_0x242782){logger[_0xb695('0x9')](util[_0xb695('0x1c')](_0xb695('0x3c'),_0x242782[_0xb695('0x39')]));_0x242782[_0xb695('0x3a')](_0x242782[_0xb695('0x2b')],_0x242782[_0xb695('0x2c')],parseInt(_0x242782[_0xb695('0x2d')],0xa)+0x1);_0x242782[_0xb695('0x3b')]();}function handleUnpublished(_0x2c4695){logger[_0xb695('0x9')](util['format'](_0xb695('0x3d'),_0x2c4695[_0xb695('0x39')]));_0x2c4695['continueAt'](_0x2c4695[_0xb695('0x2b')],_0x2c4695[_0xb695('0x2c')],parseInt(_0x2c4695[_0xb695('0x2d')],0xa)+0x1);_0x2c4695[_0xb695('0x3b')]();}module[_0xb695('0x3e')]={'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 c9c351a..b39c0a6 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 _0x3043=['prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','indexOf','slice','trim','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits'];(function(_0x2bd523,_0x20c592){var _0x111703=function(_0x4de93b){while(--_0x4de93b){_0x2bd523['push'](_0x2bd523['shift']());}};_0x111703(++_0x20c592);}(_0x3043,0x175));var _0x3304=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x3043[_0x164af1];return _0x5d81a2;};'use strict';var util=require(_0x3304('0x0'));var Transform=require(_0x3304('0x1'))[_0x3304('0x2')];function AGIReply(_0x36404b){Transform[_0x3304('0x3')](this,_0x36404b);this[_0x3304('0x4')]='';this[_0x3304('0x5')]=![];}util[_0x3304('0x6')](AGIReply,Transform);AGIReply[_0x3304('0x7')][_0x3304('0x8')]=function(_0x4c18eb,_0x4593ea,_0x40d5ce){var _0x228878='\x0a',_0x180be2=['\x0a\x0a',_0x3304('0x9')],_0x4004b2=-0x1,_0x57faca=-0x1,_0x1c435a='',_0x32af8e=0x0,_0x1b2e4d='',_0x4977c3='';this[_0x3304('0x4')]+=_0x4c18eb[_0x3304('0xa')]();_0x1b2e4d=this['_localBuffer'];if(!this[_0x3304('0x5')]){_0x32af8e=0x0;while(_0x180be2[_0x32af8e]){while((_0x57faca=_0x1b2e4d['indexOf'](_0x180be2[_0x32af8e]))!=-0x1){_0x1c435a=_0x180be2[_0x32af8e];_0x4977c3=_0x1b2e4d['substring'](0x0,_0x57faca);_0x1b2e4d=_0x1b2e4d[_0x3304('0xb')](_0x57faca+_0x1c435a[_0x3304('0xc')]);var _0x43b584=_0x4977c3['split'](_0x228878),_0x1cd879=0x0,_0x446197={},_0x331c5d='',_0x1c8cb1='',_0x155314=-0x1;while(_0x43b584[_0x1cd879]){_0x155314=_0x43b584[_0x1cd879][_0x3304('0xd')](':');if(_0x155314!=-0x1){_0x331c5d=_0x43b584[_0x1cd879][_0x3304('0xe')](0x0,_0x155314)['trim']();_0x1c8cb1=_0x43b584[_0x1cd879][_0x3304('0xe')](_0x155314+0x1)[_0x3304('0xf')]();if(_0x331c5d[_0x3304('0xc')]>0x0){_0x446197[_0x331c5d]=_0x1c8cb1;}}else{}_0x1cd879++;}this[_0x3304('0x10')]('headers',_0x446197);this[_0x3304('0x5')]=!![];}_0x32af8e++;}this[_0x3304('0x4')]=_0x1b2e4d;}else{while((_0x4004b2=_0x1b2e4d[_0x3304('0xd')](_0x228878))!=-0x1){_0x4977c3=_0x1b2e4d[_0x3304('0xb')](0x0,_0x4004b2);this[_0x3304('0x10')](_0x3304('0x11'),_0x4977c3);_0x1b2e4d=_0x1b2e4d[_0x3304('0xb')](_0x4004b2+_0x228878[_0x3304('0xc')]);}this[_0x3304('0x4')]=_0x1b2e4d;}_0x40d5ce();};module[_0x3304('0x12')]=AGIReply; \ No newline at end of file +var _0x312f=['substring','length','split','indexOf','slice','trim','emit','headers','line','util','stream','Transform','call','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','_inBody'];(function(_0x4ba97e,_0x194ab6){var _0x31730d=function(_0x5d7d99){while(--_0x5d7d99){_0x4ba97e['push'](_0x4ba97e['shift']());}};_0x31730d(++_0x194ab6);}(_0x312f,0x1ab));var _0xf312=function(_0x2d154c,_0x5be4b3){_0x2d154c=_0x2d154c-0x0;var _0x5430ef=_0x312f[_0x2d154c];return _0x5430ef;};'use strict';var util=require(_0xf312('0x0'));var Transform=require(_0xf312('0x1'))[_0xf312('0x2')];function AGIReply(_0x2b3a20){Transform[_0xf312('0x3')](this,_0x2b3a20);this['_localBuffer']='';this['_inBody']=![];}util[_0xf312('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xf312('0x5')]=function(_0x259d35,_0x276bf3,_0x389196){var _0x16fc8f='\x0a',_0x305040=['\x0a\x0a',_0xf312('0x6')],_0x21a7ea=-0x1,_0x2a602f=-0x1,_0x331743='',_0x4fc3b7=0x0,_0x5052d3='',_0x2f76ea='';this[_0xf312('0x7')]+=_0x259d35[_0xf312('0x8')]();_0x5052d3=this[_0xf312('0x7')];if(!this[_0xf312('0x9')]){_0x4fc3b7=0x0;while(_0x305040[_0x4fc3b7]){while((_0x2a602f=_0x5052d3['indexOf'](_0x305040[_0x4fc3b7]))!=-0x1){_0x331743=_0x305040[_0x4fc3b7];_0x2f76ea=_0x5052d3[_0xf312('0xa')](0x0,_0x2a602f);_0x5052d3=_0x5052d3[_0xf312('0xa')](_0x2a602f+_0x331743[_0xf312('0xb')]);var _0xfe80f5=_0x2f76ea[_0xf312('0xc')](_0x16fc8f),_0x4aba12=0x0,_0xd049c9={},_0xa43ae3='',_0x2b543a='',_0x57ff30=-0x1;while(_0xfe80f5[_0x4aba12]){_0x57ff30=_0xfe80f5[_0x4aba12][_0xf312('0xd')](':');if(_0x57ff30!=-0x1){_0xa43ae3=_0xfe80f5[_0x4aba12][_0xf312('0xe')](0x0,_0x57ff30)['trim']();_0x2b543a=_0xfe80f5[_0x4aba12][_0xf312('0xe')](_0x57ff30+0x1)[_0xf312('0xf')]();if(_0xa43ae3[_0xf312('0xb')]>0x0){_0xd049c9[_0xa43ae3]=_0x2b543a;}}else{}_0x4aba12++;}this[_0xf312('0x10')](_0xf312('0x11'),_0xd049c9);this['_inBody']=!![];}_0x4fc3b7++;}this[_0xf312('0x7')]=_0x5052d3;}else{while((_0x21a7ea=_0x5052d3[_0xf312('0xd')](_0x16fc8f))!=-0x1){_0x2f76ea=_0x5052d3['substring'](0x0,_0x21a7ea);this[_0xf312('0x10')](_0xf312('0x12'),_0x2f76ea);_0x5052d3=_0x5052d3[_0xf312('0xa')](_0x21a7ea+_0x16fc8f[_0xf312('0xb')]);}this[_0xf312('0x7')]=_0x5052d3;}_0x389196();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index edf054b..182aef2 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 _0x1601=['YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x1601,0x105));var _0x1160=function(_0x1e9dd1,_0x2e180a){_0x1e9dd1=_0x1e9dd1-0x0;var _0x1752dc=_0x1601[_0x1e9dd1];return _0x1752dc;};'use strict';var _=require(_0x1160('0x0'));var moment=require(_0x1160('0x1'));var jayson=require(_0x1160('0x2'));var client=jayson['client'][_0x1160('0x3')]({'port':0x2329});function request(_0x498dd1,_0x26720a){return new Promise(function(_0x1738e5,_0x15f1fd){return client[_0x1160('0x4')](_0x498dd1,_0x26720a)['then'](function(_0x5b42e1){if(_0x5b42e1[_0x1160('0x5')]){return _0x15f1fd(_0x5b42e1[_0x1160('0x5')]['message']);}else{return _0x1738e5(_0x5b42e1[_0x1160('0x6')]);}})[_0x1160('0x7')](function(_0x9c6df7){return _0x15f1fd(_0x9c6df7);});});}exports[_0x1160('0x8')]=function(){return request(_0x1160('0x9'),{'options':{'raw':![],'attributes':['id',_0x1160('0xa'),'production']}});};exports[_0x1160('0xb')]=function(_0x4fed16){return request(_0x1160('0xc'),{'options':{'raw':![],'where':{'name':_0x4fed16},'attributes':[_0x1160('0xd')]}});};exports[_0x1160('0xe')]=function(_0xf80cb4){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xf80cb4},'include':[{'model':_0x1160('0xf'),'as':_0x1160('0x10'),'include':[{'model':_0x1160('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0x1160('0xa'),_0x1160('0x12')]}});};exports[_0x1160('0x13')]=function(_0x248994){return request(_0x1160('0xc'),{'options':{'where':{'id':_0x248994},'attributes':[_0x1160('0xa')]}});};exports[_0x1160('0x14')]=function(_0x2df7b3){return request(_0x1160('0x15'),{'options':{'where':{'id':_0x2df7b3},'attributes':['name']}});};exports[_0x1160('0x16')]=function(_0x12d80c){return request(_0x1160('0x17'),{'options':{'where':{'id':_0x12d80c},'attributes':[_0x1160('0xa')]}});};exports[_0x1160('0x18')]=function(_0x36749f){return request(_0x1160('0x19'),{'options':{'where':{'id':_0x36749f},'attributes':['dsn']}});};exports['getUserById']=function(_0x2f9a35){return request(_0x1160('0x1a'),{'options':{'where':{'id':_0x2f9a35},'attributes':[_0x1160('0xa')]}});};exports[_0x1160('0x1b')]=function(_0x1e3631){return request(_0x1160('0x1c'),{'options':{'where':{'phone':_0x1e3631['phone']},'attributes':['id']}});};exports[_0x1160('0x1d')]=function(_0x1e5ff3){return request(_0x1160('0x1e'),{'options':{'where':{'id':_0x1e5ff3},'attributes':['name']}});};exports[_0x1160('0x1f')]=function(_0x32adc1){return request(_0x1160('0x20'),{'options':{'where':{'id':_0x32adc1},'attributes':[_0x1160('0x21')]}});};exports['getIntervalById']=function(_0x284671){return request(_0x1160('0x22'),{'options':{'raw':![],'where':{'id':_0x284671},'include':[{'model':'Interval','as':_0x1160('0x23')}]}});};exports[_0x1160('0x24')]=function(_0x436b78){return request('ShowSmsAccount',{'options':{'where':{'id':_0x436b78},'attributes':['id',_0x1160('0xa')]}});};exports[_0x1160('0x25')]=function(_0x2f6050){return request(_0x1160('0x26'),{'body':_0x2f6050});};exports['createSquareDetailsReport']=function(_0x10684f){return request('CreateSquareDetailsReport',{'body':_0x10684f});};exports[_0x1160('0x27')]=function(_0x326e71){return request(_0x1160('0x28'),{'body':_[_0x1160('0x29')](_0x326e71,{'project_name':_0x326e71[_0x1160('0x2a')],'prev_project_name':_0x326e71[_0x1160('0x2b')]||'','is_subproject':_0x326e71[_0x1160('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0x1160('0x2c'))})});};exports[_0x1160('0x2d')]=function(_0x57d044){return request(_0x1160('0x2e'),{'body':_0x57d044});};exports[_0x1160('0x2f')]=function(_0x2776d0){return request('CreateSquareMessage',{'body':_0x2776d0});};exports['createCmContact']=function(_0x382dec){return request(_0x1160('0x30'),{'options':{'raw':![],'where':{'phone':_0x382dec['phone'],'ListId':_0x382dec[_0x1160('0x31')]}}})[_0x1160('0x32')](function(_0x34bb67){if(_0x34bb67){return _0x34bb67;}return request(_0x1160('0x33'),{'body':_0x382dec});});};exports[_0x1160('0x34')]=function(_0x2cbe42){return request(_0x1160('0x35'),{'options':{'where':{'id':_0x2cbe42},'attributes':[_0x1160('0xa')]}});};exports[_0x1160('0x36')]=function(_0xf2c826,_0x12f5f2){return request(_0x1160('0x37'),{'body':{'interface':_0x12f5f2},'options':{'where':_0xf2c826}});};exports[_0x1160('0x38')]=function(_0x340803,_0x214e19,_0x407eb0){return request(_0x1160('0x39'),{'body':{'type':_0x214e19,'uniqueid':_0x407eb0},'options':{'where':_0x340803}});};exports['agentUnpause']=function(_0x32904a){return request(_0x1160('0x3a'),{'body':{},'options':{'where':_0x32904a}});};exports[_0x1160('0x3b')]=function(_0x61e589){return request(_0x1160('0x3c'),{'body':{},'options':{'where':_0x61e589}});}; \ No newline at end of file +var _0xf55c=['getPauseById','ShowPause','agentLogin','LoginUser','agentPause','UnpauseUser','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','createSquareRecording','createCmContact','ShowCmHopper','ListId'];(function(_0x130090,_0x21d9b7){var _0x104a94=function(_0x630dab){while(--_0x630dab){_0x130090['push'](_0x130090['shift']());}};_0x104a94(++_0x21d9b7);}(_0xf55c,0x1e7));var _0xcf55=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf55c[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0xcf55('0x0'));var moment=require('moment');var _=require(_0xcf55('0x1'));var util=require(_0xcf55('0x2'));var jayson=require(_0xcf55('0x3'));var client=jayson[_0xcf55('0x4')][_0xcf55('0x5')]({'port':0x2329});function request(_0x2c24c8,_0x3cd699){return new BPromise(function(_0x5d1baf,_0x2bff1a){return client[_0xcf55('0x6')](_0x2c24c8,_0x3cd699)[_0xcf55('0x7')](function(_0x3a6de7){if(_0x3a6de7['error']){return _0x2bff1a(_0x3a6de7[_0xcf55('0x8')][_0xcf55('0x9')]);}else{return _0x5d1baf(_0x3a6de7[_0xcf55('0xa')]);}})[_0xcf55('0xb')](function(_0x576566){return _0x2bff1a(_0x576566);});});}exports[_0xcf55('0xc')]=function(){return request(_0xcf55('0xd'),{'options':{'raw':![],'attributes':['id',_0xcf55('0xe'),_0xcf55('0xf')]}});};exports[_0xcf55('0x10')]=function(_0x1d8ffc){return request(_0xcf55('0x11'),{'options':{'raw':![],'where':{'name':_0x1d8ffc},'attributes':['production']}});};exports[_0xcf55('0x12')]=function(_0x133c22){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x133c22},'include':[{'model':'MailServerOut','as':_0xcf55('0x13'),'include':[{'model':_0xcf55('0x14'),'as':_0xcf55('0x14')}]}],'attributes':['id',_0xcf55('0xe'),_0xcf55('0x15')]}});};exports[_0xcf55('0x16')]=function(_0x435287){return request(_0xcf55('0x11'),{'options':{'where':{'id':_0x435287},'attributes':[_0xcf55('0xe')]}});};exports[_0xcf55('0x17')]=function(_0x3a7e3f){return request(_0xcf55('0x18'),{'options':{'where':{'id':_0x3a7e3f},'attributes':['name']}});};exports[_0xcf55('0x19')]=function(_0xfba091){return request(_0xcf55('0x1a'),{'options':{'where':{'id':_0xfba091},'attributes':[_0xcf55('0xe')]}});};exports[_0xcf55('0x1b')]=function(_0x4b0c1a){return request(_0xcf55('0x1c'),{'options':{'where':{'id':_0x4b0c1a},'attributes':[_0xcf55('0x1d')]}});};exports[_0xcf55('0x1e')]=function(_0xeed93){return request(_0xcf55('0x1f'),{'options':{'where':{'id':_0xeed93},'attributes':['name']}});};exports[_0xcf55('0x20')]=function(_0x486436){return request(_0xcf55('0x21'),{'options':{'where':{'phone':_0x486436[_0xcf55('0x22')]},'attributes':['id']}});};exports[_0xcf55('0x23')]=function(_0x5ca906){return request('ShowTrunk',{'options':{'where':{'id':_0x5ca906},'attributes':['name']}});};exports[_0xcf55('0x24')]=function(_0x9cd5d5){return request(_0xcf55('0x25'),{'options':{'where':{'id':_0x9cd5d5},'attributes':['save_name']}});};exports[_0xcf55('0x26')]=function(_0x2dcddf){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2dcddf},'include':[{'model':'Interval','as':_0xcf55('0x27')}]}});};exports[_0xcf55('0x28')]=function(_0x5de5af){return request(_0xcf55('0x29'),{'options':{'where':{'id':_0x5de5af},'attributes':['id',_0xcf55('0xe')]}});};exports[_0xcf55('0x2a')]=function(_0x3c0723){return request(_0xcf55('0x2b'),{'body':_0x3c0723});};exports[_0xcf55('0x2c')]=function(_0x2854ca){return request(_0xcf55('0x2d'),{'body':_0x2854ca});};exports['createSquareReport']=function(_0x37e734){return request('CreateSquareReport',{'body':_[_0xcf55('0x2e')](_0x37e734,{'project_name':_0x37e734[_0xcf55('0x2f')],'prev_project_name':_0x37e734[_0xcf55('0x30')]||'','is_subproject':_0x37e734['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xcf55('0x31')]=function(_0x34c18b){return request('CreateSquareRecording',{'body':_0x34c18b});};exports['createSquareMessage']=function(_0x41d5af){return request('CreateSquareMessage',{'body':_0x41d5af});};exports[_0xcf55('0x32')]=function(_0x4128c0){return request(_0xcf55('0x33'),{'options':{'raw':![],'where':{'phone':_0x4128c0[_0xcf55('0x22')],'ListId':_0x4128c0[_0xcf55('0x34')]}}})[_0xcf55('0x7')](function(_0x3cf082){if(_0x3cf082){return _0x3cf082;}return request('CreateCmContact',{'body':_0x4128c0});});};exports[_0xcf55('0x35')]=function(_0x4aee25){return request(_0xcf55('0x36'),{'options':{'where':{'id':_0x4aee25},'attributes':[_0xcf55('0xe')]}});};exports[_0xcf55('0x37')]=function(_0x4cc35e,_0x28798a){return request(_0xcf55('0x38'),{'body':{'interface':_0x28798a},'options':{'where':_0x4cc35e}});};exports[_0xcf55('0x39')]=function(_0xa26ab9,_0x567f8f,_0x439fd7){return request('PauseUser',{'body':{'type':_0x567f8f,'uniqueid':_0x439fd7},'options':{'where':_0xa26ab9}});};exports['agentUnpause']=function(_0x5692ff){return request(_0xcf55('0x3a'),{'body':{},'options':{'where':_0x5692ff}});};exports['agentLogout']=function(_0x5ba246){return request(_0xcf55('0x3b'),{'body':{},'options':{'where':_0x5ba246}});}; \ 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 16d3cce..c5d8e79 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 _0xe55d=['./polly','./lex'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe55d,0x126));var _0xde55=function(_0x330a9e,_0x3eb7b4){_0x330a9e=_0x330a9e-0x0;var _0x43c7c4=_0xe55d[_0x330a9e];return _0x43c7c4;};var polly=require(_0xde55('0x0'));var lex=require(_0xde55('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8ca9=['./polly','./lex','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca9,0x9c));var _0x98ca=function(_0x32d7b2,_0x36786a){_0x32d7b2=_0x32d7b2-0x0;var _0x24c3bb=_0x8ca9[_0x32d7b2];return _0x24c3bb;};var polly=require(_0x98ca('0x0'));var lex=require(_0x98ca('0x1'));module[_0x98ca('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 27ad839..3a258c5 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 _0x70e0=['exports','./lib/api'];(function(_0x3b10df,_0x46d3ec){var _0x50501e=function(_0x28b8b5){while(--_0x28b8b5){_0x3b10df['push'](_0x3b10df['shift']());}};_0x50501e(++_0x46d3ec);}(_0x70e0,0x17b));var _0x070e=function(_0x40629a,_0x5771ae){_0x40629a=_0x40629a-0x0;var _0x7627e0=_0x70e0[_0x40629a];return _0x7627e0;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x6f0d=['exports'];(function(_0x3086df,_0x4bbaba){var _0x3e4ad0=function(_0x205705){while(--_0x205705){_0x3086df['push'](_0x3086df['shift']());}};_0x3e4ad0(++_0x4bbaba);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x17f148,_0x316db2){_0x17f148=_0x17f148-0x0;var _0x157b34=_0x6f0d[_0x17f148];return _0x157b34;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ 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 bec3a72..b58dc42 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(_0x27fd0a,_0x21cdee){var _0x4213c2=function(_0x345aee){while(--_0x345aee){_0x27fd0a['push'](_0x27fd0a['shift']());}};_0x4213c2(++_0x21cdee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x1668f1,_0x581d4b){var _0x45ba6b=function(_0x4e6024){while(--_0x4e6024){_0x1668f1['push'](_0x1668f1['shift']());}};_0x45ba6b(++_0x581d4b);}(_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 diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index c8b8543..bea3300 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 _0xe7a9=['./lib/api'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xe7a9,0x68));var _0x9e7a=function(_0x27002b,_0x5d364c){_0x27002b=_0x27002b-0x0;var _0x5b3beb=_0xe7a9[_0x27002b];return _0x5b3beb;};'use strict';var polly=require(_0x9e7a('0x0'));module['exports']=function(_0x226aaf,_0x1bc4d1,_0x371e84,_0x4dcc8f,_0x4df539,_0x19e122,_0x1d6a5e){return polly(_0x226aaf,_0x1bc4d1,_0x371e84,_0x4dcc8f,_0x4df539,_0x19e122,_0x1d6a5e);}; \ No newline at end of file +var _0xb38c=['exports','./lib/api'];(function(_0xfc3348,_0x4db501){var _0x2f9fb2=function(_0x375f7e){while(--_0x375f7e){_0xfc3348['push'](_0xfc3348['shift']());}};_0x2f9fb2(++_0x4db501);}(_0xb38c,0x1bf));var _0xcb38=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xb38c[_0x2c27ed];return _0x597bd1;};'use strict';var polly=require(_0xcb38('0x0'));module[_0xcb38('0x1')]=function(_0x4d7a1b,_0x370705,_0x4d8e36,_0x5493a6,_0x4102c3,_0x5251ba,_0xe15a4d){return polly(_0x4d7a1b,_0x370705,_0x4d8e36,_0x5493a6,_0x4102c3,_0x5251ba,_0xe15a4d);}; \ 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 b685bff..4e51eff 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 _0xda52=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x1d88ca,_0x5a1b62){var _0x5c7585=function(_0x14d897){while(--_0x14d897){_0x1d88ca['push'](_0x1d88ca['shift']());}};_0x5c7585(++_0x5a1b62);}(_0xda52,0x103));var _0x2da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda52[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x2da5('0x0'));var BPromise=require('bluebird');var rs=require(_0x2da5('0x1'));var AWS=require(_0x2da5('0x2'));function pollyResult(_0x53c220,_0x40c069,_0x1ad33b){return new BPromise(function(_0x5ccac5,_0x58a144){_0x53c220[_0x2da5('0x3')](_0x40c069,function(_0x1aff9d,_0x1caa0a){if(_0x1aff9d){_0x58a144(_0x1aff9d);}else if(_0x1caa0a){if(_0x1caa0a[_0x2da5('0x4')]instanceof Buffer){fs[_0x2da5('0x5')](_0x1ad33b,_0x1caa0a[_0x2da5('0x4')],function(_0x38ab5a){if(_0x38ab5a){_0x58a144(_0x38ab5a);}else{_0x5ccac5();}});}else{_0x58a144(new Error(_0x2da5('0x6')));}}else{_0x58a144(new Error(_0x2da5('0x7')));}});});}module[_0x2da5('0x8')]=function(_0x542ad7,_0x1d91d2,_0x420a76,_0x2821c6,_0x57752d,_0x393d73,_0x383e7f){var _0x5aff72=new AWS[(_0x2da5('0x9'))]({'accessKeyId':_0x542ad7,'secretAccessKey':_0x1d91d2,'region':_0x420a76});var _0x29fb75={'Text':_0x57752d,'TextType':_0x393d73||'text','OutputFormat':_0x2da5('0xa'),'VoiceId':_0x2821c6};return pollyResult(_0x5aff72,_0x29fb75,_0x383e7f);}; \ No newline at end of file +var _0xe5f9=['randomstring','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','bluebird'];(function(_0x488917,_0x33462f){var _0x294885=function(_0x5be9cc){while(--_0x5be9cc){_0x488917['push'](_0x488917['shift']());}};_0x294885(++_0x33462f);}(_0xe5f9,0xee));var _0x9e5f=function(_0x17e92b,_0xa77f21){_0x17e92b=_0x17e92b-0x0;var _0x23ac1c=_0xe5f9[_0x17e92b];return _0x23ac1c;};'use strict';var fs=require('fs');var path=require(_0x9e5f('0x0'));var BPromise=require(_0x9e5f('0x1'));var rs=require(_0x9e5f('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4c9394,_0x108b63,_0x8459d5){return new BPromise(function(_0x484213,_0x1bce0f){_0x4c9394['synthesizeSpeech'](_0x108b63,function(_0x4bd134,_0x420881){if(_0x4bd134){_0x1bce0f(_0x4bd134);}else if(_0x420881){if(_0x420881[_0x9e5f('0x3')]instanceof Buffer){fs[_0x9e5f('0x4')](_0x8459d5,_0x420881[_0x9e5f('0x3')],function(_0x205340){if(_0x205340){_0x1bce0f(_0x205340);}else{_0x484213();}});}else{_0x1bce0f(new Error(_0x9e5f('0x5')));}}else{_0x1bce0f(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x111d66,_0x202995,_0x4167a9,_0x5371e9,_0x271ea2,_0x2c1916,_0xde8a67){var _0x4f0047=new AWS['Polly']({'accessKeyId':_0x111d66,'secretAccessKey':_0x202995,'region':_0x4167a9});var _0xa5f720={'Text':_0x271ea2,'TextType':_0x2c1916||_0x9e5f('0x6'),'OutputFormat':_0x9e5f('0x7'),'VoiceId':_0x5371e9};return pollyResult(_0x4f0047,_0xa5f720,_0xde8a67);}; \ 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 e5e169f..1042c40 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 _0x07bf=['./lib/api'];(function(_0x552b6a,_0x1f3b6c){var _0x5c3c46=function(_0x315830){while(--_0x315830){_0x552b6a['push'](_0x552b6a['shift']());}};_0x5c3c46(++_0x1f3b6c);}(_0x07bf,0x12a));var _0xf07b=function(_0xe30977,_0x52979d){_0xe30977=_0xe30977-0x0;var _0x415c9a=_0x07bf[_0xe30977];return _0x415c9a;};'use strict';var asr=require(_0xf07b('0x0'));module['exports']=function(_0x485892,_0x42ee90,_0x3d93f5,_0x1cd839){return asr(_0x485892,_0x42ee90,_0x3d93f5);}; \ No newline at end of file +var _0x4362=['./lib/api','exports'];(function(_0x73fa16,_0x1377a2){var _0x290acd=function(_0x281d4b){while(--_0x281d4b){_0x73fa16['push'](_0x73fa16['shift']());}};_0x290acd(++_0x1377a2);}(_0x4362,0x10e));var _0x2436=function(_0x8a95a3,_0x21d5c1){_0x8a95a3=_0x8a95a3-0x0;var _0xbdccb0=_0x4362[_0x8a95a3];return _0xbdccb0;};'use strict';var asr=require(_0x2436('0x0'));module[_0x2436('0x1')]=function(_0x22bf03,_0x5b2e22,_0x573a7e,_0xdac51d){return asr(_0x22bf03,_0x5b2e22,_0x573a7e);}; \ 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 fc52b97..8a5c7ad 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 _0x6e77=['filepath\x20should\x20be\x20a\x20string','string','length','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6e77,0xef));var _0x76e7=function(_0xf9bcaf,_0x3c9230){_0xf9bcaf=_0xf9bcaf-0x0;var _0x1dff25=_0x6e77[_0xf9bcaf];return _0x1dff25;};'use strict';var url=require('url');var BPromise=require(_0x76e7('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x389715,_0x2aea10,_0x57a8b3){return new BPromise(function(_0x37101b,_0x305900){var _0xcc6627;if(typeof _0x389715!=='string'||_0x389715['length']===0x0){return _0x305900(_0x76e7('0x1'));}if(typeof _0x2aea10!==_0x76e7('0x2')||_0x2aea10[_0x76e7('0x3')]===0x0){return _0x305900('key\x20should\x20be\x20a\x20string');}if(typeof _0x57a8b3!==_0x76e7('0x4')&&(typeof _0x57a8b3!==_0x76e7('0x2')||_0x57a8b3[_0x76e7('0x3')]===0x0)){return _0x305900('lang\x20should\x20be\x20a\x20string');}try{_0xcc6627=fs[_0x76e7('0x5')](_0x389715)[_0x76e7('0x6')]('base64');}catch(_0x37f521){return _0x305900(_0x37f521);}return _0x37101b({'method':_0x76e7('0x7'),'uri':host+_0x76e7('0x8')+_0x2aea10,'body':{'config':{'encoding':_0x76e7('0x9'),'sampleRateHertz':'8000','languageCode':_0x57a8b3},'audio':{'content':_0xcc6627}},'json':!![]});});}; \ No newline at end of file +var _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x48ea55,_0x3b5a67){var _0x79949f=function(_0x17478f){while(--_0x17478f){_0x48ea55['push'](_0x48ea55['shift']());}};_0x79949f(++_0x3b5a67);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x321d63,_0x262075){_0x321d63=_0x321d63-0x0;var _0x4c78b4=_0x6f7a[_0x321d63];return _0x4c78b4;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'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 16cccab..a69c2cd 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 _0xbff2=['./asr'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xbff2,0x1da));var _0x2bff=function(_0x18bfcb,_0x53eee5){_0x18bfcb=_0x18bfcb-0x0;var _0x11d63b=_0xbff2[_0x18bfcb];return _0x11d63b;};var asr=require(_0x2bff('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x31da=['./asr','exports'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x31da,0x8a));var _0xa31d=function(_0x3cae4f,_0x3b0948){_0x3cae4f=_0x3cae4f-0x0;var _0x49942a=_0x31da[_0x3cae4f];return _0x49942a;};var asr=require(_0xa31d('0x0'));module[_0xa31d('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 e2b8aa6..62ebdcf 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 _0x01e7=['.wav','base64','then','chmodSync','777','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','result','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','querystring','request-promise','randomstring','google-tts-api','url','util','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate'];(function(_0x436fe0,_0x3f1719){var _0x7e1740=function(_0x35d85d){while(--_0x35d85d){_0x436fe0['push'](_0x436fe0['shift']());}};_0x7e1740(++_0x3f1719);}(_0x01e7,0x15c));var _0x701e=function(_0x40f583,_0x3cc230){_0x40f583=_0x40f583-0x0;var _0x5d6a51=_0x01e7[_0x40f583];return _0x5d6a51;};'use strict';var apiai=require(_0x701e('0x0'));var BPromise=require(_0x701e('0x1'));var dialogflow=require(_0x701e('0x2'));var fs=require('fs');var http=require(_0x701e('0x3'));var https=require('https');var md5=require(_0x701e('0x4'));var path=require('path');var querystring=require(_0x701e('0x5'));var rp=require(_0x701e('0x6'));var rs=require(_0x701e('0x7'));var sox=require('sox');var tts=require(_0x701e('0x8'));var urlParse=require(_0x701e('0x9'))['parse'];var util=require(_0x701e('0xa'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x701e('0xb'));var logger=require(_0x701e('0xc'))(_0x701e('0xd'));var ISPEECH_API=_0x701e('0xe');function downloadFile(_0x3a0234,_0x5e68eb){return new BPromise(function(_0x8c9d75,_0x308ba7){var _0x578822=urlParse(_0x3a0234);var _0x11413f=_0x578822['protocol']===_0x701e('0xf')?https:http;var _0x228d5c={'host':_0x578822[_0x701e('0x10')],'path':_0x578822[_0x701e('0x11')],'headers':{'user-agent':_0x701e('0x12')}};_0x11413f[_0x701e('0x13')](_0x228d5c,function(_0x5db94d){if(_0x5db94d['statusCode']!==0xc8){logger[_0x701e('0x14')](_0x701e('0x15')+_0x3a0234+_0x701e('0x16')+_0x5db94d[_0x701e('0x17')]+'\x20('+_0x5db94d['statusMessage']+')');_0x308ba7(new Error(_0x701e('0x15')+_0x3a0234+_0x701e('0x16')+_0x5db94d[_0x701e('0x17')]+'\x20('+_0x5db94d[_0x701e('0x18')]+')'));return;}var _0xf02534=fs[_0x701e('0x19')](_0x5e68eb);_0xf02534['on']('finish',function(){logger[_0x701e('0x1a')](_0x701e('0x1b'));_0xf02534[_0x701e('0x1c')](_0x8c9d75);});_0xf02534['on'](_0x701e('0x14'),function(_0x149d59){fs[_0x701e('0x1d')](_0x5e68eb);logger[_0x701e('0x14')](_0x701e('0x1e'),_0x149d59);_0x308ba7(_0x149d59);});_0x5db94d[_0x701e('0x1f')](_0xf02534);})['on']('error',function(_0x2a747d){logger[_0x701e('0x14')](_0x2a747d);_0x308ba7(_0x2a747d);})[_0x701e('0x20')]();});}function uploadFile(_0x3f1012){return new BPromise(function(_0xaa374,_0x54e112){var _0x2cee90=urlParse(_0x3f1012);var _0x3c3a88=_0x2cee90[_0x701e('0x21')]==='https:'?https:http;var _0x17e644={'host':_0x2cee90[_0x701e('0x10')],'path':_0x2cee90['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x3c3a88[_0x701e('0x13')](_0x17e644,function(_0xbfdf99){if(_0xbfdf99['statusCode']!==0xc8){_0x54e112(new Error(_0x701e('0x15')+_0x3f1012+_0x701e('0x16')+_0xbfdf99[_0x701e('0x17')]+'\x20('+_0xbfdf99['statusMessage']+')'));return;}var _0x137289='';_0xbfdf99['on'](_0x701e('0x22'),function(_0x2abd6d){_0x137289+=_0x2abd6d;});_0xbfdf99['on'](_0x701e('0x20'),function(){_0xaa374(_0x137289);});})['on'](_0x701e('0x14'),function(_0x5d7d7f){_0x54e112(_0x5d7d7f);})[_0x701e('0x20')]();});}function convertFile(_0x4da66e,_0x4e74d2){return new BPromise(function(_0x185d8b,_0x311245){var _0xcd1d1a=sox[_0x701e('0x23')](_0x4da66e,_0x4e74d2,{'sampleRate':0x1f40,'format':_0x701e('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xcd1d1a['on'](_0x701e('0x14'),function(_0x12879d){logger[_0x701e('0x14')](_0x701e('0x25'),_0x12879d);_0x311245(_0x12879d);});_0xcd1d1a['on'](_0x701e('0x20'),function(){logger[_0x701e('0x1a')](_0x701e('0x26'));_0x185d8b();});_0xcd1d1a[_0x701e('0x27')]();});}function base64Decode(_0x43bc8f,_0x388830){var _0x57c84d=path['resolve'](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+_0x701e('0x2a'));fs['writeFileSync'](_0x57c84d,_0x43bc8f,_0x701e('0x2b'));return convertFile(_0x57c84d,_0x388830)[_0x701e('0x2c')](function(){try{fs[_0x701e('0x1d')](_0x57c84d);fs[_0x701e('0x2d')](_0x388830,_0x701e('0x2e'));}catch(_0x58551b){logger[_0x701e('0x14')](_0x58551b);}return _0x388830['split']('.')[0x0];});}function base64Encode(_0x20e896){var _0x33b2fb=fs['readFileSync'](_0x20e896);return new Buffer(_0x33b2fb)['toString'](_0x701e('0x2b'));}exports[_0x701e('0x2f')]=function(_0x4d6d56,_0x48b476,_0x1d1968,_0x5c7dda,_0x523e49,_0x5c14f3){var _0x9c7af6,_0x2a5646;var _0x12995a=_0x701e('0x30');var _0x42187c=_0x701e('0x31')+_0x4d6d56;var _0x189c27={};if(_0x48b476==='ssml'){_0x189c27[_0x701e('0x32')]={'ssml':_0x1d1968};}else{_0x189c27[_0x701e('0x32')]={'text':_0x1d1968};};_0x189c27[_0x701e('0x33')]={'languageCode':_0x5c7dda,'ssmlGender':_0x523e49};_0x189c27['audioConfig']={'audioEncoding':_0x701e('0x34'),'sampleRateHertz':0x1f40};var _0x209979={'url':_0x12995a+_0x701e('0x35')+_0x42187c,'method':_0x701e('0x36'),'json':!![],'body':_0x189c27};return rp(_0x209979)[_0x701e('0x2c')](function(_0x373b1d){return new BPromise(function(_0x1bb281,_0x603cdc){_0x9c7af6=path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs['generate'](0x4)+_0x701e('0x38'));var _0x1b398d=Buffer[_0x701e('0x39')](_0x373b1d[_0x701e('0x3a')],_0x701e('0x2b'));return fs[_0x701e('0x3b')](_0x9c7af6,_0x1b398d,function(_0x3906b4){_0x603cdc(_0x3906b4);},function(_0x232838){fs[_0x701e('0x2d')](_0x9c7af6,_0x701e('0x2e'));_0x1bb281(_0x232838);});});})['then'](function(_0x2e8fad){_0x2a5646=path[_0x701e('0x37')](__dirname,'tmp',rs[_0x701e('0x29')](0x4)+'.wav');return convertFile(_0x9c7af6,_0x2a5646);})[_0x701e('0x2c')](function(){try{fs[_0x701e('0x1d')](_0x9c7af6);fs[_0x701e('0x2d')](_0x2a5646,_0x701e('0x2e'));}catch(_0x57328b){logger[_0x701e('0x14')](_0x57328b);}logger[_0x701e('0x1a')](_0x701e('0x3c'),_0x2a5646[_0x701e('0x3d')]('.')[0x0]);return _0x2a5646[_0x701e('0x3d')]('.')[0x0];});};exports[_0x701e('0x3e')]=function(_0xbfad3d,_0x45c316){var _0x2e857c=_0x701e('0x3f');var _0x489288,_0x57b3dd;var _0x5d7cae;var _0x10f1b7={'encoding':_0x701e('0x40'),'method':_0x701e('0x36'),'timeout':0x2710,'url':_0x2e857c,'headers':{'Content-Type':_0x701e('0x41')},'body':_0x701e('0x42')+encodeURIComponent(JSON[_0x701e('0x43')]([[[_0x701e('0x44'),JSON[_0x701e('0x43')]([_0xbfad3d,_0x45c316||'en',![],'null']),null,_0x701e('0x45')]]]))};return rp(_0x10f1b7)[_0x701e('0x2c')](function(_0x3afb03){try{_0x5d7cae=eval(_0x3afb03['slice'](0x5))[0x0][0x2];}catch(_0x1eb902){throw new Error('parse\x20response\x20failed:\x0a'+_0x3afb03[_0x701e('0x22')]);}if(!_0x5d7cae){if(_0xbfad3d[_0x701e('0x46')]>0xc8){throw new Error(_0x701e('0x47'));}else{throw new Error(_0x701e('0x48')+_0x45c316+_0x701e('0x49'));}}try{_0x5d7cae=eval(_0x5d7cae)[0x0];}catch(_0x20f361){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2e5baa=_0x5d7cae;_0x489288=path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs['generate'](0x4)+_0x701e('0x38'));fs[_0x701e('0x4a')](_0x489288,_0x5d7cae,{'encoding':'base64'});_0x57b3dd=path['resolve'](__dirname,_0x701e('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x489288,_0x57b3dd);})[_0x701e('0x2c')](function(){try{fs[_0x701e('0x1d')](_0x489288);fs[_0x701e('0x2d')](_0x57b3dd,'777');}catch(_0x59457e){logger['error'](_0x59457e);}logger[_0x701e('0x1a')]('goggleTTS\x20path',_0x57b3dd[_0x701e('0x3d')]('.')[0x0]);return _0x57b3dd[_0x701e('0x3d')]('.')[0x0];});};exports['googleASR']=function(_0x6e274b,_0x183ff7,_0x25d665){return google[_0x701e('0x4b')](_0x6e274b,_0x183ff7,_0x25d665)[_0x701e('0x2c')](function(_0x1419ff){logger[_0x701e('0x1a')](_0x1419ff['uri']);return rp(_0x1419ff);})[_0x701e('0x2c')](function(_0x58df58){var _0x1e94b1='';var _0x30c9bc=0x0;try{fs[_0x701e('0x1d')](_0x6e274b);}catch(_0x261553){logger[_0x701e('0x14')](_0x261553);}if(_0x58df58&&_0x58df58[_0x701e('0x4c')]){_0x1e94b1=_0x58df58[_0x701e('0x4c')][_0x701e('0x4d')](function(_0x563aa4){return _0x563aa4&&_0x563aa4[_0x701e('0x4e')][0x0]&&_0x563aa4[_0x701e('0x4e')][0x0][_0x701e('0x4f')]?_0x563aa4[_0x701e('0x4e')][0x0]['transcript']:'';})[_0x701e('0x50')]('\x0a');_0x30c9bc=_0x58df58[_0x701e('0x4c')]['map'](function(_0x4896af){return _0x4896af&&_0x4896af[_0x701e('0x4e')][0x0]&&_0x4896af[_0x701e('0x4e')][0x0][_0x701e('0x51')]?_0x4896af[_0x701e('0x4e')][0x0][_0x701e('0x51')]:0x0;})[_0x701e('0x50')]('\x0a');}logger['info'](_0x701e('0x52'),_0x1e94b1);logger[_0x701e('0x1a')](_0x701e('0x53'),_0x30c9bc);return{'transcript':_0x1e94b1,'confidence':_0x30c9bc};})[_0x701e('0x54')](function(_0x111ecd){logger[_0x701e('0x14')](_0x701e('0x55'),_0x111ecd['statusCode'],_0x111ecd['name'],_0x111ecd['message']);});};exports[_0x701e('0x56')]=function(_0x4d9627,_0x22e726,_0xa8f55d,_0x3aebcf){var _0x4ea0ab=apiai(_0x22e726,{'language':_0x3aebcf||'en'});return _0x4ea0ab['textRequest'](_0xa8f55d,{'sessionId':md5(_0x4d9627)})[_0x701e('0x2c')](function(_0x2bfddd){logger[_0x701e('0x1a')](JSON[_0x701e('0x43')](_0x2bfddd));return{'source':_0x2bfddd['result']['source'],'resolvedQuery':_0x2bfddd[_0x701e('0x57')][_0x701e('0x58')],'action':_0x2bfddd[_0x701e('0x57')][_0x701e('0x59')],'actionIncomplete':_0x2bfddd[_0x701e('0x57')][_0x701e('0x5a')],'speech':_0x2bfddd[_0x701e('0x57')]['fulfillment'][_0x701e('0x5b')],'score':_0x2bfddd[_0x701e('0x57')][_0x701e('0x5c')],'statusCode':_0x2bfddd[_0x701e('0x5d')]['code'],'endConversation':_0x2bfddd[_0x701e('0x57')][_0x701e('0x5e')][_0x701e('0x5f')]||![],'isFallbackIntent':_0x2bfddd[_0x701e('0x57')]['metadata'][_0x701e('0x60')]};});};exports[_0x701e('0x61')]=function(_0x35dcd1,_0x4a1683,_0x60f628,_0x5f25c7,_0x247241,_0x5b8ab4){var _0x57d71e=_0x5f25c7[_0x701e('0x62')](/\\n/g,'\x0a');var _0x8ece76={'credentials':{'private_key':_0x57d71e,'client_email':_0x60f628}};var _0x4d4178=new dialogflow[(_0x701e('0x63'))](_0x8ece76);var _0x306726=_0x4d4178[_0x701e('0x64')](_0x4a1683,md5(_0x35dcd1));var _0x4fb43d={'session':_0x306726,'queryInput':{'text':{'text':_0x247241,'languageCode':_0x5b8ab4}}};return _0x4d4178['detectIntent'](_0x4fb43d)[_0x701e('0x2c')](function(_0x435c2a){if(_0x435c2a&&_0x435c2a[_0x701e('0x46')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x701e('0x43')](_0x435c2a));var _0x29123b=_0x435c2a[0x0];if(_0x29123b){var _0x11af53={'action':_0x29123b['queryResult'][_0x701e('0x59')],'allRequiredParamsPresent':_0x29123b[_0x701e('0x65')][_0x701e('0x66')],'endConversation':_0x29123b[_0x701e('0x65')][_0x701e('0x67')]&&_0x29123b[_0x701e('0x65')][_0x701e('0x67')][_0x701e('0x68')]?_0x29123b[_0x701e('0x65')][_0x701e('0x67')][_0x701e('0x68')][_0x701e('0x69')]['boolValue']:![],'fulfillmentText':_0x29123b[_0x701e('0x65')][_0x701e('0x6a')],'intentName':_0x29123b[_0x701e('0x65')][_0x701e('0x6b')]['name'],'intentDisplayName':_0x29123b[_0x701e('0x65')][_0x701e('0x6b')]['displayName'],'isFallbackIntent':_0x29123b[_0x701e('0x65')]['intent'][_0x701e('0x6c')],'languageCode':_0x29123b[_0x701e('0x65')][_0x701e('0x6d')],'queryText':_0x29123b['queryResult']['queryText'],'responseId':_0x29123b['responseId'],'score':_0x29123b[_0x701e('0x65')][_0x701e('0x6e')],'speech':_0x29123b[_0x701e('0x65')]['fulfillmentText'],'providerResponse':JSON[_0x701e('0x43')](_0x435c2a)};return _0x11af53;}}});};exports[_0x701e('0x6f')]=function(_0x275f56,_0x418be2,_0x280559,_0x4ec600){return tilde['asr'](_0x275f56,_0x418be2,_0x280559,_0x4ec600)['then'](function(_0x593b53){try{fs[_0x701e('0x1d')](_0x275f56);}catch(_0x57c03f){logger[_0x701e('0x14')](_0x57c03f);}logger[_0x701e('0x1a')](_0x701e('0x70'),_0x593b53[_0x701e('0x4f')]);logger[_0x701e('0x1a')](_0x701e('0x71'),_0x593b53['confidence']);return _0x593b53;});};exports['awsPolly']=function(_0x596c99,_0xaf1246,_0x55ac75,_0x1c6b05,_0x231f8e,_0x449369){var _0x332596=path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+_0x701e('0x38'));var _0x514245;return aws[_0x701e('0x72')](_0x596c99,_0xaf1246,_0x55ac75,_0x1c6b05,_0x231f8e,_0x449369,_0x332596)[_0x701e('0x2c')](function(){_0x514245=path['resolve'](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+_0x701e('0x2a'));return convertFile(_0x332596,_0x514245);})[_0x701e('0x2c')](function(){try{fs[_0x701e('0x1d')](_0x332596);fs[_0x701e('0x2d')](_0x514245,'777');}catch(_0xd8b36e){logger[_0x701e('0x14')](_0xd8b36e);}return _0x514245[_0x701e('0x3d')]('.')[0x0];});};exports['awsLex']=function(_0x5305c1,_0x3ad34f,_0x347dcc,_0x2e5326,_0x2d3b71,_0x163bbe){return aws[_0x701e('0x73')](_0x5305c1,_0x3ad34f,_0x347dcc,_0x2e5326,_0x2d3b71,_0x163bbe)['then'](function(_0x2545b9){logger[_0x701e('0x1a')](JSON[_0x701e('0x43')](_0x2545b9));return _0x2545b9;});};exports[_0x701e('0x74')]=function(_0x36aa71,_0x1b1822,_0x18dee7,_0x3ee668){var _0x50ac9e=util[_0x701e('0x75')](_0x701e('0x76'),ISPEECH_API,_0x36aa71,encodeURIComponent(_0x1b1822),_0x18dee7,_0x3ee668);var _0x3233af=path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+'.mp3');var _0x4040d2;return downloadFile(_0x50ac9e,_0x3233af)[_0x701e('0x2c')](function(){_0x4040d2=path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+_0x701e('0x2a'));return convertFile(_0x3233af,_0x4040d2);})[_0x701e('0x2c')](function(){try{fs[_0x701e('0x1d')](_0x3233af);fs['chmodSync'](_0x4040d2,'777');}catch(_0x50c169){logger[_0x701e('0x14')](_0x50c169);}return _0x4040d2['split']('.')[0x0];});};exports[_0x701e('0x77')]=function(_0x1300f0,_0x3b44f6,_0xdb7d64,_0x3a910){var _0x4ad736=util[_0x701e('0x75')](_0x701e('0x78'),ISPEECH_API,_0x3b44f6,_0xdb7d64,base64Encode(_0x1300f0),_0x3a910?util[_0x701e('0x75')]('model=%s',encodeURIComponent(_0x3a910)):_0x701e('0x79'));return uploadFile(_0x4ad736)['then'](function(_0x80b2a9){return querystring['parse'](_0x80b2a9);});};exports[_0x701e('0x7a')]=function(_0x437d88,_0x2a6aaf){return sestek[_0x701e('0x7b')](_0x437d88,_0x2a6aaf)[_0x701e('0x2c')](function(_0x374218){logger[_0x701e('0x1a')](JSON[_0x701e('0x43')](_0x374218));var _0x4d4cb0={'speech':_0x374218['text'],'action':_0x374218[_0x701e('0x7c')]?_0x374218[_0x701e('0x7c')][_0x701e('0x7d')]:undefined,'actiondata':_0x374218[_0x701e('0x7c')]?_0x374218[_0x701e('0x7c')][_0x701e('0x7e')]:undefined};if(_0x374218[_0x701e('0x7c')]&&_0x374218[_0x701e('0x7c')][_0x701e('0x7f')]){return base64Decode(_0x374218[_0x701e('0x7c')][_0x701e('0x7f')]['Data'],path[_0x701e('0x37')](__dirname,_0x701e('0x28'),rs[_0x701e('0x29')](0x4)+_0x701e('0x2a')))[_0x701e('0x2c')](function(_0x43e3ee){_0x4d4cb0[_0x701e('0x80')]=_0x43e3ee;return _0x4d4cb0;});}return _0x4d4cb0;});};exports[_0x701e('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x1d96=['text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','randomstring','google-tts-api','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','host','request\x20to\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','.mp3','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda'];(function(_0x6a5e0c,_0x1101fc){var _0xfc86b9=function(_0x20cde7){while(--_0x20cde7){_0x6a5e0c['push'](_0x6a5e0c['shift']());}};_0xfc86b9(++_0x1101fc);}(_0x1d96,0x121));var _0x61d9=function(_0x55240a,_0x40917c){_0x55240a=_0x55240a-0x0;var _0x56b115=_0x1d96[_0x55240a];return _0x56b115;};'use strict';var apiai=require(_0x61d9('0x0'));var BPromise=require(_0x61d9('0x1'));var dialogflow=require(_0x61d9('0x2'));var fs=require('fs');var http=require(_0x61d9('0x3'));var https=require(_0x61d9('0x4'));var md5=require(_0x61d9('0x5'));var path=require(_0x61d9('0x6'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x61d9('0x7'));var sox=require('sox');var tts=require(_0x61d9('0x8'));var urlParse=require('url')['parse'];var util=require(_0x61d9('0x9'));var aws=require(_0x61d9('0xa'));var google=require(_0x61d9('0xb'));var sestek=require(_0x61d9('0xc'));var tilde=require(_0x61d9('0xd'));var logger=require(_0x61d9('0xe'))(_0x61d9('0xf'));var ISPEECH_API=_0x61d9('0x10');function downloadFile(_0x681357,_0x4ff92e){return new BPromise(function(_0x3db60d,_0x475d86){var _0x43de02=urlParse(_0x681357);var _0x357b21=_0x43de02[_0x61d9('0x11')]===_0x61d9('0x12')?https:http;var _0xb5afc6={'host':_0x43de02['host'],'path':_0x43de02[_0x61d9('0x6')],'headers':{'user-agent':_0x61d9('0x13')}};_0x357b21[_0x61d9('0x14')](_0xb5afc6,function(_0x3c1259){if(_0x3c1259['statusCode']!==0xc8){logger[_0x61d9('0x15')]('request\x20to\x20'+_0x681357+_0x61d9('0x16')+_0x3c1259[_0x61d9('0x17')]+'\x20('+_0x3c1259['statusMessage']+')');_0x475d86(new Error('request\x20to\x20'+_0x681357+_0x61d9('0x16')+_0x3c1259[_0x61d9('0x17')]+'\x20('+_0x3c1259[_0x61d9('0x18')]+')'));return;}var _0x25aec=fs[_0x61d9('0x19')](_0x4ff92e);_0x25aec['on'](_0x61d9('0x1a'),function(){logger[_0x61d9('0x1b')](_0x61d9('0x1c'));_0x25aec[_0x61d9('0x1d')](_0x3db60d);});_0x25aec['on']('error',function(_0x2e6e40){fs[_0x61d9('0x1e')](_0x4ff92e);logger['error'](_0x61d9('0x1f'),_0x2e6e40);_0x475d86(_0x2e6e40);});_0x3c1259['pipe'](_0x25aec);})['on'](_0x61d9('0x15'),function(_0x141568){logger[_0x61d9('0x15')](_0x141568);_0x475d86(_0x141568);})[_0x61d9('0x20')]();});}function uploadFile(_0x470eb2){return new BPromise(function(_0x13430b,_0x25a9a0){var _0x18ba70=urlParse(_0x470eb2);var _0x1fde54=_0x18ba70['protocol']===_0x61d9('0x12')?https:http;var _0xe6ede9={'host':_0x18ba70[_0x61d9('0x21')],'path':_0x18ba70[_0x61d9('0x6')],'headers':{'user-agent':_0x61d9('0x13')}};_0x1fde54['get'](_0xe6ede9,function(_0x503ed6){if(_0x503ed6[_0x61d9('0x17')]!==0xc8){_0x25a9a0(new Error(_0x61d9('0x22')+_0x470eb2+_0x61d9('0x16')+_0x503ed6[_0x61d9('0x17')]+'\x20('+_0x503ed6[_0x61d9('0x18')]+')'));return;}var _0x5e6ca7='';_0x503ed6['on'](_0x61d9('0x23'),function(_0x4d1964){_0x5e6ca7+=_0x4d1964;});_0x503ed6['on'](_0x61d9('0x20'),function(){_0x13430b(_0x5e6ca7);});})['on'](_0x61d9('0x15'),function(_0x948f6c){_0x25a9a0(_0x948f6c);})[_0x61d9('0x20')]();});}function convertFile(_0xdf8daa,_0xea4773){return new BPromise(function(_0x125140,_0x58053f){var _0x56be4d=sox[_0x61d9('0x24')](_0xdf8daa,_0xea4773,{'sampleRate':0x1f40,'format':_0x61d9('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56be4d['on'](_0x61d9('0x15'),function(_0x3986f2){logger[_0x61d9('0x15')](_0x61d9('0x26'),_0x3986f2);_0x58053f(_0x3986f2);});_0x56be4d['on'](_0x61d9('0x20'),function(){logger['info'](_0x61d9('0x27'));_0x125140();});_0x56be4d[_0x61d9('0x28')]();});}function base64Decode(_0x3d1d5a,_0x570fd2){var _0x6346d6=path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+_0x61d9('0x2c'));fs[_0x61d9('0x2d')](_0x6346d6,_0x3d1d5a,_0x61d9('0x2e'));return convertFile(_0x6346d6,_0x570fd2)[_0x61d9('0x2f')](function(){try{fs[_0x61d9('0x1e')](_0x6346d6);fs[_0x61d9('0x30')](_0x570fd2,_0x61d9('0x31'));}catch(_0xa2429f){logger[_0x61d9('0x15')](_0xa2429f);}return _0x570fd2[_0x61d9('0x32')]('.')[0x0];});}function base64Encode(_0x32ae50){var _0x185319=fs[_0x61d9('0x33')](_0x32ae50);return new Buffer(_0x185319)[_0x61d9('0x34')](_0x61d9('0x2e'));}exports[_0x61d9('0x35')]=function(_0x1f98ec,_0x291b10,_0x583c4a,_0x4b562b,_0x27789b,_0x3bbe5f){var _0x50e975,_0x4e182b;var _0x297b21=_0x61d9('0x36');var _0x1fba2a=_0x61d9('0x37')+_0x1f98ec;var _0x561a8e={};if(_0x291b10===_0x61d9('0x38')){_0x561a8e[_0x61d9('0x39')]={'ssml':_0x583c4a};}else{_0x561a8e[_0x61d9('0x39')]={'text':_0x583c4a};};_0x561a8e[_0x61d9('0x3a')]={'languageCode':_0x4b562b,'ssmlGender':_0x27789b};_0x561a8e['audioConfig']={'audioEncoding':_0x61d9('0x3b'),'sampleRateHertz':0x1f40};var _0x135ed1={'url':_0x297b21+'text:synthesize'+_0x1fba2a,'method':_0x61d9('0x3c'),'json':!![],'body':_0x561a8e};return rp(_0x135ed1)[_0x61d9('0x2f')](function(_0x3d1736){return new BPromise(function(_0xe894ee,_0x23a0f3){_0x50e975=path['resolve'](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+_0x61d9('0x3d'));var _0x3ddbb9=Buffer['from'](_0x3d1736[_0x61d9('0x3e')],_0x61d9('0x2e'));return fs['writeFile'](_0x50e975,_0x3ddbb9,function(_0x18cd00){_0x23a0f3(_0x18cd00);},function(_0x16d512){fs[_0x61d9('0x30')](_0x50e975,'777');_0xe894ee(_0x16d512);});});})[_0x61d9('0x2f')](function(_0xf04fcb){_0x4e182b=path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+'.wav');return convertFile(_0x50e975,_0x4e182b);})[_0x61d9('0x2f')](function(){try{fs[_0x61d9('0x1e')](_0x50e975);fs[_0x61d9('0x30')](_0x4e182b,_0x61d9('0x31'));}catch(_0x53f453){logger[_0x61d9('0x15')](_0x53f453);}logger[_0x61d9('0x1b')](_0x61d9('0x3f'),_0x4e182b['split']('.')[0x0]);return _0x4e182b[_0x61d9('0x32')]('.')[0x0];});};exports[_0x61d9('0x40')]=function(_0x13e039,_0x3e1a08){var _0x5073e9=_0x61d9('0x41');var _0x46c9d8,_0xaec540;var _0x4a604b;var _0x4ea5fd={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x5073e9,'headers':{'Content-Type':_0x61d9('0x42')},'body':_0x61d9('0x43')+encodeURIComponent(JSON[_0x61d9('0x44')]([[[_0x61d9('0x45'),JSON['stringify']([_0x13e039,_0x3e1a08||'en',![],_0x61d9('0x46')]),null,_0x61d9('0x47')]]]))};return rp(_0x4ea5fd)[_0x61d9('0x2f')](function(_0x437c75){try{_0x4a604b=eval(_0x437c75[_0x61d9('0x48')](0x5))[0x0][0x2];}catch(_0x1a41b2){throw new Error('parse\x20response\x20failed:\x0a'+_0x437c75[_0x61d9('0x23')]);}if(!_0x4a604b){if(_0x13e039[_0x61d9('0x49')]>0xc8){throw new Error(_0x61d9('0x4a'));}else{throw new Error(_0x61d9('0x4b')+_0x3e1a08+_0x61d9('0x4c'));}}try{_0x4a604b=eval(_0x4a604b)[0x0];}catch(_0xd82c25){throw new Error(_0x61d9('0x4d')+res[_0x61d9('0x23')]);}const _0x519440=_0x4a604b;_0x46c9d8=path['resolve'](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+_0x61d9('0x3d'));fs[_0x61d9('0x2d')](_0x46c9d8,_0x4a604b,{'encoding':'base64'});_0xaec540=path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs['generate'](0x4)+_0x61d9('0x2c'));return convertFile(_0x46c9d8,_0xaec540);})[_0x61d9('0x2f')](function(){try{fs['unlink'](_0x46c9d8);fs['chmodSync'](_0xaec540,_0x61d9('0x31'));}catch(_0x153bf1){logger[_0x61d9('0x15')](_0x153bf1);}logger[_0x61d9('0x1b')](_0x61d9('0x4e'),_0xaec540[_0x61d9('0x32')]('.')[0x0]);return _0xaec540[_0x61d9('0x32')]('.')[0x0];});};exports['googleASR']=function(_0xfb52a3,_0x165501,_0x923205){return google[_0x61d9('0x4f')](_0xfb52a3,_0x165501,_0x923205)[_0x61d9('0x2f')](function(_0x5e1b0d){logger[_0x61d9('0x1b')](_0x5e1b0d[_0x61d9('0x50')]);return rp(_0x5e1b0d);})[_0x61d9('0x2f')](function(_0x34cf85){var _0x4fef43='';var _0x4ac875=0x0;try{fs['unlink'](_0xfb52a3);}catch(_0x1b8ee5){logger[_0x61d9('0x15')](_0x1b8ee5);}if(_0x34cf85&&_0x34cf85[_0x61d9('0x51')]){_0x4fef43=_0x34cf85[_0x61d9('0x51')][_0x61d9('0x52')](function(_0x45e63e){return _0x45e63e&&_0x45e63e[_0x61d9('0x53')][0x0]&&_0x45e63e['alternatives'][0x0][_0x61d9('0x54')]?_0x45e63e[_0x61d9('0x53')][0x0][_0x61d9('0x54')]:'';})['join']('\x0a');_0x4ac875=_0x34cf85[_0x61d9('0x51')][_0x61d9('0x52')](function(_0x8e5f3f){return _0x8e5f3f&&_0x8e5f3f[_0x61d9('0x53')][0x0]&&_0x8e5f3f[_0x61d9('0x53')][0x0][_0x61d9('0x55')]?_0x8e5f3f[_0x61d9('0x53')][0x0][_0x61d9('0x55')]:0x0;})[_0x61d9('0x56')]('\x0a');}logger['info'](_0x61d9('0x57'),_0x4fef43);logger[_0x61d9('0x1b')](_0x61d9('0x58'),_0x4ac875);return{'transcript':_0x4fef43,'confidence':_0x4ac875};})[_0x61d9('0x59')](function(_0x14c43c){logger['error'](_0x61d9('0x5a'),_0x14c43c[_0x61d9('0x17')],_0x14c43c['name'],_0x14c43c[_0x61d9('0x5b')]);});};exports[_0x61d9('0x5c')]=function(_0x4c5ccc,_0x35b5e3,_0x1628f0,_0x222582){var _0x553c85=apiai(_0x35b5e3,{'language':_0x222582||'en'});return _0x553c85[_0x61d9('0x5d')](_0x1628f0,{'sessionId':md5(_0x4c5ccc)})[_0x61d9('0x2f')](function(_0x4dedaa){logger['info'](JSON[_0x61d9('0x44')](_0x4dedaa));return{'source':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x5f')],'resolvedQuery':_0x4dedaa[_0x61d9('0x5e')]['resolvedQuery'],'action':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x60')],'actionIncomplete':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x61')],'speech':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x62')]['speech'],'score':_0x4dedaa['result']['score'],'statusCode':_0x4dedaa[_0x61d9('0x63')][_0x61d9('0x64')],'endConversation':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x65')]['endConversation']||![],'isFallbackIntent':_0x4dedaa[_0x61d9('0x5e')][_0x61d9('0x65')][_0x61d9('0x66')]};});};exports[_0x61d9('0x67')]=function(_0x3d4c3a,_0xe09c2,_0x2cae15,_0x83c55e,_0x177552,_0x39a6cb){var _0xe69fb4=_0x83c55e[_0x61d9('0x68')](/\\n/g,'\x0a');var _0x263a6a={'credentials':{'private_key':_0xe69fb4,'client_email':_0x2cae15}};var _0x36eeb1=new dialogflow['SessionsClient'](_0x263a6a);var _0x57c0a7=_0x36eeb1['sessionPath'](_0xe09c2,md5(_0x3d4c3a));var _0x4378c7={'session':_0x57c0a7,'queryInput':{'text':{'text':_0x177552,'languageCode':_0x39a6cb}}};return _0x36eeb1[_0x61d9('0x69')](_0x4378c7)['then'](function(_0x1b185b){if(_0x1b185b&&_0x1b185b[_0x61d9('0x49')]){logger[_0x61d9('0x1b')](_0x61d9('0x6a'),JSON[_0x61d9('0x44')](_0x1b185b));var _0x1371fd=_0x1b185b[0x0];if(_0x1371fd){var _0x2a94b8={'action':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x60')],'allRequiredParamsPresent':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x6c')],'endConversation':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x6d')]&&_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x6d')][_0x61d9('0x6e')]?_0x1371fd[_0x61d9('0x6b')]['diagnosticInfo'][_0x61d9('0x6e')][_0x61d9('0x6f')][_0x61d9('0x70')]:![],'fulfillmentText':_0x1371fd['queryResult'][_0x61d9('0x71')],'intentName':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x72')]['name'],'intentDisplayName':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x72')]['displayName'],'isFallbackIntent':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x72')][_0x61d9('0x73')],'languageCode':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x74')],'queryText':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x75')],'responseId':_0x1371fd[_0x61d9('0x76')],'score':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x77')],'speech':_0x1371fd[_0x61d9('0x6b')][_0x61d9('0x71')],'providerResponse':JSON['stringify'](_0x1b185b)};return _0x2a94b8;}}});};exports['tildeASR']=function(_0x2ebd03,_0x8d2a1f,_0x4353d9,_0x220e5c){return tilde[_0x61d9('0x4f')](_0x2ebd03,_0x8d2a1f,_0x4353d9,_0x220e5c)[_0x61d9('0x2f')](function(_0x56a155){try{fs['unlink'](_0x2ebd03);}catch(_0x34fa40){logger['error'](_0x34fa40);}logger['info'](_0x61d9('0x78'),_0x56a155[_0x61d9('0x54')]);logger[_0x61d9('0x1b')](_0x61d9('0x79'),_0x56a155[_0x61d9('0x55')]);return _0x56a155;});};exports[_0x61d9('0x7a')]=function(_0x1cd920,_0x751c47,_0x2d2092,_0x63c171,_0x22cd9b,_0x2ee172){var _0x2640e7=path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+'.mp3');var _0x182c81;return aws[_0x61d9('0x7b')](_0x1cd920,_0x751c47,_0x2d2092,_0x63c171,_0x22cd9b,_0x2ee172,_0x2640e7)['then'](function(){_0x182c81=path['resolve'](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+'.wav');return convertFile(_0x2640e7,_0x182c81);})[_0x61d9('0x2f')](function(){try{fs[_0x61d9('0x1e')](_0x2640e7);fs[_0x61d9('0x30')](_0x182c81,_0x61d9('0x31'));}catch(_0x52dc6b){logger[_0x61d9('0x15')](_0x52dc6b);}return _0x182c81[_0x61d9('0x32')]('.')[0x0];});};exports[_0x61d9('0x7c')]=function(_0x342adc,_0xf80fe2,_0xd9818a,_0x44723d,_0x1d86ff,_0x2c8773){return aws[_0x61d9('0x7d')](_0x342adc,_0xf80fe2,_0xd9818a,_0x44723d,_0x1d86ff,_0x2c8773)[_0x61d9('0x2f')](function(_0xb1f136){logger[_0x61d9('0x1b')](JSON[_0x61d9('0x44')](_0xb1f136));return _0xb1f136;});};exports[_0x61d9('0x7e')]=function(_0x2957b3,_0x17e7d6,_0x398f61,_0x5c1ffe){var _0x1c046d=util[_0x61d9('0x7f')](_0x61d9('0x80'),ISPEECH_API,_0x2957b3,encodeURIComponent(_0x17e7d6),_0x398f61,_0x5c1ffe);var _0x33765c=path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+'.mp3');var _0x3f9ea0;return downloadFile(_0x1c046d,_0x33765c)[_0x61d9('0x2f')](function(){_0x3f9ea0=path[_0x61d9('0x29')](__dirname,'tmp',rs[_0x61d9('0x2b')](0x4)+'.wav');return convertFile(_0x33765c,_0x3f9ea0);})['then'](function(){try{fs[_0x61d9('0x1e')](_0x33765c);fs[_0x61d9('0x30')](_0x3f9ea0,_0x61d9('0x31'));}catch(_0x4be44f){logger['error'](_0x4be44f);}return _0x3f9ea0[_0x61d9('0x32')]('.')[0x0];});};exports[_0x61d9('0x81')]=function(_0x2b980b,_0x3d7abe,_0x289f73,_0x4c41f1){var _0x5f7ac7=util[_0x61d9('0x7f')](_0x61d9('0x82'),ISPEECH_API,_0x3d7abe,_0x289f73,base64Encode(_0x2b980b),_0x4c41f1?util[_0x61d9('0x7f')]('model=%s',encodeURIComponent(_0x4c41f1)):_0x61d9('0x83'));return uploadFile(_0x5f7ac7)[_0x61d9('0x2f')](function(_0x141efa){return querystring['parse'](_0x141efa);});};exports[_0x61d9('0x84')]=function(_0xb2a12,_0x39388b){return sestek[_0x61d9('0x85')](_0xb2a12,_0x39388b)[_0x61d9('0x2f')](function(_0x2683c1){logger[_0x61d9('0x1b')](JSON['stringify'](_0x2683c1));var _0xd7f1f9={'speech':_0x2683c1[_0x61d9('0x86')],'action':_0x2683c1[_0x61d9('0x87')]?_0x2683c1[_0x61d9('0x87')][_0x61d9('0x88')]:undefined,'actiondata':_0x2683c1[_0x61d9('0x87')]?_0x2683c1[_0x61d9('0x87')]['CustomActionData']:undefined};if(_0x2683c1[_0x61d9('0x87')]&&_0x2683c1[_0x61d9('0x87')][_0x61d9('0x89')]){return base64Decode(_0x2683c1[_0x61d9('0x87')][_0x61d9('0x89')][_0x61d9('0x8a')],path[_0x61d9('0x29')](__dirname,_0x61d9('0x2a'),rs[_0x61d9('0x2b')](0x4)+_0x61d9('0x2c')))[_0x61d9('0x2f')](function(_0x15355b){_0xd7f1f9[_0x61d9('0x8b')]=_0x15355b;return _0xd7f1f9;});}return _0xd7f1f9;});};exports[_0x61d9('0x8c')]=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 177f71c..4041766 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 _0x0d8e=['exports','./nda'];(function(_0x2929ba,_0x506aa6){var _0x365e6e=function(_0x206fd3){while(--_0x206fd3){_0x2929ba['push'](_0x2929ba['shift']());}};_0x365e6e(++_0x506aa6);}(_0x0d8e,0x16f));var _0xe0d8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0d8e[_0x4a9fb1];return _0x348672;};var nda=require(_0xe0d8('0x0'));module[_0xe0d8('0x1')]={'nda':nda}; \ No newline at end of file +var _0x249c=['./nda'];(function(_0x413d83,_0x487390){var _0xe15e65=function(_0x3ce0ee){while(--_0x3ce0ee){_0x413d83['push'](_0x413d83['shift']());}};_0xe15e65(++_0x487390);}(_0x249c,0x19f));var _0xc249=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x249c[_0x5f3de3];return _0x287e0d;};var nda=require(_0xc249('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 662ebac..394df02 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 _0xffe1=['resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','custom_action','CustomActionData','custom_action_data','request-promise','url','exports','POST'];(function(_0x594ac2,_0xaa7274){var _0x4fb04c=function(_0x5f03aa){while(--_0x5f03aa){_0x594ac2['push'](_0x594ac2['shift']());}};_0x4fb04c(++_0xaa7274);}(_0xffe1,0x175));var _0x1ffe=function(_0x5b7827,_0x3b0cb1){_0x5b7827=_0x5b7827-0x0;var _0x1a0847=_0xffe1[_0x5b7827];return _0x1a0847;};'use strict';var rp=require(_0x1ffe('0x0'));var url=require(_0x1ffe('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x1ffe('0x2')]=function(_0x100207,_0x38121){var _0x4d13c2={'method':_0x1ffe('0x3'),'uri':url[_0x1ffe('0x4')](_0x38121[_0x1ffe('0x5')],'/token'),'form':{'grant_type':_0x1ffe('0x6'),'username':_0x38121[_0x1ffe('0x7')],'password':_0x38121[_0x1ffe('0x6')]},'json':!![]};return rp(_0x4d13c2)[_0x1ffe('0x8')](function(_0xb34112){var _0x8eee2b={'method':'POST','uri':url['resolve'](_0x38121[_0x1ffe('0x9')],_0x1ffe('0xa')),'body':{'type':_0x38121[_0x1ffe('0xb')]||_0x1ffe('0xc'),'channelId':'Nda','conversation':{'id':_0x100207[_0x1ffe('0xd')]},'from':{'id':_0x100207[_0x1ffe('0xe')],'name':_0x100207[_0x1ffe('0xf')]},'recipient':{'id':_0x100207[_0x1ffe('0x10')],'name':_0x100207[_0x1ffe('0x11')]},'text':_0x38121[_0x1ffe('0x12')],'channelData':{}},'headers':{'Authorization':_0x1ffe('0x13')+_0xb34112[_0x1ffe('0x14')]},'json':!![]};if(_0x38121['project']){_0x8eee2b[_0x1ffe('0x15')][_0x1ffe('0x16')]['ProjectName']=_0x38121[_0x1ffe('0x17')];}if(_0x38121[_0x1ffe('0x18')]=='1'){_0x8eee2b[_0x1ffe('0x15')][_0x1ffe('0x16')][_0x1ffe('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x38121[_0x1ffe('0x1a')]){_0x8eee2b[_0x1ffe('0x15')][_0x1ffe('0x16')]['CustomAction']=_0x38121[_0x1ffe('0x1a')];if(_0x38121['custom_action_data']){_0x8eee2b[_0x1ffe('0x15')]['channelData'][_0x1ffe('0x1b')]=_0x38121[_0x1ffe('0x1c')];}}logger['info'](JSON['stringify'](_0x8eee2b));return rp(_0x8eee2b);});}; \ No newline at end of file +var _0xdf79=['dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','../../../../../config/logger','agi','exports','/token','password','username','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid'];(function(_0x57203d,_0x1aefbf){var _0x184239=function(_0x3643be){while(--_0x3643be){_0x57203d['push'](_0x57203d['shift']());}};_0x184239(++_0x1aefbf);}(_0xdf79,0xa7));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x9df7('0x0'))(_0x9df7('0x1'));module[_0x9df7('0x2')]=function(_0x2450f8,_0x2fbdd5){var _0x5251ba={'method':'POST','uri':url['resolve'](_0x2fbdd5['ndauth_url'],_0x9df7('0x3')),'form':{'grant_type':_0x9df7('0x4'),'username':_0x2fbdd5[_0x9df7('0x5')],'password':_0x2fbdd5[_0x9df7('0x4')]},'json':!![]};return rp(_0x5251ba)['then'](function(_0x21d177){var _0x4cc7d5={'method':_0x9df7('0x6'),'uri':url['resolve'](_0x2fbdd5[_0x9df7('0x7')],_0x9df7('0x8')),'body':{'type':_0x2fbdd5[_0x9df7('0x9')]||'message','channelId':_0x9df7('0xa'),'conversation':{'id':_0x2450f8[_0x9df7('0xb')]},'from':{'id':_0x2450f8[_0x9df7('0xc')],'name':_0x2450f8['calleridname']},'recipient':{'id':_0x2450f8[_0x9df7('0xd')],'name':_0x2450f8[_0x9df7('0xe')]},'text':_0x2fbdd5[_0x9df7('0xf')],'channelData':{}},'headers':{'Authorization':_0x9df7('0x10')+_0x21d177[_0x9df7('0x11')]},'json':!![]};if(_0x2fbdd5[_0x9df7('0x12')]){_0x4cc7d5[_0x9df7('0x13')][_0x9df7('0x14')][_0x9df7('0x15')]=_0x2fbdd5[_0x9df7('0x12')];}if(_0x2fbdd5[_0x9df7('0x16')]=='1'){_0x4cc7d5[_0x9df7('0x13')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9df7('0x17')};}if(_0x2fbdd5[_0x9df7('0x18')]){_0x4cc7d5[_0x9df7('0x13')]['channelData'][_0x9df7('0x19')]=_0x2fbdd5['custom_action'];if(_0x2fbdd5['custom_action_data']){_0x4cc7d5['body'][_0x9df7('0x14')][_0x9df7('0x1a')]=_0x2fbdd5[_0x9df7('0x1b')];}}logger[_0x9df7('0x1c')](JSON[_0x9df7('0x1d')](_0x4cc7d5));return rp(_0x4cc7d5);});}; \ 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 0f6081c..cca6460 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 _0xaffb=['exports'];(function(_0x2f626e,_0x4e8b7d){var _0x3c4bac=function(_0x36b18d){while(--_0x36b18d){_0x2f626e['push'](_0x2f626e['shift']());}};_0x3c4bac(++_0x4e8b7d);}(_0xaffb,0x149));var _0xbaff=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xaffb[_0x30c2ae];return _0x1ee1cc;};'use strict';var asr=require('./lib/api');module[_0xbaff('0x0')]=function(_0x3aaac9,_0x2e24b0,_0x5259da,_0x483ce7){return asr(_0x3aaac9,_0x2e24b0,_0x5259da,_0x483ce7);}; \ No newline at end of file +var _0x98c6=['exports','./lib/api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x98c6,0xe1));var _0x698c=function(_0x5464ec,_0x8c8f92){_0x5464ec=_0x5464ec-0x0;var _0x5f704b=_0x98c6[_0x5464ec];return _0x5f704b;};'use strict';var asr=require(_0x698c('0x0'));module[_0x698c('0x1')]=function(_0x111cd3,_0x59a45a,_0x48ae73,_0x33b453){return asr(_0x111cd3,_0x59a45a,_0x48ae73,_0x33b453);}; \ 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 53124a6..0e9d8fa 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 _0xe093=['hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','open','message','bluebird','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xe093,0x126));var _0x3e09=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe093[_0x1f9f37];return _0x21c080;};'use strict';var BPromise=require(_0x3e09('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3e09('0x1'));var logger=require(_0x3e09('0x2'))('agi');module[_0x3e09('0x3')]=function(_0x586c24,_0x1290e6,_0x3883c0,_0x4fbba9){return new BPromise(function(_0x12c913,_0x169120){logger[_0x3e09('0x4')](_0x3e09('0x5'),_0x4fbba9||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x21427b=new WebSocket(_0x4fbba9||_0x3e09('0x6'),{'perMessageDeflate':![]});var _0x383a01='';var _0x5542e5='0';var _0x2d0748='1';var _0x33a2f0=_0x3e09('0x7');function _0x501b58(_0x2798de){var _0x401f37=crypto[_0x3e09('0x8')]('sha1');_0x401f37[_0x3e09('0x9')](_0x2798de);return _0x401f37['digest'](_0x3e09('0xa'));}function _0x4641fd(){try{logger['info'](_0x3e09('0xb'));var _0x1db7bb=moment()[_0x3e09('0xc')]();var _0x310270=_0x501b58(_0x1db7bb+_0x1290e6+_0x3883c0);_0x21427b[_0x3e09('0xd')](JSON[_0x3e09('0xe')]({'appID':_0x1290e6,'timestamp':_0x1db7bb,'appKey':_0x310270}));var _0x5b626c=fs[_0x3e09('0xf')](_0x586c24);_0x5b626c['on'](_0x3e09('0x10'),function(_0x4e9a7e){_0x21427b[_0x3e09('0xd')](_0x4e9a7e);});_0x5b626c['on'](_0x3e09('0x11'),function(){_0x21427b[_0x3e09('0xd')]('EOS');});}catch(_0x18912c){logger[_0x3e09('0x12')](_0x3e09('0x13'),JSON[_0x3e09('0xe')](_0x18912c));_0x21427b[_0x3e09('0x14')]();}}function _0x5949f3(_0x3a4b34){try{if(_0x3a4b34){var _0x3f668b=JSON[_0x3e09('0x15')](_0x3a4b34);switch(_0x3f668b[_0x3e09('0x16')]){case 0x0:if(_0x3f668b['result']){if(_0x3f668b[_0x3e09('0x17')][_0x3e09('0x18')]){logger['info'](_0x3e09('0x19'),JSON[_0x3e09('0xe')](_0x3f668b[_0x3e09('0x17')][_0x3e09('0x1a')]));_0x383a01=_0x3f668b['result'][_0x3e09('0x1a')][0x0][_0x3e09('0x1b')];_0x5542e5=_0x3f668b[_0x3e09('0x17')]['hypotheses'][0x0][_0x3e09('0x1c')];_0x2d0748='0';_0x33a2f0=_0x3e09('0x1d');_0x21427b[_0x3e09('0x14')]();}}break;case 0x1:logger[_0x3e09('0x4')](_0x3e09('0x7'));_0x2d0748='1';_0x33a2f0=_0x3e09('0x7');break;case 0x2:logger[_0x3e09('0x4')](_0x3e09('0x1e'));_0x2d0748='2';_0x33a2f0=_0x3e09('0x1e');break;case 0x9:logger[_0x3e09('0x4')](_0x3e09('0x1f'));_0x2d0748='9';_0x33a2f0='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x3e09('0x4')](_0x3e09('0x20'));_0x2d0748='10';_0x33a2f0=_0x3e09('0x20');break;case 0xb:logger[_0x3e09('0x4')](_0x3e09('0x21'));_0x2d0748='11';_0x33a2f0=_0x3e09('0x21');}}}catch(_0x565aa2){logger[_0x3e09('0x12')](_0x3e09('0x22'),JSON['stringify'](_0x565aa2));_0x21427b[_0x3e09('0x14')]();}}function _0x3378f7(){logger[_0x3e09('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x12c913({'transcript':_0x383a01,'confidence':_0x5542e5,'status':_0x2d0748,'status_message':_0x33a2f0});}function _0x909156(_0x1791c3){logger[_0x3e09('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3e09('0x23')](_0x1791c3)){logger[_0x3e09('0x12')](_['isObject'](_0x1791c3)?JSON['stringify'](_0x1791c3):_0x1791c3);}}_0x21427b['on'](_0x3e09('0x24'),_0x4641fd);_0x21427b['on'](_0x3e09('0x25'),_0x5949f3);_0x21427b['on'](_0x3e09('0x11'),_0x3378f7);_0x21427b['on'](_0x3e09('0x12'),_0x909156);});}; \ No newline at end of file +var _0x5fe7=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','lodash','moment','crypto','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','createReadStream','data','send','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','final'];(function(_0x6a23aa,_0x3797ab){var _0x5ad153=function(_0xee6112){while(--_0xee6112){_0x6a23aa['push'](_0x6a23aa['shift']());}};_0x5ad153(++_0x3797ab);}(_0x5fe7,0xa8));var _0x75fe=function(_0x20e492,_0x2be336){_0x20e492=_0x20e492-0x0;var _0x3b895b=_0x5fe7[_0x20e492];return _0x3b895b;};'use strict';var BPromise=require('bluebird');var _=require(_0x75fe('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x75fe('0x1'));var crypto=require(_0x75fe('0x2'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x177ac1,_0x29647c,_0x4f46d6,_0x5aa679){return new BPromise(function(_0x2df435,_0x131305){logger['info']('Tilde\x20URI',_0x5aa679||_0x75fe('0x3'));var _0x11bf61=new WebSocket(_0x5aa679||_0x75fe('0x3'),{'perMessageDeflate':![]});var _0x4967da='';var _0x28056e='0';var _0x288a76='1';var _0xfa2f67=_0x75fe('0x4');function _0x4691ab(_0x411a74){var _0x246d36=crypto[_0x75fe('0x5')](_0x75fe('0x6'));_0x246d36[_0x75fe('0x7')](_0x411a74);return _0x246d36[_0x75fe('0x8')](_0x75fe('0x9'));}function _0xb6b0e6(){try{logger[_0x75fe('0xa')]('Open\x20Tilde\x20ASR\x20socket');var _0x4629fd=moment()['unix']();var _0x49dfd2=_0x4691ab(_0x4629fd+_0x29647c+_0x4f46d6);_0x11bf61['send'](JSON['stringify']({'appID':_0x29647c,'timestamp':_0x4629fd,'appKey':_0x49dfd2}));var _0x539ea1=fs[_0x75fe('0xb')](_0x177ac1);_0x539ea1['on'](_0x75fe('0xc'),function(_0x2b5ad0){_0x11bf61['send'](_0x2b5ad0);});_0x539ea1['on']('close',function(){_0x11bf61[_0x75fe('0xd')](_0x75fe('0xe'));});}catch(_0x5dd916){logger[_0x75fe('0xf')](_0x75fe('0x10'),JSON[_0x75fe('0x11')](_0x5dd916));_0x11bf61['terminate']();}}function _0x470bc0(_0x4fc010){try{if(_0x4fc010){var _0x46ab0b=JSON[_0x75fe('0x12')](_0x4fc010);switch(_0x46ab0b[_0x75fe('0x13')]){case 0x0:if(_0x46ab0b[_0x75fe('0x14')]){if(_0x46ab0b['result'][_0x75fe('0x15')]){logger[_0x75fe('0xa')](_0x75fe('0x16'),JSON['stringify'](_0x46ab0b[_0x75fe('0x14')][_0x75fe('0x17')]));_0x4967da=_0x46ab0b[_0x75fe('0x14')][_0x75fe('0x17')][0x0][_0x75fe('0x18')];_0x28056e=_0x46ab0b[_0x75fe('0x14')]['hypotheses'][0x0][_0x75fe('0x19')];_0x288a76='0';_0xfa2f67=_0x75fe('0x1a');_0x11bf61['terminate']();}}break;case 0x1:logger[_0x75fe('0xa')](_0x75fe('0x4'));_0x288a76='1';_0xfa2f67=_0x75fe('0x4');break;case 0x2:logger[_0x75fe('0xa')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x288a76='2';_0xfa2f67=_0x75fe('0x1b');break;case 0x9:logger['info'](_0x75fe('0x1c'));_0x288a76='9';_0xfa2f67=_0x75fe('0x1c');break;case 0xa:logger['info'](_0x75fe('0x1d'));_0x288a76='10';_0xfa2f67='Authentication\x20failed.';break;case 0xb:logger[_0x75fe('0xa')](_0x75fe('0x1e'));_0x288a76='11';_0xfa2f67=_0x75fe('0x1e');}}}catch(_0x4d72d6){logger[_0x75fe('0xf')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x75fe('0x11')](_0x4d72d6));_0x11bf61[_0x75fe('0x1f')]();}}function _0xd77448(){logger['info'](_0x75fe('0x20'));_0x2df435({'transcript':_0x4967da,'confidence':_0x28056e,'status':_0x288a76,'status_message':_0xfa2f67});}function _0x23db11(_0xd8a6d){logger[_0x75fe('0xf')](_0x75fe('0x21'));if(!_[_0x75fe('0x22')](_0xd8a6d)){logger[_0x75fe('0xf')](_['isObject'](_0xd8a6d)?JSON[_0x75fe('0x11')](_0xd8a6d):_0xd8a6d);}}_0x11bf61['on'](_0x75fe('0x23'),_0xb6b0e6);_0x11bf61['on'](_0x75fe('0x24'),_0x470bc0);_0x11bf61['on'](_0x75fe('0x25'),_0xd77448);_0x11bf61['on'](_0x75fe('0xf'),_0x23db11);});}; \ 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 3e7c531..1dc3ce2 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 _0x8184=['./asr','exports'];(function(_0xf3bfe5,_0x2f6600){var _0x130463=function(_0x17af24){while(--_0x17af24){_0xf3bfe5['push'](_0xf3bfe5['shift']());}};_0x130463(++_0x2f6600);}(_0x8184,0x108));var _0x4818=function(_0x4b13f0,_0x1273df){_0x4b13f0=_0x4b13f0-0x0;var _0x2a1955=_0x8184[_0x4b13f0];return _0x2a1955;};var asr=require(_0x4818('0x0'));module[_0x4818('0x1')]={'asr':asr}; \ No newline at end of file +var _0x021f=['./asr'];(function(_0x185190,_0x418609){var _0x38abe4=function(_0x24d1b1){while(--_0x24d1b1){_0x185190['push'](_0x185190['shift']());}};_0x38abe4(++_0x418609);}(_0x021f,0x1c9));var _0xf021=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x021f[_0x5c2e3e];return _0x53f64a;};var asr=require(_0xf021('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d4be45a..f1ee161 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 _0xb3ed=['./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','projectUpdate','stringify','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','events','EventEmitter','./error'];(function(_0x280919,_0xd6a4fb){var _0x37884f=function(_0x2298e7){while(--_0x2298e7){_0x280919['push'](_0x280919['shift']());}};_0x37884f(++_0xd6a4fb);}(_0xb3ed,0x173));var _0xdb3e=function(_0x5e4d76,_0x5aced6){_0x5e4d76=_0x5e4d76-0x0;var _0x402f5d=_0xb3ed[_0x5e4d76];return _0x402f5d;};'use strict';var util=require('util');var net=require(_0xdb3e('0x0'));var EventEmitter=require(_0xdb3e('0x1'))[_0xdb3e('0x2')];var AGIError=require(_0xdb3e('0x3'));var AGIChannel=require(_0xdb3e('0x4'));var AGIServer=function(_0x529de7,_0x4a42ee,_0x4494f9){var _0xc8422e=this;var _0x38d8ce=null;var _0x31fba1=0x0;if(!_0x529de7)_0x529de7=0x11dd;if(!_0x4a42ee)_0x4a42ee=_0xdb3e('0x5');EventEmitter[_0xdb3e('0x6')](_0xc8422e);function _0x42874c(){if(!_0x529de7){_0xc8422e['emit'](_0xdb3e('0x7'),new AGIError(_0xdb3e('0x8')));return![];}_0x38d8ce=net[_0xdb3e('0x9')]();_0x38d8ce[_0xdb3e('0xa')](_0x529de7,_0x4a42ee);_0x38d8ce['on'](_0xdb3e('0xb'),function(){_0xc8422e['emit'](_0xdb3e('0xb'));});_0x38d8ce['on']('connection',function(_0x460847){_0x460847['on']('data',function(_0xf7493b){_0xc8422e[_0xdb3e('0xc')](_0xdb3e('0xd'),JSON[_0xdb3e('0xe')](_0xf7493b));});_0x38d8ce['getConnections'](function(_0x367c8c,_0x148d9d){if(_0x367c8c){_0xc8422e['emit']('error',new AGIError(_0xdb3e('0xf'),_0x367c8c));}else if(_0x4494f9&&_0x4494f9<0x0){_0xc8422e[_0xdb3e('0xc')]('error',new AGIError(_0xdb3e('0x10')));_0x460847[_0xdb3e('0x11')]();}else if(_0x4494f9&&_0x4494f9>0x0&&_0x4494f9<_0x148d9d){_0x31fba1+=0x1;_0xc8422e[_0xdb3e('0xc')](_0xdb3e('0x7'),new AGIError(_0xdb3e('0x12'),_0x31fba1));_0x460847[_0xdb3e('0x11')]();}else{var _0x353334=new AGIChannel(_0x460847);_0x353334['on']('ready',function(){_0xc8422e[_0xdb3e('0xc')](_0xdb3e('0x13'),_0x353334);});}});});_0x38d8ce['on']('error',function(_0x5796e4){_0xc8422e['emit'](_0xdb3e('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5796e4[_0xdb3e('0x14')]));});_0x38d8ce['on'](_0xdb3e('0x15'),function(){_0xc8422e[_0xdb3e('0xc')](_0xdb3e('0x15'),new AGIError(_0xdb3e('0x16')));});}process[_0xdb3e('0x17')](function(){_0x42874c();});};util[_0xdb3e('0x18')](AGIServer,EventEmitter);module['exports']=function(_0x11f503,_0x39105d,_0x3cb6e5){return new AGIServer(_0x11f503,_0x39105d,_0x3cb6e5);}; \ No newline at end of file +var _0x7a8d=['net','events','EventEmitter','./error','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick'];(function(_0x5df378,_0x1692b4){var _0x58fb26=function(_0xbea53){while(--_0xbea53){_0x5df378['push'](_0x5df378['shift']());}};_0x58fb26(++_0x1692b4);}(_0x7a8d,0x150));var _0xd7a8=function(_0x1f4684,_0x594baa){_0x1f4684=_0x1f4684-0x0;var _0x2fbf7a=_0x7a8d[_0x1f4684];return _0x2fbf7a;};'use strict';var util=require('util');var net=require(_0xd7a8('0x0'));var EventEmitter=require(_0xd7a8('0x1'))[_0xd7a8('0x2')];var AGIError=require(_0xd7a8('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x80aa00,_0x704043,_0x248328){var _0x11f2ab=this,_0x80aa00=_0x80aa00||0x11dd,_0x704043=_0x704043||'127.0.0.1',_0x51a246=null,_0x55429f=0x0;EventEmitter['call'](_0x11f2ab);function _0x127094(){if(!_0x80aa00){_0x11f2ab['emit'](_0xd7a8('0x4'),new AGIError(_0xd7a8('0x5')));return![];}_0x51a246=net[_0xd7a8('0x6')]();_0x51a246[_0xd7a8('0x7')](_0x80aa00,_0x704043);_0x51a246['on'](_0xd7a8('0x8'),function(){_0x11f2ab[_0xd7a8('0x9')]('listening');});_0x51a246['on'](_0xd7a8('0xa'),function(_0xa7346){_0x51a246[_0xd7a8('0xb')](function(_0x32771f,_0x28518a){if(_0x32771f){_0x11f2ab[_0xd7a8('0x9')](_0xd7a8('0x4'),new AGIError('E_AGI_SERVER_ERROR',_0x32771f));}else if(_0x248328&&_0x248328<0x0){_0x11f2ab['emit'](_0xd7a8('0x4'),new AGIError(_0xd7a8('0xc')));_0xa7346[_0xd7a8('0xd')]();}else if(_0x248328&&_0x248328>0x0&&_0x248328<_0x28518a){_0x55429f+=0x1;_0x11f2ab[_0xd7a8('0x9')](_0xd7a8('0x4'),new AGIError(_0xd7a8('0xe'),_0x55429f));_0xa7346[_0xd7a8('0xd')]();}else{var _0x89d5e7=new AGIChannel(_0xa7346);_0x89d5e7['on'](_0xd7a8('0xf'),function(){_0x11f2ab[_0xd7a8('0x9')](_0xd7a8('0xa'),_0x89d5e7);});}});});_0x51a246['on'](_0xd7a8('0x4'),function(_0x40e5e1){_0x11f2ab[_0xd7a8('0x9')]('error',new AGIError(_0xd7a8('0x10'),_0x40e5e1[_0xd7a8('0x11')]));});_0x51a246['on'](_0xd7a8('0x12'),function(){_0x11f2ab[_0xd7a8('0x9')](_0xd7a8('0x12'),new AGIError(_0xd7a8('0x13')));});}process[_0xd7a8('0x14')](function(){_0x127094();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x449ffa,_0x3fb705,_0x1c9d1d){return new AGIServer(_0x449ffa,_0x3fb705,_0x1c9d1d);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 305d553..1f20374 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 _0xfff0=['clear','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','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','no\x20list\x20selected','delay','add','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','exec','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','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','no\x20query\x20configured','query:\x20%s','variable_id','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','no\x20key\x20configured','wav','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','condition','no\x20condition\x20configured','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)','true','IFTIME\x20%s\x20%s','hangup','%s/recordings/%s','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','logout','failure','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','getSmtpOptions','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getSquareProject','catch','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','url','method','timeout','number','includes','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','tildeASR','appid','appsecret'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xfff0,0x139));var _0x0fff=function(_0x11d81f,_0x351699){_0x11d81f=_0x11d81f-0x0;var _0x2c6d7a=_0xfff0[_0x11d81f];return _0x2c6d7a;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0fff('0x0'));var sh=require(_0x0fff('0x1'));var odbc=require(_0x0fff('0x2'))();var rs=require('randomstring');var moment=require(_0x0fff('0x3'));var Mustache=require(_0x0fff('0x4'));var rp=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var shared=require('../../config/environment/shared');var scripts=require(_0x0fff('0x8'));var FILES_PATH=_0x0fff('0x9');var recursiveMapAttributes=[_0x0fff('0xa'),'rawBody'];var verticesWithRetry=[_0x0fff('0xb'),'getdigits',_0x0fff('0xc')];var AGIVertices=function(_0x5304a5,_0x41cfd9,_0x3db6f6){this['channel']=_0x5304a5;this[_0x0fff('0xd')]=_0x41cfd9;this[_0x0fff('0xe')]=_0x3db6f6;};AGIVertices[_0x0fff('0xf')][_0x0fff('0x10')]=function(_0x209b6d,_0x20c88b){this[_0x0fff('0xd')][_0x0fff('0x11')](_0x209b6d)[_0x0fff('0x12')](function(_0x411ffc){_0x20c88b(null,_0x411ffc?_0x411ffc[_0x0fff('0x13')]:![]);})['catch'](function(_0x1fb243){_0x20c88b(_0x1fb243);});};AGIVertices['prototype'][_0x0fff('0x14')]=function(_0x431efa,_0x38fc82){this[_0x0fff('0xd')]['getVoiceQueueById'](_0x431efa)['then'](function(_0x1daf30){_0x38fc82(null,_0x1daf30?_0x1daf30['name']:![]);})['catch'](function(_0x51ceea){_0x38fc82(_0x51ceea);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x15')]=function(_0x5eab2e,_0x431b33){this[_0x0fff('0xd')]['getSquareProjectById'](_0x5eab2e)['then'](function(_0x48f36d){_0x431b33(null,_0x48f36d?_0x48f36d[_0x0fff('0x13')]:![]);})[_0x0fff('0x16')](function(_0x46a02d){_0x431b33(_0x46a02d);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x17')]=function(_0xe89b4a,_0x4c88ae){this[_0x0fff('0xd')][_0x0fff('0x18')](_0xe89b4a)[_0x0fff('0x12')](function(_0x49d211){_0x4c88ae(null,_0x49d211?_0x49d211['dsn']:![]);})[_0x0fff('0x16')](function(_0x330e29){_0x4c88ae(_0x330e29);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x19')]=function(_0x502393,_0x155132){this[_0x0fff('0xd')][_0x0fff('0x1a')](_0x502393)[_0x0fff('0x12')](function(_0x16e7f4){_0x155132(null,_0x16e7f4?_0x16e7f4[_0x0fff('0x13')]:![]);})['catch'](function(_0x6a116c){_0x155132(_0x6a116c);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x1b')]=function(_0x24cd18,_0x11ac00){this[_0x0fff('0xd')]['getTrunkById'](_0x24cd18)[_0x0fff('0x12')](function(_0x87b3a6){_0x11ac00(null,_0x87b3a6?_0x87b3a6[_0x0fff('0x13')]:![]);})[_0x0fff('0x16')](function(_0x36d268){_0x11ac00(_0x36d268);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x1c')]=function(_0x3e6fef,_0x44e54a){var _0xc32a61=this;this[_0x0fff('0xd')][_0x0fff('0x1d')](_0x3e6fef)['then'](function(_0x7046a3){_0x44e54a(null,_0x7046a3?_0xc32a61[_0x0fff('0x1e')](_0x7046a3[_0x0fff('0x1f')]):![]);})[_0x0fff('0x16')](function(_0x1f643d){_0x44e54a(_0x1f643d);});};AGIVertices[_0x0fff('0xf')]['getMailAccount']=function(_0x31f9a4,_0xa16c29){this[_0x0fff('0xd')]['getMailAccountById'](_0x31f9a4)[_0x0fff('0x12')](function(_0x3fa6fc){_0xa16c29(null,_0x3fa6fc?_0x3fa6fc:![]);})['catch'](function(_0x3daf51){_0xa16c29(_0x3daf51);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x20')]=function(_0x15ae24,_0x25ab2a,_0x263e9e){this[_0x0fff('0xe')][_0x0fff('0x20')](_0x15ae24,_0x25ab2a)[_0x0fff('0x12')](function(){_0x263e9e(null);})[_0x0fff('0x16')](function(_0x58469b){_0x263e9e(_0x58469b);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x21')]=function(_0x2b5a2a,_0x1bbb9e){this[_0x0fff('0xd')]['getIntervalById'](_0x2b5a2a)['then'](function(_0x316057){if(_0x316057){if(_0x316057[_0x0fff('0x22')]){_0x1bbb9e(null,[_0x316057[_0x0fff('0x23')]]);}else{_0x1bbb9e(null,_[_0x0fff('0x24')](_0x316057['Intervals'],_0x0fff('0x23')));}}else{_0x1bbb9e(null,![]);}})[_0x0fff('0x16')](function(_0x13347d){_0x1bbb9e(_0x13347d);});};AGIVertices[_0x0fff('0xf')]['getSoundPath']=function(_0x36a233){return util[_0x0fff('0x25')](_0x0fff('0x26'),FILES_PATH,_0x36a233);};AGIVertices[_0x0fff('0xf')][_0x0fff('0x27')]=function(_0x43af7a,_0x1a381b,_0x384f76){odbc[_0x0fff('0x28')](_0x43af7a,function(_0x388193){if(_0x388193){logger[_0x0fff('0x29')](_0x0fff('0x2a'),_0x388193);_0x384f76(_0x388193);}else{logger['info'](_0x0fff('0x2b'));odbc[_0x0fff('0x2c')](_0x1a381b,function(_0x45ba02,_0x312b0d){if(_0x45ba02){logger[_0x0fff('0x2d')](_0x0fff('0x2e'),_0x1a381b);_0x384f76(_0x45ba02);}else{logger['info'](_0x0fff('0x2f'),_0x1a381b);odbc[_0x0fff('0x30')](function(_0x8e13e7){if(_0x8e13e7){logger[_0x0fff('0x29')](_0x0fff('0x31'),_0x8e13e7);}_0x384f76(null,_0x312b0d);});}});}});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x32')]=function(_0x425ec1,_0x28e0aa){this['rpc'][_0x0fff('0x33')](_0x425ec1)['then'](function(_0x28a8b7){_0x28e0aa(null,_0x28a8b7?_0x28a8b7:![]);})[_0x0fff('0x16')](function(_0x126f6a){_0x28e0aa(_0x126f6a);});};AGIVertices['prototype']['createSmsMessage']=function(_0x91411b,_0x9470f){this[_0x0fff('0xd')]['createSmsMessage'](_0x91411b)['then'](function(_0x4668b3){_0x9470f(null,_0x4668b3);})['catch'](function(_0xd6ebeb){_0x9470f(_0xd6ebeb);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x34')]=function(_0x309d75,_0x395923,_0x26fc5f){this['rpc'][_0x0fff('0x34')]({'uniqueid':this[_0x0fff('0x35')][_0x0fff('0x36')],'node':_0x309d75[_0x0fff('0x37')],'application':_0x309d75[_0x0fff('0x38')],'data':_0x395923||null,'project_name':this[_0x0fff('0x35')][_0x0fff('0x39')],'callerid':this['channel'][_0x0fff('0x3a')]})[_0x0fff('0x12')](function(_0x101b3a){if(_0x26fc5f){_0x26fc5f(null,_0x101b3a);}})['catch'](function(_0x2de540){if(_0x26fc5f){_0x26fc5f(_0x2de540);}});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x3b')]=function(_0x1fbbbf,_0x3c5cc0,_0x451b47,_0x2f73cf){this[_0x0fff('0xd')][_0x0fff('0x3b')]({'uniqueid':this[_0x0fff('0x35')][_0x0fff('0x36')],'callerid':this['channel'][_0x0fff('0x3a')],'calleridname':this[_0x0fff('0x35')]['calleridname'],'context':this[_0x0fff('0x35')][_0x0fff('0x3c')],'extension':this[_0x0fff('0x35')]['extension'],'priority':this['channel'][_0x0fff('0x3d')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x0fff('0x35')][_0x0fff('0x3e')],'projectName':this[_0x0fff('0x35')][_0x0fff('0x39')],'saveName':_0x3c5cc0,'filename':_0x1fbbbf[_0x0fff('0x3f')]||_0x3c5cc0,'savePath':_0x451b47})[_0x0fff('0x12')](function(_0x552440){_0x2f73cf(null,_0x552440);})[_0x0fff('0x16')](function(_0x3ee3e3){_0x2f73cf(_0x3ee3e3);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x40')]=function(_0x30c4d6,_0x2c725c,_0x5d1739,_0x17cc91,_0x356337){this['rpc'][_0x0fff('0x40')]({'uniqueid':this['channel']['uniqueid'],'body':_0x30c4d6,'direction':_0x2c725c,'providerName':_0x5d1739,'providerResponse':_0x17cc91})['then'](function(_0x218e1c){if(_0x356337){_0x356337(null,_0x218e1c);}})[_0x0fff('0x16')](function(_0x15f725){if(_0x356337){_0x356337(_0x15f725);}});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x41')]=function(_0x4bf98d,_0x2524ad){this[_0x0fff('0xd')][_0x0fff('0x41')]({'firstName':_[_0x0fff('0x42')](_0x4bf98d[_0x0fff('0x13')])||_['isNil'](_0x4bf98d[_0x0fff('0x13')])?_0x0fff('0x43')+Math[_0x0fff('0x44')]():_0x4bf98d[_0x0fff('0x13')],'lastName':_[_0x0fff('0x42')](_0x4bf98d[_0x0fff('0x45')])||_[_0x0fff('0x46')](_0x4bf98d[_0x0fff('0x45')])?null:_0x4bf98d[_0x0fff('0x45')],'phone':_0x4bf98d[_0x0fff('0x47')],'ListId':_0x4bf98d[_0x0fff('0x48')],'scheduledat':_0x4bf98d[_0x0fff('0x49')],'callbackUniqueid':this[_0x0fff('0x35')][_0x0fff('0x36')],'tags':_0x0fff('0x4a'),'description':_0x0fff('0x4b')+_0x4bf98d[_0x0fff('0x49')][_0x0fff('0x4c')](),'priority':_0x4bf98d[_0x0fff('0x4d')]})[_0x0fff('0x12')](function(_0x18c853){_0x2524ad(null,_0x18c853);})['catch'](function(_0x25d696){_0x2524ad(_0x25d696);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x4e')]=function(_0x2744b4,_0x57d568){this[_0x0fff('0xd')]['getPauseById'](_0x2744b4)[_0x0fff('0x12')](function(_0x1f216d){_0x57d568(null,_0x1f216d?_0x1f216d[_0x0fff('0x13')]:![]);})[_0x0fff('0x16')](function(_0x4bf865){_0x57d568(_0x4bf865);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x4f')]=function(_0xd781d3,_0x226d6d,_0x4cf619){var _0x5ba7e7={'role':_0x0fff('0x50')};_0x5ba7e7[_0xd781d3]=this[_0x0fff('0x35')][_0x0fff('0x3a')];this[_0x0fff('0xd')][_0x0fff('0x4f')](_0x5ba7e7,_0x226d6d,this[_0x0fff('0x35')]['uniqueid'])['then'](function(_0x1efc0f){_0x4cf619(null,_[_0x0fff('0x46')](_0x1efc0f)?![]:!![]);})[_0x0fff('0x16')](function(_0x33bff0){logger[_0x0fff('0x29')](_0x33bff0);_0x4cf619(null,![]);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x51')]=function(_0x40e5ec,_0x5f2fcc){var _0x12fe95={'role':'agent'};_0x12fe95[_0x40e5ec]=this[_0x0fff('0x35')][_0x0fff('0x3a')];this[_0x0fff('0xd')]['agentUnpause'](_0x12fe95)['then'](function(_0x139cb3){_0x5f2fcc(null,_['isNil'](_0x139cb3)?![]:!![]);})[_0x0fff('0x16')](function(_0x5ce7ac){logger[_0x0fff('0x29')](_0x5ce7ac);_0x5f2fcc(null,![]);});};AGIVertices[_0x0fff('0xf')]['agentLogout']=function(_0x3e04df,_0x2c6e89){var _0x57a504={'role':_0x0fff('0x50')};_0x57a504[_0x3e04df]=this[_0x0fff('0x35')][_0x0fff('0x3a')];this['rpc'][_0x0fff('0x52')](_0x57a504)[_0x0fff('0x12')](function(_0x1414af){_0x2c6e89(null,_[_0x0fff('0x46')](_0x1414af)?![]:!![]);})[_0x0fff('0x16')](function(_0xf4fb1e){logger[_0x0fff('0x29')](_0xf4fb1e);_0x2c6e89(null,![]);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x53')]=function(_0x31848c,_0x1a5988){var _0x23d04a={'role':'agent'};_0x23d04a[_0x31848c]=this['channel'][_0x0fff('0x3a')];var _0x59c65a=_0x31848c!='internal'?util[_0x0fff('0x25')](_0x0fff('0x54'),_0x0fff('0x55'),this['channel']['callerid']):undefined;this[_0x0fff('0xd')][_0x0fff('0x53')](_0x23d04a,_0x59c65a)[_0x0fff('0x12')](function(_0x2586c6){_0x1a5988(null,_['isNil'](_0x2586c6)?![]:!![]);})[_0x0fff('0x16')](function(_0xec4e30){logger[_0x0fff('0x29')](_0xec4e30);_0x1a5988(null,![]);});};AGIVertices[_0x0fff('0xf')]['shellCommand']=function(_0x2b5d13,_0x1858fb){sh['exec'](_['trim'](_0x2b5d13),function(_0x33ed23,_0x1dac18){var _0x2e91e0=_0x1dac18[_0x0fff('0x56')](/(\r\n|\n|\r)/gm,'');_0x1858fb(null,_0x2e91e0);});};AGIVertices[_0x0fff('0xf')]['googleCloudTTS']=function(_0x27cb67,_0x7b040){scripts[_0x0fff('0x57')](_0x27cb67[_0x0fff('0x58')],_0x27cb67[_0x0fff('0x59')]||'text',_0x27cb67['text'],_0x27cb67[_0x0fff('0x5a')]||'en-US',_0x27cb67[_0x0fff('0x5b')]||_0x0fff('0x5c'),_0x27cb67[_0x0fff('0x5d')]||_0x0fff('0x5e'))[_0x0fff('0x12')](function(_0x5b5ff7){_0x7b040(null,_0x5b5ff7);})[_0x0fff('0x16')](function(_0x191872){_0x7b040(_0x191872);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x5f')]=function(_0x31ff4e,_0x15ab8e){scripts[_0x0fff('0x5f')](_0x31ff4e[_0x0fff('0x60')],_0x31ff4e[_0x0fff('0x61')]||'en',0x1)[_0x0fff('0x12')](function(_0x5c6063){_0x15ab8e(null,_0x5c6063);})['catch'](function(_0x134012){_0x15ab8e(_0x134012);});};AGIVertices[_0x0fff('0xf')]['restAPI']=function(_0x11a5b8,_0x495bf7){var _0x27dc72={'uri':_0x11a5b8[_0x0fff('0x62')],'method':_0x11a5b8[_0x0fff('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x11a5b8[_0x0fff('0x64')])===_0x0fff('0x65')&&parseInt(_0x11a5b8['timeout'])>=0x1?parseInt(_0x11a5b8[_0x0fff('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x0fff('0x66')](['POST',_0x0fff('0x67')],_0x27dc72[_0x0fff('0x63')][_0x0fff('0x68')]())){try{_0x27dc72['body']=_0x11a5b8[_0x0fff('0x69')]?JSON[_0x0fff('0x6a')](_0x11a5b8['rawBody']):{};}catch(_0x567544){logger[_0x0fff('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x567544);}}try{_0x27dc72['headers']=_0x11a5b8[_0x0fff('0xa')]?JSON[_0x0fff('0x6a')](_0x11a5b8[_0x0fff('0xa')]):{};}catch(_0x47b5d0){logger['error'](_0x0fff('0x6b'),_0x47b5d0);}if(_0x11a5b8['computedVariables']){try{var _0x326f19=require(_0x11a5b8[_0x0fff('0x6c')])[_0x0fff('0x6d')](this,_0x27dc72);_0x27dc72[_0x0fff('0x6e')]=Mustache[_0x0fff('0x6f')](_0x11a5b8[_0x0fff('0x62')],_0x326f19,{},['$$','$$']);if(_0x27dc72[_0x0fff('0x70')]){_0x27dc72['headers']=JSON[_0x0fff('0x6a')](Mustache[_0x0fff('0x6f')](JSON[_0x0fff('0x71')](_0x27dc72[_0x0fff('0x70')]),_0x326f19,{},['$$','$$']));}if(_0x27dc72[_0x0fff('0x72')]){_0x27dc72[_0x0fff('0x72')]=JSON['parse'](Mustache[_0x0fff('0x6f')](JSON['stringify'](_0x27dc72[_0x0fff('0x72')]),_0x326f19,{},['$$','$$']));}}catch(_0xa932e2){logger[_0x0fff('0x29')](_0x0fff('0x73'),_0xa932e2);}}rp(_0x27dc72)['then'](function(_0x4fc7c7){var _0x34dd99={'statusCode':_0x4fc7c7['statusCode']||0xc8,'statusMessage':_0x4fc7c7[_0x0fff('0x74')]||'OK','headers':_0x4fc7c7[_0x0fff('0x70')]||{},'body':_0x4fc7c7['body']||{}};_0x495bf7(null,_0x34dd99);})['catch'](function(_0x36cc4e){var _0x898a3c={'statusCode':_0x36cc4e[_0x0fff('0x75')]||0x1f4,'statusMessage':_0x36cc4e[_0x0fff('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x36cc4e[_0x0fff('0x77')]['headers']||{},'body':_0x36cc4e[_0x0fff('0x77')][_0x0fff('0x72')]||{}};_0x495bf7(null,_0x898a3c);});};AGIVertices[_0x0fff('0xf')]['googleDialogflow']=function(_0x5930bf,_0x493bf0){scripts[_0x0fff('0x78')](this['channel'][_0x0fff('0x36')],_0x5930bf[_0x0fff('0x79')],_0x5930bf[_0x0fff('0x60')],_0x5930bf[_0x0fff('0x7a')]||'en')[_0x0fff('0x12')](function(_0x171e29){_0x493bf0(null,_0x171e29);})[_0x0fff('0x16')](function(_0x28d073){_0x493bf0(_0x28d073);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x7b')]=function(_0x1db804,_0x55a9d2){scripts[_0x0fff('0x7b')](this[_0x0fff('0x35')][_0x0fff('0x36')],_0x1db804[_0x0fff('0x7c')],_0x1db804[_0x0fff('0x7d')],_0x1db804['private_key'],_0x1db804[_0x0fff('0x60')],_0x1db804[_0x0fff('0x7e')]||'en')['then'](function(_0x35559c){_0x55a9d2(null,_0x35559c);})[_0x0fff('0x16')](function(_0x45fe6e){_0x55a9d2(_0x45fe6e);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x7f')]=function(_0x2b1688,_0xe06663){scripts[_0x0fff('0x7f')](this[_0x0fff('0x35')],_0x2b1688)[_0x0fff('0x12')](function(_0x48a2ab){_0xe06663(null,_0x48a2ab);})[_0x0fff('0x16')](function(_0x42ddee){_0xe06663(_0x42ddee);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x80')]=function(_0x4a00fb,_0x2fdf96){scripts[_0x0fff('0x80')](_0x4a00fb['key'],_0x4a00fb[_0x0fff('0x60')],_0x4a00fb['ispeech_tts_language']||_0x0fff('0x81'),_0x4a00fb[_0x0fff('0x82')])[_0x0fff('0x12')](function(_0x8ff121){_0x2fdf96(null,_0x8ff121);})[_0x0fff('0x16')](function(_0x4cb7cc){_0x2fdf96(_0x4cb7cc);});};AGIVertices[_0x0fff('0xf')]['ispeechASR']=function(_0x579094,_0x431b4d,_0x173b44){scripts[_0x0fff('0x83')](_0x431b4d,_0x579094[_0x0fff('0x79')],_0x579094[_0x0fff('0x84')]||_0x0fff('0x81'),this['isConfigured'](_0x579094['model'])?_0x579094['model']:undefined)[_0x0fff('0x12')](function(_0x41b755){_0x173b44(null,_0x41b755);})[_0x0fff('0x16')](function(_0x506156){_0x173b44(_0x506156);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x85')]=function(_0x2138c3,_0x352e91){scripts[_0x0fff('0x85')](_0x2138c3[_0x0fff('0x86')],_0x2138c3[_0x0fff('0x87')],_0x2138c3[_0x0fff('0x88')],_0x2138c3[_0x0fff('0x89')]||_0x0fff('0x8a'),_0x2138c3[_0x0fff('0x60')],_0x2138c3[_0x0fff('0x8b')]||_0x0fff('0x60'))['then'](function(_0x42c282){_0x352e91(null,_0x42c282);})[_0x0fff('0x16')](function(_0x3bea4b){_0x352e91(_0x3bea4b);});};AGIVertices[_0x0fff('0xf')][_0x0fff('0x8c')]=function(_0x1b48f3,_0xddc066){scripts['awsLex'](this[_0x0fff('0x35')][_0x0fff('0x36')],_0x1b48f3['aws_access_key_id'],_0x1b48f3[_0x0fff('0x87')],_0x1b48f3['aws_lex_region'],_0x1b48f3[_0x0fff('0x60')],_0x1b48f3[_0x0fff('0x8d')])['then'](function(_0x4e819f){_0xddc066(null,_0x4e819f);})['catch'](function(_0x22da86){_0xddc066(_0x22da86);});};AGIVertices['prototype']['googleASR']=function(_0x59774e,_0x533ce4,_0x194d74){scripts['googleASR'](_0x533ce4,_0x59774e[_0x0fff('0x79')],_0x59774e['google_asr_language']||_0x0fff('0x81'))['then'](function(_0x465dde){_0x194d74(null,_0x465dde);})[_0x0fff('0x16')](function(_0x49cd34){_0x194d74(_0x49cd34);});};AGIVertices['prototype'][_0x0fff('0x8e')]=function(_0x361233,_0x199c8b,_0x3fe2ce){scripts[_0x0fff('0x8e')](_0x199c8b,_0x361233[_0x0fff('0x8f')],_0x361233[_0x0fff('0x90')],_0x361233['uri'])[_0x0fff('0x12')](function(_0x1b653a){_0x3fe2ce(null,_0x1b653a);})[_0x0fff('0x16')](function(_0x8ef733){_0x3fe2ce(_0x8ef733);});};AGIVertices['prototype'][_0x0fff('0x91')]=function(_0x1d1264){var _0x5bf8ad=_['includes'](verticesWithRetry,_0x1d1264['agicommand'])?_0x1d1264:_[_0x0fff('0x92')](_0x1d1264);for(var _0x37b5b4 in _0x5bf8ad){if(_0x5bf8ad['hasOwnProperty'](_0x37b5b4)){if(_0x5bf8ad[_0x37b5b4]&&_[_0x0fff('0x93')](_0x5bf8ad[_0x37b5b4])){if(_[_0x0fff('0x66')](recursiveMapAttributes,_0x37b5b4)){_0x5bf8ad[_0x37b5b4]=this['replaceObjectAllVariables'](_0x5bf8ad[_0x37b5b4]);}else{_0x5bf8ad[_0x37b5b4]=this[_0x0fff('0x94')](_0x5bf8ad[_0x37b5b4]);}}}}return _0x5bf8ad;};AGIVertices[_0x0fff('0xf')][_0x0fff('0x95')]=function(_0x49da45){for(var _0x4cdaaf in _0x49da45){if(_0x49da45[_0x0fff('0x96')](_0x4cdaaf)){if(_[_0x0fff('0x97')](_0x49da45[_0x4cdaaf])){this['recursiveNodeIndex'](_0x49da45[_0x4cdaaf]);}else if(_[_0x0fff('0x98')](_0x49da45[_0x4cdaaf])){for(var _0x198ca4=0x0;_0x198ca4<_0x49da45[_0x4cdaaf][_0x0fff('0x99')];_0x198ca4++){this[_0x0fff('0x95')](_0x49da45[_0x4cdaaf][_0x198ca4]);}}else if(_[_0x0fff('0x93')](_0x49da45[_0x4cdaaf])){_0x49da45[_0x4cdaaf]=this[_0x0fff('0x94')](_0x49da45[_0x4cdaaf]);}}}};AGIVertices[_0x0fff('0xf')][_0x0fff('0x9a')]=function(_0x327b5,_0x320c2d){for(var _0x10aa61 in _0x327b5){if(_0x327b5[_0x0fff('0x96')](_0x10aa61)){if(_['isPlainObject'](_0x327b5[_0x10aa61])){if(!_[_0x0fff('0x42')](_0x327b5[_0x10aa61])){this['saveRestApiResult'](_0x327b5[_0x10aa61],util[_0x0fff('0x25')]('%s.%s',_0x320c2d,_0x10aa61));}}else if(_[_0x0fff('0x98')](_0x327b5[_0x10aa61])){for(var _0x5336=0x0;_0x5336<_0x327b5[_0x10aa61][_0x0fff('0x99')];_0x5336++){this[_0x0fff('0x9a')](_0x327b5[_0x10aa61][_0x5336],util[_0x0fff('0x25')](_0x0fff('0x9b'),_0x320c2d,_0x10aa61+'['+_0x5336+']'));}}else{if(!_['isNil'](_0x327b5[_0x10aa61])){this[_0x0fff('0x35')][_0x0fff('0x9c')](util['format'](_0x0fff('0x9b'),_0x320c2d,_0x10aa61),_0x327b5[_0x10aa61]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x420b4b){try{var _0x2e38c3=JSON[_0x0fff('0x6a')](_0x420b4b);this[_0x0fff('0x95')](_0x2e38c3);return JSON[_0x0fff('0x71')](_0x2e38c3);}catch(_0x411822){return this['replaceAllVariables'](_0x420b4b);}};AGIVertices[_0x0fff('0xf')][_0x0fff('0x94')]=function(_0x336fd9){var _0x2c9588=_0x336fd9[_0x0fff('0x9d')]('{');for(var _0x5cb750=0x1;_0x5cb750<_0x2c9588[_0x0fff('0x99')];_0x5cb750+=0x1){var _0xf73eb6=_0x2c9588[_0x5cb750][_0x0fff('0x9d')]('}');if(_0xf73eb6[_0x0fff('0x99')]>0x1){_0x336fd9=_0x336fd9[_0x0fff('0x9e')]('{'+_0xf73eb6[0x0]+'}',this[_0x0fff('0x35')][_0x0fff('0x10')](_0xf73eb6[0x0])['extra']||_0xf73eb6[0x0]);}}if(_0x2c9588['length']===0x1){return _0x336fd9[_0x0fff('0x4c')]();}return this['replaceAllVariables'](_0x336fd9);};AGIVertices[_0x0fff('0xf')]['getAndSetVariable']=function(_0x5f00ee,_0x592341){var _0x2e1625=this[_0x0fff('0x35')][_0x0fff('0x10')](_0x5f00ee);if(_0x2e1625[_0x0fff('0x9f')]===-0x1){return _0x2e1625;}logger[_0x0fff('0x2d')](util['format'](_0x0fff('0xa0'),_0x592341,_0x2e1625[_0x0fff('0xa1')]));return this[_0x0fff('0x35')][_0x0fff('0x9c')](_0x592341,_0x2e1625[_0x0fff('0xa1')]);};AGIVertices[_0x0fff('0xf')][_0x0fff('0xa2')]=function(_0x115445){return _0x115445&&_0x115445!=='0'&&_0x115445!=='-1'&&_0x115445!=='';};AGIVertices['prototype']['maxRetry']=function(_0x1f1946){this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x1f1946,'-');_0x1f1946['retry']=_0x1f1946[_0x0fff('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0fff('0xf')][_0x0fff('0xa4')]=function(_0x59f078){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xa5'),_0x59f078[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x59f078[_0x0fff('0x60')])){return this[_0x0fff('0x35')]['noop']('no\x20text\x20configured');}var _0x4a70ee='\x22'+_0x59f078[_0x0fff('0x60')]+'\x22';if(this[_0x0fff('0xa2')](_0x59f078[_0x0fff('0x77')])){_0x4a70ee+=','+_0x59f078[_0x0fff('0x77')];}var _0x41d09a=this[_0x0fff('0x35')]['exec'](_0x0fff('0xa6'),_0x4a70ee);if(_0x41d09a[_0x0fff('0x9f')]===-0x1){return _0x41d09a;}return this[_0x0fff('0x35')]['noop'](util['format'](_0x0fff('0xa7'),_0x4a70ee));};AGIVertices['prototype'][_0x0fff('0xa8')]=function(_0x15ed92){logger['info'](util[_0x0fff('0x25')](_0x0fff('0xa9'),_0x15ed92['label']));if(!this[_0x0fff('0xa2')](_0x15ed92[_0x0fff('0xaa')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xac'));}var _0x2cc1cc=_0x15ed92['grammar'];if(this[_0x0fff('0xa2')](_0x15ed92['options'])){_0x2cc1cc+=','+_0x15ed92[_0x0fff('0x77')];}var _0x5030a9=this[_0x0fff('0x35')]['exec'](_0x0fff('0xad'),_0x2cc1cc);if(_0x5030a9[_0x0fff('0x9f')]===-0x1){return _0x5030a9;}var _0x1d7516=this['getAndSetVariable'](_0x0fff('0xae'),'MRCP_RECOG_CONFIDENCE');if(_0x1d7516[_0x0fff('0x9f')]===-0x1){return _0x1d7516;}var _0x677458=this[_0x0fff('0xaf')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x677458[_0x0fff('0x9f')]===-0x1){return _0x677458;}var _0x30a237=this['getAndSetVariable']('RECOG_INSTANCE()',_0x0fff('0xb0'));if(_0x30a237[_0x0fff('0x9f')]===-0x1){return _0x30a237;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2cc1cc));};AGIVertices[_0x0fff('0xf')]['agi']=function(_0x7aee17){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xb1'),_0x7aee17['label']));return this[_0x0fff('0x35')]['agi']([_0x7aee17[_0x0fff('0xb2')],_0x7aee17[_0x0fff('0xb3')]]);};AGIVertices[_0x0fff('0xf')][_0x0fff('0xb4')]=function(_0x1330c9){logger['info'](util['format'](_0x0fff('0xb5'),_0x1330c9[_0x0fff('0x37')]));if(this[_0x0fff('0xa2')](_0x1330c9['timeout'])){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xb6'),_0x1330c9['timeout']));var _0x3a8267=this['channel'][_0x0fff('0xb7')](_0x1330c9[_0x0fff('0x64')]);if(_0x3a8267[_0x0fff('0x9f')]===-0x1){return _0x3a8267;}}return this[_0x0fff('0x35')][_0x0fff('0xb4')]();};AGIVertices[_0x0fff('0xf')][_0x0fff('0x4a')]=function(_0x463037){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x463037[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x463037[_0x0fff('0x48')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x463037,_0x0fff('0xb8'));}_0x463037['scheduledAt']=moment();if(this['isConfigured'](_0x463037[_0x0fff('0xb9')])){_0x463037['scheduledAt']=moment()[_0x0fff('0xba')](_0x463037[_0x0fff('0xb9')],'minutes');}if(!this[_0x0fff('0xa2')](_0x463037['callback_priority'])){_0x463037[_0x0fff('0x4d')]=0x2;}this['createCmContact']['sync'](this,_0x463037);return this['channel']['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x463037[_0x0fff('0x47')],_0x463037[_0x0fff('0x48')],_0x463037[_0x0fff('0x49')]));};AGIVertices[_0x0fff('0xf')]['custom_app']=function(_0x1a9eca){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1a9eca[_0x0fff('0x37')]));var _0x5bed22=this['channel']['exec'](_0x1a9eca[_0x0fff('0xbb')],_0x1a9eca[_0x0fff('0x77')]);if(_0x5bed22[_0x0fff('0x9f')]===-0x1){return _0x5bed22;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xbc'),_0x1a9eca[_0x0fff('0xbb')],_0x1a9eca[_0x0fff('0x77')]));};AGIVertices[_0x0fff('0xf')][_0x0fff('0xbd')]=function(_0x51c5ac){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x51c5ac['label']));if(!this['isConfigured'](_0x51c5ac[_0x0fff('0x60')])){return this['channel'][_0x0fff('0xab')]('no\x20text\x20configured');}var _0x55c429='\x22'+_0x51c5ac['text']+'\x22';if(this[_0x0fff('0xa2')](_0x51c5ac[_0x0fff('0x77')])){_0x55c429+=','+_0x51c5ac[_0x0fff('0x77')];}var _0x2d1d2f=this['channel'][_0x0fff('0xbe')](_0x0fff('0xa6'),_0x55c429);if(_0x2d1d2f[_0x0fff('0x9f')]===-0x1){return _0x2d1d2f;}return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0xa7'),_0x55c429));};AGIVertices[_0x0fff('0xf')]['sestektts']=function(_0x473080){logger['info'](util[_0x0fff('0x25')](_0x0fff('0xbf'),_0x473080[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x473080['text'])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0xc0'));}var _0x31f36d='\x22'+_0x473080[_0x0fff('0x60')]+'\x22';if(this[_0x0fff('0xa2')](_0x473080[_0x0fff('0x77')])){_0x31f36d+=','+_0x473080[_0x0fff('0x77')];}var _0x1610f6=this['channel'][_0x0fff('0xbe')](_0x0fff('0xa6'),_0x31f36d);if(_0x1610f6['result']===-0x1){return _0x1610f6;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xa7'),_0x31f36d));};AGIVertices[_0x0fff('0xf')][_0x0fff('0xc1')]=function(_0x32f1e1){logger['info'](util['format'](_0x0fff('0xc2'),_0x32f1e1['label']));if(!this[_0x0fff('0xa2')](_0x32f1e1[_0x0fff('0xaa')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xac'));}var _0x2eeb15=_0x32f1e1[_0x0fff('0xaa')];if(this[_0x0fff('0xa2')](_0x32f1e1[_0x0fff('0x77')])){_0x2eeb15+=','+_0x32f1e1[_0x0fff('0x77')];}var _0x3d26cd=this[_0x0fff('0x35')][_0x0fff('0xbe')](_0x0fff('0xad'),_0x2eeb15);if(_0x3d26cd['result']===-0x1){return _0x3d26cd;}var _0x1d22a6=this[_0x0fff('0xaf')](_0x0fff('0xae'),_0x0fff('0xc3'));if(_0x1d22a6[_0x0fff('0x9f')]===-0x1){return _0x1d22a6;}var _0xd38d3=this['getAndSetVariable'](_0x0fff('0xc4'),_0x0fff('0xc5'));if(_0xd38d3[_0x0fff('0x9f')]===-0x1){return _0xd38d3;}var _0x2bbdd7=this['getAndSetVariable']('RECOG_INSTANCE()',_0x0fff('0xc6'));if(_0x2bbdd7[_0x0fff('0x9f')]===-0x1){return _0x2bbdd7;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2eeb15));};AGIVertices[_0x0fff('0xf')][_0x0fff('0xc7')]=function(_0x422a02){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0xc8'),_0x422a02[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x422a02[_0x0fff('0xaa')])){return this['channel'][_0x0fff('0xab')](_0x0fff('0xac'));}var _0x2b685f=_0x422a02[_0x0fff('0xaa')];if(this['isConfigured'](_0x422a02['options'])){_0x2b685f+=','+_0x422a02[_0x0fff('0x77')];}var _0x370d1d=this['channel'][_0x0fff('0xbe')](_0x0fff('0xad'),_0x2b685f);if(_0x370d1d[_0x0fff('0x9f')]===-0x1){return _0x370d1d;}var _0x5cf1de=this[_0x0fff('0xaf')]('RECOG_CONFIDENCE()',_0x0fff('0xc9'));if(_0x5cf1de['result']===-0x1){return _0x5cf1de;}var _0x2dede8=this[_0x0fff('0xaf')](_0x0fff('0xc4'),_0x0fff('0xca'));if(_0x2dede8['result']===-0x1){return _0x2dede8;}var _0x506e95=this['getAndSetVariable']('RECOG_INSTANCE()',_0x0fff('0xcb'));if(_0x506e95[_0x0fff('0x9f')]===-0x1){return _0x506e95;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xcc'),_0x2b685f));};AGIVertices['prototype'][_0x0fff('0xcd')]=function(_0x211fca){logger['info'](util[_0x0fff('0x25')](_0x0fff('0xce'),_0x211fca[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x211fca['odbc_id'])){return this['channel']['error'](_0x211fca,_0x0fff('0xcf'));}var _0x12f606=this[_0x0fff('0x17')][_0x0fff('0x6d')](this,_0x211fca[_0x0fff('0xd0')]);if(!_0x12f606){return this['channel']['error'](_0x211fca,_0x0fff('0xd1'));}if(!this['isConfigured'](_0x211fca['query'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x211fca,_0x0fff('0xd2'));}var _0x39c3c8=_0x211fca['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xd3'),_0x39c3c8));var _0x1ccc53=this['getQueryOdbc'][_0x0fff('0x6d')](this,_0x12f606,_0x39c3c8);this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x211fca,_0x39c3c8);if(!this[_0x0fff('0xa2')](_0x211fca[_0x0fff('0xd4')])){return this[_0x0fff('0x35')][_0x0fff('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x47b28a=this[_0x0fff('0x10')][_0x0fff('0x6d')](this,_0x211fca[_0x0fff('0xd4')]);if(!_0x47b28a){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x211fca,'no\x20variable\x20found');}var _0x20969a=this;_0x1ccc53['forEach'](function(_0x16b13e,_0x545149){Object[_0x0fff('0xd5')](_0x16b13e)[_0x0fff('0xd6')](function(_0x1132b4){_0x20969a[_0x0fff('0x35')]['setVariable'](util[_0x0fff('0x25')]('%s[%s][%s]',_0x47b28a,_0x545149,_0x1132b4),_0x16b13e[_0x1132b4]);});});this[_0x0fff('0x35')][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0xd7'),_0x47b28a),_0x1ccc53['length']);return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xd8'),_0x47b28a));};AGIVertices[_0x0fff('0xf')][_0x0fff('0xd9')]=function(_0x4f1bbc){logger[_0x0fff('0xda')](util[_0x0fff('0x25')](_0x0fff('0xdb'),_0x4f1bbc[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x4f1bbc['sip_id'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x4f1bbc,_0x0fff('0xdc'));}var _0x46e5d1=this['getUser'][_0x0fff('0x6d')](this,_0x4f1bbc[_0x0fff('0xdd')]);if(!_0x46e5d1){return this[_0x0fff('0x35')]['error'](_0x4f1bbc,_0x0fff('0xde'));}var _0x109f2a=this[_0x0fff('0x35')][_0x0fff('0xbe')](_0x0fff('0xdf'),[util[_0x0fff('0x25')]('SIP/%s',_0x46e5d1),_0x4f1bbc[_0x0fff('0x64')],_0x4f1bbc[_0x0fff('0xe0')],_0x4f1bbc[_0x0fff('0x62')]]);if(_0x109f2a[_0x0fff('0x9f')]===-0x1){return _0x109f2a;}return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0xe1'),_0x0fff('0xdf')));};AGIVertices[_0x0fff('0xf')][_0x0fff('0xe2')]=function(_0x253ff3){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xe3'),_0x253ff3[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x253ff3[_0x0fff('0x79')])){return this[_0x0fff('0x35')][_0x0fff('0xab')]('no\x20key\x20configured');}if(!this[_0x0fff('0xa2')](_0x253ff3['text'])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xc0'));}this[_0x0fff('0x35')][_0x0fff('0xe4')]=!![];this[_0x0fff('0x34')](_0x253ff3);this['createSquareMessage'](_0x253ff3['text'],'in','','');this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xe5'),_0x253ff3[_0x0fff('0x60')]));var _0x389edb=this[_0x0fff('0x78')]['sync'](this,_0x253ff3);if(_0x389edb){for(var _0x3d916c in _0x389edb){if(_0x389edb[_0x0fff('0x96')](_0x3d916c)){this[_0x0fff('0x35')][_0x0fff('0x9c')](util['format']('DIALOGFLOW_%s',_0x3d916c['toUpperCase']()),_0x389edb[_0x3d916c]);}}this[_0x0fff('0x40')](_0x389edb['speech'],_0x0fff('0xe6'),_0x0fff('0xe2'),'');return this[_0x0fff('0x35')]['noop'](util['format'](_0x0fff('0xe7'),_0x389edb[_0x0fff('0xe8')]));}return this[_0x0fff('0x35')]['error'](_0x253ff3,_0x0fff('0xe9'));};AGIVertices['prototype'][_0x0fff('0xea')]=function(_0x348531){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xeb'),_0x348531[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x348531['dialogflowV2_project_id'])){return this[_0x0fff('0x35')][_0x0fff('0xab')]('no\x20project_id\x20configured');}if(!this[_0x0fff('0xa2')](_0x348531[_0x0fff('0x7d')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0xec'));}if(!this[_0x0fff('0xa2')](_0x348531[_0x0fff('0xed')])){return this['channel'][_0x0fff('0xab')](_0x0fff('0xee'));}if(!this['isConfigured'](_0x348531[_0x0fff('0x7e')])){return this['channel'][_0x0fff('0xab')](_0x0fff('0xef'));}if(!this[_0x0fff('0xa2')](_0x348531[_0x0fff('0x60')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xc0'));}this[_0x0fff('0x35')][_0x0fff('0xe4')]=!![];this[_0x0fff('0x34')](_0x348531);this[_0x0fff('0x40')](_0x348531[_0x0fff('0x60')],'in','','');this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xf0'),_0x348531[_0x0fff('0x60')]));var _0x52d6d4=this[_0x0fff('0x7b')][_0x0fff('0x6d')](this,_0x348531);if(_0x52d6d4){for(var _0x3be37c in _0x52d6d4){if(_0x52d6d4['hasOwnProperty'](_0x3be37c)){if(_0x3be37c!==_0x0fff('0xf1')){this['channel'][_0x0fff('0x9c')](util[_0x0fff('0x25')]('DIALOGFLOW_%s',_0x3be37c[_0x0fff('0x68')]()),_0x52d6d4[_0x3be37c]);}}}this[_0x0fff('0x40')](_0x52d6d4['speech'],_0x0fff('0xe6'),_0x0fff('0xea'),_0x52d6d4[_0x0fff('0xf1')]);return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')]('DialogflowV2\x20Result\x20%s',_0x52d6d4[_0x0fff('0xe8')]));}return this['channel'][_0x0fff('0x29')](_0x348531,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x0fff('0xf')][_0x0fff('0xf2')]=function(_0x253449){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0xf3'),_0x253449[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x253449[_0x0fff('0xf4')])){return this['channel']['noop'](_0x0fff('0xf5'));}if(!this['isConfigured'](_0x253449['username'])){return this['channel'][_0x0fff('0xab')](_0x0fff('0xf6'));}if(!this[_0x0fff('0xa2')](_0x253449['password'])){return this['channel'][_0x0fff('0xab')](_0x0fff('0xf7'));}if(!this['isConfigured'](_0x253449[_0x0fff('0xf8')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xc0'));}this[_0x0fff('0x35')][_0x0fff('0xe4')]=!![];this['createSquareDetailsReport'](_0x253449);this[_0x0fff('0x40')](_0x253449[_0x0fff('0x60')],'in','','');this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xf9'),_0x253449[_0x0fff('0x60')]));var _0x273d66=this['sestekNDA'][_0x0fff('0x6d')](this,_0x253449);if(_0x273d66){for(var _0x483e52 in _0x273d66){if(_0x273d66[_0x0fff('0x96')](_0x483e52)){this[_0x0fff('0x35')][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0xfa'),_0x483e52['toUpperCase']()),_0x273d66[_0x483e52]);}}this[_0x0fff('0x40')](_0x273d66[_0x0fff('0xe8')],_0x0fff('0xe6'),_0x0fff('0xf2'),'');if(_0x273d66[_0x0fff('0xfb')]){this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xfc'),_0x273d66[_0x0fff('0xfb')]));var _0x27ecbb=this[_0x0fff('0x35')]['streamFile'](_0x273d66[_0x0fff('0xfb')]);try{fs['unlink'](_0x273d66['audiofile']+_0x0fff('0xfd'));}catch(_0x550210){logger[_0x0fff('0x29')](_0x550210);}return _0x27ecbb;}else{return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xfe'),_0x273d66[_0x0fff('0xe8')]));}}return this[_0x0fff('0x35')]['error'](_0x253449,_0x0fff('0xff'));};AGIVertices[_0x0fff('0xf')]['end']=function(_0x2cfcf9){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x100'),_0x2cfcf9[_0x0fff('0x37')]));return this['channel']['noop'](_0x0fff('0x101'));};AGIVertices[_0x0fff('0xf')]['ext_dial']=function(_0x2d1a0d){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x102'),_0x2d1a0d[_0x0fff('0x37')]));var _0x420f38='';if(_0x2d1a0d[_0x0fff('0x103')]){if(!this[_0x0fff('0xa2')](_0x2d1a0d[_0x0fff('0x103')])){return this['channel'][_0x0fff('0x29')](_0x2d1a0d,_0x0fff('0x104'));}else{var _0x49eca5=parseInt(_0x2d1a0d[_0x0fff('0x103')],0xa);if(isNaN(_0x49eca5)){_0x420f38=_0x2d1a0d[_0x0fff('0x103')];}else{_0x420f38=this[_0x0fff('0x1b')]['sync'](this,_0x2d1a0d[_0x0fff('0x103')]);if(!_0x420f38){return this['channel']['error'](_0x2d1a0d,_0x0fff('0x105'));}}}}else if(_0x2d1a0d[_0x0fff('0x106')]){_0x420f38=_0x2d1a0d[_0x0fff('0x106')];}else{return this['channel']['error'](_0x2d1a0d,_0x0fff('0x104'));}var _0x5d9286=this[_0x0fff('0x35')]['exec']('DIAL',[util[_0x0fff('0x25')](_0x0fff('0x107'),_0x420f38,_0x2d1a0d['phone']),_0x2d1a0d[_0x0fff('0x64')],_0x2d1a0d[_0x0fff('0xe0')],_0x2d1a0d[_0x0fff('0x62')]]);if(_0x5d9286[_0x0fff('0x9f')]===-0x1){return _0x5d9286;}return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0xe1'),_0x0fff('0xdf')));};AGIVertices['prototype']['finally']=function(_0x9f0fda){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x9f0fda['label']));return this['channel'][_0x0fff('0xab')](_0x0fff('0x108'));};AGIVertices['prototype']['getdigits']=function(_0xf8e46){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x109'),_0xf8e46[_0x0fff('0x37')]));if(_0xf8e46['retry']===0x0){return this['maxRetry'](_0xf8e46);}_0xf8e46[_0x0fff('0x10a')]-=0x1;if(!this[_0x0fff('0xa2')](_0xf8e46[_0x0fff('0x10b')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0xf8e46,_0x0fff('0x10c'));}var _0x2fe9a2=this['getSound'][_0x0fff('0x6d')](this,_0xf8e46['file_id']);if(!_0x2fe9a2){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0xf8e46,_0x0fff('0x10d'));}if(!this[_0x0fff('0xa2')](_0xf8e46[_0x0fff('0xd4')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x0fff('0x10e'));}var _0x496e99=this[_0x0fff('0x35')][_0x0fff('0x10f')](_0x2fe9a2,_0xf8e46[_0x0fff('0x110')],_0xf8e46[_0x0fff('0x111')]);var _0x1dcfe3=_0x496e99[_0x0fff('0x9f')]?_0x496e99[_0x0fff('0x9f')][_0x0fff('0x4c')]():'';logger['info'](_0x0fff('0x112'),JSON[_0x0fff('0x71')](_0x496e99));if(_0x496e99[_0x0fff('0x9f')]===-0x1){this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0xf8e46,_0x1dcfe3);return _0x496e99;}else if(_0x496e99[_0x0fff('0xa1')]==='timeout'){_0x496e99[_0x0fff('0x9f')]=_0x1dcfe3['length']>=parseInt(_0xf8e46[_0x0fff('0x113')])?'x':'i';}else{_0x496e99[_0x0fff('0x9f')]=_0x1dcfe3['length']>=parseInt(_0xf8e46['mindigit'])&&_0x1dcfe3[_0x0fff('0x99')]<=parseInt(_0xf8e46[_0x0fff('0x111')])?'x':'i';}var _0x459ed5=this['getVariable']['sync'](this,_0xf8e46[_0x0fff('0xd4')]);if(!_0x459ed5){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0xf8e46,_0x0fff('0x114'));}this[_0x0fff('0x35')][_0x0fff('0x9c')](_0x459ed5,_0x1dcfe3);if(this[_0x0fff('0xa2')](_0xf8e46['hiddendigitsnum'])){var _0x237aa1=parseInt(_0xf8e46[_0x0fff('0x115')],0xa);var _0x16845b=rs[_0x0fff('0x116')]({'charset':'*','length':_0x237aa1});var _0x1f77ff=_0x1dcfe3[_0x0fff('0x99')];if(_0x1f77ff>0x0){if(_0x1f77ff>_0x237aa1){this['createSquareDetailsReport'][_0x0fff('0x6d')](this,_0xf8e46,_0xf8e46[_0x0fff('0x117')]==='first'?_0x16845b+_0x1dcfe3[_0x0fff('0x118')](_0x237aa1):_0x1dcfe3[_0x0fff('0x118')](0x0,_0x1f77ff-_0x237aa1)+_0x16845b);}else{this[_0x0fff('0x34')]['sync'](this,_0xf8e46,rs['generate']({'charset':'*','length':_0x1f77ff}));}}else{this['createSquareDetailsReport'][_0x0fff('0x6d')](this,_0xf8e46,'');}}else{this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0xf8e46,_0x1dcfe3);}return _0x496e99;};AGIVertices['prototype']['getsecretdigits']=function(_0x5b559f){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x119'),_0x5b559f[_0x0fff('0x37')]));return this[_0x0fff('0x11a')](_0x5b559f);};AGIVertices[_0x0fff('0xf')][_0x0fff('0x11b')]=function(_0x3379b3){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3379b3[_0x0fff('0x37')]));this['createSquareDetailsReport']['sync'](this,_0x3379b3,_0x3379b3[_0x0fff('0x11c')]);return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x11d'),_0x3379b3[_0x0fff('0x11c')]));};AGIVertices['prototype'][_0x0fff('0x11e')]=function(_0x2c432e){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x11f'),_0x2c432e[_0x0fff('0x37')]));if(!this['isConfigured'](_0x2c432e[_0x0fff('0x86')])||!this['isConfigured'](_0x2c432e[_0x0fff('0x87')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0x120'));}if(!this[_0x0fff('0xa2')](_0x2c432e[_0x0fff('0x60')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0xc0'));}this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x121'),_0x2c432e['text']));var _0x5515ed=this[_0x0fff('0x85')]['sync'](this,_0x2c432e);if(_0x5515ed){this[_0x0fff('0x35')][_0x0fff('0xab')](util['format'](_0x0fff('0x122'),_0x5515ed));var _0xee7bd=this[_0x0fff('0x35')][_0x0fff('0x123')](_0x5515ed);try{fs[_0x0fff('0x124')](_0x5515ed+'.wav');}catch(_0x4644e5){logger[_0x0fff('0x29')](_0x4644e5);}return _0xee7bd;}return this['channel'][_0x0fff('0x29')](_0x2c432e,_0x0fff('0x125'));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x126')]=function(_0x5b15ab){logger['info'](util['format'](_0x0fff('0x127'),_0x5b15ab[_0x0fff('0x37')]));if(!this['isConfigured'](_0x5b15ab[_0x0fff('0x86')])||!this[_0x0fff('0xa2')](_0x5b15ab[_0x0fff('0x87')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0x120'));}if(!this[_0x0fff('0xa2')](_0x5b15ab[_0x0fff('0x8d')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x128'));}if(!this[_0x0fff('0xa2')](_0x5b15ab[_0x0fff('0x60')])){return this['channel'][_0x0fff('0xab')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x0fff('0x34')](_0x5b15ab);this[_0x0fff('0x40')](_0x5b15ab[_0x0fff('0x60')],'in','','');this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0x129'),_0x5b15ab[_0x0fff('0x60')]));var _0x5b7bc1=this[_0x0fff('0x8c')]['sync'](this,_0x5b15ab);if(_0x5b7bc1){for(var _0x1355ee in _0x5b7bc1){if(_0x5b7bc1[_0x0fff('0x96')](_0x1355ee)&&_[_0x0fff('0x93')](_0x5b7bc1[_0x1355ee])){this[_0x0fff('0x35')][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0x12a'),_0x1355ee[_0x0fff('0x68')]()),_0x5b7bc1[_0x1355ee]);}}if(_['isNil'](_0x5b7bc1[_0x0fff('0x76')])){return this[_0x0fff('0x35')][_0x0fff('0xab')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x0fff('0x40')](_0x5b7bc1[_0x0fff('0x76')],_0x0fff('0xe6'),_0x0fff('0x12b'),'');return this[_0x0fff('0x35')][_0x0fff('0xab')](util['format'](_0x0fff('0x12c'),_0x5b7bc1['message']));}}return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x5b15ab,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x0fff('0xf')][_0x0fff('0x12d')]=function(_0x5209ca){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5209ca['label'],_0x5209ca[_0x0fff('0x64')]));if(!this[_0x0fff('0xa2')](_0x5209ca['key'])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x12e'));}var _0x3b4c80=_0x0fff('0x12f');var _0x1f2482=util[_0x0fff('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0x0fff('0x116')](0x4));var _0x2acd03=util[_0x0fff('0x25')](_0x0fff('0x9b'),_0x1f2482,_0x3b4c80);var _0x523699=!![];if(_0x5209ca[_0x0fff('0x130')]===_0x0fff('0x131')){_0x523699=![];}var _0x32e0e9=this['channel'][_0x0fff('0x132')](_0x1f2482,_0x3b4c80,_0x5209ca[_0x0fff('0x133')],_0x5209ca[_0x0fff('0x64')],undefined,_0x523699);if(_0x32e0e9[_0x0fff('0x9f')]!==-0x1){this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')]('google\x20%s\x20file\x20created',_0x2acd03));var _0x4c3f84=this['googleASR'][_0x0fff('0x6d')](this,_0x5209ca,_0x2acd03);if(_0x4c3f84){for(var _0x2b3df8 in _0x4c3f84){if(_0x4c3f84[_0x0fff('0x96')](_0x2b3df8)){this[_0x0fff('0x35')][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0x134'),_0x2b3df8['toUpperCase']()),_0x4c3f84[_0x2b3df8]);}}return this[_0x0fff('0x35')]['noop'](util['format'](_0x0fff('0x135'),JSON[_0x0fff('0x71')](_0x4c3f84)));}}return _0x32e0e9;};AGIVertices[_0x0fff('0xf')][_0x0fff('0x136')]=function(_0xb88226){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x137'),_0xb88226['label']));if(!this[_0x0fff('0xa2')](_0xb88226[_0x0fff('0x8f')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x138'));}if(!this[_0x0fff('0xa2')](_0xb88226[_0x0fff('0x90')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0x139'));}var _0x264009=_0x0fff('0x12f');var _0x5a14b4=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x0fff('0x116')](0x4));var _0x114e3d=util[_0x0fff('0x25')](_0x0fff('0x9b'),_0x5a14b4,_0x264009);var _0x11de55=!![];if(_0xb88226[_0x0fff('0x130')]===_0x0fff('0x131')){_0x11de55=![];}var _0x52f36f=this[_0x0fff('0x35')][_0x0fff('0x132')](_0x5a14b4,_0x264009,_0xb88226[_0x0fff('0x133')],_0xb88226[_0x0fff('0x64')],undefined,_0x11de55);if(_0x52f36f[_0x0fff('0x9f')]!==-0x1){this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x13a'),_0x114e3d));var _0x38433f=this['tildeASR'][_0x0fff('0x6d')](this,_0xb88226,_0x114e3d);if(_0x38433f){for(var _0x1b5415 in _0x38433f){if(_0x38433f['hasOwnProperty'](_0x1b5415)){this[_0x0fff('0x35')]['setVariable'](util[_0x0fff('0x25')](_0x0fff('0x13b'),_0x1b5415[_0x0fff('0x68')]()),_0x38433f[_0x1b5415]);}}return this[_0x0fff('0x35')][_0x0fff('0xab')](util['format'](_0x0fff('0x13c'),JSON[_0x0fff('0x71')](_0x38433f)));}}return _0x52f36f;};AGIVertices[_0x0fff('0xf')]['gotoc']=function(_0x519315){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x13d'),_0x519315[_0x0fff('0x37')]));return this[_0x0fff('0x35')][_0x0fff('0x13e')](_0x519315[_0x0fff('0x3c')],_0x519315['extension'],_0x519315[_0x0fff('0x3d')]);};AGIVertices[_0x0fff('0xf')]['gotoif']=function(_0x1bf968){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1bf968['label']));if(!this[_0x0fff('0xa2')](_0x1bf968[_0x0fff('0x13f')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x1bf968,_0x0fff('0x140'));}try{var _0x4016ad=eval(_0x1bf968[_0x0fff('0x13f')])?'true':_0x0fff('0x141');this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x142'),_0x1bf968['condition'],_0x4016ad));return{'code':0xc8,'result':_0x4016ad};}catch(_0x1f417e){return{'code':0xc8,'result':_0x0fff('0x141')};}};AGIVertices[_0x0fff('0xf')]['gotoiftime']=function(_0x33d848){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x143'),_0x33d848[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x33d848[_0x0fff('0x144')])){return this[_0x0fff('0x35')]['error'](_0x33d848,_0x0fff('0x145'));}var _0xd3fbb3=this[_0x0fff('0x21')][_0x0fff('0x6d')](this,_0x33d848[_0x0fff('0x144')]);if(!_0xd3fbb3){return this['channel'][_0x0fff('0x29')](_0x33d848,_0x0fff('0x146'));}for(var _0x489906=0x0;_0x489906<_0xd3fbb3[_0x0fff('0x99')];_0x489906+=0x1){var _0x2c21f2=this[_0x0fff('0x35')][_0x0fff('0x10')](util[_0x0fff('0x25')](_0x0fff('0x147'),_0xd3fbb3[_0x489906]));if(_0x2c21f2[_0x0fff('0x9f')]===-0x1){return _0x2c21f2;}logger[_0x0fff('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0xd3fbb3[_0x489906],_0x2c21f2[_0x0fff('0xa1')]));if(_0x2c21f2[_0x0fff('0xa1')]===_0x0fff('0x148')){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x149'),_0xd3fbb3[_0x489906],_0x0fff('0x148')));this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x149'),_0xd3fbb3[_0x489906],_0x0fff('0x148')));return{'code':0xc8,'result':_0x0fff('0x148')};}else{logger['info'](util[_0x0fff('0x25')](_0x0fff('0x149'),_0xd3fbb3[_0x489906],_0x0fff('0x141')));this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')]('IFTIME\x20%s\x20%s',_0xd3fbb3[_0x489906],_0x0fff('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x0fff('0xf')][_0x0fff('0x14a')]=function(_0xdd4502){logger[_0x0fff('0x2d')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xdd4502['label']));return this[_0x0fff('0x35')][_0x0fff('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0x48910f){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x48910f[_0x0fff('0x37')]));if(!this['isConfigured'](_0x48910f['key'])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x12e'));}var _0x1ffe34='wav';var _0x899bd9=util['format'](_0x0fff('0x14b'),FILES_PATH,rs[_0x0fff('0x116')](0x4));var _0xcf4e8d=util[_0x0fff('0x25')](_0x0fff('0x9b'),_0x899bd9,_0x1ffe34);var _0x42f105=!![];if(_0x48910f[_0x0fff('0x130')]===_0x0fff('0x131')){_0x42f105=![];}var _0x43891e=this[_0x0fff('0x35')][_0x0fff('0x132')](_0x899bd9,_0x1ffe34,_0x48910f[_0x0fff('0x133')],_0x48910f[_0x0fff('0x64')],undefined,_0x42f105);if(_0x43891e[_0x0fff('0x9f')]!==-0x1){this[_0x0fff('0x35')][_0x0fff('0xab')](util['format'](_0x0fff('0x14c'),_0xcf4e8d));var _0x14fd5c=this['ispeechASR'][_0x0fff('0x6d')](this,_0x48910f,_0xcf4e8d);if(_0x14fd5c){for(var _0x182a8c in _0x14fd5c){if(_0x14fd5c[_0x0fff('0x96')](_0x182a8c)){this[_0x0fff('0x35')][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0x14d'),_0x182a8c['toUpperCase']()),_0x14fd5c[_0x182a8c]);}}return this[_0x0fff('0x35')][_0x0fff('0xab')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x0fff('0x71')](_0x14fd5c)));}}return _0x43891e;};AGIVertices[_0x0fff('0xf')][_0x0fff('0x14e')]=function(_0x139c76){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x14f'),_0x139c76['label']));if(!this['isConfigured'](_0x139c76[_0x0fff('0x79')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x12e'));}if(!this[_0x0fff('0xa2')](_0x139c76['text'])){return this['channel']['noop'](_0x0fff('0xc0'));}this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0x150'),_0x139c76[_0x0fff('0x60')]));var _0x53563c=this[_0x0fff('0x80')]['sync'](this,_0x139c76);if(_0x53563c){this['channel']['noop'](util[_0x0fff('0x25')](_0x0fff('0x14c'),_0x53563c));var _0x446bc2=this['channel'][_0x0fff('0x123')](_0x53563c,_0x139c76[_0x0fff('0x133')]);try{fs['unlink'](_0x53563c+_0x0fff('0xfd'));}catch(_0xc61a2a){logger['error'](_0xc61a2a);}return _0x446bc2;}return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x139c76,_0x0fff('0x151'));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x152')]=function(_0x235b17){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x153'),_0x235b17[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x235b17[_0x0fff('0x154')])){return this['channel'][_0x0fff('0x29')](_0x235b17,_0x0fff('0x155'));}logger['info'](util['format'](_0x0fff('0x156'),this['channel']['callerid'],_0x235b17[_0x0fff('0x154')]));var _0x51a219=this['agentLogin'][_0x0fff('0x6d')](this,_0x235b17[_0x0fff('0x154')]);if(_0x51a219){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x157'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x235b17[_0x0fff('0x154')]));this['channel']['noop'](util[_0x0fff('0x25')](_0x0fff('0x157'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x235b17[_0x0fff('0x154')]));return{'code':0xc8,'result':_0x0fff('0x158')};}else{logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x159'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x235b17[_0x0fff('0x154')]));this[_0x0fff('0x35')][_0x0fff('0xab')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x235b17[_0x0fff('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0fff('0xf')][_0x0fff('0x15a')]=function(_0x1e77b8){logger['info'](util[_0x0fff('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1e77b8[_0x0fff('0x37')]));if(!this['isConfigured'](_0x1e77b8['findBy'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x1e77b8,_0x0fff('0x155'));}logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x156'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1e77b8[_0x0fff('0x154')]));var _0x4c389c=this[_0x0fff('0x52')][_0x0fff('0x6d')](this,_0x1e77b8[_0x0fff('0x154')]);if(_0x4c389c){logger['info'](util['format'](_0x0fff('0x157'),this['channel'][_0x0fff('0x3a')],_0x1e77b8[_0x0fff('0x154')]));this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0x157'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1e77b8[_0x0fff('0x154')]));return{'code':0xc8,'result':_0x0fff('0x158')};}else{logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x159'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1e77b8[_0x0fff('0x154')]));this[_0x0fff('0x35')][_0x0fff('0xab')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x1e77b8['findBy']));return{'code':0xc8,'result':_0x0fff('0x15b')};}};AGIVertices['prototype']['math']=function(_0x45e098){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x15c'),_0x45e098['label']));if(!this[_0x0fff('0xa2')](_0x45e098['operation'])){return this[_0x0fff('0x35')]['error'](_0x45e098,_0x0fff('0x15d'));}this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x15e'),_0x45e098[_0x0fff('0x15f')]));var _0x36f7b1=eval(_0x45e098[_0x0fff('0x15f')]);if(!this[_0x0fff('0xa2')](_0x45e098[_0x0fff('0xd4')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x10e'));}var _0x18a6d1=this[_0x0fff('0x10')][_0x0fff('0x6d')](this,_0x45e098[_0x0fff('0xd4')]);if(!_0x18a6d1){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x45e098,_0x0fff('0x114'));}if(_['isArray'](_0x36f7b1)){var _0x4c6604=this;_0x36f7b1['forEach'](function(_0x8e1593,_0x29286f){_0x4c6604['channel'][_0x0fff('0x9c')](util[_0x0fff('0x25')](_0x0fff('0x160'),_0x18a6d1,_0x29286f),_0x8e1593);});return this['channel'][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x161'),_0x18a6d1));}else{return this[_0x0fff('0x35')][_0x0fff('0x9c')](_0x18a6d1,_0x36f7b1);}};AGIVertices['prototype']['menu']=function(_0x34f249){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x34f249[_0x0fff('0x37')]));if(_0x34f249[_0x0fff('0x10a')]===0x0){return this[_0x0fff('0xa3')](_0x34f249);}_0x34f249[_0x0fff('0x10a')]-=0x1;if(!this[_0x0fff('0xa2')](_0x34f249[_0x0fff('0x10b')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x34f249,'no\x20file\x20audio\x20selected');}var _0xeee123=this['getSound']['sync'](this,_0x34f249['file_id']);if(!_0xeee123){return this['channel']['error'](_0x34f249,_0x0fff('0x10d'));}var _0x54e8b9=this[_0x0fff('0x35')][_0x0fff('0x10f')](_0xeee123,_0x34f249[_0x0fff('0x110')],_0x34f249['digit']);var _0x527af9=_0x54e8b9['result'];if(_0x54e8b9[_0x0fff('0x9f')]===-0x1){this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x34f249,'-1');return _0x54e8b9;}else if(_0x54e8b9[_0x0fff('0xa1')]===_0x0fff('0x64')){_0x54e8b9['result']=_0x54e8b9[_0x0fff('0x9f')][_0x0fff('0x99')]>0x0?_0x54e8b9[_0x0fff('0x9f')]:'t';}else if(_['isEmpty'](_0x54e8b9[_0x0fff('0x9f')])){_0x54e8b9[_0x0fff('0x9f')]='#';_0x527af9='#';}if(!this[_0x0fff('0xa2')](_0x34f249[_0x0fff('0xd4')])){this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x10e'));}else{var _0x4227c5=this[_0x0fff('0x10')][_0x0fff('0x6d')](this,_0x34f249['variable_id']);if(!_0x4227c5){return this['channel'][_0x0fff('0x29')](_0x34f249,_0x0fff('0x114'));}this[_0x0fff('0x35')][_0x0fff('0x9c')](_0x4227c5,_0x527af9);}this[_0x0fff('0x34')]['sync'](this,_0x34f249,_0x527af9);return _0x54e8b9;};AGIVertices[_0x0fff('0xf')][_0x0fff('0xab')]=function(_0x4ad073){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x162'),_0x4ad073[_0x0fff('0x37')]));return this['channel'][_0x0fff('0xab')](_0x4ad073[_0x0fff('0x163')]||_0x4ad073[_0x0fff('0x37')]);};AGIVertices[_0x0fff('0xf')][_0x0fff('0x164')]=function(_0x4e0c48){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x165'),_0x4e0c48[_0x0fff('0x37')]));if(!this['isConfigured'](_0x4e0c48['findBy'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x4e0c48,_0x0fff('0x155'));}logger['info'](util[_0x0fff('0x25')](_0x0fff('0x156'),this['channel']['callerid'],_0x4e0c48[_0x0fff('0x154')]));var _0x24060b=this[_0x0fff('0x4e')][_0x0fff('0x6d')](this,_0x4e0c48[_0x0fff('0x166')]);var _0xd22656=this['agentPause'][_0x0fff('0x6d')](this,_0x4e0c48[_0x0fff('0x154')],_0x24060b);if(_0xd22656){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x157'),this['channel'][_0x0fff('0x3a')],_0x4e0c48['findBy']));this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x157'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x4e0c48[_0x0fff('0x154')]));return{'code':0xc8,'result':_0x0fff('0x158')};}else{logger['info'](util[_0x0fff('0x25')](_0x0fff('0x159'),this['channel']['callerid'],_0x4e0c48[_0x0fff('0x154')]));this[_0x0fff('0x35')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0fff('0x3a')],_0x4e0c48[_0x0fff('0x154')]));return{'code':0xc8,'result':_0x0fff('0x15b')};}};AGIVertices[_0x0fff('0xf')][_0x0fff('0x167')]=function(_0x46cfa2){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x168'),_0x46cfa2['label']));if(!this['isConfigured'](_0x46cfa2[_0x0fff('0x10b')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x46cfa2,'no\x20file\x20audio\x20selected');}var _0x56e8b0=this[_0x0fff('0x1c')][_0x0fff('0x6d')](this,_0x46cfa2[_0x0fff('0x10b')]);if(!_0x56e8b0){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x46cfa2,_0x0fff('0x10d'));}var _0x2bde15=this[_0x0fff('0x35')][_0x0fff('0xbe')](_0x0fff('0x169'),[_0x56e8b0,_0x46cfa2[_0x0fff('0xe0')]]);if(_0x2bde15['result']===-0x1){return _0x2bde15;}return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0xbc'),_0x0fff('0x169'),_0x56e8b0));};AGIVertices['prototype']['queue']=function(_0x155f21){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x16a'),_0x155f21[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x155f21['queue_id'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x155f21,_0x0fff('0x16b'));}var _0x134a1c='';var _0x4a193f=parseInt(_0x155f21[_0x0fff('0x16c')],0xa);if(isNaN(_0x4a193f)){_0x134a1c=_0x155f21[_0x0fff('0x16c')];}else{_0x134a1c=this['getVoiceQueue'][_0x0fff('0x6d')](this,_0x155f21[_0x0fff('0x16c')]);if(!_0x134a1c){return this[_0x0fff('0x35')]['error'](_0x155f21,_0x0fff('0x16d'));}}var _0x3232d1='';if(this[_0x0fff('0xa2')](_0x155f21[_0x0fff('0x10b')])){var _0x7bb684=this[_0x0fff('0x1c')][_0x0fff('0x6d')](this,_0x155f21[_0x0fff('0x10b')]);if(_0x7bb684){_0x3232d1=_0x7bb684;}}this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x155f21,_0x134a1c);if(_0x155f21[_0x0fff('0xe0')]['indexOf']('x')<0x0){_0x155f21['opts']+='x';}if(_0x155f21[_0x0fff('0xe0')][_0x0fff('0x16e')]('X')<0x0){_0x155f21[_0x0fff('0xe0')]+='X';}this[_0x0fff('0x35')]['setVariable']('XMCS-QUEUE',_0x134a1c?_0x134a1c[_0x0fff('0x16f')]():'');var _0x53299c=this[_0x0fff('0x35')][_0x0fff('0xbe')](_0x0fff('0x170'),[_0x134a1c,_0x155f21['opts'],_0x155f21[_0x0fff('0x62')],_0x3232d1,_0x155f21['timeout'],_0x155f21[_0x0fff('0x6')],_0x155f21[_0x0fff('0x171')],_0x155f21['gosub'],'',_0x155f21[_0x0fff('0x172')]]);if(_0x53299c[_0x0fff('0x9f')]===-0x1){return _0x53299c;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xbc'),_0x0fff('0x170'),_0x134a1c));};AGIVertices['prototype'][_0x0fff('0x173')]=function(_0x4c62df){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x174'),_0x4c62df['label']));var _0x5bae19=_0x4c62df[_0x0fff('0x175')]||_0x0fff('0x12f');var _0x4a1d04=util[_0x0fff('0x25')]('%s_%s',this[_0x0fff('0x35')][_0x0fff('0x36')],rs[_0x0fff('0x116')](0x5));var _0xac5c47=util[_0x0fff('0x25')](_0x0fff('0x176'),FILES_PATH,_0x4a1d04,_0x5bae19);var _0x5a5d3b=util[_0x0fff('0x25')]('%s/recordings/%s',FILES_PATH,_0x4a1d04);this[_0x0fff('0x3b')]['sync'](this,_0x4c62df,_0x4a1d04,_0xac5c47);this[_0x0fff('0x35')][_0x0fff('0x9c')](_0x0fff('0x177'),_0x4a1d04);logger[_0x0fff('0x2d')](_0x0fff('0x178'),_0x5a5d3b,_0x5bae19,_0x4c62df[_0x0fff('0x179')],_0x4c62df[_0x0fff('0x64')]);return this['channel'][_0x0fff('0x132')](_0x5a5d3b,_0x5bae19,_0x4c62df['escape_digits'],_0x4c62df[_0x0fff('0x64')],undefined,!![]);};AGIVertices[_0x0fff('0xf')][_0x0fff('0x17a')]=function(_0x53e0c4){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x17b'),_0x53e0c4[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x53e0c4[_0x0fff('0x62')])){return this[_0x0fff('0x35')]['noop'](_0x0fff('0x17c'));}var _0x47946a=this['restAPI'][_0x0fff('0x6d')](this,_0x53e0c4);logger['info'](util['format'](_0x0fff('0x17d'),util[_0x0fff('0x17e')](_0x47946a,{'showHidden':![],'depth':null})));if(!this[_0x0fff('0xa2')](_0x53e0c4[_0x0fff('0xd4')])){return this['channel'][_0x0fff('0xab')](_0x0fff('0x17f'));}var _0xa89975=this['getVariable'][_0x0fff('0x6d')](this,_0x53e0c4[_0x0fff('0xd4')]);if(!_0xa89975){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x53e0c4,_0x0fff('0x114'));}this[_0x0fff('0x35')]['setVariable'](util[_0x0fff('0x25')](_0x0fff('0x180'),_0xa89975),_0x47946a[_0x0fff('0x75')]?_0x47946a[_0x0fff('0x75')]:_0x0fff('0x181'));this['channel']['setVariable'](util[_0x0fff('0x25')](_0x0fff('0x182'),_0xa89975),_0x47946a['statusMessage']?_0x47946a[_0x0fff('0x74')]:'OK');if(_0x47946a[_0x0fff('0x72')]){try{this[_0x0fff('0x9a')](_0x47946a[_0x0fff('0x72')],_0xa89975);}catch(_0x2c07c9){logger[_0x0fff('0x29')](util[_0x0fff('0x25')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xa89975));}}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xd8'),_0xa89975));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x183')]=function(_0x499f0f){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x184'),_0x499f0f[_0x0fff('0x37')]));return this[_0x0fff('0x35')][_0x0fff('0x185')](_0x499f0f[_0x0fff('0x186')][_0x0fff('0x56')](/\s+/g,''),_0x499f0f['escape_digits']);};AGIVertices[_0x0fff('0xf')]['saynumber']=function(_0x32ed28){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x187'),_0x32ed28[_0x0fff('0x37')]));return this[_0x0fff('0x35')][_0x0fff('0x188')](_0x32ed28[_0x0fff('0x65')][_0x0fff('0x56')](/\s+/g,''),_0x32ed28['escape_digits']);};AGIVertices[_0x0fff('0xf')]['sayphonetic']=function(_0x2abbc4){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x189'),_0x2abbc4['label']));return this[_0x0fff('0x35')][_0x0fff('0x18a')](_0x2abbc4['text'],_0x2abbc4[_0x0fff('0x179')]);};AGIVertices['prototype'][_0x0fff('0x18b')]=function(_0x1ae0a8){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x18c'),_0x1ae0a8[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x1ae0a8[_0x0fff('0x18d')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x18e'));}var _0x55f2bd=this[_0x0fff('0x18f')]['sync'](this,_0x1ae0a8[_0x0fff('0x18d')]);if(!_0x55f2bd||!_0x55f2bd[_0x0fff('0x190')]){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x1ae0a8,'no\x20mail\x20account\x20found');}var _0x54b51a={'from':util[_0x0fff('0x25')](_0x0fff('0x191'),_0x55f2bd[_0x0fff('0x13')],_0x55f2bd[_0x0fff('0x192')]||_0x55f2bd[_0x0fff('0x190')][_0x0fff('0x193')]),'to':_0x1ae0a8['to']||'','cc':_0x1ae0a8['cc']||'','bcc':_0x1ae0a8[_0x0fff('0x194')]||'','subject':_0x1ae0a8[_0x0fff('0x195')],'html':_0x1ae0a8[_0x0fff('0x60')],'text':_0x1ae0a8['text']};var _0x33c125=_0x55f2bd[_0x0fff('0x196')]();if(this[_0x0fff('0xa2')](_0x1ae0a8[_0x0fff('0x197')])){}logger['debug']('sendMail\x20message',JSON[_0x0fff('0x71')](_0x54b51a));this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x1ae0a8,_0x1ae0a8[_0x0fff('0x18d')]);this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x198'),_0x55f2bd[_0x0fff('0x13')]));this['sendMailMessage']['sync'](this,_0x33c125,_0x54b51a);return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x199'));};AGIVertices['prototype'][_0x0fff('0x19a')]=function(_0x26ae35){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x19b'),_0x26ae35[_0x0fff('0x37')]));return this[_0x0fff('0x35')][_0x0fff('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x0fff('0xf')][_0x0fff('0x19c')]=function(_0x8723d4){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x19d'),_0x8723d4[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x8723d4[_0x0fff('0x19e')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x19f'));}var _0x5de936=this['getSmsAccount'][_0x0fff('0x6d')](this,_0x8723d4[_0x0fff('0x19e')]);if(!_0x5de936){return this['channel'][_0x0fff('0x29')](_0x8723d4,_0x0fff('0x1a0'));}var _0x1a06de={'body':_0x8723d4[_0x0fff('0x1a1')],'phone':_0x8723d4['to']||'','SmsAccountId':_0x5de936['id']};logger['debug'](_0x0fff('0x1a2'),JSON[_0x0fff('0x71')](_0x1a06de));this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x8723d4,_0x8723d4[_0x0fff('0x19e')]);this[_0x0fff('0x35')][_0x0fff('0xab')](util['format'](_0x0fff('0x1a3'),_0x5de936[_0x0fff('0x13')]));this['createSmsMessage'][_0x0fff('0x6d')](this,_0x1a06de);return this['channel']['noop'](_0x0fff('0x1a4'));};AGIVertices['prototype'][_0x0fff('0x1a5')]=function(_0x1bd032){logger['info'](util[_0x0fff('0x25')](_0x0fff('0x1a6'),_0x1bd032[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x1bd032[_0x0fff('0xd4')])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x1bd032,_0x0fff('0x1a7'));}var _0x37ee08=this[_0x0fff('0x10')]['sync'](this,_0x1bd032['variable_id']);if(!_0x37ee08){return this[_0x0fff('0x35')]['error'](_0x1bd032,_0x0fff('0x114'));}return this[_0x0fff('0x35')]['setVariable'](_0x37ee08,_0x1bd032[_0x0fff('0x1a8')]);};AGIVertices[_0x0fff('0xf')]['start']=function(_0x30d340){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x1a9'),_0x30d340['label']));this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x1aa'));if(_0x30d340[_0x0fff('0xb4')]===_0x0fff('0x1ab')){this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x1ac'));return this['channel'][_0x0fff('0xb4')]();}return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0x1ad'));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x1ae')]=function(_0x39b77d){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x1af'),_0x39b77d[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x39b77d['project_id'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x39b77d,_0x0fff('0x1b0'));}var _0x7f082a=this[_0x0fff('0x15')]['sync'](this,_0x39b77d[_0x0fff('0x1b1')]);if(!this['isConfigured'](_0x7f082a)){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x39b77d,util[_0x0fff('0x25')](_0x0fff('0x1b2'),_0x39b77d['project_id']));}if(_0x7f082a===this[_0x0fff('0x35')][_0x0fff('0x39')]){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x39b77d,_0x0fff('0x1b3'));}this[_0x0fff('0x34')][_0x0fff('0x6d')](this,_0x39b77d,_0x7f082a);var _0x15ddb7=this[_0x0fff('0x35')][_0x0fff('0xbe')]('AGI',util[_0x0fff('0x25')](_0x0fff('0x1b4'),config[_0x0fff('0x6')][_0x0fff('0x1b5')]||_0x0fff('0x1b6'),_0x7f082a,this[_0x0fff('0x35')][_0x0fff('0x39')]));if(_0x15ddb7['result']===-0x1){return _0x15ddb7;}return this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0xbc'),_0x0fff('0x1b7'),_0x7f082a));};AGIVertices[_0x0fff('0xf')]['system']=function(_0x208dea){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x1b8'),_0x208dea[_0x0fff('0x37')]));var _0x33763f=this['shellCommand']['sync'](this,_0x208dea[_0x0fff('0xb2')]);this['createSquareDetailsReport'][_0x0fff('0x6d')](this,_0x208dea,_0x208dea[_0x0fff('0xb2')]);if(this[_0x0fff('0xa2')](_0x208dea[_0x0fff('0xd4')])){var _0x339cfd=this[_0x0fff('0x10')][_0x0fff('0x6d')](this,_0x208dea[_0x0fff('0xd4')]);if(_0x339cfd){this[_0x0fff('0x35')]['setVariable'](_0x339cfd,_0x33763f);return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x208dea[_0x0fff('0xb2')],_0x339cfd));}}return this['channel'][_0x0fff('0xab')](util[_0x0fff('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x208dea['command']));};AGIVertices['prototype'][_0x0fff('0x1b9')]=function(_0x5d6601){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x1ba'),_0x5d6601[_0x0fff('0x37')]));_0x5d6601[_0x0fff('0x60')]=_0x5d6601['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0fff('0xa2')](_0x5d6601[_0x0fff('0x58')])){return this['channel']['noop'](_0x0fff('0x1bb'));}if(!this['isConfigured'](_0x5d6601[_0x0fff('0x60')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xc0'));}this['channel'][_0x0fff('0xab')](util['format'](_0x0fff('0x1bc'),_0x5d6601[_0x0fff('0x60')]));var _0x4828ce=this['googleCloudTTS'][_0x0fff('0x6d')](this,_0x5d6601);if(_0x4828ce){this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x1bd'),_0x4828ce));var _0x60e025=this[_0x0fff('0x35')]['streamFile'](_0x4828ce);try{fs[_0x0fff('0x124')](_0x4828ce+_0x0fff('0xfd'));}catch(_0x3e71d1){logger['error'](_0x3e71d1);}return _0x60e025;}return this['channel'][_0x0fff('0x29')](_0x5d6601,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0fff('0xf')]['tts']=function(_0x52a354){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x1be'),_0x52a354['label']));_0x52a354['text']=_0x52a354[_0x0fff('0x60')][_0x0fff('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0fff('0xa2')](_0x52a354[_0x0fff('0x60')])){return this[_0x0fff('0x35')][_0x0fff('0xab')](_0x0fff('0xc0'));}this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0x1bf'),_0x52a354[_0x0fff('0x60')]));var _0x3a5b96=this[_0x0fff('0x5f')][_0x0fff('0x6d')](this,_0x52a354);if(_0x3a5b96){this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')]('Google\x20TTS\x20%s\x20file\x20created',_0x3a5b96));var _0x5259b6=this[_0x0fff('0x35')][_0x0fff('0x123')](_0x3a5b96);try{fs[_0x0fff('0x124')](_0x3a5b96+_0x0fff('0xfd'));}catch(_0x2748c6){logger['error'](_0x2748c6);}return _0x5259b6;}return this['channel']['error'](_0x52a354,_0x0fff('0x1c0'));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x1c1')]=function(_0x1753ee){logger['info'](util['format'](_0x0fff('0x1c2'),_0x1753ee[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x1753ee['findBy'])){return this[_0x0fff('0x35')][_0x0fff('0x29')](_0x1753ee,_0x0fff('0x155'));}logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x156'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1753ee['findBy']));var _0x403a97=this[_0x0fff('0x51')][_0x0fff('0x6d')](this,_0x1753ee[_0x0fff('0x154')]);if(_0x403a97){logger['info'](util[_0x0fff('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1753ee[_0x0fff('0x154')]));this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0x157'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1753ee[_0x0fff('0x154')]));return{'code':0xc8,'result':_0x0fff('0x158')};}else{logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x159'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1753ee[_0x0fff('0x154')]));this[_0x0fff('0x35')]['noop'](util[_0x0fff('0x25')](_0x0fff('0x159'),this[_0x0fff('0x35')][_0x0fff('0x3a')],_0x1753ee[_0x0fff('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0fff('0x1c3')]=function(_0x1b03fd){logger[_0x0fff('0x2d')](util['format'](_0x0fff('0x1c4'),_0x1b03fd[_0x0fff('0x37')]));var _0x176cb8=this[_0x0fff('0x35')][_0x0fff('0xbe')]('VOICEMAIL',[_0x1b03fd[_0x0fff('0x1c5')],_0x1b03fd[_0x0fff('0x77')]]);if(_0x176cb8['result']===-0x1){return _0x176cb8;}return this[_0x0fff('0x35')][_0x0fff('0xab')](util[_0x0fff('0x25')](_0x0fff('0xbc'),_0x0fff('0x1c6'),_0x1b03fd[_0x0fff('0x1c5')]));};AGIVertices[_0x0fff('0xf')][_0x0fff('0x1c7')]=function(_0x20f1df){logger[_0x0fff('0x2d')](util[_0x0fff('0x25')](_0x0fff('0x1c8'),_0x20f1df[_0x0fff('0x37')]));if(!this[_0x0fff('0xa2')](_0x20f1df[_0x0fff('0xd4')])){return this['channel'][_0x0fff('0x29')](_0x20f1df,_0x0fff('0x1a7'));}var _0x35ef18=this['getVariable']['sync'](this,_0x20f1df['variable_id']);if(!_0x35ef18){return this[_0x0fff('0x35')]['error'](_0x20f1df,_0x0fff('0x114'));}var _0x46f6ab=this[_0x0fff('0x35')][_0x0fff('0x10')](_0x35ef18);return{'code':0xc8,'result':_0x46f6ab[_0x0fff('0xa1')]?_0x46f6ab[_0x0fff('0xa1')]:'-'};};String[_0x0fff('0xf')][_0x0fff('0x9e')]=function(_0x356d4b,_0xdbad){return this[_0x0fff('0x9d')](_0x356d4b)[_0x0fff('0x1c9')](_0xdbad);};module['exports']=AGIVertices; \ No newline at end of file +var _0xd943=['render','body','stringify','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','appid','appsecret','uri','clear','includes','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','hasOwnProperty','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','getSquareOdbc','odbc_id','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_access_key_id','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','recordFile','tildeASR','TildeASR\x20Result\x20%s','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','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','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','getSmtpOptions','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','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','unpause','voicemail','VOICEMAIL','mailbox','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','./scripts','menu','getdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','url','timeout','number','POST','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync'];(function(_0x56f6cc,_0x204cdc){var _0xba92c6=function(_0x295098){while(--_0x295098){_0x56f6cc['push'](_0x56f6cc['shift']());}};_0xba92c6(++_0x204cdc);}(_0xd943,0x15d));var _0x3d94=function(_0x1813e8,_0x29b96b){_0x1813e8=_0x1813e8-0x0;var _0x38f783=_0xd943[_0x1813e8];return _0x38f783;};'use strict';var fs=require('fs');var util=require(_0x3d94('0x0'));var _=require(_0x3d94('0x1'));var sh=require(_0x3d94('0x2'));var odbc=require(_0x3d94('0x3'))();var rs=require('randomstring');var moment=require(_0x3d94('0x4'));var Mustache=require(_0x3d94('0x5'));var rp=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0x3d94('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x3d94('0xa'),_0x3d94('0xb'),'getsecretdigits'];var AGIVertices=function(_0x512766,_0x3984a3,_0x27e381){this[_0x3d94('0xc')]=_0x512766;this['rpc']=_0x3984a3;this[_0x3d94('0xd')]=_0x27e381;};AGIVertices['prototype'][_0x3d94('0xe')]=function(_0x301536,_0x5f5041){this[_0x3d94('0xf')][_0x3d94('0x10')](_0x301536)[_0x3d94('0x11')](function(_0x368825){_0x5f5041(null,_0x368825?_0x368825[_0x3d94('0x12')]:![]);})['catch'](function(_0x96c54b){_0x5f5041(_0x96c54b);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x14')]=function(_0x4c167c,_0x24e8b9){this[_0x3d94('0xf')][_0x3d94('0x15')](_0x4c167c)['then'](function(_0x14ea5f){_0x24e8b9(null,_0x14ea5f?_0x14ea5f[_0x3d94('0x12')]:![]);})[_0x3d94('0x16')](function(_0x34098e){_0x24e8b9(_0x34098e);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x17')]=function(_0x31c6e8,_0x9893cb){this['rpc'][_0x3d94('0x18')](_0x31c6e8)[_0x3d94('0x11')](function(_0x2acee3){_0x9893cb(null,_0x2acee3?_0x2acee3[_0x3d94('0x12')]:![]);})[_0x3d94('0x16')](function(_0x3ca0e3){_0x9893cb(_0x3ca0e3);});};AGIVertices[_0x3d94('0x13')]['getSquareOdbc']=function(_0x9bca24,_0x59b741){this[_0x3d94('0xf')][_0x3d94('0x19')](_0x9bca24)[_0x3d94('0x11')](function(_0x1e9ec2){_0x59b741(null,_0x1e9ec2?_0x1e9ec2[_0x3d94('0x1a')]:![]);})['catch'](function(_0x578002){_0x59b741(_0x578002);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1b')]=function(_0x9c2f2c,_0x4edee4){this[_0x3d94('0xf')][_0x3d94('0x1c')](_0x9c2f2c)[_0x3d94('0x11')](function(_0x384f76){_0x4edee4(null,_0x384f76?_0x384f76[_0x3d94('0x12')]:![]);})[_0x3d94('0x16')](function(_0x295493){_0x4edee4(_0x295493);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1d')]=function(_0x18f58c,_0x30368c){this[_0x3d94('0xf')][_0x3d94('0x1e')](_0x18f58c)[_0x3d94('0x11')](function(_0x2945d2){_0x30368c(null,_0x2945d2?_0x2945d2['name']:![]);})[_0x3d94('0x16')](function(_0x558fd2){_0x30368c(_0x558fd2);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1f')]=function(_0xc2885,_0x439173){var _0x13254f=this;this[_0x3d94('0xf')][_0x3d94('0x20')](_0xc2885)['then'](function(_0x584c4a){_0x439173(null,_0x584c4a?_0x13254f[_0x3d94('0x21')](_0x584c4a['save_name']):![]);})['catch'](function(_0x23d20d){_0x439173(_0x23d20d);});};AGIVertices['prototype'][_0x3d94('0x22')]=function(_0xef9644,_0x32403a){this['rpc'][_0x3d94('0x23')](_0xef9644)['then'](function(_0x3d4994){_0x32403a(null,_0x3d4994?_0x3d4994:![]);})['catch'](function(_0x1c19b1){_0x32403a(_0x1c19b1);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x24')]=function(_0x246f88,_0x50560c,_0x18f854){this['mailRpc'][_0x3d94('0x24')](_0x246f88,_0x50560c)[_0x3d94('0x11')](function(){_0x18f854(null);})['catch'](function(_0x5288da){_0x18f854(_0x5288da);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x25')]=function(_0x273337,_0x5cdb2e){this[_0x3d94('0xf')][_0x3d94('0x26')](_0x273337)['then'](function(_0x242500){if(_0x242500){if(_0x242500[_0x3d94('0x27')]){_0x5cdb2e(null,[_0x242500[_0x3d94('0x28')]]);}else{_0x5cdb2e(null,_[_0x3d94('0x29')](_0x242500[_0x3d94('0x2a')],'interval'));}}else{_0x5cdb2e(null,![]);}})[_0x3d94('0x16')](function(_0x42b742){_0x5cdb2e(_0x42b742);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x21')]=function(_0xb493f1){return util[_0x3d94('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0xb493f1);};AGIVertices['prototype'][_0x3d94('0x2c')]=function(_0x3e4d64,_0x1c1b25,_0x438ba3){odbc[_0x3d94('0x2d')](_0x3e4d64,function(_0x40a3d8){if(_0x40a3d8){logger[_0x3d94('0x2e')](_0x3d94('0x2f'),_0x40a3d8);_0x438ba3(_0x40a3d8);}else{logger[_0x3d94('0x30')](_0x3d94('0x31'));odbc['query'](_0x1c1b25,function(_0x6b2b1f,_0x21afb5){if(_0x6b2b1f){logger[_0x3d94('0x30')](_0x3d94('0x32'),_0x1c1b25);_0x438ba3(_0x6b2b1f);}else{logger['info'](_0x3d94('0x33'),_0x1c1b25);odbc[_0x3d94('0x34')](function(_0x35e0e6){if(_0x35e0e6){logger[_0x3d94('0x2e')](_0x3d94('0x35'),_0x35e0e6);}_0x438ba3(null,_0x21afb5);});}});}});};AGIVertices['prototype'][_0x3d94('0x36')]=function(_0x462ab6,_0x1d3d41){this['rpc']['getSmsAccountById'](_0x462ab6)['then'](function(_0x47905e){_0x1d3d41(null,_0x47905e?_0x47905e:![]);})[_0x3d94('0x16')](function(_0x22f52c){_0x1d3d41(_0x22f52c);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x37')]=function(_0x1a2348,_0x24a522){this[_0x3d94('0xf')]['createSmsMessage'](_0x1a2348)['then'](function(_0x118fda){_0x24a522(null,_0x118fda);})[_0x3d94('0x16')](function(_0x512cef){_0x24a522(_0x512cef);});};AGIVertices[_0x3d94('0x13')]['createSquareDetailsReport']=function(_0x1361fb,_0x411b5b,_0x3c9ebc){this[_0x3d94('0xf')][_0x3d94('0x38')]({'uniqueid':this['channel'][_0x3d94('0x39')],'node':_0x1361fb[_0x3d94('0x3a')],'application':_0x1361fb[_0x3d94('0x3b')],'data':_0x411b5b||null,'project_name':this['channel'][_0x3d94('0x3c')],'callerid':this['channel']['callerid']})[_0x3d94('0x11')](function(_0x402132){if(_0x3c9ebc){_0x3c9ebc(null,_0x402132);}})[_0x3d94('0x16')](function(_0xfeae3a){if(_0x3c9ebc){_0x3c9ebc(_0xfeae3a);}});};AGIVertices['prototype'][_0x3d94('0x3d')]=function(_0x4a4b74,_0x26426e,_0x37c747,_0x35c911){this[_0x3d94('0xf')][_0x3d94('0x3d')]({'uniqueid':this[_0x3d94('0xc')][_0x3d94('0x39')],'callerid':this['channel'][_0x3d94('0x3e')],'calleridname':this[_0x3d94('0xc')]['calleridname'],'context':this['channel'][_0x3d94('0x3f')],'extension':this[_0x3d94('0xc')]['extension'],'priority':this[_0x3d94('0xc')][_0x3d94('0x40')],'accountcode':this[_0x3d94('0xc')][_0x3d94('0x41')],'dnid':this[_0x3d94('0xc')][_0x3d94('0x42')],'projectName':this[_0x3d94('0xc')][_0x3d94('0x3c')],'saveName':_0x26426e,'filename':_0x4a4b74[_0x3d94('0x43')]||_0x26426e,'savePath':_0x37c747})[_0x3d94('0x11')](function(_0x4075ef){_0x35c911(null,_0x4075ef);})[_0x3d94('0x16')](function(_0x2dad4f){_0x35c911(_0x2dad4f);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x44')]=function(_0x49209b,_0x44df82,_0x22e2b8,_0x1a9338,_0x33d36a){this[_0x3d94('0xf')][_0x3d94('0x44')]({'uniqueid':this[_0x3d94('0xc')][_0x3d94('0x39')],'body':_0x49209b,'direction':_0x44df82,'providerName':_0x22e2b8,'providerResponse':_0x1a9338})[_0x3d94('0x11')](function(_0x5465a5){if(_0x33d36a){_0x33d36a(null,_0x5465a5);}})[_0x3d94('0x16')](function(_0x5799df){if(_0x33d36a){_0x33d36a(_0x5799df);}});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x45')]=function(_0x4af4c2,_0x255630){this['rpc']['createCmContact']({'firstName':_[_0x3d94('0x46')](_0x4af4c2['name'])||_[_0x3d94('0x47')](_0x4af4c2[_0x3d94('0x12')])?'callback_'+Math[_0x3d94('0x48')]():_0x4af4c2['name'],'lastName':_['isEmpty'](_0x4af4c2[_0x3d94('0x49')])||_[_0x3d94('0x47')](_0x4af4c2[_0x3d94('0x49')])?null:_0x4af4c2[_0x3d94('0x49')],'phone':_0x4af4c2[_0x3d94('0x4a')],'ListId':_0x4af4c2[_0x3d94('0x4b')],'scheduledat':_0x4af4c2[_0x3d94('0x4c')],'callbackUniqueid':this[_0x3d94('0xc')][_0x3d94('0x39')],'tags':'callback','description':_0x3d94('0x4d')+_0x4af4c2[_0x3d94('0x4c')][_0x3d94('0x4e')](),'priority':_0x4af4c2[_0x3d94('0x4f')]})[_0x3d94('0x11')](function(_0x3e1992){_0x255630(null,_0x3e1992);})[_0x3d94('0x16')](function(_0x126894){_0x255630(_0x126894);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x50')]=function(_0x1fd806,_0x5eba38){this[_0x3d94('0xf')]['getPauseById'](_0x1fd806)[_0x3d94('0x11')](function(_0x3a30f7){_0x5eba38(null,_0x3a30f7?_0x3a30f7[_0x3d94('0x12')]:![]);})[_0x3d94('0x16')](function(_0x3a837b){_0x5eba38(_0x3a837b);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x51')]=function(_0x169aa1,_0x9d9ad9,_0x5da38c){var _0x519ada={'role':_0x3d94('0x52')};_0x519ada[_0x169aa1]=this['channel'][_0x3d94('0x3e')];this[_0x3d94('0xf')]['agentPause'](_0x519ada,_0x9d9ad9,this[_0x3d94('0xc')][_0x3d94('0x39')])[_0x3d94('0x11')](function(_0x467648){_0x5da38c(null,_[_0x3d94('0x47')](_0x467648)?![]:!![]);})[_0x3d94('0x16')](function(_0xd3bb){logger['error'](_0xd3bb);_0x5da38c(null,![]);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x53')]=function(_0x368581,_0x4b23b5){var _0x2d8b49={'role':_0x3d94('0x52')};_0x2d8b49[_0x368581]=this[_0x3d94('0xc')][_0x3d94('0x3e')];this['rpc']['agentUnpause'](_0x2d8b49)[_0x3d94('0x11')](function(_0x38b2fa){_0x4b23b5(null,_[_0x3d94('0x47')](_0x38b2fa)?![]:!![]);})[_0x3d94('0x16')](function(_0x4f9e83){logger[_0x3d94('0x2e')](_0x4f9e83);_0x4b23b5(null,![]);});};AGIVertices[_0x3d94('0x13')]['agentLogout']=function(_0x5ba865,_0x250c87){var _0x336e36={'role':'agent'};_0x336e36[_0x5ba865]=this[_0x3d94('0xc')][_0x3d94('0x3e')];this[_0x3d94('0xf')]['agentLogout'](_0x336e36)[_0x3d94('0x11')](function(_0x68c033){_0x250c87(null,_['isNil'](_0x68c033)?![]:!![]);})['catch'](function(_0x4e1932){logger[_0x3d94('0x2e')](_0x4e1932);_0x250c87(null,![]);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x54')]=function(_0x37a2e1,_0x196ed6){var _0x4ecfa2={'role':_0x3d94('0x52')};_0x4ecfa2[_0x37a2e1]=this[_0x3d94('0xc')][_0x3d94('0x3e')];var _0x1e8e3d=_0x37a2e1!=_0x3d94('0x55')?util[_0x3d94('0x2b')]('%s/%s@from-sip/n',_0x3d94('0x56'),this['channel'][_0x3d94('0x3e')]):undefined;this[_0x3d94('0xf')][_0x3d94('0x54')](_0x4ecfa2,_0x1e8e3d)[_0x3d94('0x11')](function(_0x128fdc){_0x196ed6(null,_[_0x3d94('0x47')](_0x128fdc)?![]:!![]);})['catch'](function(_0x4dc5aa){logger[_0x3d94('0x2e')](_0x4dc5aa);_0x196ed6(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x5c5fb2,_0x3c7dc4){sh[_0x3d94('0x57')](_[_0x3d94('0x58')](_0x5c5fb2),function(_0x396146,_0xb20f94){var _0x2e2fb0=_0xb20f94[_0x3d94('0x59')](/(\r\n|\n|\r)/gm,'');_0x3c7dc4(null,_0x2e2fb0);});};AGIVertices[_0x3d94('0x13')]['googleCloudTTS']=function(_0x22917e,_0x5e55a4){scripts[_0x3d94('0x5a')](_0x22917e[_0x3d94('0x5b')],_0x22917e[_0x3d94('0x5c')]||'text',_0x22917e['text'],_0x22917e['languageCode']||_0x3d94('0x5d'),_0x22917e[_0x3d94('0x5e')]||_0x3d94('0x5f'),_0x22917e[_0x3d94('0x60')]||_0x3d94('0x61'))['then'](function(_0x5b7316){_0x5e55a4(null,_0x5b7316);})[_0x3d94('0x16')](function(_0x404d36){_0x5e55a4(_0x404d36);});};AGIVertices[_0x3d94('0x13')]['googleTTS']=function(_0x46a9af,_0x53d471){scripts[_0x3d94('0x62')](_0x46a9af[_0x3d94('0x63')],_0x46a9af[_0x3d94('0x64')]||'en',0x1)[_0x3d94('0x11')](function(_0x3b42c8){_0x53d471(null,_0x3b42c8);})[_0x3d94('0x16')](function(_0x234bce){_0x53d471(_0x234bce);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x65')]=function(_0xf0d4eb,_0x3dbf5c){var _0xe6cfd1={'uri':_0xf0d4eb[_0x3d94('0x66')],'method':_0xf0d4eb['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xf0d4eb[_0x3d94('0x67')])===_0x3d94('0x68')&&parseInt(_0xf0d4eb[_0x3d94('0x67')])>=0x1?parseInt(_0xf0d4eb[_0x3d94('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x3d94('0x69'),'PUT'],_0xe6cfd1['method'][_0x3d94('0x6a')]())){try{_0xe6cfd1['body']=_0xf0d4eb[_0x3d94('0x6b')]?JSON[_0x3d94('0x6c')](_0xf0d4eb['rawBody']):{};}catch(_0x4558ff){logger['error'](_0x3d94('0x6d'),_0x4558ff);}}try{_0xe6cfd1[_0x3d94('0x6e')]=_0xf0d4eb['rawHeaders']?JSON['parse'](_0xf0d4eb['rawHeaders']):{};}catch(_0x833d96){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x833d96);}if(_0xf0d4eb[_0x3d94('0x6f')]){try{var _0x39ea2a=require(_0xf0d4eb[_0x3d94('0x6f')])[_0x3d94('0x70')](this,_0xe6cfd1);_0xe6cfd1['uri']=Mustache[_0x3d94('0x71')](_0xf0d4eb[_0x3d94('0x66')],_0x39ea2a,{},['$$','$$']);if(_0xe6cfd1[_0x3d94('0x6e')]){_0xe6cfd1[_0x3d94('0x6e')]=JSON[_0x3d94('0x6c')](Mustache[_0x3d94('0x71')](JSON['stringify'](_0xe6cfd1[_0x3d94('0x6e')]),_0x39ea2a,{},['$$','$$']));}if(_0xe6cfd1[_0x3d94('0x72')]){_0xe6cfd1[_0x3d94('0x72')]=JSON[_0x3d94('0x6c')](Mustache[_0x3d94('0x71')](JSON[_0x3d94('0x73')](_0xe6cfd1[_0x3d94('0x72')]),_0x39ea2a,{},['$$','$$']));}}catch(_0x42d2c0){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x42d2c0);}}rp(_0xe6cfd1)[_0x3d94('0x11')](function(_0x23b1a6){var _0x970b44={'statusCode':_0x23b1a6['statusCode']||0xc8,'statusMessage':_0x23b1a6[_0x3d94('0x74')]||'OK','headers':_0x23b1a6[_0x3d94('0x6e')]||{},'body':_0x23b1a6[_0x3d94('0x72')]||{}};_0x3dbf5c(null,_0x970b44);})[_0x3d94('0x16')](function(_0x860ee5){var _0x492b12={'statusCode':_0x860ee5['statusCode']||0x1f4,'statusMessage':_0x860ee5[_0x3d94('0x75')]||_0x3d94('0x76'),'headers':_0x860ee5[_0x3d94('0x77')][_0x3d94('0x6e')]||{},'body':_0x860ee5[_0x3d94('0x77')][_0x3d94('0x72')]||{}};_0x3dbf5c(null,_0x492b12);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x78')]=function(_0x462e88,_0x35caf5){scripts[_0x3d94('0x78')](this[_0x3d94('0xc')][_0x3d94('0x39')],_0x462e88['key'],_0x462e88[_0x3d94('0x63')],_0x462e88[_0x3d94('0x79')]||'en')['then'](function(_0x5d3d6e){_0x35caf5(null,_0x5d3d6e);})[_0x3d94('0x16')](function(_0xf935c7){_0x35caf5(_0xf935c7);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x7a')]=function(_0x4f323c,_0x482e99){scripts[_0x3d94('0x7a')](this[_0x3d94('0xc')][_0x3d94('0x39')],_0x4f323c[_0x3d94('0x7b')],_0x4f323c[_0x3d94('0x7c')],_0x4f323c['private_key'],_0x4f323c[_0x3d94('0x63')],_0x4f323c['dialogflowV2_language']||'en')[_0x3d94('0x11')](function(_0xe87d17){_0x482e99(null,_0xe87d17);})[_0x3d94('0x16')](function(_0x4fef1d){_0x482e99(_0x4fef1d);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x7d')]=function(_0x5e6ca4,_0x205b9d){scripts['sestekNDA'](this[_0x3d94('0xc')],_0x5e6ca4)[_0x3d94('0x11')](function(_0x2de60e){_0x205b9d(null,_0x2de60e);})['catch'](function(_0x35b2e2){_0x205b9d(_0x35b2e2);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x7e')]=function(_0x53a92d,_0x3e091a){scripts[_0x3d94('0x7e')](_0x53a92d[_0x3d94('0x7f')],_0x53a92d[_0x3d94('0x63')],_0x53a92d[_0x3d94('0x80')]||_0x3d94('0x5d'),_0x53a92d[_0x3d94('0x81')])[_0x3d94('0x11')](function(_0x577890){_0x3e091a(null,_0x577890);})[_0x3d94('0x16')](function(_0x2b8f09){_0x3e091a(_0x2b8f09);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x82')]=function(_0x32357b,_0x186d45,_0x5716fd){scripts[_0x3d94('0x82')](_0x186d45,_0x32357b[_0x3d94('0x7f')],_0x32357b[_0x3d94('0x83')]||'en-US',this[_0x3d94('0x84')](_0x32357b['model'])?_0x32357b[_0x3d94('0x85')]:undefined)[_0x3d94('0x11')](function(_0x490d77){_0x5716fd(null,_0x490d77);})[_0x3d94('0x16')](function(_0x33f215){_0x5716fd(_0x33f215);});};AGIVertices['prototype']['awsPolly']=function(_0x10613f,_0x36e87c){scripts['awsPolly'](_0x10613f['aws_access_key_id'],_0x10613f['aws_secret_access_key'],_0x10613f[_0x3d94('0x86')],_0x10613f[_0x3d94('0x87')]||_0x3d94('0x88'),_0x10613f[_0x3d94('0x63')],_0x10613f[_0x3d94('0x89')]||'text')[_0x3d94('0x11')](function(_0xfacdff){_0x36e87c(null,_0xfacdff);})[_0x3d94('0x16')](function(_0x491220){_0x36e87c(_0x491220);});};AGIVertices[_0x3d94('0x13')]['awsLex']=function(_0x149895,_0x26f8a1){scripts[_0x3d94('0x8a')](this[_0x3d94('0xc')][_0x3d94('0x39')],_0x149895['aws_access_key_id'],_0x149895['aws_secret_access_key'],_0x149895[_0x3d94('0x8b')],_0x149895[_0x3d94('0x63')],_0x149895['aws_bot_name'])[_0x3d94('0x11')](function(_0x5cc4d9){_0x26f8a1(null,_0x5cc4d9);})[_0x3d94('0x16')](function(_0x237911){_0x26f8a1(_0x237911);});};AGIVertices[_0x3d94('0x13')]['googleASR']=function(_0x406528,_0x5ed9e7,_0xa4055e){scripts[_0x3d94('0x8c')](_0x5ed9e7,_0x406528[_0x3d94('0x7f')],_0x406528[_0x3d94('0x8d')]||'en-US')['then'](function(_0x11ff83){_0xa4055e(null,_0x11ff83);})[_0x3d94('0x16')](function(_0x1c2092){_0xa4055e(_0x1c2092);});};AGIVertices[_0x3d94('0x13')]['tildeASR']=function(_0x4113bf,_0x493d38,_0x49c674){scripts['tildeASR'](_0x493d38,_0x4113bf[_0x3d94('0x8e')],_0x4113bf[_0x3d94('0x8f')],_0x4113bf[_0x3d94('0x90')])[_0x3d94('0x11')](function(_0x5bd2ab){_0x49c674(null,_0x5bd2ab);})[_0x3d94('0x16')](function(_0x33af12){_0x49c674(_0x33af12);});};AGIVertices[_0x3d94('0x13')][_0x3d94('0x91')]=function(_0x34f7d2){var _0x213f3e=_[_0x3d94('0x92')](verticesWithRetry,_0x34f7d2[_0x3d94('0x3b')])?_0x34f7d2:_[_0x3d94('0x93')](_0x34f7d2);for(var _0x140ad1 in _0x213f3e){if(_0x213f3e['hasOwnProperty'](_0x140ad1)){if(_0x213f3e[_0x140ad1]&&_['isString'](_0x213f3e[_0x140ad1])){if(_[_0x3d94('0x92')](recursiveMapAttributes,_0x140ad1)){_0x213f3e[_0x140ad1]=this[_0x3d94('0x94')](_0x213f3e[_0x140ad1]);}else{_0x213f3e[_0x140ad1]=this[_0x3d94('0x95')](_0x213f3e[_0x140ad1]);}}}}return _0x213f3e;};AGIVertices[_0x3d94('0x13')][_0x3d94('0x96')]=function(_0x293e1c){for(var _0x2d3c1a in _0x293e1c){if(_0x293e1c['hasOwnProperty'](_0x2d3c1a)){if(_[_0x3d94('0x97')](_0x293e1c[_0x2d3c1a])){this[_0x3d94('0x96')](_0x293e1c[_0x2d3c1a]);}else if(_[_0x3d94('0x98')](_0x293e1c[_0x2d3c1a])){for(var _0x27c1e1=0x0;_0x27c1e1<_0x293e1c[_0x2d3c1a][_0x3d94('0x99')];_0x27c1e1++){this[_0x3d94('0x96')](_0x293e1c[_0x2d3c1a][_0x27c1e1]);}}else if(_['isString'](_0x293e1c[_0x2d3c1a])){_0x293e1c[_0x2d3c1a]=this['replaceAllVariables'](_0x293e1c[_0x2d3c1a]);}}}};AGIVertices[_0x3d94('0x13')]['saveRestApiResult']=function(_0x248fbe,_0x44fc5e){for(var _0x350751 in _0x248fbe){if(_0x248fbe[_0x3d94('0x9a')](_0x350751)){if(_[_0x3d94('0x97')](_0x248fbe[_0x350751])){if(!_[_0x3d94('0x46')](_0x248fbe[_0x350751])){this[_0x3d94('0x9b')](_0x248fbe[_0x350751],util[_0x3d94('0x2b')]('%s.%s',_0x44fc5e,_0x350751));}}else if(_[_0x3d94('0x98')](_0x248fbe[_0x350751])){for(var _0x2c8a2f=0x0;_0x2c8a2f<_0x248fbe[_0x350751][_0x3d94('0x99')];_0x2c8a2f++){this[_0x3d94('0x9b')](_0x248fbe[_0x350751][_0x2c8a2f],util[_0x3d94('0x2b')](_0x3d94('0x9c'),_0x44fc5e,_0x350751+'['+_0x2c8a2f+']'));}}else{if(!_[_0x3d94('0x47')](_0x248fbe[_0x350751])){this[_0x3d94('0xc')][_0x3d94('0x9d')](util[_0x3d94('0x2b')](_0x3d94('0x9c'),_0x44fc5e,_0x350751),_0x248fbe[_0x350751]);}}}}};AGIVertices[_0x3d94('0x13')][_0x3d94('0x94')]=function(_0x40b09b){try{var _0x2d02db=JSON[_0x3d94('0x6c')](_0x40b09b);this[_0x3d94('0x96')](_0x2d02db);return JSON[_0x3d94('0x73')](_0x2d02db);}catch(_0x2513da){return this[_0x3d94('0x95')](_0x40b09b);}};AGIVertices[_0x3d94('0x13')]['replaceAllVariables']=function(_0x464960){var _0x35040e=_0x464960[_0x3d94('0x9e')]('{');for(var _0x2fa27d=0x1;_0x2fa27d<_0x35040e[_0x3d94('0x99')];_0x2fa27d+=0x1){var _0x185592=_0x35040e[_0x2fa27d]['split']('}');if(_0x185592[_0x3d94('0x99')]>0x1){_0x464960=_0x464960[_0x3d94('0x9f')]('{'+_0x185592[0x0]+'}',this[_0x3d94('0xc')][_0x3d94('0xe')](_0x185592[0x0])[_0x3d94('0xa0')]||_0x185592[0x0]);}}if(_0x35040e[_0x3d94('0x99')]===0x1){return _0x464960['toString']();}return this[_0x3d94('0x95')](_0x464960);};AGIVertices[_0x3d94('0x13')]['getAndSetVariable']=function(_0x4c1906,_0x4a1faa){var _0x3e1139=this[_0x3d94('0xc')][_0x3d94('0xe')](_0x4c1906);if(_0x3e1139[_0x3d94('0xa1')]===-0x1){return _0x3e1139;}logger[_0x3d94('0x30')](util['format'](_0x3d94('0xa2'),_0x4a1faa,_0x3e1139[_0x3d94('0xa0')]));return this[_0x3d94('0xc')][_0x3d94('0x9d')](_0x4a1faa,_0x3e1139[_0x3d94('0xa0')]);};AGIVertices[_0x3d94('0x13')]['isConfigured']=function(_0x167d4c){return _0x167d4c&&_0x167d4c!=='0'&&_0x167d4c!=='-1'&&_0x167d4c!=='';};AGIVertices['prototype'][_0x3d94('0xa3')]=function(_0xb970e1){this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0xb970e1,'-');_0xb970e1['retry']=_0xb970e1[_0x3d94('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3d94('0x13')][_0x3d94('0xa4')]=function(_0x3bf421){logger['info'](util['format'](_0x3d94('0xa5'),_0x3bf421[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x3bf421['text'])){return this[_0x3d94('0xc')]['noop']('no\x20text\x20configured');}var _0x560fdf='\x22'+_0x3bf421[_0x3d94('0x63')]+'\x22';if(this['isConfigured'](_0x3bf421[_0x3d94('0x77')])){_0x560fdf+=','+_0x3bf421[_0x3d94('0x77')];}var _0x1ad1b0=this['channel'][_0x3d94('0x57')](_0x3d94('0xa6'),_0x560fdf);if(_0x1ad1b0['result']===-0x1){return _0x1ad1b0;}return this['channel'][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xa8'),_0x560fdf));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xa9')]=function(_0x38eba7){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x38eba7['label']));if(!this[_0x3d94('0x84')](_0x38eba7[_0x3d94('0xaa')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xab'));}var _0x370e9f=_0x38eba7[_0x3d94('0xaa')];if(this[_0x3d94('0x84')](_0x38eba7[_0x3d94('0x77')])){_0x370e9f+=','+_0x38eba7[_0x3d94('0x77')];}var _0x5e9c90=this['channel'][_0x3d94('0x57')]('MRCPRecog',_0x370e9f);if(_0x5e9c90[_0x3d94('0xa1')]===-0x1){return _0x5e9c90;}var _0x149fab=this[_0x3d94('0xac')](_0x3d94('0xad'),_0x3d94('0xae'));if(_0x149fab[_0x3d94('0xa1')]===-0x1){return _0x149fab;}var _0x37fc9a=this[_0x3d94('0xac')]('RECOG_INPUT()',_0x3d94('0xaf'));if(_0x37fc9a[_0x3d94('0xa1')]===-0x1){return _0x37fc9a;}var _0x32b72d=this[_0x3d94('0xac')](_0x3d94('0xb0'),_0x3d94('0xb1'));if(_0x32b72d[_0x3d94('0xa1')]===-0x1){return _0x32b72d;}return this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')](_0x3d94('0xb2'),_0x370e9f));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x8')]=function(_0x3b6df7){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xb3'),_0x3b6df7['label']));return this[_0x3d94('0xc')][_0x3d94('0x8')]([_0x3b6df7['command'],_0x3b6df7[_0x3d94('0xb4')]]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0xb5')]=function(_0xaedee0){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xb6'),_0xaedee0[_0x3d94('0x3a')]));if(this[_0x3d94('0x84')](_0xaedee0[_0x3d94('0x67')])){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xb7'),_0xaedee0[_0x3d94('0x67')]));var _0x186c79=this[_0x3d94('0xc')][_0x3d94('0xb8')](_0xaedee0[_0x3d94('0x67')]);if(_0x186c79[_0x3d94('0xa1')]===-0x1){return _0x186c79;}}return this[_0x3d94('0xc')][_0x3d94('0xb5')]();};AGIVertices[_0x3d94('0x13')][_0x3d94('0xb9')]=function(_0xba6a5b){logger[_0x3d94('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xba6a5b[_0x3d94('0x3a')]));if(!this['isConfigured'](_0xba6a5b['list_id'])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0xba6a5b,_0x3d94('0xba'));}_0xba6a5b[_0x3d94('0x4c')]=moment();if(this[_0x3d94('0x84')](_0xba6a5b['delay'])){_0xba6a5b[_0x3d94('0x4c')]=moment()['add'](_0xba6a5b[_0x3d94('0xbb')],_0x3d94('0xbc'));}if(!this[_0x3d94('0x84')](_0xba6a5b[_0x3d94('0x4f')])){_0xba6a5b[_0x3d94('0x4f')]=0x2;}this[_0x3d94('0x45')][_0x3d94('0x70')](this,_0xba6a5b);return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xbd'),_0xba6a5b[_0x3d94('0x4a')],_0xba6a5b[_0x3d94('0x4b')],_0xba6a5b[_0x3d94('0x4c')]));};AGIVertices[_0x3d94('0x13')]['custom_app']=function(_0x594e4f){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0xbe'),_0x594e4f['label']));var _0x2105c2=this[_0x3d94('0xc')]['exec'](_0x594e4f[_0x3d94('0xbf')],_0x594e4f[_0x3d94('0x77')]);if(_0x2105c2[_0x3d94('0xa1')]===-0x1){return _0x2105c2;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0xc0'),_0x594e4f[_0x3d94('0xbf')],_0x594e4f[_0x3d94('0x77')]));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xc1')]=function(_0x3bac7c){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xc2'),_0x3bac7c['label']));if(!this[_0x3d94('0x84')](_0x3bac7c[_0x3d94('0x63')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xc3'));}var _0x359d07='\x22'+_0x3bac7c['text']+'\x22';if(this['isConfigured'](_0x3bac7c[_0x3d94('0x77')])){_0x359d07+=','+_0x3bac7c[_0x3d94('0x77')];}var _0x50a9aa=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0xa6'),_0x359d07);if(_0x50a9aa[_0x3d94('0xa1')]===-0x1){return _0x50a9aa;}return this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x359d07));};AGIVertices[_0x3d94('0x13')]['sestektts']=function(_0x4e513d){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xc4'),_0x4e513d[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x4e513d['text'])){return this[_0x3d94('0xc')]['noop']('no\x20text\x20configured');}var _0x4a611c='\x22'+_0x4e513d[_0x3d94('0x63')]+'\x22';if(this['isConfigured'](_0x4e513d[_0x3d94('0x77')])){_0x4a611c+=','+_0x4e513d[_0x3d94('0x77')];}var _0x1041f0=this[_0x3d94('0xc')][_0x3d94('0x57')]('MRCPSynth',_0x4a611c);if(_0x1041f0[_0x3d94('0xa1')]===-0x1){return _0x1041f0;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xa8'),_0x4a611c));};AGIVertices[_0x3d94('0x13')]['lumenvoxasr']=function(_0x259571){logger['info'](util['format'](_0x3d94('0xc5'),_0x259571['label']));if(!this[_0x3d94('0x84')](_0x259571[_0x3d94('0xaa')])){return this[_0x3d94('0xc')]['noop']('no\x20grammar\x20configured');}var _0x377e2c=_0x259571['grammar'];if(this[_0x3d94('0x84')](_0x259571[_0x3d94('0x77')])){_0x377e2c+=','+_0x259571['options'];}var _0xedca04=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0xc6'),_0x377e2c);if(_0xedca04[_0x3d94('0xa1')]===-0x1){return _0xedca04;}var _0xd66e02=this[_0x3d94('0xac')](_0x3d94('0xad'),_0x3d94('0xc7'));if(_0xd66e02[_0x3d94('0xa1')]===-0x1){return _0xd66e02;}var _0x2d0c19=this[_0x3d94('0xac')](_0x3d94('0xc8'),_0x3d94('0xc9'));if(_0x2d0c19[_0x3d94('0xa1')]===-0x1){return _0x2d0c19;}var _0xfeeaf1=this[_0x3d94('0xac')]('RECOG_INSTANCE()',_0x3d94('0xca'));if(_0xfeeaf1[_0x3d94('0xa1')]===-0x1){return _0xfeeaf1;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xb2'),_0x377e2c));};AGIVertices[_0x3d94('0x13')]['sestekasr']=function(_0x4db175){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0xcb'),_0x4db175['label']));if(!this['isConfigured'](_0x4db175[_0x3d94('0xaa')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xab'));}var _0x49dfd3=_0x4db175['grammar'];if(this['isConfigured'](_0x4db175[_0x3d94('0x77')])){_0x49dfd3+=','+_0x4db175['options'];}var _0x4fe456=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0xc6'),_0x49dfd3);if(_0x4fe456[_0x3d94('0xa1')]===-0x1){return _0x4fe456;}var _0x348a17=this[_0x3d94('0xac')](_0x3d94('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x348a17['result']===-0x1){return _0x348a17;}var _0x223de4=this[_0x3d94('0xac')](_0x3d94('0xc8'),_0x3d94('0xcc'));if(_0x223de4[_0x3d94('0xa1')]===-0x1){return _0x223de4;}var _0x2607f3=this[_0x3d94('0xac')]('RECOG_INSTANCE()',_0x3d94('0xcd'));if(_0x2607f3['result']===-0x1){return _0x2607f3;}return this['channel']['noop'](util[_0x3d94('0x2b')](_0x3d94('0xb2'),_0x49dfd3));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xce')]=function(_0x5973f8){logger[_0x3d94('0x30')](util['format'](_0x3d94('0xcf'),_0x5973f8[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x5973f8['odbc_id'])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x5973f8,'no\x20database\x20selected');}var _0x4e431a=this[_0x3d94('0xd0')][_0x3d94('0x70')](this,_0x5973f8[_0x3d94('0xd1')]);if(!_0x4e431a){return this[_0x3d94('0xc')]['error'](_0x5973f8,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5973f8[_0x3d94('0xd2')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x5973f8,_0x3d94('0xd3'));}var _0x1c5345=_0x5973f8[_0x3d94('0xd2')][_0x3d94('0x59')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x3d94('0x2b')](_0x3d94('0xd4'),_0x1c5345));var _0x23dd3b=this[_0x3d94('0x2c')][_0x3d94('0x70')](this,_0x4e431a,_0x1c5345);this['createSquareDetailsReport'][_0x3d94('0x70')](this,_0x5973f8,_0x1c5345);if(!this[_0x3d94('0x84')](_0x5973f8[_0x3d94('0xd5')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xd6'));}var _0x49141f=this[_0x3d94('0xe')][_0x3d94('0x70')](this,_0x5973f8['variable_id']);if(!_0x49141f){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x5973f8,'no\x20variable\x20found');}var _0x1d30b2=this;_0x23dd3b['forEach'](function(_0x46cdae,_0x1e0210){Object[_0x3d94('0xd7')](_0x46cdae)[_0x3d94('0xd8')](function(_0x5e935e){_0x1d30b2[_0x3d94('0xc')][_0x3d94('0x9d')](util['format']('%s[%s][%s]',_0x49141f,_0x1e0210,_0x5e935e),_0x46cdae[_0x5e935e]);});});this['channel'][_0x3d94('0x9d')](util[_0x3d94('0x2b')](_0x3d94('0xd9'),_0x49141f),_0x23dd3b['length']);return this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0xda'),_0x49141f));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xdb')]=function(_0x1c0f57){logger[_0x3d94('0xdc')](util[_0x3d94('0x2b')](_0x3d94('0xdd'),_0x1c0f57[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x1c0f57[_0x3d94('0xde')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x1c0f57,_0x3d94('0xdf'));}var _0x8268b6=this[_0x3d94('0x1b')][_0x3d94('0x70')](this,_0x1c0f57[_0x3d94('0xde')]);if(!_0x8268b6){return this['channel']['error'](_0x1c0f57,_0x3d94('0xe0'));}var _0x38fa3e=this[_0x3d94('0xc')]['exec']('DIAL',[util[_0x3d94('0x2b')](_0x3d94('0xe1'),_0x8268b6),_0x1c0f57[_0x3d94('0x67')],_0x1c0f57['opts'],_0x1c0f57[_0x3d94('0x66')]]);if(_0x38fa3e[_0x3d94('0xa1')]===-0x1){return _0x38fa3e;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0xe2'),_0x3d94('0xe3')));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xe4')]=function(_0x152c40){logger[_0x3d94('0x30')](util['format'](_0x3d94('0xe5'),_0x152c40[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x152c40['key'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xe6'));}if(!this[_0x3d94('0x84')](_0x152c40['text'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20text\x20configured');}this[_0x3d94('0xc')][_0x3d94('0xe7')]=!![];this[_0x3d94('0x38')](_0x152c40);this['createSquareMessage'](_0x152c40[_0x3d94('0x63')],'in','','');this['channel']['noop'](util[_0x3d94('0x2b')](_0x3d94('0xe8'),_0x152c40['text']));var _0x5a8e05=this[_0x3d94('0x78')]['sync'](this,_0x152c40);if(_0x5a8e05){for(var _0x278cbb in _0x5a8e05){if(_0x5a8e05[_0x3d94('0x9a')](_0x278cbb)){this[_0x3d94('0xc')][_0x3d94('0x9d')](util[_0x3d94('0x2b')](_0x3d94('0xe9'),_0x278cbb[_0x3d94('0x6a')]()),_0x5a8e05[_0x278cbb]);}}this[_0x3d94('0x44')](_0x5a8e05[_0x3d94('0xea')],'out',_0x3d94('0xe4'),'');return this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')]('Dialogflow\x20Result\x20%s',_0x5a8e05[_0x3d94('0xea')]));}return this[_0x3d94('0xc')]['error'](_0x152c40,_0x3d94('0xeb'));};AGIVertices['prototype']['dialogflowV2']=function(_0xf8f4e7){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0xf8f4e7[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0xf8f4e7[_0x3d94('0x7b')])){return this[_0x3d94('0xc')]['noop'](_0x3d94('0xec'));}if(!this[_0x3d94('0x84')](_0xf8f4e7[_0x3d94('0x7c')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0xf8f4e7['private_key'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xed'));}if(!this['isConfigured'](_0xf8f4e7[_0x3d94('0xee')])){return this[_0x3d94('0xc')]['noop'](_0x3d94('0xef'));}if(!this[_0x3d94('0x84')](_0xf8f4e7[_0x3d94('0x63')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xc3'));}this['channel']['bot']=!![];this[_0x3d94('0x38')](_0xf8f4e7);this[_0x3d94('0x44')](_0xf8f4e7['text'],'in','','');this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xf0'),_0xf8f4e7[_0x3d94('0x63')]));var _0x1b0346=this['googleDialogflowV2'][_0x3d94('0x70')](this,_0xf8f4e7);if(_0x1b0346){for(var _0x3ab157 in _0x1b0346){if(_0x1b0346[_0x3d94('0x9a')](_0x3ab157)){if(_0x3ab157!==_0x3d94('0xf1')){this['channel'][_0x3d94('0x9d')](util[_0x3d94('0x2b')]('DIALOGFLOW_%s',_0x3ab157[_0x3d94('0x6a')]()),_0x1b0346[_0x3ab157]);}}}this[_0x3d94('0x44')](_0x1b0346[_0x3d94('0xea')],_0x3d94('0xf2'),_0x3d94('0xf3'),_0x1b0346[_0x3d94('0xf1')]);return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xf4'),_0x1b0346['speech']));}return this['channel'][_0x3d94('0x2e')](_0xf8f4e7,_0x3d94('0xf5'));};AGIVertices[_0x3d94('0x13')][_0x3d94('0xf6')]=function(_0x5ddb0a){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0xf7'),_0x5ddb0a['label']));if(!this[_0x3d94('0x84')](_0x5ddb0a[_0x3d94('0xf8')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xf9'));}if(!this[_0x3d94('0x84')](_0x5ddb0a[_0x3d94('0xfa')])){return this['channel'][_0x3d94('0xa7')]('no\x20username\x20configured');}if(!this[_0x3d94('0x84')](_0x5ddb0a['password'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20password\x20configured');}if(!this[_0x3d94('0x84')](_0x5ddb0a['ndassistant_url'])){return this[_0x3d94('0xc')]['noop']('no\x20text\x20configured');}this[_0x3d94('0xc')][_0x3d94('0xe7')]=!![];this[_0x3d94('0x38')](_0x5ddb0a);this[_0x3d94('0x44')](_0x5ddb0a[_0x3d94('0x63')],'in','','');this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xfb'),_0x5ddb0a[_0x3d94('0x63')]));var _0x290604=this[_0x3d94('0x7d')]['sync'](this,_0x5ddb0a);if(_0x290604){for(var _0x2c30db in _0x290604){if(_0x290604[_0x3d94('0x9a')](_0x2c30db)){this[_0x3d94('0xc')][_0x3d94('0x9d')](util['format']('SESTEK_NDA_%s',_0x2c30db[_0x3d94('0x6a')]()),_0x290604[_0x2c30db]);}}this[_0x3d94('0x44')](_0x290604[_0x3d94('0xea')],_0x3d94('0xf2'),_0x3d94('0xf6'),'');if(_0x290604['audiofile']){this['channel'][_0x3d94('0xa7')](util['format'](_0x3d94('0xfc'),_0x290604[_0x3d94('0xfd')]));var _0x1bb33f=this[_0x3d94('0xc')][_0x3d94('0xfe')](_0x290604[_0x3d94('0xfd')]);try{fs['unlink'](_0x290604[_0x3d94('0xfd')]+_0x3d94('0xff'));}catch(_0x4aa6e6){logger[_0x3d94('0x2e')](_0x4aa6e6);}return _0x1bb33f;}else{return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('SestekNDA\x20Result\x20%s',_0x290604['speech']));}}return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x5ddb0a,_0x3d94('0x100'));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x101')]=function(_0x1a7a60){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x102'),_0x1a7a60['label']));return this[_0x3d94('0xc')][_0x3d94('0xa7')]('end');};AGIVertices['prototype'][_0x3d94('0x103')]=function(_0x503369){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x104'),_0x503369[_0x3d94('0x3a')]));var _0x3eb0b5='';if(_0x503369[_0x3d94('0x105')]){if(!this['isConfigured'](_0x503369[_0x3d94('0x105')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x503369,_0x3d94('0x106'));}else{var _0x77078d=parseInt(_0x503369[_0x3d94('0x105')],0xa);if(isNaN(_0x77078d)){_0x3eb0b5=_0x503369[_0x3d94('0x105')];}else{_0x3eb0b5=this[_0x3d94('0x1d')][_0x3d94('0x70')](this,_0x503369[_0x3d94('0x105')]);if(!_0x3eb0b5){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x503369,_0x3d94('0x107'));}}}}else if(_0x503369['trunk_name']){_0x3eb0b5=_0x503369[_0x3d94('0x108')];}else{return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x503369,'no\x20trunk\x20selected');}var _0x2ba263=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0xe3'),[util[_0x3d94('0x2b')](_0x3d94('0x109'),_0x3eb0b5,_0x503369[_0x3d94('0x4a')]),_0x503369['timeout'],_0x503369[_0x3d94('0x10a')],_0x503369[_0x3d94('0x66')]]);if(_0x2ba263[_0x3d94('0xa1')]===-0x1){return _0x2ba263;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x10b')]=function(_0x46236d){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x10c'),_0x46236d['label']));return this[_0x3d94('0xc')][_0x3d94('0xa7')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x1da500){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x10d'),_0x1da500['label']));if(_0x1da500[_0x3d94('0x10e')]===0x0){return this[_0x3d94('0xa3')](_0x1da500);}_0x1da500[_0x3d94('0x10e')]-=0x1;if(!this[_0x3d94('0x84')](_0x1da500[_0x3d94('0x10f')])){return this[_0x3d94('0xc')]['error'](_0x1da500,'no\x20file\x20audio\x20selected');}var _0x15e8be=this[_0x3d94('0x1f')][_0x3d94('0x70')](this,_0x1da500[_0x3d94('0x10f')]);if(!_0x15e8be){return this['channel'][_0x3d94('0x2e')](_0x1da500,_0x3d94('0x110'));}if(!this[_0x3d94('0x84')](_0x1da500[_0x3d94('0xd5')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x3d94('0xd6'));}var _0x32aa5c=this['channel'][_0x3d94('0x111')](_0x15e8be,_0x1da500['response'],_0x1da500['maxdigit']);var _0x16f500=_0x32aa5c[_0x3d94('0xa1')]?_0x32aa5c[_0x3d94('0xa1')][_0x3d94('0x4e')]():'';logger[_0x3d94('0x30')](_0x3d94('0x112'),JSON[_0x3d94('0x73')](_0x32aa5c));if(_0x32aa5c[_0x3d94('0xa1')]===-0x1){this['createSquareDetailsReport'][_0x3d94('0x70')](this,_0x1da500,_0x16f500);return _0x32aa5c;}else if(_0x32aa5c['extra']===_0x3d94('0x67')){_0x32aa5c[_0x3d94('0xa1')]=_0x16f500[_0x3d94('0x99')]>=parseInt(_0x1da500[_0x3d94('0x113')])?'x':'i';}else{_0x32aa5c[_0x3d94('0xa1')]=_0x16f500[_0x3d94('0x99')]>=parseInt(_0x1da500['mindigit'])&&_0x16f500[_0x3d94('0x99')]<=parseInt(_0x1da500[_0x3d94('0x114')])?'x':'i';}var _0x5cb7cc=this[_0x3d94('0xe')]['sync'](this,_0x1da500['variable_id']);if(!_0x5cb7cc){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x1da500,_0x3d94('0x115'));}this[_0x3d94('0xc')][_0x3d94('0x9d')](_0x5cb7cc,_0x16f500);if(this['isConfigured'](_0x1da500[_0x3d94('0x116')])){var _0x113efa=parseInt(_0x1da500[_0x3d94('0x116')],0xa);var _0x43e025=rs['generate']({'charset':'*','length':_0x113efa});var _0x20b987=_0x16f500['length'];if(_0x20b987>0x0){if(_0x20b987>_0x113efa){this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x1da500,_0x1da500['hiddendigitspos']===_0x3d94('0x117')?_0x43e025+_0x16f500[_0x3d94('0x118')](_0x113efa):_0x16f500[_0x3d94('0x118')](0x0,_0x20b987-_0x113efa)+_0x43e025);}else{this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x1da500,rs[_0x3d94('0x119')]({'charset':'*','length':_0x20b987}));}}else{this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x1da500,'');}}else{this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x1da500,_0x16f500);}return _0x32aa5c;};AGIVertices['prototype']['getsecretdigits']=function(_0x1b537d){logger['info'](util['format'](_0x3d94('0x11a'),_0x1b537d['label']));return this[_0x3d94('0xb')](_0x1b537d);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x11b')]=function(_0x36c9be){logger[_0x3d94('0x30')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x36c9be[_0x3d94('0x3a')]));this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x36c9be,_0x36c9be['goalname']);return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('GOAL\x20%s',_0x36c9be[_0x3d94('0x11c')]));};AGIVertices[_0x3d94('0x13')]['awspolly']=function(_0xbbf698){logger['info'](util[_0x3d94('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xbbf698['label']));if(!this[_0x3d94('0x84')](_0xbbf698['aws_access_key_id'])||!this[_0x3d94('0x84')](_0xbbf698[_0x3d94('0x11d')])){return this[_0x3d94('0xc')]['noop'](_0x3d94('0x11e'));}if(!this[_0x3d94('0x84')](_0xbbf698[_0x3d94('0x63')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xc3'));}this[_0x3d94('0xc')]['noop'](util['format'](_0x3d94('0x11f'),_0xbbf698[_0x3d94('0x63')]));var _0x2476e2=this[_0x3d94('0x120')][_0x3d94('0x70')](this,_0xbbf698);if(_0x2476e2){this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x121'),_0x2476e2));var _0x4d7a86=this[_0x3d94('0xc')][_0x3d94('0xfe')](_0x2476e2);try{fs[_0x3d94('0x122')](_0x2476e2+_0x3d94('0xff'));}catch(_0x46ff19){logger['error'](_0x46ff19);}return _0x4d7a86;}return this[_0x3d94('0xc')]['error'](_0xbbf698,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x3d94('0x123')]=function(_0xc39092){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x124'),_0xc39092[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0xc39092[_0x3d94('0x125')])||!this[_0x3d94('0x84')](_0xc39092[_0x3d94('0x11d')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x11e'));}if(!this[_0x3d94('0x84')](_0xc39092[_0x3d94('0x126')])){return this['channel'][_0x3d94('0xa7')](_0x3d94('0x127'));}if(!this['isConfigured'](_0xc39092['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x3d94('0xc')]['bot']=!![];this[_0x3d94('0x38')](_0xc39092);this[_0x3d94('0x44')](_0xc39092[_0x3d94('0x63')],'in','','');this['channel'][_0x3d94('0xa7')](util['format'](_0x3d94('0x128'),_0xc39092[_0x3d94('0x63')]));var _0x4403a4=this['awsLex']['sync'](this,_0xc39092);if(_0x4403a4){for(var _0x13b389 in _0x4403a4){if(_0x4403a4[_0x3d94('0x9a')](_0x13b389)&&_[_0x3d94('0x129')](_0x4403a4[_0x13b389])){this['channel'][_0x3d94('0x9d')](util[_0x3d94('0x2b')](_0x3d94('0x12a'),_0x13b389['toUpperCase']()),_0x4403a4[_0x13b389]);}}if(_[_0x3d94('0x47')](_0x4403a4[_0x3d94('0x75')])){return this['channel'][_0x3d94('0xa7')](_0x3d94('0x12b'));}else{this[_0x3d94('0x44')](_0x4403a4[_0x3d94('0x75')],'out',_0x3d94('0x12c'),'');return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x12d'),_0x4403a4['message']));}}return this['channel']['error'](_0xc39092,_0x3d94('0x12e'));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x12f')]=function(_0x104291){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x130'),_0x104291['label'],_0x104291['timeout']));if(!this['isConfigured'](_0x104291['key'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20key\x20configured');}var _0x23609d='wav';var _0x4d40fc=util['format'](_0x3d94('0x131'),FILES_PATH,rs['generate'](0x4));var _0x5be191=util[_0x3d94('0x2b')](_0x3d94('0x9c'),_0x4d40fc,_0x23609d);var _0x30762c=!![];if(_0x104291[_0x3d94('0x132')]===_0x3d94('0x133')){_0x30762c=![];}var _0x12daf9=this['channel']['recordFile'](_0x4d40fc,_0x23609d,_0x104291['intKey'],_0x104291['timeout'],undefined,_0x30762c);if(_0x12daf9['result']!==-0x1){this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0x134'),_0x5be191));var _0x1bab26=this['googleASR'][_0x3d94('0x70')](this,_0x104291,_0x5be191);if(_0x1bab26){for(var _0x331977 in _0x1bab26){if(_0x1bab26[_0x3d94('0x9a')](_0x331977)){this[_0x3d94('0xc')][_0x3d94('0x9d')](util['format'](_0x3d94('0x135'),_0x331977[_0x3d94('0x6a')]()),_0x1bab26[_0x331977]);}}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0x136'),JSON[_0x3d94('0x73')](_0x1bab26)));}}return _0x12daf9;};AGIVertices[_0x3d94('0x13')]['tildeasr']=function(_0x50e0a3){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x137'),_0x50e0a3['label']));if(!this[_0x3d94('0x84')](_0x50e0a3[_0x3d94('0x8e')])){return this['channel']['noop'](_0x3d94('0x138'));}if(!this['isConfigured'](_0x50e0a3[_0x3d94('0x8f')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20appsecret\x20configured');}var _0x42af01=_0x3d94('0x139');var _0x3a443d=util[_0x3d94('0x2b')](_0x3d94('0x131'),FILES_PATH,rs[_0x3d94('0x119')](0x4));var _0x4fcefd=util[_0x3d94('0x2b')](_0x3d94('0x9c'),_0x3a443d,_0x42af01);var _0x56e01d=!![];if(_0x50e0a3['beep']===_0x3d94('0x133')){_0x56e01d=![];}var _0x47bfca=this['channel'][_0x3d94('0x13a')](_0x3a443d,_0x42af01,_0x50e0a3['intKey'],_0x50e0a3['timeout'],undefined,_0x56e01d);if(_0x47bfca['result']!==-0x1){this['channel'][_0x3d94('0xa7')](util['format']('tilde\x20%s\x20file\x20created',_0x4fcefd));var _0x1e60c4=this[_0x3d94('0x13b')][_0x3d94('0x70')](this,_0x50e0a3,_0x4fcefd);if(_0x1e60c4){for(var _0xb7f7c5 in _0x1e60c4){if(_0x1e60c4['hasOwnProperty'](_0xb7f7c5)){this['channel']['setVariable'](util[_0x3d94('0x2b')]('TILDE_ASR_%s',_0xb7f7c5[_0x3d94('0x6a')]()),_0x1e60c4[_0xb7f7c5]);}}return this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')](_0x3d94('0x13c'),JSON[_0x3d94('0x73')](_0x1e60c4)));}}return _0x47bfca;};AGIVertices[_0x3d94('0x13')]['gotoc']=function(_0x4e2e06){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4e2e06['label']));return this[_0x3d94('0xc')][_0x3d94('0x13d')](_0x4e2e06[_0x3d94('0x3f')],_0x4e2e06[_0x3d94('0x13e')],_0x4e2e06[_0x3d94('0x40')]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x13f')]=function(_0x254bf6){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x140'),_0x254bf6['label']));if(!this[_0x3d94('0x84')](_0x254bf6[_0x3d94('0x141')])){return this[_0x3d94('0xc')]['error'](_0x254bf6,'no\x20condition\x20configured');}try{var _0x148c61=eval(_0x254bf6[_0x3d94('0x141')])?'true':_0x3d94('0x142');this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')](_0x3d94('0x143'),_0x254bf6[_0x3d94('0x141')],_0x148c61));return{'code':0xc8,'result':_0x148c61};}catch(_0x5b5adb){return{'code':0xc8,'result':_0x3d94('0x142')};}};AGIVertices[_0x3d94('0x13')][_0x3d94('0x144')]=function(_0x39d75f){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x145'),_0x39d75f[_0x3d94('0x3a')]));if(!this['isConfigured'](_0x39d75f[_0x3d94('0x146')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x39d75f,_0x3d94('0x147'));}var _0x386e97=this[_0x3d94('0x25')]['sync'](this,_0x39d75f[_0x3d94('0x146')]);if(!_0x386e97){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x39d75f,'no\x20intervals\x20found');}for(var _0x4bd157=0x0;_0x4bd157<_0x386e97[_0x3d94('0x99')];_0x4bd157+=0x1){var _0x21ee78=this[_0x3d94('0xc')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x386e97[_0x4bd157]));if(_0x21ee78['result']===-0x1){return _0x21ee78;}logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x148'),_0x386e97[_0x4bd157],_0x21ee78['extra']));if(_0x21ee78[_0x3d94('0xa0')]===_0x3d94('0x149')){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x148'),_0x386e97[_0x4bd157],_0x3d94('0x149')));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x148'),_0x386e97[_0x4bd157],'true'));return{'code':0xc8,'result':_0x3d94('0x149')};}else{logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x148'),_0x386e97[_0x4bd157],_0x3d94('0x142')));this[_0x3d94('0xc')][_0x3d94('0xa7')](util['format'](_0x3d94('0x148'),_0x386e97[_0x4bd157],_0x3d94('0x142')));}}return{'code':0xc8,'result':_0x3d94('0x142')};};AGIVertices[_0x3d94('0x13')][_0x3d94('0x14a')]=function(_0x95c581){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x14b'),_0x95c581[_0x3d94('0x3a')]));return this[_0x3d94('0xc')][_0x3d94('0x14a')]();};AGIVertices[_0x3d94('0x13')][_0x3d94('0x14c')]=function(_0x567196){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x14d'),_0x567196[_0x3d94('0x3a')]));if(!this['isConfigured'](_0x567196[_0x3d94('0x7f')])){return this['channel'][_0x3d94('0xa7')](_0x3d94('0xe6'));}var _0x4f5a22=_0x3d94('0x139');var _0x26431d=util[_0x3d94('0x2b')](_0x3d94('0x131'),FILES_PATH,rs[_0x3d94('0x119')](0x4));var _0x384d22=util[_0x3d94('0x2b')](_0x3d94('0x9c'),_0x26431d,_0x4f5a22);var _0x5a0ca2=!![];if(_0x567196['beep']===_0x3d94('0x133')){_0x5a0ca2=![];}var _0x197e20=this[_0x3d94('0xc')]['recordFile'](_0x26431d,_0x4f5a22,_0x567196[_0x3d94('0x14e')],_0x567196['timeout'],undefined,_0x5a0ca2);if(_0x197e20[_0x3d94('0xa1')]!==-0x1){this['channel']['noop'](util[_0x3d94('0x2b')](_0x3d94('0x14f'),_0x384d22));var _0xb00eb5=this['ispeechASR']['sync'](this,_0x567196,_0x384d22);if(_0xb00eb5){for(var _0x19896b in _0xb00eb5){if(_0xb00eb5[_0x3d94('0x9a')](_0x19896b)){this['channel']['setVariable'](util['format'](_0x3d94('0x150'),_0x19896b[_0x3d94('0x6a')]()),_0xb00eb5[_0x19896b]);}}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x3d94('0x73')](_0xb00eb5)));}}return _0x197e20;};AGIVertices[_0x3d94('0x13')][_0x3d94('0x151')]=function(_0x1542f8){logger[_0x3d94('0x30')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1542f8['label']));if(!this[_0x3d94('0x84')](_0x1542f8['key'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')]('no\x20key\x20configured');}if(!this[_0x3d94('0x84')](_0x1542f8[_0x3d94('0x63')])){return this[_0x3d94('0xc')]['noop'](_0x3d94('0xc3'));}this['channel'][_0x3d94('0xa7')](util['format'](_0x3d94('0x152'),_0x1542f8[_0x3d94('0x63')]));var _0x11ab49=this['ispeechTTS']['sync'](this,_0x1542f8);if(_0x11ab49){this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x14f'),_0x11ab49));var _0x26d145=this[_0x3d94('0xc')]['streamFile'](_0x11ab49,_0x1542f8[_0x3d94('0x14e')]);try{fs[_0x3d94('0x122')](_0x11ab49+_0x3d94('0xff'));}catch(_0x4bd192){logger[_0x3d94('0x2e')](_0x4bd192);}return _0x26d145;}return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x1542f8,_0x3d94('0x153'));};AGIVertices['prototype'][_0x3d94('0x154')]=function(_0x3d66aa){logger['info'](util['format'](_0x3d94('0x155'),_0x3d66aa[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x3d66aa['findBy'])){return this['channel'][_0x3d94('0x2e')](_0x3d66aa,_0x3d94('0x156'));}logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x157'),this['channel'][_0x3d94('0x3e')],_0x3d66aa[_0x3d94('0x158')]));var _0x5b634f=this[_0x3d94('0x54')][_0x3d94('0x70')](this,_0x3d66aa[_0x3d94('0x158')]);if(_0x5b634f){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x3d66aa[_0x3d94('0x158')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x3d66aa[_0x3d94('0x158')]));return{'code':0xc8,'result':_0x3d94('0x15a')};}else{logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x3d66aa[_0x3d94('0x158')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this[_0x3d94('0xc')]['callerid'],_0x3d66aa[_0x3d94('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3d94('0x13')]['logout']=function(_0x36bf50){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x36bf50[_0x3d94('0x3a')]));if(!this['isConfigured'](_0x36bf50['findBy'])){return this['channel'][_0x3d94('0x2e')](_0x36bf50,_0x3d94('0x156'));}logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x157'),this[_0x3d94('0xc')]['callerid'],_0x36bf50[_0x3d94('0x158')]));var _0x189f05=this[_0x3d94('0x15c')][_0x3d94('0x70')](this,_0x36bf50[_0x3d94('0x158')]);if(_0x189f05){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this['channel']['callerid'],_0x36bf50[_0x3d94('0x158')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x36bf50['findBy']));return{'code':0xc8,'result':_0x3d94('0x15a')};}else{logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this['channel'][_0x3d94('0x3e')],_0x36bf50['findBy']));this['channel'][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x36bf50[_0x3d94('0x158')]));return{'code':0xc8,'result':_0x3d94('0x15d')};}};AGIVertices[_0x3d94('0x13')][_0x3d94('0x15e')]=function(_0x13445d){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x15f'),_0x13445d['label']));if(!this['isConfigured'](_0x13445d[_0x3d94('0x160')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x13445d,_0x3d94('0x161'));}this['channel'][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x162'),_0x13445d[_0x3d94('0x160')]));var _0x20f7cc=eval(_0x13445d[_0x3d94('0x160')]);if(!this[_0x3d94('0x84')](_0x13445d[_0x3d94('0xd5')])){return this['channel']['noop'](_0x3d94('0xd6'));}var _0x503cca=this[_0x3d94('0xe')][_0x3d94('0x70')](this,_0x13445d['variable_id']);if(!_0x503cca){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x13445d,_0x3d94('0x115'));}if(_['isArray'](_0x20f7cc)){var _0x1e01bc=this;_0x20f7cc[_0x3d94('0xd8')](function(_0x52e1fe,_0x25417c){_0x1e01bc[_0x3d94('0xc')][_0x3d94('0x9d')](util['format'](_0x3d94('0x163'),_0x503cca,_0x25417c),_0x52e1fe);});return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('variable\x20%s[key]\x20set',_0x503cca));}else{return this[_0x3d94('0xc')]['setVariable'](_0x503cca,_0x20f7cc);}};AGIVertices['prototype'][_0x3d94('0xa')]=function(_0x329ab4){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x164'),_0x329ab4[_0x3d94('0x3a')]));if(_0x329ab4[_0x3d94('0x10e')]===0x0){return this[_0x3d94('0xa3')](_0x329ab4);}_0x329ab4['retry']-=0x1;if(!this[_0x3d94('0x84')](_0x329ab4[_0x3d94('0x10f')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x329ab4,_0x3d94('0x165'));}var _0x3f04fc=this['getSound']['sync'](this,_0x329ab4[_0x3d94('0x10f')]);if(!_0x3f04fc){return this[_0x3d94('0xc')]['error'](_0x329ab4,'no\x20file\x20audio\x20found');}var _0x7ac1c0=this['channel'][_0x3d94('0x111')](_0x3f04fc,_0x329ab4[_0x3d94('0x166')],_0x329ab4['digit']);var _0xf12e07=_0x7ac1c0[_0x3d94('0xa1')];if(_0x7ac1c0['result']===-0x1){this['createSquareDetailsReport'][_0x3d94('0x70')](this,_0x329ab4,'-1');return _0x7ac1c0;}else if(_0x7ac1c0[_0x3d94('0xa0')]==='timeout'){_0x7ac1c0[_0x3d94('0xa1')]=_0x7ac1c0[_0x3d94('0xa1')][_0x3d94('0x99')]>0x0?_0x7ac1c0['result']:'t';}else if(_[_0x3d94('0x46')](_0x7ac1c0[_0x3d94('0xa1')])){_0x7ac1c0[_0x3d94('0xa1')]='#';_0xf12e07='#';}if(!this[_0x3d94('0x84')](_0x329ab4[_0x3d94('0xd5')])){this[_0x3d94('0xc')]['noop'](_0x3d94('0xd6'));}else{var _0xef3289=this[_0x3d94('0xe')]['sync'](this,_0x329ab4[_0x3d94('0xd5')]);if(!_0xef3289){return this['channel'][_0x3d94('0x2e')](_0x329ab4,'no\x20variable\x20found');}this[_0x3d94('0xc')]['setVariable'](_0xef3289,_0xf12e07);}this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x329ab4,_0xf12e07);return _0x7ac1c0;};AGIVertices[_0x3d94('0x13')][_0x3d94('0xa7')]=function(_0x3d7383){logger[_0x3d94('0x30')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3d7383[_0x3d94('0x3a')]));return this['channel'][_0x3d94('0xa7')](_0x3d7383[_0x3d94('0x167')]||_0x3d7383[_0x3d94('0x3a')]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x168')]=function(_0xa578b){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x169'),_0xa578b[_0x3d94('0x3a')]));if(!this['isConfigured'](_0xa578b[_0x3d94('0x158')])){return this['channel'][_0x3d94('0x2e')](_0xa578b,_0x3d94('0x156'));}logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x157'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0xa578b[_0x3d94('0x158')]));var _0x4bad72=this[_0x3d94('0x50')]['sync'](this,_0xa578b[_0x3d94('0x16a')]);var _0x1b69c2=this[_0x3d94('0x51')][_0x3d94('0x70')](this,_0xa578b['findBy'],_0x4bad72);if(_0x1b69c2){logger['info'](util['format'](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0xa578b[_0x3d94('0x158')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this['channel'][_0x3d94('0x3e')],_0xa578b[_0x3d94('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3d94('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3d94('0xc')]['callerid'],_0xa578b['findBy']));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this['channel']['callerid'],_0xa578b[_0x3d94('0x158')]));return{'code':0xc8,'result':_0x3d94('0x15d')};}};AGIVertices[_0x3d94('0x13')][_0x3d94('0x16b')]=function(_0x3f8284){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x16c'),_0x3f8284[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x3f8284[_0x3d94('0x10f')])){return this[_0x3d94('0xc')]['error'](_0x3f8284,_0x3d94('0x165'));}var _0x20892c=this[_0x3d94('0x1f')]['sync'](this,_0x3f8284[_0x3d94('0x10f')]);if(!_0x20892c){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x3f8284,'no\x20file\x20audio\x20found');}var _0x97d82b=this[_0x3d94('0xc')]['exec'](_0x3d94('0x16d'),[_0x20892c,_0x3f8284[_0x3d94('0x10a')]]);if(_0x97d82b['result']===-0x1){return _0x97d82b;}return this['channel'][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('Executed\x20command\x20%s\x20%s',_0x3d94('0x16d'),_0x20892c));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x16e')]=function(_0x3b068f){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x16f'),_0x3b068f[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x3b068f[_0x3d94('0x170')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x3b068f,_0x3d94('0x171'));}var _0x14b1e0='';var _0x23b4d9=parseInt(_0x3b068f[_0x3d94('0x170')],0xa);if(isNaN(_0x23b4d9)){_0x14b1e0=_0x3b068f[_0x3d94('0x170')];}else{_0x14b1e0=this[_0x3d94('0x14')]['sync'](this,_0x3b068f[_0x3d94('0x170')]);if(!_0x14b1e0){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x3b068f,_0x3d94('0x172'));}}var _0x488cca='';if(this[_0x3d94('0x84')](_0x3b068f[_0x3d94('0x10f')])){var _0x2ced92=this[_0x3d94('0x1f')][_0x3d94('0x70')](this,_0x3b068f[_0x3d94('0x10f')]);if(_0x2ced92){_0x488cca=_0x2ced92;}}this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x3b068f,_0x14b1e0);if(_0x3b068f[_0x3d94('0x10a')]['indexOf']('x')<0x0){_0x3b068f[_0x3d94('0x10a')]+='x';}if(_0x3b068f[_0x3d94('0x10a')][_0x3d94('0x173')]('X')<0x0){_0x3b068f[_0x3d94('0x10a')]+='X';}this[_0x3d94('0xc')][_0x3d94('0x9d')](_0x3d94('0x174'),_0x14b1e0?_0x14b1e0[_0x3d94('0x175')]():'');var _0x242fdc=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0x176'),[_0x14b1e0,_0x3b068f[_0x3d94('0x10a')],_0x3b068f[_0x3d94('0x66')],_0x488cca,_0x3b068f['timeout'],_0x3b068f['agi'],_0x3b068f[_0x3d94('0x177')],_0x3b068f[_0x3d94('0x178')],'',_0x3b068f[_0x3d94('0x179')]]);if(_0x242fdc[_0x3d94('0xa1')]===-0x1){return _0x242fdc;}return this['channel'][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xc0'),'QUEUE',_0x14b1e0));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x17a')]=function(_0x437799){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x17b'),_0x437799[_0x3d94('0x3a')]));var _0x6ba5f1=_0x437799[_0x3d94('0x17c')]||'wav';var _0x35bbac=util[_0x3d94('0x2b')](_0x3d94('0x17d'),this[_0x3d94('0xc')][_0x3d94('0x39')],rs[_0x3d94('0x119')](0x5));var _0x1aab5c=util[_0x3d94('0x2b')](_0x3d94('0x17e'),FILES_PATH,_0x35bbac,_0x6ba5f1);var _0x802903=util['format'](_0x3d94('0x131'),FILES_PATH,_0x35bbac);this[_0x3d94('0x3d')][_0x3d94('0x70')](this,_0x437799,_0x35bbac,_0x1aab5c);this[_0x3d94('0xc')][_0x3d94('0x9d')](_0x3d94('0x17f'),_0x35bbac);logger['info'](_0x3d94('0x180'),_0x802903,_0x6ba5f1,_0x437799[_0x3d94('0x181')],_0x437799[_0x3d94('0x67')]);return this[_0x3d94('0xc')][_0x3d94('0x13a')](_0x802903,_0x6ba5f1,_0x437799[_0x3d94('0x181')],_0x437799['timeout'],undefined,!![]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x182')]=function(_0x31e5ba){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x183'),_0x31e5ba[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x31e5ba[_0x3d94('0x66')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x184'));}var _0x521855=this[_0x3d94('0x65')][_0x3d94('0x70')](this,_0x31e5ba);logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x185'),util[_0x3d94('0x186')](_0x521855,{'showHidden':![],'depth':null})));if(!this[_0x3d94('0x84')](_0x31e5ba[_0x3d94('0xd5')])){return this['channel'][_0x3d94('0xa7')](_0x3d94('0x187'));}var _0x129418=this[_0x3d94('0xe')][_0x3d94('0x70')](this,_0x31e5ba[_0x3d94('0xd5')]);if(!_0x129418){return this['channel']['error'](_0x31e5ba,_0x3d94('0x115'));}this['channel']['setVariable'](util[_0x3d94('0x2b')]('%s_STATUS_CODE',_0x129418),_0x521855[_0x3d94('0x188')]?_0x521855[_0x3d94('0x188')]:_0x3d94('0x189'));this[_0x3d94('0xc')][_0x3d94('0x9d')](util[_0x3d94('0x2b')](_0x3d94('0x18a'),_0x129418),_0x521855[_0x3d94('0x74')]?_0x521855[_0x3d94('0x74')]:'OK');if(_0x521855[_0x3d94('0x72')]){try{this[_0x3d94('0x9b')](_0x521855['body'],_0x129418);}catch(_0x5cc98e){logger[_0x3d94('0x2e')](util[_0x3d94('0x2b')](_0x3d94('0x18b'),_0x129418));}}return this['channel'][_0x3d94('0xa7')](util['format']('variable\x20%s\x20set',_0x129418));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x18c')]=function(_0x464633){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x18d'),_0x464633[_0x3d94('0x3a')]));return this['channel'][_0x3d94('0x18e')](_0x464633[_0x3d94('0x18f')]['replace'](/\s+/g,''),_0x464633[_0x3d94('0x181')]);};AGIVertices['prototype'][_0x3d94('0x190')]=function(_0x385c1b){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x385c1b[_0x3d94('0x3a')]));return this[_0x3d94('0xc')][_0x3d94('0x191')](_0x385c1b[_0x3d94('0x68')][_0x3d94('0x59')](/\s+/g,''),_0x385c1b[_0x3d94('0x181')]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x192')]=function(_0x32267e){logger['info'](util[_0x3d94('0x2b')](_0x3d94('0x193'),_0x32267e[_0x3d94('0x3a')]));return this[_0x3d94('0xc')]['sayPhonetic'](_0x32267e[_0x3d94('0x63')],_0x32267e[_0x3d94('0x181')]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x194')]=function(_0x5740ad){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x195'),_0x5740ad['label']));if(!this[_0x3d94('0x84')](_0x5740ad['account_id'])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x196'));}var _0x1e31a8=this[_0x3d94('0x22')][_0x3d94('0x70')](this,_0x5740ad[_0x3d94('0x197')]);if(!_0x1e31a8||!_0x1e31a8['Smtp']){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x5740ad,_0x3d94('0x198'));}var _0xd6f5ff={'from':util[_0x3d94('0x2b')](_0x3d94('0x199'),_0x1e31a8['name'],_0x1e31a8['email']||_0x1e31a8['Smtp']['user']),'to':_0x5740ad['to']||'','cc':_0x5740ad['cc']||'','bcc':_0x5740ad[_0x3d94('0x19a')]||'','subject':_0x5740ad['subject'],'html':_0x5740ad[_0x3d94('0x63')],'text':_0x5740ad[_0x3d94('0x63')]};var _0xf08fd2=_0x1e31a8[_0x3d94('0x19b')]();if(this[_0x3d94('0x84')](_0x5740ad[_0x3d94('0x19c')])){}logger[_0x3d94('0xdc')](_0x3d94('0x19d'),JSON[_0x3d94('0x73')](_0xd6f5ff));this['createSquareDetailsReport']['sync'](this,_0x5740ad,_0x5740ad[_0x3d94('0x197')]);this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x19e'),_0x1e31a8[_0x3d94('0x12')]));this[_0x3d94('0x24')][_0x3d94('0x70')](this,_0xf08fd2,_0xd6f5ff);return this[_0x3d94('0xc')]['noop'](_0x3d94('0x19f'));};AGIVertices['prototype'][_0x3d94('0x1a0')]=function(_0x1a867a){logger['info'](util['format'](_0x3d94('0x1a1'),_0x1a867a['label']));return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x1a2'));};AGIVertices['prototype']['sendSMS']=function(_0x13fb2d){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x1a3'),_0x13fb2d[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x13fb2d[_0x3d94('0x1a4')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x1a5'));}var _0x22d730=this[_0x3d94('0x36')]['sync'](this,_0x13fb2d['sms_account_id']);if(!_0x22d730){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x13fb2d,'no\x20sms\x20account\x20found');}var _0x1f3fe={'body':_0x13fb2d[_0x3d94('0x1a6')],'phone':_0x13fb2d['to']||'','SmsAccountId':_0x22d730['id']};logger[_0x3d94('0xdc')](_0x3d94('0x1a7'),JSON[_0x3d94('0x73')](_0x1f3fe));this['createSquareDetailsReport'][_0x3d94('0x70')](this,_0x13fb2d,_0x13fb2d[_0x3d94('0x1a4')]);this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x1a8'),_0x22d730[_0x3d94('0x12')]));this[_0x3d94('0x37')][_0x3d94('0x70')](this,_0x1f3fe);return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x1a9'));};AGIVertices['prototype'][_0x3d94('0x1aa')]=function(_0x2a2c9b){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x1ab'),_0x2a2c9b[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x2a2c9b[_0x3d94('0xd5')])){return this['channel'][_0x3d94('0x2e')](_0x2a2c9b,_0x3d94('0x1ac'));}var _0x469f43=this[_0x3d94('0xe')][_0x3d94('0x70')](this,_0x2a2c9b[_0x3d94('0xd5')]);if(!_0x469f43){return this['channel'][_0x3d94('0x2e')](_0x2a2c9b,_0x3d94('0x115'));}return this[_0x3d94('0xc')]['setVariable'](_0x469f43,_0x2a2c9b[_0x3d94('0x1ad')]);};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1ae')]=function(_0x4b2286){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4b2286[_0x3d94('0x3a')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x1af'));if(_0x4b2286[_0x3d94('0xb5')]==='yes'){this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0x1b0'));return this[_0x3d94('0xc')]['answer']();}return this[_0x3d94('0xc')]['noop'](_0x3d94('0x1b1'));};AGIVertices['prototype'][_0x3d94('0x1b2')]=function(_0x1fbca4){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x1b3'),_0x1fbca4[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x1fbca4['project_id'])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x1fbca4,'no\x20subproject\x20selected');}var _0x229f90=this[_0x3d94('0x17')][_0x3d94('0x70')](this,_0x1fbca4[_0x3d94('0x1b4')]);if(!this[_0x3d94('0x84')](_0x229f90)){return this['channel'][_0x3d94('0x2e')](_0x1fbca4,util['format'](_0x3d94('0x1b5'),_0x1fbca4[_0x3d94('0x1b4')]));}if(_0x229f90===this[_0x3d94('0xc')]['arg_1']){return this[_0x3d94('0xc')]['error'](_0x1fbca4,_0x3d94('0x1b6'));}this[_0x3d94('0x38')][_0x3d94('0x70')](this,_0x1fbca4,_0x229f90);var _0x2f3698=this[_0x3d94('0xc')][_0x3d94('0x57')]('AGI',util['format'](_0x3d94('0x1b7'),config[_0x3d94('0x8')][_0x3d94('0x1b8')]||_0x3d94('0x1b9'),_0x229f90,this[_0x3d94('0xc')]['arg_1']));if(_0x2f3698[_0x3d94('0xa1')]===-0x1){return _0x2f3698;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xc0'),_0x3d94('0x1ba'),_0x229f90));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1bb')]=function(_0x1ba6d1){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x1bc'),_0x1ba6d1[_0x3d94('0x3a')]));var _0x3392ca=this['shellCommand'][_0x3d94('0x70')](this,_0x1ba6d1[_0x3d94('0x1bd')]);this['createSquareDetailsReport'][_0x3d94('0x70')](this,_0x1ba6d1,_0x1ba6d1[_0x3d94('0x1bd')]);if(this[_0x3d94('0x84')](_0x1ba6d1['variable_id'])){var _0x1504ce=this['getVariable'][_0x3d94('0x70')](this,_0x1ba6d1['variable_id']);if(_0x1504ce){this['channel'][_0x3d94('0x9d')](_0x1504ce,_0x3392ca);return this[_0x3d94('0xc')]['noop'](util['format'](_0x3d94('0x1be'),_0x1ba6d1['command'],_0x1504ce));}}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1ba6d1[_0x3d94('0x1bd')]));};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1bf')]=function(_0x17a299){logger[_0x3d94('0x30')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x17a299['label']));_0x17a299[_0x3d94('0x63')]=_0x17a299[_0x3d94('0x63')][_0x3d94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3d94('0x84')](_0x17a299[_0x3d94('0x5b')])){return this['channel'][_0x3d94('0xa7')]('no\x20apiKey\x20configured');}if(!this[_0x3d94('0x84')](_0x17a299[_0x3d94('0x63')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xc3'));}this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x1c0'),_0x17a299[_0x3d94('0x63')]));var _0xaaa86a=this[_0x3d94('0x5a')][_0x3d94('0x70')](this,_0x17a299);if(_0xaaa86a){this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x1c1'),_0xaaa86a));var _0x132a16=this[_0x3d94('0xc')]['streamFile'](_0xaaa86a);try{fs['unlink'](_0xaaa86a+_0x3d94('0xff'));}catch(_0x25c4b2){logger[_0x3d94('0x2e')](_0x25c4b2);}return _0x132a16;}return this['channel'][_0x3d94('0x2e')](_0x17a299,_0x3d94('0x1c2'));};AGIVertices['prototype'][_0x3d94('0x1c3')]=function(_0x51b845){logger[_0x3d94('0x30')](util['format'](_0x3d94('0x1c4'),_0x51b845['label']));_0x51b845[_0x3d94('0x63')]=_0x51b845[_0x3d94('0x63')][_0x3d94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3d94('0x84')](_0x51b845[_0x3d94('0x63')])){return this[_0x3d94('0xc')][_0x3d94('0xa7')](_0x3d94('0xc3'));}this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x1c5'),_0x51b845[_0x3d94('0x63')]));var _0x1c72d=this[_0x3d94('0x62')][_0x3d94('0x70')](this,_0x51b845);if(_0x1c72d){this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x1c6'),_0x1c72d));var _0xca0289=this[_0x3d94('0xc')][_0x3d94('0xfe')](_0x1c72d);try{fs['unlink'](_0x1c72d+'.wav');}catch(_0x267064){logger[_0x3d94('0x2e')](_0x267064);}return _0xca0289;}return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x51b845,_0x3d94('0x1c7'));};AGIVertices['prototype'][_0x3d94('0x1c8')]=function(_0x4c1795){logger['info'](util[_0x3d94('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x4c1795[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x4c1795[_0x3d94('0x158')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x4c1795,_0x3d94('0x156'));}logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x157'),this['channel'][_0x3d94('0x3e')],_0x4c1795[_0x3d94('0x158')]));var _0x5bcf28=this[_0x3d94('0x53')]['sync'](this,_0x4c1795[_0x3d94('0x158')]);if(_0x5bcf28){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x4c1795[_0x3d94('0x158')]));this[_0x3d94('0xc')]['noop'](util[_0x3d94('0x2b')](_0x3d94('0x159'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x4c1795['findBy']));return{'code':0xc8,'result':_0x3d94('0x15a')};}else{logger[_0x3d94('0x30')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x4c1795[_0x3d94('0x158')]));this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0x15b'),this[_0x3d94('0xc')][_0x3d94('0x3e')],_0x4c1795['findBy']));return{'code':0xc8,'result':_0x3d94('0x15d')};}};AGIVertices[_0x3d94('0x13')][_0x3d94('0x1c9')]=function(_0x1e8534){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1e8534[_0x3d94('0x3a')]));var _0x453254=this[_0x3d94('0xc')][_0x3d94('0x57')](_0x3d94('0x1ca'),[_0x1e8534[_0x3d94('0x1cb')],_0x1e8534[_0x3d94('0x77')]]);if(_0x453254[_0x3d94('0xa1')]===-0x1){return _0x453254;}return this[_0x3d94('0xc')][_0x3d94('0xa7')](util[_0x3d94('0x2b')](_0x3d94('0xc0'),_0x3d94('0x1ca'),_0x1e8534[_0x3d94('0x1cb')]));};AGIVertices[_0x3d94('0x13')]['vswitch']=function(_0x59ac0f){logger[_0x3d94('0x30')](util[_0x3d94('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x59ac0f[_0x3d94('0x3a')]));if(!this[_0x3d94('0x84')](_0x59ac0f[_0x3d94('0xd5')])){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x59ac0f,'no\x20variable\x20selected');}var _0x2d4afc=this['getVariable'][_0x3d94('0x70')](this,_0x59ac0f[_0x3d94('0xd5')]);if(!_0x2d4afc){return this[_0x3d94('0xc')][_0x3d94('0x2e')](_0x59ac0f,_0x3d94('0x115'));}var _0x20c121=this[_0x3d94('0xc')]['getVariable'](_0x2d4afc);return{'code':0xc8,'result':_0x20c121[_0x3d94('0xa0')]?_0x20c121['extra']:'-'};};String[_0x3d94('0x13')]['replaceAll']=function(_0x5e56fd,_0x5c592c){return this[_0x3d94('0x9e')](_0x5e56fd)[_0x3d94('0x1cc')](_0x5c592c);};module[_0x3d94('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 13b3225..dc1de66 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 _0xb067=['acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','mandatoryDisposition','name','mandatoryDispositionPause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','queue','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xb067,0x16a));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7b06('0x0'));var _=require('lodash');var moment=require(_0x7b06('0x1'));var ami=require(_0x7b06('0x2'));var logger=require(_0x7b06('0x3'))('acw');var RpcUser=require(_0x7b06('0x4'));var RpcVoiceAgentReport=require(_0x7b06('0x5'));function Acw(_0x346608){this[_0x7b06('0x6')]=_0x346608['voiceQueues'];this['agents']=_0x346608[_0x7b06('0x7')];this[_0x7b06('0x8')]=_0x346608[_0x7b06('0x8')];this['channels']={};ami['on'](_0x7b06('0x9'),this[_0x7b06('0xa')][_0x7b06('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x7b06('0xb')](this));ami['on'](_0x7b06('0xc'),this[_0x7b06('0xd')][_0x7b06('0xb')](this));ami['on'](_0x7b06('0xe'),this[_0x7b06('0xf')]['bind'](this));ami['on'](_0x7b06('0x10'),this[_0x7b06('0x11')]['bind'](this));ami['on'](_0x7b06('0x12'),this[_0x7b06('0x13')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x7b06('0x14')][_0x7b06('0xb')](this));}function getDiff(_0x321914){var _0x4e92f7=moment()[_0x7b06('0x15')](0x0);var _0x146b83=moment(_0x321914)[_0x7b06('0x15')](0x0);return _0x4e92f7[_0x7b06('0x16')](_0x146b83,_0x7b06('0x17'));}Acw[_0x7b06('0x18')][_0x7b06('0x19')]=function(_0x376dbb){try{var _0x471302=this;var _0x346190=this[_0x7b06('0x1a')][_0x376dbb][_0x7b06('0x1b')];var _0x27351a=this[_0x7b06('0x1a')][_0x376dbb]['queue'];var _0x5b6aa4=this[_0x7b06('0x6')][_0x27351a];var _0xecba57=![];var _0x4a7b85='ACW';if(_0x5b6aa4[_0x7b06('0x1c')]){if(_0x5b6aa4['mandatoryDispositionPause'][_0x7b06('0x1d')]){_0xecba57=!![];_0x4a7b85=_0x5b6aa4[_0x7b06('0x1e')][_0x7b06('0x1d')];}}ami['Action']({'action':'QueuePause','interface':_0x346190,'paused':!![],'reason':_0x4a7b85})[_0x7b06('0x1f')](function(_0x3d3b4d){if(_0x471302[_0x7b06('0x7')][_0x346190]){return RpcUser[_0x7b06('0x20')](_0x471302[_0x7b06('0x7')][_0x346190]['id'])[_0x7b06('0x1f')](function(_0x1c0a64){if(_0x1c0a64&&!_0x1c0a64['voicePause']){logger[_0x7b06('0x21')](_0x7b06('0x22'),_0x376dbb,_0x346190,_0x27351a);var _0x15af1b=_0x471302[_0x7b06('0x1a')][_0x376dbb][_0x7b06('0x23')]&&_0x471302[_0x7b06('0x1a')][_0x376dbb][_0x7b06('0x24')]?_0x471302[_0x7b06('0x1a')][_0x376dbb]['destlinkedid']:_0x376dbb;return RpcUser['savePause'](_0x471302['agents'][_0x346190],_0x4a7b85,_0x15af1b)[_0x7b06('0x1f')](function(_0x43bc54){if(!_0xecba57){_0x471302[_0x7b06('0x8')][_0x346190]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x376dbb,_0x471302['voiceQueues'][_0x27351a][_0x7b06('0x25')],_0x346190,_0x27351a);_0x471302[_0x7b06('0x8')][_0x346190]['timer']=setTimeout(_0x471302[_0x7b06('0x26')][_0x7b06('0xb')](_0x471302,_0x346190),_0x471302['voiceQueues'][_0x27351a][_0x7b06('0x25')]*0x3e8);_0x471302['timers'][_0x346190]['lastPauseAt']=moment()[_0x7b06('0x27')](_0x7b06('0x28'));_0x471302['timers'][_0x346190][_0x7b06('0x29')]=_0x376dbb;_0x471302['timers'][_0x346190]['queue']=_0x27351a;_0x471302[_0x7b06('0x8')][_0x346190]['updateAcw']=function(){var _0x105aa5=getDiff(_0x471302[_0x7b06('0x8')][_0x346190][_0x7b06('0x2a')]);clearTimeout(_0x471302[_0x7b06('0x8')][_0x346190][_0x7b06('0x2b')]);_0x471302[_0x7b06('0x8')][_0x346190][_0x7b06('0x2b')]=![];RpcVoiceAgentReport[_0x7b06('0x2c')]({'acwtime':_0x105aa5},_0x471302['timers'][_0x346190][_0x7b06('0x29')],_0x346190)[_0x7b06('0x1f')](function(_0x1cea68){logger[_0x7b06('0x21')](_0x7b06('0x2d'),_0x376dbb,_0x105aa5,_0x1cea68);})[_0x7b06('0x2e')](function(_0xe3ec8d){logger[_0x7b06('0x2f')](_0x7b06('0x30'),_0x376dbb,_0xe3ec8d);});delete _0x471302[_0x7b06('0x8')][_0x346190];};}});}else{logger[_0x7b06('0x21')](_0x7b06('0x31'),_0x376dbb,_0x346190,_0x27351a);}});}})[_0x7b06('0x2e')](function(_0xcd4cd){logger['error'](_0x7b06('0x32'),_0x376dbb,_0x471302[_0x7b06('0x6')][_0x27351a]['acwTimeout'],_0x346190,_0x27351a);})[_0x7b06('0x33')](function(){delete _0x471302['channels'][_0x376dbb];});}catch(_0x1ac438){logger['error']('[ACW][START]\x20%s',_0x1ac438['message']);}};Acw[_0x7b06('0x18')][_0x7b06('0x26')]=function(_0x3aeecc){try{var _0x5980cb=this;if(_0x5980cb['timers'][_0x3aeecc]){_0x5980cb[_0x7b06('0x8')][_0x3aeecc][_0x7b06('0x2b')]=![];var _0x42e692=_0x5980cb[_0x7b06('0x8')][_0x3aeecc][_0x7b06('0x29')];var _0x51cd15=_0x5980cb[_0x7b06('0x8')][_0x3aeecc][_0x7b06('0x34')];var _0x57c79a=_0x5980cb['voiceQueues'][_0x51cd15][_0x7b06('0x25')];logger[_0x7b06('0x21')]('[%s][TIMER][STOP][AGENT:%s]',_0x42e692,_0x3aeecc);RpcUser[_0x7b06('0x35')](this[_0x7b06('0x7')][_0x3aeecc]);RpcVoiceAgentReport['update']({'acwtime':_0x57c79a,'agentacw':!![]},_0x42e692,_0x3aeecc)[_0x7b06('0x1f')](function(_0xeed0bf){logger[_0x7b06('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x42e692,_0x57c79a,_0xeed0bf);})[_0x7b06('0x2e')](function(_0x32d49a){logger[_0x7b06('0x2f')](_0x7b06('0x30'),_0x42e692,_0x32d49a);});}else{logger['error'](_0x7b06('0x36'),_0x3aeecc);if(_0x5980cb[_0x7b06('0x8')]){logger['info'](_0x7b06('0x37'),JSON['stringify'](_0x5980cb[_0x7b06('0x8')]));}}}catch(_0x2dd36c){logger[_0x7b06('0x2f')](_0x7b06('0x38'),_0x2dd36c[_0x7b06('0x39')]);}};Acw['prototype'][_0x7b06('0xa')]=function(_0x3af6dc){try{if(this[_0x7b06('0x6')][_0x3af6dc['queue']]&&(this[_0x7b06('0x6')][_0x3af6dc['queue']][_0x7b06('0x3a')]||this[_0x7b06('0x6')][_0x3af6dc[_0x7b06('0x34')]]['mandatoryDisposition'])){if(this[_0x7b06('0x7')][_0x3af6dc[_0x7b06('0x1b')]]){this[_0x7b06('0x1a')][_0x3af6dc[_0x7b06('0x29')]]={'queue':_0x3af6dc[_0x7b06('0x34')],'interface':_0x3af6dc['interface'],'destlinkedid':_0x3af6dc[_0x7b06('0x24')]};}}}catch(_0x181691){logger[_0x7b06('0x2f')](_0x7b06('0x3b'),_0x181691[_0x7b06('0x39')]);}};Acw[_0x7b06('0x18')]['syncAgentConnectPreview']=function(_0x1f1acb){try{if(this[_0x7b06('0x6')][_0x1f1acb[_0x7b06('0x34')]]&&(this[_0x7b06('0x6')][_0x1f1acb[_0x7b06('0x34')]][_0x7b06('0x3a')]||this[_0x7b06('0x6')][_0x1f1acb[_0x7b06('0x34')]][_0x7b06('0x1c')])){if(this[_0x7b06('0x7')][_0x1f1acb[_0x7b06('0x1b')]]){this[_0x7b06('0x1a')][_0x1f1acb[_0x7b06('0x29')]]={'queue':_0x1f1acb['queue'],'interface':_0x1f1acb[_0x7b06('0x1b')]};}}}catch(_0x275acf){logger[_0x7b06('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x275acf[_0x7b06('0x39')]);}};Acw[_0x7b06('0x18')][_0x7b06('0x3c')]=function(_0xecac44){try{if(this[_0x7b06('0x1a')][_0xecac44[_0x7b06('0x29')]]&&_[_0x7b06('0x3d')](this[_0x7b06('0x1a')][_0xecac44[_0x7b06('0x29')]][_0x7b06('0x23')])){logger[_0x7b06('0x21')](_0x7b06('0x3e'),_0xecac44[_0x7b06('0x29')]);this['startAcw'](_0xecac44[_0x7b06('0x29')]);}else if(this[_0x7b06('0x1a')][_0xecac44[_0x7b06('0x3f')]]&&_['isUndefined'](this[_0x7b06('0x1a')][_0xecac44[_0x7b06('0x3f')]][_0x7b06('0x23')])){logger['info']('[%s][HANGUP:LINKEDID]',_0xecac44[_0x7b06('0x3f')]);this['startAcw'](_0xecac44[_0x7b06('0x3f')]);}}catch(_0x24339b){logger[_0x7b06('0x2f')](_0x7b06('0x40'),_0x24339b[_0x7b06('0x39')]);}};Acw[_0x7b06('0x18')][_0x7b06('0xd')]=function(_0x5031df){try{if(this[_0x7b06('0x1a')][_0x5031df[_0x7b06('0x29')]]&&this[_0x7b06('0x1a')][_0x5031df[_0x7b06('0x29')]][_0x7b06('0x23')]){logger[_0x7b06('0x21')](_0x7b06('0x41'),_0x5031df[_0x7b06('0x29')]);this[_0x7b06('0x19')](_0x5031df[_0x7b06('0x29')]);}else if(this[_0x7b06('0x1a')][_0x5031df[_0x7b06('0x3f')]]&&this[_0x7b06('0x1a')][_0x5031df[_0x7b06('0x3f')]][_0x7b06('0x23')]){logger[_0x7b06('0x21')](_0x7b06('0x42'),_0x5031df[_0x7b06('0x3f')]);this['startAcw'](_0x5031df[_0x7b06('0x3f')]);}}catch(_0x42e311){logger[_0x7b06('0x2f')](_0x7b06('0x43'),_0x42e311[_0x7b06('0x39')]);}};Acw[_0x7b06('0x18')][_0x7b06('0x11')]=function(_0x58f1cd){try{if(!_[_0x7b06('0x44')](this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x45')]])){this['startAcw'](_0x58f1cd[_0x7b06('0x45')]);if(this[_0x7b06('0x1a')][_0x58f1cd['secondtransfereruniqueid']]){this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x46')]][_0x7b06('0x23')]=!![];this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x47')]]=this['channels'][_0x58f1cd['secondtransfereruniqueid']];delete this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x46')]];}}else if(!_[_0x7b06('0x44')](this[_0x7b06('0x1a')][_0x58f1cd['transfertargetuniqueid']])){this[_0x7b06('0x19')](_0x58f1cd[_0x7b06('0x47')]);if(this[_0x7b06('0x1a')][_0x58f1cd['origtransfereruniqueid']]){this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x48')]][_0x7b06('0x23')]=!![];this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x45')]]=this['channels'][_0x58f1cd['origtransfereruniqueid']];delete this[_0x7b06('0x1a')][_0x58f1cd[_0x7b06('0x48')]];}}}catch(_0x1ec049){logger[_0x7b06('0x2f')](_0x7b06('0x49'),_0x1ec049[_0x7b06('0x39')]);}};Acw['prototype'][_0x7b06('0x13')]=function(_0x52361e){try{if(this[_0x7b06('0x1a')][_0x52361e[_0x7b06('0x4a')]]){logger[_0x7b06('0x21')](_0x7b06('0x4b'),JSON['stringify'](_0x52361e[_0x7b06('0x4a')]));this['startAcw'](_0x52361e[_0x7b06('0x4a')]);}else if(this[_0x7b06('0x1a')][_0x52361e[_0x7b06('0x4c')]]){logger[_0x7b06('0x21')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x52361e[_0x7b06('0x4c')]));this[_0x7b06('0x19')](_0x52361e[_0x7b06('0x4c')]);}}catch(_0x51a478){logger[_0x7b06('0x2f')](_0x7b06('0x4d'),_0x51a478[_0x7b06('0x39')]);}};Acw[_0x7b06('0x18')][_0x7b06('0xf')]=function(_0x27a085){try{if(this[_0x7b06('0x6')][_0x27a085[_0x7b06('0x34')]]&&this[_0x7b06('0x6')][_0x27a085[_0x7b06('0x34')]]['autopause']===_0x7b06('0x4e')){if(this[_0x7b06('0x7')][_0x27a085[_0x7b06('0x1b')]]){logger[_0x7b06('0x21')](_0x7b06('0x4f'),_0x27a085[_0x7b06('0x29')],_0x27a085[_0x7b06('0x1b')],_0x27a085[_0x7b06('0x34')]);return RpcUser[_0x7b06('0x50')](this['agents'][_0x27a085[_0x7b06('0x1b')]],_0x7b06('0x51'),_0x27a085[_0x7b06('0x29')]);}}}catch(_0x5c7433){logger[_0x7b06('0x2f')](_0x7b06('0x52'),_0x5c7433[_0x7b06('0x39')]);}};module[_0x7b06('0x53')]=Acw; \ No newline at end of file +var _0xed86=['syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s'];(function(_0x11ad93,_0x49306a){var _0x50535e=function(_0x30b454){while(--_0x30b454){_0x11ad93['push'](_0x11ad93['shift']());}};_0x50535e(++_0x49306a);}(_0xed86,0xb2));var _0x6ed8=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xed86[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x6ed8('0x0'));var _=require('lodash');var moment=require(_0x6ed8('0x1'));var ami=require(_0x6ed8('0x2'));var logger=require(_0x6ed8('0x3'))('acw');var RpcUser=require(_0x6ed8('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x519783){this[_0x6ed8('0x5')]=_0x519783[_0x6ed8('0x5')];this[_0x6ed8('0x6')]=_0x519783[_0x6ed8('0x6')];this['timers']=_0x519783['timers'];this['channels']={};ami['on'](_0x6ed8('0x7'),this[_0x6ed8('0x8')][_0x6ed8('0x9')](this));ami['on'](_0x6ed8('0xa'),this[_0x6ed8('0xb')][_0x6ed8('0x9')](this));ami['on']('hangup',this[_0x6ed8('0xc')][_0x6ed8('0x9')](this));ami['on'](_0x6ed8('0xd'),this['syncAgentRingNoAnswer'][_0x6ed8('0x9')](this));ami['on'](_0x6ed8('0xe'),this[_0x6ed8('0xf')][_0x6ed8('0x9')](this));ami['on'](_0x6ed8('0x10'),this[_0x6ed8('0x11')][_0x6ed8('0x9')](this));ami['on'](_0x6ed8('0x12'),this[_0x6ed8('0x13')][_0x6ed8('0x9')](this));}function getDiff(_0x4c29d7){var _0x5ef8aa=moment()[_0x6ed8('0x14')](0x0);var _0x4bb0b3=moment(_0x4c29d7)[_0x6ed8('0x14')](0x0);return _0x5ef8aa['diff'](_0x4bb0b3,_0x6ed8('0x15'));}Acw[_0x6ed8('0x16')]['startAcw']=function(_0x460c4d){try{var _0x3cc28d=this;var _0x123f28=this[_0x6ed8('0x17')][_0x460c4d][_0x6ed8('0x18')];var _0x4e9cd8=this[_0x6ed8('0x17')][_0x460c4d]['queue'];var _0x17bd63=this['voiceQueues'][_0x4e9cd8];var _0x224372=![];var _0x434cde=_0x6ed8('0x19');if(_0x17bd63[_0x6ed8('0x1a')]){if(_0x17bd63[_0x6ed8('0x1b')][_0x6ed8('0x1c')]){_0x224372=!![];_0x434cde=_0x17bd63['mandatoryDispositionPause'][_0x6ed8('0x1c')];}}ami[_0x6ed8('0x1d')]({'action':_0x6ed8('0x1e'),'interface':_0x123f28,'paused':!![],'reason':_0x434cde})[_0x6ed8('0x1f')](function(_0x513450){if(_0x3cc28d['agents'][_0x123f28]){return RpcUser[_0x6ed8('0x20')](_0x3cc28d[_0x6ed8('0x6')][_0x123f28]['id'])['then'](function(_0x451bb6){if(_0x451bb6&&!_0x451bb6[_0x6ed8('0x21')]){logger[_0x6ed8('0x22')](_0x6ed8('0x23'),_0x460c4d,_0x123f28,_0x4e9cd8);var _0x4562cd=_0x3cc28d[_0x6ed8('0x17')][_0x460c4d]['attended']&&_0x3cc28d['channels'][_0x460c4d][_0x6ed8('0x24')]?_0x3cc28d[_0x6ed8('0x17')][_0x460c4d][_0x6ed8('0x24')]:_0x460c4d;return RpcUser[_0x6ed8('0x25')](_0x3cc28d[_0x6ed8('0x6')][_0x123f28],_0x434cde,_0x4562cd)[_0x6ed8('0x1f')](function(_0x4a8274){if(!_0x224372){_0x3cc28d[_0x6ed8('0x26')][_0x123f28]={};logger['info'](_0x6ed8('0x27'),_0x460c4d,_0x3cc28d[_0x6ed8('0x5')][_0x4e9cd8]['acwTimeout'],_0x123f28,_0x4e9cd8);_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x28')]=setTimeout(_0x3cc28d['stopAcw'][_0x6ed8('0x9')](_0x3cc28d,_0x123f28),_0x3cc28d[_0x6ed8('0x5')][_0x4e9cd8][_0x6ed8('0x29')]*0x3e8);_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x2a')]=moment()[_0x6ed8('0x2b')](_0x6ed8('0x2c'));_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x2d')]=_0x460c4d;_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x2e')]=_0x4e9cd8;_0x3cc28d[_0x6ed8('0x26')][_0x123f28]['updateAcw']=function(){var _0x4b29ae=getDiff(_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x2a')]);clearTimeout(_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x28')]);_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x4b29ae},_0x3cc28d[_0x6ed8('0x26')][_0x123f28][_0x6ed8('0x2d')],_0x123f28)[_0x6ed8('0x1f')](function(_0x591311){logger[_0x6ed8('0x22')](_0x6ed8('0x2f'),_0x460c4d,_0x4b29ae,_0x591311);})[_0x6ed8('0x30')](function(_0x39d53a){logger['error'](_0x6ed8('0x31'),_0x460c4d,_0x39d53a);});delete _0x3cc28d[_0x6ed8('0x26')][_0x123f28];};}});}else{logger[_0x6ed8('0x22')](_0x6ed8('0x32'),_0x460c4d,_0x123f28,_0x4e9cd8);}});}})[_0x6ed8('0x30')](function(_0x4542dc){logger[_0x6ed8('0x33')](_0x6ed8('0x27'),_0x460c4d,_0x3cc28d['voiceQueues'][_0x4e9cd8][_0x6ed8('0x29')],_0x123f28,_0x4e9cd8);})['finally'](function(){delete _0x3cc28d['channels'][_0x460c4d];});}catch(_0x577e91){logger[_0x6ed8('0x33')](_0x6ed8('0x34'),_0x577e91['message']);}};Acw['prototype']['stopAcw']=function(_0x6c6482){try{var _0x2dc1bb=this;if(_0x2dc1bb[_0x6ed8('0x26')][_0x6c6482]){_0x2dc1bb[_0x6ed8('0x26')][_0x6c6482][_0x6ed8('0x28')]=![];var _0x23f8a9=_0x2dc1bb[_0x6ed8('0x26')][_0x6c6482]['uniqueid'];var _0x3245d6=_0x2dc1bb[_0x6ed8('0x26')][_0x6c6482][_0x6ed8('0x2e')];var _0x58032d=_0x2dc1bb[_0x6ed8('0x5')][_0x3245d6][_0x6ed8('0x29')];logger[_0x6ed8('0x22')](_0x6ed8('0x35'),_0x23f8a9,_0x6c6482);RpcUser[_0x6ed8('0x36')](this[_0x6ed8('0x6')][_0x6c6482]);RpcVoiceAgentReport[_0x6ed8('0x37')]({'acwtime':_0x58032d,'agentacw':!![]},_0x23f8a9,_0x6c6482)[_0x6ed8('0x1f')](function(_0x4ef793){logger[_0x6ed8('0x22')](_0x6ed8('0x2f'),_0x23f8a9,_0x58032d,_0x4ef793);})[_0x6ed8('0x30')](function(_0x5eec54){logger[_0x6ed8('0x33')](_0x6ed8('0x31'),_0x23f8a9,_0x5eec54);});}else{logger[_0x6ed8('0x33')](_0x6ed8('0x38'),_0x6c6482);if(_0x2dc1bb['timers']){logger['info'](_0x6ed8('0x39'),JSON[_0x6ed8('0x3a')](_0x2dc1bb[_0x6ed8('0x26')]));}}}catch(_0x248d2c){logger['error'](_0x6ed8('0x3b'),_0x248d2c['message']);}};Acw[_0x6ed8('0x16')]['syncAgentConnect']=function(_0x5296b2){try{if(this['voiceQueues'][_0x5296b2['queue']]&&(this[_0x6ed8('0x5')][_0x5296b2[_0x6ed8('0x2e')]][_0x6ed8('0x3c')]||this[_0x6ed8('0x5')][_0x5296b2['queue']][_0x6ed8('0x1a')])){if(this[_0x6ed8('0x6')][_0x5296b2[_0x6ed8('0x18')]]){this[_0x6ed8('0x17')][_0x5296b2['uniqueid']]={'queue':_0x5296b2[_0x6ed8('0x2e')],'interface':_0x5296b2[_0x6ed8('0x18')],'destlinkedid':_0x5296b2[_0x6ed8('0x24')]};}}}catch(_0x49ef3b){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x49ef3b[_0x6ed8('0x3d')]);}};Acw[_0x6ed8('0x16')][_0x6ed8('0x13')]=function(_0x13582e){try{if(this[_0x6ed8('0x5')][_0x13582e[_0x6ed8('0x2e')]]&&(this[_0x6ed8('0x5')][_0x13582e[_0x6ed8('0x2e')]][_0x6ed8('0x3c')]||this[_0x6ed8('0x5')][_0x13582e[_0x6ed8('0x2e')]][_0x6ed8('0x1a')])){if(this['agents'][_0x13582e[_0x6ed8('0x18')]]){this['channels'][_0x13582e[_0x6ed8('0x2d')]]={'queue':_0x13582e['queue'],'interface':_0x13582e[_0x6ed8('0x18')]};}}}catch(_0xf01e4a){logger[_0x6ed8('0x33')](_0x6ed8('0x3e'),_0xf01e4a['message']);}};Acw[_0x6ed8('0x16')][_0x6ed8('0xb')]=function(_0x33d15b){try{if(this['channels'][_0x33d15b[_0x6ed8('0x2d')]]&&_[_0x6ed8('0x3f')](this[_0x6ed8('0x17')][_0x33d15b[_0x6ed8('0x2d')]][_0x6ed8('0x40')])){logger[_0x6ed8('0x22')]('[%s][HANGUP:UNIQUEID]',_0x33d15b[_0x6ed8('0x2d')]);this[_0x6ed8('0x41')](_0x33d15b['uniqueid']);}else if(this['channels'][_0x33d15b[_0x6ed8('0x42')]]&&_['isUndefined'](this[_0x6ed8('0x17')][_0x33d15b['linkedid']][_0x6ed8('0x40')])){logger['info'](_0x6ed8('0x43'),_0x33d15b['linkedid']);this[_0x6ed8('0x41')](_0x33d15b[_0x6ed8('0x42')]);}}catch(_0x207dbb){logger[_0x6ed8('0x33')](_0x6ed8('0x44'),_0x207dbb[_0x6ed8('0x3d')]);}};Acw[_0x6ed8('0x16')][_0x6ed8('0xc')]=function(_0x244161){try{if(this['channels'][_0x244161[_0x6ed8('0x2d')]]&&this[_0x6ed8('0x17')][_0x244161['uniqueid']][_0x6ed8('0x40')]){logger['info'](_0x6ed8('0x45'),_0x244161[_0x6ed8('0x2d')]);this[_0x6ed8('0x41')](_0x244161[_0x6ed8('0x2d')]);}else if(this[_0x6ed8('0x17')][_0x244161[_0x6ed8('0x42')]]&&this[_0x6ed8('0x17')][_0x244161[_0x6ed8('0x42')]][_0x6ed8('0x40')]){logger[_0x6ed8('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x244161['linkedid']);this[_0x6ed8('0x41')](_0x244161['linkedid']);}}catch(_0x2b45ee){logger[_0x6ed8('0x33')](_0x6ed8('0x46'),_0x2b45ee[_0x6ed8('0x3d')]);}};Acw['prototype'][_0x6ed8('0xf')]=function(_0x3d0510){try{if(!_[_0x6ed8('0x47')](this['channels'][_0x3d0510['transfereeuniqueid']])){this[_0x6ed8('0x41')](_0x3d0510[_0x6ed8('0x48')]);if(this[_0x6ed8('0x17')][_0x3d0510['secondtransfereruniqueid']]){this[_0x6ed8('0x17')][_0x3d0510['secondtransfereruniqueid']]['attended']=!![];this[_0x6ed8('0x17')][_0x3d0510['transfertargetuniqueid']]=this[_0x6ed8('0x17')][_0x3d0510['secondtransfereruniqueid']];delete this['channels'][_0x3d0510['secondtransfereruniqueid']];}}else if(!_[_0x6ed8('0x47')](this[_0x6ed8('0x17')][_0x3d0510['transfertargetuniqueid']])){this['startAcw'](_0x3d0510[_0x6ed8('0x49')]);if(this[_0x6ed8('0x17')][_0x3d0510[_0x6ed8('0x4a')]]){this[_0x6ed8('0x17')][_0x3d0510[_0x6ed8('0x4a')]][_0x6ed8('0x40')]=!![];this[_0x6ed8('0x17')][_0x3d0510['transfereeuniqueid']]=this['channels'][_0x3d0510[_0x6ed8('0x4a')]];delete this[_0x6ed8('0x17')][_0x3d0510[_0x6ed8('0x4a')]];}}}catch(_0x299d24){logger[_0x6ed8('0x33')](_0x6ed8('0x4b'),_0x299d24['message']);}};Acw[_0x6ed8('0x16')][_0x6ed8('0x11')]=function(_0x136b93){try{if(this[_0x6ed8('0x17')][_0x136b93[_0x6ed8('0x4c')]]){logger[_0x6ed8('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6ed8('0x3a')](_0x136b93[_0x6ed8('0x4c')]));this[_0x6ed8('0x41')](_0x136b93['transfereruniqueid']);}else if(this[_0x6ed8('0x17')][_0x136b93[_0x6ed8('0x4d')]]){logger[_0x6ed8('0x22')](_0x6ed8('0x4e'),JSON[_0x6ed8('0x3a')](_0x136b93[_0x6ed8('0x4d')]));this['startAcw'](_0x136b93[_0x6ed8('0x4d')]);}}catch(_0x406a68){logger['error'](_0x6ed8('0x4f'),_0x406a68['message']);}};Acw['prototype'][_0x6ed8('0x50')]=function(_0x56dfb2){try{if(this[_0x6ed8('0x5')][_0x56dfb2['queue']]&&this[_0x6ed8('0x5')][_0x56dfb2['queue']][_0x6ed8('0x51')]===_0x6ed8('0x52')){if(this[_0x6ed8('0x6')][_0x56dfb2[_0x6ed8('0x18')]]){logger[_0x6ed8('0x22')](_0x6ed8('0x53'),_0x56dfb2[_0x6ed8('0x2d')],_0x56dfb2[_0x6ed8('0x18')],_0x56dfb2['queue']);return RpcUser[_0x6ed8('0x25')](this[_0x6ed8('0x6')][_0x56dfb2[_0x6ed8('0x18')]],'Auto-Pause',_0x56dfb2[_0x6ed8('0x2d')]);}}}catch(_0x421091){logger[_0x6ed8('0x33')](_0x6ed8('0x54'),_0x421091['message']);}};module[_0x6ed8('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f6c73f7..6164400 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x38fedf,_0xc5e240){var _0x39e44a=function(_0x24f38f){while(--_0x24f38f){_0x38fedf['push'](_0x38fedf['shift']());}};_0x39e44a(++_0xc5e240);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x44cbdc,_0x285518){var _0x302623=function(_0x153582){while(--_0x153582){_0x44cbdc['push'](_0x44cbdc['shift']());}};_0x302623(++_0x285518);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa03344,_0x581292){_0xa03344=_0xa03344-0x0;var _0x38acfd=_0x0b0e[_0xa03344];return _0x38acfd;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),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 f1bfbf2..a548fcd 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xcb91[_0x288f5e];return _0x476cc9;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x8d5fcc,_0x689ab3){var _0x23009a=function(_0x418e26){while(--_0x418e26){_0x8d5fcc['push'](_0x8d5fcc['shift']());}};_0x23009a(++_0x689ab3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5e4a9c,_0x2c0d9b){_0x5e4a9c=_0x5e4a9c-0x0;var _0x7f3c28=_0xbdb7[_0x5e4a9c];return _0x7f3c28;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index ef3baab..f531099 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d5e=['idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','queue','util','lodash','moment','string','isNil','uniqueid','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x6c4901,_0x45956a){var _0x50af8f=function(_0x3eea14){while(--_0x3eea14){_0x6c4901['push'](_0x6c4901['shift']());}};_0x50af8f(++_0x45956a);}(_0x5d5e,0x118));var _0xe5d5=function(_0x50c2d8,_0x5142f1){_0x50c2d8=_0x50c2d8-0x0;var _0x26b6e9=_0x5d5e[_0x50c2d8];return _0x26b6e9;};'use strict';var util=require(_0xe5d5('0x0'));var _=require(_0xe5d5('0x1'));var moment=require(_0xe5d5('0x2'));function checkNameSurname(_0x1e479d,_0x1b5f80,_0x1ca62e){var _0x157c36='';if(!_['isNil'](_0x1b5f80)&&_0xe5d5('0x3')===typeof _0x1b5f80){_0x157c36+=_0x1b5f80;}if(!_[_0xe5d5('0x4')](_0x1ca62e)&&_0xe5d5('0x3')===typeof _0x1ca62e){_0x157c36+='\x20'+_0x1ca62e;}if(_0x157c36!==''){return _0x157c36;}return _0x1e479d;}function Action(_0x15c6f3,_0x27504a,_0xdf5fcd){this['voiceQueue']=_0x15c6f3;this[_0xe5d5('0x5')]=_0xdf5fcd||undefined;this[_0xe5d5('0x6')]=checkNameSurname(_0x27504a[_0xe5d5('0x7')]['phone'],_0x27504a['Contact'][_0xe5d5('0x8')],_0x27504a['Contact'][_0xe5d5('0x9')]);this[_0xe5d5('0xa')]=_0x27504a[_0xe5d5('0x7')][_0xe5d5('0xb')];this['queue']=_0x15c6f3[_0xe5d5('0x6')];this['active']=_0x27504a[_0xe5d5('0xc')]||![];this[_0xe5d5('0xd')]=_0x15c6f3['type'];this[_0xe5d5('0xe')]=_0x15c6f3['dialQueueTimeout']||0x3;this['scheduledat']=_0x27504a[_0xe5d5('0xf')];this[_0xe5d5('0x10')]=_0x27504a['countbusyretry'];this[_0xe5d5('0x11')]=_0x27504a[_0xe5d5('0x11')];this['countnoanswerretry']=_0x27504a['countnoanswerretry'];this[_0xe5d5('0x12')]=_0x27504a[_0xe5d5('0x12')];this['countdropretry']=_0x27504a[_0xe5d5('0x13')];this[_0xe5d5('0x14')]=_0x27504a[_0xe5d5('0x14')];this[_0xe5d5('0x15')]=_0x27504a[_0xe5d5('0x15')];this[_0xe5d5('0x16')]=_0x27504a[_0xe5d5('0x16')];this[_0xe5d5('0x17')]=_0x27504a[_0xe5d5('0x17')];this[_0xe5d5('0x18')]=_0x27504a[_0xe5d5('0x18')];this[_0xe5d5('0x19')]=_0x27504a[_0xe5d5('0x19')];this['VoiceQueueId']=_0x27504a[_0xe5d5('0x1a')];this[_0xe5d5('0x1b')]=_0x27504a['CampaignId'];this[_0xe5d5('0x1c')]=_0x27504a['id'];this[_0xe5d5('0x1d')]=_0x27504a[_0xe5d5('0x7')][_0xe5d5('0x8')]||'';this['starttime']=moment()[_0xe5d5('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe5d5('0x1f')]=_0x27504a['callback'];this[_0xe5d5('0x20')]=_0x27504a['callbackuniqueid'];this[_0xe5d5('0x21')]=_0x27504a[_0xe5d5('0x21')];this[_0xe5d5('0x22')]=_0x27504a[_0xe5d5('0x22')];this[_0xe5d5('0x23')]='';this['originatecalleridname']='';}Action[_0xe5d5('0x24')][_0xe5d5('0x25')]=function(){return util[_0xe5d5('0x1e')](_0xe5d5('0x26'),this['name'],this[_0xe5d5('0x27')][_0xe5d5('0x28')]>0x0?this[_0xe5d5('0xa')][_0xe5d5('0x29')](this[_0xe5d5('0x27')][_0xe5d5('0x28')]):this[_0xe5d5('0xa')]);};Action[_0xe5d5('0x24')][_0xe5d5('0x2a')]=function(){return this[_0xe5d5('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0x1ffa=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','substring','exports','util','moment','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','number','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x1ec1fa,_0x3efb52){var _0x3e00f0=function(_0x5f2489){while(--_0x5f2489){_0x1ec1fa['push'](_0x1ec1fa['shift']());}};_0x3e00f0(++_0x3efb52);}(_0x1ffa,0x1bb));var _0xa1ff=function(_0x47bb39,_0x11ce8b){_0x47bb39=_0x47bb39-0x0;var _0x2e7f69=_0x1ffa[_0x47bb39];return _0x2e7f69;};'use strict';var util=require(_0xa1ff('0x0'));var _=require('lodash');var moment=require(_0xa1ff('0x1'));function checkNameSurname(_0x83fba1,_0x383a62,_0x3dbd8e){var _0x50b061='';if(!_['isNil'](_0x383a62)&&_0xa1ff('0x2')===typeof _0x383a62){_0x50b061+=_0x383a62;}if(!_[_0xa1ff('0x3')](_0x3dbd8e)&&'string'===typeof _0x3dbd8e){_0x50b061+='\x20'+_0x3dbd8e;}if(_0x50b061!==''){return _0x50b061;}return _0x83fba1;}function Action(_0x560e12,_0x2941d1,_0x6a3da8){this[_0xa1ff('0x4')]=_0x560e12;this[_0xa1ff('0x5')]=_0x6a3da8||undefined;this['name']=checkNameSurname(_0x2941d1[_0xa1ff('0x6')][_0xa1ff('0x7')],_0x2941d1['Contact'][_0xa1ff('0x8')],_0x2941d1[_0xa1ff('0x6')]['lastName']);this[_0xa1ff('0x9')]=_0x2941d1[_0xa1ff('0x6')]['phone'];this[_0xa1ff('0xa')]=_0x560e12[_0xa1ff('0xb')];this[_0xa1ff('0xc')]=_0x2941d1[_0xa1ff('0xc')]||![];this['type']=_0x560e12['type'];this['dialQueueTimeout']=_0x560e12[_0xa1ff('0xd')]||0x3;this[_0xa1ff('0xe')]=_0x2941d1['scheduledat'];this[_0xa1ff('0xf')]=_0x2941d1[_0xa1ff('0xf')];this[_0xa1ff('0x10')]=_0x2941d1['countcongestionretry'];this[_0xa1ff('0x11')]=_0x2941d1[_0xa1ff('0x11')];this[_0xa1ff('0x12')]=_0x2941d1[_0xa1ff('0x12')];this[_0xa1ff('0x13')]=_0x2941d1[_0xa1ff('0x13')];this[_0xa1ff('0x14')]=_0x2941d1['countabandonedretry'];this[_0xa1ff('0x15')]=_0x2941d1['countmachineretry'];this['countagentrejectretry']=_0x2941d1[_0xa1ff('0x16')];this['ContactId']=_0x2941d1[_0xa1ff('0x17')];this['ListId']=_0x2941d1[_0xa1ff('0x18')];this['UserId']=_0x2941d1[_0xa1ff('0x19')];this[_0xa1ff('0x1a')]=_0x2941d1[_0xa1ff('0x1a')];this[_0xa1ff('0x1b')]=_0x2941d1[_0xa1ff('0x1b')];this[_0xa1ff('0x1c')]=_0x2941d1['id'];this[_0xa1ff('0x1d')]=_0x2941d1[_0xa1ff('0x6')]['firstName']||'';this[_0xa1ff('0x1e')]=moment()[_0xa1ff('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa1ff('0x20')]=_0x2941d1[_0xa1ff('0x20')];this[_0xa1ff('0x21')]=_0x2941d1[_0xa1ff('0x21')];this[_0xa1ff('0x22')]=_0x2941d1[_0xa1ff('0x22')];this[_0xa1ff('0x23')]=_0x2941d1[_0xa1ff('0x23')];this[_0xa1ff('0x24')]='';this['originatecalleridname']='';}Action[_0xa1ff('0x25')][_0xa1ff('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xa1ff('0xb')],this[_0xa1ff('0x4')][_0xa1ff('0x27')]>0x0?this[_0xa1ff('0x9')][_0xa1ff('0x28')](this[_0xa1ff('0x4')][_0xa1ff('0x27')]):this[_0xa1ff('0x9')]);};Action[_0xa1ff('0x25')]['getQueue']=function(){return this[_0xa1ff('0xa')];};module[_0xa1ff('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 7c8b04a..f18868c 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3945=['queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type'];(function(_0x28e7ad,_0x304787){var _0x111aeb=function(_0x1df52b){while(--_0x1df52b){_0x28e7ad['push'](_0x28e7ad['shift']());}};_0x111aeb(++_0x304787);}(_0x3945,0xd4));var _0x5394=function(_0x5408cb,_0x294623){_0x5408cb=_0x5408cb-0x0;var _0x2b5ae8=_0x3945[_0x5408cb];return _0x2b5ae8;};'use strict';var util=require('util');var _=require(_0x5394('0x0'));var moment=require('moment');function getSeconds(_0xef03c0,_0x215851){var _0x5903f6=moment(_0xef03c0)['milliseconds'](0x0);var _0x3c9b33=moment(_0x215851)[_0x5394('0x1')](0x0);return _0x5903f6[_0x5394('0x2')](_0x3c9b33,_0x5394('0x3'));}function AgentComplete(_0x4a64ad,_0x37b40f){this[_0x5394('0x4')]=0x4;this[_0x5394('0x5')]='Answer';this[_0x5394('0x6')]=_0x4a64ad[_0x5394('0x6')];this[_0x5394('0x7')]=_0x4a64ad['type'];this['campaigntype']=_0x4a64ad[_0x5394('0x7')]==='outbound'?_0x5394('0x8'):_0x4a64ad[_0x5394('0x7')];this['countbusyretry']=_0x4a64ad[_0x5394('0x9')];this[_0x5394('0xa')]=_0x4a64ad[_0x5394('0xa')];this['countnoanswerretry']=_0x4a64ad['countnoanswerretry'];this[_0x5394('0xb')]=_0x4a64ad[_0x5394('0x9')]+_0x4a64ad['countcongestionretry']+_0x4a64ad[_0x5394('0xc')]+_0x4a64ad[_0x5394('0xd')]+_0x4a64ad[_0x5394('0xe')]+_0x4a64ad[_0x5394('0xf')]+_0x4a64ad[_0x5394('0x10')]+_0x4a64ad[_0x5394('0x11')];this[_0x5394('0xd')]=_0x4a64ad[_0x5394('0xd')];this[_0x5394('0xe')]=_0x4a64ad[_0x5394('0xe')];this[_0x5394('0xf')]=_0x4a64ad['countabandonedretry'];this[_0x5394('0x10')]=_0x4a64ad[_0x5394('0x10')];this[_0x5394('0x11')]=_0x4a64ad[_0x5394('0x11')];this[_0x5394('0x12')]=_0x37b40f[_0x5394('0x12')];this[_0x5394('0x13')]=_0x4a64ad[_0x5394('0x14')];this[_0x5394('0x15')]=_0x4a64ad[_0x5394('0x16')];this[_0x5394('0x17')]=_0x4a64ad[_0x5394('0x17')];this['responsetime']=_0x4a64ad[_0x5394('0x18')];this[_0x5394('0x19')]=_0x4a64ad[_0x5394('0x19')];this[_0x5394('0x1a')]=moment()[_0x5394('0x1b')](_0x5394('0x1c'));this['ringtime']=getSeconds(_0x4a64ad[_0x5394('0x18')],_0x4a64ad[_0x5394('0x17')]);this['holdtime']=getSeconds(_0x4a64ad[_0x5394('0x19')],_0x4a64ad[_0x5394('0x18')]);this[_0x5394('0x1d')]=getSeconds(this['endtime'],_0x4a64ad[_0x5394('0x19')]);this[_0x5394('0x8')]=_0x37b40f[_0x5394('0x8')];this[_0x5394('0x1e')]=_0x37b40f['membername'];this[_0x5394('0x1f')]=_0x37b40f[_0x5394('0x1f')];this[_0x5394('0x20')]=_0x4a64ad[_0x5394('0x20')];this[_0x5394('0x21')]=_0x4a64ad[_0x5394('0x21')];this[_0x5394('0x22')]=_0x4a64ad[_0x5394('0x22')];this[_0x5394('0x23')]=_0x4a64ad['recallme'];this[_0x5394('0x24')]=_0x4a64ad[_0x5394('0x24')];this[_0x5394('0x25')]=_0x4a64ad[_0x5394('0x25')];this['UserId']=_0x4a64ad[_0x5394('0x26')];this[_0x5394('0x27')]=_0x4a64ad[_0x5394('0x27')];this['CampaignId']=_0x4a64ad[_0x5394('0x28')];this['originatecalleridnum']=_0x4a64ad[_0x5394('0x29')]||'';this[_0x5394('0x2a')]=_0x4a64ad['originatecalleridname']||'';}module[_0x5394('0x2b')]=AgentComplete; \ No newline at end of file +var _0xc496=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','number','starttime'];(function(_0x472caf,_0x5c7dae){var _0x32f49b=function(_0x4fdee5){while(--_0x4fdee5){_0x472caf['push'](_0x472caf['shift']());}};_0x32f49b(++_0x5c7dae);}(_0xc496,0x1c2));var _0x6c49=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc496[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0x6c49('0x0'));var _=require(_0x6c49('0x1'));var moment=require(_0x6c49('0x2'));function getSeconds(_0x308adc,_0x57c717){var _0x49b7d8=moment(_0x308adc)[_0x6c49('0x3')](0x0);var _0x58c482=moment(_0x57c717)[_0x6c49('0x3')](0x0);return _0x49b7d8[_0x6c49('0x4')](_0x58c482,'seconds');}function AgentComplete(_0x3368f,_0x1f65fe){this['state']=0x4;this[_0x6c49('0x5')]=_0x6c49('0x6');this[_0x6c49('0x7')]=_0x3368f[_0x6c49('0x7')];this['type']=_0x3368f[_0x6c49('0x8')];this[_0x6c49('0x9')]=_0x3368f[_0x6c49('0x8')]===_0x6c49('0xa')?_0x6c49('0xb'):_0x3368f[_0x6c49('0x8')];this[_0x6c49('0xc')]=_0x3368f['countbusyretry'];this[_0x6c49('0xd')]=_0x3368f[_0x6c49('0xd')];this['countnoanswerretry']=_0x3368f['countnoanswerretry'];this[_0x6c49('0xe')]=_0x3368f[_0x6c49('0xc')]+_0x3368f[_0x6c49('0xd')]+_0x3368f['countnoanswerretry']+_0x3368f[_0x6c49('0xf')]+_0x3368f['countdropretry']+_0x3368f[_0x6c49('0x10')]+_0x3368f[_0x6c49('0x11')]+_0x3368f[_0x6c49('0x12')];this[_0x6c49('0xf')]=_0x3368f[_0x6c49('0xf')];this[_0x6c49('0x13')]=_0x3368f[_0x6c49('0x13')];this[_0x6c49('0x10')]=_0x3368f[_0x6c49('0x10')];this['countmachineretry']=_0x3368f['countmachineretry'];this[_0x6c49('0x12')]=_0x3368f[_0x6c49('0x12')];this[_0x6c49('0x14')]=_0x1f65fe[_0x6c49('0x14')];this['calleridname']=_0x3368f['name'];this['calleridnum']=_0x3368f[_0x6c49('0x15')];this['starttime']=_0x3368f[_0x6c49('0x16')];this[_0x6c49('0x17')]=_0x3368f[_0x6c49('0x17')];this[_0x6c49('0x18')]=_0x3368f[_0x6c49('0x18')];this[_0x6c49('0x19')]=moment()[_0x6c49('0x1a')](_0x6c49('0x1b'));this[_0x6c49('0x1c')]=getSeconds(_0x3368f[_0x6c49('0x17')],_0x3368f[_0x6c49('0x16')]);this['holdtime']=getSeconds(_0x3368f[_0x6c49('0x18')],_0x3368f[_0x6c49('0x17')]);this[_0x6c49('0x1d')]=getSeconds(this['endtime'],_0x3368f[_0x6c49('0x18')]);this[_0x6c49('0xb')]=_0x1f65fe[_0x6c49('0xb')];this['membername']=_0x1f65fe[_0x6c49('0x1e')];this['reason']=_0x1f65fe[_0x6c49('0x1f')];this[_0x6c49('0x20')]=_0x3368f[_0x6c49('0x20')];this[_0x6c49('0x21')]=_0x3368f[_0x6c49('0x21')];this[_0x6c49('0x22')]=_0x3368f[_0x6c49('0x22')];this[_0x6c49('0x23')]=_0x3368f[_0x6c49('0x23')];this[_0x6c49('0x24')]=_0x3368f[_0x6c49('0x24')];this[_0x6c49('0x25')]=_0x3368f[_0x6c49('0x25')];this[_0x6c49('0x26')]=_0x3368f[_0x6c49('0x26')];this[_0x6c49('0x27')]=_0x3368f[_0x6c49('0x27')];this[_0x6c49('0x28')]=_0x3368f[_0x6c49('0x28')];this[_0x6c49('0x29')]=_0x3368f[_0x6c49('0x29')]||'';this[_0x6c49('0x2a')]=_0x3368f[_0x6c49('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6501510..62365e0 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe015=['countnosuchnumberretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x9f5ac3,_0x105765){var _0x534f9c=function(_0x38be43){while(--_0x38be43){_0x9f5ac3['push'](_0x9f5ac3['shift']());}};_0x534f9c(++_0x105765);}(_0xe015,0x13b));var _0x5e01=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe015[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x5e01('0x0'));var _=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));function getSeconds(_0x5811ae,_0x51f689){var _0x46ed0d=moment(_0x5811ae)['milliseconds'](0x0);var _0x2136cf=moment(_0x51f689)[_0x5e01('0x3')](0x0);return _0x46ed0d[_0x5e01('0x4')](_0x2136cf,_0x5e01('0x5'));}function Final(_0x4ac3f1){this[_0x5e01('0x6')]=_0x4ac3f1[_0x5e01('0x6')];this['scheduledat']=_0x4ac3f1['scheduledat'];this[_0x5e01('0x7')]=_0x4ac3f1[_0x5e01('0x7')];this[_0x5e01('0x8')]=_0x4ac3f1[_0x5e01('0x7')]===_0x5e01('0x9')?_0x5e01('0xa'):_0x4ac3f1['type'];this[_0x5e01('0xb')]=_0x4ac3f1['countbusyretry'];this[_0x5e01('0xc')]=_0x4ac3f1['countcongestionretry'];this[_0x5e01('0xd')]=_0x4ac3f1[_0x5e01('0xd')];this['countglobal']=_0x4ac3f1[_0x5e01('0xb')]+_0x4ac3f1[_0x5e01('0xc')]+_0x4ac3f1['countnoanswerretry']+_0x4ac3f1['countnosuchnumberretry']+_0x4ac3f1[_0x5e01('0xe')]+_0x4ac3f1[_0x5e01('0xf')]+_0x4ac3f1[_0x5e01('0x10')]+_0x4ac3f1[_0x5e01('0x11')];this[_0x5e01('0x12')]=_0x4ac3f1[_0x5e01('0x12')];this['countdropretry']=_0x4ac3f1[_0x5e01('0xe')];this['countabandonedretry']=_0x4ac3f1['countabandonedretry'];this[_0x5e01('0x10')]=_0x4ac3f1[_0x5e01('0x10')];this['countagentrejectretry']=_0x4ac3f1[_0x5e01('0x11')];this['queue']=_0x4ac3f1[_0x5e01('0xa')];this['calleridname']=_0x4ac3f1[_0x5e01('0x13')];this['calleridnum']=_0x4ac3f1[_0x5e01('0x14')];this['starttime']=_0x4ac3f1['starttime'];this[_0x5e01('0x15')]=_0x4ac3f1[_0x5e01('0x15')];this['endtime']=_0x4ac3f1[_0x5e01('0x15')];this[_0x5e01('0x16')]=_0x4ac3f1[_0x5e01('0x16')]||0x0;this[_0x5e01('0x17')]=_0x4ac3f1[_0x5e01('0x17')]||0x0;this[_0x5e01('0x18')]=_0x4ac3f1[_0x5e01('0x18')]||0x0;this[_0x5e01('0x19')]=_0x4ac3f1['callback'];this[_0x5e01('0x1a')]=_0x4ac3f1[_0x5e01('0x1a')];this['callbackat']=_0x4ac3f1[_0x5e01('0x1b')];this[_0x5e01('0x1c')]=_0x4ac3f1[_0x5e01('0x1c')];this[_0x5e01('0x1d')]=_0x4ac3f1[_0x5e01('0x1d')];this[_0x5e01('0x1e')]=_0x4ac3f1['ListId'];this[_0x5e01('0x1f')]=_0x4ac3f1[_0x5e01('0x1f')];this[_0x5e01('0x20')]=_0x4ac3f1[_0x5e01('0x20')];this['CampaignId']=_0x4ac3f1[_0x5e01('0x21')];this[_0x5e01('0x22')]=_0x4ac3f1[_0x5e01('0x22')]||'';this['originatecalleridname']=_0x4ac3f1[_0x5e01('0x23')]||'';}module[_0x5e01('0x24')]=Final; \ No newline at end of file +var _0x4b19=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x4b19,0x195));var _0x94b1=function(_0x4b5e9f,_0x2fbea9){_0x4b5e9f=_0x4b5e9f-0x0;var _0x2b1cf1=_0x4b19[_0x4b5e9f];return _0x2b1cf1;};'use strict';var util=require(_0x94b1('0x0'));var _=require('lodash');var moment=require(_0x94b1('0x1'));function getSeconds(_0x32f392,_0x221ab3){var _0x577f52=moment(_0x32f392)[_0x94b1('0x2')](0x0);var _0x3648ad=moment(_0x221ab3)[_0x94b1('0x2')](0x0);return _0x577f52['diff'](_0x3648ad,_0x94b1('0x3'));}function Final(_0x11e23c){this['uniqueid']=_0x11e23c[_0x94b1('0x4')];this[_0x94b1('0x5')]=_0x11e23c['scheduledat'];this[_0x94b1('0x6')]=_0x11e23c[_0x94b1('0x6')];this[_0x94b1('0x7')]=_0x11e23c['type']===_0x94b1('0x8')?'queue':_0x11e23c['type'];this[_0x94b1('0x9')]=_0x11e23c[_0x94b1('0x9')];this[_0x94b1('0xa')]=_0x11e23c[_0x94b1('0xa')];this[_0x94b1('0xb')]=_0x11e23c[_0x94b1('0xb')];this['countglobal']=_0x11e23c[_0x94b1('0x9')]+_0x11e23c[_0x94b1('0xa')]+_0x11e23c[_0x94b1('0xb')]+_0x11e23c[_0x94b1('0xc')]+_0x11e23c['countdropretry']+_0x11e23c['countabandonedretry']+_0x11e23c[_0x94b1('0xd')]+_0x11e23c[_0x94b1('0xe')];this['countnosuchnumberretry']=_0x11e23c['countnosuchnumberretry'];this[_0x94b1('0xf')]=_0x11e23c[_0x94b1('0xf')];this['countabandonedretry']=_0x11e23c[_0x94b1('0x10')];this['countmachineretry']=_0x11e23c['countmachineretry'];this[_0x94b1('0xe')]=_0x11e23c[_0x94b1('0xe')];this[_0x94b1('0x11')]=_0x11e23c[_0x94b1('0x11')];this['calleridname']=_0x11e23c[_0x94b1('0x12')];this[_0x94b1('0x13')]=_0x11e23c[_0x94b1('0x13')];this[_0x94b1('0x14')]=_0x11e23c[_0x94b1('0x14')];this[_0x94b1('0x15')]=_0x11e23c[_0x94b1('0x15')];this['endtime']=_0x11e23c[_0x94b1('0x15')];this[_0x94b1('0x16')]=_0x11e23c[_0x94b1('0x16')]||0x0;this['holdtime']=_0x11e23c[_0x94b1('0x17')]||0x0;this[_0x94b1('0x18')]=_0x11e23c['talktime']||0x0;this[_0x94b1('0x19')]=_0x11e23c[_0x94b1('0x19')];this[_0x94b1('0x1a')]=_0x11e23c[_0x94b1('0x1a')];this[_0x94b1('0x1b')]=_0x11e23c[_0x94b1('0x1b')];this[_0x94b1('0x1c')]=_0x11e23c[_0x94b1('0x1c')];this[_0x94b1('0x1d')]=_0x11e23c[_0x94b1('0x1d')];this['ListId']=_0x11e23c[_0x94b1('0x1e')];this[_0x94b1('0x1f')]=_0x11e23c[_0x94b1('0x1f')];this['VoiceQueueId']=_0x11e23c[_0x94b1('0x20')];this['CampaignId']=_0x11e23c[_0x94b1('0x21')];this[_0x94b1('0x22')]=_0x11e23c[_0x94b1('0x22')]||'';this[_0x94b1('0x23')]=_0x11e23c['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index e0ca697..38ad22c 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e38=['ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x38ad58,_0x505e3a){var _0x36abe3=function(_0x247b28){while(--_0x247b28){_0x38ad58['push'](_0x38ad58['shift']());}};_0x36abe3(++_0x505e3a);}(_0x5e38,0x190));var _0x85e3=function(_0x5d64ce,_0x33126c){_0x5d64ce=_0x5d64ce-0x0;var _0x2f8661=_0x5e38[_0x5d64ce];return _0x2f8661;};'use strict';var util=require('util');var _=require(_0x85e3('0x0'));var moment=require(_0x85e3('0x1'));function getSeconds(_0x560d46,_0x5cb3e3){var _0x35061b=moment(_0x560d46)[_0x85e3('0x2')](0x0);var _0x8f14d1=moment(_0x5cb3e3)[_0x85e3('0x2')](0x0);return _0x35061b['diff'](_0x8f14d1,_0x85e3('0x3'));}function Hangup(_0x6008d3,_0x256688){this[_0x85e3('0x4')]=0x4;this['statedesc']=_0x85e3('0x5');this[_0x85e3('0x6')]=_0x6008d3[_0x85e3('0x6')];this[_0x85e3('0x7')]=_0x6008d3[_0x85e3('0x7')];this[_0x85e3('0x8')]=_0x6008d3[_0x85e3('0x7')]==='outbound'?_0x85e3('0x9'):_0x6008d3[_0x85e3('0x7')];this[_0x85e3('0xa')]=_0x6008d3[_0x85e3('0xa')];this[_0x85e3('0xb')]=_0x6008d3[_0x85e3('0xb')];this[_0x85e3('0xc')]=_0x6008d3['countnoanswerretry'];this[_0x85e3('0xd')]=_0x6008d3[_0x85e3('0xa')]+_0x6008d3[_0x85e3('0xb')]+_0x6008d3[_0x85e3('0xc')]+_0x6008d3[_0x85e3('0xe')]+_0x6008d3[_0x85e3('0xf')]+_0x6008d3[_0x85e3('0x10')]+_0x6008d3[_0x85e3('0x11')]+_0x6008d3[_0x85e3('0x12')];this[_0x85e3('0xe')]=_0x6008d3[_0x85e3('0xe')];this[_0x85e3('0xf')]=_0x6008d3[_0x85e3('0xf')];this[_0x85e3('0x10')]=_0x6008d3[_0x85e3('0x10')];this[_0x85e3('0x11')]=_0x6008d3[_0x85e3('0x11')];this['countagentrejectretry']=_0x6008d3[_0x85e3('0x12')];this['uniqueid']=_0x256688[_0x85e3('0x13')];this[_0x85e3('0x14')]=_0x6008d3[_0x85e3('0x15')];this['calleridnum']=_0x6008d3[_0x85e3('0x16')];this[_0x85e3('0x17')]=_0x6008d3[_0x85e3('0x17')];this['responsetime']=_0x6008d3[_0x85e3('0x18')];this[_0x85e3('0x19')]=moment()[_0x85e3('0x1a')](_0x85e3('0x1b'));this[_0x85e3('0x1c')]=getSeconds(_0x6008d3[_0x85e3('0x18')],_0x6008d3[_0x85e3('0x17')]);this[_0x85e3('0x1d')]=0x0;this[_0x85e3('0x1e')]=getSeconds(this['endtime'],_0x6008d3[_0x85e3('0x18')]);this[_0x85e3('0x9')]=_0x6008d3[_0x85e3('0x9')];this[_0x85e3('0x1f')]=_0x85e3('0x20');this[_0x85e3('0x21')]=_0x256688[_0x85e3('0x22')];this[_0x85e3('0x23')]=_0x6008d3[_0x85e3('0x23')];this[_0x85e3('0x24')]=_0x6008d3[_0x85e3('0x24')];this[_0x85e3('0x25')]=_0x6008d3[_0x85e3('0x25')];this[_0x85e3('0x26')]=_0x6008d3[_0x85e3('0x26')];this[_0x85e3('0x27')]=_0x6008d3[_0x85e3('0x27')];this[_0x85e3('0x28')]=_0x6008d3[_0x85e3('0x28')];this[_0x85e3('0x29')]=_0x6008d3[_0x85e3('0x29')];this[_0x85e3('0x2a')]=_0x6008d3[_0x85e3('0x2a')];this[_0x85e3('0x2b')]=_0x6008d3[_0x85e3('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0x1dd9=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry'];(function(_0x1ad049,_0x59e9a0){var _0x5c0942=function(_0x9f2cfc){while(--_0x9f2cfc){_0x1ad049['push'](_0x1ad049['shift']());}};_0x5c0942(++_0x59e9a0);}(_0x1dd9,0x188));var _0x91dd=function(_0x4ab9b0,_0x439e22){_0x4ab9b0=_0x4ab9b0-0x0;var _0x100ce5=_0x1dd9[_0x4ab9b0];return _0x100ce5;};'use strict';var util=require('util');var _=require(_0x91dd('0x0'));var moment=require('moment');function getSeconds(_0x4b7252,_0x53200b){var _0x10a9f9=moment(_0x4b7252)['milliseconds'](0x0);var _0x194dd0=moment(_0x53200b)[_0x91dd('0x1')](0x0);return _0x10a9f9[_0x91dd('0x2')](_0x194dd0,_0x91dd('0x3'));}function Hangup(_0x5361f7,_0x1c374b){this['state']=0x4;this[_0x91dd('0x4')]=_0x91dd('0x5');this[_0x91dd('0x6')]=_0x5361f7[_0x91dd('0x6')];this[_0x91dd('0x7')]=_0x5361f7['type'];this[_0x91dd('0x8')]=_0x5361f7['type']==='outbound'?_0x91dd('0x9'):_0x5361f7['type'];this['countbusyretry']=_0x5361f7[_0x91dd('0xa')];this[_0x91dd('0xb')]=_0x5361f7[_0x91dd('0xb')];this['countnoanswerretry']=_0x5361f7[_0x91dd('0xc')];this[_0x91dd('0xd')]=_0x5361f7[_0x91dd('0xa')]+_0x5361f7[_0x91dd('0xb')]+_0x5361f7[_0x91dd('0xc')]+_0x5361f7[_0x91dd('0xe')]+_0x5361f7['countdropretry']+_0x5361f7[_0x91dd('0xf')]+_0x5361f7[_0x91dd('0x10')]+_0x5361f7['countagentrejectretry'];this[_0x91dd('0xe')]=_0x5361f7['countnosuchnumberretry'];this[_0x91dd('0x11')]=_0x5361f7[_0x91dd('0x11')];this[_0x91dd('0xf')]=_0x5361f7[_0x91dd('0xf')];this[_0x91dd('0x10')]=_0x5361f7[_0x91dd('0x10')];this[_0x91dd('0x12')]=_0x5361f7[_0x91dd('0x12')];this[_0x91dd('0x13')]=_0x1c374b[_0x91dd('0x13')];this[_0x91dd('0x14')]=_0x5361f7[_0x91dd('0x15')];this[_0x91dd('0x16')]=_0x5361f7['number'];this[_0x91dd('0x17')]=_0x5361f7[_0x91dd('0x17')];this['responsetime']=_0x5361f7[_0x91dd('0x18')];this[_0x91dd('0x19')]=moment()['format'](_0x91dd('0x1a'));this[_0x91dd('0x1b')]=getSeconds(_0x5361f7[_0x91dd('0x18')],_0x5361f7['starttime']);this[_0x91dd('0x1c')]=0x0;this[_0x91dd('0x1d')]=getSeconds(this[_0x91dd('0x19')],_0x5361f7[_0x91dd('0x18')]);this[_0x91dd('0x9')]=_0x5361f7[_0x91dd('0x9')];this['membername']=_0x91dd('0x1e');this[_0x91dd('0x1f')]=_0x1c374b[_0x91dd('0x20')];this['callback']=_0x5361f7['callback'];this[_0x91dd('0x21')]=_0x5361f7[_0x91dd('0x21')];this[_0x91dd('0x22')]=_0x5361f7[_0x91dd('0x22')];this['recallme']=_0x5361f7[_0x91dd('0x23')];this[_0x91dd('0x24')]=_0x5361f7[_0x91dd('0x24')];this[_0x91dd('0x25')]=_0x5361f7['ListId'];this['UserId']=_0x5361f7[_0x91dd('0x26')];this[_0x91dd('0x27')]=_0x5361f7[_0x91dd('0x27')];this[_0x91dd('0x28')]=_0x5361f7[_0x91dd('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 28a4a24..2c00435 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa13=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime'];(function(_0x3411fa,_0xe5f1e3){var _0x4bd652=function(_0x33cf86){while(--_0x33cf86){_0x3411fa['push'](_0x3411fa['shift']());}};_0x4bd652(++_0xe5f1e3);}(_0xfa13,0x1a6));var _0x3fa1=function(_0x122f7e,_0x6867ab){_0x122f7e=_0x122f7e-0x0;var _0x3c5f30=_0xfa13[_0x122f7e];return _0x3c5f30;};'use strict';var util=require(_0x3fa1('0x0'));var _=require(_0x3fa1('0x1'));var moment=require(_0x3fa1('0x2'));function getSeconds(_0x30c7b5,_0x9599d7){var _0x51622d=moment(_0x30c7b5)[_0x3fa1('0x3')](0x0);var _0x160598=moment(_0x9599d7)['milliseconds'](0x0);return _0x51622d[_0x3fa1('0x4')](_0x160598,_0x3fa1('0x5'));}function History(_0x32765e){this[_0x3fa1('0x6')]=_0x32765e[_0x3fa1('0x6')];this[_0x3fa1('0x7')]=_0x32765e[_0x3fa1('0x7')]||undefined;this[_0x3fa1('0x8')]=_0x32765e[_0x3fa1('0x8')];this[_0x3fa1('0x9')]=_0x32765e[_0x3fa1('0x8')]===_0x3fa1('0xa')?_0x3fa1('0xb'):_0x32765e['type'];this[_0x3fa1('0xc')]=_0x32765e[_0x3fa1('0xc')];this[_0x3fa1('0xd')]=_0x32765e['countcongestionretry'];this[_0x3fa1('0xe')]=_0x32765e[_0x3fa1('0xe')];this['countglobal']=_0x32765e[_0x3fa1('0xc')]+_0x32765e['countcongestionretry']+_0x32765e[_0x3fa1('0xe')]+_0x32765e[_0x3fa1('0xf')]+_0x32765e[_0x3fa1('0x10')]+_0x32765e[_0x3fa1('0x11')]+_0x32765e[_0x3fa1('0x12')]+_0x32765e[_0x3fa1('0x13')];this[_0x3fa1('0xf')]=_0x32765e[_0x3fa1('0xf')];this[_0x3fa1('0x10')]=_0x32765e[_0x3fa1('0x10')];this[_0x3fa1('0x11')]=_0x32765e[_0x3fa1('0x11')];this[_0x3fa1('0x12')]=_0x32765e[_0x3fa1('0x12')];this[_0x3fa1('0x13')]=_0x32765e[_0x3fa1('0x13')];this[_0x3fa1('0xb')]=_0x32765e[_0x3fa1('0xb')];this[_0x3fa1('0x14')]=_0x32765e[_0x3fa1('0x15')];this[_0x3fa1('0x16')]=_0x32765e[_0x3fa1('0x17')];this[_0x3fa1('0x18')]=_0x32765e[_0x3fa1('0x18')];this[_0x3fa1('0x19')]=_0x32765e[_0x3fa1('0x19')];this[_0x3fa1('0x1a')]=_0x32765e[_0x3fa1('0x19')];this[_0x3fa1('0x1b')]=getSeconds(_0x32765e[_0x3fa1('0x19')],_0x32765e['starttime']);this['holdtime']=0x0;this[_0x3fa1('0x1c')]=0x0;this[_0x3fa1('0x1d')]=_0x32765e[_0x3fa1('0x1d')];this[_0x3fa1('0x1e')]=_0x32765e[_0x3fa1('0x1e')];this[_0x3fa1('0x1f')]=_0x32765e[_0x3fa1('0x1f')];this[_0x3fa1('0x20')]=_0x32765e['recallme'];this['ContactId']=_0x32765e[_0x3fa1('0x21')];this[_0x3fa1('0x22')]=_0x32765e[_0x3fa1('0x22')];this[_0x3fa1('0x23')]=_0x32765e[_0x3fa1('0x23')];this[_0x3fa1('0x24')]=_0x32765e[_0x3fa1('0x24')];this[_0x3fa1('0x25')]=_0x32765e['CampaignId'];this[_0x3fa1('0x26')]=_0x32765e[_0x3fa1('0x26')]||'';this['originatecalleridname']=_0x32765e[_0x3fa1('0x27')]||'';}module[_0x3fa1('0x28')]=History; \ No newline at end of file +var _0x3068=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid'];(function(_0x51ac91,_0x192060){var _0x3c64be=function(_0x4c5742){while(--_0x4c5742){_0x51ac91['push'](_0x51ac91['shift']());}};_0x3c64be(++_0x192060);}(_0x3068,0x1a7));var _0x8306=function(_0x15a806,_0x35f6b6){_0x15a806=_0x15a806-0x0;var _0x5a2754=_0x3068[_0x15a806];return _0x5a2754;};'use strict';var util=require(_0x8306('0x0'));var _=require(_0x8306('0x1'));var moment=require('moment');function getSeconds(_0x174c26,_0x18f79c){var _0x27c50a=moment(_0x174c26)['milliseconds'](0x0);var _0x58d9f6=moment(_0x18f79c)[_0x8306('0x2')](0x0);return _0x27c50a[_0x8306('0x3')](_0x58d9f6,_0x8306('0x4'));}function History(_0x21dcf9){this[_0x8306('0x5')]=_0x21dcf9['uniqueid'];this['scheduledat']=_0x21dcf9[_0x8306('0x6')]||undefined;this[_0x8306('0x7')]=_0x21dcf9[_0x8306('0x7')];this[_0x8306('0x8')]=_0x21dcf9['type']===_0x8306('0x9')?_0x8306('0xa'):_0x21dcf9[_0x8306('0x7')];this[_0x8306('0xb')]=_0x21dcf9[_0x8306('0xb')];this['countcongestionretry']=_0x21dcf9[_0x8306('0xc')];this['countnoanswerretry']=_0x21dcf9['countnoanswerretry'];this['countglobal']=_0x21dcf9[_0x8306('0xb')]+_0x21dcf9[_0x8306('0xc')]+_0x21dcf9[_0x8306('0xd')]+_0x21dcf9[_0x8306('0xe')]+_0x21dcf9[_0x8306('0xf')]+_0x21dcf9[_0x8306('0x10')]+_0x21dcf9[_0x8306('0x11')]+_0x21dcf9['countagentrejectretry'];this['countnosuchnumberretry']=_0x21dcf9[_0x8306('0xe')];this[_0x8306('0xf')]=_0x21dcf9[_0x8306('0xf')];this[_0x8306('0x10')]=_0x21dcf9[_0x8306('0x10')];this[_0x8306('0x11')]=_0x21dcf9[_0x8306('0x11')];this[_0x8306('0x12')]=_0x21dcf9[_0x8306('0x12')];this[_0x8306('0xa')]=_0x21dcf9['queue'];this[_0x8306('0x13')]=_0x21dcf9[_0x8306('0x14')];this['calleridnum']=_0x21dcf9[_0x8306('0x15')];this[_0x8306('0x16')]=_0x21dcf9[_0x8306('0x16')];this[_0x8306('0x17')]=_0x21dcf9[_0x8306('0x17')];this[_0x8306('0x18')]=_0x21dcf9['responsetime'];this[_0x8306('0x19')]=getSeconds(_0x21dcf9[_0x8306('0x17')],_0x21dcf9[_0x8306('0x16')]);this[_0x8306('0x1a')]=0x0;this[_0x8306('0x1b')]=0x0;this[_0x8306('0x1c')]=_0x21dcf9[_0x8306('0x1c')];this[_0x8306('0x1d')]=_0x21dcf9['callbackuniqueid'];this[_0x8306('0x1e')]=_0x21dcf9[_0x8306('0x1e')];this[_0x8306('0x1f')]=_0x21dcf9[_0x8306('0x1f')];this['ContactId']=_0x21dcf9['ContactId'];this[_0x8306('0x20')]=_0x21dcf9[_0x8306('0x20')];this[_0x8306('0x21')]=_0x21dcf9[_0x8306('0x21')];this[_0x8306('0x22')]=_0x21dcf9[_0x8306('0x22')];this['CampaignId']=_0x21dcf9[_0x8306('0x23')];this[_0x8306('0x24')]=_0x21dcf9[_0x8306('0x24')]||'';this[_0x8306('0x25')]=_0x21dcf9[_0x8306('0x25')]||'';}module[_0x8306('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 90276f0..f68759d 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 _0xfdd1=['channel','strategy','actionid','locked','paused','stateinterface','queueBooked','push','pick','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','syncQueueStatusComplete','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','launchHandleIvr','dialMethod','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','sumBillable','sumHoldTime','talking','unmanaged','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','startPredictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','stack','error','length','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','[getContactDialer2][ReScheduled]','contactsRescheduled','sendMessageOneNotActive','pTalking','available','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','starttime','uniqueId','[uniqueid]','[actions]','clearZombieChannels','enqueue','isNil','Action','status','catch','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','outboundAnswerAgiCallsDay','HangupInAMD','AMD','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','membername','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','buildObj','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countbusyretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineRetryFrequency','CampaignId','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AGI','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xfdd1,0xf9));var _0x1fdd=function(_0x3c0c9e,_0x3ecdee){_0x3c0c9e=_0x3c0c9e-0x0;var _0x5ba5fe=_0xfdd1[_0x3c0c9e];return _0x5ba5fe;};'use strict';var util=require(_0x1fdd('0x0'));var _=require(_0x1fdd('0x1'));var BPromise=require(_0x1fdd('0x2'));var uuid=require(_0x1fdd('0x3'));var moment=require(_0x1fdd('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x1fdd('0x5'));var ut=require(_0x1fdd('0x6'));var config=require(_0x1fdd('0x7'));var logger=require('../../../config/logger')(_0x1fdd('0x8'));var loggerBooked=require(_0x1fdd('0x9'))(_0x1fdd('0xa'));var loggerPredictive=require(_0x1fdd('0x9'))(_0x1fdd('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x1fdd('0x9'))('syncQueueSummary');var ami=require('../ami');config[_0x1fdd('0xc')]=_[_0x1fdd('0xd')](config[_0x1fdd('0xc')],{'host':_0x1fdd('0xe'),'port':0x18eb});var io=require(_0x1fdd('0xf'))(new Redis(config[_0x1fdd('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x1fdd('0x10'));var cmHopperBlack=require(_0x1fdd('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x1fdd('0x12'));var Action=require(_0x1fdd('0x13'));var History=require(_0x1fdd('0x14'));var Final=require(_0x1fdd('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x1fdd('0x16'));var Hangup=require(_0x1fdd('0x17'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x1fdd('0x18');var strategy={'rrmemory':_0x1fdd('0x19'),'roundrobin':_0x1fdd('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1fdd('0x1b')]['enqueue']=function(_0x44c274){this[_0x1fdd('0x1c')]=this['tail']?this[_0x1fdd('0x1c')][_0x1fdd('0x1d')](_0x44c274):_0x44c274();};function Dialer(_0x39b45f,_0x5a8ecb){this[_0x1fdd('0x1e')]=new Sequence();this[_0x1fdd('0x1f')]=_0x5a8ecb;this[_0x1fdd('0x20')]=_0x39b45f[_0x1fdd('0x20')];this[_0x1fdd('0x21')]=_0x39b45f[_0x1fdd('0x21')];this[_0x1fdd('0x22')]=_0x39b45f['agents'];this[_0x1fdd('0x23')]=_0x39b45f[_0x1fdd('0x23')];this[_0x1fdd('0x24')]=config[_0x1fdd('0x24')]||0x2;this[_0x1fdd('0x25')]={};this[_0x1fdd('0x26')]={};this[_0x1fdd('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x1fdd('0x28')]={};this[_0x1fdd('0x29')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x1fdd('0x2a'),this[_0x1fdd('0x2b')][_0x1fdd('0x2c')](this));ami['on']('queuecallerabandon',this[_0x1fdd('0x2d')]['bind'](this));ami['on'](_0x1fdd('0x2e'),this[_0x1fdd('0x2f')]['bind'](this));ami['on'](_0x1fdd('0x30'),this['syncAgentComplete'][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x31'),this[_0x1fdd('0x32')][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x33'),this['syncHangup'][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x34'),this[_0x1fdd('0x35')][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x36'),this[_0x1fdd('0x37')][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x38'),this[_0x1fdd('0x39')][_0x1fdd('0x2c')](this));ami['on'](_0x1fdd('0x3a'),this['syncQueueStatusComplete'][_0x1fdd('0x2c')](this));this[_0x1fdd('0x3b')]();this[_0x1fdd('0x3c')]();RpcSetting[_0x1fdd('0x3d')]()[_0x1fdd('0x3e')](function(_0x185180){previewRecallmeReminderInterval=_0x185180['previewRecallmeReminderInterval'];});}function isNotNull(_0x32c369){return _0x32c369!==null&&!_[_0x1fdd('0x3f')](_0x32c369);}function checkIsLoggedIn(_0x394304,_0x551380){return function(){if(_0x551380<=0x0){_0x394304[_0x1fdd('0x40')]=_0x1fdd('0x41');throw _0x394304[_0x1fdd('0x42')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3a37d2){return _0x3a37d2;}function checkIsActive(_0x3fcf59,_0x108cbb){return function(){if(!isActive(_0x108cbb)){_0x3fcf59[_0x1fdd('0x40')]=_0x1fdd('0x43');throw _0x3fcf59['name']+_0x1fdd('0x44');}};}function checkInterval(_0x58b1ed){return function(){if(!isNotNull(_0x58b1ed[_0x1fdd('0x45')])){_0x58b1ed[_0x1fdd('0x40')]=_0x1fdd('0x46');throw _0x58b1ed[_0x1fdd('0x42')]+_0x1fdd('0x47');}if(!isNotNull(_0x58b1ed[_0x1fdd('0x45')][_0x1fdd('0x48')])){_0x58b1ed['message']=_0x1fdd('0x46');throw _0x58b1ed[_0x1fdd('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x1fdd('0x49')](_0x58b1ed['Interval'][_0x1fdd('0x48')]))){_0x58b1ed[_0x1fdd('0x40')]=_0x1fdd('0x46');throw _0x58b1ed['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x289c10,_0x49a7e3,_0x5584f7){return{'action':_0x289c10,'response':_0x49a7e3,'message':_0x5584f7,'stack':_0x5584f7};}function myreject(_0x643721){return function(_0x231ade){return _0x643721(msgResponse(_0x1fdd('0x4a'),_0x1fdd('0x4b'),JSON['stringify'](_0x231ade)));};}function getSeconds(_0x5d5c42,_0x47280c){var _0x5611db=moment(_0x5d5c42)[_0x1fdd('0x4c')](0x0);var _0x39f94c=moment(_0x47280c)[_0x1fdd('0x4c')](0x0);return _0x5611db[_0x1fdd('0x4d')](_0x39f94c,_0x1fdd('0x4e'));}function emit(_0x571edb,_0x3be949,_0x18ea8d){io['to'](_0x571edb)[_0x1fdd('0x4f')](_0x3be949,_0x18ea8d);}function emitVoiceQueueSummary(_0x4561db){if(_0x4561db[_0x1fdd('0x50')]===_0x1fdd('0x51')){var _0x450618={'id':_0x4561db['id'],'name':_0x4561db[_0x1fdd('0x42')],'strategy':_0x4561db['strategy'],'answered':_0x4561db['answered'],'available':_0x4561db['available'],'loggedIn':_0x4561db['loggedIn'],'pTalking':_0x4561db['pTalking'],'sumBillable':_0x4561db[_0x1fdd('0x52')],'sumDuration':_0x4561db['sumDuration'],'sumHoldTime':_0x4561db[_0x1fdd('0x53')]||0x0,'talking':_0x4561db[_0x1fdd('0x54')],'total':_0x4561db['total'],'type':_0x4561db[_0x1fdd('0x50')],'unmanaged':_0x4561db[_0x1fdd('0x55')],'abandoned':_0x4561db['abandoned'],'waiting':_0x4561db[_0x1fdd('0x56')],'loggedInDb':_0x4561db['loggedInDb'],'dialActive':_0x4561db[_0x1fdd('0x57')],'dialMethod':_0x4561db['dialMethod'],'dialOriginateCallerIdName':_0x4561db[_0x1fdd('0x58')],'dialOriginateCallerIdNumber':_0x4561db[_0x1fdd('0x59')],'dialOriginateTimeout':_0x4561db[_0x1fdd('0x5a')],'dialPrefix':_0x4561db['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4561db['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4561db[_0x1fdd('0x5b')],'outboundBlacklistCallsDay':_0x4561db[_0x1fdd('0x5c')],'outboundBusyCallsDay':_0x4561db[_0x1fdd('0x5d')],'outboundCongestionCallsDay':_0x4561db[_0x1fdd('0x5e')],'outboundDropCallsDayACS':_0x4561db['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4561db[_0x1fdd('0x5f')],'outboundDropCallsDayTimeout':_0x4561db[_0x1fdd('0x60')],'outboundNoAnswerCallsDay':_0x4561db[_0x1fdd('0x61')],'outboundNoSuchCallsDay':_0x4561db[_0x1fdd('0x62')],'outboundOriginateFailureCallsDay':_0x4561db[_0x1fdd('0x63')],'outboundReCallsDay':_0x4561db['outboundReCallsDay'],'outboundRejectCallsDay':_0x4561db[_0x1fdd('0x64')],'outboundUnknownCallsDay':_0x4561db[_0x1fdd('0x65')],'predictiveIntervalAnsweredCalls':_0x4561db['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4561db[_0x1fdd('0x66')],'predictiveIntervalAvgTalktime':_0x4561db[_0x1fdd('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x4561db[_0x1fdd('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x4561db[_0x1fdd('0x69')],'predictiveIntervalErlangCalls':_0x4561db[_0x1fdd('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x4561db['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4561db['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4561db[_0x1fdd('0x6b')],'predictiveIntervalPauses':_0x4561db[_0x1fdd('0x6c')],'predictiveIntervalAvailable':_0x4561db[_0x1fdd('0x6d')],'predictiveIntervalTotalCalls':_0x4561db[_0x1fdd('0x6e')],'message':_0x4561db['message'],'originated':_0x4561db['originated'],'erlangCalls':_0x4561db['erlangCalls'],'erlangCallToSecond':_0x4561db[_0x1fdd('0x6f')],'erlangAbandonmentRate':_0x4561db[_0x1fdd('0x70')],'erlangBusyFactor':_0x4561db[_0x1fdd('0x71')],'startPredictive':_0x4561db['startPredictive'],'startProgressive':_0x4561db[_0x1fdd('0x28')]};if(_0x4561db[_0x1fdd('0x72')]){_0x450618[_0x1fdd('0x72')]={'id':_0x4561db[_0x1fdd('0x72')]['id'],'name':_0x4561db['Trunk'][_0x1fdd('0x42')],'active':_0x4561db[_0x1fdd('0x72')][_0x1fdd('0x73')],'callerid':_0x4561db[_0x1fdd('0x72')][_0x1fdd('0x74')]};}if(_0x4561db[_0x1fdd('0x45')]){_0x450618[_0x1fdd('0x45')]={'id':_0x4561db[_0x1fdd('0x45')]['id'],'name':_0x4561db[_0x1fdd('0x45')][_0x1fdd('0x42')]};}var _0x52b353=md5(JSON[_0x1fdd('0x75')](_0x450618));if(_0x4561db[_0x1fdd('0x76')]!==_0x52b353){_0x4561db[_0x1fdd('0x76')]=_0x52b353;emit(util[_0x1fdd('0x77')](_0x1fdd('0x78'),_0x450618['name']),_0x1fdd('0x79'),_0x450618);}}}function emitCampaignSummary(_0x1a0c13){if(_0x1a0c13[_0x1fdd('0x50')]===_0x1fdd('0x7a')){emit(util[_0x1fdd('0x77')](_0x1fdd('0x7b'),_0x1a0c13[_0x1fdd('0x42')]),_0x1fdd('0x7c'),_0x1a0c13);}}function checkGetDataPredictive(_0x5817b3){if(isNotNull(_0x5817b3)&&!_['isEmpty'](_0x5817b3)){loggerPredictive[_0x1fdd('0x7d')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x1fdd('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5817b3[_0x1fdd('0x6e')]);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x7e'),_0x5817b3['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x7f'),_0x5817b3['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x80'),_0x5817b3[_0x1fdd('0x68')]);loggerPredictive[_0x1fdd('0x7d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5817b3[_0x1fdd('0x66')]);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x81'),_0x5817b3[_0x1fdd('0x67')]);loggerPredictive['info'](_0x1fdd('0x82'));if(_0x5817b3['predictiveIntervalTotalCalls']>0x0){if(!_[_0x1fdd('0x3f')](_0x5817b3[_0x1fdd('0x67')])&&_0x5817b3[_0x1fdd('0x67')]>0x0){return!![];}loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x83'));if(!_[_0x1fdd('0x3f')](_0x5817b3['predictiveIntervalAvgHoldtime'])&&_0x5817b3[_0x1fdd('0x66')]>0x0){return!![];}loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x84'));}else{loggerPredictive[_0x1fdd('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x169ac7){return function(_0x3faa04){loggerPredictive[_0x1fdd('0x7d')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x1fdd('0x85'),_0x3faa04[_0x1fdd('0x86')]);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x87'),_0x3faa04['erlangCallToSecond']);loggerPredictive['info'](_0x1fdd('0x88'),_0x3faa04[_0x1fdd('0x70')]);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x89'),_0x3faa04[_0x1fdd('0x71')]);loggerPredictive['info'](_0x1fdd('0x88'),_0x3faa04[_0x1fdd('0x70')]);loggerPredictive[_0x1fdd('0x7d')]('---------------------------');_[_0x1fdd('0x8a')](_0x169ac7,_0x3faa04);};}function getDiff(_0x436a90){var _0x5d76c0=moment()[_0x1fdd('0x4c')](0x0);var _0x289446=moment(_0x436a90)['milliseconds'](0x0);return _0x5d76c0['diff'](_0x289446,'seconds');}function ifInterval(_0x41bb9a,_0x18503f){if(_[_0x1fdd('0x3f')](_0x18503f)){return![];}return getDiff(_0x18503f)<_0x41bb9a*0x3c;}function freeVariablesPredictive(_0x391a20){if(isNotNull(_0x391a20)){if(!_['isUndefined'](_0x391a20[_0x1fdd('0x28')])){_0x391a20[_0x1fdd('0x28')]=undefined;loggerPredictive[_0x1fdd('0x7d')](_0x391a20['name'],_0x1fdd('0x8b'));}if(!_['isUndefined'](_0x391a20['startPredictive'])){_0x391a20[_0x1fdd('0x8c')]=undefined;loggerPredictive[_0x1fdd('0x7d')](_0x391a20[_0x1fdd('0x42')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x1fdd('0x3f')](_0x391a20[_0x1fdd('0x8d')])){clearInterval(_0x391a20[_0x1fdd('0x8d')]);_0x391a20['handlePredictive']=undefined;loggerPredictive[_0x1fdd('0x7d')](_0x391a20[_0x1fdd('0x42')],_0x1fdd('0x8e'));}}}function erlangb(_0x281f99,_0x1eed78){if(_0x1eed78===0x0){return 0x0;}var _0x1fd2cf=0x1;for(var _0x5696cd=0x1;_0x5696cd<=_0x1eed78;_0x5696cd+=0x1){_0x1fd2cf=0x1+_0x1fd2cf*_0x5696cd/_0x281f99;}return 0x1/_0x1fd2cf;}function isVoiceQueueOutbound(_0x3403b2){return _0x3403b2===_0x1fdd('0x51');}function isNotPreview(_0x4f2f92){return _0x4f2f92!==_0x1fdd('0x1f');}function isCampaignIvr(_0x5b4a0c){return _0x5b4a0c==='ivr';}function getCallerId(_0x246478,_0x210990,_0x22c3dc){if(!_['isUndefined'](_0x22c3dc)&&typeof _0x22c3dc===_0x1fdd('0x8f')&&!_[_0x1fdd('0x49')](_0x22c3dc)){if(!_[_0x1fdd('0x3f')](_0x210990)&&typeof _0x210990==='string'&&!_[_0x1fdd('0x49')](_0x210990)){return util[_0x1fdd('0x77')](_0x1fdd('0x90'),_0x210990,_0x22c3dc);}return util[_0x1fdd('0x77')](_0x1fdd('0x90'),_0x22c3dc,_0x22c3dc);}if(!_[_0x1fdd('0x3f')](_0x246478)&&typeof _0x246478===_0x1fdd('0x8f')&&!_[_0x1fdd('0x49')](_0x246478)){return _0x246478;}return _0x1fdd('0x91');}function loggerCatchQueueSummary(_0x25a935,_0x1ff207){return function(_0x4fdb45){freeVariablesPredictive(_0x1ff207);emitVoiceQueueSummary(_0x1ff207);emitCampaignSummary(_0x1ff207);loggerSyncQueueSummary['error'](_0x25a935,util['inspect'](_0x4fdb45,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5a3724,_0x6ea109){return function(_0x154143){loggerPredictive['error'](_0x6ea109['name'],_0x5a3724);loggerPredictive['error'](_0x154143[_0x1fdd('0x92')]);freeVariablesPredictive(_0x6ea109);};}function loggerCatch(_0x495c93){return function(_0x68870b){logger[_0x1fdd('0x93')](_0x495c93,util['inspect'](_0x68870b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5c7e3d){return _0x5c7e3d&&!_['isUndefined'](_0x5c7e3d)&&_0x5c7e3d[_0x1fdd('0x94')]>0x0;}function decremetOriginate(_0x15b830){if(!_[_0x1fdd('0x3f')](_0x15b830)&&_0x15b830!==null){if(typeof _0x15b830[_0x1fdd('0x95')]!=='undefined'){if(_0x15b830['originated']>0x0){_0x15b830[_0x1fdd('0x95')]-=0x1;}else{logger[_0x1fdd('0x93')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1fdd('0x93')](_0x1fdd('0x96'));}}function checkContactLowerLimitOriginate(_0x26b8a5,_0x1dbdca,_0x39bd1c){if(_0x1dbdca>_0x39bd1c){for(var _0x17fa0c=0x0;_0x17fa0c<_0x1dbdca-_0x39bd1c;_0x17fa0c+=0x1){decremetOriginate(_0x26b8a5);}}}function loggerGetContactDialer(_0x3223bc,_0x46c7fd,_0x620f8a){return function(_0x265e70){checkContactLowerLimitOriginate(_0x46c7fd,_0x620f8a,0x0);logger['error'](_0x3223bc,util[_0x1fdd('0x97')](_0x265e70,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xe5adda){return function(_0x3ac879){if(isNotNull(_0x3ac879)&&isNotNull(_0x3ac879[0x0])){if(_0x3ac879[0x0]['contactsRescheduled']>0x0){_0xe5adda[_0x1fdd('0x40')]='RESCHEDULED_CONTACTS';logger[_0x1fdd('0x7d')](_0x1fdd('0x98')+_0xe5adda[_0x1fdd('0x42')],_0x3ac879[0x0][_0x1fdd('0x99')],'contacts');}else{_0xe5adda['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x1fdd('0x7d')]('[getContactDialer2][Empty]'+_0xe5adda[_0x1fdd('0x42')]);}}};}function notSendMessagesQueue(_0x1e1d99){if(_0x1e1d99[_0x1fdd('0x9a')]){freeVariablesPredictive(_0x1e1d99);if(_0x1e1d99[_0x1fdd('0x95')]===0x0&&_0x1e1d99['talking']===0x0&&_0x1e1d99[_0x1fdd('0x56')]===0x0&&(_0x1e1d99[_0x1fdd('0x9b')]||0x0)===0x0){_0x1e1d99[_0x1fdd('0x9a')]=![];_0x1e1d99[_0x1fdd('0x9c')]=0x0;_0x1e1d99[_0x1fdd('0x40')]=_0x1fdd('0x43');loggerSyncQueueSummary[_0x1fdd('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1e1d99[_0x1fdd('0x42')],'is\x20not\x20active');}else{_0x1e1d99['message']=_0x1fdd('0x9d');loggerSyncQueueSummary[_0x1fdd('0x93')](_0x1fdd('0x9e'),_0x1e1d99[_0x1fdd('0x42')],_0x1fdd('0x9f'));}emitVoiceQueueSummary(_0x1e1d99);}}function notSendMessagesCampaign(_0x3cbd4a){if(_0x3cbd4a[_0x1fdd('0x9a')]){if(_0x3cbd4a[_0x1fdd('0x95')]===0x0){_0x3cbd4a[_0x1fdd('0x9a')]=![];_0x3cbd4a['message']=_0x1fdd('0x43');loggerSyncQueueSummary[_0x1fdd('0x93')](_0x1fdd('0xa0'),_0x3cbd4a[_0x1fdd('0x42')],_0x1fdd('0xa1'));}else{_0x3cbd4a[_0x1fdd('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1fdd('0x93')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3cbd4a[_0x1fdd('0x42')],_0x1fdd('0x9f'));}emitCampaignSummary(_0x3cbd4a);}}function createObjHistory(_0xf13be,_0x47ac99,_0x51e5d1,_0x571c8b,_0x123395){_0xf13be[_0x1fdd('0x40')]=_0x51e5d1;var _0x26bcf6=new Action(_0xf13be,_0x47ac99);var _0x3c8130=new History(_0x26bcf6);_0x3c8130[_0x1fdd('0xa2')]=_0x571c8b;_0x3c8130[_0x1fdd('0xa3')]=_0x123395;_0x3c8130['endtime']=_0x26bcf6[_0x1fdd('0xa4')];return _0x3c8130;}Dialer[_0x1fdd('0x1b')][_0x1fdd('0x3c')]=function(){var _0x1f4f65=this;setInterval(function(){_0x1f4f65['clearZombieChannels'](_0x1f4f65[_0x1fdd('0xa5')],_0x1fdd('0xa6'));_0x1f4f65['clearZombieChannels'](_0x1f4f65[_0x1fdd('0x26')],_0x1fdd('0xa7'));},0x32c8);};Dialer['prototype'][_0x1fdd('0xa8')]=function(_0x55b465,_0x44fd63){var _0x6b8bc3=this;for(var _0x499792 in _0x55b465){if(typeof _0x55b465[_0x499792]!=='undefined'){this['sequence'][_0x1fdd('0xa9')](function(){if(!_[_0x1fdd('0xaa')](_0x55b465[_0x499792])){return ami[_0x1fdd('0xab')]({'action':_0x1fdd('0xac'),'channel':_0x55b465[_0x499792]['channel']})[_0x1fdd('0xad')](function(_0x3c60d6){if(_0x3c60d6[_0x1fdd('0x40')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x55b465[_0x499792]&&_0x55b465[_0x499792][_0x1fdd('0x50')]!==_0x1fdd('0x7a')){_0x6b8bc3[_0x1fdd('0xae')](_0x6b8bc3[_0x1fdd('0x20')][_0x55b465[_0x499792]['queue']]);logger[_0x1fdd('0x93')](_0x1fdd('0xaf'),_0x44fd63,_0x499792,_0x55b465[_0x499792][_0x1fdd('0xb0')]);delete _0x55b465[_0x499792];}if(_0x55b465[_0x499792]&&_0x55b465[_0x499792]['type']===_0x1fdd('0x7a')){_0x6b8bc3[_0x1fdd('0xae')](_0x6b8bc3[_0x1fdd('0x21')][_0x55b465[_0x499792][_0x1fdd('0xb0')]]);logger[_0x1fdd('0x93')]('[Dialer][checkChannel][ivr]',_0x44fd63,_0x499792,_0x55b465[_0x499792]['queue']);delete _0x55b465[_0x499792];}},0x2328);}});}});}}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xb1')]=function(_0xb4394a){return BPromise[_0x1fdd('0xb2')]()[_0x1fdd('0x3e')](cmHopper[_0x1fdd('0xb1')](_0xb4394a))['catch'](loggerCatch(_0x1fdd('0xb3')));};Dialer['prototype']['checkIsBlackList']=function(_0x5334bc){return BPromise['resolve']()['then'](cmHopperBlack[_0x1fdd('0xb4')](_0x5334bc))[_0x1fdd('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xb5')]=function(_0x3d062b){return BPromise[_0x1fdd('0xb2')]()[_0x1fdd('0x3e')](cmHopperBlack['checkIsBlackListIvr'](_0x3d062b))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xb6')));};Dialer['prototype'][_0x1fdd('0xb7')]=function(_0x3a27ab){return BPromise[_0x1fdd('0xb2')]()['then'](cmHopperHistory[_0x1fdd('0xb8')](_0x3a27ab))[_0x1fdd('0xad')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xb9')]=function(_0x29daec){return BPromise[_0x1fdd('0xb2')]()[_0x1fdd('0x3e')](cmHopper['rescheduleContact'](_0x29daec))['catch'](loggerCatch(_0x1fdd('0xba')));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xbb')]=function(_0x50a172,_0x44c633,_0x4cb042){return BPromise['resolve']()[_0x1fdd('0x3e')](cmHopper[_0x1fdd('0xbb')](_0x50a172,_0x44c633,_0x4cb042))[_0x1fdd('0xad')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xbc')]=function(_0x2d54b6,_0x27c18d,_0x477561,_0x330055,_0x4db229){return BPromise[_0x1fdd('0xb2')]()[_0x1fdd('0x3e')](cmHopper[_0x1fdd('0xbc')](_0x2d54b6,_0x27c18d,_0x477561,_0x330055))[_0x1fdd('0xad')](function(_0x1d38df){_0x4db229['temp']-=_0x477561;_0x4db229[_0x1fdd('0xbd')]=_0x4db229[_0x1fdd('0xbd')]>0x0?_0x4db229[_0x1fdd('0xbd')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x1d38df);});};Dialer[_0x1fdd('0x1b')]['getContactDialerIvr']=function(_0x50dcd5,_0x329d49,_0x448102,_0x5bee33){return BPromise[_0x1fdd('0xb2')]()['then'](cmHopper[_0x1fdd('0xbe')](_0x50dcd5,_0x329d49,_0x448102))[_0x1fdd('0xad')](function(_0x196e82){_0x5bee33[_0x1fdd('0xbd')]-=_0x329d49;_0x5bee33[_0x1fdd('0xbd')]=_0x5bee33[_0x1fdd('0xbd')]>0x0?_0x5bee33[_0x1fdd('0xbd')]:0x0;loggerCatch(_0x1fdd('0xbf'))(_0x196e82);});};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xc0')]=function(_0x23288b){return BPromise[_0x1fdd('0xb2')]()[_0x1fdd('0x3e')](voiceQueueRt[_0x1fdd('0xc0')](_0x23288b))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xc1')));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xc2')]=function(_0x1ee13f){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x1ee13f))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xc3')));};Dialer['prototype'][_0x1fdd('0xc4')]=function(_0xa6a1ef){return BPromise[_0x1fdd('0xb2')]()['then'](cmHopperHistory[_0x1fdd('0xc4')](_0xa6a1ef))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xc5')));};Dialer[_0x1fdd('0x1b')]['updateOriginated']=function(_0x4b0fe8){if(!_[_0x1fdd('0x3f')](_0x4b0fe8)&&_0x4b0fe8!==null){if(typeof _0x4b0fe8['originated']!==_0x1fdd('0xc6')){if(_0x4b0fe8[_0x1fdd('0x95')]>0x0){_0x4b0fe8[_0x1fdd('0x95')]-=0x1;}else{logger[_0x1fdd('0x93')](_0x1fdd('0xc7'));}}}else{logger[_0x1fdd('0x93')](_0x1fdd('0xc8'));}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xc9')]=function(_0x162482,_0x3dc119){var _0x2fcc97=this;return function(_0x45e24f){_0x2fcc97[_0x1fdd('0xae')](_0x3dc119);logger[_0x1fdd('0x93')](_0x162482,util[_0x1fdd('0x97')](_0x45e24f,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1fdd('0xca')]=function(_0xbd949a,_0x55f492,_0x304081){var _0x5b447d={'state':0x19,'statedesc':_0x1fdd('0xcb')};this['updateOriginated'](_0x55f492);this['saveInDb'](_['merge'](_0x5b447d,_['pick'](_0x304081,[_0x1fdd('0xcc'),_0x1fdd('0xcd'),_0x1fdd('0xce'),_0x1fdd('0xcf'),'CampaignId'])),_0x1fdd('0xd0'),_0x1fdd('0xd1'));logger['error'](_0xbd949a);};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xd2')]=function(_0x2c9fb0){return _0x2c9fb0===_0x1fdd('0xd3');};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xd4')]=function(_0x422743){return!_['isUndefined'](_0x422743)&&_0x422743&&!_[_0x1fdd('0x3f')](_0x422743[_0x1fdd('0x42')])&&!_[_0x1fdd('0x3f')](_0x422743[_0x1fdd('0x73')])&&_0x422743[_0x1fdd('0x73')]&&(this[_0x1fdd('0x23')][util[_0x1fdd('0x77')]('SIP/%s',_0x422743[_0x1fdd('0x42')])]['status']===_0x1fdd('0xd5')||this[_0x1fdd('0x23')][util[_0x1fdd('0x77')](_0x1fdd('0xd6'),_0x422743[_0x1fdd('0x42')])][_0x1fdd('0xac')]==='unmonitored');};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xd7')]=function(_0x2f738a,_0x294179,_0x164067){this[_0x1fdd('0xc4')](_0x2f738a)['catch'](loggerCatch(_0x294179));this[_0x1fdd('0xc2')](_0x2f738a)[_0x1fdd('0xad')](loggerCatch(_0x164067));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x37')]=function(_0x4cf068){var _0x3f2f90=this[_0x1fdd('0xa5')][_0x4cf068[_0x1fdd('0xd8')]];var _0x1e1840;if(!_[_0x1fdd('0xaa')](_0x4cf068)&&!_[_0x1fdd('0xaa')](_0x4cf068[_0x1fdd('0xd9')])&&!_[_0x1fdd('0xaa')](_0x4cf068[_0x1fdd('0xd9')][_0x1fdd('0xda')])&&_0x4cf068[_0x1fdd('0xdb')]===_0x1fdd('0xdc')&&_0x3f2f90){if(_0x3f2f90[_0x1fdd('0x50')]!=='ivr'&&this[_0x1fdd('0x20')][_0x3f2f90[_0x1fdd('0xb0')]]['dialAMDActive']&&_0x4cf068[_0x1fdd('0xdd')]==='HANGUP'){delete this[_0x1fdd('0xa5')][_0x4cf068[_0x1fdd('0xd8')]];this[_0x1fdd('0xae')](this[_0x1fdd('0x20')][_0x3f2f90[_0x1fdd('0xb0')]]);this[_0x1fdd('0x20')][_0x3f2f90['queue']][_0x1fdd('0x5b')]+=0x1;this[_0x1fdd('0x20')][_0x3f2f90[_0x1fdd('0xb0')]][_0x1fdd('0xde')]+=0x1;_0x1e1840=new Hangup(_0x3f2f90,_0x4cf068);_0x1e1840[_0x1fdd('0xa2')]=0x12;_0x1e1840['statedesc']=_0x1fdd('0xdf');_0x1e1840['membername']=_0x1fdd('0xe0');ami[_0x1fdd('0x4f')]('custom:amd',ut['buildObj'](_0x1e1840,_0x1fdd('0xe1')));this[_0x1fdd('0xd7')](_0x1e1840,_0x1fdd('0xe2'),_0x1fdd('0xe3'));}if(_0x3f2f90[_0x1fdd('0x50')]!=='ivr'&&this['voiceQueues'][_0x3f2f90[_0x1fdd('0xb0')]][_0x1fdd('0xe4')]&&_0x4cf068['value']==='MACHINE'){var _0x4a0606=this;return new BPromise(function(_0x2d45d5,_0x2e1688){delete _0x4a0606['uniqueId'][_0x4cf068[_0x1fdd('0xd8')]];_0x4a0606[_0x1fdd('0xae')](_0x4a0606[_0x1fdd('0x20')][_0x3f2f90[_0x1fdd('0xb0')]]);_0x4a0606[_0x1fdd('0x20')][_0x3f2f90['queue']]['outboundAnswerCallsDay']+=0x1;_0x4a0606[_0x1fdd('0x20')][_0x3f2f90['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x19d923=_0x4a0606[_0x1fdd('0x20')][_0x3f2f90['queue']];var _0x48750c=new Hangup(_0x3f2f90,_0x4cf068);_0x48750c[_0x1fdd('0xa2')]=0x13;_0x48750c['statedesc']=_0x1fdd('0xe5');_0x48750c[_0x1fdd('0xe6')]='AMD';_0x48750c[_0x1fdd('0xe7')]+=0x1;_0x48750c['countglobal']+=0x1;_0x48750c[_0x1fdd('0xe1')]=!![];ami[_0x1fdd('0x4f')](_0x1fdd('0xe8'),ut['buildObj'](_0x48750c,_0x1fdd('0xe1')));_0x4a0606[_0x1fdd('0xc4')](_0x48750c)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xe9')));if(_0x48750c['countbusyretry']+_0x48750c[_0x1fdd('0xea')]+_0x48750c[_0x1fdd('0xeb')]+_0x48750c[_0x1fdd('0xec')]+_0x48750c[_0x1fdd('0xed')]+_0x48750c[_0x1fdd('0xee')]+_0x48750c[_0x1fdd('0xe7')]+_0x48750c['countagentrejectretry']>=_0x19d923[_0x1fdd('0xef')]){_0x4a0606['stateGlobal'](_0x48750c,_0x2d45d5,_0x2e1688,'reason19\x20machine....');}else{if(_0x48750c[_0x1fdd('0xe7')]>=_0x19d923[_0x1fdd('0xf0')]){_0x4a0606[_0x1fdd('0xf1')](_0x48750c,_0x2d45d5,_0x2e1688,_0x1fdd('0xf2'));}else{_0x4a0606['rescheduleContact']({'active':![],'countmachineretry':_0x48750c[_0x1fdd('0xe7')],'scheduledat':moment()[_0x1fdd('0xf3')](_0x19d923['dialMachineRetryFrequency'],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x48750c[_0x1fdd('0xcc')],'ListId':_0x48750c[_0x1fdd('0xcd')],'VoiceQueueId':_0x48750c[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x48750c['CampaignId']||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xf6')));_0x2d45d5({'reschedule':0x1});}}});}if(_0x3f2f90[_0x1fdd('0x50')]==='ivr'&&this[_0x1fdd('0x21')][_0x3f2f90[_0x1fdd('0xb0')]]['dialAMDActive']&&_0x4cf068[_0x1fdd('0xdd')]===_0x1fdd('0xf7')){delete this[_0x1fdd('0xa5')][_0x4cf068[_0x1fdd('0xd8')]];this[_0x1fdd('0xae')](this[_0x1fdd('0x21')][_0x3f2f90[_0x1fdd('0xb0')]]);_0x1e1840=new Hangup(_0x3f2f90,_0x4cf068);_0x1e1840[_0x1fdd('0xa2')]=0x12;_0x1e1840[_0x1fdd('0xa3')]=_0x1fdd('0xdf');_0x1e1840[_0x1fdd('0xe6')]=_0x1fdd('0xe0');ami['emit'](_0x1fdd('0xe8'),ut[_0x1fdd('0xf8')](_0x1e1840,_0x1fdd('0xe1')));this[_0x1fdd('0xd7')](_0x1e1840,_0x1fdd('0xf9'),_0x1fdd('0xfa'));}if(_0x3f2f90[_0x1fdd('0x50')]==='ivr'&&this[_0x1fdd('0x21')][_0x3f2f90[_0x1fdd('0xb0')]]['dialAMDActive']&&_0x4cf068[_0x1fdd('0xdd')]==='MACHINE'){var _0x4a0606=this;return new BPromise(function(_0x2f9375,_0x1dfb7f){delete _0x4a0606['uniqueId'][_0x4cf068[_0x1fdd('0xd8')]];_0x4a0606['updateOriginated'](_0x4a0606['campaigns'][_0x3f2f90[_0x1fdd('0xb0')]]);_0x4a0606['campaigns'][_0x3f2f90[_0x1fdd('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x4a0606[_0x1fdd('0x21')][_0x3f2f90['queue']][_0x1fdd('0xde')]+=0x1;var _0x53e800=_0x4a0606['campaigns'][_0x3f2f90[_0x1fdd('0xb0')]];var _0x1ba018=new Hangup(_0x3f2f90,_0x4cf068);_0x1ba018[_0x1fdd('0xa2')]=0x13;_0x1ba018[_0x1fdd('0xa3')]='Machine';_0x1ba018['membername']=_0x1fdd('0xe0');_0x1ba018[_0x1fdd('0xe7')]+=0x1;_0x1ba018[_0x1fdd('0xfb')]+=0x1;_0x1ba018['amd']=!![];ami['emit'](_0x1fdd('0xe8'),ut[_0x1fdd('0xf8')](_0x1ba018,_0x1fdd('0xe1')));_0x4a0606[_0x1fdd('0xc4')](_0x1ba018)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xe9')));if(_0x1ba018[_0x1fdd('0xfc')]+_0x1ba018[_0x1fdd('0xea')]+_0x1ba018[_0x1fdd('0xeb')]+_0x1ba018[_0x1fdd('0xec')]+_0x1ba018[_0x1fdd('0xed')]+_0x1ba018[_0x1fdd('0xee')]+_0x1ba018[_0x1fdd('0xe7')]+_0x1ba018[_0x1fdd('0xfd')]>=_0x53e800['dialGlobalMaxRetry']){_0x4a0606[_0x1fdd('0xfe')](_0x1ba018,_0x2f9375,_0x1dfb7f,_0x1fdd('0xff'));}else{if(_0x1ba018['countmachineretry']>=_0x53e800['dialMachineMaxRetry']){_0x4a0606[_0x1fdd('0xf1')](_0x1ba018,_0x2f9375,_0x1dfb7f,_0x1fdd('0xf2'));}else{_0x4a0606['rescheduleContact']({'active':![],'countmachineretry':_0x1ba018['countmachineretry'],'scheduledat':moment()[_0x1fdd('0xf3')](_0x53e800[_0x1fdd('0x100')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x1ba018[_0x1fdd('0xcc')],'ListId':_0x1ba018['ListId'],'VoiceQueueId':_0x1ba018[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x1ba018[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xf6')));_0x2f9375({'reschedule':0x1});}}});}}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x102')]=function(_0xfc9435){var _0x1c7eca=this['uniqueId'][_0xfc9435['uniqueid']];var _0x4a752e=this;var _0x288b49;if(_0x1c7eca&&_0x1c7eca[_0x1fdd('0x50')]===_0x1fdd('0x7a')){delete this[_0x1fdd('0xa5')][_0xfc9435['uniqueid']];this[_0x1fdd('0xae')](this[_0x1fdd('0x21')][_0x1c7eca[_0x1fdd('0xb0')]]);this[_0x1fdd('0x21')][_0x1c7eca['queue']][_0x1fdd('0x103')]+=0x1;_0x288b49=new Hangup(_0x1c7eca,_0xfc9435);this[_0x1fdd('0xc4')](_0x288b49)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x104')));this[_0x1fdd('0xc2')](_0x288b49)[_0x1fdd('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x1c7eca&&_0x1c7eca[_0x1fdd('0x50')]!=='ivr'&&isNotNull(this[_0x1fdd('0x20')][_0x1c7eca[_0x1fdd('0xb0')]]['dialQueueProject'])){delete this[_0x1fdd('0xa5')][_0xfc9435[_0x1fdd('0xd8')]];this['updateOriginated'](this[_0x1fdd('0x20')][_0x1c7eca[_0x1fdd('0xb0')]]);this['voiceQueues'][_0x1c7eca[_0x1fdd('0xb0')]][_0x1fdd('0x5b')]+=0x1;this[_0x1fdd('0x20')][_0x1c7eca[_0x1fdd('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x288b49=new Hangup(_0x1c7eca,_0xfc9435);_0x288b49[_0x1fdd('0xa2')]=0x10;_0x288b49[_0x1fdd('0xa3')]='AnswerAGI';_0x288b49[_0x1fdd('0xe6')]=_0x1fdd('0x105');this[_0x1fdd('0xc4')](_0x288b49)[_0x1fdd('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1fdd('0xc2')](_0x288b49)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x106')));}if(_0x1c7eca&&_0x1c7eca[_0x1fdd('0x50')]!==_0x1fdd('0x7a')&&!isNotNull(this[_0x1fdd('0x20')][_0x1c7eca['queue']][_0x1fdd('0x107')])){delete this[_0x1fdd('0xa5')][_0xfc9435[_0x1fdd('0xd8')]];this[_0x1fdd('0xae')](this[_0x1fdd('0x20')][_0x1c7eca['queue']]);this['voiceQueues'][_0x1c7eca['queue']][_0x1fdd('0x65')]+=0x1;_0x288b49=new Hangup(_0x1c7eca,_0xfc9435);_0x288b49[_0x1fdd('0xa2')]=0xc;_0x288b49[_0x1fdd('0xa3')]=_0xfc9435[_0x1fdd('0x108')];_0x288b49['membername']=_0x1fdd('0x109');this[_0x1fdd('0xc4')](_0x288b49)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x104')));this[_0x1fdd('0xc2')](_0x288b49)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x106')));}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x10a')]=function(_0x3b6332){var _0x9c76e7=this[_0x1fdd('0xa5')][_0x3b6332[_0x1fdd('0xd8')]];var _0x4c93ed=this;if(this[_0x1fdd('0x20')][_0x3b6332[_0x1fdd('0xb0')]]){if(_0x9c76e7&&_0x9c76e7[_0x1fdd('0x50')]!==_0x1fdd('0x7a')){delete this[_0x1fdd('0xa5')][_0x3b6332[_0x1fdd('0xd8')]];this['voiceQueues'][_0x3b6332['queue']]['outboundAnswerCallsDay']+=0x1;var _0x4bdd2b=new AgentComplete(_0x9c76e7,_0x3b6332);if(_0x3b6332[_0x1fdd('0x10b')]==='agent'){_0x4bdd2b[_0x1fdd('0x10c')]=this[_0x1fdd('0x20')][_0x3b6332['queue']]['dialQueueProject2']&&this[_0x1fdd('0x20')][_0x3b6332[_0x1fdd('0xb0')]][_0x1fdd('0x10d')]?moment()[_0x1fdd('0x77')](_0x1fdd('0xf5')):undefined;}this[_0x1fdd('0xc4')](_0x4bdd2b)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x10e')));this['moveContactManagedDialer'](_0x4bdd2b)['catch'](loggerCatch(_0x1fdd('0x10f')));}}};Dialer['prototype'][_0x1fdd('0x2b')]=function(_0x42a402){if(this[_0x1fdd('0x20')][_0x42a402[_0x1fdd('0xb0')]]){if(this[_0x1fdd('0xa5')][_0x42a402['uniqueid']]&&this[_0x1fdd('0xa5')][_0x42a402[_0x1fdd('0xd8')]][_0x1fdd('0x50')]!==_0x1fdd('0x7a')){this[_0x1fdd('0xae')](this['voiceQueues'][_0x42a402[_0x1fdd('0xb0')]]);this[_0x1fdd('0xa5')][_0x42a402[_0x1fdd('0xd8')]][_0x1fdd('0x110')]=moment()[_0x1fdd('0x77')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x1fdd('0x1b')]['queueCallerAbandonCreateState']=function(_0x358184){this[_0x1fdd('0xc4')](_0x358184)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x10e')));this[_0x1fdd('0xc2')](_0x358184)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x111')));};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x2d')]=function(_0x53861b){var _0x4d8ce6=this[_0x1fdd('0xa5')][_0x53861b[_0x1fdd('0xd8')]];var _0x3bc2d9=this;if(this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]]){if(_0x4d8ce6&&_0x4d8ce6[_0x1fdd('0x50')]!==_0x1fdd('0x7a')){delete this['uniqueId'][_0x53861b['uniqueid']];this[_0x1fdd('0xae')](this['voiceQueues'][_0x53861b[_0x1fdd('0xb0')]]);_0x4d8ce6[_0x1fdd('0x112')]=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));var _0x1453d4=new QueueCallerAbandon(_0x4d8ce6,_0x53861b);if(getSeconds(_0x4d8ce6[_0x1fdd('0x112')],_0x4d8ce6[_0x1fdd('0x113')])>=_0x4d8ce6[_0x1fdd('0x114')]){this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x69')]+=0x1;this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x115')]+=0x1;_0x1453d4[_0x1fdd('0xa2')]=0xa;_0x1453d4[_0x1fdd('0xa3')]='Drop';_0x1453d4[_0x1fdd('0x116')]=_0x1fdd('0x117');_0x1453d4[_0x1fdd('0x10c')]=this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x118')]?moment()[_0x1fdd('0x77')](_0x1fdd('0xf5')):undefined;_0x1453d4[_0x1fdd('0xed')]+=0x1;_0x1453d4[_0x1fdd('0xfb')]+=0x1;if(_0x1453d4['countdropretry']>=this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x119')]){this[_0x1fdd('0x11a')](_0x1453d4);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1453d4[_0x1fdd('0xed')],'scheduledat':moment()[_0x1fdd('0xf3')](this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x11b')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4d8ce6[_0x1fdd('0xcc')],'ListId':_0x4d8ce6[_0x1fdd('0xcd')],'VoiceQueueId':_0x4d8ce6['VoiceQueueId']||undefined,'CampaignId':_0x4d8ce6['CampaignId']||undefined})['catch'](loggerCatch(_0x1fdd('0x11c')));var _0x290800=new History(_0x1453d4);_0x290800[_0x1fdd('0xa2')]=0xa;_0x290800[_0x1fdd('0xa3')]=_0x1fdd('0x11d');_0x290800[_0x1fdd('0xa4')]=moment()[_0x1fdd('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x290800['endtime']=_0x290800[_0x1fdd('0xa4')];_0x290800[_0x1fdd('0x11e')]=_0x1453d4['calleridname'];_0x290800['calleridnum']=_0x1453d4[_0x1fdd('0x11f')];this[_0x1fdd('0xc4')](_0x290800)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x120')));}}else{this[_0x1fdd('0x20')][_0x53861b[_0x1fdd('0xb0')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x1fdd('0x20')][_0x53861b['queue']][_0x1fdd('0x5f')]+=0x1;_0x1453d4[_0x1fdd('0xa2')]=0xb;_0x1453d4[_0x1fdd('0xa3')]=_0x1fdd('0x121');_0x1453d4['dropreason']=_0x1fdd('0x122');_0x1453d4['countabandonedretry']+=0x1;_0x1453d4[_0x1fdd('0xfb')]+=0x1;if(_0x1453d4['countabandonedretry']>=this['voiceQueues'][_0x53861b[_0x1fdd('0xb0')]]['dialAbandonedMaxRetry']){this[_0x1fdd('0x11a')](_0x1453d4);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1453d4[_0x1fdd('0xee')],'scheduledat':moment()[_0x1fdd('0xf3')](this['voiceQueues'][_0x53861b[_0x1fdd('0xb0')]][_0x1fdd('0x123')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4d8ce6['ContactId'],'ListId':_0x4d8ce6['ListId'],'VoiceQueueId':_0x4d8ce6[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x4d8ce6[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x124')));var _0x290800=new History(_0x1453d4);_0x290800[_0x1fdd('0xa2')]=0xb;_0x290800['statedesc']='Abandoned';_0x290800[_0x1fdd('0xa4')]=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));_0x290800[_0x1fdd('0x125')]=_0x290800[_0x1fdd('0xa4')];_0x290800[_0x1fdd('0x11e')]=_0x1453d4[_0x1fdd('0x11e')];_0x290800['calleridnum']=_0x1453d4['calleridnum'];this['createHistory'](_0x290800)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x126')));}}}}};Dialer[_0x1fdd('0x1b')]['syncNewExten']=function(_0x140745){if(this[_0x1fdd('0x26')][_0x140745[_0x1fdd('0xd8')]]){this[_0x1fdd('0x26')][_0x140745[_0x1fdd('0xd8')]][_0x1fdd('0x127')]=_0x140745[_0x1fdd('0x127')];}if(this[_0x1fdd('0xa5')][_0x140745[_0x1fdd('0xd8')]]){this[_0x1fdd('0xa5')][_0x140745[_0x1fdd('0xd8')]][_0x1fdd('0x127')]=_0x140745[_0x1fdd('0x127')];}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x39')]=function(_0x3909a4){if(strategy[this[_0x1fdd('0x20')][this[_0x1fdd('0x26')][_0x3909a4['actionid']]['queue']][_0x1fdd('0x128')]]==='roundrobin'){if(this[_0x1fdd('0x26')][_0x3909a4[_0x1fdd('0x129')]]&&_[_0x1fdd('0xaa')](this['actions'][_0x3909a4[_0x1fdd('0x129')]][_0x1fdd('0x12a')])&&_0x3909a4[_0x1fdd('0xac')]==='1'&&_0x3909a4[_0x1fdd('0x12b')]==='0'){if(this[_0x1fdd('0x22')][_0x3909a4[_0x1fdd('0x12c')]]){if(!this['agents'][_0x3909a4['stateinterface']][_0x1fdd('0x12a')]){this['agents'][_0x3909a4[_0x1fdd('0x12c')]][_0x1fdd('0x12a')]=!![];this['actions'][_0x3909a4['actionid']]['locked']=!![];this[_0x1fdd('0x26')][_0x3909a4[_0x1fdd('0x129')]][_0x1fdd('0x12c')]=_0x3909a4[_0x1fdd('0x12c')];}}}}else if((strategy[this[_0x1fdd('0x20')][this['actions'][_0x3909a4['actionid']][_0x1fdd('0xb0')]][_0x1fdd('0x128')]]||_0x1fdd('0x19'))==='rrmemory'){if(this[_0x1fdd('0x26')][_0x3909a4[_0x1fdd('0x129')]]){if(this[_0x1fdd('0x22')][_0x3909a4[_0x1fdd('0x12c')]]){this[_0x1fdd('0x26')][_0x3909a4['actionid']][_0x1fdd('0x12c')]=_0x3909a4[_0x1fdd('0x12c')];if(_[_0x1fdd('0xaa')](this[_0x1fdd('0x12d')][this[_0x1fdd('0x26')][_0x3909a4['actionid']][_0x1fdd('0xb0')]])){this['queueBooked'][this[_0x1fdd('0x26')][_0x3909a4[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]=[];}this['queueBooked'][this[_0x1fdd('0x26')][_0x3909a4['actionid']][_0x1fdd('0xb0')]][_0x1fdd('0x12e')](_[_0x1fdd('0x8a')](_[_0x1fdd('0x12f')](this['actions'][_0x3909a4[_0x1fdd('0x129')]],['idHopper',_0x1fdd('0x12c')]),{'status':_0x3909a4['status'],'paused':_0x3909a4[_0x1fdd('0x12b')]}));}}}};function unlockQueueStatus(_0x45c0f4,_0x5127c3){setTimeout(function(){if(_['isUndefined'](_0x45c0f4['queueStatusComplete'])){loggerBooked['error'](_0x1fdd('0x130'),_0x5127c3);}_0x45c0f4['queueStatusComplete']=!![];loggerBooked[_0x1fdd('0x7d')](_0x1fdd('0x131'),_0x5127c3,JSON['stringify'](_[_0x1fdd('0x12f')](_0x45c0f4,[_0x1fdd('0x42'),_0x1fdd('0x132')])));},0x1f3);}Dialer[_0x1fdd('0x1b')][_0x1fdd('0x133')]=function(_0x4bee73){var _0x302b93=this;var _0x59791a=_0x302b93[_0x1fdd('0x20')][_0x302b93[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]];if(strategy[this[_0x1fdd('0x20')][this['actions'][_0x4bee73[_0x1fdd('0x129')]]['queue']]['strategy']]===_0x1fdd('0x1a')){if(this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]&&this[_0x1fdd('0x26')][_0x4bee73['actionid']][_0x1fdd('0x12c')]){this[_0x1fdd('0x1f')][_0x1fdd('0x134')](this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0x135')],this['actions'][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0x12c')])[_0x1fdd('0xad')](function(_0x2b92de){logger[_0x1fdd('0x93')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x2b92de,{'showHidden':![],'depth':null}));})['finally'](function(){_0x302b93[_0x1fdd('0xae')](_0x302b93[_0x1fdd('0x20')][_0x302b93[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]['queue']]);_0x302b93[_0x1fdd('0x22')][_0x302b93[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0x12c')]][_0x1fdd('0x12a')]=![];delete _0x302b93[_0x1fdd('0x26')][_0x4bee73['actionid']];unlockQueueStatus(_0x59791a);});}else{this[_0x1fdd('0xae')](this[_0x1fdd('0x20')][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]);this[_0x1fdd('0xb9')]({'active':![],'ContactId':this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xcc')],'ListId':this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xcd')],'VoiceQueueId':this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x136')));delete this['actions'][_0x4bee73[_0x1fdd('0x129')]];unlockQueueStatus(_0x59791a);}}else if((strategy[this[_0x1fdd('0x20')][this['actions'][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]][_0x1fdd('0x128')]]||_0x1fdd('0x19'))==='rrmemory'){var _0x16a051;if(this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]&&!_[_0x1fdd('0x49')](this[_0x1fdd('0x12d')][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]['queue']])){if(this[_0x1fdd('0x137')][_0x302b93['actions'][_0x4bee73[_0x1fdd('0x129')]]['queue']]){this[_0x1fdd('0x137')][_0x302b93['actions'][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]=this['queueBookedRR'][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]?this[_0x1fdd('0x137')][this['actions'][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]:this['queueBooked'][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]][_0x1fdd('0xb0')]]?this['queueBooked'][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]['queue']]['_rr']||0x0:0x0;}this[_0x1fdd('0x12d')][this[_0x1fdd('0x26')][_0x4bee73['actionid']][_0x1fdd('0xb0')]][_0x1fdd('0x138')]=this[_0x1fdd('0x137')][this[_0x1fdd('0x26')][_0x4bee73[_0x1fdd('0x129')]]['queue']];for(var _0x18eab4=0x0;_0x18eab4=0x0;})[_0x1fdd('0xad')](myreject(_0x2885b2)));}}else{_0x2c19c7[_0x1fdd('0x12e')](ami[_0x1fdd('0xab')]({'action':_0x1fdd('0x14f'),'command':util[_0x1fdd('0x77')](_0x1fdd('0x150'),_0x11329a,!_[_0x1fdd('0x3f')](config[_0x1fdd('0x152')][_0x1c7143])?_0x1c7143:'')})[_0x1fdd('0x3e')](function(_0x4c6363){return _0x4c6363[_0x1fdd('0x153')][_0x1fdd('0x154')]('true')>=0x0;})[_0x1fdd('0xad')](myreject(_0x2885b2)));}BPromise[_0x1fdd('0x156')](_0x2c19c7)[_0x1fdd('0x3e')](function(_0xd9acff){var _0x12d912=_[_0x1fdd('0x157')](_0xd9acff);if(_0x12d912){return _0x5e552d(_0x12d912);}else{_0x496f20[_0x1fdd('0x40')]=_0x33a3a8?_0x1fdd('0x158'):'INTERVAL_IS_OVERTIME';return _0x2885b2(msgResponse(_0x1fdd('0x159'),_0x1fdd('0x14a'),_0x1fdd('0x15a')+_0x33a3a8+'\x20'+_0x13a5f8+_0x1fdd('0x15b')+util[_0x1fdd('0x97')](_0x11329a,{'showHidden':![],'depth':null})+_0x1fdd('0x15c')+_0x1c7143));}})['catch'](function(_0x201b2b){return _0x2885b2(msgResponse(_0x1fdd('0x148'),_0x1fdd('0x14a'),JSON['stringify'](_0x201b2b)));});});};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x15d')]=function(_0x43b981){var _0x230808=this;return function(){switch(_0x43b981['dialMethod']){case'progressive':freeVariablesPredictive(_0x43b981);_0x230808[_0x1fdd('0x15e')](_0x43b981,0x1);break;case'power':freeVariablesPredictive(_0x43b981);_0x230808[_0x1fdd('0x15e')](_0x43b981,_0x43b981['dialPowerLevel']);break;case _0x1fdd('0xb'):_0x230808[_0x1fdd('0xb')](_0x43b981);break;case _0x1fdd('0xa'):freeVariablesPredictive(_0x43b981);_0x230808['handlePower'](_0x43b981,0x1);break;default:freeVariablesPredictive(_0x43b981);logger[_0x1fdd('0x93')](_0x1fdd('0x15f'),_0x43b981[_0x1fdd('0x42')],_0x1fdd('0x160'));}};};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x161')]=function(_0x136e75){return BPromise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_0x136e75['id'],previewRecallmeReminderInterval))[_0x1fdd('0x3e')](function(_0x4f2744){for(var _0x4177eb=0x0;_0x4177eb<_0x4f2744[_0x1fdd('0x94')];_0x4177eb++){var _0x459582=_0x4f2744[_0x4177eb][_0x1fdd('0x162')][_0x1fdd('0x42')];if(_0x459582)io['to'](util['format'](_0x1fdd('0x163'),_0x459582))[_0x1fdd('0x4f')]('user:dialPreviewRecallReminder',{'hopper':_0x4f2744[_0x4177eb]});}})[_0x1fdd('0xad')](function(_0x2092f5){});};Dialer['prototype'][_0x1fdd('0x164')]=function(_0x5a8c1a){var _0x4c0623=this;return function(){_0x4c0623['handleIvr'](_0x5a8c1a);};};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x32')]=function(_0x66d9d2){var _0x4d56b6=this;if(isNotPreview(_0x66d9d2[_0x1fdd('0x165')])){if(isVoiceQueueOutbound(_0x66d9d2[_0x1fdd('0x50')])&&isActive(_0x66d9d2[_0x1fdd('0x57')])){_0x66d9d2['sendMessageOneNotActive']=!![];BPromise[_0x1fdd('0xb2')]()['then'](checkIsLoggedIn(_0x66d9d2,_0x66d9d2[_0x1fdd('0x166')]))[_0x1fdd('0x3e')](checkIsActive(_0x66d9d2,_0x66d9d2['dialActive']))['then'](checkInterval(_0x66d9d2))[_0x1fdd('0x3e')](_0x4d56b6[_0x1fdd('0x144')](_0x66d9d2))[_0x1fdd('0x3e')](_0x4d56b6[_0x1fdd('0x147')](_0x66d9d2[_0x1fdd('0x167')],_0x66d9d2['dialTimezone'],_0x66d9d2[_0x1fdd('0x42')],_0x66d9d2))['then'](_0x4d56b6[_0x1fdd('0x149')](_0x66d9d2['Interval'],_0x66d9d2[_0x1fdd('0x168')],_0x66d9d2['name'],_0x66d9d2))[_0x1fdd('0x3e')](_0x4d56b6[_0x1fdd('0x15d')](_0x66d9d2))['catch'](loggerCatchQueueSummary(_0x1fdd('0x169'),_0x66d9d2));}else{notSendMessagesQueue(_0x66d9d2);}}else{freeVariablesPredictive(_0x66d9d2);if(_0x66d9d2['dialPreviewRecallmeReminder']){_0x4d56b6[_0x1fdd('0x161')](_0x66d9d2);}}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x143')]=function(){var _0x4fa84a=this;var _0x2c99dc;for(var _0x4aeecb in this['campaigns']){if(typeof this[_0x1fdd('0x21')][_0x4aeecb]!==_0x1fdd('0xc6')){_0x2c99dc=this[_0x1fdd('0x21')][_0x4aeecb];if(isCampaignIvr(_0x2c99dc['type'])&&isActive(_0x2c99dc[_0x1fdd('0x73')])){_0x2c99dc[_0x1fdd('0x9a')]=!![];BPromise[_0x1fdd('0xb2')]()['then'](checkIsActive(_0x2c99dc,_0x2c99dc['active']))[_0x1fdd('0x3e')](checkInterval(_0x2c99dc))[_0x1fdd('0x3e')](_0x4fa84a[_0x1fdd('0x144')](_0x2c99dc))[_0x1fdd('0x3e')](_0x4fa84a[_0x1fdd('0x147')](_0x2c99dc[_0x1fdd('0x167')],_0x2c99dc['dialTimezone'],_0x2c99dc[_0x1fdd('0x42')],_0x2c99dc))['then'](_0x4fa84a[_0x1fdd('0x149')](_0x2c99dc[_0x1fdd('0x45')],_0x2c99dc[_0x1fdd('0x168')],_0x2c99dc[_0x1fdd('0x42')],_0x2c99dc))[_0x1fdd('0x3e')](_0x4fa84a[_0x1fdd('0x164')](_0x2c99dc))[_0x1fdd('0xad')](loggerCatchQueueSummary('[syncCampaigns]',_0x2c99dc));}else{notSendMessagesCampaign(_0x2c99dc);}}}};function getCallerIdRandom(_0x430907,_0x6a80c8){var _0xe043b9;var _0x4f5dc6;var _0x205fbb;if(_0x6a80c8<=0x0){_0x6a80c8=0x1;}_0xe043b9=new RegExp(_0x1fdd('0x16a')+_0x6a80c8+'}$');_0x4f5dc6=Math[_0x1fdd('0x16b')](0xa,_0x6a80c8-0x1);_0x205fbb=Math[_0x1fdd('0x16b')](0xa,_0x6a80c8)-0x1;return util[_0x1fdd('0x77')]('%s',_[_0x1fdd('0x16c')](_0x430907,_0xe043b9,_[_0x1fdd('0x16d')](_0x4f5dc6,_0x205fbb)));}function extractCalleridName(_0x4a625c){var _0x4f0891=_0x4a625c['match'](/"(.*?)"/);return _0x4f0891?_0x4f0891[0x1]:_0x4a625c;}function extractCalleridNumber(_0x49600c){var _0x5f29a3=_0x49600c[_0x1fdd('0x16e')](/<(.*?)>/);return _0x5f29a3?_0x5f29a3[0x1]:_0x49600c;}Dialer[_0x1fdd('0x1b')]['actionOriginate']=function(_0x548153,_0x35b96f){var _0x40e494=this;var _0x51fbe1=uuid['v4']();this[_0x1fdd('0x26')][_0x51fbe1]=new Action(_0x548153,_0x35b96f,_0x51fbe1);return new BPromise(function(_0x5b5ef6,_0x5298ad){if(_[_0x1fdd('0x3f')](_0x548153)&&typeof _0x548153!==_0x1fdd('0x16f')){return _0x5298ad(msgResponse(_0x1fdd('0x170'),_0x1fdd('0x14a'),_0x1fdd('0x171')));}if(_[_0x1fdd('0x3f')](_0x35b96f[_0x1fdd('0x172')][_0x1fdd('0x173')])||_0x35b96f[_0x1fdd('0x172')][_0x1fdd('0x173')]===null){return _0x5298ad(msgResponse(_0x1fdd('0x170'),_0x1fdd('0x14a'),_0x1fdd('0x174')));}var _0x48d646={'XMD-CALLERID':_0x40e494[_0x1fdd('0x26')][_0x51fbe1][_0x1fdd('0x175')](),'XMD-AGI':_0x548153[_0x1fdd('0x107')]?util['format'](_0x1fdd('0x176'),ipAgi,_0x548153[_0x1fdd('0x107')]):_0x1fdd('0x177'),'XMD-AGIAFTER':_0x548153[_0x1fdd('0x118')]?util[_0x1fdd('0x77')](_0x1fdd('0x176'),ipAgi,_0x548153[_0x1fdd('0x118')]):_0x1fdd('0x177'),'XMD-QUEUE':_0x548153[_0x1fdd('0x50')]===_0x1fdd('0x51')?util[_0x1fdd('0x77')]('\x22%s,%s%s,,,%s\x22',_0x548153[_0x1fdd('0x42')],_0x548153[_0x1fdd('0x178')]||'',_0x548153[_0x1fdd('0x10d')]?'c':'',_0x548153[_0x1fdd('0x114')]||0x3):_0x1fdd('0x177'),'XMD-CONTACTID':_0x35b96f[_0x1fdd('0xcc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x40e494[_0x1fdd('0x26')][_0x51fbe1][_0x1fdd('0x175')](),'XMD-AMD':_0x548153['dialAMDActive']?_0x1fdd('0x179'):_0x1fdd('0x177'),'XMD-DESTINATION':_0x1fdd('0xdc')};if(_0x548153[_0x1fdd('0xe4')]){_0x48d646['XMD-AMDINITIALSILENCE']=_0x548153[_0x1fdd('0x17a')]||0x9c4;_0x48d646['XMD-AMDGREETING']=_0x548153[_0x1fdd('0x17b')]||0x5dc;_0x48d646[_0x1fdd('0x17c')]=_0x548153[_0x1fdd('0x17d')]||0x320;_0x48d646[_0x1fdd('0x17e')]=_0x548153['dialAMDTotalAnalysisTime']||0x1388;_0x48d646[_0x1fdd('0x17f')]=_0x548153[_0x1fdd('0x180')]||0x64;_0x48d646[_0x1fdd('0x181')]=_0x548153[_0x1fdd('0x182')]||0x32;_0x48d646[_0x1fdd('0x183')]=_0x548153[_0x1fdd('0x184')]||0x3;_0x48d646[_0x1fdd('0x185')]=_0x548153['dialAMDSilenceThreshold']||0x100;_0x48d646[_0x1fdd('0x186')]=_0x548153[_0x1fdd('0x187')]||0x1388;}if(_0x548153[_0x1fdd('0x50')]===_0x1fdd('0x51')){_0x48d646['XMD-VOICEQUEUEID']=_0x35b96f[_0x1fdd('0xcf')];}else{_0x48d646[_0x1fdd('0x188')]=_0x35b96f[_0x1fdd('0x101')];}for(var _0x4abd80 in _0x35b96f['Contact']){if(typeof _0x35b96f[_0x1fdd('0x172')][_0x4abd80]!==_0x1fdd('0xc6')){if(isNotNull(_0x35b96f[_0x1fdd('0x172')][_0x4abd80])&&_0x4abd80!=='id'&&_0x4abd80!=='tags'&&_0x4abd80!==_0x1fdd('0x189')&&_0x4abd80!==_0x1fdd('0x18a')){_0x48d646[util[_0x1fdd('0x77')](_0x1fdd('0x18b'),_0x1fdd('0x18c'),_['toUpper'](_0x4abd80))]=_0x35b96f[_0x1fdd('0x172')][_0x4abd80];}}}var _0x1f44d7=_0x40e494[_0x1fdd('0xd4')](_0x548153[_0x1fdd('0x72')])?getCallerId(_0x548153[_0x1fdd('0x72')]['callerid'],_0x548153['dialOriginateCallerIdName'],_0x548153['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x548153['dialOriginateCallerIdNumber'],_0x548153[_0x1fdd('0x18d')]):_0x548153['dialOriginateCallerIdNumber']):getCallerId(_[_0x1fdd('0xaa')](_0x548153['TrunkBackup'])?_0x548153['Trunk'][_0x1fdd('0x74')]:_0x548153[_0x1fdd('0x145')][_0x1fdd('0x74')],_0x548153['dialOriginateCallerIdName'],_0x548153[_0x1fdd('0x18d')]>0x0?getCallerIdRandom(_0x548153[_0x1fdd('0x59')],_0x548153[_0x1fdd('0x18d')]):_0x548153[_0x1fdd('0x59')]);if(_0x1f44d7){_0x48d646['XMD-ORIGINATECALLERIDNAME']=_0x40e494[_0x1fdd('0x26')][_0x51fbe1][_0x1fdd('0x18e')]=extractCalleridName(_0x1f44d7);_0x48d646[_0x1fdd('0x18f')]=_0x40e494[_0x1fdd('0x26')][_0x51fbe1][_0x1fdd('0x190')]=extractCalleridNumber(_0x1f44d7);}return ami[_0x1fdd('0xab')]({'actionid':_0x51fbe1,'action':_0x1fdd('0x170'),'channel':_0x40e494[_0x1fdd('0xd4')](_0x548153[_0x1fdd('0x72')])?util[_0x1fdd('0x77')](_0x1fdd('0x191'),_0x548153[_0x1fdd('0x72')]['name'],isNotNull(_0x548153[_0x1fdd('0x192')])?_0x548153['dialPrefix']['trim']()||'':'',_0x548153['dialCutDigit']>0x0?_0x35b96f[_0x1fdd('0x172')][_0x1fdd('0x173')]['substring'](_0x548153['dialCutDigit']):_0x35b96f['Contact'][_0x1fdd('0x173')]):util[_0x1fdd('0x77')]('SIP/%s/%s%s',_[_0x1fdd('0xaa')](_0x548153[_0x1fdd('0x145')])?_0x548153[_0x1fdd('0x72')]['name']:_0x548153[_0x1fdd('0x145')]['name'],isNotNull(_0x548153['dialPrefix'])?_0x548153[_0x1fdd('0x192')][_0x1fdd('0x193')]()||'':'',_0x548153[_0x1fdd('0x194')]>0x0?_0x35b96f[_0x1fdd('0x172')][_0x1fdd('0x173')][_0x1fdd('0x195')](_0x548153[_0x1fdd('0x194')]):_0x35b96f[_0x1fdd('0x172')][_0x1fdd('0x173')]),'callerid':_0x1f44d7,'Exten':'xcally-motion-dialer','Context':_0x1fdd('0x196'),'Priority':'1','variable':_0x48d646,'timeout':(_0x548153['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x51fbe1})['then'](function(_0x36f842){return _0x5b5ef6(_0x36f842);})[_0x1fdd('0xad')](function(_0x53c171){_0x548153[_0x1fdd('0x63')]+=0x1;var _0x2ffdae=new History(_0x40e494[_0x1fdd('0x26')][_0x51fbe1]);logger[_0x1fdd('0x93')](util['format'](_0x1fdd('0x197'),JSON['stringify'](_0x53c171)));_0x2ffdae[_0x1fdd('0xa2')]=0xe;_0x2ffdae[_0x1fdd('0xa3')]=_0x1fdd('0x198');_0x2ffdae[_0x1fdd('0xa4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ffdae[_0x1fdd('0x125')]=_0x2ffdae[_0x1fdd('0xa4')];_0x40e494[_0x1fdd('0xc4')](_0x2ffdae)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x199')));_0x40e494[_0x1fdd('0xc2')](_0x2ffdae)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x199')))[_0x1fdd('0x1d')](function(){delete _0x40e494[_0x1fdd('0x26')][_0x51fbe1];return _0x5298ad(msgResponse(_0x1fdd('0x170'),'Error',_0x1fdd('0x19a')));});});});};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x2f')]=function(_0x2e4ce7){var _0x2f0f0a=this[_0x1fdd('0x26')][_0x2e4ce7[_0x1fdd('0x129')]];if(_0x2f0f0a){delete this['actions'][_0x2e4ce7[_0x1fdd('0x129')]];_0x2f0f0a['responsetime']=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));var _0x532e9c=_0x2f0f0a['type']===_0x1fdd('0x7a')?this['campaigns'][_0x2f0f0a[_0x1fdd('0xb0')]]:this[_0x1fdd('0x20')][_0x2f0f0a['getQueue']()];if(!this['isSuccess'](_0x2e4ce7[_0x1fdd('0x19b')])){this['updateOriginated'](_0x532e9c);return this['callProgressDetecting'](_0x2f0f0a,_0x532e9c,_0x2e4ce7)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x19c')));}this['uniqueId'][_0x2e4ce7['uniqueid']]=_0x2f0f0a;}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x19d')]=function(_0x43ef33,_0x2ced11,_0x543d4a){var _0x4157d2=new History(_0x2ced11);if(_0x4157d2[_0x1fdd('0xfc')]+_0x4157d2[_0x1fdd('0xea')]+_0x4157d2['countnoanswerretry']+_0x4157d2[_0x1fdd('0xec')]+_0x4157d2['countdropretry']+_0x4157d2[_0x1fdd('0xee')]+_0x4157d2[_0x1fdd('0xe7')]+_0x4157d2[_0x1fdd('0xfd')]>=_0x543d4a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x43ef33){case 0x3:if(_0x4157d2[_0x1fdd('0xeb')]>=_0x543d4a[_0x1fdd('0x19e')]-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countnoanswerretry':_0x4157d2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a[_0x1fdd('0x19f')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2[_0x1fdd('0xcd')],'VoiceQueueId':_0x4157d2['VoiceQueueId']||undefined,'CampaignId':_0x4157d2[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1a0')));break;case 0x5:if(_0x4157d2['countbusyretry']>=_0x543d4a['dialBusyMaxRetry']-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countbusyretry':_0x4157d2['countbusyretry']+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a[_0x1fdd('0x1a1')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2[_0x1fdd('0xcd')],'VoiceQueueId':_0x4157d2['VoiceQueueId']||undefined,'CampaignId':_0x4157d2['CampaignId']||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1a2')));break;case 0x8:if(_0x4157d2[_0x1fdd('0xea')]>=_0x543d4a[_0x1fdd('0x1a3')]-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countcongestionretry':_0x4157d2[_0x1fdd('0xea')]+=0x1,'scheduledat':moment()['add'](_0x543d4a[_0x1fdd('0x1a4')],'minutes')[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2[_0x1fdd('0xcd')],'VoiceQueueId':_0x4157d2[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x4157d2['CampaignId']||undefined})[_0x1fdd('0xad')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4157d2['countnosuchnumberretry']>=_0x543d4a[_0x1fdd('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4157d2[_0x1fdd('0xec')]+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a[_0x1fdd('0x1a6')],'minutes')[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2[_0x1fdd('0xcd')],'VoiceQueueId':_0x4157d2['VoiceQueueId']||undefined,'CampaignId':_0x4157d2['CampaignId']||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1a7')));}break;case 0xa:if(_0x4157d2['countdropretry']>=_0x543d4a[_0x1fdd('0x119')]-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countdropretry':_0x4157d2[_0x1fdd('0xed')]+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a[_0x1fdd('0x11b')],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2[_0x1fdd('0xcd')],'VoiceQueueId':_0x4157d2[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x4157d2[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x11c')));break;case 0xb:if(_0x4157d2['countabandonedretry']>=_0x543d4a[_0x1fdd('0x1a8')]-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countabandonedretry':_0x4157d2[_0x1fdd('0xee')]+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a[_0x1fdd('0x123')],'minutes')[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2['ContactId'],'ListId':_0x4157d2['ListId'],'VoiceQueueId':_0x4157d2[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x4157d2['CampaignId']||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x124')));break;case 0x13:if(_0x4157d2[_0x1fdd('0xe7')]>=_0x543d4a[_0x1fdd('0xf0')]-0x1){return!![];}this[_0x1fdd('0xb9')]({'active':![],'countmachineretry':_0x4157d2[_0x1fdd('0xe7')]+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a['dialMachineRetryFrequency'],_0x1fdd('0xf4'))['format'](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2['ListId'],'VoiceQueueId':_0x4157d2['VoiceQueueId']||undefined,'CampaignId':_0x4157d2[_0x1fdd('0x101')]||undefined})['catch'](loggerCatch(_0x1fdd('0xf6')));break;case 0x14:if(_0x4157d2[_0x1fdd('0xfd')]>=_0x543d4a['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4157d2['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x1fdd('0xf3')](_0x543d4a['dialAgentRejectRetryFrequency'],_0x1fdd('0xf4'))[_0x1fdd('0x77')](_0x1fdd('0xf5')),'ContactId':_0x4157d2[_0x1fdd('0xcc')],'ListId':_0x4157d2['ListId'],'VoiceQueueId':_0x4157d2[_0x1fdd('0xcf')]||undefined,'CampaignId':_0x4157d2[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1a9')));break;default:return!![];}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x1aa')]=function(_0x433339,_0x310b6c,_0xcf3124){var _0x5062b9=this;var _0x1b5c28=new History(_0x433339);return new BPromise(function(_0x406a29,_0x42dae6){if(_[_0x1fdd('0x3f')](_0x310b6c)&&typeof _0x310b6c!=='object'){return _0x42dae6(msgResponse(_0x1fdd('0x1ab'),'Failure',_0x1fdd('0x1ac')));}if(_[_0x1fdd('0x3f')](_0xcf3124)&&typeof _0xcf3124!==_0x1fdd('0x16f')){return _0x42dae6(msgResponse(_0x1fdd('0x1ab'),_0x1fdd('0x14a'),_0x1fdd('0x1ad')));}switch(_0xcf3124[_0x1fdd('0x10b')]){case'0':_0x310b6c[_0x1fdd('0x62')]+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0x0;_0x1b5c28['statedesc']=_0x1fdd('0x1ae');_0x1b5c28[_0x1fdd('0xec')]+=0x1;_0x1b5c28[_0x1fdd('0xfb')]+=0x1;ami[_0x1fdd('0x4f')](_0x1fdd('0x1af'),ut[_0x1fdd('0xf8')](_0x433339,_0x1fdd('0x1b0')));_0x5062b9[_0x1fdd('0xc4')](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5062b9[_0x1fdd('0x19d')](0x0,_0x433339,_0x310b6c)){if(_0x1b5c28['countnosuchnumberretry']>=_0x310b6c[_0x1fdd('0x1a5')]){_0x5062b9['createStateFinal'](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1b1'));}else{_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1b1'));}}break;case'3':_0x310b6c[_0x1fdd('0x61')]+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0x3;_0x1b5c28['statedesc']='NoAnswer';_0x1b5c28['countnoanswerretry']+=0x1;_0x1b5c28[_0x1fdd('0xfb')]+=0x1;ami[_0x1fdd('0x4f')](_0x1fdd('0x1b2'),ut['buildObj'](_0x433339,_0x1fdd('0x1b3')));_0x5062b9[_0x1fdd('0xc4')](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1b4')));if(_0x5062b9[_0x1fdd('0x19d')](0x3,_0x433339,_0x310b6c)){if(_0x1b5c28['countnoanswerretry']>=_0x310b6c[_0x1fdd('0x19e')]){_0x5062b9[_0x1fdd('0xf1')](_0x1b5c28,_0x406a29,_0x42dae6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1b5'));}}break;case'5':_0x310b6c[_0x1fdd('0x5d')]+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0x5;_0x1b5c28[_0x1fdd('0xa3')]=_0x1fdd('0x1b6');_0x1b5c28[_0x1fdd('0xfc')]+=0x1;_0x1b5c28[_0x1fdd('0xfb')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x433339,'busy'));_0x5062b9[_0x1fdd('0xc4')](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1b7')));if(_0x5062b9[_0x1fdd('0x19d')](0x5,_0x433339,_0x310b6c)){if(_0x1b5c28[_0x1fdd('0xfc')]>=_0x310b6c['dialBusyMaxRetry']){_0x5062b9[_0x1fdd('0xf1')](_0x1b5c28,_0x406a29,_0x42dae6,'reason\x205\x20busy');}else{_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1b8'));}}break;case'8':_0x310b6c[_0x1fdd('0x5e')]+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0x8;_0x1b5c28[_0x1fdd('0xa3')]=_0x1fdd('0x1b9');_0x1b5c28[_0x1fdd('0xea')]+=0x1;_0x1b5c28[_0x1fdd('0xfb')]+=0x1;ami[_0x1fdd('0x4f')](_0x1fdd('0x1ba'),ut['buildObj'](_0x433339,_0x1fdd('0x1bb')));_0x5062b9[_0x1fdd('0xc4')](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5062b9[_0x1fdd('0x19d')](0x8,_0x433339,_0x310b6c)){if(_0x1b5c28[_0x1fdd('0xea')]>=_0x310b6c[_0x1fdd('0x1a3')]){_0x5062b9['createStateFinal'](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1bc'));}else{_0x5062b9['stateGlobal'](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1bc'));}}break;case'11':_0x310b6c[_0x1fdd('0x1bd')]+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0xb;_0x1b5c28['statedesc']=_0x1fdd('0x121');_0x1b5c28['countabandonedretry']+=0x1;_0x1b5c28['countglobal']+=0x1;_0x5062b9['createHistory'](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x126')));if(_0x5062b9[_0x1fdd('0x19d')](0xb,_0x433339,_0x310b6c)){if(_0x1b5c28[_0x1fdd('0xee')]>=_0x310b6c['dialAbandonedMaxRetry']){_0x5062b9[_0x1fdd('0xf1')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1be'));}else{_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1be'));}}break;case'20':_0x310b6c[_0x1fdd('0x64')]+=0x1;_0x1b5c28['state']=0x14;_0x1b5c28[_0x1fdd('0xa3')]=_0x1fdd('0x1bf');_0x1b5c28[_0x1fdd('0xfd')]+=0x1;_0x1b5c28['countglobal']+=0x1;ami['emit'](_0x1fdd('0x1c0'),ut[_0x1fdd('0xf8')](_0x433339,_0x1fdd('0x1c1')));_0x5062b9['createHistory'](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1c2')));if(_0x5062b9['checkRetriveMax'](0x14,_0x433339,_0x310b6c)){if(_0x1b5c28[_0x1fdd('0xfd')]>=_0x310b6c['dialAgentRejectMaxRetry']){_0x5062b9['createStateFinal'](_0x1b5c28,_0x406a29,_0x42dae6,'reason\x2020\x20agentreject');}else{_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0x1fdd('0x1c3'));}}break;default:_0x310b6c['outboundUnknownCallsDay']+=0x1;_0x1b5c28[_0x1fdd('0xa2')]=0xc;_0x1b5c28[_0x1fdd('0xa3')]=_0xcf3124[_0x1fdd('0x10b')];_0x5062b9[_0x1fdd('0xc4')](_0x1b5c28)[_0x1fdd('0xad')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5062b9[_0x1fdd('0x19d')](_0xcf3124[_0x1fdd('0x10b')],_0x433339,_0x310b6c)){if(_0x1b5c28['countbusyretry']+_0x1b5c28[_0x1fdd('0xea')]+_0x1b5c28[_0x1fdd('0xeb')]+_0x1b5c28['countnosuchnumberretry']+_0x1b5c28[_0x1fdd('0xed')]+_0x1b5c28[_0x1fdd('0xee')]+_0x1b5c28[_0x1fdd('0xe7')]+_0x1b5c28['countagentrejectretry']>=_0x310b6c['dialGlobalMaxRetry']){_0x5062b9[_0x1fdd('0xfe')](_0x1b5c28,_0x406a29,_0x42dae6,_0xcf3124[_0x1fdd('0x10b')]);}else{_0x5062b9[_0x1fdd('0xf1')](_0x1b5c28,_0x406a29,_0x42dae6,_0xcf3124[_0x1fdd('0x10b')]);}}}});};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xfe')]=function(_0x2d6ef3,_0x5950a7,_0x5a62bd,_0x11a7ed){var _0x1849a4=new Final(_0x2d6ef3);_0x1849a4[_0x1fdd('0xa2')]=0xf;_0x1849a4['statedesc']=_0x1fdd('0x1c4');this[_0x1fdd('0xf1')](_0x1849a4,_0x5950a7,_0x5a62bd,_0x11a7ed);};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xf1')]=function(_0x833868,_0x192d1d,_0x190e54,_0x5afc0a){this[_0x1fdd('0xc2')](_0x833868)['then'](function(){return _0x192d1d(msgResponse(_0x1fdd('0x1ab'),_0x1fdd('0xd3'),_0x5afc0a));})[_0x1fdd('0xad')](function(){return _0x190e54(msgResponse('[moveContactManagedDialer][0]',_0x1fdd('0x14a'),_0x1fdd('0x1c5')));});};Dialer[_0x1fdd('0x1b')][_0x1fdd('0xb')]=function(_0x121a23){var _0x4bbb5e=_0x121a23[_0x1fdd('0x1c6')]/0x64;var _0x4528ca=_0x121a23[_0x1fdd('0x60')]/(_0x121a23[_0x1fdd('0x60')]+_0x121a23[_0x1fdd('0x5b')]);var _0x5295f8=Math[_0x1fdd('0x1c7')](_0x121a23[_0x1fdd('0x6d')]*(_0x121a23[_0x1fdd('0x1c8')]/0x64));var _0x3281f2=Math[_0x1fdd('0x1c7')](_0x121a23['predictiveIntervalAvailable']*(_0x121a23[_0x1fdd('0x1c9')]/0x64));var _0x13c746=_0x121a23[_0x1fdd('0x9c')]+_0x121a23[_0x1fdd('0x54')];var _0xab4ddd=Math['floor'](_0x121a23[_0x1fdd('0x86')]*_0x121a23[_0x1fdd('0x70')]*_0x121a23['predictiveIntervalHitRate']*_0x121a23[_0x1fdd('0x6b')]);if(_[_0x1fdd('0x3f')](_0x121a23[_0x1fdd('0x28')])){if(!_[_0x1fdd('0x3f')](_0x121a23[_0x1fdd('0x8c')])){_0x121a23['startPredictive']=undefined;loggerPredictive[_0x1fdd('0x93')](_0x1fdd('0x1ca'),_0x1fdd('0x1cb'));}if(!_[_0x1fdd('0x3f')](_0x121a23[_0x1fdd('0x8d')])){loggerPredictive['error'](_0x1fdd('0x1ca'),_0x1fdd('0x1cc'));clearInterval(_0x121a23[_0x1fdd('0x8d')]);_0x121a23['handlePredictive']=undefined;}_0x121a23[_0x1fdd('0x28')]=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));loggerPredictive[_0x1fdd('0x7d')](_0x121a23[_0x1fdd('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x121a23[_0x1fdd('0x28')]);this[_0x1fdd('0x15e')](_0x121a23,0x1);}else if(ifInterval(_0x121a23[_0x1fdd('0x1cd')],_0x121a23[_0x1fdd('0x28')])){this[_0x1fdd('0x15e')](_0x121a23,0x1);loggerPredictiveCalls[_0x1fdd('0x7d')](_0x1fdd('0x1ce'),_0x121a23[_0x1fdd('0x28')],_0x121a23[_0x1fdd('0x42')]);_0x121a23['erlangCalls']=0x0;_0x121a23[_0x1fdd('0x115')]=0x0;}else if(_0x4bbb5e<_0x4528ca&&_0x121a23[_0x1fdd('0x1cf')]===_0x1fdd('0x1d0')){freeVariablesPredictive(_0x121a23);loggerPredictive[_0x1fdd('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x4528ca,_0x1fdd('0x28'),_0x121a23[_0x1fdd('0x42')]);}else if(_0xab4ddd<_0x121a23[_0x1fdd('0x115')]&&_0x121a23[_0x1fdd('0x1cf')]===_0x1fdd('0x1d0')){freeVariablesPredictive(_0x121a23);loggerPredictive[_0x1fdd('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x1fdd('0x1d1'),_0xab4ddd,_0x1fdd('0x1d2'),_0x121a23['predictiveIntervalErlangCallsDroppedCalls'],_0x1fdd('0x28'),_0x121a23[_0x1fdd('0x42')]);}else if(!ifInterval(_0x121a23[_0x1fdd('0x1cd')],_0x121a23['startProgressive'])&&_[_0x1fdd('0x3f')](_0x121a23[_0x1fdd('0x8c')])&&!_[_0x1fdd('0x3f')](_0x121a23[_0x1fdd('0x28')])){_0x121a23[_0x1fdd('0x8c')]=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));loggerPredictive[_0x1fdd('0x7d')](_0x121a23['name'],_0x1fdd('0x1d3'),_0x121a23[_0x1fdd('0x8c')]);this[_0x1fdd('0xb7')](_0x121a23[_0x1fdd('0x1cd')])[_0x1fdd('0x3e')](this[_0x1fdd('0x1d4')](_0x121a23))[_0x1fdd('0x3e')](mergeDataErlangB(_0x121a23))[_0x1fdd('0x3e')](this['startMethodPredictive'](_0x121a23))[_0x1fdd('0xad')](loggerCatchPredictive(_0x1fdd('0x1d5'),_0x121a23));}else if(!ifInterval(_0x121a23[_0x1fdd('0x1cd')],_0x121a23[_0x1fdd('0x8c')])){_0x121a23[_0x1fdd('0x115')]=0x0;_0x121a23[_0x1fdd('0x8c')]=moment()[_0x1fdd('0x77')](_0x1fdd('0xf5'));loggerPredictive[_0x1fdd('0x7d')](_0x121a23['name'],_0x1fdd('0x1d6'),_0x121a23[_0x1fdd('0x8c')]);clearInterval(_0x121a23[_0x1fdd('0x8d')]);_0x121a23[_0x1fdd('0x8d')]=undefined;this['averageHandleTime'](_0x121a23['dialPredictiveInterval'])[_0x1fdd('0x3e')](this[_0x1fdd('0x1d4')](_0x121a23))[_0x1fdd('0x3e')](mergeDataErlangB(_0x121a23))[_0x1fdd('0x3e')](this[_0x1fdd('0x1d7')](_0x121a23))[_0x1fdd('0xad')](loggerCatchPredictive(_0x1fdd('0x1d8'),_0x121a23));}else if(_0x121a23[_0x1fdd('0x6d')]&&_0x13c746<_0x121a23['predictiveIntervalAvailable']-_0x3281f2){freeVariablesPredictive(_0x121a23);loggerPredictive[_0x1fdd('0x7d')](_0x121a23[_0x1fdd('0x42')],_0x1fdd('0x1d9'),_0x13c746,_0x1fdd('0x1da'),_0x121a23['predictiveIntervalAvailable'],'-',_0x3281f2,'=',_0x121a23[_0x1fdd('0x6d')]-_0x3281f2,')');}else if(_0x121a23['predictiveIntervalAvailable']&&_0x13c746>_0x121a23[_0x1fdd('0x6d')]+_0x5295f8){freeVariablesPredictive(_0x121a23);loggerPredictive[_0x1fdd('0x7d')](_0x121a23[_0x1fdd('0x42')],_0x1fdd('0x1d9'),_0x13c746,_0x1fdd('0x1db'),_0x121a23['predictiveIntervalAvailable'],'+',_0x5295f8,'=',_0x121a23[_0x1fdd('0x6d')]+_0x5295f8,')');}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x1d4')]=function(_0x3fcdc6){var _0x485a27=this;return function(_0x3f4c9f){return new BPromise(function(_0x5e295e,_0x5813b4){_['merge'](_0x3fcdc6,_0x3f4c9f[0x0]);if(checkGetDataPredictive(_0x3f4c9f[0x0])){var _0x57d2d7=_0x3fcdc6[_0x1fdd('0x6d')]=_0x3fcdc6[_0x1fdd('0x54')]+_0x3fcdc6['available'];var _0x30f028=_0x3fcdc6[_0x1fdd('0x1cd')]*0x3c;var _0x1a53ec=_0x3f4c9f[0x0]['predictiveIntervalAvgTalktime']+_0x3f4c9f[0x0][_0x1fdd('0x66')];var _0x3401e2=(_0x3f4c9f[0x0][_0x1fdd('0x1dc')]+_0x3f4c9f[0x0][_0x1fdd('0x69')]+_0x3f4c9f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3f4c9f[0x0]['predictiveIntervalTotalCalls'];_0x3fcdc6[_0x1fdd('0x1dd')]=_0x3401e2>0x0?_0x3401e2:0x1;switch(_0x3fcdc6[_0x1fdd('0x1cf')]){case _0x1fdd('0x1d0'):var _0x4b4eed=_0x3fcdc6[_0x1fdd('0x1c6')]/0x64;return _0x485a27['abandonmentRate'](_0x57d2d7,_0x30f028,_0x1a53ec,_0x3401e2,_0x4b4eed)[_0x1fdd('0x3e')](function(_0x99186a){return _0x5e295e(_0x99186a);});case _0x1fdd('0x1de'):var _0x248c1c=_0x3fcdc6[_0x1fdd('0x1c6')]/0x64;return _0x485a27[_0x1fdd('0x1df')](_0x57d2d7,_0x30f028,_0x1a53ec,_0x3401e2,_0x248c1c)['then'](function(_0x1634a5){return _0x5e295e(_0x1634a5);});default:return _0x5813b4(msgResponse(_0x1fdd('0x1e0'),_0x1fdd('0x14a'),_0x1fdd('0x1e1')));}}else{return _0x5813b4(msgResponse(_0x1fdd('0x1e0'),'Failure',_0x1fdd('0x1e2')));}});};};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x1e3')]=function(_0x17edec){var _0x3e0915=this;return function(_0xb8e40a){return new BPromise(function(_0x1b8ba5,_0x339e57){_['merge'](_0x17edec,_0xb8e40a[0x0]);if(checkGetDataPredictive(_0xb8e40a[0x0])){loggerPredictive[_0x1fdd('0x7d')](JSON[_0x1fdd('0x75')](_0xb8e40a[0x0]));if(_0x17edec[_0x1fdd('0x1cf')]===_0x1fdd('0x1d0')){return _0x3e0915['getVoiceQueueRtPauses'](_0x17edec['id'])[_0x1fdd('0x3e')](function(_0x5d6a0f){var _0x17ee99=_0x17edec[_0x1fdd('0x166')]-_0x5d6a0f[0x0][_0x1fdd('0x1e4')];var _0x1a9e09=_0x17edec[_0x1fdd('0x1cd')]*0x3c;var _0x4ddc04=_0xb8e40a[0x0][_0x1fdd('0x67')]+_0xb8e40a[0x0][_0x1fdd('0x66')];var _0x5cc4d0=(_0xb8e40a[0x0][_0x1fdd('0x1dc')]+_0xb8e40a[0x0][_0x1fdd('0x69')]+_0xb8e40a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xb8e40a[0x0][_0x1fdd('0x6e')];var _0x4148f0=_0x17edec['dialPredictiveOptimizationPercentage']/0x64;_0x17edec[_0x1fdd('0x6c')]=_0x5d6a0f[0x0]['outboundQueuePauses']||0x0;_0x17edec[_0x1fdd('0x1dd')]=_0x5cc4d0>0x0?_0x5cc4d0:0x1;return _0x3e0915[_0x1fdd('0x1e5')](_0x17ee99,_0x1a9e09,_0x4ddc04,_0x5cc4d0,_0x4148f0);})[_0x1fdd('0x3e')](function(_0x29f9c4){return _0x1b8ba5(_0x29f9c4);})[_0x1fdd('0xad')](function(_0xda0aa5){return _0x339e57(msgResponse(_0x1fdd('0x1e6'),_0x1fdd('0x14a'),JSON[_0x1fdd('0x75')](_0xda0aa5)));});}if(_0x17edec[_0x1fdd('0x1cf')]===_0x1fdd('0x1de')){return _0x3e0915['getVoiceQueueRtPauses'](_0x17edec['id'])[_0x1fdd('0x3e')](function(_0x4bbe01){var _0x523003=_0x17edec['loggedIn']-_0x4bbe01[0x0][_0x1fdd('0x1e4')];var _0x2082eb=_0x17edec[_0x1fdd('0x1cd')]*0x3c;var _0x3b4472=_0xb8e40a[0x0]['predictiveIntervalAvgTalktime']+_0xb8e40a[0x0][_0x1fdd('0x66')];var _0x51d047=(_0xb8e40a[0x0][_0x1fdd('0x1dc')]+_0xb8e40a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xb8e40a[0x0][_0x1fdd('0x68')])/_0xb8e40a[0x0][_0x1fdd('0x6e')];var _0x5c22df=_0x17edec[_0x1fdd('0x1c6')]/0x64;_0x17edec['predictiveIntervalPauses']=_0x4bbe01[0x0][_0x1fdd('0x1e4')]||0x0;_0x17edec[_0x1fdd('0x1dd')]=_0x51d047>0x0?_0x51d047:0x1;return _0x3e0915[_0x1fdd('0x1df')](_0x523003,_0x2082eb,_0x3b4472,_0x51d047,_0x5c22df);})[_0x1fdd('0x3e')](function(_0x501b8e){return _0x1b8ba5(_0x501b8e);})[_0x1fdd('0xad')](function(_0x424373){return _0x339e57(msgResponse(_0x1fdd('0x1e6'),'Failure',JSON[_0x1fdd('0x75')](_0x424373)));});}}else{return _0x339e57(msgResponse(_0x1fdd('0x1e0'),'Failure',_0x1fdd('0x1e2')));}});};};Dialer['prototype'][_0x1fdd('0x1d7')]=function(_0xc19d0f){var _0x412d70=this;return function(){var _0x268f22=0x0;var _0xa49108=Math[_0x1fdd('0x1e7')](_0xc19d0f[_0x1fdd('0x6f')]*0x3e8);if(_0xa49108>0x0){_0xa49108=_0xa49108<0x64?0x64:_0xa49108;loggerPredictive['info'](_0xc19d0f[_0x1fdd('0x42')],_0x1fdd('0x1e8'),_0xa49108,'milliseconds');_0xc19d0f[_0x1fdd('0x8d')]=setInterval(function(){_0x412d70[_0x1fdd('0x8d')](_0xc19d0f);loggerPredictiveCalls[_0x1fdd('0x7d')](_0x1fdd('0x1e9'),_0x268f22+=0x1);},_0xa49108);}else{loggerPredictive['info'](_0xc19d0f[_0x1fdd('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x1fdd('0x1ea')]=function(_0x346b97,_0xb20525){var _0x575561=this;return function(_0x11cb67){if(_[_0x1fdd('0x49')](_0x11cb67)){if(_[_0x1fdd('0xaa')](_0xb20525[_0x1fdd('0xce')])||!_0xb20525[_0x1fdd('0x1eb')]){if(_0x346b97[_0x1fdd('0x165')]==='booked'){_0x346b97[_0x1fdd('0x132')]=_[_0x1fdd('0x3f')](_0x346b97['queueStatusComplete'])?!![]:_0x346b97[_0x1fdd('0x132')];var _0x1f7ebb=uuid['v4']();_0x575561[_0x1fdd('0x26')][_0x1f7ebb]=new Action(_0x346b97,_0xb20525,_0x1f7ebb);loggerBooked[_0x1fdd('0x7d')](_0x1fdd('0x1ec'),_0x1f7ebb,_0x1fdd('0x1ed'),JSON[_0x1fdd('0x75')](_0x346b97[_0x1fdd('0x132')]),_0x1fdd('0x1ee'),_0x346b97[_0x1fdd('0x42')]);if(_0x346b97[_0x1fdd('0x132')]){_0x346b97[_0x1fdd('0x132')]=![];_0x575561['queueBooked'][_0x575561[_0x1fdd('0x26')][_0x1f7ebb]['queue']]=[];ami[_0x1fdd('0xab')]({'actionid':_0x1f7ebb,'action':_0x1fdd('0x1ef'),'queue':_0x346b97[_0x1fdd('0x42')]})[_0x1fdd('0xad')](function(){_0x575561[_0x1fdd('0xae')](_0x346b97);_0x575561[_0x1fdd('0xb9')]({'active':![],'ContactId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb][_0x1fdd('0xcc')],'ListId':_0x575561['actions'][_0x1f7ebb]['ListId'],'VoiceQueueId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb][_0x1fdd('0xcf')]||undefined,'CampaignId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb][_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1f0')));delete _0x575561['actions'][_0x1f7ebb];});}else{loggerBooked[_0x1fdd('0x7d')](_0x1fdd('0x1f1'),JSON['stringify'](_0x346b97['queueStatusComplete']),_0x1fdd('0x1ee'),_0x346b97[_0x1fdd('0x42')]);_0x575561['updateOriginated'](_0x346b97);_0x575561[_0x1fdd('0xb9')]({'active':![],'ContactId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb][_0x1fdd('0xcc')],'ListId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb][_0x1fdd('0xcd')],'VoiceQueueId':_0x575561[_0x1fdd('0x26')][_0x1f7ebb]['VoiceQueueId']||undefined,'CampaignId':_0x575561['actions'][_0x1f7ebb][_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x575561[_0x1fdd('0x26')][_0x1f7ebb];}}else{return _0x575561[_0x1fdd('0x1f2')](_0x346b97,_0xb20525);}}else{if(getDiff(_0xb20525[_0x1fdd('0x1f3')])<_0x346b97[_0x1fdd('0x1f4')]*0x3c){if(_0xb20525['Agent']&&!_0xb20525[_0x1fdd('0x162')][_0x1fdd('0x1f5')]){_0x575561[_0x1fdd('0x1f')]['run'](_0xb20525['id'])[_0x1fdd('0x1d')](function(){_0x575561[_0x1fdd('0xae')](_0x346b97);});}else{_0x575561[_0x1fdd('0xbb')]({'active':![]},_0xb20525['id'],0x1)[_0x1fdd('0x1d')](function(){_0x575561[_0x1fdd('0xae')](_0x346b97);});}}else{_0x346b97[_0x1fdd('0x1f6')]+=0x1;_0x575561[_0x1fdd('0xae')](_0x346b97);if(_0x346b97[_0x1fdd('0x1f7')]){_0x575561[_0x1fdd('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb20525[_0x1fdd('0xcc')],'ListId':_0xb20525[_0x1fdd('0xcd')],'VoiceQueueId':_0xb20525[_0x1fdd('0xcf')]||undefined,'CampaignId':_0xb20525[_0x1fdd('0x101')]||undefined})[_0x1fdd('0xad')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x575561['createHistory'](createObjHistory(_0x346b97,_0xb20525,_0x1fdd('0x1f8'),0x17,_0x1fdd('0x1f9')))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0x1fa')));}else{_0x575561[_0x1fdd('0xd7')](createObjHistory(_0x346b97,_0xb20525,_0x1fdd('0x1fb'),0x16,'RecallFailedTimeout'),_0x1fdd('0x1fc'),_0x1fdd('0x1fd'));}}}}else{_0x346b97[_0x1fdd('0x5c')]+=0x1;_0x575561['saveInDb'](createObjHistory(_0x346b97,_0xb20525,_0x1fdd('0x1fe'),0xd,_0x1fdd('0x1ff')),'[Originate][historyBlacklist]',_0x1fdd('0x200'));throw _0x1fdd('0x201');}};};Dialer[_0x1fdd('0x1b')]['handleIvr']=function(_0x42f8b5){var _0x4c8641=this;var _0x199b97=_0x42f8b5[_0x1fdd('0x202')]-_0x42f8b5[_0x1fdd('0x95')]-_0x42f8b5['temp'];emitCampaignSummary(_0x42f8b5);if(_0x199b97>0x0){if(_0x199b97>this['maxNumberOriginate']){_0x199b97=this[_0x1fdd('0x24')];}_0x42f8b5['temp']+=_0x199b97;this[_0x1fdd('0xbe')](_0x42f8b5['id'],_0x199b97,_0x42f8b5[_0x1fdd('0x203')],_0x42f8b5)[_0x1fdd('0x3e')](function(_0x295dcd){_0x42f8b5[_0x1fdd('0xbd')]-=_0x199b97;_0x42f8b5[_0x1fdd('0xbd')]=_0x42f8b5[_0x1fdd('0xbd')]>0x0?_0x42f8b5[_0x1fdd('0xbd')]:0x0;if(!checkContactEmpty(_0x295dcd)){_0x42f8b5[_0x1fdd('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x1fdd('0x7d')](_0x1fdd('0x204')+_0x42f8b5[_0x1fdd('0x42')]);}else{_0x42f8b5['originated']+=_0x295dcd['length'];_0x42f8b5[_0x1fdd('0x40')]=_0x1fdd('0x205');for(var _0x22d7e5=0x0;_0x22d7e5<_0x295dcd[_0x1fdd('0x94')];_0x22d7e5+=0x1){_0x42f8b5[_0x1fdd('0x206')]+=0x1;if(_[_0x1fdd('0xaa')](_0x295dcd[_0x22d7e5])||_[_0x1fdd('0xaa')](_0x295dcd[_0x22d7e5][_0x1fdd('0x172')])||_[_0x1fdd('0xaa')](_0x295dcd[_0x22d7e5]['Contact'][_0x1fdd('0x173')])){_0x4c8641[_0x1fdd('0xca')](_0x1fdd('0x207'),_0x42f8b5,_0x295dcd[_0x22d7e5]);}else{_0x4c8641[_0x1fdd('0xb5')](_[_0x1fdd('0x12f')](_0x295dcd[_0x22d7e5],[_0x1fdd('0x101'),_0x1fdd('0x208')]))['then'](_0x4c8641[_0x1fdd('0x1ea')](_0x42f8b5,_0x295dcd[_0x22d7e5]))[_0x1fdd('0xad')](_0x4c8641['loggerHandler'](_0x1fdd('0x209'),_0x42f8b5));}}}})[_0x1fdd('0xad')](loggerGetContactDialer(_0x1fdd('0x20a'),_0x42f8b5,_0x199b97));}};Dialer['prototype']['handlePower']=function(_0x585a18,_0x19a935){var _0x254296=this;var _0x3babaf=[];var _0xca3279=_0x19a935>=0x1?_0x19a935:0x1;if(_0x585a18[_0x1fdd('0x165')]===_0x1fdd('0xa')){_0xca3279=0x1;}var _0x7d4c60=Math['floor'](_0x585a18[_0x1fdd('0x9c')]*_0xca3279)-_0x585a18[_0x1fdd('0x95')]-_0x585a18[_0x1fdd('0xbd')];emitVoiceQueueSummary(_0x585a18);if(_0x585a18[_0x1fdd('0x20b')]>0x0){var _0x15bc34=_0x585a18[_0x1fdd('0x20b')]-_0x585a18['originated']-_0x585a18['talking']-_0x585a18[_0x1fdd('0xbd')]-_0x585a18[_0x1fdd('0x9b')];if(_0x7d4c60>_0x15bc34){_0x7d4c60=_0x15bc34;}}if(_0x7d4c60>0x0){if(_0x585a18['dialMethod']===_0x1fdd('0xa')){_0x7d4c60=0x1;}if(_0x7d4c60>this['maxNumberOriginate']){_0x7d4c60=this[_0x1fdd('0x24')];}_0x585a18[_0x1fdd('0xbd')]+=_0x7d4c60;for(var _0x2e5104 in this[_0x1fdd('0x22')]){if(typeof this[_0x1fdd('0x22')][_0x2e5104]!=='undefined'){if(this[_0x1fdd('0x22')][_0x2e5104]['state']===_0x1fdd('0x20c')&&this['agents'][_0x2e5104][_0x1fdd('0xac')]===_0x1fdd('0xd5')){_0x3babaf[_0x1fdd('0x12e')](this[_0x1fdd('0x22')][_0x2e5104]['id']);}}}this[_0x1fdd('0xbc')](_0x585a18['id'],_0x3babaf,_0x7d4c60,_0x585a18['dialOrderByScheduledAt'],_0x585a18)[_0x1fdd('0x3e')](function(_0xcf395c){_0x585a18[_0x1fdd('0xbd')]-=_0x7d4c60;_0x585a18[_0x1fdd('0xbd')]=_0x585a18[_0x1fdd('0xbd')]>0x0?_0x585a18[_0x1fdd('0xbd')]:0x0;if(!checkContactEmpty(_0xcf395c)){_0x254296[_0x1fdd('0xb1')](_0x585a18)[_0x1fdd('0x3e')](sendMessageReschedule(_0x585a18))['catch'](loggerCatch(_0x1fdd('0xb3')));}else{_0x585a18[_0x1fdd('0x95')]+=_0xcf395c[_0x1fdd('0x94')];_0x585a18[_0x1fdd('0x40')]=_0x585a18[_0x1fdd('0x165')]===_0x1fdd('0xa')?_0x1fdd('0x179'):_0x1fdd('0x205');for(var _0xc4bbb9=0x0;_0xc4bbb9<_0xcf395c[_0x1fdd('0x94')];_0xc4bbb9+=0x1){if(_[_0x1fdd('0xaa')](_0xcf395c[_0xc4bbb9])||_[_0x1fdd('0xaa')](_0xcf395c[_0xc4bbb9]['Contact'])||_['isNil'](_0xcf395c[_0xc4bbb9][_0x1fdd('0x172')][_0x1fdd('0x173')])){_0x254296['emptyContact'](_0x1fdd('0x207'),_0x585a18,_0xcf395c[_0xc4bbb9]);}else{_0x254296[_0x1fdd('0xb4')](_[_0x1fdd('0x12f')](_0xcf395c[_0xc4bbb9],[_0x1fdd('0xcf'),_0x1fdd('0x208')]))[_0x1fdd('0x3e')](_0x254296[_0x1fdd('0x1ea')](_0x585a18,_0xcf395c[_0xc4bbb9]))[_0x1fdd('0xad')](_0x254296[_0x1fdd('0xc9')](_0x1fdd('0x207'),_0x585a18));}}}})[_0x1fdd('0xad')](loggerGetContactDialer(_0x1fdd('0x20d'),_0x585a18,_0x7d4c60));}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x8d')]=function(_0x37d2db){if(_0x37d2db[_0x1fdd('0x20b')]>0x0){var _0x47e4bb=_0x37d2db[_0x1fdd('0x20b')]-_0x37d2db[_0x1fdd('0x95')]-_0x37d2db[_0x1fdd('0x54')];if(_0x47e4bb>0x0){this['tryOriginatePredictive'](_0x37d2db);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x37d2db);}};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x20e')]=function(_0x1db89e){var _0x30998e=this;var _0x2c1667=[];_0x1db89e[_0x1fdd('0x95')]+=0x1;for(var _0x75f991 in this[_0x1fdd('0x22')]){if(typeof this[_0x1fdd('0x22')][_0x75f991]!=='undefined'){if(this['agents'][_0x75f991][_0x1fdd('0xa2')]==='not_inuse'&&this[_0x1fdd('0x22')][_0x75f991][_0x1fdd('0xac')]===_0x1fdd('0xd5')){_0x2c1667[_0x1fdd('0x12e')](this[_0x1fdd('0x22')][_0x75f991]['id']);}}}this['getContactDialer'](_0x1db89e['id'],_0x2c1667,0x1,_0x1db89e[_0x1fdd('0x203')],_0x1db89e)['then'](function(_0x1e043d){if(!checkContactEmpty(_0x1e043d)){checkContactLowerLimitOriginate(_0x1db89e,0x1,0x0);_0x30998e[_0x1fdd('0xb1')](_0x1db89e)['then'](sendMessageReschedule(_0x1db89e))[_0x1fdd('0xad')](loggerCatch(_0x1fdd('0xb3')));}else{_0x1db89e['message']='RUNNING';if(_[_0x1fdd('0xaa')](_0x1e043d[0x0])||_['isNil'](_0x1e043d[0x0]['Contact'])||_['isNil'](_0x1e043d[0x0][_0x1fdd('0x172')][_0x1fdd('0x173')])){_0x30998e[_0x1fdd('0xca')](_0x1fdd('0x207'),_0x1db89e,_0x1e043d[0x0]);}else{_0x30998e[_0x1fdd('0xb4')](_[_0x1fdd('0x12f')](_0x1e043d[0x0],['VoiceQueueId',_0x1fdd('0x208')]))['then'](_0x30998e[_0x1fdd('0x1ea')](_0x1db89e,_0x1e043d[0x0]))['catch'](_0x30998e['loggerHandler']('[actionOriginatePredictive]\x20',_0x1db89e));}}})['catch'](loggerGetContactDialer(_0x1fdd('0x20f'),_0x1db89e,0x1));emitVoiceQueueSummary(_0x1db89e);};Dialer[_0x1fdd('0x1b')][_0x1fdd('0x1e5')]=function(_0x577d95,_0x3b459d,_0x36db4d,_0x1d09e7,_0x3aa767,_0x1c5ed0){loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x210'));loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x211'),_0x577d95);loggerPredictive[_0x1fdd('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b459d);loggerPredictive['info'](_0x1fdd('0x212'),_0x36db4d);loggerPredictive['info'](_0x1fdd('0x213'),_0x1d09e7);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x214'),_0x3aa767);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x82'));return new BPromise(function(_0x208074,_0x405ee3){if(_0x577d95<=0x0||isNaN(_0x577d95)){return _0x405ee3(msgResponse('[abandonmentRate]',_0x1fdd('0x4b'),_0x1fdd('0x215')+_0x577d95));}if(_0x36db4d<=0x0||isNaN(_0x36db4d)){return _0x405ee3(msgResponse(_0x1fdd('0x216'),_0x1fdd('0x4b'),_0x1fdd('0x217')+_0x36db4d));}if(_0x1d09e7<=0x0||isNaN(_0x1d09e7)){return _0x405ee3(msgResponse('[abandonmentRate]',_0x1fdd('0x4b'),_0x1fdd('0x218')+_0x1d09e7));}if(_0x3b459d<=0x0||isNaN(_0x3b459d)){return _0x405ee3(msgResponse(_0x1fdd('0x216'),'Error','interval\x20=\x20'+_0x3b459d));}if(_0x3aa767<=0x0||isNaN(_0x3aa767)){return _0x405ee3(msgResponse('[abandonmentRate]',_0x1fdd('0x4b'),_0x1fdd('0x219')+_0x3aa767));}_0x1c5ed0=_0x1c5ed0||0x0;var _0x3d5950=0x1/_0x36db4d;var _0x372148=0x0;var _0x5f4ce5=0x0;var _0x234ddd=0x0;var _0x5b189a=0x0;for(var _0x4d0baa=0x0;_0x234ddd<_0x3aa767;_0x4d0baa+=0x1){_0x5f4ce5=_0x4d0baa/_0x3b459d;_0x372148=(_0x1d09e7*_0x5f4ce5+_0x1c5ed0)/_0x3d5950;_0x234ddd=erlangb(_0x372148,_0x577d95);_0x5b189a=_0x372148/_0x577d95*(0x1-erlangb(_0x372148,_0x577d95));}return _0x208074({'erlangCalls':_0x4d0baa,'erlangCallToSecond':_0x3b459d/_0x4d0baa,'erlangAbandonmentRate':_0x234ddd,'erlangBusyFactor':_0x5b189a});});};Dialer[_0x1fdd('0x1b')]['busyFactor']=function(_0x4fe71e,_0x538ef2,_0x3348a6,_0x43ce68,_0x3535bf,_0x529d93){loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x21a'));loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x211'),_0x4fe71e);loggerPredictive[_0x1fdd('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x538ef2);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3348a6);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x213'),_0x43ce68);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x21b'),_0x3535bf);loggerPredictive[_0x1fdd('0x7d')](_0x1fdd('0x82'));return new BPromise(function(_0xa8548c,_0x28f0f2){if(_0x4fe71e<=0x0||isNaN(_0x4fe71e)){return _0x28f0f2(msgResponse(_0x1fdd('0x21c'),_0x1fdd('0x4b'),_0x1fdd('0x215')+_0x4fe71e));}if(_0x3348a6<=0x0||isNaN(_0x3348a6)){return _0x28f0f2(msgResponse(_0x1fdd('0x21c'),'Error',_0x1fdd('0x217')+_0x3348a6));}if(_0x43ce68<=0x0||isNaN(_0x43ce68)){return _0x28f0f2(msgResponse(_0x1fdd('0x21c'),_0x1fdd('0x4b'),_0x1fdd('0x218')+_0x43ce68));}if(_0x538ef2<=0x0||isNaN(_0x538ef2)){return _0x28f0f2(msgResponse(_0x1fdd('0x21c'),_0x1fdd('0x4b'),_0x1fdd('0x21d')+_0x538ef2));}if(_0x3535bf<=0x0||isNaN(_0x3535bf)){return _0x28f0f2(msgResponse(_0x1fdd('0x21c'),'Error',_0x1fdd('0x21e')+_0x3535bf));}_0x529d93=_0x529d93||0x0;var _0x5b22e7=0x1/_0x3348a6;var _0x4a1d08=0x0;var _0x37a828=0x0;var _0x389cb3=0x0;var _0x1e9a98=0x0;for(var _0x11dfaa=0x0;_0x1e9a98<_0x3535bf;_0x11dfaa+=0x1){_0x37a828=_0x11dfaa/_0x538ef2;_0x4a1d08=(_0x43ce68*_0x37a828+_0x529d93)/_0x5b22e7;_0x389cb3=erlangb(_0x4a1d08,_0x4fe71e);_0x1e9a98=_0x4a1d08/_0x4fe71e*(0x1-erlangb(_0x4a1d08,_0x4fe71e));}return _0xa8548c({'erlangCalls':_0x11dfaa,'erlangCallToSecond':_0x538ef2/_0x11dfaa,'erlangAbandonmentRate':_0x389cb3,'erlangBusyFactor':_0x1e9a98});});};module[_0x1fdd('0x21f')]=Dialer; \ No newline at end of file +var _0x29cc=['Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','ACTIVE','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','isSuccess','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','diff','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','isUndefined','History\x20information\x20are\x20empty','---------\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','[emptyContact]','Success','SIP/%s','reachable','unmonitored','uniqueId','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','membername','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countglobal','countcongestionretry','countdropretry','countagentrejectretry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','syncAgentComplete','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','dropreason','TIMEOUT','calleridnum','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','preview','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x29cc,0xbc));var _0xc29c=function(_0x5baf36,_0x28bdf5){_0x5baf36=_0x5baf36-0x0;var _0x398cd1=_0x29cc[_0x5baf36];return _0x398cd1;};'use strict';var util=require('util');var _=require(_0xc29c('0x0'));var BPromise=require(_0xc29c('0x1'));var uuid=require(_0xc29c('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xc29c('0x3'));var Redis=require(_0xc29c('0x4'));var ut=require(_0xc29c('0x5'));var config=require(_0xc29c('0x6'));var logger=require(_0xc29c('0x7'))('dialer');var loggerBooked=require(_0xc29c('0x7'))(_0xc29c('0x8'));var loggerPredictive=require(_0xc29c('0x7'))(_0xc29c('0x9'));var loggerPredictiveCalls=require(_0xc29c('0x7'))(_0xc29c('0xa'));var loggerSyncQueueSummary=require(_0xc29c('0x7'))(_0xc29c('0xb'));var ami=require(_0xc29c('0xc'));config[_0xc29c('0xd')]=_['defaults'](config[_0xc29c('0xd')],{'host':_0xc29c('0xe'),'port':0x18eb});var io=require(_0xc29c('0xf'))(new Redis(config[_0xc29c('0xd')]));var cmHopper=require(_0xc29c('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc29c('0x11'));var voiceQueueRt=require(_0xc29c('0x12'));var RpcSetting=require(_0xc29c('0x13'));var Action=require(_0xc29c('0x14'));var History=require(_0xc29c('0x15'));var Final=require(_0xc29c('0x16'));var AgentComplete=require(_0xc29c('0x17'));var QueueCallerAbandon=require(_0xc29c('0x18'));var Hangup=require(_0xc29c('0x19'));var ipAgi=process[_0xc29c('0x1a')][_0xc29c('0x1b')]||'127.0.0.1';var strategy={'rrmemory':_0xc29c('0x1c'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xc29c('0x1d')][_0xc29c('0x1e')]=function(_0x3a6997){this[_0xc29c('0x1f')]=this[_0xc29c('0x1f')]?this[_0xc29c('0x1f')][_0xc29c('0x20')](_0x3a6997):_0x3a6997();};function Dialer(_0x6d2233,_0x33ab3b){this['sequence']=new Sequence();this['preview']=_0x33ab3b;this['voiceQueues']=_0x6d2233[_0xc29c('0x21')];this[_0xc29c('0x22')]=_0x6d2233[_0xc29c('0x22')];this[_0xc29c('0x23')]=_0x6d2233[_0xc29c('0x23')];this[_0xc29c('0x24')]=_0x6d2233['trunks'];this[_0xc29c('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xc29c('0x26')]={};this[_0xc29c('0x27')]={};this['uniqueId']={};this[_0xc29c('0x28')]={};this[_0xc29c('0x29')]={};this[_0xc29c('0x2a')]={};this['ivrOriginated']={};this[_0xc29c('0x2b')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0xc29c('0x2c')][_0xc29c('0x2d')](this));ami['on']('queuecallerabandon',this[_0xc29c('0x2e')]['bind'](this));ami['on'](_0xc29c('0x2f'),this[_0xc29c('0x30')][_0xc29c('0x2d')](this));ami['on'](_0xc29c('0x31'),this['syncAgentComplete']['bind'](this));ami['on'](_0xc29c('0x32'),this[_0xc29c('0xb')]['bind'](this));ami['on'](_0xc29c('0x33'),this[_0xc29c('0x34')][_0xc29c('0x2d')](this));ami['on'](_0xc29c('0x35'),this[_0xc29c('0x36')][_0xc29c('0x2d')](this));ami['on']('varset',this[_0xc29c('0x37')][_0xc29c('0x2d')](this));ami['on'](_0xc29c('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0xc29c('0x39'),this[_0xc29c('0x3a')][_0xc29c('0x2d')](this));this[_0xc29c('0x3b')]();this[_0xc29c('0x3c')]();RpcSetting[_0xc29c('0x3d')]()[_0xc29c('0x3e')](function(_0x15da2e){previewRecallmeReminderInterval=_0x15da2e[_0xc29c('0x3f')];});}function isNotNull(_0x39a9a8){return _0x39a9a8!==null&&!_['isUndefined'](_0x39a9a8);}function checkIsLoggedIn(_0x2948a0,_0x421482){return function(){if(_0x421482<=0x0){_0x2948a0[_0xc29c('0x40')]='AGENTS_NOT_LOGGED';throw _0x2948a0[_0xc29c('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3aa676){return _0x3aa676;}function checkIsActive(_0x2f71d7,_0x59b89f){return function(){if(!isActive(_0x59b89f)){_0x2f71d7[_0xc29c('0x40')]=_0xc29c('0x42');throw _0x2f71d7[_0xc29c('0x41')]+_0xc29c('0x43');}};}function checkInterval(_0x46df12){return function(){if(!isNotNull(_0x46df12[_0xc29c('0x44')])){_0x46df12[_0xc29c('0x40')]='INTERVAL_IS_NULL';throw _0x46df12[_0xc29c('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x46df12['Interval'][_0xc29c('0x45')])){_0x46df12[_0xc29c('0x40')]=_0xc29c('0x46');throw _0x46df12['name']+_0xc29c('0x47');}if(!isNotNull(_[_0xc29c('0x48')](_0x46df12[_0xc29c('0x44')][_0xc29c('0x45')]))){_0x46df12['message']=_0xc29c('0x46');throw _0x46df12[_0xc29c('0x41')]+_0xc29c('0x47');}};}function msgResponse(_0x4a9fe0,_0x1d3b48,_0x331a15){return{'action':_0x4a9fe0,'response':_0x1d3b48,'message':_0x331a15,'stack':_0x331a15};}function myreject(_0x4f2ea8){return function(_0x34c94a){return _0x4f2ea8(msgResponse('[ifTime][Action]',_0xc29c('0x49'),JSON[_0xc29c('0x4a')](_0x34c94a)));};}function getSeconds(_0x23e0b8,_0x5e433f){var _0x55377e=moment(_0x23e0b8)[_0xc29c('0x4b')](0x0);var _0x5a3134=moment(_0x5e433f)[_0xc29c('0x4b')](0x0);return _0x55377e[_0xc29c('0x4c')](_0x5a3134,'seconds');}function emit(_0x38921f,_0x3b7146,_0x1b46e6){io['to'](_0x38921f)[_0xc29c('0x4d')](_0x3b7146,_0x1b46e6);}function emitVoiceQueueSummary(_0x385961){if(_0x385961['type']===_0xc29c('0x4e')){var _0x587b8a={'id':_0x385961['id'],'name':_0x385961[_0xc29c('0x41')],'strategy':_0x385961[_0xc29c('0x4f')],'answered':_0x385961[_0xc29c('0x50')],'available':_0x385961[_0xc29c('0x51')],'loggedIn':_0x385961[_0xc29c('0x52')],'pTalking':_0x385961[_0xc29c('0x53')],'sumBillable':_0x385961['sumBillable'],'sumDuration':_0x385961[_0xc29c('0x54')],'sumHoldTime':_0x385961[_0xc29c('0x55')]||0x0,'talking':_0x385961[_0xc29c('0x56')],'total':_0x385961[_0xc29c('0x57')],'type':_0x385961[_0xc29c('0x58')],'unmanaged':_0x385961[_0xc29c('0x59')],'abandoned':_0x385961['abandoned'],'waiting':_0x385961[_0xc29c('0x5a')],'loggedInDb':_0x385961[_0xc29c('0x5b')],'dialActive':_0x385961[_0xc29c('0x5c')],'dialMethod':_0x385961[_0xc29c('0x5d')],'dialOriginateCallerIdName':_0x385961[_0xc29c('0x5e')],'dialOriginateCallerIdNumber':_0x385961['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x385961[_0xc29c('0x5f')],'dialPrefix':_0x385961['dialPrefix'],'outboundAnswerAgiCallsDay':_0x385961[_0xc29c('0x60')],'outboundAnswerCallsDay':_0x385961[_0xc29c('0x61')],'outboundBlacklistCallsDay':_0x385961[_0xc29c('0x62')],'outboundBusyCallsDay':_0x385961[_0xc29c('0x63')],'outboundCongestionCallsDay':_0x385961[_0xc29c('0x64')],'outboundDropCallsDayACS':_0x385961[_0xc29c('0x65')],'outboundDropCallsDayCallersExit':_0x385961['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x385961[_0xc29c('0x66')],'outboundNoAnswerCallsDay':_0x385961[_0xc29c('0x67')],'outboundNoSuchCallsDay':_0x385961[_0xc29c('0x68')],'outboundOriginateFailureCallsDay':_0x385961['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x385961[_0xc29c('0x69')],'outboundRejectCallsDay':_0x385961['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x385961[_0xc29c('0x6a')],'predictiveIntervalAnsweredCalls':_0x385961['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x385961[_0xc29c('0x6b')],'predictiveIntervalAvgTalktime':_0x385961['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x385961['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x385961['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x385961[_0xc29c('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x385961[_0xc29c('0x6d')],'predictiveIntervalHitRate':_0x385961['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x385961[_0xc29c('0x6e')],'predictiveIntervalPauses':_0x385961[_0xc29c('0x6f')],'predictiveIntervalAvailable':_0x385961[_0xc29c('0x70')],'predictiveIntervalTotalCalls':_0x385961[_0xc29c('0x71')],'message':_0x385961[_0xc29c('0x40')],'originated':_0x385961[_0xc29c('0x72')],'erlangCalls':_0x385961[_0xc29c('0x73')],'erlangCallToSecond':_0x385961[_0xc29c('0x74')],'erlangAbandonmentRate':_0x385961[_0xc29c('0x75')],'erlangBusyFactor':_0x385961[_0xc29c('0x76')],'startPredictive':_0x385961[_0xc29c('0x29')],'startProgressive':_0x385961['startProgressive']};if(_0x385961[_0xc29c('0x77')]){_0x587b8a['Trunk']={'id':_0x385961[_0xc29c('0x77')]['id'],'name':_0x385961[_0xc29c('0x77')][_0xc29c('0x41')],'active':_0x385961['Trunk'][_0xc29c('0x78')],'callerid':_0x385961[_0xc29c('0x77')]['callerid']};}if(_0x385961[_0xc29c('0x44')]){_0x587b8a['Interval']={'id':_0x385961[_0xc29c('0x44')]['id'],'name':_0x385961[_0xc29c('0x44')]['name']};}var _0x88a605=md5(JSON['stringify'](_0x587b8a));if(_0x385961[_0xc29c('0x3')]!==_0x88a605){_0x385961['md5']=_0x88a605;emit(util[_0xc29c('0x79')](_0xc29c('0x7a'),_0x587b8a[_0xc29c('0x41')]),_0xc29c('0x7b'),_0x587b8a);}}}function emitCampaignSummary(_0x4f6c95){if(_0x4f6c95[_0xc29c('0x58')]===_0xc29c('0x7c')){emit(util[_0xc29c('0x79')](_0xc29c('0x7d'),_0x4f6c95[_0xc29c('0x41')]),_0xc29c('0x7e'),_0x4f6c95);}}function checkGetDataPredictive(_0xce410d){if(isNotNull(_0xce410d)&&!_[_0xc29c('0x48')](_0xce410d)){loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x80'));loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x81'),_0xce410d[_0xc29c('0x71')]);loggerPredictive['info'](_0xc29c('0x82'),_0xce410d[_0xc29c('0x83')]);loggerPredictive[_0xc29c('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xce410d[_0xc29c('0x84')]);loggerPredictive[_0xc29c('0x7f')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xce410d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc29c('0x7f')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xce410d[_0xc29c('0x6b')]);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x85'),_0xce410d[_0xc29c('0x86')]);loggerPredictive[_0xc29c('0x7f')]('---------------------------');if(_0xce410d[_0xc29c('0x71')]>0x0){if(!_[_0xc29c('0x87')](_0xce410d[_0xc29c('0x86')])&&_0xce410d[_0xc29c('0x86')]>0x0){return!![];}loggerPredictive[_0xc29c('0x7f')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xc29c('0x87')](_0xce410d[_0xc29c('0x6b')])&&_0xce410d[_0xc29c('0x6b')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xc29c('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x88'));}return![];}function mergeDataErlangB(_0x12257c){return function(_0x5e6df3){loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x89'));loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8a'),_0x5e6df3['erlangCalls']);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8b'),_0x5e6df3[_0xc29c('0x74')]);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8c'),_0x5e6df3[_0xc29c('0x75')]);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8d'),_0x5e6df3[_0xc29c('0x76')]);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8c'),_0x5e6df3[_0xc29c('0x75')]);loggerPredictive['info'](_0xc29c('0x8e'));_[_0xc29c('0x8f')](_0x12257c,_0x5e6df3);};}function getDiff(_0x3872ec){var _0x1bcba6=moment()['milliseconds'](0x0);var _0x5b580b=moment(_0x3872ec)[_0xc29c('0x4b')](0x0);return _0x1bcba6[_0xc29c('0x4c')](_0x5b580b,'seconds');}function ifInterval(_0x2f7b10,_0x142398){if(_[_0xc29c('0x87')](_0x142398)){return![];}return getDiff(_0x142398)<_0x2f7b10*0x3c;}function freeVariablesPredictive(_0x463206){if(isNotNull(_0x463206)){if(!_['isUndefined'](_0x463206[_0xc29c('0x2a')])){_0x463206['startProgressive']=undefined;loggerPredictive['info'](_0x463206[_0xc29c('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xc29c('0x87')](_0x463206[_0xc29c('0x29')])){_0x463206['startPredictive']=undefined;loggerPredictive['info'](_0x463206['name'],_0xc29c('0x90'));}if(!_[_0xc29c('0x87')](_0x463206[_0xc29c('0x91')])){clearInterval(_0x463206[_0xc29c('0x91')]);_0x463206[_0xc29c('0x91')]=undefined;loggerPredictive[_0xc29c('0x7f')](_0x463206[_0xc29c('0x41')],_0xc29c('0x92'));}}}function erlangb(_0x139de1,_0x49a6a9){if(_0x49a6a9===0x0){return 0x0;}var _0x15c24e=0x1;for(var _0x4f0e6a=0x1;_0x4f0e6a<=_0x49a6a9;_0x4f0e6a+=0x1){_0x15c24e=0x1+_0x15c24e*_0x4f0e6a/_0x139de1;}return 0x1/_0x15c24e;}function isVoiceQueueOutbound(_0x408080){return _0x408080===_0xc29c('0x4e');}function isNotPreview(_0x1aa868){return _0x1aa868!=='preview';}function isCampaignIvr(_0x35d678){return _0x35d678===_0xc29c('0x7c');}function getCallerId(_0xf4e49b,_0x4d8137,_0x1b54f6){if(!_[_0xc29c('0x87')](_0x1b54f6)&&typeof _0x1b54f6===_0xc29c('0x93')&&!_['isEmpty'](_0x1b54f6)){if(!_[_0xc29c('0x87')](_0x4d8137)&&typeof _0x4d8137==='string'&&!_[_0xc29c('0x48')](_0x4d8137)){return util[_0xc29c('0x79')](_0xc29c('0x94'),_0x4d8137,_0x1b54f6);}return util[_0xc29c('0x79')](_0xc29c('0x94'),_0x1b54f6,_0x1b54f6);}if(!_[_0xc29c('0x87')](_0xf4e49b)&&typeof _0xf4e49b===_0xc29c('0x93')&&!_[_0xc29c('0x48')](_0xf4e49b)){return _0xf4e49b;}return _0xc29c('0x95');}function loggerCatchQueueSummary(_0x5a2ee2,_0x894f2b){return function(_0x4af53c){freeVariablesPredictive(_0x894f2b);emitVoiceQueueSummary(_0x894f2b);emitCampaignSummary(_0x894f2b);loggerSyncQueueSummary[_0xc29c('0x96')](_0x5a2ee2,util['inspect'](_0x4af53c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x472e44,_0x26ca68){return function(_0x35ff20){loggerPredictive[_0xc29c('0x96')](_0x26ca68['name'],_0x472e44);loggerPredictive[_0xc29c('0x96')](_0x35ff20[_0xc29c('0x97')]);freeVariablesPredictive(_0x26ca68);};}function loggerCatch(_0x1f3a3f){return function(_0x2e11d9){logger[_0xc29c('0x96')](_0x1f3a3f,util[_0xc29c('0x98')](_0x2e11d9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1e0b93){return _0x1e0b93&&!_[_0xc29c('0x87')](_0x1e0b93)&&_0x1e0b93['length']>0x0;}function decremetOriginate(_0x362817){if(!_[_0xc29c('0x87')](_0x362817)&&_0x362817!==null){if(typeof _0x362817[_0xc29c('0x72')]!==_0xc29c('0x99')){if(_0x362817[_0xc29c('0x72')]>0x0){_0x362817[_0xc29c('0x72')]-=0x1;}else{logger['error'](_0xc29c('0x9a'));}}}else{logger[_0xc29c('0x96')](_0xc29c('0x9b'));}}function checkContactLowerLimitOriginate(_0x2c6e72,_0x366c80,_0x234b57){if(_0x366c80>_0x234b57){for(var _0x23c93f=0x0;_0x23c93f<_0x366c80-_0x234b57;_0x23c93f+=0x1){decremetOriginate(_0x2c6e72);}}}function loggerGetContactDialer(_0x2d3dba,_0x376b52,_0x24a13){return function(_0x294cb4){checkContactLowerLimitOriginate(_0x376b52,_0x24a13,0x0);logger[_0xc29c('0x96')](_0x2d3dba,util['inspect'](_0x294cb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x16275f){return function(_0x3ba592){if(isNotNull(_0x3ba592)&&isNotNull(_0x3ba592[0x0])){if(_0x3ba592[0x0][_0xc29c('0x9c')]>0x0){_0x16275f[_0xc29c('0x40')]='RESCHEDULED_CONTACTS';logger['info'](_0xc29c('0x9d')+_0x16275f['name'],_0x3ba592[0x0][_0xc29c('0x9c')],_0xc29c('0x9e'));}else{_0x16275f['message']=_0xc29c('0x9f');logger[_0xc29c('0x7f')](_0xc29c('0xa0')+_0x16275f[_0xc29c('0x41')]);}}};}function notSendMessagesQueue(_0x31e29){if(_0x31e29[_0xc29c('0xa1')]){freeVariablesPredictive(_0x31e29);if(_0x31e29['originated']===0x0&&_0x31e29[_0xc29c('0x56')]===0x0&&_0x31e29['waiting']===0x0&&(_0x31e29['pTalking']||0x0)===0x0){_0x31e29[_0xc29c('0xa1')]=![];_0x31e29['available']=0x0;_0x31e29[_0xc29c('0x40')]=_0xc29c('0x42');loggerSyncQueueSummary[_0xc29c('0x96')](_0xc29c('0xa2'),_0x31e29['name'],'is\x20not\x20active');}else{_0x31e29['message']=_0xc29c('0xa3');loggerSyncQueueSummary[_0xc29c('0x96')](_0xc29c('0xa2'),_0x31e29[_0xc29c('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x31e29);}}function notSendMessagesCampaign(_0x33005f){if(_0x33005f[_0xc29c('0xa1')]){if(_0x33005f[_0xc29c('0x72')]===0x0){_0x33005f['sendMessageOneNotActive']=![];_0x33005f[_0xc29c('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc29c('0x96')](_0xc29c('0xa4'),_0x33005f['name'],_0xc29c('0xa5'));}else{_0x33005f[_0xc29c('0x40')]=_0xc29c('0xa3');loggerSyncQueueSummary[_0xc29c('0x96')](_0xc29c('0xa4'),_0x33005f[_0xc29c('0x41')],_0xc29c('0xa6'));}emitCampaignSummary(_0x33005f);}}function createObjHistory(_0x154d30,_0x2cb1cb,_0x1fd16f,_0x4db538,_0x58ab41){_0x154d30['message']=_0x1fd16f;var _0x5930d9=new Action(_0x154d30,_0x2cb1cb);var _0x512dd7=new History(_0x5930d9);_0x512dd7[_0xc29c('0xa7')]=_0x4db538;_0x512dd7[_0xc29c('0xa8')]=_0x58ab41;_0x512dd7[_0xc29c('0xa9')]=_0x5930d9[_0xc29c('0xaa')];return _0x512dd7;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x147748=this;setInterval(function(){_0x147748[_0xc29c('0xab')](_0x147748['uniqueId'],'[uniqueid]');_0x147748['clearZombieChannels'](_0x147748[_0xc29c('0x26')],_0xc29c('0xac'));},0x32c8);};Dialer[_0xc29c('0x1d')][_0xc29c('0xab')]=function(_0xb47551,_0xbc7ca5){var _0x13d762=this;for(var _0x32d9c7 in _0xb47551){if(typeof _0xb47551[_0x32d9c7]!==_0xc29c('0x99')){this[_0xc29c('0xad')][_0xc29c('0x1e')](function(){if(!_[_0xc29c('0xae')](_0xb47551[_0x32d9c7])){return ami[_0xc29c('0xaf')]({'action':_0xc29c('0xb0'),'channel':_0xb47551[_0x32d9c7][_0xc29c('0xb1')]})[_0xc29c('0xb2')](function(_0x363d7c){if(_0x363d7c[_0xc29c('0x40')]===_0xc29c('0xb3')){setTimeout(function(){if(_0xb47551[_0x32d9c7]&&_0xb47551[_0x32d9c7][_0xc29c('0x58')]!==_0xc29c('0x7c')){_0x13d762['updateOriginated'](_0x13d762['voiceQueues'][_0xb47551[_0x32d9c7]['queue']]);logger[_0xc29c('0x96')](_0xc29c('0xb4'),_0xbc7ca5,_0x32d9c7,_0xb47551[_0x32d9c7]['queue']);delete _0xb47551[_0x32d9c7];}if(_0xb47551[_0x32d9c7]&&_0xb47551[_0x32d9c7]['type']==='ivr'){_0x13d762[_0xc29c('0xb5')](_0x13d762['campaigns'][_0xb47551[_0x32d9c7]['queue']]);logger['error'](_0xc29c('0xb6'),_0xbc7ca5,_0x32d9c7,_0xb47551[_0x32d9c7][_0xc29c('0xb7')]);delete _0xb47551[_0x32d9c7];}},0x2328);}});}});}}};Dialer['prototype'][_0xc29c('0xb8')]=function(_0x497d36){return BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xb8')](_0x497d36))['catch'](loggerCatch(_0xc29c('0xba')));};Dialer[_0xc29c('0x1d')][_0xc29c('0xbb')]=function(_0x42e077){return BPromise[_0xc29c('0xb9')]()['then'](cmHopperBlack['checkIsBlackList'](_0x42e077))['catch'](loggerCatch(_0xc29c('0xbc')));};Dialer[_0xc29c('0x1d')]['checkIsBlackListIvr']=function(_0x4ab925){return BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](cmHopperBlack[_0xc29c('0xbd')](_0x4ab925))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xbe')));};Dialer['prototype'][_0xc29c('0xbf')]=function(_0x469c47){return BPromise['resolve']()[_0xc29c('0x3e')](cmHopperHistory[_0xc29c('0xc0')](_0x469c47))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xc1')));};Dialer['prototype'][_0xc29c('0xc2')]=function(_0x377087){return BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xc2')](_0x377087))[_0xc29c('0xb2')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xc29c('0x1d')][_0xc29c('0xc3')]=function(_0x318693,_0x4aac7b,_0x191d43){return BPromise['resolve']()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xc3')](_0x318693,_0x4aac7b,_0x191d43))['catch'](loggerCatch(_0xc29c('0xc4')));};Dialer['prototype'][_0xc29c('0xc5')]=function(_0x217608,_0x177a60,_0x368b9d,_0x253e42,_0x227232){return BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xc5')](_0x217608,_0x177a60,_0x368b9d,_0x253e42))[_0xc29c('0xb2')](function(_0x9f7ac1){_0x227232[_0xc29c('0xc6')]-=_0x368b9d;_0x227232[_0xc29c('0xc6')]=_0x227232['temp']>0x0?_0x227232[_0xc29c('0xc6')]:0x0;loggerCatch(_0xc29c('0xc7'))(_0x9f7ac1);});};Dialer['prototype'][_0xc29c('0xc8')]=function(_0x5bb2bd,_0x47f364,_0x1c2dde,_0x35c5f5){return BPromise['resolve']()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xc8')](_0x5bb2bd,_0x47f364,_0x1c2dde))[_0xc29c('0xb2')](function(_0x15ad35){_0x35c5f5[_0xc29c('0xc6')]-=_0x47f364;_0x35c5f5[_0xc29c('0xc6')]=_0x35c5f5['temp']>0x0?_0x35c5f5['temp']:0x0;loggerCatch(_0xc29c('0xc9'))(_0x15ad35);});};Dialer['prototype'][_0xc29c('0xca')]=function(_0x4dd955){return BPromise['resolve']()[_0xc29c('0x3e')](voiceQueueRt[_0xc29c('0xca')](_0x4dd955))[_0xc29c('0xb2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xc29c('0xcb')]=function(_0x3e5aea){return BPromise['resolve']()[_0xc29c('0x3e')](cmHopper[_0xc29c('0xcb')](_0x3e5aea))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xcc')));};Dialer['prototype'][_0xc29c('0xcd')]=function(_0x1dd868){return BPromise['resolve']()[_0xc29c('0x3e')](cmHopperHistory[_0xc29c('0xcd')](_0x1dd868))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xce')));};Dialer[_0xc29c('0x1d')]['updateOriginated']=function(_0x333731){if(!_['isUndefined'](_0x333731)&&_0x333731!==null){if(typeof _0x333731['originated']!==_0xc29c('0x99')){if(_0x333731[_0xc29c('0x72')]>0x0){_0x333731[_0xc29c('0x72')]-=0x1;}else{logger[_0xc29c('0x96')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc29c('0x96')](_0xc29c('0xcf'));}};Dialer['prototype']['loggerHandler']=function(_0x2a3876,_0x27b749){var _0x187fce=this;return function(_0xd3a4df){_0x187fce[_0xc29c('0xb5')](_0x27b749);logger[_0xc29c('0x96')](_0x2a3876,util[_0xc29c('0x98')](_0xd3a4df,{'showHidden':![],'depth':null}));};};Dialer[_0xc29c('0x1d')][_0xc29c('0xd0')]=function(_0x2cc23d,_0x2599a8,_0x1f5410){var _0xf866b0={'state':0x19,'statedesc':_0xc29c('0xd1')};this[_0xc29c('0xb5')](_0x2599a8);this[_0xc29c('0xd2')](_[_0xc29c('0x8f')](_0xf866b0,_[_0xc29c('0xd3')](_0x1f5410,[_0xc29c('0xd4'),_0xc29c('0xd5'),_0xc29c('0xd6'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0xc29c('0xd7'));logger[_0xc29c('0x96')](_0x2cc23d);};Dialer['prototype']['isSuccess']=function(_0x39a909){return _0x39a909===_0xc29c('0xd8');};Dialer[_0xc29c('0x1d')]['isTrunkReachable']=function(_0x4dbbf0){return!_[_0xc29c('0x87')](_0x4dbbf0)&&_0x4dbbf0&&!_[_0xc29c('0x87')](_0x4dbbf0[_0xc29c('0x41')])&&!_[_0xc29c('0x87')](_0x4dbbf0[_0xc29c('0x78')])&&_0x4dbbf0['active']&&(this[_0xc29c('0x24')][util['format'](_0xc29c('0xd9'),_0x4dbbf0[_0xc29c('0x41')])][_0xc29c('0xb0')]===_0xc29c('0xda')||this[_0xc29c('0x24')][util[_0xc29c('0x79')](_0xc29c('0xd9'),_0x4dbbf0[_0xc29c('0x41')])][_0xc29c('0xb0')]===_0xc29c('0xdb'));};Dialer['prototype'][_0xc29c('0xd2')]=function(_0x3fe2c8,_0xa1816a,_0x1d3e47){this[_0xc29c('0xcd')](_0x3fe2c8)[_0xc29c('0xb2')](loggerCatch(_0xa1816a));this[_0xc29c('0xcb')](_0x3fe2c8)[_0xc29c('0xb2')](loggerCatch(_0x1d3e47));};Dialer[_0xc29c('0x1d')]['syncVarSet']=function(_0x20730a){var _0x7f5123=this[_0xc29c('0xdc')][_0x20730a['uniqueid']];var _0xf1e1ec;if(!_[_0xc29c('0xae')](_0x20730a)&&!_[_0xc29c('0xae')](_0x20730a[_0xc29c('0xdd')])&&!_[_0xc29c('0xae')](_0x20730a[_0xc29c('0xdd')]['amdstatus'])&&_0x20730a[_0xc29c('0xde')]===_0xc29c('0xdf')&&_0x7f5123){if(_0x7f5123['type']!==_0xc29c('0x7c')&&this[_0xc29c('0x21')][_0x7f5123['queue']][_0xc29c('0xe0')]&&_0x20730a[_0xc29c('0xe1')]===_0xc29c('0xe2')){delete this[_0xc29c('0xdc')][_0x20730a[_0xc29c('0xe3')]];this[_0xc29c('0xb5')](this[_0xc29c('0x21')][_0x7f5123[_0xc29c('0xb7')]]);this['voiceQueues'][_0x7f5123[_0xc29c('0xb7')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x7f5123[_0xc29c('0xb7')]][_0xc29c('0x60')]+=0x1;_0xf1e1ec=new Hangup(_0x7f5123,_0x20730a);_0xf1e1ec['state']=0x12;_0xf1e1ec[_0xc29c('0xa8')]='HangupInAMD';_0xf1e1ec[_0xc29c('0xe4')]=_0xc29c('0xe5');ami[_0xc29c('0x4d')](_0xc29c('0xe6'),ut[_0xc29c('0xe7')](_0xf1e1ec,'amd'));this[_0xc29c('0xd2')](_0xf1e1ec,_0xc29c('0xe8'),'[syncHangupInAMD]');}if(_0x7f5123[_0xc29c('0x58')]!==_0xc29c('0x7c')&&this[_0xc29c('0x21')][_0x7f5123['queue']][_0xc29c('0xe0')]&&_0x20730a[_0xc29c('0xe1')]==='MACHINE'){var _0x3658e4=this;return new BPromise(function(_0x25db62,_0x1727a9){delete _0x3658e4[_0xc29c('0xdc')][_0x20730a[_0xc29c('0xe3')]];_0x3658e4[_0xc29c('0xb5')](_0x3658e4['voiceQueues'][_0x7f5123['queue']]);_0x3658e4['voiceQueues'][_0x7f5123[_0xc29c('0xb7')]][_0xc29c('0x61')]+=0x1;_0x3658e4['voiceQueues'][_0x7f5123[_0xc29c('0xb7')]][_0xc29c('0x60')]+=0x1;var _0x2a7dc3=_0x3658e4[_0xc29c('0x21')][_0x7f5123[_0xc29c('0xb7')]];var _0x56da03=new Hangup(_0x7f5123,_0x20730a);_0x56da03[_0xc29c('0xa7')]=0x13;_0x56da03[_0xc29c('0xa8')]='Machine';_0x56da03[_0xc29c('0xe4')]=_0xc29c('0xe5');_0x56da03[_0xc29c('0xe9')]+=0x1;_0x56da03['countglobal']+=0x1;_0x56da03[_0xc29c('0xea')]=!![];ami[_0xc29c('0x4d')](_0xc29c('0xe6'),ut['buildObj'](_0x56da03,_0xc29c('0xea')));_0x3658e4['createHistory'](_0x56da03)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xeb')));if(_0x56da03[_0xc29c('0xec')]+_0x56da03['countcongestionretry']+_0x56da03[_0xc29c('0xed')]+_0x56da03[_0xc29c('0xee')]+_0x56da03['countdropretry']+_0x56da03[_0xc29c('0xef')]+_0x56da03[_0xc29c('0xe9')]+_0x56da03['countagentrejectretry']>=_0x2a7dc3[_0xc29c('0xf0')]){_0x3658e4[_0xc29c('0xf1')](_0x56da03,_0x25db62,_0x1727a9,'reason19\x20machine....');}else{if(_0x56da03['countmachineretry']>=_0x2a7dc3[_0xc29c('0xf2')]){_0x3658e4[_0xc29c('0xf3')](_0x56da03,_0x25db62,_0x1727a9,'reason\x2019\x20machine....');}else{_0x3658e4[_0xc29c('0xc2')]({'active':![],'countmachineretry':_0x56da03[_0xc29c('0xe9')],'scheduledat':moment()[_0xc29c('0xf4')](_0x2a7dc3[_0xc29c('0xf5')],_0xc29c('0xf6'))[_0xc29c('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x56da03[_0xc29c('0xd4')],'ListId':_0x56da03['ListId'],'VoiceQueueId':_0x56da03[_0xc29c('0xf7')]||undefined,'CampaignId':_0x56da03[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xf9')));_0x25db62({'reschedule':0x1});}}});}if(_0x7f5123[_0xc29c('0x58')]===_0xc29c('0x7c')&&this[_0xc29c('0x22')][_0x7f5123[_0xc29c('0xb7')]][_0xc29c('0xe0')]&&_0x20730a['value']===_0xc29c('0xe2')){delete this['uniqueId'][_0x20730a[_0xc29c('0xe3')]];this[_0xc29c('0xb5')](this[_0xc29c('0x22')][_0x7f5123[_0xc29c('0xb7')]]);_0xf1e1ec=new Hangup(_0x7f5123,_0x20730a);_0xf1e1ec['state']=0x12;_0xf1e1ec[_0xc29c('0xa8')]=_0xc29c('0xfa');_0xf1e1ec[_0xc29c('0xe4')]=_0xc29c('0xe5');ami[_0xc29c('0x4d')](_0xc29c('0xe6'),ut[_0xc29c('0xe7')](_0xf1e1ec,'amd'));this[_0xc29c('0xd2')](_0xf1e1ec,_0xc29c('0xfb'),_0xc29c('0xfc'));}if(_0x7f5123['type']===_0xc29c('0x7c')&&this[_0xc29c('0x22')][_0x7f5123[_0xc29c('0xb7')]]['dialAMDActive']&&_0x20730a[_0xc29c('0xe1')]===_0xc29c('0xfd')){var _0x3658e4=this;return new BPromise(function(_0x5d12a9,_0x34f73a){delete _0x3658e4[_0xc29c('0xdc')][_0x20730a[_0xc29c('0xe3')]];_0x3658e4['updateOriginated'](_0x3658e4[_0xc29c('0x22')][_0x7f5123['queue']]);_0x3658e4['campaigns'][_0x7f5123[_0xc29c('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x3658e4[_0xc29c('0x22')][_0x7f5123[_0xc29c('0xb7')]][_0xc29c('0x60')]+=0x1;var _0x4e4589=_0x3658e4['campaigns'][_0x7f5123[_0xc29c('0xb7')]];var _0x47780b=new Hangup(_0x7f5123,_0x20730a);_0x47780b[_0xc29c('0xa7')]=0x13;_0x47780b[_0xc29c('0xa8')]=_0xc29c('0xfe');_0x47780b[_0xc29c('0xe4')]=_0xc29c('0xe5');_0x47780b[_0xc29c('0xe9')]+=0x1;_0x47780b[_0xc29c('0xff')]+=0x1;_0x47780b['amd']=!![];ami['emit']('custom:amd',ut[_0xc29c('0xe7')](_0x47780b,'amd'));_0x3658e4['createHistory'](_0x47780b)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xeb')));if(_0x47780b[_0xc29c('0xec')]+_0x47780b[_0xc29c('0x100')]+_0x47780b['countnoanswerretry']+_0x47780b[_0xc29c('0xee')]+_0x47780b[_0xc29c('0x101')]+_0x47780b[_0xc29c('0xef')]+_0x47780b[_0xc29c('0xe9')]+_0x47780b[_0xc29c('0x102')]>=_0x4e4589[_0xc29c('0xf0')]){_0x3658e4[_0xc29c('0xf1')](_0x47780b,_0x5d12a9,_0x34f73a,'reason19\x20machine....');}else{if(_0x47780b['countmachineretry']>=_0x4e4589[_0xc29c('0xf2')]){_0x3658e4[_0xc29c('0xf3')](_0x47780b,_0x5d12a9,_0x34f73a,_0xc29c('0x103'));}else{_0x3658e4[_0xc29c('0xc2')]({'active':![],'countmachineretry':_0x47780b[_0xc29c('0xe9')],'scheduledat':moment()[_0xc29c('0xf4')](_0x4e4589['dialMachineRetryFrequency'],_0xc29c('0xf6'))[_0xc29c('0x79')](_0xc29c('0x104')),'ContactId':_0x47780b[_0xc29c('0xd4')],'ListId':_0x47780b['ListId'],'VoiceQueueId':_0x47780b[_0xc29c('0xf7')]||undefined,'CampaignId':_0x47780b[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xf9')));_0x5d12a9({'reschedule':0x1});}}});}}};Dialer[_0xc29c('0x1d')][_0xc29c('0x34')]=function(_0x365bdb){var _0x1727dd=this['uniqueId'][_0x365bdb['uniqueid']];var _0x2aed3c=this;var _0x214a0d;if(_0x1727dd&&_0x1727dd[_0xc29c('0x58')]===_0xc29c('0x7c')){delete this[_0xc29c('0xdc')][_0x365bdb[_0xc29c('0xe3')]];this[_0xc29c('0xb5')](this[_0xc29c('0x22')][_0x1727dd[_0xc29c('0xb7')]]);this[_0xc29c('0x22')][_0x1727dd[_0xc29c('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x214a0d=new Hangup(_0x1727dd,_0x365bdb);this[_0xc29c('0xcd')](_0x214a0d)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x105')));this[_0xc29c('0xcb')](_0x214a0d)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x106')));}if(_0x1727dd&&_0x1727dd[_0xc29c('0x58')]!==_0xc29c('0x7c')&&isNotNull(this[_0xc29c('0x21')][_0x1727dd[_0xc29c('0xb7')]][_0xc29c('0x107')])){delete this[_0xc29c('0xdc')][_0x365bdb[_0xc29c('0xe3')]];this['updateOriginated'](this[_0xc29c('0x21')][_0x1727dd['queue']]);this[_0xc29c('0x21')][_0x1727dd[_0xc29c('0xb7')]][_0xc29c('0x61')]+=0x1;this['voiceQueues'][_0x1727dd[_0xc29c('0xb7')]][_0xc29c('0x60')]+=0x1;_0x214a0d=new Hangup(_0x1727dd,_0x365bdb);_0x214a0d[_0xc29c('0xa7')]=0x10;_0x214a0d[_0xc29c('0xa8')]=_0xc29c('0x108');_0x214a0d[_0xc29c('0xe4')]=_0xc29c('0x109');this[_0xc29c('0xcd')](_0x214a0d)['catch'](loggerCatch(_0xc29c('0x105')));this[_0xc29c('0xcb')](_0x214a0d)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x106')));}if(_0x1727dd&&_0x1727dd[_0xc29c('0x58')]!=='ivr'&&!isNotNull(this[_0xc29c('0x21')][_0x1727dd[_0xc29c('0xb7')]][_0xc29c('0x107')])){delete this['uniqueId'][_0x365bdb[_0xc29c('0xe3')]];this[_0xc29c('0xb5')](this[_0xc29c('0x21')][_0x1727dd['queue']]);this[_0xc29c('0x21')][_0x1727dd[_0xc29c('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x214a0d=new Hangup(_0x1727dd,_0x365bdb);_0x214a0d['state']=0xc;_0x214a0d[_0xc29c('0xa8')]=_0x365bdb[_0xc29c('0x10a')];_0x214a0d[_0xc29c('0xe4')]='Unknow';this[_0xc29c('0xcd')](_0x214a0d)['catch'](loggerCatch(_0xc29c('0x105')));this[_0xc29c('0xcb')](_0x214a0d)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x106')));}};Dialer[_0xc29c('0x1d')][_0xc29c('0x10b')]=function(_0x4c3c79){var _0x8d7cf3=this[_0xc29c('0xdc')][_0x4c3c79[_0xc29c('0xe3')]];var _0x59a800=this;if(this[_0xc29c('0x21')][_0x4c3c79['queue']]){if(_0x8d7cf3&&_0x8d7cf3['type']!==_0xc29c('0x7c')){delete this[_0xc29c('0xdc')][_0x4c3c79['uniqueid']];this[_0xc29c('0x21')][_0x4c3c79[_0xc29c('0xb7')]][_0xc29c('0x61')]+=0x1;var _0x2e95d0=new AgentComplete(_0x8d7cf3,_0x4c3c79);if(_0x4c3c79[_0xc29c('0x10c')]==='agent'){_0x2e95d0[_0xc29c('0x10d')]=this[_0xc29c('0x21')][_0x4c3c79['queue']]['dialQueueProject2']&&this[_0xc29c('0x21')][_0x4c3c79[_0xc29c('0xb7')]][_0xc29c('0x10e')]?moment()[_0xc29c('0x79')](_0xc29c('0x104')):undefined;}this[_0xc29c('0xcd')](_0x2e95d0)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x10f')));this['moveContactManagedDialer'](_0x2e95d0)[_0xc29c('0xb2')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xc29c('0x2c')]=function(_0x5b74e8){if(this['voiceQueues'][_0x5b74e8[_0xc29c('0xb7')]]){if(this[_0xc29c('0xdc')][_0x5b74e8[_0xc29c('0xe3')]]&&this['uniqueId'][_0x5b74e8[_0xc29c('0xe3')]][_0xc29c('0x58')]!==_0xc29c('0x7c')){this[_0xc29c('0xb5')](this[_0xc29c('0x21')][_0x5b74e8[_0xc29c('0xb7')]]);this['uniqueId'][_0x5b74e8[_0xc29c('0xe3')]][_0xc29c('0x110')]=moment()[_0xc29c('0x79')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xc29c('0x1d')][_0xc29c('0x111')]=function(_0x1a7267){this['createHistory'](_0x1a7267)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x10f')));this[_0xc29c('0xcb')](_0x1a7267)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x112')));};Dialer['prototype'][_0xc29c('0x2e')]=function(_0x7cd125){var _0x4bdaff=this['uniqueId'][_0x7cd125[_0xc29c('0xe3')]];var _0x18b500=this;if(this[_0xc29c('0x21')][_0x7cd125['queue']]){if(_0x4bdaff&&_0x4bdaff['type']!=='ivr'){delete this[_0xc29c('0xdc')][_0x7cd125[_0xc29c('0xe3')]];this[_0xc29c('0xb5')](this['voiceQueues'][_0x7cd125[_0xc29c('0xb7')]]);_0x4bdaff[_0xc29c('0x113')]=moment()[_0xc29c('0x79')](_0xc29c('0x104'));var _0x203245=new QueueCallerAbandon(_0x4bdaff,_0x7cd125);if(getSeconds(_0x4bdaff['droptime'],_0x4bdaff['responsetime'])>=_0x4bdaff['dialQueueTimeout']){this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]][_0xc29c('0x84')]+=0x1;this[_0xc29c('0x21')][_0x7cd125['queue']][_0xc29c('0x66')]+=0x1;this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]][_0xc29c('0x6d')]+=0x1;_0x203245[_0xc29c('0xa7')]=0xa;_0x203245[_0xc29c('0xa8')]=_0xc29c('0x114');_0x203245[_0xc29c('0x115')]=_0xc29c('0x116');_0x203245[_0xc29c('0x10d')]=this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]]['dialQueueProject2']?moment()[_0xc29c('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x203245[_0xc29c('0x101')]+=0x1;_0x203245[_0xc29c('0xff')]+=0x1;if(_0x203245[_0xc29c('0x101')]>=this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]]['dialDropMaxRetry']){this[_0xc29c('0x111')](_0x203245);}else{this[_0xc29c('0xc2')]({'active':![],'countdropretry':_0x203245[_0xc29c('0x101')],'scheduledat':moment()[_0xc29c('0xf4')](this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]]['dialDropRetryFrequency'],'minutes')[_0xc29c('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bdaff[_0xc29c('0xd4')],'ListId':_0x4bdaff[_0xc29c('0xd5')],'VoiceQueueId':_0x4bdaff['VoiceQueueId']||undefined,'CampaignId':_0x4bdaff['CampaignId']||undefined})[_0xc29c('0xb2')](loggerCatch('[rescheduleContact][Drop]'));var _0x37a8ec=new History(_0x203245);_0x37a8ec[_0xc29c('0xa7')]=0xa;_0x37a8ec[_0xc29c('0xa8')]='Drop';_0x37a8ec['starttime']=moment()[_0xc29c('0x79')](_0xc29c('0x104'));_0x37a8ec['endtime']=_0x37a8ec[_0xc29c('0xaa')];_0x37a8ec['calleridname']=_0x203245['calleridname'];_0x37a8ec[_0xc29c('0x117')]=_0x203245[_0xc29c('0x117')];this[_0xc29c('0xcd')](_0x37a8ec)[_0xc29c('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x7cd125[_0xc29c('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x203245[_0xc29c('0xa7')]=0xb;_0x203245[_0xc29c('0xa8')]=_0xc29c('0x118');_0x203245[_0xc29c('0x115')]='CALLEREXIT';_0x203245[_0xc29c('0xef')]+=0x1;_0x203245[_0xc29c('0xff')]+=0x1;if(_0x203245[_0xc29c('0xef')]>=this[_0xc29c('0x21')][_0x7cd125[_0xc29c('0xb7')]][_0xc29c('0x119')]){this[_0xc29c('0x111')](_0x203245);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x203245[_0xc29c('0xef')],'scheduledat':moment()[_0xc29c('0xf4')](this['voiceQueues'][_0x7cd125[_0xc29c('0xb7')]][_0xc29c('0x11a')],'minutes')[_0xc29c('0x79')](_0xc29c('0x104')),'ContactId':_0x4bdaff[_0xc29c('0xd4')],'ListId':_0x4bdaff['ListId'],'VoiceQueueId':_0x4bdaff[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4bdaff[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x11b')));var _0x37a8ec=new History(_0x203245);_0x37a8ec[_0xc29c('0xa7')]=0xb;_0x37a8ec[_0xc29c('0xa8')]=_0xc29c('0x118');_0x37a8ec[_0xc29c('0xaa')]=moment()['format'](_0xc29c('0x104'));_0x37a8ec[_0xc29c('0xa9')]=_0x37a8ec['starttime'];_0x37a8ec[_0xc29c('0x11c')]=_0x203245[_0xc29c('0x11c')];_0x37a8ec[_0xc29c('0x117')]=_0x203245[_0xc29c('0x117')];this[_0xc29c('0xcd')](_0x37a8ec)['catch'](loggerCatch(_0xc29c('0x11d')));}}}}};Dialer[_0xc29c('0x1d')][_0xc29c('0x36')]=function(_0x5497d6){if(this[_0xc29c('0x26')][_0x5497d6[_0xc29c('0xe3')]]){this[_0xc29c('0x26')][_0x5497d6[_0xc29c('0xe3')]][_0xc29c('0xb1')]=_0x5497d6[_0xc29c('0xb1')];}if(this[_0xc29c('0xdc')][_0x5497d6[_0xc29c('0xe3')]]){this[_0xc29c('0xdc')][_0x5497d6[_0xc29c('0xe3')]]['channel']=_0x5497d6[_0xc29c('0xb1')];}};Dialer['prototype']['syncQueueMember']=function(_0x24a823){if(strategy[this[_0xc29c('0x21')][this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]][_0xc29c('0xb7')]][_0xc29c('0x4f')]]===_0xc29c('0x11f')){if(this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]]&&_[_0xc29c('0xae')](this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]][_0xc29c('0x120')])&&_0x24a823[_0xc29c('0xb0')]==='1'&&_0x24a823[_0xc29c('0x121')]==='0'){if(this['agents'][_0x24a823[_0xc29c('0x122')]]){if(!this[_0xc29c('0x23')][_0x24a823['stateinterface']][_0xc29c('0x120')]){this[_0xc29c('0x23')][_0x24a823[_0xc29c('0x122')]]['locked']=!![];this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]][_0xc29c('0x120')]=!![];this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]]['stateinterface']=_0x24a823[_0xc29c('0x122')];}}}}else if((strategy[this[_0xc29c('0x21')][this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]]['queue']]['strategy']]||_0xc29c('0x1c'))===_0xc29c('0x1c')){if(this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]]){if(this[_0xc29c('0x23')][_0x24a823['stateinterface']]){this[_0xc29c('0x26')][_0x24a823['actionid']][_0xc29c('0x122')]=_0x24a823[_0xc29c('0x122')];if(_[_0xc29c('0xae')](this[_0xc29c('0x2b')][this['actions'][_0x24a823[_0xc29c('0x11e')]]['queue']])){this[_0xc29c('0x2b')][this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]][_0xc29c('0xb7')]]=[];}this[_0xc29c('0x2b')][this[_0xc29c('0x26')][_0x24a823[_0xc29c('0x11e')]]['queue']][_0xc29c('0x123')](_[_0xc29c('0x8f')](_[_0xc29c('0xd3')](this[_0xc29c('0x26')][_0x24a823['actionid']],[_0xc29c('0x124'),_0xc29c('0x122')]),{'status':_0x24a823[_0xc29c('0xb0')],'paused':_0x24a823[_0xc29c('0x121')]}));}}}};function unlockQueueStatus(_0x55dc69,_0x582472){setTimeout(function(){if(_['isUndefined'](_0x55dc69[_0xc29c('0x125')])){loggerBooked[_0xc29c('0x96')](_0xc29c('0x126'),_0x582472);}_0x55dc69[_0xc29c('0x125')]=!![];loggerBooked[_0xc29c('0x7f')](_0xc29c('0x127'),_0x582472,JSON[_0xc29c('0x4a')](_[_0xc29c('0xd3')](_0x55dc69,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0xc29c('0x1d')][_0xc29c('0x3a')]=function(_0x2849c2){var _0x29d6be=this;var _0x70f15e=_0x29d6be['voiceQueues'][_0x29d6be['actions'][_0x2849c2[_0xc29c('0x11e')]]['queue']];if(strategy[this[_0xc29c('0x21')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]][_0xc29c('0x4f')]]===_0xc29c('0x11f')){if(this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]&&this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]['stateinterface']){this[_0xc29c('0x128')]['run'](this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0x124')],this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0x122')])['catch'](function(_0x2783bf){logger[_0xc29c('0x96')](_0xc29c('0x129'),util[_0xc29c('0x98')](_0x2783bf,{'showHidden':![],'depth':null}));})[_0xc29c('0x20')](function(){_0x29d6be[_0xc29c('0xb5')](_0x29d6be['voiceQueues'][_0x29d6be[_0xc29c('0x26')][_0x2849c2['actionid']][_0xc29c('0xb7')]]);_0x29d6be[_0xc29c('0x23')][_0x29d6be['actions'][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0x122')]][_0xc29c('0x120')]=![];delete _0x29d6be[_0xc29c('0x26')][_0x2849c2['actionid']];unlockQueueStatus(_0x70f15e);});}else{this[_0xc29c('0xb5')](this[_0xc29c('0x21')][this['actions'][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]]);this[_0xc29c('0xc2')]({'active':![],'ContactId':this['actions'][_0x2849c2['actionid']]['ContactId'],'ListId':this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xd5')],'VoiceQueueId':this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]['CampaignId']||undefined})[_0xc29c('0xb2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]];unlockQueueStatus(_0x70f15e);}}else if((strategy[this[_0xc29c('0x21')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]][_0xc29c('0x4f')]]||_0xc29c('0x1c'))===_0xc29c('0x1c')){var _0x1646e2;if(this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]&&!_[_0xc29c('0x48')](this['queueBooked'][this[_0xc29c('0x26')][_0x2849c2['actionid']][_0xc29c('0xb7')]])){if(this[_0xc29c('0x12a')][_0x29d6be[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]]){this['queueBookedRR'][_0x29d6be['actions'][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]]=this[_0xc29c('0x12a')][this[_0xc29c('0x26')][_0x2849c2['actionid']]['queue']]?this[_0xc29c('0x12a')][this[_0xc29c('0x26')][_0x2849c2['actionid']][_0xc29c('0xb7')]]:this[_0xc29c('0x2b')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]]['queue']]?this[_0xc29c('0x2b')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]][_0xc29c('0x12b')]||0x0:0x0;}this[_0xc29c('0x2b')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]]['_rr']=this[_0xc29c('0x12a')][this[_0xc29c('0x26')][_0x2849c2[_0xc29c('0x11e')]][_0xc29c('0xb7')]];for(var _0x29943b=0x0;_0x29943b=0x0;})[_0xc29c('0xb2')](myreject(_0xf5155a)));}}else{_0x33c094[_0xc29c('0x123')](ami[_0xc29c('0xaf')]({'action':_0xc29c('0x144'),'command':util[_0xc29c('0x79')]('iftime\x20%s,%s',_0x30c984,!_[_0xc29c('0x87')](config[_0xc29c('0x13f')][_0x8a917c])?_0x8a917c:'')})['then'](function(_0x4aed64){return _0x4aed64['content'][_0xc29c('0x148')]('true')>=0x0;})[_0xc29c('0xb2')](myreject(_0xf5155a)));}BPromise['all'](_0x33c094)[_0xc29c('0x3e')](function(_0x3681d1){var _0x32d8c4=_[_0xc29c('0x14a')](_0x3681d1);if(_0x32d8c4){return _0x2c4d7f(_0x32d8c4);}else{_0x4019e4[_0xc29c('0x40')]=_0x28d939?_0xc29c('0x14b'):_0xc29c('0x14c');return _0xf5155a(msgResponse('[ifTime][promiseAll]',_0xc29c('0x13e'),_0xc29c('0x14d')+_0x28d939+'\x20'+_0x2c5b43+_0xc29c('0x14e')+util[_0xc29c('0x98')](_0x30c984,{'showHidden':![],'depth':null})+_0xc29c('0x14f')+_0x8a917c));}})['catch'](function(_0x388293){return _0xf5155a(msgResponse(_0xc29c('0x13c'),'Failure',JSON['stringify'](_0x388293)));});});};Dialer[_0xc29c('0x1d')][_0xc29c('0x150')]=function(_0x5290b8){var _0x19c927=this;return function(){switch(_0x5290b8[_0xc29c('0x5d')]){case _0xc29c('0x151'):freeVariablesPredictive(_0x5290b8);_0x19c927[_0xc29c('0x152')](_0x5290b8,0x1);break;case'power':freeVariablesPredictive(_0x5290b8);_0x19c927[_0xc29c('0x152')](_0x5290b8,_0x5290b8[_0xc29c('0x153')]);break;case'predictive':_0x19c927['predictive'](_0x5290b8);break;case _0xc29c('0x8'):freeVariablesPredictive(_0x5290b8);_0x19c927[_0xc29c('0x152')](_0x5290b8,0x1);break;default:freeVariablesPredictive(_0x5290b8);logger[_0xc29c('0x96')](_0xc29c('0x154'),_0x5290b8['name'],_0xc29c('0x155'));}};};Dialer[_0xc29c('0x1d')][_0xc29c('0x156')]=function(_0x215822){return BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](cmHopper[_0xc29c('0x157')](_0x215822['id'],previewRecallmeReminderInterval))[_0xc29c('0x3e')](function(_0x32e635){for(var _0x15b4b9=0x0;_0x15b4b9<_0x32e635[_0xc29c('0x143')];_0x15b4b9++){var _0x327332=_0x32e635[_0x15b4b9]['Agent'][_0xc29c('0x41')];if(_0x327332)io['to'](util['format'](_0xc29c('0x158'),_0x327332))['emit'](_0xc29c('0x159'),{'hopper':_0x32e635[_0x15b4b9]});}})[_0xc29c('0xb2')](function(_0x5e668b){});};Dialer[_0xc29c('0x1d')][_0xc29c('0x15a')]=function(_0x29f449){var _0x52aa4a=this;return function(){_0x52aa4a[_0xc29c('0x15b')](_0x29f449);};};Dialer[_0xc29c('0x1d')][_0xc29c('0xb')]=function(_0x144346){var _0x4f281a=this;if(isNotPreview(_0x144346[_0xc29c('0x5d')])){if(isVoiceQueueOutbound(_0x144346[_0xc29c('0x58')])&&isActive(_0x144346[_0xc29c('0x5c')])){_0x144346['sendMessageOneNotActive']=!![];BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](checkIsLoggedIn(_0x144346,_0x144346[_0xc29c('0x52')]))[_0xc29c('0x3e')](checkIsActive(_0x144346,_0x144346[_0xc29c('0x5c')]))[_0xc29c('0x3e')](checkInterval(_0x144346))[_0xc29c('0x3e')](_0x4f281a[_0xc29c('0x136')](_0x144346))[_0xc29c('0x3e')](_0x4f281a['checkIfTime'](_0x144346['dialGlobalInterval'],_0x144346['dialTimezone'],_0x144346[_0xc29c('0x41')],_0x144346))[_0xc29c('0x3e')](_0x4f281a[_0xc29c('0x13d')](_0x144346['Interval'],_0x144346[_0xc29c('0x15c')],_0x144346[_0xc29c('0x41')],_0x144346))['then'](_0x4f281a['checkDialMethod'](_0x144346))[_0xc29c('0xb2')](loggerCatchQueueSummary(_0xc29c('0x15d'),_0x144346));}else{notSendMessagesQueue(_0x144346);}}else{freeVariablesPredictive(_0x144346);if(_0x144346[_0xc29c('0x15e')]){_0x4f281a[_0xc29c('0x156')](_0x144346);}}};Dialer[_0xc29c('0x1d')]['syncCampaigns']=function(){var _0x5393d2=this;var _0x42e689;for(var _0x494cea in this[_0xc29c('0x22')]){if(typeof this[_0xc29c('0x22')][_0x494cea]!==_0xc29c('0x99')){_0x42e689=this[_0xc29c('0x22')][_0x494cea];if(isCampaignIvr(_0x42e689[_0xc29c('0x58')])&&isActive(_0x42e689[_0xc29c('0x78')])){_0x42e689['sendMessageOneNotActive']=!![];BPromise[_0xc29c('0xb9')]()[_0xc29c('0x3e')](checkIsActive(_0x42e689,_0x42e689[_0xc29c('0x78')]))[_0xc29c('0x3e')](checkInterval(_0x42e689))[_0xc29c('0x3e')](_0x5393d2[_0xc29c('0x136')](_0x42e689))[_0xc29c('0x3e')](_0x5393d2[_0xc29c('0x13b')](_0x42e689[_0xc29c('0x15f')],_0x42e689[_0xc29c('0x15c')],_0x42e689[_0xc29c('0x41')],_0x42e689))[_0xc29c('0x3e')](_0x5393d2['checkIfTimeIntervals'](_0x42e689[_0xc29c('0x44')],_0x42e689[_0xc29c('0x15c')],_0x42e689['name'],_0x42e689))[_0xc29c('0x3e')](_0x5393d2[_0xc29c('0x15a')](_0x42e689))[_0xc29c('0xb2')](loggerCatchQueueSummary(_0xc29c('0x160'),_0x42e689));}else{notSendMessagesCampaign(_0x42e689);}}}};function getCallerIdRandom(_0x5dadbd,_0x1d4645){var _0x5c2460;var _0x2d16aa;var _0x4a2986;if(_0x1d4645<=0x0){_0x1d4645=0x1;}_0x5c2460=new RegExp(_0xc29c('0x161')+_0x1d4645+'}$');_0x2d16aa=Math['pow'](0xa,_0x1d4645-0x1);_0x4a2986=Math['pow'](0xa,_0x1d4645)-0x1;return util[_0xc29c('0x79')]('%s',_[_0xc29c('0x162')](_0x5dadbd,_0x5c2460,_[_0xc29c('0x163')](_0x2d16aa,_0x4a2986)));}function extractCalleridName(_0x372711){var _0x5cc477=_0x372711[_0xc29c('0x164')](/"(.*?)"/);return _0x5cc477?_0x5cc477[0x1]:_0x372711;}function extractCalleridNumber(_0x493774){var _0x16e581=_0x493774[_0xc29c('0x164')](/<(.*?)>/);return _0x16e581?_0x16e581[0x1]:_0x493774;}Dialer['prototype'][_0xc29c('0x165')]=function(_0x2ba204,_0x16d68f){var _0x5cfb5c=this;var _0x55bb7b=uuid['v4']();this[_0xc29c('0x26')][_0x55bb7b]=new Action(_0x2ba204,_0x16d68f,_0x55bb7b);return new BPromise(function(_0x451bbe,_0x109a70){if(_['isUndefined'](_0x2ba204)&&typeof _0x2ba204!=='object'){return _0x109a70(msgResponse(_0xc29c('0x166'),'Failure',_0xc29c('0x167')));}if(_['isUndefined'](_0x16d68f['Contact'][_0xc29c('0x168')])||_0x16d68f[_0xc29c('0x169')][_0xc29c('0x168')]===null){return _0x109a70(msgResponse(_0xc29c('0x166'),_0xc29c('0x13e'),_0xc29c('0x16a')));}var _0x1131bd={'XMD-CALLERID':_0x5cfb5c[_0xc29c('0x26')][_0x55bb7b][_0xc29c('0x16b')](),'XMD-AGI':_0x2ba204['dialQueueProject']?util[_0xc29c('0x79')](_0xc29c('0x16c'),ipAgi,_0x2ba204['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x2ba204[_0xc29c('0x16d')]?util[_0xc29c('0x79')](_0xc29c('0x16c'),ipAgi,_0x2ba204[_0xc29c('0x16d')]):'NONE','XMD-QUEUE':_0x2ba204[_0xc29c('0x58')]===_0xc29c('0x4e')?util[_0xc29c('0x79')](_0xc29c('0x16e'),_0x2ba204[_0xc29c('0x41')],_0x2ba204[_0xc29c('0x16f')]||'',_0x2ba204[_0xc29c('0x10e')]?'c':'',_0x2ba204[_0xc29c('0x170')]||0x3):'NONE','XMD-CONTACTID':_0x16d68f[_0xc29c('0xd4')],'XMD-CDRTYPE':_0xc29c('0x171'),'CALLERID(all)':_0x5cfb5c['actions'][_0x55bb7b][_0xc29c('0x16b')](),'XMD-AMD':_0x2ba204[_0xc29c('0xe0')]?_0xc29c('0x172'):_0xc29c('0x173'),'XMD-DESTINATION':_0xc29c('0xdf')};if(_0x2ba204[_0xc29c('0xe0')]){_0x1131bd[_0xc29c('0x174')]=_0x2ba204[_0xc29c('0x175')]||0x9c4;_0x1131bd[_0xc29c('0x176')]=_0x2ba204[_0xc29c('0x177')]||0x5dc;_0x1131bd['XMD-AMDAFTERGREETINGSILENCE']=_0x2ba204[_0xc29c('0x178')]||0x320;_0x1131bd['XMD-AMDTOTALANALYSISTIME']=_0x2ba204[_0xc29c('0x179')]||0x1388;_0x1131bd[_0xc29c('0x17a')]=_0x2ba204[_0xc29c('0x17b')]||0x64;_0x1131bd[_0xc29c('0x17c')]=_0x2ba204['dialAMDBetweenWordsSilence']||0x32;_0x1131bd[_0xc29c('0x17d')]=_0x2ba204[_0xc29c('0x17e')]||0x3;_0x1131bd[_0xc29c('0x17f')]=_0x2ba204[_0xc29c('0x180')]||0x100;_0x1131bd[_0xc29c('0x181')]=_0x2ba204[_0xc29c('0x182')]||0x1388;}if(_0x2ba204[_0xc29c('0x58')]===_0xc29c('0x4e')){_0x1131bd['XMD-VOICEQUEUEID']=_0x16d68f['VoiceQueueId'];}else{_0x1131bd[_0xc29c('0x183')]=_0x16d68f['CampaignId'];}for(var _0x9d9f90 in _0x16d68f['Contact']){if(typeof _0x16d68f[_0xc29c('0x169')][_0x9d9f90]!==_0xc29c('0x99')){if(isNotNull(_0x16d68f[_0xc29c('0x169')][_0x9d9f90])&&_0x9d9f90!=='id'&&_0x9d9f90!==_0xc29c('0x184')&&_0x9d9f90!=='createdAt'&&_0x9d9f90!==_0xc29c('0x185')){_0x1131bd[util[_0xc29c('0x79')](_0xc29c('0x186'),_0xc29c('0x187'),_[_0xc29c('0x188')](_0x9d9f90))]=_0x16d68f[_0xc29c('0x169')][_0x9d9f90];}}}var _0x59d959=_0x5cfb5c['isTrunkReachable'](_0x2ba204[_0xc29c('0x77')])?getCallerId(_0x2ba204['Trunk'][_0xc29c('0x189')],_0x2ba204['dialOriginateCallerIdName'],_0x2ba204['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2ba204[_0xc29c('0x18a')],_0x2ba204[_0xc29c('0x18b')]):_0x2ba204['dialOriginateCallerIdNumber']):getCallerId(_[_0xc29c('0xae')](_0x2ba204[_0xc29c('0x138')])?_0x2ba204[_0xc29c('0x77')][_0xc29c('0x189')]:_0x2ba204['TrunkBackup']['callerid'],_0x2ba204['dialOriginateCallerIdName'],_0x2ba204[_0xc29c('0x18b')]>0x0?getCallerIdRandom(_0x2ba204[_0xc29c('0x18a')],_0x2ba204[_0xc29c('0x18b')]):_0x2ba204[_0xc29c('0x18a')]);if(_0x59d959){_0x1131bd[_0xc29c('0x18c')]=_0x5cfb5c[_0xc29c('0x26')][_0x55bb7b][_0xc29c('0x18d')]=extractCalleridName(_0x59d959);_0x1131bd[_0xc29c('0x18e')]=_0x5cfb5c['actions'][_0x55bb7b][_0xc29c('0x18f')]=extractCalleridNumber(_0x59d959);}return ami[_0xc29c('0xaf')]({'actionid':_0x55bb7b,'action':_0xc29c('0x166'),'channel':_0x5cfb5c['isTrunkReachable'](_0x2ba204[_0xc29c('0x77')])?util[_0xc29c('0x79')]('SIP/%s/%s%s',_0x2ba204[_0xc29c('0x77')]['name'],isNotNull(_0x2ba204[_0xc29c('0x190')])?_0x2ba204[_0xc29c('0x190')]['trim']()||'':'',_0x2ba204[_0xc29c('0x191')]>0x0?_0x16d68f[_0xc29c('0x169')][_0xc29c('0x168')][_0xc29c('0x192')](_0x2ba204[_0xc29c('0x191')]):_0x16d68f[_0xc29c('0x169')][_0xc29c('0x168')]):util['format'](_0xc29c('0x193'),_[_0xc29c('0xae')](_0x2ba204[_0xc29c('0x138')])?_0x2ba204[_0xc29c('0x77')][_0xc29c('0x41')]:_0x2ba204[_0xc29c('0x138')][_0xc29c('0x41')],isNotNull(_0x2ba204[_0xc29c('0x190')])?_0x2ba204[_0xc29c('0x190')][_0xc29c('0x194')]()||'':'',_0x2ba204['dialCutDigit']>0x0?_0x16d68f[_0xc29c('0x169')][_0xc29c('0x168')]['substring'](_0x2ba204[_0xc29c('0x191')]):_0x16d68f[_0xc29c('0x169')][_0xc29c('0x168')]),'callerid':_0x59d959,'Exten':_0xc29c('0xdf'),'Context':_0xc29c('0x195'),'Priority':'1','variable':_0x1131bd,'timeout':(_0x2ba204[_0xc29c('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55bb7b})[_0xc29c('0x3e')](function(_0x504afe){return _0x451bbe(_0x504afe);})[_0xc29c('0xb2')](function(_0x4d659a){_0x2ba204[_0xc29c('0x196')]+=0x1;var _0x4eda9=new History(_0x5cfb5c['actions'][_0x55bb7b]);logger[_0xc29c('0x96')](util[_0xc29c('0x79')](_0xc29c('0x197'),JSON[_0xc29c('0x4a')](_0x4d659a)));_0x4eda9[_0xc29c('0xa7')]=0xe;_0x4eda9[_0xc29c('0xa8')]=_0xc29c('0x198');_0x4eda9[_0xc29c('0xaa')]=moment()[_0xc29c('0x79')](_0xc29c('0x104'));_0x4eda9[_0xc29c('0xa9')]=_0x4eda9[_0xc29c('0xaa')];_0x5cfb5c[_0xc29c('0xcd')](_0x4eda9)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x199')));_0x5cfb5c[_0xc29c('0xcb')](_0x4eda9)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x199')))['finally'](function(){delete _0x5cfb5c[_0xc29c('0x26')][_0x55bb7b];return _0x109a70(msgResponse(_0xc29c('0x166'),_0xc29c('0x49'),_0xc29c('0x19a')));});});});};Dialer[_0xc29c('0x1d')][_0xc29c('0x30')]=function(_0xbed756){var _0x27830e=this[_0xc29c('0x26')][_0xbed756[_0xc29c('0x11e')]];if(_0x27830e){delete this[_0xc29c('0x26')][_0xbed756[_0xc29c('0x11e')]];_0x27830e[_0xc29c('0x19b')]=moment()['format'](_0xc29c('0x104'));var _0x1c3da4=_0x27830e['type']==='ivr'?this[_0xc29c('0x22')][_0x27830e[_0xc29c('0xb7')]]:this[_0xc29c('0x21')][_0x27830e[_0xc29c('0x19c')]()];if(!this[_0xc29c('0x19d')](_0xbed756[_0xc29c('0x19e')])){this[_0xc29c('0xb5')](_0x1c3da4);return this[_0xc29c('0x19f')](_0x27830e,_0x1c3da4,_0xbed756)[_0xc29c('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0xbed756['uniqueid']]=_0x27830e;}};Dialer[_0xc29c('0x1d')]['checkRetriveMax']=function(_0x1bc8ed,_0x290ebc,_0x2d89a2){var _0x4962a7=new History(_0x290ebc);if(_0x4962a7['countbusyretry']+_0x4962a7[_0xc29c('0x100')]+_0x4962a7[_0xc29c('0xed')]+_0x4962a7['countnosuchnumberretry']+_0x4962a7['countdropretry']+_0x4962a7[_0xc29c('0xef')]+_0x4962a7[_0xc29c('0xe9')]+_0x4962a7['countagentrejectretry']>=_0x2d89a2['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1bc8ed){case 0x3:if(_0x4962a7[_0xc29c('0xed')]>=_0x2d89a2[_0xc29c('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4962a7[_0xc29c('0xed')]+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0x1a1')],_0xc29c('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7[_0xc29c('0xd5')],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1a2')));break;case 0x5:if(_0x4962a7[_0xc29c('0xec')]>=_0x2d89a2[_0xc29c('0x1a3')]-0x1){return!![];}this[_0xc29c('0xc2')]({'active':![],'countbusyretry':_0x4962a7[_0xc29c('0xec')]+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0x1a4')],'minutes')[_0xc29c('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7['ListId'],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1a5')));break;case 0x8:if(_0x4962a7['countcongestionretry']>=_0x2d89a2[_0xc29c('0x1a6')]-0x1){return!![];}this[_0xc29c('0xc2')]({'active':![],'countcongestionretry':_0x4962a7[_0xc29c('0x100')]+=0x1,'scheduledat':moment()['add'](_0x2d89a2['dialCongestionRetryFrequency'],_0xc29c('0xf6'))['format'](_0xc29c('0x104')),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7['ListId'],'VoiceQueueId':_0x4962a7['VoiceQueueId']||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4962a7[_0xc29c('0xee')]>=_0x2d89a2[_0xc29c('0x1a7')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4962a7[_0xc29c('0xee')]+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0x1a8')],_0xc29c('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7['ListId'],'VoiceQueueId':_0x4962a7['VoiceQueueId']||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})['catch'](loggerCatch(_0xc29c('0x1a9')));}break;case 0xa:if(_0x4962a7['countdropretry']>=_0x2d89a2[_0xc29c('0x1aa')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4962a7[_0xc29c('0x101')]+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0x1ab')],_0xc29c('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7[_0xc29c('0xd5')],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7['CampaignId']||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1ac')));break;case 0xb:if(_0x4962a7[_0xc29c('0xef')]>=_0x2d89a2['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xc29c('0xc2')]({'active':![],'countabandonedretry':_0x4962a7['countabandonedretry']+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0x11a')],_0xc29c('0xf6'))[_0xc29c('0x79')](_0xc29c('0x104')),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7[_0xc29c('0xd5')],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4962a7[_0xc29c('0xe9')]>=_0x2d89a2[_0xc29c('0xf2')]-0x1){return!![];}this[_0xc29c('0xc2')]({'active':![],'countmachineretry':_0x4962a7['countmachineretry']+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2[_0xc29c('0xf5')],_0xc29c('0xf6'))[_0xc29c('0x79')](_0xc29c('0x104')),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7[_0xc29c('0xd5')],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4962a7[_0xc29c('0x102')]>=_0x2d89a2['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xc29c('0xc2')]({'active':![],'countagentrejectretry':_0x4962a7[_0xc29c('0x102')]+=0x1,'scheduledat':moment()[_0xc29c('0xf4')](_0x2d89a2['dialAgentRejectRetryFrequency'],_0xc29c('0xf6'))[_0xc29c('0x79')](_0xc29c('0x104')),'ContactId':_0x4962a7[_0xc29c('0xd4')],'ListId':_0x4962a7[_0xc29c('0xd5')],'VoiceQueueId':_0x4962a7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x4962a7[_0xc29c('0xf8')]||undefined})['catch'](loggerCatch(_0xc29c('0x1ad')));break;default:return!![];}};Dialer[_0xc29c('0x1d')][_0xc29c('0x19f')]=function(_0x3a99c3,_0x5719a8,_0x29a9b6){var _0x258364=this;var _0x2fbb42=new History(_0x3a99c3);return new BPromise(function(_0x326804,_0x53320d){if(_[_0xc29c('0x87')](_0x5719a8)&&typeof _0x5719a8!==_0xc29c('0x1ae')){return _0x53320d(msgResponse(_0xc29c('0x1af'),'Failure',_0xc29c('0x1b0')));}if(_[_0xc29c('0x87')](_0x29a9b6)&&typeof _0x29a9b6!==_0xc29c('0x1ae')){return _0x53320d(msgResponse(_0xc29c('0x1af'),_0xc29c('0x13e'),'evt\x20is\x20undefine'));}switch(_0x29a9b6[_0xc29c('0x10c')]){case'0':_0x5719a8[_0xc29c('0x68')]+=0x1;_0x2fbb42[_0xc29c('0xa7')]=0x0;_0x2fbb42[_0xc29c('0xa8')]=_0xc29c('0x1b1');_0x2fbb42['countnosuchnumberretry']+=0x1;_0x2fbb42[_0xc29c('0xff')]+=0x1;ami[_0xc29c('0x4d')](_0xc29c('0x1b2'),ut[_0xc29c('0xe7')](_0x3a99c3,_0xc29c('0x1b3')));_0x258364[_0xc29c('0xcd')](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x258364[_0xc29c('0x1b4')](0x0,_0x3a99c3,_0x5719a8)){if(_0x2fbb42[_0xc29c('0xee')]>=_0x5719a8[_0xc29c('0x1a7')]){_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1b5'));}else{_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1b5'));}}break;case'3':_0x5719a8[_0xc29c('0x67')]+=0x1;_0x2fbb42['state']=0x3;_0x2fbb42[_0xc29c('0xa8')]='NoAnswer';_0x2fbb42[_0xc29c('0xed')]+=0x1;_0x2fbb42[_0xc29c('0xff')]+=0x1;ami['emit'](_0xc29c('0x1b6'),ut['buildObj'](_0x3a99c3,_0xc29c('0x1b7')));_0x258364[_0xc29c('0xcd')](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1b8')));if(_0x258364[_0xc29c('0x1b4')](0x3,_0x3a99c3,_0x5719a8)){if(_0x2fbb42[_0xc29c('0xed')]>=_0x5719a8[_0xc29c('0x1a0')]){_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1b9'));}else{_0x258364['stateGlobal'](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1b9'));}}break;case'5':_0x5719a8[_0xc29c('0x63')]+=0x1;_0x2fbb42[_0xc29c('0xa7')]=0x5;_0x2fbb42[_0xc29c('0xa8')]=_0xc29c('0x1ba');_0x2fbb42[_0xc29c('0xec')]+=0x1;_0x2fbb42[_0xc29c('0xff')]+=0x1;ami[_0xc29c('0x4d')]('custom:agentbusy',ut[_0xc29c('0xe7')](_0x3a99c3,_0xc29c('0x1bb')));_0x258364[_0xc29c('0xcd')](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x258364[_0xc29c('0x1b4')](0x5,_0x3a99c3,_0x5719a8)){if(_0x2fbb42[_0xc29c('0xec')]>=_0x5719a8[_0xc29c('0x1a3')]){_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,'reason\x205\x20busy');}else{_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1bc'));}}break;case'8':_0x5719a8[_0xc29c('0x64')]+=0x1;_0x2fbb42[_0xc29c('0xa7')]=0x8;_0x2fbb42[_0xc29c('0xa8')]=_0xc29c('0x1bd');_0x2fbb42[_0xc29c('0x100')]+=0x1;_0x2fbb42['countglobal']+=0x1;ami[_0xc29c('0x4d')](_0xc29c('0x1be'),ut[_0xc29c('0xe7')](_0x3a99c3,_0xc29c('0x1bf')));_0x258364['createHistory'](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1c0')));if(_0x258364['checkRetriveMax'](0x8,_0x3a99c3,_0x5719a8)){if(_0x2fbb42[_0xc29c('0x100')]>=_0x5719a8[_0xc29c('0x1a6')]){_0x258364['createStateFinal'](_0x2fbb42,_0x326804,_0x53320d,'reason\x208\x20congestion');}else{_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1c1'));}}break;case'11':_0x5719a8[_0xc29c('0x1c2')]+=0x1;_0x2fbb42[_0xc29c('0xa7')]=0xb;_0x2fbb42['statedesc']='Abandoned';_0x2fbb42[_0xc29c('0xef')]+=0x1;_0x2fbb42['countglobal']+=0x1;_0x258364[_0xc29c('0xcd')](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x11d')));if(_0x258364['checkRetriveMax'](0xb,_0x3a99c3,_0x5719a8)){if(_0x2fbb42['countabandonedretry']>=_0x5719a8[_0xc29c('0x119')]){_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1c3'));}else{_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1c3'));}}break;case'20':_0x5719a8[_0xc29c('0x1c4')]+=0x1;_0x2fbb42['state']=0x14;_0x2fbb42['statedesc']=_0xc29c('0x1c5');_0x2fbb42[_0xc29c('0x102')]+=0x1;_0x2fbb42['countglobal']+=0x1;ami['emit'](_0xc29c('0x1c6'),ut[_0xc29c('0xe7')](_0x3a99c3,_0xc29c('0x1c7')));_0x258364['createHistory'](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1c8')));if(_0x258364[_0xc29c('0x1b4')](0x14,_0x3a99c3,_0x5719a8)){if(_0x2fbb42[_0xc29c('0x102')]>=_0x5719a8[_0xc29c('0x1c9')]){_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1ca'));}else{_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0xc29c('0x1ca'));}}break;default:_0x5719a8[_0xc29c('0x6a')]+=0x1;_0x2fbb42[_0xc29c('0xa7')]=0xc;_0x2fbb42[_0xc29c('0xa8')]=_0x29a9b6[_0xc29c('0x10c')];_0x258364['createHistory'](_0x2fbb42)[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1cb')));if(_0x258364[_0xc29c('0x1b4')](_0x29a9b6['reason'],_0x3a99c3,_0x5719a8)){if(_0x2fbb42['countbusyretry']+_0x2fbb42[_0xc29c('0x100')]+_0x2fbb42[_0xc29c('0xed')]+_0x2fbb42[_0xc29c('0xee')]+_0x2fbb42['countdropretry']+_0x2fbb42[_0xc29c('0xef')]+_0x2fbb42[_0xc29c('0xe9')]+_0x2fbb42[_0xc29c('0x102')]>=_0x5719a8[_0xc29c('0xf0')]){_0x258364[_0xc29c('0xf1')](_0x2fbb42,_0x326804,_0x53320d,_0x29a9b6['reason']);}else{_0x258364[_0xc29c('0xf3')](_0x2fbb42,_0x326804,_0x53320d,_0x29a9b6['reason']);}}}});};Dialer[_0xc29c('0x1d')]['stateGlobal']=function(_0x39093f,_0x1a50a1,_0x40299d,_0x26e196){var _0xacc648=new Final(_0x39093f);_0xacc648['state']=0xf;_0xacc648[_0xc29c('0xa8')]=_0xc29c('0x1cc');this[_0xc29c('0xf3')](_0xacc648,_0x1a50a1,_0x40299d,_0x26e196);};Dialer[_0xc29c('0x1d')][_0xc29c('0xf3')]=function(_0xa65b49,_0x2b6707,_0x3b51cf,_0x39e789){this['moveContactManagedDialer'](_0xa65b49)[_0xc29c('0x3e')](function(){return _0x2b6707(msgResponse(_0xc29c('0x1af'),_0xc29c('0xd8'),_0x39e789));})['catch'](function(){return _0x3b51cf(msgResponse('[moveContactManagedDialer][0]',_0xc29c('0x13e'),_0xc29c('0x1cd')));});};Dialer['prototype']['predictive']=function(_0x5ad793){var _0x3603d6=_0x5ad793[_0xc29c('0x1ce')]/0x64;var _0x584f6e=_0x5ad793['outboundDropCallsDayTimeout']/(_0x5ad793[_0xc29c('0x66')]+_0x5ad793['outboundAnswerCallsDay']);var _0x14cdd6=Math[_0xc29c('0x1cf')](_0x5ad793[_0xc29c('0x70')]*(_0x5ad793[_0xc29c('0x1d0')]/0x64));var _0x3ea949=Math[_0xc29c('0x1cf')](_0x5ad793[_0xc29c('0x70')]*(_0x5ad793[_0xc29c('0x1d1')]/0x64));var _0x1c4198=_0x5ad793[_0xc29c('0x51')]+_0x5ad793[_0xc29c('0x56')];var _0x136848=Math[_0xc29c('0x1d2')](_0x5ad793[_0xc29c('0x73')]*_0x5ad793[_0xc29c('0x75')]*_0x5ad793['predictiveIntervalHitRate']*_0x5ad793['predictiveIntervalMultiplicativeFactor']);if(_[_0xc29c('0x87')](_0x5ad793['startProgressive'])){if(!_[_0xc29c('0x87')](_0x5ad793[_0xc29c('0x29')])){_0x5ad793[_0xc29c('0x29')]=undefined;loggerPredictive[_0xc29c('0x96')](_0xc29c('0x1d3'),_0xc29c('0x1d4'));}if(!_[_0xc29c('0x87')](_0x5ad793[_0xc29c('0x91')])){loggerPredictive['error'](_0xc29c('0x1d3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5ad793[_0xc29c('0x91')]);_0x5ad793['handlePredictive']=undefined;}_0x5ad793[_0xc29c('0x2a')]=moment()[_0xc29c('0x79')](_0xc29c('0x104'));loggerPredictive['info'](_0x5ad793[_0xc29c('0x41')],_0xc29c('0x1d5'),_0x5ad793[_0xc29c('0x2a')]);this['handlePower'](_0x5ad793,0x1);}else if(ifInterval(_0x5ad793[_0xc29c('0x1d6')],_0x5ad793[_0xc29c('0x2a')])){this[_0xc29c('0x152')](_0x5ad793,0x1);loggerPredictiveCalls[_0xc29c('0x7f')]('[startMethodPredictive][StartProgressive][Loop]',_0x5ad793['startProgressive'],_0x5ad793[_0xc29c('0x41')]);_0x5ad793[_0xc29c('0x73')]=0x0;_0x5ad793[_0xc29c('0x6d')]=0x0;}else if(_0x3603d6<_0x584f6e&&_0x5ad793[_0xc29c('0x1d7')]===_0xc29c('0x1d8')){freeVariablesPredictive(_0x5ad793);loggerPredictive[_0xc29c('0x7f')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xc29c('0x1d9'),_0x584f6e,_0xc29c('0x2a'),_0x5ad793[_0xc29c('0x41')]);}else if(_0x136848<_0x5ad793[_0xc29c('0x6d')]&&_0x5ad793[_0xc29c('0x1d7')]===_0xc29c('0x1d8')){freeVariablesPredictive(_0x5ad793);loggerPredictive[_0xc29c('0x7f')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xc29c('0x1da'),_0x136848,_0xc29c('0x1db'),_0x5ad793['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5ad793[_0xc29c('0x41')]);}else if(!ifInterval(_0x5ad793[_0xc29c('0x1d6')],_0x5ad793['startProgressive'])&&_[_0xc29c('0x87')](_0x5ad793[_0xc29c('0x29')])&&!_['isUndefined'](_0x5ad793[_0xc29c('0x2a')])){_0x5ad793['startPredictive']=moment()[_0xc29c('0x79')](_0xc29c('0x104'));loggerPredictive[_0xc29c('0x7f')](_0x5ad793['name'],'started\x20in\x20predictive\x20at',_0x5ad793[_0xc29c('0x29')]);this[_0xc29c('0xbf')](_0x5ad793['dialPredictiveInterval'])[_0xc29c('0x3e')](this['getDataPredictive'](_0x5ad793))[_0xc29c('0x3e')](mergeDataErlangB(_0x5ad793))[_0xc29c('0x3e')](this[_0xc29c('0x1dc')](_0x5ad793))[_0xc29c('0xb2')](loggerCatchPredictive(_0xc29c('0x1dd'),_0x5ad793));}else if(!ifInterval(_0x5ad793[_0xc29c('0x1d6')],_0x5ad793['startPredictive'])){_0x5ad793[_0xc29c('0x6d')]=0x0;_0x5ad793[_0xc29c('0x29')]=moment()[_0xc29c('0x79')](_0xc29c('0x104'));loggerPredictive[_0xc29c('0x7f')](_0x5ad793['name'],_0xc29c('0x1de'),_0x5ad793[_0xc29c('0x29')]);clearInterval(_0x5ad793[_0xc29c('0x91')]);_0x5ad793['handlePredictive']=undefined;this[_0xc29c('0xbf')](_0x5ad793['dialPredictiveInterval'])['then'](this[_0xc29c('0x1df')](_0x5ad793))[_0xc29c('0x3e')](mergeDataErlangB(_0x5ad793))['then'](this[_0xc29c('0x1dc')](_0x5ad793))['catch'](loggerCatchPredictive(_0xc29c('0x1e0'),_0x5ad793));}else if(_0x5ad793[_0xc29c('0x70')]&&_0x1c4198<_0x5ad793[_0xc29c('0x70')]-_0x3ea949){freeVariablesPredictive(_0x5ad793);loggerPredictive[_0xc29c('0x7f')](_0x5ad793[_0xc29c('0x41')],_0xc29c('0x1e1'),_0x1c4198,_0xc29c('0x1e2'),_0x5ad793[_0xc29c('0x70')],'-',_0x3ea949,'=',_0x5ad793[_0xc29c('0x70')]-_0x3ea949,')');}else if(_0x5ad793['predictiveIntervalAvailable']&&_0x1c4198>_0x5ad793[_0xc29c('0x70')]+_0x14cdd6){freeVariablesPredictive(_0x5ad793);loggerPredictive['info'](_0x5ad793[_0xc29c('0x41')],_0xc29c('0x1e1'),_0x1c4198,_0xc29c('0x1e3'),_0x5ad793[_0xc29c('0x70')],'+',_0x14cdd6,'=',_0x5ad793[_0xc29c('0x70')]+_0x14cdd6,')');}};Dialer[_0xc29c('0x1d')]['getDataPredictive']=function(_0x142c73){var _0x493239=this;return function(_0x833b83){return new BPromise(function(_0x48b978,_0x555534){_[_0xc29c('0x8f')](_0x142c73,_0x833b83[0x0]);if(checkGetDataPredictive(_0x833b83[0x0])){var _0x5cb16b=_0x142c73[_0xc29c('0x70')]=_0x142c73['talking']+_0x142c73['available'];var _0x31d853=_0x142c73[_0xc29c('0x1d6')]*0x3c;var _0x9f298b=_0x833b83[0x0]['predictiveIntervalAvgTalktime']+_0x833b83[0x0]['predictiveIntervalAvgHoldtime'];var _0x256616=(_0x833b83[0x0][_0xc29c('0x83')]+_0x833b83[0x0][_0xc29c('0x84')]+_0x833b83[0x0][_0xc29c('0x1e4')])/_0x833b83[0x0][_0xc29c('0x71')];_0x142c73[_0xc29c('0x1e5')]=_0x256616>0x0?_0x256616:0x1;switch(_0x142c73[_0xc29c('0x1d7')]){case _0xc29c('0x1d8'):var _0xa05c2c=_0x142c73[_0xc29c('0x1ce')]/0x64;return _0x493239[_0xc29c('0x1e6')](_0x5cb16b,_0x31d853,_0x9f298b,_0x256616,_0xa05c2c)[_0xc29c('0x3e')](function(_0x168af5){return _0x48b978(_0x168af5);});case'agentBusyFactor':var _0x320707=_0x142c73['dialPredictiveOptimizationPercentage']/0x64;return _0x493239[_0xc29c('0x1e7')](_0x5cb16b,_0x31d853,_0x9f298b,_0x256616,_0x320707)['then'](function(_0x450aa0){return _0x48b978(_0x450aa0);});default:return _0x555534(msgResponse(_0xc29c('0x1e8'),_0xc29c('0x13e'),_0xc29c('0x1e9')));}}else{return _0x555534(msgResponse('[getDataPredictive]',_0xc29c('0x13e'),_0xc29c('0x1ea')));}});};};Dialer['prototype'][_0xc29c('0x1eb')]=function(_0x57aa88){var _0x51b967=this;return function(_0x467936){return new BPromise(function(_0x1bbdee,_0x110680){_[_0xc29c('0x8f')](_0x57aa88,_0x467936[0x0]);if(checkGetDataPredictive(_0x467936[0x0])){loggerPredictive[_0xc29c('0x7f')](JSON['stringify'](_0x467936[0x0]));if(_0x57aa88[_0xc29c('0x1d7')]==='dropRate'){return _0x51b967[_0xc29c('0xca')](_0x57aa88['id'])['then'](function(_0x2ae09d){var _0x137278=_0x57aa88[_0xc29c('0x52')]-_0x2ae09d[0x0][_0xc29c('0x1ec')];var _0xc0a141=_0x57aa88[_0xc29c('0x1d6')]*0x3c;var _0x2a53f9=_0x467936[0x0][_0xc29c('0x86')]+_0x467936[0x0][_0xc29c('0x6b')];var _0x4d1176=(_0x467936[0x0][_0xc29c('0x83')]+_0x467936[0x0][_0xc29c('0x84')]+_0x467936[0x0][_0xc29c('0x1e4')])/_0x467936[0x0][_0xc29c('0x71')];var _0x5d249b=_0x57aa88[_0xc29c('0x1ce')]/0x64;_0x57aa88[_0xc29c('0x6f')]=_0x2ae09d[0x0]['outboundQueuePauses']||0x0;_0x57aa88[_0xc29c('0x1e5')]=_0x4d1176>0x0?_0x4d1176:0x1;return _0x51b967[_0xc29c('0x1e6')](_0x137278,_0xc0a141,_0x2a53f9,_0x4d1176,_0x5d249b);})[_0xc29c('0x3e')](function(_0x302bbb){return _0x1bbdee(_0x302bbb);})[_0xc29c('0xb2')](function(_0x259299){return _0x110680(msgResponse(_0xc29c('0x1ed'),_0xc29c('0x13e'),JSON[_0xc29c('0x4a')](_0x259299)));});}if(_0x57aa88['dialPredictiveOptimization']===_0xc29c('0x1ee')){return _0x51b967[_0xc29c('0xca')](_0x57aa88['id'])[_0xc29c('0x3e')](function(_0x4609fa){var _0x4cf6d1=_0x57aa88[_0xc29c('0x52')]-_0x4609fa[0x0][_0xc29c('0x1ec')];var _0x592252=_0x57aa88[_0xc29c('0x1d6')]*0x3c;var _0x49253e=_0x467936[0x0][_0xc29c('0x86')]+_0x467936[0x0][_0xc29c('0x6b')];var _0x1d5a31=(_0x467936[0x0]['predictiveIntervalAnsweredCalls']+_0x467936[0x0][_0xc29c('0x84')]+_0x467936[0x0][_0xc29c('0x1e4')])/_0x467936[0x0][_0xc29c('0x71')];var _0x1a97aa=_0x57aa88[_0xc29c('0x1ce')]/0x64;_0x57aa88[_0xc29c('0x6f')]=_0x4609fa[0x0][_0xc29c('0x1ec')]||0x0;_0x57aa88[_0xc29c('0x1e5')]=_0x1d5a31>0x0?_0x1d5a31:0x1;return _0x51b967[_0xc29c('0x1e7')](_0x4cf6d1,_0x592252,_0x49253e,_0x1d5a31,_0x1a97aa);})[_0xc29c('0x3e')](function(_0x3e749c){return _0x1bbdee(_0x3e749c);})[_0xc29c('0xb2')](function(_0x43d91b){return _0x110680(msgResponse(_0xc29c('0x1ed'),'Failure',JSON[_0xc29c('0x4a')](_0x43d91b)));});}}else{return _0x110680(msgResponse(_0xc29c('0x1e8'),'Failure',_0xc29c('0x1ea')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x32b3ae){var _0x191a7b=this;return function(){var _0x524602=0x0;var _0x40be81=Math[_0xc29c('0x1d2')](_0x32b3ae[_0xc29c('0x74')]*0x3e8);if(_0x40be81>0x0){_0x40be81=_0x40be81<0x64?0x64:_0x40be81;loggerPredictive[_0xc29c('0x7f')](_0x32b3ae['name'],_0xc29c('0x1ef'),_0x40be81,_0xc29c('0x4b'));_0x32b3ae[_0xc29c('0x91')]=setInterval(function(){_0x191a7b[_0xc29c('0x91')](_0x32b3ae);loggerPredictiveCalls[_0xc29c('0x7f')](_0xc29c('0x1f0'),_0x524602+=0x1);},_0x40be81);}else{loggerPredictive[_0xc29c('0x7f')](_0x32b3ae[_0xc29c('0x41')],_0xc29c('0x1f1'));}};};Dialer[_0xc29c('0x1d')][_0xc29c('0x1f2')]=function(_0xe0d04f,_0x28f6b7){var _0x105b1b=this;return function(_0xe8d6d5){if(_['isEmpty'](_0xe8d6d5)){if(_[_0xc29c('0xae')](_0x28f6b7[_0xc29c('0xd6')])||!_0x28f6b7[_0xc29c('0x1f3')]){if(_0xe0d04f[_0xc29c('0x5d')]==='booked'){_0xe0d04f[_0xc29c('0x125')]=_[_0xc29c('0x87')](_0xe0d04f[_0xc29c('0x125')])?!![]:_0xe0d04f[_0xc29c('0x125')];var _0x53dd5d=uuid['v4']();_0x105b1b[_0xc29c('0x26')][_0x53dd5d]=new Action(_0xe0d04f,_0x28f6b7,_0x53dd5d);loggerBooked[_0xc29c('0x7f')](_0xc29c('0x1f4'),_0x53dd5d,_0xc29c('0x1f5'),JSON[_0xc29c('0x4a')](_0xe0d04f[_0xc29c('0x125')]),'Queue:\x20',_0xe0d04f['name']);if(_0xe0d04f[_0xc29c('0x125')]){_0xe0d04f['queueStatusComplete']=![];_0x105b1b['queueBooked'][_0x105b1b['actions'][_0x53dd5d][_0xc29c('0xb7')]]=[];ami['Action']({'actionid':_0x53dd5d,'action':_0xc29c('0x1f6'),'queue':_0xe0d04f[_0xc29c('0x41')]})[_0xc29c('0xb2')](function(){_0x105b1b[_0xc29c('0xb5')](_0xe0d04f);_0x105b1b[_0xc29c('0xc2')]({'active':![],'ContactId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d][_0xc29c('0xd4')],'ListId':_0x105b1b['actions'][_0x53dd5d][_0xc29c('0xd5')],'VoiceQueueId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d][_0xc29c('0xf7')]||undefined,'CampaignId':_0x105b1b['actions'][_0x53dd5d][_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x1f7')));delete _0x105b1b[_0xc29c('0x26')][_0x53dd5d];});}else{loggerBooked[_0xc29c('0x7f')](_0xc29c('0x1f8'),JSON['stringify'](_0xe0d04f[_0xc29c('0x125')]),_0xc29c('0x1f9'),_0xe0d04f[_0xc29c('0x41')]);_0x105b1b[_0xc29c('0xb5')](_0xe0d04f);_0x105b1b[_0xc29c('0xc2')]({'active':![],'ContactId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d]['ContactId'],'ListId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d][_0xc29c('0xd5')],'VoiceQueueId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d][_0xc29c('0xf7')]||undefined,'CampaignId':_0x105b1b[_0xc29c('0x26')][_0x53dd5d][_0xc29c('0xf8')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x105b1b[_0xc29c('0x26')][_0x53dd5d];}}else{return _0x105b1b[_0xc29c('0x165')](_0xe0d04f,_0x28f6b7);}}else{if(getDiff(_0x28f6b7[_0xc29c('0x1fa')])<_0xe0d04f[_0xc29c('0x1fb')]*0x3c){if(_0x28f6b7['Agent']&&!_0x28f6b7[_0xc29c('0x1fc')][_0xc29c('0x1fd')]){_0x105b1b[_0xc29c('0x128')][_0xc29c('0x1fe')](_0x28f6b7['id'])['finally'](function(){_0x105b1b[_0xc29c('0xb5')](_0xe0d04f);});}else{_0x105b1b['unlockContact']({'active':![]},_0x28f6b7['id'],0x1)[_0xc29c('0x20')](function(){_0x105b1b[_0xc29c('0xb5')](_0xe0d04f);});}}else{_0xe0d04f[_0xc29c('0x69')]+=0x1;_0x105b1b[_0xc29c('0xb5')](_0xe0d04f);if(_0xe0d04f[_0xc29c('0x1ff')]){_0x105b1b[_0xc29c('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x28f6b7[_0xc29c('0xd4')],'ListId':_0x28f6b7[_0xc29c('0xd5')],'VoiceQueueId':_0x28f6b7[_0xc29c('0xf7')]||undefined,'CampaignId':_0x28f6b7[_0xc29c('0xf8')]||undefined})[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x200')));_0x105b1b[_0xc29c('0xcd')](createObjHistory(_0xe0d04f,_0x28f6b7,_0xc29c('0x201'),0x17,_0xc29c('0x202')))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0x203')));}else{_0x105b1b[_0xc29c('0xd2')](createObjHistory(_0xe0d04f,_0x28f6b7,_0xc29c('0x204'),0x16,_0xc29c('0x205')),_0xc29c('0x206'),'[Originate][HistoryRecallClose]');}}}}else{_0xe0d04f[_0xc29c('0x62')]+=0x1;_0x105b1b[_0xc29c('0xd2')](createObjHistory(_0xe0d04f,_0x28f6b7,'BLACKLIST',0xd,'Blacklist'),_0xc29c('0x207'),_0xc29c('0x208'));throw'inBlackList';}};};Dialer[_0xc29c('0x1d')]['handleIvr']=function(_0x3b5871){var _0x3368e7=this;var _0x48c712=_0x3b5871[_0xc29c('0x209')]-_0x3b5871['originated']-_0x3b5871[_0xc29c('0xc6')];emitCampaignSummary(_0x3b5871);if(_0x48c712>0x0){if(_0x48c712>this[_0xc29c('0x25')]){_0x48c712=this[_0xc29c('0x25')];}_0x3b5871[_0xc29c('0xc6')]+=_0x48c712;this[_0xc29c('0xc8')](_0x3b5871['id'],_0x48c712,_0x3b5871[_0xc29c('0x20a')],_0x3b5871)['then'](function(_0x4209aa){_0x3b5871[_0xc29c('0xc6')]-=_0x48c712;_0x3b5871[_0xc29c('0xc6')]=_0x3b5871['temp']>0x0?_0x3b5871['temp']:0x0;if(!checkContactEmpty(_0x4209aa)){_0x3b5871[_0xc29c('0x40')]=_0xc29c('0x9f');logger['info'](_0xc29c('0x20b')+_0x3b5871['name']);}else{_0x3b5871[_0xc29c('0x72')]+=_0x4209aa[_0xc29c('0x143')];_0x3b5871['message']='RUNNING';for(var _0x431821=0x0;_0x431821<_0x4209aa[_0xc29c('0x143')];_0x431821+=0x1){_0x3b5871[_0xc29c('0x20c')]+=0x1;if(_['isNil'](_0x4209aa[_0x431821])||_[_0xc29c('0xae')](_0x4209aa[_0x431821][_0xc29c('0x169')])||_[_0xc29c('0xae')](_0x4209aa[_0x431821][_0xc29c('0x169')]['phone'])){_0x3368e7[_0xc29c('0xd0')](_0xc29c('0x20d'),_0x3b5871,_0x4209aa[_0x431821]);}else{_0x3368e7[_0xc29c('0xbd')](_[_0xc29c('0xd3')](_0x4209aa[_0x431821],[_0xc29c('0xf8'),_0xc29c('0x20e')]))['then'](_0x3368e7['checkContactBlack'](_0x3b5871,_0x4209aa[_0x431821]))['catch'](_0x3368e7[_0xc29c('0x20f')]('[actionOriginateIvr]\x20',_0x3b5871));}}}})['catch'](loggerGetContactDialer(_0xc29c('0x210'),_0x3b5871,_0x48c712));}};Dialer[_0xc29c('0x1d')][_0xc29c('0x152')]=function(_0x5561f1,_0x458dd2){var _0x28fee6=this;var _0x5803c1=[];var _0x59d472=_0x458dd2>=0x1?_0x458dd2:0x1;if(_0x5561f1['dialMethod']===_0xc29c('0x8')){_0x59d472=0x1;}var _0x1846a6=Math['floor'](_0x5561f1[_0xc29c('0x51')]*_0x59d472)-_0x5561f1[_0xc29c('0x72')]-_0x5561f1[_0xc29c('0xc6')];emitVoiceQueueSummary(_0x5561f1);if(_0x5561f1[_0xc29c('0x211')]>0x0){var _0x143fff=_0x5561f1[_0xc29c('0x211')]-_0x5561f1[_0xc29c('0x72')]-_0x5561f1[_0xc29c('0x56')]-_0x5561f1[_0xc29c('0xc6')]-_0x5561f1[_0xc29c('0x53')];if(_0x1846a6>_0x143fff){_0x1846a6=_0x143fff;}}if(_0x1846a6>0x0){if(_0x5561f1['dialMethod']===_0xc29c('0x8')){_0x1846a6=0x1;}if(_0x1846a6>this[_0xc29c('0x25')]){_0x1846a6=this['maxNumberOriginate'];}_0x5561f1[_0xc29c('0xc6')]+=_0x1846a6;for(var _0x14d9cc in this[_0xc29c('0x23')]){if(typeof this[_0xc29c('0x23')][_0x14d9cc]!==_0xc29c('0x99')){if(this[_0xc29c('0x23')][_0x14d9cc][_0xc29c('0xa7')]===_0xc29c('0x212')&&this[_0xc29c('0x23')][_0x14d9cc][_0xc29c('0xb0')]==='reachable'){_0x5803c1[_0xc29c('0x123')](this[_0xc29c('0x23')][_0x14d9cc]['id']);}}}this[_0xc29c('0xc5')](_0x5561f1['id'],_0x5803c1,_0x1846a6,_0x5561f1[_0xc29c('0x20a')],_0x5561f1)['then'](function(_0x529f73){_0x5561f1[_0xc29c('0xc6')]-=_0x1846a6;_0x5561f1[_0xc29c('0xc6')]=_0x5561f1[_0xc29c('0xc6')]>0x0?_0x5561f1[_0xc29c('0xc6')]:0x0;if(!checkContactEmpty(_0x529f73)){_0x28fee6[_0xc29c('0xb8')](_0x5561f1)[_0xc29c('0x3e')](sendMessageReschedule(_0x5561f1))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xba')));}else{_0x5561f1['originated']+=_0x529f73[_0xc29c('0x143')];_0x5561f1[_0xc29c('0x40')]=_0x5561f1[_0xc29c('0x5d')]===_0xc29c('0x8')?_0xc29c('0x172'):_0xc29c('0x213');for(var _0x24f6ca=0x0;_0x24f6ca<_0x529f73[_0xc29c('0x143')];_0x24f6ca+=0x1){if(_['isNil'](_0x529f73[_0x24f6ca])||_['isNil'](_0x529f73[_0x24f6ca]['Contact'])||_[_0xc29c('0xae')](_0x529f73[_0x24f6ca][_0xc29c('0x169')][_0xc29c('0x168')])){_0x28fee6[_0xc29c('0xd0')](_0xc29c('0x20d'),_0x5561f1,_0x529f73[_0x24f6ca]);}else{_0x28fee6[_0xc29c('0xbb')](_['pick'](_0x529f73[_0x24f6ca],[_0xc29c('0xf7'),'Contact.phone']))['then'](_0x28fee6['checkContactBlack'](_0x5561f1,_0x529f73[_0x24f6ca]))[_0xc29c('0xb2')](_0x28fee6[_0xc29c('0x20f')](_0xc29c('0x20d'),_0x5561f1));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5561f1,_0x1846a6));}};Dialer[_0xc29c('0x1d')][_0xc29c('0x91')]=function(_0x97f851){if(_0x97f851[_0xc29c('0x211')]>0x0){var _0x2a4cb7=_0x97f851[_0xc29c('0x211')]-_0x97f851[_0xc29c('0x72')]-_0x97f851[_0xc29c('0x56')];if(_0x2a4cb7>0x0){this[_0xc29c('0x214')](_0x97f851);}else{loggerPredictiveCalls['info'](_0xc29c('0x215'));}}else{this['tryOriginatePredictive'](_0x97f851);}};Dialer[_0xc29c('0x1d')][_0xc29c('0x214')]=function(_0x45db98){var _0x2298d2=this;var _0x3f47ea=[];_0x45db98[_0xc29c('0x72')]+=0x1;for(var _0x2ac129 in this[_0xc29c('0x23')]){if(typeof this[_0xc29c('0x23')][_0x2ac129]!==_0xc29c('0x99')){if(this['agents'][_0x2ac129][_0xc29c('0xa7')]===_0xc29c('0x212')&&this[_0xc29c('0x23')][_0x2ac129][_0xc29c('0xb0')]===_0xc29c('0xda')){_0x3f47ea[_0xc29c('0x123')](this[_0xc29c('0x23')][_0x2ac129]['id']);}}}this['getContactDialer'](_0x45db98['id'],_0x3f47ea,0x1,_0x45db98[_0xc29c('0x20a')],_0x45db98)[_0xc29c('0x3e')](function(_0x2e088f){if(!checkContactEmpty(_0x2e088f)){checkContactLowerLimitOriginate(_0x45db98,0x1,0x0);_0x2298d2['countReScheduled'](_0x45db98)['then'](sendMessageReschedule(_0x45db98))[_0xc29c('0xb2')](loggerCatch(_0xc29c('0xba')));}else{_0x45db98[_0xc29c('0x40')]=_0xc29c('0x213');if(_[_0xc29c('0xae')](_0x2e088f[0x0])||_['isNil'](_0x2e088f[0x0][_0xc29c('0x169')])||_[_0xc29c('0xae')](_0x2e088f[0x0]['Contact']['phone'])){_0x2298d2[_0xc29c('0xd0')](_0xc29c('0x20d'),_0x45db98,_0x2e088f[0x0]);}else{_0x2298d2[_0xc29c('0xbb')](_[_0xc29c('0xd3')](_0x2e088f[0x0],[_0xc29c('0xf7'),_0xc29c('0x20e')]))[_0xc29c('0x3e')](_0x2298d2[_0xc29c('0x1f2')](_0x45db98,_0x2e088f[0x0]))[_0xc29c('0xb2')](_0x2298d2['loggerHandler'](_0xc29c('0x216'),_0x45db98));}}})[_0xc29c('0xb2')](loggerGetContactDialer(_0xc29c('0x217'),_0x45db98,0x1));emitVoiceQueueSummary(_0x45db98);};Dialer['prototype'][_0xc29c('0x1e6')]=function(_0x3303d0,_0x4f1925,_0x67265c,_0x456873,_0xb251e0,_0x43b0b6){loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x218'));loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x219'),_0x3303d0);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x21a'),_0x4f1925);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x21b'),_0x67265c);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x21c'),_0x456873);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x21d'),_0xb251e0);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8e'));return new BPromise(function(_0x49ab87,_0x45b3f3){if(_0x3303d0<=0x0||isNaN(_0x3303d0)){return _0x45b3f3(msgResponse(_0xc29c('0x21e'),_0xc29c('0x49'),'m\x20=\x20'+_0x3303d0));}if(_0x67265c<=0x0||isNaN(_0x67265c)){return _0x45b3f3(msgResponse(_0xc29c('0x21e'),_0xc29c('0x49'),'Ts\x20=\x20'+_0x67265c));}if(_0x456873<=0x0||isNaN(_0x456873)){return _0x45b3f3(msgResponse(_0xc29c('0x21e'),_0xc29c('0x49'),_0xc29c('0x21f')+_0x456873));}if(_0x4f1925<=0x0||isNaN(_0x4f1925)){return _0x45b3f3(msgResponse('[abandonmentRate]',_0xc29c('0x49'),_0xc29c('0x220')+_0x4f1925));}if(_0xb251e0<=0x0||isNaN(_0xb251e0)){return _0x45b3f3(msgResponse(_0xc29c('0x21e'),_0xc29c('0x49'),_0xc29c('0x221')+_0xb251e0));}_0x43b0b6=_0x43b0b6||0x0;var _0x1e81ca=0x1/_0x67265c;var _0x298e92=0x0;var _0x512ed7=0x0;var _0xe6db0=0x0;var _0x402322=0x0;for(var _0x50ccd5=0x0;_0xe6db0<_0xb251e0;_0x50ccd5+=0x1){_0x512ed7=_0x50ccd5/_0x4f1925;_0x298e92=(_0x456873*_0x512ed7+_0x43b0b6)/_0x1e81ca;_0xe6db0=erlangb(_0x298e92,_0x3303d0);_0x402322=_0x298e92/_0x3303d0*(0x1-erlangb(_0x298e92,_0x3303d0));}return _0x49ab87({'erlangCalls':_0x50ccd5,'erlangCallToSecond':_0x4f1925/_0x50ccd5,'erlangAbandonmentRate':_0xe6db0,'erlangBusyFactor':_0x402322});});};Dialer[_0xc29c('0x1d')][_0xc29c('0x1e7')]=function(_0x3a89a4,_0x240c8e,_0x15e963,_0x47cc72,_0x22c4f2,_0x2bd536){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xc29c('0x7f')]('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',_0x3a89a4);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x21a'),_0x240c8e);loggerPredictive['info'](_0xc29c('0x21b'),_0x15e963);loggerPredictive['info']('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',_0x47cc72);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22c4f2);loggerPredictive[_0xc29c('0x7f')](_0xc29c('0x8e'));return new BPromise(function(_0xc2d85e,_0x3a987){if(_0x3a89a4<=0x0||isNaN(_0x3a89a4)){return _0x3a987(msgResponse(_0xc29c('0x222'),_0xc29c('0x49'),'m\x20=\x20'+_0x3a89a4));}if(_0x15e963<=0x0||isNaN(_0x15e963)){return _0x3a987(msgResponse(_0xc29c('0x222'),'Error','Ts\x20=\x20'+_0x15e963));}if(_0x47cc72<=0x0||isNaN(_0x47cc72)){return _0x3a987(msgResponse(_0xc29c('0x222'),_0xc29c('0x49'),'p\x20=\x20'+_0x47cc72));}if(_0x240c8e<=0x0||isNaN(_0x240c8e)){return _0x3a987(msgResponse(_0xc29c('0x222'),_0xc29c('0x49'),_0xc29c('0x220')+_0x240c8e));}if(_0x22c4f2<=0x0||isNaN(_0x22c4f2)){return _0x3a987(msgResponse(_0xc29c('0x222'),'Error',_0xc29c('0x223')+_0x22c4f2));}_0x2bd536=_0x2bd536||0x0;var _0x5b33fc=0x1/_0x15e963;var _0x19bf9a=0x0;var _0x4b219e=0x0;var _0x27061c=0x0;var _0x2b925e=0x0;for(var _0x398d02=0x0;_0x2b925e<_0x22c4f2;_0x398d02+=0x1){_0x4b219e=_0x398d02/_0x240c8e;_0x19bf9a=(_0x47cc72*_0x4b219e+_0x2bd536)/_0x5b33fc;_0x27061c=erlangb(_0x19bf9a,_0x3a89a4);_0x2b925e=_0x19bf9a/_0x3a89a4*(0x1-erlangb(_0x19bf9a,_0x3a89a4));}return _0xc2d85e({'erlangCalls':_0x398d02,'erlangCallToSecond':_0x240c8e/_0x398d02,'erlangAbandonmentRate':_0x27061c,'erlangBusyFactor':_0x2b925e});});};module[_0xc29c('0x224')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 393093e..ef5cc84 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14f6=['endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x14f6,0x1c1));var _0x614f=function(_0x22ff2f,_0x4b2fd0){_0x22ff2f=_0x22ff2f-0x0;var _0x3dd6c0=_0x14f6[_0x22ff2f];return _0x3dd6c0;};'use strict';var util=require(_0x614f('0x0'));var _=require(_0x614f('0x1'));var moment=require(_0x614f('0x2'));function getSeconds(_0x53873c,_0x40a170){var _0x1cf098=moment(_0x53873c)[_0x614f('0x3')](0x0);var _0x2a6d4c=moment(_0x40a170)['milliseconds'](0x0);return _0x1cf098[_0x614f('0x4')](_0x2a6d4c,'seconds');}function QueueCallerAbandon(_0x22b23a,_0x16dbc9){this[_0x614f('0x5')]=_0x22b23a[_0x614f('0x5')];this['type']=_0x22b23a[_0x614f('0x6')];this[_0x614f('0x7')]=_0x22b23a[_0x614f('0x6')]==='outbound'?'queue':_0x22b23a[_0x614f('0x6')];this[_0x614f('0x8')]=_0x22b23a['countbusyretry'];this[_0x614f('0x9')]=_0x22b23a[_0x614f('0x9')];this[_0x614f('0xa')]=_0x22b23a['countnoanswerretry'];this['countglobal']=_0x22b23a[_0x614f('0x8')]+_0x22b23a[_0x614f('0x9')]+_0x22b23a[_0x614f('0xa')]+_0x22b23a['countnosuchnumberretry']+_0x22b23a[_0x614f('0xb')]+_0x22b23a[_0x614f('0xc')]+_0x22b23a[_0x614f('0xd')]+_0x22b23a[_0x614f('0xe')];this[_0x614f('0xf')]=_0x22b23a[_0x614f('0xf')];this[_0x614f('0xb')]=_0x22b23a[_0x614f('0xb')];this[_0x614f('0xc')]=_0x22b23a[_0x614f('0xc')];this[_0x614f('0xd')]=_0x22b23a[_0x614f('0xd')];this['countagentrejectretry']=_0x22b23a['countagentrejectretry'];this[_0x614f('0x10')]=_0x16dbc9[_0x614f('0x10')];this[_0x614f('0x11')]=_0x22b23a[_0x614f('0x12')];this[_0x614f('0x13')]=_0x22b23a[_0x614f('0x14')];this[_0x614f('0x15')]=_0x22b23a[_0x614f('0x15')];this[_0x614f('0x16')]=_0x22b23a[_0x614f('0x16')];this[_0x614f('0x17')]=_0x22b23a[_0x614f('0x17')];this[_0x614f('0x18')]=this[_0x614f('0x17')];this[_0x614f('0x19')]=getSeconds(_0x22b23a[_0x614f('0x16')],_0x22b23a[_0x614f('0x15')]);this[_0x614f('0x1a')]=getSeconds(this['droptime'],_0x22b23a[_0x614f('0x16')]);this[_0x614f('0x1b')]=0x0;this[_0x614f('0x1c')]=_0x16dbc9['queue'];this[_0x614f('0x1d')]=_0x16dbc9[_0x614f('0x1e')];this['reason']=_0x16dbc9[_0x614f('0x1f')];this[_0x614f('0x20')]=_0x22b23a[_0x614f('0x20')];this[_0x614f('0x21')]=_0x22b23a[_0x614f('0x21')];this['callbackat']=_0x22b23a['callbackat'];this[_0x614f('0x22')]=_0x22b23a[_0x614f('0x22')];this[_0x614f('0x23')]=_0x22b23a[_0x614f('0x23')];this[_0x614f('0x24')]=_0x22b23a['ListId'];this[_0x614f('0x25')]=_0x22b23a[_0x614f('0x25')];this[_0x614f('0x26')]=_0x22b23a['VoiceQueueId'];this[_0x614f('0x27')]=_0x22b23a['CampaignId'];this[_0x614f('0x28')]=_0x22b23a[_0x614f('0x28')]||'';this[_0x614f('0x29')]=_0x22b23a[_0x614f('0x29')]||'';}module[_0x614f('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x5809=['calleridname','number','responsetime','droptime','endtime','ringtime','starttime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','milliseconds','diff','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid'];(function(_0x2144a2,_0x5e91ef){var _0xf2a6ca=function(_0x3203e1){while(--_0x3203e1){_0x2144a2['push'](_0x2144a2['shift']());}};_0xf2a6ca(++_0x5e91ef);}(_0x5809,0x145));var _0x9580=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5809[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x9580('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x438e8e,_0x4a8627){var _0x9253cd=moment(_0x438e8e)[_0x9580('0x1')](0x0);var _0x4f1724=moment(_0x4a8627)[_0x9580('0x1')](0x0);return _0x9253cd[_0x9580('0x2')](_0x4f1724,'seconds');}function QueueCallerAbandon(_0x5c187d,_0x5fea95){this[_0x9580('0x3')]=_0x5c187d[_0x9580('0x3')];this[_0x9580('0x4')]=_0x5c187d[_0x9580('0x4')];this[_0x9580('0x5')]=_0x5c187d[_0x9580('0x4')]==='outbound'?_0x9580('0x6'):_0x5c187d[_0x9580('0x4')];this[_0x9580('0x7')]=_0x5c187d[_0x9580('0x7')];this[_0x9580('0x8')]=_0x5c187d[_0x9580('0x8')];this[_0x9580('0x9')]=_0x5c187d[_0x9580('0x9')];this[_0x9580('0xa')]=_0x5c187d[_0x9580('0x7')]+_0x5c187d['countcongestionretry']+_0x5c187d['countnoanswerretry']+_0x5c187d[_0x9580('0xb')]+_0x5c187d[_0x9580('0xc')]+_0x5c187d[_0x9580('0xd')]+_0x5c187d['countmachineretry']+_0x5c187d[_0x9580('0xe')];this[_0x9580('0xb')]=_0x5c187d[_0x9580('0xb')];this[_0x9580('0xc')]=_0x5c187d['countdropretry'];this[_0x9580('0xd')]=_0x5c187d[_0x9580('0xd')];this[_0x9580('0xf')]=_0x5c187d[_0x9580('0xf')];this[_0x9580('0xe')]=_0x5c187d[_0x9580('0xe')];this[_0x9580('0x10')]=_0x5fea95[_0x9580('0x10')];this[_0x9580('0x11')]=_0x5c187d['name'];this['calleridnum']=_0x5c187d[_0x9580('0x12')];this['starttime']=_0x5c187d['starttime'];this[_0x9580('0x13')]=_0x5c187d['responsetime'];this[_0x9580('0x14')]=_0x5c187d[_0x9580('0x14')];this[_0x9580('0x15')]=this[_0x9580('0x14')];this[_0x9580('0x16')]=getSeconds(_0x5c187d['responsetime'],_0x5c187d[_0x9580('0x17')]);this['holdtime']=getSeconds(this['droptime'],_0x5c187d['responsetime']);this[_0x9580('0x18')]=0x0;this[_0x9580('0x6')]=_0x5fea95[_0x9580('0x6')];this['membername']=_0x5fea95[_0x9580('0x19')];this[_0x9580('0x1a')]=_0x5fea95[_0x9580('0x1a')];this[_0x9580('0x1b')]=_0x5c187d[_0x9580('0x1b')];this[_0x9580('0x1c')]=_0x5c187d[_0x9580('0x1c')];this['callbackat']=_0x5c187d[_0x9580('0x1d')];this[_0x9580('0x1e')]=_0x5c187d[_0x9580('0x1e')];this[_0x9580('0x1f')]=_0x5c187d[_0x9580('0x1f')];this[_0x9580('0x20')]=_0x5c187d[_0x9580('0x20')];this[_0x9580('0x21')]=_0x5c187d[_0x9580('0x21')];this[_0x9580('0x22')]=_0x5c187d[_0x9580('0x22')];this[_0x9580('0x23')]=_0x5c187d[_0x9580('0x23')];this[_0x9580('0x24')]=_0x5c187d['originatecalleridnum']||'';this['originatecalleridname']=_0x5c187d['originatecalleridname']||'';}module[_0x9580('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b2c9ac0..56e5fad 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(_0x5e2443,_0x18acad){var _0x4ccc3d=function(_0x5a26b0){while(--_0x5a26b0){_0x5e2443['push'](_0x5e2443['shift']());}};_0x4ccc3d(++_0x18acad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x3434a3,_0x532215){var _0x772695=function(_0xc364db){while(--_0xc364db){_0x3434a3['push'](_0x3434a3['shift']());}};_0x772695(++_0x532215);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 cb5b5b3..0af2b2d 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 _0x69d3=['syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','syncOriginateResponse','prototype','context','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState'];(function(_0xbf400c,_0x37e1e7){var _0x2ee697=function(_0x3c2668){while(--_0x3c2668){_0xbf400c['push'](_0xbf400c['shift']());}};_0x2ee697(++_0x37e1e7);}(_0x69d3,0xda));var _0x369d=function(_0x5ed841,_0x3d5adc){_0x5ed841=_0x5ed841-0x0;var _0x4ea5fa=_0x69d3[_0x5ed841];return _0x4ea5fa;};'use strict';var util=require(_0x369d('0x0'));var _=require(_0x369d('0x1'));var BPromise=require(_0x369d('0x2'));var uuid=require('uuid');var moment=require(_0x369d('0x3'));var path=require(_0x369d('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x369d('0x5'))('fax');var ami=require('../ami');var rpcDb=require(_0x369d('0x6'));var Channel=require(_0x369d('0x7'));var ut=require(_0x369d('0x8'));var Action=require(_0x369d('0x9'));var faxAccount=require(_0x369d('0xa'));var attachment=require(_0x369d('0xb'));var faxMessage=require(_0x369d('0xc'));function Fax(_0x2ac0ec){this[_0x369d('0xd')]={};this['faxAccounts']=_0x2ac0ec['faxAccounts'];this[_0x369d('0xe')]=_0x2ac0ec[_0x369d('0xe')];this[_0x369d('0xf')]={};ami['on'](_0x369d('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0x369d('0x11'),this[_0x369d('0x12')][_0x369d('0x13')](this));ami['on'](_0x369d('0x14'),this[_0x369d('0x15')][_0x369d('0x13')](this));ami['on']('newexten',this[_0x369d('0x16')][_0x369d('0x13')](this));ami['on'](_0x369d('0x17'),this[_0x369d('0x18')][_0x369d('0x13')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x369d('0x19'),this[_0x369d('0x1a')][_0x369d('0x13')](this));ami['on']('originateresponse',this[_0x369d('0x1b')][_0x369d('0x13')](this));}Fax[_0x369d('0x1c')]['syncNewchannel']=function(_0x368c05){if(_0x368c05[_0x369d('0x1d')]==='from-voip-provider'){for(var _0x572513 in this['faxAccounts']){if(this[_0x369d('0x1e')][_0x369d('0x1f')](_0x572513)){if(_0x368c05[_0x369d('0x20')]===this['faxAccounts'][_0x572513][_0x369d('0x21')]){this[_0x369d('0xd')][_0x368c05[_0x369d('0x22')]]={};this[_0x369d('0xd')][_0x368c05[_0x369d('0x22')]]['channel']=_0x368c05[_0x369d('0x23')];this[_0x369d('0xd')][_0x368c05[_0x369d('0x22')]]['id']=this[_0x369d('0x1e')][_0x572513]['id'];this[_0x369d('0xd')][_0x368c05[_0x369d('0x22')]][_0x369d('0x24')]=this[_0x369d('0x1e')][_0x572513]['name'];logger['info'](_0x368c05[_0x369d('0x22')],_0x369d('0x25'));}}}}if(this[_0x369d('0xf')][_0x368c05[_0x369d('0x22')]]){this[_0x369d('0xd')][_0x368c05[_0x369d('0x22')]]={};this[_0x369d('0xd')][_0x368c05['uniqueid']]['channel']=_0x368c05[_0x369d('0x23')];logger[_0x369d('0x26')](_0x368c05[_0x369d('0x22')],_0x369d('0x25'));}};Fax[_0x369d('0x1c')][_0x369d('0x12')]=function(_0x8090b0){if(this['channels'][_0x8090b0[_0x369d('0x22')]]){for(var _0xe95742 in _0x8090b0[_0x369d('0x27')]){if(_0x8090b0[_0x369d('0x27')][_0x369d('0x1f')](_0xe95742)){this[_0x369d('0xd')][_0x8090b0[_0x369d('0x22')]][_0xe95742]=_0x8090b0['value'];}}}};Fax[_0x369d('0x1c')]['syncNewState']=function(_0x57b94c){if(this[_0x369d('0xd')][_0x57b94c[_0x369d('0x22')]]){this['channels'][_0x57b94c[_0x369d('0x22')]]['channelstate']=_0x57b94c[_0x369d('0x28')];this[_0x369d('0xd')][_0x57b94c[_0x369d('0x22')]][_0x369d('0x29')]=_0x57b94c[_0x369d('0x29')];}};Fax[_0x369d('0x1c')][_0x369d('0x16')]=function(_0x47f60c){if(this[_0x369d('0xd')][_0x47f60c[_0x369d('0x22')]]){for(var _0x219faf in _0x47f60c[_0x369d('0x27')]){if(_0x47f60c[_0x369d('0x27')][_0x369d('0x1f')](_0x219faf)){this[_0x369d('0xd')][_0x47f60c[_0x369d('0x22')]][_0x219faf]=_0x47f60c['value'];}}}};Fax[_0x369d('0x1c')][_0x369d('0x18')]=function(_0x376abf){if(this[_0x369d('0xd')][_0x376abf[_0x369d('0x22')]]){this['channels'][_0x376abf[_0x369d('0x22')]][_0x369d('0x2a')]=_0x376abf[_0x369d('0x2a')];this[_0x369d('0xd')][_0x376abf[_0x369d('0x22')]][_0x369d('0x2b')]=_0x376abf['status'];this[_0x369d('0xd')][_0x376abf[_0x369d('0x22')]][_0x369d('0x21')]=_0x376abf[_0x369d('0x21')];this[_0x369d('0xd')][_0x376abf[_0x369d('0x22')]][_0x369d('0x2c')]=_0x376abf[_0x369d('0x2c')];logger[_0x369d('0x26')](_0x376abf[_0x369d('0x22')],_0x369d('0x2d'));}};Fax[_0x369d('0x1c')][_0x369d('0x2e')]=function(_0x43d734){var _0x56922d=this;if(this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]]){var _0x69c7af=this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]]['id'];this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]][_0x369d('0x2f')]=_0x43d734[_0x369d('0x2f')];this['channels'][_0x43d734['uniqueid']][_0x369d('0x30')]=_0x43d734[_0x369d('0x30')];this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]][_0x369d('0x21')]=_0x43d734[_0x369d('0x21')];this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]][_0x369d('0x31')]=_0x43d734['resolution'];this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]][_0x369d('0x32')]=_0x43d734[_0x369d('0x32')];this[_0x369d('0xd')][_0x43d734[_0x369d('0x22')]][_0x369d('0x2c')]=_0x43d734[_0x369d('0x2c')];this['channels'][_0x43d734['uniqueid']][_0x369d('0x33')]=_0x43d734[_0x369d('0x33')];if(this[_0x369d('0xd')][_0x43d734['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x43d734['filename'],_0x369d('0x34'),function(_0x6e8477){logger['info'](_0x43d734[_0x369d('0x22')],_0x369d('0x35'),_0x6e8477[_0x369d('0x36')]);attachment[_0x369d('0x37')]({'name':path['parse'](_0x43d734[_0x369d('0x2c')])['name'],'basename':path[_0x369d('0x38')](_0x43d734['filename'])[_0x369d('0x24')]+_0x369d('0x39'),'type':_0x369d('0x3a')})['then'](function(_0x4e5df6){faxAccount[_0x369d('0x3b')](_0x69c7af,{'from':_0x43d734[_0x369d('0x33')],'mapKey':_0x369d('0x3c'),'body':path['parse'](_0x43d734[_0x369d('0x2c')])[_0x369d('0x24')]+_0x369d('0x39'),'AttachmentId':_0x4e5df6['id']})[_0x369d('0x3d')](function(_0x34e2e4){logger[_0x369d('0x3e')](_0x43d734[_0x369d('0x22')],_0x369d('0x3f'),JSON[_0x369d('0x40')](_0x34e2e4));});})['catch'](function(_0x11ce32){logger[_0x369d('0x3e')](_0x43d734[_0x369d('0x22')],_0x369d('0x41'),JSON[_0x369d('0x40')](_0x11ce32));});});}logger[_0x369d('0x26')](_0x43d734['uniqueid'],_0x369d('0x41'));}};Fax[_0x369d('0x1c')][_0x369d('0x1b')]=function(_0x44a357){if(this[_0x369d('0xf')][_0x44a357[_0x369d('0x22')]]){_[_0x369d('0x42')](this[_0x369d('0xd')][_0x44a357[_0x369d('0x22')]],_[_0x369d('0x43')](_0x44a357,[_0x369d('0x44'),_0x369d('0x45')]));}};function updateStatus(_0x573774){if(_0x573774[_0x369d('0x46')]){faxMessage[_0x369d('0x47')](_0x573774[_0x369d('0x46')],{'failMessage':_0x369d('0x48')})[_0x369d('0x49')](function(_0x4b41e5){ut[_0x369d('0x4a')]('[Fax][Message][Error][Updated]',_0x4b41e5);})[_0x369d('0x3d')](function(_0x2709f7){ut[_0x369d('0x4a')](_0x369d('0x4b'),_0x2709f7);});}else{ut[_0x369d('0x4a')](_0x369d('0x4c'));}}Fax[_0x369d('0x1c')][_0x369d('0x4d')]=function(_0x1cdeca,_0x9f1544,_0x4d582a){var _0x5a3dd4=this;var _0x203750={};if(_0x9f1544){_0x203750={'read':_0x9f1544};}else{_0x203750={'failMessage':_0x4d582a};}if(this[_0x369d('0xf')][_0x1cdeca][_0x369d('0x46')]){faxMessage[_0x369d('0x47')](this[_0x369d('0xf')][_0x1cdeca]['AttachmentId'],_0x203750)['then'](function(_0x4215ff){ut[_0x369d('0x4a')]('[Fax][Message][Updated]',_0x4215ff);})[_0x369d('0x3d')](function(_0x49c3b5){ut[_0x369d('0x4a')](_0x369d('0x4e'),_0x49c3b5);})[_0x369d('0x4f')](function(){delete _0x5a3dd4['channels'][_0x1cdeca];delete _0x5a3dd4[_0x369d('0xf')][_0x1cdeca];});}else{ut[_0x369d('0x4a')](_0x369d('0x50'));delete this[_0x369d('0xd')][_0x1cdeca];delete this['actions'][_0x1cdeca];}};Fax['prototype'][_0x369d('0x1a')]=function(_0x476ee8){var _0x35667d=this;if(this['channels'][_0x476ee8[_0x369d('0x22')]]){if(this[_0x369d('0xf')][_0x476ee8[_0x369d('0x22')]]){this['channels'][_0x476ee8['uniqueid']]['id']=this[_0x369d('0xf')][_0x476ee8[_0x369d('0x22')]]['id'];this[_0x369d('0xd')][_0x476ee8[_0x369d('0x22')]]['name']=this[_0x369d('0xf')][_0x476ee8[_0x369d('0x22')]][_0x369d('0x24')];}logger[_0x369d('0x26')](_0x476ee8[_0x369d('0x22')],this['actions'][_0x476ee8[_0x369d('0x22')]]?_0x369d('0x51'):_0x369d('0x52'),JSON['stringify'](this[_0x369d('0xd')][_0x476ee8['uniqueid']]));if(this[_0x369d('0xf')][_0x476ee8['uniqueid']]){if(this['channels'][_0x476ee8['uniqueid']]['faxpages']>0x0&&this[_0x369d('0xd')][_0x476ee8['uniqueid']][_0x369d('0x17')]==='SUCCESS'){this[_0x369d('0x4d')](_0x476ee8[_0x369d('0x22')],!![]);}else{this[_0x369d('0x4d')](_0x476ee8['uniqueid'],![],this[_0x369d('0xd')][_0x476ee8[_0x369d('0x22')]][_0x369d('0x53')]?_0x369d('0x54')+this[_0x369d('0xd')][_0x476ee8[_0x369d('0x22')]]['faxstatusstring']:_0x369d('0x55'));}}}};Fax['prototype']['send']=function(_0x56c98e){var _0x36e990=this;return new BPromise(function(_0xab8c70,_0xde27de){_0x36e990[_0x369d('0x56')](_0x56c98e,_0x36e990[_0x369d('0x1e')][_0x56c98e[_0x369d('0x57')]])[_0x369d('0x49')](function(_0x3fe68c){ut[_0x369d('0x4a')](_0x369d('0x58'),_0x3fe68c);_0xab8c70(ut[_0x369d('0x36')](_0x369d('0x59')));})[_0x369d('0x3d')](function(_0x7ba3e5){ut[_0x369d('0x4a')](_0x369d('0x5a'),_0x7ba3e5);updateStatus(_0x56c98e);_0xde27de(ut['message'](_0x369d('0x5b')));});});};Fax['prototype'][_0x369d('0x5c')]=function(_0x2ecc06){var _0x2492fb=this;return new BPromise(function(_0x38efd7,_0x23dcd9){var _0x561331=_0x2492fb[_0x369d('0x5d')](_0x2492fb['faxAccounts'][_0x2ecc06['FaxAccountId']][_0x369d('0x5e')],_0x2ecc06);if(_0x561331[_0x369d('0x5f')]){_0x38efd7(ut[_0x369d('0x36')](_0x369d('0x60')));}else{_0x23dcd9(ut[_0x369d('0x36')](_0x561331[_0x369d('0x36')]));}});};function originate(_0x341d93,_0x11ac7d,_0x55a811){return new BPromise(function(_0x461782,_0x24e70d){if(_0x55a811){var _0x4c741d=util[_0x369d('0x61')](_0x369d('0x62'),path[_0x369d('0x38')](_0x341d93['path'])[_0x369d('0x24')],_0x341d93['path']);gs[_0x369d('0x63')](_0x4c741d)[_0x369d('0x49')](function(){_0x341d93[_0x369d('0x4')]=util[_0x369d('0x61')](_0x369d('0x64'),path[_0x369d('0x38')](_0x341d93[_0x369d('0x4')])['dir'],path[_0x369d('0x38')](_0x341d93[_0x369d('0x4')])['name']);_0x11ac7d[_0x369d('0x65')]=_0x341d93['path'];ut[_0x369d('0x4a')](_0x369d('0x66'),'');ami[_0x369d('0x67')](ut['variablesAction'](_0x341d93,_0x11ac7d))[_0x369d('0x49')](function(_0x2cbe15){_0x461782(_0x2cbe15);})['catch'](function(_0x8740ed){_0x24e70d(_0x8740ed);});})[_0x369d('0x3d')](function(_0xb94d21){_0x24e70d(_0xb94d21);});}else{ami['Action'](ut[_0x369d('0x68')](_0x341d93,_0x11ac7d))[_0x369d('0x49')](function(_0x3db9b9){_0x461782(_0x3db9b9);})[_0x369d('0x3d')](function(_0x46c137){_0x24e70d(_0x46c137);});}});}Fax['prototype'][_0x369d('0x56')]=function(_0xa05657,_0x45fadd){var _0x4560d8=this;return new BPromise(function(_0x1e0a41,_0x5ebc42){var _0x586972=uuid['v4']();var _0x3c8615=ut[_0x369d('0x69')](_0xa05657,_0x45fadd);_0x4560d8[_0x369d('0xf')][_0x586972]=new Action(_0x586972,_0x45fadd,_0xa05657);var _0x11b348=_0x4560d8[_0x369d('0xf')][_0x586972];if(path[_0x369d('0x38')](_0xa05657['path'])[_0x369d('0x6a')]===_0x369d('0x39')){originate(_0x11b348,_0x3c8615,!![])['then'](function(_0x6c8235){_0x1e0a41(_0x6c8235);})['catch'](function(_0x4936eb){_0x5ebc42(_0x4936eb);});}else{originate(_0x11b348,_0x3c8615,![])['then'](function(_0x2b791a){_0x1e0a41(_0x2b791a);})[_0x369d('0x3d')](function(_0x5b2c2f){_0x5ebc42(_0x5b2c2f);});}});};Fax[_0x369d('0x1c')]['isTrunkReachable']=function(_0x26faf4){return!_['isNil'](_0x26faf4)&&!_['isNil'](_0x26faf4[_0x369d('0x24')])&&!_[_0x369d('0x6b')](_0x26faf4[_0x369d('0x6c')])&&_0x26faf4[_0x369d('0x6c')]&&!_[_0x369d('0x6b')](this['trunks'][util[_0x369d('0x61')](_0x369d('0x6d'),_0x26faf4[_0x369d('0x24')])])&&!_[_0x369d('0x6b')](this[_0x369d('0xe')][util[_0x369d('0x61')](_0x369d('0x6d'),_0x26faf4[_0x369d('0x24')])][_0x369d('0x2b')])&&(this['trunks'][util[_0x369d('0x61')](_0x369d('0x6d'),_0x26faf4[_0x369d('0x24')])][_0x369d('0x2b')]==='reachable'||this[_0x369d('0xe')][util['format'](_0x369d('0x6d'),_0x26faf4[_0x369d('0x24')])][_0x369d('0x2b')]===_0x369d('0x6e'));};Fax[_0x369d('0x1c')][_0x369d('0x5d')]=function(_0x3fa663,_0x3582fe){if(!this[_0x369d('0x6f')](_0x3fa663)){ut[_0x369d('0x4a')](_0x369d('0x70'),_[_0x369d('0x6b')](_0x3fa663)?'':_0x3fa663[_0x369d('0x24')]+_0x369d('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x369d('0x6b')](_0x3582fe['fax'])){ut['logger'](_0x369d('0x72'),JSON[_0x369d('0x40')](_0x3582fe));return{'isValid':![],'message':_0x369d('0x73')};}if(_[_0x369d('0x6b')](_0x3582fe[_0x369d('0x4')])){ut[_0x369d('0x4a')](_0x369d('0x74'),JSON[_0x369d('0x40')](_0x3582fe));return{'isValid':![],'message':_0x369d('0x75')};}return{'isValid':!![],'message':_0x369d('0x76')};};module[_0x369d('0x77')]=Fax; \ No newline at end of file +var _0xe605=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','syncNewState','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','%s/%s.tif'];(function(_0x5cfb59,_0x298da0){var _0x332909=function(_0x5940b4){while(--_0x5940b4){_0x5cfb59['push'](_0x5cfb59['shift']());}};_0x332909(++_0x298da0);}(_0xe605,0x92));var _0x5e60=function(_0x2e45d1,_0x83d5c){_0x2e45d1=_0x2e45d1-0x0;var _0x4e9442=_0xe605[_0x2e45d1];return _0x4e9442;};'use strict';var util=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var path=require(_0x5e60('0x4'));var tiff2pdf=require(_0x5e60('0x5'));var gs=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var ami=require(_0x5e60('0x9'));var rpcDb=require(_0x5e60('0xa'));var Channel=require(_0x5e60('0xb'));var ut=require(_0x5e60('0xc'));var Action=require(_0x5e60('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5e60('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x593118){this['channels']={};this[_0x5e60('0xf')]=_0x593118[_0x5e60('0xf')];this[_0x5e60('0x10')]=_0x593118[_0x5e60('0x10')];this[_0x5e60('0x11')]={};ami['on'](_0x5e60('0x12'),this['syncNewchannel'][_0x5e60('0x13')](this));ami['on']('varset',this[_0x5e60('0x14')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x15'),this['syncNewState'][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x16'),this[_0x5e60('0x17')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x18'),this[_0x5e60('0x19')]['bind'](this));ami['on'](_0x5e60('0x1a'),this[_0x5e60('0x1b')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x1c'),this['syncHangup'][_0x5e60('0x13')](this));ami['on']('originateresponse',this[_0x5e60('0x1d')][_0x5e60('0x13')](this));}Fax['prototype'][_0x5e60('0x1e')]=function(_0x3e1a44){if(_0x3e1a44[_0x5e60('0x1f')]===_0x5e60('0x20')){for(var _0x5c485d in this[_0x5e60('0xf')]){if(this[_0x5e60('0xf')]['hasOwnProperty'](_0x5c485d)){if(_0x3e1a44[_0x5e60('0x21')]===this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x22')]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]['id']=this['faxAccounts'][_0x5c485d]['id'];this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x26')]=this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x26')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],_0x5e60('0x28'));}}}}if(this[_0x5e60('0x11')][_0x3e1a44['uniqueid']]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x5e60('0x29')]['syncVarSet']=function(_0x23d187){if(this[_0x5e60('0x23')][_0x23d187['uniqueid']]){for(var _0x46691f in _0x23d187[_0x5e60('0x2a')]){if(_0x23d187['variable'][_0x5e60('0x2b')](_0x46691f)){this[_0x5e60('0x23')][_0x23d187['uniqueid']][_0x46691f]=_0x23d187['value'];}}}};Fax['prototype'][_0x5e60('0x2c')]=function(_0x235cc7){if(this[_0x5e60('0x23')][_0x235cc7[_0x5e60('0x24')]]){this[_0x5e60('0x23')][_0x235cc7['uniqueid']][_0x5e60('0x2d')]=_0x235cc7[_0x5e60('0x2d')];this['channels'][_0x235cc7[_0x5e60('0x24')]]['channelstatedesc']=_0x235cc7['channelstatedesc'];}};Fax[_0x5e60('0x29')][_0x5e60('0x17')]=function(_0x1f474b){if(this[_0x5e60('0x23')][_0x1f474b[_0x5e60('0x24')]]){for(var _0xbf5b7a in _0x1f474b[_0x5e60('0x2a')]){if(_0x1f474b[_0x5e60('0x2a')][_0x5e60('0x2b')](_0xbf5b7a)){this[_0x5e60('0x23')][_0x1f474b['uniqueid']][_0xbf5b7a]=_0x1f474b[_0x5e60('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x478415){if(this[_0x5e60('0x23')][_0x478415['uniqueid']]){this[_0x5e60('0x23')][_0x478415['uniqueid']][_0x5e60('0x2f')]=_0x478415[_0x5e60('0x2f')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x30')]=_0x478415[_0x5e60('0x30')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]]['localstationid']=_0x478415[_0x5e60('0x22')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x31')]=_0x478415[_0x5e60('0x31')];logger[_0x5e60('0x27')](_0x478415[_0x5e60('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x5e60('0x29')][_0x5e60('0x1b')]=function(_0x4cba18){var _0x532ab2=this;if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]){var _0x1ae294=this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['id'];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x32')]=_0x4cba18[_0x5e60('0x32')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]=_0x4cba18[_0x5e60('0x33')];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x22')]=_0x4cba18['localstationid'];this['channels'][_0x4cba18['uniqueid']][_0x5e60('0x34')]=_0x4cba18[_0x5e60('0x34')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['transferrate']=_0x4cba18[_0x5e60('0x35')];this[_0x5e60('0x23')][_0x4cba18['uniqueid']]['filename']=_0x4cba18[_0x5e60('0x31')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x36')]=_0x4cba18[_0x5e60('0x36')];if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]>0x0){tiff2pdf(_0x4cba18[_0x5e60('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x284e66){logger[_0x5e60('0x27')](_0x4cba18['uniqueid'],_0x5e60('0x37'),_0x284e66[_0x5e60('0x38')]);attachment[_0x5e60('0x39')]({'name':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])['name'],'basename':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+_0x5e60('0x3b'),'type':'application/pdf'})['then'](function(_0x5b9f5a){faxAccount[_0x5e60('0x3c')](_0x1ae294,{'from':_0x4cba18[_0x5e60('0x36')],'mapKey':_0x5e60('0x8'),'body':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+'.pdf','AttachmentId':_0x5b9f5a['id']})[_0x5e60('0x3d')](function(_0x1c48d0){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x3f'),JSON[_0x5e60('0x40')](_0x1c48d0));});})[_0x5e60('0x3d')](function(_0x4acd96){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'),JSON[_0x5e60('0x40')](_0x4acd96));});});}logger[_0x5e60('0x27')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'));}};Fax[_0x5e60('0x29')][_0x5e60('0x1d')]=function(_0x350d6d){if(this[_0x5e60('0x11')][_0x350d6d[_0x5e60('0x24')]]){_[_0x5e60('0x42')](this[_0x5e60('0x23')][_0x350d6d[_0x5e60('0x24')]],_[_0x5e60('0x43')](_0x350d6d,[_0x5e60('0x44'),_0x5e60('0x45')]));}};function updateStatus(_0x54479d){if(_0x54479d['AttachmentId']){faxMessage[_0x5e60('0x46')](_0x54479d['AttachmentId'],{'failMessage':_0x5e60('0x47')})[_0x5e60('0x48')](function(_0x20d6e6){ut[_0x5e60('0x49')](_0x5e60('0x4a'),_0x20d6e6);})[_0x5e60('0x3d')](function(_0x4b72a4){ut['logger'](_0x5e60('0x4b'),_0x4b72a4);});}else{ut[_0x5e60('0x49')](_0x5e60('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x31ced8,_0x46f3ba,_0x179cc6){var _0x501b87=this;var _0x1a3ed9={};if(_0x46f3ba){_0x1a3ed9={'read':_0x46f3ba};}else{_0x1a3ed9={'failMessage':_0x179cc6};}if(this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')]){faxMessage[_0x5e60('0x46')](this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')],_0x1a3ed9)['then'](function(_0x412be1){ut[_0x5e60('0x49')]('[Fax][Message][Updated]',_0x412be1);})[_0x5e60('0x3d')](function(_0x3f6a1e){ut[_0x5e60('0x49')]('[Fax][Message][NoUpdate1]',_0x3f6a1e);})[_0x5e60('0x4e')](function(){delete _0x501b87[_0x5e60('0x23')][_0x31ced8];delete _0x501b87['actions'][_0x31ced8];});}else{ut[_0x5e60('0x49')](_0x5e60('0x4f'));delete this[_0x5e60('0x23')][_0x31ced8];delete this[_0x5e60('0x11')][_0x31ced8];}};Fax['prototype'][_0x5e60('0x50')]=function(_0x1abc43){var _0x4ded96=this;if(this[_0x5e60('0x23')][_0x1abc43['uniqueid']]){if(this[_0x5e60('0x11')][_0x1abc43['uniqueid']]){this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['id']=this['actions'][_0x1abc43[_0x5e60('0x24')]]['id'];this['channels'][_0x1abc43[_0x5e60('0x24')]]['name']=this[_0x5e60('0x11')][_0x1abc43['uniqueid']][_0x5e60('0x26')];}logger[_0x5e60('0x27')](_0x1abc43[_0x5e60('0x24')],this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]?_0x5e60('0x51'):_0x5e60('0x52'),JSON['stringify'](this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]));if(this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]){if(this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['faxpages']>0x0&&this['channels'][_0x1abc43['uniqueid']][_0x5e60('0x18')]===_0x5e60('0x53')){this['updateStatus'](_0x1abc43[_0x5e60('0x24')],!![]);}else{this[_0x5e60('0x54')](_0x1abc43['uniqueid'],![],this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]?_0x5e60('0x56')+this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]:_0x5e60('0x57'));}}}};Fax[_0x5e60('0x29')][_0x5e60('0x58')]=function(_0x157aad){var _0x15921d=this;return new BPromise(function(_0xc5f45,_0x2826f7){_0x15921d[_0x5e60('0x59')](_0x157aad,_0x15921d[_0x5e60('0xf')][_0x157aad[_0x5e60('0x5a')]])['then'](function(_0x922817){ut[_0x5e60('0x49')](_0x5e60('0x5b'),_0x922817);_0xc5f45(ut['message'](_0x5e60('0x5c')));})[_0x5e60('0x3d')](function(_0x58376d){ut[_0x5e60('0x49')](_0x5e60('0x5d'),_0x58376d);updateStatus(_0x157aad);_0x2826f7(ut['message'](_0x5e60('0x5e')));});});};Fax[_0x5e60('0x29')][_0x5e60('0x5f')]=function(_0xd9a0db){var _0x1db659=this;return new BPromise(function(_0x711888,_0x221f35){var _0x3b5493=_0x1db659[_0x5e60('0x60')](_0x1db659['faxAccounts'][_0xd9a0db[_0x5e60('0x5a')]][_0x5e60('0x61')],_0xd9a0db);if(_0x3b5493[_0x5e60('0x62')]){_0x711888(ut['message'](_0x5e60('0x63')));}else{_0x221f35(ut[_0x5e60('0x38')](_0x3b5493[_0x5e60('0x38')]));}});};function originate(_0x15d975,_0x3e85fe,_0x559f8c){return new BPromise(function(_0x4560e1,_0x213c7e){if(_0x559f8c){var _0x3463a7=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')],_0x15d975[_0x5e60('0x4')]);gs[_0x5e60('0x64')](_0x3463a7)[_0x5e60('0x48')](function(){_0x15d975[_0x5e60('0x4')]=util['format'](_0x5e60('0x65'),path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])['dir'],path['parse'](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')]);_0x3e85fe[_0x5e60('0x66')]=_0x15d975['path'];ut['logger'](_0x5e60('0x67'),'');ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x42c62d){_0x4560e1(_0x42c62d);})[_0x5e60('0x3d')](function(_0x4a1e15){_0x213c7e(_0x4a1e15);});})[_0x5e60('0x3d')](function(_0x406a74){_0x213c7e(_0x406a74);});}else{ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x1750b5){_0x4560e1(_0x1750b5);})[_0x5e60('0x3d')](function(_0x92d9c5){_0x213c7e(_0x92d9c5);});}});}Fax[_0x5e60('0x29')]['execOriginate']=function(_0x34cfa7,_0x136464){var _0x48570a=this;return new BPromise(function(_0x306e7c,_0x26508b){var _0x530a21=uuid['v4']();var _0x312ae3=ut[_0x5e60('0x6a')](_0x34cfa7,_0x136464);_0x48570a[_0x5e60('0x11')][_0x530a21]=new Action(_0x530a21,_0x136464,_0x34cfa7);var _0x1b4aee=_0x48570a[_0x5e60('0x11')][_0x530a21];if(path[_0x5e60('0x3a')](_0x34cfa7['path'])[_0x5e60('0x6b')]===_0x5e60('0x3b')){originate(_0x1b4aee,_0x312ae3,!![])[_0x5e60('0x48')](function(_0x222d94){_0x306e7c(_0x222d94);})[_0x5e60('0x3d')](function(_0xd70e8f){_0x26508b(_0xd70e8f);});}else{originate(_0x1b4aee,_0x312ae3,![])[_0x5e60('0x48')](function(_0x3f6bb2){_0x306e7c(_0x3f6bb2);})[_0x5e60('0x3d')](function(_0x58e900){_0x26508b(_0x58e900);});}});};Fax[_0x5e60('0x29')][_0x5e60('0x6c')]=function(_0x71d909){return!_[_0x5e60('0x6d')](_0x71d909)&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x26')])&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x6e')])&&_0x71d909[_0x5e60('0x6e')]&&!_[_0x5e60('0x6d')](this['trunks'][util['format']('SIP/%s',_0x71d909[_0x5e60('0x26')])])&&!_[_0x5e60('0x6d')](this[_0x5e60('0x10')][util[_0x5e60('0x6f')](_0x5e60('0x70'),_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')])&&(this[_0x5e60('0x10')][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')]===_0x5e60('0x71')||this['trunks'][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909['name'])]['status']===_0x5e60('0x72'));};Fax[_0x5e60('0x29')][_0x5e60('0x60')]=function(_0x148c53,_0x445e6a){if(!this[_0x5e60('0x6c')](_0x148c53)){ut[_0x5e60('0x49')](_0x5e60('0x73'),_[_0x5e60('0x6d')](_0x148c53)?'':_0x148c53['name']+_0x5e60('0x74'));return{'isValid':![],'message':_0x5e60('0x75')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x8')])){ut[_0x5e60('0x49')](_0x5e60('0x76'),JSON[_0x5e60('0x40')](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x77')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x4')])){ut[_0x5e60('0x49')](_0x5e60('0x78'),JSON['stringify'](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x79')};}return{'isValid':!![],'message':_0x5e60('0x7a')};};module[_0x5e60('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 21b89d0..3105e72 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 _0xd20d=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd20d,0x123));var _0xdd20=function(_0x3a33f5,_0x296b4e){_0x3a33f5=_0x3a33f5-0x0;var _0x205a56=_0xd20d[_0x3a33f5];return _0x205a56;};'use strict';var util=require(_0xdd20('0x0'));var BPromise=require(_0xdd20('0x1'));var logger=require(_0xdd20('0x2'))('preview');var _=require(_0xdd20('0x3'));var faxAccount=require(_0xdd20('0x4'));function loggerCatch(_0x55807b){return function(_0x523a0){logger[_0xdd20('0x5')](_0x55807b,util[_0xdd20('0x6')](_0x523a0,{'showHidden':![],'depth':null}));};}exports[_0xdd20('0x7')]=function(_0x8338af,_0x48faaf){return BPromise[_0xdd20('0x8')]()[_0xdd20('0x9')](faxAccount[_0xdd20('0x7')](_0x8338af,_0x48faaf))[_0xdd20('0xa')](loggerCatch(_0xdd20('0xb')));}; \ No newline at end of file +var _0x5f44=['[Notify]\x20','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch'];(function(_0x4e9348,_0x5eca73){var _0x50cafa=function(_0x14d364){while(--_0x14d364){_0x4e9348['push'](_0x4e9348['shift']());}};_0x50cafa(++_0x5eca73);}(_0x5f44,0xa6));var _0x45f4=function(_0x4356b9,_0x1dd962){_0x4356b9=_0x4356b9-0x0;var _0x45bb1e=_0x5f44[_0x4356b9];return _0x45bb1e;};'use strict';var util=require('util');var BPromise=require(_0x45f4('0x0'));var logger=require('../../../config/logger')(_0x45f4('0x1'));var _=require(_0x45f4('0x2'));var faxAccount=require(_0x45f4('0x3'));function loggerCatch(_0x4886f1){return function(_0x2773f6){logger[_0x45f4('0x4')](_0x4886f1,util[_0x45f4('0x5')](_0x2773f6,{'showHidden':![],'depth':null}));};}exports[_0x45f4('0x6')]=function(_0x7f9258,_0x730ca9){return BPromise[_0x45f4('0x7')]()[_0x45f4('0x8')](faxAccount[_0x45f4('0x6')](_0x7f9258,_0x730ca9))[_0x45f4('0x9')](loggerCatch(_0x45f4('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 56a4c2d..ada9572 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 _0x37fd=['../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x287fe0,_0x3a4b91){var _0x591669=function(_0x27da45){while(--_0x27da45){_0x287fe0['push'](_0x287fe0['shift']());}};_0x591669(++_0x3a4b91);}(_0x37fd,0x7d));var _0xd37f=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0x37fd[_0x140d2f];return _0x1a04c6;};'use strict';var util=require(_0xd37f('0x0'));var logger=require(_0xd37f('0x1'))(_0xd37f('0x2'));var BPromise=require(_0xd37f('0x3'));var exec=require(_0xd37f('0x4'))['exec'];exports[_0xd37f('0x5')]=function(_0x1ca1f4){return new BPromise(function(_0x4032dc,_0x55fc5b){exec(_0x1ca1f4,function(_0x19242c,_0x110dc2,_0x30aa50){logger[_0xd37f('0x6')](_0xd37f('0x7'),_0x110dc2);if(_0x19242c){logger[_0xd37f('0x6')](_0xd37f('0x7'),_0xd37f('0x8'),util['inspect'](_0x19242c,{'showHidden':![],'depth':null}),_0x110dc2,_0x30aa50);_0x55fc5b(_0x19242c);}_0x4032dc(_0x110dc2);});});}; \ No newline at end of file +var _0xb5a5=['util','bluebird','child_process','info','Exec\x20gs','inspect'];(function(_0x592a41,_0x379e90){var _0x54eec5=function(_0x37416a){while(--_0x37416a){_0x592a41['push'](_0x592a41['shift']());}};_0x54eec5(++_0x379e90);}(_0xb5a5,0x192));var _0x5b5a=function(_0x19b67f,_0x42d1c7){_0x19b67f=_0x19b67f-0x0;var _0x57e9d9=_0xb5a5[_0x19b67f];return _0x57e9d9;};'use strict';var util=require(_0x5b5a('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x5b5a('0x1'));var exec=require(_0x5b5a('0x2'))['exec'];exports['execute']=function(_0x38c118){return new BPromise(function(_0x4c6730,_0x1d771a){exec(_0x38c118,function(_0x35a625,_0x2590a0,_0x38ddc0){logger[_0x5b5a('0x3')](_0x5b5a('0x4'),_0x2590a0);if(_0x35a625){logger['info'](_0x5b5a('0x4'),'\x20Error\x20:',util[_0x5b5a('0x5')](_0x35a625,{'showHidden':![],'depth':null}),_0x2590a0,_0x38ddc0);_0x1d771a(_0x35a625);}_0x4c6730(_0x2590a0);});});}; \ 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 304881d..3740a88 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 _0x6469=['t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','moment','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6469,0x110));var _0x9646=function(_0x10cc01,_0x2984bd){_0x10cc01=_0x10cc01-0x0;var _0x465a0e=_0x6469[_0x10cc01];return _0x465a0e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9646('0x0'));var logger=require(_0x9646('0x1'))('fax');exports[_0x9646('0x2')]=function(_0x4bc845){return{'message':_0x4bc845};};exports[_0x9646('0x3')]=function(_0x533696,_0x2fa2fb){logger[_0x9646('0x4')](_0x533696,util[_0x9646('0x5')](_0x2fa2fb,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x215f2e,_0x1ef873){var _0x1ba6ab={'XMF-ECM':_0x1ef873[_0x9646('0x6')],'XMF-HEADERINFO':_0x1ef873[_0x9646('0x7')],'XMF-MINRATE':_0x1ef873[_0x9646('0x8')],'XMF-MAXRATE':_0x1ef873[_0x9646('0x9')],'XMF-MODEM':util[_0x9646('0xa')](_0x9646('0xb'),_0x1ef873[_0x9646('0xc')]),'XMF-GATEWAY':_0x1ef873['gateway'],'XMF-FAXDETECT':_0x1ef873[_0x9646('0xd')],'XMF-T38TIMEOUT':_0x1ef873[_0x9646('0xe')],'XMF-LOCALSTATIONID':_0x1ef873[_0x9646('0xf')],'XMF-PATH':_0x215f2e[_0x9646('0x10')]};return _0x1ba6ab;};exports[_0x9646('0x11')]=function(_0x1e609c,_0x1b7c3f){return{'actionid':_0x1e609c[_0x9646('0x12')],'action':_0x9646('0x13'),'channel':_0x1e609c['channel'],'Exten':_0x9646('0x14'),'Context':_0x9646('0x15'),'Priority':'1','callerid':util[_0x9646('0xa')]('\x22%s\x22\x20<%s>',_0x1e609c['headerinfo']?_0x1e609c['headerinfo']:'',_0x1e609c['localstationid']),'variable':_0x1b7c3f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1e609c['uniqueid']};}; \ No newline at end of file +var _0x3bbf=['originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','../../../../config/logger','fax','message','logger','inspect','ecm','maxrate','format','\x22%s\x22','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid'];(function(_0x2199e9,_0x48898b){var _0x1d1983=function(_0x1e9ccc){while(--_0x1e9ccc){_0x2199e9['push'](_0x2199e9['shift']());}};_0x1d1983(++_0x48898b);}(_0x3bbf,0x140));var _0xf3bb=function(_0x5cbdfa,_0x2b4bed){_0x5cbdfa=_0x5cbdfa-0x0;var _0x3d8f90=_0x3bbf[_0x5cbdfa];return _0x3d8f90;};'use strict';var util=require(_0xf3bb('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xf3bb('0x1'))(_0xf3bb('0x2'));exports[_0xf3bb('0x3')]=function(_0x1db421){return{'message':_0x1db421};};exports[_0xf3bb('0x4')]=function(_0x50b69a,_0x46327a){logger['info'](_0x50b69a,util[_0xf3bb('0x5')](_0x46327a,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4a20f5,_0x465df0){var _0x4b5606={'XMF-ECM':_0x465df0[_0xf3bb('0x6')],'XMF-HEADERINFO':_0x465df0['headerinfo'],'XMF-MINRATE':_0x465df0['minrate'],'XMF-MAXRATE':_0x465df0[_0xf3bb('0x7')],'XMF-MODEM':util[_0xf3bb('0x8')](_0xf3bb('0x9'),_0x465df0['modem']),'XMF-GATEWAY':_0x465df0['gateway'],'XMF-FAXDETECT':_0x465df0[_0xf3bb('0xa')],'XMF-T38TIMEOUT':_0x465df0[_0xf3bb('0xb')],'XMF-LOCALSTATIONID':_0x465df0[_0xf3bb('0xc')],'XMF-PATH':_0x4a20f5[_0xf3bb('0xd')]};return _0x4b5606;};exports[_0xf3bb('0xe')]=function(_0xeb9f84,_0x48103b){return{'actionid':_0xeb9f84[_0xf3bb('0xf')],'action':_0xf3bb('0x10'),'channel':_0xeb9f84[_0xf3bb('0x11')],'Exten':_0xf3bb('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xf3bb('0x8')](_0xf3bb('0x13'),_0xeb9f84[_0xf3bb('0x14')]?_0xeb9f84[_0xf3bb('0x14')]:'',_0xeb9f84['localstationid']),'variable':_0x48103b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xeb9f84[_0xf3bb('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 40f60bb..998b93b 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 _0x99f9=['ami','get','hour','initAgents','then','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getZohoAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','catch','[index.js][main]','util','moment','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger'];(function(_0x326acc,_0x1b2638){var _0x302fa2=function(_0xe38a75){while(--_0xe38a75){_0x326acc['push'](_0x326acc['shift']());}};_0x302fa2(++_0x1b2638);}(_0x99f9,0x118));var _0x999f=function(_0x49e168,_0x1ba140){_0x49e168=_0x49e168-0x0;var _0xccb8f3=_0x99f9[_0x49e168];return _0xccb8f3;};'use strict';var BPromise=require('bluebird');var util=require(_0x999f('0x0'));var moment=require(_0x999f('0x1'));var server=require('./server');var Realtime=require(_0x999f('0x2'));var Report=require('./report');var Acw=require(_0x999f('0x3'));var Trigger=require(_0x999f('0x4'));var Dialer=require(_0x999f('0x5'));var Preview=require(_0x999f('0x6'));var Fax=require(_0x999f('0x7'));var user=require(_0x999f('0x8'));var voiceQueue=require(_0x999f('0x9'));var voiceQueueReport=require(_0x999f('0xa'));var voiceCallReport=require(_0x999f('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x999f('0xc'));var cmHopperHistory=require(_0x999f('0xd'));var campaign=require(_0x999f('0xe'));var voiceExtension=require(_0x999f('0xf'));var faxAccount=require(_0x999f('0x10'));var zendesk=require(_0x999f('0x11'));var salesforce=require(_0x999f('0x12'));var sugarcrm=require(_0x999f('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x999f('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x999f('0x15'));var freshsales=require(_0x999f('0x16'));var servicenow=require(_0x999f('0x17'));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(_0x999f('0x18'))(_0x999f('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x999f('0x1a')](_0x999f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user['getAgents']())['then'](realtime[_0x999f('0x1c')]())[_0x999f('0x1d')](user['getTelephones']())[_0x999f('0x1d')](realtime[_0x999f('0x1e')]())[_0x999f('0x1d')](trunk[_0x999f('0x1f')]())[_0x999f('0x1d')](realtime[_0x999f('0x20')]())[_0x999f('0x1d')](voiceQueue[_0x999f('0x21')]())[_0x999f('0x1d')](realtime[_0x999f('0x22')]())['then'](trigger[_0x999f('0x23')]())[_0x999f('0x1d')](realtime[_0x999f('0x24')]())[_0x999f('0x1d')](template[_0x999f('0x25')]())[_0x999f('0x1d')](realtime[_0x999f('0x26')]())[_0x999f('0x1d')](zendesk['getZendeskAccounts']())[_0x999f('0x1d')](realtime[_0x999f('0x27')]())[_0x999f('0x1d')](salesforce[_0x999f('0x28')]())['then'](realtime[_0x999f('0x29')]())[_0x999f('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x999f('0x1d')](realtime[_0x999f('0x2a')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x999f('0x1d')](realtime['initFreshdeskAccounts']())[_0x999f('0x1d')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x999f('0x1d')](zoho[_0x999f('0x2b')]())['then'](realtime['initZohoAccounts']())[_0x999f('0x1d')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x999f('0x1d')](freshsales['getFreshsalesAccounts']())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x999f('0x2c')]())[_0x999f('0x1d')](realtime['initServicenowAccounts']())[_0x999f('0x1d')](dynamics365[_0x999f('0x2d')]())[_0x999f('0x1d')](realtime[_0x999f('0x2e')]())[_0x999f('0x1d')](campaign['getCampaigns']())[_0x999f('0x1d')](realtime[_0x999f('0x2f')]())[_0x999f('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x999f('0x30')]())['then'](faxAccount[_0x999f('0x31')]())['then'](realtime['initFaxAccounts']())[_0x999f('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x999f('0x32')]())[_0x999f('0x1d')](realtime[_0x999f('0x33')]())[_0x999f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x999f('0x1d')](realtime[_0x999f('0x34')]())[_0x999f('0x1d')](cmHopperHistory[_0x999f('0x35')]())[_0x999f('0x1d')](realtime[_0x999f('0x36')]())[_0x999f('0x1d')](voiceCallReport[_0x999f('0x37')]())['then'](realtime[_0x999f('0x38')]())['catch'](function(_0x1a6afc){logger[_0x999f('0x39')]('[index.js][initParams]',util[_0x999f('0x3a')](_0x1a6afc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x2ad1c6){return initRealtime();})[_0x999f('0x1d')](function(){return initParams();})[_0x999f('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x999f('0x3b')](function(_0x1bdcfe){logger[_0x999f('0x39')](_0x999f('0x3c'),util[_0x999f('0x3a')](_0x1bdcfe,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4dd7=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','[index.js][main]','bluebird','util','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','then','getAgents','initAgents','getTelephones'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4dd7,0x6b));var _0x74dd=function(_0x571ef1,_0x12fa6e){_0x571ef1=_0x571ef1-0x0;var _0x4ff41f=_0x4dd7[_0x571ef1];return _0x4ff41f;};'use strict';var BPromise=require(_0x74dd('0x0'));var util=require(_0x74dd('0x1'));var moment=require('moment');var server=require(_0x74dd('0x2'));var Realtime=require(_0x74dd('0x3'));var Report=require('./report');var Acw=require(_0x74dd('0x4'));var Trigger=require(_0x74dd('0x5'));var Dialer=require(_0x74dd('0x6'));var Preview=require(_0x74dd('0x7'));var Fax=require(_0x74dd('0x8'));var user=require(_0x74dd('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x74dd('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x74dd('0xb'));var trigger=require(_0x74dd('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x74dd('0xd'));var campaign=require(_0x74dd('0xe'));var voiceExtension=require(_0x74dd('0xf'));var faxAccount=require(_0x74dd('0x10'));var zendesk=require(_0x74dd('0x11'));var salesforce=require(_0x74dd('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x74dd('0x13'));var desk=require(_0x74dd('0x14'));var zoho=require(_0x74dd('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x74dd('0x16'));var servicenow=require(_0x74dd('0x17'));var dynamics365=require(_0x74dd('0x18'));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(_0x74dd('0x19'))(_0x74dd('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x74dd('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x74dd('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x74dd('0x1c')]()[_0x74dd('0x1d')](user[_0x74dd('0x1e')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x1f')]())['then'](user[_0x74dd('0x20')]())[_0x74dd('0x1d')](realtime['initTelephones']())['then'](trunk['getTrunks']())['then'](realtime[_0x74dd('0x21')]())[_0x74dd('0x1d')](voiceQueue[_0x74dd('0x22')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x23')]())['then'](trigger[_0x74dd('0x24')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x25')]())[_0x74dd('0x1d')](template[_0x74dd('0x26')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x27')]())[_0x74dd('0x1d')](zendesk[_0x74dd('0x28')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x29')]())[_0x74dd('0x1d')](salesforce[_0x74dd('0x2a')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x2b')]())[_0x74dd('0x1d')](sugarcrm[_0x74dd('0x2c')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x2d')]())[_0x74dd('0x1d')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x74dd('0x2e')]())['then'](desk[_0x74dd('0x2f')]())['then'](realtime[_0x74dd('0x30')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0x74dd('0x31')]())['then'](vtiger[_0x74dd('0x32')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x33')]())[_0x74dd('0x1d')](freshsales[_0x74dd('0x34')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x35')]())['then'](servicenow['getServicenowAccounts']())[_0x74dd('0x1d')](realtime['initServicenowAccounts']())[_0x74dd('0x1d')](dynamics365[_0x74dd('0x36')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x37')]())[_0x74dd('0x1d')](campaign[_0x74dd('0x38')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x39')]())[_0x74dd('0x1d')](voiceExtension['getVoiceExtensions']())[_0x74dd('0x1d')](realtime[_0x74dd('0x3a')]())['then'](faxAccount[_0x74dd('0x3b')]())['then'](realtime[_0x74dd('0x3c')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x74dd('0x1c')]()[_0x74dd('0x1d')](voiceQueueReport[_0x74dd('0x3d')]())['then'](realtime[_0x74dd('0x3e')]())[_0x74dd('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x74dd('0x1d')](realtime[_0x74dd('0x3f')]())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x74dd('0x1d')](voiceCallReport[_0x74dd('0x40')]())[_0x74dd('0x1d')](realtime[_0x74dd('0x41')]())[_0x74dd('0x42')](function(_0x4a4276){logger[_0x74dd('0x43')]('[index.js][initParams]',util['inspect'](_0x4a4276,{'showHidden':![],'depth':null}));});}function main(){return server[_0x74dd('0x44')](realtime,preview,fax)[_0x74dd('0x1d')](function(_0x1d1ec6){return initRealtime();})[_0x74dd('0x1d')](function(){return initParams();})[_0x74dd('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x74dd('0x42')](function(_0x5eb6a8){logger[_0x74dd('0x43')](_0x74dd('0x45'),util['inspect'](_0x5eb6a8,{'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 bf2b1a5..838330e 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x210b26,_0x220e39){var _0x50f135=function(_0x182903){while(--_0x182903){_0x210b26['push'](_0x210b26['shift']());}};_0x50f135(++_0x220e39);}(_0x70e0,0x17b));var _0x070e=function(_0x5ec31a,_0x8ff212){_0x5ec31a=_0x5ec31a-0x0;var _0x3e4d9d=_0x70e0[_0x5ec31a];return _0x3e4d9d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x35f522,_0x4533c3){var _0x571712=function(_0x4ca2ce){while(--_0x4ca2ce){_0x35f522['push'](_0x35f522['shift']());}};_0x571712(++_0x4533c3);}(_0xe706,0xa3));var _0x6e70=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xe706[_0x274dd7];return _0x148829;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 96aec38..922add6 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 _0x4f1c=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency'];(function(_0x434fee,_0x5ab0a0){var _0x320a46=function(_0x170e79){while(--_0x170e79){_0x434fee['push'](_0x434fee['shift']());}};_0x320a46(++_0x5ab0a0);}(_0x4f1c,0xd9));var _0xc4f1=function(_0x22e2af,_0xb3bb1e){_0x22e2af=_0x22e2af-0x0;var _0x19f455=_0x4f1c[_0x22e2af];return _0x19f455;};'use strict';function Campaign(_0x1d8c4b){this['id']=_0x1d8c4b['id']||0x0;this[_0xc4f1('0x0')]=_0x1d8c4b[_0xc4f1('0x0')]||'';this[_0xc4f1('0x1')]=_0x1d8c4b[_0xc4f1('0x1')]||'campaign';this[_0xc4f1('0x2')]=0x0;this[_0xc4f1('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc4f1('0x4')]=0x0;this[_0xc4f1('0x5')]='';this[_0xc4f1('0x6')]=!![];this[_0xc4f1('0x7')]=_0x1d8c4b[_0xc4f1('0x7')];this[_0xc4f1('0x8')]=_0x1d8c4b[_0xc4f1('0x8')];this[_0xc4f1('0x9')]=_0x1d8c4b[_0xc4f1('0x9')]||null;this['dialGlobalInterval']=_0x1d8c4b[_0xc4f1('0xa')]?_0x1d8c4b[_0xc4f1('0xa')]:null;this[_0xc4f1('0xb')]=_0x1d8c4b['dialOriginateCallerIdName'];this[_0xc4f1('0xc')]=_0x1d8c4b[_0xc4f1('0xc')];this[_0xc4f1('0xd')]=_0x1d8c4b[_0xc4f1('0xd')]||0x1e;this[_0xc4f1('0xe')]=_0x1d8c4b['dialCongestionMaxRetry'];this[_0xc4f1('0xf')]=_0x1d8c4b[_0xc4f1('0xf')];this[_0xc4f1('0x10')]=_0x1d8c4b[_0xc4f1('0x10')];this['dialBusyRetryFrequency']=_0x1d8c4b['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x1d8c4b[_0xc4f1('0x11')];this[_0xc4f1('0x12')]=_0x1d8c4b[_0xc4f1('0x12')];this[_0xc4f1('0x13')]=_0x1d8c4b[_0xc4f1('0x13')];this[_0xc4f1('0x14')]=_0x1d8c4b[_0xc4f1('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1d8c4b[_0xc4f1('0x15')]||0x96;this['dialDropMaxRetry']=_0x1d8c4b['dialDropMaxRetry']||0x3;this[_0xc4f1('0x16')]=_0x1d8c4b[_0xc4f1('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x1d8c4b[_0xc4f1('0x17')]||0x3;this[_0xc4f1('0x18')]=_0x1d8c4b[_0xc4f1('0x18')]||0x96;this[_0xc4f1('0x19')]=_0x1d8c4b[_0xc4f1('0x19')]||0x3;this[_0xc4f1('0x1a')]=_0x1d8c4b[_0xc4f1('0x1a')]||0x96;this[_0xc4f1('0x1b')]=_0x1d8c4b[_0xc4f1('0x1b')]||0x3;this[_0xc4f1('0x1c')]=_0x1d8c4b[_0xc4f1('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x1d8c4b[_0xc4f1('0x1d')]||_0xc4f1('0x1e');this[_0xc4f1('0x1f')]=_0x1d8c4b[_0xc4f1('0x1f')]||undefined;this[_0xc4f1('0x20')]=_0x1d8c4b[_0xc4f1('0x20')]||undefined;this['dialCutDigit']=_0x1d8c4b[_0xc4f1('0x21')]||undefined;this[_0xc4f1('0x22')]=_0x1d8c4b[_0xc4f1('0x22')]?_0x1d8c4b['TrunkBackup']:undefined;this['Trunk']=_0x1d8c4b[_0xc4f1('0x23')]?_0x1d8c4b[_0xc4f1('0x23')]:undefined;this[_0xc4f1('0x24')]=_0x1d8c4b['Interval']?_0x1d8c4b[_0xc4f1('0x24')]:undefined;this[_0xc4f1('0x25')]=_0x1d8c4b[_0xc4f1('0x25')]?_0x1d8c4b['SquareProject']:undefined;this[_0xc4f1('0x26')]=_0x1d8c4b[_0xc4f1('0x25')]?_0x1d8c4b[_0xc4f1('0x25')][_0xc4f1('0x0')]:undefined;this[_0xc4f1('0x27')]=_0x1d8c4b[_0xc4f1('0x27')]||![];this['dialAMDInitialSilence']=_0x1d8c4b['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1d8c4b['dialAMDGreeting'];this[_0xc4f1('0x28')]=_0x1d8c4b[_0xc4f1('0x28')];this[_0xc4f1('0x29')]=_0x1d8c4b[_0xc4f1('0x29')];this[_0xc4f1('0x2a')]=_0x1d8c4b[_0xc4f1('0x2a')];this['dialAMDBetweenWordsSilence']=_0x1d8c4b[_0xc4f1('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x1d8c4b[_0xc4f1('0x2c')];this[_0xc4f1('0x2d')]=_0x1d8c4b['dialAMDSilenceThreshold'];this[_0xc4f1('0x2e')]=_0x1d8c4b['dialAMDMaximumWordLength'];}module[_0xc4f1('0x2f')]=Campaign; \ No newline at end of file +var _0x3155=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x39bae8,_0xee0428){var _0x47d295=function(_0x1394fa){while(--_0x1394fa){_0x39bae8['push'](_0x39bae8['shift']());}};_0x47d295(++_0xee0428);}(_0x3155,0x6c));var _0x5315=function(_0x54fbed,_0x3c77a7){_0x54fbed=_0x54fbed-0x0;var _0x333bbc=_0x3155[_0x54fbed];return _0x333bbc;};'use strict';function Campaign(_0x56eeee){this['id']=_0x56eeee['id']||0x0;this[_0x5315('0x0')]=_0x56eeee[_0x5315('0x0')]||'';this[_0x5315('0x1')]=_0x56eeee[_0x5315('0x1')]||_0x5315('0x2');this[_0x5315('0x3')]=0x0;this[_0x5315('0x4')]=0x0;this[_0x5315('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5315('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x5315('0x7')]=_0x56eeee[_0x5315('0x7')];this[_0x5315('0x8')]=_0x56eeee[_0x5315('0x8')];this['dialTimezone']=_0x56eeee[_0x5315('0x9')]||null;this[_0x5315('0xa')]=_0x56eeee['dialGlobalInterval']?_0x56eeee[_0x5315('0xa')]:null;this[_0x5315('0xb')]=_0x56eeee['dialOriginateCallerIdName'];this[_0x5315('0xc')]=_0x56eeee[_0x5315('0xc')];this[_0x5315('0xd')]=_0x56eeee[_0x5315('0xd')]||0x1e;this[_0x5315('0xe')]=_0x56eeee[_0x5315('0xe')];this['dialCongestionRetryFrequency']=_0x56eeee[_0x5315('0xf')];this['dialBusyMaxRetry']=_0x56eeee[_0x5315('0x10')];this[_0x5315('0x11')]=_0x56eeee[_0x5315('0x11')];this[_0x5315('0x12')]=_0x56eeee[_0x5315('0x12')];this[_0x5315('0x13')]=_0x56eeee[_0x5315('0x13')];this['dialGlobalMaxRetry']=_0x56eeee[_0x5315('0x14')];this[_0x5315('0x15')]=_0x56eeee[_0x5315('0x15')]||0x3;this[_0x5315('0x16')]=_0x56eeee['dialNoSuchNumberRetryFrequency']||0x96;this[_0x5315('0x17')]=_0x56eeee[_0x5315('0x17')]||0x3;this['dialDropRetryFrequency']=_0x56eeee[_0x5315('0x18')]||0x96;this[_0x5315('0x19')]=_0x56eeee[_0x5315('0x19')]||0x3;this[_0x5315('0x1a')]=_0x56eeee[_0x5315('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x56eeee[_0x5315('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x56eeee['dialMachineRetryFrequency']||0x96;this[_0x5315('0x1c')]=_0x56eeee['dialAgentRejectMaxRetry']||0x3;this[_0x5315('0x1d')]=_0x56eeee[_0x5315('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x56eeee[_0x5315('0x1e')]||_0x5315('0x1f');this[_0x5315('0x20')]=_0x56eeee['dialPrefix']||undefined;this[_0x5315('0x21')]=_0x56eeee[_0x5315('0x21')]||undefined;this[_0x5315('0x22')]=_0x56eeee[_0x5315('0x22')]||undefined;this[_0x5315('0x23')]=_0x56eeee[_0x5315('0x23')]?_0x56eeee[_0x5315('0x23')]:undefined;this[_0x5315('0x24')]=_0x56eeee[_0x5315('0x24')]?_0x56eeee[_0x5315('0x24')]:undefined;this['Interval']=_0x56eeee[_0x5315('0x25')]?_0x56eeee[_0x5315('0x25')]:undefined;this[_0x5315('0x26')]=_0x56eeee[_0x5315('0x26')]?_0x56eeee['SquareProject']:undefined;this[_0x5315('0x27')]=_0x56eeee[_0x5315('0x26')]?_0x56eeee[_0x5315('0x26')]['name']:undefined;this[_0x5315('0x28')]=_0x56eeee[_0x5315('0x28')]||![];this[_0x5315('0x29')]=_0x56eeee['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x56eeee['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x56eeee[_0x5315('0x2a')];this[_0x5315('0x2b')]=_0x56eeee[_0x5315('0x2b')];this[_0x5315('0x2c')]=_0x56eeee[_0x5315('0x2c')];this[_0x5315('0x2d')]=_0x56eeee[_0x5315('0x2d')];this[_0x5315('0x2e')]=_0x56eeee[_0x5315('0x2e')];this[_0x5315('0x2f')]=_0x56eeee[_0x5315('0x2f')];this['dialAMDMaximumWordLength']=_0x56eeee[_0x5315('0x30')];}module[_0x5315('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c4562b8..ed7658f 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 _0x2eba=['duration','billableseconds','tag','disposition','monitor','queue','monitors','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','accountcode','uniqueid','linkedid','exten','answered','abandoned','lastdata'];(function(_0x1bff41,_0x386880){var _0x4db66b=function(_0x5aa7b6){while(--_0x5aa7b6){_0x1bff41['push'](_0x1bff41['shift']());}};_0x4db66b(++_0x386880);}(_0x2eba,0xc7));var _0xa2eb=function(_0x2cb15f,_0x3481cb){_0x2cb15f=_0x2cb15f-0x0;var _0xdc40ef=_0x2eba[_0x2cb15f];return _0xdc40ef;};'use strict';function Channel(){this['starttime']=null;this[_0xa2eb('0x0')]='';this[_0xa2eb('0x1')]='';this[_0xa2eb('0x2')]=0x0;this[_0xa2eb('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xa2eb('0x4')]=0x0;this['context']='';this[_0xa2eb('0x5')]=0x0;this[_0xa2eb('0x6')]=0x0;this[_0xa2eb('0x7')]=0x0;this[_0xa2eb('0x8')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xa2eb('0x9')]=![];this['lastapplication']='';this[_0xa2eb('0xa')]='';this[_0xa2eb('0xb')]=0x0;this[_0xa2eb('0xc')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xa2eb('0xd')]=null;this[_0xa2eb('0xe')]=null;this[_0xa2eb('0xf')]=![];this['monitorFilename']=null;this[_0xa2eb('0x10')]=null;this[_0xa2eb('0x11')]=[];this['transfercalleridnum']=undefined;this[_0xa2eb('0x12')]=undefined;this['transferType']=undefined;this[_0xa2eb('0x13')]=0x0;}module[_0xa2eb('0x14')]=Channel; \ No newline at end of file +var _0x236c=['monitorFilename','monitors','transfercalleridnum','transferType','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x236c,0x155));var _0xc236=function(_0x2b9f28,_0x13fb9a){_0x2b9f28=_0x2b9f28-0x0;var _0xe5e43c=_0x236c[_0x2b9f28];return _0xe5e43c;};'use strict';function Channel(){this[_0xc236('0x0')]=null;this['channel']='';this[_0xc236('0x1')]='';this[_0xc236('0x2')]=0x0;this[_0xc236('0x3')]='';this[_0xc236('0x4')]=undefined;this[_0xc236('0x5')]=undefined;this['accountcode']=0x0;this[_0xc236('0x6')]='';this[_0xc236('0x7')]=0x0;this[_0xc236('0x8')]=0x0;this[_0xc236('0x9')]=0x0;this[_0xc236('0xa')]=![];this[_0xc236('0xb')]=null;this['endtime']=null;this[_0xc236('0xc')]=![];this[_0xc236('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0xc236('0xe')]=0x0;this['holdtime']=0x0;this[_0xc236('0xf')]=null;this[_0xc236('0x10')]=null;this[_0xc236('0x11')]=null;this[_0xc236('0x12')]=![];this[_0xc236('0x13')]=null;this['queue']=null;this[_0xc236('0x14')]=[];this[_0xc236('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc236('0x16')]=undefined;this[_0xc236('0x17')]=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 8986f13..df9bdc3 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 _0x3462=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x245546,_0x2d5269){var _0x1ebb5a=function(_0x25d614){while(--_0x25d614){_0x245546['push'](_0x245546['shift']());}};_0x1ebb5a(++_0x2d5269);}(_0x3462,0x15f));var _0x2346=function(_0x169c11,_0x4cbe14){_0x169c11=_0x169c11-0x0;var _0x2115e8=_0x3462[_0x169c11];return _0x2115e8;};'use strict';function DeskAccount(_0x16ef90){this['id']=_0x16ef90['id']||0x0;this[_0x2346('0x0')]=_0x16ef90[_0x2346('0x0')]||'';this[_0x2346('0x1')]=_0x16ef90[_0x2346('0x1')]||'';this['remoteUri']=_0x16ef90[_0x2346('0x2')]||'';this[_0x2346('0x3')]=_0x16ef90[_0x2346('0x3')]||'';this[_0x2346('0x4')]=_0x16ef90[_0x2346('0x4')]||'';this[_0x2346('0x5')]=_0x16ef90[_0x2346('0x5')]||'';this[_0x2346('0x6')]=_0x16ef90[_0x2346('0x6')]||'';this[_0x2346('0x7')]=_0x16ef90['token']||'';this[_0x2346('0x8')]=_0x16ef90[_0x2346('0x8')]||'';this['type']=_0x16ef90[_0x2346('0x9')]||'';this[_0x2346('0xa')]=_0x16ef90['serverUrl']||'';this['Configurations']=_0x16ef90[_0x2346('0xb')]||{};}module[_0x2346('0xc')]=DeskAccount; \ No newline at end of file +var _0x939c=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x939c,0xea));var _0xc939=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x939c[_0x35885a];return _0xe86249;};'use strict';function DeskAccount(_0x536b2f){this['id']=_0x536b2f['id']||0x0;this[_0xc939('0x0')]=_0x536b2f[_0xc939('0x0')]||'';this[_0xc939('0x1')]=_0x536b2f[_0xc939('0x1')]||'';this[_0xc939('0x2')]=_0x536b2f[_0xc939('0x2')]||'';this['authType']=_0x536b2f[_0xc939('0x3')]||'';this[_0xc939('0x4')]=_0x536b2f[_0xc939('0x4')]||'';this['consumerKey']=_0x536b2f[_0xc939('0x5')]||'';this['consumerSecret']=_0x536b2f[_0xc939('0x6')]||'';this['token']=_0x536b2f[_0xc939('0x7')]||'';this['tokenSecret']=_0x536b2f[_0xc939('0x8')]||'';this[_0xc939('0x9')]=_0x536b2f[_0xc939('0x9')]||'';this[_0xc939('0xa')]=_0x536b2f[_0xc939('0xa')]||'';this[_0xc939('0xb')]=_0x536b2f['Configurations']||{};}module[_0xc939('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f01067e..4705343 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 _0xcc13=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x135762,_0x238b42){var _0x3e3d17=function(_0x591751){while(--_0x591751){_0x135762['push'](_0x135762['shift']());}};_0x3e3d17(++_0x238b42);}(_0xcc13,0x1e4));var _0x3cc1=function(_0x3bebd1,_0x5bd765){_0x3bebd1=_0x3bebd1-0x0;var _0x5e9236=_0xcc13[_0x3bebd1];return _0x5e9236;};'use strict';function Dynamics365Account(_0x52a859){this['id']=_0x52a859['id']||0x0;this['name']=_0x52a859['name']||'';this['username']=_0x52a859[_0x3cc1('0x0')]||'';this[_0x3cc1('0x1')]=_0x52a859[_0x3cc1('0x1')]||'';this['remoteUri']=_0x52a859[_0x3cc1('0x2')]||'';this[_0x3cc1('0x3')]=_0x52a859[_0x3cc1('0x3')]||'';this[_0x3cc1('0x4')]=_0x52a859[_0x3cc1('0x4')]||'';this[_0x3cc1('0x5')]=_0x52a859['clientSecret']||{};this[_0x3cc1('0x6')]=_0x52a859[_0x3cc1('0x6')]||'';this[_0x3cc1('0x7')]=_0x52a859[_0x3cc1('0x7')]||![];this[_0x3cc1('0x8')]=_0x52a859['Configurations']||{};this[_0x3cc1('0x9')]=_0x52a859['CloudProvider']||{};}module[_0x3cc1('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xce50=['remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','name','username','password'];(function(_0x1036af,_0x32a708){var _0x407e88=function(_0x1cb598){while(--_0x1cb598){_0x1036af['push'](_0x1036af['shift']());}};_0x407e88(++_0x32a708);}(_0xce50,0x1d3));var _0x0ce5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xce50[_0x2dadb9];return _0x2f0097;};'use strict';function Dynamics365Account(_0x1a5785){this['id']=_0x1a5785['id']||0x0;this['name']=_0x1a5785[_0x0ce5('0x0')]||'';this[_0x0ce5('0x1')]=_0x1a5785[_0x0ce5('0x1')]||'';this[_0x0ce5('0x2')]=_0x1a5785[_0x0ce5('0x2')]||'';this[_0x0ce5('0x3')]=_0x1a5785[_0x0ce5('0x3')]||'';this['tenantId']=_0x1a5785[_0x0ce5('0x4')]||'';this[_0x0ce5('0x5')]=_0x1a5785[_0x0ce5('0x5')]||'';this[_0x0ce5('0x6')]=_0x1a5785[_0x0ce5('0x6')]||{};this['serverUrl']=_0x1a5785['serverUrl']||'';this[_0x0ce5('0x7')]=_0x1a5785[_0x0ce5('0x7')]||![];this['Configurations']=_0x1a5785[_0x0ce5('0x8')]||{};this[_0x0ce5('0x9')]=_0x1a5785[_0x0ce5('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1d0d070..6a7b324 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 _0x12b7=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0x12b7,0x1a9));var _0x712b=function(_0x5755e5,_0x105949){_0x5755e5=_0x5755e5-0x0;var _0x5b61ba=_0x12b7[_0x5755e5];return _0x5b61ba;};'use strict';function FaxAccount(_0x144b42){this['id']=_0x144b42['id']||0x0;this[_0x712b('0x0')]=_0x144b42['name']||'';this[_0x712b('0x1')]=_0x144b42['description'];this[_0x712b('0x2')]=_0x144b42[_0x712b('0x2')];this[_0x712b('0x3')]=_0x144b42['headerinfo'];this['localstationid']=_0x144b42['localstationid'];this['minrate']=_0x144b42[_0x712b('0x4')]||0x960;this[_0x712b('0x5')]=_0x144b42[_0x712b('0x5')]||0x3840;this[_0x712b('0x6')]=_0x144b42[_0x712b('0x6')]||_0x712b('0x7');this[_0x712b('0x8')]=_0x144b42['gateway']||'no';this[_0x712b('0x9')]=_0x144b42[_0x712b('0x9')]||'no';this[_0x712b('0xa')]=_0x144b42[_0x712b('0xa')]||0x1388;this[_0x712b('0xb')]=_0x144b42['tech']||_0x712b('0xc');this[_0x712b('0xd')]=_0x144b42[_0x712b('0xd')]?_0x144b42[_0x712b('0xd')]:undefined;this['ListId']=_0x144b42['ListId'];this[_0x712b('0xe')]=_0x144b42['key'];}module[_0x712b('0xf')]=FaxAccount; \ No newline at end of file +var _0x5c21=['exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key'];(function(_0x38a8a7,_0xb6afd4){var _0x57011a=function(_0x239d9a){while(--_0x239d9a){_0x38a8a7['push'](_0x38a8a7['shift']());}};_0x57011a(++_0xb6afd4);}(_0x5c21,0x1b1));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x4bf8b3){this['id']=_0x4bf8b3['id']||0x0;this[_0x15c2('0x0')]=_0x4bf8b3[_0x15c2('0x0')]||'';this[_0x15c2('0x1')]=_0x4bf8b3[_0x15c2('0x1')];this[_0x15c2('0x2')]=_0x4bf8b3[_0x15c2('0x2')];this['headerinfo']=_0x4bf8b3['headerinfo'];this['localstationid']=_0x4bf8b3[_0x15c2('0x3')];this[_0x15c2('0x4')]=_0x4bf8b3[_0x15c2('0x4')]||0x960;this[_0x15c2('0x5')]=_0x4bf8b3[_0x15c2('0x5')]||0x3840;this[_0x15c2('0x6')]=_0x4bf8b3['modem']||_0x15c2('0x7');this[_0x15c2('0x8')]=_0x4bf8b3[_0x15c2('0x8')]||'no';this[_0x15c2('0x9')]=_0x4bf8b3[_0x15c2('0x9')]||'no';this[_0x15c2('0xa')]=_0x4bf8b3[_0x15c2('0xa')]||0x1388;this[_0x15c2('0xb')]=_0x4bf8b3['tech']||'SIP';this['Trunk']=_0x4bf8b3[_0x15c2('0xc')]?_0x4bf8b3[_0x15c2('0xc')]:undefined;this['ListId']=_0x4bf8b3[_0x15c2('0xd')];this[_0x15c2('0xe')]=_0x4bf8b3['key'];}module[_0x15c2('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 15e9c70..7a2559b 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 _0xa3da=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xa3da,0x99));var _0xaa3d=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa3da[_0x5c351c];return _0x26f3b3;};'use strict';function FreshdeskAccount(_0x291b64){this['id']=_0x291b64['id']||0x0;this[_0xaa3d('0x0')]=_0x291b64[_0xaa3d('0x0')]||'';this[_0xaa3d('0x1')]=_0x291b64['username']||'';this[_0xaa3d('0x2')]=_0x291b64[_0xaa3d('0x3')]||'';this[_0xaa3d('0x4')]=_0x291b64[_0xaa3d('0x4')]||'';this['serverUrl']=_0x291b64[_0xaa3d('0x5')]||'';this[_0xaa3d('0x6')]=_0x291b64[_0xaa3d('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xbcae=['token','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x52cb1e,_0xb8de51){var _0x43cdda=function(_0x2084e7){while(--_0x2084e7){_0x52cb1e['push'](_0x52cb1e['shift']());}};_0x43cdda(++_0xb8de51);}(_0xbcae,0x131));var _0xebca=function(_0x351ee4,_0x2bfe3d){_0x351ee4=_0x351ee4-0x0;var _0x1d2e57=_0xbcae[_0x351ee4];return _0x1d2e57;};'use strict';function FreshdeskAccount(_0x223238){this['id']=_0x223238['id']||0x0;this['name']=_0x223238['name']||'';this['username']=_0x223238[_0xebca('0x0')]||'';this['apiKey']=_0x223238[_0xebca('0x1')]||'';this['remoteUri']=_0x223238[_0xebca('0x2')]||'';this['serverUrl']=_0x223238[_0xebca('0x3')]||'';this['Configurations']=_0x223238[_0xebca('0x4')]||{};}module[_0xebca('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index aae2ca3..3fd60fc 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 _0x1a0b=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x5540c3,_0x42c118){var _0x51316d=function(_0x3550db){while(--_0x3550db){_0x5540c3['push'](_0x5540c3['shift']());}};_0x51316d(++_0x42c118);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x1c59c5,_0x5e99fb){_0x1c59c5=_0x1c59c5-0x0;var _0x5c0c51=_0x1a0b[_0x1c59c5];return _0x5c0c51;};'use strict';function FreshsalesAccount(_0xe98786){this['id']=_0xe98786['id']||0x0;this['name']=_0xe98786[_0xb1a0('0x0')]||'';this[_0xb1a0('0x1')]=_0xe98786[_0xb1a0('0x1')]||'';this[_0xb1a0('0x2')]=_0xe98786[_0xb1a0('0x3')]||'';this[_0xb1a0('0x4')]=_0xe98786[_0xb1a0('0x4')]||'';this[_0xb1a0('0x5')]=_0xe98786[_0xb1a0('0x5')]||'';this[_0xb1a0('0x6')]=_0xe98786[_0xb1a0('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x5e17=['serverUrl','Configurations','exports','token','remoteUri'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5e17,0x17a));var _0x75e1=function(_0x16ef1f,_0x1bb9fa){_0x16ef1f=_0x16ef1f-0x0;var _0x20155c=_0x5e17[_0x16ef1f];return _0x20155c;};'use strict';function FreshsalesAccount(_0x5b83b9){this['id']=_0x5b83b9['id']||0x0;this['name']=_0x5b83b9['name']||'';this['username']=_0x5b83b9['username']||'';this['apiKey']=_0x5b83b9[_0x75e1('0x0')]||'';this[_0x75e1('0x1')]=_0x5b83b9[_0x75e1('0x1')]||'';this[_0x75e1('0x2')]=_0x5b83b9[_0x75e1('0x2')]||'';this[_0x75e1('0x3')]=_0x5b83b9[_0x75e1('0x3')]||{};}module[_0x75e1('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c10ca15..10aa28b 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 _0x397c=['lastAssignedTo','motionChannel','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','accountcode','priority','holdtime','assigned'];(function(_0x52953e,_0x5e6812){var _0x4c48f8=function(_0xb81a32){while(--_0xb81a32){_0x52953e['push'](_0x52953e['shift']());}};_0x4c48f8(++_0x5e6812);}(_0x397c,0xcb));var _0xc397=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x397c[_0x22f8ab];return _0x2a70e5;};'use strict';function QueueReport(){this[_0xc397('0x0')]=_0xc397('0x1');this[_0xc397('0x2')]='';this[_0xc397('0x3')]='';this['calleridname']='';this[_0xc397('0x4')]='';this['queuecallerjoinAt']=null;this[_0xc397('0x5')]=null;this['position']=0x1;this['count']=0x1;this[_0xc397('0x6')]=![];this[_0xc397('0x7')]=null;this[_0xc397('0x8')]=![];this[_0xc397('0x9')]=null;this[_0xc397('0xa')]=![];this[_0xc397('0xb')]=null;this['originalposition']=0x1;this[_0xc397('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xc397('0xd')]='';this['context']='';this['exten']='';this[_0xc397('0xe')]='';this[_0xc397('0xf')]=0x0;this[_0xc397('0x10')]=![];this[_0xc397('0x11')]='';this[_0xc397('0x12')]='voice';this['mohtime']=0x0;this['variables']={};}module[_0xc397('0x13')]=QueueReport; \ No newline at end of file +var _0x6eb2=['priority','assigned','motionChannel','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum'];(function(_0x569acf,_0x163f90){var _0x2fc12f=function(_0x3f75cc){while(--_0x3f75cc){_0x569acf['push'](_0x569acf['shift']());}};_0x2fc12f(++_0x163f90);}(_0x6eb2,0x95));var _0x26eb=function(_0x3ebe6b,_0x50bbf7){_0x3ebe6b=_0x3ebe6b-0x0;var _0x334cfc=_0x6eb2[_0x3ebe6b];return _0x334cfc;};'use strict';function QueueReport(){this['type']=_0x26eb('0x0');this[_0x26eb('0x1')]='';this[_0x26eb('0x2')]='';this[_0x26eb('0x3')]='';this[_0x26eb('0x4')]='';this[_0x26eb('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x26eb('0x6')]=0x1;this[_0x26eb('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x26eb('0x8')]=![];this[_0x26eb('0x9')]=null;this['queuecallerexit']=![];this[_0x26eb('0xa')]=null;this['originalposition']=0x1;this[_0x26eb('0xb')]='';this[_0x26eb('0xc')]='';this['connectedlinename']='';this['accountcode']='';this['context']='';this['exten']='';this[_0x26eb('0xd')]='';this['holdtime']=0x0;this[_0x26eb('0xe')]=![];this['lastAssignedTo']='';this[_0x26eb('0xf')]='voice';this['mohtime']=0x0;this[_0x26eb('0x10')]={};}module[_0x26eb('0x11')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0d577da..4e381f0 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 _0xa343=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x28f780,_0x3f1bd8){var _0x1b02cc=function(_0x2dec3a){while(--_0x2dec3a){_0x28f780['push'](_0x28f780['shift']());}};_0x1b02cc(++_0x3f1bd8);}(_0xa343,0x1a1));var _0x3a34=function(_0x2cac01,_0x2e8b3d){_0x2cac01=_0x2cac01-0x0;var _0x2257b7=_0xa343[_0x2cac01];return _0x2257b7;};'use strict';function SalesforceAccount(_0x35b1fc){this['id']=_0x35b1fc['id']||0x0;this[_0x3a34('0x0')]=_0x35b1fc[_0x3a34('0x0')]||'';this['username']=_0x35b1fc['username']||'';this[_0x3a34('0x1')]=_0x35b1fc[_0x3a34('0x1')]||'';this[_0x3a34('0x2')]=_0x35b1fc[_0x3a34('0x2')]||'';this[_0x3a34('0x3')]=_0x35b1fc[_0x3a34('0x3')]||'';this[_0x3a34('0x4')]=_0x35b1fc[_0x3a34('0x4')]||'';this[_0x3a34('0x5')]=_0x35b1fc[_0x3a34('0x5')]||'';this[_0x3a34('0x6')]=_0x35b1fc[_0x3a34('0x6')]||_0x3a34('0x7');this[_0x3a34('0x8')]=_0x35b1fc[_0x3a34('0x8')]||'';this[_0x3a34('0x9')]=_0x35b1fc[_0x3a34('0x9')]||{};}module[_0x3a34('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x7a55=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x4672e9,_0x5caff9){var _0x2407fd=function(_0x41bd9e){while(--_0x41bd9e){_0x4672e9['push'](_0x4672e9['shift']());}};_0x2407fd(++_0x5caff9);}(_0x7a55,0xcc));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';function SalesforceAccount(_0x495f13){this['id']=_0x495f13['id']||0x0;this[_0x57a5('0x0')]=_0x495f13[_0x57a5('0x0')]||'';this[_0x57a5('0x1')]=_0x495f13[_0x57a5('0x1')]||'';this[_0x57a5('0x2')]=_0x495f13['remoteUri']||'';this[_0x57a5('0x3')]=_0x495f13[_0x57a5('0x3')]||'';this[_0x57a5('0x4')]=_0x495f13['clientId']||'';this['clientSecret']=_0x495f13[_0x57a5('0x5')]||'';this['securityToken']=_0x495f13[_0x57a5('0x6')]||'';this['type']=_0x495f13[_0x57a5('0x7')]||_0x57a5('0x8');this[_0x57a5('0x9')]=_0x495f13['serverUrl']||'';this[_0x57a5('0xa')]=_0x495f13[_0x57a5('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 186a03d..41baf17 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 _0x8193=['Configurations','exports','username','password','remoteUri','serverUrl'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x8193,0xf2));var _0x3819=function(_0x21a3ac,_0x386a4b){_0x21a3ac=_0x21a3ac-0x0;var _0x164fec=_0x8193[_0x21a3ac];return _0x164fec;};'use strict';function ServicenowAccount(_0x4344f9){this['id']=_0x4344f9['id']||0x0;this['name']=_0x4344f9['name']||'';this[_0x3819('0x0')]=_0x4344f9[_0x3819('0x0')]||'';this[_0x3819('0x1')]=_0x4344f9[_0x3819('0x1')]||'';this[_0x3819('0x2')]=_0x4344f9[_0x3819('0x2')]||'';this[_0x3819('0x3')]=_0x4344f9[_0x3819('0x3')]||'';this[_0x3819('0x4')]=_0x4344f9['Configurations']||{};}module[_0x3819('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xae17=['serverUrl','username','password','remoteUri'];(function(_0x47bfee,_0x112b73){var _0x2feb04=function(_0xf626ff){while(--_0xf626ff){_0x47bfee['push'](_0x47bfee['shift']());}};_0x2feb04(++_0x112b73);}(_0xae17,0x13d));var _0x7ae1=function(_0x2d6d36,_0x242e94){_0x2d6d36=_0x2d6d36-0x0;var _0x42dc7e=_0xae17[_0x2d6d36];return _0x42dc7e;};'use strict';function ServicenowAccount(_0x424035){this['id']=_0x424035['id']||0x0;this['name']=_0x424035['name']||'';this[_0x7ae1('0x0')]=_0x424035[_0x7ae1('0x0')]||'';this['password']=_0x424035[_0x7ae1('0x1')]||'';this[_0x7ae1('0x2')]=_0x424035['remoteUri']||'';this[_0x7ae1('0x3')]=_0x424035[_0x7ae1('0x3')]||'';this['Configurations']=_0x424035['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1011b63..0057307 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 _0x2f20=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x2f20,0x92));var _0x02f2=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x2f20[_0x3fba9f];return _0x192cf1;};'use strict';function SugarcrmAccount(_0x22e5ed){this['id']=_0x22e5ed['id']||0x0;this[_0x02f2('0x0')]=_0x22e5ed[_0x02f2('0x0')]||'';this[_0x02f2('0x1')]=_0x22e5ed[_0x02f2('0x1')]||'';this['password']=_0x22e5ed[_0x02f2('0x2')]||'';this[_0x02f2('0x3')]=_0x22e5ed[_0x02f2('0x3')]||'';this[_0x02f2('0x4')]=_0x22e5ed['serverUrl']||'';this[_0x02f2('0x5')]=_0x22e5ed[_0x02f2('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xb186=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xcd241c,_0x32e173){var _0x3b838a=function(_0x443d0e){while(--_0x443d0e){_0xcd241c['push'](_0xcd241c['shift']());}};_0x3b838a(++_0x32e173);}(_0xb186,0x10e));var _0x6b18=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0xb186[_0x2e6dbf];return _0x2680e5;};'use strict';function SugarcrmAccount(_0x36b0d8){this['id']=_0x36b0d8['id']||0x0;this[_0x6b18('0x0')]=_0x36b0d8['name']||'';this['username']=_0x36b0d8[_0x6b18('0x1')]||'';this[_0x6b18('0x2')]=_0x36b0d8['password']||'';this[_0x6b18('0x3')]=_0x36b0d8[_0x6b18('0x3')]||'';this[_0x6b18('0x4')]=_0x36b0d8[_0x6b18('0x4')]||'';this[_0x6b18('0x5')]=_0x36b0d8[_0x6b18('0x5')]||{};}module[_0x6b18('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index daea1cc..18d8f80 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 _0x16a3=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x4734c8,_0x69cadb){var _0x46640d=function(_0x116833){while(--_0x116833){_0x4734c8['push'](_0x4734c8['shift']());}};_0x46640d(++_0x69cadb);}(_0x16a3,0x1e0));var _0x316a=function(_0x5828d0,_0x2c3e93){_0x5828d0=_0x5828d0-0x0;var _0x239b02=_0x16a3[_0x5828d0];return _0x239b02;};'use strict';function Telephone(_0x2d574f){this['id']=_0x2d574f['id']||0x0;this['name']=_0x2d574f[_0x316a('0x0')]||'';this[_0x316a('0x1')]=_0x2d574f[_0x316a('0x1')]||'';this[_0x316a('0x2')]=_0x316a('0x3');this[_0x316a('0x4')]=0x0;this[_0x316a('0x5')]=_0x316a('0x3');this[_0x316a('0x6')]='';}module[_0x316a('0x7')]=Telephone; \ No newline at end of file +var _0x9d26=['status','address','exports','name','accountcode','state','unknown'];(function(_0x4bacb1,_0x251bda){var _0x471154=function(_0x45cdec){while(--_0x45cdec){_0x4bacb1['push'](_0x4bacb1['shift']());}};_0x471154(++_0x251bda);}(_0x9d26,0x17d));var _0x69d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d26[_0x321bb2];return _0x9c12ed;};'use strict';function Telephone(_0x531af6){this['id']=_0x531af6['id']||0x0;this['name']=_0x531af6[_0x69d2('0x0')]||'';this[_0x69d2('0x1')]=_0x531af6[_0x69d2('0x1')]||'';this[_0x69d2('0x2')]=_0x69d2('0x3');this['stateTime']=0x0;this[_0x69d2('0x4')]='unknown';this[_0x69d2('0x5')]='';}module[_0x69d2('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 b3a378b..a9c6f68 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x3f3779,_0xd11796){var _0xb6c512=function(_0x4577a5){while(--_0x4577a5){_0x3f3779['push'](_0x3f3779['shift']());}};_0xb6c512(++_0xd11796);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x7eab16,_0x2a7291){var _0x39559a=function(_0x55d1b2){while(--_0x55d1b2){_0x7eab16['push'](_0x7eab16['shift']());}};_0x39559a(++_0x2a7291);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 0556d44..7f67697 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x263d59,_0x15729f){var _0x3aa3ed=function(_0x2f4437){while(--_0x2f4437){_0x263d59['push'](_0x263d59['shift']());}};_0x3aa3ed(++_0x15729f);}(_0x757a,0xde));var _0xa757=function(_0x3bf18c,_0x3d87a7){_0x3bf18c=_0x3bf18c-0x0;var _0x511cf7=_0x757a[_0x3bf18c];return _0x511cf7;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x3e2584,_0x5408a0){var _0x579a52=function(_0x555591){while(--_0x555591){_0x3e2584['push'](_0x3e2584['shift']());}};_0x579a52(++_0x5408a0);}(_0xda3f,0xec));var _0xfda3=function(_0x1a4e86,_0x2d3729){_0x1a4e86=_0x1a4e86-0x0;var _0x1d4b29=_0xda3f[_0x1a4e86];return _0x1d4b29;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 84bb4a8..1ccd492 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 _0x690a=['defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x690a,0xe2));var _0xa690=function(_0x294303,_0x10c8ea){_0x294303=_0x294303-0x0;var _0x29c840=_0x690a[_0x294303];return _0x29c840;};'use strict';function Trunk(_0x160c29){this['id']=_0x160c29['id']||0x0;this[_0xa690('0x0')]=_0x160c29[_0xa690('0x0')]||![];this[_0xa690('0x1')]=_0x160c29[_0xa690('0x1')]||'';this[_0xa690('0x2')]='unknown';this[_0xa690('0x3')]=0x0;this[_0xa690('0x4')]=_0xa690('0x5');this[_0xa690('0x6')]=_0x160c29[_0xa690('0x6')]&&_0x160c29[_0xa690('0x6')][_0xa690('0x7')](':')?_0x160c29[_0xa690('0x6')][_0xa690('0x8')](':')[0x0]:'';this[_0xa690('0x9')]='';this['port']='';this[_0xa690('0xa')]='';this[_0xa690('0xb')]='';this[_0xa690('0xc')]='';this[_0xa690('0xd')]=_0xa690('0x5');this['registrationtime']='';this['address']='';this[_0xa690('0xe')]=_0x160c29[_0xa690('0xe')]||'';}module[_0xa690('0xf')]=Trunk; \ No newline at end of file +var _0xc780=['split','host','port','domain','domainport','refresh','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x57800a,_0x31a489){var _0x4ad8dd=function(_0x4a9bc1){while(--_0x4a9bc1){_0x57800a['push'](_0x57800a['shift']());}};_0x4ad8dd(++_0x31a489);}(_0xc780,0x158));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x2cab76){this['id']=_0x2cab76['id']||0x0;this[_0x0c78('0x0')]=_0x2cab76[_0x0c78('0x0')]||![];this[_0x0c78('0x1')]=_0x2cab76[_0x0c78('0x1')]||'';this[_0x0c78('0x2')]=_0x0c78('0x3');this[_0x0c78('0x4')]=0x0;this[_0x0c78('0x5')]='unknown';this[_0x0c78('0x6')]=_0x2cab76[_0x0c78('0x6')]&&_0x2cab76['registry'][_0x0c78('0x7')](':')?_0x2cab76['registry'][_0x0c78('0x8')](':')[0x0]:'';this[_0x0c78('0x9')]='';this[_0x0c78('0xa')]='';this[_0x0c78('0xb')]='';this[_0x0c78('0xc')]='';this[_0x0c78('0xd')]='';this['stateRegistry']=_0x0c78('0x3');this['registrationtime']='';this['address']='';this[_0x0c78('0xe')]=_0x2cab76[_0x0c78('0xe')]||'';}module[_0x0c78('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2d4fb52..afdaf21 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 _0x7a79=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x33ae39,_0x3768f0){var _0x1e4afc=function(_0x182a2a){while(--_0x182a2a){_0x33ae39['push'](_0x33ae39['shift']());}};_0x1e4afc(++_0x3768f0);}(_0x7a79,0x86));var _0x97a7=function(_0x3bad26,_0x1cf013){_0x3bad26=_0x3bad26-0x0;var _0x42e1ff=_0x7a79[_0x3bad26];return _0x42e1ff;};'use strict';function voiceExtension(_0x5250dd){this['id']=_0x5250dd['id']||0x0;this['exten']=_0x5250dd['exten']||'';this[_0x97a7('0x0')]=_0x5250dd[_0x97a7('0x0')]||_0x97a7('0x1');this[_0x97a7('0x2')]=_0x5250dd['mandatoryDisposition']||![];}module[_0x97a7('0x3')]=voiceExtension; \ No newline at end of file +var _0xdde2=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0xdde2,0x11f));var _0x2dde=function(_0xc6f023,_0x41987a){_0xc6f023=_0xc6f023-0x0;var _0x379055=_0xdde2[_0xc6f023];return _0x379055;};'use strict';function voiceExtension(_0x18f260){this['id']=_0x18f260['id']||0x0;this[_0x2dde('0x0')]=_0x18f260[_0x2dde('0x0')]||'';this[_0x2dde('0x1')]=_0x18f260[_0x2dde('0x1')]||_0x2dde('0x2');this[_0x2dde('0x3')]=_0x18f260['mandatoryDisposition']||![];}module[_0x2dde('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 45963af..102514b 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 _0x9792=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x32f2f5,_0x2b8188){var _0x3a3364=function(_0x2c40f4){while(--_0x2c40f4){_0x32f2f5['push'](_0x32f2f5['shift']());}};_0x3a3364(++_0x2b8188);}(_0x9792,0xb9));var _0x2979=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9792[_0x19950b];return _0x3c6b41;};'use strict';var statusDesc=[_0x2979('0x0'),_0x2979('0x1'),_0x2979('0x2'),_0x2979('0x3'),_0x2979('0x4'),'unavailable','ringing',_0x2979('0x5'),'onhold'];var monitorFormat={'wav':_0x2979('0x6'),'wav49':_0x2979('0x7'),'gsm':_0x2979('0x8')};var strategy={'rrmemory':_0x2979('0x9'),'roundrobin':_0x2979('0xa')};function VoiceQueue(_0x38f523){this['id']=_0x38f523['id']||0x0;this['name']=_0x38f523['name']||'';this['monitor_format']=_0x38f523[_0x2979('0xb')]||'';this[_0x2979('0xc')]=_0x38f523[_0x2979('0xc')]||'inbound';this[_0x2979('0xd')]=0x0;this[_0x2979('0xe')]=0x0;this[_0x2979('0xf')]=0x0;this[_0x2979('0x10')]=0x0;this[_0x2979('0x11')]=0x0;this[_0x2979('0x12')]=0x0;this[_0x2979('0x13')]=0x0;this['unmanaged']=0x0;this[_0x2979('0x14')]=0x0;this['loggedIn']=0x0;this[_0x2979('0x15')]=0x0;this[_0x2979('0x16')]=_0x38f523[_0x2979('0x16')]||![];this[_0x2979('0x17')]=_0x38f523[_0x2979('0x17')]||0xa;this[_0x2979('0x18')]=_0x38f523[_0x2979('0x18')]||'no';this[_0x2979('0x19')]=!![];this[_0x2979('0x1a')]='';this[_0x2979('0x1b')]=0x0;this[_0x2979('0x1c')]=0x0;this[_0x2979('0x1d')]=_0x38f523[_0x2979('0x1d')]||null;this[_0x2979('0x1e')]=_0x38f523[_0x2979('0x1e')]?_0x38f523[_0x2979('0x1e')]:null;this[_0x2979('0x1f')]=_0x38f523[_0x2979('0x1f')];this[_0x2979('0x20')]=_0x38f523[_0x2979('0x20')]||_0x2979('0x21');this[_0x2979('0x22')]=_0x38f523[_0x2979('0x22')]||0x0;this[_0x2979('0x23')]=_0x38f523[_0x2979('0x23')]||0x0;this['dialPowerLevel']=_0x38f523['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x38f523[_0x2979('0x24')]||_0x2979('0x25');this[_0x2979('0x26')]=_0x38f523[_0x2979('0x26')]||0.03;this[_0x2979('0x27')]=_0x38f523[_0x2979('0x27')]||0x258;this[_0x2979('0x28')]=_0x38f523['dialOriginateCallerIdName']||_0x2979('0x29');this[_0x2979('0x2a')]=_0x38f523['dialOriginateCallerIdNumber']||_0x2979('0x29');this[_0x2979('0x2b')]=_0x38f523['dialOriginateTimeout']||0x1e;this[_0x2979('0x2c')]=_0x38f523[_0x2979('0x2c')]||_0x2979('0x2d');this[_0x2979('0x2e')]=_0x38f523['dialQueueTimeout']||0x3;this[_0x2979('0x2f')]=_0x38f523[_0x2979('0x2f')]||undefined;this[_0x2979('0x30')]=_0x38f523[_0x2979('0x30')]||0x3;this[_0x2979('0x31')]=_0x38f523['dialCongestionRetryFrequency']||0x96;this[_0x2979('0x32')]=_0x38f523[_0x2979('0x32')]||0x3;this[_0x2979('0x33')]=_0x38f523[_0x2979('0x33')]||0x96;this[_0x2979('0x34')]=_0x38f523[_0x2979('0x34')]||0x3;this[_0x2979('0x35')]=_0x38f523[_0x2979('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x38f523[_0x2979('0x36')]||0x3;this[_0x2979('0x37')]=_0x38f523[_0x2979('0x37')]||0x96;this[_0x2979('0x38')]=_0x38f523[_0x2979('0x38')]||0x3;this['dialDropRetryFrequency']=_0x38f523['dialDropRetryFrequency']||0x96;this[_0x2979('0x39')]=_0x38f523[_0x2979('0x39')]||0x3;this[_0x2979('0x3a')]=_0x38f523[_0x2979('0x3a')]||0x96;this[_0x2979('0x3b')]=_0x38f523['dialMachineMaxRetry']||0x3;this[_0x2979('0x3c')]=_0x38f523[_0x2979('0x3c')]||0x96;this[_0x2979('0x3d')]=_0x38f523[_0x2979('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x38f523[_0x2979('0x3e')]||0x96;this[_0x2979('0x3f')]=_0x38f523[_0x2979('0x3f')]||0x4;this['Trunk']=_0x38f523[_0x2979('0x40')]?_0x38f523[_0x2979('0x40')]:undefined;this[_0x2979('0x41')]=_0x38f523['TrunkBackup']?_0x38f523[_0x2979('0x41')]:undefined;this[_0x2979('0x42')]=_0x38f523[_0x2979('0x42')]||undefined;this['Interval']=_0x38f523['Interval']?_0x38f523[_0x2979('0x43')]:undefined;this[_0x2979('0x44')]=_0x38f523['dialOrderByScheduledAt']||'DESC';this[_0x2979('0x45')]=_0x38f523[_0x2979('0x45')]||undefined;this['dialCutDigit']=_0x38f523['dialCutDigit']||undefined;this[_0x2979('0x46')]=strategy[_0x38f523[_0x2979('0x46')]]||_0x2979('0x9');this[_0x2979('0x47')]=!![];this[_0x2979('0x48')]=_0x38f523[_0x2979('0x48')]||![];this[_0x2979('0x49')]=_0x38f523['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x38f523[_0x2979('0x4a')];this[_0x2979('0x4b')]=_0x38f523[_0x2979('0x4b')];this[_0x2979('0x4c')]=_0x38f523[_0x2979('0x4c')];this[_0x2979('0x4d')]=_0x38f523[_0x2979('0x4d')];this[_0x2979('0x4e')]=_0x38f523['dialAMDBetweenWordsSilence'];this[_0x2979('0x4f')]=_0x38f523[_0x2979('0x4f')];this[_0x2979('0x50')]=_0x38f523[_0x2979('0x50')];this[_0x2979('0x51')]=_0x38f523[_0x2979('0x51')];this[_0x2979('0x52')]=0x0;this['pTalking']=0x0;this[_0x2979('0x53')]=_0x38f523[_0x2979('0x53')];this[_0x2979('0x54')]=0x0;this[_0x2979('0x55')]=0x0;this[_0x2979('0x56')]=0x0;this[_0x2979('0x57')]=0x0;this[_0x2979('0x58')]=0x0;this[_0x2979('0x59')]=0x0;this[_0x2979('0x5a')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2979('0x5b')]=0x0;this[_0x2979('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2979('0x5d')]=undefined;this[_0x2979('0x5e')]=undefined;this[_0x2979('0x5f')]=undefined;this[_0x2979('0x60')]=1.05;this[_0x2979('0x61')]=0x0;this[_0x2979('0x62')]=0x0;this[_0x2979('0x63')]=0x0;this[_0x2979('0x64')]=0x0;this[_0x2979('0x65')]=0x0;this[_0x2979('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2979('0x67')]=0x0;this[_0x2979('0x68')]=_0x38f523[_0x2979('0x69')]||0x14;this[_0x2979('0x6a')]=_0x38f523['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2979('0x6b')]=0x1;this[_0x2979('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x2979('0x6d')]=0x0;this[_0x2979('0x6e')]=0x0;this[_0x2979('0x6f')]=_0x38f523['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x38f523['dialRecallInQueue']||![];this[_0x2979('0x70')]=!!_0x38f523['dialPreviewAutoRecallMe']||![];this[_0x2979('0x71')]=!!_0x38f523[_0x2979('0x71')]||![];this['dialQueueProject2']=_0x38f523[_0x2979('0x72')]||undefined;this[_0x2979('0x73')]=_0x38f523[_0x2979('0x73')]||![];this[_0x2979('0x74')]=_0x38f523[_0x2979('0x74')]||![];this[_0x2979('0xb')]=monitorFormat[_0x38f523['monitor_format']]?monitorFormat[_0x38f523[_0x2979('0xb')]]:undefined;this['mandatoryDisposition']=_0x38f523[_0x2979('0x75')]||![];this[_0x2979('0x76')]=_0x38f523[_0x2979('0x76')]?_0x38f523[_0x2979('0x76')]:undefined;}module[_0x2979('0x77')]=VoiceQueue; \ No newline at end of file +var _0xa88f=['abandoned','available','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','ringing','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged'];(function(_0x106bfd,_0x5acbdb){var _0x53909b=function(_0x3f6500){while(--_0x3f6500){_0x106bfd['push'](_0x106bfd['shift']());}};_0x53909b(++_0x5acbdb);}(_0xa88f,0xdc));var _0xfa88=function(_0x8203cf,_0x363b37){_0x8203cf=_0x8203cf-0x0;var _0x3c70f0=_0xa88f[_0x8203cf];return _0x3c70f0;};'use strict';var statusDesc=['unknown',_0xfa88('0x0'),'inuse',_0xfa88('0x1'),_0xfa88('0x2'),'unavailable',_0xfa88('0x3'),_0xfa88('0x4'),_0xfa88('0x5')];var monitorFormat={'wav':_0xfa88('0x6'),'wav49':'wav49','gsm':_0xfa88('0x7')};var strategy={'rrmemory':_0xfa88('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x13d27d){this['id']=_0x13d27d['id']||0x0;this['name']=_0x13d27d[_0xfa88('0x9')]||'';this[_0xfa88('0xa')]=_0x13d27d[_0xfa88('0xa')]||'';this[_0xfa88('0xb')]=_0x13d27d[_0xfa88('0xb')]||_0xfa88('0xc');this['waiting']=0x0;this[_0xfa88('0xd')]=0x0;this[_0xfa88('0xe')]=0x0;this[_0xfa88('0xf')]=0x0;this[_0xfa88('0x10')]=0x0;this[_0xfa88('0x11')]=0x0;this[_0xfa88('0x12')]=0x0;this[_0xfa88('0x13')]=0x0;this[_0xfa88('0x14')]=0x0;this['loggedIn']=0x0;this[_0xfa88('0x15')]=0x0;this['acw']=_0x13d27d['acw']||![];this[_0xfa88('0x16')]=_0x13d27d[_0xfa88('0x16')]||0xa;this[_0xfa88('0x17')]=_0x13d27d[_0xfa88('0x17')]||'no';this[_0xfa88('0x18')]=!![];this[_0xfa88('0x19')]='';this['originated']=0x0;this['temp']=0x0;this[_0xfa88('0x1a')]=_0x13d27d[_0xfa88('0x1a')]||null;this[_0xfa88('0x1b')]=_0x13d27d[_0xfa88('0x1b')]?_0x13d27d['dialGlobalInterval']:null;this[_0xfa88('0x1c')]=_0x13d27d['dialActive'];this['dialMethod']=_0x13d27d[_0xfa88('0x1d')]||_0xfa88('0x1e');this['dialLimitChannel']=_0x13d27d[_0xfa88('0x1f')]||0x0;this[_0xfa88('0x20')]=_0x13d27d[_0xfa88('0x20')]||0x0;this[_0xfa88('0x21')]=_0x13d27d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x13d27d[_0xfa88('0x22')]||'dropRate';this[_0xfa88('0x23')]=_0x13d27d[_0xfa88('0x23')]||0.03;this[_0xfa88('0x24')]=_0x13d27d[_0xfa88('0x24')]||0x258;this[_0xfa88('0x25')]=_0x13d27d[_0xfa88('0x25')]||_0xfa88('0x26');this[_0xfa88('0x27')]=_0x13d27d[_0xfa88('0x27')]||_0xfa88('0x26');this[_0xfa88('0x28')]=_0x13d27d[_0xfa88('0x28')]||0x1e;this[_0xfa88('0x29')]=_0x13d27d['dialQueueOptions']||_0xfa88('0x2a');this[_0xfa88('0x2b')]=_0x13d27d[_0xfa88('0x2b')]||0x3;this[_0xfa88('0x2c')]=_0x13d27d[_0xfa88('0x2c')]||undefined;this[_0xfa88('0x2d')]=_0x13d27d[_0xfa88('0x2d')]||0x3;this[_0xfa88('0x2e')]=_0x13d27d[_0xfa88('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x13d27d['dialBusyMaxRetry']||0x3;this[_0xfa88('0x2f')]=_0x13d27d[_0xfa88('0x2f')]||0x96;this[_0xfa88('0x30')]=_0x13d27d['dialNoAnswerMaxRetry']||0x3;this[_0xfa88('0x31')]=_0x13d27d[_0xfa88('0x31')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x13d27d['dialNoSuchNumberMaxRetry']||0x3;this[_0xfa88('0x32')]=_0x13d27d[_0xfa88('0x32')]||0x96;this[_0xfa88('0x33')]=_0x13d27d[_0xfa88('0x33')]||0x3;this[_0xfa88('0x34')]=_0x13d27d[_0xfa88('0x34')]||0x96;this[_0xfa88('0x35')]=_0x13d27d[_0xfa88('0x35')]||0x3;this[_0xfa88('0x36')]=_0x13d27d['dialAbandonedRetryFrequency']||0x96;this[_0xfa88('0x37')]=_0x13d27d[_0xfa88('0x37')]||0x3;this['dialMachineRetryFrequency']=_0x13d27d[_0xfa88('0x38')]||0x96;this[_0xfa88('0x39')]=_0x13d27d[_0xfa88('0x39')]||0x3;this[_0xfa88('0x3a')]=_0x13d27d[_0xfa88('0x3a')]||0x96;this[_0xfa88('0x3b')]=_0x13d27d[_0xfa88('0x3b')]||0x4;this[_0xfa88('0x3c')]=_0x13d27d['Trunk']?_0x13d27d[_0xfa88('0x3c')]:undefined;this['TrunkBackup']=_0x13d27d[_0xfa88('0x3d')]?_0x13d27d['TrunkBackup']:undefined;this['dialPrefix']=_0x13d27d[_0xfa88('0x3e')]||undefined;this[_0xfa88('0x3f')]=_0x13d27d[_0xfa88('0x3f')]?_0x13d27d[_0xfa88('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x13d27d[_0xfa88('0x40')]||_0xfa88('0x41');this[_0xfa88('0x42')]=_0x13d27d[_0xfa88('0x42')]||undefined;this[_0xfa88('0x43')]=_0x13d27d[_0xfa88('0x43')]||undefined;this['strategy']=strategy[_0x13d27d[_0xfa88('0x44')]]||_0xfa88('0x8');this[_0xfa88('0x45')]=!![];this['dialAMDActive']=_0x13d27d[_0xfa88('0x46')]||![];this[_0xfa88('0x47')]=_0x13d27d[_0xfa88('0x47')];this[_0xfa88('0x48')]=_0x13d27d[_0xfa88('0x48')];this['dialAMDAfterGreetingSilence']=_0x13d27d[_0xfa88('0x49')];this[_0xfa88('0x4a')]=_0x13d27d[_0xfa88('0x4a')];this['dialAMDMinWordLength']=_0x13d27d[_0xfa88('0x4b')];this['dialAMDBetweenWordsSilence']=_0x13d27d[_0xfa88('0x4c')];this[_0xfa88('0x4d')]=_0x13d27d[_0xfa88('0x4d')];this[_0xfa88('0x4e')]=_0x13d27d[_0xfa88('0x4e')];this[_0xfa88('0x4f')]=_0x13d27d[_0xfa88('0x4f')];this[_0xfa88('0x50')]=0x0;this[_0xfa88('0x51')]=0x0;this[_0xfa88('0x52')]=_0x13d27d[_0xfa88('0x52')];this[_0xfa88('0x53')]=0x0;this[_0xfa88('0x54')]=0x0;this[_0xfa88('0x55')]=0x0;this[_0xfa88('0x56')]=0x0;this[_0xfa88('0x57')]=0x0;this[_0xfa88('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xfa88('0x59')]=0x0;this[_0xfa88('0x5a')]=0x0;this[_0xfa88('0x5b')]=0x0;this[_0xfa88('0x5c')]=0x0;this['outboundReCallsDay']=0x0;this[_0xfa88('0x5d')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xfa88('0x5e')]=undefined;this[_0xfa88('0x5f')]=1.05;this[_0xfa88('0x60')]=0x0;this[_0xfa88('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xfa88('0x62')]=0x0;this[_0xfa88('0x63')]=0x0;this[_0xfa88('0x64')]=0x0;this[_0xfa88('0x65')]=0x0;this[_0xfa88('0x66')]=0x0;this[_0xfa88('0x67')]=_0x13d27d['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x13d27d[_0xfa88('0x68')]||0xa;this[_0xfa88('0x69')]=0x0;this[_0xfa88('0x6a')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xfa88('0x6b')]=0x0;this[_0xfa88('0x6c')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xfa88('0x6d')]=0x0;this[_0xfa88('0x6e')]=_0x13d27d[_0xfa88('0x6e')]||0x1e;this['dialRecallInQueue']=_0x13d27d[_0xfa88('0x6f')]||![];this['dialPreviewAutoRecallMe']=!!_0x13d27d[_0xfa88('0x70')]||![];this[_0xfa88('0x71')]=!!_0x13d27d['dialPreviewRecallmeReminder']||![];this[_0xfa88('0x72')]=_0x13d27d[_0xfa88('0x72')]||undefined;this[_0xfa88('0x73')]=_0x13d27d[_0xfa88('0x73')]||![];this[_0xfa88('0x74')]=_0x13d27d['dialAgiAfterHangupAgent']||![];this[_0xfa88('0xa')]=monitorFormat[_0x13d27d[_0xfa88('0xa')]]?monitorFormat[_0x13d27d[_0xfa88('0xa')]]:undefined;this[_0xfa88('0x75')]=_0x13d27d[_0xfa88('0x75')]||![];this['mandatoryDispositionPause']=_0x13d27d[_0xfa88('0x76')]?_0x13d27d[_0xfa88('0x76')]:undefined;}module[_0xfa88('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9f70f08..338a4ba 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 _0xe698=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1e2c3b,_0x5bf556){var _0x379590=function(_0x1839c2){while(--_0x1839c2){_0x1e2c3b['push'](_0x1e2c3b['shift']());}};_0x379590(++_0x5bf556);}(_0xe698,0xd7));var _0x8e69=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe698[_0x19950b];return _0x3c6b41;};'use strict';function VtigerAccount(_0x2229e8){this['id']=_0x2229e8['id']||0x0;this['name']=_0x2229e8[_0x8e69('0x0')]||'';this[_0x8e69('0x1')]=_0x2229e8[_0x8e69('0x1')]||'';this[_0x8e69('0x2')]=_0x2229e8[_0x8e69('0x2')]||'';this[_0x8e69('0x3')]=_0x2229e8['remoteUri']||'';this[_0x8e69('0x4')]=_0x2229e8[_0x8e69('0x4')]||'';this[_0x8e69('0x5')]=_0x2229e8[_0x8e69('0x5')]||{};}module[_0x8e69('0x6')]=VtigerAccount; \ No newline at end of file +var _0x168b=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x300a9f,_0x5c7e8b){var _0x920790=function(_0x3e7fe7){while(--_0x3e7fe7){_0x300a9f['push'](_0x300a9f['shift']());}};_0x920790(++_0x5c7e8b);}(_0x168b,0x1f3));var _0xb168=function(_0x42f6cf,_0x20aae8){_0x42f6cf=_0x42f6cf-0x0;var _0x129bc2=_0x168b[_0x42f6cf];return _0x129bc2;};'use strict';function VtigerAccount(_0x5ec47a){this['id']=_0x5ec47a['id']||0x0;this[_0xb168('0x0')]=_0x5ec47a['name']||'';this[_0xb168('0x1')]=_0x5ec47a[_0xb168('0x1')]||'';this[_0xb168('0x2')]=_0x5ec47a[_0xb168('0x2')]||'';this[_0xb168('0x3')]=_0x5ec47a[_0xb168('0x3')]||'';this[_0xb168('0x4')]=_0x5ec47a[_0xb168('0x4')]||'';this[_0xb168('0x5')]=_0x5ec47a['Configurations']||{};}module[_0xb168('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 02919f6..14d103a 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 _0xd270=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username','password'];(function(_0x271329,_0x391784){var _0x9cc80d=function(_0x33c321){while(--_0x33c321){_0x271329['push'](_0x271329['shift']());}};_0x9cc80d(++_0x391784);}(_0xd270,0x1b7));var _0x0d27=function(_0x5494fa,_0x3e1301){_0x5494fa=_0x5494fa-0x0;var _0x38993b=_0xd270[_0x5494fa];return _0x38993b;};'use strict';function ZendeskAccount(_0x158f2a){this['id']=_0x158f2a['id']||0x0;this['name']=_0x158f2a['name']||'';this[_0x0d27('0x0')]=_0x158f2a[_0x0d27('0x0')]||'';this[_0x0d27('0x1')]=_0x158f2a[_0x0d27('0x1')]||'';this['token']=_0x158f2a['token']||'';this[_0x0d27('0x2')]=_0x158f2a[_0x0d27('0x2')]||'';this[_0x0d27('0x3')]=_0x158f2a['authType']||'';this[_0x0d27('0x4')]=_0x158f2a[_0x0d27('0x4')]||_0x0d27('0x5');this[_0x0d27('0x6')]=_0x158f2a['serverUrl']||'';this[_0x0d27('0x7')]=_0x158f2a['Configurations']||{};}module[_0x0d27('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xa107=['password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username'];(function(_0x41fbe7,_0x437845){var _0x1a567a=function(_0x1843f1){while(--_0x1843f1){_0x41fbe7['push'](_0x41fbe7['shift']());}};_0x1a567a(++_0x437845);}(_0xa107,0x12a));var _0x7a10=function(_0x407e75,_0x1fb0c7){_0x407e75=_0x407e75-0x0;var _0x4a3be6=_0xa107[_0x407e75];return _0x4a3be6;};'use strict';function ZendeskAccount(_0x1ae0bc){this['id']=_0x1ae0bc['id']||0x0;this[_0x7a10('0x0')]=_0x1ae0bc[_0x7a10('0x0')]||'';this[_0x7a10('0x1')]=_0x1ae0bc[_0x7a10('0x1')]||'';this['password']=_0x1ae0bc[_0x7a10('0x2')]||'';this[_0x7a10('0x3')]=_0x1ae0bc['token']||'';this[_0x7a10('0x4')]=_0x1ae0bc[_0x7a10('0x4')]||'';this[_0x7a10('0x5')]=_0x1ae0bc[_0x7a10('0x5')]||'';this[_0x7a10('0x6')]=_0x1ae0bc[_0x7a10('0x6')]||'integrationTab';this['serverUrl']=_0x1ae0bc[_0x7a10('0x7')]||'';this[_0x7a10('0x8')]=_0x1ae0bc[_0x7a10('0x8')]||{};}module[_0x7a10('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 8702819..c78af99 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 _0x7a63=['code','refreshToken','Configurations','name','description','host','zone','clientSecret','serverUrl'];(function(_0x2b3c9d,_0x1c8c0c){var _0x4b8037=function(_0x225327){while(--_0x225327){_0x2b3c9d['push'](_0x2b3c9d['shift']());}};_0x4b8037(++_0x1c8c0c);}(_0x7a63,0x1e9));var _0x37a6=function(_0xe5520b,_0x5e0a35){_0xe5520b=_0xe5520b-0x0;var _0x5d862c=_0x7a63[_0xe5520b];return _0x5d862c;};'use strict';function ZohoAccount(_0x1707cc){this['id']=_0x1707cc['id']||0x0;this[_0x37a6('0x0')]=_0x1707cc[_0x37a6('0x0')]||'';this[_0x37a6('0x1')]=_0x1707cc[_0x37a6('0x1')]||'';this[_0x37a6('0x2')]=_0x1707cc['host']||'';this[_0x37a6('0x3')]=_0x1707cc[_0x37a6('0x3')]||'';this['clientId']=_0x1707cc['clientId']||'';this['clientSecret']=_0x1707cc[_0x37a6('0x4')]||'';this[_0x37a6('0x5')]=_0x1707cc[_0x37a6('0x5')]||'';this['code']=_0x1707cc[_0x37a6('0x6')]||'';this['refreshToken']=_0x1707cc[_0x37a6('0x7')]||'';this[_0x37a6('0x8')]=_0x1707cc[_0x37a6('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x0181=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x25d4b3,_0x485359){var _0x34b49c=function(_0x8a1f24){while(--_0x8a1f24){_0x25d4b3['push'](_0x25d4b3['shift']());}};_0x34b49c(++_0x485359);}(_0x0181,0x171));var _0x1018=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x0181[_0xcf5436];return _0xc4f5c8;};'use strict';function ZohoAccount(_0x401195){this['id']=_0x401195['id']||0x0;this['name']=_0x401195[_0x1018('0x0')]||'';this['description']=_0x401195['description']||'';this[_0x1018('0x1')]=_0x401195[_0x1018('0x1')]||'';this[_0x1018('0x2')]=_0x401195['zone']||'';this[_0x1018('0x3')]=_0x401195[_0x1018('0x3')]||'';this[_0x1018('0x4')]=_0x401195[_0x1018('0x4')]||'';this[_0x1018('0x5')]=_0x401195['serverUrl']||'';this[_0x1018('0x6')]=_0x401195['code']||'';this[_0x1018('0x7')]=_0x401195[_0x1018('0x7')]||'';this[_0x1018('0x8')]=_0x401195[_0x1018('0x8')]||{};}module[_0x1018('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 cdecbba..ecb8304 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 _0x35f3=['countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','isNil','string','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry'];(function(_0x59cb43,_0xa451a){var _0x1bdcc5=function(_0x46f5e9){while(--_0x46f5e9){_0x59cb43['push'](_0x59cb43['shift']());}};_0x1bdcc5(++_0xa451a);}(_0x35f3,0xdb));var _0x335f=function(_0x31dc9e,_0x4e9999){_0x31dc9e=_0x31dc9e-0x0;var _0x114dff=_0x35f3[_0x31dc9e];return _0x114dff;};'use strict';var util=require(_0x335f('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x426606,_0x313b18,_0x475487){var _0x20966e='';if(!_[_0x335f('0x1')](_0x313b18)&&_0x335f('0x2')===typeof _0x313b18){_0x20966e+=_0x313b18;}if(!_[_0x335f('0x1')](_0x475487)&&_0x335f('0x2')===typeof _0x475487){_0x20966e+='\x20'+_0x475487;}if(_0x20966e!==''){return _0x20966e;}return _0x426606;}function Action(_0x29f62b,_0x3f9e8c,_0x48d67f,_0x49589f,_0x29f7dd){this[_0x335f('0x3')]=_0x48d67f||undefined;this[_0x335f('0x4')]=_0x29f62b['id'];this[_0x335f('0x5')]=_0x3f9e8c['name'];this[_0x335f('0x6')]=_0x3f9e8c['type'];this['campaigntype']=_0x335f('0x5');this[_0x335f('0x7')]=![];this[_0x335f('0x8')]=_['isNil'](_0x29f62b[_0x335f('0x9')])?undefined:_0x29f62b['Agent']['name'];this[_0x335f('0xa')]=this['membername']?util[_0x335f('0xb')](_0x335f('0xc'),this['membername']):_0x49589f||undefined;this[_0x335f('0xd')]=checkNameSurname(_0x29f62b[_0x335f('0xe')][_0x335f('0xf')],_0x29f62b[_0x335f('0xe')][_0x335f('0x10')],_0x29f62b['Contact'][_0x335f('0x11')]);this['active']=_0x29f62b[_0x335f('0x12')]||![];this[_0x335f('0x13')]=_0x29f62b[_0x335f('0xe')][_0x335f('0xf')];this['scheduledat']=_0x29f62b[_0x335f('0x14')];this[_0x335f('0x15')]=_0x29f62b[_0x335f('0x15')]||0x0;this['countcongestionretry']=_0x29f62b[_0x335f('0x16')]||0x0;this[_0x335f('0x17')]=_0x29f62b['countnoanswerretry']||0x0;this[_0x335f('0x18')]=(_0x29f62b[_0x335f('0x15')]||0x0)+(_0x29f62b[_0x335f('0x16')]||0x0)+(_0x29f62b[_0x335f('0x17')]||0x0)+(_0x29f62b[_0x335f('0x19')]||0x0)+(_0x29f62b['countdropretry']||0x0)+(_0x29f62b[_0x335f('0x1a')]||0x0)+(_0x29f62b[_0x335f('0x1b')]||0x0)+(_0x29f62b[_0x335f('0x1c')]||0x0);this[_0x335f('0x19')]=_0x29f62b[_0x335f('0x19')]||0x0;this[_0x335f('0x1d')]=_0x29f62b[_0x335f('0x1d')]||0x0;this[_0x335f('0x1a')]=_0x29f62b['countabandonedretry']||0x0;this['countmachineretry']=_0x29f62b['countmachineretry']||0x0;this[_0x335f('0x1c')]=_0x29f62b['countagentrejectretry']||0x0;this[_0x335f('0x1e')]=_0x29f62b[_0x335f('0x1e')];this[_0x335f('0x1f')]=_0x29f62b[_0x335f('0x1f')];this[_0x335f('0x20')]=_0x29f62b[_0x335f('0x20')];this['recallme']=_0x29f62b['recallme'];this['ContactId']=_0x29f62b['ContactId'];this['ListId']=_0x29f62b['ListId'];this[_0x335f('0x21')]=_[_0x335f('0x1')](_0x29f62b[_0x335f('0x9')])?_0x29f62b['UserId']:_0x29f62b['Agent']['id'];this[_0x335f('0x22')]=_0x29f62b[_0x335f('0x22')];this[_0x335f('0x23')]='';this[_0x335f('0x24')]='';}Action['prototype'][_0x335f('0x25')]=function(){return util['format'](_0x335f('0x26'),this['calleridname'],this[_0x335f('0x27')]);};module[_0x335f('0x28')]=Action; \ No newline at end of file +var _0xc52d=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active'];(function(_0xf96d90,_0x494f88){var _0x309146=function(_0xecd191){while(--_0xecd191){_0xf96d90['push'](_0xf96d90['shift']());}};_0x309146(++_0x494f88);}(_0xc52d,0xa1));var _0xdc52=function(_0x14626a,_0x35f249){_0x14626a=_0x14626a-0x0;var _0x3e9a14=_0xc52d[_0x14626a];return _0x3e9a14;};'use strict';var util=require(_0xdc52('0x0'));var _=require(_0xdc52('0x1'));var moment=require(_0xdc52('0x2'));function checkNameSurname(_0x1645a3,_0x1543ec,_0x506587){var _0x4a61a7='';if(!_[_0xdc52('0x3')](_0x1543ec)&&_0xdc52('0x4')===typeof _0x1543ec){_0x4a61a7+=_0x1543ec;}if(!_[_0xdc52('0x3')](_0x506587)&&'string'===typeof _0x506587){_0x4a61a7+='\x20'+_0x506587;}if(_0x4a61a7!==''){return _0x4a61a7;}return _0x1645a3;}function Action(_0x10aa5f,_0x13e467,_0x5aa112,_0x3f6f85,_0xc4d258){this[_0xdc52('0x5')]=_0x5aa112||undefined;this[_0xdc52('0x6')]=_0x10aa5f['id'];this['queue']=_0x13e467[_0xdc52('0x7')];this[_0xdc52('0x8')]=_0x13e467[_0xdc52('0x8')];this[_0xdc52('0x9')]=_0xdc52('0xa');this[_0xdc52('0xb')]=![];this[_0xdc52('0xc')]=_[_0xdc52('0x3')](_0x10aa5f[_0xdc52('0xd')])?undefined:_0x10aa5f[_0xdc52('0xd')][_0xdc52('0x7')];this[_0xdc52('0xe')]=this['membername']?util[_0xdc52('0xf')](_0xdc52('0x10'),this[_0xdc52('0xc')]):_0x3f6f85||undefined;this[_0xdc52('0x11')]=checkNameSurname(_0x10aa5f[_0xdc52('0x12')][_0xdc52('0x13')],_0x10aa5f[_0xdc52('0x12')][_0xdc52('0x14')],_0x10aa5f[_0xdc52('0x12')][_0xdc52('0x15')]);this['active']=_0x10aa5f[_0xdc52('0x16')]||![];this['calleridnum']=_0x10aa5f[_0xdc52('0x12')]['phone'];this['scheduledat']=_0x10aa5f[_0xdc52('0x17')];this[_0xdc52('0x18')]=_0x10aa5f['countbusyretry']||0x0;this['countcongestionretry']=_0x10aa5f[_0xdc52('0x19')]||0x0;this[_0xdc52('0x1a')]=_0x10aa5f[_0xdc52('0x1a')]||0x0;this[_0xdc52('0x1b')]=(_0x10aa5f[_0xdc52('0x18')]||0x0)+(_0x10aa5f['countcongestionretry']||0x0)+(_0x10aa5f[_0xdc52('0x1a')]||0x0)+(_0x10aa5f[_0xdc52('0x1c')]||0x0)+(_0x10aa5f['countdropretry']||0x0)+(_0x10aa5f['countabandonedretry']||0x0)+(_0x10aa5f[_0xdc52('0x1d')]||0x0)+(_0x10aa5f[_0xdc52('0x1e')]||0x0);this['countnosuchnumberretry']=_0x10aa5f[_0xdc52('0x1c')]||0x0;this[_0xdc52('0x1f')]=_0x10aa5f['countdropretry']||0x0;this['countabandonedretry']=_0x10aa5f[_0xdc52('0x20')]||0x0;this[_0xdc52('0x1d')]=_0x10aa5f['countmachineretry']||0x0;this['countagentrejectretry']=_0x10aa5f[_0xdc52('0x1e')]||0x0;this[_0xdc52('0x21')]=_0x10aa5f[_0xdc52('0x21')];this[_0xdc52('0x22')]=_0x10aa5f[_0xdc52('0x22')];this['callbackat']=_0x10aa5f[_0xdc52('0x23')];this[_0xdc52('0x24')]=_0x10aa5f[_0xdc52('0x24')];this[_0xdc52('0x25')]=_0x10aa5f[_0xdc52('0x25')];this[_0xdc52('0x26')]=_0x10aa5f[_0xdc52('0x26')];this[_0xdc52('0x27')]=_[_0xdc52('0x3')](_0x10aa5f[_0xdc52('0xd')])?_0x10aa5f['UserId']:_0x10aa5f[_0xdc52('0xd')]['id'];this[_0xdc52('0x28')]=_0x10aa5f[_0xdc52('0x28')];this['originatecalleridnum']='';this[_0xdc52('0x29')]='';}Action[_0xdc52('0x2a')]['getCaller']=function(){return util[_0xdc52('0xf')](_0xdc52('0x2b'),this[_0xdc52('0x11')],this[_0xdc52('0x2c')]);};module[_0xdc52('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index fe9cc2c..36a5698 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 _0x24ca=['dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','updateOriginated','[originated][decrement][callProgressDetectingAgent]','Contact','phone','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','activeContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt'];(function(_0x2602a5,_0x1d38ab){var _0x22bb16=function(_0x268bc6){while(--_0x268bc6){_0x2602a5['push'](_0x2602a5['shift']());}};_0x22bb16(++_0x1d38ab);}(_0x24ca,0x8c));var _0xa24c=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x24ca[_0x2fbcf6];return _0x3e7265;};'use strict';var util=require(_0xa24c('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xa24c('0x1'));var moment=require('moment');var md5=require(_0xa24c('0x2'));var Redis=require(_0xa24c('0x3'));var config=require(_0xa24c('0x4'));var logger=require('../../../config/logger')(_0xa24c('0x5'));var loggerAction=require(_0xa24c('0x6'))(_0xa24c('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0xa24c('0x8'));config[_0xa24c('0x9')]=_[_0xa24c('0xa')](config[_0xa24c('0x9')],{'host':_0xa24c('0xb'),'port':0x18eb});var io=require(_0xa24c('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa24c('0xd')][_0xa24c('0xe')]=function(_0x355882){this['tail']=this['tail']?this[_0xa24c('0xf')][_0xa24c('0x10')](_0x355882):_0x355882();};function Preview(_0x2da0c3){this[_0xa24c('0x11')]=new Sequence();this[_0xa24c('0x12')]=_0x2da0c3[_0xa24c('0x13')];this['trunks']=_0x2da0c3['trunks'];this['actions']={};this[_0xa24c('0x14')]=_0x2da0c3[_0xa24c('0x14')];this[_0xa24c('0x15')]=0x0;ami['on'](_0xa24c('0x16'),this[_0xa24c('0x17')]['bind'](this));ami['on'](_0xa24c('0x18'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0xa24c('0x19')][_0xa24c('0x1a')](this));ami['on'](_0xa24c('0x1b'),this[_0xa24c('0x1c')][_0xa24c('0x1a')](this));ami['on'](_0xa24c('0x1d'),this[_0xa24c('0x1e')][_0xa24c('0x1a')](this));ami['on'](_0xa24c('0x1f'),this[_0xa24c('0x20')][_0xa24c('0x1a')](this));ami['on'](_0xa24c('0x21'),this[_0xa24c('0x22')][_0xa24c('0x1a')](this));ami['on']('blindtransfer',this[_0xa24c('0x23')]['bind'](this));this[_0xa24c('0x24')](this[_0xa24c('0x12')]);}function emit(_0x8c3949,_0x37e20e,_0x240f6c){io['to'](_0x8c3949)[_0xa24c('0x25')](_0x37e20e,_0x240f6c);}function emitCampaignPreview(_0x38dfdc){if(_0x38dfdc[_0xa24c('0x26')]===_0xa24c('0x27')){var _0x2ec5ad={'id':_0x38dfdc['id'],'name':_0x38dfdc[_0xa24c('0x28')],'strategy':_0x38dfdc['strategy'],'answered':_0x38dfdc['answered'],'available':_0x38dfdc[_0xa24c('0x29')],'loggedIn':_0x38dfdc[_0xa24c('0x2a')],'pTalking':_0x38dfdc[_0xa24c('0x2b')],'sumBillable':_0x38dfdc[_0xa24c('0x2c')],'sumDuration':_0x38dfdc[_0xa24c('0x2d')],'sumHoldTime':_0x38dfdc[_0xa24c('0x2e')]||0x0,'talking':_0x38dfdc[_0xa24c('0x2f')],'total':_0x38dfdc[_0xa24c('0x30')],'type':_0x38dfdc[_0xa24c('0x26')],'unmanaged':_0x38dfdc['unmanaged'],'abandoned':_0x38dfdc[_0xa24c('0x31')],'waiting':_0x38dfdc['waiting'],'loggedInDb':_0x38dfdc[_0xa24c('0x32')],'dialActive':_0x38dfdc[_0xa24c('0x33')],'dialMethod':_0x38dfdc[_0xa24c('0x34')],'dialOriginateCallerIdName':_0x38dfdc[_0xa24c('0x35')],'dialOriginateCallerIdNumber':_0x38dfdc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x38dfdc['dialOriginateTimeout'],'dialPrefix':_0x38dfdc['dialPrefix'],'outboundAnswerAgiCallsDay':_0x38dfdc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x38dfdc[_0xa24c('0x36')],'outboundBlacklistCallsDay':_0x38dfdc[_0xa24c('0x37')],'outboundBusyCallsDay':_0x38dfdc[_0xa24c('0x38')],'outboundCongestionCallsDay':_0x38dfdc[_0xa24c('0x39')],'outboundDropCallsDayACS':_0x38dfdc[_0xa24c('0x3a')],'outboundDropCallsDayCallersExit':_0x38dfdc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x38dfdc['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x38dfdc[_0xa24c('0x3b')],'outboundNoSuchCallsDay':_0x38dfdc[_0xa24c('0x3c')],'outboundOriginateFailureCallsDay':_0x38dfdc[_0xa24c('0x3d')],'outboundReCallsDay':_0x38dfdc[_0xa24c('0x3e')],'outboundRejectCallsDay':_0x38dfdc[_0xa24c('0x3f')],'outboundUnknownCallsDay':_0x38dfdc[_0xa24c('0x40')],'outboundAbandonedCallsDay':_0x38dfdc[_0xa24c('0x41')],'predictiveIntervalAnsweredCalls':_0x38dfdc[_0xa24c('0x42')],'predictiveIntervalAvgHoldtime':_0x38dfdc[_0xa24c('0x43')],'predictiveIntervalAvgTalktime':_0x38dfdc[_0xa24c('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x38dfdc['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x38dfdc[_0xa24c('0x45')],'predictiveIntervalErlangCalls':_0x38dfdc[_0xa24c('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x38dfdc['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x38dfdc[_0xa24c('0x47')],'predictiveIntervalMultiplicativeFactor':_0x38dfdc[_0xa24c('0x48')],'predictiveIntervalPauses':_0x38dfdc[_0xa24c('0x49')],'predictiveIntervalAvailable':_0x38dfdc[_0xa24c('0x4a')],'predictiveIntervalTotalCalls':_0x38dfdc[_0xa24c('0x4b')],'message':_0x38dfdc[_0xa24c('0x4c')],'originated':_0x38dfdc[_0xa24c('0x4d')],'erlangCalls':_0x38dfdc[_0xa24c('0x4e')],'erlangCallToSecond':_0x38dfdc[_0xa24c('0x4f')],'erlangAbandonmentRate':_0x38dfdc[_0xa24c('0x50')],'erlangBusyFactor':_0x38dfdc['erlangBusyFactor'],'startPredictive':_0x38dfdc['startPredictive'],'startProgressive':_0x38dfdc['startProgressive']};if(_0x38dfdc[_0xa24c('0x51')]){_0x2ec5ad['Trunk']={'id':_0x38dfdc[_0xa24c('0x51')]['id'],'name':_0x38dfdc[_0xa24c('0x51')][_0xa24c('0x28')],'active':_0x38dfdc['Trunk'][_0xa24c('0x52')],'callerid':_0x38dfdc[_0xa24c('0x51')][_0xa24c('0x53')]};}if(_0x38dfdc['Interval']){_0x2ec5ad[_0xa24c('0x54')]={'id':_0x38dfdc[_0xa24c('0x54')]['id'],'name':_0x38dfdc['Interval'][_0xa24c('0x28')]};}var _0x22fd0f=md5(JSON[_0xa24c('0x55')](_0x2ec5ad));if(_0x38dfdc['md5']!==_0x22fd0f){_0x38dfdc[_0xa24c('0x2')]=_0x22fd0f;emit(util[_0xa24c('0x56')](_0xa24c('0x57'),_0x2ec5ad[_0xa24c('0x28')]),_0xa24c('0x58'),_0x2ec5ad);}}}function emitVoiceQueueChannelRemove(_0x4a9d2d){logger[_0xa24c('0x59')](_0xa24c('0x5a'),JSON['stringify'](_0x4a9d2d));emit(util[_0xa24c('0x56')](_0xa24c('0x57'),_0x4a9d2d[_0xa24c('0x28')]),'voice_queue_channel:remove',_0x4a9d2d);io['emit'](_0xa24c('0x5b'),_0x4a9d2d);}function notSendMessagesQueue(_0xa5c873){if(_0xa5c873[_0xa24c('0x5c')]){if(_0xa5c873[_0xa24c('0x4d')]===0x0&&_0xa5c873[_0xa24c('0x2b')]===0x0){_0xa5c873[_0xa24c('0x5c')]=![];_0xa5c873['available']=0x0;_0xa5c873[_0xa24c('0x5d')]=0x0;_0xa5c873[_0xa24c('0x4c')]=_0xa24c('0x5e');ut[_0xa24c('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xa5c873[_0xa24c('0x28')]+_0xa24c('0x60'));}else{_0xa5c873[_0xa24c('0x4c')]=_0xa24c('0x61');ut[_0xa24c('0x5f')](_0xa24c('0x62'),_0xa5c873[_0xa24c('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0xa5c873);}}Preview['prototype'][_0xa24c('0x24')]=function(){var _0x4dde63=this;setInterval(function(){_0x4dde63[_0xa24c('0x63')]();},0x7cf);};Preview['prototype'][_0xa24c('0x63')]=function(){var _0x214627=this[_0xa24c('0x12')];this[_0xa24c('0x15')]+=0x1;for(var _0x21328f in _0x214627){if(_0x214627[_0xa24c('0x64')](_0x21328f)&&(_0x214627[_0x21328f][_0xa24c('0x34')]===_0xa24c('0x5')||_0x214627[_0x21328f][_0xa24c('0x34')]===_0xa24c('0x65'))&&_0x214627[_0x21328f][_0xa24c('0x26')]===_0xa24c('0x27')){if(this[_0xa24c('0x15')]>0x7){this[_0xa24c('0x15')]=0x0;this[_0xa24c('0x66')]();}}if(_0x214627[_0xa24c('0x64')](_0x21328f)&&_0x214627[_0x21328f]['dialMethod']===_0xa24c('0x5')&&_0x214627[_0x21328f][_0xa24c('0x26')]===_0xa24c('0x27')){if(_0x214627[_0x21328f]['dialActive']){this[_0xa24c('0x67')](_0x214627[_0x21328f]);if(_0x214627[_0x21328f][_0xa24c('0x68')])this[_0xa24c('0x69')](_0x214627[_0x21328f]);}else{notSendMessagesQueue(_0x214627[_0x21328f]);}}}};Preview[_0xa24c('0xd')]['clearZombieChannel']=function(_0x67a84e){var _0x3703fc=this;this[_0xa24c('0x11')][_0xa24c('0xe')](function(){if(!_[_0xa24c('0x6a')](_0x3703fc[_0xa24c('0x6b')][_0x67a84e])){loggerAction[_0xa24c('0x59')](_0xa24c('0x6c'),_0x67a84e,_0xa24c('0x6d'),_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x6e')],_0xa24c('0x6f'),JSON[_0xa24c('0x55')](_0x3703fc['campaignsPreview'][_0x3703fc[_0xa24c('0x6b')][_0x67a84e]['queue']][_0xa24c('0x4d')]),_0xa24c('0x70'),JSON[_0xa24c('0x55')](_0x3703fc[_0xa24c('0x12')][_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x6e')]][_0xa24c('0x2b')]),JSON[_0xa24c('0x55')](_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x71')]),JSON[_0xa24c('0x55')](_[_0xa24c('0x72')](_0x3703fc[_0xa24c('0x6b')][_0x67a84e],['contactId',_0xa24c('0x73'),_0xa24c('0x74'),_0xa24c('0x75')])));return ami[_0xa24c('0x76')]({'action':'status','channel':_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x77')]})[_0xa24c('0x78')](function(_0x4f3778){if(_0x4f3778['message']===_0xa24c('0x79')){setTimeout(function(){if(_0x3703fc[_0xa24c('0x6b')][_0x67a84e]){ut['updateOriginated'](_0x3703fc[_0xa24c('0x12')][_0x3703fc[_0xa24c('0x6b')][_0x67a84e]['queue']],_0xa24c('0x7a'));if(_0x3703fc['actions'][_0x67a84e]['dialAnswer']===!![]){ut[_0xa24c('0x7b')](_0x3703fc['campaignsPreview'][_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x6e')]],'[clearZombieChannel]');ut[_0xa24c('0x7c')](_0xa24c('0x7d')+_0x67a84e,_0x3703fc[_0xa24c('0x6b')][_0x67a84e][_0xa24c('0x6e')]);}ut['loggerError'](_0xa24c('0x7e')+_0x67a84e,_0x3703fc['actions'][_0x67a84e][_0xa24c('0x6e')]);delete _0x3703fc[_0xa24c('0x6b')][_0x67a84e];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x2cabd8=this;loggerAction[_0xa24c('0x59')](_0xa24c('0x7f'),_[_0xa24c('0x80')](this[_0xa24c('0x6b')]));for(var _0x5f2564 in this[_0xa24c('0x6b')]){if(_0x2cabd8['actions'][_0xa24c('0x64')](_0x5f2564)){_0x2cabd8['clearZombieChannel'](_0x5f2564);}}};Preview['prototype']['recallMe']=function(_0x3fc3d9){var _0x5c4834=this;rpcDb['getContactRecallMe'](_0x3fc3d9['id'],ut[_0xa24c('0x81')](this['agents']))[_0xa24c('0x82')](function(_0x143bdb){if(!_[_0xa24c('0x6a')](_0x143bdb)){for(var _0x14c819=0x0;_0x14c819<_0x143bdb[_0xa24c('0x83')];_0x14c819+=0x1){if(ut[_0xa24c('0x84')](_0x143bdb[_0x14c819][_0xa24c('0x85')])<_0x3fc3d9[_0xa24c('0x86')]*0x3c){if(_0x143bdb[_0x14c819]['Agent']&&!_0x143bdb[_0x14c819]['Agent'][_0xa24c('0x87')]){_0x5c4834[_0xa24c('0x88')](_0x143bdb[_0x14c819]['id'])['then'](ut[_0xa24c('0x89')](_0xa24c('0x8a')))['catch'](ut[_0xa24c('0x89')](_0xa24c('0x8a')));}else{rpcDb[_0xa24c('0x8b')](_0x143bdb[_0x14c819]['id']);}}else{var _0x4ee0cb=new Action(_0x143bdb[_0x14c819],_0x3fc3d9);_0x4ee0cb[_0xa24c('0x8c')]=moment()[_0xa24c('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fc3d9[_0xa24c('0x3e')]+=0x1;ut['logCustomer'](_0x4ee0cb,0x17,_0xa24c('0x8d'));if(_0x3fc3d9[_0xa24c('0x8e')]){rpcDb[_0xa24c('0x8f')](ut[_0xa24c('0x90')](_0x143bdb[_0x14c819]));rpcDb[_0xa24c('0x91')](_0x4ee0cb,_0xa24c('0x92'));}else{ut[_0xa24c('0x93')](_0x4ee0cb,0x16,_0xa24c('0x94'));rpcDb[_0xa24c('0x91')](_0x4ee0cb,_0xa24c('0x95'));rpcDb[_0xa24c('0x96')](_0x4ee0cb,_0xa24c('0x95'));}}}}})[_0xa24c('0x78')](ut[_0xa24c('0x89')](_0xa24c('0x97')));};Preview[_0xa24c('0xd')][_0xa24c('0x67')]=function(_0x46aded){_0x46aded['sendMessageOneNotActive']=!![];if(ut[_0xa24c('0x98')](_0x46aded['loggedIn'])){_0x46aded[_0xa24c('0x4c')]=_0xa24c('0x99');}else if(!ut[_0xa24c('0x9a')](_0x46aded[_0xa24c('0x33')])){_0x46aded['message']='NOT_ACTIVE';}else if(!this[_0xa24c('0x9b')](_0x46aded[_0xa24c('0x51')])){if(!this[_0xa24c('0x9b')](_0x46aded['TrunkBackup'])){_0x46aded[_0xa24c('0x4c')]=_0xa24c('0x9c');}else{_0x46aded[_0xa24c('0x4c')]=_0xa24c('0x9d');}}else{_0x46aded[_0xa24c('0x4c')]=_0xa24c('0x9d');}emitCampaignPreview(_0x46aded);};Preview[_0xa24c('0xd')][_0xa24c('0x9e')]=function(_0x26d04f,_0xb113c3,_0x2cb64e){var _0x19c87a=this;var _0x3b68d7=this[_0xa24c('0x6b')][_0xb113c3];var _0x34acae=this[_0xa24c('0x12')][_0x3b68d7[_0xa24c('0x6e')]];var _0x179e70;if(_0x34acae){switch(_0x2cb64e){case'1':_0x34acae[_0xa24c('0x3c')]+=0x1;_0x3b68d7[_0xa24c('0x9f')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut[_0xa24c('0x93')](_0x3b68d7,0x0,_0xa24c('0xa2'));ami[_0xa24c('0x25')](_0xa24c('0xa3'),ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xa5')));rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xa6'));if(ut['totalGlobal'](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut['cloneAction'](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xa9'));}else{if(_0x3b68d7[_0xa24c('0x9f')]>=_0x34acae['dialNoSuchNumberMaxRetry']){rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xa9'));}else{rpcDb[_0xa24c('0xaa')](ut['scheduledAt'](_0x3b68d7,_0xa24c('0x9f'),_0x34acae['dialNoSuchNumberRetryFrequency']),_0x3b68d7[_0xa24c('0xab')],_0x3b68d7[_0xa24c('0xac')]);}}delete this[_0xa24c('0x6b')][_0x26d04f['linkedid']];break;case _0xa24c('0xad'):var _0x846186=moment()['format'](_0xa24c('0xae'));_0x3b68d7[_0xa24c('0xaf')]=_0x846186;_0x3b68d7[_0xa24c('0xb0')]=_0x846186;_0x3b68d7[_0xa24c('0x71')]=!![];_0x34acae[_0xa24c('0x2b')]+=0x1;logger[_0xa24c('0x59')](_0xa24c('0xb1'),_0x3b68d7[_0xa24c('0xb2')],_0xa24c('0xb3'),_0x34acae[_0xa24c('0x28')],_0xa24c('0x70'),_0x34acae[_0xa24c('0x2b')]);ami[_0xa24c('0x25')](_0xa24c('0xb4'),ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xb5'),this['campaignsPreview'][_0x3b68d7[_0xa24c('0x6e')]]));if(_0x34acae[_0xa24c('0xb6')]){ami[_0xa24c('0x25')](_0xa24c('0xb7'),ut[_0xa24c('0xb8')](_0x3b68d7));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xb9'),this[_0xa24c('0x12')][_0x3b68d7[_0xa24c('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0xa24c('0xa4')](_0x3b68d7,'complete'));_0x34acae[_0xa24c('0x36')]+=0x1;_0x34acae[_0xa24c('0x30')]+=0x1;_0x34acae[_0xa24c('0xba')]+=0x1;ut['decrementTalkink'](_0x34acae,_0xa24c('0xbb'));_0x3b68d7['countglobal']=ut['totalGlobal'](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0x4,_0xa24c('0xbc'));rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xbd'));rpcDb[_0xa24c('0x96')](_0x3b68d7,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xa24c('0xbe')](_0x3b68d7);_0x34acae[_0xa24c('0x2d')]+=_0x3b68d7[_0xa24c('0xbf')];_0x34acae[_0xa24c('0x2c')]+=_0x3b68d7[_0xa24c('0xbf')];logger['info'](_0xa24c('0xc0'),_0x3b68d7[_0xa24c('0xb2')],'\x20Queue',_0x34acae['name'],_0xa24c('0x70'),_0x34acae[_0xa24c('0x2b')]);delete this[_0xa24c('0x6b')][_0x26d04f[_0xa24c('0xc1')]];break;case _0xa24c('0xc2'):_0x34acae[_0xa24c('0x38')]+=0x1;_0x3b68d7[_0xa24c('0xc3')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut['totalGlobal'](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0x5,_0xa24c('0xc4'));ami[_0xa24c('0x25')](_0xa24c('0xc5'),ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xc6')));rpcDb['createCustomerHistory'](_0x3b68d7,_0xa24c('0xc7'));if(ut['totalGlobal'](_0x3b68d7)>=_0x34acae['dialGlobalMaxRetry']){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb['createCustomerFinal'](_0x179e70,_0xa24c('0xc9'));}else{if(_0x3b68d7[_0xa24c('0xc3')]>=_0x34acae[_0xa24c('0xca')]){rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xc7'));}else{rpcDb['rescheduleContact'](ut[_0xa24c('0xcb')](_0x3b68d7,_0xa24c('0xc3'),_0x34acae[_0xa24c('0xcc')]),_0x3b68d7[_0xa24c('0xab')],_0x3b68d7[_0xa24c('0xac')]);}}break;case _0xa24c('0xcd'):_0x34acae[_0xa24c('0x3b')]+=0x1;_0x3b68d7[_0xa24c('0xce')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut[_0xa24c('0x93')](_0x3b68d7,0x3,_0xa24c('0xcf'));ami[_0xa24c('0x25')]('custom:agentnoanswer',ut['buildObj'](_0x3b68d7,_0xa24c('0xd0')));rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xd1'));if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xd2'));}else{if(_0x3b68d7[_0xa24c('0xce')]>=_0x34acae[_0xa24c('0xd3')]){rpcDb['createCustomerFinal'](_0x3b68d7,_0xa24c('0xd1'));}else{rpcDb[_0xa24c('0xaa')](ut[_0xa24c('0xcb')](_0x3b68d7,_0xa24c('0xce'),_0x34acae[_0xa24c('0xd4')]),_0x3b68d7[_0xa24c('0xab')],_0x3b68d7['activeContact']);}}break;case _0xa24c('0xd5'):_0x34acae[_0xa24c('0x39')]+=0x1;_0x3b68d7[_0xa24c('0xd6')]+=0x1;_0x3b68d7['countglobal']=ut[_0xa24c('0xa1')](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0x8,_0xa24c('0xd7'));ami[_0xa24c('0x25')](_0xa24c('0xd8'),ut['buildObj'](_0x3b68d7,_0xa24c('0xd9')));rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xda'));if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xdb'));}else{if(_0x3b68d7[_0xa24c('0xd6')]>=_0x34acae[_0xa24c('0xdc')]){rpcDb[_0xa24c('0x96')](_0x3b68d7,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa24c('0xaa')](ut[_0xa24c('0xcb')](_0x3b68d7,_0xa24c('0xd6'),_0x34acae[_0xa24c('0xcc')]),_0x3b68d7[_0xa24c('0xab')],_0x3b68d7['activeContact']);}}break;case _0xa24c('0xdd'):_0x34acae['outboundRejectCallsDay']+=0x1;_0x3b68d7[_0xa24c('0xde')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0x14,_0xa24c('0xdf'));ami['emit'](_0xa24c('0xe0'),ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xe1')));rpcDb['createCustomerHistory'](_0x3b68d7,_0xa24c('0xe2'));if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae['dialGlobalMaxRetry']){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0x14,_0xa24c('0xdf'));rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xe3'));}else{if(_0x3b68d7[_0xa24c('0xde')]>=_0x34acae[_0xa24c('0xe4')]){rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xe3'));}else{rpcDb[_0xa24c('0xaa')](ut[_0xa24c('0xcb')](_0x3b68d7,_0xa24c('0xde'),_0x34acae[_0xa24c('0xe5')]),_0x3b68d7['unlockAgent'],_0x3b68d7[_0xa24c('0xac')]);}}break;case _0xa24c('0xe6'):_0x34acae[_0xa24c('0x41')]+=0x1;_0x3b68d7['countabandonedretry']+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut[_0xa24c('0x93')](_0x3b68d7,0xb,'Abandoned');rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xe7'));if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb['createCustomerFinal'](_0x179e70,_0xa24c('0xe7'));}else{if(_0x3b68d7[_0xa24c('0xe8')]>=_0x34acae[_0xa24c('0xe9')]){rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xe7'));}else{rpcDb['rescheduleContact'](ut[_0xa24c('0xcb')](_0x3b68d7,_0xa24c('0xea'),_0x34acae[_0xa24c('0xeb')]),_0x3b68d7[_0xa24c('0xab')],_0x3b68d7[_0xa24c('0xac')]);}}break;case'18':_0x34acae['outboundUnknownCallsDay']+=0x1;_0x3b68d7['countmachineretry']+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0x12,_0x26d04f[_0xa24c('0xec')]||_0x26d04f[_0xa24c('0xed')]);ami[_0xa24c('0x25')](_0xa24c('0xee'),ut['buildObj'](_0x3b68d7,_0xa24c('0xef')));rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xf0'));if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae['dialGlobalMaxRetry']){_0x179e70=ut['cloneAction'](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xf0'));}else{rpcDb[_0xa24c('0x96')](_0x3b68d7,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xa24c('0x6b')][_0x26d04f[_0xa24c('0xc1')]];break;case'19':_0x34acae[_0xa24c('0x40')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut[_0xa24c('0xa1')](_0x3b68d7);ut[_0xa24c('0x93')](_0x3b68d7,0x13,_0x26d04f[_0xa24c('0xec')]||_0x26d04f[_0xa24c('0xed')]);ami[_0xa24c('0x25')](_0xa24c('0xee'),ut[_0xa24c('0xa4')](_0x3b68d7,_0xa24c('0xef')));rpcDb[_0xa24c('0x91')](_0x3b68d7,'[callProgressDetectingCustomer][machine]');if(ut[_0xa24c('0xa1')](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,_0xa24c('0xa8'));rpcDb[_0xa24c('0x96')](_0x179e70,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xf1'));}delete this['actions'][_0x26d04f['linkedid']];break;default:if(_0x3b68d7['dialAnswer']){ut[_0xa24c('0x7b')](_0x34acae,'[default]');ut[_0xa24c('0x7c')](_0xa24c('0xf2')+_0x34acae['name'],_0x26d04f);}_0x34acae[_0xa24c('0x40')]+=0x1;_0x3b68d7[_0xa24c('0xa0')]=ut['totalGlobal'](_0x3b68d7);ut['logCustomer'](_0x3b68d7,0xc,_0x26d04f[_0xa24c('0xec')]||_0x26d04f[_0xa24c('0xed')]);rpcDb[_0xa24c('0x91')](_0x3b68d7,_0xa24c('0xf3'));if(ut['totalGlobal'](_0x3b68d7)>=_0x34acae[_0xa24c('0xa7')]){_0x179e70=ut[_0xa24c('0xc8')](_0x3b68d7,0xf,'Global');rpcDb[_0xa24c('0x96')](_0x179e70,_0xa24c('0xf4'));}else{rpcDb[_0xa24c('0x96')](_0x3b68d7,_0xa24c('0xf4'));}delete this[_0xa24c('0x6b')][_0x26d04f[_0xa24c('0xc1')]];}if(!(_0x3b68d7[_0xa24c('0x71')]&&_0x2cb64e==='16')){ut['updateOriginated'](_0x34acae,'[callProgressDetectingCustomer]');logger[_0xa24c('0x59')](_0xa24c('0xf5'),_0x3b68d7['uniqueid'],'\x20Queue',_0x34acae[_0xa24c('0x28')],_0xa24c('0x6f'),_0x34acae[_0xa24c('0x4d')]);}if(_0x2cb64e!=='ANSWER'){delete this[_0xa24c('0x6b')][_0x26d04f[_0xa24c('0xc1')]];delete this[_0xa24c('0x6b')][_0x26d04f[_0xa24c('0xf6')]];}}};Preview[_0xa24c('0xd')][_0xa24c('0xf7')]=function(_0x58fd7,_0x352f29,_0x54cd76){if(_['isUndefined'](_0x352f29)&&_0xa24c('0xf8')!==typeof _0x352f29){return;}if(_[_0xa24c('0xf9')](_0x54cd76)&&'object'!==typeof _0x54cd76){return;}switch(_0x54cd76['reason']){case'0':ut[_0xa24c('0xfa')](_0x58fd7,0x0,_0xa24c('0xa2'));rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0xfc'));break;case'3':ut[_0xa24c('0xfa')](_0x58fd7,0x3,_0xa24c('0xcf'));rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0xfd'));break;case'5':ut['logAgent'](_0x58fd7,0x5,_0xa24c('0xc4'));rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0xfe'));break;case'8':ut[_0xa24c('0xfa')](_0x58fd7,0x8,_0xa24c('0xd7'));rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0xff'));break;case'22':ut[_0xa24c('0xfa')](_0x58fd7,0x16,_0xa24c('0x100'));rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0x101'));break;default:ut[_0xa24c('0xfa')](_0x58fd7,0xc,_0x54cd76[_0xa24c('0x102')]);rpcDb[_0xa24c('0xfb')](_0x58fd7,_0xa24c('0xff'));}ut[_0xa24c('0x103')](_0x352f29,'[callProgressDetectingAgent]');logger['info'](_0xa24c('0x104'),_0x58fd7[_0xa24c('0xb2')],_0xa24c('0xb3'),_0x352f29[_0xa24c('0x28')],_0xa24c('0x6f'),_0x352f29[_0xa24c('0x4d')]);delete this[_0xa24c('0x6b')][_0x58fd7['uniqueid']];};Preview['prototype']['checkInBlack']=function(_0x4ef03e,_0x4d9695,_0xeaef09,_0x28f207,_0x363ce0){var _0x494094=this;return new BPromise(function(_0xd6d9a,_0x44d5a4){if(_[_0xa24c('0x6a')](_0x4d9695)||_['isNil'](_0x4d9695[_0xa24c('0x105')])||_['isNil'](_0x4d9695[_0xa24c('0x105')][_0xa24c('0x106')])||_[_0xa24c('0x6a')](_0x4d9695[_0xa24c('0x74')])){_0x44d5a4(ut['message']('Contact\x20is\x20undefined',_0x28f207,_0x363ce0));return;}var _0x5d5398=uuid['v4']();var _0x3da105=_0x494094[_0xa24c('0x12')][_0x4d9695['Queue'][_0xa24c('0x28')]];var _0x57eb5b=_0xeaef09?_0x494094[_0xa24c('0x14')][_0xeaef09]['id']:undefined;_0x494094[_0xa24c('0x6b')][_0x5d5398]=new Action(_0x4d9695,_0x3da105,_0x5d5398,_0xeaef09,_0x57eb5b);var _0x112a98=_0x494094[_0xa24c('0x6b')][_0x5d5398];_0x112a98[_0xa24c('0xab')]=_0x28f207;_0x112a98[_0xa24c('0xac')]=_0x363ce0;_0x112a98[_0xa24c('0x107')]=_0xeaef09;if(_[_0xa24c('0x108')](_0x4ef03e)){_0x494094[_0xa24c('0x109')](_0x112a98,_0x3da105,_0x4d9695,_0xeaef09)[_0xa24c('0x82')](function(_0x24a843){logger['info']('[Preview][execCall][success]',_0xa24c('0x10a')+_0x112a98[_0xa24c('0x6e')]+_0xa24c('0x10b')+_0x112a98['idContact'],JSON[_0xa24c('0x55')](_0x24a843));ami[_0xa24c('0x25')](_0xa24c('0x10c'),ut[_0xa24c('0xa4')](_0x112a98,_0xa24c('0x10d'),_0x494094[_0xa24c('0x12')][_0x112a98['queue']]));_0xd6d9a(ut[_0xa24c('0x4c')]('Calling'));})[_0xa24c('0x78')](function(_0x2509b6){ut[_0xa24c('0x5f')](_0xa24c('0x10e'),_0x2509b6);_0x44d5a4(ut[_0xa24c('0x4c')](_0xa24c('0x10f'),_0x28f207,_0x363ce0));});}else{_0x3da105[_0xa24c('0x37')]+=0x1;ut['logBlacklist'](_0x112a98);rpcDb[_0xa24c('0x110')](_0x112a98,_0xa24c('0x111'));delete _0x494094[_0xa24c('0x6b')][_0x5d5398];_0x44d5a4(ut[_0xa24c('0x4c')](_0xa24c('0x112'),_0x28f207,_0x363ce0));}});};Preview[_0xa24c('0xd')]['isTrunkReachable']=function(_0x268414){return!_[_0xa24c('0x6a')](_0x268414)&&!_['isNil'](_0x268414['name'])&&!_[_0xa24c('0x6a')](_0x268414[_0xa24c('0x52')])&&_0x268414[_0xa24c('0x52')]&&!_['isNil'](this[_0xa24c('0x113')][util[_0xa24c('0x56')](_0xa24c('0x114'),_0x268414[_0xa24c('0x28')])])&&!_[_0xa24c('0x6a')](this[_0xa24c('0x113')][util[_0xa24c('0x56')]('SIP/%s',_0x268414['name'])]['status'])&&(this[_0xa24c('0x113')][util[_0xa24c('0x56')](_0xa24c('0x114'),_0x268414[_0xa24c('0x28')])]['status']===_0xa24c('0x115')||this['trunks'][util['format']('SIP/%s',_0x268414[_0xa24c('0x28')])]['status']===_0xa24c('0x116'));};Preview[_0xa24c('0xd')][_0xa24c('0x88')]=function(_0x137ff9,_0x4783e3){var _0x23e6b5=this;return new BPromise(function(_0x360463,_0xd08a1f){_0x23e6b5[_0xa24c('0x117')](_0x137ff9,_0x4783e3)[_0xa24c('0x82')](function(_0x31013c){_0x360463(_[_0xa24c('0x72')](_0x31013c,['message']));})[_0xa24c('0x78')](function(_0x76d731){if(_0x76d731[_0xa24c('0x118')]){rpcDb[_0xa24c('0x119')](_0x137ff9);}if(_0x76d731[_0xa24c('0x52')]){rpcDb[_0xa24c('0x8b')](_0x137ff9);}_0xd08a1f(_['pick'](_0x76d731,[_0xa24c('0x4c')]));});});};Preview['prototype']['execRun']=function(_0x1dc858,_0x521e45){var _0x510ce5=this;return new BPromise(function(_0x100548,_0x3f9ff2){var _0x41448e,_0x4b53d4;rpcDb['getContactPreview'](_0x1dc858)[_0xa24c('0x82')](function(_0x4ec9a7){if(!_['isNil'](_0x4ec9a7[0x0])){_0x4b53d4=_0x4ec9a7[0x0]['recallme']?![]:!![];_0x41448e=_0x4ec9a7[0x0][_0xa24c('0x11a')]?!![]:![];_0x41448e=_0x521e45?!![]:_0x41448e;}var _0x48275e=_0x510ce5[_0xa24c('0x11b')](_0x4ec9a7);if(_0x48275e[_0xa24c('0x11c')]){rpcDb[_0xa24c('0x11d')](_['pick'](_0x4ec9a7[0x0],[_0xa24c('0x74'),_0xa24c('0x11e')]))[_0xa24c('0x82')](function(_0x25436b){_0x510ce5['checkInBlack'](_0x25436b,_0x4ec9a7[0x0],_0x521e45,_0x4b53d4,_0x41448e)[_0xa24c('0x82')](function(_0xc41066){_0x100548(_0xc41066);})[_0xa24c('0x78')](function(_0x20cba8){_0x3f9ff2(_0x20cba8);});})[_0xa24c('0x78')](function(_0x41138e){ut[_0xa24c('0x5f')](_0xa24c('0x11f'),_0x41138e);_0x3f9ff2(ut[_0xa24c('0x4c')]('Call\x20unsuccessful',_0x4b53d4,_0x41448e));});}else{_0x3f9ff2(ut['message'](_0x48275e[_0xa24c('0x4c')],_0x4b53d4,_0x41448e));}})['catch'](function(_0x4a8fe7){ut[_0xa24c('0x5f')](_0xa24c('0x120'),_0x4a8fe7);_0x3f9ff2(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0xa24c('0x11b')]=function(_0x43d5a0){if(_[_0xa24c('0x6a')](_0x43d5a0)||_[_0xa24c('0x108')](_0x43d5a0)||!_[_0xa24c('0x6a')](_0x43d5a0[0x0]['Agent'])&&_['isNil'](_0x43d5a0[0x0][_0xa24c('0x121')][_0xa24c('0x28')])){ut['logger'](_0xa24c('0x122'),_0x43d5a0);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5c575e=this[_0xa24c('0x12')][_0x43d5a0[0x0][_0xa24c('0x6d')][_0xa24c('0x28')]];_0x5c575e[_0xa24c('0x4c')]='ACTIVE';if(_['isNil'](_0x5c575e)){ut[_0xa24c('0x5f')](_0xa24c('0x123'),_0x5c575e);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa24c('0x9b')](_0x5c575e[_0xa24c('0x51')])){ut[_0xa24c('0x5f')](_0xa24c('0x124'),'campaign\x20Name:\x20'+_0x5c575e['name']+_0xa24c('0x125'));if(!this['isTrunkReachable'](_0x5c575e[_0xa24c('0x126')])){ut['logger'](_0xa24c('0x124'),_0x5c575e['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa24c('0x127')};}}if(!ut['isActive'](_0x5c575e[_0xa24c('0x33')])){ut[_0xa24c('0x5f')](_0xa24c('0x128'),_0x5c575e[_0xa24c('0x28')]+_0xa24c('0x129'));return{'isValid':![],'message':_0xa24c('0x12a')+_0x5c575e['name']+_0xa24c('0x129')};}return{'isValid':!![],'message':_0xa24c('0x12b')};};Preview[_0xa24c('0xd')][_0xa24c('0x109')]=function(_0x32819a,_0x5ce5b6,_0x167d1e,_0x4194f7){var _0x5e44a4=this;return new BPromise(function(_0x154fe3,_0x14fc72){var _0x1230e9=_0x32819a[_0xa24c('0xb2')];var _0x42791a=_0x5e44a4[_0xa24c('0x9b')](_0x5ce5b6[_0xa24c('0x51')])?util[_0xa24c('0x56')](_0xa24c('0x12c'),_0x5ce5b6['Trunk'][_0xa24c('0x28')],_[_0xa24c('0x6a')](_0x5ce5b6['dialPrefix'])?'':_0x5ce5b6['dialPrefix'][_0xa24c('0x12d')]()||'',_0x5ce5b6[_0xa24c('0x12e')]>0x0?_0x167d1e[_0xa24c('0x105')][_0xa24c('0x106')]['substring'](_0x5ce5b6['dialCutDigit']):_0x167d1e[_0xa24c('0x105')][_0xa24c('0x106')]):util[_0xa24c('0x56')](_0xa24c('0x12c'),_['isNil'](_0x5ce5b6[_0xa24c('0x126')])?_0x5ce5b6[_0xa24c('0x51')][_0xa24c('0x28')]:_0x5ce5b6[_0xa24c('0x126')]['name'],_[_0xa24c('0x6a')](_0x5ce5b6[_0xa24c('0x12f')])?'':_0x5ce5b6[_0xa24c('0x12f')][_0xa24c('0x12d')]()||'',_0x5ce5b6[_0xa24c('0x12e')]>0x0?_0x167d1e[_0xa24c('0x105')][_0xa24c('0x106')][_0xa24c('0x130')](_0x5ce5b6[_0xa24c('0x12e')]):_0x167d1e[_0xa24c('0x105')][_0xa24c('0x106')]);var _0x20e4b7=_0x5e44a4['isTrunkReachable'](_0x5ce5b6[_0xa24c('0x51')])?ut['getCallerId'](_0x5ce5b6['Trunk']['callerid'],_0x5ce5b6['dialOriginateCallerIdName'],_0x5ce5b6[_0xa24c('0x131')]>0x0?ut['getCallerIdRandom'](_0x5ce5b6['dialOriginateCallerIdNumber'],_0x5ce5b6['dialRandomLastDigitCallerIdNumber']):_0x5ce5b6[_0xa24c('0x132')]):ut[_0xa24c('0x133')](_[_0xa24c('0x6a')](_0x5ce5b6['TrunkBackup'])?_0x5ce5b6['Trunk'][_0xa24c('0x53')]:_0x5ce5b6[_0xa24c('0x126')][_0xa24c('0x53')],_0x5ce5b6[_0xa24c('0x35')],_0x5ce5b6[_0xa24c('0x131')]>0x0?ut[_0xa24c('0x134')](_0x5ce5b6[_0xa24c('0x132')],_0x5ce5b6[_0xa24c('0x131')]):_0x5ce5b6['dialOriginateCallerIdNumber']);if(_0x20e4b7){_0x32819a[_0xa24c('0x135')]=ut[_0xa24c('0x136')](_0x20e4b7);_0x32819a[_0xa24c('0x137')]=ut[_0xa24c('0x138')](_0x20e4b7);}var _0x4e676a=ut['addVariables'](_0x5ce5b6,_0x167d1e,_0x42791a,_0x20e4b7,_0x1230e9,_0x32819a);_[_0xa24c('0x139')](_0x32819a,ut[_0xa24c('0x13a')](_0x4e676a));_0x32819a[_0xa24c('0x8c')]=moment()[_0xa24c('0x56')](_0xa24c('0xae'));ami['Action'](ut['variablesAction'](_0x32819a,_0x5ce5b6,_0x4e676a,_0x32819a[_0xa24c('0xac')],_0x4194f7))['then'](function(_0xcbc692){_0x5ce5b6[_0xa24c('0x4d')]+=0x1;logger[_0xa24c('0x59')](_0xa24c('0x13b'),_0x1230e9,_0xa24c('0xb3'),_0x5ce5b6[_0xa24c('0x28')],_0xa24c('0x6f'),_0x5ce5b6['originated']);_0x154fe3(_0xcbc692);})[_0xa24c('0x78')](function(_0x4dc309){ut['logAgent'](_0x32819a,0xe,_0xa24c('0x13c'));rpcDb[_0xa24c('0xfb')](_0x32819a,_0xa24c('0x13d'));_0x14fc72(_0x4dc309);});});};Preview[_0xa24c('0xd')][_0xa24c('0x1e')]=function(_0x477649){if(this[_0xa24c('0x6b')][_0x477649[_0xa24c('0xc1')]]){this[_0xa24c('0x6b')][_0x477649[_0xa24c('0xc1')]][_0xa24c('0x77')]=_0x477649['channel'];}};Preview['prototype'][_0xa24c('0x17')]=function(_0xf7e8d2){var _0x39e3d5=this;var _0x5f0468=this[_0xa24c('0x6b')][_0xf7e8d2[_0xa24c('0x13e')]];if(_0x5f0468){if(_0x5f0468['lookAgent']&&this[_0xa24c('0x14')][_0x5f0468[_0xa24c('0x107')]]){ut[_0xa24c('0x13f')](_0x5f0468,this[_0xa24c('0x14')][_0x5f0468[_0xa24c('0x107')]]['name'],this[_0xa24c('0x14')][_0x5f0468[_0xa24c('0x107')]]['id']);}var _0x3abc23=_['clone'](_0x5f0468);_0x3abc23[_0xa24c('0xaf')]=moment()[_0xa24c('0x56')](_0xa24c('0xae'));var _0x319500=_0x39e3d5[_0xa24c('0x12')][_0x5f0468[_0xa24c('0x6e')]];if(ut[_0xa24c('0x140')](_0xf7e8d2[_0xa24c('0x141')])){if(_0x5f0468[_0xa24c('0xab')]){rpcDb[_0xa24c('0x119')](_0x5f0468['idContact']);}if(_0x5f0468[_0xa24c('0xac')]){rpcDb['disableContact'](_0x5f0468[_0xa24c('0x142')]);}ami[_0xa24c('0x25')](_0xa24c('0x143'),ut[_0xa24c('0xa4')](_0x5f0468,'rejected',this[_0xa24c('0x12')][_0x5f0468[_0xa24c('0x6e')]]));this[_0xa24c('0xf7')](_0x3abc23,_0x319500,_0xf7e8d2);}else{_0x5f0468[_0xa24c('0x8c')]=moment()['format'](_0xa24c('0xae'));ut[_0xa24c('0xfa')](_0x3abc23,0x4,_0xa24c('0xbc'));rpcDb[_0xa24c('0xfb')](_0x3abc23,_0xa24c('0x144'));}}};Preview[_0xa24c('0xd')]['syncHangup']=function(_0x1409d0){var _0x343c46=this;var _0x10ff10=this[_0xa24c('0x6b')][_0x1409d0[_0xa24c('0xc1')]];var _0x39062d;if(_0x10ff10){_0x39062d=this[_0xa24c('0x12')][_0x10ff10[_0xa24c('0x6e')]];logger['info'](_0xa24c('0x145'),_0x1409d0[_0xa24c('0xc1')],_0xa24c('0xb3'),_0x39062d['name'],_0xa24c('0x70'),_0x39062d[_0xa24c('0x2b')]);}if(this[_0xa24c('0x6b')][_0x1409d0[_0xa24c('0xc1')]]&&_0x1409d0[_0xa24c('0xc1')]!==_0x1409d0[_0xa24c('0xb2')]){if(_0x1409d0['cause']==='16'&&this[_0xa24c('0x6b')][_0x1409d0[_0xa24c('0xc1')]][_0xa24c('0x71')]){this[_0xa24c('0x9e')](_0x1409d0,_0x1409d0[_0xa24c('0xc1')],_0x1409d0['cause']);}else if(this['actions'][_0x1409d0['linkedid']][_0xa24c('0x71')]){logger['info'](_0xa24c('0x146'),_0x1409d0[_0xa24c('0xc1')],_0x1409d0[_0xa24c('0x147')],_0xa24c('0xb3'),_0x39062d['name'],'pTalking:\x20',_0x39062d[_0xa24c('0x2b')]);this['callProgressDetectingCustomer'](_0x1409d0,_0x1409d0['linkedid'],_0x1409d0['cause']);}}else if(_0x10ff10&&_[_0xa24c('0x6a')](_0x10ff10['statedesc'])&&_0x39062d[_0xa24c('0x148')]&&_0x1409d0[_0xa24c('0xc1')]===_0x1409d0[_0xa24c('0xb2')]&&_[_0xa24c('0x6a')](_0x1409d0[_0xa24c('0x102')])&&_0x1409d0['cause']==='16'&&_0x1409d0[_0xa24c('0x149')]==='6'&&_[_0xa24c('0xf9')](_0x10ff10[_0xa24c('0x14a')])){if(_0x10ff10['unlockAgent']){rpcDb[_0xa24c('0x119')](_0x10ff10['idContact']);}if(_0x10ff10[_0xa24c('0xac')]){rpcDb[_0xa24c('0x8b')](_0x10ff10[_0xa24c('0x142')]);}_0x1409d0[_0xa24c('0x102')]='22';this['callProgressDetectingAgent'](_0x10ff10,_0x39062d,_0x1409d0);}else if(_0x10ff10&&_0x10ff10[_0xa24c('0x14a')]){if(_0x1409d0['cause']==='16'&&this[_0xa24c('0x6b')][_0x1409d0[_0xa24c('0xc1')]][_0xa24c('0x71')]){logger[_0xa24c('0x59')](_0xa24c('0x14b'),_0x1409d0[_0xa24c('0xc1')],_0x1409d0[_0xa24c('0x147')],_0xa24c('0xb3'),_0x39062d[_0xa24c('0x28')],_0xa24c('0x70'),_0x39062d[_0xa24c('0x2b')]);this[_0xa24c('0x9e')](_0x1409d0,_0x1409d0['linkedid'],_0x1409d0['cause']);}else if(this[_0xa24c('0x6b')][_0x1409d0[_0xa24c('0xc1')]]['dialAnswer']){logger[_0xa24c('0x59')](_0xa24c('0x146'),_0x1409d0[_0xa24c('0xc1')],_0x1409d0['cause'],_0xa24c('0xb3'),_0x39062d[_0xa24c('0x28')],_0xa24c('0x70'),_0x39062d['pTalking']);this[_0xa24c('0x9e')](_0x1409d0,_0x1409d0[_0xa24c('0xc1')],_0x1409d0[_0xa24c('0x147')]);}}};Preview[_0xa24c('0xd')][_0xa24c('0x1c')]=function(_0xff0b2a){if(this[_0xa24c('0x6b')][_0xff0b2a['destlinkedid']]&&_0xff0b2a['destlinkedid']!==_0xff0b2a[_0xa24c('0x14c')]){this[_0xa24c('0x9e')](_0xff0b2a,_0xff0b2a['destlinkedid'],_0xff0b2a[_0xa24c('0xed')]);}};Preview[_0xa24c('0xd')][_0xa24c('0x19')]=function(_0x71f339){if(this[_0xa24c('0x6b')][_0x71f339[_0xa24c('0xc1')]]&&_0x71f339['linkedid']!==_0x71f339[_0xa24c('0xb2')]&&!this[_0xa24c('0x6b')][_0x71f339[_0xa24c('0xc1')]][_0xa24c('0x71')]){if(_0x71f339['cause']==='1'){this[_0xa24c('0x9e')](_0x71f339,_0x71f339[_0xa24c('0xc1')],_0x71f339[_0xa24c('0x147')]);}}};Preview[_0xa24c('0xd')][_0xa24c('0x14d')]=function(_0x40d0fe,_0x5abbae,_0x37adca){if(this[_0xa24c('0x6b')][_0x40d0fe]){if(_[_0xa24c('0x6a')](this[_0xa24c('0x6b')][_0x40d0fe][_0xa24c('0x14e')])){this[_0xa24c('0x6b')][_0x40d0fe][_0xa24c('0x14e')]={};}this[_0xa24c('0x6b')][_0x40d0fe][_0xa24c('0x14e')][_0x5abbae]=_0x37adca;}};Preview[_0xa24c('0xd')][_0xa24c('0x20')]=function(_0x261c52){try{if(!_[_0xa24c('0x6a')](_0x261c52)){if(ut['filterKey'](_[_0xa24c('0x14f')](_0x261c52[_0xa24c('0x150')])[0x0])){this[_0xa24c('0x14d')](_0x261c52[_0xa24c('0xb2')],_[_0xa24c('0x14f')](_0x261c52[_0xa24c('0x150')])[0x0],_0x261c52[_0xa24c('0x151')]);}}}catch(_0x3aafd6){logger[_0xa24c('0x152')](_0xa24c('0x153'),util[_0xa24c('0x154')](_0x3aafd6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xa24c('0x22')]=function(_0x1a7006){if(_0x1a7006){if(this[_0xa24c('0x6b')][_0x1a7006[_0xa24c('0x155')]]){this[_0xa24c('0x6b')][_0x1a7006['transfertargetlinkedid']][_0xa24c('0x14a')]=!![];}}};Preview[_0xa24c('0xd')]['syncBlindTransfer']=function(_0x11c6ce){if(_0x11c6ce){if(this[_0xa24c('0x6b')][_0x11c6ce[_0xa24c('0x156')]]){this[_0xa24c('0x6b')][_0x11c6ce[_0xa24c('0x156')]]['transfer']=!![];}}};module[_0xa24c('0x157')]=Preview; \ No newline at end of file +var _0xac9d=['prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','dialMethod','booked','hasOwnProperty','dialPreviewAutoRecallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated','pTalking:\x20','pTalking','dialAnswer','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','recallMe','then','length','Agent','voicePause','run','logger2','[RecallMe]','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentcomplete','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','idContact','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','pick','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','campaign\x20Name:\x20','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','clone','isFailure','response','unlockContact','custom:agentringnoanswer','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','socket.io-emitter'];(function(_0x2e5539,_0x476eeb){var _0x1d8eee=function(_0x14f16f){while(--_0x14f16f){_0x2e5539['push'](_0x2e5539['shift']());}};_0x1d8eee(++_0x476eeb);}(_0xac9d,0x14d));var _0xdac9=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xac9d[_0x336264];return _0x53cf91;};'use strict';var util=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));var BPromise=require(_0xdac9('0x2'));var uuid=require(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var md5=require(_0xdac9('0x5'));var Redis=require(_0xdac9('0x6'));var config=require(_0xdac9('0x7'));var logger=require('../../../config/logger')(_0xdac9('0x8'));var loggerAction=require('../../../config/logger')(_0xdac9('0x9'));var ami=require(_0xdac9('0xa'));var rpcDb=require(_0xdac9('0xb'));var Action=require(_0xdac9('0xc'));var ut=require(_0xdac9('0xd'));config[_0xdac9('0xe')]=_['defaults'](config[_0xdac9('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0xdac9('0xf'))(new Redis(config[_0xdac9('0xe')]));var Sequence=function(){};Sequence[_0xdac9('0x10')][_0xdac9('0x11')]=function(_0x23ec14){this[_0xdac9('0x12')]=this[_0xdac9('0x12')]?this[_0xdac9('0x12')][_0xdac9('0x13')](_0x23ec14):_0x23ec14();};function Preview(_0x5514c5){this[_0xdac9('0x14')]=new Sequence();this[_0xdac9('0x15')]=_0x5514c5['voiceQueues'];this[_0xdac9('0x16')]=_0x5514c5[_0xdac9('0x16')];this[_0xdac9('0x17')]={};this['agents']=_0x5514c5[_0xdac9('0x18')];this[_0xdac9('0x19')]=0x0;ami['on'](_0xdac9('0x1a'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xdac9('0x1b'),this[_0xdac9('0x1c')]['bind'](this));ami['on'](_0xdac9('0x1d'),this[_0xdac9('0x1e')][_0xdac9('0x1f')](this));ami['on'](_0xdac9('0x20'),this[_0xdac9('0x21')][_0xdac9('0x1f')](this));ami['on'](_0xdac9('0x22'),this[_0xdac9('0x23')]['bind'](this));ami['on'](_0xdac9('0x24'),this[_0xdac9('0x25')]['bind'](this));ami['on'](_0xdac9('0x26'),this[_0xdac9('0x27')][_0xdac9('0x1f')](this));ami['on'](_0xdac9('0x28'),this['syncBlindTransfer']['bind'](this));this[_0xdac9('0x29')](this[_0xdac9('0x15')]);}function emit(_0x2b9d91,_0x395ec7,_0x52fb18){io['to'](_0x2b9d91)[_0xdac9('0x2a')](_0x395ec7,_0x52fb18);}function emitCampaignPreview(_0x33cb7d){if(_0x33cb7d[_0xdac9('0x2b')]===_0xdac9('0x2c')){var _0xe7bd10={'id':_0x33cb7d['id'],'name':_0x33cb7d[_0xdac9('0x2d')],'strategy':_0x33cb7d[_0xdac9('0x2e')],'answered':_0x33cb7d[_0xdac9('0x2f')],'available':_0x33cb7d[_0xdac9('0x30')],'loggedIn':_0x33cb7d[_0xdac9('0x31')],'pTalking':_0x33cb7d['pTalking'],'sumBillable':_0x33cb7d[_0xdac9('0x32')],'sumDuration':_0x33cb7d[_0xdac9('0x33')],'sumHoldTime':_0x33cb7d[_0xdac9('0x34')]||0x0,'talking':_0x33cb7d[_0xdac9('0x35')],'total':_0x33cb7d['total'],'type':_0x33cb7d[_0xdac9('0x2b')],'unmanaged':_0x33cb7d['unmanaged'],'abandoned':_0x33cb7d[_0xdac9('0x36')],'waiting':_0x33cb7d[_0xdac9('0x37')],'loggedInDb':_0x33cb7d['loggedInDb'],'dialActive':_0x33cb7d[_0xdac9('0x38')],'dialMethod':_0x33cb7d['dialMethod'],'dialOriginateCallerIdName':_0x33cb7d[_0xdac9('0x39')],'dialOriginateCallerIdNumber':_0x33cb7d[_0xdac9('0x3a')],'dialOriginateTimeout':_0x33cb7d[_0xdac9('0x3b')],'dialPrefix':_0x33cb7d[_0xdac9('0x3c')],'outboundAnswerAgiCallsDay':_0x33cb7d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x33cb7d['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x33cb7d[_0xdac9('0x3d')],'outboundBusyCallsDay':_0x33cb7d[_0xdac9('0x3e')],'outboundCongestionCallsDay':_0x33cb7d['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x33cb7d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x33cb7d[_0xdac9('0x3f')],'outboundDropCallsDayTimeout':_0x33cb7d[_0xdac9('0x40')],'outboundNoAnswerCallsDay':_0x33cb7d[_0xdac9('0x41')],'outboundNoSuchCallsDay':_0x33cb7d[_0xdac9('0x42')],'outboundOriginateFailureCallsDay':_0x33cb7d[_0xdac9('0x43')],'outboundReCallsDay':_0x33cb7d[_0xdac9('0x44')],'outboundRejectCallsDay':_0x33cb7d[_0xdac9('0x45')],'outboundUnknownCallsDay':_0x33cb7d[_0xdac9('0x46')],'outboundAbandonedCallsDay':_0x33cb7d[_0xdac9('0x47')],'predictiveIntervalAnsweredCalls':_0x33cb7d[_0xdac9('0x48')],'predictiveIntervalAvgHoldtime':_0x33cb7d[_0xdac9('0x49')],'predictiveIntervalAvgTalktime':_0x33cb7d[_0xdac9('0x4a')],'predictiveIntervalDroppedCallsCallersExit':_0x33cb7d[_0xdac9('0x4b')],'predictiveIntervalDroppedCallsTimeout':_0x33cb7d[_0xdac9('0x4c')],'predictiveIntervalErlangCalls':_0x33cb7d[_0xdac9('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x33cb7d[_0xdac9('0x4e')],'predictiveIntervalHitRate':_0x33cb7d[_0xdac9('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x33cb7d[_0xdac9('0x50')],'predictiveIntervalPauses':_0x33cb7d[_0xdac9('0x51')],'predictiveIntervalAvailable':_0x33cb7d[_0xdac9('0x52')],'predictiveIntervalTotalCalls':_0x33cb7d[_0xdac9('0x53')],'message':_0x33cb7d['message'],'originated':_0x33cb7d['originated'],'erlangCalls':_0x33cb7d[_0xdac9('0x54')],'erlangCallToSecond':_0x33cb7d[_0xdac9('0x55')],'erlangAbandonmentRate':_0x33cb7d[_0xdac9('0x56')],'erlangBusyFactor':_0x33cb7d[_0xdac9('0x57')],'startPredictive':_0x33cb7d[_0xdac9('0x58')],'startProgressive':_0x33cb7d['startProgressive']};if(_0x33cb7d[_0xdac9('0x59')]){_0xe7bd10['Trunk']={'id':_0x33cb7d[_0xdac9('0x59')]['id'],'name':_0x33cb7d[_0xdac9('0x59')]['name'],'active':_0x33cb7d[_0xdac9('0x59')]['active'],'callerid':_0x33cb7d['Trunk'][_0xdac9('0x5a')]};}if(_0x33cb7d[_0xdac9('0x5b')]){_0xe7bd10[_0xdac9('0x5b')]={'id':_0x33cb7d[_0xdac9('0x5b')]['id'],'name':_0x33cb7d[_0xdac9('0x5b')][_0xdac9('0x2d')]};}var _0x51cde6=md5(JSON[_0xdac9('0x5c')](_0xe7bd10));if(_0x33cb7d[_0xdac9('0x5')]!==_0x51cde6){_0x33cb7d['md5']=_0x51cde6;emit(util[_0xdac9('0x5d')](_0xdac9('0x5e'),_0xe7bd10[_0xdac9('0x2d')]),_0xdac9('0x5f'),_0xe7bd10);}}}function emitVoiceQueueChannelRemove(_0x35aa58){logger[_0xdac9('0x60')](_0xdac9('0x61'),JSON['stringify'](_0x35aa58));emit(util[_0xdac9('0x5d')](_0xdac9('0x5e'),_0x35aa58[_0xdac9('0x2d')]),'voice_queue_channel:remove',_0x35aa58);io[_0xdac9('0x2a')](_0xdac9('0x62'),_0x35aa58);}function notSendMessagesQueue(_0x26ba56){if(_0x26ba56[_0xdac9('0x63')]){if(_0x26ba56['originated']===0x0&&_0x26ba56['pTalking']===0x0){_0x26ba56[_0xdac9('0x63')]=![];_0x26ba56[_0xdac9('0x30')]=0x0;_0x26ba56[_0xdac9('0x64')]=0x0;_0x26ba56[_0xdac9('0x65')]=_0xdac9('0x66');ut['logger'](_0xdac9('0x67'),_0x26ba56['name']+_0xdac9('0x68'));}else{_0x26ba56[_0xdac9('0x65')]=_0xdac9('0x69');ut[_0xdac9('0x6a')](_0xdac9('0x67'),_0x26ba56[_0xdac9('0x2d')]+_0xdac9('0x6b'));}emitCampaignPreview(_0x26ba56);}}Preview[_0xdac9('0x10')][_0xdac9('0x29')]=function(){var _0x8a0538=this;setInterval(function(){_0x8a0538[_0xdac9('0x6c')]();},0x7cf);};Preview[_0xdac9('0x10')][_0xdac9('0x6c')]=function(){var _0x441676=this['campaignsPreview'];this[_0xdac9('0x19')]+=0x1;for(var _0x272b52 in _0x441676){if(_0x441676['hasOwnProperty'](_0x272b52)&&(_0x441676[_0x272b52][_0xdac9('0x6d')]===_0xdac9('0x8')||_0x441676[_0x272b52][_0xdac9('0x6d')]===_0xdac9('0x6e'))&&_0x441676[_0x272b52][_0xdac9('0x2b')]===_0xdac9('0x2c')){if(this['clockClearZombieChannels']>0x7){this[_0xdac9('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x441676[_0xdac9('0x6f')](_0x272b52)&&_0x441676[_0x272b52][_0xdac9('0x6d')]===_0xdac9('0x8')&&_0x441676[_0x272b52][_0xdac9('0x2b')]==='outbound'){if(_0x441676[_0x272b52]['dialActive']){this['setMessage'](_0x441676[_0x272b52]);if(_0x441676[_0x272b52][_0xdac9('0x70')])this['recallMe'](_0x441676[_0x272b52]);}else{notSendMessagesQueue(_0x441676[_0x272b52]);}}}};Preview['prototype'][_0xdac9('0x71')]=function(_0x15c332){var _0x49c948=this;this['sequence'][_0xdac9('0x11')](function(){if(!_[_0xdac9('0x72')](_0x49c948[_0xdac9('0x17')][_0x15c332])){loggerAction[_0xdac9('0x60')](_0xdac9('0x73'),_0x15c332,_0xdac9('0x74'),_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')],'originated:\x20',JSON[_0xdac9('0x5c')](_0x49c948[_0xdac9('0x15')][_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]][_0xdac9('0x76')]),_0xdac9('0x77'),JSON[_0xdac9('0x5c')](_0x49c948[_0xdac9('0x15')][_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]][_0xdac9('0x78')]),JSON[_0xdac9('0x5c')](_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x79')]),JSON['stringify'](_['pick'](_0x49c948['actions'][_0x15c332],[_0xdac9('0x7a'),_0xdac9('0x7b'),'VoiceQueueId',_0xdac9('0x7c')])));return ami[_0xdac9('0x7d')]({'action':_0xdac9('0x7e'),'channel':_0x49c948['actions'][_0x15c332][_0xdac9('0x7f')]})[_0xdac9('0x80')](function(_0x57902f){if(_0x57902f['message']===_0xdac9('0x81')){setTimeout(function(){if(_0x49c948[_0xdac9('0x17')][_0x15c332]){ut[_0xdac9('0x82')](_0x49c948[_0xdac9('0x15')][_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]],_0xdac9('0x83'));if(_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x79')]===!![]){ut[_0xdac9('0x84')](_0x49c948[_0xdac9('0x15')][_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]],_0xdac9('0x83'));ut[_0xdac9('0x85')]('[Dialer][checkChannel][pTalking][Preview]'+_0x15c332,_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]);}ut[_0xdac9('0x85')](_0xdac9('0x86')+_0x15c332,_0x49c948[_0xdac9('0x17')][_0x15c332][_0xdac9('0x75')]);delete _0x49c948['actions'][_0x15c332];}},0x2328);}});}});};Preview[_0xdac9('0x10')][_0xdac9('0x87')]=function(){var _0xd9b702=this;loggerAction[_0xdac9('0x60')](_0xdac9('0x88'),_[_0xdac9('0x89')](this[_0xdac9('0x17')]));for(var _0x243862 in this[_0xdac9('0x17')]){if(_0xd9b702['actions'][_0xdac9('0x6f')](_0x243862)){_0xd9b702[_0xdac9('0x71')](_0x243862);}}};Preview[_0xdac9('0x10')][_0xdac9('0x8a')]=function(_0x2ca15d){var _0x21ab3d=this;rpcDb['getContactRecallMe'](_0x2ca15d['id'],ut['agentReadyId'](this[_0xdac9('0x18')]))[_0xdac9('0x8b')](function(_0x41ea68){if(!_[_0xdac9('0x72')](_0x41ea68)){for(var _0x1c1f5f=0x0;_0x1c1f5f<_0x41ea68[_0xdac9('0x8c')];_0x1c1f5f+=0x1){if(ut['getDiff'](_0x41ea68[_0x1c1f5f]['scheduledat'])<_0x2ca15d['dialRecallMeTimeout']*0x3c){if(_0x41ea68[_0x1c1f5f][_0xdac9('0x8d')]&&!_0x41ea68[_0x1c1f5f][_0xdac9('0x8d')][_0xdac9('0x8e')]){_0x21ab3d[_0xdac9('0x8f')](_0x41ea68[_0x1c1f5f]['id'])['then'](ut[_0xdac9('0x90')](_0xdac9('0x91')))[_0xdac9('0x80')](ut[_0xdac9('0x90')](_0xdac9('0x91')));}else{rpcDb['disableContact'](_0x41ea68[_0x1c1f5f]['id']);}}else{var _0x19a46e=new Action(_0x41ea68[_0x1c1f5f],_0x2ca15d);_0x19a46e['starttime']=moment()[_0xdac9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ca15d[_0xdac9('0x44')]+=0x1;ut[_0xdac9('0x92')](_0x19a46e,0x17,_0xdac9('0x93'));if(_0x2ca15d[_0xdac9('0x94')]){rpcDb[_0xdac9('0x95')](ut[_0xdac9('0x96')](_0x41ea68[_0x1c1f5f]));rpcDb[_0xdac9('0x97')](_0x19a46e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x19a46e,0x16,'RecallFailedTimeout');rpcDb[_0xdac9('0x97')](_0x19a46e,_0xdac9('0x98'));rpcDb[_0xdac9('0x99')](_0x19a46e,_0xdac9('0x98'));}}}}})[_0xdac9('0x80')](ut[_0xdac9('0x90')](_0xdac9('0x9a')));};Preview['prototype'][_0xdac9('0x9b')]=function(_0x5b63d8){_0x5b63d8['sendMessageOneNotActive']=!![];if(ut[_0xdac9('0x9c')](_0x5b63d8['loggedIn'])){_0x5b63d8['message']=_0xdac9('0x9d');}else if(!ut[_0xdac9('0x9e')](_0x5b63d8[_0xdac9('0x38')])){_0x5b63d8['message']='NOT_ACTIVE';}else if(!this[_0xdac9('0x9f')](_0x5b63d8[_0xdac9('0x59')])){if(!this['isTrunkReachable'](_0x5b63d8[_0xdac9('0xa0')])){_0x5b63d8[_0xdac9('0x65')]=_0xdac9('0xa1');}else{_0x5b63d8[_0xdac9('0x65')]=_0xdac9('0xa2');}}else{_0x5b63d8[_0xdac9('0x65')]=_0xdac9('0xa2');}emitCampaignPreview(_0x5b63d8);};Preview[_0xdac9('0x10')][_0xdac9('0xa3')]=function(_0x800e5,_0x20cd93,_0x1e2e7b){var _0x5401e6=this;var _0x24c11d=this['actions'][_0x20cd93];var _0x180397=this[_0xdac9('0x15')][_0x24c11d['queue']];var _0x3a6c78;if(_0x180397){switch(_0x1e2e7b){case'1':_0x180397[_0xdac9('0x42')]+=0x1;_0x24c11d[_0xdac9('0xa4')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x0,_0xdac9('0xa7'));ami[_0xdac9('0x2a')](_0xdac9('0xa8'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xaa')));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xab'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut[_0xdac9('0xad')](_0x24c11d,0xf,'Global');rpcDb[_0xdac9('0x99')](_0x3a6c78,_0xdac9('0xae'));}else{if(_0x24c11d[_0xdac9('0xa4')]>=_0x180397[_0xdac9('0xaf')]){rpcDb['createCustomerFinal'](_0x24c11d,_0xdac9('0xae'));}else{rpcDb[_0xdac9('0xb0')](ut[_0xdac9('0xb1')](_0x24c11d,'countnosuchnumberretry',_0x180397[_0xdac9('0xb2')]),_0x24c11d[_0xdac9('0xb3')],_0x24c11d['activeContact']);}}delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xb4')]];break;case _0xdac9('0xb5'):var _0x4d3d3e=moment()[_0xdac9('0x5d')](_0xdac9('0xb6'));_0x24c11d[_0xdac9('0xb7')]=_0x4d3d3e;_0x24c11d['answertime']=_0x4d3d3e;_0x24c11d['dialAnswer']=!![];_0x180397[_0xdac9('0x78')]+=0x1;logger[_0xdac9('0x60')](_0xdac9('0xb8'),_0x24c11d[_0xdac9('0xb9')],_0xdac9('0xba'),_0x180397[_0xdac9('0x2d')],_0xdac9('0x77'),_0x180397[_0xdac9('0x78')]);ami[_0xdac9('0x2a')](_0xdac9('0xbb'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xbc'),this[_0xdac9('0x15')][_0x24c11d['queue']]));if(_0x180397['acw']){ami[_0xdac9('0x2a')]('custom:agentConnectPreview',ut['buildAcw'](_0x24c11d));}break;case'16':ami[_0xdac9('0x2a')](_0xdac9('0xbd'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xbe'),this['campaignsPreview'][_0x24c11d[_0xdac9('0x75')]]));emitVoiceQueueChannelRemove(ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xbe')));_0x180397['outboundAnswerCallsDay']+=0x1;_0x180397[_0xdac9('0xbf')]+=0x1;_0x180397[_0xdac9('0x2f')]+=0x1;ut['decrementTalkink'](_0x180397,_0xdac9('0xc0'));_0x24c11d['countglobal']=ut[_0xdac9('0xa6')](_0x24c11d);ut['logCustomer'](_0x24c11d,0x4,_0xdac9('0xc1'));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xc2'));rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xc3'));rpcDb['crateCustomerReportQueue'](_0x24c11d);_0x180397[_0xdac9('0x33')]+=_0x24c11d[_0xdac9('0xc4')];_0x180397[_0xdac9('0x32')]+=_0x24c11d[_0xdac9('0xc4')];logger[_0xdac9('0x60')](_0xdac9('0xc5'),_0x24c11d[_0xdac9('0xb9')],_0xdac9('0xba'),_0x180397[_0xdac9('0x2d')],'pTalking:\x20',_0x180397[_0xdac9('0x78')]);delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xb4')]];break;case'BUSY':_0x180397['outboundBusyCallsDay']+=0x1;_0x24c11d['countbusyretry']+=0x1;_0x24c11d['countglobal']=ut['totalGlobal'](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x5,_0xdac9('0xc6'));ami[_0xdac9('0x2a')](_0xdac9('0xc7'),ut['buildObj'](_0x24c11d,_0xdac9('0xc8')));rpcDb['createCustomerHistory'](_0x24c11d,_0xdac9('0xc9'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut[_0xdac9('0xad')](_0x24c11d,0xf,'Global');rpcDb[_0xdac9('0x99')](_0x3a6c78,_0xdac9('0xca'));}else{if(_0x24c11d[_0xdac9('0xcb')]>=_0x180397[_0xdac9('0xcc')]){rpcDb['createCustomerFinal'](_0x24c11d,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xdac9('0xb0')](ut[_0xdac9('0xb1')](_0x24c11d,_0xdac9('0xcb'),_0x180397['dialBusyRetryFrequency']),_0x24c11d['unlockAgent'],_0x24c11d[_0xdac9('0xcd')]);}}break;case _0xdac9('0xce'):_0x180397[_0xdac9('0x41')]+=0x1;_0x24c11d[_0xdac9('0xcf')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x3,_0xdac9('0xd0'));ami[_0xdac9('0x2a')](_0xdac9('0xd1'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xd2')));rpcDb[_0xdac9('0x97')](_0x24c11d,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut['cloneAction'](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb['createCustomerFinal'](_0x3a6c78,_0xdac9('0xd4'));}else{if(_0x24c11d[_0xdac9('0xcf')]>=_0x180397[_0xdac9('0xd5')]){rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xd6'));}else{rpcDb[_0xdac9('0xb0')](ut[_0xdac9('0xb1')](_0x24c11d,_0xdac9('0xcf'),_0x180397[_0xdac9('0xd7')]),_0x24c11d[_0xdac9('0xb3')],_0x24c11d[_0xdac9('0xcd')]);}}break;case'CONGESTION':_0x180397[_0xdac9('0xd8')]+=0x1;_0x24c11d[_0xdac9('0xd9')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x8,'Congestion');ami['emit'](_0xdac9('0xda'),ut['buildObj'](_0x24c11d,'congestion'));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xdb'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut['cloneAction'](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb[_0xdac9('0x99')](_0x3a6c78,_0xdac9('0xdc'));}else{if(_0x24c11d['countcongestionretry']>=_0x180397['dialCongestionMaxRetry']){rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xdb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24c11d,'countcongestionretry',_0x180397[_0xdac9('0xdd')]),_0x24c11d[_0xdac9('0xb3')],_0x24c11d[_0xdac9('0xcd')]);}}break;case'CANCEL':_0x180397[_0xdac9('0x45')]+=0x1;_0x24c11d[_0xdac9('0xde')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x14,'AgentReject');ami[_0xdac9('0x2a')](_0xdac9('0xdf'),ut['buildObj'](_0x24c11d,_0xdac9('0xe0')));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xe1'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397['dialGlobalMaxRetry']){_0x3a6c78=ut['cloneAction'](_0x24c11d,0x14,_0xdac9('0xe2'));rpcDb[_0xdac9('0x99')](_0x3a6c78,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24c11d['countagentrejectretry']>=_0x180397[_0xdac9('0xe3')]){rpcDb['createCustomerFinal'](_0x24c11d,_0xdac9('0xe4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24c11d,_0xdac9('0xde'),_0x180397[_0xdac9('0xe5')]),_0x24c11d[_0xdac9('0xb3')],_0x24c11d[_0xdac9('0xcd')]);}}break;case _0xdac9('0xe6'):_0x180397[_0xdac9('0x47')]+=0x1;_0x24c11d[_0xdac9('0xe7')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0xb,_0xdac9('0xe8'));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xe9'));if(ut['totalGlobal'](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut[_0xdac9('0xad')](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb[_0xdac9('0x99')](_0x3a6c78,_0xdac9('0xe9'));}else{if(_0x24c11d[_0xdac9('0xea')]>=_0x180397[_0xdac9('0xeb')]){rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xe9'));}else{rpcDb[_0xdac9('0xb0')](ut[_0xdac9('0xb1')](_0x24c11d,'countabandonedretry',_0x180397[_0xdac9('0xec')]),_0x24c11d[_0xdac9('0xb3')],_0x24c11d[_0xdac9('0xcd')]);}}break;case'18':_0x180397[_0xdac9('0x46')]+=0x1;_0x24c11d[_0xdac9('0xed')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x12,_0x800e5[_0xdac9('0xee')]||_0x800e5[_0xdac9('0xef')]);ami['emit'](_0xdac9('0xf0'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xf1')));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xf2'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut[_0xdac9('0xad')](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb[_0xdac9('0x99')](_0x3a6c78,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xf2'));}delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xb4')]];break;case'19':_0x180397[_0xdac9('0x46')]+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0x13,_0x800e5[_0xdac9('0xee')]||_0x800e5[_0xdac9('0xef')]);ami['emit'](_0xdac9('0xf0'),ut[_0xdac9('0xa9')](_0x24c11d,_0xdac9('0xf1')));rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xf3'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397[_0xdac9('0xac')]){_0x3a6c78=ut[_0xdac9('0xad')](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb[_0xdac9('0x99')](_0x3a6c78,_0xdac9('0xf3'));}else{rpcDb[_0xdac9('0x99')](_0x24c11d,'[callProgressDetectingCustomer][machine]');}delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xb4')]];break;default:if(_0x24c11d['dialAnswer']){ut[_0xdac9('0x84')](_0x180397,_0xdac9('0xf4'));ut[_0xdac9('0x85')](_0xdac9('0xf5')+_0x180397[_0xdac9('0x2d')],_0x800e5);}_0x180397['outboundUnknownCallsDay']+=0x1;_0x24c11d[_0xdac9('0xa5')]=ut[_0xdac9('0xa6')](_0x24c11d);ut[_0xdac9('0x92')](_0x24c11d,0xc,_0x800e5['cause-txt']||_0x800e5[_0xdac9('0xef')]);rpcDb[_0xdac9('0x97')](_0x24c11d,_0xdac9('0xf6'));if(ut[_0xdac9('0xa6')](_0x24c11d)>=_0x180397['dialGlobalMaxRetry']){_0x3a6c78=ut['cloneAction'](_0x24c11d,0xf,_0xdac9('0xd3'));rpcDb['createCustomerFinal'](_0x3a6c78,_0xdac9('0xf7'));}else{rpcDb[_0xdac9('0x99')](_0x24c11d,_0xdac9('0xf7'));}delete this['actions'][_0x800e5[_0xdac9('0xb4')]];}if(!(_0x24c11d[_0xdac9('0x79')]&&_0x1e2e7b==='16')){ut[_0xdac9('0x82')](_0x180397,_0xdac9('0xf8'));logger[_0xdac9('0x60')](_0xdac9('0xf9'),_0x24c11d[_0xdac9('0xb9')],_0xdac9('0xba'),_0x180397[_0xdac9('0x2d')],_0xdac9('0xfa'),_0x180397[_0xdac9('0x76')]);}if(_0x1e2e7b!==_0xdac9('0xb5')){delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xb4')]];delete this[_0xdac9('0x17')][_0x800e5[_0xdac9('0xfb')]];}}};Preview[_0xdac9('0x10')][_0xdac9('0xfc')]=function(_0x123dec,_0x1efe77,_0x279cf3){if(_[_0xdac9('0xfd')](_0x1efe77)&&'object'!==typeof _0x1efe77){return;}if(_['isUndefined'](_0x279cf3)&&_0xdac9('0xfe')!==typeof _0x279cf3){return;}switch(_0x279cf3[_0xdac9('0xff')]){case'0':ut[_0xdac9('0x100')](_0x123dec,0x0,_0xdac9('0xa7'));rpcDb[_0xdac9('0x101')](_0x123dec,_0xdac9('0x102'));break;case'3':ut[_0xdac9('0x100')](_0x123dec,0x3,_0xdac9('0xd0'));rpcDb['createAgentHistory'](_0x123dec,_0xdac9('0x103'));break;case'5':ut[_0xdac9('0x100')](_0x123dec,0x5,_0xdac9('0xc6'));rpcDb[_0xdac9('0x101')](_0x123dec,_0xdac9('0x104'));break;case'8':ut[_0xdac9('0x100')](_0x123dec,0x8,_0xdac9('0x105'));rpcDb[_0xdac9('0x101')](_0x123dec,_0xdac9('0x106'));break;case'22':ut[_0xdac9('0x100')](_0x123dec,0x16,_0xdac9('0x107'));rpcDb[_0xdac9('0x101')](_0x123dec,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xdac9('0x100')](_0x123dec,0xc,_0x279cf3[_0xdac9('0xff')]);rpcDb['createAgentHistory'](_0x123dec,'[callProgressDetectingAgent][logCongestion]');}ut[_0xdac9('0x82')](_0x1efe77,_0xdac9('0x108'));logger[_0xdac9('0x60')](_0xdac9('0x109'),_0x123dec[_0xdac9('0xb9')],_0xdac9('0xba'),_0x1efe77[_0xdac9('0x2d')],_0xdac9('0xfa'),_0x1efe77['originated']);delete this[_0xdac9('0x17')][_0x123dec[_0xdac9('0xb9')]];};Preview['prototype'][_0xdac9('0x10a')]=function(_0x43310f,_0x39b635,_0x3a4982,_0x5ea0f8,_0x1c430a){var _0x68801b=this;return new BPromise(function(_0x72c574,_0x4b6304){if(_[_0xdac9('0x72')](_0x39b635)||_[_0xdac9('0x72')](_0x39b635['Contact'])||_[_0xdac9('0x72')](_0x39b635[_0xdac9('0x10b')][_0xdac9('0x10c')])||_[_0xdac9('0x72')](_0x39b635[_0xdac9('0x10d')])){_0x4b6304(ut[_0xdac9('0x65')](_0xdac9('0x10e'),_0x5ea0f8,_0x1c430a));return;}var _0x5511ef=uuid['v4']();var _0xbe0990=_0x68801b['campaignsPreview'][_0x39b635[_0xdac9('0x74')][_0xdac9('0x2d')]];var _0x5c7ab2=_0x3a4982?_0x68801b[_0xdac9('0x18')][_0x3a4982]['id']:undefined;_0x68801b[_0xdac9('0x17')][_0x5511ef]=new Action(_0x39b635,_0xbe0990,_0x5511ef,_0x3a4982,_0x5c7ab2);var _0x376d26=_0x68801b[_0xdac9('0x17')][_0x5511ef];_0x376d26[_0xdac9('0xb3')]=_0x5ea0f8;_0x376d26['activeContact']=_0x1c430a;_0x376d26[_0xdac9('0x10f')]=_0x3a4982;if(_['isEmpty'](_0x43310f)){_0x68801b[_0xdac9('0x110')](_0x376d26,_0xbe0990,_0x39b635,_0x3a4982)[_0xdac9('0x8b')](function(_0x3426d8){logger['info'](_0xdac9('0x111'),_0xdac9('0x112')+_0x376d26[_0xdac9('0x75')]+'\x20IdHopper:\x20'+_0x376d26[_0xdac9('0x113')],JSON[_0xdac9('0x5c')](_0x3426d8));ami[_0xdac9('0x2a')]('custom:agentcalled',ut[_0xdac9('0xa9')](_0x376d26,'called',_0x68801b[_0xdac9('0x15')][_0x376d26[_0xdac9('0x75')]]));_0x72c574(ut[_0xdac9('0x65')](_0xdac9('0x114')));})[_0xdac9('0x80')](function(_0x277ac1){ut[_0xdac9('0x6a')]('[Preview][execCall][failure]',_0x277ac1);_0x4b6304(ut[_0xdac9('0x65')](_0xdac9('0x115'),_0x5ea0f8,_0x1c430a));});}else{_0xbe0990['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x376d26);rpcDb[_0xdac9('0x116')](_0x376d26,_0xdac9('0x117'));delete _0x68801b[_0xdac9('0x17')][_0x5511ef];_0x4b6304(ut[_0xdac9('0x65')](_0xdac9('0x118'),_0x5ea0f8,_0x1c430a));}});};Preview[_0xdac9('0x10')][_0xdac9('0x9f')]=function(_0x1cdb7b){return!_[_0xdac9('0x72')](_0x1cdb7b)&&!_[_0xdac9('0x72')](_0x1cdb7b['name'])&&!_[_0xdac9('0x72')](_0x1cdb7b[_0xdac9('0x119')])&&_0x1cdb7b['active']&&!_[_0xdac9('0x72')](this['trunks'][util[_0xdac9('0x5d')](_0xdac9('0x11a'),_0x1cdb7b[_0xdac9('0x2d')])])&&!_['isNil'](this[_0xdac9('0x16')][util[_0xdac9('0x5d')](_0xdac9('0x11a'),_0x1cdb7b[_0xdac9('0x2d')])][_0xdac9('0x7e')])&&(this[_0xdac9('0x16')][util[_0xdac9('0x5d')](_0xdac9('0x11a'),_0x1cdb7b[_0xdac9('0x2d')])][_0xdac9('0x7e')]==='reachable'||this[_0xdac9('0x16')][util['format']('SIP/%s',_0x1cdb7b[_0xdac9('0x2d')])][_0xdac9('0x7e')]===_0xdac9('0x11b'));};Preview['prototype'][_0xdac9('0x8f')]=function(_0xead446,_0x2686d0){var _0x560e36=this;return new BPromise(function(_0xac1f20,_0x1195ba){_0x560e36['execRun'](_0xead446,_0x2686d0)[_0xdac9('0x8b')](function(_0x37552c){_0xac1f20(_[_0xdac9('0x11c')](_0x37552c,[_0xdac9('0x65')]));})[_0xdac9('0x80')](function(_0x1cd3f7){if(_0x1cd3f7[_0xdac9('0x11d')]){rpcDb['unlockContact'](_0xead446);}if(_0x1cd3f7['active']){rpcDb[_0xdac9('0x11e')](_0xead446);}_0x1195ba(_[_0xdac9('0x11c')](_0x1cd3f7,['message']));});});};Preview[_0xdac9('0x10')][_0xdac9('0x11f')]=function(_0x475c2e,_0x5862af){var _0x35e60a=this;return new BPromise(function(_0x500e09,_0x74d0fd){var _0x280b48,_0x46b699;rpcDb[_0xdac9('0x120')](_0x475c2e)[_0xdac9('0x8b')](function(_0x389cc6){if(!_['isNil'](_0x389cc6[0x0])){_0x46b699=_0x389cc6[0x0][_0xdac9('0x121')]?![]:!![];_0x280b48=_0x389cc6[0x0][_0xdac9('0x121')]?!![]:![];_0x280b48=_0x5862af?!![]:_0x280b48;}var _0x2bbfb7=_0x35e60a[_0xdac9('0x122')](_0x389cc6);if(_0x2bbfb7[_0xdac9('0x123')]){rpcDb[_0xdac9('0x124')](_[_0xdac9('0x11c')](_0x389cc6[0x0],[_0xdac9('0x10d'),'Contact.phone']))['then'](function(_0x27504e){_0x35e60a['checkInBlack'](_0x27504e,_0x389cc6[0x0],_0x5862af,_0x46b699,_0x280b48)[_0xdac9('0x8b')](function(_0x582a00){_0x500e09(_0x582a00);})[_0xdac9('0x80')](function(_0x6470f5){_0x74d0fd(_0x6470f5);});})[_0xdac9('0x80')](function(_0x2d781b){ut[_0xdac9('0x6a')](_0xdac9('0x125'),_0x2d781b);_0x74d0fd(ut[_0xdac9('0x65')](_0xdac9('0x126'),_0x46b699,_0x280b48));});}else{_0x74d0fd(ut['message'](_0x2bbfb7['message'],_0x46b699,_0x280b48));}})[_0xdac9('0x80')](function(_0x2eaae3){ut[_0xdac9('0x6a')](_0xdac9('0x127'),_0x2eaae3);_0x74d0fd(ut[_0xdac9('0x65')](_0xdac9('0x126'),![],!![]));});});};Preview['prototype'][_0xdac9('0x122')]=function(_0x26fe6b){if(_[_0xdac9('0x72')](_0x26fe6b)||_[_0xdac9('0x128')](_0x26fe6b)||!_[_0xdac9('0x72')](_0x26fe6b[0x0]['Agent'])&&_[_0xdac9('0x72')](_0x26fe6b[0x0][_0xdac9('0x8d')][_0xdac9('0x2d')])){ut[_0xdac9('0x6a')](_0xdac9('0x129'),_0x26fe6b);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x231221=this[_0xdac9('0x15')][_0x26fe6b[0x0]['Queue'][_0xdac9('0x2d')]];_0x231221[_0xdac9('0x65')]='ACTIVE';if(_[_0xdac9('0x72')](_0x231221)){ut[_0xdac9('0x6a')]('[Preview][validateContact][Empty\x20Campaign]',_0x231221);return{'isValid':![],'message':_0xdac9('0x12a')};}if(!this['isTrunkReachable'](_0x231221['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x231221[_0xdac9('0x2d')]+_0xdac9('0x12b'));if(!this[_0xdac9('0x9f')](_0x231221[_0xdac9('0xa0')])){ut[_0xdac9('0x6a')](_0xdac9('0x12c'),_0x231221[_0xdac9('0x2d')]+_0xdac9('0x12d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xdac9('0x9e')](_0x231221['dialActive'])){ut[_0xdac9('0x6a')]('[Preview][validateContact][Campaign\x20Active]',_0x231221[_0xdac9('0x2d')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xdac9('0x12e')+_0x231221[_0xdac9('0x2d')]+_0xdac9('0x12f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xdac9('0x110')]=function(_0x2cb05d,_0x269b07,_0x5d7482,_0x190a1f){var _0x3a6136=this;return new BPromise(function(_0x12039d,_0xba2b6){var _0x5ede8b=_0x2cb05d[_0xdac9('0xb9')];var _0x2719b3=_0x3a6136['isTrunkReachable'](_0x269b07[_0xdac9('0x59')])?util['format'](_0xdac9('0x130'),_0x269b07[_0xdac9('0x59')][_0xdac9('0x2d')],_['isNil'](_0x269b07['dialPrefix'])?'':_0x269b07[_0xdac9('0x3c')][_0xdac9('0x131')]()||'',_0x269b07[_0xdac9('0x132')]>0x0?_0x5d7482['Contact'][_0xdac9('0x10c')]['substring'](_0x269b07['dialCutDigit']):_0x5d7482[_0xdac9('0x10b')][_0xdac9('0x10c')]):util[_0xdac9('0x5d')](_0xdac9('0x130'),_['isNil'](_0x269b07[_0xdac9('0xa0')])?_0x269b07[_0xdac9('0x59')][_0xdac9('0x2d')]:_0x269b07[_0xdac9('0xa0')][_0xdac9('0x2d')],_[_0xdac9('0x72')](_0x269b07[_0xdac9('0x3c')])?'':_0x269b07[_0xdac9('0x3c')]['trim']()||'',_0x269b07[_0xdac9('0x132')]>0x0?_0x5d7482[_0xdac9('0x10b')]['phone']['substring'](_0x269b07[_0xdac9('0x132')]):_0x5d7482[_0xdac9('0x10b')][_0xdac9('0x10c')]);var _0x3c6828=_0x3a6136[_0xdac9('0x9f')](_0x269b07[_0xdac9('0x59')])?ut['getCallerId'](_0x269b07[_0xdac9('0x59')][_0xdac9('0x5a')],_0x269b07['dialOriginateCallerIdName'],_0x269b07[_0xdac9('0x133')]>0x0?ut[_0xdac9('0x134')](_0x269b07[_0xdac9('0x3a')],_0x269b07[_0xdac9('0x133')]):_0x269b07[_0xdac9('0x3a')]):ut[_0xdac9('0x135')](_[_0xdac9('0x72')](_0x269b07['TrunkBackup'])?_0x269b07['Trunk'][_0xdac9('0x5a')]:_0x269b07[_0xdac9('0xa0')][_0xdac9('0x5a')],_0x269b07['dialOriginateCallerIdName'],_0x269b07[_0xdac9('0x133')]>0x0?ut[_0xdac9('0x134')](_0x269b07[_0xdac9('0x3a')],_0x269b07[_0xdac9('0x133')]):_0x269b07[_0xdac9('0x3a')]);if(_0x3c6828){_0x2cb05d[_0xdac9('0x136')]=ut[_0xdac9('0x137')](_0x3c6828);_0x2cb05d['originatecalleridnum']=ut[_0xdac9('0x138')](_0x3c6828);}var _0x3e0db2=ut[_0xdac9('0x139')](_0x269b07,_0x5d7482,_0x2719b3,_0x3c6828,_0x5ede8b,_0x2cb05d);_[_0xdac9('0x13a')](_0x2cb05d,ut[_0xdac9('0x13b')](_0x3e0db2));_0x2cb05d['starttime']=moment()[_0xdac9('0x5d')](_0xdac9('0xb6'));ami[_0xdac9('0x7d')](ut[_0xdac9('0x13c')](_0x2cb05d,_0x269b07,_0x3e0db2,_0x2cb05d[_0xdac9('0xcd')],_0x190a1f))[_0xdac9('0x8b')](function(_0x2cf6f1){_0x269b07[_0xdac9('0x76')]+=0x1;logger[_0xdac9('0x60')](_0xdac9('0x13d'),_0x5ede8b,_0xdac9('0xba'),_0x269b07[_0xdac9('0x2d')],_0xdac9('0xfa'),_0x269b07[_0xdac9('0x76')]);_0x12039d(_0x2cf6f1);})[_0xdac9('0x80')](function(_0x1aac04){ut[_0xdac9('0x100')](_0x2cb05d,0xe,_0xdac9('0x13e'));rpcDb[_0xdac9('0x101')](_0x2cb05d,_0xdac9('0x13f'));_0xba2b6(_0x1aac04);});});};Preview[_0xdac9('0x10')][_0xdac9('0x23')]=function(_0x3e0c5f){if(this[_0xdac9('0x17')][_0x3e0c5f[_0xdac9('0xb4')]]){this[_0xdac9('0x17')][_0x3e0c5f[_0xdac9('0xb4')]][_0xdac9('0x7f')]=_0x3e0c5f[_0xdac9('0x7f')];}};Preview['prototype'][_0xdac9('0x140')]=function(_0x4d89ec){var _0x342f1b=this;var _0x1cce73=this[_0xdac9('0x17')][_0x4d89ec[_0xdac9('0x141')]];if(_0x1cce73){if(_0x1cce73[_0xdac9('0x10f')]&&this[_0xdac9('0x18')][_0x1cce73[_0xdac9('0x10f')]]){ut['logLookAgent'](_0x1cce73,this[_0xdac9('0x18')][_0x1cce73[_0xdac9('0x10f')]]['name'],this[_0xdac9('0x18')][_0x1cce73[_0xdac9('0x10f')]]['id']);}var _0x8fbf67=_[_0xdac9('0x142')](_0x1cce73);_0x8fbf67[_0xdac9('0xb7')]=moment()['format'](_0xdac9('0xb6'));var _0x10e31b=_0x342f1b['campaignsPreview'][_0x1cce73[_0xdac9('0x75')]];if(ut[_0xdac9('0x143')](_0x4d89ec[_0xdac9('0x144')])){if(_0x1cce73['unlockAgent']){rpcDb[_0xdac9('0x145')](_0x1cce73[_0xdac9('0x113')]);}if(_0x1cce73[_0xdac9('0xcd')]){rpcDb[_0xdac9('0x11e')](_0x1cce73[_0xdac9('0x113')]);}ami[_0xdac9('0x2a')](_0xdac9('0x146'),ut[_0xdac9('0xa9')](_0x1cce73,'rejected',this[_0xdac9('0x15')][_0x1cce73['queue']]));this['callProgressDetectingAgent'](_0x8fbf67,_0x10e31b,_0x4d89ec);}else{_0x1cce73[_0xdac9('0x147')]=moment()[_0xdac9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xdac9('0x100')](_0x8fbf67,0x4,_0xdac9('0xc1'));rpcDb[_0xdac9('0x101')](_0x8fbf67,_0xdac9('0x148'));}}};Preview['prototype']['syncHangup']=function(_0x26b19b){var _0x3a1d4d=this;var _0x2c57d2=this[_0xdac9('0x17')][_0x26b19b[_0xdac9('0xb4')]];var _0x4d396c;if(_0x2c57d2){_0x4d396c=this['campaignsPreview'][_0x2c57d2['queue']];logger[_0xdac9('0x60')](_0xdac9('0x149'),_0x26b19b[_0xdac9('0xb4')],'\x20Queue',_0x4d396c['name'],'pTalking:\x20',_0x4d396c[_0xdac9('0x78')]);}if(this[_0xdac9('0x17')][_0x26b19b[_0xdac9('0xb4')]]&&_0x26b19b[_0xdac9('0xb4')]!==_0x26b19b[_0xdac9('0xb9')]){if(_0x26b19b[_0xdac9('0x14a')]==='16'&&this['actions'][_0x26b19b[_0xdac9('0xb4')]]['dialAnswer']){this[_0xdac9('0xa3')](_0x26b19b,_0x26b19b[_0xdac9('0xb4')],_0x26b19b[_0xdac9('0x14a')]);}else if(this[_0xdac9('0x17')][_0x26b19b[_0xdac9('0xb4')]][_0xdac9('0x79')]){logger[_0xdac9('0x60')](_0xdac9('0x14b'),_0x26b19b[_0xdac9('0xb4')],_0x26b19b[_0xdac9('0x14a')],_0xdac9('0xba'),_0x4d396c[_0xdac9('0x2d')],'pTalking:\x20',_0x4d396c['pTalking']);this[_0xdac9('0xa3')](_0x26b19b,_0x26b19b[_0xdac9('0xb4')],_0x26b19b[_0xdac9('0x14a')]);}}else if(_0x2c57d2&&_[_0xdac9('0x72')](_0x2c57d2[_0xdac9('0x14c')])&&_0x4d396c['dialQueueProject']&&_0x26b19b[_0xdac9('0xb4')]===_0x26b19b[_0xdac9('0xb9')]&&_['isNil'](_0x26b19b[_0xdac9('0xff')])&&_0x26b19b[_0xdac9('0x14a')]==='16'&&_0x26b19b[_0xdac9('0x14d')]==='6'&&_['isUndefined'](_0x2c57d2['transfer'])){if(_0x2c57d2[_0xdac9('0xb3')]){rpcDb['unlockContact'](_0x2c57d2[_0xdac9('0x113')]);}if(_0x2c57d2[_0xdac9('0xcd')]){rpcDb[_0xdac9('0x11e')](_0x2c57d2['idContact']);}_0x26b19b[_0xdac9('0xff')]='22';this[_0xdac9('0xfc')](_0x2c57d2,_0x4d396c,_0x26b19b);}else if(_0x2c57d2&&_0x2c57d2[_0xdac9('0x14e')]){if(_0x26b19b['cause']==='16'&&this[_0xdac9('0x17')][_0x26b19b[_0xdac9('0xb4')]][_0xdac9('0x79')]){logger['info'](_0xdac9('0x14f'),_0x26b19b[_0xdac9('0xb4')],_0x26b19b['cause'],'\x20Queue',_0x4d396c[_0xdac9('0x2d')],_0xdac9('0x77'),_0x4d396c[_0xdac9('0x78')]);this[_0xdac9('0xa3')](_0x26b19b,_0x26b19b['linkedid'],_0x26b19b[_0xdac9('0x14a')]);}else if(this[_0xdac9('0x17')][_0x26b19b[_0xdac9('0xb4')]]['dialAnswer']){logger[_0xdac9('0x60')](_0xdac9('0x14b'),_0x26b19b[_0xdac9('0xb4')],_0x26b19b[_0xdac9('0x14a')],_0xdac9('0xba'),_0x4d396c[_0xdac9('0x2d')],_0xdac9('0x77'),_0x4d396c[_0xdac9('0x78')]);this['callProgressDetectingCustomer'](_0x26b19b,_0x26b19b[_0xdac9('0xb4')],_0x26b19b[_0xdac9('0x14a')]);}}};Preview[_0xdac9('0x10')][_0xdac9('0x21')]=function(_0x48b519){if(this[_0xdac9('0x17')][_0x48b519[_0xdac9('0xfb')]]&&_0x48b519[_0xdac9('0xfb')]!==_0x48b519[_0xdac9('0x150')]){this[_0xdac9('0xa3')](_0x48b519,_0x48b519[_0xdac9('0xfb')],_0x48b519[_0xdac9('0xef')]);}};Preview[_0xdac9('0x10')][_0xdac9('0x1e')]=function(_0x9adc9d){if(this[_0xdac9('0x17')][_0x9adc9d[_0xdac9('0xb4')]]&&_0x9adc9d[_0xdac9('0xb4')]!==_0x9adc9d[_0xdac9('0xb9')]&&!this[_0xdac9('0x17')][_0x9adc9d[_0xdac9('0xb4')]][_0xdac9('0x79')]){if(_0x9adc9d[_0xdac9('0x14a')]==='1'){this[_0xdac9('0xa3')](_0x9adc9d,_0x9adc9d['linkedid'],_0x9adc9d[_0xdac9('0x14a')]);}}};Preview[_0xdac9('0x10')][_0xdac9('0x151')]=function(_0x9d6a1f,_0x2d3ff9,_0x27a0a0){if(this[_0xdac9('0x17')][_0x9d6a1f]){if(_[_0xdac9('0x72')](this[_0xdac9('0x17')][_0x9d6a1f]['variables'])){this[_0xdac9('0x17')][_0x9d6a1f]['variables']={};}this[_0xdac9('0x17')][_0x9d6a1f][_0xdac9('0x152')][_0x2d3ff9]=_0x27a0a0;}};Preview[_0xdac9('0x10')][_0xdac9('0x25')]=function(_0x197094){try{if(!_[_0xdac9('0x72')](_0x197094)){if(ut[_0xdac9('0x153')](_[_0xdac9('0x154')](_0x197094[_0xdac9('0x155')])[0x0])){this[_0xdac9('0x151')](_0x197094[_0xdac9('0xb9')],_[_0xdac9('0x154')](_0x197094[_0xdac9('0x155')])[0x0],_0x197094[_0xdac9('0x156')]);}}}catch(_0x4f7d5b){logger['error'](_0xdac9('0x157'),util[_0xdac9('0x158')](_0x4f7d5b,{'showHidden':![],'depth':null}));}};Preview[_0xdac9('0x10')][_0xdac9('0x27')]=function(_0x4abf26){if(_0x4abf26){if(this['actions'][_0x4abf26[_0xdac9('0x159')]]){this['actions'][_0x4abf26[_0xdac9('0x159')]][_0xdac9('0x14e')]=!![];}}};Preview[_0xdac9('0x10')][_0xdac9('0x15a')]=function(_0x4d05c6){if(_0x4d05c6){if(this['actions'][_0x4d05c6[_0xdac9('0x15b')]]){this[_0xdac9('0x17')][_0x4d05c6[_0xdac9('0x15b')]][_0xdac9('0x14e')]=!![];}}};module[_0xdac9('0x15c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c22ec17..196e9fd 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 _0x58cd=['createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20'];(function(_0x3a3f6d,_0x579219){var _0x396dc8=function(_0x351e53){while(--_0x351e53){_0x3a3f6d['push'](_0x3a3f6d['shift']());}};_0x396dc8(++_0x579219);}(_0x58cd,0x13a));var _0xd58c=function(_0x5e70d7,_0x440570){_0x5e70d7=_0x5e70d7-0x0;var _0xf2a6df=_0x58cd[_0x5e70d7];return _0xf2a6df;};'use strict';var util=require(_0xd58c('0x0'));var BPromise=require(_0xd58c('0x1'));var logger=require(_0xd58c('0x2'))(_0xd58c('0x3'));var _=require('lodash');var cmHopper=require(_0xd58c('0x4'));var cmHopperFinal=require(_0xd58c('0x5'));var cmHopperHistory=require(_0xd58c('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd58c('0x7'));var agentReportPreview=require(_0xd58c('0x8'));var voiceQueueReport=require(_0xd58c('0x9'));function loggerCatch(_0x1efae7){return function(_0x1dbb2c){logger[_0xd58c('0xa')](_0x1efae7,util[_0xd58c('0xb')](_0x1dbb2c,{'showHidden':![],'depth':null}));};}function create(_0x134330){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopperHistory['createHistory'](_0x134330))[_0xd58c('0xe')](loggerCatch(_0xd58c('0xf')));}function createAgent(_0xeb8538){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](agentReportPreview[_0xd58c('0x10')](_0xeb8538))['catch'](loggerCatch(_0xd58c('0xf')));}function moveContact(_0x16e0d9){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopper[_0xd58c('0x11')](_0x16e0d9,!![]))[_0xd58c('0xe')](loggerCatch(_0xd58c('0x12')));}exports[_0xd58c('0x13')]=function(_0x48c6c6){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopperBlack[_0xd58c('0x13')](_0x48c6c6))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xd58c('0x14')]=function(_0x1a4c42){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopper[_0xd58c('0x14')](_0x1a4c42))[_0xd58c('0xe')](loggerCatch(_0xd58c('0x15')));};exports[_0xd58c('0x10')]=function(_0x4c8233,_0x3c643d){create(_0x4c8233)[_0xd58c('0xe')](loggerCatch(_0x3c643d));moveContact(_0x4c8233)[_0xd58c('0xe')](loggerCatch(_0x3c643d));};exports['createAgentHistory']=function(_0x5f0402,_0x8207c3){createAgent(_0x5f0402)[_0xd58c('0xe')](loggerCatch(_0x8207c3));};exports[_0xd58c('0x16')]=function(_0x5a67cd,_0x221652){create(_0x5a67cd)[_0xd58c('0xe')](loggerCatch(_0x221652));};exports[_0xd58c('0x17')]=function(_0x23930a,_0x266d59){moveContact(_0x23930a)['catch'](loggerCatch(_0x266d59));};exports[_0xd58c('0x18')]=function(_0x14927e,_0x1dce70,_0x24be50){if(_0x1dce70){_0x14927e[_0xd58c('0x19')]=null;}if(_0x24be50){_0x14927e[_0xd58c('0x1a')]=![];}return BPromise['resolve']()[_0xd58c('0xd')](cmHopper[_0xd58c('0x18')](_0x14927e))[_0xd58c('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xd58c('0x1b')]=function(_0x4ccdf0){return BPromise['resolve']()[_0xd58c('0xd')](cmHopper[_0xd58c('0x1b')](_0x4ccdf0))['catch'](loggerCatch(_0xd58c('0x1c')));};exports[_0xd58c('0x1d')]=function(_0x311df8){return BPromise['resolve']()[_0xd58c('0xd')](cmHopper[_0xd58c('0x1d')]({'UserId':null},_0x311df8,0x1))[_0xd58c('0xe')](loggerCatch(_0xd58c('0x1e')));};exports[_0xd58c('0x1f')]=function(_0x4a64e2){return BPromise['resolve']()[_0xd58c('0xd')](cmHopper[_0xd58c('0x1d')]({'active':![]},_0x4a64e2,0x1))[_0xd58c('0xe')](loggerCatch(_0xd58c('0x20')));};exports[_0xd58c('0x21')]=function(_0x59238c){var _0x32a8e6={};_0x32a8e6[_0xd58c('0x22')]=_0x59238c[_0xd58c('0x22')];_0x32a8e6[_0xd58c('0x23')]=_0x59238c['uniqueid'];_0x32a8e6[_0xd58c('0x24')]=_0x59238c['calleridnum'];_0x32a8e6['calleridname']=_0x59238c[_0xd58c('0x25')];_0x32a8e6['queue']=_0x59238c['queue'];_0x32a8e6[_0xd58c('0x26')]=_0x59238c[_0xd58c('0x27')];_0x32a8e6['queuecallerleaveAt']=_0x59238c[_0xd58c('0x27')];_0x32a8e6[_0xd58c('0x28')]=0x1;_0x32a8e6[_0xd58c('0x29')]=_0x59238c[_0xd58c('0x2a')];_0x32a8e6[_0xd58c('0x2b')]=_0x59238c[_0xd58c('0x2c')];_0x32a8e6[_0xd58c('0x2d')]='from-sip';_0x32a8e6['exten']=_0xd58c('0x2e');_0x32a8e6[_0xd58c('0x2f')]=0x0;_0x32a8e6[_0xd58c('0x30')]=0x1;_0x32a8e6['lastAssignedTo']=_0x59238c['membername'];_0x32a8e6[_0xd58c('0x31')]=_0xd58c('0x32');return BPromise['resolve']()[_0xd58c('0xd')](voiceQueueReport[_0xd58c('0x33')](_0x32a8e6))['catch'](loggerCatch(_0xd58c('0x34')));};exports['getContactRecallMe']=function(_0x376e62,_0x5e3c2a){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopper[_0xd58c('0x35')](_0x376e62,_0x5e3c2a))[_0xd58c('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd58c('0x36')]=function(_0x27e239){return BPromise[_0xd58c('0xc')]()[_0xd58c('0xd')](cmHopper['rescheduleContact'](_0x27e239,!![],!![]))[_0xd58c('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xe3f7=['resolve','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect'];(function(_0xdbcfc7,_0x26e454){var _0x39384b=function(_0x3c7fa1){while(--_0x3c7fa1){_0xdbcfc7['push'](_0xdbcfc7['shift']());}};_0x39384b(++_0x26e454);}(_0xe3f7,0x168));var _0x7e3f=function(_0x10b59a,_0x5a0ed4){_0x10b59a=_0x10b59a-0x0;var _0x435565=_0xe3f7[_0x10b59a];return _0x435565;};'use strict';var util=require(_0x7e3f('0x0'));var BPromise=require(_0x7e3f('0x1'));var logger=require(_0x7e3f('0x2'))('preview');var _=require(_0x7e3f('0x3'));var cmHopper=require(_0x7e3f('0x4'));var cmHopperFinal=require(_0x7e3f('0x5'));var cmHopperHistory=require(_0x7e3f('0x6'));var cmHopperBlack=require(_0x7e3f('0x7'));var voiceQueueRt=require(_0x7e3f('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x7e3f('0x9'));function loggerCatch(_0x474dd5){return function(_0x251f88){logger['error'](_0x474dd5,util[_0x7e3f('0xa')](_0x251f88,{'showHidden':![],'depth':null}));};}function create(_0x22ef3d){return BPromise[_0x7e3f('0xb')]()['then'](cmHopperHistory['createHistory'](_0x22ef3d))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0xd')));}function createAgent(_0x37bb7){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](agentReportPreview[_0x7e3f('0xf')](_0x37bb7))[_0x7e3f('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5d95f9){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](cmHopper[_0x7e3f('0x10')](_0x5d95f9,!![]))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x11')));}exports['checkIsBlackList']=function(_0x12601b){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](cmHopperBlack[_0x7e3f('0x12')](_0x12601b))[_0x7e3f('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x7e3f('0x13')]=function(_0x4d4d34){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](cmHopper[_0x7e3f('0x13')](_0x4d4d34))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x14')));};exports[_0x7e3f('0xf')]=function(_0x1b162a,_0x511994){create(_0x1b162a)['catch'](loggerCatch(_0x511994));moveContact(_0x1b162a)[_0x7e3f('0xc')](loggerCatch(_0x511994));};exports['createAgentHistory']=function(_0x5a38b8,_0x4ee396){createAgent(_0x5a38b8)[_0x7e3f('0xc')](loggerCatch(_0x4ee396));};exports['createCustomerHistory']=function(_0x5abd4d,_0x24986a){create(_0x5abd4d)[_0x7e3f('0xc')](loggerCatch(_0x24986a));};exports['createCustomerFinal']=function(_0x21d565,_0x16c381){moveContact(_0x21d565)['catch'](loggerCatch(_0x16c381));};exports['rescheduleContact']=function(_0x36bcd9,_0x474d44,_0x4a3d88){if(_0x474d44){_0x36bcd9['UserId']=null;}if(_0x4a3d88){_0x36bcd9[_0x7e3f('0x15')]=![];}return BPromise[_0x7e3f('0xb')]()['then'](cmHopper['rescheduleContact'](_0x36bcd9))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x16')));};exports[_0x7e3f('0x17')]=function(_0x4fa266){return BPromise[_0x7e3f('0xb')]()['then'](cmHopper[_0x7e3f('0x17')](_0x4fa266))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x7e3f('0x18')]=function(_0x2537d9){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](cmHopper[_0x7e3f('0x18')]({'UserId':null},_0x2537d9,0x1))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x19')));};exports[_0x7e3f('0x1a')]=function(_0x1f4631){return BPromise[_0x7e3f('0xb')]()['then'](cmHopper[_0x7e3f('0x18')]({'active':![]},_0x1f4631,0x1))[_0x7e3f('0xc')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x2e3ef2){var _0x26fe2a={};_0x26fe2a[_0x7e3f('0x1b')]=_0x2e3ef2[_0x7e3f('0x1b')];_0x26fe2a[_0x7e3f('0x1c')]=_0x2e3ef2[_0x7e3f('0x1c')];_0x26fe2a[_0x7e3f('0x1d')]=_0x2e3ef2[_0x7e3f('0x1d')];_0x26fe2a[_0x7e3f('0x1e')]=_0x2e3ef2[_0x7e3f('0x1e')];_0x26fe2a[_0x7e3f('0x1f')]=_0x2e3ef2['queue'];_0x26fe2a[_0x7e3f('0x20')]=_0x2e3ef2['answertime'];_0x26fe2a[_0x7e3f('0x21')]=_0x2e3ef2[_0x7e3f('0x22')];_0x26fe2a[_0x7e3f('0x23')]=0x1;_0x26fe2a[_0x7e3f('0x24')]=_0x2e3ef2[_0x7e3f('0x25')];_0x26fe2a[_0x7e3f('0x26')]=_0x2e3ef2['membername'];_0x26fe2a[_0x7e3f('0x27')]=_0x7e3f('0x28');_0x26fe2a[_0x7e3f('0x29')]=_0x7e3f('0x2a');_0x26fe2a['holdtime']=0x0;_0x26fe2a[_0x7e3f('0x2b')]=0x1;_0x26fe2a[_0x7e3f('0x2c')]=_0x2e3ef2[_0x7e3f('0x2d')];_0x26fe2a['queuecallerexitreason']=_0x7e3f('0x2e');return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](voiceQueueReport[_0x7e3f('0x2f')](_0x26fe2a))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x30')));};exports[_0x7e3f('0x31')]=function(_0x73114f,_0x5b2366){return BPromise[_0x7e3f('0xb')]()['then'](cmHopper['getContactRecallMe'](_0x73114f,_0x5b2366))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x32')));};exports[_0x7e3f('0x33')]=function(_0x1b45f4){return BPromise[_0x7e3f('0xb')]()[_0x7e3f('0xe')](cmHopper['rescheduleContact'](_0x1b45f4,!![],!![]))[_0x7e3f('0xc')](loggerCatch(_0x7e3f('0x34')));}; \ 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 8691c6d..11d24b8 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 _0x98f6=['extractCalleridNumber','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','logger','info','inspect','loggerError','logger2','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','isActive','addVariables','Queue','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','updatedAt','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','channelAgent','from-sip','uniqueid','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','reachable','push','seconds','createBody','CampaignId','filterKey','idContact','type','membername','calleridnum','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match'];(function(_0x104112,_0x342eb6){var _0x394ab4=function(_0x48db18){while(--_0x48db18){_0x104112['push'](_0x104112['shift']());}};_0x394ab4(++_0x342eb6);}(_0x98f6,0x1b1));var _0x698f=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x98f6[_0x20a558];return _0x53d3f7;};'use strict';var util=require(_0x698f('0x0'));var _=require(_0x698f('0x1'));var moment=require(_0x698f('0x2'));var logger=require(_0x698f('0x3'))('preview');var ipAgi=process['env'][_0x698f('0x4')]||_0x698f('0x5');function getSeconds(_0xfcaf8f,_0x3eae9b){var _0x2e0e0c=moment(_0xfcaf8f)[_0x698f('0x6')](0x0);var _0x4e62d6=moment(_0x3eae9b)[_0x698f('0x6')](0x0);return _0x2e0e0c[_0x698f('0x7')](_0x4e62d6,'seconds');}exports[_0x698f('0x8')]=function(_0x277663){return function(_0x286155){logger[_0x698f('0x9')](_0x277663,util['inspect'](_0x286155,{'showHidden':![],'depth':null}));};};exports[_0x698f('0xa')]=function(_0x3b8a43,_0x37e76b){logger[_0x698f('0xb')](_0x3b8a43,util[_0x698f('0xc')](_0x37e76b,{'showHidden':![],'depth':null}));};exports[_0x698f('0xd')]=function(_0x4b7476,_0x18ab3f){logger['error'](_0x4b7476,util[_0x698f('0xc')](_0x18ab3f,{'showHidden':![],'depth':null}));};exports[_0x698f('0xe')]=function(_0x589dbc){return function(_0x42af46){logger[_0x698f('0xb')](_0x589dbc,util[_0x698f('0xc')](_0x42af46,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x36905c,_0x4b89c7,_0x301f82){return{'message':_0x36905c,'unlock':_0x4b89c7,'active':_0x301f82};};exports[_0x698f('0xf')]=function(_0x24d9bb,_0x59d81f,_0x205b25){if(!_['isUndefined'](_0x205b25)&&'string'===typeof _0x205b25&&!_[_0x698f('0x10')](_0x205b25)){if(!_[_0x698f('0x11')](_0x59d81f)&&_0x698f('0x12')===typeof _0x59d81f&&!_[_0x698f('0x10')](_0x59d81f)){return util[_0x698f('0x13')](_0x698f('0x14'),_0x59d81f,_0x205b25);}return util[_0x698f('0x13')](_0x698f('0x14'),_0x205b25,_0x205b25);}if(!_['isUndefined'](_0x24d9bb)&&_0x698f('0x12')===typeof _0x24d9bb&&!_['isEmpty'](_0x24d9bb)){return _0x24d9bb;}return'\x22\x22\x20<>';};exports[_0x698f('0x15')]=function(_0x3f4ce6){if(_['isNil'](_0x3f4ce6)){return![];}return _0x3f4ce6;};exports[_0x698f('0x16')]=function(_0x50d775,_0x183c1a,_0x175c49,_0x56c3d0,_0xf19d99,_0xd8ade8){var _0x32b00a={'XMD-QUEUE':_0x183c1a[_0x698f('0x17')]?_0x183c1a[_0x698f('0x17')]['name']:'','XMD-CALLERID':_0x56c3d0,'XMD-CALLERID-PREVIEW':_0xd8ade8?util[_0x698f('0x13')](_0x698f('0x14'),_0xd8ade8['calleridname'],_0xd8ade8['calleridnum']):_0x56c3d0,'XMD-DIALID':_0xf19d99,'XMD-CONTACTID':_0x183c1a[_0x698f('0x18')],'XMD-CDRTYPE':_0x698f('0x19'),'CALLERID(all)':_0x56c3d0,'XMD-VOICEQUEUEID':_0x183c1a[_0x698f('0x1a')],'XMD-DIALCHANNEL':_0x175c49,'XMD-DIALTIMEOUT':_0x50d775['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x698f('0x13')](_0x698f('0x1b'),_0x50d775['dialQueueProject2']?'g':'',_[_0x698f('0x10')](_0x50d775[_0x698f('0x1c')])?'':_0x698f('0x1d')),'XMD-DIALURL':_0x50d775[_0x698f('0x1e')]||'','XMD-AGI':_0x50d775[_0x698f('0x1f')]?util['format'](_0x698f('0x20'),ipAgi,_0x50d775['dialQueueProject']):_0x698f('0x21'),'XMD-AGIAFTER':_0x50d775[_0x698f('0x22')]?util[_0x698f('0x13')](_0x698f('0x20'),ipAgi,_0x50d775[_0x698f('0x22')]):_0x698f('0x21'),'XMD-ORIGINATECALLERIDNUM':_0xd8ade8?_0xd8ade8[_0x698f('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xd8ade8?_0xd8ade8[_0x698f('0x24')]:'','XMD-DESTINATION':_0x698f('0x25'),'SIPADDHEADER':_0x698f('0x26')};if(!_['isEmpty'](_0x50d775[_0x698f('0x1c')])){_0x32b00a[util['format']('%s',_0x698f('0x27'))]=_0x50d775['monitor_format'];_0x32b00a[util[_0x698f('0x13')]('%s',_0x698f('0x28'))]=_0xf19d99;}if(_0x183c1a&&_0x183c1a['Contact']){for(var _0xefecf9 in _0x183c1a[_0x698f('0x29')]){if(_0x183c1a[_0x698f('0x29')][_0x698f('0x2a')](_0xefecf9)){if(!_[_0x698f('0x2b')](_0x183c1a['Contact'][_0xefecf9])&&_0xefecf9!=='id'&&_0xefecf9!==_0x698f('0x2c')&&_0xefecf9!=='createdAt'&&_0xefecf9!==_0x698f('0x2d')){_0x32b00a[util[_0x698f('0x13')]('%s%s',_0x698f('0x2e'),_[_0x698f('0x2f')](_0xefecf9))]=_0x183c1a[_0x698f('0x29')][_0xefecf9];}}}}return _0x32b00a;};exports['toLowerVariables']=function(_0x30f410){var _0x44521e={};for(var _0x3e90c4 in _0x30f410){if(_0x30f410[_0x698f('0x2a')](_0x3e90c4)){_0x44521e[util[_0x698f('0x13')]('%s',_[_0x698f('0x30')](_0x3e90c4))]=_0x30f410[_0x3e90c4];}}return{'variables':_0x44521e};};exports['updateOriginated']=function(_0x481f3d,_0x5d1cf9){if(!_[_0x698f('0x2b')](_0x481f3d)){if(_0x481f3d[_0x698f('0x2a')]('originated')){if(_0x481f3d[_0x698f('0x31')]>0x0){_0x481f3d['originated']-=0x1;}else{logger[_0x698f('0x9')](_0x698f('0x32'),_0x5d1cf9);}}}else{logger['error'](_0x698f('0x33'),_0x5d1cf9);}};exports[_0x698f('0x34')]=function(_0x5b1078){var _0x4043d2=moment()[_0x698f('0x13')](_0x698f('0x35'));_0x5b1078[_0x698f('0x36')]=0xd;_0x5b1078['statedesc']=_0x698f('0x37');_0x5b1078[_0x698f('0x38')]=_0x4043d2;_0x5b1078[_0x698f('0x39')]=_0x4043d2;_0x5b1078[_0x698f('0x3a')]=_0x4043d2;};exports[_0x698f('0x3b')]=function(_0x4be07b,_0x47b3af,_0x4be508){var _0x5b62af=moment()['format'](_0x698f('0x35'));_0x4be07b[_0x698f('0x36')]=_0x47b3af;_0x4be07b[_0x698f('0x3c')]=_0x4be508;_0x4be07b['responsetime']=_0x5b62af;_0x4be07b[_0x698f('0x3d')]=getSeconds(_0x4be07b[_0x698f('0x39')],_0x4be07b['starttime']);};exports[_0x698f('0x3e')]=function(_0x4d45ab,_0x68439b,_0x5ce627){_0x4d45ab['membername']=_0x68439b;_0x4d45ab[_0x698f('0x3f')]=_0x5ce627;};exports['logCustomer']=function(_0x1325d2,_0x171562,_0x1e8536){var _0x1112c8=moment()[_0x698f('0x13')](_0x698f('0x35'));_0x1325d2[_0x698f('0x36')]=_0x171562;_0x1325d2[_0x698f('0x3c')]=_0x1e8536;_0x1325d2[_0x698f('0x39')]=_0x1325d2[_0x698f('0x39')]?_0x1325d2[_0x698f('0x39')]:_0x1112c8;_0x1325d2[_0x698f('0x3a')]=_0x1325d2['endtime']?_0x1325d2[_0x698f('0x3a')]:_0x1112c8;_0x1325d2[_0x698f('0x3d')]=getSeconds(_0x1325d2['responsetime']||0x0,_0x1325d2[_0x698f('0x38')]||0x0);_0x1325d2[_0x698f('0x40')]=_0x1325d2[_0x698f('0x41')]?getSeconds(_0x1325d2[_0x698f('0x3a')],_0x1325d2['answertime']):0x0;};exports[_0x698f('0x42')]=function(_0x4e89e4){return _0x4e89e4===_0x698f('0x43');};exports[_0x698f('0x44')]=function(_0x419023,_0x13d8c8,_0x11f558,_0x5ee639,_0x555a83){var _0x4a6d5a=_0x5ee639?_0x698f('0x45'):_0x419023[_0x698f('0x46')];_0x4a6d5a=_0x555a83?_0x698f('0x47'):_0x4a6d5a;return{'actionid':_0x419023['uniqueid'],'action':'originate','channel':_0x419023[_0x698f('0x48')],'callerid':util[_0x698f('0x13')](_0x698f('0x14'),_0x4a6d5a,_0x419023['calleridnum']),'Exten':_0x698f('0x25'),'Context':_0x698f('0x49'),'Priority':'1','variable':_0x11f558,'timeout':(_0x13d8c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x419023[_0x698f('0x4a')]};};exports['totalGlobal']=function(_0x5b12db){return _0x5b12db[_0x698f('0x4b')]+_0x5b12db[_0x698f('0x4c')]+_0x5b12db['countnoanswerretry']+_0x5b12db[_0x698f('0x4d')]+_0x5b12db[_0x698f('0x4e')];};exports[_0x698f('0x4f')]=function(_0x148b82){var _0x1e0026=_[_0x698f('0x50')](_0x148b82);_0x1e0026[_0x698f('0x36')]=0xf;_0x1e0026[_0x698f('0x3c')]=_0x698f('0x51');return _0x1e0026;};exports['scheduledAt']=function(_0x5cf6cf,_0x25e66d,_0x27621f){var _0x2c1068={};_0x2c1068[_0x25e66d]=_0x5cf6cf[_0x25e66d];_0x2c1068[_0x698f('0x52')]=![];_0x2c1068['scheduledat']=moment()['add'](_0x27621f,_0x698f('0x53'))[_0x698f('0x13')](_0x698f('0x35'));_0x2c1068[_0x698f('0x18')]=_0x5cf6cf['ContactId'];_0x2c1068[_0x698f('0x54')]=_0x5cf6cf[_0x698f('0x54')];_0x2c1068[_0x698f('0x1a')]=_0x5cf6cf[_0x698f('0x1a')]||undefined;return _0x2c1068;};exports[_0x698f('0x55')]=function(_0x1b4153,_0x8223cb){if(!_[_0x698f('0x2b')](_0x1b4153)){if(_0x1b4153[_0x698f('0x56')]>0x0){_0x1b4153[_0x698f('0x56')]-=0x1;}else{logger[_0x698f('0x9')](_0x8223cb,_0x698f('0x57'));}}else{logger[_0x698f('0x9')](_0x8223cb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x698f('0x58')]=function(_0x509a25){if(_0x509a25<=0x0){return!![];}return![];};exports[_0x698f('0x59')]=function(_0x4d7638,_0x4bfcb3,_0x433c16){_0x4d7638[_0x698f('0x5a')]=_0x4bfcb3;_0x4d7638[_0x698f('0x5b')]=_0x4d7638[_0x698f('0x5c')];_0x4d7638['interface']=_0x4d7638[_0x698f('0x48')];_0x4d7638[_0x698f('0x5d')]=_0x698f('0x5e');if(_0x433c16){_0x4d7638['mandatoryDisposition']=_0x433c16[_0x698f('0x5f')];}return _0x4d7638;};exports[_0x698f('0x60')]=function(_0x44f143){var _0x5872d9={};_0x5872d9[_0x698f('0x5c')]=_0x44f143[_0x698f('0x5c')];_0x5872d9[_0x698f('0x61')]=_0x44f143[_0x698f('0x48')];_0x5872d9[_0x698f('0x4a')]=_0x44f143[_0x698f('0x4a')];return _0x5872d9;};exports[_0x698f('0x62')]=function(_0x3ac75e){var _0xfd643f=[];for(var _0x251586 in _0x3ac75e){if(_0x3ac75e['hasOwnProperty'](_0x251586)){if(!_[_0x698f('0x2b')](_0x3ac75e[_0x251586])&&_0x3ac75e[_0x251586]['state']===_0x698f('0x63')&&_0x3ac75e[_0x251586]['status']===_0x698f('0x64')){_0xfd643f[_0x698f('0x65')](_0x3ac75e[_0x251586]['id']);}}}return _0xfd643f;};exports['getDiff']=function(_0x348050){var _0xe3a2dc=moment()[_0x698f('0x6')](0x0);var _0x1d1379=moment(_0x348050)[_0x698f('0x6')](0x0);return _0xe3a2dc[_0x698f('0x7')](_0x1d1379,_0x698f('0x66'));};exports[_0x698f('0x67')]=function(_0x3d9c8b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d9c8b[_0x698f('0x18')],'ListId':_0x3d9c8b[_0x698f('0x54')],'VoiceQueueId':_0x3d9c8b[_0x698f('0x1a')]||undefined,'CampaignId':_0x3d9c8b[_0x698f('0x68')]||undefined};};exports[_0x698f('0x69')]=function(_0x1669c5){if(_0x1669c5===_0x698f('0x4a')||_0x1669c5===_0x698f('0x6a')||_0x1669c5==='queue'||_0x1669c5===_0x698f('0x6b')||_0x1669c5==='campaigntype'||_0x1669c5==='dialAnswer'||_0x1669c5===_0x698f('0x6c')||_0x1669c5===_0x698f('0x48')||_0x1669c5===_0x698f('0x46')||_0x1669c5===_0x698f('0x52')||_0x1669c5===_0x698f('0x6d')||_0x1669c5==='scheduledat'||_0x1669c5===_0x698f('0x4b')||_0x1669c5===_0x698f('0x4c')||_0x1669c5==='countnoanswerretry'||_0x1669c5===_0x698f('0x6e')||_0x1669c5===_0x698f('0x6f')||_0x1669c5===_0x698f('0x70')||_0x1669c5==='callbackat'||_0x1669c5===_0x698f('0x71')||_0x1669c5==='ContactId'||_0x1669c5===_0x698f('0x54')||_0x1669c5===_0x698f('0x3f')||_0x1669c5===_0x698f('0x1a')||_0x1669c5===_0x698f('0x72')||_0x1669c5===_0x698f('0x73')||_0x1669c5===_0x698f('0x74')||_0x1669c5===_0x698f('0x75')||_0x1669c5===_0x698f('0x76')||_0x1669c5===_0x698f('0x77')||_0x1669c5===_0x698f('0x78')||_0x1669c5===_0x698f('0x79')||_0x1669c5===_0x698f('0x7a')||_0x1669c5===_0x698f('0x7b')||_0x1669c5===_0x698f('0x7c')||_0x1669c5==='xmd-cdrtype'||_0x1669c5===_0x698f('0x7d')||_0x1669c5===_0x698f('0x7e')||_0x1669c5===_0x698f('0x7f')||_0x1669c5===_0x698f('0x80')||_0x1669c5==='rtpaudioqosbridged'||_0x1669c5===_0x698f('0x81')||_0x1669c5==='rtpaudioqosjitterbridged'||_0x1669c5===_0x698f('0x82')||_0x1669c5===_0x698f('0x83')||_0x1669c5===_0x698f('0x84')||_0x1669c5===_0x698f('0x85')||_0x1669c5==='rtpaudioqos'||_0x1669c5===_0x698f('0x86')||_0x1669c5===_0x698f('0x81')||_0x1669c5===_0x698f('0x87')||_0x1669c5===_0x698f('0x82')||_0x1669c5===_0x698f('0x83')||_0x1669c5===_0x698f('0x84')||_0x1669c5==='rtpaudioqosrttbridged'||_0x1669c5===_0x698f('0x88')||_0x1669c5===_0x698f('0x89')||_0x1669c5===_0x698f('0x36')||_0x1669c5===_0x698f('0x3c')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5af81a,_0x1cef7b){var _0x361b52,_0x5e2f0f,_0x4e947c;if(_0x1cef7b<=0x0){_0x1cef7b=0x1;}_0x361b52=new RegExp(_0x698f('0x8a')+_0x1cef7b+'}$');_0x5e2f0f=Math[_0x698f('0x8b')](0xa,_0x1cef7b-0x1);_0x4e947c=Math['pow'](0xa,_0x1cef7b)-0x1;return util[_0x698f('0x13')]('%s',_[_0x698f('0x8c')](_0x5af81a,_0x361b52,_['random'](_0x5e2f0f,_0x4e947c)));};exports[_0x698f('0x8d')]=function(_0x4aa875){var _0x54d0c4=_0x4aa875[_0x698f('0x8e')](/"(.*?)"/);return _0x54d0c4?_0x54d0c4[0x1]:_0x4aa875;};exports[_0x698f('0x8f')]=function(_0x1edd4a){var _0x3e876e=_0x1edd4a[_0x698f('0x8e')](/<(.*?)>/);return _0x3e876e?_0x3e876e[0x1]:_0x1edd4a;}; \ No newline at end of file +var _0xd1d5=['xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','match','extractCalleridNumber','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','info','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','responsetime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','channelAgent','not_inuse','status','createBody','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd1d5,0x129));var _0x5d1d=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xd1d5[_0x187ee1];return _0x388160;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x5d1d('0x0'));var logger=require(_0x5d1d('0x1'))(_0x5d1d('0x2'));var ipAgi=process[_0x5d1d('0x3')][_0x5d1d('0x4')]||'127.0.0.1';function getSeconds(_0xe26b93,_0x4b21bc){var _0x2d81c4=moment(_0xe26b93)[_0x5d1d('0x5')](0x0);var _0x337ae0=moment(_0x4b21bc)[_0x5d1d('0x5')](0x0);return _0x2d81c4[_0x5d1d('0x6')](_0x337ae0,_0x5d1d('0x7'));}exports[_0x5d1d('0x8')]=function(_0x4679ec){return function(_0xb371c4){logger[_0x5d1d('0x9')](_0x4679ec,util[_0x5d1d('0xa')](_0xb371c4,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2a1794,_0x201e0d){logger[_0x5d1d('0xb')](_0x2a1794,util[_0x5d1d('0xa')](_0x201e0d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1125f3,_0x2b0197){logger[_0x5d1d('0x9')](_0x1125f3,util[_0x5d1d('0xa')](_0x2b0197,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x273461){return function(_0x4cc24b){logger['info'](_0x273461,util[_0x5d1d('0xa')](_0x4cc24b,{'showHidden':![],'depth':null}));};};exports[_0x5d1d('0xc')]=function(_0x6c8182,_0x45cfcb,_0x190169){return{'message':_0x6c8182,'unlock':_0x45cfcb,'active':_0x190169};};exports[_0x5d1d('0xd')]=function(_0x2bb110,_0x30ac7a,_0x4009f7){if(!_[_0x5d1d('0xe')](_0x4009f7)&&'string'===typeof _0x4009f7&&!_[_0x5d1d('0xf')](_0x4009f7)){if(!_['isUndefined'](_0x30ac7a)&&'string'===typeof _0x30ac7a&&!_[_0x5d1d('0xf')](_0x30ac7a)){return util[_0x5d1d('0x10')](_0x5d1d('0x11'),_0x30ac7a,_0x4009f7);}return util[_0x5d1d('0x10')]('\x22%s\x22\x20<%s>',_0x4009f7,_0x4009f7);}if(!_[_0x5d1d('0xe')](_0x2bb110)&&_0x5d1d('0x12')===typeof _0x2bb110&&!_['isEmpty'](_0x2bb110)){return _0x2bb110;}return _0x5d1d('0x13');};exports['isActive']=function(_0xbf7e66){if(_[_0x5d1d('0x14')](_0xbf7e66)){return![];}return _0xbf7e66;};exports[_0x5d1d('0x15')]=function(_0x347b71,_0x1d9d3c,_0x3b6d63,_0x25cf35,_0xe5252c,_0xe25723){var _0x33fc8a={'XMD-QUEUE':_0x1d9d3c[_0x5d1d('0x16')]?_0x1d9d3c[_0x5d1d('0x16')]['name']:'','XMD-CALLERID':_0x25cf35,'XMD-CALLERID-PREVIEW':_0xe25723?util['format']('\x22%s\x22\x20<%s>',_0xe25723[_0x5d1d('0x17')],_0xe25723[_0x5d1d('0x18')]):_0x25cf35,'XMD-DIALID':_0xe5252c,'XMD-CONTACTID':_0x1d9d3c[_0x5d1d('0x19')],'XMD-CDRTYPE':_0x5d1d('0x1a'),'CALLERID(all)':_0x25cf35,'XMD-VOICEQUEUEID':_0x1d9d3c[_0x5d1d('0x1b')],'XMD-DIALCHANNEL':_0x3b6d63,'XMD-DIALTIMEOUT':_0x347b71[_0x5d1d('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x5d1d('0x10')](_0x5d1d('0x1d'),_0x347b71[_0x5d1d('0x1e')]?'g':'',_[_0x5d1d('0xf')](_0x347b71[_0x5d1d('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x347b71[_0x5d1d('0x20')]||'','XMD-AGI':_0x347b71[_0x5d1d('0x21')]?util[_0x5d1d('0x10')](_0x5d1d('0x22'),ipAgi,_0x347b71[_0x5d1d('0x21')]):_0x5d1d('0x23'),'XMD-AGIAFTER':_0x347b71['dialQueueProject2']?util[_0x5d1d('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x347b71[_0x5d1d('0x1e')]):_0x5d1d('0x23'),'XMD-ORIGINATECALLERIDNUM':_0xe25723?_0xe25723[_0x5d1d('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0xe25723?_0xe25723[_0x5d1d('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x5d1d('0x26')};if(!_[_0x5d1d('0xf')](_0x347b71[_0x5d1d('0x1f')])){_0x33fc8a[util[_0x5d1d('0x10')]('%s',_0x5d1d('0x27'))]=_0x347b71[_0x5d1d('0x1f')];_0x33fc8a[util[_0x5d1d('0x10')]('%s',_0x5d1d('0x28'))]=_0xe5252c;}if(_0x1d9d3c&&_0x1d9d3c[_0x5d1d('0x29')]){for(var _0xd2155c in _0x1d9d3c['Contact']){if(_0x1d9d3c['Contact'][_0x5d1d('0x2a')](_0xd2155c)){if(!_[_0x5d1d('0x14')](_0x1d9d3c[_0x5d1d('0x29')][_0xd2155c])&&_0xd2155c!=='id'&&_0xd2155c!=='tags'&&_0xd2155c!=='createdAt'&&_0xd2155c!==_0x5d1d('0x2b')){_0x33fc8a[util[_0x5d1d('0x10')](_0x5d1d('0x2c'),_0x5d1d('0x2d'),_[_0x5d1d('0x2e')](_0xd2155c))]=_0x1d9d3c['Contact'][_0xd2155c];}}}}return _0x33fc8a;};exports[_0x5d1d('0x2f')]=function(_0x1b0e19){var _0x3e249c={};for(var _0x3bb580 in _0x1b0e19){if(_0x1b0e19[_0x5d1d('0x2a')](_0x3bb580)){_0x3e249c[util[_0x5d1d('0x10')]('%s',_[_0x5d1d('0x30')](_0x3bb580))]=_0x1b0e19[_0x3bb580];}}return{'variables':_0x3e249c};};exports[_0x5d1d('0x31')]=function(_0xcf9e42,_0x6b490d){if(!_['isNil'](_0xcf9e42)){if(_0xcf9e42[_0x5d1d('0x2a')]('originated')){if(_0xcf9e42['originated']>0x0){_0xcf9e42['originated']-=0x1;}else{logger[_0x5d1d('0x9')](_0x5d1d('0x32'),_0x6b490d);}}}else{logger[_0x5d1d('0x9')](_0x5d1d('0x33'),_0x6b490d);}};exports[_0x5d1d('0x34')]=function(_0x60fc91){var _0x5605cf=moment()['format'](_0x5d1d('0x35'));_0x60fc91[_0x5d1d('0x36')]=0xd;_0x60fc91[_0x5d1d('0x37')]=_0x5d1d('0x38');_0x60fc91['starttime']=_0x5605cf;_0x60fc91['responsetime']=_0x5605cf;_0x60fc91[_0x5d1d('0x39')]=_0x5605cf;};exports[_0x5d1d('0x3a')]=function(_0x3904fe,_0x3ebcdd,_0x5edbae){var _0x5c1ddf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3904fe[_0x5d1d('0x36')]=_0x3ebcdd;_0x3904fe[_0x5d1d('0x37')]=_0x5edbae;_0x3904fe[_0x5d1d('0x3b')]=_0x5c1ddf;_0x3904fe['ringtime']=getSeconds(_0x3904fe[_0x5d1d('0x3b')],_0x3904fe[_0x5d1d('0x3c')]);};exports[_0x5d1d('0x3d')]=function(_0x3ba3ca,_0x575532,_0x430098){_0x3ba3ca[_0x5d1d('0x3e')]=_0x575532;_0x3ba3ca[_0x5d1d('0x3f')]=_0x430098;};exports[_0x5d1d('0x40')]=function(_0x45f9d8,_0x29122c,_0x485c4d){var _0x5063ad=moment()[_0x5d1d('0x10')](_0x5d1d('0x35'));_0x45f9d8[_0x5d1d('0x36')]=_0x29122c;_0x45f9d8['statedesc']=_0x485c4d;_0x45f9d8[_0x5d1d('0x3b')]=_0x45f9d8[_0x5d1d('0x3b')]?_0x45f9d8[_0x5d1d('0x3b')]:_0x5063ad;_0x45f9d8[_0x5d1d('0x39')]=_0x45f9d8[_0x5d1d('0x39')]?_0x45f9d8[_0x5d1d('0x39')]:_0x5063ad;_0x45f9d8['ringtime']=getSeconds(_0x45f9d8[_0x5d1d('0x3b')]||0x0,_0x45f9d8[_0x5d1d('0x3c')]||0x0);_0x45f9d8[_0x5d1d('0x41')]=_0x45f9d8[_0x5d1d('0x42')]?getSeconds(_0x45f9d8[_0x5d1d('0x39')],_0x45f9d8[_0x5d1d('0x42')]):0x0;};exports[_0x5d1d('0x43')]=function(_0x4edd43){return _0x4edd43==='Failure';};exports['variablesAction']=function(_0x38ac5e,_0x2e4a0e,_0x2395e2,_0x3bb96a,_0x245fde){var _0x1aebd1=_0x3bb96a?_0x5d1d('0x44'):_0x38ac5e['calleridname'];_0x1aebd1=_0x245fde?_0x5d1d('0x45'):_0x1aebd1;return{'actionid':_0x38ac5e[_0x5d1d('0x46')],'action':'originate','channel':_0x38ac5e['channelAgent'],'callerid':util[_0x5d1d('0x10')](_0x5d1d('0x11'),_0x1aebd1,_0x38ac5e[_0x5d1d('0x18')]),'Exten':'xcally-motion-preview','Context':_0x5d1d('0x47'),'Priority':'1','variable':_0x2395e2,'timeout':(_0x2e4a0e[_0x5d1d('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x38ac5e['uniqueid']};};exports[_0x5d1d('0x49')]=function(_0x31e36c){return _0x31e36c[_0x5d1d('0x4a')]+_0x31e36c[_0x5d1d('0x4b')]+_0x31e36c['countnoanswerretry']+_0x31e36c[_0x5d1d('0x4c')]+_0x31e36c['countnosuchnumberretry'];};exports[_0x5d1d('0x4d')]=function(_0x1a95d3){var _0x24f437=_[_0x5d1d('0x4e')](_0x1a95d3);_0x24f437[_0x5d1d('0x36')]=0xf;_0x24f437['statedesc']=_0x5d1d('0x4f');return _0x24f437;};exports[_0x5d1d('0x50')]=function(_0x43305d,_0x1caa81,_0x17d3ab){var _0x59b73c={};_0x59b73c[_0x1caa81]=_0x43305d[_0x1caa81];_0x59b73c[_0x5d1d('0x51')]=![];_0x59b73c['scheduledat']=moment()[_0x5d1d('0x52')](_0x17d3ab,_0x5d1d('0x53'))[_0x5d1d('0x10')](_0x5d1d('0x35'));_0x59b73c[_0x5d1d('0x19')]=_0x43305d['ContactId'];_0x59b73c[_0x5d1d('0x54')]=_0x43305d[_0x5d1d('0x54')];_0x59b73c[_0x5d1d('0x1b')]=_0x43305d['VoiceQueueId']||undefined;return _0x59b73c;};exports[_0x5d1d('0x55')]=function(_0xebc16d,_0x31a64c){if(!_[_0x5d1d('0x14')](_0xebc16d)){if(_0xebc16d[_0x5d1d('0x56')]>0x0){_0xebc16d['pTalking']-=0x1;}else{logger[_0x5d1d('0x9')](_0x31a64c,_0x5d1d('0x57'));}}else{logger[_0x5d1d('0x9')](_0x31a64c,_0x5d1d('0x58'));}};exports[_0x5d1d('0x59')]=function(_0x428347){if(_0x428347<=0x0){return!![];}return![];};exports[_0x5d1d('0x5a')]=function(_0x1709b2,_0x1ed825,_0xe9cd45){_0x1709b2[_0x5d1d('0x5b')]=_0x1ed825;_0x1709b2['name']=_0x1709b2['queue'];_0x1709b2[_0x5d1d('0x5c')]=_0x1709b2['channelAgent'];_0x1709b2[_0x5d1d('0x5d')]=_0x5d1d('0x5e');if(_0xe9cd45){_0x1709b2[_0x5d1d('0x5f')]=_0xe9cd45[_0x5d1d('0x5f')];}return _0x1709b2;};exports[_0x5d1d('0x60')]=function(_0x1bd3b9){var _0x5a674a={};_0x5a674a[_0x5d1d('0x61')]=_0x1bd3b9[_0x5d1d('0x61')];_0x5a674a['interface']=_0x1bd3b9[_0x5d1d('0x62')];_0x5a674a[_0x5d1d('0x46')]=_0x1bd3b9['uniqueid'];return _0x5a674a;};exports['agentReadyId']=function(_0x37142a){var _0x5b9b4e=[];for(var _0x173e92 in _0x37142a){if(_0x37142a['hasOwnProperty'](_0x173e92)){if(!_[_0x5d1d('0x14')](_0x37142a[_0x173e92])&&_0x37142a[_0x173e92]['state']===_0x5d1d('0x63')&&_0x37142a[_0x173e92][_0x5d1d('0x64')]==='reachable'){_0x5b9b4e['push'](_0x37142a[_0x173e92]['id']);}}}return _0x5b9b4e;};exports['getDiff']=function(_0x481242){var _0x9308c9=moment()[_0x5d1d('0x5')](0x0);var _0x385244=moment(_0x481242)[_0x5d1d('0x5')](0x0);return _0x9308c9['diff'](_0x385244,_0x5d1d('0x7'));};exports[_0x5d1d('0x65')]=function(_0x22c729){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x22c729['ContactId'],'ListId':_0x22c729[_0x5d1d('0x54')],'VoiceQueueId':_0x22c729[_0x5d1d('0x1b')]||undefined,'CampaignId':_0x22c729[_0x5d1d('0x66')]||undefined};};exports[_0x5d1d('0x67')]=function(_0x5da188){if(_0x5da188===_0x5d1d('0x46')||_0x5da188===_0x5d1d('0x68')||_0x5da188===_0x5d1d('0x61')||_0x5da188===_0x5d1d('0x69')||_0x5da188===_0x5d1d('0x6a')||_0x5da188==='dialAnswer'||_0x5da188==='membername'||_0x5da188===_0x5d1d('0x62')||_0x5da188===_0x5d1d('0x17')||_0x5da188===_0x5d1d('0x51')||_0x5da188===_0x5d1d('0x18')||_0x5da188===_0x5d1d('0x6b')||_0x5da188===_0x5d1d('0x4a')||_0x5da188===_0x5d1d('0x4b')||_0x5da188===_0x5d1d('0x6c')||_0x5da188===_0x5d1d('0x6d')||_0x5da188===_0x5d1d('0x6e')||_0x5da188===_0x5d1d('0x6f')||_0x5da188==='callbackat'||_0x5da188===_0x5d1d('0x70')||_0x5da188===_0x5d1d('0x19')||_0x5da188===_0x5d1d('0x54')||_0x5da188===_0x5d1d('0x3f')||_0x5da188===_0x5d1d('0x1b')||_0x5da188===_0x5d1d('0x71')||_0x5da188===_0x5d1d('0x72')||_0x5da188===_0x5d1d('0x73')||_0x5da188===_0x5d1d('0x74')||_0x5da188===_0x5d1d('0x75')||_0x5da188==='xmd-dialurl'||_0x5da188===_0x5d1d('0x76')||_0x5da188===_0x5d1d('0x77')||_0x5da188==='xmd-dialid'||_0x5da188===_0x5d1d('0x78')||_0x5da188===_0x5d1d('0x79')||_0x5da188===_0x5d1d('0x7a')||_0x5da188===_0x5d1d('0x7b')||_0x5da188==='xmd-agiafter'||_0x5da188==='xmd-agi'||_0x5da188===_0x5d1d('0x7c')||_0x5da188===_0x5d1d('0x7d')||_0x5da188===_0x5d1d('0x7e')||_0x5da188===_0x5d1d('0x7f')||_0x5da188===_0x5d1d('0x80')||_0x5da188===_0x5d1d('0x81')||_0x5da188===_0x5d1d('0x82')||_0x5da188===_0x5d1d('0x83')||_0x5da188===_0x5d1d('0x7c')||_0x5da188===_0x5d1d('0x7d')||_0x5da188===_0x5d1d('0x7e')||_0x5da188===_0x5d1d('0x7f')||_0x5da188==='rtpaudioqosloss'||_0x5da188===_0x5d1d('0x81')||_0x5da188===_0x5d1d('0x82')||_0x5da188===_0x5d1d('0x83')||_0x5da188===_0x5d1d('0x84')||_0x5da188==='bridgepvtcallid'||_0x5da188===_0x5d1d('0x36')||_0x5da188===_0x5d1d('0x37')){return![];}return!![];};exports[_0x5d1d('0x85')]=function(_0x47e208,_0xd9e252){var _0x47b848,_0x427c74,_0x5f35c4;if(_0xd9e252<=0x0){_0xd9e252=0x1;}_0x47b848=new RegExp(_0x5d1d('0x86')+_0xd9e252+'}$');_0x427c74=Math['pow'](0xa,_0xd9e252-0x1);_0x5f35c4=Math[_0x5d1d('0x87')](0xa,_0xd9e252)-0x1;return util['format']('%s',_['replace'](_0x47e208,_0x47b848,_['random'](_0x427c74,_0x5f35c4)));};exports['extractCalleridName']=function(_0x1162d4){var _0x44f40d=_0x1162d4[_0x5d1d('0x88')](/"(.*?)"/);return _0x44f40d?_0x44f40d[0x1]:_0x1162d4;};exports[_0x5d1d('0x89')]=function(_0x25588d){var _0x184757=_0x25588d['match'](/<(.*?)>/);return _0x184757?_0x184757[0x1]:_0x25588d;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e33b131..a1be26f 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 _0x5e6b=['boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0xfba05f,_0x56a358){var _0x5efd6b=function(_0x449c61){while(--_0x449c61){_0xfba05f['push'](_0xfba05f['shift']());}};_0x5efd6b(++_0x56a358);}(_0x5e6b,0x73));var _0xb5e6=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x5e6b[_0x585d81];return _0x1aca0d;};'use strict';exports[_0xb5e6('0x0')]={'queue':{'type':_0xb5e6('0x1'),'required':!![]},'interface':{'type':_0xb5e6('0x1'),'required':!![]},'membername':{'type':_0xb5e6('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xb5e6('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xb5e6('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xb5e6('0x3')]={'interface':{'type':_0xb5e6('0x1'),'required':!![]},'paused':{'type':_0xb5e6('0x2')},'reason':{'type':_0xb5e6('0x1'),'required':![]}};exports[_0xb5e6('0x4')]={'module':{'type':_0xb5e6('0x1'),'required':![]}};exports[_0xb5e6('0x5')]={'uniqueid':{'type':_0xb5e6('0x1'),'required':!![]}};exports[_0xb5e6('0x6')]={'uniqueid':{'type':_0xb5e6('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xb5e6('0x1')},'mixmonitorid':{'type':_0xb5e6('0x1')}};exports[_0xb5e6('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xb5e6('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xb5e6('0x1'),'required':!![]},'context':{'type':_0xb5e6('0x1')}}; \ No newline at end of file +var _0xb896=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean'];(function(_0x4c9b3a,_0x3b31a8){var _0x3a1124=function(_0x1bcf1c){while(--_0x1bcf1c){_0x4c9b3a['push'](_0x4c9b3a['shift']());}};_0x3a1124(++_0x3b31a8);}(_0xb896,0x1a3));var _0x6b89=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0xb896[_0x5a5395];return _0x4da43d;};'use strict';exports[_0x6b89('0x0')]={'queue':{'type':_0x6b89('0x1'),'required':!![]},'interface':{'type':_0x6b89('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6b89('0x2'),'required':![]},'paused':{'type':_0x6b89('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x6b89('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x6b89('0x4')]={'interface':{'type':_0x6b89('0x1'),'required':!![]},'paused':{'type':_0x6b89('0x3')},'reason':{'type':_0x6b89('0x1'),'required':![]}};exports[_0x6b89('0x5')]={'module':{'type':_0x6b89('0x1'),'required':![]}};exports[_0x6b89('0x6')]={'uniqueid':{'type':_0x6b89('0x1'),'required':!![]}};exports[_0x6b89('0x7')]={'uniqueid':{'type':_0x6b89('0x1'),'required':!![]},'filename':{'type':_0x6b89('0x1')},'format':{'type':_0x6b89('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x6b89('0x8')]={'uniqueid':{'type':_0x6b89('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x6b89('0x1'),'required':!![]},'exten':{'type':_0x6b89('0x1'),'required':!![]},'context':{'type':_0x6b89('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 29ed3ce..ec6b27b 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 _0x9b3d=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty'];(function(_0x5a0bab,_0x168def){var _0x32b15a=function(_0x52f391){while(--_0x52f391){_0x5a0bab['push'](_0x5a0bab['shift']());}};_0x32b15a(++_0x168def);}(_0x9b3d,0xa9));var _0xd9b3=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0x9b3d[_0x4a7e98];return _0x27d10d;};'use strict';var BPromise=require(_0xd9b3('0x0'));var util=require(_0xd9b3('0x1'));var _=require(_0xd9b3('0x2'));var moment=require('moment');var Agent=require(_0xd9b3('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xd9b3('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xd9b3('0x5'));var Campaign=require(_0xd9b3('0x6'));var VoiceExtension=require(_0xd9b3('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xd9b3('0x8'));var FreshdeskAccount=require(_0xd9b3('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xd9b3('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xd9b3('0xb'));var FreshsalesAccount=require(_0xd9b3('0xc'));var FaxAccount=require(_0xd9b3('0xd'));var Realtime=function(){this[_0xd9b3('0xe')]={};this[_0xd9b3('0xf')]={};this[_0xd9b3('0x10')]={};this[_0xd9b3('0x11')]={};this[_0xd9b3('0x12')]={};this[_0xd9b3('0x13')]={};this[_0xd9b3('0x14')]={};this[_0xd9b3('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xd9b3('0x16')]={};this[_0xd9b3('0x17')]={};this[_0xd9b3('0x18')]={};this[_0xd9b3('0x19')]={};this[_0xd9b3('0x1a')]={};this[_0xd9b3('0x1b')]={};this[_0xd9b3('0x1c')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xd9b3('0x1d')]={};this[_0xd9b3('0x1e')]={};this['vtigerAccounts']={};this[_0xd9b3('0x1f')]={};this['dynamics365Accounts']={};this[_0xd9b3('0x20')]={};this[_0xd9b3('0x21')]={};};function freeIsNotKey(_0x6b1dbd,_0x250f12,_0x47d1be){var _0x1f9023=_[_0xd9b3('0x22')](_0x6b1dbd,function(_0x23b05b,_0x6bd82c){return _0x23b05b[_0x47d1be];});for(var _0x643d3c in _0x250f12){if(_0x250f12[_0xd9b3('0x23')](_0x643d3c)){if(!_0x1f9023[_0x643d3c]){delete _0x250f12[_0x643d3c];}}}}function freeIsNotKeySip(_0x1f8f74,_0x42281f){var _0x143edc=_['mapKeys'](_0x1f8f74,function(_0x344bb8,_0x86917f){return util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x344bb8['name']);});for(var _0x5e8e71 in _0x42281f){if(_0x42281f['hasOwnProperty'](_0x5e8e71)){if(!_0x143edc[_0x5e8e71]){delete _0x42281f[_0x5e8e71];}}}}function freeIsNotKeyAgent(_0x33b04f,_0x1a69d6){var _0x2a312b=_[_0xd9b3('0x22')](_0x33b04f,function(_0x1a7329,_0x466d0d){var _0xcaa886=_[_0xd9b3('0x26')](_0x1a7329[_0xd9b3('0x27')])?util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x1a7329[_0xd9b3('0x28')]):_0x1a7329['interface'];return _0xcaa886;});for(var _0x24aa53 in _0x1a69d6){if(_0x1a69d6['hasOwnProperty'](_0x24aa53)){if(!_0x2a312b[_0x24aa53]){delete _0x1a69d6[_0x24aa53];}}}}function clearVoiceCallReports(_0x4cfe93){_0x4cfe93[_0xd9b3('0x29')]=0x0;_0x4cfe93[_0xd9b3('0x2a')]=0x0;_0x4cfe93[_0xd9b3('0x2b')]=0x0;_0x4cfe93[_0xd9b3('0x2c')]=0x0;_0x4cfe93[_0xd9b3('0x2d')]=0x0;}function clearCampaigns(_0x5d40b9){if(!_[_0xd9b3('0x2e')](_0x5d40b9)){for(var _0x20206b in _0x5d40b9){if(_0x5d40b9[_0xd9b3('0x23')](_0x20206b)){_0x5d40b9[_0x20206b][_0xd9b3('0x2f')]=0x0;_0x5d40b9[_0x20206b][_0xd9b3('0x30')]=0x0;}}}}function clearVoiceQueues(_0x33cd1c){if(!_[_0xd9b3('0x2e')](_0x33cd1c)){for(var _0x10d4f2 in _0x33cd1c){if(_0x33cd1c[_0xd9b3('0x23')](_0x10d4f2)){_0x33cd1c[_0x10d4f2]['total']=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x2a')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x31')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x32')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x2b')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x2c')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x2d')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x33')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x34')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x35')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x36')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x37')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x38')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x39')]=0x0;_0x33cd1c[_0x10d4f2]['outboundDropCallsDayCallersExit']=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3a')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3b')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3c')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3d')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x33')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3e')]=0x0;_0x33cd1c[_0x10d4f2][_0xd9b3('0x3f')]=!![];}}}}Realtime['prototype'][_0xd9b3('0x40')]=function(_0x4d8f7d,_0x137a73){for(var _0x4430a5 in _0x137a73){if(_0x4d8f7d[_0xd9b3('0x23')](_0x4430a5)){_0x4d8f7d[_0x4430a5]=_0x137a73[_0x4430a5];}}};Realtime[_0xd9b3('0x41')][_0xd9b3('0x42')]=function(){var _0x35b3c9=this;return function(_0x1ba686){if(_0x1ba686){freeIsNotKeyAgent(_0x1ba686,_0x35b3c9[_0xd9b3('0xe')]);for(var _0x27abec=0x0,_0x4ca313={},_0x5bf94c={};_0x27abec<_0x1ba686[_0xd9b3('0x43')];_0x27abec+=0x1){_0x4ca313=_0x1ba686[_0x27abec];var _0xf0813c=_['isNil'](_0x4ca313[_0xd9b3('0x27')])?util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x4ca313['name']):_0x4ca313[_0xd9b3('0x27')];if(_[_0xd9b3('0x44')](_0x35b3c9[_0xd9b3('0xe')][_0xf0813c])){_0x35b3c9['agents'][_0xf0813c]=new Agent(_0x4ca313);}else{_0x35b3c9[_0xd9b3('0x40')](_0x35b3c9[_0xd9b3('0xe')][_0xf0813c],_0x4ca313);}}}return _0x35b3c9[_0xd9b3('0xe')];};};Realtime['prototype'][_0xd9b3('0x45')]=function(){var _0x3af5cc=this;return function(_0xb5c87f){if(_0xb5c87f){freeIsNotKeySip(_0xb5c87f,_0x3af5cc[_0xd9b3('0xf')]);for(var _0x413c81=0x0,_0x2778f0={},_0x40a89f={};_0x413c81<_0xb5c87f['length'];_0x413c81+=0x1){_0x2778f0=_0xb5c87f[_0x413c81];if(_['isUndefined'](_0x3af5cc[_0xd9b3('0xf')][util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x2778f0[_0xd9b3('0x28')])])){_0x3af5cc[_0xd9b3('0xf')][util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x2778f0[_0xd9b3('0x28')])]=new Telephone(_0x2778f0);}else{_0x3af5cc[_0xd9b3('0x40')](_0x3af5cc[_0xd9b3('0xf')][util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x2778f0[_0xd9b3('0x28')])],_0x2778f0);}}}return _0x3af5cc['telephones'];};};Realtime['prototype']['initTrunks']=function(){var _0x4542e0=this;return function(_0x1673df){if(_0x1673df){freeIsNotKeySip(_0x1673df,_0x4542e0[_0xd9b3('0x10')]);for(var _0x3876bf=0x0,_0x2faf99={},_0x41c0dd={};_0x3876bf<_0x1673df['length'];_0x3876bf+=0x1){_0x2faf99=_0x1673df[_0x3876bf];if(_[_0xd9b3('0x44')](_0x4542e0[_0xd9b3('0x10')][util[_0xd9b3('0x24')]('SIP/%s',_0x2faf99[_0xd9b3('0x28')])])){_0x4542e0[_0xd9b3('0x10')][util[_0xd9b3('0x24')]('SIP/%s',_0x2faf99[_0xd9b3('0x28')])]=new Trunk(_0x2faf99);}else{_0x4542e0[_0xd9b3('0x40')](_0x4542e0['trunks'][util[_0xd9b3('0x24')](_0xd9b3('0x25'),_0x2faf99[_0xd9b3('0x28')])],_0x2faf99);}}}return _0x4542e0[_0xd9b3('0x10')];};};Realtime['prototype'][_0xd9b3('0x46')]=function(){var _0x11e51e=this;return function(_0x485c93){if(_0x485c93){freeIsNotKey(_0x485c93,_0x11e51e[_0xd9b3('0x11')],'name');for(var _0x201912=0x0,_0x531382={},_0x514365={};_0x201912<_0x485c93[_0xd9b3('0x43')];_0x201912+=0x1){_0x531382=_0x485c93[_0x201912];if(_[_0xd9b3('0x44')](_0x11e51e[_0xd9b3('0x11')][_0x531382['name']])){_0x11e51e['voiceQueues'][_0x531382[_0xd9b3('0x28')]]=new VoiceQueue(_0x531382);}else{_0x11e51e[_0xd9b3('0x40')](_0x11e51e['voiceQueues'][_0x531382[_0xd9b3('0x28')]],_0x531382);}}}return _0x11e51e[_0xd9b3('0x11')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x47')]=function(){var _0x1e5a67=this;return function(_0x365624){if(_0x365624){freeIsNotKey(_0x365624,_0x1e5a67[_0xd9b3('0x12')],'id');for(var _0x320829=0x0,_0x2948e5={},_0x548078={};_0x320829<_0x365624[_0xd9b3('0x43')];_0x320829+=0x1){_0x2948e5=_0x365624[_0x320829];if(_[_0xd9b3('0x44')](_0x1e5a67[_0xd9b3('0x12')][_0x2948e5['id']])){_0x1e5a67[_0xd9b3('0x12')][_0x2948e5['id']]=new Trigger(_0x2948e5);}else{_0x1e5a67['mergeFromDatabase'](_0x1e5a67['triggers'][_0x2948e5['id']],_0x2948e5);}}}return _0x1e5a67[_0xd9b3('0x12')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x48')]=function(){var _0x510709=this;return function(_0x49dc64){if(_0x49dc64){freeIsNotKey(_0x49dc64,_0x510709[_0xd9b3('0x14')],'id');for(var _0x1c7573=0x0,_0x4ddec9={},_0x122272={};_0x1c7573<_0x49dc64[_0xd9b3('0x43')];_0x1c7573+=0x1){_0x4ddec9=_0x49dc64[_0x1c7573];if(_[_0xd9b3('0x44')](_0x510709[_0xd9b3('0x14')][_0x4ddec9['id']])){_0x510709[_0xd9b3('0x14')][_0x4ddec9['id']]=new Template(_0x4ddec9);}else{_0x510709[_0xd9b3('0x40')](_0x510709['templates'][_0x4ddec9['id']],_0x4ddec9);}}}return _0x510709[_0xd9b3('0x14')];};};Realtime['prototype'][_0xd9b3('0x49')]=function(){var _0x5672ca=this;return function(_0x32410d){if(_0x32410d){freeIsNotKey(_0x32410d,_0x5672ca[_0xd9b3('0x1b')],'id');for(var _0x52aa30=0x0,_0x32fed8={},_0x15b977={};_0x52aa30<_0x32410d[_0xd9b3('0x43')];_0x52aa30+=0x1){_0x32fed8=_0x32410d[_0x52aa30];if(_[_0xd9b3('0x44')](_0x5672ca[_0xd9b3('0x1b')][_0x32fed8['id']])){_0x5672ca[_0xd9b3('0x1b')][_0x32fed8['id']]=new ZendeskAccount(_0x32fed8);}else{_0x5672ca[_0xd9b3('0x40')](_0x5672ca[_0xd9b3('0x1b')][_0x32fed8['id']],_0x32fed8);}}}return _0x5672ca[_0xd9b3('0x1b')];};};Realtime['prototype'][_0xd9b3('0x4a')]=function(){var _0xbcce13=this;return function(_0x3d5918){if(_0x3d5918){freeIsNotKey(_0x3d5918,_0xbcce13[_0xd9b3('0x1c')],'id');for(var _0x272d01=0x0,_0x5f3542={},_0x5f4a61={};_0x272d01<_0x3d5918['length'];_0x272d01+=0x1){_0x5f3542=_0x3d5918[_0x272d01];if(_['isUndefined'](_0xbcce13['salesforceAccounts'][_0x5f3542['id']])){_0xbcce13[_0xd9b3('0x1c')][_0x5f3542['id']]=new SalesforceAccount(_0x5f3542);}else{_0xbcce13['mergeFromDatabase'](_0xbcce13['salesforceAccounts'][_0x5f3542['id']],_0x5f3542);}}}return _0xbcce13[_0xd9b3('0x1c')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x4b')]=function(){var _0x30b989=this;return function(_0x2efd3e){if(_0x2efd3e){freeIsNotKey(_0x2efd3e,_0x30b989[_0xd9b3('0x4c')],'id');for(var _0x52f2bc=0x0,_0x51162e={},_0x1492af={};_0x52f2bc<_0x2efd3e[_0xd9b3('0x43')];_0x52f2bc+=0x1){_0x51162e=_0x2efd3e[_0x52f2bc];if(_[_0xd9b3('0x44')](_0x30b989[_0xd9b3('0x4c')][_0x51162e['id']])){_0x30b989['freshdeskAccounts'][_0x51162e['id']]=new FreshdeskAccount(_0x51162e);}else{_0x30b989[_0xd9b3('0x40')](_0x30b989[_0xd9b3('0x4c')][_0x51162e['id']],_0x51162e);}}}return _0x30b989[_0xd9b3('0x4c')];};};Realtime[_0xd9b3('0x41')]['initZohoAccounts']=function(){var _0xdbbfc4=this;return function(_0x1c9459){if(_0x1c9459){freeIsNotKey(_0x1c9459,_0xdbbfc4[_0xd9b3('0x1d')],'id');for(var _0x449a5d=0x0,_0x1a183b={},_0x8cc456={};_0x449a5d<_0x1c9459['length'];_0x449a5d+=0x1){_0x1a183b=_0x1c9459[_0x449a5d];if(_[_0xd9b3('0x44')](_0xdbbfc4[_0xd9b3('0x1d')][_0x1a183b['id']])){_0xdbbfc4[_0xd9b3('0x1d')][_0x1a183b['id']]=new ZohoAccount(_0x1a183b);}else{_0xdbbfc4[_0xd9b3('0x40')](_0xdbbfc4[_0xd9b3('0x1d')][_0x1a183b['id']],_0x1a183b);}}}return _0xdbbfc4[_0xd9b3('0x1d')];};};Realtime['prototype'][_0xd9b3('0x4d')]=function(){var _0x4123db=this;return function(_0x2db924){if(_0x2db924){freeIsNotKey(_0x2db924,_0x4123db[_0xd9b3('0x1e')],'id');for(var _0x4e2890=0x0,_0x5bab91={},_0x4ae268={};_0x4e2890<_0x2db924['length'];_0x4e2890+=0x1){_0x5bab91=_0x2db924[_0x4e2890];if(_['isUndefined'](_0x4123db[_0xd9b3('0x1e')][_0x5bab91['id']])){_0x4123db[_0xd9b3('0x1e')][_0x5bab91['id']]=new DeskAccount(_0x5bab91);}else{_0x4123db[_0xd9b3('0x40')](_0x4123db['deskAccounts'][_0x5bab91['id']],_0x5bab91);}}}return _0x4123db[_0xd9b3('0x1e')];};};Realtime['prototype'][_0xd9b3('0x4e')]=function(){var _0x2a60a3=this;return function(_0x2e0a6f){if(_0x2e0a6f){freeIsNotKey(_0x2e0a6f,_0x2a60a3[_0xd9b3('0x4f')],'id');for(var _0x4ce2c2=0x0,_0x2ee188={},_0x4edbb9={};_0x4ce2c2<_0x2e0a6f[_0xd9b3('0x43')];_0x4ce2c2+=0x1){_0x2ee188=_0x2e0a6f[_0x4ce2c2];if(_[_0xd9b3('0x44')](_0x2a60a3[_0xd9b3('0x4f')][_0x2ee188['id']])){_0x2a60a3[_0xd9b3('0x4f')][_0x2ee188['id']]=new SugarcrmAccount(_0x2ee188);}else{_0x2a60a3['mergeFromDatabase'](_0x2a60a3['sugarcrmAccounts'][_0x2ee188['id']],_0x2ee188);}}}return _0x2a60a3[_0xd9b3('0x4f')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x50')]=function(){var _0x241534=this;return function(_0x1dba72){if(_0x1dba72){freeIsNotKey(_0x1dba72,_0x241534['vtigerAccounts'],'id');for(var _0x7dc53e=0x0,_0x4e5bc9={},_0x28fc74={};_0x7dc53e<_0x1dba72[_0xd9b3('0x43')];_0x7dc53e+=0x1){_0x4e5bc9=_0x1dba72[_0x7dc53e];if(_[_0xd9b3('0x44')](_0x241534[_0xd9b3('0x51')][_0x4e5bc9['id']])){_0x241534['vtigerAccounts'][_0x4e5bc9['id']]=new VtigerAccount(_0x4e5bc9);}else{_0x241534[_0xd9b3('0x40')](_0x241534[_0xd9b3('0x51')][_0x4e5bc9['id']],_0x4e5bc9);}}}return _0x241534['vtigerAccounts'];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x52')]=function(){var _0x499a14=this;return function(_0x3601ac){if(_0x3601ac){freeIsNotKey(_0x3601ac,_0x499a14[_0xd9b3('0x1f')],'id');for(var _0x2e1d8c=0x0,_0x32e70d={},_0x5f02f9={};_0x2e1d8c<_0x3601ac['length'];_0x2e1d8c+=0x1){_0x32e70d=_0x3601ac[_0x2e1d8c];if(_[_0xd9b3('0x44')](_0x499a14[_0xd9b3('0x1f')][_0x32e70d['id']])){_0x499a14[_0xd9b3('0x1f')][_0x32e70d['id']]=new ServicenowAccount(_0x32e70d);}else{_0x499a14[_0xd9b3('0x40')](_0x499a14['servicenowAccounts'][_0x32e70d['id']],_0x32e70d);}}}return _0x499a14[_0xd9b3('0x1f')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x53')]=function(){var _0x11b059=this;return function(_0x303687){if(_0x303687){freeIsNotKey(_0x303687,_0x11b059[_0xd9b3('0x54')],'id');for(var _0x2c0b6b=0x0,_0x25d26f={},_0x578eac={};_0x2c0b6b<_0x303687[_0xd9b3('0x43')];_0x2c0b6b+=0x1){_0x25d26f=_0x303687[_0x2c0b6b];if(_['isUndefined'](_0x11b059[_0xd9b3('0x54')][_0x25d26f['id']])){_0x11b059[_0xd9b3('0x54')][_0x25d26f['id']]=new Dynamics365Account(_0x25d26f);}else{_0x11b059['mergeFromDatabase'](_0x11b059[_0xd9b3('0x54')][_0x25d26f['id']],_0x25d26f);}}}return _0x11b059[_0xd9b3('0x54')];};};Realtime[_0xd9b3('0x41')]['initFreshsalesAccounts']=function(){var _0x21c6f2=this;return function(_0x4976ca){if(_0x4976ca){freeIsNotKey(_0x4976ca,_0x21c6f2[_0xd9b3('0x20')],'id');for(var _0x5eae89=0x0,_0x3397a3={},_0x3ea44c={};_0x5eae89<_0x4976ca[_0xd9b3('0x43')];_0x5eae89+=0x1){_0x3397a3=_0x4976ca[_0x5eae89];if(_[_0xd9b3('0x44')](_0x21c6f2['freshsalesAccounts'][_0x3397a3['id']])){_0x21c6f2[_0xd9b3('0x20')][_0x3397a3['id']]=new FreshsalesAccount(_0x3397a3);}else{_0x21c6f2[_0xd9b3('0x40')](_0x21c6f2['freshsalesAccounts'][_0x3397a3['id']],_0x3397a3);}}}return _0x21c6f2[_0xd9b3('0x20')];};};Realtime['prototype'][_0xd9b3('0x55')]=function(){var _0x29ab6f=this;return function(_0x204daf){for(var _0x1e0537=0x0;_0x1e0537<_0x204daf[_0xd9b3('0x43')];_0x1e0537+=0x1){_[_0xd9b3('0x56')](_0x29ab6f[_0xd9b3('0x11')][_0x204daf[_0x1e0537][_0xd9b3('0x28')]],_0x204daf[_0x1e0537]);}return _0x29ab6f[_0xd9b3('0x11')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x57')]=function(){var _0x7b3776=this;return function(_0x82a07d){clearVoiceQueues(_0x7b3776[_0xd9b3('0x11')]);if(_0x82a07d){_0x82a07d=_['groupBy'](_0x82a07d,_0xd9b3('0x58'));for(var _0x16f6dd in _0x82a07d){if(_0x82a07d[_0xd9b3('0x23')](_0x16f6dd)){var _0x1e81cd={};for(var _0x46a4db=0x0;_0x46a4db<_0x82a07d[_0x16f6dd][_0xd9b3('0x43')];_0x46a4db+=0x1){var _0x56eb31=_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x59')];if(_0x7b3776[_0xd9b3('0x11')][_0x56eb31]){if(_0x82a07d[_0x16f6dd][_0x46a4db]['queuecallerexit']){_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x31')]+=0x1;}if(_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5a')]){_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x32')]+=0x1;}_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x2b')]+=moment(_0x82a07d[_0x16f6dd][_0x46a4db]['queuecallerleaveAt'])[_0xd9b3('0x5b')](moment(_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5c')]),_0xd9b3('0x5d'))||0x0;if(_0x46a4db===_0x82a07d[_0x16f6dd][_0xd9b3('0x43')]-0x1){_0x7b3776['voiceQueues'][_0x56eb31]['sumDuration']+=moment(_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5e')]||_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5f')]||_0x82a07d[_0x16f6dd][_0x46a4db]['queuecallerexitAt'])[_0xd9b3('0x5b')](moment(_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5c')]),_0xd9b3('0x5d'))||0x0;_0x7b3776['voiceQueues'][_0x56eb31][_0xd9b3('0x29')]+=0x1;if(_0x82a07d[_0x16f6dd][_0x46a4db]['queuecallercomplete']){_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x2a')]+=0x1;_0x7b3776['voiceQueues'][_0x56eb31][_0xd9b3('0x2d')]+=moment(_0x82a07d[_0x16f6dd][_0x46a4db][_0xd9b3('0x5e')])['diff'](moment(_0x82a07d[_0x16f6dd][_0x46a4db]['queuecallerleaveAt']),_0xd9b3('0x5d'))||0x0;}}else{_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x2c')]+=_0x7b3776[_0xd9b3('0x11')][_0x56eb31][_0xd9b3('0x2b')]||0x0;}}}}}}return _0x7b3776[_0xd9b3('0x11')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x60')]=function(){var _0x4f261d=this;return function(_0x2926a8){clearVoiceCallReports(_0x4f261d[_0xd9b3('0x15')]);if(_0x2926a8){for(var _0x3eec73=0x0;_0x3eec73<_0x2926a8['length'];_0x3eec73+=0x1){_0x4f261d[_0xd9b3('0x15')]['total']+=0x1;_0x4f261d['outbound'][_0xd9b3('0x2c')]+=_0x2926a8[_0x3eec73][_0xd9b3('0x61')];if(_0x2926a8[_0x3eec73]['disposition']===_0xd9b3('0x62')){_0x4f261d[_0xd9b3('0x15')][_0xd9b3('0x2a')]+=0x1;_0x4f261d[_0xd9b3('0x15')][_0xd9b3('0x2b')]+=_0x2926a8[_0x3eec73]['duration']-_0x2926a8[_0x3eec73]['billableseconds']||0x0;_0x4f261d[_0xd9b3('0x15')][_0xd9b3('0x2d')]+=_0x2926a8[_0x3eec73][_0xd9b3('0x63')];}}}return _0x4f261d[_0xd9b3('0x15')];};};Realtime['prototype'][_0xd9b3('0x64')]=function(){var _0x604533=this;return function(_0xab6fbf){if(_0xab6fbf){freeIsNotKey(_0xab6fbf,_0x604533[_0xd9b3('0x13')],_0xd9b3('0x28'));for(var _0x43aa13=0x0,_0x254dd9={};_0x43aa13<_0xab6fbf[_0xd9b3('0x43')];_0x43aa13+=0x1){_0x254dd9=_0xab6fbf[_0x43aa13];if(_[_0xd9b3('0x44')](_0x604533[_0xd9b3('0x13')][_0x254dd9[_0xd9b3('0x28')]])){_0x604533[_0xd9b3('0x13')][_0x254dd9[_0xd9b3('0x28')]]=new Campaign(_0x254dd9);}else{_0x604533[_0xd9b3('0x40')](_0x604533[_0xd9b3('0x13')][_0x254dd9['name']],_0x254dd9);_0x604533[_0xd9b3('0x13')][_0x254dd9[_0xd9b3('0x28')]][_0xd9b3('0x65')]=_0x254dd9[_0xd9b3('0x66')]?_0x254dd9[_0xd9b3('0x66')][_0xd9b3('0x28')]:undefined;}}}return _0x604533[_0xd9b3('0x13')];};};Realtime['prototype'][_0xd9b3('0x67')]=function(){var _0x26b8b4=this;return function(_0x3d848b){if(_0x3d848b){freeIsNotKey(_0x3d848b,_0x26b8b4[_0xd9b3('0x68')],'id');for(var _0x4ea289=0x0,_0x11a002={};_0x4ea289<_0x3d848b['length'];_0x4ea289+=0x1){_0x11a002=_0x3d848b[_0x4ea289];if(_['isUndefined'](_0x26b8b4[_0xd9b3('0x68')][_0x11a002['id']])){_0x26b8b4['voiceExtensions'][_0x11a002['id']]=new VoiceExtension(_0x11a002);}else{_0x26b8b4[_0xd9b3('0x40')](_0x26b8b4['voiceExtensions'][_0x11a002['id']],_0x11a002);}}}return _0x26b8b4[_0xd9b3('0x68')];};};Realtime['prototype'][_0xd9b3('0x69')]=function(){var _0x7ece3a=this;return function(_0x2ff38b){clearCampaigns(_0x7ece3a[_0xd9b3('0x13')]);for(var _0x1699a1=0x0;_0x1699a1<_0x2ff38b[_0xd9b3('0x43')];_0x1699a1+=0x1){_[_0xd9b3('0x56')](_0x7ece3a[_0xd9b3('0x13')][_0x2ff38b[_0x1699a1][_0xd9b3('0x28')]],_0x2ff38b[_0x1699a1]);}return _0x7ece3a[_0xd9b3('0x13')];};};Realtime[_0xd9b3('0x41')][_0xd9b3('0x6a')]=function(){var _0x3081fc=this;return function(_0x44dcb7){if(_0x44dcb7){freeIsNotKey(_0x44dcb7,_0x3081fc[_0xd9b3('0x21')],'id');for(var _0x3744f3=0x0,_0x2a4588={},_0x397572={};_0x3744f3<_0x44dcb7[_0xd9b3('0x43')];_0x3744f3+=0x1){_0x2a4588=_0x44dcb7[_0x3744f3];if(_[_0xd9b3('0x44')](_0x3081fc[_0xd9b3('0x21')][_0x2a4588['id']])){_0x3081fc[_0xd9b3('0x21')][_0x2a4588['id']]=new FaxAccount(_0x2a4588);}else{_0x3081fc[_0xd9b3('0x40')](_0x3081fc[_0xd9b3('0x21')][_0x2a4588['id']],_0x2a4588);}}}return _0x3081fc[_0xd9b3('0x21')];};};module[_0xd9b3('0x6b')]=Realtime; \ No newline at end of file +var _0x6c4e=['../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','prototype','initAgents','isUndefined','mergeFromDatabase','initTelephones','telephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount'];(function(_0x400160,_0x12e14c){var _0x5443b9=function(_0x1a56ea){while(--_0x1a56ea){_0x400160['push'](_0x400160['shift']());}};_0x5443b9(++_0x12e14c);}(_0x6c4e,0x130));var _0xe6c4=function(_0x17c8b5,_0x21d1ab){_0x17c8b5=_0x17c8b5-0x0;var _0x8ada7b=_0x6c4e[_0x17c8b5];return _0x8ada7b;};'use strict';var BPromise=require(_0xe6c4('0x0'));var util=require(_0xe6c4('0x1'));var _=require(_0xe6c4('0x2'));var moment=require(_0xe6c4('0x3'));var Agent=require(_0xe6c4('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0xe6c4('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xe6c4('0x6'));var Template=require(_0xe6c4('0x7'));var Campaign=require(_0xe6c4('0x8'));var VoiceExtension=require(_0xe6c4('0x9'));var ZendeskAccount=require(_0xe6c4('0xa'));var SalesforceAccount=require(_0xe6c4('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xe6c4('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xe6c4('0xd'));var VtigerAccount=require(_0xe6c4('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xe6c4('0xf'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xe6c4('0x10')]={};this['telephones']={};this[_0xe6c4('0x11')]={};this[_0xe6c4('0x12')]={};this[_0xe6c4('0x13')]={};this[_0xe6c4('0x14')]={};this[_0xe6c4('0x15')]={};this[_0xe6c4('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xe6c4('0x17')]={};this[_0xe6c4('0x18')]={};this[_0xe6c4('0x19')]={};this[_0xe6c4('0x1a')]={};this[_0xe6c4('0x1b')]={};this[_0xe6c4('0x1c')]={};this[_0xe6c4('0x1d')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xe6c4('0x1e')]={};this[_0xe6c4('0x1f')]={};this[_0xe6c4('0x20')]={};this[_0xe6c4('0x21')]={};this[_0xe6c4('0x22')]={};this[_0xe6c4('0x23')]={};this[_0xe6c4('0x24')]={};};function freeIsNotKey(_0x4e386e,_0x42cecc,_0x475b16){var _0x127e7b=_[_0xe6c4('0x25')](_0x4e386e,function(_0x31bc1d,_0x49a8b5){return _0x31bc1d[_0x475b16];});for(var _0x2dafd0 in _0x42cecc){if(_0x42cecc['hasOwnProperty'](_0x2dafd0)){if(!_0x127e7b[_0x2dafd0]){delete _0x42cecc[_0x2dafd0];}}}}function freeIsNotKeySip(_0x944f95,_0xc7ab82){var _0x131199=_['mapKeys'](_0x944f95,function(_0x2ba3b0,_0x3285b8){return util[_0xe6c4('0x26')](_0xe6c4('0x27'),_0x2ba3b0[_0xe6c4('0x28')]);});for(var _0x4cdbb9 in _0xc7ab82){if(_0xc7ab82['hasOwnProperty'](_0x4cdbb9)){if(!_0x131199[_0x4cdbb9]){delete _0xc7ab82[_0x4cdbb9];}}}}function freeIsNotKeyAgent(_0x336976,_0x24f4c1){var _0x4b4eb0=_[_0xe6c4('0x25')](_0x336976,function(_0x49e79a,_0x6bf345){var _0x2218ea=_[_0xe6c4('0x29')](_0x49e79a[_0xe6c4('0x2a')])?util['format'](_0xe6c4('0x27'),_0x49e79a['name']):_0x49e79a[_0xe6c4('0x2a')];return _0x2218ea;});for(var _0x3f923 in _0x24f4c1){if(_0x24f4c1[_0xe6c4('0x2b')](_0x3f923)){if(!_0x4b4eb0[_0x3f923]){delete _0x24f4c1[_0x3f923];}}}}function clearVoiceCallReports(_0x55add3){_0x55add3[_0xe6c4('0x2c')]=0x0;_0x55add3[_0xe6c4('0x2d')]=0x0;_0x55add3[_0xe6c4('0x2e')]=0x0;_0x55add3[_0xe6c4('0x2f')]=0x0;_0x55add3[_0xe6c4('0x30')]=0x0;}function clearCampaigns(_0x29922e){if(!_[_0xe6c4('0x31')](_0x29922e)){for(var _0x3ec034 in _0x29922e){if(_0x29922e[_0xe6c4('0x2b')](_0x3ec034)){_0x29922e[_0x3ec034][_0xe6c4('0x32')]=0x0;_0x29922e[_0x3ec034]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5e159c){if(!_[_0xe6c4('0x31')](_0x5e159c)){for(var _0x48b8c6 in _0x5e159c){if(_0x5e159c['hasOwnProperty'](_0x48b8c6)){_0x5e159c[_0x48b8c6]['total']=0x0;_0x5e159c[_0x48b8c6]['answered']=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x33')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x34')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x2e')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x2f')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x30')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x35')]=0x0;_0x5e159c[_0x48b8c6]['outboundNoAnswerCallsDay']=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x36')]=0x0;_0x5e159c[_0x48b8c6]['outboundCongestionCallsDay']=0x0;_0x5e159c[_0x48b8c6]['outboundNoSuchCallsDay']=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x37')]=0x0;_0x5e159c[_0x48b8c6]['outboundDropCallsDayTimeout']=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x38')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x39')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x3a')]=0x0;_0x5e159c[_0x48b8c6]['outboundRejectCallsDay']=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x3b')]=0x0;_0x5e159c[_0x48b8c6][_0xe6c4('0x35')]=0x0;_0x5e159c[_0x48b8c6]['outboundAnswerCallsDay']=0x0;_0x5e159c[_0x48b8c6]['queueStatusComplete']=!![];}}}}Realtime[_0xe6c4('0x3c')]['mergeFromDatabase']=function(_0x426514,_0x2b9c87){for(var _0x2d8d7d in _0x2b9c87){if(_0x426514[_0xe6c4('0x2b')](_0x2d8d7d)){_0x426514[_0x2d8d7d]=_0x2b9c87[_0x2d8d7d];}}};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x3d')]=function(){var _0x34d01d=this;return function(_0x255d84){if(_0x255d84){freeIsNotKeyAgent(_0x255d84,_0x34d01d[_0xe6c4('0x10')]);for(var _0xf87f1b=0x0,_0x23481b={},_0xaa955={};_0xf87f1b<_0x255d84['length'];_0xf87f1b+=0x1){_0x23481b=_0x255d84[_0xf87f1b];var _0x421dd6=_[_0xe6c4('0x29')](_0x23481b['interface'])?util[_0xe6c4('0x26')](_0xe6c4('0x27'),_0x23481b[_0xe6c4('0x28')]):_0x23481b[_0xe6c4('0x2a')];if(_[_0xe6c4('0x3e')](_0x34d01d[_0xe6c4('0x10')][_0x421dd6])){_0x34d01d[_0xe6c4('0x10')][_0x421dd6]=new Agent(_0x23481b);}else{_0x34d01d[_0xe6c4('0x3f')](_0x34d01d[_0xe6c4('0x10')][_0x421dd6],_0x23481b);}}}return _0x34d01d[_0xe6c4('0x10')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x40')]=function(){var _0x530d6d=this;return function(_0x5adfe2){if(_0x5adfe2){freeIsNotKeySip(_0x5adfe2,_0x530d6d[_0xe6c4('0x41')]);for(var _0x1d37c3=0x0,_0x1dd8bb={},_0x264e79={};_0x1d37c3<_0x5adfe2[_0xe6c4('0x42')];_0x1d37c3+=0x1){_0x1dd8bb=_0x5adfe2[_0x1d37c3];if(_[_0xe6c4('0x3e')](_0x530d6d[_0xe6c4('0x41')][util[_0xe6c4('0x26')](_0xe6c4('0x27'),_0x1dd8bb[_0xe6c4('0x28')])])){_0x530d6d['telephones'][util['format'](_0xe6c4('0x27'),_0x1dd8bb[_0xe6c4('0x28')])]=new Telephone(_0x1dd8bb);}else{_0x530d6d[_0xe6c4('0x3f')](_0x530d6d[_0xe6c4('0x41')][util[_0xe6c4('0x26')]('SIP/%s',_0x1dd8bb[_0xe6c4('0x28')])],_0x1dd8bb);}}}return _0x530d6d[_0xe6c4('0x41')];};};Realtime['prototype'][_0xe6c4('0x43')]=function(){var _0x25eb94=this;return function(_0x21c6e0){if(_0x21c6e0){freeIsNotKeySip(_0x21c6e0,_0x25eb94['trunks']);for(var _0x1a4697=0x0,_0x35930c={},_0x2ee5dd={};_0x1a4697<_0x21c6e0[_0xe6c4('0x42')];_0x1a4697+=0x1){_0x35930c=_0x21c6e0[_0x1a4697];if(_[_0xe6c4('0x3e')](_0x25eb94[_0xe6c4('0x11')][util[_0xe6c4('0x26')](_0xe6c4('0x27'),_0x35930c['name'])])){_0x25eb94[_0xe6c4('0x11')][util[_0xe6c4('0x26')](_0xe6c4('0x27'),_0x35930c[_0xe6c4('0x28')])]=new Trunk(_0x35930c);}else{_0x25eb94[_0xe6c4('0x3f')](_0x25eb94[_0xe6c4('0x11')][util['format'](_0xe6c4('0x27'),_0x35930c[_0xe6c4('0x28')])],_0x35930c);}}}return _0x25eb94['trunks'];};};Realtime['prototype'][_0xe6c4('0x44')]=function(){var _0x5d400f=this;return function(_0x137004){if(_0x137004){freeIsNotKey(_0x137004,_0x5d400f['voiceQueues'],_0xe6c4('0x28'));for(var _0x95990b=0x0,_0x14d019={},_0x136c73={};_0x95990b<_0x137004[_0xe6c4('0x42')];_0x95990b+=0x1){_0x14d019=_0x137004[_0x95990b];if(_[_0xe6c4('0x3e')](_0x5d400f[_0xe6c4('0x12')][_0x14d019[_0xe6c4('0x28')]])){_0x5d400f[_0xe6c4('0x12')][_0x14d019[_0xe6c4('0x28')]]=new VoiceQueue(_0x14d019);}else{_0x5d400f[_0xe6c4('0x3f')](_0x5d400f[_0xe6c4('0x12')][_0x14d019['name']],_0x14d019);}}}return _0x5d400f['voiceQueues'];};};Realtime['prototype'][_0xe6c4('0x45')]=function(){var _0x2980c9=this;return function(_0x123c74){if(_0x123c74){freeIsNotKey(_0x123c74,_0x2980c9['triggers'],'id');for(var _0x5cd209=0x0,_0x3a3ba9={},_0x4119e4={};_0x5cd209<_0x123c74[_0xe6c4('0x42')];_0x5cd209+=0x1){_0x3a3ba9=_0x123c74[_0x5cd209];if(_[_0xe6c4('0x3e')](_0x2980c9['triggers'][_0x3a3ba9['id']])){_0x2980c9[_0xe6c4('0x13')][_0x3a3ba9['id']]=new Trigger(_0x3a3ba9);}else{_0x2980c9[_0xe6c4('0x3f')](_0x2980c9[_0xe6c4('0x13')][_0x3a3ba9['id']],_0x3a3ba9);}}}return _0x2980c9[_0xe6c4('0x13')];};};Realtime['prototype'][_0xe6c4('0x46')]=function(){var _0x58e71c=this;return function(_0x15d88b){if(_0x15d88b){freeIsNotKey(_0x15d88b,_0x58e71c[_0xe6c4('0x15')],'id');for(var _0x253d70=0x0,_0x11e8fa={},_0xb551d={};_0x253d70<_0x15d88b['length'];_0x253d70+=0x1){_0x11e8fa=_0x15d88b[_0x253d70];if(_['isUndefined'](_0x58e71c[_0xe6c4('0x15')][_0x11e8fa['id']])){_0x58e71c[_0xe6c4('0x15')][_0x11e8fa['id']]=new Template(_0x11e8fa);}else{_0x58e71c[_0xe6c4('0x3f')](_0x58e71c['templates'][_0x11e8fa['id']],_0x11e8fa);}}}return _0x58e71c[_0xe6c4('0x15')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x47')]=function(){var _0x5aa131=this;return function(_0x47d0e4){if(_0x47d0e4){freeIsNotKey(_0x47d0e4,_0x5aa131[_0xe6c4('0x1c')],'id');for(var _0x545e01=0x0,_0x5a4ef5={},_0x45bd65={};_0x545e01<_0x47d0e4[_0xe6c4('0x42')];_0x545e01+=0x1){_0x5a4ef5=_0x47d0e4[_0x545e01];if(_[_0xe6c4('0x3e')](_0x5aa131[_0xe6c4('0x1c')][_0x5a4ef5['id']])){_0x5aa131[_0xe6c4('0x1c')][_0x5a4ef5['id']]=new ZendeskAccount(_0x5a4ef5);}else{_0x5aa131['mergeFromDatabase'](_0x5aa131['zendeskAccounts'][_0x5a4ef5['id']],_0x5a4ef5);}}}return _0x5aa131['zendeskAccounts'];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x48')]=function(){var _0x2fb744=this;return function(_0x2663b7){if(_0x2663b7){freeIsNotKey(_0x2663b7,_0x2fb744[_0xe6c4('0x1d')],'id');for(var _0x158311=0x0,_0x48eeb0={},_0x3d5f99={};_0x158311<_0x2663b7['length'];_0x158311+=0x1){_0x48eeb0=_0x2663b7[_0x158311];if(_[_0xe6c4('0x3e')](_0x2fb744[_0xe6c4('0x1d')][_0x48eeb0['id']])){_0x2fb744[_0xe6c4('0x1d')][_0x48eeb0['id']]=new SalesforceAccount(_0x48eeb0);}else{_0x2fb744[_0xe6c4('0x3f')](_0x2fb744[_0xe6c4('0x1d')][_0x48eeb0['id']],_0x48eeb0);}}}return _0x2fb744[_0xe6c4('0x1d')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x49')]=function(){var _0x2d2e7f=this;return function(_0x2fefe1){if(_0x2fefe1){freeIsNotKey(_0x2fefe1,_0x2d2e7f['freshdeskAccounts'],'id');for(var _0xf91766=0x0,_0x24d3a4={},_0x30e764={};_0xf91766<_0x2fefe1['length'];_0xf91766+=0x1){_0x24d3a4=_0x2fefe1[_0xf91766];if(_['isUndefined'](_0x2d2e7f[_0xe6c4('0x4a')][_0x24d3a4['id']])){_0x2d2e7f['freshdeskAccounts'][_0x24d3a4['id']]=new FreshdeskAccount(_0x24d3a4);}else{_0x2d2e7f[_0xe6c4('0x3f')](_0x2d2e7f[_0xe6c4('0x4a')][_0x24d3a4['id']],_0x24d3a4);}}}return _0x2d2e7f[_0xe6c4('0x4a')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x4b')]=function(){var _0x11bca7=this;return function(_0x3095ab){if(_0x3095ab){freeIsNotKey(_0x3095ab,_0x11bca7[_0xe6c4('0x1e')],'id');for(var _0x15d24b=0x0,_0x2b35e4={},_0x553360={};_0x15d24b<_0x3095ab[_0xe6c4('0x42')];_0x15d24b+=0x1){_0x2b35e4=_0x3095ab[_0x15d24b];if(_[_0xe6c4('0x3e')](_0x11bca7[_0xe6c4('0x1e')][_0x2b35e4['id']])){_0x11bca7[_0xe6c4('0x1e')][_0x2b35e4['id']]=new ZohoAccount(_0x2b35e4);}else{_0x11bca7[_0xe6c4('0x3f')](_0x11bca7[_0xe6c4('0x1e')][_0x2b35e4['id']],_0x2b35e4);}}}return _0x11bca7[_0xe6c4('0x1e')];};};Realtime[_0xe6c4('0x3c')]['initDeskAccounts']=function(){var _0xc99629=this;return function(_0x547cb5){if(_0x547cb5){freeIsNotKey(_0x547cb5,_0xc99629[_0xe6c4('0x1f')],'id');for(var _0x4df283=0x0,_0x4e3b24={},_0x32db73={};_0x4df283<_0x547cb5['length'];_0x4df283+=0x1){_0x4e3b24=_0x547cb5[_0x4df283];if(_[_0xe6c4('0x3e')](_0xc99629[_0xe6c4('0x1f')][_0x4e3b24['id']])){_0xc99629[_0xe6c4('0x1f')][_0x4e3b24['id']]=new DeskAccount(_0x4e3b24);}else{_0xc99629[_0xe6c4('0x3f')](_0xc99629['deskAccounts'][_0x4e3b24['id']],_0x4e3b24);}}}return _0xc99629['deskAccounts'];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x4c')]=function(){var _0x3ab059=this;return function(_0x11c374){if(_0x11c374){freeIsNotKey(_0x11c374,_0x3ab059[_0xe6c4('0x4d')],'id');for(var _0x565e93=0x0,_0x209e59={},_0x4beb5a={};_0x565e93<_0x11c374[_0xe6c4('0x42')];_0x565e93+=0x1){_0x209e59=_0x11c374[_0x565e93];if(_[_0xe6c4('0x3e')](_0x3ab059[_0xe6c4('0x4d')][_0x209e59['id']])){_0x3ab059[_0xe6c4('0x4d')][_0x209e59['id']]=new SugarcrmAccount(_0x209e59);}else{_0x3ab059[_0xe6c4('0x3f')](_0x3ab059[_0xe6c4('0x4d')][_0x209e59['id']],_0x209e59);}}}return _0x3ab059[_0xe6c4('0x4d')];};};Realtime[_0xe6c4('0x3c')]['initVtigerAccounts']=function(){var _0x226c5c=this;return function(_0x5dd3b3){if(_0x5dd3b3){freeIsNotKey(_0x5dd3b3,_0x226c5c[_0xe6c4('0x20')],'id');for(var _0x406b9e=0x0,_0x4d8fa1={},_0x4bb8f5={};_0x406b9e<_0x5dd3b3[_0xe6c4('0x42')];_0x406b9e+=0x1){_0x4d8fa1=_0x5dd3b3[_0x406b9e];if(_[_0xe6c4('0x3e')](_0x226c5c['vtigerAccounts'][_0x4d8fa1['id']])){_0x226c5c[_0xe6c4('0x20')][_0x4d8fa1['id']]=new VtigerAccount(_0x4d8fa1);}else{_0x226c5c[_0xe6c4('0x3f')](_0x226c5c['vtigerAccounts'][_0x4d8fa1['id']],_0x4d8fa1);}}}return _0x226c5c['vtigerAccounts'];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x4e')]=function(){var _0x259c35=this;return function(_0x1011c3){if(_0x1011c3){freeIsNotKey(_0x1011c3,_0x259c35[_0xe6c4('0x21')],'id');for(var _0x36585b=0x0,_0x2dc51a={},_0xa11d87={};_0x36585b<_0x1011c3[_0xe6c4('0x42')];_0x36585b+=0x1){_0x2dc51a=_0x1011c3[_0x36585b];if(_[_0xe6c4('0x3e')](_0x259c35['servicenowAccounts'][_0x2dc51a['id']])){_0x259c35['servicenowAccounts'][_0x2dc51a['id']]=new ServicenowAccount(_0x2dc51a);}else{_0x259c35[_0xe6c4('0x3f')](_0x259c35['servicenowAccounts'][_0x2dc51a['id']],_0x2dc51a);}}}return _0x259c35[_0xe6c4('0x21')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x4f')]=function(){var _0x226854=this;return function(_0x4967ce){if(_0x4967ce){freeIsNotKey(_0x4967ce,_0x226854[_0xe6c4('0x22')],'id');for(var _0x460750=0x0,_0x5cb353={},_0x197752={};_0x460750<_0x4967ce[_0xe6c4('0x42')];_0x460750+=0x1){_0x5cb353=_0x4967ce[_0x460750];if(_[_0xe6c4('0x3e')](_0x226854[_0xe6c4('0x22')][_0x5cb353['id']])){_0x226854[_0xe6c4('0x22')][_0x5cb353['id']]=new Dynamics365Account(_0x5cb353);}else{_0x226854[_0xe6c4('0x3f')](_0x226854[_0xe6c4('0x22')][_0x5cb353['id']],_0x5cb353);}}}return _0x226854[_0xe6c4('0x22')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x50')]=function(){var _0xa36b75=this;return function(_0x1826e3){if(_0x1826e3){freeIsNotKey(_0x1826e3,_0xa36b75[_0xe6c4('0x23')],'id');for(var _0x248d19=0x0,_0x4213fb={},_0x5df457={};_0x248d19<_0x1826e3[_0xe6c4('0x42')];_0x248d19+=0x1){_0x4213fb=_0x1826e3[_0x248d19];if(_['isUndefined'](_0xa36b75[_0xe6c4('0x23')][_0x4213fb['id']])){_0xa36b75['freshsalesAccounts'][_0x4213fb['id']]=new FreshsalesAccount(_0x4213fb);}else{_0xa36b75[_0xe6c4('0x3f')](_0xa36b75['freshsalesAccounts'][_0x4213fb['id']],_0x4213fb);}}}return _0xa36b75[_0xe6c4('0x23')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x51')]=function(){var _0x41e4b0=this;return function(_0x19aa3b){for(var _0x1c6af6=0x0;_0x1c6af6<_0x19aa3b[_0xe6c4('0x42')];_0x1c6af6+=0x1){_[_0xe6c4('0x52')](_0x41e4b0['voiceQueues'][_0x19aa3b[_0x1c6af6][_0xe6c4('0x28')]],_0x19aa3b[_0x1c6af6]);}return _0x41e4b0[_0xe6c4('0x12')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x53')]=function(){var _0x56e044=this;return function(_0x290f89){clearVoiceQueues(_0x56e044[_0xe6c4('0x12')]);if(_0x290f89){_0x290f89=_[_0xe6c4('0x54')](_0x290f89,'uniqueid');for(var _0x4bac42 in _0x290f89){if(_0x290f89[_0xe6c4('0x2b')](_0x4bac42)){var _0x188e5a={};for(var _0x1ca210=0x0;_0x1ca210<_0x290f89[_0x4bac42][_0xe6c4('0x42')];_0x1ca210+=0x1){var _0x310ae6=_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x55')];if(_0x56e044['voiceQueues'][_0x310ae6]){if(_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x56')]){_0x56e044['voiceQueues'][_0x310ae6]['unmanaged']+=0x1;}if(_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x57')]){_0x56e044[_0xe6c4('0x12')][_0x310ae6][_0xe6c4('0x34')]+=0x1;}_0x56e044['voiceQueues'][_0x310ae6][_0xe6c4('0x2e')]+=moment(_0x290f89[_0x4bac42][_0x1ca210]['queuecallerleaveAt'])[_0xe6c4('0x58')](moment(_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x59')]),_0xe6c4('0x5a'))||0x0;if(_0x1ca210===_0x290f89[_0x4bac42][_0xe6c4('0x42')]-0x1){_0x56e044['voiceQueues'][_0x310ae6][_0xe6c4('0x2f')]+=moment(_0x290f89[_0x4bac42][_0x1ca210]['queuecallercompleteAt']||_0x290f89[_0x4bac42][_0x1ca210]['queuecallerabandonAt']||_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x5b')])[_0xe6c4('0x58')](moment(_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x59')]),'seconds')||0x0;_0x56e044['voiceQueues'][_0x310ae6]['total']+=0x1;if(_0x290f89[_0x4bac42][_0x1ca210]['queuecallercomplete']){_0x56e044[_0xe6c4('0x12')][_0x310ae6][_0xe6c4('0x2d')]+=0x1;_0x56e044['voiceQueues'][_0x310ae6][_0xe6c4('0x30')]+=moment(_0x290f89[_0x4bac42][_0x1ca210][_0xe6c4('0x5c')])[_0xe6c4('0x58')](moment(_0x290f89[_0x4bac42][_0x1ca210]['queuecallerleaveAt']),_0xe6c4('0x5a'))||0x0;}}else{_0x56e044[_0xe6c4('0x12')][_0x310ae6]['sumDuration']+=_0x56e044[_0xe6c4('0x12')][_0x310ae6]['sumHoldTime']||0x0;}}}}}}return _0x56e044[_0xe6c4('0x12')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x5d')]=function(){var _0x291034=this;return function(_0x3679b6){clearVoiceCallReports(_0x291034[_0xe6c4('0x16')]);if(_0x3679b6){for(var _0x4fe430=0x0;_0x4fe430<_0x3679b6[_0xe6c4('0x42')];_0x4fe430+=0x1){_0x291034[_0xe6c4('0x16')]['total']+=0x1;_0x291034['outbound'][_0xe6c4('0x2f')]+=_0x3679b6[_0x4fe430][_0xe6c4('0x5e')];if(_0x3679b6[_0x4fe430][_0xe6c4('0x5f')]===_0xe6c4('0x60')){_0x291034['outbound'][_0xe6c4('0x2d')]+=0x1;_0x291034[_0xe6c4('0x16')][_0xe6c4('0x2e')]+=_0x3679b6[_0x4fe430][_0xe6c4('0x5e')]-_0x3679b6[_0x4fe430][_0xe6c4('0x61')]||0x0;_0x291034[_0xe6c4('0x16')][_0xe6c4('0x30')]+=_0x3679b6[_0x4fe430][_0xe6c4('0x61')];}}}return _0x291034[_0xe6c4('0x16')];};};Realtime['prototype'][_0xe6c4('0x62')]=function(){var _0x54e75a=this;return function(_0x32723d){if(_0x32723d){freeIsNotKey(_0x32723d,_0x54e75a['campaigns'],_0xe6c4('0x28'));for(var _0xba37d8=0x0,_0x408c95={};_0xba37d8<_0x32723d[_0xe6c4('0x42')];_0xba37d8+=0x1){_0x408c95=_0x32723d[_0xba37d8];if(_[_0xe6c4('0x3e')](_0x54e75a[_0xe6c4('0x14')][_0x408c95['name']])){_0x54e75a[_0xe6c4('0x14')][_0x408c95[_0xe6c4('0x28')]]=new Campaign(_0x408c95);}else{_0x54e75a[_0xe6c4('0x3f')](_0x54e75a[_0xe6c4('0x14')][_0x408c95[_0xe6c4('0x28')]],_0x408c95);_0x54e75a[_0xe6c4('0x14')][_0x408c95[_0xe6c4('0x28')]][_0xe6c4('0x63')]=_0x408c95[_0xe6c4('0x64')]?_0x408c95['SquareProject']['name']:undefined;}}}return _0x54e75a[_0xe6c4('0x14')];};};Realtime[_0xe6c4('0x3c')]['initVoiceExtensions']=function(){var _0x37048b=this;return function(_0x2b6c69){if(_0x2b6c69){freeIsNotKey(_0x2b6c69,_0x37048b[_0xe6c4('0x65')],'id');for(var _0x164e2a=0x0,_0x57ebc8={};_0x164e2a<_0x2b6c69[_0xe6c4('0x42')];_0x164e2a+=0x1){_0x57ebc8=_0x2b6c69[_0x164e2a];if(_[_0xe6c4('0x3e')](_0x37048b[_0xe6c4('0x65')][_0x57ebc8['id']])){_0x37048b[_0xe6c4('0x65')][_0x57ebc8['id']]=new VoiceExtension(_0x57ebc8);}else{_0x37048b[_0xe6c4('0x3f')](_0x37048b[_0xe6c4('0x65')][_0x57ebc8['id']],_0x57ebc8);}}}return _0x37048b[_0xe6c4('0x65')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x66')]=function(){var _0x16360d=this;return function(_0x497dba){clearCampaigns(_0x16360d['campaigns']);for(var _0x55d0f1=0x0;_0x55d0f1<_0x497dba['length'];_0x55d0f1+=0x1){_[_0xe6c4('0x52')](_0x16360d[_0xe6c4('0x14')][_0x497dba[_0x55d0f1][_0xe6c4('0x28')]],_0x497dba[_0x55d0f1]);}return _0x16360d[_0xe6c4('0x14')];};};Realtime[_0xe6c4('0x3c')][_0xe6c4('0x67')]=function(){var _0x521c9f=this;return function(_0x5ab65a){if(_0x5ab65a){freeIsNotKey(_0x5ab65a,_0x521c9f['faxAccounts'],'id');for(var _0x3c8c0c=0x0,_0x3c9c03={},_0x329fa6={};_0x3c8c0c<_0x5ab65a[_0xe6c4('0x42')];_0x3c8c0c+=0x1){_0x3c9c03=_0x5ab65a[_0x3c8c0c];if(_[_0xe6c4('0x3e')](_0x521c9f[_0xe6c4('0x24')][_0x3c9c03['id']])){_0x521c9f[_0xe6c4('0x24')][_0x3c9c03['id']]=new FaxAccount(_0x3c9c03);}else{_0x521c9f[_0xe6c4('0x3f')](_0x521c9f[_0xe6c4('0x24')][_0x3c9c03['id']],_0x3c9c03);}}}return _0x521c9f[_0xe6c4('0x24')];};};module[_0xe6c4('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2f2dc2e..9f448f9 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 _0xdf2d=['channel','calleridnum','internal','destination','exten','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','getCallType','UserId','split','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','getAgentByInternal','keys'];(function(_0x32060f,_0x1ad0fc){var _0x4e0ade=function(_0x223b7f){while(--_0x223b7f){_0x32060f['push'](_0x32060f['shift']());}};_0x4e0ade(++_0x1ad0fc);}(_0xdf2d,0x88));var _0xddf2=function(_0x10776d,_0x340cae){_0x10776d=_0x10776d-0x0;var _0x1d0b9c=_0xdf2d[_0x10776d];return _0x1d0b9c;};'use strict';var _=require(_0xddf2('0x0'));var moment=require(_0xddf2('0x1'));var util=require(_0xddf2('0x2'));var config=require('../../../config/environment');var ami=require(_0xddf2('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xddf2('0x4'));var RpcVoiceDialReport=require(_0xddf2('0x5'));var RpcMemberReport=require(_0xddf2('0x6'));var RpcVoiceQueueReport=require(_0xddf2('0x7'));var RpcVoiceRecording=require(_0xddf2('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xddf2('0x9'));var VoiceCallReport=require(_0xddf2('0xa'));var VoiceAgentReport=require(_0xddf2('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xddf2('0xc'));function Report(_0x3a3732){this[_0xddf2('0xd')]=_0x3a3732;this[_0xddf2('0xe')]=_0x3a3732[_0xddf2('0xe')];this[_0xddf2('0xf')]=_0x3a3732[_0xddf2('0xf')];}Report[_0xddf2('0x10')][_0xddf2('0x11')]=function(_0xb763ca){var _0x2b31b7=new VoiceQueueReport(this[_0xddf2('0xd')]);var _0x905881=new VoiceAgentReport(this['realtime']);var _0x13e2a8=new VoiceDialReport(this[_0xddf2('0xd')]);var _0x199a16=new VoiceCallReport(this[_0xddf2('0xd')]);var _0x5209bf=new UserReport(this[_0xddf2('0xd')]);if(config[_0xddf2('0x12')]&&config[_0xddf2('0x12')][_0xddf2('0x13')]){ami['on'](_0xddf2('0x14'),this[_0xddf2('0x15')]['bind'](this));ami['on'](_0xddf2('0x16'),this[_0xddf2('0x17')][_0xddf2('0x18')](this));ami['on'](_0xddf2('0x19'),this[_0xddf2('0x1a')][_0xddf2('0x18')](this));ami['on'](_0xddf2('0x1b'),this[_0xddf2('0x1c')][_0xddf2('0x18')](this));ami['on'](_0xddf2('0x1d'),this[_0xddf2('0x1e')][_0xddf2('0x18')](this));ami['on']('attendedtransfer',this[_0xddf2('0x1f')][_0xddf2('0x18')](this));}};Report[_0xddf2('0x10')][_0xddf2('0x20')]=function(_0x4890d4){var _0x1c5a43;_0x1c5a43=_[_0xddf2('0x21')](this[_0xddf2('0xe')],function(_0x912c9a){return _0x912c9a[_0xddf2('0x22')]==_0x4890d4||_0x912c9a['name']==_0x4890d4;});if(_['isNil'](_0x1c5a43)){var _0x364991=_[_0xddf2('0x21')](this[_0xddf2('0xf')],function(_0x27f336){return _0x27f336[_0xddf2('0x22')]==_0x4890d4||_0x27f336[_0xddf2('0x23')]==_0x4890d4;});if(_0x364991){_0x1c5a43=_[_0xddf2('0x21')](this[_0xddf2('0xe')],function(_0x1eae77){return _0x1eae77[_0xddf2('0x24')]==util[_0xddf2('0x25')](_0xddf2('0x26'),_0x364991['name']);});}}return _0x1c5a43;};Report[_0xddf2('0x10')][_0xddf2('0x15')]=function(_0x7c171e){for(var _0x209d14=0x0;_0x209d14<_0x7c171e[_0xddf2('0x27')];_0x209d14+=0x1){var _0x1a2502=this['findAgent'](_0x7c171e[_0x209d14][_0xddf2('0x28')]);if(_0x1a2502){_0x7c171e[_0x209d14][_0xddf2('0x22')]=_0x1a2502[_0xddf2('0x22')];_0x7c171e[_0x209d14][_0xddf2('0x29')]=!![];_0x7c171e[_0x209d14][_0xddf2('0x2a')]=_0x1a2502['name'];_0x7c171e[_0x209d14][_0xddf2('0x24')]=_[_0xddf2('0x2b')](_0x1a2502[_0xddf2('0x24')])?util['format'](_0xddf2('0x26'),_0x1a2502[_0xddf2('0x23')]):_0x1a2502['interface'];if(_0x7c171e[_0x209d14]['queuecallercomplete']){_0x7c171e[_0x209d14][_0xddf2('0x2c')]=moment()[_0xddf2('0x25')](_0xddf2('0x2d'));}if(_0x7c171e[_0x209d14][_0xddf2('0x2e')]){_0x7c171e[_0x209d14][_0xddf2('0x2f')]=moment()[_0xddf2('0x25')](_0xddf2('0x2d'));}RpcMemberReport[_0xddf2('0x15')](_0x7c171e[_0x209d14]);}RpcVoiceQueueReport['create'](_0x7c171e[_0x209d14]);}};function extractCalleridNumber(_0x91de5f){var _0x355a02=_0x91de5f['match'](/<(.*?)>/);return _0x355a02?_0x355a02[0x1]:_0x91de5f;}Report['prototype'][_0xddf2('0x30')]=function(_0x2d8d03){for(var _0x122b44=0x0;_0x122b44','calleridname','transfers','linkedid','transfereelinkedid','type','UserId','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','voiceDialReport','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','accountcode','name','isNil','find','interface','format','SIP/%s','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match'];(function(_0x2fc48b,_0x42b03f){var _0x365ce5=function(_0x27bcd3){while(--_0x27bcd3){_0x2fc48b['push'](_0x2fc48b['shift']());}};_0x365ce5(++_0x42b03f);}(_0xac00,0xec));var _0x0ac0=function(_0x5a7188,_0x2ec5ad){_0x5a7188=_0x5a7188-0x0;var _0x805ef=_0xac00[_0x5a7188];return _0x805ef;};'use strict';var _=require('lodash');var moment=require(_0x0ac0('0x0'));var util=require(_0x0ac0('0x1'));var config=require(_0x0ac0('0x2'));var ami=require(_0x0ac0('0x3'));var RpcVoiceAgentReport=require(_0x0ac0('0x4'));var RpcVoiceCallReport=require(_0x0ac0('0x5'));var RpcVoiceDialReport=require(_0x0ac0('0x6'));var RpcMemberReport=require(_0x0ac0('0x7'));var RpcVoiceQueueReport=require(_0x0ac0('0x8'));var RpcVoiceRecording=require(_0x0ac0('0x9'));var RpcVoiceTransferReport=require(_0x0ac0('0xa'));var VoiceQueueReport=require(_0x0ac0('0xb'));var VoiceCallReport=require(_0x0ac0('0xc'));var VoiceAgentReport=require(_0x0ac0('0xd'));var VoiceDialReport=require(_0x0ac0('0xe'));var UserReport=require('./userReport');function Report(_0xe0e782){this[_0x0ac0('0xf')]=_0xe0e782;this[_0x0ac0('0x10')]=_0xe0e782['agents'];this['telephones']=_0xe0e782[_0x0ac0('0x11')];}Report['prototype'][_0x0ac0('0x12')]=function(_0x2556d6){var _0x2c1a52=new VoiceQueueReport(this[_0x0ac0('0xf')]);var _0x186931=new VoiceAgentReport(this['realtime']);var _0x31afc2=new VoiceDialReport(this[_0x0ac0('0xf')]);var _0x4e55b5=new VoiceCallReport(this[_0x0ac0('0xf')]);var _0xcd7132=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0x0ac0('0x13')]){ami['on'](_0x0ac0('0x14'),this[_0x0ac0('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x0ac0('0x16')](this));ami['on'](_0x0ac0('0x17'),this[_0x0ac0('0x18')][_0x0ac0('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x0ac0('0x16')](this));ami['on']('blindtransfer',this[_0x0ac0('0x19')][_0x0ac0('0x16')](this));ami['on'](_0x0ac0('0x1a'),this[_0x0ac0('0x1b')][_0x0ac0('0x16')](this));}};Report[_0x0ac0('0x1c')]['findAgent']=function(_0x486443){var _0x5c618a;_0x5c618a=_['find'](this[_0x0ac0('0x10')],function(_0x57a2a8){return _0x57a2a8[_0x0ac0('0x1d')]==_0x486443||_0x57a2a8[_0x0ac0('0x1e')]==_0x486443;});if(_[_0x0ac0('0x1f')](_0x5c618a)){var _0x16b9ac=_[_0x0ac0('0x20')](this[_0x0ac0('0x11')],function(_0x24ab7f){return _0x24ab7f[_0x0ac0('0x1d')]==_0x486443||_0x24ab7f[_0x0ac0('0x1e')]==_0x486443;});if(_0x16b9ac){_0x5c618a=_['find'](this[_0x0ac0('0x10')],function(_0x18df52){return _0x18df52[_0x0ac0('0x21')]==util[_0x0ac0('0x22')](_0x0ac0('0x23'),_0x16b9ac[_0x0ac0('0x1e')]);});}}return _0x5c618a;};Report[_0x0ac0('0x1c')][_0x0ac0('0x15')]=function(_0x5c99f7){for(var _0x5f5bba=0x0;_0x5f5bba<_0x5c99f7['length'];_0x5f5bba+=0x1){var _0x10b541=this[_0x0ac0('0x24')](_0x5c99f7[_0x5f5bba][_0x0ac0('0x25')]);if(_0x10b541){_0x5c99f7[_0x5f5bba]['accountcode']=_0x10b541[_0x0ac0('0x1d')];_0x5c99f7[_0x5f5bba][_0x0ac0('0x26')]=!![];_0x5c99f7[_0x5f5bba][_0x0ac0('0x27')]=_0x10b541[_0x0ac0('0x1e')];_0x5c99f7[_0x5f5bba]['interface']=_[_0x0ac0('0x1f')](_0x10b541[_0x0ac0('0x21')])?util['format'](_0x0ac0('0x23'),_0x10b541[_0x0ac0('0x1e')]):_0x10b541[_0x0ac0('0x21')];if(_0x5c99f7[_0x5f5bba]['queuecallercomplete']){_0x5c99f7[_0x5f5bba][_0x0ac0('0x28')]=moment()[_0x0ac0('0x22')](_0x0ac0('0x29'));}if(_0x5c99f7[_0x5f5bba][_0x0ac0('0x2a')]){_0x5c99f7[_0x5f5bba][_0x0ac0('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x0ac0('0x15')](_0x5c99f7[_0x5f5bba]);}RpcVoiceQueueReport[_0x0ac0('0x2c')](_0x5c99f7[_0x5f5bba]);}};function extractCalleridNumber(_0x11c9fe){var _0x20baaa=_0x11c9fe[_0x0ac0('0x2d')](/<(.*?)>/);return _0x20baaa?_0x20baaa[0x1]:_0x11c9fe;}Report['prototype'][_0x0ac0('0x2e')]=function(_0x46e646){for(var _0x2171e4=0x0;_0x2171e40x0?_0x1862a8:0x0;this[_0xc01e('0x16')][_0x375b10[_0xc01e('0x75')]][_0xc01e('0x60')]=this['voiceQueues'][_0x375b10[_0xc01e('0x75')]][_0xc01e('0x60')]>_[_0xc01e('0x7a')](_0x375b10[_0xc01e('0x7c')])?_[_0xc01e('0x7a')](_0x375b10[_0xc01e('0x7c')]):this['voiceQueues'][_0x375b10[_0xc01e('0x75')]][_0xc01e('0x60')];this[_0xc01e('0x59')](this['voiceQueues'][_0x375b10['queue']],_0xc01e('0x18'));}logger[_0xc01e('0x4b')](_0xc01e('0x7d'),util['inspect'](this[_0xc01e('0x16')][_0x375b10[_0xc01e('0x75')]],{'showHidden':![],'depth':null}));ami[_0xc01e('0x4a')](_0xc01e('0x7e'),this['voiceQueues'][_0x375b10[_0xc01e('0x75')]]);}}}catch(_0x5e68b8){logger['error'](_0xc01e('0x73'),util['inspect'](_0x5e68b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01e('0x1c')]=function(_0x1dd7e9){logger[_0xc01e('0x4b')](_0xc01e('0x7f'),util[_0xc01e('0x43')](_0x1dd7e9,{'showHidden':![],'depth':null}));this[_0xc01e('0x71')]=!![];};VoiceQueueReport[_0xc01e('0xd')][_0xc01e('0x1e')]=function(_0x235e94){try{if(this[_0xc01e('0x6c')](_0x235e94)){logger[_0xc01e('0x4b')](_0xc01e('0x80'),_0x235e94[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x235e94,{'showHidden':![],'depth':null}));if(_[_0xc01e('0x6d')](this[_0xc01e('0x12')][_0x235e94['uniqueid']]))this['queueReports'][_0x235e94[_0xc01e('0x4e')]]=[];if(_['isUndefined'](this[_0xc01e('0x14')][_0x235e94['uniqueid']]))this[_0xc01e('0x14')][_0x235e94['uniqueid']]={};var _0x127c26=new QueueReport();_0x127c26[_0xc01e('0x56')]=_0x235e94[_0xc01e('0x75')];_0x127c26[_0xc01e('0x5a')]=this[_0xc01e('0x16')][_0x127c26[_0xc01e('0x56')]]&&this[_0xc01e('0x16')][_0x127c26[_0xc01e('0x56')]][_0xc01e('0x5a')]?this[_0xc01e('0x16')][_0x127c26[_0xc01e('0x56')]][_0xc01e('0x5a')]||_0xc01e('0x5b'):_0xc01e('0x5b');_0x127c26[_0xc01e('0x75')]=_0x235e94[_0xc01e('0x75')];_0x127c26['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x127c26['position']=_0x235e94[_0xc01e('0x81')];_0x127c26['count']=_0x235e94[_0xc01e('0x82')];_0x127c26[_0xc01e('0x4e')]=_0x235e94[_0xc01e('0x4e')];_0x127c26['routealias']=this[_0xc01e('0x14')][_0x235e94['uniqueid']][_0xc01e('0x83')];logger[_0xc01e('0x76')](_0xc01e('0x84'),_0x127c26[_0xc01e('0x56')],_0x127c26[_0xc01e('0x5a')]);_[_0xc01e('0x85')](_0x127c26,_[_0xc01e('0x86')](_0x235e94,_[_0xc01e('0x87')](_0x127c26)));this[_0xc01e('0x12')][_0x235e94[_0xc01e('0x4e')]][_0xc01e('0x88')](_0x127c26);this[_0xc01e('0x14')][_0x235e94[_0xc01e('0x4e')]]=_0x127c26;this['emitVoiceQueueChannelSave'](_0x127c26,_0xc01e('0x1d'));}}catch(_0x7b1c32){logger[_0xc01e('0x41')](_0xc01e('0x80'),_0x235e94['uniqueid'],util[_0xc01e('0x43')](_0x7b1c32,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01e('0x89')]=function(_0x44a609){try{if(this['isNotNull'](_0x44a609)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x44a609[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x44a609,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44a609['uniqueid']]){var _0x47fe18=_[_0xc01e('0x8a')](this[_0xc01e('0x12')][_0x44a609[_0xc01e('0x4e')]]);_0x47fe18[_0xc01e('0x8b')]=![];_0x47fe18[_0xc01e('0x8c')]=null;_0x47fe18[_0xc01e('0x8d')]=_0x44a609[_0xc01e('0x8d')];_0x47fe18[_0xc01e('0x8e')]=_0x44a609[_0xc01e('0x8e')];_0x47fe18[_0xc01e('0x1f')]=!![];_0x47fe18[_0xc01e('0x8f')]=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));_0x47fe18['queuecallerexitreason']=_0xc01e('0x91');_0x47fe18[_0xc01e('0x92')]=null;logger[_0xc01e('0x76')](_0xc01e('0x93'),_0x47fe18[_0xc01e('0x56')],_0x47fe18['type']);this['channels'][_0x44a609['uniqueid']]=_0x47fe18;this[_0xc01e('0x52')](_0x47fe18,_0xc01e('0x1f'));}}}catch(_0x491f48){logger['error'](_0xc01e('0x94'),_0x44a609['uniqueid'],util['inspect'](_0x491f48,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01e('0xd')][_0xc01e('0x21')]=function(_0x33dd6e){try{if(this[_0xc01e('0x6c')](_0x33dd6e)){logger[_0xc01e('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x33dd6e[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x33dd6e,{'showHidden':![],'depth':null}));if(this[_0xc01e('0x12')][_0x33dd6e['uniqueid']]){var _0x3f51c0=_[_0xc01e('0x8a')](this[_0xc01e('0x12')][_0x33dd6e[_0xc01e('0x4e')]]);_0x3f51c0['queuecallerleaveAt']=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));_0x3f51c0[_0xc01e('0x95')]=_0x33dd6e[_0xc01e('0x95')];_0x3f51c0[_0xc01e('0x96')]=_0x33dd6e[_0xc01e('0x96')];logger['info'](_0xc01e('0x97'),_0x3f51c0[_0xc01e('0x56')],_0x3f51c0[_0xc01e('0x5a')],_0x33dd6e[_0xc01e('0x95')],_0x33dd6e[_0xc01e('0x96')]);this[_0xc01e('0x14')][_0x33dd6e[_0xc01e('0x4e')]]=_0x3f51c0;this[_0xc01e('0x98')](_0x3f51c0,'queuecallerleave');}}}catch(_0x197686){logger[_0xc01e('0x41')](_0xc01e('0x99'),_0x33dd6e[_0xc01e('0x4e')],util['inspect'](_0x197686,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01e('0xd')]['syncAgentConnect']=function(_0xe80801){try{if(this[_0xc01e('0x6c')](_0xe80801)){logger['debug'](_0xc01e('0x9a'),_0xe80801[_0xc01e('0x4e')],util['inspect'](_0xe80801,{'showHidden':![],'depth':null}));if(this[_0xc01e('0x12')][_0xe80801['uniqueid']]){var _0x55dd99=_[_0xc01e('0x8a')](this[_0xc01e('0x12')][_0xe80801['uniqueid']]);_0x55dd99[_0xc01e('0x8b')]=!![];_0x55dd99['queuecallerexitreason']=_0xc01e('0x9b');logger['info'](_0xc01e('0x9c'),_0x55dd99[_0xc01e('0x56')],_0x55dd99[_0xc01e('0x5a')]);}}}catch(_0x5163e2){logger[_0xc01e('0x41')](_0xc01e('0x9a'),_0xe80801[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x5163e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01e('0xd')][_0xc01e('0x22')]=function(_0x4da88b){try{if(this[_0xc01e('0x6c')](_0x4da88b)){logger[_0xc01e('0x4b')](_0xc01e('0x9d'),_0x4da88b[_0xc01e('0x4e')],util['inspect'](_0x4da88b,{'showHidden':![],'depth':null}));if(this[_0xc01e('0x12')][_0x4da88b['uniqueid']]){var _0x3a35ca=_[_0xc01e('0x8a')](this[_0xc01e('0x12')][_0x4da88b[_0xc01e('0x4e')]]);_0x3a35ca[_0xc01e('0x1f')]=![];_0x3a35ca[_0xc01e('0x8f')]=null;_0x3a35ca[_0xc01e('0x9e')]=!![];_0x3a35ca['lastAssignedTo']=_0x4da88b[_0xc01e('0x9f')];_0x3a35ca[_0xc01e('0x8d')]=_0x4da88b[_0xc01e('0x8d')];_0x3a35ca[_0xc01e('0x8b')]=!![];_0x3a35ca[_0xc01e('0xa0')]=![];_0x3a35ca['queuecallerexitAt']=null;if(!_0x3a35ca[_0xc01e('0xa1')]){if(_0x4da88b['reason']==_0xc01e('0xa1')){_0x3a35ca[_0xc01e('0x54')]=_0xc01e('0xa2');logger[_0xc01e('0x76')](_0xc01e('0xa3'),_0x3a35ca[_0xc01e('0x56')],_0x3a35ca[_0xc01e('0x5a')]);}else{if(_['startsWith'](_0x4da88b[_0xc01e('0x3e')]['toLowerCase'](),_0xc01e('0xa4'))){if(this['queueReports'][_0x4da88b[_0xc01e('0xa5')]]){var _0x1c64d4=_[_0xc01e('0x8a')](this[_0xc01e('0x12')][_0x4da88b[_0xc01e('0xa5')]]);_0x1c64d4[_0xc01e('0x8b')]=![];_0x1c64d4[_0xc01e('0xa0')]=!![];_0x1c64d4['queuecallerexitAt']=moment(_0x3a35ca[_0xc01e('0xa6')])[_0xc01e('0xa7')](_0x4da88b[_0xc01e('0x8d')],_0xc01e('0xa8'))[_0xc01e('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c64d4['queuecallerexitreason']='FORWARDTRANSFER';_0x1c64d4['transfer']=!![];_0x1c64d4['transfertype']=_0xc01e('0xa9');_0x1c64d4[_0xc01e('0xaa')]=_0x4da88b['destexten'];_0x1c64d4[_0xc01e('0xab')]=_0x4da88b[_0xc01e('0x4e')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1c64d4[_0xc01e('0x56')],_0x1c64d4[_0xc01e('0x5a')]);var _0x2f56b5=this['queueReports'][_0x4da88b[_0xc01e('0xa5')]];this[_0xc01e('0x12')][_0x4da88b['linkedid']]=this[_0xc01e('0x12')][_0x4da88b[_0xc01e('0x4e')]];this[_0xc01e('0x12')][_0x4da88b[_0xc01e('0x4e')]]=_0x2f56b5;}}else{_0x3a35ca['queuecallerexitreason']='COMPLETEDBY'+_0x4da88b[_0xc01e('0xac')][_0xc01e('0xad')]();logger[_0xc01e('0x76')](_0xc01e('0xae'),_0x3a35ca[_0xc01e('0x56')],_0x3a35ca[_0xc01e('0x5a')],_0x3a35ca['queuecallerexitreason']);}}}this[_0xc01e('0x14')][_0x4da88b[_0xc01e('0x4e')]]=_0x3a35ca;this[_0xc01e('0x52')](_0x3a35ca,_0xc01e('0xaf'));}}}catch(_0xa87f4c){logger[_0xc01e('0x41')](_0xc01e('0x9d'),_0x4da88b[_0xc01e('0x4e')],util['inspect'](_0xa87f4c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01e('0xd')]['syncVarSet']=function(_0x1b48ef){try{if(this['isNotNull'](_0x1b48ef)){logger[_0xc01e('0x4b')](_0xc01e('0xb0'),_0x1b48ef[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x1b48ef,{'showHidden':![],'depth':null}));this[_0xc01e('0xb1')](_0x1b48ef[_0xc01e('0x4e')],_['keys'](_0x1b48ef[_0xc01e('0xb2')])[0x0],_0x1b48ef[_0xc01e('0xb3')]);if(this[_0xc01e('0x12')][_0x1b48ef[_0xc01e('0x4e')]]){var _0x4ed659=_['last'](this[_0xc01e('0x12')][_0x1b48ef['uniqueid']]);if(_0x4ed659){if(this['isNotNull'](_0x1b48ef[_0xc01e('0xb2')])&&this[_0xc01e('0x6c')](_0x1b48ef[_0xc01e('0xb2')][_0xc01e('0xb4')])){switch(_0x1b48ef['value']){case _0xc01e('0xb5'):_0x4ed659['queuecallerexit']=![];_0x4ed659[_0xc01e('0xb6')]=null;break;case _0xc01e('0xb7'):_0x4ed659[_0xc01e('0xb8')]=_0xc01e('0xb9');_0x4ed659[_0xc01e('0xa0')]=!![];_0x4ed659[_0xc01e('0xb6')]=moment()['format'](_0xc01e('0x90'));_0x4ed659[_0xc01e('0xba')]=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));logger[_0xc01e('0x4b')](_0xc01e('0xbb'),_0x1b48ef['uniqueid'],util[_0xc01e('0x43')](_0x4ed659,{'showHidden':![],'depth':null}));ami[_0xc01e('0x4a')](_0xc01e('0xbc'),_0x4ed659);break;default:_0x4ed659[_0xc01e('0xa0')]=!![];_0x4ed659[_0xc01e('0xb6')]=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));_0x4ed659[_0xc01e('0xba')]=moment()[_0xc01e('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ed659[_0xc01e('0x1f')]=![];_0x4ed659[_0xc01e('0x8f')]=null;_0x4ed659['queuecallerexitreason']=_0x1b48ef[_0xc01e('0xb3')];this['channels'][_0x1b48ef[_0xc01e('0x4e')]]=_0x4ed659;this['emitVoiceQueueChannelRemove'](_0x4ed659,_0xc01e('0x25'));}else if(this[_0xc01e('0x6c')](_0x1b48ef[_0xc01e('0xb2')])&&this[_0xc01e('0x6c')](_0x1b48ef[_0xc01e('0xb2')][_0xc01e('0xbd')])){if(!_0x4ed659['queuecallerabandon']){_0x4ed659[_0xc01e('0xa0')]=!![];_0x4ed659[_0xc01e('0xb6')]=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));_0x4ed659['queuecallerexitreason']=_0xc01e('0xbe');_0x4ed659[_0xc01e('0xba')]=moment()[_0xc01e('0x4f')](_0xc01e('0x90'));this[_0xc01e('0x14')][_0x1b48ef[_0xc01e('0x4e')]]=_0x4ed659;}}logger[_0xc01e('0x76')](_0xc01e('0xbf'),_0x1b48ef[_0xc01e('0x4e')],_0x4ed659[_0xc01e('0x56')],_0x4ed659['type'],_['keys'](_0x1b48ef['variable'])[0x0],_0x1b48ef[_0xc01e('0xb3')]);_0x4ed659[_0xc01e('0x45')]=this[_0xc01e('0x45')][_0x1b48ef[_0xc01e('0x4e')]];}}}}catch(_0x436890){logger['error'](_0xc01e('0xb0'),_0x1b48ef[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x436890,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01e('0xd')][_0xc01e('0xb1')]=function(_0x5511a0,_0x597f13,_0x498635){var _0x19229c=[_0xc01e('0xc0'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xc01e('0xc1'),'rtpaudioqosloss',_0xc01e('0xc2'),_0xc01e('0xc3'),'rtpaudioqosrttbridged',_0xc01e('0xc4'),_0xc01e('0xc5'),_0xc01e('0xc6'),_0xc01e('0xc7'),'membercalls',_0xc01e('0xc8'),_0xc01e('0xc9'),_0xc01e('0xca'),_0xc01e('0x9f'),_0xc01e('0xcb'),_0xc01e('0xcc')];if(!_[_0xc01e('0x3c')](_0x597f13)&&!_[_0xc01e('0xcd')](_0x19229c,_0x597f13)){if(_['isUndefined'](this[_0xc01e('0x45')][_0x5511a0])){this[_0xc01e('0x45')][_0x5511a0]={};}this[_0xc01e('0x45')][_0x5511a0][_0x597f13]=_0x498635;}};VoiceQueueReport[_0xc01e('0xd')][_0xc01e('0x28')]=function(_0x18ab17){try{if(this[_0xc01e('0x6c')](_0x18ab17)){logger['debug'](_0xc01e('0xce'),_0x18ab17[_0xc01e('0x4e')],util[_0xc01e('0x43')](_0x18ab17,{'showHidden':![],'depth':null}));if(this[_0xc01e('0x12')][_0x18ab17[_0xc01e('0x4e')]]){for(var _0x328925=0x0,_0x234d40={};_0x3289250x0?_0x5961a7:0x0;this[_0x19d2('0x11')][_0x3567eb[_0x19d2('0x67')]][_0x19d2('0x2e')]=this[_0x19d2('0x11')][_0x3567eb['queue']][_0x19d2('0x2e')]>_['toNumber'](_0x3567eb['loggedin'])?_['toNumber'](_0x3567eb[_0x19d2('0x6c')]):this[_0x19d2('0x11')][_0x3567eb[_0x19d2('0x67')]][_0x19d2('0x2e')];this[_0x19d2('0x6e')](this['voiceQueues'][_0x3567eb[_0x19d2('0x67')]],_0x19d2('0x14'));}logger['debug'](_0x19d2('0x6f'),util[_0x19d2('0x3c')](this[_0x19d2('0x11')][_0x3567eb[_0x19d2('0x67')]],{'showHidden':![],'depth':null}));ami[_0x19d2('0x42')](_0x19d2('0x70'),this[_0x19d2('0x11')][_0x3567eb[_0x19d2('0x67')]]);}}}catch(_0x325562){logger[_0x19d2('0x3b')](_0x19d2('0x71'),util[_0x19d2('0x3c')](_0x325562,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x17')]=function(_0x924568){logger[_0x19d2('0x43')](_0x19d2('0x72'),util[_0x19d2('0x3c')](_0x924568,{'showHidden':![],'depth':null}));this[_0x19d2('0x12')]=!![];};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x1a')]=function(_0xd09d03){try{if(this['isNotNull'](_0xd09d03)){logger[_0x19d2('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0xd09d03[_0x19d2('0x46')],util['inspect'](_0xd09d03,{'showHidden':![],'depth':null}));if(_[_0x19d2('0x61')](this[_0x19d2('0xe')][_0xd09d03['uniqueid']]))this['queueReports'][_0xd09d03[_0x19d2('0x46')]]=[];if(_[_0x19d2('0x61')](this[_0x19d2('0x34')][_0xd09d03['uniqueid']]))this[_0x19d2('0x34')][_0xd09d03['uniqueid']]={};var _0x2497f9=new QueueReport();_0x2497f9[_0x19d2('0x49')]=_0xd09d03[_0x19d2('0x67')];_0x2497f9[_0x19d2('0x57')]=this['voiceQueues'][_0x2497f9['name']]&&this[_0x19d2('0x11')][_0x2497f9['name']]['type']?this[_0x19d2('0x11')][_0x2497f9[_0x19d2('0x49')]]['type']||_0x19d2('0x50'):_0x19d2('0x50');_0x2497f9[_0x19d2('0x67')]=_0xd09d03[_0x19d2('0x67')];_0x2497f9[_0x19d2('0x73')]=moment()[_0x19d2('0x47')](_0x19d2('0x74'));_0x2497f9[_0x19d2('0x75')]=_0xd09d03['position'];_0x2497f9[_0x19d2('0x76')]=_0xd09d03[_0x19d2('0x76')];_0x2497f9[_0x19d2('0x46')]=_0xd09d03[_0x19d2('0x46')];_0x2497f9['routealias']=this['channels'][_0xd09d03[_0x19d2('0x46')]]['routealias'];logger[_0x19d2('0x68')](_0x19d2('0x77'),_0x2497f9[_0x19d2('0x49')],_0x2497f9[_0x19d2('0x57')]);_['merge'](_0x2497f9,_['pick'](_0xd09d03,_[_0x19d2('0x78')](_0x2497f9)));this[_0x19d2('0xe')][_0xd09d03['uniqueid']][_0x19d2('0x79')](_0x2497f9);this[_0x19d2('0x34')][_0xd09d03[_0x19d2('0x46')]]=_0x2497f9;this['emitVoiceQueueChannelSave'](_0x2497f9,_0x19d2('0x19'));}}catch(_0x5ddf48){logger['error'](_0x19d2('0x7a'),_0xd09d03[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x5ddf48,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x7b')]=function(_0x39e771){try{if(this[_0x19d2('0x65')](_0x39e771)){logger[_0x19d2('0x43')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39e771[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x39e771,{'showHidden':![],'depth':null}));if(this[_0x19d2('0xe')][_0x39e771['uniqueid']]){var _0x218d4b=_[_0x19d2('0x7c')](this[_0x19d2('0xe')][_0x39e771[_0x19d2('0x46')]]);_0x218d4b[_0x19d2('0x7d')]=![];_0x218d4b['queuecallercompleteAt']=null;_0x218d4b['holdtime']=_0x39e771[_0x19d2('0x7e')];_0x218d4b[_0x19d2('0x7f')]=_0x39e771['originalposition'];_0x218d4b['queuecallerabandon']=!![];_0x218d4b[_0x19d2('0x80')]=moment()[_0x19d2('0x47')](_0x19d2('0x74'));_0x218d4b[_0x19d2('0x4d')]=_0x19d2('0x81');_0x218d4b[_0x19d2('0x82')]=null;logger[_0x19d2('0x68')](_0x19d2('0x83'),_0x218d4b['name'],_0x218d4b[_0x19d2('0x57')]);this[_0x19d2('0x34')][_0x39e771[_0x19d2('0x46')]]=_0x218d4b;this[_0x19d2('0x4c')](_0x218d4b,'queuecallerabandon');}}}catch(_0x54259a){logger[_0x19d2('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39e771[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x54259a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x1b')]=function(_0x1a457b){try{if(this[_0x19d2('0x65')](_0x1a457b)){logger['debug'](_0x19d2('0x84'),_0x1a457b['uniqueid'],util[_0x19d2('0x3c')](_0x1a457b,{'showHidden':![],'depth':null}));if(this[_0x19d2('0xe')][_0x1a457b['uniqueid']]){var _0x570c12=_['last'](this[_0x19d2('0xe')][_0x1a457b[_0x19d2('0x46')]]);_0x570c12['queuecallerleaveAt']=moment()[_0x19d2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x570c12[_0x19d2('0x85')]=_0x1a457b[_0x19d2('0x85')];_0x570c12[_0x19d2('0x86')]=_0x1a457b[_0x19d2('0x86')];logger[_0x19d2('0x68')](_0x19d2('0x87'),_0x570c12[_0x19d2('0x49')],_0x570c12['type'],_0x1a457b['connectedlinenum'],_0x1a457b['connectedlinename']);this['channels'][_0x1a457b[_0x19d2('0x46')]]=_0x570c12;this[_0x19d2('0x88')](_0x570c12,_0x19d2('0x89'));}}}catch(_0x14016f){logger[_0x19d2('0x3b')](_0x19d2('0x84'),_0x1a457b[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x14016f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x19d2('0x1e')]=function(_0x228cbb){try{if(this[_0x19d2('0x65')](_0x228cbb)){logger['debug'](_0x19d2('0x8a'),_0x228cbb[_0x19d2('0x46')],util['inspect'](_0x228cbb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x228cbb[_0x19d2('0x46')]]){var _0x409cb1=_[_0x19d2('0x7c')](this[_0x19d2('0xe')][_0x228cbb[_0x19d2('0x46')]]);_0x409cb1['queuecallercomplete']=!![];_0x409cb1[_0x19d2('0x4d')]=_0x19d2('0x8b');logger[_0x19d2('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x409cb1['name'],_0x409cb1['type']);}}}catch(_0x49e6b3){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x228cbb[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x49e6b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x1d')]=function(_0x2c1107){try{if(this[_0x19d2('0x65')](_0x2c1107)){logger[_0x19d2('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x2c1107['uniqueid'],util[_0x19d2('0x3c')](_0x2c1107,{'showHidden':![],'depth':null}));if(this[_0x19d2('0xe')][_0x2c1107[_0x19d2('0x46')]]){var _0x1944fc=_[_0x19d2('0x7c')](this[_0x19d2('0xe')][_0x2c1107[_0x19d2('0x46')]]);_0x1944fc[_0x19d2('0x8c')]=![];_0x1944fc[_0x19d2('0x80')]=null;_0x1944fc[_0x19d2('0x8d')]=!![];_0x1944fc['lastAssignedTo']=_0x2c1107[_0x19d2('0x8e')];_0x1944fc[_0x19d2('0x7e')]=_0x2c1107[_0x19d2('0x7e')];_0x1944fc[_0x19d2('0x7d')]=!![];_0x1944fc[_0x19d2('0x8f')]=![];_0x1944fc[_0x19d2('0x90')]=null;if(!_0x1944fc[_0x19d2('0x91')]){if(_0x2c1107['reason']==_0x19d2('0x91')){_0x1944fc[_0x19d2('0x4d')]='COMPLETED';logger[_0x19d2('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1944fc[_0x19d2('0x49')],_0x1944fc['type']);}else{if(_[_0x19d2('0x92')](_0x2c1107['channel']['toLowerCase'](),_0x19d2('0x93'))){if(this[_0x19d2('0xe')][_0x2c1107['linkedid']]){var _0x1a39ad=_[_0x19d2('0x7c')](this[_0x19d2('0xe')][_0x2c1107[_0x19d2('0x94')]]);_0x1a39ad[_0x19d2('0x7d')]=![];_0x1a39ad[_0x19d2('0x8f')]=!![];_0x1a39ad[_0x19d2('0x90')]=moment(_0x1944fc['queuecallerjoinAt'])[_0x19d2('0x95')](_0x2c1107[_0x19d2('0x7e')],'seconds')[_0x19d2('0x47')](_0x19d2('0x74'));_0x1a39ad[_0x19d2('0x4d')]=_0x19d2('0x96');_0x1a39ad[_0x19d2('0x91')]=!![];_0x1a39ad[_0x19d2('0x97')]=_0x19d2('0x98');_0x1a39ad[_0x19d2('0x99')]=_0x2c1107[_0x19d2('0x9a')];_0x1a39ad[_0x19d2('0x9b')]=_0x2c1107['uniqueid'];logger[_0x19d2('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1a39ad[_0x19d2('0x49')],_0x1a39ad['type']);var _0xe2d179=this['queueReports'][_0x2c1107['linkedid']];this[_0x19d2('0xe')][_0x2c1107[_0x19d2('0x94')]]=this[_0x19d2('0xe')][_0x2c1107['uniqueid']];this[_0x19d2('0xe')][_0x2c1107[_0x19d2('0x46')]]=_0xe2d179;}}else{_0x1944fc[_0x19d2('0x4d')]='COMPLETEDBY'+_0x2c1107['reason'][_0x19d2('0x9c')]();logger[_0x19d2('0x68')](_0x19d2('0x9d'),_0x1944fc[_0x19d2('0x49')],_0x1944fc[_0x19d2('0x57')],_0x1944fc[_0x19d2('0x4d')]);}}}this[_0x19d2('0x34')][_0x2c1107[_0x19d2('0x46')]]=_0x1944fc;this[_0x19d2('0x4c')](_0x1944fc,_0x19d2('0x1c'));}}}catch(_0x2e84e3){logger[_0x19d2('0x3b')]('[%s][voiceQueueReport][agentcomplete]',_0x2c1107[_0x19d2('0x46')],util['inspect'](_0x2e84e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x9e')]=function(_0x3b98cc){try{if(this[_0x19d2('0x65')](_0x3b98cc)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3b98cc[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x3b98cc,{'showHidden':![],'depth':null}));this[_0x19d2('0x9f')](_0x3b98cc[_0x19d2('0x46')],_['keys'](_0x3b98cc[_0x19d2('0xa0')])[0x0],_0x3b98cc[_0x19d2('0xa1')]);if(this[_0x19d2('0xe')][_0x3b98cc[_0x19d2('0x46')]]){var _0x1235a5=_[_0x19d2('0x7c')](this['queueReports'][_0x3b98cc[_0x19d2('0x46')]]);if(_0x1235a5){if(this['isNotNull'](_0x3b98cc[_0x19d2('0xa0')])&&this['isNotNull'](_0x3b98cc[_0x19d2('0xa0')]['queuestatus'])){switch(_0x3b98cc['value']){case'CONTINUE':_0x1235a5[_0x19d2('0x8f')]=![];_0x1235a5[_0x19d2('0x90')]=null;break;case _0x19d2('0xa2'):_0x1235a5['lastevent']=_0x19d2('0xa3');_0x1235a5[_0x19d2('0x8f')]=!![];_0x1235a5['queuecallerexitAt']=moment()[_0x19d2('0x47')](_0x19d2('0x74'));_0x1235a5[_0x19d2('0xa4')]=moment()['format'](_0x19d2('0x74'));logger[_0x19d2('0x43')](_0x19d2('0xa5'),_0x3b98cc[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x1235a5,{'showHidden':![],'depth':null}));ami[_0x19d2('0x42')](_0x19d2('0xa6'),_0x1235a5);break;default:_0x1235a5['queuecallerexit']=!![];_0x1235a5['queuecallerexitAt']=moment()['format'](_0x19d2('0x74'));_0x1235a5[_0x19d2('0xa4')]=moment()[_0x19d2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1235a5[_0x19d2('0x8c')]=![];_0x1235a5[_0x19d2('0x80')]=null;_0x1235a5[_0x19d2('0x4d')]=_0x3b98cc[_0x19d2('0xa1')];this[_0x19d2('0x34')][_0x3b98cc['uniqueid']]=_0x1235a5;this[_0x19d2('0x4c')](_0x1235a5,_0x19d2('0x1f'));}else if(this[_0x19d2('0x65')](_0x3b98cc[_0x19d2('0xa0')])&&this['isNotNull'](_0x3b98cc[_0x19d2('0xa0')]['queueposition'])){if(!_0x1235a5[_0x19d2('0x8c')]){_0x1235a5[_0x19d2('0x8f')]=!![];_0x1235a5[_0x19d2('0x90')]=moment()[_0x19d2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1235a5[_0x19d2('0x4d')]=_0x19d2('0xa7');_0x1235a5['queuecallerleaveAt']=moment()['format'](_0x19d2('0x74'));this[_0x19d2('0x34')][_0x3b98cc[_0x19d2('0x46')]]=_0x1235a5;}}logger['info'](_0x19d2('0xa8'),_0x3b98cc[_0x19d2('0x46')],_0x1235a5['name'],_0x1235a5['type'],_[_0x19d2('0x78')](_0x3b98cc['variable'])[0x0],_0x3b98cc[_0x19d2('0xa1')]);_0x1235a5['variables']=this['variables'][_0x3b98cc[_0x19d2('0x46')]];}}}}catch(_0x10ce75){logger['error'](_0x19d2('0xa9'),_0x3b98cc[_0x19d2('0x46')],util[_0x19d2('0x3c')](_0x10ce75,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0x9f')]=function(_0x2eaad8,_0xd941d4,_0x336418){var _0x12ba1b=[_0x19d2('0xaa'),_0x19d2('0xab'),_0x19d2('0xac'),_0x19d2('0xad'),_0x19d2('0xae'),'rtpaudioqoslossbridged',_0x19d2('0xaf'),_0x19d2('0xb0'),_0x19d2('0xb1'),_0x19d2('0xb2'),'bridgepeer','bridgepvtcallid',_0x19d2('0xb3'),_0x19d2('0xb4'),_0x19d2('0xb5'),_0x19d2('0xb6'),_0x19d2('0x8e'),_0x19d2('0xb7'),_0x19d2('0xb8')];if(!_[_0x19d2('0x36')](_0xd941d4)&&!_[_0x19d2('0xb9')](_0x12ba1b,_0xd941d4)){if(_[_0x19d2('0x61')](this[_0x19d2('0x3e')][_0x2eaad8])){this[_0x19d2('0x3e')][_0x2eaad8]={};}this[_0x19d2('0x3e')][_0x2eaad8][_0xd941d4]=_0x336418;}};VoiceQueueReport[_0x19d2('0x32')][_0x19d2('0xba')]=function(_0x12104f){try{if(this['isNotNull'](_0x12104f)){logger[_0x19d2('0x43')]('[%s][voiceQueueReport][hangup]',_0x12104f[_0x19d2('0x46')],util['inspect'](_0x12104f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12104f['uniqueid']]){for(var _0x480fab=0x0,_0x163396={};_0x480fab=0x0?moment(_0x299685[_0x0d63('0x1b')])[_0x0d63('0xf')](_0x299685['starttime'],'seconds'):null,'data1':_0x0d63('0x1c'),'data2':_0x299685[_0x0d63('0x15')],'data3':_0x299685[_0x0d63('0x1d')],'data4':_0x299685['dialstring']||null,'role':_0x0d63('0x14'),'internal':_0x299685['accountcode']?_[_0x0d63('0x16')](_0x299685['accountcode']):undefined,'uniqueid':_0x299685[_0x0d63('0x17')]},'log':_0x0d63('0x18')});}; \ No newline at end of file +var _0x62b9=['membername','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport'];(function(_0x51ef2b,_0x160e0d){var _0x3ccb42=function(_0x50299b){while(--_0x50299b){_0x51ef2b['push'](_0x51ef2b['shift']());}};_0x3ccb42(++_0x160e0d);}(_0x62b9,0xe5));var _0x962b=function(_0x23163e,_0xad54c8){_0x23163e=_0x23163e-0x0;var _0x1934a9=_0x62b9[_0x23163e];return _0x1934a9;};'use strict';var moment=require(_0x962b('0x0'));var _=require(_0x962b('0x1'));var util=require(_0x962b('0x2'));var client=require(_0x962b('0x3'));exports[_0x962b('0x4')]=function(_0x194b77){var _0x1ad012=_0x194b77['queuecallercompleteAt']||_0x194b77[_0x962b('0x5')];return client[_0x962b('0x6')]('CreateMemberReport',{'body':{'channel':_0x962b('0x7'),'membername':_0x194b77[_0x962b('0x8')],'interface':_[_0x962b('0x9')](_0x194b77['interface'])?util[_0x962b('0xa')](_0x962b('0xb'),_0x194b77[_0x962b('0x8')]):_0x194b77[_0x962b('0xc')],'type':_0x962b('0xd'),'enterAt':_0x194b77[_0x962b('0xe')],'exitAt':_0x1ad012,'duration':moment(_0x1ad012)[_0x962b('0xf')](_0x194b77[_0x962b('0xe')],_0x962b('0x10')),'data1':_0x962b('0x11'),'data2':_0x194b77[_0x962b('0x12')],'data3':_0x194b77[_0x962b('0x13')],'data4':null,'data5':_0x194b77[_0x962b('0x14')],'role':_0x962b('0x15'),'internal':_0x194b77[_0x962b('0x16')]?_[_0x962b('0x17')](_0x194b77[_0x962b('0x16')]):undefined,'uniqueid':_0x194b77[_0x962b('0x18')]},'log':_0x962b('0x19')});};exports[_0x962b('0x1a')]=function(_0x2602ea){return client[_0x962b('0x6')](_0x962b('0x19'),{'body':{'channel':_0x962b('0x7'),'membername':_0x2602ea[_0x962b('0x1b')],'interface':_0x2602ea[_0x962b('0xc')],'type':_0x962b('0xd'),'enterAt':_0x2602ea['starttime'],'exitAt':_0x2602ea['endtime'],'duration':moment(_0x2602ea[_0x962b('0x1c')])[_0x962b('0xf')](_0x2602ea[_0x962b('0x1d')],_0x962b('0x10'))>=0x0?moment(_0x2602ea[_0x962b('0x1c')])[_0x962b('0xf')](_0x2602ea[_0x962b('0x1d')],_0x962b('0x10')):null,'data1':_0x962b('0x1e'),'data2':_0x2602ea['accountcode'],'data3':_0x2602ea[_0x962b('0x13')],'data4':_0x2602ea[_0x962b('0x1f')]||null,'role':_0x962b('0x15'),'internal':_0x2602ea['accountcode']?_[_0x962b('0x17')](_0x2602ea[_0x962b('0x16')]):undefined,'uniqueid':_0x2602ea[_0x962b('0x18')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e2ac57a..46704b4 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 _0x4dfc=['previewRecallmeReminderInterval','GetSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x4dfc,0xda));var _0xc4df=function(_0x38fbc2,_0x641aa1){_0x38fbc2=_0x38fbc2-0x0;var _0x43c7d4=_0x4dfc[_0x38fbc2];return _0x43c7d4;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request'](_0xc4df('0x0'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc4df('0x1'),_0xc4df('0x2')]},'log':_0xc4df('0x3')});}; \ No newline at end of file +var _0x3166=['previewRecallmeReminderInterval','GetSettings','getSettings','Request','ShowSetting'];(function(_0x29df36,_0x35d704){var _0x13ba21=function(_0x120bda){while(--_0x120bda){_0x29df36['push'](_0x29df36['shift']());}};_0x13ba21(++_0x35d704);}(_0x3166,0xbb));var _0x6316=function(_0x57e369,_0x447060){_0x57e369=_0x57e369-0x0;var _0x5f3b8e=_0x3166[_0x57e369];return _0x5f3b8e;};'use strict';var client=require('../client');exports[_0x6316('0x0')]=function(){return client[_0x6316('0x1')](_0x6316('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6316('0x3')]},'log':_0x6316('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 11321c6..7c59d0e 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 _0xd35e=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x43f2d0,_0x56ac4e){var _0x1fa5a2=function(_0x225e57){while(--_0x225e57){_0x43f2d0['push'](_0x43f2d0['shift']());}};_0x1fa5a2(++_0x56ac4e);}(_0xd35e,0x14a));var _0xed35=function(_0x335ef5,_0x1a74a9){_0x335ef5=_0x335ef5-0x0;var _0xc51af9=_0xd35e[_0x335ef5];return _0xc51af9;};'use strict';var client=require(_0xed35('0x0'));exports[_0xed35('0x1')]=function(_0x2e9f27){return function(_0x449514){return client[_0xed35('0x2')](_0xed35('0x3'),{'options':{'raw':!![],'attributes':['id',_0xed35('0x4'),_0xed35('0x5')]},'log':_0xed35('0x3')});};}; \ No newline at end of file +var _0xf9f6=['html','GetTemplate','name'];(function(_0x3245f7,_0x26bfad){var _0x472f77=function(_0x391589){while(--_0x391589){_0x3245f7['push'](_0x3245f7['shift']());}};_0x472f77(++_0x26bfad);}(_0xf9f6,0x1a5));var _0x6f9f=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xf9f6[_0x4d45c1];return _0x244478;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x7c3ac){return function(_0x17e03a){return client['Request'](_0x6f9f('0x0'),{'options':{'raw':!![],'attributes':['id',_0x6f9f('0x1'),_0x6f9f('0x2')]},'log':_0x6f9f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 602d223..acc354a 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 _0xb041=['Actions','action','data1','data2','data3','data5','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','operator','Action'];(function(_0x4c00e1,_0xa87c75){var _0x498951=function(_0x5231ae){while(--_0x5231ae){_0x4c00e1['push'](_0x4c00e1['shift']());}};_0x498951(++_0xa87c75);}(_0xb041,0x10b));var _0x1b04=function(_0x5e3287,_0x3f35ad){_0x5e3287=_0x5e3287-0x0;var _0x48b04d=_0xb041[_0x5e3287];return _0x48b04d;};'use strict';var client=require(_0x1b04('0x0'));exports[_0x1b04('0x1')]=function(_0x19384a){return function(_0x302222){return client[_0x1b04('0x2')](_0x1b04('0x3'),{'options':{'raw':![],'attributes':['id',_0x1b04('0x4'),_0x1b04('0x5'),_0x1b04('0x6')],'include':[{'model':_0x1b04('0x7'),'as':_0x1b04('0x8'),'attributes':['id',_0x1b04('0x9'),'operator',_0x1b04('0xa')]},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0x1b04('0xb'),_0x1b04('0xa')]},{'model':_0x1b04('0xc'),'as':_0x1b04('0xd'),'attributes':['id',_0x1b04('0xe'),_0x1b04('0xf'),_0x1b04('0x10'),_0x1b04('0x11'),'data4',_0x1b04('0x12'),_0x1b04('0x13'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x874c=['action','data1','data2','data3','data6','data7','GetTrigger','getTriggers','Request','status','Condition','AllConditions','operator','AnyConditions','field','value'];(function(_0x5393fe,_0x2410ca){var _0x2996f3=function(_0x1707d8){while(--_0x1707d8){_0x5393fe['push'](_0x5393fe['shift']());}};_0x2996f3(++_0x2410ca);}(_0x874c,0x107));var _0xc874=function(_0x56c039,_0x19c00f){_0x56c039=_0x56c039-0x0;var _0x15f31e=_0x874c[_0x56c039];return _0x15f31e;};'use strict';var client=require('../client');exports[_0xc874('0x0')]=function(_0x2d32c1){return function(_0x1bef28){return client[_0xc874('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0xc874('0x2')],'include':[{'model':_0xc874('0x3'),'as':_0xc874('0x4'),'attributes':['id','field',_0xc874('0x5'),'value']},{'model':_0xc874('0x3'),'as':_0xc874('0x6'),'attributes':['id',_0xc874('0x7'),_0xc874('0x5'),_0xc874('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0xc874('0x9'),_0xc874('0xa'),_0xc874('0xb'),_0xc874('0xc'),'data4','data5',_0xc874('0xd'),_0xc874('0xe')]}]},'log':_0xc874('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index aa1a865..75d24ed 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 _0x6658=['../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x1e259c,_0x27c300){var _0x16d6e8=function(_0x2f345c){while(--_0x2f345c){_0x1e259c['push'](_0x1e259c['shift']());}};_0x16d6e8(++_0x27c300);}(_0x6658,0x198));var _0x8665=function(_0x35f6ff,_0x52f92f){_0x35f6ff=_0x35f6ff-0x0;var _0x59b239=_0x6658[_0x35f6ff];return _0x59b239;};'use strict';var client=require(_0x8665('0x0'));exports[_0x8665('0x1')]=function(_0x2d027a){return function(_0x1a6b0b){return client[_0x8665('0x2')](_0x8665('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8665('0x4'),_0x8665('0x5'),'defaultuser']},'log':_0x8665('0x3')});};}; \ No newline at end of file +var _0x9374=['getTrunks','GetTrunk','registry','defaultuser'];(function(_0x3b6d83,_0x38277b){var _0x2cac4f=function(_0x4dd73f){while(--_0x4dd73f){_0x3b6d83['push'](_0x3b6d83['shift']());}};_0x2cac4f(++_0x38277b);}(_0x9374,0x1ac));var _0x4937=function(_0x291d3d,_0x744ad5){_0x291d3d=_0x291d3d-0x0;var _0x36e564=_0x9374[_0x291d3d];return _0x36e564;};'use strict';var client=require('../client');exports[_0x4937('0x0')]=function(_0x294169){return function(_0x7ae017){return client['Request'](_0x4937('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4937('0x2'),_0x4937('0x3')]},'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 646e468..1cf96e1 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 _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe706,0xa3));var _0x6e70=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0xe706[_0x2e5a17];return _0x24f53d;};'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 +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(_0x33f153,_0x39d65d){_0x33f153=_0x33f153-0x0;var _0x12ac15=_0xe706[_0x33f153];return _0x12ac15;};'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 7e745e9..21816c1 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 _0x1740=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x2e8b61,_0x214d43){var _0x1c1165=function(_0x40c08b){while(--_0x40c08b){_0x2e8b61['push'](_0x2e8b61['shift']());}};_0x1c1165(++_0x214d43);}(_0x1740,0x6e));var _0x0174=function(_0x45ec64,_0x558688){_0x45ec64=_0x45ec64-0x0;var _0x596452=_0x1740[_0x45ec64];return _0x596452;};'use strict';var client=require(_0x0174('0x0'));exports['create']=function(_0x1bd00f){return client[_0x0174('0x1')](_0x0174('0x2'),{'body':_0x1bd00f,'log':_0x0174('0x2')});};exports[_0x0174('0x3')]=function(_0x317681,_0x2007d1,_0x5c860d){return client[_0x0174('0x1')]('UpdateVoiceAgentReport',{'body':_0x317681,'options':{'where':{'uniqueid':_0x2007d1,'interface':_0x5c860d,'agentcomplete':!![]}},'log':_0x0174('0x4')});}; \ No newline at end of file +var _0x1cf8=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x7585af,_0x2764b6){var _0x30c8a8=function(_0xbdbe9){while(--_0xbdbe9){_0x7585af['push'](_0x7585af['shift']());}};_0x30c8a8(++_0x2764b6);}(_0x1cf8,0x19b));var _0x81cf=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x1cf8[_0x23c73d];return _0x36ba47;};'use strict';var client=require(_0x81cf('0x0'));exports[_0x81cf('0x1')]=function(_0xa9b1ed){return client[_0x81cf('0x2')](_0x81cf('0x3'),{'body':_0xa9b1ed,'log':_0x81cf('0x3')});};exports['update']=function(_0x4f0c85,_0x5e4326,_0x54c690){return client[_0x81cf('0x2')](_0x81cf('0x4'),{'body':_0x4f0c85,'options':{'where':{'uniqueid':_0x5e4326,'interface':_0x54c690,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 75188ff..a5347ab 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 _0x70eb=['duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','context','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x19b3f8,_0x150751){var _0x22c3a1=function(_0x16bf0a){while(--_0x16bf0a){_0x19b3f8['push'](_0x19b3f8['shift']());}};_0x22c3a1(++_0x150751);}(_0x70eb,0x1f0));var _0xb70e=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x70eb[_0x5416db];return _0x243e35;};'use strict';var moment=require('moment');var util=require(_0xb70e('0x0'));var _=require(_0xb70e('0x1'));var client=require(_0xb70e('0x2'));exports['create']=function(_0x1e4725){return client[_0xb70e('0x3')](_0xb70e('0x4'),{'body':_['merge'](_0x1e4725,{'source':_0x1e4725['calleridnum'],'destinationcontext':_0x1e4725[_0xb70e('0x5')],'callerid':_0x1e4725['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xb70e('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xb70e('0x3')](_0xb70e('0x6'),{'options':{'where':{'type':[_0xb70e('0x7')],'createdAt':{'$between':[moment()[_0xb70e('0x8')](_0xb70e('0x9'))[_0xb70e('0xa')](_0xb70e('0xb')),moment()[_0xb70e('0xc')](_0xb70e('0x9'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xb70e('0xd'),'disposition',_0xb70e('0xe'),_0xb70e('0xf')]},'log':_0xb70e('0x10')});};}; \ No newline at end of file +var _0x353a=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format'];(function(_0x2b59ac,_0x6b690d){var _0x55de00=function(_0x56b100){while(--_0x56b100){_0x2b59ac['push'](_0x2b59ac['shift']());}};_0x55de00(++_0x6b690d);}(_0x353a,0xcc));var _0xa353=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x353a[_0x1bfe2b];return _0x1477d4;};'use strict';var moment=require(_0xa353('0x0'));var util=require(_0xa353('0x1'));var _=require(_0xa353('0x2'));var client=require(_0xa353('0x3'));exports[_0xa353('0x4')]=function(_0x3819bc){return client[_0xa353('0x5')](_0xa353('0x6'),{'body':_['merge'](_0x3819bc,{'source':_0x3819bc[_0xa353('0x7')],'destinationcontext':_0x3819bc[_0xa353('0x8')],'callerid':_0x3819bc[_0xa353('0x9')],'amaflags':_0xa353('0xa')}),'log':_0xa353('0x6')});};exports[_0xa353('0xb')]=function(){return function(){return client[_0xa353('0x5')](_0xa353('0xc'),{'options':{'where':{'type':[_0xa353('0xd')],'createdAt':{'$between':[moment()['startOf'](_0xa353('0xe'))[_0xa353('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xa353('0xe'))[_0xa353('0xf')](_0xa353('0x10'))]}},'attributes':[_0xa353('0x11'),_0xa353('0x12'),_0xa353('0x13'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2afeb56..904f951 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 _0x748e=['Request','CreateVoiceDialReport','../client','create'];(function(_0x1e992d,_0x52eca6){var _0x1d9157=function(_0x502107){while(--_0x502107){_0x1e992d['push'](_0x1e992d['shift']());}};_0x1d9157(++_0x52eca6);}(_0x748e,0xaa));var _0xe748=function(_0x1d7bc0,_0x50a455){_0x1d7bc0=_0x1d7bc0-0x0;var _0x15a179=_0x748e[_0x1d7bc0];return _0x15a179;};'use strict';var client=require(_0xe748('0x0'));exports[_0xe748('0x1')]=function(_0x32d1c9){return client[_0xe748('0x2')](_0xe748('0x3'),{'body':_0x32d1c9,'log':_0xe748('0x3')});}; \ No newline at end of file +var _0x51d1=['Request','CreateVoiceDialReport','../client','create'];(function(_0x1c6315,_0x114ff7){var _0x19074f=function(_0x10b203){while(--_0x10b203){_0x1c6315['push'](_0x1c6315['shift']());}};_0x19074f(++_0x114ff7);}(_0x51d1,0x11a));var _0x151d=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x51d1[_0x514c15];return _0x16283e;};'use strict';var client=require(_0x151d('0x0'));exports[_0x151d('0x1')]=function(_0xad83b6){return client[_0x151d('0x2')](_0x151d('0x3'),{'body':_0xad83b6,'log':_0x151d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 111357d..5533666 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 _0xa571=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x59137b,_0x20880e){var _0x267490=function(_0xcec6de){while(--_0xcec6de){_0x59137b['push'](_0x59137b['shift']());}};_0x267490(++_0x20880e);}(_0xa571,0x107));var _0x1a57=function(_0x473a99,_0x2f7c2f){_0x473a99=_0x473a99-0x0;var _0x3f6dfa=_0xa571[_0x473a99];return _0x3f6dfa;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(){return client[_0x1a57('0x2')](_0x1a57('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x1a57('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1a57('0x1')});};}; \ No newline at end of file +var _0xcd31=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd31,0x15d));var _0x1cd3=function(_0x135b54,_0x73cc32){_0x135b54=_0x135b54-0x0;var _0x4d3313=_0xcd31[_0x135b54];return _0x4d3313;};'use strict';var client=require('../client');exports[_0x1cd3('0x0')]=function(){return function(){return client[_0x1cd3('0x1')](_0x1cd3('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x1cd3('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1cd3('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 014c70b..1921edf 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 _0xf891=['dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x286e80,_0x5da797){var _0x2fbab3=function(_0x1630fd){while(--_0x1630fd){_0x286e80['push'](_0x286e80['shift']());}};_0x2fbab3(++_0x5da797);}(_0xf891,0x199));var _0x1f89=function(_0x1a841c,_0x4cb15c){_0x1a841c=_0x1a841c-0x0;var _0x51e58a=_0xf891[_0x1a841c];return _0x51e58a;};'use strict';var client=require(_0x1f89('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x1f89('0x1')](_0x1f89('0x2'),{'options':{'raw':![],'attributes':['id',_0x1f89('0x3'),_0x1f89('0x4'),'acwTimeout',_0x1f89('0x5'),_0x1f89('0x6'),'type',_0x1f89('0x7'),_0x1f89('0x8'),'dialLimitChannel','dialLimitQueue',_0x1f89('0x9'),_0x1f89('0xa'),'dialPredictiveOptimizationPercentage',_0x1f89('0xb'),_0x1f89('0xc'),'dialOriginateCallerIdNumber',_0x1f89('0xd'),_0x1f89('0xe'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0x1f89('0xf'),_0x1f89('0x10'),_0x1f89('0x11'),_0x1f89('0x12'),_0x1f89('0x13'),'dialGlobalMaxRetry','dialTimezone',_0x1f89('0x14'),_0x1f89('0x15'),_0x1f89('0x16'),_0x1f89('0x17'),_0x1f89('0x18'),'dialAMDGreeting',_0x1f89('0x19'),'dialAMDTotalAnalysisTime',_0x1f89('0x1a'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x1f89('0x1b'),_0x1f89('0x1c'),_0x1f89('0x1d'),'dialRecallMeTimeout',_0x1f89('0x1e'),_0x1f89('0x1f'),_0x1f89('0x20'),_0x1f89('0x21'),_0x1f89('0x22'),_0x1f89('0x6'),_0x1f89('0x23'),'dialRandomLastDigitCallerIdNumber',_0x1f89('0x24'),_0x1f89('0x25'),'dialNoSuchNumberRetryFrequency',_0x1f89('0x26'),'dialDropRetryFrequency',_0x1f89('0x27'),_0x1f89('0x28'),_0x1f89('0x29'),'dialMachineRetryFrequency',_0x1f89('0x2a'),_0x1f89('0x2b'),_0x1f89('0x2c'),_0x1f89('0x2d'),_0x1f89('0x2e'),_0x1f89('0x2f'),_0x1f89('0x30')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x1f89('0x3'),_0x1f89('0x31'),_0x1f89('0x32')]},{'model':_0x1f89('0x33'),'as':_0x1f89('0x34'),'attributes':['id','name']},{'model':'Trunk','as':_0x1f89('0x35'),'attributes':['id','name',_0x1f89('0x31'),'active']},{'model':_0x1f89('0x36'),'as':'Interval','attributes':['id',_0x1f89('0x3')],'include':[{'model':_0x1f89('0x36'),'as':_0x1f89('0x37'),'attributes':['id',_0x1f89('0x3'),'interval']}]}]},'log':_0x1f89('0x38')});};}; \ No newline at end of file +var _0x8985=['mandatoryDispositionPause','TrunkBackup','Interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x8985,0x120));var _0x5898=function(_0x427128,_0x2d017a){_0x427128=_0x427128-0x0;var _0x2f51c6=_0x8985[_0x427128];return _0x2f51c6;};'use strict';var client=require('../client');exports[_0x5898('0x0')]=function(){return function(){return client[_0x5898('0x1')](_0x5898('0x2'),{'options':{'raw':![],'attributes':['id',_0x5898('0x3'),_0x5898('0x4'),'acwTimeout',_0x5898('0x5'),'monitor_format',_0x5898('0x6'),_0x5898('0x7'),_0x5898('0x8'),_0x5898('0x9'),_0x5898('0xa'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x5898('0xb'),_0x5898('0xc'),_0x5898('0xd'),_0x5898('0xe'),_0x5898('0xf'),'dialQueueTimeout',_0x5898('0x10'),_0x5898('0x11'),'dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0x5898('0x12'),_0x5898('0x13'),_0x5898('0x14'),'dialTimezone','dialGlobalInterval',_0x5898('0x15'),_0x5898('0x16'),'dialAMDActive',_0x5898('0x17'),_0x5898('0x18'),_0x5898('0x19'),_0x5898('0x1a'),_0x5898('0x1b'),_0x5898('0x1c'),_0x5898('0x1d'),_0x5898('0x1e'),_0x5898('0x1f'),'timeout',_0x5898('0x20'),_0x5898('0x21'),_0x5898('0x22'),_0x5898('0x23'),_0x5898('0x24'),_0x5898('0x25'),_0x5898('0x26'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x5898('0x27'),_0x5898('0x28'),_0x5898('0x29'),_0x5898('0x2a'),'dialAbandonedMaxRetry',_0x5898('0x2b'),_0x5898('0x2c'),'dialMachineRetryFrequency',_0x5898('0x2d'),_0x5898('0x2e'),'mandatoryDisposition',_0x5898('0x2f'),_0x5898('0x30'),_0x5898('0x31'),_0x5898('0x32')],'include':[{'model':'Trunk','as':_0x5898('0x33'),'attributes':['id',_0x5898('0x3'),_0x5898('0x34'),_0x5898('0x35')]},{'model':'Pause','as':_0x5898('0x36'),'attributes':['id',_0x5898('0x3')]},{'model':_0x5898('0x33'),'as':_0x5898('0x37'),'attributes':['id',_0x5898('0x3'),_0x5898('0x34'),'active']},{'model':'Interval','as':_0x5898('0x38'),'attributes':['id',_0x5898('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name','interval']}]}]},'log':_0x5898('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e71d7f4..e36310d 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(_0x374c27,_0x49f59f){var _0x1737e9=function(_0x3c97cb){while(--_0x3c97cb){_0x374c27['push'](_0x374c27['shift']());}};_0x1737e9(++_0x49f59f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0xc49b87,_0x9b1222){var _0x3c72c7=function(_0x29e14f){while(--_0x29e14f){_0xc49b87['push'](_0xc49b87['shift']());}};_0x3c72c7(++_0x9b1222);}(_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 diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 39a934a..840b520 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 _0x158f=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x7cebaf,_0x37d37c){var _0xcd1075=function(_0x275f3f){while(--_0x275f3f){_0x7cebaf['push'](_0x7cebaf['shift']());}};_0xcd1075(++_0x37d37c);}(_0x158f,0x179));var _0xf158=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x158f[_0x5ba549];return _0x36e3a1;};'use strict';var client=require('../client');exports[_0xf158('0x0')]=function(_0xafaca4){return function(){return client['Request'](_0xf158('0x1'),{'options':{'where':{'VoiceQueueId':_0xafaca4,'paused':!![]},'raw':!![]},'log':_0xf158('0x0')});};}; \ No newline at end of file +var _0x1977=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x9dbb23,_0xa5c385){var _0xb36921=function(_0x3e06d5){while(--_0x3e06d5){_0x9dbb23['push'](_0x9dbb23['shift']());}};_0xb36921(++_0xa5c385);}(_0x1977,0x126));var _0x7197=function(_0x5b8f48,_0x43efb7){_0x5b8f48=_0x5b8f48-0x0;var _0x124fd6=_0x1977[_0x5b8f48];return _0x124fd6;};'use strict';var client=require(_0x7197('0x0'));exports[_0x7197('0x1')]=function(_0x47585c){return function(){return client[_0x7197('0x2')](_0x7197('0x3'),{'options':{'where':{'VoiceQueueId':_0x47585c,'paused':!![]},'raw':!![]},'log':_0x7197('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 398731b..88e3a1a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5f4b93,_0x84454f){var _0x2199ee=function(_0x3be57f){while(--_0x3be57f){_0x5f4b93['push'](_0x5f4b93['shift']());}};_0x2199ee(++_0x84454f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x294818,_0x439dfa){var _0x448893=function(_0x21d7d5){while(--_0x21d7d5){_0x294818['push'](_0x294818['shift']());}};_0x448893(++_0x439dfa);}(_0x7a54,0x106));var _0x47a5=function(_0x410206,_0x595f0b){_0x410206=_0x410206-0x0;var _0x87ca93=_0x7a54[_0x410206];return _0x87ca93;};'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 ebc2069..b2e3e7f 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 _0x5666=['transfereeaccountcode','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','attended','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x18c3f7,_0x329e47){var _0x530af3=function(_0x32be52){while(--_0x32be52){_0x18c3f7['push'](_0x18c3f7['shift']());}};_0x530af3(++_0x329e47);}(_0x5666,0x86));var _0x6566=function(_0x4faf22,_0x3839d9){_0x4faf22=_0x4faf22-0x0;var _0x42302e=_0x5666[_0x4faf22];return _0x42302e;};'use strict';var client=require('../client');exports[_0x6566('0x0')]={};exports[_0x6566('0x1')]=function(_0x505997){return client[_0x6566('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x505997[_0x6566('0x3')],'transfererchannel':_0x505997['transfererchannel'],'transferercalleridnum':_0x505997[_0x6566('0x4')],'transferercalleridname':_0x505997[_0x6566('0x5')],'transfererconnectedlinenum':_0x505997[_0x6566('0x6')],'transfererconnectedlinename':_0x505997['transfererconnectedlinename'],'transfereraccountcode':_0x505997[_0x6566('0x7')],'transferercontext':_0x505997[_0x6566('0x8')],'transfererexten':_0x505997[_0x6566('0x9')],'transfererlinkedid':_0x505997['transfererlinkedid'],'transfereechannel':_0x505997[_0x6566('0xa')],'transfereecalleridnum':_0x505997['transfereecalleridnum'],'transfereecalleridname':_0x505997[_0x6566('0xb')],'transfereeconnectedlinenum':_0x505997[_0x6566('0xc')],'transfereeconnectedlinename':_0x505997[_0x6566('0xd')],'transfereeaccountcode':_0x505997[_0x6566('0xe')],'transfereecontext':_0x505997['transfereecontext'],'transfereeexten':_0x505997[_0x6566('0xf')],'transfereelinkedid':_0x505997['transfereelinkedid'],'isexternal':_0x505997[_0x6566('0x10')],'context':_0x505997[_0x6566('0x11')],'extension':_0x505997[_0x6566('0x12')],'type':_0x6566('0x13')},'log':_0x6566('0x14')});};exports['attendedTransfer']=function(_0x1069dc){return client[_0x6566('0x2')](_0x6566('0x14'),{'body':{'result':_0x1069dc['result'],'transfererchannel':_0x1069dc[_0x6566('0x15')],'transferercalleridnum':_0x1069dc[_0x6566('0x16')],'transferercalleridname':_0x1069dc[_0x6566('0x17')],'transfererconnectedlinenum':_0x1069dc['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1069dc[_0x6566('0x18')],'transfereraccountcode':_0x1069dc[_0x6566('0x19')],'transferercontext':_0x1069dc[_0x6566('0x1a')],'transfererexten':_0x1069dc[_0x6566('0x1b')],'transfererlinkedid':_0x1069dc[_0x6566('0x1c')],'transfereechannel':_0x1069dc[_0x6566('0x1d')],'transfereecalleridnum':_0x1069dc[_0x6566('0x1e')],'transfereecalleridname':_0x1069dc[_0x6566('0x1f')],'transfereeconnectedlinenum':_0x1069dc[_0x6566('0x20')],'transfereeconnectedlinename':_0x1069dc[_0x6566('0x21')],'transfereeaccountcode':_0x1069dc['transfertargetaccountcode'],'transfereecontext':_0x1069dc[_0x6566('0x22')],'transfereeexten':_0x1069dc[_0x6566('0x23')],'transfereelinkedid':_0x1069dc['transfertargetlinkedid'],'isexternal':_0x1069dc[_0x6566('0x10')],'context':_0x1069dc['origtransferercontext'],'extension':_0x1069dc['origtransfererexten'],'type':_0x6566('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xb1ba=['context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xb1ba,0xf5));var _0xab1b=function(_0x11059e,_0x302e2d){_0x11059e=_0x11059e-0x0;var _0x2eeeec=_0xb1ba[_0x11059e];return _0x2eeeec;};'use strict';var client=require(_0xab1b('0x0'));exports[_0xab1b('0x1')]={};exports[_0xab1b('0x2')]=function(_0x1c6f89){return client[_0xab1b('0x3')](_0xab1b('0x4'),{'body':{'result':_0x1c6f89[_0xab1b('0x5')],'transfererchannel':_0x1c6f89[_0xab1b('0x6')],'transferercalleridnum':_0x1c6f89[_0xab1b('0x7')],'transferercalleridname':_0x1c6f89[_0xab1b('0x8')],'transfererconnectedlinenum':_0x1c6f89[_0xab1b('0x9')],'transfererconnectedlinename':_0x1c6f89[_0xab1b('0xa')],'transfereraccountcode':_0x1c6f89[_0xab1b('0xb')],'transferercontext':_0x1c6f89[_0xab1b('0xc')],'transfererexten':_0x1c6f89[_0xab1b('0xd')],'transfererlinkedid':_0x1c6f89['transfererlinkedid'],'transfereechannel':_0x1c6f89[_0xab1b('0xe')],'transfereecalleridnum':_0x1c6f89['transfereecalleridnum'],'transfereecalleridname':_0x1c6f89['transfereecalleridname'],'transfereeconnectedlinenum':_0x1c6f89[_0xab1b('0xf')],'transfereeconnectedlinename':_0x1c6f89[_0xab1b('0x10')],'transfereeaccountcode':_0x1c6f89[_0xab1b('0x11')],'transfereecontext':_0x1c6f89[_0xab1b('0x12')],'transfereeexten':_0x1c6f89['transfereeexten'],'transfereelinkedid':_0x1c6f89[_0xab1b('0x13')],'isexternal':_0x1c6f89[_0xab1b('0x14')],'context':_0x1c6f89[_0xab1b('0x15')],'extension':_0x1c6f89['extension'],'type':_0xab1b('0x16')},'log':_0xab1b('0x4')});};exports[_0xab1b('0x17')]=function(_0x40fbb6){return client[_0xab1b('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x40fbb6[_0xab1b('0x5')],'transfererchannel':_0x40fbb6[_0xab1b('0x18')],'transferercalleridnum':_0x40fbb6['origtransferercalleridnum'],'transferercalleridname':_0x40fbb6[_0xab1b('0x19')],'transfererconnectedlinenum':_0x40fbb6[_0xab1b('0x1a')],'transfererconnectedlinename':_0x40fbb6[_0xab1b('0x1b')],'transfereraccountcode':_0x40fbb6[_0xab1b('0x1c')],'transferercontext':_0x40fbb6['secondtransferercontext'],'transfererexten':_0x40fbb6['secondtransfererexten'],'transfererlinkedid':_0x40fbb6[_0xab1b('0x1d')],'transfereechannel':_0x40fbb6[_0xab1b('0x1e')],'transfereecalleridnum':_0x40fbb6[_0xab1b('0x1f')],'transfereecalleridname':_0x40fbb6['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x40fbb6['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x40fbb6[_0xab1b('0x20')],'transfereeaccountcode':_0x40fbb6['transfertargetaccountcode'],'transfereecontext':_0x40fbb6[_0xab1b('0x21')],'transfereeexten':_0x40fbb6[_0xab1b('0x22')],'transfereelinkedid':_0x40fbb6[_0xab1b('0x23')],'isexternal':_0x40fbb6[_0xab1b('0x14')],'context':_0x40fbb6[_0xab1b('0x24')],'extension':_0x40fbb6['origtransfererexten'],'type':_0xab1b('0x25')},'log':_0xab1b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 27875f0..cf34132 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 _0x444e=['loggedInDb','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','push','find','omit','undefined','values','channels','length','voicechannel','validate','map','uniqueid','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','../../../config/environment','../ami','listen','format','%s/%s','timers','timer','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x444e,0xe8));var _0xe444=function(_0x20f638,_0x590867){_0x20f638=_0x20f638-0x0;var _0x4fc65b=_0x444e[_0x20f638];return _0x4fc65b;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var jayson=require(_0xe444('0x1'));var schema=require('validate');var BPromise=require(_0xe444('0x2'));var moment=require('moment');var config=require(_0xe444('0x3'));var properties=require('../properties');var ami=require(_0xe444('0x4'));exports[_0xe444('0x5')]=function(_0x91763c,_0x394fc1,_0x36ac3b){return new BPromise(function(_0x1ddb27,_0x4834c7){var _0xfbd88b={'QueuePause':function(_0x4b5b7d){return new Promise(function(_0x29a2b7,_0x482b98){var _0x3199dd=util[_0xe444('0x6')](_0xe444('0x7'),'SIP',_0x4b5b7d['name']);if(_0x91763c[_0xe444('0x8')]&&_0x91763c[_0xe444('0x8')][_0x3199dd]&&_0x91763c['timers'][_0x3199dd][_0xe444('0x9')]){_0x91763c['timers'][_0x3199dd]['updateAcw']();}if(_0x91763c[_0xe444('0xa')][_0x3199dd]){_0x91763c['agents'][_0x3199dd][_0xe444('0xb')]({'statePause':_0x4b5b7d[_0xe444('0xc')]?!![]:![]});}_0x29a2b7({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x28c3e4){var _0x4f046c=this;return new Promise(function(_0x5ba044,_0x32e7f9){if(ami[_0xe444('0xd')]()==![]){return _0x32e7f9(_0x4f046c['error'](0x1f4,[config[_0xe444('0xe')]['ip'],config['asterisk'][_0xe444('0xf')],_0xe444('0x10')][_0xe444('0x11')]('\x20')));}_0x28c3e4=_[_0xe444('0x12')](_0x28c3e4,_[_0xe444('0x13')](properties[_0xe444('0x14')]));_0x28c3e4[_0xe444('0x15')]=_0xe444('0x16');return ami[_0xe444('0x17')](_0x28c3e4)[_0xe444('0x18')](function(_0x236bc4){_0x5ba044({'code':0xc8,'message':_0x236bc4[_0xe444('0x19')]});})[_0xe444('0x1a')](function(_0x4e2711){_0x32e7f9(_0x4f046c[_0xe444('0x1b')](0x1f5,_0x4e2711[_0xe444('0x19')]));});});},'Command':function(_0x12eb54){var _0x2f6a4a=this;return new Promise(function(_0x58fd40,_0x306e05){if(ami[_0xe444('0xd')]()==![]){return _0x306e05(_0x2f6a4a[_0xe444('0x1b')](0x1f4,[config[_0xe444('0xe')]['ip'],config[_0xe444('0xe')]['username'],_0xe444('0x10')][_0xe444('0x11')]('\x20')));}_0x12eb54=_['pick'](_0x12eb54,_0xe444('0x1c'));_0x12eb54['action']=_0xe444('0x1d');return ami[_0xe444('0x17')](_0x12eb54)[_0xe444('0x18')](function(_0x322c07){_0x58fd40({'code':0xc8,'message':_0x322c07[_0xe444('0x1e')]});})['catch'](function(_0x527bf5){_0x306e05(_0x2f6a4a[_0xe444('0x1b')](0x1f5,_0x527bf5[_0xe444('0x19')]));});});},'VoiceQueues':function(_0x1ac266){return new Promise(function(_0x1ff6d2,_0x2a03a2){var _0x5e0311=[];for(var _0x3c9cf7 in _0x91763c[_0xe444('0x1f')]){if(_0x91763c['voiceQueues'][_0xe444('0x20')](_0x3c9cf7)){var _0x4f4412=_0x91763c[_0xe444('0x1f')][_0x3c9cf7];var _0x26ca6f={'id':_0x4f4412['id'],'name':_0x4f4412[_0xe444('0x21')],'strategy':_0x4f4412[_0xe444('0x22')],'answered':_0x4f4412[_0xe444('0x23')],'available':_0x4f4412['available'],'loggedIn':_0x4f4412[_0xe444('0x24')],'pTalking':_0x4f4412[_0xe444('0x25')],'sumBillable':_0x4f4412[_0xe444('0x26')],'sumDuration':_0x4f4412[_0xe444('0x27')],'sumHoldTime':_0x4f4412['sumHoldTime']||0x0,'talking':_0x4f4412['talking'],'total':_0x4f4412[_0xe444('0x28')],'type':_0x4f4412[_0xe444('0x29')],'unmanaged':_0x4f4412[_0xe444('0x2a')],'abandoned':_0x4f4412[_0xe444('0x2b')],'waiting':_0x4f4412['waiting'],'loggedInDb':_0x4f4412[_0xe444('0x2c')]};if(_0x4f4412[_0xe444('0x29')]===_0xe444('0x2d')){_0x26ca6f[_0xe444('0x2e')]=_0x4f4412['dialActive'];_0x26ca6f['dialMethod']=_0x4f4412['dialMethod'];_0x26ca6f[_0xe444('0x2f')]=_0x4f4412[_0xe444('0x2f')];_0x26ca6f[_0xe444('0x30')]=_0x4f4412[_0xe444('0x30')];_0x26ca6f[_0xe444('0x31')]=_0x4f4412['dialOriginateTimeout'];_0x26ca6f[_0xe444('0x32')]=_0x4f4412[_0xe444('0x32')];_0x26ca6f[_0xe444('0x33')]=_0x4f4412['temp'];_0x26ca6f[_0xe444('0x34')]=_0x4f4412['outboundAnswerAgiCallsDay'];_0x26ca6f['outboundAnswerCallsDay']=_0x4f4412[_0xe444('0x35')];_0x26ca6f[_0xe444('0x36')]=_0x4f4412['outboundBlacklistCallsDay'];_0x26ca6f[_0xe444('0x37')]=_0x4f4412['outboundBusyCallsDay'];_0x26ca6f[_0xe444('0x38')]=_0x4f4412['outboundCongestionCallsDay'];_0x26ca6f['outboundDropCallsDayACS']=_0x4f4412[_0xe444('0x39')];_0x26ca6f['outboundDropCallsDayCallersExit']=_0x4f4412[_0xe444('0x3a')];_0x26ca6f[_0xe444('0x3b')]=_0x4f4412[_0xe444('0x3b')];_0x26ca6f[_0xe444('0x3c')]=_0x4f4412['outboundNoAnswerCallsDay'];_0x26ca6f[_0xe444('0x3d')]=_0x4f4412[_0xe444('0x3d')];_0x26ca6f[_0xe444('0x3e')]=_0x4f4412['outboundOriginateFailureCallsDay'];_0x26ca6f[_0xe444('0x3f')]=_0x4f4412['outboundReCallsDay'];_0x26ca6f[_0xe444('0x40')]=_0x4f4412[_0xe444('0x40')];_0x26ca6f[_0xe444('0x41')]=_0x4f4412['outboundUnknownCallsDay'];_0x26ca6f['predictiveIntervalAnsweredCalls']=_0x4f4412[_0xe444('0x42')];_0x26ca6f[_0xe444('0x43')]=_0x4f4412[_0xe444('0x43')];_0x26ca6f[_0xe444('0x44')]=_0x4f4412[_0xe444('0x44')];_0x26ca6f[_0xe444('0x45')]=_0x4f4412[_0xe444('0x45')];_0x26ca6f['predictiveIntervalDroppedCallsTimeout']=_0x4f4412['predictiveIntervalDroppedCallsTimeout'];_0x26ca6f[_0xe444('0x46')]=_0x4f4412['predictiveIntervalErlangCalls'];_0x26ca6f[_0xe444('0x47')]=_0x4f4412['predictiveIntervalErlangCallsDroppedCalls'];_0x26ca6f[_0xe444('0x48')]=_0x4f4412[_0xe444('0x48')];_0x26ca6f[_0xe444('0x49')]=_0x4f4412[_0xe444('0x49')];_0x26ca6f[_0xe444('0x4a')]=_0x4f4412[_0xe444('0x4a')];_0x26ca6f['predictiveIntervalAvailable']=_0x4f4412[_0xe444('0x4b')];_0x26ca6f[_0xe444('0x4c')]=_0x4f4412[_0xe444('0x4c')];_0x26ca6f[_0xe444('0x19')]=_0x4f4412['message'];_0x26ca6f[_0xe444('0x4d')]=_0x4f4412[_0xe444('0x4d')];_0x26ca6f[_0xe444('0x4e')]=_0x4f4412[_0xe444('0x4e')];_0x26ca6f[_0xe444('0x4f')]=_0x4f4412[_0xe444('0x4f')];_0x26ca6f[_0xe444('0x50')]=_0x4f4412[_0xe444('0x50')];_0x26ca6f[_0xe444('0x51')]=_0x4f4412['erlangBusyFactor'];_0x26ca6f['startPredictive']=_0x4f4412['startPredictive'];_0x26ca6f[_0xe444('0x52')]=_0x4f4412[_0xe444('0x52')];}if(_0x4f4412[_0xe444('0x53')]){_0x26ca6f[_0xe444('0x53')]={'id':_0x4f4412[_0xe444('0x53')]['id'],'name':_0x4f4412['Trunk']['name'],'active':_0x4f4412[_0xe444('0x53')][_0xe444('0x54')],'callerid':_0x4f4412[_0xe444('0x53')]['callerid']};}if(_0x4f4412[_0xe444('0x55')]){_0x26ca6f[_0xe444('0x55')]={'id':_0x4f4412[_0xe444('0x55')]['id'],'name':_0x4f4412[_0xe444('0x55')][_0xe444('0x21')]};}_0x5e0311[_0xe444('0x56')](_0x26ca6f);}}_0x1ff6d2({'count':_0x5e0311['length'],'rows':_0x5e0311});});},'UpdateVoiceQueue':function(_0x595f81){return new Promise(function(_0x3c8636,_0x2f550f){var _0x2eba87=_[_0xe444('0x57')](_0x91763c['voiceQueues'],{'id':parseInt(_0x595f81['id'])});var _0x13b92d=_[_0xe444('0x58')](_0x595f81,['id']);if(_0x2eba87){for(var _0x3549d0 in _0x13b92d){if(typeof _0x13b92d[_0x3549d0]!==_0xe444('0x59')&&typeof _0x2eba87[_0x3549d0]!==_0xe444('0x59')){_0x2eba87[_0x3549d0]=_0x13b92d[_0x3549d0];}}_0x3c8636(_0x2eba87);}else{_0x2f550f();}});},'VoiceChannels':function(_0x300cea){return new Promise(function(_0x10b183,_0x26d4d3){var _0x4ae871=_[_0xe444('0x5a')](_0x91763c[_0xe444('0x5b')]);_0x10b183({'count':_0x4ae871[_0xe444('0x5c')],'rows':_0x4ae871});});},'VoiceChannelMixMonitor':function(_0x4cb019){var _0x124fc3=this;return new Promise(function(_0x51ce26,_0x5736a2){if(ami['isConnected']()==![]){return _0x5736a2(_0x124fc3[_0xe444('0x1b')](0x1f4,[config[_0xe444('0xe')]['ip'],config['asterisk']['username'],_0xe444('0x10')][_0xe444('0x11')]('\x20')));}var _0x53bde2=schema(properties[_0xe444('0x5d')])[_0xe444('0x5e')](_0x4cb019);if(_0x53bde2[_0xe444('0x5c')]>0x0){return _0x5736a2(_0x124fc3['error'](0x1f4,_[_0xe444('0x5f')](_0x53bde2,'message')[_0xe444('0x11')](',\x20')));}var _0x3f65d3=_['find'](_0x91763c['channels'],{'uniqueid':_0x4cb019[_0xe444('0x60')]});if(_0x3f65d3&&_0x3f65d3['channel']){var _0x251c70=util[_0xe444('0x6')]('%s.%s',_0x4cb019[_0xe444('0x61')]||_0x4cb019[_0xe444('0x60')],_0x4cb019[_0xe444('0x6')]||_0xe444('0x62'));return ami[_0xe444('0x17')]({'action':_0xe444('0x63'),'channel':_0x3f65d3[_0xe444('0x64')],'file':_0x251c70,'options':_0xe444('0x65')})[_0xe444('0x18')](function(_0x34482f){var _0x3286b6=_[_0xe444('0x57')](_0x3f65d3['monitors'],{'filename':_0xe444('0x66')+_0x251c70[_0xe444('0x67')]()});if(_['isNil'](_0x3286b6)){_0x3f65d3[_0xe444('0x68')]['push']({'filename':_0xe444('0x66')+_0x251c70['toLowerCase'](),'createdAt':moment()[_0xe444('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x34482f[_0xe444('0x69')],'status':_0xe444('0x6a')});}else{_0x3286b6[_0xe444('0x69')]=_0x34482f[_0xe444('0x69')];_0x3286b6[_0xe444('0x6b')]='rec';}_0x51ce26({'code':0xc8,'message':[_0x4cb019[_0xe444('0x60')],_0xe444('0x6c'),_0x34482f['mixmonitorid']][_0xe444('0x11')]('\x20'),'mixmonitorid':_0x34482f[_0xe444('0x69')]});})[_0xe444('0x1a')](function(_0x372909){_0x5736a2(_0x124fc3['error'](0x1f5,[_0x4cb019[_0xe444('0x60')],_0x372909[_0xe444('0x19')]['toLowerCase']()][_0xe444('0x11')]('\x20')));});}else{return _0x5736a2(_0x124fc3[_0xe444('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x486d5c){var _0x1bd0dc=this;return new Promise(function(_0x35793c,_0x31f478){if(ami[_0xe444('0xd')]()==![]){return _0x31f478(_0x1bd0dc['error'](0x1f4,[config[_0xe444('0xe')]['ip'],config['asterisk'][_0xe444('0xf')],_0xe444('0x10')][_0xe444('0x11')]('\x20')));}var _0x152feb=schema(properties[_0xe444('0x5d')])['validate'](_0x486d5c);if(_0x152feb[_0xe444('0x5c')]>0x0){return _0x31f478(_0x1bd0dc[_0xe444('0x1b')](0x1f4,_['map'](_0x152feb,_0xe444('0x19'))[_0xe444('0x11')](',\x20')));}var _0x3a9acf=_[_0xe444('0x57')](_0x91763c[_0xe444('0x5b')],{'uniqueid':_0x486d5c[_0xe444('0x60')]});if(_0x3a9acf){return BPromise[_0xe444('0x6d')]()[_0xe444('0x18')](function(){if(_0x3a9acf[_0xe444('0x64')]){return ami[_0xe444('0x17')]({'action':_0xe444('0x6e'),'channel':_0x3a9acf['channel'],'mixmonitorid':_0x486d5c[_0xe444('0x69')]})[_0xe444('0x1a')](function(_0x4d91e3){});}})[_0xe444('0x18')](function(){if(_0x3a9acf['destinationchannel']){return ami[_0xe444('0x17')]({'action':_0xe444('0x6e'),'channel':_0x3a9acf[_0xe444('0x6f')],'mixmonitorid':_0x486d5c[_0xe444('0x69')]})['catch'](function(_0x28bdc2){});}})[_0xe444('0x18')](function(_0x5a0cb4){var _0xa45ffa=_[_0xe444('0x57')](_0x3a9acf['monitors'],{'mixmonitorid':_0x486d5c[_0xe444('0x69')]});if(_0xa45ffa){_0xa45ffa[_0xe444('0x6b')]=_0xe444('0x70');}})['then'](function(){var _0x849c5c=util[_0xe444('0x6')]('%s.%s',_0x486d5c[_0xe444('0x61')]||_0x486d5c[_0xe444('0x60')],_0x486d5c[_0xe444('0x6')]||_0xe444('0x62'));var _0x392a3a=_[_0xe444('0x57')](_0x3a9acf[_0xe444('0x68')],{'filename':_0xe444('0x66')+_0x849c5c['toLowerCase']()});if(_0x392a3a){_0x392a3a[_0xe444('0x6b')]=_0xe444('0x70');}})[_0xe444('0x18')](function(){_0x35793c({'code':0xc8,'message':[_0x486d5c[_0xe444('0x60')],'StopMixMonitor\x20Success'][_0xe444('0x11')]('\x20')});})[_0xe444('0x1a')](function(_0x37e49f){_0x31f478(_0x1bd0dc['error'](0x1f5,[_0x486d5c[_0xe444('0x60')],_0x37e49f[_0xe444('0x19')][_0xe444('0x67')]()][_0xe444('0x11')]('\x20')));});}else{return _0x31f478(_0x1bd0dc[_0xe444('0x1b')](0x1f5,_0xe444('0x71')));}});},'VoiceQueuesChannels':function(_0x32f7ed){return new Promise(function(_0x365d7f,_0x36a6a3){var _0x4d6bd4=_[_0xe444('0x5a')](_0x91763c['queueChannels']);_0x365d7f({'count':_0x4d6bd4[_0xe444('0x5c')],'rows':_0x4d6bd4});});},'VoiceQueuesChannel':function(_0x289b59){var _0x458851=this;return new Promise(function(_0x499246,_0x4ca57c){var _0x37533c=schema(properties['voicequeuechannel'])[_0xe444('0x5e')](_0x289b59);if(_0x37533c[_0xe444('0x5c')]>0x0){return _0x4ca57c(_0x458851[_0xe444('0x1b')](0x1f4,_['map'](_0x37533c,_0xe444('0x19'))[_0xe444('0x11')](',\x20')));}var _0x1edb83=_[_0xe444('0x57')](_0x91763c[_0xe444('0x72')],{'uniqueid':_0x289b59['uniqueid']});if(_0x1edb83){_0x499246(_0x1edb83);}else{return _0x4ca57c(_0x458851['error'](0x1f5,_0xe444('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x5bb065){var _0x151a8f=this;return new Promise(function(_0x153bd8,_0x2ad3e3){if(ami['isConnected']()==![]){return _0x2ad3e3(_0x151a8f[_0xe444('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0xe444('0xe')][_0xe444('0xf')],'ami\x20disconnected']['join']('\x20')));}var _0x4a1328=schema(properties[_0xe444('0x73')])['validate'](_0x5bb065);if(_0x4a1328[_0xe444('0x5c')]>0x0){return _0x2ad3e3(_0x151a8f['error'](0x1f4,_['map'](_0x4a1328,_0xe444('0x19'))[_0xe444('0x11')](',\x20')));}var _0x1398c2=_[_0xe444('0x57')](_0x91763c['queueChannels'],{'uniqueid':_0x5bb065['uniqueid']});if(_0x1398c2&&_0x1398c2[_0xe444('0x64')]){return ami['Action']({'action':_0xe444('0x74'),'channel':_0x1398c2[_0xe444('0x64')]})['then'](function(_0x5e863f){_0x153bd8({'code':0xc8,'message':[_0x5bb065[_0xe444('0x60')],_0x5e863f[_0xe444('0x19')][_0xe444('0x67')]()][_0xe444('0x11')]('\x20')});})[_0xe444('0x1a')](function(_0x192834){_0x2ad3e3(_0x151a8f[_0xe444('0x1b')](0x1f5,[_0x5bb065[_0xe444('0x60')],_0x192834['message'][_0xe444('0x67')]()]['join']('\x20')));});}else{return _0x2ad3e3(_0x151a8f[_0xe444('0x1b')](0x1f5,_0xe444('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x3ae01f){var _0x43796f=this;return new Promise(function(_0x57a209,_0x354c3a){if(ami[_0xe444('0xd')]()==![]){return _0x354c3a(_0x43796f[_0xe444('0x1b')](0x1f4,[config[_0xe444('0xe')]['ip'],config[_0xe444('0xe')]['username'],_0xe444('0x10')][_0xe444('0x11')]('\x20')));}var _0x1d7b58=schema(properties[_0xe444('0x75')])[_0xe444('0x5e')](_0x3ae01f);if(_0x1d7b58[_0xe444('0x5c')]>0x0){return _0x354c3a(_0x43796f['error'](0x1f4,_[_0xe444('0x5f')](_0x1d7b58,_0xe444('0x19'))[_0xe444('0x11')](',\x20')));}var _0x4cfc14=_['find'](_0x91763c[_0xe444('0x72')],{'uniqueid':_0x3ae01f[_0xe444('0x60')]});if(_0x4cfc14&&_0x4cfc14[_0xe444('0x64')]){return ami[_0xe444('0x17')]({'action':_0xe444('0x76'),'channel':_0x4cfc14[_0xe444('0x64')],'exten':_0x3ae01f[_0xe444('0x77')],'context':_0x3ae01f['context']||_0x4cfc14[_0xe444('0x78')],'priority':0x1})[_0xe444('0x18')](function(_0x40261a){_0x57a209({'code':0xc8,'message':[_0x3ae01f['uniqueid'],_0x40261a[_0xe444('0x19')][_0xe444('0x67')]()]['join']('\x20')});})[_0xe444('0x1a')](function(_0x50fca3){_0x354c3a(_0x43796f['error'](0x1f5,[_0x3ae01f[_0xe444('0x60')],_0x50fca3[_0xe444('0x19')][_0xe444('0x67')]()]['join']('\x20')));});}else{return _0x354c3a(_0x43796f[_0xe444('0x1b')](0x1f5,_0xe444('0x71')));}});},'Agents':function(_0x3be23c){return new Promise(function(_0x51b876,_0x225dc4){var _0x241ea0=_['values'](_0x91763c[_0xe444('0xa')]);_0x51b876({'count':_0x241ea0['length'],'rows':_0x241ea0});});},'Telephones':function(_0x656676){return new Promise(function(_0x538968,_0x1372a7){var _0x5605cf=_[_0xe444('0x5a')](_0x91763c[_0xe444('0x79')]);_0x538968({'count':_0x5605cf[_0xe444('0x5c')],'rows':_0x5605cf});});},'Trunks':function(_0xe57d6b){return new Promise(function(_0x292ecc,_0x26d26d){var _0x517f69=_[_0xe444('0x5a')](_0x91763c[_0xe444('0x7a')]);_0x292ecc({'count':_0x517f69[_0xe444('0x5c')],'rows':_0x517f69});});},'OutboundChannels':function(_0x252f5d){return new Promise(function(_0xcf8b68,_0x29e74c){var _0x5b67eb=_[_0xe444('0x5a')](_0x91763c[_0xe444('0x7b')]);_0xcf8b68({'count':_0x5b67eb[_0xe444('0x5c')],'rows':_0x5b67eb});});},'Outbound':function(_0x146199){return new Promise(function(_0x4cda77,_0x5a3f3e){_0x4cda77(_0x91763c[_0xe444('0x2d')]);});},'Campaigns':function(_0x4df1fc){return new Promise(function(_0x32e5b6,_0x120f49){var _0x356445=_['values'](_0x91763c[_0xe444('0x7c')]);_0x32e5b6({'count':_0x356445['length'],'rows':_0x356445});});},'VoiceQueuesPreview':function(_0x191d33){var _0x36d9be=this;return new Promise(function(_0x601c26,_0x3f1842){_0x394fc1[_0xe444('0x7d')](_0x191d33['id'])[_0xe444('0x18')](function(_0x1ef277){_0x601c26({'code':0xc8,'message':_0x1ef277[_0xe444('0x19')]});})[_0xe444('0x1a')](function(_0x3ec157){_0x3f1842(_0x36d9be[_0xe444('0x1b')](0x1f4,_0x3ec157[_0xe444('0x19')]));});});},'EventManager':function(_0x34deff){var _0x502f03=this;return new Promise(function(_0x3bea13,_0x507864){if(!_0x34deff[_0xe444('0x7e')]){return _0x507864(_0x502f03[_0xe444('0x1b')](0x1f4,_0xe444('0x7f')));}ami[_0xe444('0x80')](_0xe444('0x81')+_0x34deff[_0xe444('0x7e')],_0x34deff[_0xe444('0x19')]);_0x3bea13({'code':0xc8,'message':_0x34deff});});},'FaxAccounts':function(_0x806511){return new Promise(function(_0x5a7c24,_0x32d87f){var _0xbe9eef=_[_0xe444('0x5a')](_0x91763c[_0xe444('0x82')]);_0x5a7c24({'count':_0xbe9eef[_0xe444('0x5c')],'rows':_0xbe9eef});});},'SendFax':function(_0x5e31ef){var _0x1fa6fa=this;return new Promise(function(_0x4e7bfe,_0x1fa8ca){_0x36ac3b[_0xe444('0x83')](_0x5e31ef)['then'](function(_0x5a6ff4){_0x4e7bfe({'code':0xc8,'message':_0x5a6ff4[_0xe444('0x19')]});})[_0xe444('0x1a')](function(_0x592b5a){_0x1fa8ca(_0x1fa6fa[_0xe444('0x1b')](0x1f4,_0x592b5a[_0xe444('0x19')]));});});},'CheckAfterSend':function(_0x26792f){var _0x1505f5=this;return new Promise(function(_0x52bf94,_0x18d289){_0x36ac3b['checkAfterSend'](_0x26792f)[_0xe444('0x18')](function(_0x16532c){_0x52bf94({'code':0xc8,'message':_0x16532c['message']});})[_0xe444('0x1a')](function(_0xc46db3){_0x18d289(_0x1505f5[_0xe444('0x1b')](0x1f4,_0xc46db3[_0xe444('0x19')]));});});}};var _0x1b2ec0=jayson[_0xe444('0x84')](_0xfbd88b)[_0xe444('0x85')]();_0x1b2ec0['on'](_0xe444('0x1b'),function(_0x4692b5){return _0x4834c7(_0x4692b5);});_0x1b2ec0[_0xe444('0x5')](0x232a,_0xe444('0x86'),function(){console[_0xe444('0x87')](_0xe444('0x88'),0x232a);return _0x1ddb27(_0xe444('0x89')+0x232a);});});}; \ No newline at end of file +var _0xaa3f=['find','values','channels','voicechannel','map','uniqueid','channel','format','%s.%s','filename','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','wav','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','error','asterisk','username','ami\x20disconnected','join','module','action','Reload','Action','isConnected','pick','command','Command','then','content','catch','message','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','type','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','length'];(function(_0x2024b2,_0x1a9434){var _0x4924b2=function(_0x4c9301){while(--_0x4c9301){_0x2024b2['push'](_0x2024b2['shift']());}};_0x4924b2(++_0x1a9434);}(_0xaa3f,0xbb));var _0xfaa3=function(_0xffa9a2,_0x1482e8){_0xffa9a2=_0xffa9a2-0x0;var _0x1d0e24=_0xaa3f[_0xffa9a2];return _0x1d0e24;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var jayson=require(_0xfaa3('0x2'));var schema=require(_0xfaa3('0x3'));var BPromise=require(_0xfaa3('0x4'));var moment=require(_0xfaa3('0x5'));var config=require(_0xfaa3('0x6'));var properties=require(_0xfaa3('0x7'));var ami=require(_0xfaa3('0x8'));exports['listen']=function(_0x513eea,_0x2ac57f,_0x4bac92){return new BPromise(function(_0x3d09aa,_0xeecce5){var _0x352958={'QueuePause':function(_0xbf270c){return new Promise(function(_0x328d5f,_0x2e422d){var _0xf420ec=util['format'](_0xfaa3('0x9'),_0xfaa3('0xa'),_0xbf270c['name']);if(_0x513eea['timers']&&_0x513eea[_0xfaa3('0xb')][_0xf420ec]&&_0x513eea[_0xfaa3('0xb')][_0xf420ec][_0xfaa3('0xc')]){_0x513eea[_0xfaa3('0xb')][_0xf420ec][_0xfaa3('0xd')]();}if(_0x513eea[_0xfaa3('0xe')][_0xf420ec]){_0x513eea['agents'][_0xf420ec][_0xfaa3('0xf')]({'statePause':_0xbf270c['pause']?!![]:![]});}_0x328d5f({'code':0xc8,'message':_0xfaa3('0x10')});});},'Reload':function(_0x2b8935){var _0x44540f=this;return new Promise(function(_0x58f71b,_0x290b6c){if(ami['isConnected']()==![]){return _0x290b6c(_0x44540f[_0xfaa3('0x11')](0x1f4,[config[_0xfaa3('0x12')]['ip'],config[_0xfaa3('0x12')][_0xfaa3('0x13')],_0xfaa3('0x14')][_0xfaa3('0x15')]('\x20')));}_0x2b8935=_['pick'](_0x2b8935,_['keys'](properties[_0xfaa3('0x16')]));_0x2b8935[_0xfaa3('0x17')]=_0xfaa3('0x18');return ami[_0xfaa3('0x19')](_0x2b8935)['then'](function(_0x5dd38c){_0x58f71b({'code':0xc8,'message':_0x5dd38c['message']});})['catch'](function(_0x499148){_0x290b6c(_0x44540f[_0xfaa3('0x11')](0x1f5,_0x499148['message']));});});},'Command':function(_0x2a037c){var _0x42846e=this;return new Promise(function(_0x38b978,_0x34b276){if(ami[_0xfaa3('0x1a')]()==![]){return _0x34b276(_0x42846e[_0xfaa3('0x11')](0x1f4,[config[_0xfaa3('0x12')]['ip'],config[_0xfaa3('0x12')][_0xfaa3('0x13')],_0xfaa3('0x14')]['join']('\x20')));}_0x2a037c=_[_0xfaa3('0x1b')](_0x2a037c,_0xfaa3('0x1c'));_0x2a037c[_0xfaa3('0x17')]=_0xfaa3('0x1d');return ami['Action'](_0x2a037c)[_0xfaa3('0x1e')](function(_0x2d4087){_0x38b978({'code':0xc8,'message':_0x2d4087[_0xfaa3('0x1f')]});})[_0xfaa3('0x20')](function(_0x16a3e3){_0x34b276(_0x42846e[_0xfaa3('0x11')](0x1f5,_0x16a3e3[_0xfaa3('0x21')]));});});},'VoiceQueues':function(_0x11841c){return new Promise(function(_0x5d6cdd,_0xe075fc){var _0x2a1ace=[];for(var _0x699e72 in _0x513eea[_0xfaa3('0x22')]){if(_0x513eea[_0xfaa3('0x22')][_0xfaa3('0x23')](_0x699e72)){var _0x2416fe=_0x513eea[_0xfaa3('0x22')][_0x699e72];var _0xd67c17={'id':_0x2416fe['id'],'name':_0x2416fe[_0xfaa3('0x24')],'strategy':_0x2416fe[_0xfaa3('0x25')],'answered':_0x2416fe[_0xfaa3('0x26')],'available':_0x2416fe[_0xfaa3('0x27')],'loggedIn':_0x2416fe[_0xfaa3('0x28')],'pTalking':_0x2416fe[_0xfaa3('0x29')],'sumBillable':_0x2416fe['sumBillable'],'sumDuration':_0x2416fe[_0xfaa3('0x2a')],'sumHoldTime':_0x2416fe[_0xfaa3('0x2b')]||0x0,'talking':_0x2416fe[_0xfaa3('0x2c')],'total':_0x2416fe['total'],'type':_0x2416fe[_0xfaa3('0x2d')],'unmanaged':_0x2416fe['unmanaged'],'abandoned':_0x2416fe[_0xfaa3('0x2e')],'waiting':_0x2416fe['waiting'],'loggedInDb':_0x2416fe[_0xfaa3('0x2f')]};if(_0x2416fe[_0xfaa3('0x2d')]===_0xfaa3('0x30')){_0xd67c17[_0xfaa3('0x31')]=_0x2416fe[_0xfaa3('0x31')];_0xd67c17[_0xfaa3('0x32')]=_0x2416fe[_0xfaa3('0x32')];_0xd67c17[_0xfaa3('0x33')]=_0x2416fe['dialOriginateCallerIdName'];_0xd67c17[_0xfaa3('0x34')]=_0x2416fe[_0xfaa3('0x34')];_0xd67c17[_0xfaa3('0x35')]=_0x2416fe[_0xfaa3('0x35')];_0xd67c17[_0xfaa3('0x36')]=_0x2416fe[_0xfaa3('0x36')];_0xd67c17[_0xfaa3('0x37')]=_0x2416fe[_0xfaa3('0x37')];_0xd67c17[_0xfaa3('0x38')]=_0x2416fe[_0xfaa3('0x38')];_0xd67c17[_0xfaa3('0x39')]=_0x2416fe[_0xfaa3('0x39')];_0xd67c17[_0xfaa3('0x3a')]=_0x2416fe[_0xfaa3('0x3a')];_0xd67c17[_0xfaa3('0x3b')]=_0x2416fe[_0xfaa3('0x3b')];_0xd67c17['outboundCongestionCallsDay']=_0x2416fe[_0xfaa3('0x3c')];_0xd67c17[_0xfaa3('0x3d')]=_0x2416fe[_0xfaa3('0x3d')];_0xd67c17[_0xfaa3('0x3e')]=_0x2416fe[_0xfaa3('0x3e')];_0xd67c17[_0xfaa3('0x3f')]=_0x2416fe[_0xfaa3('0x3f')];_0xd67c17[_0xfaa3('0x40')]=_0x2416fe['outboundNoAnswerCallsDay'];_0xd67c17[_0xfaa3('0x41')]=_0x2416fe[_0xfaa3('0x41')];_0xd67c17[_0xfaa3('0x42')]=_0x2416fe['outboundOriginateFailureCallsDay'];_0xd67c17[_0xfaa3('0x43')]=_0x2416fe[_0xfaa3('0x43')];_0xd67c17['outboundRejectCallsDay']=_0x2416fe[_0xfaa3('0x44')];_0xd67c17[_0xfaa3('0x45')]=_0x2416fe[_0xfaa3('0x45')];_0xd67c17[_0xfaa3('0x46')]=_0x2416fe[_0xfaa3('0x46')];_0xd67c17[_0xfaa3('0x47')]=_0x2416fe['predictiveIntervalAvgHoldtime'];_0xd67c17['predictiveIntervalAvgTalktime']=_0x2416fe[_0xfaa3('0x48')];_0xd67c17[_0xfaa3('0x49')]=_0x2416fe['predictiveIntervalDroppedCallsCallersExit'];_0xd67c17['predictiveIntervalDroppedCallsTimeout']=_0x2416fe[_0xfaa3('0x4a')];_0xd67c17['predictiveIntervalErlangCalls']=_0x2416fe[_0xfaa3('0x4b')];_0xd67c17[_0xfaa3('0x4c')]=_0x2416fe[_0xfaa3('0x4c')];_0xd67c17[_0xfaa3('0x4d')]=_0x2416fe[_0xfaa3('0x4d')];_0xd67c17[_0xfaa3('0x4e')]=_0x2416fe[_0xfaa3('0x4e')];_0xd67c17[_0xfaa3('0x4f')]=_0x2416fe['predictiveIntervalPauses'];_0xd67c17['predictiveIntervalAvailable']=_0x2416fe['predictiveIntervalAvailable'];_0xd67c17['predictiveIntervalTotalCalls']=_0x2416fe[_0xfaa3('0x50')];_0xd67c17[_0xfaa3('0x21')]=_0x2416fe['message'];_0xd67c17[_0xfaa3('0x51')]=_0x2416fe[_0xfaa3('0x51')];_0xd67c17[_0xfaa3('0x52')]=_0x2416fe['erlangCalls'];_0xd67c17['erlangCallToSecond']=_0x2416fe[_0xfaa3('0x53')];_0xd67c17['erlangAbandonmentRate']=_0x2416fe[_0xfaa3('0x54')];_0xd67c17['erlangBusyFactor']=_0x2416fe['erlangBusyFactor'];_0xd67c17[_0xfaa3('0x55')]=_0x2416fe[_0xfaa3('0x55')];_0xd67c17['startProgressive']=_0x2416fe[_0xfaa3('0x56')];}if(_0x2416fe['Trunk']){_0xd67c17[_0xfaa3('0x57')]={'id':_0x2416fe['Trunk']['id'],'name':_0x2416fe[_0xfaa3('0x57')][_0xfaa3('0x24')],'active':_0x2416fe[_0xfaa3('0x57')]['active'],'callerid':_0x2416fe[_0xfaa3('0x57')][_0xfaa3('0x58')]};}if(_0x2416fe['Interval']){_0xd67c17[_0xfaa3('0x59')]={'id':_0x2416fe[_0xfaa3('0x59')]['id'],'name':_0x2416fe[_0xfaa3('0x59')][_0xfaa3('0x24')]};}_0x2a1ace['push'](_0xd67c17);}}_0x5d6cdd({'count':_0x2a1ace[_0xfaa3('0x5a')],'rows':_0x2a1ace});});},'UpdateVoiceQueue':function(_0x3e0efb){return new Promise(function(_0x5dfff8,_0xd26e61){var _0x5a8ab2=_[_0xfaa3('0x5b')](_0x513eea[_0xfaa3('0x22')],{'id':parseInt(_0x3e0efb['id'])});var _0xb4df09=_['omit'](_0x3e0efb,['id']);if(_0x5a8ab2){for(var _0x1b3006 in _0xb4df09){if(typeof _0xb4df09[_0x1b3006]!=='undefined'&&typeof _0x5a8ab2[_0x1b3006]!=='undefined'){_0x5a8ab2[_0x1b3006]=_0xb4df09[_0x1b3006];}}_0x5dfff8(_0x5a8ab2);}else{_0xd26e61();}});},'VoiceChannels':function(_0xc30e04){return new Promise(function(_0x2b150d,_0x31a3c6){var _0x27feb6=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x5d')]);_0x2b150d({'count':_0x27feb6[_0xfaa3('0x5a')],'rows':_0x27feb6});});},'VoiceChannelMixMonitor':function(_0x581844){var _0x45a6af=this;return new Promise(function(_0x13dd2b,_0x320555){if(ami[_0xfaa3('0x1a')]()==![]){return _0x320555(_0x45a6af[_0xfaa3('0x11')](0x1f4,[config[_0xfaa3('0x12')]['ip'],config[_0xfaa3('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x138c8c=schema(properties[_0xfaa3('0x5e')])[_0xfaa3('0x3')](_0x581844);if(_0x138c8c[_0xfaa3('0x5a')]>0x0){return _0x320555(_0x45a6af['error'](0x1f4,_[_0xfaa3('0x5f')](_0x138c8c,'message')['join'](',\x20')));}var _0x4d81b9=_['find'](_0x513eea['channels'],{'uniqueid':_0x581844[_0xfaa3('0x60')]});if(_0x4d81b9&&_0x4d81b9[_0xfaa3('0x61')]){var _0x2e85a9=util[_0xfaa3('0x62')](_0xfaa3('0x63'),_0x581844[_0xfaa3('0x64')]||_0x581844[_0xfaa3('0x60')],_0x581844[_0xfaa3('0x62')]||'wav');return ami[_0xfaa3('0x19')]({'action':'MixMonitor','channel':_0x4d81b9['channel'],'file':_0x2e85a9,'options':_0xfaa3('0x65')})[_0xfaa3('0x1e')](function(_0x461e87){var _0x38c984=_[_0xfaa3('0x5b')](_0x4d81b9[_0xfaa3('0x66')],{'filename':_0xfaa3('0x67')+_0x2e85a9[_0xfaa3('0x68')]()});if(_[_0xfaa3('0x69')](_0x38c984)){_0x4d81b9[_0xfaa3('0x66')][_0xfaa3('0x6a')]({'filename':_0xfaa3('0x67')+_0x2e85a9[_0xfaa3('0x68')](),'createdAt':moment()[_0xfaa3('0x62')](_0xfaa3('0x6b')),'mixmonitorid':_0x461e87['mixmonitorid'],'status':_0xfaa3('0x6c')});}else{_0x38c984['mixmonitorid']=_0x461e87[_0xfaa3('0x6d')];_0x38c984[_0xfaa3('0x6e')]=_0xfaa3('0x6c');}_0x13dd2b({'code':0xc8,'message':[_0x581844[_0xfaa3('0x60')],_0xfaa3('0x6f'),_0x461e87[_0xfaa3('0x6d')]][_0xfaa3('0x15')]('\x20'),'mixmonitorid':_0x461e87[_0xfaa3('0x6d')]});})[_0xfaa3('0x20')](function(_0x58c08d){_0x320555(_0x45a6af[_0xfaa3('0x11')](0x1f5,[_0x581844[_0xfaa3('0x60')],_0x58c08d[_0xfaa3('0x21')][_0xfaa3('0x68')]()]['join']('\x20')));});}else{return _0x320555(_0x45a6af[_0xfaa3('0x11')](0x1f5,_0xfaa3('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x172a2c){var _0x23192e=this;return new Promise(function(_0x3dfd2f,_0x1ff9a5){if(ami[_0xfaa3('0x1a')]()==![]){return _0x1ff9a5(_0x23192e['error'](0x1f4,[config[_0xfaa3('0x12')]['ip'],config[_0xfaa3('0x12')][_0xfaa3('0x13')],_0xfaa3('0x14')]['join']('\x20')));}var _0x2f0c2d=schema(properties[_0xfaa3('0x5e')])[_0xfaa3('0x3')](_0x172a2c);if(_0x2f0c2d[_0xfaa3('0x5a')]>0x0){return _0x1ff9a5(_0x23192e[_0xfaa3('0x11')](0x1f4,_[_0xfaa3('0x5f')](_0x2f0c2d,_0xfaa3('0x21'))[_0xfaa3('0x15')](',\x20')));}var _0x214cd7=_['find'](_0x513eea['channels'],{'uniqueid':_0x172a2c[_0xfaa3('0x60')]});if(_0x214cd7){return BPromise['resolve']()['then'](function(){if(_0x214cd7[_0xfaa3('0x61')]){return ami[_0xfaa3('0x19')]({'action':_0xfaa3('0x71'),'channel':_0x214cd7['channel'],'mixmonitorid':_0x172a2c[_0xfaa3('0x6d')]})[_0xfaa3('0x20')](function(_0x530de5){});}})[_0xfaa3('0x1e')](function(){if(_0x214cd7[_0xfaa3('0x72')]){return ami[_0xfaa3('0x19')]({'action':_0xfaa3('0x71'),'channel':_0x214cd7['destinationchannel'],'mixmonitorid':_0x172a2c[_0xfaa3('0x6d')]})[_0xfaa3('0x20')](function(_0x519eb1){});}})[_0xfaa3('0x1e')](function(_0x33ba8e){var _0x2a4405=_[_0xfaa3('0x5b')](_0x214cd7[_0xfaa3('0x66')],{'mixmonitorid':_0x172a2c['mixmonitorid']});if(_0x2a4405){_0x2a4405[_0xfaa3('0x6e')]=_0xfaa3('0x73');}})['then'](function(){var _0x4c972d=util['format'](_0xfaa3('0x63'),_0x172a2c[_0xfaa3('0x64')]||_0x172a2c[_0xfaa3('0x60')],_0x172a2c[_0xfaa3('0x62')]||_0xfaa3('0x74'));var _0x22d3f3=_[_0xfaa3('0x5b')](_0x214cd7[_0xfaa3('0x66')],{'filename':_0xfaa3('0x67')+_0x4c972d[_0xfaa3('0x68')]()});if(_0x22d3f3){_0x22d3f3[_0xfaa3('0x6e')]=_0xfaa3('0x73');}})['then'](function(){_0x3dfd2f({'code':0xc8,'message':[_0x172a2c[_0xfaa3('0x60')],'StopMixMonitor\x20Success'][_0xfaa3('0x15')]('\x20')});})['catch'](function(_0x7ce211){_0x1ff9a5(_0x23192e[_0xfaa3('0x11')](0x1f5,[_0x172a2c['uniqueid'],_0x7ce211['message'][_0xfaa3('0x68')]()][_0xfaa3('0x15')]('\x20')));});}else{return _0x1ff9a5(_0x23192e[_0xfaa3('0x11')](0x1f5,_0xfaa3('0x70')));}});},'VoiceQueuesChannels':function(_0x60adb2){return new Promise(function(_0x2bc208,_0x373775){var _0x494e6f=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x75')]);_0x2bc208({'count':_0x494e6f[_0xfaa3('0x5a')],'rows':_0x494e6f});});},'VoiceQueuesChannel':function(_0x47d0fc){var _0x2833e7=this;return new Promise(function(_0x2ab721,_0x1a3033){var _0x1f0f28=schema(properties['voicequeuechannel'])[_0xfaa3('0x3')](_0x47d0fc);if(_0x1f0f28['length']>0x0){return _0x1a3033(_0x2833e7['error'](0x1f4,_[_0xfaa3('0x5f')](_0x1f0f28,_0xfaa3('0x21'))[_0xfaa3('0x15')](',\x20')));}var _0x17daa5=_[_0xfaa3('0x5b')](_0x513eea[_0xfaa3('0x75')],{'uniqueid':_0x47d0fc[_0xfaa3('0x60')]});if(_0x17daa5){_0x2ab721(_0x17daa5);}else{return _0x1a3033(_0x2833e7['error'](0x1f5,_0xfaa3('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x494a19){var _0x5e99ec=this;return new Promise(function(_0x313e43,_0x582043){if(ami[_0xfaa3('0x1a')]()==![]){return _0x582043(_0x5e99ec['error'](0x1f4,[config['asterisk']['ip'],config[_0xfaa3('0x12')][_0xfaa3('0x13')],_0xfaa3('0x14')]['join']('\x20')));}var _0x1e8dd9=schema(properties[_0xfaa3('0x76')])[_0xfaa3('0x3')](_0x494a19);if(_0x1e8dd9[_0xfaa3('0x5a')]>0x0){return _0x582043(_0x5e99ec[_0xfaa3('0x11')](0x1f4,_['map'](_0x1e8dd9,_0xfaa3('0x21'))[_0xfaa3('0x15')](',\x20')));}var _0x589fdc=_[_0xfaa3('0x5b')](_0x513eea[_0xfaa3('0x75')],{'uniqueid':_0x494a19[_0xfaa3('0x60')]});if(_0x589fdc&&_0x589fdc[_0xfaa3('0x61')]){return ami[_0xfaa3('0x19')]({'action':_0xfaa3('0x77'),'channel':_0x589fdc[_0xfaa3('0x61')]})[_0xfaa3('0x1e')](function(_0x49b349){_0x313e43({'code':0xc8,'message':[_0x494a19[_0xfaa3('0x60')],_0x49b349[_0xfaa3('0x21')]['toLowerCase']()][_0xfaa3('0x15')]('\x20')});})[_0xfaa3('0x20')](function(_0x225bb4){_0x582043(_0x5e99ec[_0xfaa3('0x11')](0x1f5,[_0x494a19[_0xfaa3('0x60')],_0x225bb4['message'][_0xfaa3('0x68')]()][_0xfaa3('0x15')]('\x20')));});}else{return _0x582043(_0x5e99ec[_0xfaa3('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2b9d36){var _0x5a3d46=this;return new Promise(function(_0x1b2ee4,_0x2d8f04){if(ami[_0xfaa3('0x1a')]()==![]){return _0x2d8f04(_0x5a3d46['error'](0x1f4,[config[_0xfaa3('0x12')]['ip'],config[_0xfaa3('0x12')][_0xfaa3('0x13')],_0xfaa3('0x14')]['join']('\x20')));}var _0x4be650=schema(properties['voicequeuechannelredirect'])[_0xfaa3('0x3')](_0x2b9d36);if(_0x4be650[_0xfaa3('0x5a')]>0x0){return _0x2d8f04(_0x5a3d46[_0xfaa3('0x11')](0x1f4,_[_0xfaa3('0x5f')](_0x4be650,_0xfaa3('0x21'))['join'](',\x20')));}var _0xac819=_[_0xfaa3('0x5b')](_0x513eea[_0xfaa3('0x75')],{'uniqueid':_0x2b9d36['uniqueid']});if(_0xac819&&_0xac819[_0xfaa3('0x61')]){return ami['Action']({'action':_0xfaa3('0x78'),'channel':_0xac819['channel'],'exten':_0x2b9d36[_0xfaa3('0x79')],'context':_0x2b9d36[_0xfaa3('0x7a')]||_0xac819[_0xfaa3('0x7a')],'priority':0x1})[_0xfaa3('0x1e')](function(_0x515a67){_0x1b2ee4({'code':0xc8,'message':[_0x2b9d36[_0xfaa3('0x60')],_0x515a67[_0xfaa3('0x21')][_0xfaa3('0x68')]()][_0xfaa3('0x15')]('\x20')});})['catch'](function(_0x3cc53c){_0x2d8f04(_0x5a3d46[_0xfaa3('0x11')](0x1f5,[_0x2b9d36[_0xfaa3('0x60')],_0x3cc53c[_0xfaa3('0x21')][_0xfaa3('0x68')]()]['join']('\x20')));});}else{return _0x2d8f04(_0x5a3d46[_0xfaa3('0x11')](0x1f5,_0xfaa3('0x70')));}});},'Agents':function(_0xc20a3d){return new Promise(function(_0x5382ef,_0x3ddd0c){var _0x3a6b5b=_[_0xfaa3('0x5c')](_0x513eea['agents']);_0x5382ef({'count':_0x3a6b5b[_0xfaa3('0x5a')],'rows':_0x3a6b5b});});},'Telephones':function(_0x4b1b6f){return new Promise(function(_0x422201,_0x57a309){var _0x1956a6=_['values'](_0x513eea[_0xfaa3('0x7b')]);_0x422201({'count':_0x1956a6[_0xfaa3('0x5a')],'rows':_0x1956a6});});},'Trunks':function(_0x4fb738){return new Promise(function(_0x51e0b9,_0x452694){var _0x3824eb=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x7c')]);_0x51e0b9({'count':_0x3824eb[_0xfaa3('0x5a')],'rows':_0x3824eb});});},'OutboundChannels':function(_0x5bc92b){return new Promise(function(_0x40de0f,_0x328a25){var _0x24055c=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x7d')]);_0x40de0f({'count':_0x24055c[_0xfaa3('0x5a')],'rows':_0x24055c});});},'Outbound':function(_0x27479e){return new Promise(function(_0x3a8e72,_0x2514a2){_0x3a8e72(_0x513eea['outbound']);});},'Campaigns':function(_0x50a137){return new Promise(function(_0x10dc8d,_0x2d2554){var _0x570b95=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x7e')]);_0x10dc8d({'count':_0x570b95[_0xfaa3('0x5a')],'rows':_0x570b95});});},'VoiceQueuesPreview':function(_0x13e28f){var _0xf9867b=this;return new Promise(function(_0xa5c863,_0x3f02b2){_0x2ac57f[_0xfaa3('0x7f')](_0x13e28f['id'])[_0xfaa3('0x1e')](function(_0x4b42b9){_0xa5c863({'code':0xc8,'message':_0x4b42b9['message']});})[_0xfaa3('0x20')](function(_0x1a5885){_0x3f02b2(_0xf9867b[_0xfaa3('0x11')](0x1f4,_0x1a5885[_0xfaa3('0x21')]));});});},'EventManager':function(_0x2909a8){var _0x27226b=this;return new Promise(function(_0x2c5509,_0x27a1a5){if(!_0x2909a8['event']){return _0x27a1a5(_0x27226b['error'](0x1f4,_0xfaa3('0x80')));}ami[_0xfaa3('0x81')](_0xfaa3('0x82')+_0x2909a8['event'],_0x2909a8[_0xfaa3('0x21')]);_0x2c5509({'code':0xc8,'message':_0x2909a8});});},'FaxAccounts':function(_0x1fde58){return new Promise(function(_0x2a72be,_0x6c693a){var _0x1f458b=_[_0xfaa3('0x5c')](_0x513eea[_0xfaa3('0x83')]);_0x2a72be({'count':_0x1f458b['length'],'rows':_0x1f458b});});},'SendFax':function(_0x2f4cd3){var _0x24114d=this;return new Promise(function(_0x4d8ce7,_0x875fea){_0x4bac92[_0xfaa3('0x84')](_0x2f4cd3)[_0xfaa3('0x1e')](function(_0x310063){_0x4d8ce7({'code':0xc8,'message':_0x310063['message']});})[_0xfaa3('0x20')](function(_0x3a6d4d){_0x875fea(_0x24114d['error'](0x1f4,_0x3a6d4d[_0xfaa3('0x21')]));});});},'CheckAfterSend':function(_0x5f2169){var _0x5d502a=this;return new Promise(function(_0x49e054,_0x1161b6){_0x4bac92['checkAfterSend'](_0x5f2169)[_0xfaa3('0x1e')](function(_0x48cbd3){_0x49e054({'code':0xc8,'message':_0x48cbd3[_0xfaa3('0x21')]});})['catch'](function(_0xe679f8){_0x1161b6(_0x5d502a['error'](0x1f4,_0xe679f8[_0xfaa3('0x21')]));});});}};var _0x317056=jayson[_0xfaa3('0x85')](_0x352958)['http']();_0x317056['on']('error',function(_0x5561b2){return _0xeecce5(_0x5561b2);});_0x317056[_0xfaa3('0x86')](0x232a,_0xfaa3('0x87'),function(){console[_0xfaa3('0x88')](_0xfaa3('0x89'),0x232a);return _0x3d09aa(_0xfaa3('0x8a')+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 1579bac..a5d5c77 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 _0x032e=['format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s',''];(function(_0x5a6253,_0x4dd0b5){var _0x5816b3=function(_0x448846){while(--_0x448846){_0x5a6253['push'](_0x5a6253['shift']());}};_0x5816b3(++_0x4dd0b5);}(_0x032e,0x124));var _0xe032=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x032e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe032('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe032('0x3'));var cmContactRpc=require(_0xe032('0x4'));config[_0xe032('0x5')]=_[_0xe032('0x6')](config[_0xe032('0x5')],{'host':_0xe032('0x7'),'port':0x18eb});var io=require(_0xe032('0x8'))(new Redis(config[_0xe032('0x5')]));function emit(_0x37432f,_0x1576c8,_0x3289b0,_0xd84027,_0xaf3907){logger[_0xe032('0x9')](_0xe032('0xa'),_0x37432f,_0x1576c8['id'],_0x3289b0,_0xd84027,JSON[_0xe032('0xb')](_0xaf3907));io['to'](_0x3289b0)[_0xe032('0xc')](_0xd84027,_0xaf3907);}exports[_0xe032('0xd')]=function(_0x4aec53,_0x1382e1,_0x1ce2ae,_0x13c126){var _0x42e2ba,_0x244f93;var _0x21883b={};var _0x2194fc=Number(_0x1ce2ae['data1']);var _0x646979=_0x1ce2ae[_0xe032('0xe')]?Boolean(Number(_0x1ce2ae[_0xe032('0xe')])):![];var _0x1a53ab;var _0x4aee44=![];if(!_[_0xe032('0xf')](_0x1ce2ae[_0xe032('0x10')])){if(_0x1ce2ae[_0xe032('0x10')]=='1')_0x4aee44=!![];}if(!_0x4aee44){if(_0x13c126[_0xe032('0x11')]){_0x21883b['id']=_0x13c126[_0xe032('0x11')];}}if(!_0x21883b['id']){_0x21883b[_0xe032('0x12')]=_0x2194fc;_0x1a53ab=_0x1ce2ae[_0xe032('0x13')]&&_0x1ce2ae['data3']!=='0'?_0x1ce2ae[_0xe032('0x13')][_0xe032('0x14')](','):[_0xe032('0x15')];_0x21883b[_0xe032('0x16')]=_[_0xe032('0x17')](_0x1a53ab,function(_0x208b00){var _0x4cdab3={};_0x4cdab3[_0x208b00]=_0x13c126[_0xe032('0x18')]?_0x13c126[_0xe032('0x19')]:_0x13c126[_0xe032('0x1a')];return _0x4cdab3;});}var _0x41d2a5=['id',_0xe032('0x1b'),'lastName','phone','mobile',_0xe032('0x1c'),'ListId',_0xe032('0x1d'),_0xe032('0x1e'),_0xe032('0x1f')];var _0x2aa342=_[_0xe032('0x20')](_0x41d2a5,_0x1a53ab);BPromise[_0xe032('0x21')]()[_0xe032('0x22')](cmContactRpc['getContacts']({'attributes':_0x2aa342,'where':_0x21883b}))[_0xe032('0x22')](function(_0x866c81){_0x244f93=_0x866c81;if(!_[_0xe032('0x23')](_0x244f93)){if(_0x244f93[_0xe032('0x24')]===0x1){_0x42e2ba=_0x244f93[0x0];logger[_0xe032('0x9')](_0xe032('0x25'),_0x13c126[_0xe032('0x26')],_0x1382e1['id'],_0x42e2ba['id']);}else{logger[_0xe032('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x13c126['uniqueid'],_0x1382e1['id'],_['map'](_0x244f93,'id')[_0xe032('0x27')](','));}return;}else{logger[_0xe032('0x9')](_0xe032('0x28'),_0x13c126[_0xe032('0x26')],_0x1382e1['id']);var _0x2bfe8f={'ListId':_0x2194fc};var _0x200671=_0x1ce2ae[_0xe032('0x29')]&&_0x1ce2ae[_0xe032('0x29')]!=='0'?_0x1ce2ae[_0xe032('0x29')]:_0xe032('0x15');if(_0x646979){logger['info'](_0xe032('0x2a'),_0x13c126[_0xe032('0x26')],_0x1382e1['id']);_0x2bfe8f[_0x200671]=_[_0xe032('0xf')](_0x13c126[_0xe032('0x18')])?_0x13c126['calleridnum']:_0x13c126['destcalleridnum'];if(_[_0xe032('0xf')](_0x13c126[_0xe032('0x18')])){_0x2bfe8f[_0xe032('0x1b')]=_0x13c126[_0xe032('0x2b')]&&_0x13c126['calleridname']!==''?_0x13c126['calleridname']:_0xe032('0x2c');}else{_0x2bfe8f[_0xe032('0x1b')]=_0x13c126[_0xe032('0x2d')]&&_0x13c126[_0xe032('0x2d')]!==''?_0x13c126[_0xe032('0x2d')]:_0xe032('0x2c');}return BPromise[_0xe032('0x21')]()[_0xe032('0x22')](cmContactRpc[_0xe032('0x2e')](_0x2bfe8f))['then'](function(_0xd90bd5){_0x42e2ba=_0xd90bd5;_0x244f93[_0xe032('0x2f')](_0xd90bd5);if(_0x42e2ba){logger[_0xe032('0x9')](_0xe032('0x30'),_0x13c126['uniqueid'],_0x1382e1['id'],_0x42e2ba['id']);}return;});}else{logger[_0xe032('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x13c126[_0xe032('0x26')],_0x1382e1['id']);_0x2bfe8f[_0x200671]=_['isNil'](_0x13c126[_0xe032('0x18')])?_0x13c126['calleridnum']:_0x13c126[_0xe032('0x19')];if(_['isNil'](_0x13c126[_0xe032('0x18')])){_0x2bfe8f[_0xe032('0x1b')]=_0x13c126['calleridname']&&_0x13c126[_0xe032('0x2b')]!==_0xe032('0x31')?_0x13c126[_0xe032('0x2b')]:_0xe032('0x2c');}else{_0x2bfe8f['firstName']=_0x13c126[_0xe032('0x2d')]&&_0x13c126['destcalleridname']!==_0xe032('0x31')?_0x13c126[_0xe032('0x2d')]:'Unknown';}_0x42e2ba=_0x2bfe8f;_0x244f93[_0xe032('0x2f')](_0x2bfe8f);return;}}})[_0xe032('0x22')](function(){if(_0x4aec53){emit(_0x13c126['uniqueid'],_0x1382e1,util[_0xe032('0x32')](_0xe032('0x33'),_0x4aec53[_0xe032('0x34')]),util[_0xe032('0x32')](_0xe032('0x35'),_0x1ce2ae[_0xe032('0x36')][_0xe032('0x37')]()),{'evt':_[_0xe032('0x38')](_0x13c126,{'autoCreate':_0x646979}),'contact':_0x42e2ba===undefined?{}:_0x42e2ba,'contacts':_0x244f93[_0xe032('0x24')]===0x0?undefined:_0x244f93});}});}; \ No newline at end of file +var _0xbd50=['lastName','mobile','fax','createdAt','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName'];(function(_0x87b368,_0x1165fb){var _0x5761ae=function(_0x5a6d4f){while(--_0x5a6d4f){_0x87b368['push'](_0x87b368['shift']());}};_0x5761ae(++_0x1165fb);}(_0xbd50,0x196));var _0x0bd5=function(_0x652863,_0x36f1e1){_0x652863=_0x652863-0x0;var _0x1fcf1d=_0xbd50[_0x652863];return _0x1fcf1d;};'use strict';var _=require(_0x0bd5('0x0'));var BPromise=require(_0x0bd5('0x1'));var Redis=require(_0x0bd5('0x2'));var util=require('util');var config=require(_0x0bd5('0x3'));var logger=require(_0x0bd5('0x4'))(_0x0bd5('0x5'));var cmContactRpc=require(_0x0bd5('0x6'));config[_0x0bd5('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0bd5('0x8'))(new Redis(config[_0x0bd5('0x7')]));function emit(_0xcc6cfa,_0x2c0db1,_0x1b99f3,_0x5ebe64,_0x47e78d){logger[_0x0bd5('0x9')](_0x0bd5('0xa'),_0xcc6cfa,_0x2c0db1['id'],_0x1b99f3,_0x5ebe64,JSON[_0x0bd5('0xb')](_0x47e78d));io['to'](_0x1b99f3)['emit'](_0x5ebe64,_0x47e78d);}exports[_0x0bd5('0xc')]=function(_0x2fa7d1,_0x519bc6,_0x210f45,_0x7db86e){var _0x4d7d17,_0x1ce7dd;var _0x130723={};var _0x1aa818=Number(_0x210f45['data1']);var _0x2f7a0c=_0x210f45[_0x0bd5('0xd')]?Boolean(Number(_0x210f45[_0x0bd5('0xd')])):![];var _0xc5b4cd;var _0xfa1eed=![];if(!_[_0x0bd5('0xe')](_0x210f45[_0x0bd5('0xf')])){if(_0x210f45[_0x0bd5('0xf')]=='1')_0xfa1eed=!![];}if(!_0xfa1eed){if(_0x7db86e['xmd-contactid']){_0x130723['id']=_0x7db86e[_0x0bd5('0x10')];}}if(!_0x130723['id']){_0x130723[_0x0bd5('0x11')]=_0x1aa818;_0xc5b4cd=_0x210f45['data3']&&_0x210f45[_0x0bd5('0x12')]!=='0'?_0x210f45[_0x0bd5('0x12')][_0x0bd5('0x13')](','):[_0x0bd5('0x14')];_0x130723['$or']=_[_0x0bd5('0x15')](_0xc5b4cd,function(_0x2e4f36){var _0xa890be={};_0xa890be[_0x2e4f36]=_0x7db86e[_0x0bd5('0x16')]?_0x7db86e[_0x0bd5('0x17')]:_0x7db86e[_0x0bd5('0x18')];return _0xa890be;});}var _0xc58e12=['id',_0x0bd5('0x19'),_0x0bd5('0x1a'),_0x0bd5('0x14'),_0x0bd5('0x1b'),_0x0bd5('0x1c'),_0x0bd5('0x11'),_0x0bd5('0x1d'),'scheduledAt','updatedAt'];var _0x596b6a=_['union'](_0xc58e12,_0xc5b4cd);BPromise['resolve']()[_0x0bd5('0x1e')](cmContactRpc[_0x0bd5('0x1f')]({'attributes':_0x596b6a,'where':_0x130723}))[_0x0bd5('0x1e')](function(_0x4a6910){_0x1ce7dd=_0x4a6910;if(!_[_0x0bd5('0x20')](_0x1ce7dd)){if(_0x1ce7dd['length']===0x1){_0x4d7d17=_0x1ce7dd[0x0];logger[_0x0bd5('0x9')](_0x0bd5('0x21'),_0x7db86e[_0x0bd5('0x22')],_0x519bc6['id'],_0x4d7d17['id']);}else{logger['info'](_0x0bd5('0x23'),_0x7db86e['uniqueid'],_0x519bc6['id'],_['map'](_0x1ce7dd,'id')[_0x0bd5('0x24')](','));}return;}else{logger[_0x0bd5('0x9')](_0x0bd5('0x25'),_0x7db86e['uniqueid'],_0x519bc6['id']);var _0x42428c={'ListId':_0x1aa818};var _0x5eab3e=_0x210f45[_0x0bd5('0x26')]&&_0x210f45[_0x0bd5('0x26')]!=='0'?_0x210f45[_0x0bd5('0x26')]:_0x0bd5('0x14');if(_0x2f7a0c){logger[_0x0bd5('0x9')](_0x0bd5('0x27'),_0x7db86e[_0x0bd5('0x22')],_0x519bc6['id']);_0x42428c[_0x5eab3e]=_[_0x0bd5('0xe')](_0x7db86e[_0x0bd5('0x16')])?_0x7db86e[_0x0bd5('0x18')]:_0x7db86e[_0x0bd5('0x17')];if(_[_0x0bd5('0xe')](_0x7db86e[_0x0bd5('0x16')])){_0x42428c[_0x0bd5('0x19')]=_0x7db86e['calleridname']&&_0x7db86e[_0x0bd5('0x28')]!==_0x0bd5('0x29')?_0x7db86e['calleridname']:_0x0bd5('0x2a');}else{_0x42428c[_0x0bd5('0x19')]=_0x7db86e['destcalleridname']&&_0x7db86e[_0x0bd5('0x2b')]!==_0x0bd5('0x29')?_0x7db86e[_0x0bd5('0x2b')]:_0x0bd5('0x2a');}return BPromise['resolve']()[_0x0bd5('0x1e')](cmContactRpc[_0x0bd5('0x2c')](_0x42428c))[_0x0bd5('0x1e')](function(_0x24ef4a){_0x4d7d17=_0x24ef4a;_0x1ce7dd[_0x0bd5('0x2d')](_0x24ef4a);if(_0x4d7d17){logger[_0x0bd5('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x7db86e[_0x0bd5('0x22')],_0x519bc6['id'],_0x4d7d17['id']);}return;});}else{logger['info'](_0x0bd5('0x2e'),_0x7db86e[_0x0bd5('0x22')],_0x519bc6['id']);_0x42428c[_0x5eab3e]=_[_0x0bd5('0xe')](_0x7db86e[_0x0bd5('0x16')])?_0x7db86e[_0x0bd5('0x18')]:_0x7db86e[_0x0bd5('0x17')];if(_[_0x0bd5('0xe')](_0x7db86e[_0x0bd5('0x16')])){_0x42428c[_0x0bd5('0x19')]=_0x7db86e[_0x0bd5('0x28')]&&_0x7db86e[_0x0bd5('0x28')]!==_0x0bd5('0x29')?_0x7db86e[_0x0bd5('0x28')]:'Unknown';}else{_0x42428c[_0x0bd5('0x19')]=_0x7db86e[_0x0bd5('0x2b')]&&_0x7db86e['destcalleridname']!==''?_0x7db86e[_0x0bd5('0x2b')]:_0x0bd5('0x2a');}_0x4d7d17=_0x42428c;_0x1ce7dd[_0x0bd5('0x2d')](_0x42428c);return;}}})[_0x0bd5('0x1e')](function(){if(_0x2fa7d1){emit(_0x7db86e[_0x0bd5('0x22')],_0x519bc6,util[_0x0bd5('0x2f')](_0x0bd5('0x30'),_0x2fa7d1[_0x0bd5('0x31')]),util[_0x0bd5('0x2f')](_0x0bd5('0x32'),_0x210f45[_0x0bd5('0x33')][_0x0bd5('0x34')]()),{'evt':_[_0x0bd5('0x35')](_0x7db86e,{'autoCreate':_0x2f7a0c}),'contact':_0x4d7d17===undefined?{}:_0x4d7d17,'contacts':_0x1ce7dd['length']===0x0?undefined:_0x1ce7dd});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 506a250..8ca0877 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 _0xc247=['offlineMessage','created','equals','exports','util','lodash','url','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','undefined','motionChannel','voice','checkTriggers','hasOwnProperty','status','checkTrigger','merge','length','Actions','interface','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','user:%s','action','jscripty','format','name','trigger:%s','exec','integration','buildUri','parse','query','search','channel','AllConditions','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','event','queue','agent','membername','lastevent','routeId','mailSubstatus','null','substatus'];(function(_0x4aabb0,_0x6fbde7){var _0x2112c6=function(_0x58219e){while(--_0x58219e){_0x4aabb0['push'](_0x4aabb0['shift']());}};_0x2112c6(++_0x6fbde7);}(_0xc247,0xfe));var _0x7c24=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0xc247[_0x593d89];return _0x4aa403;};'use strict';var util=require(_0x7c24('0x0'));var _=require(_0x7c24('0x1'));var url=require(_0x7c24('0x2'));var Mustache=require('mustache');var Redis=require(_0x7c24('0x3'));var urlforward=require(_0x7c24('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x7c24('0x5'));var config=require(_0x7c24('0x6'));var logger=require(_0x7c24('0x7'))(_0x7c24('0x8'));var ami=require(_0x7c24('0x9'));config[_0x7c24('0xa')]=_[_0x7c24('0xb')](config[_0x7c24('0xa')],{'host':_0x7c24('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c24('0xa')]));var operators={'equals':function(_0x517f4c,_0x5e72bc){return _0x517f4c==_0x5e72bc;},'not_equals':function(_0x2a4474,_0xd329d0){return _0x2a4474!=_0xd329d0;}};var barAndWebActions=[_0x7c24('0xd'),_0x7c24('0x2'),'winapp'];function Trigger(_0x2174b8){this['triggers']=_0x2174b8[_0x7c24('0xe')];this[_0x7c24('0xf')]=_0x2174b8[_0x7c24('0xf')];this['voiceQueues']=_0x2174b8[_0x7c24('0x10')];this[_0x7c24('0x11')]=_0x2174b8[_0x7c24('0x11')];this[_0x7c24('0x12')]=_0x2174b8['voiceExtensions'];this['zendeskAccounts']=_0x2174b8[_0x7c24('0x13')];this[_0x7c24('0x14')]=_0x2174b8[_0x7c24('0x14')];this[_0x7c24('0x15')]=_0x2174b8[_0x7c24('0x15')];this['sugarcrmAccounts']=_0x2174b8['sugarcrmAccounts'];this[_0x7c24('0x16')]=_0x2174b8[_0x7c24('0x16')];this['deskAccounts']=_0x2174b8[_0x7c24('0x17')];this[_0x7c24('0x18')]=_0x2174b8[_0x7c24('0x18')];this[_0x7c24('0x19')]=_0x2174b8['servicenowAccounts'];this[_0x7c24('0x1a')]=_0x2174b8[_0x7c24('0x1a')];this[_0x7c24('0x1b')]=_0x2174b8[_0x7c24('0x1b')];this[_0x7c24('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x7c24('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x7c24('0x1d')],'zoho':this[_0x7c24('0x16')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x7c24('0x1a')],'freshsales':this[_0x7c24('0x1b')],'servicenow':this[_0x7c24('0x19')]};ami['on'](_0x7c24('0x1e'),this['syncCustomEvent'][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x20'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x22'),this[_0x7c24('0x21')]['bind'](this));ami['on'](_0x7c24('0x23'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x24'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x25'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x26'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x27'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x28'),this[_0x7c24('0x21')]['bind'](this));ami['on'](_0x7c24('0x29'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x2a'),this[_0x7c24('0x21')]['bind'](this));ami['on']('custom:dialbegin',this[_0x7c24('0x2b')][_0x7c24('0x1f')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x2c'),this['syncAgentDial'][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x2d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:closedinteraction',this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x2e'),this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x2f'),this[_0x7c24('0x21')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on']('custom:acceptmessage',this[_0x7c24('0x21')][_0x7c24('0x1f')](this));ami['on'](_0x7c24('0x30'),this[_0x7c24('0x21')]['bind'](this));ami['on'](_0x7c24('0x31'),this['syncCustomEvent'][_0x7c24('0x1f')](this));}Trigger[_0x7c24('0x32')][_0x7c24('0x33')]=function(_0xf98971,_0x30d3b3,_0x2c15be){logger[_0x7c24('0x34')](_0xf98971,_0x30d3b3,JSON['stringify'](_0x2c15be));io['to'](_0xf98971)[_0x7c24('0x33')](_0x30d3b3,_0x2c15be);};Trigger[_0x7c24('0x32')][_0x7c24('0x21')]=function(_0x3ceeae){var _0x111576=_[_0x7c24('0x35')](_0x3ceeae);if(typeof _0x111576['motionChannel']===_0x7c24('0x36')){_0x111576[_0x7c24('0x37')]=_0x7c24('0x38');}this['checkTriggers'](_0x111576);};Trigger[_0x7c24('0x32')][_0x7c24('0x2b')]=function(_0xce9273){if(this['agents'][_0xce9273['interface']]){this[_0x7c24('0x21')](_0xce9273);}};Trigger[_0x7c24('0x32')][_0x7c24('0x39')]=function(_0x47928d){var _0x46c9be;for(var _0x1707a3 in this['triggers']){if(this[_0x7c24('0xe')][_0x7c24('0x3a')](_0x1707a3)){if(this['triggers'][_0x1707a3][_0x7c24('0x3b')]){_0x46c9be=this[_0x7c24('0x3c')](this['triggers'][_0x1707a3],_0x47928d);if(_0x46c9be){_[_0x7c24('0x3d')](_0x47928d,_0x47928d['variables']);for(var _0x569327=0x0,_0x5ab5fb,_0xaf756d,_0x138d11;_0x5693270x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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(_0x4e65cb,_0xb86de){var _0x4144ce=function(_0x4df66e){while(--_0x4df66e){_0x4e65cb['push'](_0x4e65cb['shift']());}};_0x4144ce(++_0xb86de);}(_0x814b,0x1a2));var _0xb814=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0x814b[_0x119e7a];return _0x1fb90a;};'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 49140d9..a125062 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 _0xef8b=['%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','redis','defaults','localhost','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token',']\x20Wrong\x20credentials!','message','GET','isNil','validateEmail','email','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','contacts','/systemusers(','userId','Bearer\x20','4.0','headers','odata-entityid','substring','enduserId','destcalleridnum','calleridnum','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','picklist','type','nameField','customField','idField','indexOf','ticketType','assign','Subjects','getString','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','lastIndexOf','ticketId','format'];(function(_0x6cb205,_0x4e835d){var _0x2291d6=function(_0x5e1aca){while(--_0x5e1aca){_0x6cb205['push'](_0x6cb205['shift']());}};_0x2291d6(++_0x4e835d);}(_0xef8b,0xee));var _0xbef8=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0xef8b[_0x5be8cc];return _0x5f1b7e;};'use strict';var _=require(_0xbef8('0x0'));var rp=require('request-promise');var util=require(_0xbef8('0x1'));var intUtil=require(_0xbef8('0x2'));var md5=require(_0xbef8('0x3'));var Redis=require(_0xbef8('0x4'));var logger=require('../../../../config/logger')(_0xbef8('0x5'));var config=require('../../../../config/environment');config[_0xbef8('0x6')]=_[_0xbef8('0x7')](config[_0xbef8('0x6')],{'host':_0xbef8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbef8('0x6')]));function getAuthToken(_0x506f97,_0x43f722,_0x1a45fd){if(_0x506f97['modernAuthentication']){_0x506f97['remoteUri']=_0x506f97[_0xbef8('0x9')]['data7'];_0x506f97[_0xbef8('0xa')]=_0x506f97[_0xbef8('0x9')][_0xbef8('0xb')];return Promise[_0xbef8('0xc')](_0x506f97[_0xbef8('0x9')][_0xbef8('0xd')]);}var _0x18a148={'method':_0xbef8('0xe'),'uri':_0x43f722,'form':{'client_id':_0x506f97[_0xbef8('0xf')],'resource':_0x506f97[_0xbef8('0x10')],'username':_0x506f97[_0xbef8('0x11')],'password':_0x506f97[_0xbef8('0x12')],'grant_type':_0xbef8('0x12'),'client_secret':_0x506f97[_0xbef8('0x13')]},'json':!![]};return rp(_0x18a148)[_0xbef8('0x14')](function(_0x5f3a69){return _0x5f3a69[_0xbef8('0x15')];})['catch'](function(_0x39040f){logger['error']('['+[_0x1a45fd['toUpperCase']()]+_0xbef8('0x16'));return _0x39040f[_0xbef8('0x17')];});}function getUser(_0x369bfc,_0x29de49,_0x361793,_0x4a8885,_0x2dfac7,_0x1ac530){return new Promise(function(_0x4066d0,_0x2e21e8){return getAuthToken(_0x29de49,_0x4a8885,_0x1ac530)['then'](function(_0x2fe907){var _0x13c46f={'method':_0xbef8('0x18'),'uri':_0x2dfac7+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x2fe907,'OData-Version':'4.0'},'json':!![]};return rp(_0x13c46f);})['then'](function(_0x14e5a5){var _0x17e09b=_0x14e5a5['value'];var _0x15eb93=![];var _0x3bc86a=null;if(!_[_0xbef8('0x19')](_0x361793)){if(intUtil[_0xbef8('0x1a')](_0x361793['email'])){_0x369bfc['userEmail']=_0x361793[_0xbef8('0x1b')];for(_0x3bc86a=0x0;_0x3bc86a<_0x17e09b[_0xbef8('0x1c')];_0x3bc86a++){if(_0x17e09b[_0x3bc86a][_0xbef8('0x1d')]===_0x361793[_0xbef8('0x1b')]&&!_0x17e09b[_0x3bc86a]['isdisabled']){_0x15eb93=!![];logger['info']('['+[_0x1ac530['toUpperCase']()]+_0xbef8('0x1e')+_0x17e09b[_0x3bc86a][_0xbef8('0x1f')]+'!');_0x369bfc['userId']=_0x17e09b[_0x3bc86a][_0xbef8('0x1f')];}}}}if(!_0x15eb93){logger[_0xbef8('0x20')]('['+[_0x1ac530[_0xbef8('0x21')]()]+_0xbef8('0x22'));_0x369bfc['userEmail']=_0x29de49[_0xbef8('0x11')];for(_0x3bc86a=0x0;_0x3bc86a<_0x17e09b['length'];_0x3bc86a++){if(_0x17e09b[_0x3bc86a][_0xbef8('0x1d')]===_0x29de49[_0xbef8('0x11')]){_0x369bfc['userId']=_0x17e09b[_0x3bc86a][_0xbef8('0x1f')];}}}_0x4066d0(_0x369bfc);})[_0xbef8('0x23')](function(_0x294e89){_0x2e21e8(_0x294e89[_0xbef8('0x17')]);});});}function createEndUser(_0xd99615,_0x28665c,_0xd29f19,_0x281845,_0x3e8af9,_0x2d212b){return new Promise(function(_0x28c20f,_0x903524){return getAuthToken(_0x28665c,_0xd29f19,_0x2d212b)[_0xbef8('0x14')](function(_0x4f69fe){var _0x50d3ef=_0x2d212b[_0xbef8('0x24')]()===_0xbef8('0x25')?_0x3e8af9['destcalleridnum']:_0x3e8af9['calleridnum'];var _0x1dac87={'method':'POST','uri':_0x281845+_0xbef8('0x26'),'body':{'telephone1':_0x50d3ef,'fullname':_0x50d3ef,'firstname':_0x50d3ef,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbef8('0x27')+_0xd99615[_0xbef8('0x28')]+')'},'headers':{'Authorization':_0xbef8('0x29')+_0x4f69fe,'OData-Version':_0xbef8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1dac87);})[_0xbef8('0x14')](function(_0x4dae53){var _0x423c33=_0x4dae53[_0xbef8('0x2b')][_0xbef8('0x2c')];var _0x36665a=_0x423c33[_0xbef8('0x2d')](_0x423c33['lastIndexOf']('(')+0x1,_0x423c33['lastIndexOf'](')'));_0xd99615[_0xbef8('0x2e')]=_0x36665a;_0x28c20f(_0xd99615);})['catch'](function(_0x1d5e7f){_0x903524(_0x1d5e7f[_0xbef8('0x17')]);});});}function getEndUser(_0x47449b,_0x38546b,_0x1185ea,_0x1a235f,_0x4996bf,_0x17e31d,_0xe5144d){var _0xc3d0d5=_0x17e31d[_0xbef8('0x24')]()===_0xbef8('0x25')?_0x4996bf[_0xbef8('0x2f')]:_0x4996bf[_0xbef8('0x30')];return getAuthToken(_0x38546b,_0x1185ea,_0x17e31d)[_0xbef8('0x14')](function(_0x25b896){var _0x3c6e6b={'method':_0xbef8('0x18'),'uri':_0x1a235f+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0xc3d0d5[_0xbef8('0x31')]('+',_0xbef8('0x32'))+'\x27','headers':{'Authorization':_0xbef8('0x29')+_0x25b896,'If-None-Match':null,'OData-Version':_0xbef8('0x2a')},'json':!![]};return rp(_0x3c6e6b);})[_0xbef8('0x14')](function(_0x19c546){var _0x14db97=![];if(!_0x19c546)return _0x14db97;var _0xd820c0=_0x19c546['value'];for(var _0x5ce473=0x0;_0x5ce473<_0xd820c0[_0xbef8('0x1c')];_0x5ce473++){if(_0xd820c0[_0x5ce473][_0xbef8('0x33')]===_0xc3d0d5){_0x14db97=!![];_0x47449b[_0xbef8('0x2e')]=_0xd820c0[_0x5ce473][_0xbef8('0x34')];}}return _0x14db97;})[_0xbef8('0x14')](function(_0x598fde){if(_0x598fde)return _0x47449b;if(_0xe5144d===_0xbef8('0x35')){logger[_0xbef8('0x20')]('['+[_0x17e31d[_0xbef8('0x21')]()]+_0xbef8('0x36'));return _0x47449b;}return createEndUser(_0x47449b,_0x38546b,_0x1185ea,_0x1a235f,_0x4996bf,_0x17e31d)[_0xbef8('0x14')](function(_0x152abf){logger[_0xbef8('0x20')]('['+[_0x17e31d['toUpperCase']()]+']\x20Enduser\x20created!',_0x152abf['enduserId']);return _0x152abf;});});}function getCustomFields(_0x15fb17,_0x27f0fd,_0x217221){var _0x43bee2={};if(_0x15fb17[_0xbef8('0x1c')]>0x0){_[_0xbef8('0x37')](_0x15fb17,function(_0x578ea5){if(_[_0xbef8('0x38')](['string',_0xbef8('0x39')],_0x578ea5[_0xbef8('0x3a')])&&_0x578ea5[_0xbef8('0x3b')]&&!_0x578ea5[_0xbef8('0x3c')]){var _0x3163a4=_0x578ea5[_0xbef8('0x3d')][_0xbef8('0x24')]();var _0x4f53e8=_0x3163a4[_0xbef8('0x2d')](0x0,_0x3163a4[_0xbef8('0x3e')]('_'));var _0x5b0d3e=_0x3163a4[_0xbef8('0x2d')](_0x3163a4['indexOf']('_')+0x1);if(_0x4f53e8===_0x217221){_0x43bee2[_0x5b0d3e]=_0x578ea5['content'];}}});}return _0x43bee2;}function getTicket(_0x4394f4,_0x21b726,_0x23423c,_0x1dce00,_0x1ed2bf,_0x22530e,_0x21136c){return new Promise(function(_0x1137c8,_0x52fa43){var _0x29ee74;return getAuthToken(_0x21b726,_0x23423c,_0x21136c)[_0xbef8('0x14')](function(_0xcc9358){if(_0x22530e[_0xbef8('0x3f')]==='incident'){_0x29ee74={'method':_0xbef8('0xe'),'uri':_0x1dce00+'incidents','body':Object[_0xbef8('0x40')]({},{'title':intUtil['getString'](_0x22530e[_0xbef8('0x41')],_0x1ed2bf,'\x20'),'description':intUtil[_0xbef8('0x42')](_0x22530e[_0xbef8('0x43')],_0x1ed2bf,'\x0a'),'customerid_contact@odata.bind':_0x4394f4[_0xbef8('0x2e')]?'/contacts('+_0x4394f4[_0xbef8('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4394f4[_0xbef8('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x22530e[_0xbef8('0x44')],_0x1ed2bf,_0x22530e['ticketType'])),'headers':{'Authorization':_0xbef8('0x29')+_0xcc9358,'OData-Version':_0xbef8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x22530e['ticketType']===_0xbef8('0x45')){var _0x3ebec3=_0x4394f4[_0xbef8('0x2e')]?[{'partyid_systemuser@odata.bind':_0xbef8('0x27')+_0x4394f4['userId']+')','participationtypemask':_0x4394f4[_0xbef8('0x46')]===_0xbef8('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xbef8('0x48')+_0x4394f4[_0xbef8('0x2e')]+')','participationtypemask':_0x4394f4[_0xbef8('0x46')]===_0xbef8('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xbef8('0x27')+_0x4394f4['userId']+')','participationtypemask':_0x4394f4[_0xbef8('0x46')]===_0xbef8('0x47')?0x2:0x1}];_0x29ee74={'method':_0xbef8('0xe'),'uri':_0x1dce00+_0xbef8('0x49'),'body':Object[_0xbef8('0x40')]({},{'subject':intUtil[_0xbef8('0x42')](_0x22530e[_0xbef8('0x41')],_0x1ed2bf,'\x20'),'phonenumber':String(_0x1ed2bf[_0xbef8('0x30')]),'description':intUtil['getString'](_0x22530e['Descriptions'],_0x1ed2bf,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4394f4[_0xbef8('0x2e')]?_0xbef8('0x48')+_0x4394f4[_0xbef8('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4394f4[_0xbef8('0x28')]+')','directioncode':_0x4394f4['callDirection']===_0xbef8('0x47')?![]:!![],'phonecall_activity_parties':_0x3ebec3},getCustomFields(_0x22530e[_0xbef8('0x44')],_0x1ed2bf,_0x22530e[_0xbef8('0x3f')])),'headers':{'Authorization':_0xbef8('0x29')+_0xcc9358,'OData-Version':_0xbef8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x29ee74);})['then'](function(_0x49be55){var _0x47112a=_0x49be55['headers']['odata-entityid'];var _0x3cd678=_0x47112a['substring'](_0x47112a[_0xbef8('0x4a')]('(')+0x1,_0x47112a[_0xbef8('0x4a')](')'));_0x4394f4[_0xbef8('0x4b')]=_0x3cd678;_0x1137c8(_0x4394f4);})[_0xbef8('0x23')](function(_0x44c506){_0x52fa43(_0x44c506['message']);});});}function emit(_0x91a400,_0x4aef3f,_0x2f4036,_0x4e05e7){var _0x2f698c={'uri':util[_0xbef8('0x4c')](_0xbef8('0x4d'),_0x91a400,_0x2f4036,_0x4e05e7)};io['to'](util[_0xbef8('0x4c')](_0xbef8('0x4e'),_0x4aef3f))[_0xbef8('0x4f')](_0xbef8('0x50'),_0x2f698c);}exports['cs']=function(_0x3a4826,_0x1e4f4c,_0x480ddc,_0x3676a3,_0x2ab31f,_0x190d29,_0x1cdc0e,_0x24c220){var _0x26fc81={};_0x190d29[_0xbef8('0x10')]=_0x190d29[_0xbef8('0x51')]?intUtil[_0xbef8('0x52')](_0x190d29[_0xbef8('0x9')]['data7']):intUtil[_0xbef8('0x52')](_0x190d29[_0xbef8('0x10')]);_0x190d29[_0xbef8('0x53')]=intUtil[_0xbef8('0x52')](_0x190d29['serverUrl']);_0x26fc81['callDirection']=_0x24c220===_0xbef8('0x47')||_0x24c220===_0xbef8('0x54')?_0xbef8('0x47'):_0xbef8('0x25');var _0x5a8579=_0x190d29['modernAuthentication']?util[_0xbef8('0x4c')](_0xbef8('0x55'),_0x190d29[_0xbef8('0x9')][_0xbef8('0x56')]):util['format'](_0xbef8('0x55'),_0x190d29['remoteUri']);var _0x481d5f=util[_0xbef8('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x190d29[_0xbef8('0xa')]);var _0x1eebd2=util[_0xbef8('0x4c')](_0xbef8('0x57'),_0x190d29[_0xbef8('0x53')],_0x1e4f4c[_0xbef8('0x58')],md5(_0x1e4f4c[_0xbef8('0x58')]));if(_0x2ab31f&&_0x2ab31f[_0xbef8('0x59')]){logger['info'](_0xbef8('0x5a'),_0xbef8('0x5b'));_0x1e4f4c[_0xbef8('0x5c')]=_0x1eebd2;}else if(_0x1cdc0e&&_0x1cdc0e['recordingFormat']&&_0x1cdc0e[_0xbef8('0x5d')]!==_0xbef8('0x5e')){logger[_0xbef8('0x20')]('[OUTBOUND]',_0xbef8('0x5b'));_0x1e4f4c[_0xbef8('0x5c')]=_0x1eebd2;}else{_0x1e4f4c['recordingURL']='';}return getUser(_0x26fc81,_0x190d29,_0x3676a3,_0x481d5f,_0x5a8579,_0x24c220)[_0xbef8('0x14')](function(_0x46e616){logger[_0xbef8('0x20')]('['+_0x24c220['toUpperCase']()+_0xbef8('0x5f'),_0x46e616['userId']);logger[_0xbef8('0x20')]('['+_0x24c220[_0xbef8('0x21')]()+_0xbef8('0x60'),_0x46e616[_0xbef8('0x61')]);return getEndUser(_0x46e616,_0x190d29,_0x481d5f,_0x5a8579,_0x1e4f4c,_0x24c220,_0x480ddc[_0xbef8('0x62')]);})['then'](function(_0x7ad453){logger[_0xbef8('0x20')]('['+_0x24c220[_0xbef8('0x21')]()+_0xbef8('0x63'),_0x7ad453[_0xbef8('0x2e')]);logger[_0xbef8('0x20')]('['+_0x24c220[_0xbef8('0x21')]()+_0xbef8('0x64'),_0x1e4f4c[_0xbef8('0x30')]);return getTicket(_0x7ad453,_0x190d29,_0x481d5f,_0x5a8579,_0x1e4f4c,_0x480ddc,_0x24c220);})['then'](function(_0x523265){logger[_0xbef8('0x20')](util[_0xbef8('0x4c')]('['+_0x24c220['toUpperCase']()+_0xbef8('0x65'),_0x480ddc[_0xbef8('0x3f')],_0x523265[_0xbef8('0x4b')]));logger[_0xbef8('0x20')](util[_0xbef8('0x4c')]('['+_0x24c220[_0xbef8('0x21')]()+_0xbef8('0x66'),_0x24c220));if(_0x24c220!==_0xbef8('0x54')){logger['info']('['+_0x24c220[_0xbef8('0x21')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x190d29[_0xbef8('0x10')],_0x3676a3[_0xbef8('0x67')],_0x480ddc[_0xbef8('0x3f')],_0x523265[_0xbef8('0x4b')]);}})[_0xbef8('0x23')](function(_0x5eea17){logger['error']('['+_0x24c220[_0xbef8('0x21')]()+_0xbef8('0x68'),_0x5eea17[_0xbef8('0x17')]);});}; \ No newline at end of file +var _0xb176=['trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','data7','tenantId','data2','resolve','CloudProvider','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','username','internalemailaddress','userId','toLowerCase','outbound','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit'];(function(_0x1a9bdf,_0x43130a){var _0x61a042=function(_0x13fdf5){while(--_0x13fdf5){_0x1a9bdf['push'](_0x1a9bdf['shift']());}};_0x61a042(++_0x43130a);}(_0xb176,0x164));var _0x6b17=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xb176[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0x6b17('0x0'));var rp=require('request-promise');var util=require(_0x6b17('0x1'));var intUtil=require('./util');var md5=require(_0x6b17('0x2'));var Redis=require(_0x6b17('0x3'));var logger=require(_0x6b17('0x4'))(_0x6b17('0x5'));var config=require('../../../../config/environment');config[_0x6b17('0x6')]=_[_0x6b17('0x7')](config[_0x6b17('0x6')],{'host':_0x6b17('0x8'),'port':0x18eb});var io=require(_0x6b17('0x9'))(new Redis(config[_0x6b17('0x6')]));function getAuthToken(_0x2e46da,_0x560774,_0x1ef1d0){if(_0x2e46da[_0x6b17('0xa')]){_0x2e46da['remoteUri']=_0x2e46da['CloudProvider'][_0x6b17('0xb')];_0x2e46da[_0x6b17('0xc')]=_0x2e46da['CloudProvider'][_0x6b17('0xd')];return Promise[_0x6b17('0xe')](_0x2e46da[_0x6b17('0xf')]['data5']);}var _0x5ce029={'method':_0x6b17('0x10'),'uri':_0x560774,'form':{'client_id':_0x2e46da[_0x6b17('0x11')],'resource':_0x2e46da[_0x6b17('0x12')],'username':_0x2e46da['username'],'password':_0x2e46da[_0x6b17('0x13')],'grant_type':_0x6b17('0x13'),'client_secret':_0x2e46da[_0x6b17('0x14')]},'json':!![]};return rp(_0x5ce029)[_0x6b17('0x15')](function(_0x312ab4){return _0x312ab4[_0x6b17('0x16')];})[_0x6b17('0x17')](function(_0x3cf549){logger[_0x6b17('0x18')]('['+[_0x1ef1d0[_0x6b17('0x19')]()]+_0x6b17('0x1a'));return _0x3cf549[_0x6b17('0x1b')];});}function getUser(_0x5a0fb1,_0x8780b4,_0x58b804,_0x258477,_0x2a5ee3,_0x58f1ad){return new Promise(function(_0x1ed505,_0x4f69fb){return getAuthToken(_0x8780b4,_0x258477,_0x58f1ad)[_0x6b17('0x15')](function(_0x2a7a58){var _0x35fea2={'method':_0x6b17('0x1c'),'uri':_0x2a5ee3+_0x6b17('0x1d'),'headers':{'Authorization':'Bearer\x20'+_0x2a7a58,'OData-Version':'4.0'},'json':!![]};return rp(_0x35fea2);})['then'](function(_0x5ae4f3){var _0x35edbc=_0x5ae4f3[_0x6b17('0x1e')];var _0x1718c2=![];var _0x4d9dd6=null;if(!_[_0x6b17('0x1f')](_0x58b804)){if(intUtil[_0x6b17('0x20')](_0x58b804['email'])){_0x5a0fb1[_0x6b17('0x21')]=_0x58b804[_0x6b17('0x22')];for(_0x4d9dd6=0x0;_0x4d9dd6<_0x35edbc[_0x6b17('0x23')];_0x4d9dd6++){if(_0x35edbc[_0x4d9dd6]['internalemailaddress']===_0x58b804[_0x6b17('0x22')]&&!_0x35edbc[_0x4d9dd6][_0x6b17('0x24')]){_0x1718c2=!![];logger[_0x6b17('0x25')]('['+[_0x58f1ad[_0x6b17('0x19')]()]+_0x6b17('0x26')+_0x35edbc[_0x4d9dd6][_0x6b17('0x27')]+'!');_0x5a0fb1['userId']=_0x35edbc[_0x4d9dd6][_0x6b17('0x27')];}}}}if(!_0x1718c2){logger[_0x6b17('0x25')]('['+[_0x58f1ad['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5a0fb1[_0x6b17('0x21')]=_0x8780b4[_0x6b17('0x28')];for(_0x4d9dd6=0x0;_0x4d9dd6<_0x35edbc[_0x6b17('0x23')];_0x4d9dd6++){if(_0x35edbc[_0x4d9dd6][_0x6b17('0x29')]===_0x8780b4['username']){_0x5a0fb1[_0x6b17('0x2a')]=_0x35edbc[_0x4d9dd6][_0x6b17('0x27')];}}}_0x1ed505(_0x5a0fb1);})[_0x6b17('0x17')](function(_0x154cdf){_0x4f69fb(_0x154cdf[_0x6b17('0x1b')]);});});}function createEndUser(_0x392054,_0x437bfb,_0x481c18,_0x23c50c,_0x418907,_0x5776a1){return new Promise(function(_0x1d31e7,_0x32d805){return getAuthToken(_0x437bfb,_0x481c18,_0x5776a1)[_0x6b17('0x15')](function(_0x545402){var _0x1c12ea=_0x5776a1[_0x6b17('0x2b')]()===_0x6b17('0x2c')?_0x418907['destcalleridnum']:_0x418907[_0x6b17('0x2d')];var _0x5d1af5={'method':_0x6b17('0x10'),'uri':_0x23c50c+_0x6b17('0x2e'),'body':{'telephone1':_0x1c12ea,'fullname':_0x1c12ea,'firstname':_0x1c12ea,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6b17('0x2f')+_0x392054[_0x6b17('0x2a')]+')'},'headers':{'Authorization':_0x6b17('0x30')+_0x545402,'OData-Version':_0x6b17('0x31')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5d1af5);})[_0x6b17('0x15')](function(_0x2e1337){var _0x142913=_0x2e1337[_0x6b17('0x32')][_0x6b17('0x33')];var _0x42c37d=_0x142913[_0x6b17('0x34')](_0x142913[_0x6b17('0x35')]('(')+0x1,_0x142913[_0x6b17('0x35')](')'));_0x392054[_0x6b17('0x36')]=_0x42c37d;_0x1d31e7(_0x392054);})[_0x6b17('0x17')](function(_0x1e9faa){_0x32d805(_0x1e9faa[_0x6b17('0x1b')]);});});}function getEndUser(_0x5b455c,_0x2748ac,_0x2caf19,_0x17c230,_0x2c7368,_0x431507,_0x401c1f){var _0x27f382=_0x431507[_0x6b17('0x2b')]()==='outbound'?_0x2c7368['destcalleridnum']:_0x2c7368['calleridnum'];return getAuthToken(_0x2748ac,_0x2caf19,_0x431507)[_0x6b17('0x15')](function(_0x50d581){var _0x679af={'method':_0x6b17('0x1c'),'uri':_0x17c230+_0x6b17('0x37')+_0x27f382[_0x6b17('0x38')]('+',_0x6b17('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x50d581,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x679af);})['then'](function(_0x523df2){var _0x3ff8e4=![];if(!_0x523df2)return _0x3ff8e4;var _0x371e31=_0x523df2['value'];for(var _0x4d8cc9=0x0;_0x4d8cc9<_0x371e31[_0x6b17('0x23')];_0x4d8cc9++){if(_0x371e31[_0x4d8cc9][_0x6b17('0x3a')]===_0x27f382){_0x3ff8e4=!![];_0x5b455c['enduserId']=_0x371e31[_0x4d8cc9][_0x6b17('0x3b')];}}return _0x3ff8e4;})[_0x6b17('0x15')](function(_0x23d47e){if(_0x23d47e)return _0x5b455c;if(_0x401c1f===_0x6b17('0x3c')){logger[_0x6b17('0x25')]('['+[_0x431507[_0x6b17('0x19')]()]+_0x6b17('0x3d'));return _0x5b455c;}return createEndUser(_0x5b455c,_0x2748ac,_0x2caf19,_0x17c230,_0x2c7368,_0x431507)[_0x6b17('0x15')](function(_0x5aa601){logger[_0x6b17('0x25')]('['+[_0x431507[_0x6b17('0x19')]()]+_0x6b17('0x3e'),_0x5aa601[_0x6b17('0x36')]);return _0x5aa601;});});}function getCustomFields(_0x3e821e,_0x4928c8,_0x53cb2b){var _0x420261={};if(_0x3e821e['length']>0x0){_[_0x6b17('0x3f')](_0x3e821e,function(_0x2dff4f){if(_[_0x6b17('0x40')]([_0x6b17('0x41'),_0x6b17('0x42')],_0x2dff4f[_0x6b17('0x43')])&&_0x2dff4f[_0x6b17('0x44')]&&!_0x2dff4f['customField']){var _0x4822d7=_0x2dff4f[_0x6b17('0x45')][_0x6b17('0x2b')]();var _0x144847=_0x4822d7['substring'](0x0,_0x4822d7['indexOf']('_'));var _0x4acaed=_0x4822d7[_0x6b17('0x34')](_0x4822d7[_0x6b17('0x46')]('_')+0x1);if(_0x144847===_0x53cb2b){_0x420261[_0x4acaed]=_0x2dff4f[_0x6b17('0x47')];}}});}return _0x420261;}function getTicket(_0x5a8d2f,_0x133489,_0x4cf2b5,_0x257f4c,_0xf3896c,_0xabbc61,_0x3bdf4e){return new Promise(function(_0x4781fd,_0x2d1824){var _0x246482;return getAuthToken(_0x133489,_0x4cf2b5,_0x3bdf4e)['then'](function(_0xc63c97){if(_0xabbc61[_0x6b17('0x48')]===_0x6b17('0x49')){_0x246482={'method':_0x6b17('0x10'),'uri':_0x257f4c+'incidents','body':Object['assign']({},{'title':intUtil[_0x6b17('0x4a')](_0xabbc61[_0x6b17('0x4b')],_0xf3896c,'\x20'),'description':intUtil[_0x6b17('0x4a')](_0xabbc61[_0x6b17('0x4c')],_0xf3896c,'\x0a'),'customerid_contact@odata.bind':_0x5a8d2f['enduserId']?_0x6b17('0x4d')+_0x5a8d2f[_0x6b17('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5a8d2f['userId']+')','caseorigincode':'1'},getCustomFields(_0xabbc61[_0x6b17('0x4e')],_0xf3896c,_0xabbc61[_0x6b17('0x48')])),'headers':{'Authorization':_0x6b17('0x30')+_0xc63c97,'OData-Version':_0x6b17('0x31')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xabbc61[_0x6b17('0x48')]===_0x6b17('0x4f')){var _0x2fa7e9=_0x5a8d2f[_0x6b17('0x36')]?[{'partyid_systemuser@odata.bind':_0x6b17('0x2f')+_0x5a8d2f[_0x6b17('0x2a')]+')','participationtypemask':_0x5a8d2f[_0x6b17('0x50')]===_0x6b17('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0x6b17('0x4d')+_0x5a8d2f[_0x6b17('0x36')]+')','participationtypemask':_0x5a8d2f['callDirection']===_0x6b17('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6b17('0x2f')+_0x5a8d2f['userId']+')','participationtypemask':_0x5a8d2f[_0x6b17('0x50')]==='queue'?0x2:0x1}];_0x246482={'method':'POST','uri':_0x257f4c+_0x6b17('0x52'),'body':Object[_0x6b17('0x53')]({},{'subject':intUtil[_0x6b17('0x4a')](_0xabbc61[_0x6b17('0x4b')],_0xf3896c,'\x20'),'phonenumber':String(_0xf3896c[_0x6b17('0x2d')]),'description':intUtil[_0x6b17('0x4a')](_0xabbc61[_0x6b17('0x4c')],_0xf3896c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5a8d2f[_0x6b17('0x36')]?_0x6b17('0x4d')+_0x5a8d2f['enduserId']+')':undefined,'ownerid@odata.bind':_0x6b17('0x2f')+_0x5a8d2f['userId']+')','directioncode':_0x5a8d2f['callDirection']===_0x6b17('0x51')?![]:!![],'phonecall_activity_parties':_0x2fa7e9},getCustomFields(_0xabbc61[_0x6b17('0x4e')],_0xf3896c,_0xabbc61[_0x6b17('0x48')])),'headers':{'Authorization':_0x6b17('0x30')+_0xc63c97,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x246482);})[_0x6b17('0x15')](function(_0x3cb733){var _0x48051d=_0x3cb733['headers'][_0x6b17('0x33')];var _0x271d9a=_0x48051d[_0x6b17('0x34')](_0x48051d[_0x6b17('0x35')]('(')+0x1,_0x48051d['lastIndexOf'](')'));_0x5a8d2f['ticketId']=_0x271d9a;_0x4781fd(_0x5a8d2f);})[_0x6b17('0x17')](function(_0x2f00ad){_0x2d1824(_0x2f00ad[_0x6b17('0x1b')]);});});}function emit(_0xd1d5a6,_0x5475c3,_0x34241a,_0x580db6){var _0x42da49={'uri':util[_0x6b17('0x54')](_0x6b17('0x55'),_0xd1d5a6,_0x34241a,_0x580db6)};io['to'](util[_0x6b17('0x54')](_0x6b17('0x56'),_0x5475c3))[_0x6b17('0x57')](_0x6b17('0x58'),_0x42da49);}exports['cs']=function(_0x586de0,_0x58613a,_0x1ea63d,_0x38a711,_0x34f9ca,_0x11891b,_0x54e21e,_0x466a86){var _0x3cad6a={};_0x11891b[_0x6b17('0x12')]=_0x11891b[_0x6b17('0xa')]?intUtil[_0x6b17('0x59')](_0x11891b['CloudProvider'][_0x6b17('0xb')]):intUtil[_0x6b17('0x59')](_0x11891b[_0x6b17('0x12')]);_0x11891b[_0x6b17('0x5a')]=intUtil[_0x6b17('0x59')](_0x11891b['serverUrl']);_0x3cad6a[_0x6b17('0x50')]=_0x466a86===_0x6b17('0x51')||_0x466a86===_0x6b17('0x5b')?_0x6b17('0x51'):_0x6b17('0x2c');var _0x25135a=_0x11891b[_0x6b17('0xa')]?util[_0x6b17('0x54')](_0x6b17('0x5c'),_0x11891b[_0x6b17('0xf')][_0x6b17('0xb')]):util['format'](_0x6b17('0x5c'),_0x11891b[_0x6b17('0x12')]);var _0x8628d5=util[_0x6b17('0x54')]('https://login.microsoftonline.com/%s/oauth2/token',_0x11891b[_0x6b17('0xc')]);var _0x3a9279=util['format'](_0x6b17('0x5d'),_0x11891b[_0x6b17('0x5a')],_0x58613a[_0x6b17('0x5e')],md5(_0x58613a[_0x6b17('0x5e')]));if(_0x34f9ca&&_0x34f9ca[_0x6b17('0x5f')]){logger['info'](_0x6b17('0x60'),'Recording\x20is\x20enabled!');_0x58613a['recordingURL']=_0x3a9279;}else if(_0x54e21e&&_0x54e21e[_0x6b17('0x61')]&&_0x54e21e['recordingFormat']!==_0x6b17('0x62')){logger[_0x6b17('0x25')](_0x6b17('0x63'),_0x6b17('0x64'));_0x58613a[_0x6b17('0x65')]=_0x3a9279;}else{_0x58613a[_0x6b17('0x65')]='';}return getUser(_0x3cad6a,_0x11891b,_0x38a711,_0x8628d5,_0x25135a,_0x466a86)[_0x6b17('0x15')](function(_0x1d998e){logger[_0x6b17('0x25')]('['+_0x466a86[_0x6b17('0x19')]()+_0x6b17('0x66'),_0x1d998e[_0x6b17('0x2a')]);logger['info']('['+_0x466a86[_0x6b17('0x19')]()+_0x6b17('0x67'),_0x1d998e['userEmail']);return getEndUser(_0x1d998e,_0x11891b,_0x8628d5,_0x25135a,_0x58613a,_0x466a86,_0x1ea63d[_0x6b17('0x68')]);})['then'](function(_0x2808b9){logger[_0x6b17('0x25')]('['+_0x466a86['toUpperCase']()+_0x6b17('0x69'),_0x2808b9[_0x6b17('0x36')]);logger[_0x6b17('0x25')]('['+_0x466a86[_0x6b17('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x58613a[_0x6b17('0x2d')]);return getTicket(_0x2808b9,_0x11891b,_0x8628d5,_0x25135a,_0x58613a,_0x1ea63d,_0x466a86);})['then'](function(_0x7ed64b){logger[_0x6b17('0x25')](util[_0x6b17('0x54')]('['+_0x466a86[_0x6b17('0x19')]()+_0x6b17('0x6a'),_0x1ea63d[_0x6b17('0x48')],_0x7ed64b['ticketId']));logger[_0x6b17('0x25')](util[_0x6b17('0x54')]('['+_0x466a86[_0x6b17('0x19')]()+_0x6b17('0x6b'),_0x466a86));if(_0x466a86!==_0x6b17('0x5b')){logger['info']('['+_0x466a86[_0x6b17('0x19')]()+']',_0x6b17('0x6c'));emit(_0x11891b['remoteUri'],_0x38a711[_0x6b17('0x6d')],_0x1ea63d[_0x6b17('0x48')],_0x7ed64b['ticketId']);}})[_0x6b17('0x17')](function(_0x3721a1){logger['error']('['+_0x466a86[_0x6b17('0x19')]()+_0x6b17('0x6e'),_0x3721a1[_0x6b17('0x1b')]);});}; \ 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 e12aa9c..6a4da20 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 _0xe265=['uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','recordingFormat','none','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','find','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','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!'];(function(_0x2d1dc3,_0x72ffdf){var _0x2640e3=function(_0x30cde1){while(--_0x30cde1){_0x2d1dc3['push'](_0x2d1dc3['shift']());}};_0x2640e3(++_0x72ffdf);}(_0xe265,0x182));var _0x5e26=function(_0x24d370,_0x2f11d2){_0x24d370=_0x24d370-0x0;var _0x14f82d=_0xe265[_0x24d370];return _0x14f82d;};'use strict';var _=require(_0x5e26('0x0'));var rp=require('request-promise');var md5=require(_0x5e26('0x1'));var util=require('util');var Redis=require(_0x5e26('0x2'));var intUtil=require(_0x5e26('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5e26('0x4'))('freshdesk');config[_0x5e26('0x5')]=_[_0x5e26('0x6')](config[_0x5e26('0x5')],{'host':_0x5e26('0x7'),'port':0x18eb});var io=require(_0x5e26('0x8'))(new Redis(config[_0x5e26('0x5')]));var headers={'Content-Type':_0x5e26('0x9'),'Accept':_0x5e26('0x9')};function emit(_0x599e42,_0x5b2dc8,_0x2457a6){io['to'](_0x599e42)[_0x5e26('0xa')](_0x5b2dc8,_0x2457a6);}function getTicket(_0x4a5fcd,_0x42f466,_0x82a22,_0x484503,_0x53bab6){logger[_0x5e26('0xb')]('Creating\x20new\x20ticket...');var _0x49b01c=_[_0x5e26('0xc')]({'responder_id':_0x42f466['id'],'requester_id':_0x82a22['id'],'name':util[_0x5e26('0xd')](_0x5e26('0xe'),_0x53bab6[_0x5e26('0xf')]),'phone':_0x53bab6[_0x5e26('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x484503[_0x5e26('0x11')],_0x53bab6,'\x20'),'description':intUtil[_0x5e26('0x12')](_0x484503[_0x5e26('0x13')],_0x53bab6,'
'),'tags':getTags(_0x484503[_0x5e26('0x14')],_0x5e26('0x15'))},getCustomFields(_0x484503['Fields'],_0x53bab6));_0x49b01c[_0x5e26('0x16')]=_[_0x5e26('0x17')](_[_0x5e26('0x18')](_0x49b01c[_0x5e26('0x16')],'id'),_0x5e26('0x19'));return request({'uri':util[_0x5e26('0xd')](_0x5e26('0x1a'),_0x4a5fcd[_0x5e26('0x1b')]),'method':_0x5e26('0x1c'),'body':_0x49b01c})[_0x5e26('0x1d')](function(_0x51df59){logger[_0x5e26('0xb')](_0x5e26('0x1e'));return _0x51df59;});}function getUser(_0x373814,_0x38010f){if(intUtil['validateEmail'](_0x38010f)){return request({'uri':util[_0x5e26('0xd')](_0x5e26('0x1f'),_0x373814[_0x5e26('0x1b')]),'qs':{'email':_0x38010f}})[_0x5e26('0x1d')](function(_0x3de3d4){if(_0x3de3d4['length']){logger['info']('Agent\x20found!');return _[_0x5e26('0x20')](_0x3de3d4,function(_0x1af7e8){return _0x1af7e8['contact'][_0x5e26('0x21')]===_0x38010f;});}else{logger[_0x5e26('0xb')](_0x5e26('0x22'));return request({'uri':util[_0x5e26('0xd')](_0x5e26('0x23'),_0x373814['remoteUri'])})[_0x5e26('0x1d')](function(_0x2d1897){logger['info'](_0x5e26('0x24'));return _0x2d1897;});}});}else{logger[_0x5e26('0xb')](_0x5e26('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x373814['remoteUri'])})['then'](function(_0x4c7a49){logger[_0x5e26('0xb')](_0x5e26('0x24'));return _0x4c7a49;});}}function getEndUser(_0x4e391f,_0x1b85d0,_0x2415ad){logger[_0x5e26('0xb')]('Searching\x20enduser\x20with\x20phone',_0x2415ad);return request({'uri':util[_0x5e26('0xd')](_0x5e26('0x26'),_0x4e391f[_0x5e26('0x1b')]),'qs':{'phone':_0x2415ad}})['then'](function(_0x223f49){if(_0x223f49[_0x5e26('0x27')]){logger[_0x5e26('0xb')]('Enduser\x20found!');return _[_0x5e26('0x20')](_0x223f49,{'phone':_0x2415ad});}else{logger[_0x5e26('0xb')](_0x5e26('0x28'));return request({'uri':util['format'](_0x5e26('0x26'),_0x4e391f[_0x5e26('0x1b')]),'method':_0x5e26('0x1c'),'body':{'name':_0x1b85d0,'phone':_0x2415ad}})[_0x5e26('0x1d')](function(_0xb2b7d9){logger[_0x5e26('0xb')](_0x5e26('0x29'));return _0xb2b7d9;});}});}function getAuth(_0x35dfbe){return util[_0x5e26('0xd')](_0x5e26('0x2a'),new Buffer(_0x35dfbe[_0x5e26('0x2b')]+':X')[_0x5e26('0x2c')](_0x5e26('0x2d')));}function request(_0x48451e){logger[_0x5e26('0x2e')](_0x5e26('0x2f'),JSON[_0x5e26('0x30')](_0x48451e));return rp(_[_0x5e26('0x6')](_0x48451e,{'method':_0x5e26('0x31'),'headers':headers,'json':!![]}));}function getTags(_0xd11959,_0x117b05){var _0x1a90f0=[];if(_0xd11959&&_0xd11959[_0x5e26('0x27')]>0x0){_0x1a90f0=_[_0x5e26('0x32')](_0xd11959,_0x117b05);}return _0x1a90f0;}function getCustomFields(_0x2a1fe2,_0x11bb71){var _0x4e2574=[];var _0x384cf4={'custom_fields':[]};if(_0x2a1fe2[_0x5e26('0x27')]>0x0){_['forEach'](_0x2a1fe2,function(_0x550e8a){if(_[_0x5e26('0x33')]([_0x5e26('0x34'),_0x5e26('0x35')],_0x550e8a[_0x5e26('0x36')])&&_0x550e8a[_0x5e26('0x37')]&&!_0x550e8a[_0x5e26('0x38')]){_0x384cf4[_0x550e8a[_0x5e26('0x37')][_0x5e26('0x39')]()]=_0x550e8a[_0x5e26('0x3a')]['toString']();}else if(_['includes'](['string','picklist'],_0x550e8a[_0x5e26('0x36')])&&_0x550e8a[_0x5e26('0x3b')]&&_0x550e8a[_0x5e26('0x38')]){_0x384cf4['custom_fields'][_0x5e26('0x3c')]({'id':_0x550e8a[_0x5e26('0x3b')],'value':_0x550e8a[_0x5e26('0x3a')][_0x5e26('0x2c')]()});}else if(_0x550e8a[_0x5e26('0x36')]===_0x5e26('0x3d')&&_0x550e8a[_0x5e26('0x3e')]&&_0x550e8a[_0x5e26('0x3b')]&&_0x550e8a[_0x5e26('0x38')]){_0x11bb71[_0x550e8a[_0x5e26('0x3e')]]&&_0x384cf4[_0x5e26('0x16')][_0x5e26('0x3c')]({'id':_0x550e8a[_0x5e26('0x3b')],'value':_0x11bb71[_0x550e8a['variableName']][_0x5e26('0x2c')]()});}else if(_0x550e8a[_0x5e26('0x36')]===_0x5e26('0x3f')&&_0x550e8a[_0x5e26('0x40')]&&_0x550e8a[_0x5e26('0x40')][_0x5e26('0x15')]&&_0x550e8a['idField']&&_0x550e8a[_0x5e26('0x38')]){_0x11bb71[_0x550e8a[_0x5e26('0x40')][_0x5e26('0x15')][_0x5e26('0x39')]()]&&_0x384cf4[_0x5e26('0x16')]['push']({'id':_0x550e8a[_0x5e26('0x3b')],'value':_0x11bb71[_0x550e8a[_0x5e26('0x40')][_0x5e26('0x15')][_0x5e26('0x39')]()][_0x5e26('0x2c')]()});}});}return _0x384cf4;}exports['queue']=function(_0x178aae,_0x3cc583,_0x2d02bd,_0x35c8ce,_0xc8e5e0,_0x4a8960){var _0x4469c9,_0x403665;_0x4a8960[_0x5e26('0x1b')]=intUtil[_0x5e26('0x41')](_0x4a8960[_0x5e26('0x1b')]);_0x4a8960[_0x5e26('0x42')]=intUtil[_0x5e26('0x41')](_0x4a8960[_0x5e26('0x42')]);if(_0xc8e5e0&&_0xc8e5e0[_0x5e26('0x43')]){logger[_0x5e26('0xb')]('[QUEUE]',_0x5e26('0x44'));_0x3cc583['recordingURL']=util[_0x5e26('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a8960['serverUrl'],_0x3cc583['uniqueid'],md5(_0x3cc583[_0x5e26('0x45')]));}else{_0x3cc583[_0x5e26('0x46')]='';}headers[_0x5e26('0x47')]=getAuth(_0x4a8960);return getUser(_0x4a8960,_0x35c8ce[_0x5e26('0x21')])[_0x5e26('0x1d')](function(_0x26bbb0){_0x4469c9=_0x26bbb0;logger[_0x5e26('0xb')](_0x5e26('0x48'),_0x4469c9['id']);return getEndUser(_0x4a8960,_0x3cc583[_0x5e26('0xf')],_0x3cc583[_0x5e26('0x10')]);})[_0x5e26('0x1d')](function(_0x3f243a){_0x403665=_0x3f243a;logger[_0x5e26('0xb')](_0x5e26('0x49'),_0x403665['id']);return getTicket(_0x4a8960,_0x4469c9,_0x403665,_0x2d02bd,_0x3cc583);})[_0x5e26('0x1d')](function(_0x19756c){if(_0x19756c&&_0x19756c['id']){logger[_0x5e26('0xb')](_0x5e26('0x1e'));logger['info'](_0x5e26('0x4a'),_0x19756c['id']);logger[_0x5e26('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5e26('0xd')](_0x5e26('0x4b'),_0x35c8ce[_0x5e26('0x15')]),_0x5e26('0x4c'),{'uri':util[_0x5e26('0xd')](_0x5e26('0x4d'),_0x4a8960[_0x5e26('0x1b')],_0x19756c['id'])});}})[_0x5e26('0x4e')](function(_0x1444cb){logger[_0x5e26('0x4f')](_0x5e26('0x50'),JSON[_0x5e26('0x30')](_0x1444cb));});};exports[_0x5e26('0x51')]=function(_0x5c591e,_0x4117c3,_0xa09680,_0xfbb7dd,_0x2eac27,_0x1c6a55,_0x5d3d40){var _0x1a4ed2,_0x451816;_0x1c6a55[_0x5e26('0x1b')]=intUtil[_0x5e26('0x41')](_0x1c6a55['remoteUri']);_0x1c6a55[_0x5e26('0x42')]=intUtil[_0x5e26('0x41')](_0x1c6a55['serverUrl']);if(_0x5d3d40&&_0x5d3d40['recordingFormat']&&_0x5d3d40[_0x5e26('0x52')]!==_0x5e26('0x53')){logger[_0x5e26('0xb')]('[OUTBOUND]',_0x5e26('0x44'));_0x4117c3[_0x5e26('0x46')]=util[_0x5e26('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c6a55[_0x5e26('0x42')],_0x4117c3[_0x5e26('0x45')],md5(_0x4117c3[_0x5e26('0x45')]));}headers['Authorization']=getAuth(_0x1c6a55);return getUser(_0x1c6a55,_0xfbb7dd['email'])[_0x5e26('0x1d')](function(_0x57aa17){_0x1a4ed2=_0x57aa17;logger['info'](_0x5e26('0x48'),_0x1a4ed2['id']);return getEndUser(_0x1c6a55,_0x4117c3[_0x5e26('0x54')],_0x4117c3['destcalleridnum']);})[_0x5e26('0x1d')](function(_0x20d3a4){_0x451816=_0x20d3a4;logger['info'](_0x5e26('0x49'),_0x451816['id']);return getTicket(_0x1c6a55,_0x1a4ed2,_0x451816,_0xa09680,_0x4117c3);})[_0x5e26('0x1d')](function(_0x434f5d){if(_0x434f5d&&_0x434f5d['id']){logger[_0x5e26('0xb')]('Ticket\x20created!');logger[_0x5e26('0xb')](_0x5e26('0x4a'),_0x434f5d['id']);logger['info']('[OUTBOUND]',_0x5e26('0x55'));emit(util[_0x5e26('0xd')](_0x5e26('0x4b'),_0xfbb7dd['name']),_0x5e26('0x4c'),{'uri':util['format'](_0x5e26('0x4d'),_0x1c6a55[_0x5e26('0x1b')],_0x434f5d['id'])});}})[_0x5e26('0x4e')](function(_0x42ff3e){logger[_0x5e26('0x4f')](_0x5e26('0x56'),JSON[_0x5e26('0x30')](_0x42ff3e));});};exports[_0x5e26('0x57')]=function(_0x4928d2,_0x70b1d6,_0x10f48e,_0x460b11,_0x5025d8,_0x351234){var _0xf613ec,_0xa7470b;_0x351234['remoteUri']=intUtil['stripTrailingSlash'](_0x351234[_0x5e26('0x1b')]);_0x351234['serverUrl']=intUtil[_0x5e26('0x41')](_0x351234[_0x5e26('0x42')]);if(_0x5025d8&&_0x5025d8[_0x5e26('0x43')]){logger[_0x5e26('0xb')]('['+_0x70b1d6[_0x5e26('0x58')][_0x5e26('0x59')]()+']','Recording\x20is\x20enabled!');_0x70b1d6['recordingURL']=util[_0x5e26('0xd')](_0x5e26('0x5a'),_0x351234[_0x5e26('0x42')],_0x70b1d6[_0x5e26('0x45')],md5(_0x70b1d6[_0x5e26('0x45')]));}else{_0x70b1d6['recordingURL']='';}headers[_0x5e26('0x47')]=getAuth(_0x351234);return getUser(_0x351234,'')[_0x5e26('0x1d')](function(_0x4f7c9a){_0xf613ec=_0x4f7c9a;logger['info'](_0x5e26('0x48'),_0xf613ec['id']);return getEndUser(_0x351234,_0x70b1d6[_0x5e26('0xf')],_0x70b1d6['calleridnum']);})['then'](function(_0x390e93){_0xa7470b=_0x390e93;logger[_0x5e26('0xb')](_0x5e26('0x49'),_0xa7470b['id']);return getTicket(_0x351234,_0xf613ec,_0xa7470b,_0x10f48e,_0x70b1d6);})[_0x5e26('0x1d')](function(_0x364fd4){if(_0x364fd4){logger[_0x5e26('0xb')](_0x5e26('0x1e'));logger[_0x5e26('0xb')](_0x5e26('0x4a'),_0x364fd4['id']);}})['catch'](function(_0x325345){logger[_0x5e26('0x4f')]('['+_0x70b1d6[_0x5e26('0x58')][_0x5e26('0x59')]()+']',JSON[_0x5e26('0x30')](_0x325345));});}; \ No newline at end of file +var _0xc53e=['content','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','unmanaged','lastevent','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','name','custom_fields','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','stringify','includes','string','picklist','nameField','customField','toLowerCase'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc53e,0x11c));var _0xec53=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc53e[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var rp=require(_0xec53('0x0'));var md5=require('md5');var util=require(_0xec53('0x1'));var Redis=require(_0xec53('0x2'));var intUtil=require(_0xec53('0x3'));var config=require(_0xec53('0x4'));var logger=require(_0xec53('0x5'))(_0xec53('0x6'));config[_0xec53('0x7')]=_[_0xec53('0x8')](config[_0xec53('0x7')],{'host':_0xec53('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xec53('0x7')]));var headers={'Content-Type':_0xec53('0xa'),'Accept':_0xec53('0xa')};function emit(_0x228648,_0x4553a2,_0x29a4db){io['to'](_0x228648)[_0xec53('0xb')](_0x4553a2,_0x29a4db);}function getTicket(_0x4bbe28,_0xe76894,_0x551e60,_0x217db9,_0x55c758){logger[_0xec53('0xc')]('Creating\x20new\x20ticket...');var _0x3139e6=_[_0xec53('0xd')]({'responder_id':_0xe76894['id'],'requester_id':_0x551e60['id'],'name':util[_0xec53('0xe')](_0xec53('0xf'),_0x55c758[_0xec53('0x10')]),'phone':_0x55c758[_0xec53('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x217db9[_0xec53('0x12')],_0x55c758,'\x20'),'description':intUtil[_0xec53('0x13')](_0x217db9[_0xec53('0x14')],_0x55c758,_0xec53('0x15')),'tags':getTags(_0x217db9['Tags'],_0xec53('0x16'))},getCustomFields(_0x217db9['Fields'],_0x55c758));_0x3139e6[_0xec53('0x17')]=_['mapValues'](_['keyBy'](_0x3139e6[_0xec53('0x17')],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x4bbe28[_0xec53('0x18')]),'method':_0xec53('0x19'),'body':_0x3139e6})[_0xec53('0x1a')](function(_0x1c97c5){logger[_0xec53('0xc')](_0xec53('0x1b'));return _0x1c97c5;});}function getUser(_0x1ca3db,_0x35b943){if(intUtil['validateEmail'](_0x35b943)){return request({'uri':util[_0xec53('0xe')](_0xec53('0x1c'),_0x1ca3db[_0xec53('0x18')]),'qs':{'email':_0x35b943}})[_0xec53('0x1a')](function(_0x30482d){if(_0x30482d[_0xec53('0x1d')]){logger[_0xec53('0xc')](_0xec53('0x1e'));return _[_0xec53('0x1f')](_0x30482d,function(_0x52cf43){return _0x52cf43[_0xec53('0x20')][_0xec53('0x21')]===_0x35b943;});}else{logger[_0xec53('0xc')](_0xec53('0x22'));return request({'uri':util[_0xec53('0xe')](_0xec53('0x23'),_0x1ca3db[_0xec53('0x18')])})['then'](function(_0x55f1df){logger['info']('Admin\x20account\x20selected.');return _0x55f1df;});}});}else{logger[_0xec53('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xec53('0x23'),_0x1ca3db['remoteUri'])})[_0xec53('0x1a')](function(_0x1a1bd7){logger[_0xec53('0xc')]('Admin\x20account\x20selected.');return _0x1a1bd7;});}}function getEndUser(_0x5b3bd3,_0x1c1a8a,_0x11375e){logger[_0xec53('0xc')](_0xec53('0x24'),_0x11375e);return request({'uri':util[_0xec53('0xe')](_0xec53('0x25'),_0x5b3bd3[_0xec53('0x18')]),'qs':{'phone':_0x11375e}})[_0xec53('0x1a')](function(_0x2eed1c){if(_0x2eed1c[_0xec53('0x1d')]){logger['info'](_0xec53('0x26'));return _['find'](_0x2eed1c,{'phone':_0x11375e});}else{logger['info'](_0xec53('0x27'));return request({'uri':util['format'](_0xec53('0x25'),_0x5b3bd3[_0xec53('0x18')]),'method':_0xec53('0x19'),'body':{'name':_0x1c1a8a,'phone':_0x11375e}})['then'](function(_0x1616a4){logger[_0xec53('0xc')](_0xec53('0x28'));return _0x1616a4;});}});}function getAuth(_0x493a80){return util[_0xec53('0xe')](_0xec53('0x29'),new Buffer(_0x493a80[_0xec53('0x2a')]+':X')[_0xec53('0x2b')](_0xec53('0x2c')));}function request(_0x10e39f){logger['debug']('[HTTP]',JSON[_0xec53('0x2d')](_0x10e39f));return rp(_[_0xec53('0x8')](_0x10e39f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x12688c,_0x14b653){var _0x276e16=[];if(_0x12688c&&_0x12688c[_0xec53('0x1d')]>0x0){_0x276e16=_['map'](_0x12688c,_0x14b653);}return _0x276e16;}function getCustomFields(_0x723adc,_0x113b8e){var _0x2b1e39=[];var _0x1990dc={'custom_fields':[]};if(_0x723adc[_0xec53('0x1d')]>0x0){_['forEach'](_0x723adc,function(_0x168fb2){if(_[_0xec53('0x2e')]([_0xec53('0x2f'),_0xec53('0x30')],_0x168fb2['type'])&&_0x168fb2[_0xec53('0x31')]&&!_0x168fb2[_0xec53('0x32')]){_0x1990dc[_0x168fb2[_0xec53('0x31')][_0xec53('0x33')]()]=_0x168fb2[_0xec53('0x34')][_0xec53('0x2b')]();}else if(_[_0xec53('0x2e')]([_0xec53('0x2f'),_0xec53('0x30')],_0x168fb2[_0xec53('0x35')])&&_0x168fb2[_0xec53('0x36')]&&_0x168fb2[_0xec53('0x32')]){_0x1990dc[_0xec53('0x17')][_0xec53('0x37')]({'id':_0x168fb2[_0xec53('0x36')],'value':_0x168fb2[_0xec53('0x34')][_0xec53('0x2b')]()});}else if(_0x168fb2[_0xec53('0x35')]===_0xec53('0x38')&&_0x168fb2[_0xec53('0x39')]&&_0x168fb2['idField']&&_0x168fb2['customField']){_0x113b8e[_0x168fb2[_0xec53('0x39')]]&&_0x1990dc['custom_fields']['push']({'id':_0x168fb2[_0xec53('0x36')],'value':_0x113b8e[_0x168fb2[_0xec53('0x39')]]['toString']()});}else if(_0x168fb2['type']===_0xec53('0x3a')&&_0x168fb2[_0xec53('0x3b')]&&_0x168fb2[_0xec53('0x3b')][_0xec53('0x16')]&&_0x168fb2[_0xec53('0x36')]&&_0x168fb2[_0xec53('0x32')]){_0x113b8e[_0x168fb2[_0xec53('0x3b')][_0xec53('0x16')][_0xec53('0x33')]()]&&_0x1990dc[_0xec53('0x17')][_0xec53('0x37')]({'id':_0x168fb2[_0xec53('0x36')],'value':_0x113b8e[_0x168fb2[_0xec53('0x3b')][_0xec53('0x16')][_0xec53('0x33')]()][_0xec53('0x2b')]()});}});}return _0x1990dc;}exports[_0xec53('0x3c')]=function(_0x1128ed,_0x577403,_0x1ae71b,_0x322483,_0x56941d,_0x21f063){var _0x76f812,_0x229f0c;_0x21f063[_0xec53('0x18')]=intUtil[_0xec53('0x3d')](_0x21f063[_0xec53('0x18')]);_0x21f063[_0xec53('0x3e')]=intUtil[_0xec53('0x3d')](_0x21f063['serverUrl']);if(_0x56941d&&_0x56941d['monitor_format']){logger[_0xec53('0xc')](_0xec53('0x3f'),_0xec53('0x40'));_0x577403[_0xec53('0x41')]=util['format'](_0xec53('0x42'),_0x21f063[_0xec53('0x3e')],_0x577403['uniqueid'],md5(_0x577403[_0xec53('0x43')]));}else{_0x577403[_0xec53('0x41')]='';}headers[_0xec53('0x44')]=getAuth(_0x21f063);return getUser(_0x21f063,_0x322483[_0xec53('0x21')])['then'](function(_0x48445f){_0x76f812=_0x48445f;logger[_0xec53('0xc')](_0xec53('0x45'),_0x76f812['id']);return getEndUser(_0x21f063,_0x577403['calleridname'],_0x577403[_0xec53('0x11')]);})[_0xec53('0x1a')](function(_0x319496){_0x229f0c=_0x319496;logger[_0xec53('0xc')](_0xec53('0x46'),_0x229f0c['id']);return getTicket(_0x21f063,_0x76f812,_0x229f0c,_0x1ae71b,_0x577403);})[_0xec53('0x1a')](function(_0x2165c8){if(_0x2165c8&&_0x2165c8['id']){logger[_0xec53('0xc')]('Ticket\x20created!');logger[_0xec53('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2165c8['id']);logger['info'](_0xec53('0x3f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec53('0xe')](_0xec53('0x47'),_0x322483[_0xec53('0x16')]),_0xec53('0x48'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x21f063[_0xec53('0x18')],_0x2165c8['id'])});}})['catch'](function(_0x453fb2){logger[_0xec53('0x49')](_0xec53('0x3f'),JSON[_0xec53('0x2d')](_0x453fb2));});};exports[_0xec53('0x4a')]=function(_0x386d76,_0x24dcdf,_0x231116,_0x216fb4,_0x2e4a83,_0x231a50,_0x58c496){var _0x33e6bd,_0x482a5f;_0x231a50[_0xec53('0x18')]=intUtil[_0xec53('0x3d')](_0x231a50[_0xec53('0x18')]);_0x231a50[_0xec53('0x3e')]=intUtil[_0xec53('0x3d')](_0x231a50[_0xec53('0x3e')]);if(_0x58c496&&_0x58c496[_0xec53('0x4b')]&&_0x58c496['recordingFormat']!=='none'){logger[_0xec53('0xc')](_0xec53('0x4c'),'Recording\x20is\x20enabled!');_0x24dcdf['recordingURL']=util['format'](_0xec53('0x42'),_0x231a50['serverUrl'],_0x24dcdf[_0xec53('0x43')],md5(_0x24dcdf[_0xec53('0x43')]));}headers['Authorization']=getAuth(_0x231a50);return getUser(_0x231a50,_0x216fb4['email'])[_0xec53('0x1a')](function(_0x2aa5fe){_0x33e6bd=_0x2aa5fe;logger['info'](_0xec53('0x45'),_0x33e6bd['id']);return getEndUser(_0x231a50,_0x24dcdf[_0xec53('0x4d')],_0x24dcdf[_0xec53('0x4e')]);})['then'](function(_0x9ae476){_0x482a5f=_0x9ae476;logger[_0xec53('0xc')]('The\x20Enduser\x20ID\x20is:',_0x482a5f['id']);return getTicket(_0x231a50,_0x33e6bd,_0x482a5f,_0x231116,_0x24dcdf);})[_0xec53('0x1a')](function(_0x184b3c){if(_0x184b3c&&_0x184b3c['id']){logger[_0xec53('0xc')](_0xec53('0x1b'));logger[_0xec53('0xc')]('The\x20Ticket\x20ID\x20is:',_0x184b3c['id']);logger[_0xec53('0xc')](_0xec53('0x4c'),_0xec53('0x4f'));emit(util[_0xec53('0xe')](_0xec53('0x47'),_0x216fb4[_0xec53('0x16')]),_0xec53('0x48'),{'uri':util[_0xec53('0xe')](_0xec53('0x50'),_0x231a50[_0xec53('0x18')],_0x184b3c['id'])});}})[_0xec53('0x51')](function(_0x470b58){logger[_0xec53('0x49')]('[OUTBOUND]',JSON[_0xec53('0x2d')](_0x470b58));});};exports[_0xec53('0x52')]=function(_0x32aa6d,_0x19e3ec,_0x46ad01,_0x519a7e,_0x24f15d,_0x3c16ca){var _0x310a4c,_0xfb458;_0x3c16ca[_0xec53('0x18')]=intUtil[_0xec53('0x3d')](_0x3c16ca[_0xec53('0x18')]);_0x3c16ca[_0xec53('0x3e')]=intUtil['stripTrailingSlash'](_0x3c16ca[_0xec53('0x3e')]);if(_0x24f15d&&_0x24f15d['monitor_format']){logger['info']('['+_0x19e3ec[_0xec53('0x53')]['toUpperCase']()+']',_0xec53('0x40'));_0x19e3ec[_0xec53('0x41')]=util[_0xec53('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c16ca[_0xec53('0x3e')],_0x19e3ec[_0xec53('0x43')],md5(_0x19e3ec['uniqueid']));}else{_0x19e3ec[_0xec53('0x41')]='';}headers[_0xec53('0x44')]=getAuth(_0x3c16ca);return getUser(_0x3c16ca,'')[_0xec53('0x1a')](function(_0x518661){_0x310a4c=_0x518661;logger['info'](_0xec53('0x45'),_0x310a4c['id']);return getEndUser(_0x3c16ca,_0x19e3ec['calleridname'],_0x19e3ec[_0xec53('0x11')]);})[_0xec53('0x1a')](function(_0x155b80){_0xfb458=_0x155b80;logger['info']('The\x20Enduser\x20ID\x20is:',_0xfb458['id']);return getTicket(_0x3c16ca,_0x310a4c,_0xfb458,_0x46ad01,_0x19e3ec);})['then'](function(_0x4feec0){if(_0x4feec0){logger[_0xec53('0xc')](_0xec53('0x1b'));logger[_0xec53('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4feec0['id']);}})[_0xec53('0x51')](function(_0x330709){logger[_0xec53('0x49')]('['+_0x19e3ec['lastevent']['toUpperCase']()+']',JSON[_0xec53('0x2d')](_0x330709));});}; \ 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 5603d52..34d4d23 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 _0x1c44=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','endUserId','Contact\x20found\x20mobile_number:','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x435713,_0x5dd205){var _0x4ed61e=function(_0x1bfda2){while(--_0x1bfda2){_0x435713['push'](_0x435713['shift']());}};_0x4ed61e(++_0x5dd205);}(_0x1c44,0x103));var _0x41c4=function(_0x26baf1,_0x20c7a6){_0x26baf1=_0x26baf1-0x0;var _0x50a163=_0x1c44[_0x26baf1];return _0x50a163;};'use strict';var _=require(_0x41c4('0x0'));var rp=require(_0x41c4('0x1'));var md5=require(_0x41c4('0x2'));var util=require(_0x41c4('0x3'));var moment=require(_0x41c4('0x4'));var Promise=require(_0x41c4('0x5'));var Redis=require(_0x41c4('0x6'));var intUtil=require(_0x41c4('0x7'));var config=require(_0x41c4('0x8'));var logger=require('../../../../config/logger')(_0x41c4('0x9'));config[_0x41c4('0xa')]=_['defaults'](config[_0x41c4('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x41c4('0xb'))(new Redis(config[_0x41c4('0xa')]));function getAdminId(_0x1751b0,_0x2e3b82,_0x113d35,_0x544586){return new Promise(function(_0x43c742,_0x2ba5b8){var _0x9e352f=![];var _0x20fad0={'method':_0x41c4('0xc'),'uri':_0x544586+_0x41c4('0xd'),'json':!![]};_0x20fad0[_0x41c4('0xe')]=_0x113d35;logger[_0x41c4('0xf')]('Getting\x20admin\x20information');return rp(_0x20fad0)[_0x41c4('0x10')](function(_0x36d6d7){if(_0x36d6d7){var _0x1ebaf4=_0x36d6d7[_0x41c4('0x11')];var _0x34bcbb=null;for(_0x34bcbb=0x0;_0x34bcbb<_0x1ebaf4['length'];_0x34bcbb++){if(_0x1ebaf4[_0x34bcbb]['email']===_0x1751b0[_0x41c4('0x12')]){_0x1751b0['adminId']=_0x1ebaf4[_0x34bcbb]['id'];_0x9e352f=!![];}}if(_0x9e352f){logger[_0x41c4('0xf')](_0x41c4('0x13'),_0x1751b0[_0x41c4('0x14')]);_0x43c742(_0x1751b0);}else{_0x2ba5b8({'statusCode':0x194,'message':_0x41c4('0x15')});}}else{_0x2ba5b8({'statusCode':0x194,'message':_0x41c4('0x15')});}})['catch'](function(_0x10eb8a){logger[_0x41c4('0x16')]('['+[_0x2e3b82[_0x41c4('0x17')]()]+']',_0x10eb8a[_0x41c4('0x18')]);_0x2ba5b8(_0x10eb8a);});});}function getUser(_0x12c973,_0x102972,_0x148c13){return function(_0x5344c0){return new Promise(function(_0x27f07a,_0x18463f){var _0x4eec92={'method':_0x41c4('0xc'),'uri':_0x148c13+_0x41c4('0xd'),'json':!![]};_0x4eec92['headers']=_0x102972;logger[_0x41c4('0xf')](_0x41c4('0x19'));return rp(_0x4eec92)[_0x41c4('0x10')](function(_0x4a78ae){if(_0x4a78ae){var _0x1cc401=_0x4a78ae[_0x41c4('0x11')];var _0x500b3e=![];var _0x43a5d3=null;if(_0x5344c0[_0x41c4('0x1a')]!==null){logger['info'](_0x41c4('0x1b'),_0x5344c0['agentEmail']);_0x5344c0[_0x41c4('0x1c')]=_0x5344c0['agentEmail'];for(_0x43a5d3=0x0;_0x43a5d3<_0x1cc401[_0x41c4('0x1d')];_0x43a5d3++){if(_0x1cc401[_0x43a5d3][_0x41c4('0x1e')]===_0x5344c0[_0x41c4('0x1a')]){_0x500b3e=!![];_0x5344c0['userId']=_0x1cc401[_0x43a5d3]['id'];logger[_0x41c4('0xf')]('User\x20found:',_0x5344c0[_0x41c4('0x1f')]);}}}if(!_0x500b3e){logger[_0x41c4('0xf')]('Admin\x20selected');_0x5344c0['userEmail']=_0x5344c0[_0x41c4('0x12')];_0x5344c0[_0x41c4('0x1f')]=_0x5344c0[_0x41c4('0x14')];_0x500b3e=!![];}if(_0x500b3e){_0x27f07a(_0x5344c0);}else{_0x18463f({'statusCode':0x194,'message':_0x41c4('0x15')});}}else{_0x18463f({'statusCode':0x194,'message':_0x41c4('0x15')});}})[_0x41c4('0x20')](function(_0x255a60){logger['error']('['+[_0x12c973['toUpperCase']()]+']',_0x255a60['message']);_0x18463f(_0x255a60);});});};}function searchContact(_0x47d604,_0x110e81,_0x244e71,_0x489a99){return new Promise(function(_0x4baf11,_0x473a71){var _0x5699e4={'method':'GET','headers':_0x110e81,'uri':_0x47d604+_0x41c4('0x21')+_0x489a99+_0x41c4('0x22')+_0x244e71+_0x41c4('0x23'),'json':!![]};rp(_0x5699e4)[_0x41c4('0x10')](function(_0x350d5f){var _0x2cddec=_[_0x41c4('0x24')](_0x350d5f[_0x41c4('0x25')]['contacts'],[_0x244e71,_0x489a99]);_0x4baf11(_0x2cddec);})[_0x41c4('0x20')](function(_0x31a067){_0x473a71(_0x31a067);});});}function getEndUser(_0x45a943,_0x203e0a,_0x566052){return function(_0x50217c){return new Promise(function(_0x5fdc3a,_0x52a8d1){logger[_0x41c4('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x50217c['contactNumber']));searchContact(_0x566052,_0x203e0a,'mobile_number',_0x50217c['contactNumber'])[_0x41c4('0x10')](function(_0x456eac){if(_0x456eac){_0x50217c[_0x41c4('0x26')]=_0x456eac['id'];logger['info'](_0x41c4('0x27'),_0x50217c['endUserId']);return _0x5fdc3a(_0x50217c);}searchContact(_0x566052,_0x203e0a,'work_number',_0x50217c[_0x41c4('0x28')])[_0x41c4('0x10')](function(_0x1c382d){if(_0x1c382d){_0x50217c['endUserId']=_0x1c382d['id'];logger['info'](_0x41c4('0x29'),_0x50217c[_0x41c4('0x26')]);return _0x5fdc3a(_0x50217c);}createEndUser(_0x50217c,_0x45a943,_0x203e0a,_0x566052)[_0x41c4('0x10')](function(_0x452816){logger[_0x41c4('0xf')](_0x41c4('0x2a'),_0x452816[_0x41c4('0x26')]);return _0x5fdc3a(_0x452816);});});})[_0x41c4('0x20')](function(_0x213e19){_0x52a8d1(_0x213e19);});});};}function createEndUser(_0x60a4f,_0x209d24,_0x5858df,_0x55160b){return new Promise(function(_0xb70b1b,_0x15047b){var _0x420c4a=moment();var _0x581324={'method':'POST','uri':_0x55160b+_0x41c4('0x2b'),'body':{'contact':{'last_name':_0x60a4f[_0x41c4('0x28')],'work_number':_0x60a4f['contactNumber'],'mobile_number':_0x60a4f[_0x41c4('0x28')],'owner_id':_0x60a4f[_0x41c4('0x1f')],'created_at':_0x420c4a[_0x41c4('0x2c')](_0x41c4('0x2d'))}},'json':!![]};_0x581324[_0x41c4('0xe')]=_0x5858df;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x581324)[_0x41c4('0x10')](function(_0x4e962c){_0x60a4f[_0x41c4('0x26')]=_0x4e962c[_0x41c4('0x2e')]['id'];_0xb70b1b(_0x60a4f);})[_0x41c4('0x20')](function(_0xf0f656){logger['error']('['+[_0x209d24[_0x41c4('0x17')]()]+']',_0xf0f656['message']);_0x15047b(_0xf0f656['message']);});});}function getTicket(_0x205faf,_0x222fc2,_0x38b6f6,_0x16d3a3,_0x295624){return function(_0x316865){logger[_0x41c4('0xf')](_0x41c4('0x2f'));return new Promise(function(_0x2a2350,_0x3d6d85){var _0x2983a4=moment();var _0x26e5aa={'method':_0x41c4('0x30'),'uri':_0x38b6f6+_0x41c4('0x31'),'body':{'title':intUtil[_0x41c4('0x32')](_0x16d3a3['Subjects'],_0x295624,'\x20'),'description':intUtil['getString'](_0x16d3a3[_0x41c4('0x33')],_0x295624,'\x0a'),'owner_id':_0x316865[_0x41c4('0x1f')],'creater_id':_0x316865[_0x41c4('0x14')],'targetable_id':_0x316865[_0x41c4('0x26')],'targetable_type':_0x41c4('0x34'),'created_at':_0x2983a4['format'](_0x41c4('0x2d')),'due_date':_0x2983a4[_0x41c4('0x35')](0x1e,'m')[_0x41c4('0x2c')](_0x41c4('0x2d'))},'json':!![]};_0x26e5aa['headers']=_0x222fc2;return rp(_0x26e5aa)[_0x41c4('0x10')](function(_0x5a579f){_0x316865[_0x41c4('0x36')]=_0x5a579f['task']['id'];logger['info'](_0x41c4('0x37'),_0x316865[_0x41c4('0x36')]);_0x2a2350(_0x316865);})[_0x41c4('0x20')](function(_0x5d720f){logger[_0x41c4('0x16')]('['+[_0x205faf['toUpperCase']()]+']',_0x5d720f[_0x41c4('0x18')]);_0x3d6d85(_0x5d720f[_0x41c4('0x18')]);});});};}function emit(_0x1f80d9,_0xb1d128,_0x3e9e8b){var _0x1e0af7={'uri':_0x1f80d9+'/contacts/'+_0x3e9e8b};io['to'](util[_0x41c4('0x2c')](_0x41c4('0x38'),_0xb1d128))[_0x41c4('0x39')](_0x41c4('0x3a'),_0x1e0af7);}exports['cs']=function(_0x1f7a09,_0xafd2be,_0x45ef04,_0x2babff,_0x1c851a,_0x3d7199,_0x45fbce,_0x12833d){var _0x3b9c90={};var _0x224547={'Authorization':_0x41c4('0x3b')+_0x3d7199[_0x41c4('0x3c')]};_0x3d7199['remoteUri']=intUtil[_0x41c4('0x3d')](_0x3d7199['remoteUri']);_0x3d7199[_0x41c4('0x3e')]=intUtil[_0x41c4('0x3d')](_0x3d7199['serverUrl']);var _0x1c35c3=_0x3d7199[_0x41c4('0x3f')];_0x3b9c90['adminEmail']=_0x3d7199[_0x41c4('0x40')];_0x3b9c90['contactNumber']=_0x12833d['toLowerCase']()===_0x41c4('0x41')?_0xafd2be[_0x41c4('0x42')]:_0xafd2be[_0x41c4('0x43')];_0x3b9c90['callDirection']=_0x12833d===_0x41c4('0x44')||_0x12833d===_0x41c4('0x45')?_0x41c4('0x44'):_0x41c4('0x41');if(_0x2babff){_0x3b9c90[_0x41c4('0x1a')]=_0x2babff[_0x41c4('0x1e')];}var _0x3d9399=util[_0x41c4('0x2c')](_0x41c4('0x46'),_0x3d7199[_0x41c4('0x3e')],_0xafd2be[_0x41c4('0x47')],md5(_0xafd2be[_0x41c4('0x47')]));if(_0x1c851a&&_0x1c851a[_0x41c4('0x48')]){logger[_0x41c4('0xf')](_0x41c4('0x49'),_0x41c4('0x4a'));_0xafd2be[_0x41c4('0x4b')]=_0x3d9399;}else if(_0x45fbce&&_0x45fbce['recordingFormat']&&_0x45fbce[_0x41c4('0x4c')]!==_0x41c4('0x4d')){logger[_0x41c4('0xf')](_0x41c4('0x4e'),_0x41c4('0x4a'));_0xafd2be[_0x41c4('0x4b')]=_0x3d9399;}else{_0xafd2be['recordingURL']='';}return getAdminId(_0x3b9c90,_0x12833d,_0x224547,_0x1c35c3)[_0x41c4('0x10')](getUser(_0x12833d,_0x224547,_0x1c35c3))[_0x41c4('0x10')](getEndUser(_0x12833d,_0x224547,_0x1c35c3))[_0x41c4('0x10')](getTicket(_0x12833d,_0x224547,_0x1c35c3,_0x45ef04,_0xafd2be))[_0x41c4('0x10')](function(_0x43723c){logger['info'](util[_0x41c4('0x2c')](_0x41c4('0x4f'),_0x43723c[_0x41c4('0x36')]));if(_0x12833d!==_0x41c4('0x45')){logger[_0x41c4('0xf')]('['+[_0x12833d['toUpperCase']()]+']',_0x41c4('0x50'));emit(_0x1c35c3,_0x2babff[_0x41c4('0x51')],_0x43723c[_0x41c4('0x26')]);}})[_0x41c4('0x20')](function(_0x256369){logger[_0x41c4('0x16')]('['+[_0x12833d['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x41c4('0x52')](_0x256369,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb06e=['GET','/api/selector/owners','headers','users','length','email','adminEmail','adminId','info','Admin\x20found:','catch','toUpperCase','message','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','error','&f=','&entities=contact','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x16f2be,_0xf46d59){var _0x205384=function(_0x3e73e5){while(--_0x3e73e5){_0x16f2be['push'](_0x16f2be['shift']());}};_0x205384(++_0xf46d59);}(_0xb06e,0x18b));var _0xeb06=function(_0x52f139,_0x51c99b){_0x52f139=_0x52f139-0x0;var _0x34b6a6=_0xb06e[_0x52f139];return _0x34b6a6;};'use strict';var _=require(_0xeb06('0x0'));var rp=require(_0xeb06('0x1'));var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require(_0xeb06('0x2'));var Redis=require('ioredis');var intUtil=require(_0xeb06('0x3'));var config=require(_0xeb06('0x4'));var logger=require(_0xeb06('0x5'))('freshsales');config[_0xeb06('0x6')]=_[_0xeb06('0x7')](config['redis'],{'host':_0xeb06('0x8'),'port':0x18eb});var io=require(_0xeb06('0x9'))(new Redis(config['redis']));function getAdminId(_0x231034,_0x6de3fe,_0x340359,_0x392e36){return new Promise(function(_0x1a5175,_0x566df4){var _0x33e778=![];var _0x49ea09={'method':_0xeb06('0xa'),'uri':_0x392e36+_0xeb06('0xb'),'json':!![]};_0x49ea09[_0xeb06('0xc')]=_0x340359;logger['info']('Getting\x20admin\x20information');return rp(_0x49ea09)['then'](function(_0x3f260a){if(_0x3f260a){var _0xe89e35=_0x3f260a[_0xeb06('0xd')];var _0x58ae0f=null;for(_0x58ae0f=0x0;_0x58ae0f<_0xe89e35[_0xeb06('0xe')];_0x58ae0f++){if(_0xe89e35[_0x58ae0f][_0xeb06('0xf')]===_0x231034[_0xeb06('0x10')]){_0x231034[_0xeb06('0x11')]=_0xe89e35[_0x58ae0f]['id'];_0x33e778=!![];}}if(_0x33e778){logger[_0xeb06('0x12')](_0xeb06('0x13'),_0x231034[_0xeb06('0x11')]);_0x1a5175(_0x231034);}else{_0x566df4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x566df4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xeb06('0x14')](function(_0x517bac){logger['error']('['+[_0x6de3fe[_0xeb06('0x15')]()]+']',_0x517bac[_0xeb06('0x16')]);_0x566df4(_0x517bac);});});}function getUser(_0x1c9230,_0x2d8ee6,_0x5dc217){return function(_0x254120){return new Promise(function(_0x1d08c1,_0x487efb){var _0x551943={'method':_0xeb06('0xa'),'uri':_0x5dc217+_0xeb06('0xb'),'json':!![]};_0x551943[_0xeb06('0xc')]=_0x2d8ee6;logger['info']('Getting\x20user\x20list');return rp(_0x551943)[_0xeb06('0x17')](function(_0x23a6fd){if(_0x23a6fd){var _0x52e36b=_0x23a6fd[_0xeb06('0xd')];var _0x1579f3=![];var _0x3b05ac=null;if(_0x254120['agentEmail']!==null){logger[_0xeb06('0x12')](_0xeb06('0x18'),_0x254120[_0xeb06('0x19')]);_0x254120[_0xeb06('0x1a')]=_0x254120[_0xeb06('0x19')];for(_0x3b05ac=0x0;_0x3b05ac<_0x52e36b['length'];_0x3b05ac++){if(_0x52e36b[_0x3b05ac][_0xeb06('0xf')]===_0x254120[_0xeb06('0x19')]){_0x1579f3=!![];_0x254120[_0xeb06('0x1b')]=_0x52e36b[_0x3b05ac]['id'];logger[_0xeb06('0x12')](_0xeb06('0x1c'),_0x254120[_0xeb06('0x1b')]);}}}if(!_0x1579f3){logger['info'](_0xeb06('0x1d'));_0x254120['userEmail']=_0x254120['adminEmail'];_0x254120[_0xeb06('0x1b')]=_0x254120['adminId'];_0x1579f3=!![];}if(_0x1579f3){_0x1d08c1(_0x254120);}else{_0x487efb({'statusCode':0x194,'message':_0xeb06('0x1e')});}}else{_0x487efb({'statusCode':0x194,'message':_0xeb06('0x1e')});}})[_0xeb06('0x14')](function(_0x3e585e){logger[_0xeb06('0x1f')]('['+[_0x1c9230['toUpperCase']()]+']',_0x3e585e[_0xeb06('0x16')]);_0x487efb(_0x3e585e);});});};}function searchContact(_0x3b1c98,_0x3ce1a8,_0x57b185,_0x2a9ebf){return new Promise(function(_0x213a7e,_0x2784c9){var _0x15c7a0={'method':_0xeb06('0xa'),'headers':_0x3ce1a8,'uri':_0x3b1c98+'/api/lookup?q='+_0x2a9ebf+_0xeb06('0x20')+_0x57b185+_0xeb06('0x21'),'json':!![]};rp(_0x15c7a0)[_0xeb06('0x17')](function(_0x9e459){var _0x4052c9=_['find'](_0x9e459[_0xeb06('0x22')][_0xeb06('0x22')],[_0x57b185,_0x2a9ebf]);_0x213a7e(_0x4052c9);})[_0xeb06('0x14')](function(_0xaa088e){_0x2784c9(_0xaa088e);});});}function getEndUser(_0xbfa91,_0x4c9955,_0x395740){return function(_0x4af41b){return new Promise(function(_0x534c7d,_0x34e4f3){logger[_0xeb06('0x12')](util[_0xeb06('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x4af41b[_0xeb06('0x24')]));searchContact(_0x395740,_0x4c9955,_0xeb06('0x25'),_0x4af41b[_0xeb06('0x24')])[_0xeb06('0x17')](function(_0xaaf019){if(_0xaaf019){_0x4af41b[_0xeb06('0x26')]=_0xaaf019['id'];logger[_0xeb06('0x12')](_0xeb06('0x27'),_0x4af41b[_0xeb06('0x26')]);return _0x534c7d(_0x4af41b);}searchContact(_0x395740,_0x4c9955,_0xeb06('0x28'),_0x4af41b[_0xeb06('0x24')])['then'](function(_0x47e0d1){if(_0x47e0d1){_0x4af41b[_0xeb06('0x26')]=_0x47e0d1['id'];logger['info'](_0xeb06('0x29'),_0x4af41b[_0xeb06('0x26')]);return _0x534c7d(_0x4af41b);}createEndUser(_0x4af41b,_0xbfa91,_0x4c9955,_0x395740)[_0xeb06('0x17')](function(_0x40e7b7){logger['info'](_0xeb06('0x2a'),_0x40e7b7[_0xeb06('0x26')]);return _0x534c7d(_0x40e7b7);});});})[_0xeb06('0x14')](function(_0xc4493e){_0x34e4f3(_0xc4493e);});});};}function createEndUser(_0x1edd1e,_0x5b8254,_0x3ea870,_0x5417c8){return new Promise(function(_0x5479cc,_0x43602f){var _0x4a0034=moment();var _0x107b3d={'method':_0xeb06('0x2b'),'uri':_0x5417c8+_0xeb06('0x2c'),'body':{'contact':{'last_name':_0x1edd1e[_0xeb06('0x24')],'work_number':_0x1edd1e['contactNumber'],'mobile_number':_0x1edd1e[_0xeb06('0x24')],'owner_id':_0x1edd1e[_0xeb06('0x1b')],'created_at':_0x4a0034[_0xeb06('0x23')](_0xeb06('0x2d'))}},'json':!![]};_0x107b3d[_0xeb06('0xc')]=_0x3ea870;logger['info'](_0xeb06('0x2e'));return rp(_0x107b3d)[_0xeb06('0x17')](function(_0xa28ba2){_0x1edd1e[_0xeb06('0x26')]=_0xa28ba2[_0xeb06('0x2f')]['id'];_0x5479cc(_0x1edd1e);})[_0xeb06('0x14')](function(_0x2cf12b){logger[_0xeb06('0x1f')]('['+[_0x5b8254['toUpperCase']()]+']',_0x2cf12b[_0xeb06('0x16')]);_0x43602f(_0x2cf12b[_0xeb06('0x16')]);});});}function getTicket(_0x43d6b3,_0x1afe42,_0x347e90,_0x2c4df9,_0x36b923){return function(_0x1d736d){logger[_0xeb06('0x12')](_0xeb06('0x30'));return new Promise(function(_0x227e72,_0x31205d){var _0xf47d7b=moment();var _0x3acfa1={'method':'POST','uri':_0x347e90+'/api/tasks','body':{'title':intUtil['getString'](_0x2c4df9[_0xeb06('0x31')],_0x36b923,'\x20'),'description':intUtil[_0xeb06('0x32')](_0x2c4df9[_0xeb06('0x33')],_0x36b923,'\x0a'),'owner_id':_0x1d736d[_0xeb06('0x1b')],'creater_id':_0x1d736d[_0xeb06('0x11')],'targetable_id':_0x1d736d[_0xeb06('0x26')],'targetable_type':_0xeb06('0x34'),'created_at':_0xf47d7b[_0xeb06('0x23')](_0xeb06('0x2d')),'due_date':_0xf47d7b[_0xeb06('0x35')](0x1e,'m')[_0xeb06('0x23')](_0xeb06('0x2d'))},'json':!![]};_0x3acfa1[_0xeb06('0xc')]=_0x1afe42;return rp(_0x3acfa1)[_0xeb06('0x17')](function(_0x429e82){_0x1d736d[_0xeb06('0x36')]=_0x429e82[_0xeb06('0x37')]['id'];logger['info']('Task\x20created:',_0x1d736d[_0xeb06('0x36')]);_0x227e72(_0x1d736d);})['catch'](function(_0x4a7458){logger['error']('['+[_0x43d6b3[_0xeb06('0x15')]()]+']',_0x4a7458[_0xeb06('0x16')]);_0x31205d(_0x4a7458[_0xeb06('0x16')]);});});};}function emit(_0x3a8f8e,_0x353875,_0x3e6830){var _0x4ffc8a={'uri':_0x3a8f8e+_0xeb06('0x38')+_0x3e6830};io['to'](util['format'](_0xeb06('0x39'),_0x353875))['emit']('trigger:browser:url',_0x4ffc8a);}exports['cs']=function(_0x266842,_0x5d28e7,_0x14a52b,_0x4323fb,_0x30a198,_0x567ce3,_0x40c14b,_0x2e443d){var _0x4d0b6f={};var _0x50f8a9={'Authorization':_0xeb06('0x3a')+_0x567ce3['apiKey']};_0x567ce3['remoteUri']=intUtil[_0xeb06('0x3b')](_0x567ce3[_0xeb06('0x3c')]);_0x567ce3[_0xeb06('0x3d')]=intUtil[_0xeb06('0x3b')](_0x567ce3[_0xeb06('0x3d')]);var _0x24c5a1=_0x567ce3['remoteUri'];_0x4d0b6f[_0xeb06('0x10')]=_0x567ce3[_0xeb06('0x3e')];_0x4d0b6f[_0xeb06('0x24')]=_0x2e443d[_0xeb06('0x3f')]()==='outbound'?_0x5d28e7['destcalleridnum']:_0x5d28e7[_0xeb06('0x40')];_0x4d0b6f[_0xeb06('0x41')]=_0x2e443d===_0xeb06('0x42')||_0x2e443d==='unmanaged'?'queue':_0xeb06('0x43');if(_0x4323fb){_0x4d0b6f[_0xeb06('0x19')]=_0x4323fb['email'];}var _0x24e40d=util[_0xeb06('0x23')](_0xeb06('0x44'),_0x567ce3[_0xeb06('0x3d')],_0x5d28e7['uniqueid'],md5(_0x5d28e7[_0xeb06('0x45')]));if(_0x30a198&&_0x30a198[_0xeb06('0x46')]){logger[_0xeb06('0x12')](_0xeb06('0x47'),_0xeb06('0x48'));_0x5d28e7[_0xeb06('0x49')]=_0x24e40d;}else if(_0x40c14b&&_0x40c14b[_0xeb06('0x4a')]&&_0x40c14b[_0xeb06('0x4a')]!==_0xeb06('0x4b')){logger[_0xeb06('0x12')](_0xeb06('0x4c'),_0xeb06('0x48'));_0x5d28e7['recordingURL']=_0x24e40d;}else{_0x5d28e7[_0xeb06('0x49')]='';}return getAdminId(_0x4d0b6f,_0x2e443d,_0x50f8a9,_0x24c5a1)[_0xeb06('0x17')](getUser(_0x2e443d,_0x50f8a9,_0x24c5a1))['then'](getEndUser(_0x2e443d,_0x50f8a9,_0x24c5a1))[_0xeb06('0x17')](getTicket(_0x2e443d,_0x50f8a9,_0x24c5a1,_0x14a52b,_0x5d28e7))[_0xeb06('0x17')](function(_0x4384d1){logger[_0xeb06('0x12')](util[_0xeb06('0x23')](_0xeb06('0x4d'),_0x4384d1[_0xeb06('0x36')]));if(_0x2e443d!=='unmanaged'){logger[_0xeb06('0x12')]('['+[_0x2e443d[_0xeb06('0x15')]()]+']',_0xeb06('0x4e'));emit(_0x24c5a1,_0x4323fb['name'],_0x4384d1[_0xeb06('0x26')]);}})[_0xeb06('0x14')](function(_0x180448){logger['error']('['+[_0x2e443d[_0xeb06('0x15')]()]+_0xeb06('0x4f'),util[_0xeb06('0x50')](_0x180448,{'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 2e47af1..d8d5ba9 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 _0x007f=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','toLowerCase','data1','find'];(function(_0x52b4a9,_0x659ba9){var _0x5042cc=function(_0x346ea2){while(--_0x346ea2){_0x52b4a9['push'](_0x52b4a9['shift']());}};_0x5042cc(++_0x659ba9);}(_0x007f,0xdf));var _0xf007=function(_0x57e50b,_0x16e856){_0x57e50b=_0x57e50b-0x0;var _0x4a1016=_0x007f[_0x57e50b];return _0x4a1016;};'use strict';var _=require(_0xf007('0x0'));var util=require(_0xf007('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xf007('0x2'));var sugarcrm=require(_0xf007('0x3'));var freshdesk=require(_0xf007('0x4'));var zoho=require(_0xf007('0x5'));var desk=require(_0xf007('0x6'));var vtiger=require(_0xf007('0x7'));var servicenow=require(_0xf007('0x8'));var dynamics365=require(_0xf007('0x9'));var freshsales=require(_0xf007('0xa'));var integrations=[_0xf007('0xb'),'salesforce',_0xf007('0xc'),'freshdesk',_0xf007('0xd'),_0xf007('0xe'),_0xf007('0xf'),_0xf007('0x10'),'freshsales',_0xf007('0x11')];exports[_0xf007('0x12')]=function(_0xbe45a4,_0x510783,_0x187daa,_0x4c7900,_0xcbbf6f,_0x4897b3){if(_0x187daa){if(_[_0xf007('0x13')](integrations,_0xbe45a4['data1'][_0xf007('0x14')]())){try{var _0x5d76fe=null;var _0x479ee0='';var _0x31c1fb=_0x187daa[_0xbe45a4[_0xf007('0x15')][_0xf007('0x14')]()];if(_0x31c1fb){var _0x4f4eba=_0x31c1fb[_0xbe45a4['data2']];if(_0x4f4eba){var _0x326c5b=_[_0xf007('0x16')](_0x4f4eba[_0xf007('0x17')],{'id':parseInt(_0xbe45a4[_0xf007('0x18')],0xa)});if(_0x326c5b){if(_0x4c7900){if(_0xcbbf6f&&_0x510783[_0xf007('0x19')]){_0x479ee0=_0xf007('0x19');}else if(_0x510783[_0xf007('0x1a')]){_0x479ee0=_0xf007('0x1b');}else{console[_0xf007('0x1c')](_0xf007('0x1d'),_0x510783);}}else{_0x479ee0=_0xf007('0x1e');}switch(_0xbe45a4[_0xf007('0x15')][_0xf007('0x14')]()){case _0xf007('0xb'):zendesk[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0x1f'):salesforce[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0xc'):sugarcrm[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0x20'):freshdesk[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0xd'):zoho[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case'desk':desk[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0xf'):vtiger[_0x479ee0](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3);break;case _0xf007('0x21'):freshsales['cs'](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3,_0x479ee0);break;case'servicenow':servicenow['cs'](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3,_0x479ee0);break;case _0xf007('0x10'):dynamics365['cs'](_0xbe45a4,_0x510783,_0x326c5b,_0x4c7900,_0xcbbf6f,_0x4f4eba,_0x4897b3,_0x479ee0);break;default:console[_0xf007('0x1c')]('unknown\x20integration');}}else{_0x5d76fe=require(_0xf007('0x22'))(_0xbe45a4[_0xf007('0x15')][_0xf007('0x14')]());_0x5d76fe[_0xf007('0x23')](_0xf007('0x24'),util[_0xf007('0x25')](_0xf007('0x26'),_0xbe45a4[_0xf007('0x15')][_0xf007('0x14')](),_0xbe45a4['data3']));}}else{_0x5d76fe=require(_0xf007('0x22'))(_0xbe45a4[_0xf007('0x15')][_0xf007('0x14')]());_0x5d76fe['error']('[EXEC]',util['format'](_0xf007('0x27'),_0xbe45a4[_0xf007('0x15')]['toLowerCase'](),_0xbe45a4[_0xf007('0x28')]));}}else{}}catch(_0x1eb94f){console[_0xf007('0x23')](_0x1eb94f);}}}}; \ No newline at end of file +var _0xf5a7=['outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0xf5a7,0x1ec));var _0x7f5a=function(_0x4c8f97,_0x56ecc9){_0x4c8f97=_0x4c8f97-0x0;var _0x2837d3=_0xf5a7[_0x4c8f97];return _0x2837d3;};'use strict';var _=require('lodash');var util=require(_0x7f5a('0x0'));var zendesk=require(_0x7f5a('0x1'));var salesforce=require(_0x7f5a('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x7f5a('0x3'));var desk=require(_0x7f5a('0x4'));var vtiger=require(_0x7f5a('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x7f5a('0x6'));var freshsales=require(_0x7f5a('0x7'));var integrations=[_0x7f5a('0x8'),_0x7f5a('0x9'),_0x7f5a('0xa'),_0x7f5a('0xb'),'zoho',_0x7f5a('0xc'),_0x7f5a('0xd'),_0x7f5a('0xe'),_0x7f5a('0xf'),_0x7f5a('0x10')];exports[_0x7f5a('0x11')]=function(_0x5d63dd,_0x21ff3b,_0x2c21b1,_0x13d172,_0x3d698c,_0x1fe7fe){if(_0x2c21b1){if(_['includes'](integrations,_0x5d63dd[_0x7f5a('0x12')]['toLowerCase']())){try{var _0x2c0c88=null;var _0x153863='';var _0x4ac567=_0x2c21b1[_0x5d63dd[_0x7f5a('0x12')][_0x7f5a('0x13')]()];if(_0x4ac567){var _0x36f78a=_0x4ac567[_0x5d63dd[_0x7f5a('0x14')]];if(_0x36f78a){var _0x30ee04=_[_0x7f5a('0x15')](_0x36f78a[_0x7f5a('0x16')],{'id':parseInt(_0x5d63dd[_0x7f5a('0x17')],0xa)});if(_0x30ee04){if(_0x13d172){if(_0x3d698c&&_0x21ff3b[_0x7f5a('0x18')]){_0x153863='queue';}else if(_0x21ff3b[_0x7f5a('0x19')]){_0x153863=_0x7f5a('0x1a');}else{console[_0x7f5a('0x1b')](_0x7f5a('0x1c'),_0x21ff3b);}}else{_0x153863=_0x7f5a('0x1d');}switch(_0x5d63dd['data1'][_0x7f5a('0x13')]()){case'zendesk':zendesk[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case _0x7f5a('0x9'):salesforce[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case _0x7f5a('0xa'):sugarcrm[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case'freshdesk':freshdesk[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case'zoho':zoho[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case _0x7f5a('0xc'):desk[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case _0x7f5a('0xd'):vtiger[_0x153863](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe);break;case _0x7f5a('0xf'):freshsales['cs'](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe,_0x153863);break;case'servicenow':servicenow['cs'](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe,_0x153863);break;case _0x7f5a('0xe'):dynamics365['cs'](_0x5d63dd,_0x21ff3b,_0x30ee04,_0x13d172,_0x3d698c,_0x36f78a,_0x1fe7fe,_0x153863);break;default:console[_0x7f5a('0x1b')](_0x7f5a('0x1e'));}}else{_0x2c0c88=require('../../../../config/logger')(_0x5d63dd[_0x7f5a('0x12')]['toLowerCase']());_0x2c0c88[_0x7f5a('0x1f')](_0x7f5a('0x20'),util[_0x7f5a('0x21')](_0x7f5a('0x22'),_0x5d63dd[_0x7f5a('0x12')][_0x7f5a('0x13')](),_0x5d63dd[_0x7f5a('0x17')]));}}else{_0x2c0c88=require(_0x7f5a('0x23'))(_0x5d63dd[_0x7f5a('0x12')]['toLowerCase']());_0x2c0c88[_0x7f5a('0x1f')](_0x7f5a('0x20'),util[_0x7f5a('0x21')](_0x7f5a('0x24'),_0x5d63dd['data1'][_0x7f5a('0x13')](),_0x5d63dd[_0x7f5a('0x14')]));}}else{}}catch(_0x1b48be){console[_0x7f5a('0x1f')](_0x1b48be);}}}}; \ 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 2a219a4..353d862 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 _0x7226=['additionalSearchAccount','Account','Contact','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','No\x20Company','upperFirst','includes','string','picklist','idField','toString','variableName','Variable','name','toLowerCase','password','concat','remoteUri','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','Subjects','getString','Task','ActivityDate','utc','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','ticketType','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','additionalSearchLead','Lead','account_contact_lead'];(function(_0x114aad,_0x5df4a2){var _0x35dfc8=function(_0x44958d){while(--_0x44958d){_0x114aad['push'](_0x114aad['shift']());}};_0x35dfc8(++_0x5df4a2);}(_0x7226,0x138));var _0x6722=function(_0x4eaa30,_0x4255cf){_0x4eaa30=_0x4eaa30-0x0;var _0x20f148=_0x7226[_0x4eaa30];return _0x20f148;};'use strict';var _=require(_0x6722('0x0'));var rp=require(_0x6722('0x1'));var moment=require(_0x6722('0x2'));var BPromise=require(_0x6722('0x3'));var md5=require('md5');var jsforce=require(_0x6722('0x4'));var util=require('util');var Redis=require(_0x6722('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6722('0x6'))(_0x6722('0x7'));config[_0x6722('0x8')]=_[_0x6722('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6722('0xa'))(new Redis(config[_0x6722('0x8')]));function emit(_0x3a7b43,_0x37f4f5,_0x4ac1ca){io['to'](_0x3a7b43)['emit'](_0x37f4f5,_0x4ac1ca);}function getTicket(_0x3e2415,_0x13fbcf,_0x52a6ed,_0x2678a3,_0x1b44ce,_0x2a23e0,_0x4c234c,_0x735009){var _0xd04964=Object[_0x6722('0xb')]({},{'OwnerId':_0x13fbcf['id'],'Subject':intUtil['getString'](_0x2678a3[_0x6722('0xc')],_0x1b44ce,'\x20'),'Description':intUtil[_0x6722('0xd')](_0x2678a3['Descriptions'],_0x1b44ce,'\x0a')},getCustomFields(_0x2a23e0,_0x1b44ce));if(_0x52a6ed){if(_0x2678a3['ticketType']===_0x6722('0xe')){_0xd04964[_0x6722('0xf')]=moment[_0x6722('0x10')]();_0xd04964['IsReminderSet']=![];_0xd04964['IsRecurrence']=![];if(_0x52a6ed[_0x6722('0x11')]==='contact'||_0x52a6ed[_0x6722('0x11')]===_0x6722('0x12')){_0xd04964[_0x6722('0x13')]=_0x52a6ed['id'];}else if(_0x52a6ed[_0x6722('0x11')]===_0x6722('0x14')){_0xd04964[_0x6722('0x15')]=_0x52a6ed['id'];}}else if(_0x2678a3['ticketType']===_0x6722('0x16')){if(_0x52a6ed[_0x6722('0x11')]===_0x6722('0x17')){_0xd04964[_0x6722('0x18')]=_0x52a6ed['id'];}else if(_0x52a6ed[_0x6722('0x11')]===_0x6722('0x14')){_0xd04964[_0x6722('0x19')]=_0x52a6ed['id'];}else if(_0x52a6ed[_0x6722('0x11')]===_0x6722('0x12')&&_0x2678a3[_0x6722('0x1a')]){_0xd04964[_0x2678a3[_0x6722('0x1a')]]=_0x52a6ed['id'];}else{logger[_0x6722('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4c234c['sobject'](_0x2678a3[_0x6722('0x1c')])[_0x6722('0x1d')](_0xd04964);}function getUser(_0x32abe2,_0x337ceb,_0x1aeaa3){if(!_[_0x6722('0x1e')](_0x337ceb)&&intUtil[_0x6722('0x1f')](_0x337ceb)){var _0x5dc227={'Email':_0x337ceb};var _0x3f0e37={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1aeaa3['sobject']('User')[_0x6722('0x20')](_0x5dc227,_0x3f0e37)[_0x6722('0x21')]()[_0x6722('0x22')](function(_0x1ff80f){if(_0x1ff80f[_0x6722('0x23')]){var _0x723ad1=_['find'](_0x1ff80f,function(_0x1f3615){return _0x1f3615['Email']===_0x337ceb;});if(_0x723ad1){logger[_0x6722('0x1b')](_0x6722('0x24'),_0x337ceb);return BPromise[_0x6722('0x25')]({'id':_0x723ad1['Id'],'name':_0x723ad1[_0x6722('0x26')]});}}else{logger[_0x6722('0x1b')](_0x6722('0x27'),_0x337ceb);return _0x1aeaa3[_0x6722('0x28')]()[_0x6722('0x22')](function(_0x47e9f0){return BPromise[_0x6722('0x25')]({'id':_0x47e9f0[_0x6722('0x29')],'name':_0x47e9f0[_0x6722('0x2a')]});});}});}else{logger[_0x6722('0x1b')](_0x6722('0x27'),_0x337ceb);return _0x1aeaa3['identity']()[_0x6722('0x22')](function(_0x358d2f){return BPromise[_0x6722('0x25')]({'id':_0x358d2f[_0x6722('0x29')],'name':_0x358d2f['display_name']});});}}function getEndUser(_0x73ce5f,_0x2d903f,_0x285457,_0x1f8d23,_0x246144){var _0x959f03={'$or':{'Phone':_0x1f8d23}};var _0x209e34={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x6722('0x22')](function(){logger['info'](_0x6722('0x2b'),_0x1f8d23,_0x2d903f[_0x6722('0x2c')]);switch(_0x2d903f[_0x6722('0x2c')]){case _0x6722('0x2d'):var _0x5e9e05=_[_0x6722('0x2e')](_0x959f03);if(_0x2d903f[_0x6722('0x2f')]){var _0x42bac5={};_0x42bac5[_0x2d903f[_0x6722('0x2f')]]=_0x1f8d23;_[_0x6722('0x30')](_0x5e9e05[_0x6722('0x31')],_0x42bac5);}return _0x246144[_0x6722('0x32')]('Contact')['find'](_0x5e9e05,_0x209e34)[_0x6722('0x21')]()[_0x6722('0x22')](function(_0x74c743){if(_0x74c743&&_0x74c743[_0x6722('0x23')]){return _0x74c743;}else{var _0x314661=_['cloneDeep'](_0x959f03);if(_0x2d903f[_0x6722('0x33')]){var _0x4d7ca3={};_0x4d7ca3[_0x2d903f['additionalSearchLead']]=_0x1f8d23;_[_0x6722('0x30')](_0x314661['$or'],_0x4d7ca3);}return _0x246144[_0x6722('0x32')](_0x6722('0x34'))[_0x6722('0x20')](_0x314661,_0x209e34);}});case _0x6722('0x35'):var _0x3134ff=_['cloneDeep'](_0x959f03);if(_0x2d903f[_0x6722('0x36')]){var _0x42bac5={};_0x42bac5[_0x2d903f[_0x6722('0x36')]]=_0x1f8d23;_[_0x6722('0x30')](_0x3134ff[_0x6722('0x31')],_0x42bac5);}return _0x246144[_0x6722('0x32')](_0x6722('0x37'))['find'](_0x3134ff,_0x209e34)[_0x6722('0x21')]()[_0x6722('0x22')](function(_0x412bf7){if(_0x412bf7&&_0x412bf7[_0x6722('0x23')]){return _0x412bf7;}else{var _0xc6845f=_['cloneDeep'](_0x959f03);if(_0x2d903f['additionalSearchContact']){var _0x3e9bc4={};_0x3e9bc4[_0x2d903f['additionalSearchContact']]=_0x1f8d23;_[_0x6722('0x30')](_0xc6845f[_0x6722('0x31')],_0x3e9bc4);}return _0x246144[_0x6722('0x32')]('Contact')['find'](_0xc6845f,_0x209e34)['then'](function(_0x354118){if(_0x354118&&_0x354118[_0x6722('0x23')]){return _0x354118;}else{var _0x7ccdf7=_[_0x6722('0x2e')](_0x959f03);if(_0x2d903f['additionalSearchLead']){var _0x25a571={};_0x25a571[_0x2d903f[_0x6722('0x33')]]=_0x1f8d23;_[_0x6722('0x30')](_0x7ccdf7[_0x6722('0x31')],_0x25a571);}return _0x246144[_0x6722('0x32')](_0x6722('0x34'))[_0x6722('0x20')](_0x7ccdf7,_0x209e34);}});}});case'contact':var _0x5e9e05=_[_0x6722('0x2e')](_0x959f03);if(_0x2d903f[_0x6722('0x2f')]){var _0x42bac5={};_0x42bac5[_0x2d903f[_0x6722('0x2f')]]=_0x1f8d23;_[_0x6722('0x30')](_0x5e9e05[_0x6722('0x31')],_0x42bac5);}return _0x246144[_0x6722('0x32')](_0x6722('0x38'))[_0x6722('0x20')](_0x5e9e05,_0x209e34)[_0x6722('0x21')]();case'lead':var _0x546c00=_[_0x6722('0x2e')](_0x959f03);if(_0x2d903f[_0x6722('0x33')]){var _0x42bac5={};_0x42bac5[_0x2d903f[_0x6722('0x33')]]=_0x1f8d23;_[_0x6722('0x30')](_0x546c00[_0x6722('0x31')],_0x42bac5);}return _0x246144['sobject']('Lead')[_0x6722('0x20')](_0x546c00,_0x209e34);case _0x6722('0x14'):var _0x3134ff=_['cloneDeep'](_0x959f03);if(_0x2d903f[_0x6722('0x36')]){var _0x42bac5={};_0x42bac5[_0x2d903f[_0x6722('0x36')]]=_0x1f8d23;_['merge'](_0x3134ff[_0x6722('0x31')],_0x42bac5);}return _0x246144[_0x6722('0x32')]('Account')[_0x6722('0x20')](_0x3134ff,_0x209e34);default:return null;}})['then'](function(_0x586bb4){if(_0x586bb4&&_0x586bb4['length']){var _0x317eae=_[_0x6722('0x39')](_0x586bb4);if(_0x317eae){return BPromise[_0x6722('0x25')]({'id':_0x317eae['Id'],'name':_0x317eae['Name'],'phone':_0x317eae[_0x6722('0x3a')],'endUserType':_0x317eae[_0x6722('0x3b')][_0x6722('0x3c')]['toLowerCase']()});}}})[_0x6722('0x22')](function(_0x5503af){if(_0x5503af){logger[_0x6722('0x1b')](_0x6722('0x3d'),_0x5503af[_0x6722('0x11')],_0x1f8d23);return BPromise['resolve'](_0x5503af);}else{logger[_0x6722('0x1b')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x1f8d23);var _0x42efb3={'Phone':_0x1f8d23};if(_0x2d903f[_0x6722('0x3e')]){if(_0x2d903f[_0x6722('0x3e')]===_0x6722('0x17')){logger['info'](_0x6722('0x3f'),_0x1f8d23,_0x2d903f[_0x6722('0x3e')]);_0x42efb3[_0x6722('0x40')]=_0x285457!==''?_0x285457:util[_0x6722('0x41')](_0x6722('0x42'),_0x1f8d23);}else if(_0x2d903f['moduleCreate']==='lead'){logger['info'](_0x6722('0x3f'),_0x1f8d23,_0x2d903f[_0x6722('0x3e')]);_0x42efb3[_0x6722('0x40')]=_0x285457!==''?_0x285457:util[_0x6722('0x41')](_0x6722('0x42'),_0x1f8d23);_0x42efb3['Company']=_0x6722('0x43');}else if(_0x2d903f[_0x6722('0x3e')]==='account'){logger[_0x6722('0x1b')](_0x6722('0x3f'),_0x1f8d23,_0x2d903f['moduleCreate']);_0x42efb3[_0x6722('0x26')]=_0x285457!==''?_0x285457:util[_0x6722('0x41')]('Caller\x20-\x20%s',_0x1f8d23);}else{return null;}}return _0x246144[_0x6722('0x32')](_[_0x6722('0x44')](_0x2d903f['moduleCreate']))[_0x6722('0x1d')](_0x42efb3)[_0x6722('0x22')](function(_0x77d1a0){return BPromise[_0x6722('0x25')]({'id':_0x77d1a0['id'],'endUserType':_0x2d903f[_0x6722('0x3e')]});});}});}function getCustomFields(_0x2bbbab,_0x8eedef){var _0x109fda={};if(_0x2bbbab[_0x6722('0x23')]>0x0){_['forEach'](_0x2bbbab,function(_0x25f2fe){if(_[_0x6722('0x45')]([_0x6722('0x46'),_0x6722('0x47')],_0x25f2fe[_0x6722('0x3c')])&&_0x25f2fe[_0x6722('0x48')]){_0x109fda[_0x25f2fe[_0x6722('0x48')]]=_0x25f2fe['content'][_0x6722('0x49')]();}else if(_0x25f2fe[_0x6722('0x3c')]==='variable'&&_0x25f2fe[_0x6722('0x4a')]&&_0x25f2fe[_0x6722('0x48')]){_0x8eedef[_0x25f2fe[_0x6722('0x4a')]]&&(_0x109fda[_0x25f2fe[_0x6722('0x48')]]=_0x8eedef[_0x25f2fe[_0x6722('0x4a')]][_0x6722('0x49')]());}else if(_0x25f2fe[_0x6722('0x3c')]==='customVariable'&&_0x25f2fe[_0x6722('0x4b')]&&_0x25f2fe['Variable'][_0x6722('0x4c')]&&_0x25f2fe['idField']){_0x8eedef[_0x25f2fe[_0x6722('0x4b')]['name'][_0x6722('0x4d')]()]&&(_0x109fda[_0x25f2fe[_0x6722('0x48')]]=_0x8eedef[_0x25f2fe[_0x6722('0x4b')]['name'][_0x6722('0x4d')]()][_0x6722('0x49')]());}});}return _0x109fda;}function getConnection(_0x32456d){var _0x8063a3=_0x32456d[_0x6722('0x4e')][_0x6722('0x4f')](_0x32456d['securityToken']);var _0x45bb89=new jsforce['Connection']({'oauth2':{'loginUrl':_0x32456d[_0x6722('0x50')]||'https://login.salesforce.com','clientId':_0x32456d[_0x6722('0x51')],'clientSecret':_0x32456d['clientSecret']}});return _0x45bb89[_0x6722('0x52')](_0x32456d[_0x6722('0x53')],_0x8063a3)[_0x6722('0x22')](function(){logger['info'](_0x6722('0x54'));return _0x45bb89;});}exports[_0x6722('0x55')]=function(_0x5e47b3,_0x12c7e2,_0x487324,_0x1a655b,_0x5b12e6,_0x17c2fb){var _0x36d2e5,_0x4348eb,_0x518db5,_0x5b8a5d;_0x17c2fb['serverUrl']=intUtil[_0x6722('0x56')](_0x17c2fb[_0x6722('0x57')]);_0x17c2fb[_0x6722('0x50')]=intUtil['stripTrailingSlash'](_0x17c2fb[_0x6722('0x50')]);if(_0x5b12e6&&_0x5b12e6['monitor_format']){logger[_0x6722('0x1b')](_0x6722('0x58'),_0x6722('0x59'));_0x12c7e2['recordingURL']=util['format'](_0x6722('0x5a'),_0x17c2fb[_0x6722('0x57')],_0x12c7e2['uniqueid'],md5(_0x12c7e2[_0x6722('0x5b')]));}else{_0x12c7e2[_0x6722('0x5c')]='';}return getConnection(_0x17c2fb)['then'](function(_0x3d46be){_0x5b8a5d=_0x3d46be;return getUser(_0x17c2fb,_0x1a655b['email'],_0x5b8a5d);})[_0x6722('0x22')](function(_0x5eddba){_0x36d2e5=_0x5eddba;return getEndUser(_0x17c2fb,_0x487324,_0x12c7e2[_0x6722('0x5d')],_0x12c7e2[_0x6722('0x5e')],_0x5b8a5d);})['then'](function(_0x28e752){_0x4348eb=_0x28e752;return getTicket(_0x17c2fb,_0x36d2e5,_0x4348eb,_0x487324,_0x12c7e2,_0x487324[_0x6722('0x5f')],_0x5b8a5d,_0x6722('0x55'));})[_0x6722('0x22')](function(_0x3029a1){_0x518db5=_0x3029a1;logger[_0x6722('0x1b')](_0x6722('0x60'),_0x518db5['id']);logger['info'](_0x6722('0x61'),_0x518db5['id'],_0x1a655b[_0x6722('0x4c')],_0x17c2fb[_0x6722('0x3c')]);switch(_0x17c2fb[_0x6722('0x3c')]){case _0x6722('0x62'):emit(util[_0x6722('0x41')](_0x6722('0x63'),_0x1a655b[_0x6722('0x4c')]),_0x6722('0x64'),{'recordId':_0x518db5['id']});break;case _0x6722('0x65'):emit(util[_0x6722('0x41')](_0x6722('0x63'),_0x1a655b[_0x6722('0x4c')]),_0x6722('0x66'),{'uri':util[_0x6722('0x41')](_0x6722('0x67'),_0x5b8a5d['instanceUrl'],_0x518db5['id'])});break;default:logger[_0x6722('0x68')](_0x6722('0x69'));}})[_0x6722('0x6a')](function(_0xf807cd){logger[_0x6722('0x68')](_0x6722('0x58'),_0xf807cd);});};exports[_0x6722('0x6b')]=function(_0x32c737,_0x41231c,_0x1bf2b9,_0x33ea43,_0x23575b,_0x4fba77,_0x28063d){var _0x53bd1a,_0x153192,_0x3abef,_0x46ccea;_0x4fba77[_0x6722('0x57')]=intUtil[_0x6722('0x56')](_0x4fba77[_0x6722('0x57')]);_0x4fba77[_0x6722('0x50')]=intUtil['stripTrailingSlash'](_0x4fba77[_0x6722('0x50')]);if(_0x28063d&&_0x28063d[_0x6722('0x6c')]&&_0x28063d[_0x6722('0x6c')]!==_0x6722('0x6d')){logger[_0x6722('0x1b')]('[OUTBOUND]',_0x6722('0x59'));_0x41231c[_0x6722('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4fba77['serverUrl'],_0x41231c['uniqueid'],md5(_0x41231c[_0x6722('0x5b')]));}return getConnection(_0x4fba77)['then'](function(_0x55bf0a){_0x46ccea=_0x55bf0a;return getUser(_0x4fba77,_0x33ea43[_0x6722('0x6e')],_0x46ccea);})[_0x6722('0x22')](function(_0x3287cf){_0x53bd1a=_0x3287cf;return getEndUser(_0x4fba77,_0x1bf2b9,_0x41231c[_0x6722('0x6f')],_0x41231c[_0x6722('0x70')],_0x46ccea);})[_0x6722('0x22')](function(_0x19def6){_0x153192=_0x19def6;return getTicket(_0x4fba77,_0x53bd1a,_0x153192,_0x1bf2b9,_0x41231c,_0x1bf2b9[_0x6722('0x5f')],_0x46ccea,_0x6722('0x6b'));})[_0x6722('0x22')](function(_0x15498a){_0x3abef=_0x15498a;logger[_0x6722('0x1b')](_0x6722('0x71'),_0x3abef['id']);logger[_0x6722('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3abef['id'],_0x33ea43[_0x6722('0x4c')],_0x4fba77[_0x6722('0x3c')]);switch(_0x4fba77[_0x6722('0x3c')]){case _0x6722('0x62'):emit(util[_0x6722('0x41')](_0x6722('0x63'),_0x33ea43[_0x6722('0x4c')]),'trigger:salesforce:display',{'recordId':_0x3abef['id']});break;case _0x6722('0x65'):emit(util['format'](_0x6722('0x63'),_0x33ea43[_0x6722('0x4c')]),_0x6722('0x66'),{'uri':util[_0x6722('0x41')](_0x6722('0x67'),_0x46ccea[_0x6722('0x72')],_0x3abef['id'])});break;default:logger[_0x6722('0x68')](_0x6722('0x73'),_0x6722('0x74'));}})['catch'](function(_0xa184a8){logger[_0x6722('0x68')]('[OUTBOUND]',_0xa184a8);});};exports['unmanaged']=function(_0x541c1c,_0x3a68d1,_0x3aac82,_0x48e6ee,_0x1a48da,_0x4660fd){var _0x38d7ae,_0x5aed12,_0x4b1cb7,_0x46ccb7;_0x4660fd[_0x6722('0x57')]=intUtil[_0x6722('0x56')](_0x4660fd[_0x6722('0x57')]);_0x4660fd[_0x6722('0x50')]=intUtil[_0x6722('0x56')](_0x4660fd['remoteUri']);if(_0x1a48da&&_0x1a48da[_0x6722('0x75')]){logger[_0x6722('0x1b')]('['+_0x3a68d1['lastevent'][_0x6722('0x76')]()+']',_0x6722('0x59'));_0x3a68d1[_0x6722('0x5c')]=util['format'](_0x6722('0x5a'),_0x4660fd[_0x6722('0x57')],_0x3a68d1[_0x6722('0x5b')],md5(_0x3a68d1[_0x6722('0x5b')]));}else{_0x3a68d1[_0x6722('0x5c')]='';}return getConnection(_0x4660fd)['then'](function(_0x317765){_0x46ccb7=_0x317765;if(!_[_0x6722('0x1e')](_0x48e6ee)){return getUser(_0x4660fd,_0x48e6ee[_0x6722('0x4c')],_0x46ccb7);}else{return getUser(_0x4660fd,null,_0x46ccb7);}})[_0x6722('0x22')](function(_0x428df7){_0x38d7ae=_0x428df7;return getEndUser(_0x4660fd,_0x3aac82,_0x3a68d1[_0x6722('0x5d')],_0x3a68d1[_0x6722('0x5e')],_0x46ccb7);})['then'](function(_0x5b4817){_0x5aed12=_0x5b4817;return getTicket(_0x4660fd,_0x38d7ae,_0x5aed12,_0x3aac82,_0x3a68d1,_0x3aac82[_0x6722('0x5f')],_0x46ccb7);})['then'](function(_0x2706b8){_0x4b1cb7=_0x2706b8;logger['info']('['+_0x3a68d1[_0x6722('0x77')][_0x6722('0x76')]()+_0x6722('0x78'),_0x4b1cb7['id']);logger[_0x6722('0x1b')]('['+_0x3a68d1[_0x6722('0x77')][_0x6722('0x76')]()+_0x6722('0x79'),_0x4660fd['type']);})['catch'](function(_0x51f089){logger['error']('['+_0x3a68d1[_0x6722('0x77')][_0x6722('0x76')]()+']',_0x51f089);});}; \ No newline at end of file +var _0x59a1=['IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','contact','ContactId','AccountId','leadId','sobject','validateEmail','User','find','execute','then','length','Email','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','%s/%s/e','instanceUrl','monitor_format','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x59a1,0xe1));var _0x159a=function(_0x48e6a3,_0xdf7208){_0x48e6a3=_0x48e6a3-0x0;var _0x14bae6=_0x59a1[_0x48e6a3];return _0x14bae6;};'use strict';var _=require(_0x159a('0x0'));var rp=require(_0x159a('0x1'));var moment=require(_0x159a('0x2'));var BPromise=require('bluebird');var md5=require(_0x159a('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x159a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x159a('0x5'))(_0x159a('0x6'));config[_0x159a('0x7')]=_[_0x159a('0x8')](config[_0x159a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x159a('0x9'))(new Redis(config[_0x159a('0x7')]));function emit(_0x5562a7,_0x5e1938,_0x387c98){io['to'](_0x5562a7)['emit'](_0x5e1938,_0x387c98);}function getTicket(_0x1af183,_0x347d3e,_0x48ee29,_0x2955cc,_0x475fbc,_0x3e371b,_0x2efcbb,_0x307110){var _0x474750=Object[_0x159a('0xa')]({},{'OwnerId':_0x347d3e['id'],'Subject':intUtil[_0x159a('0xb')](_0x2955cc['Subjects'],_0x475fbc,'\x20'),'Description':intUtil[_0x159a('0xb')](_0x2955cc[_0x159a('0xc')],_0x475fbc,'\x0a')},getCustomFields(_0x3e371b,_0x475fbc));if(_0x48ee29){if(_0x2955cc['ticketType']===_0x159a('0xd')){_0x474750[_0x159a('0xe')]=moment[_0x159a('0xf')]();_0x474750[_0x159a('0x10')]=![];_0x474750[_0x159a('0x11')]=![];if(_0x48ee29[_0x159a('0x12')]==='contact'||_0x48ee29[_0x159a('0x12')]===_0x159a('0x13')){_0x474750[_0x159a('0x14')]=_0x48ee29['id'];}else if(_0x48ee29[_0x159a('0x12')]===_0x159a('0x15')){_0x474750[_0x159a('0x16')]=_0x48ee29['id'];}}else if(_0x2955cc[_0x159a('0x17')]==='Case'){if(_0x48ee29[_0x159a('0x12')]===_0x159a('0x18')){_0x474750[_0x159a('0x19')]=_0x48ee29['id'];}else if(_0x48ee29[_0x159a('0x12')]===_0x159a('0x15')){_0x474750[_0x159a('0x1a')]=_0x48ee29['id'];}else if(_0x48ee29[_0x159a('0x12')]===_0x159a('0x13')&&_0x2955cc[_0x159a('0x1b')]){_0x474750[_0x2955cc[_0x159a('0x1b')]]=_0x48ee29['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2efcbb[_0x159a('0x1c')](_0x2955cc[_0x159a('0x17')])['create'](_0x474750);}function getUser(_0x2e3eed,_0x346046,_0x3c3692){if(!_['isNil'](_0x346046)&&intUtil[_0x159a('0x1d')](_0x346046)){var _0x1e086b={'Email':_0x346046};var _0x1b0c70={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3c3692[_0x159a('0x1c')](_0x159a('0x1e'))[_0x159a('0x1f')](_0x1e086b,_0x1b0c70)[_0x159a('0x20')]()[_0x159a('0x21')](function(_0x11abf5){if(_0x11abf5[_0x159a('0x22')]){var _0x3f622e=_['find'](_0x11abf5,function(_0x25e4fb){return _0x25e4fb[_0x159a('0x23')]===_0x346046;});if(_0x3f622e){logger['info']('Agent\x20%s\x20found.',_0x346046);return BPromise[_0x159a('0x24')]({'id':_0x3f622e['Id'],'name':_0x3f622e[_0x159a('0x25')]});}}else{logger[_0x159a('0x26')](_0x159a('0x27'),_0x346046);return _0x3c3692[_0x159a('0x28')]()['then'](function(_0xa53ecb){return BPromise[_0x159a('0x24')]({'id':_0xa53ecb[_0x159a('0x29')],'name':_0xa53ecb[_0x159a('0x2a')]});});}});}else{logger[_0x159a('0x26')](_0x159a('0x27'),_0x346046);return _0x3c3692[_0x159a('0x28')]()[_0x159a('0x21')](function(_0x1e0115){return BPromise[_0x159a('0x24')]({'id':_0x1e0115[_0x159a('0x29')],'name':_0x1e0115[_0x159a('0x2a')]});});}}function getEndUser(_0x14dedd,_0x486688,_0x5648ed,_0x1e1dcb,_0x4a28e6){var _0xc21308={'$or':{'Phone':_0x1e1dcb}};var _0x291a2f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x159a('0x21')](function(){logger[_0x159a('0x26')](_0x159a('0x2b'),_0x1e1dcb,_0x486688[_0x159a('0x2c')]);switch(_0x486688[_0x159a('0x2c')]){case'contact_lead':var _0x5bcb39=_[_0x159a('0x2d')](_0xc21308);if(_0x486688[_0x159a('0x2e')]){var _0x5c5dae={};_0x5c5dae[_0x486688[_0x159a('0x2e')]]=_0x1e1dcb;_[_0x159a('0x2f')](_0x5bcb39[_0x159a('0x30')],_0x5c5dae);}return _0x4a28e6[_0x159a('0x1c')](_0x159a('0x31'))[_0x159a('0x1f')](_0x5bcb39,_0x291a2f)[_0x159a('0x20')]()[_0x159a('0x21')](function(_0x21879f){if(_0x21879f&&_0x21879f[_0x159a('0x22')]){return _0x21879f;}else{var _0xde99f2=_[_0x159a('0x2d')](_0xc21308);if(_0x486688[_0x159a('0x32')]){var _0x387989={};_0x387989[_0x486688[_0x159a('0x32')]]=_0x1e1dcb;_['merge'](_0xde99f2['$or'],_0x387989);}return _0x4a28e6[_0x159a('0x1c')](_0x159a('0x33'))[_0x159a('0x1f')](_0xde99f2,_0x291a2f);}});case'account_contact_lead':var _0x3dc853=_['cloneDeep'](_0xc21308);if(_0x486688[_0x159a('0x34')]){var _0x5c5dae={};_0x5c5dae[_0x486688['additionalSearchAccount']]=_0x1e1dcb;_[_0x159a('0x2f')](_0x3dc853[_0x159a('0x30')],_0x5c5dae);}return _0x4a28e6[_0x159a('0x1c')](_0x159a('0x35'))[_0x159a('0x1f')](_0x3dc853,_0x291a2f)[_0x159a('0x20')]()[_0x159a('0x21')](function(_0x1b8a79){if(_0x1b8a79&&_0x1b8a79['length']){return _0x1b8a79;}else{var _0x566792=_['cloneDeep'](_0xc21308);if(_0x486688['additionalSearchContact']){var _0x5b50cf={};_0x5b50cf[_0x486688['additionalSearchContact']]=_0x1e1dcb;_[_0x159a('0x2f')](_0x566792[_0x159a('0x30')],_0x5b50cf);}return _0x4a28e6[_0x159a('0x1c')](_0x159a('0x31'))[_0x159a('0x1f')](_0x566792,_0x291a2f)[_0x159a('0x21')](function(_0xcdddb5){if(_0xcdddb5&&_0xcdddb5[_0x159a('0x22')]){return _0xcdddb5;}else{var _0x23390a=_['cloneDeep'](_0xc21308);if(_0x486688['additionalSearchLead']){var _0x257b03={};_0x257b03[_0x486688['additionalSearchLead']]=_0x1e1dcb;_['merge'](_0x23390a[_0x159a('0x30')],_0x257b03);}return _0x4a28e6[_0x159a('0x1c')]('Lead')[_0x159a('0x1f')](_0x23390a,_0x291a2f);}});}});case'contact':var _0x5bcb39=_[_0x159a('0x2d')](_0xc21308);if(_0x486688[_0x159a('0x2e')]){var _0x5c5dae={};_0x5c5dae[_0x486688[_0x159a('0x2e')]]=_0x1e1dcb;_[_0x159a('0x2f')](_0x5bcb39[_0x159a('0x30')],_0x5c5dae);}return _0x4a28e6[_0x159a('0x1c')](_0x159a('0x31'))['find'](_0x5bcb39,_0x291a2f)[_0x159a('0x20')]();case _0x159a('0x13'):var _0x536518=_[_0x159a('0x2d')](_0xc21308);if(_0x486688['additionalSearchLead']){var _0x5c5dae={};_0x5c5dae[_0x486688[_0x159a('0x32')]]=_0x1e1dcb;_['merge'](_0x536518['$or'],_0x5c5dae);}return _0x4a28e6[_0x159a('0x1c')]('Lead')['find'](_0x536518,_0x291a2f);case _0x159a('0x15'):var _0x3dc853=_['cloneDeep'](_0xc21308);if(_0x486688[_0x159a('0x34')]){var _0x5c5dae={};_0x5c5dae[_0x486688[_0x159a('0x34')]]=_0x1e1dcb;_[_0x159a('0x2f')](_0x3dc853[_0x159a('0x30')],_0x5c5dae);}return _0x4a28e6['sobject'](_0x159a('0x35'))[_0x159a('0x1f')](_0x3dc853,_0x291a2f);default:return null;}})[_0x159a('0x21')](function(_0x314d79){if(_0x314d79&&_0x314d79[_0x159a('0x22')]){var _0x5482ec=_[_0x159a('0x36')](_0x314d79);if(_0x5482ec){return BPromise[_0x159a('0x24')]({'id':_0x5482ec['Id'],'name':_0x5482ec[_0x159a('0x25')],'phone':_0x5482ec[_0x159a('0x37')],'endUserType':_0x5482ec['attributes'][_0x159a('0x38')][_0x159a('0x39')]()});}}})['then'](function(_0x285791){if(_0x285791){logger[_0x159a('0x26')](_0x159a('0x3a'),_0x285791[_0x159a('0x12')],_0x1e1dcb);return BPromise[_0x159a('0x24')](_0x285791);}else{logger[_0x159a('0x26')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x1e1dcb);var _0xea5537={'Phone':_0x1e1dcb};if(_0x486688[_0x159a('0x3b')]){if(_0x486688['moduleCreate']===_0x159a('0x18')){logger[_0x159a('0x26')](_0x159a('0x3c'),_0x1e1dcb,_0x486688[_0x159a('0x3b')]);_0xea5537['LastName']=_0x5648ed!==_0x159a('0x3d')?_0x5648ed:util[_0x159a('0x3e')](_0x159a('0x3f'),_0x1e1dcb);}else if(_0x486688[_0x159a('0x3b')]===_0x159a('0x13')){logger[_0x159a('0x26')](_0x159a('0x3c'),_0x1e1dcb,_0x486688[_0x159a('0x3b')]);_0xea5537[_0x159a('0x40')]=_0x5648ed!==_0x159a('0x3d')?_0x5648ed:util[_0x159a('0x3e')]('Caller\x20-\x20%s',_0x1e1dcb);_0xea5537['Company']='No\x20Company';}else if(_0x486688[_0x159a('0x3b')]===_0x159a('0x15')){logger[_0x159a('0x26')](_0x159a('0x3c'),_0x1e1dcb,_0x486688[_0x159a('0x3b')]);_0xea5537[_0x159a('0x25')]=_0x5648ed!==_0x159a('0x3d')?_0x5648ed:util['format'](_0x159a('0x3f'),_0x1e1dcb);}else{return null;}}return _0x4a28e6[_0x159a('0x1c')](_['upperFirst'](_0x486688[_0x159a('0x3b')]))[_0x159a('0x41')](_0xea5537)[_0x159a('0x21')](function(_0x34a1a0){return BPromise[_0x159a('0x24')]({'id':_0x34a1a0['id'],'endUserType':_0x486688['moduleCreate']});});}});}function getCustomFields(_0x3166fb,_0xbc9bf3){var _0x26b0be={};if(_0x3166fb[_0x159a('0x22')]>0x0){_[_0x159a('0x42')](_0x3166fb,function(_0x557f83){if(_[_0x159a('0x43')]([_0x159a('0x44'),_0x159a('0x45')],_0x557f83['type'])&&_0x557f83[_0x159a('0x46')]){_0x26b0be[_0x557f83['idField']]=_0x557f83[_0x159a('0x47')][_0x159a('0x48')]();}else if(_0x557f83[_0x159a('0x38')]===_0x159a('0x49')&&_0x557f83[_0x159a('0x4a')]&&_0x557f83[_0x159a('0x46')]){_0xbc9bf3[_0x557f83[_0x159a('0x4a')]]&&(_0x26b0be[_0x557f83[_0x159a('0x46')]]=_0xbc9bf3[_0x557f83[_0x159a('0x4a')]][_0x159a('0x48')]());}else if(_0x557f83[_0x159a('0x38')]===_0x159a('0x4b')&&_0x557f83['Variable']&&_0x557f83[_0x159a('0x4c')][_0x159a('0x4d')]&&_0x557f83['idField']){_0xbc9bf3[_0x557f83[_0x159a('0x4c')][_0x159a('0x4d')][_0x159a('0x39')]()]&&(_0x26b0be[_0x557f83[_0x159a('0x46')]]=_0xbc9bf3[_0x557f83[_0x159a('0x4c')][_0x159a('0x4d')][_0x159a('0x39')]()][_0x159a('0x48')]());}});}return _0x26b0be;}function getConnection(_0x17285a){var _0x30a250=_0x17285a['password']['concat'](_0x17285a[_0x159a('0x4e')]);var _0x82e9b2=new jsforce[(_0x159a('0x4f'))]({'oauth2':{'loginUrl':_0x17285a[_0x159a('0x50')]||_0x159a('0x51'),'clientId':_0x17285a[_0x159a('0x52')],'clientSecret':_0x17285a[_0x159a('0x53')]}});return _0x82e9b2[_0x159a('0x54')](_0x17285a[_0x159a('0x55')],_0x30a250)['then'](function(){logger[_0x159a('0x26')](_0x159a('0x56'));return _0x82e9b2;});}exports['queue']=function(_0x166c03,_0x2a66b5,_0x2dd739,_0x2bebed,_0x5ceb2a,_0x41b88a){var _0x57ce27,_0x276416,_0x58f765,_0x5f5636;_0x41b88a[_0x159a('0x57')]=intUtil[_0x159a('0x58')](_0x41b88a['serverUrl']);_0x41b88a[_0x159a('0x50')]=intUtil[_0x159a('0x58')](_0x41b88a[_0x159a('0x50')]);if(_0x5ceb2a&&_0x5ceb2a['monitor_format']){logger[_0x159a('0x26')](_0x159a('0x59'),_0x159a('0x5a'));_0x2a66b5['recordingURL']=util['format'](_0x159a('0x5b'),_0x41b88a[_0x159a('0x57')],_0x2a66b5[_0x159a('0x5c')],md5(_0x2a66b5[_0x159a('0x5c')]));}else{_0x2a66b5[_0x159a('0x5d')]='';}return getConnection(_0x41b88a)['then'](function(_0x3e63d1){_0x5f5636=_0x3e63d1;return getUser(_0x41b88a,_0x2bebed[_0x159a('0x5e')],_0x5f5636);})[_0x159a('0x21')](function(_0x441ab4){_0x57ce27=_0x441ab4;return getEndUser(_0x41b88a,_0x2dd739,_0x2a66b5[_0x159a('0x5f')],_0x2a66b5[_0x159a('0x60')],_0x5f5636);})['then'](function(_0x9c38b8){_0x276416=_0x9c38b8;return getTicket(_0x41b88a,_0x57ce27,_0x276416,_0x2dd739,_0x2a66b5,_0x2dd739['Fields'],_0x5f5636,'queue');})[_0x159a('0x21')](function(_0x5f1482){_0x58f765=_0x5f1482;logger[_0x159a('0x26')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x58f765['id']);logger['info'](_0x159a('0x61'),_0x58f765['id'],_0x2bebed[_0x159a('0x4d')],_0x41b88a[_0x159a('0x38')]);switch(_0x41b88a[_0x159a('0x38')]){case _0x159a('0x62'):emit(util[_0x159a('0x3e')](_0x159a('0x63'),_0x2bebed[_0x159a('0x4d')]),'trigger:salesforce:display',{'recordId':_0x58f765['id']});break;case _0x159a('0x64'):emit(util[_0x159a('0x3e')]('user:%s',_0x2bebed[_0x159a('0x4d')]),_0x159a('0x65'),{'uri':util[_0x159a('0x3e')]('%s/%s/e',_0x5f5636['instanceUrl'],_0x58f765['id'])});break;default:logger[_0x159a('0x66')](_0x159a('0x67'));}})[_0x159a('0x68')](function(_0x4b16e6){logger['error'](_0x159a('0x59'),_0x4b16e6);});};exports[_0x159a('0x69')]=function(_0x125d97,_0x7e2765,_0x3ce859,_0x51d2a6,_0x30fd9a,_0x492107,_0x14c4ca){var _0x4d19dd,_0x38bb6f,_0x5abb5b,_0x34cd47;_0x492107[_0x159a('0x57')]=intUtil[_0x159a('0x58')](_0x492107[_0x159a('0x57')]);_0x492107[_0x159a('0x50')]=intUtil['stripTrailingSlash'](_0x492107[_0x159a('0x50')]);if(_0x14c4ca&&_0x14c4ca[_0x159a('0x6a')]&&_0x14c4ca[_0x159a('0x6a')]!==_0x159a('0x6b')){logger[_0x159a('0x26')](_0x159a('0x6c'),_0x159a('0x5a'));_0x7e2765[_0x159a('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x492107[_0x159a('0x57')],_0x7e2765['uniqueid'],md5(_0x7e2765[_0x159a('0x5c')]));}return getConnection(_0x492107)[_0x159a('0x21')](function(_0x40ce54){_0x34cd47=_0x40ce54;return getUser(_0x492107,_0x51d2a6[_0x159a('0x5e')],_0x34cd47);})[_0x159a('0x21')](function(_0x4c2659){_0x4d19dd=_0x4c2659;return getEndUser(_0x492107,_0x3ce859,_0x7e2765[_0x159a('0x6d')],_0x7e2765['destcalleridnum'],_0x34cd47);})[_0x159a('0x21')](function(_0x5001e9){_0x38bb6f=_0x5001e9;return getTicket(_0x492107,_0x4d19dd,_0x38bb6f,_0x3ce859,_0x7e2765,_0x3ce859[_0x159a('0x6e')],_0x34cd47,_0x159a('0x69'));})['then'](function(_0x155637){_0x5abb5b=_0x155637;logger[_0x159a('0x26')](_0x159a('0x6f'),_0x5abb5b['id']);logger[_0x159a('0x26')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5abb5b['id'],_0x51d2a6['name'],_0x492107[_0x159a('0x38')]);switch(_0x492107[_0x159a('0x38')]){case _0x159a('0x62'):emit(util['format'](_0x159a('0x63'),_0x51d2a6[_0x159a('0x4d')]),_0x159a('0x70'),{'recordId':_0x5abb5b['id']});break;case _0x159a('0x64'):emit(util[_0x159a('0x3e')](_0x159a('0x63'),_0x51d2a6[_0x159a('0x4d')]),_0x159a('0x65'),{'uri':util[_0x159a('0x3e')](_0x159a('0x71'),_0x34cd47[_0x159a('0x72')],_0x5abb5b['id'])});break;default:logger['error'](_0x159a('0x6c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x159a('0x68')](function(_0x3ed507){logger[_0x159a('0x66')](_0x159a('0x6c'),_0x3ed507);});};exports['unmanaged']=function(_0x55351b,_0x5d1122,_0x1a87cb,_0x2a89ca,_0x1fd71c,_0x5288b7){var _0x1a257b,_0x230b30,_0x3f7eb4,_0x460a5f;_0x5288b7[_0x159a('0x57')]=intUtil[_0x159a('0x58')](_0x5288b7[_0x159a('0x57')]);_0x5288b7[_0x159a('0x50')]=intUtil['stripTrailingSlash'](_0x5288b7['remoteUri']);if(_0x1fd71c&&_0x1fd71c[_0x159a('0x73')]){logger[_0x159a('0x26')]('['+_0x5d1122[_0x159a('0x74')][_0x159a('0x75')]()+']','Recording\x20is\x20enabled!');_0x5d1122['recordingURL']=util[_0x159a('0x3e')](_0x159a('0x5b'),_0x5288b7[_0x159a('0x57')],_0x5d1122[_0x159a('0x5c')],md5(_0x5d1122[_0x159a('0x5c')]));}else{_0x5d1122[_0x159a('0x5d')]='';}return getConnection(_0x5288b7)[_0x159a('0x21')](function(_0x2cce6e){_0x460a5f=_0x2cce6e;if(!_[_0x159a('0x76')](_0x2a89ca)){return getUser(_0x5288b7,_0x2a89ca[_0x159a('0x4d')],_0x460a5f);}else{return getUser(_0x5288b7,null,_0x460a5f);}})[_0x159a('0x21')](function(_0x1f8d5e){_0x1a257b=_0x1f8d5e;return getEndUser(_0x5288b7,_0x1a87cb,_0x5d1122[_0x159a('0x5f')],_0x5d1122['calleridnum'],_0x460a5f);})[_0x159a('0x21')](function(_0x24b514){_0x230b30=_0x24b514;return getTicket(_0x5288b7,_0x1a257b,_0x230b30,_0x1a87cb,_0x5d1122,_0x1a87cb[_0x159a('0x6e')],_0x460a5f);})['then'](function(_0x3b228f){_0x3f7eb4=_0x3b228f;logger['info']('['+_0x5d1122['lastevent'][_0x159a('0x75')]()+_0x159a('0x77'),_0x3f7eb4['id']);logger[_0x159a('0x26')]('['+_0x5d1122[_0x159a('0x74')]['toUpperCase']()+_0x159a('0x78'),_0x5288b7['type']);})[_0x159a('0x68')](function(_0x60dcb9){logger['error']('['+_0x5d1122[_0x159a('0x74')][_0x159a('0x75')]()+']',_0x60dcb9);});}; \ 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 12e882d..1cc70bf 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 _0xbffd=['../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','customField','nameField','toLowerCase','content','toString','includes','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5','ioredis','./util'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xbffd,0xd8));var _0xdbff=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xbffd[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xdbff('0x0'));var util=require('util');var md5=require(_0xdbff('0x1'));var Redis=require(_0xdbff('0x2'));var intUtil=require(_0xdbff('0x3'));var config=require(_0xdbff('0x4'));var logger=require('../../../../config/logger')('servicenow');config[_0xdbff('0x5')]=_[_0xdbff('0x6')](config[_0xdbff('0x5')],{'host':_0xdbff('0x7'),'port':0x18eb});var io=require(_0xdbff('0x8'))(new Redis(config[_0xdbff('0x5')]));function getAdminUser(_0xb7cfbd,_0x4d0047,_0x50bf4f,_0x11205a,_0xaacbc,_0x3152ec){return new Promise(function(_0x255c49,_0xbe5794){var _0x5145c2={'method':_0xdbff('0x9'),'uri':_0x11205a+_0xdbff('0xa')+'&'+_0xaacbc+'&'+_0x3152ec,'auth':_0x4d0047,'json':!![]};return rp(_0x5145c2)['then'](function(_0x1c4840){if(_0x1c4840['result'][_0xdbff('0xb')]>0x0){_0x50bf4f[_0xdbff('0xc')]=_0x1c4840[_0xdbff('0xd')][0x0][_0xdbff('0xe')];}logger['info']('['+[_0xb7cfbd['toUpperCase']()]+_0xdbff('0xf'),_0x50bf4f);_0x255c49(_0x50bf4f);})[_0xdbff('0x10')](function(_0x453e15){logger[_0xdbff('0x11')]('['+[_0xb7cfbd[_0xdbff('0x12')]()]+']',_0x453e15[_0xdbff('0x13')]);_0xbe5794(_0x453e15[_0xdbff('0x13')]);});});}function getUser(_0x49d895,_0x594769,_0x1d2075,_0xe26c14,_0x35aa98){return function(_0x3cb9ca){logger[_0xdbff('0x14')]('['+[_0x49d895['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x3cb9ca);return new Promise(function(_0x2923b5,_0x429120){if(intUtil['validateEmail'](_0x3cb9ca[_0xdbff('0x15')])){var _0x3f1355={'method':_0xdbff('0x9'),'uri':_0x1d2075+_0xdbff('0x16')+_0x3cb9ca[_0xdbff('0x15')]+'&'+_0xe26c14+'&'+_0x35aa98,'auth':_0x594769,'json':!![]};logger[_0xdbff('0x14')]('['+[_0x49d895[_0xdbff('0x12')]()]+_0xdbff('0x17'),_0x3f1355);return rp(_0x3f1355)[_0xdbff('0x18')](function(_0x1cadfc){logger['info']('['+[_0x49d895[_0xdbff('0x12')]()]+_0xdbff('0x19'),_0x1cadfc);if(_0x1cadfc[_0xdbff('0xd')]['length']>0x0&&String(_0x1cadfc[_0xdbff('0xd')][0x0]['active'])===_0xdbff('0x1a')){_0x3cb9ca['userId']=_0x1cadfc[_0xdbff('0xd')][0x0][_0xdbff('0xe')];}else{_0x3cb9ca[_0xdbff('0x1b')]=_0x3cb9ca[_0xdbff('0xc')];_0x3cb9ca[_0xdbff('0x15')]=_0x3cb9ca['adminEmail'];}logger[_0xdbff('0x14')]('['+[_0x49d895[_0xdbff('0x12')]()]+_0xdbff('0x1c'),_0x3cb9ca);_0x2923b5(_0x3cb9ca);})[_0xdbff('0x10')](function(_0x1e43ca){logger[_0xdbff('0x11')]('['+[_0x49d895[_0xdbff('0x12')]()]+']',_0x1e43ca[_0xdbff('0x13')]);_0x429120(_0x1e43ca[_0xdbff('0x13')]);});}else{logger[_0xdbff('0x14')]('['+[_0x49d895[_0xdbff('0x12')]()]+_0xdbff('0x1d'));_0x3cb9ca['userId']=_0x3cb9ca[_0xdbff('0xc')];_0x3cb9ca[_0xdbff('0x15')]=_0x3cb9ca['adminEmail'];_0x2923b5(_0x3cb9ca);}});};}function createEndUser(_0x2b1a1b,_0xc4bac5,_0x4dfff3,_0x176c50,_0x28a8da){logger['info']('['+[_0x2b1a1b['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x4dfff3);return new Promise(function(_0x32b460,_0x270070){var _0x57e891={'method':_0xdbff('0x1e'),'uri':_0x176c50+_0xdbff('0x1f')+_0x28a8da,'body':{'user_name':_0x4dfff3[_0xdbff('0x20')],'roles':_0xdbff('0x21'),'first_name':_0x4dfff3[_0xdbff('0x20')],'active':_0xdbff('0x1a'),'date_format':_0xdbff('0x22'),'phone':_0x4dfff3[_0xdbff('0x20')]},'auth':_0xc4bac5,'json':!![]};return rp(_0x57e891)['then'](function(_0x5b5a39){logger[_0xdbff('0x14')]('['+[_0x2b1a1b[_0xdbff('0x12')]()]+_0xdbff('0x23'),_0x5b5a39['result']);_0x4dfff3[_0xdbff('0x24')]=_0x5b5a39[_0xdbff('0xd')][_0xdbff('0xe')];_0x32b460(_0x4dfff3);})[_0xdbff('0x10')](function(_0x3a4adc){logger[_0xdbff('0x11')]('['+[_0x2b1a1b[_0xdbff('0x12')]()]+']',_0x3a4adc[_0xdbff('0x13')]);_0x270070(_0x3a4adc[_0xdbff('0x13')]);});});}function getEndUser(_0x48f315,_0xd54309,_0x283992,_0x4efb99,_0x32c367){return function(_0x3723b4){logger[_0xdbff('0x14')]('['+[_0x48f315[_0xdbff('0x12')]()]+_0xdbff('0x25'),_0x3723b4);return new Promise(function(_0x4877b3,_0x1e350f){var _0x5ab500={'method':_0xdbff('0x9'),'uri':_0x283992+_0xdbff('0x26')+_0x3723b4[_0xdbff('0x20')]+'&'+_0x4efb99+'&'+_0x32c367,'auth':_0xd54309,'json':!![]};return rp(_0x5ab500)['then'](function(_0x3f9422){if(_0x3f9422['result'][_0xdbff('0xb')]>0x0){_0x3723b4[_0xdbff('0x24')]=_0x3f9422['result'][0x0][_0xdbff('0xe')];logger[_0xdbff('0x14')]('['+[_0x48f315[_0xdbff('0x12')]()]+_0xdbff('0x27'),_0x3723b4);_0x4877b3(_0x3723b4);}else{return createEndUser(_0x48f315,_0xd54309,_0x3723b4,_0x283992,_0x4efb99)[_0xdbff('0x18')](function(_0x3953be){logger[_0xdbff('0x14')]('['+[_0x48f315[_0xdbff('0x12')]()]+_0xdbff('0x28'),_0x3953be);_0x4877b3(_0x3953be);});}})[_0xdbff('0x10')](function(_0x1e45f4){logger['error']('['+[_0x48f315[_0xdbff('0x12')]()]+']',_0x1e45f4[_0xdbff('0x13')]);_0x1e350f(_0x1e45f4[_0xdbff('0x13')]);});});};}function getCustomFields(_0xe1b9c5,_0x124861){var _0x4f10f9={};if(_0xe1b9c5[_0xdbff('0xb')]>0x0){_[_0xdbff('0x29')](_0xe1b9c5,function(_0x38289a){if(_['includes'](['string',_0xdbff('0x2a')],_0x38289a[_0xdbff('0x2b')])&&_0x38289a['nameField']&&!_0x38289a[_0xdbff('0x2c')]){_0x4f10f9[_0x38289a[_0xdbff('0x2d')][_0xdbff('0x2e')]()]=_0x38289a[_0xdbff('0x2f')][_0xdbff('0x30')]();}else if(_[_0xdbff('0x31')]([_0xdbff('0x32'),_0xdbff('0x2a')],_0x38289a[_0xdbff('0x2b')])&&_0x38289a[_0xdbff('0x33')]&&_0x38289a['customField']){_0x4f10f9[_0x38289a[_0xdbff('0x33')][_0xdbff('0x2e')]()]=_0x38289a[_0xdbff('0x2f')][_0xdbff('0x30')]();}else if(_0x38289a[_0xdbff('0x2b')]===_0xdbff('0x34')&&_0x38289a[_0xdbff('0x35')]&&_0x38289a['idField']&&_0x38289a[_0xdbff('0x2c')]){_0x4f10f9[_0x38289a['idField'][_0xdbff('0x2e')]()]=_0x124861[_0x38289a[_0xdbff('0x35')]][_0xdbff('0x30')]();}else if(_0x38289a[_0xdbff('0x2b')]===_0xdbff('0x36')&&_0x38289a[_0xdbff('0x37')]&&_0x38289a[_0xdbff('0x37')][_0xdbff('0x38')]&&_0x38289a[_0xdbff('0x33')]&&_0x38289a[_0xdbff('0x2c')]){_0x4f10f9[_0x38289a[_0xdbff('0x33')][_0xdbff('0x2e')]()]=_0x124861[_0x38289a[_0xdbff('0x37')][_0xdbff('0x38')]['toLowerCase']()][_0xdbff('0x30')]();}});}return _0x4f10f9;}function getTicket(_0x336c66,_0x2df634,_0x21e1f2,_0x4d758b,_0x54600e,_0x4223ac){return function(_0x43d4d2){logger[_0xdbff('0x14')]('['+[_0x336c66[_0xdbff('0x12')]()]+_0xdbff('0x39'),_0x43d4d2);return new Promise(function(_0x4d9915,_0x383f3a){var _0x49486f=_0x336c66[_0xdbff('0x2e')]()===_0xdbff('0x3a')?_0x43d4d2['userId']:_0x43d4d2[_0xdbff('0x24')];var _0x18c35d={'method':_0xdbff('0x1e'),'uri':_0x21e1f2+_0xdbff('0x3b')+'?'+_0x4223ac,'body':Object[_0xdbff('0x3c')]({},{'active':_0xdbff('0x1a'),'caller_id':_0x49486f,'assigned_to':_0x43d4d2[_0xdbff('0x1b')],'short_description':intUtil[_0xdbff('0x3d')](_0x4d758b[_0xdbff('0x3e')],_0x54600e,'\x20'),'description':intUtil['getString'](_0x4d758b[_0xdbff('0x3f')],_0x54600e,'\x0a')},getCustomFields(_0x4d758b[_0xdbff('0x40')],_0x54600e)),'auth':_0x2df634,'json':!![]};return rp(_0x18c35d)[_0xdbff('0x18')](function(_0x84ff6c){logger[_0xdbff('0x14')]('['+[_0x336c66['toUpperCase']()]+_0xdbff('0x41'),_0x84ff6c[_0xdbff('0xd')]);_0x43d4d2['ticketId']=_0x84ff6c[_0xdbff('0xd')][_0xdbff('0xe')];_0x43d4d2[_0xdbff('0x42')]=_0x84ff6c[_0xdbff('0xd')][_0xdbff('0x43')];logger[_0xdbff('0x14')]('['+[_0x336c66[_0xdbff('0x12')]()]+']\x20getTicket\x20crm',_0x43d4d2);_0x4d9915(_0x43d4d2);})[_0xdbff('0x10')](function(_0x48f927){logger['error']('['+[_0x336c66['toUpperCase']()]+']',_0x48f927['message']);_0x383f3a(_0x48f927[_0xdbff('0x13')]);});});};}function createRemoteTag(_0x53d14b,_0x14a38e,_0x1f42f0,_0x278e21){return new Promise(function(_0x1563cd,_0x384443){var _0x29c0d1={'method':'POST','uri':_0x1f42f0+'label'+'?'+_0x278e21,'body':{'short_description':_0x53d14b,'global':!![],'active':!![],'name':_0x53d14b},'auth':_0x14a38e,'json':!![]};return rp(_0x29c0d1)['then'](function(_0x1a315b){var _0x3238a2=_0x1a315b[_0xdbff('0xd')][_0xdbff('0xe')];_0x1563cd(_0x3238a2);});});}function getRemoteTag(_0x3ef336,_0x164d3a,_0x2b5c25,_0x3768f4,_0x121ff1){return new Promise(function(_0x2b9cb6,_0x4ea32d){var _0x5cf7cf={'method':_0xdbff('0x9'),'uri':_0x2b5c25+'label'+'?sysparm_query=name%3D'+_0x3ef336+'&'+_0x3768f4,'auth':_0x164d3a,'json':!![]};return rp(_0x5cf7cf)[_0xdbff('0x18')](function(_0x9e2efe){if(_0x9e2efe[_0xdbff('0xd')][_0xdbff('0xb')]>0x0){var _0x23e51c=_0x9e2efe[_0xdbff('0xd')][0x0]['sys_id'];_0x2b9cb6(_0x23e51c);}else{return createRemoteTag(_0x3ef336,_0x164d3a,_0x2b5c25,_0x3768f4)[_0xdbff('0x18')](function(_0x356d8a){_0x2b9cb6(_0x356d8a);});}});});}function assignTagToIncident(_0x3f0aba,_0x5ab610,_0x1db4d6,_0x37cfdf,_0x40208b){return new Promise(function(_0x58b5a0,_0x337a3b){var _0x45d893={'method':'POST','uri':_0x1db4d6+'label_entry'+'?'+_0x40208b,'body':{'label':_0x3f0aba,'table':_0xdbff('0x3b'),'id_type':_0xdbff('0x44'),'table_key':_0x37cfdf[_0xdbff('0x45')],'title':_0xdbff('0x46')+_0x37cfdf[_0xdbff('0x42')],'id_display':_0x37cfdf[_0xdbff('0x42')]},'auth':_0x5ab610,'json':!![]};return rp(_0x45d893)[_0xdbff('0x18')](function(_0x3a8b50){_0x58b5a0();})[_0xdbff('0x10')](function(){_0x58b5a0();});});}function manageTags(_0x5800ca,_0x16d995,_0x2bf32e,_0x151525,_0x5ca9a0,_0x4b3093,_0x58f40a){return new Promise(function(_0x1e50da,_0x1258a0){var _0x156468=[];_0x16d995[_0xdbff('0x29')](function(_0x8256c4){_0x156468[_0xdbff('0x47')](getRemoteTag(_0x8256c4,_0x2bf32e,_0x151525,_0x4b3093,_0x58f40a));});return Promise['all'](_0x156468)[_0xdbff('0x18')](function(_0x12973a){if(_0x12973a[_0xdbff('0xb')]){logger[_0xdbff('0x14')]('['+[_0x5800ca[_0xdbff('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x12973a);var _0x493567=[];_0x12973a[_0xdbff('0x29')](function(_0x31183a){_0x493567[_0xdbff('0x47')](assignTagToIncident(_0x31183a,_0x2bf32e,_0x151525,_0x5ca9a0,_0x4b3093));});return Promise[_0xdbff('0x48')](_0x493567)['then'](function(){_0x1e50da();})[_0xdbff('0x10')](function(){_0x1e50da();});}else{_0x1e50da();}});});}function getTags(_0x20c319,_0x4825b8,_0x166bf5,_0x4e422d,_0x14bc0e,_0x465a37){return function(_0x103236){return new Promise(function(_0x43ae8c,_0x5bbe75){var _0x4d2b86=[];var _0x118da5=_0x4e422d[_0xdbff('0x49')];if(_0x118da5&&_0x118da5[_0xdbff('0xb')]>0x0){_0x4d2b86=_[_0xdbff('0x4a')](_0x118da5,_0xdbff('0x38'));}if(_0x4d2b86[_0xdbff('0xb')]>0x0){return manageTags(_0x20c319,_0x4d2b86,_0x4825b8,_0x166bf5,_0x103236,_0x14bc0e,_0x465a37)['then'](function(){_0x43ae8c(_0x103236);});}else{_0x43ae8c(_0x103236);}});};}function emit(_0x1a0b46,_0x227af3,_0x4b160a){var _0x39f124=_0xdbff('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xdbff('0x4c')+'%255EORDERBYDESCnumber';var _0x5636cc={'uri':_0x1a0b46+_0xdbff('0x4d')+_0x4b160a+_0x39f124};io['to'](util[_0xdbff('0x4e')](_0xdbff('0x4f'),_0x227af3))[_0xdbff('0x50')](_0xdbff('0x51'),_0x5636cc);}exports['cs']=function(_0x21ae50,_0x716bfb,_0x52a3be,_0x4b57fc,_0xb217d,_0x33c923,_0x30ef29,_0x343950){var _0x241f78={};var _0x32eba3={'user':_0x33c923[_0xdbff('0x52')],'pass':_0x33c923[_0xdbff('0x53')]};var _0xe9170f='sysparm_limit=1';var _0x4ad025=_0xdbff('0x54');_0x33c923['remoteUri']=intUtil[_0xdbff('0x55')](_0x33c923['remoteUri']);_0x33c923[_0xdbff('0x56')]=intUtil[_0xdbff('0x55')](_0x33c923['serverUrl']);var _0x194cf7=util[_0xdbff('0x4e')](_0xdbff('0x57'),_0x33c923[_0xdbff('0x58')]);_0x241f78[_0xdbff('0x15')]=!_[_0xdbff('0x59')](_0x4b57fc)?_0x4b57fc['email']:null;_0x241f78['adminEmail']=_0x33c923[_0xdbff('0x5a')];_0x241f78[_0xdbff('0x20')]=_0x343950['toLowerCase']()===_0xdbff('0x3a')?_0x716bfb[_0xdbff('0x5b')]:_0x716bfb[_0xdbff('0x5c')];_0x241f78[_0xdbff('0x5d')]=_0x343950==='queue'||_0x343950===_0xdbff('0x5e')?_0xdbff('0x5f'):'outbound';var _0x39a9e5=util[_0xdbff('0x4e')](_0xdbff('0x60'),_0x33c923[_0xdbff('0x56')],_0x716bfb[_0xdbff('0x61')],md5(_0x716bfb[_0xdbff('0x61')]));if(_0xb217d&&_0xb217d[_0xdbff('0x62')]){logger[_0xdbff('0x14')](_0xdbff('0x63'),_0xdbff('0x64'));_0x716bfb[_0xdbff('0x65')]=_0x39a9e5;}else if(_0x30ef29&&_0x30ef29[_0xdbff('0x66')]&&_0x30ef29[_0xdbff('0x66')]!==_0xdbff('0x67')){logger[_0xdbff('0x14')](_0xdbff('0x68'),_0xdbff('0x64'));_0x716bfb[_0xdbff('0x65')]=_0x39a9e5;}else{_0x716bfb['recordingURL']='';}return getAdminUser(_0x343950,_0x32eba3,_0x241f78,_0x194cf7,_0x4ad025,_0xe9170f)['then'](getUser(_0x343950,_0x32eba3,_0x194cf7,_0x4ad025,_0xe9170f))[_0xdbff('0x18')](getEndUser(_0x343950,_0x32eba3,_0x194cf7,_0x4ad025,_0xe9170f))[_0xdbff('0x18')](getTicket(_0x343950,_0x32eba3,_0x194cf7,_0x52a3be,_0x716bfb,_0x4ad025))['then'](function(_0x34fefa){logger[_0xdbff('0x14')](util['format'](_0xdbff('0x69'),_0x34fefa['ticketId']));logger['info'](util[_0xdbff('0x4e')](_0xdbff('0x6a'),_0x343950));if(_0x343950!==_0xdbff('0x5e')){logger[_0xdbff('0x14')]('['+[_0x343950[_0xdbff('0x12')]()]+']',_0xdbff('0x6b'));emit(_0x33c923[_0xdbff('0x58')],_0x4b57fc[_0xdbff('0x38')],_0x34fefa[_0xdbff('0x45')]);}})['catch'](function(_0x5dcb6c){logger[_0xdbff('0x11')]('['+[_0x343950[_0xdbff('0x12')]()]+_0xdbff('0x6c'),util[_0xdbff('0x6d')](_0x5dcb6c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc1b4=['],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20entity','length','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc1b4,0xae));var _0x4c1b=function(_0x4e451e,_0x33ac5e){_0x4e451e=_0x4e451e-0x0;var _0x17519f=_0xc1b4[_0x4e451e];return _0x17519f;};'use strict';var _=require(_0x4c1b('0x0'));var Promise=require(_0x4c1b('0x1'));var rp=require(_0x4c1b('0x2'));var util=require(_0x4c1b('0x3'));var md5=require(_0x4c1b('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4c1b('0x5'));var logger=require(_0x4c1b('0x6'))(_0x4c1b('0x7'));config[_0x4c1b('0x8')]=_[_0x4c1b('0x9')](config['redis'],{'host':_0x4c1b('0xa'),'port':0x18eb});var io=require(_0x4c1b('0xb'))(new Redis(config[_0x4c1b('0x8')]));function getAdminUser(_0x59589f,_0x5af0ce,_0x45b608,_0x393c55,_0x105dd5,_0x3786ab){return new Promise(function(_0x24c34b,_0x39a9c7){var _0x565948={'method':_0x4c1b('0xc'),'uri':_0x393c55+_0x4c1b('0xd')+'&'+_0x105dd5+'&'+_0x3786ab,'auth':_0x5af0ce,'json':!![]};return rp(_0x565948)[_0x4c1b('0xe')](function(_0x2e078d){if(_0x2e078d[_0x4c1b('0xf')]['length']>0x0){_0x45b608[_0x4c1b('0x10')]=_0x2e078d[_0x4c1b('0xf')][0x0][_0x4c1b('0x11')];}logger['info']('['+[_0x59589f[_0x4c1b('0x12')]()]+'],\x20getAdminUser\x20crm',_0x45b608);_0x24c34b(_0x45b608);})[_0x4c1b('0x13')](function(_0x4d16e4){logger[_0x4c1b('0x14')]('['+[_0x59589f[_0x4c1b('0x12')]()]+']',_0x4d16e4['message']);_0x39a9c7(_0x4d16e4[_0x4c1b('0x15')]);});});}function getUser(_0x4a4855,_0x434afe,_0xaa6a4a,_0x1f749a,_0x551877){return function(_0x3f26ef){logger['info']('['+[_0x4a4855[_0x4c1b('0x12')]()]+_0x4c1b('0x16'),_0x3f26ef);return new Promise(function(_0x2c6756,_0x413b7a){if(intUtil[_0x4c1b('0x17')](_0x3f26ef[_0x4c1b('0x18')])){var _0x574b7d={'method':'GET','uri':_0xaa6a4a+_0x4c1b('0x19')+_0x3f26ef['userEmail']+'&'+_0x1f749a+'&'+_0x551877,'auth':_0x434afe,'json':!![]};logger['info']('['+[_0x4a4855[_0x4c1b('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x574b7d);return rp(_0x574b7d)['then'](function(_0x2227ab){logger[_0x4c1b('0x1a')]('['+[_0x4a4855['toUpperCase']()]+_0x4c1b('0x1b'),_0x2227ab);if(_0x2227ab['result'][_0x4c1b('0x1c')]>0x0&&String(_0x2227ab[_0x4c1b('0xf')][0x0]['active'])===_0x4c1b('0x1d')){_0x3f26ef[_0x4c1b('0x1e')]=_0x2227ab[_0x4c1b('0xf')][0x0]['sys_id'];}else{_0x3f26ef[_0x4c1b('0x1e')]=_0x3f26ef[_0x4c1b('0x10')];_0x3f26ef[_0x4c1b('0x18')]=_0x3f26ef[_0x4c1b('0x1f')];}logger[_0x4c1b('0x1a')]('['+[_0x4a4855[_0x4c1b('0x12')]()]+'],\x20getUser\x20crm',_0x3f26ef);_0x2c6756(_0x3f26ef);})[_0x4c1b('0x13')](function(_0x4cac1e){logger[_0x4c1b('0x14')]('['+[_0x4a4855[_0x4c1b('0x12')]()]+']',_0x4cac1e[_0x4c1b('0x15')]);_0x413b7a(_0x4cac1e[_0x4c1b('0x15')]);});}else{logger[_0x4c1b('0x1a')]('['+[_0x4a4855[_0x4c1b('0x12')]()]+_0x4c1b('0x20'));_0x3f26ef[_0x4c1b('0x1e')]=_0x3f26ef['adminId'];_0x3f26ef[_0x4c1b('0x18')]=_0x3f26ef[_0x4c1b('0x1f')];_0x2c6756(_0x3f26ef);}});};}function createEndUser(_0x450822,_0x86c691,_0x221ea6,_0x3d8f29,_0x5e1fab){logger['info']('['+[_0x450822[_0x4c1b('0x12')]()]+_0x4c1b('0x21'),_0x221ea6);return new Promise(function(_0x3bcc3a,_0x4767ff){var _0x5d80fe={'method':'POST','uri':_0x3d8f29+_0x4c1b('0x22')+_0x5e1fab,'body':{'user_name':_0x221ea6[_0x4c1b('0x23')],'roles':_0x4c1b('0x24'),'first_name':_0x221ea6[_0x4c1b('0x23')],'active':_0x4c1b('0x1d'),'date_format':_0x4c1b('0x25'),'phone':_0x221ea6['endUserNumber']},'auth':_0x86c691,'json':!![]};return rp(_0x5d80fe)['then'](function(_0x494abe){logger[_0x4c1b('0x1a')]('['+[_0x450822[_0x4c1b('0x12')]()]+_0x4c1b('0x26'),_0x494abe[_0x4c1b('0xf')]);_0x221ea6['endUserId']=_0x494abe[_0x4c1b('0xf')][_0x4c1b('0x11')];_0x3bcc3a(_0x221ea6);})[_0x4c1b('0x13')](function(_0x4d8c24){logger[_0x4c1b('0x14')]('['+[_0x450822[_0x4c1b('0x12')]()]+']',_0x4d8c24[_0x4c1b('0x15')]);_0x4767ff(_0x4d8c24[_0x4c1b('0x15')]);});});}function getEndUser(_0x5c9709,_0x5ed273,_0x3b0233,_0x524096,_0x71210b){return function(_0x475cc7){logger[_0x4c1b('0x1a')]('['+[_0x5c9709[_0x4c1b('0x12')]()]+_0x4c1b('0x27'),_0x475cc7);return new Promise(function(_0x27214a,_0x4bc566){var _0x111c8c={'method':_0x4c1b('0xc'),'uri':_0x3b0233+'sys_user?sysparm_query=phone%3D'+_0x475cc7[_0x4c1b('0x23')]+'&'+_0x524096+'&'+_0x71210b,'auth':_0x5ed273,'json':!![]};return rp(_0x111c8c)['then'](function(_0x1a6da0){if(_0x1a6da0[_0x4c1b('0xf')][_0x4c1b('0x1c')]>0x0){_0x475cc7['endUserId']=_0x1a6da0[_0x4c1b('0xf')][0x0]['sys_id'];logger[_0x4c1b('0x1a')]('['+[_0x5c9709[_0x4c1b('0x12')]()]+_0x4c1b('0x28'),_0x475cc7);_0x27214a(_0x475cc7);}else{return createEndUser(_0x5c9709,_0x5ed273,_0x475cc7,_0x3b0233,_0x524096)['then'](function(_0x225eaf){logger[_0x4c1b('0x1a')]('['+[_0x5c9709['toUpperCase']()]+_0x4c1b('0x29'),_0x225eaf);_0x27214a(_0x225eaf);});}})['catch'](function(_0x2f6685){logger[_0x4c1b('0x14')]('['+[_0x5c9709['toUpperCase']()]+']',_0x2f6685[_0x4c1b('0x15')]);_0x4bc566(_0x2f6685[_0x4c1b('0x15')]);});});};}function getCustomFields(_0x364524,_0x3d01f1){var _0x25250a={};if(_0x364524['length']>0x0){_[_0x4c1b('0x2a')](_0x364524,function(_0x1064d3){if(_[_0x4c1b('0x2b')]([_0x4c1b('0x2c'),_0x4c1b('0x2d')],_0x1064d3[_0x4c1b('0x2e')])&&_0x1064d3[_0x4c1b('0x2f')]&&!_0x1064d3['customField']){_0x25250a[_0x1064d3[_0x4c1b('0x2f')][_0x4c1b('0x30')]()]=_0x1064d3[_0x4c1b('0x31')][_0x4c1b('0x32')]();}else if(_[_0x4c1b('0x2b')]([_0x4c1b('0x2c'),_0x4c1b('0x2d')],_0x1064d3['type'])&&_0x1064d3[_0x4c1b('0x33')]&&_0x1064d3[_0x4c1b('0x34')]){_0x25250a[_0x1064d3[_0x4c1b('0x33')][_0x4c1b('0x30')]()]=_0x1064d3[_0x4c1b('0x31')][_0x4c1b('0x32')]();}else if(_0x1064d3[_0x4c1b('0x2e')]===_0x4c1b('0x35')&&_0x1064d3[_0x4c1b('0x36')]&&_0x1064d3[_0x4c1b('0x33')]&&_0x1064d3['customField']){_0x25250a[_0x1064d3[_0x4c1b('0x33')][_0x4c1b('0x30')]()]=_0x3d01f1[_0x1064d3['variableName']][_0x4c1b('0x32')]();}else if(_0x1064d3[_0x4c1b('0x2e')]===_0x4c1b('0x37')&&_0x1064d3[_0x4c1b('0x38')]&&_0x1064d3[_0x4c1b('0x38')][_0x4c1b('0x39')]&&_0x1064d3[_0x4c1b('0x33')]&&_0x1064d3['customField']){_0x25250a[_0x1064d3[_0x4c1b('0x33')][_0x4c1b('0x30')]()]=_0x3d01f1[_0x1064d3[_0x4c1b('0x38')]['name']['toLowerCase']()][_0x4c1b('0x32')]();}});}return _0x25250a;}function getTicket(_0x1190e3,_0x3f8c18,_0x1f4391,_0x2e2069,_0x2df264,_0x4e60c0){return function(_0x476de6){logger[_0x4c1b('0x1a')]('['+[_0x1190e3[_0x4c1b('0x12')]()]+_0x4c1b('0x3a'),_0x476de6);return new Promise(function(_0x4093e1,_0x3c80b5){var _0x10dd2c=_0x1190e3[_0x4c1b('0x30')]()===_0x4c1b('0x3b')?_0x476de6[_0x4c1b('0x1e')]:_0x476de6[_0x4c1b('0x3c')];var _0x79d42={'method':'POST','uri':_0x1f4391+'incident'+'?'+_0x4e60c0,'body':Object[_0x4c1b('0x3d')]({},{'active':_0x4c1b('0x1d'),'caller_id':_0x10dd2c,'assigned_to':_0x476de6[_0x4c1b('0x1e')],'short_description':intUtil[_0x4c1b('0x3e')](_0x2e2069[_0x4c1b('0x3f')],_0x2df264,'\x20'),'description':intUtil[_0x4c1b('0x3e')](_0x2e2069[_0x4c1b('0x40')],_0x2df264,'\x0a')},getCustomFields(_0x2e2069[_0x4c1b('0x41')],_0x2df264)),'auth':_0x3f8c18,'json':!![]};return rp(_0x79d42)['then'](function(_0x42ed63){logger['info']('['+[_0x1190e3[_0x4c1b('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x42ed63['result']);_0x476de6[_0x4c1b('0x42')]=_0x42ed63[_0x4c1b('0xf')][_0x4c1b('0x11')];_0x476de6[_0x4c1b('0x43')]=_0x42ed63['result'][_0x4c1b('0x44')];logger['info']('['+[_0x1190e3[_0x4c1b('0x12')]()]+_0x4c1b('0x45'),_0x476de6);_0x4093e1(_0x476de6);})[_0x4c1b('0x13')](function(_0x497386){logger[_0x4c1b('0x14')]('['+[_0x1190e3[_0x4c1b('0x12')]()]+']',_0x497386['message']);_0x3c80b5(_0x497386[_0x4c1b('0x15')]);});});};}function createRemoteTag(_0x36aea4,_0x34e7ad,_0x4f30a7,_0x3f767e){return new Promise(function(_0x2f8a3a,_0x24baeb){var _0x21de58={'method':_0x4c1b('0x46'),'uri':_0x4f30a7+_0x4c1b('0x47')+'?'+_0x3f767e,'body':{'short_description':_0x36aea4,'global':!![],'active':!![],'name':_0x36aea4},'auth':_0x34e7ad,'json':!![]};return rp(_0x21de58)[_0x4c1b('0xe')](function(_0x2023d4){var _0x5488a1=_0x2023d4[_0x4c1b('0xf')][_0x4c1b('0x11')];_0x2f8a3a(_0x5488a1);});});}function getRemoteTag(_0x29418c,_0x4cc1c6,_0x51c3eb,_0x43caa3,_0x19c281){return new Promise(function(_0x1c46f6,_0x3ed244){var _0x1e45d2={'method':_0x4c1b('0xc'),'uri':_0x51c3eb+_0x4c1b('0x47')+_0x4c1b('0x48')+_0x29418c+'&'+_0x43caa3,'auth':_0x4cc1c6,'json':!![]};return rp(_0x1e45d2)[_0x4c1b('0xe')](function(_0x47b6f7){if(_0x47b6f7[_0x4c1b('0xf')][_0x4c1b('0x1c')]>0x0){var _0x3f1f46=_0x47b6f7[_0x4c1b('0xf')][0x0][_0x4c1b('0x11')];_0x1c46f6(_0x3f1f46);}else{return createRemoteTag(_0x29418c,_0x4cc1c6,_0x51c3eb,_0x43caa3)['then'](function(_0xf74024){_0x1c46f6(_0xf74024);});}});});}function assignTagToIncident(_0x42a6f5,_0x10e925,_0x3bd4c5,_0x8546bd,_0x10f254){return new Promise(function(_0x389919,_0x151811){var _0x244092={'method':_0x4c1b('0x46'),'uri':_0x3bd4c5+_0x4c1b('0x49')+'?'+_0x10f254,'body':{'label':_0x42a6f5,'table':'incident','id_type':_0x4c1b('0x4a'),'table_key':_0x8546bd['ticketId'],'title':'Incident\x20-\x20'+_0x8546bd[_0x4c1b('0x43')],'id_display':_0x8546bd['ticketNumber']},'auth':_0x10e925,'json':!![]};return rp(_0x244092)[_0x4c1b('0xe')](function(_0x5e8b5f){_0x389919();})['catch'](function(){_0x389919();});});}function manageTags(_0x41f934,_0x4dbbfd,_0xf45abd,_0x18ba47,_0x19936e,_0x4b7e9b,_0x53519a){return new Promise(function(_0x6ce271,_0x4c6733){var _0x1304a5=[];_0x4dbbfd[_0x4c1b('0x2a')](function(_0x494f33){_0x1304a5['push'](getRemoteTag(_0x494f33,_0xf45abd,_0x18ba47,_0x4b7e9b,_0x53519a));});return Promise[_0x4c1b('0x4b')](_0x1304a5)[_0x4c1b('0xe')](function(_0x5219a0){if(_0x5219a0['length']){logger[_0x4c1b('0x1a')]('['+[_0x41f934[_0x4c1b('0x12')]()]+_0x4c1b('0x4c'),_0x5219a0);var _0x1e3f18=[];_0x5219a0[_0x4c1b('0x2a')](function(_0x4437bb){_0x1e3f18['push'](assignTagToIncident(_0x4437bb,_0xf45abd,_0x18ba47,_0x19936e,_0x4b7e9b));});return Promise[_0x4c1b('0x4b')](_0x1e3f18)[_0x4c1b('0xe')](function(){_0x6ce271();})[_0x4c1b('0x13')](function(){_0x6ce271();});}else{_0x6ce271();}});});}function getTags(_0x3ecc79,_0x598757,_0x11ba13,_0x5132b2,_0x4baf4c,_0x2b8d33){return function(_0x3a7abc){return new Promise(function(_0x3705c6,_0x3ffe2b){var _0x4c4c22=[];var _0x4f235e=_0x5132b2[_0x4c1b('0x4d')];if(_0x4f235e&&_0x4f235e[_0x4c1b('0x1c')]>0x0){_0x4c4c22=_[_0x4c1b('0x4e')](_0x4f235e,_0x4c1b('0x39'));}if(_0x4c4c22['length']>0x0){return manageTags(_0x3ecc79,_0x4c4c22,_0x598757,_0x11ba13,_0x3a7abc,_0x4baf4c,_0x2b8d33)[_0x4c1b('0xe')](function(){_0x3705c6(_0x3a7abc);});}else{_0x3705c6(_0x3a7abc);}});};}function emit(_0x3d2969,_0x22669f,_0x31b5dd){var _0x4a4fd2=_0x4c1b('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x4c1b('0x50')+'%255EORDERBYDESCnumber';var _0x146be4={'uri':_0x3d2969+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x31b5dd+_0x4a4fd2};io['to'](util['format']('user:%s',_0x22669f))[_0x4c1b('0x51')](_0x4c1b('0x52'),_0x146be4);}exports['cs']=function(_0x1163c8,_0x52f64d,_0xa0f5d8,_0x1d9327,_0x31e595,_0x29c8bc,_0x4f6058,_0x498851){var _0x1412a5={};var _0x5e2ce8={'user':_0x29c8bc[_0x4c1b('0x53')],'pass':_0x29c8bc['password']};var _0x215c82='sysparm_limit=1';var _0x56d79d=_0x4c1b('0x54');_0x29c8bc[_0x4c1b('0x55')]=intUtil[_0x4c1b('0x56')](_0x29c8bc[_0x4c1b('0x55')]);_0x29c8bc[_0x4c1b('0x57')]=intUtil[_0x4c1b('0x56')](_0x29c8bc['serverUrl']);var _0x349e6e=util[_0x4c1b('0x58')]('%s/api/now/table/',_0x29c8bc[_0x4c1b('0x55')]);_0x1412a5[_0x4c1b('0x18')]=!_[_0x4c1b('0x59')](_0x1d9327)?_0x1d9327['email']:null;_0x1412a5[_0x4c1b('0x1f')]=_0x29c8bc[_0x4c1b('0x5a')];_0x1412a5[_0x4c1b('0x23')]=_0x498851['toLowerCase']()===_0x4c1b('0x3b')?_0x52f64d[_0x4c1b('0x5b')]:_0x52f64d[_0x4c1b('0x5c')];_0x1412a5['callDirection']=_0x498851===_0x4c1b('0x5d')||_0x498851===_0x4c1b('0x5e')?_0x4c1b('0x5d'):_0x4c1b('0x3b');var _0x5b68ac=util[_0x4c1b('0x58')](_0x4c1b('0x5f'),_0x29c8bc[_0x4c1b('0x57')],_0x52f64d[_0x4c1b('0x60')],md5(_0x52f64d[_0x4c1b('0x60')]));if(_0x31e595&&_0x31e595[_0x4c1b('0x61')]){logger[_0x4c1b('0x1a')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52f64d['recordingURL']=_0x5b68ac;}else if(_0x4f6058&&_0x4f6058['recordingFormat']&&_0x4f6058[_0x4c1b('0x62')]!==_0x4c1b('0x63')){logger[_0x4c1b('0x1a')](_0x4c1b('0x64'),_0x4c1b('0x65'));_0x52f64d['recordingURL']=_0x5b68ac;}else{_0x52f64d[_0x4c1b('0x66')]='';}return getAdminUser(_0x498851,_0x5e2ce8,_0x1412a5,_0x349e6e,_0x56d79d,_0x215c82)[_0x4c1b('0xe')](getUser(_0x498851,_0x5e2ce8,_0x349e6e,_0x56d79d,_0x215c82))[_0x4c1b('0xe')](getEndUser(_0x498851,_0x5e2ce8,_0x349e6e,_0x56d79d,_0x215c82))['then'](getTicket(_0x498851,_0x5e2ce8,_0x349e6e,_0xa0f5d8,_0x52f64d,_0x56d79d))['then'](function(_0xb7c752){logger['info'](util[_0x4c1b('0x58')](_0x4c1b('0x67'),_0xb7c752[_0x4c1b('0x42')]));logger[_0x4c1b('0x1a')](util[_0x4c1b('0x58')](_0x4c1b('0x68'),_0x498851));if(_0x498851!==_0x4c1b('0x5e')){logger[_0x4c1b('0x1a')]('['+[_0x498851['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x29c8bc[_0x4c1b('0x55')],_0x1d9327['name'],_0xb7c752['ticketId']);}})[_0x4c1b('0x13')](function(_0x561749){logger['error']('['+[_0x498851[_0x4c1b('0x12')]()]+_0x4c1b('0x69'),util[_0x4c1b('0x6a')](_0x561749,{'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 4efffbe..2018476 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 _0x5481=['POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20Enduser\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','error','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_minutes','parent_id','parent_type','Contacts','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','customField','content','string','variable','customVariable','Variable'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x5481,0x19d));var _0x1548=function(_0x46ac04,_0x2e6b08){_0x46ac04=_0x46ac04-0x0;var _0x3190eb=_0x5481[_0x46ac04];return _0x3190eb;};'use strict';var _=require(_0x1548('0x0'));var rp=require(_0x1548('0x1'));var BPromise=require(_0x1548('0x2'));var md5=require(_0x1548('0x3'));var util=require(_0x1548('0x4'));var Redis=require(_0x1548('0x5'));var intUtil=require(_0x1548('0x6'));var config=require(_0x1548('0x7'));var logger=require(_0x1548('0x8'))(_0x1548('0x9'));config[_0x1548('0xa')]=_[_0x1548('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1548('0xc'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x20e774,_0x1ed1ac,_0x56c491){io['to'](_0x20e774)[_0x1548('0xd')](_0x1ed1ac,_0x56c491);}function getTicket(_0x5c3228,_0x2ab173,_0x5dc7f9,_0x558849,_0x158399,_0x1e1f5e,_0x1e35a1,_0x2c1277){logger[_0x1548('0xe')](_0x1548('0xf'));var _0xd35de8=new Date();var _0xc9cb93=[{'name':'name','value':intUtil[_0x1548('0x10')](_0x558849['Subjects'],_0x158399,'\x20')},{'name':_0x1548('0x11'),'value':_0x2ab173['id']},{'name':_0x1548('0x12'),'value':_0x2ab173['id']},{'name':_0x1548('0x13'),'value':intUtil[_0x1548('0x10')](_0x558849[_0x1548('0x14')],_0x158399,'\x0a')},{'name':'date_start','value':_0xd35de8['toISOString']()[_0x1548('0x15')](0x0,0x13)[_0x1548('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x1548('0x17'),'value':'15'},{'name':_0x1548('0x18'),'value':_0x5dc7f9['id']},{'name':_0x1548('0x19'),'value':_0x1548('0x1a')},{'name':'parent_name','value':_0x5dc7f9[_0x1548('0x1b')]},{'name':_0x1548('0x1c'),'value':_0x2c1277}];if(_0x1e1f5e[_0x1548('0x1d')]){_[_0x1548('0x1e')](_0x1e1f5e,function(_0x274d70){if(_0x158399[_0x274d70[_0x1548('0x1f')]]){_0xc9cb93[_0x1548('0x20')]({'name':_0x274d70[_0x1548('0x21')],'value':_0x158399[_0x274d70[_0x1548('0x1f')]]});}});}return request({'form':{'method':_0x1548('0x22'),'input_type':_0x1548('0x23'),'response_type':_0x1548('0x23'),'rest_data':JSON[_0x1548('0x24')]({'session':_0x1e35a1['id'],'module_name':_0x1548('0x25'),'name_value_list':_0xc9cb93})}});}function getAuth(_0x162fda){return util[_0x1548('0x26')](_0x1548('0x27'),new Buffer(_0x162fda[_0x1548('0x28')]+':X')[_0x1548('0x29')](_0x1548('0x2a')));}function getServerInfo(_0x274557){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x1548('0x23'),'rest_data':JSON['stringify']({'session':_0x274557['id']})}});}function getUser(_0xaf6fff,_0x33573e,_0x249b69){if(!_[_0x1548('0x2b')](_0x33573e)){logger[_0x1548('0xe')](_0x1548('0x2c'),_0x33573e);return request({'form':{'method':_0x1548('0x2d'),'input_type':_0x1548('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x249b69['id'],'module_name':_0x1548('0x2e'),'query':util[_0x1548('0x26')](_0x1548('0x2f'),_0x33573e),'order_by':'','offset':'0','select_fields':['id','name',_0x1548('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4837db){if(_0x4837db[_0x1548('0x31')]['length']){var _0x375b89=_[_0x1548('0x32')](_0x4837db[_0x1548('0x31')],function(_0x4384f8){return _0x4384f8['name_value_list'][_0x1548('0x30')]['value']===_0x33573e;});if(_0x375b89){logger['info']('Agent\x20found!');return BPromise[_0x1548('0x33')]({'id':_0x375b89[_0x1548('0x34')]['id'][_0x1548('0x35')],'name':_0x375b89[_0x1548('0x34')][_0x1548('0x1b')]['value']});}}logger['info'](_0x1548('0x36'));return BPromise[_0x1548('0x33')]({'id':_0x249b69[_0x1548('0x34')][_0x1548('0x37')][_0x1548('0x35')],'name':_0x249b69[_0x1548('0x34')]['user_name']['value']});});}else{logger[_0x1548('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1548('0x33')]({'id':_0x249b69[_0x1548('0x34')][_0x1548('0x37')]['value'],'name':_0x249b69[_0x1548('0x34')][_0x1548('0x30')]['value']});}}function getEndUser(_0xe608c2,_0x2efc8c,_0x3e8f91,_0x50a625){logger[_0x1548('0xe')]('Searching\x20enduser\x20with\x20phone',_0x3e8f91);return request({'form':{'method':_0x1548('0x2d'),'input_type':_0x1548('0x23'),'response_type':_0x1548('0x23'),'rest_data':JSON[_0x1548('0x24')]({'session':_0x50a625['id'],'module_name':'Contacts','query':util[_0x1548('0x26')](_0x1548('0x38'),_0x3e8f91),'order_by':'','offset':'0','select_fields':['id',_0x1548('0x1b'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1548('0x39')](function(_0x53fd83){if(_0x53fd83['entry_list']['length']){var _0x42b02b=_[_0x1548('0x32')](_0x53fd83[_0x1548('0x31')],function(_0x2d9bd6){return _0x2d9bd6['name_value_list'][_0x1548('0x3a')][_0x1548('0x35')]===_0x3e8f91;});if(_0x42b02b){logger[_0x1548('0xe')](_0x1548('0x3b'));return BPromise[_0x1548('0x33')]({'id':_0x42b02b['name_value_list']['id'][_0x1548('0x35')],'name':_0x42b02b[_0x1548('0x34')][_0x1548('0x1b')][_0x1548('0x35')],'phone':_0x42b02b[_0x1548('0x34')][_0x1548('0x3a')][_0x1548('0x35')]});}}else{logger[_0x1548('0xe')](_0x1548('0x3c'));return request({'form':{'method':'set_entry','input_type':_0x1548('0x23'),'response_type':'JSON','rest_data':JSON[_0x1548('0x24')]({'session':_0x50a625['id'],'module_name':_0x1548('0x1a'),'name_value_list':[{'name':'first_name','value':_0x2efc8c!==_0x1548('0x3d')?_0x2efc8c:util['format'](_0x1548('0x3e'),_0x3e8f91)},{'name':_0x1548('0x3a'),'value':_0x3e8f91}]})}})[_0x1548('0x39')](function(_0x27633b){logger[_0x1548('0xe')](_0x1548('0x3f'));return BPromise['resolve']({'id':_0x27633b['id'],'name':_0x27633b['entry_list']['first_name']['value'],'phone':_0x27633b['entry_list'][_0x1548('0x3a')][_0x1548('0x35')]});});}});}function request(_0x5ff782){logger[_0x1548('0x40')](_0x1548('0x41'),JSON['stringify'](_0x5ff782));return rp(_[_0x1548('0x42')](def,_0x5ff782));}function getTags(_0x57e23b,_0x5606e4){var _0x2767a0=[];if(_0x57e23b&&_0x57e23b[_0x1548('0x1d')]>0x0){_0x2767a0=_['map'](_0x57e23b,_0x5606e4);}return _0x2767a0;}function getCustomFields(_0x1c49c5,_0x45a74f){var _0x9e11ab=[];var _0x24f279={'custom_fields':[]};if(_0x1c49c5[_0x1548('0x1d')]>0x0){_[_0x1548('0x1e')](_0x1c49c5,function(_0x19e5c4){if(_0x19e5c4[_0x1548('0x43')]==='string'&&_0x19e5c4[_0x1548('0x44')]&&!_0x19e5c4[_0x1548('0x45')]){_0x24f279[_0x19e5c4['nameField']['toLowerCase']()]=_0x19e5c4[_0x1548('0x46')]['toString']();}else if(_0x19e5c4[_0x1548('0x43')]===_0x1548('0x47')&&_0x19e5c4[_0x1548('0x21')]&&_0x19e5c4[_0x1548('0x45')]){_0x24f279['custom_fields'][_0x1548('0x20')]({'id':_0x19e5c4['idField'],'value':_0x19e5c4[_0x1548('0x46')][_0x1548('0x29')]()});}else if(_0x19e5c4[_0x1548('0x43')]===_0x1548('0x48')&&_0x19e5c4[_0x1548('0x1f')]&&_0x19e5c4['idField']&&_0x19e5c4[_0x1548('0x45')]){_0x45a74f[_0x19e5c4['variableName']]&&_0x24f279['custom_fields'][_0x1548('0x20')]({'id':_0x19e5c4[_0x1548('0x21')],'value':_0x45a74f[_0x19e5c4[_0x1548('0x1f')]][_0x1548('0x29')]()});}else if(_0x19e5c4[_0x1548('0x43')]===_0x1548('0x49')&&_0x19e5c4[_0x1548('0x4a')]&&_0x19e5c4[_0x1548('0x4a')][_0x1548('0x1b')]&&_0x19e5c4[_0x1548('0x21')]&&_0x19e5c4[_0x1548('0x45')]){_0x45a74f[_0x19e5c4[_0x1548('0x4a')][_0x1548('0x1b')]['toLowerCase']()]&&_0x24f279['custom_fields'][_0x1548('0x20')]({'id':_0x19e5c4[_0x1548('0x21')],'value':_0x45a74f[_0x19e5c4[_0x1548('0x4a')][_0x1548('0x1b')]['toLowerCase']()][_0x1548('0x29')]()});}});}return _0x24f279;}function getConnection(_0xa876f6){return request({'method':_0x1548('0x4b'),'form':{'method':_0x1548('0x4c'),'input_type':_0x1548('0x23'),'response_type':_0x1548('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xa876f6[_0x1548('0x4d')],'password':_0xa876f6[_0x1548('0x4e')],'encryption':_0x1548('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x1548('0x39')](function(_0x46ccf2){var _0x551687=_0x46ccf2;if(_0x551687['id']){def[_0x1548('0x50')]=_0x551687['id'];return BPromise[_0x1548('0x33')](_0x551687);}else{throw new Error(util[_0x1548('0x26')](_0x1548('0x51'),_0xa876f6['id']));}});}function setRelationship(_0x7393c1,_0x4f42a,_0x3af588,_0x24eba6){return request({'form':{'method':_0x1548('0x52'),'input_type':_0x1548('0x23'),'response_type':_0x1548('0x23'),'rest_data':JSON['stringify']({'session':_0x7393c1['id'],'module_name':_0x1548('0x25'),'module_id':_0x3af588['id'],'link_field_name':_0x24eba6,'related_ids':[_0x4f42a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1548('0x53')]=function(_0xfefa67,_0x56228f,_0x31914e,_0x5751e2,_0x7a431a,_0x55b68b){var _0x1f73af,_0x560dde,_0xedf445,_0x35bef8;_0x55b68b[_0x1548('0x54')]=intUtil[_0x1548('0x55')](_0x55b68b['remoteUri']);_0x55b68b[_0x1548('0x56')]=intUtil['stripTrailingSlash'](_0x55b68b[_0x1548('0x56')]);def[_0x1548('0x57')]=util['format'](_0x1548('0x58'),_0x55b68b[_0x1548('0x54')]);if(_0x7a431a&&_0x7a431a[_0x1548('0x59')]){logger[_0x1548('0xe')](_0x1548('0x5a'),'Recording\x20is\x20enabled!');_0x56228f['recordingURL']=util[_0x1548('0x26')](_0x1548('0x5b'),_0x55b68b[_0x1548('0x56')],_0x56228f[_0x1548('0x5c')],md5(_0x56228f[_0x1548('0x5c')]));}else{_0x56228f[_0x1548('0x5d')]='';}return getConnection(_0x55b68b)[_0x1548('0x39')](function(_0x5a9433){_0x35bef8=_0x5a9433;return getUser(_0x55b68b,_0x5751e2[_0x1548('0x1b')],_0x35bef8);})[_0x1548('0x39')](function(_0x54bbd1){_0x1f73af=_0x54bbd1;logger[_0x1548('0xe')]('The\x20User\x20ID\x20is:',_0x1f73af['id']);return getEndUser(_0x55b68b,_0x56228f['calleridname'],_0x56228f['calleridnum'],_0x35bef8);})['then'](function(_0x3f9473){_0x560dde=_0x3f9473;logger['info'](_0x1548('0x5e'),_0x560dde['id']);return getTicket(_0x55b68b,_0x1f73af,_0x560dde,_0x31914e,_0x56228f,_0x31914e['Fields'],_0x35bef8,'Inbound');})['then'](function(_0x2be968){_0xedf445=_0x2be968;logger['info']('Ticket\x20created!');logger[_0x1548('0xe')]('The\x20Ticket\x20ID\x20is:',_0xedf445['id']);return setRelationship(_0x35bef8,_0x1f73af,_0xedf445,_0x1548('0x5f'));})[_0x1548('0x39')](function(){return setRelationship(_0x35bef8,_0x560dde,_0xedf445,_0x1548('0x60'));})[_0x1548('0x39')](function(){return getServerInfo(_0x35bef8);})['then'](function(_0x4f3b37){var _0x5cad5a=parseInt(_0x4f3b37['version'][_0x1548('0x61')](0x0));var _0x4c13c6=util[_0x1548('0x26')](_0x1548('0x62'),_0x55b68b[_0x1548('0x54')],_0xedf445['id']);if(_0x5cad5a>0x6){_0x4c13c6=util[_0x1548('0x26')](_0x1548('0x63'),_0x55b68b['remoteUri'],_0xedf445['id']);}logger[_0x1548('0xe')](_0x1548('0x5a'),_0x1548('0x64'));emit(util[_0x1548('0x26')](_0x1548('0x65'),_0x5751e2['name']),_0x1548('0x66'),{'uri':_0x4c13c6});})[_0x1548('0x67')](function(_0x15f80a){logger['error'](_0x1548('0x5a'),JSON[_0x1548('0x24')](_0x15f80a));});};exports[_0x1548('0x68')]=function(_0x1ad407,_0x3eb9ca,_0x52caf7,_0x2a22a4,_0x2a8ff9,_0x14dab6,_0x121e74){var _0x140cac,_0x395d33,_0x3a7ae9,_0x5031cc;_0x14dab6[_0x1548('0x54')]=intUtil['stripTrailingSlash'](_0x14dab6['remoteUri']);_0x14dab6[_0x1548('0x56')]=intUtil[_0x1548('0x55')](_0x14dab6[_0x1548('0x56')]);def[_0x1548('0x57')]=util[_0x1548('0x26')]('%s/service/v4_1/rest.php',_0x14dab6[_0x1548('0x54')]);if(_0x121e74&&_0x121e74[_0x1548('0x69')]&&_0x121e74['recordingFormat']!==_0x1548('0x6a')){logger[_0x1548('0xe')](_0x1548('0x6b'),'Recording\x20is\x20enabled!');_0x3eb9ca['recordingURL']=util[_0x1548('0x26')](_0x1548('0x5b'),_0x14dab6[_0x1548('0x56')],_0x3eb9ca[_0x1548('0x5c')],md5(_0x3eb9ca[_0x1548('0x5c')]));}return getConnection(_0x14dab6)[_0x1548('0x39')](function(_0x485908){_0x5031cc=_0x485908;return getUser(_0x14dab6,_0x2a22a4['name'],_0x5031cc);})[_0x1548('0x39')](function(_0x5bed9b){_0x140cac=_0x5bed9b;logger[_0x1548('0xe')](_0x1548('0x6c'),_0x140cac['id']);return getEndUser(_0x14dab6,_0x3eb9ca[_0x1548('0x6d')],_0x3eb9ca[_0x1548('0x6e')],_0x5031cc);})[_0x1548('0x39')](function(_0x304e96){_0x395d33=_0x304e96;logger[_0x1548('0xe')]('The\x20Enduser\x20ID\x20is:',_0x395d33['id']);return getTicket(_0x14dab6,_0x140cac,_0x395d33,_0x52caf7,_0x3eb9ca,_0x52caf7['Fields'],_0x5031cc,_0x1548('0x6f'));})[_0x1548('0x39')](function(_0x330463){_0x3a7ae9=_0x330463;logger['info'](_0x1548('0x70'));logger['info'](_0x1548('0x71'),_0x3a7ae9['id']);return setRelationship(_0x5031cc,_0x140cac,_0x3a7ae9,_0x1548('0x5f'));})[_0x1548('0x39')](function(){return setRelationship(_0x5031cc,_0x395d33,_0x3a7ae9,_0x1548('0x60'));})[_0x1548('0x39')](function(){return getServerInfo(_0x5031cc);})[_0x1548('0x39')](function(_0x3de52f){var _0xa39a0f=parseInt(_0x3de52f[_0x1548('0x72')][_0x1548('0x61')](0x0));var _0x252e4d=util[_0x1548('0x26')](_0x1548('0x62'),_0x14dab6['remoteUri'],_0x3a7ae9['id']);if(_0xa39a0f>0x6){_0x252e4d=util[_0x1548('0x26')](_0x1548('0x63'),_0x14dab6['remoteUri'],_0x3a7ae9['id']);}logger[_0x1548('0xe')](_0x1548('0x6b'),_0x1548('0x64'));emit(util[_0x1548('0x26')](_0x1548('0x65'),_0x2a22a4[_0x1548('0x1b')]),_0x1548('0x66'),{'uri':_0x252e4d});})[_0x1548('0x67')](function(_0x326d0e){logger[_0x1548('0x73')](_0x1548('0x6b'),JSON[_0x1548('0x24')](_0x326d0e));});};exports[_0x1548('0x74')]=function(_0x467509,_0x305efa,_0x42d786,_0x5b2989,_0x16b7c2,_0x293e09){var _0x57e36d,_0x3f2748,_0x2107b4,_0xcd7306;_0x293e09[_0x1548('0x54')]=intUtil[_0x1548('0x55')](_0x293e09[_0x1548('0x54')]);_0x293e09[_0x1548('0x56')]=intUtil['stripTrailingSlash'](_0x293e09['serverUrl']);def[_0x1548('0x57')]=util['format'](_0x1548('0x58'),_0x293e09['remoteUri']);if(_0x16b7c2&&_0x16b7c2[_0x1548('0x59')]){logger['info']('['+_0x305efa[_0x1548('0x75')][_0x1548('0x76')]()+']',_0x1548('0x77'));_0x305efa[_0x1548('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x293e09[_0x1548('0x56')],_0x305efa['uniqueid'],md5(_0x305efa[_0x1548('0x5c')]));}else{_0x305efa['recordingURL']='';}return getConnection(_0x293e09)['then'](function(_0x505d7c){_0xcd7306=_0x505d7c;if(!_['isNil'](_0x5b2989)){return getUser(_0x293e09,_0x5b2989['name'],_0xcd7306);}else{return getUser(_0x293e09,null,_0xcd7306);}})['then'](function(_0x5111cc){_0x57e36d=_0x5111cc;logger[_0x1548('0xe')](_0x1548('0x6c'),_0x57e36d['id']);return getEndUser(_0x293e09,_0x305efa[_0x1548('0x78')],_0x305efa['calleridnum'],_0xcd7306);})[_0x1548('0x39')](function(_0xa549b2){_0x3f2748=_0xa549b2;logger['info'](_0x1548('0x5e'),_0x3f2748['id']);return getTicket(_0x293e09,_0x57e36d,_0x3f2748,_0x42d786,_0x305efa,_0x42d786[_0x1548('0x79')],_0xcd7306,'Inbound');})[_0x1548('0x39')](function(_0x3729b3){_0x2107b4=_0x3729b3;logger[_0x1548('0xe')](_0x1548('0x70'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2107b4['id']);return setRelationship(_0xcd7306,_0x57e36d,_0x2107b4,_0x1548('0x5f'));})[_0x1548('0x39')](function(){return setRelationship(_0xcd7306,_0x3f2748,_0x2107b4,_0x1548('0x60'));})[_0x1548('0x39')](function(){return getServerInfo(_0xcd7306);})[_0x1548('0x67')](function(_0x3d5414){logger[_0x1548('0x73')]('['+_0x305efa[_0x1548('0x75')]['toUpperCase']()+']',JSON[_0x1548('0x24')](_0x3d5414));});}; \ No newline at end of file +var _0x8553=['password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','version','user:%s','catch','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','name','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','info','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','format','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','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','variable','Variable','custom_fields','login'];(function(_0x152a57,_0x2f062f){var _0x3ed07e=function(_0x114e36){while(--_0x114e36){_0x152a57['push'](_0x152a57['shift']());}};_0x3ed07e(++_0x2f062f);}(_0x8553,0x18e));var _0x3855=function(_0x49831e,_0x477ff4){_0x49831e=_0x49831e-0x0;var _0x52a888=_0x8553[_0x49831e];return _0x52a888;};'use strict';var _=require(_0x3855('0x0'));var rp=require(_0x3855('0x1'));var BPromise=require(_0x3855('0x2'));var md5=require(_0x3855('0x3'));var util=require(_0x3855('0x4'));var Redis=require(_0x3855('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x3855('0x6'))(_0x3855('0x7'));config[_0x3855('0x8')]=_[_0x3855('0x9')](config[_0x3855('0x8')],{'host':_0x3855('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3855('0x8')]));var def={'method':_0x3855('0xb'),'json':!![]};function emit(_0x2afe01,_0x59ea59,_0x100656){io['to'](_0x2afe01)['emit'](_0x59ea59,_0x100656);}function getTicket(_0x5f3c63,_0x4d3cb8,_0x21458c,_0x1f99b4,_0x2f8f32,_0x2e8ee6,_0x5736d6,_0x6cdf69){logger['info']('Creating\x20new\x20ticket...');var _0x10eee5=new Date();var _0x59477d=[{'name':_0x3855('0xc'),'value':intUtil['getString'](_0x1f99b4[_0x3855('0xd')],_0x2f8f32,'\x20')},{'name':'assigned_user_id','value':_0x4d3cb8['id']},{'name':_0x3855('0xe'),'value':_0x4d3cb8['id']},{'name':_0x3855('0xf'),'value':intUtil['getString'](_0x1f99b4[_0x3855('0x10')],_0x2f8f32,'\x0a')},{'name':_0x3855('0x11'),'value':_0x10eee5[_0x3855('0x12')]()[_0x3855('0x13')](0x0,0x13)[_0x3855('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x3855('0x15'),'value':'15'},{'name':_0x3855('0x16'),'value':_0x21458c['id']},{'name':_0x3855('0x17'),'value':_0x3855('0x18')},{'name':_0x3855('0x19'),'value':_0x21458c[_0x3855('0xc')]},{'name':_0x3855('0x1a'),'value':_0x6cdf69}];if(_0x2e8ee6[_0x3855('0x1b')]){_[_0x3855('0x1c')](_0x2e8ee6,function(_0xbc49f0){if(_0x2f8f32[_0xbc49f0[_0x3855('0x1d')]]){_0x59477d[_0x3855('0x1e')]({'name':_0xbc49f0[_0x3855('0x1f')],'value':_0x2f8f32[_0xbc49f0[_0x3855('0x1d')]]});}});}return request({'form':{'method':_0x3855('0x20'),'input_type':'JSON','response_type':_0x3855('0x21'),'rest_data':JSON[_0x3855('0x22')]({'session':_0x5736d6['id'],'module_name':_0x3855('0x23'),'name_value_list':_0x59477d})}});}function getAuth(_0x337662){return util['format'](_0x3855('0x24'),new Buffer(_0x337662[_0x3855('0x25')]+':X')[_0x3855('0x26')](_0x3855('0x27')));}function getServerInfo(_0x2b6a65){return request({'form':{'method':_0x3855('0x28'),'input_type':_0x3855('0x21'),'response_type':_0x3855('0x21'),'rest_data':JSON[_0x3855('0x22')]({'session':_0x2b6a65['id']})}});}function getUser(_0x5c3fa6,_0x2cdf75,_0x3392a6){if(!_[_0x3855('0x29')](_0x2cdf75)){logger['info'](_0x3855('0x2a'),_0x2cdf75);return request({'form':{'method':'get_entry_list','input_type':_0x3855('0x21'),'response_type':_0x3855('0x21'),'rest_data':JSON[_0x3855('0x22')]({'session':_0x3392a6['id'],'module_name':_0x3855('0x2b'),'query':util['format'](_0x3855('0x2c'),_0x2cdf75),'order_by':'','offset':'0','select_fields':['id',_0x3855('0xc'),_0x3855('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3855('0x2e')](function(_0x4de6ee){if(_0x4de6ee['entry_list'][_0x3855('0x1b')]){var _0x5387f8=_['find'](_0x4de6ee[_0x3855('0x2f')],function(_0x11d0c4){return _0x11d0c4[_0x3855('0x30')][_0x3855('0x2d')]['value']===_0x2cdf75;});if(_0x5387f8){logger[_0x3855('0x31')]('Agent\x20found!');return BPromise[_0x3855('0x32')]({'id':_0x5387f8['name_value_list']['id'][_0x3855('0x33')],'name':_0x5387f8['name_value_list'][_0x3855('0xc')][_0x3855('0x33')]});}}logger[_0x3855('0x31')](_0x3855('0x34'));return BPromise[_0x3855('0x32')]({'id':_0x3392a6[_0x3855('0x30')][_0x3855('0x35')][_0x3855('0x33')],'name':_0x3392a6[_0x3855('0x30')][_0x3855('0x2d')][_0x3855('0x33')]});});}else{logger[_0x3855('0x31')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3392a6[_0x3855('0x30')]['user_id'][_0x3855('0x33')],'name':_0x3392a6[_0x3855('0x30')][_0x3855('0x2d')][_0x3855('0x33')]});}}function getEndUser(_0x2773c3,_0x9dc5c7,_0x50fc24,_0x4c1ade){logger[_0x3855('0x31')](_0x3855('0x36'),_0x50fc24);return request({'form':{'method':_0x3855('0x37'),'input_type':'JSON','response_type':_0x3855('0x21'),'rest_data':JSON[_0x3855('0x22')]({'session':_0x4c1ade['id'],'module_name':_0x3855('0x18'),'query':util[_0x3855('0x38')](_0x3855('0x39'),_0x50fc24),'order_by':'','offset':'0','select_fields':['id',_0x3855('0xc'),_0x3855('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3855('0x2e')](function(_0x5ee0a6){if(_0x5ee0a6['entry_list']['length']){var _0x4ed2e5=_['find'](_0x5ee0a6[_0x3855('0x2f')],function(_0x3f17a5){return _0x3f17a5['name_value_list']['phone_home'][_0x3855('0x33')]===_0x50fc24;});if(_0x4ed2e5){logger['info'](_0x3855('0x3b'));return BPromise[_0x3855('0x32')]({'id':_0x4ed2e5[_0x3855('0x30')]['id'][_0x3855('0x33')],'name':_0x4ed2e5['name_value_list']['name'][_0x3855('0x33')],'phone':_0x4ed2e5['name_value_list']['phone_home']['value']});}}else{logger[_0x3855('0x31')](_0x3855('0x3c'));return request({'form':{'method':_0x3855('0x20'),'input_type':_0x3855('0x21'),'response_type':'JSON','rest_data':JSON[_0x3855('0x22')]({'session':_0x4c1ade['id'],'module_name':_0x3855('0x18'),'name_value_list':[{'name':_0x3855('0x3d'),'value':_0x9dc5c7!==_0x3855('0x3e')?_0x9dc5c7:util[_0x3855('0x38')](_0x3855('0x3f'),_0x50fc24)},{'name':_0x3855('0x3a'),'value':_0x50fc24}]})}})[_0x3855('0x2e')](function(_0x1e160d){logger[_0x3855('0x31')](_0x3855('0x40'));return BPromise['resolve']({'id':_0x1e160d['id'],'name':_0x1e160d[_0x3855('0x2f')]['first_name'][_0x3855('0x33')],'phone':_0x1e160d['entry_list'][_0x3855('0x3a')][_0x3855('0x33')]});});}});}function request(_0xc8075){logger[_0x3855('0x41')](_0x3855('0x42'),JSON[_0x3855('0x22')](_0xc8075));return rp(_[_0x3855('0x43')](def,_0xc8075));}function getTags(_0x4f42ba,_0x177ff6){var _0x40d187=[];if(_0x4f42ba&&_0x4f42ba['length']>0x0){_0x40d187=_[_0x3855('0x44')](_0x4f42ba,_0x177ff6);}return _0x40d187;}function getCustomFields(_0x4e3aa2,_0x5f545b){var _0x59a861=[];var _0x54560a={'custom_fields':[]};if(_0x4e3aa2[_0x3855('0x1b')]>0x0){_[_0x3855('0x1c')](_0x4e3aa2,function(_0x5fe712){if(_0x5fe712[_0x3855('0x45')]===_0x3855('0x46')&&_0x5fe712[_0x3855('0x47')]&&!_0x5fe712[_0x3855('0x48')]){_0x54560a[_0x5fe712[_0x3855('0x47')][_0x3855('0x49')]()]=_0x5fe712['content'][_0x3855('0x26')]();}else if(_0x5fe712[_0x3855('0x45')]==='string'&&_0x5fe712[_0x3855('0x1f')]&&_0x5fe712[_0x3855('0x48')]){_0x54560a['custom_fields']['push']({'id':_0x5fe712[_0x3855('0x1f')],'value':_0x5fe712['content'][_0x3855('0x26')]()});}else if(_0x5fe712[_0x3855('0x45')]===_0x3855('0x4a')&&_0x5fe712[_0x3855('0x1d')]&&_0x5fe712[_0x3855('0x1f')]&&_0x5fe712[_0x3855('0x48')]){_0x5f545b[_0x5fe712[_0x3855('0x1d')]]&&_0x54560a['custom_fields']['push']({'id':_0x5fe712[_0x3855('0x1f')],'value':_0x5f545b[_0x5fe712[_0x3855('0x1d')]][_0x3855('0x26')]()});}else if(_0x5fe712[_0x3855('0x45')]==='customVariable'&&_0x5fe712[_0x3855('0x4b')]&&_0x5fe712['Variable'][_0x3855('0xc')]&&_0x5fe712[_0x3855('0x1f')]&&_0x5fe712[_0x3855('0x48')]){_0x5f545b[_0x5fe712[_0x3855('0x4b')][_0x3855('0xc')][_0x3855('0x49')]()]&&_0x54560a[_0x3855('0x4c')][_0x3855('0x1e')]({'id':_0x5fe712['idField'],'value':_0x5f545b[_0x5fe712['Variable'][_0x3855('0xc')]['toLowerCase']()][_0x3855('0x26')]()});}});}return _0x54560a;}function getConnection(_0xe7a2b8){return request({'method':_0x3855('0xb'),'form':{'method':_0x3855('0x4d'),'input_type':_0x3855('0x21'),'response_type':_0x3855('0x21'),'rest_data':JSON[_0x3855('0x22')]({'user_auth':{'user_name':_0xe7a2b8['username'],'password':_0xe7a2b8[_0x3855('0x4e')],'encryption':_0x3855('0x4f')},'application':_0x3855('0x50')})}})['then'](function(_0x3bcbef){var _0x1ff661=_0x3bcbef;if(_0x1ff661['id']){def[_0x3855('0x51')]=_0x1ff661['id'];return BPromise['resolve'](_0x1ff661);}else{throw new Error(util[_0x3855('0x38')]('Account\x20%d\x20is\x20not\x20valid',_0xe7a2b8['id']));}});}function setRelationship(_0x546a05,_0x376250,_0x1b331d,_0x1a99ca){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x3855('0x21'),'rest_data':JSON['stringify']({'session':_0x546a05['id'],'module_name':'Calls','module_id':_0x1b331d['id'],'link_field_name':_0x1a99ca,'related_ids':[_0x376250['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x344f7c,_0x16d115,_0x578896,_0xa95738,_0x50f4f5,_0x4559dd){var _0x3185d7,_0x4f16cd,_0x5bf61a,_0x128e03;_0x4559dd[_0x3855('0x52')]=intUtil[_0x3855('0x53')](_0x4559dd[_0x3855('0x52')]);_0x4559dd[_0x3855('0x54')]=intUtil[_0x3855('0x53')](_0x4559dd[_0x3855('0x54')]);def[_0x3855('0x55')]=util[_0x3855('0x38')]('%s/service/v4_1/rest.php',_0x4559dd['remoteUri']);if(_0x50f4f5&&_0x50f4f5[_0x3855('0x56')]){logger[_0x3855('0x31')](_0x3855('0x57'),'Recording\x20is\x20enabled!');_0x16d115[_0x3855('0x58')]=util['format'](_0x3855('0x59'),_0x4559dd[_0x3855('0x54')],_0x16d115[_0x3855('0x5a')],md5(_0x16d115['uniqueid']));}else{_0x16d115[_0x3855('0x58')]='';}return getConnection(_0x4559dd)['then'](function(_0x5a6335){_0x128e03=_0x5a6335;return getUser(_0x4559dd,_0xa95738[_0x3855('0xc')],_0x128e03);})[_0x3855('0x2e')](function(_0x28e353){_0x3185d7=_0x28e353;logger[_0x3855('0x31')](_0x3855('0x5b'),_0x3185d7['id']);return getEndUser(_0x4559dd,_0x16d115[_0x3855('0x5c')],_0x16d115['calleridnum'],_0x128e03);})[_0x3855('0x2e')](function(_0x347766){_0x4f16cd=_0x347766;logger[_0x3855('0x31')](_0x3855('0x5d'),_0x4f16cd['id']);return getTicket(_0x4559dd,_0x3185d7,_0x4f16cd,_0x578896,_0x16d115,_0x578896[_0x3855('0x5e')],_0x128e03,_0x3855('0x5f'));})[_0x3855('0x2e')](function(_0x417cf6){_0x5bf61a=_0x417cf6;logger[_0x3855('0x31')](_0x3855('0x60'));logger[_0x3855('0x31')](_0x3855('0x61'),_0x5bf61a['id']);return setRelationship(_0x128e03,_0x3185d7,_0x5bf61a,_0x3855('0x62'));})['then'](function(){return setRelationship(_0x128e03,_0x4f16cd,_0x5bf61a,_0x3855('0x63'));})['then'](function(){return getServerInfo(_0x128e03);})[_0x3855('0x2e')](function(_0xd6c5fb){var _0x1b6433=parseInt(_0xd6c5fb['version'][_0x3855('0x64')](0x0));var _0x2ddfcf=util['format'](_0x3855('0x65'),_0x4559dd[_0x3855('0x52')],_0x5bf61a['id']);if(_0x1b6433>0x6){_0x2ddfcf=util[_0x3855('0x38')](_0x3855('0x66'),_0x4559dd[_0x3855('0x52')],_0x5bf61a['id']);}logger[_0x3855('0x31')]('[QUEUE]',_0x3855('0x67'));emit(util[_0x3855('0x38')]('user:%s',_0xa95738['name']),_0x3855('0x68'),{'uri':_0x2ddfcf});})['catch'](function(_0x17ccfd){logger[_0x3855('0x69')](_0x3855('0x57'),JSON[_0x3855('0x22')](_0x17ccfd));});};exports['outbound']=function(_0x50b09b,_0x19754b,_0x1f44c9,_0x145b2e,_0x4c78a6,_0x3dc1ac,_0x47dc7e){var _0x34f075,_0x5979ec,_0x1944e0,_0x49d388;_0x3dc1ac[_0x3855('0x52')]=intUtil['stripTrailingSlash'](_0x3dc1ac[_0x3855('0x52')]);_0x3dc1ac[_0x3855('0x54')]=intUtil[_0x3855('0x53')](_0x3dc1ac[_0x3855('0x54')]);def[_0x3855('0x55')]=util[_0x3855('0x38')]('%s/service/v4_1/rest.php',_0x3dc1ac['remoteUri']);if(_0x47dc7e&&_0x47dc7e[_0x3855('0x6a')]&&_0x47dc7e[_0x3855('0x6a')]!=='none'){logger[_0x3855('0x31')](_0x3855('0x6b'),_0x3855('0x6c'));_0x19754b[_0x3855('0x58')]=util['format'](_0x3855('0x59'),_0x3dc1ac[_0x3855('0x54')],_0x19754b[_0x3855('0x5a')],md5(_0x19754b[_0x3855('0x5a')]));}return getConnection(_0x3dc1ac)[_0x3855('0x2e')](function(_0xdeb88){_0x49d388=_0xdeb88;return getUser(_0x3dc1ac,_0x145b2e[_0x3855('0xc')],_0x49d388);})[_0x3855('0x2e')](function(_0x457395){_0x34f075=_0x457395;logger[_0x3855('0x31')]('The\x20User\x20ID\x20is:',_0x34f075['id']);return getEndUser(_0x3dc1ac,_0x19754b[_0x3855('0x6d')],_0x19754b[_0x3855('0x6e')],_0x49d388);})[_0x3855('0x2e')](function(_0x1fbdcb){_0x5979ec=_0x1fbdcb;logger[_0x3855('0x31')]('The\x20Enduser\x20ID\x20is:',_0x5979ec['id']);return getTicket(_0x3dc1ac,_0x34f075,_0x5979ec,_0x1f44c9,_0x19754b,_0x1f44c9[_0x3855('0x5e')],_0x49d388,'Outbound');})[_0x3855('0x2e')](function(_0x55eec3){_0x1944e0=_0x55eec3;logger[_0x3855('0x31')](_0x3855('0x60'));logger[_0x3855('0x31')](_0x3855('0x61'),_0x1944e0['id']);return setRelationship(_0x49d388,_0x34f075,_0x1944e0,'users');})['then'](function(){return setRelationship(_0x49d388,_0x5979ec,_0x1944e0,_0x3855('0x63'));})['then'](function(){return getServerInfo(_0x49d388);})['then'](function(_0x5b8f51){var _0xc8599e=parseInt(_0x5b8f51[_0x3855('0x6f')][_0x3855('0x64')](0x0));var _0x3472c2=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3dc1ac['remoteUri'],_0x1944e0['id']);if(_0xc8599e>0x6){_0x3472c2=util['format'](_0x3855('0x66'),_0x3dc1ac[_0x3855('0x52')],_0x1944e0['id']);}logger['info'](_0x3855('0x6b'),_0x3855('0x67'));emit(util[_0x3855('0x38')](_0x3855('0x70'),_0x145b2e[_0x3855('0xc')]),_0x3855('0x68'),{'uri':_0x3472c2});})[_0x3855('0x71')](function(_0x2c5a92){logger[_0x3855('0x69')](_0x3855('0x6b'),JSON[_0x3855('0x22')](_0x2c5a92));});};exports[_0x3855('0x72')]=function(_0x563361,_0x152320,_0x2dec92,_0x10077f,_0x292fe8,_0x1d6a95){var _0x572201,_0x490f58,_0x745e70,_0x2dba51;_0x1d6a95['remoteUri']=intUtil['stripTrailingSlash'](_0x1d6a95[_0x3855('0x52')]);_0x1d6a95[_0x3855('0x54')]=intUtil[_0x3855('0x53')](_0x1d6a95[_0x3855('0x54')]);def['uri']=util[_0x3855('0x38')](_0x3855('0x73'),_0x1d6a95['remoteUri']);if(_0x292fe8&&_0x292fe8[_0x3855('0x56')]){logger['info']('['+_0x152320[_0x3855('0x74')][_0x3855('0x75')]()+']',_0x3855('0x6c'));_0x152320[_0x3855('0x58')]=util[_0x3855('0x38')](_0x3855('0x59'),_0x1d6a95['serverUrl'],_0x152320['uniqueid'],md5(_0x152320[_0x3855('0x5a')]));}else{_0x152320['recordingURL']='';}return getConnection(_0x1d6a95)[_0x3855('0x2e')](function(_0x457c6a){_0x2dba51=_0x457c6a;if(!_[_0x3855('0x29')](_0x10077f)){return getUser(_0x1d6a95,_0x10077f[_0x3855('0xc')],_0x2dba51);}else{return getUser(_0x1d6a95,null,_0x2dba51);}})[_0x3855('0x2e')](function(_0x28b526){_0x572201=_0x28b526;logger[_0x3855('0x31')](_0x3855('0x5b'),_0x572201['id']);return getEndUser(_0x1d6a95,_0x152320[_0x3855('0x5c')],_0x152320[_0x3855('0x76')],_0x2dba51);})['then'](function(_0x1f827a){_0x490f58=_0x1f827a;logger[_0x3855('0x31')](_0x3855('0x5d'),_0x490f58['id']);return getTicket(_0x1d6a95,_0x572201,_0x490f58,_0x2dec92,_0x152320,_0x2dec92[_0x3855('0x5e')],_0x2dba51,_0x3855('0x5f'));})[_0x3855('0x2e')](function(_0x42ca65){_0x745e70=_0x42ca65;logger[_0x3855('0x31')](_0x3855('0x60'));logger[_0x3855('0x31')](_0x3855('0x61'),_0x745e70['id']);return setRelationship(_0x2dba51,_0x572201,_0x745e70,_0x3855('0x62'));})[_0x3855('0x2e')](function(){return setRelationship(_0x2dba51,_0x490f58,_0x745e70,_0x3855('0x63'));})[_0x3855('0x2e')](function(){return getServerInfo(_0x2dba51);})['catch'](function(_0xe0c8d9){logger[_0x3855('0x69')]('['+_0x152320['lastevent'][_0x3855('0x75')]()+']',JSON[_0x3855('0x22')](_0xe0c8d9));});}; \ 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 9a5fc3c..d627aba 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 _0xead4=['slice','substring','validateEmail','isNil','test','util','getString','length','sortBy','type','content','variable','variableName','toString','Variable','name','toLowerCase','push','string','format','%s:\x20%s','keyType','key','customVariable'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xead4,0x1e5));var _0x4ead=function(_0x27a954,_0x5ac46d){_0x27a954=_0x27a954-0x0;var _0x10c3a7=_0xead4[_0x27a954];return _0x10c3a7;};'use strict';var _=require('lodash');var util=require(_0x4ead('0x0'));exports[_0x4ead('0x1')]=function(_0x2af8f4,_0xbe397e,_0xdae177){var _0x353d0c=[];if(_0x2af8f4[_0x4ead('0x2')]>0x0){var _0x110313=_[_0x4ead('0x3')](_0x2af8f4,['id']);for(var _0x403a81=0x0;_0x403a81<_0x110313[_0x4ead('0x2')];_0x403a81++){var _0x2e2d1d=_0x110313[_0x403a81];if(_0x2e2d1d[_0x4ead('0x4')]==='string'){_0x353d0c['push'](_0x2e2d1d[_0x4ead('0x5')]);}else if(_0x2e2d1d[_0x4ead('0x4')]===_0x4ead('0x6')&&_0x2e2d1d[_0x4ead('0x7')]){_0xbe397e[_0x2e2d1d[_0x4ead('0x7')]]&&_0x353d0c['push'](_0xbe397e[_0x2e2d1d[_0x4ead('0x7')]][_0x4ead('0x8')]());}else if(_0x2e2d1d[_0x4ead('0x4')]==='customVariable'&&_0x2e2d1d[_0x4ead('0x9')]&&_0x2e2d1d['Variable'][_0x4ead('0xa')]){_0xbe397e[_0x2e2d1d[_0x4ead('0x9')][_0x4ead('0xa')][_0x4ead('0xb')]()]&&_0x353d0c[_0x4ead('0xc')](_0xbe397e[_0x2e2d1d[_0x4ead('0x9')][_0x4ead('0xa')]['toLowerCase']()][_0x4ead('0x8')]());}else if(_0x2e2d1d['type']==='keyValue'){if(_0x2e2d1d['keyType']===_0x4ead('0xd')&&_0x2e2d1d['key']){_0x353d0c['push'](util[_0x4ead('0xe')](_0x4ead('0xf'),_0x2e2d1d['key'],_0x2e2d1d['keyContent']));}else if(_0x2e2d1d[_0x4ead('0x10')]===_0x4ead('0x6')&&_0x2e2d1d[_0x4ead('0x7')]&&_0x2e2d1d[_0x4ead('0x11')]){_0xbe397e[_0x2e2d1d[_0x4ead('0x7')]]&&_0x353d0c[_0x4ead('0xc')](util[_0x4ead('0xe')](_0x4ead('0xf'),_0x2e2d1d['key'],_0xbe397e[_0x2e2d1d[_0x4ead('0x7')]]));}else if(_0x2e2d1d[_0x4ead('0x10')]===_0x4ead('0x12')&&_0x2e2d1d['Variable']&&_0x2e2d1d['Variable'][_0x4ead('0xa')]&&_0x2e2d1d[_0x4ead('0x11')]){_0xbe397e[_0x2e2d1d[_0x4ead('0x9')]['name'][_0x4ead('0xb')]()]&&_0x353d0c['push'](util[_0x4ead('0xe')]('%s:\x20%s',_0x2e2d1d[_0x4ead('0x11')],_0xbe397e[_0x2e2d1d['Variable'][_0x4ead('0xa')]['toLowerCase']()]));}}}}return _0x353d0c['join'](_0xdae177);};exports['stripTrailingSlash']=function(_0x44014c){var _0x29b221=_0x44014c[_0x4ead('0x13')](-0x1);if(_0x29b221==='/'){_0x44014c=_0x44014c[_0x4ead('0x14')](0x0,_0x44014c['lastIndexOf'](_0x29b221));}return _0x44014c;};exports[_0x4ead('0x15')]=function(_0x32ac5d){if(!_[_0x4ead('0x16')](_0x32ac5d)&&_0x32ac5d!==''){var _0x51ca4d=/^(([^<>()\[\]\\.,;:\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 _0x51ca4d[_0x4ead('0x17')](String(_0x32ac5d)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x1588=['lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','slice'];(function(_0xfafce3,_0x1e320a){var _0x4e2043=function(_0x32c092){while(--_0x32c092){_0xfafce3['push'](_0xfafce3['shift']());}};_0x4e2043(++_0x1e320a);}(_0x1588,0x1cb));var _0x8158=function(_0x4e2c2b,_0x624e3c){_0x4e2c2b=_0x4e2c2b-0x0;var _0x58d1b2=_0x1588[_0x4e2c2b];return _0x58d1b2;};'use strict';var _=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));exports[_0x8158('0x2')]=function(_0x2e3279,_0x36badb,_0x26349d){var _0x1dafe3=[];if(_0x2e3279['length']>0x0){var _0x3e9c34=_['sortBy'](_0x2e3279,['id']);for(var _0x3f445f=0x0;_0x3f445f<_0x3e9c34[_0x8158('0x3')];_0x3f445f++){var _0x10282d=_0x3e9c34[_0x3f445f];if(_0x10282d[_0x8158('0x4')]===_0x8158('0x5')){_0x1dafe3[_0x8158('0x6')](_0x10282d[_0x8158('0x7')]);}else if(_0x10282d['type']===_0x8158('0x8')&&_0x10282d[_0x8158('0x9')]){_0x36badb[_0x10282d[_0x8158('0x9')]]&&_0x1dafe3[_0x8158('0x6')](_0x36badb[_0x10282d[_0x8158('0x9')]]['toString']());}else if(_0x10282d[_0x8158('0x4')]===_0x8158('0xa')&&_0x10282d[_0x8158('0xb')]&&_0x10282d[_0x8158('0xb')]['name']){_0x36badb[_0x10282d[_0x8158('0xb')]['name']['toLowerCase']()]&&_0x1dafe3[_0x8158('0x6')](_0x36badb[_0x10282d[_0x8158('0xb')][_0x8158('0xc')][_0x8158('0xd')]()]['toString']());}else if(_0x10282d['type']===_0x8158('0xe')){if(_0x10282d[_0x8158('0xf')]===_0x8158('0x5')&&_0x10282d[_0x8158('0x10')]){_0x1dafe3[_0x8158('0x6')](util[_0x8158('0x11')](_0x8158('0x12'),_0x10282d[_0x8158('0x10')],_0x10282d['keyContent']));}else if(_0x10282d[_0x8158('0xf')]===_0x8158('0x8')&&_0x10282d['variableName']&&_0x10282d[_0x8158('0x10')]){_0x36badb[_0x10282d[_0x8158('0x9')]]&&_0x1dafe3['push'](util[_0x8158('0x11')](_0x8158('0x12'),_0x10282d['key'],_0x36badb[_0x10282d[_0x8158('0x9')]]));}else if(_0x10282d['keyType']===_0x8158('0xa')&&_0x10282d[_0x8158('0xb')]&&_0x10282d[_0x8158('0xb')][_0x8158('0xc')]&&_0x10282d[_0x8158('0x10')]){_0x36badb[_0x10282d['Variable']['name'][_0x8158('0xd')]()]&&_0x1dafe3['push'](util[_0x8158('0x11')]('%s:\x20%s',_0x10282d[_0x8158('0x10')],_0x36badb[_0x10282d[_0x8158('0xb')][_0x8158('0xc')][_0x8158('0xd')]()]));}}}}return _0x1dafe3[_0x8158('0x13')](_0x26349d);};exports['stripTrailingSlash']=function(_0x146551){var _0x4fc90c=_0x146551[_0x8158('0x14')](-0x1);if(_0x4fc90c==='/'){_0x146551=_0x146551['substring'](0x0,_0x146551[_0x8158('0x15')](_0x4fc90c));}return _0x146551;};exports[_0x8158('0x16')]=function(_0x26cb05){if(!_[_0x8158('0x17')](_0x26cb05)&&_0x26cb05!==''){var _0x3dc20c=/^(([^<>()\[\]\\.,;:\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 _0x3dc20c['test'](String(_0x26cb05)[_0x8158('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 9f32d18..0907f50 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','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','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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(_0x160043,_0x51b467){var _0x2aee5c=function(_0x3fb8e2){while(--_0x3fb8e2){_0x160043['push'](_0x160043['shift']());}};_0x2aee5c(++_0x51b467);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 dc12f10..2719f5e 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 _0x6921=['forEach','includes','type','customField','nameField','toLowerCase','content','string','picklist','idField','custom_fields','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','then','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','results','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','map'];(function(_0x28d3ad,_0x3fe4f9){var _0x15d280=function(_0x394cc4){while(--_0x394cc4){_0x28d3ad['push'](_0x28d3ad['shift']());}};_0x15d280(++_0x3fe4f9);}(_0x6921,0x1d8));var _0x1692=function(_0x2b82c1,_0x2eac45){_0x2b82c1=_0x2b82c1-0x0;var _0x108999=_0x6921[_0x2b82c1];return _0x108999;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x1692('0x0'));var util=require('util');var Redis=require(_0x1692('0x1'));var intUtil=require(_0x1692('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1692('0x3'));config[_0x1692('0x4')]=_[_0x1692('0x5')](config[_0x1692('0x4')],{'host':_0x1692('0x6'),'port':0x18eb});var io=require(_0x1692('0x7'))(new Redis(config[_0x1692('0x4')]));function emit(_0x265a0e,_0x427940,_0xffd34a){io['to'](_0x265a0e)['emit'](_0x427940,_0xffd34a);}var headers={'Content-Type':_0x1692('0x8'),'Accept':_0x1692('0x8')};function getTicket(_0x2d917c,_0x58d4ef,_0x4ad29e,_0x5d0e9f,_0xf647c5){logger[_0x1692('0x9')](_0x1692('0xa'));return request({'uri':util['format'](_0x1692('0xb'),_0x2d917c['remoteUri']),'method':_0x1692('0xc'),'body':{'ticket':_[_0x1692('0xd')]({'requester_id':_0x4ad29e['id'],'submitter_id':_0x58d4ef?_0x58d4ef['id']:undefined,'assignee_id':_0x58d4ef?_0x58d4ef['id']:undefined,'tags':getTags(_0x5d0e9f[_0x1692('0xe')],_0x1692('0xf')),'subject':intUtil['getString'](_0x5d0e9f[_0x1692('0x10')],_0xf647c5,'\x20'),'description':intUtil[_0x1692('0x11')](_0x5d0e9f['Descriptions'],_0xf647c5,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1692('0x11')](_0x5d0e9f[_0x1692('0x12')],_0xf647c5,'\x0a')}},getCustomFields(_0x5d0e9f[_0x1692('0x13')],_0xf647c5))}})['then'](function(_0x47b7cd){logger[_0x1692('0x9')](_0x1692('0x14'));return _0x47b7cd[_0x1692('0x15')];});}function getUser(_0x256089,_0x51565e){if(intUtil['validateEmail'](_0x51565e)){logger[_0x1692('0x9')](_0x1692('0x16'),_0x51565e);return request({'uri':util['format'](_0x1692('0x17'),_0x256089['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x51565e)}})[_0x1692('0x18')](function(_0x12d125){if(_0x12d125[_0x1692('0x19')]){logger[_0x1692('0x9')]('Agent\x20found!');return _[_0x1692('0x1a')](_0x12d125['results'],{'email':_0x51565e,'role':_0x1692('0x1b')});}else{logger[_0x1692('0x9')](_0x1692('0x1c'));return request({'uri':util[_0x1692('0x1d')](_0x1692('0x1e'),_0x256089[_0x1692('0x1f')])})[_0x1692('0x18')](function(_0x547aaf){logger[_0x1692('0x9')]('Admin\x20account\x20selected.');return _0x547aaf['user'];});}});}else{logger[_0x1692('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1692('0x1d')]('%s/users/me.json',_0x256089[_0x1692('0x1f')])})[_0x1692('0x18')](function(_0x4df8b5){logger[_0x1692('0x9')](_0x1692('0x20'));return _0x4df8b5[_0x1692('0x21')];});}}function getEndUser(_0x34ba77,_0x549952,_0x472860){logger[_0x1692('0x9')](_0x1692('0x22'),_0x472860);return request({'uri':util[_0x1692('0x1d')](_0x1692('0x17'),_0x34ba77[_0x1692('0x1f')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x472860)}})[_0x1692('0x18')](function(_0x5d8f88){var _0x5a89ef;if(_0x5d8f88['results'][_0x1692('0x23')]){_0x5d8f88['results']=_[_0x1692('0x24')](_0x5d8f88['results'],{'suspended':![],'role':_0x1692('0x25')});if(_0x5d8f88['results'][_0x1692('0x23')]){_0x5a89ef=_[_0x1692('0x26')](_0x5d8f88[_0x1692('0x27')]);}}if(_0x5a89ef){logger[_0x1692('0x9')](_0x1692('0x28'));return _0x5a89ef;}else{logger[_0x1692('0x9')](_0x1692('0x29'));return request({'uri':util[_0x1692('0x1d')](_0x1692('0x2a'),_0x34ba77[_0x1692('0x1f')]),'method':_0x1692('0xc'),'body':{'user':{'role':_0x1692('0x25'),'name':util[_0x1692('0x1d')]('Caller\x20-\x20%s',_0x549952||_0x472860),'phone':_0x472860}}})[_0x1692('0x18')](function(_0x91fed4){logger[_0x1692('0x9')]('Enduser\x20created.');return _0x91fed4[_0x1692('0x21')];});}});}function getAuth(_0x54fa02){var _0x24072e;if(_0x54fa02[_0x1692('0x2b')]===_0x1692('0x2c')){_0x24072e=util['format'](_0x1692('0x2d'),_0x54fa02['username'],_0x54fa02['password']);}else if(_0x54fa02['authType']===_0x1692('0x2e')){_0x24072e=util[_0x1692('0x1d')](_0x1692('0x2f'),_0x54fa02['username'],_0x54fa02[_0x1692('0x2e')]);}return util['format'](_0x1692('0x30'),new Buffer(_0x24072e)[_0x1692('0x31')](_0x1692('0x32')));}function request(_0x5207f6){logger['debug']('[HTTP]',JSON[_0x1692('0x33')](_0x5207f6));return rp(_[_0x1692('0x5')](_0x5207f6,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1f3619,_0x4e5621){var _0x1bd362=[];if(_0x1f3619&&_0x1f3619[_0x1692('0x23')]>0x0){_0x1bd362=_[_0x1692('0x34')](_0x1f3619,_0x4e5621);}return _0x1bd362;}function getCustomFields(_0x4d7c80,_0x2676c3){var _0x125445=[];var _0x3a1e38={'custom_fields':[]};if(_0x4d7c80[_0x1692('0x23')]>0x0){_[_0x1692('0x35')](_0x4d7c80,function(_0x6515ea){if(_[_0x1692('0x36')](['string','picklist'],_0x6515ea[_0x1692('0x37')])&&_0x6515ea['nameField']&&!_0x6515ea[_0x1692('0x38')]){_0x3a1e38[_0x6515ea[_0x1692('0x39')][_0x1692('0x3a')]()]=_0x6515ea[_0x1692('0x3b')][_0x1692('0x31')]();}else if(_[_0x1692('0x36')]([_0x1692('0x3c'),_0x1692('0x3d')],_0x6515ea[_0x1692('0x37')])&&_0x6515ea[_0x1692('0x3e')]&&_0x6515ea[_0x1692('0x38')]){_0x3a1e38[_0x1692('0x3f')][_0x1692('0x40')]({'id':_0x6515ea[_0x1692('0x3e')],'value':_0x6515ea['content'][_0x1692('0x31')]()});}else if(_0x6515ea[_0x1692('0x37')]===_0x1692('0x41')&&_0x6515ea[_0x1692('0x42')]&&_0x6515ea[_0x1692('0x3e')]&&_0x6515ea[_0x1692('0x38')]){_0x2676c3[_0x6515ea['variableName']]&&_0x3a1e38[_0x1692('0x3f')][_0x1692('0x40')]({'id':_0x6515ea[_0x1692('0x3e')],'value':_0x2676c3[_0x6515ea[_0x1692('0x42')]][_0x1692('0x31')]()});}else if(_0x6515ea[_0x1692('0x37')]==='customVariable'&&_0x6515ea[_0x1692('0x43')]&&_0x6515ea['Variable']['name']&&_0x6515ea[_0x1692('0x3e')]&&_0x6515ea[_0x1692('0x38')]){_0x2676c3[_0x6515ea[_0x1692('0x43')][_0x1692('0xf')][_0x1692('0x3a')]()]&&_0x3a1e38[_0x1692('0x3f')][_0x1692('0x40')]({'id':_0x6515ea[_0x1692('0x3e')],'value':_0x2676c3[_0x6515ea[_0x1692('0x43')][_0x1692('0xf')][_0x1692('0x3a')]()][_0x1692('0x31')]()});}});}return _0x3a1e38;}exports['queue']=function(_0x229b25,_0x50b1bd,_0x22623f,_0x4bf023,_0x2cdaaf,_0x52cfc2){var _0xfed861,_0x39f16f;_0x52cfc2['remoteUri']=intUtil[_0x1692('0x44')](_0x52cfc2[_0x1692('0x1f')]);_0x52cfc2[_0x1692('0x45')]=intUtil[_0x1692('0x44')](_0x52cfc2[_0x1692('0x45')]);if(_0x2cdaaf&&_0x2cdaaf['monitor_format']){logger['info'](_0x1692('0x46'),_0x1692('0x47'));_0x50b1bd[_0x1692('0x48')]=util[_0x1692('0x1d')](_0x1692('0x49'),_0x52cfc2[_0x1692('0x45')],_0x50b1bd[_0x1692('0x4a')],md5(_0x50b1bd['uniqueid']));}else{_0x50b1bd[_0x1692('0x48')]='';}headers[_0x1692('0x4b')]=getAuth(_0x52cfc2);return getUser(_0x52cfc2,_0x4bf023[_0x1692('0x4c')])[_0x1692('0x18')](function(_0x9b480d){_0xfed861=_0x9b480d;logger[_0x1692('0x9')]('The\x20User\x20ID\x20is:',_0xfed861['id']);return getEndUser(_0x52cfc2,_0x50b1bd[_0x1692('0x4d')],_0x50b1bd[_0x1692('0x4e')]);})[_0x1692('0x18')](function(_0x593165){_0x39f16f=_0x593165;logger[_0x1692('0x9')](_0x1692('0x4f'),_0x39f16f['id']);return getTicket(_0x52cfc2,_0xfed861,_0x39f16f,_0x22623f,_0x50b1bd);})['then'](function(_0x29b279){if(_0x29b279){logger[_0x1692('0x9')]('The\x20Ticket\x20ID\x20is:',_0x29b279['id']);switch(_0x52cfc2['type']){case'integrationTab':logger[_0x1692('0x9')](_0x1692('0x46'),_0x1692('0x50'));return request({'uri':util['format'](_0x1692('0x51'),_0x52cfc2[_0x1692('0x1f')],_0xfed861['id'],_0x29b279['id']),'method':_0x1692('0xc')});case _0x1692('0x52'):logger['info'](_0x1692('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1692('0x1d')](_0x1692('0x53'),_0x4bf023[_0x1692('0xf')]),'trigger:browser:url',{'uri':util['format'](_0x1692('0x54'),_0x52cfc2[_0x1692('0x1f')][_0x1692('0x55')](_0x1692('0x56'),''),_0x29b279['id'])});break;default:logger[_0x1692('0x57')]('[QUEUE]',_0x1692('0x58'));}}})[_0x1692('0x59')](function(_0x177a55){logger[_0x1692('0x57')](_0x1692('0x5a'),util['inspect'](_0x177a55,{'showHidden':!![],'depth':null}));});};exports[_0x1692('0x5b')]=function(_0xa2cac7,_0x3a2a4b,_0x5a8ae4,_0x6edc50,_0x4031f4,_0x14cfdf,_0x246b87){var _0x898e83,_0x5d8922;_0x14cfdf[_0x1692('0x1f')]=intUtil['stripTrailingSlash'](_0x14cfdf[_0x1692('0x1f')]);_0x14cfdf[_0x1692('0x45')]=intUtil[_0x1692('0x44')](_0x14cfdf['serverUrl']);if(_0x246b87&&_0x246b87[_0x1692('0x5c')]&&_0x246b87[_0x1692('0x5c')]!==_0x1692('0x5d')){logger[_0x1692('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3a2a4b[_0x1692('0x48')]=util[_0x1692('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14cfdf['serverUrl'],_0x3a2a4b[_0x1692('0x4a')],md5(_0x3a2a4b[_0x1692('0x4a')]));}headers['Authorization']=getAuth(_0x14cfdf);return getUser(_0x14cfdf,_0x6edc50[_0x1692('0x4c')])['then'](function(_0x5eeb13){_0x898e83=_0x5eeb13;logger[_0x1692('0x9')]('The\x20User\x20ID\x20is:',_0x898e83['id']);return getEndUser(_0x14cfdf,_0x3a2a4b['destcalleridname'],_0x3a2a4b[_0x1692('0x5e')]);})[_0x1692('0x18')](function(_0x3bc448){_0x5d8922=_0x3bc448;logger[_0x1692('0x9')](_0x1692('0x4f'),_0x5d8922['id']);return getTicket(_0x14cfdf,_0x898e83,_0x5d8922,_0x5a8ae4,_0x3a2a4b);})[_0x1692('0x18')](function(_0x2d67fc){if(_0x2d67fc){logger['info'](_0x1692('0x5f'),_0x2d67fc['id']);switch(_0x14cfdf[_0x1692('0x37')]){case'integrationTab':logger[_0x1692('0x9')]('[OUTBOUND]',_0x1692('0x50'));return request({'uri':util[_0x1692('0x1d')](_0x1692('0x51'),_0x14cfdf[_0x1692('0x1f')],_0x898e83['id'],_0x2d67fc['id']),'method':_0x1692('0xc')});case'newTab':logger[_0x1692('0x9')](_0x1692('0x60'),_0x1692('0x61'));emit(util[_0x1692('0x1d')](_0x1692('0x53'),_0x6edc50[_0x1692('0xf')]),'trigger:browser:url',{'uri':util[_0x1692('0x1d')](_0x1692('0x54'),_0x14cfdf['remoteUri']['replace'](_0x1692('0x56'),''),_0x2d67fc['id'])});break;default:logger[_0x1692('0x57')]('[OUTBOUND]',_0x1692('0x58'));}}})[_0x1692('0x59')](function(_0xf6db9c){logger[_0x1692('0x57')](_0x1692('0x62'),util[_0x1692('0x63')](_0xf6db9c,{'showHidden':!![],'depth':null}));});};exports[_0x1692('0x64')]=function(_0x12d24b,_0xa2e11a,_0x19e24c,_0x337dd9,_0x502acb,_0x3eb5ba){var _0x2f9bbf,_0x136893;_0x3eb5ba[_0x1692('0x1f')]=intUtil['stripTrailingSlash'](_0x3eb5ba['remoteUri']);_0x3eb5ba[_0x1692('0x45')]=intUtil[_0x1692('0x44')](_0x3eb5ba[_0x1692('0x45')]);if(_0x502acb&&_0x502acb[_0x1692('0x65')]){logger[_0x1692('0x9')]('['+_0xa2e11a[_0x1692('0x66')][_0x1692('0x67')]()+']',_0x1692('0x47'));_0xa2e11a[_0x1692('0x48')]=util[_0x1692('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3eb5ba[_0x1692('0x45')],_0xa2e11a['uniqueid'],md5(_0xa2e11a['uniqueid']));}else{_0xa2e11a[_0x1692('0x48')]='';}headers[_0x1692('0x4b')]=getAuth(_0x3eb5ba);return getUser(_0x3eb5ba)['then'](function(_0x5bcd88){_0x2f9bbf=_0x5bcd88;logger[_0x1692('0x9')]('The\x20User\x20ID\x20is:',_0x2f9bbf['id']);return getEndUser(_0x3eb5ba,_0xa2e11a['calleridname'],_0xa2e11a[_0x1692('0x4e')]);})[_0x1692('0x18')](function(_0x463b64){_0x136893=_0x463b64;logger[_0x1692('0x9')](_0x1692('0x4f'),_0x136893['id']);return getTicket(_0x3eb5ba,_0x2f9bbf,_0x136893,_0x19e24c,_0xa2e11a);})[_0x1692('0x18')](function(_0x10fbf9){if(_0x10fbf9){logger['info'](_0x1692('0x5f'),_0x10fbf9['id']);}})[_0x1692('0x59')](function(_0x45dbfb){logger[_0x1692('0x57')]('['+_0xa2e11a[_0x1692('0x66')]['toUpperCase']()+']'+_0x1692('0x68'),util[_0x1692('0x63')](_0x45dbfb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4abe=['info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','application/json'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4abe,0x14e));var _0xe4ab=function(_0x3d37ee,_0x29797e){_0x3d37ee=_0x3d37ee-0x0;var _0x22c880=_0x4abe[_0x3d37ee];return _0x22c880;};'use strict';var _=require(_0xe4ab('0x0'));var rp=require(_0xe4ab('0x1'));var md5=require(_0xe4ab('0x2'));var util=require('util');var Redis=require(_0xe4ab('0x3'));var intUtil=require(_0xe4ab('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe4ab('0x5'));config[_0xe4ab('0x6')]=_[_0xe4ab('0x7')](config[_0xe4ab('0x6')],{'host':_0xe4ab('0x8'),'port':0x18eb});var io=require(_0xe4ab('0x9'))(new Redis(config[_0xe4ab('0x6')]));function emit(_0x2a876a,_0x4e6e94,_0x30bc5f){io['to'](_0x2a876a)['emit'](_0x4e6e94,_0x30bc5f);}var headers={'Content-Type':_0xe4ab('0xa'),'Accept':'application/json'};function getTicket(_0x562d88,_0x3bcf20,_0x282509,_0x12b0ea,_0x7969b5){logger[_0xe4ab('0xb')](_0xe4ab('0xc'));return request({'uri':util[_0xe4ab('0xd')](_0xe4ab('0xe'),_0x562d88['remoteUri']),'method':_0xe4ab('0xf'),'body':{'ticket':_[_0xe4ab('0x10')]({'requester_id':_0x282509['id'],'submitter_id':_0x3bcf20?_0x3bcf20['id']:undefined,'assignee_id':_0x3bcf20?_0x3bcf20['id']:undefined,'tags':getTags(_0x12b0ea[_0xe4ab('0x11')],_0xe4ab('0x12')),'subject':intUtil[_0xe4ab('0x13')](_0x12b0ea['Subjects'],_0x7969b5,'\x20'),'description':intUtil['getString'](_0x12b0ea['Descriptions'],_0x7969b5,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe4ab('0x13')](_0x12b0ea[_0xe4ab('0x14')],_0x7969b5,'\x0a')}},getCustomFields(_0x12b0ea[_0xe4ab('0x15')],_0x7969b5))}})[_0xe4ab('0x16')](function(_0x3ca224){logger[_0xe4ab('0xb')]('Ticket\x20created!');return _0x3ca224[_0xe4ab('0x17')];});}function getUser(_0x574f1d,_0x5a16a5){if(intUtil[_0xe4ab('0x18')](_0x5a16a5)){logger[_0xe4ab('0xb')](_0xe4ab('0x19'),_0x5a16a5);return request({'uri':util['format'](_0xe4ab('0x1a'),_0x574f1d['remoteUri']),'qs':{'query':util[_0xe4ab('0xd')]('type:user\x20role:agent\x20email:%s',_0x5a16a5)}})['then'](function(_0x2aaf2e){if(_0x2aaf2e[_0xe4ab('0x1b')]){logger['info'](_0xe4ab('0x1c'));return _[_0xe4ab('0x1d')](_0x2aaf2e[_0xe4ab('0x1e')],{'email':_0x5a16a5,'role':_0xe4ab('0x1f')});}else{logger[_0xe4ab('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xe4ab('0x20'),_0x574f1d['remoteUri'])})['then'](function(_0x4fbc56){logger[_0xe4ab('0xb')](_0xe4ab('0x21'));return _0x4fbc56[_0xe4ab('0x22')];});}});}else{logger['info'](_0xe4ab('0x23'));return request({'uri':util['format'](_0xe4ab('0x20'),_0x574f1d[_0xe4ab('0x24')])})['then'](function(_0x587eee){logger[_0xe4ab('0xb')]('Admin\x20account\x20selected.');return _0x587eee[_0xe4ab('0x22')];});}}function getEndUser(_0x4193d4,_0x1636a1,_0x2bb9b4){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2bb9b4);return request({'uri':util[_0xe4ab('0xd')]('%s/search.json',_0x4193d4[_0xe4ab('0x24')]),'qs':{'query':util[_0xe4ab('0xd')](_0xe4ab('0x25'),_0x2bb9b4)}})[_0xe4ab('0x16')](function(_0x4d5b12){var _0x5cfc58;if(_0x4d5b12[_0xe4ab('0x1e')]['length']){_0x4d5b12[_0xe4ab('0x1e')]=_[_0xe4ab('0x26')](_0x4d5b12[_0xe4ab('0x1e')],{'suspended':![],'role':_0xe4ab('0x27')});if(_0x4d5b12[_0xe4ab('0x1e')][_0xe4ab('0x28')]){_0x5cfc58=_[_0xe4ab('0x29')](_0x4d5b12[_0xe4ab('0x1e')]);}}if(_0x5cfc58){logger[_0xe4ab('0xb')](_0xe4ab('0x2a'));return _0x5cfc58;}else{logger[_0xe4ab('0xb')](_0xe4ab('0x2b'));return request({'uri':util[_0xe4ab('0xd')](_0xe4ab('0x2c'),_0x4193d4[_0xe4ab('0x24')]),'method':'POST','body':{'user':{'role':_0xe4ab('0x27'),'name':util[_0xe4ab('0xd')](_0xe4ab('0x2d'),_0x1636a1||_0x2bb9b4),'phone':_0x2bb9b4}}})['then'](function(_0x4c643e){logger[_0xe4ab('0xb')](_0xe4ab('0x2e'));return _0x4c643e[_0xe4ab('0x22')];});}});}function getAuth(_0xe981ba){var _0x233e73;if(_0xe981ba[_0xe4ab('0x2f')]===_0xe4ab('0x30')){_0x233e73=util['format'](_0xe4ab('0x31'),_0xe981ba['username'],_0xe981ba[_0xe4ab('0x30')]);}else if(_0xe981ba[_0xe4ab('0x2f')]===_0xe4ab('0x32')){_0x233e73=util['format'](_0xe4ab('0x33'),_0xe981ba[_0xe4ab('0x34')],_0xe981ba[_0xe4ab('0x32')]);}return util[_0xe4ab('0xd')]('Basic\x20%s',new Buffer(_0x233e73)[_0xe4ab('0x35')](_0xe4ab('0x36')));}function request(_0x415aa1){logger[_0xe4ab('0x37')](_0xe4ab('0x38'),JSON[_0xe4ab('0x39')](_0x415aa1));return rp(_[_0xe4ab('0x7')](_0x415aa1,{'method':_0xe4ab('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x34b2da,_0x53b89b){var _0x500a62=[];if(_0x34b2da&&_0x34b2da[_0xe4ab('0x28')]>0x0){_0x500a62=_[_0xe4ab('0x3b')](_0x34b2da,_0x53b89b);}return _0x500a62;}function getCustomFields(_0x10c9dd,_0x3ad47d){var _0x29b488=[];var _0x49d247={'custom_fields':[]};if(_0x10c9dd[_0xe4ab('0x28')]>0x0){_[_0xe4ab('0x3c')](_0x10c9dd,function(_0x44a63a){if(_[_0xe4ab('0x3d')]([_0xe4ab('0x3e'),_0xe4ab('0x3f')],_0x44a63a[_0xe4ab('0x40')])&&_0x44a63a[_0xe4ab('0x41')]&&!_0x44a63a[_0xe4ab('0x42')]){_0x49d247[_0x44a63a['nameField'][_0xe4ab('0x43')]()]=_0x44a63a[_0xe4ab('0x44')][_0xe4ab('0x35')]();}else if(_[_0xe4ab('0x3d')]([_0xe4ab('0x3e'),'picklist'],_0x44a63a['type'])&&_0x44a63a[_0xe4ab('0x45')]&&_0x44a63a[_0xe4ab('0x42')]){_0x49d247[_0xe4ab('0x46')]['push']({'id':_0x44a63a[_0xe4ab('0x45')],'value':_0x44a63a[_0xe4ab('0x44')][_0xe4ab('0x35')]()});}else if(_0x44a63a[_0xe4ab('0x40')]===_0xe4ab('0x47')&&_0x44a63a[_0xe4ab('0x48')]&&_0x44a63a['idField']&&_0x44a63a[_0xe4ab('0x42')]){_0x3ad47d[_0x44a63a['variableName']]&&_0x49d247[_0xe4ab('0x46')][_0xe4ab('0x49')]({'id':_0x44a63a['idField'],'value':_0x3ad47d[_0x44a63a['variableName']][_0xe4ab('0x35')]()});}else if(_0x44a63a[_0xe4ab('0x40')]==='customVariable'&&_0x44a63a[_0xe4ab('0x4a')]&&_0x44a63a[_0xe4ab('0x4a')][_0xe4ab('0x12')]&&_0x44a63a[_0xe4ab('0x45')]&&_0x44a63a[_0xe4ab('0x42')]){_0x3ad47d[_0x44a63a['Variable']['name'][_0xe4ab('0x43')]()]&&_0x49d247[_0xe4ab('0x46')][_0xe4ab('0x49')]({'id':_0x44a63a[_0xe4ab('0x45')],'value':_0x3ad47d[_0x44a63a[_0xe4ab('0x4a')]['name']['toLowerCase']()][_0xe4ab('0x35')]()});}});}return _0x49d247;}exports[_0xe4ab('0x4b')]=function(_0x3468a0,_0x311a96,_0x30e83f,_0x36f61b,_0x192341,_0x39a4f6){var _0x3d7b9b,_0x5e77b9;_0x39a4f6['remoteUri']=intUtil[_0xe4ab('0x4c')](_0x39a4f6['remoteUri']);_0x39a4f6[_0xe4ab('0x4d')]=intUtil['stripTrailingSlash'](_0x39a4f6[_0xe4ab('0x4d')]);if(_0x192341&&_0x192341['monitor_format']){logger[_0xe4ab('0xb')](_0xe4ab('0x4e'),'Recording\x20is\x20enabled!');_0x311a96['recordingURL']=util[_0xe4ab('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39a4f6['serverUrl'],_0x311a96['uniqueid'],md5(_0x311a96['uniqueid']));}else{_0x311a96[_0xe4ab('0x4f')]='';}headers[_0xe4ab('0x50')]=getAuth(_0x39a4f6);return getUser(_0x39a4f6,_0x36f61b[_0xe4ab('0x51')])[_0xe4ab('0x16')](function(_0x2d66f0){_0x3d7b9b=_0x2d66f0;logger[_0xe4ab('0xb')]('The\x20User\x20ID\x20is:',_0x3d7b9b['id']);return getEndUser(_0x39a4f6,_0x311a96['calleridname'],_0x311a96['calleridnum']);})[_0xe4ab('0x16')](function(_0x4fa51b){_0x5e77b9=_0x4fa51b;logger['info'](_0xe4ab('0x52'),_0x5e77b9['id']);return getTicket(_0x39a4f6,_0x3d7b9b,_0x5e77b9,_0x30e83f,_0x311a96);})['then'](function(_0x53f3cf){if(_0x53f3cf){logger[_0xe4ab('0xb')](_0xe4ab('0x53'),_0x53f3cf['id']);switch(_0x39a4f6[_0xe4ab('0x40')]){case _0xe4ab('0x54'):logger[_0xe4ab('0xb')](_0xe4ab('0x4e'),_0xe4ab('0x55'));return request({'uri':util[_0xe4ab('0xd')](_0xe4ab('0x56'),_0x39a4f6[_0xe4ab('0x24')],_0x3d7b9b['id'],_0x53f3cf['id']),'method':_0xe4ab('0xf')});case _0xe4ab('0x57'):logger[_0xe4ab('0xb')]('[QUEUE]',_0xe4ab('0x58'));emit(util[_0xe4ab('0xd')](_0xe4ab('0x59'),_0x36f61b[_0xe4ab('0x12')]),_0xe4ab('0x5a'),{'uri':util['format'](_0xe4ab('0x5b'),_0x39a4f6[_0xe4ab('0x24')][_0xe4ab('0x5c')]('/api/v2',''),_0x53f3cf['id'])});break;default:logger[_0xe4ab('0x5d')]('[QUEUE]',_0xe4ab('0x5e'));}}})[_0xe4ab('0x5f')](function(_0x154895){logger[_0xe4ab('0x5d')](_0xe4ab('0x60'),util[_0xe4ab('0x61')](_0x154895,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xbf71aa,_0x266e30,_0x15fc69,_0x18f9e3,_0x2a827c,_0x36bdcb,_0x49c38b){var _0x40d7c6,_0x5d49c7;_0x36bdcb['remoteUri']=intUtil[_0xe4ab('0x4c')](_0x36bdcb[_0xe4ab('0x24')]);_0x36bdcb[_0xe4ab('0x4d')]=intUtil[_0xe4ab('0x4c')](_0x36bdcb[_0xe4ab('0x4d')]);if(_0x49c38b&&_0x49c38b[_0xe4ab('0x62')]&&_0x49c38b[_0xe4ab('0x62')]!==_0xe4ab('0x63')){logger[_0xe4ab('0xb')](_0xe4ab('0x64'),_0xe4ab('0x65'));_0x266e30['recordingURL']=util[_0xe4ab('0xd')](_0xe4ab('0x66'),_0x36bdcb[_0xe4ab('0x4d')],_0x266e30[_0xe4ab('0x67')],md5(_0x266e30[_0xe4ab('0x67')]));}headers[_0xe4ab('0x50')]=getAuth(_0x36bdcb);return getUser(_0x36bdcb,_0x18f9e3[_0xe4ab('0x51')])['then'](function(_0x135175){_0x40d7c6=_0x135175;logger[_0xe4ab('0xb')](_0xe4ab('0x68'),_0x40d7c6['id']);return getEndUser(_0x36bdcb,_0x266e30[_0xe4ab('0x69')],_0x266e30['destcalleridnum']);})[_0xe4ab('0x16')](function(_0x3b3664){_0x5d49c7=_0x3b3664;logger[_0xe4ab('0xb')](_0xe4ab('0x52'),_0x5d49c7['id']);return getTicket(_0x36bdcb,_0x40d7c6,_0x5d49c7,_0x15fc69,_0x266e30);})[_0xe4ab('0x16')](function(_0x316248){if(_0x316248){logger[_0xe4ab('0xb')](_0xe4ab('0x53'),_0x316248['id']);switch(_0x36bdcb[_0xe4ab('0x40')]){case'integrationTab':logger[_0xe4ab('0xb')]('[OUTBOUND]',_0xe4ab('0x55'));return request({'uri':util[_0xe4ab('0xd')](_0xe4ab('0x56'),_0x36bdcb[_0xe4ab('0x24')],_0x40d7c6['id'],_0x316248['id']),'method':_0xe4ab('0xf')});case _0xe4ab('0x57'):logger[_0xe4ab('0xb')](_0xe4ab('0x64'),_0xe4ab('0x58'));emit(util[_0xe4ab('0xd')](_0xe4ab('0x59'),_0x18f9e3[_0xe4ab('0x12')]),_0xe4ab('0x5a'),{'uri':util[_0xe4ab('0xd')]('%s/agent/tickets/%s',_0x36bdcb['remoteUri'][_0xe4ab('0x5c')](_0xe4ab('0x6a'),''),_0x316248['id'])});break;default:logger[_0xe4ab('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x27c068){logger[_0xe4ab('0x5d')](_0xe4ab('0x6b'),util[_0xe4ab('0x61')](_0x27c068,{'showHidden':!![],'depth':null}));});};exports[_0xe4ab('0x6c')]=function(_0x3d986e,_0x67f2cb,_0x377daf,_0x35c61a,_0x184b69,_0x1c4536){var _0x15984f,_0x1b8bf0;_0x1c4536[_0xe4ab('0x24')]=intUtil[_0xe4ab('0x4c')](_0x1c4536[_0xe4ab('0x24')]);_0x1c4536['serverUrl']=intUtil['stripTrailingSlash'](_0x1c4536['serverUrl']);if(_0x184b69&&_0x184b69[_0xe4ab('0x6d')]){logger['info']('['+_0x67f2cb[_0xe4ab('0x6e')][_0xe4ab('0x6f')]()+']',_0xe4ab('0x65'));_0x67f2cb[_0xe4ab('0x4f')]=util[_0xe4ab('0xd')](_0xe4ab('0x66'),_0x1c4536[_0xe4ab('0x4d')],_0x67f2cb[_0xe4ab('0x67')],md5(_0x67f2cb['uniqueid']));}else{_0x67f2cb['recordingURL']='';}headers[_0xe4ab('0x50')]=getAuth(_0x1c4536);return getUser(_0x1c4536)[_0xe4ab('0x16')](function(_0x57e506){_0x15984f=_0x57e506;logger[_0xe4ab('0xb')](_0xe4ab('0x68'),_0x15984f['id']);return getEndUser(_0x1c4536,_0x67f2cb[_0xe4ab('0x70')],_0x67f2cb[_0xe4ab('0x71')]);})[_0xe4ab('0x16')](function(_0x34e395){_0x1b8bf0=_0x34e395;logger['info'](_0xe4ab('0x52'),_0x1b8bf0['id']);return getTicket(_0x1c4536,_0x15984f,_0x1b8bf0,_0x377daf,_0x67f2cb);})['then'](function(_0x163069){if(_0x163069){logger['info']('The\x20Ticket\x20ID\x20is:',_0x163069['id']);}})[_0xe4ab('0x5f')](function(_0xafd750){logger[_0xe4ab('0x5d')]('['+_0x67f2cb[_0xe4ab('0x6e')][_0xe4ab('0x6f')]()+']'+_0xe4ab('0x72'),util[_0xe4ab('0x61')](_0xafd750,{'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 72b1691..1193da7 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 _0x31f0=['clientSecret','refresh_token','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','name','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','getString','Subjects','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','user:%s','toUpperCase','lodash','request-promise','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','variable','variableName','toString','customVariable','Variable','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId'];(function(_0x3d9dfd,_0x1f6811){var _0x56156e=function(_0x2a7796){while(--_0x2a7796){_0x3d9dfd['push'](_0x3d9dfd['shift']());}};_0x56156e(++_0x1f6811);}(_0x31f0,0x1a0));var _0x031f=function(_0x1ed7b8,_0x48df9a){_0x1ed7b8=_0x1ed7b8-0x0;var _0x40e035=_0x31f0[_0x1ed7b8];return _0x40e035;};'use strict';var _=require(_0x031f('0x0'));var rp=require(_0x031f('0x1'));var md5=require('md5');var util=require(_0x031f('0x2'));var intUtil=require('./util');var moment=require(_0x031f('0x3'));var Redis=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var config=require(_0x031f('0x6'));var logger=require(_0x031f('0x7'))(_0x031f('0x8'));config[_0x031f('0x9')]=_['defaults'](config[_0x031f('0x9')],{'host':_0x031f('0xa'),'port':0x18eb});var io=require(_0x031f('0xb'))(new Redis(config[_0x031f('0x9')]));function emit(_0x4bd5dd,_0xb856c1,_0x2e7017){io['to'](_0x4bd5dd)[_0x031f('0xc')](_0xb856c1,_0x2e7017);}function request(_0xcfa1be){logger[_0x031f('0xd')](_0x031f('0xe'),JSON[_0x031f('0xf')](_0xcfa1be));return rp(_0xcfa1be);}function getCustomFields(_0x16412f,_0x408202){var _0x19abea={};if(_0x16412f[_0x031f('0x10')]>0x0){_[_0x031f('0x11')](_0x16412f,function(_0x6eceb6){if(_[_0x031f('0x12')](['string',_0x031f('0x13')],_0x6eceb6[_0x031f('0x14')])&&_0x6eceb6[_0x031f('0x15')]){_0x19abea[_0x6eceb6[_0x031f('0x15')]]=_0x6eceb6['content']['toString']();}else if(_0x6eceb6[_0x031f('0x14')]===_0x031f('0x16')&&_0x6eceb6[_0x031f('0x17')]&&_0x6eceb6[_0x031f('0x15')]&&_0x408202[_0x6eceb6[_0x031f('0x17')]]){_0x19abea[_0x6eceb6[_0x031f('0x15')]]=_0x408202[_0x6eceb6[_0x031f('0x17')]][_0x031f('0x18')]();}else if(_0x6eceb6[_0x031f('0x14')]===_0x031f('0x19')&&_0x6eceb6[_0x031f('0x1a')]&&_0x6eceb6['Variable']['name']&&_0x6eceb6[_0x031f('0x15')]&&_0x408202[_0x6eceb6[_0x031f('0x1a')]['name'][_0x031f('0x1b')]()]){_0x19abea[_0x6eceb6['idField']]=_0x408202[_0x6eceb6[_0x031f('0x1a')]['name'][_0x031f('0x1b')]()][_0x031f('0x18')]();}});}return _0x19abea;}function getName(_0x2bd85c){if(_0x2bd85c[_0x031f('0x1c')]('\x20')>0x0){var _0x3c8cb1=_0x2bd85c['split'](/ (.+)/);if(_0x3c8cb1[0x1]){return _0x3c8cb1;}}return[_0x2bd85c,_0x2bd85c];}var accountsTokens={};function getAccessToken(_0x4a91d3){return new Promise(function(_0x141f56,_0xd3352d){if(!_[_0x031f('0x1d')](accountsTokens[_0x4a91d3['id']])&&!_[_0x031f('0x1d')](accountsTokens[_0x4a91d3['id']][_0x031f('0x1e')])){if(moment()[_0x031f('0x1f')](accountsTokens[_0x4a91d3['id']][_0x031f('0x20')])){_0x141f56(accountsTokens[_0x4a91d3['id']]['access_token']);}}var _0x1694e9;switch(_0x4a91d3['zone']){case'US':_0x1694e9=_0x031f('0x21');break;case'AU':_0x1694e9='https://accounts.zoho.com.au';break;case'EU':_0x1694e9=_0x031f('0x22');break;case'IN':_0x1694e9=_0x031f('0x23');break;case'CN':_0x1694e9=_0x031f('0x24');break;default:_0x1694e9=_0x031f('0x22');break;}var _0x36cf57={'method':_0x031f('0x25'),'uri':_0x1694e9+_0x031f('0x26'),'qs':{'refresh_token':_0x4a91d3['refreshToken'],'client_id':_0x4a91d3[_0x031f('0x27')],'client_secret':_0x4a91d3[_0x031f('0x28')],'grant_type':_0x031f('0x29')},'json':!![]};return rp(_0x36cf57)['then'](function(_0x45139c){accountsTokens[_0x4a91d3['id']]={'access_token':_0x45139c[_0x031f('0x1e')],'expires_in':moment()['add'](_0x45139c[_0x031f('0x20')],_0x031f('0x2a'))};_0x141f56(_0x45139c[_0x031f('0x1e')]);})[_0x031f('0x2b')](function(_0x3d21f0){logger[_0x031f('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x3d21f0['stack']);_0xd3352d(_0x3d21f0);});});}function getUser(_0x22f781,_0xc8b30d,_0x1a86c,_0x483851){logger[_0x031f('0x2d')](_0x031f('0x2e'));return request({'method':_0x031f('0x2f'),'uri':util[_0x031f('0x30')](_0x031f('0x31'),_0xc8b30d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x031f('0x32')+_0x22f781},'json':!![]})[_0x031f('0x33')](function(_0x1ab378){if(_0x1ab378[_0x031f('0x34')]){var _0x85d559=-0x1;if(_[_0x031f('0x35')](_0x1ab378['users'])){if(!_['isNil'](_0x483851)){_0x85d559=_['findIndex'](_0x1ab378[_0x031f('0x34')],function(_0x436ecc){return _0x436ecc['email']===_0x483851;});}if(_0x85d559>=0x0){logger[_0x031f('0x2d')](_0x031f('0x36'));}else{logger['info'](_0x031f('0x37'));_0x85d559=_['findIndex'](_0x1ab378[_0x031f('0x34')],function(_0x57aa22){return _0x57aa22[_0x031f('0x38')][_0x031f('0x39')]==='Administrator';});}return _0x1ab378[_0x031f('0x34')][_0x85d559];}else{if(_0x1ab378[_0x031f('0x3a')]['profile'][_0x031f('0x39')]===_0x031f('0x3b')){logger[_0x031f('0x2d')](_0x031f('0x37'));user=_0x1ab378[_0x031f('0x3a')];return user;}else{logger['error'](_0x031f('0x3c'),JSON[_0x031f('0xf')](_0x1ab378));throw new Error(_0x031f('0x3d')+JSON[_0x031f('0xf')](_0x1ab378));}}}else{logger['error'](_0x031f('0x3c'),JSON[_0x031f('0xf')](_0x1ab378));throw new Error(_0x031f('0x3d')+JSON['stringify'](_0x1ab378));}})[_0x031f('0x2b')](function(_0x24a42b){console[_0x031f('0x2c')](_0x24a42b);});}function getZohoUser(_0x15d650,_0x6d3bc1){return new BPromise(function(_0x44a3ce,_0x51a5c4){request(_0x15d650)[_0x031f('0x33')](function(_0x31b9e6){var _0x44dfbd=null;if(_0x31b9e6){_0x44dfbd=_0x31b9e6[_0x031f('0x3e')][0x0];_0x44dfbd['enduserType']=_0x6d3bc1;}_0x44a3ce(_0x44dfbd);})[_0x031f('0x2b')](function(_0x4b1f9f){_0x51a5c4(_0x4b1f9f);});});}function createEndUser(_0x443d67,_0x50377c,_0xf3f173,_0x41a6b7,_0x380609,_0x56a8a7){var _0xf3f173=getName(_0xf3f173);return request({'method':_0x031f('0x25'),'uri':_0x031f('0x3f')+_0x50377c+'/crm/v2/'+_[_0x031f('0x40')](_0x56a8a7[_0x031f('0x41')])+'s','body':{'data':[{'Last_Name':_0xf3f173[0x1],'First_Name':_0xf3f173[0x0],'Phone':_0x41a6b7,'Owner':{'name':!_[_0x031f('0x1d')](_0x380609[_0x031f('0x42')][_0x031f('0x39')])?_0x380609[_0x031f('0x42')][_0x031f('0x39')]:!_['isNil'](_0x380609['first_name'])?_0x380609[_0x031f('0x43')]+'\x20'+_0x380609[_0x031f('0x44')]:_0x380609['last_name'],'id':_0x380609['id']}}]},'headers':{'Authorization':_0x031f('0x32')+_0x443d67},'json':!![]})[_0x031f('0x33')](function(_0x380a35){if(_0x380a35&&_0x380a35[_0x031f('0x3e')][0x0][_0x031f('0x45')]==='SUCCESS'){var _0x456433=_0x380a35[_0x031f('0x3e')][0x0][_0x031f('0x46')];_0x456433['enduserType']=_[_0x031f('0x40')](_0x56a8a7[_0x031f('0x41')])+'s';return _0x456433;}logger[_0x031f('0x2c')](_0x031f('0x3c'),JSON['stringify'](data));throw new Error(_0x031f('0x47')+JSON[_0x031f('0xf')](data));})[_0x031f('0x2b')](function(_0x453863){console[_0x031f('0x48')](_0x031f('0x49'),_0x453863);});}function getEndUser(_0x2f91ce,_0x21c3a9,_0x5b7aef,_0x5dc27e,_0x212ff5,_0x43e9ab,_0x17be87){var _0xf080da={'method':_0x031f('0x2f'),'uri':'','headers':{'Authorization':_0x031f('0x32')+_0x2f91ce},'json':!![]};switch(_0x17be87[_0x031f('0x4a')]){case'contact_lead':_0xf080da[_0x031f('0x4b')]=_0x031f('0x3f')+_0x21c3a9+_0x031f('0x4c')+_0x212ff5+'))';return getZohoUser(_0xf080da,'Contacts')['then'](function(_0x42fa63){if(_0x42fa63)return _0x42fa63;_0xf080da['uri']=_0x031f('0x3f')+_0x21c3a9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x212ff5+'))';return getZohoUser(_0xf080da,_0x031f('0x4d'))[_0x031f('0x33')](function(_0x2e59bd){if(_0x2e59bd)return _0x2e59bd;if(_0x17be87[_0x031f('0x41')]!='nothing'){return createEndUser(_0x2f91ce,_0x21c3a9,_0x5dc27e,_0x212ff5,_0x43e9ab,_0x17be87);}else{return{};}});});break;case _0x031f('0x4e'):_0xf080da[_0x031f('0x4b')]=_0x031f('0x3f')+_0x21c3a9+_0x031f('0x4c')+_0x212ff5+'))';return getZohoUser(_0xf080da,'Contacts')[_0x031f('0x33')](function(_0x3163f3){if(_0x3163f3)return _0x3163f3;if(_0x17be87[_0x031f('0x41')]!=_0x031f('0x4f')){return createEndUser(_0x2f91ce,_0x21c3a9,_0x5dc27e,_0x212ff5,_0x43e9ab,_0x17be87);}else{return{};}});break;case _0x031f('0x50'):_0xf080da[_0x031f('0x4b')]=_0x031f('0x3f')+_0x21c3a9+_0x031f('0x51')+_0x212ff5+'))';return getZohoUser(_0xf080da,_0x031f('0x4d'))[_0x031f('0x33')](function(_0x393c82){if(_0x393c82)return _0x393c82;if(_0x17be87[_0x031f('0x41')]!='nothing'){return createEndUser(_0x2f91ce,_0x21c3a9,_0x5dc27e,_0x212ff5,_0x43e9ab,_0x17be87);}else{return{};}});break;}}function getCall(_0x11c452,_0x37320a,_0x5af1c3,_0x3801d6,_0x23344d,_0x38f71f,_0x27ce93,_0x26e167){logger[_0x031f('0x2d')](_0x031f('0x52'));var _0x159d46={};_0x159d46[_0x031f('0x53')]={'name':!_['isNil'](_0x3801d6[_0x031f('0x42')][_0x031f('0x39')])&&!_['isNil'](_0x3801d6[_0x031f('0x38')][_0x031f('0x39')])&&_0x3801d6[_0x031f('0x38')]['name']==='administrator'?_0x3801d6[_0x031f('0x42')][_0x031f('0x39')]:!_['isNil'](_0x3801d6[_0x031f('0x43')])?_0x3801d6[_0x031f('0x43')]+'\x20'+_0x3801d6[_0x031f('0x44')]:_0x3801d6[_0x031f('0x44')],'id':_0x3801d6['id']};_0x159d46['Subject']=intUtil[_0x031f('0x54')](_0x38f71f[_0x031f('0x55')],_0x27ce93,'\x20');_0x159d46['Description']=intUtil['getString'](_0x38f71f['Descriptions'],_0x27ce93,'\x0a');if(_0x23344d[_0x031f('0x56')]==='Contacts'){_0x159d46[_0x031f('0x57')]={'name':!_[_0x031f('0x1d')](_0x23344d[_0x031f('0x58')])?_0x23344d[_0x031f('0x58')]:!_[_0x031f('0x1d')](_0x23344d[_0x031f('0x59')])?_0x23344d[_0x031f('0x59')]+'\x20'+_0x23344d[_0x031f('0x5a')]:_0x23344d[_0x031f('0x5a')],'id':_0x23344d['id']};}if(_0x23344d[_0x031f('0x56')]===_0x031f('0x4d')){_0x159d46[_0x031f('0x5b')]={'name':!_[_0x031f('0x1d')](_0x23344d[_0x031f('0x58')])?_0x23344d[_0x031f('0x58')]:!_[_0x031f('0x1d')](_0x23344d[_0x031f('0x59')])?_0x23344d[_0x031f('0x59')]+'\x20'+_0x23344d[_0x031f('0x5a')]:_0x23344d[_0x031f('0x5a')],'id':_0x23344d['id']};_0x159d46[_0x031f('0x5c')]=_[_0x031f('0x40')](_0x23344d[_0x031f('0x56')]);}if(_0x27ce93[_0x031f('0x5d')]){_0x159d46[_0x031f('0x5e')]=moment[_0x031f('0x5f')](parseInt(_0x27ce93[_0x031f('0x5d')])*0x3e8)['format']('mm:ss');}else if(_0x27ce93['answertime']&&_0x27ce93[_0x031f('0x60')]){_0x159d46[_0x031f('0x5e')]=moment[_0x031f('0x5f')](moment(_0x27ce93[_0x031f('0x60')],_0x031f('0x61'))['diff'](moment(_0x27ce93[_0x031f('0x62')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x27ce93[_0x031f('0x63')]){case _0x031f('0x64'):_0x159d46['Call_Result']=_0x031f('0x65');break;case _0x031f('0x66'):case _0x031f('0x67'):_0x159d46[_0x031f('0x68')]=_0x031f('0x69');break;case _0x031f('0x6a'):_0x159d46[_0x031f('0x68')]=_0x031f('0x6b');break;case _0x031f('0x6c'):_0x159d46[_0x031f('0x68')]='Abandoned';break;case _0x031f('0x6d'):_0x159d46[_0x031f('0x68')]=_0x031f('0x6e');default:}_0x159d46[_0x031f('0x6f')]=(_0x26e167===_0x031f('0x70')?moment(_0x27ce93[_0x031f('0x62')])[_0x031f('0x30')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x27ce93[_0x031f('0x71')])[_0x031f('0x30')](_0x031f('0x61')))||moment()[_0x031f('0x30')](_0x031f('0x61'));_0x159d46[_0x031f('0x72')]=_0x26e167||_0x031f('0x73');_0x159d46=_['merge'](_0x159d46,getCustomFields(_0x38f71f[_0x031f('0x74')],_0x27ce93));return request({'method':_0x031f('0x25'),'uri':_0x031f('0x3f')+_0x37320a+_0x031f('0x75'),'headers':{'Authorization':_0x031f('0x32')+_0x11c452},'body':{'data':[_0x159d46]},'json':!![]})[_0x031f('0x33')](function(_0x1b8a44){if(_0x1b8a44&&_0x1b8a44[_0x031f('0x3e')][0x0][_0x031f('0x45')]===_0x031f('0x76')){logger['info'](_0x031f('0x77'));return{'id':_0x1b8a44[_0x031f('0x3e')][0x0]['details']['id']};}})[_0x031f('0x2b')](function(_0x5c701e){logger[_0x031f('0x2d')](_0x031f('0x78'),_0x5c701e[_0x031f('0x79')]);console['log'](_0x031f('0x78'),_0x5c701e);});}exports[_0x031f('0x7a')]=function(_0x1b59f1,_0x35f717,_0x3a1fea,_0x2a0dd2,_0xb002f,_0x507acf){var _0x5b27b6,_0x2c3cec,_0x5aaabe;_0x507acf[_0x031f('0x7b')]=intUtil[_0x031f('0x7c')](_0x507acf[_0x031f('0x7b')]);_0x507acf[_0x031f('0x7d')]=intUtil[_0x031f('0x7c')](_0x507acf[_0x031f('0x7d')]);if(_0xb002f&&_0xb002f[_0x031f('0x7e')]){logger['info'](_0x031f('0x7f'),'Recording\x20is\x20enabled!');_0x35f717['recordingURL']=_0x507acf[_0x031f('0x7d')]+_0x031f('0x80')+_0x35f717['uniqueid']+_0x031f('0x81')+md5(_0x35f717[_0x031f('0x82')]);}else{_0x35f717[_0x031f('0x83')]='';}var _0x553465=_0x507acf['host']===_0x031f('0x84')?'eu':_0x031f('0x85');return getAccessToken(_0x507acf)['then'](function(_0x51817e){_0x5aaabe=_0x51817e;return getUser(_0x5aaabe,_0x553465,_0x507acf,_0x2a0dd2[_0x031f('0x86')]);})[_0x031f('0x33')](function(_0x18603c){_0x5b27b6=_0x18603c;logger[_0x031f('0x2d')](_0x031f('0x87'),_0x5b27b6['id']);return getEndUser(_0x5aaabe,_0x553465,_0x507acf,_0x35f717[_0x031f('0x88')],_0x35f717[_0x031f('0x89')],_0x5b27b6,_0x3a1fea);})[_0x031f('0x33')](function(_0x1c3007){_0x2c3cec=_0x1c3007;return getCall(_0x5aaabe,_0x553465,_0x507acf,_0x5b27b6,_0x2c3cec,_0x3a1fea,_0x35f717,_0x031f('0x73'));})[_0x031f('0x33')](function(_0x2a582e){if(_0x2a582e){logger['info'](_0x031f('0x8a'),_0x2a582e['id']);logger[_0x031f('0x2d')](_0x031f('0x7f'),_0x031f('0x8b'));emit(util[_0x031f('0x30')]('user:%s',_0x2a0dd2['name']),_0x031f('0x8c'),{'uri':_0x031f('0x8d')+_0x507acf[_0x031f('0x7b')]+_0x031f('0x8e')+_0x2a582e['id']});}})[_0x031f('0x2b')](function(_0x27bc69){logger[_0x031f('0x2c')](_0x031f('0x7f'),JSON[_0x031f('0xf')](_0x27bc69));});};exports[_0x031f('0x70')]=function(_0x91a075,_0x4dd467,_0x58472d,_0x325665,_0x5a53f2,_0x3541dd,_0x193843){var _0x5628d0,_0x40f943,_0x39fd99;_0x3541dd[_0x031f('0x7b')]=intUtil[_0x031f('0x7c')](_0x3541dd[_0x031f('0x7b')]);_0x3541dd[_0x031f('0x7d')]=intUtil[_0x031f('0x7c')](_0x3541dd[_0x031f('0x7d')]);if(_0x193843&&_0x193843[_0x031f('0x8f')]&&_0x193843[_0x031f('0x8f')]!==_0x031f('0x90')){logger[_0x031f('0x2d')](_0x031f('0x91'),_0x031f('0x92'));_0x4dd467[_0x031f('0x83')]=_0x3541dd['serverUrl']+_0x031f('0x80')+_0x4dd467[_0x031f('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x4dd467['uniqueid']);}var _0x23ad8=_0x3541dd[_0x031f('0x7b')]===_0x031f('0x84')?'eu':_0x031f('0x85');return getAccessToken(_0x3541dd)['then'](function(_0x55d866){_0x39fd99=_0x55d866;return getUser(_0x39fd99,_0x23ad8,_0x3541dd,_0x325665[_0x031f('0x86')]);})['then'](function(_0xea931a){_0x5628d0=_0xea931a;logger['info']('The\x20User\x20ID\x20is:',_0x5628d0['id']);return getEndUser(_0x39fd99,_0x23ad8,_0x3541dd,_0x4dd467[_0x031f('0x93')],_0x4dd467[_0x031f('0x94')],_0x5628d0,_0x58472d);})['then'](function(_0x5b2932){_0x40f943=_0x5b2932;return getCall(_0x39fd99,_0x23ad8,_0x3541dd,_0x5628d0,_0x40f943,_0x58472d,_0x4dd467,_0x031f('0x95'));})['then'](function(_0x2737c0){if(_0x2737c0){logger[_0x031f('0x2d')](_0x031f('0x8a'),_0x2737c0['id']);logger[_0x031f('0x2d')](_0x031f('0x91'),_0x031f('0x8b'));emit(util['format'](_0x031f('0x96'),_0x325665[_0x031f('0x39')]),_0x031f('0x8c'),{'uri':'https://crm.'+_0x3541dd[_0x031f('0x7b')]+_0x031f('0x8e')+_0x2737c0['id']});}})[_0x031f('0x2b')](function(_0x418597){logger[_0x031f('0x2c')]('[OUTBOUND]',JSON[_0x031f('0xf')](_0x418597));});};exports['unmanaged']=function(_0x150649,_0x37ce16,_0x37e5bf,_0x59cd27,_0x3ee02e,_0x572b4b){var _0x25d28e,_0xbc0dbb,_0x1a9261;_0x572b4b[_0x031f('0x7b')]=intUtil['stripTrailingSlash'](_0x572b4b[_0x031f('0x7b')]);_0x572b4b[_0x031f('0x7d')]=intUtil[_0x031f('0x7c')](_0x572b4b[_0x031f('0x7d')]);if(_0x3ee02e&&_0x3ee02e['monitor_format']){logger[_0x031f('0x2d')]('['+_0x37ce16[_0x031f('0x63')][_0x031f('0x97')]()+']','Recording\x20is\x20enabled!');_0x37ce16[_0x031f('0x83')]=_0x572b4b[_0x031f('0x7d')]+_0x031f('0x80')+_0x37ce16[_0x031f('0x82')]+_0x031f('0x81')+md5(_0x37ce16[_0x031f('0x82')]);}else{_0x37ce16[_0x031f('0x83')]='';}var _0x733266=_0x572b4b['host']===_0x031f('0x84')?'eu':_0x031f('0x85');return getAccessToken(_0x572b4b)[_0x031f('0x33')](function(_0x339a07){_0x1a9261=_0x339a07;return getUser(_0x1a9261,_0x733266,_0x572b4b);})[_0x031f('0x33')](function(_0x366f35){_0x25d28e=_0x366f35;logger['info'](_0x031f('0x87'),_0x25d28e['id']);return getEndUser(_0x1a9261,_0x733266,_0x572b4b,_0x37ce16[_0x031f('0x88')],_0x37ce16[_0x031f('0x89')],_0x25d28e,_0x37e5bf);})[_0x031f('0x33')](function(_0x560ca4){_0xbc0dbb=_0x560ca4;return getCall(_0x1a9261,_0x733266,_0x572b4b,_0x25d28e,_0xbc0dbb,_0x37e5bf,_0x37ce16,_0x031f('0x73'));})['then'](function(_0x4b782b){if(_0x4b782b){logger[_0x031f('0x2d')](_0x031f('0x8a'),_0x4b782b['id']);}})[_0x031f('0x2b')](function(_0x3626e3){logger['error']('['+_0x37ce16['lastevent'][_0x031f('0x97')]()+']',JSON[_0x031f('0xf')](_0x3626e3));});}; \ No newline at end of file +var _0xd25f=['customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','catch','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','role','last_name','code','SUCCESS','data','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','moduleCreate','lead','Creating\x20new\x20call...','Owner','first_name','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','merge','Fields','POST','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','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','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','zoho.eu','Inbound','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','debug','stringify','length','includes','picklist','type','idField','toString','variableName'];(function(_0x493206,_0x6c3012){var _0x8d85d4=function(_0x1623db){while(--_0x1623db){_0x493206['push'](_0x493206['shift']());}};_0x8d85d4(++_0x6c3012);}(_0xd25f,0x84));var _0xfd25=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0xd25f[_0x20beae];return _0xf5725;};'use strict';var _=require(_0xfd25('0x0'));var rp=require(_0xfd25('0x1'));var md5=require('md5');var util=require(_0xfd25('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xfd25('0x3'));var BPromise=require('bluebird');var config=require(_0xfd25('0x4'));var logger=require(_0xfd25('0x5'))(_0xfd25('0x6'));config[_0xfd25('0x7')]=_[_0xfd25('0x8')](config['redis'],{'host':_0xfd25('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd25('0x7')]));function emit(_0x377abd,_0x3ab055,_0x5bce9e){io['to'](_0x377abd)['emit'](_0x3ab055,_0x5bce9e);}function request(_0x2391ba){logger[_0xfd25('0xa')]('[HTTP]',JSON[_0xfd25('0xb')](_0x2391ba));return rp(_0x2391ba);}function getCustomFields(_0x27ef0b,_0x5b71d6){var _0x4885ac={};if(_0x27ef0b[_0xfd25('0xc')]>0x0){_['forEach'](_0x27ef0b,function(_0x452572){if(_[_0xfd25('0xd')](['string',_0xfd25('0xe')],_0x452572[_0xfd25('0xf')])&&_0x452572[_0xfd25('0x10')]){_0x4885ac[_0x452572[_0xfd25('0x10')]]=_0x452572['content'][_0xfd25('0x11')]();}else if(_0x452572['type']==='variable'&&_0x452572[_0xfd25('0x12')]&&_0x452572[_0xfd25('0x10')]&&_0x5b71d6[_0x452572[_0xfd25('0x12')]]){_0x4885ac[_0x452572['idField']]=_0x5b71d6[_0x452572['variableName']][_0xfd25('0x11')]();}else if(_0x452572['type']===_0xfd25('0x13')&&_0x452572[_0xfd25('0x14')]&&_0x452572[_0xfd25('0x14')][_0xfd25('0x15')]&&_0x452572['idField']&&_0x5b71d6[_0x452572[_0xfd25('0x14')][_0xfd25('0x15')][_0xfd25('0x16')]()]){_0x4885ac[_0x452572[_0xfd25('0x10')]]=_0x5b71d6[_0x452572[_0xfd25('0x14')]['name']['toLowerCase']()][_0xfd25('0x11')]();}});}return _0x4885ac;}function getName(_0x468b9a){if(_0x468b9a[_0xfd25('0x17')]('\x20')>0x0){var _0x385e96=_0x468b9a[_0xfd25('0x18')](/ (.+)/);if(_0x385e96[0x1]){return _0x385e96;}}return[_0x468b9a,_0x468b9a];}var accountsTokens={};function getAccessToken(_0x1ef5e9){return new Promise(function(_0x304c53,_0x5d614d){if(!_[_0xfd25('0x19')](accountsTokens[_0x1ef5e9['id']])&&!_[_0xfd25('0x19')](accountsTokens[_0x1ef5e9['id']][_0xfd25('0x1a')])){if(moment()[_0xfd25('0x1b')](accountsTokens[_0x1ef5e9['id']][_0xfd25('0x1c')])){_0x304c53(accountsTokens[_0x1ef5e9['id']][_0xfd25('0x1a')]);}}var _0x5e883d;switch(_0x1ef5e9[_0xfd25('0x1d')]){case'US':_0x5e883d=_0xfd25('0x1e');break;case'AU':_0x5e883d=_0xfd25('0x1f');break;case'EU':_0x5e883d='https://accounts.zoho.eu';break;case'IN':_0x5e883d=_0xfd25('0x20');break;case'CN':_0x5e883d=_0xfd25('0x21');break;default:_0x5e883d=_0xfd25('0x22');break;}var _0x4d99d8={'method':'POST','uri':_0x5e883d+_0xfd25('0x23'),'qs':{'refresh_token':_0x1ef5e9[_0xfd25('0x24')],'client_id':_0x1ef5e9[_0xfd25('0x25')],'client_secret':_0x1ef5e9[_0xfd25('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4d99d8)[_0xfd25('0x27')](function(_0x381a5b){accountsTokens[_0x1ef5e9['id']]={'access_token':_0x381a5b[_0xfd25('0x1a')],'expires_in':moment()[_0xfd25('0x28')](_0x381a5b[_0xfd25('0x1c')],'seconds')};_0x304c53(_0x381a5b[_0xfd25('0x1a')]);})[_0xfd25('0x29')](function(_0x2f3cb4){logger['error'](_0xfd25('0x2a'),_0x2f3cb4['stack']);_0x5d614d(_0x2f3cb4);});});}function getUser(_0x423f0f,_0xfc293b,_0x2a56ba,_0x256a15){logger['info'](_0xfd25('0x2b'));return request({'method':_0xfd25('0x2c'),'uri':util[_0xfd25('0x2d')](_0xfd25('0x2e'),_0xfc293b),'qs':{'type':_0xfd25('0x2f')},'headers':{'Authorization':_0xfd25('0x30')+_0x423f0f},'json':!![]})['then'](function(_0x16dfc2){if(_0x16dfc2[_0xfd25('0x31')]){var _0x1e1d43=-0x1;if(_[_0xfd25('0x32')](_0x16dfc2[_0xfd25('0x31')])){if(!_['isNil'](_0x256a15)){_0x1e1d43=_[_0xfd25('0x33')](_0x16dfc2['users'],function(_0x3ab9ea){return _0x3ab9ea[_0xfd25('0x34')]===_0x256a15;});}if(_0x1e1d43>=0x0){logger[_0xfd25('0x35')]('Agent\x20found!');}else{logger['info'](_0xfd25('0x36'));_0x1e1d43=_[_0xfd25('0x33')](_0x16dfc2['users'],function(_0x16f7ef){return _0x16f7ef[_0xfd25('0x37')][_0xfd25('0x15')]===_0xfd25('0x38');});}return _0x16dfc2[_0xfd25('0x31')][_0x1e1d43];}else{if(_0x16dfc2['user'][_0xfd25('0x37')]['name']===_0xfd25('0x38')){logger['info'](_0xfd25('0x36'));user=_0x16dfc2['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xfd25('0xb')](_0x16dfc2));throw new Error(_0xfd25('0x39')+JSON['stringify'](_0x16dfc2));}}}else{logger[_0xfd25('0x3a')](_0xfd25('0x3b'),JSON[_0xfd25('0xb')](_0x16dfc2));throw new Error(_0xfd25('0x39')+JSON['stringify'](_0x16dfc2));}})[_0xfd25('0x29')](function(_0x4f35ba){console[_0xfd25('0x3a')](_0x4f35ba);});}function getZohoUser(_0x5ba4b4,_0x42c898){return new BPromise(function(_0x484eda,_0x3d787e){request(_0x5ba4b4)[_0xfd25('0x27')](function(_0x4656bb){var _0x4670b7=null;if(_0x4656bb){_0x4670b7=_0x4656bb['data'][0x0];_0x4670b7[_0xfd25('0x3c')]=_0x42c898;}_0x484eda(_0x4670b7);})[_0xfd25('0x29')](function(_0x169815){_0x3d787e(_0x169815);});});}function createEndUser(_0x53cdd1,_0x2da920,_0x4ccc32,_0x2d9b28,_0x311776,_0x27c4d7){var _0x4ccc32=getName(_0x4ccc32);return request({'method':'POST','uri':_0xfd25('0x3d')+_0x2da920+_0xfd25('0x3e')+_['startCase'](_0x27c4d7['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4ccc32[0x1],'First_Name':_0x4ccc32[0x0],'Phone':_0x2d9b28,'Owner':{'name':!_[_0xfd25('0x19')](_0x311776[_0xfd25('0x3f')]['name'])?_0x311776[_0xfd25('0x3f')][_0xfd25('0x15')]:!_[_0xfd25('0x19')](_0x311776['first_name'])?_0x311776['first_name']+'\x20'+_0x311776['last_name']:_0x311776[_0xfd25('0x40')],'id':_0x311776['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53cdd1},'json':!![]})['then'](function(_0x4f59a3){if(_0x4f59a3&&_0x4f59a3['data'][0x0][_0xfd25('0x41')]===_0xfd25('0x42')){var _0x494919=_0x4f59a3[_0xfd25('0x43')][0x0][_0xfd25('0x44')];_0x494919[_0xfd25('0x3c')]=_[_0xfd25('0x45')](_0x27c4d7['moduleCreate'])+'s';return _0x494919;}logger[_0xfd25('0x3a')](_0xfd25('0x3b'),JSON[_0xfd25('0xb')](data));throw new Error(_0xfd25('0x46')+JSON['stringify'](data));})[_0xfd25('0x29')](function(_0x3dacc5){console[_0xfd25('0x47')](_0xfd25('0x48'),_0x3dacc5);});}function getEndUser(_0x15d6d5,_0x40ed8b,_0xb9faf8,_0x37ad44,_0x10a6b2,_0x3b36b6,_0x4d6ea9){var _0x32bb23={'method':_0xfd25('0x2c'),'uri':'','headers':{'Authorization':_0xfd25('0x30')+_0x15d6d5},'json':!![]};switch(_0x4d6ea9[_0xfd25('0x49')]){case _0xfd25('0x4a'):_0x32bb23[_0xfd25('0x4b')]='https://www.zohoapis.'+_0x40ed8b+_0xfd25('0x4c')+_0x10a6b2+'))';return getZohoUser(_0x32bb23,_0xfd25('0x4d'))[_0xfd25('0x27')](function(_0x56f415){if(_0x56f415)return _0x56f415;_0x32bb23[_0xfd25('0x4b')]=_0xfd25('0x3d')+_0x40ed8b+_0xfd25('0x4e')+_0x10a6b2+'))';return getZohoUser(_0x32bb23,_0xfd25('0x4f'))[_0xfd25('0x27')](function(_0x2ecbb6){if(_0x2ecbb6)return _0x2ecbb6;if(_0x4d6ea9['moduleCreate']!=_0xfd25('0x50')){return createEndUser(_0x15d6d5,_0x40ed8b,_0x37ad44,_0x10a6b2,_0x3b36b6,_0x4d6ea9);}else{return{};}});});break;case _0xfd25('0x51'):_0x32bb23['uri']=_0xfd25('0x3d')+_0x40ed8b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x10a6b2+'))';return getZohoUser(_0x32bb23,_0xfd25('0x4d'))[_0xfd25('0x27')](function(_0x3e651e){if(_0x3e651e)return _0x3e651e;if(_0x4d6ea9[_0xfd25('0x52')]!=_0xfd25('0x50')){return createEndUser(_0x15d6d5,_0x40ed8b,_0x37ad44,_0x10a6b2,_0x3b36b6,_0x4d6ea9);}else{return{};}});break;case _0xfd25('0x53'):_0x32bb23[_0xfd25('0x4b')]=_0xfd25('0x3d')+_0x40ed8b+_0xfd25('0x4e')+_0x10a6b2+'))';return getZohoUser(_0x32bb23,'Leads')[_0xfd25('0x27')](function(_0x471ee1){if(_0x471ee1)return _0x471ee1;if(_0x4d6ea9[_0xfd25('0x52')]!=_0xfd25('0x50')){return createEndUser(_0x15d6d5,_0x40ed8b,_0x37ad44,_0x10a6b2,_0x3b36b6,_0x4d6ea9);}else{return{};}});break;}}function getCall(_0x5382fa,_0x5580cf,_0x5e2f88,_0x3a854e,_0x4a880e,_0x47808e,_0x38d100,_0x225e79){logger[_0xfd25('0x35')](_0xfd25('0x54'));var _0x1dae7c={};_0x1dae7c[_0xfd25('0x55')]={'name':!_[_0xfd25('0x19')](_0x3a854e[_0xfd25('0x3f')][_0xfd25('0x15')])&&!_['isNil'](_0x3a854e[_0xfd25('0x37')][_0xfd25('0x15')])&&_0x3a854e[_0xfd25('0x37')]['name']==='administrator'?_0x3a854e[_0xfd25('0x3f')][_0xfd25('0x15')]:!_['isNil'](_0x3a854e[_0xfd25('0x56')])?_0x3a854e[_0xfd25('0x56')]+'\x20'+_0x3a854e[_0xfd25('0x40')]:_0x3a854e[_0xfd25('0x40')],'id':_0x3a854e['id']};_0x1dae7c['Subject']=intUtil['getString'](_0x47808e[_0xfd25('0x57')],_0x38d100,'\x20');_0x1dae7c[_0xfd25('0x58')]=intUtil['getString'](_0x47808e[_0xfd25('0x59')],_0x38d100,'\x0a');if(_0x4a880e['enduserType']==='Contacts'){_0x1dae7c['Who_Id']={'name':!_[_0xfd25('0x19')](_0x4a880e[_0xfd25('0x5a')])?_0x4a880e['Full_Name']:!_['isNil'](_0x4a880e['First_Name'])?_0x4a880e[_0xfd25('0x5b')]+'\x20'+_0x4a880e[_0xfd25('0x5c')]:_0x4a880e['Last_Name'],'id':_0x4a880e['id']};}if(_0x4a880e[_0xfd25('0x3c')]===_0xfd25('0x4f')){_0x1dae7c['What_Id']={'name':!_[_0xfd25('0x19')](_0x4a880e[_0xfd25('0x5a')])?_0x4a880e[_0xfd25('0x5a')]:!_['isNil'](_0x4a880e[_0xfd25('0x5b')])?_0x4a880e[_0xfd25('0x5b')]+'\x20'+_0x4a880e[_0xfd25('0x5c')]:_0x4a880e['Last_Name'],'id':_0x4a880e['id']};_0x1dae7c[_0xfd25('0x5d')]=_[_0xfd25('0x45')](_0x4a880e['enduserType']);}if(_0x38d100[_0xfd25('0x5e')]){_0x1dae7c[_0xfd25('0x5f')]=moment[_0xfd25('0x60')](parseInt(_0x38d100[_0xfd25('0x5e')])*0x3e8)[_0xfd25('0x2d')](_0xfd25('0x61'));}else if(_0x38d100['answertime']&&_0x38d100['endtime']){_0x1dae7c['Call_Duration']=moment['utc'](moment(_0x38d100[_0xfd25('0x62')],_0xfd25('0x63'))[_0xfd25('0x64')](moment(_0x38d100[_0xfd25('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0xfd25('0x2d')](_0xfd25('0x61'));}switch(_0x38d100[_0xfd25('0x66')]){case _0xfd25('0x67'):_0x1dae7c[_0xfd25('0x68')]=_0xfd25('0x69');break;case _0xfd25('0x6a'):case'connect':_0x1dae7c[_0xfd25('0x68')]=_0xfd25('0x6b');break;case _0xfd25('0x6c'):_0x1dae7c[_0xfd25('0x68')]=_0xfd25('0x6d');break;case _0xfd25('0x6e'):_0x1dae7c[_0xfd25('0x68')]=_0xfd25('0x6f');break;case'timeout':_0x1dae7c[_0xfd25('0x68')]=_0xfd25('0x70');default:}_0x1dae7c['Call_Start_Time']=(_0x225e79===_0xfd25('0x71')?moment(_0x38d100['starttime'])['format'](_0xfd25('0x63')):moment(_0x38d100[_0xfd25('0x72')])[_0xfd25('0x2d')](_0xfd25('0x63')))||moment()[_0xfd25('0x2d')](_0xfd25('0x63'));_0x1dae7c['Call_Type']=_0x225e79||'Inbound';_0x1dae7c=_[_0xfd25('0x73')](_0x1dae7c,getCustomFields(_0x47808e[_0xfd25('0x74')],_0x38d100));return request({'method':_0xfd25('0x75'),'uri':_0xfd25('0x3d')+_0x5580cf+'/crm/v2/Calls','headers':{'Authorization':_0xfd25('0x30')+_0x5382fa},'body':{'data':[_0x1dae7c]},'json':!![]})[_0xfd25('0x27')](function(_0x29a50c){if(_0x29a50c&&_0x29a50c['data'][0x0][_0xfd25('0x41')]===_0xfd25('0x42')){logger['info'](_0xfd25('0x76'));return{'id':_0x29a50c['data'][0x0]['details']['id']};}})[_0xfd25('0x29')](function(_0x139ea5){logger['info'](_0xfd25('0x77'),_0x139ea5[_0xfd25('0x78')]);console[_0xfd25('0x47')](_0xfd25('0x77'),_0x139ea5);});}exports[_0xfd25('0x79')]=function(_0x23ef0a,_0x5c0bd5,_0x1f5497,_0x1d6da5,_0xda1e9b,_0x7e926b){var _0x3a7fa9,_0x4c3ef4,_0x5afbe8;_0x7e926b['host']=intUtil[_0xfd25('0x7a')](_0x7e926b[_0xfd25('0x7b')]);_0x7e926b[_0xfd25('0x7c')]=intUtil[_0xfd25('0x7a')](_0x7e926b['serverUrl']);if(_0xda1e9b&&_0xda1e9b['monitor_format']){logger[_0xfd25('0x35')](_0xfd25('0x7d'),_0xfd25('0x7e'));_0x5c0bd5['recordingURL']=_0x7e926b[_0xfd25('0x7c')]+_0xfd25('0x7f')+_0x5c0bd5[_0xfd25('0x80')]+_0xfd25('0x81')+md5(_0x5c0bd5[_0xfd25('0x80')]);}else{_0x5c0bd5[_0xfd25('0x82')]='';}var _0x1f4699=_0x7e926b[_0xfd25('0x7b')]==='zoho.eu'?'eu':_0xfd25('0x83');return getAccessToken(_0x7e926b)[_0xfd25('0x27')](function(_0x1df909){_0x5afbe8=_0x1df909;return getUser(_0x5afbe8,_0x1f4699,_0x7e926b,_0x1d6da5[_0xfd25('0x34')]);})[_0xfd25('0x27')](function(_0x14ff8a){_0x3a7fa9=_0x14ff8a;logger['info'](_0xfd25('0x84'),_0x3a7fa9['id']);return getEndUser(_0x5afbe8,_0x1f4699,_0x7e926b,_0x5c0bd5[_0xfd25('0x85')],_0x5c0bd5[_0xfd25('0x86')],_0x3a7fa9,_0x1f5497);})['then'](function(_0x39b517){_0x4c3ef4=_0x39b517;return getCall(_0x5afbe8,_0x1f4699,_0x7e926b,_0x3a7fa9,_0x4c3ef4,_0x1f5497,_0x5c0bd5,'Inbound');})['then'](function(_0x58d400){if(_0x58d400){logger['info'](_0xfd25('0x87'),_0x58d400['id']);logger[_0xfd25('0x35')]('[QUEUE]',_0xfd25('0x88'));emit(util['format'](_0xfd25('0x89'),_0x1d6da5[_0xfd25('0x15')]),_0xfd25('0x8a'),{'uri':_0xfd25('0x8b')+_0x7e926b['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x58d400['id']});}})[_0xfd25('0x29')](function(_0x136e67){logger[_0xfd25('0x3a')]('[QUEUE]',JSON[_0xfd25('0xb')](_0x136e67));});};exports['outbound']=function(_0x481c3b,_0x438e3b,_0xd888d8,_0x5add17,_0x48f3db,_0x134918,_0x15aa94){var _0xb030a9,_0x1c69e0,_0x5069ba;_0x134918['host']=intUtil[_0xfd25('0x7a')](_0x134918['host']);_0x134918['serverUrl']=intUtil[_0xfd25('0x7a')](_0x134918[_0xfd25('0x7c')]);if(_0x15aa94&&_0x15aa94[_0xfd25('0x8c')]&&_0x15aa94[_0xfd25('0x8c')]!==_0xfd25('0x8d')){logger[_0xfd25('0x35')](_0xfd25('0x8e'),_0xfd25('0x7e'));_0x438e3b[_0xfd25('0x82')]=_0x134918[_0xfd25('0x7c')]+'/api/voice/recordings/'+_0x438e3b[_0xfd25('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x438e3b[_0xfd25('0x80')]);}var _0x536c38=_0x134918[_0xfd25('0x7b')]==='zoho.eu'?'eu':_0xfd25('0x83');return getAccessToken(_0x134918)[_0xfd25('0x27')](function(_0x32196c){_0x5069ba=_0x32196c;return getUser(_0x5069ba,_0x536c38,_0x134918,_0x5add17['email']);})[_0xfd25('0x27')](function(_0x43322c){_0xb030a9=_0x43322c;logger[_0xfd25('0x35')]('The\x20User\x20ID\x20is:',_0xb030a9['id']);return getEndUser(_0x5069ba,_0x536c38,_0x134918,_0x438e3b[_0xfd25('0x8f')],_0x438e3b['destcalleridnum'],_0xb030a9,_0xd888d8);})[_0xfd25('0x27')](function(_0x236668){_0x1c69e0=_0x236668;return getCall(_0x5069ba,_0x536c38,_0x134918,_0xb030a9,_0x1c69e0,_0xd888d8,_0x438e3b,_0xfd25('0x90'));})[_0xfd25('0x27')](function(_0x8dbb64){if(_0x8dbb64){logger[_0xfd25('0x35')](_0xfd25('0x87'),_0x8dbb64['id']);logger[_0xfd25('0x35')]('[OUTBOUND]',_0xfd25('0x88'));emit(util['format'](_0xfd25('0x89'),_0x5add17[_0xfd25('0x15')]),_0xfd25('0x8a'),{'uri':_0xfd25('0x8b')+_0x134918[_0xfd25('0x7b')]+_0xfd25('0x91')+_0x8dbb64['id']});}})['catch'](function(_0x35c04f){logger[_0xfd25('0x3a')](_0xfd25('0x8e'),JSON['stringify'](_0x35c04f));});};exports[_0xfd25('0x92')]=function(_0x4f61e6,_0x11dbf2,_0x3acb47,_0x3f6e37,_0x1a47a8,_0x19effc){var _0x4fd79f,_0x4ea5a3,_0x41bba1;_0x19effc[_0xfd25('0x7b')]=intUtil[_0xfd25('0x7a')](_0x19effc[_0xfd25('0x7b')]);_0x19effc[_0xfd25('0x7c')]=intUtil['stripTrailingSlash'](_0x19effc[_0xfd25('0x7c')]);if(_0x1a47a8&&_0x1a47a8[_0xfd25('0x93')]){logger[_0xfd25('0x35')]('['+_0x11dbf2[_0xfd25('0x66')][_0xfd25('0x94')]()+']',_0xfd25('0x7e'));_0x11dbf2[_0xfd25('0x82')]=_0x19effc[_0xfd25('0x7c')]+_0xfd25('0x7f')+_0x11dbf2[_0xfd25('0x80')]+_0xfd25('0x81')+md5(_0x11dbf2[_0xfd25('0x80')]);}else{_0x11dbf2[_0xfd25('0x82')]='';}var _0x1e12b7=_0x19effc['host']===_0xfd25('0x95')?'eu':_0xfd25('0x83');return getAccessToken(_0x19effc)['then'](function(_0x4be072){_0x41bba1=_0x4be072;return getUser(_0x41bba1,_0x1e12b7,_0x19effc);})[_0xfd25('0x27')](function(_0x4f01ae){_0x4fd79f=_0x4f01ae;logger[_0xfd25('0x35')](_0xfd25('0x84'),_0x4fd79f['id']);return getEndUser(_0x41bba1,_0x1e12b7,_0x19effc,_0x11dbf2[_0xfd25('0x85')],_0x11dbf2['calleridnum'],_0x4fd79f,_0x3acb47);})['then'](function(_0x69ffe9){_0x4ea5a3=_0x69ffe9;return getCall(_0x41bba1,_0x1e12b7,_0x19effc,_0x4fd79f,_0x4ea5a3,_0x3acb47,_0x11dbf2,_0xfd25('0x96'));})[_0xfd25('0x27')](function(_0x38d18e){if(_0x38d18e){logger['info'](_0xfd25('0x87'),_0x38d18e['id']);}})[_0xfd25('0x29')](function(_0x22be5e){logger[_0xfd25('0x3a')]('['+_0x11dbf2[_0xfd25('0x66')]['toUpperCase']()+']',JSON['stringify'](_0x22be5e));});}; \ 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 7994dc7..eb2dee2 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 _0xee9f=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','../../../../config/logger','trigger','data2','Script','data3','render','error'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xee9f,0xab));var _0xfee9=function(_0x301bbc,_0x434a33){_0x301bbc=_0x301bbc-0x0;var _0x3bd743=_0xee9f[_0x301bbc];return _0x3bd743;};'use strict';var util=require(_0xfee9('0x0'));var sh=require(_0xfee9('0x1'));var Mustache=require('mustache');var logger=require(_0xfee9('0x2'))(_0xfee9('0x3'));exports['exec']=function(_0x356e10,_0x28b26a){var _0x1bf607=_0x356e10[_0xfee9('0x4')]?_0x356e10['data2']:_0xfee9('0x5');var _0x1995bf=_0x356e10[_0xfee9('0x6')]?Mustache[_0xfee9('0x7')](_0x356e10[_0xfee9('0x6')],_0x28b26a):_0x28b26a;sh['exec'](_0x1995bf,function(_0x29e1a6,_0x3946a2,_0x41e5da){if(_0x29e1a6!==0x0){logger[_0xfee9('0x8')](util[_0xfee9('0x9')](_0xfee9('0xa'),_0x1bf607,_0x1995bf,_0x29e1a6,_0x41e5da));}else{logger[_0xfee9('0xb')](util[_0xfee9('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1bf607,_0x1995bf,_0x3946a2));}});}; \ No newline at end of file +var _0x4540=['shelljs','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x215d67,_0x34852e){var _0x25b959=function(_0x166490){while(--_0x166490){_0x215d67['push'](_0x215d67['shift']());}};_0x25b959(++_0x34852e);}(_0x4540,0x1a3));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0454('0x0'));var sh=require(_0x0454('0x1'));var Mustache=require('mustache');var logger=require(_0x0454('0x2'))(_0x0454('0x3'));exports[_0x0454('0x4')]=function(_0x2d5e9f,_0x4f2922){var _0x1a21b6=_0x2d5e9f[_0x0454('0x5')]?_0x2d5e9f[_0x0454('0x5')]:_0x0454('0x6');var _0x2047bf=_0x2d5e9f[_0x0454('0x7')]?Mustache[_0x0454('0x8')](_0x2d5e9f[_0x0454('0x7')],_0x4f2922):_0x4f2922;sh[_0x0454('0x4')](_0x2047bf,function(_0x56502e,_0x5b2f2b,_0x541420){if(_0x56502e!==0x0){logger[_0x0454('0x9')](util['format'](_0x0454('0xa'),_0x1a21b6,_0x2047bf,_0x56502e,_0x541420));}else{logger['info'](util['format'](_0x0454('0xb'),_0x1a21b6,_0x2047bf,_0x5b2f2b));}});}; \ 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 47ef8af..ae0a284 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 _0x7aa2=['stack','data1','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','isNil','object','stringify','%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','message','request-promise','util','../../../../config/logger','toUpperCase','render','data2','data5','number','data6','parse','error'];(function(_0x5c5b0e,_0x583e3c){var _0x28e2c9=function(_0x209f7d){while(--_0x209f7d){_0x5c5b0e['push'](_0x5c5b0e['shift']());}};_0x28e2c9(++_0x583e3c);}(_0x7aa2,0xfa));var _0x27aa=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0x7aa2[_0x399d76];return _0x3b19a1;};'use strict';var rp=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x27aa('0x2'))('trigger');exports['exec']=function(_0x23dec8,_0x279fbe){var _0x18fd6f,_0x248009;var _0x3cd7ae={'method':_0x23dec8['data1'][_0x27aa('0x3')](),'uri':Mustache[_0x27aa('0x4')](_0x23dec8[_0x27aa('0x5')],_0x279fbe),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x23dec8[_0x27aa('0x6')])===_0x27aa('0x7')&&parseInt(_0x23dec8['data5'])>=0x1&&parseInt(_0x23dec8[_0x27aa('0x6')])<=0xa?parseInt(_0x23dec8[_0x27aa('0x6')])*0x3e8:0x5*0x3e8};try{_0x3cd7ae['headers']=_0x23dec8[_0x27aa('0x8')]?JSON[_0x27aa('0x9')](Mustache[_0x27aa('0x4')](_0x23dec8[_0x27aa('0x8')],_0x279fbe)):{};}catch(_0x3c23c7){logger[_0x27aa('0xa')](_0x3c23c7[_0x27aa('0xb')]);}switch(_0x23dec8[_0x27aa('0xc')][_0x27aa('0x3')]()){case _0x27aa('0xd'):case'DELETE':_0x18fd6f=null;_0x3cd7ae['qs']=_0x279fbe;break;case _0x27aa('0xe'):case _0x27aa('0xf'):if(_0x23dec8['data7']){try{_0x18fd6f=JSON[_0x27aa('0x9')](Mustache[_0x27aa('0x4')](_0x23dec8[_0x27aa('0x10')],_0x279fbe));_0x3cd7ae[_0x27aa('0x11')]=_0x18fd6f;}catch(_0x1f3d36){logger[_0x27aa('0xa')](_0x1f3d36[_0x27aa('0xb')]);logger[_0x27aa('0xa')](_0x27aa('0x12'));}}else{_0x18fd6f=_0x279fbe;_0x3cd7ae['body']=_0x18fd6f;}break;}logger[_0x27aa('0x13')](util[_0x27aa('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x23dec8[_0x27aa('0xc')],_0x23dec8[_0x27aa('0x5')],JSON['stringify'](_0x3cd7ae)));rp(_0x3cd7ae)['then'](function(_0x92a2c3){_0x18fd6f=!_[_0x27aa('0x15')](_0x18fd6f)?',\x20request\x20body:\x20'+_0x18fd6f:'';_0x248009=typeof _0x92a2c3[_0x27aa('0x11')]===_0x27aa('0x16')?JSON[_0x27aa('0x17')](_0x92a2c3[_0x27aa('0x11')]):_0x92a2c3[_0x27aa('0x11')];logger[_0x27aa('0x13')](util[_0x27aa('0x14')](_0x27aa('0x18'),_0x23dec8[_0x27aa('0xc')],_0x23dec8[_0x27aa('0x5')],_0x92a2c3[_0x27aa('0x19')],_0x248009));})[_0x27aa('0x1a')](function(_0x42a5de){logger[_0x27aa('0xa')](util[_0x27aa('0x14')](_0x27aa('0x1b'),_0x23dec8['data1'],_0x23dec8[_0x27aa('0x5')],_0x42a5de['statusCode'],_0x42a5de['name'],_0x42a5de[_0x27aa('0x1c')]));});}; \ No newline at end of file +var _0xc5bd=['body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','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','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','render','data2','data5','number','headers','data6','parse','stack','GET','DELETE','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x3e8c8f,_0x8b646d){var _0x29dc91=function(_0x16b8cc){while(--_0x16b8cc){_0x3e8c8f['push'](_0x3e8c8f['shift']());}};_0x29dc91(++_0x8b646d);}(_0xc5bd,0xf4));var _0xdc5b=function(_0x64b850,_0x2fe125){_0x64b850=_0x64b850-0x0;var _0x2f2eb6=_0xc5bd[_0x64b850];return _0x2f2eb6;};'use strict';var rp=require(_0xdc5b('0x0'));var util=require(_0xdc5b('0x1'));var _=require(_0xdc5b('0x2'));var Mustache=require(_0xdc5b('0x3'));var logger=require(_0xdc5b('0x4'))(_0xdc5b('0x5'));exports['exec']=function(_0x3b4efb,_0x14b0ad){var _0x44569e,_0x4f2e86;var _0x1559b8={'method':_0x3b4efb['data1']['toUpperCase'](),'uri':Mustache[_0xdc5b('0x6')](_0x3b4efb[_0xdc5b('0x7')],_0x14b0ad),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3b4efb[_0xdc5b('0x8')])===_0xdc5b('0x9')&&parseInt(_0x3b4efb[_0xdc5b('0x8')])>=0x1&&parseInt(_0x3b4efb['data5'])<=0xa?parseInt(_0x3b4efb['data5'])*0x3e8:0x5*0x3e8};try{_0x1559b8[_0xdc5b('0xa')]=_0x3b4efb[_0xdc5b('0xb')]?JSON[_0xdc5b('0xc')](Mustache[_0xdc5b('0x6')](_0x3b4efb[_0xdc5b('0xb')],_0x14b0ad)):{};}catch(_0x17fdd5){logger['error'](_0x17fdd5[_0xdc5b('0xd')]);}switch(_0x3b4efb['data1']['toUpperCase']()){case _0xdc5b('0xe'):case _0xdc5b('0xf'):_0x44569e=null;_0x1559b8['qs']=_0x14b0ad;break;case'POST':case _0xdc5b('0x10'):if(_0x3b4efb[_0xdc5b('0x11')]){try{_0x44569e=JSON['parse'](Mustache['render'](_0x3b4efb[_0xdc5b('0x11')],_0x14b0ad));_0x1559b8['body']=_0x44569e;}catch(_0x18f053){logger[_0xdc5b('0x12')](_0x18f053[_0xdc5b('0xd')]);logger[_0xdc5b('0x12')](_0xdc5b('0x13'));}}else{_0x44569e=_0x14b0ad;_0x1559b8[_0xdc5b('0x14')]=_0x44569e;}break;}logger['info'](util[_0xdc5b('0x15')](_0xdc5b('0x16'),_0x3b4efb[_0xdc5b('0x17')],_0x3b4efb[_0xdc5b('0x7')],JSON[_0xdc5b('0x18')](_0x1559b8)));rp(_0x1559b8)['then'](function(_0x591417){_0x44569e=!_['isNil'](_0x44569e)?',\x20request\x20body:\x20'+_0x44569e:'';_0x4f2e86=typeof _0x591417[_0xdc5b('0x14')]===_0xdc5b('0x19')?JSON['stringify'](_0x591417[_0xdc5b('0x14')]):_0x591417[_0xdc5b('0x14')];logger[_0xdc5b('0x1a')](util[_0xdc5b('0x15')](_0xdc5b('0x1b'),_0x3b4efb[_0xdc5b('0x17')],_0x3b4efb['data2'],_0x591417[_0xdc5b('0x1c')],_0x4f2e86));})[_0xdc5b('0x1d')](function(_0x3c4b42){logger[_0xdc5b('0x12')](util[_0xdc5b('0x15')](_0xdc5b('0x1e'),_0x3b4efb[_0xdc5b('0x17')],_0x3b4efb[_0xdc5b('0x7')],_0x3c4b42[_0xdc5b('0x1c')],_0x3c4b42[_0xdc5b('0x1f')],_0x3c4b42[_0xdc5b('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 65e62b1..7d689f8 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 _0x5a1e=['then','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client'];(function(_0x358c67,_0x5c9ce9){var _0x2c8532=function(_0x17734e){while(--_0x17734e){_0x358c67['push'](_0x358c67['shift']());}};_0x2c8532(++_0x5c9ce9);}(_0x5a1e,0x130));var _0xe5a1=function(_0x6949f1,_0x106daa){_0x6949f1=_0x6949f1-0x0;var _0x2d7590=_0x5a1e[_0x6949f1];return _0x2d7590;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe5a1('0x0'));var logger=require(_0xe5a1('0x1'))(_0xe5a1('0x2'));var client=jayson[_0xe5a1('0x3')]['http']({'port':0x2329});client['Request']=function(_0x39e680,_0x1ab6ea){return new BPromise(function(_0x55dbd2,_0x490ce8){return client['request'](_0x39e680,_0x1ab6ea)[_0xe5a1('0x4')](function(_0x29b1a3){logger['debug'](_0xe5a1('0x5'),_0xe5a1('0x2'),_0x39e680,_0x1ab6ea,_0x29b1a3);if(_0x29b1a3[_0xe5a1('0x6')]){logger['error'](_0xe5a1('0x5'),'routing',_0x39e680,_0x29b1a3[_0xe5a1('0x6')][_0xe5a1('0x7')],_0x1ab6ea);return _0x490ce8(_0x29b1a3['error']['message']);}else{return _0x55dbd2(_0x29b1a3[_0xe5a1('0x8')]);}})[_0xe5a1('0x9')](function(_0x4498ed){logger[_0xe5a1('0x6')](_0xe5a1('0x5'),'routing',_0x39e680,_0x4498ed,_0x1ab6ea);return _0x490ce8(_0x4498ed);});});};module[_0xe5a1('0xa')]=client; \ No newline at end of file +var _0xd897=['http','Request','then','debug','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x4f66cd,_0x2915ad){var _0x7975b8=function(_0x5066b2){while(--_0x5066b2){_0x4f66cd['push'](_0x4f66cd['shift']());}};_0x7975b8(++_0x2915ad);}(_0xd897,0x1dc));var _0x7d89=function(_0x51d207,_0x522875){_0x51d207=_0x51d207-0x0;var _0x11345a=_0xd897[_0x51d207];return _0x11345a;};'use strict';var jayson=require(_0x7d89('0x0'));var BPromise=require(_0x7d89('0x1'));var logger=require(_0x7d89('0x2'))(_0x7d89('0x3'));var client=jayson[_0x7d89('0x4')][_0x7d89('0x5')]({'port':0x2329});client[_0x7d89('0x6')]=function(_0x239fe7,_0xd7d08a){return new BPromise(function(_0xec7986,_0xac0fe1){return client['request'](_0x239fe7,_0xd7d08a)[_0x7d89('0x7')](function(_0x29c0e5){logger[_0x7d89('0x8')](_0x7d89('0x9'),_0x7d89('0x3'),_0x239fe7,_0xd7d08a,_0x29c0e5);if(_0x29c0e5[_0x7d89('0xa')]){logger['error'](_0x7d89('0x9'),_0x7d89('0x3'),_0x239fe7,_0x29c0e5[_0x7d89('0xa')][_0x7d89('0xb')],_0xd7d08a);return _0xac0fe1(_0x29c0e5[_0x7d89('0xa')]['message']);}else{return _0xec7986(_0x29c0e5['result']);}})[_0x7d89('0xc')](function(_0xf6289){logger[_0x7d89('0xa')]('rpc',_0x7d89('0x3'),_0x239fe7,_0xf6289,_0xd7d08a);return _0xac0fe1(_0xf6289);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 36dbf0f..fc38251 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 _0xb681=['refresh','mailAccounts','getSettings','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts'];(function(_0x46a355,_0x1b5f1a){var _0x60e91e=function(_0x528faf){while(--_0x528faf){_0x46a355['push'](_0x46a355['shift']());}};_0x60e91e(++_0x1b5f1a);}(_0xb681,0xc8));var _0x1b68=function(_0x2bf9ed,_0x1b4a6a){_0x2bf9ed=_0x2bf9ed-0x0;var _0xc43470=_0xb681[_0x2bf9ed];return _0xc43470;};'use strict';var server=require(_0x1b68('0x0'));var Realtime=require(_0x1b68('0x1'));var EmailChannel=require(_0x1b68('0x2'));var mailAccount=require(_0x1b68('0x3'));var setting=require(_0x1b68('0x4'));var logger=require(_0x1b68('0x5'))(_0x1b68('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x1b68('0x7')](mailAccount[_0x1b68('0x8')]())[_0x1b68('0x7')](realtime[_0x1b68('0x9')]())['then'](function(){email[_0x1b68('0xa')](realtime[_0x1b68('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x1b68('0x7')](function(){return setting[_0x1b68('0xc')]();})['then'](function(_0xe89a46){return setInterval(initRealtime,_0xe89a46[_0x1b68('0xd')]*0x3e8);})[_0x1b68('0xe')](function(_0x168a09){logger['error']('Email\x20service\x20initialization',_0x168a09);});}main(); \ No newline at end of file +var _0x5feb=['error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x5feb,0x144));var _0xb5fe=function(_0x2f31b1,_0x17daa8){_0x2f31b1=_0x2f31b1-0x0;var _0x448988=_0x5feb[_0x2f31b1];return _0x448988;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xb5fe('0x0'));var mailAccount=require(_0xb5fe('0x1'));var setting=require(_0xb5fe('0x2'));var logger=require(_0xb5fe('0x3'))(_0xb5fe('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb5fe('0x5')]()[_0xb5fe('0x6')](mailAccount[_0xb5fe('0x7')]())[_0xb5fe('0x6')](realtime[_0xb5fe('0x8')]())[_0xb5fe('0x6')](function(){email[_0xb5fe('0x9')](realtime[_0xb5fe('0xa')]);return realtime;});}function main(){return server[_0xb5fe('0xb')](realtime,email)[_0xb5fe('0x6')](function(){return initRealtime();})[_0xb5fe('0x6')](function(){return setting['getSettings']();})['then'](function(_0x4954d3){return setInterval(initRealtime,_0x4954d3['loginMailFrequency']*0x3e8);})['catch'](function(_0x32d2ab){logger[_0xb5fe('0xc')](_0xb5fe('0xd'),_0x32d2ab);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 373db19..fc190a6 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 _0xc2a5=['connected','messages','info','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','handleImapEnd','lastSync','verifySmtp','Smtp','catch','verify','exports','moment','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','active','service','custom','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapError','disabled'];(function(_0x3bf270,_0x565421){var _0x26ec83=function(_0x27633a){while(--_0x27633a){_0x3bf270['push'](_0x3bf270['shift']());}};_0x26ec83(++_0x565421);}(_0xc2a5,0x11a));var _0x5c2a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc2a5[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var moment=require(_0x5c2a('0x0'));var BPromise=require(_0x5c2a('0x1'));var md5=require(_0x5c2a('0x2'));var Redis=require('ioredis');var config=require(_0x5c2a('0x3'));var logger=require('../../../config/logger')(_0x5c2a('0x4'));config[_0x5c2a('0x5')]=_[_0x5c2a('0x6')](config[_0x5c2a('0x5')],{'host':_0x5c2a('0x7'),'port':0x18eb});var io=require(_0x5c2a('0x8'))(new Redis(config[_0x5c2a('0x5')]));var EmailImap=require(_0x5c2a('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5c7600){logger['info'](_0x5c2a('0xa'));this['mailAccounts']=_0x5c7600[_0x5c2a('0xb')];this['imapAccounts']={};this[_0x5c2a('0xc')]=new EmailSmtp();}EmailChannel[_0x5c2a('0xd')][_0x5c2a('0xe')]=function(_0x56fa2f){var _0x2f29e5=this[_0x5c2a('0xb')][_0x56fa2f];var _0x960152={'id':_0x2f29e5['id'],'name':_0x2f29e5[_0x5c2a('0xf')],'key':_0x2f29e5['key'],'active':_0x2f29e5['active'],'Imap':{'status':_0x2f29e5[_0x5c2a('0x10')][_0x5c2a('0x11')],'messageStatus':_0x2f29e5[_0x5c2a('0x10')][_0x5c2a('0x12')],'total':_0x2f29e5[_0x5c2a('0x10')][_0x5c2a('0x13')]}};if(_[_0x5c2a('0x14')](md5Accounts[_0x56fa2f])){md5Accounts[_0x56fa2f]={};}var _0x1f3961=md5(JSON[_0x5c2a('0x15')](_0x960152));if(md5Accounts[_0x56fa2f]['md5']!==_0x1f3961){md5Accounts[_0x56fa2f][_0x5c2a('0x2')]=_0x1f3961;io['emit'](_0x5c2a('0x16'),_0x960152);}};EmailChannel['prototype']['refresh']=function(_0x31d874){for(var _0x393495 in _0x31d874){if(_0x31d874[_0x5c2a('0x17')](_0x393495)){if(_0x31d874[_0x393495][_0x5c2a('0x10')]&&_0x31d874[_0x393495][_0x5c2a('0x18')]){var _0x528e1b=_0x31d874[_0x393495]['Imap'];if(!_0x528e1b[_0x5c2a('0x19')]&&_0x31d874[_0x393495]['provider']!==_0x5c2a('0x1a'))_0x528e1b[_0x5c2a('0x19')]=_0x31d874[_0x393495][_0x5c2a('0x1b')];if(!this[_0x5c2a('0x1c')][_0x5c2a('0x17')](_0x528e1b['id'])){this['imapAccounts'][_0x528e1b['id']]=new EmailImap(_0x528e1b,_0x31d874[_0x393495][_0x5c2a('0x4')]);this[_0x5c2a('0x1c')][_0x528e1b['id']]['on'](_0x5c2a('0x1d'),this[_0x5c2a('0x1e')][_0x5c2a('0x1f')](this,_0x393495));this[_0x5c2a('0x1c')][_0x528e1b['id']]['on'](_0x5c2a('0x4'),this[_0x5c2a('0x20')]['bind'](this,_0x393495));this[_0x5c2a('0x1c')][_0x528e1b['id']]['on'](_0x5c2a('0x21'),this['handleImapEnd'][_0x5c2a('0x1f')](this,_0x393495));this[_0x5c2a('0x1c')][_0x528e1b['id']]['on']('error',this[_0x5c2a('0x22')]['bind'](this,_0x393495));}}else{if(_[_0x5c2a('0x14')](this[_0x5c2a('0xb')][_0x393495][_0x5c2a('0x10')])){this[_0x5c2a('0xb')][_0x393495][_0x5c2a('0x10')]={};}this[_0x5c2a('0xb')][_0x393495]['Imap'][_0x5c2a('0x11')]=_0x5c2a('0x23');this[_0x5c2a('0xb')][_0x393495][_0x5c2a('0x10')][_0x5c2a('0x12')]='';this[_0x5c2a('0xe')](_0x393495);}}}};EmailChannel[_0x5c2a('0xd')][_0x5c2a('0x1e')]=function(_0x395fbc,_0x2b5fb0){if(this[_0x5c2a('0xb')][_0x395fbc]){this[_0x5c2a('0xb')][_0x395fbc]['Imap']['status']=_0x5c2a('0x24');this['mailAccounts'][_0x395fbc][_0x5c2a('0x10')][_0x5c2a('0x12')]=_0x2b5fb0[_0x5c2a('0xf')];if(_0x2b5fb0['messages']){this[_0x5c2a('0xb')][_0x395fbc][_0x5c2a('0x10')][_0x5c2a('0x13')]=_0x2b5fb0[_0x5c2a('0x25')][_0x5c2a('0x13')];}return this[_0x5c2a('0xe')](_0x395fbc);}};EmailChannel['prototype'][_0x5c2a('0x20')]=function(_0x46d9a9,_0x29c55b){logger[_0x5c2a('0x26')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x29c55b[_0x5c2a('0x27')],_0x29c55b[_0x5c2a('0x28')],_0x29c55b[_0x5c2a('0x29')],_0x46d9a9);if(this['mailAccounts'][_0x46d9a9]){return mailAccount[_0x5c2a('0x2a')](_0x46d9a9,_0x29c55b)[_0x5c2a('0x2b')](function(_0x197e04){if(_0x197e04){logger[_0x5c2a('0x26')](_0x5c2a('0x2c'));}})['catch'](function(_0x1d67b2){logger[_0x5c2a('0x2d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x1d67b2));});}};EmailChannel['prototype'][_0x5c2a('0x2e')]=function(_0x50eaa2){if(this[_0x5c2a('0xb')][_0x50eaa2]&&this[_0x5c2a('0xb')][_0x50eaa2][_0x5c2a('0x10')]){if(this[_0x5c2a('0x1c')][this[_0x5c2a('0xb')][_0x50eaa2][_0x5c2a('0x10')]['id']]){delete this[_0x5c2a('0x1c')][this[_0x5c2a('0xb')][_0x50eaa2][_0x5c2a('0x10')]['id']];}this[_0x5c2a('0xb')][_0x50eaa2][_0x5c2a('0x10')][_0x5c2a('0x2f')]=moment();this['emit'](_0x50eaa2);}};EmailChannel[_0x5c2a('0xd')][_0x5c2a('0x22')]=function(_0x7c07b0,_0x2a1f56){if(this['mailAccounts'][_0x7c07b0]){this[_0x5c2a('0xb')][_0x7c07b0][_0x5c2a('0x10')][_0x5c2a('0x11')]=_0x5c2a('0x2d');this['mailAccounts'][_0x7c07b0]['Imap'][_0x5c2a('0x12')]=_0x2a1f56;return this['emit'](_0x7c07b0);}};EmailChannel[_0x5c2a('0xd')]['sendMail']=function(_0x31e62e,_0x2e5747){return this[_0x5c2a('0xc')]['send'](_0x31e62e,_0x2e5747);};EmailChannel['prototype'][_0x5c2a('0x30')]=function(_0xb6a43e){var _0x25321a=this;if(this[_0x5c2a('0xb')][_0xb6a43e['id']]){if(_[_0x5c2a('0x14')](this['mailAccounts'][_0xb6a43e['id']][_0x5c2a('0x31')])){this[_0x5c2a('0xb')][_0xb6a43e['id']][_0x5c2a('0x31')]={};}this[_0x5c2a('0xb')][_0xb6a43e['id']][_0x5c2a('0x31')][_0x5c2a('0x2f')]=moment();return new BPromise(function(_0x4b14c6,_0x32b19f){return _0x25321a[_0x5c2a('0xc')]['verify'](_0xb6a43e)[_0x5c2a('0x2b')](function(_0x4616b8){_0x25321a[_0x5c2a('0xb')][_0xb6a43e['id']][_0x5c2a('0x31')][_0x5c2a('0x11')]='verified';_0x25321a['mailAccounts'][_0xb6a43e['id']][_0x5c2a('0x31')][_0x5c2a('0x12')]='';_0x25321a['emit'](_0xb6a43e['id']);_0x4b14c6(_0x4616b8);})[_0x5c2a('0x32')](function(_0x2658ed){_0x25321a['mailAccounts'][_0xb6a43e['id']]['Smtp'][_0x5c2a('0x11')]='error';_0x25321a[_0x5c2a('0xb')][_0xb6a43e['id']][_0x5c2a('0x31')][_0x5c2a('0x12')]=_0x2658ed;_0x25321a['emit'](_0xb6a43e['id']);_0x32b19f(_0x2658ed);});});}return this['smtp'][_0x5c2a('0x33')](_0xb6a43e);};module[_0x5c2a('0x34')]=EmailChannel; \ No newline at end of file +var _0x5294=['send','verifySmtp','Smtp','lastSync','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','smtp','prototype','emit','mailAccounts','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','catch','handleImapError','sendMail'];(function(_0x4293c4,_0x39b062){var _0x11ea67=function(_0x3b75a2){while(--_0x3b75a2){_0x4293c4['push'](_0x4293c4['shift']());}};_0x11ea67(++_0x39b062);}(_0x5294,0x114));var _0x4529=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x5294[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x4529('0x0'));var moment=require(_0x4529('0x1'));var BPromise=require(_0x4529('0x2'));var md5=require(_0x4529('0x3'));var Redis=require(_0x4529('0x4'));var config=require('../../../config/environment');var logger=require(_0x4529('0x5'))(_0x4529('0x6'));config[_0x4529('0x7')]=_['defaults'](config[_0x4529('0x7')],{'host':_0x4529('0x8'),'port':0x18eb});var io=require(_0x4529('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x4529('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x559b31){logger[_0x4529('0xb')](_0x4529('0xc'));this['mailAccounts']=_0x559b31['mailAccounts'];this['imapAccounts']={};this[_0x4529('0xd')]=new EmailSmtp();}EmailChannel[_0x4529('0xe')][_0x4529('0xf')]=function(_0x15d34d){var _0x794dc7=this[_0x4529('0x10')][_0x15d34d];var _0x1dba8c={'id':_0x794dc7['id'],'name':_0x794dc7[_0x4529('0x11')],'key':_0x794dc7[_0x4529('0x12')],'active':_0x794dc7[_0x4529('0x13')],'Imap':{'status':_0x794dc7[_0x4529('0x14')][_0x4529('0x15')],'messageStatus':_0x794dc7[_0x4529('0x14')][_0x4529('0x16')],'total':_0x794dc7['Imap'][_0x4529('0x17')]}};if(_['isNil'](md5Accounts[_0x15d34d])){md5Accounts[_0x15d34d]={};}var _0x1aa63a=md5(JSON[_0x4529('0x18')](_0x1dba8c));if(md5Accounts[_0x15d34d][_0x4529('0x3')]!==_0x1aa63a){md5Accounts[_0x15d34d]['md5']=_0x1aa63a;io[_0x4529('0xf')](_0x4529('0x19'),_0x1dba8c);}};EmailChannel[_0x4529('0xe')][_0x4529('0x1a')]=function(_0x1c383a){for(var _0x4dc4c4 in _0x1c383a){if(_0x1c383a[_0x4529('0x1b')](_0x4dc4c4)){if(_0x1c383a[_0x4dc4c4][_0x4529('0x14')]&&_0x1c383a[_0x4dc4c4]['active']){var _0x5841f6=_0x1c383a[_0x4dc4c4][_0x4529('0x14')];if(!_0x5841f6[_0x4529('0x1c')]&&_0x1c383a[_0x4dc4c4][_0x4529('0x1d')]!=='custom')_0x5841f6['service']=_0x1c383a[_0x4dc4c4]['provider'];if(!this[_0x4529('0x1e')][_0x4529('0x1b')](_0x5841f6['id'])){this[_0x4529('0x1e')][_0x5841f6['id']]=new EmailImap(_0x5841f6,_0x1c383a[_0x4dc4c4][_0x4529('0x6')]);this[_0x4529('0x1e')][_0x5841f6['id']]['on'](_0x4529('0x1f'),this[_0x4529('0x20')][_0x4529('0x21')](this,_0x4dc4c4));this['imapAccounts'][_0x5841f6['id']]['on']('email',this[_0x4529('0x22')][_0x4529('0x21')](this,_0x4dc4c4));this['imapAccounts'][_0x5841f6['id']]['on'](_0x4529('0x23'),this[_0x4529('0x24')][_0x4529('0x21')](this,_0x4dc4c4));this[_0x4529('0x1e')][_0x5841f6['id']]['on'](_0x4529('0x25'),this['handleImapError'][_0x4529('0x21')](this,_0x4dc4c4));}}else{if(_['isNil'](this[_0x4529('0x10')][_0x4dc4c4][_0x4529('0x14')])){this[_0x4529('0x10')][_0x4dc4c4][_0x4529('0x14')]={};}this[_0x4529('0x10')][_0x4dc4c4][_0x4529('0x14')]['status']=_0x4529('0x26');this['mailAccounts'][_0x4dc4c4][_0x4529('0x14')]['messageStatus']='';this[_0x4529('0xf')](_0x4dc4c4);}}}};EmailChannel[_0x4529('0xe')][_0x4529('0x20')]=function(_0x1a19f0,_0x16f92a){if(this[_0x4529('0x10')][_0x1a19f0]){this[_0x4529('0x10')][_0x1a19f0][_0x4529('0x14')][_0x4529('0x15')]=_0x4529('0x27');this[_0x4529('0x10')][_0x1a19f0][_0x4529('0x14')][_0x4529('0x16')]=_0x16f92a[_0x4529('0x11')];if(_0x16f92a['messages']){this[_0x4529('0x10')][_0x1a19f0][_0x4529('0x14')]['total']=_0x16f92a[_0x4529('0x28')]['total'];}return this[_0x4529('0xf')](_0x1a19f0);}};EmailChannel[_0x4529('0xe')][_0x4529('0x22')]=function(_0x1d018c,_0x285055){logger[_0x4529('0xb')](_0x4529('0x29'),_0x285055[_0x4529('0x2a')],_0x285055['lastName'],_0x285055[_0x4529('0x2b')],_0x1d018c);if(this[_0x4529('0x10')][_0x1d018c]){return mailAccount['notify'](_0x1d018c,_0x285055)[_0x4529('0x2c')](function(_0x446f57){if(_0x446f57){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x4529('0x2d')](function(_0x49c883){logger[_0x4529('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4529('0x18')](_0x49c883));});}};EmailChannel[_0x4529('0xe')][_0x4529('0x24')]=function(_0x5b6c3f){if(this[_0x4529('0x10')][_0x5b6c3f]&&this['mailAccounts'][_0x5b6c3f][_0x4529('0x14')]){if(this[_0x4529('0x1e')][this[_0x4529('0x10')][_0x5b6c3f]['Imap']['id']]){delete this[_0x4529('0x1e')][this['mailAccounts'][_0x5b6c3f]['Imap']['id']];}this[_0x4529('0x10')][_0x5b6c3f][_0x4529('0x14')]['lastSync']=moment();this[_0x4529('0xf')](_0x5b6c3f);}};EmailChannel[_0x4529('0xe')][_0x4529('0x2e')]=function(_0x4183b3,_0x521657){if(this[_0x4529('0x10')][_0x4183b3]){this['mailAccounts'][_0x4183b3]['Imap'][_0x4529('0x15')]=_0x4529('0x25');this[_0x4529('0x10')][_0x4183b3][_0x4529('0x14')][_0x4529('0x16')]=_0x521657;return this[_0x4529('0xf')](_0x4183b3);}};EmailChannel[_0x4529('0xe')][_0x4529('0x2f')]=function(_0x25a8fb,_0xb19390){return this[_0x4529('0xd')][_0x4529('0x30')](_0x25a8fb,_0xb19390);};EmailChannel['prototype'][_0x4529('0x31')]=function(_0x33838c){var _0x346e55=this;if(this['mailAccounts'][_0x33838c['id']]){if(_['isNil'](this['mailAccounts'][_0x33838c['id']]['Smtp'])){this[_0x4529('0x10')][_0x33838c['id']][_0x4529('0x32')]={};}this[_0x4529('0x10')][_0x33838c['id']][_0x4529('0x32')][_0x4529('0x33')]=moment();return new BPromise(function(_0xb10be4,_0xbc5d30){return _0x346e55['smtp'][_0x4529('0x34')](_0x33838c)['then'](function(_0x36f37a){_0x346e55[_0x4529('0x10')][_0x33838c['id']][_0x4529('0x32')][_0x4529('0x15')]='verified';_0x346e55[_0x4529('0x10')][_0x33838c['id']][_0x4529('0x32')][_0x4529('0x16')]='';_0x346e55[_0x4529('0xf')](_0x33838c['id']);_0xb10be4(_0x36f37a);})[_0x4529('0x2d')](function(_0x1e418b){_0x346e55[_0x4529('0x10')][_0x33838c['id']][_0x4529('0x32')][_0x4529('0x15')]=_0x4529('0x25');_0x346e55['mailAccounts'][_0x33838c['id']][_0x4529('0x32')][_0x4529('0x16')]=_0x1e418b;_0x346e55[_0x4529('0xf')](_0x33838c['id']);_0xbc5d30(_0x1e418b);});});}return this[_0x4529('0xd')][_0x4529('0x34')](_0x33838c);};module[_0x4529('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 04f4054..6288c5a 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 _0xeff8=['port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','email','handleFetchEnd','handleCloseBox','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','getAccount','imap','account','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host'];(function(_0x41604c,_0x3fb07c){var _0x1ea71a=function(_0x2c3ec2){while(--_0x2c3ec2){_0x41604c['push'](_0x41604c['shift']());}};_0x1ea71a(++_0x3fb07c);}(_0xeff8,0x186));var _0x8eff=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xeff8[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var Imap=require('imap');var simpleParser=require(_0x8eff('0x2'))[_0x8eff('0x3')];var Iconv=require(_0x8eff('0x4'))['Iconv'];var EventEmitter=require(_0x8eff('0x5'))[_0x8eff('0x6')];var utils=require(_0x8eff('0x7'));var logger=require(_0x8eff('0x8'))('email');function EmailImap(_0x469641,_0xb54063){this[_0x8eff('0x9')]=_0x8eff('0xa');this['account']=this[_0x8eff('0xb')](_0x469641,_0xb54063);this[_0x8eff('0xc')]=new Imap(this[_0x8eff('0xd')]);this[_0x8eff('0xc')]['once']('ready',this[_0x8eff('0xe')][_0x8eff('0xf')](this));this[_0x8eff('0xc')]['once'](_0x8eff('0x10'),this[_0x8eff('0x11')]['bind'](this));this[_0x8eff('0xc')]['on'](_0x8eff('0x12'),this['handleError']['bind'](this));this[_0x8eff('0xc')][_0x8eff('0x13')]();}util[_0x8eff('0x14')](EmailImap,EventEmitter);EmailImap[_0x8eff('0x15')][_0x8eff('0xb')]=function(_0x56efdf,_0x3e7c01){var _0x212a2e={'connTimeout':_0x56efdf[_0x8eff('0x16')]?_0x56efdf[_0x8eff('0x16')]*0x3e8:0x2710,'authTimeout':_0x56efdf[_0x8eff('0x17')]?_0x56efdf[_0x8eff('0x17')]*0x3e8:0x1388};if(_[_0x8eff('0x18')](_0x56efdf[_0x8eff('0x19')])){if(_0x56efdf[_0x8eff('0x1a')]){_0x212a2e[_0x8eff('0x1b')]=_0x56efdf[_0x8eff('0x1b')];_0x212a2e['password']=_0x56efdf[_0x8eff('0x1c')];}_0x212a2e[_0x8eff('0x1d')]=_0x56efdf[_0x8eff('0x1d')];_0x212a2e[_0x8eff('0x1e')]=_0x56efdf[_0x8eff('0x1e')]||0x3e1;if(_0x56efdf[_0x8eff('0x1f')]){_0x212a2e[_0x8eff('0x1f')]=!![];}else{_0x212a2e[_0x8eff('0x1f')]=![];_0x212a2e[_0x8eff('0x20')]=_0x8eff('0x21');}}else{if(_0x56efdf[_0x8eff('0x22')]){_0x212a2e[_0x8eff('0x23')]=utils[_0x8eff('0x24')](_0x56efdf[_0x8eff('0x25')][_0x8eff('0x26')],_0x56efdf[_0x8eff('0x1b')]);_0x212a2e['user']=_0x56efdf[_0x8eff('0x1b')];}else{_0x212a2e[_0x8eff('0x1b')]=_0x56efdf['user'];_0x212a2e[_0x8eff('0x1c')]=_0x56efdf['password'];}_0x212a2e[_0x8eff('0x1d')]=utils[_0x8eff('0x27')](_0x56efdf[_0x8eff('0x19')]);_0x212a2e[_0x8eff('0x1e')]=0x3e1;_0x212a2e[_0x8eff('0x1f')]=!![];}_0x212a2e['email']=_0x3e7c01||_0x56efdf[_0x8eff('0x1b')]||_0x8eff('0x28');return _0x212a2e;};EmailImap['prototype'][_0x8eff('0xe')]=function(){this[_0x8eff('0xc')][_0x8eff('0x29')](this[_0x8eff('0x9')],![],this[_0x8eff('0x2a')][_0x8eff('0xf')](this));};EmailImap[_0x8eff('0x15')][_0x8eff('0x2a')]=function(_0x516173,_0x3e1607){if(_0x516173){this[_0x8eff('0x2b')](_0x516173,!![]);}else{this[_0x8eff('0x2c')](_0x8eff('0x2d'),_0x3e1607);this[_0x8eff('0x2e')]();}};EmailImap[_0x8eff('0x15')]['handleCloseBox']=function(_0x4ed3b8){if(_0x4ed3b8){this[_0x8eff('0x2b')](_0x4ed3b8,!![]);}else{this[_0x8eff('0xc')][_0x8eff('0x10')]();}};EmailImap['prototype'][_0x8eff('0x2e')]=function(){this[_0x8eff('0xc')][_0x8eff('0x2f')]([_0x8eff('0x30')],this[_0x8eff('0x31')][_0x8eff('0xf')](this));};EmailImap[_0x8eff('0x15')][_0x8eff('0x31')]=function(_0x36a613,_0x1e9a8a){if(_0x36a613){this[_0x8eff('0x2b')](_0x36a613,!![]);}else{if(_0x1e9a8a[_0x8eff('0x32')]){try{var _0x5e0ecb=this[_0x8eff('0xc')][_0x8eff('0x33')](_0x1e9a8a,{'bodies':'','markSeen':!![]});_0x5e0ecb['on'](_0x8eff('0x34'),this[_0x8eff('0x35')]['bind'](this));_0x5e0ecb[_0x8eff('0x36')](_0x8eff('0x12'),this['handleFetchError']['bind'](this));_0x5e0ecb[_0x8eff('0x36')](_0x8eff('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x51ec38){logger[_0x8eff('0x12')](_0x51ec38);}}else{this['imap'][_0x8eff('0x37')](!![],this['handleCloseBox'][_0x8eff('0xf')](this));}}};EmailImap[_0x8eff('0x15')][_0x8eff('0x35')]=function(_0x1dcab3){_0x1dcab3['on'](_0x8eff('0x38'),this[_0x8eff('0x39')]['bind'](this));_0x1dcab3[_0x8eff('0x36')]('attributes',this[_0x8eff('0x3a')]['bind'](this));_0x1dcab3[_0x8eff('0x36')](_0x8eff('0x10'),this[_0x8eff('0x3b')][_0x8eff('0xf')](this));};EmailImap['prototype'][_0x8eff('0x39')]=function(_0x170a33){simpleParser(_0x170a33,{'Iconv':Iconv},this[_0x8eff('0x3c')]['bind'](this));};EmailImap[_0x8eff('0x15')][_0x8eff('0x3a')]=function(){};EmailImap[_0x8eff('0x15')][_0x8eff('0x3b')]=function(){};EmailImap[_0x8eff('0x15')][_0x8eff('0x3c')]=function(_0x29f68e,_0x26da7a){if(_0x29f68e){logger[_0x8eff('0x12')](_0x29f68e);}else{var _0x5c1277=this;utils['parser'](this[_0x8eff('0xd')],_0x26da7a,function(_0x114f8e){_0x5c1277[_0x8eff('0x2c')](_0x8eff('0x3d'),_0x114f8e);});}};EmailImap[_0x8eff('0x15')][_0x8eff('0x3e')]=function(){this[_0x8eff('0xc')]['closeBox'](!![],this[_0x8eff('0x3f')][_0x8eff('0xf')](this));};EmailImap['prototype'][_0x8eff('0x40')]=function(_0x1ad6b3){this[_0x8eff('0x2b')](_0x1ad6b3);this[_0x8eff('0xc')][_0x8eff('0x37')](!![],this[_0x8eff('0x3f')][_0x8eff('0xf')](this));};EmailImap[_0x8eff('0x15')][_0x8eff('0x11')]=function(){this['emit'](_0x8eff('0x10'));};EmailImap[_0x8eff('0x15')][_0x8eff('0x2b')]=function(_0x2fa131,_0x1a5460){logger['error'](_0x8eff('0x2b'),this['account'][_0x8eff('0x3d')],JSON[_0x8eff('0x41')](_0x2fa131));var _0x1e9d99='';if(_0x2fa131){if(_0x2fa131[_0x8eff('0x42')]){_0x1e9d99=_0x2fa131['textCode'];}else{for(var _0xa0eabb in _0x2fa131){if(_0x2fa131[_0x8eff('0x43')](_0xa0eabb)){_0x1e9d99+=_[_0x8eff('0x44')](_0xa0eabb)+':\x20'+_0x2fa131[_0xa0eabb]+'\x0a';}}}}if(_0x1a5460){this['imap']['end']();}else{this[_0x8eff('0x2c')](_0x8eff('0x12'),_0x1e9d99);this[_0x8eff('0x2c')](_0x8eff('0x10'));}};module[_0x8eff('0x45')]=EmailImap; \ No newline at end of file +var _0x2a07=['handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','xoauth2','CloudProvider','data5','getHost','service','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','error','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once'];(function(_0x5850fb,_0x5dbf98){var _0x133afd=function(_0x31a699){while(--_0x31a699){_0x5850fb['push'](_0x5850fb['shift']());}};_0x133afd(++_0x5dbf98);}(_0x2a07,0x74));var _0x72a0=function(_0x3ce221,_0x22d678){_0x3ce221=_0x3ce221-0x0;var _0x3995b8=_0x2a07[_0x3ce221];return _0x3995b8;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var Imap=require(_0x72a0('0x2'));var simpleParser=require(_0x72a0('0x3'))[_0x72a0('0x4')];var Iconv=require('iconv')[_0x72a0('0x5')];var EventEmitter=require(_0x72a0('0x6'))[_0x72a0('0x7')];var utils=require(_0x72a0('0x8'));var logger=require(_0x72a0('0x9'))(_0x72a0('0xa'));function EmailImap(_0x3ccf6d,_0x20dab9){this[_0x72a0('0xb')]=_0x72a0('0xc');this[_0x72a0('0xd')]=this[_0x72a0('0xe')](_0x3ccf6d,_0x20dab9);this[_0x72a0('0x2')]=new Imap(this[_0x72a0('0xd')]);this[_0x72a0('0x2')][_0x72a0('0xf')]('ready',this[_0x72a0('0x10')][_0x72a0('0x11')](this));this['imap'][_0x72a0('0xf')](_0x72a0('0x12'),this[_0x72a0('0x13')][_0x72a0('0x11')](this));this[_0x72a0('0x2')]['on']('error',this[_0x72a0('0x14')][_0x72a0('0x11')](this));this[_0x72a0('0x2')][_0x72a0('0x15')]();}util[_0x72a0('0x16')](EmailImap,EventEmitter);EmailImap[_0x72a0('0x17')][_0x72a0('0xe')]=function(_0x5e0b5f,_0x4930c5){var _0xe103dc={'connTimeout':_0x5e0b5f[_0x72a0('0x18')]?_0x5e0b5f[_0x72a0('0x18')]*0x3e8:0x2710,'authTimeout':_0x5e0b5f[_0x72a0('0x19')]?_0x5e0b5f[_0x72a0('0x19')]*0x3e8:0x1388};if(_[_0x72a0('0x1a')](_0x5e0b5f['service'])){if(_0x5e0b5f[_0x72a0('0x1b')]){_0xe103dc[_0x72a0('0x1c')]=_0x5e0b5f[_0x72a0('0x1c')];_0xe103dc[_0x72a0('0x1d')]=_0x5e0b5f[_0x72a0('0x1d')];}_0xe103dc['host']=_0x5e0b5f[_0x72a0('0x1e')];_0xe103dc[_0x72a0('0x1f')]=_0x5e0b5f[_0x72a0('0x1f')]||0x3e1;if(_0x5e0b5f['tls']){_0xe103dc[_0x72a0('0x20')]=!![];}else{_0xe103dc[_0x72a0('0x20')]=![];_0xe103dc[_0x72a0('0x21')]=_0x72a0('0x22');}}else{if(_0x5e0b5f['modernAuthentication']){_0xe103dc[_0x72a0('0x23')]=utils['generateXOAuth2Token'](_0x5e0b5f[_0x72a0('0x24')][_0x72a0('0x25')],_0x5e0b5f[_0x72a0('0x1c')]);_0xe103dc['user']=_0x5e0b5f[_0x72a0('0x1c')];}else{_0xe103dc[_0x72a0('0x1c')]=_0x5e0b5f[_0x72a0('0x1c')];_0xe103dc[_0x72a0('0x1d')]=_0x5e0b5f['password'];}_0xe103dc[_0x72a0('0x1e')]=utils[_0x72a0('0x26')](_0x5e0b5f[_0x72a0('0x27')]);_0xe103dc[_0x72a0('0x1f')]=0x3e1;_0xe103dc[_0x72a0('0x20')]=!![];}_0xe103dc[_0x72a0('0xa')]=_0x4930c5||_0x5e0b5f['user']||'anonymous@xcally.com';return _0xe103dc;};EmailImap[_0x72a0('0x17')][_0x72a0('0x10')]=function(){this[_0x72a0('0x2')][_0x72a0('0x28')](this[_0x72a0('0xb')],![],this[_0x72a0('0x29')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x29')]=function(_0x12dcc9,_0x4f9718){if(_0x12dcc9){this[_0x72a0('0x14')](_0x12dcc9,!![]);}else{this[_0x72a0('0x2a')](_0x72a0('0x2b'),_0x4f9718);this[_0x72a0('0x2c')]();}};EmailImap[_0x72a0('0x17')][_0x72a0('0x2d')]=function(_0x432179){if(_0x432179){this[_0x72a0('0x14')](_0x432179,!![]);}else{this[_0x72a0('0x2')][_0x72a0('0x12')]();}};EmailImap['prototype'][_0x72a0('0x2c')]=function(){this[_0x72a0('0x2')][_0x72a0('0x2e')]([_0x72a0('0x2f')],this[_0x72a0('0x30')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')]['handleReadUnseen']=function(_0x30878e,_0x2c884f){if(_0x30878e){this[_0x72a0('0x14')](_0x30878e,!![]);}else{if(_0x2c884f[_0x72a0('0x31')]){try{var _0x89d598=this[_0x72a0('0x2')][_0x72a0('0x32')](_0x2c884f,{'bodies':'','markSeen':!![]});_0x89d598['on'](_0x72a0('0x33'),this['handleFetchMessage'][_0x72a0('0x11')](this));_0x89d598[_0x72a0('0xf')](_0x72a0('0x34'),this['handleFetchError'][_0x72a0('0x11')](this));_0x89d598['once'](_0x72a0('0x12'),this[_0x72a0('0x35')][_0x72a0('0x11')](this));}catch(_0x3a293f){logger[_0x72a0('0x34')](_0x3a293f);}}else{this[_0x72a0('0x2')][_0x72a0('0x36')](!![],this[_0x72a0('0x2d')][_0x72a0('0x11')](this));}}};EmailImap[_0x72a0('0x17')][_0x72a0('0x37')]=function(_0x3ff191){_0x3ff191['on']('body',this[_0x72a0('0x38')]['bind'](this));_0x3ff191[_0x72a0('0xf')](_0x72a0('0x39'),this[_0x72a0('0x3a')][_0x72a0('0x11')](this));_0x3ff191[_0x72a0('0xf')](_0x72a0('0x12'),this[_0x72a0('0x3b')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')]['handleMessageBody']=function(_0x4a973a){simpleParser(_0x4a973a,{'Iconv':Iconv},this[_0x72a0('0x3c')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x3a')]=function(){};EmailImap[_0x72a0('0x17')]['handleMessageEnd']=function(){};EmailImap[_0x72a0('0x17')][_0x72a0('0x3c')]=function(_0x582c90,_0x21ad08){if(_0x582c90){logger['error'](_0x582c90);}else{var _0x582c84=this;utils['parser'](this[_0x72a0('0xd')],_0x21ad08,function(_0x49633b){_0x582c84[_0x72a0('0x2a')](_0x72a0('0xa'),_0x49633b);});}};EmailImap[_0x72a0('0x17')][_0x72a0('0x35')]=function(){this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x3d')]=function(_0x4a7032){this[_0x72a0('0x14')](_0x4a7032);this[_0x72a0('0x2')]['closeBox'](!![],this[_0x72a0('0x2d')][_0x72a0('0x11')](this));};EmailImap[_0x72a0('0x17')][_0x72a0('0x13')]=function(){this[_0x72a0('0x2a')](_0x72a0('0x12'));};EmailImap['prototype'][_0x72a0('0x14')]=function(_0x5babc1,_0x3683b6){logger['error'](_0x72a0('0x14'),this[_0x72a0('0xd')]['email'],JSON[_0x72a0('0x3e')](_0x5babc1));var _0x506d65='';if(_0x5babc1){if(_0x5babc1[_0x72a0('0x3f')]){_0x506d65=_0x5babc1[_0x72a0('0x3f')];}else{for(var _0x13254c in _0x5babc1){if(_0x5babc1['hasOwnProperty'](_0x13254c)){_0x506d65+=_[_0x72a0('0x40')](_0x13254c)+':\x20'+_0x5babc1[_0x13254c]+'\x0a';}}}}if(_0x3683b6){this[_0x72a0('0x2')][_0x72a0('0x12')]();}else{this['emit']('error',_0x506d65);this[_0x72a0('0x2a')]('end');}};module[_0x72a0('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 950dec7..39561e9 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf35=['exports','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail','verify','toString','Not\x20verifired'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xdf35,0x1af));var _0x5df3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdf35[_0x4b369d];return _0x571a98;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x5df3('0x0'));function EmailSmtp(){}EmailSmtp[_0x5df3('0x1')]['send']=function(_0x3eaf5,_0x12efc4){return new Promise(function(_0x3077ab,_0x473796){var _0x48d4f1=nodemailer[_0x5df3('0x2')](_0x3eaf5);_0x48d4f1[_0x5df3('0x3')](_0x5df3('0x4'),inlineBase64());_0x48d4f1[_0x5df3('0x5')](_0x12efc4,function(_0x45faed,_0x162b33){if(_0x45faed){_0x473796(_0x45faed['toString']());}else{_0x3077ab(_0x162b33);}});});};EmailSmtp[_0x5df3('0x1')][_0x5df3('0x6')]=function(_0x20039c){return new Promise(function(_0x3df01f,_0x13edd7){var _0x5a8e8d=nodemailer[_0x5df3('0x2')](_0x20039c);_0x5a8e8d['verify'](function(_0x48a2d9,_0x59e72a){if(_0x48a2d9){_0x13edd7(_0x48a2d9[_0x5df3('0x7')]());}else{if(_0x59e72a){_0x3df01f(_0x59e72a);}else{_0x13edd7(_0x5df3('0x8'));}}});});};module[_0x5df3('0x9')]=EmailSmtp; \ No newline at end of file +var _0x6c2a=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0xf39acb,_0x4b0d57){var _0x3989ef=function(_0x3d4472){while(--_0x3d4472){_0xf39acb['push'](_0xf39acb['shift']());}};_0x3989ef(++_0x4b0d57);}(_0x6c2a,0x109));var _0xa6c2=function(_0x4955a9,_0x4fbad8){_0x4955a9=_0x4955a9-0x0;var _0x3a8f07=_0x6c2a[_0x4955a9];return _0x3a8f07;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xa6c2('0x0'));function EmailSmtp(){}EmailSmtp[_0xa6c2('0x1')][_0xa6c2('0x2')]=function(_0x27a631,_0x34992f){return new Promise(function(_0x461dd4,_0x4ec4b4){var _0x214ac3=nodemailer[_0xa6c2('0x3')](_0x27a631);_0x214ac3['use'](_0xa6c2('0x4'),inlineBase64());_0x214ac3[_0xa6c2('0x5')](_0x34992f,function(_0x3b8f2c,_0x25ef8a){if(_0x3b8f2c){_0x4ec4b4(_0x3b8f2c[_0xa6c2('0x6')]());}else{_0x461dd4(_0x25ef8a);}});});};EmailSmtp[_0xa6c2('0x1')][_0xa6c2('0x7')]=function(_0x2cdfd8){return new Promise(function(_0x4c04e0,_0x342fb4){var _0xdab817=nodemailer[_0xa6c2('0x3')](_0x2cdfd8);_0xdab817['verify'](function(_0x11c9b8,_0x24137d){if(_0x11c9b8){_0x342fb4(_0x11c9b8[_0xa6c2('0x6')]());}else{if(_0x24137d){_0x4c04e0(_0x24137d);}else{_0x342fb4(_0xa6c2('0x8'));}}});});};module[_0xa6c2('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6aefa41..d18acb4 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf82f=['127.0.0.1','user=','auth=Bearer\x20','utf-8','base64','lodash','randomstring','path','util','node-tnef','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','length','slice','join','Anonymous','split','isEmpty','html','replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com'];(function(_0x2dc293,_0xbd4e34){var _0x5b0e0a=function(_0x318d16){while(--_0x318d16){_0x2dc293['push'](_0x2dc293['shift']());}};_0x5b0e0a(++_0xbd4e34);}(_0xf82f,0xec));var _0xff82=function(_0x5706c3,_0x208e27){_0x5706c3=_0x5706c3-0x0;var _0x3d9f36=_0xf82f[_0x5706c3];return _0x3d9f36;};'use strict';var _=require(_0xff82('0x0'));var moment=require('moment');var random=require(_0xff82('0x1'));var fs=require('fs');var path=require(_0xff82('0x2'));var util=require(_0xff82('0x3'));var tnef=require(_0xff82('0x4'));var logger=require('../../../config/logger')('email');var config=require('../../../config/environment');function getAddress(_0x1f7f58){var _0xf3feaa=_['head'](_0x1f7f58[_0xff82('0x5')]);return _0xf3feaa&&_0xf3feaa[_0xff82('0x6')]?_0xf3feaa['address']:_0xff82('0x7')+random[_0xff82('0x8')](0x6)+_0xff82('0x9');}function getFirstName(_0x5bb773){var _0x58d0b3=_[_0xff82('0xa')](_0x5bb773[_0xff82('0x5')]);if(_0x58d0b3&&_0x58d0b3[_0xff82('0xb')]){if(_0x58d0b3[_0xff82('0xb')]==_0x58d0b3['address']){return _0x58d0b3[_0xff82('0xb')][_0xff82('0xc')](0x0,_0x58d0b3['name'][_0xff82('0xd')]('@'));}var _0x3783af=_0x58d0b3[_0xff82('0xb')]['split'](/\s+/);return _0x3783af[_0xff82('0xe')]>0x1?_0x3783af[_0xff82('0xf')](0x0,-0x1)[_0xff82('0x10')]('\x20'):_0x58d0b3['name'];}return _0xff82('0x11');}function getLastName(_0x267308){var _0x56f6b7=_[_0xff82('0xa')](_0x267308[_0xff82('0x5')]);if(_0x56f6b7&&_0x56f6b7[_0xff82('0xb')]){var _0x26e23b=_0x56f6b7['name'][_0xff82('0x12')](/\s+/);return _0x26e23b[_0xff82('0xe')]>0x1?_0x26e23b['pop']():'';}return'';}function getMails(_0x134bbc,_0x15172a){var _0x178a92='';for(var _0x32fdc7=0x0;_0x32fdc7<_0x15172a[_0xff82('0x5')][_0xff82('0xe')];_0x32fdc7+=0x1){if(_0x15172a['value'][_0x32fdc7]['address']!==_0x134bbc){if(!_[_0xff82('0x13')](_0x178a92)){_0x178a92+=',';}_0x178a92+=_0x15172a['value'][_0x32fdc7][_0xff82('0xb')]||_0x15172a[_0xff82('0x5')][_0x32fdc7][_0xff82('0x6')]||'';_0x178a92+='\x20<';_0x178a92+=_0x15172a[_0xff82('0x5')][_0x32fdc7][_0xff82('0x6')]?_0x15172a[_0xff82('0x5')][_0x32fdc7]['address']:_0xff82('0x7')+random[_0xff82('0x8')](0x6)+_0xff82('0x9');_0x178a92+='>';}}return _0x178a92;}function parseEmail(_0x20e49d,_0x313f40,_0x26bcd6){if(_0x313f40[_0xff82('0x14')]){var _0x4926e4=/)<[^<]*)*<\/script>/gi;while(_0x4926e4['test'](_0x313f40[_0xff82('0x14')])){_0x313f40[_0xff82('0x14')]=_0x313f40[_0xff82('0x14')][_0xff82('0x15')](_0x4926e4,'');}if(_0x313f40[_0xff82('0x14')]['includes'](_0xff82('0x16'))){var _0x361bc7=[];_0x313f40[_0xff82('0x17')][_0xff82('0x18')](_0x56b387=>{_0x361bc7[_0xff82('0x19')](_0x56b387[_0xff82('0x1a')]);});var _0x3df948=/]+>/g;var _0x124e3b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x36c1a1=_0x313f40[_0xff82('0x14')]['replace'](_0x124e3b,_0xff82('0x1b'));var _0x5d2e83=_0x36c1a1[_0xff82('0x15')](_0x3df948,'_IMG');for(let _0x41db38=0x0;_0x41db38<_0x361bc7[_0xff82('0xe')];_0x41db38++){var _0x2b41bd=_0x5d2e83[_0xff82('0x15')]('_IMG',_0xff82('0x1c')+_0x361bc7[_0x41db38]+'\x20]');_0x5d2e83=_0x2b41bd;}_0x313f40[_0xff82('0x14')]=_0x5d2e83;}_0x26bcd6[_0xff82('0x1d')]=_0x313f40[_0xff82('0x14')];}else{_0x26bcd6[_0xff82('0x1d')]=_0x313f40[_0xff82('0x1e')];}if(_0x26bcd6['body']){_0x26bcd6[_0xff82('0x1d')]=_0x26bcd6[_0xff82('0x1d')]['replace'](/0x0){var _0x4b4c39=[_0xff82('0x2e'),_0xff82('0x2f'),_0xff82('0x30')];for(var _0x4f29a2=0x0;_0x4f29a2<_0x313f40['headerLines'][_0xff82('0xe')];_0x4f29a2++){var _0x249c1e=_['indexOf'](_0x4b4c39,_0x313f40[_0xff82('0x2d')][_0x4f29a2][_0xff82('0x31')]);if(_0x249c1e>=0x0){_0x26bcd6[_0xff82('0x32')]=!![];}}}return _0x26bcd6;}exports['parser']=function(_0x4bd7d9,_0x310e7c,_0x5bc4bf){var _0x355526={'from':getAddress(_0x310e7c['from']),'firstName':getFirstName(_0x310e7c[_0xff82('0x33')]),'lastName':getLastName(_0x310e7c['from']),'mapKey':_0xff82('0x22'),'message':{'from':getMails(_0x4bd7d9[_0xff82('0x22')],_0x310e7c['from']),'to':_0x4bd7d9['email'],'cc':'','subject':_0x310e7c[_0xff82('0x34')]||'','messageId':_0x310e7c[_0xff82('0x35')],'inReplyTo':_0x310e7c['inReplyTo'],'sentAt':moment(_0x310e7c[_0xff82('0x36')])[_0xff82('0x28')](_0xff82('0x37')),'attach':![],'attachments':[]}};if(!_0x310e7c[_0xff82('0x14')]&&!_0x310e7c['textAsHtml']){var _0xd6e9c1=_[_0xff82('0x38')](_0x310e7c[_0xff82('0x17')],{'contentType':_0xff82('0x39')});if(_0xd6e9c1[_0xff82('0xe')]){logger[_0xff82('0x3a')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x310e7c[_0xff82('0x35')]));tnef['parseBuffer'](_[_0xff82('0x3b')](_0xd6e9c1)[_0xff82('0x2b')],function(_0xe893a7,_0x4abb2d){if(_0x4abb2d){_0x310e7c[_0xff82('0x14')]=_0x4abb2d[_0xff82('0x3c')]||_0xff82('0x3d');if(_0x4abb2d[_0xff82('0x3e')]){for(var _0x2fa474=0x0;_0x2fa474<_0x4abb2d['Attachments'][_0xff82('0xe')];_0x2fa474++){var _0x22380c=_0x4abb2d[_0xff82('0x3e')][_0x2fa474];_0x355526[_0xff82('0x20')][_0xff82('0x17')][_0xff82('0x19')]({'filename':_0x22380c[_0xff82('0x3f')],'content':Buffer[_0xff82('0x33')](_0x22380c[_0xff82('0x40')])});}}}_0x5bc4bf(parseEmail(_0x4bd7d9,_0x310e7c,_0x355526));});}else{_0x310e7c[_0xff82('0x14')]=_0xff82('0x3d');_0x5bc4bf(parseEmail(_0x4bd7d9,_0x310e7c,_0x355526));}}else{_0x5bc4bf(parseEmail(_0x4bd7d9,_0x310e7c,_0x355526));}};exports['getHost']=function(_0x2d7605){switch(_0x2d7605){case _0xff82('0x41'):return _0xff82('0x42');case _0xff82('0x43'):return _0xff82('0x44');case'hotmail':return _0xff82('0x45');case _0xff82('0x46'):return _0xff82('0x47');}return _0xff82('0x48');};exports['generateXOAuth2Token']=function(_0x268490,_0x572e77){var _0x33297a=[_0xff82('0x49')+(_0x572e77||''),_0xff82('0x4a')+_0x268490,'',''];return Buffer['from'](_0x33297a[_0xff82('0x10')](''),_0xff82('0x4b'))['toString'](_0xff82('0x4c'));}; \ No newline at end of file +var _0x41f7=['body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','@xcally.com','head','name','substring','slice','join','Anonymous','split','pop','isEmpty','anonymous','generate','html','includes','attachments','forEach','filename','replace','_IMG','length','\x20[Attachment:\x20'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x41f7,0x79));var _0x741f=function(_0x4d506c,_0x495426){_0x4d506c=_0x4d506c-0x0;var _0x139058=_0x41f7[_0x4d506c];return _0x139058;};'use strict';var _=require(_0x741f('0x0'));var moment=require(_0x741f('0x1'));var random=require(_0x741f('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x741f('0x3'));var tnef=require(_0x741f('0x4'));var logger=require(_0x741f('0x5'))(_0x741f('0x6'));var config=require(_0x741f('0x7'));function getAddress(_0x35f02c){var _0xfa7ad7=_['head'](_0x35f02c[_0x741f('0x8')]);return _0xfa7ad7&&_0xfa7ad7['address']?_0xfa7ad7[_0x741f('0x9')]:'anonymous'+random['generate'](0x6)+_0x741f('0xa');}function getFirstName(_0x543d59){var _0x1a3b63=_[_0x741f('0xb')](_0x543d59[_0x741f('0x8')]);if(_0x1a3b63&&_0x1a3b63[_0x741f('0xc')]){if(_0x1a3b63[_0x741f('0xc')]==_0x1a3b63[_0x741f('0x9')]){return _0x1a3b63['name'][_0x741f('0xd')](0x0,_0x1a3b63['name']['indexOf']('@'));}var _0x59f6c6=_0x1a3b63[_0x741f('0xc')]['split'](/\s+/);return _0x59f6c6['length']>0x1?_0x59f6c6[_0x741f('0xe')](0x0,-0x1)[_0x741f('0xf')]('\x20'):_0x1a3b63['name'];}return _0x741f('0x10');}function getLastName(_0x1cce7e){var _0x567be8=_[_0x741f('0xb')](_0x1cce7e[_0x741f('0x8')]);if(_0x567be8&&_0x567be8[_0x741f('0xc')]){var _0x5c6b63=_0x567be8['name'][_0x741f('0x11')](/\s+/);return _0x5c6b63['length']>0x1?_0x5c6b63[_0x741f('0x12')]():'';}return'';}function getMails(_0x4ab0fe,_0x172a2b){var _0x39d95b='';for(var _0x56b28e=0x0;_0x56b28e<_0x172a2b[_0x741f('0x8')]['length'];_0x56b28e+=0x1){if(_0x172a2b[_0x741f('0x8')][_0x56b28e][_0x741f('0x9')]!==_0x4ab0fe){if(!_[_0x741f('0x13')](_0x39d95b)){_0x39d95b+=',';}_0x39d95b+=_0x172a2b[_0x741f('0x8')][_0x56b28e][_0x741f('0xc')]||_0x172a2b[_0x741f('0x8')][_0x56b28e]['address']||'';_0x39d95b+='\x20<';_0x39d95b+=_0x172a2b['value'][_0x56b28e][_0x741f('0x9')]?_0x172a2b[_0x741f('0x8')][_0x56b28e][_0x741f('0x9')]:_0x741f('0x14')+random[_0x741f('0x15')](0x6)+_0x741f('0xa');_0x39d95b+='>';}}return _0x39d95b;}function parseEmail(_0x57c61f,_0x55b6d9,_0x347a20){if(_0x55b6d9[_0x741f('0x16')]){var _0x29b37e=/)<[^<]*)*<\/script>/gi;while(_0x29b37e['test'](_0x55b6d9[_0x741f('0x16')])){_0x55b6d9[_0x741f('0x16')]=_0x55b6d9[_0x741f('0x16')]['replace'](_0x29b37e,'');}if(_0x55b6d9[_0x741f('0x16')][_0x741f('0x17')]('{_0x340bfc['push'](_0x107973[_0x741f('0x1a')]);});var _0x637bc2=/]+>/g;var _0x1cfe9c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x20aa02=_0x55b6d9[_0x741f('0x16')][_0x741f('0x1b')](_0x1cfe9c,'_SRC');var _0x14fea4=_0x20aa02[_0x741f('0x1b')](_0x637bc2,_0x741f('0x1c'));for(let _0x671989=0x0;_0x671989<_0x340bfc[_0x741f('0x1d')];_0x671989++){var _0x13c13b=_0x14fea4['replace']('_IMG',_0x741f('0x1e')+_0x340bfc[_0x671989]+'\x20]');_0x14fea4=_0x13c13b;}_0x55b6d9[_0x741f('0x16')]=_0x14fea4;}_0x347a20['body']=_0x55b6d9[_0x741f('0x16')];}else{_0x347a20[_0x741f('0x1f')]=_0x55b6d9[_0x741f('0x20')];}if(_0x347a20['body']){_0x347a20['body']=_0x347a20[_0x741f('0x1f')][_0x741f('0x1b')](/0x0){var _0x9fe4c5=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x741f('0x30')];for(var _0x5daa8a=0x0;_0x5daa8a<_0x55b6d9[_0x741f('0x2f')]['length'];_0x5daa8a++){var _0x2f41d6=_['indexOf'](_0x9fe4c5,_0x55b6d9[_0x741f('0x2f')][_0x5daa8a][_0x741f('0x31')]);if(_0x2f41d6>=0x0){_0x347a20[_0x741f('0x32')]=!![];}}}return _0x347a20;}exports[_0x741f('0x33')]=function(_0x448540,_0x47003d,_0x3060bc){var _0x33dd68={'from':getAddress(_0x47003d[_0x741f('0x34')]),'firstName':getFirstName(_0x47003d[_0x741f('0x34')]),'lastName':getLastName(_0x47003d[_0x741f('0x34')]),'mapKey':_0x741f('0x6'),'message':{'from':getMails(_0x448540[_0x741f('0x6')],_0x47003d['from']),'to':_0x448540[_0x741f('0x6')],'cc':'','subject':_0x47003d['subject']||'','messageId':_0x47003d[_0x741f('0x35')],'inReplyTo':_0x47003d['inReplyTo'],'sentAt':moment(_0x47003d['date'])[_0x741f('0x36')](_0x741f('0x37')),'attach':![],'attachments':[]}};if(!_0x47003d[_0x741f('0x16')]&&!_0x47003d[_0x741f('0x20')]){var _0x1788cd=_['filter'](_0x47003d[_0x741f('0x18')],{'contentType':_0x741f('0x38')});if(_0x1788cd['length']){logger[_0x741f('0x39')](util[_0x741f('0x36')](_0x741f('0x3a'),_0x47003d[_0x741f('0x35')]));tnef['parseBuffer'](_[_0x741f('0x3b')](_0x1788cd)[_0x741f('0x2c')],function(_0x562e1f,_0x1d1b4a){if(_0x1d1b4a){_0x47003d[_0x741f('0x16')]=_0x1d1b4a[_0x741f('0x3c')]||_0x741f('0x3d');if(_0x1d1b4a['Attachments']){for(var _0x281e9d=0x0;_0x281e9d<_0x1d1b4a[_0x741f('0x3e')][_0x741f('0x1d')];_0x281e9d++){var _0x425b11=_0x1d1b4a[_0x741f('0x3e')][_0x281e9d];_0x33dd68['message']['attachments']['push']({'filename':_0x425b11[_0x741f('0x3f')],'content':Buffer[_0x741f('0x34')](_0x425b11[_0x741f('0x40')])});}}}_0x3060bc(parseEmail(_0x448540,_0x47003d,_0x33dd68));});}else{_0x47003d[_0x741f('0x16')]=_0x741f('0x3d');_0x3060bc(parseEmail(_0x448540,_0x47003d,_0x33dd68));}}else{_0x3060bc(parseEmail(_0x448540,_0x47003d,_0x33dd68));}};exports[_0x741f('0x41')]=function(_0x46ed07){switch(_0x46ed07){case'gmail':return _0x741f('0x42');case _0x741f('0x43'):return'imap.mail.yahoo.com';case'hotmail':return'imap-mail.outlook.com';case _0x741f('0x44'):return _0x741f('0x45');}return _0x741f('0x46');};exports[_0x741f('0x47')]=function(_0x17e60e,_0x1ee334){var _0x29403e=[_0x741f('0x48')+(_0x1ee334||''),_0x741f('0x49')+_0x17e60e,'',''];return Buffer[_0x741f('0x34')](_0x29403e['join'](''),_0x741f('0x4a'))[_0x741f('0x4b')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 21cfc0d..1139aad 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 _0x25fe=['active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x56fd7f,_0x4f3507){var _0x2bdb48=function(_0x21abad){while(--_0x21abad){_0x56fd7f['push'](_0x56fd7f['shift']());}};_0x2bdb48(++_0x4f3507);}(_0x25fe,0xdc));var _0xe25f=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x25fe[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0xe25f('0x0'));function MailAccount(_0x15b5cd){this['id']=_0x15b5cd['id']||0x0;this[_0xe25f('0x1')]=_0x15b5cd['name']||_0xe25f('0x2');this[_0xe25f('0x3')]=_0x15b5cd[_0xe25f('0x3')]||'SERV';this[_0xe25f('0x4')]=_0x15b5cd[_0xe25f('0x4')]||![];this[_0xe25f('0x5')]=_0x15b5cd[_0xe25f('0x5')]||[];this[_0xe25f('0x6')]=_0x15b5cd[_0xe25f('0x6')]||[];}module[_0xe25f('0x7')]=MailAccount; \ No newline at end of file +var _0xf062=['lodash','name','Service','key','SERV','active','Smtp','exports'];(function(_0x47e3e6,_0x270c04){var _0x324041=function(_0x5afee2){while(--_0x5afee2){_0x47e3e6['push'](_0x47e3e6['shift']());}};_0x324041(++_0x270c04);}(_0xf062,0x1d0));var _0x2f06=function(_0x6310b9,_0x352e0c){_0x6310b9=_0x6310b9-0x0;var _0x15847c=_0xf062[_0x6310b9];return _0x15847c;};'use strict';var _=require(_0x2f06('0x0'));function MailAccount(_0x3a5b7c){this['id']=_0x3a5b7c['id']||0x0;this[_0x2f06('0x1')]=_0x3a5b7c['name']||_0x2f06('0x2');this[_0x2f06('0x3')]=_0x3a5b7c[_0x2f06('0x3')]||_0x2f06('0x4');this[_0x2f06('0x5')]=_0x3a5b7c['active']||![];this['Imap']=_0x3a5b7c['Imap']||[];this[_0x2f06('0x6')]=_0x3a5b7c[_0x2f06('0x6')]||[];}module[_0x2f06('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5353e46..9d20777 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 _0xd5b0=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge'];(function(_0xf43cb,_0x465374){var _0x14e869=function(_0x454719){while(--_0x454719){_0xf43cb['push'](_0xf43cb['shift']());}};_0x14e869(++_0x465374);}(_0xd5b0,0x135));var _0x0d5b=function(_0x28fbfa,_0x159c9a){_0x28fbfa=_0x28fbfa-0x0;var _0x4b7bae=_0xd5b0[_0x28fbfa];return _0x4b7bae;};'use strict';var _=require(_0x0d5b('0x0'));var MailAccount=require(_0x0d5b('0x1'));var Realtime=function(){this[_0x0d5b('0x2')]={};};function freeIsNotKey(_0x290cd3,_0x5c6d75,_0x58a9ae){var _0x57f064=_[_0x0d5b('0x3')](_0x290cd3,function(_0x28185b,_0x193037){return _0x28185b[_0x58a9ae];});for(var _0x5ddb2c in _0x5c6d75){if(_0x5c6d75['hasOwnProperty'](_0x5ddb2c)){if(!_0x57f064[_0x5ddb2c]){delete _0x5c6d75[_0x5ddb2c];}}}}Realtime[_0x0d5b('0x4')][_0x0d5b('0x5')]=function(_0xce84fd,_0xf07d64){for(var _0x44c0ce in _0xf07d64){if(_0xce84fd['hasOwnProperty'](_0x44c0ce)){_0xce84fd[_0x44c0ce]=_0xf07d64[_0x44c0ce];}}};Realtime['prototype'][_0x0d5b('0x6')]=function(){var _0xb45d03=this;return function(_0x3eab58){if(_0x3eab58){freeIsNotKey(_0x3eab58,_0xb45d03[_0x0d5b('0x2')],'id');for(var _0x5d9c36=0x0,_0x44d4bf={},_0x1feca2={};_0x5d9c36<_0x3eab58[_0x0d5b('0x7')];_0x5d9c36+=0x1){_0x44d4bf=_0x3eab58[_0x5d9c36];if(_[_0x0d5b('0x8')](_0xb45d03[_0x0d5b('0x2')][_0x44d4bf['id']])){_0xb45d03[_0x0d5b('0x2')][_0x44d4bf['id']]=new MailAccount(_0x44d4bf);}else{_[_0x0d5b('0x9')](_0xb45d03['mailAccounts'][_0x44d4bf['id']],_0x44d4bf);}}}return _0xb45d03['mailAccounts'];};};module[_0x0d5b('0xa')]=Realtime; \ No newline at end of file +var _0x367b=['isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','length'];(function(_0x36a11b,_0x3f4260){var _0x327c0f=function(_0x1dbbbc){while(--_0x1dbbbc){_0x36a11b['push'](_0x36a11b['shift']());}};_0x327c0f(++_0x3f4260);}(_0x367b,0xb9));var _0xb367=function(_0x132b21,_0x59b703){_0x132b21=_0x132b21-0x0;var _0x26f0f7=_0x367b[_0x132b21];return _0x26f0f7;};'use strict';var _=require(_0xb367('0x0'));var MailAccount=require(_0xb367('0x1'));var Realtime=function(){this[_0xb367('0x2')]={};};function freeIsNotKey(_0x84d803,_0x5c4a63,_0x4d97c1){var _0x1e7f1a=_['mapKeys'](_0x84d803,function(_0x299fc2,_0x48639d){return _0x299fc2[_0x4d97c1];});for(var _0x3c1a18 in _0x5c4a63){if(_0x5c4a63[_0xb367('0x3')](_0x3c1a18)){if(!_0x1e7f1a[_0x3c1a18]){delete _0x5c4a63[_0x3c1a18];}}}}Realtime[_0xb367('0x4')][_0xb367('0x5')]=function(_0x2c7764,_0x175114){for(var _0x1478d4 in _0x175114){if(_0x2c7764[_0xb367('0x3')](_0x1478d4)){_0x2c7764[_0x1478d4]=_0x175114[_0x1478d4];}}};Realtime[_0xb367('0x4')]['initMailAccounts']=function(){var _0x29033b=this;return function(_0x113021){if(_0x113021){freeIsNotKey(_0x113021,_0x29033b[_0xb367('0x2')],'id');for(var _0x5223=0x0,_0x37772b={},_0xd9002b={};_0x5223<_0x113021[_0xb367('0x6')];_0x5223+=0x1){_0x37772b=_0x113021[_0x5223];if(_[_0xb367('0x7')](_0x29033b[_0xb367('0x2')][_0x37772b['id']])){_0x29033b['mailAccounts'][_0x37772b['id']]=new MailAccount(_0x37772b);}else{_['merge'](_0x29033b[_0xb367('0x2')][_0x37772b['id']],_0x37772b);}}}return _0x29033b[_0xb367('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ae34ff4..684d71f 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 _0x9048=['MailServerOut','Smtp','notify','NotifyMailAccount','../client','Request','service','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0x9048,0xf2));var _0x8904=function(_0x40bc97,_0xa6503b){_0x40bc97=_0x40bc97-0x0;var _0x3b5d13=_0x9048[_0x40bc97];return _0x3b5d13;};'use strict';var client=require(_0x8904('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x8904('0x1')]('GetMailAccount',{'options':{'attributes':['id','name','provider',_0x8904('0x2'),_0x8904('0x3'),'active',_0x8904('0x4'),_0x8904('0x5'),_0x8904('0x6')],'raw':![],'include':[{'model':_0x8904('0x7'),'as':_0x8904('0x8'),'include':[{'model':_0x8904('0x9'),'attributes':['id',_0x8904('0xa'),_0x8904('0x2'),_0x8904('0xb'),_0x8904('0xc')],'as':_0x8904('0x9')}]},{'model':_0x8904('0xd'),'as':_0x8904('0xe'),'include':[{'model':_0x8904('0x9'),'attributes':['id','name','service',_0x8904('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x8904('0xf')]=function(_0x548d60,_0x1b1a6e){return client[_0x8904('0x1')](_0x8904('0x10'),{'account':{'id':_0x548d60},'body':_0x1b1a6e,'log':_0x8904('0x10')});}; \ No newline at end of file +var _0x9303=['TemplateId','Imap','service','type','data5','CloudProvider','MailServerOut','name','getMailAccount','notify','NotifyMailAccount','../client','GetMailAccount','provider','active','key','ListId'];(function(_0x456290,_0x27e86c){var _0x169e83=function(_0x31d5ef){while(--_0x31d5ef){_0x456290['push'](_0x456290['shift']());}};_0x169e83(++_0x27e86c);}(_0x9303,0xd7));var _0x3930=function(_0x16d578,_0x3cbca3){_0x16d578=_0x16d578-0x0;var _0x3c0177=_0x9303[_0x16d578];return _0x3c0177;};'use strict';var client=require(_0x3930('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x3930('0x1'),{'options':{'attributes':['id','name',_0x3930('0x2'),'service','email',_0x3930('0x3'),_0x3930('0x4'),_0x3930('0x5'),_0x3930('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x3930('0x7'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x3930('0x8'),_0x3930('0x9'),_0x3930('0xa')],'as':_0x3930('0xb')}]},{'model':_0x3930('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x3930('0xd'),'service','type','data5'],'as':_0x3930('0xb')}]}]},'log':_0x3930('0xe')});};};exports[_0x3930('0xf')]=function(_0x272eb5,_0x161c1e){return client['Request'](_0x3930('0x10'),{'account':{'id':_0x272eb5},'body':_0x161c1e,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7e551d8..0a00fa1 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 _0xd02b=['../client','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x18efc2,_0x35d1cb){var _0x2a92a7=function(_0x11b2ec){while(--_0x11b2ec){_0x18efc2['push'](_0x18efc2['shift']());}};_0x2a92a7(++_0x35d1cb);}(_0xd02b,0xb9));var _0xbd02=function(_0x4fd471,_0x1f4ab4){_0x4fd471=_0x4fd471-0x0;var _0x3dbc37=_0xd02b[_0x4fd471];return _0x3dbc37;};'use strict';var client=require(_0xbd02('0x0'));exports['getSettings']=function(){return client[_0xbd02('0x1')](_0xbd02('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbd02('0x3')]},'log':_0xbd02('0x4')});}; \ No newline at end of file +var _0x76e0=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x58b250,_0x210a75){var _0x2ad6d6=function(_0xfbc855){while(--_0xfbc855){_0x58b250['push'](_0x58b250['shift']());}};_0x2ad6d6(++_0x210a75);}(_0x76e0,0x177));var _0x076e=function(_0x2a2211,_0x90f68f){_0x2a2211=_0x2a2211-0x0;var _0x57e663=_0x76e0[_0x2a2211];return _0x57e663;};'use strict';var client=require(_0x076e('0x0'));exports[_0x076e('0x1')]=function(){return client[_0x076e('0x2')](_0x076e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x076e('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index db8c623..6ce6f7e 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(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 68800cc..1244872 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 _0x70e2=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','ioredis','createServer','timeout','socket.io','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes'];(function(_0x1ae212,_0x326175){var _0x114025=function(_0xc8a28){while(--_0xc8a28){_0x1ae212['push'](_0x1ae212['shift']());}};_0x114025(++_0x326175);}(_0x70e2,0x1d2));var _0x270e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x70e2[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x270e('0x0'));var http=require('http');var express=require(_0x270e('0x1'));var sticky=require('sticky-session');var Redis=require(_0x270e('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x270e('0x3')](app);server[_0x270e('0x4')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x270e('0x5'))(server,{'transports':[_0x270e('0x6'),_0x270e('0x7')]});config['redis']=_[_0x270e('0x8')](config[_0x270e('0x9')],{'host':_0x270e('0xa'),'port':0x18eb});socketio[_0x270e('0xb')](require(_0x270e('0xc'))({'pubClient':new Redis(config[_0x270e('0x9')]),'subClient':new Redis(config[_0x270e('0x9')])}));require(_0x270e('0xd'))[_0x270e('0xe')]();require(_0x270e('0xf'))['default'](socketio);require('../../config/express')[_0x270e('0xe')](app);require(_0x270e('0x10'))[_0x270e('0xe')](app);}else{server[_0x270e('0x11')](_0x270e('0x12'),function(){console[_0x270e('0x13')](_0x270e('0x14'),config[_0x270e('0x15')]);});}exports=module[_0x270e('0x16')]=app; \ No newline at end of file +var _0x8efb=['polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port'];(function(_0xf06d43,_0x292b43){var _0x57283b=function(_0x20d298){while(--_0x20d298){_0xf06d43['push'](_0xf06d43['shift']());}};_0x57283b(++_0x292b43);}(_0x8efb,0x1ad));var _0xb8ef=function(_0x519e83,_0x2879eb){_0x519e83=_0x519e83-0x0;var _0x40dd98=_0x8efb[_0x519e83];return _0x40dd98;};'use strict';var _=require(_0xb8ef('0x0'));var http=require('http');var express=require(_0xb8ef('0x1'));var sticky=require(_0xb8ef('0x2'));var Redis=require(_0xb8ef('0x3'));var config=require(_0xb8ef('0x4'));var app=express();var server=http[_0xb8ef('0x5')](app);server[_0xb8ef('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0xb8ef('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xb8ef('0x8')]});config[_0xb8ef('0x9')]=_['defaults'](config[_0xb8ef('0x9')],{'host':_0xb8ef('0xa'),'port':0x18eb});socketio[_0xb8ef('0xb')](require(_0xb8ef('0xc'))({'pubClient':new Redis(config[_0xb8ef('0x9')]),'subClient':new Redis(config['redis'])}));require(_0xb8ef('0xd'))['default']();require(_0xb8ef('0xe'))[_0xb8ef('0xf')](socketio);require(_0xb8ef('0x10'))['default'](app);require(_0xb8ef('0x11'))[_0xb8ef('0xf')](app);}else{server[_0xb8ef('0x12')](_0xb8ef('0x13'),function(){console[_0xb8ef('0x14')](_0xb8ef('0x15'),config[_0xb8ef('0x7')]);});}exports=module[_0xb8ef('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9833c93..24e4438 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 _0x7d14=['bluebird','routing','client','Request','request','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x420cd4,_0x20169b){var _0x2cdc13=function(_0x989219){while(--_0x989219){_0x420cd4['push'](_0x420cd4['shift']());}};_0x2cdc13(++_0x20169b);}(_0x7d14,0x107));var _0x47d1=function(_0x56313e,_0x5db7ff){_0x56313e=_0x56313e-0x0;var _0x396cd0=_0x7d14[_0x56313e];return _0x396cd0;};'use strict';var jayson=require(_0x47d1('0x0'));var BPromise=require(_0x47d1('0x1'));var logger=require('../../config/logger')(_0x47d1('0x2'));var client=jayson[_0x47d1('0x3')]['http']({'port':0x2329});client[_0x47d1('0x4')]=function(_0x1f6044,_0x46ddde){return new BPromise(function(_0x23e0be,_0x1dbab3){return client[_0x47d1('0x5')](_0x1f6044,_0x46ddde)['then'](function(_0x23323a){logger[_0x47d1('0x6')](_0x47d1('0x7'),_0x47d1('0x2'),_0x1f6044,_0x46ddde,_0x23323a);if(_0x23323a['error']){logger[_0x47d1('0x8')](_0x47d1('0x7'),'routing',_0x1f6044,_0x23323a[_0x47d1('0x8')][_0x47d1('0x9')],_0x46ddde);return _0x1dbab3(_0x23323a[_0x47d1('0x8')][_0x47d1('0x9')]);}else{return _0x23e0be(_0x23323a[_0x47d1('0xa')]);}})['catch'](function(_0x555413){logger[_0x47d1('0x8')](_0x47d1('0x7'),'routing',_0x1f6044,_0x555413,_0x46ddde);return _0x1dbab3(_0x555413);});});};module[_0x47d1('0xb')]=client; \ No newline at end of file +var _0x389f=['message','result','catch','exports','jayson/promise','bluebird','routing','Request','request','debug','error','rpc'];(function(_0x1da448,_0x565a9f){var _0xdb7a13=function(_0x48bfc7){while(--_0x48bfc7){_0x1da448['push'](_0x1da448['shift']());}};_0xdb7a13(++_0x565a9f);}(_0x389f,0x1d8));var _0xf389=function(_0x393ebf,_0x449e5a){_0x393ebf=_0x393ebf-0x0;var _0x5808c2=_0x389f[_0x393ebf];return _0x5808c2;};'use strict';var jayson=require(_0xf389('0x0'));var BPromise=require(_0xf389('0x1'));var logger=require('../../config/logger')(_0xf389('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0xf389('0x3')]=function(_0x5cb5b6,_0x3ffaea){return new BPromise(function(_0x5a13af,_0x3f173e){return client[_0xf389('0x4')](_0x5cb5b6,_0x3ffaea)['then'](function(_0x3bae4b){logger[_0xf389('0x5')]('rpc',_0xf389('0x2'),_0x5cb5b6,_0x3ffaea,_0x3bae4b);if(_0x3bae4b[_0xf389('0x6')]){logger[_0xf389('0x6')](_0xf389('0x7'),_0xf389('0x2'),_0x5cb5b6,_0x3bae4b[_0xf389('0x6')]['message'],_0x3ffaea);return _0x3f173e(_0x3bae4b[_0xf389('0x6')][_0xf389('0x8')]);}else{return _0x5a13af(_0x3bae4b[_0xf389('0x9')]);}})[_0xf389('0xa')](function(_0x1673c6){logger[_0xf389('0x6')](_0xf389('0x7'),_0xf389('0x2'),_0x5cb5b6,_0x1673c6,_0x3ffaea);return _0x3f173e(_0x1673c6);});});};module[_0xf389('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index a9aee4d..eda8270 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 _0x384b=['./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval'];(function(_0xad8706,_0x3f7662){var _0x4d1d6c=function(_0x3f5ad7){while(--_0x3f5ad7){_0xad8706['push'](_0xad8706['shift']());}};_0x4d1d6c(++_0x3f7662);}(_0x384b,0xd9));var _0xb384=function(_0x1b5994,_0x33a804){_0x1b5994=_0x1b5994-0x0;var _0x537fa7=_0x384b[_0x1b5994];return _0x537fa7;};'use strict';var BPromise=require(_0xb384('0x0'));var server=require(_0xb384('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xb384('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xb384('0x3'));var smsQueue=require(_0xb384('0x4'));var mailQueue=require(_0xb384('0x5'));var faxQueue=require(_0xb384('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xb384('0x7')]()['then'](user['getAgents']())[_0xb384('0x8')](realtime[_0xb384('0x9')]())['then'](interval['getIntervals']())[_0xb384('0x8')](realtime[_0xb384('0xa')]())[_0xb384('0x8')](openchannelQueue[_0xb384('0xb')]())[_0xb384('0x8')](realtime[_0xb384('0xc')]())['then'](chatQueue['getChatQueues']())[_0xb384('0x8')](realtime['initChatQueues']())[_0xb384('0x8')](smsQueue[_0xb384('0xd')]())[_0xb384('0x8')](realtime[_0xb384('0xe')]())[_0xb384('0x8')](mailQueue[_0xb384('0xf')]())[_0xb384('0x8')](realtime['initMailQueues']())['then'](faxQueue[_0xb384('0x10')]())[_0xb384('0x8')](realtime[_0xb384('0x11')]())[_0xb384('0x8')](whatsappQueue[_0xb384('0x12')]())[_0xb384('0x8')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xb384('0x13')](realtime)[_0xb384('0x8')](function(_0x5cfa98){return initRealtime();})['then'](function(_0x1cc2f4){return setInterval(initRealtime,0x1388);})[_0xb384('0x14')](function(_0x4114e8){console[_0xb384('0x15')](_0x4114e8);});}main(); \ No newline at end of file +var _0x27dc=['./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues','initMailQueues','initWhatsappQueues','listen','log','bluebird'];(function(_0x5c8546,_0x30b36e){var _0xf655f0=function(_0x3510ea){while(--_0x3510ea){_0x5c8546['push'](_0x5c8546['shift']());}};_0xf655f0(++_0x30b36e);}(_0x27dc,0xdb));var _0xc27d=function(_0xf40ce5,_0x419f0b){_0xf40ce5=_0xf40ce5-0x0;var _0x461e04=_0x27dc[_0xf40ce5];return _0x461e04;};'use strict';var BPromise=require(_0xc27d('0x0'));var server=require(_0xc27d('0x1'));var Realtime=require(_0xc27d('0x2'));var user=require('./rpc/user');var interval=require(_0xc27d('0x3'));var openchannelQueue=require(_0xc27d('0x4'));var chatQueue=require(_0xc27d('0x5'));var smsQueue=require(_0xc27d('0x6'));var mailQueue=require(_0xc27d('0x7'));var faxQueue=require(_0xc27d('0x8'));var whatsappQueue=require(_0xc27d('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc27d('0xa')]()[_0xc27d('0xb')](user[_0xc27d('0xc')]())['then'](realtime[_0xc27d('0xd')]())[_0xc27d('0xb')](interval[_0xc27d('0xe')]())[_0xc27d('0xb')](realtime['initIntervals']())[_0xc27d('0xb')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xc27d('0xf')]())[_0xc27d('0xb')](chatQueue['getChatQueues']())[_0xc27d('0xb')](realtime['initChatQueues']())['then'](smsQueue[_0xc27d('0x10')]())[_0xc27d('0xb')](realtime[_0xc27d('0x11')]())[_0xc27d('0xb')](mailQueue['getMailQueues']())[_0xc27d('0xb')](realtime[_0xc27d('0x12')]())[_0xc27d('0xb')](faxQueue['getFaxQueues']())[_0xc27d('0xb')](realtime['initFaxQueues']())[_0xc27d('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xc27d('0x13')]())[_0xc27d('0xb')](function(){return realtime;});}function main(){return server[_0xc27d('0x14')](realtime)['then'](function(_0x1eade5){return initRealtime();})[_0xc27d('0xb')](function(_0x397bb7){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2a4576){console[_0xc27d('0x15')](_0x2a4576);});}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 b6a4eb5..cde50b6 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x3e3748,_0x118608){var _0x467996=function(_0x475275){while(--_0x475275){_0x3e3748['push'](_0x3e3748['shift']());}};_0x467996(++_0x118608);}(_0x326f,0xd1));var _0xf326=function(_0x5ba8ac,_0x15aabf){_0x5ba8ac=_0x5ba8ac-0x0;var _0xf91aa6=_0x326f[_0x5ba8ac];return _0xf91aa6;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x1771be,_0x2f8b1d){var _0x4c684a=function(_0x445043){while(--_0x445043){_0x1771be['push'](_0x1771be['shift']());}};_0x4c684a(++_0x2f8b1d);}(_0xe14b,0x93));var _0xbe14=function(_0x2feda6,_0x492e8f){_0x2feda6=_0x2feda6-0x0;var _0x220f37=_0xe14b[_0x2feda6];return _0x220f37;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 5cedd23..1d7cf58 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 _0xd7a9=['sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','result','catch'];(function(_0x2dfb6a,_0x3ddcdb){var _0x1ae0a6=function(_0x3ca00c){while(--_0x3ca00c){_0x2dfb6a['push'](_0x2dfb6a['shift']());}};_0x1ae0a6(++_0x3ddcdb);}(_0xd7a9,0x1cd));var _0x9d7a=function(_0x3be358,_0x47b502){_0x3be358=_0x3be358-0x0;var _0x2fa33a=_0xd7a9[_0x3be358];return _0x2fa33a;};'use strict';var BPromise=require(_0x9d7a('0x0'));var jayson=require(_0x9d7a('0x1'));var client=jayson[_0x9d7a('0x2')][_0x9d7a('0x3')]({'port':0x232b});function request(_0x2a3ee2,_0x22d566){return new BPromise(function(_0x3fe566,_0x1fed36){return client[_0x9d7a('0x4')](_0x2a3ee2,_0x22d566)[_0x9d7a('0x5')](function(_0x457321){if(_0x457321['error']){return _0x1fed36(_0x457321[_0x9d7a('0x6')]['message']);}else{return _0x3fe566(_0x457321[_0x9d7a('0x7')]);}})[_0x9d7a('0x8')](function(_0x11eec4){return _0x1fed36(_0x11eec4);});});}exports[_0x9d7a('0x9')]=function(_0x3d3b11,_0x283721){return request('SendMail',{'account':_0x3d3b11,'message':_0x283721});}; \ No newline at end of file +var _0x7e3a=['error','result','catch','sendMailMessage','SendMail','jayson/promise','client','request'];(function(_0x19b35e,_0x170c6a){var _0x25e655=function(_0x2b60c0){while(--_0x2b60c0){_0x19b35e['push'](_0x19b35e['shift']());}};_0x25e655(++_0x170c6a);}(_0x7e3a,0x105));var _0xa7e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7e3a[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa7e3('0x0'));var client=jayson[_0xa7e3('0x1')]['http']({'port':0x232b});function request(_0x3922a2,_0x457b15){return new BPromise(function(_0x212a67,_0x28f6df){return client[_0xa7e3('0x2')](_0x3922a2,_0x457b15)['then'](function(_0x2980dd){if(_0x2980dd[_0xa7e3('0x3')]){return _0x28f6df(_0x2980dd[_0xa7e3('0x3')]['message']);}else{return _0x212a67(_0x2980dd[_0xa7e3('0x4')]);}})[_0xa7e3('0x5')](function(_0x54d559){return _0x28f6df(_0x54d559);});});}exports[_0xa7e3('0x6')]=function(_0x2e7c3f,_0xb09d60){return request(_0xa7e3('0x7'),{'account':_0x2e7c3f,'message':_0xb09d60});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 88e0ad8..6b80a58 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 _0x20cc=['faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','openchannelCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','whatsappStatusTime','openchannelCurrentCapacity','user:save','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity'];(function(_0x1872d7,_0x23d7f4){var _0x4b68d8=function(_0x5dc506){while(--_0x5dc506){_0x1872d7['push'](_0x1872d7['shift']());}};_0x4b68d8(++_0x23d7f4);}(_0x20cc,0x196));var _0xc20c=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x20cc[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xc20c('0x0'));var moment=require(_0xc20c('0x1'));var md5=require(_0xc20c('0x2'));var Redis=require('ioredis');var config=require(_0xc20c('0x3'));config[_0xc20c('0x4')]=_[_0xc20c('0x5')](config[_0xc20c('0x4')],{'host':_0xc20c('0x6'),'port':0x18eb});var io=require(_0xc20c('0x7'))(new Redis(config[_0xc20c('0x4')]));function Agent(_0x2d311c){this['id']=_0x2d311c['id']||0x0;this[_0xc20c('0x8')]=_0x2d311c[_0xc20c('0x8')]||'';this[_0xc20c('0x9')]=_0x2d311c[_0xc20c('0x9')]||!![];this['voicePause']=_0x2d311c[_0xc20c('0xa')]||![];this[_0xc20c('0xb')]=_0x2d311c['chatPause']||![];this[_0xc20c('0xc')]=_0x2d311c[_0xc20c('0xc')]||![];this['faxPause']=_0x2d311c[_0xc20c('0xd')]||![];this[_0xc20c('0xe')]=_0x2d311c[_0xc20c('0xe')]||![];this[_0xc20c('0xf')]=_0x2d311c[_0xc20c('0xf')]||![];this['chatStatus']=_0xc20c('0x10');this[_0xc20c('0x11')]=0x0;this[_0xc20c('0x12')]=_0x2d311c[_0xc20c('0x12')]||0x0;this[_0xc20c('0x13')]=0x0;this[_0xc20c('0x14')]=_0xc20c('0x10');this[_0xc20c('0x15')]=0x0;this[_0xc20c('0x16')]=_0x2d311c['mailCapacity']||0x0;this[_0xc20c('0x17')]=0x0;this['faxStatus']=_0xc20c('0x10');this[_0xc20c('0x18')]=0x0;this[_0xc20c('0x19')]=_0x2d311c[_0xc20c('0x19')]||0x0;this[_0xc20c('0x1a')]=0x0;this[_0xc20c('0x1b')]=_0xc20c('0x10');this[_0xc20c('0x1c')]=0x0;this[_0xc20c('0x1d')]=_0x2d311c[_0xc20c('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xc20c('0x1e')]=_0xc20c('0x10');this['whatsappStatusTime']=0x0;this[_0xc20c('0x1f')]=_0x2d311c[_0xc20c('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xc20c('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x2d311c[_0xc20c('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xc20c('0x21')]=![];this[_0xc20c('0x22')]=undefined;this[_0xc20c('0x2')]='';this['updateRealtime']();}Agent[_0xc20c('0x23')][_0xc20c('0x24')]=function(_0x1dae6c){if(this[_0x1dae6c+_0xc20c('0x25')]>0x0){if(this[_0x1dae6c+_0xc20c('0x26')]>0x0&&this[_0x1dae6c+'CurrentCapacity']>=this[_0x1dae6c+_0xc20c('0x26')]){return _0xc20c('0x27');}else{return _0xc20c('0x28');}}else{return _0xc20c('0x29');}};Agent[_0xc20c('0x23')][_0xc20c('0x2a')]=function(){var _0x195971=[_0xc20c('0x2b'),'chat',_0xc20c('0x2c'),_0xc20c('0x2d'),'sms',_0xc20c('0x2e')];for(var _0x4f43a2=0x0;_0x4f43a2<_0x195971[_0xc20c('0x2f')];_0x4f43a2+=0x1){var _0xa55d11=this[_0xc20c('0x24')](_0x195971[_0x4f43a2]);if(this[_0x195971[_0x4f43a2]+_0xc20c('0x30')]!==_0xa55d11){this[_0x195971[_0x4f43a2]+_0xc20c('0x31')]=_[_0xc20c('0x32')](moment()['format']('x'));}this[_0x195971[_0x4f43a2]+_0xc20c('0x30')]=_0xa55d11;}var _0x5a6a94={'id':this['id'],'name':this[_0xc20c('0x8')],'online':this['online'],'voicePause':this[_0xc20c('0xa')],'chatPause':this[_0xc20c('0xb')],'mailPause':this[_0xc20c('0xc')],'smsPause':this[_0xc20c('0xe')],'faxPause':this[_0xc20c('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc20c('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc20c('0x13')],'mailStatus':this[_0xc20c('0x14')],'mailStatusTime':this[_0xc20c('0x15')],'mailCapacity':this[_0xc20c('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xc20c('0x19')],'faxCurrentCapacity':this[_0xc20c('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc20c('0x1c')],'smsCapacity':this[_0xc20c('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc20c('0x1e')],'whatsappStatusTime':this[_0xc20c('0x33')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xc20c('0x20')],'openchannelCurrentCapacity':this[_0xc20c('0x34')],'busy':this[_0xc20c('0x21')],'busyQueue':this[_0xc20c('0x22')]};var _0xbdaf1f=md5(JSON['stringify'](_0x5a6a94));if(this[_0xc20c('0x2')]!==_0xbdaf1f){this[_0xc20c('0x2')]=_0xbdaf1f;io['emit'](_0xc20c('0x35'),_0x5a6a94);}};module['exports']=Agent; \ No newline at end of file +var _0x36bc=['busy','stringify','emit','user:save','exports','lodash','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','prototype','mail','chat','openchannel','fax','sms','length','Status','toNumber','format','chatCurrentCapacity','faxStatus','openchannelCurrentCapacity'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x36bc,0xf5));var _0xc36b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x36bc[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xc36b('0x0'));var moment=require(_0xc36b('0x1'));var md5=require('md5');var Redis=require(_0xc36b('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xc36b('0x3')],{'host':_0xc36b('0x4'),'port':0x18eb});var io=require(_0xc36b('0x5'))(new Redis(config[_0xc36b('0x3')]));function Agent(_0x313447){this['id']=_0x313447['id']||0x0;this[_0xc36b('0x6')]=_0x313447['name']||'';this[_0xc36b('0x7')]=_0x313447[_0xc36b('0x7')]||!![];this[_0xc36b('0x8')]=_0x313447[_0xc36b('0x8')]||![];this[_0xc36b('0x9')]=_0x313447['chatPause']||![];this[_0xc36b('0xa')]=_0x313447['mailPause']||![];this[_0xc36b('0xb')]=_0x313447[_0xc36b('0xb')]||![];this[_0xc36b('0xc')]=_0x313447[_0xc36b('0xc')]||![];this[_0xc36b('0xd')]=_0x313447[_0xc36b('0xd')]||![];this['chatStatus']=_0xc36b('0xe');this[_0xc36b('0xf')]=0x0;this['chatCapacity']=_0x313447[_0xc36b('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xc36b('0x11')]=_0xc36b('0xe');this[_0xc36b('0x12')]=0x0;this[_0xc36b('0x13')]=_0x313447[_0xc36b('0x13')]||0x0;this[_0xc36b('0x14')]=0x0;this['faxStatus']=_0xc36b('0xe');this[_0xc36b('0x15')]=0x0;this[_0xc36b('0x16')]=_0x313447[_0xc36b('0x16')]||0x0;this[_0xc36b('0x17')]=0x0;this[_0xc36b('0x18')]='unknown';this[_0xc36b('0x19')]=0x0;this[_0xc36b('0x1a')]=_0x313447['smsCapacity']||0x0;this[_0xc36b('0x1b')]=0x0;this[_0xc36b('0x1c')]=_0xc36b('0xe');this[_0xc36b('0x1d')]=0x0;this[_0xc36b('0x1e')]=_0x313447[_0xc36b('0x1e')]||0x0;this[_0xc36b('0x1f')]=0x0;this[_0xc36b('0x20')]=_0xc36b('0xe');this[_0xc36b('0x21')]=0x0;this['openchannelCapacity']=_0x313447[_0xc36b('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xc36b('0x23')]=undefined;this[_0xc36b('0x24')]='';this[_0xc36b('0x25')]();}Agent['prototype'][_0xc36b('0x26')]=function(_0x50be47){if(this[_0x50be47+_0xc36b('0x27')]>0x0){if(this[_0x50be47+_0xc36b('0x28')]>0x0&&this[_0x50be47+_0xc36b('0x27')]>=this[_0x50be47+_0xc36b('0x28')]){return _0xc36b('0x29');}else{return'working';}}else{return'idle';}};Agent[_0xc36b('0x2a')]['updateRealtime']=function(){var _0x1338f4=[_0xc36b('0x2b'),_0xc36b('0x2c'),_0xc36b('0x2d'),_0xc36b('0x2e'),_0xc36b('0x2f'),'whatsapp'];for(var _0x3148c4=0x0;_0x3148c4<_0x1338f4[_0xc36b('0x30')];_0x3148c4+=0x1){var _0x65c99d=this[_0xc36b('0x26')](_0x1338f4[_0x3148c4]);if(this[_0x1338f4[_0x3148c4]+_0xc36b('0x31')]!==_0x65c99d){this[_0x1338f4[_0x3148c4]+'StatusTime']=_[_0xc36b('0x32')](moment()[_0xc36b('0x33')]('x'));}this[_0x1338f4[_0x3148c4]+_0xc36b('0x31')]=_0x65c99d;}var _0x9c8429={'id':this['id'],'name':this[_0xc36b('0x6')],'online':this[_0xc36b('0x7')],'voicePause':this[_0xc36b('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xc36b('0xc')],'faxPause':this[_0xc36b('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc36b('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc36b('0x34')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc36b('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc36b('0x35')],'faxStatusTime':this[_0xc36b('0x15')],'faxCapacity':this[_0xc36b('0x16')],'faxCurrentCapacity':this[_0xc36b('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc36b('0x19')],'smsCapacity':this[_0xc36b('0x1a')],'smsCurrentCapacity':this[_0xc36b('0x1b')],'whatsappStatus':this[_0xc36b('0x1c')],'whatsappStatusTime':this[_0xc36b('0x1d')],'whatsappCapacity':this[_0xc36b('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xc36b('0x20')],'openchannelStatusTime':this[_0xc36b('0x21')],'openchannelCapacity':this[_0xc36b('0x22')],'openchannelCurrentCapacity':this[_0xc36b('0x36')],'busy':this[_0xc36b('0x37')],'busyQueue':this['busyQueue']};var _0x51d7bc=md5(JSON[_0xc36b('0x38')](_0x9c8429));if(this[_0xc36b('0x24')]!==_0x51d7bc){this[_0xc36b('0x24')]=_0x51d7bc;io[_0xc36b('0x39')](_0xc36b('0x3a'),_0x9c8429);}};module[_0xc36b('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4c99295..882863b 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 _0xd007=['emit','chat_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','map','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s'];(function(_0x3ea10f,_0x179252){var _0xae757f=function(_0x48d520){while(--_0x48d520){_0x3ea10f['push'](_0x3ea10f['shift']());}};_0xae757f(++_0x179252);}(_0xd007,0x1c2));var _0x7d00=function(_0x138468,_0x56982e){_0x138468=_0x138468-0x0;var _0x2b064d=_0xd007[_0x138468];return _0x2b064d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x7d00('0x0'));var Redis=require('ioredis');var config=require(_0x7d00('0x1'));config[_0x7d00('0x2')]=_[_0x7d00('0x3')](config['redis'],{'host':_0x7d00('0x4'),'port':0x18eb});var io=require(_0x7d00('0x5'))(new Redis(config['redis']));function ChatQueue(_0x54c865){this['id']=_0x54c865['id']||0x0;this[_0x7d00('0x6')]=_0x54c865[_0x7d00('0x6')]||'';this[_0x7d00('0x7')]=_0x54c865[_0x7d00('0x7')]||0xa;this[_0x7d00('0x8')]=_0x54c865['strategy']||_0x7d00('0x9');this[_0x7d00('0xa')]=_0x54c865[_0x7d00('0xa')];this[_0x7d00('0xb')]={};this['waiting']=0x0;this[_0x7d00('0xc')]='';this[_0x7d00('0xd')]();this[_0x7d00('0xe')]();}ChatQueue[_0x7d00('0xf')][_0x7d00('0xd')]=function(){var _0x12763a=this[_0x7d00('0xb')]['_rr'];this[_0x7d00('0xb')]=_[_0x7d00('0x10')](this[_0x7d00('0xa')],'id');this[_0x7d00('0xb')]['_rr']=_0x12763a;};ChatQueue[_0x7d00('0xf')][_0x7d00('0xe')]=function(){this['loggedIn']=0x0;this[_0x7d00('0x11')]=0x0;for(var _0xcc12bd=0x0;_0xcc12bd=0x0?this['available']:0x0;var _0x2b2fec={'id':this['id'],'available':this[_0x7d00('0x16')],'loggedIn':this[_0x7d00('0x14')],'name':this['name'],'paused':this[_0x7d00('0x11')],'waiting':this['waiting']};var _0x573866=md5(JSON[_0x7d00('0x17')](_0x2b2fec));if(this['md5']!==_0x573866){this[_0x7d00('0xc')]=_0x573866;io['to'](util[_0x7d00('0x18')](_0x7d00('0x19'),_0x2b2fec[_0x7d00('0x6')]))[_0x7d00('0x1a')](_0x7d00('0x1b'),_0x2b2fec);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8773=['mapAgentsId','waiting','updateRouting','prototype','map','_rr','loggedIn','paused','chatPause','available','format','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8773,0x17b));var _0x3877=function(_0x435909,_0x30d85a){_0x435909=_0x435909-0x0;var _0x957660=_0x8773[_0x435909];return _0x957660;};'use strict';var _=require(_0x3877('0x0'));var md5=require(_0x3877('0x1'));var util=require('util');var Redis=require(_0x3877('0x2'));var config=require(_0x3877('0x3'));config[_0x3877('0x4')]=_['defaults'](config['redis'],{'host':_0x3877('0x5'),'port':0x18eb});var io=require(_0x3877('0x6'))(new Redis(config[_0x3877('0x4')]));function ChatQueue(_0x474eb7){this['id']=_0x474eb7['id']||0x0;this['name']=_0x474eb7[_0x3877('0x7')]||'';this[_0x3877('0x8')]=_0x474eb7[_0x3877('0x8')]||0xa;this[_0x3877('0x9')]=_0x474eb7[_0x3877('0x9')]||_0x3877('0xa');this[_0x3877('0xb')]=_0x474eb7['Agents'];this[_0x3877('0xc')]={};this[_0x3877('0xd')]=0x0;this['md5']='';this[_0x3877('0xe')]();this['updateRealtime']();}ChatQueue[_0x3877('0xf')][_0x3877('0xe')]=function(){var _0x2b103c=this[_0x3877('0xc')]['_rr'];this[_0x3877('0xc')]=_[_0x3877('0x10')](this[_0x3877('0xb')],'id');this[_0x3877('0xc')][_0x3877('0x11')]=_0x2b103c;};ChatQueue[_0x3877('0xf')]['updateRealtime']=function(){this[_0x3877('0x12')]=0x0;this[_0x3877('0x13')]=0x0;for(var _0x2426c0=0x0;_0x2426c0=0x0?this[_0x3877('0x15')]:0x0;var _0x313df9={'id':this['id'],'available':this[_0x3877('0x15')],'loggedIn':this[_0x3877('0x12')],'name':this[_0x3877('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x176cac=md5(JSON['stringify'](_0x313df9));if(this[_0x3877('0x1')]!==_0x176cac){this['md5']=_0x176cac;io['to'](util[_0x3877('0x16')]('chat:queue:%s',_0x313df9['name']))['emit']('chat_queue:save',_0x313df9);}};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 7ea2177..1ac5e2a 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 _0x015b=['updateRealtime','loggedIn','length','paused','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x1f7420,_0x46922d){var _0x5574ac=function(_0x48f0e4){while(--_0x48f0e4){_0x1f7420['push'](_0x1f7420['shift']());}};_0x5574ac(++_0x46922d);}(_0x015b,0x10e));var _0xb015=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x015b[_0x11f249];return _0x5c3656;};'use strict';var _=require(_0xb015('0x0'));var md5=require(_0xb015('0x1'));var util=require(_0xb015('0x2'));var Redis=require(_0xb015('0x3'));var config=require(_0xb015('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb015('0x5'))(new Redis(config[_0xb015('0x6')]));function FaxQueue(_0x245b4f){this['id']=_0x245b4f['id']||0x0;this[_0xb015('0x7')]=_0x245b4f[_0xb015('0x7')]||'';this[_0xb015('0x8')]=_0x245b4f[_0xb015('0x8')]||0xa;this[_0xb015('0x9')]=_0x245b4f[_0xb015('0x9')]||'beepall';this[_0xb015('0xa')]=_0x245b4f[_0xb015('0xa')];this[_0xb015('0xb')]={};this[_0xb015('0xc')]=0x0;this[_0xb015('0x1')]='';this[_0xb015('0xd')]();this['updateRealtime']();}FaxQueue[_0xb015('0xe')]['updateRouting']=function(){var _0x11fb78=this['mapAgentsId'][_0xb015('0xf')];this[_0xb015('0xb')]=_['map'](this[_0xb015('0xa')],'id');this['mapAgentsId'][_0xb015('0xf')]=_0x11fb78;};FaxQueue[_0xb015('0xe')][_0xb015('0x10')]=function(){this[_0xb015('0x11')]=0x0;this['paused']=0x0;for(var _0x3c5443=0x0;_0x3c5443=0x0?this[_0xb015('0x14')]:0x0;var _0x15c50c={'id':this['id'],'available':this[_0xb015('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xb015('0x7')],'paused':this['paused'],'waiting':this[_0xb015('0xc')]};var _0x225607=md5(JSON[_0xb015('0x15')](_0x15c50c));if(this[_0xb015('0x1')]!==_0x225607){this[_0xb015('0x1')]=_0x225607;io['to'](util[_0xb015('0x16')]('fax:queue:%s',_0x15c50c['name']))[_0xb015('0x17')](_0xb015('0x18'),_0x15c50c);}};module[_0xb015('0x19')]=FaxQueue; \ No newline at end of file +var _0x6f1b=['faxPause','available','name','fax:queue:%s','emit','fax_queue:save','exports','md5','ioredis','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online'];(function(_0x10a60f,_0x2b1765){var _0x37bb5a=function(_0x17cee0){while(--_0x17cee0){_0x10a60f['push'](_0x10a60f['shift']());}};_0x37bb5a(++_0x2b1765);}(_0x6f1b,0x18f));var _0xb6f1=function(_0x761739,_0x4f1266){_0x761739=_0x761739-0x0;var _0x3f89e6=_0x6f1b[_0x761739];return _0x3f89e6;};'use strict';var _=require('lodash');var md5=require(_0xb6f1('0x0'));var util=require('util');var Redis=require(_0xb6f1('0x1'));var config=require('../../../config/environment');config[_0xb6f1('0x2')]=_[_0xb6f1('0x3')](config[_0xb6f1('0x2')],{'host':_0xb6f1('0x4'),'port':0x18eb});var io=require(_0xb6f1('0x5'))(new Redis(config['redis']));function FaxQueue(_0x2aea9d){this['id']=_0x2aea9d['id']||0x0;this['name']=_0x2aea9d['name']||'';this[_0xb6f1('0x6')]=_0x2aea9d['timeout']||0xa;this[_0xb6f1('0x7')]=_0x2aea9d[_0xb6f1('0x7')]||_0xb6f1('0x8');this[_0xb6f1('0x9')]=_0x2aea9d[_0xb6f1('0x9')];this[_0xb6f1('0xa')]={};this[_0xb6f1('0xb')]=0x0;this[_0xb6f1('0x0')]='';this[_0xb6f1('0xc')]();this[_0xb6f1('0xd')]();}FaxQueue[_0xb6f1('0xe')][_0xb6f1('0xc')]=function(){var _0x37ae24=this['mapAgentsId'][_0xb6f1('0xf')];this['mapAgentsId']=_[_0xb6f1('0x10')](this[_0xb6f1('0x9')],'id');this['mapAgentsId'][_0xb6f1('0xf')]=_0x37ae24;};FaxQueue[_0xb6f1('0xe')][_0xb6f1('0xd')]=function(){this[_0xb6f1('0x11')]=0x0;this[_0xb6f1('0x12')]=0x0;for(var _0x4b85bf=0x0;_0x4b85bf=0x0?this['available']:0x0;var _0x54aa87={'id':this['id'],'available':this[_0xb6f1('0x16')],'loggedIn':this[_0xb6f1('0x11')],'name':this[_0xb6f1('0x17')],'paused':this[_0xb6f1('0x12')],'waiting':this[_0xb6f1('0xb')]};var _0x32ebc5=md5(JSON['stringify'](_0x54aa87));if(this[_0xb6f1('0x0')]!==_0x32ebc5){this['md5']=_0x32ebc5;io['to'](util['format'](_0xb6f1('0x18'),_0x54aa87[_0xb6f1('0x17')]))[_0xb6f1('0x19')](_0xb6f1('0x1a'),_0x54aa87);}};module[_0xb6f1('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 82b4478..9480f3c 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 _0x076f=['Intervals','exports','name'];(function(_0x414fe5,_0x342c98){var _0x562d7b=function(_0x199169){while(--_0x199169){_0x414fe5['push'](_0x414fe5['shift']());}};_0x562d7b(++_0x342c98);}(_0x076f,0x197));var _0xf076=function(_0x32de8c,_0x2bfb6d){_0x32de8c=_0x32de8c-0x0;var _0x3f8c0d=_0x076f[_0x32de8c];return _0x3f8c0d;};'use strict';function Interval(_0x97b7f0){this['id']=_0x97b7f0['id']||0x0;this['name']=_0x97b7f0[_0xf076('0x0')]||'';this['Intervals']=_0x97b7f0[_0xf076('0x1')]||{};}module[_0xf076('0x2')]=Interval; \ No newline at end of file +var _0xa05e=['name','Intervals','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa05e,0x10e));var _0xea05=function(_0x32d819,_0xe22920){_0x32d819=_0x32d819-0x0;var _0x4d90ad=_0xa05e[_0x32d819];return _0x4d90ad;};'use strict';function Interval(_0x13760b){this['id']=_0x13760b['id']||0x0;this[_0xea05('0x0')]=_0x13760b[_0xea05('0x0')]||'';this[_0xea05('0x1')]=_0x13760b['Intervals']||{};}module[_0xea05('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 a712bfd..817917a 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 _0x9800=['exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','paused','available','waiting','stringify','format','emit','mail_queue:save'];(function(_0x4c5232,_0x270c3e){var _0x47ade2=function(_0xf67096){while(--_0xf67096){_0x4c5232['push'](_0x4c5232['shift']());}};_0x47ade2(++_0x270c3e);}(_0x9800,0xa9));var _0x0980=function(_0x97833d,_0x4d6c31){_0x97833d=_0x97833d-0x0;var _0x49e829=_0x9800[_0x97833d];return _0x49e829;};'use strict';var _=require(_0x0980('0x0'));var md5=require(_0x0980('0x1'));var util=require(_0x0980('0x2'));var Redis=require('ioredis');var config=require(_0x0980('0x3'));config[_0x0980('0x4')]=_[_0x0980('0x5')](config[_0x0980('0x4')],{'host':_0x0980('0x6'),'port':0x18eb});var io=require(_0x0980('0x7'))(new Redis(config['redis']));function MailQueue(_0x5a8c5a){this['id']=_0x5a8c5a['id']||0x0;this[_0x0980('0x8')]=_0x5a8c5a[_0x0980('0x8')]||'';this[_0x0980('0x9')]=_0x5a8c5a[_0x0980('0x9')]||0xa;this[_0x0980('0xa')]=_0x5a8c5a[_0x0980('0xa')]||'beepall';this[_0x0980('0xb')]=_0x5a8c5a[_0x0980('0xb')];this[_0x0980('0xc')]={};this['waiting']=0x0;this[_0x0980('0x1')]='';this[_0x0980('0xd')]();this[_0x0980('0xe')]();}MailQueue[_0x0980('0xf')][_0x0980('0xd')]=function(){var _0x3a018c=this[_0x0980('0xc')][_0x0980('0x10')];this[_0x0980('0xc')]=_[_0x0980('0x11')](this['Agents'],'id');this[_0x0980('0xc')][_0x0980('0x10')]=_0x3a018c;};MailQueue['prototype']['updateRealtime']=function(){this[_0x0980('0x12')]=0x0;this['paused']=0x0;for(var _0x4f8dab=0x0;_0x4f8dab=0x0?this['available']:0x0;var _0x542a40={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0980('0x8')],'paused':this[_0x0980('0x14')],'waiting':this[_0x0980('0x16')]};var _0x4334ac=md5(JSON[_0x0980('0x17')](_0x542a40));if(this['md5']!==_0x4334ac){this[_0x0980('0x1')]=_0x4334ac;io['to'](util[_0x0980('0x18')]('mail:queue:%s',_0x542a40[_0x0980('0x8')]))[_0x0980('0x19')](_0x0980('0x1a'),_0x542a40);}};module[_0x0980('0x1b')]=MailQueue; \ No newline at end of file +var _0xa509=['length','available','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xa509,0xf0));var _0x9a50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa509[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9a50('0x0'));var md5=require(_0x9a50('0x1'));var util=require('util');var Redis=require(_0x9a50('0x2'));var config=require(_0x9a50('0x3'));config[_0x9a50('0x4')]=_[_0x9a50('0x5')](config[_0x9a50('0x4')],{'host':_0x9a50('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x38513b){this['id']=_0x38513b['id']||0x0;this[_0x9a50('0x7')]=_0x38513b['name']||'';this[_0x9a50('0x8')]=_0x38513b[_0x9a50('0x8')]||0xa;this[_0x9a50('0x9')]=_0x38513b['strategy']||'beepall';this['Agents']=_0x38513b['Agents'];this[_0x9a50('0xa')]={};this[_0x9a50('0xb')]=0x0;this[_0x9a50('0x1')]='';this[_0x9a50('0xc')]();this[_0x9a50('0xd')]();}MailQueue[_0x9a50('0xe')][_0x9a50('0xc')]=function(){var _0x2d9ab0=this[_0x9a50('0xa')][_0x9a50('0xf')];this[_0x9a50('0xa')]=_[_0x9a50('0x10')](this[_0x9a50('0x11')],'id');this[_0x9a50('0xa')][_0x9a50('0xf')]=_0x2d9ab0;};MailQueue[_0x9a50('0xe')][_0x9a50('0xd')]=function(){this[_0x9a50('0x12')]=0x0;this[_0x9a50('0x13')]=0x0;for(var _0x1ca613=0x0;_0x1ca613=0x0?this[_0x9a50('0x15')]:0x0;var _0x3a385a={'id':this['id'],'available':this[_0x9a50('0x15')],'loggedIn':this[_0x9a50('0x12')],'name':this[_0x9a50('0x7')],'paused':this[_0x9a50('0x13')],'waiting':this[_0x9a50('0xb')]};var _0x1c78c1=md5(JSON['stringify'](_0x3a385a));if(this[_0x9a50('0x1')]!==_0x1c78c1){this[_0x9a50('0x1')]=_0x1c78c1;io['to'](util[_0x9a50('0x16')](_0x9a50('0x17'),_0x3a385a['name']))['emit'](_0x9a50('0x18'),_0x3a385a);}};module[_0x9a50('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 405f06e..a0dfe8c 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x326f,0xd1));var _0xf326=function(_0x59fe84,_0xcd7a7e){_0x59fe84=_0x59fe84-0x0;var _0x81332=_0x326f[_0x59fe84];return _0x81332;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4cc1b2,_0x3c3273){var _0x55aa48=function(_0x48b430){while(--_0x48b430){_0x4cc1b2['push'](_0x4cc1b2['shift']());}};_0x55aa48(++_0x3c3273);}(_0x814b,0x1a2));var _0xb814=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x814b[_0xfcfc24];return _0x58f773;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ea1cd57..faf20e8 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 _0xe94a=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x32b76e,_0x14b20f){var _0x45177f=function(_0x44a335){while(--_0x44a335){_0x32b76e['push'](_0x32b76e['shift']());}};_0x45177f(++_0x14b20f);}(_0xe94a,0x1c7));var _0xae94=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0xe94a[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0xae94('0x0'));var md5=require(_0xae94('0x1'));var util=require(_0xae94('0x2'));var Redis=require('ioredis');var config=require(_0xae94('0x3'));config[_0xae94('0x4')]=_[_0xae94('0x5')](config[_0xae94('0x4')],{'host':_0xae94('0x6'),'port':0x18eb});var io=require(_0xae94('0x7'))(new Redis(config['redis']));function SmsQueue(_0x429d6d){this['id']=_0x429d6d['id']||0x0;this[_0xae94('0x8')]=_0x429d6d[_0xae94('0x8')]||'';this[_0xae94('0x9')]=_0x429d6d[_0xae94('0x9')]||0xa;this['strategy']=_0x429d6d['strategy']||_0xae94('0xa');this[_0xae94('0xb')]=_0x429d6d['Agents'];this[_0xae94('0xc')]={};this[_0xae94('0xd')]=0x0;this[_0xae94('0x1')]='';this[_0xae94('0xe')]();this[_0xae94('0xf')]();}SmsQueue[_0xae94('0x10')][_0xae94('0xe')]=function(){var _0x3e24c6=this['mapAgentsId']['_rr'];this[_0xae94('0xc')]=_[_0xae94('0x11')](this['Agents'],'id');this[_0xae94('0xc')]['_rr']=_0x3e24c6;};SmsQueue[_0xae94('0x10')][_0xae94('0xf')]=function(){this[_0xae94('0x12')]=0x0;this[_0xae94('0x13')]=0x0;for(var _0x223e35=0x0;_0x223e35=0x0?this[_0xae94('0x16')]:0x0;var _0x382b4a={'id':this['id'],'available':this[_0xae94('0x16')],'loggedIn':this[_0xae94('0x12')],'name':this['name'],'paused':this[_0xae94('0x13')],'waiting':this[_0xae94('0xd')]};var _0x5a0cdd=md5(JSON[_0xae94('0x17')](_0x382b4a));if(this[_0xae94('0x1')]!==_0x5a0cdd){this['md5']=_0x5a0cdd;io['to'](util[_0xae94('0x18')](_0xae94('0x19'),_0x382b4a[_0xae94('0x8')]))[_0xae94('0x1a')](_0xae94('0x1b'),_0x382b4a);}};module[_0xae94('0x1c')]=SmsQueue; \ No newline at end of file +var _0x17ba=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','smsPause','paused','available','waiting','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x12d39e,_0xc9c7c7){var _0x1bd418=function(_0x1182a5){while(--_0x1182a5){_0x12d39e['push'](_0x12d39e['shift']());}};_0x1bd418(++_0xc9c7c7);}(_0x17ba,0xab));var _0xa17b=function(_0x170ffe,_0x35a497){_0x170ffe=_0x170ffe-0x0;var _0x48ac08=_0x17ba[_0x170ffe];return _0x48ac08;};'use strict';var _=require(_0xa17b('0x0'));var md5=require(_0xa17b('0x1'));var util=require('util');var Redis=require(_0xa17b('0x2'));var config=require(_0xa17b('0x3'));config[_0xa17b('0x4')]=_[_0xa17b('0x5')](config[_0xa17b('0x4')],{'host':_0xa17b('0x6'),'port':0x18eb});var io=require(_0xa17b('0x7'))(new Redis(config[_0xa17b('0x4')]));function SmsQueue(_0x1dc353){this['id']=_0x1dc353['id']||0x0;this[_0xa17b('0x8')]=_0x1dc353[_0xa17b('0x8')]||'';this[_0xa17b('0x9')]=_0x1dc353[_0xa17b('0x9')]||0xa;this[_0xa17b('0xa')]=_0x1dc353[_0xa17b('0xa')]||_0xa17b('0xb');this[_0xa17b('0xc')]=_0x1dc353[_0xa17b('0xc')];this[_0xa17b('0xd')]={};this['waiting']=0x0;this[_0xa17b('0x1')]='';this[_0xa17b('0xe')]();this[_0xa17b('0xf')]();}SmsQueue[_0xa17b('0x10')][_0xa17b('0xe')]=function(){var _0x4382df=this[_0xa17b('0xd')]['_rr'];this[_0xa17b('0xd')]=_[_0xa17b('0x11')](this[_0xa17b('0xc')],'id');this['mapAgentsId'][_0xa17b('0x12')]=_0x4382df;};SmsQueue[_0xa17b('0x10')][_0xa17b('0xf')]=function(){this[_0xa17b('0x13')]=0x0;this['paused']=0x0;for(var _0x117ad9=0x0;_0x117ad9=0x0?this[_0xa17b('0x17')]:0x0;var _0x197237={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa17b('0x13')],'name':this[_0xa17b('0x8')],'paused':this[_0xa17b('0x16')],'waiting':this[_0xa17b('0x18')]};var _0x2a340d=md5(JSON[_0xa17b('0x19')](_0x197237));if(this[_0xa17b('0x1')]!==_0x2a340d){this['md5']=_0x2a340d;io['to'](util[_0xa17b('0x1a')](_0xa17b('0x1b'),_0x197237[_0xa17b('0x8')]))['emit'](_0xa17b('0x1c'),_0x197237);}};module[_0xa17b('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c90ea7a..28cbd76 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 _0x5438=['timeout','strategy','Agents','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','length','whatsappPause','paused','available','waiting','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x13745c,_0x302072){var _0x143fcb=function(_0x54a73a){while(--_0x54a73a){_0x13745c['push'](_0x13745c['shift']());}};_0x143fcb(++_0x302072);}(_0x5438,0x12c));var _0x8543=function(_0x1968ef,_0x5218db){_0x1968ef=_0x1968ef-0x0;var _0x2d2dfa=_0x5438[_0x1968ef];return _0x2d2dfa;};'use strict';var _=require('lodash');var md5=require(_0x8543('0x0'));var util=require(_0x8543('0x1'));var Redis=require(_0x8543('0x2'));var config=require(_0x8543('0x3'));config[_0x8543('0x4')]=_[_0x8543('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8543('0x6'))(new Redis(config[_0x8543('0x4')]));function WhatsappQueue(_0x10544e){this['id']=_0x10544e['id']||0x0;this[_0x8543('0x7')]=_0x10544e[_0x8543('0x7')]||'';this['timeout']=_0x10544e[_0x8543('0x8')]||0xa;this[_0x8543('0x9')]=_0x10544e[_0x8543('0x9')]||'beepall';this[_0x8543('0xa')]=_0x10544e[_0x8543('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8543('0x0')]='';this[_0x8543('0xb')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x8543('0xb')]=function(){var _0x3c1abf=this[_0x8543('0xc')][_0x8543('0xd')];this[_0x8543('0xc')]=_[_0x8543('0xe')](this[_0x8543('0xa')],'id');this[_0x8543('0xc')]['_rr']=_0x3c1abf;};WhatsappQueue[_0x8543('0xf')][_0x8543('0x10')]=function(){this[_0x8543('0x11')]=0x0;this['paused']=0x0;for(var _0x1ae8c5=0x0;_0x1ae8c5=0x0?this[_0x8543('0x15')]:0x0;var _0x375cc4={'id':this['id'],'available':this[_0x8543('0x15')],'loggedIn':this[_0x8543('0x11')],'name':this[_0x8543('0x7')],'paused':this[_0x8543('0x14')],'waiting':this[_0x8543('0x16')]};var _0x9a4af6=md5(JSON[_0x8543('0x17')](_0x375cc4));if(this[_0x8543('0x0')]!==_0x9a4af6){this[_0x8543('0x0')]=_0x9a4af6;io['to'](util['format'](_0x8543('0x18'),_0x375cc4[_0x8543('0x7')]))[_0x8543('0x19')](_0x8543('0x1a'),_0x375cc4);}};module[_0x8543('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xe5bd=['mapAgentsId','updateRouting','updateRealtime','prototype','map','loggedIn','length','whatsappPause','available','paused','waiting','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe5bd,0x148));var _0xde5b=function(_0x4f2dd6,_0x4d3d03){_0x4f2dd6=_0x4f2dd6-0x0;var _0x236e70=_0xe5bd[_0x4f2dd6];return _0x236e70;};'use strict';var _=require(_0xde5b('0x0'));var md5=require(_0xde5b('0x1'));var util=require('util');var Redis=require(_0xde5b('0x2'));var config=require('../../../config/environment');config[_0xde5b('0x3')]=_[_0xde5b('0x4')](config[_0xde5b('0x3')],{'host':_0xde5b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde5b('0x3')]));function WhatsappQueue(_0xfa3d0b){this['id']=_0xfa3d0b['id']||0x0;this[_0xde5b('0x6')]=_0xfa3d0b['name']||'';this[_0xde5b('0x7')]=_0xfa3d0b[_0xde5b('0x7')]||0xa;this[_0xde5b('0x8')]=_0xfa3d0b[_0xde5b('0x8')]||'beepall';this[_0xde5b('0x9')]=_0xfa3d0b['Agents'];this[_0xde5b('0xa')]={};this['waiting']=0x0;this[_0xde5b('0x1')]='';this[_0xde5b('0xb')]();this[_0xde5b('0xc')]();}WhatsappQueue[_0xde5b('0xd')]['updateRouting']=function(){var _0x501577=this[_0xde5b('0xa')]['_rr'];this[_0xde5b('0xa')]=_[_0xde5b('0xe')](this['Agents'],'id');this[_0xde5b('0xa')]['_rr']=_0x501577;};WhatsappQueue[_0xde5b('0xd')][_0xde5b('0xc')]=function(){this[_0xde5b('0xf')]=0x0;this['paused']=0x0;for(var _0x51b5e2=0x0;_0x51b5e2=0x0?this[_0xde5b('0x12')]:0x0;var _0x592999={'id':this['id'],'available':this[_0xde5b('0x12')],'loggedIn':this[_0xde5b('0xf')],'name':this[_0xde5b('0x6')],'paused':this['paused'],'waiting':this[_0xde5b('0x14')]};var _0xdf55dd=md5(JSON[_0xde5b('0x15')](_0x592999));if(this[_0xde5b('0x1')]!==_0xdf55dd){this[_0xde5b('0x1')]=_0xdf55dd;io['to'](util[_0xde5b('0x16')]('whatsapp:queue:%s',_0x592999['name']))[_0xde5b('0x17')](_0xde5b('0x18'),_0x592999);}};module[_0xde5b('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 671ed34..bf0fd82 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(_0x1ce3b2,_0x3bd4b7){var _0x25245c=function(_0x47c0b1){while(--_0x47c0b1){_0x1ce3b2['push'](_0x1ce3b2['shift']());}};_0x25245c(++_0x3bd4b7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb10b[_0x5d2803];return _0xdcad2c;};'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 _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(_0x1f7dea,_0x2cccc6){var _0x6f0f48=function(_0x2cf5fa){while(--_0x2cf5fa){_0x1f7dea['push'](_0x1f7dea['shift']());}};_0x6f0f48(++_0x2cccc6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c1309,_0x66e161){_0x3c1309=_0x3c1309-0x0;var _0x4b71bf=_0xb10b[_0x3c1309];return _0x4b71bf;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b0c44f1..3e261e3 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 _0x5046=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x5046,0x1a8));var _0x6504=function(_0x22f759,_0x9a5480){_0x22f759=_0x22f759-0x0;var _0x3ff41b=_0x5046[_0x22f759];return _0x3ff41b;};'use strict';var client=require('../client');exports[_0x6504('0x0')]=function(_0x275fdf,_0x14e80a){return client['Request'](_0x6504('0x1'),{'body':_0x14e80a,'options':{'where':{'id':_0x275fdf}},'log':_0x6504('0x2')});};exports[_0x6504('0x3')]=function(_0x42ce19,_0x3d701d){return client[_0x6504('0x4')](_0x6504('0x5'),{'body':_0x3d701d,'options':{'where':{'id':_0x42ce19}},'log':_0x6504('0x6')});}; \ No newline at end of file +var _0x23f9=['../client','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x933f66,_0x4e1744){var _0x1d032d=function(_0x540aa0){while(--_0x540aa0){_0x933f66['push'](_0x933f66['shift']());}};_0x1d032d(++_0x4e1744);}(_0x23f9,0xea));var _0x923f=function(_0x520d8c,_0x54ba7e){_0x520d8c=_0x520d8c-0x0;var _0x56932e=_0x23f9[_0x520d8c];return _0x56932e;};'use strict';var client=require(_0x923f('0x0'));exports['update']=function(_0x2cbeb1,_0x3718b7){return client[_0x923f('0x1')](_0x923f('0x2'),{'body':_0x3718b7,'options':{'where':{'id':_0x2cbeb1}},'log':_0x923f('0x3')});};exports['addTags']=function(_0x26b708,_0x12dfb4){return client['Request'](_0x923f('0x4'),{'body':_0x12dfb4,'options':{'where':{'id':_0x26b708}},'log':_0x923f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3624760..232104c 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 _0x666f=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x7a7072,_0x127e1f){var _0x16df93=function(_0x3467a9){while(--_0x3467a9){_0x7a7072['push'](_0x7a7072['shift']());}};_0x16df93(++_0x127e1f);}(_0x666f,0x19f));var _0xf666=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x666f[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xf666('0x0'));exports[_0xf666('0x1')]=function(_0x599d7c){return client['Request'](_0xf666('0x2'),{'body':_0x599d7c,'log':_0xf666('0x3')});}; \ No newline at end of file +var _0xc2e9=['../client','create','Request','createChatMessage'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc2e9,0xe4));var _0x9c2e=function(_0x385aaa,_0x115e85){_0x385aaa=_0x385aaa-0x0;var _0x387206=_0xc2e9[_0x385aaa];return _0x387206;};'use strict';var client=require(_0x9c2e('0x0'));exports[_0x9c2e('0x1')]=function(_0x1840a8){return client[_0x9c2e('0x2')]('CreateChatMessage',{'body':_0x1840a8,'log':_0x9c2e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6a48fb5..b4dca58 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 _0xfd20=['getChatQueues','name','timeout','User','online','chatPause'];(function(_0x466a3d,_0x35f671){var _0x1d1d39=function(_0x29791f){while(--_0x29791f){_0x466a3d['push'](_0x466a3d['shift']());}};_0x1d1d39(++_0x35f671);}(_0xfd20,0x66));var _0x0fd2=function(_0x3d7f78,_0x17e4d0){_0x3d7f78=_0x3d7f78-0x0;var _0x3bf252=_0xfd20[_0x3d7f78];return _0x3bf252;};'use strict';var client=require('../client');exports[_0x0fd2('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x0fd2('0x1'),_0x0fd2('0x2'),'strategy'],'include':[{'model':_0x0fd2('0x3'),'as':'Agents','attributes':['id',_0x0fd2('0x1'),_0x0fd2('0x4'),_0x0fd2('0x5')]}]},'log':_0x0fd2('0x0')});};}; \ No newline at end of file +var _0x6183=['chatPause','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online'];(function(_0x7b9a8d,_0x308a64){var _0x28ca9e=function(_0x2b9be5){while(--_0x2b9be5){_0x7b9a8d['push'](_0x7b9a8d['shift']());}};_0x28ca9e(++_0x308a64);}(_0x6183,0x19b));var _0x3618=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x6183[_0x5a95fa];return _0x1a61b8;};'use strict';var client=require('../client');exports[_0x3618('0x0')]=function(){return function(){return client[_0x3618('0x1')](_0x3618('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3618('0x3'),_0x3618('0x4')],'include':[{'model':_0x3618('0x5'),'as':_0x3618('0x6'),'attributes':['id',_0x3618('0x7'),_0x3618('0x8'),_0x3618('0x9')]}]},'log':_0x3618('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1bc3de5..9e45b9e 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 _0xe80c=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x315c69,_0x360597){var _0x1513ad=function(_0x219e5a){while(--_0x219e5a){_0x315c69['push'](_0x315c69['shift']());}};_0x1513ad(++_0x360597);}(_0xe80c,0x1c2));var _0xce80=function(_0x199dc5,_0x3223ab){_0x199dc5=_0x199dc5-0x0;var _0x16ceb3=_0xe80c[_0x199dc5];return _0x16ceb3;};'use strict';var client=require('../client');exports[_0xce80('0x0')]=function(_0x3ba4d9){return client[_0xce80('0x1')](_0xce80('0x2'),{'body':_0x3ba4d9,'log':_0xce80('0x2')});};exports['update']=function(_0x40be3f,_0xd0d912){return client[_0xce80('0x1')](_0xce80('0x3'),{'body':_0xd0d912,'options':{'where':{'uniqueid':_0x40be3f},'order':[['id','DESC']],'limit':0x1},'log':_0xce80('0x3')});}; \ No newline at end of file +var _0x8eeb=['update','DESC','../client','Request','CreateChatQueueReport'];(function(_0x2b78c5,_0x50ac65){var _0x1c2b54=function(_0x21f0aa){while(--_0x21f0aa){_0x2b78c5['push'](_0x2b78c5['shift']());}};_0x1c2b54(++_0x50ac65);}(_0x8eeb,0x183));var _0xb8ee=function(_0x33c37b,_0x20f6d9){_0x33c37b=_0x33c37b-0x0;var _0x44925e=_0x8eeb[_0x33c37b];return _0x44925e;};'use strict';var client=require(_0xb8ee('0x0'));exports['create']=function(_0x464dec){return client[_0xb8ee('0x1')]('CreateChatQueueReport',{'body':_0x464dec,'log':_0xb8ee('0x2')});};exports[_0xb8ee('0x3')]=function(_0x42df81,_0x3039dd){return client[_0xb8ee('0x1')]('UpdateChatQueueReport',{'body':_0x3039dd,'options':{'where':{'uniqueid':_0x42df81},'order':[['id',_0xb8ee('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c1eed20..d21ade2 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(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x94abd3,_0x167549){_0x94abd3=_0x94abd3-0x0;var _0x469923=_0x7a54[_0x94abd3];return _0x469923;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x7a54,0x106));var _0x47a5=function(_0x434f89,_0x5ea476){_0x434f89=_0x434f89-0x0;var _0x48c3ba=_0x7a54[_0x434f89];return _0x48c3ba;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 5a82f4a..b2e3e29 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 _0x836d=['CreateFaxMessage','../client','Request'];(function(_0x550888,_0x321175){var _0x19bbbe=function(_0x5ef397){while(--_0x5ef397){_0x550888['push'](_0x550888['shift']());}};_0x19bbbe(++_0x321175);}(_0x836d,0x1de));var _0xd836=function(_0x2b8e07,_0x5638bc){_0x2b8e07=_0x2b8e07-0x0;var _0x2afb4c=_0x836d[_0x2b8e07];return _0x2afb4c;};'use strict';var client=require(_0xd836('0x0'));exports['create']=function(_0x332af0){return client[_0xd836('0x1')](_0xd836('0x2'),{'body':_0x332af0,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x68a8=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x18010f,_0xb74e6d){var _0x1017a4=function(_0x41072a){while(--_0x41072a){_0x18010f['push'](_0x18010f['shift']());}};_0x1017a4(++_0xb74e6d);}(_0x68a8,0x1bd));var _0x868a=function(_0x458ab0,_0x458fb6){_0x458ab0=_0x458ab0-0x0;var _0x392738=_0x68a8[_0x458ab0];return _0x392738;};'use strict';var client=require('../client');exports[_0x868a('0x0')]=function(_0x1b7a52){return client[_0x868a('0x1')](_0x868a('0x2'),{'body':_0x1b7a52,'log':_0x868a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d4d7109..6e01b8f 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 _0xbb44=['online','faxPause','getFaxQueues','../client','GetFaxQueue','timeout','User','name'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xbb44,0x18b));var _0x4bb4=function(_0x150825,_0x8faa4a){_0x150825=_0x150825-0x0;var _0x1af298=_0xbb44[_0x150825];return _0x1af298;};'use strict';var client=require(_0x4bb4('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x4bb4('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x4bb4('0x2'),'strategy'],'include':[{'model':_0x4bb4('0x3'),'as':'Agents','attributes':['id',_0x4bb4('0x4'),_0x4bb4('0x5'),_0x4bb4('0x6')]}]},'log':_0x4bb4('0x7')});};}; \ No newline at end of file +var _0xd075=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0xdd85ec,_0x1cb41f){var _0x19d0c8=function(_0x238d6b){while(--_0x238d6b){_0xdd85ec['push'](_0xdd85ec['shift']());}};_0x19d0c8(++_0x1cb41f);}(_0xd075,0x1c2));var _0x5d07=function(_0x22431d,_0x2986d4){_0x22431d=_0x22431d-0x0;var _0x5ebe4e=_0xd075[_0x22431d];return _0x5ebe4e;};'use strict';var client=require('../client');exports[_0x5d07('0x0')]=function(){return function(){return client[_0x5d07('0x1')](_0x5d07('0x2'),{'options':{'raw':![],'attributes':['id',_0x5d07('0x3'),_0x5d07('0x4'),_0x5d07('0x5')],'include':[{'model':_0x5d07('0x6'),'as':_0x5d07('0x7'),'attributes':['id',_0x5d07('0x3'),_0x5d07('0x8'),_0x5d07('0x9')]}]},'log':_0x5d07('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 49866a4..b8c7287 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 _0xf231=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x582dc0,_0x5a359a){var _0x14a981=function(_0x3cbe6e){while(--_0x3cbe6e){_0x582dc0['push'](_0x582dc0['shift']());}};_0x14a981(++_0x5a359a);}(_0xf231,0x13d));var _0x1f23=function(_0x1ee0bc,_0x202166){_0x1ee0bc=_0x1ee0bc-0x0;var _0x2570c6=_0xf231[_0x1ee0bc];return _0x2570c6;};'use strict';var client=require(_0x1f23('0x0'));exports[_0x1f23('0x1')]=function(_0x29e9a8){return client[_0x1f23('0x2')]('CreateFaxQueueReport',{'body':_0x29e9a8,'log':_0x1f23('0x3')});};exports[_0x1f23('0x4')]=function(_0x4d94b6,_0x24f0b8){return client[_0x1f23('0x2')]('UpdateFaxQueueReport',{'body':_0x24f0b8,'options':{'where':{'uniqueid':_0x4d94b6},'order':[['id',_0x1f23('0x5')]],'limit':0x1},'log':_0x1f23('0x6')});}; \ No newline at end of file +var _0x2877=['Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','create'];(function(_0x158c73,_0x5a4335){var _0x18cdcc=function(_0x40ed86){while(--_0x40ed86){_0x158c73['push'](_0x158c73['shift']());}};_0x18cdcc(++_0x5a4335);}(_0x2877,0x1d3));var _0x7287=function(_0x545a14,_0x53afc9){_0x545a14=_0x545a14-0x0;var _0x23a136=_0x2877[_0x545a14];return _0x23a136;};'use strict';var client=require('../client');exports[_0x7287('0x0')]=function(_0x16c693){return client[_0x7287('0x1')](_0x7287('0x2'),{'body':_0x16c693,'log':_0x7287('0x2')});};exports[_0x7287('0x3')]=function(_0x3da926,_0x129455){return client[_0x7287('0x1')]('UpdateFaxQueueReport',{'body':_0x129455,'options':{'where':{'uniqueid':_0x3da926},'order':[['id',_0x7287('0x4')]],'limit':0x1},'log':_0x7287('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c7900b1..3148311 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 _0x955d=['Intervals','interval','../client','getIntervals','name'];(function(_0x1066bc,_0x4fb11e){var _0x592de5=function(_0x5840ca){while(--_0x5840ca){_0x1066bc['push'](_0x1066bc['shift']());}};_0x592de5(++_0x4fb11e);}(_0x955d,0x66));var _0xd955=function(_0xfded00,_0x49e297){_0xfded00=_0xfded00-0x0;var _0x1c83a6=_0x955d[_0xfded00];return _0x1c83a6;};'use strict';var client=require(_0xd955('0x0'));exports[_0xd955('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd955('0x2')],'include':[{'model':'Interval','as':_0xd955('0x3'),'attributes':['id',_0xd955('0x2'),_0xd955('0x4')]}]},'log':_0xd955('0x1')});};}; \ No newline at end of file +var _0x590d=['GetInterval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0x590d,0x13f));var _0xd590=function(_0x38c773,_0x199a45){_0x38c773=_0x38c773-0x0;var _0x196e46=_0x590d[_0x38c773];return _0x196e46;};'use strict';var client=require(_0xd590('0x0'));exports[_0xd590('0x1')]=function(){return function(){return client[_0xd590('0x2')](_0xd590('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xd590('0x4'),'attributes':['id',_0xd590('0x5'),_0xd590('0x6')]}]},'log':_0xd590('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8f26e5d..c147650 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 _0x6a95=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6a95,0x1db));var _0x56a9=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x6a95[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x56a9('0x0'));exports[_0x56a9('0x1')]=function(_0x15574a,_0xce37aa){return client[_0x56a9('0x2')](_0x56a9('0x3'),{'body':_0xce37aa,'options':{'where':{'id':_0x15574a}},'log':_0x56a9('0x4')});};exports['addTags']=function(_0x512f52,_0x12cd60){return client[_0x56a9('0x2')](_0x56a9('0x5'),{'body':_0x12cd60,'options':{'where':{'id':_0x512f52}},'log':_0x56a9('0x6')});}; \ No newline at end of file +var _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x1b64c1,_0x2dfab9){var _0x2b93e6=function(_0x27911c){while(--_0x27911c){_0x1b64c1['push'](_0x1b64c1['shift']());}};_0x2b93e6(++_0x2dfab9);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x1b029f,_0x43015f){_0x1b029f=_0x1b029f-0x0;var _0x4f4519=_0xcf2f[_0x1b029f];return _0x4f4519;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 884a2e5..d5c3cdc 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 _0xe1b0=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x10649b,_0xb97f60){var _0x2b35a5=function(_0x1490df){while(--_0x1490df){_0x10649b['push'](_0x10649b['shift']());}};_0x2b35a5(++_0xb97f60);}(_0xe1b0,0x1b2));var _0x0e1b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe1b0[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x0e1b('0x0'));exports[_0x0e1b('0x1')]=function(_0x4f3b58){return client[_0x0e1b('0x2')](_0x0e1b('0x3'),{'body':_0x4f3b58,'log':_0x0e1b('0x4')});}; \ No newline at end of file +var _0x3c93=['Request','CreateMailMessage','../client','create'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3c93,0x10e));var _0x33c9=function(_0x5c2d50,_0x45eb2e){_0x5c2d50=_0x5c2d50-0x0;var _0x42c298=_0x3c93[_0x5c2d50];return _0x42c298;};'use strict';var client=require(_0x33c9('0x0'));exports[_0x33c9('0x1')]=function(_0x1794f2){return client[_0x33c9('0x2')](_0x33c9('0x3'),{'body':_0x1794f2,'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 c730a64..194c718 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 _0xc86e=['mailPause','../client','getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x126af7,_0x25fa06){var _0x25b500=function(_0x10ffe7){while(--_0x10ffe7){_0x126af7['push'](_0x126af7['shift']());}};_0x25b500(++_0x25fa06);}(_0xc86e,0xd0));var _0xec86=function(_0x182b51,_0x455b54){_0x182b51=_0x182b51-0x0;var _0x102ee6=_0xc86e[_0x182b51];return _0x102ee6;};'use strict';var client=require(_0xec86('0x0'));exports[_0xec86('0x1')]=function(){return function(){return client['Request'](_0xec86('0x2'),{'options':{'raw':![],'attributes':['id',_0xec86('0x3'),_0xec86('0x4'),_0xec86('0x5')],'include':[{'model':_0xec86('0x6'),'as':_0xec86('0x7'),'attributes':['id',_0xec86('0x3'),'online',_0xec86('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x920e=['Request','GetMailQueue','name','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x17bb25,_0x5bc624){var _0x30f276=function(_0xf794d8){while(--_0xf794d8){_0x17bb25['push'](_0x17bb25['shift']());}};_0x30f276(++_0x5bc624);}(_0x920e,0x120));var _0xe920=function(_0x4c166e,_0x134272){_0x4c166e=_0x4c166e-0x0;var _0x3bf150=_0x920e[_0x4c166e];return _0x3bf150;};'use strict';var client=require(_0xe920('0x0'));exports[_0xe920('0x1')]=function(){return function(){return client[_0xe920('0x2')](_0xe920('0x3'),{'options':{'raw':![],'attributes':['id',_0xe920('0x4'),'timeout',_0xe920('0x5')],'include':[{'model':_0xe920('0x6'),'as':_0xe920('0x7'),'attributes':['id',_0xe920('0x4'),_0xe920('0x8'),_0xe920('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7814f4b..c742cd4 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 _0xd879=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x321d29,_0x5bc076){var _0x169c5f=function(_0xd9a38b){while(--_0xd9a38b){_0x321d29['push'](_0x321d29['shift']());}};_0x169c5f(++_0x5bc076);}(_0xd879,0xb9));var _0x9d87=function(_0x3dd92d,_0x83ec3b){_0x3dd92d=_0x3dd92d-0x0;var _0x439704=_0xd879[_0x3dd92d];return _0x439704;};'use strict';var client=require(_0x9d87('0x0'));exports[_0x9d87('0x1')]=function(_0x2698db){return client[_0x9d87('0x2')](_0x9d87('0x3'),{'body':_0x2698db,'log':_0x9d87('0x3')});};exports[_0x9d87('0x4')]=function(_0x5f14f0,_0x38e7ee){return client[_0x9d87('0x2')](_0x9d87('0x5'),{'body':_0x38e7ee,'options':{'where':{'uniqueid':_0x5f14f0},'order':[['id','DESC']],'limit':0x1},'log':_0x9d87('0x5')});}; \ No newline at end of file +var _0xe75f=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x80bea0,_0x4c30f4){var _0x50fb90=function(_0x1484ce){while(--_0x1484ce){_0x80bea0['push'](_0x80bea0['shift']());}};_0x50fb90(++_0x4c30f4);}(_0xe75f,0x101));var _0xfe75=function(_0xaa6960,_0x5e2e12){_0xaa6960=_0xaa6960-0x0;var _0x1f93a2=_0xe75f[_0xaa6960];return _0x1f93a2;};'use strict';var client=require(_0xfe75('0x0'));exports['create']=function(_0x4887e8){return client[_0xfe75('0x1')](_0xfe75('0x2'),{'body':_0x4887e8,'log':_0xfe75('0x2')});};exports[_0xfe75('0x3')]=function(_0x430b58,_0x3831e0){return client['Request'](_0xfe75('0x4'),{'body':_0x3831e0,'options':{'where':{'uniqueid':_0x430b58},'order':[['id',_0xfe75('0x5')]],'limit':0x1},'log':_0xfe75('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e608ffb..9e941a5 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 _0x8d0f=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0x8d0f,0x191));var _0xf8d0=function(_0x636388,_0x7067f5){_0x636388=_0x636388-0x0;var _0x4043ee=_0x8d0f[_0x636388];return _0x4043ee;};'use strict';var client=require(_0xf8d0('0x0'));exports[_0xf8d0('0x1')]=function(_0x462a59,_0x2371dc){return client[_0xf8d0('0x2')](_0xf8d0('0x3'),{'body':_0x2371dc,'options':{'where':{'id':_0x462a59}},'log':_0xf8d0('0x4')});};exports[_0xf8d0('0x5')]=function(_0x3f2533,_0x1e70ef){return client[_0xf8d0('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x1e70ef,'options':{'where':{'id':_0x3f2533}},'log':_0xf8d0('0x6')});}; \ No newline at end of file +var _0x790d=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x516524,_0x1e58bc){var _0x12d773=function(_0x5ca118){while(--_0x5ca118){_0x516524['push'](_0x516524['shift']());}};_0x12d773(++_0x1e58bc);}(_0x790d,0xe3));var _0xd790=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x790d[_0x1dd82f];return _0x353ca4;};'use strict';var client=require(_0xd790('0x0'));exports[_0xd790('0x1')]=function(_0x49a2c9,_0x1d1c57){return client[_0xd790('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1d1c57,'options':{'where':{'id':_0x49a2c9}},'log':_0xd790('0x3')});};exports[_0xd790('0x4')]=function(_0x5c8407,_0x41afed){return client[_0xd790('0x2')](_0xd790('0x5'),{'body':_0x41afed,'options':{'where':{'id':_0x5c8407}},'log':_0xd790('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7a6d30c..93f2f95 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 _0x35eb=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x35eb,0x139));var _0xb35e=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0x35eb[_0x11f226];return _0x30be77;};'use strict';var client=require(_0xb35e('0x0'));exports[_0xb35e('0x1')]=function(_0x3a7bd9){return client['Request'](_0xb35e('0x2'),{'body':_0x3a7bd9,'log':_0xb35e('0x3')});}; \ No newline at end of file +var _0xe639=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x403dc4,_0x3313f2){var _0x106f04=function(_0x212ac4){while(--_0x212ac4){_0x403dc4['push'](_0x403dc4['shift']());}};_0x106f04(++_0x3313f2);}(_0xe639,0x1e7));var _0x9e63=function(_0x4d4f65,_0x3ee7e0){_0x4d4f65=_0x4d4f65-0x0;var _0x3634a1=_0xe639[_0x4d4f65];return _0x3634a1;};'use strict';var client=require(_0x9e63('0x0'));exports[_0x9e63('0x1')]=function(_0x3842f7){return client[_0x9e63('0x2')](_0x9e63('0x3'),{'body':_0x3842f7,'log':_0x9e63('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 492eadd..b294626 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 _0xb001=['User','name','online','../client','Request','GetOpenchannelQueue','strategy'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xb001,0x7a));var _0x1b00=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb001[_0x4d613c];return _0x301fe3;};'use strict';var client=require(_0x1b00('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x1b00('0x1')](_0x1b00('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x1b00('0x3')],'include':[{'model':_0x1b00('0x4'),'as':'Agents','attributes':['id',_0x1b00('0x5'),_0x1b00('0x6'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xaebf=['GetOpenchannelQueue','name','timeout','strategy','User','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x24dc66,_0x861542){var _0x3041f0=function(_0xc1ca){while(--_0xc1ca){_0x24dc66['push'](_0x24dc66['shift']());}};_0x3041f0(++_0x861542);}(_0xaebf,0x1bf));var _0xfaeb=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xaebf[_0x2080a3];return _0x8d7d17;};'use strict';var client=require(_0xfaeb('0x0'));exports[_0xfaeb('0x1')]=function(){return function(){return client[_0xfaeb('0x2')](_0xfaeb('0x3'),{'options':{'raw':![],'attributes':['id',_0xfaeb('0x4'),_0xfaeb('0x5'),_0xfaeb('0x6')],'include':[{'model':_0xfaeb('0x7'),'as':'Agents','attributes':['id',_0xfaeb('0x4'),'online',_0xfaeb('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5a30834..f1ef15e 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 _0x3948=['update','Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport'];(function(_0x5f47ae,_0x598e64){var _0x5d57fa=function(_0x3ca851){while(--_0x3ca851){_0x5f47ae['push'](_0x5f47ae['shift']());}};_0x5d57fa(++_0x598e64);}(_0x3948,0x196));var _0x8394=function(_0xe46029,_0x216cf3){_0xe46029=_0xe46029-0x0;var _0x4448d1=_0x3948[_0xe46029];return _0x4448d1;};'use strict';var client=require(_0x8394('0x0'));exports['create']=function(_0x39f6f9){return client['Request'](_0x8394('0x1'),{'body':_0x39f6f9,'log':'CreateOpenchannelQueueReport'});};exports[_0x8394('0x2')]=function(_0x9fd35b,_0x9e42ef){return client[_0x8394('0x3')](_0x8394('0x4'),{'body':_0x9e42ef,'options':{'where':{'uniqueid':_0x9fd35b},'order':[['id',_0x8394('0x5')]],'limit':0x1},'log':_0x8394('0x4')});}; \ No newline at end of file +var _0x5525=['create','Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x5525,0xd1));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x5552('0x0'));exports[_0x5552('0x1')]=function(_0x3492bb){return client[_0x5552('0x2')](_0x5552('0x3'),{'body':_0x3492bb,'log':_0x5552('0x3')});};exports[_0x5552('0x4')]=function(_0x47c27e,_0x285566){return client[_0x5552('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x285566,'options':{'where':{'uniqueid':_0x47c27e},'order':[['id',_0x5552('0x5')]],'limit':0x1},'log':_0x5552('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 553b8bb..f931f10 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 _0x78b7=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x78b7,0x194));var _0x778b=function(_0x366e9e,_0x3c61c0){_0x366e9e=_0x366e9e-0x0;var _0x44088b=_0x78b7[_0x366e9e];return _0x44088b;};'use strict';var client=require(_0x778b('0x0'));exports[_0x778b('0x1')]=function(_0x5d5912,_0x377816){return client[_0x778b('0x2')](_0x778b('0x3'),{'body':_0x377816,'options':{'where':{'id':_0x5d5912}},'log':_0x778b('0x4')});};exports[_0x778b('0x5')]=function(_0x4d298d,_0x4c91f3){return client[_0x778b('0x2')](_0x778b('0x6'),{'body':_0x4c91f3,'options':{'where':{'id':_0x4d298d}},'log':_0x778b('0x7')});}; \ No newline at end of file +var _0x207d=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x30aa6d,_0x3bbe0e){var _0x4735e9=function(_0x30a4e4){while(--_0x30a4e4){_0x30aa6d['push'](_0x30aa6d['shift']());}};_0x4735e9(++_0x3bbe0e);}(_0x207d,0x10d));var _0xd207=function(_0x4a9b1f,_0x303d9e){_0x4a9b1f=_0x4a9b1f-0x0;var _0x2938f1=_0x207d[_0x4a9b1f];return _0x2938f1;};'use strict';var client=require(_0xd207('0x0'));exports[_0xd207('0x1')]=function(_0x302062,_0x27a1dc){return client['Request'](_0xd207('0x2'),{'body':_0x27a1dc,'options':{'where':{'id':_0x302062}},'log':'updateSmsInteraction'});};exports[_0xd207('0x3')]=function(_0x422501,_0x5351ed){return client[_0xd207('0x4')](_0xd207('0x5'),{'body':_0x5351ed,'options':{'where':{'id':_0x422501}},'log':_0xd207('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1c3a068..100ed83 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 _0xfc82=['../client','create','CreateSmsMessage'];(function(_0x110d59,_0x50c4fb){var _0x2fce64=function(_0xc1dcd8){while(--_0xc1dcd8){_0x110d59['push'](_0x110d59['shift']());}};_0x2fce64(++_0x50c4fb);}(_0xfc82,0xba));var _0x2fc8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfc82[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x2fc8('0x0'));exports[_0x2fc8('0x1')]=function(_0x23ec1b){return client['Request'](_0x2fc8('0x2'),{'body':_0x23ec1b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xbb4a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x25f280,_0x78272f){var _0x291cc9=function(_0x2acb8f){while(--_0x2acb8f){_0x25f280['push'](_0x25f280['shift']());}};_0x291cc9(++_0x78272f);}(_0xbb4a,0xd9));var _0xabb4=function(_0x54fb5e,_0x33b6a3){_0x54fb5e=_0x54fb5e-0x0;var _0x31e52c=_0xbb4a[_0x54fb5e];return _0x31e52c;};'use strict';var client=require(_0xabb4('0x0'));exports[_0xabb4('0x1')]=function(_0x6dde86){return client[_0xabb4('0x2')](_0xabb4('0x3'),{'body':_0x6dde86,'log':_0xabb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3b83dfa..c1da423 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2b08a9,_0x175ab4){var _0x31a6dd=function(_0x225aac){while(--_0x225aac){_0x2b08a9['push'](_0x2b08a9['shift']());}};_0x31a6dd(++_0x175ab4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x407f1f,_0x22bb99){var _0x18d62e=function(_0x316d60){while(--_0x316d60){_0x407f1f['push'](_0x407f1f['shift']());}};_0x18d62e(++_0x22bb99);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 048aeef..3aa36ac 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x9f9241,_0x4e7fe2){var _0x1dc46a=function(_0x39fc4e){while(--_0x39fc4e){_0x9f9241['push'](_0x9f9241['shift']());}};_0x1dc46a(++_0x4e7fe2);}(_0x70e0,0x17b));var _0x070e=function(_0x27e56f,_0x4e6fb3){_0x27e56f=_0x27e56f-0x0;var _0x5f049b=_0x70e0[_0x27e56f];return _0x5f049b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x290da0,_0x2149ca){var _0x5eec1c=function(_0x30f8c2){while(--_0x30f8c2){_0x290da0['push'](_0x290da0['shift']());}};_0x5eec1c(++_0x2149ca);}(_0x55ca,0x126));var _0xa55c=function(_0x38c7d8,_0x253557){_0x38c7d8=_0x38c7d8-0x0;var _0x266426=_0x55ca[_0x38c7d8];return _0x266426;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 3a82c07..88974e7 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(_0x5f051a,_0x3c74fc){var _0xb5fe94=function(_0x698040){while(--_0x698040){_0x5f051a['push'](_0x5f051a['shift']());}};_0xb5fe94(++_0x3c74fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x3fb637,_0x5998ff){var _0x3334a1=function(_0x170550){while(--_0x170550){_0x3fb637['push'](_0x3fb637['shift']());}};_0x3334a1(++_0x5998ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 352d538..cddf680 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 _0x0ec6=['../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x9f54a1,_0x398ca6){var _0x3c54fa=function(_0x323c74){while(--_0x323c74){_0x9f54a1['push'](_0x9f54a1['shift']());}};_0x3c54fa(++_0x398ca6);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x4c865c,_0x6a8fb9){_0x4c865c=_0x4c865c-0x0;var _0x21073f=_0x0ec6[_0x4c865c];return _0x21073f;};'use strict';var client=require(_0x60ec('0x0'));exports['update']=function(_0x50217e,_0x1bf878){return client[_0x60ec('0x1')](_0x60ec('0x2'),{'body':_0x1bf878,'options':{'where':{'id':_0x50217e}},'log':_0x60ec('0x3')});};exports[_0x60ec('0x4')]=function(_0x262ed6,_0x392a91){return client['Request'](_0x60ec('0x5'),{'body':_0x392a91,'options':{'where':{'id':_0x262ed6}},'log':_0x60ec('0x6')});}; \ No newline at end of file +var _0xe3da=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x3dd10c,_0x147522){var _0x5a3223=function(_0x7d3c36){while(--_0x7d3c36){_0x3dd10c['push'](_0x3dd10c['shift']());}};_0x5a3223(++_0x147522);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'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 5712658..11fc3a3 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 _0xe532=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x32ebd6,_0x407ff4){var _0x73ca55=function(_0x620091){while(--_0x620091){_0x32ebd6['push'](_0x32ebd6['shift']());}};_0x73ca55(++_0x407ff4);}(_0xe532,0x9a));var _0x2e53=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xe532[_0x59bcb1];return _0x4a737f;};'use strict';var client=require('../client');exports[_0x2e53('0x0')]=function(_0xd1436c){return client[_0x2e53('0x1')](_0x2e53('0x2'),{'body':_0xd1436c,'log':_0x2e53('0x3')});}; \ No newline at end of file +var _0x3488=['../client','Request','createWhatsappMessage'];(function(_0x42e1e2,_0x3aaef7){var _0x124fb5=function(_0x4bc588){while(--_0x4bc588){_0x42e1e2['push'](_0x42e1e2['shift']());}};_0x124fb5(++_0x3aaef7);}(_0x3488,0x108));var _0x8348=function(_0x39975c,_0x1d94e8){_0x39975c=_0x39975c-0x0;var _0x4de50b=_0x3488[_0x39975c];return _0x4de50b;};'use strict';var client=require(_0x8348('0x0'));exports['create']=function(_0x3fe0e0){return client[_0x8348('0x1')]('CreateWhatsappMessage',{'body':_0x3fe0e0,'log':_0x8348('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2b42d9f..3b9f530 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 _0xbdc3=['online','../client','getWhatsappQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x4e2dab,_0x55bcc4){var _0x28e7d6=function(_0x31cc26){while(--_0x31cc26){_0x4e2dab['push'](_0x4e2dab['shift']());}};_0x28e7d6(++_0x55bcc4);}(_0xbdc3,0xb5));var _0x3bdc=function(_0x329eb3,_0x8e2ffd){_0x329eb3=_0x329eb3-0x0;var _0x3ad946=_0xbdc3[_0x329eb3];return _0x3ad946;};'use strict';var client=require(_0x3bdc('0x0'));exports[_0x3bdc('0x1')]=function(){return function(){return client[_0x3bdc('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3bdc('0x3'),_0x3bdc('0x4'),_0x3bdc('0x5')],'include':[{'model':_0x3bdc('0x6'),'as':_0x3bdc('0x7'),'attributes':['id',_0x3bdc('0x3'),_0x3bdc('0x8'),'whatsappPause']}]},'log':_0x3bdc('0x1')});};}; \ No newline at end of file +var _0xfd52=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause'];(function(_0x31a725,_0x4d61cd){var _0x20f655=function(_0x30d8d6){while(--_0x30d8d6){_0x31a725['push'](_0x31a725['shift']());}};_0x20f655(++_0x4d61cd);}(_0xfd52,0x64));var _0x2fd5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xfd52[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0x2fd5('0x0'));exports[_0x2fd5('0x1')]=function(){return function(){return client[_0x2fd5('0x2')](_0x2fd5('0x3'),{'options':{'raw':![],'attributes':['id',_0x2fd5('0x4'),_0x2fd5('0x5'),_0x2fd5('0x6')],'include':[{'model':'User','as':_0x2fd5('0x7'),'attributes':['id',_0x2fd5('0x4'),_0x2fd5('0x8'),_0x2fd5('0x9')]}]},'log':_0x2fd5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 028fe3e..6ef2f7e 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 _0x28e0=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x28e0,0x1a3));var _0x028e=function(_0x4792bb,_0x5a8427){_0x4792bb=_0x4792bb-0x0;var _0x38cad0=_0x28e0[_0x4792bb];return _0x38cad0;};'use strict';var client=require('../client');exports[_0x028e('0x0')]=function(_0x437ecf){return client[_0x028e('0x1')]('CreateWhatsappQueueReport',{'body':_0x437ecf,'log':_0x028e('0x2')});};exports[_0x028e('0x3')]=function(_0x1d2af1,_0x3bd5d2){return client[_0x028e('0x1')](_0x028e('0x4'),{'body':_0x3bd5d2,'options':{'where':{'uniqueid':_0x1d2af1},'order':[['id','DESC']],'limit':0x1},'log':_0x028e('0x4')});}; \ No newline at end of file +var _0x49eb=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x284d47,_0x33cb3d){var _0x58518d=function(_0x5d8187){while(--_0x5d8187){_0x284d47['push'](_0x284d47['shift']());}};_0x58518d(++_0x33cb3d);}(_0x49eb,0x6f));var _0xb49e=function(_0x518061,_0x3951dc){_0x518061=_0x518061-0x0;var _0x434f4e=_0x49eb[_0x518061];return _0x434f4e;};'use strict';var client=require(_0xb49e('0x0'));exports[_0xb49e('0x1')]=function(_0x44c428){return client[_0xb49e('0x2')](_0xb49e('0x3'),{'body':_0x44c428,'log':_0xb49e('0x3')});};exports['update']=function(_0x429f04,_0x5b45cf){return client['Request'](_0xb49e('0x4'),{'body':_0x5b45cf,'options':{'where':{'uniqueid':_0x429f04},'order':[['id','DESC']],'limit':0x1},'log':_0xb49e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7b78028..e2dd3d8 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 _0x88f3=['length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','atimeout','channel','START:%s','end','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x146bf6,_0x3a3461){var _0x4af2c3=function(_0x3df6a6){while(--_0x3df6a6){_0x146bf6['push'](_0x146bf6['shift']());}};_0x4af2c3(++_0x3a3461);}(_0x88f3,0x13e));var _0x388f=function(_0x351c71,_0x1652b9){_0x351c71=_0x351c71-0x0;var _0x1a5391=_0x88f3[_0x351c71];return _0x1a5391;};'use strict';var schema=require('validate');var _=require(_0x388f('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x388f('0x1'))(_0x388f('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x388f('0x3'),'required':!![],'message':_0x388f('0x4')},'timeout':{'type':_0x388f('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4d3f1b,_0x138f74,_0x4af154){return logger[_0x388f('0x6')](util[_0x388f('0x7')](_0x388f('0x8'),_0x4d3f1b,_0x138f74[_0x388f('0x9')],_0x4af154));}function handleFindAgent(_0x58c4f7){return function(_0x146b17){return _0x146b17[_0x388f('0x9')]['toLowerCase']()===_0x58c4f7[_0x388f('0xa')]();};}exports[_0x388f('0xb')]=function(_0x285c5d,_0x165e3c,_0x43644a,_0xa81c0d){return function(_0xc68c3e){try{var _0x53033c={'name':_0x165e3c[0x0],'timeout':_0x165e3c[0x1]};var _0xca6b87=queue['validate'](_0x53033c,{'typecast':!![]});if(_0xca6b87[_0x388f('0xc')]){logger[_0x388f('0xd')](_0x388f('0xe'),_0x285c5d,_[_0x388f('0xf')](_0xca6b87,'message')[_0x388f('0x10')](',\x20'));_0xc68c3e[_0x388f('0x11')]();}else{var _0x14f2d2=_[_0x388f('0x12')](_0x43644a[_0x388f('0x13')],handleFindAgent(_0x53033c['name']));if(_0x14f2d2){var _0x10e927=(_0x53033c['timeout']||0xa)*0x3e8;var _0x4179ff,_0x1499b2;var _0x5af023=seqqueue['createQueue'](_0x10e927);_0x5af023['id']=_0x285c5d;_0x5af023[_0x388f('0x14')]=_0x10e927;_0x5af023[_0x388f('0x15')]=_0xa81c0d['channel'];writeLog(_0x285c5d,_0x14f2d2,util[_0x388f('0x7')](_0x388f('0x16'),_0x10e927));_0x43644a['rules'][_0x285c5d]['on'](_0x388f('0x17'),function(){logger[_0x388f('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x285c5d);clearTimeout(_0x1499b2);_0x1499b2=undefined;_0x5af023['close']();if(_0x43644a[_0x388f('0x18')][_0x285c5d]){delete _0x43644a[_0x388f('0x18')][_0x285c5d];}_0xc68c3e[_0x388f('0x11')]();});_0x43644a[_0x388f('0x18')][_0x285c5d]['on']('complete',function(){if(_0x43644a[_0x388f('0x18')][_0x285c5d]){delete _0x43644a[_0x388f('0x18')][_0x285c5d];}});_0x1499b2=setTimeout(function(){logger[_0x388f('0x6')](_0x388f('0x19'),_0x285c5d);clearTimeout(_0x1499b2);_0x5af023[_0x388f('0x1a')]();_0xc68c3e[_0x388f('0x1b')]();},_0x10e927);strategy[_0x388f('0x1c')](_0x5af023,_0x14f2d2,_0x43644a,_0xa81c0d);}else{logger[_0x388f('0xd')](_0x388f('0x1d'),_0x285c5d,_0x53033c[_0x388f('0x9')]);_0xc68c3e[_0x388f('0x11')]();}}}catch(_0x704712){console[_0x388f('0x1e')](_0x704712);logger[_0x388f('0xd')](_0x388f('0x1f'),_0x285c5d,_0x704712[_0x388f('0x20')]);_0xc68c3e[_0x388f('0x11')]();}};}; \ No newline at end of file +var _0xcdd3=['complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules'];(function(_0x1f0ca6,_0x3a7cfc){var _0x51fc6e=function(_0x1ab976){while(--_0x1ab976){_0x1f0ca6['push'](_0x1f0ca6['shift']());}};_0x51fc6e(++_0x3a7cfc);}(_0xcdd3,0xab));var _0x3cdd=function(_0x23b079,_0x19cabd){_0x23b079=_0x23b079-0x0;var _0xe83270=_0xcdd3[_0x23b079];return _0xe83270;};'use strict';var schema=require(_0x3cdd('0x0'));var _=require(_0x3cdd('0x1'));var util=require(_0x3cdd('0x2'));var seqqueue=require(_0x3cdd('0x3'));var logger=require(_0x3cdd('0x4'))(_0x3cdd('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x3cdd('0x6'),'required':!![],'message':_0x3cdd('0x7')},'timeout':{'type':_0x3cdd('0x8'),'message':_0x3cdd('0x9')}});function writeLog(_0x1fad2e,_0x1cc703,_0x4aee30){return logger['info'](util[_0x3cdd('0xa')](_0x3cdd('0xb'),_0x1fad2e,_0x1cc703[_0x3cdd('0xc')],_0x4aee30));}function handleFindAgent(_0x2607b4){return function(_0x4af31e){return _0x4af31e[_0x3cdd('0xc')][_0x3cdd('0xd')]()===_0x2607b4[_0x3cdd('0xd')]();};}exports[_0x3cdd('0xe')]=function(_0x17f2a4,_0x5d5b80,_0x408f0f,_0xfdb648){return function(_0xb46bb7){try{var _0x4ac2f0={'name':_0x5d5b80[0x0],'timeout':_0x5d5b80[0x1]};var _0xcb2ade=queue[_0x3cdd('0x0')](_0x4ac2f0,{'typecast':!![]});if(_0xcb2ade[_0x3cdd('0xf')]){logger[_0x3cdd('0x10')](_0x3cdd('0x11'),_0x17f2a4,_[_0x3cdd('0x12')](_0xcb2ade,_0x3cdd('0x13'))[_0x3cdd('0x14')](',\x20'));_0xb46bb7[_0x3cdd('0x15')]();}else{var _0x4b74ab=_[_0x3cdd('0x16')](_0x408f0f[_0x3cdd('0x17')],handleFindAgent(_0x4ac2f0[_0x3cdd('0xc')]));if(_0x4b74ab){var _0x19b632=(_0x4ac2f0[_0x3cdd('0x18')]||0xa)*0x3e8;var _0x403ac8,_0x4cb2d1;var _0x11fd00=seqqueue[_0x3cdd('0x19')](_0x19b632);_0x11fd00['id']=_0x17f2a4;_0x11fd00[_0x3cdd('0x1a')]=_0x19b632;_0x11fd00[_0x3cdd('0x1b')]=_0xfdb648['channel'];writeLog(_0x17f2a4,_0x4b74ab,util[_0x3cdd('0xa')](_0x3cdd('0x1c'),_0x19b632));_0x408f0f['rules'][_0x17f2a4]['on'](_0x3cdd('0x1d'),function(){logger[_0x3cdd('0x1e')](_0x3cdd('0x1f'),_0x17f2a4);clearTimeout(_0x4cb2d1);_0x4cb2d1=undefined;_0x11fd00[_0x3cdd('0x20')]();if(_0x408f0f['rules'][_0x17f2a4]){delete _0x408f0f['rules'][_0x17f2a4];}_0xb46bb7[_0x3cdd('0x15')]();});_0x408f0f[_0x3cdd('0x21')][_0x17f2a4]['on'](_0x3cdd('0x22'),function(){if(_0x408f0f[_0x3cdd('0x21')][_0x17f2a4]){delete _0x408f0f[_0x3cdd('0x21')][_0x17f2a4];}});_0x4cb2d1=setTimeout(function(){logger[_0x3cdd('0x1e')](_0x3cdd('0x23'),_0x17f2a4);clearTimeout(_0x4cb2d1);_0x11fd00[_0x3cdd('0x20')]();_0xb46bb7['next']();},_0x19b632);strategy[_0x3cdd('0x24')](_0x11fd00,_0x4b74ab,_0x408f0f,_0xfdb648);}else{logger['error'](_0x3cdd('0x25'),_0x17f2a4,_0x4ac2f0[_0x3cdd('0xc')]);_0xb46bb7[_0x3cdd('0x15')]();}}}catch(_0x103bef){console[_0x3cdd('0x26')](_0x103bef);logger[_0x3cdd('0x10')](_0x3cdd('0x27'),_0x17f2a4,_0x103bef[_0x3cdd('0x28')]);_0xb46bb7['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 26e1b52..3c00241 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 _0x6cb9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','error','providerName','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x2179ae,_0xe2e338){var _0x56322b=function(_0x45897d){while(--_0x45897d){_0x2179ae['push'](_0x2179ae['shift']());}};_0x56322b(++_0xe2e338);}(_0x6cb9,0x182));var _0x96cb=function(_0x2a921d,_0x1d54c9){_0x2a921d=_0x2a921d-0x0;var _0x341cd9=_0x6cb9[_0x2a921d];return _0x341cd9;};'use strict';var _=require('lodash');var moment=require(_0x96cb('0x0'));var AWS=require(_0x96cb('0x1'));var utils=require(_0x96cb('0x2'));var logger=require(_0x96cb('0x3'))(_0x96cb('0x4'));var rpc={'chatMessage':require(_0x96cb('0x5')),'openchannelMessage':require(_0x96cb('0x6')),'mailMessage':require(_0x96cb('0x7')),'smsMessage':require(_0x96cb('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x96cb('0x9'))};exports[_0x96cb('0xa')]=function(_0x2f1b80,_0x28d74b){return function(_0x4aa991){try{if(!_['isNil'](this[_0x96cb('0xb')][_0x96cb('0xc')])){logger['info'](_0x96cb('0xd'),_0x2f1b80,_0x96cb('0xe'));return _0x4aa991[_0x96cb('0xf')]();}var _0xe37b48={'ContactId':this[_0x96cb('0x10')]['id'],'sentAt':moment()[_0x96cb('0x11')](_0x96cb('0x12')),'direction':_0x96cb('0x13')};if(this['channel']==='sms'||this['channel']==='whatsapp'){_0xe37b48[_0x96cb('0x14')]=this[_0x96cb('0xb')]['phone'];}var _0x519fde=this[_0x96cb('0x15')];if(_0x519fde===_0x96cb('0x16')){_0xe37b48[_0x96cb('0x17')]=this['account']['id'];}else{_0xe37b48[_[_0x96cb('0x18')](_0x519fde)+_0x96cb('0x19')]=this[_0x96cb('0x1a')]['id'];}_0xe37b48[_[_0x96cb('0x18')](_0x519fde)+_0x96cb('0x1b')]=this[_0x96cb('0xb')]['id'];if(this[_0x96cb('0xb')][_0x96cb('0x1c')]){var _0x44e925=_0x28d74b[0x4];if(!_[_0x96cb('0x1d')](_0x44e925)){_0xe37b48[_0x96cb('0x1e')]=utils[_0x96cb('0x1f')](_0x44e925,this);return rpc[_0x519fde+_0x96cb('0x20')][_0x96cb('0x21')](_0xe37b48)[_0x96cb('0x22')](function(_0x330b41){logger[_0x96cb('0x23')](_0x96cb('0xd'),_0x2f1b80,_0xe37b48['body']);})['catch'](function(_0x33b38c){logger['error'](_0x96cb('0xd'),_0x2f1b80,JSON[_0x96cb('0x24')](_0x33b38c));})[_0x96cb('0x25')](function(){logger[_0x96cb('0x23')](_0x96cb('0x26'),_0x2f1b80);_0x4aa991[_0x96cb('0x27')]();});}else{logger[_0x96cb('0x23')](_0x96cb('0x28'),_0x2f1b80);_0x4aa991[_0x96cb('0x27')]();}}else{var _0x3c07b3=this;var _0xa844a7=new AWS[(_0x96cb('0x29'))]({'accessKeyId':_0x28d74b[0x0],'secretAccessKey':_0x28d74b[0x1],'region':_0x28d74b[0x2]});var _0x681000={'botAlias':_0x96cb('0x2a'),'botName':_0x28d74b[0x3],'inputText':this[_0x96cb('0x2b')][_0x96cb('0x1e')],'userId':this[_0x96cb('0x15')]+':'+this[_0x96cb('0xb')]['id'][_0x96cb('0x2c')]()};_0xa844a7['postText'](_0x681000,function(_0x5d4ca4,_0x219080){if(_0x5d4ca4){logger[_0x96cb('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x2f1b80,_0x5d4ca4[_0x96cb('0x2b')]);_0x4aa991['next']();}else if(_0x219080&&_0x219080[_0x96cb('0x2b')]){_0x3c07b3['body']['amazonlex']=_0x219080;_0xe37b48[_0x96cb('0x1e')]=_0x219080['message'];_0xe37b48[_0x96cb('0x2e')]='amazonlex';_0xe37b48['providerResponse']=JSON[_0x96cb('0x24')](_0x219080);return rpc[_0x519fde+'Message'][_0x96cb('0x21')](_0xe37b48)['then'](function(_0x389e80){logger[_0x96cb('0x23')]('[%s][AMAZONLEX]\x20%s',_0x2f1b80,_0xe37b48[_0x96cb('0x1e')]);if(_0x219080[_0x96cb('0x2f')]==_0x96cb('0x30')){_0x4aa991[_0x96cb('0xf')]();}else{_0x4aa991[_0x96cb('0x27')]();}})['catch'](function(_0x5e5f11){logger[_0x96cb('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x2f1b80,JSON[_0x96cb('0x24')](_0x5e5f11));_0x4aa991[_0x96cb('0xf')]();});}else{_0x4aa991[_0x96cb('0xf')]();}});}}catch(_0x10080e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2f1b80,JSON[_0x96cb('0x24')](_0x10080e));_0x4aa991[_0x96cb('0x27')]();}};}; \ No newline at end of file +var _0xed5e=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','error','amazonlex','providerResponse','dialogState','Failed','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xed5e,0x12f));var _0xeed5=function(_0x1392c1,_0x5e9cbe){_0x1392c1=_0x1392c1-0x0;var _0x4c3da2=_0xed5e[_0x1392c1];return _0x4c3da2;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xeed5('0x0'))(_0xeed5('0x1'));var rpc={'chatMessage':require(_0xeed5('0x2')),'openchannelMessage':require(_0xeed5('0x3')),'mailMessage':require(_0xeed5('0x4')),'smsMessage':require(_0xeed5('0x5')),'faxMessage':require(_0xeed5('0x6')),'whatsappMessage':require(_0xeed5('0x7'))};exports[_0xeed5('0x8')]=function(_0x5bfb33,_0x29683b){return function(_0x30b14c){try{if(!_[_0xeed5('0x9')](this[_0xeed5('0xa')][_0xeed5('0xb')])){logger[_0xeed5('0xc')]('[%s][AMAZONLEX]\x20%s',_0x5bfb33,_0xeed5('0xd'));return _0x30b14c[_0xeed5('0xe')]();}var _0xd36779={'ContactId':this[_0xeed5('0xf')]['id'],'sentAt':moment()['format'](_0xeed5('0x10')),'direction':_0xeed5('0x11')};if(this['channel']===_0xeed5('0x12')||this[_0xeed5('0x13')]===_0xeed5('0x14')){_0xd36779[_0xeed5('0x15')]=this[_0xeed5('0xa')]['phone'];}var _0x5672cc=this['channel'];if(_0x5672cc===_0xeed5('0x16')){_0xd36779[_0xeed5('0x17')]=this[_0xeed5('0x18')]['id'];}else{_0xd36779[_[_0xeed5('0x19')](_0x5672cc)+_0xeed5('0x1a')]=this[_0xeed5('0x18')]['id'];}_0xd36779[_['upperFirst'](_0x5672cc)+_0xeed5('0x1b')]=this[_0xeed5('0xa')]['id'];if(this[_0xeed5('0xa')][_0xeed5('0x1c')]){var _0x466533=_0x29683b[0x4];if(!_[_0xeed5('0x1d')](_0x466533)){_0xd36779[_0xeed5('0x1e')]=utils[_0xeed5('0x1f')](_0x466533,this);return rpc[_0x5672cc+_0xeed5('0x20')][_0xeed5('0x21')](_0xd36779)[_0xeed5('0x22')](function(_0x33d975){logger[_0xeed5('0xc')](_0xeed5('0x23'),_0x5bfb33,_0xd36779[_0xeed5('0x1e')]);})[_0xeed5('0x24')](function(_0x88d3c7){logger['error'](_0xeed5('0x23'),_0x5bfb33,JSON[_0xeed5('0x25')](_0x88d3c7));})['finally'](function(){logger[_0xeed5('0xc')](_0xeed5('0x26'),_0x5bfb33);_0x30b14c[_0xeed5('0x27')]();});}else{logger[_0xeed5('0xc')](_0xeed5('0x28'),_0x5bfb33);_0x30b14c['stop']();}}else{var _0x2a0f00=this;var _0x48c4cc=new AWS[(_0xeed5('0x29'))]({'accessKeyId':_0x29683b[0x0],'secretAccessKey':_0x29683b[0x1],'region':_0x29683b[0x2]});var _0x35bffd={'botAlias':_0xeed5('0x2a'),'botName':_0x29683b[0x3],'inputText':this[_0xeed5('0x2b')][_0xeed5('0x1e')],'userId':this['channel']+':'+this[_0xeed5('0xa')]['id']['toString']()};_0x48c4cc['postText'](_0x35bffd,function(_0x264621,_0xfe7693){if(_0x264621){logger[_0xeed5('0x2c')]('[%s][AMAZONLEX]\x20%s',_0x5bfb33,_0x264621[_0xeed5('0x2b')]);_0x30b14c['next']();}else if(_0xfe7693&&_0xfe7693['message']){_0x2a0f00[_0xeed5('0x1e')]['amazonlex']=_0xfe7693;_0xd36779['body']=_0xfe7693[_0xeed5('0x2b')];_0xd36779['providerName']=_0xeed5('0x2d');_0xd36779[_0xeed5('0x2e')]=JSON[_0xeed5('0x25')](_0xfe7693);return rpc[_0x5672cc+_0xeed5('0x20')]['create'](_0xd36779)[_0xeed5('0x22')](function(_0x7816c1){logger[_0xeed5('0xc')](_0xeed5('0x23'),_0x5bfb33,_0xd36779['body']);if(_0xfe7693[_0xeed5('0x2f')]==_0xeed5('0x30')){_0x30b14c['next']();}else{_0x30b14c[_0xeed5('0x27')]();}})['catch'](function(_0x556cde){logger[_0xeed5('0x2c')](_0xeed5('0x23'),_0x5bfb33,JSON[_0xeed5('0x25')](_0x556cde));_0x30b14c['next']();});}else{_0x30b14c[_0xeed5('0xe')]();}});}}catch(_0x95c61d){logger[_0xeed5('0x2c')](_0xeed5('0x23'),_0x5bfb33,JSON[_0xeed5('0x25')](_0x95c61d));_0x30b14c[_0xeed5('0x27')]();}};}; \ 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 e979c1c..6c0bbd8 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 _0x791f=['[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','created','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','Interaction','update'];(function(_0x1d4fcf,_0xe3a32f){var _0x2611b6=function(_0x2e53aa){while(--_0x2e53aa){_0x1d4fcf['push'](_0x1d4fcf['shift']());}};_0x2611b6(++_0xe3a32f);}(_0x791f,0x112));var _0xf791=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x791f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf791('0x0'));var moment=require('moment');var utils=require(_0xf791('0x1'));var logger=require(_0xf791('0x2'))(_0xf791('0x3'));var rpc={'chatMessage':require(_0xf791('0x4')),'openchannelMessage':require(_0xf791('0x5')),'mailMessage':require(_0xf791('0x6')),'smsMessage':require(_0xf791('0x7')),'faxMessage':require(_0xf791('0x8')),'whatsappMessage':require(_0xf791('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf791('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xf791('0xb')),'faxInteraction':require(_0xf791('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xf791('0xd'));exports[_0xf791('0xe')]=function(_0x35c27a,_0x48d493,_0x9c987c,_0x5a7c0b){return function(_0x363f2d){try{var _0x59ad28=this[_0xf791('0xf')];if(_0x59ad28===_0xf791('0x10')&&_0x5a7c0b[_0xf791('0x11')][_0xf791('0x12')]){logger['info'](_0xf791('0x13'),_0x35c27a,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x363f2d[_0xf791('0x14')]();}if(_0x48d493[0x0]==='1'&&(_['isNil'](this['interaction'][_0xf791('0x15')])||!this[_0xf791('0x16')][_0xf791('0x15')])){logger[_0xf791('0x17')]('[%s][AUTOREPLY]\x20%s',_0x35c27a,_0xf791('0x18'));return _0x363f2d[_0xf791('0x14')]();}if(_0x48d493[0x0]==='2'&&this[_0xf791('0x16')][_0xf791('0x19')]){logger[_0xf791('0x17')](_0xf791('0x1a'),_0x35c27a,_0xf791('0x1b'));return _0x363f2d[_0xf791('0x14')]();}var _0x224e23={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf791('0x1c')](_0xf791('0x1d')),'direction':_0xf791('0x1e')};if(this[_0xf791('0xf')]===_0xf791('0x10')){_0x224e23[_0xf791('0x11')]=utils['getMustacheRender'](_0x48d493[0x2],this);}else{_0x224e23[_0xf791('0x11')]=utils['getMustacheRender'](_0x48d493[0x1],this);}if(this[_0xf791('0x1f')]){_0x224e23['to']=this['message'][_0xf791('0x20')]||'';if(this['channel']===_0xf791('0x10')&&_0x48d493[0x1]==='1'){_0x224e23['cc']=this[_0xf791('0x1f')]['cc']||'';}_0x224e23[_0xf791('0x20')]=this['message']['to']||'';_0x224e23[_0xf791('0x21')]=this[_0xf791('0x1f')]['phone']||'';_0x224e23['read']=!![];if(this[_0xf791('0x1f')]['subject']){_0x224e23[_0xf791('0x22')]='';_0x224e23[_0xf791('0x22')]+=_['startsWith'](this[_0xf791('0x1f')][_0xf791('0x22')],_0xf791('0x23'))?'':_0xf791('0x24');_0x224e23[_0xf791('0x22')]+=this[_0xf791('0x1f')]['subject'];}}if(this[_0xf791('0xf')]==='chat'){_0x224e23[_0xf791('0x25')]=this[_0xf791('0x26')]['id'];}else{_0x224e23[_[_0xf791('0x27')](this['channel'])+_0xf791('0x28')]=this[_0xf791('0x26')]['id'];}_0x224e23[_[_0xf791('0x27')](this[_0xf791('0xf')])+_0xf791('0x29')]=this[_0xf791('0x16')]['id'];var _0x28faaa=this['interaction'];if(rpc[this['channel']+_0xf791('0x2a')]){if(this[_0xf791('0xf')]===_0xf791('0x10')){_0x224e23[_0xf791('0x2b')]=this['message'][_0xf791('0x2c')];_0x224e23[_0xf791('0x2d')]=_0xf791('0x2e')+_[_0xf791('0x2f')](_0x224e23[_0xf791('0x11')],_0xf791('0x30'),_0xf791('0x31'))+_0xf791('0x32');_0x224e23[_0xf791('0x33')]={'Auto-Submitted':_0xf791('0x34'),'X-Auto-Response-Suppress':_0xf791('0x35'),'Precedence':_0xf791('0x36')};return mailRpc[_0xf791('0x37')](this[_0xf791('0x26')]['smtpOptions'],_0x224e23)['then'](function(_0x29dedc){logger[_0xf791('0x17')](_0xf791('0x38'),_0x35c27a);_0x224e23['messageId']=_0x29dedc[_0xf791('0x1f')][_0xf791('0x2c')];return rpc[_0x59ad28+_0xf791('0x2a')]['create'](_0x224e23);})['then'](function(_0x1b4c8a){logger['info'](_0xf791('0x13'),_0x35c27a,JSON[_0xf791('0x39')](_0x1b4c8a));})[_0xf791('0x3a')](function(_0xf5e666){logger[_0xf791('0x3b')](_0xf791('0x3c'),_0x35c27a,JSON['stringify'](_0xf5e666));})[_0xf791('0x3d')](function(){Promise[_0xf791('0x3e')]()[_0xf791('0x3f')](function(){if(_0x48d493[0x0]!=='2'||_0x28faaa[_0xf791('0x19')])return;return rpc[_0x59ad28+_0xf791('0x40')][_0xf791('0x41')](_0x28faaa['id'],{'autoreplyExecuted':!![]})[_0xf791('0x3f')](function(_0x9534b2){logger['info'](_0xf791('0x1a'),_0x35c27a,JSON[_0xf791('0x39')](_0x9534b2));})['catch'](function(_0x823fc9){logger[_0xf791('0x3b')](_0xf791('0x42'),_0x35c27a,JSON['stringify'](_0x823fc9));});})[_0xf791('0x3f')](function(){_0x363f2d[_0xf791('0x14')]();});});}else{return rpc[this[_0xf791('0xf')]+_0xf791('0x2a')]['create'](_0x224e23)['then'](function(){logger[_0xf791('0x17')](_0xf791('0x13'),_0x35c27a,_0x224e23[_0xf791('0x11')]);})['catch'](function(_0x1820f6){logger[_0xf791('0x3b')](_0xf791('0x13'),_0x35c27a,JSON[_0xf791('0x39')](_0x1820f6));})[_0xf791('0x3d')](function(){Promise[_0xf791('0x3e')]()[_0xf791('0x3f')](function(){if(_0x48d493[0x0]!=='2'||_0x28faaa[_0xf791('0x19')])return;return rpc[_0x59ad28+_0xf791('0x40')][_0xf791('0x41')](_0x28faaa['id'],{'autoreplyExecuted':!![]})[_0xf791('0x3f')](function(_0x558524){logger[_0xf791('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x35c27a,JSON[_0xf791('0x39')](_0x558524));})[_0xf791('0x3a')](function(_0x35b158){logger['error'](_0xf791('0x42'),_0x35c27a,JSON[_0xf791('0x39')](_0x35b158));});})[_0xf791('0x3f')](function(){_0x363f2d['next']();});});}}}catch(_0x553c31){logger[_0xf791('0x3b')](_0xf791('0x13'),_0x35c27a,JSON[_0xf791('0x39')](_0x553c31));_0x363f2d[_0xf791('0x43')]();}};}; \ No newline at end of file +var _0x27b0=['resolve','autoreplyExecuted','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','phone','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x27b0,0x10b));var _0x027b=function(_0x132787,_0x49aebb){_0x132787=_0x132787-0x0;var _0x281428=_0x27b0[_0x132787];return _0x281428;};'use strict';var _=require(_0x027b('0x0'));var moment=require(_0x027b('0x1'));var utils=require(_0x027b('0x2'));var logger=require('../../../../config/logger')(_0x027b('0x3'));var rpc={'chatMessage':require(_0x027b('0x4')),'openchannelMessage':require(_0x027b('0x5')),'mailMessage':require(_0x027b('0x6')),'smsMessage':require(_0x027b('0x7')),'faxMessage':require(_0x027b('0x8')),'whatsappMessage':require(_0x027b('0x9')),'chatInteraction':require(_0x027b('0xa')),'openchannelInteraction':require(_0x027b('0xb')),'mailInteraction':require(_0x027b('0xc')),'smsInteraction':require(_0x027b('0xd')),'faxInteraction':require(_0x027b('0xe')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x1c249f,_0x20dc1a,_0x1eff68,_0x23ef1c){return function(_0x26c644){try{var _0x201c91=this[_0x027b('0xf')];if(_0x201c91===_0x027b('0x10')&&_0x23ef1c[_0x027b('0x11')][_0x027b('0x12')]){logger['info'](_0x027b('0x13'),_0x1c249f,_0x027b('0x14'));return _0x26c644[_0x027b('0x15')]();}if(_0x20dc1a[0x0]==='1'&&(_[_0x027b('0x16')](this['interaction']['created'])||!this[_0x027b('0x17')][_0x027b('0x18')])){logger[_0x027b('0x19')](_0x027b('0x13'),_0x1c249f,_0x027b('0x1a'));return _0x26c644['next']();}if(_0x20dc1a[0x0]==='2'&&this[_0x027b('0x17')]['autoreplyExecuted']){logger[_0x027b('0x19')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1c249f,_0x027b('0x1b'));return _0x26c644[_0x027b('0x15')]();}var _0x4ee770={'ContactId':this[_0x027b('0x1c')]['id'],'sentAt':moment()[_0x027b('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='mail'){_0x4ee770['body']=utils['getMustacheRender'](_0x20dc1a[0x2],this);}else{_0x4ee770[_0x027b('0x11')]=utils[_0x027b('0x1e')](_0x20dc1a[0x1],this);}if(this[_0x027b('0x1f')]){_0x4ee770['to']=this[_0x027b('0x1f')]['from']||'';if(this[_0x027b('0xf')]===_0x027b('0x10')&&_0x20dc1a[0x1]==='1'){_0x4ee770['cc']=this[_0x027b('0x1f')]['cc']||'';}_0x4ee770['from']=this[_0x027b('0x1f')]['to']||'';_0x4ee770[_0x027b('0x20')]=this[_0x027b('0x1f')][_0x027b('0x20')]||'';_0x4ee770['read']=!![];if(this[_0x027b('0x1f')][_0x027b('0x21')]){_0x4ee770[_0x027b('0x21')]='';_0x4ee770[_0x027b('0x21')]+=_['startsWith'](this[_0x027b('0x1f')][_0x027b('0x21')],_0x027b('0x22'))?'':_0x027b('0x23');_0x4ee770[_0x027b('0x21')]+=this[_0x027b('0x1f')]['subject'];}}if(this[_0x027b('0xf')]==='chat'){_0x4ee770[_0x027b('0x24')]=this[_0x027b('0x25')]['id'];}else{_0x4ee770[_['upperFirst'](this['channel'])+'AccountId']=this[_0x027b('0x25')]['id'];}_0x4ee770[_[_0x027b('0x26')](this['channel'])+_0x027b('0x27')]=this[_0x027b('0x17')]['id'];var _0x2445f8=this['interaction'];if(rpc[this['channel']+_0x027b('0x28')]){if(this[_0x027b('0xf')]===_0x027b('0x10')){_0x4ee770['inReplyTo']=this[_0x027b('0x1f')][_0x027b('0x29')];_0x4ee770[_0x027b('0x2a')]=_0x027b('0x2b')+_[_0x027b('0x2c')](_0x4ee770['body'],']+(>|$)/g,''),'priorityTrue':_0xcaf806[0x1],'priorityFalse':_0xcaf806[0x2]};var _0x18421f=gotoif[_0x6155('0x0')](_0x28c6f7,{'typecast':!![]});if(_0x18421f[_0x6155('0xe')]){logger[_0x6155('0xf')](_0x6155('0x10'),_0x2218ba,_[_0x6155('0x11')](_0x18421f,_0x6155('0x12'))[_0x6155('0x13')](',\x20'));_0x4213ab[_0x6155('0x14')]();}else{try{var _0x16a651=eval('('+_0x28c6f7[_0x6155('0x15')]+')');var _0x31aab1=_0x16a651?_0x28c6f7['priorityTrue']:_0x28c6f7['priorityFalse'];logger[_0x6155('0x16')](_0x6155('0x17'),_0x2218ba,_0x28c6f7[_0x6155('0x15')],_0x16a651,_0x31aab1||_0x6155('0x18'));if(_0x31aab1){var _0x49562d=_[_0x6155('0x19')](_0x4213ab[_0x6155('0x1a')](),{'p':_0x31aab1});if(_0x49562d>=0x0){logger[_0x6155('0x16')](_0x6155('0x1b'),_0x2218ba,_0x31aab1||_0x6155('0x18'),_0x49562d);_0x4213ab['next'](_0x49562d);}else{logger['info'](_0x6155('0x1c'),_0x2218ba,_0x31aab1||_0x6155('0x18'));_0x4213ab[_0x6155('0x14')]();}}else{_0x4213ab[_0x6155('0x18')]();}}catch(_0x3c8ede){logger[_0x6155('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2218ba,_0x3c8ede[_0x6155('0x12')]);_0x4213ab['stop']();}}}catch(_0xc46ddb){logger[_0x6155('0xf')]('[%s][GOTOIF]\x20%s',_0x2218ba,JSON[_0x6155('0x1d')](_0xc46ddb));_0x4213ab['stop']();}};}; \ No newline at end of file +var _0x4b0f=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4b0f,0xb9));var _0xf4b0=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x4b0f[_0x34f701];return _0x3e2429;};'use strict';var schema=require(_0xf4b0('0x0'));var _=require(_0xf4b0('0x1'));var htmlToText=require(_0xf4b0('0x2'));var utils=require(_0xf4b0('0x3'));var logger=require(_0xf4b0('0x4'))(_0xf4b0('0x5'));var gotoif=schema({'condition':{'type':_0xf4b0('0x6'),'required':!![],'message':_0xf4b0('0x7')},'priorityTrue':{'type':'number','message':_0xf4b0('0x8')},'priorityFalse':{'type':'number','message':_0xf4b0('0x9')}});exports[_0xf4b0('0xa')]=function(_0x623347,_0x13432c){return function(_0x3568ae){try{var _0x495d4d={'condition':htmlToText[_0xf4b0('0xb')](utils[_0xf4b0('0xc')](_0x13432c[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x13432c[0x1],'priorityFalse':_0x13432c[0x2]};var _0x14b535=gotoif[_0xf4b0('0x0')](_0x495d4d,{'typecast':!![]});if(_0x14b535[_0xf4b0('0xd')]){logger['error'](_0xf4b0('0xe'),_0x623347,_[_0xf4b0('0xf')](_0x14b535,_0xf4b0('0x10'))[_0xf4b0('0x11')](',\x20'));_0x3568ae[_0xf4b0('0x12')]();}else{try{var _0x26329b=eval('('+_0x495d4d[_0xf4b0('0x13')]+')');var _0x5a878f=_0x26329b?_0x495d4d[_0xf4b0('0x14')]:_0x495d4d[_0xf4b0('0x15')];logger[_0xf4b0('0x16')](_0xf4b0('0x17'),_0x623347,_0x495d4d[_0xf4b0('0x13')],_0x26329b,_0x5a878f||_0xf4b0('0x18'));if(_0x5a878f){var _0x4604a4=_[_0xf4b0('0x19')](_0x3568ae[_0xf4b0('0x1a')](),{'p':_0x5a878f});if(_0x4604a4>=0x0){logger[_0xf4b0('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x623347,_0x5a878f||_0xf4b0('0x18'),_0x4604a4);_0x3568ae[_0xf4b0('0x18')](_0x4604a4);}else{logger[_0xf4b0('0x16')](_0xf4b0('0x1b'),_0x623347,_0x5a878f||_0xf4b0('0x18'));_0x3568ae[_0xf4b0('0x12')]();}}else{_0x3568ae[_0xf4b0('0x18')]();}}catch(_0x3712d9){logger[_0xf4b0('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x623347,_0x3712d9[_0xf4b0('0x10')]);_0x3568ae[_0xf4b0('0x12')]();}}}catch(_0x1644f1){logger[_0xf4b0('0x1c')]('[%s][GOTOIF]\x20%s',_0x623347,JSON[_0xf4b0('0x1d')](_0x1644f1));_0x3568ae[_0xf4b0('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 616166c..633048d 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 _0x2cb5=['message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x2cb5,0x1eb));var _0x52cb=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x2cb5[_0x11155f];return _0xd07e48;};'use strict';var schema=require(_0x52cb('0x0'));var _=require(_0x52cb('0x1'));var logger=require(_0x52cb('0x2'))('routing');var gotop=schema({'priority':{'type':_0x52cb('0x3'),'required':!![],'message':_0x52cb('0x4')}});exports[_0x52cb('0x5')]=function(_0x3219a5,_0x1199d3){return function(_0x2be2f7){try{var _0x3a6d34={'priority':_0x1199d3[0x0]};var _0x3f6073=gotop[_0x52cb('0x0')](_0x3a6d34,{'typecast':!![]});if(_0x3f6073[_0x52cb('0x6')]){logger[_0x52cb('0x7')]('[%s][GOTOP]\x20%s',_0x3219a5,_[_0x52cb('0x8')](_0x3f6073,_0x52cb('0x9'))['join'](',\x20'));_0x2be2f7[_0x52cb('0xa')]();}else{logger[_0x52cb('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x3219a5,_0x3a6d34[_0x52cb('0xc')]);if(_0x3a6d34['priority']){var _0x519d40=_[_0x52cb('0xd')](_0x2be2f7[_0x52cb('0xe')](),{'p':_0x3a6d34[_0x52cb('0xc')]});if(_0x519d40>=0x0){logger['info'](_0x52cb('0xf'),_0x3219a5,_0x3a6d34['priority']||_0x52cb('0x10'),_0x519d40);_0x2be2f7['next'](_0x519d40);}else{logger['info'](_0x52cb('0x11'),_0x3219a5,_0x3a6d34[_0x52cb('0xc')]||_0x52cb('0x10'));_0x2be2f7[_0x52cb('0xa')]();}}else{_0x2be2f7[_0x52cb('0x10')]();}}}catch(_0x267820){logger[_0x52cb('0x7')](_0x52cb('0x12'),_0x3219a5,JSON[_0x52cb('0x13')](_0x267820));_0x2be2f7['stop']();}};}; \ No newline at end of file +var _0x24a2=['error','[%s][GOTOP]\x20%s','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0x24a2,0x1ca));var _0x224a=function(_0x377473,_0x1c807f){_0x377473=_0x377473-0x0;var _0x14f6ec=_0x24a2[_0x377473];return _0x14f6ec;};'use strict';var schema=require(_0x224a('0x0'));var _=require('lodash');var logger=require(_0x224a('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x224a('0x2')}});exports[_0x224a('0x3')]=function(_0x20156b,_0x886c24){return function(_0x91c37f){try{var _0x307ce9={'priority':_0x886c24[0x0]};var _0x13bc83=gotop[_0x224a('0x0')](_0x307ce9,{'typecast':!![]});if(_0x13bc83['length']){logger[_0x224a('0x4')](_0x224a('0x5'),_0x20156b,_['map'](_0x13bc83,_0x224a('0x6'))['join'](',\x20'));_0x91c37f[_0x224a('0x7')]();}else{logger[_0x224a('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x20156b,_0x307ce9[_0x224a('0x9')]);if(_0x307ce9[_0x224a('0x9')]){var _0x90a040=_[_0x224a('0xa')](_0x91c37f[_0x224a('0xb')](),{'p':_0x307ce9['priority']});if(_0x90a040>=0x0){logger[_0x224a('0x8')](_0x224a('0xc'),_0x20156b,_0x307ce9['priority']||_0x224a('0xd'),_0x90a040);_0x91c37f[_0x224a('0xd')](_0x90a040);}else{logger[_0x224a('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x20156b,_0x307ce9[_0x224a('0x9')]||'next');_0x91c37f['stop']();}}else{_0x91c37f['next']();}}}catch(_0x532b99){logger[_0x224a('0x4')](_0x224a('0x5'),_0x20156b,JSON['stringify'](_0x532b99));_0x91c37f[_0x224a('0x7')]();}};}; \ 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 7b17dc5..7a62687 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 _0xe54c=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','info','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe54c,0x79));var _0xce54=function(_0x1ad659,_0x1ab26a){_0x1ad659=_0x1ad659-0x0;var _0x56d7e2=_0xe54c[_0x1ad659];return _0x56d7e2;};'use strict';var _=require(_0xce54('0x0'));var utils=require(_0xce54('0x1'));var logger=require(_0xce54('0x2'))(_0xce54('0x3'));var rpc={'chatMessage':require(_0xce54('0x4')),'openchannelMessage':require(_0xce54('0x5')),'mailMessage':require(_0xce54('0x6')),'smsMessage':require(_0xce54('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xce54('0x8'))};exports['consequence']=function(_0x3f58ce,_0x2f47e9){return function(_0x48e7bb){try{var _0x50941={'body':utils['getMustacheRender'](_0x2f47e9[0x0],this),'ContactId':this[_0xce54('0x9')]['id']};if(this[_0xce54('0xa')]==='chat'){_0x50941[_0xce54('0xb')]=this[_0xce54('0xc')]['id'];}else{_0x50941[_[_0xce54('0xd')](this[_0xce54('0xa')])+_0xce54('0xe')]=this[_0xce54('0xc')]['id'];}_0x50941[_[_0xce54('0xd')](this[_0xce54('0xa')])+_0xce54('0xf')]=this[_0xce54('0x10')]['id'];if(rpc[this[_0xce54('0xa')]+_0xce54('0x11')]){return rpc[this[_0xce54('0xa')]+_0xce54('0x11')]['create'](_0x50941)['then'](function(_0x5a0562){logger[_0xce54('0x12')]('[%s][MESSAGE]\x20%s',_0x3f58ce,_0x50941[_0xce54('0x13')]);_0x48e7bb[_0xce54('0x14')]();})['catch'](function(_0x586520){logger[_0xce54('0x15')](_0xce54('0x16'),_0x3f58ce,JSON[_0xce54('0x17')](_0x586520));_0x48e7bb[_0xce54('0x18')]();});}}catch(_0x3c8569){logger['error']('[%s][MESSAGE]\x20%s',_0x3f58ce,JSON[_0xce54('0x17')](_0x3c8569));_0x48e7bb[_0xce54('0x18')]();}};}; \ No newline at end of file +var _0x9173=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils'];(function(_0x4ef333,_0x56d641){var _0xf09c25=function(_0x21b9e3){while(--_0x21b9e3){_0x4ef333['push'](_0x4ef333['shift']());}};_0xf09c25(++_0x56d641);}(_0x9173,0xb4));var _0x3917=function(_0x2844f2,_0x479184){_0x2844f2=_0x2844f2-0x0;var _0x298c39=_0x9173[_0x2844f2];return _0x298c39;};'use strict';var _=require(_0x3917('0x0'));var utils=require(_0x3917('0x1'));var logger=require('../../../../config/logger')(_0x3917('0x2'));var rpc={'chatMessage':require(_0x3917('0x3')),'openchannelMessage':require(_0x3917('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3917('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3917('0x6'))};exports[_0x3917('0x7')]=function(_0x17ec38,_0x403e03){return function(_0x2dace9){try{var _0x48d592={'body':utils[_0x3917('0x8')](_0x403e03[0x0],this),'ContactId':this[_0x3917('0x9')]['id']};if(this[_0x3917('0xa')]===_0x3917('0xb')){_0x48d592[_0x3917('0xc')]=this[_0x3917('0xd')]['id'];}else{_0x48d592[_['upperFirst'](this[_0x3917('0xa')])+_0x3917('0xe')]=this['account']['id'];}_0x48d592[_[_0x3917('0xf')](this[_0x3917('0xa')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0x3917('0x10')]){return rpc[this[_0x3917('0xa')]+_0x3917('0x10')][_0x3917('0x11')](_0x48d592)[_0x3917('0x12')](function(_0xc0902d){logger['info'](_0x3917('0x13'),_0x17ec38,_0x48d592[_0x3917('0x14')]);_0x2dace9[_0x3917('0x15')]();})[_0x3917('0x16')](function(_0x4d7f6c){logger[_0x3917('0x17')](_0x3917('0x13'),_0x17ec38,JSON[_0x3917('0x18')](_0x4d7f6c));_0x2dace9[_0x3917('0x19')]();});}}catch(_0x23821c){logger['error'](_0x3917('0x13'),_0x17ec38,JSON['stringify'](_0x23821c));_0x2dace9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 7169281..0459be7 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 _0x1737=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stop'];(function(_0x258224,_0x35aa4b){var _0x38e526=function(_0x123faf){while(--_0x123faf){_0x258224['push'](_0x258224['shift']());}};_0x38e526(++_0x35aa4b);}(_0x1737,0x6c));var _0x7173=function(_0x38353e,_0x346e2e){_0x38353e=_0x38353e-0x0;var _0x13672c=_0x1737[_0x38353e];return _0x13672c;};'use strict';var utils=require(_0x7173('0x0'));var logger=require(_0x7173('0x1'))(_0x7173('0x2'));exports[_0x7173('0x3')]=function(_0x1deb0c,_0x4e1d16){return function(_0x60b072){try{logger[_0x7173('0x4')](_0x7173('0x5'),_0x1deb0c,utils[_0x7173('0x6')](_0x4e1d16[0x0],this));_0x60b072['next']();}catch(_0xe996f){logger[_0x7173('0x7')]('[%s][NOOP]\x20%s',_0x1deb0c,JSON['stringify'](_0xe996f));_0x60b072[_0x7173('0x8')]();}};}; \ No newline at end of file +var _0x67bc=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x67bc,0x10e));var _0xc67b=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0x67bc[_0x3d9557];return _0x359ff8;};'use strict';var utils=require(_0xc67b('0x0'));var logger=require(_0xc67b('0x1'))(_0xc67b('0x2'));exports[_0xc67b('0x3')]=function(_0x2970a4,_0x170cd6){return function(_0x2304d9){try{logger[_0xc67b('0x4')](_0xc67b('0x5'),_0x2970a4,utils[_0xc67b('0x6')](_0x170cd6[0x0],this));_0x2304d9[_0xc67b('0x7')]();}catch(_0x4e6448){logger[_0xc67b('0x8')](_0xc67b('0x5'),_0x2970a4,JSON[_0xc67b('0x9')](_0x4e6448));_0x2304d9[_0xc67b('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b29f735..abb59b0 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 _0xd178=['waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','account','joinAt','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','from','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','message','chat','AccountId','info','name','QueueReport','error','create\x20queue\x20report'];(function(_0x20f7c9,_0x58f651){var _0x202944=function(_0x5507d3){while(--_0x5507d3){_0x20f7c9['push'](_0x20f7c9['shift']());}};_0x202944(++_0x58f651);}(_0xd178,0xb5));var _0x8d17=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xd178[_0x3635ce];return _0x97ecd0;};'use strict';var schema=require('validate');var _=require(_0x8d17('0x0'));var util=require(_0x8d17('0x1'));var seqqueue=require(_0x8d17('0x2'));var moment=require(_0x8d17('0x3'));var Redis=require(_0x8d17('0x4'));var config=require('../../../../config/environment');var logger=require(_0x8d17('0x5'))(_0x8d17('0x6'));var strategy=require('./strategy');config['redis']=_[_0x8d17('0x7')](config[_0x8d17('0x8')],{'host':_0x8d17('0x9'),'port':0x18eb});var io=require(_0x8d17('0xa'))(new Redis(config[_0x8d17('0x8')]));var attributes=['id','queue_id',_0x8d17('0xb'),'queue','from',_0x8d17('0xc')];function emit(_0x547c2f,_0x27fe21,_0x4fdefb){io['to'](_0x547c2f)[_0x8d17('0xd')](_0x27fe21,_0x4fdefb);}function emitChannelQueueInteraction(_0x45c3e8,_0x50d47e,_0x5c37da,_0x4b4d61,_0x4f1d8e,_0x440147,_0x5448cd,_0x489a9c){var _0x15208e=_[_0x8d17('0xe')](_0x5c37da);_0x15208e['queue_id']=_0x489a9c;_0x15208e[_0x8d17('0xf')]=_0x50d47e;_0x15208e[_0x8d17('0xb')]=_0x4b4d61;_0x15208e['id']=_0x4f1d8e;if(_0x440147){_0x5448cd[util[_0x8d17('0x10')](_0x8d17('0x11'),_0x45c3e8)][_0x4f1d8e]=_[_0x8d17('0x12')](_0x15208e,attributes);}else{delete _0x5448cd[util['format'](_0x8d17('0x11'),_0x45c3e8)][_0x4f1d8e];}emit(util[_0x8d17('0x10')]('%s:queue:%s',_0x45c3e8,_0x50d47e),util[_0x8d17('0x10')](_0x8d17('0x13'),_0x45c3e8,_0x440147?_0x8d17('0x14'):'remove'),_[_0x8d17('0x12')](_0x15208e,attributes));}var rpc={'openchannelQueueReport':require(_0x8d17('0x15')),'mailQueueReport':require(_0x8d17('0x16')),'chatQueueReport':require(_0x8d17('0x17')),'smsQueueReport':require(_0x8d17('0x18')),'faxQueueReport':require(_0x8d17('0x19')),'whatsappQueueReport':require(_0x8d17('0x1a'))};var queue=schema({'name':{'type':_0x8d17('0x1b'),'required':!![],'message':_0x8d17('0x1c')},'timeout':{'type':'number','message':_0x8d17('0x1d')}});function startRouting(_0x144b4c,_0x28307c,_0x913918,_0x4fdfd1){if(_0x144b4c&&_0x28307c&&_0x913918){_0x28307c['waiting']+=0x1;var _0x585bb0={'uniqueid':_0x144b4c,'from':_0x913918[_0x8d17('0x1e')]?_0x913918[_0x8d17('0x1e')][_0x8d17('0x1f')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x913918[_0x8d17('0x20')]?_0x913918['contact']['id']:null,'ListId':_0x913918['list']?_0x913918[_0x8d17('0x21')]['id']:null};_0x585bb0[_['upperFirst'](_0x913918[_0x8d17('0x22')])+_0x8d17('0x23')]=_0x28307c['id']||null;_0x585bb0[_[_0x8d17('0x24')](_0x913918[_0x8d17('0x22')])+_0x8d17('0x25')]=_0x913918[_0x8d17('0x26')]?_0x913918[_0x8d17('0x26')]['id']:null;_0x585bb0[_[_0x8d17('0x24')](_0x913918[_0x8d17('0x22')])+'MessageId']=_0x913918[_0x8d17('0x27')]?_0x913918[_0x8d17('0x27')]['id']:null;_0x585bb0[_[_0x8d17('0x24')](_0x913918['channel'])+(_0x913918[_0x8d17('0x22')]!==_0x8d17('0x28')?_0x8d17('0x29'):'WebsiteId')]=_0x913918[_0x8d17('0xb')]?_0x913918[_0x8d17('0xb')]['id']:null;logger[_0x8d17('0x2a')](util[_0x8d17('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x144b4c,_0x28307c[_0x8d17('0x2b')]));emitChannelQueueInteraction(_0x913918[_0x8d17('0x22')],_0x28307c[_0x8d17('0x2b')],_0x585bb0,_0x913918['account'][_0x8d17('0x2b')],_0x913918[_0x8d17('0x27')]['id'],!![],_0x4fdfd1,_0x28307c['id']);if(rpc[_0x913918[_0x8d17('0x22')]+_0x8d17('0x2c')]){return rpc[_0x913918[_0x8d17('0x22')]+_0x8d17('0x2c')]['create'](_0x585bb0)['catch'](function(_0x15beae){logger[_0x8d17('0x2d')](_0x8d17('0x2e'));});}}}function stopRouting(_0x17d4a4,_0x447091,_0xf06641,_0x4af9ca){if(_0x17d4a4&&_0x447091){_0x447091[_0x8d17('0x2f')]-=0x1;var _0x4f494d={'leaveAt':moment()['format'](_0x8d17('0x30')),'acceptAt':moment()[_0x8d17('0x10')](_0x8d17('0x30')),'reason':_0x8d17('0x31')};logger[_0x8d17('0x2a')](util[_0x8d17('0x10')](_0x8d17('0x32'),_0x17d4a4,_0x447091[_0x8d17('0x2b')]));emitChannelQueueInteraction(_0xf06641[_0x8d17('0x22')],_0x447091[_0x8d17('0x2b')],_0xf06641[_0x8d17('0x1e')],_0xf06641['account']['name'],_0xf06641[_0x8d17('0x27')]['id'],![],_0x4af9ca,_0x447091['id']);if(rpc[_0xf06641[_0x8d17('0x22')]+_0x8d17('0x2c')]){return rpc[_0xf06641[_0x8d17('0x22')]+'QueueReport']['update'](_0x17d4a4,_0x4f494d)[_0x8d17('0x33')](function(_0x3dafa5){logger[_0x8d17('0x2d')](_0x8d17('0x34'));});}}}function endRouting(_0x449f9e,_0x433bd5,_0x4d3582,_0x776610){if(_0x449f9e&&_0x433bd5){_0x433bd5[_0x8d17('0x2f')]-=0x1;var _0x340903={'leaveAt':moment()[_0x8d17('0x10')](_0x8d17('0x30')),'exitAt':moment()[_0x8d17('0x10')](_0x8d17('0x30')),'reason':_0x8d17('0x35')};logger[_0x8d17('0x2a')](util['format'](_0x8d17('0x36'),_0x449f9e,_0x433bd5[_0x8d17('0x2b')]));emitChannelQueueInteraction(_0x4d3582[_0x8d17('0x22')],_0x433bd5[_0x8d17('0x2b')],_0x4d3582['body'],_0x4d3582[_0x8d17('0xb')][_0x8d17('0x2b')],_0x4d3582[_0x8d17('0x27')]['id'],![],_0x776610);if(rpc[_0x4d3582[_0x8d17('0x22')]+_0x8d17('0x2c')]){return rpc[_0x4d3582[_0x8d17('0x22')]+_0x8d17('0x2c')][_0x8d17('0x37')](_0x449f9e,_0x340903)['catch'](function(_0x248a5b){logger[_0x8d17('0x2d')](_0x8d17('0x34'));});}}}function handleFindQueue(_0x223824){return function(_0x2397f7){return _0x2397f7[_0x8d17('0x2b')]['toLowerCase']()===_0x223824[_0x8d17('0x38')]();};}exports[_0x8d17('0x39')]=function(_0xecf818,_0x1dec21,_0x21cc62,_0x69cee6){return function(_0x570aa0){try{var _0x136cec={'name':_0x1dec21[0x0],'timeout':_0x1dec21[0x1]};var _0x163826=queue[_0x8d17('0x3a')](_0x136cec,{'typecast':!![]});if(_0x163826[_0x8d17('0x3b')]){logger['error'](_0x8d17('0x3c'),_0xecf818,_['map'](_0x163826,_0x8d17('0x27'))[_0x8d17('0x3d')](',\x20'));_0x570aa0[_0x8d17('0x3e')]();}else{var _0x314dea=_['find'](_0x21cc62[_0x69cee6[_0x8d17('0x22')]+_0x8d17('0x3f')],handleFindQueue(_0x136cec[_0x8d17('0x2b')]));if(_0x314dea){startRouting(_0xecf818,_0x314dea,_0x69cee6,_0x21cc62);var _0x7292de=(_0x314dea[_0x8d17('0x35')]||0xa)*0x3e8;var _0x3f6c4d=(_0x136cec[_0x8d17('0x35')]||0x14)*0x3e8;var _0x3c6878,_0xda7800;if(_0x7292de>_0x3f6c4d){_0x3f6c4d=_0x7292de;}var _0xab85ce=seqqueue[_0x8d17('0x40')](_0x7292de);_0xab85ce['id']=_0xecf818;_0xab85ce[_0x8d17('0x41')]=_0x7292de;_0xab85ce['qtimeout']=_0x3f6c4d;_0xab85ce[_0x8d17('0x22')]=_0x69cee6[_0x8d17('0x22')];_0x21cc62['rules'][_0xecf818]['on']('end',function(){logger[_0x8d17('0x2a')](_0x8d17('0x42'),_0xecf818);stopRouting(_0xecf818,_0x314dea,_0x69cee6,_0x21cc62);clearTimeout(_0x3c6878);_0x3c6878=undefined;_0xab85ce['close'](!![]);if(_0x21cc62[_0x8d17('0x43')][_0xecf818]){delete _0x21cc62[_0x8d17('0x43')][_0xecf818];}_0x570aa0['stop']();});_0x21cc62['rules'][_0xecf818]['on'](_0x8d17('0x44'),function(){if(_0x21cc62[_0x8d17('0x43')][_0xecf818]){delete _0x21cc62[_0x8d17('0x43')][_0xecf818];}});_0x3c6878=setTimeout(function(){logger[_0x8d17('0x2a')](_0x8d17('0x45'),_0xecf818);endRouting(_0xecf818,_0x314dea,_0x69cee6,_0x21cc62);clearTimeout(_0x3c6878);_0xab85ce[_0x8d17('0x46')](!![]);_0x570aa0[_0x8d17('0x47')]();},_0x3f6c4d);switch(_0x314dea['strategy']){case'rrmemory':strategy[_0x8d17('0x48')](_0xab85ce,_0x314dea,_0x21cc62,_0x69cee6);break;default:strategy[_0x8d17('0x49')](_0xab85ce,_0x314dea,_0x21cc62,_0x69cee6);}}else{logger[_0x8d17('0x2d')](_0x8d17('0x4a'),_0xecf818,_0x136cec[_0x8d17('0x2b')]);_0x570aa0[_0x8d17('0x3e')]();}}}catch(_0x42ed98){console['log'](_0x42ed98);logger[_0x8d17('0x2d')](_0x8d17('0x3c'),_0xecf818,_0x42ed98[_0x8d17('0x4b')]);_0x570aa0[_0x8d17('0x3e')]();}};}; \ No newline at end of file +var _0xbba6=['validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack'];(function(_0x21c8fe,_0x4361af){var _0x503143=function(_0x240ee9){while(--_0x240ee9){_0x21c8fe['push'](_0x21c8fe['shift']());}};_0x503143(++_0x4361af);}(_0xbba6,0x1a4));var _0x6bba=function(_0x322d43,_0xf8cd0c){_0x322d43=_0x322d43-0x0;var _0x58f111=_0xbba6[_0x322d43];return _0x58f111;};'use strict';var schema=require(_0x6bba('0x0'));var _=require(_0x6bba('0x1'));var util=require(_0x6bba('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x6bba('0x3'));var Redis=require(_0x6bba('0x4'));var config=require(_0x6bba('0x5'));var logger=require(_0x6bba('0x6'))(_0x6bba('0x7'));var strategy=require(_0x6bba('0x8'));config[_0x6bba('0x9')]=_[_0x6bba('0xa')](config[_0x6bba('0x9')],{'host':_0x6bba('0xb'),'port':0x18eb});var io=require(_0x6bba('0xc'))(new Redis(config['redis']));var attributes=['id',_0x6bba('0xd'),_0x6bba('0xe'),'queue',_0x6bba('0xf'),_0x6bba('0x10')];function emit(_0x414bdc,_0x2dba5a,_0x27fd59){io['to'](_0x414bdc)[_0x6bba('0x11')](_0x2dba5a,_0x27fd59);}function emitChannelQueueInteraction(_0x58a115,_0x54e770,_0x317fe1,_0x318138,_0x332de4,_0x3ed425,_0x1bd2fb,_0x362997){var _0x41be6b=_[_0x6bba('0x12')](_0x317fe1);_0x41be6b['queue_id']=_0x362997;_0x41be6b[_0x6bba('0x13')]=_0x54e770;_0x41be6b[_0x6bba('0xe')]=_0x318138;_0x41be6b['id']=_0x332de4;if(_0x3ed425){_0x1bd2fb[util[_0x6bba('0x14')](_0x6bba('0x15'),_0x58a115)][_0x332de4]=_[_0x6bba('0x16')](_0x41be6b,attributes);}else{delete _0x1bd2fb[util[_0x6bba('0x14')](_0x6bba('0x15'),_0x58a115)][_0x332de4];}emit(util[_0x6bba('0x14')]('%s:queue:%s',_0x58a115,_0x54e770),util[_0x6bba('0x14')](_0x6bba('0x17'),_0x58a115,_0x3ed425?_0x6bba('0x18'):_0x6bba('0x19')),_[_0x6bba('0x16')](_0x41be6b,attributes));}var rpc={'openchannelQueueReport':require(_0x6bba('0x1a')),'mailQueueReport':require(_0x6bba('0x1b')),'chatQueueReport':require(_0x6bba('0x1c')),'smsQueueReport':require(_0x6bba('0x1d')),'faxQueueReport':require(_0x6bba('0x1e')),'whatsappQueueReport':require(_0x6bba('0x1f'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x6bba('0x20')},'timeout':{'type':'number','message':_0x6bba('0x21')}});function startRouting(_0x3d0cdd,_0x1c4f64,_0x56e60a,_0x119cde){if(_0x3d0cdd&&_0x1c4f64&&_0x56e60a){_0x1c4f64[_0x6bba('0x22')]+=0x1;var _0x2f6f32={'uniqueid':_0x3d0cdd,'from':_0x56e60a['body']?_0x56e60a[_0x6bba('0x23')][_0x6bba('0xf')]:'','joinAt':moment()[_0x6bba('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x56e60a['contact']?_0x56e60a[_0x6bba('0x24')]['id']:null,'ListId':_0x56e60a[_0x6bba('0x25')]?_0x56e60a[_0x6bba('0x25')]['id']:null};_0x2f6f32[_[_0x6bba('0x26')](_0x56e60a[_0x6bba('0x27')])+_0x6bba('0x28')]=_0x1c4f64['id']||null;_0x2f6f32[_[_0x6bba('0x26')](_0x56e60a[_0x6bba('0x27')])+_0x6bba('0x29')]=_0x56e60a[_0x6bba('0x2a')]?_0x56e60a[_0x6bba('0x2a')]['id']:null;_0x2f6f32[_[_0x6bba('0x26')](_0x56e60a['channel'])+_0x6bba('0x2b')]=_0x56e60a[_0x6bba('0x2c')]?_0x56e60a[_0x6bba('0x2c')]['id']:null;_0x2f6f32[_[_0x6bba('0x26')](_0x56e60a['channel'])+(_0x56e60a[_0x6bba('0x27')]!==_0x6bba('0x2d')?_0x6bba('0x2e'):_0x6bba('0x2f'))]=_0x56e60a['account']?_0x56e60a[_0x6bba('0xe')]['id']:null;logger[_0x6bba('0x30')](util[_0x6bba('0x14')](_0x6bba('0x31'),_0x3d0cdd,_0x1c4f64['name']));emitChannelQueueInteraction(_0x56e60a[_0x6bba('0x27')],_0x1c4f64[_0x6bba('0x32')],_0x2f6f32,_0x56e60a[_0x6bba('0xe')][_0x6bba('0x32')],_0x56e60a[_0x6bba('0x2c')]['id'],!![],_0x119cde,_0x1c4f64['id']);if(rpc[_0x56e60a[_0x6bba('0x27')]+'QueueReport']){return rpc[_0x56e60a[_0x6bba('0x27')]+'QueueReport'][_0x6bba('0x33')](_0x2f6f32)[_0x6bba('0x34')](function(_0x484a98){logger[_0x6bba('0x35')](_0x6bba('0x36'));});}}}function stopRouting(_0x150bf5,_0x1d0708,_0x55b650,_0x2569de){if(_0x150bf5&&_0x1d0708){_0x1d0708[_0x6bba('0x22')]-=0x1;var _0x4a50d8={'leaveAt':moment()[_0x6bba('0x14')](_0x6bba('0x37')),'acceptAt':moment()['format'](_0x6bba('0x37')),'reason':_0x6bba('0x38')};logger[_0x6bba('0x30')](util[_0x6bba('0x14')](_0x6bba('0x39'),_0x150bf5,_0x1d0708[_0x6bba('0x32')]));emitChannelQueueInteraction(_0x55b650[_0x6bba('0x27')],_0x1d0708['name'],_0x55b650[_0x6bba('0x23')],_0x55b650[_0x6bba('0xe')][_0x6bba('0x32')],_0x55b650[_0x6bba('0x2c')]['id'],![],_0x2569de,_0x1d0708['id']);if(rpc[_0x55b650[_0x6bba('0x27')]+_0x6bba('0x3a')]){return rpc[_0x55b650[_0x6bba('0x27')]+'QueueReport'][_0x6bba('0x3b')](_0x150bf5,_0x4a50d8)['catch'](function(_0xb36d84){logger[_0x6bba('0x35')](_0x6bba('0x3c'));});}}}function endRouting(_0x17f9f8,_0x19e74d,_0x261b9b,_0x3fb45c){if(_0x17f9f8&&_0x19e74d){_0x19e74d['waiting']-=0x1;var _0x36c17e={'leaveAt':moment()[_0x6bba('0x14')](_0x6bba('0x37')),'exitAt':moment()[_0x6bba('0x14')](_0x6bba('0x37')),'reason':_0x6bba('0x3d')};logger[_0x6bba('0x30')](util[_0x6bba('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x17f9f8,_0x19e74d[_0x6bba('0x32')]));emitChannelQueueInteraction(_0x261b9b[_0x6bba('0x27')],_0x19e74d['name'],_0x261b9b[_0x6bba('0x23')],_0x261b9b[_0x6bba('0xe')]['name'],_0x261b9b[_0x6bba('0x2c')]['id'],![],_0x3fb45c);if(rpc[_0x261b9b[_0x6bba('0x27')]+_0x6bba('0x3a')]){return rpc[_0x261b9b['channel']+_0x6bba('0x3a')][_0x6bba('0x3b')](_0x17f9f8,_0x36c17e)[_0x6bba('0x34')](function(_0x41cb4e){logger[_0x6bba('0x35')](_0x6bba('0x3c'));});}}}function handleFindQueue(_0xa8e4c4){return function(_0x31dd87){return _0x31dd87[_0x6bba('0x32')][_0x6bba('0x3e')]()===_0xa8e4c4[_0x6bba('0x3e')]();};}exports[_0x6bba('0x3f')]=function(_0x3b4d97,_0x32bc30,_0x55f369,_0x8eba80){return function(_0x95cbbe){try{var _0x28881b={'name':_0x32bc30[0x0],'timeout':_0x32bc30[0x1]};var _0x27b2b7=queue[_0x6bba('0x0')](_0x28881b,{'typecast':!![]});if(_0x27b2b7[_0x6bba('0x40')]){logger[_0x6bba('0x35')](_0x6bba('0x41'),_0x3b4d97,_[_0x6bba('0x42')](_0x27b2b7,_0x6bba('0x2c'))[_0x6bba('0x43')](',\x20'));_0x95cbbe[_0x6bba('0x44')]();}else{var _0x113eec=_[_0x6bba('0x45')](_0x55f369[_0x8eba80[_0x6bba('0x27')]+_0x6bba('0x46')],handleFindQueue(_0x28881b[_0x6bba('0x32')]));if(_0x113eec){startRouting(_0x3b4d97,_0x113eec,_0x8eba80,_0x55f369);var _0x5bbbe5=(_0x113eec['timeout']||0xa)*0x3e8;var _0x1e2597=(_0x28881b[_0x6bba('0x3d')]||0x14)*0x3e8;var _0x8a075,_0x54fe39;if(_0x5bbbe5>_0x1e2597){_0x1e2597=_0x5bbbe5;}var _0x229e6d=seqqueue['createQueue'](_0x5bbbe5);_0x229e6d['id']=_0x3b4d97;_0x229e6d[_0x6bba('0x47')]=_0x5bbbe5;_0x229e6d[_0x6bba('0x48')]=_0x1e2597;_0x229e6d['channel']=_0x8eba80[_0x6bba('0x27')];_0x55f369[_0x6bba('0x49')][_0x3b4d97]['on'](_0x6bba('0x4a'),function(){logger[_0x6bba('0x30')](_0x6bba('0x4b'),_0x3b4d97);stopRouting(_0x3b4d97,_0x113eec,_0x8eba80,_0x55f369);clearTimeout(_0x8a075);_0x8a075=undefined;_0x229e6d[_0x6bba('0x4c')](!![]);if(_0x55f369['rules'][_0x3b4d97]){delete _0x55f369['rules'][_0x3b4d97];}_0x95cbbe[_0x6bba('0x44')]();});_0x55f369[_0x6bba('0x49')][_0x3b4d97]['on'](_0x6bba('0x4d'),function(){if(_0x55f369[_0x6bba('0x49')][_0x3b4d97]){delete _0x55f369[_0x6bba('0x49')][_0x3b4d97];}});_0x8a075=setTimeout(function(){logger[_0x6bba('0x30')](_0x6bba('0x4e'),_0x3b4d97);endRouting(_0x3b4d97,_0x113eec,_0x8eba80,_0x55f369);clearTimeout(_0x8a075);_0x229e6d[_0x6bba('0x4c')](!![]);_0x95cbbe[_0x6bba('0x4f')]();},_0x1e2597);switch(_0x113eec['strategy']){case _0x6bba('0x50'):strategy[_0x6bba('0x50')](_0x229e6d,_0x113eec,_0x55f369,_0x8eba80);break;default:strategy[_0x6bba('0x51')](_0x229e6d,_0x113eec,_0x55f369,_0x8eba80);}}else{logger[_0x6bba('0x35')](_0x6bba('0x52'),_0x3b4d97,_0x28881b[_0x6bba('0x32')]);_0x95cbbe[_0x6bba('0x44')]();}}}catch(_0x3362c4){console['log'](_0x3362c4);logger['error'](_0x6bba('0x41'),_0x3b4d97,_0x3362c4[_0x6bba('0x53')]);_0x95cbbe['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 bbd47a6..761fd5c 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 _0xf4bf=['squeue','drained','handleDrained','push','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','lodash','uuid','./util','routing','notificationId','agent','realtime','handleTimeout','bind'];(function(_0x1e385e,_0x3bc402){var _0x336c83=function(_0x2a2312){while(--_0x2a2312){_0x1e385e['push'](_0x1e385e['shift']());}};_0x336c83(++_0x3bc402);}(_0xf4bf,0xc2));var _0xff4b=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xf4bf[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0xff4b('0x0'));var uuid=require(_0xff4b('0x1'));var util=require(_0xff4b('0x2'));var logger=require('../../../../../config/logger')(_0xff4b('0x3'));var Agent=function(_0x19fcdc,_0x1d9e9b,_0xba2d5d,_0x3eaf65){this[_0xff4b('0x4')]=uuid['v4']();this['squeue']=_0x19fcdc;this[_0xff4b('0x5')]=_0x1d9e9b;this[_0xff4b('0x6')]=_0xba2d5d;this['routing']=_0x3eaf65;this['squeue']['push'](this['handleRun']['bind'](this),this[_0xff4b('0x7')][_0xff4b('0x8')](this));this[_0xff4b('0x9')]['on']('timeout',this[_0xff4b('0x7')][_0xff4b('0x8')](this));this[_0xff4b('0x9')]['on'](_0xff4b('0xa'),this[_0xff4b('0xb')]['bind'](this));};Agent['prototype'][_0xff4b('0xc')]=function(){this['squeue'][_0xff4b('0xc')](this['handleRun'][_0xff4b('0x8')](this),this[_0xff4b('0x7')][_0xff4b('0x8')](this));};Agent[_0xff4b('0xd')][_0xff4b('0xb')]=function(){this[_0xff4b('0x7')](!![]);};Agent[_0xff4b('0xd')][_0xff4b('0xe')]=function(_0x711a94){logger['info'](_0xff4b('0xf'),this[_0xff4b('0x9')]['id'],this[_0xff4b('0x5')]['id']);if(_[_0xff4b('0x10')](this[_0xff4b('0x6')][_0xff4b('0x11')][this[_0xff4b('0x5')]['id']])){logger[_0xff4b('0x12')](_0xff4b('0x13'),this['squeue']['id'],this[_0xff4b('0x5')]['id']);setTimeout(this[_0xff4b('0xc')][_0xff4b('0x8')](this),0x3e8);}else{if(this[_0xff4b('0x3')][_0xff4b('0x14')]||util['isAgentAvailable'](this[_0xff4b('0x9')]['id'],this[_0xff4b('0x6')][_0xff4b('0x11')][this[_0xff4b('0x5')]['id']],this['squeue']['channel'],![])){this[_0xff4b('0x6')][_0xff4b('0x11')][this['agent']['id']][_0xff4b('0x15')]=!![];this[_0xff4b('0x6')]['agents'][this[_0xff4b('0x5')]['id']][_0xff4b('0x16')]=undefined;util['showNotification'](this[_0xff4b('0x4')],this[_0xff4b('0x9')]['id'],this[_0xff4b('0x6')]['agents'][this['agent']['id']],null,this[_0xff4b('0x3')]);util[_0xff4b('0x17')](this[_0xff4b('0x9')]['id'],this[_0xff4b('0x6')][_0xff4b('0x11')][this[_0xff4b('0x5')]['id']],_0xff4b('0x18')+(this[_0xff4b('0x3')][_0xff4b('0x14')]?':FORCED':''));}else{logger[_0xff4b('0x12')](_0xff4b('0x19'),this['squeue']['id'],this[_0xff4b('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xff4b('0x7')]=function(_0x1b9b7d){if(_[_0xff4b('0x10')](this[_0xff4b('0x6')]['agents'][this[_0xff4b('0x5')]['id']])){return logger[_0xff4b('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xff4b('0x5')]['id']);}else{logger[_0xff4b('0x12')](_0xff4b('0x1a'),this[_0xff4b('0x9')]['id'],this[_0xff4b('0x5')]['id']);util[_0xff4b('0x1b')](this[_0xff4b('0x4')],this['squeue']['id'],this['realtime'][_0xff4b('0x11')][this[_0xff4b('0x5')]['id']],null,this[_0xff4b('0x3')]);this['realtime'][_0xff4b('0x11')][this[_0xff4b('0x5')]['id']][_0xff4b('0x15')]=![];this[_0xff4b('0x6')][_0xff4b('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0xff4b('0x17')](this[_0xff4b('0x9')]['id'],this[_0xff4b('0x6')]['agents'][this[_0xff4b('0x5')]['id']],_0x1b9b7d?'STOP':_0xff4b('0x1c'));}if(!_0x1b9b7d){setTimeout(this[_0xff4b('0xc')][_0xff4b('0x8')](this),0x3e8);}};function agent(_0x6e3905,_0x12ba9d,_0xb34324,_0x39158d){return new Agent(_0x6e3905,_0x12ba9d,_0xb34324,_0x39158d);}module['exports']=agent; \ No newline at end of file +var _0xf8dc=['uuid','./util','../../../../../config/logger','routing','agent','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','lodash'];(function(_0x25bcf8,_0x338caf){var _0x15bb97=function(_0x4bc97f){while(--_0x4bc97f){_0x25bcf8['push'](_0x25bcf8['shift']());}};_0x15bb97(++_0x338caf);}(_0xf8dc,0x10f));var _0xcf8d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf8dc[_0x432682];return _0x463d05;};'use strict';var _=require(_0xcf8d('0x0'));var uuid=require(_0xcf8d('0x1'));var util=require(_0xcf8d('0x2'));var logger=require(_0xcf8d('0x3'))(_0xcf8d('0x4'));var Agent=function(_0x228515,_0x2cc29a,_0x1a4e1f,_0x40e3c5){this['notificationId']=uuid['v4']();this['squeue']=_0x228515;this[_0xcf8d('0x5')]=_0x2cc29a;this[_0xcf8d('0x6')]=_0x1a4e1f;this['routing']=_0x40e3c5;this[_0xcf8d('0x7')][_0xcf8d('0x8')](this[_0xcf8d('0x9')][_0xcf8d('0xa')](this),this[_0xcf8d('0xb')][_0xcf8d('0xa')](this));this[_0xcf8d('0x7')]['on'](_0xcf8d('0xc'),this[_0xcf8d('0xb')]['bind'](this));this[_0xcf8d('0x7')]['on'](_0xcf8d('0xd'),this[_0xcf8d('0xe')]['bind'](this));};Agent['prototype'][_0xcf8d('0x8')]=function(){this[_0xcf8d('0x7')][_0xcf8d('0x8')](this[_0xcf8d('0x9')][_0xcf8d('0xa')](this),this[_0xcf8d('0xb')][_0xcf8d('0xa')](this));};Agent[_0xcf8d('0xf')]['handleDrained']=function(){this[_0xcf8d('0xb')](!![]);};Agent[_0xcf8d('0xf')][_0xcf8d('0x9')]=function(_0x3c0f08){logger[_0xcf8d('0x10')](_0xcf8d('0x11'),this[_0xcf8d('0x7')]['id'],this[_0xcf8d('0x5')]['id']);if(_[_0xcf8d('0x12')](this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']])){logger['info'](_0xcf8d('0x14'),this[_0xcf8d('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xcf8d('0x8')][_0xcf8d('0xa')](this),0x3e8);}else{if(this[_0xcf8d('0x4')][_0xcf8d('0x15')]||util[_0xcf8d('0x16')](this[_0xcf8d('0x7')]['id'],this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']],this[_0xcf8d('0x7')][_0xcf8d('0x17')],![])){this['realtime']['agents'][this[_0xcf8d('0x5')]['id']][_0xcf8d('0x18')]=!![];this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']][_0xcf8d('0x19')]=undefined;util[_0xcf8d('0x1a')](this[_0xcf8d('0x1b')],this[_0xcf8d('0x7')]['id'],this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']],null,this[_0xcf8d('0x4')]);util[_0xcf8d('0x1c')](this['squeue']['id'],this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']],_0xcf8d('0x1d')+(this[_0xcf8d('0x4')][_0xcf8d('0x15')]?_0xcf8d('0x1e'):''));}else{logger[_0xcf8d('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xcf8d('0x7')]['id'],this[_0xcf8d('0x5')]['id']);setTimeout(this['push'][_0xcf8d('0xa')](this),0x3e8);}}};Agent[_0xcf8d('0xf')][_0xcf8d('0xb')]=function(_0x3cbcc6){if(_[_0xcf8d('0x12')](this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']])){return logger[_0xcf8d('0x10')](_0xcf8d('0x14'),this['squeue']['id'],this[_0xcf8d('0x5')]['id']);}else{logger[_0xcf8d('0x10')](_0xcf8d('0x1f'),this[_0xcf8d('0x7')]['id'],this['agent']['id']);util['hideNotification'](this[_0xcf8d('0x1b')],this[_0xcf8d('0x7')]['id'],this[_0xcf8d('0x6')]['agents'][this[_0xcf8d('0x5')]['id']],null,this[_0xcf8d('0x4')]);this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']][_0xcf8d('0x18')]=![];this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0xcf8d('0x6')][_0xcf8d('0x13')][this[_0xcf8d('0x5')]['id']],_0x3cbcc6?_0xcf8d('0x20'):_0xcf8d('0x21'));}if(!_0x3cbcc6){setTimeout(this[_0xcf8d('0x8')][_0xcf8d('0xa')](this),0x3e8);}};function agent(_0x1ce867,_0xacb62a,_0x3de84d,_0x533775){return new Agent(_0x1ce867,_0xacb62a,_0x3de84d,_0x533775);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index c78f733..fbed2b1 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 _0xd493=['TIMEOUT','busy','busyQueue','lodash','./util','../../../../../config/logger','notificationId','realtime','routing','squeue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','info','hideNotification','STOP'];(function(_0x5554e6,_0x46232b){var _0x55d199=function(_0x3c0a75){while(--_0x3c0a75){_0x5554e6['push'](_0x5554e6['shift']());}};_0x55d199(++_0x46232b);}(_0xd493,0x1bd));var _0x3d49=function(_0x1f8998,_0x5bd4d1){_0x1f8998=_0x1f8998-0x0;var _0x5a9317=_0xd493[_0x1f8998];return _0x5a9317;};'use strict';var _=require(_0x3d49('0x0'));var uuid=require('uuid');var util=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))('routing');var Beepall=function(_0x4c751d,_0x4a877d,_0x58dce8,_0x439989){this[_0x3d49('0x3')]=uuid['v4']();this['squeue']=_0x4c751d;this['queue']=_0x4a877d;this[_0x3d49('0x4')]=_0x58dce8;this[_0x3d49('0x5')]=_0x439989;this[_0x3d49('0x6')][_0x3d49('0x7')](this['handleRun'][_0x3d49('0x8')](this),this[_0x3d49('0x9')][_0x3d49('0x8')](this));this[_0x3d49('0x6')]['on'](_0x3d49('0xa'),this[_0x3d49('0x9')][_0x3d49('0x8')](this));this[_0x3d49('0x6')]['on'](_0x3d49('0xb'),this[_0x3d49('0xc')]['bind'](this));};Beepall[_0x3d49('0xd')]['push']=function(){this[_0x3d49('0x6')][_0x3d49('0x7')](this[_0x3d49('0xe')][_0x3d49('0x8')](this),this[_0x3d49('0x9')][_0x3d49('0x8')](this));};Beepall[_0x3d49('0xd')][_0x3d49('0xc')]=function(_0x454bb7){this[_0x3d49('0x9')](!![]);};Beepall[_0x3d49('0xd')][_0x3d49('0xe')]=function(_0x2d41c4){var _0x5d65f3=!![];if(!_[_0x3d49('0xf')](this[_0x3d49('0x10')])&&!_[_0x3d49('0xf')](this[_0x3d49('0x10')][_0x3d49('0x11')])&&this[_0x3d49('0x10')][_0x3d49('0x11')][_0x3d49('0x12')]>0x0){for(var _0x7126d5=0x0,_0x55c868;_0x7126d50x0){for(var _0x5615d2=0x0,_0xf2465e;_0x5615d20x0&&_0x286853[_0x4c2fca+_0x368b('0x29')]>=_0x286853[_0x4c2fca+_0x368b('0x28')]){writeLog(_0xc0f7af,_0x286853,_0x4c2fca[_0x368b('0x2a')]()+_0x368b('0x2b'));return![];}}return!![];};exports[_0x368b('0x2c')]=function(_0x9f192e,_0x39ef94,_0x1e0e46,_0x2b036e,_0xc12627){return sendNotification(!![],_0x9f192e,_0x39ef94,_0x1e0e46,_0x2b036e,_0xc12627);};exports[_0x368b('0x2d')]=function(_0x3c80b5,_0x5db0b4,_0x4af77a,_0x381324,_0x2f1d52){return sendNotification(![],_0x3c80b5,_0x5db0b4,_0x4af77a,_0x381324,_0x2f1d52);};exports[_0x368b('0x2e')]=writeLog; \ No newline at end of file +var _0x2d72=['redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing'];(function(_0x154854,_0x2af4a0){var _0x2d3f87=function(_0x5794f2){while(--_0x5794f2){_0x154854['push'](_0x154854['shift']());}};_0x2d3f87(++_0x2af4a0);}(_0x2d72,0xa8));var _0x22d7=function(_0x16693f,_0x3496ec){_0x16693f=_0x16693f-0x0;var _0x485b1f=_0x2d72[_0x16693f];return _0x485b1f;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var utils=require(_0x22d7('0x2'));var Mustache=require(_0x22d7('0x3'));var Redis=require(_0x22d7('0x4'));var config=require(_0x22d7('0x5'));var logger=require(_0x22d7('0x6'))(_0x22d7('0x7'));config[_0x22d7('0x8')]=_[_0x22d7('0x9')](config[_0x22d7('0x8')],{'host':_0x22d7('0xa'),'port':0x18eb});var io=require(_0x22d7('0xb'))(new Redis(config[_0x22d7('0x8')]));function emit(_0x52a3e3,_0x23a731,_0x3791d6){io['to'](_0x52a3e3)['emit'](_0x23a731,_0x3791d6);}function sendNotification(_0x3b12cd,_0x1abed9,_0x1c6aaf,_0x3c694f,_0x49f7e1,_0x5f56eb){io['to'](util[_0x22d7('0xc')](_0x22d7('0xd'),_0x3c694f[_0x22d7('0xe')]))[_0x22d7('0xf')](_0x22d7('0x10'),_0x3c694f);var _0x4db5dd=_0x5f56eb||{};var _0x47cec1=_0x1c6aaf[_0x22d7('0x11')]('.');var _0x4e1146={'uniqueid':_0x1abed9,'channel':_0x47cec1[0x0],'id':_0x47cec1[0x1],'title':_0x47cec1[0x0]+_0x22d7('0x12'),'interactionId':_0x47cec1[0x2],'queue':_0x49f7e1?_0x49f7e1[_0x22d7('0xe')]:null,'sound':_0x4db5dd['account'][_0x22d7('0x13')],'shake':_0x4db5dd[_0x22d7('0x14')][_0x22d7('0x15')]};try{if(!_0x4db5dd[_0x22d7('0x16')]){_0x4db5dd[_0x22d7('0x16')]={};}if(_0x49f7e1){_0x4db5dd[_0x22d7('0x16')][_0x22d7('0x17')]=_0x49f7e1;}else if(_0x4db5dd[_0x22d7('0x16')]['queue']){delete _0x4db5dd[_0x22d7('0x16')][_0x22d7('0x17')];}_0x4e1146[_0x22d7('0x18')]=utils['getMustacheRender'](_0x4db5dd['account']['notificationTemplate'],_0x4db5dd);}catch(_0x46f63d){_0x4e1146[_0x22d7('0x18')]=_0x22d7('0x19');logger[_0x22d7('0x1a')](util[_0x22d7('0xc')]('[%s][QUEUE]\x20%s',_0x1abed9,_0x46f63d[_0x22d7('0x1b')]));}io['to'](util[_0x22d7('0xc')](_0x22d7('0xd'),_0x3c694f['name']))[_0x22d7('0xf')](util[_0x22d7('0xc')](_0x22d7('0x1c'),_0x3b12cd?_0x22d7('0x1d'):_0x22d7('0x1e')),_0x4e1146);}function writeLog(_0x577400,_0x5e03d5,_0x219f7c){return logger[_0x22d7('0x1f')](util[_0x22d7('0xc')](_0x22d7('0x20'),_0x577400,_0x5e03d5['name'],_0x219f7c));}exports[_0x22d7('0x21')]=function(_0x141220,_0x1b7760,_0x5b6502,_0x459827){if(_0x1b7760['busy']){writeLog(_0x141220,_0x1b7760,_0x22d7('0x22'));return![];}if(!_0x1b7760[_0x22d7('0x23')]){writeLog(_0x141220,_0x1b7760,_0x22d7('0x24'));return![];}if(_0x1b7760[_0x5b6502+'Pause']){writeLog(_0x141220,_0x1b7760,_0x22d7('0x25'));return![];}if(_0x459827&&_0x1b7760['hasOwnProperty'](_0x5b6502+'Capacity')&&_0x1b7760[_0x22d7('0x26')](_0x5b6502+_0x22d7('0x27'))){if(_0x1b7760[_0x5b6502+_0x22d7('0x28')]>0x0&&_0x1b7760[_0x5b6502+_0x22d7('0x27')]>=_0x1b7760[_0x5b6502+_0x22d7('0x28')]){writeLog(_0x141220,_0x1b7760,_0x5b6502['toUpperCase']()+_0x22d7('0x29'));return![];}}return!![];};exports[_0x22d7('0x2a')]=function(_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd){return sendNotification(!![],_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd);};exports[_0x22d7('0x2b')]=function(_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334){return sendNotification(![],_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index fb18fd7..9b40cf0 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 _0xe3f2=['error','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','validate','shelljs','lodash','./utils','routing','string','length'];(function(_0x122dea,_0x459955){var _0xbc6d09=function(_0x40d49a){while(--_0x40d49a){_0x122dea['push'](_0x122dea['shift']());}};_0xbc6d09(++_0x459955);}(_0xe3f2,0x101));var _0x2e3f=function(_0x21ad8e,_0x2e5222){_0x21ad8e=_0x21ad8e-0x0;var _0x10c5ab=_0xe3f2[_0x21ad8e];return _0x10c5ab;};'use strict';var schema=require(_0x2e3f('0x0'));var sh=require(_0x2e3f('0x1'));var _=require(_0x2e3f('0x2'));var utils=require(_0x2e3f('0x3'));var logger=require('../../../../config/logger')(_0x2e3f('0x4'));var system=schema({'command':{'type':_0x2e3f('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x580f88,_0x174208){return function(_0x482a38){try{var _0x19756d={'command':_0x174208[0x0]};var _0x101606=system[_0x2e3f('0x0')](_0x19756d,{'typecast':!![]});if(_0x101606[_0x2e3f('0x6')]){logger[_0x2e3f('0x7')]('[%s][SYSTEM]\x20%s',_0x580f88,_[_0x2e3f('0x8')](_0x101606,_0x2e3f('0x9'))['join'](',\x20'));logger[_0x2e3f('0xa')](_0x2e3f('0xb'),_0x580f88);_0x482a38[_0x2e3f('0xc')]();}else{var _0x201822=this;var _0x2e7854=utils[_0x2e3f('0xd')](_0x174208[0x0],this);logger[_0x2e3f('0xa')](_0x2e3f('0xe'),_0x580f88,_0x2e7854);sh[_0x2e3f('0xf')](_['trim'](_0x2e7854),function(_0x27afaa,_0x3fdbe6){logger[_0x2e3f('0xa')](_0x2e3f('0x10'),_0x580f88,_0x27afaa);if(_0x27afaa==0x0){var _0x2b0721=_0x3fdbe6[_0x2e3f('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x2e3f('0x12')](_0x174208[0x1])||_[_0x2e3f('0x13')](_0x174208[0x1])){logger['info'](_0x2e3f('0x14'),_0x580f88);_0x201822[_0x2e3f('0x15')][_0x174208[0x1]]=_0x2b0721;}else{logger[_0x2e3f('0xa')](_0x2e3f('0x16'),_0x580f88,_0x174208[0x1],_0x2b0721);_0x201822[_0x2e3f('0x15')][_0x174208[0x1]]=_0x2b0721;}}_0x482a38[_0x2e3f('0xc')]();});}}catch(_0x2cd1cb){logger[_0x2e3f('0x7')](_0x2e3f('0x17'),_0x580f88,_['isObject'](_0x2cd1cb)?JSON['stringify'](_0x2cd1cb):_0x2cd1cb);logger[_0x2e3f('0xa')](_0x2e3f('0xb'),_0x580f88);_0x482a38[_0x2e3f('0xc')]();}};}; \ No newline at end of file +var _0x92e1=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x92e1,0xa8));var _0x192e=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x92e1[_0x5ad0d7];return _0xd83bd;};'use strict';var schema=require(_0x192e('0x0'));var sh=require(_0x192e('0x1'));var _=require(_0x192e('0x2'));var utils=require(_0x192e('0x3'));var logger=require('../../../../config/logger')(_0x192e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x192e('0x5')}});exports[_0x192e('0x6')]=function(_0x540fda,_0xe4e31b){return function(_0x56d287){try{var _0x250119={'command':_0xe4e31b[0x0]};var _0x30beda=system[_0x192e('0x0')](_0x250119,{'typecast':!![]});if(_0x30beda['length']){logger[_0x192e('0x7')](_0x192e('0x8'),_0x540fda,_[_0x192e('0x9')](_0x30beda,_0x192e('0xa'))[_0x192e('0xb')](',\x20'));logger[_0x192e('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x540fda);_0x56d287['next']();}else{var _0x9b01e8=this;var _0x458130=utils[_0x192e('0xd')](_0xe4e31b[0x0],this);logger[_0x192e('0xc')](_0x192e('0xe'),_0x540fda,_0x458130);sh['exec'](_[_0x192e('0xf')](_0x458130),function(_0x1a42df,_0x1c9254){logger['info'](_0x192e('0x10'),_0x540fda,_0x1a42df);if(_0x1a42df==0x0){var _0x7683ec=_0x1c9254['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x192e('0x11')](_0xe4e31b[0x1])||_['isEmpty'](_0xe4e31b[0x1])){logger[_0x192e('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x540fda);_0x9b01e8[_0x192e('0x12')][_0xe4e31b[0x1]]=_0x7683ec;}else{logger[_0x192e('0xc')](_0x192e('0x13'),_0x540fda,_0xe4e31b[0x1],_0x7683ec);_0x9b01e8['body'][_0xe4e31b[0x1]]=_0x7683ec;}}_0x56d287[_0x192e('0x14')]();});}}catch(_0x142abd){logger[_0x192e('0x7')](_0x192e('0x8'),_0x540fda,_[_0x192e('0x15')](_0x142abd)?JSON['stringify'](_0x142abd):_0x142abd);logger[_0x192e('0xc')](_0x192e('0x16'),_0x540fda);_0x56d287[_0x192e('0x14')]();}};}; \ 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 60680f6..d6e2291 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 _0x4b79=['finally','isObject','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','info','catch','error','[%s][TAG]\x20%s','stringify'];(function(_0x3e90ec,_0x4781b3){var _0x2d9f68=function(_0x4004f3){while(--_0x4004f3){_0x3e90ec['push'](_0x3e90ec['shift']());}};_0x2d9f68(++_0x4781b3);}(_0x4b79,0xca));var _0x94b7=function(_0xd046da,_0x590cb0){_0xd046da=_0xd046da-0x0;var _0x28f1cb=_0x4b79[_0xd046da];return _0x28f1cb;};'use strict';var schema=require('validate');var _=require(_0x94b7('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x94b7('0x1')),'mailInteraction':require(_0x94b7('0x2')),'faxInteraction':require(_0x94b7('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x94b7('0x4'))('routing');var tag=schema({'tag':{'type':_0x94b7('0x5'),'required':!![],'message':_0x94b7('0x6')}});exports[_0x94b7('0x7')]=function(_0x53ca80,_0xce44e,_0x40dba8,_0x30c65a){return function(_0x1b0e92){try{var _0x4a03f7={'tag':_0xce44e[0x0]};var _0x40ca23=tag[_0x94b7('0x8')](_0x4a03f7,{'typecast':!![]});if(_0x40ca23[_0x94b7('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x53ca80,_['map'](_0x40ca23,_0x94b7('0xa'))[_0x94b7('0xb')](',\x20'));logger['info'](_0x94b7('0xc'),_0x53ca80);_0x1b0e92[_0x94b7('0xd')]();}else{var _0x3ae89e={'ids':[_0xce44e[0x0]]};if(rpc[_0x30c65a[_0x94b7('0xe')]+'Interaction']){rpc[_0x30c65a[_0x94b7('0xe')]+_0x94b7('0xf')]['addTags'](_0x30c65a[_0x94b7('0x10')]['id'],_0x3ae89e)[_0x94b7('0x11')](function(_0x11d393){logger[_0x94b7('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x53ca80,_0xce44e[0x1],_0x30c65a[_0x94b7('0xe')],_0x30c65a['interaction']['id']);})[_0x94b7('0x13')](function(_0x25eba3){logger[_0x94b7('0x14')](_0x94b7('0x15'),_0x53ca80,JSON[_0x94b7('0x16')](_0x25eba3));logger[_0x94b7('0x12')](_0x94b7('0xc'),_0x53ca80);})[_0x94b7('0x17')](function(){_0x1b0e92[_0x94b7('0xd')]();});}}}catch(_0x3e4629){logger[_0x94b7('0x14')]('[%s][TAG]\x20%s',_0x53ca80,_[_0x94b7('0x18')](_0x3e4629)?JSON[_0x94b7('0x16')](_0x3e4629):_0x3e4629);logger[_0x94b7('0x12')](_0x94b7('0xc'),_0x53ca80);_0x1b0e92['next']();}};}; \ No newline at end of file +var _0xf758=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x234577,_0x3b9004){var _0x28fea6=function(_0x59692d){while(--_0x59692d){_0x234577['push'](_0x234577['shift']());}};_0x28fea6(++_0x3b9004);}(_0xf758,0xb8));var _0x8f75=function(_0xee588,_0x368239){_0xee588=_0xee588-0x0;var _0x58dd1a=_0xf758[_0xee588];return _0x58dd1a;};'use strict';var schema=require('validate');var _=require(_0x8f75('0x0'));var rpc={'chatInteraction':require(_0x8f75('0x1')),'openchannelInteraction':require(_0x8f75('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8f75('0x3')),'faxInteraction':require(_0x8f75('0x4')),'whatsappInteraction':require(_0x8f75('0x5'))};var logger=require(_0x8f75('0x6'))(_0x8f75('0x7'));var tag=schema({'tag':{'type':_0x8f75('0x8'),'required':!![],'message':_0x8f75('0x9')}});exports[_0x8f75('0xa')]=function(_0x3884ad,_0x5d4a4d,_0x465da0,_0x18a44c){return function(_0x24dc93){try{var _0x55dccc={'tag':_0x5d4a4d[0x0]};var _0x15f6ee=tag[_0x8f75('0xb')](_0x55dccc,{'typecast':!![]});if(_0x15f6ee[_0x8f75('0xc')]){logger['error'](_0x8f75('0xd'),_0x3884ad,_[_0x8f75('0xe')](_0x15f6ee,'message')['join'](',\x20'));logger[_0x8f75('0xf')](_0x8f75('0x10'),_0x3884ad);_0x24dc93[_0x8f75('0x11')]();}else{var _0xcc0800={'ids':[_0x5d4a4d[0x0]]};if(rpc[_0x18a44c[_0x8f75('0x12')]+_0x8f75('0x13')]){rpc[_0x18a44c[_0x8f75('0x12')]+_0x8f75('0x13')][_0x8f75('0x14')](_0x18a44c[_0x8f75('0x15')]['id'],_0xcc0800)[_0x8f75('0x16')](function(_0x4565ee){logger[_0x8f75('0xf')](_0x8f75('0x17'),_0x3884ad,_0x5d4a4d[0x1],_0x18a44c[_0x8f75('0x12')],_0x18a44c['interaction']['id']);})[_0x8f75('0x18')](function(_0x16f193){logger[_0x8f75('0x19')]('[%s][TAG]\x20%s',_0x3884ad,JSON[_0x8f75('0x1a')](_0x16f193));logger[_0x8f75('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3884ad);})[_0x8f75('0x1b')](function(){_0x24dc93[_0x8f75('0x11')]();});}}}catch(_0x255b84){logger[_0x8f75('0x19')](_0x8f75('0xd'),_0x3884ad,_[_0x8f75('0x1c')](_0x255b84)?JSON[_0x8f75('0x1a')](_0x255b84):_0x255b84);logger[_0x8f75('0xf')](_0x8f75('0x10'),_0x3884ad);_0x24dc93['next']();}};}; \ 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 d3c6be8..b6a40f3 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 _0xc807=['error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','lodash','consequence','replace','\x20-\x20','urlOnRing','title','jsonrpc','2.0','login','push','stringify','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch'];(function(_0x4ad553,_0x586c5a){var _0x136750=function(_0x11dfbc){while(--_0x11dfbc){_0x4ad553['push'](_0x4ad553['shift']());}};_0x136750(++_0x586c5a);}(_0xc807,0x12e));var _0x7c80=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xc807[_0x2f1762];return _0x8ab21;};'use strict';var rp=require(_0x7c80('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x7c80('0x1'));var arr=[];exports[_0x7c80('0x2')]=function(_0x276081,_0x528c15){return function(_0x4224df){var _0x3f1809=_0x528c15[0xa];var _0xd1ec3d=_0x528c15[0xb];var _0x2a62c7=_0x528c15[0xc];var _0x5333f2=_0x528c15[0xd];var _0x495cc9=_0x528c15[0xe];var _0x193022=_0x528c15[0xf][_0x7c80('0x3')](/\n/g,_0x7c80('0x4'));var _0x303f4d=_0x528c15[0x10][_0x7c80('0x3')](/\n/g,'\x20');if(!arr['includes'](_0xd1ec3d)){arr['push'](_0xd1ec3d);var _0x3deb13=_0x528c15[0x3];var _0x42ad02=_0x528c15[0x4];var _0x4385c2=_0x528c15[0x1];var _0x1e0598=_0x528c15[0x0];var _0x3f77b5={};_0x3f77b5['urlOnAnswer']=_0x528c15[0x8]+'?params='+_0x2a62c7+'|'+_0x3f1809+'|'+_0x5333f2+'|'+_0xd1ec3d+'|'+_0x495cc9;_0x3f77b5[_0x7c80('0x5')]=_0x528c15[0x7]+'?params='+_0x2a62c7+'|'+_0x3f1809+'|'+_0x5333f2+'|'+_0xd1ec3d+'|'+_0x495cc9+'|'+_0x193022+'|'+_0x303f4d;_0x3f77b5[_0x7c80('0x6')]=_0x528c15[0x9];var _0x5b1125={};_0x5b1125[_0x7c80('0x7')]=_0x7c80('0x8');_0x5b1125['method']=_0x7c80('0x9');var _0x2aae37=[];_0x2aae37[_0x7c80('0xa')](_0x528c15[0x2]);_0x2aae37[_0x7c80('0xa')](_0x528c15[0x5]);_0x2aae37[_0x7c80('0xa')](_0x528c15[0x6]);_0x5b1125['params']=_0x2aae37;_0x5b1125['id']=0x1;var _0x17ae77=JSON[_0x7c80('0xb')](_0x5b1125);var _0x138964={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3deb13,'headers':{'Content-Type':_0x7c80('0xc')},'body':_0x17ae77};return rp(_0x138964)[_0x7c80('0xd')](function(_0x8e3f01){const _0x10c3a9=JSON[_0x7c80('0xe')](_0x8e3f01);if(!_0x10c3a9[_0x7c80('0xf')]['logged']){throw new Error(_0x7c80('0x10'));}var _0xba22ef=_0xd1ec3d;var _0x589078='channelId='+_0x4385c2+'&serviceId='+_0x1e0598+'&sessionId='+_0xba22ef+_0x7c80('0x11')+JSON['stringify'](_0x3f77b5);var _0x32844f=_0x42ad02+'?'+_0x589078;return rp(_0x32844f);})[_0x7c80('0xd')](function(_0x5ba956){logger[_0x7c80('0x12')](_0x7c80('0x13'),_0x276081,_0x5ba956);_0x4224df[_0x7c80('0x14')]();})[_0x7c80('0x15')](function(_0x4b7a59){logger[_0x7c80('0x16')](_0x7c80('0x17'),_0x276081,_[_0x7c80('0x18')](_0x4b7a59)?JSON[_0x7c80('0xb')](_0x4b7a59):_0x4b7a59);_0x4224df[_0x7c80('0x14')]();});}else{logger['info'](_0x7c80('0x19'),_0x276081);_0x4224df[_0x7c80('0x1a')]();}};}; \ No newline at end of file +var _0x44da=['?params=','urlOnRing','jsonrpc','2.0','method','push','params','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','stringify','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','request-promise','../../../../config/logger','routing','replace','\x20-\x20','includes','urlOnAnswer'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x44da,0x1d9));var _0xa44d=function(_0x234fca,_0xd18415){_0x234fca=_0x234fca-0x0;var _0x501097=_0x44da[_0x234fca];return _0x501097;};'use strict';var rp=require(_0xa44d('0x0'));var logger=require(_0xa44d('0x1'))(_0xa44d('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x39df2f,_0x1f3406){return function(_0x188851){var _0x67ae9d=_0x1f3406[0xa];var _0x39785d=_0x1f3406[0xb];var _0x193123=_0x1f3406[0xc];var _0x329f8b=_0x1f3406[0xd];var _0x2d7dcc=_0x1f3406[0xe];var _0x3a6a04=_0x1f3406[0xf][_0xa44d('0x3')](/\n/g,_0xa44d('0x4'));var _0x2a76d8=_0x1f3406[0x10][_0xa44d('0x3')](/\n/g,'\x20');if(!arr[_0xa44d('0x5')](_0x39785d)){arr['push'](_0x39785d);var _0x3bb3a8=_0x1f3406[0x3];var _0x52772e=_0x1f3406[0x4];var _0x3ee4ea=_0x1f3406[0x1];var _0x538d44=_0x1f3406[0x0];var _0x1b157e={};_0x1b157e[_0xa44d('0x6')]=_0x1f3406[0x8]+_0xa44d('0x7')+_0x193123+'|'+_0x67ae9d+'|'+_0x329f8b+'|'+_0x39785d+'|'+_0x2d7dcc;_0x1b157e[_0xa44d('0x8')]=_0x1f3406[0x7]+_0xa44d('0x7')+_0x193123+'|'+_0x67ae9d+'|'+_0x329f8b+'|'+_0x39785d+'|'+_0x2d7dcc+'|'+_0x3a6a04+'|'+_0x2a76d8;_0x1b157e['title']=_0x1f3406[0x9];var _0x495e03={};_0x495e03[_0xa44d('0x9')]=_0xa44d('0xa');_0x495e03[_0xa44d('0xb')]='login';var _0x10589c=[];_0x10589c[_0xa44d('0xc')](_0x1f3406[0x2]);_0x10589c[_0xa44d('0xc')](_0x1f3406[0x5]);_0x10589c[_0xa44d('0xc')](_0x1f3406[0x6]);_0x495e03[_0xa44d('0xd')]=_0x10589c;_0x495e03['id']=0x1;var _0x50a13f=JSON['stringify'](_0x495e03);var _0x4add1e={'encoding':'utf8','method':_0xa44d('0xe'),'timeout':0x2710,'url':_0x3bb3a8,'headers':{'Content-Type':_0xa44d('0xf')},'body':_0x50a13f};return rp(_0x4add1e)[_0xa44d('0x10')](function(_0x160a3e){const _0x303cce=JSON[_0xa44d('0x11')](_0x160a3e);if(!_0x303cce['result'][_0xa44d('0x12')]){throw new Error(_0xa44d('0x13'));}var _0x528072=_0x39785d;var _0x308b0c='channelId='+_0x3ee4ea+_0xa44d('0x14')+_0x538d44+'&sessionId='+_0x528072+_0xa44d('0x15')+JSON[_0xa44d('0x16')](_0x1b157e);var _0x14f66d=_0x52772e+'?'+_0x308b0c;return rp(_0x14f66d);})[_0xa44d('0x10')](function(_0x2c582e){logger[_0xa44d('0x17')](_0xa44d('0x18'),_0x39df2f,_0x2c582e);_0x188851[_0xa44d('0x19')]();})[_0xa44d('0x1a')](function(_0x5d1cb2){logger[_0xa44d('0x1b')](_0xa44d('0x1c'),_0x39df2f,_[_0xa44d('0x1d')](_0x5d1cb2)?JSON['stringify'](_0x5d1cb2):_0x5d1cb2);_0x188851['stop']();});}else{logger[_0xa44d('0x17')](_0xa44d('0x1e'),_0x39df2f);_0x188851[_0xa44d('0x1f')]();}};}; \ 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 7fd5f46..8539735 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x200135,_0x4715db){var _0x64353d=function(_0x585c6e){while(--_0x585c6e){_0x200135['push'](_0x200135['shift']());}};_0x64353d(++_0x4715db);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4000d2,_0x48c51a){var _0x32698c=function(_0x56f51d){while(--_0x56f51d){_0x4000d2['push'](_0x4000d2['shift']());}};_0x32698c(++_0x48c51a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 4d8efc7..6c6c0c3 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 _0xb688=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','priority','info','on\x20interval','\x20|\x20','error','app','.js','rules','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','UserId','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0xb688,0xcf));var _0x8b68=function(_0x3671b9,_0x4d51a2){_0x3671b9=_0x3671b9-0x0;var _0x25eea0=_0xb688[_0x3671b9];return _0x25eea0;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var fs=require('fs');var jayson=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var uuid=require(_0x8b68('0x4'));var utils=require(_0x8b68('0x5'));var config=require('../../../config/environment');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var rpc={'openchannelQueueReport':require(_0x8b68('0x8')),'mailQueueReport':require(_0x8b68('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8b68('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8b68('0xb'))};var RuleEngine=require(_0x8b68('0xc'));function getId(_0x130892,_0xa5571b,_0x132617){return util[_0x8b68('0xd')](_0x8b68('0xe'),_0x130892,_0xa5571b||0x0,_0x132617||0x0);}function getIntervals(_0x21d944,_0x24e0b0){var _0x2f2e3c=[];if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x10')])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0['IntervalId']])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')])){_0x2f2e3c=_[_0x8b68('0x12')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')],_0x8b68('0x13'));}else if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x13')])){_0x2f2e3c=[_0x24e0b0['interval']];}return _0x2f2e3c;}exports[_0x8b68('0x14')]=function(_0x509033){_0x509033['rules']={};return new BPromise(function(_0x22f75b,_0x1554d6){var _0x27d717={'Start':function(_0x5d3468){var _0x5c8d0e=this;return new Promise(function(_0x23bd52,_0x5c1e44){if(_0x5d3468){try{var _0x136f1b=[];var _0xb44923=getId(_0x5d3468[_0x8b68('0x15')],_0x5d3468[_0x8b68('0x16')]?_0x5d3468['message']['id']:0x0,_0x5d3468[_0x8b68('0x17')]?_0x5d3468[_0x8b68('0x17')]['id']:0x0);if(_0x5d3468['applications']&&_[_0x8b68('0x18')](_0x5d3468[_0x8b68('0x19')])&&_0x5d3468[_0x8b68('0x19')][_0x8b68('0x1a')]){for(var _0x38b7a7=0x0;_0x38b7a7<_0x5d3468['applications'][_0x8b68('0x1a')];_0x38b7a7+=0x1){var _0x4b4b0f=_0x5d3468[_0x8b68('0x19')][_0x38b7a7];if(fs[_0x8b68('0x1b')](path[_0x8b68('0x1c')](__dirname,_0x8b68('0x19'),_0x4b4b0f['app']+'.js'))){var _0x23edc1=[];switch(_0x4b4b0f['app'][_0x8b68('0x1d')]()){case _0x8b68('0x1e'):var _0x13aee5=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');if(_0x5d3468[_0x8b68('0x15')]==='mail'){_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x0]);_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x1]);_0x23edc1['push'](_0x13aee5[_0x8b68('0x22')](0x2,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}else{_0x23edc1['push'](_0x13aee5[0x0]);_0x23edc1['push'](_0x13aee5['slice'](0x1,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}break;case _0x8b68('0x23'):var _0x583476=_0x4b4b0f[_0x8b68('0x1f')]['split'](',');_0x23edc1['push'](_0x583476[0x0]);_0x23edc1[_0x8b68('0x21')](_0x583476[0x1]);_0x23edc1['push'](_0x583476[_0x8b68('0x22')](0x2,_0x583476[_0x8b68('0x1a')])['join'](','));break;case'dialogflowv2':var _0x357635=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x357635[0x0]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x1]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x2]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x3]);_0x23edc1['push'](_0x357635[_0x8b68('0x22')](0x4,_0x357635['length'])[_0x8b68('0x1c')](','));break;case _0x8b68('0x24'):var _0x4c276f=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x0]);_0x23edc1['push'](_0x4c276f[0x1]);_0x23edc1['push'](_0x4c276f[0x2]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x3]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[_0x8b68('0x22')](0x4,_0x4c276f[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));break;case _0x8b68('0x16'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x25'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x26')]);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x27'):var _0x10aca9=utils[_0x8b68('0x28')](_0x5d3468[_0x8b68('0x29')][_0x8b68('0x2a')],_0x5d3468);var _0x120b34=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x120b34[0x0]);_0x23edc1['push'](_0x120b34[0x1]);_0x23edc1['push'](_0x120b34[0x2]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x3]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x4]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x5]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x6]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x7]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x8]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x9]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0xa]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x17')]['id']);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x16')]['id']);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x2b')]);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x17')][_0x8b68('0x2c')]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x2d')][_0x8b68('0x2d')]);_0x23edc1[_0x8b68('0x21')](_0x10aca9);break;default:_0x23edc1=_[_0x8b68('0xf')](_0x4b4b0f[_0x8b68('0x1f')])?[]:_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');}var _0x50a9c6={'id':util[_0x8b68('0xd')](_0x8b68('0x2e'),_0xb44923,_0x4b4b0f['id'],_0x4b4b0f['app']),'condition':require(_0x8b68('0x2f'))[_0x8b68('0x30')](_0xb44923,getIntervals(_0x509033['intervals'],_0x4b4b0f),_0x509033),'consequence':require('./applications/'+_0x4b4b0f['app'])['consequence'](_0xb44923,_0x23edc1,_0x509033,_0x5d3468),'p':_0x4b4b0f[_0x8b68('0x31')]||0x0};logger[_0x8b68('0x32')]('Push\x20new\x20rule',_0x50a9c6['id'],_0x8b68('0x33'),getIntervals(_0x509033['intervals'],_0x4b4b0f)[_0x8b68('0x1c')](_0x8b68('0x34')));_0x136f1b['push'](_0x50a9c6);}else{logger[_0x8b68('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x4b4b0f[_0x8b68('0x36')]+_0x8b68('0x37')));}}_0x509033[_0x8b68('0x38')][_0xb44923]=new RuleEngine(_0x136f1b);_0x509033[_0x8b68('0x38')][_0xb44923]['execute'](_0x5d3468,function(_0x20162a){logger['info'](_0x8b68('0x39'),JSON[_0x8b68('0x3a')](_0x20162a['matchPath']));if(_0x509033[_0x8b68('0x38')][_0xb44923]){_0x509033[_0x8b68('0x38')][_0xb44923][_0x8b68('0x3b')](_0x8b68('0x3c'));}});return _0x23bd52({'code':0xc8,'message':_0x5d3468});}else{logger['info'](_0x8b68('0x3d'));return _0x23bd52({'code':0xc8,'message':_0x5d3468});}}catch(_0x478527){logger[_0x8b68('0x35')](_0x478527[_0x8b68('0x3e')]);return _0x5c1e44(_0x5c8d0e[_0x8b68('0x35')](0x1f4,_0x478527));}}return _0x5c1e44(_0x8b68('0x3f'));});},'AcceptMessage':function(_0x41d9a2){var _0x69fdbe=this;return new Promise(function(_0x29e265,_0x20df07){if(_0x41d9a2[_0x8b68('0x40')]&&_0x41d9a2[_0x8b68('0x40')]['id']){if(_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busyQueue']=undefined;}}if(_0x41d9a2[_0x8b68('0x16')]&&_0x41d9a2['message']['id']){try{var _0x58cf66=getId(_0x41d9a2['channel'],_0x41d9a2[_0x8b68('0x16')]?_0x41d9a2[_0x8b68('0x16')]['id']:0x0,_0x41d9a2[_0x8b68('0x17')]?_0x41d9a2[_0x8b68('0x17')]['id']:0x0);if(_0x509033['rules'][_0x58cf66]){_0x509033['rules'][_0x58cf66][_0x8b68('0x3b')](_0x8b68('0x42'));if(rpc[_0x41d9a2[_0x8b68('0x15')]+'QueueReport']){rpc[_0x41d9a2[_0x8b68('0x15')]+_0x8b68('0x43')]['update'](_0x58cf66,{'UserId':_0x41d9a2[_0x8b68('0x16')][_0x8b68('0x44')]})['catch'](function(_0x18a9ae){logger[_0x8b68('0x35')]('error\x20update\x20queue\x20report');});}}return _0x29e265({'code':0xc8,'message':_0x41d9a2});}catch(_0x3f7f89){logger[_0x8b68('0x35')](_0x3f7f89['stack']);return _0x20df07(_0x69fdbe['error'](0x1f4,_0x3f7f89));}}logger['error'](_0x8b68('0x45'));return _0x20df07(_0x69fdbe[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'RejectMessage':function(_0x3d4b4f){var _0x55aad3=this;return new Promise(function(_0x5a1711,_0x4492fd){if(_0x3d4b4f[_0x8b68('0x40')]&&_0x3d4b4f[_0x8b68('0x40')]['id']){try{if(_0x509033['agents'][_0x3d4b4f[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x3d4b4f[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x3d4b4f['agent']['id']][_0x8b68('0x46')]=undefined;}return _0x5a1711({'code':0xc8,'message':_0x3d4b4f});}catch(_0x3efb0e){logger['error'](_0x3efb0e[_0x8b68('0x3e')]);return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,_0x3efb0e));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x241166){var _0x3f3e43=this;return new Promise(function(_0x32cd05,_0x31a090){if(_0x241166[_0x8b68('0x15')]&&_0x241166[_0x8b68('0x17')]&&_0x241166[_0x8b68('0x17')]['id']){try{var _0x3096b3=getId(_0x241166['channel'],_0x241166[_0x8b68('0x16')]?_0x241166[_0x8b68('0x16')]['id']:0x0,_0x241166[_0x8b68('0x17')]?_0x241166[_0x8b68('0x17')]['id']:0x0);if(_0x509033[_0x8b68('0x38')][_0x3096b3]){_0x509033[_0x8b68('0x38')][_0x3096b3][_0x8b68('0x3b')](_0x8b68('0x42'));}return _0x32cd05({'code':0xc8,'message':_0x241166});}catch(_0x6d63cb){logger[_0x8b68('0x35')](_0x6d63cb[_0x8b68('0x3e')]);return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x6d63cb));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'AgentCapacity':function(_0xf07a90){var _0x3da7b4=this;return new Promise(function(_0xae90f0,_0x1de9ce){if(_0x509033['agents'][_0x8b68('0x47')](_0xf07a90['id'])){for(var _0x51e17b in _0xf07a90['capacity']){if(_0xf07a90[_0x8b68('0x48')]['hasOwnProperty'](_0x51e17b)){if(_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x47')](_0x51e17b+_0x8b68('0x49'))){_0x509033['agents'][_0xf07a90['id']][_0x51e17b+_0x8b68('0x49')]=parseInt(_0xf07a90[_0x8b68('0x48')][_0x51e17b],0xa);}}}_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x4a')]();return _0xae90f0({'code':0xc8,'message':_0x509033[_0x8b68('0x41')][_0xf07a90['id']]});}else{return _0x1de9ce(_0x3da7b4[_0x8b68('0x35')](0x1f4,_0x8b68('0x4b')));}});},'Agents':function(_0x4f0aff){return new Promise(function(_0x586a5e,_0x20aac1){var _0x4224f5=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x41')]);_0x586a5e({'count':_0x4224f5[_0x8b68('0x1a')],'rows':_0x4224f5});});},'ChatQueues':function(_0x37da34){return new Promise(function(_0x2d1519,_0x314f1e){var _0x3bf22b=[];for(var _0x36d47a in _0x509033[_0x8b68('0x4d')]){if(_0x509033[_0x8b68('0x4d')][_0x8b68('0x47')](_0x36d47a)){var _0x195f82=_0x509033[_0x8b68('0x4d')][_0x36d47a];var _0x414096={'id':_0x195f82['id'],'available':_0x195f82[_0x8b68('0x4e')],'loggedIn':_0x195f82[_0x8b68('0x4f')],'name':_0x195f82['name'],'paused':_0x195f82['paused'],'waiting':_0x195f82[_0x8b68('0x50')]};_0x3bf22b[_0x8b68('0x21')](_0x414096);}}_0x2d1519({'count':_0x3bf22b['length'],'rows':_0x3bf22b});});},'MailQueues':function(_0x48d57a){return new Promise(function(_0x574aca,_0x39a04e){var _0x3d6c17=[];for(var _0xd5f52e in _0x509033[_0x8b68('0x51')]){if(_0x509033[_0x8b68('0x51')]['hasOwnProperty'](_0xd5f52e)){var _0x1c358b=_0x509033[_0x8b68('0x51')][_0xd5f52e];var _0x5c24f8={'id':_0x1c358b['id'],'available':_0x1c358b[_0x8b68('0x4e')],'loggedIn':_0x1c358b['loggedIn'],'name':_0x1c358b['name'],'paused':_0x1c358b['paused'],'waiting':_0x1c358b[_0x8b68('0x50')]};_0x3d6c17[_0x8b68('0x21')](_0x5c24f8);}}_0x574aca({'count':_0x3d6c17[_0x8b68('0x1a')],'rows':_0x3d6c17});});},'OpenchannelQueues':function(_0x7269fd){return new Promise(function(_0x864b6b,_0x1fc24c){var _0x35b22b=[];for(var _0x34456d in _0x509033[_0x8b68('0x52')]){if(_0x509033[_0x8b68('0x52')]['hasOwnProperty'](_0x34456d)){var _0x3a8d15=_0x509033[_0x8b68('0x52')][_0x34456d];var _0x310ec9={'id':_0x3a8d15['id'],'available':_0x3a8d15['available'],'loggedIn':_0x3a8d15['loggedIn'],'name':_0x3a8d15[_0x8b68('0x53')],'paused':_0x3a8d15[_0x8b68('0x54')],'waiting':_0x3a8d15['waiting']};_0x35b22b[_0x8b68('0x21')](_0x310ec9);}}_0x864b6b({'count':_0x35b22b[_0x8b68('0x1a')],'rows':_0x35b22b});});},'SmsQueues':function(_0x29bff7){return new Promise(function(_0x2c2f6d,_0x50fd2c){var _0x96e526=[];for(var _0x4925a4 in _0x509033['smsQueues']){if(_0x509033[_0x8b68('0x55')]['hasOwnProperty'](_0x4925a4)){var _0xe9550=_0x509033[_0x8b68('0x55')][_0x4925a4];var _0x5e40f4={'id':_0xe9550['id'],'available':_0xe9550[_0x8b68('0x4e')],'loggedIn':_0xe9550[_0x8b68('0x4f')],'name':_0xe9550[_0x8b68('0x53')],'paused':_0xe9550[_0x8b68('0x54')],'waiting':_0xe9550[_0x8b68('0x50')]};_0x96e526['push'](_0x5e40f4);}}_0x2c2f6d({'count':_0x96e526[_0x8b68('0x1a')],'rows':_0x96e526});});},'FaxQueues':function(_0x2e6daf){return new Promise(function(_0xa0ed41,_0x2f87e8){var _0x34c7d8=[];for(var _0x49efb7 in _0x509033['faxQueues']){if(_0x509033[_0x8b68('0x56')]['hasOwnProperty'](_0x49efb7)){var _0x2d442a=_0x509033[_0x8b68('0x56')][_0x49efb7];var _0x16e769={'id':_0x2d442a['id'],'available':_0x2d442a[_0x8b68('0x4e')],'loggedIn':_0x2d442a[_0x8b68('0x4f')],'name':_0x2d442a[_0x8b68('0x53')],'paused':_0x2d442a[_0x8b68('0x54')],'waiting':_0x2d442a['waiting']};_0x34c7d8[_0x8b68('0x21')](_0x16e769);}}_0xa0ed41({'count':_0x34c7d8['length'],'rows':_0x34c7d8});});},'WhatsappQueues':function(_0x3aaaed){return new Promise(function(_0x2caa28,_0xc8c3c){var _0x4e0fb4=[];for(var _0x3141d3 in _0x509033['whatsappQueues']){if(_0x509033[_0x8b68('0x57')]['hasOwnProperty'](_0x3141d3)){var _0x3da555=_0x509033[_0x8b68('0x57')][_0x3141d3];var _0x644d83={'id':_0x3da555['id'],'available':_0x3da555['available'],'loggedIn':_0x3da555[_0x8b68('0x4f')],'name':_0x3da555[_0x8b68('0x53')],'paused':_0x3da555[_0x8b68('0x54')],'waiting':_0x3da555[_0x8b68('0x50')]};_0x4e0fb4[_0x8b68('0x21')](_0x644d83);}}_0x2caa28({'count':_0x4e0fb4[_0x8b68('0x1a')],'rows':_0x4e0fb4});});},'ChatQueuesWaitingInteractions':function(_0x33a02f){return new Promise(function(_0x3ae1f8,_0x395b82){var _0x5a807b=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x58')]);_0x3ae1f8({'count':_0x5a807b[_0x8b68('0x1a')],'rows':_0x5a807b});});},'MailQueuesWaitingInteractions':function(_0x1e4c28){return new Promise(function(_0x71095b,_0x543468){var _0x3dfd43=_['values'](_0x509033[_0x8b68('0x59')]);_0x71095b({'count':_0x3dfd43[_0x8b68('0x1a')],'rows':_0x3dfd43});});},'OpenchannelQueuesWaitingInteractions':function(_0x524763){return new Promise(function(_0x20c8b4,_0x75af51){var _0xa7890f=_['values'](_0x509033[_0x8b68('0x5a')]);_0x20c8b4({'count':_0xa7890f[_0x8b68('0x1a')],'rows':_0xa7890f});});},'SmsQueuesWaitingInteractions':function(_0x43a874){return new Promise(function(_0x3b260a,_0x115cb7){var _0x42464c=_['values'](_0x509033[_0x8b68('0x5b')]);_0x3b260a({'count':_0x42464c[_0x8b68('0x1a')],'rows':_0x42464c});});},'FaxQueuesWaitingInteractions':function(_0x3d38eb){return new Promise(function(_0x4e5d13,_0x45e75f){var _0xde4083=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5c')]);_0x4e5d13({'count':_0xde4083[_0x8b68('0x1a')],'rows':_0xde4083});});},'WhatsappQueuesWaitingInteractions':function(_0x377045){return new Promise(function(_0x320f42,_0x4e49ec){var _0x23cc54=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5d')]);_0x320f42({'count':_0x23cc54['length'],'rows':_0x23cc54});});}};var _0x570629=jayson[_0x8b68('0x5e')](_0x27d717)[_0x8b68('0x5f')]();_0x570629['on'](_0x8b68('0x35'),function(_0x131a30){logger[_0x8b68('0x35')](JSON['stringify'](_0x131a30));return _0x1554d6(_0x131a30);});_0x570629[_0x8b68('0x14')](0x232c,_0x8b68('0x60'),function(){console[_0x8b68('0x61')](_0x8b68('0x62'),0x232c);return _0x22f75b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xb688=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','priority','info','on\x20interval','\x20|\x20','error','app','.js','rules','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','UserId','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0xb688,0xcf));var _0x8b68=function(_0x58e6f6,_0x5c0a2e){_0x58e6f6=_0x58e6f6-0x0;var _0x119874=_0xb688[_0x58e6f6];return _0x119874;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var fs=require('fs');var jayson=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var uuid=require(_0x8b68('0x4'));var utils=require(_0x8b68('0x5'));var config=require('../../../config/environment');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var rpc={'openchannelQueueReport':require(_0x8b68('0x8')),'mailQueueReport':require(_0x8b68('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8b68('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8b68('0xb'))};var RuleEngine=require(_0x8b68('0xc'));function getId(_0x130892,_0xa5571b,_0x132617){return util[_0x8b68('0xd')](_0x8b68('0xe'),_0x130892,_0xa5571b||0x0,_0x132617||0x0);}function getIntervals(_0x21d944,_0x24e0b0){var _0x2f2e3c=[];if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x10')])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0['IntervalId']])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')])){_0x2f2e3c=_[_0x8b68('0x12')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')],_0x8b68('0x13'));}else if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x13')])){_0x2f2e3c=[_0x24e0b0['interval']];}return _0x2f2e3c;}exports[_0x8b68('0x14')]=function(_0x509033){_0x509033['rules']={};return new BPromise(function(_0x22f75b,_0x1554d6){var _0x27d717={'Start':function(_0x5d3468){var _0x5c8d0e=this;return new Promise(function(_0x23bd52,_0x5c1e44){if(_0x5d3468){try{var _0x136f1b=[];var _0xb44923=getId(_0x5d3468[_0x8b68('0x15')],_0x5d3468[_0x8b68('0x16')]?_0x5d3468['message']['id']:0x0,_0x5d3468[_0x8b68('0x17')]?_0x5d3468[_0x8b68('0x17')]['id']:0x0);if(_0x5d3468['applications']&&_[_0x8b68('0x18')](_0x5d3468[_0x8b68('0x19')])&&_0x5d3468[_0x8b68('0x19')][_0x8b68('0x1a')]){for(var _0x38b7a7=0x0;_0x38b7a7<_0x5d3468['applications'][_0x8b68('0x1a')];_0x38b7a7+=0x1){var _0x4b4b0f=_0x5d3468[_0x8b68('0x19')][_0x38b7a7];if(fs[_0x8b68('0x1b')](path[_0x8b68('0x1c')](__dirname,_0x8b68('0x19'),_0x4b4b0f['app']+'.js'))){var _0x23edc1=[];switch(_0x4b4b0f['app'][_0x8b68('0x1d')]()){case _0x8b68('0x1e'):var _0x13aee5=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');if(_0x5d3468[_0x8b68('0x15')]==='mail'){_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x0]);_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x1]);_0x23edc1['push'](_0x13aee5[_0x8b68('0x22')](0x2,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}else{_0x23edc1['push'](_0x13aee5[0x0]);_0x23edc1['push'](_0x13aee5['slice'](0x1,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}break;case _0x8b68('0x23'):var _0x583476=_0x4b4b0f[_0x8b68('0x1f')]['split'](',');_0x23edc1['push'](_0x583476[0x0]);_0x23edc1[_0x8b68('0x21')](_0x583476[0x1]);_0x23edc1['push'](_0x583476[_0x8b68('0x22')](0x2,_0x583476[_0x8b68('0x1a')])['join'](','));break;case'dialogflowv2':var _0x357635=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x357635[0x0]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x1]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x2]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x3]);_0x23edc1['push'](_0x357635[_0x8b68('0x22')](0x4,_0x357635['length'])[_0x8b68('0x1c')](','));break;case _0x8b68('0x24'):var _0x4c276f=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x0]);_0x23edc1['push'](_0x4c276f[0x1]);_0x23edc1['push'](_0x4c276f[0x2]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x3]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[_0x8b68('0x22')](0x4,_0x4c276f[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));break;case _0x8b68('0x16'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x25'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x26')]);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x27'):var _0x10aca9=utils[_0x8b68('0x28')](_0x5d3468[_0x8b68('0x29')][_0x8b68('0x2a')],_0x5d3468);var _0x120b34=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x120b34[0x0]);_0x23edc1['push'](_0x120b34[0x1]);_0x23edc1['push'](_0x120b34[0x2]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x3]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x4]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x5]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x6]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x7]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x8]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x9]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0xa]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x17')]['id']);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x16')]['id']);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x2b')]);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x17')][_0x8b68('0x2c')]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x2d')][_0x8b68('0x2d')]);_0x23edc1[_0x8b68('0x21')](_0x10aca9);break;default:_0x23edc1=_[_0x8b68('0xf')](_0x4b4b0f[_0x8b68('0x1f')])?[]:_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');}var _0x50a9c6={'id':util[_0x8b68('0xd')](_0x8b68('0x2e'),_0xb44923,_0x4b4b0f['id'],_0x4b4b0f['app']),'condition':require(_0x8b68('0x2f'))[_0x8b68('0x30')](_0xb44923,getIntervals(_0x509033['intervals'],_0x4b4b0f),_0x509033),'consequence':require('./applications/'+_0x4b4b0f['app'])['consequence'](_0xb44923,_0x23edc1,_0x509033,_0x5d3468),'p':_0x4b4b0f[_0x8b68('0x31')]||0x0};logger[_0x8b68('0x32')]('Push\x20new\x20rule',_0x50a9c6['id'],_0x8b68('0x33'),getIntervals(_0x509033['intervals'],_0x4b4b0f)[_0x8b68('0x1c')](_0x8b68('0x34')));_0x136f1b['push'](_0x50a9c6);}else{logger[_0x8b68('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x4b4b0f[_0x8b68('0x36')]+_0x8b68('0x37')));}}_0x509033[_0x8b68('0x38')][_0xb44923]=new RuleEngine(_0x136f1b);_0x509033[_0x8b68('0x38')][_0xb44923]['execute'](_0x5d3468,function(_0x20162a){logger['info'](_0x8b68('0x39'),JSON[_0x8b68('0x3a')](_0x20162a['matchPath']));if(_0x509033[_0x8b68('0x38')][_0xb44923]){_0x509033[_0x8b68('0x38')][_0xb44923][_0x8b68('0x3b')](_0x8b68('0x3c'));}});return _0x23bd52({'code':0xc8,'message':_0x5d3468});}else{logger['info'](_0x8b68('0x3d'));return _0x23bd52({'code':0xc8,'message':_0x5d3468});}}catch(_0x478527){logger[_0x8b68('0x35')](_0x478527[_0x8b68('0x3e')]);return _0x5c1e44(_0x5c8d0e[_0x8b68('0x35')](0x1f4,_0x478527));}}return _0x5c1e44(_0x8b68('0x3f'));});},'AcceptMessage':function(_0x41d9a2){var _0x69fdbe=this;return new Promise(function(_0x29e265,_0x20df07){if(_0x41d9a2[_0x8b68('0x40')]&&_0x41d9a2[_0x8b68('0x40')]['id']){if(_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busyQueue']=undefined;}}if(_0x41d9a2[_0x8b68('0x16')]&&_0x41d9a2['message']['id']){try{var _0x58cf66=getId(_0x41d9a2['channel'],_0x41d9a2[_0x8b68('0x16')]?_0x41d9a2[_0x8b68('0x16')]['id']:0x0,_0x41d9a2[_0x8b68('0x17')]?_0x41d9a2[_0x8b68('0x17')]['id']:0x0);if(_0x509033['rules'][_0x58cf66]){_0x509033['rules'][_0x58cf66][_0x8b68('0x3b')](_0x8b68('0x42'));if(rpc[_0x41d9a2[_0x8b68('0x15')]+'QueueReport']){rpc[_0x41d9a2[_0x8b68('0x15')]+_0x8b68('0x43')]['update'](_0x58cf66,{'UserId':_0x41d9a2[_0x8b68('0x16')][_0x8b68('0x44')]})['catch'](function(_0x18a9ae){logger[_0x8b68('0x35')]('error\x20update\x20queue\x20report');});}}return _0x29e265({'code':0xc8,'message':_0x41d9a2});}catch(_0x3f7f89){logger[_0x8b68('0x35')](_0x3f7f89['stack']);return _0x20df07(_0x69fdbe['error'](0x1f4,_0x3f7f89));}}logger['error'](_0x8b68('0x45'));return _0x20df07(_0x69fdbe[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'RejectMessage':function(_0x3d4b4f){var _0x55aad3=this;return new Promise(function(_0x5a1711,_0x4492fd){if(_0x3d4b4f[_0x8b68('0x40')]&&_0x3d4b4f[_0x8b68('0x40')]['id']){try{if(_0x509033['agents'][_0x3d4b4f[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x3d4b4f[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x3d4b4f['agent']['id']][_0x8b68('0x46')]=undefined;}return _0x5a1711({'code':0xc8,'message':_0x3d4b4f});}catch(_0x3efb0e){logger['error'](_0x3efb0e[_0x8b68('0x3e')]);return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,_0x3efb0e));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x241166){var _0x3f3e43=this;return new Promise(function(_0x32cd05,_0x31a090){if(_0x241166[_0x8b68('0x15')]&&_0x241166[_0x8b68('0x17')]&&_0x241166[_0x8b68('0x17')]['id']){try{var _0x3096b3=getId(_0x241166['channel'],_0x241166[_0x8b68('0x16')]?_0x241166[_0x8b68('0x16')]['id']:0x0,_0x241166[_0x8b68('0x17')]?_0x241166[_0x8b68('0x17')]['id']:0x0);if(_0x509033[_0x8b68('0x38')][_0x3096b3]){_0x509033[_0x8b68('0x38')][_0x3096b3][_0x8b68('0x3b')](_0x8b68('0x42'));}return _0x32cd05({'code':0xc8,'message':_0x241166});}catch(_0x6d63cb){logger[_0x8b68('0x35')](_0x6d63cb[_0x8b68('0x3e')]);return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x6d63cb));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'AgentCapacity':function(_0xf07a90){var _0x3da7b4=this;return new Promise(function(_0xae90f0,_0x1de9ce){if(_0x509033['agents'][_0x8b68('0x47')](_0xf07a90['id'])){for(var _0x51e17b in _0xf07a90['capacity']){if(_0xf07a90[_0x8b68('0x48')]['hasOwnProperty'](_0x51e17b)){if(_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x47')](_0x51e17b+_0x8b68('0x49'))){_0x509033['agents'][_0xf07a90['id']][_0x51e17b+_0x8b68('0x49')]=parseInt(_0xf07a90[_0x8b68('0x48')][_0x51e17b],0xa);}}}_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x4a')]();return _0xae90f0({'code':0xc8,'message':_0x509033[_0x8b68('0x41')][_0xf07a90['id']]});}else{return _0x1de9ce(_0x3da7b4[_0x8b68('0x35')](0x1f4,_0x8b68('0x4b')));}});},'Agents':function(_0x4f0aff){return new Promise(function(_0x586a5e,_0x20aac1){var _0x4224f5=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x41')]);_0x586a5e({'count':_0x4224f5[_0x8b68('0x1a')],'rows':_0x4224f5});});},'ChatQueues':function(_0x37da34){return new Promise(function(_0x2d1519,_0x314f1e){var _0x3bf22b=[];for(var _0x36d47a in _0x509033[_0x8b68('0x4d')]){if(_0x509033[_0x8b68('0x4d')][_0x8b68('0x47')](_0x36d47a)){var _0x195f82=_0x509033[_0x8b68('0x4d')][_0x36d47a];var _0x414096={'id':_0x195f82['id'],'available':_0x195f82[_0x8b68('0x4e')],'loggedIn':_0x195f82[_0x8b68('0x4f')],'name':_0x195f82['name'],'paused':_0x195f82['paused'],'waiting':_0x195f82[_0x8b68('0x50')]};_0x3bf22b[_0x8b68('0x21')](_0x414096);}}_0x2d1519({'count':_0x3bf22b['length'],'rows':_0x3bf22b});});},'MailQueues':function(_0x48d57a){return new Promise(function(_0x574aca,_0x39a04e){var _0x3d6c17=[];for(var _0xd5f52e in _0x509033[_0x8b68('0x51')]){if(_0x509033[_0x8b68('0x51')]['hasOwnProperty'](_0xd5f52e)){var _0x1c358b=_0x509033[_0x8b68('0x51')][_0xd5f52e];var _0x5c24f8={'id':_0x1c358b['id'],'available':_0x1c358b[_0x8b68('0x4e')],'loggedIn':_0x1c358b['loggedIn'],'name':_0x1c358b['name'],'paused':_0x1c358b['paused'],'waiting':_0x1c358b[_0x8b68('0x50')]};_0x3d6c17[_0x8b68('0x21')](_0x5c24f8);}}_0x574aca({'count':_0x3d6c17[_0x8b68('0x1a')],'rows':_0x3d6c17});});},'OpenchannelQueues':function(_0x7269fd){return new Promise(function(_0x864b6b,_0x1fc24c){var _0x35b22b=[];for(var _0x34456d in _0x509033[_0x8b68('0x52')]){if(_0x509033[_0x8b68('0x52')]['hasOwnProperty'](_0x34456d)){var _0x3a8d15=_0x509033[_0x8b68('0x52')][_0x34456d];var _0x310ec9={'id':_0x3a8d15['id'],'available':_0x3a8d15['available'],'loggedIn':_0x3a8d15['loggedIn'],'name':_0x3a8d15[_0x8b68('0x53')],'paused':_0x3a8d15[_0x8b68('0x54')],'waiting':_0x3a8d15['waiting']};_0x35b22b[_0x8b68('0x21')](_0x310ec9);}}_0x864b6b({'count':_0x35b22b[_0x8b68('0x1a')],'rows':_0x35b22b});});},'SmsQueues':function(_0x29bff7){return new Promise(function(_0x2c2f6d,_0x50fd2c){var _0x96e526=[];for(var _0x4925a4 in _0x509033['smsQueues']){if(_0x509033[_0x8b68('0x55')]['hasOwnProperty'](_0x4925a4)){var _0xe9550=_0x509033[_0x8b68('0x55')][_0x4925a4];var _0x5e40f4={'id':_0xe9550['id'],'available':_0xe9550[_0x8b68('0x4e')],'loggedIn':_0xe9550[_0x8b68('0x4f')],'name':_0xe9550[_0x8b68('0x53')],'paused':_0xe9550[_0x8b68('0x54')],'waiting':_0xe9550[_0x8b68('0x50')]};_0x96e526['push'](_0x5e40f4);}}_0x2c2f6d({'count':_0x96e526[_0x8b68('0x1a')],'rows':_0x96e526});});},'FaxQueues':function(_0x2e6daf){return new Promise(function(_0xa0ed41,_0x2f87e8){var _0x34c7d8=[];for(var _0x49efb7 in _0x509033['faxQueues']){if(_0x509033[_0x8b68('0x56')]['hasOwnProperty'](_0x49efb7)){var _0x2d442a=_0x509033[_0x8b68('0x56')][_0x49efb7];var _0x16e769={'id':_0x2d442a['id'],'available':_0x2d442a[_0x8b68('0x4e')],'loggedIn':_0x2d442a[_0x8b68('0x4f')],'name':_0x2d442a[_0x8b68('0x53')],'paused':_0x2d442a[_0x8b68('0x54')],'waiting':_0x2d442a['waiting']};_0x34c7d8[_0x8b68('0x21')](_0x16e769);}}_0xa0ed41({'count':_0x34c7d8['length'],'rows':_0x34c7d8});});},'WhatsappQueues':function(_0x3aaaed){return new Promise(function(_0x2caa28,_0xc8c3c){var _0x4e0fb4=[];for(var _0x3141d3 in _0x509033['whatsappQueues']){if(_0x509033[_0x8b68('0x57')]['hasOwnProperty'](_0x3141d3)){var _0x3da555=_0x509033[_0x8b68('0x57')][_0x3141d3];var _0x644d83={'id':_0x3da555['id'],'available':_0x3da555['available'],'loggedIn':_0x3da555[_0x8b68('0x4f')],'name':_0x3da555[_0x8b68('0x53')],'paused':_0x3da555[_0x8b68('0x54')],'waiting':_0x3da555[_0x8b68('0x50')]};_0x4e0fb4[_0x8b68('0x21')](_0x644d83);}}_0x2caa28({'count':_0x4e0fb4[_0x8b68('0x1a')],'rows':_0x4e0fb4});});},'ChatQueuesWaitingInteractions':function(_0x33a02f){return new Promise(function(_0x3ae1f8,_0x395b82){var _0x5a807b=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x58')]);_0x3ae1f8({'count':_0x5a807b[_0x8b68('0x1a')],'rows':_0x5a807b});});},'MailQueuesWaitingInteractions':function(_0x1e4c28){return new Promise(function(_0x71095b,_0x543468){var _0x3dfd43=_['values'](_0x509033[_0x8b68('0x59')]);_0x71095b({'count':_0x3dfd43[_0x8b68('0x1a')],'rows':_0x3dfd43});});},'OpenchannelQueuesWaitingInteractions':function(_0x524763){return new Promise(function(_0x20c8b4,_0x75af51){var _0xa7890f=_['values'](_0x509033[_0x8b68('0x5a')]);_0x20c8b4({'count':_0xa7890f[_0x8b68('0x1a')],'rows':_0xa7890f});});},'SmsQueuesWaitingInteractions':function(_0x43a874){return new Promise(function(_0x3b260a,_0x115cb7){var _0x42464c=_['values'](_0x509033[_0x8b68('0x5b')]);_0x3b260a({'count':_0x42464c[_0x8b68('0x1a')],'rows':_0x42464c});});},'FaxQueuesWaitingInteractions':function(_0x3d38eb){return new Promise(function(_0x4e5d13,_0x45e75f){var _0xde4083=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5c')]);_0x4e5d13({'count':_0xde4083[_0x8b68('0x1a')],'rows':_0xde4083});});},'WhatsappQueuesWaitingInteractions':function(_0x377045){return new Promise(function(_0x320f42,_0x4e49ec){var _0x23cc54=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5d')]);_0x320f42({'count':_0x23cc54['length'],'rows':_0x23cc54});});}};var _0x570629=jayson[_0x8b68('0x5e')](_0x27d717)[_0x8b68('0x5f')]();_0x570629['on'](_0x8b68('0x35'),function(_0x131a30){logger[_0x8b68('0x35')](JSON['stringify'](_0x131a30));return _0x1554d6(_0x131a30);});_0x570629[_0x8b68('0x14')](0x232c,_0x8b68('0x60'),function(){console[_0x8b68('0x61')](_0x8b68('0x62'),0x232c);return _0x22f75b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9d646c7..a572c1e 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 _0x98b4=['[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20','stop','bluebird','jayson/promise','../../../config/logger','routing','client','http','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','true','[%s][INTERVAL]\x20%s','some'];(function(_0x448a56,_0x3cd4d1){var _0x1ba466=function(_0x39feff){while(--_0x39feff){_0x448a56['push'](_0x448a56['shift']());}};_0x1ba466(++_0x3cd4d1);}(_0x98b4,0x10e));var _0x498b=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x98b4[_0x1ccdf7];return _0x52a0ae;};'use strict';var util=require('util');var BPromise=require(_0x498b('0x0'));var jayson=require(_0x498b('0x1'));var _=require('lodash');var logger=require(_0x498b('0x2'))(_0x498b('0x3'));var client=jayson[_0x498b('0x4')][_0x498b('0x5')]({'port':0x232a});function request(_0x57a77a,_0x395a17){return new BPromise(function(_0x4b6740,_0x5a6846){return client['request'](_0x57a77a,_0x395a17)[_0x498b('0x6')](function(_0x1d7ca5){if(_0x1d7ca5[_0x498b('0x7')]){return _0x5a6846(_0x1d7ca5[_0x498b('0x7')][_0x498b('0x8')]);}else{return _0x4b6740(_0x1d7ca5['result']);}})[_0x498b('0x9')](function(_0x325e4a){return _0x5a6846(_0x325e4a);});});}exports[_0x498b('0xa')]=function(_0x2077ff,_0x581b02,_0x190b79){return function(_0x41dde1){if(_0x190b79['rules']&&!_0x190b79[_0x498b('0xb')][_0x2077ff]){logger[_0x498b('0xc')](_0x498b('0xd'),_0x2077ff);return _0x41dde1['stop']();}var _0x1c2813=[];for(var _0x20ad45=0x0;_0x20ad45<_0x581b02['length'];_0x20ad45+=0x1){_0x1c2813['push'](request(_0x498b('0xe'),{'command':util['format']('iftime\x20%s',_0x581b02[_0x20ad45])})[_0x498b('0x6')](function(_0xe5534b){return _0xe5534b&&_0xe5534b[_0x498b('0x8')]&&_0xe5534b[_0x498b('0x8')]['indexOf'](_0x498b('0xf'))>=0x0?!![]:![];})[_0x498b('0x9')](function(_0x10d21f){logger['error'](_0x498b('0x10'),_0x2077ff,_0x581b02[_0x20ad45]);}));}BPromise['all'](_0x1c2813)[_0x498b('0x6')](function(_0x1a15e3){var _0x53fca7=_[_0x498b('0x11')](_0x1a15e3);logger[_0x498b('0xc')](_0x498b('0x12'),_0x2077ff,_0x581b02['join']('\x20|\x20'),_0x53fca7);_0x41dde1[_0x498b('0x13')](_0x53fca7);})['catch'](function(_0x110f1d){console[_0x498b('0x14')](_0x110f1d);logger[_0x498b('0x7')](_0x498b('0x12'),_0x2077ff,_0x581b02[_0x498b('0x15')](_0x498b('0x16')),_0x110f1d['stack']);_0x41dde1[_0x498b('0x17')]();});};}; \ No newline at end of file +var _0x253a=['Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push'];(function(_0x1e6b81,_0x1eb3ec){var _0x457c87=function(_0x46f35e){while(--_0x46f35e){_0x1e6b81['push'](_0x1e6b81['shift']());}};_0x457c87(++_0x1eb3ec);}(_0x253a,0x71));var _0xa253=function(_0x1e71e8,_0x31aab3){_0x1e71e8=_0x1e71e8-0x0;var _0x2718f8=_0x253a[_0x1e71e8];return _0x2718f8;};'use strict';var util=require(_0xa253('0x0'));var BPromise=require(_0xa253('0x1'));var jayson=require(_0xa253('0x2'));var _=require(_0xa253('0x3'));var logger=require(_0xa253('0x4'))(_0xa253('0x5'));var client=jayson[_0xa253('0x6')]['http']({'port':0x232a});function request(_0x48d1cc,_0x42b98e){return new BPromise(function(_0x3ba544,_0x54d975){return client[_0xa253('0x7')](_0x48d1cc,_0x42b98e)[_0xa253('0x8')](function(_0x2b910b){if(_0x2b910b[_0xa253('0x9')]){return _0x54d975(_0x2b910b[_0xa253('0x9')][_0xa253('0xa')]);}else{return _0x3ba544(_0x2b910b[_0xa253('0xb')]);}})[_0xa253('0xc')](function(_0x5478d6){return _0x54d975(_0x5478d6);});});}exports[_0xa253('0xd')]=function(_0x4ed78a,_0x2f3972,_0x2b643f){return function(_0x48b958){if(_0x2b643f[_0xa253('0xe')]&&!_0x2b643f[_0xa253('0xe')][_0x4ed78a]){logger[_0xa253('0xf')](_0xa253('0x10'),_0x4ed78a);return _0x48b958['stop']();}var _0x338e48=[];for(var _0x45c553=0x0;_0x45c553<_0x2f3972[_0xa253('0x11')];_0x45c553+=0x1){_0x338e48[_0xa253('0x12')](request(_0xa253('0x13'),{'command':util[_0xa253('0x14')](_0xa253('0x15'),_0x2f3972[_0x45c553])})[_0xa253('0x8')](function(_0x5355e0){return _0x5355e0&&_0x5355e0[_0xa253('0xa')]&&_0x5355e0[_0xa253('0xa')][_0xa253('0x16')](_0xa253('0x17'))>=0x0?!![]:![];})[_0xa253('0xc')](function(_0x514d66){logger[_0xa253('0x9')](_0xa253('0x18'),_0x4ed78a,_0x2f3972[_0x45c553]);}));}BPromise[_0xa253('0x19')](_0x338e48)[_0xa253('0x8')](function(_0x4cdbf6){var _0x3a1a4a=_[_0xa253('0x1a')](_0x4cdbf6);logger['info'](_0xa253('0x1b'),_0x4ed78a,_0x2f3972['join'](_0xa253('0x1c')),_0x3a1a4a);_0x48b958[_0xa253('0x1d')](_0x3a1a4a);})[_0xa253('0xc')](function(_0x217fc2){console['log'](_0x217fc2);logger[_0xa253('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x4ed78a,_0x2f3972[_0xa253('0x1e')](_0xa253('0x1c')),_0x217fc2[_0xa253('0x1f')]);_0x48b958[_0xa253('0x20')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 47aacd4..fe482c0 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 _0xfe57=['agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x5bf701,_0x2f215c){var _0x3c6a72=function(_0x3c3d25){while(--_0x3c3d25){_0x5bf701['push'](_0x5bf701['shift']());}};_0x3c6a72(++_0x2f215c);}(_0xfe57,0x195));var _0x7fe5=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xfe57[_0x1385dc];return _0x2f6469;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581f71,_0x3f7dca){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x4'),_0x581f71[_0x7fe5('0x5')],_0x581f71[_0x7fe5('0x6')],_0x581f71[_0x7fe5('0x7')],_0x581f71[_0x7fe5('0x8')],_0x581f71[_0x7fe5('0x9')],_0x581f71[_0x7fe5('0xa')],_0x581f71[_0x7fe5('0xb')],_0x581f71[_0x7fe5('0xc')]));if(_0x581f71[_0x7fe5('0x7')]){utils['getVoiceQueueByName'](_0x581f71[_0x7fe5('0x7')])['then'](function(_0x3564f1){if(_0x3564f1){_0x581f71[_0x7fe5('0xd')]=_0x3564f1['type'];_0x581f71['agentacw']=_0x581f71[_0x7fe5('0xe')]?_0x3564f1[_0x7fe5('0xf')]:![];_0x581f71['acwtime']=_0x581f71[_0x7fe5('0x10')]?_0x3564f1['acwTimeout']:0x0;}utils['request'](_0x7fe5('0x11'),_0x581f71);});}else{utils[_0x7fe5('0x12')](_0x7fe5('0x11'),_0x581f71);}if(_0x3f7dca){delete transfers[_0x581f71[_0x7fe5('0x5')]];}else{delete agents[_0x581f71['destuniqueid']];}}exports[_0x7fe5('0x13')]=function(_0x16bed9){try{utils['debug'](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9[_0x7fe5('0x5')]),_0x16bed9);agents[_0x16bed9[_0x7fe5('0x14')]]=_0x16bed9;agents[_0x16bed9['destuniqueid']][_0x7fe5('0x15')]=utils['now']();agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x16');agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xb')]=null;agents[_0x16bed9[_0x7fe5('0x14')]]['connectedlinename']=null;utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x17'),_0x16bed9[_0x7fe5('0x5')],agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x16bed9[_0x7fe5('0x14')]));}catch(_0x29b0bd){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9['uniqueid']),_0x29b0bd);}};exports[_0x7fe5('0x19')]=function(_0x459c2d){try{if(!_[_0x7fe5('0x1a')](agents[_0x459c2d[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x459c2d);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x1d'),_0x459c2d[_0x7fe5('0x5')],agents[_0x459c2d['destuniqueid']][_0x7fe5('0x8')],_0x459c2d[_0x7fe5('0x14')]));agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswer']=!![];agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswerAt']=utils[_0x7fe5('0x1e')]();agents[_0x459c2d['destuniqueid']][_0x7fe5('0xc')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x20')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]]['holdtime']=_0x459c2d['ringtime']?parseInt(_0x459c2d[_0x7fe5('0x21')])/0x3e8:0x0;agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x22')]=0x0;unanswered[_0x7fe5('0x23')](_0x459c2d['destuniqueid']);}}catch(_0x46f816){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x46f816);}};exports[_0x7fe5('0x24')]=function(_0x1f8572){try{_[_0x7fe5('0x25')](agents,function(_0x5c07f0,_0xe521c6){if(_0x5c07f0[_0x7fe5('0x5')]==_0x1f8572['uniqueid']&&!_[_0x7fe5('0x26')](unanswered,_0x5c07f0[_0x7fe5('0x14')])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x1f8572);utils['info'](util[_0x7fe5('0x3')](_0x7fe5('0x28'),_0x1f8572[_0x7fe5('0x5')],_0x5c07f0[_0x7fe5('0x8')],_0x5c07f0['destuniqueid']));_0x5c07f0[_0x7fe5('0x19')]=!![];_0x5c07f0[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x5c07f0[_0x7fe5('0xc')]=_0x7fe5('0x2a');_0x5c07f0[_0x7fe5('0x20')]='abandoned';_0x5c07f0[_0x7fe5('0x2b')]=_0x1f8572[_0x7fe5('0x2b')];_0x5c07f0[_0x7fe5('0x22')]=0x0;writeDB(_0x5c07f0);}});}catch(_0x39cfe9){utils['error'](util['format'](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x39cfe9);}};exports[_0x7fe5('0x2c')]=function(_0x513680){try{if(agents[_0x513680[_0x7fe5('0x14')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x513680['uniqueid']),_0x513680);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513680[_0x7fe5('0x5')],agents[_0x513680[_0x7fe5('0x14')]]['membername'],_0x513680[_0x7fe5('0x14')]));agents[_0x513680['destuniqueid']]['agentconnectAt']=utils[_0x7fe5('0x1e')]();agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xb')]=_0x513680[_0x7fe5('0xb')];agents[_0x513680[_0x7fe5('0x14')]]['connectedlinename']=_0x513680[_0x7fe5('0x2d')];agents[_0x513680[_0x7fe5('0x14')]]['holdtime']=_0x513680[_0x7fe5('0x21')];agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x2e');_[_0x7fe5('0x25')](agents,function(_0x1c81c8,_0x1a14e3){if(_0x1c81c8['destuniqueid']!=_0x513680['destuniqueid']&&_0x1c81c8[_0x7fe5('0x5')]==_0x513680['uniqueid']){_0x1c81c8[_0x7fe5('0x22')]=0x0;_0x1c81c8[_0x7fe5('0x2b')]=_0x513680['ringtime'];_0x1c81c8[_0x7fe5('0x19')]=!![];_0x1c81c8[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x1c81c8[_0x7fe5('0xc')]=_0x7fe5('0x2f');_0x1c81c8[_0x7fe5('0x20')]=_0x7fe5('0x2f');_0x1c81c8['answeredelsewheredestinationuniqueid']=_0x513680['destuniqueid'];_0x1c81c8[_0x7fe5('0x30')]=_0x513680['membername'];writeDB(_0x1c81c8);}});}}catch(_0xad0b05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x31'),_0x513680['uniqueid']),_0xad0b05);}};exports[_0x7fe5('0xe')]=function(_0x5439bc){try{if(!_['isNil'](agents[_0x5439bc[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x5439bc);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x33'),_0x5439bc['uniqueid'],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x5439bc['destuniqueid']));agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0xe')]=!![];agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x34')]=utils['now']();agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x5439bc['destuniqueid']][_0x7fe5('0x34')],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x36')]);agents[_0x5439bc['destuniqueid']][_0x7fe5('0x20')]=_0x5439bc[_0x7fe5('0x20')];agents[_0x5439bc[_0x7fe5('0x14')]]['lastevent']=_0x7fe5('0x37');writeDB(agents[_0x5439bc[_0x7fe5('0x14')]]);}}catch(_0x1ac93a){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x1ac93a);}};exports[_0x7fe5('0x38')]=function(_0x446f01){try{if(!_[_0x7fe5('0x1a')](agents[_0x446f01[_0x7fe5('0x39')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x446f01['uniqueid']),_0x446f01);utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x3a'),_0x446f01[_0x7fe5('0x5')],agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x8')],agents[_0x446f01[_0x7fe5('0x39')]]['uniqueid']));agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3b')]=!![];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3c')]=_0x7fe5('0x3d');agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3e')]=_0x446f01[_0x7fe5('0x3f')];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x40')]=agents[_0x446f01['transfereruniqueid']][_0x7fe5('0x5')];}}catch(_0x401d05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x41'),_0x446f01[_0x7fe5('0x5')]),_0x401d05);}};exports['attendedtransfer']=function(_0x31a196){try{utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x31a196);if(_0x31a196[_0x7fe5('0x43')]==_0x31a196[_0x7fe5('0x44')]){if(!_['isNil'](agents[_0x31a196[_0x7fe5('0x45')]])){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3b')]=!![];agents[_0x31a196[_0x7fe5('0x45')]]['transfertype']=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x48')];agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x40')]=_0x31a196[_0x7fe5('0x43')];}if(_0x31a196[_0x7fe5('0x49')]&&agents[_0x31a196[_0x7fe5('0x49')]]){agents[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196['transfereeuniqueid']]=_[_0x7fe5('0x4b')](agents[_0x31a196[_0x7fe5('0x49')]]);transfers[_0x31a196[_0x7fe5('0x49')]]['calleridnum']=agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfereeuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x45')]]['calleridname'];transfers[_0x31a196[_0x7fe5('0x49')]]['agentcalledAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x36')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x2b')]=0x0;transfers[_0x31a196['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x31a196[_0x7fe5('0x45')]==_0x31a196[_0x7fe5('0x4d')]){if(!_[_0x7fe5('0x1a')](agents[_0x31a196[_0x7fe5('0x43')]])){utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x43')]]['transfer']=!![];agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3c')]=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x4e')];agents[_0x31a196[_0x7fe5('0x43')]]['transferuniqueid']=_0x31a196[_0x7fe5('0x45')];}if(_0x31a196[_0x7fe5('0x4f')]&&agents[_0x31a196[_0x7fe5('0x4f')]]){agents[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196[_0x7fe5('0x4f')]]=_[_0x7fe5('0x4b')](agents[_0x31a196['transfertargetuniqueid']]);transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0xa')]=agents[_0x31a196['origtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x4c')];transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x15')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x36')]=utils['now']();transfers[_0x31a196[_0x7fe5('0x4f')]]['holdtime']=0x0;transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x2;}}}catch(_0x36ac40){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x36ac40);}};exports[_0x7fe5('0x50')]=function(_0x31404b){try{utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x51'),_0x31404b[_0x7fe5('0x5')]),_0x31404b);if(agents[_0x31404b['uniqueid']]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]==='timeout'){if(_0x31404b[_0x7fe5('0x52')]==='21'){agents[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x53');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x53');}utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]]['reason'],agents[_0x31404b[_0x7fe5('0x5')]]['lastevent']));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);var _0x2e3b94=unanswered['indexOf'](_0x31404b[_0x7fe5('0x5')]);if(_0x2e3b94>-0x1){unanswered[_0x7fe5('0x54')](_0x2e3b94,0x1);}}if(transfers[_0x31404b['uniqueid']]){transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31404b[_0x7fe5('0x5')]]['talktime']=utils[_0x7fe5('0x35')](transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt'],transfers[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);transfers[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x55');transfers[_0x31404b['uniqueid']]['lastevent']=_0x7fe5('0x37');utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],transfers[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(transfers[_0x31404b[_0x7fe5('0x5')]],!![]);}if(agents[_0x31404b[_0x7fe5('0x5')]]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x36')]){agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')]=utils[_0x7fe5('0x1e')]();agents[_0x31404b['uniqueid']][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')],agents[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]=agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x3b')]?_0x7fe5('0x3b'):_0x7fe5('0x55');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x37');utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],agents[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);}}catch(_0x226ada){utils['error'](util['format']('[%s][agents][hangup]',_0x31404b[_0x7fe5('0x5')]),_0x226ada);}}; \ No newline at end of file +var _0x8f59=['transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','format','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]'];(function(_0x4b6ef6,_0x3e8bd5){var _0x21a1c2=function(_0x2ac078){while(--_0x2ac078){_0x4b6ef6['push'](_0x4b6ef6['shift']());}};_0x21a1c2(++_0x3e8bd5);}(_0x8f59,0x11d));var _0x98f5=function(_0x494315,_0x2d42bd){_0x494315=_0x494315-0x0;var _0x49cc18=_0x8f59[_0x494315];return _0x49cc18;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var utils=require(_0x98f5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe809bb,_0x1d9fb3){utils[_0x98f5('0x3')](util['format'](_0x98f5('0x4'),_0xe809bb[_0x98f5('0x5')],_0xe809bb[_0x98f5('0x6')],_0xe809bb[_0x98f5('0x7')],_0xe809bb['membername'],_0xe809bb[_0x98f5('0x8')],_0xe809bb[_0x98f5('0x9')],_0xe809bb[_0x98f5('0xa')],_0xe809bb['lastevent']));if(_0xe809bb['queue']){utils[_0x98f5('0xb')](_0xe809bb[_0x98f5('0x7')])[_0x98f5('0xc')](function(_0x53493e){if(_0x53493e){_0xe809bb[_0x98f5('0xd')]=_0x53493e[_0x98f5('0xd')];_0xe809bb[_0x98f5('0xe')]=_0xe809bb[_0x98f5('0xf')]?_0x53493e['acw']:![];_0xe809bb[_0x98f5('0x10')]=_0xe809bb['agentacw']?_0x53493e['acwTimeout']:0x0;}utils[_0x98f5('0x11')](_0x98f5('0x12'),_0xe809bb);});}else{utils['request'](_0x98f5('0x12'),_0xe809bb);}if(_0x1d9fb3){delete transfers[_0xe809bb[_0x98f5('0x5')]];}else{delete agents[_0xe809bb[_0x98f5('0x13')]];}}exports[_0x98f5('0x14')]=function(_0x3286f7){try{utils[_0x98f5('0x15')](util['format'](_0x98f5('0x16'),_0x3286f7[_0x98f5('0x5')]),_0x3286f7);agents[_0x3286f7['destuniqueid']]=_0x3286f7;agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x17')]=utils[_0x98f5('0x18')]();agents[_0x3286f7['destuniqueid']][_0x98f5('0x19')]=_0x98f5('0x1a');agents[_0x3286f7[_0x98f5('0x13')]]['connectedlinenum']=null;agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x1b')]=null;utils['info'](util[_0x98f5('0x1c')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3286f7[_0x98f5('0x5')],agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x1d')],_0x3286f7[_0x98f5('0x13')]));}catch(_0xd6f409){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x16'),_0x3286f7['uniqueid']),_0xd6f409);}};exports[_0x98f5('0x1f')]=function(_0x191f23){try{if(!_['isNil'](agents[_0x191f23[_0x98f5('0x13')]])){utils[_0x98f5('0x15')](util[_0x98f5('0x1c')](_0x98f5('0x20'),_0x191f23[_0x98f5('0x5')]),_0x191f23);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x191f23[_0x98f5('0x5')],agents[_0x191f23['destuniqueid']][_0x98f5('0x1d')],_0x191f23['destuniqueid']));agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x1f')]=!![];agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x21')]=utils[_0x98f5('0x18')]();agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x19')]='timeout';agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x22')]='timeout';agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x23')]=_0x191f23[_0x98f5('0x24')]?parseInt(_0x191f23[_0x98f5('0x24')])/0x3e8:0x0;agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x25')]=0x0;unanswered[_0x98f5('0x26')](_0x191f23[_0x98f5('0x13')]);}}catch(_0x576c4b){utils['error'](util[_0x98f5('0x1c')](_0x98f5('0x20'),_0x191f23[_0x98f5('0x5')]),_0x576c4b);}};exports[_0x98f5('0x27')]=function(_0x15bf92){try{_[_0x98f5('0x28')](agents,function(_0x5e9d73,_0x29e1f5){if(_0x5e9d73[_0x98f5('0x5')]==_0x15bf92[_0x98f5('0x5')]&&!_[_0x98f5('0x29')](unanswered,_0x5e9d73[_0x98f5('0x13')])){utils[_0x98f5('0x15')](util['format'](_0x98f5('0x2a'),_0x15bf92[_0x98f5('0x5')]),_0x15bf92);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x15bf92[_0x98f5('0x5')],_0x5e9d73[_0x98f5('0x1d')],_0x5e9d73[_0x98f5('0x13')]));_0x5e9d73[_0x98f5('0x1f')]=!![];_0x5e9d73[_0x98f5('0x21')]=utils[_0x98f5('0x18')]();_0x5e9d73[_0x98f5('0x19')]=_0x98f5('0x2b');_0x5e9d73[_0x98f5('0x22')]=_0x98f5('0x2b');_0x5e9d73[_0x98f5('0x23')]=_0x15bf92[_0x98f5('0x23')];_0x5e9d73[_0x98f5('0x25')]=0x0;writeDB(_0x5e9d73);}});}catch(_0xe4a944){utils[_0x98f5('0x1e')](util[_0x98f5('0x1c')](_0x98f5('0x2a'),_0x15bf92[_0x98f5('0x5')]),_0xe4a944);}};exports[_0x98f5('0x2c')]=function(_0x39d935){try{if(agents[_0x39d935['destuniqueid']]){utils[_0x98f5('0x15')](util['format']('[%s][agents][agentconnect]',_0x39d935[_0x98f5('0x5')]),_0x39d935);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x2d'),_0x39d935['uniqueid'],agents[_0x39d935[_0x98f5('0x13')]][_0x98f5('0x1d')],_0x39d935[_0x98f5('0x13')]));agents[_0x39d935['destuniqueid']][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();agents[_0x39d935['destuniqueid']][_0x98f5('0xa')]=_0x39d935[_0x98f5('0xa')];agents[_0x39d935[_0x98f5('0x13')]]['connectedlinename']=_0x39d935[_0x98f5('0x1b')];agents[_0x39d935[_0x98f5('0x13')]][_0x98f5('0x23')]=_0x39d935[_0x98f5('0x24')];agents[_0x39d935[_0x98f5('0x13')]]['lastevent']='connect';_[_0x98f5('0x28')](agents,function(_0x14faf2,_0x33e6e2){if(_0x14faf2[_0x98f5('0x13')]!=_0x39d935[_0x98f5('0x13')]&&_0x14faf2[_0x98f5('0x5')]==_0x39d935['uniqueid']){_0x14faf2['talktime']=0x0;_0x14faf2[_0x98f5('0x23')]=_0x39d935[_0x98f5('0x24')];_0x14faf2[_0x98f5('0x1f')]=!![];_0x14faf2[_0x98f5('0x21')]=utils['now']();_0x14faf2['lastevent']=_0x98f5('0x2f');_0x14faf2[_0x98f5('0x22')]=_0x98f5('0x2f');_0x14faf2[_0x98f5('0x30')]=_0x39d935['destuniqueid'];_0x14faf2['answeredelsewheremembername']=_0x39d935[_0x98f5('0x1d')];writeDB(_0x14faf2);}});}}catch(_0x3a191f){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x31'),_0x39d935['uniqueid']),_0x3a191f);}};exports[_0x98f5('0xf')]=function(_0x4ff7b0){try{if(!_[_0x98f5('0x32')](agents[_0x4ff7b0[_0x98f5('0x13')]])){utils[_0x98f5('0x15')](util['format'](_0x98f5('0x33'),_0x4ff7b0[_0x98f5('0x5')]),_0x4ff7b0);utils['info'](util[_0x98f5('0x1c')](_0x98f5('0x34'),_0x4ff7b0['uniqueid'],agents[_0x4ff7b0[_0x98f5('0x13')]]['membername'],_0x4ff7b0[_0x98f5('0x13')]));agents[_0x4ff7b0[_0x98f5('0x13')]]['agentcomplete']=!![];agents[_0x4ff7b0['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x4ff7b0[_0x98f5('0x13')]]['talktime']=utils[_0x98f5('0x35')](agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x36')],agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x2e')]);agents[_0x4ff7b0[_0x98f5('0x13')]]['reason']=_0x4ff7b0[_0x98f5('0x22')];agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x19')]=_0x98f5('0x37');writeDB(agents[_0x4ff7b0[_0x98f5('0x13')]]);}}catch(_0x459649){utils['error'](util[_0x98f5('0x1c')](_0x98f5('0x33'),_0x4ff7b0[_0x98f5('0x5')]),_0x459649);}};exports[_0x98f5('0x38')]=function(_0x4a0cda){try{if(!_[_0x98f5('0x32')](agents[_0x4a0cda[_0x98f5('0x39')]])){utils[_0x98f5('0x15')](util[_0x98f5('0x1c')](_0x98f5('0x3a'),_0x4a0cda['uniqueid']),_0x4a0cda);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x4a0cda[_0x98f5('0x5')],agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x1d')],agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x5')]));agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x3b')]=!![];agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x3c')]=_0x98f5('0x3d');agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x3e')]=_0x4a0cda[_0x98f5('0x3f')];agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x40')]=agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x5')];}}catch(_0x2e48a1){utils[_0x98f5('0x1e')](util[_0x98f5('0x1c')](_0x98f5('0x3a'),_0x4a0cda[_0x98f5('0x5')]),_0x2e48a1);}};exports[_0x98f5('0x41')]=function(_0x1289a7){try{utils[_0x98f5('0x15')](util['format'](_0x98f5('0x42'),_0x1289a7[_0x98f5('0x43')]),_0x1289a7);if(_0x1289a7[_0x98f5('0x43')]==_0x1289a7[_0x98f5('0x44')]){if(!_[_0x98f5('0x32')](agents[_0x1289a7[_0x98f5('0x45')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x1289a7[_0x98f5('0x43')],agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x1d')]));agents[_0x1289a7[_0x98f5('0x45')]]['transfer']=!![];agents[_0x1289a7[_0x98f5('0x45')]]['transfertype']=_0x98f5('0x46');agents[_0x1289a7['secondtransfereruniqueid']]['transferexten']=_0x1289a7[_0x98f5('0x47')];agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x40')]=_0x1289a7['origtransfereruniqueid'];}if(_0x1289a7['transfereeuniqueid']&&agents[_0x1289a7[_0x98f5('0x48')]]){agents[_0x1289a7[_0x98f5('0x48')]]['agententerreason']=0x1;transfers[_0x1289a7[_0x98f5('0x48')]]=_[_0x98f5('0x49')](agents[_0x1289a7['transfereeuniqueid']]);transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x9')]=agents[_0x1289a7[_0x98f5('0x45')]]['calleridnum'];transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x4a')]=agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x4a')];transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x17')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7['transfereeuniqueid']][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7[_0x98f5('0x48')]]['holdtime']=0x0;transfers[_0x1289a7['transfereeuniqueid']][_0x98f5('0x4b')]=0x2;}}else if(_0x1289a7[_0x98f5('0x45')]==_0x1289a7['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x1289a7['origtransfereruniqueid']])){utils['info'](util[_0x98f5('0x1c')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1289a7[_0x98f5('0x43')],agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x1d')]));agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x3b')]=!![];agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x3c')]=_0x98f5('0x46');agents[_0x1289a7['origtransfereruniqueid']]['transferexten']=_0x1289a7[_0x98f5('0x4c')];agents[_0x1289a7['origtransfereruniqueid']][_0x98f5('0x40')]=_0x1289a7[_0x98f5('0x45')];}if(_0x1289a7[_0x98f5('0x4d')]&&agents[_0x1289a7['transfertargetuniqueid']]){agents[_0x1289a7[_0x98f5('0x4d')]]['agententerreason']=0x1;transfers[_0x1289a7['transfertargetuniqueid']]=_['clone'](agents[_0x1289a7[_0x98f5('0x4d')]]);transfers[_0x1289a7['transfertargetuniqueid']][_0x98f5('0x9')]=agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x9')];transfers[_0x1289a7['transfertargetuniqueid']]['calleridname']=agents[_0x1289a7['origtransfereruniqueid']][_0x98f5('0x4a')];transfers[_0x1289a7[_0x98f5('0x4d')]]['agentcalledAt']=utils['now']();transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x23')]=0x0;transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x4b')]=0x2;}}}catch(_0x1cc6e3){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x42'),_0x1289a7[_0x98f5('0x43')]),_0x1cc6e3);}};exports[_0x98f5('0x4e')]=function(_0xb64efb){try{utils['debug'](util[_0x98f5('0x1c')](_0x98f5('0x4f'),_0xb64efb[_0x98f5('0x5')]),_0xb64efb);if(agents[_0xb64efb['uniqueid']]&&agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]==='timeout'){if(_0xb64efb[_0x98f5('0x50')]==='21'){agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]='rejected';agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]=_0x98f5('0x51');}utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x52'),_0xb64efb[_0x98f5('0x5')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x1d')],agents[_0xb64efb['uniqueid']][_0x98f5('0x22')],agents[_0xb64efb['uniqueid']][_0x98f5('0x19')]));writeDB(agents[_0xb64efb[_0x98f5('0x5')]]);var _0x3bb728=unanswered[_0x98f5('0x53')](_0xb64efb['uniqueid']);if(_0x3bb728>-0x1){unanswered[_0x98f5('0x54')](_0x3bb728,0x1);}}if(transfers[_0xb64efb[_0x98f5('0x5')]]){transfers[_0xb64efb['uniqueid']][_0x98f5('0xf')]=!![];transfers[_0xb64efb['uniqueid']][_0x98f5('0x36')]=utils[_0x98f5('0x18')]();transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x25')]=utils['diffTime'](transfers[_0xb64efb['uniqueid']][_0x98f5('0x36')],transfers[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']);transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]=_0x98f5('0x55');transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]=_0x98f5('0x37');utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x52'),_0xb64efb[_0x98f5('0x5')],transfers[_0xb64efb[_0x98f5('0x5')]]['membername'],transfers[_0xb64efb['uniqueid']][_0x98f5('0x22')],transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]));writeDB(transfers[_0xb64efb['uniqueid']],!![]);}if(agents[_0xb64efb[_0x98f5('0x5')]]&&agents[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']){agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0xf')]=!![];agents[_0xb64efb['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0xb64efb['uniqueid']][_0x98f5('0x25')]=utils[_0x98f5('0x35')](agents[_0xb64efb['uniqueid']][_0x98f5('0x36')],agents[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']);agents[_0xb64efb[_0x98f5('0x5')]]['reason']=agents[_0xb64efb['uniqueid']][_0x98f5('0x3b')]?_0x98f5('0x3b'):_0x98f5('0x55');agents[_0xb64efb[_0x98f5('0x5')]]['lastevent']=_0x98f5('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xb64efb[_0x98f5('0x5')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x1d')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]));writeDB(agents[_0xb64efb[_0x98f5('0x5')]]);}}catch(_0x1a3a76){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x4f'),_0xb64efb[_0x98f5('0x5')]),_0x1a3a76);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1f631b0..cbee629 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 _0x430c=['linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lodash','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug'];(function(_0x18f658,_0x28cc17){var _0x522d40=function(_0x452a99){while(--_0x452a99){_0x18f658['push'](_0x18f658['shift']());}};_0x522d40(++_0x28cc17);}(_0x430c,0x1a1));var _0xc430=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x430c[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0xc430('0x1'));var dispositions=[_0xc430('0x2'),_0xc430('0x3'),'FAILED','NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xc430('0x4'),_0xc430('0x5'),'FAILED',_0xc430('0x3'),'FAILED'];var channels={};function writeDB(_0x212354){var _0x2e51c6;if(transfers[_0xc430('0x6')][_0x212354[_0xc430('0x7')]]){_0x2e51c6=_0x212354[_0xc430('0x7')];_0x212354[_0xc430('0x7')]=transfers[_0xc430('0x6')][_0x212354[_0xc430('0x7')]][_0xc430('0x8')];}utils['info'](util[_0xc430('0x9')](_0xc430('0xa'),_0x212354['uniqueid'],_0x212354[_0xc430('0xb')],_0x212354['queue'],_0x212354[_0xc430('0xc')],_0x212354['interface'],_0x212354[_0xc430('0xd')],_0x212354[_0xc430('0xe')],_0x212354[_0xc430('0xf')]));if(_0x212354[_0xc430('0x10')]){utils[_0xc430('0x11')](_0x212354[_0xc430('0x10')])[_0xc430('0x12')](function(_0x54d851){if(_0x54d851){_0x212354['UserId']=_0x54d851['id'];}utils[_0xc430('0x13')](_0xc430('0x14'),_0x212354);});}else{utils[_0xc430('0x13')](_0xc430('0x14'),_0x212354);}if(channels[_0x212354[_0xc430('0x7')]]){delete channels[_0x212354['uniqueid']];}else if(_0x2e51c6&&channels[_0x2e51c6]){if(!transfers[_0xc430('0x6')][_0x2e51c6]['recording'])delete transfers['blinds'][_0x2e51c6];delete channels[_0x2e51c6];}}exports[_0xc430('0x15')]=function(_0x3d02df){try{utils[_0xc430('0x16')](util['format']('[%s][calls][newchannel]',_0x3d02df[_0xc430('0x7')]),_0x3d02df);if(_0x3d02df['uniqueid']==_0x3d02df[_0xc430('0x17')]&&_0x3d02df['channel']!='OutgoingSpoolFailed'){utils[_0xc430('0x18')](util['format'](_0xc430('0x19'),_0x3d02df[_0xc430('0x7')],_0x3d02df[_0xc430('0x1a')],_0x3d02df[_0xc430('0x1b')]));channels[_0x3d02df[_0xc430('0x7')]]={'uniqueid':_0x3d02df['uniqueid'],'accountcode':_0x3d02df[_0xc430('0x10')],'source':_0x3d02df['calleridnum'],'destination':_0x3d02df['exten'],'destinationcontext':_0x3d02df[_0xc430('0x1a')],'channel':_0x3d02df[_0xc430('0xb')],'starttime':utils[_0xc430('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xc430('0x1d')};}}catch(_0x57d26e){utils[_0xc430('0x1e')](util[_0xc430('0x9')]('[%s][calls][newchannel]',_0x3d02df[_0xc430('0x7')]),_0x57d26e);}};exports[_0xc430('0x1f')]=function(_0x48f67a){try{utils[_0xc430('0x16')](util['format'](_0xc430('0x20'),_0x48f67a['uniqueid']),_0x48f67a);if(!_[_0xc430('0x21')](channels[_0x48f67a[_0xc430('0x7')]])&&_0x48f67a['channelstate']==0x6){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x22'),_0x48f67a[_0xc430('0x7')],_0x48f67a[_0xc430('0x1a')],_0x48f67a['channel']));if(_[_0xc430('0x21')](channels[_0x48f67a[_0xc430('0x7')]][_0xc430('0x23')])){channels[_0x48f67a[_0xc430('0x7')]]['systemanswertime']=utils[_0xc430('0x1c')]();}}else if(!_['isNil'](channels[_0x48f67a[_0xc430('0x17')]])&&_0x48f67a['channelstate']==0x6&&_0x48f67a[_0xc430('0x1a')]!=_0xc430('0x24')){utils[_0xc430('0x18')](util[_0xc430('0x9')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x48f67a[_0xc430('0x7')],_0x48f67a[_0xc430('0x17')],_0x48f67a[_0xc430('0x1a')],_0x48f67a[_0xc430('0xb')]));channels[_0x48f67a['linkedid']][_0xc430('0x10')]=_0x48f67a[_0xc430('0x10')];channels[_0x48f67a['linkedid']][_0xc430('0x25')]=_0x48f67a['channel'];if(_['isNil'](channels[_0x48f67a[_0xc430('0x17')]][_0xc430('0x26')])){channels[_0x48f67a[_0xc430('0x17')]][_0xc430('0x26')]=utils[_0xc430('0x1c')]();}channels[_0x48f67a[_0xc430('0x17')]][_0xc430('0x27')]=dispositions[_[_0xc430('0x28')](_0x48f67a['channelstate'])]||_0xc430('0x4');}}catch(_0x4c7fc8){utils[_0xc430('0x1e')](util[_0xc430('0x9')](_0xc430('0x20'),_0x48f67a[_0xc430('0x7')]),_0x4c7fc8);}};exports['hangup']=function(_0x2848ae){try{if(!_['isNil'](channels[_0x2848ae['uniqueid']])){utils[_0xc430('0x16')](util[_0xc430('0x9')]('[%s][calls][hangup]',_0x2848ae[_0xc430('0x7')]),_0x2848ae);if(_[_0xc430('0x21')](channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x29')])){channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x29')]=_0x2848ae[_0xc430('0x2a')]+'\x20<'+_0x2848ae[_0xc430('0xd')]+'>';}utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x2b'),_0x2848ae[_0xc430('0x7')],channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x29')],_0x2848ae[_0xc430('0x2c')]));channels[_0x2848ae['uniqueid']][_0xc430('0x2d')]=utils[_0xc430('0x1c')]();channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x2e')]=utils['diffTime'](channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x2d')],channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x2f')]);channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x30')]=channels[_0x2848ae['uniqueid']][_0xc430('0x26')]?utils[_0xc430('0x31')](channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x2d')],channels[_0x2848ae[_0xc430('0x7')]][_0xc430('0x26')]):0x0;writeDB(channels[_0x2848ae[_0xc430('0x7')]]);}}catch(_0x2cde1e){utils[_0xc430('0x1e')](util[_0xc430('0x9')](_0xc430('0x32'),_0x2848ae[_0xc430('0x7')]),_0x2cde1e);}};exports[_0xc430('0x33')]=function(_0xa5ef4c){try{if(!_['isNil'](channels[_0xa5ef4c['localtwolinkedid']])){utils['debug'](util[_0xc430('0x9')](_0xc430('0x34'),_0xa5ef4c[_0xc430('0x35')]),_0xa5ef4c);if(channels[_0xa5ef4c[_0xc430('0x36')]][_0xc430('0xb')]==_0xa5ef4c[_0xc430('0x37')]){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x38'),_0xa5ef4c[_0xc430('0x35')],_0xa5ef4c[_0xc430('0x36')],_0xa5ef4c[_0xc430('0x39')]));channels[_0xa5ef4c[_0xc430('0x36')]][_0xc430('0x25')]=_0xa5ef4c[_0xc430('0x39')];channels[_0xa5ef4c[_0xc430('0x36')]]['userfield']=_0xc430('0x3a');}else if(channels[_0xa5ef4c[_0xc430('0x36')]][_0xc430('0xb')]=_0xa5ef4c[_0xc430('0x3b')]){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x38'),_0xa5ef4c[_0xc430('0x35')],_0xa5ef4c['localtwolinkedid'],_0xa5ef4c[_0xc430('0x3c')]));channels[_0xa5ef4c['localtwolinkedid']][_0xc430('0x25')]=_0xa5ef4c[_0xc430('0x3c')];channels[_0xa5ef4c['localtwolinkedid']]['userfield']=_0xc430('0x3a');}}}catch(_0x4986d4){utils['error'](util[_0xc430('0x9')]('[%s][calls][attendedtransfer]',_0xa5ef4c[_0xc430('0x35')]),_0x4986d4);}};exports[_0xc430('0x3d')]=function(_0xe2d510){try{if(!_['isNil'](channels[_0xe2d510[_0xc430('0x7')]])){utils[_0xc430('0x16')](util[_0xc430('0x9')]('[%s][calls][musiconholdstart]',_0xe2d510[_0xc430('0x7')]),_0xe2d510);channels[_0xe2d510[_0xc430('0x7')]][_0xc430('0x3e')]=utils[_0xc430('0x1c')]();utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x3f'),_0xe2d510['uniqueid'],channels[_0xe2d510[_0xc430('0x7')]][_0xc430('0x3e')]));}}catch(_0x2df2f2){utils['error'](util[_0xc430('0x9')](_0xc430('0x40'),_0xe2d510[_0xc430('0x7')]),_0x2df2f2);}};exports[_0xc430('0x41')]=function(_0x5b93e1){try{if(!_[_0xc430('0x21')](channels[_0x5b93e1['uniqueid']])){utils[_0xc430('0x16')](util[_0xc430('0x9')](_0xc430('0x42'),_0x5b93e1[_0xc430('0x7')]),_0x5b93e1);if(!_[_0xc430('0x21')](channels[_0x5b93e1[_0xc430('0x7')]]['musiconholdstartAt'])){channels[_0x5b93e1[_0xc430('0x7')]][_0xc430('0x43')]+=utils['diffTime'](utils[_0xc430('0x1c')](),channels[_0x5b93e1[_0xc430('0x7')]][_0xc430('0x3e')]);utils[_0xc430('0x18')](util['format'](_0xc430('0x44'),_0x5b93e1['uniqueid'],channels[_0x5b93e1[_0xc430('0x7')]][_0xc430('0x43')]));delete channels[_0x5b93e1[_0xc430('0x7')]][_0xc430('0x3e')];}}}catch(_0x532d98){utils[_0xc430('0x1e')](util[_0xc430('0x9')]('[%s][calls][musiconholdstop]',_0x5b93e1['uniqueid']),_0x532d98);}};exports[_0xc430('0x45')]=function(_0x274760){try{if(!_[_0xc430('0x21')](channels[_0x274760[_0xc430('0x7')]])){utils[_0xc430('0x16')](util[_0xc430('0x9')](_0xc430('0x46'),_0x274760['uniqueid']),_0x274760);if(!_[_0xc430('0x21')](_0x274760['variable'][_0xc430('0x47')])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x48'),_0x274760[_0xc430('0x7')],_0x274760[_0xc430('0x49')]));channels[_0x274760['uniqueid']][_0xc430('0x4a')]=_0x274760[_0xc430('0x49')];}if(!_[_0xc430('0x21')](_0x274760[_0xc430('0x4b')][_0xc430('0x4c')])){utils[_0xc430('0x18')](util[_0xc430('0x9')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x274760[_0xc430('0x7')],_0x274760['value']));channels[_0x274760[_0xc430('0x7')]]['destination']=_0x274760[_0xc430('0x49')];channels[_0x274760[_0xc430('0x7')]][_0xc430('0x29')]='\x22'+_0x274760[_0xc430('0x49')]+_0xc430('0x4d')+_0x274760[_0xc430('0x49')]+'>';}if(!_['isNil'](_0x274760[_0xc430('0x4b')][_0xc430('0x4e')])||!_['isNil'](_0x274760['variable'][_0xc430('0x4f')])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x50'),_0x274760[_0xc430('0x7')],!_[_0xc430('0x21')](_0x274760[_0xc430('0x4b')][_0xc430('0x4e')])?_0xc430('0x4e'):_0xc430('0x4f'),_0x274760[_0xc430('0x49')]));channels[_0x274760[_0xc430('0x7')]]['callerid']=_0x274760['value'];}if(!_[_0xc430('0x21')](_0x274760['variable'][_0xc430('0x51')])||!_[_0xc430('0x21')](_0x274760['variable'][_0xc430('0x52')])){utils['info'](util['format'](_0xc430('0x50'),_0x274760[_0xc430('0x7')],!_['isNil'](_0x274760[_0xc430('0x4b')]['xmd-queue'])?'xmd-queue':_0xc430('0x52'),_0x274760[_0xc430('0x49')]));channels[_0x274760[_0xc430('0x7')]][_0xc430('0x53')]='Queue';channels[_0x274760[_0xc430('0x7')]][_0xc430('0x54')]=_0x274760[_0xc430('0x49')];channels[_0x274760[_0xc430('0x7')]]['queue']=!![];}if(!_[_0xc430('0x21')](_0x274760[_0xc430('0x4b')][_0xc430('0x55')])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x56'),_0x274760[_0xc430('0x7')],_0x274760[_0xc430('0x49')]));channels[_0x274760[_0xc430('0x7')]][_0xc430('0x57')]=_0x274760[_0xc430('0x49')];}if(!_['isNil'](_0x274760['variable']['xmd-cdrtype'])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x58'),_0x274760['uniqueid'],_0x274760['value']));channels[_0x274760[_0xc430('0x7')]][_0xc430('0x59')]=_0x274760[_0xc430('0x49')];}if(!_[_0xc430('0x21')](_0x274760[_0xc430('0x4b')][_0xc430('0x5a')])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x5b'),_0x274760[_0xc430('0x7')],_0x274760['value']));channels[_0x274760[_0xc430('0x7')]][_0xc430('0x5c')]=_0x274760[_0xc430('0x49')];}if(!_['isNil'](_0x274760['variable']['sipcallid'])){utils[_0xc430('0x18')](util[_0xc430('0x9')](_0xc430('0x5d'),_0x274760[_0xc430('0x7')],_0x274760['value']));channels[_0x274760[_0xc430('0x7')]][_0xc430('0x5e')]=_0x274760[_0xc430('0x49')];}}}catch(_0x5286cc){utils[_0xc430('0x1e')](util['format'](_0xc430('0x46'),_0x274760[_0xc430('0x7')]),_0x5286cc);}};exports[_0xc430('0x5f')]=function(_0x91aea8){try{if(!_[_0xc430('0x21')](channels[_0x91aea8['uniqueid']])){utils[_0xc430('0x16')](util[_0xc430('0x9')](_0xc430('0x60'),_0x91aea8[_0xc430('0x7')]),_0x91aea8);utils['info'](util['format'](_0xc430('0x61'),_0x91aea8['uniqueid'],_0x91aea8['application'],_0x91aea8[_0xc430('0x62')]));if(_0x91aea8[_0xc430('0x63')]['toLowerCase']()==_0xc430('0x64')&&_[_0xc430('0x65')](_0x91aea8[_0xc430('0x62')][_0xc430('0x66')](),_0xc430('0x67'))){var _0x12da25=_0x91aea8['appdata'][_0xc430('0x68')]('=');var _0x4754b1=_0x12da25[0x0][_0xc430('0x69')](_0x12da25[0x0][_0xc430('0x6a')]('(')+0x1,_0x12da25[0x0]['lastIndexOf'](')'));var _0x3d5b62=_0x12da25[0x1];channels[_0x91aea8[_0xc430('0x7')]][_0x4754b1]=_0x3d5b62;}if(!_[_0xc430('0x6b')](['hangup',_0xc430('0x6c'),'execif','set',_0xc430('0x6d')],_0x91aea8['application'][_0xc430('0x66')]())){channels[_0x91aea8['uniqueid']][_0xc430('0x53')]=_0x91aea8[_0xc430('0x63')];channels[_0x91aea8['uniqueid']][_0xc430('0x54')]=_0x91aea8[_0xc430('0x62')];}}}catch(_0x5c90a1){utils[_0xc430('0x1e')](util[_0xc430('0x9')]('[%s][calls][newexten]',_0x91aea8[_0xc430('0x7')]),_0x5c90a1);}}; \ No newline at end of file +var _0x2c8f=['then','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','error','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','appdata','cdr','split','substring','lastIndexOf','toLowerCase','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x2c8f,0x192));var _0xf2c8=function(_0x252587,_0x34b7e0){_0x252587=_0x252587-0x0;var _0x5abc29=_0x2c8f[_0x252587];return _0x5abc29;};'use strict';var _=require('lodash');var util=require(_0xf2c8('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xf2c8('0x1'),_0xf2c8('0x1'),_0xf2c8('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0xf2c8('0x3'),_0xf2c8('0x4'),_0xf2c8('0x1'),_0xf2c8('0x1'),_0xf2c8('0x1')];var channels={};function writeDB(_0x4eae22){var _0x475616;if(transfers[_0xf2c8('0x5')][_0x4eae22[_0xf2c8('0x6')]]){_0x475616=_0x4eae22[_0xf2c8('0x6')];_0x4eae22[_0xf2c8('0x6')]=transfers[_0xf2c8('0x5')][_0x4eae22['uniqueid']][_0xf2c8('0x7')];}utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0xa'),_0x4eae22[_0xf2c8('0x6')],_0x4eae22[_0xf2c8('0xb')],_0x4eae22[_0xf2c8('0xc')],_0x4eae22[_0xf2c8('0xd')],_0x4eae22['interface'],_0x4eae22[_0xf2c8('0xe')],_0x4eae22['connectedlinenum'],_0x4eae22[_0xf2c8('0xf')]));if(_0x4eae22[_0xf2c8('0x10')]){utils[_0xf2c8('0x11')](_0x4eae22[_0xf2c8('0x10')])[_0xf2c8('0x12')](function(_0x40849c){if(_0x40849c){_0x4eae22['UserId']=_0x40849c['id'];}utils[_0xf2c8('0x13')](_0xf2c8('0x14'),_0x4eae22);});}else{utils[_0xf2c8('0x13')](_0xf2c8('0x14'),_0x4eae22);}if(channels[_0x4eae22[_0xf2c8('0x6')]]){delete channels[_0x4eae22[_0xf2c8('0x6')]];}else if(_0x475616&&channels[_0x475616]){if(!transfers[_0xf2c8('0x5')][_0x475616]['recording'])delete transfers[_0xf2c8('0x5')][_0x475616];delete channels[_0x475616];}}exports[_0xf2c8('0x15')]=function(_0x19a6b2){try{utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')]('[%s][calls][newchannel]',_0x19a6b2['uniqueid']),_0x19a6b2);if(_0x19a6b2[_0xf2c8('0x6')]==_0x19a6b2[_0xf2c8('0x17')]&&_0x19a6b2[_0xf2c8('0xb')]!=_0xf2c8('0x18')){utils['info'](util[_0xf2c8('0x9')](_0xf2c8('0x19'),_0x19a6b2[_0xf2c8('0x6')],_0x19a6b2['context'],_0x19a6b2[_0xf2c8('0x1a')]));channels[_0x19a6b2[_0xf2c8('0x6')]]={'uniqueid':_0x19a6b2['uniqueid'],'accountcode':_0x19a6b2['accountcode'],'source':_0x19a6b2[_0xf2c8('0xe')],'destination':_0x19a6b2[_0xf2c8('0x1a')],'destinationcontext':_0x19a6b2[_0xf2c8('0x1b')],'channel':_0x19a6b2['channel'],'starttime':utils[_0xf2c8('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf2c8('0x2'),'amaflags':_0xf2c8('0x1d')};}}catch(_0x239350){utils['error'](util[_0xf2c8('0x9')](_0xf2c8('0x1e'),_0x19a6b2[_0xf2c8('0x6')]),_0x239350);}};exports[_0xf2c8('0x1f')]=function(_0x16938e){try{utils['debug'](util[_0xf2c8('0x9')]('[%s][calls][newstate]',_0x16938e[_0xf2c8('0x6')]),_0x16938e);if(!_[_0xf2c8('0x20')](channels[_0x16938e[_0xf2c8('0x6')]])&&_0x16938e[_0xf2c8('0x21')]==0x6){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x22'),_0x16938e[_0xf2c8('0x6')],_0x16938e[_0xf2c8('0x1b')],_0x16938e[_0xf2c8('0xb')]));if(_[_0xf2c8('0x20')](channels[_0x16938e[_0xf2c8('0x6')]][_0xf2c8('0x23')])){channels[_0x16938e['uniqueid']][_0xf2c8('0x23')]=utils['now']();}}else if(!_['isNil'](channels[_0x16938e[_0xf2c8('0x17')]])&&_0x16938e['channelstate']==0x6&&_0x16938e[_0xf2c8('0x1b')]!=_0xf2c8('0x24')){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x25'),_0x16938e[_0xf2c8('0x6')],_0x16938e[_0xf2c8('0x17')],_0x16938e['context'],_0x16938e[_0xf2c8('0xb')]));channels[_0x16938e[_0xf2c8('0x17')]][_0xf2c8('0x10')]=_0x16938e[_0xf2c8('0x10')];channels[_0x16938e[_0xf2c8('0x17')]][_0xf2c8('0x26')]=_0x16938e['channel'];if(_[_0xf2c8('0x20')](channels[_0x16938e['linkedid']][_0xf2c8('0x27')])){channels[_0x16938e['linkedid']][_0xf2c8('0x27')]=utils[_0xf2c8('0x1c')]();}channels[_0x16938e[_0xf2c8('0x17')]][_0xf2c8('0x28')]=dispositions[_[_0xf2c8('0x29')](_0x16938e['channelstate'])]||_0xf2c8('0x3');}}catch(_0x1927bd){utils['error'](util[_0xf2c8('0x9')](_0xf2c8('0x2a'),_0x16938e['uniqueid']),_0x1927bd);}};exports[_0xf2c8('0x2b')]=function(_0x20012e){try{if(!_[_0xf2c8('0x20')](channels[_0x20012e[_0xf2c8('0x6')]])){utils[_0xf2c8('0x16')](util['format']('[%s][calls][hangup]',_0x20012e[_0xf2c8('0x6')]),_0x20012e);if(_[_0xf2c8('0x20')](channels[_0x20012e[_0xf2c8('0x6')]][_0xf2c8('0x2c')])){channels[_0x20012e[_0xf2c8('0x6')]][_0xf2c8('0x2c')]=_0x20012e[_0xf2c8('0x2d')]+'\x20<'+_0x20012e[_0xf2c8('0xe')]+'>';}utils['info'](util[_0xf2c8('0x9')](_0xf2c8('0x2e'),_0x20012e[_0xf2c8('0x6')],channels[_0x20012e['uniqueid']]['callerid'],_0x20012e['cause-txt']));channels[_0x20012e['uniqueid']][_0xf2c8('0x2f')]=utils['now']();channels[_0x20012e[_0xf2c8('0x6')]]['duration']=utils[_0xf2c8('0x30')](channels[_0x20012e['uniqueid']]['endtime'],channels[_0x20012e[_0xf2c8('0x6')]][_0xf2c8('0x31')]);channels[_0x20012e['uniqueid']][_0xf2c8('0x32')]=channels[_0x20012e[_0xf2c8('0x6')]]['answertime']?utils[_0xf2c8('0x30')](channels[_0x20012e[_0xf2c8('0x6')]][_0xf2c8('0x2f')],channels[_0x20012e[_0xf2c8('0x6')]][_0xf2c8('0x27')]):0x0;writeDB(channels[_0x20012e[_0xf2c8('0x6')]]);}}catch(_0x4e1575){utils['error'](util[_0xf2c8('0x9')]('[%s][calls][hangup]',_0x20012e[_0xf2c8('0x6')]),_0x4e1575);}};exports['attendedtransfer']=function(_0x81e648){try{if(!_['isNil'](channels[_0x81e648[_0xf2c8('0x33')]])){utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')](_0xf2c8('0x34'),_0x81e648['origtransfereruniqueid']),_0x81e648);if(channels[_0x81e648[_0xf2c8('0x33')]][_0xf2c8('0xb')]==_0x81e648['transfereechannel']){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x35'),_0x81e648[_0xf2c8('0x36')],_0x81e648[_0xf2c8('0x33')],_0x81e648[_0xf2c8('0x37')]));channels[_0x81e648[_0xf2c8('0x33')]]['destinationchannel']=_0x81e648[_0xf2c8('0x37')];channels[_0x81e648[_0xf2c8('0x33')]][_0xf2c8('0x38')]=_0xf2c8('0x39');}else if(channels[_0x81e648['localtwolinkedid']]['channel']=_0x81e648[_0xf2c8('0x3a')]){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x81e648[_0xf2c8('0x36')],_0x81e648[_0xf2c8('0x33')],_0x81e648['origtransfererchannel']));channels[_0x81e648['localtwolinkedid']][_0xf2c8('0x26')]=_0x81e648[_0xf2c8('0x3b')];channels[_0x81e648[_0xf2c8('0x33')]][_0xf2c8('0x38')]='_attended';}}}catch(_0x16f713){utils[_0xf2c8('0x3c')](util[_0xf2c8('0x9')]('[%s][calls][attendedtransfer]',_0x81e648[_0xf2c8('0x36')]),_0x16f713);}};exports[_0xf2c8('0x3d')]=function(_0x15fa55){try{if(!_['isNil'](channels[_0x15fa55[_0xf2c8('0x6')]])){utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')](_0xf2c8('0x3e'),_0x15fa55[_0xf2c8('0x6')]),_0x15fa55);channels[_0x15fa55['uniqueid']][_0xf2c8('0x3f')]=utils['now']();utils['info'](util[_0xf2c8('0x9')](_0xf2c8('0x40'),_0x15fa55[_0xf2c8('0x6')],channels[_0x15fa55[_0xf2c8('0x6')]][_0xf2c8('0x3f')]));}}catch(_0x47fec0){utils[_0xf2c8('0x3c')](util[_0xf2c8('0x9')](_0xf2c8('0x3e'),_0x15fa55[_0xf2c8('0x6')]),_0x47fec0);}};exports[_0xf2c8('0x41')]=function(_0x35a20b){try{if(!_['isNil'](channels[_0x35a20b['uniqueid']])){utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')](_0xf2c8('0x42'),_0x35a20b[_0xf2c8('0x6')]),_0x35a20b);if(!_[_0xf2c8('0x20')](channels[_0x35a20b[_0xf2c8('0x6')]][_0xf2c8('0x3f')])){channels[_0x35a20b[_0xf2c8('0x6')]]['mohtime']+=utils[_0xf2c8('0x30')](utils[_0xf2c8('0x1c')](),channels[_0x35a20b['uniqueid']]['musiconholdstartAt']);utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x35a20b[_0xf2c8('0x6')],channels[_0x35a20b[_0xf2c8('0x6')]][_0xf2c8('0x43')]));delete channels[_0x35a20b['uniqueid']][_0xf2c8('0x3f')];}}}catch(_0x34cfc4){utils[_0xf2c8('0x3c')](util[_0xf2c8('0x9')](_0xf2c8('0x42'),_0x35a20b[_0xf2c8('0x6')]),_0x34cfc4);}};exports[_0xf2c8('0x44')]=function(_0x1b74e2){try{if(!_['isNil'](channels[_0x1b74e2[_0xf2c8('0x6')]])){utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')]('[%s][calls][varset]',_0x1b74e2['uniqueid']),_0x1b74e2);if(!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')]['xmd-originatecalleridnum'])){utils[_0xf2c8('0x8')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1b74e2[_0xf2c8('0x6')],_0x1b74e2[_0xf2c8('0x46')]));channels[_0x1b74e2['uniqueid']][_0xf2c8('0x47')]=_0x1b74e2[_0xf2c8('0x46')];}if(!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')][_0xf2c8('0x48')])){utils['info'](util[_0xf2c8('0x9')](_0xf2c8('0x49'),_0x1b74e2['uniqueid'],_0x1b74e2[_0xf2c8('0x46')]));channels[_0x1b74e2['uniqueid']][_0xf2c8('0x4a')]=_0x1b74e2[_0xf2c8('0x46')];channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x2c')]='\x22'+_0x1b74e2[_0xf2c8('0x46')]+_0xf2c8('0x4b')+_0x1b74e2['value']+'>';}if(!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')][_0xf2c8('0x4c')])||!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')]['xmd-callerid'])){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x4d'),_0x1b74e2[_0xf2c8('0x6')],!_['isNil'](_0x1b74e2[_0xf2c8('0x45')][_0xf2c8('0x4c')])?_0xf2c8('0x4c'):_0xf2c8('0x4e'),_0x1b74e2[_0xf2c8('0x46')]));channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x2c')]=_0x1b74e2[_0xf2c8('0x46')];}if(!_[_0xf2c8('0x20')](_0x1b74e2['variable'][_0xf2c8('0x4f')])||!_[_0xf2c8('0x20')](_0x1b74e2['variable'][_0xf2c8('0x50')])){utils[_0xf2c8('0x8')](util['format'](_0xf2c8('0x4d'),_0x1b74e2[_0xf2c8('0x6')],!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')]['xmd-queue'])?'xmd-queue':_0xf2c8('0x50'),_0x1b74e2['value']));channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x51')]=_0xf2c8('0x52');channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x53')]=_0x1b74e2[_0xf2c8('0x46')];channels[_0x1b74e2['uniqueid']][_0xf2c8('0xc')]=!![];}if(!_[_0xf2c8('0x20')](_0x1b74e2['variable'][_0xf2c8('0x54')])){utils[_0xf2c8('0x8')](util['format'](_0xf2c8('0x55'),_0x1b74e2['uniqueid'],_0x1b74e2[_0xf2c8('0x46')]));channels[_0x1b74e2[_0xf2c8('0x6')]]['ContactId']=_0x1b74e2['value'];}if(!_['isNil'](_0x1b74e2[_0xf2c8('0x45')][_0xf2c8('0x56')])){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x57'),_0x1b74e2[_0xf2c8('0x6')],_0x1b74e2['value']));channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x58')]=_0x1b74e2[_0xf2c8('0x46')];}if(!_[_0xf2c8('0x20')](_0x1b74e2['variable']['outboundrouteid'])){utils[_0xf2c8('0x8')](util[_0xf2c8('0x9')](_0xf2c8('0x59'),_0x1b74e2[_0xf2c8('0x6')],_0x1b74e2['value']));channels[_0x1b74e2['uniqueid']][_0xf2c8('0x5a')]=_0x1b74e2[_0xf2c8('0x46')];}if(!_[_0xf2c8('0x20')](_0x1b74e2[_0xf2c8('0x45')]['sipcallid'])){utils['info'](util[_0xf2c8('0x9')](_0xf2c8('0x5b'),_0x1b74e2[_0xf2c8('0x6')],_0x1b74e2[_0xf2c8('0x46')]));channels[_0x1b74e2[_0xf2c8('0x6')]][_0xf2c8('0x5c')]=_0x1b74e2['value'];}}}catch(_0x35c799){utils[_0xf2c8('0x3c')](util['format'](_0xf2c8('0x5d'),_0x1b74e2['uniqueid']),_0x35c799);}};exports[_0xf2c8('0x5e')]=function(_0x57e37e){try{if(!_[_0xf2c8('0x20')](channels[_0x57e37e[_0xf2c8('0x6')]])){utils[_0xf2c8('0x16')](util[_0xf2c8('0x9')](_0xf2c8('0x5f'),_0x57e37e['uniqueid']),_0x57e37e);utils['info'](util['format'](_0xf2c8('0x60'),_0x57e37e[_0xf2c8('0x6')],_0x57e37e[_0xf2c8('0x61')],_0x57e37e['appdata']));if(_0x57e37e[_0xf2c8('0x61')]['toLowerCase']()==_0xf2c8('0x62')&&_['startsWith'](_0x57e37e[_0xf2c8('0x63')]['toLowerCase'](),_0xf2c8('0x64'))){var _0x3362e5=_0x57e37e[_0xf2c8('0x63')][_0xf2c8('0x65')]('=');var _0x176501=_0x3362e5[0x0][_0xf2c8('0x66')](_0x3362e5[0x0][_0xf2c8('0x67')]('(')+0x1,_0x3362e5[0x0][_0xf2c8('0x67')](')'));var _0x5d6782=_0x3362e5[0x1];channels[_0x57e37e[_0xf2c8('0x6')]][_0x176501]=_0x5d6782;}if(!_['includes']([_0xf2c8('0x2b'),'noop','execif','set','gotoif'],_0x57e37e[_0xf2c8('0x61')][_0xf2c8('0x68')]())){channels[_0x57e37e[_0xf2c8('0x6')]][_0xf2c8('0x51')]=_0x57e37e['application'];channels[_0x57e37e[_0xf2c8('0x6')]][_0xf2c8('0x53')]=_0x57e37e[_0xf2c8('0x63')];}}}catch(_0x118aa6){utils['error'](util[_0xf2c8('0x9')](_0xf2c8('0x5f'),_0x57e37e['uniqueid']),_0x118aa6);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 603d2d8..b9c0c07 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 _0xdf85=['./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf85,0x12c));var _0x5df8=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdf85[_0x4e676e];return _0x336a3c;};'use strict';var utils=require(_0x5df8('0x0'));exports[_0x5df8('0x1')]=function(){utils[_0x5df8('0x2')](_0x5df8('0x3'));};exports['shutdown']=function(){utils[_0x5df8('0x2')](_0x5df8('0x4'));};exports[_0x5df8('0x5')]=function(){utils[_0x5df8('0x2')](_0x5df8('0x6'));};exports[_0x5df8('0x7')]=function(_0x31776e){utils[_0x5df8('0x7')](_0x5df8('0x8'),_0x31776e);};exports[_0x5df8('0x9')]=function(){utils['info'](_0x5df8('0xa'));};exports[_0x5df8('0xb')]=function(_0x29f51d){}; \ No newline at end of file +var _0xe772=['fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x14e819,_0x661ffa){var _0x1ea24d=function(_0x26363a){while(--_0x26363a){_0x14e819['push'](_0x14e819['shift']());}};_0x1ea24d(++_0x661ffa);}(_0xe772,0xab));var _0x2e77=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xe772[_0x2e3545];return _0xcf18f;};'use strict';var utils=require(_0x2e77('0x0'));exports['connect']=function(){utils[_0x2e77('0x1')](_0x2e77('0x2'));};exports[_0x2e77('0x3')]=function(){utils[_0x2e77('0x1')](_0x2e77('0x4'));};exports[_0x2e77('0x5')]=function(){utils[_0x2e77('0x1')](_0x2e77('0x6'));};exports['error']=function(_0x98db8e){utils['error'](_0x2e77('0x7'),_0x98db8e);};exports[_0x2e77('0x8')]=function(){utils['info'](_0x2e77('0x9'));};exports[_0x2e77('0xa')]=function(_0x4d6da3){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4053516..fdc00d8 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 _0x6290=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','assign','complete','diffTime','endtime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x803f9a,_0x53ef86){var _0x49bb25=function(_0x3af989){while(--_0x3af989){_0x803f9a['push'](_0x803f9a['shift']());}};_0x49bb25(++_0x53ef86);}(_0x6290,0x1a8));var _0x0629=function(_0x1448c6,_0x40e6ff){_0x1448c6=_0x1448c6-0x0;var _0x382e9f=_0x6290[_0x1448c6];return _0x382e9f;};'use strict';var _=require(_0x0629('0x0'));var util=require(_0x0629('0x1'));var utils=require(_0x0629('0x2'));var dials={};function writeDB(_0x41cd36){utils[_0x0629('0x3')](util[_0x0629('0x4')](_0x0629('0x5'),_0x41cd36[_0x0629('0x6')],_0x41cd36[_0x0629('0x7')],_0x41cd36[_0x0629('0x8')],_0x41cd36['calleridnum'],_0x41cd36['connectedlinenum'],_0x41cd36[_0x0629('0x9')]));utils['request'](_0x0629('0xa'),_0x41cd36);delete dials[_0x41cd36[_0x0629('0x6')]];}exports['newexten']=function(_0x3dc9b5){try{utils[_0x0629('0xb')](util['format'](_0x0629('0xc'),_0x3dc9b5[_0x0629('0x6')]),_0x3dc9b5);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3dc9b5[_0x0629('0x6')],_0x3dc9b5[_0x0629('0xd')],_0x3dc9b5[_0x0629('0xe')]));if(_0x3dc9b5[_0x0629('0xd')]['toLowerCase']()=='set'&&_['startsWith'](_0x3dc9b5[_0x0629('0xe')][_0x0629('0xf')](),_0x0629('0x10'))){var _0xc4c5c3=_0x3dc9b5[_0x0629('0xe')][_0x0629('0x11')]('=');dials[_0x3dc9b5[_0x0629('0x6')]]={'routeId':_0xc4c5c3[0x1]};}}catch(_0x370a8c){utils[_0x0629('0x12')](util[_0x0629('0x4')](_0x0629('0xc'),_0x3dc9b5[_0x0629('0x6')]),_0x370a8c);}};exports[_0x0629('0x13')]=function(_0x424d62){try{utils['debug'](util[_0x0629('0x4')](_0x0629('0x14'),_0x424d62[_0x0629('0x6')]),_0x424d62);if(!_[_0x0629('0x15')](_0x424d62['variable'][_0x0629('0x16')])){utils[_0x0629('0x3')](util[_0x0629('0x4')](_0x0629('0x17'),_0x424d62[_0x0629('0x6')],_0x424d62[_0x0629('0x18')]));dials[_0x424d62['uniqueid']]={'routeId':_0x424d62['value']};}}catch(_0x1086cf){utils[_0x0629('0x12')](util[_0x0629('0x4')](_0x0629('0x14'),_0x424d62[_0x0629('0x6')]),_0x1086cf);}};exports[_0x0629('0x19')]=function(_0x24bf1c){try{if(!_[_0x0629('0x15')](dials[_0x24bf1c[_0x0629('0x6')]])){utils['debug'](util[_0x0629('0x4')](_0x0629('0x1a'),_0x24bf1c[_0x0629('0x6')]),_0x24bf1c);dials[_0x24bf1c[_0x0629('0x6')]]=_['assign'](dials[_0x24bf1c[_0x0629('0x6')]],_0x24bf1c);dials[_0x24bf1c[_0x0629('0x6')]]['starttime']=utils[_0x0629('0x1b')]();dials[_0x24bf1c[_0x0629('0x6')]]['lastevent']='called';utils[_0x0629('0x3')](util[_0x0629('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x24bf1c[_0x0629('0x6')],dials[_0x24bf1c[_0x0629('0x6')]][_0x0629('0x1c')]));}}catch(_0x234946){utils['error'](util[_0x0629('0x4')](_0x0629('0x1a'),_0x24bf1c[_0x0629('0x6')]),_0x234946);}};exports[_0x0629('0x1d')]=function(_0x246f09){try{if(!_['isNil'](dials[_0x246f09[_0x0629('0x6')]])){utils[_0x0629('0xb')](util[_0x0629('0x4')](_0x0629('0x1e'),_0x246f09[_0x0629('0x6')]),_0x246f09);dials[_0x246f09['uniqueid']][_0x0629('0x9')]=_0x246f09['dialstatus'];if(_0x246f09[_0x0629('0x9')]==_0x0629('0x1f')){dials[_0x246f09[_0x0629('0x6')]]=_['assign'](dials[_0x246f09[_0x0629('0x6')]],_0x246f09);dials[_0x246f09['uniqueid']][_0x0629('0x20')]=utils[_0x0629('0x1b')]();dials[_0x246f09[_0x0629('0x6')]]['lastevent']='connect';utils['info'](util['format'](_0x0629('0x21'),_0x246f09[_0x0629('0x6')],_0x246f09[_0x0629('0x9')],dials[_0x246f09[_0x0629('0x6')]][_0x0629('0x20')]));}else{utils[_0x0629('0x3')](util[_0x0629('0x4')](_0x0629('0x22'),_0x246f09[_0x0629('0x6')],_0x246f09[_0x0629('0x9')]));}}}catch(_0x24266e){utils[_0x0629('0x12')](util['format'](_0x0629('0x1e'),_0x246f09[_0x0629('0x6')]),_0x24266e);}};exports[_0x0629('0x23')]=function(_0xf86d8f){try{if(!_[_0x0629('0x15')](dials[_0xf86d8f[_0x0629('0x6')]])){utils[_0x0629('0xb')](util[_0x0629('0x4')](_0x0629('0x24'),_0xf86d8f[_0x0629('0x6')]),_0xf86d8f);utils[_0x0629('0x3')](util[_0x0629('0x4')](_0x0629('0x25'),_0xf86d8f[_0x0629('0x6')],_0xf86d8f[_0x0629('0x26')],_0xf86d8f[_0x0629('0x27')],_0xf86d8f[_0x0629('0x28')]));dials[_0xf86d8f['uniqueid']]=_[_0x0629('0x29')](dials[_0xf86d8f[_0x0629('0x6')]],{'endtime':utils[_0x0629('0x1b')](),'lastevent':_0x0629('0x2a')});dials[_0xf86d8f['uniqueid']]['duration']=utils[_0x0629('0x2b')](dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x2c')],dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x1c')]);dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x2d')]=utils[_0x0629('0x2b')](dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x20')]||dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x2c')],dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x1c')]);dials[_0xf86d8f[_0x0629('0x6')]]['billableseconds']=dials[_0xf86d8f['uniqueid']][_0x0629('0x20')]?utils['diffTime'](dials[_0xf86d8f[_0x0629('0x6')]]['endtime'],dials[_0xf86d8f[_0x0629('0x6')]][_0x0629('0x20')]):0x0;writeDB(dials[_0xf86d8f[_0x0629('0x6')]]);}}catch(_0xd0e1a1){utils[_0x0629('0x12')](util[_0x0629('0x4')](_0x0629('0x24'),_0xf86d8f[_0x0629('0x6')]),_0xd0e1a1);}}; \ No newline at end of file +var _0x43e1=['[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]'];(function(_0x37656f,_0x350ac6){var _0x5cd9d8=function(_0x12e27e){while(--_0x12e27e){_0x37656f['push'](_0x37656f['shift']());}};_0x5cd9d8(++_0x350ac6);}(_0x43e1,0x150));var _0x143e=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x43e1[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x143e('0x0'));var util=require(_0x143e('0x1'));var utils=require(_0x143e('0x2'));var dials={};function writeDB(_0x22d0d9){utils[_0x143e('0x3')](util[_0x143e('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x22d0d9[_0x143e('0x5')],_0x22d0d9[_0x143e('0x6')],_0x22d0d9[_0x143e('0x7')],_0x22d0d9['calleridnum'],_0x22d0d9[_0x143e('0x8')],_0x22d0d9[_0x143e('0x9')]));utils[_0x143e('0xa')](_0x143e('0xb'),_0x22d0d9);delete dials[_0x22d0d9[_0x143e('0x5')]];}exports['newexten']=function(_0x398271){try{utils[_0x143e('0xc')](util[_0x143e('0x4')](_0x143e('0xd'),_0x398271[_0x143e('0x5')]),_0x398271);utils[_0x143e('0x3')](util[_0x143e('0x4')](_0x143e('0xe'),_0x398271[_0x143e('0x5')],_0x398271[_0x143e('0xf')],_0x398271[_0x143e('0x10')]));if(_0x398271['application']['toLowerCase']()==_0x143e('0x11')&&_['startsWith'](_0x398271[_0x143e('0x10')]['toLowerCase'](),_0x143e('0x12'))){var _0x17172f=_0x398271[_0x143e('0x10')]['split']('=');dials[_0x398271['uniqueid']]={'routeId':_0x17172f[0x1]};}}catch(_0x113505){utils[_0x143e('0x13')](util['format'](_0x143e('0xd'),_0x398271['uniqueid']),_0x113505);}};exports[_0x143e('0x14')]=function(_0x3e6e09){try{utils[_0x143e('0xc')](util[_0x143e('0x4')](_0x143e('0x15'),_0x3e6e09['uniqueid']),_0x3e6e09);if(!_[_0x143e('0x16')](_0x3e6e09[_0x143e('0x17')][_0x143e('0x18')])){utils[_0x143e('0x3')](util[_0x143e('0x4')](_0x143e('0x19'),_0x3e6e09[_0x143e('0x5')],_0x3e6e09['value']));dials[_0x3e6e09[_0x143e('0x5')]]={'routeId':_0x3e6e09[_0x143e('0x1a')]};}}catch(_0xd3c53){utils[_0x143e('0x13')](util[_0x143e('0x4')]('[%s][dials][varset]',_0x3e6e09[_0x143e('0x5')]),_0xd3c53);}};exports[_0x143e('0x1b')]=function(_0x514b99){try{if(!_[_0x143e('0x16')](dials[_0x514b99[_0x143e('0x5')]])){utils['debug'](util[_0x143e('0x4')]('[%s][dials][dialbegin]',_0x514b99['uniqueid']),_0x514b99);dials[_0x514b99[_0x143e('0x5')]]=_[_0x143e('0x1c')](dials[_0x514b99['uniqueid']],_0x514b99);dials[_0x514b99[_0x143e('0x5')]][_0x143e('0x1d')]=utils[_0x143e('0x1e')]();dials[_0x514b99[_0x143e('0x5')]][_0x143e('0x1f')]=_0x143e('0x20');utils[_0x143e('0x3')](util[_0x143e('0x4')](_0x143e('0x21'),_0x514b99[_0x143e('0x5')],dials[_0x514b99[_0x143e('0x5')]][_0x143e('0x1d')]));}}catch(_0x5e93bf){utils[_0x143e('0x13')](util[_0x143e('0x4')]('[%s][dials][dialbegin]',_0x514b99[_0x143e('0x5')]),_0x5e93bf);}};exports['dialend']=function(_0x2cf035){try{if(!_[_0x143e('0x16')](dials[_0x2cf035[_0x143e('0x5')]])){utils[_0x143e('0xc')](util['format'](_0x143e('0x22'),_0x2cf035[_0x143e('0x5')]),_0x2cf035);dials[_0x2cf035[_0x143e('0x5')]]['dialstatus']=_0x2cf035['dialstatus'];if(_0x2cf035['dialstatus']=='ANSWER'){dials[_0x2cf035[_0x143e('0x5')]]=_[_0x143e('0x1c')](dials[_0x2cf035[_0x143e('0x5')]],_0x2cf035);dials[_0x2cf035[_0x143e('0x5')]][_0x143e('0x23')]=utils[_0x143e('0x1e')]();dials[_0x2cf035[_0x143e('0x5')]][_0x143e('0x1f')]=_0x143e('0x24');utils['info'](util[_0x143e('0x4')](_0x143e('0x25'),_0x2cf035[_0x143e('0x5')],_0x2cf035[_0x143e('0x9')],dials[_0x2cf035['uniqueid']][_0x143e('0x23')]));}else{utils[_0x143e('0x3')](util[_0x143e('0x4')](_0x143e('0x26'),_0x2cf035[_0x143e('0x5')],_0x2cf035[_0x143e('0x9')]));}}}catch(_0x23152f){utils[_0x143e('0x13')](util[_0x143e('0x4')](_0x143e('0x22'),_0x2cf035[_0x143e('0x5')]),_0x23152f);}};exports[_0x143e('0x27')]=function(_0x3e5ad0){try{if(!_[_0x143e('0x16')](dials[_0x3e5ad0['uniqueid']])){utils[_0x143e('0xc')](util[_0x143e('0x4')](_0x143e('0x28'),_0x3e5ad0[_0x143e('0x5')]),_0x3e5ad0);utils[_0x143e('0x3')](util[_0x143e('0x4')](_0x143e('0x29'),_0x3e5ad0[_0x143e('0x5')],_0x3e5ad0[_0x143e('0x2a')],_0x3e5ad0[_0x143e('0x2b')],_0x3e5ad0['cause-txt']));dials[_0x3e5ad0[_0x143e('0x5')]]=_[_0x143e('0x1c')](dials[_0x3e5ad0[_0x143e('0x5')]],{'endtime':utils[_0x143e('0x1e')](),'lastevent':_0x143e('0x2c')});dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x2d')]=utils[_0x143e('0x2e')](dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x2f')],dials[_0x3e5ad0['uniqueid']][_0x143e('0x1d')]);dials[_0x3e5ad0['uniqueid']][_0x143e('0x30')]=utils[_0x143e('0x2e')](dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x23')]||dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x2f')],dials[_0x3e5ad0['uniqueid']][_0x143e('0x1d')]);dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x31')]=dials[_0x3e5ad0['uniqueid']][_0x143e('0x23')]?utils[_0x143e('0x2e')](dials[_0x3e5ad0['uniqueid']][_0x143e('0x2f')],dials[_0x3e5ad0[_0x143e('0x5')]][_0x143e('0x23')]):0x0;writeDB(dials[_0x3e5ad0[_0x143e('0x5')]]);}}catch(_0x20dc9d){utils['error'](util['format']('[%s][dials][hangup]',_0x3e5ad0['uniqueid']),_0x20dc9d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9446186..40db498 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 _0x7328=['./dials.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','device','error','[%s][index][devicestatechange]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][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]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','production','asterisk','port','username','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x5745d0,_0x249a9a){var _0x3eaa5d=function(_0x27c97e){while(--_0x27c97e){_0x5745d0['push'](_0x5745d0['shift']());}};_0x3eaa5d(++_0x249a9a);}(_0x7328,0x1d8));var _0x8732=function(_0x564dd2,_0x148fa5){_0x564dd2=_0x564dd2-0x0;var _0x47bb3a=_0x7328[_0x564dd2];return _0x47bb3a;};var AsteriskManager=require(_0x8732('0x0'));var config=require('../../config/environment');var utils=require(_0x8732('0x1'));var util=require(_0x8732('0x2'));var isXDREnabled=config[_0x8732('0x3')]&&config['xdr'][_0x8732('0x4')]?!config[_0x8732('0x3')][_0x8732('0x4')]:!![];var isProduction=config['env']===_0x8732('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0x8732('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x8732('0x6')][_0x8732('0x7')],config[_0x8732('0x6')]['ip'],config[_0x8732('0x6')][_0x8732('0x8')],config[_0x8732('0x6')]['password'],!![]);ami[_0x8732('0x9')]();if(!isXDREnabled){utils['info'](_0x8732('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8732('0xb')](_0x8732('0xc'));}else{var agents=require(_0x8732('0xd'));var calls=require(_0x8732('0xe'));var queues=require(_0x8732('0xf'));var recordings=require(_0x8732('0x10'));var members=require(_0x8732('0x11'));var dials=require(_0x8732('0x12'));var transfers=require('./transfers.controller');var core=require(_0x8732('0x13'));ami['on'](_0x8732('0x14'),core[_0x8732('0x14')]);ami['on'](_0x8732('0x15'),core[_0x8732('0x15')]);ami['on'](_0x8732('0x16'),core[_0x8732('0x16')]);ami['on']('error',core['error']);ami['on'](_0x8732('0x17'),core[_0x8732('0x17')]);ami['on']('managerevent',core[_0x8732('0x18')]);ami['on'](_0x8732('0x19'),function(_0x28295e){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')]('[%s][index][devicestatechange]',_0x28295e[_0x8732('0x1c')]),_0x28295e);members[_0x8732('0x19')](_0x28295e);}catch(_0x55e7f0){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x1e'),_0x28295e[_0x8732('0x1c')]),_0x55e7f0);}});ami['on'](_0x8732('0x1f'),function(_0x55ab56){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')]('[%s][index][agentcalled]',_0x55ab56[_0x8732('0x20')]),_0x55ab56);agents[_0x8732('0x1f')](_0x55ab56);}catch(_0x42154d){utils['error'](util[_0x8732('0x1b')]('[%s][index][agentcalled]',_0x55ab56[_0x8732('0x20')]),_0x42154d);}});ami['on'](_0x8732('0x21'),function(_0xd682d){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x22'),_0xd682d['uniqueid']),_0xd682d);agents['agentringnoanswer'](_0xd682d);}catch(_0x117d9e){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x22'),_0xd682d[_0x8732('0x20')]),_0x117d9e);}});ami['on'](_0x8732('0x23'),function(_0x568969){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x24'),_0x568969['uniqueid']),_0x568969);agents[_0x8732('0x23')](_0x568969);queues[_0x8732('0x23')](_0x568969);}catch(_0x14b704){utils[_0x8732('0x1d')](util['format']('[%s][index][agentconnect]',_0x568969['uniqueid']),_0x14b704);}});ami['on']('agentcomplete',function(_0x335063){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x25'),_0x335063[_0x8732('0x20')]),_0x335063);agents[_0x8732('0x26')](_0x335063);queues[_0x8732('0x26')](_0x335063);members[_0x8732('0x26')](_0x335063);}catch(_0x4c4f6a){utils[_0x8732('0x1d')](util['format'](_0x8732('0x25'),_0x335063[_0x8732('0x20')]),_0x4c4f6a);}});ami['on'](_0x8732('0x27'),function(_0x142928){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x28'),_0x142928['uniqueid']),_0x142928);agents['queuecallerabandon'](_0x142928);queues[_0x8732('0x27')](_0x142928);}catch(_0x233596){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x28'),_0x142928[_0x8732('0x20')]),_0x233596);}});ami['on'](_0x8732('0x29'),function(_0x19b7fb){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x2a'),_0x19b7fb['uniqueid']),_0x19b7fb);queues[_0x8732('0x29')](_0x19b7fb);recordings[_0x8732('0x29')](_0x19b7fb);}catch(_0x67b3e7){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x2a'),_0x19b7fb[_0x8732('0x20')]),_0x67b3e7);}});ami['on'](_0x8732('0x2b'),function(_0xce5a4e){try{utils[_0x8732('0x1a')](util['format'](_0x8732('0x2c'),_0xce5a4e[_0x8732('0x20')]),_0xce5a4e);queues[_0x8732('0x2b')](_0xce5a4e);}catch(_0x5e8046){utils[_0x8732('0x1d')](util['format'](_0x8732('0x2c'),_0xce5a4e['uniqueid']),_0x5e8046);}});ami['on'](_0x8732('0x2d'),function(_0x587afc){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x2e'),_0x587afc[_0x8732('0x20')]),_0x587afc);queues[_0x8732('0x2d')](_0x587afc);calls[_0x8732('0x2d')](_0x587afc);}catch(_0x3b817e){utils['error'](util[_0x8732('0x1b')]('[%s][index][musiconholdstart]',_0x587afc[_0x8732('0x20')]),_0x3b817e);}});ami['on'](_0x8732('0x2f'),function(_0x31c6af){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')]('[%s][index][musiconholdstop]',_0x31c6af[_0x8732('0x20')]),_0x31c6af);queues[_0x8732('0x2f')](_0x31c6af);calls['musiconholdstop'](_0x31c6af);}catch(_0x546e70){utils[_0x8732('0x1d')](util[_0x8732('0x1b')]('[%s][index][musiconholdstop]',_0x31c6af['uniqueid']),_0x546e70);}});ami['on'](_0x8732('0x30'),function(_0x1e74cd){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')]('[%s][index][newstate]',_0x1e74cd[_0x8732('0x20')]),_0x1e74cd);calls[_0x8732('0x30')](_0x1e74cd);recordings[_0x8732('0x30')](_0x1e74cd);}catch(_0x56f36f){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x31'),_0x1e74cd[_0x8732('0x20')]),_0x56f36f);}});ami['on'](_0x8732('0x32'),function(_0x9154e2){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x33'),_0x9154e2['uniqueid']),_0x9154e2);calls[_0x8732('0x32')](_0x9154e2);recordings[_0x8732('0x32')](_0x9154e2);dials['hangup'](_0x9154e2);agents[_0x8732('0x32')](_0x9154e2);queues['hangup'](_0x9154e2);}catch(_0x5280f7){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x33'),_0x9154e2['uniqueid']),_0x5280f7);}});ami['on'](_0x8732('0x34'),function(_0x255af3){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x35'),_0x255af3[_0x8732('0x20')]),_0x255af3);members[_0x8732('0x34')](_0x255af3);}catch(_0x526fac){utils[_0x8732('0x1d')](util['format'](_0x8732('0x35'),_0x255af3['uniqueid']),_0x526fac);}});ami['on']('blindtransfer',function(_0x18d2da){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x36'),_0x18d2da['uniqueid']),_0x18d2da);queues['blindtransfer'](_0x18d2da);agents[_0x8732('0x37')](_0x18d2da);transfers['blindtransfer'](_0x18d2da);recordings[_0x8732('0x37')](_0x18d2da);}catch(_0x108b95){utils[_0x8732('0x1d')](util['format']('[%s][index][blindtransfer]',_0x18d2da[_0x8732('0x20')]),_0x108b95);}});ami['on'](_0x8732('0x38'),function(_0x45e079){try{utils[_0x8732('0x1a')](util['format'](_0x8732('0x39'),_0x45e079[_0x8732('0x3a')]),_0x45e079);queues[_0x8732('0x38')](_0x45e079);transfers[_0x8732('0x38')](_0x45e079);agents['attendedtransfer'](_0x45e079);calls['attendedtransfer'](_0x45e079);}catch(_0x5958ee){utils['error'](util[_0x8732('0x1b')](_0x8732('0x39'),_0x45e079[_0x8732('0x3a')]),_0x5958ee);}});ami['on']('varset',function(_0x525c44){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')]('[%s][index][varset]',_0x525c44[_0x8732('0x20')]),_0x525c44);queues[_0x8732('0x3b')](_0x525c44);recordings['varset'](_0x525c44);calls['varset'](_0x525c44);dials[_0x8732('0x3b')](_0x525c44);}catch(_0x2dd3bd){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x3c'),_0x525c44[_0x8732('0x20')]),_0x2dd3bd);}});ami['on'](_0x8732('0x3d'),function(_0x33cffb){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x3e'),_0x33cffb['uniqueid']),_0x33cffb);calls[_0x8732('0x3d')](_0x33cffb);recordings[_0x8732('0x3d')](_0x33cffb);dials[_0x8732('0x3d')](_0x33cffb);}catch(_0x3370b4){utils['error'](util[_0x8732('0x1b')](_0x8732('0x3e'),_0x33cffb[_0x8732('0x20')]),_0x3370b4);}});ami['on'](_0x8732('0x3f'),function(_0x3c3480){try{utils[_0x8732('0x1a')](util['format'](_0x8732('0x40'),_0x3c3480[_0x8732('0x20')]),_0x3c3480);calls[_0x8732('0x3f')](_0x3c3480);recordings['newchannel'](_0x3c3480);}catch(_0x42b48e){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x40'),_0x3c3480[_0x8732('0x20')]),_0x42b48e);}});ami['on'](_0x8732('0x41'),function(_0x4912be){try{utils['debug'](util[_0x8732('0x1b')](_0x8732('0x42'),_0x4912be[_0x8732('0x20')]),_0x4912be);dials[_0x8732('0x41')](_0x4912be);}catch(_0x1f8c8f){utils[_0x8732('0x1d')](util[_0x8732('0x1b')](_0x8732('0x43'),_0x4912be[_0x8732('0x20')]),_0x1f8c8f);}});ami['on'](_0x8732('0x44'),function(_0x40d98f){try{utils[_0x8732('0x1a')](util[_0x8732('0x1b')](_0x8732('0x45'),_0x40d98f[_0x8732('0x20')]),_0x40d98f);dials[_0x8732('0x44')](_0x40d98f);}catch(_0x43c463){utils['error'](util[_0x8732('0x1b')]('[%s][index][dialend]',_0x40d98f[_0x8732('0x20')]),_0x43c463);}});} \ No newline at end of file +var _0xf571=['blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','production','asterisk','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]'];(function(_0x226646,_0x34665e){var _0x3cec6b=function(_0x49fd46){while(--_0x49fd46){_0x226646['push'](_0x226646['shift']());}};_0x3cec6b(++_0x34665e);}(_0xf571,0x19b));var _0x1f57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf571[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0x1f57('0x0'));var config=require('../../config/environment');var utils=require(_0x1f57('0x1'));var util=require(_0x1f57('0x2'));var isXDREnabled=config['xdr']&&config[_0x1f57('0x3')][_0x1f57('0x4')]?!config[_0x1f57('0x3')]['disabled']:!![];var isProduction=config['env']===_0x1f57('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x1f57('0x6')]['port'],config['asterisk']['ip'],config[_0x1f57('0x6')][_0x1f57('0x7')],config[_0x1f57('0x6')][_0x1f57('0x8')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x1f57('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1f57('0xa')](_0x1f57('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x1f57('0xc'));var queues=require(_0x1f57('0xd'));var recordings=require('./recordings.controller');var members=require(_0x1f57('0xe'));var dials=require(_0x1f57('0xf'));var transfers=require(_0x1f57('0x10'));var core=require('./core.controller');ami['on'](_0x1f57('0x11'),core['connect']);ami['on'](_0x1f57('0x12'),core[_0x1f57('0x12')]);ami['on'](_0x1f57('0x13'),core['fullybooted']);ami['on'](_0x1f57('0x14'),core[_0x1f57('0x14')]);ami['on'](_0x1f57('0x15'),core[_0x1f57('0x15')]);ami['on']('managerevent',core[_0x1f57('0x16')]);ami['on'](_0x1f57('0x17'),function(_0x4fab46){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x1a'),_0x4fab46[_0x1f57('0x1b')]),_0x4fab46);members[_0x1f57('0x17')](_0x4fab46);}catch(_0x121151){utils[_0x1f57('0x14')](util['format']('[%s][index][devicestatechange]',_0x4fab46['device']),_0x121151);}});ami['on'](_0x1f57('0x1c'),function(_0x334eab){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x1d'),_0x334eab[_0x1f57('0x1e')]),_0x334eab);agents['agentcalled'](_0x334eab);}catch(_0x4c06f5){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x1d'),_0x334eab[_0x1f57('0x1e')]),_0x4c06f5);}});ami['on'](_0x1f57('0x1f'),function(_0x521d27){try{utils['debug'](util[_0x1f57('0x19')]('[%s][index][agentringnoanswer]',_0x521d27['uniqueid']),_0x521d27);agents[_0x1f57('0x1f')](_0x521d27);}catch(_0x211402){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x20'),_0x521d27[_0x1f57('0x1e')]),_0x211402);}});ami['on'](_0x1f57('0x21'),function(_0x40f417){try{utils['debug'](util[_0x1f57('0x19')]('[%s][index][agentconnect]',_0x40f417['uniqueid']),_0x40f417);agents[_0x1f57('0x21')](_0x40f417);queues[_0x1f57('0x21')](_0x40f417);}catch(_0x21f0aa){utils[_0x1f57('0x14')](util[_0x1f57('0x19')]('[%s][index][agentconnect]',_0x40f417[_0x1f57('0x1e')]),_0x21f0aa);}});ami['on'](_0x1f57('0x22'),function(_0x3d3c0a){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x23'),_0x3d3c0a[_0x1f57('0x1e')]),_0x3d3c0a);agents[_0x1f57('0x22')](_0x3d3c0a);queues[_0x1f57('0x22')](_0x3d3c0a);members['agentcomplete'](_0x3d3c0a);}catch(_0x3a4d22){utils['error'](util[_0x1f57('0x19')]('[%s][index][agentcomplete]',_0x3d3c0a['uniqueid']),_0x3a4d22);}});ami['on'](_0x1f57('0x24'),function(_0x45bb16){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x25'),_0x45bb16[_0x1f57('0x1e')]),_0x45bb16);agents[_0x1f57('0x24')](_0x45bb16);queues[_0x1f57('0x24')](_0x45bb16);}catch(_0x1aa9c1){utils['error'](util[_0x1f57('0x19')]('[%s][index][queuecallerabandon]',_0x45bb16[_0x1f57('0x1e')]),_0x1aa9c1);}});ami['on'](_0x1f57('0x26'),function(_0x47c333){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x27'),_0x47c333[_0x1f57('0x1e')]),_0x47c333);queues[_0x1f57('0x26')](_0x47c333);recordings[_0x1f57('0x26')](_0x47c333);}catch(_0x3cd5c7){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x27'),_0x47c333['uniqueid']),_0x3cd5c7);}});ami['on'](_0x1f57('0x28'),function(_0x1c6594){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x29'),_0x1c6594['uniqueid']),_0x1c6594);queues[_0x1f57('0x28')](_0x1c6594);}catch(_0x231bb9){utils[_0x1f57('0x14')](util['format']('[%s][index][queuecallerleave]',_0x1c6594['uniqueid']),_0x231bb9);}});ami['on']('musiconholdstart',function(_0x20c8cd){try{utils[_0x1f57('0x18')](util['format']('[%s][index][musiconholdstart]',_0x20c8cd['uniqueid']),_0x20c8cd);queues['musiconholdstart'](_0x20c8cd);calls['musiconholdstart'](_0x20c8cd);}catch(_0x59afc6){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x2a'),_0x20c8cd[_0x1f57('0x1e')]),_0x59afc6);}});ami['on'](_0x1f57('0x2b'),function(_0x50c466){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x2c'),_0x50c466[_0x1f57('0x1e')]),_0x50c466);queues[_0x1f57('0x2b')](_0x50c466);calls[_0x1f57('0x2b')](_0x50c466);}catch(_0x2f5d0d){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x2c'),_0x50c466[_0x1f57('0x1e')]),_0x2f5d0d);}});ami['on']('newstate',function(_0x127f6f){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x2d'),_0x127f6f['uniqueid']),_0x127f6f);calls['newstate'](_0x127f6f);recordings[_0x1f57('0x2e')](_0x127f6f);}catch(_0xfdd792){utils['error'](util[_0x1f57('0x19')](_0x1f57('0x2d'),_0x127f6f['uniqueid']),_0xfdd792);}});ami['on'](_0x1f57('0x2f'),function(_0x1a0d7e){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x30'),_0x1a0d7e[_0x1f57('0x1e')]),_0x1a0d7e);calls[_0x1f57('0x2f')](_0x1a0d7e);recordings[_0x1f57('0x2f')](_0x1a0d7e);dials[_0x1f57('0x2f')](_0x1a0d7e);agents[_0x1f57('0x2f')](_0x1a0d7e);queues[_0x1f57('0x2f')](_0x1a0d7e);}catch(_0x335e74){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x30'),_0x1a0d7e['uniqueid']),_0x335e74);}});ami['on'](_0x1f57('0x31'),function(_0x3024a8){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x32'),_0x3024a8[_0x1f57('0x1e')]),_0x3024a8);members[_0x1f57('0x31')](_0x3024a8);}catch(_0x165dfc){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x32'),_0x3024a8['uniqueid']),_0x165dfc);}});ami['on'](_0x1f57('0x33'),function(_0x219201){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x34'),_0x219201[_0x1f57('0x1e')]),_0x219201);queues[_0x1f57('0x33')](_0x219201);agents['blindtransfer'](_0x219201);transfers['blindtransfer'](_0x219201);recordings['blindtransfer'](_0x219201);}catch(_0xdb76bd){utils[_0x1f57('0x14')](util[_0x1f57('0x19')]('[%s][index][blindtransfer]',_0x219201[_0x1f57('0x1e')]),_0xdb76bd);}});ami['on'](_0x1f57('0x35'),function(_0x1dd6bf){try{utils['debug'](util['format'](_0x1f57('0x36'),_0x1dd6bf[_0x1f57('0x37')]),_0x1dd6bf);queues[_0x1f57('0x35')](_0x1dd6bf);transfers[_0x1f57('0x35')](_0x1dd6bf);agents[_0x1f57('0x35')](_0x1dd6bf);calls[_0x1f57('0x35')](_0x1dd6bf);}catch(_0x3e7059){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x36'),_0x1dd6bf['origtransfereruniqueid']),_0x3e7059);}});ami['on'](_0x1f57('0x38'),function(_0x221ae6){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x39'),_0x221ae6[_0x1f57('0x1e')]),_0x221ae6);queues[_0x1f57('0x38')](_0x221ae6);recordings[_0x1f57('0x38')](_0x221ae6);calls[_0x1f57('0x38')](_0x221ae6);dials['varset'](_0x221ae6);}catch(_0x323cd8){utils['error'](util[_0x1f57('0x19')](_0x1f57('0x39'),_0x221ae6[_0x1f57('0x1e')]),_0x323cd8);}});ami['on']('newexten',function(_0x479708){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')](_0x1f57('0x3a'),_0x479708[_0x1f57('0x1e')]),_0x479708);calls[_0x1f57('0x3b')](_0x479708);recordings[_0x1f57('0x3b')](_0x479708);dials[_0x1f57('0x3b')](_0x479708);}catch(_0x542322){utils[_0x1f57('0x14')](util['format'](_0x1f57('0x3a'),_0x479708['uniqueid']),_0x542322);}});ami['on'](_0x1f57('0x3c'),function(_0x3c409f){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x3d'),_0x3c409f[_0x1f57('0x1e')]),_0x3c409f);calls[_0x1f57('0x3c')](_0x3c409f);recordings[_0x1f57('0x3c')](_0x3c409f);}catch(_0x45cf87){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x3d'),_0x3c409f[_0x1f57('0x1e')]),_0x45cf87);}});ami['on'](_0x1f57('0x3e'),function(_0x338371){try{utils['debug'](util[_0x1f57('0x19')](_0x1f57('0x3f'),_0x338371[_0x1f57('0x1e')]),_0x338371);dials[_0x1f57('0x3e')](_0x338371);}catch(_0x317733){utils['error'](util[_0x1f57('0x19')]('[%s]dialbegin',_0x338371[_0x1f57('0x1e')]),_0x317733);}});ami['on'](_0x1f57('0x40'),function(_0x2f5078){try{utils[_0x1f57('0x18')](util[_0x1f57('0x19')]('[%s][index][dialend]',_0x2f5078['uniqueid']),_0x2f5078);dials[_0x1f57('0x40')](_0x2f5078);}catch(_0xa0e342){utils[_0x1f57('0x14')](util[_0x1f57('0x19')](_0x1f57('0x41'),_0x2f5078[_0x1f57('0x1e')]),_0xa0e342);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a61f726..d566dd2 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 _0x63c4=['data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','voice','now','agent','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','data1','type','source'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63c4,0x1c6));var _0x463c=function(_0x1f1c43,_0x5c7b7f){_0x1f1c43=_0x1f1c43-0x0;var _0x49b676=_0x63c4[_0x1f1c43];return _0x49b676;};'use strict';var _=require(_0x463c('0x0'));var util=require(_0x463c('0x1'));var utils=require(_0x463c('0x2'));var members={};var exclude=[_0x463c('0x3'),_0x463c('0x4')];function writeDB(_0x37fc1e){utils[_0x463c('0x5')](util[_0x463c('0x6')](_0x463c('0x7'),_0x37fc1e['uniqueid'],_0x37fc1e[_0x463c('0x8')],_0x37fc1e[_0x463c('0x9')],_0x37fc1e[_0x463c('0xa')],_0x37fc1e[_0x463c('0xb')],_0x37fc1e['type']));if(_0x37fc1e[_0x463c('0x8')]){utils[_0x463c('0xc')](_0x37fc1e[_0x463c('0x8')])[_0x463c('0xd')](function(_0x37d114){if(_0x37d114){_0x37fc1e['membername']=_0x37d114[_0x463c('0xe')];_0x37fc1e[_0x463c('0xf')]=_0x37d114['internal'];utils[_0x463c('0x10')](_0x463c('0x11'),_0x37fc1e);}else{utils[_0x463c('0x12')](_0x37fc1e[_0x463c('0x8')][_0x463c('0x13')]('/')[0x1])['then'](function(_0x1540c5){if(_0x1540c5){_0x37fc1e[_0x463c('0xb')]=_0x1540c5['name'];_0x37fc1e['internal']=_0x1540c5['internal'];utils[_0x463c('0x10')](_0x463c('0x11'),_0x37fc1e);}});}})['catch'](function(_0x76c843){utils[_0x463c('0x14')](util['format']('[%s][members][writeDB]',_0x37fc1e['uniqueid']),_0x76c843);});}delete members[_0x37fc1e[_0x463c('0x8')]];}function startsWith(_0x87e15f,_0xf49a35){return _[_0x463c('0x15')](_0x87e15f,function(_0x4d984e){return _[_0x463c('0x16')](_0xf49a35,_0x4d984e);});}exports[_0x463c('0x17')]=function(_0x3fec53){try{utils[_0x463c('0x18')](util[_0x463c('0x6')](_0x463c('0x19'),members[_0x3fec53[_0x463c('0x1a')]]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53['device']),_0x3fec53);utils['info'](util[_0x463c('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3fec53['device']]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53[_0x463c('0x1a')],_0x3fec53[_0x463c('0x1c')],_0x3fec53['device']));switch(_0x3fec53['state']){case _0x463c('0x1d'):case'BUSY':if(!startsWith(exclude,_0x3fec53[_0x463c('0x1a')])){members[_0x3fec53['device']]={'channel':_0x463c('0x1e'),'interface':_0x3fec53['device'],'type':'TALKING','enterAt':utils[_0x463c('0x1f')](),'role':_0x463c('0x20')};}break;case _0x463c('0x21'):if(!_['isNil'](members[_0x3fec53[_0x463c('0x1a')]])){members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x22')]=utils['now']();members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x23')]=utils['diffTime'](members[_0x3fec53[_0x463c('0x1a')]]['exitAt'],members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x24')]);if(members[_0x3fec53[_0x463c('0x1a')]]['uniqueid']){writeDB(members[_0x3fec53[_0x463c('0x1a')]]);}}break;default:break;}}catch(_0x3f5762){utils['error'](util['format'](_0x463c('0x19'),members[_0x3fec53[_0x463c('0x1a')]]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53[_0x463c('0x1a')]),_0x3f5762);}};exports[_0x463c('0x25')]=function(_0x5a7ee3){try{if(!_[_0x463c('0x26')](members[_0x5a7ee3[_0x463c('0x8')]])){utils['debug'](util['format'](_0x463c('0x27'),_0x5a7ee3[_0x463c('0x1b')]),_0x5a7ee3);utils['info'](util['format'](_0x463c('0x28'),_0x5a7ee3['uniqueid'],_0x5a7ee3['interface'],_0x5a7ee3['queue']));members[_0x5a7ee3[_0x463c('0x8')]]=_[_0x463c('0x29')](members[_0x5a7ee3['interface']],{'data4':_0x5a7ee3['queue'],'uniqueid':_0x5a7ee3['uniqueid']});}}catch(_0x2543dd){utils[_0x463c('0x14')](util[_0x463c('0x6')](_0x463c('0x27'),_0x5a7ee3[_0x463c('0x1b')]),_0x2543dd);}};exports[_0x463c('0x2a')]=function(_0x1497d8){try{utils[_0x463c('0x18')](util[_0x463c('0x6')]('[%s][members][cdr]',_0x1497d8[_0x463c('0x1b')]),_0x1497d8);if(_0x1497d8[_0x463c('0x9')]){var _0x15781d=_0x1497d8[_0x463c('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x15781d])){members[_0x15781d]=_[_0x463c('0x29')](members[_0x15781d],{'data1':members[_0x15781d][_0x463c('0x2b')]||_0x1497d8[_0x463c('0x2c')],'data2':members[_0x15781d][_0x463c('0xa')]||_0x1497d8[_0x463c('0x2d')],'data3':members[_0x15781d][_0x463c('0x2e')]||_0x1497d8['destination'],'uniqueid':members[_0x15781d][_0x463c('0x1b')]||_0x1497d8[_0x463c('0x1b')]});utils[_0x463c('0x5')](util['format'](_0x463c('0x2f'),_0x1497d8[_0x463c('0x1b')],members[_0x15781d]['data1'],members[_0x15781d][_0x463c('0xa')],members[_0x15781d][_0x463c('0x2e')]));if(members[_0x15781d][_0x463c('0x22')]){writeDB(members[_0x15781d]);}}}if(_0x1497d8[_0x463c('0x30')]){var _0x3d2a2a=_0x1497d8[_0x463c('0x30')]['split']('-')[0x0];if(!_[_0x463c('0x26')](members[_0x3d2a2a])){members[_0x3d2a2a]=_[_0x463c('0x29')](members[_0x3d2a2a],{'data1':members[_0x3d2a2a]['data1']||_0x1497d8[_0x463c('0x2c')],'data2':members[_0x3d2a2a][_0x463c('0xa')]||_0x1497d8['source'],'data3':members[_0x3d2a2a]['data3']||_0x1497d8[_0x463c('0x31')],'uniqueid':members[_0x3d2a2a][_0x463c('0x1b')]||_0x1497d8[_0x463c('0x1b')]});utils[_0x463c('0x5')](util[_0x463c('0x6')](_0x463c('0x2f'),_0x1497d8['uniqueid'],members[_0x3d2a2a]['data1'],members[_0x3d2a2a][_0x463c('0xa')],members[_0x3d2a2a][_0x463c('0x2e')]));if(members[_0x3d2a2a][_0x463c('0x22')]){writeDB(members[_0x3d2a2a]);}}}}catch(_0x13731f){utils[_0x463c('0x14')](util[_0x463c('0x6')]('[%s][members][cdr]',_0x1497d8['uniqueid']),_0x13731f);}}; \ No newline at end of file +var _0x6953=['request','getUserByName','split','then','internal','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','now','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','source','data3','data1','data2','destinationchannel','assign','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','type','interface','getUserByInterface','name'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6953,0x91));var _0x3695=function(_0x269fb6,_0x551e65){_0x269fb6=_0x269fb6-0x0;var _0x5816f8=_0x6953[_0x269fb6];return _0x5816f8;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x402642){utils['info'](util[_0x3695('0x2')](_0x3695('0x3'),_0x402642[_0x3695('0x4')],_0x402642['interface'],_0x402642[_0x3695('0x5')],_0x402642['data2'],_0x402642[_0x3695('0x6')],_0x402642[_0x3695('0x7')]));if(_0x402642[_0x3695('0x8')]){utils[_0x3695('0x9')](_0x402642[_0x3695('0x8')])['then'](function(_0x3ef16e){if(_0x3ef16e){_0x402642['membername']=_0x3ef16e[_0x3695('0xa')];_0x402642['internal']=_0x3ef16e['internal'];utils[_0x3695('0xb')]('CreateMemberReport',_0x402642);}else{utils[_0x3695('0xc')](_0x402642[_0x3695('0x8')][_0x3695('0xd')]('/')[0x1])[_0x3695('0xe')](function(_0x24ecc6){if(_0x24ecc6){_0x402642[_0x3695('0x6')]=_0x24ecc6['name'];_0x402642[_0x3695('0xf')]=_0x24ecc6[_0x3695('0xf')];utils[_0x3695('0xb')](_0x3695('0x10'),_0x402642);}});}})[_0x3695('0x11')](function(_0x27e243){utils[_0x3695('0x12')](util[_0x3695('0x2')](_0x3695('0x13'),_0x402642[_0x3695('0x4')]),_0x27e243);});}delete members[_0x402642[_0x3695('0x8')]];}function startsWith(_0x4ca317,_0x3aa59d){return _[_0x3695('0x14')](_0x4ca317,function(_0x2cdd3){return _[_0x3695('0x15')](_0x3aa59d,_0x2cdd3);});}exports[_0x3695('0x16')]=function(_0x1973ee){try{utils[_0x3695('0x17')](util['format'](_0x3695('0x18'),members[_0x1973ee['device']]?members[_0x1973ee[_0x3695('0x19')]][_0x3695('0x4')]:_0x1973ee[_0x3695('0x19')]),_0x1973ee);utils[_0x3695('0x1a')](util[_0x3695('0x2')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1973ee[_0x3695('0x19')]]?members[_0x1973ee[_0x3695('0x19')]][_0x3695('0x4')]:_0x1973ee[_0x3695('0x19')],_0x1973ee[_0x3695('0x1b')],_0x1973ee[_0x3695('0x19')]));switch(_0x1973ee[_0x3695('0x1b')]){case _0x3695('0x1c'):case _0x3695('0x1d'):if(!startsWith(exclude,_0x1973ee[_0x3695('0x19')])){members[_0x1973ee[_0x3695('0x19')]]={'channel':_0x3695('0x1e'),'interface':_0x1973ee[_0x3695('0x19')],'type':_0x3695('0x1f'),'enterAt':utils['now'](),'role':_0x3695('0x20')};}break;case _0x3695('0x21'):if(!_['isNil'](members[_0x1973ee['device']])){members[_0x1973ee[_0x3695('0x19')]][_0x3695('0x22')]=utils[_0x3695('0x23')]();members[_0x1973ee[_0x3695('0x19')]]['duration']=utils[_0x3695('0x24')](members[_0x1973ee['device']][_0x3695('0x22')],members[_0x1973ee['device']][_0x3695('0x25')]);if(members[_0x1973ee['device']][_0x3695('0x4')]){writeDB(members[_0x1973ee[_0x3695('0x19')]]);}}break;default:break;}}catch(_0x462ff0){utils[_0x3695('0x12')](util[_0x3695('0x2')](_0x3695('0x18'),members[_0x1973ee['device']]?members[_0x1973ee[_0x3695('0x19')]][_0x3695('0x4')]:_0x1973ee['device']),_0x462ff0);}};exports[_0x3695('0x26')]=function(_0x4d0742){try{if(!_[_0x3695('0x27')](members[_0x4d0742[_0x3695('0x8')]])){utils[_0x3695('0x17')](util[_0x3695('0x2')](_0x3695('0x28'),_0x4d0742[_0x3695('0x4')]),_0x4d0742);utils[_0x3695('0x1a')](util[_0x3695('0x2')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4d0742[_0x3695('0x4')],_0x4d0742[_0x3695('0x8')],_0x4d0742[_0x3695('0x29')]));members[_0x4d0742['interface']]=_['assign'](members[_0x4d0742[_0x3695('0x8')]],{'data4':_0x4d0742['queue'],'uniqueid':_0x4d0742[_0x3695('0x4')]});}}catch(_0x471e4b){utils['error'](util[_0x3695('0x2')]('[%s][members][agentcomplete]',_0x4d0742[_0x3695('0x4')]),_0x471e4b);}};exports[_0x3695('0x2a')]=function(_0x185e48){try{utils[_0x3695('0x17')](util[_0x3695('0x2')](_0x3695('0x2b'),_0x185e48['uniqueid']),_0x185e48);if(_0x185e48[_0x3695('0x5')]){var _0x33043e=_0x185e48['channel'][_0x3695('0xd')]('-')[0x0];if(!_[_0x3695('0x27')](members[_0x33043e])){members[_0x33043e]=_['assign'](members[_0x33043e],{'data1':members[_0x33043e]['data1']||_0x185e48['type'],'data2':members[_0x33043e]['data2']||_0x185e48[_0x3695('0x2c')],'data3':members[_0x33043e][_0x3695('0x2d')]||_0x185e48['destination'],'uniqueid':members[_0x33043e][_0x3695('0x4')]||_0x185e48[_0x3695('0x4')]});utils[_0x3695('0x1a')](util[_0x3695('0x2')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x185e48['uniqueid'],members[_0x33043e][_0x3695('0x2e')],members[_0x33043e][_0x3695('0x2f')],members[_0x33043e]['data3']));if(members[_0x33043e][_0x3695('0x22')]){writeDB(members[_0x33043e]);}}}if(_0x185e48[_0x3695('0x30')]){var _0x521d60=_0x185e48[_0x3695('0x30')][_0x3695('0xd')]('-')[0x0];if(!_[_0x3695('0x27')](members[_0x521d60])){members[_0x521d60]=_[_0x3695('0x31')](members[_0x521d60],{'data1':members[_0x521d60][_0x3695('0x2e')]||_0x185e48[_0x3695('0x7')],'data2':members[_0x521d60][_0x3695('0x2f')]||_0x185e48[_0x3695('0x2c')],'data3':members[_0x521d60][_0x3695('0x2d')]||_0x185e48[_0x3695('0x32')],'uniqueid':members[_0x521d60][_0x3695('0x4')]||_0x185e48[_0x3695('0x4')]});utils[_0x3695('0x1a')](util['format'](_0x3695('0x33'),_0x185e48[_0x3695('0x4')],members[_0x521d60][_0x3695('0x2e')],members[_0x521d60][_0x3695('0x2f')],members[_0x521d60][_0x3695('0x2d')]));if(members[_0x521d60][_0x3695('0x22')]){writeDB(members[_0x521d60]);}}}}catch(_0x450483){utils['error'](util[_0x3695('0x2')](_0x3695('0x2b'),_0x185e48[_0x3695('0x4')]),_0x450483);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8fd6ddd..2acca5c 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 _0xa61d=['transfertargetuniqueid','clone','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','queueposition','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]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid'];(function(_0x532943,_0xfaa83f){var _0x3915b0=function(_0x333e3c){while(--_0x333e3c){_0x532943['push'](_0x532943['shift']());}};_0x3915b0(++_0xfaa83f);}(_0xa61d,0x76));var _0xda61=function(_0x135d2a,_0x546cd1){_0x135d2a=_0x135d2a-0x0;var _0xae488=_0xa61d[_0x135d2a];return _0xae488;};'use strict';var _=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var utils=require(_0xda61('0x2'));var queues={};function writeDB(_0x3550d5){utils[_0xda61('0x3')](util['format'](_0xda61('0x4'),_0x3550d5[_0xda61('0x5')],_0x3550d5[_0xda61('0x6')],_0x3550d5['queue'],_0x3550d5[_0xda61('0x7')],_0x3550d5[_0xda61('0x8')],_0x3550d5[_0xda61('0x9')],_0x3550d5[_0xda61('0xa')]));if(_0x3550d5['queue']){utils[_0xda61('0xb')](_0x3550d5[_0xda61('0xc')])[_0xda61('0xd')](function(_0x2c40fa){if(_0x2c40fa){_0x3550d5[_0xda61('0xe')]=_0x2c40fa[_0xda61('0xe')];}utils['request'](_0xda61('0xf'),_0x3550d5);});}else{utils['request'](_0xda61('0xf'),_0x3550d5);}if(_0x3550d5[_0xda61('0x10')]){delete queues[_0x3550d5[_0xda61('0x10')]];}else{delete queues[_0x3550d5['uniqueid']];}}exports['queuecallerjoin']=function(_0x307e93){try{utils[_0xda61('0x11')](util[_0xda61('0x12')](_0xda61('0x13'),_0x307e93[_0xda61('0x5')]),_0x307e93);utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x14'),_0x307e93['uniqueid'],_0x307e93['queue'],_0x307e93['position']));queues[_0x307e93['uniqueid']]=_['assign'](_0x307e93,{'originalposition':_0x307e93[_0xda61('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x38c47f){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x13'),_0x307e93['uniqueid']),_0x38c47f);}};exports[_0xda61('0x17')]=function(_0xc14a2e){try{if(!_['isNil'](queues[_0xc14a2e[_0xda61('0x5')]])){utils['debug'](util[_0xda61('0x12')](_0xda61('0x18'),_0xc14a2e[_0xda61('0x5')]),_0xc14a2e);if(queues[_0xc14a2e[_0xda61('0x5')]]['queuecallerleaveAt']){if(!queues[_0xc14a2e[_0xda61('0x5')]][_0xda61('0x19')]&&!queues[_0xc14a2e[_0xda61('0x5')]][_0xda61('0x1a')]){queues[_0xc14a2e[_0xda61('0x5')]]['queuecallercomplete']=!![];queues[_0xc14a2e[_0xda61('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0xc14a2e[_0xda61('0x5')]][_0xda61('0xa')]='COMPLETEDBYAGENT';}utils[_0xda61('0x3')](util['format'](_0xda61('0x1b'),_0xc14a2e[_0xda61('0x5')],queues[_0xc14a2e[_0xda61('0x5')]][_0xda61('0x1c')],queues[_0xc14a2e[_0xda61('0x5')]]['queuecallerexitreason']));writeDB(queues[_0xc14a2e[_0xda61('0x5')]]);}else if(queues[_0xc14a2e['uniqueid']][_0xda61('0x10')]){utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x1d'),_0xc14a2e[_0xda61('0x5')],queues[_0xc14a2e['uniqueid']][_0xda61('0x1c')],queues[_0xc14a2e['uniqueid']][_0xda61('0x10')]));queues[queues[_0xc14a2e['uniqueid']]['transfereduniqueid']]=queues[_0xc14a2e[_0xda61('0x5')]];queues[queues[_0xc14a2e[_0xda61('0x5')]][_0xda61('0x10')]][_0xda61('0x1e')]=0x2;delete queues[_0xc14a2e[_0xda61('0x5')]];}}}catch(_0x1a0753){utils['error'](util['format'](_0xda61('0x18'),_0xc14a2e[_0xda61('0x5')]),_0x1a0753);}};exports[_0xda61('0x1f')]=function(_0x51a57a){try{utils[_0xda61('0x11')](util[_0xda61('0x12')](_0xda61('0x20'),_0x51a57a[_0xda61('0x5')]),_0x51a57a);if(!_[_0xda61('0x21')](_0x51a57a[_0xda61('0x22')]['queuestatus'])&&_0x51a57a[_0xda61('0x23')][_0xda61('0x24')]()!==_0xda61('0x25')){if(!_[_0xda61('0x21')](queues[_0x51a57a[_0xda61('0x5')]])){queues[_0x51a57a[_0xda61('0x5')]]['queuecallerabandon']=![];queues[_0x51a57a['uniqueid']][_0xda61('0x26')]=null;queues[_0x51a57a['uniqueid']][_0xda61('0x1a')]=!![];queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0x27')]=utils[_0xda61('0x28')]();queues[_0x51a57a[_0xda61('0x5')]]['queuecallerexitreason']=_0x51a57a[_0xda61('0x23')][_0xda61('0x24')]();utils[_0xda61('0x3')](util[_0xda61('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x51a57a[_0xda61('0x5')],queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0x1c')],_0x51a57a[_0xda61('0x23')],queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0xa')]));writeDB(queues[_0x51a57a[_0xda61('0x5')]]);}}else if(!_[_0xda61('0x21')](_0x51a57a[_0xda61('0x22')][_0xda61('0x29')])){if(!_['isNil'](queues[_0x51a57a[_0xda61('0x5')]])&&!queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0x19')]){queues[_0x51a57a[_0xda61('0x5')]]['queuecallerabandon']=![];queues[_0x51a57a['uniqueid']][_0xda61('0x26')]=null;queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0x1a')]=!![];queues[_0x51a57a['uniqueid']][_0xda61('0x27')]=utils[_0xda61('0x28')]();queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0xa')]=_0xda61('0x2a');utils['info'](util[_0xda61('0x12')](_0xda61('0x2b'),_0x51a57a[_0xda61('0x5')],queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0x1c')],_0x51a57a[_0xda61('0x23')],queues[_0x51a57a[_0xda61('0x5')]][_0xda61('0xa')]));}}}catch(_0x1a1a4e){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x20'),_0x51a57a[_0xda61('0x5')]),_0x1a1a4e);}};exports[_0xda61('0x19')]=function(_0x582be3){try{if(!_[_0xda61('0x21')](queues[_0x582be3[_0xda61('0x5')]])){utils[_0xda61('0x11')](util['format'](_0xda61('0x2c'),_0x582be3['uniqueid']),_0x582be3);queues[_0x582be3[_0xda61('0x5')]][_0xda61('0x1a')]=![];queues[_0x582be3[_0xda61('0x5')]][_0xda61('0x27')]=null;queues[_0x582be3[_0xda61('0x5')]][_0xda61('0x19')]=!![];queues[_0x582be3['uniqueid']]['queuecallerabandonAt']=utils[_0xda61('0x28')]();queues[_0x582be3[_0xda61('0x5')]][_0xda61('0xa')]=_0xda61('0x2d');utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x2e'),_0x582be3[_0xda61('0x5')],queues[_0x582be3[_0xda61('0x5')]]['name'],queues[_0x582be3[_0xda61('0x5')]][_0xda61('0xa')]));}}catch(_0x2380e2){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x2c'),_0x582be3[_0xda61('0x5')]),_0x2380e2);}};exports[_0xda61('0x2f')]=function(_0x49d3c1){try{if(!_[_0xda61('0x21')](queues[_0x49d3c1[_0xda61('0x5')]])){utils[_0xda61('0x11')](util[_0xda61('0x12')](_0xda61('0x30'),_0x49d3c1['uniqueid']),_0x49d3c1);utils[_0xda61('0x3')](util['format'](_0xda61('0x31'),_0x49d3c1[_0xda61('0x5')],queues[_0x49d3c1[_0xda61('0x5')]][_0xda61('0x1c')],_0x49d3c1[_0xda61('0x32')],_0x49d3c1[_0xda61('0x33')]));queues[_0x49d3c1[_0xda61('0x5')]][_0xda61('0x2f')]=!![];queues[_0x49d3c1[_0xda61('0x5')]][_0xda61('0x34')]=utils[_0xda61('0x28')]();queues[_0x49d3c1[_0xda61('0x5')]]['holdtime']=utils[_0xda61('0x35')](queues[_0x49d3c1[_0xda61('0x5')]]['queuecallerleaveAt'],queues[_0x49d3c1['uniqueid']]['queuecallerjoinAt']);queues[_0x49d3c1[_0xda61('0x5')]][_0xda61('0x15')]=_0x49d3c1[_0xda61('0x15')];queues[_0x49d3c1[_0xda61('0x5')]][_0xda61('0x36')]=_0x49d3c1[_0xda61('0x36')];queues[_0x49d3c1['uniqueid']][_0xda61('0x32')]=_0x49d3c1['connectedlinenum'];queues[_0x49d3c1[_0xda61('0x5')]]['connectedlinename']=_0x49d3c1['connectedlinename'];}}catch(_0x46e61c){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x30'),_0x49d3c1[_0xda61('0x5')]),_0x46e61c);}};exports[_0xda61('0x37')]=function(_0x5149d6){try{if(!_[_0xda61('0x21')](queues[_0x5149d6[_0xda61('0x5')]])){utils[_0xda61('0x11')](util['format'](_0xda61('0x38'),_0x5149d6[_0xda61('0x5')]),_0x5149d6);utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x39'),_0x5149d6[_0xda61('0x5')],queues[_0x5149d6['uniqueid']][_0xda61('0x1c')],_0x5149d6[_0xda61('0x3a')],_0x5149d6[_0xda61('0x3b')]));queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0x19')]=![];queues[_0x5149d6[_0xda61('0x5')]]['queuecallerabandon']=![];queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0x26')]=null;queues[_0x5149d6['uniqueid']][_0xda61('0x1a')]=![];queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0xa')]=null;queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0x27')]=null;queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0x3c')]=!![];queues[_0x5149d6[_0xda61('0x5')]]['accountcode']=_0x5149d6['destaccountcode'];queues[_0x5149d6[_0xda61('0x5')]][_0xda61('0x7')]=_0x5149d6[_0xda61('0x3a')];}}catch(_0x22a141){utils[_0xda61('0x16')](util[_0xda61('0x12')]('[%s][queues][agentconnect]',_0x5149d6['uniqueid']),_0x22a141);}};exports[_0xda61('0x3d')]=function(_0x3ef687){try{if(!_[_0xda61('0x21')](queues[_0x3ef687[_0xda61('0x5')]])){if(queues[_0x3ef687[_0xda61('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0xda61('0x12')](_0xda61('0x3e'),_0x3ef687[_0xda61('0x5')]),_0x3ef687);queues[_0x3ef687['uniqueid']][_0xda61('0x19')]=![];queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x19')]=![];queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x26')]=null;queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x1a')]=![];queues[_0x3ef687['uniqueid']][_0xda61('0x27')]=null;queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x3c')]=!![];queues[_0x3ef687[_0xda61('0x5')]]['lastAssignedTo']=_0x3ef687[_0xda61('0x3a')];queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x3f')]=!![];queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x40')]=utils[_0xda61('0x28')]();if(_0x3ef687[_0xda61('0x41')]==_0xda61('0x42')){if(!queues[_0x3ef687[_0xda61('0x5')]][_0xda61('0x42')]){queues[_0x3ef687[_0xda61('0x5')]]['queuecallerexitreason']=_0xda61('0x43');}}else{queues[_0x3ef687[_0xda61('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x3ef687[_0xda61('0x41')]['toUpperCase']();}utils['info'](util['format'](_0xda61('0x44'),_0x3ef687[_0xda61('0x5')],queues[_0x3ef687['uniqueid']][_0xda61('0x1c')],_0x3ef687['membername'],queues[_0x3ef687[_0xda61('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x3ef687[_0xda61('0x5')]]);}}}catch(_0x467b8f){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x3e'),_0x3ef687[_0xda61('0x5')]),_0x467b8f);}};exports[_0xda61('0x45')]=function(_0x1cec21){try{if(!_[_0xda61('0x21')](queues[_0x1cec21[_0xda61('0x46')]])){utils[_0xda61('0x11')](util[_0xda61('0x12')](_0xda61('0x47'),_0x1cec21[_0xda61('0x5')]),_0x1cec21);queues[_0x1cec21[_0xda61('0x46')]]['transfer']=!![];queues[_0x1cec21[_0xda61('0x46')]][_0xda61('0x48')]=_0xda61('0x49');queues[_0x1cec21['transfereeuniqueid']][_0xda61('0x4a')]=_0x1cec21['extension'];queues[_0x1cec21[_0xda61('0x46')]][_0xda61('0x4b')]=_0x1cec21[_0xda61('0x46')];queues[_0x1cec21[_0xda61('0x46')]][_0xda61('0xa')]=_0xda61('0x4c');utils[_0xda61('0x3')](util[_0xda61('0x12')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1cec21['uniqueid'],queues[_0x1cec21[_0xda61('0x46')]][_0xda61('0x1c')],_0x1cec21[_0xda61('0x46')],_0x1cec21[_0xda61('0x4d')]));}}catch(_0x4284e6){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x47'),_0x1cec21['uniqueid']),_0x4284e6);}};exports[_0xda61('0x4e')]=function(_0x4e550c){try{utils[_0xda61('0x11')](util[_0xda61('0x12')](_0xda61('0x4f'),_0x4e550c[_0xda61('0x50')]),_0x4e550c);if(_0x4e550c['origtransfereruniqueid']==_0x4e550c[_0xda61('0x51')]){if(!_[_0xda61('0x21')](queues[_0x4e550c[_0xda61('0x52')]])){utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x53'),_0x4e550c[_0xda61('0x50')],queues[_0x4e550c[_0xda61('0x52')]][_0xda61('0x1c')],_0x4e550c[_0xda61('0x54')]));queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x42')]=!![];queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x48')]=_0xda61('0x55');queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x4a')]=_0x4e550c[_0xda61('0x54')];queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x4b')]=_0x4e550c[_0xda61('0x50')];queues[_0x4e550c['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xda61('0x21')](queues[_0x4e550c['origtransfererlinkedid']])){if(_0x4e550c[_0xda61('0x56')]&&queues[_0x4e550c[_0xda61('0x56')]]){queues[_0x4e550c[_0xda61('0x56')]]['queuecallerenterreason']=0x1;queues[_0x4e550c[_0xda61('0x46')]]=_['clone'](queues[_0x4e550c[_0xda61('0x56')]]);queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x10')]=_0x4e550c['transfertargetuniqueid'];queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x1e')]=0x2;queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x8')]=queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x8')];queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x57')]=queues[_0x4e550c[_0xda61('0x52')]][_0xda61('0x57')];queues[_0x4e550c['transfereeuniqueid']][_0xda61('0x58')]=utils[_0xda61('0x28')]();queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x34')]=utils[_0xda61('0x28')]();queues[_0x4e550c[_0xda61('0x46')]]['holdtime']=0x0;queues[_0x4e550c[_0xda61('0x46')]]['mohtime']=0x0;utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x59'),_0x4e550c['origtransfereruniqueid'],queues[_0x4e550c['transfereeuniqueid']]['name'],queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x8')],queues[_0x4e550c[_0xda61('0x46')]][_0xda61('0x57')]));}else{utils[_0xda61('0x3')](util['format'](_0xda61('0x5a'),_0x4e550c[_0xda61('0x50')],queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x1c')],_0x4e550c[_0xda61('0x52')]));queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x10')]=_0x4e550c[_0xda61('0x52')];}}}else if(_0x4e550c['secondtransfereruniqueid']==_0x4e550c[_0xda61('0x52')]){if(!_[_0xda61('0x21')](queues[_0x4e550c[_0xda61('0x51')]])){utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x5b'),_0x4e550c[_0xda61('0x50')],queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x1c')],_0x4e550c[_0xda61('0x5c')],_0x4e550c[_0xda61('0x5d')]));queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x42')]=!![];queues[_0x4e550c['origtransfererlinkedid']]['transfertype']=_0xda61('0x55');queues[_0x4e550c['origtransfererlinkedid']][_0xda61('0x4a')]=_0x4e550c[_0xda61('0x5d')];queues[_0x4e550c[_0xda61('0x51')]]['transferuniqueid']=_0x4e550c[_0xda61('0x5c')];queues[_0x4e550c[_0xda61('0x51')]]['queuecallerexitreason']=_0xda61('0x5e');}if(!_['isNil'](queues[_0x4e550c[_0xda61('0x52')]])){if(_0x4e550c['transfertargetlinkedid']&&queues[_0x4e550c[_0xda61('0x5f')]]){queues[_0x4e550c[_0xda61('0x5f')]][_0xda61('0x1e')]=0x1;queues[_0x4e550c[_0xda61('0x60')]]=_[_0xda61('0x61')](queues[_0x4e550c[_0xda61('0x5f')]]);queues[_0x4e550c['transfertargetuniqueid']]['transfereduniqueid']=_0x4e550c['transfertargetuniqueid'];queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x1e')]=0x2;queues[_0x4e550c['transfertargetuniqueid']]['calleridnum']=queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x8')];queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x57')]=queues[_0x4e550c[_0xda61('0x51')]][_0xda61('0x57')];queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x58')]=utils[_0xda61('0x28')]();queues[_0x4e550c['transfertargetuniqueid']][_0xda61('0x34')]=utils[_0xda61('0x28')]();queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x62')]=0x0;queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x63')]=0x0;utils['info'](util[_0xda61('0x12')](_0xda61('0x64'),_0x4e550c[_0xda61('0x50')],queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x1c')],queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x10')],queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x8')],queues[_0x4e550c[_0xda61('0x60')]][_0xda61('0x57')]));}else{utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x5a'),_0x4e550c[_0xda61('0x50')],queues[_0x4e550c[_0xda61('0x52')]][_0xda61('0x1c')],_0x4e550c[_0xda61('0x51')]));queues[_0x4e550c['secondtransfererlinkedid']][_0xda61('0x10')]=_0x4e550c[_0xda61('0x51')];}}}}catch(_0x4aaf99){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x4f'),_0x4e550c[_0xda61('0x50')]),_0x4aaf99);}};exports['musiconholdstart']=function(_0x1ecb4a){try{if(!_[_0xda61('0x21')](queues[_0x1ecb4a[_0xda61('0x5')]])){utils[_0xda61('0x11')](util[_0xda61('0x12')]('[%s][queues][musiconholdstart]',_0x1ecb4a[_0xda61('0x5')]),_0x1ecb4a);queues[_0x1ecb4a[_0xda61('0x5')]][_0xda61('0x65')]=utils[_0xda61('0x28')]();utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x66'),_0x1ecb4a[_0xda61('0x5')],queues[_0x1ecb4a[_0xda61('0x5')]][_0xda61('0x1c')],queues[_0x1ecb4a[_0xda61('0x5')]][_0xda61('0x65')]));}}catch(_0x312a1a){utils[_0xda61('0x16')](util[_0xda61('0x12')](_0xda61('0x67'),_0x1ecb4a[_0xda61('0x5')]),_0x312a1a);}};exports[_0xda61('0x68')]=function(_0x50b8ea){try{if(!_[_0xda61('0x21')](queues[_0x50b8ea[_0xda61('0x5')]])){if(!_[_0xda61('0x21')](queues[_0x50b8ea[_0xda61('0x5')]]['musiconholdstartAt'])){utils[_0xda61('0x11')](util['format'](_0xda61('0x69'),_0x50b8ea[_0xda61('0x5')]),_0x50b8ea);queues[_0x50b8ea[_0xda61('0x5')]][_0xda61('0x63')]+=utils[_0xda61('0x35')](utils[_0xda61('0x28')](),queues[_0x50b8ea[_0xda61('0x5')]][_0xda61('0x65')]);utils[_0xda61('0x3')](util[_0xda61('0x12')](_0xda61('0x6a'),_0x50b8ea[_0xda61('0x5')],queues[_0x50b8ea[_0xda61('0x5')]][_0xda61('0x1c')],queues[_0x50b8ea[_0xda61('0x5')]][_0xda61('0x63')]));delete queues[_0x50b8ea[_0xda61('0x5')]][_0xda61('0x65')];}}}catch(_0xceb3bf){utils[_0xda61('0x16')](util[_0xda61('0x12')]('[%s][queues][musiconholdstop]',_0x50b8ea['uniqueid']),_0xceb3bf);}}; \ No newline at end of file +var _0x7677=['[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','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]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension'];(function(_0x4f5e54,_0x2b6855){var _0x3f2bd4=function(_0x51221f){while(--_0x51221f){_0x4f5e54['push'](_0x4f5e54['shift']());}};_0x3f2bd4(++_0x2b6855);}(_0x7677,0x152));var _0x7767=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7677[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7767('0x0'));var util=require(_0x7767('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3b6f72){utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x4'),_0x3b6f72[_0x7767('0x5')],_0x3b6f72[_0x7767('0x6')],_0x3b6f72[_0x7767('0x7')],_0x3b6f72[_0x7767('0x8')],_0x3b6f72['calleridnum'],_0x3b6f72[_0x7767('0x9')],_0x3b6f72[_0x7767('0xa')]));if(_0x3b6f72['queue']){utils[_0x7767('0xb')](_0x3b6f72[_0x7767('0x7')])['then'](function(_0x4b8c21){if(_0x4b8c21){_0x3b6f72[_0x7767('0xc')]=_0x4b8c21[_0x7767('0xc')];}utils['request'](_0x7767('0xd'),_0x3b6f72);});}else{utils['request'](_0x7767('0xd'),_0x3b6f72);}if(_0x3b6f72[_0x7767('0xe')]){delete queues[_0x3b6f72[_0x7767('0xe')]];}else{delete queues[_0x3b6f72[_0x7767('0x5')]];}}exports[_0x7767('0xf')]=function(_0x2ece44){try{utils[_0x7767('0x10')](util[_0x7767('0x3')](_0x7767('0x11'),_0x2ece44[_0x7767('0x5')]),_0x2ece44);utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x12'),_0x2ece44[_0x7767('0x5')],_0x2ece44[_0x7767('0x7')],_0x2ece44['position']));queues[_0x2ece44['uniqueid']]=_[_0x7767('0x13')](_0x2ece44,{'originalposition':_0x2ece44['position'],'queuecallerjoinAt':utils[_0x7767('0x14')](),'mohtime':0x0});}catch(_0x448a1b){utils[_0x7767('0x15')](util[_0x7767('0x3')](_0x7767('0x11'),_0x2ece44[_0x7767('0x5')]),_0x448a1b);}};exports['hangup']=function(_0x5ad456){try{if(!_[_0x7767('0x16')](queues[_0x5ad456[_0x7767('0x5')]])){utils['debug'](util[_0x7767('0x3')](_0x7767('0x17'),_0x5ad456[_0x7767('0x5')]),_0x5ad456);if(queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0x18')]){if(!queues[_0x5ad456['uniqueid']]['queuecallerabandon']&&!queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0x19')]){queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0x1a')]=!![];queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0x1b')]=utils[_0x7767('0x14')]();queues[_0x5ad456['uniqueid']][_0x7767('0xa')]=_0x7767('0x1c');}utils['info'](util[_0x7767('0x3')](_0x7767('0x1d'),_0x5ad456[_0x7767('0x5')],queues[_0x5ad456['uniqueid']][_0x7767('0x1e')],queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0xa')]));writeDB(queues[_0x5ad456[_0x7767('0x5')]]);}else if(queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0xe')]){utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x1f'),_0x5ad456['uniqueid'],queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0x1e')],queues[_0x5ad456[_0x7767('0x5')]]['transfereduniqueid']));queues[queues[_0x5ad456[_0x7767('0x5')]][_0x7767('0xe')]]=queues[_0x5ad456['uniqueid']];queues[queues[_0x5ad456['uniqueid']]['transfereduniqueid']][_0x7767('0x20')]=0x2;delete queues[_0x5ad456[_0x7767('0x5')]];}}}catch(_0x39189a){utils[_0x7767('0x15')](util['format'](_0x7767('0x17'),_0x5ad456[_0x7767('0x5')]),_0x39189a);}};exports[_0x7767('0x21')]=function(_0xfdf24d){try{utils[_0x7767('0x10')](util[_0x7767('0x3')](_0x7767('0x22'),_0xfdf24d[_0x7767('0x5')]),_0xfdf24d);if(!_[_0x7767('0x16')](_0xfdf24d[_0x7767('0x23')][_0x7767('0x24')])&&_0xfdf24d[_0x7767('0x25')][_0x7767('0x26')]()!=='CONTINUE'){if(!_[_0x7767('0x16')](queues[_0xfdf24d[_0x7767('0x5')]])){queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x27')]=![];queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x28')]=null;queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x19')]=!![];queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x29')]=utils[_0x7767('0x14')]();queues[_0xfdf24d['uniqueid']][_0x7767('0xa')]=_0xfdf24d[_0x7767('0x25')][_0x7767('0x26')]();utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x2a'),_0xfdf24d['uniqueid'],queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x1e')],_0xfdf24d[_0x7767('0x25')],queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0xa')]));writeDB(queues[_0xfdf24d[_0x7767('0x5')]]);}}else if(!_[_0x7767('0x16')](_0xfdf24d[_0x7767('0x23')][_0x7767('0x2b')])){if(!_['isNil'](queues[_0xfdf24d[_0x7767('0x5')]])&&!queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x27')]){queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x27')]=![];queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0x28')]=null;queues[_0xfdf24d['uniqueid']][_0x7767('0x19')]=!![];queues[_0xfdf24d['uniqueid']][_0x7767('0x29')]=utils['now']();queues[_0xfdf24d[_0x7767('0x5')]][_0x7767('0xa')]='EXITWITHKEY';utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x2c'),_0xfdf24d[_0x7767('0x5')],queues[_0xfdf24d['uniqueid']][_0x7767('0x1e')],_0xfdf24d['value'],queues[_0xfdf24d['uniqueid']][_0x7767('0xa')]));}}}catch(_0x25bf83){utils[_0x7767('0x15')](util['format'](_0x7767('0x22'),_0xfdf24d['uniqueid']),_0x25bf83);}};exports[_0x7767('0x27')]=function(_0x54b3e2){try{if(!_['isNil'](queues[_0x54b3e2['uniqueid']])){utils[_0x7767('0x10')](util['format'](_0x7767('0x2d'),_0x54b3e2[_0x7767('0x5')]),_0x54b3e2);queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0x19')]=![];queues[_0x54b3e2[_0x7767('0x5')]]['queuecallerexitAt']=null;queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0x27')]=!![];queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0x28')]=utils[_0x7767('0x14')]();queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0xa')]=_0x7767('0x2e');utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x2f'),_0x54b3e2[_0x7767('0x5')],queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0x1e')],queues[_0x54b3e2[_0x7767('0x5')]][_0x7767('0xa')]));}}catch(_0x282f2c){utils['error'](util['format']('[%s][queues][queuecallerabandon]',_0x54b3e2['uniqueid']),_0x282f2c);}};exports[_0x7767('0x30')]=function(_0x10e762){try{if(!_[_0x7767('0x16')](queues[_0x10e762[_0x7767('0x5')]])){utils['debug'](util[_0x7767('0x3')](_0x7767('0x31'),_0x10e762[_0x7767('0x5')]),_0x10e762);utils['info'](util[_0x7767('0x3')](_0x7767('0x32'),_0x10e762[_0x7767('0x5')],queues[_0x10e762[_0x7767('0x5')]]['name'],_0x10e762[_0x7767('0x33')],_0x10e762[_0x7767('0x34')]));queues[_0x10e762['uniqueid']]['queuecallerleave']=!![];queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x18')]=utils[_0x7767('0x14')]();queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x35')]=utils[_0x7767('0x36')](queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x18')],queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x37')]);queues[_0x10e762[_0x7767('0x5')]]['position']=_0x10e762['position'];queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x38')]=_0x10e762['count'];queues[_0x10e762[_0x7767('0x5')]]['connectedlinenum']=_0x10e762[_0x7767('0x33')];queues[_0x10e762[_0x7767('0x5')]][_0x7767('0x34')]=_0x10e762[_0x7767('0x34')];}}catch(_0x4c27ef){utils['error'](util[_0x7767('0x3')](_0x7767('0x31'),_0x10e762[_0x7767('0x5')]),_0x4c27ef);}};exports[_0x7767('0x39')]=function(_0x106a22){try{if(!_[_0x7767('0x16')](queues[_0x106a22[_0x7767('0x5')]])){utils['debug'](util[_0x7767('0x3')](_0x7767('0x3a'),_0x106a22['uniqueid']),_0x106a22);utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x3b'),_0x106a22['uniqueid'],queues[_0x106a22['uniqueid']]['name'],_0x106a22[_0x7767('0x3c')],_0x106a22[_0x7767('0x3d')]));queues[_0x106a22[_0x7767('0x5')]][_0x7767('0x27')]=![];queues[_0x106a22[_0x7767('0x5')]][_0x7767('0x27')]=![];queues[_0x106a22[_0x7767('0x5')]]['queuecallerabandonAt']=null;queues[_0x106a22[_0x7767('0x5')]][_0x7767('0x19')]=![];queues[_0x106a22[_0x7767('0x5')]][_0x7767('0xa')]=null;queues[_0x106a22[_0x7767('0x5')]][_0x7767('0x29')]=null;queues[_0x106a22[_0x7767('0x5')]][_0x7767('0x3e')]=!![];queues[_0x106a22[_0x7767('0x5')]]['accountcode']=_0x106a22[_0x7767('0x3d')];queues[_0x106a22['uniqueid']][_0x7767('0x8')]=_0x106a22['membername'];}}catch(_0x1c0be0){utils['error'](util[_0x7767('0x3')]('[%s][queues][agentconnect]',_0x106a22[_0x7767('0x5')]),_0x1c0be0);}};exports[_0x7767('0x3f')]=function(_0x4fad1b){try{if(!_[_0x7767('0x16')](queues[_0x4fad1b[_0x7767('0x5')]])){if(queues[_0x4fad1b[_0x7767('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x7767('0x3')]('[%s][queues][agentcomplete]',_0x4fad1b[_0x7767('0x5')]),_0x4fad1b);queues[_0x4fad1b['uniqueid']][_0x7767('0x27')]=![];queues[_0x4fad1b[_0x7767('0x5')]]['queuecallerabandon']=![];queues[_0x4fad1b['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4fad1b[_0x7767('0x5')]][_0x7767('0x19')]=![];queues[_0x4fad1b[_0x7767('0x5')]][_0x7767('0x29')]=null;queues[_0x4fad1b['uniqueid']]['assigned']=!![];queues[_0x4fad1b[_0x7767('0x5')]][_0x7767('0x8')]=_0x4fad1b[_0x7767('0x3c')];queues[_0x4fad1b['uniqueid']][_0x7767('0x1a')]=!![];queues[_0x4fad1b['uniqueid']][_0x7767('0x1b')]=utils[_0x7767('0x14')]();if(_0x4fad1b['reason']==_0x7767('0x40')){if(!queues[_0x4fad1b[_0x7767('0x5')]]['transfer']){queues[_0x4fad1b['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4fad1b[_0x7767('0x5')]]['queuecallerexitreason']=_0x7767('0x41')+_0x4fad1b[_0x7767('0x42')][_0x7767('0x26')]();}utils[_0x7767('0x2')](util[_0x7767('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4fad1b[_0x7767('0x5')],queues[_0x4fad1b['uniqueid']][_0x7767('0x1e')],_0x4fad1b[_0x7767('0x3c')],queues[_0x4fad1b['uniqueid']][_0x7767('0xa')]));writeDB(queues[_0x4fad1b[_0x7767('0x5')]]);}}}catch(_0x5414b9){utils[_0x7767('0x15')](util[_0x7767('0x3')](_0x7767('0x43'),_0x4fad1b[_0x7767('0x5')]),_0x5414b9);}};exports[_0x7767('0x44')]=function(_0x317b8b){try{if(!_[_0x7767('0x16')](queues[_0x317b8b[_0x7767('0x45')]])){utils[_0x7767('0x10')](util[_0x7767('0x3')](_0x7767('0x46'),_0x317b8b[_0x7767('0x5')]),_0x317b8b);queues[_0x317b8b[_0x7767('0x45')]][_0x7767('0x40')]=!![];queues[_0x317b8b[_0x7767('0x45')]]['transfertype']=_0x7767('0x47');queues[_0x317b8b[_0x7767('0x45')]][_0x7767('0x48')]=_0x317b8b[_0x7767('0x49')];queues[_0x317b8b['transfereeuniqueid']]['transferuniqueid']=_0x317b8b[_0x7767('0x45')];queues[_0x317b8b['transfereeuniqueid']][_0x7767('0xa')]='BLINDTRANSFER';utils[_0x7767('0x2')](util['format'](_0x7767('0x4a'),_0x317b8b[_0x7767('0x5')],queues[_0x317b8b[_0x7767('0x45')]][_0x7767('0x1e')],_0x317b8b[_0x7767('0x45')],_0x317b8b[_0x7767('0x49')]));}}catch(_0x58707c){utils[_0x7767('0x15')](util['format']('[%s][queues][blindtransfer]',_0x317b8b[_0x7767('0x5')]),_0x58707c);}};exports[_0x7767('0x4b')]=function(_0x3ae618){try{utils['debug'](util[_0x7767('0x3')](_0x7767('0x4c'),_0x3ae618[_0x7767('0x4d')]),_0x3ae618);if(_0x3ae618[_0x7767('0x4d')]==_0x3ae618[_0x7767('0x4e')]){if(!_[_0x7767('0x16')](queues[_0x3ae618[_0x7767('0x4f')]])){utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x50'),_0x3ae618['origtransfereruniqueid'],queues[_0x3ae618[_0x7767('0x4f')]]['name'],_0x3ae618[_0x7767('0x51')]));queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0x40')]=!![];queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0x52')]=_0x7767('0x53');queues[_0x3ae618['secondtransfererlinkedid']]['transferexten']=_0x3ae618[_0x7767('0x51')];queues[_0x3ae618['secondtransfererlinkedid']][_0x7767('0x54')]=_0x3ae618['origtransfereruniqueid'];queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0xa')]=_0x7767('0x55');}if(!_[_0x7767('0x16')](queues[_0x3ae618['origtransfererlinkedid']])){if(_0x3ae618[_0x7767('0x56')]&&queues[_0x3ae618[_0x7767('0x56')]]){queues[_0x3ae618[_0x7767('0x56')]]['queuecallerenterreason']=0x1;queues[_0x3ae618[_0x7767('0x45')]]=_['clone'](queues[_0x3ae618['transfereelinkedid']]);queues[_0x3ae618[_0x7767('0x45')]]['transfereduniqueid']=_0x3ae618[_0x7767('0x57')];queues[_0x3ae618['transfereeuniqueid']][_0x7767('0x20')]=0x2;queues[_0x3ae618['transfereeuniqueid']][_0x7767('0x58')]=queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0x58')];queues[_0x3ae618['transfereeuniqueid']][_0x7767('0x59')]=queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0x59')];queues[_0x3ae618[_0x7767('0x45')]]['queuecallerjoinAt']=utils[_0x7767('0x14')]();queues[_0x3ae618[_0x7767('0x45')]][_0x7767('0x18')]=utils[_0x7767('0x14')]();queues[_0x3ae618[_0x7767('0x45')]][_0x7767('0x35')]=0x0;queues[_0x3ae618[_0x7767('0x45')]][_0x7767('0x5a')]=0x0;utils[_0x7767('0x2')](util[_0x7767('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3ae618['origtransfereruniqueid'],queues[_0x3ae618[_0x7767('0x45')]][_0x7767('0x1e')],queues[_0x3ae618['transfereeuniqueid']][_0x7767('0x58')],queues[_0x3ae618[_0x7767('0x45')]]['calleridname']));}else{utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x5b'),_0x3ae618[_0x7767('0x4d')],queues[_0x3ae618['origtransfererlinkedid']][_0x7767('0x1e')],_0x3ae618[_0x7767('0x4f')]));queues[_0x3ae618[_0x7767('0x4e')]]['transfereduniqueid']=_0x3ae618[_0x7767('0x4f')];}}}else if(_0x3ae618[_0x7767('0x5c')]==_0x3ae618[_0x7767('0x4f')]){if(!_['isNil'](queues[_0x3ae618[_0x7767('0x4e')]])){utils['info'](util[_0x7767('0x3')](_0x7767('0x5d'),_0x3ae618[_0x7767('0x4d')],queues[_0x3ae618[_0x7767('0x4e')]][_0x7767('0x1e')],_0x3ae618[_0x7767('0x5c')],_0x3ae618['secondtransfererexten']));queues[_0x3ae618[_0x7767('0x4e')]][_0x7767('0x40')]=!![];queues[_0x3ae618[_0x7767('0x4e')]]['transfertype']='ATTENDED';queues[_0x3ae618[_0x7767('0x4e')]]['transferexten']=_0x3ae618[_0x7767('0x5e')];queues[_0x3ae618[_0x7767('0x4e')]]['transferuniqueid']=_0x3ae618[_0x7767('0x5c')];queues[_0x3ae618[_0x7767('0x4e')]][_0x7767('0xa')]=_0x7767('0x55');}if(!_[_0x7767('0x16')](queues[_0x3ae618[_0x7767('0x4f')]])){if(_0x3ae618[_0x7767('0x5f')]&&queues[_0x3ae618[_0x7767('0x5f')]]){queues[_0x3ae618[_0x7767('0x5f')]][_0x7767('0x20')]=0x1;queues[_0x3ae618[_0x7767('0x57')]]=_[_0x7767('0x60')](queues[_0x3ae618['transfertargetlinkedid']]);queues[_0x3ae618[_0x7767('0x57')]]['transfereduniqueid']=_0x3ae618[_0x7767('0x57')];queues[_0x3ae618['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3ae618['transfertargetuniqueid']][_0x7767('0x58')]=queues[_0x3ae618['origtransfererlinkedid']][_0x7767('0x58')];queues[_0x3ae618[_0x7767('0x57')]]['calleridname']=queues[_0x3ae618['origtransfererlinkedid']][_0x7767('0x59')];queues[_0x3ae618[_0x7767('0x57')]][_0x7767('0x37')]=utils['now']();queues[_0x3ae618[_0x7767('0x57')]]['queuecallerleaveAt']=utils['now']();queues[_0x3ae618['transfertargetuniqueid']][_0x7767('0x35')]=0x0;queues[_0x3ae618[_0x7767('0x57')]][_0x7767('0x5a')]=0x0;utils[_0x7767('0x2')](util[_0x7767('0x3')](_0x7767('0x61'),_0x3ae618[_0x7767('0x4d')],queues[_0x3ae618['transfertargetuniqueid']][_0x7767('0x1e')],queues[_0x3ae618[_0x7767('0x57')]][_0x7767('0xe')],queues[_0x3ae618['transfertargetuniqueid']][_0x7767('0x58')],queues[_0x3ae618[_0x7767('0x57')]][_0x7767('0x59')]));}else{utils[_0x7767('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3ae618['origtransfereruniqueid'],queues[_0x3ae618[_0x7767('0x4f')]][_0x7767('0x1e')],_0x3ae618['origtransfererlinkedid']));queues[_0x3ae618[_0x7767('0x4f')]]['transfereduniqueid']=_0x3ae618['origtransfererlinkedid'];}}}}catch(_0x2c9b06){utils[_0x7767('0x15')](util[_0x7767('0x3')]('[%s][queues][attendedtransfer]',_0x3ae618[_0x7767('0x4d')]),_0x2c9b06);}};exports['musiconholdstart']=function(_0x5de7f){try{if(!_[_0x7767('0x16')](queues[_0x5de7f[_0x7767('0x5')]])){utils['debug'](util[_0x7767('0x3')](_0x7767('0x62'),_0x5de7f[_0x7767('0x5')]),_0x5de7f);queues[_0x5de7f[_0x7767('0x5')]]['musiconholdstartAt']=utils[_0x7767('0x14')]();utils['info'](util[_0x7767('0x3')](_0x7767('0x63'),_0x5de7f[_0x7767('0x5')],queues[_0x5de7f[_0x7767('0x5')]][_0x7767('0x1e')],queues[_0x5de7f['uniqueid']]['musiconholdstartAt']));}}catch(_0x5e0ef6){utils['error'](util[_0x7767('0x3')](_0x7767('0x62'),_0x5de7f[_0x7767('0x5')]),_0x5e0ef6);}};exports[_0x7767('0x64')]=function(_0x499c23){try{if(!_[_0x7767('0x16')](queues[_0x499c23['uniqueid']])){if(!_[_0x7767('0x16')](queues[_0x499c23['uniqueid']][_0x7767('0x65')])){utils[_0x7767('0x10')](util[_0x7767('0x3')](_0x7767('0x66'),_0x499c23[_0x7767('0x5')]),_0x499c23);queues[_0x499c23[_0x7767('0x5')]][_0x7767('0x5a')]+=utils[_0x7767('0x36')](utils['now'](),queues[_0x499c23[_0x7767('0x5')]][_0x7767('0x65')]);utils[_0x7767('0x2')](util[_0x7767('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x499c23['uniqueid'],queues[_0x499c23[_0x7767('0x5')]]['name'],queues[_0x499c23[_0x7767('0x5')]][_0x7767('0x5a')]));delete queues[_0x499c23[_0x7767('0x5')]][_0x7767('0x65')];}}}catch(_0x31dc9d){utils['error'](util[_0x7767('0x3')](_0x7767('0x66'),_0x499c23[_0x7767('0x5')]),_0x31dc9d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ec68427..244b953 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 _0x2d53=['channel','error','[%s][recordings][newchannel]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','forEach','newexten','[%s][recordings][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','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','uniqueid','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','debug','linkedid','context'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x2d53,0x10d));var _0x32d5=function(_0x1acc03,_0x1794d6){_0x1acc03=_0x1acc03-0x0;var _0x51bc63=_0x2d53[_0x1acc03];return _0x51bc63;};'use strict';var _=require(_0x32d5('0x0'));var util=require('util');var utils=require(_0x32d5('0x1'));var transfers=require(_0x32d5('0x2'));var recordings={};function writeDB(_0x8dbd9a){var _0x1dae5c;utils[_0x32d5('0x3')](util[_0x32d5('0x4')]('[%s][recordings][writeDB]',_0x8dbd9a['uniqueid']));if(transfers['blinds'][_0x8dbd9a[_0x32d5('0x5')]]){_0x1dae5c=_0x8dbd9a[_0x32d5('0x5')];_0x8dbd9a[_0x32d5('0x5')]=transfers['blinds'][_0x8dbd9a[_0x32d5('0x5')]][_0x32d5('0x6')];}if(_0x8dbd9a[_0x32d5('0x7')]){utils['getUserByInternal'](_0x8dbd9a[_0x32d5('0x7')])[_0x32d5('0x8')](function(_0x57535a){if(_0x57535a){_0x8dbd9a[_0x32d5('0x9')]=_0x57535a[_0x32d5('0xa')];_0x8dbd9a[_0x32d5('0xb')]=_0x57535a['id'];}utils[_0x32d5('0xc')](_0x32d5('0xd'),_0x8dbd9a);});}else{utils[_0x32d5('0xc')](_0x32d5('0xd'),_0x8dbd9a);}if(_0x1dae5c)delete transfers[_0x32d5('0xe')][_0x1dae5c];}exports[_0x32d5('0xf')]=function(_0x741789){try{utils[_0x32d5('0x10')](util[_0x32d5('0x4')]('[%s][recordings][newchannel]',_0x741789[_0x32d5('0x5')]),_0x741789);if(_0x741789[_0x32d5('0x5')]==_0x741789[_0x32d5('0x11')]){utils[_0x32d5('0x3')](util[_0x32d5('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x741789[_0x32d5('0x5')],_0x741789[_0x32d5('0x12')],_0x741789['exten']));recordings[_0x741789['uniqueid']]={'uniqueid':_0x741789[_0x32d5('0x5')],'accountcode':_0x741789[_0x32d5('0x7')],'exten':_0x741789['exten'],'context':_0x741789['context'],'channel':_0x741789[_0x32d5('0x13')],'monitors':[]};}}catch(_0x4a5f46){utils[_0x32d5('0x14')](util[_0x32d5('0x4')](_0x32d5('0x15'),_0x741789[_0x32d5('0x5')]),_0x4a5f46);}};exports['newstate']=function(_0x482734){try{utils[_0x32d5('0x10')](util[_0x32d5('0x4')]('[%s][recordings][newstate]',_0x482734[_0x32d5('0x5')]),_0x482734);if(!_[_0x32d5('0x16')](recordings[_0x482734[_0x32d5('0x5')]])&&_0x482734[_0x32d5('0x17')]==0x6){utils['info'](util['format'](_0x32d5('0x18'),_0x482734['uniqueid'],_0x482734[_0x32d5('0x12')],_0x482734[_0x32d5('0x13')]));}else if(!_[_0x32d5('0x16')](recordings[_0x482734[_0x32d5('0x11')]])&&_0x482734['channelstate']==0x6&&_0x482734['context']!=_0x32d5('0x19')){utils[_0x32d5('0x3')](util['format'](_0x32d5('0x1a'),_0x482734['uniqueid'],_0x482734[_0x32d5('0x11')],_0x482734[_0x32d5('0x12')],_0x482734[_0x32d5('0x13')]));recordings[_0x482734[_0x32d5('0x11')]][_0x32d5('0x7')]=_0x482734[_0x32d5('0x7')];}}catch(_0x14fee3){utils['error'](util[_0x32d5('0x4')](_0x32d5('0x1b'),_0x482734[_0x32d5('0x5')]),_0x14fee3);}};exports[_0x32d5('0x1c')]=function(_0x2e9719){try{if(!_[_0x32d5('0x16')](_0x2e9719[_0x32d5('0x1d')])&&!_['isNil'](_0x2e9719[_0x32d5('0x1d')][_0x32d5('0x1e')])){utils['debug'](util[_0x32d5('0x4')](_0x32d5('0x1f'),_0x2e9719[_0x32d5('0x5')]),_0x2e9719);utils[_0x32d5('0x3')](util['format'](_0x32d5('0x20'),_0x2e9719[_0x32d5('0x5')],_0x2e9719[_0x32d5('0x1d')],_0x2e9719['value']));if(_[_0x32d5('0x21')](_0x2e9719['value'],'.wav49')){_0x2e9719[_0x32d5('0x22')]=_0x2e9719[_0x32d5('0x22')][_0x32d5('0x23')](_0x32d5('0x24'),'.WAV');}if(recordings[_0x2e9719[_0x32d5('0x11')]]){var _0x44ab8e=_[_0x32d5('0x25')](recordings[_0x2e9719[_0x32d5('0x11')]][_0x32d5('0x26')],{'value':_0x2e9719['value']});if(_[_0x32d5('0x16')](_0x44ab8e)){recordings[_0x2e9719[_0x32d5('0x11')]][_0x32d5('0x26')][_0x32d5('0x27')]({'value':_0x2e9719[_0x32d5('0x22')]});}}}}catch(_0x13bf44){utils['error'](util[_0x32d5('0x4')](_0x32d5('0x1f'),_0x2e9719[_0x32d5('0x5')]),_0x13bf44);}};exports[_0x32d5('0x28')]=function(_0x309eb6){try{if(!_[_0x32d5('0x16')](recordings[_0x309eb6[_0x32d5('0x5')]])){utils[_0x32d5('0x10')](util['format'](_0x32d5('0x29'),_0x309eb6['uniqueid']),_0x309eb6);utils[_0x32d5('0x3')](util['format'](_0x32d5('0x2a'),_0x309eb6[_0x32d5('0x5')],_0x309eb6[_0x32d5('0x2b')],_0x309eb6[_0x32d5('0x2c')],_0x309eb6[_0x32d5('0x2d')]));recordings[_0x309eb6[_0x32d5('0x5')]][_0x32d5('0x2b')]=_0x309eb6['calleridnum'];recordings[_0x309eb6[_0x32d5('0x5')]][_0x32d5('0x2c')]=_0x309eb6[_0x32d5('0x2c')];recordings[_0x309eb6[_0x32d5('0x5')]]['connectedlinenum']=_0x309eb6[_0x32d5('0x2e')];recordings[_0x309eb6[_0x32d5('0x5')]][_0x32d5('0x2f')]=_0x309eb6['connectedlinename'];if(recordings[_0x309eb6['uniqueid']]['type']=='outbound'&&recordings[_0x309eb6[_0x32d5('0x5')]]['accountcode']){recordings[_0x309eb6['uniqueid']][_0x32d5('0x2e')]=recordings[_0x309eb6['uniqueid']][_0x32d5('0x7')];recordings[_0x309eb6[_0x32d5('0x5')]][_0x32d5('0x2f')]='';}recordings[_0x309eb6[_0x32d5('0x5')]][_0x32d5('0x26')][_0x32d5('0x30')](function(_0x46bbe9){var _0x4ab36e=_['clone'](recordings[_0x309eb6[_0x32d5('0x5')]]);_0x4ab36e[_0x32d5('0x22')]=_0x46bbe9[_0x32d5('0x22')];writeDB(_0x4ab36e);});delete recordings[_0x309eb6[_0x32d5('0x5')]];}}catch(_0x22092b){utils['error'](util[_0x32d5('0x4')](_0x32d5('0x29'),_0x309eb6[_0x32d5('0x5')]),_0x22092b);}};exports[_0x32d5('0x31')]=function(_0x39fb9b){try{if(!_['isNil'](recordings[_0x39fb9b[_0x32d5('0x5')]])){utils[_0x32d5('0x10')](util[_0x32d5('0x4')](_0x32d5('0x32'),_0x39fb9b['uniqueid']),_0x39fb9b);utils['info'](util[_0x32d5('0x4')](_0x32d5('0x33'),_0x39fb9b[_0x32d5('0x5')],_0x39fb9b[_0x32d5('0x34')],_0x39fb9b[_0x32d5('0x35')]));if(_0x39fb9b[_0x32d5('0x34')][_0x32d5('0x36')]()==_0x32d5('0x37')&&_[_0x32d5('0x38')](_0x39fb9b['appdata'][_0x32d5('0x36')](),_0x32d5('0x39'))){var _0x4b736c=_0x39fb9b[_0x32d5('0x35')][_0x32d5('0x3a')]('=');var _0x837382=_0x4b736c[0x0]['substring'](_0x4b736c[0x0]['lastIndexOf']('(')+0x1,_0x4b736c[0x0][_0x32d5('0x3b')](')'));var _0x2f8790=_0x4b736c[0x1];recordings[_0x39fb9b[_0x32d5('0x5')]][_0x837382]=_0x2f8790;}}}catch(_0x145a5a){utils[_0x32d5('0x14')](util[_0x32d5('0x4')]('[%s][recordings][newexten]',_0x39fb9b[_0x32d5('0x5')]),_0x145a5a);}};exports[_0x32d5('0x3c')]=function(_0x200b90){try{if(!_[_0x32d5('0x16')](recordings[_0x200b90[_0x32d5('0x5')]])){utils[_0x32d5('0x10')](util['format'](_0x32d5('0x3d'),_0x200b90[_0x32d5('0x5')]),_0x200b90);utils[_0x32d5('0x3')](util['format'](_0x32d5('0x3e'),_0x200b90[_0x32d5('0x5')],_0x200b90[_0x32d5('0x3f')]));recordings[_0x200b90[_0x32d5('0x5')]][_0x32d5('0x3f')]=_0x200b90[_0x32d5('0x3f')];}}catch(_0x40342c){utils['error'](util[_0x32d5('0x4')](_0x32d5('0x3d'),_0x200b90[_0x32d5('0x5')]),_0x40342c);}};exports[_0x32d5('0x40')]=function(_0x47d1cc){try{utils[_0x32d5('0x10')](util[_0x32d5('0x4')](_0x32d5('0x41'),_0x47d1cc[_0x32d5('0x5')]),_0x47d1cc);utils[_0x32d5('0x3')](util[_0x32d5('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x47d1cc['uniqueid'],_0x47d1cc[_0x32d5('0x42')],_0x47d1cc[_0x32d5('0x43')],_0x47d1cc[_0x32d5('0x44')],_0x47d1cc[_0x32d5('0x45')]));if(recordings[_0x47d1cc[_0x32d5('0x46')]]&&transfers[_0x32d5('0xe')][_0x47d1cc[_0x32d5('0x46')]]){transfers['blinds'][_0x47d1cc[_0x32d5('0x46')]][_0x32d5('0x47')]=!![];}}catch(_0x39e69d){utils['error'](util[_0x32d5('0x4')](_0x32d5('0x41'),_0x47d1cc['uniqueid']),_0x39e69d);}}; \ No newline at end of file +var _0xae91=['uniqueid','transfereeuniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','blinds','newchannel','[%s][recordings][newchannel]','linkedid','context','exten','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','value','endsWith','replace','.WAV','find','monitors','push','error','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]'];(function(_0x3bfa25,_0x1c881a){var _0x387ab4=function(_0x13aa56){while(--_0x13aa56){_0x3bfa25['push'](_0x3bfa25['shift']());}};_0x387ab4(++_0x1c881a);}(_0xae91,0x16b));var _0x1ae9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xae91[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1ae9('0x0'));var util=require(_0x1ae9('0x1'));var utils=require(_0x1ae9('0x2'));var transfers=require(_0x1ae9('0x3'));var recordings={};function writeDB(_0x536284){var _0x2830bf;utils[_0x1ae9('0x4')](util[_0x1ae9('0x5')](_0x1ae9('0x6'),_0x536284['uniqueid']));if(transfers['blinds'][_0x536284['uniqueid']]){_0x2830bf=_0x536284['uniqueid'];_0x536284[_0x1ae9('0x7')]=transfers['blinds'][_0x536284[_0x1ae9('0x7')]][_0x1ae9('0x8')];}if(_0x536284[_0x1ae9('0x9')]){utils['getUserByInternal'](_0x536284[_0x1ae9('0x9')])[_0x1ae9('0xa')](function(_0x3c8825){if(_0x3c8825){_0x536284[_0x1ae9('0xb')]=_0x3c8825[_0x1ae9('0xc')];_0x536284['UserId']=_0x3c8825['id'];}utils[_0x1ae9('0xd')](_0x1ae9('0xe'),_0x536284);});}else{utils['request']('CreateVoiceRecording',_0x536284);}if(_0x2830bf)delete transfers[_0x1ae9('0xf')][_0x2830bf];}exports[_0x1ae9('0x10')]=function(_0x270c0f){try{utils['debug'](util[_0x1ae9('0x5')](_0x1ae9('0x11'),_0x270c0f['uniqueid']),_0x270c0f);if(_0x270c0f[_0x1ae9('0x7')]==_0x270c0f[_0x1ae9('0x12')]){utils[_0x1ae9('0x4')](util[_0x1ae9('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x270c0f[_0x1ae9('0x7')],_0x270c0f[_0x1ae9('0x13')],_0x270c0f[_0x1ae9('0x14')]));recordings[_0x270c0f[_0x1ae9('0x7')]]={'uniqueid':_0x270c0f[_0x1ae9('0x7')],'accountcode':_0x270c0f['accountcode'],'exten':_0x270c0f['exten'],'context':_0x270c0f[_0x1ae9('0x13')],'channel':_0x270c0f['channel'],'monitors':[]};}}catch(_0x3fa844){utils['error'](util[_0x1ae9('0x5')](_0x1ae9('0x11'),_0x270c0f['uniqueid']),_0x3fa844);}};exports[_0x1ae9('0x15')]=function(_0x45f5c0){try{utils[_0x1ae9('0x16')](util[_0x1ae9('0x5')](_0x1ae9('0x17'),_0x45f5c0['uniqueid']),_0x45f5c0);if(!_[_0x1ae9('0x18')](recordings[_0x45f5c0['uniqueid']])&&_0x45f5c0[_0x1ae9('0x19')]==0x6){utils['info'](util[_0x1ae9('0x5')](_0x1ae9('0x1a'),_0x45f5c0['uniqueid'],_0x45f5c0[_0x1ae9('0x13')],_0x45f5c0[_0x1ae9('0x1b')]));}else if(!_[_0x1ae9('0x18')](recordings[_0x45f5c0[_0x1ae9('0x12')]])&&_0x45f5c0['channelstate']==0x6&&_0x45f5c0[_0x1ae9('0x13')]!=_0x1ae9('0x1c')){utils[_0x1ae9('0x4')](util['format'](_0x1ae9('0x1d'),_0x45f5c0[_0x1ae9('0x7')],_0x45f5c0[_0x1ae9('0x12')],_0x45f5c0[_0x1ae9('0x13')],_0x45f5c0[_0x1ae9('0x1b')]));recordings[_0x45f5c0['linkedid']]['accountcode']=_0x45f5c0[_0x1ae9('0x9')];}}catch(_0xb8c1c7){utils['error'](util[_0x1ae9('0x5')](_0x1ae9('0x17'),_0x45f5c0[_0x1ae9('0x7')]),_0xb8c1c7);}};exports[_0x1ae9('0x1e')]=function(_0x3c8410){try{if(!_[_0x1ae9('0x18')](_0x3c8410[_0x1ae9('0x1f')])&&!_[_0x1ae9('0x18')](_0x3c8410[_0x1ae9('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0x1ae9('0x5')]('[%s][recordings][varset]',_0x3c8410['uniqueid']),_0x3c8410);utils[_0x1ae9('0x4')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3c8410[_0x1ae9('0x7')],_0x3c8410[_0x1ae9('0x1f')],_0x3c8410[_0x1ae9('0x20')]));if(_[_0x1ae9('0x21')](_0x3c8410['value'],'.wav49')){_0x3c8410[_0x1ae9('0x20')]=_0x3c8410[_0x1ae9('0x20')][_0x1ae9('0x22')]('.wav49',_0x1ae9('0x23'));}if(recordings[_0x3c8410[_0x1ae9('0x12')]]){var _0x49ebb4=_[_0x1ae9('0x24')](recordings[_0x3c8410[_0x1ae9('0x12')]][_0x1ae9('0x25')],{'value':_0x3c8410[_0x1ae9('0x20')]});if(_[_0x1ae9('0x18')](_0x49ebb4)){recordings[_0x3c8410[_0x1ae9('0x12')]][_0x1ae9('0x25')][_0x1ae9('0x26')]({'value':_0x3c8410[_0x1ae9('0x20')]});}}}}catch(_0x265388){utils[_0x1ae9('0x27')](util[_0x1ae9('0x5')](_0x1ae9('0x28'),_0x3c8410[_0x1ae9('0x7')]),_0x265388);}};exports[_0x1ae9('0x29')]=function(_0xe250e){try{if(!_[_0x1ae9('0x18')](recordings[_0xe250e['uniqueid']])){utils[_0x1ae9('0x16')](util[_0x1ae9('0x5')](_0x1ae9('0x2a'),_0xe250e[_0x1ae9('0x7')]),_0xe250e);utils[_0x1ae9('0x4')](util[_0x1ae9('0x5')](_0x1ae9('0x2b'),_0xe250e[_0x1ae9('0x7')],_0xe250e['calleridnum'],_0xe250e[_0x1ae9('0x2c')],_0xe250e[_0x1ae9('0x2d')]));recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x2e')]=_0xe250e['calleridnum'];recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x2c')]=_0xe250e['calleridname'];recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x2f')]=_0xe250e[_0x1ae9('0x2f')];recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x30')]=_0xe250e['connectedlinename'];if(recordings[_0xe250e[_0x1ae9('0x7')]]['type']==_0x1ae9('0x31')&&recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x9')]){recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x2f')]=recordings[_0xe250e[_0x1ae9('0x7')]][_0x1ae9('0x9')];recordings[_0xe250e['uniqueid']][_0x1ae9('0x30')]='';}recordings[_0xe250e['uniqueid']][_0x1ae9('0x25')][_0x1ae9('0x32')](function(_0x3e8943){var _0x2817d2=_[_0x1ae9('0x33')](recordings[_0xe250e[_0x1ae9('0x7')]]);_0x2817d2[_0x1ae9('0x20')]=_0x3e8943[_0x1ae9('0x20')];writeDB(_0x2817d2);});delete recordings[_0xe250e[_0x1ae9('0x7')]];}}catch(_0x4e2ad6){utils[_0x1ae9('0x27')](util['format'](_0x1ae9('0x2a'),_0xe250e['uniqueid']),_0x4e2ad6);}};exports[_0x1ae9('0x34')]=function(_0x3b9639){try{if(!_[_0x1ae9('0x18')](recordings[_0x3b9639[_0x1ae9('0x7')]])){utils[_0x1ae9('0x16')](util['format'](_0x1ae9('0x35'),_0x3b9639['uniqueid']),_0x3b9639);utils['info'](util[_0x1ae9('0x5')](_0x1ae9('0x36'),_0x3b9639[_0x1ae9('0x7')],_0x3b9639[_0x1ae9('0x37')],_0x3b9639[_0x1ae9('0x38')]));if(_0x3b9639[_0x1ae9('0x37')][_0x1ae9('0x39')]()==_0x1ae9('0x3a')&&_[_0x1ae9('0x3b')](_0x3b9639[_0x1ae9('0x38')][_0x1ae9('0x39')](),_0x1ae9('0x3c'))){var _0x48bd28=_0x3b9639[_0x1ae9('0x38')][_0x1ae9('0x3d')]('=');var _0x2a59b4=_0x48bd28[0x0][_0x1ae9('0x3e')](_0x48bd28[0x0][_0x1ae9('0x3f')]('(')+0x1,_0x48bd28[0x0][_0x1ae9('0x3f')](')'));var _0x246a5f=_0x48bd28[0x1];recordings[_0x3b9639['uniqueid']][_0x2a59b4]=_0x246a5f;}}}catch(_0x580cdb){utils[_0x1ae9('0x27')](util[_0x1ae9('0x5')](_0x1ae9('0x35'),_0x3b9639['uniqueid']),_0x580cdb);}};exports['queuecallerjoin']=function(_0x2a1c0e){try{if(!_[_0x1ae9('0x18')](recordings[_0x2a1c0e[_0x1ae9('0x7')]])){utils[_0x1ae9('0x16')](util[_0x1ae9('0x5')](_0x1ae9('0x40'),_0x2a1c0e['uniqueid']),_0x2a1c0e);utils['info'](util['format'](_0x1ae9('0x41'),_0x2a1c0e[_0x1ae9('0x7')],_0x2a1c0e[_0x1ae9('0x42')]));recordings[_0x2a1c0e['uniqueid']][_0x1ae9('0x42')]=_0x2a1c0e['queue'];}}catch(_0x572d04){utils[_0x1ae9('0x27')](util[_0x1ae9('0x5')](_0x1ae9('0x40'),_0x2a1c0e[_0x1ae9('0x7')]),_0x572d04);}};exports[_0x1ae9('0x43')]=function(_0x2b57ea){try{utils['debug'](util['format'](_0x1ae9('0x44'),_0x2b57ea[_0x1ae9('0x7')]),_0x2b57ea);utils['info'](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2b57ea[_0x1ae9('0x7')],_0x2b57ea[_0x1ae9('0x45')],_0x2b57ea[_0x1ae9('0x46')],_0x2b57ea[_0x1ae9('0x47')],_0x2b57ea['transfereecalleridname']));if(recordings[_0x2b57ea[_0x1ae9('0x48')]]&&transfers[_0x1ae9('0xf')][_0x2b57ea[_0x1ae9('0x48')]]){transfers[_0x1ae9('0xf')][_0x2b57ea[_0x1ae9('0x48')]][_0x1ae9('0x49')]=!![];}}catch(_0x2b5c29){utils[_0x1ae9('0x27')](util[_0x1ae9('0x5')](_0x1ae9('0x44'),_0x2b57ea[_0x1ae9('0x7')]),_0x2b5c29);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 65e008e..34fe338 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 _0x49ce=['origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererexten','origtransferercontext'];(function(_0x2a5409,_0x5ad407){var _0x1f9c1d=function(_0x37d2a6){while(--_0x37d2a6){_0x2a5409['push'](_0x2a5409['shift']());}};_0x1f9c1d(++_0x5ad407);}(_0x49ce,0x179));var _0xe49c=function(_0x31bbf7,_0x292c9a){_0x31bbf7=_0x31bbf7-0x0;var _0x1469f3=_0x49ce[_0x31bbf7];return _0x1469f3;};'use strict';var _=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var utils=require(_0xe49c('0x2'));function writeDB(_0x15d845){utils['info'](util[_0xe49c('0x3')](_0xe49c('0x4'),_0x15d845['type']==='attended'?_0x15d845[_0xe49c('0x5')]:_0x15d845['uniqueid'],_0x15d845[_0xe49c('0x6')]));utils[_0xe49c('0x7')](_0xe49c('0x8'),_0x15d845);}exports[_0xe49c('0x9')]={};exports[_0xe49c('0xa')]=function(_0xb90106){try{utils['debug'](util[_0xe49c('0x3')]('[%s][transfers][blindtransfer]',_0xb90106[_0xe49c('0xb')]),_0xb90106);utils[_0xe49c('0xc')](util[_0xe49c('0x3')](_0xe49c('0xd'),_0xb90106['uniqueid'],_0xb90106['transferercalleridnum'],_0xb90106[_0xe49c('0xe')],_0xb90106[_0xe49c('0xf')],_0xb90106[_0xe49c('0x10')]));_0xb90106[_0xe49c('0x6')]=_0xe49c('0x11');exports[_0xe49c('0x9')][_0xb90106[_0xe49c('0x12')]]=_0xb90106;writeDB(_0xb90106);}catch(_0x33eb80){utils[_0xe49c('0x13')](util[_0xe49c('0x3')](_0xe49c('0x14'),_0xb90106['uniqueid']),_0x33eb80);}};exports[_0xe49c('0x15')]=function(_0x352043){try{utils[_0xe49c('0x16')](util[_0xe49c('0x3')](_0xe49c('0x17'),_0x352043[_0xe49c('0x5')]),_0x352043);utils[_0xe49c('0xc')](util[_0xe49c('0x3')](_0xe49c('0x18'),_0x352043[_0xe49c('0x5')],_0x352043[_0xe49c('0x19')],_0x352043[_0xe49c('0x1a')],_0x352043[_0xe49c('0x1b')],_0x352043[_0xe49c('0x1c')]));_0x352043=_[_0xe49c('0x1d')](_0x352043,{'transfererchannel':_0x352043[_0xe49c('0x1e')],'transferercalleridnum':_0x352043[_0xe49c('0x19')],'transferercalleridname':_0x352043['origtransferercalleridname'],'transfererconnectedlinenum':_0x352043['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x352043['secondtransfererconnectedlinename'],'transfereraccountcode':_0x352043['origtransfereraccountcode'],'transferercontext':_0x352043['secondtransferercontext'],'transfererexten':_0x352043[_0xe49c('0x1f')],'transfererlinkedid':_0x352043['origtransfererlinkedid'],'context':_0x352043[_0xe49c('0x20')],'extension':_0x352043[_0xe49c('0x21')],'type':'attended'});if(_[_0xe49c('0x22')](_0x352043[_0xe49c('0x23')])){_0x352043=_[_0xe49c('0x1d')](_0x352043,{'transfereechannel':_0x352043[_0xe49c('0x24')],'transfereecalleridnum':_0x352043[_0xe49c('0x1b')],'transfereecalleridname':_0x352043[_0xe49c('0x1c')],'transfereeconnectedlinenum':_0x352043[_0xe49c('0x25')],'transfereeconnectedlinename':_0x352043['transfertargetconnectedlinename'],'transfereeaccountcode':_0x352043['transfertargetaccountcode'],'transfereecontext':_0x352043[_0xe49c('0x26')],'transfereeexten':_0x352043[_0xe49c('0x27')],'transfereelinkedid':_0x352043[_0xe49c('0x28')]});}writeDB(_0x352043);}catch(_0x114d7c){utils[_0xe49c('0x13')](util[_0xe49c('0x3')](_0xe49c('0x17'),_0x352043[_0xe49c('0x5')]),_0x114d7c);}}; \ No newline at end of file +var _0x0c3b=['origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','transferercalleridnum','transfereecalleridnum','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign'];(function(_0x26a9ea,_0x10ecba){var _0x3bc99d=function(_0x2f9e12){while(--_0x2f9e12){_0x26a9ea['push'](_0x26a9ea['shift']());}};_0x3bc99d(++_0x10ecba);}(_0x0c3b,0x1cc));var _0xb0c3=function(_0xce8183,_0x567545){_0xce8183=_0xce8183-0x0;var _0x27c555=_0x0c3b[_0xce8183];return _0x27c555;};'use strict';var _=require(_0xb0c3('0x0'));var util=require('util');var utils=require(_0xb0c3('0x1'));function writeDB(_0x1e0ac7){utils[_0xb0c3('0x2')](util[_0xb0c3('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x1e0ac7[_0xb0c3('0x4')]===_0xb0c3('0x5')?_0x1e0ac7[_0xb0c3('0x6')]:_0x1e0ac7[_0xb0c3('0x7')],_0x1e0ac7[_0xb0c3('0x4')]));utils['request'](_0xb0c3('0x8'),_0x1e0ac7);}exports[_0xb0c3('0x9')]={};exports[_0xb0c3('0xa')]=function(_0x51414c){try{utils[_0xb0c3('0xb')](util['format']('[%s][transfers][blindtransfer]',_0x51414c[_0xb0c3('0x7')]),_0x51414c);utils['info'](util[_0xb0c3('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x51414c[_0xb0c3('0x7')],_0x51414c[_0xb0c3('0xc')],_0x51414c['transferercalleridname'],_0x51414c[_0xb0c3('0xd')],_0x51414c['transfereecalleridname']));_0x51414c[_0xb0c3('0x4')]='blind';exports[_0xb0c3('0x9')][_0x51414c[_0xb0c3('0xe')]]=_0x51414c;writeDB(_0x51414c);}catch(_0x272dd8){utils['error'](util[_0xb0c3('0x3')]('[%s][transfers][blindtransfer]',_0x51414c['uniqueid']),_0x272dd8);}};exports[_0xb0c3('0xf')]=function(_0x40bd2d){try{utils[_0xb0c3('0xb')](util['format'](_0xb0c3('0x10'),_0x40bd2d[_0xb0c3('0x6')]),_0x40bd2d);utils[_0xb0c3('0x2')](util[_0xb0c3('0x3')](_0xb0c3('0x11'),_0x40bd2d[_0xb0c3('0x6')],_0x40bd2d['origtransferercalleridnum'],_0x40bd2d[_0xb0c3('0x12')],_0x40bd2d[_0xb0c3('0x13')],_0x40bd2d['transfertargetcalleridname']));_0x40bd2d=_[_0xb0c3('0x14')](_0x40bd2d,{'transfererchannel':_0x40bd2d['origtransfererchannel'],'transferercalleridnum':_0x40bd2d[_0xb0c3('0x15')],'transferercalleridname':_0x40bd2d[_0xb0c3('0x12')],'transfererconnectedlinenum':_0x40bd2d[_0xb0c3('0x16')],'transfererconnectedlinename':_0x40bd2d[_0xb0c3('0x17')],'transfereraccountcode':_0x40bd2d['origtransfereraccountcode'],'transferercontext':_0x40bd2d[_0xb0c3('0x18')],'transfererexten':_0x40bd2d[_0xb0c3('0x19')],'transfererlinkedid':_0x40bd2d[_0xb0c3('0x1a')],'context':_0x40bd2d[_0xb0c3('0x1b')],'extension':_0x40bd2d[_0xb0c3('0x1c')],'type':_0xb0c3('0x5')});if(_[_0xb0c3('0x1d')](_0x40bd2d[_0xb0c3('0x1e')])){_0x40bd2d=_[_0xb0c3('0x14')](_0x40bd2d,{'transfereechannel':_0x40bd2d[_0xb0c3('0x1f')],'transfereecalleridnum':_0x40bd2d[_0xb0c3('0x13')],'transfereecalleridname':_0x40bd2d[_0xb0c3('0x20')],'transfereeconnectedlinenum':_0x40bd2d[_0xb0c3('0x21')],'transfereeconnectedlinename':_0x40bd2d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40bd2d['transfertargetaccountcode'],'transfereecontext':_0x40bd2d[_0xb0c3('0x22')],'transfereeexten':_0x40bd2d[_0xb0c3('0x23')],'transfereelinkedid':_0x40bd2d[_0xb0c3('0x24')]});}writeDB(_0x40bd2d);}catch(_0xb2cfbe){utils['error'](util[_0xb0c3('0x3')](_0xb0c3('0x10'),_0x40bd2d['origtransfereruniqueid']),_0xb2cfbe);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f27ce37..f5ae15f 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 _0x53ec=['util','client','http','xdr','inspect','error','request','catch','GetUser','internal','name','interface','then','debug','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','getUserByName','info','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x53ec,0x192));var _0xc53e=function(_0x401ec9,_0x77c73f){_0x401ec9=_0x401ec9-0x0;var _0x8ef3a1=_0x53ec[_0x401ec9];return _0x8ef3a1;};'use strict';var BPromise=require(_0xc53e('0x0'));var jayson=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var util=require(_0xc53e('0x3'));var client=jayson[_0xc53e('0x4')][_0xc53e('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xc53e('0x6'));exports['info']=function(_0x2b90f6,_0x38033d){logger['info'](_0x2b90f6,_0x38033d?util[_0xc53e('0x7')](_0x38033d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x41a9e8,_0x2de88b){logger['debug'](_0x41a9e8,_0x2de88b?util[_0xc53e('0x7')](_0x2de88b,{'showHidden':![],'depth':null}):'');};exports[_0xc53e('0x8')]=function(_0x8b231f,_0x2cb51d){logger[_0xc53e('0x8')](_0x8b231f,_0x2cb51d?util[_0xc53e('0x7')](_0x2cb51d,{'showHidden':![],'depth':null}):'');};exports[_0xc53e('0x9')]=function(_0x361e9d,_0xa98198){return client['request'](_0x361e9d,{'body':_0xa98198})['then'](function(_0x35128a){logger['debug']('[utils][request]\x20name:%s',_0x361e9d,_0x35128a?util[_0xc53e('0x7')](_0x35128a,{'showHidden':![],'depth':null}):'');})[_0xc53e('0xa')](function(_0x863fa){logger[_0xc53e('0x8')]('[utils][request]\x20name:%s',_0x361e9d,_0x863fa?util['inspect'](_0x863fa,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1c06cd){return client[_0xc53e('0x9')](_0xc53e('0xb'),{'options':{'raw':!![],'attributes':['id',_0xc53e('0xc'),_0xc53e('0xd'),_0xc53e('0xe')],'where':_0x1c06cd,'limit':0x1}})[_0xc53e('0xf')](function(_0x19c0d1){logger[_0xc53e('0x10')](_0xc53e('0x11'),JSON['stringify'](_0x1c06cd),_0x19c0d1?util[_0xc53e('0x7')](_0x19c0d1,{'showHidden':![],'depth':null}):'');return _0x19c0d1[_0xc53e('0x12')][_0xc53e('0x13')]?_0x19c0d1[_0xc53e('0x12')][0x0]:null;});}exports[_0xc53e('0x14')]=function(_0x270c78){return new BPromise(function(_0x164016,_0x2d4ebb){if(_0x270c78){return getUser({'internal':_0x270c78})[_0xc53e('0xf')](function(_0x5d1098){logger['info'](_0xc53e('0x15'),_0x270c78,_0x5d1098?_0xc53e('0x16'):_0xc53e('0x17'));return _0x164016(_0x5d1098);})[_0xc53e('0xa')](function(_0x20066e){logger[_0xc53e('0x8')](_0xc53e('0x18'),_0x20066e?util[_0xc53e('0x7')](_0x20066e,{'showHidden':![],'depth':null}):'');return _0x164016(null);});}return _0x164016(null);});};exports[_0xc53e('0x19')]=function(_0x401af6){return new BPromise(function(_0x17d825,_0x44fd93){if(_0x401af6){return getUser({'interface':_0x401af6})[_0xc53e('0xf')](function(_0x4fb695){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x401af6,_0x4fb695?_0xc53e('0x16'):_0xc53e('0x17'));return _0x17d825(_0x4fb695);})[_0xc53e('0xa')](function(_0x4015c8){logger[_0xc53e('0x8')]('[utils][getUserByInterface]',_0x4015c8?util['inspect'](_0x4015c8,{'showHidden':![],'depth':null}):'');return _0x17d825(null);});}return _0x17d825(null);});};exports[_0xc53e('0x1a')]=function(_0x496167){return new BPromise(function(_0x1ae55e,_0x3a5ce8){if(_0x496167){return getUser({'name':_0x496167})[_0xc53e('0xf')](function(_0x1166e6){logger[_0xc53e('0x1b')]('[utils][getUserByName]\x20name:%s\x20%s',_0x496167,_0x1166e6?_0xc53e('0x16'):'notfound');return _0x1ae55e(_0x1166e6);})['catch'](function(_0x5c65d3){logger[_0xc53e('0x8')]('[utils][getUserByName]',_0x5c65d3?util[_0xc53e('0x7')](_0x5c65d3,{'showHidden':![],'depth':null}):'');return _0x1ae55e(null);});}return _0x1ae55e(null);});};exports['getVoiceQueueByName']=function(_0x24a77e){return new BPromise(function(_0x5112d2,_0x5ce216){if(_0x24a77e){return client[_0xc53e('0x9')](_0xc53e('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xc53e('0xd'),_0xc53e('0x1d'),_0xc53e('0x1e'),_0xc53e('0x1f')],'where':{'name':_0x24a77e},'limit':0x1}})[_0xc53e('0xf')](function(_0x2a2ca9){logger['debug'](_0xc53e('0x20'),_0x24a77e,_0x2a2ca9?util[_0xc53e('0x7')](_0x2a2ca9,{'showHidden':![],'depth':null}):'');logger[_0xc53e('0x1b')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x24a77e,_0x2a2ca9?_0xc53e('0x16'):'notfound');return _0x5112d2(_0x2a2ca9[_0xc53e('0x12')][_0xc53e('0x13')]?_0x2a2ca9['result'][0x0]:null);})['catch'](function(_0x3cd8a1){logger[_0xc53e('0x8')](_0xc53e('0x21'),_0x3cd8a1?util[_0xc53e('0x7')](_0x3cd8a1,{'showHidden':![],'depth':null}):'');return _0x5112d2(null);});}return _0x5112d2(null);});};exports[_0xc53e('0x22')]=function(_0x45fedc,_0x40a8db){return moment(_0x45fedc)[_0xc53e('0x23')](_0x40a8db,'seconds')[_0xc53e('0x24')](_0xc53e('0x25'));};exports[_0xc53e('0x26')]=function(_0x17ad32,_0x1eca5b){return moment(_0x17ad32)[_0xc53e('0x27')](_0x1eca5b,_0xc53e('0x28'))[_0xc53e('0x24')](_0xc53e('0x25'));};exports['diffTime']=function(_0x3e395c,_0x48d7d0){return moment(_0x3e395c)[_0xc53e('0x29')](moment(_0x48d7d0),_0xc53e('0x28'));};exports['sumTime']=function(_0x37452a,_0x154f8b){return parseInt(_0x37452a,0xa)+parseInt(_0x154f8b,0xa);};exports[_0xc53e('0x2a')]=function(){return moment()['format'](_0xc53e('0x25'));};exports[_0xc53e('0x2b')]=function(_0x10a90d,_0x78eb5e){if(_0x78eb5e){return moment(_0x10a90d)[_0xc53e('0x2b')](_0x78eb5e);}return!![];};exports[_0xc53e('0x2c')]=function(_0x312c1b,_0x482085){if(_0x482085){return moment(_0x312c1b)[_0xc53e('0x2c')](_0x482085);}else if(_0x312c1b){return!![];}return![];}; \ No newline at end of file +var _0x1a0b=['subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','debug','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3a89dc,_0x54bb1e){var _0x11c5c9=function(_0x21bd68){while(--_0x21bd68){_0x3a89dc['push'](_0x3a89dc['shift']());}};_0x11c5c9(++_0x54bb1e);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x3394aa,_0x4abf3e){_0x3394aa=_0x3394aa-0x0;var _0x41f0c9=_0x1a0b[_0x3394aa];return _0x41f0c9;};'use strict';var BPromise=require(_0xb1a0('0x0'));var jayson=require('jayson/promise');var moment=require(_0xb1a0('0x1'));var util=require(_0xb1a0('0x2'));var client=jayson[_0xb1a0('0x3')][_0xb1a0('0x4')]({'port':0x2329});var logger=require(_0xb1a0('0x5'))(_0xb1a0('0x6'));exports[_0xb1a0('0x7')]=function(_0x34c5fb,_0x1126a3){logger[_0xb1a0('0x7')](_0x34c5fb,_0x1126a3?util[_0xb1a0('0x8')](_0x1126a3,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4c10bf,_0x1cff60){logger['debug'](_0x4c10bf,_0x1cff60?util['inspect'](_0x1cff60,{'showHidden':![],'depth':null}):'');};exports[_0xb1a0('0x9')]=function(_0x1c8459,_0x3273c2){logger['error'](_0x1c8459,_0x3273c2?util['inspect'](_0x3273c2,{'showHidden':![],'depth':null}):'');};exports[_0xb1a0('0xa')]=function(_0xa672e8,_0x16c4fb){return client[_0xb1a0('0xa')](_0xa672e8,{'body':_0x16c4fb})[_0xb1a0('0xb')](function(_0x323afb){logger['debug'](_0xb1a0('0xc'),_0xa672e8,_0x323afb?util[_0xb1a0('0x8')](_0x323afb,{'showHidden':![],'depth':null}):'');})[_0xb1a0('0xd')](function(_0x53968c){logger[_0xb1a0('0x9')](_0xb1a0('0xc'),_0xa672e8,_0x53968c?util[_0xb1a0('0x8')](_0x53968c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x180c44){return client['request'](_0xb1a0('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb1a0('0xf'),_0xb1a0('0x10'),_0xb1a0('0x11')],'where':_0x180c44,'limit':0x1}})[_0xb1a0('0xb')](function(_0x3b9724){logger[_0xb1a0('0x12')](_0xb1a0('0x13'),JSON[_0xb1a0('0x14')](_0x180c44),_0x3b9724?util[_0xb1a0('0x8')](_0x3b9724,{'showHidden':![],'depth':null}):'');return _0x3b9724[_0xb1a0('0x15')][_0xb1a0('0x16')]?_0x3b9724[_0xb1a0('0x15')][0x0]:null;});}exports[_0xb1a0('0x17')]=function(_0x28e571){return new BPromise(function(_0x223b14,_0x2c3d0e){if(_0x28e571){return getUser({'internal':_0x28e571})['then'](function(_0x5974a7){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x28e571,_0x5974a7?'found':'notfound');return _0x223b14(_0x5974a7);})['catch'](function(_0x490182){logger[_0xb1a0('0x9')](_0xb1a0('0x18'),_0x490182?util[_0xb1a0('0x8')](_0x490182,{'showHidden':![],'depth':null}):'');return _0x223b14(null);});}return _0x223b14(null);});};exports['getUserByInterface']=function(_0x5020ac){return new BPromise(function(_0x1cb9da,_0x1fb4d9){if(_0x5020ac){return getUser({'interface':_0x5020ac})['then'](function(_0x75c04d){logger['info'](_0xb1a0('0x19'),_0x5020ac,_0x75c04d?_0xb1a0('0x1a'):_0xb1a0('0x1b'));return _0x1cb9da(_0x75c04d);})[_0xb1a0('0xd')](function(_0x5b0501){logger[_0xb1a0('0x9')]('[utils][getUserByInterface]',_0x5b0501?util[_0xb1a0('0x8')](_0x5b0501,{'showHidden':![],'depth':null}):'');return _0x1cb9da(null);});}return _0x1cb9da(null);});};exports[_0xb1a0('0x1c')]=function(_0x8317eb){return new BPromise(function(_0x10e675,_0x45a486){if(_0x8317eb){return getUser({'name':_0x8317eb})[_0xb1a0('0xb')](function(_0xb64c7d){logger[_0xb1a0('0x7')](_0xb1a0('0x1d'),_0x8317eb,_0xb64c7d?'found':'notfound');return _0x10e675(_0xb64c7d);})[_0xb1a0('0xd')](function(_0x1006dc){logger[_0xb1a0('0x9')]('[utils][getUserByName]',_0x1006dc?util[_0xb1a0('0x8')](_0x1006dc,{'showHidden':![],'depth':null}):'');return _0x10e675(null);});}return _0x10e675(null);});};exports['getVoiceQueueByName']=function(_0x3fff58){return new BPromise(function(_0x5a809f,_0x38eab3){if(_0x3fff58){return client[_0xb1a0('0xa')](_0xb1a0('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xb1a0('0x10'),_0xb1a0('0x1f'),_0xb1a0('0x20'),_0xb1a0('0x21')],'where':{'name':_0x3fff58},'limit':0x1}})[_0xb1a0('0xb')](function(_0x1abda5){logger['debug'](_0xb1a0('0x22'),_0x3fff58,_0x1abda5?util[_0xb1a0('0x8')](_0x1abda5,{'showHidden':![],'depth':null}):'');logger[_0xb1a0('0x7')](_0xb1a0('0x23'),_0x3fff58,_0x1abda5?_0xb1a0('0x1a'):_0xb1a0('0x1b'));return _0x5a809f(_0x1abda5[_0xb1a0('0x15')]['length']?_0x1abda5['result'][0x0]:null);})[_0xb1a0('0xd')](function(_0x1826c3){logger['error'](_0xb1a0('0x24'),_0x1826c3?util[_0xb1a0('0x8')](_0x1826c3,{'showHidden':![],'depth':null}):'');return _0x5a809f(null);});}return _0x5a809f(null);});};exports[_0xb1a0('0x25')]=function(_0x25f44f,_0x69ef32){return moment(_0x25f44f)[_0xb1a0('0x26')](_0x69ef32,_0xb1a0('0x27'))[_0xb1a0('0x28')](_0xb1a0('0x29'));};exports[_0xb1a0('0x2a')]=function(_0x12ef87,_0x1a0e11){return moment(_0x12ef87)[_0xb1a0('0x2b')](_0x1a0e11,_0xb1a0('0x27'))[_0xb1a0('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb1a0('0x2c')]=function(_0x2bec57,_0x3732fb){return moment(_0x2bec57)[_0xb1a0('0x2d')](moment(_0x3732fb),_0xb1a0('0x27'));};exports['sumTime']=function(_0x5e5f88,_0x3973b1){return parseInt(_0x5e5f88,0xa)+parseInt(_0x3973b1,0xa);};exports[_0xb1a0('0x2e')]=function(){return moment()[_0xb1a0('0x28')](_0xb1a0('0x29'));};exports[_0xb1a0('0x2f')]=function(_0xab9e36,_0x503a1b){if(_0x503a1b){return moment(_0xab9e36)[_0xb1a0('0x2f')](_0x503a1b);}return!![];};exports[_0xb1a0('0x30')]=function(_0x520639,_0x49baab){if(_0x49baab){return moment(_0x520639)['isBefore'](_0x49baab);}else if(_0x520639){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 9363156..c8ca82b 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 _0xe81c=['error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','remoteAddress','url','statusCode','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','responseTime','agent_id','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','role','name','ensureDir','then','client','catch','user','no-user','data','timestamp'];(function(_0x585667,_0x493fd7){var _0x2e0da9=function(_0x3defff){while(--_0x3defff){_0x585667['push'](_0x585667['shift']());}};_0x2e0da9(++_0x493fd7);}(_0xe81c,0xde));var _0xce81=function(_0x49b984,_0x387c83){_0x49b984=_0x49b984-0x0;var _0x49d1e0=_0xe81c[_0x49b984];return _0x49d1e0;};var fs=require(_0xce81('0x0'));var _=require(_0xce81('0x1'));var ewinston=require(_0xce81('0x2'));var path=require(_0xce81('0x3'));var util=require(_0xce81('0x4'));var fileLogger=require(_0xce81('0x5'))[_0xce81('0x6')];var safeTemplate=require(_0xce81('0x7'))[_0xce81('0x8')];var maskSensitiveData=require(_0xce81('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0xba2bbd(_0x2fea69){var _0x15bae6=path[_0xce81('0xa')](_0xce81('0xb'),_0xce81('0xc'),'xcally');var _0x36ac0c=path[_0xce81('0xa')]('client',_0x2fea69[_0xce81('0xd')]+'-'+_0x2fea69[_0xce81('0xe')]);return fs[_0xce81('0xf')](path['join'](_0x15bae6,_0x36ac0c))[_0xce81('0x10')](function(){var _0x17d747=fileLogger(_0xce81('0x11'),path[_0xce81('0xa')](_0x15bae6,_0x36ac0c));return _0x17d747;})[_0xce81('0x12')](function(_0x2b4b41){throw _0x2b4b41;});}this[_0xce81('0xc')]=function(_0x586a93,_0xe9d5aa,_0x228f2a,_0x2f4388){return _0xba2bbd(_0x586a93[_0xce81('0x13')])[_0xce81('0x10')](function(_0x2bb684){var _0x47b94c=_0x2bb684[_0xe9d5aa];return _0x47b94c;})['then'](function(_0x48b75f){var _0xc24447=_0x586a93['user']?_0x586a93[_0xce81('0x13')]['id']:_0xce81('0x14');var _0x12ccd9=_0x2f4388[_0xce81('0x15')];var _0x1c0cef=_0x2f4388[_0xce81('0x16')];var _0x43568e=new Date(Number(_0x1c0cef));return _0x48b75f(_0xc24447,_0x43568e,_0x228f2a,_0x12ccd9);})['catch'](function(_0x2737d6){fileLogger(_0xce81('0x11'))[_0xce81('0x17')](_0x2737d6);});};}function setupLoggers(_0x5686b){return new Promise(function(_0x294a77){var _0x4c88f5=new ClientSideLogger();var _0x43e630=fileLogger(_0xce81('0x18'));var _0x2671da=fileLogger(_0xce81('0x19'));_0x5686b[_0xce81('0x1a')](_0xce81('0x1b'),_0x4c88f5);_0x5686b['use'](ewinston[_0xce81('0x1c')]({'winstonInstance':_0x43e630,'meta':![],'statusLevels':!![],'msg':function(_0x59b315,_0x3af281){var _0x25637c=_0xce81('0x1d');if(!_[_0xce81('0x1e')](_0x59b315[_0xce81('0x1f')])){_0x25637c+=_0xce81('0x20');var _0x7ad646=_0x59b315[_0xce81('0x1f')];maskSensitiveData(_0x7ad646);}return safeTemplate(util[_0xce81('0x21')](_0x25637c,_0x59b315[_0xce81('0x22')],_0x59b315['headers'][_0xce81('0x23')]?_0x59b315['headers']['x-forwarded-for']:_0x59b315[_0xce81('0x24')][_0xce81('0x25')]||_0x59b315['ip'],_0x59b315[_0xce81('0x26')],_0x3af281[_0xce81('0x27')],_0x3af281['responseTime'],_0x59b315[_0xce81('0x13')]?_0x59b315[_0xce81('0x13')]['id']:null,_0x59b315[_0xce81('0x13')]?_0x59b315[_0xce81('0x13')][_0xce81('0xe')]:null,_0x59b315[_0xce81('0x13')]?_0x59b315[_0xce81('0x13')][_0xce81('0xd')]:null,_0x7ad646?util['inspect'](_0x7ad646,![],null):''));}}));_0x5686b[_0xce81('0x28')](ewinston[_0xce81('0x1c')]({'winstonInstance':_0x2671da,'meta':![],'statusLevels':!![],'msg':function(_0x136bd1,_0x3b2b19){var _0x377b7=_0xce81('0x29');if(_0x136bd1[_0xce81('0x1f')]&&_0x136bd1[_0xce81('0x1f')][_0xce81('0x2a')]&&_0x136bd1[_0xce81('0x1f')]['agent_id']){_0x377b7=_0xce81('0x2b');}return util['format'](_0x377b7,_0x136bd1[_0xce81('0x22')],_0x136bd1[_0xce81('0x2c')]['x-forwarded-for']?_0x136bd1[_0xce81('0x2c')][_0xce81('0x23')]:_0x136bd1['connection'][_0xce81('0x25')]||_0x136bd1['ip'],_0x136bd1[_0xce81('0x26')],_0x3b2b19[_0xce81('0x27')],_0x3b2b19[_0xce81('0x2d')],_0x136bd1[_0xce81('0x13')]?_0x136bd1[_0xce81('0x13')]['id']:null,_0x136bd1[_0xce81('0x13')]?_0x136bd1['user'][_0xce81('0xe')]:null,_0x136bd1['user']?_0x136bd1[_0xce81('0x13')][_0xce81('0xd')]:null,_0x136bd1['body']&&_0x136bd1['body'][_0xce81('0x2a')]?_0x136bd1[_0xce81('0x1f')][_0xce81('0x2a')]:'other',_0x136bd1['body']&&_0x136bd1['body'][_0xce81('0x2e')]?_0x136bd1[_0xce81('0x1f')][_0xce81('0x2e')]:'',_0x136bd1['body']&&_0x136bd1[_0xce81('0x1f')][_0xce81('0x2f')]?_0x136bd1[_0xce81('0x1f')][_0xce81('0x2f')]:'');},'ignoreRoute':function(_0xe77781){var _0x51830d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51830d[_0xce81('0x30')](_0xe77781[_0xce81('0x26')]);}}));return _0x294a77();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x34d0=['agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','role','name','ensureDir','client','catch','user','then','no-user','timestamp','error','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','inspect','logger','%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','statusCode','other'];(function(_0x39a074,_0x14db8e){var _0x342dc2=function(_0x1caabd){while(--_0x1caabd){_0x39a074['push'](_0x39a074['shift']());}};_0x342dc2(++_0x14db8e);}(_0x34d0,0x1b3));var _0x034d=function(_0x40e914,_0x2af8d6){_0x40e914=_0x40e914-0x0;var _0x57e403=_0x34d0[_0x40e914];return _0x57e403;};var fs=require(_0x034d('0x0'));var _=require(_0x034d('0x1'));var ewinston=require(_0x034d('0x2'));var path=require('path');var util=require(_0x034d('0x3'));var fileLogger=require(_0x034d('0x4'))[_0x034d('0x5')];var safeTemplate=require(_0x034d('0x6'))[_0x034d('0x7')];var maskSensitiveData=require(_0x034d('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x4f1a8e(_0x1431f7){var _0x11604b=path[_0x034d('0x9')](_0x034d('0xa'),_0x034d('0xb'),_0x034d('0xc'));var _0x38705d=path['join']('client',_0x1431f7[_0x034d('0xd')]+'-'+_0x1431f7[_0x034d('0xe')]);return fs[_0x034d('0xf')](path[_0x034d('0x9')](_0x11604b,_0x38705d))['then'](function(){var _0xd3c46b=fileLogger(_0x034d('0x10'),path[_0x034d('0x9')](_0x11604b,_0x38705d));return _0xd3c46b;})[_0x034d('0x11')](function(_0x3e4823){throw _0x3e4823;});}this[_0x034d('0xb')]=function(_0x6f58a0,_0x65a3fd,_0x4113b4,_0x384ede){return _0x4f1a8e(_0x6f58a0[_0x034d('0x12')])[_0x034d('0x13')](function(_0x1bbf62){var _0x50233e=_0x1bbf62[_0x65a3fd];return _0x50233e;})[_0x034d('0x13')](function(_0x357c36){var _0x18a7fa=_0x6f58a0['user']?_0x6f58a0[_0x034d('0x12')]['id']:_0x034d('0x14');var _0x36e351=_0x384ede['data'];var _0x5c2c4d=_0x384ede[_0x034d('0x15')];var _0x52dd45=new Date(Number(_0x5c2c4d));return _0x357c36(_0x18a7fa,_0x52dd45,_0x4113b4,_0x36e351);})[_0x034d('0x11')](function(_0x429243){fileLogger(_0x034d('0x10'))[_0x034d('0x16')](_0x429243);});};}function setupLoggers(_0x41f736){return new Promise(function(_0x55536d){var _0xf98a2e=new ClientSideLogger();var _0x47292e=fileLogger('api');var _0x1ecd4b=fileLogger(_0x034d('0x17'));_0x41f736[_0x034d('0x18')]('client-side-logger',_0xf98a2e);_0x41f736[_0x034d('0x19')](ewinston['logger']({'winstonInstance':_0x47292e,'meta':![],'statusLevels':!![],'msg':function(_0xba0cf3,_0x2d80b2){var _0x3bca6d=_0x034d('0x1a');if(!_[_0x034d('0x1b')](_0xba0cf3[_0x034d('0x1c')])){_0x3bca6d+=_0x034d('0x1d');var _0x5f3dc8=_0xba0cf3[_0x034d('0x1c')];maskSensitiveData(_0x5f3dc8);}return safeTemplate(util['format'](_0x3bca6d,_0xba0cf3[_0x034d('0x1e')],_0xba0cf3[_0x034d('0x1f')][_0x034d('0x20')]?_0xba0cf3[_0x034d('0x1f')][_0x034d('0x20')]:_0xba0cf3[_0x034d('0x21')][_0x034d('0x22')]||_0xba0cf3['ip'],_0xba0cf3[_0x034d('0x23')],_0x2d80b2['statusCode'],_0x2d80b2['responseTime'],_0xba0cf3[_0x034d('0x12')]?_0xba0cf3[_0x034d('0x12')]['id']:null,_0xba0cf3[_0x034d('0x12')]?_0xba0cf3[_0x034d('0x12')][_0x034d('0xe')]:null,_0xba0cf3[_0x034d('0x12')]?_0xba0cf3[_0x034d('0x12')]['role']:null,_0x5f3dc8?util[_0x034d('0x24')](_0x5f3dc8,![],null):''));}}));_0x41f736['use'](ewinston[_0x034d('0x25')]({'winstonInstance':_0x1ecd4b,'meta':![],'statusLevels':!![],'msg':function(_0x220214,_0x4e2a23){var _0xdb5dd6=_0x034d('0x26');if(_0x220214['body']&&_0x220214[_0x034d('0x1c')][_0x034d('0x27')]&&_0x220214[_0x034d('0x1c')][_0x034d('0x28')]){_0xdb5dd6=_0x034d('0x29');}return util[_0x034d('0x2a')](_0xdb5dd6,_0x220214[_0x034d('0x1e')],_0x220214[_0x034d('0x1f')]['x-forwarded-for']?_0x220214[_0x034d('0x1f')][_0x034d('0x20')]:_0x220214['connection']['remoteAddress']||_0x220214['ip'],_0x220214[_0x034d('0x23')],_0x4e2a23[_0x034d('0x2b')],_0x4e2a23['responseTime'],_0x220214[_0x034d('0x12')]?_0x220214[_0x034d('0x12')]['id']:null,_0x220214['user']?_0x220214[_0x034d('0x12')][_0x034d('0xe')]:null,_0x220214[_0x034d('0x12')]?_0x220214['user'][_0x034d('0xd')]:null,_0x220214[_0x034d('0x1c')]&&_0x220214[_0x034d('0x1c')][_0x034d('0x27')]?_0x220214[_0x034d('0x1c')][_0x034d('0x27')]:_0x034d('0x2c'),_0x220214[_0x034d('0x1c')]&&_0x220214[_0x034d('0x1c')]['agent_id']?_0x220214[_0x034d('0x1c')][_0x034d('0x28')]:'',_0x220214[_0x034d('0x1c')]&&_0x220214[_0x034d('0x1c')][_0x034d('0x2d')]?_0x220214[_0x034d('0x1c')][_0x034d('0x2d')]:'');},'ignoreRoute':function(_0x3d567f){var _0x377f4f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x377f4f[_0x034d('0x2e')](_0x3d567f[_0x034d('0x23')]);}}));return _0x55536d();});}exports[_0x034d('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f6fbdba..f7a7fae 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5628=['info','redBG\x20white','red','white','bold\x20white','bold\x20green','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','Logger','transports','warn','format','%s-%s','error','File','Console','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase'];(function(_0x474c7e,_0x131f66){var _0x284608=function(_0x5c4841){while(--_0x5c4841){_0x474c7e['push'](_0x474c7e['shift']());}};_0x284608(++_0x131f66);}(_0x5628,0x1aa));var _0x8562=function(_0xf8bd19,_0x476c09){_0xf8bd19=_0xf8bd19-0x0;var _0x376ded=_0x5628[_0xf8bd19];return _0x376ded;};'use strict';var path=require(_0x8562('0x0'));var util=require(_0x8562('0x1'));var moment=require(_0x8562('0x2'));var winston=require('winston');var config=require(_0x8562('0x3'));var debugLevel=config[_0x8562('0x4')]?config[_0x8562('0x4')][_0x8562('0x5')]():_0x8562('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':_0x8562('0x7'),'error':_0x8562('0x8'),'warn':'bold\x20yellow','info':_0x8562('0x9'),'print':_0x8562('0xa'),'success':_0x8562('0xb'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x8562('0xc')};winston[_0x8562('0xd')](XC_LOG_COLORS);function getLogFileName(_0x479c4c,_0x116de4,_0x41a117){var _0x259ba5=_0x479c4c||_0x8562('0xe');return path[_0x8562('0xf')](_0x259ba5,util['format'](_0x8562('0x10'),_0x116de4,_0x41a117));}function formatter(_0x1c0152,_0x4261cc){_0x4261cc['message']=_0x4261cc[_0x8562('0x11')][_0x8562('0x12')](/@@{/g,_0x8562('0x13'))[_0x8562('0x12')](/}@@/g,_0x8562('0x14'))[_0x8562('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x8562('0x15'),moment()['format'](_0x8562('0x16')),_0x4261cc[_0x8562('0x17')][_0x8562('0x18')](),_0x1c0152,_0x4261cc[_0x8562('0x11')]);}function fileFormat(_0x1c490f,_0x273505){_0x273505[_0x8562('0x11')]=_0x273505[_0x8562('0x11')][_0x8562('0x12')](/@@{/g,_0x8562('0x13'))['replace'](/}@@/g,_0x8562('0x14'))[_0x8562('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x3db70c=_0x273505[_0x8562('0x19')]&&Object['keys'](_0x273505[_0x8562('0x19')])['length']?'\x0a\x09'+JSON['stringify'](_0x273505[_0x8562('0x19')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x8562('0x16')),_0x273505[_0x8562('0x17')][_0x8562('0x18')](),_0x1c490f,_0x273505[_0x8562('0x11')],_0x3db70c);}function consoleLogger(){var _0x338982=new winston[(_0x8562('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8562('0x1b'))]['Console']({'level':_0x8562('0x1c'),'json':![],'formatter':function(_0xdddea){return formatter('',_0xdddea);}})]});return _0x338982;}function fileLogger(_0x3cf7fa,_0x29dc9a){var _0x27a96f=new winston[(_0x8562('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0x8562('0x1d')](_0x8562('0x1e'),_0x3cf7fa,_0x8562('0x1f')),'filename':getLogFileName(_0x29dc9a,_0x3cf7fa,_0x8562('0x1f')),'level':_0x8562('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e73ae){return fileFormat(_0x3cf7fa,_0x4e73ae);}}),new winston[(_0x8562('0x1b'))][(_0x8562('0x20'))]({'name':util[_0x8562('0x1d')](_0x8562('0x1e'),_0x3cf7fa,debugLevel),'filename':getLogFileName(_0x29dc9a,_0x3cf7fa,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50d86a){return fileFormat(_0x3cf7fa,_0x50d86a);}}),new winston['transports'][(_0x8562('0x21'))]({'level':_0x8562('0x1c'),'json':![],'formatter':function(_0x20733a){return fileFormat(_0x3cf7fa,_0x20733a);}})]});return _0x27a96f;}exports[_0x8562('0x22')]=consoleLogger;exports[_0x8562('0x23')]=fileLogger; \ No newline at end of file +var _0xbdf2=['replace','{{{','format','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message'];(function(_0x4ff3a9,_0x583743){var _0x479f45=function(_0xb924dd){while(--_0xb924dd){_0x4ff3a9['push'](_0x4ff3a9['shift']());}};_0x479f45(++_0x583743);}(_0xbdf2,0x12c));var _0x2bdf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbdf2[_0x126558];return _0x1f6d14;};'use strict';var path=require(_0x2bdf('0x0'));var util=require(_0x2bdf('0x1'));var moment=require(_0x2bdf('0x2'));var winston=require(_0x2bdf('0x3'));var config=require(_0x2bdf('0x4'));var debugLevel=config['debugLevel']?config[_0x2bdf('0x5')]['toLowerCase']():_0x2bdf('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':_0x2bdf('0x7'),'error':_0x2bdf('0x8'),'warn':_0x2bdf('0x9'),'info':_0x2bdf('0xa'),'print':_0x2bdf('0xb'),'success':_0x2bdf('0xc'),'http':'gray','verbose':_0x2bdf('0xd'),'debug':_0x2bdf('0xe'),'silly':_0x2bdf('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x186a83,_0x1b24c5,_0x455164){var _0x377c27=_0x186a83||_0x2bdf('0x10');return path[_0x2bdf('0x11')](_0x377c27,util['format'](_0x2bdf('0x12'),_0x1b24c5,_0x455164));}function formatter(_0x325541,_0x3d13e9){_0x3d13e9[_0x2bdf('0x13')]=_0x3d13e9['message'][_0x2bdf('0x14')](/@@{/g,_0x2bdf('0x15'))[_0x2bdf('0x14')](/}@@/g,'}}}')[_0x2bdf('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x2bdf('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x2bdf('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3d13e9[_0x2bdf('0x17')][_0x2bdf('0x18')](),_0x325541,_0x3d13e9[_0x2bdf('0x13')]);}function fileFormat(_0x3bd5b0,_0x8abc23){_0x8abc23[_0x2bdf('0x13')]=_0x8abc23['message'][_0x2bdf('0x14')](/@@{/g,_0x2bdf('0x15'))[_0x2bdf('0x14')](/}@@/g,'}}}')[_0x2bdf('0x14')](/@{/g,'{{')[_0x2bdf('0x14')](/}@/g,'}}');var _0x160645=_0x8abc23[_0x2bdf('0x19')]&&Object[_0x2bdf('0x1a')](_0x8abc23[_0x2bdf('0x19')])[_0x2bdf('0x1b')]?'\x0a\x09'+JSON[_0x2bdf('0x1c')](_0x8abc23[_0x2bdf('0x19')]):'';return util['format'](_0x2bdf('0x1d'),moment()[_0x2bdf('0x16')](_0x2bdf('0x1e')),_0x8abc23[_0x2bdf('0x17')][_0x2bdf('0x18')](),_0x3bd5b0,_0x8abc23['message'],_0x160645);}function consoleLogger(){var _0x23a258=new winston[(_0x2bdf('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2bdf('0x20'))][(_0x2bdf('0x21'))]({'level':_0x2bdf('0x22'),'json':![],'formatter':function(_0x44aac0){return formatter('',_0x44aac0);}})]});return _0x23a258;}function fileLogger(_0x34126a,_0x55fca9){var _0x3f688e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2bdf('0x20'))]['File']({'name':util[_0x2bdf('0x16')](_0x2bdf('0x23'),_0x34126a,_0x2bdf('0x24')),'filename':getLogFileName(_0x55fca9,_0x34126a,_0x2bdf('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x11b3e8){return fileFormat(_0x34126a,_0x11b3e8);}}),new winston[(_0x2bdf('0x20'))][(_0x2bdf('0x25'))]({'name':util[_0x2bdf('0x16')](_0x2bdf('0x23'),_0x34126a,debugLevel),'filename':getLogFileName(_0x55fca9,_0x34126a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1f81cf){return fileFormat(_0x34126a,_0x1f81cf);}}),new winston[(_0x2bdf('0x20'))]['Console']({'level':'warn','json':![],'formatter':function(_0x8e7b85){return fileFormat(_0x34126a,_0x8e7b85);}})]});return _0x3f688e;}exports[_0x2bdf('0x26')]=consoleLogger;exports[_0x2bdf('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e5bcc53..e0c2411 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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x1967,0x173));var _0x7196=function(_0x1461ca,_0x13f374){_0x1461ca=_0x1461ca-0x0;var _0x1957d6=_0x1967[_0x1461ca];return _0x1957d6;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x861c73,_0x3d213a){_0x861c73=_0x861c73-0x0;var _0x2c7271=_0x7a54[_0x861c73];return _0x2c7271;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3ceb536..831a5b9 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(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4c058f,_0x18e432){_0x4c058f=_0x4c058f-0x0;var _0x19df4d=_0xf4f4[_0x4c058f];return _0x19df4d;};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 _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x4a62de,_0x2c5362){var _0x52962b=function(_0x1d7946){while(--_0x1d7946){_0x4a62de['push'](_0x4a62de['shift']());}};_0x52962b(++_0x2c5362);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file